From 66f3ba823aade02643c061072c0b360cc3cf650a Mon Sep 17 00:00:00 2001 From: Andrea Amorese Date: Wed, 25 Aug 2021 09:31:02 +0200 Subject: [PATCH] Built motion from commit c498a62d.|2.5.34 --- apidoc/api_project.js | 2 +- apidoc/api_project.json | 2 +- server/api/action/action.attributes.js | 2 +- server/api/action/action.controller.js | 2 +- server/api/action/action.model.js | 2 +- server/api/action/action.rpc.js | 2 +- server/api/action/index.js | 2 +- .../analyticCustomReport.attributes.js | 2 +- .../analyticCustomReport.controller.js | 2 +- .../analyticCustomReport.model.js | 2 +- .../analyticCustomReport.rpc.js | 2 +- server/api/analyticCustomReport/index.js | 2 +- .../analyticDefaultReport.attributes.js | 2 +- .../analyticDefaultReport.controller.js | 2 +- .../analyticDefaultReport.model.js | 2 +- .../analyticDefaultReport.rpc.js | 2 +- server/api/analyticDefaultReport/index.js | 2 +- .../analyticExtractedReport.attributes.js | 2 +- .../analyticExtractedReport.controller.js | 2 +- .../analyticExtractedReport.model.js | 2 +- .../analyticExtractedReport.rpc.js | 2 +- server/api/analyticExtractedReport/index.js | 2 +- .../analyticFieldReport.attributes.js | 2 +- .../analyticFieldReport.controller.js | 2 +- .../analyticFieldReport.model.js | 2 +- .../analyticFieldReport/analyticFieldReport.rpc.js | 2 +- server/api/analyticFieldReport/index.js | 2 +- .../analyticMetric/analyticMetric.attributes.js | 2 +- .../analyticMetric/analyticMetric.controller.js | 2 +- server/api/analyticMetric/analyticMetric.model.js | 2 +- server/api/analyticMetric/analyticMetric.rpc.js | 2 +- server/api/analyticMetric/index.js | 2 +- .../analyticTreeReport.attributes.js | 2 +- .../analyticTreeReport.controller.js | 2 +- .../analyticTreeReport/analyticTreeReport.model.js | 2 +- .../analyticTreeReport/analyticTreeReport.rpc.js | 2 +- server/api/analyticTreeReport/index.js | 2 +- server/api/attachment/attachment.attributes.js | 2 +- server/api/attachment/attachment.controller.js | 2 +- server/api/attachment/attachment.model.js | 2 +- server/api/attachment/attachment.rpc.js | 2 +- server/api/attachment/index.js | 2 +- server/api/authGoogle/authGoogle.controller.js | 2 +- server/api/authGoogle/index.js | 2 +- server/api/authLocal/authLocal.controller.js | 2 +- server/api/authLocal/index.js | 2 +- server/api/automation/automation.attributes.js | 2 +- server/api/automation/automation.controller.js | 2 +- server/api/automation/automation.model.js | 2 +- server/api/automation/automation.rpc.js | 2 +- server/api/automation/index.js | 2 +- server/api/campaign/campaign.attributes.js | 2 +- server/api/campaign/campaign.controller.js | 2 +- server/api/campaign/campaign.model.js | 2 +- server/api/campaign/campaign.rpc.js | 2 +- server/api/campaign/index.js | 2 +- server/api/cannedAnswer/cannedAnswer.attributes.js | 2 +- server/api/cannedAnswer/cannedAnswer.controller.js | 2 +- server/api/cannedAnswer/cannedAnswer.model.js | 2 +- server/api/cannedAnswer/cannedAnswer.rpc.js | 2 +- server/api/cannedAnswer/index.js | 2 +- server/api/cdr/cdr.attributes.js | 2 +- server/api/cdr/cdr.controller.js | 2 +- server/api/cdr/cdr.model.js | 2 +- server/api/cdr/cdr.rpc.js | 2 +- server/api/cdr/index.js | 2 +- .../chatApplication/chatApplication.attributes.js | 2 +- .../chatApplication/chatApplication.controller.js | 2 +- .../api/chatApplication/chatApplication.model.js | 2 +- server/api/chatApplication/chatApplication.rpc.js | 2 +- server/api/chatApplication/index.js | 2 +- server/api/chatGroup/chatGroup.attributes.js | 2 +- server/api/chatGroup/chatGroup.controller.js | 2 +- server/api/chatGroup/chatGroup.events.js | 2 +- server/api/chatGroup/chatGroup.model.js | 2 +- server/api/chatGroup/chatGroup.rpc.js | 2 +- server/api/chatGroup/chatGroup.socket.js | 2 +- server/api/chatGroup/index.js | 2 +- .../chatInteraction/chatInteraction.attributes.js | 2 +- .../chatInteraction/chatInteraction.controller.js | 2 +- .../api/chatInteraction/chatInteraction.events.js | 2 +- .../api/chatInteraction/chatInteraction.model.js | 2 +- server/api/chatInteraction/chatInteraction.rpc.js | 2 +- .../api/chatInteraction/chatInteraction.socket.js | 2 +- server/api/chatInteraction/index.js | 2 +- .../chatInternalMessage.attributes.js | 2 +- .../chatInternalMessage.controller.js | 2 +- .../chatInternalMessage.events.js | 2 +- .../chatInternalMessage.model.js | 2 +- .../chatInternalMessage/chatInternalMessage.rpc.js | 2 +- .../chatInternalMessage.socket.js | 2 +- server/api/chatInternalMessage/index.js | 2 +- server/api/chatMessage/chatMessage.attributes.js | 2 +- server/api/chatMessage/chatMessage.controller.js | 2 +- server/api/chatMessage/chatMessage.events.js | 2 +- server/api/chatMessage/chatMessage.model.js | 2 +- server/api/chatMessage/chatMessage.rpc.js | 2 +- server/api/chatMessage/chatMessage.socket.js | 2 +- server/api/chatMessage/index.js | 2 +- .../chatOfflineMessage.attributes.js | 2 +- .../chatOfflineMessage.controller.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.model.js | 2 +- .../chatOfflineMessage/chatOfflineMessage.rpc.js | 2 +- server/api/chatOfflineMessage/index.js | 2 +- .../chatProactiveAction.attributes.js | 2 +- .../chatProactiveAction.controller.js | 2 +- .../chatProactiveAction.model.js | 2 +- .../chatProactiveAction/chatProactiveAction.rpc.js | 2 +- server/api/chatProactiveAction/index.js | 2 +- server/api/chatQueue/chatQueue.attributes.js | 2 +- server/api/chatQueue/chatQueue.controller.js | 2 +- server/api/chatQueue/chatQueue.events.js | 2 +- server/api/chatQueue/chatQueue.model.js | 2 +- server/api/chatQueue/chatQueue.rpc.js | 2 +- server/api/chatQueue/chatQueue.socket.js | 2 +- server/api/chatQueue/index.js | 2 +- .../chatQueueReport/chatQueueReport.attributes.js | 2 +- .../chatQueueReport/chatQueueReport.controller.js | 2 +- .../api/chatQueueReport/chatQueueReport.model.js | 2 +- server/api/chatQueueReport/chatQueueReport.rpc.js | 2 +- server/api/chatQueueReport/index.js | 2 +- .../chatTransferReport.attributes.js | 2 +- .../chatTransferReport.controller.js | 2 +- .../chatTransferReport/chatTransferReport.model.js | 2 +- .../chatTransferReport/chatTransferReport.rpc.js | 2 +- server/api/chatTransferReport/index.js | 2 +- server/api/chatWebsite/chatWebsite.attributes.js | 2 +- server/api/chatWebsite/chatWebsite.controller.js | 2 +- server/api/chatWebsite/chatWebsite.events.js | 2 +- server/api/chatWebsite/chatWebsite.model.js | 2 +- server/api/chatWebsite/chatWebsite.rpc.js | 2 +- server/api/chatWebsite/chatWebsite.socket.js | 2 +- server/api/chatWebsite/index.js | 2 +- .../api/cloudProvider/cloudProvider.attributes.js | 2 +- .../api/cloudProvider/cloudProvider.controller.js | 2 +- server/api/cloudProvider/cloudProvider.model.js | 2 +- server/api/cloudProvider/cloudProvider.rpc.js | 2 +- server/api/cloudProvider/index.js | 2 +- server/api/cmCompany/cmCompany.attributes.js | 2 +- server/api/cmCompany/cmCompany.controller.js | 2 +- server/api/cmCompany/cmCompany.model.js | 2 +- server/api/cmCompany/cmCompany.rpc.js | 2 +- server/api/cmCompany/index.js | 2 +- server/api/cmContact/cmContact.attributes.js | 2 +- server/api/cmContact/cmContact.controller.js | 2 +- server/api/cmContact/cmContact.events.js | 2 +- server/api/cmContact/cmContact.model.js | 2 +- server/api/cmContact/cmContact.rpc.js | 2 +- server/api/cmContact/cmContact.socket.js | 2 +- server/api/cmContact/index.js | 2 +- .../api/cmCustomField/cmCustomField.attributes.js | 2 +- .../api/cmCustomField/cmCustomField.controller.js | 2 +- server/api/cmCustomField/cmCustomField.model.js | 2 +- server/api/cmCustomField/cmCustomField.rpc.js | 2 +- server/api/cmCustomField/index.js | 2 +- server/api/cmHopper/cmHopper.attributes.js | 2 +- server/api/cmHopper/cmHopper.controller.js | 2 +- server/api/cmHopper/cmHopper.model.js | 2 +- server/api/cmHopper/cmHopper.rpc.js | 2 +- server/api/cmHopper/index.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.attributes.js | 2 +- .../api/cmHopperBlack/cmHopperBlack.controller.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.model.js | 2 +- server/api/cmHopperBlack/cmHopperBlack.rpc.js | 2 +- server/api/cmHopperBlack/index.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.attributes.js | 2 +- .../api/cmHopperFinal/cmHopperFinal.controller.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.model.js | 2 +- server/api/cmHopperFinal/cmHopperFinal.rpc.js | 2 +- server/api/cmHopperFinal/index.js | 2 +- .../cmHopperHistory/cmHopperHistory.attributes.js | 2 +- .../cmHopperHistory/cmHopperHistory.controller.js | 2 +- .../api/cmHopperHistory/cmHopperHistory.model.js | 2 +- server/api/cmHopperHistory/cmHopperHistory.rpc.js | 2 +- server/api/cmHopperHistory/index.js | 2 +- server/api/cmList/cmList.attributes.js | 2 +- server/api/cmList/cmList.controller.js | 2 +- server/api/cmList/cmList.events.js | 2 +- server/api/cmList/cmList.model.js | 2 +- server/api/cmList/cmList.rpc.js | 2 +- server/api/cmList/cmList.socket.js | 2 +- server/api/cmList/index.js | 2 +- server/api/condition/condition.attributes.js | 2 +- server/api/condition/condition.controller.js | 2 +- server/api/condition/condition.model.js | 2 +- server/api/condition/condition.rpc.js | 2 +- server/api/condition/index.js | 2 +- server/api/dashboard/dashboard.attributes.js | 2 +- server/api/dashboard/dashboard.controller.js | 2 +- server/api/dashboard/dashboard.events.js | 2 +- server/api/dashboard/dashboard.model.js | 2 +- server/api/dashboard/dashboard.rpc.js | 2 +- server/api/dashboard/dashboard.socket.js | 2 +- server/api/dashboard/index.js | 2 +- .../api/dashboardItem/dashboardItem.attributes.js | 2 +- .../api/dashboardItem/dashboardItem.controller.js | 2 +- server/api/dashboardItem/dashboardItem.events.js | 2 +- server/api/dashboardItem/dashboardItem.model.js | 2 +- server/api/dashboardItem/dashboardItem.rpc.js | 2 +- server/api/dashboardItem/dashboardItem.socket.js | 2 +- server/api/dashboardItem/index.js | 2 +- server/api/disposition/disposition.attributes.js | 2 +- server/api/disposition/disposition.controller.js | 2 +- server/api/disposition/disposition.model.js | 2 +- server/api/disposition/disposition.rpc.js | 2 +- server/api/disposition/index.js | 2 +- server/api/faxAccount/faxAccount.attributes.js | 2 +- server/api/faxAccount/faxAccount.controller.js | 2 +- server/api/faxAccount/faxAccount.events.js | 2 +- server/api/faxAccount/faxAccount.model.js | 2 +- server/api/faxAccount/faxAccount.rpc.js | 2 +- server/api/faxAccount/faxAccount.socket.js | 2 +- server/api/faxAccount/index.js | 2 +- .../faxApplication/faxApplication.attributes.js | 2 +- .../faxApplication/faxApplication.controller.js | 2 +- server/api/faxApplication/faxApplication.model.js | 2 +- server/api/faxApplication/faxApplication.rpc.js | 2 +- server/api/faxApplication/index.js | 2 +- .../faxInteraction/faxInteraction.attributes.js | 2 +- .../faxInteraction/faxInteraction.controller.js | 2 +- server/api/faxInteraction/faxInteraction.events.js | 2 +- server/api/faxInteraction/faxInteraction.model.js | 2 +- server/api/faxInteraction/faxInteraction.rpc.js | 2 +- server/api/faxInteraction/faxInteraction.socket.js | 2 +- server/api/faxInteraction/index.js | 2 +- server/api/faxMessage/faxMessage.attributes.js | 2 +- server/api/faxMessage/faxMessage.controller.js | 2 +- server/api/faxMessage/faxMessage.events.js | 2 +- server/api/faxMessage/faxMessage.model.js | 2 +- server/api/faxMessage/faxMessage.rpc.js | 2 +- server/api/faxMessage/faxMessage.socket.js | 2 +- server/api/faxMessage/index.js | 2 +- server/api/faxQueue/faxQueue.attributes.js | 2 +- server/api/faxQueue/faxQueue.controller.js | 2 +- server/api/faxQueue/faxQueue.events.js | 2 +- server/api/faxQueue/faxQueue.model.js | 2 +- server/api/faxQueue/faxQueue.rpc.js | 2 +- server/api/faxQueue/faxQueue.socket.js | 2 +- server/api/faxQueue/index.js | 2 +- .../faxQueueReport/faxQueueReport.attributes.js | 2 +- .../faxQueueReport/faxQueueReport.controller.js | 2 +- server/api/faxQueueReport/faxQueueReport.model.js | 2 +- server/api/faxQueueReport/faxQueueReport.rpc.js | 2 +- server/api/faxQueueReport/index.js | 2 +- .../faxTransferReport.attributes.js | 2 +- .../faxTransferReport.controller.js | 2 +- .../faxTransferReport/faxTransferReport.model.js | 2 +- .../api/faxTransferReport/faxTransferReport.rpc.js | 2 +- server/api/faxTransferReport/index.js | 2 +- server/api/intDeskAccount/index.js | 2 +- .../intDeskAccount/intDeskAccount.attributes.js | 2 +- .../intDeskAccount/intDeskAccount.controller.js | 2 +- server/api/intDeskAccount/intDeskAccount.model.js | 2 +- server/api/intDeskAccount/intDeskAccount.rpc.js | 2 +- server/api/intDeskConfiguration/index.js | 2 +- .../intDeskConfiguration.attributes.js | 2 +- .../intDeskConfiguration.controller.js | 2 +- .../intDeskConfiguration.model.js | 2 +- .../intDeskConfiguration.rpc.js | 2 +- server/api/intDeskField/index.js | 2 +- server/api/intDeskField/intDeskField.attributes.js | 2 +- server/api/intDeskField/intDeskField.controller.js | 2 +- server/api/intDeskField/intDeskField.model.js | 2 +- server/api/intDeskField/intDeskField.rpc.js | 2 +- server/api/intDynamics365Account/index.js | 2 +- .../intDynamics365Account.attributes.js | 2 +- .../intDynamics365Account.controller.js | 2 +- .../intDynamics365Account.model.js | 2 +- .../intDynamics365Account.rpc.js | 2 +- server/api/intDynamics365Configuration/index.js | 2 +- .../intDynamics365Configuration.attributes.js | 2 +- .../intDynamics365Configuration.controller.js | 2 +- .../intDynamics365Configuration.model.js | 2 +- .../intDynamics365Configuration.rpc.js | 2 +- server/api/intDynamics365Field/index.js | 2 +- .../intDynamics365Field.attributes.js | 2 +- .../intDynamics365Field.controller.js | 2 +- .../intDynamics365Field.model.js | 2 +- .../intDynamics365Field/intDynamics365Field.rpc.js | 2 +- server/api/intFreshdeskAccount/index.js | 2 +- .../intFreshdeskAccount.attributes.js | 2 +- .../intFreshdeskAccount.controller.js | 2 +- .../intFreshdeskAccount.model.js | 2 +- .../intFreshdeskAccount/intFreshdeskAccount.rpc.js | 2 +- server/api/intFreshdeskConfiguration/index.js | 2 +- .../intFreshdeskConfiguration.attributes.js | 2 +- .../intFreshdeskConfiguration.controller.js | 2 +- .../intFreshdeskConfiguration.model.js | 2 +- .../intFreshdeskConfiguration.rpc.js | 2 +- server/api/intFreshdeskField/index.js | 2 +- .../intFreshdeskField.attributes.js | 2 +- .../intFreshdeskField.controller.js | 2 +- .../intFreshdeskField/intFreshdeskField.model.js | 2 +- .../api/intFreshdeskField/intFreshdeskField.rpc.js | 2 +- server/api/intFreshsalesAccount/index.js | 2 +- .../intFreshsalesAccount.attributes.js | 2 +- .../intFreshsalesAccount.controller.js | 2 +- .../intFreshsalesAccount.model.js | 2 +- .../intFreshsalesAccount.rpc.js | 2 +- server/api/intFreshsalesConfiguration/index.js | 2 +- .../intFreshsalesConfiguration.attributes.js | 2 +- .../intFreshsalesConfiguration.controller.js | 2 +- .../intFreshsalesConfiguration.model.js | 2 +- .../intFreshsalesConfiguration.rpc.js | 2 +- server/api/intFreshsalesField/index.js | 2 +- .../intFreshsalesField.attributes.js | 2 +- .../intFreshsalesField.controller.js | 2 +- .../intFreshsalesField/intFreshsalesField.model.js | 2 +- .../intFreshsalesField/intFreshsalesField.rpc.js | 2 +- server/api/intSalesforceAccount/index.js | 2 +- .../intSalesforceAccount.attributes.js | 2 +- .../intSalesforceAccount.controller.js | 2 +- .../intSalesforceAccount.model.js | 2 +- .../intSalesforceAccount.rpc.js | 2 +- server/api/intSalesforceConfiguration/index.js | 2 +- .../intSalesforceConfiguration.attributes.js | 2 +- .../intSalesforceConfiguration.controller.js | 2 +- .../intSalesforceConfiguration.model.js | 2 +- .../intSalesforceConfiguration.rpc.js | 2 +- server/api/intSalesforceField/index.js | 2 +- .../intSalesforceField.attributes.js | 2 +- .../intSalesforceField.controller.js | 2 +- .../intSalesforceField/intSalesforceField.model.js | 2 +- .../intSalesforceField/intSalesforceField.rpc.js | 2 +- server/api/intServicenowAccount/index.js | 2 +- .../intServicenowAccount.attributes.js | 2 +- .../intServicenowAccount.controller.js | 2 +- .../intServicenowAccount.model.js | 2 +- .../intServicenowAccount.rpc.js | 2 +- server/api/intServicenowConfiguration/index.js | 2 +- .../intServicenowConfiguration.attributes.js | 2 +- .../intServicenowConfiguration.controller.js | 2 +- .../intServicenowConfiguration.model.js | 2 +- .../intServicenowConfiguration.rpc.js | 2 +- server/api/intServicenowField/index.js | 2 +- .../intServicenowField.attributes.js | 2 +- .../intServicenowField.controller.js | 2 +- .../intServicenowField/intServicenowField.model.js | 2 +- .../intServicenowField/intServicenowField.rpc.js | 2 +- server/api/intSugarcrmAccount/index.js | 2 +- .../intSugarcrmAccount.attributes.js | 2 +- .../intSugarcrmAccount.controller.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.model.js | 2 +- .../intSugarcrmAccount/intSugarcrmAccount.rpc.js | 2 +- server/api/intSugarcrmConfiguration/index.js | 2 +- .../intSugarcrmConfiguration.attributes.js | 2 +- .../intSugarcrmConfiguration.controller.js | 2 +- .../intSugarcrmConfiguration.model.js | 2 +- .../intSugarcrmConfiguration.rpc.js | 2 +- server/api/intSugarcrmField/index.js | 2 +- .../intSugarcrmField.attributes.js | 2 +- .../intSugarcrmField.controller.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.model.js | 2 +- .../api/intSugarcrmField/intSugarcrmField.rpc.js | 2 +- server/api/intVtigerAccount/index.js | 2 +- .../intVtigerAccount.attributes.js | 2 +- .../intVtigerAccount.controller.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.model.js | 2 +- .../api/intVtigerAccount/intVtigerAccount.rpc.js | 2 +- server/api/intVtigerConfiguration/index.js | 2 +- .../intVtigerConfiguration.attributes.js | 2 +- .../intVtigerConfiguration.controller.js | 2 +- .../intVtigerConfiguration.model.js | 2 +- .../intVtigerConfiguration.rpc.js | 2 +- server/api/intVtigerField/index.js | 2 +- .../intVtigerField/intVtigerField.attributes.js | 2 +- .../intVtigerField/intVtigerField.controller.js | 2 +- server/api/intVtigerField/intVtigerField.model.js | 2 +- server/api/intVtigerField/intVtigerField.rpc.js | 2 +- server/api/intZendeskAccount/index.js | 2 +- .../intZendeskAccount.attributes.js | 2 +- .../intZendeskAccount.controller.js | 2 +- .../intZendeskAccount/intZendeskAccount.model.js | 2 +- .../api/intZendeskAccount/intZendeskAccount.rpc.js | 2 +- server/api/intZendeskConfiguration/index.js | 2 +- .../intZendeskConfiguration.attributes.js | 2 +- .../intZendeskConfiguration.controller.js | 2 +- .../intZendeskConfiguration.model.js | 2 +- .../intZendeskConfiguration.rpc.js | 2 +- server/api/intZendeskField/index.js | 2 +- .../intZendeskField/intZendeskField.attributes.js | 2 +- .../intZendeskField/intZendeskField.controller.js | 2 +- .../api/intZendeskField/intZendeskField.model.js | 2 +- server/api/intZendeskField/intZendeskField.rpc.js | 2 +- server/api/intZohoAccount/index.js | 2 +- .../intZohoAccount/intZohoAccount.attributes.js | 2 +- .../intZohoAccount/intZohoAccount.controller.js | 2 +- server/api/intZohoAccount/intZohoAccount.model.js | 2 +- server/api/intZohoAccount/intZohoAccount.rpc.js | 2 +- server/api/intZohoConfiguration/index.js | 2 +- .../intZohoConfiguration.attributes.js | 2 +- .../intZohoConfiguration.controller.js | 2 +- .../intZohoConfiguration.model.js | 2 +- .../intZohoConfiguration.rpc.js | 2 +- server/api/intZohoField/index.js | 2 +- server/api/intZohoField/intZohoField.attributes.js | 2 +- server/api/intZohoField/intZohoField.controller.js | 2 +- server/api/intZohoField/intZohoField.model.js | 2 +- server/api/intZohoField/intZohoField.rpc.js | 2 +- server/api/integration/index.js | 2 +- server/api/integration/integration.attributes.js | 2 +- server/api/integration/integration.controller.js | 2 +- server/api/integration/integration.model.js | 2 +- server/api/integration/integration.rpc.js | 2 +- server/api/integrationReport/index.js | 2 +- .../integrationReport.attributes.js | 2 +- .../integrationReport.controller.js | 2 +- .../integrationReport/integrationReport.model.js | 2 +- .../api/integrationReport/integrationReport.rpc.js | 2 +- server/api/interval/index.js | 2 +- server/api/interval/interval.attributes.js | 2 +- server/api/interval/interval.controller.js | 2 +- server/api/interval/interval.model.js | 2 +- server/api/interval/interval.rpc.js | 2 +- server/api/jira/index.js | 2 +- server/api/jira/jira.controller.js | 2 +- server/api/jscriptyAnswerReport/index.js | 2 +- .../jscriptyAnswerReport.attributes.js | 2 +- .../jscriptyAnswerReport.controller.js | 2 +- .../jscriptyAnswerReport.model.js | 2 +- .../jscriptyAnswerReport.rpc.js | 2 +- server/api/jscriptyProject/index.js | 2 +- .../jscriptyProject/jscriptyProject.attributes.js | 2 +- .../jscriptyProject/jscriptyProject.controller.js | 2 +- .../api/jscriptyProject/jscriptyProject.model.js | 2 +- server/api/jscriptyProject/jscriptyProject.rpc.js | 2 +- server/api/jscriptyQuestionReport/index.js | 2 +- .../jscriptyQuestionReport.attributes.js | 2 +- .../jscriptyQuestionReport.controller.js | 2 +- .../jscriptyQuestionReport.model.js | 2 +- .../jscriptyQuestionReport.rpc.js | 2 +- server/api/jscriptySessionReport/index.js | 2 +- .../jscriptySessionReport.attributes.js | 2 +- .../jscriptySessionReport.controller.js | 2 +- .../jscriptySessionReport.model.js | 2 +- .../jscriptySessionReport.rpc.js | 2 +- server/api/license/index.js | 2 +- server/api/license/license.attributes.js | 2 +- server/api/license/license.controller.js | 2 +- server/api/license/license.model.js | 2 +- server/api/license/license.rpc.js | 2 +- server/api/mailAccount/index.js | 2 +- server/api/mailAccount/mailAccount.attributes.js | 2 +- server/api/mailAccount/mailAccount.controller.js | 2 +- server/api/mailAccount/mailAccount.events.js | 2 +- server/api/mailAccount/mailAccount.model.js | 2 +- server/api/mailAccount/mailAccount.rpc.js | 2 +- server/api/mailAccount/mailAccount.socket.js | 2 +- server/api/mailApplication/index.js | 2 +- .../mailApplication/mailApplication.attributes.js | 2 +- .../mailApplication/mailApplication.controller.js | 2 +- .../api/mailApplication/mailApplication.model.js | 2 +- server/api/mailApplication/mailApplication.rpc.js | 2 +- server/api/mailInteraction/index.js | 2 +- .../mailInteraction/mailInteraction.attributes.js | 2 +- .../mailInteraction/mailInteraction.controller.js | 2 +- .../api/mailInteraction/mailInteraction.events.js | 2 +- .../api/mailInteraction/mailInteraction.model.js | 2 +- server/api/mailInteraction/mailInteraction.rpc.js | 2 +- .../api/mailInteraction/mailInteraction.socket.js | 2 +- server/api/mailMessage/index.js | 2 +- server/api/mailMessage/mailMessage.attributes.js | 2 +- server/api/mailMessage/mailMessage.controller.js | 2 +- server/api/mailMessage/mailMessage.events.js | 2 +- server/api/mailMessage/mailMessage.model.js | 2 +- server/api/mailMessage/mailMessage.rpc.js | 2 +- server/api/mailMessage/mailMessage.socket.js | 2 +- server/api/mailQueue/index.js | 2 +- server/api/mailQueue/mailQueue.attributes.js | 2 +- server/api/mailQueue/mailQueue.controller.js | 2 +- server/api/mailQueue/mailQueue.events.js | 2 +- server/api/mailQueue/mailQueue.model.js | 2 +- server/api/mailQueue/mailQueue.rpc.js | 2 +- server/api/mailQueue/mailQueue.socket.js | 2 +- server/api/mailQueueReport/index.js | 2 +- .../mailQueueReport/mailQueueReport.attributes.js | 2 +- .../mailQueueReport/mailQueueReport.controller.js | 2 +- .../api/mailQueueReport/mailQueueReport.model.js | 2 +- server/api/mailQueueReport/mailQueueReport.rpc.js | 2 +- server/api/mailServerIn/index.js | 2 +- server/api/mailServerIn/mailServerIn.attributes.js | 2 +- server/api/mailServerIn/mailServerIn.model.js | 2 +- server/api/mailServerIn/mailServerIn.rpc.js | 2 +- server/api/mailServerOut/index.js | 2 +- .../api/mailServerOut/mailServerOut.attributes.js | 2 +- .../api/mailServerOut/mailServerOut.controller.js | 2 +- server/api/mailServerOut/mailServerOut.model.js | 2 +- server/api/mailServerOut/mailServerOut.rpc.js | 2 +- server/api/mailSubstatus/index.js | 2 +- .../api/mailSubstatus/mailSubstatus.attributes.js | 2 +- .../api/mailSubstatus/mailSubstatus.controller.js | 2 +- server/api/mailSubstatus/mailSubstatus.model.js | 2 +- server/api/mailSubstatus/mailSubstatus.rpc.js | 2 +- server/api/mailTransferReport/index.js | 2 +- .../mailTransferReport.attributes.js | 2 +- .../mailTransferReport.controller.js | 2 +- .../mailTransferReport/mailTransferReport.model.js | 2 +- .../mailTransferReport/mailTransferReport.rpc.js | 2 +- server/api/memberReport/index.js | 2 +- server/api/memberReport/memberReport.attributes.js | 2 +- server/api/memberReport/memberReport.controller.js | 2 +- server/api/memberReport/memberReport.model.js | 2 +- server/api/memberReport/memberReport.rpc.js | 2 +- server/api/migration/index.js | 2 +- server/api/migration/migration.attributes.js | 2 +- server/api/migration/migration.controller.js | 2 +- server/api/migration/migration.model.js | 2 +- server/api/migration/migration.rpc.js | 2 +- server/api/network/index.js | 2 +- server/api/network/network.attributes.js | 2 +- server/api/network/network.controller.js | 2 +- server/api/network/network.model.js | 2 +- server/api/network/network.rpc.js | 2 +- server/api/openchannelAccount/index.js | 2 +- .../openchannelAccount.attributes.js | 2 +- .../openchannelAccount.controller.js | 2 +- .../openchannelAccount.events.js | 2 +- .../openchannelAccount/openchannelAccount.model.js | 2 +- .../openchannelAccount/openchannelAccount.rpc.js | 2 +- .../openchannelAccount.socket.js | 2 +- server/api/openchannelApplication/index.js | 2 +- .../openchannelApplication.attributes.js | 2 +- .../openchannelApplication.controller.js | 2 +- .../openchannelApplication.model.js | 2 +- .../openchannelApplication.rpc.js | 2 +- server/api/openchannelInteraction/index.js | 2 +- .../openchannelInteraction.attributes.js | 2 +- .../openchannelInteraction.controller.js | 2 +- .../openchannelInteraction.events.js | 2 +- .../openchannelInteraction.model.js | 2 +- .../openchannelInteraction.rpc.js | 2 +- .../openchannelInteraction.socket.js | 2 +- server/api/openchannelMessage/index.js | 2 +- .../openchannelMessage.attributes.js | 2 +- .../openchannelMessage.controller.js | 2 +- .../openchannelMessage.events.js | 2 +- .../openchannelMessage/openchannelMessage.model.js | 2 +- .../openchannelMessage/openchannelMessage.rpc.js | 2 +- .../openchannelMessage.socket.js | 2 +- server/api/openchannelQueue/index.js | 2 +- .../openchannelQueue.attributes.js | 2 +- .../openchannelQueue.controller.js | 2 +- .../openchannelQueue/openchannelQueue.events.js | 2 +- .../api/openchannelQueue/openchannelQueue.model.js | 2 +- .../api/openchannelQueue/openchannelQueue.rpc.js | 2 +- .../openchannelQueue/openchannelQueue.socket.js | 2 +- server/api/openchannelQueueReport/index.js | 2 +- .../openchannelQueueReport.attributes.js | 2 +- .../openchannelQueueReport.controller.js | 2 +- .../openchannelQueueReport.model.js | 2 +- .../openchannelQueueReport.rpc.js | 2 +- server/api/openchannelTransferReport/index.js | 2 +- .../openchannelTransferReport.attributes.js | 2 +- .../openchannelTransferReport.controller.js | 2 +- .../openchannelTransferReport.model.js | 2 +- .../openchannelTransferReport.rpc.js | 2 +- server/api/pause/index.js | 2 +- server/api/pause/pause.attributes.js | 2 +- server/api/pause/pause.controller.js | 2 +- server/api/pause/pause.model.js | 2 +- server/api/pause/pause.rpc.js | 2 +- server/api/plugin/index.js | 2 +- server/api/plugin/plugin.attributes.js | 2 +- server/api/plugin/plugin.controller.js | 2 +- server/api/plugin/plugin.events.js | 2 +- server/api/plugin/plugin.model.js | 2 +- server/api/plugin/plugin.rpc.js | 2 +- server/api/plugin/plugin.socket.js | 2 +- server/api/pm2/index.js | 2 +- server/api/pm2/pm2.controller.js | 2 +- server/api/realtime/index.js | 2 +- server/api/realtime/realtime.controller.js | 2 +- server/api/realtime/realtime.model.js | 2 +- server/api/reportAgentPreview/index.js | 2 +- .../reportAgentPreview.attributes.js | 2 +- .../reportAgentPreview/reportAgentPreview.model.js | 2 +- .../reportAgentPreview/reportAgentPreview.rpc.js | 2 +- server/api/rpc/index.js | 2 +- server/api/rpc/rpc.controller.js | 2 +- server/api/schedule/index.js | 2 +- server/api/schedule/schedule.attributes.js | 2 +- server/api/schedule/schedule.controller.js | 2 +- server/api/schedule/schedule.model.js | 2 +- server/api/schedule/schedule.rpc.js | 2 +- server/api/screenRecording/index.js | 2 +- .../screenRecording/screenRecording.attributes.js | 2 +- .../screenRecording/screenRecording.controller.js | 2 +- .../api/screenRecording/screenRecording.model.js | 2 +- server/api/screenRecording/screenRecording.rpc.js | 2 +- server/api/setting/index.js | 2 +- server/api/setting/setting.attributes.js | 2 +- server/api/setting/setting.controller.js | 2 +- server/api/setting/setting.model.js | 2 +- server/api/setting/setting.rpc.js | 2 +- server/api/smsAccount/index.js | 2 +- server/api/smsAccount/smsAccount.attributes.js | 2 +- server/api/smsAccount/smsAccount.controller.js | 2 +- server/api/smsAccount/smsAccount.events.js | 2 +- server/api/smsAccount/smsAccount.model.js | 2 +- server/api/smsAccount/smsAccount.rpc.js | 2 +- server/api/smsAccount/smsAccount.socket.js | 2 +- server/api/smsApplication/index.js | 2 +- .../smsApplication/smsApplication.attributes.js | 2 +- .../smsApplication/smsApplication.controller.js | 2 +- server/api/smsApplication/smsApplication.model.js | 2 +- server/api/smsApplication/smsApplication.rpc.js | 2 +- server/api/smsInteraction/index.js | 2 +- .../smsInteraction/smsInteraction.attributes.js | 2 +- .../smsInteraction/smsInteraction.controller.js | 2 +- server/api/smsInteraction/smsInteraction.events.js | 2 +- server/api/smsInteraction/smsInteraction.model.js | 2 +- server/api/smsInteraction/smsInteraction.rpc.js | 2 +- server/api/smsInteraction/smsInteraction.socket.js | 2 +- server/api/smsMessage/index.js | 2 +- server/api/smsMessage/smsMessage.attributes.js | 2 +- server/api/smsMessage/smsMessage.controller.js | 2 +- server/api/smsMessage/smsMessage.events.js | 2 +- server/api/smsMessage/smsMessage.model.js | 2 +- server/api/smsMessage/smsMessage.rpc.js | 2 +- server/api/smsMessage/smsMessage.socket.js | 2 +- server/api/smsQueue/index.js | 2 +- server/api/smsQueue/smsQueue.attributes.js | 2 +- server/api/smsQueue/smsQueue.controller.js | 2 +- server/api/smsQueue/smsQueue.events.js | 2 +- server/api/smsQueue/smsQueue.model.js | 2 +- server/api/smsQueue/smsQueue.rpc.js | 2 +- server/api/smsQueue/smsQueue.socket.js | 2 +- server/api/smsQueueReport/index.js | 2 +- .../smsQueueReport/smsQueueReport.attributes.js | 2 +- .../smsQueueReport/smsQueueReport.controller.js | 2 +- server/api/smsQueueReport/smsQueueReport.model.js | 2 +- server/api/smsQueueReport/smsQueueReport.rpc.js | 2 +- server/api/smsTransferReport/index.js | 2 +- .../smsTransferReport.attributes.js | 2 +- .../smsTransferReport.controller.js | 2 +- .../smsTransferReport/smsTransferReport.model.js | 2 +- .../api/smsTransferReport/smsTransferReport.rpc.js | 2 +- server/api/sound/index.js | 2 +- server/api/sound/sound.attributes.js | 2 +- server/api/sound/sound.controller.js | 2 +- server/api/sound/sound.model.js | 2 +- server/api/sound/sound.rpc.js | 2 +- server/api/squareMessage/index.js | 2 +- .../api/squareMessage/squareMessage.attributes.js | 2 +- .../api/squareMessage/squareMessage.controller.js | 2 +- server/api/squareMessage/squareMessage.model.js | 2 +- server/api/squareMessage/squareMessage.rpc.js | 2 +- server/api/squareOdbc/index.js | 2 +- server/api/squareOdbc/squareOdbc.attributes.js | 2 +- server/api/squareOdbc/squareOdbc.controller.js | 2 +- server/api/squareOdbc/squareOdbc.model.js | 2 +- server/api/squareOdbc/squareOdbc.rpc.js | 2 +- server/api/squareProject/index.js | 2 +- .../api/squareProject/squareProject.attributes.js | 2 +- .../api/squareProject/squareProject.controller.js | 2 +- server/api/squareProject/squareProject.events.js | 2 +- server/api/squareProject/squareProject.model.js | 2 +- server/api/squareProject/squareProject.rpc.js | 2 +- server/api/squareProject/squareProject.socket.js | 2 +- server/api/squareRecording/index.js | 2 +- .../squareRecording/squareRecording.attributes.js | 2 +- .../squareRecording/squareRecording.controller.js | 2 +- .../api/squareRecording/squareRecording.model.js | 2 +- server/api/squareRecording/squareRecording.rpc.js | 2 +- server/api/squareReport/index.js | 2 +- server/api/squareReport/squareReport.attributes.js | 2 +- server/api/squareReport/squareReport.controller.js | 2 +- server/api/squareReport/squareReport.model.js | 2 +- server/api/squareReport/squareReport.rpc.js | 2 +- server/api/squareReportDetail/index.js | 2 +- .../squareReportDetail.attributes.js | 2 +- .../squareReportDetail.controller.js | 2 +- .../squareReportDetail/squareReportDetail.model.js | 2 +- .../squareReportDetail/squareReportDetail.rpc.js | 2 +- server/api/system/index.js | 2 +- server/api/system/system.controller.js | 2 +- server/api/tag/index.js | 2 +- server/api/tag/tag.attributes.js | 2 +- server/api/tag/tag.controller.js | 2 +- server/api/tag/tag.model.js | 2 +- server/api/tag/tag.rpc.js | 2 +- server/api/team/index.js | 2 +- server/api/team/team.attributes.js | 2 +- server/api/team/team.controller.js | 2 +- server/api/team/team.events.js | 2 +- server/api/team/team.model.js | 2 +- server/api/team/team.rpc.js | 2 +- server/api/team/team.socket.js | 2 +- server/api/teamVoiceQueue/index.js | 2 +- .../teamVoiceQueue/teamVoiceQueue.attributes.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.model.js | 2 +- server/api/teamVoiceQueue/teamVoiceQueue.rpc.js | 2 +- server/api/template/index.js | 2 +- server/api/template/template.attributes.js | 2 +- server/api/template/template.controller.js | 2 +- server/api/template/template.model.js | 2 +- server/api/template/template.rpc.js | 2 +- server/api/trigger/index.js | 2 +- server/api/trigger/trigger.attributes.js | 2 +- server/api/trigger/trigger.controller.js | 2 +- server/api/trigger/trigger.model.js | 2 +- server/api/trigger/trigger.rpc.js | 2 +- server/api/trunk/index.js | 2 +- server/api/trunk/trunk.attributes.js | 2 +- server/api/trunk/trunk.controller.js | 2 +- server/api/trunk/trunk.model.js | 2 +- server/api/trunk/trunk.rpc.js | 2 +- server/api/user/index.js | 2 +- server/api/user/user.attributes.js | 2 +- server/api/user/user.controller.js | 2 +- server/api/user/user.events.js | 2 +- server/api/user/user.model.js | 2 +- server/api/user/user.rpc.js | 2 +- server/api/user/user.socket.js | 2 +- server/api/userChatQueue/index.js | 2 +- .../api/userChatQueue/userChatQueue.attributes.js | 2 +- server/api/userChatQueue/userChatQueue.model.js | 2 +- server/api/userChatQueue/userChatQueue.rpc.js | 2 +- server/api/userFaxQueue/index.js | 2 +- server/api/userFaxQueue/userFaxQueue.attributes.js | 2 +- server/api/userFaxQueue/userFaxQueue.model.js | 2 +- server/api/userFaxQueue/userFaxQueue.rpc.js | 2 +- server/api/userMailQueue/index.js | 2 +- .../api/userMailQueue/userMailQueue.attributes.js | 2 +- server/api/userMailQueue/userMailQueue.model.js | 2 +- server/api/userMailQueue/userMailQueue.rpc.js | 2 +- server/api/userNotification/index.js | 2 +- .../userNotification.attributes.js | 2 +- .../userNotification.controller.js | 2 +- .../userNotification/userNotification.events.js | 2 +- .../api/userNotification/userNotification.model.js | 2 +- .../api/userNotification/userNotification.rpc.js | 2 +- .../userNotification/userNotification.socket.js | 2 +- server/api/userOpenchannelQueue/index.js | 2 +- .../userOpenchannelQueue.attributes.js | 2 +- .../userOpenchannelQueue.model.js | 2 +- .../userOpenchannelQueue.rpc.js | 2 +- server/api/userProfile/index.js | 2 +- server/api/userProfile/userProfile.attributes.js | 2 +- server/api/userProfile/userProfile.controller.js | 2 +- server/api/userProfile/userProfile.events.js | 2 +- server/api/userProfile/userProfile.model.js | 2 +- server/api/userProfile/userProfile.rpc.js | 2 +- server/api/userProfile/userProfile.socket.js | 2 +- server/api/userProfileResource/index.js | 2 +- .../userProfileResource.attributes.js | 2 +- .../userProfileResource.controller.js | 2 +- .../userProfileResource.model.js | 2 +- .../userProfileResource/userProfileResource.rpc.js | 2 +- server/api/userProfileSection/index.js | 2 +- .../userProfileSection.attributes.js | 2 +- .../userProfileSection.controller.js | 2 +- .../userProfileSection/userProfileSection.model.js | 2 +- .../userProfileSection/userProfileSection.rpc.js | 2 +- server/api/userSmsQueue/index.js | 2 +- server/api/userSmsQueue/userSmsQueue.attributes.js | 2 +- server/api/userSmsQueue/userSmsQueue.model.js | 2 +- server/api/userSmsQueue/userSmsQueue.rpc.js | 2 +- server/api/userVoiceQueue/index.js | 2 +- .../userVoiceQueue/userVoiceQueue.attributes.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.model.js | 2 +- server/api/userVoiceQueue/userVoiceQueue.rpc.js | 2 +- server/api/userVoiceQueueRt/index.js | 2 +- .../userVoiceQueueRt.attributes.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.events.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.model.js | 2 +- .../api/userVoiceQueueRt/userVoiceQueueRt.rpc.js | 2 +- .../userVoiceQueueRt/userVoiceQueueRt.socket.js | 2 +- server/api/userWhatsappQueue/index.js | 2 +- .../userWhatsappQueue.attributes.js | 2 +- .../userWhatsappQueue/userWhatsappQueue.model.js | 2 +- .../api/userWhatsappQueue/userWhatsappQueue.rpc.js | 2 +- server/api/variable/index.js | 2 +- server/api/variable/variable.attributes.js | 2 +- server/api/variable/variable.controller.js | 2 +- server/api/variable/variable.model.js | 2 +- server/api/variable/variable.rpc.js | 2 +- server/api/version/index.js | 2 +- server/api/version/version.controller.js | 2 +- server/api/voiceAgentReport/index.js | 2 +- .../voiceAgentReport.attributes.js | 2 +- .../voiceAgentReport.controller.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.model.js | 2 +- .../api/voiceAgentReport/voiceAgentReport.rpc.js | 2 +- server/api/voiceCallReport/index.js | 2 +- .../voiceCallReport/voiceCallReport.attributes.js | 2 +- .../voiceCallReport/voiceCallReport.controller.js | 2 +- .../api/voiceCallReport/voiceCallReport.model.js | 2 +- server/api/voiceCallReport/voiceCallReport.rpc.js | 2 +- server/api/voiceChanSpy/index.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.attributes.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.controller.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.model.js | 2 +- server/api/voiceChanSpy/voiceChanSpy.rpc.js | 2 +- server/api/voiceContext/index.js | 2 +- server/api/voiceContext/voiceContext.attributes.js | 2 +- server/api/voiceContext/voiceContext.controller.js | 2 +- server/api/voiceContext/voiceContext.model.js | 2 +- server/api/voiceContext/voiceContext.rpc.js | 2 +- server/api/voiceDialReport/index.js | 2 +- .../voiceDialReport/voiceDialReport.attributes.js | 2 +- .../voiceDialReport/voiceDialReport.controller.js | 2 +- .../api/voiceDialReport/voiceDialReport.model.js | 2 +- server/api/voiceDialReport/voiceDialReport.rpc.js | 2 +- server/api/voiceExtension/index.js | 2 +- .../voiceExtension/voiceExtension.attributes.js | 2 +- .../voiceExtension/voiceExtension.controller.js | 2 +- server/api/voiceExtension/voiceExtension.events.js | 2 +- server/api/voiceExtension/voiceExtension.model.js | 2 +- server/api/voiceExtension/voiceExtension.rpc.js | 2 +- server/api/voiceExtension/voiceExtension.socket.js | 2 +- server/api/voiceMail/index.js | 2 +- server/api/voiceMail/voiceMail.attributes.js | 2 +- server/api/voiceMail/voiceMail.controller.js | 2 +- server/api/voiceMail/voiceMail.model.js | 2 +- server/api/voiceMail/voiceMail.rpc.js | 2 +- server/api/voiceMailMessage/index.js | 2 +- .../voiceMailMessage.attributes.js | 2 +- .../voiceMailMessage.controller.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.model.js | 2 +- .../api/voiceMailMessage/voiceMailMessage.rpc.js | 2 +- server/api/voiceMusicOnHold/index.js | 2 +- .../voiceMusicOnHold.attributes.js | 2 +- .../voiceMusicOnHold.controller.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.model.js | 2 +- .../api/voiceMusicOnHold/voiceMusicOnHold.rpc.js | 2 +- server/api/voicePrefix/index.js | 2 +- server/api/voicePrefix/voicePrefix.attributes.js | 2 +- server/api/voicePrefix/voicePrefix.controller.js | 2 +- server/api/voicePrefix/voicePrefix.events.js | 2 +- server/api/voicePrefix/voicePrefix.model.js | 2 +- server/api/voicePrefix/voicePrefix.rpc.js | 2 +- server/api/voicePrefix/voicePrefix.socket.js | 2 +- server/api/voiceQueue/index.js | 2 +- server/api/voiceQueue/voiceQueue.attributes.js | 2 +- server/api/voiceQueue/voiceQueue.controller.js | 2 +- server/api/voiceQueue/voiceQueue.events.js | 2 +- server/api/voiceQueue/voiceQueue.model.js | 2 +- server/api/voiceQueue/voiceQueue.rpc.js | 2 +- server/api/voiceQueue/voiceQueue.socket.js | 2 +- server/api/voiceQueueReport/index.js | 2 +- .../voiceQueueReport.attributes.js | 2 +- .../voiceQueueReport.controller.js | 2 +- .../voiceQueueReport/voiceQueueReport.events.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.model.js | 2 +- .../api/voiceQueueReport/voiceQueueReport.rpc.js | 2 +- .../voiceQueueReport/voiceQueueReport.socket.js | 2 +- server/api/voiceQueuesLog/index.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.attributes.js | 2 +- .../voiceQueuesLog/voiceQueuesLog.controller.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.model.js | 2 +- server/api/voiceQueuesLog/voiceQueuesLog.rpc.js | 2 +- server/api/voiceRecording/index.js | 2 +- .../voiceRecording/voiceRecording.attributes.js | 2 +- .../voiceRecording/voiceRecording.controller.js | 2 +- server/api/voiceRecording/voiceRecording.model.js | 2 +- server/api/voiceRecording/voiceRecording.rpc.js | 2 +- server/api/voiceTransferReport/index.js | 2 +- .../voiceTransferReport.attributes.js | 2 +- .../voiceTransferReport.controller.js | 2 +- .../voiceTransferReport.model.js | 2 +- .../voiceTransferReport/voiceTransferReport.rpc.js | 2 +- server/api/webbar/index.js | 2 +- server/api/webbar/webbar.controller.js | 2 +- server/api/whatsappAccount/index.js | 2 +- .../whatsappAccount/whatsappAccount.attributes.js | 2 +- .../whatsappAccount/whatsappAccount.controller.js | 2 +- .../api/whatsappAccount/whatsappAccount.events.js | 2 +- .../api/whatsappAccount/whatsappAccount.model.js | 2 +- server/api/whatsappAccount/whatsappAccount.rpc.js | 2 +- .../api/whatsappAccount/whatsappAccount.socket.js | 2 +- server/api/whatsappApplication/index.js | 2 +- .../whatsappApplication.attributes.js | 2 +- .../whatsappApplication.controller.js | 2 +- .../whatsappApplication.model.js | 2 +- .../whatsappApplication/whatsappApplication.rpc.js | 2 +- server/api/whatsappInteraction/index.js | 2 +- .../whatsappInteraction.attributes.js | 2 +- .../whatsappInteraction.controller.js | 2 +- .../whatsappInteraction.events.js | 2 +- .../whatsappInteraction.model.js | 2 +- .../whatsappInteraction/whatsappInteraction.rpc.js | 2 +- .../whatsappInteraction.socket.js | 2 +- server/api/whatsappMessage/index.js | 2 +- .../whatsappMessage/whatsappMessage.attributes.js | 2 +- .../whatsappMessage/whatsappMessage.controller.js | 2 +- .../api/whatsappMessage/whatsappMessage.events.js | 2 +- .../api/whatsappMessage/whatsappMessage.model.js | 2 +- server/api/whatsappMessage/whatsappMessage.rpc.js | 2 +- .../api/whatsappMessage/whatsappMessage.socket.js | 2 +- server/api/whatsappQueue/index.js | 2 +- .../api/whatsappQueue/whatsappQueue.attributes.js | 2 +- .../api/whatsappQueue/whatsappQueue.controller.js | 2 +- server/api/whatsappQueue/whatsappQueue.events.js | 2 +- server/api/whatsappQueue/whatsappQueue.model.js | 2 +- server/api/whatsappQueue/whatsappQueue.rpc.js | 2 +- server/api/whatsappQueue/whatsappQueue.socket.js | 2 +- server/api/whatsappQueueReport/index.js | 2 +- .../whatsappQueueReport.attributes.js | 2 +- .../whatsappQueueReport.controller.js | 2 +- .../whatsappQueueReport.model.js | 2 +- .../whatsappQueueReport/whatsappQueueReport.rpc.js | 2 +- server/api/whatsappTransferReport/index.js | 2 +- .../whatsappTransferReport.attributes.js | 2 +- .../whatsappTransferReport.controller.js | 2 +- .../whatsappTransferReport.model.js | 2 +- .../whatsappTransferReport.rpc.js | 2 +- server/app.js | 2 +- server/components/auth/service.js | 2 +- server/components/encryptor/index.js | 2 +- server/components/export/csv.js | 2 +- server/components/export/pdf.js | 2 +- server/components/export/xlsx.js | 2 +- server/components/extensions/rewrite.js | 2 +- server/components/import/cm/csv.js | 2 +- server/components/import/cm/csv2.js | 2 +- server/components/integrations/configuration.js | 2 +- server/components/interaction/service.js | 2 +- server/components/license/service.js | 2 +- server/components/parsers/advancedSearch.js | 2 +- server/components/parsers/qs.js | 2 +- server/config/express.js | 2 +- server/config/license/hardware.js | 2 +- server/config/license/index.js | 2 +- server/config/license/util.js | 2 +- server/config/local.env.js | 2 +- server/config/logger.js | 2 +- server/config/pm2/config.js | 2 +- server/config/pm2/index.js | 2 +- server/config/schedule/chat.js | 2 +- server/config/schedule/index.js | 2 +- server/config/schedule/transcribe.js | 2 +- server/config/schedule/whatsapp.js | 2 +- server/config/seedContact.js | 2 +- server/config/seedUsers.js | 2 +- server/config/socketio.js | 2 +- server/config/triggers/index.js | 2 +- server/config/utils.js | 2 +- server/errors/index.js | 2 +- server/mysqldb/index.js | 2 +- server/routes.js | 2 +- server/rpc/index.js | 2 +- server/services/agi/channel.js | 2 +- server/services/agi/error.js | 2 +- server/services/agi/graph/index.js | 2 +- server/services/agi/index.js | 2 +- server/services/agi/mailRpc/index.js | 2 +- server/services/agi/reply.js | 2 +- server/services/agi/rpc/index.js | 2 +- server/services/agi/scripts/aws/index.js | 2 +- server/services/agi/scripts/aws/lex/index.js | 2 +- server/services/agi/scripts/aws/lex/lib/api.js | 2 +- server/services/agi/scripts/aws/polly/index.js | 2 +- server/services/agi/scripts/aws/polly/lib/api.js | 2 +- server/services/agi/scripts/google/asr/index.js | 2 +- server/services/agi/scripts/google/asr/lib/api.js | 2 +- server/services/agi/scripts/google/index.js | 2 +- server/services/agi/scripts/index.js | 2 +- server/services/agi/scripts/sestek/index.js | 2 +- server/services/agi/scripts/sestek/nda/index.js | 2 +- server/services/agi/scripts/tilde/asr/index.js | 2 +- server/services/agi/scripts/tilde/asr/lib/api.js | 2 +- server/services/agi/scripts/tilde/index.js | 2 +- server/services/agi/server.js | 2 +- server/services/agi/vertices.js | 2 +- server/services/ami/acw/index.js | 2 +- server/services/ami/ami.js | 2 +- server/services/ami/client.js | 2 +- server/services/ami/dialer/action.js | 2 +- server/services/ami/dialer/agentComplete.js | 2 +- server/services/ami/dialer/final.js | 2 +- server/services/ami/dialer/hangup.js | 2 +- server/services/ami/dialer/history.js | 2 +- server/services/ami/dialer/index.js | 2 +- server/services/ami/dialer/queueCallerAbandon.js | 2 +- server/services/ami/fax/action.js | 2 +- server/services/ami/fax/index.js | 2 +- server/services/ami/fax/rpcDb.js | 2 +- server/services/ami/fax/util/gs.js | 2 +- server/services/ami/fax/util/util.js | 2 +- server/services/ami/index.js | 2 +- server/services/ami/model/agent.js | 2 +- server/services/ami/model/campaign.js | 2 +- server/services/ami/model/channel.js | 2 +- server/services/ami/model/deskAccount.js | 2 +- server/services/ami/model/dynamics365Account.js | 2 +- server/services/ami/model/faxAccount.js | 2 +- server/services/ami/model/freshdeskAccount.js | 2 +- server/services/ami/model/freshsalesAccount.js | 2 +- server/services/ami/model/queueReport.js | 2 +- server/services/ami/model/salesforceAccount.js | 2 +- server/services/ami/model/servicenowAccount.js | 2 +- server/services/ami/model/sugarcrmAccount.js | 2 +- server/services/ami/model/telephone.js | 2 +- server/services/ami/model/template.js | 2 +- server/services/ami/model/trigger.js | 2 +- server/services/ami/model/trunk.js | 2 +- server/services/ami/model/voiceExtension.js | 2 +- server/services/ami/model/voiceQueue.js | 2 +- server/services/ami/model/vtigerAccount.js | 2 +- server/services/ami/model/zendeskAccount.js | 2 +- server/services/ami/model/zohoAccount.js | 2 +- server/services/ami/preview/action.js | 2 +- server/services/ami/preview/index.js | 2 +- server/services/ami/preview/rpcDb.js | 2 +- server/services/ami/preview/util/util.js | 2 +- server/services/ami/properties.js | 2 +- server/services/ami/realtime/index.js | 2 +- server/services/ami/report/index.js | 2 +- server/services/ami/report/userReport.js | 2 +- server/services/ami/report/voiceAgentReport.js | 2 +- server/services/ami/report/voiceCallReport.js | 2 +- server/services/ami/report/voiceDialReport.js | 2 +- server/services/ami/report/voiceQueueReport.js | 2 +- server/services/ami/rpc/agentReportPreview.js | 2 +- server/services/ami/rpc/attachment.js | 2 +- server/services/ami/rpc/campaign.js | 2 +- server/services/ami/rpc/cmContact.js | 2 +- server/services/ami/rpc/cmHopper.js | 2 +- server/services/ami/rpc/cmHopperBlack.js | 2 +- server/services/ami/rpc/cmHopperFinal.js | 2 +- server/services/ami/rpc/cmHopperHistory.js | 2 +- server/services/ami/rpc/faxAccount.js | 2 +- server/services/ami/rpc/faxMessage.js | 2 +- server/services/ami/rpc/integrations/desk.js | 2 +- .../services/ami/rpc/integrations/dynamics365.js | 2 +- server/services/ami/rpc/integrations/freshdesk.js | 2 +- server/services/ami/rpc/integrations/freshsales.js | 2 +- server/services/ami/rpc/integrations/salesforce.js | 2 +- server/services/ami/rpc/integrations/servicenow.js | 2 +- server/services/ami/rpc/integrations/sugarcrm.js | 2 +- server/services/ami/rpc/integrations/vtiger.js | 2 +- server/services/ami/rpc/integrations/zendesk.js | 2 +- server/services/ami/rpc/integrations/zoho.js | 2 +- server/services/ami/rpc/memberReport.js | 2 +- server/services/ami/rpc/setting.js | 2 +- server/services/ami/rpc/template.js | 2 +- server/services/ami/rpc/trigger.js | 2 +- server/services/ami/rpc/trunk.js | 2 +- server/services/ami/rpc/user.js | 2 +- server/services/ami/rpc/voiceAgentReport.js | 2 +- server/services/ami/rpc/voiceCallReport.js | 2 +- server/services/ami/rpc/voiceDialReport.js | 2 +- server/services/ami/rpc/voiceExtension.js | 2 +- server/services/ami/rpc/voiceQueue.js | 2 +- server/services/ami/rpc/voiceQueueReport.js | 2 +- server/services/ami/rpc/voiceQueueRt.js | 2 +- server/services/ami/rpc/voiceRecording.js | 2 +- server/services/ami/rpc/voiceTransferReport.js | 2 +- server/services/ami/server/index.js | 2 +- server/services/ami/trigger/cmContact/index.js | 2 +- server/services/ami/trigger/index.js | 2 +- server/services/ami/trigger/integration/desk.js | 2 +- .../ami/trigger/integration/dynamics365.js | 2 +- .../services/ami/trigger/integration/freshdesk.js | 2 +- .../services/ami/trigger/integration/freshsales.js | 2 +- server/services/ami/trigger/integration/index.js | 2 +- .../services/ami/trigger/integration/salesforce.js | 2 +- .../services/ami/trigger/integration/servicenow.js | 2 +- .../services/ami/trigger/integration/sugarcrm.js | 2 +- server/services/ami/trigger/integration/util.js | 2 +- server/services/ami/trigger/integration/vtiger.js | 2 +- server/services/ami/trigger/integration/zendesk.js | 2 +- server/services/ami/trigger/integration/zoho.js | 2 +- server/services/ami/trigger/script/index.js | 2 +- server/services/ami/trigger/urlforward/index.js | 2 +- server/services/email/client.js | 2 +- server/services/email/index.js | 2 +- server/services/email/lib/email.js | 2 +- server/services/email/lib/imap.js | 2 +- server/services/email/lib/smtp.js | 2 +- server/services/email/lib/utils.js | 2 +- server/services/email/model/mailAccount.js | 2 +- server/services/email/realtime/index.js | 2 +- server/services/email/rpc/mailAccount.js | 2 +- server/services/email/rpc/setting.js | 2 +- server/services/email/server/index.js | 2 +- server/services/express/index.js | 2 +- server/services/routing/client.js | 2 +- server/services/routing/index.js | 2 +- server/services/routing/lib/rule-engine.js | 2 +- server/services/routing/mailRpc/index.js | 2 +- server/services/routing/model/agent.js | 2 +- server/services/routing/model/chatQueue.js | 2 +- server/services/routing/model/faxQueue.js | 2 +- server/services/routing/model/interval.js | 2 +- server/services/routing/model/mailQueue.js | 2 +- server/services/routing/model/openchannelQueue.js | 2 +- server/services/routing/model/smsQueue.js | 2 +- server/services/routing/model/whatsappQueue.js | 2 +- server/services/routing/realtime/index.js | 2 +- server/services/routing/rpc/chatInteraction.js | 2 +- server/services/routing/rpc/chatMessage.js | 2 +- server/services/routing/rpc/chatQueue.js | 2 +- server/services/routing/rpc/chatQueueReport.js | 2 +- server/services/routing/rpc/faxInteraction.js | 2 +- server/services/routing/rpc/faxMessage.js | 2 +- server/services/routing/rpc/faxQueue.js | 2 +- server/services/routing/rpc/faxQueueReport.js | 2 +- server/services/routing/rpc/interval.js | 2 +- server/services/routing/rpc/mailInteraction.js | 2 +- server/services/routing/rpc/mailMessage.js | 2 +- server/services/routing/rpc/mailQueue.js | 2 +- server/services/routing/rpc/mailQueueReport.js | 2 +- .../services/routing/rpc/openchannelInteraction.js | 2 +- server/services/routing/rpc/openchannelMessage.js | 2 +- server/services/routing/rpc/openchannelQueue.js | 2 +- .../services/routing/rpc/openchannelQueueReport.js | 2 +- server/services/routing/rpc/smsInteraction.js | 2 +- server/services/routing/rpc/smsMessage.js | 2 +- server/services/routing/rpc/smsQueue.js | 2 +- server/services/routing/rpc/smsQueueReport.js | 2 +- server/services/routing/rpc/user.js | 2 +- server/services/routing/rpc/whatsappInteraction.js | 2 +- server/services/routing/rpc/whatsappMessage.js | 2 +- server/services/routing/rpc/whatsappQueue.js | 2 +- server/services/routing/rpc/whatsappQueueReport.js | 2 +- .../services/routing/server/applications/agent.js | 2 +- .../routing/server/applications/amazonlex.js | 2 +- .../routing/server/applications/autoreply.js | 2 +- .../services/routing/server/applications/close.js | 2 +- .../routing/server/applications/dialogflow.js | 2 +- .../routing/server/applications/dialogflowV2.js | 2 +- .../services/routing/server/applications/gotoif.js | 2 +- .../services/routing/server/applications/gotop.js | 2 +- .../routing/server/applications/message.js | 2 +- .../services/routing/server/applications/noop.js | 2 +- .../services/routing/server/applications/queue.js | 2 +- .../routing/server/applications/strategy/agent.js | 2 +- .../server/applications/strategy/beepall.js | 2 +- .../routing/server/applications/strategy/index.js | 2 +- .../server/applications/strategy/rrmemory.js | 2 +- .../routing/server/applications/strategy/util.js | 2 +- .../services/routing/server/applications/system.js | 2 +- server/services/routing/server/applications/tag.js | 2 +- .../services/routing/server/applications/utils.js | 2 +- server/services/routing/server/index.js | 2 +- server/services/routing/server/interval.js | 2 +- server/services/xdr/agents.controller.js | 2 +- server/services/xdr/calls.controller.js | 2 +- server/services/xdr/core.controller.js | 2 +- server/services/xdr/dials.controller.js | 2 +- server/services/xdr/index.js | 2 +- server/services/xdr/members.controller.js | 2 +- server/services/xdr/queues.controller.js | 2 +- server/services/xdr/recordings.controller.js | 2 +- server/services/xdr/transfers.controller.js | 2 +- server/services/xdr/utils.js | 2 +- 1148 files changed, 1148 insertions(+), 1148 deletions(-) diff --git a/apidoc/api_project.js b/apidoc/api_project.js index f352e6b..bbf6a10 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-25T07:04:19.289Z", + "time": "2021-08-25T07:23:07.049Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index a561fd8..924e7b3 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-25T07:04:19.289Z", + "time": "2021-08-25T07:23:07.049Z", "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 3b1aa20..a4e816d 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 _0x9140=['TEXT','sequelize','exports','getDataValue','action','STRING','integration','motionbar','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'];(function(_0x1f99dc,_0x1b95ef){var _0x1ddea2=function(_0x2783c7){while(--_0x2783c7){_0x1f99dc['push'](_0x1f99dc['shift']());}};_0x1ddea2(++_0x1b95ef);}(_0x9140,0xc5));var _0x0914=function(_0x31c16b,_0x78b23){_0x31c16b=_0x31c16b-0x0;var _0x53e603=_0x9140[_0x31c16b];return _0x53e603;};'use strict';var Sequelize=require(_0x0914('0x0'));module[_0x0914('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5196f2){return this[_0x0914('0x2')](_0x0914('0x3'));}},'action':{'type':Sequelize[_0x0914('0x4')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x0914('0x5'),_0x0914('0x6'),'jscripty',_0x0914('0x7'),_0x0914('0x8'),_0x0914('0x9'),_0x0914('0xa')]],'msg':_0x0914('0xb')}},'comment':_0x0914('0xb')},'data1':{'type':Sequelize[_0x0914('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x0914('0x4')](0x1000),'comment':_0x0914('0xc')},'data3':{'type':Sequelize[_0x0914('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x0914('0x4')]},'data7':{'type':Sequelize[_0x0914('0xd')]}}; \ No newline at end of file +var _0x4594=['action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]','sequelize','exports','VIRTUAL'];(function(_0x35688d,_0x1708dd){var _0x3c99a7=function(_0x467577){while(--_0x467577){_0x35688d['push'](_0x35688d['shift']());}};_0x3c99a7(++_0x1708dd);}(_0x4594,0xc9));var _0x4459=function(_0x36e397,_0x4054c1){_0x36e397=_0x36e397-0x0;var _0x5741ce=_0x4594[_0x36e397];return _0x5741ce;};'use strict';var Sequelize=require(_0x4459('0x0'));module[_0x4459('0x1')]={'name':{'type':Sequelize[_0x4459('0x2')],'get':function(_0x4a4f3c){return this['getDataValue'](_0x4459('0x3'));}},'action':{'type':Sequelize[_0x4459('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x4459('0x5'),_0x4459('0x6'),_0x4459('0x7'),_0x4459('0x8'),_0x4459('0x9'),_0x4459('0xa'),'bot','script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x4459('0x4')](0x1000),'comment':_0x4459('0xb')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x4459('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x4459('0x4')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize[_0x4459('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index bc3e734..6bb411a 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 _0x647d=['to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','body','Action','find','params','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path'];(function(_0x14825b,_0x1274e7){var _0x698d7a=function(_0x46150b){while(--_0x46150b){_0x14825b['push'](_0x14825b['shift']());}};_0x698d7a(++_0x1274e7);}(_0x647d,0x13c));var _0xd647=function(_0x33d48e,_0xaa5330){_0x33d48e=_0x33d48e-0x0;var _0x308091=_0x647d[_0x33d48e];return _0x308091;};'use strict';var emlformat=require(_0xd647('0x0'));var rimraf=require(_0xd647('0x1'));var zipdir=require(_0xd647('0x2'));var jsonpatch=require(_0xd647('0x3'));var rp=require(_0xd647('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd647('0x5'));var sox=require('sox');var csv=require(_0xd647('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd647('0x7'));var _=require(_0xd647('0x8'));var squel=require(_0xd647('0x9'));var crypto=require(_0xd647('0xa'));var jsforce=require(_0xd647('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd647('0xc'));var Papa=require(_0xd647('0xd'));var Redis=require(_0xd647('0xe'));var authService=require(_0xd647('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd647('0x10'));var hardwareService=require(_0xd647('0x11'));var logger=require(_0xd647('0x12'))(_0xd647('0x13'));var utils=require(_0xd647('0x14'));var config=require(_0xd647('0x15'));var licenseUtil=require(_0xd647('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c8c30,_0x2a8751){_0x2a8751=_0x2a8751||0xcc;return function(_0x5ec0b7){if(_0x5ec0b7){return _0x5c8c30[_0xd647('0x17')](_0x2a8751);}return _0x5c8c30['status'](_0x2a8751)['end']();};}function respondWithResult(_0x2ee6af,_0x2f6e77){_0x2f6e77=_0x2f6e77||0xc8;return function(_0x4d26ab){if(_0x4d26ab){return _0x2ee6af[_0xd647('0x18')](_0x2f6e77)[_0xd647('0x19')](_0x4d26ab);}};}function respondWithFilteredResult(_0x4a3727,_0x37999a){return function(_0x5227c2){if(_0x5227c2){var _0x5db489=typeof _0x37999a['offset']===_0xd647('0x1a')&&typeof _0x37999a['limit']==='undefined';var _0x5717eb=_0x5227c2[_0xd647('0x1b')];var _0x28615a=_0x5db489?0x0:_0x37999a[_0xd647('0x1c')];var _0x4b5a91=_0x5db489?_0x5227c2[_0xd647('0x1b')]:_0x37999a[_0xd647('0x1c')]+_0x37999a['limit'];var _0x2e066c;if(_0x4b5a91>=_0x5717eb){_0x4b5a91=_0x5717eb;_0x2e066c=0xc8;}else{_0x2e066c=0xce;}_0x4a3727[_0xd647('0x18')](_0x2e066c);return _0x4a3727[_0xd647('0x1d')](_0xd647('0x1e'),_0x28615a+'-'+_0x4b5a91+'/'+_0x5717eb)['json'](_0x5227c2);}return null;};}function patchUpdates(_0x504b43){return function(_0x1a5152){try{jsonpatch[_0xd647('0x1f')](_0x1a5152,_0x504b43,!![]);}catch(_0xf385b4){return BPromise[_0xd647('0x20')](_0xf385b4);}return _0x1a5152[_0xd647('0x21')]();};}function saveUpdates(_0x17be84,_0x12ae08){return function(_0x10b310){if(_0x10b310){return _0x10b310[_0xd647('0x22')](_0x17be84)[_0xd647('0x23')](function(_0x557f79){return _0x557f79;});}return null;};}function removeEntity(_0x5bffc2,_0x244d5f){return function(_0x1990d2){if(_0x1990d2){return _0x1990d2['destroy']()[_0xd647('0x23')](function(){_0x5bffc2[_0xd647('0x18')](0xcc)[_0xd647('0x24')]();});}};}function handleEntityNotFound(_0x23adc5,_0x2931ca){return function(_0x31cb3c){if(!_0x31cb3c){_0x23adc5[_0xd647('0x17')](0x194);}return _0x31cb3c;};}function handleError(_0x53d1f6,_0xe88a59){_0xe88a59=_0xe88a59||0x1f4;return function(_0x478a4f){logger['error'](_0x478a4f[_0xd647('0x25')]);if(_0x478a4f['name']){delete _0x478a4f[_0xd647('0x26')];}_0x53d1f6[_0xd647('0x18')](_0xe88a59)[_0xd647('0x27')](_0x478a4f);};}exports[_0xd647('0x22')]=function(_0x11a30a,_0x4e4372){if(_0x11a30a[_0xd647('0x28')]['id']){delete _0x11a30a[_0xd647('0x28')]['id'];}return db[_0xd647('0x29')][_0xd647('0x2a')]({'where':{'id':_0x11a30a[_0xd647('0x2b')]['id']}})[_0xd647('0x23')](handleEntityNotFound(_0x4e4372,null))[_0xd647('0x23')](saveUpdates(_0x11a30a['body'],null))[_0xd647('0x23')](respondWithResult(_0x4e4372,null))[_0xd647('0x2c')](handleError(_0x4e4372,null));};exports[_0xd647('0x2d')]=function(_0x263d74,_0x249fe7){return db['Action'][_0xd647('0x2a')]({'where':{'id':_0x263d74[_0xd647('0x2b')]['id']}})['then'](handleEntityNotFound(_0x249fe7,null))[_0xd647('0x23')](removeEntity(_0x249fe7,null))[_0xd647('0x2c')](handleError(_0x249fe7,null));}; \ No newline at end of file +var _0xdf44=['save','update','then','error','stack','name','send','body','find','params','catch','destroy','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xdf44,0x1d9));var _0x4df4=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xdf44[_0x3e5086];return _0xfeb102;};'use strict';var emlformat=require(_0x4df4('0x0'));var rimraf=require(_0x4df4('0x1'));var zipdir=require(_0x4df4('0x2'));var jsonpatch=require(_0x4df4('0x3'));var rp=require(_0x4df4('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4df4('0x5'));var util=require('util');var path=require(_0x4df4('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4df4('0x7'));var _=require(_0x4df4('0x8'));var squel=require(_0x4df4('0x9'));var crypto=require(_0x4df4('0xa'));var jsforce=require(_0x4df4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4df4('0xc'));var querystring=require(_0x4df4('0xd'));var Papa=require('papaparse');var Redis=require(_0x4df4('0xe'));var authService=require(_0x4df4('0xf'));var qs=require(_0x4df4('0x10'));var as=require(_0x4df4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4df4('0x12'));var utils=require('../../config/utils');var config=require(_0x4df4('0x13'));var licenseUtil=require(_0x4df4('0x14'));var db=require(_0x4df4('0x15'))['db'];function respondWithStatusCode(_0x12c392,_0x1a2e48){_0x1a2e48=_0x1a2e48||0xcc;return function(_0x58ead3){if(_0x58ead3){return _0x12c392[_0x4df4('0x16')](_0x1a2e48);}return _0x12c392[_0x4df4('0x17')](_0x1a2e48)[_0x4df4('0x18')]();};}function respondWithResult(_0x1dbb19,_0x2c574c){_0x2c574c=_0x2c574c||0xc8;return function(_0x2d0dcc){if(_0x2d0dcc){return _0x1dbb19[_0x4df4('0x17')](_0x2c574c)[_0x4df4('0x19')](_0x2d0dcc);}};}function respondWithFilteredResult(_0xd6f538,_0x5413f7){return function(_0x3d6a32){if(_0x3d6a32){var _0x5621e8=typeof _0x5413f7['offset']===_0x4df4('0x1a')&&typeof _0x5413f7[_0x4df4('0x1b')]===_0x4df4('0x1a');var _0x386605=_0x3d6a32[_0x4df4('0x1c')];var _0x149ea3=_0x5621e8?0x0:_0x5413f7[_0x4df4('0x1d')];var _0x5568d2=_0x5621e8?_0x3d6a32[_0x4df4('0x1c')]:_0x5413f7[_0x4df4('0x1d')]+_0x5413f7['limit'];var _0x2404c6;if(_0x5568d2>=_0x386605){_0x5568d2=_0x386605;_0x2404c6=0xc8;}else{_0x2404c6=0xce;}_0xd6f538['status'](_0x2404c6);return _0xd6f538[_0x4df4('0x1e')](_0x4df4('0x1f'),_0x149ea3+'-'+_0x5568d2+'/'+_0x386605)[_0x4df4('0x19')](_0x3d6a32);}return null;};}function patchUpdates(_0x4c201c){return function(_0x1e39c8){try{jsonpatch[_0x4df4('0x20')](_0x1e39c8,_0x4c201c,!![]);}catch(_0x21202a){return BPromise['reject'](_0x21202a);}return _0x1e39c8[_0x4df4('0x21')]();};}function saveUpdates(_0x3f703f,_0x2e11bd){return function(_0x3f77b7){if(_0x3f77b7){return _0x3f77b7[_0x4df4('0x22')](_0x3f703f)[_0x4df4('0x23')](function(_0x5bbb68){return _0x5bbb68;});}return null;};}function removeEntity(_0x2161f8,_0x3c3794){return function(_0x4039e1){if(_0x4039e1){return _0x4039e1['destroy']()[_0x4df4('0x23')](function(){_0x2161f8['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1a3d,_0x5e6052){return function(_0x4d0cbc){if(!_0x4d0cbc){_0x5f1a3d['sendStatus'](0x194);}return _0x4d0cbc;};}function handleError(_0x12f397,_0x392972){_0x392972=_0x392972||0x1f4;return function(_0xc5aec7){logger[_0x4df4('0x24')](_0xc5aec7[_0x4df4('0x25')]);if(_0xc5aec7[_0x4df4('0x26')]){delete _0xc5aec7[_0x4df4('0x26')];}_0x12f397[_0x4df4('0x17')](_0x392972)[_0x4df4('0x27')](_0xc5aec7);};}exports[_0x4df4('0x22')]=function(_0x28c220,_0x3d871e){if(_0x28c220[_0x4df4('0x28')]['id']){delete _0x28c220[_0x4df4('0x28')]['id'];}return db['Action'][_0x4df4('0x29')]({'where':{'id':_0x28c220[_0x4df4('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3d871e,null))['then'](saveUpdates(_0x28c220[_0x4df4('0x28')],null))[_0x4df4('0x23')](respondWithResult(_0x3d871e,null))[_0x4df4('0x2b')](handleError(_0x3d871e,null));};exports[_0x4df4('0x2c')]=function(_0x4ce3fa,_0x4bc539){return db[_0x4df4('0x2d')]['find']({'where':{'id':_0x4ce3fa[_0x4df4('0x2a')]['id']}})[_0x4df4('0x23')](handleEntityNotFound(_0x4bc539,null))[_0x4df4('0x23')](removeEntity(_0x4bc539,null))[_0x4df4('0x2b')](handleError(_0x4bc539,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 177158c..2420f09 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 _0x19a8=['moment','path','rimraf','../../config/environment','exports','define','Action','tools_actions','lodash','util'];(function(_0x488c11,_0x4e1752){var _0x218b84=function(_0x3d7462){while(--_0x3d7462){_0x488c11['push'](_0x488c11['shift']());}};_0x218b84(++_0x4e1752);}(_0x19a8,0x120));var _0x819a=function(_0x445066,_0x197ece){_0x445066=_0x445066-0x0;var _0x55c794=_0x19a8[_0x445066];return _0x55c794;};'use strict';var _=require(_0x819a('0x0'));var util=require(_0x819a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x819a('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x819a('0x3'));var rimraf=require(_0x819a('0x4'));var config=require(_0x819a('0x5'));var attributes=require('./action.attributes');module[_0x819a('0x6')]=function(_0x2aa6bd,_0x10bf31){return _0x2aa6bd[_0x819a('0x7')](_0x819a('0x8'),attributes,{'tableName':_0x819a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2fa=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','api','bluebird','path','rimraf'];(function(_0x1ee351,_0x54261b){var _0x245aaf=function(_0x3e4b65){while(--_0x3e4b65){_0x1ee351['push'](_0x1ee351['shift']());}};_0x245aaf(++_0x54261b);}(_0xd2fa,0x16e));var _0xad2f=function(_0x3b1c09,_0x118b1b){_0x3b1c09=_0x3b1c09-0x0;var _0x1dba35=_0xd2fa[_0x3b1c09];return _0x1dba35;};'use strict';var _=require(_0xad2f('0x0'));var util=require(_0xad2f('0x1'));var logger=require('../../config/logger')(_0xad2f('0x2'));var moment=require('moment');var BPromise=require(_0xad2f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xad2f('0x4'));var rimraf=require(_0xad2f('0x5'));var config=require(_0xad2f('0x6'));var attributes=require(_0xad2f('0x7'));module[_0xad2f('0x8')]=function(_0x5355d2,_0x3e48f7){return _0x5355d2[_0xad2f('0x9')](_0xad2f('0xa'),attributes,{'tableName':_0xad2f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index c0d7f69..5b1bcc4 100644 --- a/server/api/action/action.rpc.js +++ b/server/api/action/action.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Action,\x20%s,\x20%s','debug','Action,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5416db,_0x55683a){var _0x243e35=function(_0x1eb623){while(--_0x1eb623){_0x5416db['push'](_0x5416db['shift']());}};_0x243e35(++_0x55683a);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Action,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});} \ No newline at end of file +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3a41d4,_0x4dd092){var _0x2b906e=function(_0x450b7f){while(--_0x450b7f){_0x3a41d4['push'](_0x3a41d4['shift']());}};_0x2b906e(++_0x4dd092);}(_0x1261,0x144));var _0x1126=function(_0x503ea8,_0x22e391){_0x503ea8=_0x503ea8-0x0;var _0x427e5d=_0x1261[_0x503ea8];return _0x427e5d;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index bc5d71f..b4f55c2 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 _0x5475=['../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','multer','path','express','Router','fs-extra'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x5475,0x1d7));var _0x5547=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5475[_0x2e4aa2];return _0x5e6092;};'use strict';var multer=require(_0x5547('0x0'));var util=require('util');var path=require(_0x5547('0x1'));var timeout=require('connect-timeout');var express=require(_0x5547('0x2'));var router=express[_0x5547('0x3')]();var fs_extra=require(_0x5547('0x4'));var auth=require(_0x5547('0x5'));var interaction=require(_0x5547('0x6'));var config=require(_0x5547('0x7'));var controller=require(_0x5547('0x8'));router[_0x5547('0x9')](_0x5547('0xa'),auth[_0x5547('0xb')](),controller[_0x5547('0xc')]);router['delete']('/:id',auth[_0x5547('0xb')](),controller[_0x5547('0xd')]);module['exports']=router; \ No newline at end of file +var _0xa213=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','update','delete','isAuthenticated','exports','path'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0xa213,0xa4));var _0x3a21=function(_0x95abe4,_0x49785b){_0x95abe4=_0x95abe4-0x0;var _0x2fa910=_0xa213[_0x95abe4];return _0x2fa910;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3a21('0x0'));var timeout=require(_0x3a21('0x1'));var express=require(_0x3a21('0x2'));var router=express[_0x3a21('0x3')]();var fs_extra=require(_0x3a21('0x4'));var auth=require(_0x3a21('0x5'));var interaction=require(_0x3a21('0x6'));var config=require(_0x3a21('0x7'));var controller=require(_0x3a21('0x8'));router[_0x3a21('0x9')](_0x3a21('0xa'),auth['isAuthenticated'](),controller[_0x3a21('0xb')]);router[_0x3a21('0xc')](_0x3a21('0xa'),auth[_0x3a21('0xd')](),controller['destroy']);module[_0x3a21('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 7485e33..adb6626 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x2675,0x75));var _0x5267=function(_0x87f551,_0x39bf50){_0x87f551=_0x87f551-0x0;var _0x36a950=_0x2675[_0x87f551];return _0x36a950;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0x33c5=['STRING','TEXT','exports'];(function(_0x48add3,_0x12fcb4){var _0x472fc9=function(_0x442ce9){while(--_0x442ce9){_0x48add3['push'](_0x48add3['shift']());}};_0x472fc9(++_0x12fcb4);}(_0x33c5,0xe6));var _0x533c=function(_0x2755fb,_0x5970f1){_0x2755fb=_0x2755fb-0x0;var _0x293f12=_0x33c5[_0x2755fb];return _0x293f12;};'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 diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 22daa2f..efaa587 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 _0x30ee=['from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','conditions','clone','debug','sequelize','QueryTypes','SELECT','right_join','SEC_TO_TIME(%s)','ROUND(%s)','IS\x20NULL','findAll','table','field','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','custom','AnalyticExtractedReport','cdr','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','HOUR(%s)','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','CustomReports','UserProfileResource','end','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','create','user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select'];(function(_0x5d238c,_0x44edce){var _0x229c99=function(_0x13a62c){while(--_0x13a62c){_0x5d238c['push'](_0x5d238c['shift']());}};_0x229c99(++_0x44edce);}(_0x30ee,0x18a));var _0xe30e=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x30ee[_0xa45395];return _0x3c83d2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe30e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe30e('0x1'));var rp=require(_0xe30e('0x2'));var moment=require(_0xe30e('0x3'));var BPromise=require(_0xe30e('0x4'));var Mustache=require(_0xe30e('0x5'));var util=require('util');var path=require(_0xe30e('0x6'));var sox=require(_0xe30e('0x7'));var csv=require(_0xe30e('0x8'));var ejs=require(_0xe30e('0x9'));var fs=require('fs');var fs_extra=require(_0xe30e('0xa'));var _=require(_0xe30e('0xb'));var squel=require(_0xe30e('0xc'));var crypto=require(_0xe30e('0xd'));var jsforce=require(_0xe30e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe30e('0x8'));var querystring=require(_0xe30e('0xf'));var Papa=require(_0xe30e('0x10'));var Redis=require(_0xe30e('0x11'));var authService=require(_0xe30e('0x12'));var qs=require(_0xe30e('0x13'));var as=require(_0xe30e('0x14'));var hardwareService=require(_0xe30e('0x15'));var logger=require(_0xe30e('0x16'))(_0xe30e('0x17'));var utils=require(_0xe30e('0x18'));var config=require(_0xe30e('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe30e('0x1a'))['db'];var dbH=require(_0xe30e('0x1a'))[_0xe30e('0x1b')];function respondWithStatusCode(_0xb74f04,_0x1d5a98){_0x1d5a98=_0x1d5a98||0xcc;return function(_0x2247ec){if(_0x2247ec){return _0xb74f04[_0xe30e('0x1c')](_0x1d5a98);}return _0xb74f04[_0xe30e('0x1d')](_0x1d5a98)['end']();};}function respondWithResult(_0x21a2fa,_0x305827){_0x305827=_0x305827||0xc8;return function(_0x43dd0a){if(_0x43dd0a){return _0x21a2fa[_0xe30e('0x1d')](_0x305827)[_0xe30e('0x1e')](_0x43dd0a);}};}function respondWithFilteredResult(_0x31a9ac,_0x3cd77b){return function(_0x3d6005){if(_0x3d6005){var _0x43db88=typeof _0x3cd77b[_0xe30e('0x1f')]===_0xe30e('0x20')&&typeof _0x3cd77b[_0xe30e('0x21')]==='undefined';var _0x5f3d01=_0x3d6005[_0xe30e('0x22')];var _0x2bd7fd=_0x43db88?0x0:_0x3cd77b[_0xe30e('0x1f')];var _0x482f13=_0x43db88?_0x3d6005[_0xe30e('0x22')]:_0x3cd77b[_0xe30e('0x1f')]+_0x3cd77b[_0xe30e('0x21')];var _0x22968b;if(_0x482f13>=_0x5f3d01){_0x482f13=_0x5f3d01;_0x22968b=0xc8;}else{_0x22968b=0xce;}_0x31a9ac['status'](_0x22968b);return _0x31a9ac[_0xe30e('0x23')]('Content-Range',_0x2bd7fd+'-'+_0x482f13+'/'+_0x5f3d01)[_0xe30e('0x1e')](_0x3d6005);}return null;};}function patchUpdates(_0x23fafe){return function(_0x1eb7d9){try{jsonpatch[_0xe30e('0x24')](_0x1eb7d9,_0x23fafe,!![]);}catch(_0x464ac1){return BPromise[_0xe30e('0x25')](_0x464ac1);}return _0x1eb7d9[_0xe30e('0x26')]();};}function saveUpdates(_0x54f187,_0x383863){return function(_0xabd873){if(_0xabd873){return _0xabd873[_0xe30e('0x27')](_0x54f187)[_0xe30e('0x28')](function(_0x4ac257){return _0x4ac257;});}return null;};}function removeEntity(_0x3084f6,_0x1a0774){return function(_0x13f26d){if(_0x13f26d){return _0x13f26d[_0xe30e('0x29')]()['then'](function(){var _0x551b5a=_0x13f26d[_0xe30e('0x2a')]({'plain':!![]});var _0x14c763=_0xe30e('0x2b');return db[_0xe30e('0x2c')]['destroy']({'where':{'type':_0x14c763,'resourceId':_0x551b5a['id']}})[_0xe30e('0x28')](function(){return _0x13f26d;});})['then'](function(){_0x3084f6[_0xe30e('0x1d')](0xcc)[_0xe30e('0x2d')]();});}};}function handleEntityNotFound(_0x398ed9,_0x33101f){return function(_0x2ed03b){if(!_0x2ed03b){_0x398ed9[_0xe30e('0x1c')](0x194);}return _0x2ed03b;};}function handleError(_0x50fa91,_0x5a24cc){_0x5a24cc=_0x5a24cc||0x1f4;return function(_0x564bdb){logger[_0xe30e('0x2e')](_0x564bdb[_0xe30e('0x2f')]);if(_0x564bdb[_0xe30e('0x30')]){delete _0x564bdb[_0xe30e('0x30')];}_0x50fa91[_0xe30e('0x1d')](_0x5a24cc)[_0xe30e('0x31')](_0x564bdb);};}exports[_0xe30e('0x32')]=function(_0x4e5d65,_0x575e4d){var _0x25eccd={},_0x1cab0f={},_0x4b24e1={'count':0x0,'rows':[]};var _0x46456a=_[_0xe30e('0x33')](db[_0xe30e('0x34')][_0xe30e('0x35')],function(_0x2e4b2d){return{'name':_0x2e4b2d[_0xe30e('0x36')],'type':_0x2e4b2d[_0xe30e('0x37')]['key']};});_0x1cab0f['model']=_[_0xe30e('0x33')](_0x46456a,'name');_0x1cab0f[_0xe30e('0x38')]=_[_0xe30e('0x39')](_0x4e5d65[_0xe30e('0x38')]);_0x1cab0f[_0xe30e('0x3a')]=_[_0xe30e('0x3b')](_0x1cab0f[_0xe30e('0x3c')],_0x1cab0f[_0xe30e('0x38')]);_0x25eccd[_0xe30e('0x3d')]=_[_0xe30e('0x3b')](_0x1cab0f[_0xe30e('0x3c')],qs[_0xe30e('0x3e')](_0x4e5d65[_0xe30e('0x38')]['fields']));_0x25eccd[_0xe30e('0x3d')]=_0x25eccd[_0xe30e('0x3d')]['length']?_0x25eccd[_0xe30e('0x3d')]:_0x1cab0f[_0xe30e('0x3c')];if(!_0x4e5d65[_0xe30e('0x38')][_0xe30e('0x3f')](_0xe30e('0x40'))){_0x25eccd['limit']=qs['limit'](_0x4e5d65[_0xe30e('0x38')][_0xe30e('0x21')]);_0x25eccd[_0xe30e('0x1f')]=qs[_0xe30e('0x1f')](_0x4e5d65[_0xe30e('0x38')][_0xe30e('0x1f')]);}_0x25eccd[_0xe30e('0x41')]=qs[_0xe30e('0x42')](_0x4e5d65[_0xe30e('0x38')][_0xe30e('0x42')]);_0x25eccd[_0xe30e('0x43')]=qs[_0xe30e('0x3a')](_[_0xe30e('0x44')](_0x4e5d65['query'],_0x1cab0f[_0xe30e('0x3a')]),_0x46456a);if(_0x4e5d65['query'][_0xe30e('0x45')]){_0x25eccd[_0xe30e('0x43')]=_[_0xe30e('0x46')](_0x25eccd['where'],{'$or':_['map'](_0x46456a,function(_0xdc154c){if(_0xdc154c['type']!==_0xe30e('0x47')){var _0x29710d={};_0x29710d[_0xdc154c['name']]={'$like':'%'+_0x4e5d65[_0xe30e('0x38')][_0xe30e('0x45')]+'%'};return _0x29710d;}})});}_0x25eccd=_[_0xe30e('0x46')]({},_0x25eccd,_0x4e5d65[_0xe30e('0x48')]);var _0x2d7775={'where':_0x25eccd['where']};return db['AnalyticCustomReport'][_0xe30e('0x22')](_0x2d7775)[_0xe30e('0x28')](function(_0x51d95b){_0x4b24e1['count']=_0x51d95b;if(_0x4e5d65[_0xe30e('0x38')]['includeAll']){_0x25eccd[_0xe30e('0x49')]=[{'all':!![]}];}return db[_0xe30e('0x34')]['findAll'](_0x25eccd);})[_0xe30e('0x28')](function(_0x3f1b0a){_0x4b24e1['rows']=_0x3f1b0a;return _0x4b24e1;})['then'](respondWithFilteredResult(_0x575e4d,_0x25eccd))[_0xe30e('0x4a')](handleError(_0x575e4d,null));};exports[_0xe30e('0x4b')]=function(_0x209593,_0x3574da){var _0x4cd893={'raw':![],'where':{'id':_0x209593[_0xe30e('0x4c')]['id']}},_0x436f01={};_0x436f01[_0xe30e('0x3c')]=_[_0xe30e('0x39')](db[_0xe30e('0x34')]['rawAttributes']);_0x436f01[_0xe30e('0x38')]=_[_0xe30e('0x39')](_0x209593[_0xe30e('0x38')]);_0x436f01[_0xe30e('0x3a')]=_[_0xe30e('0x3b')](_0x436f01[_0xe30e('0x3c')],_0x436f01[_0xe30e('0x38')]);_0x4cd893[_0xe30e('0x3d')]=_[_0xe30e('0x3b')](_0x436f01[_0xe30e('0x3c')],qs['fields'](_0x209593[_0xe30e('0x38')]['fields']));_0x4cd893[_0xe30e('0x3d')]=_0x4cd893['attributes']['length']?_0x4cd893[_0xe30e('0x3d')]:_0x436f01['model'];if(_0x209593[_0xe30e('0x38')][_0xe30e('0x4d')]){_0x4cd893['include']=[{'all':!![]}];}_0x4cd893=_[_0xe30e('0x46')]({},_0x4cd893,_0x209593[_0xe30e('0x48')]);return db[_0xe30e('0x34')]['find'](_0x4cd893)['then'](handleEntityNotFound(_0x3574da,null))['then'](respondWithResult(_0x3574da,null))[_0xe30e('0x4a')](handleError(_0x3574da,null));};exports[_0xe30e('0x4e')]=function(_0x342c73,_0xf8db03){return db[_0xe30e('0x34')]['create'](_0x342c73['body'],{})[_0xe30e('0x28')](function(_0x3cc698){var _0x2211a3=_0x342c73[_0xe30e('0x4f')][_0xe30e('0x2a')]({'plain':!![]});if(!_0x2211a3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2211a3[_0xe30e('0x50')]===_0xe30e('0x4f')){var _0x39af70=_0x3cc698[_0xe30e('0x2a')]({'plain':!![]});var _0x3a0613=_0xe30e('0x51');return db[_0xe30e('0x52')]['find']({'where':{'name':_0x3a0613,'userProfileId':_0x2211a3[_0xe30e('0x53')]},'raw':!![]})['then'](function(_0x30e19e){if(_0x30e19e&&_0x30e19e['autoAssociation']===0x0){return db[_0xe30e('0x2c')]['create']({'name':_0x39af70[_0xe30e('0x30')],'resourceId':_0x39af70['id'],'type':_0xe30e('0x2b'),'sectionId':_0x30e19e['id']},{})['then'](function(){return _0x3cc698;});}else{return _0x3cc698;}})[_0xe30e('0x4a')](function(_0x1c2fd3){logger['error'](_0xe30e('0x54'),_0x1c2fd3);throw _0x1c2fd3;});}return _0x3cc698;})[_0xe30e('0x28')](respondWithResult(_0xf8db03,0xc9))[_0xe30e('0x4a')](handleError(_0xf8db03,null));};exports['update']=function(_0x26f328,_0x2fb376){if(_0x26f328[_0xe30e('0x55')]['id']){delete _0x26f328[_0xe30e('0x55')]['id'];}return db['AnalyticCustomReport'][_0xe30e('0x56')]({'where':{'id':_0x26f328['params']['id']}})[_0xe30e('0x28')](handleEntityNotFound(_0x2fb376,null))[_0xe30e('0x28')](saveUpdates(_0x26f328['body'],null))['then'](respondWithResult(_0x2fb376,null))[_0xe30e('0x4a')](handleError(_0x2fb376,null));};exports[_0xe30e('0x29')]=function(_0x96fbde,_0x13ae0a){return db[_0xe30e('0x34')][_0xe30e('0x56')]({'where':{'id':_0x96fbde[_0xe30e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x13ae0a,null))['then'](removeEntity(_0x13ae0a,null))[_0xe30e('0x4a')](handleError(_0x13ae0a,null));};exports[_0xe30e('0x57')]=function(_0x5280f3,_0x559b70){var _0x37cfb1=0xa;var _0x2c9a4a=[_0xe30e('0x58'),_0xe30e('0x59'),'right_join',_0xe30e('0x5a')];var _0x55cdbd={'SUM':_0xe30e('0x5b'),'COUNT':_0xe30e('0x5c'),'COUNT DISTINCT':_0xe30e('0x5d'),'MAX':_0xe30e('0x5e'),'MIN':_0xe30e('0x5f'),'AVG':_0xe30e('0x60'),'GROUP_CONCAT':_0xe30e('0x61'),'GROUP_CONCAT ASC':_0xe30e('0x62'),'GROUP_CONCAT DESC':_0xe30e('0x63')};var _0x8d61c8={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe30e('0x64'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe30e('0x65')};var _0x1f3a22=function(_0x2fa469){return!_[_0xe30e('0x66')](['IS\x20NULL',_0xe30e('0x67'),_0xe30e('0x68'),_0xe30e('0x69')],_0x2fa469);};var _0x5973ba=function(_0x347641){if(!_0x347641||!_0x347641[_0xe30e('0x6a')][_0xe30e('0x6b')]){return'';}for(var _0xedaff8='(',_0x5d33e2=0x0;_0x5d33e2<_0x347641[_0xe30e('0x6a')][_0xe30e('0x6b')];_0x5d33e2+=0x1){_0x5d33e2>0x0&&(_0xedaff8+='\x20'+_0x347641[_0xe30e('0x6c')]+'\x20');_0xedaff8+=_0x347641['rules'][_0x5d33e2][_0xe30e('0x6d')]?_0x5973ba(_0x347641[_0xe30e('0x6a')][_0x5d33e2][_0xe30e('0x6d')]):_0x347641[_0xe30e('0x6a')][_0x5d33e2]['field']+'\x20'+_0x347641[_0xe30e('0x6a')][_0x5d33e2][_0xe30e('0x6e')]+(_0x1f3a22(_0x347641[_0xe30e('0x6a')][_0x5d33e2][_0xe30e('0x6e')])?'\x20'+_0x347641[_0xe30e('0x6a')][_0x5d33e2][_0xe30e('0x6f')]:'');}return _0xedaff8+')';};var _0x6ac1bf={'where':{'id':_0x5280f3[_0xe30e('0x4c')]['id']}},_0x874e7,_0x544f14,_0x39a160,_0x5b3070,_0x500c89;_0x6ac1bf=_[_0xe30e('0x46')]({},_0x6ac1bf,_0x5280f3['options']);return db['AnalyticCustomReport'][_0xe30e('0x56')](_0x6ac1bf)[_0xe30e('0x28')](function(_0x3dfade){if(_0x3dfade){_0x874e7=_0x3dfade;return _0x3dfade[_0xe30e('0x70')]();}return null;})[_0xe30e('0x28')](function(_0x5abffb){if(_0x5abffb){if(!_0x5abffb[_0xe30e('0x6b')]){throw new db[(_0xe30e('0x71'))][(_0xe30e('0x72'))](_0xe30e('0x73'),0x193);}_0x544f14=_0x5abffb;return db[_0xe30e('0x74')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x10f807){if(_0x10f807){_0x39a160=_[_0xe30e('0x75')](_0x10f807,'id');var _0xf09b61;var _0x4ef117=squel[_0xe30e('0x76')]();_0x4ef117[_0xe30e('0x77')](_0x874e7['table']);for(var _0x33e602=0x0;_0x33e602<_0x544f14[_0xe30e('0x6b')];_0x33e602+=0x1){_0xf09b61=_0x544f14[_0x33e602][_0xe30e('0x78')]?_0x39a160[_0x544f14[_0x33e602][_0xe30e('0x78')]][_0xe30e('0x79')]:_0x544f14[_0x33e602]['field'];_0xf09b61=_0x544f14[_0x33e602][_0xe30e('0x7a')]?_[_0xe30e('0x7b')](_0x55cdbd[_0x544f14[_0x33e602][_0xe30e('0x7a')]],'%s',_0xf09b61):_0xf09b61;_0xf09b61=_0x544f14[_0x33e602][_0xe30e('0x7c')]?_['replace'](_0x8d61c8[_0x544f14[_0x33e602][_0xe30e('0x7c')]],'%s',_0xf09b61):_0xf09b61;if(_0x544f14[_0x33e602][_0xe30e('0x7d')]){_0x4ef117[_0xe30e('0x6d')](_0xf09b61);}_0x544f14[_0x33e602][_0xe30e('0x7e')]&&_0x4ef117[_0xe30e('0x41')](_0xf09b61,_0x544f14[_0x33e602]['orderBy']===_0xe30e('0x7f')?![]:!![]);_0x4ef117['field'](_0xf09b61,_0x544f14[_0x33e602][_0xe30e('0x80')]||_0xf09b61);}if(_0x874e7['joins']){_0x874e7[_0xe30e('0x81')]=JSON[_0xe30e('0x82')](_0x874e7['joins']);for(var _0x3d408f=0x0;_0x3d408f<_0x874e7['joins'][_0xe30e('0x6b')];_0x3d408f+=0x1){if(_0x874e7['joins'][_0x3d408f]['type']&&_['includes'](_0x2c9a4a,_0x874e7[_0xe30e('0x81')][_0x3d408f][_0xe30e('0x37')])&&_0x874e7[_0xe30e('0x81')][_0x3d408f][_0xe30e('0x83')]&&_0x874e7[_0xe30e('0x81')][_0x3d408f]['foreignTable']&&_0x874e7[_0xe30e('0x81')][_0x3d408f][_0xe30e('0x84')]){_0x4ef117[_0x874e7[_0xe30e('0x81')][_0x3d408f]['type']](_0x874e7['joins'][_0x3d408f][_0xe30e('0x85')],null,util[_0xe30e('0x7c')]('%s.%s\x20=\x20%s.%s',_0x874e7['table'],_0x874e7['joins'][_0x3d408f][_0xe30e('0x83')],_0x874e7[_0xe30e('0x81')][_0x3d408f][_0xe30e('0x85')],_0x874e7['joins'][_0x3d408f][_0xe30e('0x84')]));}}}if(_0x874e7[_0xe30e('0x86')]){_0x874e7[_0xe30e('0x86')]=JSON['parse'](_0x874e7[_0xe30e('0x86')]);_0x4ef117[_0xe30e('0x43')](_0x5973ba(_0x874e7[_0xe30e('0x86')][_0xe30e('0x6d')]));}_0x500c89=_0x4ef117[_0xe30e('0x87')]();_0x4ef117[_0xe30e('0x21')](_0x37cfb1);_0x4ef117[_0xe30e('0x1f')](0x0);logger[_0xe30e('0x88')]('Limited\x20Query:',_0x4ef117['toString']());return dbH[_0xe30e('0x89')]['query'](_0x4ef117['toString'](),{'type':dbH[_0xe30e('0x89')][_0xe30e('0x8a')][_0xe30e('0x8b')]});}})[_0xe30e('0x28')](respondWithResult(_0x559b70,null))[_0xe30e('0x4a')](handleError(_0x559b70,null));};function runReport(_0x1a2352,_0x354424,_0x2523bd){var _0x2f07b3=_0x354424[_0xe30e('0x30')];var _0x4de068=0xa;var _0x4d27ce=['join','left_join',_0xe30e('0x8c'),_0xe30e('0x5a')];var _0x4568b9={'SUM':_0xe30e('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe30e('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xe30e('0x60'),'GROUP_CONCAT':_0xe30e('0x61'),'GROUP_CONCAT ASC':_0xe30e('0x62'),'GROUP_CONCAT DESC':_0xe30e('0x63')};var _0x2f73b8={'SEC_TO_TIME':_0xe30e('0x8d'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xe30e('0x8e'),'UNIX_TIMESTAMP':_0xe30e('0x65')};var _0x4e19af=function(_0x5deba1){return!_['includes']([_0xe30e('0x8f'),_0xe30e('0x67'),'IS\x20EMPTY',_0xe30e('0x69')],_0x5deba1);};var _0x34d52d=function(_0x3dbbae){if(!_0x3dbbae||!_0x3dbbae[_0xe30e('0x6a')]['length']){return'';}for(var _0x445da6='(',_0x6bc7e6=0x0;_0x6bc7e6<_0x3dbbae['rules'][_0xe30e('0x6b')];_0x6bc7e6+=0x1){_0x6bc7e6>0x0&&(_0x445da6+='\x20'+_0x3dbbae[_0xe30e('0x6c')]+'\x20');_0x445da6+=_0x3dbbae['rules'][_0x6bc7e6][_0xe30e('0x6d')]?_0x34d52d(_0x3dbbae[_0xe30e('0x6a')][_0x6bc7e6]['group']):_0x3dbbae[_0xe30e('0x6a')][_0x6bc7e6]['field']+'\x20'+_0x3dbbae[_0xe30e('0x6a')][_0x6bc7e6]['condition']+(_0x4e19af(_0x3dbbae[_0xe30e('0x6a')][_0x6bc7e6][_0xe30e('0x6e')])?'\x20'+_0x3dbbae[_0xe30e('0x6a')][_0x6bc7e6][_0xe30e('0x6f')]:'');}return _0x445da6+')';};var _0x23b882={'where':{'id':_0x1a2352['id']}},_0x45322f,_0x3debc4,_0x188260,_0x222a50,_0x272c70;_0x23b882=_[_0xe30e('0x46')]({},_0x23b882,_0x2523bd);return db[_0xe30e('0x34')][_0xe30e('0x56')](_0x23b882)[_0xe30e('0x28')](function(_0x40ff23){if(_0x40ff23){_0x45322f=_0x40ff23;return _0x40ff23[_0xe30e('0x70')]();}return null;})[_0xe30e('0x28')](function(_0x469ebf){if(_0x469ebf){if(!_0x469ebf[_0xe30e('0x6b')]){throw new db['Sequelize']['ValidationErrorItem'](_0xe30e('0x73'),0x193);}_0x3debc4=_0x469ebf;return db['AnalyticMetric'][_0xe30e('0x90')]({'raw':!![]});}return null;})['then'](function(_0x3df26f){if(_0x3df26f){_0x188260=_[_0xe30e('0x75')](_0x3df26f,'id');var _0x220b9a;var _0x252200=squel[_0xe30e('0x76')]();_0x252200[_0xe30e('0x77')](_0x45322f[_0xe30e('0x91')]);for(var _0x374fe7=0x0;_0x374fe7<_0x3debc4[_0xe30e('0x6b')];_0x374fe7+=0x1){_0x220b9a=_0x3debc4[_0x374fe7][_0xe30e('0x78')]?_0x188260[_0x3debc4[_0x374fe7][_0xe30e('0x78')]][_0xe30e('0x79')]:_0x3debc4[_0x374fe7][_0xe30e('0x92')];_0x220b9a=_0x3debc4[_0x374fe7][_0xe30e('0x7a')]?_['replace'](_0x4568b9[_0x3debc4[_0x374fe7][_0xe30e('0x7a')]],'%s',_0x220b9a):_0x220b9a;_0x220b9a=_0x3debc4[_0x374fe7][_0xe30e('0x7c')]?_['replace'](_0x2f73b8[_0x3debc4[_0x374fe7][_0xe30e('0x7c')]],'%s',_0x220b9a):_0x220b9a;if(_0x3debc4[_0x374fe7]['groupBy']){_0x252200['group'](_0x220b9a);}_0x3debc4[_0x374fe7]['orderBy']&&_0x252200[_0xe30e('0x41')](_0x220b9a,_0x3debc4[_0x374fe7][_0xe30e('0x7e')]===_0xe30e('0x7f')?![]:!![]);_0x252200[_0xe30e('0x92')](_0x220b9a,_0x3debc4[_0x374fe7][_0xe30e('0x80')]||_0x220b9a);}if(_0x45322f[_0xe30e('0x81')]){_0x45322f[_0xe30e('0x81')]=JSON[_0xe30e('0x82')](_0x45322f[_0xe30e('0x81')]);for(var _0x389652=0x0;_0x389652<_0x45322f['joins'][_0xe30e('0x6b')];_0x389652+=0x1){if(_0x45322f[_0xe30e('0x81')][_0x389652][_0xe30e('0x37')]&&_[_0xe30e('0x66')](_0x4d27ce,_0x45322f['joins'][_0x389652][_0xe30e('0x37')])&&_0x45322f['joins'][_0x389652]['parentKey']&&_0x45322f['joins'][_0x389652][_0xe30e('0x85')]&&_0x45322f['joins'][_0x389652]['foreignKey']){_0x252200[_0x45322f[_0xe30e('0x81')][_0x389652][_0xe30e('0x37')]](_0x45322f[_0xe30e('0x81')][_0x389652][_0xe30e('0x85')],null,util[_0xe30e('0x7c')](_0xe30e('0x93'),_0x45322f[_0xe30e('0x91')],_0x45322f[_0xe30e('0x81')][_0x389652][_0xe30e('0x83')],_0x45322f[_0xe30e('0x81')][_0x389652][_0xe30e('0x85')],_0x45322f['joins'][_0x389652][_0xe30e('0x84')]));}}}if(_0x45322f['conditions']){_0x45322f[_0xe30e('0x86')]=JSON[_0xe30e('0x82')](_0x45322f['conditions']);_0x252200[_0xe30e('0x43')](_0x34d52d(_0x45322f[_0xe30e('0x86')]['group']));}_0x272c70=_0x252200[_0xe30e('0x87')]();_0x252200[_0xe30e('0x21')](_0x4de068);_0x252200[_0xe30e('0x1f')](0x0);return;}})[_0xe30e('0x28')](function(){if(_0x354424[_0xe30e('0x94')]===_0xe30e('0x95')){return null;}var _0x2117b4=_[_0xe30e('0x46')](_0x354424,{'name':_0x354424[_0xe30e('0x96')]||_0x354424[_0xe30e('0x30')]||_0x45322f['name'],'basename':_0x2f07b3,'savename':util[_0xe30e('0x7c')](_0xe30e('0x97'),_0x354424[_0xe30e('0x30')]||_0x45322f[_0xe30e('0x30')],require(_0xe30e('0x98'))['generate'](0x4),_0x354424[_0xe30e('0x94')]||'csv'),'reportId':_0x45322f['id'],'reportType':_0xe30e('0x99')});return db[_0xe30e('0x9a')][_0xe30e('0x4e')](_0x2117b4,{'raw':!![]});})[_0xe30e('0x28')](function(_0x1109e0){if(_0x45322f['table']===_0xe30e('0x9b')){_0x272c70[_0xe30e('0x43')](_0x45322f['table']+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x354424[_0xe30e('0x9c')],_0x354424['endDate']);}else{_0x272c70['where'](_0x45322f[_0xe30e('0x91')]+_0xe30e('0x9d'),_0x354424[_0xe30e('0x9c')],_0x354424[_0xe30e('0x9e')]);}if(_0x1109e0){logger[_0xe30e('0x9f')](_0xe30e('0xa0'),_0x272c70[_0xe30e('0xa1')]());require(_0xe30e('0xa2'))[_0xe30e('0xa3')](path['join'](__dirname,_0xe30e('0xa4'),_0x1109e0[_0xe30e('0x94')]),[_0x1109e0['id'],_0x272c70[_0xe30e('0xa1')](),path[_0xe30e('0x58')](__dirname,_0xe30e('0xa5'),_0x1109e0[_0xe30e('0xa6')]),_0x2f07b3]);return _0x1109e0;}else{var _0x1d3099=squel[_0xe30e('0x76')]();_0x1d3099['from']('('+_0x272c70[_0xe30e('0xa1')]()+')',_0xe30e('0xa7'));_0x1d3099['field'](_0xe30e('0xa8'),_0xe30e('0x22'));_0x272c70[_0xe30e('0x21')](_0x354424[_0xe30e('0x21')]||_0x4de068);_0x272c70['offset'](_0x354424['offset']||0x0);return dbH[_0xe30e('0x89')][_0xe30e('0x38')](_0x1d3099['toString'](),{'type':dbH['sequelize'][_0xe30e('0x8a')][_0xe30e('0x8b')]})[_0xe30e('0x28')](function(_0x32b525){if(!_0x32b525['length']){_0x222a50=0x0;}else{_0x222a50=_0x32b525[0x0][_0xe30e('0x22')]||0x0;}return dbH[_0xe30e('0x89')][_0xe30e('0x38')](_0x272c70[_0xe30e('0xa1')](),{'type':dbH[_0xe30e('0x89')]['QueryTypes']['SELECT']});})[_0xe30e('0x28')](function(_0xf93d08){return{'rows':_0xf93d08||[],'count':_0x222a50};});}});}exports['run']=function(_0x1793c4,_0x202871){return runReport(_0x1793c4[_0xe30e('0x4c')],_0x1793c4[_0xe30e('0x38')],_0x1793c4[_0xe30e('0x48')])[_0xe30e('0x28')](respondWithResult(_0x202871,null))['catch'](handleError(_0x202871,null));};exports[_0xe30e('0xa9')]=runReport;exports[_0xe30e('0x38')]=function(_0x422a1a,_0x8ed9a2){var _0x3b054c=0xa;var _0x561ab3=['join',_0xe30e('0x59'),_0xe30e('0x8c'),_0xe30e('0x5a')];var _0x240731={'SUM':_0xe30e('0x5b'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xe30e('0x5d'),'MAX':_0xe30e('0x5e'),'MIN':_0xe30e('0x5f'),'AVG':_0xe30e('0x60'),'GROUP_CONCAT':_0xe30e('0x61'),'GROUP_CONCAT ASC':_0xe30e('0x62'),'GROUP_CONCAT DESC':_0xe30e('0x63')};var _0x3f2547={'SEC_TO_TIME':_0xe30e('0x8d'),'DATE':_0xe30e('0x64'),'HOUR':_0xe30e('0xaa'),'ROUND':_0xe30e('0x8e'),'UNIX_TIMESTAMP':_0xe30e('0x65')};var _0x568dcd=function(_0x310e6c){return!_[_0xe30e('0x66')]([_0xe30e('0x8f'),'IS\x20NOT\x20NULL',_0xe30e('0x68'),_0xe30e('0x69')],_0x310e6c);};var _0xe2d9fe=function(_0x59969d){if(!_0x59969d||!_0x59969d[_0xe30e('0x6a')][_0xe30e('0x6b')]){return'';}for(var _0x2f3ab3='(',_0x4963ce=0x0;_0x4963ce<_0x59969d[_0xe30e('0x6a')]['length'];_0x4963ce+=0x1){_0x4963ce>0x0&&(_0x2f3ab3+='\x20'+_0x59969d[_0xe30e('0x6c')]+'\x20');_0x2f3ab3+=_0x59969d[_0xe30e('0x6a')][_0x4963ce][_0xe30e('0x6d')]?_0xe2d9fe(_0x59969d[_0xe30e('0x6a')][_0x4963ce][_0xe30e('0x6d')]):_0x59969d[_0xe30e('0x6a')][_0x4963ce][_0xe30e('0x92')]+'\x20'+_0x59969d['rules'][_0x4963ce][_0xe30e('0x6e')]+(_0x568dcd(_0x59969d[_0xe30e('0x6a')][_0x4963ce]['condition'])?'\x20'+_0x59969d['rules'][_0x4963ce][_0xe30e('0x6f')]:'');}return _0x2f3ab3+')';};var _0x20d1d2={'where':{'id':_0x422a1a[_0xe30e('0x4c')]['id']}},_0x52a747,_0x99a02,_0x3a7a11,_0x2e572f,_0x307d3e;_0x20d1d2=_[_0xe30e('0x46')]({},_0x20d1d2,_0x422a1a[_0xe30e('0x48')]);return db[_0xe30e('0x34')][_0xe30e('0x56')](_0x20d1d2)[_0xe30e('0x28')](function(_0x110645){if(_0x110645){_0x52a747=_0x110645;return _0x110645[_0xe30e('0x70')]();}return null;})[_0xe30e('0x28')](function(_0x55e00c){if(_0x55e00c){if(!_0x55e00c['length']){throw new db[(_0xe30e('0x71'))][(_0xe30e('0x72'))](_0xe30e('0x73'),0x193);}_0x99a02=_0x55e00c;return db[_0xe30e('0x74')][_0xe30e('0x90')]({'raw':!![]});}return null;})['then'](function(_0x4888d1){if(_0x4888d1){_0x3a7a11=_['keyBy'](_0x4888d1,'id');var _0x2d7003;var _0x1d1315=squel[_0xe30e('0x76')]();_0x1d1315['from'](_0x52a747['table']);for(var _0xbad5a5=0x0;_0xbad5a5<_0x99a02[_0xe30e('0x6b')];_0xbad5a5+=0x1){_0x2d7003=_0x99a02[_0xbad5a5][_0xe30e('0x78')]?_0x3a7a11[_0x99a02[_0xbad5a5]['MetricId']]['metric']:_0x99a02[_0xbad5a5][_0xe30e('0x92')];_0x2d7003=_0x99a02[_0xbad5a5]['function']?_[_0xe30e('0x7b')](_0x240731[_0x99a02[_0xbad5a5][_0xe30e('0x7a')]],'%s',_0x2d7003):_0x2d7003;_0x2d7003=_0x99a02[_0xbad5a5]['format']?_['replace'](_0x3f2547[_0x99a02[_0xbad5a5][_0xe30e('0x7c')]],'%s',_0x2d7003):_0x2d7003;if(_0x99a02[_0xbad5a5][_0xe30e('0x7d')]){_0x1d1315['group'](_0x2d7003);}_0x99a02[_0xbad5a5][_0xe30e('0x7e')]&&_0x1d1315[_0xe30e('0x41')](_0x2d7003,_0x99a02[_0xbad5a5][_0xe30e('0x7e')]===_0xe30e('0x7f')?![]:!![]);_0x1d1315[_0xe30e('0x92')](_0x2d7003,_0x99a02[_0xbad5a5]['alias']||_0x2d7003);}if(_0x52a747['joins']){_0x52a747[_0xe30e('0x81')]=JSON[_0xe30e('0x82')](_0x52a747[_0xe30e('0x81')]);for(var _0xe87dde=0x0;_0xe87dde<_0x52a747[_0xe30e('0x81')]['length'];_0xe87dde+=0x1){if(_0x52a747[_0xe30e('0x81')][_0xe87dde][_0xe30e('0x37')]&&_['includes'](_0x561ab3,_0x52a747[_0xe30e('0x81')][_0xe87dde][_0xe30e('0x37')])&&_0x52a747[_0xe30e('0x81')][_0xe87dde][_0xe30e('0x83')]&&_0x52a747['joins'][_0xe87dde][_0xe30e('0x85')]&&_0x52a747[_0xe30e('0x81')][_0xe87dde][_0xe30e('0x84')]){_0x1d1315[_0x52a747['joins'][_0xe87dde][_0xe30e('0x37')]](_0x52a747[_0xe30e('0x81')][_0xe87dde][_0xe30e('0x85')],null,util[_0xe30e('0x7c')](_0xe30e('0x93'),_0x52a747[_0xe30e('0x91')],_0x52a747[_0xe30e('0x81')][_0xe87dde][_0xe30e('0x83')],_0x52a747['joins'][_0xe87dde][_0xe30e('0x85')],_0x52a747[_0xe30e('0x81')][_0xe87dde][_0xe30e('0x84')]));}}}if(_0x52a747[_0xe30e('0x86')]){_0x52a747[_0xe30e('0x86')]=JSON[_0xe30e('0x82')](_0x52a747[_0xe30e('0x86')]);_0x1d1315[_0xe30e('0x43')](_0xe2d9fe(_0x52a747[_0xe30e('0x86')][_0xe30e('0x6d')]));}_0x307d3e=_0x1d1315[_0xe30e('0x87')]();_0x1d1315[_0xe30e('0x21')](_0x3b054c);_0x1d1315[_0xe30e('0x1f')](0x0);logger[_0xe30e('0x88')]('Limited\x20Query:',_0x1d1315[_0xe30e('0xa1')]());return dbH['sequelize'][_0xe30e('0x38')](_0x1d1315[_0xe30e('0xa1')](),{'type':dbH[_0xe30e('0x89')]['QueryTypes']['SELECT']});}})[_0xe30e('0x28')](function(){return{'sql':_0x307d3e[_0xe30e('0xa1')]()};})['then'](respondWithResult(_0x8ed9a2,null))['catch'](handleError(_0x8ed9a2,null));}; \ No newline at end of file +var _0x3e23=['fs-extra','lodash','crypto','desk.js','to-csv','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','CustomReports','error','stack','name','send','index','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','show','params','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','%s.%s\x20=\x20%s.%s','foreignTable','foreignKey','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','right_join','cross_join','SUM(%s)','DATE(%s)','IS\x20NULL','value','getFields','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','countTable','COUNT(*)','run','AVG(%s)','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs'];(function(_0x437f59,_0x2e9342){var _0x2ba6a4=function(_0x34dc69){while(--_0x34dc69){_0x437f59['push'](_0x437f59['shift']());}};_0x2ba6a4(++_0x2e9342);}(_0x3e23,0x9c));var _0x33e2=function(_0x338f73,_0x1945c8){_0x338f73=_0x338f73-0x0;var _0x163fdf=_0x3e23[_0x338f73];return _0x163fdf;};'use strict';var emlformat=require(_0x33e2('0x0'));var rimraf=require(_0x33e2('0x1'));var zipdir=require(_0x33e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x33e2('0x3'));var moment=require(_0x33e2('0x4'));var BPromise=require(_0x33e2('0x5'));var Mustache=require(_0x33e2('0x6'));var util=require('util');var path=require(_0x33e2('0x7'));var sox=require(_0x33e2('0x8'));var csv=require('to-csv');var ejs=require(_0x33e2('0x9'));var fs=require('fs');var fs_extra=require(_0x33e2('0xa'));var _=require(_0x33e2('0xb'));var squel=require('squel');var crypto=require(_0x33e2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x33e2('0xd'));var toCsv=require(_0x33e2('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x33e2('0xf'));var as=require(_0x33e2('0x10'));var hardwareService=require(_0x33e2('0x11'));var logger=require('../../config/logger')(_0x33e2('0x12'));var utils=require(_0x33e2('0x13'));var config=require(_0x33e2('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x33e2('0x15'))['db'];var dbH=require(_0x33e2('0x15'))[_0x33e2('0x16')];function respondWithStatusCode(_0x44477c,_0x14d64d){_0x14d64d=_0x14d64d||0xcc;return function(_0x102c63){if(_0x102c63){return _0x44477c[_0x33e2('0x17')](_0x14d64d);}return _0x44477c[_0x33e2('0x18')](_0x14d64d)[_0x33e2('0x19')]();};}function respondWithResult(_0x26c07d,_0x41ecd3){_0x41ecd3=_0x41ecd3||0xc8;return function(_0x19da1c){if(_0x19da1c){return _0x26c07d['status'](_0x41ecd3)[_0x33e2('0x1a')](_0x19da1c);}};}function respondWithFilteredResult(_0xcfadf1,_0x1827cc){return function(_0x19da65){if(_0x19da65){var _0x1036c2=typeof _0x1827cc[_0x33e2('0x1b')]==='undefined'&&typeof _0x1827cc['limit']===_0x33e2('0x1c');var _0x590a05=_0x19da65[_0x33e2('0x1d')];var _0x1bcfc2=_0x1036c2?0x0:_0x1827cc[_0x33e2('0x1b')];var _0x17a7d9=_0x1036c2?_0x19da65[_0x33e2('0x1d')]:_0x1827cc[_0x33e2('0x1b')]+_0x1827cc[_0x33e2('0x1e')];var _0x3d15af;if(_0x17a7d9>=_0x590a05){_0x17a7d9=_0x590a05;_0x3d15af=0xc8;}else{_0x3d15af=0xce;}_0xcfadf1[_0x33e2('0x18')](_0x3d15af);return _0xcfadf1[_0x33e2('0x1f')](_0x33e2('0x20'),_0x1bcfc2+'-'+_0x17a7d9+'/'+_0x590a05)[_0x33e2('0x1a')](_0x19da65);}return null;};}function patchUpdates(_0x576571){return function(_0x38cea4){try{jsonpatch[_0x33e2('0x21')](_0x38cea4,_0x576571,!![]);}catch(_0x30fb14){return BPromise[_0x33e2('0x22')](_0x30fb14);}return _0x38cea4[_0x33e2('0x23')]();};}function saveUpdates(_0x37f794,_0x49c9db){return function(_0x3e438f){if(_0x3e438f){return _0x3e438f[_0x33e2('0x24')](_0x37f794)[_0x33e2('0x25')](function(_0x5e5168){return _0x5e5168;});}return null;};}function removeEntity(_0x15c5d6,_0x3a9f5b){return function(_0x4dac27){if(_0x4dac27){return _0x4dac27[_0x33e2('0x26')]()['then'](function(){var _0x11379c=_0x4dac27['get']({'plain':!![]});var _0x4522e6=_0x33e2('0x27');return db['UserProfileResource'][_0x33e2('0x26')]({'where':{'type':_0x4522e6,'resourceId':_0x11379c['id']}})[_0x33e2('0x25')](function(){return _0x4dac27;});})[_0x33e2('0x25')](function(){_0x15c5d6[_0x33e2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14e59c,_0x4d7afb){return function(_0x1fda6a){if(!_0x1fda6a){_0x14e59c[_0x33e2('0x17')](0x194);}return _0x1fda6a;};}function handleError(_0x25e06f,_0xd7f9fa){_0xd7f9fa=_0xd7f9fa||0x1f4;return function(_0xf0e466){logger[_0x33e2('0x28')](_0xf0e466[_0x33e2('0x29')]);if(_0xf0e466[_0x33e2('0x2a')]){delete _0xf0e466[_0x33e2('0x2a')];}_0x25e06f[_0x33e2('0x18')](_0xd7f9fa)[_0x33e2('0x2b')](_0xf0e466);};}exports[_0x33e2('0x2c')]=function(_0xf2a2c5,_0x5af84e){var _0x42fd41={},_0x28cc24={},_0x391c38={'count':0x0,'rows':[]};var _0xf93ddd=_['map'](db[_0x33e2('0x2d')][_0x33e2('0x2e')],function(_0x552915){return{'name':_0x552915[_0x33e2('0x2f')],'type':_0x552915[_0x33e2('0x30')][_0x33e2('0x31')]};});_0x28cc24[_0x33e2('0x32')]=_['map'](_0xf93ddd,_0x33e2('0x2a'));_0x28cc24[_0x33e2('0x33')]=_[_0x33e2('0x34')](_0xf2a2c5[_0x33e2('0x33')]);_0x28cc24[_0x33e2('0x35')]=_[_0x33e2('0x36')](_0x28cc24['model'],_0x28cc24['query']);_0x42fd41[_0x33e2('0x37')]=_[_0x33e2('0x36')](_0x28cc24[_0x33e2('0x32')],qs[_0x33e2('0x38')](_0xf2a2c5[_0x33e2('0x33')]['fields']));_0x42fd41[_0x33e2('0x37')]=_0x42fd41[_0x33e2('0x37')][_0x33e2('0x39')]?_0x42fd41['attributes']:_0x28cc24[_0x33e2('0x32')];if(!_0xf2a2c5[_0x33e2('0x33')]['hasOwnProperty']('nolimit')){_0x42fd41[_0x33e2('0x1e')]=qs[_0x33e2('0x1e')](_0xf2a2c5['query']['limit']);_0x42fd41[_0x33e2('0x1b')]=qs[_0x33e2('0x1b')](_0xf2a2c5[_0x33e2('0x33')]['offset']);}_0x42fd41[_0x33e2('0x3a')]=qs[_0x33e2('0x3b')](_0xf2a2c5['query'][_0x33e2('0x3b')]);_0x42fd41[_0x33e2('0x3c')]=qs['filters'](_[_0x33e2('0x3d')](_0xf2a2c5[_0x33e2('0x33')],_0x28cc24[_0x33e2('0x35')]),_0xf93ddd);if(_0xf2a2c5['query'][_0x33e2('0x3e')]){_0x42fd41[_0x33e2('0x3c')]=_[_0x33e2('0x3f')](_0x42fd41['where'],{'$or':_[_0x33e2('0x40')](_0xf93ddd,function(_0x45dfb3){if(_0x45dfb3[_0x33e2('0x30')]!==_0x33e2('0x41')){var _0x3e2f0b={};_0x3e2f0b[_0x45dfb3[_0x33e2('0x2a')]]={'$like':'%'+_0xf2a2c5[_0x33e2('0x33')][_0x33e2('0x3e')]+'%'};return _0x3e2f0b;}})});}_0x42fd41=_[_0x33e2('0x3f')]({},_0x42fd41,_0xf2a2c5[_0x33e2('0x42')]);var _0x841131={'where':_0x42fd41[_0x33e2('0x3c')]};return db[_0x33e2('0x2d')]['count'](_0x841131)[_0x33e2('0x25')](function(_0x21a553){_0x391c38[_0x33e2('0x1d')]=_0x21a553;if(_0xf2a2c5['query']['includeAll']){_0x42fd41[_0x33e2('0x43')]=[{'all':!![]}];}return db[_0x33e2('0x2d')][_0x33e2('0x44')](_0x42fd41);})[_0x33e2('0x25')](function(_0x17beca){_0x391c38[_0x33e2('0x45')]=_0x17beca;return _0x391c38;})[_0x33e2('0x25')](respondWithFilteredResult(_0x5af84e,_0x42fd41))['catch'](handleError(_0x5af84e,null));};exports[_0x33e2('0x46')]=function(_0xa7d2e6,_0x23e014){var _0x362541={'raw':![],'where':{'id':_0xa7d2e6[_0x33e2('0x47')]['id']}},_0xce203b={};_0xce203b[_0x33e2('0x32')]=_['keys'](db['AnalyticCustomReport'][_0x33e2('0x2e')]);_0xce203b['query']=_['keys'](_0xa7d2e6[_0x33e2('0x33')]);_0xce203b['filters']=_[_0x33e2('0x36')](_0xce203b[_0x33e2('0x32')],_0xce203b['query']);_0x362541[_0x33e2('0x37')]=_[_0x33e2('0x36')](_0xce203b[_0x33e2('0x32')],qs[_0x33e2('0x38')](_0xa7d2e6['query']['fields']));_0x362541[_0x33e2('0x37')]=_0x362541[_0x33e2('0x37')][_0x33e2('0x39')]?_0x362541[_0x33e2('0x37')]:_0xce203b['model'];if(_0xa7d2e6[_0x33e2('0x33')]['includeAll']){_0x362541[_0x33e2('0x43')]=[{'all':!![]}];}_0x362541=_[_0x33e2('0x3f')]({},_0x362541,_0xa7d2e6[_0x33e2('0x42')]);return db[_0x33e2('0x2d')]['find'](_0x362541)[_0x33e2('0x25')](handleEntityNotFound(_0x23e014,null))[_0x33e2('0x25')](respondWithResult(_0x23e014,null))[_0x33e2('0x48')](handleError(_0x23e014,null));};exports[_0x33e2('0x49')]=function(_0x115d5b,_0xfc7992){return db[_0x33e2('0x2d')]['create'](_0x115d5b['body'],{})[_0x33e2('0x25')](function(_0x4803c1){var _0x1c8908=_0x115d5b[_0x33e2('0x4a')][_0x33e2('0x4b')]({'plain':!![]});if(!_0x1c8908)throw new Error(_0x33e2('0x4c'));if(_0x1c8908[_0x33e2('0x4d')]===_0x33e2('0x4a')){var _0x518275=_0x4803c1[_0x33e2('0x4b')]({'plain':!![]});var _0x48d498=_0x33e2('0x4e');return db[_0x33e2('0x4f')][_0x33e2('0x50')]({'where':{'name':_0x48d498,'userProfileId':_0x1c8908['userProfileId']},'raw':!![]})['then'](function(_0x254c78){if(_0x254c78&&_0x254c78[_0x33e2('0x51')]===0x0){return db[_0x33e2('0x52')]['create']({'name':_0x518275[_0x33e2('0x2a')],'resourceId':_0x518275['id'],'type':_0x33e2('0x27'),'sectionId':_0x254c78['id']},{})[_0x33e2('0x25')](function(){return _0x4803c1;});}else{return _0x4803c1;}})['catch'](function(_0x40ab1a){logger[_0x33e2('0x28')](_0x33e2('0x53'),_0x40ab1a);throw _0x40ab1a;});}return _0x4803c1;})[_0x33e2('0x25')](respondWithResult(_0xfc7992,0xc9))[_0x33e2('0x48')](handleError(_0xfc7992,null));};exports['update']=function(_0x22418b,_0x2dfb6f){if(_0x22418b[_0x33e2('0x54')]['id']){delete _0x22418b[_0x33e2('0x54')]['id'];}return db['AnalyticCustomReport'][_0x33e2('0x50')]({'where':{'id':_0x22418b[_0x33e2('0x47')]['id']}})['then'](handleEntityNotFound(_0x2dfb6f,null))[_0x33e2('0x25')](saveUpdates(_0x22418b['body'],null))[_0x33e2('0x25')](respondWithResult(_0x2dfb6f,null))[_0x33e2('0x48')](handleError(_0x2dfb6f,null));};exports['destroy']=function(_0xf87344,_0xcd5419){return db[_0x33e2('0x2d')]['find']({'where':{'id':_0xf87344[_0x33e2('0x47')]['id']}})[_0x33e2('0x25')](handleEntityNotFound(_0xcd5419,null))[_0x33e2('0x25')](removeEntity(_0xcd5419,null))[_0x33e2('0x48')](handleError(_0xcd5419,null));};exports[_0x33e2('0x55')]=function(_0x4862b9,_0x37fce5){var _0x1aa602=0xa;var _0x1e692c=[_0x33e2('0x56'),_0x33e2('0x57'),'right_join','cross_join'];var _0xb30d2c={'SUM':'SUM(%s)','COUNT':_0x33e2('0x58'),'COUNT DISTINCT':_0x33e2('0x59'),'MAX':_0x33e2('0x5a'),'MIN':_0x33e2('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x33e2('0x5c'),'GROUP_CONCAT ASC':_0x33e2('0x5d'),'GROUP_CONCAT DESC':_0x33e2('0x5e')};var _0x1f34aa={'SEC_TO_TIME':_0x33e2('0x5f'),'DATE':'DATE(%s)','HOUR':_0x33e2('0x60'),'ROUND':_0x33e2('0x61'),'UNIX_TIMESTAMP':_0x33e2('0x62')};var _0x46a222=function(_0x577099){return!_['includes'](['IS\x20NULL',_0x33e2('0x63'),_0x33e2('0x64'),_0x33e2('0x65')],_0x577099);};var _0x24404e=function(_0x64fd82){if(!_0x64fd82||!_0x64fd82['rules'][_0x33e2('0x39')]){return'';}for(var _0x508b28='(',_0x459e2d=0x0;_0x459e2d<_0x64fd82[_0x33e2('0x66')][_0x33e2('0x39')];_0x459e2d+=0x1){_0x459e2d>0x0&&(_0x508b28+='\x20'+_0x64fd82[_0x33e2('0x67')]+'\x20');_0x508b28+=_0x64fd82[_0x33e2('0x66')][_0x459e2d]['group']?_0x24404e(_0x64fd82['rules'][_0x459e2d]['group']):_0x64fd82[_0x33e2('0x66')][_0x459e2d][_0x33e2('0x68')]+'\x20'+_0x64fd82[_0x33e2('0x66')][_0x459e2d]['condition']+(_0x46a222(_0x64fd82[_0x33e2('0x66')][_0x459e2d][_0x33e2('0x69')])?'\x20'+_0x64fd82[_0x33e2('0x66')][_0x459e2d]['value']:'');}return _0x508b28+')';};var _0x37694e={'where':{'id':_0x4862b9['params']['id']}},_0x2e52e1,_0x160c95,_0x5e1889,_0x15ee8e,_0x448eea;_0x37694e=_['merge']({},_0x37694e,_0x4862b9['options']);return db[_0x33e2('0x2d')][_0x33e2('0x50')](_0x37694e)[_0x33e2('0x25')](function(_0x2b09af){if(_0x2b09af){_0x2e52e1=_0x2b09af;return _0x2b09af['getFields']();}return null;})[_0x33e2('0x25')](function(_0x47b3f1){if(_0x47b3f1){if(!_0x47b3f1[_0x33e2('0x39')]){throw new db[(_0x33e2('0x6a'))][(_0x33e2('0x6b'))](_0x33e2('0x6c'),0x193);}_0x160c95=_0x47b3f1;return db[_0x33e2('0x6d')][_0x33e2('0x44')]({'raw':!![]});}return null;})[_0x33e2('0x25')](function(_0x2a3d6a){if(_0x2a3d6a){_0x5e1889=_[_0x33e2('0x6e')](_0x2a3d6a,'id');var _0xabc62e;var _0x5835fc=squel[_0x33e2('0x6f')]();_0x5835fc[_0x33e2('0x70')](_0x2e52e1[_0x33e2('0x71')]);for(var _0x2741d8=0x0;_0x2741d8<_0x160c95[_0x33e2('0x39')];_0x2741d8+=0x1){_0xabc62e=_0x160c95[_0x2741d8][_0x33e2('0x72')]?_0x5e1889[_0x160c95[_0x2741d8][_0x33e2('0x72')]][_0x33e2('0x73')]:_0x160c95[_0x2741d8][_0x33e2('0x68')];_0xabc62e=_0x160c95[_0x2741d8]['function']?_[_0x33e2('0x74')](_0xb30d2c[_0x160c95[_0x2741d8][_0x33e2('0x75')]],'%s',_0xabc62e):_0xabc62e;_0xabc62e=_0x160c95[_0x2741d8][_0x33e2('0x76')]?_['replace'](_0x1f34aa[_0x160c95[_0x2741d8][_0x33e2('0x76')]],'%s',_0xabc62e):_0xabc62e;if(_0x160c95[_0x2741d8][_0x33e2('0x77')]){_0x5835fc[_0x33e2('0x78')](_0xabc62e);}_0x160c95[_0x2741d8][_0x33e2('0x79')]&&_0x5835fc['order'](_0xabc62e,_0x160c95[_0x2741d8][_0x33e2('0x79')]===_0x33e2('0x7a')?![]:!![]);_0x5835fc[_0x33e2('0x68')](_0xabc62e,_0x160c95[_0x2741d8][_0x33e2('0x7b')]||_0xabc62e);}if(_0x2e52e1[_0x33e2('0x7c')]){_0x2e52e1[_0x33e2('0x7c')]=JSON[_0x33e2('0x7d')](_0x2e52e1[_0x33e2('0x7c')]);for(var _0x2c8c94=0x0;_0x2c8c94<_0x2e52e1['joins'][_0x33e2('0x39')];_0x2c8c94+=0x1){if(_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94][_0x33e2('0x30')]&&_[_0x33e2('0x7e')](_0x1e692c,_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94][_0x33e2('0x30')])&&_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94][_0x33e2('0x7f')]&&_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94]['foreignTable']&&_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94]['foreignKey']){_0x5835fc[_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94][_0x33e2('0x30')]](_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94]['foreignTable'],null,util[_0x33e2('0x76')](_0x33e2('0x80'),_0x2e52e1[_0x33e2('0x71')],_0x2e52e1['joins'][_0x2c8c94]['parentKey'],_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94][_0x33e2('0x81')],_0x2e52e1[_0x33e2('0x7c')][_0x2c8c94][_0x33e2('0x82')]));}}}if(_0x2e52e1[_0x33e2('0x83')]){_0x2e52e1[_0x33e2('0x83')]=JSON[_0x33e2('0x7d')](_0x2e52e1[_0x33e2('0x83')]);_0x5835fc['where'](_0x24404e(_0x2e52e1[_0x33e2('0x83')][_0x33e2('0x78')]));}_0x448eea=_0x5835fc[_0x33e2('0x84')]();_0x5835fc[_0x33e2('0x1e')](_0x1aa602);_0x5835fc[_0x33e2('0x1b')](0x0);logger[_0x33e2('0x85')]('Limited\x20Query:',_0x5835fc[_0x33e2('0x86')]());return dbH[_0x33e2('0x87')][_0x33e2('0x33')](_0x5835fc[_0x33e2('0x86')](),{'type':dbH[_0x33e2('0x87')][_0x33e2('0x88')][_0x33e2('0x89')]});}})[_0x33e2('0x25')](respondWithResult(_0x37fce5,null))[_0x33e2('0x48')](handleError(_0x37fce5,null));};function runReport(_0x2edf3d,_0x3c4075,_0x49304b){var _0x51e3d1=_0x3c4075[_0x33e2('0x2a')];var _0xc3b39a=0xa;var _0x52fe95=[_0x33e2('0x56'),'left_join',_0x33e2('0x8a'),_0x33e2('0x8b')];var _0x10964d={'SUM':_0x33e2('0x8c'),'COUNT':_0x33e2('0x58'),'COUNT DISTINCT':_0x33e2('0x59'),'MAX':'MAX(%s)','MIN':_0x33e2('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x33e2('0x5c'),'GROUP_CONCAT ASC':_0x33e2('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x13ecee={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x33e2('0x8d'),'HOUR':'HOUR(%s)','ROUND':_0x33e2('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x291510=function(_0x3ebfea){return!_['includes']([_0x33e2('0x8e'),_0x33e2('0x63'),_0x33e2('0x64'),'IS\x20NOT\x20EMPTY'],_0x3ebfea);};var _0x5ec08f=function(_0x45acab){if(!_0x45acab||!_0x45acab[_0x33e2('0x66')]['length']){return'';}for(var _0x1ddb13='(',_0x35609f=0x0;_0x35609f<_0x45acab[_0x33e2('0x66')]['length'];_0x35609f+=0x1){_0x35609f>0x0&&(_0x1ddb13+='\x20'+_0x45acab[_0x33e2('0x67')]+'\x20');_0x1ddb13+=_0x45acab[_0x33e2('0x66')][_0x35609f][_0x33e2('0x78')]?_0x5ec08f(_0x45acab['rules'][_0x35609f][_0x33e2('0x78')]):_0x45acab[_0x33e2('0x66')][_0x35609f]['field']+'\x20'+_0x45acab[_0x33e2('0x66')][_0x35609f][_0x33e2('0x69')]+(_0x291510(_0x45acab[_0x33e2('0x66')][_0x35609f]['condition'])?'\x20'+_0x45acab[_0x33e2('0x66')][_0x35609f][_0x33e2('0x8f')]:'');}return _0x1ddb13+')';};var _0x49bb54={'where':{'id':_0x2edf3d['id']}},_0x228c8f,_0x571a5b,_0x4318cb,_0x2316f1,_0x37cefe;_0x49bb54=_['merge']({},_0x49bb54,_0x49304b);return db[_0x33e2('0x2d')][_0x33e2('0x50')](_0x49bb54)[_0x33e2('0x25')](function(_0x1d15e1){if(_0x1d15e1){_0x228c8f=_0x1d15e1;return _0x1d15e1[_0x33e2('0x90')]();}return null;})['then'](function(_0x1e1f5a){if(_0x1e1f5a){if(!_0x1e1f5a[_0x33e2('0x39')]){throw new db[(_0x33e2('0x6a'))][(_0x33e2('0x6b'))](_0x33e2('0x6c'),0x193);}_0x571a5b=_0x1e1f5a;return db[_0x33e2('0x6d')][_0x33e2('0x44')]({'raw':!![]});}return null;})[_0x33e2('0x25')](function(_0xbd56d3){if(_0xbd56d3){_0x4318cb=_[_0x33e2('0x6e')](_0xbd56d3,'id');var _0x3084b3;var _0x48fe8f=squel[_0x33e2('0x6f')]();_0x48fe8f[_0x33e2('0x70')](_0x228c8f[_0x33e2('0x71')]);for(var _0x3d5e0a=0x0;_0x3d5e0a<_0x571a5b[_0x33e2('0x39')];_0x3d5e0a+=0x1){_0x3084b3=_0x571a5b[_0x3d5e0a][_0x33e2('0x72')]?_0x4318cb[_0x571a5b[_0x3d5e0a]['MetricId']][_0x33e2('0x73')]:_0x571a5b[_0x3d5e0a][_0x33e2('0x68')];_0x3084b3=_0x571a5b[_0x3d5e0a][_0x33e2('0x75')]?_[_0x33e2('0x74')](_0x10964d[_0x571a5b[_0x3d5e0a][_0x33e2('0x75')]],'%s',_0x3084b3):_0x3084b3;_0x3084b3=_0x571a5b[_0x3d5e0a][_0x33e2('0x76')]?_[_0x33e2('0x74')](_0x13ecee[_0x571a5b[_0x3d5e0a][_0x33e2('0x76')]],'%s',_0x3084b3):_0x3084b3;if(_0x571a5b[_0x3d5e0a][_0x33e2('0x77')]){_0x48fe8f[_0x33e2('0x78')](_0x3084b3);}_0x571a5b[_0x3d5e0a]['orderBy']&&_0x48fe8f['order'](_0x3084b3,_0x571a5b[_0x3d5e0a][_0x33e2('0x79')]===_0x33e2('0x7a')?![]:!![]);_0x48fe8f['field'](_0x3084b3,_0x571a5b[_0x3d5e0a]['alias']||_0x3084b3);}if(_0x228c8f[_0x33e2('0x7c')]){_0x228c8f[_0x33e2('0x7c')]=JSON[_0x33e2('0x7d')](_0x228c8f[_0x33e2('0x7c')]);for(var _0x27aef6=0x0;_0x27aef6<_0x228c8f['joins'][_0x33e2('0x39')];_0x27aef6+=0x1){if(_0x228c8f[_0x33e2('0x7c')][_0x27aef6][_0x33e2('0x30')]&&_[_0x33e2('0x7e')](_0x52fe95,_0x228c8f['joins'][_0x27aef6][_0x33e2('0x30')])&&_0x228c8f[_0x33e2('0x7c')][_0x27aef6][_0x33e2('0x7f')]&&_0x228c8f[_0x33e2('0x7c')][_0x27aef6][_0x33e2('0x81')]&&_0x228c8f[_0x33e2('0x7c')][_0x27aef6][_0x33e2('0x82')]){_0x48fe8f[_0x228c8f[_0x33e2('0x7c')][_0x27aef6]['type']](_0x228c8f[_0x33e2('0x7c')][_0x27aef6]['foreignTable'],null,util['format'](_0x33e2('0x80'),_0x228c8f[_0x33e2('0x71')],_0x228c8f[_0x33e2('0x7c')][_0x27aef6][_0x33e2('0x7f')],_0x228c8f[_0x33e2('0x7c')][_0x27aef6][_0x33e2('0x81')],_0x228c8f[_0x33e2('0x7c')][_0x27aef6][_0x33e2('0x82')]));}}}if(_0x228c8f[_0x33e2('0x83')]){_0x228c8f[_0x33e2('0x83')]=JSON['parse'](_0x228c8f[_0x33e2('0x83')]);_0x48fe8f[_0x33e2('0x3c')](_0x5ec08f(_0x228c8f[_0x33e2('0x83')][_0x33e2('0x78')]));}_0x37cefe=_0x48fe8f[_0x33e2('0x84')]();_0x48fe8f[_0x33e2('0x1e')](_0xc3b39a);_0x48fe8f[_0x33e2('0x1b')](0x0);return;}})[_0x33e2('0x25')](function(){if(_0x3c4075[_0x33e2('0x91')]===_0x33e2('0x92')){return null;}var _0x48c4c0=_[_0x33e2('0x3f')](_0x3c4075,{'name':_0x3c4075[_0x33e2('0x93')]||_0x3c4075[_0x33e2('0x2a')]||_0x228c8f[_0x33e2('0x2a')],'basename':_0x51e3d1,'savename':util[_0x33e2('0x76')](_0x33e2('0x94'),_0x3c4075[_0x33e2('0x2a')]||_0x228c8f[_0x33e2('0x2a')],require(_0x33e2('0x95'))[_0x33e2('0x96')](0x4),_0x3c4075[_0x33e2('0x91')]||'csv'),'reportId':_0x228c8f['id'],'reportType':_0x33e2('0x97')});return db['AnalyticExtractedReport'][_0x33e2('0x49')](_0x48c4c0,{'raw':!![]});})[_0x33e2('0x25')](function(_0x4504f3){if(_0x228c8f[_0x33e2('0x71')]===_0x33e2('0x98')){_0x37cefe[_0x33e2('0x3c')](_0x228c8f[_0x33e2('0x71')]+_0x33e2('0x99'),_0x3c4075[_0x33e2('0x9a')],_0x3c4075[_0x33e2('0x9b')]);}else{_0x37cefe[_0x33e2('0x3c')](_0x228c8f[_0x33e2('0x71')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3c4075['startDate'],_0x3c4075['endDate']);}if(_0x4504f3){logger[_0x33e2('0x9c')](_0x33e2('0x9d'),_0x37cefe['toString']());require(_0x33e2('0x9e'))[_0x33e2('0x9f')](path['join'](__dirname,_0x33e2('0xa0'),_0x4504f3[_0x33e2('0x91')]),[_0x4504f3['id'],_0x37cefe[_0x33e2('0x86')](),path[_0x33e2('0x56')](__dirname,'../../files/reports',_0x4504f3['savename']),_0x51e3d1]);return _0x4504f3;}else{var _0x5abe34=squel[_0x33e2('0x6f')]();_0x5abe34[_0x33e2('0x70')]('('+_0x37cefe[_0x33e2('0x86')]()+')',_0x33e2('0xa1'));_0x5abe34[_0x33e2('0x68')](_0x33e2('0xa2'),_0x33e2('0x1d'));_0x37cefe[_0x33e2('0x1e')](_0x3c4075['limit']||_0xc3b39a);_0x37cefe[_0x33e2('0x1b')](_0x3c4075['offset']||0x0);return dbH['sequelize'][_0x33e2('0x33')](_0x5abe34['toString'](),{'type':dbH[_0x33e2('0x87')][_0x33e2('0x88')][_0x33e2('0x89')]})['then'](function(_0x16e1ef){if(!_0x16e1ef[_0x33e2('0x39')]){_0x2316f1=0x0;}else{_0x2316f1=_0x16e1ef[0x0][_0x33e2('0x1d')]||0x0;}return dbH[_0x33e2('0x87')]['query'](_0x37cefe[_0x33e2('0x86')](),{'type':dbH['sequelize'][_0x33e2('0x88')][_0x33e2('0x89')]});})[_0x33e2('0x25')](function(_0x284085){return{'rows':_0x284085||[],'count':_0x2316f1};});}});}exports[_0x33e2('0xa3')]=function(_0x812f4f,_0x3a0dc5){return runReport(_0x812f4f[_0x33e2('0x47')],_0x812f4f['query'],_0x812f4f['options'])[_0x33e2('0x25')](respondWithResult(_0x3a0dc5,null))['catch'](handleError(_0x3a0dc5,null));};exports['runReport']=runReport;exports[_0x33e2('0x33')]=function(_0x39a69e,_0x21c283){var _0x48a7cd=0xa;var _0x49ac83=['join',_0x33e2('0x57'),_0x33e2('0x8a'),_0x33e2('0x8b')];var _0x192f0f={'SUM':_0x33e2('0x8c'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x33e2('0x59'),'MAX':_0x33e2('0x5a'),'MIN':_0x33e2('0x5b'),'AVG':_0x33e2('0xa4'),'GROUP_CONCAT':_0x33e2('0x5c'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x33e2('0x5e')};var _0xb494f3={'SEC_TO_TIME':_0x33e2('0x5f'),'DATE':_0x33e2('0x8d'),'HOUR':_0x33e2('0x60'),'ROUND':_0x33e2('0x61'),'UNIX_TIMESTAMP':_0x33e2('0x62')};var _0x2552bd=function(_0x7fb861){return!_[_0x33e2('0x7e')]([_0x33e2('0x8e'),_0x33e2('0x63'),_0x33e2('0x64'),'IS\x20NOT\x20EMPTY'],_0x7fb861);};var _0x5d56e8=function(_0x4327d8){if(!_0x4327d8||!_0x4327d8[_0x33e2('0x66')][_0x33e2('0x39')]){return'';}for(var _0x4d906d='(',_0x17e810=0x0;_0x17e810<_0x4327d8[_0x33e2('0x66')][_0x33e2('0x39')];_0x17e810+=0x1){_0x17e810>0x0&&(_0x4d906d+='\x20'+_0x4327d8[_0x33e2('0x67')]+'\x20');_0x4d906d+=_0x4327d8['rules'][_0x17e810]['group']?_0x5d56e8(_0x4327d8['rules'][_0x17e810][_0x33e2('0x78')]):_0x4327d8[_0x33e2('0x66')][_0x17e810][_0x33e2('0x68')]+'\x20'+_0x4327d8[_0x33e2('0x66')][_0x17e810][_0x33e2('0x69')]+(_0x2552bd(_0x4327d8[_0x33e2('0x66')][_0x17e810][_0x33e2('0x69')])?'\x20'+_0x4327d8[_0x33e2('0x66')][_0x17e810][_0x33e2('0x8f')]:'');}return _0x4d906d+')';};var _0x199ebf={'where':{'id':_0x39a69e[_0x33e2('0x47')]['id']}},_0x19f269,_0x5192f9,_0x2db2b3,_0x81b465,_0x4318bb;_0x199ebf=_[_0x33e2('0x3f')]({},_0x199ebf,_0x39a69e[_0x33e2('0x42')]);return db[_0x33e2('0x2d')][_0x33e2('0x50')](_0x199ebf)[_0x33e2('0x25')](function(_0x3d898a){if(_0x3d898a){_0x19f269=_0x3d898a;return _0x3d898a[_0x33e2('0x90')]();}return null;})[_0x33e2('0x25')](function(_0x4138cd){if(_0x4138cd){if(!_0x4138cd['length']){throw new db[(_0x33e2('0x6a'))][(_0x33e2('0x6b'))](_0x33e2('0x6c'),0x193);}_0x5192f9=_0x4138cd;return db[_0x33e2('0x6d')][_0x33e2('0x44')]({'raw':!![]});}return null;})[_0x33e2('0x25')](function(_0x1b2b6e){if(_0x1b2b6e){_0x2db2b3=_['keyBy'](_0x1b2b6e,'id');var _0x2ff199;var _0x1b1268=squel[_0x33e2('0x6f')]();_0x1b1268[_0x33e2('0x70')](_0x19f269[_0x33e2('0x71')]);for(var _0x3f87b8=0x0;_0x3f87b8<_0x5192f9[_0x33e2('0x39')];_0x3f87b8+=0x1){_0x2ff199=_0x5192f9[_0x3f87b8][_0x33e2('0x72')]?_0x2db2b3[_0x5192f9[_0x3f87b8]['MetricId']][_0x33e2('0x73')]:_0x5192f9[_0x3f87b8][_0x33e2('0x68')];_0x2ff199=_0x5192f9[_0x3f87b8][_0x33e2('0x75')]?_[_0x33e2('0x74')](_0x192f0f[_0x5192f9[_0x3f87b8][_0x33e2('0x75')]],'%s',_0x2ff199):_0x2ff199;_0x2ff199=_0x5192f9[_0x3f87b8][_0x33e2('0x76')]?_[_0x33e2('0x74')](_0xb494f3[_0x5192f9[_0x3f87b8][_0x33e2('0x76')]],'%s',_0x2ff199):_0x2ff199;if(_0x5192f9[_0x3f87b8]['groupBy']){_0x1b1268[_0x33e2('0x78')](_0x2ff199);}_0x5192f9[_0x3f87b8]['orderBy']&&_0x1b1268['order'](_0x2ff199,_0x5192f9[_0x3f87b8][_0x33e2('0x79')]===_0x33e2('0x7a')?![]:!![]);_0x1b1268['field'](_0x2ff199,_0x5192f9[_0x3f87b8][_0x33e2('0x7b')]||_0x2ff199);}if(_0x19f269[_0x33e2('0x7c')]){_0x19f269['joins']=JSON[_0x33e2('0x7d')](_0x19f269[_0x33e2('0x7c')]);for(var _0x587582=0x0;_0x587582<_0x19f269[_0x33e2('0x7c')][_0x33e2('0x39')];_0x587582+=0x1){if(_0x19f269[_0x33e2('0x7c')][_0x587582]['type']&&_[_0x33e2('0x7e')](_0x49ac83,_0x19f269['joins'][_0x587582][_0x33e2('0x30')])&&_0x19f269[_0x33e2('0x7c')][_0x587582][_0x33e2('0x7f')]&&_0x19f269[_0x33e2('0x7c')][_0x587582][_0x33e2('0x81')]&&_0x19f269[_0x33e2('0x7c')][_0x587582][_0x33e2('0x82')]){_0x1b1268[_0x19f269['joins'][_0x587582][_0x33e2('0x30')]](_0x19f269[_0x33e2('0x7c')][_0x587582]['foreignTable'],null,util[_0x33e2('0x76')](_0x33e2('0x80'),_0x19f269['table'],_0x19f269[_0x33e2('0x7c')][_0x587582][_0x33e2('0x7f')],_0x19f269[_0x33e2('0x7c')][_0x587582][_0x33e2('0x81')],_0x19f269[_0x33e2('0x7c')][_0x587582][_0x33e2('0x82')]));}}}if(_0x19f269[_0x33e2('0x83')]){_0x19f269[_0x33e2('0x83')]=JSON['parse'](_0x19f269[_0x33e2('0x83')]);_0x1b1268[_0x33e2('0x3c')](_0x5d56e8(_0x19f269[_0x33e2('0x83')][_0x33e2('0x78')]));}_0x4318bb=_0x1b1268['clone']();_0x1b1268[_0x33e2('0x1e')](_0x48a7cd);_0x1b1268[_0x33e2('0x1b')](0x0);logger[_0x33e2('0x85')](_0x33e2('0xa5'),_0x1b1268[_0x33e2('0x86')]());return dbH[_0x33e2('0x87')][_0x33e2('0x33')](_0x1b1268[_0x33e2('0x86')](),{'type':dbH[_0x33e2('0x87')][_0x33e2('0x88')]['SELECT']});}})['then'](function(){return{'sql':_0x4318bb[_0x33e2('0x86')]()};})[_0x33e2('0x25')](respondWithResult(_0x21c283,null))[_0x33e2('0x48')](handleError(_0x21c283,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 65d5630..af78096 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 _0xc5cd=['rimraf','./analyticCustomReport.attributes','exports','AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xc5cd,0x185));var _0xdc5c=function(_0x1bee7a,_0xacfa2a){_0x1bee7a=_0x1bee7a-0x0;var _0x5d69d7=_0xc5cd[_0x1bee7a];return _0x5d69d7;};'use strict';var _=require(_0xdc5c('0x0'));var util=require('util');var logger=require(_0xdc5c('0x1'))(_0xdc5c('0x2'));var moment=require(_0xdc5c('0x3'));var BPromise=require(_0xdc5c('0x4'));var rp=require(_0xdc5c('0x5'));var fs=require('fs');var path=require(_0xdc5c('0x6'));var rimraf=require(_0xdc5c('0x7'));var config=require('../../config/environment');var attributes=require(_0xdc5c('0x8'));module[_0xdc5c('0x9')]=function(_0x224ce6,_0x24f44f){return _0x224ce6['define'](_0xdc5c('0xa'),attributes,{'tableName':_0xdc5c('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d81=['util','api','moment','bluebird','request-promise','path','rimraf','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x4ae180,_0x42793f){var _0x361241=function(_0x4b884d){while(--_0x4b884d){_0x4ae180['push'](_0x4ae180['shift']());}};_0x361241(++_0x42793f);}(_0x7d81,0x6d));var _0x17d8=function(_0x14f555,_0x1e3f48){_0x14f555=_0x14f555-0x0;var _0x371ec1=_0x7d81[_0x14f555];return _0x371ec1;};'use strict';var _=require(_0x17d8('0x0'));var util=require(_0x17d8('0x1'));var logger=require('../../config/logger')(_0x17d8('0x2'));var moment=require(_0x17d8('0x3'));var BPromise=require(_0x17d8('0x4'));var rp=require(_0x17d8('0x5'));var fs=require('fs');var path=require(_0x17d8('0x6'));var rimraf=require(_0x17d8('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module['exports']=function(_0x595f4d,_0xa92c8c){return _0x595f4d[_0x17d8('0x8')](_0x17d8('0x9'),attributes,{'tableName':_0x17d8('0xa'),'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 3c258d6..7024ed0 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 _0x2af6=['message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x24dbdf,_0x1857df){var _0x11af73=function(_0x4ce926){while(--_0x4ce926){_0x24dbdf['push'](_0x24dbdf['shift']());}};_0x11af73(++_0x1857df);}(_0x2af6,0x1e6));var _0x62af=function(_0x2f5e32,_0x3e2712){_0x2f5e32=_0x2f5e32-0x0;var _0x392a35=_0x2af6[_0x2f5e32];return _0x392a35;};'use strict';var _=require(_0x62af('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x62af('0x1'));var rs=require(_0x62af('0x2'));var fs=require('fs');var Redis=require(_0x62af('0x3'));var db=require(_0x62af('0x4'))['db'];var utils=require(_0x62af('0x5'));var logger=require(_0x62af('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x62af('0x7'));var client=jayson[_0x62af('0x8')][_0x62af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53633b,_0x4247c3,_0x298ac4){return new BPromise(function(_0x3f7b97,_0x552562){return client[_0x62af('0xa')](_0x53633b,_0x298ac4)[_0x62af('0xb')](function(_0x186b8a){logger[_0x62af('0xc')](_0x62af('0xd'),_0x4247c3,_0x62af('0xe'));logger[_0x62af('0xf')](_0x62af('0x10'),_0x4247c3,'request\x20sent',JSON[_0x62af('0x11')](_0x186b8a));if(_0x186b8a['error']){if(_0x186b8a[_0x62af('0x12')][_0x62af('0x13')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x4247c3,_0x186b8a[_0x62af('0x12')][_0x62af('0x14')]);return _0x552562(_0x186b8a['error']['message']);}logger[_0x62af('0x12')](_0x62af('0xd'),_0x4247c3,_0x186b8a[_0x62af('0x12')][_0x62af('0x14')]);return _0x3f7b97(_0x186b8a[_0x62af('0x12')][_0x62af('0x14')]);}else{logger['info'](_0x62af('0xd'),_0x4247c3,_0x62af('0xe'));_0x3f7b97(_0x186b8a['result'][_0x62af('0x14')]);}})[_0x62af('0x15')](function(_0x5d4c7c){logger[_0x62af('0x12')](_0x62af('0xd'),_0x4247c3,_0x5d4c7c);_0x552562(_0x5d4c7c);});});} \ No newline at end of file +var _0x5ace=['util','randomstring','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','result','catch','lodash'];(function(_0x410e39,_0x53b28b){var _0x14208c=function(_0x12118d){while(--_0x12118d){_0x410e39['push'](_0x410e39['shift']());}};_0x14208c(++_0x53b28b);}(_0x5ace,0x1e2));var _0xe5ac=function(_0x199bc4,_0x338105){_0x199bc4=_0x199bc4-0x0;var _0x136ffb=_0x5ace[_0x199bc4];return _0x136ffb;};'use strict';var _=require(_0xe5ac('0x0'));var util=require(_0xe5ac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe5ac('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe5ac('0x3'))['db'];var utils=require(_0xe5ac('0x4'));var logger=require('../../config/logger')(_0xe5ac('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe5ac('0x6')][_0xe5ac('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30aeb1,_0x186d8d,_0x37af1c){return new BPromise(function(_0x35ce29,_0x14105e){return client[_0xe5ac('0x8')](_0x30aeb1,_0x37af1c)[_0xe5ac('0x9')](function(_0x53cce0){logger[_0xe5ac('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x186d8d,'request\x20sent');logger[_0xe5ac('0xb')](_0xe5ac('0xc'),_0x186d8d,'request\x20sent',JSON[_0xe5ac('0xd')](_0x53cce0));if(_0x53cce0['error']){if(_0x53cce0[_0xe5ac('0xe')][_0xe5ac('0xf')]===0x1f4){logger[_0xe5ac('0xe')]('AnalyticCustomReport,\x20%s,\x20%s',_0x186d8d,_0x53cce0[_0xe5ac('0xe')][_0xe5ac('0x10')]);return _0x14105e(_0x53cce0[_0xe5ac('0xe')][_0xe5ac('0x10')]);}logger[_0xe5ac('0xe')](_0xe5ac('0x11'),_0x186d8d,_0x53cce0[_0xe5ac('0xe')]['message']);return _0x35ce29(_0x53cce0[_0xe5ac('0xe')][_0xe5ac('0x10')]);}else{logger[_0xe5ac('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x186d8d,_0xe5ac('0x12'));_0x35ce29(_0x53cce0[_0xe5ac('0x13')][_0xe5ac('0x10')]);}})[_0xe5ac('0x14')](function(_0x4dceb4){logger['error'](_0xe5ac('0x11'),_0x186d8d,_0x4dceb4);_0x14105e(_0x4dceb4);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index c772c9d..0049ce4 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 _0x1658=['./analyticCustomReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','/:id/run','query','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xcad728,_0x13b7ab){var _0x3502a1=function(_0x57d777){while(--_0x57d777){_0xcad728['push'](_0xcad728['shift']());}};_0x3502a1(++_0x13b7ab);}(_0x1658,0x1f2));var _0x8165=function(_0x47f7fd,_0x4d350f){_0x47f7fd=_0x47f7fd-0x0;var _0x45ecc6=_0x1658[_0x47f7fd];return _0x45ecc6;};'use strict';var multer=require(_0x8165('0x0'));var util=require('util');var path=require(_0x8165('0x1'));var timeout=require(_0x8165('0x2'));var express=require(_0x8165('0x3'));var router=express[_0x8165('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8165('0x5'));var interaction=require(_0x8165('0x6'));var config=require(_0x8165('0x7'));var controller=require(_0x8165('0x8'));router[_0x8165('0x9')]('/',auth[_0x8165('0xa')](),controller['index']);router[_0x8165('0x9')](_0x8165('0xb'),auth['isAuthenticated'](),controller[_0x8165('0xc')]);router[_0x8165('0x9')](_0x8165('0xd'),auth['isAuthenticated'](),controller[_0x8165('0xe')]);router[_0x8165('0x9')](_0x8165('0xf'),auth[_0x8165('0xa')](),controller['run']);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x8165('0x10')]);router[_0x8165('0x11')]('/',auth[_0x8165('0xa')](),controller[_0x8165('0x12')]);router[_0x8165('0x13')](_0x8165('0xb'),auth[_0x8165('0xa')](),controller['update']);router[_0x8165('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8165('0x15')]=router; \ No newline at end of file +var _0x99c5=['get','index','show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','post','create','/:id','update','delete','destroy','exports','multer','util','Router','../../config/environment','./analyticCustomReport.controller'];(function(_0x367895,_0x59a6c5){var _0x842b67=function(_0x6b8bc0){while(--_0x6b8bc0){_0x367895['push'](_0x367895['shift']());}};_0x842b67(++_0x59a6c5);}(_0x99c5,0x12f));var _0x599c=function(_0x436a2,_0x4d0382){_0x436a2=_0x436a2-0x0;var _0x3fb9c9=_0x99c5[_0x436a2];return _0x3fb9c9;};'use strict';var multer=require(_0x599c('0x0'));var util=require(_0x599c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x599c('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x599c('0x3'));var controller=require(_0x599c('0x4'));router[_0x599c('0x5')]('/',auth['isAuthenticated'](),controller[_0x599c('0x6')]);router[_0x599c('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x599c('0x7')]);router[_0x599c('0x5')](_0x599c('0x8'),auth[_0x599c('0x9')](),controller[_0x599c('0xa')]);router[_0x599c('0x5')](_0x599c('0xb'),auth[_0x599c('0x9')](),controller[_0x599c('0xc')]);router[_0x599c('0x5')](_0x599c('0xd'),auth['isAuthenticated'](),controller[_0x599c('0xe')]);router[_0x599c('0xf')]('/',auth['isAuthenticated'](),controller[_0x599c('0x10')]);router['put'](_0x599c('0x11'),auth[_0x599c('0x9')](),controller[_0x599c('0x12')]);router[_0x599c('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x599c('0x14')]);module[_0x599c('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 3ebc4f0..701f957 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 _0x1cb9=['TEXT','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x215ea5,_0x3d3eb2){_0x215ea5=_0x215ea5-0x0;var _0x7a1c01=_0x1cb9[_0x215ea5];return _0x7a1c01;};'use strict';var Sequelize=require(_0x91cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x91cb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x91cb('0x1')]},'parent':{'type':Sequelize[_0x91cb('0x1')]},'table':{'type':Sequelize[_0x91cb('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x91cb('0x2')]}}; \ No newline at end of file +var _0x5fc3=['sequelize','exports','STRING','TEXT'];(function(_0x54e4fc,_0x1d8c7f){var _0x13bd1c=function(_0x28a915){while(--_0x28a915){_0x54e4fc['push'](_0x54e4fc['shift']());}};_0x13bd1c(++_0x1d8c7f);}(_0x5fc3,0xa8));var _0x35fc=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0x5fc3[_0x1afabf];return _0x497ff1;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x35fc('0x2')]},'parent':{'type':Sequelize[_0x35fc('0x2')]},'table':{'type':Sequelize[_0x35fc('0x2')]},'conditions':{'type':Sequelize[_0x35fc('0x3')]},'joins':{'type':Sequelize[_0x35fc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index de74a03..5a23288 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 _0x814b=['attributes','intersection','length','nolimit','limit','order','where','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','preview','join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%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','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','metric','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','left_join','right_join','MAX(%s)','operator','value','Sequelize','keyBy','from','groupBy','%s.%s\x20=\x20%s.%s','output','web','fullPath','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','SELECT','run','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','map','AnalyticDefaultReport','fieldName','type','model','query','keys','filters'];(function(_0x21d627,_0x4e52f9){var _0x2f3d99=function(_0x2589c0){while(--_0x2589c0){_0x21d627['push'](_0x21d627['shift']());}};_0x2f3d99(++_0x4e52f9);}(_0x814b,0x1a2));var _0xb814=function(_0x3e9ef3,_0x21a7e4){_0x3e9ef3=_0x3e9ef3-0x0;var _0x333748=_0x814b[_0x3e9ef3];return _0x333748;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];var dbH=require(_0xb814('0x1a'))[_0xb814('0x1b')];function respondWithStatusCode(_0x2ce718,_0x3bde14){_0x3bde14=_0x3bde14||0xcc;return function(_0x1438e7){if(_0x1438e7){return _0x2ce718[_0xb814('0x1c')](_0x3bde14);}return _0x2ce718[_0xb814('0x1d')](_0x3bde14)[_0xb814('0x1e')]();};}function respondWithResult(_0x3f4881,_0x44fb96){_0x44fb96=_0x44fb96||0xc8;return function(_0x17f5bd){if(_0x17f5bd){return _0x3f4881[_0xb814('0x1d')](_0x44fb96)[_0xb814('0x1f')](_0x17f5bd);}};}function respondWithFilteredResult(_0x3a71d6,_0x45e0d0){return function(_0x265a83){if(_0x265a83){var _0x125ce2=typeof _0x45e0d0[_0xb814('0x20')]===_0xb814('0x21')&&typeof _0x45e0d0['limit']===_0xb814('0x21');var _0x55ba16=_0x265a83[_0xb814('0x22')];var _0xfac75b=_0x125ce2?0x0:_0x45e0d0['offset'];var _0x4b55a7=_0x125ce2?_0x265a83['count']:_0x45e0d0[_0xb814('0x20')]+_0x45e0d0['limit'];var _0x57c128;if(_0x4b55a7>=_0x55ba16){_0x4b55a7=_0x55ba16;_0x57c128=0xc8;}else{_0x57c128=0xce;}_0x3a71d6[_0xb814('0x1d')](_0x57c128);return _0x3a71d6[_0xb814('0x23')](_0xb814('0x24'),_0xfac75b+'-'+_0x4b55a7+'/'+_0x55ba16)['json'](_0x265a83);}return null;};}function patchUpdates(_0xf5b8aa){return function(_0x531032){try{jsonpatch[_0xb814('0x25')](_0x531032,_0xf5b8aa,!![]);}catch(_0x1808a3){return BPromise[_0xb814('0x26')](_0x1808a3);}return _0x531032[_0xb814('0x27')]();};}function saveUpdates(_0x27352e,_0x2bd039){return function(_0x1f5d40){if(_0x1f5d40){return _0x1f5d40['update'](_0x27352e)[_0xb814('0x28')](function(_0x52b7a3){return _0x52b7a3;});}return null;};}function removeEntity(_0x3f81d0,_0x457dac){return function(_0x31c7ec){if(_0x31c7ec){return _0x31c7ec[_0xb814('0x29')]()[_0xb814('0x28')](function(){var _0xb9e57d=_0x31c7ec[_0xb814('0x2a')]({'plain':!![]});var _0x5755ea=_0xb814('0x2b');return db[_0xb814('0x2c')][_0xb814('0x29')]({'where':{'type':_0x5755ea,'resourceId':_0xb9e57d['id']}})[_0xb814('0x28')](function(){return _0x31c7ec;});})[_0xb814('0x28')](function(){_0x3f81d0[_0xb814('0x1d')](0xcc)[_0xb814('0x1e')]();});}};}function handleEntityNotFound(_0x1e4e89,_0x5a6291){return function(_0x271aa8){if(!_0x271aa8){_0x1e4e89[_0xb814('0x1c')](0x194);}return _0x271aa8;};}function handleError(_0x52ed64,_0x9008b2){_0x9008b2=_0x9008b2||0x1f4;return function(_0x37d24d){logger[_0xb814('0x2d')](_0x37d24d['stack']);if(_0x37d24d[_0xb814('0x2e')]){delete _0x37d24d[_0xb814('0x2e')];}_0x52ed64['status'](_0x9008b2)[_0xb814('0x2f')](_0x37d24d);};}exports['index']=function(_0x6efe9a,_0x5f3e9b){var _0x4cfc58={},_0x419cd9={},_0x4a4f27={'count':0x0,'rows':[]};var _0x2431e2=_[_0xb814('0x30')](db[_0xb814('0x31')]['rawAttributes'],function(_0x51d5ae){return{'name':_0x51d5ae[_0xb814('0x32')],'type':_0x51d5ae[_0xb814('0x33')]['key']};});_0x419cd9[_0xb814('0x34')]=_[_0xb814('0x30')](_0x2431e2,_0xb814('0x2e'));_0x419cd9[_0xb814('0x35')]=_[_0xb814('0x36')](_0x6efe9a[_0xb814('0x35')]);_0x419cd9[_0xb814('0x37')]=_['intersection'](_0x419cd9[_0xb814('0x34')],_0x419cd9[_0xb814('0x35')]);_0x4cfc58[_0xb814('0x38')]=_[_0xb814('0x39')](_0x419cd9[_0xb814('0x34')],qs['fields'](_0x6efe9a[_0xb814('0x35')]['fields']));_0x4cfc58[_0xb814('0x38')]=_0x4cfc58[_0xb814('0x38')][_0xb814('0x3a')]?_0x4cfc58['attributes']:_0x419cd9[_0xb814('0x34')];if(!_0x6efe9a[_0xb814('0x35')]['hasOwnProperty'](_0xb814('0x3b'))){_0x4cfc58[_0xb814('0x3c')]=qs[_0xb814('0x3c')](_0x6efe9a[_0xb814('0x35')][_0xb814('0x3c')]);_0x4cfc58[_0xb814('0x20')]=qs['offset'](_0x6efe9a[_0xb814('0x35')]['offset']);}_0x4cfc58[_0xb814('0x3d')]=qs['sort'](_0x6efe9a[_0xb814('0x35')]['sort']);_0x4cfc58[_0xb814('0x3e')]=qs[_0xb814('0x37')](_['pick'](_0x6efe9a['query'],_0x419cd9['filters']),_0x2431e2);if(_0x6efe9a['query'][_0xb814('0x3f')]){_0x4cfc58[_0xb814('0x3e')]=_[_0xb814('0x40')](_0x4cfc58[_0xb814('0x3e')],{'$or':_['map'](_0x2431e2,function(_0x47d782){if(_0x47d782[_0xb814('0x33')]!=='VIRTUAL'){var _0x2a93da={};_0x2a93da[_0x47d782[_0xb814('0x2e')]]={'$like':'%'+_0x6efe9a[_0xb814('0x35')][_0xb814('0x3f')]+'%'};return _0x2a93da;}})});}_0x4cfc58=_[_0xb814('0x40')]({},_0x4cfc58,_0x6efe9a[_0xb814('0x41')]);var _0x3b7f5a={'where':_0x4cfc58[_0xb814('0x3e')]};return db[_0xb814('0x31')]['count'](_0x3b7f5a)['then'](function(_0x5d26be){_0x4a4f27[_0xb814('0x22')]=_0x5d26be;if(_0x6efe9a['query'][_0xb814('0x42')]){_0x4cfc58['include']=[{'all':!![]}];}return db[_0xb814('0x31')][_0xb814('0x43')](_0x4cfc58);})[_0xb814('0x28')](function(_0x2e97cc){_0x4a4f27['rows']=_0x2e97cc;return _0x4a4f27;})[_0xb814('0x28')](respondWithFilteredResult(_0x5f3e9b,_0x4cfc58))[_0xb814('0x44')](handleError(_0x5f3e9b,null));};exports[_0xb814('0x45')]=function(_0x22cf27,_0x7d92aa){var _0x450a08={'raw':!![],'where':{'id':_0x22cf27[_0xb814('0x46')]['id']}},_0x534eb8={};_0x534eb8[_0xb814('0x34')]=_[_0xb814('0x36')](db[_0xb814('0x31')][_0xb814('0x47')]);_0x534eb8[_0xb814('0x35')]=_[_0xb814('0x36')](_0x22cf27['query']);_0x534eb8['filters']=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],_0x534eb8[_0xb814('0x35')]);_0x450a08[_0xb814('0x38')]=_[_0xb814('0x39')](_0x534eb8[_0xb814('0x34')],qs[_0xb814('0x48')](_0x22cf27[_0xb814('0x35')][_0xb814('0x48')]));_0x450a08[_0xb814('0x38')]=_0x450a08[_0xb814('0x38')]['length']?_0x450a08[_0xb814('0x38')]:_0x534eb8[_0xb814('0x34')];if(_0x22cf27['query'][_0xb814('0x42')]){_0x450a08['include']=[{'all':!![]}];}_0x450a08=_[_0xb814('0x40')]({},_0x450a08,_0x22cf27[_0xb814('0x41')]);return db[_0xb814('0x31')][_0xb814('0x49')](_0x450a08)[_0xb814('0x28')](handleEntityNotFound(_0x7d92aa,null))[_0xb814('0x28')](respondWithResult(_0x7d92aa,null))[_0xb814('0x44')](handleError(_0x7d92aa,null));};exports[_0xb814('0x4a')]=function(_0x32a397,_0x2a422a){return db['AnalyticDefaultReport']['create'](_0x32a397[_0xb814('0x4b')],{})[_0xb814('0x28')](function(_0x4156d8){var _0x3f8e29=_0x32a397[_0xb814('0x4c')][_0xb814('0x2a')]({'plain':!![]});if(!_0x3f8e29)throw new Error(_0xb814('0x4d'));if(_0x3f8e29['role']===_0xb814('0x4c')){var _0x388324=_0x4156d8[_0xb814('0x2a')]({'plain':!![]});var _0x5a916d=_0xb814('0x4e');return db['UserProfileSection'][_0xb814('0x49')]({'where':{'name':_0x5a916d,'userProfileId':_0x3f8e29['userProfileId']},'raw':!![]})[_0xb814('0x28')](function(_0x3cf8f8){if(_0x3cf8f8&&_0x3cf8f8['autoAssociation']===0x0){return db[_0xb814('0x2c')][_0xb814('0x4a')]({'name':_0x388324[_0xb814('0x2e')],'resourceId':_0x388324['id'],'type':'DefaultReports','sectionId':_0x3cf8f8['id']},{})[_0xb814('0x28')](function(){return _0x4156d8;});}else{return _0x4156d8;}})['catch'](function(_0x13bdcf){logger[_0xb814('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x13bdcf);throw _0x13bdcf;});}return _0x4156d8;})[_0xb814('0x28')](respondWithResult(_0x2a422a,0xc9))['catch'](handleError(_0x2a422a,null));};exports['update']=function(_0x3b9709,_0x35f59a){if(_0x3b9709[_0xb814('0x4b')]['id']){delete _0x3b9709['body']['id'];}return db[_0xb814('0x31')]['find']({'where':{'id':_0x3b9709[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x35f59a,null))['then'](saveUpdates(_0x3b9709[_0xb814('0x4b')],null))['then'](respondWithResult(_0x35f59a,null))[_0xb814('0x44')](handleError(_0x35f59a,null));};exports[_0xb814('0x29')]=function(_0xb2bd82,_0x113fe5){return db[_0xb814('0x31')][_0xb814('0x49')]({'where':{'id':_0xb2bd82[_0xb814('0x46')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x113fe5,null))['then'](removeEntity(_0x113fe5,null))[_0xb814('0x44')](handleError(_0x113fe5,null));};exports[_0xb814('0x4f')]=function(_0x5d71d5,_0x29a127){var _0xe14249=0xa;var _0x4d13db=[_0xb814('0x50'),'left_join','right_join',_0xb814('0x51')];var _0x5257be={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb814('0x56'),'GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x176585={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x4d611d=function(_0x211194){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x211194);};var _0x52edfa=function(_0x135e13){if(!_0x135e13||!_0x135e13['rules'][_0xb814('0x3a')]){return'';}for(var _0x39b754='(',_0xac95cf=0x0;_0xac95cf<_0x135e13['rules'][_0xb814('0x3a')];_0xac95cf+=0x1){_0xac95cf>0x0&&(_0x39b754+='\x20'+_0x135e13['operator']+'\x20');_0x39b754+=_0x135e13[_0xb814('0x63')][_0xac95cf]['group']?_0x52edfa(_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x64')]):_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x65')]+'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf][_0xb814('0x66')]+(_0x4d611d(_0x135e13[_0xb814('0x63')][_0xac95cf]['condition'])?'\x20'+_0x135e13[_0xb814('0x63')][_0xac95cf]['value']:'');}return _0x39b754+')';};var _0x255047={'where':{'id':_0x5d71d5['params']['id']}},_0x22c73f,_0x1b989d,_0x3dcaeb,_0x19fa45,_0x139531;_0x255047=_[_0xb814('0x40')]({},_0x255047,_0x5d71d5[_0xb814('0x41')]);return db['AnalyticDefaultReport'][_0xb814('0x49')](_0x255047)[_0xb814('0x28')](function(_0x263699){if(_0x263699){_0x22c73f=_0x263699;return _0x263699[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x51d834){if(_0x51d834){if(!_0x51d834[_0xb814('0x3a')]){throw new db['Sequelize'][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x1b989d=_0x51d834;return db[_0xb814('0x6a')][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x41bcaf){if(_0x41bcaf){_0x3dcaeb=_['keyBy'](_0x41bcaf,'id');var _0x506bf2;var _0x5d064b=squel[_0xb814('0x6b')]();_0x5d064b['from'](_0x22c73f[_0xb814('0x6c')]);for(var _0x1d3954=0x0;_0x1d3954<_0x1b989d[_0xb814('0x3a')];_0x1d3954+=0x1){_0x506bf2=_0x1b989d[_0x1d3954]['MetricId']?_0x3dcaeb[_0x1b989d[_0x1d3954][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x1b989d[_0x1d3954][_0xb814('0x65')];_0x506bf2=_0x1b989d[_0x1d3954]['function']?_[_0xb814('0x6f')](_0x5257be[_0x1b989d[_0x1d3954][_0xb814('0x70')]],'%s',_0x506bf2):_0x506bf2;_0x506bf2=_0x1b989d[_0x1d3954][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x176585[_0x1b989d[_0x1d3954]['format']],'%s',_0x506bf2):_0x506bf2;if(_0x1b989d[_0x1d3954]['groupBy']){_0x5d064b[_0xb814('0x64')](_0x506bf2);}_0x1b989d[_0x1d3954][_0xb814('0x72')]&&_0x5d064b[_0xb814('0x3d')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x5d064b[_0xb814('0x65')](_0x506bf2,_0x1b989d[_0x1d3954][_0xb814('0x74')]||_0x506bf2);}if(_0x22c73f[_0xb814('0x75')]){_0x22c73f[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x22c73f[_0xb814('0x75')]);for(var _0x226b0e=0x0;_0x226b0e<_0x22c73f[_0xb814('0x75')][_0xb814('0x3a')];_0x226b0e+=0x1){if(_0x22c73f[_0xb814('0x75')][_0x226b0e]['type']&&_[_0xb814('0x5e')](_0x4d13db,_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')])&&_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')]&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignTable']&&_0x22c73f[_0xb814('0x75')][_0x226b0e]['foreignKey']){_0x5d064b[_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x33')]](_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],null,util[_0xb814('0x71')]('%s.%s\x20=\x20%s.%s',_0x22c73f['table'],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x77')],_0x22c73f[_0xb814('0x75')][_0x226b0e][_0xb814('0x78')],_0x22c73f['joins'][_0x226b0e][_0xb814('0x79')]));}}}if(_0x22c73f['conditions']){_0x22c73f[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x22c73f['conditions']);_0x5d064b['where'](_0x52edfa(_0x22c73f[_0xb814('0x7a')]['group']));}_0x139531=_0x5d064b[_0xb814('0x7b')]();_0x5d064b[_0xb814('0x3c')](_0xe14249);_0x5d064b[_0xb814('0x20')](0x0);logger[_0xb814('0x7c')](_0xb814('0x7d'),_0x5d064b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')]['query'](_0x5d064b[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')]['SELECT']});}})[_0xb814('0x28')](respondWithResult(_0x29a127,null))[_0xb814('0x44')](handleError(_0x29a127,null));};function runReport(_0x58d56c,_0x10a90d,_0x583f26){var _0x37adec=_0x10a90d[_0xb814('0x2e')];var _0x4e15c2=0xa;var _0x5a0c4a=[_0xb814('0x50'),_0xb814('0x81'),_0xb814('0x82'),_0xb814('0x51')];var _0x220f8b={'SUM':_0xb814('0x52'),'COUNT':_0xb814('0x53'),'COUNT DISTINCT':_0xb814('0x54'),'MAX':_0xb814('0x83'),'MIN':_0xb814('0x55'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x52b6da={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1fb1ea=function(_0x31c072){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),_0xb814('0x62')],_0x31c072);};var _0x5cf5ad=function(_0x20efc3){if(!_0x20efc3||!_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x30faa0='(',_0x55ceb8=0x0;_0x55ceb8<_0x20efc3[_0xb814('0x63')][_0xb814('0x3a')];_0x55ceb8+=0x1){_0x55ceb8>0x0&&(_0x30faa0+='\x20'+_0x20efc3[_0xb814('0x84')]+'\x20');_0x30faa0+=_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x64')]?_0x5cf5ad(_0x20efc3['rules'][_0x55ceb8]['group']):_0x20efc3[_0xb814('0x63')][_0x55ceb8]['field']+'\x20'+_0x20efc3[_0xb814('0x63')][_0x55ceb8][_0xb814('0x66')]+(_0x1fb1ea(_0x20efc3['rules'][_0x55ceb8][_0xb814('0x66')])?'\x20'+_0x20efc3['rules'][_0x55ceb8][_0xb814('0x85')]:'');}return _0x30faa0+')';};var _0x520d0f={'where':{'id':_0x58d56c['id']}},_0x44e668,_0x1aff2b,_0x41867b,_0x2c3948,_0x2d8899;_0x520d0f=_[_0xb814('0x40')]({},_0x520d0f,_0x583f26);return db[_0xb814('0x31')]['find'](_0x520d0f)['then'](function(_0x21aa36){if(_0x21aa36){_0x44e668=_0x21aa36;return _0x21aa36['getFields']();}return null;})['then'](function(_0x2d0061){if(_0x2d0061){if(!_0x2d0061[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))]['ValidationErrorItem'](_0xb814('0x69'),0x193);}_0x1aff2b=_0x2d0061;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x14ec54){if(_0x14ec54){_0x41867b=_[_0xb814('0x87')](_0x14ec54,'id');var _0x4c8a00;var _0x1454b3=squel[_0xb814('0x6b')]();_0x1454b3[_0xb814('0x88')](_0x44e668['table']);for(var _0x1ebbf6=0x0;_0x1ebbf6<_0x1aff2b[_0xb814('0x3a')];_0x1ebbf6+=0x1){_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x6d')]?_0x41867b[_0x1aff2b[_0x1ebbf6]['MetricId']][_0xb814('0x6e')]:_0x1aff2b[_0x1ebbf6][_0xb814('0x65')];_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]?_[_0xb814('0x6f')](_0x220f8b[_0x1aff2b[_0x1ebbf6][_0xb814('0x70')]],'%s',_0x4c8a00):_0x4c8a00;_0x4c8a00=_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]?_[_0xb814('0x6f')](_0x52b6da[_0x1aff2b[_0x1ebbf6][_0xb814('0x71')]],'%s',_0x4c8a00):_0x4c8a00;if(_0x1aff2b[_0x1ebbf6][_0xb814('0x89')]){_0x1454b3[_0xb814('0x64')](_0x4c8a00);}_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]&&_0x1454b3[_0xb814('0x3d')](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x72')]==='DESC'?![]:!![]);_0x1454b3['field'](_0x4c8a00,_0x1aff2b[_0x1ebbf6][_0xb814('0x74')]||_0x4c8a00);}if(_0x44e668['joins']){_0x44e668[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x44e668[_0xb814('0x75')]);for(var _0x2bc95b=0x0;_0x2bc95b<_0x44e668[_0xb814('0x75')][_0xb814('0x3a')];_0x2bc95b+=0x1){if(_0x44e668[_0xb814('0x75')][_0x2bc95b]['type']&&_['includes'](_0x5a0c4a,_0x44e668[_0xb814('0x75')][_0x2bc95b]['type'])&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')]&&_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable']&&_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]){_0x1454b3[_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x33')]](_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],null,util[_0xb814('0x71')](_0xb814('0x8a'),_0x44e668['table'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x77')],_0x44e668[_0xb814('0x75')][_0x2bc95b]['foreignTable'],_0x44e668[_0xb814('0x75')][_0x2bc95b][_0xb814('0x79')]));}}}if(_0x44e668['conditions']){_0x44e668[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x44e668['conditions']);_0x1454b3[_0xb814('0x3e')](_0x5cf5ad(_0x44e668[_0xb814('0x7a')][_0xb814('0x64')]));}_0x2d8899=_0x1454b3[_0xb814('0x7b')]();_0x1454b3[_0xb814('0x3c')](_0x4e15c2);_0x1454b3[_0xb814('0x20')](0x0);return;}})[_0xb814('0x28')](function(){if(_0x10a90d[_0xb814('0x8b')]===_0xb814('0x8c')){return null;}var _0x1f8c7a=_[_0xb814('0x40')](_0x10a90d,{'name':_0x10a90d[_0xb814('0x8d')]||_0x10a90d['name']||_0x44e668['name'],'basename':_0x37adec,'savename':util[_0xb814('0x71')]('%s-%s.%s',_0x10a90d['name']||_0x44e668[_0xb814('0x2e')],require('randomstring')['generate'](0x4),_0x10a90d['output']||_0xb814('0x8e')),'reportId':_0x44e668['id'],'reportType':_0xb814('0x8f')});return db[_0xb814('0x90')]['create'](_0x1f8c7a,{'raw':!![]});})[_0xb814('0x28')](function(_0x4dbe89){if(_0x44e668[_0xb814('0x6c')]===_0xb814('0x91')){_0x2d8899['where'](_0x44e668[_0xb814('0x6c')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}else{_0x2d8899[_0xb814('0x3e')](_0x44e668[_0xb814('0x6c')]+_0xb814('0x94'),_0x10a90d[_0xb814('0x92')],_0x10a90d[_0xb814('0x93')]);}if(_0x4dbe89){logger[_0xb814('0x95')](_0xb814('0x96'),_0x2d8899[_0xb814('0x7e')]());require(_0xb814('0x97'))[_0xb814('0x98')](path[_0xb814('0x50')](__dirname,_0xb814('0x99'),_0x4dbe89[_0xb814('0x8b')]),[_0x4dbe89['id'],_0x2d8899['toString'](),path[_0xb814('0x50')](__dirname,_0xb814('0x9a'),_0x4dbe89['savename']),_0x37adec]);return _0x4dbe89;}else{var _0x2c7cd6=squel[_0xb814('0x6b')]();_0x2c7cd6[_0xb814('0x88')]('('+_0x2d8899['toString']()+')','countTable');_0x2c7cd6[_0xb814('0x65')]('COUNT(*)',_0xb814('0x22'));_0x2d8899['limit'](_0x10a90d[_0xb814('0x3c')]||_0x4e15c2);_0x2d8899['offset'](_0x10a90d['offset']||0x0);return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x2c7cd6[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]})[_0xb814('0x28')](function(_0x4543c3){if(!_0x4543c3[_0xb814('0x3a')]){_0x2c3948=0x0;}else{_0x2c3948=_0x4543c3[0x0][_0xb814('0x22')]||0x0;}return dbH[_0xb814('0x7f')]['query'](_0x2d8899[_0xb814('0x7e')](),{'type':dbH['sequelize'][_0xb814('0x80')][_0xb814('0x9b')]});})[_0xb814('0x28')](function(_0x4fde6a){return{'rows':_0x4fde6a||[],'count':_0x2c3948};});}});}exports[_0xb814('0x9c')]=function(_0x18fb74,_0x371e92){return runReport(_0x18fb74[_0xb814('0x46')],_0x18fb74[_0xb814('0x35')],_0x18fb74[_0xb814('0x41')])[_0xb814('0x28')](respondWithResult(_0x371e92,null))[_0xb814('0x44')](handleError(_0x371e92,null));};exports[_0xb814('0x9d')]=runReport;exports[_0xb814('0x35')]=function(_0x3b65c0,_0x11e0c3){var _0x22c811=0xa;var _0x3fd24c=[_0xb814('0x50'),'left_join',_0xb814('0x82'),_0xb814('0x51')];var _0x3e61eb={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xb814('0x54'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xb814('0x57'),'GROUP_CONCAT DESC':_0xb814('0x58')};var _0x5be0bb={'SEC_TO_TIME':_0xb814('0x59'),'DATE':_0xb814('0x5a'),'HOUR':_0xb814('0x5b'),'ROUND':_0xb814('0x5c'),'UNIX_TIMESTAMP':_0xb814('0x5d')};var _0x1bd9ab=function(_0x20e608){return!_[_0xb814('0x5e')]([_0xb814('0x5f'),_0xb814('0x60'),_0xb814('0x61'),'IS\x20NOT\x20EMPTY'],_0x20e608);};var _0x2a5dff=function(_0x553635){if(!_0x553635||!_0x553635[_0xb814('0x63')][_0xb814('0x3a')]){return'';}for(var _0x35e8f7='(',_0xa7ff62=0x0;_0xa7ff62<_0x553635[_0xb814('0x63')][_0xb814('0x3a')];_0xa7ff62+=0x1){_0xa7ff62>0x0&&(_0x35e8f7+='\x20'+_0x553635[_0xb814('0x84')]+'\x20');_0x35e8f7+=_0x553635[_0xb814('0x63')][_0xa7ff62]['group']?_0x2a5dff(_0x553635['rules'][_0xa7ff62]['group']):_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x65')]+'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')]+(_0x1bd9ab(_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x66')])?'\x20'+_0x553635[_0xb814('0x63')][_0xa7ff62][_0xb814('0x85')]:'');}return _0x35e8f7+')';};var _0x41847e={'where':{'id':_0x3b65c0[_0xb814('0x46')]['id']}},_0x1a5685,_0x51313d,_0x5c989a,_0x41486b,_0x16c05b;_0x41847e=_[_0xb814('0x40')]({},_0x41847e,_0x3b65c0[_0xb814('0x41')]);return db[_0xb814('0x31')]['find'](_0x41847e)[_0xb814('0x28')](function(_0x52899a){if(_0x52899a){_0x1a5685=_0x52899a;return _0x52899a[_0xb814('0x67')]();}return null;})[_0xb814('0x28')](function(_0x205c6c){if(_0x205c6c){if(!_0x205c6c[_0xb814('0x3a')]){throw new db[(_0xb814('0x86'))][(_0xb814('0x68'))](_0xb814('0x69'),0x193);}_0x51313d=_0x205c6c;return db['AnalyticMetric'][_0xb814('0x43')]({'raw':!![]});}return null;})[_0xb814('0x28')](function(_0x1f04eb){if(_0x1f04eb){_0x5c989a=_[_0xb814('0x87')](_0x1f04eb,'id');var _0x4a1c4e;var _0x17c63b=squel[_0xb814('0x6b')]();_0x17c63b[_0xb814('0x88')](_0x1a5685[_0xb814('0x6c')]);for(var _0xa66ca3=0x0;_0xa66ca3<_0x51313d['length'];_0xa66ca3+=0x1){_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x6d')]?_0x5c989a[_0x51313d[_0xa66ca3][_0xb814('0x6d')]][_0xb814('0x6e')]:_0x51313d[_0xa66ca3]['field'];_0x4a1c4e=_0x51313d[_0xa66ca3][_0xb814('0x70')]?_['replace'](_0x3e61eb[_0x51313d[_0xa66ca3][_0xb814('0x70')]],'%s',_0x4a1c4e):_0x4a1c4e;_0x4a1c4e=_0x51313d[_0xa66ca3]['format']?_[_0xb814('0x6f')](_0x5be0bb[_0x51313d[_0xa66ca3][_0xb814('0x71')]],'%s',_0x4a1c4e):_0x4a1c4e;if(_0x51313d[_0xa66ca3][_0xb814('0x89')]){_0x17c63b[_0xb814('0x64')](_0x4a1c4e);}_0x51313d[_0xa66ca3]['orderBy']&&_0x17c63b[_0xb814('0x3d')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x72')]===_0xb814('0x73')?![]:!![]);_0x17c63b[_0xb814('0x65')](_0x4a1c4e,_0x51313d[_0xa66ca3][_0xb814('0x74')]||_0x4a1c4e);}if(_0x1a5685[_0xb814('0x75')]){_0x1a5685[_0xb814('0x75')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x75')]);for(var _0x152260=0x0;_0x152260<_0x1a5685[_0xb814('0x75')][_0xb814('0x3a')];_0x152260+=0x1){if(_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]&&_[_0xb814('0x5e')](_0x3fd24c,_0x1a5685['joins'][_0x152260][_0xb814('0x33')])&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')]&&_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')]&&_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']){_0x17c63b[_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x33')]](_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1a5685[_0xb814('0x6c')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x77')],_0x1a5685[_0xb814('0x75')][_0x152260][_0xb814('0x78')],_0x1a5685[_0xb814('0x75')][_0x152260]['foreignKey']));}}}if(_0x1a5685[_0xb814('0x7a')]){_0x1a5685[_0xb814('0x7a')]=JSON[_0xb814('0x76')](_0x1a5685[_0xb814('0x7a')]);_0x17c63b['where'](_0x2a5dff(_0x1a5685[_0xb814('0x7a')][_0xb814('0x64')]));}_0x16c05b=_0x17c63b[_0xb814('0x7b')]();_0x17c63b[_0xb814('0x3c')](_0x22c811);_0x17c63b[_0xb814('0x20')](0x0);logger['debug'](_0xb814('0x7d'),_0x17c63b[_0xb814('0x7e')]());return dbH[_0xb814('0x7f')][_0xb814('0x35')](_0x17c63b[_0xb814('0x7e')](),{'type':dbH[_0xb814('0x7f')][_0xb814('0x80')][_0xb814('0x9b')]});}})[_0xb814('0x28')](function(){return{'sql':_0x16c05b[_0xb814('0x7e')]()};})[_0xb814('0x28')](respondWithResult(_0x11e0c3,null))[_0xb814('0x44')](handleError(_0x11e0c3,null));}; \ No newline at end of file +var _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_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)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x56837e,_0x56f32b){var _0x55f545=function(_0x27d376){while(--_0x27d376){_0x56837e['push'](_0x56837e['shift']());}};_0x55f545(++_0x56f32b);}(_0x31f0,0xb7));var _0x031f=function(_0x2b0bcc,_0x1f8d23){_0x2b0bcc=_0x2b0bcc-0x0;var _0x116666=_0x31f0[_0x2b0bcc];return _0x116666;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 3153f42..e163047 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 _0x3669=['rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x132254,_0x4af975){var _0x32b2fa=function(_0x72c86e){while(--_0x72c86e){_0x132254['push'](_0x132254['shift']());}};_0x32b2fa(++_0x4af975);}(_0x3669,0x1e7));var _0x9366=function(_0xf3671b,_0x5ef77b){_0xf3671b=_0xf3671b-0x0;var _0x1f815f=_0x3669[_0xf3671b];return _0x1f815f;};'use strict';var _=require(_0x9366('0x0'));var util=require(_0x9366('0x1'));var logger=require('../../config/logger')(_0x9366('0x2'));var moment=require(_0x9366('0x3'));var BPromise=require(_0x9366('0x4'));var rp=require(_0x9366('0x5'));var fs=require('fs');var path=require(_0x9366('0x6'));var rimraf=require(_0x9366('0x7'));var config=require('../../config/environment');var attributes=require(_0x9366('0x8'));module[_0x9366('0x9')]=function(_0xa2a28e,_0x2cd122){return _0xa2a28e[_0x9366('0xa')](_0x9366('0xb'),attributes,{'tableName':_0x9366('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb326=['./analyticDefaultReport.attributes','exports','AnalyticDefaultReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x1fc560,_0x2e67b2){var _0x4b0c1d=function(_0x4a69e4){while(--_0x4a69e4){_0x1fc560['push'](_0x1fc560['shift']());}};_0x4b0c1d(++_0x2e67b2);}(_0xb326,0xcf));var _0x6b32=function(_0x1d3923,_0x5569c6){_0x1d3923=_0x1d3923-0x0;var _0x58bb2d=_0xb326[_0x1d3923];return _0x58bb2d;};'use strict';var _=require(_0x6b32('0x0'));var util=require(_0x6b32('0x1'));var logger=require(_0x6b32('0x2'))(_0x6b32('0x3'));var moment=require(_0x6b32('0x4'));var BPromise=require(_0x6b32('0x5'));var rp=require(_0x6b32('0x6'));var fs=require('fs');var path=require(_0x6b32('0x7'));var rimraf=require('rimraf');var config=require(_0x6b32('0x8'));var attributes=require(_0x6b32('0x9'));module[_0x6b32('0xa')]=function(_0x2f6e80,_0x193e7d){return _0x2f6e80['define'](_0x6b32('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 1d04428..3a6a44a 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 _0xe087=['request\x20sent','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticDefaultReport,\x20%s,\x20%s'];(function(_0x57aae5,_0x4b0939){var _0x33225e=function(_0x2f7904){while(--_0x2f7904){_0x57aae5['push'](_0x57aae5['shift']());}};_0x33225e(++_0x4b0939);}(_0xe087,0xae));var _0x7e08=function(_0x100efd,_0x94358d){_0x100efd=_0x100efd-0x0;var _0x49e58b=_0xe087[_0x100efd];return _0x49e58b;};'use strict';var _=require('lodash');var util=require(_0x7e08('0x0'));var moment=require(_0x7e08('0x1'));var BPromise=require(_0x7e08('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e08('0x3'));var db=require(_0x7e08('0x4'))['db'];var utils=require(_0x7e08('0x5'));var logger=require(_0x7e08('0x6'))(_0x7e08('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7e08('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb91b4a,_0x4342dc,_0x57db10){return new BPromise(function(_0x141c51,_0x2f89e3){return client[_0x7e08('0x9')](_0xb91b4a,_0x57db10)[_0x7e08('0xa')](function(_0x38bb27){logger[_0x7e08('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4342dc,'request\x20sent');logger['debug'](_0x7e08('0xc'),_0x4342dc,'request\x20sent',JSON['stringify'](_0x38bb27));if(_0x38bb27[_0x7e08('0xd')]){if(_0x38bb27[_0x7e08('0xd')]['code']===0x1f4){logger[_0x7e08('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4342dc,_0x38bb27['error'][_0x7e08('0xe')]);return _0x2f89e3(_0x38bb27[_0x7e08('0xd')][_0x7e08('0xe')]);}logger[_0x7e08('0xd')](_0x7e08('0xf'),_0x4342dc,_0x38bb27['error'][_0x7e08('0xe')]);return _0x141c51(_0x38bb27[_0x7e08('0xd')][_0x7e08('0xe')]);}else{logger[_0x7e08('0xb')](_0x7e08('0xf'),_0x4342dc,_0x7e08('0x10'));_0x141c51(_0x38bb27[_0x7e08('0x11')][_0x7e08('0xe')]);}})[_0x7e08('0x12')](function(_0x1579b5){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4342dc,_0x1579b5);_0x2f89e3(_0x1579b5);});});} \ No newline at end of file +var _0xf4ba=['AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','request','then'];(function(_0x2bf0b1,_0x171aaa){var _0x29456f=function(_0x20b690){while(--_0x20b690){_0x2bf0b1['push'](_0x2bf0b1['shift']());}};_0x29456f(++_0x171aaa);}(_0xf4ba,0x130));var _0xaf4b=function(_0x37d031,_0x13049){_0x37d031=_0x37d031-0x0;var _0x1de593=_0xf4ba[_0x37d031];return _0x1de593;};'use strict';var _=require(_0xaf4b('0x0'));var util=require(_0xaf4b('0x1'));var moment=require(_0xaf4b('0x2'));var BPromise=require(_0xaf4b('0x3'));var rs=require(_0xaf4b('0x4'));var fs=require('fs');var Redis=require(_0xaf4b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xaf4b('0x6'))('rpc');var config=require(_0xaf4b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaf4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1340d1,_0x597f24,_0x4bf7c8){return new BPromise(function(_0x8e75e5,_0x490c5a){return client[_0xaf4b('0x9')](_0x1340d1,_0x4bf7c8)[_0xaf4b('0xa')](function(_0x1c6899){logger['info'](_0xaf4b('0xb'),_0x597f24,_0xaf4b('0xc'));logger[_0xaf4b('0xd')](_0xaf4b('0xe'),_0x597f24,_0xaf4b('0xc'),JSON[_0xaf4b('0xf')](_0x1c6899));if(_0x1c6899[_0xaf4b('0x10')]){if(_0x1c6899['error'][_0xaf4b('0x11')]===0x1f4){logger[_0xaf4b('0x10')](_0xaf4b('0xb'),_0x597f24,_0x1c6899[_0xaf4b('0x10')][_0xaf4b('0x12')]);return _0x490c5a(_0x1c6899[_0xaf4b('0x10')][_0xaf4b('0x12')]);}logger[_0xaf4b('0x10')](_0xaf4b('0xb'),_0x597f24,_0x1c6899[_0xaf4b('0x10')][_0xaf4b('0x12')]);return _0x8e75e5(_0x1c6899['error']['message']);}else{logger[_0xaf4b('0x13')](_0xaf4b('0xb'),_0x597f24,_0xaf4b('0xc'));_0x8e75e5(_0x1c6899['result'][_0xaf4b('0x12')]);}})[_0xaf4b('0x14')](function(_0x68fe26){logger[_0xaf4b('0x10')](_0xaf4b('0xb'),_0x597f24,_0x68fe26);_0x490c5a(_0x68fe26);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index f69334b..33e0971 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 _0xeb94=['query','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run'];(function(_0x4c41ff,_0x40061e){var _0x2e10f5=function(_0x19a0af){while(--_0x19a0af){_0x4c41ff['push'](_0x4c41ff['shift']());}};_0x2e10f5(++_0x40061e);}(_0xeb94,0x1d2));var _0x4eb9=function(_0x2acb61,_0x4436ab){_0x2acb61=_0x2acb61-0x0;var _0x5361bf=_0xeb94[_0x2acb61];return _0x5361bf;};'use strict';var multer=require('multer');var util=require(_0x4eb9('0x0'));var path=require(_0x4eb9('0x1'));var timeout=require(_0x4eb9('0x2'));var express=require(_0x4eb9('0x3'));var router=express[_0x4eb9('0x4')]();var fs_extra=require(_0x4eb9('0x5'));var auth=require(_0x4eb9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4eb9('0x7'));var controller=require(_0x4eb9('0x8'));router[_0x4eb9('0x9')]('/',auth[_0x4eb9('0xa')](),controller[_0x4eb9('0xb')]);router[_0x4eb9('0x9')](_0x4eb9('0xc'),auth[_0x4eb9('0xa')](),controller[_0x4eb9('0xd')]);router[_0x4eb9('0x9')](_0x4eb9('0xe'),auth[_0x4eb9('0xa')](),controller[_0x4eb9('0xf')]);router[_0x4eb9('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0x4eb9('0x10')]);router[_0x4eb9('0x9')]('/:id/query',auth['isAuthenticated'](),controller[_0x4eb9('0x11')]);router[_0x4eb9('0x12')]('/',auth[_0x4eb9('0xa')](),controller['create']);router[_0x4eb9('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x4eb9('0x14')]);router['delete'](_0x4eb9('0xc'),auth[_0x4eb9('0xa')](),controller[_0x4eb9('0x15')]);module[_0x4eb9('0x16')]=router; \ No newline at end of file +var _0x6016=['create','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','index','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','query'];(function(_0x195b13,_0x609368){var _0x345feb=function(_0x4b5fe5){while(--_0x4b5fe5){_0x195b13['push'](_0x195b13['shift']());}};_0x345feb(++_0x609368);}(_0x6016,0x101));var _0x6601=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0x6016[_0xe896bf];return _0x4c7a8a;};'use strict';var multer=require(_0x6601('0x0'));var util=require('util');var path=require(_0x6601('0x1'));var timeout=require(_0x6601('0x2'));var express=require('express');var router=express[_0x6601('0x3')]();var fs_extra=require(_0x6601('0x4'));var auth=require(_0x6601('0x5'));var interaction=require(_0x6601('0x6'));var config=require(_0x6601('0x7'));var controller=require(_0x6601('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x6601('0x9')]);router[_0x6601('0xa')](_0x6601('0xb'),auth[_0x6601('0xc')](),controller[_0x6601('0xd')]);router['get'](_0x6601('0xe'),auth[_0x6601('0xc')](),controller[_0x6601('0xf')]);router[_0x6601('0xa')](_0x6601('0x10'),auth[_0x6601('0xc')](),controller[_0x6601('0x11')]);router['get']('/:id/query',auth[_0x6601('0xc')](),controller[_0x6601('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6601('0x13')]);router['put'](_0x6601('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x6601('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6601('0x15')]);module[_0x6601('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1dde8a9..462554f 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 _0x6aa9=['STRING','ENUM','csv','xlsx','DATE','Loading','manual','scheduled','INTEGER','moment','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6aa9,0x82));var _0x96aa=function(_0x5e29eb,_0x2ed36d){_0x5e29eb=_0x5e29eb-0x0;var _0x3e6df1=_0x6aa9[_0x5e29eb];return _0x3e6df1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x96aa('0x0'));module[_0x96aa('0x1')]={'name':{'type':Sequelize[_0x96aa('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x96aa('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x96aa('0x3')](_0x96aa('0x4'),'pdf',_0x96aa('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x96aa('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x96aa('0x6')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x96aa('0x2')],'defaultValue':_0x96aa('0x7')},'type':{'type':Sequelize[_0x96aa('0x3')](_0x96aa('0x8'),_0x96aa('0x9')),'allowNull':![],'defaultValue':_0x96aa('0x8')},'reportId':{'type':Sequelize[_0x96aa('0xa')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x96aa('0x2')]}}; \ No newline at end of file +var _0xcf78=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','INTEGER','UNSIGNED'];(function(_0x5d8b42,_0x4cd40d){var _0x453a08=function(_0x54cc72){while(--_0x54cc72){_0x5d8b42['push'](_0x5d8b42['shift']());}};_0x453a08(++_0x4cd40d);}(_0xcf78,0xf7));var _0x8cf7=function(_0x376011,_0x5699d7){_0x376011=_0x376011-0x0;var _0x383b79=_0xcf78[_0x376011];return _0x383b79;};'use strict';var Sequelize=require(_0x8cf7('0x0'));var moment=require(_0x8cf7('0x1'));module[_0x8cf7('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x8cf7('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x8cf7('0x4')](_0x8cf7('0x5'),_0x8cf7('0x6'),_0x8cf7('0x7')),'allowNull':![],'defaultValue':_0x8cf7('0x5')},'savename':{'type':Sequelize[_0x8cf7('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x8cf7('0x8')]},'endDate':{'type':Sequelize[_0x8cf7('0x8')]},'status':{'type':Sequelize[_0x8cf7('0x3')],'defaultValue':_0x8cf7('0x9')},'type':{'type':Sequelize[_0x8cf7('0x4')](_0x8cf7('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0x8cf7('0xa')},'reportId':{'type':Sequelize[_0x8cf7('0xb')](0xb)[_0x8cf7('0xc')]},'reportType':{'type':Sequelize[_0x8cf7('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index e864752..ba0135d 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 _0xfbfa=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','savename','output','existsSync','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','moment','bluebird','mustache','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/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','model','intersection','attributes','fields','query','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','AnalyticExtractedReport','includeAll','include','rows','catch','show','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId'];(function(_0xbf098b,_0x269d81){var _0x2f1446=function(_0xa84d24){while(--_0xa84d24){_0xbf098b['push'](_0xbf098b['shift']());}};_0x2f1446(++_0x269d81);}(_0xfbfa,0x192));var _0xafbf=function(_0x4b2d65,_0x235972){_0x4b2d65=_0x4b2d65-0x0;var _0x3d6879=_0xfbfa[_0x4b2d65];return _0x3d6879;};'use strict';var emlformat=require(_0xafbf('0x0'));var rimraf=require(_0xafbf('0x1'));var zipdir=require(_0xafbf('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xafbf('0x3'));var BPromise=require(_0xafbf('0x4'));var Mustache=require(_0xafbf('0x5'));var util=require(_0xafbf('0x6'));var path=require(_0xafbf('0x7'));var sox=require(_0xafbf('0x8'));var csv=require('to-csv');var ejs=require(_0xafbf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xafbf('0xa'));var crypto=require(_0xafbf('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xafbf('0xc'));var toCsv=require(_0xafbf('0xd'));var querystring=require(_0xafbf('0xe'));var Papa=require(_0xafbf('0xf'));var Redis=require(_0xafbf('0x10'));var authService=require(_0xafbf('0x11'));var qs=require(_0xafbf('0x12'));var as=require(_0xafbf('0x13'));var hardwareService=require(_0xafbf('0x14'));var logger=require('../../config/logger')(_0xafbf('0x15'));var utils=require(_0xafbf('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xafbf('0x17'));var db=require(_0xafbf('0x18'))['db'];function respondWithStatusCode(_0x569b08,_0xabbd62){_0xabbd62=_0xabbd62||0xcc;return function(_0x65fd42){if(_0x65fd42){return _0x569b08[_0xafbf('0x19')](_0xabbd62);}return _0x569b08[_0xafbf('0x1a')](_0xabbd62)[_0xafbf('0x1b')]();};}function respondWithResult(_0xc438af,_0x1dcbf7){_0x1dcbf7=_0x1dcbf7||0xc8;return function(_0xc712bf){if(_0xc712bf){return _0xc438af[_0xafbf('0x1a')](_0x1dcbf7)[_0xafbf('0x1c')](_0xc712bf);}};}function respondWithFilteredResult(_0x4f60a4,_0x22a438){return function(_0x5e6ecd){if(_0x5e6ecd){var _0x4abdbb=typeof _0x22a438[_0xafbf('0x1d')]==='undefined'&&typeof _0x22a438[_0xafbf('0x1e')]===_0xafbf('0x1f');var _0x5e783b=_0x5e6ecd['count'];var _0x55ba5d=_0x4abdbb?0x0:_0x22a438[_0xafbf('0x1d')];var _0x46e8d7=_0x4abdbb?_0x5e6ecd[_0xafbf('0x20')]:_0x22a438[_0xafbf('0x1d')]+_0x22a438[_0xafbf('0x1e')];var _0x154c15;if(_0x46e8d7>=_0x5e783b){_0x46e8d7=_0x5e783b;_0x154c15=0xc8;}else{_0x154c15=0xce;}_0x4f60a4[_0xafbf('0x1a')](_0x154c15);return _0x4f60a4[_0xafbf('0x21')](_0xafbf('0x22'),_0x55ba5d+'-'+_0x46e8d7+'/'+_0x5e783b)[_0xafbf('0x1c')](_0x5e6ecd);}return null;};}function patchUpdates(_0x33550a){return function(_0x254ad0){try{jsonpatch[_0xafbf('0x23')](_0x254ad0,_0x33550a,!![]);}catch(_0x80cc0c){return BPromise[_0xafbf('0x24')](_0x80cc0c);}return _0x254ad0[_0xafbf('0x25')]();};}function saveUpdates(_0x39c365,_0xbcc091){return function(_0x18674d){if(_0x18674d){return _0x18674d[_0xafbf('0x26')](_0x39c365)[_0xafbf('0x27')](function(_0x172c10){return _0x172c10;});}return null;};}function removeEntity(_0x54a5dd,_0xc4a778){return function(_0x56deca){if(_0x56deca){return _0x56deca[_0xafbf('0x28')]()[_0xafbf('0x27')](function(){var _0x4259d0=_0x56deca['get']({'plain':!![]});var _0x467581=_0xafbf('0x29');return db[_0xafbf('0x2a')]['destroy']({'where':{'type':_0x467581,'resourceId':_0x4259d0['id']}})[_0xafbf('0x27')](function(){return _0x56deca;});})[_0xafbf('0x27')](function(){_0x54a5dd[_0xafbf('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x308198,_0x396ec9){return function(_0x52cc69){if(!_0x52cc69){_0x308198[_0xafbf('0x19')](0x194);}return _0x52cc69;};}function handleError(_0xd71bab,_0x3c90c6){_0x3c90c6=_0x3c90c6||0x1f4;return function(_0x3067bf){logger[_0xafbf('0x2b')](_0x3067bf['stack']);if(_0x3067bf[_0xafbf('0x2c')]){delete _0x3067bf[_0xafbf('0x2c')];}_0xd71bab[_0xafbf('0x1a')](_0x3c90c6)[_0xafbf('0x2d')](_0x3067bf);};}exports[_0xafbf('0x2e')]=function(_0x411b4a,_0xfaed28){var _0x322b2f={},_0x279f50={},_0x2a5028={'count':0x0,'rows':[]};var _0x26812e=_[_0xafbf('0x2f')](db['AnalyticExtractedReport'][_0xafbf('0x30')],function(_0x2d8726){return{'name':_0x2d8726[_0xafbf('0x31')],'type':_0x2d8726[_0xafbf('0x32')][_0xafbf('0x33')]};});_0x279f50[_0xafbf('0x34')]=_[_0xafbf('0x2f')](_0x26812e,_0xafbf('0x2c'));_0x279f50['query']=_['keys'](_0x411b4a['query']);_0x279f50['filters']=_[_0xafbf('0x35')](_0x279f50[_0xafbf('0x34')],_0x279f50['query']);_0x322b2f[_0xafbf('0x36')]=_[_0xafbf('0x35')](_0x279f50[_0xafbf('0x34')],qs[_0xafbf('0x37')](_0x411b4a[_0xafbf('0x38')][_0xafbf('0x37')]));_0x322b2f[_0xafbf('0x36')]=_0x322b2f[_0xafbf('0x36')][_0xafbf('0x39')]?_0x322b2f[_0xafbf('0x36')]:_0x279f50[_0xafbf('0x34')];if(!_0x411b4a[_0xafbf('0x38')]['hasOwnProperty']('nolimit')){_0x322b2f[_0xafbf('0x1e')]=qs[_0xafbf('0x1e')](_0x411b4a[_0xafbf('0x38')][_0xafbf('0x1e')]);_0x322b2f[_0xafbf('0x1d')]=qs['offset'](_0x411b4a[_0xafbf('0x38')][_0xafbf('0x1d')]);}_0x322b2f[_0xafbf('0x3a')]=qs[_0xafbf('0x3b')](_0x411b4a[_0xafbf('0x38')][_0xafbf('0x3b')]);_0x322b2f[_0xafbf('0x3c')]=qs[_0xafbf('0x3d')](_[_0xafbf('0x3e')](_0x411b4a[_0xafbf('0x38')],_0x279f50[_0xafbf('0x3d')]),_0x26812e);if(_0x411b4a[_0xafbf('0x38')]['filter']){_0x322b2f[_0xafbf('0x3c')]=_[_0xafbf('0x3f')](_0x322b2f[_0xafbf('0x3c')],{'$or':_[_0xafbf('0x2f')](_0x26812e,function(_0x5a047c){if(_0x5a047c[_0xafbf('0x32')]!==_0xafbf('0x40')){var _0xc68b6f={};_0xc68b6f[_0x5a047c[_0xafbf('0x2c')]]={'$like':'%'+_0x411b4a[_0xafbf('0x38')][_0xafbf('0x41')]+'%'};return _0xc68b6f;}})});}_0x322b2f=_[_0xafbf('0x3f')]({},_0x322b2f,_0x411b4a[_0xafbf('0x42')]);var _0x109698={'where':_0x322b2f[_0xafbf('0x3c')]};return db[_0xafbf('0x43')][_0xafbf('0x20')](_0x109698)[_0xafbf('0x27')](function(_0x227ea3){_0x2a5028[_0xafbf('0x20')]=_0x227ea3;if(_0x411b4a['query'][_0xafbf('0x44')]){_0x322b2f[_0xafbf('0x45')]=[{'all':!![]}];}return db[_0xafbf('0x43')]['findAll'](_0x322b2f);})[_0xafbf('0x27')](function(_0xce46a4){_0x2a5028[_0xafbf('0x46')]=_0xce46a4;return _0x2a5028;})['then'](respondWithFilteredResult(_0xfaed28,_0x322b2f))[_0xafbf('0x47')](handleError(_0xfaed28,null));};exports[_0xafbf('0x48')]=function(_0xdd2b50,_0x142b85){var _0x34d847={'raw':!![],'where':{'id':_0xdd2b50['params']['id']}},_0x7e9443={};_0x7e9443[_0xafbf('0x34')]=_[_0xafbf('0x49')](db[_0xafbf('0x43')][_0xafbf('0x30')]);_0x7e9443[_0xafbf('0x38')]=_[_0xafbf('0x49')](_0xdd2b50['query']);_0x7e9443[_0xafbf('0x3d')]=_[_0xafbf('0x35')](_0x7e9443['model'],_0x7e9443['query']);_0x34d847['attributes']=_[_0xafbf('0x35')](_0x7e9443['model'],qs[_0xafbf('0x37')](_0xdd2b50[_0xafbf('0x38')][_0xafbf('0x37')]));_0x34d847[_0xafbf('0x36')]=_0x34d847[_0xafbf('0x36')]['length']?_0x34d847[_0xafbf('0x36')]:_0x7e9443[_0xafbf('0x34')];if(_0xdd2b50[_0xafbf('0x38')][_0xafbf('0x44')]){_0x34d847[_0xafbf('0x45')]=[{'all':!![]}];}_0x34d847=_[_0xafbf('0x3f')]({},_0x34d847,_0xdd2b50[_0xafbf('0x42')]);return db[_0xafbf('0x43')][_0xafbf('0x4a')](_0x34d847)[_0xafbf('0x27')](handleEntityNotFound(_0x142b85,null))[_0xafbf('0x27')](respondWithResult(_0x142b85,null))['catch'](handleError(_0x142b85,null));};exports[_0xafbf('0x4b')]=function(_0x16c177,_0x2c3223){return db[_0xafbf('0x43')][_0xafbf('0x4b')](_0x16c177[_0xafbf('0x4c')],{})[_0xafbf('0x27')](function(_0x43c3eb){var _0x39411a=_0x16c177[_0xafbf('0x4d')][_0xafbf('0x4e')]({'plain':!![]});if(!_0x39411a)throw new Error(_0xafbf('0x4f'));if(_0x39411a[_0xafbf('0x50')]===_0xafbf('0x4d')){var _0x500800=_0x43c3eb[_0xafbf('0x4e')]({'plain':!![]});var _0x490110=_0xafbf('0x29');return db[_0xafbf('0x51')]['find']({'where':{'name':_0x490110,'userProfileId':_0x39411a[_0xafbf('0x52')]},'raw':!![]})[_0xafbf('0x27')](function(_0xf8895b){if(_0xf8895b&&_0xf8895b['autoAssociation']===0x0){return db[_0xafbf('0x2a')]['create']({'name':_0x500800['name'],'resourceId':_0x500800['id'],'type':_0xf8895b[_0xafbf('0x2c')],'sectionId':_0xf8895b['id']},{})[_0xafbf('0x27')](function(){return _0x43c3eb;});}else{return _0x43c3eb;}})[_0xafbf('0x47')](function(_0x29c627){logger[_0xafbf('0x2b')](_0xafbf('0x53'),_0x29c627);throw _0x29c627;});}return _0x43c3eb;})[_0xafbf('0x27')](respondWithResult(_0x2c3223,0xc9))[_0xafbf('0x47')](handleError(_0x2c3223,null));};exports[_0xafbf('0x26')]=function(_0x5a33aa,_0x57ea68){if(_0x5a33aa['body']['id']){delete _0x5a33aa[_0xafbf('0x4c')]['id'];}return db[_0xafbf('0x43')]['find']({'where':{'id':_0x5a33aa[_0xafbf('0x54')]['id']}})[_0xafbf('0x27')](handleEntityNotFound(_0x57ea68,null))['then'](saveUpdates(_0x5a33aa[_0xafbf('0x4c')],null))[_0xafbf('0x27')](respondWithResult(_0x57ea68,null))[_0xafbf('0x47')](handleError(_0x57ea68,null));};exports[_0xafbf('0x28')]=function(_0x57d502,_0x2c1a28){return db['AnalyticExtractedReport'][_0xafbf('0x4a')]({'where':{'id':_0x57d502['params']['id']}})['then'](handleEntityNotFound(_0x2c1a28,null))[_0xafbf('0x27')](removeEntity(_0x2c1a28,null))[_0xafbf('0x47')](handleError(_0x2c1a28,null));};exports[_0xafbf('0x55')]=function(_0x137cbd,_0x176b47,_0x21fc79){return db[_0xafbf('0x43')]['find']({'where':{'id':_0x137cbd[_0xafbf('0x54')]['id']},'attributes':[_0xafbf('0x2c'),'basename',_0xafbf('0x56'),_0xafbf('0x57')],'raw':!![]})[_0xafbf('0x27')](handleEntityNotFound(_0x176b47,null))[_0xafbf('0x27')](function(_0x55e928){if(_0x55e928){if(!fs[_0xafbf('0x58')](path[_0xafbf('0x59')](config['root'],_0xafbf('0x5a'),_0x55e928['savename']))){throw new db['Sequelize'][(_0xafbf('0x5b'))](_0xafbf('0x5c'));}if(_0x137cbd[_0xafbf('0x38')][_0xafbf('0x5d')]){return _0x176b47[_0xafbf('0x19')](0xc8);}return _0x176b47[_0xafbf('0x55')](path[_0xafbf('0x59')](config['root'],_0xafbf('0x5a'),_0x55e928[_0xafbf('0x56')]),util[_0xafbf('0x5e')](_0xafbf('0x5f'),_0x55e928['basename']||_0x55e928[_0xafbf('0x2c')],_0x55e928[_0xafbf('0x57')][_0xafbf('0x60')]()));}})[_0xafbf('0x47')](handleError(_0x176b47,null));}; \ No newline at end of file +var _0x98f3=['destroy','sendStatus','error','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','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','download','basename','savename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','root','format','%s.%s','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','offset','undefined','limit','count','set','json','apply','save','update','then','get','ExtractedReports','UserProfileResource'];(function(_0x53f1bb,_0x17ac53){var _0x2e55e6=function(_0x57b236){while(--_0x57b236){_0x53f1bb['push'](_0x53f1bb['shift']());}};_0x2e55e6(++_0x17ac53);}(_0x98f3,0x160));var _0x398f=function(_0x43a4c2,_0x4e400f){_0x43a4c2=_0x43a4c2-0x0;var _0x3cd4fb=_0x98f3[_0x43a4c2];return _0x3cd4fb;};'use strict';var emlformat=require(_0x398f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x398f('0x1'));var jsonpatch=require(_0x398f('0x2'));var rp=require('request-promise');var moment=require(_0x398f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x398f('0x4'));var util=require(_0x398f('0x5'));var path=require(_0x398f('0x6'));var sox=require(_0x398f('0x7'));var csv=require('to-csv');var ejs=require(_0x398f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x398f('0x9'));var squel=require(_0x398f('0xa'));var crypto=require(_0x398f('0xb'));var jsforce=require(_0x398f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x398f('0xd'));var querystring=require(_0x398f('0xe'));var Papa=require(_0x398f('0xf'));var Redis=require(_0x398f('0x10'));var authService=require(_0x398f('0x11'));var qs=require(_0x398f('0x12'));var as=require(_0x398f('0x13'));var hardwareService=require(_0x398f('0x14'));var logger=require(_0x398f('0x15'))(_0x398f('0x16'));var utils=require(_0x398f('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x398f('0x18'))['db'];function respondWithStatusCode(_0x146ca1,_0x114f0a){_0x114f0a=_0x114f0a||0xcc;return function(_0xd04d5){if(_0xd04d5){return _0x146ca1['sendStatus'](_0x114f0a);}return _0x146ca1['status'](_0x114f0a)[_0x398f('0x19')]();};}function respondWithResult(_0xba7adc,_0x354a27){_0x354a27=_0x354a27||0xc8;return function(_0x3757aa){if(_0x3757aa){return _0xba7adc[_0x398f('0x1a')](_0x354a27)['json'](_0x3757aa);}};}function respondWithFilteredResult(_0x592f31,_0x3de773){return function(_0x2415ca){if(_0x2415ca){var _0xff5783=typeof _0x3de773[_0x398f('0x1b')]===_0x398f('0x1c')&&typeof _0x3de773[_0x398f('0x1d')]==='undefined';var _0x3b023f=_0x2415ca[_0x398f('0x1e')];var _0x4656bc=_0xff5783?0x0:_0x3de773['offset'];var _0x457365=_0xff5783?_0x2415ca['count']:_0x3de773['offset']+_0x3de773['limit'];var _0x4bf50c;if(_0x457365>=_0x3b023f){_0x457365=_0x3b023f;_0x4bf50c=0xc8;}else{_0x4bf50c=0xce;}_0x592f31[_0x398f('0x1a')](_0x4bf50c);return _0x592f31[_0x398f('0x1f')]('Content-Range',_0x4656bc+'-'+_0x457365+'/'+_0x3b023f)[_0x398f('0x20')](_0x2415ca);}return null;};}function patchUpdates(_0x5493a1){return function(_0xb64ff){try{jsonpatch[_0x398f('0x21')](_0xb64ff,_0x5493a1,!![]);}catch(_0x2769c0){return BPromise['reject'](_0x2769c0);}return _0xb64ff[_0x398f('0x22')]();};}function saveUpdates(_0x45e3d4,_0x59a41c){return function(_0x1e7848){if(_0x1e7848){return _0x1e7848[_0x398f('0x23')](_0x45e3d4)['then'](function(_0x1edaae){return _0x1edaae;});}return null;};}function removeEntity(_0x1ec868,_0x2be535){return function(_0x1ed881){if(_0x1ed881){return _0x1ed881['destroy']()[_0x398f('0x24')](function(){var _0x12675e=_0x1ed881[_0x398f('0x25')]({'plain':!![]});var _0x1482af=_0x398f('0x26');return db[_0x398f('0x27')][_0x398f('0x28')]({'where':{'type':_0x1482af,'resourceId':_0x12675e['id']}})['then'](function(){return _0x1ed881;});})[_0x398f('0x24')](function(){_0x1ec868[_0x398f('0x1a')](0xcc)[_0x398f('0x19')]();});}};}function handleEntityNotFound(_0x236782,_0x4bf143){return function(_0x1f251b){if(!_0x1f251b){_0x236782[_0x398f('0x29')](0x194);}return _0x1f251b;};}function handleError(_0x2bbcb8,_0xa3c1a1){_0xa3c1a1=_0xa3c1a1||0x1f4;return function(_0x5ad454){logger[_0x398f('0x2a')](_0x5ad454['stack']);if(_0x5ad454[_0x398f('0x2b')]){delete _0x5ad454['name'];}_0x2bbcb8[_0x398f('0x1a')](_0xa3c1a1)[_0x398f('0x2c')](_0x5ad454);};}exports[_0x398f('0x2d')]=function(_0x316726,_0x59d74f){var _0x4f76a3={},_0x4c5e26={},_0x12fa03={'count':0x0,'rows':[]};var _0x182773=_[_0x398f('0x2e')](db[_0x398f('0x2f')][_0x398f('0x30')],function(_0x37d3fb){return{'name':_0x37d3fb[_0x398f('0x31')],'type':_0x37d3fb[_0x398f('0x32')]['key']};});_0x4c5e26[_0x398f('0x33')]=_[_0x398f('0x2e')](_0x182773,_0x398f('0x2b'));_0x4c5e26[_0x398f('0x34')]=_[_0x398f('0x35')](_0x316726[_0x398f('0x34')]);_0x4c5e26[_0x398f('0x36')]=_[_0x398f('0x37')](_0x4c5e26['model'],_0x4c5e26[_0x398f('0x34')]);_0x4f76a3[_0x398f('0x38')]=_[_0x398f('0x37')](_0x4c5e26['model'],qs[_0x398f('0x39')](_0x316726[_0x398f('0x34')][_0x398f('0x39')]));_0x4f76a3[_0x398f('0x38')]=_0x4f76a3[_0x398f('0x38')][_0x398f('0x3a')]?_0x4f76a3[_0x398f('0x38')]:_0x4c5e26[_0x398f('0x33')];if(!_0x316726[_0x398f('0x34')]['hasOwnProperty'](_0x398f('0x3b'))){_0x4f76a3[_0x398f('0x1d')]=qs[_0x398f('0x1d')](_0x316726[_0x398f('0x34')][_0x398f('0x1d')]);_0x4f76a3[_0x398f('0x1b')]=qs[_0x398f('0x1b')](_0x316726[_0x398f('0x34')][_0x398f('0x1b')]);}_0x4f76a3[_0x398f('0x3c')]=qs[_0x398f('0x3d')](_0x316726[_0x398f('0x34')][_0x398f('0x3d')]);_0x4f76a3['where']=qs['filters'](_['pick'](_0x316726[_0x398f('0x34')],_0x4c5e26[_0x398f('0x36')]),_0x182773);if(_0x316726[_0x398f('0x34')][_0x398f('0x3e')]){_0x4f76a3[_0x398f('0x3f')]=_[_0x398f('0x40')](_0x4f76a3[_0x398f('0x3f')],{'$or':_[_0x398f('0x2e')](_0x182773,function(_0x180464){if(_0x180464['type']!==_0x398f('0x41')){var _0x5232d2={};_0x5232d2[_0x180464[_0x398f('0x2b')]]={'$like':'%'+_0x316726[_0x398f('0x34')]['filter']+'%'};return _0x5232d2;}})});}_0x4f76a3=_[_0x398f('0x40')]({},_0x4f76a3,_0x316726[_0x398f('0x42')]);var _0x48cfc6={'where':_0x4f76a3['where']};return db['AnalyticExtractedReport'][_0x398f('0x1e')](_0x48cfc6)[_0x398f('0x24')](function(_0x3ee153){_0x12fa03[_0x398f('0x1e')]=_0x3ee153;if(_0x316726['query'][_0x398f('0x43')]){_0x4f76a3[_0x398f('0x44')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x398f('0x45')](_0x4f76a3);})['then'](function(_0x317bb9){_0x12fa03[_0x398f('0x46')]=_0x317bb9;return _0x12fa03;})['then'](respondWithFilteredResult(_0x59d74f,_0x4f76a3))[_0x398f('0x47')](handleError(_0x59d74f,null));};exports[_0x398f('0x48')]=function(_0x5d869f,_0x351530){var _0x49a3b2={'raw':!![],'where':{'id':_0x5d869f[_0x398f('0x49')]['id']}},_0x8d0909={};_0x8d0909[_0x398f('0x33')]=_[_0x398f('0x35')](db[_0x398f('0x2f')][_0x398f('0x30')]);_0x8d0909[_0x398f('0x34')]=_['keys'](_0x5d869f[_0x398f('0x34')]);_0x8d0909['filters']=_[_0x398f('0x37')](_0x8d0909[_0x398f('0x33')],_0x8d0909[_0x398f('0x34')]);_0x49a3b2[_0x398f('0x38')]=_[_0x398f('0x37')](_0x8d0909[_0x398f('0x33')],qs[_0x398f('0x39')](_0x5d869f[_0x398f('0x34')][_0x398f('0x39')]));_0x49a3b2[_0x398f('0x38')]=_0x49a3b2['attributes']['length']?_0x49a3b2['attributes']:_0x8d0909[_0x398f('0x33')];if(_0x5d869f['query'][_0x398f('0x43')]){_0x49a3b2[_0x398f('0x44')]=[{'all':!![]}];}_0x49a3b2=_[_0x398f('0x40')]({},_0x49a3b2,_0x5d869f['options']);return db[_0x398f('0x2f')][_0x398f('0x4a')](_0x49a3b2)[_0x398f('0x24')](handleEntityNotFound(_0x351530,null))[_0x398f('0x24')](respondWithResult(_0x351530,null))[_0x398f('0x47')](handleError(_0x351530,null));};exports[_0x398f('0x4b')]=function(_0x26f4c4,_0x52f9e9){return db[_0x398f('0x2f')][_0x398f('0x4b')](_0x26f4c4[_0x398f('0x4c')],{})['then'](function(_0xdf91da){var _0x4a7393=_0x26f4c4[_0x398f('0x4d')][_0x398f('0x25')]({'plain':!![]});if(!_0x4a7393)throw new Error(_0x398f('0x4e'));if(_0x4a7393[_0x398f('0x4f')]===_0x398f('0x4d')){var _0x4b7e43=_0xdf91da[_0x398f('0x25')]({'plain':!![]});var _0x46a44d=_0x398f('0x26');return db[_0x398f('0x50')]['find']({'where':{'name':_0x46a44d,'userProfileId':_0x4a7393[_0x398f('0x51')]},'raw':!![]})[_0x398f('0x24')](function(_0x144f8a){if(_0x144f8a&&_0x144f8a[_0x398f('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x4b7e43[_0x398f('0x2b')],'resourceId':_0x4b7e43['id'],'type':_0x144f8a[_0x398f('0x2b')],'sectionId':_0x144f8a['id']},{})[_0x398f('0x24')](function(){return _0xdf91da;});}else{return _0xdf91da;}})[_0x398f('0x47')](function(_0x1f10e1){logger['error'](_0x398f('0x53'),_0x1f10e1);throw _0x1f10e1;});}return _0xdf91da;})[_0x398f('0x24')](respondWithResult(_0x52f9e9,0xc9))[_0x398f('0x47')](handleError(_0x52f9e9,null));};exports[_0x398f('0x23')]=function(_0x1bd493,_0x172ea3){if(_0x1bd493[_0x398f('0x4c')]['id']){delete _0x1bd493['body']['id'];}return db['AnalyticExtractedReport'][_0x398f('0x4a')]({'where':{'id':_0x1bd493[_0x398f('0x49')]['id']}})[_0x398f('0x24')](handleEntityNotFound(_0x172ea3,null))[_0x398f('0x24')](saveUpdates(_0x1bd493[_0x398f('0x4c')],null))[_0x398f('0x24')](respondWithResult(_0x172ea3,null))[_0x398f('0x47')](handleError(_0x172ea3,null));};exports[_0x398f('0x28')]=function(_0xcca89f,_0x12801b){return db[_0x398f('0x2f')][_0x398f('0x4a')]({'where':{'id':_0xcca89f[_0x398f('0x49')]['id']}})['then'](handleEntityNotFound(_0x12801b,null))[_0x398f('0x24')](removeEntity(_0x12801b,null))[_0x398f('0x47')](handleError(_0x12801b,null));};exports[_0x398f('0x54')]=function(_0x569505,_0x50e339,_0x25bfc3){return db[_0x398f('0x2f')][_0x398f('0x4a')]({'where':{'id':_0x569505['params']['id']},'attributes':[_0x398f('0x2b'),_0x398f('0x55'),_0x398f('0x56'),_0x398f('0x57')],'raw':!![]})[_0x398f('0x24')](handleEntityNotFound(_0x50e339,null))['then'](function(_0x20aac8){if(_0x20aac8){if(!fs[_0x398f('0x58')](path['join'](config['root'],_0x398f('0x59'),_0x20aac8[_0x398f('0x56')]))){throw new db[(_0x398f('0x5a'))][(_0x398f('0x5b'))](_0x398f('0x5c'));}if(_0x569505[_0x398f('0x34')][_0x398f('0x5d')]){return _0x50e339[_0x398f('0x29')](0xc8);}return _0x50e339['download'](path[_0x398f('0x5e')](config[_0x398f('0x5f')],_0x398f('0x59'),_0x20aac8[_0x398f('0x56')]),util[_0x398f('0x60')](_0x398f('0x61'),_0x20aac8[_0x398f('0x55')]||_0x20aac8[_0x398f('0x2b')],_0x20aac8['output']['toLowerCase']()));}})[_0x398f('0x47')](handleError(_0x50e339,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index cc20943..0c9bdcd 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 _0x4b67=['lodash','util','api','bluebird','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports'];(function(_0x480433,_0x5dbba1){var _0x2ae111=function(_0x357dfd){while(--_0x357dfd){_0x480433['push'](_0x480433['shift']());}};_0x2ae111(++_0x5dbba1);}(_0x4b67,0x1a4));var _0x74b6=function(_0x17ab89,_0x4aaf5f){_0x17ab89=_0x17ab89-0x0;var _0x333bb9=_0x4b67[_0x17ab89];return _0x333bb9;};'use strict';var _=require(_0x74b6('0x0'));var util=require(_0x74b6('0x1'));var logger=require('../../config/logger')(_0x74b6('0x2'));var moment=require('moment');var BPromise=require(_0x74b6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74b6('0x4'));var rimraf=require('rimraf');var config=require(_0x74b6('0x5'));var attributes=require(_0x74b6('0x6'));module[_0x74b6('0x7')]=function(_0x1cc00a,_0x4b2442){return _0x1cc00a[_0x74b6('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x74b6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x353e=['../../config/environment','define','AnalyticExtractedReport','lodash','util','../../config/logger','moment','rimraf'];(function(_0xc43980,_0x11ba0f){var _0x22bb21=function(_0x10a337){while(--_0x10a337){_0xc43980['push'](_0xc43980['shift']());}};_0x22bb21(++_0x11ba0f);}(_0x353e,0x1cb));var _0xe353=function(_0x42e152,_0x2ea287){_0x42e152=_0x42e152-0x0;var _0x2609bc=_0x353e[_0x42e152];return _0x2609bc;};'use strict';var _=require(_0xe353('0x0'));var util=require(_0xe353('0x1'));var logger=require(_0xe353('0x2'))('api');var moment=require(_0xe353('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe353('0x4'));var config=require(_0xe353('0x5'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x415e37,_0x32d645){return _0x415e37[_0xe353('0x6')](_0xe353('0x7'),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 08dac6f..fa10671 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 _0x792f=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x29e1ad,_0x569e63){var _0xe60afd=function(_0x2b6a50){while(--_0x2b6a50){_0x29e1ad['push'](_0x29e1ad['shift']());}};_0xe60afd(++_0x569e63);}(_0x792f,0x10e));var _0xf792=function(_0x4a599b,_0x1d2125){_0x4a599b=_0x4a599b-0x0;var _0x2d53d3=_0x792f[_0x4a599b];return _0x2d53d3;};'use strict';var _=require('lodash');var util=require(_0xf792('0x0'));var moment=require(_0xf792('0x1'));var BPromise=require(_0xf792('0x2'));var rs=require(_0xf792('0x3'));var fs=require('fs');var Redis=require(_0xf792('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf792('0x5'));var logger=require(_0xf792('0x6'))(_0xf792('0x7'));var config=require('../../config/environment');var jayson=require(_0xf792('0x8'));var client=jayson[_0xf792('0x9')][_0xf792('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f7cdc,_0x35634c,_0x48f50a){return new BPromise(function(_0xc9a946,_0x25e810){return client[_0xf792('0xb')](_0x3f7cdc,_0x48f50a)[_0xf792('0xc')](function(_0x47603e){logger[_0xf792('0xd')](_0xf792('0xe'),_0x35634c,_0xf792('0xf'));logger[_0xf792('0x10')](_0xf792('0x11'),_0x35634c,_0xf792('0xf'),JSON['stringify'](_0x47603e));if(_0x47603e['error']){if(_0x47603e[_0xf792('0x12')][_0xf792('0x13')]===0x1f4){logger[_0xf792('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x35634c,_0x47603e[_0xf792('0x12')][_0xf792('0x14')]);return _0x25e810(_0x47603e[_0xf792('0x12')][_0xf792('0x14')]);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x35634c,_0x47603e['error']['message']);return _0xc9a946(_0x47603e[_0xf792('0x12')][_0xf792('0x14')]);}else{logger[_0xf792('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x35634c,_0xf792('0xf'));_0xc9a946(_0x47603e[_0xf792('0x15')][_0xf792('0x14')]);}})[_0xf792('0x16')](function(_0x2e8811){logger[_0xf792('0x12')](_0xf792('0xe'),_0x35634c,_0x2e8811);_0x25e810(_0x2e8811);});});} \ No newline at end of file +var _0xf117=['code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xf117,0x122));var _0x7f11=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xf117[_0x29d94e];return _0x106237;};'use strict';var _=require('lodash');var util=require(_0x7f11('0x0'));var moment=require(_0x7f11('0x1'));var BPromise=require(_0x7f11('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7f11('0x3'))['db'];var utils=require(_0x7f11('0x4'));var logger=require(_0x7f11('0x5'))(_0x7f11('0x6'));var config=require(_0x7f11('0x7'));var jayson=require(_0x7f11('0x8'));var client=jayson[_0x7f11('0x9')][_0x7f11('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x403fc2,_0x736b91,_0x19b223){return new BPromise(function(_0x432802,_0x4f98c1){return client['request'](_0x403fc2,_0x19b223)[_0x7f11('0xb')](function(_0x44c8e3){logger[_0x7f11('0xc')](_0x7f11('0xd'),_0x736b91,_0x7f11('0xe'));logger[_0x7f11('0xf')](_0x7f11('0x10'),_0x736b91,_0x7f11('0xe'),JSON['stringify'](_0x44c8e3));if(_0x44c8e3[_0x7f11('0x11')]){if(_0x44c8e3[_0x7f11('0x11')][_0x7f11('0x12')]===0x1f4){logger[_0x7f11('0x11')](_0x7f11('0xd'),_0x736b91,_0x44c8e3[_0x7f11('0x11')][_0x7f11('0x13')]);return _0x4f98c1(_0x44c8e3[_0x7f11('0x11')]['message']);}logger['error'](_0x7f11('0xd'),_0x736b91,_0x44c8e3[_0x7f11('0x11')]['message']);return _0x432802(_0x44c8e3['error'][_0x7f11('0x13')]);}else{logger[_0x7f11('0xc')](_0x7f11('0xd'),_0x736b91,_0x7f11('0xe'));_0x432802(_0x44c8e3[_0x7f11('0x14')][_0x7f11('0x13')]);}})[_0x7f11('0x15')](function(_0x328e2b){logger[_0x7f11('0x11')](_0x7f11('0xd'),_0x736b91,_0x328e2b);_0x4f98c1(_0x328e2b);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 65ce6ea..29f901f 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 _0x43b0=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','/:id/download','download','post','delete'];(function(_0x35b1f5,_0x5205cb){var _0xaa3672=function(_0x4c410b){while(--_0x4c410b){_0x35b1f5['push'](_0x35b1f5['shift']());}};_0xaa3672(++_0x5205cb);}(_0x43b0,0x1f1));var _0x043b=function(_0x5cbd00,_0x94392f){_0x5cbd00=_0x5cbd00-0x0;var _0x4dd707=_0x43b0[_0x5cbd00];return _0x4dd707;};'use strict';var multer=require(_0x043b('0x0'));var util=require(_0x043b('0x1'));var path=require(_0x043b('0x2'));var timeout=require('connect-timeout');var express=require(_0x043b('0x3'));var router=express[_0x043b('0x4')]();var fs_extra=require(_0x043b('0x5'));var auth=require(_0x043b('0x6'));var interaction=require(_0x043b('0x7'));var config=require('../../config/environment');var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x043b('0x8')](),controller['index']);router[_0x043b('0x9')](_0x043b('0xa'),auth[_0x043b('0x8')](),controller['show']);router['get'](_0x043b('0xb'),auth[_0x043b('0x8')](),controller[_0x043b('0xc')]);router[_0x043b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x043b('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x043b('0xe')](_0x043b('0xa'),auth[_0x043b('0x8')](),controller['destroy']);module[_0x043b('0xf')]=router; \ No newline at end of file +var _0x805c=['./analyticExtractedReport.controller','index','get','/:id','isAuthenticated','/:id/download','download','put','update','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0x805c,0x6b));var _0xc805=function(_0x3b80a3,_0x3611cd){_0x3b80a3=_0x3b80a3-0x0;var _0x85491b=_0x805c[_0x3b80a3];return _0x85491b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc805('0x0'));var timeout=require(_0xc805('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc805('0x2'));var interaction=require(_0xc805('0x3'));var config=require(_0xc805('0x4'));var controller=require(_0xc805('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xc805('0x6')]);router[_0xc805('0x7')](_0xc805('0x8'),auth[_0xc805('0x9')](),controller['show']);router[_0xc805('0x7')](_0xc805('0xa'),auth[_0xc805('0x9')](),controller[_0xc805('0xb')]);router['post']('/',auth[_0xc805('0x9')](),controller['create']);router[_0xc805('0xc')]('/:id',auth[_0xc805('0x9')](),controller[_0xc805('0xd')]);router['delete'](_0xc805('0x8'),auth['isAuthenticated'](),controller[_0xc805('0xe')]);module[_0xc805('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 6eb6151..bca549e 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 _0x36e9=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x257642,_0x270a80){var _0x3d813b=function(_0x2a1c8a){while(--_0x2a1c8a){_0x257642['push'](_0x257642['shift']());}};_0x3d813b(++_0x270a80);}(_0x36e9,0x15b));var _0x936e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x36e9[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x936e('0x0'));module['exports']={'field':{'type':Sequelize[_0x936e('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x936e('0x2')]},'format':{'type':Sequelize[_0x936e('0x2')]},'groupBy':{'type':Sequelize[_0x936e('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x936e('0x2')]},'custom':{'type':Sequelize[_0x936e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3895=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x295caa,_0x1eb8a6){var _0x1f6de3=function(_0x34f4be){while(--_0x34f4be){_0x295caa['push'](_0x295caa['shift']());}};_0x1f6de3(++_0x1eb8a6);}(_0x3895,0x14a));var _0x5389=function(_0x113c41,_0x3666f0){_0x113c41=_0x113c41-0x0;var _0x3d7d33=_0x3895[_0x113c41];return _0x3d7d33;};'use strict';var Sequelize=require(_0x5389('0x0'));module[_0x5389('0x1')]={'field':{'type':Sequelize[_0x5389('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x5389('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x5389('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x5389('0x3')]},'custom':{'type':Sequelize[_0x5389('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 53f08cf..fa5004d 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 _0x978a=['lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','error','stack','name','index','map','AnalyticFieldReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','bulkCreate','destroy','bulkDestroy','addFields','AnalyticCustomReport','findOne','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs'];(function(_0x3cc31a,_0x4bbb08){var _0xe50e0c=function(_0x319830){while(--_0x319830){_0x3cc31a['push'](_0x3cc31a['shift']());}};_0xe50e0c(++_0x4bbb08);}(_0x978a,0x190));var _0xa978=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x978a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa978('0x0'));var zipdir=require(_0xa978('0x1'));var jsonpatch=require(_0xa978('0x2'));var rp=require(_0xa978('0x3'));var moment=require(_0xa978('0x4'));var BPromise=require(_0xa978('0x5'));var Mustache=require(_0xa978('0x6'));var util=require(_0xa978('0x7'));var path=require(_0xa978('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa978('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa978('0xa'));var squel=require(_0xa978('0xb'));var crypto=require('crypto');var jsforce=require(_0xa978('0xc'));var deskjs=require(_0xa978('0xd'));var toCsv=require(_0xa978('0xe'));var querystring=require(_0xa978('0xf'));var Papa=require(_0xa978('0x10'));var Redis=require(_0xa978('0x11'));var authService=require(_0xa978('0x12'));var qs=require(_0xa978('0x13'));var as=require(_0xa978('0x14'));var hardwareService=require(_0xa978('0x15'));var logger=require(_0xa978('0x16'))(_0xa978('0x17'));var utils=require('../../config/utils');var config=require(_0xa978('0x18'));var licenseUtil=require(_0xa978('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422715,_0x2e6dc4){_0x2e6dc4=_0x2e6dc4||0xcc;return function(_0x37377a){if(_0x37377a){return _0x422715[_0xa978('0x1a')](_0x2e6dc4);}return _0x422715[_0xa978('0x1b')](_0x2e6dc4)['end']();};}function respondWithResult(_0x345e57,_0x2db5f2){_0x2db5f2=_0x2db5f2||0xc8;return function(_0x154655){if(_0x154655){return _0x345e57[_0xa978('0x1b')](_0x2db5f2)[_0xa978('0x1c')](_0x154655);}};}function respondWithFilteredResult(_0x2eae1b,_0x3b2e61){return function(_0x3c1856){if(_0x3c1856){var _0x162098=typeof _0x3b2e61[_0xa978('0x1d')]===_0xa978('0x1e')&&typeof _0x3b2e61[_0xa978('0x1f')]===_0xa978('0x1e');var _0x1600e0=_0x3c1856[_0xa978('0x20')];var _0x1a6448=_0x162098?0x0:_0x3b2e61[_0xa978('0x1d')];var _0x10a235=_0x162098?_0x3c1856[_0xa978('0x20')]:_0x3b2e61[_0xa978('0x1d')]+_0x3b2e61['limit'];var _0x239477;if(_0x10a235>=_0x1600e0){_0x10a235=_0x1600e0;_0x239477=0xc8;}else{_0x239477=0xce;}_0x2eae1b[_0xa978('0x1b')](_0x239477);return _0x2eae1b[_0xa978('0x21')](_0xa978('0x22'),_0x1a6448+'-'+_0x10a235+'/'+_0x1600e0)['json'](_0x3c1856);}return null;};}function patchUpdates(_0x2c64ab){return function(_0x24c712){try{jsonpatch['apply'](_0x24c712,_0x2c64ab,!![]);}catch(_0x5e882c){return BPromise[_0xa978('0x23')](_0x5e882c);}return _0x24c712[_0xa978('0x24')]();};}function saveUpdates(_0x1f2dbb,_0x925572){return function(_0x466462){if(_0x466462){return _0x466462['update'](_0x1f2dbb)[_0xa978('0x25')](function(_0xba3c79){return _0xba3c79;});}return null;};}function removeEntity(_0x123c23,_0x9073c4){return function(_0x564546){if(_0x564546){return _0x564546['destroy']()[_0xa978('0x25')](function(){_0x123c23[_0xa978('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2905c7,_0x3d49d0){return function(_0x43613e){if(!_0x43613e){_0x2905c7['sendStatus'](0x194);}return _0x43613e;};}function handleError(_0x3c9f92,_0x1dd266){_0x1dd266=_0x1dd266||0x1f4;return function(_0xdba941){logger[_0xa978('0x26')](_0xdba941[_0xa978('0x27')]);if(_0xdba941[_0xa978('0x28')]){delete _0xdba941[_0xa978('0x28')];}_0x3c9f92['status'](_0x1dd266)['send'](_0xdba941);};}exports[_0xa978('0x29')]=function(_0x13f891,_0x4b584b){var _0x32e38a={},_0x5b803d={},_0x525739={'count':0x0,'rows':[]};var _0x1154ae=_[_0xa978('0x2a')](db[_0xa978('0x2b')]['rawAttributes'],function(_0x403c5c){return{'name':_0x403c5c[_0xa978('0x2c')],'type':_0x403c5c['type'][_0xa978('0x2d')]};});_0x5b803d[_0xa978('0x2e')]=_[_0xa978('0x2a')](_0x1154ae,'name');_0x5b803d[_0xa978('0x2f')]=_[_0xa978('0x30')](_0x13f891[_0xa978('0x2f')]);_0x5b803d[_0xa978('0x31')]=_[_0xa978('0x32')](_0x5b803d['model'],_0x5b803d[_0xa978('0x2f')]);_0x32e38a[_0xa978('0x33')]=_[_0xa978('0x32')](_0x5b803d['model'],qs[_0xa978('0x34')](_0x13f891['query'][_0xa978('0x34')]));_0x32e38a[_0xa978('0x33')]=_0x32e38a[_0xa978('0x33')][_0xa978('0x35')]?_0x32e38a[_0xa978('0x33')]:_0x5b803d[_0xa978('0x2e')];if(!_0x13f891['query'][_0xa978('0x36')]('nolimit')){_0x32e38a[_0xa978('0x1f')]=qs[_0xa978('0x1f')](_0x13f891[_0xa978('0x2f')][_0xa978('0x1f')]);_0x32e38a[_0xa978('0x1d')]=qs['offset'](_0x13f891[_0xa978('0x2f')][_0xa978('0x1d')]);}_0x32e38a[_0xa978('0x37')]=qs['sort'](_0x13f891[_0xa978('0x2f')][_0xa978('0x38')]);_0x32e38a['where']=qs['filters'](_[_0xa978('0x39')](_0x13f891[_0xa978('0x2f')],_0x5b803d[_0xa978('0x31')]),_0x1154ae);if(_0x13f891[_0xa978('0x2f')][_0xa978('0x3a')]){_0x32e38a[_0xa978('0x3b')]=_[_0xa978('0x3c')](_0x32e38a[_0xa978('0x3b')],{'$or':_[_0xa978('0x2a')](_0x1154ae,function(_0x45027b){if(_0x45027b[_0xa978('0x3d')]!==_0xa978('0x3e')){var _0x160e91={};_0x160e91[_0x45027b['name']]={'$like':'%'+_0x13f891[_0xa978('0x2f')][_0xa978('0x3a')]+'%'};return _0x160e91;}})});}_0x32e38a=_['merge']({},_0x32e38a,_0x13f891[_0xa978('0x3f')]);var _0x4d7df0={'where':_0x32e38a[_0xa978('0x3b')]};return db[_0xa978('0x2b')][_0xa978('0x20')](_0x4d7df0)[_0xa978('0x25')](function(_0x3b41ff){_0x525739[_0xa978('0x20')]=_0x3b41ff;if(_0x13f891[_0xa978('0x2f')][_0xa978('0x40')]){_0x32e38a[_0xa978('0x41')]=[{'all':!![]}];}return db[_0xa978('0x2b')][_0xa978('0x42')](_0x32e38a);})['then'](function(_0x17c872){_0x525739[_0xa978('0x43')]=_0x17c872;return _0x525739;})['then'](respondWithFilteredResult(_0x4b584b,_0x32e38a))[_0xa978('0x44')](handleError(_0x4b584b,null));};exports[_0xa978('0x45')]=function(_0x4b20d1,_0x4a0b15){var _0x1a3ee2={'raw':![],'where':{'id':_0x4b20d1[_0xa978('0x46')]['id']}},_0x3ba5ea={};_0x3ba5ea[_0xa978('0x2e')]=_[_0xa978('0x30')](db[_0xa978('0x2b')][_0xa978('0x47')]);_0x3ba5ea[_0xa978('0x2f')]=_[_0xa978('0x30')](_0x4b20d1[_0xa978('0x2f')]);_0x3ba5ea[_0xa978('0x31')]=_[_0xa978('0x32')](_0x3ba5ea[_0xa978('0x2e')],_0x3ba5ea[_0xa978('0x2f')]);_0x1a3ee2[_0xa978('0x33')]=_[_0xa978('0x32')](_0x3ba5ea['model'],qs['fields'](_0x4b20d1[_0xa978('0x2f')][_0xa978('0x34')]));_0x1a3ee2['attributes']=_0x1a3ee2[_0xa978('0x33')][_0xa978('0x35')]?_0x1a3ee2['attributes']:_0x3ba5ea['model'];if(_0x4b20d1[_0xa978('0x2f')]['includeAll']){_0x1a3ee2[_0xa978('0x41')]=[{'all':!![]}];}_0x1a3ee2=_[_0xa978('0x3c')]({},_0x1a3ee2,_0x4b20d1[_0xa978('0x3f')]);return db[_0xa978('0x2b')][_0xa978('0x48')](_0x1a3ee2)['then'](handleEntityNotFound(_0x4a0b15,null))['then'](respondWithResult(_0x4a0b15,null))['catch'](handleError(_0x4a0b15,null));};exports[_0xa978('0x49')]=function(_0x5db3cd,_0x1846e4){return db[_0xa978('0x2b')][_0xa978('0x49')](_0x5db3cd[_0xa978('0x4a')],{})[_0xa978('0x25')](respondWithResult(_0x1846e4,0xc9))[_0xa978('0x44')](handleError(_0x1846e4,null));};exports[_0xa978('0x4b')]=function(_0x5da8ae,_0x34042d){return db[_0xa978('0x2b')][_0xa978('0x4b')](_0x5da8ae['body'],{'raw':![],'individualHooks':!![]})[_0xa978('0x25')](respondWithResult(_0x34042d,0xc9))[_0xa978('0x44')](handleError(_0x34042d,null));};exports['update']=function(_0x32828b,_0x56b306){if(_0x32828b[_0xa978('0x4a')]['id']){delete _0x32828b['body']['id'];}return db['AnalyticFieldReport'][_0xa978('0x48')]({'where':{'id':_0x32828b[_0xa978('0x46')]['id']}})[_0xa978('0x25')](handleEntityNotFound(_0x56b306,null))[_0xa978('0x25')](saveUpdates(_0x32828b[_0xa978('0x4a')],null))[_0xa978('0x25')](respondWithResult(_0x56b306,null))['catch'](handleError(_0x56b306,null));};exports[_0xa978('0x4c')]=function(_0x4539ef,_0x3ce330){return db['AnalyticFieldReport'][_0xa978('0x48')]({'where':{'id':_0x4539ef[_0xa978('0x46')]['id']}})[_0xa978('0x25')](handleEntityNotFound(_0x3ce330,null))[_0xa978('0x25')](removeEntity(_0x3ce330,null))[_0xa978('0x44')](handleError(_0x3ce330,null));};exports[_0xa978('0x4d')]=function(_0x491c4e,_0x3e1a30){return db[_0xa978('0x2b')][_0xa978('0x4c')]({'where':{'id':_0x491c4e['query']['ids']||[]},'raw':![],'individualHooks':!![]})[_0xa978('0x25')](respondWithResult(_0x3e1a30,0xcc))[_0xa978('0x44')](handleError(_0x3e1a30,null));};exports[_0xa978('0x4e')]=function(_0x4da522,_0x39b1d9,_0xaacb4c){return db[_0xa978('0x4f')][_0xa978('0x50')]({'where':{'id':_0x4da522[_0xa978('0x46')]['id']}})[_0xa978('0x25')](handleEntityNotFound(_0x39b1d9,null))['then'](function(_0x4d6552){if(_0x4d6552){return db['sequelize']['transaction'](function(_0xf425ef){return db[_0xa978('0x2b')]['destroy']({'where':{'CustomReportId':_0x4da522[_0xa978('0x46')]['id']},'transaction':_0xf425ef})[_0xa978('0x25')](function(_0xb8f552){var _0x5e0367=_[_0xa978('0x2a')](_0x4da522[_0xa978('0x4a')],function(_0x5e60ba){delete _0x5e60ba['id'];_0x5e60ba[_0xa978('0x51')]=_0x4da522[_0xa978('0x46')]['id'];return _0x5e60ba;});return db[_0xa978('0x2b')]['bulkCreate'](_0x5e0367,{'transaction':_0xf425ef});});})[_0xa978('0x25')](function(){return db[_0xa978('0x2b')][_0xa978('0x42')]({'where':{'CustomReportId':_0x4da522[_0xa978('0x46')]['id']}});});}})[_0xa978('0x25')](respondWithResult(_0x39b1d9,null))[_0xa978('0x44')](handleError(_0x39b1d9,null));}; \ No newline at end of file +var _0x6447=['create','body','catch','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','findAll','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','update','then','destroy','name','send','index','map','AnalyticFieldReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x6447,0x14e));var _0x7644=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x6447[_0x1a0daa];return _0x1dbe15;};'use strict';var emlformat=require(_0x7644('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7644('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7644('0x2'));var moment=require(_0x7644('0x3'));var BPromise=require(_0x7644('0x4'));var Mustache=require(_0x7644('0x5'));var util=require(_0x7644('0x6'));var path=require('path');var sox=require(_0x7644('0x7'));var csv=require(_0x7644('0x8'));var ejs=require(_0x7644('0x9'));var fs=require('fs');var fs_extra=require(_0x7644('0xa'));var _=require('lodash');var squel=require(_0x7644('0xb'));var crypto=require(_0x7644('0xc'));var jsforce=require(_0x7644('0xd'));var deskjs=require(_0x7644('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7644('0xf'));var Papa=require(_0x7644('0x10'));var Redis=require(_0x7644('0x11'));var authService=require(_0x7644('0x12'));var qs=require(_0x7644('0x13'));var as=require(_0x7644('0x14'));var hardwareService=require(_0x7644('0x15'));var logger=require(_0x7644('0x16'))(_0x7644('0x17'));var utils=require(_0x7644('0x18'));var config=require(_0x7644('0x19'));var licenseUtil=require(_0x7644('0x1a'));var db=require(_0x7644('0x1b'))['db'];function respondWithStatusCode(_0x2ff6a9,_0x25cd1b){_0x25cd1b=_0x25cd1b||0xcc;return function(_0x14c908){if(_0x14c908){return _0x2ff6a9[_0x7644('0x1c')](_0x25cd1b);}return _0x2ff6a9[_0x7644('0x1d')](_0x25cd1b)[_0x7644('0x1e')]();};}function respondWithResult(_0x4a937a,_0x14966f){_0x14966f=_0x14966f||0xc8;return function(_0x5077de){if(_0x5077de){return _0x4a937a[_0x7644('0x1d')](_0x14966f)[_0x7644('0x1f')](_0x5077de);}};}function respondWithFilteredResult(_0x20259e,_0x5709f2){return function(_0x16a11f){if(_0x16a11f){var _0x44130f=typeof _0x5709f2[_0x7644('0x20')]===_0x7644('0x21')&&typeof _0x5709f2['limit']===_0x7644('0x21');var _0x516995=_0x16a11f[_0x7644('0x22')];var _0x28c8cb=_0x44130f?0x0:_0x5709f2[_0x7644('0x20')];var _0x44e58=_0x44130f?_0x16a11f[_0x7644('0x22')]:_0x5709f2[_0x7644('0x20')]+_0x5709f2[_0x7644('0x23')];var _0x150954;if(_0x44e58>=_0x516995){_0x44e58=_0x516995;_0x150954=0xc8;}else{_0x150954=0xce;}_0x20259e[_0x7644('0x1d')](_0x150954);return _0x20259e[_0x7644('0x24')]('Content-Range',_0x28c8cb+'-'+_0x44e58+'/'+_0x516995)['json'](_0x16a11f);}return null;};}function patchUpdates(_0x5c8004){return function(_0x32f988){try{jsonpatch['apply'](_0x32f988,_0x5c8004,!![]);}catch(_0x2e3a52){return BPromise[_0x7644('0x25')](_0x2e3a52);}return _0x32f988['save']();};}function saveUpdates(_0x39b113,_0x9a61a0){return function(_0x1968f8){if(_0x1968f8){return _0x1968f8[_0x7644('0x26')](_0x39b113)[_0x7644('0x27')](function(_0x231d41){return _0x231d41;});}return null;};}function removeEntity(_0x1cfe25,_0x3cfb4e){return function(_0x8a12ac){if(_0x8a12ac){return _0x8a12ac[_0x7644('0x28')]()[_0x7644('0x27')](function(){_0x1cfe25[_0x7644('0x1d')](0xcc)[_0x7644('0x1e')]();});}};}function handleEntityNotFound(_0x5b33cd,_0x4ea7f5){return function(_0x467672){if(!_0x467672){_0x5b33cd['sendStatus'](0x194);}return _0x467672;};}function handleError(_0x1f209c,_0x44dded){_0x44dded=_0x44dded||0x1f4;return function(_0x4e546e){logger['error'](_0x4e546e['stack']);if(_0x4e546e[_0x7644('0x29')]){delete _0x4e546e[_0x7644('0x29')];}_0x1f209c[_0x7644('0x1d')](_0x44dded)[_0x7644('0x2a')](_0x4e546e);};}exports[_0x7644('0x2b')]=function(_0x33489d,_0x3cff86){var _0x3df4b9={},_0x3f8e8d={},_0x215c54={'count':0x0,'rows':[]};var _0x4a0f2=_[_0x7644('0x2c')](db[_0x7644('0x2d')]['rawAttributes'],function(_0x1531b1){return{'name':_0x1531b1[_0x7644('0x2e')],'type':_0x1531b1[_0x7644('0x2f')][_0x7644('0x30')]};});_0x3f8e8d[_0x7644('0x31')]=_['map'](_0x4a0f2,'name');_0x3f8e8d[_0x7644('0x32')]=_[_0x7644('0x33')](_0x33489d['query']);_0x3f8e8d['filters']=_[_0x7644('0x34')](_0x3f8e8d[_0x7644('0x31')],_0x3f8e8d[_0x7644('0x32')]);_0x3df4b9[_0x7644('0x35')]=_[_0x7644('0x34')](_0x3f8e8d[_0x7644('0x31')],qs[_0x7644('0x36')](_0x33489d[_0x7644('0x32')][_0x7644('0x36')]));_0x3df4b9['attributes']=_0x3df4b9['attributes'][_0x7644('0x37')]?_0x3df4b9[_0x7644('0x35')]:_0x3f8e8d[_0x7644('0x31')];if(!_0x33489d[_0x7644('0x32')][_0x7644('0x38')](_0x7644('0x39'))){_0x3df4b9['limit']=qs[_0x7644('0x23')](_0x33489d[_0x7644('0x32')][_0x7644('0x23')]);_0x3df4b9[_0x7644('0x20')]=qs[_0x7644('0x20')](_0x33489d['query'][_0x7644('0x20')]);}_0x3df4b9['order']=qs[_0x7644('0x3a')](_0x33489d['query'][_0x7644('0x3a')]);_0x3df4b9[_0x7644('0x3b')]=qs['filters'](_['pick'](_0x33489d[_0x7644('0x32')],_0x3f8e8d[_0x7644('0x3c')]),_0x4a0f2);if(_0x33489d[_0x7644('0x32')][_0x7644('0x3d')]){_0x3df4b9['where']=_[_0x7644('0x3e')](_0x3df4b9[_0x7644('0x3b')],{'$or':_['map'](_0x4a0f2,function(_0x14fe16){if(_0x14fe16['type']!==_0x7644('0x3f')){var _0x7aa60c={};_0x7aa60c[_0x14fe16[_0x7644('0x29')]]={'$like':'%'+_0x33489d[_0x7644('0x32')][_0x7644('0x3d')]+'%'};return _0x7aa60c;}})});}_0x3df4b9=_[_0x7644('0x3e')]({},_0x3df4b9,_0x33489d[_0x7644('0x40')]);var _0x5cae0d={'where':_0x3df4b9[_0x7644('0x3b')]};return db['AnalyticFieldReport'][_0x7644('0x22')](_0x5cae0d)['then'](function(_0x5caef5){_0x215c54[_0x7644('0x22')]=_0x5caef5;if(_0x33489d[_0x7644('0x32')][_0x7644('0x41')]){_0x3df4b9[_0x7644('0x42')]=[{'all':!![]}];}return db[_0x7644('0x2d')]['findAll'](_0x3df4b9);})[_0x7644('0x27')](function(_0x2feafe){_0x215c54[_0x7644('0x43')]=_0x2feafe;return _0x215c54;})[_0x7644('0x27')](respondWithFilteredResult(_0x3cff86,_0x3df4b9))['catch'](handleError(_0x3cff86,null));};exports[_0x7644('0x44')]=function(_0x514f24,_0x2c82e9){var _0x3a18e0={'raw':![],'where':{'id':_0x514f24[_0x7644('0x45')]['id']}},_0x1f4e12={};_0x1f4e12[_0x7644('0x31')]=_[_0x7644('0x33')](db[_0x7644('0x2d')]['rawAttributes']);_0x1f4e12[_0x7644('0x32')]=_[_0x7644('0x33')](_0x514f24[_0x7644('0x32')]);_0x1f4e12[_0x7644('0x3c')]=_[_0x7644('0x34')](_0x1f4e12[_0x7644('0x31')],_0x1f4e12[_0x7644('0x32')]);_0x3a18e0[_0x7644('0x35')]=_[_0x7644('0x34')](_0x1f4e12[_0x7644('0x31')],qs[_0x7644('0x36')](_0x514f24[_0x7644('0x32')]['fields']));_0x3a18e0['attributes']=_0x3a18e0[_0x7644('0x35')][_0x7644('0x37')]?_0x3a18e0[_0x7644('0x35')]:_0x1f4e12[_0x7644('0x31')];if(_0x514f24[_0x7644('0x32')]['includeAll']){_0x3a18e0['include']=[{'all':!![]}];}_0x3a18e0=_[_0x7644('0x3e')]({},_0x3a18e0,_0x514f24['options']);return db[_0x7644('0x2d')][_0x7644('0x46')](_0x3a18e0)[_0x7644('0x27')](handleEntityNotFound(_0x2c82e9,null))['then'](respondWithResult(_0x2c82e9,null))['catch'](handleError(_0x2c82e9,null));};exports[_0x7644('0x47')]=function(_0x1ae4f7,_0x7d89c7){return db[_0x7644('0x2d')][_0x7644('0x47')](_0x1ae4f7[_0x7644('0x48')],{})['then'](respondWithResult(_0x7d89c7,0xc9))[_0x7644('0x49')](handleError(_0x7d89c7,null));};exports[_0x7644('0x4a')]=function(_0x47bbe4,_0x3f2515){return db[_0x7644('0x2d')]['bulkCreate'](_0x47bbe4[_0x7644('0x48')],{'raw':![],'individualHooks':!![]})[_0x7644('0x27')](respondWithResult(_0x3f2515,0xc9))[_0x7644('0x49')](handleError(_0x3f2515,null));};exports['update']=function(_0x7b2189,_0x1d878d){if(_0x7b2189[_0x7644('0x48')]['id']){delete _0x7b2189['body']['id'];}return db[_0x7644('0x2d')][_0x7644('0x46')]({'where':{'id':_0x7b2189['params']['id']}})[_0x7644('0x27')](handleEntityNotFound(_0x1d878d,null))[_0x7644('0x27')](saveUpdates(_0x7b2189[_0x7644('0x48')],null))['then'](respondWithResult(_0x1d878d,null))[_0x7644('0x49')](handleError(_0x1d878d,null));};exports[_0x7644('0x28')]=function(_0x5213cb,_0x812e36){return db[_0x7644('0x2d')][_0x7644('0x46')]({'where':{'id':_0x5213cb[_0x7644('0x45')]['id']}})[_0x7644('0x27')](handleEntityNotFound(_0x812e36,null))['then'](removeEntity(_0x812e36,null))[_0x7644('0x49')](handleError(_0x812e36,null));};exports['bulkDestroy']=function(_0x9ad28b,_0xb4c340){return db[_0x7644('0x2d')][_0x7644('0x28')]({'where':{'id':_0x9ad28b[_0x7644('0x32')][_0x7644('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x7644('0x27')](respondWithResult(_0xb4c340,0xcc))[_0x7644('0x49')](handleError(_0xb4c340,null));};exports[_0x7644('0x4c')]=function(_0x1f598f,_0x52426c,_0x3e0d9a){return db[_0x7644('0x4d')][_0x7644('0x4e')]({'where':{'id':_0x1f598f[_0x7644('0x45')]['id']}})['then'](handleEntityNotFound(_0x52426c,null))[_0x7644('0x27')](function(_0x10fdd4){if(_0x10fdd4){return db['sequelize']['transaction'](function(_0x1f7591){return db['AnalyticFieldReport'][_0x7644('0x28')]({'where':{'CustomReportId':_0x1f598f[_0x7644('0x45')]['id']},'transaction':_0x1f7591})[_0x7644('0x27')](function(_0x4f8e75){var _0x408d34=_['map'](_0x1f598f[_0x7644('0x48')],function(_0x300a51){delete _0x300a51['id'];_0x300a51[_0x7644('0x4f')]=_0x1f598f['params']['id'];return _0x300a51;});return db['AnalyticFieldReport'][_0x7644('0x4a')](_0x408d34,{'transaction':_0x1f7591});});})[_0x7644('0x27')](function(){return db[_0x7644('0x2d')][_0x7644('0x50')]({'where':{'CustomReportId':_0x1f598f[_0x7644('0x45')]['id']}});});}})['then'](respondWithResult(_0x52426c,null))['catch'](handleError(_0x52426c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f0a107c..9da1392 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 _0x893b=['rimraf','../../config/environment','./analyticFieldReport.attributes','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x177f2a,_0x2f3e55){var _0x39086a=function(_0x5b7cf6){while(--_0x5b7cf6){_0x177f2a['push'](_0x177f2a['shift']());}};_0x39086a(++_0x2f3e55);}(_0x893b,0x185));var _0xb893=function(_0x1dcb68,_0x238c44){_0x1dcb68=_0x1dcb68-0x0;var _0x2ca316=_0x893b[_0x1dcb68];return _0x2ca316;};'use strict';var _=require(_0xb893('0x0'));var util=require(_0xb893('0x1'));var logger=require(_0xb893('0x2'))(_0xb893('0x3'));var moment=require('moment');var BPromise=require(_0xb893('0x4'));var rp=require(_0xb893('0x5'));var fs=require('fs');var path=require(_0xb893('0x6'));var rimraf=require(_0xb893('0x7'));var config=require(_0xb893('0x8'));var attributes=require(_0xb893('0x9'));module['exports']=function(_0x5265bc,_0x1b7a09){return _0x5265bc['define'](_0xb893('0xa'),attributes,{'tableName':_0xb893('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09e0=['bluebird','path','rimraf','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','api','moment'];(function(_0x5a8bf9,_0x1e6560){var _0x261738=function(_0xf70b15){while(--_0xf70b15){_0x5a8bf9['push'](_0x5a8bf9['shift']());}};_0x261738(++_0x1e6560);}(_0x09e0,0x130));var _0x009e=function(_0x43c4fc,_0x94577d){_0x43c4fc=_0x43c4fc-0x0;var _0x5571ca=_0x09e0[_0x43c4fc];return _0x5571ca;};'use strict';var _=require(_0x009e('0x0'));var util=require(_0x009e('0x1'));var logger=require('../../config/logger')(_0x009e('0x2'));var moment=require(_0x009e('0x3'));var BPromise=require(_0x009e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x009e('0x5'));var rimraf=require(_0x009e('0x6'));var config=require('../../config/environment');var attributes=require(_0x009e('0x7'));module[_0x009e('0x8')]=function(_0x2f4d83,_0x55aa09){return _0x2f4d83['define'](_0x009e('0x9'),attributes,{'tableName':_0x009e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index ad77c81..24fe6eb 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 _0x085b=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x9e15c3,_0x120d01){var _0x32c175=function(_0x5cdcc1){while(--_0x5cdcc1){_0x9e15c3['push'](_0x9e15c3['shift']());}};_0x32c175(++_0x120d01);}(_0x085b,0x6c));var _0xb085=function(_0x39c65b,_0x4b5a02){_0x39c65b=_0x39c65b-0x0;var _0x487fee=_0x085b[_0x39c65b];return _0x487fee;};'use strict';var _=require(_0xb085('0x0'));var util=require(_0xb085('0x1'));var moment=require(_0xb085('0x2'));var BPromise=require(_0xb085('0x3'));var rs=require(_0xb085('0x4'));var fs=require('fs');var Redis=require(_0xb085('0x5'));var db=require(_0xb085('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb085('0x7'))(_0xb085('0x8'));var config=require(_0xb085('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb085('0xa')][_0xb085('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26ee81,_0x13fe5c,_0x45a868){return new BPromise(function(_0x912f4,_0xe9556f){return client[_0xb085('0xc')](_0x26ee81,_0x45a868)[_0xb085('0xd')](function(_0x1aad31){logger[_0xb085('0xe')](_0xb085('0xf'),_0x13fe5c,_0xb085('0x10'));logger['debug'](_0xb085('0x11'),_0x13fe5c,_0xb085('0x10'),JSON[_0xb085('0x12')](_0x1aad31));if(_0x1aad31[_0xb085('0x13')]){if(_0x1aad31[_0xb085('0x13')][_0xb085('0x14')]===0x1f4){logger[_0xb085('0x13')](_0xb085('0xf'),_0x13fe5c,_0x1aad31['error'][_0xb085('0x15')]);return _0xe9556f(_0x1aad31[_0xb085('0x13')][_0xb085('0x15')]);}logger[_0xb085('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x13fe5c,_0x1aad31[_0xb085('0x13')]['message']);return _0x912f4(_0x1aad31['error'][_0xb085('0x15')]);}else{logger[_0xb085('0xe')](_0xb085('0xf'),_0x13fe5c,_0xb085('0x10'));_0x912f4(_0x1aad31[_0xb085('0x16')][_0xb085('0x15')]);}})['catch'](function(_0x140027){logger['error'](_0xb085('0xf'),_0x13fe5c,_0x140027);_0xe9556f(_0x140027);});});} \ No newline at end of file +var _0x1de2=['AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','AnalyticFieldReport,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','request','then','info','request\x20sent','debug'];(function(_0x165448,_0x1725ba){var _0x1bcb38=function(_0x47fb70){while(--_0x47fb70){_0x165448['push'](_0x165448['shift']());}};_0x1bcb38(++_0x1725ba);}(_0x1de2,0x1e1));var _0x21de=function(_0x41382c,_0xc3ffd1){_0x41382c=_0x41382c-0x0;var _0x4da35b=_0x1de2[_0x41382c];return _0x4da35b;};'use strict';var _=require('lodash');var util=require(_0x21de('0x0'));var moment=require(_0x21de('0x1'));var BPromise=require(_0x21de('0x2'));var rs=require(_0x21de('0x3'));var fs=require('fs');var Redis=require(_0x21de('0x4'));var db=require(_0x21de('0x5'))['db'];var utils=require(_0x21de('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x21de('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d8972,_0x3f4d1a,_0x4df2c8){return new BPromise(function(_0x35ae1c,_0x844225){return client[_0x21de('0x8')](_0x1d8972,_0x4df2c8)[_0x21de('0x9')](function(_0x2c1643){logger[_0x21de('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f4d1a,_0x21de('0xb'));logger[_0x21de('0xc')](_0x21de('0xd'),_0x3f4d1a,_0x21de('0xb'),JSON['stringify'](_0x2c1643));if(_0x2c1643['error']){if(_0x2c1643[_0x21de('0xe')]['code']===0x1f4){logger[_0x21de('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3f4d1a,_0x2c1643[_0x21de('0xe')][_0x21de('0xf')]);return _0x844225(_0x2c1643[_0x21de('0xe')]['message']);}logger[_0x21de('0xe')](_0x21de('0x10'),_0x3f4d1a,_0x2c1643[_0x21de('0xe')]['message']);return _0x35ae1c(_0x2c1643['error'][_0x21de('0xf')]);}else{logger['info'](_0x21de('0x10'),_0x3f4d1a,'request\x20sent');_0x35ae1c(_0x2c1643[_0x21de('0x11')][_0x21de('0xf')]);}})[_0x21de('0x12')](function(_0x4573f4){logger[_0x21de('0xe')](_0x21de('0x10'),_0x3f4d1a,_0x4573f4);_0x844225(_0x4573f4);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 3befd0a..027a45f 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(_0xed0bb8,_0x26e01a){var _0x55a32b=function(_0xf009bf){while(--_0xf009bf){_0xed0bb8['push'](_0xed0bb8['shift']());}};_0x55a32b(++_0x26e01a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +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(_0x252938,_0x4d41c8){var _0x5ef26e=function(_0x29824e){while(--_0x29824e){_0x252938['push'](_0x252938['shift']());}};_0x5ef26e(++_0x4d41c8);}(_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 diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 82a3614..470d764 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 _0xb677=['TEXT','sequelize','STRING','name'];(function(_0x155d73,_0x127098){var _0x18eedc=function(_0xfcd7d7){while(--_0xfcd7d7){_0x155d73['push'](_0x155d73['shift']());}};_0x18eedc(++_0x127098);}(_0xb677,0x119));var _0x7b67=function(_0x5aea32,_0x3bfbde){_0x5aea32=_0x5aea32-0x0;var _0x673243=_0xb677[_0x5aea32];return _0x673243;};'use strict';var Sequelize=require(_0x7b67('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b67('0x1')],'allowNull':![],'unique':_0x7b67('0x2')},'table':{'type':Sequelize[_0x7b67('0x1')]},'metric':{'type':Sequelize[_0x7b67('0x3')]},'description':{'type':Sequelize[_0x7b67('0x1')]}}; \ No newline at end of file +var _0xd757=['name','sequelize','exports','STRING'];(function(_0x26b1b4,_0x32a9c8){var _0x2896e2=function(_0x573323){while(--_0x573323){_0x26b1b4['push'](_0x26b1b4['shift']());}};_0x2896e2(++_0x32a9c8);}(_0xd757,0x1e5));var _0x7d75=function(_0xe01b77,_0x1e25d8){_0xe01b77=_0xe01b77-0x0;var _0x53b173=_0xd757[_0xe01b77];return _0x53b173;};'use strict';var Sequelize=require(_0x7d75('0x0'));module[_0x7d75('0x1')]={'name':{'type':Sequelize[_0x7d75('0x2')],'allowNull':![],'unique':_0x7d75('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x7d75('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index fa43326..d103c78 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 _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x27300b,_0x298344){var _0x518a12=function(_0x60c85c){while(--_0x60c85c){_0x27300b['push'](_0x27300b['shift']());}};_0x518a12(++_0x298344);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x45c957,_0x1762a2){_0x45c957=_0x45c957-0x0;var _0x455a3b=_0x7fbe[_0x45c957];return _0x455a3b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file +var _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1d9078,_0x2c5ced){var _0x50cfb3=function(_0x3614ef){while(--_0x3614ef){_0x1d9078['push'](_0x1d9078['shift']());}};_0x50cfb3(++_0x2c5ced);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4e0417,_0x574fd4){_0x4e0417=_0x4e0417-0x0;var _0x5d6909=_0x7fbe[_0x4e0417];return _0x5d6909;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index d45fa82..22cae40 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 _0x649f=['bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','lodash','util','../../config/logger'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x649f,0x93));var _0xf649=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x649f[_0x36c5b0];return _0xf19333;};'use strict';var _=require(_0xf649('0x0'));var util=require(_0xf649('0x1'));var logger=require(_0xf649('0x2'))('api');var moment=require('moment');var BPromise=require(_0xf649('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf649('0x4'));var rimraf=require(_0xf649('0x5'));var config=require(_0xf649('0x6'));var attributes=require(_0xf649('0x7'));module[_0xf649('0x8')]=function(_0x3e2e46,_0x580748){return _0x3e2e46[_0xf649('0x9')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['moment','request-promise','path','rimraf','exports','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x2ea1d4,_0x23f303){var _0x566ecc=function(_0x415e04){while(--_0x415e04){_0x2ea1d4['push'](_0x2ea1d4['shift']());}};_0x566ecc(++_0x23f303);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x17a28e,_0x41e687){_0x17a28e=_0x17a28e-0x0;var _0x306811=_0xc1c6[_0x17a28e];return _0x306811;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'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 ae3d458..49bbcf7 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 _0x886a=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x147523,_0x25c13b){var _0x419b1a=function(_0x4fdf20){while(--_0x4fdf20){_0x147523['push'](_0x147523['shift']());}};_0x419b1a(++_0x25c13b);}(_0x886a,0x119));var _0xa886=function(_0x386b03,_0x5d0000){_0x386b03=_0x386b03-0x0;var _0xd3d524=_0x886a[_0x386b03];return _0xd3d524;};'use strict';var _=require(_0xa886('0x0'));var util=require(_0xa886('0x1'));var moment=require(_0xa886('0x2'));var BPromise=require(_0xa886('0x3'));var rs=require(_0xa886('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa886('0x5'));var logger=require(_0xa886('0x6'))(_0xa886('0x7'));var config=require(_0xa886('0x8'));var jayson=require(_0xa886('0x9'));var client=jayson[_0xa886('0xa')][_0xa886('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d9bd1,_0x4d12d8,_0x20c97f){return new BPromise(function(_0x228917,_0x15b7ba){return client['request'](_0x5d9bd1,_0x20c97f)['then'](function(_0x1ce5b6){logger[_0xa886('0xc')](_0xa886('0xd'),_0x4d12d8,_0xa886('0xe'));logger[_0xa886('0xf')](_0xa886('0x10'),_0x4d12d8,_0xa886('0xe'),JSON[_0xa886('0x11')](_0x1ce5b6));if(_0x1ce5b6[_0xa886('0x12')]){if(_0x1ce5b6['error'][_0xa886('0x13')]===0x1f4){logger[_0xa886('0x12')]('AnalyticMetric,\x20%s,\x20%s',_0x4d12d8,_0x1ce5b6[_0xa886('0x12')][_0xa886('0x14')]);return _0x15b7ba(_0x1ce5b6[_0xa886('0x12')]['message']);}logger[_0xa886('0x12')](_0xa886('0xd'),_0x4d12d8,_0x1ce5b6['error'][_0xa886('0x14')]);return _0x228917(_0x1ce5b6[_0xa886('0x12')][_0xa886('0x14')]);}else{logger[_0xa886('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x4d12d8,_0xa886('0xe'));_0x228917(_0x1ce5b6[_0xa886('0x15')][_0xa886('0x14')]);}})[_0xa886('0x16')](function(_0x32df5d){logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x4d12d8,_0x32df5d);_0x15b7ba(_0x32df5d);});});} \ No newline at end of file +var _0xedae=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xedae,0x69));var _0xeeda=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xedae[_0x18a79d];return _0x4f8848;};'use strict';var _=require(_0xeeda('0x0'));var util=require(_0xeeda('0x1'));var moment=require('moment');var BPromise=require(_0xeeda('0x2'));var rs=require(_0xeeda('0x3'));var fs=require('fs');var Redis=require(_0xeeda('0x4'));var db=require(_0xeeda('0x5'))['db'];var utils=require(_0xeeda('0x6'));var logger=require(_0xeeda('0x7'))('rpc');var config=require(_0xeeda('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xeeda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fa4e9,_0x4033ce,_0x3418da){return new BPromise(function(_0xf06d65,_0x4c3d6e){return client[_0xeeda('0xa')](_0x3fa4e9,_0x3418da)[_0xeeda('0xb')](function(_0x25b219){logger[_0xeeda('0xc')](_0xeeda('0xd'),_0x4033ce,_0xeeda('0xe'));logger[_0xeeda('0xf')](_0xeeda('0x10'),_0x4033ce,_0xeeda('0xe'),JSON[_0xeeda('0x11')](_0x25b219));if(_0x25b219[_0xeeda('0x12')]){if(_0x25b219[_0xeeda('0x12')][_0xeeda('0x13')]===0x1f4){logger['error'](_0xeeda('0xd'),_0x4033ce,_0x25b219[_0xeeda('0x12')]['message']);return _0x4c3d6e(_0x25b219[_0xeeda('0x12')]['message']);}logger[_0xeeda('0x12')](_0xeeda('0xd'),_0x4033ce,_0x25b219[_0xeeda('0x12')][_0xeeda('0x14')]);return _0xf06d65(_0x25b219[_0xeeda('0x12')][_0xeeda('0x14')]);}else{logger[_0xeeda('0xc')](_0xeeda('0xd'),_0x4033ce,_0xeeda('0xe'));_0xf06d65(_0x25b219[_0xeeda('0x15')][_0xeeda('0x14')]);}})['catch'](function(_0x37331a){logger[_0xeeda('0x12')](_0xeeda('0xd'),_0x4033ce,_0x37331a);_0x4c3d6e(_0x37331a);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b6a8989..5d523e5 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 _0xdd0c=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','index','/:id','isAuthenticated','show','update','delete','destroy','exports'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0xdd0c,0x165));var _0xcdd0=function(_0xf318bb,_0x31af4f){_0xf318bb=_0xf318bb-0x0;var _0xb5d6d=_0xdd0c[_0xf318bb];return _0xb5d6d;};'use strict';var multer=require('multer');var util=require(_0xcdd0('0x0'));var path=require(_0xcdd0('0x1'));var timeout=require(_0xcdd0('0x2'));var express=require('express');var router=express[_0xcdd0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcdd0('0x4'));var interaction=require(_0xcdd0('0x5'));var config=require(_0xcdd0('0x6'));var controller=require(_0xcdd0('0x7'));router[_0xcdd0('0x8')]('/',auth['isAuthenticated'](),controller[_0xcdd0('0x9')]);router[_0xcdd0('0x8')](_0xcdd0('0xa'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xc')]);router['post']('/',auth[_0xcdd0('0xb')](),controller['create']);router['put'](_0xcdd0('0xa'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xd')]);router[_0xcdd0('0xe')](_0xcdd0('0xa'),auth[_0xcdd0('0xb')](),controller[_0xcdd0('0xf')]);module[_0xcdd0('0x10')]=router; \ No newline at end of file +var _0xbdfd=['delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x30182f,_0x30ce41){var _0x5207db=function(_0x50a417){while(--_0x50a417){_0x30182f['push'](_0x30182f['shift']());}};_0x5207db(++_0x30ce41);}(_0xbdfd,0x135));var _0xdbdf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbdfd[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xdbdf('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xdbdf('0x1'));var express=require(_0xdbdf('0x2'));var router=express[_0xdbdf('0x3')]();var fs_extra=require(_0xdbdf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdbdf('0x5'));var config=require(_0xdbdf('0x6'));var controller=require('./analyticMetric.controller');router[_0xdbdf('0x7')]('/',auth[_0xdbdf('0x8')](),controller['index']);router[_0xdbdf('0x7')](_0xdbdf('0x9'),auth[_0xdbdf('0x8')](),controller[_0xdbdf('0xa')]);router[_0xdbdf('0xb')]('/',auth['isAuthenticated'](),controller[_0xdbdf('0xc')]);router[_0xdbdf('0xd')](_0xdbdf('0x9'),auth[_0xdbdf('0x8')](),controller[_0xdbdf('0xe')]);router[_0xdbdf('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xdbdf('0x10')]);module[_0xdbdf('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 6d91c52..ade2547 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 _0xfb89=['TEXT'];(function(_0x3bc82d,_0x59187f){var _0x2cfb3d=function(_0x515ac3){while(--_0x515ac3){_0x3bc82d['push'](_0x3bc82d['shift']());}};_0x2cfb3d(++_0x59187f);}(_0xfb89,0x196));var _0x9fb8=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0xfb89[_0x3e478c];return _0x29ef89;};'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize[_0x9fb8('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0xd8f3=['TEXT','sequelize','exports'];(function(_0x2da9df,_0x3a6b87){var _0x2fecc3=function(_0x3663e1){while(--_0x3663e1){_0x2da9df['push'](_0x2da9df['shift']());}};_0x2fecc3(++_0x3a6b87);}(_0xd8f3,0x154));var _0x3d8f=function(_0x128641,_0x5b428c){_0x128641=_0x128641-0x0;var _0x28f3b2=_0xd8f3[_0x128641];return _0x28f3b2;};'use strict';var Sequelize=require(_0x3d8f('0x0'));module[_0x3d8f('0x1')]={'tree':{'type':Sequelize[_0x3d8f('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 b26ede3..7061bd0 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 _0x35ff=['attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','AnalyticTreeReport','findAll','rows','catch','show','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields'];(function(_0x47a768,_0x3357cc){var _0x5d756d=function(_0x3d89b4){while(--_0x3d89b4){_0x47a768['push'](_0x47a768['shift']());}};_0x5d756d(++_0x3357cc);}(_0x35ff,0x1ac));var _0xf35f=function(_0x93f225,_0x208206){_0x93f225=_0x93f225-0x0;var _0x272bf4=_0x35ff[_0x93f225];return _0x272bf4;};'use strict';var emlformat=require(_0xf35f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf35f('0x1'));var jsonpatch=require(_0xf35f('0x2'));var rp=require(_0xf35f('0x3'));var moment=require(_0xf35f('0x4'));var BPromise=require(_0xf35f('0x5'));var Mustache=require('mustache');var util=require(_0xf35f('0x6'));var path=require(_0xf35f('0x7'));var sox=require(_0xf35f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf35f('0x9'));var squel=require(_0xf35f('0xa'));var crypto=require(_0xf35f('0xb'));var jsforce=require(_0xf35f('0xc'));var deskjs=require(_0xf35f('0xd'));var toCsv=require(_0xf35f('0xe'));var querystring=require(_0xf35f('0xf'));var Papa=require(_0xf35f('0x10'));var Redis=require(_0xf35f('0x11'));var authService=require(_0xf35f('0x12'));var qs=require(_0xf35f('0x13'));var as=require(_0xf35f('0x14'));var hardwareService=require(_0xf35f('0x15'));var logger=require(_0xf35f('0x16'))(_0xf35f('0x17'));var utils=require('../../config/utils');var config=require(_0xf35f('0x18'));var licenseUtil=require(_0xf35f('0x19'));var db=require(_0xf35f('0x1a'))['db'];function respondWithStatusCode(_0x326f58,_0x58d2b4){_0x58d2b4=_0x58d2b4||0xcc;return function(_0x26c10c){if(_0x26c10c){return _0x326f58[_0xf35f('0x1b')](_0x58d2b4);}return _0x326f58[_0xf35f('0x1c')](_0x58d2b4)[_0xf35f('0x1d')]();};}function respondWithResult(_0x30a4e9,_0x48e45b){_0x48e45b=_0x48e45b||0xc8;return function(_0x1b28ad){if(_0x1b28ad){return _0x30a4e9[_0xf35f('0x1c')](_0x48e45b)['json'](_0x1b28ad);}};}function respondWithFilteredResult(_0x3d68af,_0x35a830){return function(_0xa458a2){if(_0xa458a2){var _0x585cb6=typeof _0x35a830[_0xf35f('0x1e')]==='undefined'&&typeof _0x35a830[_0xf35f('0x1f')]===_0xf35f('0x20');var _0x1473f7=_0xa458a2[_0xf35f('0x21')];var _0x550877=_0x585cb6?0x0:_0x35a830[_0xf35f('0x1e')];var _0x1a3086=_0x585cb6?_0xa458a2[_0xf35f('0x21')]:_0x35a830[_0xf35f('0x1e')]+_0x35a830['limit'];var _0x449c22;if(_0x1a3086>=_0x1473f7){_0x1a3086=_0x1473f7;_0x449c22=0xc8;}else{_0x449c22=0xce;}_0x3d68af[_0xf35f('0x1c')](_0x449c22);return _0x3d68af[_0xf35f('0x22')](_0xf35f('0x23'),_0x550877+'-'+_0x1a3086+'/'+_0x1473f7)[_0xf35f('0x24')](_0xa458a2);}return null;};}function patchUpdates(_0x2c9b3c){return function(_0x40a5ae){try{jsonpatch[_0xf35f('0x25')](_0x40a5ae,_0x2c9b3c,!![]);}catch(_0x30bd95){return BPromise[_0xf35f('0x26')](_0x30bd95);}return _0x40a5ae[_0xf35f('0x27')]();};}function saveUpdates(_0x340967,_0x588353){return function(_0x616a9e){if(_0x616a9e){return _0x616a9e[_0xf35f('0x28')](_0x340967)[_0xf35f('0x29')](function(_0x7b5931){return _0x7b5931;});}return null;};}function removeEntity(_0x539d88,_0x4bedef){return function(_0x1fc44d){if(_0x1fc44d){return _0x1fc44d[_0xf35f('0x2a')]()[_0xf35f('0x29')](function(){_0x539d88[_0xf35f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e491c,_0x3b6797){return function(_0x2aa3b0){if(!_0x2aa3b0){_0x1e491c[_0xf35f('0x1b')](0x194);}return _0x2aa3b0;};}function handleError(_0x5e1a20,_0x17bc62){_0x17bc62=_0x17bc62||0x1f4;return function(_0x3e2842){logger[_0xf35f('0x2b')](_0x3e2842[_0xf35f('0x2c')]);if(_0x3e2842[_0xf35f('0x2d')]){delete _0x3e2842['name'];}_0x5e1a20[_0xf35f('0x1c')](_0x17bc62)[_0xf35f('0x2e')](_0x3e2842);};}exports['index']=function(_0x3c6667,_0x42adf3){var _0x3612b1={},_0x5c6577={},_0x596ce4={'count':0x0,'rows':[]};var _0x38ed09=_['map'](db['AnalyticTreeReport'][_0xf35f('0x2f')],function(_0x5db0c1){return{'name':_0x5db0c1[_0xf35f('0x30')],'type':_0x5db0c1[_0xf35f('0x31')][_0xf35f('0x32')]};});_0x5c6577['model']=_[_0xf35f('0x33')](_0x38ed09,_0xf35f('0x2d'));_0x5c6577[_0xf35f('0x34')]=_[_0xf35f('0x35')](_0x3c6667[_0xf35f('0x34')]);_0x5c6577[_0xf35f('0x36')]=_[_0xf35f('0x37')](_0x5c6577[_0xf35f('0x38')],_0x5c6577['query']);_0x3612b1['attributes']=_['intersection'](_0x5c6577[_0xf35f('0x38')],qs['fields'](_0x3c6667[_0xf35f('0x34')][_0xf35f('0x39')]));_0x3612b1[_0xf35f('0x3a')]=_0x3612b1[_0xf35f('0x3a')][_0xf35f('0x3b')]?_0x3612b1[_0xf35f('0x3a')]:_0x5c6577[_0xf35f('0x38')];if(!_0x3c6667[_0xf35f('0x34')][_0xf35f('0x3c')](_0xf35f('0x3d'))){_0x3612b1[_0xf35f('0x1f')]=qs[_0xf35f('0x1f')](_0x3c6667[_0xf35f('0x34')][_0xf35f('0x1f')]);_0x3612b1[_0xf35f('0x1e')]=qs[_0xf35f('0x1e')](_0x3c6667[_0xf35f('0x34')][_0xf35f('0x1e')]);}_0x3612b1[_0xf35f('0x3e')]=qs[_0xf35f('0x3f')](_0x3c6667['query'][_0xf35f('0x3f')]);_0x3612b1[_0xf35f('0x40')]=qs[_0xf35f('0x36')](_[_0xf35f('0x41')](_0x3c6667[_0xf35f('0x34')],_0x5c6577[_0xf35f('0x36')]),_0x38ed09);if(_0x3c6667[_0xf35f('0x34')]['filter']){_0x3612b1[_0xf35f('0x40')]=_['merge'](_0x3612b1[_0xf35f('0x40')],{'$or':_[_0xf35f('0x33')](_0x38ed09,function(_0x19b01a){if(_0x19b01a['type']!==_0xf35f('0x42')){var _0x33bdd0={};_0x33bdd0[_0x19b01a[_0xf35f('0x2d')]]={'$like':'%'+_0x3c6667[_0xf35f('0x34')][_0xf35f('0x43')]+'%'};return _0x33bdd0;}})});}_0x3612b1=_[_0xf35f('0x44')]({},_0x3612b1,_0x3c6667[_0xf35f('0x45')]);var _0x5e000f={'where':_0x3612b1[_0xf35f('0x40')]};return db['AnalyticTreeReport'][_0xf35f('0x21')](_0x5e000f)[_0xf35f('0x29')](function(_0x2ff544){_0x596ce4[_0xf35f('0x21')]=_0x2ff544;if(_0x3c6667[_0xf35f('0x34')][_0xf35f('0x46')]){_0x3612b1['include']=[{'all':!![]}];}return db[_0xf35f('0x47')][_0xf35f('0x48')](_0x3612b1);})['then'](function(_0x7ea5c7){_0x596ce4[_0xf35f('0x49')]=_0x7ea5c7;return _0x596ce4;})['then'](respondWithFilteredResult(_0x42adf3,_0x3612b1))[_0xf35f('0x4a')](handleError(_0x42adf3,null));};exports[_0xf35f('0x4b')]=function(_0x353b4f,_0xf4f4b6){var _0x3515f1={'raw':!![],'where':{'id':_0x353b4f[_0xf35f('0x4c')]['id']}},_0x38b23a={};_0x38b23a['model']=_[_0xf35f('0x35')](db[_0xf35f('0x47')][_0xf35f('0x2f')]);_0x38b23a['query']=_['keys'](_0x353b4f[_0xf35f('0x34')]);_0x38b23a[_0xf35f('0x36')]=_[_0xf35f('0x37')](_0x38b23a[_0xf35f('0x38')],_0x38b23a['query']);_0x3515f1['attributes']=_[_0xf35f('0x37')](_0x38b23a['model'],qs['fields'](_0x353b4f[_0xf35f('0x34')][_0xf35f('0x39')]));_0x3515f1[_0xf35f('0x3a')]=_0x3515f1[_0xf35f('0x3a')][_0xf35f('0x3b')]?_0x3515f1[_0xf35f('0x3a')]:_0x38b23a[_0xf35f('0x38')];if(_0x353b4f[_0xf35f('0x34')]['includeAll']){_0x3515f1[_0xf35f('0x4d')]=[{'all':!![]}];}_0x3515f1=_['merge']({},_0x3515f1,_0x353b4f[_0xf35f('0x45')]);return db[_0xf35f('0x47')][_0xf35f('0x4e')](_0x3515f1)[_0xf35f('0x29')](handleEntityNotFound(_0xf4f4b6,null))[_0xf35f('0x29')](respondWithResult(_0xf4f4b6,null))[_0xf35f('0x4a')](handleError(_0xf4f4b6,null));};exports[_0xf35f('0x4f')]=function(_0x3aa682,_0x2be68b){return db['AnalyticTreeReport'][_0xf35f('0x4f')](_0x3aa682[_0xf35f('0x50')],{})['then'](respondWithResult(_0x2be68b,0xc9))['catch'](handleError(_0x2be68b,null));};exports[_0xf35f('0x28')]=function(_0x110a6c,_0x521eee){if(_0x110a6c['body']['id']){delete _0x110a6c[_0xf35f('0x50')]['id'];}return db[_0xf35f('0x47')][_0xf35f('0x4e')]({'where':{'id':_0x110a6c[_0xf35f('0x4c')]['id']}})[_0xf35f('0x29')](handleEntityNotFound(_0x521eee,null))[_0xf35f('0x29')](saveUpdates(_0x110a6c[_0xf35f('0x50')],null))[_0xf35f('0x29')](respondWithResult(_0x521eee,null))[_0xf35f('0x4a')](handleError(_0x521eee,null));};exports[_0xf35f('0x2a')]=function(_0x274094,_0x2917b7){return db['AnalyticTreeReport'][_0xf35f('0x4e')]({'where':{'id':_0x274094['params']['id']}})[_0xf35f('0x29')](handleEntityNotFound(_0x2917b7,null))[_0xf35f('0x29')](removeEntity(_0x2917b7,null))['catch'](handleError(_0x2917b7,null));}; \ No newline at end of file +var _0x0523=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','index','AnalyticTreeReport','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0x0523,0x1a7));var _0x3052=function(_0x374bcf,_0x1c761c){_0x374bcf=_0x374bcf-0x0;var _0x53e31b=_0x0523[_0x374bcf];return _0x53e31b;};'use strict';var emlformat=require(_0x3052('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3052('0x1'));var jsonpatch=require(_0x3052('0x2'));var rp=require(_0x3052('0x3'));var moment=require(_0x3052('0x4'));var BPromise=require(_0x3052('0x5'));var Mustache=require(_0x3052('0x6'));var util=require(_0x3052('0x7'));var path=require('path');var sox=require(_0x3052('0x8'));var csv=require(_0x3052('0x9'));var ejs=require(_0x3052('0xa'));var fs=require('fs');var fs_extra=require(_0x3052('0xb'));var _=require('lodash');var squel=require(_0x3052('0xc'));var crypto=require('crypto');var jsforce=require(_0x3052('0xd'));var deskjs=require(_0x3052('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3052('0xf'));var Papa=require(_0x3052('0x10'));var Redis=require(_0x3052('0x11'));var authService=require(_0x3052('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x3052('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3052('0x14'));var utils=require(_0x3052('0x15'));var config=require(_0x3052('0x16'));var licenseUtil=require(_0x3052('0x17'));var db=require(_0x3052('0x18'))['db'];function respondWithStatusCode(_0x3153d0,_0x141ef2){_0x141ef2=_0x141ef2||0xcc;return function(_0x3b3af5){if(_0x3b3af5){return _0x3153d0['sendStatus'](_0x141ef2);}return _0x3153d0[_0x3052('0x19')](_0x141ef2)[_0x3052('0x1a')]();};}function respondWithResult(_0x2f6672,_0x641b1a){_0x641b1a=_0x641b1a||0xc8;return function(_0x10eac3){if(_0x10eac3){return _0x2f6672[_0x3052('0x19')](_0x641b1a)['json'](_0x10eac3);}};}function respondWithFilteredResult(_0xfd29e5,_0x15410b){return function(_0x3da043){if(_0x3da043){var _0x305d4=typeof _0x15410b[_0x3052('0x1b')]==='undefined'&&typeof _0x15410b[_0x3052('0x1c')]===_0x3052('0x1d');var _0x243afe=_0x3da043['count'];var _0x1fff1c=_0x305d4?0x0:_0x15410b[_0x3052('0x1b')];var _0x416300=_0x305d4?_0x3da043[_0x3052('0x1e')]:_0x15410b[_0x3052('0x1b')]+_0x15410b[_0x3052('0x1c')];var _0x3ba0be;if(_0x416300>=_0x243afe){_0x416300=_0x243afe;_0x3ba0be=0xc8;}else{_0x3ba0be=0xce;}_0xfd29e5[_0x3052('0x19')](_0x3ba0be);return _0xfd29e5[_0x3052('0x1f')](_0x3052('0x20'),_0x1fff1c+'-'+_0x416300+'/'+_0x243afe)[_0x3052('0x21')](_0x3da043);}return null;};}function patchUpdates(_0x42635e){return function(_0x41444c){try{jsonpatch[_0x3052('0x22')](_0x41444c,_0x42635e,!![]);}catch(_0x573f3a){return BPromise['reject'](_0x573f3a);}return _0x41444c[_0x3052('0x23')]();};}function saveUpdates(_0x123ed,_0x340d68){return function(_0x1bd2fd){if(_0x1bd2fd){return _0x1bd2fd[_0x3052('0x24')](_0x123ed)[_0x3052('0x25')](function(_0x567987){return _0x567987;});}return null;};}function removeEntity(_0x26260b,_0x2a6da4){return function(_0x47f9a9){if(_0x47f9a9){return _0x47f9a9['destroy']()[_0x3052('0x25')](function(){_0x26260b[_0x3052('0x19')](0xcc)[_0x3052('0x1a')]();});}};}function handleEntityNotFound(_0x422a8b,_0x231217){return function(_0x1b3c0e){if(!_0x1b3c0e){_0x422a8b[_0x3052('0x26')](0x194);}return _0x1b3c0e;};}function handleError(_0x1a1644,_0x51a0d5){_0x51a0d5=_0x51a0d5||0x1f4;return function(_0x5ad2e5){logger[_0x3052('0x27')](_0x5ad2e5[_0x3052('0x28')]);if(_0x5ad2e5[_0x3052('0x29')]){delete _0x5ad2e5[_0x3052('0x29')];}_0x1a1644['status'](_0x51a0d5)['send'](_0x5ad2e5);};}exports[_0x3052('0x2a')]=function(_0x22722b,_0x362cce){var _0x372104={},_0x2c19ed={},_0x4f8522={'count':0x0,'rows':[]};var _0x329a9b=_['map'](db[_0x3052('0x2b')][_0x3052('0x2c')],function(_0x22a031){return{'name':_0x22a031['fieldName'],'type':_0x22a031[_0x3052('0x2d')][_0x3052('0x2e')]};});_0x2c19ed[_0x3052('0x2f')]=_[_0x3052('0x30')](_0x329a9b,_0x3052('0x29'));_0x2c19ed[_0x3052('0x31')]=_[_0x3052('0x32')](_0x22722b['query']);_0x2c19ed[_0x3052('0x33')]=_[_0x3052('0x34')](_0x2c19ed[_0x3052('0x2f')],_0x2c19ed[_0x3052('0x31')]);_0x372104[_0x3052('0x35')]=_[_0x3052('0x34')](_0x2c19ed['model'],qs[_0x3052('0x36')](_0x22722b[_0x3052('0x31')]['fields']));_0x372104['attributes']=_0x372104[_0x3052('0x35')]['length']?_0x372104[_0x3052('0x35')]:_0x2c19ed[_0x3052('0x2f')];if(!_0x22722b['query'][_0x3052('0x37')]('nolimit')){_0x372104[_0x3052('0x1c')]=qs[_0x3052('0x1c')](_0x22722b['query']['limit']);_0x372104[_0x3052('0x1b')]=qs[_0x3052('0x1b')](_0x22722b[_0x3052('0x31')][_0x3052('0x1b')]);}_0x372104[_0x3052('0x38')]=qs[_0x3052('0x39')](_0x22722b[_0x3052('0x31')][_0x3052('0x39')]);_0x372104['where']=qs['filters'](_['pick'](_0x22722b['query'],_0x2c19ed[_0x3052('0x33')]),_0x329a9b);if(_0x22722b['query'][_0x3052('0x3a')]){_0x372104[_0x3052('0x3b')]=_[_0x3052('0x3c')](_0x372104[_0x3052('0x3b')],{'$or':_[_0x3052('0x30')](_0x329a9b,function(_0x1f546a){if(_0x1f546a[_0x3052('0x2d')]!=='VIRTUAL'){var _0x390fdc={};_0x390fdc[_0x1f546a[_0x3052('0x29')]]={'$like':'%'+_0x22722b[_0x3052('0x31')][_0x3052('0x3a')]+'%'};return _0x390fdc;}})});}_0x372104=_['merge']({},_0x372104,_0x22722b[_0x3052('0x3d')]);var _0x7daecf={'where':_0x372104['where']};return db[_0x3052('0x2b')]['count'](_0x7daecf)[_0x3052('0x25')](function(_0x16bac0){_0x4f8522[_0x3052('0x1e')]=_0x16bac0;if(_0x22722b['query'][_0x3052('0x3e')]){_0x372104[_0x3052('0x3f')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0x3052('0x40')](_0x372104);})[_0x3052('0x25')](function(_0x4c45d4){_0x4f8522[_0x3052('0x41')]=_0x4c45d4;return _0x4f8522;})[_0x3052('0x25')](respondWithFilteredResult(_0x362cce,_0x372104))[_0x3052('0x42')](handleError(_0x362cce,null));};exports[_0x3052('0x43')]=function(_0x14d1e9,_0x2475da){var _0x24a183={'raw':!![],'where':{'id':_0x14d1e9[_0x3052('0x44')]['id']}},_0x35f678={};_0x35f678['model']=_[_0x3052('0x32')](db['AnalyticTreeReport'][_0x3052('0x2c')]);_0x35f678[_0x3052('0x31')]=_[_0x3052('0x32')](_0x14d1e9[_0x3052('0x31')]);_0x35f678[_0x3052('0x33')]=_[_0x3052('0x34')](_0x35f678['model'],_0x35f678[_0x3052('0x31')]);_0x24a183[_0x3052('0x35')]=_[_0x3052('0x34')](_0x35f678['model'],qs['fields'](_0x14d1e9[_0x3052('0x31')][_0x3052('0x36')]));_0x24a183[_0x3052('0x35')]=_0x24a183[_0x3052('0x35')][_0x3052('0x45')]?_0x24a183[_0x3052('0x35')]:_0x35f678[_0x3052('0x2f')];if(_0x14d1e9[_0x3052('0x31')]['includeAll']){_0x24a183[_0x3052('0x3f')]=[{'all':!![]}];}_0x24a183=_['merge']({},_0x24a183,_0x14d1e9[_0x3052('0x3d')]);return db[_0x3052('0x2b')][_0x3052('0x46')](_0x24a183)['then'](handleEntityNotFound(_0x2475da,null))[_0x3052('0x25')](respondWithResult(_0x2475da,null))[_0x3052('0x42')](handleError(_0x2475da,null));};exports[_0x3052('0x47')]=function(_0x5ed1d7,_0x39f02c){return db[_0x3052('0x2b')][_0x3052('0x47')](_0x5ed1d7[_0x3052('0x48')],{})[_0x3052('0x25')](respondWithResult(_0x39f02c,0xc9))['catch'](handleError(_0x39f02c,null));};exports[_0x3052('0x24')]=function(_0x3622b7,_0x50336e){if(_0x3622b7[_0x3052('0x48')]['id']){delete _0x3622b7['body']['id'];}return db[_0x3052('0x2b')][_0x3052('0x46')]({'where':{'id':_0x3622b7[_0x3052('0x44')]['id']}})['then'](handleEntityNotFound(_0x50336e,null))['then'](saveUpdates(_0x3622b7['body'],null))['then'](respondWithResult(_0x50336e,null))[_0x3052('0x42')](handleError(_0x50336e,null));};exports[_0x3052('0x49')]=function(_0x5c9791,_0x5b19dc){return db[_0x3052('0x2b')][_0x3052('0x46')]({'where':{'id':_0x5c9791[_0x3052('0x44')]['id']}})[_0x3052('0x25')](handleEntityNotFound(_0x5b19dc,null))[_0x3052('0x25')](removeEntity(_0x5b19dc,null))[_0x3052('0x42')](handleError(_0x5b19dc,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 61c0e25..e732bb4 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 _0x8d1a=['exports','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x8d1a,0x10b));var _0xa8d1=function(_0x1b0cc8,_0x6e3392){_0x1b0cc8=_0x1b0cc8-0x0;var _0x441d1a=_0x8d1a[_0x1b0cc8];return _0x441d1a;};'use strict';var _=require('lodash');var util=require(_0xa8d1('0x0'));var logger=require(_0xa8d1('0x1'))(_0xa8d1('0x2'));var moment=require(_0xa8d1('0x3'));var BPromise=require(_0xa8d1('0x4'));var rp=require(_0xa8d1('0x5'));var fs=require('fs');var path=require(_0xa8d1('0x6'));var rimraf=require('rimraf');var config=require(_0xa8d1('0x7'));var attributes=require('./analyticTreeReport.attributes');module[_0xa8d1('0x8')]=function(_0x216b44,_0x449fd0){return _0x216b44['define'](_0xa8d1('0x9'),attributes,{'tableName':_0xa8d1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1795=['bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','define','analytics_report_trees','util','../../config/logger'];(function(_0xea41f1,_0x562290){var _0x484896=function(_0x2e20e3){while(--_0x2e20e3){_0xea41f1['push'](_0xea41f1['shift']());}};_0x484896(++_0x562290);}(_0x1795,0x76));var _0x5179=function(_0x14e504,_0x5e4fd4){_0x14e504=_0x14e504-0x0;var _0x3fb819=_0x1795[_0x14e504];return _0x3fb819;};'use strict';var _=require('lodash');var util=require(_0x5179('0x0'));var logger=require(_0x5179('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5179('0x2'));var rp=require(_0x5179('0x3'));var fs=require('fs');var path=require(_0x5179('0x4'));var rimraf=require(_0x5179('0x5'));var config=require('../../config/environment');var attributes=require(_0x5179('0x6'));module[_0x5179('0x7')]=function(_0x182143,_0x32ed59){return _0x182143[_0x5179('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0x5179('0x9'),'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 34ce82d..5eb4d17 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x5bd9fc,_0x5943d9){var _0x6f81eb=function(_0x2b7e51){while(--_0x2b7e51){_0x5bd9fc['push'](_0x5bd9fc['shift']());}};_0x6f81eb(++_0x5943d9);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('AnalyticTreeReport,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0x7a54=['info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x6fc0d1,_0x2d2513){_0x6fc0d1=_0x6fc0d1-0x0;var _0x4aa763=_0x7a54[_0x6fc0d1];return _0x4aa763;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index ea3b688..ada77cf 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 _0x8e2e=['show','post','create','put','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id'];(function(_0x3cea78,_0x4a6751){var _0x33b66b=function(_0x1f45cd){while(--_0x1f45cd){_0x3cea78['push'](_0x3cea78['shift']());}};_0x33b66b(++_0x4a6751);}(_0x8e2e,0x19b));var _0xe8e2=function(_0x544b3f,_0x4d8b66){_0x544b3f=_0x544b3f-0x0;var _0x15787f=_0x8e2e[_0x544b3f];return _0x15787f;};'use strict';var multer=require(_0xe8e2('0x0'));var util=require(_0xe8e2('0x1'));var path=require(_0xe8e2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe8e2('0x3')]();var fs_extra=require(_0xe8e2('0x4'));var auth=require(_0xe8e2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xe8e2('0x6')]('/',auth[_0xe8e2('0x7')](),controller['index']);router[_0xe8e2('0x6')](_0xe8e2('0x8'),auth[_0xe8e2('0x7')](),controller[_0xe8e2('0x9')]);router[_0xe8e2('0xa')]('/',auth['isAuthenticated'](),controller[_0xe8e2('0xb')]);router[_0xe8e2('0xc')](_0xe8e2('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xe8e2('0x8'),auth[_0xe8e2('0x7')](),controller[_0xe8e2('0xd')]);module[_0xe8e2('0xe')]=router; \ No newline at end of file +var _0x6baa=['../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','show','create','put','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x19dfef,_0x51721e){var _0x347527=function(_0x1d11f8){while(--_0x1d11f8){_0x19dfef['push'](_0x19dfef['shift']());}};_0x347527(++_0x51721e);}(_0x6baa,0xb4));var _0xa6ba=function(_0x818a29,_0x5afa36){_0x818a29=_0x818a29-0x0;var _0x4b60ac=_0x6baa[_0x818a29];return _0x4b60ac;};'use strict';var multer=require(_0xa6ba('0x0'));var util=require(_0xa6ba('0x1'));var path=require(_0xa6ba('0x2'));var timeout=require(_0xa6ba('0x3'));var express=require(_0xa6ba('0x4'));var router=express[_0xa6ba('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa6ba('0x6'));var config=require(_0xa6ba('0x7'));var controller=require(_0xa6ba('0x8'));router[_0xa6ba('0x9')]('/',auth[_0xa6ba('0xa')](),controller['index']);router[_0xa6ba('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xa6ba('0xb')]);router['post']('/',auth[_0xa6ba('0xa')](),controller[_0xa6ba('0xc')]);router[_0xa6ba('0xd')]('/:id',auth[_0xa6ba('0xa')](),controller['update']);router[_0xa6ba('0xe')](_0xa6ba('0xf'),auth[_0xa6ba('0xa')](),controller['destroy']);module[_0xa6ba('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index f805c81..748f447 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 _0x544f=['sequelize','STRING'];(function(_0x325430,_0x81f8df){var _0x47e948=function(_0x438af0){while(--_0x438af0){_0x325430['push'](_0x325430['shift']());}};_0x47e948(++_0x81f8df);}(_0x544f,0x14c));var _0xf544=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x544f[_0x429948];return _0x35d5d1;};'use strict';var Sequelize=require(_0xf544('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xf544('0x1')]},'type':{'type':Sequelize[_0xf544('0x1')]}}; \ No newline at end of file +var _0xe356=['exports','STRING','sequelize'];(function(_0xcfeda9,_0xd418ae){var _0x4826c7=function(_0x45dc9d){while(--_0x45dc9d){_0xcfeda9['push'](_0xcfeda9['shift']());}};_0x4826c7(++_0xd418ae);}(_0xe356,0x1ee));var _0x6e35=function(_0x36ed0f,_0x292e11){_0x36ed0f=_0x36ed0f-0x0;var _0x3321ad=_0xe356[_0x36ed0f];return _0x3321ad;};'use strict';var Sequelize=require(_0x6e35('0x0'));module[_0x6e35('0x1')]={'name':{'type':Sequelize[_0x6e35('0x2')]},'basename':{'type':Sequelize[_0x6e35('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1ef30f4..84ffe88 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 _0xc8e5=['keys','filters','attributes','intersection','fields','length','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','params','find','get','omit','body','createdAt','create','file','basename','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','zip-dir','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query'];(function(_0x359b13,_0x11788c){var _0x28dc12=function(_0x895e88){while(--_0x895e88){_0x359b13['push'](_0x359b13['shift']());}};_0x28dc12(++_0x11788c);}(_0xc8e5,0x79));var _0x5c8e=function(_0x220f6a,_0x2a8b9c){_0x220f6a=_0x220f6a-0x0;var _0x54ef68=_0xc8e5[_0x220f6a];return _0x54ef68;};'use strict';var emlformat=require(_0x5c8e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c8e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5c8e('0x2'));var moment=require('moment');var BPromise=require(_0x5c8e('0x3'));var Mustache=require(_0x5c8e('0x4'));var util=require(_0x5c8e('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5c8e('0x6'));var fs=require('fs');var fs_extra=require(_0x5c8e('0x7'));var _=require(_0x5c8e('0x8'));var squel=require(_0x5c8e('0x9'));var crypto=require(_0x5c8e('0xa'));var jsforce=require(_0x5c8e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5c8e('0xc'));var querystring=require(_0x5c8e('0xd'));var Papa=require(_0x5c8e('0xe'));var Redis=require('ioredis');var authService=require(_0x5c8e('0xf'));var qs=require(_0x5c8e('0x10'));var as=require(_0x5c8e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c8e('0x12'))(_0x5c8e('0x13'));var utils=require(_0x5c8e('0x14'));var config=require(_0x5c8e('0x15'));var licenseUtil=require(_0x5c8e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x428ff0,_0x2cac48){_0x2cac48=_0x2cac48||0xcc;return function(_0x325496){if(_0x325496){return _0x428ff0['sendStatus'](_0x2cac48);}return _0x428ff0[_0x5c8e('0x17')](_0x2cac48)[_0x5c8e('0x18')]();};}function respondWithResult(_0x11189b,_0x4c39b6){_0x4c39b6=_0x4c39b6||0xc8;return function(_0x30c98d){if(_0x30c98d){return _0x11189b['status'](_0x4c39b6)[_0x5c8e('0x19')](_0x30c98d);}};}function respondWithFilteredResult(_0x4df204,_0x5e0553){return function(_0x280d14){if(_0x280d14){var _0x303ebc=typeof _0x5e0553['offset']===_0x5c8e('0x1a')&&typeof _0x5e0553['limit']===_0x5c8e('0x1a');var _0x89a428=_0x280d14[_0x5c8e('0x1b')];var _0x3b311f=_0x303ebc?0x0:_0x5e0553[_0x5c8e('0x1c')];var _0x3fe437=_0x303ebc?_0x280d14[_0x5c8e('0x1b')]:_0x5e0553[_0x5c8e('0x1c')]+_0x5e0553[_0x5c8e('0x1d')];var _0x1e9280;if(_0x3fe437>=_0x89a428){_0x3fe437=_0x89a428;_0x1e9280=0xc8;}else{_0x1e9280=0xce;}_0x4df204[_0x5c8e('0x17')](_0x1e9280);return _0x4df204[_0x5c8e('0x1e')](_0x5c8e('0x1f'),_0x3b311f+'-'+_0x3fe437+'/'+_0x89a428)[_0x5c8e('0x19')](_0x280d14);}return null;};}function patchUpdates(_0x567874){return function(_0x273f39){try{jsonpatch[_0x5c8e('0x20')](_0x273f39,_0x567874,!![]);}catch(_0x533390){return BPromise[_0x5c8e('0x21')](_0x533390);}return _0x273f39[_0x5c8e('0x22')]();};}function saveUpdates(_0x28010c,_0x5264e6){return function(_0x48a397){if(_0x48a397){return _0x48a397[_0x5c8e('0x23')](_0x28010c)[_0x5c8e('0x24')](function(_0x4f3ae0){return _0x4f3ae0;});}return null;};}function removeEntity(_0x44e800,_0x18273a){return function(_0x581201){if(_0x581201){return _0x581201[_0x5c8e('0x25')]()[_0x5c8e('0x24')](function(){_0x44e800[_0x5c8e('0x17')](0xcc)[_0x5c8e('0x18')]();});}};}function handleEntityNotFound(_0x37e2b4,_0x43538e){return function(_0x4c7c53){if(!_0x4c7c53){_0x37e2b4[_0x5c8e('0x26')](0x194);}return _0x4c7c53;};}function handleError(_0x51b200,_0x298f77){_0x298f77=_0x298f77||0x1f4;return function(_0x3e296e){logger['error'](_0x3e296e[_0x5c8e('0x27')]);if(_0x3e296e['name']){delete _0x3e296e[_0x5c8e('0x28')];}_0x51b200['status'](_0x298f77)[_0x5c8e('0x29')](_0x3e296e);};}exports[_0x5c8e('0x2a')]=function(_0x21c6f6,_0x16f9c1){var _0x2c9863={},_0x12d07f={},_0x277e09={'count':0x0,'rows':[]};var _0x558466=_[_0x5c8e('0x2b')](db[_0x5c8e('0x2c')][_0x5c8e('0x2d')],function(_0x74903a){return{'name':_0x74903a[_0x5c8e('0x2e')],'type':_0x74903a[_0x5c8e('0x2f')][_0x5c8e('0x30')]};});_0x12d07f[_0x5c8e('0x31')]=_['map'](_0x558466,_0x5c8e('0x28'));_0x12d07f[_0x5c8e('0x32')]=_[_0x5c8e('0x33')](_0x21c6f6[_0x5c8e('0x32')]);_0x12d07f[_0x5c8e('0x34')]=_['intersection'](_0x12d07f['model'],_0x12d07f[_0x5c8e('0x32')]);_0x2c9863[_0x5c8e('0x35')]=_[_0x5c8e('0x36')](_0x12d07f[_0x5c8e('0x31')],qs['fields'](_0x21c6f6[_0x5c8e('0x32')][_0x5c8e('0x37')]));_0x2c9863[_0x5c8e('0x35')]=_0x2c9863[_0x5c8e('0x35')][_0x5c8e('0x38')]?_0x2c9863[_0x5c8e('0x35')]:_0x12d07f[_0x5c8e('0x31')];if(!_0x21c6f6[_0x5c8e('0x32')]['hasOwnProperty'](_0x5c8e('0x39'))){_0x2c9863[_0x5c8e('0x1d')]=qs[_0x5c8e('0x1d')](_0x21c6f6['query'][_0x5c8e('0x1d')]);_0x2c9863[_0x5c8e('0x1c')]=qs[_0x5c8e('0x1c')](_0x21c6f6[_0x5c8e('0x32')][_0x5c8e('0x1c')]);}_0x2c9863[_0x5c8e('0x3a')]=qs[_0x5c8e('0x3b')](_0x21c6f6[_0x5c8e('0x32')]['sort']);_0x2c9863['where']=qs[_0x5c8e('0x34')](_['pick'](_0x21c6f6[_0x5c8e('0x32')],_0x12d07f[_0x5c8e('0x34')]),_0x558466);if(_0x21c6f6[_0x5c8e('0x32')][_0x5c8e('0x3c')]){_0x2c9863[_0x5c8e('0x3d')]=_[_0x5c8e('0x3e')](_0x2c9863[_0x5c8e('0x3d')],{'$or':_[_0x5c8e('0x2b')](_0x558466,function(_0x75189a){if(_0x75189a[_0x5c8e('0x2f')]!=='VIRTUAL'){var _0x2e253a={};_0x2e253a[_0x75189a[_0x5c8e('0x28')]]={'$like':'%'+_0x21c6f6['query'][_0x5c8e('0x3c')]+'%'};return _0x2e253a;}})});}_0x2c9863=_[_0x5c8e('0x3e')]({},_0x2c9863,_0x21c6f6[_0x5c8e('0x3f')]);var _0x3506c8={'where':_0x2c9863[_0x5c8e('0x3d')]};return db[_0x5c8e('0x2c')]['count'](_0x3506c8)[_0x5c8e('0x24')](function(_0x17019e){_0x277e09[_0x5c8e('0x1b')]=_0x17019e;if(_0x21c6f6['query'][_0x5c8e('0x40')]){_0x2c9863[_0x5c8e('0x41')]=[{'all':!![]}];}return db['Attachment'][_0x5c8e('0x42')](_0x2c9863);})[_0x5c8e('0x24')](function(_0x3f21e4){_0x277e09[_0x5c8e('0x43')]=_0x3f21e4;return _0x277e09;})[_0x5c8e('0x24')](respondWithFilteredResult(_0x16f9c1,_0x2c9863))[_0x5c8e('0x44')](handleError(_0x16f9c1,null));};exports['show']=function(_0x48be33,_0x4ea88e){var _0xe020bb={'raw':!![],'where':{'id':_0x48be33[_0x5c8e('0x45')]['id']}},_0x5c3bf3={};_0x5c3bf3['model']=_['keys'](db['Attachment'][_0x5c8e('0x2d')]);_0x5c3bf3[_0x5c8e('0x32')]=_[_0x5c8e('0x33')](_0x48be33[_0x5c8e('0x32')]);_0x5c3bf3[_0x5c8e('0x34')]=_[_0x5c8e('0x36')](_0x5c3bf3[_0x5c8e('0x31')],_0x5c3bf3[_0x5c8e('0x32')]);_0xe020bb[_0x5c8e('0x35')]=_[_0x5c8e('0x36')](_0x5c3bf3[_0x5c8e('0x31')],qs[_0x5c8e('0x37')](_0x48be33[_0x5c8e('0x32')][_0x5c8e('0x37')]));_0xe020bb[_0x5c8e('0x35')]=_0xe020bb[_0x5c8e('0x35')]['length']?_0xe020bb[_0x5c8e('0x35')]:_0x5c3bf3['model'];if(_0x48be33[_0x5c8e('0x32')][_0x5c8e('0x40')]){_0xe020bb['include']=[{'all':!![]}];}_0xe020bb=_[_0x5c8e('0x3e')]({},_0xe020bb,_0x48be33[_0x5c8e('0x3f')]);return db[_0x5c8e('0x2c')]['find'](_0xe020bb)[_0x5c8e('0x24')](handleEntityNotFound(_0x4ea88e,null))[_0x5c8e('0x24')](respondWithResult(_0x4ea88e,null))[_0x5c8e('0x44')](handleError(_0x4ea88e,null));};exports['clone']=function(_0x173aed,_0x3a63e3){var _0x522c78={'where':{'id':_0x173aed[_0x5c8e('0x45')]['id']}},_0x372fd5={};_0x372fd5[_0x5c8e('0x31')]=_['keys'](db[_0x5c8e('0x2c')][_0x5c8e('0x2d')]);_0x522c78['attributes']=_['intersection'](_0x372fd5['model'],qs[_0x5c8e('0x37')](_0x173aed['query']['fields']));_0x522c78['attributes']=_0x522c78['attributes'][_0x5c8e('0x38')]?_0x522c78[_0x5c8e('0x35')]:_0x372fd5['model'];if(_0x173aed[_0x5c8e('0x32')]['includeAll']){_0x522c78[_0x5c8e('0x41')]=[{'all':!![]}];}_0x522c78=_[_0x5c8e('0x3e')]({},_0x522c78,_0x173aed[_0x5c8e('0x3f')]);return db[_0x5c8e('0x2c')][_0x5c8e('0x46')](_0x522c78)[_0x5c8e('0x24')](handleEntityNotFound(_0x3a63e3,null))[_0x5c8e('0x24')](function(_0x2b3417){if(_0x2b3417){var _0xaa52d4=_0x2b3417[_0x5c8e('0x47')]({'plain':!![]});_0xaa52d4=qs['omit'](_0xaa52d4,['id','createdAt','updatedAt']);_0x173aed['body']=_[_0x5c8e('0x48')](_0x173aed[_0x5c8e('0x49')],['id',_0x5c8e('0x4a'),'updatedAt']);return db['Attachment'][_0x5c8e('0x4b')](_['merge'](_0xaa52d4,_0x173aed[_0x5c8e('0x49')]),{'include':_0x173aed['query'][_0x5c8e('0x40')]?[{'all':!![]}]:undefined});}})[_0x5c8e('0x24')](respondWithResult(_0x3a63e3,0xc9))[_0x5c8e('0x44')](handleError(_0x3a63e3,null));};exports[_0x5c8e('0x23')]=function(_0x13214a,_0x402eea){if(_0x13214a[_0x5c8e('0x49')]['id']){delete _0x13214a[_0x5c8e('0x49')]['id'];}return db['Attachment'][_0x5c8e('0x46')]({'where':{'id':_0x13214a[_0x5c8e('0x45')]['id']}})[_0x5c8e('0x24')](handleEntityNotFound(_0x402eea,null))[_0x5c8e('0x24')](saveUpdates(_0x13214a['body'],null))[_0x5c8e('0x24')](respondWithResult(_0x402eea,null))[_0x5c8e('0x44')](handleError(_0x402eea,null));};exports[_0x5c8e('0x25')]=function(_0xd7b80d,_0x55b190){return db[_0x5c8e('0x2c')][_0x5c8e('0x46')]({'where':{'id':_0xd7b80d[_0x5c8e('0x45')]['id']}})[_0x5c8e('0x24')](handleEntityNotFound(_0x55b190,null))[_0x5c8e('0x24')](removeEntity(_0x55b190,null))['catch'](handleError(_0x55b190,null));};exports['create']=function(_0x5eae33,_0x917947,_0x71fe1){_0x5eae33[_0x5c8e('0x49')][_0x5c8e('0x28')]=_0x5eae33[_0x5c8e('0x4c')]['originalname'];_0x5eae33[_0x5c8e('0x49')][_0x5c8e('0x4d')]=_0x5eae33[_0x5c8e('0x4c')][_0x5c8e('0x4e')];_0x5eae33[_0x5c8e('0x49')][_0x5c8e('0x2f')]=_0x5eae33['file'][_0x5c8e('0x4f')];return db[_0x5c8e('0x2c')][_0x5c8e('0x4b')](_0x5eae33[_0x5c8e('0x49')])[_0x5c8e('0x24')](respondWithResult(_0x917947,0xc9))[_0x5c8e('0x44')](handleError(_0x917947,null));};exports[_0x5c8e('0x50')]=function(_0x47238b,_0x16ac58,_0x3e4083){return db['Attachment'][_0x5c8e('0x51')]({'where':{'id':_0x47238b[_0x5c8e('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x16ac58,null))['then'](function(_0x52d377){if(_0x52d377){var _0x202257=_0x52d377[_0x5c8e('0x52')]!==null;var _0x46e708=path[_0x5c8e('0x53')](config['root'],_0x5c8e('0x54'));if(_0x202257){_0x46e708=path[_0x5c8e('0x53')](_0x46e708,_0x5c8e('0x55'));}var _0x5679bd=path[_0x5c8e('0x53')](_0x46e708,_0x52d377[_0x5c8e('0x4d')]);return _0x16ac58[_0x5c8e('0x50')](_0x5679bd);}})[_0x5c8e('0x44')](handleError(_0x16ac58,null));}; \ No newline at end of file +var _0xc1b6=['moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','save','update','then','destroy','error','name','send','index','map','Attachment','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','clone','get','omit','createdAt','body','create','file','originalname','filename','mimetype','download','findOne','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x2a6773,_0x4fc9f1){var _0x30e631=function(_0x44210f){while(--_0x44210f){_0x2a6773['push'](_0x2a6773['shift']());}};_0x30e631(++_0x4fc9f1);}(_0xc1b6,0xa8));var _0x6c1b=function(_0x212348,_0x55415c){_0x212348=_0x212348-0x0;var _0x1696e9=_0xc1b6[_0x212348];return _0x1696e9;};'use strict';var emlformat=require(_0x6c1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c1b('0x1'));var jsonpatch=require(_0x6c1b('0x2'));var rp=require(_0x6c1b('0x3'));var moment=require(_0x6c1b('0x4'));var BPromise=require(_0x6c1b('0x5'));var Mustache=require(_0x6c1b('0x6'));var util=require(_0x6c1b('0x7'));var path=require(_0x6c1b('0x8'));var sox=require(_0x6c1b('0x9'));var csv=require(_0x6c1b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1b('0xb'));var _=require(_0x6c1b('0xc'));var squel=require('squel');var crypto=require(_0x6c1b('0xd'));var jsforce=require(_0x6c1b('0xe'));var deskjs=require(_0x6c1b('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6c1b('0x10'));var Redis=require(_0x6c1b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6c1b('0x12'));var logger=require(_0x6c1b('0x13'))('api');var utils=require(_0x6c1b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6c1b('0x15'));var db=require(_0x6c1b('0x16'))['db'];function respondWithStatusCode(_0x420113,_0x5e1ee2){_0x5e1ee2=_0x5e1ee2||0xcc;return function(_0x2c58ec){if(_0x2c58ec){return _0x420113[_0x6c1b('0x17')](_0x5e1ee2);}return _0x420113[_0x6c1b('0x18')](_0x5e1ee2)[_0x6c1b('0x19')]();};}function respondWithResult(_0x4cc53c,_0x18de3a){_0x18de3a=_0x18de3a||0xc8;return function(_0x4d567d){if(_0x4d567d){return _0x4cc53c['status'](_0x18de3a)[_0x6c1b('0x1a')](_0x4d567d);}};}function respondWithFilteredResult(_0x545208,_0x323f97){return function(_0x40f65d){if(_0x40f65d){var _0x3df97f=typeof _0x323f97[_0x6c1b('0x1b')]===_0x6c1b('0x1c')&&typeof _0x323f97['limit']==='undefined';var _0x3dd05e=_0x40f65d['count'];var _0x3d0ec0=_0x3df97f?0x0:_0x323f97[_0x6c1b('0x1b')];var _0x2ba1b5=_0x3df97f?_0x40f65d['count']:_0x323f97['offset']+_0x323f97[_0x6c1b('0x1d')];var _0x5c84db;if(_0x2ba1b5>=_0x3dd05e){_0x2ba1b5=_0x3dd05e;_0x5c84db=0xc8;}else{_0x5c84db=0xce;}_0x545208[_0x6c1b('0x18')](_0x5c84db);return _0x545208[_0x6c1b('0x1e')]('Content-Range',_0x3d0ec0+'-'+_0x2ba1b5+'/'+_0x3dd05e)[_0x6c1b('0x1a')](_0x40f65d);}return null;};}function patchUpdates(_0x32f0e5){return function(_0x28b681){try{jsonpatch['apply'](_0x28b681,_0x32f0e5,!![]);}catch(_0x556b8b){return BPromise['reject'](_0x556b8b);}return _0x28b681[_0x6c1b('0x1f')]();};}function saveUpdates(_0x3aa36c,_0x321834){return function(_0x266a74){if(_0x266a74){return _0x266a74[_0x6c1b('0x20')](_0x3aa36c)[_0x6c1b('0x21')](function(_0x5b9302){return _0x5b9302;});}return null;};}function removeEntity(_0x5cd30f,_0x2e1b5c){return function(_0x474f5f){if(_0x474f5f){return _0x474f5f[_0x6c1b('0x22')]()[_0x6c1b('0x21')](function(){_0x5cd30f['status'](0xcc)[_0x6c1b('0x19')]();});}};}function handleEntityNotFound(_0x2b67a8,_0x254092){return function(_0x762a50){if(!_0x762a50){_0x2b67a8[_0x6c1b('0x17')](0x194);}return _0x762a50;};}function handleError(_0xc4b925,_0x44eda1){_0x44eda1=_0x44eda1||0x1f4;return function(_0x346a8f){logger[_0x6c1b('0x23')](_0x346a8f['stack']);if(_0x346a8f[_0x6c1b('0x24')]){delete _0x346a8f[_0x6c1b('0x24')];}_0xc4b925[_0x6c1b('0x18')](_0x44eda1)[_0x6c1b('0x25')](_0x346a8f);};}exports[_0x6c1b('0x26')]=function(_0x1b3f5a,_0x1a1dec){var _0x1c4ee4={},_0x312dfc={},_0x47f5b3={'count':0x0,'rows':[]};var _0x4817b9=_[_0x6c1b('0x27')](db[_0x6c1b('0x28')][_0x6c1b('0x29')],function(_0x160143){return{'name':_0x160143[_0x6c1b('0x2a')],'type':_0x160143['type']['key']};});_0x312dfc['model']=_[_0x6c1b('0x27')](_0x4817b9,_0x6c1b('0x24'));_0x312dfc[_0x6c1b('0x2b')]=_[_0x6c1b('0x2c')](_0x1b3f5a[_0x6c1b('0x2b')]);_0x312dfc[_0x6c1b('0x2d')]=_[_0x6c1b('0x2e')](_0x312dfc[_0x6c1b('0x2f')],_0x312dfc[_0x6c1b('0x2b')]);_0x1c4ee4[_0x6c1b('0x30')]=_['intersection'](_0x312dfc[_0x6c1b('0x2f')],qs[_0x6c1b('0x31')](_0x1b3f5a[_0x6c1b('0x2b')]['fields']));_0x1c4ee4['attributes']=_0x1c4ee4[_0x6c1b('0x30')][_0x6c1b('0x32')]?_0x1c4ee4[_0x6c1b('0x30')]:_0x312dfc[_0x6c1b('0x2f')];if(!_0x1b3f5a[_0x6c1b('0x2b')][_0x6c1b('0x33')]('nolimit')){_0x1c4ee4['limit']=qs[_0x6c1b('0x1d')](_0x1b3f5a['query']['limit']);_0x1c4ee4['offset']=qs['offset'](_0x1b3f5a[_0x6c1b('0x2b')]['offset']);}_0x1c4ee4['order']=qs[_0x6c1b('0x34')](_0x1b3f5a['query']['sort']);_0x1c4ee4[_0x6c1b('0x35')]=qs[_0x6c1b('0x2d')](_[_0x6c1b('0x36')](_0x1b3f5a[_0x6c1b('0x2b')],_0x312dfc['filters']),_0x4817b9);if(_0x1b3f5a[_0x6c1b('0x2b')][_0x6c1b('0x37')]){_0x1c4ee4[_0x6c1b('0x35')]=_[_0x6c1b('0x38')](_0x1c4ee4[_0x6c1b('0x35')],{'$or':_[_0x6c1b('0x27')](_0x4817b9,function(_0x2e3f71){if(_0x2e3f71[_0x6c1b('0x39')]!==_0x6c1b('0x3a')){var _0x5d91dc={};_0x5d91dc[_0x2e3f71[_0x6c1b('0x24')]]={'$like':'%'+_0x1b3f5a[_0x6c1b('0x2b')]['filter']+'%'};return _0x5d91dc;}})});}_0x1c4ee4=_['merge']({},_0x1c4ee4,_0x1b3f5a[_0x6c1b('0x3b')]);var _0x34c788={'where':_0x1c4ee4['where']};return db[_0x6c1b('0x28')][_0x6c1b('0x3c')](_0x34c788)[_0x6c1b('0x21')](function(_0x547c69){_0x47f5b3['count']=_0x547c69;if(_0x1b3f5a[_0x6c1b('0x2b')][_0x6c1b('0x3d')]){_0x1c4ee4[_0x6c1b('0x3e')]=[{'all':!![]}];}return db[_0x6c1b('0x28')][_0x6c1b('0x3f')](_0x1c4ee4);})[_0x6c1b('0x21')](function(_0x46ab5a){_0x47f5b3[_0x6c1b('0x40')]=_0x46ab5a;return _0x47f5b3;})[_0x6c1b('0x21')](respondWithFilteredResult(_0x1a1dec,_0x1c4ee4))[_0x6c1b('0x41')](handleError(_0x1a1dec,null));};exports[_0x6c1b('0x42')]=function(_0x18a866,_0x58e04c){var _0x42fef0={'raw':!![],'where':{'id':_0x18a866[_0x6c1b('0x43')]['id']}},_0x3c83db={};_0x3c83db[_0x6c1b('0x2f')]=_['keys'](db[_0x6c1b('0x28')][_0x6c1b('0x29')]);_0x3c83db['query']=_[_0x6c1b('0x2c')](_0x18a866[_0x6c1b('0x2b')]);_0x3c83db[_0x6c1b('0x2d')]=_[_0x6c1b('0x2e')](_0x3c83db['model'],_0x3c83db[_0x6c1b('0x2b')]);_0x42fef0['attributes']=_[_0x6c1b('0x2e')](_0x3c83db[_0x6c1b('0x2f')],qs[_0x6c1b('0x31')](_0x18a866[_0x6c1b('0x2b')][_0x6c1b('0x31')]));_0x42fef0[_0x6c1b('0x30')]=_0x42fef0[_0x6c1b('0x30')]['length']?_0x42fef0['attributes']:_0x3c83db[_0x6c1b('0x2f')];if(_0x18a866[_0x6c1b('0x2b')][_0x6c1b('0x3d')]){_0x42fef0[_0x6c1b('0x3e')]=[{'all':!![]}];}_0x42fef0=_[_0x6c1b('0x38')]({},_0x42fef0,_0x18a866[_0x6c1b('0x3b')]);return db[_0x6c1b('0x28')][_0x6c1b('0x44')](_0x42fef0)[_0x6c1b('0x21')](handleEntityNotFound(_0x58e04c,null))[_0x6c1b('0x21')](respondWithResult(_0x58e04c,null))['catch'](handleError(_0x58e04c,null));};exports[_0x6c1b('0x45')]=function(_0x263eca,_0x2fdb41){var _0x2a9922={'where':{'id':_0x263eca['params']['id']}},_0x5cff86={};_0x5cff86[_0x6c1b('0x2f')]=_[_0x6c1b('0x2c')](db[_0x6c1b('0x28')][_0x6c1b('0x29')]);_0x2a9922['attributes']=_[_0x6c1b('0x2e')](_0x5cff86[_0x6c1b('0x2f')],qs['fields'](_0x263eca[_0x6c1b('0x2b')]['fields']));_0x2a9922[_0x6c1b('0x30')]=_0x2a9922[_0x6c1b('0x30')][_0x6c1b('0x32')]?_0x2a9922[_0x6c1b('0x30')]:_0x5cff86[_0x6c1b('0x2f')];if(_0x263eca[_0x6c1b('0x2b')][_0x6c1b('0x3d')]){_0x2a9922[_0x6c1b('0x3e')]=[{'all':!![]}];}_0x2a9922=_[_0x6c1b('0x38')]({},_0x2a9922,_0x263eca[_0x6c1b('0x3b')]);return db[_0x6c1b('0x28')][_0x6c1b('0x44')](_0x2a9922)['then'](handleEntityNotFound(_0x2fdb41,null))[_0x6c1b('0x21')](function(_0x26af5a){if(_0x26af5a){var _0x3d6647=_0x26af5a[_0x6c1b('0x46')]({'plain':!![]});_0x3d6647=qs[_0x6c1b('0x47')](_0x3d6647,['id',_0x6c1b('0x48'),'updatedAt']);_0x263eca['body']=_[_0x6c1b('0x47')](_0x263eca[_0x6c1b('0x49')],['id',_0x6c1b('0x48'),'updatedAt']);return db['Attachment']['create'](_[_0x6c1b('0x38')](_0x3d6647,_0x263eca[_0x6c1b('0x49')]),{'include':_0x263eca[_0x6c1b('0x2b')][_0x6c1b('0x3d')]?[{'all':!![]}]:undefined});}})[_0x6c1b('0x21')](respondWithResult(_0x2fdb41,0xc9))[_0x6c1b('0x41')](handleError(_0x2fdb41,null));};exports['update']=function(_0x119dec,_0x2376ba){if(_0x119dec[_0x6c1b('0x49')]['id']){delete _0x119dec['body']['id'];}return db[_0x6c1b('0x28')][_0x6c1b('0x44')]({'where':{'id':_0x119dec[_0x6c1b('0x43')]['id']}})[_0x6c1b('0x21')](handleEntityNotFound(_0x2376ba,null))['then'](saveUpdates(_0x119dec[_0x6c1b('0x49')],null))['then'](respondWithResult(_0x2376ba,null))[_0x6c1b('0x41')](handleError(_0x2376ba,null));};exports[_0x6c1b('0x22')]=function(_0x978d9a,_0xdf7702){return db[_0x6c1b('0x28')][_0x6c1b('0x44')]({'where':{'id':_0x978d9a[_0x6c1b('0x43')]['id']}})[_0x6c1b('0x21')](handleEntityNotFound(_0xdf7702,null))[_0x6c1b('0x21')](removeEntity(_0xdf7702,null))[_0x6c1b('0x41')](handleError(_0xdf7702,null));};exports[_0x6c1b('0x4a')]=function(_0xce3760,_0x4c4841,_0x2da76b){_0xce3760[_0x6c1b('0x49')][_0x6c1b('0x24')]=_0xce3760[_0x6c1b('0x4b')][_0x6c1b('0x4c')];_0xce3760[_0x6c1b('0x49')]['basename']=_0xce3760[_0x6c1b('0x4b')][_0x6c1b('0x4d')];_0xce3760['body'][_0x6c1b('0x39')]=_0xce3760[_0x6c1b('0x4b')][_0x6c1b('0x4e')];return db[_0x6c1b('0x28')][_0x6c1b('0x4a')](_0xce3760[_0x6c1b('0x49')])[_0x6c1b('0x21')](respondWithResult(_0x4c4841,0xc9))[_0x6c1b('0x41')](handleError(_0x4c4841,null));};exports[_0x6c1b('0x4f')]=function(_0x318588,_0xf64ac6,_0x52f35d){return db[_0x6c1b('0x28')][_0x6c1b('0x50')]({'where':{'id':_0x318588[_0x6c1b('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xf64ac6,null))[_0x6c1b('0x21')](function(_0x4c3a07){if(_0x4c3a07){var _0x34ba4e=_0x4c3a07[_0x6c1b('0x51')]!==null;var _0x4a33dc=path[_0x6c1b('0x52')](config['root'],_0x6c1b('0x53'));if(_0x34ba4e){_0x4a33dc=path[_0x6c1b('0x52')](_0x4a33dc,_0x6c1b('0x54'));}var _0x1f970b=path[_0x6c1b('0x52')](_0x4a33dc,_0x4c3a07[_0x6c1b('0x55')]);return _0xf64ac6[_0x6c1b('0x4f')](_0x1f970b);}})[_0x6c1b('0x41')](handleError(_0xf64ac6,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index af727d2..b3c26fb 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 _0xa686=['../../config/logger','moment','bluebird','request-promise','rimraf','./attachment.attributes','define','attachments','lodash','util'];(function(_0x4370cc,_0xa2d157){var _0x3214c7=function(_0x29e0e9){while(--_0x29e0e9){_0x4370cc['push'](_0x4370cc['shift']());}};_0x3214c7(++_0xa2d157);}(_0xa686,0xc6));var _0x6a68=function(_0x46a003,_0x56cb62){_0x46a003=_0x46a003-0x0;var _0x4d0baf=_0xa686[_0x46a003];return _0x4d0baf;};'use strict';var _=require(_0x6a68('0x0'));var util=require(_0x6a68('0x1'));var logger=require(_0x6a68('0x2'))('api');var moment=require(_0x6a68('0x3'));var BPromise=require(_0x6a68('0x4'));var rp=require(_0x6a68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a68('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a68('0x7'));module['exports']=function(_0x5cb288,_0x52f474){return _0x5cb288[_0x6a68('0x8')]('Attachment',attributes,{'tableName':_0x6a68('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f02=['request-promise','path','../../config/environment','exports','define','Attachment','attachments','util','../../config/logger','api','bluebird'];(function(_0x4d77a4,_0x3be85a){var _0x15a00e=function(_0x3dc23b){while(--_0x3dc23b){_0x4d77a4['push'](_0x4d77a4['shift']());}};_0x15a00e(++_0x3be85a);}(_0x3f02,0xee));var _0x23f0=function(_0x3f6b1b,_0x58d3d6){_0x3f6b1b=_0x3f6b1b-0x0;var _0x4a3d2b=_0x3f02[_0x3f6b1b];return _0x4a3d2b;};'use strict';var _=require('lodash');var util=require(_0x23f0('0x0'));var logger=require(_0x23f0('0x1'))(_0x23f0('0x2'));var moment=require('moment');var BPromise=require(_0x23f0('0x3'));var rp=require(_0x23f0('0x4'));var fs=require('fs');var path=require(_0x23f0('0x5'));var rimraf=require('rimraf');var config=require(_0x23f0('0x6'));var attributes=require('./attachment.attributes');module[_0x23f0('0x7')]=function(_0x6e2c0,_0x5e9449){return _0x6e2c0[_0x23f0('0x8')](_0x23f0('0x9'),attributes,{'tableName':_0x23f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index c8d5212..6a4082c 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 _0xf194=['info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','code','error','message','result','CreateAttachment','Attachment','create','options','stringify','catch','lodash','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf194,0x91));var _0x4f19=function(_0x41b6db,_0x3c962b){_0x41b6db=_0x41b6db-0x0;var _0x4d29dc=_0xf194[_0x41b6db];return _0x4d29dc;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var moment=require(_0x4f19('0x2'));var BPromise=require(_0x4f19('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f19('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f19('0x5'));var config=require(_0x4f19('0x6'));var jayson=require(_0x4f19('0x7'));var client=jayson['client'][_0x4f19('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45c88a,_0x514d93,_0x4b023f){return new BPromise(function(_0x265d15,_0x116780){return client[_0x4f19('0x9')](_0x45c88a,_0x4b023f)[_0x4f19('0xa')](function(_0x4aaf89){logger[_0x4f19('0xb')](_0x4f19('0xc'),_0x514d93,_0x4f19('0xd'));logger[_0x4f19('0xe')](_0x4f19('0xf'),_0x514d93,_0x4f19('0xd'),JSON['stringify'](_0x4aaf89));if(_0x4aaf89['error']){if(_0x4aaf89['error'][_0x4f19('0x10')]===0x1f4){logger[_0x4f19('0x11')]('Attachment,\x20%s,\x20%s',_0x514d93,_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);return _0x116780(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}logger['error'](_0x4f19('0xc'),_0x514d93,_0x4aaf89[_0x4f19('0x11')]['message']);return _0x265d15(_0x4aaf89[_0x4f19('0x11')][_0x4f19('0x12')]);}else{logger['info'](_0x4f19('0xc'),_0x514d93,'request\x20sent');_0x265d15(_0x4aaf89[_0x4f19('0x13')][_0x4f19('0x12')]);}})['catch'](function(_0x4d8021){logger[_0x4f19('0x11')](_0x4f19('0xc'),_0x514d93,_0x4d8021);_0x116780(_0x4d8021);});});}exports[_0x4f19('0x14')]=function(_0x576eef){var _0x1d9bf3=this;return new Promise(function(_0x205fee,_0x1b4d79){return db[_0x4f19('0x15')][_0x4f19('0x16')](_0x576eef['body'],{'raw':_0x576eef[_0x4f19('0x17')]?_0x576eef[_0x4f19('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x4f19('0xa')](function(_0x14ff93){logger[_0x4f19('0xb')](_0x4f19('0x14'),_0x576eef);logger['debug'](_0x4f19('0x14'),_0x576eef,JSON[_0x4f19('0x18')](_0x14ff93));_0x205fee(_0x14ff93);})[_0x4f19('0x19')](function(_0xcbe002){logger[_0x4f19('0x11')](_0x4f19('0x14'),_0xcbe002[_0x4f19('0x12')],_0x576eef);_0x1b4d79(_0x1d9bf3[_0x4f19('0x11')](0x1f4,_0xcbe002[_0x4f19('0x12')]));});});}; \ No newline at end of file +var _0xad95=['ioredis','../../mysqldb','rpc','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','util','moment'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xad95,0x70));var _0x5ad9=function(_0x313477,_0x2c636c){_0x313477=_0x313477-0x0;var _0x2902a0=_0xad95[_0x313477];return _0x2902a0;};'use strict';var _=require(_0x5ad9('0x0'));var util=require(_0x5ad9('0x1'));var moment=require(_0x5ad9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ad9('0x3'));var db=require(_0x5ad9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5ad9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2bef4e,_0x117fde,_0x2a0915){return new BPromise(function(_0x3d937a,_0x404b33){return client['request'](_0x2bef4e,_0x2a0915)[_0x5ad9('0x6')](function(_0x4fdb7b){logger['info'](_0x5ad9('0x7'),_0x117fde,_0x5ad9('0x8'));logger[_0x5ad9('0x9')]('Attachment,\x20%s,\x20%s,\x20%s',_0x117fde,_0x5ad9('0x8'),JSON[_0x5ad9('0xa')](_0x4fdb7b));if(_0x4fdb7b['error']){if(_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xc')]===0x1f4){logger[_0x5ad9('0xb')](_0x5ad9('0x7'),_0x117fde,_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xd')]);return _0x404b33(_0x4fdb7b['error']['message']);}logger['error'](_0x5ad9('0x7'),_0x117fde,_0x4fdb7b[_0x5ad9('0xb')]['message']);return _0x3d937a(_0x4fdb7b[_0x5ad9('0xb')][_0x5ad9('0xd')]);}else{logger[_0x5ad9('0xe')](_0x5ad9('0x7'),_0x117fde,_0x5ad9('0x8'));_0x3d937a(_0x4fdb7b[_0x5ad9('0xf')][_0x5ad9('0xd')]);}})[_0x5ad9('0x10')](function(_0x36e61f){logger[_0x5ad9('0xb')]('Attachment,\x20%s,\x20%s',_0x117fde,_0x36e61f);_0x404b33(_0x36e61f);});});}exports[_0x5ad9('0x11')]=function(_0x54f392){var _0x3d1c8f=this;return new Promise(function(_0x28682f,_0xe4171b){return db[_0x5ad9('0x12')][_0x5ad9('0x13')](_0x54f392[_0x5ad9('0x14')],{'raw':_0x54f392[_0x5ad9('0x15')]?_0x54f392['options'][_0x5ad9('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x49363b){logger[_0x5ad9('0xe')]('CreateAttachment',_0x54f392);logger[_0x5ad9('0x9')](_0x5ad9('0x11'),_0x54f392,JSON[_0x5ad9('0xa')](_0x49363b));_0x28682f(_0x49363b);})[_0x5ad9('0x10')](function(_0x1274f7){logger['error'](_0x5ad9('0x11'),_0x1274f7['message'],_0x54f392);_0xe4171b(_0x3d1c8f[_0x5ad9('0xb')](0x1f4,_0x1274f7['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 0cfb9ef..87d2f5a 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x3c7b15,_0x4eeab6){var _0x40044c=function(_0x4283b3){while(--_0x4283b3){_0x3c7b15['push'](_0x3c7b15['shift']());}};_0x40044c(++_0x4eeab6);}(_0xb10b,0x12a));var _0xbb10=function(_0x12d93a,_0x460b08){_0x12d93a=_0x12d93a-0x0;var _0x5e0913=_0xb10b[_0x12d93a];return _0x5e0913;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb28,0x106));var _0x8db2=function(_0x227b10,_0x4658fd){_0x227b10=_0x227b10-0x0;var _0x2fe070=_0xdb28[_0x227b10];return _0x2fe070;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./attachment.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['post'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index b2d7e2e..6262107 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 _0xa932=['allowedLoginAttempts','blockDuration','User','find','map','emails','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','minutes','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../config/environment','../../components/auth/service','signToken','login','google','profile','callback','authenticate','/login','clientID','clientSecret','callbackURL','Setting'];(function(_0x52ed18,_0x722adb){var _0x5d0a9e=function(_0x464a){while(--_0x464a){_0x52ed18['push'](_0x52ed18['shift']());}};_0x5d0a9e(++_0x722adb);}(_0xa932,0x1d7));var _0x2a93=function(_0x1e028c,_0x2bd5b0){_0x1e028c=_0x1e028c-0x0;var _0x336831=_0xa932[_0x1e028c];return _0x336831;};'use strict';var _=require(_0x2a93('0x0'));var passport=require(_0x2a93('0x1'));var GoogleStrategy=require(_0x2a93('0x2'))[_0x2a93('0x3')];var moment=require(_0x2a93('0x4'));var db=require(_0x2a93('0x5'))['db'];var config=require(_0x2a93('0x6'));var signToken=require(_0x2a93('0x7'))[_0x2a93('0x8')];var utils=require('../../config/utils');exports[_0x2a93('0x9')]=passport['authenticate'](_0x2a93('0xa'),{'failureRedirect':'/login','scope':[_0x2a93('0xb'),'email'],'session':![]});exports[_0x2a93('0xc')]=passport[_0x2a93('0xd')](_0x2a93('0xa'),{'failureRedirect':_0x2a93('0xe'),'session':![]});passport['use'](new GoogleStrategy({'clientID':config[_0x2a93('0xa')]?config['google'][_0x2a93('0xf')]:'id','clientSecret':config[_0x2a93('0xa')]?config[_0x2a93('0xa')][_0x2a93('0x10')]:'secret','callbackURL':config[_0x2a93('0xa')]?config['google'][_0x2a93('0x11')]:''},function(_0x40f930,_0x11e422,_0x14004f,_0x26c26d){var _0x4d1f97,_0x2f6abb;return db[_0x2a93('0x12')]['findOne']({'where':{'id':0x1},'attributes':[_0x2a93('0x13'),_0x2a93('0x14')],'raw':!![]})['then'](function(_0x139af1){_0x4d1f97=_0x139af1;return db[_0x2a93('0x15')][_0x2a93('0x16')]({'where':{'email':_[_0x2a93('0x17')](_0x14004f[_0x2a93('0x18')],'value'),'role':{'$or':[_0x2a93('0x19'),_0x2a93('0x1a'),_0x2a93('0x1b')]}}});})[_0x2a93('0x1c')](function(_0x4355ec){_0x2f6abb=_0x4355ec;if(_0x2f6abb){if(_0x2f6abb['disabled']){return _0x26c26d(_0x2a93('0x1d'));}else if(_0x4d1f97[_0x2a93('0x14')]>0x0){if(_0x2f6abb[_0x2a93('0x1e')]){if(moment(_0x2f6abb[_0x2a93('0x1f')])['add'](_0x4d1f97[_0x2a93('0x14')],_0x2a93('0x20'))>moment()){return _0x26c26d(_0x2a93('0x1d'));}else{return utils['clearBlockUser'](_0x2f6abb,0x0,![],null)[_0x2a93('0x1c')](function(){return utils[_0x2a93('0x21')](_0x2f6abb);})[_0x2a93('0x1c')](function(){return _0x26c26d(null,_0x2f6abb);});}}else{return utils['getLicense'](_0x2f6abb)[_0x2a93('0x1c')](function(){return _0x26c26d(null,_0x2f6abb);});}}else{return utils[_0x2a93('0x21')](_0x2f6abb)[_0x2a93('0x1c')](function(){return _0x26c26d(null,_0x2f6abb);});}}return _0x26c26d(_0x2a93('0x1d'));})[_0x2a93('0x22')](function(_0x2b958d){_0x26c26d(_0x2b958d);});})); \ No newline at end of file +var _0xd328=['getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../config/environment','../../components/auth/service','../../config/utils','login','authenticate','google','/login','profile','email','use','clientSecret','secret','callbackURL','Setting','allowedLoginAttempts','blockDuration','then','User','find','emails','admin','user','agent','disabled','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser'];(function(_0x25f9ac,_0x3c3cff){var _0x352783=function(_0x1cdda9){while(--_0x1cdda9){_0x25f9ac['push'](_0x25f9ac['shift']());}};_0x352783(++_0x3c3cff);}(_0xd328,0x13d));var _0x8d32=function(_0x1f3193,_0x49da07){_0x1f3193=_0x1f3193-0x0;var _0x27b09e=_0xd328[_0x1f3193];return _0x27b09e;};'use strict';var _=require(_0x8d32('0x0'));var passport=require(_0x8d32('0x1'));var GoogleStrategy=require(_0x8d32('0x2'))['Strategy'];var moment=require(_0x8d32('0x3'));var db=require('../../mysqldb')['db'];var config=require(_0x8d32('0x4'));var signToken=require(_0x8d32('0x5'))['signToken'];var utils=require(_0x8d32('0x6'));exports[_0x8d32('0x7')]=passport[_0x8d32('0x8')](_0x8d32('0x9'),{'failureRedirect':_0x8d32('0xa'),'scope':[_0x8d32('0xb'),_0x8d32('0xc')],'session':![]});exports['callback']=passport[_0x8d32('0x8')](_0x8d32('0x9'),{'failureRedirect':_0x8d32('0xa'),'session':![]});passport[_0x8d32('0xd')](new GoogleStrategy({'clientID':config[_0x8d32('0x9')]?config[_0x8d32('0x9')]['clientID']:'id','clientSecret':config[_0x8d32('0x9')]?config[_0x8d32('0x9')][_0x8d32('0xe')]:_0x8d32('0xf'),'callbackURL':config['google']?config[_0x8d32('0x9')][_0x8d32('0x10')]:''},function(_0x40bc2a,_0x488502,_0x1727db,_0x5d641e){var _0x2b1c6e,_0xb542b2;return db[_0x8d32('0x11')]['findOne']({'where':{'id':0x1},'attributes':[_0x8d32('0x12'),_0x8d32('0x13')],'raw':!![]})[_0x8d32('0x14')](function(_0x15afa7){_0x2b1c6e=_0x15afa7;return db[_0x8d32('0x15')][_0x8d32('0x16')]({'where':{'email':_['map'](_0x1727db[_0x8d32('0x17')],'value'),'role':{'$or':[_0x8d32('0x18'),_0x8d32('0x19'),_0x8d32('0x1a')]}}});})[_0x8d32('0x14')](function(_0x161c0a){_0xb542b2=_0x161c0a;if(_0xb542b2){if(_0xb542b2[_0x8d32('0x1b')]){return _0x5d641e('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x2b1c6e['blockDuration']>0x0){if(_0xb542b2['blocked']){if(moment(_0xb542b2[_0x8d32('0x1c')])[_0x8d32('0x1d')](_0x2b1c6e[_0x8d32('0x13')],_0x8d32('0x1e'))>moment()){return _0x5d641e(_0x8d32('0x1f'));}else{return utils[_0x8d32('0x20')](_0xb542b2,0x0,![],null)['then'](function(){return utils[_0x8d32('0x21')](_0xb542b2);})['then'](function(){return _0x5d641e(null,_0xb542b2);});}}else{return utils[_0x8d32('0x21')](_0xb542b2)['then'](function(){return _0x5d641e(null,_0xb542b2);});}}else{return utils[_0x8d32('0x21')](_0xb542b2)[_0x8d32('0x14')](function(){return _0x5d641e(null,_0xb542b2);});}}return _0x5d641e(_0x8d32('0x1f'));})[_0x8d32('0x22')](function(_0x78a403){_0x5d641e(_0x78a403);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index dd2ac78..9b8c286 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 _0x7288=['isMiddleware','login','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','get'];(function(_0x17421a,_0x138b91){var _0x3d4c2a=function(_0x2b4a8b){while(--_0x2b4a8b){_0x17421a['push'](_0x17421a['shift']());}};_0x3d4c2a(++_0x138b91);}(_0x7288,0x144));var _0x8728=function(_0x117795,_0x49281c){_0x117795=_0x117795-0x0;var _0x306edf=_0x7288[_0x117795];return _0x306edf;};'use strict';var express=require(_0x8728('0x0'));var passport=require(_0x8728('0x1'));var router=express[_0x8728('0x2')]();var controller=require(_0x8728('0x3'));var userController=require(_0x8728('0x4'));var authService=require('../../components/auth/service');router[_0x8728('0x5')]('/',controller['login']);router[_0x8728('0x5')]('/callback',controller['callback'],authService[_0x8728('0x6')],userController[_0x8728('0x7')],authService[_0x8728('0x8')]);module[_0x8728('0x9')]=router; \ No newline at end of file +var _0xd9c7=['callback','isMiddleware','login','setTokenCookie','express','passport','Router','../user/user.controller.js','get','/callback'];(function(_0x441f9b,_0x207036){var _0x6d55b9=function(_0xc7f8ed){while(--_0xc7f8ed){_0x441f9b['push'](_0x441f9b['shift']());}};_0x6d55b9(++_0x207036);}(_0xd9c7,0x72));var _0x7d9c=function(_0x12feb4,_0x2f63bb){_0x12feb4=_0x12feb4-0x0;var _0x15f37b=_0xd9c7[_0x12feb4];return _0x15f37b;};'use strict';var express=require(_0x7d9c('0x0'));var passport=require(_0x7d9c('0x1'));var router=express[_0x7d9c('0x2')]();var controller=require('./authGoogle.controller');var userController=require(_0x7d9c('0x3'));var authService=require('../../components/auth/service');router[_0x7d9c('0x4')]('/',controller['login']);router[_0x7d9c('0x4')](_0x7d9c('0x5'),controller[_0x7d9c('0x6')],authService[_0x7d9c('0x7')],userController[_0x7d9c('0x8')],authService[_0x7d9c('0x9')]);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 71f366f..edd43fc 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 _0x1535=['moment','../../mysqldb','../../config/utils','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','clearBlockUser','disabled','minutes','getLicense','catch','find','email','Smtp','service','host','port','secure','authentication','auth','format','\x22%s\x22\x20<%s>','request','SendMail','error','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','Setting','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','previousPasswords','validatePasswordHistory','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring'];(function(_0x1e9cda,_0x3b3ffc){var _0x238e6a=function(_0x3979e4){while(--_0x3979e4){_0x1e9cda['push'](_0x1e9cda['shift']());}};_0x238e6a(++_0x3b3ffc);}(_0x1535,0x9d));var _0x5153=function(_0xb81c46,_0x4845e1){_0xb81c46=_0xb81c46-0x0;var _0x39c47d=_0x1535[_0xb81c46];return _0x39c47d;};'use strict';var util=require(_0x5153('0x0'));var passport=require(_0x5153('0x1'));var LocalStrategy=require(_0x5153('0x2'))[_0x5153('0x3')];var jayson=require(_0x5153('0x4'));var _=require(_0x5153('0x5'));var rs=require(_0x5153('0x6'));var moment=require(_0x5153('0x7'));var db=require(_0x5153('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x5153('0x9'));var client=jayson['client'][_0x5153('0xa')]({'port':0x232b});function localAuthenticate(_0x91007a,_0x109af7,_0x1ca57e,_0x3b3288){var _0x25b803,_0x1e1ec7;return db['Setting'][_0x5153('0xb')]({'where':{'id':0x1},'attributes':[_0x5153('0xc'),_0x5153('0xd')],'raw':!![]})[_0x5153('0xe')](function(_0x5152f8){_0x25b803=_0x5152f8;return _0x91007a[_0x5153('0xb')]({'attributes':['id',_0x5153('0xf'),_0x5153('0x10'),_0x5153('0x11'),_0x5153('0x12'),'disabled',_0x5153('0x13'),'blockedAt',_0x5153('0x14')],'where':{'name':_0x109af7,'role':{'$or':[_0x5153('0x15'),_0x5153('0x16'),'agent']}}});})[_0x5153('0xe')](function(_0x10550b){if(!_0x10550b||_0x10550b&&_0x10550b['name']!==_0x109af7){throw new Error(_0x5153('0x17'));}else{_0x1e1ec7=_0x10550b;return _0x1e1ec7;}})['then'](function(){_0x1e1ec7[_0x5153('0x18')](_0x1ca57e,function(_0x2a1cdd,_0x2e3993){var _0x5f3b97=_0x1e1ec7[_0x5153('0x14')]+0x1;if(_0x2a1cdd){return _0x3b3288(_0x2a1cdd);}else if(!_0x2e3993){if(_0x1e1ec7['disabled']){return _0x3b3288(null,![],{'message':_0x5153('0x17')});}else if(_0x25b803['allowedLoginAttempts']>0x0){if(_0x1e1ec7[_0x5153('0x13')]){if(_0x25b803[_0x5153('0xd')]>0x0){if(moment(_0x1e1ec7[_0x5153('0x19')])[_0x5153('0x1a')](_0x25b803[_0x5153('0xd')],'minutes')>moment()){return _0x3b3288(null,![],{'message':_0x5153('0x17')});}else{return utils[_0x5153('0x1b')](_0x1e1ec7,_0x5f3b97,![],null)[_0x5153('0xe')](function(){return _0x3b3288(null,![],{'message':_0x5153('0x17')});});}}else{return _0x3b3288(null,![],{'message':_0x5153('0x17')});}}else{if(_0x5f3b97>=_0x25b803[_0x5153('0xc')]){return utils[_0x5153('0x1b')](_0x1e1ec7,0x0,!![],moment())['then'](function(){return _0x3b3288(null,![],{'message':_0x5153('0x17')});});}else{return utils[_0x5153('0x1b')](_0x1e1ec7,_0x5f3b97,![],null)[_0x5153('0xe')](function(){return _0x3b3288(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3b3288(null,![],{'message':_0x5153('0x17')});}}else{if(_0x1e1ec7[_0x5153('0x1c')]){return _0x3b3288(null,![],{'message':_0x5153('0x17')});}else if(_0x25b803[_0x5153('0xc')]>0x0){if(_0x1e1ec7[_0x5153('0x13')]){if(_0x25b803[_0x5153('0xd')]>0x0){if(moment(_0x1e1ec7[_0x5153('0x19')])[_0x5153('0x1a')](_0x25b803['blockDuration'],_0x5153('0x1d'))>moment()){return _0x3b3288(null,![],{'message':_0x5153('0x17')});}else{return utils[_0x5153('0x1b')](_0x1e1ec7,0x0,![],null)['then'](function(){return utils['getLicense'](_0x1e1ec7);})[_0x5153('0xe')](function(){return _0x3b3288(null,_0x1e1ec7);});}}else{return _0x3b3288(null,![],{'message':_0x5153('0x17')});}}else{return utils['clearBlockUser'](_0x1e1ec7,0x0,![],null)[_0x5153('0xe')](function(){return utils[_0x5153('0x1e')](_0x1e1ec7);})[_0x5153('0xe')](function(){return _0x3b3288(null,_0x1e1ec7);})['catch'](function(_0x38f8a2){return _0x3b3288(null,![],_0x38f8a2);});}}else{if(_0x1e1ec7['blocked']){return _0x3b3288(null,![],{'message':_0x5153('0x17')});}else{return utils[_0x5153('0x1e')](_0x1e1ec7)['then'](function(){return _0x3b3288(null,_0x1e1ec7);});}}}});})[_0x5153('0x1f')](function(_0x58899d){return _0x3b3288(null,![],_0x58899d);});}function sendServiceMail(_0x1977b4){return db['MailAccount'][_0x5153('0x20')]({'where':{'service':!![]},'attributes':['id',_0x5153('0xf'),_0x5153('0x21')],'include':[{'model':db['MailServerOut'],'as':_0x5153('0x22')}]})[_0x5153('0xe')](function(_0x3ffa33){if(!_0x3ffa33){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x742ea4={'tls':{'rejectUnauthorized':![]}};if(_0x3ffa33[_0x5153('0x22')]['service']){_0x742ea4['service']=_0x3ffa33[_0x5153('0x22')][_0x5153('0x23')];}else{_0x742ea4[_0x5153('0x24')]=_0x3ffa33[_0x5153('0x22')][_0x5153('0x24')];_0x742ea4[_0x5153('0x25')]=_0x3ffa33[_0x5153('0x22')][_0x5153('0x25')];_0x742ea4[_0x5153('0x26')]=_0x3ffa33[_0x5153('0x22')]['secure'];}if(_0x3ffa33[_0x5153('0x22')][_0x5153('0x27')]){_0x742ea4[_0x5153('0x28')]={'user':_0x3ffa33[_0x5153('0x22')][_0x5153('0x16')],'pass':_0x3ffa33['Smtp']['pass']};}var _0x3b357d={'account':_0x742ea4,'message':_['merge']({'from':util[_0x5153('0x29')](_0x5153('0x2a'),_0x3ffa33[_0x5153('0xf')],_0x3ffa33['email']||_0x3ffa33[_0x5153('0x22')][_0x5153('0x16')])},_0x1977b4)};return client[_0x5153('0x2b')](_0x5153('0x2c'),_0x3b357d);})['then'](function(_0x4110c8){if(_0x4110c8[_0x5153('0x2d')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x4110c8[_0x5153('0x2d')][_0x5153('0x2e')]||JSON[_0x5153('0x2f')](_0x4110c8[_0x5153('0x2d')])));}return!![];});}function handleError(_0xcead54,_0x2be57e,_0x54a0cd){return _0xcead54[_0x5153('0x30')](_0x2be57e||0x1f4)[_0x5153('0x31')]({'message':_0x54a0cd?_0x54a0cd['message']||_0x54a0cd:''});}exports[_0x5153('0x32')]=function(_0x5cac26,_0x16e65b,_0x3eb4f6){passport[_0x5153('0x18')](_0x5153('0x33'),function(_0x281d56,_0x2a7b45,_0x289c15){var _0x608e4=_0x281d56||_0x289c15;if(_0x608e4){return handleError(_0x16e65b,0x191,_0x608e4);}if(!_0x2a7b45){return handleError(_0x16e65b,0x194,{'message':_0x5153('0x34')});}else{var _0x55505a={'payload':{'id':_0x2a7b45['id'],'role':_0x2a7b45[_0x5153('0x12')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x55505a)[_0x5153('0xe')](function(_0x557cd3){_0x16e65b[_0x5153('0x35')]({'id':_0x2a7b45['id'],'token':_0x557cd3,'statusCall':'','isAlreadyLogged':_0x2a7b45[_0x5153('0x36')]});});}})(_0x5cac26,_0x16e65b,_0x3eb4f6);};exports['forgot']=function(_0x594bda,_0x55b2e7,_0x2cfd60){if(!_0x594bda['body']['email']){return handleError(_0x55b2e7,0x1f4,{'message':_0x5153('0x37')});}var _0x5512ea=rs[_0x5153('0x38')]();_0x594bda[_0x5153('0x39')]['email']=_0x594bda[_0x5153('0x39')][_0x5153('0x21')][_0x5153('0x3a')]()[_0x5153('0x3b')]();var _0x4ca56e;return db[_0x5153('0x3c')][_0x5153('0xb')]({'where':{'id':0x1},'attributes':[_0x5153('0xc'),_0x5153('0xd')],'raw':!![]})[_0x5153('0xe')](function(_0x1e57c9){_0x4ca56e=_0x1e57c9;return db[_0x5153('0x3d')]['find']({'where':{'email':_0x594bda[_0x5153('0x39')][_0x5153('0x21')]}});})[_0x5153('0xe')](function(_0x971070){if(!_0x971070){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x971070[_0x5153('0x1c')]){throw new Error(_0x5153('0x3e'));}if(_0x971070[_0x5153('0x13')]){if(moment(_0x971070[_0x5153('0x19')])['add'](_0x4ca56e['blockDuration'],_0x5153('0x1d'))>moment()){throw new Error(_0x5153('0x3f'));}else{_0x971070['blocked']=![];_0x971070[_0x5153('0x19')]=null;}}_0x971070[_0x5153('0x40')]=_0x5512ea;_0x971070[_0x5153('0x41')]=Date[_0x5153('0x42')]()+0x36ee80;return _0x971070[_0x5153('0x43')]();})[_0x5153('0xe')](function(){return sendServiceMail({'to':_0x594bda[_0x5153('0x39')][_0x5153('0x21')],'subject':_0x5153('0x44'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x5153('0x45')+'https://'+_0x594bda[_0x5153('0x46')][_0x5153('0x24')]+'/reset/'+_0x5512ea+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x5153('0xe')](function(){_0x55b2e7[_0x5153('0x30')](0xc8)[_0x5153('0x31')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x40fb82){return handleError(_0x55b2e7,0x1f4,_0x40fb82);});};exports[_0x5153('0x47')]=function(_0x14bedf,_0x5909dd,_0x46da73){return db[_0x5153('0x3d')]['find']({'where':{'resetPasswordToken':_0x14bedf[_0x5153('0x48')][_0x5153('0x49')],'resetPasswordExpires':{'$gt':Date[_0x5153('0x42')]()}}})[_0x5153('0xe')](function(_0x3ad911){if(!_0x3ad911){throw new Error(_0x5153('0x4a'));}return db[_0x5153('0x3c')][_0x5153('0xb')]({'attributes':['id',_0x5153('0x4b'),'enforcePasswordHistory',_0x5153('0x4c')]})[_0x5153('0xe')](function(_0x306621){if(_0x306621[_0x5153('0x4b')])authService[_0x5153('0x4d')](_0x14bedf[_0x5153('0x39')][_0x5153('0x10')]);if(!_0x306621['enforcePasswordHistory']||!_0x3ad911[_0x5153('0x4e')])return _0x3ad911;authService[_0x5153('0x4f')](_0x14bedf['body']['password'],_0x3ad911[_0x5153('0x4e')],_0x306621[_0x5153('0x4c')]);return _0x3ad911;})[_0x5153('0xe')](function(){_0x3ad911[_0x5153('0x10')]=_0x14bedf[_0x5153('0x39')][_0x5153('0x10')];_0x3ad911['resetPasswordToken']=null;_0x3ad911['resetPasswordExpires']=null;return _0x3ad911[_0x5153('0x43')]();});})['then'](function(){_0x5909dd[_0x5153('0x30')](0xc8)[_0x5153('0x31')]({'message':_0x5153('0x50')});})['catch'](function(_0x187410){return handleError(_0x5909dd,0x1f4,_0x187410);});};passport[_0x5153('0x51')](new LocalStrategy({'usernameField':_0x5153('0xf'),'passwordField':_0x5153('0x10')},function(_0x35aa78,_0x1afba2,_0x13cf4a){return localAuthenticate(db[_0x5153('0x3d')],_0x35aa78,_0x1afba2,_0x13cf4a);})); \ No newline at end of file +var _0x3cad=['validatePasswordHistory','previousPasswords','Password\x20reset!','util','passport-local','Strategy','jayson/promise','lodash','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','auth','request','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','error','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','validatePasswordPattern'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x3cad,0x102));var _0xd3ca=function(_0x41f484,_0x50f835){_0x41f484=_0x41f484-0x0;var _0x2f9acb=_0x3cad[_0x41f484];return _0x2f9acb;};'use strict';var util=require(_0xd3ca('0x0'));var passport=require('passport');var LocalStrategy=require(_0xd3ca('0x1'))[_0xd3ca('0x2')];var jayson=require(_0xd3ca('0x3'));var _=require(_0xd3ca('0x4'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xd3ca('0x5'));var utils=require(_0xd3ca('0x6'));var client=jayson[_0xd3ca('0x7')][_0xd3ca('0x8')]({'port':0x232b});function localAuthenticate(_0x2e5c2d,_0xbea659,_0x5ea2b2,_0x1dfa6e){var _0x452206,_0x73df6c;return db[_0xd3ca('0x9')][_0xd3ca('0xa')]({'where':{'id':0x1},'attributes':[_0xd3ca('0xb'),_0xd3ca('0xc')],'raw':!![]})[_0xd3ca('0xd')](function(_0x5589fc){_0x452206=_0x5589fc;return _0x2e5c2d[_0xd3ca('0xa')]({'attributes':['id',_0xd3ca('0xe'),_0xd3ca('0xf'),_0xd3ca('0x10'),'role',_0xd3ca('0x11'),_0xd3ca('0x12'),_0xd3ca('0x13'),_0xd3ca('0x14')],'where':{'name':_0xbea659,'role':{'$or':[_0xd3ca('0x15'),_0xd3ca('0x16'),'agent']}}});})['then'](function(_0x5c599c){if(!_0x5c599c||_0x5c599c&&_0x5c599c[_0xd3ca('0xe')]!==_0xbea659){throw new Error(_0xd3ca('0x17'));}else{_0x73df6c=_0x5c599c;return _0x73df6c;}})[_0xd3ca('0xd')](function(){_0x73df6c[_0xd3ca('0x18')](_0x5ea2b2,function(_0x2d2585,_0x2869f5){var _0x1e301b=_0x73df6c[_0xd3ca('0x14')]+0x1;if(_0x2d2585){return _0x1dfa6e(_0x2d2585);}else if(!_0x2869f5){if(_0x73df6c[_0xd3ca('0x11')]){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});}else if(_0x452206['allowedLoginAttempts']>0x0){if(_0x73df6c[_0xd3ca('0x12')]){if(_0x452206[_0xd3ca('0xc')]>0x0){if(moment(_0x73df6c[_0xd3ca('0x13')])[_0xd3ca('0x19')](_0x452206[_0xd3ca('0xc')],_0xd3ca('0x1a'))>moment()){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});}else{return utils[_0xd3ca('0x1b')](_0x73df6c,_0x1e301b,![],null)[_0xd3ca('0xd')](function(){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});});}}else{return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});}}else{if(_0x1e301b>=_0x452206['allowedLoginAttempts']){return utils[_0xd3ca('0x1b')](_0x73df6c,0x0,!![],moment())[_0xd3ca('0xd')](function(){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});});}else{return utils[_0xd3ca('0x1b')](_0x73df6c,_0x1e301b,![],null)['then'](function(){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});});}}}else{return _0x1dfa6e(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x73df6c[_0xd3ca('0x11')]){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});}else if(_0x452206['allowedLoginAttempts']>0x0){if(_0x73df6c['blocked']){if(_0x452206[_0xd3ca('0xc')]>0x0){if(moment(_0x73df6c['blockedAt'])['add'](_0x452206[_0xd3ca('0xc')],'minutes')>moment()){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});}else{return utils[_0xd3ca('0x1b')](_0x73df6c,0x0,![],null)['then'](function(){return utils[_0xd3ca('0x1c')](_0x73df6c);})[_0xd3ca('0xd')](function(){return _0x1dfa6e(null,_0x73df6c);});}}else{return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});}}else{return utils['clearBlockUser'](_0x73df6c,0x0,![],null)[_0xd3ca('0xd')](function(){return utils[_0xd3ca('0x1c')](_0x73df6c);})[_0xd3ca('0xd')](function(){return _0x1dfa6e(null,_0x73df6c);})[_0xd3ca('0x1d')](function(_0x3fbfe2){return _0x1dfa6e(null,![],_0x3fbfe2);});}}else{if(_0x73df6c['blocked']){return _0x1dfa6e(null,![],{'message':_0xd3ca('0x17')});}else{return utils[_0xd3ca('0x1c')](_0x73df6c)[_0xd3ca('0xd')](function(){return _0x1dfa6e(null,_0x73df6c);});}}}});})['catch'](function(_0x50bbe1){return _0x1dfa6e(null,![],_0x50bbe1);});}function sendServiceMail(_0x4086a){return db[_0xd3ca('0x1e')][_0xd3ca('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xd3ca('0xe'),_0xd3ca('0x20')],'include':[{'model':db[_0xd3ca('0x21')],'as':_0xd3ca('0x22')}]})[_0xd3ca('0xd')](function(_0x94b148){if(!_0x94b148){throw new Error(_0xd3ca('0x23'));}var _0x47d3ed={'tls':{'rejectUnauthorized':![]}};if(_0x94b148['Smtp']['service']){_0x47d3ed['service']=_0x94b148[_0xd3ca('0x22')][_0xd3ca('0x24')];}else{_0x47d3ed[_0xd3ca('0x25')]=_0x94b148['Smtp']['host'];_0x47d3ed[_0xd3ca('0x26')]=_0x94b148[_0xd3ca('0x22')]['port'];_0x47d3ed['secure']=_0x94b148['Smtp'][_0xd3ca('0x27')];}if(_0x94b148[_0xd3ca('0x22')]['authentication']){_0x47d3ed[_0xd3ca('0x28')]={'user':_0x94b148['Smtp']['user'],'pass':_0x94b148[_0xd3ca('0x22')]['pass']};}var _0x481c32={'account':_0x47d3ed,'message':_['merge']({'from':util['format']('\x22%s\x22\x20<%s>',_0x94b148[_0xd3ca('0xe')],_0x94b148[_0xd3ca('0x20')]||_0x94b148['Smtp'][_0xd3ca('0x16')])},_0x4086a)};return client[_0xd3ca('0x29')]('SendMail',_0x481c32);})[_0xd3ca('0xd')](function(_0x13c3c6){if(_0x13c3c6['error']){throw new Error(util[_0xd3ca('0x2a')](_0xd3ca('0x2b'),_0x13c3c6[_0xd3ca('0x2c')][_0xd3ca('0x2d')]||JSON[_0xd3ca('0x2e')](_0x13c3c6[_0xd3ca('0x2c')])));}return!![];});}function handleError(_0x3dbde6,_0x39c3c4,_0xb63e8b){return _0x3dbde6[_0xd3ca('0x2f')](_0x39c3c4||0x1f4)[_0xd3ca('0x30')]({'message':_0xb63e8b?_0xb63e8b[_0xd3ca('0x2d')]||_0xb63e8b:''});}exports[_0xd3ca('0x31')]=function(_0x5ee1fe,_0x4d78c0,_0x3eb0fb){passport[_0xd3ca('0x18')]('local',function(_0x4a0286,_0x46c91d,_0xc78c83){var _0x5715d1=_0x4a0286||_0xc78c83;if(_0x5715d1){return handleError(_0x4d78c0,0x191,_0x5715d1);}if(!_0x46c91d){return handleError(_0x4d78c0,0x194,{'message':_0xd3ca('0x32')});}else{var _0x2719c7={'payload':{'id':_0x46c91d['id'],'role':_0x46c91d[_0xd3ca('0x33')]},'options':{'expiresIn':0x15180}};return authService[_0xd3ca('0x34')](_0x2719c7)[_0xd3ca('0xd')](function(_0x19abf1){_0x4d78c0[_0xd3ca('0x35')]({'id':_0x46c91d['id'],'token':_0x19abf1,'statusCall':'','isAlreadyLogged':_0x46c91d[_0xd3ca('0x36')]});});}})(_0x5ee1fe,_0x4d78c0,_0x3eb0fb);};exports[_0xd3ca('0x37')]=function(_0x48322b,_0x1f6ed2,_0x115b64){if(!_0x48322b['body']['email']){return handleError(_0x1f6ed2,0x1f4,{'message':_0xd3ca('0x38')});}var _0x3436b3=rs[_0xd3ca('0x39')]();_0x48322b[_0xd3ca('0x3a')][_0xd3ca('0x20')]=_0x48322b[_0xd3ca('0x3a')][_0xd3ca('0x20')][_0xd3ca('0x3b')]()[_0xd3ca('0x3c')]();var _0x156375;return db[_0xd3ca('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0xd3ca('0xb'),'blockDuration'],'raw':!![]})[_0xd3ca('0xd')](function(_0x260d86){_0x156375=_0x260d86;return db[_0xd3ca('0x3d')][_0xd3ca('0x1f')]({'where':{'email':_0x48322b[_0xd3ca('0x3a')][_0xd3ca('0x20')]}});})[_0xd3ca('0xd')](function(_0x25e633){if(!_0x25e633){throw new Error(_0xd3ca('0x3e'));}if(_0x25e633[_0xd3ca('0x11')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x25e633['blocked']){if(moment(_0x25e633[_0xd3ca('0x13')])['add'](_0x156375['blockDuration'],'minutes')>moment()){throw new Error(_0xd3ca('0x3f'));}else{_0x25e633[_0xd3ca('0x12')]=![];_0x25e633['blockedAt']=null;}}_0x25e633[_0xd3ca('0x40')]=_0x3436b3;_0x25e633[_0xd3ca('0x41')]=Date[_0xd3ca('0x42')]()+0x36ee80;return _0x25e633[_0xd3ca('0x43')]();})['then'](function(){return sendServiceMail({'to':_0x48322b['body'][_0xd3ca('0x20')],'subject':_0xd3ca('0x44'),'text':_0xd3ca('0x45')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xd3ca('0x46')+_0x48322b[_0xd3ca('0x47')][_0xd3ca('0x25')]+_0xd3ca('0x48')+_0x3436b3+'\x0a\x0a'+_0xd3ca('0x49')});})['then'](function(){_0x1f6ed2['status'](0xc8)[_0xd3ca('0x30')]({'message':'Reset\x20Email\x20sent!'});})[_0xd3ca('0x1d')](function(_0x566710){return handleError(_0x1f6ed2,0x1f4,_0x566710);});};exports[_0xd3ca('0x4a')]=function(_0x1e30a7,_0x55cbf3,_0xbb0413){return db['User'][_0xd3ca('0x1f')]({'where':{'resetPasswordToken':_0x1e30a7[_0xd3ca('0x4b')][_0xd3ca('0x4c')],'resetPasswordExpires':{'$gt':Date[_0xd3ca('0x42')]()}}})[_0xd3ca('0xd')](function(_0xf03dac){if(!_0xf03dac){throw new Error(_0xd3ca('0x4d'));}return db[_0xd3ca('0x9')][_0xd3ca('0xa')]({'attributes':['id','securePassword',_0xd3ca('0x4e'),_0xd3ca('0x4f')]})[_0xd3ca('0xd')](function(_0xdf1e49){if(_0xdf1e49[_0xd3ca('0x50')])authService[_0xd3ca('0x51')](_0x1e30a7[_0xd3ca('0x3a')][_0xd3ca('0xf')]);if(!_0xdf1e49[_0xd3ca('0x4e')]||!_0xf03dac['previousPasswords'])return _0xf03dac;authService[_0xd3ca('0x52')](_0x1e30a7[_0xd3ca('0x3a')][_0xd3ca('0xf')],_0xf03dac[_0xd3ca('0x53')],_0xdf1e49[_0xd3ca('0x4f')]);return _0xf03dac;})[_0xd3ca('0xd')](function(){_0xf03dac[_0xd3ca('0xf')]=_0x1e30a7[_0xd3ca('0x3a')][_0xd3ca('0xf')];_0xf03dac[_0xd3ca('0x40')]=null;_0xf03dac[_0xd3ca('0x41')]=null;return _0xf03dac[_0xd3ca('0x43')]();});})[_0xd3ca('0xd')](function(){_0x55cbf3[_0xd3ca('0x2f')](0xc8)['send']({'message':_0xd3ca('0x54')});})[_0xd3ca('0x1d')](function(_0x49ef5c){return handleError(_0x55cbf3,0x1f4,_0x49ef5c);});};passport['use'](new LocalStrategy({'usernameField':_0xd3ca('0xe'),'passwordField':_0xd3ca('0xf')},function(_0x582616,_0x3f5c77,_0x8169c6){return localAuthenticate(db['User'],_0x582616,_0x3f5c77,_0x8169c6);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 3760042..c85753c 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 _0x0bfd=['/reset/:token','reset','exports','Router','./authLocal.controller','post','login','/forgot'];(function(_0x5a7e78,_0x400b57){var _0xa8d4a1=function(_0x486659){while(--_0x486659){_0x5a7e78['push'](_0x5a7e78['shift']());}};_0xa8d4a1(++_0x400b57);}(_0x0bfd,0x7b));var _0xd0bf=function(_0x35e289,_0x5cca85){_0x35e289=_0x35e289-0x0;var _0x22eb84=_0x0bfd[_0x35e289];return _0x22eb84;};'use strict';var express=require('express');var router=express[_0xd0bf('0x0')]();var controller=require(_0xd0bf('0x1'));router[_0xd0bf('0x2')]('/',controller[_0xd0bf('0x3')]);router[_0xd0bf('0x2')](_0xd0bf('0x4'),controller['forgot']);router[_0xd0bf('0x2')](_0xd0bf('0x5'),controller[_0xd0bf('0x6')]);module[_0xd0bf('0x7')]=router; \ No newline at end of file +var _0x4f0c=['forgot','/reset/:token','reset','exports','Router','post','login'];(function(_0x47b19f,_0x77c99f){var _0x1fd067=function(_0x2b7688){while(--_0x2b7688){_0x47b19f['push'](_0x47b19f['shift']());}};_0x1fd067(++_0x77c99f);}(_0x4f0c,0xac));var _0xc4f0=function(_0x3a574c,_0x33598e){_0x3a574c=_0x3a574c-0x0;var _0x28c69f=_0x4f0c[_0x3a574c];return _0x28c69f;};'use strict';var express=require('express');var router=express[_0xc4f0('0x0')]();var controller=require('./authLocal.controller');router[_0xc4f0('0x1')]('/',controller[_0xc4f0('0x2')]);router[_0xc4f0('0x1')]('/forgot',controller[_0xc4f0('0x3')]);router[_0xc4f0('0x1')](_0xc4f0('0x4'),controller[_0xc4f0('0x5')]);module[_0xc4f0('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 6b14aaa..948af2a 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 _0x3d2f=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x14b8ee,_0x26d31a){var _0x50ef2b=function(_0x27d7bc){while(--_0x27d7bc){_0x14b8ee['push'](_0x14b8ee['shift']());}};_0x50ef2b(++_0x26d31a);}(_0x3d2f,0x14a));var _0xf3d2=function(_0x6143bc,_0x547322){_0x6143bc=_0x6143bc-0x0;var _0x277165=_0x3d2f[_0x6143bc];return _0x277165;};'use strict';var Sequelize=require(_0xf3d2('0x0'));module[_0xf3d2('0x1')]={'name':{'type':Sequelize[_0xf3d2('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xf3d2('0x2')]},'description':{'type':Sequelize[_0xf3d2('0x2')]},'status':{'type':Sequelize[_0xf3d2('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xf3d2('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xfeef=['exports','STRING','INTEGER'];(function(_0x3f4642,_0xaf8701){var _0x383322=function(_0x3cd476){while(--_0x3cd476){_0x3f4642['push'](_0x3f4642['shift']());}};_0x383322(++_0xaf8701);}(_0xfeef,0x90));var _0xffee=function(_0x1f8542,_0x161f82){_0x1f8542=_0x1f8542-0x0;var _0x55536d=_0xfeef[_0x1f8542];return _0x55536d;};'use strict';var Sequelize=require('sequelize');module[_0xffee('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xffee('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xffee('0x2')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fa3819d..622f2f9 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 _0xf664=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','update','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','then','includeAll','include','Automation','findAll','catch','show','params','keys','length','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','hasOwnProperty','addActions','Action','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xf664,0xe9));var _0x4f66=function(_0x1b70e3,_0x3a15b1){_0x1b70e3=_0x1b70e3-0x0;var _0x1452ab=_0xf664[_0x1b70e3];return _0x1452ab;};'use strict';var emlformat=require(_0x4f66('0x0'));var rimraf=require(_0x4f66('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f66('0x2'));var rp=require(_0x4f66('0x3'));var moment=require(_0x4f66('0x4'));var BPromise=require(_0x4f66('0x5'));var Mustache=require(_0x4f66('0x6'));var util=require('util');var path=require(_0x4f66('0x7'));var sox=require('sox');var csv=require(_0x4f66('0x8'));var ejs=require(_0x4f66('0x9'));var fs=require('fs');var fs_extra=require(_0x4f66('0xa'));var _=require(_0x4f66('0xb'));var squel=require(_0x4f66('0xc'));var crypto=require(_0x4f66('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4f66('0x8'));var querystring=require(_0x4f66('0xe'));var Papa=require(_0x4f66('0xf'));var Redis=require(_0x4f66('0x10'));var authService=require(_0x4f66('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f66('0x12'));var logger=require(_0x4f66('0x13'))(_0x4f66('0x14'));var utils=require(_0x4f66('0x15'));var config=require(_0x4f66('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f66('0x17'))['db'];function respondWithStatusCode(_0x5222e0,_0x29b4e6){_0x29b4e6=_0x29b4e6||0xcc;return function(_0x11fc50){if(_0x11fc50){return _0x5222e0[_0x4f66('0x18')](_0x29b4e6);}return _0x5222e0[_0x4f66('0x19')](_0x29b4e6)[_0x4f66('0x1a')]();};}function respondWithResult(_0x370962,_0x4df47e){_0x4df47e=_0x4df47e||0xc8;return function(_0x180bdc){if(_0x180bdc){return _0x370962[_0x4f66('0x19')](_0x4df47e)[_0x4f66('0x1b')](_0x180bdc);}};}function respondWithFilteredResult(_0x4c3fa2,_0x28c1ae){return function(_0x4e4e5b){if(_0x4e4e5b){var _0x4463d8=typeof _0x28c1ae[_0x4f66('0x1c')]===_0x4f66('0x1d')&&typeof _0x28c1ae['limit']===_0x4f66('0x1d');var _0x12128d=_0x4e4e5b[_0x4f66('0x1e')];var _0x562a15=_0x4463d8?0x0:_0x28c1ae['offset'];var _0x5d6a4b=_0x4463d8?_0x4e4e5b[_0x4f66('0x1e')]:_0x28c1ae['offset']+_0x28c1ae['limit'];var _0x11c886;if(_0x5d6a4b>=_0x12128d){_0x5d6a4b=_0x12128d;_0x11c886=0xc8;}else{_0x11c886=0xce;}_0x4c3fa2[_0x4f66('0x19')](_0x11c886);return _0x4c3fa2[_0x4f66('0x1f')]('Content-Range',_0x562a15+'-'+_0x5d6a4b+'/'+_0x12128d)[_0x4f66('0x1b')](_0x4e4e5b);}return null;};}function patchUpdates(_0x3d7586){return function(_0x39ce74){try{jsonpatch[_0x4f66('0x20')](_0x39ce74,_0x3d7586,!![]);}catch(_0x3b671e){return BPromise[_0x4f66('0x21')](_0x3b671e);}return _0x39ce74['save']();};}function saveUpdates(_0x5584a4,_0x19cd27){return function(_0x4bd7bb){if(_0x4bd7bb){return _0x4bd7bb[_0x4f66('0x22')](_0x5584a4)['then'](function(_0x4c0689){return _0x4c0689;});}return null;};}function removeEntity(_0x46f3ad,_0x2a3373){return function(_0x573fc2){if(_0x573fc2){return _0x573fc2['destroy']()['then'](function(){_0x46f3ad['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x203cab,_0x4a703b){return function(_0x56884a){if(!_0x56884a){_0x203cab[_0x4f66('0x18')](0x194);}return _0x56884a;};}function handleError(_0x57bb5d,_0xcc4a80){_0xcc4a80=_0xcc4a80||0x1f4;return function(_0x324030){logger['error'](_0x324030[_0x4f66('0x23')]);if(_0x324030[_0x4f66('0x24')]){delete _0x324030[_0x4f66('0x24')];}_0x57bb5d['status'](_0xcc4a80)[_0x4f66('0x25')](_0x324030);};}exports[_0x4f66('0x26')]=function(_0x21cb92,_0x1cc05b){var _0x1ae922={},_0x46770c={},_0x41bd47={'count':0x0,'rows':[]};var _0xd243fe=_[_0x4f66('0x27')](db['Automation'][_0x4f66('0x28')],function(_0x2914a0){return{'name':_0x2914a0[_0x4f66('0x29')],'type':_0x2914a0[_0x4f66('0x2a')][_0x4f66('0x2b')]};});_0x46770c['model']=_[_0x4f66('0x27')](_0xd243fe,_0x4f66('0x24'));_0x46770c[_0x4f66('0x2c')]=_['keys'](_0x21cb92[_0x4f66('0x2c')]);_0x46770c[_0x4f66('0x2d')]=_[_0x4f66('0x2e')](_0x46770c[_0x4f66('0x2f')],_0x46770c[_0x4f66('0x2c')]);_0x1ae922[_0x4f66('0x30')]=_[_0x4f66('0x2e')](_0x46770c[_0x4f66('0x2f')],qs[_0x4f66('0x31')](_0x21cb92[_0x4f66('0x2c')][_0x4f66('0x31')]));_0x1ae922[_0x4f66('0x30')]=_0x1ae922[_0x4f66('0x30')]['length']?_0x1ae922[_0x4f66('0x30')]:_0x46770c['model'];if(!_0x21cb92[_0x4f66('0x2c')]['hasOwnProperty'](_0x4f66('0x32'))){_0x1ae922[_0x4f66('0x33')]=qs[_0x4f66('0x33')](_0x21cb92[_0x4f66('0x2c')][_0x4f66('0x33')]);_0x1ae922['offset']=qs[_0x4f66('0x1c')](_0x21cb92[_0x4f66('0x2c')][_0x4f66('0x1c')]);}_0x1ae922[_0x4f66('0x34')]=qs[_0x4f66('0x35')](_0x21cb92[_0x4f66('0x2c')][_0x4f66('0x35')]);_0x1ae922['where']=qs[_0x4f66('0x2d')](_[_0x4f66('0x36')](_0x21cb92[_0x4f66('0x2c')],_0x46770c['filters']),_0xd243fe);if(_0x21cb92[_0x4f66('0x2c')][_0x4f66('0x37')]){_0x1ae922[_0x4f66('0x38')]=_['merge'](_0x1ae922[_0x4f66('0x38')],{'$or':_['map'](_0xd243fe,function(_0x1f0ebc){if(_0x1f0ebc['type']!==_0x4f66('0x39')){var _0x3c0d08={};_0x3c0d08[_0x1f0ebc[_0x4f66('0x24')]]={'$like':'%'+_0x21cb92[_0x4f66('0x2c')][_0x4f66('0x37')]+'%'};return _0x3c0d08;}})});}_0x1ae922=_[_0x4f66('0x3a')]({},_0x1ae922,_0x21cb92[_0x4f66('0x3b')]);var _0x3eab06={'where':_0x1ae922[_0x4f66('0x38')]};return db['Automation'][_0x4f66('0x1e')](_0x3eab06)[_0x4f66('0x3c')](function(_0x32e846){_0x41bd47[_0x4f66('0x1e')]=_0x32e846;if(_0x21cb92[_0x4f66('0x2c')][_0x4f66('0x3d')]){_0x1ae922[_0x4f66('0x3e')]=[{'all':!![]}];}return db[_0x4f66('0x3f')][_0x4f66('0x40')](_0x1ae922);})[_0x4f66('0x3c')](function(_0x390461){_0x41bd47['rows']=_0x390461;return _0x41bd47;})[_0x4f66('0x3c')](respondWithFilteredResult(_0x1cc05b,_0x1ae922))[_0x4f66('0x41')](handleError(_0x1cc05b,null));};exports[_0x4f66('0x42')]=function(_0x495ff8,_0x27fe31){var _0x230013={'raw':![],'where':{'id':_0x495ff8[_0x4f66('0x43')]['id']}},_0x6647b8={};_0x6647b8[_0x4f66('0x2f')]=_[_0x4f66('0x44')](db['Automation'][_0x4f66('0x28')]);_0x6647b8['query']=_[_0x4f66('0x44')](_0x495ff8[_0x4f66('0x2c')]);_0x6647b8[_0x4f66('0x2d')]=_['intersection'](_0x6647b8[_0x4f66('0x2f')],_0x6647b8['query']);_0x230013[_0x4f66('0x30')]=_[_0x4f66('0x2e')](_0x6647b8[_0x4f66('0x2f')],qs['fields'](_0x495ff8[_0x4f66('0x2c')][_0x4f66('0x31')]));_0x230013[_0x4f66('0x30')]=_0x230013[_0x4f66('0x30')][_0x4f66('0x45')]?_0x230013[_0x4f66('0x30')]:_0x6647b8[_0x4f66('0x2f')];if(_0x495ff8['query'][_0x4f66('0x3d')]){_0x230013[_0x4f66('0x3e')]=[{'all':!![]}];}_0x230013=_[_0x4f66('0x3a')]({},_0x230013,_0x495ff8[_0x4f66('0x3b')]);return db['Automation'][_0x4f66('0x46')](_0x230013)['then'](handleEntityNotFound(_0x27fe31,null))[_0x4f66('0x3c')](respondWithResult(_0x27fe31,null))[_0x4f66('0x41')](handleError(_0x27fe31,null));};exports[_0x4f66('0x47')]=function(_0x11a9f7,_0x6db65c){return db['Automation'][_0x4f66('0x47')](_0x11a9f7['body'],{})[_0x4f66('0x3c')](respondWithResult(_0x6db65c,0xc9))[_0x4f66('0x41')](handleError(_0x6db65c,null));};exports[_0x4f66('0x22')]=function(_0x3d80f1,_0x39d707){if(_0x3d80f1[_0x4f66('0x48')]['id']){delete _0x3d80f1[_0x4f66('0x48')]['id'];}return db[_0x4f66('0x3f')]['find']({'where':{'id':_0x3d80f1[_0x4f66('0x43')]['id']}})[_0x4f66('0x3c')](handleEntityNotFound(_0x39d707,null))[_0x4f66('0x3c')](saveUpdates(_0x3d80f1[_0x4f66('0x48')],null))[_0x4f66('0x3c')](respondWithResult(_0x39d707,null))['catch'](handleError(_0x39d707,null));};exports[_0x4f66('0x49')]=function(_0x2a4437,_0x9f2cb2){return db[_0x4f66('0x3f')]['find']({'where':{'id':_0x2a4437[_0x4f66('0x43')]['id']}})['then'](handleEntityNotFound(_0x9f2cb2,null))[_0x4f66('0x3c')](removeEntity(_0x9f2cb2,null))[_0x4f66('0x41')](handleError(_0x9f2cb2,null));};exports[_0x4f66('0x4a')]=function(_0x1fb54b,_0x1a602e,_0x5cea04){return db[_0x4f66('0x4b')][_0x4f66('0x46')]({'where':{'id':_0x1fb54b[_0x4f66('0x43')]['id']}})['then'](handleEntityNotFound(_0x1a602e,null))['then'](function(_0x1f7408){if(_0x1f7408){return _0x1f7408[_0x4f66('0x4a')](_0x1fb54b[_0x4f66('0x48')][_0x4f66('0x4c')],_[_0x4f66('0x4d')](_0x1fb54b[_0x4f66('0x48')],['ids','id'])||{});}})[_0x4f66('0x3c')](respondWithResult(_0x1a602e,null))[_0x4f66('0x41')](handleError(_0x1a602e,null));};exports[_0x4f66('0x4e')]=function(_0x1dc654,_0x134bd2,_0x3b5eec){var _0x426376={};var _0x26e73b={};var _0x61a5ba;var _0x2800d6;return db[_0x4f66('0x3f')]['findOne']({'where':{'id':_0x1dc654['params']['id']}})[_0x4f66('0x3c')](handleEntityNotFound(_0x134bd2,null))[_0x4f66('0x3c')](function(_0x2b0484){if(_0x2b0484){_0x61a5ba=_0x2b0484;_0x26e73b[_0x4f66('0x2f')]=_['keys'](db[_0x4f66('0x4b')][_0x4f66('0x28')]);_0x26e73b[_0x4f66('0x2c')]=_[_0x4f66('0x44')](_0x1dc654['query']);_0x26e73b[_0x4f66('0x2d')]=_[_0x4f66('0x2e')](_0x26e73b[_0x4f66('0x2f')],_0x26e73b[_0x4f66('0x2c')]);_0x426376['attributes']=_['intersection'](_0x26e73b[_0x4f66('0x2f')],qs[_0x4f66('0x31')](_0x1dc654['query'][_0x4f66('0x31')]));_0x426376['attributes']=_0x426376['attributes'][_0x4f66('0x45')]?_0x426376[_0x4f66('0x30')]:_0x26e73b[_0x4f66('0x2f')];_0x426376['order']=qs[_0x4f66('0x35')](_0x1dc654['query'][_0x4f66('0x35')]);_0x426376[_0x4f66('0x38')]=qs['filters'](_[_0x4f66('0x36')](_0x1dc654[_0x4f66('0x2c')],_0x26e73b['filters']));if(_0x1dc654['query']['filter']){_0x426376[_0x4f66('0x38')]=_[_0x4f66('0x3a')](_0x426376[_0x4f66('0x38')],{'$or':_[_0x4f66('0x27')](_0x426376[_0x4f66('0x30')],function(_0x48584f){var _0x4a52ea={};_0x4a52ea[_0x48584f]={'$like':'%'+_0x1dc654['query'][_0x4f66('0x37')]+'%'};return _0x4a52ea;})});}_0x426376=_[_0x4f66('0x3a')]({},_0x426376,_0x1dc654[_0x4f66('0x3b')]);return _0x61a5ba[_0x4f66('0x4e')](_0x426376);}})[_0x4f66('0x3c')](function(_0x2ac200){if(_0x2ac200){_0x2800d6=_0x2ac200['length'];if(!_0x1dc654['query'][_0x4f66('0x4f')]('nolimit')){_0x426376[_0x4f66('0x33')]=qs[_0x4f66('0x33')](_0x1dc654[_0x4f66('0x2c')][_0x4f66('0x33')]);_0x426376[_0x4f66('0x1c')]=qs['offset'](_0x1dc654[_0x4f66('0x2c')]['offset']);}return _0x61a5ba[_0x4f66('0x4e')](_0x426376);}})[_0x4f66('0x3c')](function(_0x13edb0){if(_0x13edb0){return _0x13edb0?{'count':_0x2800d6,'rows':_0x13edb0}:null;}})[_0x4f66('0x3c')](respondWithResult(_0x134bd2,null))[_0x4f66('0x41')](handleError(_0x134bd2,null));};exports[_0x4f66('0x50')]=function(_0xe93bd4,_0x2622db,_0x3830b2){return db[_0x4f66('0x51')][_0x4f66('0x46')]({'where':{'id':_0xe93bd4[_0x4f66('0x43')]['id']}})[_0x4f66('0x3c')](handleEntityNotFound(_0x2622db,null))[_0x4f66('0x3c')](function(_0x4bbd75){if(_0x4bbd75){return _0x4bbd75[_0x4f66('0x50')](_0xe93bd4[_0x4f66('0x48')]['ids'],_[_0x4f66('0x4d')](_0xe93bd4[_0x4f66('0x48')],[_0x4f66('0x4c'),'id'])||{});}})[_0x4f66('0x3c')](respondWithResult(_0x2622db,null))[_0x4f66('0x41')](handleError(_0x2622db,null));};exports['getActions']=function(_0x2f4e3f,_0x39faea,_0x347937){var _0x5d5dd5={};var _0x153613={};var _0x2f1207;var _0x55fc31;return db[_0x4f66('0x3f')]['findOne']({'where':{'id':_0x2f4e3f['params']['id']}})[_0x4f66('0x3c')](handleEntityNotFound(_0x39faea,null))[_0x4f66('0x3c')](function(_0x297362){if(_0x297362){_0x2f1207=_0x297362;_0x153613['model']=_[_0x4f66('0x44')](db['Action'][_0x4f66('0x28')]);_0x153613[_0x4f66('0x2c')]=_[_0x4f66('0x44')](_0x2f4e3f[_0x4f66('0x2c')]);_0x153613[_0x4f66('0x2d')]=_[_0x4f66('0x2e')](_0x153613['model'],_0x153613[_0x4f66('0x2c')]);_0x5d5dd5[_0x4f66('0x30')]=_['intersection'](_0x153613[_0x4f66('0x2f')],qs[_0x4f66('0x31')](_0x2f4e3f[_0x4f66('0x2c')][_0x4f66('0x31')]));_0x5d5dd5[_0x4f66('0x30')]=_0x5d5dd5[_0x4f66('0x30')][_0x4f66('0x45')]?_0x5d5dd5[_0x4f66('0x30')]:_0x153613[_0x4f66('0x2f')];_0x5d5dd5[_0x4f66('0x34')]=qs[_0x4f66('0x35')](_0x2f4e3f[_0x4f66('0x2c')][_0x4f66('0x35')]);_0x5d5dd5[_0x4f66('0x38')]=qs[_0x4f66('0x2d')](_[_0x4f66('0x36')](_0x2f4e3f[_0x4f66('0x2c')],_0x153613[_0x4f66('0x2d')]));if(_0x2f4e3f[_0x4f66('0x2c')][_0x4f66('0x37')]){_0x5d5dd5[_0x4f66('0x38')]=_[_0x4f66('0x3a')](_0x5d5dd5[_0x4f66('0x38')],{'$or':_['map'](_0x5d5dd5[_0x4f66('0x30')],function(_0x4107c4){var _0x39bc04={};_0x39bc04[_0x4107c4]={'$like':'%'+_0x2f4e3f[_0x4f66('0x2c')][_0x4f66('0x37')]+'%'};return _0x39bc04;})});}_0x5d5dd5=_[_0x4f66('0x3a')]({},_0x5d5dd5,_0x2f4e3f[_0x4f66('0x3b')]);return _0x2f1207[_0x4f66('0x52')](_0x5d5dd5);}})[_0x4f66('0x3c')](function(_0x14c407){if(_0x14c407){_0x55fc31=_0x14c407['length'];if(!_0x2f4e3f[_0x4f66('0x2c')][_0x4f66('0x4f')](_0x4f66('0x32'))){_0x5d5dd5['limit']=qs['limit'](_0x2f4e3f[_0x4f66('0x2c')][_0x4f66('0x33')]);_0x5d5dd5[_0x4f66('0x1c')]=qs[_0x4f66('0x1c')](_0x2f4e3f[_0x4f66('0x2c')][_0x4f66('0x1c')]);}return _0x2f1207[_0x4f66('0x52')](_0x5d5dd5);}})[_0x4f66('0x3c')](function(_0x20268d){if(_0x20268d){return _0x20268d?{'count':_0x55fc31,'rows':_0x20268d}:null;}})['then'](respondWithResult(_0x39faea,null))[_0x4f66('0x41')](handleError(_0x39faea,null));}; \ No newline at end of file +var _0x882e=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','addConditions','omit','ids','findOne','Condition','getConditions','addActions','Action','getActions','rimraf','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','Automation'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x882e,0x11f));var _0xe882=function(_0x199685,_0x1ed29f){_0x199685=_0x199685-0x0;var _0x46d148=_0x882e[_0x199685];return _0x46d148;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe882('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe882('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe882('0x2'));var Mustache=require(_0xe882('0x3'));var util=require(_0xe882('0x4'));var path=require(_0xe882('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe882('0x6'));var fs=require('fs');var fs_extra=require(_0xe882('0x7'));var _=require('lodash');var squel=require(_0xe882('0x8'));var crypto=require(_0xe882('0x9'));var jsforce=require(_0xe882('0xa'));var deskjs=require(_0xe882('0xb'));var toCsv=require(_0xe882('0xc'));var querystring=require(_0xe882('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe882('0xe'));var qs=require(_0xe882('0xf'));var as=require(_0xe882('0x10'));var hardwareService=require(_0xe882('0x11'));var logger=require(_0xe882('0x12'))(_0xe882('0x13'));var utils=require(_0xe882('0x14'));var config=require(_0xe882('0x15'));var licenseUtil=require(_0xe882('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x381152,_0x582025){_0x582025=_0x582025||0xcc;return function(_0x3b0834){if(_0x3b0834){return _0x381152[_0xe882('0x17')](_0x582025);}return _0x381152[_0xe882('0x18')](_0x582025)['end']();};}function respondWithResult(_0x338d8c,_0x11c057){_0x11c057=_0x11c057||0xc8;return function(_0x249b75){if(_0x249b75){return _0x338d8c[_0xe882('0x18')](_0x11c057)[_0xe882('0x19')](_0x249b75);}};}function respondWithFilteredResult(_0x4e3d9f,_0x749d9e){return function(_0x4bd2f0){if(_0x4bd2f0){var _0x5449b1=typeof _0x749d9e['offset']===_0xe882('0x1a')&&typeof _0x749d9e[_0xe882('0x1b')]===_0xe882('0x1a');var _0x23e200=_0x4bd2f0[_0xe882('0x1c')];var _0x5941f4=_0x5449b1?0x0:_0x749d9e[_0xe882('0x1d')];var _0x1569c1=_0x5449b1?_0x4bd2f0['count']:_0x749d9e[_0xe882('0x1d')]+_0x749d9e[_0xe882('0x1b')];var _0x44764a;if(_0x1569c1>=_0x23e200){_0x1569c1=_0x23e200;_0x44764a=0xc8;}else{_0x44764a=0xce;}_0x4e3d9f[_0xe882('0x18')](_0x44764a);return _0x4e3d9f[_0xe882('0x1e')](_0xe882('0x1f'),_0x5941f4+'-'+_0x1569c1+'/'+_0x23e200)[_0xe882('0x19')](_0x4bd2f0);}return null;};}function patchUpdates(_0x3a25fc){return function(_0x3b48c1){try{jsonpatch[_0xe882('0x20')](_0x3b48c1,_0x3a25fc,!![]);}catch(_0x5d7c96){return BPromise[_0xe882('0x21')](_0x5d7c96);}return _0x3b48c1[_0xe882('0x22')]();};}function saveUpdates(_0x225b2e,_0x9e9fde){return function(_0x21d982){if(_0x21d982){return _0x21d982[_0xe882('0x23')](_0x225b2e)[_0xe882('0x24')](function(_0x3c4963){return _0x3c4963;});}return null;};}function removeEntity(_0x1ee06f,_0x193688){return function(_0x2c0dbe){if(_0x2c0dbe){return _0x2c0dbe[_0xe882('0x25')]()[_0xe882('0x24')](function(){_0x1ee06f[_0xe882('0x18')](0xcc)[_0xe882('0x26')]();});}};}function handleEntityNotFound(_0xef7b46,_0x430526){return function(_0xa71108){if(!_0xa71108){_0xef7b46['sendStatus'](0x194);}return _0xa71108;};}function handleError(_0x2ab363,_0x38be5f){_0x38be5f=_0x38be5f||0x1f4;return function(_0x3499a4){logger[_0xe882('0x27')](_0x3499a4[_0xe882('0x28')]);if(_0x3499a4[_0xe882('0x29')]){delete _0x3499a4['name'];}_0x2ab363['status'](_0x38be5f)[_0xe882('0x2a')](_0x3499a4);};}exports['index']=function(_0x145ea9,_0x1a112a){var _0x211910={},_0x523fab={},_0x163dee={'count':0x0,'rows':[]};var _0x204066=_[_0xe882('0x2b')](db[_0xe882('0x2c')][_0xe882('0x2d')],function(_0x1038a2){return{'name':_0x1038a2[_0xe882('0x2e')],'type':_0x1038a2[_0xe882('0x2f')]['key']};});_0x523fab[_0xe882('0x30')]=_[_0xe882('0x2b')](_0x204066,'name');_0x523fab[_0xe882('0x31')]=_[_0xe882('0x32')](_0x145ea9[_0xe882('0x31')]);_0x523fab[_0xe882('0x33')]=_[_0xe882('0x34')](_0x523fab[_0xe882('0x30')],_0x523fab['query']);_0x211910[_0xe882('0x35')]=_[_0xe882('0x34')](_0x523fab['model'],qs[_0xe882('0x36')](_0x145ea9[_0xe882('0x31')]['fields']));_0x211910['attributes']=_0x211910[_0xe882('0x35')][_0xe882('0x37')]?_0x211910[_0xe882('0x35')]:_0x523fab[_0xe882('0x30')];if(!_0x145ea9[_0xe882('0x31')][_0xe882('0x38')](_0xe882('0x39'))){_0x211910[_0xe882('0x1b')]=qs['limit'](_0x145ea9['query'][_0xe882('0x1b')]);_0x211910[_0xe882('0x1d')]=qs['offset'](_0x145ea9['query'][_0xe882('0x1d')]);}_0x211910['order']=qs['sort'](_0x145ea9['query'][_0xe882('0x3a')]);_0x211910[_0xe882('0x3b')]=qs[_0xe882('0x33')](_[_0xe882('0x3c')](_0x145ea9[_0xe882('0x31')],_0x523fab[_0xe882('0x33')]),_0x204066);if(_0x145ea9[_0xe882('0x31')][_0xe882('0x3d')]){_0x211910[_0xe882('0x3b')]=_[_0xe882('0x3e')](_0x211910[_0xe882('0x3b')],{'$or':_['map'](_0x204066,function(_0x488261){if(_0x488261[_0xe882('0x2f')]!==_0xe882('0x3f')){var _0x51dee6={};_0x51dee6[_0x488261[_0xe882('0x29')]]={'$like':'%'+_0x145ea9[_0xe882('0x31')]['filter']+'%'};return _0x51dee6;}})});}_0x211910=_[_0xe882('0x3e')]({},_0x211910,_0x145ea9[_0xe882('0x40')]);var _0x27a2e8={'where':_0x211910[_0xe882('0x3b')]};return db[_0xe882('0x2c')]['count'](_0x27a2e8)['then'](function(_0x3bf72d){_0x163dee[_0xe882('0x1c')]=_0x3bf72d;if(_0x145ea9[_0xe882('0x31')]['includeAll']){_0x211910[_0xe882('0x41')]=[{'all':!![]}];}return db[_0xe882('0x2c')][_0xe882('0x42')](_0x211910);})[_0xe882('0x24')](function(_0x367141){_0x163dee['rows']=_0x367141;return _0x163dee;})[_0xe882('0x24')](respondWithFilteredResult(_0x1a112a,_0x211910))[_0xe882('0x43')](handleError(_0x1a112a,null));};exports[_0xe882('0x44')]=function(_0x3b287b,_0x2e5cbf){var _0xb20aa={'raw':![],'where':{'id':_0x3b287b[_0xe882('0x45')]['id']}},_0x25449a={};_0x25449a[_0xe882('0x30')]=_[_0xe882('0x32')](db[_0xe882('0x2c')][_0xe882('0x2d')]);_0x25449a[_0xe882('0x31')]=_[_0xe882('0x32')](_0x3b287b[_0xe882('0x31')]);_0x25449a[_0xe882('0x33')]=_[_0xe882('0x34')](_0x25449a['model'],_0x25449a['query']);_0xb20aa[_0xe882('0x35')]=_[_0xe882('0x34')](_0x25449a[_0xe882('0x30')],qs[_0xe882('0x36')](_0x3b287b[_0xe882('0x31')]['fields']));_0xb20aa[_0xe882('0x35')]=_0xb20aa[_0xe882('0x35')][_0xe882('0x37')]?_0xb20aa[_0xe882('0x35')]:_0x25449a[_0xe882('0x30')];if(_0x3b287b['query'][_0xe882('0x46')]){_0xb20aa[_0xe882('0x41')]=[{'all':!![]}];}_0xb20aa=_[_0xe882('0x3e')]({},_0xb20aa,_0x3b287b[_0xe882('0x40')]);return db[_0xe882('0x2c')][_0xe882('0x47')](_0xb20aa)[_0xe882('0x24')](handleEntityNotFound(_0x2e5cbf,null))['then'](respondWithResult(_0x2e5cbf,null))[_0xe882('0x43')](handleError(_0x2e5cbf,null));};exports[_0xe882('0x48')]=function(_0x17d3a0,_0x214ac1){return db[_0xe882('0x2c')]['create'](_0x17d3a0[_0xe882('0x49')],{})['then'](respondWithResult(_0x214ac1,0xc9))[_0xe882('0x43')](handleError(_0x214ac1,null));};exports[_0xe882('0x23')]=function(_0x1d4e85,_0xd198a6){if(_0x1d4e85[_0xe882('0x49')]['id']){delete _0x1d4e85['body']['id'];}return db[_0xe882('0x2c')][_0xe882('0x47')]({'where':{'id':_0x1d4e85['params']['id']}})[_0xe882('0x24')](handleEntityNotFound(_0xd198a6,null))[_0xe882('0x24')](saveUpdates(_0x1d4e85[_0xe882('0x49')],null))[_0xe882('0x24')](respondWithResult(_0xd198a6,null))['catch'](handleError(_0xd198a6,null));};exports[_0xe882('0x25')]=function(_0x2d5140,_0x5b1da5){return db[_0xe882('0x2c')][_0xe882('0x47')]({'where':{'id':_0x2d5140[_0xe882('0x45')]['id']}})[_0xe882('0x24')](handleEntityNotFound(_0x5b1da5,null))[_0xe882('0x24')](removeEntity(_0x5b1da5,null))['catch'](handleError(_0x5b1da5,null));};exports[_0xe882('0x4a')]=function(_0x35f515,_0x501847,_0x152301){return db['Condition'][_0xe882('0x47')]({'where':{'id':_0x35f515[_0xe882('0x45')]['id']}})[_0xe882('0x24')](handleEntityNotFound(_0x501847,null))[_0xe882('0x24')](function(_0x11779a){if(_0x11779a){return _0x11779a[_0xe882('0x4a')](_0x35f515[_0xe882('0x49')]['ids'],_[_0xe882('0x4b')](_0x35f515[_0xe882('0x49')],[_0xe882('0x4c'),'id'])||{});}})[_0xe882('0x24')](respondWithResult(_0x501847,null))[_0xe882('0x43')](handleError(_0x501847,null));};exports['getConditions']=function(_0x41e3cd,_0x2ada91,_0x33c14c){var _0x2037b1={};var _0x3516da={};var _0x45f197;var _0x5a6200;return db[_0xe882('0x2c')][_0xe882('0x4d')]({'where':{'id':_0x41e3cd['params']['id']}})[_0xe882('0x24')](handleEntityNotFound(_0x2ada91,null))[_0xe882('0x24')](function(_0x57a4ee){if(_0x57a4ee){_0x45f197=_0x57a4ee;_0x3516da[_0xe882('0x30')]=_[_0xe882('0x32')](db[_0xe882('0x4e')][_0xe882('0x2d')]);_0x3516da['query']=_['keys'](_0x41e3cd[_0xe882('0x31')]);_0x3516da[_0xe882('0x33')]=_[_0xe882('0x34')](_0x3516da[_0xe882('0x30')],_0x3516da['query']);_0x2037b1['attributes']=_[_0xe882('0x34')](_0x3516da[_0xe882('0x30')],qs['fields'](_0x41e3cd[_0xe882('0x31')][_0xe882('0x36')]));_0x2037b1[_0xe882('0x35')]=_0x2037b1[_0xe882('0x35')][_0xe882('0x37')]?_0x2037b1['attributes']:_0x3516da['model'];_0x2037b1['order']=qs[_0xe882('0x3a')](_0x41e3cd[_0xe882('0x31')][_0xe882('0x3a')]);_0x2037b1['where']=qs[_0xe882('0x33')](_[_0xe882('0x3c')](_0x41e3cd['query'],_0x3516da[_0xe882('0x33')]));if(_0x41e3cd[_0xe882('0x31')][_0xe882('0x3d')]){_0x2037b1[_0xe882('0x3b')]=_[_0xe882('0x3e')](_0x2037b1[_0xe882('0x3b')],{'$or':_[_0xe882('0x2b')](_0x2037b1[_0xe882('0x35')],function(_0x59c500){var _0x1d8b0e={};_0x1d8b0e[_0x59c500]={'$like':'%'+_0x41e3cd[_0xe882('0x31')][_0xe882('0x3d')]+'%'};return _0x1d8b0e;})});}_0x2037b1=_[_0xe882('0x3e')]({},_0x2037b1,_0x41e3cd[_0xe882('0x40')]);return _0x45f197[_0xe882('0x4f')](_0x2037b1);}})[_0xe882('0x24')](function(_0x41a7cb){if(_0x41a7cb){_0x5a6200=_0x41a7cb['length'];if(!_0x41e3cd[_0xe882('0x31')][_0xe882('0x38')](_0xe882('0x39'))){_0x2037b1[_0xe882('0x1b')]=qs[_0xe882('0x1b')](_0x41e3cd[_0xe882('0x31')][_0xe882('0x1b')]);_0x2037b1[_0xe882('0x1d')]=qs[_0xe882('0x1d')](_0x41e3cd[_0xe882('0x31')][_0xe882('0x1d')]);}return _0x45f197['getConditions'](_0x2037b1);}})[_0xe882('0x24')](function(_0x5d381a){if(_0x5d381a){return _0x5d381a?{'count':_0x5a6200,'rows':_0x5d381a}:null;}})[_0xe882('0x24')](respondWithResult(_0x2ada91,null))[_0xe882('0x43')](handleError(_0x2ada91,null));};exports[_0xe882('0x50')]=function(_0x142e9b,_0x3ed407,_0x2d9377){return db[_0xe882('0x51')]['find']({'where':{'id':_0x142e9b[_0xe882('0x45')]['id']}})[_0xe882('0x24')](handleEntityNotFound(_0x3ed407,null))[_0xe882('0x24')](function(_0x177f47){if(_0x177f47){return _0x177f47[_0xe882('0x50')](_0x142e9b['body'][_0xe882('0x4c')],_['omit'](_0x142e9b[_0xe882('0x49')],[_0xe882('0x4c'),'id'])||{});}})[_0xe882('0x24')](respondWithResult(_0x3ed407,null))[_0xe882('0x43')](handleError(_0x3ed407,null));};exports[_0xe882('0x52')]=function(_0x5cc5bb,_0x1f1dcb,_0x43a7b7){var _0x9d7c69={};var _0x1145d1={};var _0x22420c;var _0xb69637;return db[_0xe882('0x2c')]['findOne']({'where':{'id':_0x5cc5bb[_0xe882('0x45')]['id']}})[_0xe882('0x24')](handleEntityNotFound(_0x1f1dcb,null))['then'](function(_0x267315){if(_0x267315){_0x22420c=_0x267315;_0x1145d1[_0xe882('0x30')]=_[_0xe882('0x32')](db[_0xe882('0x51')][_0xe882('0x2d')]);_0x1145d1[_0xe882('0x31')]=_[_0xe882('0x32')](_0x5cc5bb[_0xe882('0x31')]);_0x1145d1[_0xe882('0x33')]=_[_0xe882('0x34')](_0x1145d1[_0xe882('0x30')],_0x1145d1[_0xe882('0x31')]);_0x9d7c69[_0xe882('0x35')]=_[_0xe882('0x34')](_0x1145d1[_0xe882('0x30')],qs['fields'](_0x5cc5bb[_0xe882('0x31')][_0xe882('0x36')]));_0x9d7c69[_0xe882('0x35')]=_0x9d7c69['attributes'][_0xe882('0x37')]?_0x9d7c69['attributes']:_0x1145d1[_0xe882('0x30')];_0x9d7c69['order']=qs[_0xe882('0x3a')](_0x5cc5bb['query'][_0xe882('0x3a')]);_0x9d7c69[_0xe882('0x3b')]=qs[_0xe882('0x33')](_['pick'](_0x5cc5bb[_0xe882('0x31')],_0x1145d1['filters']));if(_0x5cc5bb[_0xe882('0x31')]['filter']){_0x9d7c69['where']=_[_0xe882('0x3e')](_0x9d7c69[_0xe882('0x3b')],{'$or':_[_0xe882('0x2b')](_0x9d7c69[_0xe882('0x35')],function(_0x2fc093){var _0x3f98e1={};_0x3f98e1[_0x2fc093]={'$like':'%'+_0x5cc5bb[_0xe882('0x31')][_0xe882('0x3d')]+'%'};return _0x3f98e1;})});}_0x9d7c69=_[_0xe882('0x3e')]({},_0x9d7c69,_0x5cc5bb[_0xe882('0x40')]);return _0x22420c['getActions'](_0x9d7c69);}})[_0xe882('0x24')](function(_0x4cc0d7){if(_0x4cc0d7){_0xb69637=_0x4cc0d7[_0xe882('0x37')];if(!_0x5cc5bb[_0xe882('0x31')][_0xe882('0x38')](_0xe882('0x39'))){_0x9d7c69[_0xe882('0x1b')]=qs[_0xe882('0x1b')](_0x5cc5bb[_0xe882('0x31')]['limit']);_0x9d7c69[_0xe882('0x1d')]=qs[_0xe882('0x1d')](_0x5cc5bb[_0xe882('0x31')][_0xe882('0x1d')]);}return _0x22420c['getActions'](_0x9d7c69);}})[_0xe882('0x24')](function(_0x5ee96a){if(_0x5ee96a){return _0x5ee96a?{'count':_0xb69637,'rows':_0x5ee96a}:null;}})[_0xe882('0x24')](respondWithResult(_0x1f1dcb,null))[_0xe882('0x43')](handleError(_0x1f1dcb,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 8f00047..3062d6e 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 _0xe9d6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./automation.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe9d6,0x1f4));var _0x6e9d=function(_0x20e589,_0x246220){_0x20e589=_0x20e589-0x0;var _0x1d6527=_0xe9d6[_0x20e589];return _0x1d6527;};'use strict';var _=require(_0x6e9d('0x0'));var util=require(_0x6e9d('0x1'));var logger=require(_0x6e9d('0x2'))(_0x6e9d('0x3'));var moment=require(_0x6e9d('0x4'));var BPromise=require(_0x6e9d('0x5'));var rp=require(_0x6e9d('0x6'));var fs=require('fs');var path=require(_0x6e9d('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e9d('0x8'));module[_0x6e9d('0x9')]=function(_0xbea913,_0x2e72df){return _0xbea913['define']('Automation',attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6480=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./automation.attributes','define','Automation','tools_automations'];(function(_0x495f12,_0x220c4a){var _0x1fff37=function(_0x5851f5){while(--_0x5851f5){_0x495f12['push'](_0x495f12['shift']());}};_0x1fff37(++_0x220c4a);}(_0x6480,0x1d9));var _0x0648=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6480[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0648('0x0'));var logger=require(_0x0648('0x1'))(_0x0648('0x2'));var moment=require(_0x0648('0x3'));var BPromise=require(_0x0648('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0648('0x5'));var config=require(_0x0648('0x6'));var attributes=require(_0x0648('0x7'));module['exports']=function(_0x2acb12,_0x153b6f){return _0x2acb12[_0x0648('0x8')](_0x0648('0x9'),attributes,{'tableName':_0x0648('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 55300d7..d2308a8 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 _0xb7e2=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7e2,0x103));var _0x2b7e=function(_0x5f28c1,_0x2d429d){_0x5f28c1=_0x5f28c1-0x0;var _0x244481=_0xb7e2[_0x5f28c1];return _0x244481;};'use strict';var _=require(_0x2b7e('0x0'));var util=require('util');var moment=require(_0x2b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2b7e('0x4'))(_0x2b7e('0x5'));var config=require(_0x2b7e('0x6'));var jayson=require(_0x2b7e('0x7'));var client=jayson[_0x2b7e('0x8')][_0x2b7e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d7a0b,_0xc23ec4,_0x45dc9f){return new BPromise(function(_0x10a31d,_0x49491c){return client[_0x2b7e('0xa')](_0x4d7a0b,_0x45dc9f)[_0x2b7e('0xb')](function(_0x2f5991){logger[_0x2b7e('0xc')](_0x2b7e('0xd'),_0xc23ec4,'request\x20sent');logger['debug'](_0x2b7e('0xe'),_0xc23ec4,_0x2b7e('0xf'),JSON[_0x2b7e('0x10')](_0x2f5991));if(_0x2f5991[_0x2b7e('0x11')]){if(_0x2f5991[_0x2b7e('0x11')][_0x2b7e('0x12')]===0x1f4){logger[_0x2b7e('0x11')]('Automation,\x20%s,\x20%s',_0xc23ec4,_0x2f5991[_0x2b7e('0x11')][_0x2b7e('0x13')]);return _0x49491c(_0x2f5991[_0x2b7e('0x11')][_0x2b7e('0x13')]);}logger['error']('Automation,\x20%s,\x20%s',_0xc23ec4,_0x2f5991['error'][_0x2b7e('0x13')]);return _0x10a31d(_0x2f5991['error'][_0x2b7e('0x13')]);}else{logger['info'](_0x2b7e('0xd'),_0xc23ec4,'request\x20sent');_0x10a31d(_0x2f5991[_0x2b7e('0x14')][_0x2b7e('0x13')]);}})[_0x2b7e('0x15')](function(_0x4d85c3){logger[_0x2b7e('0x11')](_0x2b7e('0xd'),_0xc23ec4,_0x4d85c3);_0x49491c(_0x4d85c3);});});} \ No newline at end of file +var _0x4ca7=['util','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash'];(function(_0x54d731,_0x3f0c48){var _0x55de76=function(_0x345741){while(--_0x345741){_0x54d731['push'](_0x54d731['shift']());}};_0x55de76(++_0x3f0c48);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x2ef905,_0x5a10fe){_0x2ef905=_0x2ef905-0x0;var _0x2e1e7e=_0x4ca7[_0x2ef905];return _0x2e1e7e;};'use strict';var _=require(_0x74ca('0x0'));var util=require(_0x74ca('0x1'));var moment=require(_0x74ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x74ca('0x3'));var fs=require('fs');var Redis=require(_0x74ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x74ca('0x5'))('rpc');var config=require(_0x74ca('0x6'));var jayson=require(_0x74ca('0x7'));var client=jayson['client'][_0x74ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x572dc2,_0x453b45,_0x1d28e1){return new BPromise(function(_0x33cabd,_0x407524){return client[_0x74ca('0x9')](_0x572dc2,_0x1d28e1)[_0x74ca('0xa')](function(_0x116715){logger['info'](_0x74ca('0xb'),_0x453b45,'request\x20sent');logger[_0x74ca('0xc')](_0x74ca('0xd'),_0x453b45,'request\x20sent',JSON[_0x74ca('0xe')](_0x116715));if(_0x116715[_0x74ca('0xf')]){if(_0x116715[_0x74ca('0xf')][_0x74ca('0x10')]===0x1f4){logger[_0x74ca('0xf')](_0x74ca('0xb'),_0x453b45,_0x116715[_0x74ca('0xf')][_0x74ca('0x11')]);return _0x407524(_0x116715['error'][_0x74ca('0x11')]);}logger[_0x74ca('0xf')](_0x74ca('0xb'),_0x453b45,_0x116715[_0x74ca('0xf')][_0x74ca('0x11')]);return _0x33cabd(_0x116715[_0x74ca('0xf')][_0x74ca('0x11')]);}else{logger[_0x74ca('0x12')](_0x74ca('0xb'),_0x453b45,_0x74ca('0x13'));_0x33cabd(_0x116715[_0x74ca('0x14')][_0x74ca('0x11')]);}})[_0x74ca('0x15')](function(_0x42b90e){logger['error'](_0x74ca('0xb'),_0x453b45,_0x42b90e);_0x407524(_0x42b90e);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 1891a1e..332dc7b 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 _0xbdb0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','get','/:id','show','/:id/conditions','getActions','create','addConditions','post','/:id/actions','put','destroy','exports','multer','util','path'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xbdb0,0x189));var _0x0bdb=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xbdb0[_0x411add];return _0x238242;};'use strict';var multer=require(_0x0bdb('0x0'));var util=require(_0x0bdb('0x1'));var path=require(_0x0bdb('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bdb('0x3'));var router=express[_0x0bdb('0x4')]();var fs_extra=require(_0x0bdb('0x5'));var auth=require(_0x0bdb('0x6'));var interaction=require(_0x0bdb('0x7'));var config=require('../../config/environment');var controller=require(_0x0bdb('0x8'));router['get']('/',auth[_0x0bdb('0x9')](),controller['index']);router[_0x0bdb('0xa')](_0x0bdb('0xb'),auth[_0x0bdb('0x9')](),controller[_0x0bdb('0xc')]);router[_0x0bdb('0xa')](_0x0bdb('0xd'),auth[_0x0bdb('0x9')](),controller['getConditions']);router[_0x0bdb('0xa')]('/:id/actions',auth['isAuthenticated'](),controller[_0x0bdb('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0bdb('0xf')]);router['post']('/:id/conditions',auth[_0x0bdb('0x9')](),controller[_0x0bdb('0x10')]);router[_0x0bdb('0x11')](_0x0bdb('0x12'),auth[_0x0bdb('0x9')](),controller['addActions']);router[_0x0bdb('0x13')](_0x0bdb('0xb'),auth[_0x0bdb('0x9')](),controller['update']);router['delete']('/:id',auth[_0x0bdb('0x9')](),controller[_0x0bdb('0x14')]);module[_0x0bdb('0x15')]=router; \ No newline at end of file +var _0xbe22=['../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','update','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x13cfa1,_0x2ae2db){var _0x4686ed=function(_0x1690e5){while(--_0x1690e5){_0x13cfa1['push'](_0x13cfa1['shift']());}};_0x4686ed(++_0x2ae2db);}(_0xbe22,0x1c1));var _0x2be2=function(_0xf0916f,_0x447c4e){_0xf0916f=_0xf0916f-0x0;var _0x4a2393=_0xbe22[_0xf0916f];return _0x4a2393;};'use strict';var multer=require(_0x2be2('0x0'));var util=require(_0x2be2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2be2('0x2'));var router=express[_0x2be2('0x3')]();var fs_extra=require(_0x2be2('0x4'));var auth=require(_0x2be2('0x5'));var interaction=require(_0x2be2('0x6'));var config=require(_0x2be2('0x7'));var controller=require(_0x2be2('0x8'));router[_0x2be2('0x9')]('/',auth[_0x2be2('0xa')](),controller[_0x2be2('0xb')]);router['get'](_0x2be2('0xc'),auth[_0x2be2('0xa')](),controller[_0x2be2('0xd')]);router['get'](_0x2be2('0xe'),auth[_0x2be2('0xa')](),controller[_0x2be2('0xf')]);router[_0x2be2('0x9')](_0x2be2('0x10'),auth[_0x2be2('0xa')](),controller[_0x2be2('0x11')]);router[_0x2be2('0x12')]('/',auth['isAuthenticated'](),controller[_0x2be2('0x13')]);router[_0x2be2('0x12')]('/:id/conditions',auth[_0x2be2('0xa')](),controller[_0x2be2('0x14')]);router[_0x2be2('0x12')]('/:id/actions',auth[_0x2be2('0xa')](),controller[_0x2be2('0x15')]);router['put'](_0x2be2('0xc'),auth[_0x2be2('0xa')](),controller[_0x2be2('0x16')]);router['delete'](_0x2be2('0xc'),auth[_0x2be2('0xa')](),controller['destroy']);module[_0x2be2('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index ab6d661..e4d542f 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 _0x1e87=['#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)','exports','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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x37b8a8,_0x4735a4){var _0x247770=function(_0x2c702a){while(--_0x2c702a){_0x37b8a8['push'](_0x37b8a8['shift']());}};_0x247770(++_0x4735a4);}(_0x1e87,0x162));var _0x71e8=function(_0x2b5a41,_0x5ac813){_0x2b5a41=_0x2b5a41-0x0;var _0x50f282=_0x1e87[_0x2b5a41];return _0x50f282;};'use strict';var Sequelize=require('sequelize');module[_0x71e8('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x71e8('0x1')](_0x71e8('0x2')),'allowNull':![],'defaultValue':_0x71e8('0x2')},'description':{'type':Sequelize[_0x71e8('0x3')]},'active':{'type':Sequelize[_0x71e8('0x4')],'defaultValue':0x0,'comment':_0x71e8('0x5')},'limitCalls':{'type':Sequelize[_0x71e8('0x6')](0x4)[_0x71e8('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x71e8('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x71e8('0x3')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x71e8('0x3')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x71e8('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71e8('0x9')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x71e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71e8('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71e8('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x71e8('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71e8('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x71e8('0x6')](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x71e8('0x6')](0x3)[_0x71e8('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71e8('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x71e8('0x6')](0x3)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x71e8('0x3')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x71e8('0x3')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x71e8('0x1')](_0x71e8('0xe'),_0x71e8('0xf'),_0x71e8('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x71e8('0x11')},'dialAMDInitialSilence':{'type':Sequelize[_0x71e8('0x6')](0x9)[_0x71e8('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x71e8('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x71e8('0x6')](0x9)[_0x71e8('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x71e8('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x71e8('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x71e8('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x71e8('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x71e8('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x71e8('0x6')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x71e8('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x71e8('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x71e8('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x71e8('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x71e8('0x6')](0x9)[_0x71e8('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x71e8('0x17')},'dialOrderByScheduledAt':{'type':Sequelize[_0x71e8('0x1')](_0x71e8('0x18'),_0x71e8('0x19')),'defaultValue':_0x71e8('0x18')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x71e8('0x6')](0x3)[_0x71e8('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x71e8('0x1a')},'dialCutDigit':{'type':Sequelize[_0x71e8('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x71e8('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x71e8('0x6')](0x3)[_0x71e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x71e8('0x6')](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71e8('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x71e8('0x6')](0x3)[_0x71e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71e8('0x1d')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x71e8('0x6')](0x3)[_0x71e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x71e8('0x6')](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71e8('0x1e')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x71e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71e8('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x71e8('0x6')](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71e8('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x71e8('0x6')](0x3)[_0x71e8('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x71e8('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x71e8('0x6')](0x5)[_0x71e8('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x71e8('0x22')}}; \ No newline at end of file +var _0x04e4=['Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','Max\x20200\x20calls.'];(function(_0x2556f6,_0x40cb2d){var _0x249844=function(_0xe33268){while(--_0xe33268){_0x2556f6['push'](_0x2556f6['shift']());}};_0x249844(++_0x40cb2d);}(_0x04e4,0x17d));var _0x404e=function(_0x2d83be,_0x2cb3f1){_0x2d83be=_0x2d83be-0x0;var _0x6e5c60=_0x04e4[_0x2d83be];return _0x6e5c60;};'use strict';var Sequelize=require(_0x404e('0x0'));module[_0x404e('0x1')]={'name':{'type':Sequelize[_0x404e('0x2')],'unique':_0x404e('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x404e('0x4')]('ivr'),'allowNull':![],'defaultValue':_0x404e('0x5')},'description':{'type':Sequelize[_0x404e('0x2')]},'active':{'type':Sequelize[_0x404e('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x404e('0x7')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x404e('0x8')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x404e('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x404e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x404e('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x404e('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x404e('0x7')](0x5)[_0x404e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x404e('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x404e('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x404e('0x7')](0x5)[_0x404e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x404e('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'defaultValue':0x3,'comment':_0x404e('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x404e('0x7')](0x5)[_0x404e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x404e('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x404e('0x11')},'dialTimezone':{'type':Sequelize[_0x404e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x404e('0x2')],'defaultValue':_0x404e('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0x404e('0x4')](_0x404e('0x13'),_0x404e('0x14'),_0x404e('0x15')),'defaultValue':_0x404e('0x13')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x404e('0x16')},'dialAMDInitialSilence':{'type':Sequelize[_0x404e('0x7')](0x9)[_0x404e('0xa')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x404e('0xa')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x404e('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x404e('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x404e('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x404e('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x404e('0x19')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x404e('0xa')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x404e('0xa')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x404e('0x1a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x404e('0x7')](0x5)[_0x404e('0xa')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x404e('0x7')](0x9)[_0x404e('0xa')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x404e('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x404e('0x4')](_0x404e('0x1c'),_0x404e('0x1d')),'defaultValue':_0x404e('0x1c')},'dialPrefix':{'type':Sequelize[_0x404e('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x404e('0x1e')},'dialCutDigit':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x404e('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x404e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x404e('0x7')](0x5)[_0x404e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x404e('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x404e('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0x404e('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x404e('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x404e('0x7')](0x5)[_0x404e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x404e('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x404e('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x404e('0x7')](0x3)[_0x404e('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x404e('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x404e('0xa')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x404e('0x26')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index fe892b2..308b878 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 _0xd3f6=['Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters','pick','filter','where','merge','VIRTUAL','Campaign','includeAll','include','findAll','rows','catch','show','params','keys','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','create','role','autoAssociation','getHoppers','findOne','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','cm_hopper','COALESCE(phone,\x27\x27)','push','sequelize','removeLists','getBlackLists','CmList','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xd3f6,0x6a));var _0x6d3f=function(_0x55a89e,_0x1a05ab){_0x55a89e=_0x55a89e-0x0;var _0x3aa2bd=_0xd3f6[_0x55a89e];return _0x3aa2bd;};'use strict';var emlformat=require(_0x6d3f('0x0'));var rimraf=require(_0x6d3f('0x1'));var zipdir=require(_0x6d3f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6d3f('0x3'));var moment=require(_0x6d3f('0x4'));var BPromise=require(_0x6d3f('0x5'));var Mustache=require(_0x6d3f('0x6'));var util=require(_0x6d3f('0x7'));var path=require(_0x6d3f('0x8'));var sox=require(_0x6d3f('0x9'));var csv=require(_0x6d3f('0xa'));var ejs=require(_0x6d3f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d3f('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6d3f('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6d3f('0xe'));var Papa=require(_0x6d3f('0xf'));var Redis=require('ioredis');var authService=require(_0x6d3f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x6d3f('0x11'));var hardwareService=require(_0x6d3f('0x12'));var logger=require(_0x6d3f('0x13'))(_0x6d3f('0x14'));var utils=require(_0x6d3f('0x15'));var config=require(_0x6d3f('0x16'));var licenseUtil=require(_0x6d3f('0x17'));var db=require(_0x6d3f('0x18'))['db'];function respondWithStatusCode(_0x110010,_0x382579){_0x382579=_0x382579||0xcc;return function(_0x4fab1b){if(_0x4fab1b){return _0x110010[_0x6d3f('0x19')](_0x382579);}return _0x110010[_0x6d3f('0x1a')](_0x382579)[_0x6d3f('0x1b')]();};}function respondWithResult(_0x2a8310,_0x2887ff){_0x2887ff=_0x2887ff||0xc8;return function(_0x2b4d69){if(_0x2b4d69){return _0x2a8310[_0x6d3f('0x1a')](_0x2887ff)[_0x6d3f('0x1c')](_0x2b4d69);}};}function respondWithFilteredResult(_0x4c4cd8,_0xe3124){return function(_0x4098e5){if(_0x4098e5){var _0x1fbc0c=typeof _0xe3124[_0x6d3f('0x1d')]===_0x6d3f('0x1e')&&typeof _0xe3124['limit']===_0x6d3f('0x1e');var _0x3effcc=_0x4098e5[_0x6d3f('0x1f')];var _0x273f2e=_0x1fbc0c?0x0:_0xe3124[_0x6d3f('0x1d')];var _0x313736=_0x1fbc0c?_0x4098e5[_0x6d3f('0x1f')]:_0xe3124[_0x6d3f('0x1d')]+_0xe3124['limit'];var _0x545258;if(_0x313736>=_0x3effcc){_0x313736=_0x3effcc;_0x545258=0xc8;}else{_0x545258=0xce;}_0x4c4cd8[_0x6d3f('0x1a')](_0x545258);return _0x4c4cd8[_0x6d3f('0x20')](_0x6d3f('0x21'),_0x273f2e+'-'+_0x313736+'/'+_0x3effcc)[_0x6d3f('0x1c')](_0x4098e5);}return null;};}function patchUpdates(_0x515e03){return function(_0x31e522){try{jsonpatch[_0x6d3f('0x22')](_0x31e522,_0x515e03,!![]);}catch(_0x380bde){return BPromise[_0x6d3f('0x23')](_0x380bde);}return _0x31e522[_0x6d3f('0x24')]();};}function saveUpdates(_0x580d7d,_0x216b8c){return function(_0x17d291){if(_0x17d291){return _0x17d291[_0x6d3f('0x25')](_0x580d7d)[_0x6d3f('0x26')](function(_0x2e472b){return _0x2e472b;});}return null;};}function removeEntity(_0x44599c,_0x38428b){return function(_0x40d0ee){if(_0x40d0ee){return _0x40d0ee[_0x6d3f('0x27')]()[_0x6d3f('0x26')](function(){var _0x24c0b8=_0x40d0ee[_0x6d3f('0x28')]({'plain':!![]});var _0x2c1f4e=_0x6d3f('0x29');return db[_0x6d3f('0x2a')]['destroy']({'where':{'type':_0x2c1f4e,'resourceId':_0x24c0b8['id']}})[_0x6d3f('0x26')](function(){return _0x40d0ee;});})['then'](function(){_0x44599c[_0x6d3f('0x1a')](0xcc)[_0x6d3f('0x1b')]();});}};}function handleEntityNotFound(_0x160c03,_0x238f29){return function(_0x71e35e){if(!_0x71e35e){_0x160c03[_0x6d3f('0x19')](0x194);}return _0x71e35e;};}function handleError(_0x9d8daf,_0x3c5445){_0x3c5445=_0x3c5445||0x1f4;return function(_0x36ff20){logger[_0x6d3f('0x2b')](_0x36ff20[_0x6d3f('0x2c')]);if(_0x36ff20[_0x6d3f('0x2d')]){delete _0x36ff20['name'];}_0x9d8daf[_0x6d3f('0x1a')](_0x3c5445)[_0x6d3f('0x2e')](_0x36ff20);};}exports[_0x6d3f('0x2f')]=function(_0x470019,_0x40754e){var _0x17b983={},_0x161771={},_0x49ee16={'count':0x0,'rows':[]};var _0x217753=_[_0x6d3f('0x30')](db['Campaign'][_0x6d3f('0x31')],function(_0x5e8234){return{'name':_0x5e8234[_0x6d3f('0x32')],'type':_0x5e8234[_0x6d3f('0x33')]['key']};});_0x161771[_0x6d3f('0x34')]=_['map'](_0x217753,_0x6d3f('0x2d'));_0x161771[_0x6d3f('0x35')]=_['keys'](_0x470019['query']);_0x161771['filters']=_[_0x6d3f('0x36')](_0x161771[_0x6d3f('0x34')],_0x161771['query']);_0x17b983[_0x6d3f('0x37')]=_[_0x6d3f('0x36')](_0x161771[_0x6d3f('0x34')],qs[_0x6d3f('0x38')](_0x470019[_0x6d3f('0x35')]['fields']));_0x17b983['attributes']=_0x17b983[_0x6d3f('0x37')][_0x6d3f('0x39')]?_0x17b983[_0x6d3f('0x37')]:_0x161771[_0x6d3f('0x34')];if(!_0x470019[_0x6d3f('0x35')][_0x6d3f('0x3a')](_0x6d3f('0x3b'))){_0x17b983['limit']=qs[_0x6d3f('0x3c')](_0x470019[_0x6d3f('0x35')][_0x6d3f('0x3c')]);_0x17b983[_0x6d3f('0x1d')]=qs[_0x6d3f('0x1d')](_0x470019['query']['offset']);}_0x17b983[_0x6d3f('0x3d')]=qs[_0x6d3f('0x3e')](_0x470019[_0x6d3f('0x35')]['sort']);_0x17b983['where']=qs[_0x6d3f('0x3f')](_[_0x6d3f('0x40')](_0x470019[_0x6d3f('0x35')],_0x161771[_0x6d3f('0x3f')]),_0x217753);if(_0x470019['query'][_0x6d3f('0x41')]){_0x17b983[_0x6d3f('0x42')]=_[_0x6d3f('0x43')](_0x17b983[_0x6d3f('0x42')],{'$or':_[_0x6d3f('0x30')](_0x217753,function(_0x2be777){if(_0x2be777[_0x6d3f('0x33')]!==_0x6d3f('0x44')){var _0x4f2a14={};_0x4f2a14[_0x2be777[_0x6d3f('0x2d')]]={'$like':'%'+_0x470019[_0x6d3f('0x35')][_0x6d3f('0x41')]+'%'};return _0x4f2a14;}})});}_0x17b983=_[_0x6d3f('0x43')]({},_0x17b983,_0x470019['options']);var _0x388df2={'where':_0x17b983[_0x6d3f('0x42')]};return db[_0x6d3f('0x45')]['count'](_0x388df2)[_0x6d3f('0x26')](function(_0x5d1c43){_0x49ee16[_0x6d3f('0x1f')]=_0x5d1c43;if(_0x470019[_0x6d3f('0x35')][_0x6d3f('0x46')]){_0x17b983[_0x6d3f('0x47')]=[{'all':!![]}];}return db[_0x6d3f('0x45')][_0x6d3f('0x48')](_0x17b983);})[_0x6d3f('0x26')](function(_0x33b251){_0x49ee16[_0x6d3f('0x49')]=_0x33b251;return _0x49ee16;})[_0x6d3f('0x26')](respondWithFilteredResult(_0x40754e,_0x17b983))[_0x6d3f('0x4a')](handleError(_0x40754e,null));};exports[_0x6d3f('0x4b')]=function(_0x1043e4,_0x4d0fd3){var _0x52c636={'raw':![],'where':{'id':_0x1043e4[_0x6d3f('0x4c')]['id']}},_0x42a3ca={};_0x42a3ca[_0x6d3f('0x34')]=_[_0x6d3f('0x4d')](db[_0x6d3f('0x45')]['rawAttributes']);_0x42a3ca['query']=_[_0x6d3f('0x4d')](_0x1043e4['query']);_0x42a3ca[_0x6d3f('0x3f')]=_[_0x6d3f('0x36')](_0x42a3ca[_0x6d3f('0x34')],_0x42a3ca['query']);_0x52c636['attributes']=_['intersection'](_0x42a3ca['model'],qs[_0x6d3f('0x38')](_0x1043e4['query'][_0x6d3f('0x38')]));_0x52c636[_0x6d3f('0x37')]=_0x52c636[_0x6d3f('0x37')][_0x6d3f('0x39')]?_0x52c636['attributes']:_0x42a3ca[_0x6d3f('0x34')];if(_0x1043e4[_0x6d3f('0x35')][_0x6d3f('0x46')]){_0x52c636[_0x6d3f('0x47')]=[{'all':!![]}];}_0x52c636=_[_0x6d3f('0x43')]({},_0x52c636,_0x1043e4[_0x6d3f('0x4e')]);return db[_0x6d3f('0x45')][_0x6d3f('0x4f')](_0x52c636)[_0x6d3f('0x26')](handleEntityNotFound(_0x4d0fd3,null))[_0x6d3f('0x26')](respondWithResult(_0x4d0fd3,null))[_0x6d3f('0x4a')](handleError(_0x4d0fd3,null));};exports['create']=function(_0x1ff459,_0x474d98){return db['Campaign']['create'](_0x1ff459[_0x6d3f('0x50')],{})[_0x6d3f('0x26')](function(_0x2aa8a9){var _0x3f8cce=_0x1ff459[_0x6d3f('0x51')][_0x6d3f('0x28')]({'plain':!![]});if(!_0x3f8cce)throw new Error(_0x6d3f('0x52'));if(_0x3f8cce['role']===_0x6d3f('0x51')){var _0x4d9121=_0x2aa8a9[_0x6d3f('0x28')]({'plain':!![]});var _0x1ce10d=_0x6d3f('0x29');return db[_0x6d3f('0x53')][_0x6d3f('0x4f')]({'where':{'name':_0x1ce10d,'userProfileId':_0x3f8cce[_0x6d3f('0x54')]},'raw':!![]})[_0x6d3f('0x26')](function(_0x280497){if(_0x280497&&_0x280497['autoAssociation']===0x0){return db[_0x6d3f('0x2a')]['create']({'name':_0x4d9121['name'],'resourceId':_0x4d9121['id'],'type':_0x280497[_0x6d3f('0x2d')],'sectionId':_0x280497['id']},{})[_0x6d3f('0x26')](function(){return _0x2aa8a9;});}else{return _0x2aa8a9;}})[_0x6d3f('0x4a')](function(_0x5cfafb){logger[_0x6d3f('0x2b')](_0x6d3f('0x55'),_0x5cfafb);throw _0x5cfafb;});}return _0x2aa8a9;})['then'](respondWithResult(_0x474d98,0xc9))['catch'](handleError(_0x474d98,null));};exports[_0x6d3f('0x56')]=function(_0x4b70db,_0x570a53){var _0x223c79={'where':{'id':_0x4b70db[_0x6d3f('0x4c')]['id']}},_0x443813={};_0x443813[_0x6d3f('0x34')]=_['keys'](db['Campaign']['rawAttributes']);_0x223c79['attributes']=_[_0x6d3f('0x36')](_0x443813['model'],qs[_0x6d3f('0x38')](_0x4b70db[_0x6d3f('0x35')][_0x6d3f('0x38')]));_0x223c79[_0x6d3f('0x37')]=_0x223c79[_0x6d3f('0x37')]['length']?_0x223c79[_0x6d3f('0x37')]:_0x443813['model'];if(_0x4b70db[_0x6d3f('0x35')][_0x6d3f('0x46')]){_0x223c79[_0x6d3f('0x47')]=[{'all':!![]}];}_0x223c79=_[_0x6d3f('0x43')]({},_0x223c79,_0x4b70db['options']);return db[_0x6d3f('0x45')][_0x6d3f('0x4f')](_0x223c79)[_0x6d3f('0x26')](handleEntityNotFound(_0x570a53,null))[_0x6d3f('0x26')](function(_0x27cf83){if(_0x27cf83){var _0x528905=_0x27cf83[_0x6d3f('0x28')]({'plain':!![]});_0x528905=qs[_0x6d3f('0x57')](_0x528905,['id',_0x6d3f('0x58'),'updatedAt']);_0x4b70db[_0x6d3f('0x50')]=_[_0x6d3f('0x57')](_0x4b70db[_0x6d3f('0x50')],['id',_0x6d3f('0x58'),_0x6d3f('0x59')]);return db[_0x6d3f('0x45')][_0x6d3f('0x5a')](_[_0x6d3f('0x43')](_0x528905,_0x4b70db[_0x6d3f('0x50')]),{'include':_0x4b70db[_0x6d3f('0x35')][_0x6d3f('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x1c9202){var _0x1d8289=_0x4b70db[_0x6d3f('0x51')][_0x6d3f('0x28')]({'plain':!![]});if(!_0x1d8289)throw new Error(_0x6d3f('0x52'));if(_0x1d8289[_0x6d3f('0x5b')]===_0x6d3f('0x51')){var _0x2e3410=_0x1c9202[_0x6d3f('0x28')]({'plain':!![]});var _0x4a5237='IvrCampaigns';return db['UserProfileSection'][_0x6d3f('0x4f')]({'where':{'name':_0x4a5237,'userProfileId':_0x1d8289[_0x6d3f('0x54')]},'raw':!![]})[_0x6d3f('0x26')](function(_0xbb8d20){if(_0xbb8d20&&_0xbb8d20[_0x6d3f('0x5c')]===0x0){return db[_0x6d3f('0x2a')]['create']({'name':_0x2e3410['name'],'resourceId':_0x2e3410['id'],'type':_0xbb8d20[_0x6d3f('0x2d')],'sectionId':_0xbb8d20['id']},{})[_0x6d3f('0x26')](function(){return _0x1c9202;});}else{return _0x1c9202;}})[_0x6d3f('0x4a')](function(_0x1d4217){logger[_0x6d3f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d4217);throw _0x1d4217;});}return _0x1c9202;});}})[_0x6d3f('0x26')](respondWithResult(_0x570a53,0xc9))[_0x6d3f('0x4a')](handleError(_0x570a53,null));};exports['update']=function(_0x39f23d,_0x7c9aaf){if(_0x39f23d['body']['id']){delete _0x39f23d[_0x6d3f('0x50')]['id'];}return db[_0x6d3f('0x45')][_0x6d3f('0x4f')]({'where':{'id':_0x39f23d[_0x6d3f('0x4c')]['id']}})[_0x6d3f('0x26')](handleEntityNotFound(_0x7c9aaf,null))['then'](saveUpdates(_0x39f23d[_0x6d3f('0x50')],null))[_0x6d3f('0x26')](respondWithResult(_0x7c9aaf,null))[_0x6d3f('0x4a')](handleError(_0x7c9aaf,null));};exports[_0x6d3f('0x27')]=function(_0xaee091,_0x212f84){return db[_0x6d3f('0x45')][_0x6d3f('0x4f')]({'where':{'id':_0xaee091[_0x6d3f('0x4c')]['id']}})[_0x6d3f('0x26')](handleEntityNotFound(_0x212f84,null))[_0x6d3f('0x26')](removeEntity(_0x212f84,null))[_0x6d3f('0x4a')](handleError(_0x212f84,null));};exports[_0x6d3f('0x5d')]=function(_0x3c2d29,_0x2934a3,_0x228fc5){var _0x35a24c={'raw':!![],'where':{}};var _0x3da96a={};var _0x3add03={'count':0x0,'rows':[]};return db[_0x6d3f('0x45')][_0x6d3f('0x5e')]({'where':{'id':_0x3c2d29['params']['id']}})['then'](handleEntityNotFound(_0x2934a3,null))[_0x6d3f('0x26')](function(_0x3eeabe){if(_0x3eeabe){_0x3da96a[_0x6d3f('0x34')]=_[_0x6d3f('0x4d')](db['CmHopper']['rawAttributes']);_0x3da96a['query']=_[_0x6d3f('0x4d')](_0x3c2d29[_0x6d3f('0x35')]);_0x3da96a[_0x6d3f('0x3f')]=_[_0x6d3f('0x36')](_0x3da96a[_0x6d3f('0x34')],_0x3da96a[_0x6d3f('0x35')]);_0x35a24c[_0x6d3f('0x37')]=_[_0x6d3f('0x36')](_0x3da96a[_0x6d3f('0x34')],qs[_0x6d3f('0x38')](_0x3c2d29[_0x6d3f('0x35')][_0x6d3f('0x38')]));_0x35a24c[_0x6d3f('0x37')]=_0x35a24c[_0x6d3f('0x37')][_0x6d3f('0x39')]?_0x35a24c[_0x6d3f('0x37')]:_0x3da96a['model'];if(!_0x3c2d29['query'][_0x6d3f('0x3a')](_0x6d3f('0x3b'))){_0x35a24c[_0x6d3f('0x3c')]=qs['limit'](_0x3c2d29['query']['limit']);_0x35a24c[_0x6d3f('0x1d')]=qs[_0x6d3f('0x1d')](_0x3c2d29[_0x6d3f('0x35')][_0x6d3f('0x1d')]);}_0x35a24c['order']=qs[_0x6d3f('0x3e')](_0x3c2d29[_0x6d3f('0x35')][_0x6d3f('0x3e')]);_0x35a24c['where']=qs[_0x6d3f('0x3f')](_[_0x6d3f('0x40')](_0x3c2d29[_0x6d3f('0x35')],_0x3da96a[_0x6d3f('0x3f')]));_0x35a24c[_0x6d3f('0x42')]['CampaignId']=_0x3eeabe['id'];if(_0x3c2d29['query']['filter']){_0x35a24c[_0x6d3f('0x42')]=_[_0x6d3f('0x43')](_0x35a24c[_0x6d3f('0x42')],{'$or':_[_0x6d3f('0x30')](_0x35a24c[_0x6d3f('0x37')],function(_0x4ab5b8){var _0x27bbfb={};_0x27bbfb[_0x4ab5b8]={'$like':'%'+_0x3c2d29[_0x6d3f('0x35')][_0x6d3f('0x41')]+'%'};return _0x27bbfb;})});}_0x35a24c=_['merge']({},_0x35a24c,_0x3c2d29[_0x6d3f('0x4e')]);return db[_0x6d3f('0x5f')]['count']({'where':_0x35a24c[_0x6d3f('0x42')]})[_0x6d3f('0x26')](function(_0x403544){_0x3add03[_0x6d3f('0x1f')]=_0x403544;if(_0x3c2d29['query'][_0x6d3f('0x46')]){_0x35a24c['include']=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x35a24c);})[_0x6d3f('0x26')](function(_0x4272c5){_0x3add03[_0x6d3f('0x49')]=_0x4272c5;return _0x3add03;});}})[_0x6d3f('0x26')](respondWithFilteredResult(_0x2934a3,_0x35a24c))['catch'](handleError(_0x2934a3,null));};exports[_0x6d3f('0x60')]=function(_0x4805df,_0x47d6d1,_0x1497c4){var _0x4c8767={'raw':!![],'where':{}};var _0x5344f6={};var _0x2e0b3e={'count':0x0,'rows':[]};return db['Campaign'][_0x6d3f('0x5e')]({'where':{'id':_0x4805df[_0x6d3f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x47d6d1,null))[_0x6d3f('0x26')](function(_0x3eb98f){if(_0x3eb98f){_0x5344f6['model']=_['keys'](db[_0x6d3f('0x61')][_0x6d3f('0x31')]);_0x5344f6[_0x6d3f('0x35')]=_[_0x6d3f('0x4d')](_0x4805df[_0x6d3f('0x35')]);_0x5344f6[_0x6d3f('0x3f')]=_['intersection'](_0x5344f6[_0x6d3f('0x34')],_0x5344f6[_0x6d3f('0x35')]);_0x4c8767['attributes']=_['intersection'](_0x5344f6[_0x6d3f('0x34')],qs['fields'](_0x4805df[_0x6d3f('0x35')]['fields']));_0x4c8767[_0x6d3f('0x37')]=_0x4c8767[_0x6d3f('0x37')][_0x6d3f('0x39')]?_0x4c8767[_0x6d3f('0x37')]:_0x5344f6['model'];if(!_0x4805df[_0x6d3f('0x35')][_0x6d3f('0x3a')](_0x6d3f('0x3b'))){_0x4c8767[_0x6d3f('0x3c')]=qs[_0x6d3f('0x3c')](_0x4805df[_0x6d3f('0x35')][_0x6d3f('0x3c')]);_0x4c8767['offset']=qs[_0x6d3f('0x1d')](_0x4805df[_0x6d3f('0x35')][_0x6d3f('0x1d')]);}_0x4c8767[_0x6d3f('0x3d')]=qs[_0x6d3f('0x3e')](_0x4805df[_0x6d3f('0x35')]['sort']);_0x4c8767[_0x6d3f('0x42')]=qs[_0x6d3f('0x3f')](_['pick'](_0x4805df['query'],_0x5344f6[_0x6d3f('0x3f')]));_0x4c8767[_0x6d3f('0x42')][_0x6d3f('0x62')]=_0x3eb98f['id'];if(_0x4805df['query']['filter']){_0x4c8767['where']=_['merge'](_0x4c8767[_0x6d3f('0x42')],{'$or':_[_0x6d3f('0x30')](_0x4c8767[_0x6d3f('0x37')],function(_0x316676){var _0x5284c5={};_0x5284c5[_0x316676]={'$like':'%'+_0x4805df['query'][_0x6d3f('0x41')]+'%'};return _0x5284c5;})});}_0x4c8767=_['merge']({},_0x4c8767,_0x4805df[_0x6d3f('0x4e')]);return db[_0x6d3f('0x61')]['count']({'where':_0x4c8767[_0x6d3f('0x42')]})[_0x6d3f('0x26')](function(_0x373c99){_0x2e0b3e[_0x6d3f('0x1f')]=_0x373c99;if(_0x4805df['query'][_0x6d3f('0x46')]){_0x4c8767[_0x6d3f('0x47')]=[{'all':!![]}];}return db[_0x6d3f('0x61')]['findAll'](_0x4c8767);})['then'](function(_0x1880eb){_0x2e0b3e[_0x6d3f('0x49')]=_0x1880eb;return _0x2e0b3e;});}})[_0x6d3f('0x26')](respondWithFilteredResult(_0x47d6d1,_0x4c8767))['catch'](handleError(_0x47d6d1,null));};exports[_0x6d3f('0x63')]=function(_0x13ee04,_0x45e430,_0x5a354d){var _0x52be23={'raw':!![],'where':{}};var _0x5e2dae={};var _0xfb228b={'count':0x0,'rows':[]};return db[_0x6d3f('0x45')][_0x6d3f('0x5e')]({'where':{'id':_0x13ee04['params']['id']}})['then'](handleEntityNotFound(_0x45e430,null))[_0x6d3f('0x26')](function(_0x49d03f){if(_0x49d03f){_0x5e2dae[_0x6d3f('0x34')]=_['keys'](db['CmHopperFinal'][_0x6d3f('0x31')]);_0x5e2dae['query']=_['keys'](_0x13ee04[_0x6d3f('0x35')]);_0x5e2dae['filters']=_[_0x6d3f('0x36')](_0x5e2dae[_0x6d3f('0x34')],_0x5e2dae[_0x6d3f('0x35')]);_0x52be23[_0x6d3f('0x37')]=_[_0x6d3f('0x36')](_0x5e2dae['model'],qs[_0x6d3f('0x38')](_0x13ee04[_0x6d3f('0x35')][_0x6d3f('0x38')]));_0x52be23[_0x6d3f('0x37')]=_0x52be23[_0x6d3f('0x37')]['length']?_0x52be23[_0x6d3f('0x37')]:_0x5e2dae['model'];if(!_0x13ee04[_0x6d3f('0x35')]['hasOwnProperty'](_0x6d3f('0x3b'))){_0x52be23['limit']=qs[_0x6d3f('0x3c')](_0x13ee04[_0x6d3f('0x35')][_0x6d3f('0x3c')]);_0x52be23[_0x6d3f('0x1d')]=qs[_0x6d3f('0x1d')](_0x13ee04[_0x6d3f('0x35')]['offset']);}_0x52be23[_0x6d3f('0x3d')]=qs[_0x6d3f('0x3e')](_0x13ee04[_0x6d3f('0x35')][_0x6d3f('0x3e')]);_0x52be23[_0x6d3f('0x42')]=qs[_0x6d3f('0x3f')](_[_0x6d3f('0x40')](_0x13ee04[_0x6d3f('0x35')],_0x5e2dae[_0x6d3f('0x3f')]));_0x52be23['where'][_0x6d3f('0x62')]=_0x49d03f['id'];if(_0x13ee04[_0x6d3f('0x35')][_0x6d3f('0x41')]){_0x52be23[_0x6d3f('0x42')]=_[_0x6d3f('0x43')](_0x52be23[_0x6d3f('0x42')],{'$or':_[_0x6d3f('0x30')](_0x52be23['attributes'],function(_0x218840){var _0x591d24={};_0x591d24[_0x218840]={'$like':'%'+_0x13ee04[_0x6d3f('0x35')]['filter']+'%'};return _0x591d24;})});}_0x52be23=_[_0x6d3f('0x43')]({},_0x52be23,_0x13ee04[_0x6d3f('0x4e')]);return db[_0x6d3f('0x64')][_0x6d3f('0x1f')]({'where':_0x52be23[_0x6d3f('0x42')]})['then'](function(_0x14d6d2){_0xfb228b[_0x6d3f('0x1f')]=_0x14d6d2;if(_0x13ee04[_0x6d3f('0x35')][_0x6d3f('0x46')]){_0x52be23['include']=[{'all':!![]}];}return db[_0x6d3f('0x64')][_0x6d3f('0x48')](_0x52be23);})[_0x6d3f('0x26')](function(_0x39420c){_0xfb228b[_0x6d3f('0x49')]=_0x39420c;return _0xfb228b;});}})['then'](respondWithFilteredResult(_0x45e430,_0x52be23))[_0x6d3f('0x4a')](handleError(_0x45e430,null));};exports[_0x6d3f('0x65')]=function(_0x5805ba,_0x31e9bc,_0x479e92){var _0x4d8cc2={'raw':!![],'where':{}};var _0x46b5e5={};var _0x2b0aa0={'count':0x0,'rows':[]};return db[_0x6d3f('0x45')][_0x6d3f('0x5e')]({'where':{'id':_0x5805ba[_0x6d3f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x31e9bc,null))[_0x6d3f('0x26')](function(_0x59c808){if(_0x59c808){_0x46b5e5['model']=_['keys'](db[_0x6d3f('0x66')][_0x6d3f('0x31')]);_0x46b5e5['query']=_[_0x6d3f('0x4d')](_0x5805ba[_0x6d3f('0x35')]);_0x46b5e5['filters']=_[_0x6d3f('0x36')](_0x46b5e5[_0x6d3f('0x34')],_0x46b5e5[_0x6d3f('0x35')]);_0x4d8cc2[_0x6d3f('0x37')]=_[_0x6d3f('0x36')](_0x46b5e5[_0x6d3f('0x34')],qs[_0x6d3f('0x38')](_0x5805ba['query'][_0x6d3f('0x38')]));_0x4d8cc2[_0x6d3f('0x37')]=_0x4d8cc2[_0x6d3f('0x37')][_0x6d3f('0x39')]?_0x4d8cc2['attributes']:_0x46b5e5['model'];if(!_0x5805ba[_0x6d3f('0x35')][_0x6d3f('0x3a')](_0x6d3f('0x3b'))){_0x4d8cc2[_0x6d3f('0x3c')]=qs[_0x6d3f('0x3c')](_0x5805ba['query'][_0x6d3f('0x3c')]);_0x4d8cc2[_0x6d3f('0x1d')]=qs[_0x6d3f('0x1d')](_0x5805ba[_0x6d3f('0x35')][_0x6d3f('0x1d')]);}_0x4d8cc2[_0x6d3f('0x3d')]=qs[_0x6d3f('0x3e')](_0x5805ba[_0x6d3f('0x35')][_0x6d3f('0x3e')]);_0x4d8cc2[_0x6d3f('0x42')]=qs[_0x6d3f('0x3f')](_[_0x6d3f('0x40')](_0x5805ba[_0x6d3f('0x35')],_0x46b5e5['filters']));_0x4d8cc2[_0x6d3f('0x42')][_0x6d3f('0x62')]=_0x59c808['id'];if(_0x5805ba[_0x6d3f('0x35')][_0x6d3f('0x41')]){_0x4d8cc2[_0x6d3f('0x42')]=_[_0x6d3f('0x43')](_0x4d8cc2[_0x6d3f('0x42')],{'$or':_[_0x6d3f('0x30')](_0x4d8cc2[_0x6d3f('0x37')],function(_0x36c528){var _0x19748a={};_0x19748a[_0x36c528]={'$like':'%'+_0x5805ba[_0x6d3f('0x35')][_0x6d3f('0x41')]+'%'};return _0x19748a;})});}_0x4d8cc2=_[_0x6d3f('0x43')]({},_0x4d8cc2,_0x5805ba[_0x6d3f('0x4e')]);return db[_0x6d3f('0x66')][_0x6d3f('0x1f')]({'where':_0x4d8cc2[_0x6d3f('0x42')]})[_0x6d3f('0x26')](function(_0x50fcc0){_0x2b0aa0['count']=_0x50fcc0;if(_0x5805ba[_0x6d3f('0x35')]['includeAll']){_0x4d8cc2['include']=[{'all':!![]}];}return db[_0x6d3f('0x66')][_0x6d3f('0x48')](_0x4d8cc2);})['then'](function(_0x53c57a){_0x2b0aa0[_0x6d3f('0x49')]=_0x53c57a;return _0x2b0aa0;});}})[_0x6d3f('0x26')](respondWithFilteredResult(_0x31e9bc,_0x4d8cc2))[_0x6d3f('0x4a')](handleError(_0x31e9bc,null));};exports[_0x6d3f('0x67')]=function(_0x229a6d,_0x5c7da0,_0xf1ad88){var _0x39f533={};var _0x1117b6={};var _0x295cca;var _0x4c90c3;return db['Campaign'][_0x6d3f('0x5e')]({'where':{'id':_0x229a6d[_0x6d3f('0x4c')]['id']}})[_0x6d3f('0x26')](handleEntityNotFound(_0x5c7da0,null))[_0x6d3f('0x26')](function(_0x2a3034){if(_0x2a3034){_0x295cca=_0x2a3034;_0x1117b6[_0x6d3f('0x34')]=_['keys'](db['CmList'][_0x6d3f('0x31')]);_0x1117b6[_0x6d3f('0x35')]=_['keys'](_0x229a6d['query']);_0x1117b6['filters']=_[_0x6d3f('0x36')](_0x1117b6[_0x6d3f('0x34')],_0x1117b6[_0x6d3f('0x35')]);_0x39f533[_0x6d3f('0x37')]=_[_0x6d3f('0x36')](_0x1117b6['model'],qs[_0x6d3f('0x38')](_0x229a6d[_0x6d3f('0x35')][_0x6d3f('0x38')]));_0x39f533[_0x6d3f('0x37')]=_0x39f533[_0x6d3f('0x37')][_0x6d3f('0x39')]?_0x39f533[_0x6d3f('0x37')]:_0x1117b6[_0x6d3f('0x34')];_0x39f533[_0x6d3f('0x3d')]=qs[_0x6d3f('0x3e')](_0x229a6d[_0x6d3f('0x35')]['sort']);_0x39f533['where']=qs[_0x6d3f('0x3f')](_[_0x6d3f('0x40')](_0x229a6d['query'],_0x1117b6['filters']));if(_0x229a6d[_0x6d3f('0x35')][_0x6d3f('0x41')]){_0x39f533[_0x6d3f('0x42')]=_[_0x6d3f('0x43')](_0x39f533[_0x6d3f('0x42')],{'$or':_[_0x6d3f('0x30')](_0x39f533[_0x6d3f('0x37')],function(_0x5323e7){var _0x593999={};_0x593999[_0x5323e7]={'$like':'%'+_0x229a6d[_0x6d3f('0x35')][_0x6d3f('0x41')]+'%'};return _0x593999;})});}_0x39f533=_[_0x6d3f('0x43')]({},_0x39f533,_0x229a6d[_0x6d3f('0x4e')]);return _0x295cca['getLists'](_0x39f533);}})[_0x6d3f('0x26')](function(_0x3b49c2){if(_0x3b49c2){_0x4c90c3=_0x3b49c2[_0x6d3f('0x39')];if(!_0x229a6d[_0x6d3f('0x35')][_0x6d3f('0x3a')](_0x6d3f('0x3b'))){_0x39f533[_0x6d3f('0x3c')]=qs['limit'](_0x229a6d[_0x6d3f('0x35')][_0x6d3f('0x3c')]);_0x39f533[_0x6d3f('0x1d')]=qs[_0x6d3f('0x1d')](_0x229a6d['query'][_0x6d3f('0x1d')]);}return _0x295cca[_0x6d3f('0x67')](_0x39f533);}})[_0x6d3f('0x26')](function(_0xe2007e){if(_0xe2007e){return _0xe2007e?{'count':_0x4c90c3,'rows':_0xe2007e}:null;}})['then'](respondWithResult(_0x5c7da0,null))[_0x6d3f('0x4a')](handleError(_0x5c7da0,null));};exports['addLists']=function(_0x1663e9,_0x10f4e2,_0x3b5bba){var _0x51ac04,_0x5049c0;return db[_0x6d3f('0x45')][_0x6d3f('0x4f')]({'where':{'id':_0x1663e9['params']['id']}})[_0x6d3f('0x26')](handleEntityNotFound(_0x10f4e2,null))[_0x6d3f('0x26')](function(_0x1f9e1f){if(_0x1f9e1f){_0x5049c0=_0x1f9e1f;return _0x1f9e1f[_0x6d3f('0x68')](_0x1663e9[_0x6d3f('0x50')][_0x6d3f('0x69')],_[_0x6d3f('0x57')](_0x1663e9['body'],[_0x6d3f('0x69'),'id'])||{});}return null;})[_0x6d3f('0x6a')](function(_0x54caae){var _0x28584e;_0x51ac04=_0x54caae||[];var _0x4460de=[];if(_0x54caae){for(var _0x1bb987=0x0;_0x1bb987<_0x54caae[_0x6d3f('0x39')];_0x1bb987+=0x1){var _0x129129=_0x54caae[_0x1bb987][_0x6d3f('0x28')]({'plain':!![]});_0x5049c0[_0x6d3f('0x6b')]=_0x1663e9[_0x6d3f('0x50')][_0x6d3f('0x6b')]?_0x1663e9[_0x6d3f('0x50')][_0x6d3f('0x6b')]:_0x5049c0[_0x6d3f('0x6b')];switch(_0x5049c0[_0x6d3f('0x6b')]){case _0x6d3f('0x6c'):_0x28584e=squel[_0x6d3f('0x6d')]()[_0x6d3f('0x6e')]('cm_hopper')[_0x6d3f('0x6f')]([_0x6d3f('0x70'),'scheduledAt',_0x6d3f('0x71'),_0x6d3f('0x72'),_0x6d3f('0x62'),_0x6d3f('0x58'),_0x6d3f('0x59')],squel[_0x6d3f('0x73')]()['field'](_0x6d3f('0x70'),_0x6d3f('0x70'))[_0x6d3f('0x74')](_0x6d3f('0x75'),_0x6d3f('0x76'))[_0x6d3f('0x74')]('id',_0x6d3f('0x71'))[_0x6d3f('0x74')](_0x129129[_0x6d3f('0x77')][_0x6d3f('0x78')](),'ListId')[_0x6d3f('0x74')](_0x1663e9['params']['id'][_0x6d3f('0x78')](),_0x6d3f('0x62'))[_0x6d3f('0x74')](_0x6d3f('0x75'),_0x6d3f('0x58'))['field'](_0x6d3f('0x75'),_0x6d3f('0x59'))[_0x6d3f('0x79')](_0x6d3f('0x7a'))[_0x6d3f('0x42')](_0x6d3f('0x7b'))[_0x6d3f('0x42')](_0x6d3f('0x7c'),_0x129129[_0x6d3f('0x77')]['toString']())[_0x6d3f('0x42')](_0x6d3f('0x7d'))[_0x6d3f('0x42')](_0x6d3f('0x7e'),squel[_0x6d3f('0x73')]()[_0x6d3f('0x74')](_0x6d3f('0x7f'))[_0x6d3f('0x79')]('cm_hopper_final')[_0x6d3f('0x42')](_0x6d3f('0x80'),_0x1663e9[_0x6d3f('0x4c')]['id'][_0x6d3f('0x78')]()))[_0x6d3f('0x42')](_0x6d3f('0x7e'),squel[_0x6d3f('0x73')]()['field']('COALESCE(phone,\x27\x27)')['from'](_0x6d3f('0x81'))[_0x6d3f('0x42')](_0x6d3f('0x80'),_0x1663e9[_0x6d3f('0x4c')]['id'][_0x6d3f('0x78')]())))[_0x6d3f('0x78')]();break;case'onlyIfOpen':_0x28584e=squel[_0x6d3f('0x6d')]()[_0x6d3f('0x6e')]('cm_hopper')['fromQuery']([_0x6d3f('0x70'),'scheduledAt',_0x6d3f('0x71'),_0x6d3f('0x72'),_0x6d3f('0x62'),_0x6d3f('0x58'),_0x6d3f('0x59')],squel[_0x6d3f('0x73')]()[_0x6d3f('0x74')](_0x6d3f('0x70'),'phone')['field'](_0x6d3f('0x75'),_0x6d3f('0x76'))['field']('id','ContactId')[_0x6d3f('0x74')](_0x129129[_0x6d3f('0x77')][_0x6d3f('0x78')](),_0x6d3f('0x72'))[_0x6d3f('0x74')](_0x1663e9['params']['id'][_0x6d3f('0x78')](),_0x6d3f('0x62'))[_0x6d3f('0x74')](_0x6d3f('0x75'),'createdAt')[_0x6d3f('0x74')](_0x6d3f('0x75'),'updatedAt')[_0x6d3f('0x79')](_0x6d3f('0x7a'))[_0x6d3f('0x42')](_0x6d3f('0x7b'))[_0x6d3f('0x42')](_0x6d3f('0x7c'),_0x129129[_0x6d3f('0x77')][_0x6d3f('0x78')]())[_0x6d3f('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x6d3f('0x42')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x6d3f('0x74')](_0x6d3f('0x82'))['from']('cm_hopper')['where'](_0x6d3f('0x80'),_0x1663e9[_0x6d3f('0x4c')]['id'][_0x6d3f('0x78')]())))[_0x6d3f('0x78')]();break;default:_0x28584e=squel['insert']()[_0x6d3f('0x6e')]('cm_hopper')[_0x6d3f('0x6f')](['phone',_0x6d3f('0x76'),_0x6d3f('0x71'),_0x6d3f('0x72'),_0x6d3f('0x62'),'createdAt',_0x6d3f('0x59')],squel[_0x6d3f('0x73')]()[_0x6d3f('0x74')]('phone','phone')[_0x6d3f('0x74')](_0x6d3f('0x75'),_0x6d3f('0x76'))['field']('id',_0x6d3f('0x71'))[_0x6d3f('0x74')](_0x129129[_0x6d3f('0x77')]['toString'](),_0x6d3f('0x72'))[_0x6d3f('0x74')](_0x1663e9['params']['id'][_0x6d3f('0x78')](),'CampaignId')[_0x6d3f('0x74')]('NOW()',_0x6d3f('0x58'))[_0x6d3f('0x74')](_0x6d3f('0x75'),'updatedAt')['from']('cm_contacts')[_0x6d3f('0x42')](_0x6d3f('0x7b'))['where'](_0x6d3f('0x7c'),_0x129129['CmListId'][_0x6d3f('0x78')]())[_0x6d3f('0x42')](_0x6d3f('0x7d')))['toString']();}_0x4460de[_0x6d3f('0x83')](db[_0x6d3f('0x84')][_0x6d3f('0x35')](_0x28584e));}return BPromise['all'](_0x4460de);}})[_0x6d3f('0x26')](function(){return _0x51ac04;})[_0x6d3f('0x26')](respondWithResult(_0x10f4e2,null))[_0x6d3f('0x4a')](handleError(_0x10f4e2,null));};exports[_0x6d3f('0x85')]=function(_0x2ad8a7,_0x34d13f,_0x4cc81d){return db[_0x6d3f('0x45')][_0x6d3f('0x4f')]({'where':{'id':_0x2ad8a7[_0x6d3f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x34d13f,null))[_0x6d3f('0x26')](function(_0x43a25a){if(_0x43a25a){return _0x43a25a[_0x6d3f('0x85')](_0x2ad8a7[_0x6d3f('0x35')][_0x6d3f('0x69')]);}})['then'](function(_0x2e7812){if(_0x2e7812){return db[_0x6d3f('0x5f')][_0x6d3f('0x27')]({'where':{'ListId':_0x2ad8a7[_0x6d3f('0x35')]['ids'],'CampaignId':_0x2ad8a7[_0x6d3f('0x4c')]['id']}})[_0x6d3f('0x26')](function(){return _0x2e7812;});}})[_0x6d3f('0x26')](respondWithStatusCode(_0x34d13f,null))[_0x6d3f('0x4a')](handleError(_0x34d13f,null));};exports[_0x6d3f('0x86')]=function(_0x21ffac,_0x5452fc,_0x196a59){var _0x25e32d={};var _0x346728={};var _0x3a5e34;var _0x4cc69e;return db[_0x6d3f('0x45')][_0x6d3f('0x5e')]({'where':{'id':_0x21ffac['params']['id']}})[_0x6d3f('0x26')](handleEntityNotFound(_0x5452fc,null))[_0x6d3f('0x26')](function(_0x536b6e){if(_0x536b6e){_0x3a5e34=_0x536b6e;_0x346728[_0x6d3f('0x34')]=_[_0x6d3f('0x4d')](db[_0x6d3f('0x87')][_0x6d3f('0x31')]);_0x346728[_0x6d3f('0x35')]=_['keys'](_0x21ffac[_0x6d3f('0x35')]);_0x346728['filters']=_[_0x6d3f('0x36')](_0x346728['model'],_0x346728['query']);_0x25e32d[_0x6d3f('0x37')]=_[_0x6d3f('0x36')](_0x346728[_0x6d3f('0x34')],qs['fields'](_0x21ffac[_0x6d3f('0x35')][_0x6d3f('0x38')]));_0x25e32d[_0x6d3f('0x37')]=_0x25e32d[_0x6d3f('0x37')][_0x6d3f('0x39')]?_0x25e32d[_0x6d3f('0x37')]:_0x346728[_0x6d3f('0x34')];_0x25e32d[_0x6d3f('0x3d')]=qs[_0x6d3f('0x3e')](_0x21ffac['query'][_0x6d3f('0x3e')]);_0x25e32d[_0x6d3f('0x42')]=qs[_0x6d3f('0x3f')](_['pick'](_0x21ffac['query'],_0x346728[_0x6d3f('0x3f')]));if(_0x21ffac[_0x6d3f('0x35')][_0x6d3f('0x41')]){_0x25e32d[_0x6d3f('0x42')]=_['merge'](_0x25e32d[_0x6d3f('0x42')],{'$or':_['map'](_0x25e32d[_0x6d3f('0x37')],function(_0x4b518c){var _0x240041={};_0x240041[_0x4b518c]={'$like':'%'+_0x21ffac[_0x6d3f('0x35')]['filter']+'%'};return _0x240041;})});}_0x25e32d=_[_0x6d3f('0x43')]({},_0x25e32d,_0x21ffac[_0x6d3f('0x4e')]);return _0x3a5e34['getBlackLists'](_0x25e32d);}})[_0x6d3f('0x26')](function(_0x5685a5){if(_0x5685a5){_0x4cc69e=_0x5685a5[_0x6d3f('0x39')];if(!_0x21ffac['query']['hasOwnProperty'](_0x6d3f('0x3b'))){_0x25e32d[_0x6d3f('0x3c')]=qs['limit'](_0x21ffac[_0x6d3f('0x35')][_0x6d3f('0x3c')]);_0x25e32d[_0x6d3f('0x1d')]=qs[_0x6d3f('0x1d')](_0x21ffac[_0x6d3f('0x35')][_0x6d3f('0x1d')]);}return _0x3a5e34['getBlackLists'](_0x25e32d);}})[_0x6d3f('0x26')](function(_0x8fc1a1){if(_0x8fc1a1){return _0x8fc1a1?{'count':_0x4cc69e,'rows':_0x8fc1a1}:null;}})[_0x6d3f('0x26')](respondWithResult(_0x5452fc,null))[_0x6d3f('0x4a')](handleError(_0x5452fc,null));};exports[_0x6d3f('0x88')]=function(_0x2ef715,_0x13db9f,_0x1b5a95){var _0x2048cf,_0x57e44a;return db[_0x6d3f('0x45')]['find']({'where':{'id':_0x2ef715[_0x6d3f('0x4c')]['id']}})[_0x6d3f('0x26')](handleEntityNotFound(_0x13db9f,null))[_0x6d3f('0x26')](function(_0x10cede){if(_0x10cede){_0x57e44a=_0x10cede;return _0x10cede['addBlackLists'](_0x2ef715['body'][_0x6d3f('0x69')],_[_0x6d3f('0x57')](_0x2ef715[_0x6d3f('0x50')],['ids','id'])||{});}return null;})[_0x6d3f('0x6a')](function(_0x3d680e){var _0x5e6029;_0x2048cf=_0x3d680e||[];var _0x601f83=[];if(_0x3d680e){for(var _0x2f2cd3=0x0;_0x2f2cd3<_0x3d680e[_0x6d3f('0x39')];_0x2f2cd3+=0x1){var _0x4f32da=_0x3d680e[_0x2f2cd3][_0x6d3f('0x28')]({'plain':!![]});_0x5e6029=squel[_0x6d3f('0x6d')]()['into'](_0x6d3f('0x89'))[_0x6d3f('0x6f')]([_0x6d3f('0x70'),_0x6d3f('0x71'),'ListId',_0x6d3f('0x62'),_0x6d3f('0x58'),_0x6d3f('0x59')],squel[_0x6d3f('0x73')]()[_0x6d3f('0x74')](_0x6d3f('0x70'),_0x6d3f('0x70'))[_0x6d3f('0x74')]('id',_0x6d3f('0x71'))[_0x6d3f('0x74')](_0x4f32da[_0x6d3f('0x77')]['toString'](),'ListId')[_0x6d3f('0x74')](_0x2ef715[_0x6d3f('0x4c')]['id'][_0x6d3f('0x78')](),_0x6d3f('0x62'))[_0x6d3f('0x74')](_0x6d3f('0x75'),_0x6d3f('0x58'))[_0x6d3f('0x74')]('NOW()',_0x6d3f('0x59'))['from'](_0x6d3f('0x7a'))['where'](_0x6d3f('0x7b'))[_0x6d3f('0x42')](_0x6d3f('0x7c'),_0x4f32da[_0x6d3f('0x77')][_0x6d3f('0x78')]())[_0x6d3f('0x42')](_0x6d3f('0x7d')))[_0x6d3f('0x78')]();_0x601f83[_0x6d3f('0x83')](db['sequelize']['query'](_0x5e6029));}return BPromise['all'](_0x601f83);}})[_0x6d3f('0x26')](function(){return _0x2048cf;})[_0x6d3f('0x26')](respondWithResult(_0x13db9f,null))[_0x6d3f('0x4a')](handleError(_0x13db9f,null));};exports[_0x6d3f('0x8a')]=function(_0x43a756,_0x11125f,_0x279708){return db[_0x6d3f('0x45')][_0x6d3f('0x4f')]({'where':{'id':_0x43a756['params']['id']}})[_0x6d3f('0x26')](handleEntityNotFound(_0x11125f,null))[_0x6d3f('0x26')](function(_0x4d0f63){if(_0x4d0f63){return _0x4d0f63['removeBlackLists'](_0x43a756[_0x6d3f('0x35')][_0x6d3f('0x69')]);}})['then'](function(_0x574c3b){if(_0x574c3b){return db[_0x6d3f('0x66')][_0x6d3f('0x27')]({'where':{'ListId':_0x43a756[_0x6d3f('0x35')]['ids'],'CampaignId':_0x43a756[_0x6d3f('0x4c')]['id']}})[_0x6d3f('0x26')](function(){return _0x574c3b;});}})[_0x6d3f('0x26')](respondWithStatusCode(_0x11125f,null))['catch'](handleError(_0x11125f,null));}; \ No newline at end of file +var _0xf876=['all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','sequelize','removeBlackLists','eml-format','rimraf','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','IvrCampaigns','UserProfileResource','destroy','error','stack','index','map','fieldName','type','key','model','name','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','Campaign','includeAll','include','findAll','rows','catch','show','rawAttributes','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','clone','omit','createdAt','updatedAt','params','findOne','hasOwnProperty','pick','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ListId','select','field','phone','NOW()','ContactId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','scheduledAt','cm_contacts','COALESCE(phone,\x27\x27)','push'];(function(_0x543412,_0x4d2bea){var _0x4cab53=function(_0x21519f){while(--_0x21519f){_0x543412['push'](_0x543412['shift']());}};_0x4cab53(++_0x4d2bea);}(_0xf876,0x19f));var _0x6f87=function(_0xd02bb,_0x26e2d0){_0xd02bb=_0xd02bb-0x0;var _0x1cdf23=_0xf876[_0xd02bb];return _0x1cdf23;};'use strict';var emlformat=require(_0x6f87('0x0'));var rimraf=require(_0x6f87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6f87('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6f87('0x3'));var util=require(_0x6f87('0x4'));var path=require(_0x6f87('0x5'));var sox=require('sox');var csv=require(_0x6f87('0x6'));var ejs=require(_0x6f87('0x7'));var fs=require('fs');var fs_extra=require(_0x6f87('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6f87('0x9'));var jsforce=require(_0x6f87('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f87('0xb'));var Papa=require(_0x6f87('0xc'));var Redis=require('ioredis');var authService=require(_0x6f87('0xd'));var qs=require(_0x6f87('0xe'));var as=require(_0x6f87('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f87('0x10'))(_0x6f87('0x11'));var utils=require(_0x6f87('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6f87('0x13'));var db=require(_0x6f87('0x14'))['db'];function respondWithStatusCode(_0x5d897b,_0x2e6f20){_0x2e6f20=_0x2e6f20||0xcc;return function(_0x18642b){if(_0x18642b){return _0x5d897b[_0x6f87('0x15')](_0x2e6f20);}return _0x5d897b['status'](_0x2e6f20)[_0x6f87('0x16')]();};}function respondWithResult(_0x3fa836,_0x249103){_0x249103=_0x249103||0xc8;return function(_0x5a10ba){if(_0x5a10ba){return _0x3fa836[_0x6f87('0x17')](_0x249103)['json'](_0x5a10ba);}};}function respondWithFilteredResult(_0x2b33be,_0x19e860){return function(_0x2bcb12){if(_0x2bcb12){var _0xd74ebb=typeof _0x19e860[_0x6f87('0x18')]===_0x6f87('0x19')&&typeof _0x19e860[_0x6f87('0x1a')]===_0x6f87('0x19');var _0x56a083=_0x2bcb12['count'];var _0x4fc1a9=_0xd74ebb?0x0:_0x19e860[_0x6f87('0x18')];var _0x2126d8=_0xd74ebb?_0x2bcb12[_0x6f87('0x1b')]:_0x19e860[_0x6f87('0x18')]+_0x19e860[_0x6f87('0x1a')];var _0x2b02b0;if(_0x2126d8>=_0x56a083){_0x2126d8=_0x56a083;_0x2b02b0=0xc8;}else{_0x2b02b0=0xce;}_0x2b33be['status'](_0x2b02b0);return _0x2b33be[_0x6f87('0x1c')](_0x6f87('0x1d'),_0x4fc1a9+'-'+_0x2126d8+'/'+_0x56a083)[_0x6f87('0x1e')](_0x2bcb12);}return null;};}function patchUpdates(_0x28ceba){return function(_0x21e7da){try{jsonpatch[_0x6f87('0x1f')](_0x21e7da,_0x28ceba,!![]);}catch(_0x5a95f9){return BPromise[_0x6f87('0x20')](_0x5a95f9);}return _0x21e7da[_0x6f87('0x21')]();};}function saveUpdates(_0x5bc29d,_0xd40831){return function(_0x3713d3){if(_0x3713d3){return _0x3713d3[_0x6f87('0x22')](_0x5bc29d)[_0x6f87('0x23')](function(_0x205b8d){return _0x205b8d;});}return null;};}function removeEntity(_0x1e2ecc,_0x374506){return function(_0xadd95d){if(_0xadd95d){return _0xadd95d['destroy']()[_0x6f87('0x23')](function(){var _0x1407b2=_0xadd95d[_0x6f87('0x24')]({'plain':!![]});var _0x6a7776=_0x6f87('0x25');return db[_0x6f87('0x26')][_0x6f87('0x27')]({'where':{'type':_0x6a7776,'resourceId':_0x1407b2['id']}})[_0x6f87('0x23')](function(){return _0xadd95d;});})[_0x6f87('0x23')](function(){_0x1e2ecc['status'](0xcc)[_0x6f87('0x16')]();});}};}function handleEntityNotFound(_0x177039,_0x307b19){return function(_0x1935c2){if(!_0x1935c2){_0x177039[_0x6f87('0x15')](0x194);}return _0x1935c2;};}function handleError(_0x1372c7,_0x427006){_0x427006=_0x427006||0x1f4;return function(_0x50b2b3){logger[_0x6f87('0x28')](_0x50b2b3[_0x6f87('0x29')]);if(_0x50b2b3['name']){delete _0x50b2b3['name'];}_0x1372c7['status'](_0x427006)['send'](_0x50b2b3);};}exports[_0x6f87('0x2a')]=function(_0x2901a8,_0x5f0d65){var _0x20fdb7={},_0x2e5e68={},_0x22e301={'count':0x0,'rows':[]};var _0x295006=_[_0x6f87('0x2b')](db['Campaign']['rawAttributes'],function(_0x4cf91f){return{'name':_0x4cf91f[_0x6f87('0x2c')],'type':_0x4cf91f[_0x6f87('0x2d')][_0x6f87('0x2e')]};});_0x2e5e68[_0x6f87('0x2f')]=_['map'](_0x295006,_0x6f87('0x30'));_0x2e5e68[_0x6f87('0x31')]=_[_0x6f87('0x32')](_0x2901a8[_0x6f87('0x31')]);_0x2e5e68['filters']=_['intersection'](_0x2e5e68[_0x6f87('0x2f')],_0x2e5e68[_0x6f87('0x31')]);_0x20fdb7['attributes']=_[_0x6f87('0x33')](_0x2e5e68[_0x6f87('0x2f')],qs[_0x6f87('0x34')](_0x2901a8[_0x6f87('0x31')]['fields']));_0x20fdb7[_0x6f87('0x35')]=_0x20fdb7[_0x6f87('0x35')][_0x6f87('0x36')]?_0x20fdb7['attributes']:_0x2e5e68[_0x6f87('0x2f')];if(!_0x2901a8[_0x6f87('0x31')]['hasOwnProperty'](_0x6f87('0x37'))){_0x20fdb7[_0x6f87('0x1a')]=qs[_0x6f87('0x1a')](_0x2901a8[_0x6f87('0x31')][_0x6f87('0x1a')]);_0x20fdb7['offset']=qs[_0x6f87('0x18')](_0x2901a8['query'][_0x6f87('0x18')]);}_0x20fdb7[_0x6f87('0x38')]=qs['sort'](_0x2901a8[_0x6f87('0x31')][_0x6f87('0x39')]);_0x20fdb7[_0x6f87('0x3a')]=qs[_0x6f87('0x3b')](_['pick'](_0x2901a8[_0x6f87('0x31')],_0x2e5e68[_0x6f87('0x3b')]),_0x295006);if(_0x2901a8[_0x6f87('0x31')]['filter']){_0x20fdb7[_0x6f87('0x3a')]=_[_0x6f87('0x3c')](_0x20fdb7[_0x6f87('0x3a')],{'$or':_[_0x6f87('0x2b')](_0x295006,function(_0x279f5c){if(_0x279f5c[_0x6f87('0x2d')]!==_0x6f87('0x3d')){var _0x2a0334={};_0x2a0334[_0x279f5c[_0x6f87('0x30')]]={'$like':'%'+_0x2901a8[_0x6f87('0x31')][_0x6f87('0x3e')]+'%'};return _0x2a0334;}})});}_0x20fdb7=_[_0x6f87('0x3c')]({},_0x20fdb7,_0x2901a8[_0x6f87('0x3f')]);var _0xcad1e4={'where':_0x20fdb7[_0x6f87('0x3a')]};return db[_0x6f87('0x40')][_0x6f87('0x1b')](_0xcad1e4)[_0x6f87('0x23')](function(_0x863ff8){_0x22e301[_0x6f87('0x1b')]=_0x863ff8;if(_0x2901a8[_0x6f87('0x31')][_0x6f87('0x41')]){_0x20fdb7[_0x6f87('0x42')]=[{'all':!![]}];}return db[_0x6f87('0x40')][_0x6f87('0x43')](_0x20fdb7);})[_0x6f87('0x23')](function(_0xa30b08){_0x22e301[_0x6f87('0x44')]=_0xa30b08;return _0x22e301;})['then'](respondWithFilteredResult(_0x5f0d65,_0x20fdb7))[_0x6f87('0x45')](handleError(_0x5f0d65,null));};exports[_0x6f87('0x46')]=function(_0x38e0f1,_0x38db63){var _0x3cd7a5={'raw':![],'where':{'id':_0x38e0f1['params']['id']}},_0x35f0c6={};_0x35f0c6[_0x6f87('0x2f')]=_[_0x6f87('0x32')](db[_0x6f87('0x40')][_0x6f87('0x47')]);_0x35f0c6[_0x6f87('0x31')]=_[_0x6f87('0x32')](_0x38e0f1[_0x6f87('0x31')]);_0x35f0c6[_0x6f87('0x3b')]=_[_0x6f87('0x33')](_0x35f0c6[_0x6f87('0x2f')],_0x35f0c6[_0x6f87('0x31')]);_0x3cd7a5[_0x6f87('0x35')]=_[_0x6f87('0x33')](_0x35f0c6[_0x6f87('0x2f')],qs[_0x6f87('0x34')](_0x38e0f1[_0x6f87('0x31')][_0x6f87('0x34')]));_0x3cd7a5['attributes']=_0x3cd7a5['attributes'][_0x6f87('0x36')]?_0x3cd7a5[_0x6f87('0x35')]:_0x35f0c6[_0x6f87('0x2f')];if(_0x38e0f1[_0x6f87('0x31')]['includeAll']){_0x3cd7a5[_0x6f87('0x42')]=[{'all':!![]}];}_0x3cd7a5=_[_0x6f87('0x3c')]({},_0x3cd7a5,_0x38e0f1[_0x6f87('0x3f')]);return db[_0x6f87('0x40')]['find'](_0x3cd7a5)[_0x6f87('0x23')](handleEntityNotFound(_0x38db63,null))['then'](respondWithResult(_0x38db63,null))['catch'](handleError(_0x38db63,null));};exports[_0x6f87('0x48')]=function(_0x56674f,_0x9e7874){return db[_0x6f87('0x40')][_0x6f87('0x48')](_0x56674f[_0x6f87('0x49')],{})[_0x6f87('0x23')](function(_0x431af5){var _0x610b06=_0x56674f[_0x6f87('0x4a')][_0x6f87('0x24')]({'plain':!![]});if(!_0x610b06)throw new Error(_0x6f87('0x4b'));if(_0x610b06[_0x6f87('0x4c')]===_0x6f87('0x4a')){var _0x2253d5=_0x431af5[_0x6f87('0x24')]({'plain':!![]});var _0x36e3e3=_0x6f87('0x25');return db[_0x6f87('0x4d')][_0x6f87('0x4e')]({'where':{'name':_0x36e3e3,'userProfileId':_0x610b06[_0x6f87('0x4f')]},'raw':!![]})[_0x6f87('0x23')](function(_0x3a130d){if(_0x3a130d&&_0x3a130d[_0x6f87('0x50')]===0x0){return db[_0x6f87('0x26')]['create']({'name':_0x2253d5[_0x6f87('0x30')],'resourceId':_0x2253d5['id'],'type':_0x3a130d[_0x6f87('0x30')],'sectionId':_0x3a130d['id']},{})[_0x6f87('0x23')](function(){return _0x431af5;});}else{return _0x431af5;}})[_0x6f87('0x45')](function(_0x16f4d5){logger['error'](_0x6f87('0x51'),_0x16f4d5);throw _0x16f4d5;});}return _0x431af5;})['then'](respondWithResult(_0x9e7874,0xc9))[_0x6f87('0x45')](handleError(_0x9e7874,null));};exports[_0x6f87('0x52')]=function(_0x4bc9ef,_0x3d60e3){var _0x57ba38={'where':{'id':_0x4bc9ef['params']['id']}},_0x5b56ac={};_0x5b56ac['model']=_[_0x6f87('0x32')](db[_0x6f87('0x40')]['rawAttributes']);_0x57ba38[_0x6f87('0x35')]=_[_0x6f87('0x33')](_0x5b56ac[_0x6f87('0x2f')],qs[_0x6f87('0x34')](_0x4bc9ef['query']['fields']));_0x57ba38[_0x6f87('0x35')]=_0x57ba38['attributes'][_0x6f87('0x36')]?_0x57ba38[_0x6f87('0x35')]:_0x5b56ac[_0x6f87('0x2f')];if(_0x4bc9ef[_0x6f87('0x31')][_0x6f87('0x41')]){_0x57ba38['include']=[{'all':!![]}];}_0x57ba38=_[_0x6f87('0x3c')]({},_0x57ba38,_0x4bc9ef[_0x6f87('0x3f')]);return db['Campaign'][_0x6f87('0x4e')](_0x57ba38)['then'](handleEntityNotFound(_0x3d60e3,null))['then'](function(_0x5dc29a){if(_0x5dc29a){var _0x1528a7=_0x5dc29a[_0x6f87('0x24')]({'plain':!![]});_0x1528a7=qs[_0x6f87('0x53')](_0x1528a7,['id',_0x6f87('0x54'),_0x6f87('0x55')]);_0x4bc9ef[_0x6f87('0x49')]=_[_0x6f87('0x53')](_0x4bc9ef[_0x6f87('0x49')],['id',_0x6f87('0x54'),_0x6f87('0x55')]);return db['Campaign'][_0x6f87('0x48')](_['merge'](_0x1528a7,_0x4bc9ef[_0x6f87('0x49')]),{'include':_0x4bc9ef[_0x6f87('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x6f87('0x23')](function(_0x1ebe13){var _0xfc6bf5=_0x4bc9ef[_0x6f87('0x4a')][_0x6f87('0x24')]({'plain':!![]});if(!_0xfc6bf5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfc6bf5[_0x6f87('0x4c')]===_0x6f87('0x4a')){var _0x261bbd=_0x1ebe13['get']({'plain':!![]});var _0x1ca59c=_0x6f87('0x25');return db['UserProfileSection'][_0x6f87('0x4e')]({'where':{'name':_0x1ca59c,'userProfileId':_0xfc6bf5[_0x6f87('0x4f')]},'raw':!![]})[_0x6f87('0x23')](function(_0x5421fa){if(_0x5421fa&&_0x5421fa[_0x6f87('0x50')]===0x0){return db[_0x6f87('0x26')]['create']({'name':_0x261bbd['name'],'resourceId':_0x261bbd['id'],'type':_0x5421fa[_0x6f87('0x30')],'sectionId':_0x5421fa['id']},{})['then'](function(){return _0x1ebe13;});}else{return _0x1ebe13;}})[_0x6f87('0x45')](function(_0x4ec34a){logger[_0x6f87('0x28')](_0x6f87('0x51'),_0x4ec34a);throw _0x4ec34a;});}return _0x1ebe13;});}})[_0x6f87('0x23')](respondWithResult(_0x3d60e3,0xc9))[_0x6f87('0x45')](handleError(_0x3d60e3,null));};exports[_0x6f87('0x22')]=function(_0x257ff4,_0x393d8f){if(_0x257ff4[_0x6f87('0x49')]['id']){delete _0x257ff4[_0x6f87('0x49')]['id'];}return db[_0x6f87('0x40')][_0x6f87('0x4e')]({'where':{'id':_0x257ff4[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x393d8f,null))[_0x6f87('0x23')](saveUpdates(_0x257ff4[_0x6f87('0x49')],null))[_0x6f87('0x23')](respondWithResult(_0x393d8f,null))['catch'](handleError(_0x393d8f,null));};exports[_0x6f87('0x27')]=function(_0x22e651,_0x467ca6){return db['Campaign'][_0x6f87('0x4e')]({'where':{'id':_0x22e651[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x467ca6,null))[_0x6f87('0x23')](removeEntity(_0x467ca6,null))[_0x6f87('0x45')](handleError(_0x467ca6,null));};exports['getHoppers']=function(_0x373754,_0x2c5fbe,_0x22ae85){var _0x49d3a4={'raw':!![],'where':{}};var _0x175f18={};var _0x1b7d56={'count':0x0,'rows':[]};return db['Campaign'][_0x6f87('0x57')]({'where':{'id':_0x373754[_0x6f87('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c5fbe,null))[_0x6f87('0x23')](function(_0x45756a){if(_0x45756a){_0x175f18[_0x6f87('0x2f')]=_[_0x6f87('0x32')](db['CmHopper'][_0x6f87('0x47')]);_0x175f18[_0x6f87('0x31')]=_[_0x6f87('0x32')](_0x373754['query']);_0x175f18['filters']=_[_0x6f87('0x33')](_0x175f18[_0x6f87('0x2f')],_0x175f18[_0x6f87('0x31')]);_0x49d3a4[_0x6f87('0x35')]=_[_0x6f87('0x33')](_0x175f18['model'],qs[_0x6f87('0x34')](_0x373754[_0x6f87('0x31')][_0x6f87('0x34')]));_0x49d3a4[_0x6f87('0x35')]=_0x49d3a4[_0x6f87('0x35')]['length']?_0x49d3a4[_0x6f87('0x35')]:_0x175f18[_0x6f87('0x2f')];if(!_0x373754[_0x6f87('0x31')][_0x6f87('0x58')](_0x6f87('0x37'))){_0x49d3a4[_0x6f87('0x1a')]=qs['limit'](_0x373754[_0x6f87('0x31')][_0x6f87('0x1a')]);_0x49d3a4['offset']=qs[_0x6f87('0x18')](_0x373754[_0x6f87('0x31')][_0x6f87('0x18')]);}_0x49d3a4[_0x6f87('0x38')]=qs[_0x6f87('0x39')](_0x373754[_0x6f87('0x31')][_0x6f87('0x39')]);_0x49d3a4[_0x6f87('0x3a')]=qs[_0x6f87('0x3b')](_[_0x6f87('0x59')](_0x373754['query'],_0x175f18[_0x6f87('0x3b')]));_0x49d3a4['where'][_0x6f87('0x5a')]=_0x45756a['id'];if(_0x373754[_0x6f87('0x31')][_0x6f87('0x3e')]){_0x49d3a4['where']=_['merge'](_0x49d3a4[_0x6f87('0x3a')],{'$or':_[_0x6f87('0x2b')](_0x49d3a4[_0x6f87('0x35')],function(_0x2b42dc){var _0x5b5330={};_0x5b5330[_0x2b42dc]={'$like':'%'+_0x373754[_0x6f87('0x31')][_0x6f87('0x3e')]+'%'};return _0x5b5330;})});}_0x49d3a4=_['merge']({},_0x49d3a4,_0x373754[_0x6f87('0x3f')]);return db['CmHopper'][_0x6f87('0x1b')]({'where':_0x49d3a4[_0x6f87('0x3a')]})[_0x6f87('0x23')](function(_0xdd5c85){_0x1b7d56[_0x6f87('0x1b')]=_0xdd5c85;if(_0x373754[_0x6f87('0x31')][_0x6f87('0x41')]){_0x49d3a4[_0x6f87('0x42')]=[{'all':!![]}];}return db[_0x6f87('0x5b')]['findAll'](_0x49d3a4);})[_0x6f87('0x23')](function(_0x6dc45c){_0x1b7d56[_0x6f87('0x44')]=_0x6dc45c;return _0x1b7d56;});}})[_0x6f87('0x23')](respondWithFilteredResult(_0x2c5fbe,_0x49d3a4))[_0x6f87('0x45')](handleError(_0x2c5fbe,null));};exports[_0x6f87('0x5c')]=function(_0x9d389d,_0x210e9c,_0x3dbd79){var _0x253bf6={'raw':!![],'where':{}};var _0x58cd32={};var _0x3e9a9f={'count':0x0,'rows':[]};return db[_0x6f87('0x40')][_0x6f87('0x57')]({'where':{'id':_0x9d389d[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x210e9c,null))[_0x6f87('0x23')](function(_0x28c4a6){if(_0x28c4a6){_0x58cd32[_0x6f87('0x2f')]=_['keys'](db['CmHopperHistory']['rawAttributes']);_0x58cd32[_0x6f87('0x31')]=_[_0x6f87('0x32')](_0x9d389d[_0x6f87('0x31')]);_0x58cd32[_0x6f87('0x3b')]=_['intersection'](_0x58cd32[_0x6f87('0x2f')],_0x58cd32[_0x6f87('0x31')]);_0x253bf6['attributes']=_['intersection'](_0x58cd32[_0x6f87('0x2f')],qs[_0x6f87('0x34')](_0x9d389d['query'][_0x6f87('0x34')]));_0x253bf6['attributes']=_0x253bf6[_0x6f87('0x35')][_0x6f87('0x36')]?_0x253bf6[_0x6f87('0x35')]:_0x58cd32[_0x6f87('0x2f')];if(!_0x9d389d['query'][_0x6f87('0x58')](_0x6f87('0x37'))){_0x253bf6[_0x6f87('0x1a')]=qs[_0x6f87('0x1a')](_0x9d389d[_0x6f87('0x31')][_0x6f87('0x1a')]);_0x253bf6[_0x6f87('0x18')]=qs['offset'](_0x9d389d['query'][_0x6f87('0x18')]);}_0x253bf6[_0x6f87('0x38')]=qs[_0x6f87('0x39')](_0x9d389d[_0x6f87('0x31')][_0x6f87('0x39')]);_0x253bf6[_0x6f87('0x3a')]=qs[_0x6f87('0x3b')](_['pick'](_0x9d389d['query'],_0x58cd32['filters']));_0x253bf6[_0x6f87('0x3a')][_0x6f87('0x5a')]=_0x28c4a6['id'];if(_0x9d389d[_0x6f87('0x31')][_0x6f87('0x3e')]){_0x253bf6[_0x6f87('0x3a')]=_[_0x6f87('0x3c')](_0x253bf6[_0x6f87('0x3a')],{'$or':_['map'](_0x253bf6[_0x6f87('0x35')],function(_0x1543df){var _0x51049a={};_0x51049a[_0x1543df]={'$like':'%'+_0x9d389d[_0x6f87('0x31')][_0x6f87('0x3e')]+'%'};return _0x51049a;})});}_0x253bf6=_[_0x6f87('0x3c')]({},_0x253bf6,_0x9d389d[_0x6f87('0x3f')]);return db['CmHopperHistory'][_0x6f87('0x1b')]({'where':_0x253bf6[_0x6f87('0x3a')]})[_0x6f87('0x23')](function(_0x136d4c){_0x3e9a9f[_0x6f87('0x1b')]=_0x136d4c;if(_0x9d389d[_0x6f87('0x31')][_0x6f87('0x41')]){_0x253bf6[_0x6f87('0x42')]=[{'all':!![]}];}return db[_0x6f87('0x5d')][_0x6f87('0x43')](_0x253bf6);})[_0x6f87('0x23')](function(_0x3aaa74){_0x3e9a9f[_0x6f87('0x44')]=_0x3aaa74;return _0x3e9a9f;});}})[_0x6f87('0x23')](respondWithFilteredResult(_0x210e9c,_0x253bf6))[_0x6f87('0x45')](handleError(_0x210e9c,null));};exports[_0x6f87('0x5e')]=function(_0x1d3e31,_0x262a7c,_0x17002c){var _0x3a150a={'raw':!![],'where':{}};var _0x53d362={};var _0x54082c={'count':0x0,'rows':[]};return db[_0x6f87('0x40')][_0x6f87('0x57')]({'where':{'id':_0x1d3e31[_0x6f87('0x56')]['id']}})['then'](handleEntityNotFound(_0x262a7c,null))[_0x6f87('0x23')](function(_0x1cf867){if(_0x1cf867){_0x53d362[_0x6f87('0x2f')]=_[_0x6f87('0x32')](db[_0x6f87('0x5f')][_0x6f87('0x47')]);_0x53d362[_0x6f87('0x31')]=_[_0x6f87('0x32')](_0x1d3e31[_0x6f87('0x31')]);_0x53d362[_0x6f87('0x3b')]=_[_0x6f87('0x33')](_0x53d362[_0x6f87('0x2f')],_0x53d362[_0x6f87('0x31')]);_0x3a150a[_0x6f87('0x35')]=_[_0x6f87('0x33')](_0x53d362[_0x6f87('0x2f')],qs[_0x6f87('0x34')](_0x1d3e31[_0x6f87('0x31')]['fields']));_0x3a150a['attributes']=_0x3a150a[_0x6f87('0x35')][_0x6f87('0x36')]?_0x3a150a['attributes']:_0x53d362[_0x6f87('0x2f')];if(!_0x1d3e31[_0x6f87('0x31')][_0x6f87('0x58')](_0x6f87('0x37'))){_0x3a150a[_0x6f87('0x1a')]=qs[_0x6f87('0x1a')](_0x1d3e31[_0x6f87('0x31')][_0x6f87('0x1a')]);_0x3a150a[_0x6f87('0x18')]=qs[_0x6f87('0x18')](_0x1d3e31[_0x6f87('0x31')][_0x6f87('0x18')]);}_0x3a150a[_0x6f87('0x38')]=qs[_0x6f87('0x39')](_0x1d3e31['query'][_0x6f87('0x39')]);_0x3a150a[_0x6f87('0x3a')]=qs[_0x6f87('0x3b')](_['pick'](_0x1d3e31[_0x6f87('0x31')],_0x53d362[_0x6f87('0x3b')]));_0x3a150a['where'][_0x6f87('0x5a')]=_0x1cf867['id'];if(_0x1d3e31[_0x6f87('0x31')][_0x6f87('0x3e')]){_0x3a150a['where']=_['merge'](_0x3a150a[_0x6f87('0x3a')],{'$or':_[_0x6f87('0x2b')](_0x3a150a['attributes'],function(_0x5afb68){var _0x2d460e={};_0x2d460e[_0x5afb68]={'$like':'%'+_0x1d3e31[_0x6f87('0x31')][_0x6f87('0x3e')]+'%'};return _0x2d460e;})});}_0x3a150a=_[_0x6f87('0x3c')]({},_0x3a150a,_0x1d3e31['options']);return db[_0x6f87('0x5f')]['count']({'where':_0x3a150a[_0x6f87('0x3a')]})[_0x6f87('0x23')](function(_0xbb043d){_0x54082c[_0x6f87('0x1b')]=_0xbb043d;if(_0x1d3e31[_0x6f87('0x31')][_0x6f87('0x41')]){_0x3a150a['include']=[{'all':!![]}];}return db[_0x6f87('0x5f')][_0x6f87('0x43')](_0x3a150a);})[_0x6f87('0x23')](function(_0x2d9668){_0x54082c[_0x6f87('0x44')]=_0x2d9668;return _0x54082c;});}})[_0x6f87('0x23')](respondWithFilteredResult(_0x262a7c,_0x3a150a))[_0x6f87('0x45')](handleError(_0x262a7c,null));};exports[_0x6f87('0x60')]=function(_0x5df24a,_0x57b0f3,_0x195da5){var _0x1b5197={'raw':!![],'where':{}};var _0x511e4c={};var _0xddeea5={'count':0x0,'rows':[]};return db[_0x6f87('0x40')][_0x6f87('0x57')]({'where':{'id':_0x5df24a[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x57b0f3,null))[_0x6f87('0x23')](function(_0x3100d2){if(_0x3100d2){_0x511e4c['model']=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x511e4c[_0x6f87('0x31')]=_[_0x6f87('0x32')](_0x5df24a[_0x6f87('0x31')]);_0x511e4c[_0x6f87('0x3b')]=_['intersection'](_0x511e4c['model'],_0x511e4c['query']);_0x1b5197[_0x6f87('0x35')]=_[_0x6f87('0x33')](_0x511e4c[_0x6f87('0x2f')],qs['fields'](_0x5df24a[_0x6f87('0x31')][_0x6f87('0x34')]));_0x1b5197[_0x6f87('0x35')]=_0x1b5197['attributes'][_0x6f87('0x36')]?_0x1b5197[_0x6f87('0x35')]:_0x511e4c[_0x6f87('0x2f')];if(!_0x5df24a['query'][_0x6f87('0x58')]('nolimit')){_0x1b5197[_0x6f87('0x1a')]=qs[_0x6f87('0x1a')](_0x5df24a['query'][_0x6f87('0x1a')]);_0x1b5197[_0x6f87('0x18')]=qs[_0x6f87('0x18')](_0x5df24a[_0x6f87('0x31')][_0x6f87('0x18')]);}_0x1b5197[_0x6f87('0x38')]=qs['sort'](_0x5df24a[_0x6f87('0x31')][_0x6f87('0x39')]);_0x1b5197['where']=qs[_0x6f87('0x3b')](_[_0x6f87('0x59')](_0x5df24a[_0x6f87('0x31')],_0x511e4c[_0x6f87('0x3b')]));_0x1b5197['where'][_0x6f87('0x5a')]=_0x3100d2['id'];if(_0x5df24a[_0x6f87('0x31')]['filter']){_0x1b5197[_0x6f87('0x3a')]=_[_0x6f87('0x3c')](_0x1b5197['where'],{'$or':_['map'](_0x1b5197[_0x6f87('0x35')],function(_0x192556){var _0x4ca52e={};_0x4ca52e[_0x192556]={'$like':'%'+_0x5df24a[_0x6f87('0x31')][_0x6f87('0x3e')]+'%'};return _0x4ca52e;})});}_0x1b5197=_['merge']({},_0x1b5197,_0x5df24a['options']);return db[_0x6f87('0x61')][_0x6f87('0x1b')]({'where':_0x1b5197[_0x6f87('0x3a')]})[_0x6f87('0x23')](function(_0x41eb67){_0xddeea5[_0x6f87('0x1b')]=_0x41eb67;if(_0x5df24a['query'][_0x6f87('0x41')]){_0x1b5197[_0x6f87('0x42')]=[{'all':!![]}];}return db[_0x6f87('0x61')][_0x6f87('0x43')](_0x1b5197);})[_0x6f87('0x23')](function(_0x20b2a2){_0xddeea5[_0x6f87('0x44')]=_0x20b2a2;return _0xddeea5;});}})['then'](respondWithFilteredResult(_0x57b0f3,_0x1b5197))[_0x6f87('0x45')](handleError(_0x57b0f3,null));};exports['getLists']=function(_0x5eca16,_0x1803ce,_0x11b3da){var _0x176506={};var _0xe5ff32={};var _0x511974;var _0x4b645d;return db[_0x6f87('0x40')][_0x6f87('0x57')]({'where':{'id':_0x5eca16['params']['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x1803ce,null))[_0x6f87('0x23')](function(_0x1e322b){if(_0x1e322b){_0x511974=_0x1e322b;_0xe5ff32[_0x6f87('0x2f')]=_[_0x6f87('0x32')](db[_0x6f87('0x62')]['rawAttributes']);_0xe5ff32[_0x6f87('0x31')]=_[_0x6f87('0x32')](_0x5eca16[_0x6f87('0x31')]);_0xe5ff32['filters']=_['intersection'](_0xe5ff32[_0x6f87('0x2f')],_0xe5ff32['query']);_0x176506[_0x6f87('0x35')]=_[_0x6f87('0x33')](_0xe5ff32[_0x6f87('0x2f')],qs[_0x6f87('0x34')](_0x5eca16[_0x6f87('0x31')][_0x6f87('0x34')]));_0x176506['attributes']=_0x176506['attributes'][_0x6f87('0x36')]?_0x176506[_0x6f87('0x35')]:_0xe5ff32['model'];_0x176506[_0x6f87('0x38')]=qs[_0x6f87('0x39')](_0x5eca16[_0x6f87('0x31')][_0x6f87('0x39')]);_0x176506['where']=qs['filters'](_[_0x6f87('0x59')](_0x5eca16[_0x6f87('0x31')],_0xe5ff32['filters']));if(_0x5eca16['query'][_0x6f87('0x3e')]){_0x176506[_0x6f87('0x3a')]=_[_0x6f87('0x3c')](_0x176506['where'],{'$or':_[_0x6f87('0x2b')](_0x176506[_0x6f87('0x35')],function(_0x4f4bf7){var _0x5133d9={};_0x5133d9[_0x4f4bf7]={'$like':'%'+_0x5eca16[_0x6f87('0x31')]['filter']+'%'};return _0x5133d9;})});}_0x176506=_[_0x6f87('0x3c')]({},_0x176506,_0x5eca16['options']);return _0x511974[_0x6f87('0x63')](_0x176506);}})[_0x6f87('0x23')](function(_0x3ad776){if(_0x3ad776){_0x4b645d=_0x3ad776[_0x6f87('0x36')];if(!_0x5eca16[_0x6f87('0x31')]['hasOwnProperty'](_0x6f87('0x37'))){_0x176506['limit']=qs[_0x6f87('0x1a')](_0x5eca16[_0x6f87('0x31')][_0x6f87('0x1a')]);_0x176506[_0x6f87('0x18')]=qs[_0x6f87('0x18')](_0x5eca16[_0x6f87('0x31')][_0x6f87('0x18')]);}return _0x511974[_0x6f87('0x63')](_0x176506);}})[_0x6f87('0x23')](function(_0x20144c){if(_0x20144c){return _0x20144c?{'count':_0x4b645d,'rows':_0x20144c}:null;}})['then'](respondWithResult(_0x1803ce,null))['catch'](handleError(_0x1803ce,null));};exports[_0x6f87('0x64')]=function(_0xb0c29b,_0x2a01b4,_0x4a7d8b){var _0x323fe9,_0x9a5d6f;return db[_0x6f87('0x40')][_0x6f87('0x4e')]({'where':{'id':_0xb0c29b[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x2a01b4,null))[_0x6f87('0x23')](function(_0x3c5f67){if(_0x3c5f67){_0x9a5d6f=_0x3c5f67;return _0x3c5f67[_0x6f87('0x64')](_0xb0c29b[_0x6f87('0x49')][_0x6f87('0x65')],_[_0x6f87('0x53')](_0xb0c29b[_0x6f87('0x49')],[_0x6f87('0x65'),'id'])||{});}return null;})[_0x6f87('0x66')](function(_0xf22be0){var _0x254340;_0x323fe9=_0xf22be0||[];var _0x270d3c=[];if(_0xf22be0){for(var _0x3cf8e1=0x0;_0x3cf8e1<_0xf22be0['length'];_0x3cf8e1+=0x1){var _0x15ec40=_0xf22be0[_0x3cf8e1]['get']({'plain':!![]});_0x9a5d6f[_0x6f87('0x67')]=_0xb0c29b[_0x6f87('0x49')][_0x6f87('0x67')]?_0xb0c29b[_0x6f87('0x49')][_0x6f87('0x67')]:_0x9a5d6f['dialCheckDuplicateType'];switch(_0x9a5d6f[_0x6f87('0x67')]){case _0x6f87('0x68'):_0x254340=squel[_0x6f87('0x69')]()[_0x6f87('0x6a')](_0x6f87('0x6b'))[_0x6f87('0x6c')](['phone','scheduledAt','ContactId',_0x6f87('0x6d'),_0x6f87('0x5a'),_0x6f87('0x54'),_0x6f87('0x55')],squel[_0x6f87('0x6e')]()[_0x6f87('0x6f')](_0x6f87('0x70'),'phone')[_0x6f87('0x6f')](_0x6f87('0x71'),'scheduledAt')[_0x6f87('0x6f')]('id',_0x6f87('0x72'))[_0x6f87('0x6f')](_0x15ec40['CmListId'][_0x6f87('0x73')](),_0x6f87('0x6d'))['field'](_0xb0c29b['params']['id']['toString'](),_0x6f87('0x5a'))['field'](_0x6f87('0x71'),_0x6f87('0x54'))[_0x6f87('0x6f')](_0x6f87('0x71'),_0x6f87('0x55'))[_0x6f87('0x74')]('cm_contacts')['where'](_0x6f87('0x75'))[_0x6f87('0x3a')](_0x6f87('0x76'),_0x15ec40[_0x6f87('0x77')][_0x6f87('0x73')]())[_0x6f87('0x3a')](_0x6f87('0x78'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x6f87('0x6e')]()[_0x6f87('0x6f')](_0x6f87('0x79'))[_0x6f87('0x74')](_0x6f87('0x7a'))[_0x6f87('0x3a')](_0x6f87('0x7b'),_0xb0c29b[_0x6f87('0x56')]['id']['toString']()))[_0x6f87('0x3a')](_0x6f87('0x7c'),squel['select']()[_0x6f87('0x6f')]('COALESCE(phone,\x27\x27)')[_0x6f87('0x74')](_0x6f87('0x6b'))[_0x6f87('0x3a')](_0x6f87('0x7b'),_0xb0c29b[_0x6f87('0x56')]['id']['toString']())))['toString']();break;case'onlyIfOpen':_0x254340=squel[_0x6f87('0x69')]()[_0x6f87('0x6a')](_0x6f87('0x6b'))[_0x6f87('0x6c')]([_0x6f87('0x70'),_0x6f87('0x7d'),_0x6f87('0x72'),'ListId','CampaignId',_0x6f87('0x54'),_0x6f87('0x55')],squel[_0x6f87('0x6e')]()[_0x6f87('0x6f')](_0x6f87('0x70'),_0x6f87('0x70'))[_0x6f87('0x6f')](_0x6f87('0x71'),_0x6f87('0x7d'))['field']('id',_0x6f87('0x72'))[_0x6f87('0x6f')](_0x15ec40[_0x6f87('0x77')]['toString'](),_0x6f87('0x6d'))[_0x6f87('0x6f')](_0xb0c29b[_0x6f87('0x56')]['id'][_0x6f87('0x73')](),_0x6f87('0x5a'))['field'](_0x6f87('0x71'),_0x6f87('0x54'))['field']('NOW()','updatedAt')[_0x6f87('0x74')](_0x6f87('0x7e'))[_0x6f87('0x3a')](_0x6f87('0x75'))[_0x6f87('0x3a')](_0x6f87('0x76'),_0x15ec40[_0x6f87('0x77')][_0x6f87('0x73')]())[_0x6f87('0x3a')](_0x6f87('0x78'))[_0x6f87('0x3a')](_0x6f87('0x7c'),squel['select']()['field'](_0x6f87('0x7f'))[_0x6f87('0x74')](_0x6f87('0x6b'))[_0x6f87('0x3a')](_0x6f87('0x7b'),_0xb0c29b[_0x6f87('0x56')]['id'][_0x6f87('0x73')]())))['toString']();break;default:_0x254340=squel['insert']()[_0x6f87('0x6a')](_0x6f87('0x6b'))[_0x6f87('0x6c')]([_0x6f87('0x70'),_0x6f87('0x7d'),_0x6f87('0x72'),_0x6f87('0x6d'),_0x6f87('0x5a'),_0x6f87('0x54'),_0x6f87('0x55')],squel[_0x6f87('0x6e')]()[_0x6f87('0x6f')]('phone','phone')['field'](_0x6f87('0x71'),_0x6f87('0x7d'))['field']('id',_0x6f87('0x72'))[_0x6f87('0x6f')](_0x15ec40[_0x6f87('0x77')][_0x6f87('0x73')](),_0x6f87('0x6d'))[_0x6f87('0x6f')](_0xb0c29b[_0x6f87('0x56')]['id'][_0x6f87('0x73')](),'CampaignId')[_0x6f87('0x6f')](_0x6f87('0x71'),_0x6f87('0x54'))[_0x6f87('0x6f')](_0x6f87('0x71'),_0x6f87('0x55'))[_0x6f87('0x74')]('cm_contacts')[_0x6f87('0x3a')](_0x6f87('0x75'))['where']('ListId\x20=\x20?',_0x15ec40[_0x6f87('0x77')][_0x6f87('0x73')]())[_0x6f87('0x3a')]('phone\x20IS\x20NOT\x20NULL'))[_0x6f87('0x73')]();}_0x270d3c[_0x6f87('0x80')](db['sequelize'][_0x6f87('0x31')](_0x254340));}return BPromise[_0x6f87('0x81')](_0x270d3c);}})[_0x6f87('0x23')](function(){return _0x323fe9;})[_0x6f87('0x23')](respondWithResult(_0x2a01b4,null))['catch'](handleError(_0x2a01b4,null));};exports[_0x6f87('0x82')]=function(_0x19b4a0,_0x588627,_0x28b865){return db[_0x6f87('0x40')][_0x6f87('0x4e')]({'where':{'id':_0x19b4a0[_0x6f87('0x56')]['id']}})['then'](handleEntityNotFound(_0x588627,null))[_0x6f87('0x23')](function(_0x342154){if(_0x342154){return _0x342154[_0x6f87('0x82')](_0x19b4a0['query'][_0x6f87('0x65')]);}})['then'](function(_0x52440b){if(_0x52440b){return db[_0x6f87('0x5b')]['destroy']({'where':{'ListId':_0x19b4a0['query']['ids'],'CampaignId':_0x19b4a0[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](function(){return _0x52440b;});}})[_0x6f87('0x23')](respondWithStatusCode(_0x588627,null))['catch'](handleError(_0x588627,null));};exports[_0x6f87('0x83')]=function(_0x5f223d,_0x48e932,_0x18a6f3){var _0x4271eb={};var _0x5b37f6={};var _0x4f9c0a;var _0x27c1ac;return db[_0x6f87('0x40')][_0x6f87('0x57')]({'where':{'id':_0x5f223d[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x48e932,null))[_0x6f87('0x23')](function(_0x239693){if(_0x239693){_0x4f9c0a=_0x239693;_0x5b37f6[_0x6f87('0x2f')]=_[_0x6f87('0x32')](db[_0x6f87('0x62')][_0x6f87('0x47')]);_0x5b37f6[_0x6f87('0x31')]=_['keys'](_0x5f223d[_0x6f87('0x31')]);_0x5b37f6[_0x6f87('0x3b')]=_[_0x6f87('0x33')](_0x5b37f6['model'],_0x5b37f6[_0x6f87('0x31')]);_0x4271eb[_0x6f87('0x35')]=_['intersection'](_0x5b37f6[_0x6f87('0x2f')],qs['fields'](_0x5f223d[_0x6f87('0x31')][_0x6f87('0x34')]));_0x4271eb[_0x6f87('0x35')]=_0x4271eb[_0x6f87('0x35')][_0x6f87('0x36')]?_0x4271eb['attributes']:_0x5b37f6[_0x6f87('0x2f')];_0x4271eb[_0x6f87('0x38')]=qs[_0x6f87('0x39')](_0x5f223d[_0x6f87('0x31')]['sort']);_0x4271eb[_0x6f87('0x3a')]=qs['filters'](_[_0x6f87('0x59')](_0x5f223d[_0x6f87('0x31')],_0x5b37f6[_0x6f87('0x3b')]));if(_0x5f223d[_0x6f87('0x31')][_0x6f87('0x3e')]){_0x4271eb[_0x6f87('0x3a')]=_['merge'](_0x4271eb['where'],{'$or':_[_0x6f87('0x2b')](_0x4271eb[_0x6f87('0x35')],function(_0x249fa8){var _0x1b0c25={};_0x1b0c25[_0x249fa8]={'$like':'%'+_0x5f223d[_0x6f87('0x31')][_0x6f87('0x3e')]+'%'};return _0x1b0c25;})});}_0x4271eb=_[_0x6f87('0x3c')]({},_0x4271eb,_0x5f223d['options']);return _0x4f9c0a[_0x6f87('0x83')](_0x4271eb);}})['then'](function(_0x321343){if(_0x321343){_0x27c1ac=_0x321343[_0x6f87('0x36')];if(!_0x5f223d[_0x6f87('0x31')]['hasOwnProperty'](_0x6f87('0x37'))){_0x4271eb[_0x6f87('0x1a')]=qs['limit'](_0x5f223d[_0x6f87('0x31')][_0x6f87('0x1a')]);_0x4271eb['offset']=qs['offset'](_0x5f223d[_0x6f87('0x31')][_0x6f87('0x18')]);}return _0x4f9c0a[_0x6f87('0x83')](_0x4271eb);}})[_0x6f87('0x23')](function(_0x248787){if(_0x248787){return _0x248787?{'count':_0x27c1ac,'rows':_0x248787}:null;}})[_0x6f87('0x23')](respondWithResult(_0x48e932,null))[_0x6f87('0x45')](handleError(_0x48e932,null));};exports[_0x6f87('0x84')]=function(_0x4d0fb8,_0x328543,_0x5642a2){var _0x4fbf58,_0x34563e;return db[_0x6f87('0x40')][_0x6f87('0x4e')]({'where':{'id':_0x4d0fb8[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x328543,null))[_0x6f87('0x23')](function(_0x3e2d5d){if(_0x3e2d5d){_0x34563e=_0x3e2d5d;return _0x3e2d5d[_0x6f87('0x84')](_0x4d0fb8[_0x6f87('0x49')]['ids'],_[_0x6f87('0x53')](_0x4d0fb8['body'],['ids','id'])||{});}return null;})[_0x6f87('0x66')](function(_0x2ac94e){var _0x402c70;_0x4fbf58=_0x2ac94e||[];var _0x564c88=[];if(_0x2ac94e){for(var _0x393d14=0x0;_0x393d14<_0x2ac94e[_0x6f87('0x36')];_0x393d14+=0x1){var _0x587e50=_0x2ac94e[_0x393d14][_0x6f87('0x24')]({'plain':!![]});_0x402c70=squel[_0x6f87('0x69')]()[_0x6f87('0x6a')](_0x6f87('0x85'))['fromQuery'](['phone',_0x6f87('0x72'),_0x6f87('0x6d'),_0x6f87('0x5a'),'createdAt',_0x6f87('0x55')],squel[_0x6f87('0x6e')]()[_0x6f87('0x6f')]('phone',_0x6f87('0x70'))['field']('id','ContactId')[_0x6f87('0x6f')](_0x587e50['CmListId']['toString'](),_0x6f87('0x6d'))[_0x6f87('0x6f')](_0x4d0fb8[_0x6f87('0x56')]['id'][_0x6f87('0x73')](),_0x6f87('0x5a'))[_0x6f87('0x6f')](_0x6f87('0x71'),_0x6f87('0x54'))[_0x6f87('0x6f')]('NOW()',_0x6f87('0x55'))['from'](_0x6f87('0x7e'))['where'](_0x6f87('0x75'))[_0x6f87('0x3a')]('ListId\x20=\x20?',_0x587e50[_0x6f87('0x77')][_0x6f87('0x73')]())[_0x6f87('0x3a')](_0x6f87('0x78')))[_0x6f87('0x73')]();_0x564c88[_0x6f87('0x80')](db[_0x6f87('0x86')][_0x6f87('0x31')](_0x402c70));}return BPromise['all'](_0x564c88);}})['then'](function(){return _0x4fbf58;})['then'](respondWithResult(_0x328543,null))[_0x6f87('0x45')](handleError(_0x328543,null));};exports[_0x6f87('0x87')]=function(_0x49ac0e,_0x363b2a,_0x2be477){return db[_0x6f87('0x40')]['find']({'where':{'id':_0x49ac0e[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](handleEntityNotFound(_0x363b2a,null))[_0x6f87('0x23')](function(_0x4f6a1b){if(_0x4f6a1b){return _0x4f6a1b[_0x6f87('0x87')](_0x49ac0e[_0x6f87('0x31')][_0x6f87('0x65')]);}})['then'](function(_0x1fe021){if(_0x1fe021){return db[_0x6f87('0x61')][_0x6f87('0x27')]({'where':{'ListId':_0x49ac0e[_0x6f87('0x31')]['ids'],'CampaignId':_0x49ac0e[_0x6f87('0x56')]['id']}})[_0x6f87('0x23')](function(){return _0x1fe021;});}})[_0x6f87('0x23')](respondWithStatusCode(_0x363b2a,null))[_0x6f87('0x45')](handleError(_0x363b2a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a649b1d..c382a89 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x2dbcef,_0x1cfecb){var _0x5a90ea=function(_0x189054){while(--_0x189054){_0x2dbcef['push'](_0x2dbcef['shift']());}};_0x5a90ea(++_0x1cfecb);}(_0x7a54,0x106));var _0x47a5=function(_0x350a59,_0x219dbe){_0x350a59=_0x350a59-0x0;var _0x12a03b=_0x7a54[_0x350a59];return _0x12a03b;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x580647,_0x43d2c3){var _0x5f0792=function(_0x386cef){while(--_0x386cef){_0x580647['push'](_0x580647['shift']());}};_0x5f0792(++_0x43d2c3);}(_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 fc84bfe..cdc6872 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 _0x0487=['map','attributes','model','GetCampaign','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','findAll','options','where','limit','include'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x0487,0x14f));var _0x7048=function(_0x37a7c6,_0x3a84b6){_0x37a7c6=_0x37a7c6-0x0;var _0x539905=_0x0487[_0x37a7c6];return _0x539905;};'use strict';var _=require(_0x7048('0x0'));var util=require(_0x7048('0x1'));var moment=require(_0x7048('0x2'));var BPromise=require(_0x7048('0x3'));var rs=require(_0x7048('0x4'));var fs=require('fs');var Redis=require(_0x7048('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7048('0x6'));var logger=require('../../config/logger')(_0x7048('0x7'));var config=require(_0x7048('0x8'));var jayson=require(_0x7048('0x9'));var client=jayson[_0x7048('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aaedd,_0x140c84,_0xf90179){return new BPromise(function(_0x5683ce,_0x40c685){return client['request'](_0x2aaedd,_0xf90179)[_0x7048('0xb')](function(_0x40fc92){logger[_0x7048('0xc')](_0x7048('0xd'),_0x140c84,_0x7048('0xe'));logger[_0x7048('0xf')](_0x7048('0x10'),_0x140c84,'request\x20sent',JSON[_0x7048('0x11')](_0x40fc92));if(_0x40fc92[_0x7048('0x12')]){if(_0x40fc92[_0x7048('0x12')]['code']===0x1f4){logger[_0x7048('0x12')](_0x7048('0xd'),_0x140c84,_0x40fc92['error'][_0x7048('0x13')]);return _0x40c685(_0x40fc92[_0x7048('0x12')][_0x7048('0x13')]);}logger[_0x7048('0x12')](_0x7048('0xd'),_0x140c84,_0x40fc92['error'][_0x7048('0x13')]);return _0x5683ce(_0x40fc92['error'][_0x7048('0x13')]);}else{logger[_0x7048('0xc')](_0x7048('0xd'),_0x140c84,_0x7048('0xe'));_0x5683ce(_0x40fc92['result'][_0x7048('0x13')]);}})['catch'](function(_0x1082a0){logger[_0x7048('0x12')]('Campaign,\x20%s,\x20%s',_0x140c84,_0x1082a0);_0x40c685(_0x1082a0);});});}exports['GetCampaign']=function(_0x255d5d){var _0xbef931=this;return new Promise(function(_0x1db323,_0xe5fd91){return db['Campaign'][_0x7048('0x14')]({'raw':_0x255d5d['options']?_0x255d5d['options']['raw']===undefined?!![]:![]:!![],'where':_0x255d5d[_0x7048('0x15')]?_0x255d5d[_0x7048('0x15')][_0x7048('0x16')]||null:null,'attributes':_0x255d5d[_0x7048('0x15')]?_0x255d5d[_0x7048('0x15')]['attributes']||null:null,'limit':_0x255d5d[_0x7048('0x15')]?_0x255d5d['options'][_0x7048('0x17')]||null:null,'include':_0x255d5d[_0x7048('0x15')]?_0x255d5d[_0x7048('0x15')][_0x7048('0x18')]?_[_0x7048('0x19')](_0x255d5d[_0x7048('0x15')]['include'],function(_0x4c8709){return{'model':db[_0x4c8709['model']],'as':_0x4c8709['as'],'attributes':_0x4c8709[_0x7048('0x1a')],'include':_0x4c8709['include']?_[_0x7048('0x19')](_0x4c8709[_0x7048('0x18')],function(_0x3c7c96){return{'model':db[_0x3c7c96['model']],'as':_0x3c7c96['as'],'attributes':_0x3c7c96[_0x7048('0x1a')],'include':_0x3c7c96['include']?_[_0x7048('0x19')](_0x3c7c96['include'],function(_0xe3b552){return{'model':db[_0xe3b552[_0x7048('0x1b')]],'as':_0xe3b552['as'],'attributes':_0xe3b552[_0x7048('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x384ff7){logger['info'](_0x7048('0x1c'),_0x255d5d);logger['debug'](_0x7048('0x1c'),_0x255d5d,JSON['stringify'](_0x384ff7));_0x1db323(_0x384ff7);})[_0x7048('0x1d')](function(_0x3ccc34){logger['error']('GetCampaign',_0x3ccc34['message'],_0x255d5d);_0xe5fd91(_0xbef931[_0x7048('0x12')](0x1f4,_0x3ccc34[_0x7048('0x13')]));});});}; \ No newline at end of file +var _0x0962=['jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetCampaign','Campaign','options','raw','where','attributes','include','model','map','debug','stringify','lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment'];(function(_0x34a11a,_0x131ee5){var _0x5220be=function(_0x215bbc){while(--_0x215bbc){_0x34a11a['push'](_0x34a11a['shift']());}};_0x5220be(++_0x131ee5);}(_0x0962,0x198));var _0x2096=function(_0x474c90,_0x96f754){_0x474c90=_0x474c90-0x0;var _0x23e956=_0x0962[_0x474c90];return _0x23e956;};'use strict';var _=require(_0x2096('0x0'));var util=require(_0x2096('0x1'));var moment=require(_0x2096('0x2'));var BPromise=require(_0x2096('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2096('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2096('0x5'))(_0x2096('0x6'));var config=require(_0x2096('0x7'));var jayson=require(_0x2096('0x8'));var client=jayson[_0x2096('0x9')][_0x2096('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130711,_0x39471c,_0x4b5f76){return new BPromise(function(_0x16799f,_0x10b0e7){return client[_0x2096('0xb')](_0x130711,_0x4b5f76)[_0x2096('0xc')](function(_0x2f49bf){logger[_0x2096('0xd')](_0x2096('0xe'),_0x39471c,_0x2096('0xf'));logger['debug'](_0x2096('0x10'),_0x39471c,_0x2096('0xf'),JSON['stringify'](_0x2f49bf));if(_0x2f49bf[_0x2096('0x11')]){if(_0x2f49bf[_0x2096('0x11')][_0x2096('0x12')]===0x1f4){logger[_0x2096('0x11')](_0x2096('0xe'),_0x39471c,_0x2f49bf['error'][_0x2096('0x13')]);return _0x10b0e7(_0x2f49bf[_0x2096('0x11')][_0x2096('0x13')]);}logger['error'](_0x2096('0xe'),_0x39471c,_0x2f49bf[_0x2096('0x11')][_0x2096('0x13')]);return _0x16799f(_0x2f49bf['error'][_0x2096('0x13')]);}else{logger[_0x2096('0xd')](_0x2096('0xe'),_0x39471c,_0x2096('0xf'));_0x16799f(_0x2f49bf['result'][_0x2096('0x13')]);}})[_0x2096('0x14')](function(_0x1ffbb8){logger['error']('Campaign,\x20%s,\x20%s',_0x39471c,_0x1ffbb8);_0x10b0e7(_0x1ffbb8);});});}exports[_0x2096('0x15')]=function(_0x22c478){var _0x4e4dc2=this;return new Promise(function(_0xd7e9e0,_0x2b7da7){return db[_0x2096('0x16')]['findAll']({'raw':_0x22c478[_0x2096('0x17')]?_0x22c478['options'][_0x2096('0x18')]===undefined?!![]:![]:!![],'where':_0x22c478[_0x2096('0x17')]?_0x22c478[_0x2096('0x17')][_0x2096('0x19')]||null:null,'attributes':_0x22c478[_0x2096('0x17')]?_0x22c478[_0x2096('0x17')][_0x2096('0x1a')]||null:null,'limit':_0x22c478[_0x2096('0x17')]?_0x22c478[_0x2096('0x17')]['limit']||null:null,'include':_0x22c478[_0x2096('0x17')]?_0x22c478['options'][_0x2096('0x1b')]?_['map'](_0x22c478['options'][_0x2096('0x1b')],function(_0x686f15){return{'model':db[_0x686f15[_0x2096('0x1c')]],'as':_0x686f15['as'],'attributes':_0x686f15[_0x2096('0x1a')],'include':_0x686f15[_0x2096('0x1b')]?_[_0x2096('0x1d')](_0x686f15[_0x2096('0x1b')],function(_0xe72b8a){return{'model':db[_0xe72b8a[_0x2096('0x1c')]],'as':_0xe72b8a['as'],'attributes':_0xe72b8a[_0x2096('0x1a')],'include':_0xe72b8a[_0x2096('0x1b')]?_[_0x2096('0x1d')](_0xe72b8a['include'],function(_0x4a78e7){return{'model':db[_0x4a78e7[_0x2096('0x1c')]],'as':_0x4a78e7['as'],'attributes':_0x4a78e7[_0x2096('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2096('0xc')](function(_0x35f1c3){logger[_0x2096('0xd')](_0x2096('0x15'),_0x22c478);logger[_0x2096('0x1e')](_0x2096('0x15'),_0x22c478,JSON[_0x2096('0x1f')](_0x35f1c3));_0xd7e9e0(_0x35f1c3);})['catch'](function(_0x1524de){logger[_0x2096('0x11')](_0x2096('0x15'),_0x1524de[_0x2096('0x13')],_0x22c478);_0x2b7da7(_0x4e4dc2[_0x2096('0x11')](0x1f4,_0x1524de[_0x2096('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7843dd2..1ba6412 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 _0x8b7c=['../../components/auth/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','getLists','/:id/blacklists','getBlackLists','post','create','clone','/:id/lists','addLists','addBlackLists','put','delete','removeLists','removeBlackLists','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x11a92c,_0xd10035){var _0x190b60=function(_0x1ffbaa){while(--_0x1ffbaa){_0x11a92c['push'](_0x11a92c['shift']());}};_0x190b60(++_0xd10035);}(_0x8b7c,0x119));var _0xc8b7=function(_0x486f1d,_0x90c2b5){_0x486f1d=_0x486f1d-0x0;var _0x5a2c2d=_0x8b7c[_0x486f1d];return _0x5a2c2d;};'use strict';var multer=require(_0xc8b7('0x0'));var util=require(_0xc8b7('0x1'));var path=require(_0xc8b7('0x2'));var timeout=require(_0xc8b7('0x3'));var express=require(_0xc8b7('0x4'));var router=express[_0xc8b7('0x5')]();var fs_extra=require(_0xc8b7('0x6'));var auth=require(_0xc8b7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc8b7('0x8'));var controller=require(_0xc8b7('0x9'));router[_0xc8b7('0xa')]('/',auth['isAuthenticated'](),controller[_0xc8b7('0xb')]);router[_0xc8b7('0xa')](_0xc8b7('0xc'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0xe')]);router[_0xc8b7('0xa')]('/:id/hoppers',auth[_0xc8b7('0xd')](),controller['getHoppers']);router[_0xc8b7('0xa')](_0xc8b7('0xf'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x10')]);router[_0xc8b7('0xa')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router[_0xc8b7('0xa')](_0xc8b7('0x11'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x12')]);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xc8b7('0x13')]);router[_0xc8b7('0xa')](_0xc8b7('0x14'),auth['isAuthenticated'](),controller[_0xc8b7('0x15')]);router[_0xc8b7('0x16')]('/',auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x17')]);router[_0xc8b7('0x16')]('/:id/clone',auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x18')]);router[_0xc8b7('0x16')](_0xc8b7('0x19'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x1a')]);router[_0xc8b7('0x16')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0xc8b7('0x1b')]);router[_0xc8b7('0x1c')](_0xc8b7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xc8b7('0x1d')]('/:id',auth[_0xc8b7('0xd')](),controller['destroy']);router[_0xc8b7('0x1d')](_0xc8b7('0x19'),auth['isAuthenticated'](),controller[_0xc8b7('0x1e')]);router['delete'](_0xc8b7('0x14'),auth[_0xc8b7('0xd')](),controller[_0xc8b7('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x193f=['destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/lists','/:id/blacklists','getBlackLists','post','/:id/clone','clone','put','update','delete'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x193f,0x9f));var _0xf193=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0x193f[_0x265aa2];return _0x447a3a;};'use strict';var multer=require(_0xf193('0x0'));var util=require(_0xf193('0x1'));var path=require(_0xf193('0x2'));var timeout=require(_0xf193('0x3'));var express=require('express');var router=express[_0xf193('0x4')]();var fs_extra=require(_0xf193('0x5'));var auth=require(_0xf193('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf193('0x7'));router[_0xf193('0x8')]('/',auth[_0xf193('0x9')](),controller[_0xf193('0xa')]);router[_0xf193('0x8')](_0xf193('0xb'),auth[_0xf193('0x9')](),controller[_0xf193('0xc')]);router['get'](_0xf193('0xd'),auth[_0xf193('0x9')](),controller['getHoppers']);router[_0xf193('0x8')](_0xf193('0xe'),auth[_0xf193('0x9')](),controller[_0xf193('0xf')]);router[_0xf193('0x8')]('/:id/hopper_finals',auth[_0xf193('0x9')](),controller[_0xf193('0x10')]);router[_0xf193('0x8')](_0xf193('0x11'),auth[_0xf193('0x9')](),controller['getHopperBlacks']);router[_0xf193('0x8')](_0xf193('0x12'),auth[_0xf193('0x9')](),controller['getLists']);router[_0xf193('0x8')](_0xf193('0x13'),auth[_0xf193('0x9')](),controller[_0xf193('0x14')]);router[_0xf193('0x15')]('/',auth[_0xf193('0x9')](),controller['create']);router[_0xf193('0x15')](_0xf193('0x16'),auth[_0xf193('0x9')](),controller[_0xf193('0x17')]);router[_0xf193('0x15')](_0xf193('0x12'),auth[_0xf193('0x9')](),controller['addLists']);router[_0xf193('0x15')]('/:id/blacklists',auth['isAuthenticated'](),controller['addBlackLists']);router[_0xf193('0x18')](_0xf193('0xb'),auth[_0xf193('0x9')](),controller[_0xf193('0x19')]);router[_0xf193('0x1a')](_0xf193('0xb'),auth[_0xf193('0x9')](),controller[_0xf193('0x1b')]);router['delete'](_0xf193('0x12'),auth[_0xf193('0x9')](),controller[_0xf193('0x1c')]);router[_0xf193('0x1a')](_0xf193('0x13'),auth['isAuthenticated'](),controller[_0xf193('0x1d')]);module[_0xf193('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 908c69b..0f4cb81 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 _0xda19=['exports','STRING','TEXT','VIRTUAL','key'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0xda19,0x181));var _0x9da1=function(_0x1c4004,_0x5bb18d){_0x1c4004=_0x1c4004-0x0;var _0x2b9169=_0xda19[_0x1c4004];return _0x2b9169;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'key':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x9da1('0x1')]},'name':{'type':Sequelize[_0x9da1('0x3')],'get':function(){return this['getDataValue'](_0x9da1('0x4'));}}}; \ No newline at end of file +var _0x3b45=['key','exports','TEXT','STRING','VIRTUAL','getDataValue'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x3b45,0x67));var _0x53b4=function(_0x382052,_0xc612bc){_0x382052=_0x382052-0x0;var _0x31d728=_0x3b45[_0x382052];return _0x31d728;};'use strict';var Sequelize=require('sequelize');module[_0x53b4('0x0')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x53b4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x53b4('0x2')]},'name':{'type':Sequelize[_0x53b4('0x3')],'get':function(){return this[_0x53b4('0x4')](_0x53b4('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index f32ee36..4a99313 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 _0xdc2c=['rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','findAll','rows','catch','show','params','include','options','find','body','create','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','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','map','CannedAnswer'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xdc2c,0x1de));var _0xcdc2=function(_0x13aadd,_0x39015c){_0x13aadd=_0x13aadd-0x0;var _0x29ed22=_0xdc2c[_0x13aadd];return _0x29ed22;};'use strict';var emlformat=require(_0xcdc2('0x0'));var rimraf=require(_0xcdc2('0x1'));var zipdir=require(_0xcdc2('0x2'));var jsonpatch=require(_0xcdc2('0x3'));var rp=require(_0xcdc2('0x4'));var moment=require(_0xcdc2('0x5'));var BPromise=require(_0xcdc2('0x6'));var Mustache=require(_0xcdc2('0x7'));var util=require('util');var path=require(_0xcdc2('0x8'));var sox=require(_0xcdc2('0x9'));var csv=require(_0xcdc2('0xa'));var ejs=require(_0xcdc2('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdc2('0xc'));var squel=require(_0xcdc2('0xd'));var crypto=require('crypto');var jsforce=require(_0xcdc2('0xe'));var deskjs=require(_0xcdc2('0xf'));var toCsv=require(_0xcdc2('0xa'));var querystring=require(_0xcdc2('0x10'));var Papa=require(_0xcdc2('0x11'));var Redis=require(_0xcdc2('0x12'));var authService=require(_0xcdc2('0x13'));var qs=require(_0xcdc2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdc2('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcdc2('0x16'));var db=require(_0xcdc2('0x17'))['db'];function respondWithStatusCode(_0x40508b,_0x5a6e5c){_0x5a6e5c=_0x5a6e5c||0xcc;return function(_0x1da005){if(_0x1da005){return _0x40508b['sendStatus'](_0x5a6e5c);}return _0x40508b[_0xcdc2('0x18')](_0x5a6e5c)[_0xcdc2('0x19')]();};}function respondWithResult(_0x202ab7,_0xa8b6f2){_0xa8b6f2=_0xa8b6f2||0xc8;return function(_0x4c5e53){if(_0x4c5e53){return _0x202ab7[_0xcdc2('0x18')](_0xa8b6f2)['json'](_0x4c5e53);}};}function respondWithFilteredResult(_0x2a50ae,_0x279c08){return function(_0x33e4b2){if(_0x33e4b2){var _0x243e0a=typeof _0x279c08[_0xcdc2('0x1a')]===_0xcdc2('0x1b')&&typeof _0x279c08[_0xcdc2('0x1c')]===_0xcdc2('0x1b');var _0x51a928=_0x33e4b2['count'];var _0x1ed73e=_0x243e0a?0x0:_0x279c08[_0xcdc2('0x1a')];var _0x5f44ae=_0x243e0a?_0x33e4b2['count']:_0x279c08[_0xcdc2('0x1a')]+_0x279c08[_0xcdc2('0x1c')];var _0x4ae36e;if(_0x5f44ae>=_0x51a928){_0x5f44ae=_0x51a928;_0x4ae36e=0xc8;}else{_0x4ae36e=0xce;}_0x2a50ae[_0xcdc2('0x18')](_0x4ae36e);return _0x2a50ae[_0xcdc2('0x1d')]('Content-Range',_0x1ed73e+'-'+_0x5f44ae+'/'+_0x51a928)['json'](_0x33e4b2);}return null;};}function patchUpdates(_0x51fe92){return function(_0x4bb4ca){try{jsonpatch[_0xcdc2('0x1e')](_0x4bb4ca,_0x51fe92,!![]);}catch(_0x3af1d8){return BPromise[_0xcdc2('0x1f')](_0x3af1d8);}return _0x4bb4ca['save']();};}function saveUpdates(_0x2f8208,_0x223bdb){return function(_0x4f0902){if(_0x4f0902){return _0x4f0902[_0xcdc2('0x20')](_0x2f8208)[_0xcdc2('0x21')](function(_0x36629d){return _0x36629d;});}return null;};}function removeEntity(_0x32d717,_0x551ddc){return function(_0x53cb1a){if(_0x53cb1a){return _0x53cb1a[_0xcdc2('0x22')]()[_0xcdc2('0x21')](function(){var _0x44ea68=_0x53cb1a[_0xcdc2('0x23')]({'plain':!![]});var _0x5d4007='CannedAnswers';return db[_0xcdc2('0x24')][_0xcdc2('0x22')]({'where':{'type':_0x5d4007,'resourceId':_0x44ea68['id']}})[_0xcdc2('0x21')](function(){return _0x53cb1a;});})['then'](function(){_0x32d717[_0xcdc2('0x18')](0xcc)[_0xcdc2('0x19')]();});}};}function handleEntityNotFound(_0x45fb59,_0xb90491){return function(_0x529d37){if(!_0x529d37){_0x45fb59[_0xcdc2('0x25')](0x194);}return _0x529d37;};}function handleError(_0x5e58cb,_0x3e33b7){_0x3e33b7=_0x3e33b7||0x1f4;return function(_0x34cd55){logger[_0xcdc2('0x26')](_0x34cd55[_0xcdc2('0x27')]);if(_0x34cd55[_0xcdc2('0x28')]){delete _0x34cd55['name'];}_0x5e58cb[_0xcdc2('0x18')](_0x3e33b7)[_0xcdc2('0x29')](_0x34cd55);};}exports['index']=function(_0x5a40da,_0x748f33){var _0x9c5da7={},_0x350c01={},_0x3e5294={'count':0x0,'rows':[]};var _0xf9b713=_[_0xcdc2('0x2a')](db[_0xcdc2('0x2b')][_0xcdc2('0x2c')],function(_0x347364){return{'name':_0x347364['fieldName'],'type':_0x347364[_0xcdc2('0x2d')][_0xcdc2('0x2e')]};});_0x350c01[_0xcdc2('0x2f')]=_[_0xcdc2('0x2a')](_0xf9b713,'name');_0x350c01[_0xcdc2('0x30')]=_[_0xcdc2('0x31')](_0x5a40da['query']);_0x350c01[_0xcdc2('0x32')]=_[_0xcdc2('0x33')](_0x350c01[_0xcdc2('0x2f')],_0x350c01[_0xcdc2('0x30')]);_0x9c5da7['attributes']=_[_0xcdc2('0x33')](_0x350c01[_0xcdc2('0x2f')],qs[_0xcdc2('0x34')](_0x5a40da['query'][_0xcdc2('0x34')]));_0x9c5da7[_0xcdc2('0x35')]=_0x9c5da7[_0xcdc2('0x35')][_0xcdc2('0x36')]?_0x9c5da7['attributes']:_0x350c01['model'];if(!_0x5a40da[_0xcdc2('0x30')][_0xcdc2('0x37')](_0xcdc2('0x38'))){_0x9c5da7[_0xcdc2('0x1c')]=qs[_0xcdc2('0x1c')](_0x5a40da[_0xcdc2('0x30')][_0xcdc2('0x1c')]);_0x9c5da7['offset']=qs[_0xcdc2('0x1a')](_0x5a40da[_0xcdc2('0x30')][_0xcdc2('0x1a')]);}_0x9c5da7[_0xcdc2('0x39')]=qs[_0xcdc2('0x3a')](_0x5a40da[_0xcdc2('0x30')][_0xcdc2('0x3a')]);_0x9c5da7[_0xcdc2('0x3b')]=qs[_0xcdc2('0x32')](_['pick'](_0x5a40da[_0xcdc2('0x30')],_0x350c01[_0xcdc2('0x32')]),_0xf9b713);if(_0x5a40da[_0xcdc2('0x30')][_0xcdc2('0x3c')]){_0x9c5da7[_0xcdc2('0x3b')]=_[_0xcdc2('0x3d')](_0x9c5da7[_0xcdc2('0x3b')],{'$or':[{'key':{'$like':'%'+_0x5a40da[_0xcdc2('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x5a40da['query'][_0xcdc2('0x3c')]+'%'}}]});}_0x9c5da7=_['merge']({},_0x9c5da7,_0x5a40da['options']);var _0x355bb8={'where':_0x9c5da7[_0xcdc2('0x3b')]};return db[_0xcdc2('0x2b')]['count'](_0x355bb8)[_0xcdc2('0x21')](function(_0x4d863b){_0x3e5294[_0xcdc2('0x3e')]=_0x4d863b;if(_0x5a40da[_0xcdc2('0x30')]['includeAll']){_0x9c5da7['include']=[{'all':!![]}];}return db[_0xcdc2('0x2b')][_0xcdc2('0x3f')](_0x9c5da7);})[_0xcdc2('0x21')](function(_0x3a7264){_0x3e5294[_0xcdc2('0x40')]=_0x3a7264;return _0x3e5294;})['then'](respondWithFilteredResult(_0x748f33,_0x9c5da7))[_0xcdc2('0x41')](handleError(_0x748f33,null));};exports[_0xcdc2('0x42')]=function(_0x2a404b,_0x28ff06){var _0x55fd21={'raw':!![],'where':{'id':_0x2a404b[_0xcdc2('0x43')]['id']}},_0x230d9c={};_0x230d9c[_0xcdc2('0x2f')]=_['keys'](db['CannedAnswer'][_0xcdc2('0x2c')]);_0x230d9c['query']=_[_0xcdc2('0x31')](_0x2a404b[_0xcdc2('0x30')]);_0x230d9c[_0xcdc2('0x32')]=_[_0xcdc2('0x33')](_0x230d9c[_0xcdc2('0x2f')],_0x230d9c[_0xcdc2('0x30')]);_0x55fd21[_0xcdc2('0x35')]=_['intersection'](_0x230d9c[_0xcdc2('0x2f')],qs[_0xcdc2('0x34')](_0x2a404b[_0xcdc2('0x30')][_0xcdc2('0x34')]));_0x55fd21[_0xcdc2('0x35')]=_0x55fd21['attributes']['length']?_0x55fd21[_0xcdc2('0x35')]:_0x230d9c[_0xcdc2('0x2f')];if(_0x2a404b[_0xcdc2('0x30')]['includeAll']){_0x55fd21[_0xcdc2('0x44')]=[{'all':!![]}];}_0x55fd21=_['merge']({},_0x55fd21,_0x2a404b[_0xcdc2('0x45')]);return db[_0xcdc2('0x2b')][_0xcdc2('0x46')](_0x55fd21)[_0xcdc2('0x21')](handleEntityNotFound(_0x28ff06,null))[_0xcdc2('0x21')](respondWithResult(_0x28ff06,null))[_0xcdc2('0x41')](handleError(_0x28ff06,null));};exports[_0xcdc2('0x20')]=function(_0xab5ff9,_0x27479b){if(_0xab5ff9[_0xcdc2('0x47')]['id']){delete _0xab5ff9[_0xcdc2('0x47')]['id'];}return db[_0xcdc2('0x2b')][_0xcdc2('0x46')]({'where':{'id':_0xab5ff9[_0xcdc2('0x43')]['id']}})[_0xcdc2('0x21')](handleEntityNotFound(_0x27479b,null))[_0xcdc2('0x21')](saveUpdates(_0xab5ff9['body'],null))['then'](respondWithResult(_0x27479b,null))['catch'](handleError(_0x27479b,null));};exports['destroy']=function(_0x3cafe5,_0x4ee330){return db[_0xcdc2('0x2b')][_0xcdc2('0x46')]({'where':{'id':_0x3cafe5[_0xcdc2('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ee330,null))['then'](removeEntity(_0x4ee330,null))[_0xcdc2('0x41')](handleError(_0x4ee330,null));};exports[_0xcdc2('0x48')]=function(_0x3edc00,_0xd09d67){var _0x589417={'key':_0x3edc00[_0xcdc2('0x47')][_0xcdc2('0x2e')]};if(_0x3edc00[_0xcdc2('0x47')][_0xcdc2('0x49')]){_0x589417[_0xcdc2('0x49')]=_0x3edc00['body'][_0xcdc2('0x49')];}else if(_0x3edc00[_0xcdc2('0x47')][_0xcdc2('0x4a')]){_0x589417[_0xcdc2('0x4a')]=_0x3edc00['body'][_0xcdc2('0x4a')];}else if(_0x3edc00[_0xcdc2('0x47')][_0xcdc2('0x4b')]){_0x589417[_0xcdc2('0x4b')]=_0x3edc00[_0xcdc2('0x47')]['OpenchannelAccountId'];}else if(_0x3edc00[_0xcdc2('0x47')][_0xcdc2('0x4c')]){_0x589417[_0xcdc2('0x4c')]=_0x3edc00[_0xcdc2('0x47')][_0xcdc2('0x4c')];}return db['CannedAnswer'][_0xcdc2('0x46')]({'where':_0x589417})[_0xcdc2('0x21')](function(_0x4978ac){if(_0x4978ac){throw new db[(_0xcdc2('0x4d'))][(_0xcdc2('0x4e'))](_0xcdc2('0x4f'));}return db['CannedAnswer'][_0xcdc2('0x48')](_0x3edc00[_0xcdc2('0x47')]);})['then'](function(_0x2f17bd){var _0x29b535=_0x3edc00[_0xcdc2('0x50')][_0xcdc2('0x23')]({'plain':!![]});if(!_0x29b535)throw new Error(_0xcdc2('0x51'));if(_0x29b535[_0xcdc2('0x52')]===_0xcdc2('0x50')){var _0x2dc711=_0x2f17bd[_0xcdc2('0x23')]({'plain':!![]});return db[_0xcdc2('0x53')][_0xcdc2('0x46')]({'where':{'name':'CannedAnswers','userProfileId':_0x29b535[_0xcdc2('0x54')]},'raw':!![]})[_0xcdc2('0x21')](function(_0x22badb){if(_0x22badb&&_0x22badb[_0xcdc2('0x55')]===0x0){return db[_0xcdc2('0x24')][_0xcdc2('0x48')]({'name':_0x2dc711['name'],'resourceId':_0x2dc711['id'],'type':_0x22badb[_0xcdc2('0x28')],'sectionId':_0x22badb['id']},{})[_0xcdc2('0x21')](function(){return _0x2f17bd;});}else{return _0x2f17bd;}})[_0xcdc2('0x41')](function(_0x39af5f){logger[_0xcdc2('0x26')](_0xcdc2('0x56'),_0x39af5f);throw _0x39af5f;});}return _0x2f17bd;})[_0xcdc2('0x21')](respondWithResult(_0xd09d67,0xc9))[_0xcdc2('0x41')](handleError(_0xd09d67,null));}; \ No newline at end of file +var _0xae23=['../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','reject','save','update','then','get','CannedAnswers','UserProfileResource','destroy','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1088c0,_0x114580){var _0xb9df7c=function(_0x423af7){while(--_0x423af7){_0x1088c0['push'](_0x1088c0['shift']());}};_0xb9df7c(++_0x114580);}(_0xae23,0x1b6));var _0x3ae2=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xae23[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0x3ae2('0x0'));var rimraf=require(_0x3ae2('0x1'));var zipdir=require(_0x3ae2('0x2'));var jsonpatch=require(_0x3ae2('0x3'));var rp=require('request-promise');var moment=require(_0x3ae2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3ae2('0x5'));var util=require(_0x3ae2('0x6'));var path=require(_0x3ae2('0x7'));var sox=require(_0x3ae2('0x8'));var csv=require(_0x3ae2('0x9'));var ejs=require(_0x3ae2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ae2('0xb'));var squel=require(_0x3ae2('0xc'));var crypto=require(_0x3ae2('0xd'));var jsforce=require(_0x3ae2('0xe'));var deskjs=require(_0x3ae2('0xf'));var toCsv=require(_0x3ae2('0x9'));var querystring=require(_0x3ae2('0x10'));var Papa=require(_0x3ae2('0x11'));var Redis=require(_0x3ae2('0x12'));var authService=require(_0x3ae2('0x13'));var qs=require(_0x3ae2('0x14'));var as=require(_0x3ae2('0x15'));var hardwareService=require(_0x3ae2('0x16'));var logger=require(_0x3ae2('0x17'))('api');var utils=require(_0x3ae2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3ae2('0x19'))['db'];function respondWithStatusCode(_0xa4bac2,_0x10ec5b){_0x10ec5b=_0x10ec5b||0xcc;return function(_0x33b52e){if(_0x33b52e){return _0xa4bac2[_0x3ae2('0x1a')](_0x10ec5b);}return _0xa4bac2[_0x3ae2('0x1b')](_0x10ec5b)[_0x3ae2('0x1c')]();};}function respondWithResult(_0x57797a,_0x548dcb){_0x548dcb=_0x548dcb||0xc8;return function(_0xdb61b8){if(_0xdb61b8){return _0x57797a[_0x3ae2('0x1b')](_0x548dcb)[_0x3ae2('0x1d')](_0xdb61b8);}};}function respondWithFilteredResult(_0x1d2d1e,_0x1519c9){return function(_0x194488){if(_0x194488){var _0x11e0fb=typeof _0x1519c9['offset']==='undefined'&&typeof _0x1519c9[_0x3ae2('0x1e')]===_0x3ae2('0x1f');var _0xd5379c=_0x194488[_0x3ae2('0x20')];var _0x4cabc1=_0x11e0fb?0x0:_0x1519c9[_0x3ae2('0x21')];var _0x2c65d0=_0x11e0fb?_0x194488[_0x3ae2('0x20')]:_0x1519c9[_0x3ae2('0x21')]+_0x1519c9[_0x3ae2('0x1e')];var _0x1f76ee;if(_0x2c65d0>=_0xd5379c){_0x2c65d0=_0xd5379c;_0x1f76ee=0xc8;}else{_0x1f76ee=0xce;}_0x1d2d1e[_0x3ae2('0x1b')](_0x1f76ee);return _0x1d2d1e[_0x3ae2('0x22')]('Content-Range',_0x4cabc1+'-'+_0x2c65d0+'/'+_0xd5379c)[_0x3ae2('0x1d')](_0x194488);}return null;};}function patchUpdates(_0x168b98){return function(_0x1e6249){try{jsonpatch['apply'](_0x1e6249,_0x168b98,!![]);}catch(_0x2f316e){return BPromise[_0x3ae2('0x23')](_0x2f316e);}return _0x1e6249[_0x3ae2('0x24')]();};}function saveUpdates(_0x46f350,_0x3932e8){return function(_0x469eef){if(_0x469eef){return _0x469eef[_0x3ae2('0x25')](_0x46f350)[_0x3ae2('0x26')](function(_0x225a01){return _0x225a01;});}return null;};}function removeEntity(_0x44bdd4,_0x535548){return function(_0x394c2c){if(_0x394c2c){return _0x394c2c['destroy']()['then'](function(){var _0x2db469=_0x394c2c[_0x3ae2('0x27')]({'plain':!![]});var _0x1a6a15=_0x3ae2('0x28');return db[_0x3ae2('0x29')][_0x3ae2('0x2a')]({'where':{'type':_0x1a6a15,'resourceId':_0x2db469['id']}})['then'](function(){return _0x394c2c;});})[_0x3ae2('0x26')](function(){_0x44bdd4['status'](0xcc)[_0x3ae2('0x1c')]();});}};}function handleEntityNotFound(_0x5f26be,_0x2cdffb){return function(_0x211ae6){if(!_0x211ae6){_0x5f26be['sendStatus'](0x194);}return _0x211ae6;};}function handleError(_0x2a0598,_0x3e0825){_0x3e0825=_0x3e0825||0x1f4;return function(_0x558895){logger[_0x3ae2('0x2b')](_0x558895[_0x3ae2('0x2c')]);if(_0x558895[_0x3ae2('0x2d')]){delete _0x558895['name'];}_0x2a0598[_0x3ae2('0x1b')](_0x3e0825)[_0x3ae2('0x2e')](_0x558895);};}exports[_0x3ae2('0x2f')]=function(_0x5ab86f,_0x4e838c){var _0x45decb={},_0x5932bb={},_0x2bc291={'count':0x0,'rows':[]};var _0x82097e=_[_0x3ae2('0x30')](db[_0x3ae2('0x31')][_0x3ae2('0x32')],function(_0x116be6){return{'name':_0x116be6[_0x3ae2('0x33')],'type':_0x116be6[_0x3ae2('0x34')][_0x3ae2('0x35')]};});_0x5932bb[_0x3ae2('0x36')]=_[_0x3ae2('0x30')](_0x82097e,'name');_0x5932bb[_0x3ae2('0x37')]=_[_0x3ae2('0x38')](_0x5ab86f[_0x3ae2('0x37')]);_0x5932bb[_0x3ae2('0x39')]=_[_0x3ae2('0x3a')](_0x5932bb[_0x3ae2('0x36')],_0x5932bb[_0x3ae2('0x37')]);_0x45decb[_0x3ae2('0x3b')]=_[_0x3ae2('0x3a')](_0x5932bb['model'],qs[_0x3ae2('0x3c')](_0x5ab86f[_0x3ae2('0x37')][_0x3ae2('0x3c')]));_0x45decb[_0x3ae2('0x3b')]=_0x45decb['attributes'][_0x3ae2('0x3d')]?_0x45decb[_0x3ae2('0x3b')]:_0x5932bb[_0x3ae2('0x36')];if(!_0x5ab86f[_0x3ae2('0x37')][_0x3ae2('0x3e')](_0x3ae2('0x3f'))){_0x45decb['limit']=qs[_0x3ae2('0x1e')](_0x5ab86f[_0x3ae2('0x37')][_0x3ae2('0x1e')]);_0x45decb[_0x3ae2('0x21')]=qs[_0x3ae2('0x21')](_0x5ab86f['query'][_0x3ae2('0x21')]);}_0x45decb[_0x3ae2('0x40')]=qs[_0x3ae2('0x41')](_0x5ab86f[_0x3ae2('0x37')]['sort']);_0x45decb[_0x3ae2('0x42')]=qs['filters'](_[_0x3ae2('0x43')](_0x5ab86f[_0x3ae2('0x37')],_0x5932bb[_0x3ae2('0x39')]),_0x82097e);if(_0x5ab86f[_0x3ae2('0x37')][_0x3ae2('0x44')]){_0x45decb[_0x3ae2('0x42')]=_[_0x3ae2('0x45')](_0x45decb['where'],{'$or':[{'key':{'$like':'%'+_0x5ab86f['query'][_0x3ae2('0x44')]+'%'}},{'value':{'$like':'%'+_0x5ab86f['query'][_0x3ae2('0x44')]+'%'}}]});}_0x45decb=_[_0x3ae2('0x45')]({},_0x45decb,_0x5ab86f['options']);var _0x55ebed={'where':_0x45decb[_0x3ae2('0x42')]};return db['CannedAnswer'][_0x3ae2('0x20')](_0x55ebed)[_0x3ae2('0x26')](function(_0x3a07d3){_0x2bc291[_0x3ae2('0x20')]=_0x3a07d3;if(_0x5ab86f[_0x3ae2('0x37')][_0x3ae2('0x46')]){_0x45decb[_0x3ae2('0x47')]=[{'all':!![]}];}return db[_0x3ae2('0x31')][_0x3ae2('0x48')](_0x45decb);})[_0x3ae2('0x26')](function(_0x1734df){_0x2bc291[_0x3ae2('0x49')]=_0x1734df;return _0x2bc291;})['then'](respondWithFilteredResult(_0x4e838c,_0x45decb))[_0x3ae2('0x4a')](handleError(_0x4e838c,null));};exports[_0x3ae2('0x4b')]=function(_0x46e412,_0x15ca33){var _0x29b119={'raw':!![],'where':{'id':_0x46e412[_0x3ae2('0x4c')]['id']}},_0xd55020={};_0xd55020['model']=_[_0x3ae2('0x38')](db[_0x3ae2('0x31')][_0x3ae2('0x32')]);_0xd55020['query']=_[_0x3ae2('0x38')](_0x46e412['query']);_0xd55020[_0x3ae2('0x39')]=_[_0x3ae2('0x3a')](_0xd55020[_0x3ae2('0x36')],_0xd55020[_0x3ae2('0x37')]);_0x29b119[_0x3ae2('0x3b')]=_['intersection'](_0xd55020['model'],qs[_0x3ae2('0x3c')](_0x46e412[_0x3ae2('0x37')]['fields']));_0x29b119['attributes']=_0x29b119[_0x3ae2('0x3b')][_0x3ae2('0x3d')]?_0x29b119['attributes']:_0xd55020[_0x3ae2('0x36')];if(_0x46e412['query'][_0x3ae2('0x46')]){_0x29b119['include']=[{'all':!![]}];}_0x29b119=_[_0x3ae2('0x45')]({},_0x29b119,_0x46e412['options']);return db[_0x3ae2('0x31')]['find'](_0x29b119)[_0x3ae2('0x26')](handleEntityNotFound(_0x15ca33,null))['then'](respondWithResult(_0x15ca33,null))[_0x3ae2('0x4a')](handleError(_0x15ca33,null));};exports['update']=function(_0x2903fe,_0x3f0fd3){if(_0x2903fe[_0x3ae2('0x4d')]['id']){delete _0x2903fe[_0x3ae2('0x4d')]['id'];}return db[_0x3ae2('0x31')]['find']({'where':{'id':_0x2903fe[_0x3ae2('0x4c')]['id']}})[_0x3ae2('0x26')](handleEntityNotFound(_0x3f0fd3,null))[_0x3ae2('0x26')](saveUpdates(_0x2903fe[_0x3ae2('0x4d')],null))['then'](respondWithResult(_0x3f0fd3,null))[_0x3ae2('0x4a')](handleError(_0x3f0fd3,null));};exports['destroy']=function(_0x8316e4,_0x5872d2){return db[_0x3ae2('0x31')][_0x3ae2('0x4e')]({'where':{'id':_0x8316e4[_0x3ae2('0x4c')]['id']}})[_0x3ae2('0x26')](handleEntityNotFound(_0x5872d2,null))[_0x3ae2('0x26')](removeEntity(_0x5872d2,null))[_0x3ae2('0x4a')](handleError(_0x5872d2,null));};exports[_0x3ae2('0x4f')]=function(_0x340d21,_0x436188){var _0x4a4e25={'key':_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x35')]};if(_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x50')]){_0x4a4e25[_0x3ae2('0x50')]=_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x50')];}else if(_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x51')]){_0x4a4e25[_0x3ae2('0x51')]=_0x340d21['body']['SmsAccountId'];}else if(_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x52')]){_0x4a4e25[_0x3ae2('0x52')]=_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x52')];}else if(_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x53')]){_0x4a4e25['ChatWebsiteId']=_0x340d21[_0x3ae2('0x4d')][_0x3ae2('0x53')];}return db[_0x3ae2('0x31')][_0x3ae2('0x4e')]({'where':_0x4a4e25})[_0x3ae2('0x26')](function(_0x59cd0e){if(_0x59cd0e){throw new db[(_0x3ae2('0x54'))]['ValidationError'](_0x3ae2('0x55'));}return db[_0x3ae2('0x31')]['create'](_0x340d21[_0x3ae2('0x4d')]);})['then'](function(_0x371332){var _0x10755c=_0x340d21[_0x3ae2('0x56')]['get']({'plain':!![]});if(!_0x10755c)throw new Error(_0x3ae2('0x57'));if(_0x10755c['role']===_0x3ae2('0x56')){var _0x29b114=_0x371332[_0x3ae2('0x27')]({'plain':!![]});return db[_0x3ae2('0x58')]['find']({'where':{'name':_0x3ae2('0x28'),'userProfileId':_0x10755c[_0x3ae2('0x59')]},'raw':!![]})['then'](function(_0x54b446){if(_0x54b446&&_0x54b446[_0x3ae2('0x5a')]===0x0){return db['UserProfileResource'][_0x3ae2('0x4f')]({'name':_0x29b114[_0x3ae2('0x2d')],'resourceId':_0x29b114['id'],'type':_0x54b446[_0x3ae2('0x2d')],'sectionId':_0x54b446['id']},{})[_0x3ae2('0x26')](function(){return _0x371332;});}else{return _0x371332;}})[_0x3ae2('0x4a')](function(_0x5a9ea0){logger['error'](_0x3ae2('0x5b'),_0x5a9ea0);throw _0x5a9ea0;});}return _0x371332;})[_0x3ae2('0x26')](respondWithResult(_0x436188,0xc9))['catch'](handleError(_0x436188,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0d45808..921fabf 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 _0x5e03=['./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x5e03,0x192));var _0x35e0=function(_0x51846b,_0x1dcdbb){_0x51846b=_0x51846b-0x0;var _0x583622=_0x5e03[_0x51846b];return _0x583622;};'use strict';var _=require('lodash');var util=require(_0x35e0('0x0'));var logger=require(_0x35e0('0x1'))(_0x35e0('0x2'));var moment=require(_0x35e0('0x3'));var BPromise=require(_0x35e0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x35e0('0x5'));var config=require('../../config/environment');var attributes=require(_0x35e0('0x6'));module[_0x35e0('0x7')]=function(_0x1a0687,_0x982db6){return _0x1a0687[_0x35e0('0x8')](_0x35e0('0x9'),attributes,{'tableName':_0x35e0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x35e0('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x57f8=['CannedAnswer','tools_canned_answers','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x2d560b,_0x4278af){var _0x49a56c=function(_0x4652d0){while(--_0x4652d0){_0x2d560b['push'](_0x2d560b['shift']());}};_0x49a56c(++_0x4278af);}(_0x57f8,0x198));var _0x857f=function(_0xf8aecd,_0x4631e1){_0xf8aecd=_0xf8aecd-0x0;var _0x41b3a1=_0x57f8[_0xf8aecd];return _0x41b3a1;};'use strict';var _=require('lodash');var util=require(_0x857f('0x0'));var logger=require(_0x857f('0x1'))(_0x857f('0x2'));var moment=require(_0x857f('0x3'));var BPromise=require(_0x857f('0x4'));var rp=require(_0x857f('0x5'));var fs=require('fs');var path=require(_0x857f('0x6'));var rimraf=require(_0x857f('0x7'));var config=require(_0x857f('0x8'));var attributes=require(_0x857f('0x9'));module[_0x857f('0xa')]=function(_0x369c40,_0x5d22e4){return _0x369c40[_0x857f('0xb')](_0x857f('0xc'),attributes,{'tableName':_0x857f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x857f('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 9378ee6..04796dd 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(_0x42edc8,_0x28b98e){var _0x199b79=function(_0x45e8f0){while(--_0x45e8f0){_0x42edc8['push'](_0x42edc8['shift']());}};_0x199b79(++_0x28b98e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x56d972,_0x42f7f5){var _0x10d843=function(_0x93873c){while(--_0x93873c){_0x56d972['push'](_0x56d972['shift']());}};_0x10d843(++_0x42f7f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 26523f8..77cb68a 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 _0x27fd=['../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x327e8b,_0x912506){var _0x89151=function(_0x25f76c){while(--_0x25f76c){_0x327e8b['push'](_0x327e8b['shift']());}};_0x89151(++_0x912506);}(_0x27fd,0x1dd));var _0xd27f=function(_0xbc2974,_0xec3342){_0xbc2974=_0xbc2974-0x0;var _0x3a5b4f=_0x27fd[_0xbc2974];return _0x3a5b4f;};'use strict';var multer=require(_0xd27f('0x0'));var util=require(_0xd27f('0x1'));var path=require(_0xd27f('0x2'));var timeout=require(_0xd27f('0x3'));var express=require('express');var router=express[_0xd27f('0x4')]();var fs_extra=require(_0xd27f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd27f('0x6'));var config=require(_0xd27f('0x7'));var controller=require(_0xd27f('0x8'));router[_0xd27f('0x9')]('/',auth['isAuthenticated'](),controller[_0xd27f('0xa')]);router[_0xd27f('0x9')](_0xd27f('0xb'),auth[_0xd27f('0xc')](),controller[_0xd27f('0xd')]);router[_0xd27f('0xe')]('/',auth[_0xd27f('0xc')](),controller[_0xd27f('0xf')]);router[_0xd27f('0x10')]('/:id',auth[_0xd27f('0xc')](),controller[_0xd27f('0x11')]);router[_0xd27f('0x12')](_0xd27f('0xb'),auth[_0xd27f('0xc')](),controller[_0xd27f('0x13')]);module[_0xd27f('0x14')]=router; \ No newline at end of file +var _0x1f06=['destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./cannedAnswer.controller','get','isAuthenticated','show','create','put','delete','/:id'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x1f06,0x172));var _0x61f0=function(_0x3eab66,_0x455323){_0x3eab66=_0x3eab66-0x0;var _0x20dd81=_0x1f06[_0x3eab66];return _0x20dd81;};'use strict';var multer=require('multer');var util=require(_0x61f0('0x0'));var path=require(_0x61f0('0x1'));var timeout=require(_0x61f0('0x2'));var express=require(_0x61f0('0x3'));var router=express['Router']();var fs_extra=require(_0x61f0('0x4'));var auth=require(_0x61f0('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x61f0('0x6'));router[_0x61f0('0x7')]('/',auth[_0x61f0('0x8')](),controller['index']);router[_0x61f0('0x7')]('/:id',auth[_0x61f0('0x8')](),controller[_0x61f0('0x9')]);router['post']('/',auth[_0x61f0('0x8')](),controller[_0x61f0('0xa')]);router[_0x61f0('0xb')]('/:id',auth[_0x61f0('0x8')](),controller['update']);router[_0x61f0('0xc')](_0x61f0('0xd'),auth['isAuthenticated'](),controller[_0x61f0('0xe')]);module[_0x61f0('0xf')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 93cc63e..401219e 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 _0x8696=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x369b84,_0xaa28c8){var _0x56eeeb=function(_0x194fc1){while(--_0x194fc1){_0x369b84['push'](_0x369b84['shift']());}};_0x56eeeb(++_0xaa28c8);}(_0x8696,0x143));var _0x6869=function(_0x18f121,_0x38bb8b){_0x18f121=_0x18f121-0x0;var _0x161741=_0x8696[_0x18f121];return _0x161741;};'use strict';var Sequelize=require(_0x6869('0x0'));module[_0x6869('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x6869('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x6869('0x3')]},'dst':{'type':Sequelize[_0x6869('0x3')]},'dcontext':{'type':Sequelize[_0x6869('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x6869('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6869('0x3')]},'duration':{'type':Sequelize[_0x6869('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x6869('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6869('0x3')]},'userfield':{'type':Sequelize[_0x6869('0x3')]},'uniqueid':{'type':Sequelize[_0x6869('0x3')]},'linkedid':{'type':Sequelize[_0x6869('0x3')]},'sequence':{'type':Sequelize[_0x6869('0x3')]},'peeraccount':{'type':Sequelize[_0x6869('0x3')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x6869('0x3')]}}; \ No newline at end of file +var _0xefd7=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','DATE'];(function(_0x50de89,_0x3b695a){var _0x119c44=function(_0x49e152){while(--_0x49e152){_0x50de89['push'](_0x50de89['shift']());}};_0x119c44(++_0x3b695a);}(_0xefd7,0x99));var _0x7efd=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xefd7[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x7efd('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x7efd('0x1')],'allowNull':![],'defaultValue':_0x7efd('0x2')},'clid':{'type':Sequelize[_0x7efd('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x7efd('0x3')]},'dcontext':{'type':Sequelize[_0x7efd('0x3')]},'channel':{'type':Sequelize[_0x7efd('0x3')]},'dstchannel':{'type':Sequelize[_0x7efd('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x7efd('0x3')]},'duration':{'type':Sequelize[_0x7efd('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x7efd('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x7efd('0x3')]},'amaflags':{'type':Sequelize[_0x7efd('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7efd('0x3')]},'userfield':{'type':Sequelize[_0x7efd('0x3')]},'uniqueid':{'type':Sequelize[_0x7efd('0x3')]},'linkedid':{'type':Sequelize[_0x7efd('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x7efd('0x3')]},'type':{'type':Sequelize[_0x7efd('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f2d2e3f..ae1e5de 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 _0x7c09=['map','Cdr','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index'];(function(_0x45c450,_0x2d46e9){var _0x355dff=function(_0x5a79bd){while(--_0x5a79bd){_0x45c450['push'](_0x45c450['shift']());}};_0x355dff(++_0x2d46e9);}(_0x7c09,0x102));var _0x97c0=function(_0x3c81b5,_0x3c4d22){_0x3c81b5=_0x3c81b5-0x0;var _0x49b8d3=_0x7c09[_0x3c81b5];return _0x49b8d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];function respondWithStatusCode(_0x39a3b4,_0x9ca3c1){_0x9ca3c1=_0x9ca3c1||0xcc;return function(_0x2ecf34){if(_0x2ecf34){return _0x39a3b4[_0x97c0('0x18')](_0x9ca3c1);}return _0x39a3b4[_0x97c0('0x19')](_0x9ca3c1)[_0x97c0('0x1a')]();};}function respondWithResult(_0x514782,_0x3f2fc2){_0x3f2fc2=_0x3f2fc2||0xc8;return function(_0x15b336){if(_0x15b336){return _0x514782[_0x97c0('0x19')](_0x3f2fc2)['json'](_0x15b336);}};}function respondWithFilteredResult(_0x42027d,_0x9ca6a8){return function(_0x379951){if(_0x379951){var _0x21e5f7=typeof _0x9ca6a8[_0x97c0('0x1b')]===_0x97c0('0x1c')&&typeof _0x9ca6a8['limit']===_0x97c0('0x1c');var _0x3ae7c4=_0x379951['count'];var _0x560ac0=_0x21e5f7?0x0:_0x9ca6a8[_0x97c0('0x1b')];var _0x179d43=_0x21e5f7?_0x379951[_0x97c0('0x1d')]:_0x9ca6a8[_0x97c0('0x1b')]+_0x9ca6a8[_0x97c0('0x1e')];var _0x4fed42;if(_0x179d43>=_0x3ae7c4){_0x179d43=_0x3ae7c4;_0x4fed42=0xc8;}else{_0x4fed42=0xce;}_0x42027d[_0x97c0('0x19')](_0x4fed42);return _0x42027d[_0x97c0('0x1f')](_0x97c0('0x20'),_0x560ac0+'-'+_0x179d43+'/'+_0x3ae7c4)['json'](_0x379951);}return null;};}function patchUpdates(_0x554122){return function(_0x2b74a2){try{jsonpatch[_0x97c0('0x21')](_0x2b74a2,_0x554122,!![]);}catch(_0x169f19){return BPromise['reject'](_0x169f19);}return _0x2b74a2[_0x97c0('0x22')]();};}function saveUpdates(_0x20bc4c,_0x31ffb7){return function(_0x272314){if(_0x272314){return _0x272314[_0x97c0('0x23')](_0x20bc4c)[_0x97c0('0x24')](function(_0x9dff60){return _0x9dff60;});}return null;};}function removeEntity(_0x5ac457,_0x60ab00){return function(_0x29b3aa){if(_0x29b3aa){return _0x29b3aa[_0x97c0('0x25')]()[_0x97c0('0x24')](function(){_0x5ac457['status'](0xcc)[_0x97c0('0x1a')]();});}};}function handleEntityNotFound(_0x14cada,_0x52a429){return function(_0x2ec9d6){if(!_0x2ec9d6){_0x14cada[_0x97c0('0x18')](0x194);}return _0x2ec9d6;};}function handleError(_0x447316,_0x4af5a5){_0x4af5a5=_0x4af5a5||0x1f4;return function(_0x4f11ba){logger['error'](_0x4f11ba[_0x97c0('0x26')]);if(_0x4f11ba[_0x97c0('0x27')]){delete _0x4f11ba[_0x97c0('0x27')];}_0x447316[_0x97c0('0x19')](_0x4af5a5)[_0x97c0('0x28')](_0x4f11ba);};}exports[_0x97c0('0x29')]=function(_0x4a3645,_0x10e47e){var _0x1c183f={},_0x325090={},_0x4ad645={'count':0x0,'rows':[]};var _0x14617c=_[_0x97c0('0x2a')](db[_0x97c0('0x2b')][_0x97c0('0x2c')],function(_0x2a7b2b){return{'name':_0x2a7b2b['fieldName'],'type':_0x2a7b2b['type'][_0x97c0('0x2d')]};});_0x325090[_0x97c0('0x2e')]=_[_0x97c0('0x2a')](_0x14617c,'name');_0x325090[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x4a3645['query']);_0x325090[_0x97c0('0x31')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],_0x325090[_0x97c0('0x2f')]);_0x1c183f[_0x97c0('0x33')]=_[_0x97c0('0x32')](_0x325090[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x1c183f[_0x97c0('0x33')]=_0x1c183f[_0x97c0('0x33')][_0x97c0('0x35')]?_0x1c183f[_0x97c0('0x33')]:_0x325090[_0x97c0('0x2e')];if(!_0x4a3645['query'][_0x97c0('0x36')](_0x97c0('0x37'))){_0x1c183f[_0x97c0('0x1e')]=qs[_0x97c0('0x1e')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x1e')]);_0x1c183f[_0x97c0('0x1b')]=qs[_0x97c0('0x1b')](_0x4a3645['query'][_0x97c0('0x1b')]);}_0x1c183f['order']=qs[_0x97c0('0x38')](_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x38')]);_0x1c183f[_0x97c0('0x39')]=qs[_0x97c0('0x31')](_[_0x97c0('0x3a')](_0x4a3645[_0x97c0('0x2f')],_0x325090[_0x97c0('0x31')]),_0x14617c);if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3b')]){_0x1c183f[_0x97c0('0x39')]=_['merge'](_0x1c183f[_0x97c0('0x39')],{'$or':_[_0x97c0('0x2a')](_0x14617c,function(_0x4d47b1){if(_0x4d47b1[_0x97c0('0x3c')]!==_0x97c0('0x3d')){var _0x2aeffc={};_0x2aeffc[_0x4d47b1[_0x97c0('0x27')]]={'$like':'%'+_0x4a3645['query'][_0x97c0('0x3b')]+'%'};return _0x2aeffc;}})});}_0x1c183f=_['merge']({},_0x1c183f,_0x4a3645[_0x97c0('0x3e')]);var _0x64cfcd={'where':_0x1c183f['where']};return db[_0x97c0('0x2b')][_0x97c0('0x1d')](_0x64cfcd)[_0x97c0('0x24')](function(_0xb13649){_0x4ad645[_0x97c0('0x1d')]=_0xb13649;if(_0x4a3645[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x1c183f[_0x97c0('0x40')]=[{'all':!![]}];}return db[_0x97c0('0x2b')][_0x97c0('0x41')](_0x1c183f);})[_0x97c0('0x24')](function(_0x2cca4c){_0x4ad645[_0x97c0('0x42')]=_0x2cca4c;return _0x4ad645;})['then'](respondWithFilteredResult(_0x10e47e,_0x1c183f))[_0x97c0('0x43')](handleError(_0x10e47e,null));};exports[_0x97c0('0x44')]=function(_0x1dc6ff,_0x142421){var _0x312fce={'raw':!![],'where':{'id':_0x1dc6ff[_0x97c0('0x45')]['id']}},_0x375ebc={};_0x375ebc['model']=_['keys'](db[_0x97c0('0x2b')][_0x97c0('0x2c')]);_0x375ebc[_0x97c0('0x2f')]=_[_0x97c0('0x30')](_0x1dc6ff[_0x97c0('0x2f')]);_0x375ebc['filters']=_['intersection'](_0x375ebc['model'],_0x375ebc[_0x97c0('0x2f')]);_0x312fce['attributes']=_['intersection'](_0x375ebc[_0x97c0('0x2e')],qs[_0x97c0('0x34')](_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x34')]));_0x312fce[_0x97c0('0x33')]=_0x312fce['attributes'][_0x97c0('0x35')]?_0x312fce[_0x97c0('0x33')]:_0x375ebc[_0x97c0('0x2e')];if(_0x1dc6ff[_0x97c0('0x2f')][_0x97c0('0x3f')]){_0x312fce[_0x97c0('0x40')]=[{'all':!![]}];}_0x312fce=_[_0x97c0('0x46')]({},_0x312fce,_0x1dc6ff[_0x97c0('0x3e')]);return db[_0x97c0('0x2b')][_0x97c0('0x47')](_0x312fce)['then'](handleEntityNotFound(_0x142421,null))[_0x97c0('0x24')](respondWithResult(_0x142421,null))[_0x97c0('0x43')](handleError(_0x142421,null));};exports[_0x97c0('0x48')]=function(_0x276c98,_0x4ff0a5){return db['Cdr'][_0x97c0('0x48')](_0x276c98[_0x97c0('0x49')],{})[_0x97c0('0x24')](respondWithResult(_0x4ff0a5,0xc9))['catch'](handleError(_0x4ff0a5,null));};exports[_0x97c0('0x23')]=function(_0xac56ac,_0x240f68){if(_0xac56ac[_0x97c0('0x49')]['id']){delete _0xac56ac[_0x97c0('0x49')]['id'];}return db['Cdr'][_0x97c0('0x47')]({'where':{'id':_0xac56ac[_0x97c0('0x45')]['id']}})[_0x97c0('0x24')](handleEntityNotFound(_0x240f68,null))['then'](saveUpdates(_0xac56ac['body'],null))[_0x97c0('0x24')](respondWithResult(_0x240f68,null))['catch'](handleError(_0x240f68,null));};exports['destroy']=function(_0x473b63,_0x20e2a5){return db[_0x97c0('0x2b')]['find']({'where':{'id':_0x473b63['params']['id']}})['then'](handleEntityNotFound(_0x20e2a5,null))[_0x97c0('0x24')](removeEntity(_0x20e2a5,null))[_0x97c0('0x43')](handleError(_0x20e2a5,null));};exports[_0x97c0('0x4a')]=function(_0xdb2767,_0x397065){return db[_0x97c0('0x2b')][_0x97c0('0x4a')]()['then'](respondWithResult(_0x397065,null))[_0x97c0('0x43')](handleError(_0x397065,null));}; \ No newline at end of file +var _0x3831=['error','stack','name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','options','count','include','rows','catch','show','params','length','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','lodash','crypto','jsforce','desk.js','to-csv','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','offset','undefined','limit','set','apply','reject','save','update','then','destroy'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x3831,0x14c));var _0x1383=function(_0x576710,_0x2766d0){_0x576710=_0x576710-0x0;var _0x792aaa=_0x3831[_0x576710];return _0x792aaa;};'use strict';var emlformat=require(_0x1383('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1383('0x1'));var jsonpatch=require(_0x1383('0x2'));var rp=require(_0x1383('0x3'));var moment=require(_0x1383('0x4'));var BPromise=require(_0x1383('0x5'));var Mustache=require('mustache');var util=require(_0x1383('0x6'));var path=require('path');var sox=require(_0x1383('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1383('0x8'));var squel=require('squel');var crypto=require(_0x1383('0x9'));var jsforce=require(_0x1383('0xa'));var deskjs=require(_0x1383('0xb'));var toCsv=require(_0x1383('0xc'));var querystring=require(_0x1383('0xd'));var Papa=require(_0x1383('0xe'));var Redis=require(_0x1383('0xf'));var authService=require(_0x1383('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1383('0x11'));var hardwareService=require(_0x1383('0x12'));var logger=require(_0x1383('0x13'))(_0x1383('0x14'));var utils=require(_0x1383('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1383('0x16'));var db=require(_0x1383('0x17'))['db'];function respondWithStatusCode(_0x1d35fc,_0x48c107){_0x48c107=_0x48c107||0xcc;return function(_0x5e7f63){if(_0x5e7f63){return _0x1d35fc[_0x1383('0x18')](_0x48c107);}return _0x1d35fc[_0x1383('0x19')](_0x48c107)[_0x1383('0x1a')]();};}function respondWithResult(_0x1ba3d1,_0x1e02d7){_0x1e02d7=_0x1e02d7||0xc8;return function(_0x2c8931){if(_0x2c8931){return _0x1ba3d1[_0x1383('0x19')](_0x1e02d7)[_0x1383('0x1b')](_0x2c8931);}};}function respondWithFilteredResult(_0x5e9ed9,_0x7a50d0){return function(_0x1f46de){if(_0x1f46de){var _0x41d895=typeof _0x7a50d0[_0x1383('0x1c')]===_0x1383('0x1d')&&typeof _0x7a50d0[_0x1383('0x1e')]===_0x1383('0x1d');var _0x5ca7fc=_0x1f46de['count'];var _0x2301a6=_0x41d895?0x0:_0x7a50d0['offset'];var _0x236b29=_0x41d895?_0x1f46de['count']:_0x7a50d0['offset']+_0x7a50d0['limit'];var _0x1c8fe7;if(_0x236b29>=_0x5ca7fc){_0x236b29=_0x5ca7fc;_0x1c8fe7=0xc8;}else{_0x1c8fe7=0xce;}_0x5e9ed9['status'](_0x1c8fe7);return _0x5e9ed9[_0x1383('0x1f')]('Content-Range',_0x2301a6+'-'+_0x236b29+'/'+_0x5ca7fc)[_0x1383('0x1b')](_0x1f46de);}return null;};}function patchUpdates(_0x1e6d5e){return function(_0xca314){try{jsonpatch[_0x1383('0x20')](_0xca314,_0x1e6d5e,!![]);}catch(_0x32fb05){return BPromise[_0x1383('0x21')](_0x32fb05);}return _0xca314[_0x1383('0x22')]();};}function saveUpdates(_0x10ed33,_0x2afbd2){return function(_0x505093){if(_0x505093){return _0x505093[_0x1383('0x23')](_0x10ed33)[_0x1383('0x24')](function(_0x39fea2){return _0x39fea2;});}return null;};}function removeEntity(_0x241c3d,_0x186524){return function(_0x2a9502){if(_0x2a9502){return _0x2a9502[_0x1383('0x25')]()['then'](function(){_0x241c3d['status'](0xcc)[_0x1383('0x1a')]();});}};}function handleEntityNotFound(_0x160497,_0x38b48a){return function(_0x3b158d){if(!_0x3b158d){_0x160497[_0x1383('0x18')](0x194);}return _0x3b158d;};}function handleError(_0x4aaee1,_0x5391e0){_0x5391e0=_0x5391e0||0x1f4;return function(_0x4a8b6e){logger[_0x1383('0x26')](_0x4a8b6e[_0x1383('0x27')]);if(_0x4a8b6e[_0x1383('0x28')]){delete _0x4a8b6e[_0x1383('0x28')];}_0x4aaee1['status'](_0x5391e0)[_0x1383('0x29')](_0x4a8b6e);};}exports['index']=function(_0x3c788b,_0xf0037f){var _0x42d63f={},_0x23e541={},_0x3357e9={'count':0x0,'rows':[]};var _0x15a3c4=_[_0x1383('0x2a')](db[_0x1383('0x2b')][_0x1383('0x2c')],function(_0x29ca05){return{'name':_0x29ca05[_0x1383('0x2d')],'type':_0x29ca05[_0x1383('0x2e')][_0x1383('0x2f')]};});_0x23e541[_0x1383('0x30')]=_['map'](_0x15a3c4,_0x1383('0x28'));_0x23e541[_0x1383('0x31')]=_[_0x1383('0x32')](_0x3c788b[_0x1383('0x31')]);_0x23e541[_0x1383('0x33')]=_[_0x1383('0x34')](_0x23e541['model'],_0x23e541[_0x1383('0x31')]);_0x42d63f[_0x1383('0x35')]=_[_0x1383('0x34')](_0x23e541[_0x1383('0x30')],qs[_0x1383('0x36')](_0x3c788b[_0x1383('0x31')]['fields']));_0x42d63f[_0x1383('0x35')]=_0x42d63f['attributes']['length']?_0x42d63f[_0x1383('0x35')]:_0x23e541[_0x1383('0x30')];if(!_0x3c788b[_0x1383('0x31')]['hasOwnProperty']('nolimit')){_0x42d63f['limit']=qs[_0x1383('0x1e')](_0x3c788b[_0x1383('0x31')][_0x1383('0x1e')]);_0x42d63f['offset']=qs['offset'](_0x3c788b[_0x1383('0x31')][_0x1383('0x1c')]);}_0x42d63f[_0x1383('0x37')]=qs[_0x1383('0x38')](_0x3c788b['query']['sort']);_0x42d63f[_0x1383('0x39')]=qs[_0x1383('0x33')](_[_0x1383('0x3a')](_0x3c788b[_0x1383('0x31')],_0x23e541[_0x1383('0x33')]),_0x15a3c4);if(_0x3c788b[_0x1383('0x31')][_0x1383('0x3b')]){_0x42d63f['where']=_[_0x1383('0x3c')](_0x42d63f['where'],{'$or':_[_0x1383('0x2a')](_0x15a3c4,function(_0x311072){if(_0x311072[_0x1383('0x2e')]!=='VIRTUAL'){var _0x277689={};_0x277689[_0x311072['name']]={'$like':'%'+_0x3c788b['query'][_0x1383('0x3b')]+'%'};return _0x277689;}})});}_0x42d63f=_[_0x1383('0x3c')]({},_0x42d63f,_0x3c788b[_0x1383('0x3d')]);var _0x53bcb0={'where':_0x42d63f[_0x1383('0x39')]};return db[_0x1383('0x2b')][_0x1383('0x3e')](_0x53bcb0)[_0x1383('0x24')](function(_0x56c269){_0x3357e9[_0x1383('0x3e')]=_0x56c269;if(_0x3c788b['query']['includeAll']){_0x42d63f[_0x1383('0x3f')]=[{'all':!![]}];}return db[_0x1383('0x2b')]['findAll'](_0x42d63f);})['then'](function(_0x5ca90f){_0x3357e9[_0x1383('0x40')]=_0x5ca90f;return _0x3357e9;})[_0x1383('0x24')](respondWithFilteredResult(_0xf0037f,_0x42d63f))[_0x1383('0x41')](handleError(_0xf0037f,null));};exports[_0x1383('0x42')]=function(_0x3dea24,_0x3e737a){var _0x12d58d={'raw':!![],'where':{'id':_0x3dea24[_0x1383('0x43')]['id']}},_0x43ac2f={};_0x43ac2f['model']=_[_0x1383('0x32')](db[_0x1383('0x2b')][_0x1383('0x2c')]);_0x43ac2f['query']=_[_0x1383('0x32')](_0x3dea24['query']);_0x43ac2f[_0x1383('0x33')]=_[_0x1383('0x34')](_0x43ac2f[_0x1383('0x30')],_0x43ac2f[_0x1383('0x31')]);_0x12d58d[_0x1383('0x35')]=_[_0x1383('0x34')](_0x43ac2f[_0x1383('0x30')],qs[_0x1383('0x36')](_0x3dea24[_0x1383('0x31')]['fields']));_0x12d58d['attributes']=_0x12d58d['attributes'][_0x1383('0x44')]?_0x12d58d[_0x1383('0x35')]:_0x43ac2f[_0x1383('0x30')];if(_0x3dea24[_0x1383('0x31')][_0x1383('0x45')]){_0x12d58d[_0x1383('0x3f')]=[{'all':!![]}];}_0x12d58d=_['merge']({},_0x12d58d,_0x3dea24[_0x1383('0x3d')]);return db[_0x1383('0x2b')][_0x1383('0x46')](_0x12d58d)['then'](handleEntityNotFound(_0x3e737a,null))[_0x1383('0x24')](respondWithResult(_0x3e737a,null))[_0x1383('0x41')](handleError(_0x3e737a,null));};exports[_0x1383('0x47')]=function(_0x1bc99a,_0x171066){return db['Cdr'][_0x1383('0x47')](_0x1bc99a['body'],{})[_0x1383('0x24')](respondWithResult(_0x171066,0xc9))[_0x1383('0x41')](handleError(_0x171066,null));};exports['update']=function(_0x16c74e,_0x2e41c3){if(_0x16c74e[_0x1383('0x48')]['id']){delete _0x16c74e[_0x1383('0x48')]['id'];}return db[_0x1383('0x2b')][_0x1383('0x46')]({'where':{'id':_0x16c74e[_0x1383('0x43')]['id']}})[_0x1383('0x24')](handleEntityNotFound(_0x2e41c3,null))[_0x1383('0x24')](saveUpdates(_0x16c74e[_0x1383('0x48')],null))['then'](respondWithResult(_0x2e41c3,null))[_0x1383('0x41')](handleError(_0x2e41c3,null));};exports[_0x1383('0x25')]=function(_0x23f8d7,_0x2ac880){return db[_0x1383('0x2b')][_0x1383('0x46')]({'where':{'id':_0x23f8d7[_0x1383('0x43')]['id']}})[_0x1383('0x24')](handleEntityNotFound(_0x2ac880,null))[_0x1383('0x24')](removeEntity(_0x2ac880,null))['catch'](handleError(_0x2ac880,null));};exports[_0x1383('0x49')]=function(_0x228af7,_0x45a3e5){return db['Cdr'][_0x1383('0x49')]()[_0x1383('0x24')](respondWithResult(_0x45a3e5,null))['catch'](handleError(_0x45a3e5,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7f0d19f..6e8abbe 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(_0x233efc,_0x4fa9e6){var _0x2d50d5=function(_0x5b6d57){while(--_0x5b6d57){_0x233efc['push'](_0x233efc['shift']());}};_0x2d50d5(++_0x4fa9e6);}(_0x7a54,0x106));var _0x47a5=function(_0xc755a3,_0x5cfc48){_0xc755a3=_0xc755a3-0x0;var _0x47332c=_0x7a54[_0xc755a3];return _0x47332c;};'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(_0x131578,_0x166d47){var _0x5cda0d=function(_0x527a5f){while(--_0x527a5f){_0x131578['push'](_0x131578['shift']());}};_0x5cda0d(++_0x166d47);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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 cd2eae2..9c22cfd 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 _0xc62c=['result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x240e74,_0x119815){var _0x2a3d80=function(_0x9b48a5){while(--_0x9b48a5){_0x240e74['push'](_0x240e74['shift']());}};_0x2a3d80(++_0x119815);}(_0xc62c,0x15b));var _0xcc62=function(_0xbf608e,_0x354703){_0xbf608e=_0xbf608e-0x0;var _0x9086a5=_0xc62c[_0xbf608e];return _0x9086a5;};'use strict';var _=require(_0xcc62('0x0'));var util=require('util');var moment=require(_0xcc62('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc62('0x2'));var db=require(_0xcc62('0x3'))['db'];var utils=require(_0xcc62('0x4'));var logger=require(_0xcc62('0x5'))(_0xcc62('0x6'));var config=require(_0xcc62('0x7'));var jayson=require(_0xcc62('0x8'));var client=jayson[_0xcc62('0x9')][_0xcc62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d9f58,_0x20cbbb,_0x5d2f4c){return new BPromise(function(_0x689569,_0x35b99a){return client[_0xcc62('0xb')](_0x3d9f58,_0x5d2f4c)[_0xcc62('0xc')](function(_0x467fb9){logger[_0xcc62('0xd')](_0xcc62('0xe'),_0x20cbbb,_0xcc62('0xf'));logger[_0xcc62('0x10')](_0xcc62('0x11'),_0x20cbbb,'request\x20sent',JSON['stringify'](_0x467fb9));if(_0x467fb9['error']){if(_0x467fb9[_0xcc62('0x12')][_0xcc62('0x13')]===0x1f4){logger[_0xcc62('0x12')](_0xcc62('0xe'),_0x20cbbb,_0x467fb9['error']['message']);return _0x35b99a(_0x467fb9[_0xcc62('0x12')]['message']);}logger[_0xcc62('0x12')](_0xcc62('0xe'),_0x20cbbb,_0x467fb9[_0xcc62('0x12')]['message']);return _0x689569(_0x467fb9['error'][_0xcc62('0x14')]);}else{logger[_0xcc62('0xd')](_0xcc62('0xe'),_0x20cbbb,_0xcc62('0xf'));_0x689569(_0x467fb9[_0xcc62('0x15')][_0xcc62('0x14')]);}})[_0xcc62('0x16')](function(_0x3c84be){logger[_0xcc62('0x12')](_0xcc62('0xe'),_0x20cbbb,_0x3c84be);_0x35b99a(_0x3c84be);});});} \ No newline at end of file +var _0xa301=['message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x440813,_0x159ba4){var _0x13fbc4=function(_0x4642be){while(--_0x4642be){_0x440813['push'](_0x440813['shift']());}};_0x13fbc4(++_0x159ba4);}(_0xa301,0x119));var _0x1a30=function(_0x49b5ee,_0x362e84){_0x49b5ee=_0x49b5ee-0x0;var _0x3379af=_0xa301[_0x49b5ee];return _0x3379af;};'use strict';var _=require(_0x1a30('0x0'));var util=require(_0x1a30('0x1'));var moment=require(_0x1a30('0x2'));var BPromise=require(_0x1a30('0x3'));var rs=require(_0x1a30('0x4'));var fs=require('fs');var Redis=require(_0x1a30('0x5'));var db=require(_0x1a30('0x6'))['db'];var utils=require(_0x1a30('0x7'));var logger=require(_0x1a30('0x8'))(_0x1a30('0x9'));var config=require('../../config/environment');var jayson=require(_0x1a30('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fc84c,_0x1a55c7,_0x2418fd){return new BPromise(function(_0x5c1ff9,_0x29bb3b){return client[_0x1a30('0xb')](_0x1fc84c,_0x2418fd)['then'](function(_0x4572dd){logger[_0x1a30('0xc')](_0x1a30('0xd'),_0x1a55c7,_0x1a30('0xe'));logger[_0x1a30('0xf')]('Cdr,\x20%s,\x20%s,\x20%s',_0x1a55c7,_0x1a30('0xe'),JSON[_0x1a30('0x10')](_0x4572dd));if(_0x4572dd[_0x1a30('0x11')]){if(_0x4572dd['error'][_0x1a30('0x12')]===0x1f4){logger[_0x1a30('0x11')](_0x1a30('0xd'),_0x1a55c7,_0x4572dd['error'][_0x1a30('0x13')]);return _0x29bb3b(_0x4572dd[_0x1a30('0x11')][_0x1a30('0x13')]);}logger[_0x1a30('0x11')](_0x1a30('0xd'),_0x1a55c7,_0x4572dd[_0x1a30('0x11')]['message']);return _0x5c1ff9(_0x4572dd['error']['message']);}else{logger['info'](_0x1a30('0xd'),_0x1a55c7,_0x1a30('0xe'));_0x5c1ff9(_0x4572dd['result'][_0x1a30('0x13')]);}})['catch'](function(_0x5dc684){logger[_0x1a30('0x11')](_0x1a30('0xd'),_0x1a55c7,_0x5dc684);_0x29bb3b(_0x5dc684);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 6131395..3a82534 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0xc40b9f,_0x17ec1f){var _0x535b9c=function(_0x591b19){while(--_0x591b19){_0xc40b9f['push'](_0xc40b9f['shift']());}};_0x535b9c(++_0x17ec1f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x43daa8,_0x2b964e){var _0x42a182=function(_0x16a94b){while(--_0x16a94b){_0x43daa8['push'](_0x43daa8['shift']());}};_0x42a182(++_0x2b964e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 20672bc..6ee3df8 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 _0xd02f=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd02f,0x80));var _0xfd02=function(_0x2332e1,_0x433415){_0x2332e1=_0x2332e1-0x0;var _0x2c3bda=_0xd02f[_0x2332e1];return _0x2c3bda;};'use strict';var Sequelize=require(_0xfd02('0x0'));module[_0xfd02('0x1')]={'priority':{'type':Sequelize[_0xfd02('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfd02('0x3')],'allowNull':![],'defaultValue':_0xfd02('0x4')},'appdata':{'type':Sequelize[_0xfd02('0x5')]()},'description':{'type':Sequelize[_0xfd02('0x3')]},'interval':{'type':Sequelize[_0xfd02('0x3')],'defaultValue':_0xfd02('0x6')}}; \ No newline at end of file +var _0x1bc6=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x7cd008,_0x35f2fa){var _0x5cbed1=function(_0x23ba84){while(--_0x23ba84){_0x7cd008['push'](_0x7cd008['shift']());}};_0x5cbed1(++_0x35f2fa);}(_0x1bc6,0x94));var _0x61bc=function(_0x3c953b,_0xdd526a){_0x3c953b=_0x3c953b-0x0;var _0x133793=_0x1bc6[_0x3c953b];return _0x133793;};'use strict';var Sequelize=require(_0x61bc('0x0'));module[_0x61bc('0x1')]={'priority':{'type':Sequelize[_0x61bc('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61bc('0x3')],'allowNull':![],'defaultValue':_0x61bc('0x4')},'appdata':{'type':Sequelize[_0x61bc('0x5')]()},'description':{'type':Sequelize[_0x61bc('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x61bc('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index f8dcdaa..f02615f 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 _0x1be1=['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','end','sendStatus','stack','name','send','show','params','keys','ChatApplication','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','body','catch','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x131d54,_0x4ad89b){var _0x4df77c=function(_0x52d892){while(--_0x52d892){_0x131d54['push'](_0x131d54['shift']());}};_0x4df77c(++_0x4ad89b);}(_0x1be1,0x192));var _0x11be=function(_0x12d2fa,_0x27d8ba){_0x12d2fa=_0x12d2fa-0x0;var _0x220d2c=_0x1be1[_0x12d2fa];return _0x220d2c;};'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(){_0x46b7c2[_0x11be('0x17')](0xcc)[_0x11be('0x23')]();});}};}function handleEntityNotFound(_0x4cb27f,_0x106167){return function(_0x518e2b){if(!_0x518e2b){_0x4cb27f[_0x11be('0x24')](0x194);}return _0x518e2b;};}function handleError(_0x563e01,_0x28310d){_0x28310d=_0x28310d||0x1f4;return function(_0xb11f3d){logger['error'](_0xb11f3d[_0x11be('0x25')]);if(_0xb11f3d[_0x11be('0x26')]){delete _0xb11f3d[_0x11be('0x26')];}_0x563e01[_0x11be('0x17')](_0x28310d)[_0x11be('0x27')](_0xb11f3d);};}exports[_0x11be('0x28')]=function(_0xf5a6ac,_0x2cf9aa){var _0x43ab30={'raw':!![],'where':{'id':_0xf5a6ac[_0x11be('0x29')]['id']}},_0x5966c5={};_0x5966c5['model']=_[_0x11be('0x2a')](db[_0x11be('0x2b')]['rawAttributes']);_0x5966c5['query']=_[_0x11be('0x2a')](_0xf5a6ac[_0x11be('0x2c')]);_0x5966c5[_0x11be('0x2d')]=_[_0x11be('0x2e')](_0x5966c5[_0x11be('0x2f')],_0x5966c5[_0x11be('0x2c')]);_0x43ab30[_0x11be('0x30')]=_[_0x11be('0x2e')](_0x5966c5[_0x11be('0x2f')],qs['fields'](_0xf5a6ac[_0x11be('0x2c')][_0x11be('0x31')]));_0x43ab30[_0x11be('0x30')]=_0x43ab30[_0x11be('0x30')][_0x11be('0x32')]?_0x43ab30[_0x11be('0x30')]:_0x5966c5['model'];if(_0xf5a6ac[_0x11be('0x2c')][_0x11be('0x33')]){_0x43ab30[_0x11be('0x34')]=[{'all':!![]}];}_0x43ab30=_[_0x11be('0x35')]({},_0x43ab30,_0xf5a6ac[_0x11be('0x36')]);return db['ChatApplication'][_0x11be('0x37')](_0x43ab30)[_0x11be('0x22')](handleEntityNotFound(_0x2cf9aa,null))[_0x11be('0x22')](respondWithResult(_0x2cf9aa,null))['catch'](handleError(_0x2cf9aa,null));};exports[_0x11be('0x21')]=function(_0x51ae3a,_0x4c7b47){if(_0x51ae3a['body']['id']){delete _0x51ae3a['body']['id'];}return db[_0x11be('0x2b')][_0x11be('0x37')]({'where':{'id':_0x51ae3a[_0x11be('0x29')]['id']}})['then'](handleEntityNotFound(_0x4c7b47,null))[_0x11be('0x22')](saveUpdates(_0x51ae3a[_0x11be('0x38')],null))['then'](respondWithResult(_0x4c7b47,null))[_0x11be('0x39')](handleError(_0x4c7b47,null));};exports['destroy']=function(_0x222f84,_0x58e702){return db[_0x11be('0x2b')][_0x11be('0x37')]({'where':{'id':_0x222f84[_0x11be('0x29')]['id']}})[_0x11be('0x22')](handleEntityNotFound(_0x58e702,null))['then'](removeEntity(_0x58e702,null))[_0x11be('0x39')](handleError(_0x58e702,null));}; \ No newline at end of file +var _0xbf5c=['options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','params','model','ChatApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','includeAll','include','merge'];(function(_0xf765b6,_0x2033e2){var _0x493102=function(_0x4bc013){while(--_0x4bc013){_0xf765b6['push'](_0xf765b6['shift']());}};_0x493102(++_0x2033e2);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x4c6233,_0x12bc76){_0x4c6233=_0x4c6233-0x0;var _0x1949b4=_0xbf5c[_0x4c6233];return _0x1949b4;};'use strict';var emlformat=require(_0xcbf5('0x0'));var rimraf=require(_0xcbf5('0x1'));var zipdir=require(_0xcbf5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcbf5('0x3'));var moment=require(_0xcbf5('0x4'));var BPromise=require(_0xcbf5('0x5'));var Mustache=require('mustache');var util=require(_0xcbf5('0x6'));var path=require(_0xcbf5('0x7'));var sox=require('sox');var csv=require(_0xcbf5('0x8'));var ejs=require(_0xcbf5('0x9'));var fs=require('fs');var fs_extra=require(_0xcbf5('0xa'));var _=require('lodash');var squel=require(_0xcbf5('0xb'));var crypto=require(_0xcbf5('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcbf5('0x8'));var querystring=require(_0xcbf5('0xd'));var Papa=require(_0xcbf5('0xe'));var Redis=require('ioredis');var authService=require(_0xcbf5('0xf'));var qs=require(_0xcbf5('0x10'));var as=require(_0xcbf5('0x11'));var hardwareService=require(_0xcbf5('0x12'));var logger=require(_0xcbf5('0x13'))(_0xcbf5('0x14'));var utils=require('../../config/utils');var config=require(_0xcbf5('0x15'));var licenseUtil=require(_0xcbf5('0x16'));var db=require(_0xcbf5('0x17'))['db'];function respondWithStatusCode(_0x4a894b,_0x5e5307){_0x5e5307=_0x5e5307||0xcc;return function(_0x18c2fe){if(_0x18c2fe){return _0x4a894b['sendStatus'](_0x5e5307);}return _0x4a894b[_0xcbf5('0x18')](_0x5e5307)[_0xcbf5('0x19')]();};}function respondWithResult(_0x5cbcf6,_0x2e7536){_0x2e7536=_0x2e7536||0xc8;return function(_0x51b1d2){if(_0x51b1d2){return _0x5cbcf6['status'](_0x2e7536)[_0xcbf5('0x1a')](_0x51b1d2);}};}function respondWithFilteredResult(_0x550e21,_0x2c58ba){return function(_0x5348ce){if(_0x5348ce){var _0x4fc535=typeof _0x2c58ba[_0xcbf5('0x1b')]===_0xcbf5('0x1c')&&typeof _0x2c58ba[_0xcbf5('0x1d')]===_0xcbf5('0x1c');var _0x7f2153=_0x5348ce[_0xcbf5('0x1e')];var _0x462d46=_0x4fc535?0x0:_0x2c58ba['offset'];var _0xcf3d18=_0x4fc535?_0x5348ce[_0xcbf5('0x1e')]:_0x2c58ba[_0xcbf5('0x1b')]+_0x2c58ba[_0xcbf5('0x1d')];var _0x269b01;if(_0xcf3d18>=_0x7f2153){_0xcf3d18=_0x7f2153;_0x269b01=0xc8;}else{_0x269b01=0xce;}_0x550e21[_0xcbf5('0x18')](_0x269b01);return _0x550e21[_0xcbf5('0x1f')](_0xcbf5('0x20'),_0x462d46+'-'+_0xcf3d18+'/'+_0x7f2153)['json'](_0x5348ce);}return null;};}function patchUpdates(_0x155147){return function(_0x4e8874){try{jsonpatch[_0xcbf5('0x21')](_0x4e8874,_0x155147,!![]);}catch(_0x4c7b1e){return BPromise[_0xcbf5('0x22')](_0x4c7b1e);}return _0x4e8874[_0xcbf5('0x23')]();};}function saveUpdates(_0x2334f1,_0xf2360){return function(_0x3e9548){if(_0x3e9548){return _0x3e9548[_0xcbf5('0x24')](_0x2334f1)['then'](function(_0x17bbc8){return _0x17bbc8;});}return null;};}function removeEntity(_0x5602fd,_0x965482){return function(_0x1b59d4){if(_0x1b59d4){return _0x1b59d4[_0xcbf5('0x25')]()[_0xcbf5('0x26')](function(){_0x5602fd['status'](0xcc)[_0xcbf5('0x19')]();});}};}function handleEntityNotFound(_0x43e9af,_0x2aa7c){return function(_0x41d465){if(!_0x41d465){_0x43e9af[_0xcbf5('0x27')](0x194);}return _0x41d465;};}function handleError(_0x27557f,_0x149b61){_0x149b61=_0x149b61||0x1f4;return function(_0xe6742){logger['error'](_0xe6742[_0xcbf5('0x28')]);if(_0xe6742[_0xcbf5('0x29')]){delete _0xe6742[_0xcbf5('0x29')];}_0x27557f[_0xcbf5('0x18')](_0x149b61)[_0xcbf5('0x2a')](_0xe6742);};}exports['show']=function(_0x1293ab,_0x367eb0){var _0x9ce00={'raw':!![],'where':{'id':_0x1293ab[_0xcbf5('0x2b')]['id']}},_0x3389a1={};_0x3389a1[_0xcbf5('0x2c')]=_['keys'](db[_0xcbf5('0x2d')][_0xcbf5('0x2e')]);_0x3389a1[_0xcbf5('0x2f')]=_[_0xcbf5('0x30')](_0x1293ab[_0xcbf5('0x2f')]);_0x3389a1[_0xcbf5('0x31')]=_[_0xcbf5('0x32')](_0x3389a1['model'],_0x3389a1['query']);_0x9ce00[_0xcbf5('0x33')]=_['intersection'](_0x3389a1[_0xcbf5('0x2c')],qs[_0xcbf5('0x34')](_0x1293ab[_0xcbf5('0x2f')][_0xcbf5('0x34')]));_0x9ce00[_0xcbf5('0x33')]=_0x9ce00['attributes']['length']?_0x9ce00[_0xcbf5('0x33')]:_0x3389a1[_0xcbf5('0x2c')];if(_0x1293ab[_0xcbf5('0x2f')][_0xcbf5('0x35')]){_0x9ce00[_0xcbf5('0x36')]=[{'all':!![]}];}_0x9ce00=_[_0xcbf5('0x37')]({},_0x9ce00,_0x1293ab[_0xcbf5('0x38')]);return db['ChatApplication'][_0xcbf5('0x39')](_0x9ce00)[_0xcbf5('0x26')](handleEntityNotFound(_0x367eb0,null))[_0xcbf5('0x26')](respondWithResult(_0x367eb0,null))[_0xcbf5('0x3a')](handleError(_0x367eb0,null));};exports['update']=function(_0x4840fe,_0x3e180c){if(_0x4840fe['body']['id']){delete _0x4840fe[_0xcbf5('0x3b')]['id'];}return db[_0xcbf5('0x2d')]['find']({'where':{'id':_0x4840fe['params']['id']}})[_0xcbf5('0x26')](handleEntityNotFound(_0x3e180c,null))[_0xcbf5('0x26')](saveUpdates(_0x4840fe[_0xcbf5('0x3b')],null))[_0xcbf5('0x26')](respondWithResult(_0x3e180c,null))['catch'](handleError(_0x3e180c,null));};exports[_0xcbf5('0x25')]=function(_0x3c70e6,_0x11a8ea){return db[_0xcbf5('0x2d')]['find']({'where':{'id':_0x3c70e6[_0xcbf5('0x2b')]['id']}})[_0xcbf5('0x26')](handleEntityNotFound(_0x11a8ea,null))['then'](removeEntity(_0x11a8ea,null))['catch'](handleError(_0x11a8ea,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 942c160..7cf9994 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 _0xd8df=['ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','request-promise','path','rimraf','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8df,0x163));var _0xfd8d=function(_0x98e599,_0x1e2d07){_0x98e599=_0x98e599-0x0;var _0x5e5dbe=_0xd8df[_0x98e599];return _0x5e5dbe;};'use strict';var _=require(_0xfd8d('0x0'));var util=require(_0xfd8d('0x1'));var logger=require(_0xfd8d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfd8d('0x3'));var fs=require('fs');var path=require(_0xfd8d('0x4'));var rimraf=require(_0xfd8d('0x5'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xfd8d('0x6')]=function(_0x18a1a6,_0x219b7e){return _0x18a1a6[_0xfd8d('0x7')](_0xfd8d('0x8'),attributes,{'tableName':_0xfd8d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfd8d('0xa')});}; \ No newline at end of file +var _0xe1dc=['bluebird','request-promise','rimraf','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x48619d,_0x27276f){var _0x337673=function(_0x1d9fd0){while(--_0x1d9fd0){_0x48619d['push'](_0x48619d['shift']());}};_0x337673(++_0x27276f);}(_0xe1dc,0x8a));var _0xce1d=function(_0x110b75,_0x146dbc){_0x110b75=_0x110b75-0x0;var _0x332394=_0xe1dc[_0x110b75];return _0x332394;};'use strict';var _=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var logger=require(_0xce1d('0x2'))(_0xce1d('0x3'));var moment=require(_0xce1d('0x4'));var BPromise=require(_0xce1d('0x5'));var rp=require(_0xce1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce1d('0x7'));var config=require('../../config/environment');var attributes=require('./chatApplication.attributes');module[_0xce1d('0x8')]=function(_0x232005,_0x2782b7){return _0x232005[_0xce1d('0x9')](_0xce1d('0xa'),attributes,{'tableName':_0xce1d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xce1d('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 4fff472..e57a6f1 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 _0x6743=['../../config/environment','jayson/promise','http','request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x525051,_0x57efe1){var _0x3cd649=function(_0x5b726d){while(--_0x5b726d){_0x525051['push'](_0x525051['shift']());}};_0x3cd649(++_0x57efe1);}(_0x6743,0x100));var _0x3674=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x6743[_0x6a0266];return _0x309e00;};'use strict';var _=require(_0x3674('0x0'));var util=require(_0x3674('0x1'));var moment=require(_0x3674('0x2'));var BPromise=require(_0x3674('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3674('0x4'));var db=require(_0x3674('0x5'))['db'];var utils=require(_0x3674('0x6'));var logger=require(_0x3674('0x7'))('rpc');var config=require(_0x3674('0x8'));var jayson=require(_0x3674('0x9'));var client=jayson['client'][_0x3674('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x148da6,_0x3e4022,_0x53dfa0){return new BPromise(function(_0x2d5aa9,_0x5cacc0){return client[_0x3674('0xb')](_0x148da6,_0x53dfa0)[_0x3674('0xc')](function(_0x510985){logger[_0x3674('0xd')](_0x3674('0xe'),_0x3e4022,_0x3674('0xf'));logger[_0x3674('0x10')](_0x3674('0x11'),_0x3e4022,_0x3674('0xf'),JSON[_0x3674('0x12')](_0x510985));if(_0x510985[_0x3674('0x13')]){if(_0x510985[_0x3674('0x13')][_0x3674('0x14')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x3e4022,_0x510985[_0x3674('0x13')]['message']);return _0x5cacc0(_0x510985[_0x3674('0x13')][_0x3674('0x15')]);}logger[_0x3674('0x13')](_0x3674('0xe'),_0x3e4022,_0x510985['error'][_0x3674('0x15')]);return _0x2d5aa9(_0x510985[_0x3674('0x13')]['message']);}else{logger[_0x3674('0xd')](_0x3674('0xe'),_0x3e4022,_0x3674('0xf'));_0x2d5aa9(_0x510985[_0x3674('0x16')][_0x3674('0x15')]);}})[_0x3674('0x17')](function(_0x324f9c){logger['error']('ChatApplication,\x20%s,\x20%s',_0x3e4022,_0x324f9c);_0x5cacc0(_0x324f9c);});});} \ No newline at end of file +var _0x64ec=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x4f19de,_0x27fbec){var _0x10b304=function(_0x2619ee){while(--_0x2619ee){_0x4f19de['push'](_0x4f19de['shift']());}};_0x10b304(++_0x27fbec);}(_0x64ec,0xfb));var _0xc64e=function(_0x15e9b6,_0x8d872c){_0x15e9b6=_0x15e9b6-0x0;var _0x39a432=_0x64ec[_0x15e9b6];return _0x39a432;};'use strict';var _=require(_0xc64e('0x0'));var util=require(_0xc64e('0x1'));var moment=require(_0xc64e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc64e('0x3'));var db=require(_0xc64e('0x4'))['db'];var utils=require(_0xc64e('0x5'));var logger=require(_0xc64e('0x6'))(_0xc64e('0x7'));var config=require(_0xc64e('0x8'));var jayson=require(_0xc64e('0x9'));var client=jayson[_0xc64e('0xa')][_0xc64e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38b377,_0x3d2eef,_0x32024f){return new BPromise(function(_0x44bc67,_0x46f3c7){return client[_0xc64e('0xc')](_0x38b377,_0x32024f)['then'](function(_0x4e31fc){logger[_0xc64e('0xd')]('ChatApplication,\x20%s,\x20%s',_0x3d2eef,_0xc64e('0xe'));logger[_0xc64e('0xf')](_0xc64e('0x10'),_0x3d2eef,_0xc64e('0xe'),JSON[_0xc64e('0x11')](_0x4e31fc));if(_0x4e31fc[_0xc64e('0x12')]){if(_0x4e31fc[_0xc64e('0x12')][_0xc64e('0x13')]===0x1f4){logger[_0xc64e('0x12')](_0xc64e('0x14'),_0x3d2eef,_0x4e31fc[_0xc64e('0x12')][_0xc64e('0x15')]);return _0x46f3c7(_0x4e31fc[_0xc64e('0x12')]['message']);}logger[_0xc64e('0x12')](_0xc64e('0x14'),_0x3d2eef,_0x4e31fc['error'][_0xc64e('0x15')]);return _0x44bc67(_0x4e31fc[_0xc64e('0x12')][_0xc64e('0x15')]);}else{logger[_0xc64e('0xd')](_0xc64e('0x14'),_0x3d2eef,'request\x20sent');_0x44bc67(_0x4e31fc[_0xc64e('0x16')][_0xc64e('0x15')]);}})['catch'](function(_0x2f9692){logger[_0xc64e('0x12')](_0xc64e('0x14'),_0x3d2eef,_0x2f9692);_0x46f3c7(_0x2f9692);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 6274da6..92b59d4 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 _0x9948=['fs-extra','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','path'];(function(_0x2baf2d,_0x4a2974){var _0x4c0c1d=function(_0xabb949){while(--_0xabb949){_0x2baf2d['push'](_0x2baf2d['shift']());}};_0x4c0c1d(++_0x4a2974);}(_0x9948,0xdc));var _0x8994=function(_0x2b1b89,_0x133d34){_0x2b1b89=_0x2b1b89-0x0;var _0x3b8916=_0x9948[_0x2b1b89];return _0x3b8916;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8994('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8994('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x8994('0x2'));var config=require(_0x8994('0x3'));var controller=require(_0x8994('0x4'));router[_0x8994('0x5')](_0x8994('0x6'),auth[_0x8994('0x7')](),controller[_0x8994('0x8')]);router[_0x8994('0x9')](_0x8994('0x6'),auth['isAuthenticated'](),controller[_0x8994('0xa')]);router['delete'](_0x8994('0x6'),auth['isAuthenticated'](),controller[_0x8994('0xb')]);module[_0x8994('0xc')]=router; \ No newline at end of file +var _0x7f87=['delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','show','put','isAuthenticated','update'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7f87,0x93));var _0x77f8=function(_0x2aba79,_0x167d90){_0x2aba79=_0x2aba79-0x0;var _0x5ac1b9=_0x7f87[_0x2aba79];return _0x5ac1b9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77f8('0x0'));var timeout=require(_0x77f8('0x1'));var express=require(_0x77f8('0x2'));var router=express[_0x77f8('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x77f8('0x4'));var interaction=require(_0x77f8('0x5'));var config=require(_0x77f8('0x6'));var controller=require('./chatApplication.controller');router[_0x77f8('0x7')](_0x77f8('0x8'),auth['isAuthenticated'](),controller[_0x77f8('0x9')]);router[_0x77f8('0xa')](_0x77f8('0x8'),auth[_0x77f8('0xb')](),controller[_0x77f8('0xc')]);router[_0x77f8('0xd')](_0x77f8('0x8'),auth[_0x77f8('0xb')](),controller[_0x77f8('0xe')]);module[_0x77f8('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 132515c..914098c 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 _0x2bad=['BOOLEAN','sequelize','exports','STRING'];(function(_0x20821d,_0x316833){var _0x409cc6=function(_0xb90d26){while(--_0xb90d26){_0x20821d['push'](_0x20821d['shift']());}};_0x409cc6(++_0x316833);}(_0x2bad,0xed));var _0xd2ba=function(_0x3644b9,_0x5cd3a6){_0x3644b9=_0x3644b9-0x0;var _0x4d196d=_0x2bad[_0x3644b9];return _0x4d196d;};'use strict';var Sequelize=require(_0xd2ba('0x0'));module[_0xd2ba('0x1')]={'name':{'type':Sequelize[_0xd2ba('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd2ba('0x2')]},'write':{'type':Sequelize[_0xd2ba('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdab3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x52b750,_0x551e8b){var _0x2aa67a=function(_0x43f785){while(--_0x43f785){_0x52b750['push'](_0x52b750['shift']());}};_0x2aa67a(++_0x551e8b);}(_0xdab3,0xeb));var _0x3dab=function(_0xd4d0b2,_0xae09d5){_0xd4d0b2=_0xd4d0b2-0x0;var _0x43f942=_0xdab3[_0xd4d0b2];return _0x43f942;};'use strict';var Sequelize=require(_0x3dab('0x0'));module[_0x3dab('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x3dab('0x2')]},'write':{'type':Sequelize[_0x3dab('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 4a658f8..c4dd610 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 _0x7538=['omit','ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','getMessages','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','update','destroy','then','error','name','send','map','ChatGroup','rawAttributes','fieldName','type','key','model','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','show','keys','find','create','body','catch','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7538,0x6c));var _0x8753=function(_0x33c1f3,_0x13b859){_0x33c1f3=_0x33c1f3-0x0;var _0x222082=_0x7538[_0x33c1f3];return _0x222082;};'use strict';var emlformat=require(_0x8753('0x0'));var rimraf=require(_0x8753('0x1'));var zipdir=require(_0x8753('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8753('0x3'));var moment=require(_0x8753('0x4'));var BPromise=require(_0x8753('0x5'));var Mustache=require(_0x8753('0x6'));var util=require('util');var path=require(_0x8753('0x7'));var sox=require(_0x8753('0x8'));var csv=require(_0x8753('0x9'));var ejs=require(_0x8753('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8753('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8753('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8753('0xd'));var Papa=require(_0x8753('0xe'));var Redis=require(_0x8753('0xf'));var authService=require(_0x8753('0x10'));var qs=require(_0x8753('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8753('0x12'));var logger=require(_0x8753('0x13'))('api');var utils=require(_0x8753('0x14'));var config=require(_0x8753('0x15'));var licenseUtil=require(_0x8753('0x16'));var db=require('../../mysqldb')['db'];config[_0x8753('0x17')]=_['defaults'](config[_0x8753('0x17')],{'host':_0x8753('0x18'),'port':0x18eb});var socket=require(_0x8753('0x19'))(new Redis(config[_0x8753('0x17')]));require(_0x8753('0x1a'))[_0x8753('0x1b')](socket);function respondWithStatusCode(_0x4ca2d5,_0x165257){_0x165257=_0x165257||0xcc;return function(_0x2b6481){if(_0x2b6481){return _0x4ca2d5[_0x8753('0x1c')](_0x165257);}return _0x4ca2d5['status'](_0x165257)[_0x8753('0x1d')]();};}function respondWithResult(_0x343765,_0x5b83aa){_0x5b83aa=_0x5b83aa||0xc8;return function(_0x80188a){if(_0x80188a){return _0x343765[_0x8753('0x1e')](_0x5b83aa)[_0x8753('0x1f')](_0x80188a);}};}function respondWithFilteredResult(_0x583c9b,_0x23ed5a){return function(_0x3d44d6){if(_0x3d44d6){var _0x533439=typeof _0x23ed5a[_0x8753('0x20')]===_0x8753('0x21')&&typeof _0x23ed5a['limit']==='undefined';var _0x4da8b3=_0x3d44d6[_0x8753('0x22')];var _0x2756bf=_0x533439?0x0:_0x23ed5a[_0x8753('0x20')];var _0x2985e4=_0x533439?_0x3d44d6[_0x8753('0x22')]:_0x23ed5a[_0x8753('0x20')]+_0x23ed5a[_0x8753('0x23')];var _0x2a834c;if(_0x2985e4>=_0x4da8b3){_0x2985e4=_0x4da8b3;_0x2a834c=0xc8;}else{_0x2a834c=0xce;}_0x583c9b[_0x8753('0x1e')](_0x2a834c);return _0x583c9b[_0x8753('0x24')]('Content-Range',_0x2756bf+'-'+_0x2985e4+'/'+_0x4da8b3)[_0x8753('0x1f')](_0x3d44d6);}return null;};}function patchUpdates(_0x6ed567){return function(_0x348318){try{jsonpatch[_0x8753('0x25')](_0x348318,_0x6ed567,!![]);}catch(_0x5a8a88){return BPromise['reject'](_0x5a8a88);}return _0x348318['save']();};}function saveUpdates(_0x5da4f1,_0x3631f6){return function(_0x125476){if(_0x125476){return _0x125476[_0x8753('0x26')](_0x5da4f1)['then'](function(_0x3d7c87){return _0x3d7c87;});}return null;};}function removeEntity(_0x559ce4,_0x6bdfe){return function(_0x2026eb){if(_0x2026eb){return _0x2026eb[_0x8753('0x27')]()[_0x8753('0x28')](function(){_0x559ce4[_0x8753('0x1e')](0xcc)[_0x8753('0x1d')]();});}};}function handleEntityNotFound(_0x5ea825,_0x2460c6){return function(_0x5091f2){if(!_0x5091f2){_0x5ea825[_0x8753('0x1c')](0x194);}return _0x5091f2;};}function handleError(_0x50b51b,_0xaf0554){_0xaf0554=_0xaf0554||0x1f4;return function(_0x218361){logger[_0x8753('0x29')](_0x218361['stack']);if(_0x218361['name']){delete _0x218361[_0x8753('0x2a')];}_0x50b51b['status'](_0xaf0554)[_0x8753('0x2b')](_0x218361);};}exports['index']=function(_0x2835e9,_0x47935f){var _0x515a6c={},_0x1a6bf0={},_0x50fcc6={'count':0x0,'rows':[]};var _0x2977c1=_[_0x8753('0x2c')](db[_0x8753('0x2d')][_0x8753('0x2e')],function(_0x2dcc5d){return{'name':_0x2dcc5d[_0x8753('0x2f')],'type':_0x2dcc5d[_0x8753('0x30')][_0x8753('0x31')]};});_0x1a6bf0[_0x8753('0x32')]=_['map'](_0x2977c1,_0x8753('0x2a'));_0x1a6bf0['query']=_['keys'](_0x2835e9['query']);_0x1a6bf0[_0x8753('0x33')]=_[_0x8753('0x34')](_0x1a6bf0['model'],_0x1a6bf0[_0x8753('0x35')]);_0x515a6c['attributes']=_['intersection'](_0x1a6bf0[_0x8753('0x32')],qs['fields'](_0x2835e9[_0x8753('0x35')][_0x8753('0x36')]));_0x515a6c[_0x8753('0x37')]=_0x515a6c['attributes'][_0x8753('0x38')]?_0x515a6c[_0x8753('0x37')]:_0x1a6bf0['model'];if(!_0x2835e9['query'][_0x8753('0x39')](_0x8753('0x3a'))){_0x515a6c['limit']=qs[_0x8753('0x23')](_0x2835e9['query'][_0x8753('0x23')]);_0x515a6c[_0x8753('0x20')]=qs[_0x8753('0x20')](_0x2835e9[_0x8753('0x35')][_0x8753('0x20')]);}_0x515a6c['order']=qs[_0x8753('0x3b')](_0x2835e9['query'][_0x8753('0x3b')]);_0x515a6c['where']=qs['filters'](_[_0x8753('0x3c')](_0x2835e9[_0x8753('0x35')],_0x1a6bf0[_0x8753('0x33')]),_0x2977c1);if(_0x2835e9['query'][_0x8753('0x3d')]){_0x515a6c[_0x8753('0x3e')]=_[_0x8753('0x3f')](_0x515a6c[_0x8753('0x3e')],{'$or':_[_0x8753('0x2c')](_0x2977c1,function(_0x121294){if(_0x121294['type']!=='VIRTUAL'){var _0x3006c8={};_0x3006c8[_0x121294[_0x8753('0x2a')]]={'$like':'%'+_0x2835e9['query'][_0x8753('0x3d')]+'%'};return _0x3006c8;}})});}_0x515a6c=_['merge']({},_0x515a6c,_0x2835e9[_0x8753('0x40')]);var _0x1ae9f6={'where':_0x515a6c[_0x8753('0x3e')]};return db[_0x8753('0x2d')][_0x8753('0x22')](_0x1ae9f6)[_0x8753('0x28')](function(_0xa3b820){_0x50fcc6[_0x8753('0x22')]=_0xa3b820;if(_0x2835e9[_0x8753('0x35')][_0x8753('0x41')]){_0x515a6c[_0x8753('0x42')]=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x515a6c);})[_0x8753('0x28')](function(_0x3887ac){_0x50fcc6['rows']=_0x3887ac;return _0x50fcc6;})[_0x8753('0x28')](respondWithFilteredResult(_0x47935f,_0x515a6c))['catch'](handleError(_0x47935f,null));};exports[_0x8753('0x43')]=function(_0x573e5d,_0x59c1aa){var _0x70ddea={'raw':!![],'where':{'id':_0x573e5d['params']['id']}},_0x1f7ed7={};_0x1f7ed7[_0x8753('0x32')]=_[_0x8753('0x44')](db[_0x8753('0x2d')][_0x8753('0x2e')]);_0x1f7ed7[_0x8753('0x35')]=_[_0x8753('0x44')](_0x573e5d[_0x8753('0x35')]);_0x1f7ed7[_0x8753('0x33')]=_['intersection'](_0x1f7ed7[_0x8753('0x32')],_0x1f7ed7[_0x8753('0x35')]);_0x70ddea[_0x8753('0x37')]=_['intersection'](_0x1f7ed7[_0x8753('0x32')],qs[_0x8753('0x36')](_0x573e5d['query']['fields']));_0x70ddea[_0x8753('0x37')]=_0x70ddea[_0x8753('0x37')][_0x8753('0x38')]?_0x70ddea[_0x8753('0x37')]:_0x1f7ed7[_0x8753('0x32')];if(_0x573e5d[_0x8753('0x35')]['includeAll']){_0x70ddea[_0x8753('0x42')]=[{'all':!![]}];}_0x70ddea=_[_0x8753('0x3f')]({},_0x70ddea,_0x573e5d[_0x8753('0x40')]);return db[_0x8753('0x2d')][_0x8753('0x45')](_0x70ddea)[_0x8753('0x28')](handleEntityNotFound(_0x59c1aa,null))[_0x8753('0x28')](respondWithResult(_0x59c1aa,null))['catch'](handleError(_0x59c1aa,null));};exports[_0x8753('0x46')]=function(_0x312433,_0x164aaa){return db[_0x8753('0x2d')]['create'](_0x312433[_0x8753('0x47')],{})[_0x8753('0x28')](respondWithResult(_0x164aaa,0xc9))['catch'](handleError(_0x164aaa,null));};exports[_0x8753('0x26')]=function(_0x1a3e1c,_0x885d70){if(_0x1a3e1c[_0x8753('0x47')]['id']){delete _0x1a3e1c['body']['id'];}return db[_0x8753('0x2d')][_0x8753('0x45')]({'where':{'id':_0x1a3e1c['params']['id']}})[_0x8753('0x28')](handleEntityNotFound(_0x885d70,null))[_0x8753('0x28')](saveUpdates(_0x1a3e1c['body'],null))[_0x8753('0x28')](respondWithResult(_0x885d70,null))[_0x8753('0x48')](handleError(_0x885d70,null));};exports[_0x8753('0x27')]=function(_0x2e4e04,_0x5a3798){return db['ChatGroup'][_0x8753('0x45')]({'where':{'id':_0x2e4e04[_0x8753('0x49')]['id']}})[_0x8753('0x28')](handleEntityNotFound(_0x5a3798,null))[_0x8753('0x28')](removeEntity(_0x5a3798,null))[_0x8753('0x48')](handleError(_0x5a3798,null));};exports[_0x8753('0x4a')]=function(_0x211523,_0x2cde6c){return db['ChatGroup']['describe']()[_0x8753('0x28')](respondWithResult(_0x2cde6c,null))['catch'](handleError(_0x2cde6c,null));};exports[_0x8753('0x4b')]=function(_0x378c2d,_0x372e09,_0x31477a){return db[_0x8753('0x4c')]['count']({'where':{'ChatGroupId':_0x378c2d['params']['id'],'ToId':_0x378c2d[_0x8753('0x4d')]['id'],'read':![]}})['then'](function(_0x297afa){return{'id':_[_0x8753('0x4e')](_0x378c2d[_0x8753('0x49')]['id']),'count':_0x297afa};})[_0x8753('0x28')](respondWithResult(_0x372e09,null))[_0x8753('0x48')](handleError(_0x372e09,null));};exports[_0x8753('0x4f')]=function(_0x13b9e0,_0x3338ac,_0x2d1a49){return db[_0x8753('0x2d')][_0x8753('0x45')]({'where':{'id':_0x13b9e0[_0x8753('0x49')]['id']}})[_0x8753('0x28')](handleEntityNotFound(_0x3338ac,null))['then'](function(_0x3cecb2){if(_0x3cecb2){return _0x3cecb2[_0x8753('0x4f')](_0x13b9e0[_0x8753('0x47')]['ids'],_[_0x8753('0x50')](_0x13b9e0[_0x8753('0x47')],[_0x8753('0x51'),'id'])||{});}})[_0x8753('0x28')](respondWithResult(_0x3338ac,null))[_0x8753('0x48')](handleError(_0x3338ac,null));};exports[_0x8753('0x52')]=function(_0x57f06c,_0x579312,_0x4d9854){var _0x1184f3={};var _0xda2735={};var _0xf05de4;var _0x31f878;return db['ChatGroup'][_0x8753('0x53')]({'where':{'id':_0x57f06c[_0x8753('0x49')]['id']}})['then'](handleEntityNotFound(_0x579312,null))[_0x8753('0x28')](function(_0x40031e){if(_0x40031e){_0xf05de4=_0x40031e;_0xda2735[_0x8753('0x32')]=_[_0x8753('0x44')](db[_0x8753('0x54')][_0x8753('0x2e')]);_0xda2735[_0x8753('0x35')]=_[_0x8753('0x44')](_0x57f06c[_0x8753('0x35')]);_0xda2735[_0x8753('0x33')]=_['intersection'](_0xda2735[_0x8753('0x32')],_0xda2735[_0x8753('0x35')]);_0x1184f3[_0x8753('0x37')]=_['intersection'](_0xda2735[_0x8753('0x32')],qs[_0x8753('0x36')](_0x57f06c['query'][_0x8753('0x36')]));_0x1184f3[_0x8753('0x37')]=_0x1184f3['attributes']['length']?_0x1184f3['attributes']:_0xda2735[_0x8753('0x32')];_0x1184f3['order']=qs[_0x8753('0x3b')](_0x57f06c[_0x8753('0x35')][_0x8753('0x3b')]);_0x1184f3[_0x8753('0x3e')]=qs[_0x8753('0x33')](_[_0x8753('0x3c')](_0x57f06c['query'],_0xda2735['filters']));if(_0x57f06c[_0x8753('0x35')][_0x8753('0x3d')]){_0x1184f3[_0x8753('0x3e')]=_[_0x8753('0x3f')](_0x1184f3['where'],{'$or':_[_0x8753('0x2c')](_0x1184f3[_0x8753('0x37')],function(_0xdaa23d){var _0x9a89ac={};_0x9a89ac[_0xdaa23d]={'$like':'%'+_0x57f06c[_0x8753('0x35')][_0x8753('0x3d')]+'%'};return _0x9a89ac;})});}_0x1184f3=_[_0x8753('0x3f')]({},_0x1184f3,_0x57f06c[_0x8753('0x40')]);return _0xf05de4['getMembers'](_0x1184f3);}})['then'](function(_0x4e92e0){if(_0x4e92e0){_0x31f878=_0x4e92e0['length'];if(!_0x57f06c[_0x8753('0x35')]['hasOwnProperty'](_0x8753('0x3a'))){_0x1184f3[_0x8753('0x23')]=qs[_0x8753('0x23')](_0x57f06c[_0x8753('0x35')]['limit']);_0x1184f3[_0x8753('0x20')]=qs[_0x8753('0x20')](_0x57f06c[_0x8753('0x35')][_0x8753('0x20')]);}return _0xf05de4[_0x8753('0x52')](_0x1184f3);}})[_0x8753('0x28')](function(_0x2548c){if(_0x2548c){return _0x2548c?{'count':_0x31f878,'rows':_0x2548c}:null;}})[_0x8753('0x28')](respondWithResult(_0x579312,null))[_0x8753('0x48')](handleError(_0x579312,null));};exports[_0x8753('0x55')]=function(_0x170fc6,_0x3c56c9,_0x54e11b){return db['ChatGroup'][_0x8753('0x45')]({'where':{'id':_0x170fc6[_0x8753('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c56c9,null))['then'](function(_0x58dc9c){if(_0x58dc9c){return _0x58dc9c[_0x8753('0x55')](_0x170fc6['query'][_0x8753('0x51')]);}})[_0x8753('0x28')](respondWithStatusCode(_0x3c56c9,null))[_0x8753('0x48')](handleError(_0x3c56c9,null));};exports[_0x8753('0x56')]=function(_0x4aaa8f,_0x1fc4d9,_0x9a7638){if(_0x4aaa8f[_0x8753('0x47')]['id']){delete _0x4aaa8f[_0x8753('0x47')]['id'];}return db[_0x8753('0x2d')][_0x8753('0x45')]({'where':{'id':_0x4aaa8f[_0x8753('0x49')]['id']}})[_0x8753('0x28')](handleEntityNotFound(_0x1fc4d9,null))['then'](function(_0x5de353){if(_0x5de353){_0x4aaa8f[_0x8753('0x47')][_0x8753('0x57')]=_0x5de353['id'];return db[_0x8753('0x4c')]['create'](_0x4aaa8f['body']);}})[_0x8753('0x28')](respondWithResult(_0x1fc4d9,null))[_0x8753('0x48')](handleError(_0x1fc4d9,null));};exports[_0x8753('0x58')]=function(_0x2cae4d,_0x3e44ab,_0xbff884){var _0x22de04={};var _0x53ed88={};var _0x1ff812;var _0x427575;return db[_0x8753('0x2d')][_0x8753('0x53')]({'where':{'id':_0x2cae4d[_0x8753('0x49')]['id']}})[_0x8753('0x28')](handleEntityNotFound(_0x3e44ab,null))['then'](function(_0x21e321){if(_0x21e321){_0x1ff812=_0x21e321;_0x53ed88[_0x8753('0x32')]=_[_0x8753('0x44')](db[_0x8753('0x4c')][_0x8753('0x2e')]);_0x53ed88[_0x8753('0x35')]=_['keys'](_0x2cae4d[_0x8753('0x35')]);_0x53ed88[_0x8753('0x33')]=_['intersection'](_0x53ed88[_0x8753('0x32')],_0x53ed88[_0x8753('0x35')]);_0x22de04[_0x8753('0x37')]=_[_0x8753('0x34')](_0x53ed88[_0x8753('0x32')],qs['fields'](_0x2cae4d['query'][_0x8753('0x36')]));_0x22de04['attributes']=_0x22de04[_0x8753('0x37')][_0x8753('0x38')]?_0x22de04[_0x8753('0x37')]:_0x53ed88[_0x8753('0x32')];_0x22de04[_0x8753('0x59')]=qs[_0x8753('0x3b')](_0x2cae4d[_0x8753('0x35')][_0x8753('0x3b')]);_0x22de04[_0x8753('0x3e')]=qs['filters'](_[_0x8753('0x3c')](_0x2cae4d['query'],_0x53ed88[_0x8753('0x33')]));if(_0x2cae4d[_0x8753('0x35')]['filter']){_0x22de04[_0x8753('0x3e')]=_['merge'](_0x22de04['where'],{'$or':_['map'](_0x22de04[_0x8753('0x37')],function(_0x2b9e0b){var _0x58c264={};_0x58c264[_0x2b9e0b]={'$like':'%'+_0x2cae4d[_0x8753('0x35')][_0x8753('0x3d')]+'%'};return _0x58c264;})});}if(_0x2cae4d['query']['$gte']){var _0x48f73e=_0x2cae4d[_0x8753('0x35')][_0x8753('0x5a')][_0x8753('0x5b')](',');var _0x251d7={};_0x251d7[_0x48f73e[0x0]]={'$gte':moment(_0x48f73e[0x1])[_0x8753('0x5c')](_0x8753('0x5d'))};_0x22de04[_0x8753('0x3e')]=_[_0x8753('0x3f')](_0x22de04[_0x8753('0x3e')],_0x251d7);}_0x22de04=_[_0x8753('0x3f')]({},_0x22de04,_0x2cae4d[_0x8753('0x40')]);return _0x1ff812[_0x8753('0x58')](_0x22de04);}})[_0x8753('0x28')](function(_0x44746d){if(_0x44746d){_0x427575=_0x44746d['length'];if(!_0x2cae4d[_0x8753('0x35')][_0x8753('0x39')]('nolimit')){_0x22de04['limit']=qs[_0x8753('0x23')](_0x2cae4d[_0x8753('0x35')][_0x8753('0x23')]);_0x22de04[_0x8753('0x20')]=qs[_0x8753('0x20')](_0x2cae4d[_0x8753('0x35')][_0x8753('0x20')]);}return _0x1ff812['getMessages'](_0x22de04);}})[_0x8753('0x28')](function(_0x4e03aa){if(_0x4e03aa){return _0x4e03aa?{'count':_0x427575,'rows':_0x4e03aa}:null;}})[_0x8753('0x28')](respondWithResult(_0x3e44ab,null))[_0x8753('0x48')](handleError(_0x3e44ab,null));}; \ No newline at end of file +var _0x9060=['bluebird','util','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','ChatGroup','includeAll','findAll','rows','catch','params','include','options','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','omit','getMembers','findOne','hasOwnProperty','removeMembers','addMessage','ChatInternalMessage','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','moment'];(function(_0x415c63,_0x72e8d8){var _0x479b50=function(_0x18eeca){while(--_0x18eeca){_0x415c63['push'](_0x415c63['shift']());}};_0x479b50(++_0x72e8d8);}(_0x9060,0x111));var _0x0906=function(_0x4c0622,_0x5dacaf){_0x4c0622=_0x4c0622-0x0;var _0x1799d8=_0x9060[_0x4c0622];return _0x1799d8;};'use strict';var emlformat=require(_0x0906('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0906('0x1'));var rp=require('request-promise');var moment=require(_0x0906('0x2'));var BPromise=require(_0x0906('0x3'));var Mustache=require('mustache');var util=require(_0x0906('0x4'));var path=require('path');var sox=require(_0x0906('0x5'));var csv=require(_0x0906('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0906('0x7'));var _=require('lodash');var squel=require(_0x0906('0x8'));var crypto=require('crypto');var jsforce=require(_0x0906('0x9'));var deskjs=require(_0x0906('0xa'));var toCsv=require(_0x0906('0x6'));var querystring=require(_0x0906('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0906('0xc'));var qs=require(_0x0906('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0906('0xe'));var logger=require('../../config/logger')(_0x0906('0xf'));var utils=require(_0x0906('0x10'));var config=require(_0x0906('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0906('0x12')]=_[_0x0906('0x13')](config[_0x0906('0x12')],{'host':_0x0906('0x14'),'port':0x18eb});var socket=require(_0x0906('0x15'))(new Redis(config[_0x0906('0x12')]));require(_0x0906('0x16'))[_0x0906('0x17')](socket);function respondWithStatusCode(_0x5782d8,_0x388ec8){_0x388ec8=_0x388ec8||0xcc;return function(_0x3fd62e){if(_0x3fd62e){return _0x5782d8[_0x0906('0x18')](_0x388ec8);}return _0x5782d8[_0x0906('0x19')](_0x388ec8)[_0x0906('0x1a')]();};}function respondWithResult(_0x32a54c,_0x223d4c){_0x223d4c=_0x223d4c||0xc8;return function(_0xba0dbc){if(_0xba0dbc){return _0x32a54c[_0x0906('0x19')](_0x223d4c)[_0x0906('0x1b')](_0xba0dbc);}};}function respondWithFilteredResult(_0x2f1772,_0x5cbc8a){return function(_0x160e7b){if(_0x160e7b){var _0x50c45a=typeof _0x5cbc8a[_0x0906('0x1c')]===_0x0906('0x1d')&&typeof _0x5cbc8a[_0x0906('0x1e')]===_0x0906('0x1d');var _0x2a011d=_0x160e7b[_0x0906('0x1f')];var _0x2b2446=_0x50c45a?0x0:_0x5cbc8a['offset'];var _0x3386f4=_0x50c45a?_0x160e7b['count']:_0x5cbc8a[_0x0906('0x1c')]+_0x5cbc8a[_0x0906('0x1e')];var _0x3d86a6;if(_0x3386f4>=_0x2a011d){_0x3386f4=_0x2a011d;_0x3d86a6=0xc8;}else{_0x3d86a6=0xce;}_0x2f1772['status'](_0x3d86a6);return _0x2f1772[_0x0906('0x20')]('Content-Range',_0x2b2446+'-'+_0x3386f4+'/'+_0x2a011d)[_0x0906('0x1b')](_0x160e7b);}return null;};}function patchUpdates(_0x834c0){return function(_0x296aa3){try{jsonpatch[_0x0906('0x21')](_0x296aa3,_0x834c0,!![]);}catch(_0x4daf76){return BPromise[_0x0906('0x22')](_0x4daf76);}return _0x296aa3[_0x0906('0x23')]();};}function saveUpdates(_0x39c3c6,_0x5a678a){return function(_0x37b5b6){if(_0x37b5b6){return _0x37b5b6[_0x0906('0x24')](_0x39c3c6)[_0x0906('0x25')](function(_0x5b04c9){return _0x5b04c9;});}return null;};}function removeEntity(_0x2f0411,_0x4868cf){return function(_0x1633eb){if(_0x1633eb){return _0x1633eb['destroy']()[_0x0906('0x25')](function(){_0x2f0411[_0x0906('0x19')](0xcc)[_0x0906('0x1a')]();});}};}function handleEntityNotFound(_0x599193,_0x2f59a6){return function(_0x3c1c2d){if(!_0x3c1c2d){_0x599193[_0x0906('0x18')](0x194);}return _0x3c1c2d;};}function handleError(_0x5604a8,_0x2091fa){_0x2091fa=_0x2091fa||0x1f4;return function(_0x47dcb8){logger[_0x0906('0x26')](_0x47dcb8[_0x0906('0x27')]);if(_0x47dcb8[_0x0906('0x28')]){delete _0x47dcb8[_0x0906('0x28')];}_0x5604a8['status'](_0x2091fa)['send'](_0x47dcb8);};}exports[_0x0906('0x29')]=function(_0x1f95f,_0x3c6161){var _0x1cdaef={},_0x589410={},_0x58b2f2={'count':0x0,'rows':[]};var _0x1b9b56=_['map'](db['ChatGroup'][_0x0906('0x2a')],function(_0x1adfee){return{'name':_0x1adfee[_0x0906('0x2b')],'type':_0x1adfee[_0x0906('0x2c')][_0x0906('0x2d')]};});_0x589410[_0x0906('0x2e')]=_[_0x0906('0x2f')](_0x1b9b56,_0x0906('0x28'));_0x589410[_0x0906('0x30')]=_[_0x0906('0x31')](_0x1f95f[_0x0906('0x30')]);_0x589410[_0x0906('0x32')]=_[_0x0906('0x33')](_0x589410['model'],_0x589410['query']);_0x1cdaef[_0x0906('0x34')]=_[_0x0906('0x33')](_0x589410[_0x0906('0x2e')],qs[_0x0906('0x35')](_0x1f95f[_0x0906('0x30')][_0x0906('0x35')]));_0x1cdaef['attributes']=_0x1cdaef[_0x0906('0x34')][_0x0906('0x36')]?_0x1cdaef[_0x0906('0x34')]:_0x589410[_0x0906('0x2e')];if(!_0x1f95f['query']['hasOwnProperty'](_0x0906('0x37'))){_0x1cdaef['limit']=qs[_0x0906('0x1e')](_0x1f95f[_0x0906('0x30')][_0x0906('0x1e')]);_0x1cdaef[_0x0906('0x1c')]=qs[_0x0906('0x1c')](_0x1f95f[_0x0906('0x30')][_0x0906('0x1c')]);}_0x1cdaef[_0x0906('0x38')]=qs[_0x0906('0x39')](_0x1f95f[_0x0906('0x30')]['sort']);_0x1cdaef['where']=qs[_0x0906('0x32')](_[_0x0906('0x3a')](_0x1f95f[_0x0906('0x30')],_0x589410[_0x0906('0x32')]),_0x1b9b56);if(_0x1f95f['query']['filter']){_0x1cdaef[_0x0906('0x3b')]=_[_0x0906('0x3c')](_0x1cdaef[_0x0906('0x3b')],{'$or':_[_0x0906('0x2f')](_0x1b9b56,function(_0x343615){if(_0x343615[_0x0906('0x2c')]!==_0x0906('0x3d')){var _0x34b9d9={};_0x34b9d9[_0x343615[_0x0906('0x28')]]={'$like':'%'+_0x1f95f['query'][_0x0906('0x3e')]+'%'};return _0x34b9d9;}})});}_0x1cdaef=_[_0x0906('0x3c')]({},_0x1cdaef,_0x1f95f['options']);var _0x51bfad={'where':_0x1cdaef[_0x0906('0x3b')]};return db[_0x0906('0x3f')][_0x0906('0x1f')](_0x51bfad)['then'](function(_0x39e3b9){_0x58b2f2[_0x0906('0x1f')]=_0x39e3b9;if(_0x1f95f['query'][_0x0906('0x40')]){_0x1cdaef['include']=[{'all':!![]}];}return db[_0x0906('0x3f')][_0x0906('0x41')](_0x1cdaef);})['then'](function(_0x34615c){_0x58b2f2[_0x0906('0x42')]=_0x34615c;return _0x58b2f2;})[_0x0906('0x25')](respondWithFilteredResult(_0x3c6161,_0x1cdaef))[_0x0906('0x43')](handleError(_0x3c6161,null));};exports['show']=function(_0x596307,_0x47c5ed){var _0x6ba49a={'raw':!![],'where':{'id':_0x596307[_0x0906('0x44')]['id']}},_0x5c7606={};_0x5c7606[_0x0906('0x2e')]=_[_0x0906('0x31')](db[_0x0906('0x3f')][_0x0906('0x2a')]);_0x5c7606['query']=_[_0x0906('0x31')](_0x596307[_0x0906('0x30')]);_0x5c7606[_0x0906('0x32')]=_['intersection'](_0x5c7606['model'],_0x5c7606[_0x0906('0x30')]);_0x6ba49a[_0x0906('0x34')]=_[_0x0906('0x33')](_0x5c7606[_0x0906('0x2e')],qs['fields'](_0x596307[_0x0906('0x30')][_0x0906('0x35')]));_0x6ba49a[_0x0906('0x34')]=_0x6ba49a['attributes']['length']?_0x6ba49a[_0x0906('0x34')]:_0x5c7606[_0x0906('0x2e')];if(_0x596307['query'][_0x0906('0x40')]){_0x6ba49a[_0x0906('0x45')]=[{'all':!![]}];}_0x6ba49a=_['merge']({},_0x6ba49a,_0x596307[_0x0906('0x46')]);return db[_0x0906('0x3f')][_0x0906('0x47')](_0x6ba49a)[_0x0906('0x25')](handleEntityNotFound(_0x47c5ed,null))[_0x0906('0x25')](respondWithResult(_0x47c5ed,null))[_0x0906('0x43')](handleError(_0x47c5ed,null));};exports[_0x0906('0x48')]=function(_0x2c7260,_0x202f26){return db[_0x0906('0x3f')]['create'](_0x2c7260[_0x0906('0x49')],{})['then'](respondWithResult(_0x202f26,0xc9))[_0x0906('0x43')](handleError(_0x202f26,null));};exports[_0x0906('0x24')]=function(_0x2b683a,_0x529169){if(_0x2b683a[_0x0906('0x49')]['id']){delete _0x2b683a[_0x0906('0x49')]['id'];}return db[_0x0906('0x3f')][_0x0906('0x47')]({'where':{'id':_0x2b683a['params']['id']}})[_0x0906('0x25')](handleEntityNotFound(_0x529169,null))[_0x0906('0x25')](saveUpdates(_0x2b683a[_0x0906('0x49')],null))['then'](respondWithResult(_0x529169,null))[_0x0906('0x43')](handleError(_0x529169,null));};exports['destroy']=function(_0xd11596,_0x111fc7){return db[_0x0906('0x3f')]['find']({'where':{'id':_0xd11596[_0x0906('0x44')]['id']}})['then'](handleEntityNotFound(_0x111fc7,null))['then'](removeEntity(_0x111fc7,null))[_0x0906('0x43')](handleError(_0x111fc7,null));};exports[_0x0906('0x4a')]=function(_0x4459ef,_0x5f0b18){return db[_0x0906('0x3f')][_0x0906('0x4a')]()[_0x0906('0x25')](respondWithResult(_0x5f0b18,null))[_0x0906('0x43')](handleError(_0x5f0b18,null));};exports[_0x0906('0x4b')]=function(_0x28373f,_0x53091c,_0x445da8){return db['ChatInternalMessage'][_0x0906('0x1f')]({'where':{'ChatGroupId':_0x28373f[_0x0906('0x44')]['id'],'ToId':_0x28373f[_0x0906('0x4c')]['id'],'read':![]}})[_0x0906('0x25')](function(_0x23459f){return{'id':_[_0x0906('0x4d')](_0x28373f[_0x0906('0x44')]['id']),'count':_0x23459f};})[_0x0906('0x25')](respondWithResult(_0x53091c,null))['catch'](handleError(_0x53091c,null));};exports[_0x0906('0x4e')]=function(_0x103e7c,_0x4afa17,_0x15e30d){return db[_0x0906('0x3f')][_0x0906('0x47')]({'where':{'id':_0x103e7c[_0x0906('0x44')]['id']}})[_0x0906('0x25')](handleEntityNotFound(_0x4afa17,null))[_0x0906('0x25')](function(_0x58464c){if(_0x58464c){return _0x58464c[_0x0906('0x4e')](_0x103e7c[_0x0906('0x49')][_0x0906('0x4f')],_[_0x0906('0x50')](_0x103e7c[_0x0906('0x49')],['ids','id'])||{});}})[_0x0906('0x25')](respondWithResult(_0x4afa17,null))[_0x0906('0x43')](handleError(_0x4afa17,null));};exports[_0x0906('0x51')]=function(_0xc9cc25,_0x357242,_0x250d36){var _0x32eead={};var _0x106dbe={};var _0x459b00;var _0xb52234;return db[_0x0906('0x3f')][_0x0906('0x52')]({'where':{'id':_0xc9cc25[_0x0906('0x44')]['id']}})[_0x0906('0x25')](handleEntityNotFound(_0x357242,null))[_0x0906('0x25')](function(_0x37efe3){if(_0x37efe3){_0x459b00=_0x37efe3;_0x106dbe[_0x0906('0x2e')]=_[_0x0906('0x31')](db['User'][_0x0906('0x2a')]);_0x106dbe[_0x0906('0x30')]=_[_0x0906('0x31')](_0xc9cc25[_0x0906('0x30')]);_0x106dbe[_0x0906('0x32')]=_['intersection'](_0x106dbe[_0x0906('0x2e')],_0x106dbe[_0x0906('0x30')]);_0x32eead[_0x0906('0x34')]=_['intersection'](_0x106dbe[_0x0906('0x2e')],qs[_0x0906('0x35')](_0xc9cc25[_0x0906('0x30')][_0x0906('0x35')]));_0x32eead[_0x0906('0x34')]=_0x32eead[_0x0906('0x34')][_0x0906('0x36')]?_0x32eead[_0x0906('0x34')]:_0x106dbe[_0x0906('0x2e')];_0x32eead['order']=qs[_0x0906('0x39')](_0xc9cc25[_0x0906('0x30')]['sort']);_0x32eead['where']=qs[_0x0906('0x32')](_[_0x0906('0x3a')](_0xc9cc25[_0x0906('0x30')],_0x106dbe[_0x0906('0x32')]));if(_0xc9cc25[_0x0906('0x30')][_0x0906('0x3e')]){_0x32eead[_0x0906('0x3b')]=_[_0x0906('0x3c')](_0x32eead[_0x0906('0x3b')],{'$or':_[_0x0906('0x2f')](_0x32eead['attributes'],function(_0x26d645){var _0x100a83={};_0x100a83[_0x26d645]={'$like':'%'+_0xc9cc25['query'][_0x0906('0x3e')]+'%'};return _0x100a83;})});}_0x32eead=_[_0x0906('0x3c')]({},_0x32eead,_0xc9cc25[_0x0906('0x46')]);return _0x459b00[_0x0906('0x51')](_0x32eead);}})[_0x0906('0x25')](function(_0x341f3a){if(_0x341f3a){_0xb52234=_0x341f3a['length'];if(!_0xc9cc25[_0x0906('0x30')][_0x0906('0x53')](_0x0906('0x37'))){_0x32eead['limit']=qs['limit'](_0xc9cc25[_0x0906('0x30')][_0x0906('0x1e')]);_0x32eead[_0x0906('0x1c')]=qs['offset'](_0xc9cc25[_0x0906('0x30')][_0x0906('0x1c')]);}return _0x459b00[_0x0906('0x51')](_0x32eead);}})['then'](function(_0x942b6e){if(_0x942b6e){return _0x942b6e?{'count':_0xb52234,'rows':_0x942b6e}:null;}})['then'](respondWithResult(_0x357242,null))['catch'](handleError(_0x357242,null));};exports[_0x0906('0x54')]=function(_0x15eff7,_0x50756c,_0x2d9b6b){return db[_0x0906('0x3f')][_0x0906('0x47')]({'where':{'id':_0x15eff7['params']['id']}})[_0x0906('0x25')](handleEntityNotFound(_0x50756c,null))['then'](function(_0x5a3f01){if(_0x5a3f01){return _0x5a3f01[_0x0906('0x54')](_0x15eff7[_0x0906('0x30')]['ids']);}})['then'](respondWithStatusCode(_0x50756c,null))['catch'](handleError(_0x50756c,null));};exports[_0x0906('0x55')]=function(_0x395f40,_0x1a112f,_0x1e5ab5){if(_0x395f40['body']['id']){delete _0x395f40['body']['id'];}return db[_0x0906('0x3f')][_0x0906('0x47')]({'where':{'id':_0x395f40['params']['id']}})[_0x0906('0x25')](handleEntityNotFound(_0x1a112f,null))[_0x0906('0x25')](function(_0x717c4c){if(_0x717c4c){_0x395f40[_0x0906('0x49')]['ChatGroupId']=_0x717c4c['id'];return db[_0x0906('0x56')]['create'](_0x395f40[_0x0906('0x49')]);}})['then'](respondWithResult(_0x1a112f,null))[_0x0906('0x43')](handleError(_0x1a112f,null));};exports[_0x0906('0x57')]=function(_0x437169,_0xf68325,_0x59996c){var _0x3e754a={};var _0x299811={};var _0x43ac9b;var _0x257b21;return db[_0x0906('0x3f')][_0x0906('0x52')]({'where':{'id':_0x437169[_0x0906('0x44')]['id']}})['then'](handleEntityNotFound(_0xf68325,null))[_0x0906('0x25')](function(_0x228f0a){if(_0x228f0a){_0x43ac9b=_0x228f0a;_0x299811['model']=_['keys'](db[_0x0906('0x56')][_0x0906('0x2a')]);_0x299811[_0x0906('0x30')]=_[_0x0906('0x31')](_0x437169[_0x0906('0x30')]);_0x299811[_0x0906('0x32')]=_[_0x0906('0x33')](_0x299811[_0x0906('0x2e')],_0x299811['query']);_0x3e754a[_0x0906('0x34')]=_[_0x0906('0x33')](_0x299811[_0x0906('0x2e')],qs[_0x0906('0x35')](_0x437169[_0x0906('0x30')][_0x0906('0x35')]));_0x3e754a['attributes']=_0x3e754a['attributes'][_0x0906('0x36')]?_0x3e754a['attributes']:_0x299811[_0x0906('0x2e')];_0x3e754a[_0x0906('0x38')]=qs['sort'](_0x437169['query']['sort']);_0x3e754a[_0x0906('0x3b')]=qs[_0x0906('0x32')](_[_0x0906('0x3a')](_0x437169['query'],_0x299811[_0x0906('0x32')]));if(_0x437169[_0x0906('0x30')][_0x0906('0x3e')]){_0x3e754a[_0x0906('0x3b')]=_[_0x0906('0x3c')](_0x3e754a[_0x0906('0x3b')],{'$or':_[_0x0906('0x2f')](_0x3e754a[_0x0906('0x34')],function(_0x30db87){var _0xc20e73={};_0xc20e73[_0x30db87]={'$like':'%'+_0x437169[_0x0906('0x30')][_0x0906('0x3e')]+'%'};return _0xc20e73;})});}if(_0x437169['query'][_0x0906('0x58')]){var _0x973a73=_0x437169[_0x0906('0x30')]['$gte'][_0x0906('0x59')](',');var _0x3ca345={};_0x3ca345[_0x973a73[0x0]]={'$gte':moment(_0x973a73[0x1])[_0x0906('0x5a')](_0x0906('0x5b'))};_0x3e754a[_0x0906('0x3b')]=_['merge'](_0x3e754a['where'],_0x3ca345);}_0x3e754a=_[_0x0906('0x3c')]({},_0x3e754a,_0x437169[_0x0906('0x46')]);return _0x43ac9b[_0x0906('0x57')](_0x3e754a);}})['then'](function(_0x3a3008){if(_0x3a3008){_0x257b21=_0x3a3008['length'];if(!_0x437169[_0x0906('0x30')][_0x0906('0x53')](_0x0906('0x37'))){_0x3e754a[_0x0906('0x1e')]=qs[_0x0906('0x1e')](_0x437169[_0x0906('0x30')]['limit']);_0x3e754a[_0x0906('0x1c')]=qs[_0x0906('0x1c')](_0x437169[_0x0906('0x30')][_0x0906('0x1c')]);}return _0x43ac9b[_0x0906('0x57')](_0x3e754a);}})[_0x0906('0x25')](function(_0x34f054){if(_0x34f054){return _0x34f054?{'count':_0x257b21,'rows':_0x34f054}:null;}})[_0x0906('0x25')](respondWithResult(_0xf68325,null))['catch'](handleError(_0xf68325,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index a0f5c02..74fa34a 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 _0x1409=['hook','../../mysqldb','ChatGroup','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x28d18f,_0x1131c3){var _0x400c52=function(_0x4851be){while(--_0x4851be){_0x28d18f['push'](_0x28d18f['shift']());}};_0x400c52(++_0x1131c3);}(_0x1409,0x79));var _0x9140=function(_0x4b646a,_0x4ec531){_0x4b646a=_0x4b646a-0x0;var _0x21c6b1=_0x1409[_0x4b646a];return _0x21c6b1;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x9140('0x0'))['db'][_0x9140('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x9140('0x2')](0x0);var events={'afterCreate':_0x9140('0x3'),'afterUpdate':_0x9140('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13e6a9){return function(_0x74a3a6,_0x5e0721,_0xcead8a){ChatGroupEvents[_0x9140('0x5')](_0x13e6a9+':'+_0x74a3a6['id'],_0x74a3a6);ChatGroupEvents['emit'](_0x13e6a9,_0x74a3a6);_0xcead8a(null);};}for(var e in events){if(events[_0x9140('0x6')](e)){var event=events[e];ChatGroup[_0x9140('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x9aac=['hook','events','ChatGroup','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x4ab6a1,_0x4d64d5){var _0x2a24cc=function(_0x2625a0){while(--_0x2625a0){_0x4ab6a1['push'](_0x4ab6a1['shift']());}};_0x2a24cc(++_0x4d64d5);}(_0x9aac,0x135));var _0xc9aa=function(_0xa39f64,_0x681888){_0xa39f64=_0xa39f64-0x0;var _0x222314=_0x9aac[_0xa39f64];return _0x222314;};'use strict';var EventEmitter=require(_0xc9aa('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xc9aa('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc9aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8ca086){return function(_0x5c8ce2,_0x28c49c,_0x267772){ChatGroupEvents['emit'](_0x8ca086+':'+_0x5c8ce2['id'],_0x5c8ce2);ChatGroupEvents[_0xc9aa('0x4')](_0x8ca086,_0x5c8ce2);_0x267772(null);};}for(var e in events){if(events[_0xc9aa('0x5')](e)){var event=events[e];ChatGroup[_0xc9aa('0x6')](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 4553101..3758259 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 _0xbc5b=['./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x2be7dd,_0x226547){var _0x4c94e1=function(_0x97d18c){while(--_0x97d18c){_0x2be7dd['push'](_0x2be7dd['shift']());}};_0x4c94e1(++_0x226547);}(_0xbc5b,0x17f));var _0xbbc5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xbc5b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xbbc5('0x0'));var util=require(_0xbbc5('0x1'));var logger=require(_0xbbc5('0x2'))(_0xbbc5('0x3'));var moment=require(_0xbbc5('0x4'));var BPromise=require('bluebird');var rp=require(_0xbbc5('0x5'));var fs=require('fs');var path=require(_0xbbc5('0x6'));var rimraf=require(_0xbbc5('0x7'));var config=require(_0xbbc5('0x8'));var attributes=require(_0xbbc5('0x9'));module[_0xbbc5('0xa')]=function(_0x339b08,_0x1a5e25){return _0x339b08[_0xbbc5('0xb')](_0xbbc5('0xc'),attributes,{'tableName':_0xbbc5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf294=['path','../../config/environment','./chatGroup.attributes','exports','define','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1dcc1b,_0x22002f){var _0x5ba0c5=function(_0x1633a5){while(--_0x1633a5){_0x1dcc1b['push'](_0x1dcc1b['shift']());}};_0x5ba0c5(++_0x22002f);}(_0xf294,0xa2));var _0x4f29=function(_0x39ad4c,_0x2fa27e){_0x39ad4c=_0x39ad4c-0x0;var _0xf3314d=_0xf294[_0x39ad4c];return _0xf3314d;};'use strict';var _=require(_0x4f29('0x0'));var util=require(_0x4f29('0x1'));var logger=require(_0x4f29('0x2'))(_0x4f29('0x3'));var moment=require(_0x4f29('0x4'));var BPromise=require(_0x4f29('0x5'));var rp=require(_0x4f29('0x6'));var fs=require('fs');var path=require(_0x4f29('0x7'));var rimraf=require('rimraf');var config=require(_0x4f29('0x8'));var attributes=require(_0x4f29('0x9'));module[_0x4f29('0xa')]=function(_0x46e8c2,_0x7e69b9){return _0x46e8c2[_0x4f29('0xb')]('ChatGroup',attributes,{'tableName':_0x4f29('0xc'),'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 fc0310a..5ddbd37 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 _0x7617=['client','http','redis','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7617,0x1cd));var _0x7761=function(_0x3f0014,_0x22b6a7){_0x3f0014=_0x3f0014-0x0;var _0x137811=_0x7617[_0x3f0014];return _0x137811;};'use strict';var _=require(_0x7761('0x0'));var util=require(_0x7761('0x1'));var moment=require('moment');var BPromise=require(_0x7761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7761('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7761('0x4'));var config=require(_0x7761('0x5'));var jayson=require(_0x7761('0x6'));var client=jayson[_0x7761('0x7')][_0x7761('0x8')]({'port':0x232a});config[_0x7761('0x9')]=_['defaults'](config['redis'],{'host':_0x7761('0xa'),'port':0x18eb});var socket=require(_0x7761('0xb'))(new Redis(config[_0x7761('0x9')]));require(_0x7761('0xc'))[_0x7761('0xd')](socket);function respondWithRpcPromise(_0x354369,_0x57015c,_0x329ba5){return new BPromise(function(_0x1dbf7d,_0x43b7a8){return client[_0x7761('0xe')](_0x354369,_0x329ba5)['then'](function(_0x117f89){logger[_0x7761('0xf')](_0x7761('0x10'),_0x57015c,_0x7761('0x11'));logger[_0x7761('0x12')](_0x7761('0x13'),_0x57015c,'request\x20sent',JSON[_0x7761('0x14')](_0x117f89));if(_0x117f89[_0x7761('0x15')]){if(_0x117f89[_0x7761('0x15')][_0x7761('0x16')]===0x1f4){logger[_0x7761('0x15')](_0x7761('0x10'),_0x57015c,_0x117f89[_0x7761('0x15')]['message']);return _0x43b7a8(_0x117f89[_0x7761('0x15')][_0x7761('0x17')]);}logger['error'](_0x7761('0x10'),_0x57015c,_0x117f89['error'][_0x7761('0x17')]);return _0x1dbf7d(_0x117f89['error'][_0x7761('0x17')]);}else{logger[_0x7761('0xf')]('ChatGroup,\x20%s,\x20%s',_0x57015c,'request\x20sent');_0x1dbf7d(_0x117f89[_0x7761('0x18')][_0x7761('0x17')]);}})[_0x7761('0x19')](function(_0x1fcda2){logger['error'](_0x7761('0x10'),_0x57015c,_0x1fcda2);_0x43b7a8(_0x1fcda2);});});} \ No newline at end of file +var _0x9dc3=['info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','register','request','then'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x9dc3,0xa5));var _0x39dc=function(_0x340340,_0xc747c2){_0x340340=_0x340340-0x0;var _0x261359=_0x9dc3[_0x340340];return _0x261359;};'use strict';var _=require(_0x39dc('0x0'));var util=require(_0x39dc('0x1'));var moment=require(_0x39dc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x39dc('0x3'));var db=require(_0x39dc('0x4'))['db'];var utils=require(_0x39dc('0x5'));var logger=require(_0x39dc('0x6'))(_0x39dc('0x7'));var config=require(_0x39dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x39dc('0x9')][_0x39dc('0xa')]({'port':0x232a});config[_0x39dc('0xb')]=_[_0x39dc('0xc')](config[_0x39dc('0xb')],{'host':_0x39dc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatGroup.socket')[_0x39dc('0xe')](socket);function respondWithRpcPromise(_0x44f334,_0x16bbbd,_0xffe473){return new BPromise(function(_0x2b4d22,_0x1eebb1){return client[_0x39dc('0xf')](_0x44f334,_0xffe473)[_0x39dc('0x10')](function(_0x54490e){logger[_0x39dc('0x11')](_0x39dc('0x12'),_0x16bbbd,_0x39dc('0x13'));logger[_0x39dc('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x16bbbd,_0x39dc('0x13'),JSON[_0x39dc('0x15')](_0x54490e));if(_0x54490e[_0x39dc('0x16')]){if(_0x54490e['error'][_0x39dc('0x17')]===0x1f4){logger[_0x39dc('0x16')](_0x39dc('0x12'),_0x16bbbd,_0x54490e[_0x39dc('0x16')][_0x39dc('0x18')]);return _0x1eebb1(_0x54490e['error'][_0x39dc('0x18')]);}logger[_0x39dc('0x16')](_0x39dc('0x12'),_0x16bbbd,_0x54490e[_0x39dc('0x16')][_0x39dc('0x18')]);return _0x2b4d22(_0x54490e[_0x39dc('0x16')][_0x39dc('0x18')]);}else{logger['info'](_0x39dc('0x12'),_0x16bbbd,_0x39dc('0x13'));_0x2b4d22(_0x54490e['result']['message']);}})[_0x39dc('0x19')](function(_0x11fb9b){logger[_0x39dc('0x16')](_0x39dc('0x12'),_0x16bbbd,_0x11fb9b);_0x1eebb1(_0x11fb9b);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 48d3b31..fa6cc67 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 _0x26a6=['save','remove','update','removeListener','register','chatGroup:'];(function(_0x13ae53,_0x4729cc){var _0x247e55=function(_0x1800ec){while(--_0x1800ec){_0x13ae53['push'](_0x13ae53['shift']());}};_0x247e55(++_0x4729cc);}(_0x26a6,0x6c));var _0x626a=function(_0x3c3825,_0x518587){_0x3c3825=_0x3c3825-0x0;var _0x2e7ee2=_0x26a6[_0x3c3825];return _0x2e7ee2;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x626a('0x0'),_0x626a('0x1'),_0x626a('0x2')];function createListener(_0x180a23,_0xb13125){return function(_0x2aa0a2){_0xb13125['emit'](_0x180a23,_0x2aa0a2);};}function removeListener(_0x2767d7,_0x5dbe37){return function(){ChatGroupEvents[_0x626a('0x3')](_0x2767d7,_0x5dbe37);};}exports[_0x626a('0x4')]=function(_0x305afe){for(var _0x2f020c=0x0,_0x1f0fb6=events['length'];_0x2f020c<_0x1f0fb6;_0x2f020c++){var _0x44c1e9=events[_0x2f020c];var _0x458286=createListener(_0x626a('0x5')+_0x44c1e9,_0x305afe);ChatGroupEvents['on'](_0x44c1e9,_0x458286);}}; \ No newline at end of file +var _0xaded=['./chatGroup.events','save','remove','emit','register','chatGroup:'];(function(_0x5df25b,_0x1bc928){var _0x19f252=function(_0x41de28){while(--_0x41de28){_0x5df25b['push'](_0x5df25b['shift']());}};_0x19f252(++_0x1bc928);}(_0xaded,0x10e));var _0xdade=function(_0x5efe23,_0x5c40e7){_0x5efe23=_0x5efe23-0x0;var _0x2b176a=_0xaded[_0x5efe23];return _0x2b176a;};'use strict';var ChatGroupEvents=require(_0xdade('0x0'));var events=[_0xdade('0x1'),_0xdade('0x2'),'update'];function createListener(_0x35e53f,_0x5e7ad3){return function(_0x13e193){_0x5e7ad3[_0xdade('0x3')](_0x35e53f,_0x13e193);};}function removeListener(_0x991f3d,_0x3aa5df){return function(){ChatGroupEvents['removeListener'](_0x991f3d,_0x3aa5df);};}exports[_0xdade('0x4')]=function(_0x356d33){for(var _0x5db69e=0x0,_0x512eca=events['length'];_0x5db69e<_0x512eca;_0x5db69e++){var _0x599b6e=events[_0x5db69e];var _0x5e01a7=createListener(_0xdade('0x5')+_0x599b6e,_0x356d33);ChatGroupEvents['on'](_0x599b6e,_0x5e01a7);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 0dd8ad4..13f8c63 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 _0x27c3=['/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','post'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x27c3,0x159));var _0x327c=function(_0x27fe26,_0x3b8ca7){_0x27fe26=_0x27fe26-0x0;var _0x4fcb35=_0x27c3[_0x27fe26];return _0x4fcb35;};'use strict';var multer=require(_0x327c('0x0'));var util=require(_0x327c('0x1'));var path=require(_0x327c('0x2'));var timeout=require(_0x327c('0x3'));var express=require(_0x327c('0x4'));var router=express[_0x327c('0x5')]();var fs_extra=require(_0x327c('0x6'));var auth=require(_0x327c('0x7'));var interaction=require(_0x327c('0x8'));var config=require(_0x327c('0x9'));var controller=require('./chatGroup.controller');router[_0x327c('0xa')]('/',auth[_0x327c('0xb')](),controller['index']);router[_0x327c('0xa')](_0x327c('0xc'),auth[_0x327c('0xb')](),controller[_0x327c('0xd')]);router[_0x327c('0xa')](_0x327c('0xe'),auth[_0x327c('0xb')](),controller[_0x327c('0xf')]);router['get'](_0x327c('0x10'),auth[_0x327c('0xb')](),controller[_0x327c('0x11')]);router[_0x327c('0xa')]('/:id/members',auth[_0x327c('0xb')](),controller['getMembers']);router[_0x327c('0xa')]('/:id/messages',auth[_0x327c('0xb')](),controller['getMessages']);router[_0x327c('0x12')]('/',auth[_0x327c('0xb')](),controller['create']);router[_0x327c('0x12')](_0x327c('0x13'),auth[_0x327c('0xb')](),controller[_0x327c('0x14')]);router[_0x327c('0x12')]('/:id/messages',auth[_0x327c('0xb')](),controller[_0x327c('0x15')]);router[_0x327c('0x16')](_0x327c('0xe'),auth[_0x327c('0xb')](),controller[_0x327c('0x17')]);router[_0x327c('0x18')](_0x327c('0xe'),auth['isAuthenticated'](),controller[_0x327c('0x19')]);router['delete'](_0x327c('0x13'),auth['isAuthenticated'](),controller[_0x327c('0x1a')]);module[_0x327c('0x1b')]=router; \ No newline at end of file +var _0xddd2=['post','create','addMessage','put','update','delete','/:id/members','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages'];(function(_0x52f3e2,_0x422aec){var _0x3ca491=function(_0x2fed77){while(--_0x2fed77){_0x52f3e2['push'](_0x52f3e2['shift']());}};_0x3ca491(++_0x422aec);}(_0xddd2,0x1b8));var _0x2ddd=function(_0x3bcd0b,_0x118ab4){_0x3bcd0b=_0x3bcd0b-0x0;var _0x307096=_0xddd2[_0x3bcd0b];return _0x307096;};'use strict';var multer=require(_0x2ddd('0x0'));var util=require(_0x2ddd('0x1'));var path=require('path');var timeout=require(_0x2ddd('0x2'));var express=require(_0x2ddd('0x3'));var router=express[_0x2ddd('0x4')]();var fs_extra=require(_0x2ddd('0x5'));var auth=require(_0x2ddd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatGroup.controller');router[_0x2ddd('0x7')]('/',auth[_0x2ddd('0x8')](),controller[_0x2ddd('0x9')]);router[_0x2ddd('0x7')](_0x2ddd('0xa'),auth['isAuthenticated'](),controller[_0x2ddd('0xb')]);router[_0x2ddd('0x7')](_0x2ddd('0xc'),auth[_0x2ddd('0x8')](),controller[_0x2ddd('0xd')]);router[_0x2ddd('0x7')](_0x2ddd('0xe'),auth['isAuthenticated'](),controller[_0x2ddd('0xf')]);router[_0x2ddd('0x7')]('/:id/members',auth[_0x2ddd('0x8')](),controller[_0x2ddd('0x10')]);router[_0x2ddd('0x7')](_0x2ddd('0x11'),auth[_0x2ddd('0x8')](),controller[_0x2ddd('0x12')]);router[_0x2ddd('0x13')]('/',auth[_0x2ddd('0x8')](),controller[_0x2ddd('0x14')]);router[_0x2ddd('0x13')]('/:id/members',auth[_0x2ddd('0x8')](),controller['addMembers']);router[_0x2ddd('0x13')]('/:id/messages',auth[_0x2ddd('0x8')](),controller[_0x2ddd('0x15')]);router[_0x2ddd('0x16')]('/:id',auth[_0x2ddd('0x8')](),controller[_0x2ddd('0x17')]);router[_0x2ddd('0x18')](_0x2ddd('0xc'),auth[_0x2ddd('0x8')](),controller['destroy']);router[_0x2ddd('0x18')](_0x2ddd('0x19'),auth['isAuthenticated'](),controller['removeMembers']);module[_0x2ddd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 723fc9a..51c7aac 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 _0x3c81=['INTEGER','ENUM','TEXT','STRING','DATE','long','out','BOOLEAN','sequelize','exports'];(function(_0x1002e5,_0x46556c){var _0x4a6654=function(_0x1ad73b){while(--_0x1ad73b){_0x1002e5['push'](_0x1002e5['shift']());}};_0x4a6654(++_0x46556c);}(_0x3c81,0x102));var _0x13c8=function(_0xb1348f,_0x41a781){_0xb1348f=_0xb1348f-0x0;var _0x6665de=_0x3c81[_0xb1348f];return _0x6665de;};'use strict';var Sequelize=require(_0x13c8('0x0'));module[_0x13c8('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x13c8('0x2')]},'ratingType':{'type':Sequelize[_0x13c8('0x3')]('star','thumb'),'defaultValue':'star'},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x13c8('0x4')]},'mailTranscript':{'type':Sequelize[_0x13c8('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x13c8('0x6')]},'disposition':{'type':Sequelize[_0x13c8('0x5')]},'secondDisposition':{'type':Sequelize[_0x13c8('0x5')]},'thirdDisposition':{'type':Sequelize[_0x13c8('0x5')]},'note':{'type':Sequelize[_0x13c8('0x5')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x13c8('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x13c8('0x5')]},'deviceModel':{'type':Sequelize[_0x13c8('0x5')]},'deviceVendor':{'type':Sequelize[_0x13c8('0x5')]},'deviceType':{'type':Sequelize[_0x13c8('0x5')]},'referer':{'type':Sequelize[_0x13c8('0x4')]},'customerIp':{'type':Sequelize[_0x13c8('0x5')]},'formData':{'type':Sequelize[_0x13c8('0x4')](_0x13c8('0x7'))},'read1stAt':{'type':Sequelize[_0x13c8('0x6')]},'lastMsgAt':{'type':Sequelize[_0x13c8('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x13c8('0x3')]('in',_0x13c8('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x13c8('0x5')]},'customerPort':{'type':Sequelize[_0x13c8('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x13c8('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x6836=['BOOLEAN','ENUM','thumb','TEXT','STRING','DATE','out','sequelize','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x6836,0x1c0));var _0x6683=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x6836[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x6683('0x0'));module[_0x6683('0x1')]={'closed':{'type':Sequelize[_0x6683('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6683('0x3')]('star',_0x6683('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x6683('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x6683('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6683('0x7')]},'disposition':{'type':Sequelize[_0x6683('0x6')]},'secondDisposition':{'type':Sequelize[_0x6683('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6683('0x6')]},'browserName':{'type':Sequelize[_0x6683('0x6')]},'browserVersion':{'type':Sequelize[_0x6683('0x6')]},'osName':{'type':Sequelize[_0x6683('0x6')]},'osVersion':{'type':Sequelize[_0x6683('0x6')]},'deviceModel':{'type':Sequelize[_0x6683('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6683('0x5')]},'customerIp':{'type':Sequelize[_0x6683('0x6')]},'formData':{'type':Sequelize[_0x6683('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x6683('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6683('0x3')]('in',_0x6683('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6683('0x6')]},'customerPort':{'type':Sequelize[_0x6683('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x6683('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x6683('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index ff44a5c..9185ee2 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 _0x9ffd=['MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','agent','getChatWebsites','isEmpty','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','keyBy','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','toString','ui.ChatInteractionId\x20IN\x20?','groupBy','params','includeAll','find','destroy','describe','createVidaooSession','findOne','ChatWebsite','vidaooNote','vidaooApiKey','vidaooEscalation','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','create','updateAttributes','customUpdate','abandonInteraction,\x20%s,\x20%s,\x20%s','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','addMessage','ids','omit','getMessages','ChatInteractionId','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','secret','include','includeAgent','push','setTags','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','tmp','server','files','CmContact','firstName','attachments','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','lastName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','reject','save','update','stack','name','render','merge','body','contact','account','Users','fullname','Tags','TagIds','split','forEach','index','ChatInteraction','rawAttributes','fieldName','type','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','select','field','color','from','left_join','u.id\x20=\x20ui.UserId','chat_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','parseSearch','search','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','compact','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1add26,_0x26c68c){_0x1add26=_0x1add26-0x0;var _0x2d393e=_0x9ffd[_0x1add26];return _0x2d393e;};'use strict';var emlformat=require(_0xd9ff('0x0'));var rimraf=require(_0xd9ff('0x1'));var zipdir=require(_0xd9ff('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd9ff('0x3'));var moment=require(_0xd9ff('0x4'));var BPromise=require(_0xd9ff('0x5'));var Mustache=require(_0xd9ff('0x6'));var util=require('util');var path=require(_0xd9ff('0x7'));var sox=require(_0xd9ff('0x8'));var csv=require('to-csv');var ejs=require(_0xd9ff('0x9'));var fs=require('fs');var fs_extra=require(_0xd9ff('0xa'));var _=require(_0xd9ff('0xb'));var squel=require(_0xd9ff('0xc'));var crypto=require(_0xd9ff('0xd'));var jsforce=require(_0xd9ff('0xe'));var deskjs=require(_0xd9ff('0xf'));var toCsv=require(_0xd9ff('0x10'));var querystring=require(_0xd9ff('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd9ff('0x12'));var pdf=require(_0xd9ff('0x13'));var hardwareService=require(_0xd9ff('0x14'));var logger=require(_0xd9ff('0x15'))(_0xd9ff('0x16'));var utils=require(_0xd9ff('0x17'));var config=require(_0xd9ff('0x18'));var licenseUtil=require(_0xd9ff('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xd9ff('0x1a')](config[_0xd9ff('0x1b')],{'host':_0xd9ff('0x1c'),'port':0x18eb});var socket=require(_0xd9ff('0x1d'))(new Redis(config[_0xd9ff('0x1b')]));require('./chatInteraction.socket')[_0xd9ff('0x1e')](socket);var jayson=require(_0xd9ff('0x1f'));var client=jayson['client'][_0xd9ff('0x20')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x547e28,_0x4c5718,_0x271287,_0x4f9d6d){return new BPromise(function(_0x35679e,_0xa30fd2){var _0x39c6ce=_0x4f9d6d||client;return _0x39c6ce[_0xd9ff('0x21')](_0x547e28,_0x271287)[_0xd9ff('0x22')](function(_0x2d4df1){logger[_0xd9ff('0x23')](_0xd9ff('0x24'),_0x4c5718,_0xd9ff('0x25'));logger[_0xd9ff('0x26')](_0xd9ff('0x27'),_0x4c5718,_0xd9ff('0x25'),JSON[_0xd9ff('0x28')](_0x2d4df1));if(_0x2d4df1['error']){if(_0x2d4df1['error'][_0xd9ff('0x29')]===0x1f4){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x2d4df1['error']['message']);return _0xa30fd2(_0x2d4df1['error'][_0xd9ff('0x2b')]);}logger['error'](_0xd9ff('0x24'),_0x4c5718,_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);return _0x35679e(_0x2d4df1[_0xd9ff('0x2a')][_0xd9ff('0x2b')]);}else{logger[_0xd9ff('0x23')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,'request\x20sent');_0x35679e(_0x2d4df1[_0xd9ff('0x2c')]['message']);}})[_0xd9ff('0x2d')](function(_0x4d86fe){logger[_0xd9ff('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x4c5718,_0x4d86fe);_0xa30fd2(_0x4d86fe);});});}function respondWithStatusCode(_0x10cbdd,_0x159e56){_0x159e56=_0x159e56||0xcc;return function(_0x2138b4){if(_0x2138b4){return _0x10cbdd[_0xd9ff('0x2e')](_0x159e56);}return _0x10cbdd['status'](_0x159e56)[_0xd9ff('0x2f')]();};}function respondWithResult(_0xe11f88,_0x1c78c4){_0x1c78c4=_0x1c78c4||0xc8;return function(_0x4390f7){if(_0x4390f7){return _0xe11f88['status'](_0x1c78c4)[_0xd9ff('0x30')](_0x4390f7);}};}function respondWithFilteredResult(_0x3792d9,_0x44b5a7){return function(_0x45fb63){if(_0x45fb63){var _0x263d3a=typeof _0x44b5a7[_0xd9ff('0x31')]===_0xd9ff('0x32')&&typeof _0x44b5a7[_0xd9ff('0x33')]===_0xd9ff('0x32');var _0x5706cf=_0x45fb63[_0xd9ff('0x34')];var _0x4ba2be=_0x263d3a?0x0:_0x44b5a7[_0xd9ff('0x31')];var _0x29c532=_0x263d3a?_0x45fb63[_0xd9ff('0x34')]:_0x44b5a7['offset']+_0x44b5a7[_0xd9ff('0x33')];var _0x3b26da;if(_0x29c532>=_0x5706cf){_0x29c532=_0x5706cf;_0x3b26da=0xc8;}else{_0x3b26da=0xce;}_0x3792d9[_0xd9ff('0x35')](_0x3b26da);return _0x3792d9[_0xd9ff('0x36')]('Content-Range',_0x4ba2be+'-'+_0x29c532+'/'+_0x5706cf)[_0xd9ff('0x30')](_0x45fb63);}return null;};}function patchUpdates(_0x5743de){return function(_0x18c28b){try{jsonpatch[_0xd9ff('0x37')](_0x18c28b,_0x5743de,!![]);}catch(_0x323cb5){return BPromise[_0xd9ff('0x38')](_0x323cb5);}return _0x18c28b[_0xd9ff('0x39')]();};}function saveUpdates(_0xdf3947,_0x2cc2ae){return function(_0x281c7b){if(_0x281c7b){return _0x281c7b[_0xd9ff('0x3a')](_0xdf3947)[_0xd9ff('0x22')](function(_0x4813a5){return _0x4813a5;});}return null;};}function removeEntity(_0x34e9a9,_0x4670e4){return function(_0x66f4d){if(_0x66f4d){return _0x66f4d['destroy']()[_0xd9ff('0x22')](function(){_0x34e9a9[_0xd9ff('0x35')](0xcc)[_0xd9ff('0x2f')]();});}};}function handleEntityNotFound(_0x4ab10f,_0x3d449d){return function(_0x5e3ff9){if(!_0x5e3ff9){_0x4ab10f[_0xd9ff('0x2e')](0x194);}return _0x5e3ff9;};}function handleError(_0x4ae56b,_0x20a021){_0x20a021=_0x20a021||0x1f4;return function(_0x5db498){logger[_0xd9ff('0x2a')](_0x5db498[_0xd9ff('0x3b')]);if(_0x5db498[_0xd9ff('0x3c')]){delete _0x5db498['name'];}_0x4ae56b['status'](_0x20a021)['send'](_0x5db498);};}function getMustacheRender(_0x7ac3d1,_0x30fc5b){return Mustache[_0xd9ff('0x3d')](_0x7ac3d1,_[_0xd9ff('0x3e')](_0x30fc5b[_0xd9ff('0x3f')],{'contact':_0x30fc5b[_0xd9ff('0x40')],'message':_0x30fc5b['message'],'agent':_0x30fc5b['agent'],'interaction':_0x30fc5b['interaction'],'account':_0x30fc5b[_0xd9ff('0x41')]}))||'';}function getInteractionUsers(_0x252edc,_0x918c9a){return new BPromise(function(_0x32adae,_0x56b94d){try{if(_0x918c9a[_0x252edc['id']]){_0x252edc[_0xd9ff('0x42')]=_['map'](_0x918c9a[_0x252edc['id']],function(_0x3cff52){return{'id':_0x3cff52['id'],'fullname':_0x3cff52[_0xd9ff('0x43')]};});}}catch(_0x1bedaf){_0x56b94d(_0x1bedaf);}_0x32adae(_0x252edc);});}function getInteractionTags(_0x169dc7,_0x59fc07){return new BPromise(function(_0x1e34da,_0x2d4d97){try{if(_0x169dc7['TagIds']){_0x169dc7[_0xd9ff('0x44')]=[];_0x169dc7[_0xd9ff('0x45')][_0xd9ff('0x46')](',')[_0xd9ff('0x47')](function(_0x1fe44d){_0x169dc7[_0xd9ff('0x44')]['push'](_0x59fc07[_0x1fe44d]);});}delete _0x169dc7[_0xd9ff('0x45')];}catch(_0x116f28){_0x2d4d97(_0x116f28);}_0x1e34da(_0x169dc7);});}function updateChatInteraction(_0x10533a,_0x39fbbb,_0x472724){return new BPromise(function(_0x52aab8,_0x3178cd){return getInteractionUsers(_0x10533a,_0x472724)[_0xd9ff('0x22')](function(_0xe0bc49){return getInteractionTags(_0xe0bc49,_0x39fbbb);})['then'](function(_0x5d06dd){_0x52aab8(_0x5d06dd);})[_0xd9ff('0x2d')](function(_0x7eb1a){_0x3178cd(_0x7eb1a);});});}exports[_0xd9ff('0x48')]=function(_0x2dfb8f,_0x437561){var _0x30c69d={},_0x564ef4={},_0xd64585={'count':0x0,'rows':[]};var _0x2d3013=_['map'](db[_0xd9ff('0x49')][_0xd9ff('0x4a')],function(_0x13a1ec){return{'name':_0x13a1ec[_0xd9ff('0x4b')],'type':_0x13a1ec[_0xd9ff('0x4c')]['key']};});_0x564ef4['model']=_['map'](_0x2d3013,_0xd9ff('0x3c'));_0x564ef4['query']=_[_0xd9ff('0x4d')](_0x2dfb8f[_0xd9ff('0x4e')]);_0x564ef4[_0xd9ff('0x4f')]=_['intersection'](_0x564ef4[_0xd9ff('0x50')],_0x564ef4[_0xd9ff('0x4e')]);_0x30c69d['attributes']=_[_0xd9ff('0x51')](_0x564ef4[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x2dfb8f[_0xd9ff('0x4e')]['fields']));_0x30c69d[_0xd9ff('0x53')]=_0x30c69d['attributes'][_0xd9ff('0x54')]?_0x30c69d['attributes']:_0x564ef4[_0xd9ff('0x50')];if(!_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x30c69d[_0xd9ff('0x33')]=qs['limit'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x30c69d[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2dfb8f['query']['offset']);}_0x30c69d['order']=qs[_0xd9ff('0x57')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x30c69d['where']=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0x2dfb8f[_0xd9ff('0x4e')],_0x564ef4[_0xd9ff('0x4f')]),_0x2d3013);var _0xfede73=[];var _0x40d391=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5a')]('id')[_0xd9ff('0x5a')](_0xd9ff('0x3c'))[_0xd9ff('0x5a')](_0xd9ff('0x5b'))[_0xd9ff('0x5c')]('tools_tags');var _0x3ed112=squel['select']()[_0xd9ff('0x5a')]('u.id')[_0xd9ff('0x5a')]('u.fullname')[_0xd9ff('0x5a')]('ui.ChatInteractionId')[_0xd9ff('0x5c')]('user_has_chat_interactions','ui')[_0xd9ff('0x5d')]('users','u',_0xd9ff('0x5e'));var _0x5da1a8=squel[_0xd9ff('0x59')]()[_0xd9ff('0x5c')](_0xd9ff('0x5f'),'i')[_0xd9ff('0x5d')]('cm_contacts','c',_0xd9ff('0x60'))[_0xd9ff('0x5d')](_0xd9ff('0x61'),'o','o.id\x20=\x20i.UserId')[_0xd9ff('0x5d')](_0xd9ff('0x62'),'a',_0xd9ff('0x63'))[_0xd9ff('0x5d')](_0xd9ff('0x64'),'me','me.ChatInteractionId\x20=\x20i.id')[_0xd9ff('0x5d')](_0xd9ff('0x65'),'it',_0xd9ff('0x66'))[_0xd9ff('0x5d')](_0xd9ff('0x67'),'t',_0xd9ff('0x68'));var _0x458fd4=squel['expr']();var _0x3be850=[];var _0x11251f=squel['expr']();var _0x1c885f;if(_0x2dfb8f[_0xd9ff('0x4e')]['search']){_0x1c885f=as[_0xd9ff('0x69')](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x6a')]);var _0x54ea27=_0x1c885f['sqlOperator'];for(var _0x39473e=0x0;_0x39473e<_0x1c885f['conditions'][_0xd9ff('0x54')];_0x39473e++){var _0x1e4d0c=_0x1c885f[_0xd9ff('0x6b')][_0x39473e];var _0x102aea='i';var _0x53a230=_['find'](_0x2d3013,['name',_0x1e4d0c[_0xd9ff('0x5a')]]);if(!_0x53a230){switch(_0x1e4d0c[_0xd9ff('0x5a')]){case _0xd9ff('0x6c'):if(_0x1e4d0c[_0xd9ff('0x6d')]==0x1){_0x5da1a8[_0xd9ff('0x6e')]('`'+_0x1e4d0c['field']+_0xd9ff('0x6f'));}else{_0x5da1a8['having']('`'+_0x1e4d0c[_0xd9ff('0x5a')]+_0xd9ff('0x70'));}break;case _0xd9ff('0x71'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){if(_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')]('\x20')[_0xd9ff('0x54')]>0x1){_0x458fd4[_0x54ea27]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xd9ff('0x74')](_0x1e4d0c[_0xd9ff('0x6d')]),null);}else{var _0x4f5338='%'+_0x1e4d0c['value']+'%';_0x458fd4[_0x54ea27](_0xd9ff('0x75'),_0x4f5338,_0x4f5338,_0x4f5338);}}else{_0x53a230=_['find'](_0x2d3013,[_0xd9ff('0x3c'),_0xd9ff('0x76')]);_0x1e4d0c['field']=_0xd9ff('0x76');_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')]['start'],_0x58c9c2[_0xd9ff('0x6d')]['end']);}break;case'Tag':var _0x3dabb1=_0x1e4d0c[_0xd9ff('0x6d')][_0xd9ff('0x46')](',')[_0xd9ff('0x79')](function(_0x56d822){return Number(_0x56d822);});_0x3dabb1[_0xd9ff('0x47')](function(_0x23b816){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x23b816+',%');});_0x3be850=_[_0xd9ff('0x7b')](_0x3be850,_0x3dabb1);break;case _0xd9ff('0x7c'):if(_0x1e4d0c[_0xd9ff('0x72')]===_0xd9ff('0x73')){_0x458fd4[_0x54ea27](_0xd9ff('0x7d'),'%'+_0x1e4d0c['value']+'%',null);}else{_0x53a230=_['find'](_0x2d3013,['name',_0xd9ff('0x7e')]);_0x1e4d0c[_0xd9ff('0x5a')]='UserId';_0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}break;case _0xd9ff('0x3f'):_0x58c9c2=as['buildExpression']('me',null,_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x7f')],_0x58c9c2['value'][_0xd9ff('0x2f')]);break;}}else{var _0x58c9c2=as[_0xd9ff('0x77')](_0x102aea,_0x53a230[_0xd9ff('0x4c')],_0x1e4d0c);_0x458fd4[_0x54ea27](_0x58c9c2[_0xd9ff('0x78')],_0x58c9c2['value'][_0xd9ff('0x7f')],_0x58c9c2[_0xd9ff('0x6d')][_0xd9ff('0x2f')]);}}}else{var _0x1cd620=_(_0x2dfb8f['query'])[_0xd9ff('0x4d')]()[_0xd9ff('0x79')](function(_0x1de5c9){return _['some'](_0x2d3013,[_0xd9ff('0x3c'),_0x1de5c9])?_0x1de5c9:undefined;})[_0xd9ff('0x80')]()[_0xd9ff('0x6d')]();if(!_['isEmpty'](_0x1cd620)){_0x1cd620[_0xd9ff('0x47')](function(_0x35926f){if(_0x35926f===_0xd9ff('0x81')){_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0x83'),[]['concat'](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]));}else if(_0x35926f===_0xd9ff('0x84')){var _0x59af0a=JSON[_0xd9ff('0x85')](_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f])[_0xd9ff('0x86')];var _0x5d1973=JSON[_0xd9ff('0x85')](_0x2dfb8f['query'][_0x35926f])[_0xd9ff('0x87')];_0x5da1a8['where'](_0xd9ff('0x88'),_0x59af0a,_0x5d1973);}else{if(_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]===_0xd9ff('0x89')){_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8a'));}else{_0x5da1a8[_0xd9ff('0x82')]('i.'+_0x35926f+_0xd9ff('0x8b'),_0x2dfb8f[_0xd9ff('0x4e')][_0x35926f]);}}});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8c')]){if(_0x2dfb8f['query'][_0xd9ff('0x8c')]==0x1){_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8d'));}else{_0x5da1a8[_0xd9ff('0x6e')](_0xd9ff('0x8e'));}}if(_0x2dfb8f[_0xd9ff('0x4e')]['tag']){_0x3be850=_['isArray'](_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')])?_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]:new Array(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x8f')]);_0x3be850['forEach'](function(_0x1d34a1){_0x11251f['or'](_0xd9ff('0x7a'),'%,'+_0x1d34a1+',%');});}if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x90')]){var _0x14c89f=_0x2dfb8f[_0xd9ff('0x4e')]['filter'][_0xd9ff('0x91')]('\x5c','\x5c\x5c')[_0xd9ff('0x91')](/'/g,'\x27\x27');if(qs[_0xd9ff('0x92')](_0x14c89f)){_0x458fd4['or'](_0xd9ff('0x93'),_0x14c89f+'%');}else{_0x458fd4['or'](_0xd9ff('0x94'),qs[_0xd9ff('0x74')](_0x14c89f))['or'](_0xd9ff('0x95'),_0x14c89f+'%');}}}_0x5da1a8[_0xd9ff('0x82')](_0x458fd4);_0x5da1a8['group'](_0xd9ff('0x96'));var _0x4c2ad5={'type':db[_0xd9ff('0x97')][_0xd9ff('0x98')][_0xd9ff('0x99')],'raw':!![]};var _0x2d2d1c=_0x5da1a8[_0xd9ff('0x9a')]();_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x96'));_0x2d2d1c[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));if(_0x30c69d[_0xd9ff('0x9c')]){_0x30c69d[_0xd9ff('0x9c')][_0xd9ff('0x47')](function(_0x5d29b9){var _0x4413c4=_0x5d29b9[0x0]===_0xd9ff('0x9d')?_0x5d29b9[0x0]:'i.'+_0x5d29b9[0x0];_0x5da1a8[_0xd9ff('0x9c')](_0x4413c4,_0x5d29b9[0x1]===_0xd9ff('0x9e')?![]:!![]);});}if(!_['isEmpty'](_0x3be850)){_0x5da1a8[_0xd9ff('0x6e')](_0x11251f);_0x2d2d1c[_0xd9ff('0x82')]('t.id\x20IN\x20?',_0x3be850);}BPromise[_0xd9ff('0x9f')]()[_0xd9ff('0x22')](function(){if(!_0x1c885f){if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x81')])return;_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa0'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x2dfb8f[_0xd9ff('0xa1')]['role']!==_0xd9ff('0xa2'))return;return _0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa3')]({'attributes':['id'],'raw':!![]})[_0xd9ff('0x22')](function(_0x320adb){if(_[_0xd9ff('0xa4')](_0x320adb)){_0x2d2d1c[_0xd9ff('0x82')](_0xd9ff('0xa5'));_0x5da1a8[_0xd9ff('0x82')](_0xd9ff('0xa5'));}else{_0x2d2d1c[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));_0x5da1a8[_0xd9ff('0x82')]('i.ChatWebsiteId\x20IN\x20?',_[_0xd9ff('0x79')](_0x320adb,'id'));}});})[_0xd9ff('0x22')](function(){if(_0x2dfb8f[_0xd9ff('0xa1')][_0xd9ff('0xa6')]===_0xd9ff('0xa2')&&!_0x1c885f&&!_0x2dfb8f[_0xd9ff('0x4e')]['ChatWebsiteId'])return[];return db['sequelize'][_0xd9ff('0x4e')](_0x2d2d1c['toString'](),_0x4c2ad5);})['then'](function(_0x4a55c1){_0xd64585['count']=_0x4a55c1[_0xd9ff('0x54')];if(_0xd64585[_0xd9ff('0x34')]===0x0)return[];return db[_0xd9ff('0xa7')]['query'](_0x40d391['toString'](),_0x4c2ad5)[_0xd9ff('0x22')](function(_0x5e7f52){_0xfede73=_[_0xd9ff('0xa8')](_0x5e7f52,'id');_0x4c2ad5=_['merge'](_0x4c2ad5,{'model':db[_0xd9ff('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2dfb8f[_0xd9ff('0x4e')][_0xd9ff('0x52')]){_0x30c69d[_0xd9ff('0x53')][_0xd9ff('0x47')](function(_0x4e6dd2){_0x5da1a8['field']('i.'+_0x4e6dd2);});}else{_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0x9b'),_0xd9ff('0x6c'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xa9'),'Account.key');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xaa'),_0xd9ff('0xab'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xac'),_0xd9ff('0x9d'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xad'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xae'),_0xd9ff('0xaf'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb0'),'Contact.lastName');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb1'),'Contact.email');_0x5da1a8['field'](_0xd9ff('0xb2'),_0xd9ff('0xb3'));_0x5da1a8['field'](_0xd9ff('0xb4'),_0xd9ff('0xb5'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb6'),_0xd9ff('0xb7'));_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xb8'),_0xd9ff('0xb9'));_0x5da1a8['field']('o.internal','Owner.internal');_0x5da1a8[_0xd9ff('0x5a')](_0xd9ff('0xba'),_0xd9ff('0x45'));}if(_0x30c69d['limit'])_0x5da1a8[_0xd9ff('0x33')](_0x30c69d[_0xd9ff('0x33')]);if(_0x30c69d[_0xd9ff('0x31')])_0x5da1a8[_0xd9ff('0x31')](_0x30c69d[_0xd9ff('0x31')]);return db[_0xd9ff('0xa7')]['query'](_0x5da1a8[_0xd9ff('0xbb')](),_0x4c2ad5);})['then'](function(_0x5cb3af){if(_0x5cb3af[_0xd9ff('0x54')]>0x0)_0x3ed112[_0xd9ff('0x82')](_0xd9ff('0xbc'),_['map'](_0x5cb3af,'id'));return db[_0xd9ff('0xa7')][_0xd9ff('0x4e')](_0x3ed112['toString'](),_0x4c2ad5)['then'](function(_0x4aa6d5){var _0x11840a=_[_0xd9ff('0xbd')](_0x4aa6d5,'ChatInteractionId');var _0x2871ec=[];_0x5cb3af[_0xd9ff('0x47')](function(_0x16e130){_0x2871ec['push'](updateChatInteraction(_0x16e130,_0xfede73,_0x11840a));});return BPromise['all'](_0x2871ec);});});})['then'](function(_0xdf2e33){_0xd64585['rows']=_0xdf2e33;return _0xd64585;})[_0xd9ff('0x22')](respondWithFilteredResult(_0x437561,_0x30c69d))[_0xd9ff('0x2d')](handleError(_0x437561,null));};exports['show']=function(_0x1b048b,_0x5eeeaf){var _0x3339e5={'raw':![],'where':{'id':_0x1b048b[_0xd9ff('0xbe')]['id']}},_0x1f7d87={};_0x1f7d87['model']=_[_0xd9ff('0x4d')](db['ChatInteraction']['rawAttributes']);_0x1f7d87['query']=_[_0xd9ff('0x4d')](_0x1b048b[_0xd9ff('0x4e')]);_0x1f7d87[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x1f7d87['model'],_0x1f7d87['query']);_0x3339e5[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x1f7d87[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0x1b048b[_0xd9ff('0x4e')]['fields']));_0x3339e5['attributes']=_0x3339e5[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x3339e5[_0xd9ff('0x53')]:_0x1f7d87[_0xd9ff('0x50')];if(_0x1b048b[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x3339e5['include']=[{'all':!![]}];}_0x3339e5=_[_0xd9ff('0x3e')]({},_0x3339e5,_0x1b048b['options']);return db['ChatInteraction'][_0xd9ff('0xc0')](_0x3339e5)[_0xd9ff('0x22')](handleEntityNotFound(_0x5eeeaf,null))[_0xd9ff('0x22')](respondWithResult(_0x5eeeaf,null))[_0xd9ff('0x2d')](handleError(_0x5eeeaf,null));};exports['create']=function(_0x4e3fdd,_0x2cf8da){return db['ChatInteraction']['create'](_0x4e3fdd[_0xd9ff('0x3f')],{})['then'](respondWithResult(_0x2cf8da,0xc9))[_0xd9ff('0x2d')](handleError(_0x2cf8da,null));};exports['update']=function(_0x327cd8,_0xd95329){if(_0x327cd8[_0xd9ff('0x3f')]['id']){delete _0x327cd8[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x327cd8[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0xd95329,null))[_0xd9ff('0x22')](saveUpdates(_0x327cd8['body'],null))['then'](respondWithResult(_0xd95329,null))[_0xd9ff('0x2d')](handleError(_0xd95329,null));};exports[_0xd9ff('0xc1')]=function(_0x499869,_0x3c86ac){return db['ChatInteraction']['find']({'where':{'id':_0x499869[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x3c86ac,null))[_0xd9ff('0x22')](removeEntity(_0x3c86ac,null))[_0xd9ff('0x2d')](handleError(_0x3c86ac,null));};exports[_0xd9ff('0xc2')]=function(_0x11c84f,_0x2d0261){return db[_0xd9ff('0x49')][_0xd9ff('0xc2')]()[_0xd9ff('0x22')](respondWithResult(_0x2d0261,null))[_0xd9ff('0x2d')](handleError(_0x2d0261,null));};exports[_0xd9ff('0xc3')]=function(_0x73cfcf,_0x538f20){var _0x51feff=_0x73cfcf['params']['id'];var _0x30c62c;var _0x50b6b2;var _0x413aef;return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x51feff}})[_0xd9ff('0x22')](function(_0x54c390){_0x30c62c=_0x54c390;return db[_0xd9ff('0xc5')]['findOne']({'where':{'id':_0x54c390[_0xd9ff('0x81')]},'attributes':['id','vidaooApiKey','vidaooEscalation','vidaooTopic',_0xd9ff('0xc6'),'vidaooMetadata'],'raw':!![]});})[_0xd9ff('0x22')](function(_0x54524c){if(_0x54524c&&_0x54524c[_0xd9ff('0xc7')]&&_0x54524c[_0xd9ff('0xc8')]){_0x50b6b2=_0x54524c;var _0x696e18={'interaction':{'id':_0x51feff},'agent':{'id':_0x73cfcf[_0xd9ff('0xa1')]['id'],'name':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0x3c')],'fullname':_0x73cfcf['user']['fullname'],'email':_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]},'contact':_0x73cfcf[_0xd9ff('0x3f')][_0xd9ff('0x40')],'account':_0x73cfcf[_0xd9ff('0x3f')]['account']};var _0x432854={'rejectUnauthorized':![],'method':_0xd9ff('0xca'),'url':_0xd9ff('0xcb'),'headers':{'X-APIKEY':_0x54524c[_0xd9ff('0xc7')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x73cfcf[_0xd9ff('0xa1')][_0xd9ff('0xc9')]],'buttons':null,'topic':_0x50b6b2['vidaooTopic'],'note':_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xc6')])?null:getMustacheRender(_0x50b6b2[_0xd9ff('0xc6')],_0x696e18),'metadata':null},'redirect':_0xd9ff('0xcd'),'json':!![]};try{if(!_[_0xd9ff('0xcc')](_0x50b6b2[_0xd9ff('0xce')])){var _0x1c8e55=getMustacheRender(_0x50b6b2[_0xd9ff('0xce')],_0x696e18);var _0x29fdb8=JSON[_0xd9ff('0x85')](_0x1c8e55);_0x432854[_0xd9ff('0x3f')][_0xd9ff('0xcf')]=_0x29fdb8;}}catch(_0xfc755a){throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))](_0xd9ff('0xd1'));}return rp(_0x432854);}else{throw new db[(_0xd9ff('0x97'))][(_0xd9ff('0xd0'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xd9ff('0x22')](function(_0x282183){_0x413aef=_0x282183;if(_0x413aef['id']){var _0x3aba00={'body':_0x413aef[_0xd9ff('0xd2')],'ChatWebsiteId':_0x50b6b2['id'],'ChatInteractionId':_0x30c62c['id'],'direction':_0xd9ff('0xd3'),'UserId':_0x73cfcf[_0xd9ff('0xa1')]['id']};return db[_0xd9ff('0xd4')][_0xd9ff('0xd5')](_0x3aba00,{});}else{throw new db['Sequelize'][(_0xd9ff('0xd0'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xd9ff('0x22')](function(){return _0x30c62c[_0xd9ff('0xd6')]({'vidaooSessionId':_0x413aef['id']});})[_0xd9ff('0x22')](respondWithResult(_0x538f20,null))[_0xd9ff('0x2d')](handleError(_0x538f20,null));};exports[_0xd9ff('0xd7')]=function(_0x204127,_0xf98666){if(_0x204127['body']['id']){delete _0x204127[_0xd9ff('0x3f')]['id'];}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x204127[_0xd9ff('0xbe')]['id']},'include':[{'model':db['CmContact'],'as':_0xd9ff('0x71')}]})[_0xd9ff('0x22')](handleEntityNotFound(_0xf98666,null))['then'](saveUpdates(_0x204127[_0xd9ff('0x3f')],null))[_0xd9ff('0x22')](respondWithResult(_0xf98666,null))['catch'](handleError(_0xf98666,null));};exports['abandon']=function(_0x5c4138,_0x560ea2,_0x1e6d5a){if(_0x5c4138[_0xd9ff('0x3f')]['id']){delete _0x5c4138[_0xd9ff('0x3f')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5c4138[_0xd9ff('0xbe')]['id']}})['then'](function(_0x43a941){if(!_0x43a941){logger[_0xd9ff('0x2a')](_0xd9ff('0xd8'),'abandon',0x194,'entity\x20not\x20found');_0x560ea2['sendStatus'](0x194);}else{if(_0x43a941[_0xd9ff('0x7e')]){throw new db[(_0xd9ff('0x97'))]['ValidationError'](_0xd9ff('0xd9'));}}return _0x43a941;})[_0xd9ff('0x22')](function(_0x7efe12){if(_0x7efe12){return _0x7efe12[_0xd9ff('0x3a')]({'closed':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xda')],'disposition':_0x5c4138[_0xd9ff('0x3f')][_0xd9ff('0xdb')]})[_0xd9ff('0x22')](function(_0x3b7aeb){return _0x3b7aeb;});}})[_0xd9ff('0x22')](function(_0x37eb49){return respondWithRpcPromise(_0xd9ff('0xdc'),_0xd9ff('0xdd'),_0x5c4138[_0xd9ff('0x3f')],client9004);})[_0xd9ff('0x22')](respondWithResult(_0x560ea2,null))[_0xd9ff('0x2d')](handleError(_0x560ea2,null));};exports[_0xd9ff('0xde')]=function(_0x3b05c4,_0x32c04e,_0x1bcf8f){_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0x3c')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe0')];_0x3b05c4[_0xd9ff('0x3f')][_0xd9ff('0xe1')]=_0x3b05c4[_0xd9ff('0xdf')][_0xd9ff('0xe2')];_0x3b05c4['body'][_0xd9ff('0x4c')]=_0x3b05c4[_0xd9ff('0xdf')]['mimetype'];return db[_0xd9ff('0xe3')][_0xd9ff('0xd5')](_0x3b05c4[_0xd9ff('0x3f')])[_0xd9ff('0x22')](respondWithResult(_0x32c04e,0xc9))[_0xd9ff('0x2d')](handleError(_0x32c04e,null));};exports[_0xd9ff('0xe4')]=function(_0x5978ad,_0x4ddfe7,_0x30c520){return db['ChatInteraction']['findOne']({'where':{'id':_0x5978ad[_0xd9ff('0xbe')]['id']},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null))['then'](function(_0x327362){if(_0x327362){if(_0x327362[_0xd9ff('0xda')]){return _0x4ddfe7[_0xd9ff('0x35')](0x193)[_0xd9ff('0x30')]({'status':0x193,'message':'Unauthorized'});}return db[_0xd9ff('0xe3')][_0xd9ff('0xc4')]({'where':{'id':_0x5978ad['query'][_0xd9ff('0xe5')]},'raw':!![]})[_0xd9ff('0x22')](handleEntityNotFound(_0x4ddfe7,null));}})['then'](function(_0x62f1f3){if(_0x62f1f3){var _0xd188cf=_0x62f1f3[_0xd9ff('0xe6')]!==null;var _0x5b2e9c=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],_0xd9ff('0xe9'));if(_0xd188cf){_0x5b2e9c=path['join'](_0x5b2e9c,_0xd9ff('0xea'));}var _0x53a25a=path[_0xd9ff('0xe7')](_0x5b2e9c,_0x62f1f3[_0xd9ff('0xe1')]);return _0x4ddfe7[_0xd9ff('0xeb')](_0x53a25a);}})[_0xd9ff('0x2d')](handleError(_0x4ddfe7,null));};exports[_0xd9ff('0xec')]=function(_0x10397d,_0x51039f){var _0x37ea50=null;var _0x3cf2ef=null;var _0x171195=null;var _0x24c066=null;if(_0x10397d[_0xd9ff('0x3f')]['id']){delete _0x10397d['body']['id'];}if(_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]){_0x24c066=path['join'](config[_0xd9ff('0xe8')],_0xd9ff('0xee'),util[_0xd9ff('0xef')](_0xd9ff('0xf0'),Date[_0xd9ff('0xf1')]()));_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xf2')]=_0x24c066;}return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x10397d[_0xd9ff('0xbe')]['id']},'include':[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'include':[{'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c')}]}]})[_0xd9ff('0x22')](handleEntityNotFound(_0x51039f,null))[_0xd9ff('0x22')](saveUpdates(_0x10397d['body'],null))['then'](function(_0x497e36){if(_0x497e36){_0x37ea50=_0x497e36;return db[_0xd9ff('0xc5')]['find']({'where':{'id':_0x37ea50[_0xd9ff('0x81')]}});}})['then'](function(_0x4d4cc0){if(_0x4d4cc0){_0x171195=_0x4d4cc0;return db['CmContact'][_0xd9ff('0xc0')]({'where':{'id':_0x37ea50['ContactId']}});}})['then'](function(_0x474b4c){if(_0x474b4c){_0x3cf2ef=_0x474b4c;if(_0x24c066){var _0x144cf7=null;for(var _0x9eac7f=0x1;_0x9eac7f<_0x37ea50[_0xd9ff('0xf3')][_0xd9ff('0x54')];++_0x9eac7f){_0x144cf7=_0x37ea50[_0xd9ff('0xf3')][_0x9eac7f];var _0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');var _0x4531bc=_0x10397d['body']['customer']||util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0xd9ff('0xf7'),_0x144cf7[_0xd9ff('0x76')]);switch(_0x171195[_0xd9ff('0xf8')]){case _0xd9ff('0xf9'):_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')]('%s%d',_0x171195[_0xd9ff('0xf5')],_0x144cf7[_0xd9ff('0x7e')]):_0xd9ff('0xf6');break;case _0xd9ff('0xfa'):_0x2450da=_0x144cf7['UserId']?_0x144cf7['User'][_0xd9ff('0xfb')]||_0x144cf7[_0xd9ff('0x7c')]['fullname']:_0xd9ff('0xf6');break;case _0xd9ff('0xfc'):_0x2450da=_0x144cf7['UserId']?_0x144cf7[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6');break;default:_0x2450da=_0x144cf7[_0xd9ff('0x7e')]?util[_0xd9ff('0xef')](_0xd9ff('0xf4'),_0x171195[_0xd9ff('0xf5')],_0x144cf7['UserId']):_0xd9ff('0xf6');}var _0x62b518=util[_0xd9ff('0xef')](_0xd9ff('0xfd'),moment(_0x144cf7[_0xd9ff('0x84')])['format'](_0xd9ff('0xfe')),_0x144cf7[_0xd9ff('0xff')]==='in'?_0x4531bc:_0x2450da,_0x144cf7[_0xd9ff('0x3f')]);if(!_0x144cf7['secret']){fs[_0xd9ff('0x100')](_0x24c066,_0x62b518);}}return db[_0xd9ff('0x101')][_0xd9ff('0xc4')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xd9ff('0x102'),'raw':!![]}]});}}})['then'](function(_0x5e07ae){if(_0x5e07ae&&_0x5e07ae['Smtp']&&_0x10397d['body']){var _0x578f41={'tls':{'rejectUnauthorized':![]}};if(_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')]){_0x578f41['service']=_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x103')];}else{_0x578f41[_0xd9ff('0x104')]=_0x5e07ae['Smtp'][_0xd9ff('0x104')];_0x578f41['port']=_0x5e07ae['Smtp'][_0xd9ff('0x105')];_0x578f41[_0xd9ff('0x106')]=_0x5e07ae[_0xd9ff('0x102')]['secure'];}if(_0x5e07ae['Smtp'][_0xd9ff('0x107')]){_0x578f41[_0xd9ff('0x108')]={'user':_0x5e07ae['Smtp'][_0xd9ff('0xa1')],'pass':_0x5e07ae[_0xd9ff('0x102')][_0xd9ff('0x109')]};}return respondWithRpcPromise(_0xd9ff('0x10a'),_0xd9ff('0x10b'),{'account':_0x578f41,'message':{'from':util[_0xd9ff('0xef')](_0xd9ff('0x10c'),_0x5e07ae['name'],_0x5e07ae[_0xd9ff('0xc9')]||_0x5e07ae[_0xd9ff('0x102')]['user']),'to':_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')],'subject':'Mail\x20Transcript','text':util[_0xd9ff('0xef')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x10397d[_0xd9ff('0x3f')][_0xd9ff('0xed')]),'attachments':[{'path':_0x24c066}]}})['then'](function(){return _0x37ea50;})[_0xd9ff('0x2d')](function(_0x4d6172){console[_0xd9ff('0x2a')](_0x4d6172);});}else{return _0x37ea50;}})[_0xd9ff('0x22')](respondWithStatusCode(_0x51039f,0xc8))[_0xd9ff('0x2d')](handleError(_0x51039f,null));};exports[_0xd9ff('0x10d')]=function(_0x6a2524,_0x356583,_0x5c1165){return db['ChatMessage'][_0xd9ff('0xc0')]({'where':{'id':_0x6a2524['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x356583,null))[_0xd9ff('0x22')](function(_0x599273){if(_0x599273){return _0x599273['addMessage'](_0x6a2524['body'][_0xd9ff('0x10e')],_[_0xd9ff('0x10f')](_0x6a2524[_0xd9ff('0x3f')],['ids','id'])||{});}})[_0xd9ff('0x22')](respondWithResult(_0x356583,null))[_0xd9ff('0x2d')](handleError(_0x356583,null));};exports[_0xd9ff('0x110')]=function(_0x2832b7,_0x618c47,_0x109140){var _0x278670={'raw':![],'where':{}};var _0x5e064d={};var _0x231b46={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0x2832b7[_0xd9ff('0xbe')]['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x618c47,null))[_0xd9ff('0x22')](function(_0x1802b1){if(_0x1802b1){_0x5e064d[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')][_0xd9ff('0x4a')]);_0x5e064d['query']=_['keys'](_0x2832b7[_0xd9ff('0x4e')]);_0x5e064d['filters']=_['intersection'](_0x5e064d[_0xd9ff('0x50')],_0x5e064d[_0xd9ff('0x4e')]);_0x278670[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x5e064d[_0xd9ff('0x50')],qs['fields'](_0x2832b7[_0xd9ff('0x4e')]['fields']));_0x278670[_0xd9ff('0x53')]=_0x278670[_0xd9ff('0x53')]['length']?_0x278670[_0xd9ff('0x53')]:_0x5e064d[_0xd9ff('0x50')];if(!_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x278670[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0x2832b7['query'][_0xd9ff('0x33')]);_0x278670[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x31')]);}_0x278670[_0xd9ff('0x9c')]=qs['sort'](_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x57')]);_0x278670[_0xd9ff('0x82')]=qs['filters'](_[_0xd9ff('0x58')](_0x2832b7['query'],_0x5e064d[_0xd9ff('0x4f')]));_0x278670['where'][_0xd9ff('0x111')]=_0x1802b1['id'];if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x278670['where']=_[_0xd9ff('0x3e')](_0x278670['where'],{'$or':_[_0xd9ff('0x79')](_0x278670[_0xd9ff('0x53')],function(_0x2b2a50){var _0x34f3f0={};_0x34f3f0[_0x2b2a50]={'$like':'%'+_0x2832b7[_0xd9ff('0x4e')]['filter']+'%'};return _0x34f3f0;})});}if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')]){var _0x955328=_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0x86')][_0xd9ff('0x46')](',');var _0x5d95b1={};_0x5d95b1[_0x955328[0x0]]={'$gte':moment(_0x955328[0x1])['format'](_0xd9ff('0x112'))};_0x278670[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x278670[_0xd9ff('0x82')],_0x5d95b1);}_0x278670=_[_0xd9ff('0x3e')]({},_0x278670,_0x2832b7[_0xd9ff('0x113')]);return db[_0xd9ff('0xd4')]['count']({'where':_0x278670[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x3e90fe){_0x231b46[_0xd9ff('0x34')]=_0x3e90fe;if(_0x2832b7[_0xd9ff('0x4e')][_0xd9ff('0xbf')]){_0x278670['include']=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x278670);})[_0xd9ff('0x22')](function(_0x33f933){_0x231b46[_0xd9ff('0x115')]=_0x33f933;return _0x231b46;});}})[_0xd9ff('0x22')](respondWithFilteredResult(_0x618c47,_0x278670))['catch'](handleError(_0x618c47,null));};exports['getMyMessages']=function(_0xf3a93b,_0x473ecf,_0x1213a4){var _0x6f731a={'where':{}},_0x193c57={},_0x4572b2={'count':0x0,'rows':[]};return db[_0xd9ff('0x49')][_0xd9ff('0xc4')]({'where':{'id':_0xf3a93b['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x473ecf,null))[_0xd9ff('0x22')](function(_0x4115a3){if(_0x4115a3){_0x193c57[_0xd9ff('0x50')]=_[_0xd9ff('0x4d')](db[_0xd9ff('0xd4')]['rawAttributes']);_0x193c57[_0xd9ff('0x4e')]=_['keys'](_0xf3a93b['query']);_0x193c57[_0xd9ff('0x4f')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],_0x193c57[_0xd9ff('0x4e')]);_0x6f731a[_0xd9ff('0x53')]=_[_0xd9ff('0x51')](_0x193c57[_0xd9ff('0x50')],qs[_0xd9ff('0x52')](_0xf3a93b['query'][_0xd9ff('0x52')]));_0x6f731a['attributes']=_0x6f731a[_0xd9ff('0x53')][_0xd9ff('0x54')]?_0x6f731a[_0xd9ff('0x53')]:_0x193c57[_0xd9ff('0x50')];if(!_0xf3a93b['query'][_0xd9ff('0x55')](_0xd9ff('0x56'))){_0x6f731a[_0xd9ff('0x33')]=qs[_0xd9ff('0x33')](_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x33')]);_0x6f731a[_0xd9ff('0x31')]=qs[_0xd9ff('0x31')](_0xf3a93b[_0xd9ff('0x4e')]['offset']);}_0x6f731a[_0xd9ff('0x9c')]=qs['sort'](_0xf3a93b['query'][_0xd9ff('0x57')]);_0x6f731a[_0xd9ff('0x82')]=qs[_0xd9ff('0x4f')](_[_0xd9ff('0x58')](_0xf3a93b[_0xd9ff('0x4e')],_0x193c57[_0xd9ff('0x4f')]));_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x111')]=_0x4115a3['id'];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x90')]){_0x6f731a[_0xd9ff('0x82')]=_[_0xd9ff('0x3e')](_0x6f731a['where'],{'$or':_[_0xd9ff('0x79')](_0x6f731a['attributes'],function(_0x1bb980){var _0x3ccf5d={};_0x3ccf5d[_0x1bb980]={'$like':'%'+_0xf3a93b['query']['filter']+'%'};return _0x3ccf5d;})});}_0x6f731a[_0xd9ff('0x82')][_0xd9ff('0x116')]=![];if(_0xf3a93b['query']['id']){_0x6f731a[_0xd9ff('0x82')]['id']={'$gt':_0xf3a93b[_0xd9ff('0x4e')]['id']};}_0x6f731a=_['merge']({},_0x6f731a,_0xf3a93b[_0xd9ff('0x113')]);return db['ChatMessage'][_0xd9ff('0x34')]({'where':_0x6f731a[_0xd9ff('0x82')]})[_0xd9ff('0x22')](function(_0x42d9ff){_0x4572b2[_0xd9ff('0x34')]=_0x42d9ff;_0x6f731a[_0xd9ff('0x117')]=[];if(_0xf3a93b[_0xd9ff('0x4e')][_0xd9ff('0x118')]){_0x6f731a[_0xd9ff('0x117')][_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43'),_0xd9ff('0xfb')]});}if(_0xf3a93b['query'][_0xd9ff('0xbf')]){_0x6f731a[_0xd9ff('0x117')]=[{'all':!![]}];}return db[_0xd9ff('0xd4')][_0xd9ff('0x114')](_0x6f731a);})[_0xd9ff('0x22')](function(_0x314f18){_0x4572b2['rows']=_0x314f18;return _0x4572b2;});}})['then'](respondWithFilteredResult(_0x473ecf,_0x6f731a))['catch'](handleError(_0x473ecf,null));};exports['addTags']=function(_0x4699d3,_0x2e91a8,_0x4956b2){return db[_0xd9ff('0x49')][_0xd9ff('0xc0')]({'where':{'id':_0x4699d3[_0xd9ff('0xbe')]['id']}})['then'](handleEntityNotFound(_0x2e91a8,null))['then'](function(_0x217023){if(_0x217023){return _0x217023[_0xd9ff('0x11a')](_0x4699d3['body']['ids'],_['omit'](_0x4699d3['body'],['ids','id'])||{})[_0xd9ff('0x11b')](function(){return db[_0xd9ff('0x11c')][_0xd9ff('0x114')]({'attributes':['id',_0xd9ff('0x3c'),_0xd9ff('0x5b')],'where':{'id':_0x4699d3[_0xd9ff('0x3f')][_0xd9ff('0x10e')]}});})[_0xd9ff('0x22')](function(_0x317f93){socket[_0xd9ff('0x11d')](_0xd9ff('0x11e'),{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]});return{'id':Number(_0x4699d3[_0xd9ff('0xbe')]['id']),'tags':_0x317f93||[]};});}})[_0xd9ff('0x22')](respondWithResult(_0x2e91a8,null))[_0xd9ff('0x2d')](handleError(_0x2e91a8,null));};exports[_0xd9ff('0x11f')]=function(_0x404baf,_0x5d73cd,_0xdb719b){return db['ChatInteraction'][_0xd9ff('0xc0')]({'where':{'id':_0x404baf['params']['id']}})[_0xd9ff('0x22')](handleEntityNotFound(_0x5d73cd,null))[_0xd9ff('0x22')](function(_0x10935d){if(_0x10935d){return _0x10935d['removeTags'](_0x404baf['query']['ids']);}})['then'](respondWithStatusCode(_0x5d73cd,null))['catch'](handleError(_0x5d73cd,null));};exports[_0xd9ff('0xeb')]=function(_0x2031e9,_0x3b50d9){var _0x410fae=moment()[_0xd9ff('0x120')]()[_0xd9ff('0xbb')]();var _0x494da6=path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server','files',_0xd9ff('0x121'));var _0x49c9cc=path[_0xd9ff('0xe7')](config['root'],_0xd9ff('0x122'),_0xd9ff('0x123'),'attachments');var _0x378746=path[_0xd9ff('0xe7')](_0x494da6,_0x410fae);var _0x2acbe3=util[_0xd9ff('0xef')]('transcript-%d-%s.zip',_0x2031e9['params']['id'],_0x410fae);var _0x46d12c=path[_0xd9ff('0xe7')](_0x494da6,_0x2acbe3);var _0x54f4aa=[];_0x54f4aa[_0xd9ff('0x119')]({'model':db['User'],'as':_0xd9ff('0x7c'),'attributes':['id',_0xd9ff('0x43')],'raw':!![]});_0x54f4aa[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x124')],'as':_0xd9ff('0x71'),'attributes':['id',_0xd9ff('0x125'),'lastName'],'raw':!![]});if(_0x2031e9['query'][_0xd9ff('0x126')]){_0x54f4aa['push']({'model':db[_0xd9ff('0xe3')],'as':'Attachment','raw':!![]});}var _0xd015e9=[{'model':db[_0xd9ff('0xd4')],'as':_0xd9ff('0xf3'),'attributes':['id','body',_0xd9ff('0x84'),_0xd9ff('0xff'),'secret','read'],'include':_0x54f4aa}];_0xd015e9['push']({'model':db[_0xd9ff('0xc5')],'as':_0xd9ff('0x127'),'attributes':['id',_0xd9ff('0x3c')]});_0xd015e9[_0xd9ff('0x119')]({'model':db[_0xd9ff('0x7c')],'as':_0xd9ff('0x128'),'attributes':['id',_0xd9ff('0x43')]});return db[_0xd9ff('0x49')]['find']({'where':{'id':_0x2031e9[_0xd9ff('0xbe')]['id']},'include':_0xd015e9})[_0xd9ff('0x22')](handleEntityNotFound(_0x3b50d9,null))[_0xd9ff('0x22')](function(_0x1b452e){if(_0x1b452e){var _0x3ab927=_0x1b452e[_0xd9ff('0x129')]({'plain':!![]});fs[_0xd9ff('0x12a')](_0x378746);var _0x2b6e15={'channel':_0xd9ff('0x12b'),'account':_0x3ab927['Account']['name'],'agent':_0x3ab927['Owner']?_0x3ab927[_0xd9ff('0x128')][_0xd9ff('0x43')]:'N.A.','createdAt':moment(_0x3ab927[_0xd9ff('0x84')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd9ff('0xbb')](),'closedAt':_0x3ab927[_0xd9ff('0xda')]?moment(_0x3ab927[_0xd9ff('0x12c')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')]():'','disposition':_0x3ab927['disposition'],'chatInfo':{'browser':_0x3ab927[_0xd9ff('0x12d')],'os':_0x3ab927[_0xd9ff('0x12e')],'referer':_0x3ab927[_0xd9ff('0x12f')],'customerIp':_0x3ab927[_0xd9ff('0x130')],'customerPort':_0x3ab927[_0xd9ff('0x131')]?_0x3ab927['customerPort']:'N.A.'},'messages':_(_0x3ab927[_0xd9ff('0xf3')])[_0xd9ff('0x132')]()[_0xd9ff('0x90')]({'secret':![]})[_0xd9ff('0x79')](function(_0x319248){if(_0x319248[_0xd9ff('0xe3')]){var _0x1ea603=path[_0xd9ff('0xe7')](_0x49c9cc,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')]);if(fs[_0xd9ff('0x133')](_0x1ea603)){fs[_0xd9ff('0x134')](_0x1ea603)[_0xd9ff('0x135')](fs['createWriteStream'](path[_0xd9ff('0xe7')](_0x378746,_0x319248[_0xd9ff('0xe3')][_0xd9ff('0xe1')])));}}return{'date':moment(_0x319248[_0xd9ff('0x84')])[_0xd9ff('0xef')](_0xd9ff('0x112'))[_0xd9ff('0xbb')](),'sender':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?_0x319248[_0xd9ff('0x7c')]?_0x319248[_0xd9ff('0x7c')][_0xd9ff('0x43')]:_0xd9ff('0xf6'):_0x319248['Contact'][_0xd9ff('0x125')]+(_0x319248[_0xd9ff('0x71')][_0xd9ff('0x136')]?'\x20'+_0x319248[_0xd9ff('0x71')]['lastName']:''),'body':_0x319248[_0xd9ff('0xe3')]?_0x319248['Attachment']['basename']:_0x319248[_0xd9ff('0x3f')],'direction':_0x319248[_0xd9ff('0xff')]===_0xd9ff('0xd3')?'A':'C','secret':_0x319248[_0xd9ff('0x116')],'read':_0x319248[_0xd9ff('0x8c')],'attachment':_0x319248[_0xd9ff('0xe3')]};})[_0xd9ff('0x6d')]()};return ejs['renderFile'](path[_0xd9ff('0xe7')](config[_0xd9ff('0xe8')],'server',_0xd9ff('0x137'),_0xd9ff('0x138')),{'interaction':_0x2b6e15})[_0xd9ff('0x22')](function(_0xb07a14){var _0x1c419f=path[_0xd9ff('0xe7')](_0x378746,_0xd9ff('0x139')+_0x3ab927['id']+'-'+_0x410fae+_0xd9ff('0x13a'));var _0x3156c8={'path':_0x1c419f,'channel':_0xd9ff('0x12b'),'interactionId':_0x3ab927['id']};return pdf[_0xd9ff('0x13b')](_0xb07a14,_0x3156c8);})['then'](function(){return new BPromise(function(_0x567007,_0x1019f9){zipdir(_0x378746,{'saveTo':_0x46d12c},function(_0x2ab78a,_0x4649d9){if(_0x2ab78a)return _0x1019f9(_0x2ab78a);return _0x567007(_0x4649d9);});})[_0xd9ff('0x22')](function(){return new BPromise(function(_0x166033,_0x3c40e4){rimraf(_0x378746,function(_0x346d93){if(_0x346d93)_0x3c40e4(_0x346d93);return _0x166033();});});})[_0xd9ff('0x22')](function(){return _0x3b50d9['download'](_0x46d12c,_0x2acbe3,function(_0x22680e){if(_0x22680e){console['log'](_0xd9ff('0x13c'),_0x22680e);}else{fs[_0xd9ff('0x13d')](_0x46d12c);}});});});}else{return _0x3b50d9['sendStatus'](0xc8);}})[_0xd9ff('0x2d')](handleError(_0x3b50d9,null));}; \ No newline at end of file +var _0xea28=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','sendStatus','stack','name','merge','contact','agent','interaction','account','Users','map','TagIds','Tags','split','forEach','index','ChatInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','u.id','ui.ChatInteractionId','from','user_has_chat_interactions','users','u.id\x20=\x20ui.UserId','chat_interactions','left_join','cm_contacts','o.id\x20=\x20i.UserId','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','me.ChatInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','search','parseSearch','conditions','find','unreadMessages','having','`\x20=\x200','Contact','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','role','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','groupBy','ChatInteractionId','push','all','params','includeAll','options','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','POST','https://api-vidaoo.xcally.com/api/v1/meetings','email','isNull','follow','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','entity\x20not\x20found','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','closed','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','now','pathTranscript','%s%d','agentAlias','System','customer','format','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','fullname','[%s]\x20%s:\x20%s\x0a','direction','appendFileSync','MailServerOut','Smtp','service','port','secure','authentication','auth','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','addMessage','ids','omit','getMessages','include','findAll','rows','getMyMessages','secret','includeAgent','addTags','setTags','spread','emit','removeTags','files','attachments','transcript-%d-%s.zip','firstName','lastName','Messages','read','Account','Chat','Owner','YYYY-MM-DD\x20HH:mm:ss','browserName','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.ejs','transcript-','log','unlinkSync','eml-format','rimraf','zip-dir'];(function(_0x4bc676,_0xa0df1c){var _0x4757e2=function(_0xe56289){while(--_0xe56289){_0x4bc676['push'](_0x4bc676['shift']());}};_0x4757e2(++_0xa0df1c);}(_0xea28,0x13a));var _0x8ea2=function(_0x375e36,_0x29c47a){_0x375e36=_0x375e36-0x0;var _0x4c8cfa=_0xea28[_0x375e36];return _0x4c8cfa;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x8ea2('0x16'));var logger=require(_0x8ea2('0x17'))(_0x8ea2('0x18'));var utils=require('../../config/utils');var config=require(_0x8ea2('0x19'));var licenseUtil=require(_0x8ea2('0x1a'));var db=require(_0x8ea2('0x1b'))['db'];config[_0x8ea2('0x1c')]=_[_0x8ea2('0x1d')](config['redis'],{'host':_0x8ea2('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8ea2('0x1f'))[_0x8ea2('0x20')](socket);var jayson=require(_0x8ea2('0x21'));var client=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232b});var client9004=jayson[_0x8ea2('0x22')][_0x8ea2('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x11f5e8,_0x474873,_0x396aab,_0x2dfa7c){return new BPromise(function(_0x1c1715,_0x3bc774){var _0xaa8abf=_0x2dfa7c||client;return _0xaa8abf[_0x8ea2('0x24')](_0x11f5e8,_0x396aab)[_0x8ea2('0x25')](function(_0x467045){logger[_0x8ea2('0x26')](_0x8ea2('0x27'),_0x474873,_0x8ea2('0x28'));logger[_0x8ea2('0x29')](_0x8ea2('0x2a'),_0x474873,'request\x20sent',JSON['stringify'](_0x467045));if(_0x467045[_0x8ea2('0x2b')]){if(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2c')]===0x1f4){logger['error'](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')]['message']);return _0x3bc774(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}logger[_0x8ea2('0x2b')](_0x8ea2('0x27'),_0x474873,_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);return _0x1c1715(_0x467045[_0x8ea2('0x2b')][_0x8ea2('0x2d')]);}else{logger[_0x8ea2('0x26')]('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x8ea2('0x28'));_0x1c1715(_0x467045['result'][_0x8ea2('0x2d')]);}})[_0x8ea2('0x2e')](function(_0x29b38f){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x474873,_0x29b38f);_0x3bc774(_0x29b38f);});});}function respondWithStatusCode(_0x2e4da3,_0x4dc7bf){_0x4dc7bf=_0x4dc7bf||0xcc;return function(_0x200a49){if(_0x200a49){return _0x2e4da3['sendStatus'](_0x4dc7bf);}return _0x2e4da3[_0x8ea2('0x2f')](_0x4dc7bf)[_0x8ea2('0x30')]();};}function respondWithResult(_0x21c526,_0x266db8){_0x266db8=_0x266db8||0xc8;return function(_0x4e1b90){if(_0x4e1b90){return _0x21c526['status'](_0x266db8)[_0x8ea2('0x31')](_0x4e1b90);}};}function respondWithFilteredResult(_0x4da5b3,_0x4a9875){return function(_0x287078){if(_0x287078){var _0x24f187=typeof _0x4a9875[_0x8ea2('0x32')]===_0x8ea2('0x33')&&typeof _0x4a9875[_0x8ea2('0x34')]===_0x8ea2('0x33');var _0x316707=_0x287078[_0x8ea2('0x35')];var _0x9c5fac=_0x24f187?0x0:_0x4a9875['offset'];var _0x5b7ff9=_0x24f187?_0x287078[_0x8ea2('0x35')]:_0x4a9875[_0x8ea2('0x32')]+_0x4a9875['limit'];var _0x4a110f;if(_0x5b7ff9>=_0x316707){_0x5b7ff9=_0x316707;_0x4a110f=0xc8;}else{_0x4a110f=0xce;}_0x4da5b3[_0x8ea2('0x2f')](_0x4a110f);return _0x4da5b3['set'](_0x8ea2('0x36'),_0x9c5fac+'-'+_0x5b7ff9+'/'+_0x316707)[_0x8ea2('0x31')](_0x287078);}return null;};}function patchUpdates(_0x53fd06){return function(_0x17b21c){try{jsonpatch[_0x8ea2('0x37')](_0x17b21c,_0x53fd06,!![]);}catch(_0x33abc8){return BPromise['reject'](_0x33abc8);}return _0x17b21c['save']();};}function saveUpdates(_0x49a252,_0x3880c3){return function(_0x233e12){if(_0x233e12){return _0x233e12[_0x8ea2('0x38')](_0x49a252)['then'](function(_0x456487){return _0x456487;});}return null;};}function removeEntity(_0x391b08,_0x3d5bf0){return function(_0x278e5d){if(_0x278e5d){return _0x278e5d[_0x8ea2('0x39')]()[_0x8ea2('0x25')](function(){_0x391b08[_0x8ea2('0x2f')](0xcc)[_0x8ea2('0x30')]();});}};}function handleEntityNotFound(_0x5e9b1f,_0x955ef3){return function(_0x29e3f5){if(!_0x29e3f5){_0x5e9b1f[_0x8ea2('0x3a')](0x194);}return _0x29e3f5;};}function handleError(_0x467d97,_0x4eebc1){_0x4eebc1=_0x4eebc1||0x1f4;return function(_0x2a1f14){logger['error'](_0x2a1f14[_0x8ea2('0x3b')]);if(_0x2a1f14[_0x8ea2('0x3c')]){delete _0x2a1f14[_0x8ea2('0x3c')];}_0x467d97[_0x8ea2('0x2f')](_0x4eebc1)['send'](_0x2a1f14);};}function getMustacheRender(_0x2bed24,_0x531979){return Mustache['render'](_0x2bed24,_[_0x8ea2('0x3d')](_0x531979['body'],{'contact':_0x531979[_0x8ea2('0x3e')],'message':_0x531979[_0x8ea2('0x2d')],'agent':_0x531979[_0x8ea2('0x3f')],'interaction':_0x531979[_0x8ea2('0x40')],'account':_0x531979[_0x8ea2('0x41')]}))||'';}function getInteractionUsers(_0x4ae536,_0x84685d){return new BPromise(function(_0x5c5d2d,_0x12a6c2){try{if(_0x84685d[_0x4ae536['id']]){_0x4ae536[_0x8ea2('0x42')]=_[_0x8ea2('0x43')](_0x84685d[_0x4ae536['id']],function(_0x3995ff){return{'id':_0x3995ff['id'],'fullname':_0x3995ff['fullname']};});}}catch(_0x44e8bc){_0x12a6c2(_0x44e8bc);}_0x5c5d2d(_0x4ae536);});}function getInteractionTags(_0x57a6b8,_0x3f0c78){return new BPromise(function(_0x5ba351,_0x2ee78b){try{if(_0x57a6b8[_0x8ea2('0x44')]){_0x57a6b8[_0x8ea2('0x45')]=[];_0x57a6b8[_0x8ea2('0x44')][_0x8ea2('0x46')](',')[_0x8ea2('0x47')](function(_0x2f4fa8){_0x57a6b8['Tags']['push'](_0x3f0c78[_0x2f4fa8]);});}delete _0x57a6b8[_0x8ea2('0x44')];}catch(_0x53455a){_0x2ee78b(_0x53455a);}_0x5ba351(_0x57a6b8);});}function updateChatInteraction(_0x4b03fa,_0x59e2fa,_0x3cbc09){return new BPromise(function(_0x5d9ba0,_0x40a532){return getInteractionUsers(_0x4b03fa,_0x3cbc09)[_0x8ea2('0x25')](function(_0x39c944){return getInteractionTags(_0x39c944,_0x59e2fa);})[_0x8ea2('0x25')](function(_0x989d9b){_0x5d9ba0(_0x989d9b);})[_0x8ea2('0x2e')](function(_0x3b2219){_0x40a532(_0x3b2219);});});}exports[_0x8ea2('0x48')]=function(_0x5352b9,_0x3afb80){var _0x1ef615={},_0x1db25c={},_0x5cb6ad={'count':0x0,'rows':[]};var _0x2d6bbb=_[_0x8ea2('0x43')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')],function(_0x20992d){return{'name':_0x20992d['fieldName'],'type':_0x20992d[_0x8ea2('0x4b')][_0x8ea2('0x4c')]};});_0x1db25c[_0x8ea2('0x4d')]=_['map'](_0x2d6bbb,_0x8ea2('0x3c'));_0x1db25c[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x5352b9[_0x8ea2('0x4e')]);_0x1db25c[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],_0x1db25c[_0x8ea2('0x4e')]);_0x1ef615[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x1db25c[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x1ef615['attributes']=_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x1ef615[_0x8ea2('0x52')]:_0x1db25c[_0x8ea2('0x4d')];if(!_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x55')](_0x8ea2('0x56'))){_0x1ef615[_0x8ea2('0x34')]=qs['limit'](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x34')]);_0x1ef615[_0x8ea2('0x32')]=qs['offset'](_0x5352b9['query'][_0x8ea2('0x32')]);}_0x1ef615[_0x8ea2('0x57')]=qs[_0x8ea2('0x58')](_0x5352b9['query'][_0x8ea2('0x58')]);_0x1ef615[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x5352b9[_0x8ea2('0x4e')],_0x1db25c['filters']),_0x2d6bbb);var _0x4afd85=[];var _0x24a22a=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x5c')]('id')['field'](_0x8ea2('0x3c'))[_0x8ea2('0x5c')](_0x8ea2('0x5d'))['from']('tools_tags');var _0x48aebf=squel['select']()['field'](_0x8ea2('0x5e'))[_0x8ea2('0x5c')]('u.fullname')['field'](_0x8ea2('0x5f'))[_0x8ea2('0x60')](_0x8ea2('0x61'),'ui')['left_join'](_0x8ea2('0x62'),'u',_0x8ea2('0x63'));var _0x59e3df=squel[_0x8ea2('0x5b')]()[_0x8ea2('0x60')](_0x8ea2('0x64'),'i')[_0x8ea2('0x65')](_0x8ea2('0x66'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join']('users','o',_0x8ea2('0x67'))[_0x8ea2('0x65')](_0x8ea2('0x68'),'a',_0x8ea2('0x69'))[_0x8ea2('0x65')](_0x8ea2('0x6a'),'me',_0x8ea2('0x6b'))['left_join']('chat_interaction_has_tags','it','it.ChatInteractionId\x20=\x20i.id')[_0x8ea2('0x65')](_0x8ea2('0x6c'),'t',_0x8ea2('0x6d'));var _0x2bbec0=squel['expr']();var _0x11824e=[];var _0x2b8662=squel['expr']();var _0x21485a;if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x6e')]){_0x21485a=as[_0x8ea2('0x6f')](_0x5352b9[_0x8ea2('0x4e')]['search']);var _0x479c05=_0x21485a['sqlOperator'];for(var _0x53a62c=0x0;_0x53a62c<_0x21485a[_0x8ea2('0x70')][_0x8ea2('0x54')];_0x53a62c++){var _0x2d8221=_0x21485a[_0x8ea2('0x70')][_0x53a62c];var _0x491d3d='i';var _0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x2d8221[_0x8ea2('0x5c')]]);if(!_0x461d32){switch(_0x2d8221['field']){case _0x8ea2('0x72'):if(_0x2d8221['value']==0x1){_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+_0x8ea2('0x74'));}else{_0x59e3df[_0x8ea2('0x73')]('`'+_0x2d8221['field']+'`\x20>\x200');}break;case _0x8ea2('0x75'):if(_0x2d8221['operator']===_0x8ea2('0x76')){if(_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')]('\x20')[_0x8ea2('0x54')]>0x1){_0x2bbec0[_0x479c05]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8ea2('0x78')](_0x2d8221[_0x8ea2('0x77')]),null);}else{var _0x39776d='%'+_0x2d8221[_0x8ea2('0x77')]+'%';_0x2bbec0[_0x479c05](_0x8ea2('0x79'),_0x39776d,_0x39776d,_0x39776d);}}else{_0x461d32=_[_0x8ea2('0x71')](_0x2d6bbb,[_0x8ea2('0x3c'),_0x8ea2('0x7a')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x7a');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db['text'],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);}break;case _0x8ea2('0x7d'):var _0x219f78=_0x2d8221[_0x8ea2('0x77')][_0x8ea2('0x46')](',')[_0x8ea2('0x43')](function(_0xefb7b){return Number(_0xefb7b);});_0x219f78[_0x8ea2('0x47')](function(_0x35cfc5){_0x2b8662['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x35cfc5+',%');});_0x11824e=_[_0x8ea2('0x7e')](_0x11824e,_0x219f78);break;case _0x8ea2('0x7f'):if(_0x2d8221[_0x8ea2('0x80')]===_0x8ea2('0x76')){_0x2bbec0[_0x479c05](_0x8ea2('0x81'),'%'+_0x2d8221['value']+'%',null);}else{_0x461d32=_['find'](_0x2d6bbb,['name',_0x8ea2('0x82')]);_0x2d8221[_0x8ea2('0x5c')]=_0x8ea2('0x82');_0x3d55db=as[_0x8ea2('0x7b')](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db['value'][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')]['end']);}break;case'body':_0x3d55db=as[_0x8ea2('0x7b')]('me',null,_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x30')]);break;}}else{var _0x3d55db=as['buildExpression'](_0x491d3d,_0x461d32[_0x8ea2('0x4b')],_0x2d8221);_0x2bbec0[_0x479c05](_0x3d55db[_0x8ea2('0x83')],_0x3d55db[_0x8ea2('0x77')][_0x8ea2('0x7c')],_0x3d55db['value'][_0x8ea2('0x30')]);}}}else{var _0x356099=_(_0x5352b9[_0x8ea2('0x4e')])['keys']()[_0x8ea2('0x43')](function(_0x5c2d05){return _['some'](_0x2d6bbb,[_0x8ea2('0x3c'),_0x5c2d05])?_0x5c2d05:undefined;})[_0x8ea2('0x84')]()['value']();if(!_['isEmpty'](_0x356099)){_0x356099['forEach'](function(_0x167f15){if(_0x167f15==='ChatWebsiteId'){_0x59e3df['where'](_0x8ea2('0x85'),[][_0x8ea2('0x86')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15]));}else if(_0x167f15===_0x8ea2('0x87')){var _0x1681d8=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x89')];var _0x14a5de=JSON[_0x8ea2('0x88')](_0x5352b9[_0x8ea2('0x4e')][_0x167f15])[_0x8ea2('0x8a')];_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0x8b'),_0x1681d8,_0x14a5de);}else{if(_0x5352b9['query'][_0x167f15]===_0x8ea2('0x8c')){_0x59e3df[_0x8ea2('0x59')]('i.'+_0x167f15+_0x8ea2('0x8d'));}else{_0x59e3df['where']('i.'+_0x167f15+_0x8ea2('0x8e'),_0x5352b9['query'][_0x167f15]);}}});}if(_0x5352b9[_0x8ea2('0x4e')]['read']){if(_0x5352b9[_0x8ea2('0x4e')]['read']==0x1){_0x59e3df[_0x8ea2('0x73')](_0x8ea2('0x8f'));}else{_0x59e3df['having'](_0x8ea2('0x90'));}}if(_0x5352b9['query'][_0x8ea2('0x91')]){_0x11824e=_[_0x8ea2('0x92')](_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x91')])?_0x5352b9[_0x8ea2('0x4e')]['tag']:new Array(_0x5352b9['query'][_0x8ea2('0x91')]);_0x11824e['forEach'](function(_0x410f78){_0x2b8662['or'](_0x8ea2('0x93'),'%,'+_0x410f78+',%');});}if(_0x5352b9[_0x8ea2('0x4e')][_0x8ea2('0x94')]){var _0x262cef=_0x5352b9[_0x8ea2('0x4e')]['filter']['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x8ea2('0x95')](_0x262cef)){_0x2bbec0['or']('i.id\x20LIKE\x20?',_0x262cef+'%');}else{_0x2bbec0['or'](_0x8ea2('0x96'),qs[_0x8ea2('0x78')](_0x262cef))['or'](_0x8ea2('0x97'),_0x262cef+'%');}}}_0x59e3df[_0x8ea2('0x59')](_0x2bbec0);_0x59e3df[_0x8ea2('0x98')](_0x8ea2('0x99'));var _0x4b4d64={'type':db[_0x8ea2('0x9a')][_0x8ea2('0x9b')][_0x8ea2('0x9c')],'raw':!![]};var _0x335a96=_0x59e3df[_0x8ea2('0x9d')]();_0x335a96['field']('i.id');_0x335a96[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));if(_0x1ef615[_0x8ea2('0x57')]){_0x1ef615[_0x8ea2('0x57')][_0x8ea2('0x47')](function(_0x2e0bbe){var _0x9c4960=_0x2e0bbe[0x0]===_0x8ea2('0x9f')?_0x2e0bbe[0x0]:'i.'+_0x2e0bbe[0x0];_0x59e3df[_0x8ea2('0x57')](_0x9c4960,_0x2e0bbe[0x1]===_0x8ea2('0xa0')?![]:!![]);});}if(!_[_0x8ea2('0xa1')](_0x11824e)){_0x59e3df[_0x8ea2('0x73')](_0x2b8662);_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa2'),_0x11824e);}BPromise[_0x8ea2('0xa3')]()[_0x8ea2('0x25')](function(){if(!_0x21485a){if(_0x5352b9['query']['ChatWebsiteId'])return;_0x335a96[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa4'));return;}if(_0x5352b9['user'][_0x8ea2('0xa5')]!=='agent')return;return _0x5352b9[_0x8ea2('0xa6')][_0x8ea2('0xa7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x17dee8){if(_[_0x8ea2('0xa1')](_0x17dee8)){_0x335a96[_0x8ea2('0x59')](_0x8ea2('0xa8'));_0x59e3df[_0x8ea2('0x59')](_0x8ea2('0xa8'));}else{_0x335a96[_0x8ea2('0x59')](_0x8ea2('0x85'),_[_0x8ea2('0x43')](_0x17dee8,'id'));_0x59e3df[_0x8ea2('0x59')]('i.ChatWebsiteId\x20IN\x20?',_[_0x8ea2('0x43')](_0x17dee8,'id'));}});})[_0x8ea2('0x25')](function(){if(_0x5352b9['user'][_0x8ea2('0xa5')]==='agent'&&!_0x21485a&&!_0x5352b9['query']['ChatWebsiteId'])return[];return db[_0x8ea2('0xa9')]['query'](_0x335a96[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x12ed20){_0x5cb6ad[_0x8ea2('0x35')]=_0x12ed20[_0x8ea2('0x54')];if(_0x5cb6ad[_0x8ea2('0x35')]===0x0)return[];return db['sequelize'][_0x8ea2('0x4e')](_0x24a22a['toString'](),_0x4b4d64)[_0x8ea2('0x25')](function(_0x18aa81){_0x4afd85=_[_0x8ea2('0xab')](_0x18aa81,'id');_0x4b4d64=_[_0x8ea2('0x3d')](_0x4b4d64,{'model':db[_0x8ea2('0x49')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5352b9['query'][_0x8ea2('0x53')]){_0x1ef615[_0x8ea2('0x52')][_0x8ea2('0x47')](function(_0x2a82b2){_0x59e3df[_0x8ea2('0x5c')]('i.'+_0x2a82b2);});}else{_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0x9e'),_0x8ea2('0x72'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xac'),_0x8ea2('0xad'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xae'),_0x8ea2('0xaf'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb0'),_0x8ea2('0x9f'));_0x59e3df['field'](_0x8ea2('0xb1'));_0x59e3df['field']('c.firstName',_0x8ea2('0xb2'));_0x59e3df[_0x8ea2('0x5c')]('c.lastName',_0x8ea2('0xb3'));_0x59e3df[_0x8ea2('0x5c')]('c.email',_0x8ea2('0xb4'));_0x59e3df[_0x8ea2('0x5c')]('c.phone',_0x8ea2('0xb5'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb6'),_0x8ea2('0xb7'));_0x59e3df[_0x8ea2('0x5c')]('c.fax',_0x8ea2('0xb8'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xb9'),_0x8ea2('0xba'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbb'),_0x8ea2('0xbc'));_0x59e3df[_0x8ea2('0x5c')](_0x8ea2('0xbd'),'TagIds');}if(_0x1ef615[_0x8ea2('0x34')])_0x59e3df['limit'](_0x1ef615[_0x8ea2('0x34')]);if(_0x1ef615[_0x8ea2('0x32')])_0x59e3df[_0x8ea2('0x32')](_0x1ef615[_0x8ea2('0x32')]);return db[_0x8ea2('0xa9')]['query'](_0x59e3df[_0x8ea2('0xaa')](),_0x4b4d64);})[_0x8ea2('0x25')](function(_0x4fdd16){if(_0x4fdd16['length']>0x0)_0x48aebf[_0x8ea2('0x59')](_0x8ea2('0xbe'),_['map'](_0x4fdd16,'id'));return db['sequelize'][_0x8ea2('0x4e')](_0x48aebf[_0x8ea2('0xaa')](),_0x4b4d64)['then'](function(_0x2b7e80){var _0x2f6673=_[_0x8ea2('0xbf')](_0x2b7e80,_0x8ea2('0xc0'));var _0xdf4de9=[];_0x4fdd16['forEach'](function(_0x2e3a5d){_0xdf4de9[_0x8ea2('0xc1')](updateChatInteraction(_0x2e3a5d,_0x4afd85,_0x2f6673));});return BPromise[_0x8ea2('0xc2')](_0xdf4de9);});});})[_0x8ea2('0x25')](function(_0x412af1){_0x5cb6ad['rows']=_0x412af1;return _0x5cb6ad;})[_0x8ea2('0x25')](respondWithFilteredResult(_0x3afb80,_0x1ef615))['catch'](handleError(_0x3afb80,null));};exports['show']=function(_0x9468be,_0x17e9fc){var _0x5c95ec={'raw':![],'where':{'id':_0x9468be[_0x8ea2('0xc3')]['id']}},_0x239516={};_0x239516[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db[_0x8ea2('0x49')][_0x8ea2('0x4a')]);_0x239516['query']=_[_0x8ea2('0x4f')](_0x9468be[_0x8ea2('0x4e')]);_0x239516[_0x8ea2('0x50')]=_['intersection'](_0x239516[_0x8ea2('0x4d')],_0x239516[_0x8ea2('0x4e')]);_0x5c95ec[_0x8ea2('0x52')]=_[_0x8ea2('0x51')](_0x239516[_0x8ea2('0x4d')],qs['fields'](_0x9468be[_0x8ea2('0x4e')][_0x8ea2('0x53')]));_0x5c95ec[_0x8ea2('0x52')]=_0x5c95ec[_0x8ea2('0x52')]['length']?_0x5c95ec['attributes']:_0x239516[_0x8ea2('0x4d')];if(_0x9468be['query'][_0x8ea2('0xc4')]){_0x5c95ec['include']=[{'all':!![]}];}_0x5c95ec=_[_0x8ea2('0x3d')]({},_0x5c95ec,_0x9468be[_0x8ea2('0xc5')]);return db[_0x8ea2('0x49')][_0x8ea2('0x71')](_0x5c95ec)[_0x8ea2('0x25')](handleEntityNotFound(_0x17e9fc,null))[_0x8ea2('0x25')](respondWithResult(_0x17e9fc,null))[_0x8ea2('0x2e')](handleError(_0x17e9fc,null));};exports['create']=function(_0x2c5677,_0x224fca){return db[_0x8ea2('0x49')][_0x8ea2('0xc6')](_0x2c5677[_0x8ea2('0xc7')],{})[_0x8ea2('0x25')](respondWithResult(_0x224fca,0xc9))['catch'](handleError(_0x224fca,null));};exports[_0x8ea2('0x38')]=function(_0x463372,_0x76085){if(_0x463372[_0x8ea2('0xc7')]['id']){delete _0x463372['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x463372[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x76085,null))[_0x8ea2('0x25')](saveUpdates(_0x463372['body'],null))[_0x8ea2('0x25')](respondWithResult(_0x76085,null))[_0x8ea2('0x2e')](handleError(_0x76085,null));};exports[_0x8ea2('0x39')]=function(_0x500b47,_0x331019){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x500b47[_0x8ea2('0xc3')]['id']}})['then'](handleEntityNotFound(_0x331019,null))['then'](removeEntity(_0x331019,null))[_0x8ea2('0x2e')](handleError(_0x331019,null));};exports[_0x8ea2('0xc8')]=function(_0x405020,_0x5c9359){return db[_0x8ea2('0x49')][_0x8ea2('0xc8')]()[_0x8ea2('0x25')](respondWithResult(_0x5c9359,null))[_0x8ea2('0x2e')](handleError(_0x5c9359,null));};exports[_0x8ea2('0xc9')]=function(_0x11c59e,_0x11b02a){var _0x5ab2c4=_0x11c59e[_0x8ea2('0xc3')]['id'];var _0x111f97;var _0xf76d70;var _0x384500;return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x5ab2c4}})[_0x8ea2('0x25')](function(_0x568581){_0x111f97=_0x568581;return db[_0x8ea2('0xcb')][_0x8ea2('0xca')]({'where':{'id':_0x568581[_0x8ea2('0xcc')]},'attributes':['id',_0x8ea2('0xcd'),_0x8ea2('0xce'),'vidaooTopic',_0x8ea2('0xcf'),_0x8ea2('0xd0')],'raw':!![]});})[_0x8ea2('0x25')](function(_0x1c336e){if(_0x1c336e&&_0x1c336e[_0x8ea2('0xcd')]&&_0x1c336e[_0x8ea2('0xce')]){_0xf76d70=_0x1c336e;var _0x473ae2={'interaction':{'id':_0x5ab2c4},'agent':{'id':_0x11c59e[_0x8ea2('0xa6')]['id'],'name':_0x11c59e[_0x8ea2('0xa6')]['name'],'fullname':_0x11c59e['user']['fullname'],'email':_0x11c59e[_0x8ea2('0xa6')]['email']},'contact':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x3e')],'account':_0x11c59e[_0x8ea2('0xc7')][_0x8ea2('0x41')]};var _0x6c0ccc={'rejectUnauthorized':![],'method':_0x8ea2('0xd1'),'url':_0x8ea2('0xd2'),'headers':{'X-APIKEY':_0x1c336e[_0x8ea2('0xcd')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x11c59e[_0x8ea2('0xa6')][_0x8ea2('0xd3')]],'buttons':null,'topic':_0xf76d70['vidaooTopic'],'note':_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xcf')])?null:getMustacheRender(_0xf76d70[_0x8ea2('0xcf')],_0x473ae2),'metadata':null},'redirect':_0x8ea2('0xd5'),'json':!![]};try{if(!_[_0x8ea2('0xd4')](_0xf76d70[_0x8ea2('0xd0')])){var _0xc6888c=getMustacheRender(_0xf76d70[_0x8ea2('0xd0')],_0x473ae2);var _0x152d46=JSON[_0x8ea2('0x88')](_0xc6888c);_0x6c0ccc[_0x8ea2('0xc7')][_0x8ea2('0xd6')]=_0x152d46;}}catch(_0x465e7f){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xd8'));}return rp(_0x6c0ccc);}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError']('Error\x20in\x20Vidaoo\x20configuration');}})['then'](function(_0x4b2c0f){_0x384500=_0x4b2c0f;if(_0x384500['id']){var _0x2fcddc={'body':_0x384500[_0x8ea2('0xd9')],'ChatWebsiteId':_0xf76d70['id'],'ChatInteractionId':_0x111f97['id'],'direction':'out','UserId':_0x11c59e[_0x8ea2('0xa6')]['id']};return db[_0x8ea2('0xda')][_0x8ea2('0xc6')](_0x2fcddc,{});}else{throw new db[(_0x8ea2('0x9a'))]['ValidationError'](_0x8ea2('0xdb'));}})['then'](function(){return _0x111f97[_0x8ea2('0xdc')]({'vidaooSessionId':_0x384500['id']});})[_0x8ea2('0x25')](respondWithResult(_0x11b02a,null))[_0x8ea2('0x2e')](handleError(_0x11b02a,null));};exports[_0x8ea2('0xdd')]=function(_0x3b6b03,_0x3292bc){if(_0x3b6b03['body']['id']){delete _0x3b6b03['body']['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x3b6b03['params']['id']},'include':[{'model':db[_0x8ea2('0xde')],'as':'Contact'}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x3292bc,null))[_0x8ea2('0x25')](saveUpdates(_0x3b6b03[_0x8ea2('0xc7')],null))[_0x8ea2('0x25')](respondWithResult(_0x3292bc,null))[_0x8ea2('0x2e')](handleError(_0x3292bc,null));};exports[_0x8ea2('0xdf')]=function(_0x1383b4,_0x4c1b9d,_0x3f3822){if(_0x1383b4[_0x8ea2('0xc7')]['id']){delete _0x1383b4[_0x8ea2('0xc7')]['id'];}return db[_0x8ea2('0x49')][_0x8ea2('0x71')]({'where':{'id':_0x1383b4[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](function(_0x1c974d){if(!_0x1c974d){logger[_0x8ea2('0x2b')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x8ea2('0xdf'),0x194,_0x8ea2('0xe0'));_0x4c1b9d[_0x8ea2('0x3a')](0x194);}else{if(_0x1c974d['UserId']){throw new db[(_0x8ea2('0x9a'))][(_0x8ea2('0xd7'))](_0x8ea2('0xe1'));}}return _0x1c974d;})[_0x8ea2('0x25')](function(_0xe18090){if(_0xe18090){return _0xe18090[_0x8ea2('0x38')]({'closed':_0x1383b4['body']['closed'],'disposition':_0x1383b4[_0x8ea2('0xc7')][_0x8ea2('0xe2')]})[_0x8ea2('0x25')](function(_0x695f4a){return _0x695f4a;});}})[_0x8ea2('0x25')](function(_0x57ff72){return respondWithRpcPromise(_0x8ea2('0xe3'),'abandon',_0x1383b4[_0x8ea2('0xc7')],client9004);})[_0x8ea2('0x25')](respondWithResult(_0x4c1b9d,null))['catch'](handleError(_0x4c1b9d,null));};exports[_0x8ea2('0xe4')]=function(_0x254b51,_0x2c11d2,_0x2aaa88){_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x3c')]=_0x254b51[_0x8ea2('0xe5')][_0x8ea2('0xe6')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0xe7')]=_0x254b51['file'][_0x8ea2('0xe8')];_0x254b51[_0x8ea2('0xc7')][_0x8ea2('0x4b')]=_0x254b51['file'][_0x8ea2('0xe9')];return db['Attachment'][_0x8ea2('0xc6')](_0x254b51[_0x8ea2('0xc7')])[_0x8ea2('0x25')](respondWithResult(_0x2c11d2,0xc9))[_0x8ea2('0x2e')](handleError(_0x2c11d2,null));};exports[_0x8ea2('0xea')]=function(_0x1786ac,_0x7a45a8,_0x3a68e2){return db[_0x8ea2('0x49')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0xc3')]['id']},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null))[_0x8ea2('0x25')](function(_0x8d4abd){if(_0x8d4abd){if(_0x8d4abd[_0x8ea2('0xeb')]){return _0x7a45a8[_0x8ea2('0x2f')](0x193)[_0x8ea2('0x31')]({'status':0x193,'message':_0x8ea2('0xec')});}return db[_0x8ea2('0xed')]['findOne']({'where':{'id':_0x1786ac[_0x8ea2('0x4e')][_0x8ea2('0xee')]},'raw':!![]})[_0x8ea2('0x25')](handleEntityNotFound(_0x7a45a8,null));}})[_0x8ea2('0x25')](function(_0xcbb6b3){if(_0xcbb6b3){var _0x4bdbe0=_0xcbb6b3[_0x8ea2('0xef')]!==null;var _0x44791f=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf2'));if(_0x4bdbe0){_0x44791f=path['join'](_0x44791f,_0x8ea2('0xf3'));}var _0x4e7aff=path[_0x8ea2('0xf0')](_0x44791f,_0xcbb6b3[_0x8ea2('0xe7')]);return _0x7a45a8[_0x8ea2('0xf4')](_0x4e7aff);}})['catch'](handleError(_0x7a45a8,null));};exports[_0x8ea2('0xf5')]=function(_0x48a2e2,_0x4e804c){var _0x487bab=null;var _0x1a0966=null;var _0x50087b=null;var _0x196b89=null;if(_0x48a2e2[_0x8ea2('0xc7')]['id']){delete _0x48a2e2[_0x8ea2('0xc7')]['id'];}if(_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')]){_0x196b89=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],_0x8ea2('0xf7'),util['format']('transcript-%s.txt',Date[_0x8ea2('0xf8')]()));_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf9')]=_0x196b89;}return db['ChatInteraction']['find']({'where':{'id':_0x48a2e2['params']['id']},'include':[{'model':db[_0x8ea2('0xda')],'as':'Messages','include':[{'model':db['User'],'as':_0x8ea2('0x7f')}]}]})[_0x8ea2('0x25')](handleEntityNotFound(_0x4e804c,null))['then'](saveUpdates(_0x48a2e2['body'],null))[_0x8ea2('0x25')](function(_0x48eac8){if(_0x48eac8){_0x487bab=_0x48eac8;return db['ChatWebsite'][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0xcc')]}});}})[_0x8ea2('0x25')](function(_0x54da21){if(_0x54da21){_0x50087b=_0x54da21;return db[_0x8ea2('0xde')][_0x8ea2('0x71')]({'where':{'id':_0x487bab[_0x8ea2('0x7a')]}});}})[_0x8ea2('0x25')](function(_0x3a43d5){if(_0x3a43d5){_0x1a0966=_0x3a43d5;if(_0x196b89){var _0x535b01=null;for(var _0x22e4cd=0x1;_0x22e4cd<_0x487bab['Messages'][_0x8ea2('0x54')];++_0x22e4cd){_0x535b01=_0x487bab['Messages'][_0x22e4cd];var _0x230a70=_0x535b01['UserId']?util['format'](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');var _0x332670=_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xfd')]||util[_0x8ea2('0xfe')]('%s%d',_0x8ea2('0xff'),_0x535b01[_0x8ea2('0x7a')]);switch(_0x50087b[_0x8ea2('0x100')]){case _0x8ea2('0x101'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?util['format'](_0x8ea2('0xfa'),_0x50087b['agentAlias'],_0x535b01[_0x8ea2('0x82')]):'System';break;case _0x8ea2('0x102'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01[_0x8ea2('0x7f')][_0x8ea2('0x103')]||_0x535b01['User']['fullname']:'System';break;case _0x8ea2('0x104'):_0x230a70=_0x535b01[_0x8ea2('0x82')]?_0x535b01['User'][_0x8ea2('0x105')]:_0x8ea2('0xfc');break;default:_0x230a70=_0x535b01[_0x8ea2('0x82')]?util[_0x8ea2('0xfe')](_0x8ea2('0xfa'),_0x50087b[_0x8ea2('0xfb')],_0x535b01[_0x8ea2('0x82')]):_0x8ea2('0xfc');}var _0x422280=util[_0x8ea2('0xfe')](_0x8ea2('0x106'),moment(_0x535b01[_0x8ea2('0x87')])[_0x8ea2('0xfe')]('MM/DD/YYYY\x20HH:mm:ss'),_0x535b01[_0x8ea2('0x107')]==='in'?_0x332670:_0x230a70,_0x535b01['body']);if(!_0x535b01['secret']){fs[_0x8ea2('0x108')](_0x196b89,_0x422280);}}return db['MailAccount'][_0x8ea2('0xca')]({'where':{'service':!![]},'include':[{'model':db[_0x8ea2('0x109')],'as':_0x8ea2('0x10a'),'raw':!![]}]});}}})[_0x8ea2('0x25')](function(_0xff0fae){if(_0xff0fae&&_0xff0fae['Smtp']&&_0x48a2e2[_0x8ea2('0xc7')]){var _0x3f5688={'tls':{'rejectUnauthorized':![]}};if(_0xff0fae[_0x8ea2('0x10a')]['service']){_0x3f5688['service']=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10b')];}else{_0x3f5688['host']=_0xff0fae[_0x8ea2('0x10a')]['host'];_0x3f5688[_0x8ea2('0x10c')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10c')];_0x3f5688[_0x8ea2('0x10d')]=_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10d')];}if(_0xff0fae[_0x8ea2('0x10a')][_0x8ea2('0x10e')]){_0x3f5688[_0x8ea2('0x10f')]={'user':_0xff0fae['Smtp']['user'],'pass':_0xff0fae[_0x8ea2('0x10a')]['pass']};}return respondWithRpcPromise(_0x8ea2('0x110'),_0x8ea2('0x111'),{'account':_0x3f5688,'message':{'from':util[_0x8ea2('0xfe')](_0x8ea2('0x112'),_0xff0fae['name'],_0xff0fae[_0x8ea2('0xd3')]||_0xff0fae[_0x8ea2('0x10a')]['user']),'to':_0x48a2e2[_0x8ea2('0xc7')][_0x8ea2('0xf6')],'subject':_0x8ea2('0x113'),'text':util['format']('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x48a2e2['body'][_0x8ea2('0xf6')]),'attachments':[{'path':_0x196b89}]}})['then'](function(){return _0x487bab;})[_0x8ea2('0x2e')](function(_0x488acb){console[_0x8ea2('0x2b')](_0x488acb);});}else{return _0x487bab;}})[_0x8ea2('0x25')](respondWithStatusCode(_0x4e804c,0xc8))[_0x8ea2('0x2e')](handleError(_0x4e804c,null));};exports[_0x8ea2('0x114')]=function(_0x54925a,_0x295339,_0x55c23c){return db['ChatMessage']['find']({'where':{'id':_0x54925a[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x295339,null))[_0x8ea2('0x25')](function(_0x48b51d){if(_0x48b51d){return _0x48b51d[_0x8ea2('0x114')](_0x54925a[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x54925a[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{});}})[_0x8ea2('0x25')](respondWithResult(_0x295339,null))[_0x8ea2('0x2e')](handleError(_0x295339,null));};exports[_0x8ea2('0x117')]=function(_0x102d70,_0x2b014d,_0xc35654){var _0x355b91={'raw':![],'where':{}};var _0x1cf414={};var _0x48e543={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x8ea2('0xca')]({'where':{'id':_0x102d70['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x2b014d,null))[_0x8ea2('0x25')](function(_0x3ebbc8){if(_0x3ebbc8){_0x1cf414['model']=_[_0x8ea2('0x4f')](db['ChatMessage']['rawAttributes']);_0x1cf414[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x102d70[_0x8ea2('0x4e')]);_0x1cf414[_0x8ea2('0x50')]=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],_0x1cf414[_0x8ea2('0x4e')]);_0x355b91['attributes']=_[_0x8ea2('0x51')](_0x1cf414[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x102d70['query'][_0x8ea2('0x53')]));_0x355b91[_0x8ea2('0x52')]=_0x355b91[_0x8ea2('0x52')]['length']?_0x355b91[_0x8ea2('0x52')]:_0x1cf414[_0x8ea2('0x4d')];if(!_0x102d70[_0x8ea2('0x4e')]['hasOwnProperty']('nolimit')){_0x355b91[_0x8ea2('0x34')]=qs['limit'](_0x102d70[_0x8ea2('0x4e')]['limit']);_0x355b91[_0x8ea2('0x32')]=qs[_0x8ea2('0x32')](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x32')]);}_0x355b91[_0x8ea2('0x57')]=qs['sort'](_0x102d70[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x355b91[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_[_0x8ea2('0x5a')](_0x102d70[_0x8ea2('0x4e')],_0x1cf414['filters']));_0x355b91['where'][_0x8ea2('0xc0')]=_0x3ebbc8['id'];if(_0x102d70[_0x8ea2('0x4e')]['filter']){_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],{'$or':_[_0x8ea2('0x43')](_0x355b91['attributes'],function(_0x19ea2b){var _0x4450e8={};_0x4450e8[_0x19ea2b]={'$like':'%'+_0x102d70['query'][_0x8ea2('0x94')]+'%'};return _0x4450e8;})});}if(_0x102d70['query'][_0x8ea2('0x89')]){var _0x479b40=_0x102d70['query'][_0x8ea2('0x89')][_0x8ea2('0x46')](',');var _0xbb5964={};_0xbb5964[_0x479b40[0x0]]={'$gte':moment(_0x479b40[0x1])[_0x8ea2('0xfe')]('YYYY-MM-DD\x20HH:mm:ss')};_0x355b91[_0x8ea2('0x59')]=_[_0x8ea2('0x3d')](_0x355b91[_0x8ea2('0x59')],_0xbb5964);}_0x355b91=_['merge']({},_0x355b91,_0x102d70[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x355b91[_0x8ea2('0x59')]})[_0x8ea2('0x25')](function(_0x46d38e){_0x48e543[_0x8ea2('0x35')]=_0x46d38e;if(_0x102d70['query'][_0x8ea2('0xc4')]){_0x355b91[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x355b91);})[_0x8ea2('0x25')](function(_0x23f247){_0x48e543[_0x8ea2('0x11a')]=_0x23f247;return _0x48e543;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x2b014d,_0x355b91))[_0x8ea2('0x2e')](handleError(_0x2b014d,null));};exports[_0x8ea2('0x11b')]=function(_0x3a37fb,_0x455009,_0x556919){var _0x58a0e5={'where':{}},_0x3be2ce={},_0x56a973={'count':0x0,'rows':[]};return db[_0x8ea2('0x49')][_0x8ea2('0xca')]({'where':{'id':_0x3a37fb[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x455009,null))[_0x8ea2('0x25')](function(_0x515381){if(_0x515381){_0x3be2ce[_0x8ea2('0x4d')]=_[_0x8ea2('0x4f')](db['ChatMessage'][_0x8ea2('0x4a')]);_0x3be2ce[_0x8ea2('0x4e')]=_[_0x8ea2('0x4f')](_0x3a37fb[_0x8ea2('0x4e')]);_0x3be2ce['filters']=_[_0x8ea2('0x51')](_0x3be2ce[_0x8ea2('0x4d')],_0x3be2ce[_0x8ea2('0x4e')]);_0x58a0e5[_0x8ea2('0x52')]=_['intersection'](_0x3be2ce[_0x8ea2('0x4d')],qs[_0x8ea2('0x53')](_0x3a37fb[_0x8ea2('0x4e')]['fields']));_0x58a0e5[_0x8ea2('0x52')]=_0x58a0e5[_0x8ea2('0x52')][_0x8ea2('0x54')]?_0x58a0e5['attributes']:_0x3be2ce['model'];if(!_0x3a37fb[_0x8ea2('0x4e')]['hasOwnProperty'](_0x8ea2('0x56'))){_0x58a0e5[_0x8ea2('0x34')]=qs[_0x8ea2('0x34')](_0x3a37fb[_0x8ea2('0x4e')]['limit']);_0x58a0e5[_0x8ea2('0x32')]=qs['offset'](_0x3a37fb['query']['offset']);}_0x58a0e5['order']=qs[_0x8ea2('0x58')](_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x58')]);_0x58a0e5[_0x8ea2('0x59')]=qs[_0x8ea2('0x50')](_['pick'](_0x3a37fb['query'],_0x3be2ce[_0x8ea2('0x50')]));_0x58a0e5['where']['ChatInteractionId']=_0x515381['id'];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]){_0x58a0e5[_0x8ea2('0x59')]=_['merge'](_0x58a0e5[_0x8ea2('0x59')],{'$or':_['map'](_0x58a0e5[_0x8ea2('0x52')],function(_0x4041ec){var _0x56178b={};_0x56178b[_0x4041ec]={'$like':'%'+_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x94')]+'%'};return _0x56178b;})});}_0x58a0e5['where'][_0x8ea2('0x11c')]=![];if(_0x3a37fb[_0x8ea2('0x4e')]['id']){_0x58a0e5[_0x8ea2('0x59')]['id']={'$gt':_0x3a37fb[_0x8ea2('0x4e')]['id']};}_0x58a0e5=_[_0x8ea2('0x3d')]({},_0x58a0e5,_0x3a37fb[_0x8ea2('0xc5')]);return db[_0x8ea2('0xda')][_0x8ea2('0x35')]({'where':_0x58a0e5[_0x8ea2('0x59')]})['then'](function(_0xcedece){_0x56a973['count']=_0xcedece;_0x58a0e5[_0x8ea2('0x118')]=[];if(_0x3a37fb[_0x8ea2('0x4e')][_0x8ea2('0x11d')]){_0x58a0e5[_0x8ea2('0x118')][_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':_0x8ea2('0x7f'),'attributes':['id',_0x8ea2('0x105'),'alias']});}if(_0x3a37fb['query'][_0x8ea2('0xc4')]){_0x58a0e5[_0x8ea2('0x118')]=[{'all':!![]}];}return db[_0x8ea2('0xda')][_0x8ea2('0x119')](_0x58a0e5);})[_0x8ea2('0x25')](function(_0x52bf7c){_0x56a973[_0x8ea2('0x11a')]=_0x52bf7c;return _0x56a973;});}})[_0x8ea2('0x25')](respondWithFilteredResult(_0x455009,_0x58a0e5))['catch'](handleError(_0x455009,null));};exports[_0x8ea2('0x11e')]=function(_0x3be5d0,_0x3ac848,_0x52ce76){return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x3be5d0['params']['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x3ac848,null))[_0x8ea2('0x25')](function(_0x1030c9){if(_0x1030c9){return _0x1030c9[_0x8ea2('0x11f')](_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')],_[_0x8ea2('0x116')](_0x3be5d0[_0x8ea2('0xc7')],[_0x8ea2('0x115'),'id'])||{})[_0x8ea2('0x120')](function(){return db[_0x8ea2('0x7d')][_0x8ea2('0x119')]({'attributes':['id',_0x8ea2('0x3c'),_0x8ea2('0x5d')],'where':{'id':_0x3be5d0[_0x8ea2('0xc7')][_0x8ea2('0x115')]}});})[_0x8ea2('0x25')](function(_0x452b94){socket[_0x8ea2('0x121')]('chatInteractionTags:save',{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]});return{'id':Number(_0x3be5d0['params']['id']),'tags':_0x452b94||[]};});}})[_0x8ea2('0x25')](respondWithResult(_0x3ac848,null))[_0x8ea2('0x2e')](handleError(_0x3ac848,null));};exports[_0x8ea2('0x122')]=function(_0x9410dd,_0x497671,_0x5e3e8d){return db[_0x8ea2('0x49')]['find']({'where':{'id':_0x9410dd[_0x8ea2('0xc3')]['id']}})[_0x8ea2('0x25')](handleEntityNotFound(_0x497671,null))[_0x8ea2('0x25')](function(_0x19b042){if(_0x19b042){return _0x19b042[_0x8ea2('0x122')](_0x9410dd[_0x8ea2('0x4e')][_0x8ea2('0x115')]);}})['then'](respondWithStatusCode(_0x497671,null))[_0x8ea2('0x2e')](handleError(_0x497671,null));};exports[_0x8ea2('0xf4')]=function(_0x2dc450,_0x34e1c5){var _0x5b929c=moment()['unix']()[_0x8ea2('0xaa')]();var _0x263123=path[_0x8ea2('0xf0')](config['root'],'server',_0x8ea2('0x123'),'tmp');var _0x40e8e6=path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x123'),_0x8ea2('0x124'));var _0x2dfabc=path[_0x8ea2('0xf0')](_0x263123,_0x5b929c);var _0x515049=util['format'](_0x8ea2('0x125'),_0x2dc450[_0x8ea2('0xc3')]['id'],_0x5b929c);var _0x39000d=path['join'](_0x263123,_0x515049);var _0x3a1752=[];_0x3a1752['push']({'model':db[_0x8ea2('0x7f')],'as':'User','attributes':['id',_0x8ea2('0x105')],'raw':!![]});_0x3a1752['push']({'model':db[_0x8ea2('0xde')],'as':_0x8ea2('0x75'),'attributes':['id',_0x8ea2('0x126'),_0x8ea2('0x127')],'raw':!![]});if(_0x2dc450['query'][_0x8ea2('0x124')]){_0x3a1752[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xed')],'as':_0x8ea2('0xed'),'raw':!![]});}var _0x5ba508=[{'model':db[_0x8ea2('0xda')],'as':_0x8ea2('0x128'),'attributes':['id',_0x8ea2('0xc7'),_0x8ea2('0x87'),_0x8ea2('0x107'),'secret',_0x8ea2('0x129')],'include':_0x3a1752}];_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0xcb')],'as':_0x8ea2('0x12a'),'attributes':['id','name']});_0x5ba508[_0x8ea2('0xc1')]({'model':db[_0x8ea2('0x7f')],'as':'Owner','attributes':['id','fullname']});return db['ChatInteraction'][_0x8ea2('0x71')]({'where':{'id':_0x2dc450[_0x8ea2('0xc3')]['id']},'include':_0x5ba508})[_0x8ea2('0x25')](handleEntityNotFound(_0x34e1c5,null))[_0x8ea2('0x25')](function(_0x3c9013){if(_0x3c9013){var _0x103c43=_0x3c9013['get']({'plain':!![]});fs['mkdirSync'](_0x2dfabc);var _0xc099b6={'channel':_0x8ea2('0x12b'),'account':_0x103c43[_0x8ea2('0x12a')]['name'],'agent':_0x103c43['Owner']?_0x103c43[_0x8ea2('0x12c')][_0x8ea2('0x105')]:'N.A.','createdAt':moment(_0x103c43[_0x8ea2('0x87')])['format'](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'closedAt':_0x103c43[_0x8ea2('0xeb')]?moment(_0x103c43['closedAt'])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))['toString']():'','disposition':_0x103c43[_0x8ea2('0xe2')],'chatInfo':{'browser':_0x103c43[_0x8ea2('0x12e')],'os':_0x103c43['osName'],'referer':_0x103c43['referer'],'customerIp':_0x103c43[_0x8ea2('0x12f')],'customerPort':_0x103c43[_0x8ea2('0x130')]?_0x103c43[_0x8ea2('0x130')]:'N.A.'},'messages':_(_0x103c43[_0x8ea2('0x128')])[_0x8ea2('0x131')]()[_0x8ea2('0x94')]({'secret':![]})[_0x8ea2('0x43')](function(_0x36799a){if(_0x36799a['Attachment']){var _0x1cc1d9=path['join'](_0x40e8e6,_0x36799a[_0x8ea2('0xed')]['basename']);if(fs[_0x8ea2('0x132')](_0x1cc1d9)){fs[_0x8ea2('0x133')](_0x1cc1d9)[_0x8ea2('0x134')](fs[_0x8ea2('0x135')](path['join'](_0x2dfabc,_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')])));}}return{'date':moment(_0x36799a[_0x8ea2('0x87')])[_0x8ea2('0xfe')](_0x8ea2('0x12d'))[_0x8ea2('0xaa')](),'sender':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?_0x36799a[_0x8ea2('0x7f')]?_0x36799a[_0x8ea2('0x7f')][_0x8ea2('0x105')]:'System':_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x126')]+(_0x36799a[_0x8ea2('0x75')]['lastName']?'\x20'+_0x36799a[_0x8ea2('0x75')][_0x8ea2('0x127')]:''),'body':_0x36799a[_0x8ea2('0xed')]?_0x36799a[_0x8ea2('0xed')][_0x8ea2('0xe7')]:_0x36799a[_0x8ea2('0xc7')],'direction':_0x36799a[_0x8ea2('0x107')]===_0x8ea2('0x136')?'A':'C','secret':_0x36799a[_0x8ea2('0x11c')],'read':_0x36799a[_0x8ea2('0x129')],'attachment':_0x36799a['Attachment']};})[_0x8ea2('0x77')]()};return ejs[_0x8ea2('0x137')](path[_0x8ea2('0xf0')](config[_0x8ea2('0xf1')],'server',_0x8ea2('0x138'),_0x8ea2('0x139')),{'interaction':_0xc099b6})[_0x8ea2('0x25')](function(_0x10d2b3){var _0x12a217=path[_0x8ea2('0xf0')](_0x2dfabc,_0x8ea2('0x13a')+_0x103c43['id']+'-'+_0x5b929c+'.pdf');var _0x44b0dc={'path':_0x12a217,'channel':_0x8ea2('0x12b'),'interactionId':_0x103c43['id']};return pdf['createPdfFromHTML'](_0x10d2b3,_0x44b0dc);})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x27f5e9,_0x19b678){zipdir(_0x2dfabc,{'saveTo':_0x39000d},function(_0x50ebcd,_0x5d6c63){if(_0x50ebcd)return _0x19b678(_0x50ebcd);return _0x27f5e9(_0x5d6c63);});})[_0x8ea2('0x25')](function(){return new BPromise(function(_0x55b3a1,_0x57e228){rimraf(_0x2dfabc,function(_0x3c669b){if(_0x3c669b)_0x57e228(_0x3c669b);return _0x55b3a1();});});})[_0x8ea2('0x25')](function(){return _0x34e1c5['download'](_0x39000d,_0x515049,function(_0x688d21){if(_0x688d21){console[_0x8ea2('0x13b')]('err',_0x688d21);}else{fs[_0x8ea2('0x13c')](_0x39000d);}});});});}else{return _0x34e1c5['sendStatus'](0xc8);}})[_0x8ea2('0x2e')](handleError(_0x34e1c5,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 820c0f9..af2c8f2 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 _0xa391=['setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll','length','emit','catch','hook','exports','events','ChatInteraction','../../mysqldb','ChatMessage'];(function(_0x442365,_0x20c8ed){var _0xaa5e6=function(_0x1220da){while(--_0x1220da){_0x442365['push'](_0x442365['shift']());}};_0xaa5e6(++_0x20c8ed);}(_0xa391,0x188));var _0x1a39=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xa391[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0x1a39('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x1a39('0x1')];var ChatMessage=require(_0x1a39('0x2'))['db'][_0x1a39('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x1a39('0x4')](0x0);var events={'afterCreate':_0x1a39('0x5'),'afterUpdate':_0x1a39('0x6'),'afterDestroy':'remove'};function emitEvent(_0x1180eb){return function(_0x2cb431,_0x2f57a4,_0x195e28){_0x2cb431[_0x1a39('0x7')]({'attributes':['id'],'raw':!![]})[_0x1a39('0x8')](function(_0x3e60ba){_0x2cb431[_0x1a39('0x9')](_0x1a39('0xa'),_0x3e60ba[_0x1a39('0xb')](function(_0x5fe7ad){return{'id':_0x5fe7ad['id']};}));return ChatMessage[_0x1a39('0xc')]({'where':{'ChatInteractionId':_0x2cb431['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1a39('0x8')](function(_0x38b0bf){_0x2cb431[_0x1a39('0x9')]('unreadMessages',_0x38b0bf[_0x1a39('0xd')]);ChatInteractionEvents[_0x1a39('0xe')](_0x1180eb+':'+_0x2cb431['id'],_0x2cb431);ChatInteractionEvents[_0x1a39('0xe')](_0x1180eb,_0x2cb431);_0x195e28(null);})[_0x1a39('0xf')](_0x195e28(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction[_0x1a39('0x10')](e,emitEvent(event));}}module[_0x1a39('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xc7e5=['hook','exports','../../mysqldb','ChatMessage','update','remove','Users','map','findAll','then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xc7e5,0xf2));var _0x5c7e=function(_0x502849,_0x13391f){_0x502849=_0x502849-0x0;var _0x54d0f9=_0xc7e5[_0x502849];return _0x54d0f9;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x5c7e('0x0'))['db']['ChatInteraction'];var ChatMessage=require(_0x5c7e('0x0'))['db'][_0x5c7e('0x1')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5c7e('0x2'),'afterDestroy':_0x5c7e('0x3')};function emitEvent(_0x54b97b){return function(_0x2be715,_0x13221c,_0x30be10){_0x2be715['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x8646a8){_0x2be715['setDataValue'](_0x5c7e('0x4'),_0x8646a8[_0x5c7e('0x5')](function(_0x5e7ed5){return{'id':_0x5e7ed5['id']};}));return ChatMessage[_0x5c7e('0x6')]({'where':{'ChatInteractionId':_0x2be715['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5c7e('0x7')](function(_0x449316){_0x2be715[_0x5c7e('0x8')](_0x5c7e('0x9'),_0x449316[_0x5c7e('0xa')]);ChatInteractionEvents[_0x5c7e('0xb')](_0x54b97b+':'+_0x2be715['id'],_0x2be715);ChatInteractionEvents[_0x5c7e('0xb')](_0x54b97b,_0x2be715);_0x30be10(null);})[_0x5c7e('0xc')](_0x30be10(null));};}for(var e in events){if(events[_0x5c7e('0xd')](e)){var event=events[e];ChatInteraction[_0x5c7e('0xe')](e,emitEvent(event));}}module[_0x5c7e('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 15e53e5..18bbe86 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 _0x4ba0=['exports','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./chatInteraction.attributes'];(function(_0x56ebfc,_0x87cf63){var _0x485816=function(_0x44bfb6){while(--_0x44bfb6){_0x56ebfc['push'](_0x56ebfc['shift']());}};_0x485816(++_0x87cf63);}(_0x4ba0,0xf7));var _0x04ba=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x4ba0[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x04ba('0x0'));var util=require(_0x04ba('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x04ba('0x2'));var BPromise=require(_0x04ba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04ba('0x4'));var rimraf=require(_0x04ba('0x5'));var config=require(_0x04ba('0x6'));var attributes=require(_0x04ba('0x7'));module[_0x04ba('0x8')]=function(_0x54d1fe,_0x867bd4){return _0x54d1fe['define'](_0x04ba('0x9'),attributes,{'tableName':_0x04ba('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x14ef84,_0x33d19e,_0xf785c4){if(_0x14ef84[_0x04ba('0xb')](_0x04ba('0xc'))){_0x14ef84['closedAt']=moment()[_0x04ba('0xd')](_0x04ba('0xe'));}_0xf785c4(null,_0x14ef84);}},'charset':_0x04ba('0xf'),'collate':_0x04ba('0x10')});}; \ No newline at end of file +var _0x8dd5=['closed','closedAt','format','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8dd5,0xe1));var _0x58dd=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x8dd5[_0x2b4448];return _0xb4b465;};'use strict';var _=require(_0x58dd('0x0'));var util=require(_0x58dd('0x1'));var logger=require(_0x58dd('0x2'))(_0x58dd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x58dd('0x4'));var fs=require('fs');var path=require(_0x58dd('0x5'));var rimraf=require(_0x58dd('0x6'));var config=require(_0x58dd('0x7'));var attributes=require(_0x58dd('0x8'));module[_0x58dd('0x9')]=function(_0x4d02bd,_0x299601){return _0x4d02bd[_0x58dd('0xa')](_0x58dd('0xb'),attributes,{'tableName':_0x58dd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x524e3d,_0x32838c,_0x217f00){if(_0x524e3d['changed'](_0x58dd('0xd'))){_0x524e3d[_0x58dd('0xe')]=moment()[_0x58dd('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x217f00(null,_0x524e3d);}},'charset':'utf8mb4','collate':_0x58dd('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 77149b7..3216a9d 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 _0x5b8e=['then','ids','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./chatInteraction.socket','register','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','body','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction'];(function(_0x3af48d,_0x3b45e2){var _0x1108ab=function(_0x2d5b8f){while(--_0x2d5b8f){_0x3af48d['push'](_0x3af48d['shift']());}};_0x1108ab(++_0x3b45e2);}(_0x5b8e,0x1bc));var _0xe5b8=function(_0x23dda5,_0x221860){_0x23dda5=_0x23dda5-0x0;var _0x32c24e=_0x5b8e[_0x23dda5];return _0x32c24e;};'use strict';var _=require(_0xe5b8('0x0'));var util=require(_0xe5b8('0x1'));var moment=require(_0xe5b8('0x2'));var BPromise=require(_0xe5b8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe5b8('0x4'));var db=require(_0xe5b8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe5b8('0x6'))(_0xe5b8('0x7'));var config=require(_0xe5b8('0x8'));var jayson=require(_0xe5b8('0x9'));var client=jayson[_0xe5b8('0xa')][_0xe5b8('0xb')]({'port':0x232a});config['redis']=_[_0xe5b8('0xc')](config[_0xe5b8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xe5b8('0xe'))(new Redis(config[_0xe5b8('0xd')]));require(_0xe5b8('0xf'))[_0xe5b8('0x10')](socket);function respondWithRpcPromise(_0x58f871,_0x1e1a56,_0x41e9aa){return new BPromise(function(_0x4c641a,_0x24ee5f){return client['request'](_0x58f871,_0x41e9aa)['then'](function(_0x3d4037){logger[_0xe5b8('0x11')](_0xe5b8('0x12'),_0x1e1a56,'request\x20sent');logger[_0xe5b8('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1e1a56,_0xe5b8('0x14'),JSON[_0xe5b8('0x15')](_0x3d4037));if(_0x3d4037[_0xe5b8('0x16')]){if(_0x3d4037[_0xe5b8('0x16')][_0xe5b8('0x17')]===0x1f4){logger[_0xe5b8('0x16')](_0xe5b8('0x12'),_0x1e1a56,_0x3d4037[_0xe5b8('0x16')][_0xe5b8('0x18')]);return _0x24ee5f(_0x3d4037[_0xe5b8('0x16')]['message']);}logger[_0xe5b8('0x16')](_0xe5b8('0x12'),_0x1e1a56,_0x3d4037[_0xe5b8('0x16')][_0xe5b8('0x18')]);return _0x4c641a(_0x3d4037['error']['message']);}else{logger[_0xe5b8('0x11')](_0xe5b8('0x12'),_0x1e1a56,_0xe5b8('0x14'));_0x4c641a(_0x3d4037[_0xe5b8('0x19')][_0xe5b8('0x18')]);}})['catch'](function(_0x24667e){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x1e1a56,_0x24667e);_0x24ee5f(_0x24667e);});});}exports[_0xe5b8('0x1a')]=function(_0x1c25e0){var _0x310d4f=this;return new Promise(function(_0x28d9be,_0x3e7011){return db[_0xe5b8('0x1b')]['update'](_0x1c25e0[_0xe5b8('0x1c')],{'raw':_0x1c25e0[_0xe5b8('0x1d')]?_0x1c25e0[_0xe5b8('0x1d')][_0xe5b8('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c25e0[_0xe5b8('0x1d')]?_0x1c25e0['options'][_0xe5b8('0x1f')]||null:null,'attributes':_0x1c25e0[_0xe5b8('0x1d')]?_0x1c25e0[_0xe5b8('0x1d')][_0xe5b8('0x20')]||null:null,'limit':_0x1c25e0['options']?_0x1c25e0[_0xe5b8('0x1d')][_0xe5b8('0x21')]||null:null})['then'](function(_0x48543f){logger[_0xe5b8('0x11')](_0xe5b8('0x1a'),_0x1c25e0);logger[_0xe5b8('0x13')]('UpdateChatInteraction',_0x1c25e0,JSON[_0xe5b8('0x15')](_0x48543f));_0x28d9be(_0x48543f);})[_0xe5b8('0x22')](function(_0x1f122c){logger['error'](_0xe5b8('0x1a'),_0x1f122c[_0xe5b8('0x18')],_0x1c25e0);_0x3e7011(_0x310d4f['error'](0x1f4,_0x1f122c[_0xe5b8('0x18')]));});});};exports[_0xe5b8('0x23')]=function(_0x37bb2f){return new Promise(function(_0x5cd549,_0x115d42){return db['ChatInteraction']['find']({'where':_0x37bb2f[_0xe5b8('0x1d')]?_0x37bb2f[_0xe5b8('0x1d')]['where']||null:null})[_0xe5b8('0x24')](function(_0x36eb2b){if(_0x36eb2b){return _0x36eb2b['addTags'](_0x37bb2f[_0xe5b8('0x1c')]['ids'],_['omit'](_0x37bb2f[_0xe5b8('0x1c')],[_0xe5b8('0x25'),'id'])||{});}})[_0xe5b8('0x26')](function(_0x2a003c){logger['info']('AddTags',_0x37bb2f);logger[_0xe5b8('0x13')](_0xe5b8('0x27'),_0x37bb2f,JSON[_0xe5b8('0x15')](_0x2a003c));_0x5cd549(_0x2a003c);})[_0xe5b8('0x22')](function(_0x1ae84a){logger[_0xe5b8('0x16')](_0xe5b8('0x27'),_0x1ae84a[_0xe5b8('0x18')],_0x37bb2f);_0x115d42(_this[_0xe5b8('0x16')](0x1f4,_0x1ae84a[_0xe5b8('0x18')]));});});}; \ No newline at end of file +var _0x7bc7=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','error','code','message','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','attributes','limit','stringify','AddTagsToChatInteraction','addTags','ids','omit','body','AddTags','lodash','util','moment','bluebird'];(function(_0xaeb1b9,_0x20830a){var _0xcdbe94=function(_0x125e67){while(--_0x125e67){_0xaeb1b9['push'](_0xaeb1b9['shift']());}};_0xcdbe94(++_0x20830a);}(_0x7bc7,0xf2));var _0x77bc=function(_0x4b5288,_0x10d3ea){_0x4b5288=_0x4b5288-0x0;var _0x25bf4c=_0x7bc7[_0x4b5288];return _0x25bf4c;};'use strict';var _=require(_0x77bc('0x0'));var util=require(_0x77bc('0x1'));var moment=require(_0x77bc('0x2'));var BPromise=require(_0x77bc('0x3'));var rs=require(_0x77bc('0x4'));var fs=require('fs');var Redis=require(_0x77bc('0x5'));var db=require(_0x77bc('0x6'))['db'];var utils=require(_0x77bc('0x7'));var logger=require(_0x77bc('0x8'))('rpc');var config=require(_0x77bc('0x9'));var jayson=require(_0x77bc('0xa'));var client=jayson[_0x77bc('0xb')][_0x77bc('0xc')]({'port':0x232a});config[_0x77bc('0xd')]=_[_0x77bc('0xe')](config['redis'],{'host':_0x77bc('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x77bc('0xd')]));require(_0x77bc('0x10'))[_0x77bc('0x11')](socket);function respondWithRpcPromise(_0x386c5c,_0x177e50,_0xe5fa85){return new BPromise(function(_0x34007a,_0xca1c63){return client['request'](_0x386c5c,_0xe5fa85)[_0x77bc('0x12')](function(_0x302bb5){logger[_0x77bc('0x13')](_0x77bc('0x14'),_0x177e50,'request\x20sent');logger[_0x77bc('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x177e50,_0x77bc('0x16'),JSON['stringify'](_0x302bb5));if(_0x302bb5[_0x77bc('0x17')]){if(_0x302bb5[_0x77bc('0x17')][_0x77bc('0x18')]===0x1f4){logger[_0x77bc('0x17')](_0x77bc('0x14'),_0x177e50,_0x302bb5[_0x77bc('0x17')][_0x77bc('0x19')]);return _0xca1c63(_0x302bb5[_0x77bc('0x17')]['message']);}logger[_0x77bc('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x177e50,_0x302bb5[_0x77bc('0x17')][_0x77bc('0x19')]);return _0x34007a(_0x302bb5[_0x77bc('0x17')]['message']);}else{logger[_0x77bc('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x177e50,_0x77bc('0x16'));_0x34007a(_0x302bb5['result'][_0x77bc('0x19')]);}})[_0x77bc('0x1a')](function(_0x12d9fc){logger[_0x77bc('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x177e50,_0x12d9fc);_0xca1c63(_0x12d9fc);});});}exports[_0x77bc('0x1b')]=function(_0x503567){var _0x2c8c71=this;return new Promise(function(_0xbefe87,_0x4cef05){return db[_0x77bc('0x1c')][_0x77bc('0x1d')](_0x503567['body'],{'raw':_0x503567[_0x77bc('0x1e')]?_0x503567['options'][_0x77bc('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503567['options']?_0x503567[_0x77bc('0x1e')]['where']||null:null,'attributes':_0x503567['options']?_0x503567['options'][_0x77bc('0x20')]||null:null,'limit':_0x503567['options']?_0x503567['options'][_0x77bc('0x21')]||null:null})[_0x77bc('0x12')](function(_0x1726e5){logger[_0x77bc('0x13')]('UpdateChatInteraction',_0x503567);logger['debug'](_0x77bc('0x1b'),_0x503567,JSON[_0x77bc('0x22')](_0x1726e5));_0xbefe87(_0x1726e5);})[_0x77bc('0x1a')](function(_0x1ce0bb){logger[_0x77bc('0x17')]('UpdateChatInteraction',_0x1ce0bb[_0x77bc('0x19')],_0x503567);_0x4cef05(_0x2c8c71[_0x77bc('0x17')](0x1f4,_0x1ce0bb['message']));});});};exports[_0x77bc('0x23')]=function(_0x1bc303){return new Promise(function(_0x92acf9,_0x295eb4){return db[_0x77bc('0x1c')]['find']({'where':_0x1bc303[_0x77bc('0x1e')]?_0x1bc303[_0x77bc('0x1e')]['where']||null:null})['then'](function(_0x4ef0b4){if(_0x4ef0b4){return _0x4ef0b4[_0x77bc('0x24')](_0x1bc303['body'][_0x77bc('0x25')],_[_0x77bc('0x26')](_0x1bc303[_0x77bc('0x27')],['ids','id'])||{});}})['spread'](function(_0x4be764){logger['info']('AddTags',_0x1bc303);logger['debug']('AddTags',_0x1bc303,JSON['stringify'](_0x4be764));_0x92acf9(_0x4be764);})[_0x77bc('0x1a')](function(_0x504878){logger[_0x77bc('0x17')](_0x77bc('0x28'),_0x504878[_0x77bc('0x19')],_0x1bc303);_0x295eb4(_this[_0x77bc('0x17')](0x1f4,_0x504878[_0x77bc('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 41f4fc1..c292639 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 _0xacda=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x20d6f0,_0x33e54c){var _0x105ceb=function(_0x4927e9){while(--_0x4927e9){_0x20d6f0['push'](_0x20d6f0['shift']());}};_0x105ceb(++_0x33e54c);}(_0xacda,0x7c));var _0xaacd=function(_0xec77c5,_0x3d51cb){_0xec77c5=_0xec77c5-0x0;var _0x3868f1=_0xacda[_0xec77c5];return _0x3868f1;};'use strict';var ChatInteractionEvents=require(_0xaacd('0x0'));var events=[_0xaacd('0x1'),_0xaacd('0x2'),_0xaacd('0x3')];function createListener(_0x5d2850,_0x4c9cd6){return function(_0x28ea09){_0x4c9cd6['emit'](_0x5d2850,_0x28ea09);};}function removeListener(_0x28b418,_0x447e4f){return function(){ChatInteractionEvents[_0xaacd('0x4')](_0x28b418,_0x447e4f);};}exports[_0xaacd('0x5')]=function(_0x1486f0){for(var _0x1ee8f3=0x0,_0x4899c1=events[_0xaacd('0x6')];_0x1ee8f3<_0x4899c1;_0x1ee8f3++){var _0x362ccf=events[_0x1ee8f3];var _0x231ec4=createListener(_0xaacd('0x7')+_0x362ccf,_0x1486f0);ChatInteractionEvents['on'](_0x362ccf,_0x231ec4);}}; \ No newline at end of file +var _0x0896=['length','chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x32aa36,_0x53b8a4){var _0xf1ca83=function(_0x2e7e62){while(--_0x2e7e62){_0x32aa36['push'](_0x32aa36['shift']());}};_0xf1ca83(++_0x53b8a4);}(_0x0896,0xc8));var _0x6089=function(_0x291905,_0x20e0e0){_0x291905=_0x291905-0x0;var _0x27ce23=_0x0896[_0x291905];return _0x27ce23;};'use strict';var ChatInteractionEvents=require(_0x6089('0x0'));var events=[_0x6089('0x1'),_0x6089('0x2'),_0x6089('0x3')];function createListener(_0x438261,_0xec47f9){return function(_0x370935){_0xec47f9[_0x6089('0x4')](_0x438261,_0x370935);};}function removeListener(_0x395d6a,_0x41a384){return function(){ChatInteractionEvents[_0x6089('0x5')](_0x395d6a,_0x41a384);};}exports[_0x6089('0x6')]=function(_0x4210ef){for(var _0x39d1e3=0x0,_0x17e3a2=events[_0x6089('0x7')];_0x39d1e3<_0x17e3a2;_0x39d1e3++){var _0x2370e6=events[_0x39d1e3];var _0x3e6950=createListener(_0x6089('0x8')+_0x2370e6,_0x4210ef);ChatInteractionEvents['on'](_0x2370e6,_0x3e6950);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index e5e54aa..89221b2 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 _0xb28e=['server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','chatinteraction:update','update','/:id/custom_update','abandon','/:id/close','close','destroy','delete','removeTags','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','/:id/download','post','create','/:id/vidaoo','diskStorage','join','root'];(function(_0x4420e7,_0x503ae9){var _0x3cfad0=function(_0xd98647){while(--_0xd98647){_0x4420e7['push'](_0x4420e7['shift']());}};_0x3cfad0(++_0x503ae9);}(_0xb28e,0xb3));var _0xeb28=function(_0x57d562,_0x379b0b){_0x57d562=_0x57d562-0x0;var _0x17ac79=_0xb28e[_0x57d562];return _0x17ac79;};'use strict';var multer=require(_0xeb28('0x0'));var util=require('util');var path=require(_0xeb28('0x1'));var timeout=require(_0xeb28('0x2'));var express=require(_0xeb28('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xeb28('0x4'));var config=require(_0xeb28('0x5'));var controller=require(_0xeb28('0x6'));router[_0xeb28('0x7')]('/',auth[_0xeb28('0x8')](),controller[_0xeb28('0x9')]);router['get'](_0xeb28('0xa'),auth['isAuthenticated'](),controller[_0xeb28('0xb')]);router[_0xeb28('0x7')]('/:id',auth[_0xeb28('0xc')](),controller[_0xeb28('0xd')]);router[_0xeb28('0x7')](_0xeb28('0xe'),auth[_0xeb28('0xc')](),controller['attachmentDownload']);router[_0xeb28('0x7')](_0xeb28('0xf'),auth[_0xeb28('0x8')](),controller[_0xeb28('0x10')]);router[_0xeb28('0x7')](_0xeb28('0x11'),auth[_0xeb28('0xc')](),controller['getMyMessages']);router[_0xeb28('0x7')](_0xeb28('0x12'),auth[_0xeb28('0x8')](),controller['download']);router[_0xeb28('0x13')]('/',auth[_0xeb28('0x8')](),controller[_0xeb28('0x14')]);router[_0xeb28('0x13')](_0xeb28('0x15'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xeb28('0x16')]({'destination':function(_0x23d12b,_0x21e130,_0x2cfa40){_0x2cfa40(null,path[_0xeb28('0x17')](config[_0xeb28('0x18')],_0xeb28('0x19')));},'filename':function(_0x12728f,_0x2162bf,_0x4a8d04){_0x4a8d04(null,util[_0xeb28('0x1a')]('%s-%s',Date[_0xeb28('0x1b')](),_0x2162bf[_0xeb28('0x1c')][_0xeb28('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xeb28('0x13')](_0xeb28('0x1e'),upload[_0xeb28('0x1f')](_0xeb28('0x20')),controller[_0xeb28('0x21')]);router[_0xeb28('0x13')](_0xeb28('0xf'),auth[_0xeb28('0xc')](),controller[_0xeb28('0x22')]);router[_0xeb28('0x13')](_0xeb28('0x23'),auth[_0xeb28('0x8')](),interaction[_0xeb28('0x24')](_0xeb28('0x25'),_0xeb28('0x26')),controller[_0xeb28('0x27')]);router[_0xeb28('0x28')](_0xeb28('0x29'),auth[_0xeb28('0x8')](),interaction[_0xeb28('0x24')](_0xeb28('0x25'),_0xeb28('0x2a')),controller[_0xeb28('0x2b')]);router[_0xeb28('0x28')](_0xeb28('0x2c'),controller['customUpdate']);router['put']('/:id/abandon',auth[_0xeb28('0xc')](),controller[_0xeb28('0x2d')]);router['put'](_0xeb28('0x2e'),controller[_0xeb28('0x2f')]);router['delete'](_0xeb28('0x29'),auth[_0xeb28('0x8')](),interaction[_0xeb28('0x24')](_0xeb28('0x25'),'chatinteraction:destroy'),controller[_0xeb28('0x30')]);router[_0xeb28('0x31')](_0xeb28('0x23'),auth[_0xeb28('0x8')](),controller[_0xeb28('0x32')]);module['exports']=router; \ No newline at end of file +var _0xa616=['isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','join','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','/:id/tags','tracked','/:id','chat','update','put','/:id/custom_update','customUpdate','abandon','/:id/close','close','delete','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','get'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xa616,0x103));var _0x6a61=function(_0x9d2d2,_0x1c1c2c){_0x9d2d2=_0x9d2d2-0x0;var _0x488242=_0xa616[_0x9d2d2];return _0x488242;};'use strict';var multer=require(_0x6a61('0x0'));var util=require(_0x6a61('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6a61('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6a61('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6a61('0x4'));var controller=require(_0x6a61('0x5'));router['get']('/',auth[_0x6a61('0x6')](),controller[_0x6a61('0x7')]);router['get'](_0x6a61('0x8'),auth['isAuthenticated'](),controller[_0x6a61('0x9')]);router[_0x6a61('0xa')]('/:id',auth[_0x6a61('0xb')](),controller[_0x6a61('0xc')]);router[_0x6a61('0xa')]('/:id/attachment_download',auth[_0x6a61('0xb')](),controller[_0x6a61('0xd')]);router['get'](_0x6a61('0xe'),auth[_0x6a61('0x6')](),controller[_0x6a61('0xf')]);router['get'](_0x6a61('0x10'),auth[_0x6a61('0xb')](),controller['getMyMessages']);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x6a61('0x11')]);router['post']('/',auth[_0x6a61('0x6')](),controller[_0x6a61('0x12')]);router[_0x6a61('0x13')](_0x6a61('0x14'),auth[_0x6a61('0x6')](),controller[_0x6a61('0x15')]);var upload=multer({'storage':multer[_0x6a61('0x16')]({'destination':function(_0x478ec3,_0x48e602,_0x565644){_0x565644(null,path[_0x6a61('0x17')](config['root'],_0x6a61('0x18')));},'filename':function(_0x37dee8,_0x3ed6b8,_0x11aec7){_0x11aec7(null,util[_0x6a61('0x19')]('%s-%s',Date[_0x6a61('0x1a')](),_0x3ed6b8[_0x6a61('0x1b')][_0x6a61('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x6a61('0x13')](_0x6a61('0x1d'),upload[_0x6a61('0x1e')]('file'),controller['attachmentUpload']);router['post']('/:id/messages',auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0x6a61('0x13')](_0x6a61('0x1f'),auth[_0x6a61('0x6')](),interaction[_0x6a61('0x20')]('chat','chatinteraction:addtags'),controller['addTags']);router['put'](_0x6a61('0x21'),auth['isAuthenticated'](),interaction[_0x6a61('0x20')](_0x6a61('0x22'),'chatinteraction:update'),controller[_0x6a61('0x23')]);router[_0x6a61('0x24')](_0x6a61('0x25'),controller[_0x6a61('0x26')]);router['put']('/:id/abandon',auth[_0x6a61('0xb')](),controller[_0x6a61('0x27')]);router[_0x6a61('0x24')](_0x6a61('0x28'),controller[_0x6a61('0x29')]);router[_0x6a61('0x2a')](_0x6a61('0x21'),auth[_0x6a61('0x6')](),interaction['tracked']('chat','chatinteraction:destroy'),controller[_0x6a61('0x2b')]);router[_0x6a61('0x2a')]('/:id/tags',auth[_0x6a61('0x6')](),controller['removeTags']);module[_0x6a61('0x2c')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 7e675b5..17b7a86 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 _0x0f73=['INTEGER','sequelize','medium'];(function(_0x4882d2,_0x11d8af){var _0x22c366=function(_0x5c5119){while(--_0x5c5119){_0x4882d2['push'](_0x4882d2['shift']());}};_0x22c366(++_0x11d8af);}(_0x0f73,0x160));var _0x30f7=function(_0x9ca252,_0x591090){_0x9ca252=_0x9ca252-0x0;var _0x4aa69c=_0x0f73[_0x9ca252];return _0x4aa69c;};'use strict';var Sequelize=require(_0x30f7('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x30f7('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x30f7('0x2')]}}; \ No newline at end of file +var _0xf5dc=['BOOLEAN','TEXT','medium'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xf5dc,0xc4));var _0xcf5d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf5dc[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xcf5d('0x0')](_0xcf5d('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xcf5d('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 66e62ff..a5ea7e6 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 _0x5c47=['register','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','isEmpty','agent','resourceId','push','createdAt','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket'];(function(_0x3ab325,_0x3b4302){var _0x38ef2a=function(_0x8bfb31){while(--_0x8bfb31){_0x3ab325['push'](_0x3ab325['shift']());}};_0x38ef2a(++_0x3b4302);}(_0x5c47,0xc1));var _0x75c4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c47[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x75c4('0x0'));var rimraf=require(_0x75c4('0x1'));var zipdir=require(_0x75c4('0x2'));var jsonpatch=require(_0x75c4('0x3'));var rp=require(_0x75c4('0x4'));var moment=require(_0x75c4('0x5'));var BPromise=require(_0x75c4('0x6'));var Mustache=require('mustache');var util=require(_0x75c4('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x75c4('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75c4('0x9'));var _=require(_0x75c4('0xa'));var squel=require(_0x75c4('0xb'));var crypto=require(_0x75c4('0xc'));var jsforce=require(_0x75c4('0xd'));var deskjs=require(_0x75c4('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x75c4('0xf'));var Redis=require(_0x75c4('0x10'));var authService=require(_0x75c4('0x11'));var qs=require(_0x75c4('0x12'));var as=require(_0x75c4('0x13'));var hardwareService=require(_0x75c4('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x75c4('0x15'));var config=require(_0x75c4('0x16'));var licenseUtil=require(_0x75c4('0x17'));var db=require(_0x75c4('0x18'))['db'];config[_0x75c4('0x19')]=_[_0x75c4('0x1a')](config[_0x75c4('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x75c4('0x1b'))(new Redis(config[_0x75c4('0x19')]));require(_0x75c4('0x1c'))[_0x75c4('0x1d')](socket);function respondWithStatusCode(_0x6f7745,_0x167767){_0x167767=_0x167767||0xcc;return function(_0x1a0e38){if(_0x1a0e38){return _0x6f7745[_0x75c4('0x1e')](_0x167767);}return _0x6f7745[_0x75c4('0x1f')](_0x167767)[_0x75c4('0x20')]();};}function respondWithResult(_0x40d4e3,_0x5dada3){_0x5dada3=_0x5dada3||0xc8;return function(_0x36b18c){if(_0x36b18c){return _0x40d4e3['status'](_0x5dada3)[_0x75c4('0x21')](_0x36b18c);}};}function respondWithFilteredResult(_0x106fff,_0x275e79){return function(_0x853946){if(_0x853946){var _0x47158a=typeof _0x275e79[_0x75c4('0x22')]===_0x75c4('0x23')&&typeof _0x275e79[_0x75c4('0x24')]===_0x75c4('0x23');var _0x3df456=_0x853946[_0x75c4('0x25')];var _0x163e74=_0x47158a?0x0:_0x275e79[_0x75c4('0x22')];var _0x51dfa7=_0x47158a?_0x853946[_0x75c4('0x25')]:_0x275e79[_0x75c4('0x22')]+_0x275e79['limit'];var _0x3db3c6;if(_0x51dfa7>=_0x3df456){_0x51dfa7=_0x3df456;_0x3db3c6=0xc8;}else{_0x3db3c6=0xce;}_0x106fff[_0x75c4('0x1f')](_0x3db3c6);return _0x106fff['set']('Content-Range',_0x163e74+'-'+_0x51dfa7+'/'+_0x3df456)[_0x75c4('0x21')](_0x853946);}return null;};}function patchUpdates(_0x5e13dc){return function(_0x3e5f27){try{jsonpatch['apply'](_0x3e5f27,_0x5e13dc,!![]);}catch(_0x3d2046){return BPromise[_0x75c4('0x26')](_0x3d2046);}return _0x3e5f27[_0x75c4('0x27')]();};}function saveUpdates(_0x55f00e,_0x552eb1){return function(_0x1a1fd0){if(_0x1a1fd0){return _0x1a1fd0[_0x75c4('0x28')](_0x55f00e)[_0x75c4('0x29')](function(_0x5ca204){return _0x5ca204;});}return null;};}function removeEntity(_0x5efab6,_0x3f51a4){return function(_0x2714fb){if(_0x2714fb){return _0x2714fb[_0x75c4('0x2a')]()['then'](function(){_0x5efab6['status'](0xcc)[_0x75c4('0x20')]();});}};}function handleEntityNotFound(_0x4893ad,_0x4798ec){return function(_0x7d751b){if(!_0x7d751b){_0x4893ad[_0x75c4('0x1e')](0x194);}return _0x7d751b;};}function handleError(_0x1ca144,_0x37beec){_0x37beec=_0x37beec||0x1f4;return function(_0x570011){logger[_0x75c4('0x2b')](_0x570011[_0x75c4('0x2c')]);if(_0x570011[_0x75c4('0x2d')]){delete _0x570011[_0x75c4('0x2d')];}_0x1ca144[_0x75c4('0x1f')](_0x37beec)[_0x75c4('0x2e')](_0x570011);};}exports[_0x75c4('0x2f')]=function(_0x441d8e,_0x524122){var _0x40dee9={},_0x458914={},_0x4c6b52={'count':0x0,'rows':[]};var _0x473d78=_[_0x75c4('0x30')](db[_0x75c4('0x31')][_0x75c4('0x32')],function(_0x7a5b2a){return{'name':_0x7a5b2a[_0x75c4('0x33')],'type':_0x7a5b2a[_0x75c4('0x34')][_0x75c4('0x35')]};});_0x458914[_0x75c4('0x36')]=_[_0x75c4('0x30')](_0x473d78,_0x75c4('0x2d'));_0x458914[_0x75c4('0x37')]=_[_0x75c4('0x38')](_0x441d8e['query']);_0x458914['filters']=_['intersection'](_0x458914[_0x75c4('0x36')],_0x458914[_0x75c4('0x37')]);_0x40dee9[_0x75c4('0x39')]=_[_0x75c4('0x3a')](_0x458914[_0x75c4('0x36')],qs[_0x75c4('0x3b')](_0x441d8e[_0x75c4('0x37')][_0x75c4('0x3b')]));_0x40dee9['attributes']=_0x40dee9[_0x75c4('0x39')][_0x75c4('0x3c')]?_0x40dee9[_0x75c4('0x39')]:_0x458914[_0x75c4('0x36')];if(!_0x441d8e[_0x75c4('0x37')][_0x75c4('0x3d')](_0x75c4('0x3e'))){_0x40dee9[_0x75c4('0x24')]=qs[_0x75c4('0x24')](_0x441d8e[_0x75c4('0x37')][_0x75c4('0x24')]);_0x40dee9[_0x75c4('0x22')]=qs[_0x75c4('0x22')](_0x441d8e[_0x75c4('0x37')][_0x75c4('0x22')]);}_0x40dee9[_0x75c4('0x3f')]=qs['sort'](_0x441d8e[_0x75c4('0x37')][_0x75c4('0x40')]);_0x40dee9[_0x75c4('0x41')]=qs['filters'](_[_0x75c4('0x42')](_0x441d8e['query'],_0x458914['filters']),_0x473d78);if(_0x441d8e[_0x75c4('0x37')][_0x75c4('0x43')]){_0x40dee9[_0x75c4('0x41')]=_[_0x75c4('0x44')](_0x40dee9[_0x75c4('0x41')],{'$or':_[_0x75c4('0x30')](_0x473d78,function(_0x5c3e0e){if(_0x5c3e0e[_0x75c4('0x34')]!=='VIRTUAL'){var _0x2a6571={};_0x2a6571[_0x5c3e0e[_0x75c4('0x2d')]]={'$like':'%'+_0x441d8e[_0x75c4('0x37')][_0x75c4('0x43')]+'%'};return _0x2a6571;}})});}_0x40dee9=_[_0x75c4('0x44')]({},_0x40dee9,_0x441d8e['options']);var _0x167bc9={'where':_0x40dee9['where']};return db[_0x75c4('0x31')][_0x75c4('0x25')](_0x167bc9)['then'](function(_0x4b5988){_0x4c6b52[_0x75c4('0x25')]=_0x4b5988;if(_0x441d8e[_0x75c4('0x37')][_0x75c4('0x45')]){_0x40dee9[_0x75c4('0x46')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x75c4('0x47')](_0x40dee9);})[_0x75c4('0x29')](function(_0x1587ec){_0x4c6b52[_0x75c4('0x48')]=_0x1587ec;return _0x4c6b52;})[_0x75c4('0x29')](respondWithFilteredResult(_0x524122,_0x40dee9))[_0x75c4('0x49')](handleError(_0x524122,null));};exports[_0x75c4('0x4a')]=function(_0x185626,_0x1b5988){var _0x3f4e25={'raw':!![],'where':{'id':_0x185626[_0x75c4('0x4b')]['id']}},_0x4e3359={};_0x4e3359[_0x75c4('0x36')]=_[_0x75c4('0x38')](db[_0x75c4('0x31')][_0x75c4('0x32')]);_0x4e3359[_0x75c4('0x37')]=_[_0x75c4('0x38')](_0x185626['query']);_0x4e3359['filters']=_[_0x75c4('0x3a')](_0x4e3359[_0x75c4('0x36')],_0x4e3359['query']);_0x3f4e25[_0x75c4('0x39')]=_[_0x75c4('0x3a')](_0x4e3359[_0x75c4('0x36')],qs[_0x75c4('0x3b')](_0x185626['query'][_0x75c4('0x3b')]));_0x3f4e25[_0x75c4('0x39')]=_0x3f4e25[_0x75c4('0x39')][_0x75c4('0x3c')]?_0x3f4e25[_0x75c4('0x39')]:_0x4e3359[_0x75c4('0x36')];if(_0x185626['query'][_0x75c4('0x45')]){_0x3f4e25['include']=[{'all':!![]}];}_0x3f4e25=_[_0x75c4('0x44')]({},_0x3f4e25,_0x185626[_0x75c4('0x4c')]);return db[_0x75c4('0x31')][_0x75c4('0x4d')](_0x3f4e25)[_0x75c4('0x29')](handleEntityNotFound(_0x1b5988,null))[_0x75c4('0x29')](respondWithResult(_0x1b5988,null))['catch'](handleError(_0x1b5988,null));};exports[_0x75c4('0x4e')]=function(_0x65a0f2,_0x1dfa84){return db[_0x75c4('0x31')][_0x75c4('0x4e')](_0x65a0f2['body'],{})[_0x75c4('0x29')](respondWithResult(_0x1dfa84,0xc9))['catch'](handleError(_0x1dfa84,null));};exports[_0x75c4('0x28')]=function(_0x25f057,_0x2f95bd){if(_0x25f057['body']['id']){delete _0x25f057[_0x75c4('0x4f')]['id'];}return db[_0x75c4('0x31')][_0x75c4('0x4d')]({'where':{'id':_0x25f057[_0x75c4('0x4b')]['id']}})[_0x75c4('0x29')](handleEntityNotFound(_0x2f95bd,null))[_0x75c4('0x29')](saveUpdates(_0x25f057[_0x75c4('0x4f')],null))[_0x75c4('0x29')](respondWithResult(_0x2f95bd,null))[_0x75c4('0x49')](handleError(_0x2f95bd,null));};exports[_0x75c4('0x2a')]=function(_0x5df392,_0x267b52){return db[_0x75c4('0x31')][_0x75c4('0x4d')]({'where':{'id':_0x5df392[_0x75c4('0x4b')]['id']}})[_0x75c4('0x29')](handleEntityNotFound(_0x267b52,null))[_0x75c4('0x29')](removeEntity(_0x267b52,null))[_0x75c4('0x49')](handleError(_0x267b52,null));};exports['describe']=function(_0x53e10b,_0x4c2d1d){return db[_0x75c4('0x31')][_0x75c4('0x50')]()['then'](respondWithResult(_0x4c2d1d,null))[_0x75c4('0x49')](handleError(_0x4c2d1d,null));};function wrapUser(_0x471d8d){return function(_0x3d76d8){var _0x497b9f=_0x471d8d[_0x75c4('0x51')]({'plain':!![]});_0x497b9f[_0x75c4('0x52')]=[];if(_0x3d76d8){_0x497b9f[_0x75c4('0x53')]=_0x3d76d8['createdAt'];_0x497b9f[_0x75c4('0x54')]=_0x3d76d8;}else{_0x497b9f['lastMessageAt']=moment(0x0)[_0x75c4('0x55')](_0x75c4('0x56'));_0x497b9f[_0x75c4('0x54')]={};}return _0x497b9f;};}exports[_0x75c4('0x57')]=function(_0x379cb2,_0xcf3529,_0x548927){var _0x384cb6=[];return db[_0x75c4('0x58')][_0x75c4('0x47')]({'where':{'role':['agent',_0x75c4('0x59'),'user']},'attributes':['id',_0x75c4('0x5a'),_0x75c4('0x2d'),_0x75c4('0x5b'),'userpic','internal',_0x75c4('0x5c'),_0x75c4('0x5d'),_0x75c4('0x5e'),_0x75c4('0x5f')],'order':qs[_0x75c4('0x40')](_0x75c4('0x60')),'include':[{'model':db[_0x75c4('0x61')],'as':'VoiceQueues','attributes':['id',_0x75c4('0x2d'),_0x75c4('0x34')],'through':{'attributes':[]}}]})['then'](function(_0x48249e){if(_0x48249e){var _0x23187d=_0x379cb2[_0x75c4('0x62')][_0x75c4('0x51')]({'plain':!![]});if(!_0x23187d)throw new Error(_0x75c4('0x63'));if(_0x23187d[_0x75c4('0x5b')]===_0x75c4('0x62')){return db[_0x75c4('0x64')]['find']({'where':{'name':_0x75c4('0x65'),'userProfileId':_0x23187d[_0x75c4('0x66')]},'raw':!![]})[_0x75c4('0x29')](function(_0x56a47e){if(_0x56a47e){if(_0x56a47e['autoAssociation']===0x0){return db['UserProfileResource'][_0x75c4('0x47')]({'where':{'sectionId':_0x56a47e['id']},'raw':!![]})[_0x75c4('0x29')](function(_0x315732){var _0x21b77e=[];if(_[_0x75c4('0x67')](_0x315732)){_0x21b77e=_[_0x75c4('0x43')](_0x48249e,function(_0x3e6514){if(_0x3e6514['role']!==_0x75c4('0x68')){return _0x3e6514;}});return _0x21b77e;}else{for(var _0x6a1f92=0x0;_0x6a1f92<_0x48249e[_0x75c4('0x3c')];_0x6a1f92++){var _0x425bd3=_0x48249e[_0x6a1f92];if(_0x425bd3['role']===_0x75c4('0x68')){var _0x37eec9=_['find'](_0x315732,function(_0xff6806){return _0xff6806[_0x75c4('0x69')]===_0x425bd3['id'];});if(_0x37eec9)_0x21b77e[_0x75c4('0x6a')](_0x425bd3);}else{_0x21b77e['push'](_0x425bd3);}}return _0x21b77e;}});}else{return _0x48249e;}}else{var _0x21f0f0=_['filter'](_0x48249e,function(_0x47d74c){if(_0x47d74c[_0x75c4('0x5b')]!==_0x75c4('0x68')){return _0x47d74c;}});return _0x21f0f0;}});}else{return _0x48249e;}}})[_0x75c4('0x29')](function(_0x2cd985){var _0x1c51d4=[];if(_0x2cd985){_0x384cb6=_0x2cd985;for(var _0x42359d=0x0;_0x42359d<_0x2cd985[_0x75c4('0x3c')];_0x42359d+=0x1){_0x384cb6[_0x42359d]['messages']=[];_0x1c51d4[_0x75c4('0x6a')](db[_0x75c4('0x31')][_0x75c4('0x4d')]({'where':{'FromId':[_0x379cb2[_0x75c4('0x62')]['id'],_0x2cd985[_0x42359d]['id']],'ToId':[_0x379cb2['user']['id'],_0x2cd985[_0x42359d]['id']],'ChatGroupId':null},'attributes':['id',_0x75c4('0x6b'),'FromId','ToId',_0x75c4('0x6c'),_0x75c4('0x4f')],'order':qs['sort'](_0x75c4('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x75c4('0x29')](wrapUser(_0x2cd985[_0x42359d])));}return BPromise[_0x75c4('0x6e')](_0x1c51d4);}return[];})[_0x75c4('0x29')](function(_0x490c3b){return{'rows':_0x490c3b,'count':_0x490c3b[_0x75c4('0x3c')]};})[_0x75c4('0x29')](respondWithResult(_0xcf3529,null))[_0x75c4('0x49')](handleError(_0xcf3529,null));}; \ No newline at end of file +var _0x3eb1=['offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','send','index','map','ChatInternalMessage','fieldName','type','key','name','keys','filters','intersection','model','query','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','findAll','params','rawAttributes','include','catch','create','body','update','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','User','agent','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Agents','userProfileId','autoAssociation','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','fs-extra','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','redis','localhost','socket.io-emitter','register','status','end'];(function(_0x1aaf60,_0x207f75){var _0x4b2f42=function(_0x27071b){while(--_0x27071b){_0x1aaf60['push'](_0x1aaf60['shift']());}};_0x4b2f42(++_0x207f75);}(_0x3eb1,0x130));var _0x13eb=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x3eb1[_0x5180c3];return _0x55c975;};'use strict';var emlformat=require(_0x13eb('0x0'));var rimraf=require(_0x13eb('0x1'));var zipdir=require(_0x13eb('0x2'));var jsonpatch=require(_0x13eb('0x3'));var rp=require('request-promise');var moment=require(_0x13eb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x13eb('0x5'));var path=require(_0x13eb('0x6'));var sox=require(_0x13eb('0x7'));var csv=require(_0x13eb('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13eb('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13eb('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x13eb('0x8'));var querystring=require(_0x13eb('0xb'));var Papa=require(_0x13eb('0xc'));var Redis=require(_0x13eb('0xd'));var authService=require(_0x13eb('0xe'));var qs=require(_0x13eb('0xf'));var as=require(_0x13eb('0x10'));var hardwareService=require(_0x13eb('0x11'));var logger=require(_0x13eb('0x12'))(_0x13eb('0x13'));var utils=require(_0x13eb('0x14'));var config=require(_0x13eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x13eb('0x16')](config[_0x13eb('0x17')],{'host':_0x13eb('0x18'),'port':0x18eb});var socket=require(_0x13eb('0x19'))(new Redis(config[_0x13eb('0x17')]));require('./chatInternalMessage.socket')[_0x13eb('0x1a')](socket);function respondWithStatusCode(_0xad335b,_0x3525c2){_0x3525c2=_0x3525c2||0xcc;return function(_0x7289dc){if(_0x7289dc){return _0xad335b['sendStatus'](_0x3525c2);}return _0xad335b[_0x13eb('0x1b')](_0x3525c2)[_0x13eb('0x1c')]();};}function respondWithResult(_0x1b7ee1,_0x580bb9){_0x580bb9=_0x580bb9||0xc8;return function(_0x5e3193){if(_0x5e3193){return _0x1b7ee1[_0x13eb('0x1b')](_0x580bb9)['json'](_0x5e3193);}};}function respondWithFilteredResult(_0xe2976a,_0x29fb80){return function(_0x10586d){if(_0x10586d){var _0x3c9f54=typeof _0x29fb80[_0x13eb('0x1d')]===_0x13eb('0x1e')&&typeof _0x29fb80[_0x13eb('0x1f')]===_0x13eb('0x1e');var _0x490c5f=_0x10586d[_0x13eb('0x20')];var _0x2959d6=_0x3c9f54?0x0:_0x29fb80[_0x13eb('0x1d')];var _0x3e43e3=_0x3c9f54?_0x10586d[_0x13eb('0x20')]:_0x29fb80[_0x13eb('0x1d')]+_0x29fb80[_0x13eb('0x1f')];var _0x2feae9;if(_0x3e43e3>=_0x490c5f){_0x3e43e3=_0x490c5f;_0x2feae9=0xc8;}else{_0x2feae9=0xce;}_0xe2976a['status'](_0x2feae9);return _0xe2976a[_0x13eb('0x21')](_0x13eb('0x22'),_0x2959d6+'-'+_0x3e43e3+'/'+_0x490c5f)[_0x13eb('0x23')](_0x10586d);}return null;};}function patchUpdates(_0x61713b){return function(_0x525c5f){try{jsonpatch[_0x13eb('0x24')](_0x525c5f,_0x61713b,!![]);}catch(_0x35ee5e){return BPromise[_0x13eb('0x25')](_0x35ee5e);}return _0x525c5f[_0x13eb('0x26')]();};}function saveUpdates(_0x427a29,_0x3bb6ab){return function(_0x554a01){if(_0x554a01){return _0x554a01['update'](_0x427a29)['then'](function(_0x29a9b4){return _0x29a9b4;});}return null;};}function removeEntity(_0x55b445,_0x91ce51){return function(_0x265440){if(_0x265440){return _0x265440['destroy']()[_0x13eb('0x27')](function(){_0x55b445[_0x13eb('0x1b')](0xcc)[_0x13eb('0x1c')]();});}};}function handleEntityNotFound(_0x20b4a2,_0x4fbfc9){return function(_0x33cb88){if(!_0x33cb88){_0x20b4a2[_0x13eb('0x28')](0x194);}return _0x33cb88;};}function handleError(_0x1ca546,_0x387754){_0x387754=_0x387754||0x1f4;return function(_0xa486bb){logger[_0x13eb('0x29')](_0xa486bb[_0x13eb('0x2a')]);if(_0xa486bb['name']){delete _0xa486bb['name'];}_0x1ca546[_0x13eb('0x1b')](_0x387754)[_0x13eb('0x2b')](_0xa486bb);};}exports[_0x13eb('0x2c')]=function(_0x4bd63e,_0x132e41){var _0x1544a7={},_0x558e9={},_0x275c3f={'count':0x0,'rows':[]};var _0x45bd1f=_[_0x13eb('0x2d')](db[_0x13eb('0x2e')]['rawAttributes'],function(_0x3e16d6){return{'name':_0x3e16d6[_0x13eb('0x2f')],'type':_0x3e16d6[_0x13eb('0x30')][_0x13eb('0x31')]};});_0x558e9['model']=_[_0x13eb('0x2d')](_0x45bd1f,_0x13eb('0x32'));_0x558e9['query']=_[_0x13eb('0x33')](_0x4bd63e['query']);_0x558e9[_0x13eb('0x34')]=_[_0x13eb('0x35')](_0x558e9[_0x13eb('0x36')],_0x558e9[_0x13eb('0x37')]);_0x1544a7['attributes']=_[_0x13eb('0x35')](_0x558e9[_0x13eb('0x36')],qs[_0x13eb('0x38')](_0x4bd63e[_0x13eb('0x37')][_0x13eb('0x38')]));_0x1544a7['attributes']=_0x1544a7['attributes'][_0x13eb('0x39')]?_0x1544a7[_0x13eb('0x3a')]:_0x558e9[_0x13eb('0x36')];if(!_0x4bd63e[_0x13eb('0x37')][_0x13eb('0x3b')](_0x13eb('0x3c'))){_0x1544a7[_0x13eb('0x1f')]=qs[_0x13eb('0x1f')](_0x4bd63e['query'][_0x13eb('0x1f')]);_0x1544a7[_0x13eb('0x1d')]=qs[_0x13eb('0x1d')](_0x4bd63e[_0x13eb('0x37')][_0x13eb('0x1d')]);}_0x1544a7[_0x13eb('0x3d')]=qs[_0x13eb('0x3e')](_0x4bd63e[_0x13eb('0x37')]['sort']);_0x1544a7[_0x13eb('0x3f')]=qs[_0x13eb('0x34')](_['pick'](_0x4bd63e[_0x13eb('0x37')],_0x558e9[_0x13eb('0x34')]),_0x45bd1f);if(_0x4bd63e['query']['filter']){_0x1544a7[_0x13eb('0x3f')]=_['merge'](_0x1544a7[_0x13eb('0x3f')],{'$or':_['map'](_0x45bd1f,function(_0x497fb1){if(_0x497fb1[_0x13eb('0x30')]!==_0x13eb('0x40')){var _0x23319f={};_0x23319f[_0x497fb1[_0x13eb('0x32')]]={'$like':'%'+_0x4bd63e[_0x13eb('0x37')][_0x13eb('0x41')]+'%'};return _0x23319f;}})});}_0x1544a7=_[_0x13eb('0x42')]({},_0x1544a7,_0x4bd63e[_0x13eb('0x43')]);var _0x5c8718={'where':_0x1544a7[_0x13eb('0x3f')]};return db[_0x13eb('0x2e')]['count'](_0x5c8718)[_0x13eb('0x27')](function(_0x4b49bb){_0x275c3f['count']=_0x4b49bb;if(_0x4bd63e[_0x13eb('0x37')][_0x13eb('0x44')]){_0x1544a7['include']=[{'all':!![]}];}return db[_0x13eb('0x2e')][_0x13eb('0x45')](_0x1544a7);})[_0x13eb('0x27')](function(_0x7bdabf){_0x275c3f['rows']=_0x7bdabf;return _0x275c3f;})[_0x13eb('0x27')](respondWithFilteredResult(_0x132e41,_0x1544a7))['catch'](handleError(_0x132e41,null));};exports['show']=function(_0x302cfe,_0xbf4863){var _0x274abb={'raw':!![],'where':{'id':_0x302cfe[_0x13eb('0x46')]['id']}},_0x1ec890={};_0x1ec890[_0x13eb('0x36')]=_[_0x13eb('0x33')](db[_0x13eb('0x2e')][_0x13eb('0x47')]);_0x1ec890[_0x13eb('0x37')]=_[_0x13eb('0x33')](_0x302cfe[_0x13eb('0x37')]);_0x1ec890['filters']=_['intersection'](_0x1ec890[_0x13eb('0x36')],_0x1ec890['query']);_0x274abb[_0x13eb('0x3a')]=_[_0x13eb('0x35')](_0x1ec890['model'],qs[_0x13eb('0x38')](_0x302cfe[_0x13eb('0x37')]['fields']));_0x274abb['attributes']=_0x274abb[_0x13eb('0x3a')][_0x13eb('0x39')]?_0x274abb[_0x13eb('0x3a')]:_0x1ec890[_0x13eb('0x36')];if(_0x302cfe[_0x13eb('0x37')]['includeAll']){_0x274abb[_0x13eb('0x48')]=[{'all':!![]}];}_0x274abb=_[_0x13eb('0x42')]({},_0x274abb,_0x302cfe[_0x13eb('0x43')]);return db[_0x13eb('0x2e')]['find'](_0x274abb)[_0x13eb('0x27')](handleEntityNotFound(_0xbf4863,null))[_0x13eb('0x27')](respondWithResult(_0xbf4863,null))[_0x13eb('0x49')](handleError(_0xbf4863,null));};exports['create']=function(_0x621377,_0x44ff3a){return db['ChatInternalMessage'][_0x13eb('0x4a')](_0x621377[_0x13eb('0x4b')],{})['then'](respondWithResult(_0x44ff3a,0xc9))[_0x13eb('0x49')](handleError(_0x44ff3a,null));};exports[_0x13eb('0x4c')]=function(_0xf7d122,_0x1402f2){if(_0xf7d122[_0x13eb('0x4b')]['id']){delete _0xf7d122['body']['id'];}return db['ChatInternalMessage'][_0x13eb('0x4d')]({'where':{'id':_0xf7d122[_0x13eb('0x46')]['id']}})['then'](handleEntityNotFound(_0x1402f2,null))[_0x13eb('0x27')](saveUpdates(_0xf7d122[_0x13eb('0x4b')],null))[_0x13eb('0x27')](respondWithResult(_0x1402f2,null))[_0x13eb('0x49')](handleError(_0x1402f2,null));};exports['destroy']=function(_0x322823,_0x3a63f6){return db['ChatInternalMessage'][_0x13eb('0x4d')]({'where':{'id':_0x322823[_0x13eb('0x46')]['id']}})[_0x13eb('0x27')](handleEntityNotFound(_0x3a63f6,null))[_0x13eb('0x27')](removeEntity(_0x3a63f6,null))[_0x13eb('0x49')](handleError(_0x3a63f6,null));};exports[_0x13eb('0x4e')]=function(_0x3df6b2,_0x340cf2){return db['ChatInternalMessage'][_0x13eb('0x4e')]()[_0x13eb('0x27')](respondWithResult(_0x340cf2,null))['catch'](handleError(_0x340cf2,null));};function wrapUser(_0x5a54b7){return function(_0x17a804){var _0xccb0b=_0x5a54b7[_0x13eb('0x4f')]({'plain':!![]});_0xccb0b[_0x13eb('0x50')]=[];if(_0x17a804){_0xccb0b[_0x13eb('0x51')]=_0x17a804[_0x13eb('0x52')];_0xccb0b[_0x13eb('0x53')]=_0x17a804;}else{_0xccb0b['lastMessageAt']=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0xccb0b[_0x13eb('0x53')]={};}return _0xccb0b;};}exports['getUsers']=function(_0x1d4d62,_0x3054e7,_0x5d9abd){var _0x28748d=[];return db[_0x13eb('0x54')][_0x13eb('0x45')]({'where':{'role':[_0x13eb('0x55'),'admin','user']},'attributes':['id',_0x13eb('0x56'),_0x13eb('0x32'),_0x13eb('0x57'),_0x13eb('0x58'),_0x13eb('0x59'),_0x13eb('0x5a'),_0x13eb('0x5b'),_0x13eb('0x5c'),_0x13eb('0x5d')],'order':qs[_0x13eb('0x3e')](_0x13eb('0x5e')),'include':[{'model':db[_0x13eb('0x5f')],'as':_0x13eb('0x60'),'attributes':['id','name',_0x13eb('0x30')],'through':{'attributes':[]}}]})[_0x13eb('0x27')](function(_0x5d4d5f){if(_0x5d4d5f){var _0x14d346=_0x1d4d62['user'][_0x13eb('0x4f')]({'plain':!![]});if(!_0x14d346)throw new Error(_0x13eb('0x61'));if(_0x14d346[_0x13eb('0x57')]===_0x13eb('0x62')){return db[_0x13eb('0x63')][_0x13eb('0x4d')]({'where':{'name':_0x13eb('0x64'),'userProfileId':_0x14d346[_0x13eb('0x65')]},'raw':!![]})['then'](function(_0x4a320e){if(_0x4a320e){if(_0x4a320e[_0x13eb('0x66')]===0x0){return db['UserProfileResource'][_0x13eb('0x45')]({'where':{'sectionId':_0x4a320e['id']},'raw':!![]})[_0x13eb('0x27')](function(_0x42eae2){var _0x187608=[];if(_[_0x13eb('0x67')](_0x42eae2)){_0x187608=_[_0x13eb('0x41')](_0x5d4d5f,function(_0x4dfc14){if(_0x4dfc14['role']!==_0x13eb('0x55')){return _0x4dfc14;}});return _0x187608;}else{for(var _0x1b7f92=0x0;_0x1b7f92<_0x5d4d5f[_0x13eb('0x39')];_0x1b7f92++){var _0x27ca21=_0x5d4d5f[_0x1b7f92];if(_0x27ca21[_0x13eb('0x57')]===_0x13eb('0x55')){var _0x3c9572=_['find'](_0x42eae2,function(_0xf6323){return _0xf6323[_0x13eb('0x68')]===_0x27ca21['id'];});if(_0x3c9572)_0x187608[_0x13eb('0x69')](_0x27ca21);}else{_0x187608['push'](_0x27ca21);}}return _0x187608;}});}else{return _0x5d4d5f;}}else{var _0x16fb6b=_[_0x13eb('0x41')](_0x5d4d5f,function(_0x47a539){if(_0x47a539['role']!=='agent'){return _0x47a539;}});return _0x16fb6b;}});}else{return _0x5d4d5f;}}})[_0x13eb('0x27')](function(_0x1e50d7){var _0x1bfe41=[];if(_0x1e50d7){_0x28748d=_0x1e50d7;for(var _0x2bd8ef=0x0;_0x2bd8ef<_0x1e50d7['length'];_0x2bd8ef+=0x1){_0x28748d[_0x2bd8ef][_0x13eb('0x50')]=[];_0x1bfe41['push'](db[_0x13eb('0x2e')]['find']({'where':{'FromId':[_0x1d4d62[_0x13eb('0x62')]['id'],_0x1e50d7[_0x2bd8ef]['id']],'ToId':[_0x1d4d62[_0x13eb('0x62')]['id'],_0x1e50d7[_0x2bd8ef]['id']],'ChatGroupId':null},'attributes':['id',_0x13eb('0x52'),_0x13eb('0x6a'),_0x13eb('0x6b'),_0x13eb('0x6c'),_0x13eb('0x4b')],'order':qs[_0x13eb('0x3e')](_0x13eb('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x13eb('0x27')](wrapUser(_0x1e50d7[_0x2bd8ef])));}return BPromise[_0x13eb('0x6e')](_0x1bfe41);}return[];})[_0x13eb('0x27')](function(_0x3142b2){return{'rows':_0x3142b2,'count':_0x3142b2['length']};})[_0x13eb('0x27')](respondWithResult(_0x3054e7,null))[_0x13eb('0x49')](handleError(_0x3054e7,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index bb5ad48..2c04b6b 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 _0x971c=['emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','save'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x971c,0x66));var _0xc971=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x971c[_0x1e7b16];return _0x37fadc;};'use strict';var EventEmitter=require(_0xc971('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xc971('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc971('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2a3f43){return function(_0x172418,_0x49e8b4,_0x55ab63){ChatInternalMessageEvents['emit'](_0x2a3f43+':'+_0x172418['id'],_0x172418);ChatInternalMessageEvents[_0xc971('0x3')](_0x2a3f43,_0x172418);_0x55ab63(null);};}for(var e in events){if(events[_0xc971('0x4')](e)){var event=events[e];ChatInternalMessage[_0xc971('0x5')](e,emitEvent(event));}}module[_0xc971('0x6')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xe149=['hook','exports','events','save','emit','hasOwnProperty'];(function(_0x479716,_0x3505ba){var _0x32ae1c=function(_0x537f1d){while(--_0x537f1d){_0x479716['push'](_0x479716['shift']());}};_0x32ae1c(++_0x3505ba);}(_0xe149,0x7a));var _0x9e14=function(_0x2bbe4e,_0x2f416d){_0x2bbe4e=_0x2bbe4e-0x0;var _0x9ffba7=_0xe149[_0x2bbe4e];return _0x9ffba7;};'use strict';var EventEmitter=require(_0x9e14('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e14('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc27309){return function(_0x42f9f4,_0x4d4482,_0x127777){ChatInternalMessageEvents[_0x9e14('0x2')](_0xc27309+':'+_0x42f9f4['id'],_0x42f9f4);ChatInternalMessageEvents[_0x9e14('0x2')](_0xc27309,_0x42f9f4);_0x127777(null);};}for(var e in events){if(events[_0x9e14('0x3')](e)){var event=events[e];ChatInternalMessage[_0x9e14('0x4')](e,emitEvent(event));}}module[_0x9e14('0x5')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 17c322f..201265f 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 _0x149f=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4035a7,_0x3463f7){var _0xa090a1=function(_0x5c97f9){while(--_0x5c97f9){_0x4035a7['push'](_0x4035a7['shift']());}};_0xa090a1(++_0x3463f7);}(_0x149f,0x149));var _0xf149=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x149f[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xf149('0x0'));var util=require(_0xf149('0x1'));var logger=require('../../config/logger')(_0xf149('0x2'));var moment=require(_0xf149('0x3'));var BPromise=require(_0xf149('0x4'));var rp=require(_0xf149('0x5'));var fs=require('fs');var path=require(_0xf149('0x6'));var rimraf=require(_0xf149('0x7'));var config=require(_0xf149('0x8'));var attributes=require(_0xf149('0x9'));module[_0xf149('0xa')]=function(_0x1bb859,_0x4cc525){return _0x1bb859['define'](_0xf149('0xb'),attributes,{'tableName':_0xf149('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf149('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xbced=['utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4'];(function(_0x33f447,_0x2c4879){var _0x1a0e82=function(_0x5a3d8c){while(--_0x5a3d8c){_0x33f447['push'](_0x33f447['shift']());}};_0x1a0e82(++_0x2c4879);}(_0xbced,0x9d));var _0xdbce=function(_0x5a8d7d,_0x2ed942){_0x5a8d7d=_0x5a8d7d-0x0;var _0xcbb507=_0xbced[_0x5a8d7d];return _0xcbb507;};'use strict';var _=require(_0xdbce('0x0'));var util=require('util');var logger=require(_0xdbce('0x1'))(_0xdbce('0x2'));var moment=require('moment');var BPromise=require(_0xdbce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdbce('0x4'));var rimraf=require(_0xdbce('0x5'));var config=require(_0xdbce('0x6'));var attributes=require(_0xdbce('0x7'));module[_0xdbce('0x8')]=function(_0x46a042,_0x339779){return _0x46a042[_0xdbce('0x9')](_0xdbce('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdbce('0xb'),'collate':_0xdbce('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index acf40cf..65927eb 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 _0xac9d=['./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x448bf3,_0x240965){var _0x492b33=function(_0x40d4ef){while(--_0x40d4ef){_0x448bf3['push'](_0x448bf3['shift']());}};_0x492b33(++_0x240965);}(_0xac9d,0x14d));var _0xdac9=function(_0x5d64f3,_0x374d1a){_0x5d64f3=_0x5d64f3-0x0;var _0x2e5c81=_0xac9d[_0x5d64f3];return _0x2e5c81;};'use strict';var _=require(_0xdac9('0x0'));var util=require(_0xdac9('0x1'));var moment=require(_0xdac9('0x2'));var BPromise=require(_0xdac9('0x3'));var rs=require(_0xdac9('0x4'));var fs=require('fs');var Redis=require(_0xdac9('0x5'));var db=require(_0xdac9('0x6'))['db'];var utils=require(_0xdac9('0x7'));var logger=require('../../config/logger')(_0xdac9('0x8'));var config=require('../../config/environment');var jayson=require(_0xdac9('0x9'));var client=jayson[_0xdac9('0xa')][_0xdac9('0xb')]({'port':0x232a});config[_0xdac9('0xc')]=_[_0xdac9('0xd')](config[_0xdac9('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdac9('0xe'))(new Redis(config['redis']));require(_0xdac9('0xf'))[_0xdac9('0x10')](socket);function respondWithRpcPromise(_0x39c92c,_0x1a4674,_0x23ec14){return new BPromise(function(_0x2859bf,_0x255627){return client[_0xdac9('0x11')](_0x39c92c,_0x23ec14)[_0xdac9('0x12')](function(_0x5514c5){logger[_0xdac9('0x13')](_0xdac9('0x14'),_0x1a4674,'request\x20sent');logger[_0xdac9('0x15')](_0xdac9('0x16'),_0x1a4674,_0xdac9('0x17'),JSON['stringify'](_0x5514c5));if(_0x5514c5[_0xdac9('0x18')]){if(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x19')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x255627(_0x5514c5['error'][_0xdac9('0x1a')]);}logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);return _0x2859bf(_0x5514c5[_0xdac9('0x18')][_0xdac9('0x1a')]);}else{logger[_0xdac9('0x13')]('ChatInternalMessage,\x20%s,\x20%s',_0x1a4674,_0xdac9('0x17'));_0x2859bf(_0x5514c5[_0xdac9('0x1b')]['message']);}})[_0xdac9('0x1c')](function(_0xa57f2d){logger[_0xdac9('0x18')](_0xdac9('0x14'),_0x1a4674,_0xa57f2d);_0x255627(_0xa57f2d);});});} \ No newline at end of file +var _0xe4d6=['ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xe4d6,0xd7));var _0x6e4d=function(_0x54dcb2,_0x130fe3){_0x54dcb2=_0x54dcb2-0x0;var _0x2c4ca8=_0xe4d6[_0x54dcb2];return _0x2c4ca8;};'use strict';var _=require(_0x6e4d('0x0'));var util=require(_0x6e4d('0x1'));var moment=require(_0x6e4d('0x2'));var BPromise=require(_0x6e4d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e4d('0x4'));var db=require(_0x6e4d('0x5'))['db'];var utils=require(_0x6e4d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6e4d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6e4d('0x8')][_0x6e4d('0x9')]({'port':0x232a});config[_0x6e4d('0xa')]=_[_0x6e4d('0xb')](config[_0x6e4d('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6e4d('0xa')]));require(_0x6e4d('0xc'))[_0x6e4d('0xd')](socket);function respondWithRpcPromise(_0x502da3,_0x2d32e2,_0x540159){return new BPromise(function(_0x404f41,_0x31ff03){return client[_0x6e4d('0xe')](_0x502da3,_0x540159)[_0x6e4d('0xf')](function(_0x4d11a3){logger['info'](_0x6e4d('0x10'),_0x2d32e2,_0x6e4d('0x11'));logger[_0x6e4d('0x12')](_0x6e4d('0x13'),_0x2d32e2,_0x6e4d('0x11'),JSON[_0x6e4d('0x14')](_0x4d11a3));if(_0x4d11a3[_0x6e4d('0x15')]){if(_0x4d11a3[_0x6e4d('0x15')][_0x6e4d('0x16')]===0x1f4){logger['error'](_0x6e4d('0x10'),_0x2d32e2,_0x4d11a3[_0x6e4d('0x15')][_0x6e4d('0x17')]);return _0x31ff03(_0x4d11a3['error']['message']);}logger[_0x6e4d('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2d32e2,_0x4d11a3[_0x6e4d('0x15')][_0x6e4d('0x17')]);return _0x404f41(_0x4d11a3['error'][_0x6e4d('0x17')]);}else{logger['info'](_0x6e4d('0x10'),_0x2d32e2,_0x6e4d('0x11'));_0x404f41(_0x4d11a3[_0x6e4d('0x18')][_0x6e4d('0x17')]);}})[_0x6e4d('0x19')](function(_0x5cf5e4){logger[_0x6e4d('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2d32e2,_0x5cf5e4);_0x31ff03(_0x5cf5e4);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index cf7b5cf..b9253b8 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 _0x6580=['removeListener','register','chatInternalMessage:','update'];(function(_0x39106d,_0x4d5fef){var _0x42d497=function(_0x4a239c){while(--_0x4a239c){_0x39106d['push'](_0x39106d['shift']());}};_0x42d497(++_0x4d5fef);}(_0x6580,0xa3));var _0x0658=function(_0x3e21c7,_0x583119){_0x3e21c7=_0x3e21c7-0x0;var _0x5b9124=_0x6580[_0x3e21c7];return _0x5b9124;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=['save','remove',_0x0658('0x0')];function createListener(_0x25d3e4,_0x3cc914){return function(_0x374248){_0x3cc914['emit'](_0x25d3e4,_0x374248);};}function removeListener(_0x5f1cde,_0x35531a){return function(){ChatInternalMessageEvents[_0x0658('0x1')](_0x5f1cde,_0x35531a);};}exports[_0x0658('0x2')]=function(_0x453af8){for(var _0x449b36=0x0,_0x4d6dae=events['length'];_0x449b36<_0x4d6dae;_0x449b36++){var _0x258483=events[_0x449b36];var _0x9bc9=createListener(_0x0658('0x3')+_0x258483,_0x453af8);ChatInternalMessageEvents['on'](_0x258483,_0x9bc9);}}; \ No newline at end of file +var _0x786b=['register','length','chatInternalMessage:','./chatInternalMessage.events','update','emit'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0x786b,0x1c5));var _0xb786=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x786b[_0x2642cb];return _0xe6e41;};'use strict';var ChatInternalMessageEvents=require(_0xb786('0x0'));var events=['save','remove',_0xb786('0x1')];function createListener(_0x1347a2,_0x21a3cf){return function(_0x306110){_0x21a3cf[_0xb786('0x2')](_0x1347a2,_0x306110);};}function removeListener(_0x601d55,_0x500328){return function(){ChatInternalMessageEvents['removeListener'](_0x601d55,_0x500328);};}exports[_0xb786('0x3')]=function(_0x130fce){for(var _0x25f7d6=0x0,_0x1e8165=events[_0xb786('0x4')];_0x25f7d6<_0x1e8165;_0x25f7d6++){var _0x2438ab=events[_0x25f7d6];var _0xf1cb76=createListener(_0xb786('0x5')+_0x2438ab,_0x130fce);ChatInternalMessageEvents['on'](_0x2438ab,_0xf1cb76);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index a0ba644..1a794b0 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 _0x7d6f=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','/:id','show','post','create','put','update','delete','destroy'];(function(_0x5d4dd7,_0x38229c){var _0x2ce0ad=function(_0x54a7fb){while(--_0x54a7fb){_0x5d4dd7['push'](_0x5d4dd7['shift']());}};_0x2ce0ad(++_0x38229c);}(_0x7d6f,0x6e));var _0xf7d6=function(_0x3fd31e,_0x16ab10){_0x3fd31e=_0x3fd31e-0x0;var _0x422a79=_0x7d6f[_0x3fd31e];return _0x422a79;};'use strict';var multer=require(_0xf7d6('0x0'));var util=require('util');var path=require(_0xf7d6('0x1'));var timeout=require(_0xf7d6('0x2'));var express=require(_0xf7d6('0x3'));var router=express[_0xf7d6('0x4')]();var fs_extra=require(_0xf7d6('0x5'));var auth=require(_0xf7d6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf7d6('0x7'));var controller=require(_0xf7d6('0x8'));router[_0xf7d6('0x9')]('/',auth[_0xf7d6('0xa')](),controller['index']);router[_0xf7d6('0x9')](_0xf7d6('0xb'),auth[_0xf7d6('0xa')](),controller[_0xf7d6('0xc')]);router[_0xf7d6('0x9')](_0xf7d6('0xd'),auth['isAuthenticated'](),controller['getUsers']);router[_0xf7d6('0x9')](_0xf7d6('0xe'),auth[_0xf7d6('0xa')](),controller[_0xf7d6('0xf')]);router[_0xf7d6('0x10')]('/',auth[_0xf7d6('0xa')](),controller[_0xf7d6('0x11')]);router[_0xf7d6('0x12')](_0xf7d6('0xe'),controller[_0xf7d6('0x13')]);router[_0xf7d6('0x14')](_0xf7d6('0xe'),auth[_0xf7d6('0xa')](),controller[_0xf7d6('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe2a3=['./chatInternalMessage.controller','get','index','isAuthenticated','getUsers','/:id','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xe2a3,0x1d7));var _0x3e2a=function(_0x1d7853,_0x1f20c3){_0x1d7853=_0x1d7853-0x0;var _0xbdebec=_0xe2a3[_0x1d7853];return _0xbdebec;};'use strict';var multer=require(_0x3e2a('0x0'));var util=require(_0x3e2a('0x1'));var path=require(_0x3e2a('0x2'));var timeout=require(_0x3e2a('0x3'));var express=require(_0x3e2a('0x4'));var router=express[_0x3e2a('0x5')]();var fs_extra=require(_0x3e2a('0x6'));var auth=require(_0x3e2a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3e2a('0x8'));var controller=require(_0x3e2a('0x9'));router[_0x3e2a('0xa')]('/',auth['isAuthenticated'](),controller[_0x3e2a('0xb')]);router[_0x3e2a('0xa')]('/describe',auth[_0x3e2a('0xc')](),controller['describe']);router[_0x3e2a('0xa')]('/users',auth['isAuthenticated'](),controller[_0x3e2a('0xd')]);router['get'](_0x3e2a('0xe'),auth[_0x3e2a('0xc')](),controller['show']);router[_0x3e2a('0xf')]('/',auth[_0x3e2a('0xc')](),controller[_0x3e2a('0x10')]);router[_0x3e2a('0x11')](_0x3e2a('0xe'),controller['update']);router['delete'](_0x3e2a('0xe'),auth[_0x3e2a('0xc')](),controller[_0x3e2a('0x12')]);module[_0x3e2a('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index fbceb70..dababfd 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 _0x5eb1=['ENUM','out','DATE','STRING','exports','TEXT','medium','BOOLEAN'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x5eb1,0x7c));var _0x15eb=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0x5eb1[_0x499210];return _0x2e153d;};'use strict';var Sequelize=require('sequelize');module[_0x15eb('0x0')]={'body':{'type':Sequelize[_0x15eb('0x1')](_0x15eb('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x15eb('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x15eb('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x15eb('0x4')]('in','out'),'defaultValue':_0x15eb('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x15eb('0x6')]},'providerName':{'type':Sequelize[_0x15eb('0x7')]},'providerResponse':{'type':Sequelize[_0x15eb('0x1')]}}; \ No newline at end of file +var _0x0b0e=['TEXT','BOOLEAN','ENUM','out','DATE','STRING','sequelize'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0b0e,0x187));var _0xe0b0=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x0b0e[_0x403c20];return _0x2b271a;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe0b0('0x3')]('in',_0xe0b0('0x4')),'defaultValue':_0xe0b0('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xe0b0('0x5')]},'providerName':{'type':Sequelize[_0xe0b0('0x6')]},'providerResponse':{'type':Sequelize[_0xe0b0('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 46ca048..259ed5f 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 _0xa9e0=['interaction','[CHATMESSAGE: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','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x4b56d2,_0x4c1a0f){var _0x4e29bd=function(_0x5c2292){while(--_0x5c2292){_0x4b56d2['push'](_0x4b56d2['shift']());}};_0x4e29bd(++_0x4c1a0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE: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','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','rejectmessage','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','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x39ae83,_0x39164a){var _0x28d251=function(_0x55e6fe){while(--_0x55e6fe){_0x39ae83['push'](_0x39ae83['shift']());}};_0x28d251(++_0x39164a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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'];config[_0x0a9e('0x15')]=_[_0x0a9e('0x16')](config[_0x0a9e('0x15')],{'host':_0x0a9e('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x15')]));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x0a9e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x5d0880,_0x1985b6,_0x519dfd,_0x16033c){return new BPromise(function(_0x12066b,_0x48f32d){var _0x225616=_0x16033c||client;return _0x225616['request'](_0x5d0880,_0x519dfd)[_0x0a9e('0x1d')](function(_0x478723){logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));logger[_0x0a9e('0x21')](_0x0a9e('0x22'),_0x1985b6,_0x0a9e('0x20'),JSON[_0x0a9e('0x23')](_0x478723));if(_0x478723[_0x0a9e('0x24')]){if(_0x478723[_0x0a9e('0x24')][_0x0a9e('0x25')]===0x1f4){logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')]['message']);return _0x48f32d(_0x478723[_0x0a9e('0x24')]['message']);}logger['error'](_0x0a9e('0x1f'),_0x1985b6,_0x478723[_0x0a9e('0x24')][_0x0a9e('0x26')]);return _0x12066b(_0x478723[_0x0a9e('0x24')]['message']);}else{logger[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x1985b6,_0x0a9e('0x20'));_0x12066b(_0x478723[_0x0a9e('0x27')][_0x0a9e('0x26')]);}})[_0x0a9e('0x28')](function(_0x16b1ca){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1985b6,_0x16b1ca);_0x48f32d(_0x16b1ca);});});}function respondWithStatusCode(_0x197ec0,_0x3a8e58){_0x3a8e58=_0x3a8e58||0xcc;return function(_0x40c424){if(_0x40c424){return _0x197ec0[_0x0a9e('0x29')](_0x3a8e58);}return _0x197ec0['status'](_0x3a8e58)[_0x0a9e('0x2a')]();};}function respondWithResult(_0x479bc4,_0x45a1e7){_0x45a1e7=_0x45a1e7||0xc8;return function(_0x5bfb33){if(_0x5bfb33){return _0x479bc4[_0x0a9e('0x2b')](_0x45a1e7)[_0x0a9e('0x2c')](_0x5bfb33);}};}function respondWithFilteredResult(_0x25fba9,_0x14433c){return function(_0x140511){if(_0x140511){var _0x1538a4=typeof _0x14433c[_0x0a9e('0x2d')]===_0x0a9e('0x2e')&&typeof _0x14433c['limit']===_0x0a9e('0x2e');var _0x468813=_0x140511[_0x0a9e('0x2f')];var _0x2ec755=_0x1538a4?0x0:_0x14433c['offset'];var _0x15b200=_0x1538a4?_0x140511[_0x0a9e('0x2f')]:_0x14433c[_0x0a9e('0x2d')]+_0x14433c[_0x0a9e('0x30')];var _0x58b06f;if(_0x15b200>=_0x468813){_0x15b200=_0x468813;_0x58b06f=0xc8;}else{_0x58b06f=0xce;}_0x25fba9[_0x0a9e('0x2b')](_0x58b06f);return _0x25fba9[_0x0a9e('0x31')](_0x0a9e('0x32'),_0x2ec755+'-'+_0x15b200+'/'+_0x468813)[_0x0a9e('0x2c')](_0x140511);}return null;};}function patchUpdates(_0x540530){return function(_0x426950){try{jsonpatch['apply'](_0x426950,_0x540530,!![]);}catch(_0x2407f9){return BPromise[_0x0a9e('0x33')](_0x2407f9);}return _0x426950[_0x0a9e('0x34')]();};}function saveUpdates(_0x33bdb7,_0x25ce3a){return function(_0x5180f1){if(_0x5180f1){return _0x5180f1[_0x0a9e('0x35')](_0x33bdb7)[_0x0a9e('0x1d')](function(_0x40cb85){return _0x40cb85;});}return null;};}function removeEntity(_0x2da5c0,_0x2b45ea){return function(_0x409319){if(_0x409319){return _0x409319[_0x0a9e('0x36')]()[_0x0a9e('0x1d')](function(){_0x2da5c0['status'](0xcc)[_0x0a9e('0x2a')]();});}};}function handleEntityNotFound(_0x5e7238,_0x2cc7a0){return function(_0x14b13f){if(!_0x14b13f){_0x5e7238[_0x0a9e('0x29')](0x194);}return _0x14b13f;};}function handleError(_0x3f3d41,_0x567193){_0x567193=_0x567193||0x1f4;return function(_0x191e91){logger[_0x0a9e('0x24')](_0x191e91[_0x0a9e('0x37')]);if(_0x191e91[_0x0a9e('0x38')]){delete _0x191e91['name'];}_0x3f3d41['status'](_0x567193)[_0x0a9e('0x39')](_0x191e91);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 6ad28d0..50aad4b 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 _0xa5dc=['../../mysqldb','setMaxListeners','save','emit','hook','exports'];(function(_0x1ef452,_0x2c342b){var _0x3f3570=function(_0x1bca85){while(--_0x1bca85){_0x1ef452['push'](_0x1ef452['shift']());}};_0x3f3570(++_0x2c342b);}(_0xa5dc,0x96));var _0xca5d=function(_0x4996dd,_0x1613fc){_0x4996dd=_0x4996dd-0x0;var _0x98b206=_0xa5dc[_0x4996dd];return _0x98b206;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xca5d('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xca5d('0x1')](0x0);var events={'afterCreate':_0xca5d('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5613be){return function(_0x5d18f7,_0x910e0c,_0x2abef7){ChatMessageEvents[_0xca5d('0x3')](_0x5613be+':'+_0x5d18f7['id'],_0x5d18f7);ChatMessageEvents[_0xca5d('0x3')](_0x5613be,_0x5d18f7);_0x2abef7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xca5d('0x4')](e,emitEvent(event));}}module[_0xca5d('0x5')]=ChatMessageEvents; \ No newline at end of file +var _0x7ca1=['hook','exports','events','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x44c11f,_0x4d12f9){var _0x23796c=function(_0x1dad07){while(--_0x1dad07){_0x44c11f['push'](_0x44c11f['shift']());}};_0x23796c(++_0x4d12f9);}(_0x7ca1,0xe3));var _0x17ca=function(_0x1514e0,_0x1a31a5){_0x1514e0=_0x1514e0-0x0;var _0x1e055d=_0x7ca1[_0x1514e0];return _0x1e055d;};'use strict';var EventEmitter=require(_0x17ca('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x17ca('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x17ca('0x2'),'afterUpdate':_0x17ca('0x3'),'afterDestroy':_0x17ca('0x4')};function emitEvent(_0x2cf34f){return function(_0x5465af,_0x3130c4,_0xde6396){ChatMessageEvents['emit'](_0x2cf34f+':'+_0x5465af['id'],_0x5465af);ChatMessageEvents[_0x17ca('0x5')](_0x2cf34f,_0x5465af);_0xde6396(null);};}for(var e in events){if(events[_0x17ca('0x6')](e)){var event=events[e];ChatMessage[_0x17ca('0x7')](e,emitEvent(event));}}module[_0x17ca('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 6118176..90a6191 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 _0x91f4=['error','utf8mb4','utf8mb4_unicode_ci','util','bluebird','path','exports','define','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','then','update','createdAt','catch'];(function(_0x5f4c61,_0x42e0cf){var _0x16309d=function(_0x5e6127){while(--_0x5e6127){_0x5f4c61['push'](_0x5f4c61['shift']());}};_0x16309d(++_0x42e0cf);}(_0x91f4,0xc9));var _0x491f=function(_0x247449,_0x479b74){_0x247449=_0x247449-0x0;var _0x33471e=_0x91f4[_0x247449];return _0x33471e;};'use strict';var _=require('lodash');var util=require(_0x491f('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x491f('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x491f('0x2'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0x491f('0x3')]=function(_0x54d45c,_0x37df6a){return _0x54d45c[_0x491f('0x4')]('ChatMessage',attributes,{'tableName':_0x491f('0x5'),'paranoid':![],'indexes':[{'name':_0x491f('0x6'),'fields':[_0x491f('0x7')],'type':_0x491f('0x8')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x568a46,_0x3d853d,_0x1db77d){var _0x231c33=_0x54d45c['models'];var _0x598ad4=_0x568a46['get']({'plain':!![]});if(_0x598ad4[_0x491f('0x9')][_0x491f('0xa')]()==='in'||_0x598ad4[_0x491f('0x9')]['toLowerCase']()==='out'&&!_0x598ad4[_0x491f('0xb')]&&!_[_0x491f('0xc')](_0x598ad4['UserId'])){_0x231c33[_0x491f('0xd')][_0x491f('0xe')]({'where':{'id':_0x598ad4['ChatInteractionId']}})[_0x491f('0xf')](function(_0x3b4c33){if(_0x3b4c33){_0x3b4c33[_0x491f('0x10')]({'lastMsgAt':_0x598ad4[_0x491f('0x11')],'lastMsgDirection':_0x598ad4[_0x491f('0x9')]['toLowerCase']()});}})[_0x491f('0x12')](function(_0x5be319){console[_0x491f('0x13')](_0x5be319);});}_0x1db77d();}},'charset':_0x491f('0x14'),'collate':_0x491f('0x15')});}; \ No newline at end of file +var _0x9fcf=['fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','findOne','ChatInteractionId','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','exports','chat_messages'];(function(_0x402885,_0x58cee4){var _0x3e2800=function(_0x431243){while(--_0x431243){_0x402885['push'](_0x402885['shift']());}};_0x3e2800(++_0x58cee4);}(_0x9fcf,0x1da));var _0xf9fc=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x9fcf[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xf9fc('0x0'));var util=require(_0xf9fc('0x1'));var logger=require(_0xf9fc('0x2'))('api');var moment=require(_0xf9fc('0x3'));var BPromise=require('bluebird');var rp=require(_0xf9fc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf9fc('0x5'));var config=require(_0xf9fc('0x6'));var attributes=require('./chatMessage.attributes');module[_0xf9fc('0x7')]=function(_0x579f7c,_0x5a17fc){return _0x579f7c['define']('ChatMessage',attributes,{'tableName':_0xf9fc('0x8'),'paranoid':![],'indexes':[{'name':_0xf9fc('0x9'),'fields':[_0xf9fc('0xa')],'type':_0xf9fc('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x34e40a,_0x3c5680,_0xe3402){var _0x16182c=_0x579f7c[_0xf9fc('0xc')];var _0x242689=_0x34e40a['get']({'plain':!![]});if(_0x242689[_0xf9fc('0xd')][_0xf9fc('0xe')]()==='in'||_0x242689[_0xf9fc('0xd')]['toLowerCase']()===_0xf9fc('0xf')&&!_0x242689['secret']&&!_[_0xf9fc('0x10')](_0x242689[_0xf9fc('0x11')])){_0x16182c['ChatInteraction'][_0xf9fc('0x12')]({'where':{'id':_0x242689[_0xf9fc('0x13')]}})[_0xf9fc('0x14')](function(_0x3523f9){if(_0x3523f9){_0x3523f9['update']({'lastMsgAt':_0x242689['createdAt'],'lastMsgDirection':_0x242689[_0xf9fc('0xd')][_0xf9fc('0xe')]()});}})['catch'](function(_0x34b6a0){console['error'](_0x34b6a0);});}_0xe3402();}},'charset':_0xf9fc('0x15'),'collate':_0xf9fc('0x16')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 73bc093..e0401ca 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 _0x4725=['http','defaults','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','create','raw','CreateChatMessage','lodash','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5ea8c4,_0x123360){var _0x2a3fdf=function(_0x1bd294){while(--_0x1bd294){_0x5ea8c4['push'](_0x5ea8c4['shift']());}};_0x2a3fdf(++_0x123360);}(_0x4725,0x14a));var _0x5472=function(_0x23c7a5,_0x5396f5){_0x23c7a5=_0x23c7a5-0x0;var _0x528a79=_0x4725[_0x23c7a5];return _0x528a79;};'use strict';var _=require(_0x5472('0x0'));var util=require(_0x5472('0x1'));var moment=require('moment');var BPromise=require(_0x5472('0x2'));var rs=require(_0x5472('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5472('0x4'))(_0x5472('0x5'));var config=require(_0x5472('0x6'));var jayson=require(_0x5472('0x7'));var client=jayson['client'][_0x5472('0x8')]({'port':0x232a});config['redis']=_[_0x5472('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5472('0xa'))(new Redis(config['redis']));require(_0x5472('0xb'))[_0x5472('0xc')](socket);function respondWithRpcPromise(_0x12d306,_0x54afc0,_0x4080a0){return new BPromise(function(_0x18b542,_0xb200dd){return client['request'](_0x12d306,_0x4080a0)[_0x5472('0xd')](function(_0x339742){logger[_0x5472('0xe')](_0x5472('0xf'),_0x54afc0,_0x5472('0x10'));logger[_0x5472('0x11')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x54afc0,_0x5472('0x10'),JSON[_0x5472('0x12')](_0x339742));if(_0x339742[_0x5472('0x13')]){if(_0x339742[_0x5472('0x13')][_0x5472('0x14')]===0x1f4){logger[_0x5472('0x13')]('ChatMessage,\x20%s,\x20%s',_0x54afc0,_0x339742[_0x5472('0x13')][_0x5472('0x15')]);return _0xb200dd(_0x339742[_0x5472('0x13')][_0x5472('0x15')]);}logger[_0x5472('0x13')](_0x5472('0xf'),_0x54afc0,_0x339742['error']['message']);return _0x18b542(_0x339742[_0x5472('0x13')][_0x5472('0x15')]);}else{logger[_0x5472('0xe')](_0x5472('0xf'),_0x54afc0,_0x5472('0x10'));_0x18b542(_0x339742['result'][_0x5472('0x15')]);}})[_0x5472('0x16')](function(_0x3cf8cd){logger[_0x5472('0x13')]('ChatMessage,\x20%s,\x20%s',_0x54afc0,_0x3cf8cd);_0xb200dd(_0x3cf8cd);});});}exports['CreateChatMessage']=function(_0x331f96){var _0xbbcb2d=this;return new Promise(function(_0x3202c1,_0x2ff801){return db['ChatMessage'][_0x5472('0x17')](_0x331f96['body'],{'raw':_0x331f96['options']?_0x331f96['options'][_0x5472('0x18')]===undefined?!![]:![]:!![]})[_0x5472('0xd')](function(_0x3661c4){logger['info']('CreateChatMessage',_0x331f96);logger[_0x5472('0x11')](_0x5472('0x19'),_0x331f96,JSON[_0x5472('0x12')](_0x3661c4));_0x3202c1(_0x3661c4);})[_0x5472('0x16')](function(_0x41c76d){logger[_0x5472('0x13')](_0x5472('0x19'),_0x41c76d[_0x5472('0x15')],_0x331f96);_0x2ff801(_0xbbcb2d[_0x5472('0x13')](0x1f4,_0x41c76d['message']));});});}; \ No newline at end of file +var _0x613e=['./chatMessage.socket','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ChatMessage','body','options','raw','CreateChatMessage','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x5bdb15,_0x4eaf32){var _0x1293f2=function(_0x403f89){while(--_0x403f89){_0x5bdb15['push'](_0x5bdb15['shift']());}};_0x1293f2(++_0x4eaf32);}(_0x613e,0x1e1));var _0xe613=function(_0x47c0c0,_0x15f492){_0x47c0c0=_0x47c0c0-0x0;var _0x3200fd=_0x613e[_0x47c0c0];return _0x3200fd;};'use strict';var _=require(_0xe613('0x0'));var util=require(_0xe613('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe613('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe613('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe613('0x4'));var config=require(_0xe613('0x5'));var jayson=require(_0xe613('0x6'));var client=jayson['client'][_0xe613('0x7')]({'port':0x232a});config[_0xe613('0x8')]=_[_0xe613('0x9')](config[_0xe613('0x8')],{'host':_0xe613('0xa'),'port':0x18eb});var socket=require(_0xe613('0xb'))(new Redis(config[_0xe613('0x8')]));require(_0xe613('0xc'))['register'](socket);function respondWithRpcPromise(_0x34fdf9,_0x307532,_0x1b6a15){return new BPromise(function(_0x4dea7a,_0x533cf3){return client[_0xe613('0xd')](_0x34fdf9,_0x1b6a15)[_0xe613('0xe')](function(_0x58087b){logger['info'](_0xe613('0xf'),_0x307532,_0xe613('0x10'));logger[_0xe613('0x11')](_0xe613('0x12'),_0x307532,_0xe613('0x10'),JSON[_0xe613('0x13')](_0x58087b));if(_0x58087b['error']){if(_0x58087b['error'][_0xe613('0x14')]===0x1f4){logger[_0xe613('0x15')](_0xe613('0xf'),_0x307532,_0x58087b[_0xe613('0x15')][_0xe613('0x16')]);return _0x533cf3(_0x58087b[_0xe613('0x15')][_0xe613('0x16')]);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x307532,_0x58087b[_0xe613('0x15')]['message']);return _0x4dea7a(_0x58087b[_0xe613('0x15')][_0xe613('0x16')]);}else{logger['info'](_0xe613('0xf'),_0x307532,_0xe613('0x10'));_0x4dea7a(_0x58087b['result'][_0xe613('0x16')]);}})[_0xe613('0x17')](function(_0x7f9bb8){logger['error'](_0xe613('0xf'),_0x307532,_0x7f9bb8);_0x533cf3(_0x7f9bb8);});});}exports['CreateChatMessage']=function(_0x45a8c2){var _0x554e97=this;return new Promise(function(_0x472fa2,_0x5104c0){return db[_0xe613('0x18')]['create'](_0x45a8c2[_0xe613('0x19')],{'raw':_0x45a8c2['options']?_0x45a8c2[_0xe613('0x1a')][_0xe613('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0xdc0601){logger['info'](_0xe613('0x1c'),_0x45a8c2);logger[_0xe613('0x11')](_0xe613('0x1c'),_0x45a8c2,JSON[_0xe613('0x13')](_0xdc0601));_0x472fa2(_0xdc0601);})['catch'](function(_0x2931e2){logger[_0xe613('0x15')](_0xe613('0x1c'),_0x2931e2['message'],_0x45a8c2);_0x5104c0(_0x554e97[_0xe613('0x15')](0x1f4,_0x2931e2[_0xe613('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index a8520f8..960b0e9 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 _0x21d1=['chatMessage:','./chatMessage.events','save','remove','update','removeListener','register','length'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x21d1,0x1c9));var _0x121d=function(_0x1028f5,_0x55fb38){_0x1028f5=_0x1028f5-0x0;var _0x1333c6=_0x21d1[_0x1028f5];return _0x1333c6;};'use strict';var ChatMessageEvents=require(_0x121d('0x0'));var events=[_0x121d('0x1'),_0x121d('0x2'),_0x121d('0x3')];function createListener(_0x438b9b,_0x14fd65){return function(_0x550ab5){_0x14fd65['emit'](_0x438b9b,_0x550ab5);};}function removeListener(_0x20b991,_0x19c637){return function(){ChatMessageEvents[_0x121d('0x4')](_0x20b991,_0x19c637);};}exports[_0x121d('0x5')]=function(_0x2f3987){for(var _0x4c47ee=0x0,_0x226625=events[_0x121d('0x6')];_0x4c47ee<_0x226625;_0x4c47ee++){var _0x47b50b=events[_0x4c47ee];var _0x2d4d7e=createListener(_0x121d('0x7')+_0x47b50b,_0x2f3987);ChatMessageEvents['on'](_0x47b50b,_0x2d4d7e);}}; \ No newline at end of file +var _0x1c9a=['register','length','chatMessage:','./chatMessage.events','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x4afa49,_0x95abec){_0x4afa49=_0x4afa49-0x0;var _0x3248bf=_0x1c9a[_0x4afa49];return _0x3248bf;};'use strict';var ChatMessageEvents=require(_0xa1c9('0x0'));var events=[_0xa1c9('0x1'),'remove',_0xa1c9('0x2')];function createListener(_0x867bbb,_0x38c48f){return function(_0x408418){_0x38c48f[_0xa1c9('0x3')](_0x867bbb,_0x408418);};}function removeListener(_0x4a0d3d,_0x2f883c){return function(){ChatMessageEvents['removeListener'](_0x4a0d3d,_0x2f883c);};}exports[_0xa1c9('0x4')]=function(_0xdd22bf){for(var _0x237862=0x0,_0x2b0c89=events[_0xa1c9('0x5')];_0x237862<_0x2b0c89;_0x237862++){var _0x46b19a=events[_0x237862];var _0x3b1a2c=createListener(_0xa1c9('0x6')+_0x46b19a,_0xdd22bf);ChatMessageEvents['on'](_0x46b19a,_0x3b1a2c);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 2fafb87..1391642 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 _0x6b28=['get','isAuthenticated','index','/describe','describe','/:id','show','chatmessage:create','create','update','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0xee18e4,_0x1835eb){var _0x5993a8=function(_0x1af87c){while(--_0x1af87c){_0xee18e4['push'](_0xee18e4['shift']());}};_0x5993a8(++_0x1835eb);}(_0x6b28,0x13e));var _0x86b2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b28[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x86b2('0x0'));var util=require('util');var path=require(_0x86b2('0x1'));var timeout=require(_0x86b2('0x2'));var express=require(_0x86b2('0x3'));var router=express[_0x86b2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x86b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x86b2('0x6'));var controller=require('./chatMessage.controller');router[_0x86b2('0x7')]('/',auth[_0x86b2('0x8')](),controller[_0x86b2('0x9')]);router['get'](_0x86b2('0xa'),auth['isAuthenticated'](),controller[_0x86b2('0xb')]);router[_0x86b2('0x7')](_0x86b2('0xc'),auth['isAuthenticated'](),controller[_0x86b2('0xd')]);router['post']('/',auth[_0x86b2('0x8')](),interaction['tracked']('chat',_0x86b2('0xe')),controller[_0x86b2('0xf')]);router['put'](_0x86b2('0xc'),controller[_0x86b2('0x10')]);router['put'](_0x86b2('0x11'),auth[_0x86b2('0x8')](),controller[_0x86b2('0x12')]);router[_0x86b2('0x13')](_0x86b2('0x14'),auth[_0x86b2('0x8')](),controller[_0x86b2('0x15')]);router[_0x86b2('0x16')]('/:id',auth[_0x86b2('0x8')](),controller[_0x86b2('0x17')]);module[_0x86b2('0x18')]=router; \ No newline at end of file +var _0xb832=['multer','path','express','Router','../../components/auth/service','./chatMessage.controller','get','isAuthenticated','index','/:id','show','post','tracked','chat','chatmessage:create','update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xb832,0x1b5));var _0x2b83=function(_0x472d2c,_0x246328){_0x472d2c=_0x472d2c-0x0;var _0x3384ea=_0xb832[_0x472d2c];return _0x3384ea;};'use strict';var multer=require(_0x2b83('0x0'));var util=require('util');var path=require(_0x2b83('0x1'));var timeout=require('connect-timeout');var express=require(_0x2b83('0x2'));var router=express[_0x2b83('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b83('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2b83('0x5'));router[_0x2b83('0x6')]('/',auth[_0x2b83('0x7')](),controller[_0x2b83('0x8')]);router[_0x2b83('0x6')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2b83('0x6')](_0x2b83('0x9'),auth[_0x2b83('0x7')](),controller[_0x2b83('0xa')]);router[_0x2b83('0xb')]('/',auth['isAuthenticated'](),interaction[_0x2b83('0xc')](_0x2b83('0xd'),_0x2b83('0xe')),controller['create']);router['put']('/:id',controller[_0x2b83('0xf')]);router[_0x2b83('0x10')](_0x2b83('0x11'),auth[_0x2b83('0x7')](),controller[_0x2b83('0x12')]);router[_0x2b83('0x10')](_0x2b83('0x13'),auth[_0x2b83('0x7')](),controller[_0x2b83('0x14')]);router['delete'](_0x2b83('0x9'),auth[_0x2b83('0x7')](),controller[_0x2b83('0x15')]);module[_0x2b83('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 0df9d78..72658a2 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 _0x7bb6=['exports','TEXT','medium','sequelize'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x7bb6,0x1bb));var _0x67bb=function(_0x5e6f02,_0x19927e){_0x5e6f02=_0x5e6f02-0x0;var _0x4efbfc=_0x7bb6[_0x5e6f02];return _0x4efbfc;};'use strict';var Sequelize=require(_0x67bb('0x0'));module[_0x67bb('0x1')]={'body':{'type':Sequelize[_0x67bb('0x2')](_0x67bb('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xf2ea=['medium','sequelize','exports','TEXT'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xf2ea,0x121));var _0xaf2e=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xf2ea[_0x36ed48];return _0x51c63a;};'use strict';var Sequelize=require(_0xaf2e('0x0'));module[_0xaf2e('0x1')]={'body':{'type':Sequelize[_0xaf2e('0x2')](_0xaf2e('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 251ad73..f59032a 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(_0x20f799,_0x51ff5d){var _0x2c4a51=function(_0xf8c95c){while(--_0xf8c95c){_0x20f799['push'](_0x20f799['shift']());}};_0x2c4a51(++_0x51ff5d);}(_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 +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7a54,0x106));var _0x47a5=function(_0x1eb8a8,_0x32e91d){_0x1eb8a8=_0x1eb8a8-0x0;var _0x3c9f55=_0x7a54[_0x1eb8a8];return _0x3c9f55;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 1be4318..2d5a005 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 _0xda6e=['moment','bluebird','request-promise','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x42af3a,_0x2aafb9){var _0x14d099=function(_0x14a06d){while(--_0x14a06d){_0x42af3a['push'](_0x42af3a['shift']());}};_0x14d099(++_0x2aafb9);}(_0xda6e,0xe5));var _0xeda6=function(_0x188d60,_0x5582b8){_0x188d60=_0x188d60-0x0;var _0x3819e0=_0xda6e[_0x188d60];return _0x3819e0;};'use strict';var _=require(_0xeda6('0x0'));var util=require(_0xeda6('0x1'));var logger=require(_0xeda6('0x2'))('api');var moment=require(_0xeda6('0x3'));var BPromise=require(_0xeda6('0x4'));var rp=require(_0xeda6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatOfflineMessage.attributes');module['exports']=function(_0x1390e8,_0x51dd18){return _0x1390e8['define']('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xeda6('0x6'),'collate':_0xeda6('0x7')});}; \ No newline at end of file +var _0xcc05=['ChatOfflineMessage','chat_offline_messages','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports'];(function(_0x5847b1,_0x579628){var _0xacd877=function(_0x182eaf){while(--_0x182eaf){_0x5847b1['push'](_0x5847b1['shift']());}};_0xacd877(++_0x579628);}(_0xcc05,0x1d6));var _0x5cc0=function(_0x4a2666,_0x1a5433){_0x4a2666=_0x4a2666-0x0;var _0x14f962=_0xcc05[_0x4a2666];return _0x14f962;};'use strict';var _=require(_0x5cc0('0x0'));var util=require(_0x5cc0('0x1'));var logger=require(_0x5cc0('0x2'))(_0x5cc0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5cc0('0x4'));var fs=require('fs');var path=require(_0x5cc0('0x5'));var rimraf=require(_0x5cc0('0x6'));var config=require(_0x5cc0('0x7'));var attributes=require(_0x5cc0('0x8'));module[_0x5cc0('0x9')]=function(_0x10b8b1,_0x3281fa){return _0x10b8b1['define'](_0x5cc0('0xa'),attributes,{'tableName':_0x5cc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 bc3d576..819763a 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 _0xe562=['rpc','../../config/environment','http','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x7f0422,_0x2274a0){var _0x4412de=function(_0x27b341){while(--_0x27b341){_0x7f0422['push'](_0x7f0422['shift']());}};_0x4412de(++_0x2274a0);}(_0xe562,0x72));var _0x2e56=function(_0x1f24c0,_0x489f4c){_0x1f24c0=_0x1f24c0-0x0;var _0x5899f4=_0xe562[_0x1f24c0];return _0x5899f4;};'use strict';var _=require(_0x2e56('0x0'));var util=require('util');var moment=require(_0x2e56('0x1'));var BPromise=require(_0x2e56('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e56('0x3'));var db=require(_0x2e56('0x4'))['db'];var utils=require(_0x2e56('0x5'));var logger=require('../../config/logger')(_0x2e56('0x6'));var config=require(_0x2e56('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2e56('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d762e,_0x85d962,_0x11c9bd){return new BPromise(function(_0x50c3d1,_0x1d42af){return client['request'](_0x3d762e,_0x11c9bd)[_0x2e56('0x9')](function(_0x19a475){logger[_0x2e56('0xa')](_0x2e56('0xb'),_0x85d962,_0x2e56('0xc'));logger[_0x2e56('0xd')](_0x2e56('0xe'),_0x85d962,_0x2e56('0xc'),JSON[_0x2e56('0xf')](_0x19a475));if(_0x19a475[_0x2e56('0x10')]){if(_0x19a475['error'][_0x2e56('0x11')]===0x1f4){logger[_0x2e56('0x10')](_0x2e56('0xb'),_0x85d962,_0x19a475[_0x2e56('0x10')][_0x2e56('0x12')]);return _0x1d42af(_0x19a475['error'][_0x2e56('0x12')]);}logger[_0x2e56('0x10')](_0x2e56('0xb'),_0x85d962,_0x19a475[_0x2e56('0x10')][_0x2e56('0x12')]);return _0x50c3d1(_0x19a475[_0x2e56('0x10')][_0x2e56('0x12')]);}else{logger[_0x2e56('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x85d962,'request\x20sent');_0x50c3d1(_0x19a475['result'][_0x2e56('0x12')]);}})[_0x2e56('0x13')](function(_0x42c588){logger[_0x2e56('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x85d962,_0x42c588);_0x1d42af(_0x42c588);});});} \ No newline at end of file +var _0xfe11=['request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfe11,0x94));var _0x1fe1=function(_0x44d6b8,_0xe7e065){_0x44d6b8=_0x44d6b8-0x0;var _0x18cbfa=_0xfe11[_0x44d6b8];return _0x18cbfa;};'use strict';var _=require(_0x1fe1('0x0'));var util=require(_0x1fe1('0x1'));var moment=require(_0x1fe1('0x2'));var BPromise=require(_0x1fe1('0x3'));var rs=require(_0x1fe1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1fe1('0x5'));var logger=require(_0x1fe1('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1fe1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x340c29,_0x11477c,_0x2f08ce){return new BPromise(function(_0x49b66c,_0x392209){return client[_0x1fe1('0x8')](_0x340c29,_0x2f08ce)[_0x1fe1('0x9')](function(_0x3a1784){logger[_0x1fe1('0xa')](_0x1fe1('0xb'),_0x11477c,_0x1fe1('0xc'));logger[_0x1fe1('0xd')](_0x1fe1('0xe'),_0x11477c,_0x1fe1('0xc'),JSON['stringify'](_0x3a1784));if(_0x3a1784[_0x1fe1('0xf')]){if(_0x3a1784[_0x1fe1('0xf')][_0x1fe1('0x10')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x11477c,_0x3a1784[_0x1fe1('0xf')][_0x1fe1('0x11')]);return _0x392209(_0x3a1784[_0x1fe1('0xf')][_0x1fe1('0x11')]);}logger[_0x1fe1('0xf')](_0x1fe1('0xb'),_0x11477c,_0x3a1784[_0x1fe1('0xf')][_0x1fe1('0x11')]);return _0x49b66c(_0x3a1784[_0x1fe1('0xf')][_0x1fe1('0x11')]);}else{logger[_0x1fe1('0xa')](_0x1fe1('0xb'),_0x11477c,'request\x20sent');_0x49b66c(_0x3a1784[_0x1fe1('0x12')][_0x1fe1('0x11')]);}})[_0x1fe1('0x13')](function(_0x3afc84){logger[_0x1fe1('0xf')](_0x1fe1('0xb'),_0x11477c,_0x3afc84);_0x392209(_0x3afc84);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index a573170..b11c583 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 _0x503d=['show','post','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5d4418,_0x5408cb){var _0x192224=function(_0x37fd65){while(--_0x37fd65){_0x5d4418['push'](_0x5d4418['shift']());}};_0x192224(++_0x5408cb);}(_0x503d,0x8a));var _0xd503=function(_0x30182f,_0x30ce41){_0x30182f=_0x30182f-0x0;var _0x5207db=_0x503d[_0x30182f];return _0x5207db;};'use strict';var multer=require(_0xd503('0x0'));var util=require(_0xd503('0x1'));var path=require(_0xd503('0x2'));var timeout=require(_0xd503('0x3'));var express=require(_0xd503('0x4'));var router=express[_0xd503('0x5')]();var fs_extra=require(_0xd503('0x6'));var auth=require(_0xd503('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd503('0x8'));var controller=require(_0xd503('0x9'));router[_0xd503('0xa')]('/',auth[_0xd503('0xb')](),controller[_0xd503('0xc')]);router[_0xd503('0xa')](_0xd503('0xd'),auth[_0xd503('0xb')](),controller[_0xd503('0xe')]);router[_0xd503('0xa')](_0xd503('0xf'),auth[_0xd503('0xb')](),controller[_0xd503('0x10')]);router[_0xd503('0x11')]('/',auth['isAuthenticated'](),controller[_0xd503('0x12')]);router[_0xd503('0x13')]('/:id',auth[_0xd503('0xb')](),controller['update']);router[_0xd503('0x14')](_0xd503('0xf'),auth[_0xd503('0xb')](),controller[_0xd503('0x15')]);module['exports']=router; \ No newline at end of file +var _0xb110=['/:id','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','/describe','get'];(function(_0xe51964,_0x433b90){var _0x2c2366=function(_0x1bc95c){while(--_0x1bc95c){_0xe51964['push'](_0xe51964['shift']());}};_0x2c2366(++_0x433b90);}(_0xb110,0x16e));var _0x0b11=function(_0x26bab7,_0x2e8a91){_0x26bab7=_0x26bab7-0x0;var _0x2c042d=_0xb110[_0x26bab7];return _0x2c042d;};'use strict';var multer=require(_0x0b11('0x0'));var util=require(_0x0b11('0x1'));var path=require(_0x0b11('0x2'));var timeout=require('connect-timeout');var express=require(_0x0b11('0x3'));var router=express[_0x0b11('0x4')]();var fs_extra=require(_0x0b11('0x5'));var auth=require(_0x0b11('0x6'));var interaction=require(_0x0b11('0x7'));var config=require(_0x0b11('0x8'));var controller=require(_0x0b11('0x9'));router['get']('/',auth[_0x0b11('0xa')](),controller[_0x0b11('0xb')]);router['get'](_0x0b11('0xc'),auth[_0x0b11('0xa')](),controller['describe']);router[_0x0b11('0xd')](_0x0b11('0xe'),auth[_0x0b11('0xa')](),controller['show']);router['post']('/',auth[_0x0b11('0xa')](),controller['create']);router[_0x0b11('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0b11('0x10')]);router['delete']('/:id',auth[_0x0b11('0xa')](),controller[_0x0b11('0x11')]);module[_0x0b11('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index b4e4a4b..ccff6a3 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 _0x58bb=['exports','ENUM','mouseOver','STRING','INTEGER','sequelize'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x58bb,0xc5));var _0xb58b=function(_0x3648ad,_0x1f9094){_0x3648ad=_0x3648ad-0x0;var _0x2424e1=_0x58bb[_0x3648ad];return _0x2424e1;};'use strict';var Sequelize=require(_0xb58b('0x0'));module[_0xb58b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb58b('0x2')](_0xb58b('0x3'),'timeout'),'defaultValue':_0xb58b('0x3')},'selector':{'type':Sequelize[_0xb58b('0x4')]},'timeout':{'type':Sequelize[_0xb58b('0x5')]}}; \ No newline at end of file +var _0x937d=['ENUM','mouseOver','timeout','exports','STRING'];(function(_0x1e9235,_0x17560a){var _0x5a2c62=function(_0x5467ce){while(--_0x5467ce){_0x1e9235['push'](_0x1e9235['shift']());}};_0x5a2c62(++_0x17560a);}(_0x937d,0x170));var _0xd937=function(_0x1d6093,_0x1c110b){_0x1d6093=_0x1d6093-0x0;var _0x21c796=_0x937d[_0x1d6093];return _0x21c796;};'use strict';var Sequelize=require('sequelize');module[_0xd937('0x0')]={'name':{'type':Sequelize[_0xd937('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd937('0x2')](_0xd937('0x3'),_0xd937('0x4')),'defaultValue':_0xd937('0x3')},'selector':{'type':Sequelize[_0xd937('0x1')]},'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 43ba67e..79fe4e7 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 _0xbecd=['crypto','jsforce','desk.js','papaparse','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','end','error','name','send','show','params','keys','rawAttributes','filters','intersection','model','query','fields','attributes','includeAll','include','merge','options','ChatProactiveAction','catch','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x23aeaf,_0x241fa7){var _0x118109=function(_0x3971ca){while(--_0x3971ca){_0x23aeaf['push'](_0x23aeaf['shift']());}};_0x118109(++_0x241fa7);}(_0xbecd,0x6a));var _0xdbec=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbecd[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xdbec('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdbec('0x1'));var jsonpatch=require(_0xdbec('0x2'));var rp=require('request-promise');var moment=require(_0xdbec('0x3'));var BPromise=require(_0xdbec('0x4'));var Mustache=require(_0xdbec('0x5'));var util=require(_0xdbec('0x6'));var path=require(_0xdbec('0x7'));var sox=require(_0xdbec('0x8'));var csv=require(_0xdbec('0x9'));var ejs=require(_0xdbec('0xa'));var fs=require('fs');var fs_extra=require(_0xdbec('0xb'));var _=require(_0xdbec('0xc'));var squel=require(_0xdbec('0xd'));var crypto=require(_0xdbec('0xe'));var jsforce=require(_0xdbec('0xf'));var deskjs=require(_0xdbec('0x10'));var toCsv=require(_0xdbec('0x9'));var querystring=require('querystring');var Papa=require(_0xdbec('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(_0xdbec('0x12'));var logger=require(_0xdbec('0x13'))('api');var utils=require(_0xdbec('0x14'));var config=require(_0xdbec('0x15'));var licenseUtil=require(_0xdbec('0x16'));var db=require(_0xdbec('0x17'))['db'];function respondWithStatusCode(_0x15540a,_0x2a2d14){_0x2a2d14=_0x2a2d14||0xcc;return function(_0x52ebb1){if(_0x52ebb1){return _0x15540a[_0xdbec('0x18')](_0x2a2d14);}return _0x15540a[_0xdbec('0x19')](_0x2a2d14)['end']();};}function respondWithResult(_0xd5300d,_0x109dd7){_0x109dd7=_0x109dd7||0xc8;return function(_0x5dd681){if(_0x5dd681){return _0xd5300d[_0xdbec('0x19')](_0x109dd7)['json'](_0x5dd681);}};}function respondWithFilteredResult(_0x45684f,_0x4a2906){return function(_0x45321f){if(_0x45321f){var _0x53420c=typeof _0x4a2906['offset']===_0xdbec('0x1a')&&typeof _0x4a2906[_0xdbec('0x1b')]===_0xdbec('0x1a');var _0x414f6f=_0x45321f[_0xdbec('0x1c')];var _0x392600=_0x53420c?0x0:_0x4a2906[_0xdbec('0x1d')];var _0x5d9ed5=_0x53420c?_0x45321f[_0xdbec('0x1c')]:_0x4a2906[_0xdbec('0x1d')]+_0x4a2906[_0xdbec('0x1b')];var _0x384a9d;if(_0x5d9ed5>=_0x414f6f){_0x5d9ed5=_0x414f6f;_0x384a9d=0xc8;}else{_0x384a9d=0xce;}_0x45684f[_0xdbec('0x19')](_0x384a9d);return _0x45684f[_0xdbec('0x1e')](_0xdbec('0x1f'),_0x392600+'-'+_0x5d9ed5+'/'+_0x414f6f)['json'](_0x45321f);}return null;};}function patchUpdates(_0x405a2a){return function(_0x3d1236){try{jsonpatch[_0xdbec('0x20')](_0x3d1236,_0x405a2a,!![]);}catch(_0x588f61){return BPromise[_0xdbec('0x21')](_0x588f61);}return _0x3d1236['save']();};}function saveUpdates(_0x361fc4,_0x3c2769){return function(_0x3c81b3){if(_0x3c81b3){return _0x3c81b3[_0xdbec('0x22')](_0x361fc4)[_0xdbec('0x23')](function(_0x37cf85){return _0x37cf85;});}return null;};}function removeEntity(_0x22c2b6,_0x3b5c13){return function(_0x25e37e){if(_0x25e37e){return _0x25e37e[_0xdbec('0x24')]()[_0xdbec('0x23')](function(){_0x22c2b6[_0xdbec('0x19')](0xcc)[_0xdbec('0x25')]();});}};}function handleEntityNotFound(_0x3aeaa4,_0x33f91){return function(_0x267b7e){if(!_0x267b7e){_0x3aeaa4[_0xdbec('0x18')](0x194);}return _0x267b7e;};}function handleError(_0x29283b,_0x1ace13){_0x1ace13=_0x1ace13||0x1f4;return function(_0x1f7f4d){logger[_0xdbec('0x26')](_0x1f7f4d['stack']);if(_0x1f7f4d[_0xdbec('0x27')]){delete _0x1f7f4d[_0xdbec('0x27')];}_0x29283b[_0xdbec('0x19')](_0x1ace13)[_0xdbec('0x28')](_0x1f7f4d);};}exports[_0xdbec('0x29')]=function(_0x3e368c,_0x5efa6d){var _0x43aa89={'raw':!![],'where':{'id':_0x3e368c[_0xdbec('0x2a')]['id']}},_0x2225ae={};_0x2225ae['model']=_[_0xdbec('0x2b')](db['ChatProactiveAction'][_0xdbec('0x2c')]);_0x2225ae['query']=_[_0xdbec('0x2b')](_0x3e368c['query']);_0x2225ae[_0xdbec('0x2d')]=_[_0xdbec('0x2e')](_0x2225ae[_0xdbec('0x2f')],_0x2225ae['query']);_0x43aa89['attributes']=_[_0xdbec('0x2e')](_0x2225ae[_0xdbec('0x2f')],qs['fields'](_0x3e368c[_0xdbec('0x30')][_0xdbec('0x31')]));_0x43aa89[_0xdbec('0x32')]=_0x43aa89[_0xdbec('0x32')]['length']?_0x43aa89[_0xdbec('0x32')]:_0x2225ae['model'];if(_0x3e368c[_0xdbec('0x30')][_0xdbec('0x33')]){_0x43aa89[_0xdbec('0x34')]=[{'all':!![]}];}_0x43aa89=_[_0xdbec('0x35')]({},_0x43aa89,_0x3e368c[_0xdbec('0x36')]);return db[_0xdbec('0x37')]['find'](_0x43aa89)[_0xdbec('0x23')](handleEntityNotFound(_0x5efa6d,null))[_0xdbec('0x23')](respondWithResult(_0x5efa6d,null))[_0xdbec('0x38')](handleError(_0x5efa6d,null));};exports['create']=function(_0xe2c284,_0x100dcd){return db['ChatProactiveAction'][_0xdbec('0x39')](_0xe2c284['body'],{})[_0xdbec('0x23')](respondWithResult(_0x100dcd,0xc9))[_0xdbec('0x38')](handleError(_0x100dcd,null));};exports[_0xdbec('0x22')]=function(_0x2da9ec,_0x3078ab){if(_0x2da9ec[_0xdbec('0x3a')]['id']){delete _0x2da9ec['body']['id'];}return db['ChatProactiveAction'][_0xdbec('0x3b')]({'where':{'id':_0x2da9ec[_0xdbec('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3078ab,null))[_0xdbec('0x23')](saveUpdates(_0x2da9ec['body'],null))['then'](respondWithResult(_0x3078ab,null))[_0xdbec('0x38')](handleError(_0x3078ab,null));};exports[_0xdbec('0x24')]=function(_0x9ad7a9,_0x54a415){return db[_0xdbec('0x37')]['find']({'where':{'id':_0x9ad7a9[_0xdbec('0x2a')]['id']}})[_0xdbec('0x23')](handleEntityNotFound(_0x54a415,null))['then'](removeEntity(_0x54a415,null))['catch'](handleError(_0x54a415,null));}; \ No newline at end of file +var _0xb1a3=['limit','count','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','attributes','intersection','fields','length','include','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x49afb1,_0x2c71a8){var _0x56ffd9=function(_0x13e474){while(--_0x13e474){_0x49afb1['push'](_0x49afb1['shift']());}};_0x56ffd9(++_0x2c71a8);}(_0xb1a3,0x1cc));var _0x3b1a=function(_0x1e6e4e,_0x2b1b09){_0x1e6e4e=_0x1e6e4e-0x0;var _0x3d746b=_0xb1a3[_0x1e6e4e];return _0x3d746b;};'use strict';var emlformat=require(_0x3b1a('0x0'));var rimraf=require(_0x3b1a('0x1'));var zipdir=require(_0x3b1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b1a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3b1a('0x4'));var util=require(_0x3b1a('0x5'));var path=require(_0x3b1a('0x6'));var sox=require(_0x3b1a('0x7'));var csv=require(_0x3b1a('0x8'));var ejs=require(_0x3b1a('0x9'));var fs=require('fs');var fs_extra=require(_0x3b1a('0xa'));var _=require('lodash');var squel=require(_0x3b1a('0xb'));var crypto=require(_0x3b1a('0xc'));var jsforce=require(_0x3b1a('0xd'));var deskjs=require(_0x3b1a('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b1a('0xf'));var Redis=require(_0x3b1a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b1a('0x12'));var logger=require('../../config/logger')(_0x3b1a('0x13'));var utils=require(_0x3b1a('0x14'));var config=require(_0x3b1a('0x15'));var licenseUtil=require(_0x3b1a('0x16'));var db=require(_0x3b1a('0x17'))['db'];function respondWithStatusCode(_0x1fea99,_0x2bd423){_0x2bd423=_0x2bd423||0xcc;return function(_0x32e77a){if(_0x32e77a){return _0x1fea99[_0x3b1a('0x18')](_0x2bd423);}return _0x1fea99['status'](_0x2bd423)['end']();};}function respondWithResult(_0x8aad4b,_0x3dfeda){_0x3dfeda=_0x3dfeda||0xc8;return function(_0x19c135){if(_0x19c135){return _0x8aad4b[_0x3b1a('0x19')](_0x3dfeda)['json'](_0x19c135);}};}function respondWithFilteredResult(_0x1b175e,_0x2f0674){return function(_0x55ac06){if(_0x55ac06){var _0x19bbc1=typeof _0x2f0674[_0x3b1a('0x1a')]===_0x3b1a('0x1b')&&typeof _0x2f0674[_0x3b1a('0x1c')]===_0x3b1a('0x1b');var _0xf10b60=_0x55ac06[_0x3b1a('0x1d')];var _0x220869=_0x19bbc1?0x0:_0x2f0674['offset'];var _0x14996f=_0x19bbc1?_0x55ac06[_0x3b1a('0x1d')]:_0x2f0674['offset']+_0x2f0674[_0x3b1a('0x1c')];var _0x5758fd;if(_0x14996f>=_0xf10b60){_0x14996f=_0xf10b60;_0x5758fd=0xc8;}else{_0x5758fd=0xce;}_0x1b175e[_0x3b1a('0x19')](_0x5758fd);return _0x1b175e[_0x3b1a('0x1e')](_0x3b1a('0x1f'),_0x220869+'-'+_0x14996f+'/'+_0xf10b60)[_0x3b1a('0x20')](_0x55ac06);}return null;};}function patchUpdates(_0xe1113d){return function(_0x13eeec){try{jsonpatch['apply'](_0x13eeec,_0xe1113d,!![]);}catch(_0x2c0a87){return BPromise[_0x3b1a('0x21')](_0x2c0a87);}return _0x13eeec[_0x3b1a('0x22')]();};}function saveUpdates(_0x1a09f1,_0x42bdf6){return function(_0x4f5f52){if(_0x4f5f52){return _0x4f5f52['update'](_0x1a09f1)[_0x3b1a('0x23')](function(_0x447d94){return _0x447d94;});}return null;};}function removeEntity(_0x5829ea,_0x3af980){return function(_0x1728df){if(_0x1728df){return _0x1728df[_0x3b1a('0x24')]()[_0x3b1a('0x23')](function(){_0x5829ea['status'](0xcc)[_0x3b1a('0x25')]();});}};}function handleEntityNotFound(_0x417c2e,_0x2fbac5){return function(_0x482484){if(!_0x482484){_0x417c2e[_0x3b1a('0x18')](0x194);}return _0x482484;};}function handleError(_0x3744f0,_0x155d77){_0x155d77=_0x155d77||0x1f4;return function(_0x45ebfc){logger[_0x3b1a('0x26')](_0x45ebfc[_0x3b1a('0x27')]);if(_0x45ebfc['name']){delete _0x45ebfc[_0x3b1a('0x28')];}_0x3744f0[_0x3b1a('0x19')](_0x155d77)[_0x3b1a('0x29')](_0x45ebfc);};}exports[_0x3b1a('0x2a')]=function(_0x2ff415,_0x1c6399){var _0x5cb4d0={'raw':!![],'where':{'id':_0x2ff415[_0x3b1a('0x2b')]['id']}},_0x58aec7={};_0x58aec7[_0x3b1a('0x2c')]=_[_0x3b1a('0x2d')](db[_0x3b1a('0x2e')][_0x3b1a('0x2f')]);_0x58aec7[_0x3b1a('0x30')]=_[_0x3b1a('0x2d')](_0x2ff415[_0x3b1a('0x30')]);_0x58aec7[_0x3b1a('0x31')]=_['intersection'](_0x58aec7[_0x3b1a('0x2c')],_0x58aec7[_0x3b1a('0x30')]);_0x5cb4d0[_0x3b1a('0x32')]=_[_0x3b1a('0x33')](_0x58aec7[_0x3b1a('0x2c')],qs[_0x3b1a('0x34')](_0x2ff415[_0x3b1a('0x30')][_0x3b1a('0x34')]));_0x5cb4d0[_0x3b1a('0x32')]=_0x5cb4d0['attributes'][_0x3b1a('0x35')]?_0x5cb4d0[_0x3b1a('0x32')]:_0x58aec7[_0x3b1a('0x2c')];if(_0x2ff415[_0x3b1a('0x30')]['includeAll']){_0x5cb4d0[_0x3b1a('0x36')]=[{'all':!![]}];}_0x5cb4d0=_[_0x3b1a('0x37')]({},_0x5cb4d0,_0x2ff415[_0x3b1a('0x38')]);return db[_0x3b1a('0x2e')][_0x3b1a('0x39')](_0x5cb4d0)[_0x3b1a('0x23')](handleEntityNotFound(_0x1c6399,null))[_0x3b1a('0x23')](respondWithResult(_0x1c6399,null))[_0x3b1a('0x3a')](handleError(_0x1c6399,null));};exports['create']=function(_0x189e00,_0x2be45d){return db[_0x3b1a('0x2e')][_0x3b1a('0x3b')](_0x189e00[_0x3b1a('0x3c')],{})[_0x3b1a('0x23')](respondWithResult(_0x2be45d,0xc9))[_0x3b1a('0x3a')](handleError(_0x2be45d,null));};exports['update']=function(_0x3c2108,_0x420d13){if(_0x3c2108[_0x3b1a('0x3c')]['id']){delete _0x3c2108[_0x3b1a('0x3c')]['id'];}return db['ChatProactiveAction'][_0x3b1a('0x39')]({'where':{'id':_0x3c2108[_0x3b1a('0x2b')]['id']}})[_0x3b1a('0x23')](handleEntityNotFound(_0x420d13,null))[_0x3b1a('0x23')](saveUpdates(_0x3c2108[_0x3b1a('0x3c')],null))[_0x3b1a('0x23')](respondWithResult(_0x420d13,null))[_0x3b1a('0x3a')](handleError(_0x420d13,null));};exports[_0x3b1a('0x24')]=function(_0x228667,_0x5277bb){return db[_0x3b1a('0x2e')][_0x3b1a('0x39')]({'where':{'id':_0x228667['params']['id']}})[_0x3b1a('0x23')](handleEntityNotFound(_0x5277bb,null))[_0x3b1a('0x23')](removeEntity(_0x5277bb,null))[_0x3b1a('0x3a')](handleError(_0x5277bb,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6a6d579..0244835 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 _0x6860=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x488ed2,_0x150a50){var _0x237bcf=function(_0x5e2d36){while(--_0x5e2d36){_0x488ed2['push'](_0x488ed2['shift']());}};_0x237bcf(++_0x150a50);}(_0x6860,0x1ec));var _0x0686=function(_0x502596,_0x5d1e75){_0x502596=_0x502596-0x0;var _0x56e8fc=_0x6860[_0x502596];return _0x56e8fc;};'use strict';var _=require(_0x0686('0x0'));var util=require(_0x0686('0x1'));var logger=require('../../config/logger')(_0x0686('0x2'));var moment=require('moment');var BPromise=require(_0x0686('0x3'));var rp=require(_0x0686('0x4'));var fs=require('fs');var path=require(_0x0686('0x5'));var rimraf=require(_0x0686('0x6'));var config=require(_0x0686('0x7'));var attributes=require(_0x0686('0x8'));module[_0x0686('0x9')]=function(_0x6ab47f,_0x452a23){return _0x6ab47f['define'](_0x0686('0xa'),attributes,{'tableName':_0x0686('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99fa=['util','../../config/logger','api','moment','request-promise','rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x19c9a9,_0x557523){var _0x2f8388=function(_0x2d194d){while(--_0x2d194d){_0x19c9a9['push'](_0x19c9a9['shift']());}};_0x2f8388(++_0x557523);}(_0x99fa,0x1e0));var _0xa99f=function(_0x11d684,_0x4d4123){_0x11d684=_0x11d684-0x0;var _0x78a301=_0x99fa[_0x11d684];return _0x78a301;};'use strict';var _=require('lodash');var util=require(_0xa99f('0x0'));var logger=require(_0xa99f('0x1'))(_0xa99f('0x2'));var moment=require(_0xa99f('0x3'));var BPromise=require('bluebird');var rp=require(_0xa99f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa99f('0x5'));var config=require('../../config/environment');var attributes=require(_0xa99f('0x6'));module[_0xa99f('0x7')]=function(_0x464603,_0x49755b){return _0x464603['define'](_0xa99f('0x8'),attributes,{'tableName':_0xa99f('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 6373a73..5fb3fe2 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 _0x050a=['moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util'];(function(_0x212c34,_0x57a0be){var _0xcb3231=function(_0x31a5f8){while(--_0x31a5f8){_0x212c34['push'](_0x212c34['shift']());}};_0xcb3231(++_0x57a0be);}(_0x050a,0xa6));var _0xa050=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x050a[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xa050('0x0'));var util=require(_0xa050('0x1'));var moment=require(_0xa050('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa050('0x3'));var db=require(_0xa050('0x4'))['db'];var utils=require(_0xa050('0x5'));var logger=require('../../config/logger')(_0xa050('0x6'));var config=require(_0xa050('0x7'));var jayson=require(_0xa050('0x8'));var client=jayson['client'][_0xa050('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b680,_0x6a4a07,_0x5ecd23){return new BPromise(function(_0x1bb46e,_0x3f42e0){return client[_0xa050('0xa')](_0x3b680,_0x5ecd23)[_0xa050('0xb')](function(_0xadf56a){logger[_0xa050('0xc')](_0xa050('0xd'),_0x6a4a07,_0xa050('0xe'));logger[_0xa050('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x6a4a07,'request\x20sent',JSON[_0xa050('0x10')](_0xadf56a));if(_0xadf56a[_0xa050('0x11')]){if(_0xadf56a[_0xa050('0x11')][_0xa050('0x12')]===0x1f4){logger[_0xa050('0x11')](_0xa050('0xd'),_0x6a4a07,_0xadf56a[_0xa050('0x11')][_0xa050('0x13')]);return _0x3f42e0(_0xadf56a[_0xa050('0x11')][_0xa050('0x13')]);}logger[_0xa050('0x11')](_0xa050('0xd'),_0x6a4a07,_0xadf56a[_0xa050('0x11')]['message']);return _0x1bb46e(_0xadf56a[_0xa050('0x11')][_0xa050('0x13')]);}else{logger[_0xa050('0xc')](_0xa050('0xd'),_0x6a4a07,_0xa050('0xe'));_0x1bb46e(_0xadf56a['result']['message']);}})[_0xa050('0x14')](function(_0x832281){logger[_0xa050('0x11')](_0xa050('0xd'),_0x6a4a07,_0x832281);_0x3f42e0(_0x832281);});});} \ No newline at end of file +var _0xbe90=['result','catch','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xbe90,0x106));var _0x0be9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe90[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x0be9('0x0'));var moment=require(_0x0be9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0be9('0x2'))['db'];var utils=require(_0x0be9('0x3'));var logger=require(_0x0be9('0x4'))('rpc');var config=require(_0x0be9('0x5'));var jayson=require(_0x0be9('0x6'));var client=jayson[_0x0be9('0x7')][_0x0be9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf24fbe,_0x56e881,_0x109511){return new BPromise(function(_0x3ce5ac,_0x5647c5){return client[_0x0be9('0x9')](_0xf24fbe,_0x109511)['then'](function(_0x316e9c){logger['info'](_0x0be9('0xa'),_0x56e881,_0x0be9('0xb'));logger[_0x0be9('0xc')](_0x0be9('0xd'),_0x56e881,_0x0be9('0xb'),JSON[_0x0be9('0xe')](_0x316e9c));if(_0x316e9c[_0x0be9('0xf')]){if(_0x316e9c[_0x0be9('0xf')]['code']===0x1f4){logger[_0x0be9('0xf')](_0x0be9('0xa'),_0x56e881,_0x316e9c[_0x0be9('0xf')][_0x0be9('0x10')]);return _0x5647c5(_0x316e9c[_0x0be9('0xf')][_0x0be9('0x10')]);}logger[_0x0be9('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x56e881,_0x316e9c[_0x0be9('0xf')][_0x0be9('0x10')]);return _0x3ce5ac(_0x316e9c[_0x0be9('0xf')][_0x0be9('0x10')]);}else{logger[_0x0be9('0x11')](_0x0be9('0xa'),_0x56e881,_0x0be9('0xb'));_0x3ce5ac(_0x316e9c[_0x0be9('0x12')][_0x0be9('0x10')]);}})[_0x0be9('0x13')](function(_0x220302){logger[_0x0be9('0xf')](_0x0be9('0xa'),_0x56e881,_0x220302);_0x5647c5(_0x220302);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 7aa9b31..735f94f 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 _0x1cb9=['get','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatProactiveAction.controller'];(function(_0x226451,_0xe40595){var _0xe27040=function(_0x1721a1){while(--_0x1721a1){_0x226451['push'](_0x226451['shift']());}};_0xe27040(++_0xe40595);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5677e9,_0x318ff3){_0x5677e9=_0x5677e9-0x0;var _0x11ce06=_0x1cb9[_0x5677e9];return _0x11ce06;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0xb')]);router[_0x91cb('0xc')]('/',auth['isAuthenticated'](),controller[_0x91cb('0xd')]);router['put'](_0x91cb('0x9'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')](_0x91cb('0x9'),auth[_0x91cb('0xa')](),controller[_0x91cb('0x10')]);module[_0x91cb('0x11')]=router; \ No newline at end of file +var _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x13d444,_0x28b18d){var _0xbc6021=function(_0x122de0){while(--_0x122de0){_0x13d444['push'](_0x13d444['shift']());}};_0xbc6021(++_0x28b18d);}(_0x032e,0x124));var _0xe032=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x032e[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 2d5fd58..91fec5a 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 _0x25aa=['rrmemory','beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x561f25,_0x2d95c1){var _0x150e4c=function(_0x266e99){while(--_0x266e99){_0x561f25['push'](_0x561f25['shift']());}};_0x150e4c(++_0x2d95c1);}(_0x25aa,0xd2));var _0xa25a=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0x25aa[_0x5627e1];return _0x2f013f;};'use strict';var Sequelize=require(_0xa25a('0x0'));module[_0xa25a('0x1')]={'name':{'type':Sequelize[_0xa25a('0x2')],'unique':_0xa25a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa25a('0x2')]},'timeout':{'type':Sequelize[_0xa25a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa25a('0x5')](_0xa25a('0x6'),_0xa25a('0x7'),_0xa25a('0x8'))}}; \ No newline at end of file +var _0x2434=['STRING','name','INTEGER','rrmemory','beepall','roundrobin','exports'];(function(_0x513357,_0x2fc2ae){var _0x3bcd2f=function(_0x11f20c){while(--_0x11f20c){_0x513357['push'](_0x513357['shift']());}};_0x3bcd2f(++_0x2fc2ae);}(_0x2434,0x1c6));var _0x4243=function(_0x16f3f1,_0xe64512){_0x16f3f1=_0x16f3f1-0x0;var _0xa88872=_0x2434[_0x16f3f1];return _0xa88872;};'use strict';var Sequelize=require('sequelize');module[_0x4243('0x0')]={'name':{'type':Sequelize[_0x4243('0x1')],'unique':_0x4243('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4243('0x1')]},'timeout':{'type':Sequelize[_0x4243('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4243('0x4'),_0x4243('0x5'),_0x4243('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 0d9f81d..69a0154 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 _0x5037=['./chatQueue.socket','register','jayson/promise','client','http','request','info','ChatQueue,\x20%s,\x20%s','debug','stringify','code','error','message','request\x20sent','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChatQueues','UserProfileResource','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','params','fields','includeAll','include','create','body','user','UserProfileSection','find','userProfileId','describe','findOne','UserChatQueue','ChatQueueId','findAll','User','updatedAt','rows','%s/%s','SIP','chatPause','createdAt','getTeams','Team','ids','voicePause','flatMap','Agents','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','team_has_chat_queues','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','isEmpty','removeAgents','userChatQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','defaults','redis'];(function(_0x303d18,_0x216807){var _0x5daa73=function(_0x4e37f6){while(--_0x4e37f6){_0x303d18['push'](_0x303d18['shift']());}};_0x5daa73(++_0x216807);}(_0x5037,0x18c));var _0x7503=function(_0x2e837b,_0x3852fb){_0x2e837b=_0x2e837b-0x0;var _0x3d5d69=_0x5037[_0x2e837b];return _0x3d5d69;};'use strict';var emlformat=require(_0x7503('0x0'));var rimraf=require(_0x7503('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7503('0x2'));var moment=require('moment');var BPromise=require(_0x7503('0x3'));var Mustache=require(_0x7503('0x4'));var util=require(_0x7503('0x5'));var path=require('path');var sox=require(_0x7503('0x6'));var csv=require(_0x7503('0x7'));var ejs=require(_0x7503('0x8'));var fs=require('fs');var fs_extra=require(_0x7503('0x9'));var _=require(_0x7503('0xa'));var squel=require(_0x7503('0xb'));var crypto=require(_0x7503('0xc'));var jsforce=require(_0x7503('0xd'));var deskjs=require(_0x7503('0xe'));var toCsv=require(_0x7503('0x7'));var querystring=require(_0x7503('0xf'));var Papa=require(_0x7503('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7503('0x11'));var hardwareService=require(_0x7503('0x12'));var logger=require(_0x7503('0x13'))(_0x7503('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7503('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7503('0x16')](config[_0x7503('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7503('0x18'))[_0x7503('0x19')](socket);var jayson=require(_0x7503('0x1a'));var client=jayson[_0x7503('0x1b')][_0x7503('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2f83c3,_0x32dc4f,_0x1da4fc,_0x408820){return new BPromise(function(_0x1d67ba,_0x4b4753){var _0x418f16=_0x408820||client;return _0x418f16[_0x7503('0x1d')](_0x2f83c3,_0x1da4fc)['then'](function(_0x426bb4){logger[_0x7503('0x1e')](_0x7503('0x1f'),_0x32dc4f,'request\x20sent');logger[_0x7503('0x20')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x32dc4f,'request\x20sent',JSON[_0x7503('0x21')](_0x426bb4));if(_0x426bb4['error']){if(_0x426bb4['error'][_0x7503('0x22')]===0x1f4){logger[_0x7503('0x23')](_0x7503('0x1f'),_0x32dc4f,_0x426bb4['error']['message']);return _0x4b4753(_0x426bb4[_0x7503('0x23')]['message']);}logger[_0x7503('0x23')](_0x7503('0x1f'),_0x32dc4f,_0x426bb4['error'][_0x7503('0x24')]);return _0x1d67ba(_0x426bb4[_0x7503('0x23')][_0x7503('0x24')]);}else{logger[_0x7503('0x1e')](_0x7503('0x1f'),_0x32dc4f,_0x7503('0x25'));_0x1d67ba(_0x426bb4[_0x7503('0x26')]['message']);}})[_0x7503('0x27')](function(_0x1f7596){logger[_0x7503('0x23')](_0x7503('0x1f'),_0x32dc4f,_0x1f7596);_0x4b4753(_0x1f7596);});});}function respondWithStatusCode(_0x47f9ca,_0x154d0d){_0x154d0d=_0x154d0d||0xcc;return function(_0x5e1a98){if(_0x5e1a98){return _0x47f9ca['sendStatus'](_0x154d0d);}return _0x47f9ca['status'](_0x154d0d)[_0x7503('0x28')]();};}function respondWithResult(_0x31f4f3,_0x4d8640){_0x4d8640=_0x4d8640||0xc8;return function(_0x620a8b){if(_0x620a8b){return _0x31f4f3[_0x7503('0x29')](_0x4d8640)[_0x7503('0x2a')](_0x620a8b);}};}function respondWithFilteredResult(_0x1442cd,_0x373d72){return function(_0x55a6ae){if(_0x55a6ae){var _0x1d0f1a=typeof _0x373d72[_0x7503('0x2b')]===_0x7503('0x2c')&&typeof _0x373d72[_0x7503('0x2d')]===_0x7503('0x2c');var _0x504948=_0x55a6ae['count'];var _0x1d7b07=_0x1d0f1a?0x0:_0x373d72[_0x7503('0x2b')];var _0x4a5158=_0x1d0f1a?_0x55a6ae[_0x7503('0x2e')]:_0x373d72[_0x7503('0x2b')]+_0x373d72[_0x7503('0x2d')];var _0x112d48;if(_0x4a5158>=_0x504948){_0x4a5158=_0x504948;_0x112d48=0xc8;}else{_0x112d48=0xce;}_0x1442cd['status'](_0x112d48);return _0x1442cd[_0x7503('0x2f')](_0x7503('0x30'),_0x1d7b07+'-'+_0x4a5158+'/'+_0x504948)['json'](_0x55a6ae);}return null;};}function patchUpdates(_0x18108f){return function(_0x3470d7){try{jsonpatch[_0x7503('0x31')](_0x3470d7,_0x18108f,!![]);}catch(_0x2d3099){return BPromise[_0x7503('0x32')](_0x2d3099);}return _0x3470d7[_0x7503('0x33')]();};}function saveUpdates(_0x57f6ff,_0x50fbe1){return function(_0x53357e){if(_0x53357e){return _0x53357e[_0x7503('0x34')](_0x57f6ff)[_0x7503('0x35')](function(_0x34daa5){return _0x34daa5;});}return null;};}function removeEntity(_0x59fe06,_0x2789f4){return function(_0x40bc00){if(_0x40bc00){return _0x40bc00[_0x7503('0x36')]()[_0x7503('0x35')](function(){var _0x39ed23=_0x40bc00[_0x7503('0x37')]({'plain':!![]});var _0x1c69a7=_0x7503('0x38');return db[_0x7503('0x39')][_0x7503('0x36')]({'where':{'type':_0x1c69a7,'resourceId':_0x39ed23['id']}})[_0x7503('0x35')](function(){return _0x40bc00;});})[_0x7503('0x35')](function(){_0x59fe06['status'](0xcc)[_0x7503('0x28')]();});}};}function handleEntityNotFound(_0x266e5e,_0xb2f5be){return function(_0xfb09fb){if(!_0xfb09fb){_0x266e5e['sendStatus'](0x194);}return _0xfb09fb;};}function handleError(_0x240887,_0x52854d){_0x52854d=_0x52854d||0x1f4;return function(_0x1cca89){logger[_0x7503('0x23')](_0x1cca89[_0x7503('0x3a')]);if(_0x1cca89[_0x7503('0x3b')]){delete _0x1cca89[_0x7503('0x3b')];}_0x240887['status'](_0x52854d)['send'](_0x1cca89);};}exports[_0x7503('0x3c')]=function(_0x5442b3,_0x45aaa2){var _0x57809b={},_0x44da6e={},_0x36acac={'count':0x0,'rows':[]};var _0x58618f=_[_0x7503('0x3d')](db[_0x7503('0x3e')][_0x7503('0x3f')],function(_0x1cde6f){return{'name':_0x1cde6f[_0x7503('0x40')],'type':_0x1cde6f[_0x7503('0x41')][_0x7503('0x42')]};});_0x44da6e[_0x7503('0x43')]=_[_0x7503('0x3d')](_0x58618f,_0x7503('0x3b'));_0x44da6e[_0x7503('0x44')]=_[_0x7503('0x45')](_0x5442b3[_0x7503('0x44')]);_0x44da6e['filters']=_[_0x7503('0x46')](_0x44da6e[_0x7503('0x43')],_0x44da6e[_0x7503('0x44')]);_0x57809b[_0x7503('0x47')]=_['intersection'](_0x44da6e[_0x7503('0x43')],qs['fields'](_0x5442b3[_0x7503('0x44')]['fields']));_0x57809b['attributes']=_0x57809b[_0x7503('0x47')][_0x7503('0x48')]?_0x57809b[_0x7503('0x47')]:_0x44da6e['model'];if(!_0x5442b3[_0x7503('0x44')][_0x7503('0x49')](_0x7503('0x4a'))){_0x57809b['limit']=qs[_0x7503('0x2d')](_0x5442b3[_0x7503('0x44')][_0x7503('0x2d')]);_0x57809b[_0x7503('0x2b')]=qs['offset'](_0x5442b3[_0x7503('0x44')][_0x7503('0x2b')]);}_0x57809b[_0x7503('0x4b')]=qs[_0x7503('0x4c')](_0x5442b3[_0x7503('0x44')][_0x7503('0x4c')]);_0x57809b['where']=qs[_0x7503('0x4d')](_[_0x7503('0x4e')](_0x5442b3[_0x7503('0x44')],_0x44da6e[_0x7503('0x4d')]),_0x58618f);if(_0x5442b3['query'][_0x7503('0x4f')]){_0x57809b['where']=_['merge'](_0x57809b[_0x7503('0x50')],{'$or':_[_0x7503('0x3d')](_0x58618f,function(_0x496869){if(_0x496869[_0x7503('0x41')]!=='VIRTUAL'){var _0x3527cb={};_0x3527cb[_0x496869[_0x7503('0x3b')]]={'$like':'%'+_0x5442b3[_0x7503('0x44')][_0x7503('0x4f')]+'%'};return _0x3527cb;}})});}_0x57809b=_[_0x7503('0x51')]({},_0x57809b,_0x5442b3[_0x7503('0x52')]);var _0x37d66b={'where':_0x57809b[_0x7503('0x50')]};return db[_0x7503('0x3e')]['count'](_0x37d66b)['then'](function(_0x300e32){_0x36acac[_0x7503('0x2e')]=_0x300e32;if(_0x5442b3[_0x7503('0x44')]['includeAll']){_0x57809b['include']=[{'all':!![]}];}return db[_0x7503('0x3e')]['findAll'](_0x57809b);})[_0x7503('0x35')](function(_0x311cd4){_0x36acac['rows']=_0x311cd4;return _0x36acac;})[_0x7503('0x35')](respondWithFilteredResult(_0x45aaa2,_0x57809b))['catch'](handleError(_0x45aaa2,null));};exports['show']=function(_0x2a6894,_0x18617e){var _0x26bf6f={'raw':!![],'where':{'id':_0x2a6894[_0x7503('0x53')]['id']}},_0x107be6={};_0x107be6['model']=_[_0x7503('0x45')](db[_0x7503('0x3e')][_0x7503('0x3f')]);_0x107be6[_0x7503('0x44')]=_[_0x7503('0x45')](_0x2a6894[_0x7503('0x44')]);_0x107be6[_0x7503('0x4d')]=_['intersection'](_0x107be6['model'],_0x107be6[_0x7503('0x44')]);_0x26bf6f['attributes']=_[_0x7503('0x46')](_0x107be6[_0x7503('0x43')],qs[_0x7503('0x54')](_0x2a6894[_0x7503('0x44')][_0x7503('0x54')]));_0x26bf6f[_0x7503('0x47')]=_0x26bf6f['attributes'][_0x7503('0x48')]?_0x26bf6f[_0x7503('0x47')]:_0x107be6['model'];if(_0x2a6894[_0x7503('0x44')][_0x7503('0x55')]){_0x26bf6f[_0x7503('0x56')]=[{'all':!![]}];}_0x26bf6f=_[_0x7503('0x51')]({},_0x26bf6f,_0x2a6894[_0x7503('0x52')]);return db[_0x7503('0x3e')]['find'](_0x26bf6f)[_0x7503('0x35')](handleEntityNotFound(_0x18617e,null))[_0x7503('0x35')](respondWithResult(_0x18617e,null))[_0x7503('0x27')](handleError(_0x18617e,null));};exports[_0x7503('0x57')]=function(_0x1f8921,_0x34f1df){return db[_0x7503('0x3e')][_0x7503('0x57')](_0x1f8921[_0x7503('0x58')],{})['then'](function(_0x289689){var _0x445e17=_0x1f8921[_0x7503('0x59')][_0x7503('0x37')]({'plain':!![]});if(!_0x445e17)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x445e17['role']===_0x7503('0x59')){var _0xf99736=_0x289689['get']({'plain':!![]});var _0x24051a=_0x7503('0x38');return db[_0x7503('0x5a')][_0x7503('0x5b')]({'where':{'name':_0x24051a,'userProfileId':_0x445e17[_0x7503('0x5c')]},'raw':!![]})[_0x7503('0x35')](function(_0x15417d){if(_0x15417d&&_0x15417d['autoAssociation']===0x0){return db[_0x7503('0x39')][_0x7503('0x57')]({'name':_0xf99736[_0x7503('0x3b')],'resourceId':_0xf99736['id'],'type':_0x15417d['name'],'sectionId':_0x15417d['id']},{})['then'](function(){return _0x289689;});}else{return _0x289689;}})[_0x7503('0x27')](function(_0x4657bc){logger[_0x7503('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4657bc);throw _0x4657bc;});}return _0x289689;})['then'](respondWithResult(_0x34f1df,0xc9))['catch'](handleError(_0x34f1df,null));};exports['update']=function(_0x1ac8ae,_0x394274){if(_0x1ac8ae[_0x7503('0x58')]['id']){delete _0x1ac8ae[_0x7503('0x58')]['id'];}return db[_0x7503('0x3e')][_0x7503('0x5b')]({'where':{'id':_0x1ac8ae['params']['id']}})[_0x7503('0x35')](handleEntityNotFound(_0x394274,null))['then'](saveUpdates(_0x1ac8ae[_0x7503('0x58')],null))['then'](respondWithResult(_0x394274,null))[_0x7503('0x27')](handleError(_0x394274,null));};exports[_0x7503('0x36')]=function(_0x29a80a,_0x282d6f){return db[_0x7503('0x3e')][_0x7503('0x5b')]({'where':{'id':_0x29a80a[_0x7503('0x53')]['id']}})[_0x7503('0x35')](handleEntityNotFound(_0x282d6f,null))[_0x7503('0x35')](removeEntity(_0x282d6f,null))['catch'](handleError(_0x282d6f,null));};exports[_0x7503('0x5d')]=function(_0x3b7ebe,_0x2959d5){return db['ChatQueue'][_0x7503('0x5d')]()[_0x7503('0x35')](respondWithResult(_0x2959d5,null))['catch'](handleError(_0x2959d5,null));};exports['getMembers']=function(_0x34ede4,_0x1a4361,_0x35b06c){var _0x90d95f={'raw':!![],'where':{}},_0x19874e={},_0x9803f4;return db['ChatQueue'][_0x7503('0x5e')]({'where':{'id':_0x34ede4['params']['id']}})[_0x7503('0x35')](handleEntityNotFound(_0x1a4361,null))['then'](function(_0x25dde0){if(_0x25dde0){_0x9803f4=_0x25dde0[_0x7503('0x37')]({'plain':!![]});_0x19874e[_0x7503('0x43')]=_[_0x7503('0x45')](db[_0x7503('0x5f')][_0x7503('0x3f')]);_0x19874e[_0x7503('0x44')]=_[_0x7503('0x45')](_0x34ede4[_0x7503('0x44')]);_0x19874e[_0x7503('0x4d')]=_[_0x7503('0x46')](_0x19874e['model'],_0x19874e[_0x7503('0x44')]);_0x90d95f[_0x7503('0x47')]=_[_0x7503('0x46')](_0x19874e[_0x7503('0x43')],qs[_0x7503('0x54')](_0x34ede4[_0x7503('0x44')][_0x7503('0x54')]));_0x90d95f['attributes']=_0x90d95f[_0x7503('0x47')][_0x7503('0x48')]?_0x90d95f['attributes']:_0x19874e[_0x7503('0x43')];if(!_0x34ede4[_0x7503('0x44')][_0x7503('0x49')]('nolimit')){_0x90d95f[_0x7503('0x2d')]=qs[_0x7503('0x2d')](_0x34ede4[_0x7503('0x44')][_0x7503('0x2d')]);_0x90d95f[_0x7503('0x2b')]=qs[_0x7503('0x2b')](_0x34ede4[_0x7503('0x44')][_0x7503('0x2b')]);}_0x90d95f['order']=qs['sort'](_0x34ede4[_0x7503('0x44')]['sort']);_0x90d95f[_0x7503('0x50')]=qs[_0x7503('0x4d')](_[_0x7503('0x4e')](_0x34ede4[_0x7503('0x44')],_0x19874e[_0x7503('0x4d')]));_0x90d95f[_0x7503('0x50')][_0x7503('0x60')]=_0x25dde0['id'];if(_0x34ede4['query'][_0x7503('0x4f')]){_0x90d95f[_0x7503('0x50')]=_[_0x7503('0x51')](_0x90d95f[_0x7503('0x50')],{'$or':_[_0x7503('0x3d')](_0x90d95f['attributes'],function(_0x31e977){var _0x25a2ed={};_0x25a2ed[_0x31e977]={'$like':'%'+_0x34ede4[_0x7503('0x44')][_0x7503('0x4f')]+'%'};return _0x25a2ed;})});}_0x90d95f=_['merge']({},_0x90d95f,_0x34ede4[_0x7503('0x52')]);return db[_0x7503('0x5f')][_0x7503('0x61')](_0x90d95f);}})['then'](function(_0x2bfa33){if(_0x2bfa33){return db[_0x7503('0x62')]['findAndCountAll']({'where':{'id':_[_0x7503('0x3d')](_0x2bfa33,'UserId'),'role':'agent'},'attributes':['id',_0x7503('0x3b'),'chatPause',_0x7503('0x63'),'createdAt']});}})[_0x7503('0x35')](function(_0x3ce862){if(_0x3ce862){return{'count':_0x3ce862[_0x7503('0x2e')],'rows':_[_0x7503('0x3d')](_0x3ce862[_0x7503('0x64')],function(_0x2274a4){return{'membername':_0x2274a4['name'],'UserId':_0x2274a4['id'],'queue_name':_0x9803f4[_0x7503('0x3b')],'ChatQueueId':_0x9803f4['id'],'interface':util['format'](_0x7503('0x65'),_0x7503('0x66'),_0x2274a4[_0x7503('0x3b')]),'penalty':0x0,'paused':_0x2274a4[_0x7503('0x67')],'createdAt':_0x2274a4[_0x7503('0x68')],'updatedAt':_0x2274a4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7503('0x35')](respondWithFilteredResult(_0x1a4361,_0x90d95f))[_0x7503('0x27')](handleError(_0x1a4361,null));};exports[_0x7503('0x69')]=function(_0x196b74,_0x171155,_0x1b3027){var _0x2aa0d2={};var _0x846777={};var _0x1ce189;var _0xf99c1;return db[_0x7503('0x3e')][_0x7503('0x5e')]({'where':{'id':_0x196b74[_0x7503('0x53')]['id']}})[_0x7503('0x35')](handleEntityNotFound(_0x171155,null))['then'](function(_0x1f5fb6){if(_0x1f5fb6){_0x1ce189=_0x1f5fb6;_0x846777[_0x7503('0x43')]=_[_0x7503('0x45')](db[_0x7503('0x6a')][_0x7503('0x3f')]);_0x846777[_0x7503('0x44')]=_[_0x7503('0x45')](_0x196b74[_0x7503('0x44')]);_0x846777[_0x7503('0x4d')]=_['intersection'](_0x846777[_0x7503('0x43')],_0x846777[_0x7503('0x44')]);_0x2aa0d2[_0x7503('0x47')]=_[_0x7503('0x46')](_0x846777[_0x7503('0x43')],qs[_0x7503('0x54')](_0x196b74[_0x7503('0x44')][_0x7503('0x54')]));_0x2aa0d2[_0x7503('0x47')]=_0x2aa0d2[_0x7503('0x47')][_0x7503('0x48')]?_0x2aa0d2['attributes']:_0x846777[_0x7503('0x43')];_0x2aa0d2['order']=qs[_0x7503('0x4c')](_0x196b74[_0x7503('0x44')]['sort']);_0x2aa0d2[_0x7503('0x50')]=qs[_0x7503('0x4d')](_['pick'](_0x196b74[_0x7503('0x44')],_0x846777[_0x7503('0x4d')]));if(_0x196b74['query'][_0x7503('0x4f')]){_0x2aa0d2[_0x7503('0x50')]=_[_0x7503('0x51')](_0x2aa0d2[_0x7503('0x50')],{'$or':_[_0x7503('0x3d')](_0x2aa0d2[_0x7503('0x47')],function(_0x2511cb){var _0x283692={};_0x283692[_0x2511cb]={'$like':'%'+_0x196b74[_0x7503('0x44')][_0x7503('0x4f')]+'%'};return _0x283692;})});}_0x2aa0d2=_[_0x7503('0x51')]({},_0x2aa0d2,_0x196b74['options']);return _0x1ce189['getTeams'](_0x2aa0d2);}})['then'](function(_0x5c32bf){if(_0x5c32bf){_0xf99c1=_0x5c32bf[_0x7503('0x48')];if(!_0x196b74[_0x7503('0x44')][_0x7503('0x49')](_0x7503('0x4a'))){_0x2aa0d2[_0x7503('0x2d')]=qs[_0x7503('0x2d')](_0x196b74['query'][_0x7503('0x2d')]);_0x2aa0d2[_0x7503('0x2b')]=qs['offset'](_0x196b74[_0x7503('0x44')][_0x7503('0x2b')]);}return _0x1ce189[_0x7503('0x69')](_0x2aa0d2);}})[_0x7503('0x35')](function(_0x1c1bd3){if(_0x1c1bd3){return _0x1c1bd3?{'count':_0xf99c1,'rows':_0x1c1bd3}:null;}})[_0x7503('0x35')](respondWithResult(_0x171155,null))[_0x7503('0x27')](handleError(_0x171155,null));};exports['addTeams']=function(_0x3c8aca,_0xa37bc8,_0x4568a5){var _0x2e3de3=_0x3c8aca[_0x7503('0x58')][_0x7503('0x6b')];return db[_0x7503('0x6a')]['findAll']({'where':{'id':_0x2e3de3},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x7503('0x3b'),'online',_0x7503('0x6c'),'interface'],'raw':!![]}]})[_0x7503('0x35')](function(_0xfa03a4){if(_0xfa03a4){var _0x48cdbe=_[_0x7503('0x6d')](_0xfa03a4,function(_0x39658b){var _0x1abd55=_0x39658b[_0x7503('0x37')]({'plain':!![]});return _0x1abd55[_0x7503('0x6e')];});return db['ChatQueue'][_0x7503('0x5b')]({'where':{'id':_0x3c8aca[_0x7503('0x53')]['id']}})[_0x7503('0x35')](function(_0x464444){return db['sequelize']['transaction'](function(_0x266deb){return _0x464444['addTeams'](_0x2e3de3,{'transaction':_0x266deb})[_0x7503('0x35')](function(){return BPromise[_0x7503('0x6f')](_0x48cdbe,function(_0x1ded32){return db[_0x7503('0x5f')][_0x7503('0x70')]({'where':{'UserId':_0x1ded32['id'],'ChatQueueId':_0x3c8aca[_0x7503('0x53')]['id']},'transaction':_0x266deb});});})[_0x7503('0x35')](function(){_0x48cdbe[_0x7503('0x71')](function(_0x37c8ff){socket[_0x7503('0x72')](_0x7503('0x73'),{'UserId':_0x37c8ff['id'],'ChatQueueId':_0x464444['id']});});});});});}})[_0x7503('0x35')](respondWithStatusCode(_0xa37bc8,null))[_0x7503('0x27')](handleError(_0xa37bc8,null));};exports['removeTeams']=function(_0x1111b9,_0x39aedb,_0x444a46){return db[_0x7503('0x6a')]['findAll']({'where':{'id':_0x1111b9[_0x7503('0x44')][_0x7503('0x6b')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x7503('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x39aedb,null))[_0x7503('0x35')](function(_0x823c20){var _0x336f20=_[_0x7503('0x3d')](_0x823c20,'id');var _0x5eb737=[];var _0x56eee3=[];var _0x20b01b=squel[_0x7503('0x74')]();_0x20b01b[_0x7503('0x75')](_0x7503('0x76'))['from'](_0x7503('0x77'),'tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('ChatQueueId\x20=\x20?',_0x1111b9[_0x7503('0x53')]['id']);for(var _0x2f37ad=0x0;_0x2f37ad<_0x823c20[_0x7503('0x48')];_0x2f37ad+=0x1){let _0x20d211=_0x823c20[_0x2f37ad];for(var _0x39e2fd=0x0;_0x39e2fd<_0x20d211['Agents']['length'];_0x39e2fd+=0x1){let _0x354e1c=_0x20d211[_0x7503('0x6e')][_0x39e2fd];var _0x1d6c3c=_0x20b01b['clone']();_0x1d6c3c['where'](_0x7503('0x78'),_0x354e1c['id']);_0x56eee3[_0x7503('0x79')](db[_0x7503('0x7a')]['query'](_0x1d6c3c[_0x7503('0x7b')](),{'type':db[_0x7503('0x7a')][_0x7503('0x7c')][_0x7503('0x7d')]})[_0x7503('0x35')](function(_0x17dc4a){if(_0x17dc4a['length']===0x1){return _0x354e1c['id'];}else{var _0x3f9dd4=_[_0x7503('0x7e')](_[_0x7503('0x3d')](_0x17dc4a,_0x7503('0x7f')),function(_0x1c3c3b){return _[_0x7503('0x80')](_0x336f20,_0x1c3c3b);});if(_0x3f9dd4){return _0x354e1c['id'];}}}));}}return BPromise[_0x7503('0x81')](_0x56eee3)[_0x7503('0x35')](function(_0x35d601){_0x5eb737=_(_0x5eb737)[_0x7503('0x82')](_0x35d601)[_0x7503('0x83')]()[_0x7503('0x84')]();return db[_0x7503('0x3e')][_0x7503('0x5b')]({'where':{'id':_0x1111b9[_0x7503('0x53')]['id']}})[_0x7503('0x35')](function(_0x1bf1b6){return db['sequelize'][_0x7503('0x85')](function(_0x7a34f8){return _0x1bf1b6['removeTeams'](_0x1111b9[_0x7503('0x44')][_0x7503('0x6b')],{'transaction':_0x7a34f8})[_0x7503('0x35')](function(){if(!_[_0x7503('0x86')](_0x5eb737)){return _0x1bf1b6[_0x7503('0x87')](_0x5eb737,{'transaction':_0x7a34f8});}})[_0x7503('0x35')](function(){_0x5eb737[_0x7503('0x71')](function(_0x3f6318){socket[_0x7503('0x72')](_0x7503('0x88'),{'UserId':_0x3f6318,'ChatQueueId':_0x1bf1b6['id']});});});});});});})[_0x7503('0x35')](respondWithStatusCode(_0x39aedb,null))[_0x7503('0x27')](handleError(_0x39aedb,null));};exports[_0x7503('0x89')]=function(_0x522530,_0x5bd8b2,_0x9ac4af){return db['ChatQueue'][_0x7503('0x5b')]({'where':{'id':_0x522530[_0x7503('0x53')]['id']}})['then'](handleEntityNotFound(_0x5bd8b2,null))[_0x7503('0x35')](function(_0x572d7f){if(_0x572d7f){return _0x572d7f['addAgents'](_0x522530[_0x7503('0x58')]['ids'],_['omit'](_0x522530['body'],['ids','id'])||{})['spread'](function(_0x4b7ef5){for(var _0x19abbb=0x0;_0x19abbb<_0x522530[_0x7503('0x58')][_0x7503('0x6b')][_0x7503('0x48')];_0x19abbb+=0x1){socket[_0x7503('0x72')](_0x7503('0x73'),{'UserId':Number(_0x522530[_0x7503('0x58')][_0x7503('0x6b')][_0x19abbb]),'ChatQueueId':Number(_0x522530['params']['id'])});}return _0x4b7ef5;});}})[_0x7503('0x35')](respondWithResult(_0x5bd8b2,null))[_0x7503('0x27')](handleError(_0x5bd8b2,null));};exports[_0x7503('0x87')]=function(_0x4ea58b,_0x21440b,_0x1fb2bc){return db[_0x7503('0x3e')][_0x7503('0x5b')]({'where':{'id':_0x4ea58b[_0x7503('0x53')]['id']}})[_0x7503('0x35')](handleEntityNotFound(_0x21440b,null))[_0x7503('0x35')](function(_0xcf0b){if(_0xcf0b){return _0xcf0b[_0x7503('0x87')](_0x4ea58b[_0x7503('0x44')][_0x7503('0x6b')])[_0x7503('0x35')](function(){if(_[_0x7503('0x8a')](_0x4ea58b[_0x7503('0x44')][_0x7503('0x6b')])){for(var _0x9b33=0x0;_0x9b33<_0x4ea58b[_0x7503('0x44')]['ids'][_0x7503('0x48')];_0x9b33+=0x1){socket[_0x7503('0x72')](_0x7503('0x88'),{'UserId':Number(_0x4ea58b[_0x7503('0x44')][_0x7503('0x6b')][_0x9b33]),'ChatQueueId':Number(_0x4ea58b['params']['id'])});}}else{socket[_0x7503('0x72')](_0x7503('0x88'),{'UserId':Number(_0x4ea58b[_0x7503('0x44')]['ids']),'ChatQueueId':Number(_0x4ea58b[_0x7503('0x53')]['id'])});}});}})[_0x7503('0x35')](respondWithStatusCode(_0x21440b,null))[_0x7503('0x27')](handleError(_0x21440b,null));};exports[_0x7503('0x8b')]=function(_0x197e02,_0x18a66f,_0x2134ba){var _0x12df8b={};var _0x4f788b={};var _0xe668f6;var _0x27d412;return db[_0x7503('0x3e')][_0x7503('0x5e')]({'where':{'id':_0x197e02[_0x7503('0x53')]['id']}})[_0x7503('0x35')](handleEntityNotFound(_0x18a66f,null))['then'](function(_0x34d0b9){if(_0x34d0b9){_0xe668f6=_0x34d0b9;_0x4f788b[_0x7503('0x43')]=_[_0x7503('0x45')](db['User']['rawAttributes']);_0x4f788b['query']=_[_0x7503('0x45')](_0x197e02[_0x7503('0x44')]);_0x4f788b[_0x7503('0x4d')]=_[_0x7503('0x46')](_0x4f788b[_0x7503('0x43')],_0x4f788b[_0x7503('0x44')]);_0x12df8b[_0x7503('0x47')]=_[_0x7503('0x46')](_0x4f788b[_0x7503('0x43')],qs[_0x7503('0x54')](_0x197e02[_0x7503('0x44')][_0x7503('0x54')]));_0x12df8b[_0x7503('0x47')]=_0x12df8b[_0x7503('0x47')]['length']?_0x12df8b[_0x7503('0x47')]:_0x4f788b[_0x7503('0x43')];_0x12df8b[_0x7503('0x4b')]=qs[_0x7503('0x4c')](_0x197e02['query'][_0x7503('0x4c')]);_0x12df8b['where']=qs[_0x7503('0x4d')](_[_0x7503('0x4e')](_0x197e02[_0x7503('0x44')],_0x4f788b[_0x7503('0x4d')]));if(_0x197e02[_0x7503('0x44')][_0x7503('0x4f')]){_0x12df8b[_0x7503('0x50')]=_[_0x7503('0x51')](_0x12df8b[_0x7503('0x50')],{'$or':_[_0x7503('0x3d')](_0x12df8b[_0x7503('0x47')],function(_0x5ba604){var _0x539dc8={};_0x539dc8[_0x5ba604]={'$like':'%'+_0x197e02[_0x7503('0x44')]['filter']+'%'};return _0x539dc8;})});}_0x12df8b=_[_0x7503('0x51')]({},_0x12df8b,_0x197e02[_0x7503('0x52')]);return _0xe668f6[_0x7503('0x8b')](_0x12df8b);}})[_0x7503('0x35')](function(_0x41e5d5){if(_0x41e5d5){_0x27d412=_0x41e5d5[_0x7503('0x48')];if(!_0x197e02[_0x7503('0x44')][_0x7503('0x49')](_0x7503('0x4a'))){_0x12df8b[_0x7503('0x2d')]=qs['limit'](_0x197e02[_0x7503('0x44')][_0x7503('0x2d')]);_0x12df8b[_0x7503('0x2b')]=qs[_0x7503('0x2b')](_0x197e02[_0x7503('0x44')]['offset']);}return _0xe668f6[_0x7503('0x8b')](_0x12df8b);}})[_0x7503('0x35')](function(_0x4bcb5b){if(_0x4bcb5b){return _0x4bcb5b?{'count':_0x27d412,'rows':_0x4bcb5b}:null;}})[_0x7503('0x35')](respondWithResult(_0x18a66f,null))['catch'](handleError(_0x18a66f,null));}; \ No newline at end of file +var _0xb274=['removeAgents','userChatQueue:remove','addAgents','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','undefined','limit','count','offset','set','Content-Range','json','apply','update','destroy','ChatQueues','UserProfileResource','name','index','ChatQueue','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','options','includeAll','include','findAll','rows','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','ChatQueueId','findAndCountAll','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','Team','getTeams','addTeams','ids','User','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','select','field','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeTeams','isEmpty'];(function(_0x777641,_0x19607d){var _0x54a378=function(_0x501b92){while(--_0x501b92){_0x777641['push'](_0x777641['shift']());}};_0x54a378(++_0x19607d);}(_0xb274,0x9d));var _0x4b27=function(_0x145eae,_0x2fc6a5){_0x145eae=_0x145eae-0x0;var _0x4c6a1f=_0xb274[_0x145eae];return _0x4c6a1f;};'use strict';var emlformat=require(_0x4b27('0x0'));var rimraf=require(_0x4b27('0x1'));var zipdir=require(_0x4b27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b27('0x3'));var BPromise=require(_0x4b27('0x4'));var Mustache=require(_0x4b27('0x5'));var util=require(_0x4b27('0x6'));var path=require(_0x4b27('0x7'));var sox=require(_0x4b27('0x8'));var csv=require(_0x4b27('0x9'));var ejs=require(_0x4b27('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b27('0xb'));var squel=require(_0x4b27('0xc'));var crypto=require('crypto');var jsforce=require(_0x4b27('0xd'));var deskjs=require(_0x4b27('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4b27('0xf'));var Papa=require('papaparse');var Redis=require(_0x4b27('0x10'));var authService=require(_0x4b27('0x11'));var qs=require(_0x4b27('0x12'));var as=require(_0x4b27('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b27('0x14'))(_0x4b27('0x15'));var utils=require(_0x4b27('0x16'));var config=require(_0x4b27('0x17'));var licenseUtil=require(_0x4b27('0x18'));var db=require('../../mysqldb')['db'];config[_0x4b27('0x19')]=_['defaults'](config[_0x4b27('0x19')],{'host':_0x4b27('0x1a'),'port':0x18eb});var socket=require(_0x4b27('0x1b'))(new Redis(config['redis']));require(_0x4b27('0x1c'))[_0x4b27('0x1d')](socket);var jayson=require(_0x4b27('0x1e'));var client=jayson[_0x4b27('0x1f')][_0x4b27('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x79d848,_0x552c38,_0x19d309,_0x3dc444){return new BPromise(function(_0x45ad67,_0x4a70ef){var _0x2e4fb1=_0x3dc444||client;return _0x2e4fb1[_0x4b27('0x21')](_0x79d848,_0x19d309)[_0x4b27('0x22')](function(_0x510757){logger[_0x4b27('0x23')](_0x4b27('0x24'),_0x552c38,_0x4b27('0x25'));logger[_0x4b27('0x26')](_0x4b27('0x27'),_0x552c38,_0x4b27('0x25'),JSON['stringify'](_0x510757));if(_0x510757['error']){if(_0x510757['error'][_0x4b27('0x28')]===0x1f4){logger['error'](_0x4b27('0x24'),_0x552c38,_0x510757[_0x4b27('0x29')]['message']);return _0x4a70ef(_0x510757['error']['message']);}logger[_0x4b27('0x29')](_0x4b27('0x24'),_0x552c38,_0x510757[_0x4b27('0x29')][_0x4b27('0x2a')]);return _0x45ad67(_0x510757[_0x4b27('0x29')][_0x4b27('0x2a')]);}else{logger[_0x4b27('0x23')](_0x4b27('0x24'),_0x552c38,'request\x20sent');_0x45ad67(_0x510757[_0x4b27('0x2b')][_0x4b27('0x2a')]);}})[_0x4b27('0x2c')](function(_0x388198){logger[_0x4b27('0x29')](_0x4b27('0x24'),_0x552c38,_0x388198);_0x4a70ef(_0x388198);});});}function respondWithStatusCode(_0x48edfe,_0x4dfb41){_0x4dfb41=_0x4dfb41||0xcc;return function(_0x2ee56d){if(_0x2ee56d){return _0x48edfe[_0x4b27('0x2d')](_0x4dfb41);}return _0x48edfe[_0x4b27('0x2e')](_0x4dfb41)['end']();};}function respondWithResult(_0x4e6cf1,_0x7ab4e2){_0x7ab4e2=_0x7ab4e2||0xc8;return function(_0x584528){if(_0x584528){return _0x4e6cf1[_0x4b27('0x2e')](_0x7ab4e2)['json'](_0x584528);}};}function respondWithFilteredResult(_0x3088e4,_0x1cf07d){return function(_0x1f490e){if(_0x1f490e){var _0x4af30b=typeof _0x1cf07d['offset']===_0x4b27('0x2f')&&typeof _0x1cf07d[_0x4b27('0x30')]===_0x4b27('0x2f');var _0x19de47=_0x1f490e[_0x4b27('0x31')];var _0x4591b9=_0x4af30b?0x0:_0x1cf07d[_0x4b27('0x32')];var _0x1612d1=_0x4af30b?_0x1f490e[_0x4b27('0x31')]:_0x1cf07d[_0x4b27('0x32')]+_0x1cf07d[_0x4b27('0x30')];var _0x5e5b4d;if(_0x1612d1>=_0x19de47){_0x1612d1=_0x19de47;_0x5e5b4d=0xc8;}else{_0x5e5b4d=0xce;}_0x3088e4[_0x4b27('0x2e')](_0x5e5b4d);return _0x3088e4[_0x4b27('0x33')](_0x4b27('0x34'),_0x4591b9+'-'+_0x1612d1+'/'+_0x19de47)[_0x4b27('0x35')](_0x1f490e);}return null;};}function patchUpdates(_0x275011){return function(_0x2e4214){try{jsonpatch[_0x4b27('0x36')](_0x2e4214,_0x275011,!![]);}catch(_0x177cb4){return BPromise['reject'](_0x177cb4);}return _0x2e4214['save']();};}function saveUpdates(_0x4a13b0,_0x5c9f4f){return function(_0x1a707c){if(_0x1a707c){return _0x1a707c[_0x4b27('0x37')](_0x4a13b0)[_0x4b27('0x22')](function(_0x4f8d74){return _0x4f8d74;});}return null;};}function removeEntity(_0x364462,_0x3f98e4){return function(_0x130481){if(_0x130481){return _0x130481[_0x4b27('0x38')]()[_0x4b27('0x22')](function(){var _0x4752c4=_0x130481['get']({'plain':!![]});var _0x50d757=_0x4b27('0x39');return db[_0x4b27('0x3a')][_0x4b27('0x38')]({'where':{'type':_0x50d757,'resourceId':_0x4752c4['id']}})['then'](function(){return _0x130481;});})['then'](function(){_0x364462[_0x4b27('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x91e4ed,_0x2b01ec){return function(_0x40df82){if(!_0x40df82){_0x91e4ed[_0x4b27('0x2d')](0x194);}return _0x40df82;};}function handleError(_0xe2c7d0,_0x21434f){_0x21434f=_0x21434f||0x1f4;return function(_0x27d8c7){logger[_0x4b27('0x29')](_0x27d8c7['stack']);if(_0x27d8c7[_0x4b27('0x3b')]){delete _0x27d8c7[_0x4b27('0x3b')];}_0xe2c7d0[_0x4b27('0x2e')](_0x21434f)['send'](_0x27d8c7);};}exports[_0x4b27('0x3c')]=function(_0x2c9ead,_0x584e3f){var _0xf5a218={},_0x4f4307={},_0x416e50={'count':0x0,'rows':[]};var _0x361e43=_['map'](db[_0x4b27('0x3d')][_0x4b27('0x3e')],function(_0x266a45){return{'name':_0x266a45['fieldName'],'type':_0x266a45[_0x4b27('0x3f')][_0x4b27('0x40')]};});_0x4f4307[_0x4b27('0x41')]=_['map'](_0x361e43,'name');_0x4f4307['query']=_[_0x4b27('0x42')](_0x2c9ead[_0x4b27('0x43')]);_0x4f4307[_0x4b27('0x44')]=_[_0x4b27('0x45')](_0x4f4307[_0x4b27('0x41')],_0x4f4307[_0x4b27('0x43')]);_0xf5a218['attributes']=_[_0x4b27('0x45')](_0x4f4307[_0x4b27('0x41')],qs[_0x4b27('0x46')](_0x2c9ead['query'][_0x4b27('0x46')]));_0xf5a218['attributes']=_0xf5a218[_0x4b27('0x47')]['length']?_0xf5a218['attributes']:_0x4f4307[_0x4b27('0x41')];if(!_0x2c9ead[_0x4b27('0x43')][_0x4b27('0x48')](_0x4b27('0x49'))){_0xf5a218[_0x4b27('0x30')]=qs['limit'](_0x2c9ead[_0x4b27('0x43')][_0x4b27('0x30')]);_0xf5a218[_0x4b27('0x32')]=qs[_0x4b27('0x32')](_0x2c9ead['query'][_0x4b27('0x32')]);}_0xf5a218[_0x4b27('0x4a')]=qs[_0x4b27('0x4b')](_0x2c9ead[_0x4b27('0x43')]['sort']);_0xf5a218['where']=qs[_0x4b27('0x44')](_[_0x4b27('0x4c')](_0x2c9ead[_0x4b27('0x43')],_0x4f4307[_0x4b27('0x44')]),_0x361e43);if(_0x2c9ead['query'][_0x4b27('0x4d')]){_0xf5a218['where']=_[_0x4b27('0x4e')](_0xf5a218[_0x4b27('0x4f')],{'$or':_[_0x4b27('0x50')](_0x361e43,function(_0xb9ef8b){if(_0xb9ef8b[_0x4b27('0x3f')]!=='VIRTUAL'){var _0x564fed={};_0x564fed[_0xb9ef8b[_0x4b27('0x3b')]]={'$like':'%'+_0x2c9ead[_0x4b27('0x43')][_0x4b27('0x4d')]+'%'};return _0x564fed;}})});}_0xf5a218=_[_0x4b27('0x4e')]({},_0xf5a218,_0x2c9ead[_0x4b27('0x51')]);var _0x2175b3={'where':_0xf5a218[_0x4b27('0x4f')]};return db[_0x4b27('0x3d')]['count'](_0x2175b3)[_0x4b27('0x22')](function(_0x355f6a){_0x416e50[_0x4b27('0x31')]=_0x355f6a;if(_0x2c9ead[_0x4b27('0x43')][_0x4b27('0x52')]){_0xf5a218[_0x4b27('0x53')]=[{'all':!![]}];}return db[_0x4b27('0x3d')][_0x4b27('0x54')](_0xf5a218);})['then'](function(_0x1cde07){_0x416e50[_0x4b27('0x55')]=_0x1cde07;return _0x416e50;})['then'](respondWithFilteredResult(_0x584e3f,_0xf5a218))[_0x4b27('0x2c')](handleError(_0x584e3f,null));};exports[_0x4b27('0x56')]=function(_0x50ef43,_0x3eb9a1){var _0x51f4af={'raw':!![],'where':{'id':_0x50ef43[_0x4b27('0x57')]['id']}},_0x2d135c={};_0x2d135c['model']=_['keys'](db[_0x4b27('0x3d')][_0x4b27('0x3e')]);_0x2d135c[_0x4b27('0x43')]=_['keys'](_0x50ef43[_0x4b27('0x43')]);_0x2d135c[_0x4b27('0x44')]=_[_0x4b27('0x45')](_0x2d135c[_0x4b27('0x41')],_0x2d135c[_0x4b27('0x43')]);_0x51f4af[_0x4b27('0x47')]=_['intersection'](_0x2d135c[_0x4b27('0x41')],qs[_0x4b27('0x46')](_0x50ef43[_0x4b27('0x43')][_0x4b27('0x46')]));_0x51f4af['attributes']=_0x51f4af[_0x4b27('0x47')][_0x4b27('0x58')]?_0x51f4af[_0x4b27('0x47')]:_0x2d135c[_0x4b27('0x41')];if(_0x50ef43[_0x4b27('0x43')][_0x4b27('0x52')]){_0x51f4af[_0x4b27('0x53')]=[{'all':!![]}];}_0x51f4af=_['merge']({},_0x51f4af,_0x50ef43[_0x4b27('0x51')]);return db[_0x4b27('0x3d')]['find'](_0x51f4af)[_0x4b27('0x22')](handleEntityNotFound(_0x3eb9a1,null))[_0x4b27('0x22')](respondWithResult(_0x3eb9a1,null))[_0x4b27('0x2c')](handleError(_0x3eb9a1,null));};exports['create']=function(_0x3a5f3d,_0xfc4c2c){return db['ChatQueue'][_0x4b27('0x59')](_0x3a5f3d[_0x4b27('0x5a')],{})[_0x4b27('0x22')](function(_0x4b53aa){var _0x5b9674=_0x3a5f3d[_0x4b27('0x5b')][_0x4b27('0x5c')]({'plain':!![]});if(!_0x5b9674)throw new Error(_0x4b27('0x5d'));if(_0x5b9674['role']==='user'){var _0x369751=_0x4b53aa[_0x4b27('0x5c')]({'plain':!![]});var _0x6151a9=_0x4b27('0x39');return db[_0x4b27('0x5e')][_0x4b27('0x5f')]({'where':{'name':_0x6151a9,'userProfileId':_0x5b9674['userProfileId']},'raw':!![]})['then'](function(_0x5dd3b4){if(_0x5dd3b4&&_0x5dd3b4['autoAssociation']===0x0){return db[_0x4b27('0x3a')]['create']({'name':_0x369751['name'],'resourceId':_0x369751['id'],'type':_0x5dd3b4['name'],'sectionId':_0x5dd3b4['id']},{})[_0x4b27('0x22')](function(){return _0x4b53aa;});}else{return _0x4b53aa;}})[_0x4b27('0x2c')](function(_0x2351e4){logger['error'](_0x4b27('0x60'),_0x2351e4);throw _0x2351e4;});}return _0x4b53aa;})[_0x4b27('0x22')](respondWithResult(_0xfc4c2c,0xc9))[_0x4b27('0x2c')](handleError(_0xfc4c2c,null));};exports[_0x4b27('0x37')]=function(_0x485fb7,_0x3544da){if(_0x485fb7[_0x4b27('0x5a')]['id']){delete _0x485fb7[_0x4b27('0x5a')]['id'];}return db[_0x4b27('0x3d')][_0x4b27('0x5f')]({'where':{'id':_0x485fb7[_0x4b27('0x57')]['id']}})['then'](handleEntityNotFound(_0x3544da,null))[_0x4b27('0x22')](saveUpdates(_0x485fb7[_0x4b27('0x5a')],null))[_0x4b27('0x22')](respondWithResult(_0x3544da,null))[_0x4b27('0x2c')](handleError(_0x3544da,null));};exports[_0x4b27('0x38')]=function(_0x14822e,_0x48ee48){return db[_0x4b27('0x3d')][_0x4b27('0x5f')]({'where':{'id':_0x14822e['params']['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x48ee48,null))[_0x4b27('0x22')](removeEntity(_0x48ee48,null))['catch'](handleError(_0x48ee48,null));};exports[_0x4b27('0x61')]=function(_0x34201d,_0x2a5edc){return db[_0x4b27('0x3d')][_0x4b27('0x61')]()[_0x4b27('0x22')](respondWithResult(_0x2a5edc,null))[_0x4b27('0x2c')](handleError(_0x2a5edc,null));};exports[_0x4b27('0x62')]=function(_0x5e4e32,_0x5f123e,_0x51a22f){var _0x275028={'raw':!![],'where':{}},_0x6d2edd={},_0x4f9c2a;return db[_0x4b27('0x3d')]['findOne']({'where':{'id':_0x5e4e32[_0x4b27('0x57')]['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x5f123e,null))['then'](function(_0x36c3a1){if(_0x36c3a1){_0x4f9c2a=_0x36c3a1[_0x4b27('0x5c')]({'plain':!![]});_0x6d2edd[_0x4b27('0x41')]=_[_0x4b27('0x42')](db[_0x4b27('0x63')][_0x4b27('0x3e')]);_0x6d2edd[_0x4b27('0x43')]=_[_0x4b27('0x42')](_0x5e4e32[_0x4b27('0x43')]);_0x6d2edd[_0x4b27('0x44')]=_[_0x4b27('0x45')](_0x6d2edd[_0x4b27('0x41')],_0x6d2edd[_0x4b27('0x43')]);_0x275028[_0x4b27('0x47')]=_[_0x4b27('0x45')](_0x6d2edd[_0x4b27('0x41')],qs[_0x4b27('0x46')](_0x5e4e32[_0x4b27('0x43')]['fields']));_0x275028[_0x4b27('0x47')]=_0x275028[_0x4b27('0x47')]['length']?_0x275028[_0x4b27('0x47')]:_0x6d2edd[_0x4b27('0x41')];if(!_0x5e4e32[_0x4b27('0x43')][_0x4b27('0x48')](_0x4b27('0x49'))){_0x275028[_0x4b27('0x30')]=qs[_0x4b27('0x30')](_0x5e4e32[_0x4b27('0x43')][_0x4b27('0x30')]);_0x275028[_0x4b27('0x32')]=qs[_0x4b27('0x32')](_0x5e4e32[_0x4b27('0x43')][_0x4b27('0x32')]);}_0x275028[_0x4b27('0x4a')]=qs[_0x4b27('0x4b')](_0x5e4e32[_0x4b27('0x43')][_0x4b27('0x4b')]);_0x275028[_0x4b27('0x4f')]=qs['filters'](_[_0x4b27('0x4c')](_0x5e4e32[_0x4b27('0x43')],_0x6d2edd[_0x4b27('0x44')]));_0x275028['where'][_0x4b27('0x64')]=_0x36c3a1['id'];if(_0x5e4e32[_0x4b27('0x43')][_0x4b27('0x4d')]){_0x275028[_0x4b27('0x4f')]=_[_0x4b27('0x4e')](_0x275028['where'],{'$or':_[_0x4b27('0x50')](_0x275028[_0x4b27('0x47')],function(_0x25372c){var _0x1855dd={};_0x1855dd[_0x25372c]={'$like':'%'+_0x5e4e32[_0x4b27('0x43')][_0x4b27('0x4d')]+'%'};return _0x1855dd;})});}_0x275028=_['merge']({},_0x275028,_0x5e4e32[_0x4b27('0x51')]);return db['UserChatQueue'][_0x4b27('0x54')](_0x275028);}})[_0x4b27('0x22')](function(_0x47a4df){if(_0x47a4df){return db['User'][_0x4b27('0x65')]({'where':{'id':_['map'](_0x47a4df,'UserId'),'role':_0x4b27('0x66')},'attributes':['id',_0x4b27('0x3b'),_0x4b27('0x67'),_0x4b27('0x68'),_0x4b27('0x69')]});}})[_0x4b27('0x22')](function(_0x477b2f){if(_0x477b2f){return{'count':_0x477b2f[_0x4b27('0x31')],'rows':_[_0x4b27('0x50')](_0x477b2f[_0x4b27('0x55')],function(_0xa7277c){return{'membername':_0xa7277c[_0x4b27('0x3b')],'UserId':_0xa7277c['id'],'queue_name':_0x4f9c2a['name'],'ChatQueueId':_0x4f9c2a['id'],'interface':util['format'](_0x4b27('0x6a'),_0x4b27('0x6b'),_0xa7277c[_0x4b27('0x3b')]),'penalty':0x0,'paused':_0xa7277c['chatPause'],'createdAt':_0xa7277c[_0x4b27('0x69')],'updatedAt':_0xa7277c[_0x4b27('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4b27('0x22')](respondWithFilteredResult(_0x5f123e,_0x275028))[_0x4b27('0x2c')](handleError(_0x5f123e,null));};exports['getTeams']=function(_0xa57146,_0x535c86,_0x597566){var _0x1cfa24={};var _0x18d340={};var _0x26ad0d;var _0x3b1542;return db[_0x4b27('0x3d')]['findOne']({'where':{'id':_0xa57146[_0x4b27('0x57')]['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x535c86,null))[_0x4b27('0x22')](function(_0x10c088){if(_0x10c088){_0x26ad0d=_0x10c088;_0x18d340[_0x4b27('0x41')]=_[_0x4b27('0x42')](db[_0x4b27('0x6c')][_0x4b27('0x3e')]);_0x18d340['query']=_[_0x4b27('0x42')](_0xa57146[_0x4b27('0x43')]);_0x18d340['filters']=_['intersection'](_0x18d340['model'],_0x18d340[_0x4b27('0x43')]);_0x1cfa24['attributes']=_[_0x4b27('0x45')](_0x18d340['model'],qs['fields'](_0xa57146[_0x4b27('0x43')][_0x4b27('0x46')]));_0x1cfa24['attributes']=_0x1cfa24['attributes'][_0x4b27('0x58')]?_0x1cfa24['attributes']:_0x18d340[_0x4b27('0x41')];_0x1cfa24['order']=qs[_0x4b27('0x4b')](_0xa57146[_0x4b27('0x43')][_0x4b27('0x4b')]);_0x1cfa24[_0x4b27('0x4f')]=qs[_0x4b27('0x44')](_['pick'](_0xa57146['query'],_0x18d340[_0x4b27('0x44')]));if(_0xa57146[_0x4b27('0x43')][_0x4b27('0x4d')]){_0x1cfa24['where']=_['merge'](_0x1cfa24['where'],{'$or':_[_0x4b27('0x50')](_0x1cfa24['attributes'],function(_0x116ef8){var _0x8e9080={};_0x8e9080[_0x116ef8]={'$like':'%'+_0xa57146[_0x4b27('0x43')][_0x4b27('0x4d')]+'%'};return _0x8e9080;})});}_0x1cfa24=_[_0x4b27('0x4e')]({},_0x1cfa24,_0xa57146[_0x4b27('0x51')]);return _0x26ad0d[_0x4b27('0x6d')](_0x1cfa24);}})[_0x4b27('0x22')](function(_0x19ff02){if(_0x19ff02){_0x3b1542=_0x19ff02[_0x4b27('0x58')];if(!_0xa57146[_0x4b27('0x43')][_0x4b27('0x48')](_0x4b27('0x49'))){_0x1cfa24[_0x4b27('0x30')]=qs[_0x4b27('0x30')](_0xa57146[_0x4b27('0x43')][_0x4b27('0x30')]);_0x1cfa24[_0x4b27('0x32')]=qs['offset'](_0xa57146[_0x4b27('0x43')][_0x4b27('0x32')]);}return _0x26ad0d[_0x4b27('0x6d')](_0x1cfa24);}})['then'](function(_0x26afa2){if(_0x26afa2){return _0x26afa2?{'count':_0x3b1542,'rows':_0x26afa2}:null;}})[_0x4b27('0x22')](respondWithResult(_0x535c86,null))['catch'](handleError(_0x535c86,null));};exports[_0x4b27('0x6e')]=function(_0x2850d4,_0x114330,_0xadad31){var _0x3b94d9=_0x2850d4['body'][_0x4b27('0x6f')];return db[_0x4b27('0x6c')][_0x4b27('0x54')]({'where':{'id':_0x3b94d9},'attributes':['id'],'include':[{'model':db[_0x4b27('0x70')],'as':'Agents','attributes':['id','name',_0x4b27('0x71'),_0x4b27('0x72'),_0x4b27('0x73')],'raw':!![]}]})[_0x4b27('0x22')](function(_0x5275d3){if(_0x5275d3){var _0x51c1d1=_['flatMap'](_0x5275d3,function(_0xcda109){var _0x189c31=_0xcda109[_0x4b27('0x5c')]({'plain':!![]});return _0x189c31[_0x4b27('0x74')];});return db[_0x4b27('0x3d')]['find']({'where':{'id':_0x2850d4['params']['id']}})[_0x4b27('0x22')](function(_0x337124){return db[_0x4b27('0x75')][_0x4b27('0x76')](function(_0xfb0142){return _0x337124[_0x4b27('0x6e')](_0x3b94d9,{'transaction':_0xfb0142})[_0x4b27('0x22')](function(){return BPromise[_0x4b27('0x77')](_0x51c1d1,function(_0x326521){return db[_0x4b27('0x63')][_0x4b27('0x78')]({'where':{'UserId':_0x326521['id'],'ChatQueueId':_0x2850d4[_0x4b27('0x57')]['id']},'transaction':_0xfb0142});});})[_0x4b27('0x22')](function(){_0x51c1d1[_0x4b27('0x79')](function(_0x4e2835){socket[_0x4b27('0x7a')](_0x4b27('0x7b'),{'UserId':_0x4e2835['id'],'ChatQueueId':_0x337124['id']});});});});});}})[_0x4b27('0x22')](respondWithStatusCode(_0x114330,null))[_0x4b27('0x2c')](handleError(_0x114330,null));};exports['removeTeams']=function(_0x409d55,_0x38d382,_0x1415e7){return db[_0x4b27('0x6c')][_0x4b27('0x54')]({'where':{'id':_0x409d55[_0x4b27('0x43')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x4b27('0x74'),'attributes':['id'],'raw':!![]}]})[_0x4b27('0x22')](handleEntityNotFound(_0x38d382,null))['then'](function(_0x2db0a7){var _0x3cbde5=_[_0x4b27('0x50')](_0x2db0a7,'id');var _0x104bb1=[];var _0xbf144e=[];var _0x5268a5=squel[_0x4b27('0x7c')]();_0x5268a5[_0x4b27('0x7d')](_0x4b27('0x7e'))['from'](_0x4b27('0x7f'),'tq')[_0x4b27('0x80')](_0x4b27('0x81'),'ut',_0x4b27('0x82'))[_0x4b27('0x4f')](_0x4b27('0x83'),_0x409d55[_0x4b27('0x57')]['id']);for(var _0x441ec6=0x0;_0x441ec6<_0x2db0a7['length'];_0x441ec6+=0x1){let _0x1e11d0=_0x2db0a7[_0x441ec6];for(var _0x522bbf=0x0;_0x522bbf<_0x1e11d0[_0x4b27('0x74')][_0x4b27('0x58')];_0x522bbf+=0x1){let _0x38c820=_0x1e11d0[_0x4b27('0x74')][_0x522bbf];var _0x21deb6=_0x5268a5[_0x4b27('0x84')]();_0x21deb6[_0x4b27('0x4f')](_0x4b27('0x85'),_0x38c820['id']);_0xbf144e[_0x4b27('0x86')](db['sequelize'][_0x4b27('0x43')](_0x21deb6['toString'](),{'type':db['sequelize'][_0x4b27('0x87')][_0x4b27('0x88')]})[_0x4b27('0x22')](function(_0x4fa7ee){if(_0x4fa7ee[_0x4b27('0x58')]===0x1){return _0x38c820['id'];}else{var _0x1eceff=_[_0x4b27('0x89')](_[_0x4b27('0x50')](_0x4fa7ee,_0x4b27('0x8a')),function(_0x980f5b){return _['includes'](_0x3cbde5,_0x980f5b);});if(_0x1eceff){return _0x38c820['id'];}}}));}}return BPromise[_0x4b27('0x8b')](_0xbf144e)['then'](function(_0x59c13){_0x104bb1=_(_0x104bb1)[_0x4b27('0x8c')](_0x59c13)[_0x4b27('0x8d')]()[_0x4b27('0x8e')]();return db[_0x4b27('0x3d')][_0x4b27('0x5f')]({'where':{'id':_0x409d55[_0x4b27('0x57')]['id']}})[_0x4b27('0x22')](function(_0x2cddde){return db['sequelize']['transaction'](function(_0x22e8db){return _0x2cddde[_0x4b27('0x8f')](_0x409d55[_0x4b27('0x43')]['ids'],{'transaction':_0x22e8db})[_0x4b27('0x22')](function(){if(!_[_0x4b27('0x90')](_0x104bb1)){return _0x2cddde[_0x4b27('0x91')](_0x104bb1,{'transaction':_0x22e8db});}})[_0x4b27('0x22')](function(){_0x104bb1[_0x4b27('0x79')](function(_0x417b95){socket[_0x4b27('0x7a')](_0x4b27('0x92'),{'UserId':_0x417b95,'ChatQueueId':_0x2cddde['id']});});});});});});})['then'](respondWithStatusCode(_0x38d382,null))['catch'](handleError(_0x38d382,null));};exports[_0x4b27('0x93')]=function(_0x109b2e,_0x19830c,_0x3b0885){return db[_0x4b27('0x3d')][_0x4b27('0x5f')]({'where':{'id':_0x109b2e[_0x4b27('0x57')]['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x19830c,null))[_0x4b27('0x22')](function(_0xbdca09){if(_0xbdca09){return _0xbdca09[_0x4b27('0x93')](_0x109b2e[_0x4b27('0x5a')][_0x4b27('0x6f')],_['omit'](_0x109b2e[_0x4b27('0x5a')],[_0x4b27('0x6f'),'id'])||{})['spread'](function(_0x3509b7){for(var _0x5d1785=0x0;_0x5d1785<_0x109b2e['body'][_0x4b27('0x6f')][_0x4b27('0x58')];_0x5d1785+=0x1){socket[_0x4b27('0x7a')](_0x4b27('0x7b'),{'UserId':Number(_0x109b2e[_0x4b27('0x5a')][_0x4b27('0x6f')][_0x5d1785]),'ChatQueueId':Number(_0x109b2e[_0x4b27('0x57')]['id'])});}return _0x3509b7;});}})[_0x4b27('0x22')](respondWithResult(_0x19830c,null))['catch'](handleError(_0x19830c,null));};exports['removeAgents']=function(_0x1500af,_0x1412f3,_0x16e3bc){return db['ChatQueue'][_0x4b27('0x5f')]({'where':{'id':_0x1500af['params']['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x1412f3,null))['then'](function(_0x18e66f){if(_0x18e66f){return _0x18e66f['removeAgents'](_0x1500af[_0x4b27('0x43')]['ids'])[_0x4b27('0x22')](function(){if(_[_0x4b27('0x94')](_0x1500af[_0x4b27('0x43')][_0x4b27('0x6f')])){for(var _0xbb39be=0x0;_0xbb39be<_0x1500af['query'][_0x4b27('0x6f')][_0x4b27('0x58')];_0xbb39be+=0x1){socket['emit'](_0x4b27('0x92'),{'UserId':Number(_0x1500af[_0x4b27('0x43')][_0x4b27('0x6f')][_0xbb39be]),'ChatQueueId':Number(_0x1500af[_0x4b27('0x57')]['id'])});}}else{socket['emit'](_0x4b27('0x92'),{'UserId':Number(_0x1500af['query'][_0x4b27('0x6f')]),'ChatQueueId':Number(_0x1500af['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1412f3,null))[_0x4b27('0x2c')](handleError(_0x1412f3,null));};exports[_0x4b27('0x95')]=function(_0x73f345,_0x53894a,_0x286ed1){var _0x3873bc={};var _0x49482d={};var _0x3aeb38;var _0x56b338;return db['ChatQueue'][_0x4b27('0x96')]({'where':{'id':_0x73f345[_0x4b27('0x57')]['id']}})[_0x4b27('0x22')](handleEntityNotFound(_0x53894a,null))[_0x4b27('0x22')](function(_0x5bba2a){if(_0x5bba2a){_0x3aeb38=_0x5bba2a;_0x49482d[_0x4b27('0x41')]=_['keys'](db['User']['rawAttributes']);_0x49482d[_0x4b27('0x43')]=_[_0x4b27('0x42')](_0x73f345['query']);_0x49482d[_0x4b27('0x44')]=_[_0x4b27('0x45')](_0x49482d[_0x4b27('0x41')],_0x49482d[_0x4b27('0x43')]);_0x3873bc[_0x4b27('0x47')]=_[_0x4b27('0x45')](_0x49482d[_0x4b27('0x41')],qs[_0x4b27('0x46')](_0x73f345[_0x4b27('0x43')]['fields']));_0x3873bc[_0x4b27('0x47')]=_0x3873bc[_0x4b27('0x47')][_0x4b27('0x58')]?_0x3873bc[_0x4b27('0x47')]:_0x49482d[_0x4b27('0x41')];_0x3873bc['order']=qs[_0x4b27('0x4b')](_0x73f345[_0x4b27('0x43')]['sort']);_0x3873bc[_0x4b27('0x4f')]=qs[_0x4b27('0x44')](_['pick'](_0x73f345[_0x4b27('0x43')],_0x49482d[_0x4b27('0x44')]));if(_0x73f345[_0x4b27('0x43')][_0x4b27('0x4d')]){_0x3873bc[_0x4b27('0x4f')]=_[_0x4b27('0x4e')](_0x3873bc['where'],{'$or':_['map'](_0x3873bc[_0x4b27('0x47')],function(_0x59b317){var _0x5b8aef={};_0x5b8aef[_0x59b317]={'$like':'%'+_0x73f345[_0x4b27('0x43')]['filter']+'%'};return _0x5b8aef;})});}_0x3873bc=_[_0x4b27('0x4e')]({},_0x3873bc,_0x73f345['options']);return _0x3aeb38[_0x4b27('0x95')](_0x3873bc);}})[_0x4b27('0x22')](function(_0xa6dbaf){if(_0xa6dbaf){_0x56b338=_0xa6dbaf[_0x4b27('0x58')];if(!_0x73f345[_0x4b27('0x43')][_0x4b27('0x48')](_0x4b27('0x49'))){_0x3873bc['limit']=qs['limit'](_0x73f345[_0x4b27('0x43')]['limit']);_0x3873bc['offset']=qs[_0x4b27('0x32')](_0x73f345[_0x4b27('0x43')][_0x4b27('0x32')]);}return _0x3aeb38['getAgents'](_0x3873bc);}})['then'](function(_0x2c2ac5){if(_0x2c2ac5){return _0x2c2ac5?{'count':_0x56b338,'rows':_0x2c2ac5}:null;}})[_0x4b27('0x22')](respondWithResult(_0x53894a,null))[_0x4b27('0x2c')](handleError(_0x53894a,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 1a9418a..27c57b5 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 _0xeca7=['hook','exports','events','../../mysqldb','ChatQueue','save','update','emit'];(function(_0x39d89b,_0x413243){var _0x477b21=function(_0x5ea8bf){while(--_0x5ea8bf){_0x39d89b['push'](_0x39d89b['shift']());}};_0x477b21(++_0x413243);}(_0xeca7,0xba));var _0x7eca=function(_0x45bfbc,_0x1ff15e){_0x45bfbc=_0x45bfbc-0x0;var _0x407018=_0xeca7[_0x45bfbc];return _0x407018;};'use strict';var EventEmitter=require(_0x7eca('0x0'));var ChatQueue=require(_0x7eca('0x1'))['db'][_0x7eca('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7eca('0x3'),'afterUpdate':_0x7eca('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b5721){return function(_0x52a1bc,_0x519867,_0x29cb7b){ChatQueueEvents[_0x7eca('0x5')](_0x2b5721+':'+_0x52a1bc['id'],_0x52a1bc);ChatQueueEvents[_0x7eca('0x5')](_0x2b5721,_0x52a1bc);_0x29cb7b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x7eca('0x6')](e,emitEvent(event));}}module[_0x7eca('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xc716=['emit','hasOwnProperty','hook','exports','events','ChatQueue','setMaxListeners','save','update','remove'];(function(_0x54dd4a,_0x597472){var _0x1edeb6=function(_0xd7664a){while(--_0xd7664a){_0x54dd4a['push'](_0x54dd4a['shift']());}};_0x1edeb6(++_0x597472);}(_0xc716,0x16c));var _0x6c71=function(_0x2501aa,_0x226981){_0x2501aa=_0x2501aa-0x0;var _0x3ce23f=_0xc716[_0x2501aa];return _0x3ce23f;};'use strict';var EventEmitter=require(_0x6c71('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x6c71('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x6c71('0x2')](0x0);var events={'afterCreate':_0x6c71('0x3'),'afterUpdate':_0x6c71('0x4'),'afterDestroy':_0x6c71('0x5')};function emitEvent(_0x5ac1b3){return function(_0x25c7a2,_0x58da58,_0x1a1ca1){ChatQueueEvents[_0x6c71('0x6')](_0x5ac1b3+':'+_0x25c7a2['id'],_0x25c7a2);ChatQueueEvents[_0x6c71('0x6')](_0x5ac1b3,_0x25c7a2);_0x1a1ca1(null);};}for(var e in events){if(events[_0x6c71('0x7')](e)){var event=events[e];ChatQueue[_0x6c71('0x8')](e,emitEvent(event));}}module[_0x6c71('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 95349aa..5ea4727 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 _0x215b=['./chatQueue.attributes','ChatQueue','chat_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5371a3,_0x1f65d3){var _0xf3ee50=function(_0x557111){while(--_0x557111){_0x5371a3['push'](_0x5371a3['shift']());}};_0xf3ee50(++_0x1f65d3);}(_0x215b,0x16e));var _0xb215=function(_0x5c0f90,_0xcbe32d){_0x5c0f90=_0x5c0f90-0x0;var _0x5375bf=_0x215b[_0x5c0f90];return _0x5375bf;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb215('0x0'))(_0xb215('0x1'));var moment=require(_0xb215('0x2'));var BPromise=require(_0xb215('0x3'));var rp=require(_0xb215('0x4'));var fs=require('fs');var path=require(_0xb215('0x5'));var rimraf=require(_0xb215('0x6'));var config=require(_0xb215('0x7'));var attributes=require(_0xb215('0x8'));module['exports']=function(_0x2164f1,_0xde81fd){return _0x2164f1['define'](_0xb215('0x9'),attributes,{'tableName':_0xb215('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc360=['lodash','util','../../config/logger','api','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues'];(function(_0x341efa,_0x1caf78){var _0x4b983d=function(_0x2746ff){while(--_0x2746ff){_0x341efa['push'](_0x341efa['shift']());}};_0x4b983d(++_0x1caf78);}(_0xc360,0x84));var _0x0c36=function(_0x3c803d,_0x4ac193){_0x3c803d=_0x3c803d-0x0;var _0x3c6e80=_0xc360[_0x3c803d];return _0x3c6e80;};'use strict';var _=require(_0x0c36('0x0'));var util=require(_0x0c36('0x1'));var logger=require(_0x0c36('0x2'))(_0x0c36('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0c36('0x4'));var config=require(_0x0c36('0x5'));var attributes=require(_0x0c36('0x6'));module[_0x0c36('0x7')]=function(_0x8b83ba,_0x5aed25){return _0x8b83ba[_0x0c36('0x8')](_0x0c36('0x9'),attributes,{'tableName':_0x0c36('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index c443250..421e4fc 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 _0x9176=['model','debug','ShowChatQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatQueue.socket','register','request','then','info','stringify','error','message','ChatQueue,\x20%s,\x20%s','request\x20sent','catch','GetChatQueue','ChatQueue','findAll','raw','options','attributes','limit','include','map'];(function(_0x1b7c98,_0xcfaa51){var _0x22a87e=function(_0x4a662d){while(--_0x4a662d){_0x1b7c98['push'](_0x1b7c98['shift']());}};_0x22a87e(++_0xcfaa51);}(_0x9176,0x164));var _0x6917=function(_0x11c3ca,_0x18c151){_0x11c3ca=_0x11c3ca-0x0;var _0x8133bc=_0x9176[_0x11c3ca];return _0x8133bc;};'use strict';var _=require(_0x6917('0x0'));var util=require(_0x6917('0x1'));var moment=require(_0x6917('0x2'));var BPromise=require(_0x6917('0x3'));var rs=require(_0x6917('0x4'));var fs=require('fs');var Redis=require(_0x6917('0x5'));var db=require(_0x6917('0x6'))['db'];var utils=require(_0x6917('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6917('0x8'));var jayson=require(_0x6917('0x9'));var client=jayson[_0x6917('0xa')][_0x6917('0xb')]({'port':0x232a});config[_0x6917('0xc')]=_['defaults'](config[_0x6917('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6917('0xd'))(new Redis(config['redis']));require(_0x6917('0xe'))[_0x6917('0xf')](socket);function respondWithRpcPromise(_0x24d878,_0x56a4f6,_0x11fc8b){return new BPromise(function(_0x53a1de,_0x4610d4){return client[_0x6917('0x10')](_0x24d878,_0x11fc8b)[_0x6917('0x11')](function(_0xbf96a7){logger[_0x6917('0x12')]('ChatQueue,\x20%s,\x20%s',_0x56a4f6,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x56a4f6,'request\x20sent',JSON[_0x6917('0x13')](_0xbf96a7));if(_0xbf96a7[_0x6917('0x14')]){if(_0xbf96a7[_0x6917('0x14')]['code']===0x1f4){logger[_0x6917('0x14')]('ChatQueue,\x20%s,\x20%s',_0x56a4f6,_0xbf96a7[_0x6917('0x14')]['message']);return _0x4610d4(_0xbf96a7[_0x6917('0x14')][_0x6917('0x15')]);}logger['error'](_0x6917('0x16'),_0x56a4f6,_0xbf96a7['error']['message']);return _0x53a1de(_0xbf96a7[_0x6917('0x14')][_0x6917('0x15')]);}else{logger[_0x6917('0x12')]('ChatQueue,\x20%s,\x20%s',_0x56a4f6,_0x6917('0x17'));_0x53a1de(_0xbf96a7['result'][_0x6917('0x15')]);}})[_0x6917('0x18')](function(_0x1d8b8b){logger[_0x6917('0x14')]('ChatQueue,\x20%s,\x20%s',_0x56a4f6,_0x1d8b8b);_0x4610d4(_0x1d8b8b);});});}exports[_0x6917('0x19')]=function(_0x39eeb9){var _0x39fd85=this;return new Promise(function(_0x1728f4,_0x334629){return db[_0x6917('0x1a')][_0x6917('0x1b')]({'raw':_0x39eeb9['options']?_0x39eeb9['options'][_0x6917('0x1c')]===undefined?!![]:![]:!![],'where':_0x39eeb9[_0x6917('0x1d')]?_0x39eeb9[_0x6917('0x1d')]['where']||null:null,'attributes':_0x39eeb9['options']?_0x39eeb9['options'][_0x6917('0x1e')]||null:null,'limit':_0x39eeb9[_0x6917('0x1d')]?_0x39eeb9[_0x6917('0x1d')][_0x6917('0x1f')]||null:null,'include':_0x39eeb9[_0x6917('0x1d')]?_0x39eeb9[_0x6917('0x1d')][_0x6917('0x20')]?_[_0x6917('0x21')](_0x39eeb9['options'][_0x6917('0x20')],function(_0x3f18c5){return{'model':db[_0x3f18c5[_0x6917('0x22')]],'as':_0x3f18c5['as'],'attributes':_0x3f18c5[_0x6917('0x1e')],'include':_0x3f18c5[_0x6917('0x20')]?_[_0x6917('0x21')](_0x3f18c5[_0x6917('0x20')],function(_0x4b9c77){return{'model':db[_0x4b9c77[_0x6917('0x22')]],'as':_0x4b9c77['as'],'attributes':_0x4b9c77[_0x6917('0x1e')],'include':_0x4b9c77[_0x6917('0x20')]?_[_0x6917('0x21')](_0x4b9c77['include'],function(_0x410679){return{'model':db[_0x410679[_0x6917('0x22')]],'as':_0x410679['as'],'attributes':_0x410679[_0x6917('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6917('0x11')](function(_0x255737){logger[_0x6917('0x12')](_0x6917('0x19'),_0x39eeb9);logger[_0x6917('0x23')](_0x6917('0x19'),_0x39eeb9,JSON[_0x6917('0x13')](_0x255737));_0x1728f4(_0x255737);})['catch'](function(_0x3a876a){logger['error'](_0x6917('0x19'),_0x3a876a['message'],_0x39eeb9);_0x334629(_0x39fd85['error'](0x1f4,_0x3a876a[_0x6917('0x15')]));});});};exports[_0x6917('0x24')]=function(_0x4419f3){var _0x471a1e=this;return new Promise(function(_0xf08b9,_0x17e7ad){return db['ChatQueue'][_0x6917('0x25')]({'raw':_0x4419f3[_0x6917('0x1d')]?_0x4419f3[_0x6917('0x1d')][_0x6917('0x1c')]===undefined?!![]:![]:!![],'where':_0x4419f3[_0x6917('0x1d')]?_0x4419f3[_0x6917('0x1d')][_0x6917('0x26')]||null:null,'attributes':_0x4419f3[_0x6917('0x1d')]?_0x4419f3[_0x6917('0x1d')][_0x6917('0x1e')]||null:null,'include':_0x4419f3[_0x6917('0x1d')]?_0x4419f3[_0x6917('0x1d')][_0x6917('0x20')]?_[_0x6917('0x21')](_0x4419f3[_0x6917('0x1d')][_0x6917('0x20')],function(_0x57cc70){return{'model':db[_0x57cc70[_0x6917('0x22')]],'as':_0x57cc70['as'],'attributes':_0x57cc70[_0x6917('0x1e')],'include':_0x57cc70[_0x6917('0x20')]?_[_0x6917('0x21')](_0x57cc70[_0x6917('0x20')],function(_0x244838){return{'model':db[_0x244838[_0x6917('0x22')]],'as':_0x244838['as'],'attributes':_0x244838['attributes'],'include':_0x244838[_0x6917('0x20')]?_['map'](_0x244838[_0x6917('0x20')],function(_0x270992){return{'model':db[_0x270992[_0x6917('0x22')]],'as':_0x270992['as'],'attributes':_0x270992[_0x6917('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6917('0x11')](function(_0x4f5e36){logger[_0x6917('0x12')](_0x6917('0x24'),_0x4419f3);logger[_0x6917('0x23')]('ShowChatQueue',_0x4419f3,JSON[_0x6917('0x13')](_0x4f5e36));_0xf08b9(_0x4f5e36);})[_0x6917('0x18')](function(_0x21847b){logger[_0x6917('0x14')](_0x6917('0x24'),_0x21847b[_0x6917('0x15')],_0x4419f3);_0x17e7ad(_0x471a1e['error'](0x1f4,_0x21847b[_0x6917('0x15')]));});});}; \ No newline at end of file +var _0x84ae=['message','result','catch','ChatQueue','findAll','options','raw','where','attributes','limit','map','include','model','GetChatQueue','ShowChatQueue','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','redis','defaults','localhost','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0x318816,_0x4b705a){var _0x1671cf=function(_0x144ccb){while(--_0x144ccb){_0x318816['push'](_0x318816['shift']());}};_0x1671cf(++_0x4b705a);}(_0x84ae,0x101));var _0xe84a=function(_0x497391,_0x471b68){_0x497391=_0x497391-0x0;var _0x1f88dc=_0x84ae[_0x497391];return _0x1f88dc;};'use strict';var _=require(_0xe84a('0x0'));var util=require(_0xe84a('0x1'));var moment=require(_0xe84a('0x2'));var BPromise=require(_0xe84a('0x3'));var rs=require(_0xe84a('0x4'));var fs=require('fs');var Redis=require(_0xe84a('0x5'));var db=require(_0xe84a('0x6'))['db'];var utils=require(_0xe84a('0x7'));var logger=require(_0xe84a('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe84a('0x9')]['http']({'port':0x232a});config[_0xe84a('0xa')]=_[_0xe84a('0xb')](config[_0xe84a('0xa')],{'host':_0xe84a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe84a('0xa')]));require(_0xe84a('0xd'))[_0xe84a('0xe')](socket);function respondWithRpcPromise(_0x5c47f9,_0x2a7d97,_0x17f161){return new BPromise(function(_0x368c9f,_0xbfda9c){return client[_0xe84a('0xf')](_0x5c47f9,_0x17f161)[_0xe84a('0x10')](function(_0x57ed4e){logger[_0xe84a('0x11')](_0xe84a('0x12'),_0x2a7d97,_0xe84a('0x13'));logger[_0xe84a('0x14')](_0xe84a('0x15'),_0x2a7d97,'request\x20sent',JSON['stringify'](_0x57ed4e));if(_0x57ed4e['error']){if(_0x57ed4e[_0xe84a('0x16')]['code']===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x2a7d97,_0x57ed4e[_0xe84a('0x16')][_0xe84a('0x17')]);return _0xbfda9c(_0x57ed4e[_0xe84a('0x16')][_0xe84a('0x17')]);}logger[_0xe84a('0x16')](_0xe84a('0x12'),_0x2a7d97,_0x57ed4e[_0xe84a('0x16')][_0xe84a('0x17')]);return _0x368c9f(_0x57ed4e['error'][_0xe84a('0x17')]);}else{logger[_0xe84a('0x11')](_0xe84a('0x12'),_0x2a7d97,_0xe84a('0x13'));_0x368c9f(_0x57ed4e[_0xe84a('0x18')][_0xe84a('0x17')]);}})[_0xe84a('0x19')](function(_0x1ed66a){logger[_0xe84a('0x16')](_0xe84a('0x12'),_0x2a7d97,_0x1ed66a);_0xbfda9c(_0x1ed66a);});});}exports['GetChatQueue']=function(_0x5cdde7){var _0x38a40a=this;return new Promise(function(_0x5c0177,_0x5aad8a){return db[_0xe84a('0x1a')][_0xe84a('0x1b')]({'raw':_0x5cdde7[_0xe84a('0x1c')]?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x1d')]===undefined?!![]:![]:!![],'where':_0x5cdde7['options']?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x1e')]||null:null,'attributes':_0x5cdde7[_0xe84a('0x1c')]?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x1f')]||null:null,'limit':_0x5cdde7[_0xe84a('0x1c')]?_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x20')]||null:null,'include':_0x5cdde7['options']?_0x5cdde7['options']['include']?_[_0xe84a('0x21')](_0x5cdde7[_0xe84a('0x1c')][_0xe84a('0x22')],function(_0x594fdd){return{'model':db[_0x594fdd[_0xe84a('0x23')]],'as':_0x594fdd['as'],'attributes':_0x594fdd[_0xe84a('0x1f')],'include':_0x594fdd[_0xe84a('0x22')]?_[_0xe84a('0x21')](_0x594fdd[_0xe84a('0x22')],function(_0x30a53c){return{'model':db[_0x30a53c[_0xe84a('0x23')]],'as':_0x30a53c['as'],'attributes':_0x30a53c['attributes'],'include':_0x30a53c[_0xe84a('0x22')]?_['map'](_0x30a53c[_0xe84a('0x22')],function(_0x2a9bf){return{'model':db[_0x2a9bf[_0xe84a('0x23')]],'as':_0x2a9bf['as'],'attributes':_0x2a9bf[_0xe84a('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5da546){logger[_0xe84a('0x11')](_0xe84a('0x24'),_0x5cdde7);logger[_0xe84a('0x14')](_0xe84a('0x24'),_0x5cdde7,JSON['stringify'](_0x5da546));_0x5c0177(_0x5da546);})[_0xe84a('0x19')](function(_0x569ef4){logger['error'](_0xe84a('0x24'),_0x569ef4['message'],_0x5cdde7);_0x5aad8a(_0x38a40a[_0xe84a('0x16')](0x1f4,_0x569ef4[_0xe84a('0x17')]));});});};exports[_0xe84a('0x25')]=function(_0x2ce18e){var _0x440c64=this;return new Promise(function(_0x536896,_0x35b677){return db['ChatQueue'][_0xe84a('0x26')]({'raw':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e[_0xe84a('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e[_0xe84a('0x1c')][_0xe84a('0x1e')]||null:null,'attributes':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e[_0xe84a('0x1c')]['attributes']||null:null,'include':_0x2ce18e[_0xe84a('0x1c')]?_0x2ce18e['options'][_0xe84a('0x22')]?_['map'](_0x2ce18e['options'][_0xe84a('0x22')],function(_0x4e62dc){return{'model':db[_0x4e62dc[_0xe84a('0x23')]],'as':_0x4e62dc['as'],'attributes':_0x4e62dc[_0xe84a('0x1f')],'include':_0x4e62dc[_0xe84a('0x22')]?_[_0xe84a('0x21')](_0x4e62dc[_0xe84a('0x22')],function(_0xe750c5){return{'model':db[_0xe750c5[_0xe84a('0x23')]],'as':_0xe750c5['as'],'attributes':_0xe750c5[_0xe84a('0x1f')],'include':_0xe750c5[_0xe84a('0x22')]?_[_0xe84a('0x21')](_0xe750c5['include'],function(_0x4bea08){return{'model':db[_0x4bea08[_0xe84a('0x23')]],'as':_0x4bea08['as'],'attributes':_0x4bea08[_0xe84a('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe84a('0x10')](function(_0x5ad492){logger['info'](_0xe84a('0x25'),_0x2ce18e);logger['debug'](_0xe84a('0x25'),_0x2ce18e,JSON[_0xe84a('0x27')](_0x5ad492));_0x536896(_0x5ad492);})[_0xe84a('0x19')](function(_0x43e172){logger[_0xe84a('0x16')](_0xe84a('0x25'),_0x43e172['message'],_0x2ce18e);_0x35b677(_0x440c64[_0xe84a('0x16')](0x1f4,_0x43e172['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 65e13f4..f317812 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 _0x2bc6=['length','./chatQueue.events','save','remove','emit','removeListener'];(function(_0x3c601b,_0x4e839f){var _0x24f02f=function(_0x6a5086){while(--_0x6a5086){_0x3c601b['push'](_0x3c601b['shift']());}};_0x24f02f(++_0x4e839f);}(_0x2bc6,0x163));var _0x62bc=function(_0x4a0e5b,_0x864f50){_0x4a0e5b=_0x4a0e5b-0x0;var _0x4f6b11=_0x2bc6[_0x4a0e5b];return _0x4f6b11;};'use strict';var ChatQueueEvents=require(_0x62bc('0x0'));var events=[_0x62bc('0x1'),_0x62bc('0x2'),'update'];function createListener(_0x4b4e73,_0x5a2676){return function(_0x5c5a2a){_0x5a2676[_0x62bc('0x3')](_0x4b4e73,_0x5c5a2a);};}function removeListener(_0x576608,_0x2a1959){return function(){ChatQueueEvents[_0x62bc('0x4')](_0x576608,_0x2a1959);};}exports['register']=function(_0x3cce26){for(var _0x450cb6=0x0,_0x40af10=events[_0x62bc('0x5')];_0x450cb6<_0x40af10;_0x450cb6++){var _0x3ed6ad=events[_0x450cb6];var _0x3f625c=createListener('chatQueue:'+_0x3ed6ad,_0x3cce26);ChatQueueEvents['on'](_0x3ed6ad,_0x3f625c);}}; \ No newline at end of file +var _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x4daaa1,_0x4a1bbd){var _0x37a1fd=function(_0xa5d8c1){while(--_0xa5d8c1){_0x4daaa1['push'](_0x4daaa1['shift']());}};_0x37a1fd(++_0x4a1bbd);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x14f4a6,_0x337bb2){_0x14f4a6=_0x14f4a6-0x0;var _0x5c8eca=_0x6f0d[_0x14f4a6];return _0x5c8eca;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xd6f0('0x0'),_0xd6f0('0x1'),_0xd6f0('0x2')];function createListener(_0x107a8c,_0x573473){return function(_0x275230){_0x573473[_0xd6f0('0x3')](_0x107a8c,_0x275230);};}function removeListener(_0x2f78fb,_0x25344b){return function(){ChatQueueEvents[_0xd6f0('0x4')](_0x2f78fb,_0x25344b);};}exports['register']=function(_0x2d2ce6){for(var _0x4a8b0c=0x0,_0xe21ac4=events[_0xd6f0('0x5')];_0x4a8b0c<_0xe21ac4;_0x4a8b0c++){var _0x8b89a9=events[_0x4a8b0c];var _0x1a48a0=createListener('chatQueue:'+_0x8b89a9,_0x2d2ce6);ChatQueueEvents['on'](_0x8b89a9,_0x1a48a0);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 74af25a..9538648 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(_0x5a137d,_0x103598){var _0x331056=function(_0x3213dd){while(--_0x3213dd){_0x5a137d['push'](_0x5a137d['shift']());}};_0x331056(++_0x103598);}(_0x008c,0x188));var _0xc008=function(_0x5e4d4d,_0x5a5aa6){_0x5e4d4d=_0x5e4d4d-0x0;var _0x40cbd6=_0x008c[_0x5e4d4d];return _0x40cbd6;};'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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2e3727,_0x2670ae){var _0x2cc413=function(_0x4821a7){while(--_0x4821a7){_0x2e3727['push'](_0x2e3727['shift']());}};_0x2cc413(++_0x2670ae);}(_0x7217,0x19e));var _0x7721=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x7217[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 20dccba..8a8a983 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 _0xc77d=['STRING','DATE','moment','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc77d,0x156));var _0xdc77=function(_0x32a254,_0x14e1d0){_0x32a254=_0x32a254-0x0;var _0x799afb=_0xc77d[_0x32a254];return _0x799afb;};'use strict';var moment=require(_0xdc77('0x0'));var Sequelize=require(_0xdc77('0x1'));module[_0xdc77('0x2')]={'uniqueid':{'type':Sequelize[_0xdc77('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xdc77('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xdc77('0x4')]},'acceptAt':{'type':Sequelize[_0xdc77('0x4')]},'exitAt':{'type':Sequelize[_0xdc77('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xebab=['STRING','DATE','moment','sequelize','exports'];(function(_0x5b36bd,_0x4dfb36){var _0x1614fe=function(_0x559b7c){while(--_0x559b7c){_0x5b36bd['push'](_0x5b36bd['shift']());}};_0x1614fe(++_0x4dfb36);}(_0xebab,0x124));var _0xbeba=function(_0x92ea13,_0x285a20){_0x92ea13=_0x92ea13-0x0;var _0x565fcd=_0xebab[_0x92ea13];return _0x565fcd;};'use strict';var moment=require(_0xbeba('0x0'));var Sequelize=require(_0xbeba('0x1'));module[_0xbeba('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xbeba('0x3')]},'joinAt':{'type':Sequelize[_0xbeba('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xbeba('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xbeba('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b8ccc6a..044f7d4 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 _0xe55d=['mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','rows','show','params','length','find','body','catch','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x46d704,_0x352056){var _0x4ce393=function(_0x5d74ed){while(--_0x5d74ed){_0x46d704['push'](_0x46d704['shift']());}};_0x4ce393(++_0x352056);}(_0xe55d,0x126));var _0xde55=function(_0x338ea3,_0x511825){_0x338ea3=_0x338ea3-0x0;var _0x311b7d=_0xe55d[_0x338ea3];return _0x311b7d;};'use strict';var emlformat=require(_0xde55('0x0'));var rimraf=require(_0xde55('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde55('0x2'));var rp=require(_0xde55('0x3'));var moment=require(_0xde55('0x4'));var BPromise=require(_0xde55('0x5'));var Mustache=require(_0xde55('0x6'));var util=require(_0xde55('0x7'));var path=require('path');var sox=require(_0xde55('0x8'));var csv=require(_0xde55('0x9'));var ejs=require(_0xde55('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde55('0xb'));var squel=require(_0xde55('0xc'));var crypto=require(_0xde55('0xd'));var jsforce=require(_0xde55('0xe'));var deskjs=require(_0xde55('0xf'));var toCsv=require(_0xde55('0x9'));var querystring=require('querystring');var Papa=require(_0xde55('0x10'));var Redis=require(_0xde55('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xde55('0x12'));var hardwareService=require(_0xde55('0x13'));var logger=require('../../config/logger')(_0xde55('0x14'));var utils=require(_0xde55('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xde55('0x16'));var db=require(_0xde55('0x17'))['db'];function respondWithStatusCode(_0xd83620,_0x571b2a){_0x571b2a=_0x571b2a||0xcc;return function(_0x277d51){if(_0x277d51){return _0xd83620[_0xde55('0x18')](_0x571b2a);}return _0xd83620[_0xde55('0x19')](_0x571b2a)[_0xde55('0x1a')]();};}function respondWithResult(_0x81ea0f,_0x3663d5){_0x3663d5=_0x3663d5||0xc8;return function(_0x5844c9){if(_0x5844c9){return _0x81ea0f['status'](_0x3663d5)[_0xde55('0x1b')](_0x5844c9);}};}function respondWithFilteredResult(_0x37c61a,_0x4b4b84){return function(_0x1238c5){if(_0x1238c5){var _0x3dbdcb=typeof _0x4b4b84[_0xde55('0x1c')]===_0xde55('0x1d')&&typeof _0x4b4b84[_0xde55('0x1e')]===_0xde55('0x1d');var _0x2411a4=_0x1238c5[_0xde55('0x1f')];var _0x4a97e2=_0x3dbdcb?0x0:_0x4b4b84[_0xde55('0x1c')];var _0x42b6e4=_0x3dbdcb?_0x1238c5[_0xde55('0x1f')]:_0x4b4b84[_0xde55('0x1c')]+_0x4b4b84['limit'];var _0x4113f4;if(_0x42b6e4>=_0x2411a4){_0x42b6e4=_0x2411a4;_0x4113f4=0xc8;}else{_0x4113f4=0xce;}_0x37c61a['status'](_0x4113f4);return _0x37c61a[_0xde55('0x20')](_0xde55('0x21'),_0x4a97e2+'-'+_0x42b6e4+'/'+_0x2411a4)['json'](_0x1238c5);}return null;};}function patchUpdates(_0x2dc9b9){return function(_0x5c2991){try{jsonpatch[_0xde55('0x22')](_0x5c2991,_0x2dc9b9,!![]);}catch(_0x5597a4){return BPromise[_0xde55('0x23')](_0x5597a4);}return _0x5c2991['save']();};}function saveUpdates(_0x175106,_0x38e6f8){return function(_0x415463){if(_0x415463){return _0x415463[_0xde55('0x24')](_0x175106)[_0xde55('0x25')](function(_0x29e69c){return _0x29e69c;});}return null;};}function removeEntity(_0xbafeab,_0x2e7607){return function(_0x2e5595){if(_0x2e5595){return _0x2e5595['destroy']()['then'](function(){_0xbafeab[_0xde55('0x19')](0xcc)[_0xde55('0x1a')]();});}};}function handleEntityNotFound(_0x15a04b,_0x36488b){return function(_0x2ece31){if(!_0x2ece31){_0x15a04b[_0xde55('0x18')](0x194);}return _0x2ece31;};}function handleError(_0x330ccc,_0x443b12){_0x443b12=_0x443b12||0x1f4;return function(_0x35f246){logger[_0xde55('0x26')](_0x35f246[_0xde55('0x27')]);if(_0x35f246[_0xde55('0x28')]){delete _0x35f246[_0xde55('0x28')];}_0x330ccc['status'](_0x443b12)['send'](_0x35f246);};}exports[_0xde55('0x29')]=function(_0x51334d,_0x2bf2ae){var _0x1cfde7={},_0x2c42a2={},_0x5592e7={'count':0x0,'rows':[]};var _0x408165=_[_0xde55('0x2a')](db['ChatQueueReport'][_0xde55('0x2b')],function(_0x43c38b){return{'name':_0x43c38b[_0xde55('0x2c')],'type':_0x43c38b['type']['key']};});_0x2c42a2[_0xde55('0x2d')]=_[_0xde55('0x2a')](_0x408165,_0xde55('0x28'));_0x2c42a2[_0xde55('0x2e')]=_[_0xde55('0x2f')](_0x51334d[_0xde55('0x2e')]);_0x2c42a2['filters']=_[_0xde55('0x30')](_0x2c42a2[_0xde55('0x2d')],_0x2c42a2[_0xde55('0x2e')]);_0x1cfde7['attributes']=_[_0xde55('0x30')](_0x2c42a2[_0xde55('0x2d')],qs[_0xde55('0x31')](_0x51334d[_0xde55('0x2e')][_0xde55('0x31')]));_0x1cfde7[_0xde55('0x32')]=_0x1cfde7[_0xde55('0x32')]['length']?_0x1cfde7[_0xde55('0x32')]:_0x2c42a2[_0xde55('0x2d')];if(!_0x51334d[_0xde55('0x2e')]['hasOwnProperty'](_0xde55('0x33'))){_0x1cfde7['limit']=qs[_0xde55('0x1e')](_0x51334d['query'][_0xde55('0x1e')]);_0x1cfde7[_0xde55('0x1c')]=qs['offset'](_0x51334d['query']['offset']);}_0x1cfde7[_0xde55('0x34')]=qs[_0xde55('0x35')](_0x51334d[_0xde55('0x2e')][_0xde55('0x35')]);_0x1cfde7[_0xde55('0x36')]=qs[_0xde55('0x37')](_[_0xde55('0x38')](_0x51334d[_0xde55('0x2e')],_0x2c42a2['filters']),_0x408165);if(_0x51334d['query'][_0xde55('0x39')]){_0x1cfde7[_0xde55('0x36')]=_[_0xde55('0x3a')](_0x1cfde7[_0xde55('0x36')],{'$or':_[_0xde55('0x2a')](_0x408165,function(_0x3b751f){if(_0x3b751f[_0xde55('0x3b')]!==_0xde55('0x3c')){var _0x6debf1={};_0x6debf1[_0x3b751f[_0xde55('0x28')]]={'$like':'%'+_0x51334d[_0xde55('0x2e')][_0xde55('0x39')]+'%'};return _0x6debf1;}})});}_0x1cfde7=_[_0xde55('0x3a')]({},_0x1cfde7,_0x51334d[_0xde55('0x3d')]);var _0x436552={'where':_0x1cfde7[_0xde55('0x36')]};return db[_0xde55('0x3e')][_0xde55('0x1f')](_0x436552)[_0xde55('0x25')](function(_0x586078){_0x5592e7[_0xde55('0x1f')]=_0x586078;if(_0x51334d['query'][_0xde55('0x3f')]){_0x1cfde7[_0xde55('0x40')]=[{'all':!![]}];}return db[_0xde55('0x3e')][_0xde55('0x41')](_0x1cfde7);})[_0xde55('0x25')](function(_0xb754d7){_0x5592e7[_0xde55('0x42')]=_0xb754d7;return _0x5592e7;})[_0xde55('0x25')](respondWithFilteredResult(_0x2bf2ae,_0x1cfde7))['catch'](handleError(_0x2bf2ae,null));};exports[_0xde55('0x43')]=function(_0x419741,_0x157b7c){var _0x5509a2={'raw':!![],'where':{'id':_0x419741[_0xde55('0x44')]['id']}},_0x40abd1={};_0x40abd1['model']=_[_0xde55('0x2f')](db['ChatQueueReport'][_0xde55('0x2b')]);_0x40abd1[_0xde55('0x2e')]=_[_0xde55('0x2f')](_0x419741[_0xde55('0x2e')]);_0x40abd1[_0xde55('0x37')]=_[_0xde55('0x30')](_0x40abd1[_0xde55('0x2d')],_0x40abd1[_0xde55('0x2e')]);_0x5509a2[_0xde55('0x32')]=_[_0xde55('0x30')](_0x40abd1['model'],qs[_0xde55('0x31')](_0x419741['query'][_0xde55('0x31')]));_0x5509a2[_0xde55('0x32')]=_0x5509a2['attributes'][_0xde55('0x45')]?_0x5509a2[_0xde55('0x32')]:_0x40abd1[_0xde55('0x2d')];if(_0x419741[_0xde55('0x2e')]['includeAll']){_0x5509a2['include']=[{'all':!![]}];}_0x5509a2=_['merge']({},_0x5509a2,_0x419741['options']);return db[_0xde55('0x3e')][_0xde55('0x46')](_0x5509a2)['then'](handleEntityNotFound(_0x157b7c,null))[_0xde55('0x25')](respondWithResult(_0x157b7c,null))['catch'](handleError(_0x157b7c,null));};exports['create']=function(_0x4a4945,_0x1a14e0){return db['ChatQueueReport']['create'](_0x4a4945[_0xde55('0x47')],{})[_0xde55('0x25')](respondWithResult(_0x1a14e0,0xc9))[_0xde55('0x48')](handleError(_0x1a14e0,null));};exports[_0xde55('0x24')]=function(_0x443690,_0x1c6b42){if(_0x443690[_0xde55('0x47')]['id']){delete _0x443690['body']['id'];}return db[_0xde55('0x3e')][_0xde55('0x46')]({'where':{'id':_0x443690['params']['id']}})[_0xde55('0x25')](handleEntityNotFound(_0x1c6b42,null))[_0xde55('0x25')](saveUpdates(_0x443690[_0xde55('0x47')],null))[_0xde55('0x25')](respondWithResult(_0x1c6b42,null))[_0xde55('0x48')](handleError(_0x1c6b42,null));};exports[_0xde55('0x49')]=function(_0x712684,_0x477d30){return db[_0xde55('0x3e')][_0xde55('0x46')]({'where':{'id':_0x712684[_0xde55('0x44')]['id']}})[_0xde55('0x25')](handleEntityNotFound(_0x477d30,null))[_0xde55('0x25')](removeEntity(_0x477d30,null))[_0xde55('0x48')](handleError(_0x477d30,null));};exports[_0xde55('0x4a')]=function(_0x326f2,_0x53838e){return db['ChatQueueReport']['describe']()[_0xde55('0x25')](respondWithResult(_0x53838e,null))['catch'](handleError(_0x53838e,null));}; \ No newline at end of file +var _0xea4e=['eml-format','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','then','error','name','send','map','rawAttributes','model','query','keys','filters','attributes','fields','length','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','show','params','ChatQueueReport','intersection','find','catch','create','body','destroy','describe'];(function(_0x2a586f,_0x21e596){var _0x18c65a=function(_0x4003a5){while(--_0x4003a5){_0x2a586f['push'](_0x2a586f['shift']());}};_0x18c65a(++_0x21e596);}(_0xea4e,0x10c));var _0xeea4=function(_0xe6beba,_0x3f15d1){_0xe6beba=_0xe6beba-0x0;var _0x2f1c08=_0xea4e[_0xe6beba];return _0x2f1c08;};'use strict';var emlformat=require(_0xeea4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xeea4('0x1'));var moment=require('moment');var BPromise=require(_0xeea4('0x2'));var Mustache=require(_0xeea4('0x3'));var util=require('util');var path=require(_0xeea4('0x4'));var sox=require(_0xeea4('0x5'));var csv=require(_0xeea4('0x6'));var ejs=require(_0xeea4('0x7'));var fs=require('fs');var fs_extra=require(_0xeea4('0x8'));var _=require(_0xeea4('0x9'));var squel=require(_0xeea4('0xa'));var crypto=require(_0xeea4('0xb'));var jsforce=require(_0xeea4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeea4('0x6'));var querystring=require('querystring');var Papa=require(_0xeea4('0xd'));var Redis=require(_0xeea4('0xe'));var authService=require(_0xeea4('0xf'));var qs=require(_0xeea4('0x10'));var as=require(_0xeea4('0x11'));var hardwareService=require(_0xeea4('0x12'));var logger=require(_0xeea4('0x13'))(_0xeea4('0x14'));var utils=require('../../config/utils');var config=require(_0xeea4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xeea4('0x16'))['db'];function respondWithStatusCode(_0x216785,_0x3c18ed){_0x3c18ed=_0x3c18ed||0xcc;return function(_0x3dbf8c){if(_0x3dbf8c){return _0x216785[_0xeea4('0x17')](_0x3c18ed);}return _0x216785[_0xeea4('0x18')](_0x3c18ed)[_0xeea4('0x19')]();};}function respondWithResult(_0x9d04aa,_0x4d6605){_0x4d6605=_0x4d6605||0xc8;return function(_0x169fc5){if(_0x169fc5){return _0x9d04aa[_0xeea4('0x18')](_0x4d6605)['json'](_0x169fc5);}};}function respondWithFilteredResult(_0x44f13a,_0x4d47b0){return function(_0x2d5a6c){if(_0x2d5a6c){var _0x44f573=typeof _0x4d47b0[_0xeea4('0x1a')]===_0xeea4('0x1b')&&typeof _0x4d47b0[_0xeea4('0x1c')]===_0xeea4('0x1b');var _0x37cd8e=_0x2d5a6c[_0xeea4('0x1d')];var _0x26d8f4=_0x44f573?0x0:_0x4d47b0[_0xeea4('0x1a')];var _0x4ae372=_0x44f573?_0x2d5a6c[_0xeea4('0x1d')]:_0x4d47b0[_0xeea4('0x1a')]+_0x4d47b0['limit'];var _0x36a9b3;if(_0x4ae372>=_0x37cd8e){_0x4ae372=_0x37cd8e;_0x36a9b3=0xc8;}else{_0x36a9b3=0xce;}_0x44f13a[_0xeea4('0x18')](_0x36a9b3);return _0x44f13a['set'](_0xeea4('0x1e'),_0x26d8f4+'-'+_0x4ae372+'/'+_0x37cd8e)['json'](_0x2d5a6c);}return null;};}function patchUpdates(_0x3f7316){return function(_0x54cf4d){try{jsonpatch['apply'](_0x54cf4d,_0x3f7316,!![]);}catch(_0x3756ad){return BPromise['reject'](_0x3756ad);}return _0x54cf4d[_0xeea4('0x1f')]();};}function saveUpdates(_0x12ba5b,_0x3e162c){return function(_0x19b2a8){if(_0x19b2a8){return _0x19b2a8[_0xeea4('0x20')](_0x12ba5b)['then'](function(_0x3f2cd2){return _0x3f2cd2;});}return null;};}function removeEntity(_0x88ab4f,_0x290983){return function(_0x31dab){if(_0x31dab){return _0x31dab['destroy']()[_0xeea4('0x21')](function(){_0x88ab4f[_0xeea4('0x18')](0xcc)[_0xeea4('0x19')]();});}};}function handleEntityNotFound(_0x433825,_0x565da5){return function(_0x594258){if(!_0x594258){_0x433825[_0xeea4('0x17')](0x194);}return _0x594258;};}function handleError(_0x28d8f9,_0x3207a9){_0x3207a9=_0x3207a9||0x1f4;return function(_0x197573){logger[_0xeea4('0x22')](_0x197573['stack']);if(_0x197573[_0xeea4('0x23')]){delete _0x197573[_0xeea4('0x23')];}_0x28d8f9['status'](_0x3207a9)[_0xeea4('0x24')](_0x197573);};}exports['index']=function(_0x4a3a7e,_0xb2acc2){var _0x2eb38c={},_0x134f24={},_0x1217b4={'count':0x0,'rows':[]};var _0x5b651f=_[_0xeea4('0x25')](db['ChatQueueReport'][_0xeea4('0x26')],function(_0x4d68d8){return{'name':_0x4d68d8['fieldName'],'type':_0x4d68d8['type']['key']};});_0x134f24[_0xeea4('0x27')]=_['map'](_0x5b651f,_0xeea4('0x23'));_0x134f24[_0xeea4('0x28')]=_[_0xeea4('0x29')](_0x4a3a7e[_0xeea4('0x28')]);_0x134f24[_0xeea4('0x2a')]=_['intersection'](_0x134f24[_0xeea4('0x27')],_0x134f24[_0xeea4('0x28')]);_0x2eb38c[_0xeea4('0x2b')]=_['intersection'](_0x134f24[_0xeea4('0x27')],qs[_0xeea4('0x2c')](_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x2c')]));_0x2eb38c[_0xeea4('0x2b')]=_0x2eb38c[_0xeea4('0x2b')][_0xeea4('0x2d')]?_0x2eb38c[_0xeea4('0x2b')]:_0x134f24[_0xeea4('0x27')];if(!_0x4a3a7e[_0xeea4('0x28')]['hasOwnProperty']('nolimit')){_0x2eb38c[_0xeea4('0x1c')]=qs[_0xeea4('0x1c')](_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x1c')]);_0x2eb38c[_0xeea4('0x1a')]=qs[_0xeea4('0x1a')](_0x4a3a7e[_0xeea4('0x28')]['offset']);}_0x2eb38c[_0xeea4('0x2e')]=qs[_0xeea4('0x2f')](_0x4a3a7e[_0xeea4('0x28')]['sort']);_0x2eb38c[_0xeea4('0x30')]=qs[_0xeea4('0x2a')](_['pick'](_0x4a3a7e[_0xeea4('0x28')],_0x134f24[_0xeea4('0x2a')]),_0x5b651f);if(_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x31')]){_0x2eb38c[_0xeea4('0x30')]=_[_0xeea4('0x32')](_0x2eb38c[_0xeea4('0x30')],{'$or':_[_0xeea4('0x25')](_0x5b651f,function(_0x52a32d){if(_0x52a32d[_0xeea4('0x33')]!==_0xeea4('0x34')){var _0x47f7a2={};_0x47f7a2[_0x52a32d[_0xeea4('0x23')]]={'$like':'%'+_0x4a3a7e[_0xeea4('0x28')][_0xeea4('0x31')]+'%'};return _0x47f7a2;}})});}_0x2eb38c=_[_0xeea4('0x32')]({},_0x2eb38c,_0x4a3a7e[_0xeea4('0x35')]);var _0x3981fd={'where':_0x2eb38c[_0xeea4('0x30')]};return db['ChatQueueReport'][_0xeea4('0x1d')](_0x3981fd)[_0xeea4('0x21')](function(_0x5d6323){_0x1217b4[_0xeea4('0x1d')]=_0x5d6323;if(_0x4a3a7e['query'][_0xeea4('0x36')]){_0x2eb38c[_0xeea4('0x37')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x2eb38c);})[_0xeea4('0x21')](function(_0x4d1512){_0x1217b4[_0xeea4('0x38')]=_0x4d1512;return _0x1217b4;})[_0xeea4('0x21')](respondWithFilteredResult(_0xb2acc2,_0x2eb38c))['catch'](handleError(_0xb2acc2,null));};exports[_0xeea4('0x39')]=function(_0x410a1c,_0x55d136){var _0xb56e01={'raw':!![],'where':{'id':_0x410a1c[_0xeea4('0x3a')]['id']}},_0x13a30c={};_0x13a30c[_0xeea4('0x27')]=_[_0xeea4('0x29')](db[_0xeea4('0x3b')][_0xeea4('0x26')]);_0x13a30c['query']=_[_0xeea4('0x29')](_0x410a1c[_0xeea4('0x28')]);_0x13a30c[_0xeea4('0x2a')]=_[_0xeea4('0x3c')](_0x13a30c['model'],_0x13a30c[_0xeea4('0x28')]);_0xb56e01[_0xeea4('0x2b')]=_[_0xeea4('0x3c')](_0x13a30c['model'],qs['fields'](_0x410a1c[_0xeea4('0x28')][_0xeea4('0x2c')]));_0xb56e01['attributes']=_0xb56e01['attributes'][_0xeea4('0x2d')]?_0xb56e01[_0xeea4('0x2b')]:_0x13a30c[_0xeea4('0x27')];if(_0x410a1c[_0xeea4('0x28')][_0xeea4('0x36')]){_0xb56e01['include']=[{'all':!![]}];}_0xb56e01=_[_0xeea4('0x32')]({},_0xb56e01,_0x410a1c['options']);return db[_0xeea4('0x3b')][_0xeea4('0x3d')](_0xb56e01)[_0xeea4('0x21')](handleEntityNotFound(_0x55d136,null))['then'](respondWithResult(_0x55d136,null))[_0xeea4('0x3e')](handleError(_0x55d136,null));};exports['create']=function(_0x4e525b,_0x11aa5f){return db[_0xeea4('0x3b')][_0xeea4('0x3f')](_0x4e525b[_0xeea4('0x40')],{})['then'](respondWithResult(_0x11aa5f,0xc9))['catch'](handleError(_0x11aa5f,null));};exports[_0xeea4('0x20')]=function(_0x18bb53,_0x208282){if(_0x18bb53['body']['id']){delete _0x18bb53[_0xeea4('0x40')]['id'];}return db[_0xeea4('0x3b')]['find']({'where':{'id':_0x18bb53['params']['id']}})['then'](handleEntityNotFound(_0x208282,null))[_0xeea4('0x21')](saveUpdates(_0x18bb53[_0xeea4('0x40')],null))[_0xeea4('0x21')](respondWithResult(_0x208282,null))[_0xeea4('0x3e')](handleError(_0x208282,null));};exports[_0xeea4('0x41')]=function(_0x2bc6e6,_0x37c205){return db[_0xeea4('0x3b')]['find']({'where':{'id':_0x2bc6e6['params']['id']}})[_0xeea4('0x21')](handleEntityNotFound(_0x37c205,null))['then'](removeEntity(_0x37c205,null))[_0xeea4('0x3e')](handleError(_0x37c205,null));};exports['describe']=function(_0x92788c,_0xfb11fd){return db['ChatQueueReport'][_0xeea4('0x42')]()[_0xeea4('0x21')](respondWithResult(_0xfb11fd,null))[_0xeea4('0x3e')](handleError(_0xfb11fd,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index cee04dc..035de23 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x2b858d,_0x303fc1){var _0xbd4855=function(_0x1c1334){while(--_0x1c1334){_0x2b858d['push'](_0x2b858d['shift']());}};_0xbd4855(++_0x303fc1);}(_0x757a,0xde));var _0xa757=function(_0x365ab5,_0x23c621){_0x365ab5=_0x365ab5-0x0;var _0x50d0a7=_0x757a[_0x365ab5];return _0x50d0a7;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x17c7fc,_0x160896){var _0xc24f7e=function(_0xead648){while(--_0xead648){_0x17c7fc['push'](_0x17c7fc['shift']());}};_0xc24f7e(++_0x160896);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fbea442..23c8e80 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 _0x8a99=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','update','attributes','limit','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x7a048a,_0x244252){var _0x3ff163=function(_0x38b9c7){while(--_0x38b9c7){_0x7a048a['push'](_0x7a048a['shift']());}};_0x3ff163(++_0x244252);}(_0x8a99,0x184));var _0x98a9=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x8a99[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x98a9('0x0'));var util=require('util');var moment=require(_0x98a9('0x1'));var BPromise=require(_0x98a9('0x2'));var rs=require(_0x98a9('0x3'));var fs=require('fs');var Redis=require(_0x98a9('0x4'));var db=require(_0x98a9('0x5'))['db'];var utils=require(_0x98a9('0x6'));var logger=require(_0x98a9('0x7'))(_0x98a9('0x8'));var config=require(_0x98a9('0x9'));var jayson=require(_0x98a9('0xa'));var client=jayson[_0x98a9('0xb')][_0x98a9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x417235,_0x13f674,_0x1bedc7){return new BPromise(function(_0x2640fb,_0x2e26df){return client[_0x98a9('0xd')](_0x417235,_0x1bedc7)[_0x98a9('0xe')](function(_0x44499f){logger[_0x98a9('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x13f674,_0x98a9('0x10'));logger[_0x98a9('0x11')](_0x98a9('0x12'),_0x13f674,_0x98a9('0x10'),JSON[_0x98a9('0x13')](_0x44499f));if(_0x44499f['error']){if(_0x44499f[_0x98a9('0x14')][_0x98a9('0x15')]===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x13f674,_0x44499f[_0x98a9('0x14')][_0x98a9('0x16')]);return _0x2e26df(_0x44499f['error'][_0x98a9('0x16')]);}logger['error'](_0x98a9('0x17'),_0x13f674,_0x44499f[_0x98a9('0x14')][_0x98a9('0x16')]);return _0x2640fb(_0x44499f['error'][_0x98a9('0x16')]);}else{logger[_0x98a9('0xf')](_0x98a9('0x17'),_0x13f674,_0x98a9('0x10'));_0x2640fb(_0x44499f[_0x98a9('0x18')][_0x98a9('0x16')]);}})[_0x98a9('0x19')](function(_0x2a2a9e){logger[_0x98a9('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x13f674,_0x2a2a9e);_0x2e26df(_0x2a2a9e);});});}exports[_0x98a9('0x1a')]=function(_0x24e966){var _0x50f1ef=this;return new Promise(function(_0xe52860,_0x54e787){return db[_0x98a9('0x1b')][_0x98a9('0x1c')](_0x24e966[_0x98a9('0x1d')],{'raw':_0x24e966['options']?_0x24e966[_0x98a9('0x1e')][_0x98a9('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x25f997){logger['info'](_0x98a9('0x1a'),_0x24e966);logger[_0x98a9('0x11')](_0x98a9('0x1a'),_0x24e966,JSON['stringify'](_0x25f997));_0xe52860(_0x25f997);})[_0x98a9('0x19')](function(_0xfe92ab){logger['error'](_0x98a9('0x1a'),_0xfe92ab[_0x98a9('0x16')],_0x24e966);_0x54e787(_0x50f1ef['error'](0x1f4,_0xfe92ab[_0x98a9('0x16')]));});});};exports['UpdateChatQueueReport']=function(_0x17bc52){var _0x326259=this;return new Promise(function(_0x46b78e,_0x54d9bd){return db[_0x98a9('0x1b')][_0x98a9('0x20')](_0x17bc52['body'],{'raw':_0x17bc52['options']?_0x17bc52['options'][_0x98a9('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17bc52[_0x98a9('0x1e')]?_0x17bc52[_0x98a9('0x1e')]['where']||null:null,'attributes':_0x17bc52[_0x98a9('0x1e')]?_0x17bc52[_0x98a9('0x1e')][_0x98a9('0x21')]||null:null,'limit':_0x17bc52['options']?_0x17bc52[_0x98a9('0x1e')][_0x98a9('0x22')]||null:null})[_0x98a9('0xe')](function(_0xe675d7){logger[_0x98a9('0xf')](_0x98a9('0x23'),_0x17bc52);logger['debug']('UpdateChatQueueReport',_0x17bc52,JSON['stringify'](_0xe675d7));_0x46b78e(_0xe675d7);})[_0x98a9('0x19')](function(_0xdc1c1a){logger['error'](_0x98a9('0x23'),_0xdc1c1a['message'],_0x17bc52);_0x54d9bd(_0x326259[_0x98a9('0x14')](0x1f4,_0xdc1c1a[_0x98a9('0x16')]));});});}; \ No newline at end of file +var _0xbc10=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateChatQueueReport','create','body','options','raw','stringify','catch','UpdateChatQueueReport','ChatQueueReport','update','where','attributes','limit','lodash','moment','bluebird'];(function(_0x320f2e,_0x45f4e9){var _0x1c8bc1=function(_0x2e1d46){while(--_0x2e1d46){_0x320f2e['push'](_0x320f2e['shift']());}};_0x1c8bc1(++_0x45f4e9);}(_0xbc10,0xa2));var _0x0bc1=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0xbc10[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0x0bc1('0x0'));var util=require('util');var moment=require(_0x0bc1('0x1'));var BPromise=require(_0x0bc1('0x2'));var rs=require(_0x0bc1('0x3'));var fs=require('fs');var Redis=require(_0x0bc1('0x4'));var db=require(_0x0bc1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0bc1('0x6'))('rpc');var config=require(_0x0bc1('0x7'));var jayson=require(_0x0bc1('0x8'));var client=jayson[_0x0bc1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4428f6,_0x3ea04d,_0x127333){return new BPromise(function(_0x18c600,_0x201e66){return client[_0x0bc1('0xa')](_0x4428f6,_0x127333)[_0x0bc1('0xb')](function(_0x4572d8){logger[_0x0bc1('0xc')](_0x0bc1('0xd'),_0x3ea04d,_0x0bc1('0xe'));logger[_0x0bc1('0xf')](_0x0bc1('0x10'),_0x3ea04d,_0x0bc1('0xe'),JSON['stringify'](_0x4572d8));if(_0x4572d8[_0x0bc1('0x11')]){if(_0x4572d8[_0x0bc1('0x11')]['code']===0x1f4){logger[_0x0bc1('0x11')](_0x0bc1('0xd'),_0x3ea04d,_0x4572d8[_0x0bc1('0x11')][_0x0bc1('0x12')]);return _0x201e66(_0x4572d8[_0x0bc1('0x11')]['message']);}logger[_0x0bc1('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x3ea04d,_0x4572d8[_0x0bc1('0x11')][_0x0bc1('0x12')]);return _0x18c600(_0x4572d8['error'][_0x0bc1('0x12')]);}else{logger[_0x0bc1('0xc')](_0x0bc1('0xd'),_0x3ea04d,'request\x20sent');_0x18c600(_0x4572d8[_0x0bc1('0x13')][_0x0bc1('0x12')]);}})['catch'](function(_0x31c5d5){logger[_0x0bc1('0x11')](_0x0bc1('0xd'),_0x3ea04d,_0x31c5d5);_0x201e66(_0x31c5d5);});});}exports[_0x0bc1('0x14')]=function(_0x3c0312){var _0x1420bb=this;return new Promise(function(_0x2eee1c,_0x4f96f0){return db['ChatQueueReport'][_0x0bc1('0x15')](_0x3c0312[_0x0bc1('0x16')],{'raw':_0x3c0312[_0x0bc1('0x17')]?_0x3c0312[_0x0bc1('0x17')][_0x0bc1('0x18')]===undefined?!![]:![]:!![]})[_0x0bc1('0xb')](function(_0x2d7cab){logger[_0x0bc1('0xc')](_0x0bc1('0x14'),_0x3c0312);logger[_0x0bc1('0xf')](_0x0bc1('0x14'),_0x3c0312,JSON[_0x0bc1('0x19')](_0x2d7cab));_0x2eee1c(_0x2d7cab);})[_0x0bc1('0x1a')](function(_0x1f2219){logger[_0x0bc1('0x11')]('CreateChatQueueReport',_0x1f2219[_0x0bc1('0x12')],_0x3c0312);_0x4f96f0(_0x1420bb['error'](0x1f4,_0x1f2219[_0x0bc1('0x12')]));});});};exports[_0x0bc1('0x1b')]=function(_0x1d545b){var _0x83690f=this;return new Promise(function(_0x5e1a24,_0x158dca){return db[_0x0bc1('0x1c')][_0x0bc1('0x1d')](_0x1d545b[_0x0bc1('0x16')],{'raw':_0x1d545b[_0x0bc1('0x17')]?_0x1d545b[_0x0bc1('0x17')][_0x0bc1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d545b[_0x0bc1('0x17')]?_0x1d545b[_0x0bc1('0x17')][_0x0bc1('0x1e')]||null:null,'attributes':_0x1d545b[_0x0bc1('0x17')]?_0x1d545b[_0x0bc1('0x17')][_0x0bc1('0x1f')]||null:null,'limit':_0x1d545b[_0x0bc1('0x17')]?_0x1d545b[_0x0bc1('0x17')][_0x0bc1('0x20')]||null:null})[_0x0bc1('0xb')](function(_0x2e7c46){logger[_0x0bc1('0xc')]('UpdateChatQueueReport',_0x1d545b);logger[_0x0bc1('0xf')](_0x0bc1('0x1b'),_0x1d545b,JSON[_0x0bc1('0x19')](_0x2e7c46));_0x5e1a24(_0x2e7c46);})[_0x0bc1('0x1a')](function(_0x37976d){logger[_0x0bc1('0x11')](_0x0bc1('0x1b'),_0x37976d[_0x0bc1('0x12')],_0x1d545b);_0x158dca(_0x83690f['error'](0x1f4,_0x37976d[_0x0bc1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index e234b3a..0fd1d0a 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 _0xfe14=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','isAuthenticated','get','/describe','describe','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xfe14,0xda));var _0x4fe1=function(_0x1e08fa,_0x2177b8){_0x1e08fa=_0x1e08fa-0x0;var _0x48a80f=_0xfe14[_0x1e08fa];return _0x48a80f;};'use strict';var multer=require(_0x4fe1('0x0'));var util=require(_0x4fe1('0x1'));var path=require(_0x4fe1('0x2'));var timeout=require(_0x4fe1('0x3'));var express=require(_0x4fe1('0x4'));var router=express['Router']();var fs_extra=require(_0x4fe1('0x5'));var auth=require(_0x4fe1('0x6'));var interaction=require(_0x4fe1('0x7'));var config=require('../../config/environment');var controller=require(_0x4fe1('0x8'));router['get']('/',auth[_0x4fe1('0x9')](),controller['index']);router[_0x4fe1('0xa')](_0x4fe1('0xb'),auth[_0x4fe1('0x9')](),controller[_0x4fe1('0xc')]);router['get']('/:id',auth[_0x4fe1('0x9')](),controller[_0x4fe1('0xd')]);router[_0x4fe1('0xe')]('/',auth[_0x4fe1('0x9')](),controller[_0x4fe1('0xf')]);router[_0x4fe1('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4fe1('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x4fe1('0x12')]);module[_0x4fe1('0x13')]=router; \ No newline at end of file +var _0x416e=['describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x416e,0x102));var _0xe416=function(_0x12da0f,_0x32ae44){_0x12da0f=_0x12da0f-0x0;var _0x4adae=_0x416e[_0x12da0f];return _0x4adae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe416('0x0'));var timeout=require('connect-timeout');var express=require(_0xe416('0x1'));var router=express[_0xe416('0x2')]();var fs_extra=require(_0xe416('0x3'));var auth=require(_0xe416('0x4'));var interaction=require(_0xe416('0x5'));var config=require(_0xe416('0x6'));var controller=require(_0xe416('0x7'));router[_0xe416('0x8')]('/',auth[_0xe416('0x9')](),controller[_0xe416('0xa')]);router[_0xe416('0x8')](_0xe416('0xb'),auth[_0xe416('0x9')](),controller[_0xe416('0xc')]);router[_0xe416('0x8')](_0xe416('0xd'),auth['isAuthenticated'](),controller[_0xe416('0xe')]);router[_0xe416('0xf')]('/',auth[_0xe416('0x9')](),controller[_0xe416('0x10')]);router[_0xe416('0x11')]('/:id',auth[_0xe416('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c10f693..da4c67f 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xc0d9bc,_0x2bd6be){var _0x32ff73=function(_0x28c592){while(--_0x28c592){_0xc0d9bc['push'](_0xc0d9bc['shift']());}};_0x32ff73(++_0x2bd6be);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f5769,_0x10f092){_0x4f5769=_0x4f5769-0x0;var _0x1a89f3=_0x9bde[_0x4f5769];return _0x1a89f3;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0xb43b,0x1b2));var _0xbb43=function(_0xce9bf2,_0x2b3479){_0xce9bf2=_0xce9bf2-0x0;var _0x209960=_0xb43b[_0xce9bf2];return _0x209960;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7b18ea8..cd90d4b 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 _0x4fe3=['Content-Range','apply','reject','update','then','destroy','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set'];(function(_0x7ecc0,_0x3c5cc5){var _0x5d016b=function(_0x4229ad){while(--_0x4229ad){_0x7ecc0['push'](_0x7ecc0['shift']());}};_0x5d016b(++_0x3c5cc5);}(_0x4fe3,0x117));var _0x34fe=function(_0x44af8f,_0x46730e){_0x44af8f=_0x44af8f-0x0;var _0x4e96ab=_0x4fe3[_0x44af8f];return _0x4e96ab;};'use strict';var emlformat=require(_0x34fe('0x0'));var rimraf=require(_0x34fe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34fe('0x2'));var rp=require(_0x34fe('0x3'));var moment=require(_0x34fe('0x4'));var BPromise=require(_0x34fe('0x5'));var Mustache=require(_0x34fe('0x6'));var util=require(_0x34fe('0x7'));var path=require(_0x34fe('0x8'));var sox=require(_0x34fe('0x9'));var csv=require(_0x34fe('0xa'));var ejs=require(_0x34fe('0xb'));var fs=require('fs');var fs_extra=require(_0x34fe('0xc'));var _=require(_0x34fe('0xd'));var squel=require(_0x34fe('0xe'));var crypto=require(_0x34fe('0xf'));var jsforce=require(_0x34fe('0x10'));var deskjs=require(_0x34fe('0x11'));var toCsv=require(_0x34fe('0xa'));var querystring=require(_0x34fe('0x12'));var Papa=require('papaparse');var Redis=require(_0x34fe('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x34fe('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34fe('0x15'));var logger=require(_0x34fe('0x16'))(_0x34fe('0x17'));var utils=require(_0x34fe('0x18'));var config=require(_0x34fe('0x19'));var licenseUtil=require(_0x34fe('0x1a'));var db=require(_0x34fe('0x1b'))['db'];function respondWithStatusCode(_0x13d8c6,_0x2d6eed){_0x2d6eed=_0x2d6eed||0xcc;return function(_0x1430f0){if(_0x1430f0){return _0x13d8c6[_0x34fe('0x1c')](_0x2d6eed);}return _0x13d8c6['status'](_0x2d6eed)[_0x34fe('0x1d')]();};}function respondWithResult(_0x51ad75,_0x524e7b){_0x524e7b=_0x524e7b||0xc8;return function(_0x5b33ad){if(_0x5b33ad){return _0x51ad75[_0x34fe('0x1e')](_0x524e7b)[_0x34fe('0x1f')](_0x5b33ad);}};}function respondWithFilteredResult(_0x1254c6,_0x5863fb){return function(_0x1e30a0){if(_0x1e30a0){var _0x40ad0a=typeof _0x5863fb[_0x34fe('0x20')]==='undefined'&&typeof _0x5863fb[_0x34fe('0x21')]===_0x34fe('0x22');var _0x34f7a3=_0x1e30a0['count'];var _0xbd62cb=_0x40ad0a?0x0:_0x5863fb[_0x34fe('0x20')];var _0x29413f=_0x40ad0a?_0x1e30a0[_0x34fe('0x23')]:_0x5863fb['offset']+_0x5863fb[_0x34fe('0x21')];var _0x59a217;if(_0x29413f>=_0x34f7a3){_0x29413f=_0x34f7a3;_0x59a217=0xc8;}else{_0x59a217=0xce;}_0x1254c6[_0x34fe('0x1e')](_0x59a217);return _0x1254c6[_0x34fe('0x24')](_0x34fe('0x25'),_0xbd62cb+'-'+_0x29413f+'/'+_0x34f7a3)[_0x34fe('0x1f')](_0x1e30a0);}return null;};}function patchUpdates(_0x5c8c82){return function(_0xeca00f){try{jsonpatch[_0x34fe('0x26')](_0xeca00f,_0x5c8c82,!![]);}catch(_0x493531){return BPromise[_0x34fe('0x27')](_0x493531);}return _0xeca00f['save']();};}function saveUpdates(_0x492870,_0x3da1b2){return function(_0x484db2){if(_0x484db2){return _0x484db2[_0x34fe('0x28')](_0x492870)[_0x34fe('0x29')](function(_0x163fec){return _0x163fec;});}return null;};}function removeEntity(_0x115610,_0xcf6067){return function(_0x40806b){if(_0x40806b){return _0x40806b[_0x34fe('0x2a')]()['then'](function(){_0x115610[_0x34fe('0x1e')](0xcc)[_0x34fe('0x1d')]();});}};}function handleEntityNotFound(_0x180670,_0x25737f){return function(_0x11f49d){if(!_0x11f49d){_0x180670[_0x34fe('0x1c')](0x194);}return _0x11f49d;};}function handleError(_0xfc0c26,_0x1b0300){_0x1b0300=_0x1b0300||0x1f4;return function(_0x4249ce){logger['error'](_0x4249ce['stack']);if(_0x4249ce[_0x34fe('0x2b')]){delete _0x4249ce[_0x34fe('0x2b')];}_0xfc0c26[_0x34fe('0x1e')](_0x1b0300)[_0x34fe('0x2c')](_0x4249ce);};}exports[_0x34fe('0x2d')]=function(_0x26a353,_0x52baff){var _0x2a9df8={},_0x13d4f1={},_0x5ac6d6={'count':0x0,'rows':[]};var _0x1ff7a1=_[_0x34fe('0x2e')](db[_0x34fe('0x2f')][_0x34fe('0x30')],function(_0x47700f){return{'name':_0x47700f[_0x34fe('0x31')],'type':_0x47700f[_0x34fe('0x32')][_0x34fe('0x33')]};});_0x13d4f1[_0x34fe('0x34')]=_[_0x34fe('0x2e')](_0x1ff7a1,_0x34fe('0x2b'));_0x13d4f1['query']=_[_0x34fe('0x35')](_0x26a353['query']);_0x13d4f1[_0x34fe('0x36')]=_['intersection'](_0x13d4f1[_0x34fe('0x34')],_0x13d4f1[_0x34fe('0x37')]);_0x2a9df8[_0x34fe('0x38')]=_[_0x34fe('0x39')](_0x13d4f1[_0x34fe('0x34')],qs[_0x34fe('0x3a')](_0x26a353[_0x34fe('0x37')][_0x34fe('0x3a')]));_0x2a9df8['attributes']=_0x2a9df8[_0x34fe('0x38')][_0x34fe('0x3b')]?_0x2a9df8['attributes']:_0x13d4f1[_0x34fe('0x34')];if(!_0x26a353[_0x34fe('0x37')][_0x34fe('0x3c')](_0x34fe('0x3d'))){_0x2a9df8[_0x34fe('0x21')]=qs[_0x34fe('0x21')](_0x26a353[_0x34fe('0x37')][_0x34fe('0x21')]);_0x2a9df8[_0x34fe('0x20')]=qs[_0x34fe('0x20')](_0x26a353[_0x34fe('0x37')][_0x34fe('0x20')]);}_0x2a9df8[_0x34fe('0x3e')]=qs[_0x34fe('0x3f')](_0x26a353[_0x34fe('0x37')][_0x34fe('0x3f')]);_0x2a9df8[_0x34fe('0x40')]=qs[_0x34fe('0x36')](_[_0x34fe('0x41')](_0x26a353[_0x34fe('0x37')],_0x13d4f1[_0x34fe('0x36')]),_0x1ff7a1);if(_0x26a353[_0x34fe('0x37')]['filter']){_0x2a9df8[_0x34fe('0x40')]=_[_0x34fe('0x42')](_0x2a9df8[_0x34fe('0x40')],{'$or':_[_0x34fe('0x2e')](_0x1ff7a1,function(_0x10810c){if(_0x10810c[_0x34fe('0x32')]!=='VIRTUAL'){var _0x173721={};_0x173721[_0x10810c['name']]={'$like':'%'+_0x26a353[_0x34fe('0x37')][_0x34fe('0x43')]+'%'};return _0x173721;}})});}_0x2a9df8=_[_0x34fe('0x42')]({},_0x2a9df8,_0x26a353['options']);var _0x3d396e={'where':_0x2a9df8[_0x34fe('0x40')]};return db[_0x34fe('0x2f')][_0x34fe('0x23')](_0x3d396e)[_0x34fe('0x29')](function(_0x38405b){_0x5ac6d6['count']=_0x38405b;if(_0x26a353[_0x34fe('0x37')]['includeAll']){_0x2a9df8[_0x34fe('0x44')]=[{'all':!![]}];}return db[_0x34fe('0x2f')][_0x34fe('0x45')](_0x2a9df8);})[_0x34fe('0x29')](function(_0x487b64){_0x5ac6d6[_0x34fe('0x46')]=_0x487b64;return _0x5ac6d6;})[_0x34fe('0x29')](respondWithFilteredResult(_0x52baff,_0x2a9df8))[_0x34fe('0x47')](handleError(_0x52baff,null));};exports[_0x34fe('0x48')]=function(_0x26cdd,_0x21483f){var _0x3cd47f={'raw':!![],'where':{'id':_0x26cdd[_0x34fe('0x49')]['id']}},_0x1c7c63={};_0x1c7c63[_0x34fe('0x34')]=_['keys'](db[_0x34fe('0x2f')][_0x34fe('0x30')]);_0x1c7c63['query']=_[_0x34fe('0x35')](_0x26cdd[_0x34fe('0x37')]);_0x1c7c63[_0x34fe('0x36')]=_[_0x34fe('0x39')](_0x1c7c63['model'],_0x1c7c63['query']);_0x3cd47f['attributes']=_[_0x34fe('0x39')](_0x1c7c63[_0x34fe('0x34')],qs['fields'](_0x26cdd[_0x34fe('0x37')][_0x34fe('0x3a')]));_0x3cd47f[_0x34fe('0x38')]=_0x3cd47f[_0x34fe('0x38')]['length']?_0x3cd47f[_0x34fe('0x38')]:_0x1c7c63['model'];if(_0x26cdd[_0x34fe('0x37')][_0x34fe('0x4a')]){_0x3cd47f[_0x34fe('0x44')]=[{'all':!![]}];}_0x3cd47f=_['merge']({},_0x3cd47f,_0x26cdd['options']);return db['ChatTransferReport'][_0x34fe('0x4b')](_0x3cd47f)['then'](handleEntityNotFound(_0x21483f,null))['then'](respondWithResult(_0x21483f,null))[_0x34fe('0x47')](handleError(_0x21483f,null));};exports['create']=function(_0x17ee0b,_0xfba0){return db['ChatTransferReport'][_0x34fe('0x4c')](_0x17ee0b[_0x34fe('0x4d')],{})[_0x34fe('0x29')](respondWithResult(_0xfba0,0xc9))[_0x34fe('0x47')](handleError(_0xfba0,null));};exports[_0x34fe('0x28')]=function(_0x59a002,_0x3435ec){if(_0x59a002[_0x34fe('0x4d')]['id']){delete _0x59a002[_0x34fe('0x4d')]['id'];}return db['ChatTransferReport'][_0x34fe('0x4b')]({'where':{'id':_0x59a002[_0x34fe('0x49')]['id']}})['then'](handleEntityNotFound(_0x3435ec,null))[_0x34fe('0x29')](saveUpdates(_0x59a002['body'],null))[_0x34fe('0x29')](respondWithResult(_0x3435ec,null))['catch'](handleError(_0x3435ec,null));};exports[_0x34fe('0x2a')]=function(_0x2a67e5,_0x522ac0){return db['ChatTransferReport'][_0x34fe('0x4b')]({'where':{'id':_0x2a67e5[_0x34fe('0x49')]['id']}})[_0x34fe('0x29')](handleEntityNotFound(_0x522ac0,null))[_0x34fe('0x29')](removeEntity(_0x522ac0,null))['catch'](handleError(_0x522ac0,null));};exports['describe']=function(_0x327c72,_0x163508){return db[_0x34fe('0x2f')][_0x34fe('0x4e')]()['then'](respondWithResult(_0x163508,null))['catch'](handleError(_0x163508,null));}; \ No newline at end of file +var _0x403c=['querystring','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','limit','count','offset','set','save','update','then','destroy','end','sendStatus','error','name','send','ChatTransferReport','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x422368,_0x3389f4){var _0x485915=function(_0x3be74e){while(--_0x3be74e){_0x422368['push'](_0x422368['shift']());}};_0x485915(++_0x3389f4);}(_0x403c,0x154));var _0xc403=function(_0x35db81,_0x1d47a7){_0x35db81=_0x35db81-0x0;var _0x1e4bfc=_0x403c[_0x35db81];return _0x1e4bfc;};'use strict';var emlformat=require(_0xc403('0x0'));var rimraf=require(_0xc403('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc403('0x2'));var rp=require(_0xc403('0x3'));var moment=require(_0xc403('0x4'));var BPromise=require(_0xc403('0x5'));var Mustache=require(_0xc403('0x6'));var util=require('util');var path=require(_0xc403('0x7'));var sox=require(_0xc403('0x8'));var csv=require('to-csv');var ejs=require(_0xc403('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc403('0xa'));var squel=require(_0xc403('0xb'));var crypto=require('crypto');var jsforce=require(_0xc403('0xc'));var deskjs=require(_0xc403('0xd'));var toCsv=require(_0xc403('0xe'));var querystring=require(_0xc403('0xf'));var Papa=require(_0xc403('0x10'));var Redis=require(_0xc403('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc403('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc403('0x13'));var utils=require(_0xc403('0x14'));var config=require(_0xc403('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc403('0x16'))['db'];function respondWithStatusCode(_0x4b6346,_0x44c502){_0x44c502=_0x44c502||0xcc;return function(_0x2f22cc){if(_0x2f22cc){return _0x4b6346['sendStatus'](_0x44c502);}return _0x4b6346[_0xc403('0x17')](_0x44c502)['end']();};}function respondWithResult(_0x47b964,_0x5ec669){_0x5ec669=_0x5ec669||0xc8;return function(_0x23d5c5){if(_0x23d5c5){return _0x47b964[_0xc403('0x17')](_0x5ec669)[_0xc403('0x18')](_0x23d5c5);}};}function respondWithFilteredResult(_0xcdb565,_0x17c838){return function(_0x1300b5){if(_0x1300b5){var _0x16396b=typeof _0x17c838['offset']===_0xc403('0x19')&&typeof _0x17c838[_0xc403('0x1a')]===_0xc403('0x19');var _0x2c8014=_0x1300b5[_0xc403('0x1b')];var _0x63bf1=_0x16396b?0x0:_0x17c838[_0xc403('0x1c')];var _0x4daac7=_0x16396b?_0x1300b5[_0xc403('0x1b')]:_0x17c838['offset']+_0x17c838[_0xc403('0x1a')];var _0x52e4a9;if(_0x4daac7>=_0x2c8014){_0x4daac7=_0x2c8014;_0x52e4a9=0xc8;}else{_0x52e4a9=0xce;}_0xcdb565[_0xc403('0x17')](_0x52e4a9);return _0xcdb565[_0xc403('0x1d')]('Content-Range',_0x63bf1+'-'+_0x4daac7+'/'+_0x2c8014)[_0xc403('0x18')](_0x1300b5);}return null;};}function patchUpdates(_0x2b6d31){return function(_0x3760ab){try{jsonpatch['apply'](_0x3760ab,_0x2b6d31,!![]);}catch(_0x54aa6f){return BPromise['reject'](_0x54aa6f);}return _0x3760ab[_0xc403('0x1e')]();};}function saveUpdates(_0xba171f,_0x1f2f9b){return function(_0x8be992){if(_0x8be992){return _0x8be992[_0xc403('0x1f')](_0xba171f)[_0xc403('0x20')](function(_0xdcde55){return _0xdcde55;});}return null;};}function removeEntity(_0x2fa4d5,_0x210112){return function(_0x2cb2ed){if(_0x2cb2ed){return _0x2cb2ed[_0xc403('0x21')]()[_0xc403('0x20')](function(){_0x2fa4d5[_0xc403('0x17')](0xcc)[_0xc403('0x22')]();});}};}function handleEntityNotFound(_0x2193d3,_0x4dc51b){return function(_0x3feb62){if(!_0x3feb62){_0x2193d3[_0xc403('0x23')](0x194);}return _0x3feb62;};}function handleError(_0x1c531d,_0x2f6ab3){_0x2f6ab3=_0x2f6ab3||0x1f4;return function(_0x3eb0f4){logger[_0xc403('0x24')](_0x3eb0f4['stack']);if(_0x3eb0f4[_0xc403('0x25')]){delete _0x3eb0f4[_0xc403('0x25')];}_0x1c531d[_0xc403('0x17')](_0x2f6ab3)[_0xc403('0x26')](_0x3eb0f4);};}exports['index']=function(_0x266b21,_0x59c875){var _0x5e31c1={},_0x4e76d3={},_0x1b8bf0={'count':0x0,'rows':[]};var _0x2ef882=_['map'](db[_0xc403('0x27')]['rawAttributes'],function(_0x103739){return{'name':_0x103739[_0xc403('0x28')],'type':_0x103739[_0xc403('0x29')][_0xc403('0x2a')]};});_0x4e76d3['model']=_[_0xc403('0x2b')](_0x2ef882,_0xc403('0x25'));_0x4e76d3[_0xc403('0x2c')]=_[_0xc403('0x2d')](_0x266b21[_0xc403('0x2c')]);_0x4e76d3['filters']=_[_0xc403('0x2e')](_0x4e76d3['model'],_0x4e76d3[_0xc403('0x2c')]);_0x5e31c1['attributes']=_['intersection'](_0x4e76d3[_0xc403('0x2f')],qs['fields'](_0x266b21[_0xc403('0x2c')][_0xc403('0x30')]));_0x5e31c1[_0xc403('0x31')]=_0x5e31c1[_0xc403('0x31')][_0xc403('0x32')]?_0x5e31c1[_0xc403('0x31')]:_0x4e76d3[_0xc403('0x2f')];if(!_0x266b21['query'][_0xc403('0x33')]('nolimit')){_0x5e31c1['limit']=qs[_0xc403('0x1a')](_0x266b21['query'][_0xc403('0x1a')]);_0x5e31c1[_0xc403('0x1c')]=qs[_0xc403('0x1c')](_0x266b21['query'][_0xc403('0x1c')]);}_0x5e31c1[_0xc403('0x34')]=qs[_0xc403('0x35')](_0x266b21[_0xc403('0x2c')][_0xc403('0x35')]);_0x5e31c1[_0xc403('0x36')]=qs[_0xc403('0x37')](_['pick'](_0x266b21[_0xc403('0x2c')],_0x4e76d3[_0xc403('0x37')]),_0x2ef882);if(_0x266b21['query'][_0xc403('0x38')]){_0x5e31c1[_0xc403('0x36')]=_[_0xc403('0x39')](_0x5e31c1[_0xc403('0x36')],{'$or':_[_0xc403('0x2b')](_0x2ef882,function(_0xd46381){if(_0xd46381[_0xc403('0x29')]!==_0xc403('0x3a')){var _0x3d2694={};_0x3d2694[_0xd46381[_0xc403('0x25')]]={'$like':'%'+_0x266b21[_0xc403('0x2c')][_0xc403('0x38')]+'%'};return _0x3d2694;}})});}_0x5e31c1=_[_0xc403('0x39')]({},_0x5e31c1,_0x266b21[_0xc403('0x3b')]);var _0x4300ba={'where':_0x5e31c1[_0xc403('0x36')]};return db['ChatTransferReport'][_0xc403('0x1b')](_0x4300ba)[_0xc403('0x20')](function(_0x495a65){_0x1b8bf0[_0xc403('0x1b')]=_0x495a65;if(_0x266b21[_0xc403('0x2c')][_0xc403('0x3c')]){_0x5e31c1[_0xc403('0x3d')]=[{'all':!![]}];}return db[_0xc403('0x27')][_0xc403('0x3e')](_0x5e31c1);})[_0xc403('0x20')](function(_0x46e831){_0x1b8bf0[_0xc403('0x3f')]=_0x46e831;return _0x1b8bf0;})[_0xc403('0x20')](respondWithFilteredResult(_0x59c875,_0x5e31c1))[_0xc403('0x40')](handleError(_0x59c875,null));};exports[_0xc403('0x41')]=function(_0x396a15,_0x520ebb){var _0x112f56={'raw':!![],'where':{'id':_0x396a15[_0xc403('0x42')]['id']}},_0x107d58={};_0x107d58[_0xc403('0x2f')]=_[_0xc403('0x2d')](db[_0xc403('0x27')][_0xc403('0x43')]);_0x107d58['query']=_[_0xc403('0x2d')](_0x396a15['query']);_0x107d58[_0xc403('0x37')]=_['intersection'](_0x107d58['model'],_0x107d58[_0xc403('0x2c')]);_0x112f56[_0xc403('0x31')]=_[_0xc403('0x2e')](_0x107d58[_0xc403('0x2f')],qs[_0xc403('0x30')](_0x396a15['query'][_0xc403('0x30')]));_0x112f56['attributes']=_0x112f56[_0xc403('0x31')][_0xc403('0x32')]?_0x112f56[_0xc403('0x31')]:_0x107d58[_0xc403('0x2f')];if(_0x396a15[_0xc403('0x2c')][_0xc403('0x3c')]){_0x112f56['include']=[{'all':!![]}];}_0x112f56=_[_0xc403('0x39')]({},_0x112f56,_0x396a15[_0xc403('0x3b')]);return db[_0xc403('0x27')]['find'](_0x112f56)[_0xc403('0x20')](handleEntityNotFound(_0x520ebb,null))[_0xc403('0x20')](respondWithResult(_0x520ebb,null))['catch'](handleError(_0x520ebb,null));};exports['create']=function(_0x2da9b2,_0x54f0df){return db['ChatTransferReport'][_0xc403('0x44')](_0x2da9b2[_0xc403('0x45')],{})[_0xc403('0x20')](respondWithResult(_0x54f0df,0xc9))['catch'](handleError(_0x54f0df,null));};exports[_0xc403('0x1f')]=function(_0x29f9f8,_0x377b2c){if(_0x29f9f8[_0xc403('0x45')]['id']){delete _0x29f9f8['body']['id'];}return db[_0xc403('0x27')]['find']({'where':{'id':_0x29f9f8[_0xc403('0x42')]['id']}})['then'](handleEntityNotFound(_0x377b2c,null))[_0xc403('0x20')](saveUpdates(_0x29f9f8[_0xc403('0x45')],null))[_0xc403('0x20')](respondWithResult(_0x377b2c,null))['catch'](handleError(_0x377b2c,null));};exports[_0xc403('0x21')]=function(_0x21002a,_0x27863d){return db[_0xc403('0x27')]['find']({'where':{'id':_0x21002a[_0xc403('0x42')]['id']}})[_0xc403('0x20')](handleEntityNotFound(_0x27863d,null))['then'](removeEntity(_0x27863d,null))[_0xc403('0x40')](handleError(_0x27863d,null));};exports[_0xc403('0x46')]=function(_0x123b12,_0x4fec0e){return db[_0xc403('0x27')][_0xc403('0x46')]()[_0xc403('0x20')](respondWithResult(_0x4fec0e,null))['catch'](handleError(_0x4fec0e,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 8f78afa..e9b6877 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 _0xdfd4=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','lodash'];(function(_0x1b5e0b,_0x5076dc){var _0x5bff09=function(_0x33532e){while(--_0x33532e){_0x1b5e0b['push'](_0x1b5e0b['shift']());}};_0x5bff09(++_0x5076dc);}(_0xdfd4,0x1c6));var _0x4dfd=function(_0x2c972c,_0x2e7314){_0x2c972c=_0x2c972c-0x0;var _0x14e1b2=_0xdfd4[_0x2c972c];return _0x14e1b2;};'use strict';var _=require(_0x4dfd('0x0'));var util=require(_0x4dfd('0x1'));var logger=require(_0x4dfd('0x2'))('api');var moment=require(_0x4dfd('0x3'));var BPromise=require(_0x4dfd('0x4'));var rp=require(_0x4dfd('0x5'));var fs=require('fs');var path=require(_0x4dfd('0x6'));var rimraf=require(_0x4dfd('0x7'));var config=require(_0x4dfd('0x8'));var attributes=require(_0x4dfd('0x9'));module[_0x4dfd('0xa')]=function(_0x566144,_0x3abe0d){return _0x566144['define'](_0x4dfd('0xb'),attributes,{'tableName':_0x4dfd('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8cd0=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x29c896,_0x1084c3){var _0x2c654c=function(_0x54023e){while(--_0x54023e){_0x29c896['push'](_0x29c896['shift']());}};_0x2c654c(++_0x1084c3);}(_0x8cd0,0x8a));var _0x08cd=function(_0x4983c6,_0x4de316){_0x4983c6=_0x4983c6-0x0;var _0x526182=_0x8cd0[_0x4983c6];return _0x526182;};'use strict';var _=require(_0x08cd('0x0'));var util=require(_0x08cd('0x1'));var logger=require(_0x08cd('0x2'))(_0x08cd('0x3'));var moment=require(_0x08cd('0x4'));var BPromise=require(_0x08cd('0x5'));var rp=require(_0x08cd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x08cd('0x7'));var config=require(_0x08cd('0x8'));var attributes=require(_0x08cd('0x9'));module[_0x08cd('0xa')]=function(_0x44c49a,_0x263125){return _0x44c49a[_0x08cd('0xb')](_0x08cd('0xc'),attributes,{'tableName':_0x08cd('0xd'),'paranoid':![],'indexes':[{'name':_0x08cd('0xe'),'fields':[_0x08cd('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index dcc13a2..df571ba 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 _0xdd9e=['ChatTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x12b683,_0x124186){var _0xfb150b=function(_0x565ce7){while(--_0x565ce7){_0x12b683['push'](_0x12b683['shift']());}};_0xfb150b(++_0x124186);}(_0xdd9e,0xd2));var _0xedd9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdd9e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xedd9('0x0'));var moment=require(_0xedd9('0x1'));var BPromise=require(_0xedd9('0x2'));var rs=require(_0xedd9('0x3'));var fs=require('fs');var Redis=require(_0xedd9('0x4'));var db=require(_0xedd9('0x5'))['db'];var utils=require(_0xedd9('0x6'));var logger=require(_0xedd9('0x7'))(_0xedd9('0x8'));var config=require(_0xedd9('0x9'));var jayson=require(_0xedd9('0xa'));var client=jayson[_0xedd9('0xb')][_0xedd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3601ed,_0xbf0ffa,_0x18ad2e){return new BPromise(function(_0x245122,_0x293a1e){return client[_0xedd9('0xd')](_0x3601ed,_0x18ad2e)[_0xedd9('0xe')](function(_0x33b07a){logger[_0xedd9('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0xbf0ffa,'request\x20sent');logger[_0xedd9('0x10')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0xbf0ffa,_0xedd9('0x11'),JSON[_0xedd9('0x12')](_0x33b07a));if(_0x33b07a[_0xedd9('0x13')]){if(_0x33b07a[_0xedd9('0x13')]['code']===0x1f4){logger[_0xedd9('0x13')](_0xedd9('0x14'),_0xbf0ffa,_0x33b07a[_0xedd9('0x13')]['message']);return _0x293a1e(_0x33b07a[_0xedd9('0x13')]['message']);}logger[_0xedd9('0x13')](_0xedd9('0x14'),_0xbf0ffa,_0x33b07a['error'][_0xedd9('0x15')]);return _0x245122(_0x33b07a['error']['message']);}else{logger[_0xedd9('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0xbf0ffa,_0xedd9('0x11'));_0x245122(_0x33b07a['result']['message']);}})[_0xedd9('0x16')](function(_0x8eae34){logger[_0xedd9('0x13')](_0xedd9('0x14'),_0xbf0ffa,_0x8eae34);_0x293a1e(_0x8eae34);});});} \ No newline at end of file +var _0x0d01=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x806894,_0x1a62d7){var _0x5db622=function(_0x1ba7ac){while(--_0x1ba7ac){_0x806894['push'](_0x806894['shift']());}};_0x5db622(++_0x1a62d7);}(_0x0d01,0x9f));var _0x10d0=function(_0x2f4feb,_0x5e7224){_0x2f4feb=_0x2f4feb-0x0;var _0x2e4253=_0x0d01[_0x2f4feb];return _0x2e4253;};'use strict';var _=require(_0x10d0('0x0'));var util=require(_0x10d0('0x1'));var moment=require(_0x10d0('0x2'));var BPromise=require(_0x10d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10d0('0x4'));var db=require(_0x10d0('0x5'))['db'];var utils=require(_0x10d0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x10d0('0x7'));var jayson=require(_0x10d0('0x8'));var client=jayson['client'][_0x10d0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c6343,_0x3ac141,_0x8bed1){return new BPromise(function(_0x303b53,_0x4b9dbb){return client[_0x10d0('0xa')](_0x3c6343,_0x8bed1)['then'](function(_0x9f6b65){logger[_0x10d0('0xb')](_0x10d0('0xc'),_0x3ac141,_0x10d0('0xd'));logger['debug'](_0x10d0('0xe'),_0x3ac141,_0x10d0('0xd'),JSON['stringify'](_0x9f6b65));if(_0x9f6b65[_0x10d0('0xf')]){if(_0x9f6b65['error'][_0x10d0('0x10')]===0x1f4){logger[_0x10d0('0xf')](_0x10d0('0xc'),_0x3ac141,_0x9f6b65[_0x10d0('0xf')][_0x10d0('0x11')]);return _0x4b9dbb(_0x9f6b65['error'][_0x10d0('0x11')]);}logger['error'](_0x10d0('0xc'),_0x3ac141,_0x9f6b65[_0x10d0('0xf')][_0x10d0('0x11')]);return _0x303b53(_0x9f6b65[_0x10d0('0xf')][_0x10d0('0x11')]);}else{logger[_0x10d0('0xb')](_0x10d0('0xc'),_0x3ac141,_0x10d0('0xd'));_0x303b53(_0x9f6b65[_0x10d0('0x12')]['message']);}})[_0x10d0('0x13')](function(_0x287b33){logger[_0x10d0('0xf')](_0x10d0('0xc'),_0x3ac141,_0x287b33);_0x4b9dbb(_0x287b33);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 41acbe9..972b4de 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 _0x4c86=['isAuthenticated','show','post','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','/describe','/:id'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x4c86,0x1f4));var _0x64c8=function(_0x200c3e,_0x51daa3){_0x200c3e=_0x200c3e-0x0;var _0x2e2024=_0x4c86[_0x200c3e];return _0x2e2024;};'use strict';var multer=require('multer');var util=require(_0x64c8('0x0'));var path=require(_0x64c8('0x1'));var timeout=require(_0x64c8('0x2'));var express=require(_0x64c8('0x3'));var router=express[_0x64c8('0x4')]();var fs_extra=require(_0x64c8('0x5'));var auth=require(_0x64c8('0x6'));var interaction=require(_0x64c8('0x7'));var config=require(_0x64c8('0x8'));var controller=require(_0x64c8('0x9'));router[_0x64c8('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x64c8('0xa')](_0x64c8('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x64c8('0xc'),auth[_0x64c8('0xd')](),controller[_0x64c8('0xe')]);router[_0x64c8('0xf')]('/',auth[_0x64c8('0xd')](),controller['create']);router[_0x64c8('0x10')]('/:id',auth[_0x64c8('0xd')](),controller[_0x64c8('0x11')]);router['delete'](_0x64c8('0xc'),auth['isAuthenticated'](),controller[_0x64c8('0x12')]);module['exports']=router; \ No newline at end of file +var _0xbba0=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./chatTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','update','delete','destroy'];(function(_0x564e8c,_0x43d143){var _0x3e7ac0=function(_0x2ceb53){while(--_0x2ceb53){_0x564e8c['push'](_0x564e8c['shift']());}};_0x3e7ac0(++_0x43d143);}(_0xbba0,0x1b9));var _0x0bba=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xbba0[_0x36eaaa];return _0x461349;};'use strict';var multer=require(_0x0bba('0x0'));var util=require(_0x0bba('0x1'));var path=require(_0x0bba('0x2'));var timeout=require(_0x0bba('0x3'));var express=require(_0x0bba('0x4'));var router=express[_0x0bba('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0bba('0x6'));var config=require('../../config/environment');var controller=require(_0x0bba('0x7'));router['get']('/',auth[_0x0bba('0x8')](),controller[_0x0bba('0x9')]);router[_0x0bba('0xa')](_0x0bba('0xb'),auth[_0x0bba('0x8')](),controller['describe']);router[_0x0bba('0xa')](_0x0bba('0xc'),auth[_0x0bba('0x8')](),controller[_0x0bba('0xd')]);router['post']('/',auth[_0x0bba('0x8')](),controller[_0x0bba('0xe')]);router[_0x0bba('0xf')](_0x0bba('0xc'),auth['isAuthenticated'](),controller[_0x0bba('0x10')]);router[_0x0bba('0x11')](_0x0bba('0xc'),auth[_0x0bba('0x8')](),controller[_0x0bba('0x12')]);module[_0x0bba('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 789be21..e1619b1 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 _0x13d5=['Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','name','text','input','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message'];(function(_0x5a8eee,_0x839e0f){var _0x55f00a=function(_0x198fdd){while(--_0x198fdd){_0x5a8eee['push'](_0x5a8eee['shift']());}};_0x55f00a(++_0x839e0f);}(_0x13d5,0x19c));var _0x513d=function(_0x5184ce,_0x2e4489){_0x5184ce=_0x5184ce-0x0;var _0x4e253a=_0x13d5[_0x5184ce];return _0x4e253a;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x513d('0x0'));module['exports']={'name':{'type':Sequelize[_0x513d('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0x513d('0x1')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x513d('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x513d('0x2')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x513d('0x2')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x3')},'customerAlias':{'type':Sequelize[_0x513d('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x513d('0x4'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x513d('0x4'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x513d('0x1')],'allowNull':![],'defaultValue':_0x513d('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x513d('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x513d('0x1')]},'animation':{'type':Sequelize[_0x513d('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x513d('0x8')](_0x513d('0x9'),'squared'),'defaultValue':_0x513d('0x9')},'header_online':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0xa')},'start_chat_button':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0xb')},'offline_chat_button':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0xc')},'header_offline':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0xd')},'download_transcript':{'type':Sequelize[_0x513d('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x513d('0x6')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0x513d('0xe')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x513d('0xf')]},'closingQuestion':{'type':Sequelize[_0x513d('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0x513d('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x11')},'noteTitle':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x12')},'placeholderMessage':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x13')},'closingMessage':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x14')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x15')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x513d('0x16')},'ratingType':{'type':Sequelize[_0x513d('0x8')](_0x513d('0x17'),_0x513d('0x18')),'defaultValue':_0x513d('0x17')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x513d('0xf')],'defaultValue':function(){return JSON[_0x513d('0x19')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x513d('0x1a'),'type':_0x513d('0x1b'),'required':!![]},'props':{'title':_0x513d('0x1a'),'helpText':''}},{'type':_0x513d('0x1c'),'props':{'title':_0x513d('0x2'),'helpText':''},'config':{'required':!![],'placeholder':_0x513d('0x2'),'type':_0x513d('0x2')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x513d('0x1d')](_0x513d('0x1e'))?JSON['parse'](this[_0x513d('0x1d')](_0x513d('0x1e'))):{};},'set':function(_0x1b7f2a){return this[_0x513d('0x1f')](_0x513d('0x1e'),JSON[_0x513d('0x19')](_0x1b7f2a));}},'offlineForm':{'type':Sequelize[_0x513d('0xf')],'defaultValue':function(){return JSON[_0x513d('0x19')]({'items':[{'type':_0x513d('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x513d('0x2'),'type':_0x513d('0x2')},'variable':null},{'type':_0x513d('0x20'),'config':{'placeholder':_0x513d('0x21')},'props':{'title':_0x513d('0x21'),'helpText':_0x513d('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x513d('0x1d')]('offlineForm')?JSON['parse'](this[_0x513d('0x1d')](_0x513d('0x23'))):{};},'set':function(_0x340785){return this[_0x513d('0x1f')]('offlineForm',JSON[_0x513d('0x19')](_0x340785));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x513d('0x24')]();}},'autoclose':{'type':Sequelize[_0x513d('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x513d('0x1')]},'forwardOffline':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x513d('0x1')]},'waitingTitle':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x25')},'waitingMessage':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x26')},'offlineMessageSubject':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x27')},'offlineMessageBody':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0x513d('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x513d('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x513d('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x513d('0x1')]},'notificationTemplate':{'type':Sequelize[_0x513d('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x513d('0x1')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0x513d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x29')},'verticalAlignment':{'type':Sequelize[_0x513d('0x6')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x2a')},'defaultTitle':{'type':Sequelize[_0x513d('0x1')]},'customerAvatar':{'type':Sequelize[_0x513d('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x513d('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x513d('0x1')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x513d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x513d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x513d('0x1')],'defaultValue':_0x513d('0x2b')},'systemAvatar':{'type':Sequelize[_0x513d('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x513d('0x6')],'comment':_0x513d('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x230d96){if(!_0x230d96)this[_0x513d('0x1f')](_0x513d('0x2d'),null);this[_0x513d('0x1f')](_0x513d('0x2e'),_0x230d96);}},'vidaooEscalation':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x513d('0x1')],'allowNull':![],'defaultValue':_0x513d('0x2f')},'vidaooNote':{'type':Sequelize[_0x513d('0x1')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x513d('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xecf3=['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','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','getDataValue','onlineForm','setDataValue','textarea','Comments','offlineForm'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xecf3,0x6f));var _0x3ecf=function(_0x2604d8,_0x445628){_0x2604d8=_0x2604d8-0x0;var _0x54e7c8=_0xecf3[_0x2604d8];return _0x54e7c8;};'use strict';var Sequelize=require(_0x3ecf('0x0'));var rs=require(_0x3ecf('0x1'));module[_0x3ecf('0x2')]={'name':{'type':Sequelize[_0x3ecf('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3ecf('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x5')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0x5')},'key':{'type':Sequelize[_0x3ecf('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x3ecf('0x3')],'allowNull':![],'defaultValue':_0x3ecf('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x3ecf('0x3')],'allowNull':![],'defaultValue':_0x3ecf('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x3ecf('0x3')],'allowNull':![],'defaultValue':_0x3ecf('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x3ecf('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x3ecf('0x3')]},'animation':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x3ecf('0xa')]('rounded','squared'),'defaultValue':_0x3ecf('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0xc')},'start_chat_button':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0xd')},'offline_chat_button':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0xe')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0xf')},'download_transcript':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x3ecf('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x3ecf('0x11')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0x14')},'placeholderMessage':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x15')},'closingMessage':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x16')},'closingMessageButton':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0xe')},'skipMessageButton':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x17')},'conditionAgreement':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x18')},'ratingType':{'type':Sequelize[_0x3ecf('0xa')](_0x3ecf('0x19'),_0x3ecf('0x1a')),'defaultValue':_0x3ecf('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x3ecf('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x3ecf('0x11')],'defaultValue':function(){return JSON[_0x3ecf('0x1b')]({'items':[{'type':_0x3ecf('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0x3ecf('0x1d'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x3ecf('0x1c'),'props':{'title':_0x3ecf('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x3ecf('0x5'),'type':_0x3ecf('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x3ecf('0x1e')](_0x3ecf('0x1f'))?JSON['parse'](this['getDataValue']('onlineForm')):{};},'set':function(_0x43826c){return this[_0x3ecf('0x20')]('onlineForm',JSON[_0x3ecf('0x1b')](_0x43826c));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x3ecf('0x1b')]({'items':[{'type':_0x3ecf('0x1c'),'props':{'title':_0x3ecf('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x3ecf('0x5')},'variable':null},{'type':_0x3ecf('0x21'),'config':{'placeholder':_0x3ecf('0x22')},'props':{'title':_0x3ecf('0x22'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x3ecf('0x1e')](_0x3ecf('0x23'))?JSON['parse'](this[_0x3ecf('0x1e')](_0x3ecf('0x23'))):{};},'set':function(_0x466813){return this[_0x3ecf('0x20')](_0x3ecf('0x23'),JSON[_0x3ecf('0x1b')](_0x466813));}},'token':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x3ecf('0x3')]},'forwardOffline':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x3ecf('0x3')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0x24')},'waitingMessage':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0x26')},'offlineMessageBody':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x27')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x3ecf('0x17')},'sendUnmanaged':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x3ecf('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x3ecf('0x11')],'defaultValue':function(){return _0x3ecf('0x28');}},'notificationSound':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x3ecf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x2a')},'verticalAlignment':{'type':Sequelize[_0x3ecf('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x2b')},'defaultTitle':{'type':Sequelize[_0x3ecf('0x3')]},'customerAvatar':{'type':Sequelize[_0x3ecf('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x3ecf('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x3ecf('0x3')],'allowNull':![],'defaultValue':_0x3ecf('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3ecf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3ecf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x3ecf('0x3')],'defaultValue':_0x3ecf('0x2d')},'systemAvatar':{'type':Sequelize[_0x3ecf('0x11')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3ecf('0x8')],'comment':_0x3ecf('0x2e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x29287f){if(!_0x29287f)this[_0x3ecf('0x20')]('mandatoryDispositionPauseId',null);this[_0x3ecf('0x20')](_0x3ecf('0x2f'),_0x29287f);}},'vidaooEscalation':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x3ecf('0x3')]},'vidaooTopic':{'type':Sequelize[_0x3ecf('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x3ecf('0x30');}},'vidaooMetadata':{'type':Sequelize[_0x3ecf('0x11')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x3ecf('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x3ecf('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 5676162..5b33bbd 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 _0x29a0=['user-agent','getResult','chat','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','DESC','ChatApplication','Applications','account','list','applications','priority','asc','from','contact','customerIp','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ContactId','interaction','ChatInteraction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','basename','sequelize','Attachment','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','service','host','port','secure','authentication','pass','sendMail','\x22%s\x22\x20<%s>','email','openNewInteraction','MailAccountId','mimetype','subjectOffline','toPairsIn','offlineMessageSubject','offline-chat','addInteraction','omit','getInteractions','nolimit','fullname','internal','Tag','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','inspect','Interval','Intervals','virtual','custom','License','increment','all','some','remote','x-real-ip','remoteAddress','replace','render','alignment','textColor','color_button','backgroundColor','addApplications','transaction','getApplications','getProactiveActions','ChatProactiveAction','false','offlineForm','items','fromKey','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','destroy','then','get','ChatWebsites','end','sendStatus','name','send','map','ChatWebsite','rawAttributes','type','key','model','query','filters','intersection','attributes','length','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','Pause','mandatoryDispositionPause','keys','fields','create','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','hasOwnProperty','sort','removeDispositions','ids','addAnswer','CannedAnswer','findOne','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','sitepic','getLicense','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers'];(function(_0x2bd1ac,_0x113d5f){var _0x216cf2=function(_0x5395fc){while(--_0x5395fc){_0x2bd1ac['push'](_0x2bd1ac['shift']());}};_0x216cf2(++_0x113d5f);}(_0x29a0,0x9d));var _0x029a=function(_0x9b2115,_0x193abf){_0x9b2115=_0x9b2115-0x0;var _0x28d5bf=_0x29a0[_0x9b2115];return _0x28d5bf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x029a('0x0'));var jsonpatch=require(_0x029a('0x1'));var rp=require(_0x029a('0x2'));var moment=require(_0x029a('0x3'));var BPromise=require(_0x029a('0x4'));var Mustache=require(_0x029a('0x5'));var util=require(_0x029a('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x029a('0x7'));var ejs=require(_0x029a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x029a('0x9'));var squel=require(_0x029a('0xa'));var crypto=require('crypto');var jsforce=require(_0x029a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x029a('0x7'));var querystring=require(_0x029a('0xc'));var Papa=require(_0x029a('0xd'));var Redis=require(_0x029a('0xe'));var authService=require(_0x029a('0xf'));var qs=require(_0x029a('0x10'));var as=require(_0x029a('0x11'));var hardwareService=require(_0x029a('0x12'));var logger=require(_0x029a('0x13'))('api');var utils=require(_0x029a('0x14'));var config=require(_0x029a('0x15'));var licenseUtil=require(_0x029a('0x16'));var db=require(_0x029a('0x17'))['db'];config['redis']=_[_0x029a('0x18')](config[_0x029a('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x029a('0x1a'))(new Redis(config[_0x029a('0x19')]));require(_0x029a('0x1b'))[_0x029a('0x1c')](socket);var jayson=require(_0x029a('0x1d'));var client=jayson[_0x029a('0x1e')][_0x029a('0x1f')]({'port':0x232c});var client9002=jayson[_0x029a('0x1e')][_0x029a('0x1f')]({'port':0x232a});var client9003=jayson[_0x029a('0x1e')][_0x029a('0x1f')]({'port':0x232b});var client9001=jayson[_0x029a('0x1e')][_0x029a('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x1a0ca7,_0x1cb2f9,_0x31f76e,_0x127b97){return new BPromise(function(_0x294195,_0x3434ee){var _0x48053f=_0x127b97||client;return _0x48053f[_0x029a('0x20')](_0x1a0ca7,_0x31f76e)['then'](function(_0x35ded7){logger['info'](_0x029a('0x21'),_0x1cb2f9,_0x029a('0x22'));logger[_0x029a('0x23')](_0x029a('0x24'),_0x1cb2f9,'request\x20sent',JSON[_0x029a('0x25')](_0x35ded7));if(_0x35ded7[_0x029a('0x26')]){if(_0x35ded7[_0x029a('0x26')][_0x029a('0x27')]===0x1f4){logger[_0x029a('0x26')](_0x029a('0x21'),_0x1cb2f9,_0x35ded7[_0x029a('0x26')][_0x029a('0x28')]);return _0x3434ee(_0x35ded7['error'][_0x029a('0x28')]);}logger[_0x029a('0x26')](_0x029a('0x21'),_0x1cb2f9,_0x35ded7['error'][_0x029a('0x28')]);return _0x294195(_0x35ded7[_0x029a('0x26')][_0x029a('0x28')]);}else{logger[_0x029a('0x29')](_0x029a('0x21'),_0x1cb2f9,_0x029a('0x22'));_0x294195(_0x35ded7[_0x029a('0x2a')][_0x029a('0x28')]);}})[_0x029a('0x2b')](function(_0x617b95){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1cb2f9,_0x617b95);_0x3434ee(_0x617b95);});});}function respondWithStatusCode(_0x42599f,_0x13c187){_0x13c187=_0x13c187||0xcc;return function(_0x256444){if(_0x256444){return _0x42599f['sendStatus'](_0x13c187);}return _0x42599f[_0x029a('0x2c')](_0x13c187)['end']();};}function respondWithResult(_0x480fbb,_0x35fa57){_0x35fa57=_0x35fa57||0xc8;return function(_0x55a64c){if(_0x55a64c){return _0x480fbb[_0x029a('0x2c')](_0x35fa57)['json'](_0x55a64c);}};}function respondWithFilteredResult(_0x248a52,_0x296593){return function(_0x2cfbe5){if(_0x2cfbe5){var _0x9055ea=typeof _0x296593['offset']===_0x029a('0x2d')&&typeof _0x296593[_0x029a('0x2e')]===_0x029a('0x2d');var _0x2a45f9=_0x2cfbe5[_0x029a('0x2f')];var _0x1ca9d4=_0x9055ea?0x0:_0x296593[_0x029a('0x30')];var _0x178b2c=_0x9055ea?_0x2cfbe5[_0x029a('0x2f')]:_0x296593[_0x029a('0x30')]+_0x296593[_0x029a('0x2e')];var _0x9d6150;if(_0x178b2c>=_0x2a45f9){_0x178b2c=_0x2a45f9;_0x9d6150=0xc8;}else{_0x9d6150=0xce;}_0x248a52[_0x029a('0x2c')](_0x9d6150);return _0x248a52['set'](_0x029a('0x31'),_0x1ca9d4+'-'+_0x178b2c+'/'+_0x2a45f9)[_0x029a('0x32')](_0x2cfbe5);}return null;};}function patchUpdates(_0x1dec33){return function(_0x40b42d){try{jsonpatch['apply'](_0x40b42d,_0x1dec33,!![]);}catch(_0x562a59){return BPromise[_0x029a('0x33')](_0x562a59);}return _0x40b42d[_0x029a('0x34')]();};}function saveUpdates(_0x1858be,_0x44ba5d){return function(_0xe48509){if(_0xe48509){return _0xe48509[_0x029a('0x35')](_0x1858be)['then'](function(_0x323bb9){return _0x323bb9;});}return null;};}function removeEntity(_0x161ec0,_0x2c2059){return function(_0x5106d3){if(_0x5106d3){return _0x5106d3[_0x029a('0x36')]()[_0x029a('0x37')](function(){var _0x1eeca7=_0x5106d3[_0x029a('0x38')]({'plain':!![]});var _0x3068f5=_0x029a('0x39');return db['UserProfileResource'][_0x029a('0x36')]({'where':{'type':_0x3068f5,'resourceId':_0x1eeca7['id']}})[_0x029a('0x37')](function(){return _0x5106d3;});})[_0x029a('0x37')](function(){_0x161ec0['status'](0xcc)[_0x029a('0x3a')]();});}};}function handleEntityNotFound(_0x77d9af,_0x4dae5b){return function(_0x12afda){if(!_0x12afda){_0x77d9af[_0x029a('0x3b')](0x194);}return _0x12afda;};}function handleError(_0x23b167,_0x4a5a49){_0x4a5a49=_0x4a5a49||0x1f4;return function(_0x596727){logger[_0x029a('0x26')](_0x596727['stack']);if(_0x596727[_0x029a('0x3c')]){delete _0x596727['name'];}_0x23b167[_0x029a('0x2c')](_0x4a5a49)[_0x029a('0x3d')](_0x596727);};}exports['index']=function(_0x2a71c9,_0x5ca675){var _0x4d5b17={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5b4430={},_0x2637ab={'count':0x0,'rows':[]};var _0x27736c=_[_0x029a('0x3e')](db[_0x029a('0x3f')][_0x029a('0x40')],function(_0x146f0c){return{'name':_0x146f0c['fieldName'],'type':_0x146f0c[_0x029a('0x41')][_0x029a('0x42')]};});_0x5b4430[_0x029a('0x43')]=_[_0x029a('0x3e')](_0x27736c,_0x029a('0x3c'));_0x5b4430[_0x029a('0x44')]=_['keys'](_0x2a71c9['query']);_0x5b4430[_0x029a('0x45')]=_[_0x029a('0x46')](_0x5b4430['model'],_0x5b4430[_0x029a('0x44')]);_0x4d5b17['attributes']=_[_0x029a('0x46')](_0x5b4430['model'],qs['fields'](_0x2a71c9[_0x029a('0x44')]['fields']));_0x4d5b17[_0x029a('0x47')]=_0x4d5b17[_0x029a('0x47')][_0x029a('0x48')]?_0x4d5b17[_0x029a('0x47')]:_0x5b4430[_0x029a('0x43')];if(!_0x2a71c9['query']['hasOwnProperty']('nolimit')){_0x4d5b17['limit']=qs[_0x029a('0x2e')](_0x2a71c9['query']['limit']);_0x4d5b17['offset']=qs['offset'](_0x2a71c9[_0x029a('0x44')][_0x029a('0x30')]);}_0x4d5b17[_0x029a('0x49')]=qs['sort'](_0x2a71c9[_0x029a('0x44')]['sort']);_0x4d5b17['where']=qs[_0x029a('0x45')](_[_0x029a('0x4a')](_0x2a71c9['query'],_0x5b4430[_0x029a('0x45')]),_0x27736c);if(_0x2a71c9[_0x029a('0x44')][_0x029a('0x4b')]){_0x4d5b17[_0x029a('0x4c')]=_[_0x029a('0x4d')](_0x4d5b17[_0x029a('0x4c')],{'$or':_[_0x029a('0x3e')](_0x27736c,function(_0x8ebfd5){if(_0x8ebfd5['type']!==_0x029a('0x4e')){var _0x2f3af1={};_0x2f3af1[_0x8ebfd5[_0x029a('0x3c')]]={'$like':'%'+_0x2a71c9[_0x029a('0x44')][_0x029a('0x4b')]+'%'};return _0x2f3af1;}})});}_0x4d5b17=_['merge']({},_0x4d5b17,_0x2a71c9[_0x029a('0x4f')]);var _0xd64332={'where':_0x4d5b17[_0x029a('0x4c')]};return db[_0x029a('0x3f')][_0x029a('0x2f')](_0xd64332)[_0x029a('0x37')](function(_0x29a883){_0x2637ab['count']=_0x29a883;if(_0x2a71c9['query'][_0x029a('0x50')]){_0x4d5b17[_0x029a('0x51')]=[{'all':!![]}];}return db[_0x029a('0x3f')][_0x029a('0x52')](_0x4d5b17);})[_0x029a('0x37')](function(_0x56c001){_0x2637ab[_0x029a('0x53')]=_0x56c001;return _0x2637ab;})[_0x029a('0x37')](respondWithFilteredResult(_0x5ca675,_0x4d5b17))[_0x029a('0x2b')](handleError(_0x5ca675,null));};exports[_0x029a('0x54')]=function(_0x58f982,_0x14f53c){var _0x385d39={'raw':![],'where':{'id':_0x58f982['params']['id']},'include':[{'model':db[_0x029a('0x55')],'as':_0x029a('0x56')}]},_0x16a50c={};_0x16a50c[_0x029a('0x43')]=_['keys'](db[_0x029a('0x3f')][_0x029a('0x40')]);_0x16a50c[_0x029a('0x44')]=_[_0x029a('0x57')](_0x58f982['query']);_0x16a50c[_0x029a('0x45')]=_[_0x029a('0x46')](_0x16a50c[_0x029a('0x43')],_0x16a50c[_0x029a('0x44')]);_0x385d39[_0x029a('0x47')]=_[_0x029a('0x46')](_0x16a50c['model'],qs[_0x029a('0x58')](_0x58f982[_0x029a('0x44')][_0x029a('0x58')]));_0x385d39[_0x029a('0x47')]=_0x385d39[_0x029a('0x47')][_0x029a('0x48')]?_0x385d39['attributes']:_0x16a50c[_0x029a('0x43')];if(_0x58f982[_0x029a('0x44')][_0x029a('0x50')]){_0x385d39[_0x029a('0x51')]=[{'all':!![]}];}_0x385d39=_['merge']({},_0x385d39,_0x58f982[_0x029a('0x4f')]);return db[_0x029a('0x3f')]['find'](_0x385d39)[_0x029a('0x37')](handleEntityNotFound(_0x14f53c,null))['then'](respondWithResult(_0x14f53c,null))[_0x029a('0x2b')](handleError(_0x14f53c,null));};exports[_0x029a('0x59')]=function(_0x1679e2,_0xba4937){return db[_0x029a('0x3f')][_0x029a('0x59')](_0x1679e2['body'],{})[_0x029a('0x37')](function(_0x3160a4){var _0x2addde=_0x1679e2[_0x029a('0x5a')][_0x029a('0x38')]({'plain':!![]});if(!_0x2addde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2addde[_0x029a('0x5b')]===_0x029a('0x5a')){var _0x10c218=_0x3160a4[_0x029a('0x38')]({'plain':!![]});var _0x30242b=_0x029a('0x39');return db[_0x029a('0x5c')][_0x029a('0x5d')]({'where':{'name':_0x30242b,'userProfileId':_0x2addde[_0x029a('0x5e')]},'raw':!![]})[_0x029a('0x37')](function(_0x14b378){if(_0x14b378&&_0x14b378[_0x029a('0x5f')]===0x0){return db['UserProfileResource']['create']({'name':_0x10c218['name'],'resourceId':_0x10c218['id'],'type':_0x14b378[_0x029a('0x3c')],'sectionId':_0x14b378['id']},{})[_0x029a('0x37')](function(){return _0x3160a4;});}else{return _0x3160a4;}})[_0x029a('0x2b')](function(_0x10f906){logger[_0x029a('0x26')](_0x029a('0x60'),_0x10f906);throw _0x10f906;});}return _0x3160a4;})['then'](respondWithResult(_0xba4937,0xc9))[_0x029a('0x2b')](handleError(_0xba4937,null));};exports[_0x029a('0x35')]=function(_0x5dabab,_0x15e003){if(_0x5dabab[_0x029a('0x61')]['id']){delete _0x5dabab['body']['id'];}return db['ChatWebsite'][_0x029a('0x5d')]({'where':{'id':_0x5dabab['params']['id']},'include':[{'model':db[_0x029a('0x55')],'as':_0x029a('0x56')}]})[_0x029a('0x37')](handleEntityNotFound(_0x15e003,null))[_0x029a('0x37')](saveUpdates(_0x5dabab[_0x029a('0x61')],null))[_0x029a('0x37')](respondWithResult(_0x15e003,null))['catch'](handleError(_0x15e003,null));};exports[_0x029a('0x36')]=function(_0x2eeba0,_0x57586c){return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x2eeba0[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x57586c,null))['then'](removeEntity(_0x57586c,null))[_0x029a('0x2b')](handleError(_0x57586c,null));};exports[_0x029a('0x63')]=function(_0xba56f,_0x41f8fa){return db[_0x029a('0x3f')]['describe']()[_0x029a('0x37')](respondWithResult(_0x41f8fa,null))['catch'](handleError(_0x41f8fa,null));};exports[_0x029a('0x64')]=function(_0x135a26,_0x24c909,_0x867ab){if(_0x135a26[_0x029a('0x61')]['id']){delete _0x135a26['body']['id'];}return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x135a26[_0x029a('0x62')]['id']}})['then'](handleEntityNotFound(_0x24c909,null))[_0x029a('0x37')](function(_0x2c45a8){if(_0x2c45a8){_0x135a26['body'][_0x029a('0x65')]=_0x2c45a8['id'];return db[_0x029a('0x66')][_0x029a('0x59')](_0x135a26[_0x029a('0x61')]);}})[_0x029a('0x37')](respondWithResult(_0x24c909,null))[_0x029a('0x2b')](handleError(_0x24c909,null));};exports['getDispositions']=function(_0x20419b,_0x2efb94,_0x9730d0){var _0x2fc280={'raw':![],'where':{}};var _0x451fa8={};var _0x4e4252={'count':0x0,'rows':[]};return db[_0x029a('0x3f')]['findOne']({'where':{'id':_0x20419b[_0x029a('0x62')]['id']}})['then'](handleEntityNotFound(_0x2efb94,null))['then'](function(_0x4c4da3){if(_0x4c4da3){_0x451fa8[_0x029a('0x43')]=_['keys'](db[_0x029a('0x66')][_0x029a('0x40')]);_0x451fa8[_0x029a('0x44')]=_[_0x029a('0x57')](_0x20419b['query']);_0x451fa8[_0x029a('0x45')]=_[_0x029a('0x46')](_0x451fa8[_0x029a('0x43')],_0x451fa8[_0x029a('0x44')]);_0x2fc280[_0x029a('0x47')]=_[_0x029a('0x46')](_0x451fa8[_0x029a('0x43')],qs['fields'](_0x20419b['query']['fields']));_0x2fc280[_0x029a('0x47')]=_0x2fc280[_0x029a('0x47')][_0x029a('0x48')]?_0x2fc280['attributes']:_0x451fa8[_0x029a('0x43')];if(!_0x20419b[_0x029a('0x44')][_0x029a('0x67')]('nolimit')){_0x2fc280[_0x029a('0x2e')]=qs[_0x029a('0x2e')](_0x20419b[_0x029a('0x44')][_0x029a('0x2e')]);_0x2fc280[_0x029a('0x30')]=qs[_0x029a('0x30')](_0x20419b[_0x029a('0x44')][_0x029a('0x30')]);}_0x2fc280['order']=qs[_0x029a('0x68')](_0x20419b['query'][_0x029a('0x68')]);_0x2fc280['where']=qs[_0x029a('0x45')](_['pick'](_0x20419b[_0x029a('0x44')],_0x451fa8[_0x029a('0x45')]));_0x2fc280['where'][_0x029a('0x65')]=_0x4c4da3['id'];if(_0x20419b[_0x029a('0x44')][_0x029a('0x4b')]){_0x2fc280['where']=_[_0x029a('0x4d')](_0x2fc280[_0x029a('0x4c')],{'$or':_[_0x029a('0x3e')](_0x2fc280[_0x029a('0x47')],function(_0x5e00d0){var _0x432b96={};_0x432b96[_0x5e00d0]={'$like':'%'+_0x20419b[_0x029a('0x44')][_0x029a('0x4b')]+'%'};return _0x432b96;})});}_0x2fc280=_[_0x029a('0x4d')]({},_0x2fc280,_0x20419b[_0x029a('0x4f')]);return db[_0x029a('0x66')][_0x029a('0x2f')]({'where':_0x2fc280['where']})[_0x029a('0x37')](function(_0x39e639){_0x4e4252['count']=_0x39e639;if(_0x20419b[_0x029a('0x44')][_0x029a('0x50')]){_0x2fc280[_0x029a('0x51')]=[{'all':!![]}];}return db[_0x029a('0x66')]['findAll'](_0x2fc280);})['then'](function(_0x2ad1b0){_0x4e4252[_0x029a('0x53')]=_0x2ad1b0;return _0x4e4252;});}})[_0x029a('0x37')](respondWithFilteredResult(_0x2efb94,_0x2fc280))['catch'](handleError(_0x2efb94,null));};exports[_0x029a('0x69')]=function(_0x23dafc,_0x46f5cb,_0x48d9ab){return db['ChatWebsite'][_0x029a('0x5d')]({'where':{'id':_0x23dafc[_0x029a('0x62')]['id']}})['then'](handleEntityNotFound(_0x46f5cb,null))[_0x029a('0x37')](function(_0x5c5ca8){if(_0x5c5ca8){return _0x5c5ca8[_0x029a('0x69')](_0x23dafc[_0x029a('0x44')][_0x029a('0x6a')]);}})[_0x029a('0x37')](respondWithStatusCode(_0x46f5cb,null))[_0x029a('0x2b')](handleError(_0x46f5cb,null));};exports[_0x029a('0x6b')]=function(_0x311bed,_0x16a3da,_0x4cc78f){if(_0x311bed[_0x029a('0x61')]['id']){delete _0x311bed[_0x029a('0x61')]['id'];}return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x311bed['params']['id']}})['then'](handleEntityNotFound(_0x16a3da,null))[_0x029a('0x37')](function(_0x33661f){if(_0x33661f){_0x311bed[_0x029a('0x61')][_0x029a('0x65')]=_0x33661f['id'];return db[_0x029a('0x6c')][_0x029a('0x59')](_0x311bed[_0x029a('0x61')]);}})[_0x029a('0x37')](respondWithResult(_0x16a3da,null))[_0x029a('0x2b')](handleError(_0x16a3da,null));};exports['getAnswers']=function(_0x1049f2,_0x262bba,_0x3608a0){var _0x28bb72={'raw':![],'where':{}};var _0x56c765={};var _0x535b50={'count':0x0,'rows':[]};return db[_0x029a('0x3f')][_0x029a('0x6d')]({'where':{'id':_0x1049f2[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x262bba,null))[_0x029a('0x37')](function(_0x269627){if(_0x269627){_0x56c765['model']=_['keys'](db['CannedAnswer'][_0x029a('0x40')]);_0x56c765[_0x029a('0x44')]=_[_0x029a('0x57')](_0x1049f2[_0x029a('0x44')]);_0x56c765[_0x029a('0x45')]=_[_0x029a('0x46')](_0x56c765[_0x029a('0x43')],_0x56c765[_0x029a('0x44')]);_0x28bb72[_0x029a('0x47')]=_[_0x029a('0x46')](_0x56c765[_0x029a('0x43')],qs[_0x029a('0x58')](_0x1049f2['query'][_0x029a('0x58')]));_0x28bb72[_0x029a('0x47')]=_0x28bb72[_0x029a('0x47')][_0x029a('0x48')]?_0x28bb72[_0x029a('0x47')]:_0x56c765[_0x029a('0x43')];if(!_0x1049f2[_0x029a('0x44')]['hasOwnProperty']('nolimit')){_0x28bb72[_0x029a('0x2e')]=qs[_0x029a('0x2e')](_0x1049f2[_0x029a('0x44')][_0x029a('0x2e')]);_0x28bb72['offset']=qs[_0x029a('0x30')](_0x1049f2[_0x029a('0x44')][_0x029a('0x30')]);}_0x28bb72[_0x029a('0x49')]=qs[_0x029a('0x68')](_0x1049f2[_0x029a('0x44')]['sort']);_0x28bb72[_0x029a('0x4c')]=qs[_0x029a('0x45')](_['pick'](_0x1049f2[_0x029a('0x44')],_0x56c765['filters']));_0x28bb72[_0x029a('0x4c')][_0x029a('0x65')]=_0x269627['id'];if(_0x1049f2[_0x029a('0x44')][_0x029a('0x4b')]){_0x28bb72[_0x029a('0x4c')]=_['merge'](_0x28bb72[_0x029a('0x4c')],{'$or':_[_0x029a('0x3e')](_0x28bb72[_0x029a('0x47')],function(_0x6c6ab1){var _0x21e01a={};_0x21e01a[_0x6c6ab1]={'$like':'%'+_0x1049f2['query'][_0x029a('0x4b')]+'%'};return _0x21e01a;})});}_0x28bb72=_[_0x029a('0x4d')]({},_0x28bb72,_0x1049f2[_0x029a('0x4f')]);return db[_0x029a('0x6c')]['count']({'where':_0x28bb72['where']})[_0x029a('0x37')](function(_0xc4ec1b){_0x535b50['count']=_0xc4ec1b;if(_0x1049f2['query'][_0x029a('0x50')]){_0x28bb72['include']=[{'all':!![]}];}return db[_0x029a('0x6c')][_0x029a('0x52')](_0x28bb72);})[_0x029a('0x37')](function(_0x1d1c50){_0x535b50[_0x029a('0x53')]=_0x1d1c50;return _0x535b50;});}})['then'](respondWithFilteredResult(_0x262bba,_0x28bb72))[_0x029a('0x2b')](handleError(_0x262bba,null));};exports[_0x029a('0x6e')]=function(_0x3eb4f5,_0x1ef619,_0x4bf7fe){return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x3eb4f5[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x1ef619,null))[_0x029a('0x37')](function(_0x2ebf7){if(_0x2ebf7){return _0x2ebf7[_0x029a('0x6e')](_0x3eb4f5[_0x029a('0x44')][_0x029a('0x6a')]);}})[_0x029a('0x37')](respondWithStatusCode(_0x1ef619,null))[_0x029a('0x2b')](handleError(_0x1ef619,null));};exports[_0x029a('0x6f')]=function(_0x29f000,_0x50c3e2,_0x1c2372){_0x29f000[_0x029a('0x61')]['sitepic']=_0x29f000['file'][_0x029a('0x70')];return db[_0x029a('0x3f')]['find']({'where':{'id':_0x29f000[_0x029a('0x62')]['id']}})['then'](handleEntityNotFound(_0x50c3e2,null))['then'](saveUpdates(_0x29f000[_0x029a('0x61')],null))['then'](respondWithResult(_0x50c3e2,null))[_0x029a('0x2b')](handleError(_0x50c3e2,null));};exports[_0x029a('0x71')]=function(_0x44a052,_0x1a7926,_0x116a02){_0x44a052['body'][_0x029a('0x72')]=_0x44a052[_0x029a('0x73')][_0x029a('0x70')];return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x44a052[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x1a7926,null))[_0x029a('0x37')](saveUpdates(_0x44a052[_0x029a('0x61')],null))[_0x029a('0x37')](respondWithResult(_0x1a7926,null))[_0x029a('0x2b')](handleError(_0x1a7926,null));};exports['addCustomerAvatar']=function(_0x5487b2,_0x3e542b,_0x201e0f){_0x5487b2[_0x029a('0x61')][_0x029a('0x74')]=_0x5487b2[_0x029a('0x73')][_0x029a('0x70')];return db['ChatWebsite'][_0x029a('0x5d')]({'where':{'id':_0x5487b2[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x3e542b,null))[_0x029a('0x37')](saveUpdates(_0x5487b2[_0x029a('0x61')],null))[_0x029a('0x37')](respondWithResult(_0x3e542b,null))['catch'](handleError(_0x3e542b,null));};exports[_0x029a('0x75')]=function(_0x584ffc,_0x23eb9b,_0x3a4415){_0x584ffc[_0x029a('0x61')][_0x029a('0x76')]=_0x584ffc['file'][_0x029a('0x70')];return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x584ffc[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x23eb9b,null))[_0x029a('0x37')](saveUpdates(_0x584ffc[_0x029a('0x61')],null))['then'](respondWithResult(_0x23eb9b,null))['catch'](handleError(_0x23eb9b,null));};exports['getLogo']=function(_0x394d7e,_0x31cc87,_0x56cf96){var _0x3db0c6=path[_0x029a('0x77')](config[_0x029a('0x78')],_0x029a('0x79'));var _0x5b1620={'where':{'id':_0x394d7e[_0x029a('0x62')]['id']},'attributes':['id',_0x029a('0x7a')],'raw':!![]};var _0x495507=![];return require(_0x029a('0x16'))[_0x029a('0x7b')]()[_0x029a('0x37')](function(_0x426e30){if(_0x426e30){_0x495507=_0x426e30['custom'];}})[_0x029a('0x37')](function(){return db['ChatWebsite'][_0x029a('0x5d')](_0x5b1620);})['then'](handleEntityNotFound(_0x31cc87,null))[_0x029a('0x37')](function(_0x4e706f){if(_0x4e706f){if(!_['isNil'](_0x4e706f[_0x029a('0x7a')])){if(fs[_0x029a('0x7c')](path[_0x029a('0x77')](config[_0x029a('0x78')],_0x029a('0x7d'),_0x4e706f[_0x029a('0x7a')]))&&_0x495507){_0x3db0c6=path['join'](config['root'],'server/files/images/logos/',_0x4e706f[_0x029a('0x7a')]);}}return _0x31cc87[_0x029a('0x7e')](_0x3db0c6);}})[_0x029a('0x2b')](handleError(_0x31cc87,null));};exports[_0x029a('0x7f')]=function(_0x573515,_0x3f8f52,_0x50e4c8){var _0x5cf508=path[_0x029a('0x77')](config[_0x029a('0x78')],_0x029a('0x80'));var _0x8fb4bd={'where':{'id':_0x573515[_0x029a('0x62')]['id']},'attributes':['id',_0x029a('0x72')],'raw':!![]};return db[_0x029a('0x3f')][_0x029a('0x5d')](_0x8fb4bd)[_0x029a('0x37')](handleEntityNotFound(_0x3f8f52,null))['then'](function(_0x333f57){if(_0x333f57){if(!_[_0x029a('0x81')](_0x333f57['agentAvatar'])){if(fs[_0x029a('0x7c')](path['join'](config[_0x029a('0x78')],_0x029a('0x82'),_0x333f57[_0x029a('0x72')]))){_0x5cf508=path[_0x029a('0x77')](config[_0x029a('0x78')],_0x029a('0x82'),_0x333f57['agentAvatar']);}}return _0x3f8f52['download'](_0x5cf508);}})[_0x029a('0x2b')](handleError(_0x3f8f52,null));};exports[_0x029a('0x83')]=function(_0xd67a82,_0x1cc27a,_0x16e0b9){var _0x3a45ca=path[_0x029a('0x77')](config[_0x029a('0x78')],_0x029a('0x84'));var _0x2a2b60={'where':{'id':_0xd67a82[_0x029a('0x62')]['id']},'attributes':['id','customerAvatar',_0x029a('0x85')],'raw':!![]};return db[_0x029a('0x3f')][_0x029a('0x5d')](_0x2a2b60)[_0x029a('0x37')](handleEntityNotFound(_0x1cc27a,null))[_0x029a('0x37')](function(_0x81b4f4){if(_0x81b4f4){if(!_['isNil'](_0x81b4f4[_0x029a('0x74')])){if(fs[_0x029a('0x7c')](path[_0x029a('0x77')](config['root'],_0x029a('0x82'),_0x81b4f4[_0x029a('0x74')]))&&_0x81b4f4[_0x029a('0x85')]){_0x3a45ca=path[_0x029a('0x77')](config[_0x029a('0x78')],'server/files/images/avatars/',_0x81b4f4['customerAvatar']);}}return _0x1cc27a['download'](_0x3a45ca);}})[_0x029a('0x2b')](handleError(_0x1cc27a,null));};exports[_0x029a('0x86')]=function(_0x12e510,_0xdde4c3,_0xfd4fb0){var _0x24d348=path[_0x029a('0x77')](config[_0x029a('0x78')],_0x029a('0x87'));var _0x43bd29={'where':{'id':_0x12e510['params']['id']},'attributes':['id',_0x029a('0x76')],'raw':!![]};return db[_0x029a('0x3f')]['find'](_0x43bd29)[_0x029a('0x37')](handleEntityNotFound(_0xdde4c3,null))['then'](function(_0x1176ed){if(_0x1176ed){if(!_[_0x029a('0x81')](_0x1176ed[_0x029a('0x76')])){if(fs[_0x029a('0x7c')](path['join'](config[_0x029a('0x78')],'server/files/images/avatars/',_0x1176ed[_0x029a('0x76')]))){_0x24d348=path[_0x029a('0x77')](config[_0x029a('0x78')],'server/files/images/avatars/',_0x1176ed['systemAvatar']);}}return _0xdde4c3[_0x029a('0x7e')](_0x24d348);}})[_0x029a('0x2b')](handleError(_0xdde4c3,null));};exports[_0x029a('0x88')]=function(_0x869337,_0x38f727,_0x264f18){var _0xa74a93=require(_0x029a('0x89'));var _0x52e8c3=new _0xa74a93();var _0x84df5d=_0x52e8c3[_0x029a('0x8a')](_0x869337[_0x029a('0x8b')][_0x029a('0x8c')])[_0x029a('0x8d')]();var _0x4f4677={'body':_0x869337[_0x029a('0x61')],'channel':_0x029a('0x8e')};var _0x406ca6=[];var _0x289689=[];var _0x5a196e={};var _0x228427=![];return db[_0x029a('0x8f')][_0x029a('0x63')]()[_0x029a('0x37')](function(_0x463c9f){if(!_0x463c9f){throw new db[(_0x029a('0x90'))]['ValidationError'](_0x029a('0x91'));}_0x406ca6=_[_0x029a('0x92')](_[_0x029a('0x57')](_0x463c9f),[_0x029a('0x93'),_0x029a('0x94')]);_0x289689=_['difference'](_['keys'](_0x463c9f),[_0x029a('0x93'),_0x029a('0x94'),_0x029a('0x95'),_0x029a('0x96')]);if(_0x869337[_0x029a('0x61')]['id']){delete _0x869337[_0x029a('0x61')]['id'];}if(_[_0x029a('0x81')](_0x869337['body']['from'])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_[_0x029a('0x81')](_0x869337['body']['body'])||_0x869337[_0x029a('0x61')]['body']===''){throw new db[(_0x029a('0x90'))][(_0x029a('0x97'))](_0x029a('0x98'));}if(_[_0x029a('0x81')](_0x869337[_0x029a('0x61')]['mapKey'])){throw new db['Sequelize'][(_0x029a('0x97'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x289689);}if(!_[_0x029a('0x99')](_0x289689,_0x869337[_0x029a('0x61')][_0x029a('0x9a')])){throw new db['Sequelize'][(_0x029a('0x97'))](_0x029a('0x9b')+_0x289689);}_0x5a196e[_0x869337[_0x029a('0x61')]['mapKey']]=_0x869337[_0x029a('0x61')]['from'];})['then'](function(){return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x869337[_0x029a('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x029a('0x9c'),'include':[{'model':db[_0x029a('0x8f')],'as':_0x029a('0x9d'),'where':_0x5a196e,'limit':0x1,'order':[[_0x029a('0x94'),_0x029a('0x9e')]]}]},{'model':db[_0x029a('0x9f')],'as':_0x029a('0xa0')}]});})[_0x029a('0x37')](handleEntityNotFound(_0x38f727,null))['then'](function(_0x3a35a7){if(_0x3a35a7&&_0x3a35a7[_0x029a('0x9c')]){_0x4f4677[_0x029a('0xa1')]=_0x3a35a7;_0x4f4677['applications']=_0x3a35a7[_0x029a('0xa0')];_0x4f4677[_0x029a('0xa2')]=_0x3a35a7[_0x029a('0x9c')];_0x4f4677[_0x029a('0xa3')]=_['orderBy'](_0x4f4677[_0x029a('0xa3')],[_0x029a('0xa4')],[_0x029a('0xa5')]);if(_0x4f4677[_0x029a('0xa1')]['Applications']){delete _0x4f4677[_0x029a('0xa1')][_0x029a('0xa0')];}if(_0x4f4677['account'][_0x029a('0x9c')]&&_0x4f4677[_0x029a('0xa1')][_0x029a('0x9c')][_0x029a('0x9d')]['length']){return _0x4f4677[_0x029a('0xa1')][_0x029a('0x9c')]['Contacts'][0x0];}var _0xf2f0f6=_[_0x029a('0x18')](_0x869337[_0x029a('0x61')],{'firstName':_0x869337[_0x029a('0x61')][_0x029a('0xa6')],'ListId':_0x3a35a7['ListId']});_0xf2f0f6[_0x869337[_0x029a('0x61')][_0x029a('0x9a')]]=_0x869337[_0x029a('0x61')]['from'];return db[_0x029a('0x8f')][_0x029a('0x59')](_0xf2f0f6,{'fields':_0x406ca6,'raw':!![]});}})[_0x029a('0x37')](handleEntityNotFound(_0x38f727,null))[_0x029a('0x37')](function(_0x1e66d6){_0x4f4677[_0x029a('0xa7')]=_0x1e66d6;var _0x1aabed=_0x869337['body'][_0x029a('0xa8')];if(_0x869337['headers']['cf-connecting-ip']){_0x1aabed=_0x869337[_0x029a('0x8b')]['cf-connecting-ip'];}else if(_0x869337[_0x029a('0x8b')][_0x029a('0xa9')]){_0x1aabed=_[_0x029a('0xaa')](_0x869337[_0x029a('0x8b')][_0x029a('0xa9')]['split'](','));}if(_0x1e66d6){var _0x13f49f={'ContactId':_0x1e66d6['id'],'ChatWebsiteId':_0x869337[_0x029a('0x62')]['id'],'from':(_0x1e66d6[_0x029a('0xab')]||'')+'\x20'+(_0x1e66d6[_0x029a('0xac')]||''),'customerIp':_0x1aabed,'customerPort':_0x869337[_0x029a('0x8b')][_0x029a('0xad')]?_0x869337[_0x029a('0x8b')]['x-real-port']:null,'referer':_0x869337[_0x029a('0x61')][_0x029a('0xae')],'browserName':_0x84df5d[_0x029a('0xaf')][_0x029a('0x3c')]&&_0x84df5d[_0x029a('0xaf')][_0x029a('0xb0')]?util[_0x029a('0xb1')]('%s\x20%s',_0x84df5d[_0x029a('0xaf')][_0x029a('0x3c')],_0x84df5d[_0x029a('0xaf')][_0x029a('0xb0')]):_0x029a('0xb2'),'browserVersion':_0x84df5d[_0x029a('0xaf')][_0x029a('0xb0')]||_0x029a('0xb2'),'osName':util[_0x029a('0xb1')](_0x029a('0xb3'),_0x84df5d['os'][_0x029a('0x3c')],_0x84df5d['os'][_0x029a('0xb0')]),'osVersion':_0x84df5d['os'][_0x029a('0xb0')],'deviceModel':_0x84df5d[_0x029a('0xb4')][_0x029a('0x43')]&&_0x84df5d['device'][_0x029a('0xb5')]?util[_0x029a('0xb1')](_0x029a('0xb6'),_0x84df5d[_0x029a('0xb4')]['model'],_0x84df5d[_0x029a('0xb4')][_0x029a('0xb5')],_0x84df5d[_0x029a('0xb4')][_0x029a('0x41')]):null,'deviceVendor':_0x84df5d[_0x029a('0xb4')][_0x029a('0xb5')],'deviceType':_0x84df5d[_0x029a('0xb4')][_0x029a('0x41')],'formData':JSON['stringify'](_0x869337[_0x029a('0x61')])};var _0x43ebf5={'ChatWebsiteId':_0x869337[_0x029a('0x62')]['id'],'closed':![]};if(_0x869337['body']['threadId']){_0x43ebf5[_0x029a('0xb7')]=_0x869337[_0x029a('0x61')]['threadId'];return db['ChatInteraction'][_0x029a('0x5d')]({'where':_0x43ebf5})[_0x029a('0x37')](function(_0x4ffd60){if(_0x4ffd60){return[_0x4ffd60,![]];}_0x13f49f['threadId']=_0x869337['body'][_0x029a('0xb7')];_0x13f49f['externalUrl']=_0x869337['body']['externalUrl'];return db['ChatInteraction']['create'](_0x13f49f)[_0x029a('0x37')](function(_0x3b9b4a){return[_0x3b9b4a,!![]];});});}_0x43ebf5[_0x029a('0xb8')]=_0x1e66d6['id'];if(_0x869337[_0x029a('0x61')][_0x029a('0xb9')]&&_0x869337['body'][_0x029a('0xb9')]['id']){_0x43ebf5['id']=_0x869337[_0x029a('0x61')][_0x029a('0xb9')]['id'];return db[_0x029a('0xba')][_0x029a('0x5d')]({'where':_0x43ebf5})['then'](function(_0x1f48da){if(_0x1f48da){return[_0x1f48da,![]];}return db[_0x029a('0xba')]['create'](_0x13f49f)['then'](function(_0x2b6b92){return[_0x2b6b92,!![]];});});}return db[_0x029a('0xba')][_0x029a('0x59')](_0x13f49f)['then'](function(_0x1160b4){return[_0x1160b4,!![]];});}})[_0x029a('0xbb')](function(_0x45a504,_0x2cc87d){if(_0x45a504){_0x228427=_0x2cc87d;if(!_0x2cc87d){var _0x5a32c7={'from':(_0x4f4677[_0x029a('0xa7')][_0x029a('0xab')]||'')+'\x20'+(_0x4f4677[_0x029a('0xa7')]['lastName']||'')};if(_0x869337[_0x029a('0x61')][_0x029a('0xb7')]&&_0x869337['body']['messageId']&&_0x869337[_0x029a('0x61')][_0x029a('0xb7')]!=_0x869337[_0x029a('0x61')][_0x029a('0xbc')]){_0x5a32c7[_0x029a('0xb7')]=_0x869337[_0x029a('0x61')][_0x029a('0xbc')];}return _0x45a504[_0x029a('0x35')](_0x5a32c7);}else{return _0x45a504;}}})[_0x029a('0x37')](function(_0x59ed06){_0x4f4677[_0x029a('0xb9')]=_0x59ed06[_0x029a('0x38')]({'plain':!![]});_0x4f4677[_0x029a('0xb9')]['created']=_0x228427;if(_0x4f4677['interaction'][_0x029a('0xbd')]){if(_0x4f4677['account'][_0x029a('0xbe')]){_0x4f4677[_0x029a('0xa3')][_0x029a('0xbf')]({'id':0x0,'priority':_0x4f4677[_0x029a('0xa3')][_0x029a('0x48')]+0x1,'app':_0x029a('0xc0'),'appdata':_0x029a('0xc1'),'interval':'*,*,*,*'});}}return db[_0x029a('0xc2')]['create']({'body':_0x869337[_0x029a('0x61')][_0x029a('0x61')],'ChatWebsiteId':_0x869337['params']['id'],'ChatInteractionId':_0x59ed06['id'],'direction':'in','ContactId':_0x4f4677[_0x029a('0xa7')]['id'],'AttachmentId':_0x869337[_0x029a('0x61')]['AttachmentId']});})['then'](function(_0x2145aa){_0x4f4677[_0x029a('0x28')]=_0x2145aa;if(_0x4f4677[_0x029a('0xb9')][_0x029a('0xc3')]){return db[_0x029a('0xc4')][_0x029a('0x5d')]({'attributes':['id',_0x029a('0x3c')],'where':{'id':_0x4f4677['interaction'][_0x029a('0xc3')]}})['then'](function(_0x4220d8){if(_0x4220d8){_0x4f4677['applications'][_0x029a('0xc5')]({'id':0x0,'priority':0x0,'app':_0x029a('0xc6'),'appdata':_0x4220d8['name']+','+(_0x4f4677[_0x029a('0xa1')][_0x029a('0xc7')]||0xa),'interval':'*,*,*,*'});_0x4f4677[_0x029a('0xc8')]=!![];}return respondWithRpcPromise(_0x029a('0xc9'),_0x029a('0xca'),_0x4f4677);});}return respondWithRpcPromise(_0x029a('0xc9'),_0x029a('0xca'),_0x4f4677);})['then'](function(_0x235d31){respondWithRpcPromise(_0x029a('0xcb'),_0x029a('0xcb'),{'event':_0x029a('0x88'),'message':_0x235d31},client9002);return _0x235d31;})[_0x029a('0x37')](respondWithResult(_0x38f727,null))[_0x029a('0x2b')](handleError(_0x38f727,null));};exports['offline']=function(_0x13c7fd,_0x2c3980,_0x31efed){var _0x3e06a9,_0x13b581,_0x1e9209;var _0x4dc9e5=[];var _0x257be4=[];var _0x454609={};var _0x90ddcd=_0x13c7fd[_0x029a('0xcc')]||[];var _0x10ad4f=[];var _0x4f4a2b;return db[_0x029a('0x8f')][_0x029a('0x63')]()['then'](function(_0x3d6e73){if(!_0x3d6e73){throw new db[(_0x029a('0x90'))]['ValidationError']('no\x20available\x20attributes');}_0x257be4=_[_0x029a('0x92')](_[_0x029a('0x57')](_0x3d6e73),[_0x029a('0x93'),_0x029a('0x94')]);_0x4dc9e5=_[_0x029a('0x92')](_[_0x029a('0x57')](_0x3d6e73),[_0x029a('0x93'),_0x029a('0x94'),_0x029a('0x95'),_0x029a('0x96')]);if(_0x13c7fd[_0x029a('0x61')]['id']){delete _0x13c7fd['body']['id'];}if(_[_0x029a('0x81')](_0x13c7fd['body'][_0x029a('0xa6')])){throw _0x2c3980[_0x029a('0x2c')](0x1f4)[_0x029a('0x3d')](new db[(_0x029a('0x90'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0x029a('0x81')](_0x13c7fd[_0x029a('0x61')][_0x029a('0x61')])||_0x13c7fd['body'][_0x029a('0x61')]===''){throw _0x2c3980['status'](0x1f4)[_0x029a('0x3d')](new db[(_0x029a('0x90'))]['ValidationError'](_0x029a('0x98')));}if(_[_0x029a('0x81')](_0x13c7fd[_0x029a('0x61')]['mapKeyOffline'])){throw _0x2c3980[_0x029a('0x2c')](0x1f4)[_0x029a('0x3d')](new db[(_0x029a('0x90'))][(_0x029a('0x97'))](_0x029a('0xcd')+_0x4dc9e5));}if(!_[_0x029a('0x99')](_0x4dc9e5,_0x13c7fd[_0x029a('0x61')][_0x029a('0xce')])){throw _0x2c3980['status'](0x1f4)[_0x029a('0x3d')](new db['Sequelize'][(_0x029a('0x97'))](_0x029a('0xcf')+_0x4dc9e5));}_0x454609[_0x13c7fd[_0x029a('0x61')][_0x029a('0xce')]]=_0x13c7fd[_0x029a('0x61')]['from'];})['then'](function(){return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x13c7fd[_0x029a('0x62')]['id']},'include':[{'model':db[_0x029a('0xd0')],'as':_0x029a('0x9c')},{'model':db[_0x029a('0xd1')],'as':_0x029a('0xd1')}]});})['then'](handleEntityNotFound(_0x2c3980,null))[_0x029a('0x37')](function(_0x25d4be){if(_0x25d4be&&_0x25d4be[_0x029a('0x9c')]){_0x13b581=_0x25d4be;var _0x448042=_[_0x029a('0x18')](_0x13c7fd[_0x029a('0x61')],{'firstName':_0x13c7fd[_0x029a('0x61')][_0x029a('0xa6')],'phone':_0x13c7fd[_0x029a('0x61')]['from'],'ListId':_0x25d4be[_0x029a('0x96')]});_0x448042[_0x13c7fd[_0x029a('0x61')][_0x029a('0xce')]]=_0x13c7fd[_0x029a('0x61')][_0x029a('0xa6')];return db[_0x029a('0x8f')][_0x029a('0xd2')]({'where':_0x454609,'defaults':_0x448042});}})[_0x029a('0xbb')](function(_0x1b86a4){if(_0x1b86a4){_0x1e9209=_0x1b86a4;var _0x4db4a0=fs[_0x029a('0xd3')](path[_0x029a('0x77')](config['root'],_0x029a('0xd4')),_0x029a('0xd5'));var _0x4f6df1=ejs['render'](_0x4db4a0,{'body':_[_0x029a('0xd6')](_0x13c7fd[_0x029a('0x61')][_0x029a('0x61')]),'bodyTitle':_0x13b581[_0x029a('0xd7')]});return db[_0x029a('0xd8')]['create']({'body':_0x4f6df1,'ContactId':_0x1b86a4['id'],'ChatWebsiteId':_0x13b581['id']});}})['then'](function(_0x3e4892){_0x4f4a2b=_0x3e4892;if(_0x90ddcd[_0x029a('0x48')]){var _0xe51488=_0x90ddcd[_0x029a('0x3e')](function(_0xe7daf2){return{'name':_0xe7daf2[_0x029a('0xd9')],'basename':_0xe7daf2[_0x029a('0x70')],'type':_0xe7daf2['mimetype'],'ChatOfflineMessageId':_0x3e4892['id']};});_0x10ad4f=_0xe51488[_0x029a('0x3e')](_0x3800ba=>{var _0x3823a8={'filename':_0x3800ba['name'],'path':path[_0x029a('0x77')](config[_0x029a('0x78')],_0x029a('0xda'),_0x029a('0xcc'),_0x029a('0xdb'),'offline-chat',_0x3800ba[_0x029a('0xdc')])};return _0x3823a8;});if(!_0x13b581['openNewInteraction']){return db[_0x029a('0xdd')]['transaction'](function(_0x18077c){return db[_0x029a('0xde')]['bulkCreate'](_0xe51488,{'transaction':_0x18077c});});}}})[_0x029a('0x37')](function(){if(_0x4f4a2b){_0x3e06a9=_0x4f4a2b;return db[_0x029a('0xd1')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0x029a('0xdf')],'as':_0x029a('0xe0'),'raw':!![]}]});}})[_0x029a('0x37')](function(_0x3f68fd){if(_0x3f68fd&&_0x3f68fd['Smtp']&&_0x13b581[_0x029a('0xe1')]&&_0x13b581[_0x029a('0xe2')]){var _0xbb6152={'tls':{'rejectUnauthorized':![]}};if(_0x3f68fd[_0x029a('0xe0')][_0x029a('0xe3')]){_0xbb6152[_0x029a('0xe3')]=_0x3f68fd['Smtp'][_0x029a('0xe3')];}else{_0xbb6152[_0x029a('0xe4')]=_0x3f68fd[_0x029a('0xe0')][_0x029a('0xe4')];_0xbb6152['port']=_0x3f68fd['Smtp'][_0x029a('0xe5')];_0xbb6152['secure']=_0x3f68fd[_0x029a('0xe0')][_0x029a('0xe6')];}if(_0x3f68fd[_0x029a('0xe0')][_0x029a('0xe7')]){_0xbb6152['auth']={'user':_0x3f68fd[_0x029a('0xe0')]['user'],'pass':_0x3f68fd[_0x029a('0xe0')][_0x029a('0xe8')]};}return respondWithRpcPromise('SendMail',_0x029a('0xe9'),{'account':_0xbb6152,'message':{'from':util['format'](_0x029a('0xea'),_0x3f68fd[_0x029a('0x3c')],_0x3f68fd[_0x029a('0xeb')]||_0x3f68fd[_0x029a('0xe0')][_0x029a('0x5a')]),'to':_0x13b581['forwardOfflineAddress'],'subject':_0x13b581['offlineMessageSubject'],'html':_0x3e06a9[_0x029a('0x61')],'attachments':_0x10ad4f}},client9003)['then'](function(){return _0x3e06a9;})['catch'](function(_0x5c5686){console[_0x029a('0x26')](_0x5c5686);});}})[_0x029a('0x37')](function(){if(_0x13b581&&_0x13b581[_0x029a('0xec')]&&_0x13b581[_0x029a('0xed')]){var _0x236f75=[];if(_0x90ddcd[_0x029a('0x48')]){_0x236f75=_0x90ddcd['map'](function(_0x338895){return{'name':_0x338895['originalname'],'basename':_0x338895[_0x029a('0x70')],'type':_0x338895[_0x029a('0xee')],'ChatOfflineMessageId':_0x4f4a2b['id']};});}var _0x5117ec;if(!_[_0x029a('0x81')](_0x13b581[_0x029a('0xef')])){var _0x34edab=_[_0x029a('0x3e')](_0x13c7fd[_0x029a('0x61')],function(_0x458877){return _0x458877;});var _0x3cac01=_[_0x029a('0xf0')](_0x34edab)[0x0];var _0x24025a=_['mapValues'](_0x3cac01,function(_0x434cea){return _0x434cea;});_0x5117ec=_0x24025a[0x1][_0x13b581[_0x029a('0xef')]];}var _0x4de7a5={'from':_0x1e9209[_0x029a('0xeb')],'firstName':_0x1e9209[_0x029a('0xab')],'lastName':_0x1e9209[_0x029a('0xac')],'mapKey':_0x029a('0xeb'),'message':{'from':_0x1e9209[_0x029a('0xeb')],'to':_0x13b581[_0x029a('0xd1')][_0x029a('0xeb')],'cc':'','subject':_[_0x029a('0x81')](_0x5117ec)?_0x13b581[_0x029a('0xf1')]:_0x5117ec,'messageId':'','sentAt':new Date(),'attach':_0x236f75['length'],'attachments':_0x236f75,'originChannel':'Chat','ChatWebsiteId':_0x13b581['id'],'ChatOfflineMessageId':_0x3e06a9['id'],'originTo':_0x13b581[_0x029a('0xd1')][_0x029a('0xeb')]},'body':_0x3e06a9[_0x029a('0x61')]};var _0x468568={'account':{'id':_0x13b581[_0x029a('0xed')]},'body':_0x4de7a5,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount','notifyMail',_0x468568,client9001)['then'](function(){return _0x3e06a9;})[_0x029a('0x2b')](function(_0x2e4817){console[_0x029a('0x26')](_0x2e4817);});}return;})['then'](function(){if(_0x3e06a9){return _0x3e06a9;}})['then'](respondWithResult(_0x2c3980,null))['catch'](function(_0x22c565){console[_0x029a('0x26')](_0x029a('0x2b'),_0x22c565);for(var _0x308701 of _0x90ddcd){var _0x17e5c0=path[_0x029a('0x77')](config['root'],_0x029a('0xda'),_0x029a('0xcc'),_0x029a('0xdb'),_0x029a('0xf2'),_0x308701['filename']);fs_extra['remove'](_0x17e5c0)['catch'](function(_0x54573e){console[_0x029a('0x26')]('Could\x20not\x20remove\x20attachment\x20file',_0x17e5c0,_0x54573e);});}});};exports[_0x029a('0xf3')]=function(_0x2bebad,_0x1d0097,_0x500553){return db[_0x029a('0xba')][_0x029a('0x5d')]({'where':{'id':_0x2bebad['params']['id']}})['then'](handleEntityNotFound(_0x1d0097,null))[_0x029a('0x37')](function(_0x13edb7){if(_0x13edb7){return _0x13edb7[_0x029a('0xf3')](_0x2bebad[_0x029a('0x61')][_0x029a('0x6a')],_[_0x029a('0xf4')](_0x2bebad[_0x029a('0x61')],[_0x029a('0x6a'),'id'])||{});}})[_0x029a('0x37')](respondWithResult(_0x1d0097,null))[_0x029a('0x2b')](handleError(_0x1d0097,null));};exports[_0x029a('0xf5')]=function(_0x5ec98f,_0x3ea336,_0x138e87){var _0x4058e6={'raw':![],'where':{}};var _0x2b9154={};var _0x222dd8={'count':0x0,'rows':[]};return db[_0x029a('0x3f')]['findOne']({'where':{'id':_0x5ec98f[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x3ea336,null))[_0x029a('0x37')](function(_0x1c8e86){if(_0x1c8e86){_0x2b9154['model']=_[_0x029a('0x57')](db[_0x029a('0xba')]['rawAttributes']);_0x2b9154[_0x029a('0x44')]=_['keys'](_0x5ec98f[_0x029a('0x44')]);_0x2b9154[_0x029a('0x45')]=_[_0x029a('0x46')](_0x2b9154[_0x029a('0x43')],_0x2b9154['query']);_0x4058e6['attributes']=_[_0x029a('0x46')](_0x2b9154[_0x029a('0x43')],qs[_0x029a('0x58')](_0x5ec98f[_0x029a('0x44')][_0x029a('0x58')]));_0x4058e6[_0x029a('0x47')]=_0x4058e6[_0x029a('0x47')]['length']?_0x4058e6[_0x029a('0x47')]:_0x2b9154['model'];if(!_0x5ec98f[_0x029a('0x44')]['hasOwnProperty'](_0x029a('0xf6'))){_0x4058e6[_0x029a('0x2e')]=qs['limit'](_0x5ec98f[_0x029a('0x44')][_0x029a('0x2e')]);_0x4058e6['offset']=qs[_0x029a('0x30')](_0x5ec98f['query'][_0x029a('0x30')]);}_0x4058e6['order']=qs[_0x029a('0x68')](_0x5ec98f['query']['sort']);_0x4058e6[_0x029a('0x4c')]=qs['filters'](_[_0x029a('0x4a')](_0x5ec98f['query'],_0x2b9154['filters']));_0x4058e6[_0x029a('0x4c')][_0x029a('0x65')]=_0x1c8e86['id'];if(_0x5ec98f[_0x029a('0x44')][_0x029a('0x4b')]){_0x4058e6[_0x029a('0x4c')]=_[_0x029a('0x4d')](_0x4058e6[_0x029a('0x4c')],{'$or':_[_0x029a('0x3e')](_0x4058e6[_0x029a('0x47')],function(_0x4dcaa5){var _0x347648={};_0x347648[_0x4dcaa5]={'$like':'%'+_0x5ec98f['query'][_0x029a('0x4b')]+'%'};return _0x347648;})});}_0x4058e6=_[_0x029a('0x4d')]({},_0x4058e6,_0x5ec98f[_0x029a('0x4f')]);return db[_0x029a('0xba')][_0x029a('0x2f')]({'where':_0x4058e6['where']})[_0x029a('0x37')](function(_0x369ba5){_0x222dd8[_0x029a('0x2f')]=_0x369ba5;if(_0x5ec98f['query'][_0x029a('0x50')]){_0x4058e6[_0x029a('0x51')]=[{'model':db[_0x029a('0x8f')],'as':'Contact','required':![]},{'model':db[_0x029a('0xc4')],'as':'Owner','attributes':[_0x029a('0x3c'),_0x029a('0xf7'),_0x029a('0xf8')],'required':![]},{'model':db[_0x029a('0xf9')],'as':'Tags','attributes':['id','name',_0x029a('0xfa')],'where':_0x5ec98f[_0x029a('0x44')][_0x029a('0xfb')]?{'id':_0x5ec98f[_0x029a('0x44')]['tag']}:undefined,'required':_0x5ec98f[_0x029a('0x44')][_0x029a('0xfb')]?!![]:![]}];}return db['ChatInteraction'][_0x029a('0x52')](_0x4058e6);})['then'](function(_0xd5f7fd){_0x222dd8[_0x029a('0x53')]=_0xd5f7fd;return _0x222dd8;});}})[_0x029a('0x37')](respondWithFilteredResult(_0x3ea336,_0x4058e6))[_0x029a('0x2b')](handleError(_0x3ea336,null));};function iftimePromise(_0x524b02,_0x1b35e0){return respondWithRpcPromise(_0x029a('0xfc'),_0x029a('0xfd'),{'command':_0x1b35e0[_0x029a('0xfe')]?util[_0x029a('0xb1')](_0x029a('0xff'),_0x524b02[_0x029a('0x100')],_0x1b35e0[_0x029a('0xfe')]):util['format'](_0x029a('0x101'),_0x524b02[_0x029a('0x100')])},client9002)['then'](function(_0xc21097){var _0x91c95a=_0xc21097&&_0xc21097['indexOf'](_0x029a('0x102'))>=0x0?!![]:![];logger[_0x029a('0x29')](_0x029a('0x103'),_0x1b35e0['id'],_0x524b02['id'],_0x524b02[_0x029a('0x100')],_0x91c95a?'ONLINE':_0x029a('0x104'),_0x1b35e0[_0x029a('0xfe')]?_0x1b35e0[_0x029a('0xfe')]:_0x029a('0x105'));return _0x91c95a;})['catch'](function(_0x2e07a4){logger[_0x029a('0x26')](_0x029a('0x103'),_0x1b35e0['id'],_0x524b02['id'],_0x524b02[_0x029a('0x100')],util[_0x029a('0x106')](_0x2e07a4,{'showHidden':![],'depth':null}),_0x1b35e0['timezone']?_0x1b35e0['timezone']:_0x029a('0x105'));return![];});}exports[_0x029a('0xfd')]=function(_0x36fc52,_0x5e75a5,_0x5bc14a){var _0x388d2f=0x0;var _0x7fad6b=0x0;var _0x2b445a=![];var _0xfa2456;var _0x5b4b7d;return db['ChatWebsite'][_0x029a('0x5d')]({'where':{'id':_0x36fc52[_0x029a('0x62')]['id']},'include':[{'model':db[_0x029a('0x107')],'as':_0x029a('0x107'),'include':[{'model':db[_0x029a('0x107')],'as':_0x029a('0x108'),'attributes':['id',_0x029a('0x100')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x5e75a5,null))[_0x029a('0x37')](function(_0x47a76e){if(_0x47a76e){_0xfa2456=_0x47a76e;return _0x47a76e['getProactiveActions']({'raw':!![]});}})['then'](function(_0xaed838){if(_0xfa2456){if(_0xaed838){_0x5b4b7d=_0xaed838;}}return require(_0x029a('0x16'))['getLicense']();})[_0x029a('0x37')](function(_0x12c50c){if(_0x12c50c){_0x7fad6b=_0x12c50c[_0x029a('0x109')];_0x2b445a=_0x12c50c[_0x029a('0x10a')];}})['then'](function(){return db[_0x029a('0xba')][_0x029a('0x2f')]({'where':{'closed':![]}});})[_0x029a('0x37')](function(_0x12d0d4){_0x388d2f=_0x12d0d4;if(_0x7fad6b&&_0x12d0d4>_0x7fad6b){return db[_0x029a('0x10b')][_0x029a('0x6d')]({'where':{'id':0x1}})['then'](function(_0x4478f0){if(_0x4478f0){_0x4478f0[_0x029a('0x10c')]('chatLicenseExceeded');}});}})[_0x029a('0x37')](function(){if(_0xfa2456[_0x029a('0x107')]&&_0xfa2456[_0x029a('0x107')]['Intervals']){var _0xc16b15=[];for(var _0x44c484=0x0;_0x44c484<_0xfa2456[_0x029a('0x107')][_0x029a('0x108')][_0x029a('0x48')];_0x44c484++){var _0x84edae=_0xfa2456[_0x029a('0x107')][_0x029a('0x108')][_0x44c484][_0x029a('0x38')]({'plain':!![]});_0xc16b15[_0x029a('0xbf')](iftimePromise(_0x84edae,_0xfa2456));}return BPromise[_0x029a('0x10d')](_0xc16b15)['then'](function(_0x44dff9){return _[_0x029a('0x10e')](_0x44dff9);});}else{return!![];}})['then'](function(_0x6afebb){var _0x3d52a3=fs[_0x029a('0xd3')](path[_0x029a('0x77')](config[_0x029a('0x78')],'server/files/chat/iframe.ejs'),_0x029a('0xd5'));var _0x3526fd={'remote':_0xfa2456[_0x029a('0x10f')],'query':querystring[_0x029a('0x25')](_[_0x029a('0x4d')](_0xfa2456['get']({'plain':!![]}),{'customerIp':_0x36fc52[_0x029a('0x8b')]['x-forwarded-for']||_0x36fc52['headers'][_0x029a('0x110')]||_0x36fc52['connection'][_0x029a('0x111')]||_0x36fc52['ip'],'referer':_0x36fc52[_0x029a('0x8b')]['referer'],'openedInteractions':_0x388d2f,'maxInteractions':_0x7fad6b,'virtual':_0x2b445a[_0x029a('0x109')],'online':_0x6afebb,'custom':_0x2b445a}))[_0x029a('0x112')](/'/g,'\x5c\x27')};_0x5e75a5['send'](ejs[_0x029a('0x113')](Mustache[_0x029a('0x113')](_0x3d52a3,_0x3526fd),{'proactiveActions':_0x5b4b7d,'alignment':_0xfa2456[_0x029a('0x114')],'verticalAlignment':_0xfa2456['verticalAlignment'],'div_color':_0xfa2456[_0x029a('0xfa')],'text_color':_0xfa2456[_0x029a('0x115')],'button_color':_0xfa2456[_0x029a('0x116')],'background_color':_0xfa2456[_0x029a('0x117')]}));})[_0x029a('0x2b')](handleError(_0x5e75a5,null));};exports[_0x029a('0x118')]=function(_0x2904e7,_0x2c4473,_0x27bc8e){return db[_0x029a('0x3f')][_0x029a('0x6d')]({'where':{'id':_0x2904e7[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x2c4473,null))['then'](function(_0x422d2b){if(_0x422d2b){return db[_0x029a('0xdd')][_0x029a('0x119')](function(_0x4c580a){return db[_0x029a('0x9f')][_0x029a('0x36')]({'where':{'ChatWebsiteId':_0x2904e7[_0x029a('0x62')]['id']},'transaction':_0x4c580a})[_0x029a('0x37')](function(_0xbe5a0b){var _0x44159f=_[_0x029a('0x3e')](_0x2904e7[_0x029a('0x61')],function(_0x54ac1e){_0x54ac1e['ChatWebsiteId']=_0x2904e7[_0x029a('0x62')]['id'];return _0x54ac1e;});return db[_0x029a('0x9f')]['bulkCreate'](_0x44159f,{'transaction':_0x4c580a});});})['then'](function(){return db[_0x029a('0x9f')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x2904e7[_0x029a('0x62')]['id']},'order':_0x029a('0xa4')});});}})[_0x029a('0x37')](respondWithResult(_0x2c4473,null))[_0x029a('0x2b')](handleError(_0x2c4473,null));};exports[_0x029a('0x11a')]=function(_0x5c7f85,_0x3bf2cd,_0x5384b4){var _0x4e9407={};var _0xc207b={};var _0x597c04;var _0x4c5ecb;return db[_0x029a('0x3f')][_0x029a('0x6d')]({'where':{'id':_0x5c7f85[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x3bf2cd,null))[_0x029a('0x37')](function(_0x17b0fd){if(_0x17b0fd){_0x597c04=_0x17b0fd;_0xc207b[_0x029a('0x43')]=_[_0x029a('0x57')](db[_0x029a('0x9f')][_0x029a('0x40')]);_0xc207b[_0x029a('0x44')]=_[_0x029a('0x57')](_0x5c7f85[_0x029a('0x44')]);_0xc207b[_0x029a('0x45')]=_[_0x029a('0x46')](_0xc207b[_0x029a('0x43')],_0xc207b['query']);_0x4e9407[_0x029a('0x47')]=_[_0x029a('0x46')](_0xc207b[_0x029a('0x43')],qs[_0x029a('0x58')](_0x5c7f85['query']['fields']));_0x4e9407['attributes']=_0x4e9407[_0x029a('0x47')][_0x029a('0x48')]?_0x4e9407[_0x029a('0x47')]:_0xc207b[_0x029a('0x43')];_0x4e9407[_0x029a('0x49')]=qs['sort'](_0x5c7f85[_0x029a('0x44')][_0x029a('0x68')]);_0x4e9407['where']=qs['filters'](_[_0x029a('0x4a')](_0x5c7f85[_0x029a('0x44')],_0xc207b[_0x029a('0x45')]));if(_0x5c7f85[_0x029a('0x44')][_0x029a('0x4b')]){_0x4e9407[_0x029a('0x4c')]=_[_0x029a('0x4d')](_0x4e9407['where'],{'$or':_['map'](_0x4e9407['attributes'],function(_0x255334){var _0x5334a9={};_0x5334a9[_0x255334]={'$like':'%'+_0x5c7f85['query']['filter']+'%'};return _0x5334a9;})});}_0x4e9407=_['merge']({},_0x4e9407,_0x5c7f85[_0x029a('0x4f')]);return _0x597c04[_0x029a('0x11a')](_0x4e9407);}})[_0x029a('0x37')](function(_0x247835){if(_0x247835){_0x4c5ecb=_0x247835[_0x029a('0x48')];if(!_0x5c7f85[_0x029a('0x44')][_0x029a('0x67')](_0x029a('0xf6'))){_0x4e9407[_0x029a('0x2e')]=qs[_0x029a('0x2e')](_0x5c7f85[_0x029a('0x44')][_0x029a('0x2e')]);_0x4e9407[_0x029a('0x30')]=qs[_0x029a('0x30')](_0x5c7f85[_0x029a('0x44')][_0x029a('0x30')]);}return _0x597c04[_0x029a('0x11a')](_0x4e9407);}})[_0x029a('0x37')](function(_0x2b102b){if(_0x2b102b){return _0x2b102b?{'count':_0x4c5ecb,'rows':_0x2b102b}:null;}})[_0x029a('0x37')](respondWithResult(_0x3bf2cd,null))[_0x029a('0x2b')](handleError(_0x3bf2cd,null));};exports['addProactiveActions']=function(_0x1f8609,_0x5b2a63,_0x2907b6){return db['chatProactiveAction'][_0x029a('0x5d')]({'where':{'id':_0x1f8609[_0x029a('0x62')]['id']}})['then'](handleEntityNotFound(_0x5b2a63,null))[_0x029a('0x37')](function(_0x170a02){if(_0x170a02){return _0x170a02['addProactiveActions'](_0x1f8609[_0x029a('0x61')]['ids'],_[_0x029a('0xf4')](_0x1f8609['body'],[_0x029a('0x6a'),'id'])||{});}})[_0x029a('0x37')](respondWithResult(_0x5b2a63,null))['catch'](handleError(_0x5b2a63,null));};exports[_0x029a('0x11b')]=function(_0x58c3a5,_0x3e0a02,_0x212de7){var _0x2cfd81={};var _0x2e90c6={};var _0x249245;var _0x3e00c6;return db[_0x029a('0x3f')][_0x029a('0x6d')]({'where':{'id':_0x58c3a5[_0x029a('0x62')]['id']}})['then'](handleEntityNotFound(_0x3e0a02,null))['then'](function(_0x176a8f){if(_0x176a8f){_0x249245=_0x176a8f;_0x2e90c6[_0x029a('0x43')]=_['keys'](db[_0x029a('0x11c')][_0x029a('0x40')]);_0x2e90c6['query']=_[_0x029a('0x57')](_0x58c3a5[_0x029a('0x44')]);_0x2e90c6[_0x029a('0x45')]=_[_0x029a('0x46')](_0x2e90c6[_0x029a('0x43')],_0x2e90c6[_0x029a('0x44')]);_0x2cfd81['attributes']=_[_0x029a('0x46')](_0x2e90c6['model'],qs[_0x029a('0x58')](_0x58c3a5[_0x029a('0x44')][_0x029a('0x58')]));_0x2cfd81[_0x029a('0x47')]=_0x2cfd81[_0x029a('0x47')][_0x029a('0x48')]?_0x2cfd81['attributes']:_0x2e90c6['model'];_0x2cfd81[_0x029a('0x49')]=qs[_0x029a('0x68')](_0x58c3a5[_0x029a('0x44')][_0x029a('0x68')]);_0x2cfd81[_0x029a('0x4c')]=qs['filters'](_['pick'](_0x58c3a5[_0x029a('0x44')],_0x2e90c6[_0x029a('0x45')]));if(_0x58c3a5['query'][_0x029a('0x4b')]){_0x2cfd81[_0x029a('0x4c')]=_[_0x029a('0x4d')](_0x2cfd81[_0x029a('0x4c')],{'$or':_['map'](_0x2cfd81[_0x029a('0x47')],function(_0x161a26){var _0x57e3e6={};_0x57e3e6[_0x161a26]={'$like':'%'+_0x58c3a5['query'][_0x029a('0x4b')]+'%'};return _0x57e3e6;})});}_0x2cfd81=_['merge']({},_0x2cfd81,_0x58c3a5[_0x029a('0x4f')]);return _0x249245['getProactiveActions'](_0x2cfd81);}})[_0x029a('0x37')](function(_0x323cd7){if(_0x323cd7){_0x3e00c6=_0x323cd7[_0x029a('0x48')];if(!_0x58c3a5[_0x029a('0x44')]['hasOwnProperty'](_0x029a('0xf6'))){_0x2cfd81[_0x029a('0x2e')]=qs[_0x029a('0x2e')](_0x58c3a5['query']['limit']);_0x2cfd81['offset']=qs[_0x029a('0x30')](_0x58c3a5[_0x029a('0x44')][_0x029a('0x30')]);}return _0x249245[_0x029a('0x11b')](_0x2cfd81);}})[_0x029a('0x37')](function(_0x39a734){if(_0x39a734){return _0x39a734?{'count':_0x3e00c6,'rows':_0x39a734}:null;}})[_0x029a('0x37')](respondWithResult(_0x3e0a02,null))[_0x029a('0x2b')](handleError(_0x3e0a02,null));};exports['getFields']=function(_0x5dba35,_0x5cc3d6,_0x59f473){var _0x5f1383=_0x5dba35[_0x029a('0x44')]['online']===_0x029a('0x11d')?_0x029a('0x11e'):'onlineForm';return db[_0x029a('0x3f')][_0x029a('0x5d')]({'attributes':['id',_0x5f1383],'where':{'id':_0x5dba35[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x5cc3d6,null))[_0x029a('0x37')](function(_0x2a0b08){if(_0x2a0b08){var _0x533799=_0x2a0b08[_0x5f1383];var _0x3e068f=_0x533799&&_0x533799[_0x029a('0x11f')]?_0x533799[_0x029a('0x11f')]:[];_0x5cc3d6[_0x029a('0x3d')]({'fromKey':_[_0x029a('0x81')](_0x533799[_0x029a('0x120')])?undefined:_0x533799[_0x029a('0x120')],'count':_0x3e068f['length'],'rows':_0x3e068f});}})[_0x029a('0x2b')](handleError(_0x5cc3d6,null));};exports['getOfflineMessages']=function(_0x4764fe,_0x39e5d1,_0x10f25e){var _0x35b3ba={'raw':![],'where':{}};var _0x56b93b={};var _0x4228c8={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x029a('0x6d')]({'where':{'id':_0x4764fe[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x39e5d1,null))['then'](function(_0x4fb4fe){if(_0x4fb4fe){_0x56b93b[_0x029a('0x43')]=_[_0x029a('0x57')](db[_0x029a('0xd8')][_0x029a('0x40')]);_0x56b93b[_0x029a('0x44')]=_[_0x029a('0x57')](_0x4764fe[_0x029a('0x44')]);_0x56b93b[_0x029a('0x45')]=_['intersection'](_0x56b93b[_0x029a('0x43')],_0x56b93b[_0x029a('0x44')]);_0x35b3ba[_0x029a('0x47')]=_[_0x029a('0x46')](_0x56b93b[_0x029a('0x43')],qs['fields'](_0x4764fe[_0x029a('0x44')][_0x029a('0x58')]));_0x35b3ba[_0x029a('0x47')]=_0x35b3ba[_0x029a('0x47')]['length']?_0x35b3ba[_0x029a('0x47')]:_0x56b93b['model'];if(!_0x4764fe['query'][_0x029a('0x67')](_0x029a('0xf6'))){_0x35b3ba[_0x029a('0x2e')]=qs[_0x029a('0x2e')](_0x4764fe[_0x029a('0x44')]['limit']);_0x35b3ba[_0x029a('0x30')]=qs[_0x029a('0x30')](_0x4764fe[_0x029a('0x44')][_0x029a('0x30')]);}_0x35b3ba['order']=qs[_0x029a('0x68')](_0x4764fe['query'][_0x029a('0x68')]);_0x35b3ba[_0x029a('0x4c')]=qs[_0x029a('0x45')](_[_0x029a('0x4a')](_0x4764fe[_0x029a('0x44')],_0x56b93b[_0x029a('0x45')]));_0x35b3ba[_0x029a('0x4c')][_0x029a('0x65')]=_0x4fb4fe['id'];if(_0x4764fe['query'][_0x029a('0x4b')]){_0x35b3ba[_0x029a('0x4c')]=_[_0x029a('0x4d')](_0x35b3ba[_0x029a('0x4c')],{'$or':_[_0x029a('0x3e')](_0x35b3ba[_0x029a('0x47')],function(_0x4fbb63){var _0x3ea2b2={};_0x3ea2b2[_0x4fbb63]={'$like':'%'+_0x4764fe[_0x029a('0x44')][_0x029a('0x4b')]+'%'};return _0x3ea2b2;})});}_0x35b3ba=_[_0x029a('0x4d')]({},_0x35b3ba,_0x4764fe[_0x029a('0x4f')]);return db[_0x029a('0xd8')]['count']({'where':_0x35b3ba[_0x029a('0x4c')]})[_0x029a('0x37')](function(_0x151258){_0x4228c8[_0x029a('0x2f')]=_0x151258;if(_0x4764fe[_0x029a('0x44')]['includeAll']){_0x35b3ba['include']=[{'all':!![]}];}else{_0x35b3ba[_0x029a('0x51')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x029a('0xde')],'as':_0x029a('0x121'),'required':![]}];}return db[_0x029a('0xd8')][_0x029a('0x52')](_0x35b3ba);})[_0x029a('0x37')](function(_0x42e4ee){_0x4228c8[_0x029a('0x53')]=_0x42e4ee;return _0x4228c8;});}})[_0x029a('0x37')](respondWithFilteredResult(_0x39e5d1,_0x35b3ba))[_0x029a('0x2b')](handleError(_0x39e5d1,null));};exports[_0x029a('0x122')]=function(_0x39a43d,_0x39b457,_0x473495){return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x39a43d[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x39b457,null))[_0x029a('0x37')](function(_0x482211){if(_0x482211){return _0x482211[_0x029a('0x122')](_0x39a43d[_0x029a('0x61')]['ids'],_[_0x029a('0xf4')](_0x39a43d['body'],[_0x029a('0x6a'),'id'])||{})['spread'](function(_0x3f5449){for(var _0x3acf27=0x0;_0x3acf27<_0x39a43d[_0x029a('0x61')][_0x029a('0x6a')][_0x029a('0x48')];_0x3acf27+=0x1){socket[_0x029a('0x123')](_0x029a('0x124'),{'UserId':Number(_0x39a43d[_0x029a('0x61')][_0x029a('0x6a')][_0x3acf27]),'ChatWebsiteId':Number(_0x39a43d['params']['id'])});}return _0x3f5449;});}})['then'](respondWithResult(_0x39b457,null))[_0x029a('0x2b')](handleError(_0x39b457,null));};exports[_0x029a('0x125')]=function(_0x95c850,_0x2751f1,_0x5bcd2a){return db[_0x029a('0x3f')][_0x029a('0x5d')]({'where':{'id':_0x95c850['params']['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x2751f1,null))[_0x029a('0x37')](function(_0x215b1e){if(_0x215b1e){return _0x215b1e['removeAgents'](_0x95c850[_0x029a('0x44')][_0x029a('0x6a')])[_0x029a('0x37')](function(){if(_[_0x029a('0x126')](_0x95c850[_0x029a('0x44')][_0x029a('0x6a')])){for(var _0x213d20=0x0;_0x213d20<_0x95c850[_0x029a('0x44')]['ids'][_0x029a('0x48')];_0x213d20+=0x1){socket[_0x029a('0x123')](_0x029a('0x127'),{'UserId':Number(_0x95c850['query'][_0x029a('0x6a')][_0x213d20]),'ChatWebsiteId':Number(_0x95c850[_0x029a('0x62')]['id'])});}}else{socket[_0x029a('0x123')](_0x029a('0x127'),{'UserId':Number(_0x95c850[_0x029a('0x44')][_0x029a('0x6a')]),'ChatWebsiteId':Number(_0x95c850[_0x029a('0x62')]['id'])});}});}})[_0x029a('0x37')](respondWithStatusCode(_0x2751f1,null))[_0x029a('0x2b')](handleError(_0x2751f1,null));};exports[_0x029a('0x128')]=function(_0x3a29b8,_0x56a38a,_0x302c1f){var _0x269427={};var _0x1eb0f6={};var _0x47c7fa;var _0x5f403b;return db[_0x029a('0x3f')]['findOne']({'where':{'id':_0x3a29b8[_0x029a('0x62')]['id']}})[_0x029a('0x37')](handleEntityNotFound(_0x56a38a,null))['then'](function(_0xa72199){if(_0xa72199){_0x47c7fa=_0xa72199;_0x1eb0f6[_0x029a('0x43')]=_[_0x029a('0x57')](db['User'][_0x029a('0x40')]);_0x1eb0f6[_0x029a('0x44')]=_[_0x029a('0x57')](_0x3a29b8[_0x029a('0x44')]);_0x1eb0f6['filters']=_[_0x029a('0x46')](_0x1eb0f6[_0x029a('0x43')],_0x1eb0f6[_0x029a('0x44')]);_0x269427[_0x029a('0x47')]=_['intersection'](_0x1eb0f6[_0x029a('0x43')],qs[_0x029a('0x58')](_0x3a29b8['query'][_0x029a('0x58')]));_0x269427[_0x029a('0x47')]=_0x269427[_0x029a('0x47')]['length']?_0x269427['attributes']:_0x1eb0f6[_0x029a('0x43')];_0x269427[_0x029a('0x49')]=qs['sort'](_0x3a29b8[_0x029a('0x44')]['sort']);_0x269427[_0x029a('0x4c')]=qs[_0x029a('0x45')](_[_0x029a('0x4a')](_0x3a29b8[_0x029a('0x44')],_0x1eb0f6[_0x029a('0x45')]));if(_0x3a29b8['query'][_0x029a('0x4b')]){_0x269427['where']=_[_0x029a('0x4d')](_0x269427[_0x029a('0x4c')],{'$or':_[_0x029a('0x3e')](_0x269427['attributes'],function(_0x4ba434){var _0x28c1dd={};_0x28c1dd[_0x4ba434]={'$like':'%'+_0x3a29b8[_0x029a('0x44')][_0x029a('0x4b')]+'%'};return _0x28c1dd;})});}_0x269427=_[_0x029a('0x4d')]({},_0x269427,_0x3a29b8[_0x029a('0x4f')]);return _0x47c7fa[_0x029a('0x128')](_0x269427);}})[_0x029a('0x37')](function(_0x21f19a){if(_0x21f19a){_0x5f403b=_0x21f19a[_0x029a('0x48')];if(!_0x3a29b8['query'][_0x029a('0x67')](_0x029a('0xf6'))){_0x269427[_0x029a('0x2e')]=qs[_0x029a('0x2e')](_0x3a29b8['query'][_0x029a('0x2e')]);_0x269427[_0x029a('0x30')]=qs[_0x029a('0x30')](_0x3a29b8[_0x029a('0x44')][_0x029a('0x30')]);}return _0x47c7fa['getAgents'](_0x269427);}})[_0x029a('0x37')](function(_0x29e3ae){if(_0x29e3ae){return _0x29e3ae?{'count':_0x5f403b,'rows':_0x29e3ae}:null;}})['then'](respondWithResult(_0x56a38a,null))[_0x029a('0x2b')](handleError(_0x56a38a,null));}; \ No newline at end of file +var _0x001c=['mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','updatedAt','Applications','applications','list','orderBy','priority','asc','account','cf-connecting-ip','headers','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','contact','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','files','CompanyId','mapKeyOffline','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','fullname','Tag','color','tag','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','No\x20timezone','inspect','Interval','Intervals','getProactiveActions','getLicense','virtual','License','all','some','remote','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','textColor','backgroundColor','ChatApplication','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','items','Attachments','addAgents','omit','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','rimraf','fast-json-patch','request-promise','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','get','ChatWebsites','UserProfileResource','end','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','custom','isNil','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','chat','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x6ce469,_0x30fa03){var _0x1bc184=function(_0x7a2465){while(--_0x7a2465){_0x6ce469['push'](_0x6ce469['shift']());}};_0x1bc184(++_0x30fa03);}(_0x001c,0x97));var _0xc001=function(_0x138298,_0x416266){_0x138298=_0x138298-0x0;var _0x1048db=_0x001c[_0x138298];return _0x1048db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc001('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc001('0x1'));var rp=require(_0xc001('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xc001('0x3'));var sox=require('sox');var csv=require(_0xc001('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc001('0x5'));var _=require(_0xc001('0x6'));var squel=require(_0xc001('0x7'));var crypto=require(_0xc001('0x8'));var jsforce=require(_0xc001('0x9'));var deskjs=require(_0xc001('0xa'));var toCsv=require(_0xc001('0x4'));var querystring=require(_0xc001('0xb'));var Papa=require(_0xc001('0xc'));var Redis=require('ioredis');var authService=require(_0xc001('0xd'));var qs=require(_0xc001('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc001('0xf'));var config=require(_0xc001('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xc001('0x11'))['db'];config[_0xc001('0x12')]=_[_0xc001('0x13')](config[_0xc001('0x12')],{'host':'localhost','port':0x18eb});var socket=require(_0xc001('0x14'))(new Redis(config[_0xc001('0x12')]));require(_0xc001('0x15'))[_0xc001('0x16')](socket);var jayson=require(_0xc001('0x17'));var client=jayson[_0xc001('0x18')][_0xc001('0x19')]({'port':0x232c});var client9002=jayson[_0xc001('0x18')][_0xc001('0x19')]({'port':0x232a});var client9003=jayson['client'][_0xc001('0x19')]({'port':0x232b});var client9001=jayson['client'][_0xc001('0x19')]({'port':0x2329});function respondWithRpcPromise(_0x32bfe4,_0x5dc6b6,_0x47208c,_0x41c0f2){return new BPromise(function(_0x474292,_0x26072e){var _0x53d018=_0x41c0f2||client;return _0x53d018['request'](_0x32bfe4,_0x47208c)['then'](function(_0x326077){logger[_0xc001('0x1a')](_0xc001('0x1b'),_0x5dc6b6,_0xc001('0x1c'));logger[_0xc001('0x1d')](_0xc001('0x1e'),_0x5dc6b6,'request\x20sent',JSON[_0xc001('0x1f')](_0x326077));if(_0x326077['error']){if(_0x326077[_0xc001('0x20')][_0xc001('0x21')]===0x1f4){logger[_0xc001('0x20')](_0xc001('0x1b'),_0x5dc6b6,_0x326077['error'][_0xc001('0x22')]);return _0x26072e(_0x326077[_0xc001('0x20')][_0xc001('0x22')]);}logger[_0xc001('0x20')](_0xc001('0x1b'),_0x5dc6b6,_0x326077[_0xc001('0x20')][_0xc001('0x22')]);return _0x474292(_0x326077[_0xc001('0x20')][_0xc001('0x22')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5dc6b6,_0xc001('0x1c'));_0x474292(_0x326077['result'][_0xc001('0x22')]);}})[_0xc001('0x23')](function(_0x44991f){logger['error'](_0xc001('0x1b'),_0x5dc6b6,_0x44991f);_0x26072e(_0x44991f);});});}function respondWithStatusCode(_0x127e25,_0x2b15ed){_0x2b15ed=_0x2b15ed||0xcc;return function(_0x1101c6){if(_0x1101c6){return _0x127e25[_0xc001('0x24')](_0x2b15ed);}return _0x127e25[_0xc001('0x25')](_0x2b15ed)['end']();};}function respondWithResult(_0x36b3c9,_0x4644e4){_0x4644e4=_0x4644e4||0xc8;return function(_0x363312){if(_0x363312){return _0x36b3c9['status'](_0x4644e4)[_0xc001('0x26')](_0x363312);}};}function respondWithFilteredResult(_0x2cb0c5,_0xb6ae39){return function(_0x1b3efe){if(_0x1b3efe){var _0x4a302a=typeof _0xb6ae39[_0xc001('0x27')]==='undefined'&&typeof _0xb6ae39['limit']===_0xc001('0x28');var _0x49f5a1=_0x1b3efe[_0xc001('0x29')];var _0x5c9367=_0x4a302a?0x0:_0xb6ae39[_0xc001('0x27')];var _0x74671c=_0x4a302a?_0x1b3efe[_0xc001('0x29')]:_0xb6ae39[_0xc001('0x27')]+_0xb6ae39[_0xc001('0x2a')];var _0x113acf;if(_0x74671c>=_0x49f5a1){_0x74671c=_0x49f5a1;_0x113acf=0xc8;}else{_0x113acf=0xce;}_0x2cb0c5[_0xc001('0x25')](_0x113acf);return _0x2cb0c5[_0xc001('0x2b')](_0xc001('0x2c'),_0x5c9367+'-'+_0x74671c+'/'+_0x49f5a1)['json'](_0x1b3efe);}return null;};}function patchUpdates(_0x16988a){return function(_0x494aad){try{jsonpatch[_0xc001('0x2d')](_0x494aad,_0x16988a,!![]);}catch(_0x2837a7){return BPromise[_0xc001('0x2e')](_0x2837a7);}return _0x494aad[_0xc001('0x2f')]();};}function saveUpdates(_0x2cc29d,_0x47921b){return function(_0x5f7b73){if(_0x5f7b73){return _0x5f7b73['update'](_0x2cc29d)['then'](function(_0x5e831e){return _0x5e831e;});}return null;};}function removeEntity(_0x548579,_0x560d4d){return function(_0xbdef8b){if(_0xbdef8b){return _0xbdef8b[_0xc001('0x30')]()[_0xc001('0x31')](function(){var _0x495a69=_0xbdef8b[_0xc001('0x32')]({'plain':!![]});var _0x593111=_0xc001('0x33');return db[_0xc001('0x34')]['destroy']({'where':{'type':_0x593111,'resourceId':_0x495a69['id']}})[_0xc001('0x31')](function(){return _0xbdef8b;});})[_0xc001('0x31')](function(){_0x548579[_0xc001('0x25')](0xcc)[_0xc001('0x35')]();});}};}function handleEntityNotFound(_0x5f3564,_0x186a38){return function(_0x56459a){if(!_0x56459a){_0x5f3564['sendStatus'](0x194);}return _0x56459a;};}function handleError(_0x2f9b69,_0x1943a4){_0x1943a4=_0x1943a4||0x1f4;return function(_0xefa360){logger[_0xc001('0x20')](_0xefa360['stack']);if(_0xefa360['name']){delete _0xefa360['name'];}_0x2f9b69[_0xc001('0x25')](_0x1943a4)[_0xc001('0x36')](_0xefa360);};}exports['index']=function(_0x50d49f,_0x295dac){var _0xd564f6={'include':[{'model':db[_0xc001('0x37')],'as':_0xc001('0x38')}]},_0x3c58f8={},_0x15b966={'count':0x0,'rows':[]};var _0x2ef905=_[_0xc001('0x39')](db[_0xc001('0x3a')][_0xc001('0x3b')],function(_0x7ea924){return{'name':_0x7ea924[_0xc001('0x3c')],'type':_0x7ea924[_0xc001('0x3d')]['key']};});_0x3c58f8[_0xc001('0x3e')]=_[_0xc001('0x39')](_0x2ef905,_0xc001('0x3f'));_0x3c58f8[_0xc001('0x40')]=_[_0xc001('0x41')](_0x50d49f['query']);_0x3c58f8[_0xc001('0x42')]=_['intersection'](_0x3c58f8['model'],_0x3c58f8['query']);_0xd564f6[_0xc001('0x43')]=_[_0xc001('0x44')](_0x3c58f8['model'],qs[_0xc001('0x45')](_0x50d49f[_0xc001('0x40')][_0xc001('0x45')]));_0xd564f6[_0xc001('0x43')]=_0xd564f6[_0xc001('0x43')][_0xc001('0x46')]?_0xd564f6[_0xc001('0x43')]:_0x3c58f8[_0xc001('0x3e')];if(!_0x50d49f[_0xc001('0x40')][_0xc001('0x47')](_0xc001('0x48'))){_0xd564f6[_0xc001('0x2a')]=qs['limit'](_0x50d49f[_0xc001('0x40')][_0xc001('0x2a')]);_0xd564f6[_0xc001('0x27')]=qs[_0xc001('0x27')](_0x50d49f['query'][_0xc001('0x27')]);}_0xd564f6[_0xc001('0x49')]=qs[_0xc001('0x4a')](_0x50d49f[_0xc001('0x40')][_0xc001('0x4a')]);_0xd564f6[_0xc001('0x4b')]=qs[_0xc001('0x42')](_[_0xc001('0x4c')](_0x50d49f[_0xc001('0x40')],_0x3c58f8[_0xc001('0x42')]),_0x2ef905);if(_0x50d49f[_0xc001('0x40')][_0xc001('0x4d')]){_0xd564f6[_0xc001('0x4b')]=_[_0xc001('0x4e')](_0xd564f6['where'],{'$or':_['map'](_0x2ef905,function(_0x3b4c36){if(_0x3b4c36[_0xc001('0x3d')]!==_0xc001('0x4f')){var _0xe405ce={};_0xe405ce[_0x3b4c36[_0xc001('0x3f')]]={'$like':'%'+_0x50d49f[_0xc001('0x40')][_0xc001('0x4d')]+'%'};return _0xe405ce;}})});}_0xd564f6=_['merge']({},_0xd564f6,_0x50d49f[_0xc001('0x50')]);var _0x1eef37={'where':_0xd564f6[_0xc001('0x4b')]};return db[_0xc001('0x3a')][_0xc001('0x29')](_0x1eef37)['then'](function(_0x204ebe){_0x15b966['count']=_0x204ebe;if(_0x50d49f['query'][_0xc001('0x51')]){_0xd564f6[_0xc001('0x52')]=[{'all':!![]}];}return db[_0xc001('0x3a')][_0xc001('0x53')](_0xd564f6);})[_0xc001('0x31')](function(_0x43e2e1){_0x15b966[_0xc001('0x54')]=_0x43e2e1;return _0x15b966;})['then'](respondWithFilteredResult(_0x295dac,_0xd564f6))[_0xc001('0x23')](handleError(_0x295dac,null));};exports[_0xc001('0x55')]=function(_0x3b5d8c,_0x497b56){var _0x1cd7da={'raw':![],'where':{'id':_0x3b5d8c[_0xc001('0x56')]['id']},'include':[{'model':db[_0xc001('0x37')],'as':_0xc001('0x38')}]},_0xa89d1d={};_0xa89d1d[_0xc001('0x3e')]=_[_0xc001('0x41')](db[_0xc001('0x3a')][_0xc001('0x3b')]);_0xa89d1d['query']=_[_0xc001('0x41')](_0x3b5d8c['query']);_0xa89d1d[_0xc001('0x42')]=_[_0xc001('0x44')](_0xa89d1d[_0xc001('0x3e')],_0xa89d1d[_0xc001('0x40')]);_0x1cd7da[_0xc001('0x43')]=_['intersection'](_0xa89d1d['model'],qs[_0xc001('0x45')](_0x3b5d8c[_0xc001('0x40')][_0xc001('0x45')]));_0x1cd7da[_0xc001('0x43')]=_0x1cd7da[_0xc001('0x43')]['length']?_0x1cd7da['attributes']:_0xa89d1d[_0xc001('0x3e')];if(_0x3b5d8c[_0xc001('0x40')][_0xc001('0x51')]){_0x1cd7da[_0xc001('0x52')]=[{'all':!![]}];}_0x1cd7da=_[_0xc001('0x4e')]({},_0x1cd7da,_0x3b5d8c[_0xc001('0x50')]);return db['ChatWebsite']['find'](_0x1cd7da)['then'](handleEntityNotFound(_0x497b56,null))['then'](respondWithResult(_0x497b56,null))[_0xc001('0x23')](handleError(_0x497b56,null));};exports['create']=function(_0x531d2c,_0x2b4ed1){return db[_0xc001('0x3a')][_0xc001('0x57')](_0x531d2c[_0xc001('0x58')],{})['then'](function(_0x79162){var _0x1605e6=_0x531d2c[_0xc001('0x59')][_0xc001('0x32')]({'plain':!![]});if(!_0x1605e6)throw new Error(_0xc001('0x5a'));if(_0x1605e6[_0xc001('0x5b')]===_0xc001('0x59')){var _0x28100b=_0x79162[_0xc001('0x32')]({'plain':!![]});var _0x29e594='ChatWebsites';return db['UserProfileSection'][_0xc001('0x5c')]({'where':{'name':_0x29e594,'userProfileId':_0x1605e6[_0xc001('0x5d')]},'raw':!![]})[_0xc001('0x31')](function(_0x4f3c97){if(_0x4f3c97&&_0x4f3c97[_0xc001('0x5e')]===0x0){return db['UserProfileResource'][_0xc001('0x57')]({'name':_0x28100b[_0xc001('0x3f')],'resourceId':_0x28100b['id'],'type':_0x4f3c97[_0xc001('0x3f')],'sectionId':_0x4f3c97['id']},{})[_0xc001('0x31')](function(){return _0x79162;});}else{return _0x79162;}})[_0xc001('0x23')](function(_0x2d6fe9){logger[_0xc001('0x20')](_0xc001('0x5f'),_0x2d6fe9);throw _0x2d6fe9;});}return _0x79162;})[_0xc001('0x31')](respondWithResult(_0x2b4ed1,0xc9))[_0xc001('0x23')](handleError(_0x2b4ed1,null));};exports[_0xc001('0x60')]=function(_0x53a96f,_0x499b93){if(_0x53a96f['body']['id']){delete _0x53a96f[_0xc001('0x58')]['id'];}return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0x53a96f[_0xc001('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xc001('0x38')}]})[_0xc001('0x31')](handleEntityNotFound(_0x499b93,null))[_0xc001('0x31')](saveUpdates(_0x53a96f[_0xc001('0x58')],null))[_0xc001('0x31')](respondWithResult(_0x499b93,null))[_0xc001('0x23')](handleError(_0x499b93,null));};exports[_0xc001('0x30')]=function(_0x4fead5,_0x10b7dc){return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0x4fead5[_0xc001('0x56')]['id']}})['then'](handleEntityNotFound(_0x10b7dc,null))[_0xc001('0x31')](removeEntity(_0x10b7dc,null))[_0xc001('0x23')](handleError(_0x10b7dc,null));};exports[_0xc001('0x61')]=function(_0x5d4dcc,_0x7ea385){return db[_0xc001('0x3a')][_0xc001('0x61')]()[_0xc001('0x31')](respondWithResult(_0x7ea385,null))['catch'](handleError(_0x7ea385,null));};exports[_0xc001('0x62')]=function(_0x58cc9e,_0x1ad75d,_0x2d61d4){if(_0x58cc9e[_0xc001('0x58')]['id']){delete _0x58cc9e[_0xc001('0x58')]['id'];}return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0x58cc9e[_0xc001('0x56')]['id']}})['then'](handleEntityNotFound(_0x1ad75d,null))[_0xc001('0x31')](function(_0x392467){if(_0x392467){_0x58cc9e[_0xc001('0x58')][_0xc001('0x63')]=_0x392467['id'];return db[_0xc001('0x64')]['create'](_0x58cc9e[_0xc001('0x58')]);}})[_0xc001('0x31')](respondWithResult(_0x1ad75d,null))[_0xc001('0x23')](handleError(_0x1ad75d,null));};exports[_0xc001('0x65')]=function(_0x410b9f,_0x2664a5,_0x13936b){var _0x49d97a={'raw':![],'where':{}};var _0x542ac5={};var _0x5d1d08={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xc001('0x66')]({'where':{'id':_0x410b9f['params']['id']}})['then'](handleEntityNotFound(_0x2664a5,null))[_0xc001('0x31')](function(_0x5663ee){if(_0x5663ee){_0x542ac5[_0xc001('0x3e')]=_[_0xc001('0x41')](db[_0xc001('0x64')][_0xc001('0x3b')]);_0x542ac5['query']=_['keys'](_0x410b9f[_0xc001('0x40')]);_0x542ac5['filters']=_[_0xc001('0x44')](_0x542ac5[_0xc001('0x3e')],_0x542ac5[_0xc001('0x40')]);_0x49d97a[_0xc001('0x43')]=_['intersection'](_0x542ac5[_0xc001('0x3e')],qs[_0xc001('0x45')](_0x410b9f['query']['fields']));_0x49d97a[_0xc001('0x43')]=_0x49d97a[_0xc001('0x43')][_0xc001('0x46')]?_0x49d97a[_0xc001('0x43')]:_0x542ac5[_0xc001('0x3e')];if(!_0x410b9f['query']['hasOwnProperty']('nolimit')){_0x49d97a[_0xc001('0x2a')]=qs['limit'](_0x410b9f['query']['limit']);_0x49d97a['offset']=qs[_0xc001('0x27')](_0x410b9f[_0xc001('0x40')][_0xc001('0x27')]);}_0x49d97a['order']=qs[_0xc001('0x4a')](_0x410b9f[_0xc001('0x40')][_0xc001('0x4a')]);_0x49d97a[_0xc001('0x4b')]=qs['filters'](_[_0xc001('0x4c')](_0x410b9f[_0xc001('0x40')],_0x542ac5['filters']));_0x49d97a[_0xc001('0x4b')]['ChatWebsiteId']=_0x5663ee['id'];if(_0x410b9f[_0xc001('0x40')]['filter']){_0x49d97a['where']=_[_0xc001('0x4e')](_0x49d97a['where'],{'$or':_['map'](_0x49d97a['attributes'],function(_0x260b6){var _0x54d07d={};_0x54d07d[_0x260b6]={'$like':'%'+_0x410b9f[_0xc001('0x40')][_0xc001('0x4d')]+'%'};return _0x54d07d;})});}_0x49d97a=_[_0xc001('0x4e')]({},_0x49d97a,_0x410b9f['options']);return db[_0xc001('0x64')][_0xc001('0x29')]({'where':_0x49d97a['where']})['then'](function(_0x10ddb7){_0x5d1d08[_0xc001('0x29')]=_0x10ddb7;if(_0x410b9f[_0xc001('0x40')][_0xc001('0x51')]){_0x49d97a[_0xc001('0x52')]=[{'all':!![]}];}return db[_0xc001('0x64')][_0xc001('0x53')](_0x49d97a);})[_0xc001('0x31')](function(_0x39660c){_0x5d1d08[_0xc001('0x54')]=_0x39660c;return _0x5d1d08;});}})['then'](respondWithFilteredResult(_0x2664a5,_0x49d97a))[_0xc001('0x23')](handleError(_0x2664a5,null));};exports[_0xc001('0x67')]=function(_0x28feba,_0x1f0cea,_0x5306f2){return db[_0xc001('0x3a')]['find']({'where':{'id':_0x28feba[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x1f0cea,null))['then'](function(_0x230872){if(_0x230872){return _0x230872[_0xc001('0x67')](_0x28feba[_0xc001('0x40')][_0xc001('0x68')]);}})[_0xc001('0x31')](respondWithStatusCode(_0x1f0cea,null))[_0xc001('0x23')](handleError(_0x1f0cea,null));};exports['addAnswer']=function(_0x3a78e9,_0x40c22e,_0x5b33b9){if(_0x3a78e9[_0xc001('0x58')]['id']){delete _0x3a78e9[_0xc001('0x58')]['id'];}return db['ChatWebsite'][_0xc001('0x5c')]({'where':{'id':_0x3a78e9[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x40c22e,null))['then'](function(_0x30dff3){if(_0x30dff3){_0x3a78e9['body'][_0xc001('0x63')]=_0x30dff3['id'];return db[_0xc001('0x69')]['create'](_0x3a78e9[_0xc001('0x58')]);}})[_0xc001('0x31')](respondWithResult(_0x40c22e,null))[_0xc001('0x23')](handleError(_0x40c22e,null));};exports[_0xc001('0x6a')]=function(_0x46a5f7,_0x508684,_0x181ea4){var _0x33d5c6={'raw':![],'where':{}};var _0x4e2481={};var _0xcecdb0={'count':0x0,'rows':[]};return db[_0xc001('0x3a')]['findOne']({'where':{'id':_0x46a5f7[_0xc001('0x56')]['id']}})['then'](handleEntityNotFound(_0x508684,null))[_0xc001('0x31')](function(_0x5e46ee){if(_0x5e46ee){_0x4e2481[_0xc001('0x3e')]=_['keys'](db[_0xc001('0x69')][_0xc001('0x3b')]);_0x4e2481[_0xc001('0x40')]=_[_0xc001('0x41')](_0x46a5f7[_0xc001('0x40')]);_0x4e2481[_0xc001('0x42')]=_[_0xc001('0x44')](_0x4e2481['model'],_0x4e2481[_0xc001('0x40')]);_0x33d5c6['attributes']=_[_0xc001('0x44')](_0x4e2481[_0xc001('0x3e')],qs[_0xc001('0x45')](_0x46a5f7[_0xc001('0x40')][_0xc001('0x45')]));_0x33d5c6['attributes']=_0x33d5c6[_0xc001('0x43')][_0xc001('0x46')]?_0x33d5c6[_0xc001('0x43')]:_0x4e2481['model'];if(!_0x46a5f7[_0xc001('0x40')][_0xc001('0x47')](_0xc001('0x48'))){_0x33d5c6[_0xc001('0x2a')]=qs[_0xc001('0x2a')](_0x46a5f7['query']['limit']);_0x33d5c6[_0xc001('0x27')]=qs[_0xc001('0x27')](_0x46a5f7[_0xc001('0x40')][_0xc001('0x27')]);}_0x33d5c6[_0xc001('0x49')]=qs['sort'](_0x46a5f7[_0xc001('0x40')]['sort']);_0x33d5c6[_0xc001('0x4b')]=qs[_0xc001('0x42')](_[_0xc001('0x4c')](_0x46a5f7[_0xc001('0x40')],_0x4e2481['filters']));_0x33d5c6[_0xc001('0x4b')][_0xc001('0x63')]=_0x5e46ee['id'];if(_0x46a5f7[_0xc001('0x40')][_0xc001('0x4d')]){_0x33d5c6['where']=_[_0xc001('0x4e')](_0x33d5c6['where'],{'$or':_['map'](_0x33d5c6[_0xc001('0x43')],function(_0x5cce2c){var _0x3684c0={};_0x3684c0[_0x5cce2c]={'$like':'%'+_0x46a5f7[_0xc001('0x40')][_0xc001('0x4d')]+'%'};return _0x3684c0;})});}_0x33d5c6=_['merge']({},_0x33d5c6,_0x46a5f7[_0xc001('0x50')]);return db['CannedAnswer'][_0xc001('0x29')]({'where':_0x33d5c6[_0xc001('0x4b')]})[_0xc001('0x31')](function(_0x13a195){_0xcecdb0['count']=_0x13a195;if(_0x46a5f7[_0xc001('0x40')][_0xc001('0x51')]){_0x33d5c6['include']=[{'all':!![]}];}return db[_0xc001('0x69')][_0xc001('0x53')](_0x33d5c6);})['then'](function(_0x4210d2){_0xcecdb0['rows']=_0x4210d2;return _0xcecdb0;});}})['then'](respondWithFilteredResult(_0x508684,_0x33d5c6))[_0xc001('0x23')](handleError(_0x508684,null));};exports[_0xc001('0x6b')]=function(_0x51ad23,_0x4d2bd4,_0x311cdc){return db[_0xc001('0x3a')]['find']({'where':{'id':_0x51ad23[_0xc001('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d2bd4,null))[_0xc001('0x31')](function(_0x1218e3){if(_0x1218e3){return _0x1218e3[_0xc001('0x6b')](_0x51ad23[_0xc001('0x40')][_0xc001('0x68')]);}})[_0xc001('0x31')](respondWithStatusCode(_0x4d2bd4,null))[_0xc001('0x23')](handleError(_0x4d2bd4,null));};exports['addLogo']=function(_0x1c20fe,_0x1508d2,_0x12ba1e){_0x1c20fe[_0xc001('0x58')]['sitepic']=_0x1c20fe[_0xc001('0x6c')]['filename'];return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0x1c20fe[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x1508d2,null))[_0xc001('0x31')](saveUpdates(_0x1c20fe[_0xc001('0x58')],null))['then'](respondWithResult(_0x1508d2,null))[_0xc001('0x23')](handleError(_0x1508d2,null));};exports[_0xc001('0x6d')]=function(_0x28fb0f,_0x4cac9f,_0x5924f0){_0x28fb0f[_0xc001('0x58')][_0xc001('0x6e')]=_0x28fb0f[_0xc001('0x6c')][_0xc001('0x6f')];return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0x28fb0f['params']['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x4cac9f,null))[_0xc001('0x31')](saveUpdates(_0x28fb0f[_0xc001('0x58')],null))[_0xc001('0x31')](respondWithResult(_0x4cac9f,null))[_0xc001('0x23')](handleError(_0x4cac9f,null));};exports[_0xc001('0x70')]=function(_0x227967,_0x22cad9,_0x236c78){_0x227967[_0xc001('0x58')][_0xc001('0x71')]=_0x227967[_0xc001('0x6c')]['filename'];return db['ChatWebsite'][_0xc001('0x5c')]({'where':{'id':_0x227967[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x22cad9,null))[_0xc001('0x31')](saveUpdates(_0x227967['body'],null))[_0xc001('0x31')](respondWithResult(_0x22cad9,null))[_0xc001('0x23')](handleError(_0x22cad9,null));};exports[_0xc001('0x72')]=function(_0x2092f4,_0x4b8743,_0x291fe8){_0x2092f4[_0xc001('0x58')][_0xc001('0x73')]=_0x2092f4[_0xc001('0x6c')][_0xc001('0x6f')];return db[_0xc001('0x3a')]['find']({'where':{'id':_0x2092f4[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x4b8743,null))[_0xc001('0x31')](saveUpdates(_0x2092f4[_0xc001('0x58')],null))[_0xc001('0x31')](respondWithResult(_0x4b8743,null))[_0xc001('0x23')](handleError(_0x4b8743,null));};exports['getLogo']=function(_0x4a4318,_0x5daf51,_0x1ee1dd){var _0x3e6ac9=path[_0xc001('0x74')](config['root'],_0xc001('0x75'));var _0x50e3a5={'where':{'id':_0x4a4318[_0xc001('0x56')]['id']},'attributes':['id',_0xc001('0x76')],'raw':!![]};var _0x311ac9=![];return require(_0xc001('0x77'))['getLicense']()[_0xc001('0x31')](function(_0x507788){if(_0x507788){_0x311ac9=_0x507788[_0xc001('0x78')];}})['then'](function(){return db[_0xc001('0x3a')][_0xc001('0x5c')](_0x50e3a5);})[_0xc001('0x31')](handleEntityNotFound(_0x5daf51,null))['then'](function(_0x454440){if(_0x454440){if(!_[_0xc001('0x79')](_0x454440['sitepic'])){if(fs[_0xc001('0x7a')](path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x7c'),_0x454440['sitepic']))&&_0x311ac9){_0x3e6ac9=path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x7c'),_0x454440[_0xc001('0x76')]);}}return _0x5daf51[_0xc001('0x7d')](_0x3e6ac9);}})['catch'](handleError(_0x5daf51,null));};exports['getAvatar']=function(_0xff3e5e,_0x493d60,_0x1e2a89){var _0x5ac7fb=path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x7e'));var _0x194fd4={'where':{'id':_0xff3e5e[_0xc001('0x56')]['id']},'attributes':['id',_0xc001('0x6e')],'raw':!![]};return db[_0xc001('0x3a')][_0xc001('0x5c')](_0x194fd4)[_0xc001('0x31')](handleEntityNotFound(_0x493d60,null))[_0xc001('0x31')](function(_0x384589){if(_0x384589){if(!_[_0xc001('0x79')](_0x384589['agentAvatar'])){if(fs[_0xc001('0x7a')](path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x7f'),_0x384589['agentAvatar']))){_0x5ac7fb=path[_0xc001('0x74')](config[_0xc001('0x7b')],'server/files/images/avatars/',_0x384589[_0xc001('0x6e')]);}}return _0x493d60[_0xc001('0x7d')](_0x5ac7fb);}})[_0xc001('0x23')](handleError(_0x493d60,null));};exports[_0xc001('0x80')]=function(_0xc152ca,_0x36c01d,_0x388e9f){var _0x5b857e=path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x81'));var _0x370fce={'where':{'id':_0xc152ca[_0xc001('0x56')]['id']},'attributes':['id','customerAvatar',_0xc001('0x82')],'raw':!![]};return db[_0xc001('0x3a')][_0xc001('0x5c')](_0x370fce)[_0xc001('0x31')](handleEntityNotFound(_0x36c01d,null))[_0xc001('0x31')](function(_0x2328e1){if(_0x2328e1){if(!_[_0xc001('0x79')](_0x2328e1['customerAvatar'])){if(fs[_0xc001('0x7a')](path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x7f'),_0x2328e1[_0xc001('0x71')]))&&_0x2328e1[_0xc001('0x82')]){_0x5b857e=path[_0xc001('0x74')](config['root'],_0xc001('0x7f'),_0x2328e1[_0xc001('0x71')]);}}return _0x36c01d[_0xc001('0x7d')](_0x5b857e);}})[_0xc001('0x23')](handleError(_0x36c01d,null));};exports[_0xc001('0x83')]=function(_0x1cf6cd,_0x5d42b5,_0x842f3){var _0x14e35a=path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x84'));var _0x3382f9={'where':{'id':_0x1cf6cd['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0xc001('0x3a')][_0xc001('0x5c')](_0x3382f9)[_0xc001('0x31')](handleEntityNotFound(_0x5d42b5,null))[_0xc001('0x31')](function(_0x31931d){if(_0x31931d){if(!_[_0xc001('0x79')](_0x31931d[_0xc001('0x73')])){if(fs[_0xc001('0x7a')](path['join'](config['root'],'server/files/images/avatars/',_0x31931d['systemAvatar']))){_0x14e35a=path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0x7f'),_0x31931d['systemAvatar']);}}return _0x5d42b5['download'](_0x14e35a);}})[_0xc001('0x23')](handleError(_0x5d42b5,null));};exports[_0xc001('0x85')]=function(_0x32fe20,_0x83d385,_0x1fe43b){var _0x5c69b5=require(_0xc001('0x86'));var _0xc7acae=new _0x5c69b5();var _0x154168=_0xc7acae[_0xc001('0x87')](_0x32fe20['headers'][_0xc001('0x88')])[_0xc001('0x89')]();var _0xac97e3={'body':_0x32fe20[_0xc001('0x58')],'channel':_0xc001('0x8a')};var _0x426771=[];var _0x1fcf73=[];var _0x164eae={};var _0x1c1399=![];return db[_0xc001('0x8b')][_0xc001('0x61')]()[_0xc001('0x31')](function(_0x347464){if(!_0x347464){throw new db[(_0xc001('0x8c'))][(_0xc001('0x8d'))](_0xc001('0x8e'));}_0x426771=_[_0xc001('0x8f')](_[_0xc001('0x41')](_0x347464),[_0xc001('0x90'),'updatedAt']);_0x1fcf73=_[_0xc001('0x8f')](_['keys'](_0x347464),['createdAt','updatedAt','CompanyId',_0xc001('0x91')]);if(_0x32fe20[_0xc001('0x58')]['id']){delete _0x32fe20[_0xc001('0x58')]['id'];}if(_[_0xc001('0x79')](_0x32fe20[_0xc001('0x58')][_0xc001('0x92')])){throw new db[(_0xc001('0x8c'))]['ValidationError'](_0xc001('0x93'));}if(_['isNil'](_0x32fe20[_0xc001('0x58')][_0xc001('0x58')])||_0x32fe20[_0xc001('0x58')][_0xc001('0x58')]===''){throw new db[(_0xc001('0x8c'))][(_0xc001('0x8d'))](_0xc001('0x94'));}if(_[_0xc001('0x79')](_0x32fe20[_0xc001('0x58')][_0xc001('0x95')])){throw new db['Sequelize']['ValidationError'](_0xc001('0x96')+_0x1fcf73);}if(!_['includes'](_0x1fcf73,_0x32fe20[_0xc001('0x58')]['mapKey'])){throw new db[(_0xc001('0x8c'))]['ValidationError'](_0xc001('0x97')+_0x1fcf73);}_0x164eae[_0x32fe20[_0xc001('0x58')][_0xc001('0x95')]]=_0x32fe20[_0xc001('0x58')][_0xc001('0x92')];})[_0xc001('0x31')](function(){return db['ChatWebsite'][_0xc001('0x5c')]({'where':{'id':_0x32fe20[_0xc001('0x56')]['id']},'include':[{'model':db[_0xc001('0x98')],'as':_0xc001('0x99'),'include':[{'model':db[_0xc001('0x8b')],'as':_0xc001('0x9a'),'where':_0x164eae,'limit':0x1,'order':[[_0xc001('0x9b'),'DESC']]}]},{'model':db['ChatApplication'],'as':_0xc001('0x9c')}]});})['then'](handleEntityNotFound(_0x83d385,null))[_0xc001('0x31')](function(_0x1fda25){if(_0x1fda25&&_0x1fda25['List']){_0xac97e3['account']=_0x1fda25;_0xac97e3[_0xc001('0x9d')]=_0x1fda25[_0xc001('0x9c')];_0xac97e3[_0xc001('0x9e')]=_0x1fda25[_0xc001('0x99')];_0xac97e3[_0xc001('0x9d')]=_[_0xc001('0x9f')](_0xac97e3[_0xc001('0x9d')],[_0xc001('0xa0')],[_0xc001('0xa1')]);if(_0xac97e3[_0xc001('0xa2')][_0xc001('0x9c')]){delete _0xac97e3[_0xc001('0xa2')][_0xc001('0x9c')];}if(_0xac97e3['account'][_0xc001('0x99')]&&_0xac97e3[_0xc001('0xa2')][_0xc001('0x99')]['Contacts']['length']){return _0xac97e3[_0xc001('0xa2')][_0xc001('0x99')][_0xc001('0x9a')][0x0];}var _0x4cb65a=_[_0xc001('0x13')](_0x32fe20[_0xc001('0x58')],{'firstName':_0x32fe20[_0xc001('0x58')][_0xc001('0x92')],'ListId':_0x1fda25[_0xc001('0x91')]});_0x4cb65a[_0x32fe20[_0xc001('0x58')][_0xc001('0x95')]]=_0x32fe20[_0xc001('0x58')][_0xc001('0x92')];return db[_0xc001('0x8b')][_0xc001('0x57')](_0x4cb65a,{'fields':_0x426771,'raw':!![]});}})[_0xc001('0x31')](handleEntityNotFound(_0x83d385,null))['then'](function(_0x2711f2){_0xac97e3['contact']=_0x2711f2;var _0xf957a8=_0x32fe20[_0xc001('0x58')]['customerIp'];if(_0x32fe20['headers'][_0xc001('0xa3')]){_0xf957a8=_0x32fe20[_0xc001('0xa4')][_0xc001('0xa3')];}else if(_0x32fe20[_0xc001('0xa4')]['x-forwarded-for']){_0xf957a8=_[_0xc001('0xa5')](_0x32fe20[_0xc001('0xa4')][_0xc001('0xa6')][_0xc001('0xa7')](','));}if(_0x2711f2){var _0x38dbf9={'ContactId':_0x2711f2['id'],'ChatWebsiteId':_0x32fe20[_0xc001('0x56')]['id'],'from':(_0x2711f2[_0xc001('0xa8')]||'')+'\x20'+(_0x2711f2[_0xc001('0xa9')]||''),'customerIp':_0xf957a8,'customerPort':_0x32fe20[_0xc001('0xa4')][_0xc001('0xaa')]?_0x32fe20[_0xc001('0xa4')][_0xc001('0xaa')]:null,'referer':_0x32fe20[_0xc001('0x58')][_0xc001('0xab')],'browserName':_0x154168[_0xc001('0xac')][_0xc001('0x3f')]&&_0x154168['browser'][_0xc001('0xad')]?util[_0xc001('0xae')](_0xc001('0xaf'),_0x154168[_0xc001('0xac')][_0xc001('0x3f')],_0x154168[_0xc001('0xac')]['version']):_0xc001('0xb0'),'browserVersion':_0x154168[_0xc001('0xac')][_0xc001('0xad')]||'unknown','osName':util[_0xc001('0xae')](_0xc001('0xaf'),_0x154168['os'][_0xc001('0x3f')],_0x154168['os']['version']),'osVersion':_0x154168['os']['version'],'deviceModel':_0x154168[_0xc001('0xb1')][_0xc001('0x3e')]&&_0x154168[_0xc001('0xb1')][_0xc001('0xb2')]?util[_0xc001('0xae')](_0xc001('0xb3'),_0x154168[_0xc001('0xb1')][_0xc001('0x3e')],_0x154168[_0xc001('0xb1')]['vendor'],_0x154168['device'][_0xc001('0x3d')]):null,'deviceVendor':_0x154168['device']['vendor'],'deviceType':_0x154168['device']['type'],'formData':JSON[_0xc001('0x1f')](_0x32fe20[_0xc001('0x58')])};var _0x353377={'ChatWebsiteId':_0x32fe20['params']['id'],'closed':![]};if(_0x32fe20['body']['threadId']){_0x353377[_0xc001('0xb4')]=_0x32fe20[_0xc001('0x58')][_0xc001('0xb4')];return db[_0xc001('0xb5')][_0xc001('0x5c')]({'where':_0x353377})[_0xc001('0x31')](function(_0x33032f){if(_0x33032f){return[_0x33032f,![]];}_0x38dbf9[_0xc001('0xb4')]=_0x32fe20['body'][_0xc001('0xb4')];_0x38dbf9[_0xc001('0xb6')]=_0x32fe20[_0xc001('0x58')][_0xc001('0xb6')];return db[_0xc001('0xb5')]['create'](_0x38dbf9)[_0xc001('0x31')](function(_0x4c1d90){return[_0x4c1d90,!![]];});});}_0x353377[_0xc001('0xb7')]=_0x2711f2['id'];if(_0x32fe20[_0xc001('0x58')][_0xc001('0xb8')]&&_0x32fe20[_0xc001('0x58')][_0xc001('0xb8')]['id']){_0x353377['id']=_0x32fe20[_0xc001('0x58')][_0xc001('0xb8')]['id'];return db['ChatInteraction'][_0xc001('0x5c')]({'where':_0x353377})['then'](function(_0xa48c45){if(_0xa48c45){return[_0xa48c45,![]];}return db[_0xc001('0xb5')][_0xc001('0x57')](_0x38dbf9)[_0xc001('0x31')](function(_0x6d802b){return[_0x6d802b,!![]];});});}return db['ChatInteraction'][_0xc001('0x57')](_0x38dbf9)[_0xc001('0x31')](function(_0x204271){return[_0x204271,!![]];});}})[_0xc001('0xb9')](function(_0x269d4f,_0x34f730){if(_0x269d4f){_0x1c1399=_0x34f730;if(!_0x34f730){var _0x9bf407={'from':(_0xac97e3[_0xc001('0xba')][_0xc001('0xa8')]||'')+'\x20'+(_0xac97e3[_0xc001('0xba')][_0xc001('0xa9')]||'')};if(_0x32fe20[_0xc001('0x58')][_0xc001('0xb4')]&&_0x32fe20[_0xc001('0x58')][_0xc001('0xbb')]&&_0x32fe20['body'][_0xc001('0xb4')]!=_0x32fe20[_0xc001('0x58')]['messageId']){_0x9bf407['threadId']=_0x32fe20[_0xc001('0x58')][_0xc001('0xbb')];}return _0x269d4f[_0xc001('0x60')](_0x9bf407);}else{return _0x269d4f;}}})[_0xc001('0x31')](function(_0x21f3c7){_0xac97e3[_0xc001('0xb8')]=_0x21f3c7[_0xc001('0x32')]({'plain':!![]});_0xac97e3[_0xc001('0xb8')][_0xc001('0xbc')]=_0x1c1399;if(_0xac97e3['interaction'][_0xc001('0xbc')]){if(_0xac97e3[_0xc001('0xa2')][_0xc001('0xbd')]){_0xac97e3[_0xc001('0x9d')][_0xc001('0xbe')]({'id':0x0,'priority':_0xac97e3[_0xc001('0x9d')][_0xc001('0x46')]+0x1,'app':_0xc001('0xbf'),'appdata':'unmanaged','interval':_0xc001('0xc0')});}}return db[_0xc001('0xc1')]['create']({'body':_0x32fe20['body']['body'],'ChatWebsiteId':_0x32fe20[_0xc001('0x56')]['id'],'ChatInteractionId':_0x21f3c7['id'],'direction':'in','ContactId':_0xac97e3[_0xc001('0xba')]['id'],'AttachmentId':_0x32fe20[_0xc001('0x58')][_0xc001('0xc2')]});})['then'](function(_0x438001){_0xac97e3['message']=_0x438001;if(_0xac97e3[_0xc001('0xb8')]['UserId']){return db[_0xc001('0xc3')]['find']({'attributes':['id','name'],'where':{'id':_0xac97e3['interaction'][_0xc001('0xc4')]}})[_0xc001('0x31')](function(_0x4f1390){if(_0x4f1390){_0xac97e3['applications'][_0xc001('0xc5')]({'id':0x0,'priority':0x0,'app':_0xc001('0xc6'),'appdata':_0x4f1390[_0xc001('0x3f')]+','+(_0xac97e3[_0xc001('0xa2')][_0xc001('0xc7')]||0xa),'interval':'*,*,*,*'});_0xac97e3[_0xc001('0xc8')]=!![];}return respondWithRpcPromise(_0xc001('0xc9'),_0xc001('0xca'),_0xac97e3);});}return respondWithRpcPromise('Start',_0xc001('0xca'),_0xac97e3);})[_0xc001('0x31')](function(_0x4d172c){respondWithRpcPromise(_0xc001('0xcb'),_0xc001('0xcb'),{'event':_0xc001('0x85'),'message':_0x4d172c},client9002);return _0x4d172c;})[_0xc001('0x31')](respondWithResult(_0x83d385,null))[_0xc001('0x23')](handleError(_0x83d385,null));};exports['offline']=function(_0x17c45f,_0x1b070a,_0x7b07f3){var _0x479650,_0x27d895,_0x1a23e0;var _0x1c7e3f=[];var _0x10ff2c=[];var _0xd6c016={};var _0x5ca51c=_0x17c45f[_0xc001('0xcc')]||[];var _0x427284=[];var _0x8f0b2e;return db[_0xc001('0x8b')][_0xc001('0x61')]()[_0xc001('0x31')](function(_0x44614d){if(!_0x44614d){throw new db['Sequelize'][(_0xc001('0x8d'))](_0xc001('0x8e'));}_0x10ff2c=_[_0xc001('0x8f')](_[_0xc001('0x41')](_0x44614d),[_0xc001('0x90'),'updatedAt']);_0x1c7e3f=_[_0xc001('0x8f')](_[_0xc001('0x41')](_0x44614d),[_0xc001('0x90'),_0xc001('0x9b'),_0xc001('0xcd'),_0xc001('0x91')]);if(_0x17c45f[_0xc001('0x58')]['id']){delete _0x17c45f[_0xc001('0x58')]['id'];}if(_[_0xc001('0x79')](_0x17c45f['body'][_0xc001('0x92')])){throw _0x1b070a[_0xc001('0x25')](0x1f4)[_0xc001('0x36')](new db[(_0xc001('0x8c'))][(_0xc001('0x8d'))](_0xc001('0x93')));}if(_[_0xc001('0x79')](_0x17c45f[_0xc001('0x58')][_0xc001('0x58')])||_0x17c45f['body'][_0xc001('0x58')]===''){throw _0x1b070a[_0xc001('0x25')](0x1f4)[_0xc001('0x36')](new db['Sequelize'][(_0xc001('0x8d'))](_0xc001('0x94')));}if(_[_0xc001('0x79')](_0x17c45f['body'][_0xc001('0xce')])){throw _0x1b070a['status'](0x1f4)[_0xc001('0x36')](new db['Sequelize'][(_0xc001('0x8d'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c7e3f));}if(!_[_0xc001('0xcf')](_0x1c7e3f,_0x17c45f['body']['mapKeyOffline'])){throw _0x1b070a[_0xc001('0x25')](0x1f4)[_0xc001('0x36')](new db['Sequelize']['ValidationError'](_0xc001('0xd0')+_0x1c7e3f));}_0xd6c016[_0x17c45f['body'][_0xc001('0xce')]]=_0x17c45f[_0xc001('0x58')][_0xc001('0x92')];})[_0xc001('0x31')](function(){return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0x17c45f[_0xc001('0x56')]['id']},'include':[{'model':db[_0xc001('0x98')],'as':_0xc001('0x99')},{'model':db[_0xc001('0xd1')],'as':_0xc001('0xd1')}]});})[_0xc001('0x31')](handleEntityNotFound(_0x1b070a,null))[_0xc001('0x31')](function(_0x248915){if(_0x248915&&_0x248915[_0xc001('0x99')]){_0x27d895=_0x248915;var _0x36b1bc=_[_0xc001('0x13')](_0x17c45f[_0xc001('0x58')],{'firstName':_0x17c45f[_0xc001('0x58')][_0xc001('0x92')],'phone':_0x17c45f[_0xc001('0x58')]['from'],'ListId':_0x248915[_0xc001('0x91')]});_0x36b1bc[_0x17c45f['body'][_0xc001('0xce')]]=_0x17c45f[_0xc001('0x58')][_0xc001('0x92')];return db[_0xc001('0x8b')]['findOrCreate']({'where':_0xd6c016,'defaults':_0x36b1bc});}})['spread'](function(_0x29f0a3){if(_0x29f0a3){_0x1a23e0=_0x29f0a3;var _0x4a4ab2=fs[_0xc001('0xd2')](path[_0xc001('0x74')](config[_0xc001('0x7b')],_0xc001('0xd3')),_0xc001('0xd4'));var _0x58549c=ejs['render'](_0x4a4ab2,{'body':_['toPairs'](_0x17c45f[_0xc001('0x58')][_0xc001('0x58')]),'bodyTitle':_0x27d895[_0xc001('0xd5')]});return db[_0xc001('0xd6')]['create']({'body':_0x58549c,'ContactId':_0x29f0a3['id'],'ChatWebsiteId':_0x27d895['id']});}})[_0xc001('0x31')](function(_0x37c3df){_0x8f0b2e=_0x37c3df;if(_0x5ca51c[_0xc001('0x46')]){var _0xf94de9=_0x5ca51c[_0xc001('0x39')](function(_0x43bd36){return{'name':_0x43bd36[_0xc001('0xd7')],'basename':_0x43bd36[_0xc001('0x6f')],'type':_0x43bd36['mimetype'],'ChatOfflineMessageId':_0x37c3df['id']};});_0x427284=_0xf94de9['map'](_0x406464=>{var _0x46e166={'filename':_0x406464[_0xc001('0x3f')],'path':path[_0xc001('0x74')](config['root'],_0xc001('0xd8'),_0xc001('0xcc'),_0xc001('0xd9'),'offline-chat',_0x406464[_0xc001('0xda')])};return _0x46e166;});if(!_0x27d895[_0xc001('0xdb')]){return db[_0xc001('0xdc')][_0xc001('0xdd')](function(_0x4e2d8f){return db[_0xc001('0xde')][_0xc001('0xdf')](_0xf94de9,{'transaction':_0x4e2d8f});});}}})[_0xc001('0x31')](function(){if(_0x8f0b2e){_0x479650=_0x8f0b2e;return db[_0xc001('0xd1')][_0xc001('0x66')]({'where':{'active':!![]},'include':[{'model':db[_0xc001('0xe0')],'as':_0xc001('0xe1'),'raw':!![]}]});}})['then'](function(_0x5ea77c){if(_0x5ea77c&&_0x5ea77c['Smtp']&&_0x27d895[_0xc001('0xe2')]&&_0x27d895['forwardOfflineAddress']){var _0x44e2a8={'tls':{'rejectUnauthorized':![]}};if(_0x5ea77c['Smtp'][_0xc001('0xe3')]){_0x44e2a8[_0xc001('0xe3')]=_0x5ea77c[_0xc001('0xe1')][_0xc001('0xe3')];}else{_0x44e2a8[_0xc001('0xe4')]=_0x5ea77c[_0xc001('0xe1')][_0xc001('0xe4')];_0x44e2a8[_0xc001('0xe5')]=_0x5ea77c[_0xc001('0xe1')][_0xc001('0xe5')];_0x44e2a8[_0xc001('0xe6')]=_0x5ea77c['Smtp'][_0xc001('0xe6')];}if(_0x5ea77c[_0xc001('0xe1')][_0xc001('0xe7')]){_0x44e2a8[_0xc001('0xe8')]={'user':_0x5ea77c[_0xc001('0xe1')][_0xc001('0x59')],'pass':_0x5ea77c[_0xc001('0xe1')][_0xc001('0xe9')]};}return respondWithRpcPromise(_0xc001('0xea'),_0xc001('0xeb'),{'account':_0x44e2a8,'message':{'from':util[_0xc001('0xae')]('\x22%s\x22\x20<%s>',_0x5ea77c[_0xc001('0x3f')],_0x5ea77c[_0xc001('0xec')]||_0x5ea77c[_0xc001('0xe1')]['user']),'to':_0x27d895['forwardOfflineAddress'],'subject':_0x27d895[_0xc001('0xed')],'html':_0x479650[_0xc001('0x58')],'attachments':_0x427284}},client9003)['then'](function(){return _0x479650;})['catch'](function(_0x3a9ac4){console[_0xc001('0x20')](_0x3a9ac4);});}})[_0xc001('0x31')](function(){if(_0x27d895&&_0x27d895[_0xc001('0xdb')]&&_0x27d895[_0xc001('0xee')]){var _0x57b89d=[];if(_0x5ca51c[_0xc001('0x46')]){_0x57b89d=_0x5ca51c[_0xc001('0x39')](function(_0x5e523b){return{'name':_0x5e523b[_0xc001('0xd7')],'basename':_0x5e523b[_0xc001('0x6f')],'type':_0x5e523b[_0xc001('0xef')],'ChatOfflineMessageId':_0x8f0b2e['id']};});}var _0x384428;if(!_[_0xc001('0x79')](_0x27d895[_0xc001('0xf0')])){var _0x2525e5=_[_0xc001('0x39')](_0x17c45f[_0xc001('0x58')],function(_0x5eb22b){return _0x5eb22b;});var _0xb6517c=_[_0xc001('0xf1')](_0x2525e5)[0x0];var _0x2270f5=_['mapValues'](_0xb6517c,function(_0x214239){return _0x214239;});_0x384428=_0x2270f5[0x1][_0x27d895[_0xc001('0xf0')]];}var _0x1393b4={'from':_0x1a23e0[_0xc001('0xec')],'firstName':_0x1a23e0[_0xc001('0xa8')],'lastName':_0x1a23e0[_0xc001('0xa9')],'mapKey':'email','message':{'from':_0x1a23e0[_0xc001('0xec')],'to':_0x27d895[_0xc001('0xd1')][_0xc001('0xec')],'cc':'','subject':_['isNil'](_0x384428)?_0x27d895[_0xc001('0xed')]:_0x384428,'messageId':'','sentAt':new Date(),'attach':_0x57b89d[_0xc001('0x46')],'attachments':_0x57b89d,'originChannel':_0xc001('0xf2'),'ChatWebsiteId':_0x27d895['id'],'ChatOfflineMessageId':_0x479650['id'],'originTo':_0x27d895[_0xc001('0xd1')][_0xc001('0xec')]},'body':_0x479650[_0xc001('0x58')]};var _0x3e6485={'account':{'id':_0x27d895['MailAccountId']},'body':_0x1393b4,'log':_0xc001('0xf3')};return respondWithRpcPromise(_0xc001('0xf3'),_0xc001('0xf4'),_0x3e6485,client9001)[_0xc001('0x31')](function(){return _0x479650;})['catch'](function(_0x48bed7){console[_0xc001('0x20')](_0x48bed7);});}return;})[_0xc001('0x31')](function(){if(_0x479650){return _0x479650;}})[_0xc001('0x31')](respondWithResult(_0x1b070a,null))[_0xc001('0x23')](function(_0x450d45){console[_0xc001('0x20')](_0xc001('0x23'),_0x450d45);for(var _0x397cf5 of _0x5ca51c){var _0x99e03d=path['join'](config[_0xc001('0x7b')],_0xc001('0xd8'),_0xc001('0xcc'),_0xc001('0xd9'),'offline-chat',_0x397cf5[_0xc001('0x6f')]);fs_extra['remove'](_0x99e03d)[_0xc001('0x23')](function(_0x2279de){console[_0xc001('0x20')](_0xc001('0xf5'),_0x99e03d,_0x2279de);});}});};exports[_0xc001('0xf6')]=function(_0x342ec6,_0x5ac781,_0x423f82){return db[_0xc001('0xb5')]['find']({'where':{'id':_0x342ec6['params']['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x5ac781,null))[_0xc001('0x31')](function(_0x2b0c2){if(_0x2b0c2){return _0x2b0c2[_0xc001('0xf6')](_0x342ec6[_0xc001('0x58')][_0xc001('0x68')],_['omit'](_0x342ec6[_0xc001('0x58')],[_0xc001('0x68'),'id'])||{});}})['then'](respondWithResult(_0x5ac781,null))['catch'](handleError(_0x5ac781,null));};exports[_0xc001('0xf7')]=function(_0x1121e9,_0x1a9b6d,_0x39c01a){var _0x340f00={'raw':![],'where':{}};var _0x27690c={};var _0x5b1f59={'count':0x0,'rows':[]};return db[_0xc001('0x3a')]['findOne']({'where':{'id':_0x1121e9['params']['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x1a9b6d,null))['then'](function(_0x130bf4){if(_0x130bf4){_0x27690c[_0xc001('0x3e')]=_[_0xc001('0x41')](db[_0xc001('0xb5')]['rawAttributes']);_0x27690c[_0xc001('0x40')]=_[_0xc001('0x41')](_0x1121e9['query']);_0x27690c[_0xc001('0x42')]=_[_0xc001('0x44')](_0x27690c[_0xc001('0x3e')],_0x27690c[_0xc001('0x40')]);_0x340f00[_0xc001('0x43')]=_[_0xc001('0x44')](_0x27690c[_0xc001('0x3e')],qs[_0xc001('0x45')](_0x1121e9[_0xc001('0x40')][_0xc001('0x45')]));_0x340f00[_0xc001('0x43')]=_0x340f00[_0xc001('0x43')]['length']?_0x340f00[_0xc001('0x43')]:_0x27690c[_0xc001('0x3e')];if(!_0x1121e9[_0xc001('0x40')][_0xc001('0x47')]('nolimit')){_0x340f00['limit']=qs['limit'](_0x1121e9['query'][_0xc001('0x2a')]);_0x340f00[_0xc001('0x27')]=qs[_0xc001('0x27')](_0x1121e9['query'][_0xc001('0x27')]);}_0x340f00[_0xc001('0x49')]=qs[_0xc001('0x4a')](_0x1121e9[_0xc001('0x40')][_0xc001('0x4a')]);_0x340f00[_0xc001('0x4b')]=qs[_0xc001('0x42')](_[_0xc001('0x4c')](_0x1121e9[_0xc001('0x40')],_0x27690c[_0xc001('0x42')]));_0x340f00[_0xc001('0x4b')][_0xc001('0x63')]=_0x130bf4['id'];if(_0x1121e9[_0xc001('0x40')][_0xc001('0x4d')]){_0x340f00[_0xc001('0x4b')]=_[_0xc001('0x4e')](_0x340f00[_0xc001('0x4b')],{'$or':_[_0xc001('0x39')](_0x340f00[_0xc001('0x43')],function(_0x3c5720){var _0x1ca806={};_0x1ca806[_0x3c5720]={'$like':'%'+_0x1121e9['query'][_0xc001('0x4d')]+'%'};return _0x1ca806;})});}_0x340f00=_['merge']({},_0x340f00,_0x1121e9[_0xc001('0x50')]);return db[_0xc001('0xb5')]['count']({'where':_0x340f00[_0xc001('0x4b')]})[_0xc001('0x31')](function(_0x1d3d52){_0x5b1f59['count']=_0x1d3d52;if(_0x1121e9[_0xc001('0x40')][_0xc001('0x51')]){_0x340f00[_0xc001('0x52')]=[{'model':db[_0xc001('0x8b')],'as':_0xc001('0xf8'),'required':![]},{'model':db[_0xc001('0xc3')],'as':'Owner','attributes':[_0xc001('0x3f'),_0xc001('0xf9'),'internal'],'required':![]},{'model':db[_0xc001('0xfa')],'as':'Tags','attributes':['id',_0xc001('0x3f'),_0xc001('0xfb')],'where':_0x1121e9[_0xc001('0x40')][_0xc001('0xfc')]?{'id':_0x1121e9['query']['tag']}:undefined,'required':_0x1121e9[_0xc001('0x40')]['tag']?!![]:![]}];}return db[_0xc001('0xb5')][_0xc001('0x53')](_0x340f00);})[_0xc001('0x31')](function(_0x459ac3){_0x5b1f59[_0xc001('0x54')]=_0x459ac3;return _0x5b1f59;});}})[_0xc001('0x31')](respondWithFilteredResult(_0x1a9b6d,_0x340f00))['catch'](handleError(_0x1a9b6d,null));};function iftimePromise(_0x45272e,_0xfc5be2){return respondWithRpcPromise('Command',_0xc001('0xfd'),{'command':_0xfc5be2[_0xc001('0xfe')]?util['format'](_0xc001('0xff'),_0x45272e[_0xc001('0x100')],_0xfc5be2[_0xc001('0xfe')]):util[_0xc001('0xae')](_0xc001('0x101'),_0x45272e[_0xc001('0x100')])},client9002)[_0xc001('0x31')](function(_0x5c2858){var _0x599f44=_0x5c2858&&_0x5c2858[_0xc001('0x102')](_0xc001('0x103'))>=0x0?!![]:![];logger[_0xc001('0x1a')](_0xc001('0x104'),_0xfc5be2['id'],_0x45272e['id'],_0x45272e[_0xc001('0x100')],_0x599f44?_0xc001('0x105'):'OFFLINE',_0xfc5be2[_0xc001('0xfe')]?_0xfc5be2[_0xc001('0xfe')]:_0xc001('0x106'));return _0x599f44;})[_0xc001('0x23')](function(_0x5e6ab3){logger[_0xc001('0x20')](_0xc001('0x104'),_0xfc5be2['id'],_0x45272e['id'],_0x45272e[_0xc001('0x100')],util[_0xc001('0x107')](_0x5e6ab3,{'showHidden':![],'depth':null}),_0xfc5be2['timezone']?_0xfc5be2[_0xc001('0xfe')]:_0xc001('0x106'));return![];});}exports[_0xc001('0xfd')]=function(_0x122d2d,_0x3eda23,_0x38594e){var _0x2bfe07=0x0;var _0x45f2e9=0x0;var _0x149992=![];var _0x2a1e6c;var _0x54c5eb;return db['ChatWebsite'][_0xc001('0x5c')]({'where':{'id':_0x122d2d[_0xc001('0x56')]['id']},'include':[{'model':db[_0xc001('0x108')],'as':_0xc001('0x108'),'include':[{'model':db[_0xc001('0x108')],'as':_0xc001('0x109'),'attributes':['id',_0xc001('0x100')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x3eda23,null))[_0xc001('0x31')](function(_0x5e93cc){if(_0x5e93cc){_0x2a1e6c=_0x5e93cc;return _0x5e93cc[_0xc001('0x10a')]({'raw':!![]});}})[_0xc001('0x31')](function(_0xb215f0){if(_0x2a1e6c){if(_0xb215f0){_0x54c5eb=_0xb215f0;}}return require(_0xc001('0x77'))[_0xc001('0x10b')]();})['then'](function(_0x39bc13){if(_0x39bc13){_0x45f2e9=_0x39bc13[_0xc001('0x10c')];_0x149992=_0x39bc13[_0xc001('0x78')];}})[_0xc001('0x31')](function(){return db['ChatInteraction'][_0xc001('0x29')]({'where':{'closed':![]}});})[_0xc001('0x31')](function(_0x5d1990){_0x2bfe07=_0x5d1990;if(_0x45f2e9&&_0x5d1990>_0x45f2e9){return db[_0xc001('0x10d')]['findOne']({'where':{'id':0x1}})['then'](function(_0x452b38){if(_0x452b38){_0x452b38['increment']('chatLicenseExceeded');}});}})['then'](function(){if(_0x2a1e6c[_0xc001('0x108')]&&_0x2a1e6c['Interval'][_0xc001('0x109')]){var _0x5dc5e0=[];for(var _0x158f4b=0x0;_0x158f4b<_0x2a1e6c[_0xc001('0x108')][_0xc001('0x109')][_0xc001('0x46')];_0x158f4b++){var _0x561257=_0x2a1e6c[_0xc001('0x108')][_0xc001('0x109')][_0x158f4b][_0xc001('0x32')]({'plain':!![]});_0x5dc5e0['push'](iftimePromise(_0x561257,_0x2a1e6c));}return BPromise[_0xc001('0x10e')](_0x5dc5e0)[_0xc001('0x31')](function(_0x10578b){return _[_0xc001('0x10f')](_0x10578b);});}else{return!![];}})[_0xc001('0x31')](function(_0x2c66ca){var _0x23ec26=fs[_0xc001('0xd2')](path[_0xc001('0x74')](config['root'],'server/files/chat/iframe.ejs'),_0xc001('0xd4'));var _0xfe5e5b={'remote':_0x2a1e6c[_0xc001('0x110')],'query':querystring[_0xc001('0x1f')](_[_0xc001('0x4e')](_0x2a1e6c[_0xc001('0x32')]({'plain':!![]}),{'customerIp':_0x122d2d[_0xc001('0xa4')][_0xc001('0xa6')]||_0x122d2d[_0xc001('0xa4')][_0xc001('0x111')]||_0x122d2d[_0xc001('0x112')][_0xc001('0x113')]||_0x122d2d['ip'],'referer':_0x122d2d[_0xc001('0xa4')]['referer'],'openedInteractions':_0x2bfe07,'maxInteractions':_0x45f2e9,'virtual':_0x149992['virtual'],'online':_0x2c66ca,'custom':_0x149992}))[_0xc001('0x114')](/'/g,'\x5c\x27')};_0x3eda23[_0xc001('0x36')](ejs[_0xc001('0x115')](Mustache[_0xc001('0x115')](_0x23ec26,_0xfe5e5b),{'proactiveActions':_0x54c5eb,'alignment':_0x2a1e6c[_0xc001('0x116')],'verticalAlignment':_0x2a1e6c[_0xc001('0x117')],'div_color':_0x2a1e6c['color'],'text_color':_0x2a1e6c[_0xc001('0x118')],'button_color':_0x2a1e6c['color_button'],'background_color':_0x2a1e6c[_0xc001('0x119')]}));})[_0xc001('0x23')](handleError(_0x3eda23,null));};exports['addApplications']=function(_0x29b5f2,_0x57a737,_0x29681d){return db[_0xc001('0x3a')][_0xc001('0x66')]({'where':{'id':_0x29b5f2[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x57a737,null))['then'](function(_0x302ab2){if(_0x302ab2){return db[_0xc001('0xdc')]['transaction'](function(_0x201d6d){return db[_0xc001('0x11a')][_0xc001('0x30')]({'where':{'ChatWebsiteId':_0x29b5f2['params']['id']},'transaction':_0x201d6d})[_0xc001('0x31')](function(_0x3c4bc5){var _0x1b7598=_[_0xc001('0x39')](_0x29b5f2[_0xc001('0x58')],function(_0x1f350b){_0x1f350b[_0xc001('0x63')]=_0x29b5f2['params']['id'];return _0x1f350b;});return db[_0xc001('0x11a')][_0xc001('0xdf')](_0x1b7598,{'transaction':_0x201d6d});});})['then'](function(){return db['ChatApplication'][_0xc001('0x11b')]({'where':{'ChatWebsiteId':_0x29b5f2[_0xc001('0x56')]['id']},'order':_0xc001('0xa0')});});}})[_0xc001('0x31')](respondWithResult(_0x57a737,null))[_0xc001('0x23')](handleError(_0x57a737,null));};exports[_0xc001('0x11c')]=function(_0x1d553d,_0x17c61e,_0x3f076b){var _0x10e0ec={};var _0x5300b1={};var _0x3df920;var _0x2d4ae9;return db['ChatWebsite'][_0xc001('0x66')]({'where':{'id':_0x1d553d[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x17c61e,null))[_0xc001('0x31')](function(_0x272631){if(_0x272631){_0x3df920=_0x272631;_0x5300b1['model']=_[_0xc001('0x41')](db['ChatApplication'][_0xc001('0x3b')]);_0x5300b1[_0xc001('0x40')]=_[_0xc001('0x41')](_0x1d553d[_0xc001('0x40')]);_0x5300b1[_0xc001('0x42')]=_[_0xc001('0x44')](_0x5300b1[_0xc001('0x3e')],_0x5300b1[_0xc001('0x40')]);_0x10e0ec[_0xc001('0x43')]=_[_0xc001('0x44')](_0x5300b1[_0xc001('0x3e')],qs[_0xc001('0x45')](_0x1d553d[_0xc001('0x40')]['fields']));_0x10e0ec[_0xc001('0x43')]=_0x10e0ec['attributes'][_0xc001('0x46')]?_0x10e0ec[_0xc001('0x43')]:_0x5300b1[_0xc001('0x3e')];_0x10e0ec[_0xc001('0x49')]=qs[_0xc001('0x4a')](_0x1d553d['query'][_0xc001('0x4a')]);_0x10e0ec[_0xc001('0x4b')]=qs[_0xc001('0x42')](_[_0xc001('0x4c')](_0x1d553d['query'],_0x5300b1['filters']));if(_0x1d553d[_0xc001('0x40')][_0xc001('0x4d')]){_0x10e0ec[_0xc001('0x4b')]=_[_0xc001('0x4e')](_0x10e0ec['where'],{'$or':_[_0xc001('0x39')](_0x10e0ec[_0xc001('0x43')],function(_0x237f50){var _0x42d897={};_0x42d897[_0x237f50]={'$like':'%'+_0x1d553d[_0xc001('0x40')][_0xc001('0x4d')]+'%'};return _0x42d897;})});}_0x10e0ec=_[_0xc001('0x4e')]({},_0x10e0ec,_0x1d553d['options']);return _0x3df920[_0xc001('0x11c')](_0x10e0ec);}})[_0xc001('0x31')](function(_0x3ea93e){if(_0x3ea93e){_0x2d4ae9=_0x3ea93e['length'];if(!_0x1d553d[_0xc001('0x40')][_0xc001('0x47')](_0xc001('0x48'))){_0x10e0ec[_0xc001('0x2a')]=qs['limit'](_0x1d553d['query'][_0xc001('0x2a')]);_0x10e0ec[_0xc001('0x27')]=qs['offset'](_0x1d553d['query'][_0xc001('0x27')]);}return _0x3df920[_0xc001('0x11c')](_0x10e0ec);}})[_0xc001('0x31')](function(_0x5a3036){if(_0x5a3036){return _0x5a3036?{'count':_0x2d4ae9,'rows':_0x5a3036}:null;}})[_0xc001('0x31')](respondWithResult(_0x17c61e,null))[_0xc001('0x23')](handleError(_0x17c61e,null));};exports['addProactiveActions']=function(_0x1cd48e,_0x110c8a,_0x309750){return db[_0xc001('0x11d')]['find']({'where':{'id':_0x1cd48e[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x110c8a,null))['then'](function(_0x2bb52d){if(_0x2bb52d){return _0x2bb52d[_0xc001('0x11e')](_0x1cd48e['body'][_0xc001('0x68')],_['omit'](_0x1cd48e[_0xc001('0x58')],[_0xc001('0x68'),'id'])||{});}})[_0xc001('0x31')](respondWithResult(_0x110c8a,null))[_0xc001('0x23')](handleError(_0x110c8a,null));};exports[_0xc001('0x10a')]=function(_0x5245e7,_0x51ce3a,_0xa48c56){var _0x58ef5a={};var _0x4218ca={};var _0x4a9af3;var _0x4ba1ef;return db[_0xc001('0x3a')][_0xc001('0x66')]({'where':{'id':_0x5245e7[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x51ce3a,null))[_0xc001('0x31')](function(_0x5451bd){if(_0x5451bd){_0x4a9af3=_0x5451bd;_0x4218ca[_0xc001('0x3e')]=_[_0xc001('0x41')](db[_0xc001('0x11f')][_0xc001('0x3b')]);_0x4218ca[_0xc001('0x40')]=_['keys'](_0x5245e7[_0xc001('0x40')]);_0x4218ca[_0xc001('0x42')]=_[_0xc001('0x44')](_0x4218ca[_0xc001('0x3e')],_0x4218ca[_0xc001('0x40')]);_0x58ef5a[_0xc001('0x43')]=_[_0xc001('0x44')](_0x4218ca[_0xc001('0x3e')],qs[_0xc001('0x45')](_0x5245e7[_0xc001('0x40')][_0xc001('0x45')]));_0x58ef5a[_0xc001('0x43')]=_0x58ef5a[_0xc001('0x43')][_0xc001('0x46')]?_0x58ef5a[_0xc001('0x43')]:_0x4218ca[_0xc001('0x3e')];_0x58ef5a[_0xc001('0x49')]=qs['sort'](_0x5245e7[_0xc001('0x40')]['sort']);_0x58ef5a['where']=qs['filters'](_[_0xc001('0x4c')](_0x5245e7[_0xc001('0x40')],_0x4218ca[_0xc001('0x42')]));if(_0x5245e7[_0xc001('0x40')]['filter']){_0x58ef5a[_0xc001('0x4b')]=_[_0xc001('0x4e')](_0x58ef5a[_0xc001('0x4b')],{'$or':_[_0xc001('0x39')](_0x58ef5a[_0xc001('0x43')],function(_0x555f60){var _0x562545={};_0x562545[_0x555f60]={'$like':'%'+_0x5245e7[_0xc001('0x40')]['filter']+'%'};return _0x562545;})});}_0x58ef5a=_[_0xc001('0x4e')]({},_0x58ef5a,_0x5245e7[_0xc001('0x50')]);return _0x4a9af3[_0xc001('0x10a')](_0x58ef5a);}})[_0xc001('0x31')](function(_0x3c7b8d){if(_0x3c7b8d){_0x4ba1ef=_0x3c7b8d[_0xc001('0x46')];if(!_0x5245e7['query'][_0xc001('0x47')]('nolimit')){_0x58ef5a[_0xc001('0x2a')]=qs[_0xc001('0x2a')](_0x5245e7['query'][_0xc001('0x2a')]);_0x58ef5a[_0xc001('0x27')]=qs[_0xc001('0x27')](_0x5245e7[_0xc001('0x40')]['offset']);}return _0x4a9af3[_0xc001('0x10a')](_0x58ef5a);}})[_0xc001('0x31')](function(_0x96f668){if(_0x96f668){return _0x96f668?{'count':_0x4ba1ef,'rows':_0x96f668}:null;}})[_0xc001('0x31')](respondWithResult(_0x51ce3a,null))[_0xc001('0x23')](handleError(_0x51ce3a,null));};exports[_0xc001('0x120')]=function(_0x4ab21d,_0x4dc407,_0x3fabd4){var _0x4b933e=_0x4ab21d[_0xc001('0x40')][_0xc001('0x121')]===_0xc001('0x122')?'offlineForm':'onlineForm';return db[_0xc001('0x3a')][_0xc001('0x5c')]({'attributes':['id',_0x4b933e],'where':{'id':_0x4ab21d[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x4dc407,null))[_0xc001('0x31')](function(_0x4daa4f){if(_0x4daa4f){var _0x1b4232=_0x4daa4f[_0x4b933e];var _0x3d069e=_0x1b4232&&_0x1b4232[_0xc001('0x123')]?_0x1b4232[_0xc001('0x123')]:[];_0x4dc407[_0xc001('0x36')]({'fromKey':_[_0xc001('0x79')](_0x1b4232['fromKey'])?undefined:_0x1b4232['fromKey'],'count':_0x3d069e[_0xc001('0x46')],'rows':_0x3d069e});}})[_0xc001('0x23')](handleError(_0x4dc407,null));};exports['getOfflineMessages']=function(_0x28b07b,_0x3f0838,_0x5abf17){var _0x3515ff={'raw':![],'where':{}};var _0x48a54c={};var _0x15ed75={'count':0x0,'rows':[]};return db[_0xc001('0x3a')]['findOne']({'where':{'id':_0x28b07b[_0xc001('0x56')]['id']}})['then'](handleEntityNotFound(_0x3f0838,null))[_0xc001('0x31')](function(_0x3b9ae9){if(_0x3b9ae9){_0x48a54c[_0xc001('0x3e')]=_['keys'](db[_0xc001('0xd6')][_0xc001('0x3b')]);_0x48a54c[_0xc001('0x40')]=_[_0xc001('0x41')](_0x28b07b[_0xc001('0x40')]);_0x48a54c['filters']=_[_0xc001('0x44')](_0x48a54c[_0xc001('0x3e')],_0x48a54c[_0xc001('0x40')]);_0x3515ff[_0xc001('0x43')]=_['intersection'](_0x48a54c[_0xc001('0x3e')],qs[_0xc001('0x45')](_0x28b07b[_0xc001('0x40')]['fields']));_0x3515ff[_0xc001('0x43')]=_0x3515ff['attributes'][_0xc001('0x46')]?_0x3515ff[_0xc001('0x43')]:_0x48a54c[_0xc001('0x3e')];if(!_0x28b07b[_0xc001('0x40')][_0xc001('0x47')]('nolimit')){_0x3515ff[_0xc001('0x2a')]=qs[_0xc001('0x2a')](_0x28b07b[_0xc001('0x40')][_0xc001('0x2a')]);_0x3515ff['offset']=qs['offset'](_0x28b07b[_0xc001('0x40')][_0xc001('0x27')]);}_0x3515ff['order']=qs[_0xc001('0x4a')](_0x28b07b[_0xc001('0x40')][_0xc001('0x4a')]);_0x3515ff[_0xc001('0x4b')]=qs['filters'](_['pick'](_0x28b07b[_0xc001('0x40')],_0x48a54c[_0xc001('0x42')]));_0x3515ff[_0xc001('0x4b')][_0xc001('0x63')]=_0x3b9ae9['id'];if(_0x28b07b[_0xc001('0x40')][_0xc001('0x4d')]){_0x3515ff[_0xc001('0x4b')]=_[_0xc001('0x4e')](_0x3515ff[_0xc001('0x4b')],{'$or':_[_0xc001('0x39')](_0x3515ff[_0xc001('0x43')],function(_0x5de9d0){var _0x248f1b={};_0x248f1b[_0x5de9d0]={'$like':'%'+_0x28b07b['query'][_0xc001('0x4d')]+'%'};return _0x248f1b;})});}_0x3515ff=_['merge']({},_0x3515ff,_0x28b07b[_0xc001('0x50')]);return db[_0xc001('0xd6')][_0xc001('0x29')]({'where':_0x3515ff[_0xc001('0x4b')]})[_0xc001('0x31')](function(_0x1c6a6e){_0x15ed75[_0xc001('0x29')]=_0x1c6a6e;if(_0x28b07b[_0xc001('0x40')][_0xc001('0x51')]){_0x3515ff['include']=[{'all':!![]}];}else{_0x3515ff[_0xc001('0x52')]=[{'model':db[_0xc001('0x8b')],'as':_0xc001('0xf8'),'required':![]},{'model':db[_0xc001('0xde')],'as':_0xc001('0x124'),'required':![]}];}return db[_0xc001('0xd6')][_0xc001('0x53')](_0x3515ff);})['then'](function(_0x218151){_0x15ed75['rows']=_0x218151;return _0x15ed75;});}})[_0xc001('0x31')](respondWithFilteredResult(_0x3f0838,_0x3515ff))[_0xc001('0x23')](handleError(_0x3f0838,null));};exports[_0xc001('0x125')]=function(_0xe540e1,_0x4534c0,_0x248129){return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0xe540e1[_0xc001('0x56')]['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x4534c0,null))[_0xc001('0x31')](function(_0x47e27e){if(_0x47e27e){return _0x47e27e[_0xc001('0x125')](_0xe540e1[_0xc001('0x58')][_0xc001('0x68')],_[_0xc001('0x126')](_0xe540e1['body'],[_0xc001('0x68'),'id'])||{})[_0xc001('0xb9')](function(_0xe4cead){for(var _0x65958a=0x0;_0x65958a<_0xe540e1[_0xc001('0x58')][_0xc001('0x68')][_0xc001('0x46')];_0x65958a+=0x1){socket[_0xc001('0x127')](_0xc001('0x128'),{'UserId':Number(_0xe540e1['body'][_0xc001('0x68')][_0x65958a]),'ChatWebsiteId':Number(_0xe540e1[_0xc001('0x56')]['id'])});}return _0xe4cead;});}})['then'](respondWithResult(_0x4534c0,null))[_0xc001('0x23')](handleError(_0x4534c0,null));};exports[_0xc001('0x129')]=function(_0x22902a,_0x1648c5,_0x404fbb){return db[_0xc001('0x3a')][_0xc001('0x5c')]({'where':{'id':_0x22902a[_0xc001('0x56')]['id']}})['then'](handleEntityNotFound(_0x1648c5,null))[_0xc001('0x31')](function(_0x35b119){if(_0x35b119){return _0x35b119[_0xc001('0x129')](_0x22902a[_0xc001('0x40')][_0xc001('0x68')])[_0xc001('0x31')](function(){if(_[_0xc001('0x12a')](_0x22902a[_0xc001('0x40')][_0xc001('0x68')])){for(var _0xc99078=0x0;_0xc99078<_0x22902a[_0xc001('0x40')][_0xc001('0x68')][_0xc001('0x46')];_0xc99078+=0x1){socket['emit'](_0xc001('0x12b'),{'UserId':Number(_0x22902a[_0xc001('0x40')][_0xc001('0x68')][_0xc99078]),'ChatWebsiteId':Number(_0x22902a['params']['id'])});}}else{socket[_0xc001('0x127')]('userChatWebsite:remove',{'UserId':Number(_0x22902a[_0xc001('0x40')][_0xc001('0x68')]),'ChatWebsiteId':Number(_0x22902a[_0xc001('0x56')]['id'])});}});}})[_0xc001('0x31')](respondWithStatusCode(_0x1648c5,null))[_0xc001('0x23')](handleError(_0x1648c5,null));};exports[_0xc001('0x12c')]=function(_0xccca24,_0x4bb4d0,_0xabbadb){var _0x1afafa={};var _0x49e370={};var _0x38db8b;var _0xfda35e;return db[_0xc001('0x3a')][_0xc001('0x66')]({'where':{'id':_0xccca24['params']['id']}})[_0xc001('0x31')](handleEntityNotFound(_0x4bb4d0,null))[_0xc001('0x31')](function(_0x169850){if(_0x169850){_0x38db8b=_0x169850;_0x49e370[_0xc001('0x3e')]=_[_0xc001('0x41')](db[_0xc001('0xc3')][_0xc001('0x3b')]);_0x49e370[_0xc001('0x40')]=_[_0xc001('0x41')](_0xccca24[_0xc001('0x40')]);_0x49e370[_0xc001('0x42')]=_[_0xc001('0x44')](_0x49e370[_0xc001('0x3e')],_0x49e370['query']);_0x1afafa['attributes']=_[_0xc001('0x44')](_0x49e370['model'],qs['fields'](_0xccca24[_0xc001('0x40')][_0xc001('0x45')]));_0x1afafa[_0xc001('0x43')]=_0x1afafa[_0xc001('0x43')]['length']?_0x1afafa['attributes']:_0x49e370[_0xc001('0x3e')];_0x1afafa[_0xc001('0x49')]=qs[_0xc001('0x4a')](_0xccca24[_0xc001('0x40')][_0xc001('0x4a')]);_0x1afafa['where']=qs[_0xc001('0x42')](_[_0xc001('0x4c')](_0xccca24[_0xc001('0x40')],_0x49e370[_0xc001('0x42')]));if(_0xccca24['query'][_0xc001('0x4d')]){_0x1afafa[_0xc001('0x4b')]=_[_0xc001('0x4e')](_0x1afafa[_0xc001('0x4b')],{'$or':_[_0xc001('0x39')](_0x1afafa[_0xc001('0x43')],function(_0x475bc9){var _0x351043={};_0x351043[_0x475bc9]={'$like':'%'+_0xccca24[_0xc001('0x40')][_0xc001('0x4d')]+'%'};return _0x351043;})});}_0x1afafa=_['merge']({},_0x1afafa,_0xccca24[_0xc001('0x50')]);return _0x38db8b[_0xc001('0x12c')](_0x1afafa);}})['then'](function(_0x3419e2){if(_0x3419e2){_0xfda35e=_0x3419e2[_0xc001('0x46')];if(!_0xccca24[_0xc001('0x40')][_0xc001('0x47')](_0xc001('0x48'))){_0x1afafa['limit']=qs[_0xc001('0x2a')](_0xccca24[_0xc001('0x40')][_0xc001('0x2a')]);_0x1afafa[_0xc001('0x27')]=qs['offset'](_0xccca24[_0xc001('0x40')]['offset']);}return _0x38db8b['getAgents'](_0x1afafa);}})[_0xc001('0x31')](function(_0x21bd8b){if(_0x21bd8b){return _0x21bd8b?{'count':_0xfda35e,'rows':_0x21bd8b}:null;}})['then'](respondWithResult(_0x4bb4d0,null))[_0xc001('0x23')](handleError(_0x4bb4d0,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 98e9c6a..7adc411 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 _0x12c9=['ChatWebsite','setMaxListeners','save','remove','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x28c89b,_0x2510b3){var _0x176500=function(_0x3dfee2){while(--_0x3dfee2){_0x28c89b['push'](_0x28c89b['shift']());}};_0x176500(++_0x2510b3);}(_0x12c9,0x1c9));var _0x912c=function(_0x9fac4a,_0x9c6951){_0x9fac4a=_0x9fac4a-0x0;var _0x55851f=_0x12c9[_0x9fac4a];return _0x55851f;};'use strict';var EventEmitter=require(_0x912c('0x0'));var ChatWebsite=require(_0x912c('0x1'))['db'][_0x912c('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x912c('0x3')](0x0);var events={'afterCreate':_0x912c('0x4'),'afterUpdate':'update','afterDestroy':_0x912c('0x5')};function emitEvent(_0xcb7adc){return function(_0x2c8059,_0x298dcc,_0x1732a0){ChatWebsiteEvents['emit'](_0xcb7adc+':'+_0x2c8059['id'],_0x2c8059);ChatWebsiteEvents['emit'](_0xcb7adc,_0x2c8059);_0x1732a0(null);};}for(var e in events){if(events[_0x912c('0x6')](e)){var event=events[e];ChatWebsite[_0x912c('0x7')](e,emitEvent(event));}}module[_0x912c('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0x92bc=['remove','emit','exports','events','../../mysqldb','ChatWebsite','update'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x92bc,0x106));var _0xc92b=function(_0x933b37,_0x188075){_0x933b37=_0x933b37-0x0;var _0x51cad0=_0x92bc[_0x933b37];return _0x51cad0;};'use strict';var EventEmitter=require(_0xc92b('0x0'));var ChatWebsite=require(_0xc92b('0x1'))['db'][_0xc92b('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc92b('0x3'),'afterDestroy':_0xc92b('0x4')};function emitEvent(_0x35903f){return function(_0x1d7812,_0x56c979,_0x2dcfaa){ChatWebsiteEvents[_0xc92b('0x5')](_0x35903f+':'+_0x1d7812['id'],_0x1d7812);ChatWebsiteEvents[_0xc92b('0x5')](_0x35903f,_0x1d7812);_0x2dcfaa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xc92b('0x6')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index c3392e7..7393a36 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 _0x5390=['rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x23be51,_0xc02a1b){var _0x47a26d=function(_0xa92395){while(--_0xa92395){_0x23be51['push'](_0x23be51['shift']());}};_0x47a26d(++_0xc02a1b);}(_0x5390,0xbd));var _0x0539=function(_0x5f077e,_0xb33587){_0x5f077e=_0x5f077e-0x0;var _0x3a8800=_0x5390[_0x5f077e];return _0x3a8800;};'use strict';var _=require(_0x0539('0x0'));var util=require('util');var logger=require(_0x0539('0x1'))(_0x0539('0x2'));var moment=require(_0x0539('0x3'));var BPromise=require(_0x0539('0x4'));var rp=require(_0x0539('0x5'));var fs=require('fs');var path=require(_0x0539('0x6'));var rimraf=require(_0x0539('0x7'));var config=require(_0x0539('0x8'));var attributes=require(_0x0539('0x9'));module[_0x0539('0xa')]=function(_0x4a5e15,_0x232461){return _0x4a5e15[_0x0539('0xb')](_0x0539('0xc'),attributes,{'tableName':_0x0539('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x075e=['request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','lodash','util','../../config/logger','moment','bluebird'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x075e,0xbb));var _0xe075=function(_0x17fd9d,_0x2238f6){_0x17fd9d=_0x17fd9d-0x0;var _0x155279=_0x075e[_0x17fd9d];return _0x155279;};'use strict';var _=require(_0xe075('0x0'));var util=require(_0xe075('0x1'));var logger=require(_0xe075('0x2'))('api');var moment=require(_0xe075('0x3'));var BPromise=require(_0xe075('0x4'));var rp=require(_0xe075('0x5'));var fs=require('fs');var path=require(_0xe075('0x6'));var rimraf=require('rimraf');var config=require(_0xe075('0x7'));var attributes=require(_0xe075('0x8'));module[_0xe075('0x9')]=function(_0x445bff,_0xf79fd7){return _0x445bff[_0xe075('0xa')](_0xe075('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 09981f2..39d9e22 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 _0x2e54=['http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info','ChatWebsite,\x20%s,\x20%s','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x34a10c,_0x7ce96a){var _0x3015ab=function(_0x159266){while(--_0x159266){_0x34a10c['push'](_0x34a10c['shift']());}};_0x3015ab(++_0x7ce96a);}(_0x2e54,0xf0));var _0x42e5=function(_0xf9a23f,_0x326c20){_0xf9a23f=_0xf9a23f-0x0;var _0x2c5f99=_0x2e54[_0xf9a23f];return _0x2c5f99;};'use strict';var _=require(_0x42e5('0x0'));var util=require(_0x42e5('0x1'));var moment=require('moment');var BPromise=require(_0x42e5('0x2'));var rs=require(_0x42e5('0x3'));var fs=require('fs');var Redis=require(_0x42e5('0x4'));var db=require(_0x42e5('0x5'))['db'];var utils=require(_0x42e5('0x6'));var logger=require(_0x42e5('0x7'))(_0x42e5('0x8'));var config=require(_0x42e5('0x9'));var jayson=require(_0x42e5('0xa'));var client=jayson[_0x42e5('0xb')][_0x42e5('0xc')]({'port':0x232a});config[_0x42e5('0xd')]=_['defaults'](config[_0x42e5('0xd')],{'host':_0x42e5('0xe'),'port':0x18eb});var socket=require(_0x42e5('0xf'))(new Redis(config[_0x42e5('0xd')]));require(_0x42e5('0x10'))['register'](socket);function respondWithRpcPromise(_0x606e56,_0x41d508,_0xa1d995){return new BPromise(function(_0x519e10,_0x431b43){return client[_0x42e5('0x11')](_0x606e56,_0xa1d995)[_0x42e5('0x12')](function(_0x1c2408){logger[_0x42e5('0x13')](_0x42e5('0x14'),_0x41d508,'request\x20sent');logger['debug'](_0x42e5('0x15'),_0x41d508,_0x42e5('0x16'),JSON[_0x42e5('0x17')](_0x1c2408));if(_0x1c2408['error']){if(_0x1c2408['error'][_0x42e5('0x18')]===0x1f4){logger[_0x42e5('0x19')](_0x42e5('0x14'),_0x41d508,_0x1c2408[_0x42e5('0x19')]['message']);return _0x431b43(_0x1c2408[_0x42e5('0x19')]['message']);}logger[_0x42e5('0x19')](_0x42e5('0x14'),_0x41d508,_0x1c2408[_0x42e5('0x19')]['message']);return _0x519e10(_0x1c2408[_0x42e5('0x19')]['message']);}else{logger[_0x42e5('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x41d508,_0x42e5('0x16'));_0x519e10(_0x1c2408['result'][_0x42e5('0x1a')]);}})[_0x42e5('0x1b')](function(_0x2b5967){logger[_0x42e5('0x19')](_0x42e5('0x14'),_0x41d508,_0x2b5967);_0x431b43(_0x2b5967);});});} \ No newline at end of file +var _0x413d=['request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','request','then','info'];(function(_0x46905f,_0x15043b){var _0x27e8da=function(_0x2235e4){while(--_0x2235e4){_0x46905f['push'](_0x46905f['shift']());}};_0x27e8da(++_0x15043b);}(_0x413d,0x15a));var _0xd413=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x413d[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require('lodash');var util=require(_0xd413('0x0'));var moment=require('moment');var BPromise=require(_0xd413('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd413('0x2'));var db=require(_0xd413('0x3'))['db'];var utils=require(_0xd413('0x4'));var logger=require(_0xd413('0x5'))(_0xd413('0x6'));var config=require(_0xd413('0x7'));var jayson=require(_0xd413('0x8'));var client=jayson[_0xd413('0x9')][_0xd413('0xa')]({'port':0x232a});config[_0xd413('0xb')]=_[_0xd413('0xc')](config[_0xd413('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd413('0xd'))(new Redis(config[_0xd413('0xb')]));require(_0xd413('0xe'))['register'](socket);function respondWithRpcPromise(_0x193ee7,_0x4e6981,_0x4fcaf8){return new BPromise(function(_0x2a8ddb,_0x34b04e){return client[_0xd413('0xf')](_0x193ee7,_0x4fcaf8)[_0xd413('0x10')](function(_0x269015){logger[_0xd413('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x4e6981,_0xd413('0x12'));logger[_0xd413('0x13')](_0xd413('0x14'),_0x4e6981,_0xd413('0x12'),JSON[_0xd413('0x15')](_0x269015));if(_0x269015['error']){if(_0x269015[_0xd413('0x16')]['code']===0x1f4){logger['error'](_0xd413('0x17'),_0x4e6981,_0x269015[_0xd413('0x16')][_0xd413('0x18')]);return _0x34b04e(_0x269015[_0xd413('0x16')][_0xd413('0x18')]);}logger[_0xd413('0x16')](_0xd413('0x17'),_0x4e6981,_0x269015['error'][_0xd413('0x18')]);return _0x2a8ddb(_0x269015[_0xd413('0x16')][_0xd413('0x18')]);}else{logger[_0xd413('0x11')](_0xd413('0x17'),_0x4e6981,_0xd413('0x12'));_0x2a8ddb(_0x269015[_0xd413('0x19')][_0xd413('0x18')]);}})['catch'](function(_0x1cf6fb){logger['error'](_0xd413('0x17'),_0x4e6981,_0x1cf6fb);_0x34b04e(_0x1cf6fb);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 3bb3806..14cafd9 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 _0xd16b=['length','chatWebsite:','./chatWebsite.events','save','update','emit','removeListener','register'];(function(_0x18371d,_0xf7d926){var _0x48fedb=function(_0x165472){while(--_0x165472){_0x18371d['push'](_0x18371d['shift']());}};_0x48fedb(++_0xf7d926);}(_0xd16b,0x1aa));var _0xbd16=function(_0x3b2db6,_0x51249c){_0x3b2db6=_0x3b2db6-0x0;var _0x18a9a5=_0xd16b[_0x3b2db6];return _0x18a9a5;};'use strict';var ChatWebsiteEvents=require(_0xbd16('0x0'));var events=[_0xbd16('0x1'),'remove',_0xbd16('0x2')];function createListener(_0x48483f,_0x1baae0){return function(_0x27c61e){_0x1baae0[_0xbd16('0x3')](_0x48483f,_0x27c61e);};}function removeListener(_0x54364d,_0x2d089e){return function(){ChatWebsiteEvents[_0xbd16('0x4')](_0x54364d,_0x2d089e);};}exports[_0xbd16('0x5')]=function(_0x34d800){for(var _0x193dcf=0x0,_0x47d123=events[_0xbd16('0x6')];_0x193dcf<_0x47d123;_0x193dcf++){var _0x1593cf=events[_0x193dcf];var _0x55d6a9=createListener(_0xbd16('0x7')+_0x1593cf,_0x34d800);ChatWebsiteEvents['on'](_0x1593cf,_0x55d6a9);}}; \ No newline at end of file +var _0x99c8=['emit','register','save','update'];(function(_0x2442f7,_0x4a55f7){var _0xb8f055=function(_0x5b55d9){while(--_0x5b55d9){_0x2442f7['push'](_0x2442f7['shift']());}};_0xb8f055(++_0x4a55f7);}(_0x99c8,0x17e));var _0x899c=function(_0x36e041,_0x72b33a){_0x36e041=_0x36e041-0x0;var _0x1255e4=_0x99c8[_0x36e041];return _0x1255e4;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x899c('0x0'),'remove',_0x899c('0x1')];function createListener(_0x44f35f,_0xeea406){return function(_0x2e62b1){_0xeea406[_0x899c('0x2')](_0x44f35f,_0x2e62b1);};}function removeListener(_0x5946b8,_0x395ef0){return function(){ChatWebsiteEvents['removeListener'](_0x5946b8,_0x395ef0);};}exports[_0x899c('0x3')]=function(_0x272ad4){for(var _0x44cdd1=0x0,_0x482350=events['length'];_0x44cdd1<_0x482350;_0x44cdd1++){var _0x2505a9=events[_0x44cdd1];var _0x2e8730=createListener('chatWebsite:'+_0x2505a9,_0x272ad4);ChatWebsiteEvents['on'](_0x2505a9,_0x2e8730);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 938dd21..11f8413 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 _0x8877=['getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo','join','now','/:id/avatar','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields'];(function(_0x3a3150,_0x11cf18){var _0x52957b=function(_0x3e3932){while(--_0x3e3932){_0x3a3150['push'](_0x3a3150['shift']());}};_0x52957b(++_0x11cf18);}(_0x8877,0xb9));var _0x7887=function(_0x268da5,_0x1842b4){_0x268da5=_0x268da5-0x0;var _0x67d6ca=_0x8877[_0x268da5];return _0x67d6ca;};'use strict';var multer=require(_0x7887('0x0'));var util=require(_0x7887('0x1'));var path=require(_0x7887('0x2'));var timeout=require(_0x7887('0x3'));var express=require(_0x7887('0x4'));var router=express['Router']();var fs_extra=require(_0x7887('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7887('0x6'));var config=require(_0x7887('0x7'));var controller=require('./chatWebsite.controller');router[_0x7887('0x8')]('/',auth['isAuthenticated'](),controller[_0x7887('0x9')]);router[_0x7887('0x8')](_0x7887('0xa'),auth[_0x7887('0xb')](),controller['describe']);router[_0x7887('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7887('0xc')]);router[_0x7887('0x8')](_0x7887('0xd'),auth[_0x7887('0xb')](),controller[_0x7887('0xe')]);router[_0x7887('0x8')](_0x7887('0xf'),auth[_0x7887('0xb')](),controller[_0x7887('0x10')]);router[_0x7887('0x8')](_0x7887('0x11'),controller[_0x7887('0x12')]);router[_0x7887('0x8')]('/:id/avatar',controller[_0x7887('0x13')]);router[_0x7887('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0x7887('0x8')](_0x7887('0x14'),controller['getSystemAvatar']);router[_0x7887('0x8')](_0x7887('0x15'),auth[_0x7887('0xb')](),controller[_0x7887('0x16')]);router[_0x7887('0x8')]('/:id/snippet',controller['getSnippet']);router[_0x7887('0x8')](_0x7887('0x17'),auth[_0x7887('0xb')](),controller[_0x7887('0x18')]);router[_0x7887('0x8')](_0x7887('0x19'),auth[_0x7887('0xb')](),controller[_0x7887('0x1a')]);router[_0x7887('0x8')](_0x7887('0x1b'),controller[_0x7887('0x1c')]);router[_0x7887('0x8')](_0x7887('0x1d'),auth['isAuthenticated'](),controller[_0x7887('0x1e')]);router[_0x7887('0x8')](_0x7887('0x1f'),auth['isAuthenticated'](),controller[_0x7887('0x20')]);router['post']('/',auth[_0x7887('0xb')](),controller[_0x7887('0x21')]);router[_0x7887('0x22')]('/:id/dispositions',auth[_0x7887('0xb')](),controller[_0x7887('0x23')]);router[_0x7887('0x22')](_0x7887('0xf'),auth[_0x7887('0xb')](),controller[_0x7887('0x24')]);var upload=multer({'storage':multer[_0x7887('0x25')]({'destination':function(_0x2e72f2,_0x55c878,_0x4f9725){_0x4f9725(null,path['join'](config[_0x7887('0x26')],_0x7887('0x27')));},'filename':function(_0x43494f,_0x51373f,_0x42b50d){_0x42b50d(null,util['format'](_0x7887('0x28'),Date['now'](),_0x51373f[_0x7887('0x29')]));}})});router[_0x7887('0x22')](_0x7887('0x11'),upload[_0x7887('0x2a')](_0x7887('0x2b')),controller[_0x7887('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e7d07,_0x5bc6a7,_0x1f4569){_0x1f4569(null,path[_0x7887('0x2d')](config[_0x7887('0x26')],'server/files/images/avatars/'));},'filename':function(_0x151567,_0x50d5f7,_0x558884){_0x558884(null,util['format'](_0x7887('0x28'),Date[_0x7887('0x2e')](),_0x50d5f7[_0x7887('0x29')]));}})});router['post'](_0x7887('0x2f'),upload[_0x7887('0x2a')](_0x7887('0x2b')),controller[_0x7887('0x30')]);var upload=multer({'storage':multer[_0x7887('0x25')]({'destination':function(_0x43c35a,_0x18cb95,_0xf456a0){_0xf456a0(null,path[_0x7887('0x2d')](config[_0x7887('0x26')],_0x7887('0x31')));},'filename':function(_0x534fd1,_0x42b45e,_0x5b6256){_0x5b6256(null,util['format'](_0x7887('0x28'),Date[_0x7887('0x2e')](),_0x42b45e['originalname']));}})});router['post'](_0x7887('0x32'),upload[_0x7887('0x2a')](_0x7887('0x2b')),controller[_0x7887('0x33')]);var upload=multer({'storage':multer[_0x7887('0x25')]({'destination':function(_0x134d65,_0x4f2e95,_0x18254d){_0x18254d(null,path['join'](config['root'],_0x7887('0x31')));},'filename':function(_0x9774c5,_0x565410,_0x1f103d){_0x1f103d(null,util['format'](_0x7887('0x28'),Date[_0x7887('0x2e')](),_0x565410['originalname']));}})});router[_0x7887('0x22')](_0x7887('0x14'),upload[_0x7887('0x2a')](_0x7887('0x2b')),controller[_0x7887('0x34')]);router[_0x7887('0x22')](_0x7887('0x35'),controller[_0x7887('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5d3b98,_0x317ccf,_0x1ee381){const _0x38b78b=path['join'](config[_0x7887('0x26')],_0x7887('0x37'),_0x7887('0x38'),'offline-chat');fs_extra[_0x7887('0x39')](_0x38b78b,function(){_0x1ee381(null,_0x38b78b);});},'filename':function(_0x3d6bc0,_0x40b967,_0x3c98c5){const _0x128e8b=_0x40b967['originalname'][_0x7887('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x5dfad7=path[_0x7887('0x3b')](_0x128e8b);const _0x42801b=Date[_0x7887('0x2e')]()+'-'+_0x128e8b[_0x7887('0x3a')](_0x5dfad7,'')+_0x5dfad7;_0x3c98c5(null,_0x42801b);}})});router[_0x7887('0x22')]('/:id/offline',offlineUploadMulter[_0x7887('0x3c')](),controller[_0x7887('0x3d')]);router[_0x7887('0x22')](_0x7887('0x15'),auth[_0x7887('0xb')](),controller[_0x7887('0x3e')]);router[_0x7887('0x22')](_0x7887('0x17'),auth[_0x7887('0xb')](),controller[_0x7887('0x3f')]);router[_0x7887('0x22')](_0x7887('0x19'),auth[_0x7887('0xb')](),controller[_0x7887('0x40')]);router[_0x7887('0x22')](_0x7887('0x1f'),auth['isAuthenticated'](),controller[_0x7887('0x41')]);router['put']('/:id',auth[_0x7887('0xb')](),controller[_0x7887('0x42')]);router[_0x7887('0x43')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x7887('0x43')](_0x7887('0xd'),auth[_0x7887('0xb')](),controller[_0x7887('0x44')]);router[_0x7887('0x43')](_0x7887('0xf'),auth['isAuthenticated'](),controller[_0x7887('0x45')]);router[_0x7887('0x43')](_0x7887('0x1f'),auth[_0x7887('0xb')](),controller[_0x7887('0x46')]);module['exports']=router; \ No newline at end of file +var _0x57f0=['single','addCustomerAvatar','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','offline','/:id/applications','addApplications','addProactiveActions','put','delete','destroy','removeAnswers','/:id/users','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getApplications','/:id/proactive_actions','getFields','getOfflineMessages','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','format','%s-%s','originalname','file','addLogo','server/files/images/avatars/','now'];(function(_0x4abc62,_0x3d206f){var _0x4f06dd=function(_0x104c6a){while(--_0x104c6a){_0x4abc62['push'](_0x4abc62['shift']());}};_0x4f06dd(++_0x3d206f);}(_0x57f0,0x9f));var _0x057f=function(_0x467dee,_0x6b22b0){_0x467dee=_0x467dee-0x0;var _0x4406c7=_0x57f0[_0x467dee];return _0x4406c7;};'use strict';var multer=require('multer');var util=require(_0x057f('0x0'));var path=require(_0x057f('0x1'));var timeout=require(_0x057f('0x2'));var express=require(_0x057f('0x3'));var router=express['Router']();var fs_extra=require(_0x057f('0x4'));var auth=require(_0x057f('0x5'));var interaction=require(_0x057f('0x6'));var config=require('../../config/environment');var controller=require(_0x057f('0x7'));router[_0x057f('0x8')]('/',auth[_0x057f('0x9')](),controller[_0x057f('0xa')]);router['get'](_0x057f('0xb'),auth[_0x057f('0x9')](),controller[_0x057f('0xc')]);router[_0x057f('0x8')](_0x057f('0xd'),auth[_0x057f('0x9')](),controller[_0x057f('0xe')]);router[_0x057f('0x8')](_0x057f('0xf'),auth[_0x057f('0x9')](),controller[_0x057f('0x10')]);router[_0x057f('0x8')]('/:id/canned_answers',auth[_0x057f('0x9')](),controller[_0x057f('0x11')]);router[_0x057f('0x8')](_0x057f('0x12'),controller[_0x057f('0x13')]);router[_0x057f('0x8')](_0x057f('0x14'),controller[_0x057f('0x15')]);router['get'](_0x057f('0x16'),controller[_0x057f('0x17')]);router[_0x057f('0x8')](_0x057f('0x18'),controller[_0x057f('0x19')]);router[_0x057f('0x8')](_0x057f('0x1a'),auth[_0x057f('0x9')](),controller[_0x057f('0x1b')]);router[_0x057f('0x8')]('/:id/snippet',controller['getSnippet']);router['get']('/:id/applications',auth['isAuthenticated'](),controller[_0x057f('0x1c')]);router[_0x057f('0x8')](_0x057f('0x1d'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x057f('0x8')]('/:id/fields',controller[_0x057f('0x1e')]);router['get']('/:id/offline_messages',auth[_0x057f('0x9')](),controller[_0x057f('0x1f')]);router[_0x057f('0x8')]('/:id/users',auth['isAuthenticated'](),controller[_0x057f('0x20')]);router[_0x057f('0x21')]('/',auth[_0x057f('0x9')](),controller[_0x057f('0x22')]);router[_0x057f('0x21')]('/:id/dispositions',auth[_0x057f('0x9')](),controller[_0x057f('0x23')]);router[_0x057f('0x21')](_0x057f('0x24'),auth[_0x057f('0x9')](),controller[_0x057f('0x25')]);var upload=multer({'storage':multer[_0x057f('0x26')]({'destination':function(_0x512b77,_0x1d8201,_0x38b608){_0x38b608(null,path[_0x057f('0x27')](config[_0x057f('0x28')],'server/files/images/logos/'));},'filename':function(_0x5c65af,_0x3bce81,_0x2b4d79){_0x2b4d79(null,util[_0x057f('0x29')](_0x057f('0x2a'),Date['now'](),_0x3bce81[_0x057f('0x2b')]));}})});router[_0x057f('0x21')](_0x057f('0x12'),upload['single'](_0x057f('0x2c')),controller[_0x057f('0x2d')]);var upload=multer({'storage':multer[_0x057f('0x26')]({'destination':function(_0x4bb6e6,_0x504f40,_0x4a57d0){_0x4a57d0(null,path[_0x057f('0x27')](config[_0x057f('0x28')],_0x057f('0x2e')));},'filename':function(_0x4f387d,_0x4bfaad,_0x5452d2){_0x5452d2(null,util[_0x057f('0x29')](_0x057f('0x2a'),Date[_0x057f('0x2f')](),_0x4bfaad['originalname']));}})});router['post'](_0x057f('0x14'),upload[_0x057f('0x30')](_0x057f('0x2c')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x42f6c7,_0x89f5de,_0x73a9f2){_0x73a9f2(null,path[_0x057f('0x27')](config[_0x057f('0x28')],_0x057f('0x2e')));},'filename':function(_0xe7b1cb,_0x5811b9,_0x404177){_0x404177(null,util['format']('%s-%s',Date['now'](),_0x5811b9[_0x057f('0x2b')]));}})});router[_0x057f('0x21')](_0x057f('0x16'),upload[_0x057f('0x30')](_0x057f('0x2c')),controller[_0x057f('0x31')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xa0cb39,_0x4d048d,_0x2d3677){_0x2d3677(null,path[_0x057f('0x27')](config[_0x057f('0x28')],_0x057f('0x2e')));},'filename':function(_0xa60adb,_0x561130,_0x2b5332){_0x2b5332(null,util[_0x057f('0x29')](_0x057f('0x2a'),Date[_0x057f('0x2f')](),_0x561130[_0x057f('0x2b')]));}})});router[_0x057f('0x21')]('/:id/system_avatar',upload[_0x057f('0x30')](_0x057f('0x2c')),controller['addSystemAvatar']);router[_0x057f('0x21')](_0x057f('0x32'),controller[_0x057f('0x33')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x51755e,_0xca1878,_0xce1c81){const _0x360535=path['join'](config[_0x057f('0x28')],_0x057f('0x34'),_0x057f('0x35'),'offline-chat');fs_extra[_0x057f('0x36')](_0x360535,function(){_0xce1c81(null,_0x360535);});},'filename':function(_0xbbe1bc,_0x523461,_0x46157f){const _0x6b5706=_0x523461[_0x057f('0x2b')][_0x057f('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3650f3=path[_0x057f('0x38')](_0x6b5706);const _0x2d1530=Date[_0x057f('0x2f')]()+'-'+_0x6b5706[_0x057f('0x37')](_0x3650f3,'')+_0x3650f3;_0x46157f(null,_0x2d1530);}})});router[_0x057f('0x21')](_0x057f('0x39'),offlineUploadMulter['any'](),controller[_0x057f('0x3a')]);router[_0x057f('0x21')](_0x057f('0x1a'),auth[_0x057f('0x9')](),controller['addInteraction']);router[_0x057f('0x21')](_0x057f('0x3b'),auth[_0x057f('0x9')](),controller[_0x057f('0x3c')]);router[_0x057f('0x21')](_0x057f('0x1d'),auth[_0x057f('0x9')](),controller[_0x057f('0x3d')]);router['post']('/:id/users',auth[_0x057f('0x9')](),controller['addAgents']);router[_0x057f('0x3e')](_0x057f('0xd'),auth[_0x057f('0x9')](),controller['update']);router[_0x057f('0x3f')](_0x057f('0xd'),auth[_0x057f('0x9')](),controller[_0x057f('0x40')]);router[_0x057f('0x3f')](_0x057f('0xf'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x057f('0x3f')]('/:id/canned_answers',auth[_0x057f('0x9')](),controller[_0x057f('0x41')]);router[_0x057f('0x3f')](_0x057f('0x42'),auth[_0x057f('0x9')](),controller[_0x057f('0x43')]);module[_0x057f('0x44')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 5a23174..75a0037 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 _0x5031=['exports','STRING','ENUM','AmazonAWS','sequelize'];(function(_0xf4933b,_0x57cd3b){var _0x2b69af=function(_0x531bd8){while(--_0x531bd8){_0xf4933b['push'](_0xf4933b['shift']());}};_0x2b69af(++_0x57cd3b);}(_0x5031,0x144));var _0x1503=function(_0x57532b,_0x4c9341){_0x57532b=_0x57532b-0x0;var _0xe5df67=_0x5031[_0x57532b];return _0xe5df67;};'use strict';var Sequelize=require(_0x1503('0x0'));module[_0x1503('0x1')]={'name':{'type':Sequelize[_0x1503('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x1503('0x3')](_0x1503('0x4'),'Google'),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x1503('0x2')]}}; \ No newline at end of file +var _0x2cd0=['Google','sequelize','exports','STRING','ENUM','AmazonAWS'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2cd0,0x10f));var _0x02cd=function(_0x5984cf,_0x58aaff){_0x5984cf=_0x5984cf-0x0;var _0x558fcf=_0x2cd0[_0x5984cf];return _0x558fcf;};'use strict';var Sequelize=require(_0x02cd('0x0'));module[_0x02cd('0x1')]={'name':{'type':Sequelize[_0x02cd('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x02cd('0x3')](_0x02cd('0x4'),_0x02cd('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x02cd('0x2')]},'data2':{'type':Sequelize[_0x02cd('0x2')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c9158bb..e0ccf27 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 _0x5f2f=['end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','CloudProvider','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','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'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5f2f,0x73));var _0xf5f2=function(_0x243358,_0x2aef4b){_0x243358=_0x243358-0x0;var _0x30bb7e=_0x5f2f[_0x243358];return _0x30bb7e;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':!![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));}; \ No newline at end of file +var _0x5f66=['update','catch','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','../../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','CloudProvider','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params','find','create','body'];(function(_0x38c4a3,_0x5337eb){var _0x2e1a05=function(_0x5c5fa0){while(--_0x5c5fa0){_0x38c4a3['push'](_0x38c4a3['shift']());}};_0x2e1a05(++_0x5337eb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x5f66[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'all':!![]}];}return db[_0x65f6('0x27')][_0x65f6('0x3c')](_0x4ac04b);})[_0x65f6('0x21')](function(_0xed4c96){_0x266cfe[_0x65f6('0x3d')]=_0xed4c96;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))['catch'](handleError(_0x559330,null));};exports[_0x65f6('0x3e')]=function(_0x400ed2,_0x377ae5){var _0x181798={'raw':!![],'where':{'id':_0x400ed2[_0x65f6('0x3f')]['id']}},_0x83e2d9={};_0x83e2d9[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x83e2d9[_0x65f6('0x2c')]=_[_0x65f6('0x2b')](_0x400ed2[_0x65f6('0x2c')]);_0x83e2d9[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],_0x83e2d9['query']);_0x181798[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x83e2d9[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x400ed2['query'][_0x65f6('0x2f')]));_0x181798[_0x65f6('0x30')]=_0x181798[_0x65f6('0x30')]['length']?_0x181798[_0x65f6('0x30')]:_0x83e2d9[_0x65f6('0x2a')];if(_0x400ed2[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x181798['include']=[{'all':!![]}];}_0x181798=_[_0x65f6('0x37')]({},_0x181798,_0x400ed2['options']);return db[_0x65f6('0x27')][_0x65f6('0x40')](_0x181798)['then'](handleEntityNotFound(_0x377ae5,null))[_0x65f6('0x21')](respondWithResult(_0x377ae5,null))['catch'](handleError(_0x377ae5,null));};exports[_0x65f6('0x41')]=function(_0x4d9b76,_0x2d1706){return db[_0x65f6('0x27')][_0x65f6('0x41')](_0x4d9b76[_0x65f6('0x42')],{})['then'](respondWithResult(_0x2d1706,0xc9))['catch'](handleError(_0x2d1706,null));};exports[_0x65f6('0x43')]=function(_0x15d3ba,_0x3b647a){if(_0x15d3ba[_0x65f6('0x42')]['id']){delete _0x15d3ba[_0x65f6('0x42')]['id'];}return db[_0x65f6('0x27')][_0x65f6('0x40')]({'where':{'id':_0x15d3ba[_0x65f6('0x3f')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b647a,null))['then'](saveUpdates(_0x15d3ba[_0x65f6('0x42')],null))[_0x65f6('0x21')](respondWithResult(_0x3b647a,null))[_0x65f6('0x44')](handleError(_0x3b647a,null));};exports['destroy']=function(_0x47e749,_0x42d453){return db['CloudProvider'][_0x65f6('0x40')]({'where':{'id':_0x47e749[_0x65f6('0x3f')]['id']}})['then'](handleEntityNotFound(_0x42d453,null))[_0x65f6('0x21')](removeEntity(_0x42d453,null))['catch'](handleError(_0x42d453,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 0a358fa..af74e4d 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 _0x8d60=['api','moment','bluebird','path','rimraf','../../config/environment','define','CloudProvider','lodash','../../config/logger'];(function(_0x4ad223,_0x3a7789){var _0x19daea=function(_0xc447ad){while(--_0xc447ad){_0x4ad223['push'](_0x4ad223['shift']());}};_0x19daea(++_0x3a7789);}(_0x8d60,0x120));var _0x08d6=function(_0x45e586,_0x16c8d2){_0x45e586=_0x45e586-0x0;var _0x569b74=_0x8d60[_0x45e586];return _0x569b74;};'use strict';var _=require(_0x08d6('0x0'));var util=require('util');var logger=require(_0x08d6('0x1'))(_0x08d6('0x2'));var moment=require(_0x08d6('0x3'));var BPromise=require(_0x08d6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x08d6('0x5'));var rimraf=require(_0x08d6('0x6'));var config=require(_0x08d6('0x7'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x113f4e,_0x54cf23){return _0x113f4e[_0x08d6('0x8')](_0x08d6('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9355=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x5730df,_0x218269){var _0x3b9e22=function(_0x30dfa3){while(--_0x30dfa3){_0x5730df['push'](_0x5730df['shift']());}};_0x3b9e22(++_0x218269);}(_0x9355,0xdd));var _0x5935=function(_0x14d30a,_0x3c3188){_0x14d30a=_0x14d30a-0x0;var _0x5577ad=_0x9355[_0x14d30a];return _0x5577ad;};'use strict';var _=require(_0x5935('0x0'));var util=require(_0x5935('0x1'));var logger=require(_0x5935('0x2'))(_0x5935('0x3'));var moment=require(_0x5935('0x4'));var BPromise=require(_0x5935('0x5'));var rp=require(_0x5935('0x6'));var fs=require('fs');var path=require(_0x5935('0x7'));var rimraf=require(_0x5935('0x8'));var config=require(_0x5935('0x9'));var attributes=require(_0x5935('0xa'));module[_0x5935('0xb')]=function(_0x512f92,_0x52c564){return _0x512f92[_0x5935('0xc')](_0x5935('0xd'),attributes,{'tableName':_0x5935('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 8280fcc..682a833 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 _0xbc36=['info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x2fdbfd,_0xe80e03){var _0x308446=function(_0x4d0fcd){while(--_0x4d0fcd){_0x2fdbfd['push'](_0x2fdbfd['shift']());}};_0x308446(++_0xe80e03);}(_0xbc36,0x169));var _0x6bc3=function(_0x3675ea,_0x4b4497){_0x3675ea=_0x3675ea-0x0;var _0x3f6447=_0xbc36[_0x3675ea];return _0x3f6447;};'use strict';var _=require(_0x6bc3('0x0'));var util=require('util');var moment=require(_0x6bc3('0x1'));var BPromise=require(_0x6bc3('0x2'));var rs=require(_0x6bc3('0x3'));var fs=require('fs');var Redis=require(_0x6bc3('0x4'));var db=require(_0x6bc3('0x5'))['db'];var utils=require(_0x6bc3('0x6'));var logger=require(_0x6bc3('0x7'))(_0x6bc3('0x8'));var config=require(_0x6bc3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6bc3('0xa')][_0x6bc3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5584a5,_0x33e11c,_0x1f894a){return new BPromise(function(_0xf07594,_0x4de32d){return client[_0x6bc3('0xc')](_0x5584a5,_0x1f894a)[_0x6bc3('0xd')](function(_0x33e8e0){logger[_0x6bc3('0xe')]('CloudProvider,\x20%s,\x20%s',_0x33e11c,_0x6bc3('0xf'));logger[_0x6bc3('0x10')](_0x6bc3('0x11'),_0x33e11c,_0x6bc3('0xf'),JSON[_0x6bc3('0x12')](_0x33e8e0));if(_0x33e8e0[_0x6bc3('0x13')]){if(_0x33e8e0[_0x6bc3('0x13')][_0x6bc3('0x14')]===0x1f4){logger[_0x6bc3('0x13')]('CloudProvider,\x20%s,\x20%s',_0x33e11c,_0x33e8e0[_0x6bc3('0x13')]['message']);return _0x4de32d(_0x33e8e0[_0x6bc3('0x13')]['message']);}logger[_0x6bc3('0x13')](_0x6bc3('0x15'),_0x33e11c,_0x33e8e0['error'][_0x6bc3('0x16')]);return _0xf07594(_0x33e8e0['error']['message']);}else{logger[_0x6bc3('0xe')](_0x6bc3('0x15'),_0x33e11c,_0x6bc3('0xf'));_0xf07594(_0x33e8e0[_0x6bc3('0x17')][_0x6bc3('0x16')]);}})[_0x6bc3('0x18')](function(_0xa1782){logger['error'](_0x6bc3('0x15'),_0x33e11c,_0xa1782);_0x4de32d(_0xa1782);});});} \ No newline at end of file +var _0x753c=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0xddb860,_0x344918){var _0x255df9=function(_0x102c1c){while(--_0x102c1c){_0xddb860['push'](_0xddb860['shift']());}};_0x255df9(++_0x344918);}(_0x753c,0x96));var _0xc753=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x753c[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xc753('0x0'));var moment=require('moment');var BPromise=require(_0xc753('0x1'));var rs=require(_0xc753('0x2'));var fs=require('fs');var Redis=require(_0xc753('0x3'));var db=require(_0xc753('0x4'))['db'];var utils=require(_0xc753('0x5'));var logger=require(_0xc753('0x6'))(_0xc753('0x7'));var config=require(_0xc753('0x8'));var jayson=require(_0xc753('0x9'));var client=jayson[_0xc753('0xa')][_0xc753('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf96e73,_0xd7ee43,_0x44e544){return new BPromise(function(_0xb80bea,_0x3866e8){return client[_0xc753('0xc')](_0xf96e73,_0x44e544)[_0xc753('0xd')](function(_0x128610){logger[_0xc753('0xe')](_0xc753('0xf'),_0xd7ee43,_0xc753('0x10'));logger[_0xc753('0x11')](_0xc753('0x12'),_0xd7ee43,'request\x20sent',JSON[_0xc753('0x13')](_0x128610));if(_0x128610[_0xc753('0x14')]){if(_0x128610['error'][_0xc753('0x15')]===0x1f4){logger['error'](_0xc753('0xf'),_0xd7ee43,_0x128610[_0xc753('0x14')][_0xc753('0x16')]);return _0x3866e8(_0x128610['error'][_0xc753('0x16')]);}logger['error'](_0xc753('0xf'),_0xd7ee43,_0x128610['error'][_0xc753('0x16')]);return _0xb80bea(_0x128610[_0xc753('0x14')][_0xc753('0x16')]);}else{logger[_0xc753('0xe')](_0xc753('0xf'),_0xd7ee43,'request\x20sent');_0xb80bea(_0x128610[_0xc753('0x17')][_0xc753('0x16')]);}})[_0xc753('0x18')](function(_0x2e056c){logger[_0xc753('0x14')](_0xc753('0xf'),_0xd7ee43,_0x2e056c);_0x3866e8(_0x2e056c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5a02aa8..ecc45ab 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 _0xaebd=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','/:id','post','create','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x327904,_0x5649e4){var _0x333837=function(_0x14b825){while(--_0x14b825){_0x327904['push'](_0x327904['shift']());}};_0x333837(++_0x5649e4);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x17cdae,_0xf2cea7){_0x17cdae=_0x17cdae-0x0;var _0x309af0=_0xaebd[_0x17cdae];return _0x309af0;};'use strict';var multer=require(_0xdaeb('0x0'));var util=require('util');var path=require(_0xdaeb('0x1'));var timeout=require(_0xdaeb('0x2'));var express=require(_0xdaeb('0x3'));var router=express[_0xdaeb('0x4')]();var fs_extra=require(_0xdaeb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdaeb('0x6'));var config=require(_0xdaeb('0x7'));var controller=require(_0xdaeb('0x8'));router[_0xdaeb('0x9')]('/',auth[_0xdaeb('0xa')](),controller['index']);router[_0xdaeb('0x9')](_0xdaeb('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdaeb('0xc')]('/',auth[_0xdaeb('0xa')](),controller[_0xdaeb('0xd')]);router['put'](_0xdaeb('0xb'),auth['isAuthenticated'](),controller[_0xdaeb('0xe')]);router['delete'](_0xdaeb('0xb'),auth['isAuthenticated'](),controller[_0xdaeb('0xf')]);module[_0xdaeb('0x10')]=router; \ No newline at end of file +var _0x2ca2=['../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','post','create','put','update','delete','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x20c7ef,_0x5dcef5){var _0x3bb19e=function(_0x630d6d){while(--_0x630d6d){_0x20c7ef['push'](_0x20c7ef['shift']());}};_0x3bb19e(++_0x5dcef5);}(_0x2ca2,0x11c));var _0x22ca=function(_0x27af93,_0x14b723){_0x27af93=_0x27af93-0x0;var _0x1a0e96=_0x2ca2[_0x27af93];return _0x1a0e96;};'use strict';var multer=require(_0x22ca('0x0'));var util=require(_0x22ca('0x1'));var path=require(_0x22ca('0x2'));var timeout=require(_0x22ca('0x3'));var express=require(_0x22ca('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x22ca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22ca('0x6'));var controller=require(_0x22ca('0x7'));router[_0x22ca('0x8')]('/',auth[_0x22ca('0x9')](),controller['index']);router[_0x22ca('0x8')]('/:id',auth[_0x22ca('0x9')](),controller['show']);router[_0x22ca('0xa')]('/',auth[_0x22ca('0x9')](),controller[_0x22ca('0xb')]);router[_0x22ca('0xc')]('/:id',auth[_0x22ca('0x9')](),controller[_0x22ca('0xd')]);router[_0x22ca('0xe')](_0x22ca('0xf'),auth[_0x22ca('0x9')](),controller[_0x22ca('0x10')]);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 63d5b88..46eeb84 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 _0xb99b=['name','STRING','sequelize','exports'];(function(_0xa05ab1,_0x395497){var _0xdd2b80=function(_0x1a61a1){while(--_0x1a61a1){_0xa05ab1['push'](_0xa05ab1['shift']());}};_0xdd2b80(++_0x395497);}(_0xb99b,0x13a));var _0xbb99=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb99b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xbb99('0x0'));module[_0xbb99('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbb99('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xbb99('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xbb99('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbb99('0x3')]},'street':{'type':Sequelize[_0xbb99('0x3')]},'postalCode':{'type':Sequelize[_0xbb99('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xbb99('0x3')]},'email':{'type':Sequelize[_0xbb99('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xbb99('0x3')]},'sStreet':{'type':Sequelize[_0xbb99('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xbb99('0x3')]},'sCountry':{'type':Sequelize[_0xbb99('0x3')]},'description':{'type':Sequelize[_0xbb99('0x3')]}}; \ No newline at end of file +var _0x84fd=['exports','name','STRING','sequelize'];(function(_0x4cad3b,_0x4053af){var _0x1ebcd8=function(_0x722257){while(--_0x722257){_0x4cad3b['push'](_0x4cad3b['shift']());}};_0x1ebcd8(++_0x4053af);}(_0x84fd,0xeb));var _0xd84f=function(_0x3b279c,_0x25b2ef){_0x3b279c=_0x3b279c-0x0;var _0x56291b=_0x84fd[_0x3b279c];return _0x56291b;};'use strict';var Sequelize=require(_0xd84f('0x0'));module[_0xd84f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd84f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xd84f('0x3')]},'website':{'type':Sequelize[_0xd84f('0x3')]},'phone':{'type':Sequelize[_0xd84f('0x3')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd84f('0x3')]},'street':{'type':Sequelize[_0xd84f('0x3')]},'postalCode':{'type':Sequelize[_0xd84f('0x3')]},'city':{'type':Sequelize[_0xd84f('0x3')]},'country':{'type':Sequelize[_0xd84f('0x3')]},'email':{'type':Sequelize[_0xd84f('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd84f('0x3')]},'sPostalCode':{'type':Sequelize[_0xd84f('0x3')]},'sCity':{'type':Sequelize[_0xd84f('0x3')]},'sCountry':{'type':Sequelize[_0xd84f('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index de02611..6b2b941 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 _0x489f=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','error','stack','name','send','CmCompany','describe','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContact','omit','ids','getContacts','findOne','rawAttributes','pick','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x346645,_0x3e9d9c){var _0x32f590=function(_0x5b1bb5){while(--_0x5b1bb5){_0x346645['push'](_0x346645['shift']());}};_0x32f590(++_0x3e9d9c);}(_0x489f,0x147));var _0xf489=function(_0x1bcb50,_0x361843){_0x1bcb50=_0x1bcb50-0x0;var _0x352102=_0x489f[_0x1bcb50];return _0x352102;};'use strict';var emlformat=require(_0xf489('0x0'));var rimraf=require(_0xf489('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf489('0x2'));var moment=require(_0xf489('0x3'));var BPromise=require(_0xf489('0x4'));var Mustache=require(_0xf489('0x5'));var util=require(_0xf489('0x6'));var path=require(_0xf489('0x7'));var sox=require(_0xf489('0x8'));var csv=require(_0xf489('0x9'));var ejs=require(_0xf489('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf489('0xb'));var squel=require(_0xf489('0xc'));var crypto=require(_0xf489('0xd'));var jsforce=require(_0xf489('0xe'));var deskjs=require(_0xf489('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf489('0x10'));var Papa=require(_0xf489('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(_0xf489('0x12'));var logger=require(_0xf489('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x47e6f4,_0x2455c8){_0x2455c8=_0x2455c8||0xcc;return function(_0x13ea7e){if(_0x13ea7e){return _0x47e6f4[_0xf489('0x14')](_0x2455c8);}return _0x47e6f4[_0xf489('0x15')](_0x2455c8)[_0xf489('0x16')]();};}function respondWithResult(_0x30057b,_0x2bedaf){_0x2bedaf=_0x2bedaf||0xc8;return function(_0x24d141){if(_0x24d141){return _0x30057b[_0xf489('0x15')](_0x2bedaf)[_0xf489('0x17')](_0x24d141);}};}function respondWithFilteredResult(_0x3518ab,_0x2a3087){return function(_0x59eb26){if(_0x59eb26){var _0x2f1664=typeof _0x2a3087['offset']===_0xf489('0x18')&&typeof _0x2a3087[_0xf489('0x19')]==='undefined';var _0x5259be=_0x59eb26[_0xf489('0x1a')];var _0x563db3=_0x2f1664?0x0:_0x2a3087[_0xf489('0x1b')];var _0x3b769c=_0x2f1664?_0x59eb26[_0xf489('0x1a')]:_0x2a3087['offset']+_0x2a3087[_0xf489('0x19')];var _0x3cc553;if(_0x3b769c>=_0x5259be){_0x3b769c=_0x5259be;_0x3cc553=0xc8;}else{_0x3cc553=0xce;}_0x3518ab['status'](_0x3cc553);return _0x3518ab[_0xf489('0x1c')](_0xf489('0x1d'),_0x563db3+'-'+_0x3b769c+'/'+_0x5259be)[_0xf489('0x17')](_0x59eb26);}return null;};}function patchUpdates(_0x199527){return function(_0x53a69c){try{jsonpatch[_0xf489('0x1e')](_0x53a69c,_0x199527,!![]);}catch(_0x10cdfc){return BPromise[_0xf489('0x1f')](_0x10cdfc);}return _0x53a69c[_0xf489('0x20')]();};}function saveUpdates(_0x50bc2a,_0x50f009){return function(_0x3da750){if(_0x3da750){return _0x3da750[_0xf489('0x21')](_0x50bc2a)[_0xf489('0x22')](function(_0x4e52a3){return _0x4e52a3;});}return null;};}function removeEntity(_0x5080f5,_0x35f0d3){return function(_0x7cbf0f){if(_0x7cbf0f){return _0x7cbf0f[_0xf489('0x23')]()[_0xf489('0x22')](function(){var _0x51cff9=_0x7cbf0f[_0xf489('0x24')]({'plain':!![]});var _0x1eb6b0=_0xf489('0x25');return db['UserProfileResource'][_0xf489('0x23')]({'where':{'type':_0x1eb6b0,'resourceId':_0x51cff9['id']}})[_0xf489('0x22')](function(){return _0x7cbf0f;});})[_0xf489('0x22')](function(){_0x5080f5[_0xf489('0x15')](0xcc)[_0xf489('0x16')]();});}};}function handleEntityNotFound(_0x4525a3,_0x52e09d){return function(_0x56ad91){if(!_0x56ad91){_0x4525a3['sendStatus'](0x194);}return _0x56ad91;};}function handleError(_0x3034ac,_0x1d7a93){_0x1d7a93=_0x1d7a93||0x1f4;return function(_0x5c11ca){logger[_0xf489('0x26')](_0x5c11ca[_0xf489('0x27')]);if(_0x5c11ca[_0xf489('0x28')]){delete _0x5c11ca[_0xf489('0x28')];}_0x3034ac['status'](_0x1d7a93)[_0xf489('0x29')](_0x5c11ca);};}exports['index']=function(_0x3c0904,_0x153236){var _0x255100={},_0xe27c09={},_0x342a96={'count':0x0,'rows':[]};return db[_0xf489('0x2a')][_0xf489('0x2b')]()[_0xf489('0x22')](function(_0x267c0f){_0xe27c09[_0xf489('0x2c')]=_[_0xf489('0x2d')](_0x267c0f);_0xe27c09[_0xf489('0x2e')]=_['keys'](_0x3c0904[_0xf489('0x2e')]);_0xe27c09['filters']=_[_0xf489('0x2f')](_0xe27c09[_0xf489('0x2c')],_0xe27c09[_0xf489('0x2e')]);_0x255100['attributes']=_[_0xf489('0x2f')](_0xe27c09['model'],qs[_0xf489('0x30')](_0x3c0904[_0xf489('0x2e')][_0xf489('0x30')]));_0x255100[_0xf489('0x31')]=_0x255100[_0xf489('0x31')][_0xf489('0x32')]?_0x255100[_0xf489('0x31')]:_0xe27c09[_0xf489('0x2c')];if(!_0x3c0904[_0xf489('0x2e')][_0xf489('0x33')](_0xf489('0x34'))){_0x255100[_0xf489('0x19')]=qs[_0xf489('0x19')](_0x3c0904['query'][_0xf489('0x19')]);_0x255100[_0xf489('0x1b')]=qs[_0xf489('0x1b')](_0x3c0904[_0xf489('0x2e')][_0xf489('0x1b')]);}_0x255100[_0xf489('0x35')]=qs['sort'](_0x3c0904[_0xf489('0x2e')][_0xf489('0x36')]);_0x255100[_0xf489('0x37')]=qs[_0xf489('0x38')](_['pick'](_0x3c0904[_0xf489('0x2e')],_0xe27c09['filters']),_0x267c0f);if(_0x3c0904[_0xf489('0x2e')][_0xf489('0x39')]){_0x255100['where']=_[_0xf489('0x3a')](_0x255100[_0xf489('0x37')],{'$or':_[_0xf489('0x3b')](_0x255100['attributes'],function(_0x1934ba){var _0x4b22ad={};_0x4b22ad[_0x1934ba]={'$like':'%'+_0x3c0904[_0xf489('0x2e')][_0xf489('0x39')]+'%'};return _0x4b22ad;})});}_0x255100=_['merge']({},_0x255100,_0x3c0904[_0xf489('0x3c')]);var _0x1a8c85={'where':_0x255100[_0xf489('0x37')]};return db['CmCompany'][_0xf489('0x1a')](_0x1a8c85)[_0xf489('0x22')](function(_0x733a1){_0x342a96[_0xf489('0x1a')]=_0x733a1;if(_0x3c0904['query'][_0xf489('0x3d')]){_0x255100['include']=[{'all':!![]}];}return db[_0xf489('0x2a')][_0xf489('0x3e')](_0x255100);})['then'](function(_0x28611b){_0x342a96['rows']=_0x28611b;return _0x342a96;})[_0xf489('0x22')](respondWithFilteredResult(_0x153236,_0x255100))['catch'](handleError(_0x153236,null));})[_0xf489('0x3f')](handleError(_0x153236,null));};exports[_0xf489('0x40')]=function(_0x2e5f7c,_0x30c7d8){var _0x5d48b3={'raw':![],'where':{'id':_0x2e5f7c[_0xf489('0x41')]['id']}},_0x3c8436={};_0x3c8436['model']=_[_0xf489('0x2d')](db[_0xf489('0x2a')]['rawAttributes']);_0x3c8436[_0xf489('0x2e')]=_[_0xf489('0x2d')](_0x2e5f7c[_0xf489('0x2e')]);_0x3c8436['filters']=_[_0xf489('0x2f')](_0x3c8436[_0xf489('0x2c')],_0x3c8436[_0xf489('0x2e')]);_0x5d48b3[_0xf489('0x31')]=_['intersection'](_0x3c8436[_0xf489('0x2c')],qs[_0xf489('0x30')](_0x2e5f7c[_0xf489('0x2e')][_0xf489('0x30')]));_0x5d48b3[_0xf489('0x31')]=_0x5d48b3[_0xf489('0x31')]['length']?_0x5d48b3[_0xf489('0x31')]:_0x3c8436[_0xf489('0x2c')];if(_0x2e5f7c[_0xf489('0x2e')][_0xf489('0x3d')]){_0x5d48b3[_0xf489('0x42')]=[{'all':!![]}];}_0x5d48b3=_[_0xf489('0x3a')]({},_0x5d48b3,_0x2e5f7c[_0xf489('0x3c')]);return db[_0xf489('0x2a')][_0xf489('0x43')](_0x5d48b3)['then'](handleEntityNotFound(_0x30c7d8,null))[_0xf489('0x22')](respondWithResult(_0x30c7d8,null))[_0xf489('0x3f')](handleError(_0x30c7d8,null));};exports[_0xf489('0x44')]=function(_0x123672,_0x346d16){return db[_0xf489('0x2a')][_0xf489('0x44')](_0x123672[_0xf489('0x45')],{})['then'](function(_0x29e47e){var _0x119b4d=_0x123672[_0xf489('0x46')]['get']({'plain':!![]});if(!_0x119b4d)throw new Error(_0xf489('0x47'));if(_0x119b4d[_0xf489('0x48')]===_0xf489('0x46')){var _0x10ccd8=_0x29e47e[_0xf489('0x24')]({'plain':!![]});var _0xa3cb9a=_0xf489('0x25');return db[_0xf489('0x49')]['find']({'where':{'name':_0xa3cb9a,'userProfileId':_0x119b4d['userProfileId']},'raw':!![]})[_0xf489('0x22')](function(_0x5b23b6){if(_0x5b23b6&&_0x5b23b6[_0xf489('0x4a')]===0x0){return db[_0xf489('0x4b')][_0xf489('0x44')]({'name':_0x10ccd8[_0xf489('0x28')],'resourceId':_0x10ccd8['id'],'type':_0x5b23b6[_0xf489('0x28')],'sectionId':_0x5b23b6['id']},{})[_0xf489('0x22')](function(){return _0x29e47e;});}else{return _0x29e47e;}})['catch'](function(_0x35808f){logger[_0xf489('0x26')](_0xf489('0x4c'),_0x35808f);throw _0x35808f;});}return _0x29e47e;})[_0xf489('0x22')](respondWithResult(_0x346d16,0xc9))[_0xf489('0x3f')](handleError(_0x346d16,null));};exports[_0xf489('0x21')]=function(_0x413dff,_0x248299){if(_0x413dff[_0xf489('0x45')]['id']){delete _0x413dff['body']['id'];}return db[_0xf489('0x2a')]['find']({'where':{'id':_0x413dff[_0xf489('0x41')]['id']}})[_0xf489('0x22')](handleEntityNotFound(_0x248299,null))[_0xf489('0x22')](saveUpdates(_0x413dff['body'],null))[_0xf489('0x22')](respondWithResult(_0x248299,null))[_0xf489('0x3f')](handleError(_0x248299,null));};exports[_0xf489('0x23')]=function(_0x56c5bf,_0x24a331){return db[_0xf489('0x2a')][_0xf489('0x43')]({'where':{'id':_0x56c5bf['params']['id']}})['then'](handleEntityNotFound(_0x24a331,null))[_0xf489('0x22')](removeEntity(_0x24a331,null))[_0xf489('0x3f')](handleError(_0x24a331,null));};exports[_0xf489('0x2b')]=function(_0x3f0466,_0x374598){return db['CmCompany'][_0xf489('0x2b')]()['then'](respondWithResult(_0x374598,null))[_0xf489('0x3f')](handleError(_0x374598,null));};exports['addContacts']=function(_0x572fd1,_0x1eacbf,_0x13a9ba){return db[_0xf489('0x4d')]['find']({'where':{'id':_0x572fd1[_0xf489('0x41')]['id']}})[_0xf489('0x22')](handleEntityNotFound(_0x1eacbf,null))[_0xf489('0x22')](function(_0x4b7a73){if(_0x4b7a73){return _0x4b7a73['addContacts'](_0x572fd1['body']['ids'],_[_0xf489('0x4e')](_0x572fd1[_0xf489('0x45')],[_0xf489('0x4f'),'id'])||{});}})[_0xf489('0x22')](respondWithResult(_0x1eacbf,null))[_0xf489('0x3f')](handleError(_0x1eacbf,null));};exports[_0xf489('0x50')]=function(_0xf409db,_0x4800f7,_0xdbd5b1){var _0x86b291={};var _0xca2ae3={};var _0x1eb976;var _0x8843e4;return db[_0xf489('0x2a')][_0xf489('0x51')]({'where':{'id':_0xf409db[_0xf489('0x41')]['id']}})[_0xf489('0x22')](handleEntityNotFound(_0x4800f7,null))[_0xf489('0x22')](function(_0x4f53da){if(_0x4f53da){_0x1eb976=_0x4f53da;_0xca2ae3[_0xf489('0x2c')]=_['keys'](db['CmContact'][_0xf489('0x52')]);_0xca2ae3['query']=_['keys'](_0xf409db[_0xf489('0x2e')]);_0xca2ae3['filters']=_[_0xf489('0x2f')](_0xca2ae3[_0xf489('0x2c')],_0xca2ae3['query']);_0x86b291['attributes']=_['intersection'](_0xca2ae3[_0xf489('0x2c')],qs[_0xf489('0x30')](_0xf409db[_0xf489('0x2e')][_0xf489('0x30')]));_0x86b291[_0xf489('0x31')]=_0x86b291['attributes'][_0xf489('0x32')]?_0x86b291[_0xf489('0x31')]:_0xca2ae3[_0xf489('0x2c')];_0x86b291[_0xf489('0x35')]=qs['sort'](_0xf409db['query']['sort']);_0x86b291[_0xf489('0x37')]=qs[_0xf489('0x38')](_[_0xf489('0x53')](_0xf409db['query'],_0xca2ae3[_0xf489('0x38')]));if(_0xf409db['query']['filter']){_0x86b291[_0xf489('0x37')]=_['merge'](_0x86b291[_0xf489('0x37')],{'$or':_['map'](_0x86b291['attributes'],function(_0x3925d1){var _0x4331a9={};_0x4331a9[_0x3925d1]={'$like':'%'+_0xf409db[_0xf489('0x2e')]['filter']+'%'};return _0x4331a9;})});}_0x86b291=_[_0xf489('0x3a')]({},_0x86b291,_0xf409db[_0xf489('0x3c')]);return _0x1eb976[_0xf489('0x50')](_0x86b291);}})['then'](function(_0x1940b1){if(_0x1940b1){_0x8843e4=_0x1940b1[_0xf489('0x32')];if(!_0xf409db['query']['hasOwnProperty'](_0xf489('0x34'))){_0x86b291[_0xf489('0x19')]=qs[_0xf489('0x19')](_0xf409db[_0xf489('0x2e')]['limit']);_0x86b291[_0xf489('0x1b')]=qs['offset'](_0xf409db['query'][_0xf489('0x1b')]);}return _0x1eb976[_0xf489('0x50')](_0x86b291);}})[_0xf489('0x22')](function(_0x295e58){if(_0x295e58){return _0x295e58?{'count':_0x8843e4,'rows':_0x295e58}:null;}})[_0xf489('0x22')](respondWithResult(_0x4800f7,null))['catch'](handleError(_0x4800f7,null));}; \ No newline at end of file +var _0x68d9=['Companies','UserProfileResource','end','error','stack','name','send','CmCompany','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','options','includeAll','include','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','ids','omit','findOne','CmContact','order','getContacts','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68d9,0x89));var _0x968d=function(_0x477586,_0x49e433){_0x477586=_0x477586-0x0;var _0x22db50=_0x68d9[_0x477586];return _0x22db50;};'use strict';var emlformat=require(_0x968d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x968d('0x1'));var jsonpatch=require(_0x968d('0x2'));var rp=require(_0x968d('0x3'));var moment=require('moment');var BPromise=require(_0x968d('0x4'));var Mustache=require(_0x968d('0x5'));var util=require(_0x968d('0x6'));var path=require('path');var sox=require(_0x968d('0x7'));var csv=require('to-csv');var ejs=require(_0x968d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x968d('0x9'));var squel=require(_0x968d('0xa'));var crypto=require(_0x968d('0xb'));var jsforce=require(_0x968d('0xc'));var deskjs=require(_0x968d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x968d('0xe'));var Papa=require(_0x968d('0xf'));var Redis=require(_0x968d('0x10'));var authService=require(_0x968d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x968d('0x12'));var hardwareService=require(_0x968d('0x13'));var logger=require(_0x968d('0x14'))('api');var utils=require(_0x968d('0x15'));var config=require(_0x968d('0x16'));var licenseUtil=require(_0x968d('0x17'));var db=require(_0x968d('0x18'))['db'];function respondWithStatusCode(_0x433f40,_0x5bca8d){_0x5bca8d=_0x5bca8d||0xcc;return function(_0x289e48){if(_0x289e48){return _0x433f40[_0x968d('0x19')](_0x5bca8d);}return _0x433f40[_0x968d('0x1a')](_0x5bca8d)['end']();};}function respondWithResult(_0x3e0361,_0x4bedbe){_0x4bedbe=_0x4bedbe||0xc8;return function(_0x564616){if(_0x564616){return _0x3e0361[_0x968d('0x1a')](_0x4bedbe)[_0x968d('0x1b')](_0x564616);}};}function respondWithFilteredResult(_0x3b139a,_0x18ff39){return function(_0x584415){if(_0x584415){var _0x4c5b5e=typeof _0x18ff39[_0x968d('0x1c')]===_0x968d('0x1d')&&typeof _0x18ff39[_0x968d('0x1e')]==='undefined';var _0x1f6790=_0x584415[_0x968d('0x1f')];var _0x2d196b=_0x4c5b5e?0x0:_0x18ff39[_0x968d('0x1c')];var _0x41e106=_0x4c5b5e?_0x584415['count']:_0x18ff39['offset']+_0x18ff39[_0x968d('0x1e')];var _0x4aad0f;if(_0x41e106>=_0x1f6790){_0x41e106=_0x1f6790;_0x4aad0f=0xc8;}else{_0x4aad0f=0xce;}_0x3b139a[_0x968d('0x1a')](_0x4aad0f);return _0x3b139a[_0x968d('0x20')](_0x968d('0x21'),_0x2d196b+'-'+_0x41e106+'/'+_0x1f6790)[_0x968d('0x1b')](_0x584415);}return null;};}function patchUpdates(_0x14d919){return function(_0x55e247){try{jsonpatch['apply'](_0x55e247,_0x14d919,!![]);}catch(_0x1b0ac6){return BPromise[_0x968d('0x22')](_0x1b0ac6);}return _0x55e247[_0x968d('0x23')]();};}function saveUpdates(_0x3d0df4,_0x1f2b1b){return function(_0x15d460){if(_0x15d460){return _0x15d460[_0x968d('0x24')](_0x3d0df4)[_0x968d('0x25')](function(_0x3e1363){return _0x3e1363;});}return null;};}function removeEntity(_0x5a32c2,_0x10f064){return function(_0x3e3a27){if(_0x3e3a27){return _0x3e3a27[_0x968d('0x26')]()[_0x968d('0x25')](function(){var _0x3fb2db=_0x3e3a27['get']({'plain':!![]});var _0x31003a=_0x968d('0x27');return db[_0x968d('0x28')]['destroy']({'where':{'type':_0x31003a,'resourceId':_0x3fb2db['id']}})['then'](function(){return _0x3e3a27;});})[_0x968d('0x25')](function(){_0x5a32c2[_0x968d('0x1a')](0xcc)[_0x968d('0x29')]();});}};}function handleEntityNotFound(_0x256bb3,_0x5a54ea){return function(_0x30e763){if(!_0x30e763){_0x256bb3[_0x968d('0x19')](0x194);}return _0x30e763;};}function handleError(_0x150e57,_0x5e27c3){_0x5e27c3=_0x5e27c3||0x1f4;return function(_0x233b6b){logger[_0x968d('0x2a')](_0x233b6b[_0x968d('0x2b')]);if(_0x233b6b[_0x968d('0x2c')]){delete _0x233b6b['name'];}_0x150e57['status'](_0x5e27c3)[_0x968d('0x2d')](_0x233b6b);};}exports['index']=function(_0x2b0398,_0x306bbb){var _0x26c824={},_0x342615={},_0xfa21b4={'count':0x0,'rows':[]};return db[_0x968d('0x2e')]['describe']()[_0x968d('0x25')](function(_0x2c9dea){_0x342615[_0x968d('0x2f')]=_[_0x968d('0x30')](_0x2c9dea);_0x342615['query']=_[_0x968d('0x30')](_0x2b0398[_0x968d('0x31')]);_0x342615[_0x968d('0x32')]=_[_0x968d('0x33')](_0x342615[_0x968d('0x2f')],_0x342615[_0x968d('0x31')]);_0x26c824[_0x968d('0x34')]=_['intersection'](_0x342615[_0x968d('0x2f')],qs[_0x968d('0x35')](_0x2b0398[_0x968d('0x31')][_0x968d('0x35')]));_0x26c824[_0x968d('0x34')]=_0x26c824[_0x968d('0x34')][_0x968d('0x36')]?_0x26c824[_0x968d('0x34')]:_0x342615[_0x968d('0x2f')];if(!_0x2b0398['query'][_0x968d('0x37')](_0x968d('0x38'))){_0x26c824[_0x968d('0x1e')]=qs[_0x968d('0x1e')](_0x2b0398[_0x968d('0x31')][_0x968d('0x1e')]);_0x26c824[_0x968d('0x1c')]=qs[_0x968d('0x1c')](_0x2b0398[_0x968d('0x31')][_0x968d('0x1c')]);}_0x26c824['order']=qs['sort'](_0x2b0398[_0x968d('0x31')][_0x968d('0x39')]);_0x26c824['where']=qs[_0x968d('0x32')](_[_0x968d('0x3a')](_0x2b0398[_0x968d('0x31')],_0x342615['filters']),_0x2c9dea);if(_0x2b0398[_0x968d('0x31')][_0x968d('0x3b')]){_0x26c824[_0x968d('0x3c')]=_[_0x968d('0x3d')](_0x26c824['where'],{'$or':_[_0x968d('0x3e')](_0x26c824[_0x968d('0x34')],function(_0x386a38){var _0x465f28={};_0x465f28[_0x386a38]={'$like':'%'+_0x2b0398[_0x968d('0x31')]['filter']+'%'};return _0x465f28;})});}_0x26c824=_[_0x968d('0x3d')]({},_0x26c824,_0x2b0398[_0x968d('0x3f')]);var _0x5e1726={'where':_0x26c824['where']};return db[_0x968d('0x2e')][_0x968d('0x1f')](_0x5e1726)[_0x968d('0x25')](function(_0x52c908){_0xfa21b4[_0x968d('0x1f')]=_0x52c908;if(_0x2b0398['query'][_0x968d('0x40')]){_0x26c824[_0x968d('0x41')]=[{'all':!![]}];}return db[_0x968d('0x2e')]['findAll'](_0x26c824);})[_0x968d('0x25')](function(_0xc7fd2b){_0xfa21b4[_0x968d('0x42')]=_0xc7fd2b;return _0xfa21b4;})[_0x968d('0x25')](respondWithFilteredResult(_0x306bbb,_0x26c824))[_0x968d('0x43')](handleError(_0x306bbb,null));})[_0x968d('0x43')](handleError(_0x306bbb,null));};exports[_0x968d('0x44')]=function(_0x342b61,_0x1d47f5){var _0xb27e42={'raw':![],'where':{'id':_0x342b61['params']['id']}},_0x1627fa={};_0x1627fa['model']=_[_0x968d('0x30')](db['CmCompany'][_0x968d('0x45')]);_0x1627fa['query']=_['keys'](_0x342b61['query']);_0x1627fa[_0x968d('0x32')]=_['intersection'](_0x1627fa['model'],_0x1627fa[_0x968d('0x31')]);_0xb27e42[_0x968d('0x34')]=_[_0x968d('0x33')](_0x1627fa['model'],qs[_0x968d('0x35')](_0x342b61[_0x968d('0x31')][_0x968d('0x35')]));_0xb27e42[_0x968d('0x34')]=_0xb27e42['attributes'][_0x968d('0x36')]?_0xb27e42[_0x968d('0x34')]:_0x1627fa[_0x968d('0x2f')];if(_0x342b61[_0x968d('0x31')][_0x968d('0x40')]){_0xb27e42[_0x968d('0x41')]=[{'all':!![]}];}_0xb27e42=_['merge']({},_0xb27e42,_0x342b61[_0x968d('0x3f')]);return db[_0x968d('0x2e')][_0x968d('0x46')](_0xb27e42)[_0x968d('0x25')](handleEntityNotFound(_0x1d47f5,null))['then'](respondWithResult(_0x1d47f5,null))[_0x968d('0x43')](handleError(_0x1d47f5,null));};exports[_0x968d('0x47')]=function(_0x390147,_0x543989){return db['CmCompany'][_0x968d('0x47')](_0x390147[_0x968d('0x48')],{})['then'](function(_0x1e9f52){var _0x5c6945=_0x390147[_0x968d('0x49')][_0x968d('0x4a')]({'plain':!![]});if(!_0x5c6945)throw new Error(_0x968d('0x4b'));if(_0x5c6945['role']===_0x968d('0x49')){var _0x5de4e7=_0x1e9f52[_0x968d('0x4a')]({'plain':!![]});var _0x1343d0=_0x968d('0x27');return db['UserProfileSection'][_0x968d('0x46')]({'where':{'name':_0x1343d0,'userProfileId':_0x5c6945[_0x968d('0x4c')]},'raw':!![]})[_0x968d('0x25')](function(_0x417758){if(_0x417758&&_0x417758[_0x968d('0x4d')]===0x0){return db[_0x968d('0x28')][_0x968d('0x47')]({'name':_0x5de4e7[_0x968d('0x2c')],'resourceId':_0x5de4e7['id'],'type':_0x417758[_0x968d('0x2c')],'sectionId':_0x417758['id']},{})[_0x968d('0x25')](function(){return _0x1e9f52;});}else{return _0x1e9f52;}})[_0x968d('0x43')](function(_0x4956ef){logger[_0x968d('0x2a')](_0x968d('0x4e'),_0x4956ef);throw _0x4956ef;});}return _0x1e9f52;})[_0x968d('0x25')](respondWithResult(_0x543989,0xc9))[_0x968d('0x43')](handleError(_0x543989,null));};exports[_0x968d('0x24')]=function(_0x39ef93,_0x36f565){if(_0x39ef93[_0x968d('0x48')]['id']){delete _0x39ef93['body']['id'];}return db[_0x968d('0x2e')][_0x968d('0x46')]({'where':{'id':_0x39ef93['params']['id']}})[_0x968d('0x25')](handleEntityNotFound(_0x36f565,null))[_0x968d('0x25')](saveUpdates(_0x39ef93['body'],null))[_0x968d('0x25')](respondWithResult(_0x36f565,null))['catch'](handleError(_0x36f565,null));};exports['destroy']=function(_0x147ed3,_0x2e0690){return db[_0x968d('0x2e')][_0x968d('0x46')]({'where':{'id':_0x147ed3[_0x968d('0x4f')]['id']}})[_0x968d('0x25')](handleEntityNotFound(_0x2e0690,null))[_0x968d('0x25')](removeEntity(_0x2e0690,null))[_0x968d('0x43')](handleError(_0x2e0690,null));};exports['describe']=function(_0x351072,_0x358ce6){return db['CmCompany'][_0x968d('0x50')]()[_0x968d('0x25')](respondWithResult(_0x358ce6,null))[_0x968d('0x43')](handleError(_0x358ce6,null));};exports[_0x968d('0x51')]=function(_0x41fe07,_0x1332d2,_0xead60e){return db['CmContact'][_0x968d('0x46')]({'where':{'id':_0x41fe07[_0x968d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1332d2,null))['then'](function(_0x1b6dcb){if(_0x1b6dcb){return _0x1b6dcb[_0x968d('0x51')](_0x41fe07[_0x968d('0x48')][_0x968d('0x52')],_[_0x968d('0x53')](_0x41fe07[_0x968d('0x48')],['ids','id'])||{});}})[_0x968d('0x25')](respondWithResult(_0x1332d2,null))[_0x968d('0x43')](handleError(_0x1332d2,null));};exports['getContacts']=function(_0x359e6f,_0x3fde7f,_0x170e14){var _0x3e76b3={};var _0x2a1917={};var _0x2163a2;var _0x46bd66;return db['CmCompany'][_0x968d('0x54')]({'where':{'id':_0x359e6f[_0x968d('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3fde7f,null))[_0x968d('0x25')](function(_0x1b5674){if(_0x1b5674){_0x2163a2=_0x1b5674;_0x2a1917['model']=_[_0x968d('0x30')](db[_0x968d('0x55')][_0x968d('0x45')]);_0x2a1917[_0x968d('0x31')]=_['keys'](_0x359e6f[_0x968d('0x31')]);_0x2a1917['filters']=_[_0x968d('0x33')](_0x2a1917['model'],_0x2a1917[_0x968d('0x31')]);_0x3e76b3[_0x968d('0x34')]=_[_0x968d('0x33')](_0x2a1917['model'],qs[_0x968d('0x35')](_0x359e6f['query'][_0x968d('0x35')]));_0x3e76b3[_0x968d('0x34')]=_0x3e76b3[_0x968d('0x34')][_0x968d('0x36')]?_0x3e76b3[_0x968d('0x34')]:_0x2a1917[_0x968d('0x2f')];_0x3e76b3[_0x968d('0x56')]=qs[_0x968d('0x39')](_0x359e6f[_0x968d('0x31')]['sort']);_0x3e76b3[_0x968d('0x3c')]=qs[_0x968d('0x32')](_[_0x968d('0x3a')](_0x359e6f[_0x968d('0x31')],_0x2a1917[_0x968d('0x32')]));if(_0x359e6f[_0x968d('0x31')][_0x968d('0x3b')]){_0x3e76b3[_0x968d('0x3c')]=_[_0x968d('0x3d')](_0x3e76b3[_0x968d('0x3c')],{'$or':_[_0x968d('0x3e')](_0x3e76b3[_0x968d('0x34')],function(_0x429cf3){var _0x3cf0d8={};_0x3cf0d8[_0x429cf3]={'$like':'%'+_0x359e6f['query'][_0x968d('0x3b')]+'%'};return _0x3cf0d8;})});}_0x3e76b3=_['merge']({},_0x3e76b3,_0x359e6f[_0x968d('0x3f')]);return _0x2163a2['getContacts'](_0x3e76b3);}})[_0x968d('0x25')](function(_0x5b2ecd){if(_0x5b2ecd){_0x46bd66=_0x5b2ecd['length'];if(!_0x359e6f[_0x968d('0x31')]['hasOwnProperty']('nolimit')){_0x3e76b3[_0x968d('0x1e')]=qs['limit'](_0x359e6f['query'][_0x968d('0x1e')]);_0x3e76b3[_0x968d('0x1c')]=qs[_0x968d('0x1c')](_0x359e6f['query'][_0x968d('0x1c')]);}return _0x2163a2[_0x968d('0x57')](_0x3e76b3);}})[_0x968d('0x25')](function(_0x2aeb1b){if(_0x2aeb1b){return _0x2aeb1b?{'count':_0x46bd66,'rows':_0x2aeb1b}:null;}})[_0x968d('0x25')](respondWithResult(_0x3fde7f,null))[_0x968d('0x43')](handleError(_0x3fde7f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 7d5fc61..6bee010 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 _0x784b=['api','moment','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x784b,0x73));var _0xb784=function(_0x5809db,_0x40bc95){_0x5809db=_0x5809db-0x0;var _0x3399bc=_0x784b[_0x5809db];return _0x3399bc;};'use strict';var _=require('lodash');var util=require(_0xb784('0x0'));var logger=require(_0xb784('0x1'))(_0xb784('0x2'));var moment=require(_0xb784('0x3'));var BPromise=require(_0xb784('0x4'));var rp=require(_0xb784('0x5'));var fs=require('fs');var path=require(_0xb784('0x6'));var rimraf=require('rimraf');var config=require(_0xb784('0x7'));var attributes=require(_0xb784('0x8'));module[_0xb784('0x9')]=function(_0x72d27,_0x5adb9c){return _0x72d27[_0xb784('0xa')](_0xb784('0xb'),attributes,{'tableName':_0xb784('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc9c=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','lodash','../../config/logger'];(function(_0x32e13c,_0x4ec0fd){var _0x2969d5=function(_0x2df4a5){while(--_0x2df4a5){_0x32e13c['push'](_0x32e13c['shift']());}};_0x2969d5(++_0x4ec0fd);}(_0xdc9c,0x1d7));var _0xcdc9=function(_0x2cda18,_0x1272f2){_0x2cda18=_0x2cda18-0x0;var _0x396b2e=_0xdc9c[_0x2cda18];return _0x396b2e;};'use strict';var _=require(_0xcdc9('0x0'));var util=require('util');var logger=require(_0xcdc9('0x1'))('api');var moment=require(_0xcdc9('0x2'));var BPromise=require(_0xcdc9('0x3'));var rp=require(_0xcdc9('0x4'));var fs=require('fs');var path=require(_0xcdc9('0x5'));var rimraf=require(_0xcdc9('0x6'));var config=require(_0xcdc9('0x7'));var attributes=require(_0xcdc9('0x8'));module[_0xcdc9('0x9')]=function(_0x3fca8f,_0x5ed753){return _0x3fca8f[_0xcdc9('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','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 ef71c6a..1cecb18 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 _0x7a3e=['error','message','catch','lodash','util','ioredis','../../config/environment','jayson/promise','client','then','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4c336c,_0x3a0b51){var _0xcdd801=function(_0x5d355b){while(--_0x5d355b){_0x4c336c['push'](_0x4c336c['shift']());}};_0xcdd801(++_0x3a0b51);}(_0x7a3e,0xb3));var _0xe7a3=function(_0x411e4e,_0x14c369){_0x411e4e=_0x411e4e-0x0;var _0x48d4c3=_0x7a3e[_0x411e4e];return _0x48d4c3;};'use strict';var _=require(_0xe7a3('0x0'));var util=require(_0xe7a3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe7a3('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe7a3('0x3'));var jayson=require(_0xe7a3('0x4'));var client=jayson[_0xe7a3('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249f96,_0x3849c0,_0x504037){return new BPromise(function(_0x2baaf2,_0x477812){return client['request'](_0x249f96,_0x504037)[_0xe7a3('0x6')](function(_0x3e76cd){logger[_0xe7a3('0x7')](_0xe7a3('0x8'),_0x3849c0,'request\x20sent');logger[_0xe7a3('0x9')](_0xe7a3('0xa'),_0x3849c0,_0xe7a3('0xb'),JSON[_0xe7a3('0xc')](_0x3e76cd));if(_0x3e76cd[_0xe7a3('0xd')]){if(_0x3e76cd['error']['code']===0x1f4){logger[_0xe7a3('0xd')]('CmCompany,\x20%s,\x20%s',_0x3849c0,_0x3e76cd[_0xe7a3('0xd')][_0xe7a3('0xe')]);return _0x477812(_0x3e76cd[_0xe7a3('0xd')][_0xe7a3('0xe')]);}logger[_0xe7a3('0xd')](_0xe7a3('0x8'),_0x3849c0,_0x3e76cd[_0xe7a3('0xd')]['message']);return _0x2baaf2(_0x3e76cd['error'][_0xe7a3('0xe')]);}else{logger[_0xe7a3('0x7')](_0xe7a3('0x8'),_0x3849c0,'request\x20sent');_0x2baaf2(_0x3e76cd['result']['message']);}})[_0xe7a3('0xf')](function(_0x1c3bb1){logger['error'](_0xe7a3('0x8'),_0x3849c0,_0x1c3bb1);_0x477812(_0x1c3bb1);});});} \ No newline at end of file +var _0xdccb=['error','CmCompany,\x20%s,\x20%s','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0x355bb1,_0x3ea27c){var _0x42f907=function(_0x3f2181){while(--_0x3f2181){_0x355bb1['push'](_0x355bb1['shift']());}};_0x42f907(++_0x3ea27c);}(_0xdccb,0x193));var _0xbdcc=function(_0x5de17e,_0x556efd){_0x5de17e=_0x5de17e-0x0;var _0x9db192=_0xdccb[_0x5de17e];return _0x9db192;};'use strict';var _=require(_0xbdcc('0x0'));var util=require(_0xbdcc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbdcc('0x2'));var fs=require('fs');var Redis=require(_0xbdcc('0x3'));var db=require(_0xbdcc('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdcc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbdcc('0x6'));var client=jayson[_0xbdcc('0x7')][_0xbdcc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3cf510,_0x3f7def,_0xb86feb){return new BPromise(function(_0x4ed386,_0x4f6553){return client[_0xbdcc('0x9')](_0x3cf510,_0xb86feb)[_0xbdcc('0xa')](function(_0x72f665){logger[_0xbdcc('0xb')]('CmCompany,\x20%s,\x20%s',_0x3f7def,_0xbdcc('0xc'));logger[_0xbdcc('0xd')](_0xbdcc('0xe'),_0x3f7def,_0xbdcc('0xc'),JSON['stringify'](_0x72f665));if(_0x72f665[_0xbdcc('0xf')]){if(_0x72f665[_0xbdcc('0xf')]['code']===0x1f4){logger['error'](_0xbdcc('0x10'),_0x3f7def,_0x72f665[_0xbdcc('0xf')]['message']);return _0x4f6553(_0x72f665[_0xbdcc('0xf')][_0xbdcc('0x11')]);}logger[_0xbdcc('0xf')](_0xbdcc('0x10'),_0x3f7def,_0x72f665[_0xbdcc('0xf')][_0xbdcc('0x11')]);return _0x4ed386(_0x72f665[_0xbdcc('0xf')][_0xbdcc('0x11')]);}else{logger[_0xbdcc('0xb')](_0xbdcc('0x10'),_0x3f7def,_0xbdcc('0xc'));_0x4ed386(_0x72f665[_0xbdcc('0x12')][_0xbdcc('0x11')]);}})['catch'](function(_0x532c91){logger[_0xbdcc('0xf')](_0xbdcc('0x10'),_0x3f7def,_0x532c91);_0x4f6553(_0x532c91);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 0d4d291..4d2881d 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 _0x1740=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','getContacts','post','create','addContacts','put','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1740,0x1c6));var _0x0174=function(_0x4afa1e,_0xf635f4){_0x4afa1e=_0x4afa1e-0x0;var _0x35eeed=_0x1740[_0x4afa1e];return _0x35eeed;};'use strict';var multer=require(_0x0174('0x0'));var util=require(_0x0174('0x1'));var path=require(_0x0174('0x2'));var timeout=require(_0x0174('0x3'));var express=require(_0x0174('0x4'));var router=express[_0x0174('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0174('0x6'));var interaction=require(_0x0174('0x7'));var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0x0174('0x8')]('/',auth[_0x0174('0x9')](),controller['index']);router[_0x0174('0x8')](_0x0174('0xa'),auth['isAuthenticated'](),controller[_0x0174('0xb')]);router[_0x0174('0x8')](_0x0174('0xc'),auth[_0x0174('0x9')](),controller['show']);router[_0x0174('0x8')]('/:id/contacts',auth[_0x0174('0x9')](),controller[_0x0174('0xd')]);router[_0x0174('0xe')]('/',auth[_0x0174('0x9')](),controller[_0x0174('0xf')]);router['post']('/:id/contacts',auth[_0x0174('0x9')](),controller[_0x0174('0x10')]);router[_0x0174('0x11')](_0x0174('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x0174('0x12')](_0x0174('0xc'),auth[_0x0174('0x9')](),controller[_0x0174('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdccf=['fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/:id','show','/:id/contacts','post','create','addContacts','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x294095,_0x29e946){var _0xd5f54=function(_0x8e8630){while(--_0x8e8630){_0x294095['push'](_0x294095['shift']());}};_0xd5f54(++_0x29e946);}(_0xdccf,0x95));var _0xfdcc=function(_0x4aa7f5,_0x2a747f){_0x4aa7f5=_0x4aa7f5-0x0;var _0xab2c07=_0xdccf[_0x4aa7f5];return _0xab2c07;};'use strict';var multer=require(_0xfdcc('0x0'));var util=require(_0xfdcc('0x1'));var path=require('path');var timeout=require(_0xfdcc('0x2'));var express=require(_0xfdcc('0x3'));var router=express[_0xfdcc('0x4')]();var fs_extra=require(_0xfdcc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfdcc('0x6'));var config=require(_0xfdcc('0x7'));var controller=require(_0xfdcc('0x8'));router[_0xfdcc('0x9')]('/',auth[_0xfdcc('0xa')](),controller[_0xfdcc('0xb')]);router['get']('/describe',auth[_0xfdcc('0xa')](),controller['describe']);router[_0xfdcc('0x9')](_0xfdcc('0xc'),auth[_0xfdcc('0xa')](),controller[_0xfdcc('0xd')]);router['get'](_0xfdcc('0xe'),auth['isAuthenticated'](),controller['getContacts']);router[_0xfdcc('0xf')]('/',auth['isAuthenticated'](),controller[_0xfdcc('0x10')]);router[_0xfdcc('0xf')](_0xfdcc('0xe'),auth[_0xfdcc('0xa')](),controller[_0xfdcc('0x11')]);router[_0xfdcc('0x12')](_0xfdcc('0xc'),auth[_0xfdcc('0xa')](),controller[_0xfdcc('0x13')]);router[_0xfdcc('0x14')](_0xfdcc('0xc'),auth[_0xfdcc('0xa')](),controller[_0xfdcc('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 2320960..5bed109 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 _0x6533=['DATE','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0x6533,0x1e8));var _0x3653=function(_0x16ccb5,_0x2305c3){_0x16ccb5=_0x16ccb5-0x0;var _0x284954=_0x6533[_0x16ccb5];return _0x284954;};'use strict';var _=require(_0x3653('0x0'));var Sequelize=require(_0x3653('0x1'));module[_0x3653('0x2')]={'firstName':{'type':Sequelize[_0x3653('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3653('0x3')]},'street':{'type':Sequelize[_0x3653('0x3')]},'postalCode':{'type':Sequelize[_0x3653('0x3')]},'city':{'type':Sequelize[_0x3653('0x3')]},'country':{'type':Sequelize[_0x3653('0x3')]},'dateOfBirth':{'type':Sequelize[_0x3653('0x3')]},'description':{'type':Sequelize[_0x3653('0x4')]},'phone':{'type':Sequelize[_0x3653('0x3')]},'mobile':{'type':Sequelize[_0x3653('0x3')]},'fax':{'type':Sequelize[_0x3653('0x3')]},'email':{'type':Sequelize[_0x3653('0x3')]},'url':{'type':Sequelize[_0x3653('0x3')]},'facebook':{'type':Sequelize[_0x3653('0x3')]},'fb_data':{'type':Sequelize[_0x3653('0x3')]},'twitter':{'type':Sequelize[_0x3653('0x3')]},'skype':{'type':Sequelize[_0x3653('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x3653('0x3')]},'line':{'type':Sequelize[_0x3653('0x3')]},'wechat':{'type':Sequelize[_0x3653('0x3')]},'telegram':{'type':Sequelize[_0x3653('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize[_0x3653('0x5')](0x2)[_0x3653('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3653('0x7')],'defaultValue':Sequelize[_0x3653('0x8')]}}; \ No newline at end of file +var _0xc405=['UNSIGNED','NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER'];(function(_0x12ce51,_0x4cf3e9){var _0xeb0aa4=function(_0x11d692){while(--_0x11d692){_0x12ce51['push'](_0x12ce51['shift']());}};_0xeb0aa4(++_0x4cf3e9);}(_0xc405,0x19a));var _0x5c40=function(_0x13c4f8,_0x433521){_0x13c4f8=_0x13c4f8-0x0;var _0x5a8f4b=_0xc405[_0x13c4f8];return _0x5a8f4b;};'use strict';var _=require(_0x5c40('0x0'));var Sequelize=require(_0x5c40('0x1'));module[_0x5c40('0x2')]={'firstName':{'type':Sequelize[_0x5c40('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x5c40('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x5c40('0x3')]},'city':{'type':Sequelize[_0x5c40('0x3')]},'country':{'type':Sequelize[_0x5c40('0x3')]},'dateOfBirth':{'type':Sequelize[_0x5c40('0x3')]},'description':{'type':Sequelize[_0x5c40('0x4')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x5c40('0x3')]},'email':{'type':Sequelize[_0x5c40('0x3')]},'url':{'type':Sequelize[_0x5c40('0x3')]},'facebook':{'type':Sequelize[_0x5c40('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0x5c40('0x3')]},'skype':{'type':Sequelize[_0x5c40('0x3')]},'teams':{'type':Sequelize[_0x5c40('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x5c40('0x3')]},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x5c40('0x3')]},'UserId':{'type':Sequelize[_0x5c40('0x5')]},'priority':{'type':Sequelize[_0x5c40('0x5')](0x2)[_0x5c40('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x5c40('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 7cc7d10..7a19ecb 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 _0x45da=['undefined','count','Content-Range','apply','update','then','end','error','stack','name','send','index','describe','keys','length','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','select','field','color','from','tools_tags','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','sqlOperator','conditions','find','Tag','value','split','map','forEach','User','and','uc.UserId\x20=\x20?','fieldType','datetime','type','start','isNil','Contact','isEmpty','ListId','c.ListId\x20IN\x20?','concat','\x20=\x20?','tag','isArray','filter','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','QueryTypes','SELECT','clone','c.id','DESC','resolve','user','role','getLists','c.ListId\x20IS\x20NULL','agent','sequelize','toString','keyBy','merge','CmContact','c.firstName','c.lastName','c.phone','c.mobile','c.fax','c.ListId','c.createdAt','c.deletedAt','c.CompanyId','TagIds','Tags','rows','catch','destroy','params','displayName','findAll','columnName','alias','custom','values','body','get','mergeWith','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','omit','format','cf_%d','pickBy','table','cm_contacts','id\x20=\x20?','text','phone','getTags','options','setTags','getHoppers','rawAttributes','ContactId','includeAll','include','getHopperHistories','getHopperFinals','uploadCsv','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','child_process','CompanyId','pid','upload','createReadStream','json','meta','import','No\x20ListId\x20specified','binding','fork','../../components/import/cm/csv2','stringify','exit','getJourney','mail','sms','openchannel','fax','whatsapp','voice','includes','channel','toLowerCase','Invalid\x20channel','parse','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','source','destination','starttime','endtime','duration','createdAt','userDisposition','userSecondDisposition','UserId','findAndCountAll','fullname','startCase','Website','Account','closed','closedAt','note','disposition','secondDisposition','thirdDisposition','chat','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','ratingValue','referer','subject','substatus','threadId','Interaction','Owner','flatten','sortBy','reverse','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','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','sendStatus','status','offset'];(function(_0x538670,_0xad1080){var _0x291c33=function(_0x510b28){while(--_0x510b28){_0x538670['push'](_0x538670['shift']());}};_0x291c33(++_0xad1080);}(_0x45da,0x106));var _0xa45d=function(_0x1012a7,_0x34b347){_0x1012a7=_0x1012a7-0x0;var _0x34f1d6=_0x45da[_0x1012a7];return _0x34f1d6;};'use strict';var emlformat=require(_0xa45d('0x0'));var rimraf=require(_0xa45d('0x1'));var zipdir=require(_0xa45d('0x2'));var jsonpatch=require(_0xa45d('0x3'));var rp=require(_0xa45d('0x4'));var moment=require(_0xa45d('0x5'));var BPromise=require(_0xa45d('0x6'));var Mustache=require(_0xa45d('0x7'));var util=require(_0xa45d('0x8'));var path=require(_0xa45d('0x9'));var sox=require('sox');var csv=require(_0xa45d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa45d('0xb'));var _=require(_0xa45d('0xc'));var squel=require(_0xa45d('0xd'));var crypto=require(_0xa45d('0xe'));var jsforce=require(_0xa45d('0xf'));var deskjs=require(_0xa45d('0x10'));var toCsv=require(_0xa45d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa45d('0x11'));var authService=require(_0xa45d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa45d('0x13'));var logger=require(_0xa45d('0x14'))('api');var utils=require(_0xa45d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa45d('0x16'));var db=require('../../mysqldb')['db'];config[_0xa45d('0x17')]=_[_0xa45d('0x18')](config[_0xa45d('0x17')],{'host':_0xa45d('0x19'),'port':0x18eb});var socket=require(_0xa45d('0x1a'))(new Redis(config[_0xa45d('0x17')]));require(_0xa45d('0x1b'))[_0xa45d('0x1c')](socket);function respondWithStatusCode(_0x4a081f,_0xd0dd1b){_0xd0dd1b=_0xd0dd1b||0xcc;return function(_0x434efc){if(_0x434efc){return _0x4a081f[_0xa45d('0x1d')](_0xd0dd1b);}return _0x4a081f['status'](_0xd0dd1b)['end']();};}function respondWithResult(_0x1cc47a,_0x4dba31){_0x4dba31=_0x4dba31||0xc8;return function(_0xae3912){if(_0xae3912){return _0x1cc47a[_0xa45d('0x1e')](_0x4dba31)['json'](_0xae3912);}};}function respondWithFilteredResult(_0x540709,_0x1484f7){return function(_0x2f6456){if(_0x2f6456){var _0x56f144=typeof _0x1484f7[_0xa45d('0x1f')]===_0xa45d('0x20')&&typeof _0x1484f7['limit']==='undefined';var _0x134a35=_0x2f6456[_0xa45d('0x21')];var _0x5d5b41=_0x56f144?0x0:_0x1484f7[_0xa45d('0x1f')];var _0x5cbd35=_0x56f144?_0x2f6456[_0xa45d('0x21')]:_0x1484f7[_0xa45d('0x1f')]+_0x1484f7['limit'];var _0x49c045;if(_0x5cbd35>=_0x134a35){_0x5cbd35=_0x134a35;_0x49c045=0xc8;}else{_0x49c045=0xce;}_0x540709['status'](_0x49c045);return _0x540709['set'](_0xa45d('0x22'),_0x5d5b41+'-'+_0x5cbd35+'/'+_0x134a35)['json'](_0x2f6456);}return null;};}function patchUpdates(_0x3f202f){return function(_0xf306dd){try{jsonpatch[_0xa45d('0x23')](_0xf306dd,_0x3f202f,!![]);}catch(_0x4ef664){return BPromise['reject'](_0x4ef664);}return _0xf306dd['save']();};}function saveUpdates(_0x5a5cdc,_0xd349b6){return function(_0x5524ed){if(_0x5524ed){return _0x5524ed[_0xa45d('0x24')](_0x5a5cdc)[_0xa45d('0x25')](function(_0x7445ab){return _0x7445ab;});}return null;};}function removeEntity(_0x1e5b3b,_0x213bdd){return function(_0x38dc4){if(_0x38dc4){return _0x38dc4['destroy']()[_0xa45d('0x25')](function(){_0x1e5b3b['status'](0xcc)[_0xa45d('0x26')]();});}};}function handleEntityNotFound(_0x16aac2,_0x158878){return function(_0x36e8e3){if(!_0x36e8e3){_0x16aac2[_0xa45d('0x1d')](0x194);}return _0x36e8e3;};}function handleError(_0x4d2262,_0x304e75){_0x304e75=_0x304e75||0x1f4;return function(_0x3cd8cb){logger[_0xa45d('0x27')](_0x3cd8cb[_0xa45d('0x28')]);if(_0x3cd8cb[_0xa45d('0x29')]){delete _0x3cd8cb['name'];}_0x4d2262[_0xa45d('0x1e')](_0x304e75)[_0xa45d('0x2a')](_0x3cd8cb);};}exports[_0xa45d('0x2b')]=function(_0x31aeb3,_0x25b514){var _0x490b45={},_0x131fc4={},_0x59e828={'count':0x0,'rows':[]};return db['CmContact'][_0xa45d('0x2c')]()['then'](function(_0x558cb8){var _0x14a8cc=[];for(var _0x5488ba=0x0;_0x5488ba0x1){_0x566310['or'](_0xa45d('0x6a'),qs['getFullTextValue'](_0x11c051),null);}else{if(qs[_0xa45d('0x6b')](_0x11c051)){_0x566310['or'](_0xa45d('0x6c'),_0x11c051+'%');_0x566310['or'](_0xa45d('0x6d'),_0x11c051+'%');_0x566310['or'](_0xa45d('0x6e'),_0x11c051+'%');_0x566310['or']('c.fax\x20LIKE\x20?',_0x11c051+'%');}else if(qs[_0xa45d('0x6f')](_0x11c051)){_0x566310['or']('c.email\x20LIKE\x20?',_0x11c051+'%');}else{_0x566310['or'](_0xa45d('0x70'),'%'+_0x11c051+'%');_0x566310['or']('c.lastName\x20LIKE\x20?','%'+_0x11c051+'%');_0x566310['or']('c.email\x20LIKE\x20?','%'+_0x11c051+'%');}}}}_0x1263a6[_0xa45d('0x41')](_0x566310);_0x1263a6['group']('c.id');var _0x54ec61={'type':db['Sequelize'][_0xa45d('0x71')][_0xa45d('0x72')],'raw':!![]};var _0x1f50ed=_0x1263a6[_0xa45d('0x73')]()[_0xa45d('0x44')](_0xa45d('0x74'));if(_0x490b45[_0xa45d('0x3f')]){_0x490b45[_0xa45d('0x3f')][_0xa45d('0x57')](function(_0x3438d1){_0x1263a6['order']('c.'+_0x3438d1[0x0],_0x3438d1[0x1]===_0xa45d('0x75')?![]:!![]);});}if(!_[_0xa45d('0x61')](_0x1cf937)){_0x1263a6['having'](_0x4aa206);_0x1f50ed[_0xa45d('0x41')]('t.id\x20IN\x20?',_0x1cf937);}BPromise[_0xa45d('0x76')]()[_0xa45d('0x25')](function(){if(!_0xd387db)return;if(_0x31aeb3[_0xa45d('0x77')][_0xa45d('0x78')]!=='agent')return;if(!_['some'](_0xd387db[_0xa45d('0x51')],['field',_0xa45d('0x58')])){return _0x31aeb3[_0xa45d('0x77')][_0xa45d('0x79')]({'attributes':['id'],'raw':!![]})[_0xa45d('0x25')](function(_0x473edd){if(_['isEmpty'](_0x473edd)){_0x1f50ed[_0xa45d('0x41')](_0xa45d('0x7a'));_0x1263a6[_0xa45d('0x41')](_0xa45d('0x7a'));}else{_0x1f50ed['where'](_0xa45d('0x63'),_[_0xa45d('0x56')](_0x473edd,'id'));_0x1263a6['where'](_0xa45d('0x63'),_[_0xa45d('0x56')](_0x473edd,'id'));}});}})['then'](function(){if(_0x31aeb3[_0xa45d('0x77')][_0xa45d('0x78')]===_0xa45d('0x7b')&&!_0xd387db&&!_0x31aeb3[_0xa45d('0x37')][_0xa45d('0x62')])return[];return db[_0xa45d('0x7c')][_0xa45d('0x37')](_0x1f50ed[_0xa45d('0x7d')](),_0x54ec61);})[_0xa45d('0x25')](function(_0x56ba5d){_0x59e828['count']=_0x56ba5d[_0xa45d('0x2e')];if(_0x59e828[_0xa45d('0x21')]===0x0)return[];return db[_0xa45d('0x7c')][_0xa45d('0x37')](_0x5b8355[_0xa45d('0x7d')](),_0x54ec61)[_0xa45d('0x25')](function(_0x5f3642){_0x297b8b=_[_0xa45d('0x7e')](_0x5f3642,'id');_0x54ec61=_[_0xa45d('0x7f')](_0x54ec61,{'model':db[_0xa45d('0x80')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x31aeb3['query'][_0xa45d('0x3a')]){_0x490b45[_0xa45d('0x3b')][_0xa45d('0x57')](function(_0x4ce15a){_0x1263a6[_0xa45d('0x44')]('c.'+_0x4ce15a);});}else{_0x1263a6[_0xa45d('0x44')](_0xa45d('0x74'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x81'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x82'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x83'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x84'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x85'));_0x1263a6[_0xa45d('0x44')]('c.email');_0x1263a6[_0xa45d('0x44')](_0xa45d('0x86'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x87'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x88'));_0x1263a6[_0xa45d('0x44')](_0xa45d('0x89'));_0x1263a6[_0xa45d('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xa45d('0x8a'));}if(_0x490b45[_0xa45d('0x3e')])_0x1263a6[_0xa45d('0x3e')](_0x490b45['limit']);if(_0x490b45[_0xa45d('0x1f')])_0x1263a6[_0xa45d('0x1f')](_0x490b45['offset']);return db[_0xa45d('0x7c')][_0xa45d('0x37')](_0x1263a6[_0xa45d('0x7d')](),_0x54ec61);});})[_0xa45d('0x25')](function(_0xd1ff09){_0xd1ff09['forEach'](function(_0x4e460b){if(_0x4e460b['TagIds']){_0x4e460b['Tags']=[];_0x4e460b[_0xa45d('0x8a')]['split'](',')[_0xa45d('0x57')](function(_0x10a85c){_0x4e460b[_0xa45d('0x8b')][_0xa45d('0x31')](_0x297b8b[_0x10a85c]);});}delete _0x4e460b[_0xa45d('0x8a')];});_0x59e828[_0xa45d('0x8c')]=_0xd1ff09;return _0x59e828;})[_0xa45d('0x25')](respondWithFilteredResult(_0x25b514,_0x490b45));})[_0xa45d('0x8d')](handleError(_0x25b514,null));};exports[_0xa45d('0x8e')]=function(_0x147f1b,_0x6c2858){return db['CmContact'][_0xa45d('0x52')]({'where':{'id':_0x147f1b[_0xa45d('0x8f')]['id']}})['then'](handleEntityNotFound(_0x6c2858,null))[_0xa45d('0x25')](removeEntity(_0x6c2858,null))['catch'](handleError(_0x6c2858,null));};exports[_0xa45d('0x2c')]=function(_0x3f2f21,_0x303d18){return db[_0xa45d('0x80')][_0xa45d('0x2c')]()['then'](function(_0x5d064a){delete _0x5d064a['tags'];for(var _0x46f8c8=0x0;_0x46f8c8=_0x23b264){_0x193231=_0x23b264;_0x3f371b=0xc8;}else{_0x3f371b=0xce;}_0x471b10['status'](_0x3f371b);return _0x471b10['set']('Content-Range',_0x334e1b+'-'+_0x193231+'/'+_0x23b264)[_0x4cba('0x1e')](_0x571726);}return null;};}function patchUpdates(_0x4975af){return function(_0x228c82){try{jsonpatch['apply'](_0x228c82,_0x4975af,!![]);}catch(_0x4f6f81){return BPromise['reject'](_0x4f6f81);}return _0x228c82[_0x4cba('0x23')]();};}function saveUpdates(_0x4cf5ee,_0x5a9e52){return function(_0x4289cd){if(_0x4289cd){return _0x4289cd['update'](_0x4cf5ee)[_0x4cba('0x24')](function(_0x393de7){return _0x393de7;});}return null;};}function removeEntity(_0x34c32e,_0x2a0356){return function(_0x1c2127){if(_0x1c2127){return _0x1c2127[_0x4cba('0x25')]()['then'](function(){_0x34c32e[_0x4cba('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xaa448e,_0x26ecab){return function(_0xe2c939){if(!_0xe2c939){_0xaa448e[_0x4cba('0x1b')](0x194);}return _0xe2c939;};}function handleError(_0x4224f8,_0x122a95){_0x122a95=_0x122a95||0x1f4;return function(_0x4ef6d7){logger[_0x4cba('0x26')](_0x4ef6d7[_0x4cba('0x27')]);if(_0x4ef6d7['name']){delete _0x4ef6d7[_0x4cba('0x28')];}_0x4224f8['status'](_0x122a95)['send'](_0x4ef6d7);};}exports[_0x4cba('0x29')]=function(_0x5cf5b5,_0x62c648){var _0x30fab5={},_0x55d229={},_0x189ee8={'count':0x0,'rows':[]};return db[_0x4cba('0x2a')][_0x4cba('0x2b')]()['then'](function(_0x3c25d2){var _0x53fa60=[];for(var _0x370928=0x0;_0x3709280x1){_0x20ac58['or'](_0x4cba('0x6a'),qs[_0x4cba('0x6b')](_0x30eaa5),null);}else{if(qs['isNumeric'](_0x30eaa5)){_0x20ac58['or']('c.id\x20LIKE\x20?',_0x30eaa5+'%');_0x20ac58['or']('c.phone\x20LIKE\x20?',_0x30eaa5+'%');_0x20ac58['or']('c.mobile\x20LIKE\x20?',_0x30eaa5+'%');_0x20ac58['or'](_0x4cba('0x6c'),_0x30eaa5+'%');}else if(qs[_0x4cba('0x6d')](_0x30eaa5)){_0x20ac58['or'](_0x4cba('0x6e'),_0x30eaa5+'%');}else{_0x20ac58['or'](_0x4cba('0x6f'),'%'+_0x30eaa5+'%');_0x20ac58['or']('c.lastName\x20LIKE\x20?','%'+_0x30eaa5+'%');_0x20ac58['or'](_0x4cba('0x6e'),'%'+_0x30eaa5+'%');}}}}_0x203703['where'](_0x20ac58);_0x203703[_0x4cba('0x70')](_0x4cba('0x71'));var _0x27f644={'type':db['Sequelize']['QueryTypes'][_0x4cba('0x72')],'raw':!![]};var _0x540d19=_0x203703[_0x4cba('0x73')]()[_0x4cba('0x41')]('c.id');if(_0x30fab5[_0x4cba('0x3d')]){_0x30fab5[_0x4cba('0x3d')][_0x4cba('0x53')](function(_0x46f23d){_0x203703[_0x4cba('0x3d')]('c.'+_0x46f23d[0x0],_0x46f23d[0x1]===_0x4cba('0x74')?![]:!![]);});}if(!_['isEmpty'](_0x4f31ec)){_0x203703[_0x4cba('0x75')](_0x47f2f8);_0x540d19['where'](_0x4cba('0x76'),_0x4f31ec);}BPromise[_0x4cba('0x77')]()[_0x4cba('0x24')](function(){if(!_0x4f4d3b)return;if(_0x5cf5b5['user'][_0x4cba('0x78')]!==_0x4cba('0x79'))return;if(!_[_0x4cba('0x7a')](_0x4f4d3b[_0x4cba('0x4e')],[_0x4cba('0x41'),_0x4cba('0x56')])){return _0x5cf5b5[_0x4cba('0x7b')][_0x4cba('0x7c')]({'attributes':['id'],'raw':!![]})[_0x4cba('0x24')](function(_0x30bf84){if(_[_0x4cba('0x61')](_0x30bf84)){_0x540d19[_0x4cba('0x3f')]('c.ListId\x20IS\x20NULL');_0x203703[_0x4cba('0x3f')](_0x4cba('0x7d'));}else{_0x540d19[_0x4cba('0x3f')](_0x4cba('0x63'),_['map'](_0x30bf84,'id'));_0x203703[_0x4cba('0x3f')](_0x4cba('0x63'),_[_0x4cba('0x52')](_0x30bf84,'id'));}});}})[_0x4cba('0x24')](function(){if(_0x5cf5b5[_0x4cba('0x7b')][_0x4cba('0x78')]===_0x4cba('0x79')&&!_0x4f4d3b&&!_0x5cf5b5[_0x4cba('0x35')]['ListId'])return[];return db[_0x4cba('0x7e')][_0x4cba('0x35')](_0x540d19['toString'](),_0x27f644);})[_0x4cba('0x24')](function(_0xf23d50){_0x189ee8[_0x4cba('0x21')]=_0xf23d50[_0x4cba('0x2d')];if(_0x189ee8[_0x4cba('0x21')]===0x0)return[];return db['sequelize'][_0x4cba('0x35')](_0x1573bf[_0x4cba('0x7f')](),_0x27f644)[_0x4cba('0x24')](function(_0x2adb5b){_0x7e3bfc=_[_0x4cba('0x80')](_0x2adb5b,'id');_0x27f644=_[_0x4cba('0x81')](_0x27f644,{'model':db[_0x4cba('0x2a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5cf5b5[_0x4cba('0x35')][_0x4cba('0x39')]){_0x30fab5[_0x4cba('0x3a')][_0x4cba('0x53')](function(_0x5385c1){_0x203703['field']('c.'+_0x5385c1);});}else{_0x203703[_0x4cba('0x41')]('c.id');_0x203703[_0x4cba('0x41')](_0x4cba('0x82'));_0x203703[_0x4cba('0x41')](_0x4cba('0x83'));_0x203703[_0x4cba('0x41')](_0x4cba('0x84'));_0x203703[_0x4cba('0x41')](_0x4cba('0x85'));_0x203703[_0x4cba('0x41')](_0x4cba('0x86'));_0x203703[_0x4cba('0x41')]('c.email');_0x203703[_0x4cba('0x41')]('c.ListId');_0x203703[_0x4cba('0x41')](_0x4cba('0x87'));_0x203703[_0x4cba('0x41')](_0x4cba('0x88'));_0x203703[_0x4cba('0x41')](_0x4cba('0x89'));_0x203703[_0x4cba('0x41')](_0x4cba('0x8a'),_0x4cba('0x8b'));}if(_0x30fab5[_0x4cba('0x20')])_0x203703['limit'](_0x30fab5[_0x4cba('0x20')]);if(_0x30fab5['offset'])_0x203703[_0x4cba('0x22')](_0x30fab5[_0x4cba('0x22')]);return db[_0x4cba('0x7e')]['query'](_0x203703[_0x4cba('0x7f')](),_0x27f644);});})['then'](function(_0x302009){_0x302009[_0x4cba('0x53')](function(_0x8e23c4){if(_0x8e23c4[_0x4cba('0x8b')]){_0x8e23c4[_0x4cba('0x8c')]=[];_0x8e23c4[_0x4cba('0x8b')][_0x4cba('0x69')](',')[_0x4cba('0x53')](function(_0x5df083){_0x8e23c4['Tags']['push'](_0x7e3bfc[_0x5df083]);});}delete _0x8e23c4[_0x4cba('0x8b')];});_0x189ee8['rows']=_0x302009;return _0x189ee8;})['then'](respondWithFilteredResult(_0x62c648,_0x30fab5));})[_0x4cba('0x8d')](handleError(_0x62c648,null));};exports[_0x4cba('0x25')]=function(_0x39d634,_0x32927b){return db[_0x4cba('0x2a')]['find']({'where':{'id':_0x39d634[_0x4cba('0x8e')]['id']}})['then'](handleEntityNotFound(_0x32927b,null))[_0x4cba('0x24')](removeEntity(_0x32927b,null))[_0x4cba('0x8d')](handleError(_0x32927b,null));};exports[_0x4cba('0x2b')]=function(_0x50a9e4,_0x2b7d78){return db[_0x4cba('0x2a')][_0x4cba('0x2b')]()[_0x4cba('0x24')](function(_0x20db26){delete _0x20db26[_0x4cba('0x8f')];for(var _0x27a7d7=0x0;_0x27a7d7{}\s\\|]/g,'-');_0x2edcbd(null,util[_0x80f4('0x20')](_0x80f4('0x21'),path['basename'](_0x39b1a6[_0x80f4('0x1e')],path[_0x80f4('0x22')](_0x39b1a6[_0x80f4('0x1e')])),Date[_0x80f4('0x23')](),path['extname'](_0x39b1a6['originalname'])));}})});router[_0x80f4('0x16')](_0x80f4('0x24'),upload[_0x80f4('0x25')](_0x80f4('0x26')),controller[_0x80f4('0x27')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x14c2a0,_0x3bca58,_0x2adcad){_0x2adcad(null,path[_0x80f4('0x28')](config[_0x80f4('0x29')],_0x80f4('0x1d')));},'filename':function(_0x113c20,_0x2fbddc,_0x13c197){_0x2fbddc[_0x80f4('0x1e')]=_0x2fbddc['originalname'][_0x80f4('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x13c197(null,util[_0x80f4('0x20')](_0x80f4('0x21'),path['basename'](_0x2fbddc[_0x80f4('0x1e')],path[_0x80f4('0x22')](_0x2fbddc[_0x80f4('0x1e')])),Date[_0x80f4('0x23')](),path[_0x80f4('0x22')](_0x2fbddc[_0x80f4('0x1e')])));}})});router[_0x80f4('0x16')]('/upload',upload['single']('file'),controller['upload']);router[_0x80f4('0x16')](_0x80f4('0x2a'),auth[_0x80f4('0x9')](),controller['import']);router[_0x80f4('0x2b')](_0x80f4('0xc'),auth['isAuthenticated'](),controller[_0x80f4('0x2c')]);router[_0x80f4('0x2d')](_0x80f4('0xc'),auth[_0x80f4('0x9')](),controller['destroy']);module[_0x80f4('0x2e')]=router; \ No newline at end of file +var _0x135f=['diskStorage','join','root','server/files/tmp','originalname','format','%s-%s%s','basename','now','extname','single','file','uploadCsv','replace','/upload','upload','/upload/:id','put','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/tags','getTags','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getJscriptySessions','/:id/journey','getJourney','/merge','create','post','/create_many','setTags'];(function(_0x217c2e,_0x358f06){var _0x22b7d8=function(_0x111c48){while(--_0x111c48){_0x217c2e['push'](_0x217c2e['shift']());}};_0x22b7d8(++_0x358f06);}(_0x135f,0x1d6));var _0xf135=function(_0x2d10af,_0x56a161){_0x2d10af=_0x2d10af-0x0;var _0x2da453=_0x135f[_0x2d10af];return _0x2da453;};'use strict';var multer=require(_0xf135('0x0'));var util=require('util');var path=require(_0xf135('0x1'));var timeout=require(_0xf135('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf135('0x3'));var interaction=require(_0xf135('0x4'));var config=require(_0xf135('0x5'));var controller=require('./cmContact.controller');router[_0xf135('0x6')]('/',auth[_0xf135('0x7')](),controller['index']);router[_0xf135('0x6')](_0xf135('0x8'),auth[_0xf135('0x7')](),controller['describe']);router[_0xf135('0x6')](_0xf135('0x9'),auth[_0xf135('0x7')](),controller[_0xf135('0xa')]);router['get'](_0xf135('0xb'),auth[_0xf135('0x7')](),controller[_0xf135('0xc')]);router[_0xf135('0x6')]('/:id/hoppers',auth[_0xf135('0x7')](),controller[_0xf135('0xd')]);router[_0xf135('0x6')](_0xf135('0xe'),auth[_0xf135('0x7')](),controller['getHopperHistories']);router[_0xf135('0x6')](_0xf135('0xf'),auth['isAuthenticated'](),controller[_0xf135('0x10')]);router['get']('/:id/jscripty_sessions',auth[_0xf135('0x7')](),controller[_0xf135('0x11')]);router[_0xf135('0x6')](_0xf135('0x12'),auth[_0xf135('0x7')](),controller[_0xf135('0x13')]);router['post'](_0xf135('0x14'),auth[_0xf135('0x7')](),controller['merge']);router['post']('/',auth['isAuthenticated'](),controller[_0xf135('0x15')]);router[_0xf135('0x16')](_0xf135('0x17'),auth[_0xf135('0x7')](),controller['bulkCreate']);router[_0xf135('0x16')]('/:id/tags',auth[_0xf135('0x7')](),controller[_0xf135('0x18')]);var upload=multer({'storage':multer[_0xf135('0x19')]({'destination':function(_0x3f2cf2,_0x3ceb11,_0x4cc71d){_0x4cc71d(null,path[_0xf135('0x1a')](config[_0xf135('0x1b')],_0xf135('0x1c')));},'filename':function(_0xd8f0b5,_0x7b9a85,_0x1ac9dd){_0x7b9a85['originalname']=_0x7b9a85[_0xf135('0x1d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1ac9dd(null,util[_0xf135('0x1e')](_0xf135('0x1f'),path[_0xf135('0x20')](_0x7b9a85['originalname'],path['extname'](_0x7b9a85[_0xf135('0x1d')])),Date[_0xf135('0x21')](),path[_0xf135('0x22')](_0x7b9a85[_0xf135('0x1d')])));}})});router[_0xf135('0x16')]('/csv',upload[_0xf135('0x23')](_0xf135('0x24')),controller[_0xf135('0x25')]);var upload=multer({'storage':multer[_0xf135('0x19')]({'destination':function(_0xa74f2c,_0x307c5a,_0x172661){_0x172661(null,path['join'](config[_0xf135('0x1b')],'server/files/tmp'));},'filename':function(_0x392a23,_0x5679c2,_0x402f70){_0x5679c2[_0xf135('0x1d')]=_0x5679c2[_0xf135('0x1d')][_0xf135('0x26')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x402f70(null,util[_0xf135('0x1e')](_0xf135('0x1f'),path[_0xf135('0x20')](_0x5679c2[_0xf135('0x1d')],path[_0xf135('0x22')](_0x5679c2[_0xf135('0x1d')])),Date[_0xf135('0x21')](),path[_0xf135('0x22')](_0x5679c2[_0xf135('0x1d')])));}})});router[_0xf135('0x16')](_0xf135('0x27'),upload[_0xf135('0x23')]('file'),controller[_0xf135('0x28')]);router[_0xf135('0x16')](_0xf135('0x29'),auth['isAuthenticated'](),controller['import']);router[_0xf135('0x2a')](_0xf135('0x9'),auth[_0xf135('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf135('0x2b')]);module[_0xf135('0x2c')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 61170e7..7e7ec15 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 _0x07d6=['sequelize','lodash','exports','alias','setDataValue','getDataValue','STRING','type','select','parse','values','isArray','stringify','BOOLEAN','voice'];(function(_0x2f469d,_0x4eb2cf){var _0x187301=function(_0x887445){while(--_0x887445){_0x2f469d['push'](_0x2f469d['shift']());}};_0x187301(++_0x4eb2cf);}(_0x07d6,0xd2));var _0x607d=function(_0x337ca8,_0x2a7b60){_0x337ca8=_0x337ca8-0x0;var _0xd50979=_0x07d6[_0x337ca8];return _0xd50979;};'use strict';var Sequelize=require(_0x607d('0x0'));var _=require(_0x607d('0x1'));module[_0x607d('0x2')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x53ceda){return this['getDataValue'](_0x607d('0x3'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3626cd){this[_0x607d('0x4')](_0x607d('0x3'),_0x3626cd?_0x3626cd:this[_0x607d('0x5')]('name'));}},'type':{'type':Sequelize[_0x607d('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this[_0x607d('0x5')](_0x607d('0x7'))===_0x607d('0x8')){return JSON[_0x607d('0x9')](this['getDataValue']('values'));}else{return this[_0x607d('0x5')](_0x607d('0xa'));}},'set':function(_0xb38ef8){if(Array[_0x607d('0xb')](_0xb38ef8)){this[_0x607d('0x4')](_0x607d('0xa'),JSON[_0x607d('0xc')](_0xb38ef8));}else{this[_0x607d('0x4')](_0x607d('0xa'),_0xb38ef8);}}},'required':{'type':Sequelize[_0x607d('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x607d('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x607d('0xe'))}}; \ No newline at end of file +var _0x914f=['BOOLEAN','ENUM','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','long','select','parse','values','stringify'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x914f,0x1e3));var _0xf914=function(_0x247902,_0x26d9ca){_0x247902=_0x247902-0x0;var _0x4f8697=_0x914f[_0x247902];return _0x4f8697;};'use strict';var Sequelize=require(_0xf914('0x0'));var _=require(_0xf914('0x1'));module['exports']={'name':{'type':Sequelize[_0xf914('0x2')],'get':function(_0x2f8dc1){return this[_0xf914('0x3')](_0xf914('0x4'));}},'alias':{'type':Sequelize[_0xf914('0x5')],'allowNull':![],'set':function(_0x254589){this[_0xf914('0x6')](_0xf914('0x4'),_0x254589?_0x254589:this['getDataValue'](_0xf914('0x7')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0xf914('0x8')),'get':function(){if(this[_0xf914('0x3')]('type')===_0xf914('0x9')){return JSON[_0xf914('0xa')](this['getDataValue'](_0xf914('0xb')));}else{return this[_0xf914('0x3')](_0xf914('0xb'));}},'set':function(_0x487095){if(Array['isArray'](_0x487095)){this['setDataValue'](_0xf914('0xb'),JSON[_0xf914('0xc')](_0x487095));}else{this[_0xf914('0x6')](_0xf914('0xb'),_0x487095);}}},'required':{'type':Sequelize[_0xf914('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf914('0xd')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf914('0xe')](_0xf914('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index d32c3fb..d0e0dda 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 _0xbecb=['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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','CmCustomField','rawAttributes','fieldName','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','includeAll','find','catch','body','params','sequelize','transaction','create','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d'];(function(_0x5d8236,_0x24bdee){var _0x5b3fca=function(_0x5f482f){while(--_0x5f482f){_0x5d8236['push'](_0x5d8236['shift']());}};_0x5b3fca(++_0x24bdee);}(_0xbecb,0x117));var _0xbbec=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xbecb[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0xbbec('0x0'));var rimraf=require(_0xbbec('0x1'));var zipdir=require(_0xbbec('0x2'));var jsonpatch=require(_0xbbec('0x3'));var rp=require(_0xbbec('0x4'));var moment=require(_0xbbec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbbec('0x6'));var util=require(_0xbbec('0x7'));var path=require('path');var sox=require(_0xbbec('0x8'));var csv=require(_0xbbec('0x9'));var ejs=require(_0xbbec('0xa'));var fs=require('fs');var fs_extra=require(_0xbbec('0xb'));var _=require(_0xbbec('0xc'));var squel=require(_0xbbec('0xd'));var crypto=require(_0xbbec('0xe'));var jsforce=require(_0xbbec('0xf'));var deskjs=require(_0xbbec('0x10'));var toCsv=require(_0xbbec('0x9'));var querystring=require(_0xbbec('0x11'));var Papa=require(_0xbbec('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbbec('0x13'));var as=require(_0xbbec('0x14'));var hardwareService=require(_0xbbec('0x15'));var logger=require(_0xbbec('0x16'))(_0xbbec('0x17'));var utils=require(_0xbbec('0x18'));var config=require(_0xbbec('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbec('0x1a'))['db'];function respondWithStatusCode(_0x2a3ef2,_0x28b90f){_0x28b90f=_0x28b90f||0xcc;return function(_0x581dce){if(_0x581dce){return _0x2a3ef2[_0xbbec('0x1b')](_0x28b90f);}return _0x2a3ef2[_0xbbec('0x1c')](_0x28b90f)[_0xbbec('0x1d')]();};}function respondWithResult(_0x40bcc8,_0x544b3c){_0x544b3c=_0x544b3c||0xc8;return function(_0xced86d){if(_0xced86d){return _0x40bcc8[_0xbbec('0x1c')](_0x544b3c)[_0xbbec('0x1e')](_0xced86d);}};}function respondWithFilteredResult(_0x1106ca,_0x57c8c5){return function(_0x4d98fa){if(_0x4d98fa){var _0x46cfef=typeof _0x57c8c5[_0xbbec('0x1f')]===_0xbbec('0x20')&&typeof _0x57c8c5[_0xbbec('0x21')]===_0xbbec('0x20');var _0x307327=_0x4d98fa[_0xbbec('0x22')];var _0xf060d4=_0x46cfef?0x0:_0x57c8c5[_0xbbec('0x1f')];var _0x91b79b=_0x46cfef?_0x4d98fa['count']:_0x57c8c5[_0xbbec('0x1f')]+_0x57c8c5['limit'];var _0x3acfc3;if(_0x91b79b>=_0x307327){_0x91b79b=_0x307327;_0x3acfc3=0xc8;}else{_0x3acfc3=0xce;}_0x1106ca['status'](_0x3acfc3);return _0x1106ca[_0xbbec('0x23')](_0xbbec('0x24'),_0xf060d4+'-'+_0x91b79b+'/'+_0x307327)[_0xbbec('0x1e')](_0x4d98fa);}return null;};}function patchUpdates(_0x18e38d){return function(_0x26585b){try{jsonpatch[_0xbbec('0x25')](_0x26585b,_0x18e38d,!![]);}catch(_0x14f052){return BPromise[_0xbbec('0x26')](_0x14f052);}return _0x26585b[_0xbbec('0x27')]();};}function saveUpdates(_0x3adec6,_0x232bf1){return function(_0x4d6ebe){if(_0x4d6ebe){return _0x4d6ebe[_0xbbec('0x28')](_0x3adec6)[_0xbbec('0x29')](function(_0x4ca61a){return _0x4ca61a;});}return null;};}function removeEntity(_0x775782,_0x1f22db){return function(_0x3e7e1a){if(_0x3e7e1a){return _0x3e7e1a[_0xbbec('0x2a')]()['then'](function(){_0x775782['status'](0xcc)[_0xbbec('0x1d')]();});}};}function handleEntityNotFound(_0x5307d9,_0x10b641){return function(_0x1a8e49){if(!_0x1a8e49){_0x5307d9[_0xbbec('0x1b')](0x194);}return _0x1a8e49;};}function handleError(_0x2baf05,_0x2dfab4){_0x2dfab4=_0x2dfab4||0x1f4;return function(_0x2d1b1b){logger[_0xbbec('0x2b')](_0x2d1b1b['stack']);if(_0x2d1b1b[_0xbbec('0x2c')]){delete _0x2d1b1b[_0xbbec('0x2c')];}_0x2baf05[_0xbbec('0x1c')](_0x2dfab4)[_0xbbec('0x2d')](_0x2d1b1b);};}exports[_0xbbec('0x2e')]=function(_0x472dd8,_0x506a98){var _0x1cd1d0={},_0x3a57d8={},_0x1a945b={'count':0x0,'rows':[]};var _0x1387d6=_['map'](db[_0xbbec('0x2f')][_0xbbec('0x30')],function(_0x5e4fc2){return{'name':_0x5e4fc2[_0xbbec('0x31')],'type':_0x5e4fc2['type'][_0xbbec('0x32')]};});_0x3a57d8[_0xbbec('0x33')]=_[_0xbbec('0x34')](_[_0xbbec('0x35')](_0x1387d6,_0xbbec('0x2c')),[_0xbbec('0x2c')]);_0x3a57d8[_0xbbec('0x36')]=_[_0xbbec('0x37')](_0x472dd8[_0xbbec('0x36')]);_0x3a57d8[_0xbbec('0x38')]=_[_0xbbec('0x39')](_0x3a57d8[_0xbbec('0x33')],_0x3a57d8[_0xbbec('0x36')]);_0x1cd1d0[_0xbbec('0x3a')]=_[_0xbbec('0x39')](_0x3a57d8[_0xbbec('0x33')],qs[_0xbbec('0x3b')](_0x472dd8[_0xbbec('0x36')][_0xbbec('0x3b')]));_0x1cd1d0[_0xbbec('0x3a')]=_0x1cd1d0[_0xbbec('0x3a')][_0xbbec('0x3c')]?_0x1cd1d0[_0xbbec('0x3a')]:_0x3a57d8[_0xbbec('0x33')];if(!_0x472dd8['query']['hasOwnProperty'](_0xbbec('0x3d'))){_0x1cd1d0['limit']=qs[_0xbbec('0x21')](_0x472dd8[_0xbbec('0x36')][_0xbbec('0x21')]);_0x1cd1d0['offset']=qs[_0xbbec('0x1f')](_0x472dd8[_0xbbec('0x36')][_0xbbec('0x1f')]);}_0x1cd1d0['order']=qs[_0xbbec('0x3e')](_0x472dd8[_0xbbec('0x36')][_0xbbec('0x3e')]);_0x1cd1d0[_0xbbec('0x3f')]=qs[_0xbbec('0x38')](_[_0xbbec('0x40')](_0x472dd8[_0xbbec('0x36')],_0x3a57d8[_0xbbec('0x38')]),_0x1387d6);if(_0x472dd8[_0xbbec('0x36')][_0xbbec('0x41')]){_0x1cd1d0[_0xbbec('0x3f')]=_['merge'](_0x1cd1d0['where'],{'$or':_[_0xbbec('0x35')](_0x1387d6,function(_0x32418a){if(_0x32418a[_0xbbec('0x42')]!==_0xbbec('0x43')){var _0x413af4={};_0x413af4[_0x32418a[_0xbbec('0x2c')]]={'$like':'%'+_0x472dd8[_0xbbec('0x36')][_0xbbec('0x41')]+'%'};return _0x413af4;}})});}_0x1cd1d0=_[_0xbbec('0x44')]({},_0x1cd1d0,_0x472dd8[_0xbbec('0x45')]);var _0x3ddd4d={'where':_0x1cd1d0[_0xbbec('0x3f')]};return db['CmCustomField'][_0xbbec('0x22')](_0x3ddd4d)[_0xbbec('0x29')](function(_0x37489b){_0x1a945b['count']=_0x37489b;if(_0x472dd8['query']['includeAll']){_0x1cd1d0[_0xbbec('0x46')]=[{'all':!![]}];}return db[_0xbbec('0x2f')][_0xbbec('0x47')](_0x1cd1d0);})[_0xbbec('0x29')](function(_0x274f82){_0x1a945b[_0xbbec('0x48')]=_0x274f82;return _0x1a945b;})[_0xbbec('0x29')](respondWithFilteredResult(_0x506a98,_0x1cd1d0))['catch'](handleError(_0x506a98,null));};exports[_0xbbec('0x49')]=function(_0x7f5899,_0x52bf6d){var _0x4d0de4={'raw':!![],'where':{'id':_0x7f5899['params']['id']}},_0x1e3a62={};_0x1e3a62[_0xbbec('0x33')]=_[_0xbbec('0x37')](db[_0xbbec('0x2f')][_0xbbec('0x30')]);_0x1e3a62[_0xbbec('0x36')]=_['keys'](_0x7f5899[_0xbbec('0x36')]);_0x1e3a62[_0xbbec('0x38')]=_[_0xbbec('0x39')](_0x1e3a62['model'],_0x1e3a62[_0xbbec('0x36')]);_0x4d0de4[_0xbbec('0x3a')]=_[_0xbbec('0x39')](_0x1e3a62[_0xbbec('0x33')],qs[_0xbbec('0x3b')](_0x7f5899[_0xbbec('0x36')][_0xbbec('0x3b')]));_0x4d0de4[_0xbbec('0x3a')]=_0x4d0de4[_0xbbec('0x3a')][_0xbbec('0x3c')]?_0x4d0de4[_0xbbec('0x3a')]:_0x1e3a62[_0xbbec('0x33')];if(_0x7f5899[_0xbbec('0x36')][_0xbbec('0x4a')]){_0x4d0de4['include']=[{'all':!![]}];}_0x4d0de4=_[_0xbbec('0x44')]({},_0x4d0de4,_0x7f5899['options']);return db['CmCustomField'][_0xbbec('0x4b')](_0x4d0de4)[_0xbbec('0x29')](handleEntityNotFound(_0x52bf6d,null))[_0xbbec('0x29')](respondWithResult(_0x52bf6d,null))[_0xbbec('0x4c')](handleError(_0x52bf6d,null));};exports['update']=function(_0x3f32cf,_0x1498b7){if(_0x3f32cf[_0xbbec('0x4d')]['id']){delete _0x3f32cf[_0xbbec('0x4d')]['id'];}return db[_0xbbec('0x2f')][_0xbbec('0x4b')]({'where':{'id':_0x3f32cf['params']['id']}})['then'](handleEntityNotFound(_0x1498b7,null))[_0xbbec('0x29')](saveUpdates(_0x3f32cf[_0xbbec('0x4d')],null))[_0xbbec('0x29')](respondWithResult(_0x1498b7,null))[_0xbbec('0x4c')](handleError(_0x1498b7,null));};exports[_0xbbec('0x2a')]=function(_0x1b72a6,_0x2fbc39){return db[_0xbbec('0x2f')][_0xbbec('0x4b')]({'where':{'id':_0x1b72a6[_0xbbec('0x4e')]['id']}})[_0xbbec('0x29')](handleEntityNotFound(_0x2fbc39,null))[_0xbbec('0x29')](removeEntity(_0x2fbc39,null))['catch'](handleError(_0x2fbc39,null));};exports['create']=function(_0x3893b0,_0x175086){var _0x13d570;return db[_0xbbec('0x4f')][_0xbbec('0x50')](function(_0x3c0b82){return db['CmCustomField'][_0xbbec('0x51')](_0x3893b0[_0xbbec('0x4d')],{'transaction':_0x3c0b82})[_0xbbec('0x29')](function(_0x3a2a5d){_0x13d570=_0x3a2a5d;var _0x2a01c8={'type':db['Sequelize'][_0xbbec('0x52')],'transaction':_0x3c0b82};switch(_0x3893b0[_0xbbec('0x4d')][_0xbbec('0x42')]){case _0xbbec('0x53'):_0x2a01c8[_0xbbec('0x42')]=db[_0xbbec('0x54')]['TEXT'];break;case'number':_0x2a01c8[_0xbbec('0x42')]=db['Sequelize'][_0xbbec('0x55')];break;case _0xbbec('0x56'):_0x2a01c8[_0xbbec('0x42')]=db['Sequelize'][_0xbbec('0x57')];_0x2a01c8['defaultValue']=![];break;default:}return db[_0xbbec('0x4f')][_0xbbec('0x58')][_0xbbec('0x59')](_0xbbec('0x5a'),util[_0xbbec('0x5b')](_0xbbec('0x5c'),_0x13d570['id']),_0x2a01c8);})[_0xbbec('0x29')](function(){return _0x13d570;});})[_0xbbec('0x29')](respondWithResult(_0x175086,0xc9))[_0xbbec('0x4c')](handleError(_0x175086,null));}; \ No newline at end of file +var _0xd159=['pick','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','body','find','sequelize','transaction','Sequelize','TEXT','text','number','switch','BOOLEAN','defaultValue','queryInterface','addColumn','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','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','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','attributes','fields','length','hasOwnProperty','nolimit','where','filters'];(function(_0x3dffb5,_0x1964ac){var _0x252404=function(_0x2f3aff){while(--_0x2f3aff){_0x3dffb5['push'](_0x3dffb5['shift']());}};_0x252404(++_0x1964ac);}(_0xd159,0x172));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('moment');var BPromise=require(_0x9d15('0x4'));var Mustache=require('mustache');var util=require(_0x9d15('0x5'));var path=require(_0x9d15('0x6'));var sox=require(_0x9d15('0x7'));var csv=require(_0x9d15('0x8'));var ejs=require(_0x9d15('0x9'));var fs=require('fs');var fs_extra=require(_0x9d15('0xa'));var _=require('lodash');var squel=require(_0x9d15('0xb'));var crypto=require(_0x9d15('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9d15('0x8'));var querystring=require(_0x9d15('0xd'));var Papa=require(_0x9d15('0xe'));var Redis=require(_0x9d15('0xf'));var authService=require(_0x9d15('0x10'));var qs=require(_0x9d15('0x11'));var as=require(_0x9d15('0x12'));var hardwareService=require(_0x9d15('0x13'));var logger=require(_0x9d15('0x14'))(_0x9d15('0x15'));var utils=require(_0x9d15('0x16'));var config=require(_0x9d15('0x17'));var licenseUtil=require(_0x9d15('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x425894,_0x4f1a69){_0x4f1a69=_0x4f1a69||0xcc;return function(_0x9f1ed7){if(_0x9f1ed7){return _0x425894[_0x9d15('0x19')](_0x4f1a69);}return _0x425894[_0x9d15('0x1a')](_0x4f1a69)[_0x9d15('0x1b')]();};}function respondWithResult(_0x16ed0d,_0x30948b){_0x30948b=_0x30948b||0xc8;return function(_0x5cf2e5){if(_0x5cf2e5){return _0x16ed0d[_0x9d15('0x1a')](_0x30948b)[_0x9d15('0x1c')](_0x5cf2e5);}};}function respondWithFilteredResult(_0x1a5a9b,_0x5a0975){return function(_0x254eb3){if(_0x254eb3){var _0x33105c=typeof _0x5a0975[_0x9d15('0x1d')]===_0x9d15('0x1e')&&typeof _0x5a0975[_0x9d15('0x1f')]==='undefined';var _0x15b4ba=_0x254eb3[_0x9d15('0x20')];var _0x207cab=_0x33105c?0x0:_0x5a0975[_0x9d15('0x1d')];var _0x3ec883=_0x33105c?_0x254eb3['count']:_0x5a0975[_0x9d15('0x1d')]+_0x5a0975['limit'];var _0x4a837e;if(_0x3ec883>=_0x15b4ba){_0x3ec883=_0x15b4ba;_0x4a837e=0xc8;}else{_0x4a837e=0xce;}_0x1a5a9b[_0x9d15('0x1a')](_0x4a837e);return _0x1a5a9b['set'](_0x9d15('0x21'),_0x207cab+'-'+_0x3ec883+'/'+_0x15b4ba)['json'](_0x254eb3);}return null;};}function patchUpdates(_0x4251b1){return function(_0x38c8c4){try{jsonpatch['apply'](_0x38c8c4,_0x4251b1,!![]);}catch(_0x48f41d){return BPromise[_0x9d15('0x22')](_0x48f41d);}return _0x38c8c4[_0x9d15('0x23')]();};}function saveUpdates(_0x3437ba,_0x127aed){return function(_0x1d383c){if(_0x1d383c){return _0x1d383c[_0x9d15('0x24')](_0x3437ba)[_0x9d15('0x25')](function(_0x1d5d25){return _0x1d5d25;});}return null;};}function removeEntity(_0xab86ee,_0x5942f0){return function(_0x215199){if(_0x215199){return _0x215199[_0x9d15('0x26')]()[_0x9d15('0x25')](function(){_0xab86ee['status'](0xcc)[_0x9d15('0x1b')]();});}};}function handleEntityNotFound(_0x3d3aa1,_0x38b8cc){return function(_0x5c9237){if(!_0x5c9237){_0x3d3aa1[_0x9d15('0x19')](0x194);}return _0x5c9237;};}function handleError(_0x58727b,_0x3187d6){_0x3187d6=_0x3187d6||0x1f4;return function(_0x57f89b){logger['error'](_0x57f89b[_0x9d15('0x27')]);if(_0x57f89b[_0x9d15('0x28')]){delete _0x57f89b[_0x9d15('0x28')];}_0x58727b[_0x9d15('0x1a')](_0x3187d6)[_0x9d15('0x29')](_0x57f89b);};}exports[_0x9d15('0x2a')]=function(_0x54de28,_0x167020){var _0x52866c={},_0x34db23={},_0x4ab9be={'count':0x0,'rows':[]};var _0x434106=_[_0x9d15('0x2b')](db[_0x9d15('0x2c')][_0x9d15('0x2d')],function(_0x1bdafa){return{'name':_0x1bdafa[_0x9d15('0x2e')],'type':_0x1bdafa[_0x9d15('0x2f')][_0x9d15('0x30')]};});_0x34db23[_0x9d15('0x31')]=_[_0x9d15('0x32')](_[_0x9d15('0x2b')](_0x434106,_0x9d15('0x28')),[_0x9d15('0x28')]);_0x34db23[_0x9d15('0x33')]=_[_0x9d15('0x34')](_0x54de28[_0x9d15('0x33')]);_0x34db23['filters']=_['intersection'](_0x34db23['model'],_0x34db23[_0x9d15('0x33')]);_0x52866c[_0x9d15('0x35')]=_['intersection'](_0x34db23[_0x9d15('0x31')],qs['fields'](_0x54de28[_0x9d15('0x33')][_0x9d15('0x36')]));_0x52866c[_0x9d15('0x35')]=_0x52866c[_0x9d15('0x35')][_0x9d15('0x37')]?_0x52866c[_0x9d15('0x35')]:_0x34db23[_0x9d15('0x31')];if(!_0x54de28['query'][_0x9d15('0x38')](_0x9d15('0x39'))){_0x52866c['limit']=qs[_0x9d15('0x1f')](_0x54de28[_0x9d15('0x33')][_0x9d15('0x1f')]);_0x52866c[_0x9d15('0x1d')]=qs[_0x9d15('0x1d')](_0x54de28[_0x9d15('0x33')][_0x9d15('0x1d')]);}_0x52866c['order']=qs['sort'](_0x54de28[_0x9d15('0x33')]['sort']);_0x52866c[_0x9d15('0x3a')]=qs[_0x9d15('0x3b')](_[_0x9d15('0x3c')](_0x54de28[_0x9d15('0x33')],_0x34db23[_0x9d15('0x3b')]),_0x434106);if(_0x54de28[_0x9d15('0x33')][_0x9d15('0x3d')]){_0x52866c[_0x9d15('0x3a')]=_[_0x9d15('0x3e')](_0x52866c[_0x9d15('0x3a')],{'$or':_['map'](_0x434106,function(_0x1c6fe8){if(_0x1c6fe8[_0x9d15('0x2f')]!=='VIRTUAL'){var _0x4a61eb={};_0x4a61eb[_0x1c6fe8['name']]={'$like':'%'+_0x54de28[_0x9d15('0x33')][_0x9d15('0x3d')]+'%'};return _0x4a61eb;}})});}_0x52866c=_[_0x9d15('0x3e')]({},_0x52866c,_0x54de28[_0x9d15('0x3f')]);var _0x149ef8={'where':_0x52866c[_0x9d15('0x3a')]};return db[_0x9d15('0x2c')][_0x9d15('0x20')](_0x149ef8)[_0x9d15('0x25')](function(_0x2cb53e){_0x4ab9be[_0x9d15('0x20')]=_0x2cb53e;if(_0x54de28[_0x9d15('0x33')][_0x9d15('0x40')]){_0x52866c[_0x9d15('0x41')]=[{'all':!![]}];}return db[_0x9d15('0x2c')]['findAll'](_0x52866c);})[_0x9d15('0x25')](function(_0x48b7c){_0x4ab9be[_0x9d15('0x42')]=_0x48b7c;return _0x4ab9be;})[_0x9d15('0x25')](respondWithFilteredResult(_0x167020,_0x52866c))[_0x9d15('0x43')](handleError(_0x167020,null));};exports[_0x9d15('0x44')]=function(_0x4767d1,_0x59dfc8){var _0x9d4ae={'raw':!![],'where':{'id':_0x4767d1[_0x9d15('0x45')]['id']}},_0x493c6e={};_0x493c6e[_0x9d15('0x31')]=_['keys'](db[_0x9d15('0x2c')]['rawAttributes']);_0x493c6e[_0x9d15('0x33')]=_[_0x9d15('0x34')](_0x4767d1[_0x9d15('0x33')]);_0x493c6e['filters']=_['intersection'](_0x493c6e[_0x9d15('0x31')],_0x493c6e[_0x9d15('0x33')]);_0x9d4ae[_0x9d15('0x35')]=_[_0x9d15('0x46')](_0x493c6e['model'],qs[_0x9d15('0x36')](_0x4767d1[_0x9d15('0x33')][_0x9d15('0x36')]));_0x9d4ae[_0x9d15('0x35')]=_0x9d4ae[_0x9d15('0x35')][_0x9d15('0x37')]?_0x9d4ae['attributes']:_0x493c6e['model'];if(_0x4767d1[_0x9d15('0x33')][_0x9d15('0x40')]){_0x9d4ae['include']=[{'all':!![]}];}_0x9d4ae=_['merge']({},_0x9d4ae,_0x4767d1['options']);return db['CmCustomField']['find'](_0x9d4ae)[_0x9d15('0x25')](handleEntityNotFound(_0x59dfc8,null))[_0x9d15('0x25')](respondWithResult(_0x59dfc8,null))[_0x9d15('0x43')](handleError(_0x59dfc8,null));};exports[_0x9d15('0x24')]=function(_0x5253cc,_0x439753){if(_0x5253cc[_0x9d15('0x47')]['id']){delete _0x5253cc[_0x9d15('0x47')]['id'];}return db[_0x9d15('0x2c')][_0x9d15('0x48')]({'where':{'id':_0x5253cc[_0x9d15('0x45')]['id']}})[_0x9d15('0x25')](handleEntityNotFound(_0x439753,null))[_0x9d15('0x25')](saveUpdates(_0x5253cc[_0x9d15('0x47')],null))['then'](respondWithResult(_0x439753,null))[_0x9d15('0x43')](handleError(_0x439753,null));};exports[_0x9d15('0x26')]=function(_0x2b8edd,_0x4746b4){return db[_0x9d15('0x2c')][_0x9d15('0x48')]({'where':{'id':_0x2b8edd['params']['id']}})['then'](handleEntityNotFound(_0x4746b4,null))['then'](removeEntity(_0x4746b4,null))[_0x9d15('0x43')](handleError(_0x4746b4,null));};exports['create']=function(_0x439a95,_0x263c59){var _0x39c2f6;return db[_0x9d15('0x49')][_0x9d15('0x4a')](function(_0x5efee9){return db[_0x9d15('0x2c')]['create'](_0x439a95[_0x9d15('0x47')],{'transaction':_0x5efee9})[_0x9d15('0x25')](function(_0xbb767b){_0x39c2f6=_0xbb767b;var _0x1b0819={'type':db[_0x9d15('0x4b')][_0x9d15('0x4c')],'transaction':_0x5efee9};switch(_0x439a95[_0x9d15('0x47')][_0x9d15('0x2f')]){case _0x9d15('0x4d'):_0x1b0819[_0x9d15('0x2f')]=db[_0x9d15('0x4b')][_0x9d15('0x4c')];break;case _0x9d15('0x4e'):_0x1b0819[_0x9d15('0x2f')]=db[_0x9d15('0x4b')]['INTEGER'];break;case _0x9d15('0x4f'):_0x1b0819[_0x9d15('0x2f')]=db[_0x9d15('0x4b')][_0x9d15('0x50')];_0x1b0819[_0x9d15('0x51')]=![];break;default:}return db['sequelize'][_0x9d15('0x52')][_0x9d15('0x53')]('cm_contacts',util[_0x9d15('0x54')](_0x9d15('0x55'),_0x39c2f6['id']),_0x1b0819);})[_0x9d15('0x25')](function(){return _0x39c2f6;});})[_0x9d15('0x25')](respondWithResult(_0x263c59,0xc9))[_0x9d15('0x43')](handleError(_0x263c59,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1039c14..60ab25f 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 _0x3ede=['cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x4841b5,_0x5503a2){var _0x1dee74=function(_0x129336){while(--_0x129336){_0x4841b5['push'](_0x4841b5['shift']());}};_0x1dee74(++_0x5503a2);}(_0x3ede,0xe5));var _0xe3ed=function(_0x4f4d19,_0x574245){_0x4f4d19=_0x4f4d19-0x0;var _0x27a258=_0x3ede[_0x4f4d19];return _0x27a258;};'use strict';var _=require(_0xe3ed('0x0'));var util=require('util');var logger=require(_0xe3ed('0x1'))(_0xe3ed('0x2'));var moment=require(_0xe3ed('0x3'));var BPromise=require(_0xe3ed('0x4'));var rp=require(_0xe3ed('0x5'));var fs=require('fs');var path=require(_0xe3ed('0x6'));var rimraf=require('rimraf');var config=require(_0xe3ed('0x7'));var attributes=require(_0xe3ed('0x8'));module['exports']=function(_0x1537e0,_0x3e9894){return _0x1537e0[_0xe3ed('0x9')](_0xe3ed('0xa'),attributes,{'tableName':_0xe3ed('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5237=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x15b687,_0x1ecc83){var _0x1b1098=function(_0x1643ca){while(--_0x1643ca){_0x15b687['push'](_0x15b687['shift']());}};_0x1b1098(++_0x1ecc83);}(_0x5237,0x12c));var _0x7523=function(_0x4f4166,_0x25ddcc){_0x4f4166=_0x4f4166-0x0;var _0x2ecc2f=_0x5237[_0x4f4166];return _0x2ecc2f;};'use strict';var _=require(_0x7523('0x0'));var util=require(_0x7523('0x1'));var logger=require(_0x7523('0x2'))(_0x7523('0x3'));var moment=require(_0x7523('0x4'));var BPromise=require(_0x7523('0x5'));var rp=require(_0x7523('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7523('0x7'));var config=require(_0x7523('0x8'));var attributes=require(_0x7523('0x9'));module[_0x7523('0xa')]=function(_0x5f7778,_0x5f33ca){return _0x5f7778[_0x7523('0xb')](_0x7523('0xc'),attributes,{'tableName':_0x7523('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index daef3bd..115727a 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 _0xf4a9=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x11a18c,_0x269745){var _0x28545c=function(_0x43bb10){while(--_0x43bb10){_0x11a18c['push'](_0x11a18c['shift']());}};_0x28545c(++_0x269745);}(_0xf4a9,0x164));var _0x9f4a=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0xf4a9[_0xa98302];return _0x1ad8e3;};'use strict';var _=require(_0x9f4a('0x0'));var util=require(_0x9f4a('0x1'));var moment=require('moment');var BPromise=require(_0x9f4a('0x2'));var rs=require(_0x9f4a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f4a('0x4'))['db'];var utils=require(_0x9f4a('0x5'));var logger=require(_0x9f4a('0x6'))(_0x9f4a('0x7'));var config=require(_0x9f4a('0x8'));var jayson=require(_0x9f4a('0x9'));var client=jayson[_0x9f4a('0xa')][_0x9f4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd71a3b,_0x24338a,_0x485bcc){return new BPromise(function(_0x23576c,_0xe24605){return client[_0x9f4a('0xc')](_0xd71a3b,_0x485bcc)[_0x9f4a('0xd')](function(_0x6bffff){logger[_0x9f4a('0xe')](_0x9f4a('0xf'),_0x24338a,_0x9f4a('0x10'));logger[_0x9f4a('0x11')]('CmCustomField,\x20%s,\x20%s,\x20%s',_0x24338a,'request\x20sent',JSON[_0x9f4a('0x12')](_0x6bffff));if(_0x6bffff[_0x9f4a('0x13')]){if(_0x6bffff[_0x9f4a('0x13')][_0x9f4a('0x14')]===0x1f4){logger[_0x9f4a('0x13')](_0x9f4a('0xf'),_0x24338a,_0x6bffff[_0x9f4a('0x13')][_0x9f4a('0x15')]);return _0xe24605(_0x6bffff[_0x9f4a('0x13')][_0x9f4a('0x15')]);}logger[_0x9f4a('0x13')](_0x9f4a('0xf'),_0x24338a,_0x6bffff[_0x9f4a('0x13')][_0x9f4a('0x15')]);return _0x23576c(_0x6bffff[_0x9f4a('0x13')][_0x9f4a('0x15')]);}else{logger['info'](_0x9f4a('0xf'),_0x24338a,_0x9f4a('0x10'));_0x23576c(_0x6bffff[_0x9f4a('0x16')][_0x9f4a('0x15')]);}})[_0x9f4a('0x17')](function(_0x3faa14){logger[_0x9f4a('0x13')](_0x9f4a('0xf'),_0x24338a,_0x3faa14);_0xe24605(_0x3faa14);});});} \ No newline at end of file +var _0x66a2=['error','code','CmCustomField,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x468ef5,_0x4462bc){var _0x432060=function(_0x127a62){while(--_0x127a62){_0x468ef5['push'](_0x468ef5['shift']());}};_0x432060(++_0x4462bc);}(_0x66a2,0x156));var _0x266a=function(_0x166144,_0x5a8b8f){_0x166144=_0x166144-0x0;var _0x403981=_0x66a2[_0x166144];return _0x403981;};'use strict';var _=require(_0x266a('0x0'));var util=require('util');var moment=require(_0x266a('0x1'));var BPromise=require(_0x266a('0x2'));var rs=require(_0x266a('0x3'));var fs=require('fs');var Redis=require(_0x266a('0x4'));var db=require(_0x266a('0x5'))['db'];var utils=require(_0x266a('0x6'));var logger=require(_0x266a('0x7'))(_0x266a('0x8'));var config=require(_0x266a('0x9'));var jayson=require(_0x266a('0xa'));var client=jayson[_0x266a('0xb')][_0x266a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfd1f54,_0x3345d2,_0x315ec2){return new BPromise(function(_0x2aaa3a,_0x48f110){return client[_0x266a('0xd')](_0xfd1f54,_0x315ec2)['then'](function(_0x563ffd){logger['info']('CmCustomField,\x20%s,\x20%s',_0x3345d2,_0x266a('0xe'));logger[_0x266a('0xf')](_0x266a('0x10'),_0x3345d2,_0x266a('0xe'),JSON[_0x266a('0x11')](_0x563ffd));if(_0x563ffd[_0x266a('0x12')]){if(_0x563ffd['error'][_0x266a('0x13')]===0x1f4){logger[_0x266a('0x12')](_0x266a('0x14'),_0x3345d2,_0x563ffd[_0x266a('0x12')]['message']);return _0x48f110(_0x563ffd[_0x266a('0x12')][_0x266a('0x15')]);}logger[_0x266a('0x12')](_0x266a('0x14'),_0x3345d2,_0x563ffd[_0x266a('0x12')]['message']);return _0x2aaa3a(_0x563ffd[_0x266a('0x12')]['message']);}else{logger[_0x266a('0x16')](_0x266a('0x14'),_0x3345d2,_0x266a('0xe'));_0x2aaa3a(_0x563ffd[_0x266a('0x17')][_0x266a('0x15')]);}})['catch'](function(_0x41ee83){logger['error'](_0x266a('0x14'),_0x3345d2,_0x41ee83);_0x48f110(_0x41ee83);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e6b8408..37e9249 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 _0x4074=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports'];(function(_0x3125ed,_0x380c0a){var _0x74f915=function(_0x22df08){while(--_0x22df08){_0x3125ed['push'](_0x3125ed['shift']());}};_0x74f915(++_0x380c0a);}(_0x4074,0xf0));var _0x4407=function(_0x17f336,_0x4ae346){_0x17f336=_0x17f336-0x0;var _0x25fa3c=_0x4074[_0x17f336];return _0x25fa3c;};'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('0xf')]('/',auth[_0x4407('0xb')](),controller['create']);router['put']('/:id',auth[_0x4407('0xb')](),controller[_0x4407('0x10')]);router[_0x4407('0x11')](_0x4407('0xd'),auth[_0x4407('0xb')](),controller[_0x4407('0x12')]);module[_0x4407('0x13')]=router; \ No newline at end of file +var _0xfdcd=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','util'];(function(_0x242a98,_0x13988e){var _0x580999=function(_0x341927){while(--_0x341927){_0x242a98['push'](_0x242a98['shift']());}};_0x580999(++_0x13988e);}(_0xfdcd,0xe9));var _0xdfdc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfdcd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdfdc('0x0'));var path=require(_0xdfdc('0x1'));var timeout=require(_0xdfdc('0x2'));var express=require('express');var router=express[_0xdfdc('0x3')]();var fs_extra=require(_0xdfdc('0x4'));var auth=require(_0xdfdc('0x5'));var interaction=require(_0xdfdc('0x6'));var config=require(_0xdfdc('0x7'));var controller=require(_0xdfdc('0x8'));router[_0xdfdc('0x9')]('/',auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xb')]);router[_0xdfdc('0x9')](_0xdfdc('0xc'),auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xd')]);router['post']('/',auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xe')]);router['put'](_0xdfdc('0xc'),auth[_0xdfdc('0xa')](),controller[_0xdfdc('0xf')]);router[_0xdfdc('0x10')](_0xdfdc('0xc'),auth['isAuthenticated'](),controller[_0xdfdc('0x11')]);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 ffe6dbe..41e12bb 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 _0x494a=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','BOOLEAN','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x4275d5,_0x4a0e7f){var _0x4876ef=function(_0x506625){while(--_0x506625){_0x4275d5['push'](_0x4275d5['shift']());}};_0x4876ef(++_0x4a0e7f);}(_0x494a,0x13e));var _0xa494=function(_0x512cdb,_0x41ba6d){_0x512cdb=_0x512cdb-0x0;var _0x1d0187=_0x494a[_0x512cdb];return _0x1d0187;};'use strict';var moment=require(_0xa494('0x0'));var Sequelize=require(_0xa494('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa494('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa494('0x3')],'defaultValue':moment()[_0xa494('0x4')](_0xa494('0x5'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa494('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xa494('0x6')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa494('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa494('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa494('0x3')]},'priority':{'type':Sequelize[_0xa494('0x6')](0x2)[_0xa494('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa494('0x6')],'unique':_0xa494('0x9')},'ListId':{'type':Sequelize[_0xa494('0x6')],'unique':_0xa494('0x9')},'UserId':{'type':Sequelize[_0xa494('0x6')]},'VoiceQueueId':{'type':Sequelize[_0xa494('0x6')],'unique':_0xa494('0x9')},'CampaignId':{'type':Sequelize[_0xa494('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa494('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa494('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa494('0x6')],'defaultValue':0x0}}; \ No newline at end of file +var _0xad5d=['INTEGER','BOOLEAN','DATE','UNSIGNED','contactListQueue','moment','sequelize','STRING','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xad5d,0x83));var _0xdad5=function(_0x2b3d5d,_0x5b23b5){_0x2b3d5d=_0x2b3d5d-0x0;var _0x64b796=_0xad5d[_0x2b3d5d];return _0x64b796;};'use strict';var moment=require(_0xdad5('0x0'));var Sequelize=require(_0xdad5('0x1'));module['exports']={'phone':{'type':Sequelize[_0xdad5('0x2')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0xdad5('0x3'))},'countbusyretry':{'type':Sequelize[_0xdad5('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdad5('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdad5('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xdad5('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdad5('0x6')]},'priority':{'type':Sequelize[_0xdad5('0x4')](0x2)[_0xdad5('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xdad5('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xdad5('0x4')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xdad5('0x4')],'unique':_0xdad5('0x8')},'UserId':{'type':Sequelize[_0xdad5('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xdad5('0x4')],'unique':_0xdad5('0x8')},'CampaignId':{'type':Sequelize[_0xdad5('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xdad5('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xdad5('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xdad5('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 84428d4..1a47951 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 _0x02d5=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','create','body','catch','describe','params','VoiceQueueId','Campaign','CampaignId','dataValues','createdAt','state','statedesc','campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','UPDATE','Contact','CmCompany','Company','CmList','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','entity\x20not\x20found','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','CmHopper','fieldName','type','key','model','query','keys','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$eq','$not','$notBetween','$like','$iLike','$overlap','$contains','$contained','$any','fields','attributes','length','hasOwnProperty','nolimit','sort','where'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x02d5,0x15c));var _0x502d=function(_0x74115b,_0x31f752){_0x74115b=_0x74115b-0x0;var _0x57ebbd=_0x02d5[_0x74115b];return _0x57ebbd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x502d('0x0'));var zipdir=require(_0x502d('0x1'));var jsonpatch=require(_0x502d('0x2'));var rp=require(_0x502d('0x3'));var moment=require('moment');var BPromise=require(_0x502d('0x4'));var Mustache=require(_0x502d('0x5'));var util=require(_0x502d('0x6'));var path=require(_0x502d('0x7'));var sox=require(_0x502d('0x8'));var csv=require('to-csv');var ejs=require(_0x502d('0x9'));var fs=require('fs');var fs_extra=require(_0x502d('0xa'));var _=require(_0x502d('0xb'));var squel=require('squel');var crypto=require(_0x502d('0xc'));var jsforce=require(_0x502d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x502d('0xe'));var querystring=require(_0x502d('0xf'));var Papa=require(_0x502d('0x10'));var Redis=require(_0x502d('0x11'));var authService=require(_0x502d('0x12'));var qs=require(_0x502d('0x13'));var as=require(_0x502d('0x14'));var hardwareService=require(_0x502d('0x15'));var logger=require(_0x502d('0x16'))(_0x502d('0x17'));var utils=require(_0x502d('0x18'));var config=require(_0x502d('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x502d('0x1a'))['db'];function respondWithStatusCode(_0x3958d1,_0x40eee2){_0x40eee2=_0x40eee2||0xcc;return function(_0x512785){if(_0x512785){return _0x3958d1['sendStatus'](_0x40eee2);}return _0x3958d1[_0x502d('0x1b')](_0x40eee2)[_0x502d('0x1c')]();};}function respondWithResult(_0x34debe,_0x33c07a){_0x33c07a=_0x33c07a||0xc8;return function(_0x5ee2f2){if(_0x5ee2f2){return _0x34debe[_0x502d('0x1b')](_0x33c07a)[_0x502d('0x1d')](_0x5ee2f2);}};}function respondWithFilteredResult(_0x28a8bd,_0x189ffb){return function(_0x2c10c3){if(_0x2c10c3){var _0x1c6d39=typeof _0x189ffb[_0x502d('0x1e')]==='undefined'&&typeof _0x189ffb[_0x502d('0x1f')]===_0x502d('0x20');var _0x4a2527=_0x2c10c3[_0x502d('0x21')];var _0xf6957=_0x1c6d39?0x0:_0x189ffb['offset'];var _0xd740f=_0x1c6d39?_0x2c10c3[_0x502d('0x21')]:_0x189ffb[_0x502d('0x1e')]+_0x189ffb[_0x502d('0x1f')];var _0x3e00a8;if(_0xd740f>=_0x4a2527){_0xd740f=_0x4a2527;_0x3e00a8=0xc8;}else{_0x3e00a8=0xce;}_0x28a8bd[_0x502d('0x1b')](_0x3e00a8);return _0x28a8bd[_0x502d('0x22')](_0x502d('0x23'),_0xf6957+'-'+_0xd740f+'/'+_0x4a2527)[_0x502d('0x1d')](_0x2c10c3);}return null;};}function patchUpdates(_0xa3f71b){return function(_0x147c31){try{jsonpatch['apply'](_0x147c31,_0xa3f71b,!![]);}catch(_0x4dfd1e){return BPromise[_0x502d('0x24')](_0x4dfd1e);}return _0x147c31[_0x502d('0x25')]();};}function saveUpdates(_0x4ede1a,_0xb675a6){return function(_0x55bb42){if(_0x55bb42){return _0x55bb42[_0x502d('0x26')](_0x4ede1a)[_0x502d('0x27')](function(_0x3d64bb){return _0x3d64bb;});}return null;};}function removeEntity(_0x4e77b6,_0x4e2080){return function(_0xba55be){if(_0xba55be){return _0xba55be[_0x502d('0x28')]()[_0x502d('0x27')](function(){_0x4e77b6[_0x502d('0x1b')](0xcc)[_0x502d('0x1c')]();});}};}function handleEntityNotFound(_0x388478,_0x16f6be){return function(_0xb477ef){if(!_0xb477ef){_0x388478[_0x502d('0x29')](0x194);}return _0xb477ef;};}function handleError(_0x50048d,_0x3f563d){_0x3f563d=_0x3f563d||0x1f4;return function(_0x3b8925){logger[_0x502d('0x2a')](_0x3b8925[_0x502d('0x2b')]);if(_0x3b8925[_0x502d('0x2c')]){delete _0x3b8925[_0x502d('0x2c')];}_0x50048d[_0x502d('0x1b')](_0x3f563d)['send'](_0x3b8925);};}exports[_0x502d('0x2d')]=function(_0x43ca88,_0x573c5f){var _0x2f962d={},_0x8b9fbb={},_0x368fae={'count':0x0,'rows':[]};var _0x341756=_[_0x502d('0x2e')](db[_0x502d('0x2f')]['rawAttributes'],function(_0x3217e0){return{'name':_0x3217e0[_0x502d('0x30')],'type':_0x3217e0[_0x502d('0x31')][_0x502d('0x32')]};});_0x8b9fbb[_0x502d('0x33')]=_[_0x502d('0x2e')](_0x341756,_0x502d('0x2c'));_0x8b9fbb[_0x502d('0x34')]=_[_0x502d('0x35')](_0x43ca88[_0x502d('0x34')]);_0x8b9fbb[_0x502d('0x36')]=_[_0x502d('0x37')](_0x8b9fbb[_0x502d('0x33')],_0x8b9fbb[_0x502d('0x34')]);_0x8b9fbb[_0x502d('0x36')]=_[_0x502d('0x38')](_0x8b9fbb[_0x502d('0x36')],[_0x502d('0x39'),_0x502d('0x3a'),_0x502d('0x3b'),'$gte',_0x502d('0x3c'),_0x502d('0x3d'),'$ne',_0x502d('0x3e'),_0x502d('0x3f'),'$between',_0x502d('0x40'),'$in','$notIn',_0x502d('0x41'),'$notLike',_0x502d('0x42'),'$notILike',_0x502d('0x41'),_0x502d('0x43'),_0x502d('0x44'),_0x502d('0x45'),_0x502d('0x46')]);_0x2f962d['attributes']=_['intersection'](_0x8b9fbb['model'],qs['fields'](_0x43ca88['query'][_0x502d('0x47')]));_0x2f962d[_0x502d('0x48')]=_0x2f962d[_0x502d('0x48')][_0x502d('0x49')]?_0x2f962d[_0x502d('0x48')]:_0x8b9fbb[_0x502d('0x33')];if(!_0x43ca88[_0x502d('0x34')][_0x502d('0x4a')](_0x502d('0x4b'))){_0x2f962d[_0x502d('0x1f')]=qs['limit'](_0x43ca88['query'][_0x502d('0x1f')]);_0x2f962d[_0x502d('0x1e')]=qs['offset'](_0x43ca88[_0x502d('0x34')][_0x502d('0x1e')]);}_0x2f962d['order']=qs[_0x502d('0x4c')](_0x43ca88['query'][_0x502d('0x4c')]);_0x2f962d[_0x502d('0x4d')]=qs[_0x502d('0x36')](_['pick'](_0x43ca88[_0x502d('0x34')],_0x8b9fbb[_0x502d('0x36')]),_0x341756);if(_0x43ca88[_0x502d('0x34')][_0x502d('0x4e')]){_0x2f962d['where']=_[_0x502d('0x4f')](_0x2f962d['where'],{'$or':_['map'](_0x341756,function(_0x1ac3ba){if(_0x1ac3ba[_0x502d('0x31')]!==_0x502d('0x50')){var _0x3a12d2={};_0x3a12d2[_0x1ac3ba[_0x502d('0x2c')]]={'$like':'%'+_0x43ca88[_0x502d('0x34')][_0x502d('0x4e')]+'%'};return _0x3a12d2;}})});}_0x2f962d=_['merge']({},_0x2f962d,_0x43ca88[_0x502d('0x51')]);var _0xbb3c7a={'where':_0x2f962d['where']};return db['CmHopper']['count'](_0xbb3c7a)[_0x502d('0x27')](function(_0x28a22e){_0x368fae['count']=_0x28a22e;if(_0x43ca88['query'][_0x502d('0x52')]){_0x2f962d[_0x502d('0x53')]=[{'all':!![]}];}return db[_0x502d('0x2f')][_0x502d('0x54')](_0x2f962d);})[_0x502d('0x27')](function(_0x50d9eb){_0x368fae[_0x502d('0x55')]=_0x50d9eb;return _0x368fae;})[_0x502d('0x27')](respondWithFilteredResult(_0x573c5f,_0x2f962d))['catch'](handleError(_0x573c5f,null));};exports['show']=function(_0x3006e5,_0x4a147f){var _0x3a1afd={'raw':!![],'where':{'id':_0x3006e5['params']['id']}},_0x932bc6={};_0x932bc6['model']=_['keys'](db[_0x502d('0x2f')]['rawAttributes']);_0x932bc6[_0x502d('0x34')]=_[_0x502d('0x35')](_0x3006e5[_0x502d('0x34')]);_0x932bc6['filters']=_[_0x502d('0x37')](_0x932bc6[_0x502d('0x33')],_0x932bc6['query']);_0x3a1afd[_0x502d('0x48')]=_[_0x502d('0x37')](_0x932bc6[_0x502d('0x33')],qs[_0x502d('0x47')](_0x3006e5[_0x502d('0x34')]['fields']));_0x3a1afd['attributes']=_0x3a1afd[_0x502d('0x48')][_0x502d('0x49')]?_0x3a1afd[_0x502d('0x48')]:_0x932bc6[_0x502d('0x33')];if(_0x3006e5[_0x502d('0x34')][_0x502d('0x52')]){_0x3a1afd[_0x502d('0x53')]=[{'all':!![]}];}_0x3a1afd=_[_0x502d('0x4f')]({},_0x3a1afd,_0x3006e5[_0x502d('0x51')]);return db['CmHopper'][_0x502d('0x56')](_0x3a1afd)[_0x502d('0x27')](handleEntityNotFound(_0x4a147f,null))[_0x502d('0x27')](respondWithResult(_0x4a147f,null))['catch'](handleError(_0x4a147f,null));};exports[_0x502d('0x57')]=function(_0x2fe6c8,_0x3c6656){return db['CmHopper'][_0x502d('0x57')](_0x2fe6c8[_0x502d('0x58')],{})[_0x502d('0x27')](respondWithResult(_0x3c6656,0xc9))[_0x502d('0x59')](handleError(_0x3c6656,null));};exports[_0x502d('0x26')]=function(_0x1a0a76,_0x2e306e){if(_0x1a0a76[_0x502d('0x58')]['id']){delete _0x1a0a76['body']['id'];}return db[_0x502d('0x2f')][_0x502d('0x56')]({'where':{'id':_0x1a0a76['params']['id']}})[_0x502d('0x27')](handleEntityNotFound(_0x2e306e,null))[_0x502d('0x27')](saveUpdates(_0x1a0a76[_0x502d('0x58')],null))[_0x502d('0x27')](respondWithResult(_0x2e306e,null))[_0x502d('0x59')](handleError(_0x2e306e,null));};exports['describe']=function(_0x32cc7e,_0x126c18){return db[_0x502d('0x2f')][_0x502d('0x5a')]()[_0x502d('0x27')](respondWithResult(_0x126c18,null))[_0x502d('0x59')](handleError(_0x126c18,null));};exports['destroy']=function(_0x355c00,_0x2e5ace){var _0xcc5fb8;return db[_0x502d('0x2f')][_0x502d('0x56')]({'where':{'id':_0x355c00[_0x502d('0x5b')]['id']}})[_0x502d('0x27')](handleEntityNotFound(_0x2e5ace,null))['then'](function(_0x204894){if(_0x204894){return _0x204894['destroy']()[_0x502d('0x27')](function(_0x5685ca){return _0x5685ca;});}})[_0x502d('0x27')](function(_0x2bb6e3){_0xcc5fb8=_0x2bb6e3;if(_0x2bb6e3){if(_0x2bb6e3[_0x502d('0x5c')]||_0x2bb6e3['CampaignId']){return db[_0x2bb6e3[_0x502d('0x5c')]?'VoiceQueue':_0x502d('0x5d')]['find']({'where':{'id':_0x2bb6e3[_0x502d('0x5c')]?_0x2bb6e3[_0x502d('0x5c')]:_0x2bb6e3[_0x502d('0x5e')]},'attributes':['id',_0x502d('0x2c')],'raw':!![]});}}})[_0x502d('0x27')](function(_0x57563e){var _0x3a2fb2={};if(_0x57563e){_[_0x502d('0x4f')](_0x3a2fb2,_['omit'](_0xcc5fb8[_0x502d('0x5f')],[_0x502d('0x60'),'updatedAt','id']));_0x3a2fb2[_0x502d('0x61')]=0x15;_0x3a2fb2[_0x502d('0x62')]='deleted';_0x3a2fb2[_0x502d('0x63')]=_0x57563e[_0x502d('0x2c')];_0x3a2fb2[_0x502d('0x64')]=_0x355c00[_0x502d('0x65')]['name'];_0x3a2fb2['UserId']=_0x355c00[_0x502d('0x65')]['id'];_0x3a2fb2[_0x502d('0x66')]=!![];_0x3a2fb2[_0x502d('0x67')]=moment()[_0x502d('0x68')](_0x502d('0x69'));_0x3a2fb2[_0x502d('0x6a')]=_0xcc5fb8['phone'];_0x3a2fb2[_0x502d('0x6b')]=_0xcc5fb8[_0x502d('0x5c')]?_0x502d('0x6c'):'ivr';return db[_0x502d('0x6d')][_0x502d('0x56')]({'where':{'id':_0x3a2fb2['ContactId']},'attributes':['firstName',_0x502d('0x6e')]})[_0x502d('0x27')](function(_0x100be3){if(!_[_0x502d('0x6f')](_0x2e5ace)&&!_[_0x502d('0x6f')](_0x100be3[_0x502d('0x70')])){_0x3a2fb2[_0x502d('0x71')]=_0x100be3[_0x502d('0x70')];if(!_['isNil'](_0x100be3[_0x502d('0x6e')])){_0x3a2fb2[_0x502d('0x71')]+='\x20'+_0x100be3[_0x502d('0x6e')];}}})[_0x502d('0x72')](function(){return db[_0x502d('0x73')][_0x502d('0x57')](_0x3a2fb2);});}})[_0x502d('0x27')](function(){return _0x2e5ace[_0x502d('0x1b')](0xcc)[_0x502d('0x1c')]();})[_0x502d('0x59')](handleError(_0x2e5ace,null));};exports['getPreview']=function(_0xde7f70,_0x1cad2e,_0x23a232){var _0x588d07=[];return db[_0x502d('0x6d')][_0x502d('0x5a')]()[_0x502d('0x27')](function(_0x4d9b93){_0x588d07=_[_0x502d('0x35')](_0x4d9b93);return _0xde7f70[_0x502d('0x65')][_0x502d('0x74')]({'where':{'type':_0x502d('0x75'),'dialActive':!![],'dialMethod':_0x502d('0x76')},'attributes':['id',_0x502d('0x77')],'raw':!![]});})['then'](function(_0x9cc0a){if(_0x9cc0a&&_0x9cc0a[_0x502d('0x49')]){return db['sequelize'][_0x502d('0x78')](function(_0x106459){var _0x16b375={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x502d('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x502d('0x2e')](_0x9cc0a,'id')},'$or':[{'UserId':null},{'UserId':_0xde7f70[_0x502d('0x65')]['id']}]};var _0x2efa24=[];if(_0xde7f70[_0x502d('0x58')]['direction']&&_0xde7f70['body'][_0x502d('0x79')]===_0x502d('0x7a')){if(!_[_0x502d('0x7b')](_0xde7f70[_0x502d('0x58')][_0x502d('0x7c')])){_0x16b375['id']={'$in':_0xde7f70[_0x502d('0x58')]['hopperIds']};}_0x2efa24=[['priority','ASC'],[_0x502d('0x7d'),_0x9cc0a[0x0][_0x502d('0x77')]===_0x502d('0x7e')?_0x502d('0x7f'):_0x502d('0x7e')],db['sequelize'][_0x502d('0x80')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x502d('0x7f')]];}else{if(!_[_0x502d('0x7b')](_0xde7f70['body']['hopperIds'])){_0x16b375['id']={'$notIn':_0xde7f70['body'][_0x502d('0x7c')]};}_0x2efa24=[['priority',_0x502d('0x7f')],[_0x502d('0x7d'),_0x9cc0a[0x0][_0x502d('0x77')]],db['sequelize'][_0x502d('0x80')](_0x502d('0x81')),['id',_0x502d('0x7e')]];}return db[_0x502d('0x2f')]['findOne']({'attributes':['id',_0x502d('0x82')],'where':_0x16b375,'order':_0x2efa24,'transaction':_0x106459,'lock':_0x106459['LOCK'][_0x502d('0x83')],'include':[{'model':db[_0x502d('0x6d')],'as':_0x502d('0x84'),'attributes':_0x588d07,'include':[{'model':db[_0x502d('0x85')],'as':_0x502d('0x86'),'attributes':['id',_0x502d('0x2c')]}]},{'model':db[_0x502d('0x87')],'as':'List','attributes':['id',_0x502d('0x2c')]},{'model':db[_0x502d('0x88')],'as':_0x502d('0x89'),'attributes':['id','name',_0x502d('0x8a')]}]})[_0x502d('0x27')](function(_0x5ed508){if(_0x5ed508){return _0x5ed508[_0x502d('0x26')]({'UserId':_0xde7f70[_0x502d('0x65')]['id']},{'transaction':_0x106459});}});});}})[_0x502d('0x27')](handleEntityNotFound(_0x1cad2e,null))[_0x502d('0x27')](respondWithResult(_0x1cad2e,null))[_0x502d('0x59')](handleError(_0x1cad2e,null));};exports[_0x502d('0x8b')]=function(_0x39540a,_0x59f096,_0xd597c4){return _0x39540a[_0x502d('0x65')][_0x502d('0x74')]({'where':{'type':_0x502d('0x75'),'dialActive':!![],'dialMethod':_0x502d('0x76')},'attributes':['id'],'raw':!![]})[_0x502d('0x27')](function(_0xa2504e){if(_0xa2504e&&_0xa2504e[_0x502d('0x49')]){return db[_0x502d('0x2f')][_0x502d('0x21')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x502d('0x68')](_0x502d('0x69'))},'VoiceQueueId':{'$in':_['map'](_0xa2504e,'id')},'$or':[{'UserId':null},{'UserId':_0x39540a['user']['id']}]}});}return 0x0;})[_0x502d('0x27')](function(_0x4732b7){if(!_[_0x502d('0x6f')](_0x4732b7)&&_[_0x502d('0x8c')](_0x4732b7)){return _0x59f096[_0x502d('0x1b')](0xc8)[_0x502d('0x1d')]({'contacts':_0x4732b7});}else{logger[_0x502d('0x2a')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x502d('0x8b'),0x194,_0x502d('0x8d'));_0x59f096['sendStatus'](0x194);}})['catch'](handleError(_0x59f096,null));}; \ No newline at end of file +var _0x6c00=['literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','Contact','Company','CmList','VoiceQueue','Queue','dialActive','getOpenContacts','getVoiceQueues','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','count','offset','set','Content-Range','reject','save','then','error','stack','send','index','map','CmHopper','rawAttributes','fieldName','type','key','name','query','intersection','model','filters','concat','$or','$gt','$gte','$ne','$eq','$not','$between','$notBetween','$notIn','$like','$notLike','$iLike','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','keys','includeAll','options','find','create','body','update','params','describe','destroy','VoiceQueueId','CampaignId','Campaign','dataValues','createdAt','updatedAt','state','deleted','campaign','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','sequelize','direction','isEmpty','hopperIds','ASC','scheduledAt','DESC'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6c00,0x9f));var _0x06c0=function(_0x3a833e,_0x5a1878){_0x3a833e=_0x3a833e-0x0;var _0xdff445=_0x6c00[_0x3a833e];return _0xdff445;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06c0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x06c0('0x1'));var rp=require(_0x06c0('0x2'));var moment=require(_0x06c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x06c0('0x4'));var util=require(_0x06c0('0x5'));var path=require(_0x06c0('0x6'));var sox=require(_0x06c0('0x7'));var csv=require('to-csv');var ejs=require(_0x06c0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06c0('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x06c0('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x06c0('0xb'));var querystring=require(_0x06c0('0xc'));var Papa=require('papaparse');var Redis=require(_0x06c0('0xd'));var authService=require(_0x06c0('0xe'));var qs=require(_0x06c0('0xf'));var as=require(_0x06c0('0x10'));var hardwareService=require(_0x06c0('0x11'));var logger=require(_0x06c0('0x12'))(_0x06c0('0x13'));var utils=require(_0x06c0('0x14'));var config=require(_0x06c0('0x15'));var licenseUtil=require(_0x06c0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcb19a7,_0x10f766){_0x10f766=_0x10f766||0xcc;return function(_0x3641be){if(_0x3641be){return _0xcb19a7[_0x06c0('0x17')](_0x10f766);}return _0xcb19a7[_0x06c0('0x18')](_0x10f766)[_0x06c0('0x19')]();};}function respondWithResult(_0x175898,_0x2ed4c8){_0x2ed4c8=_0x2ed4c8||0xc8;return function(_0x4a5e7e){if(_0x4a5e7e){return _0x175898[_0x06c0('0x18')](_0x2ed4c8)[_0x06c0('0x1a')](_0x4a5e7e);}};}function respondWithFilteredResult(_0x1414eb,_0x1b9e27){return function(_0x1af1a0){if(_0x1af1a0){var _0x5352b1=typeof _0x1b9e27['offset']==='undefined'&&typeof _0x1b9e27[_0x06c0('0x1b')]==='undefined';var _0x2b9325=_0x1af1a0[_0x06c0('0x1c')];var _0x726377=_0x5352b1?0x0:_0x1b9e27['offset'];var _0x48998f=_0x5352b1?_0x1af1a0[_0x06c0('0x1c')]:_0x1b9e27[_0x06c0('0x1d')]+_0x1b9e27[_0x06c0('0x1b')];var _0x41f5f9;if(_0x48998f>=_0x2b9325){_0x48998f=_0x2b9325;_0x41f5f9=0xc8;}else{_0x41f5f9=0xce;}_0x1414eb[_0x06c0('0x18')](_0x41f5f9);return _0x1414eb[_0x06c0('0x1e')](_0x06c0('0x1f'),_0x726377+'-'+_0x48998f+'/'+_0x2b9325)[_0x06c0('0x1a')](_0x1af1a0);}return null;};}function patchUpdates(_0x18a425){return function(_0x2a44de){try{jsonpatch['apply'](_0x2a44de,_0x18a425,!![]);}catch(_0x51b676){return BPromise[_0x06c0('0x20')](_0x51b676);}return _0x2a44de[_0x06c0('0x21')]();};}function saveUpdates(_0xf4fe48,_0x2e82d9){return function(_0x138e18){if(_0x138e18){return _0x138e18['update'](_0xf4fe48)[_0x06c0('0x22')](function(_0x2ea624){return _0x2ea624;});}return null;};}function removeEntity(_0x39bde1,_0x4a3b98){return function(_0x49051f){if(_0x49051f){return _0x49051f['destroy']()['then'](function(){_0x39bde1[_0x06c0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39c72e,_0x4b0ab8){return function(_0x34be3b){if(!_0x34be3b){_0x39c72e[_0x06c0('0x17')](0x194);}return _0x34be3b;};}function handleError(_0x3e1992,_0x545fe7){_0x545fe7=_0x545fe7||0x1f4;return function(_0x410b42){logger[_0x06c0('0x23')](_0x410b42[_0x06c0('0x24')]);if(_0x410b42['name']){delete _0x410b42['name'];}_0x3e1992[_0x06c0('0x18')](_0x545fe7)[_0x06c0('0x25')](_0x410b42);};}exports[_0x06c0('0x26')]=function(_0x160cd1,_0x36ee69){var _0x388008={},_0x35bc08={},_0x4cdcc2={'count':0x0,'rows':[]};var _0x38e29f=_[_0x06c0('0x27')](db[_0x06c0('0x28')][_0x06c0('0x29')],function(_0x31c16b){return{'name':_0x31c16b[_0x06c0('0x2a')],'type':_0x31c16b[_0x06c0('0x2b')][_0x06c0('0x2c')]};});_0x35bc08['model']=_[_0x06c0('0x27')](_0x38e29f,_0x06c0('0x2d'));_0x35bc08[_0x06c0('0x2e')]=_['keys'](_0x160cd1['query']);_0x35bc08['filters']=_[_0x06c0('0x2f')](_0x35bc08[_0x06c0('0x30')],_0x35bc08[_0x06c0('0x2e')]);_0x35bc08[_0x06c0('0x31')]=_[_0x06c0('0x32')](_0x35bc08['filters'],['$and',_0x06c0('0x33'),_0x06c0('0x34'),_0x06c0('0x35'),'$lt','$lte',_0x06c0('0x36'),_0x06c0('0x37'),_0x06c0('0x38'),_0x06c0('0x39'),_0x06c0('0x3a'),'$in',_0x06c0('0x3b'),_0x06c0('0x3c'),_0x06c0('0x3d'),_0x06c0('0x3e'),'$notILike',_0x06c0('0x3c'),_0x06c0('0x3f'),_0x06c0('0x40'),_0x06c0('0x41'),_0x06c0('0x42')]);_0x388008[_0x06c0('0x43')]=_[_0x06c0('0x2f')](_0x35bc08['model'],qs[_0x06c0('0x44')](_0x160cd1[_0x06c0('0x2e')][_0x06c0('0x44')]));_0x388008[_0x06c0('0x43')]=_0x388008[_0x06c0('0x43')][_0x06c0('0x45')]?_0x388008[_0x06c0('0x43')]:_0x35bc08[_0x06c0('0x30')];if(!_0x160cd1[_0x06c0('0x2e')][_0x06c0('0x46')](_0x06c0('0x47'))){_0x388008['limit']=qs[_0x06c0('0x1b')](_0x160cd1[_0x06c0('0x2e')][_0x06c0('0x1b')]);_0x388008[_0x06c0('0x1d')]=qs[_0x06c0('0x1d')](_0x160cd1[_0x06c0('0x2e')]['offset']);}_0x388008[_0x06c0('0x48')]=qs[_0x06c0('0x49')](_0x160cd1['query'][_0x06c0('0x49')]);_0x388008[_0x06c0('0x4a')]=qs[_0x06c0('0x31')](_[_0x06c0('0x4b')](_0x160cd1['query'],_0x35bc08[_0x06c0('0x31')]),_0x38e29f);if(_0x160cd1['query'][_0x06c0('0x4c')]){_0x388008[_0x06c0('0x4a')]=_[_0x06c0('0x4d')](_0x388008['where'],{'$or':_[_0x06c0('0x27')](_0x38e29f,function(_0x30980b){if(_0x30980b[_0x06c0('0x2b')]!=='VIRTUAL'){var _0x87237e={};_0x87237e[_0x30980b[_0x06c0('0x2d')]]={'$like':'%'+_0x160cd1[_0x06c0('0x2e')][_0x06c0('0x4c')]+'%'};return _0x87237e;}})});}_0x388008=_['merge']({},_0x388008,_0x160cd1['options']);var _0x20999f={'where':_0x388008[_0x06c0('0x4a')]};return db[_0x06c0('0x28')][_0x06c0('0x1c')](_0x20999f)['then'](function(_0x326b39){_0x4cdcc2[_0x06c0('0x1c')]=_0x326b39;if(_0x160cd1[_0x06c0('0x2e')]['includeAll']){_0x388008[_0x06c0('0x4e')]=[{'all':!![]}];}return db[_0x06c0('0x28')]['findAll'](_0x388008);})['then'](function(_0x47bb0c){_0x4cdcc2[_0x06c0('0x4f')]=_0x47bb0c;return _0x4cdcc2;})[_0x06c0('0x22')](respondWithFilteredResult(_0x36ee69,_0x388008))[_0x06c0('0x50')](handleError(_0x36ee69,null));};exports[_0x06c0('0x51')]=function(_0x24e552,_0x43e957){var _0x4345e4={'raw':!![],'where':{'id':_0x24e552['params']['id']}},_0x1231a1={};_0x1231a1[_0x06c0('0x30')]=_['keys'](db[_0x06c0('0x28')][_0x06c0('0x29')]);_0x1231a1['query']=_[_0x06c0('0x52')](_0x24e552[_0x06c0('0x2e')]);_0x1231a1[_0x06c0('0x31')]=_[_0x06c0('0x2f')](_0x1231a1[_0x06c0('0x30')],_0x1231a1['query']);_0x4345e4['attributes']=_[_0x06c0('0x2f')](_0x1231a1[_0x06c0('0x30')],qs['fields'](_0x24e552['query']['fields']));_0x4345e4[_0x06c0('0x43')]=_0x4345e4[_0x06c0('0x43')]['length']?_0x4345e4[_0x06c0('0x43')]:_0x1231a1[_0x06c0('0x30')];if(_0x24e552[_0x06c0('0x2e')][_0x06c0('0x53')]){_0x4345e4[_0x06c0('0x4e')]=[{'all':!![]}];}_0x4345e4=_[_0x06c0('0x4d')]({},_0x4345e4,_0x24e552[_0x06c0('0x54')]);return db[_0x06c0('0x28')][_0x06c0('0x55')](_0x4345e4)[_0x06c0('0x22')](handleEntityNotFound(_0x43e957,null))['then'](respondWithResult(_0x43e957,null))[_0x06c0('0x50')](handleError(_0x43e957,null));};exports[_0x06c0('0x56')]=function(_0x29bae1,_0x2b76cd){return db[_0x06c0('0x28')][_0x06c0('0x56')](_0x29bae1[_0x06c0('0x57')],{})['then'](respondWithResult(_0x2b76cd,0xc9))[_0x06c0('0x50')](handleError(_0x2b76cd,null));};exports[_0x06c0('0x58')]=function(_0x395423,_0x5c53dc){if(_0x395423[_0x06c0('0x57')]['id']){delete _0x395423[_0x06c0('0x57')]['id'];}return db[_0x06c0('0x28')][_0x06c0('0x55')]({'where':{'id':_0x395423[_0x06c0('0x59')]['id']}})[_0x06c0('0x22')](handleEntityNotFound(_0x5c53dc,null))[_0x06c0('0x22')](saveUpdates(_0x395423[_0x06c0('0x57')],null))[_0x06c0('0x22')](respondWithResult(_0x5c53dc,null))['catch'](handleError(_0x5c53dc,null));};exports[_0x06c0('0x5a')]=function(_0x36c60e,_0x10cb82){return db[_0x06c0('0x28')][_0x06c0('0x5a')]()[_0x06c0('0x22')](respondWithResult(_0x10cb82,null))[_0x06c0('0x50')](handleError(_0x10cb82,null));};exports[_0x06c0('0x5b')]=function(_0x19da51,_0x176eb7){var _0x4ba2c2;return db[_0x06c0('0x28')]['find']({'where':{'id':_0x19da51['params']['id']}})[_0x06c0('0x22')](handleEntityNotFound(_0x176eb7,null))['then'](function(_0x586aea){if(_0x586aea){return _0x586aea[_0x06c0('0x5b')]()[_0x06c0('0x22')](function(_0x548cc7){return _0x548cc7;});}})[_0x06c0('0x22')](function(_0x5e1132){_0x4ba2c2=_0x5e1132;if(_0x5e1132){if(_0x5e1132[_0x06c0('0x5c')]||_0x5e1132[_0x06c0('0x5d')]){return db[_0x5e1132['VoiceQueueId']?'VoiceQueue':_0x06c0('0x5e')]['find']({'where':{'id':_0x5e1132[_0x06c0('0x5c')]?_0x5e1132[_0x06c0('0x5c')]:_0x5e1132[_0x06c0('0x5d')]},'attributes':['id',_0x06c0('0x2d')],'raw':!![]});}}})[_0x06c0('0x22')](function(_0x5c919d){var _0x8a02c8={};if(_0x5c919d){_[_0x06c0('0x4d')](_0x8a02c8,_['omit'](_0x4ba2c2[_0x06c0('0x5f')],[_0x06c0('0x60'),_0x06c0('0x61'),'id']));_0x8a02c8[_0x06c0('0x62')]=0x15;_0x8a02c8['statedesc']=_0x06c0('0x63');_0x8a02c8[_0x06c0('0x64')]=_0x5c919d[_0x06c0('0x2d')];_0x8a02c8[_0x06c0('0x65')]=_0x19da51[_0x06c0('0x66')][_0x06c0('0x2d')];_0x8a02c8['UserId']=_0x19da51[_0x06c0('0x66')]['id'];_0x8a02c8[_0x06c0('0x63')]=!![];_0x8a02c8[_0x06c0('0x67')]=moment()[_0x06c0('0x68')](_0x06c0('0x69'));_0x8a02c8['calleridnum']=_0x4ba2c2['phone'];_0x8a02c8[_0x06c0('0x6a')]=_0x4ba2c2[_0x06c0('0x5c')]?_0x06c0('0x6b'):_0x06c0('0x6c');return db[_0x06c0('0x6d')][_0x06c0('0x55')]({'where':{'id':_0x8a02c8['ContactId']},'attributes':[_0x06c0('0x6e'),_0x06c0('0x6f')]})['then'](function(_0x3fd78a){if(!_[_0x06c0('0x70')](_0x176eb7)&&!_[_0x06c0('0x70')](_0x3fd78a[_0x06c0('0x6e')])){_0x8a02c8[_0x06c0('0x71')]=_0x3fd78a[_0x06c0('0x6e')];if(!_['isNil'](_0x3fd78a[_0x06c0('0x6f')])){_0x8a02c8[_0x06c0('0x71')]+='\x20'+_0x3fd78a[_0x06c0('0x6f')];}}})[_0x06c0('0x72')](function(){return db[_0x06c0('0x73')][_0x06c0('0x56')](_0x8a02c8);});}})['then'](function(){return _0x176eb7[_0x06c0('0x18')](0xcc)[_0x06c0('0x19')]();})[_0x06c0('0x50')](handleError(_0x176eb7,null));};exports[_0x06c0('0x74')]=function(_0x41cdb2,_0x1da450,_0x42caa3){var _0x294dd9=[];return db[_0x06c0('0x6d')][_0x06c0('0x5a')]()['then'](function(_0x1ddea4){_0x294dd9=_['keys'](_0x1ddea4);return _0x41cdb2[_0x06c0('0x66')]['getVoiceQueues']({'where':{'type':_0x06c0('0x75'),'dialActive':!![],'dialMethod':_0x06c0('0x76')},'attributes':['id',_0x06c0('0x77')],'raw':!![]});})[_0x06c0('0x22')](function(_0x30f6df){if(_0x30f6df&&_0x30f6df['length']){return db[_0x06c0('0x78')]['transaction'](function(_0x436bbb){var _0x3f033f={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x06c0('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x06c0('0x27')](_0x30f6df,'id')},'$or':[{'UserId':null},{'UserId':_0x41cdb2['user']['id']}]};var _0x1a42cb=[];if(_0x41cdb2[_0x06c0('0x57')][_0x06c0('0x79')]&&_0x41cdb2[_0x06c0('0x57')]['direction']==='prev'){if(!_[_0x06c0('0x7a')](_0x41cdb2['body'][_0x06c0('0x7b')])){_0x3f033f['id']={'$in':_0x41cdb2[_0x06c0('0x57')][_0x06c0('0x7b')]};}_0x1a42cb=[['priority',_0x06c0('0x7c')],[_0x06c0('0x7d'),_0x30f6df[0x0][_0x06c0('0x77')]==='ASC'?_0x06c0('0x7e'):_0x06c0('0x7c')],db[_0x06c0('0x78')][_0x06c0('0x7f')](_0x06c0('0x80')),['id',_0x06c0('0x7e')]];}else{if(!_['isEmpty'](_0x41cdb2['body'][_0x06c0('0x7b')])){_0x3f033f['id']={'$notIn':_0x41cdb2['body'][_0x06c0('0x7b')]};}_0x1a42cb=[[_0x06c0('0x81'),_0x06c0('0x7e')],[_0x06c0('0x7d'),_0x30f6df[0x0]['dialOrderByScheduledAt']],db[_0x06c0('0x78')]['literal'](_0x06c0('0x82')),['id','ASC']];}return db['CmHopper'][_0x06c0('0x83')]({'attributes':['id',_0x06c0('0x84')],'where':_0x3f033f,'order':_0x1a42cb,'transaction':_0x436bbb,'lock':_0x436bbb['LOCK']['UPDATE'],'include':[{'model':db[_0x06c0('0x6d')],'as':_0x06c0('0x85'),'attributes':_0x294dd9,'include':[{'model':db['CmCompany'],'as':_0x06c0('0x86'),'attributes':['id',_0x06c0('0x2d')]}]},{'model':db[_0x06c0('0x87')],'as':'List','attributes':['id','name']},{'model':db[_0x06c0('0x88')],'as':_0x06c0('0x89'),'attributes':['id',_0x06c0('0x2d'),_0x06c0('0x8a')]}]})['then'](function(_0x3941f3){if(_0x3941f3){return _0x3941f3['update']({'UserId':_0x41cdb2[_0x06c0('0x66')]['id']},{'transaction':_0x436bbb});}});});}})[_0x06c0('0x22')](handleEntityNotFound(_0x1da450,null))[_0x06c0('0x22')](respondWithResult(_0x1da450,null))[_0x06c0('0x50')](handleError(_0x1da450,null));};exports[_0x06c0('0x8b')]=function(_0xa0787,_0x939139,_0x3524b9){return _0xa0787[_0x06c0('0x66')][_0x06c0('0x8c')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x06c0('0x76')},'attributes':['id'],'raw':!![]})[_0x06c0('0x22')](function(_0x2dbbf5){if(_0x2dbbf5&&_0x2dbbf5[_0x06c0('0x45')]){return db['CmHopper'][_0x06c0('0x1c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x06c0('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x06c0('0x27')](_0x2dbbf5,'id')},'$or':[{'UserId':null},{'UserId':_0xa0787[_0x06c0('0x66')]['id']}]}});}return 0x0;})[_0x06c0('0x22')](function(_0x3de800){if(!_[_0x06c0('0x70')](_0x3de800)&&_['isNumber'](_0x3de800)){return _0x939139[_0x06c0('0x18')](0xc8)['json']({'contacts':_0x3de800});}else{logger[_0x06c0('0x23')](_0x06c0('0x8d'),_0x06c0('0x8b'),0x194,_0x06c0('0x8e'));_0x939139[_0x06c0('0x17')](0x194);}})['catch'](handleError(_0x939139,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 67335cd..af4b7d3 100644 --- a/server/api/cmHopper/cmHopper.model.js +++ b/server/api/cmHopper/cmHopper.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bd8=['CmHopper','cm_hopper','scheduledat','phone','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopper.attributes','exports','define'];(function(_0x436ca8,_0x13a972){var _0x23dfcd=function(_0x421072){while(--_0x421072){_0x436ca8['push'](_0x436ca8['shift']());}};_0x23dfcd(++_0x13a972);}(_0x2bd8,0x130));var _0x82bd=function(_0x149f79,_0x5eabac){_0x149f79=_0x149f79-0x0;var _0x3667a9=_0x2bd8[_0x149f79];return _0x3667a9;};'use strict';var _=require(_0x82bd('0x0'));var util=require('util');var logger=require(_0x82bd('0x1'))(_0x82bd('0x2'));var moment=require(_0x82bd('0x3'));var BPromise=require(_0x82bd('0x4'));var rp=require(_0x82bd('0x5'));var fs=require('fs');var path=require(_0x82bd('0x6'));var rimraf=require(_0x82bd('0x7'));var config=require('../../config/environment');var attributes=require(_0x82bd('0x8'));module[_0x82bd('0x9')]=function(_0x3bf810,_0x5ceb60){return _0x3bf810[_0x82bd('0xa')](_0x82bd('0xb'),attributes,{'tableName':_0x82bd('0xc'),'paranoid':![],'indexes':[{'name':_0x82bd('0xd'),'fields':['scheduledat']},{'name':_0x82bd('0xe'),'fields':['phone']},{'name':'priority','fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbd=['path','rimraf','./cmHopper.attributes','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x48016e,_0x13a4b8){var _0x24d8c5=function(_0x1079f7){while(--_0x1079f7){_0x48016e['push'](_0x48016e['shift']());}};_0x24d8c5(++_0x13a4b8);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x3b247d,_0xbe4218){_0x3b247d=_0x3b247d-0x0;var _0x131bcf=_0xfdbd[_0x3b247d];return _0x131bcf;};'use strict';var _=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var logger=require(_0xdfdb('0x2'))(_0xdfdb('0x3'));var moment=require(_0xdfdb('0x4'));var BPromise=require(_0xdfdb('0x5'));var rp=require(_0xdfdb('0x6'));var fs=require('fs');var path=require(_0xdfdb('0x7'));var rimraf=require(_0xdfdb('0x8'));var config=require('../../config/environment');var attributes=require(_0xdfdb('0x9'));module['exports']=function(_0x453ef6,_0x41bd5e){return _0x453ef6['define']('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xdfdb('0xa'),'fields':[_0xdfdb('0xa')]},{'name':'phone','fields':[_0xdfdb('0xb')]},{'name':_0xdfdb('0xc'),'fields':[_0xdfdb('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 b766609..53ce4f9 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 _0x7693=['message','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','ShowCmHopper','catch','create','body','CreateCmHopper','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','Contact','keys','User','Agent','name','voicePause','length','UserId','push','all','MoveContactManagedDialer','CmHopperFinal','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','CountReScheduled','GetContactRecallMe','LOCK','UPDATE','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x16cb5f,_0x40fd39){var _0x1f0900=function(_0x299f08){while(--_0x299f08){_0x16cb5f['push'](_0x16cb5f['shift']());}};_0x1f0900(++_0x40fd39);}(_0x7693,0x10a));var _0x3769=function(_0x34dbd9,_0x2c756e){_0x34dbd9=_0x34dbd9-0x0;var _0x4f5862=_0x7693[_0x34dbd9];return _0x4f5862;};'use strict';var _=require(_0x3769('0x0'));var util=require(_0x3769('0x1'));var moment=require(_0x3769('0x2'));var BPromise=require('bluebird');var rs=require(_0x3769('0x3'));var fs=require('fs');var Redis=require(_0x3769('0x4'));var db=require(_0x3769('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3769('0x6'))(_0x3769('0x7'));var config=require(_0x3769('0x8'));var jayson=require(_0x3769('0x9'));var client=jayson[_0x3769('0xa')][_0x3769('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e0113,_0x20d295,_0x4501ae){return new BPromise(function(_0xe12633,_0x594720){return client[_0x3769('0xc')](_0x4e0113,_0x4501ae)[_0x3769('0xd')](function(_0x34b5d2){logger[_0x3769('0xe')](_0x3769('0xf'),_0x20d295,_0x3769('0x10'));logger[_0x3769('0x11')](_0x3769('0x12'),_0x20d295,'request\x20sent',JSON[_0x3769('0x13')](_0x34b5d2));if(_0x34b5d2[_0x3769('0x14')]){if(_0x34b5d2[_0x3769('0x14')][_0x3769('0x15')]===0x1f4){logger[_0x3769('0x14')](_0x3769('0xf'),_0x20d295,_0x34b5d2[_0x3769('0x14')][_0x3769('0x16')]);return _0x594720(_0x34b5d2[_0x3769('0x14')][_0x3769('0x16')]);}logger[_0x3769('0x14')]('CmHopper,\x20%s,\x20%s',_0x20d295,_0x34b5d2['error'][_0x3769('0x16')]);return _0xe12633(_0x34b5d2[_0x3769('0x14')][_0x3769('0x16')]);}else{logger[_0x3769('0xe')]('CmHopper,\x20%s,\x20%s',_0x20d295,_0x3769('0x10'));_0xe12633(_0x34b5d2['result'][_0x3769('0x16')]);}})['catch'](function(_0x1105c1){logger[_0x3769('0x14')]('CmHopper,\x20%s,\x20%s',_0x20d295,_0x1105c1);_0x594720(_0x1105c1);});});}exports[_0x3769('0x17')]=function(_0x598ec1){var _0x30bae9=this;return new Promise(function(_0xc984be,_0x1db3de){return db[_0x3769('0x18')][_0x3769('0x19')]({'raw':_0x598ec1[_0x3769('0x1a')]?_0x598ec1['options'][_0x3769('0x1b')]===undefined?!![]:![]:!![],'where':_0x598ec1[_0x3769('0x1a')]?_0x598ec1[_0x3769('0x1a')][_0x3769('0x1c')]||null:null,'attributes':_0x598ec1[_0x3769('0x1a')]?_0x598ec1['options'][_0x3769('0x1d')]||null:null,'limit':_0x598ec1[_0x3769('0x1a')]?_0x598ec1['options'][_0x3769('0x1e')]||null:null,'include':_0x598ec1[_0x3769('0x1a')]?_0x598ec1[_0x3769('0x1a')][_0x3769('0x1f')]?_[_0x3769('0x20')](_0x598ec1[_0x3769('0x1a')][_0x3769('0x1f')],function(_0x4f5738){return{'model':db[_0x4f5738['model']],'as':_0x4f5738['as'],'attributes':_0x4f5738[_0x3769('0x1d')],'include':_0x4f5738[_0x3769('0x1f')]?_[_0x3769('0x20')](_0x4f5738[_0x3769('0x1f')],function(_0x24ba14){return{'model':db[_0x24ba14[_0x3769('0x21')]],'as':_0x24ba14['as'],'attributes':_0x24ba14['attributes'],'include':_0x24ba14[_0x3769('0x1f')]?_[_0x3769('0x20')](_0x24ba14[_0x3769('0x1f')],function(_0x58ad92){return{'model':db[_0x58ad92[_0x3769('0x21')]],'as':_0x58ad92['as'],'attributes':_0x58ad92[_0x3769('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3769('0xd')](function(_0x414125){logger[_0x3769('0xe')](_0x3769('0x17'),_0x598ec1);logger[_0x3769('0x11')](_0x3769('0x17'),_0x598ec1,JSON[_0x3769('0x13')](_0x414125));_0xc984be(_0x414125);})['catch'](function(_0x5c6d98){logger[_0x3769('0x14')](_0x3769('0x17'),_0x5c6d98['message'],_0x598ec1);_0x1db3de(_0x30bae9['error'](0x1f4,_0x5c6d98[_0x3769('0x16')]));});});};exports[_0x3769('0x22')]=function(_0x20b8c6){var _0x4b2dd2=this;return new Promise(function(_0x2baf2c,_0x532b64){return db['CmHopper']['find']({'raw':_0x20b8c6[_0x3769('0x1a')]?_0x20b8c6['options'][_0x3769('0x1b')]===undefined?!![]:![]:!![],'where':_0x20b8c6[_0x3769('0x1a')]?_0x20b8c6[_0x3769('0x1a')][_0x3769('0x1c')]||null:null,'attributes':_0x20b8c6[_0x3769('0x1a')]?_0x20b8c6[_0x3769('0x1a')][_0x3769('0x1d')]||null:null,'include':_0x20b8c6['options']?_0x20b8c6[_0x3769('0x1a')][_0x3769('0x1f')]?_['map'](_0x20b8c6[_0x3769('0x1a')][_0x3769('0x1f')],function(_0x502974){return{'model':db[_0x502974[_0x3769('0x21')]],'as':_0x502974['as'],'attributes':_0x502974[_0x3769('0x1d')],'include':_0x502974[_0x3769('0x1f')]?_[_0x3769('0x20')](_0x502974[_0x3769('0x1f')],function(_0x12ab17){return{'model':db[_0x12ab17[_0x3769('0x21')]],'as':_0x12ab17['as'],'attributes':_0x12ab17['attributes'],'include':_0x12ab17[_0x3769('0x1f')]?_[_0x3769('0x20')](_0x12ab17['include'],function(_0x278908){return{'model':db[_0x278908[_0x3769('0x21')]],'as':_0x278908['as'],'attributes':_0x278908[_0x3769('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3769('0xd')](function(_0x4520c5){logger['info'](_0x3769('0x22'),_0x20b8c6);logger['debug'](_0x3769('0x22'),_0x20b8c6,JSON[_0x3769('0x13')](_0x4520c5));_0x2baf2c(_0x4520c5);})[_0x3769('0x23')](function(_0x1e1a0b){logger[_0x3769('0x14')]('ShowCmHopper',_0x1e1a0b['message'],_0x20b8c6);_0x532b64(_0x4b2dd2[_0x3769('0x14')](0x1f4,_0x1e1a0b['message']));});});};exports['CreateCmHopper']=function(_0x34d1ee){var _0x1a6b83=this;return new Promise(function(_0x3d624e,_0x5b8f86){return db[_0x3769('0x18')][_0x3769('0x24')](_0x34d1ee[_0x3769('0x25')],{'raw':_0x34d1ee[_0x3769('0x1a')]?_0x34d1ee[_0x3769('0x1a')][_0x3769('0x1b')]===undefined?!![]:![]:!![]})[_0x3769('0xd')](function(_0x244eb8){logger[_0x3769('0xe')](_0x3769('0x26'),_0x34d1ee);logger[_0x3769('0x11')](_0x3769('0x26'),_0x34d1ee,JSON[_0x3769('0x13')](_0x244eb8));_0x3d624e(_0x244eb8);})['catch'](function(_0x328990){logger['error'](_0x3769('0x26'),_0x328990['message'],_0x34d1ee);_0x5b8f86(_0x1a6b83['error'](0x1f4,_0x328990['message']));});});};exports['UpdateCmHopper']=function(_0x30d188){var _0x212809=this;return new Promise(function(_0x4c19f3,_0x181429){return db[_0x3769('0x18')][_0x3769('0x27')](_0x30d188[_0x3769('0x25')],{'raw':_0x30d188[_0x3769('0x1a')]?_0x30d188[_0x3769('0x1a')][_0x3769('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30d188['options']?_0x30d188['options'][_0x3769('0x1c')]||null:null,'attributes':_0x30d188[_0x3769('0x1a')]?_0x30d188['options']['attributes']||null:null,'limit':_0x30d188[_0x3769('0x1a')]?_0x30d188[_0x3769('0x1a')]['limit']||null:null})['then'](function(_0x23a581){logger[_0x3769('0xe')]('UpdateCmHopper',_0x30d188);logger[_0x3769('0x11')](_0x3769('0x28'),_0x30d188,JSON[_0x3769('0x13')](_0x23a581));_0x4c19f3(_0x23a581);})[_0x3769('0x23')](function(_0xfe157){logger[_0x3769('0x14')](_0x3769('0x28'),_0xfe157['message'],_0x30d188);_0x181429(_0x212809[_0x3769('0x14')](0x1f4,_0xfe157[_0x3769('0x16')]));});});};exports[_0x3769('0x29')]=function(_0x175bb7){var _0x4553c6=this;return new Promise(function(_0x389981,_0x2822df){return db[_0x3769('0x18')][_0x3769('0x2a')]({'where':_0x175bb7['options']?_0x175bb7[_0x3769('0x1a')][_0x3769('0x1c')]||null:null})[_0x3769('0xd')](function(_0x9db1d8){logger[_0x3769('0xe')](_0x3769('0x29'),_0x175bb7);logger[_0x3769('0x11')](_0x3769('0x29'),_0x175bb7,JSON[_0x3769('0x13')](_0x9db1d8));_0x389981(_0x9db1d8);})[_0x3769('0x23')](function(_0x19c208){logger[_0x3769('0x14')]('DestroyCmHopper',_0x19c208[_0x3769('0x16')],_0x175bb7);_0x2822df(_0x4553c6[_0x3769('0x14')](0x1f4,_0x19c208[_0x3769('0x16')]));});});};exports[_0x3769('0x2b')]=function(_0x3284ec){var _0x1cecf7=this;return new Promise(function(_0x3f2497,_0x42df4a){return db[_0x3769('0x2c')][_0x3769('0x2d')]()[_0x3769('0xd')](function(_0xdf388a){return db[_0x3769('0x2e')][_0x3769('0x2f')](function(_0x1f28e0){return db[_0x3769('0x18')][_0x3769('0x19')]({'where':_0x3284ec[_0x3769('0x1a')]?_0x3284ec['options'][_0x3769('0x1c')]||null:null,'attributes':_0x3284ec[_0x3769('0x1a')]?_0x3284ec[_0x3769('0x1a')][_0x3769('0x1d')]||null:null,'limit':_0x3284ec['options']?_0x3284ec['options']['limit']||null:null,'order':_0x3284ec[_0x3769('0x1a')]?_0x3284ec[_0x3769('0x1a')][_0x3769('0x30')]||null:null,'transaction':_0x1f28e0,'lock':_0x1f28e0['LOCK']['UPDATE'],'include':[{'model':db[_0x3769('0x2c')],'as':_0x3769('0x31'),'attributes':_[_0x3769('0x32')](_0xdf388a)},{'model':db[_0x3769('0x33')],'as':_0x3769('0x34'),'attributes':['id',_0x3769('0x35'),_0x3769('0x36')]}]})['then'](function(_0x2560a7){var _0x490c7f=[];var _0x431b3e=[];for(var _0x2b545a=0x0;_0x2b545a<_0x2560a7[_0x3769('0x37')];_0x2b545a+=0x1){var _0x48871e=_0x2560a7[_0x2b545a][_0x3769('0x38')];if(_0x48871e===null){_0x490c7f[_0x3769('0x39')](_0x2560a7[_0x2b545a]['update'](_0x3284ec[_0x3769('0x25')],{'transaction':_0x1f28e0}));}else if(!_0x431b3e['includes'](_0x48871e)){_0x431b3e[_0x3769('0x39')](_0x48871e);_0x490c7f[_0x3769('0x39')](_0x2560a7[_0x2b545a][_0x3769('0x27')](_0x3284ec[_0x3769('0x25')],{'transaction':_0x1f28e0}));}}return BPromise[_0x3769('0x3a')](_0x490c7f);});})[_0x3769('0xd')](function(_0x2ad81a){logger[_0x3769('0xe')](_0x3769('0x2b'),_0x3284ec);logger[_0x3769('0x11')](_0x3769('0x2b'),_0x3284ec,JSON[_0x3769('0x13')](_0x2ad81a));_0x3f2497(_0x2ad81a);})[_0x3769('0x23')](function(_0x10ae52){logger[_0x3769('0x14')](_0x3769('0x2b'),_0x10ae52[_0x3769('0x16')],_0x3284ec);_0x42df4a(_0x1cecf7[_0x3769('0x14')](0x1f4,_0x10ae52[_0x3769('0x16')]));});});});};exports[_0x3769('0x3b')]=function(_0x1d4537){var _0x765a68=this;return new Promise(function(_0x1ad8bb,_0x57f8a9){return db[_0x3769('0x2e')][_0x3769('0x2f')](function(_0x401d03){return db[_0x3769('0x3c')]['create'](_0x1d4537[_0x3769('0x25')],{'raw':_0x1d4537['options']?_0x1d4537[_0x3769('0x1a')][_0x3769('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x401d03})[_0x3769('0xd')](function(){return db[_0x3769('0x18')]['destroy']({'where':_0x1d4537[_0x3769('0x1a')]?_0x1d4537[_0x3769('0x1a')]['where']||null:null,'transaction':_0x401d03});});})[_0x3769('0xd')](function(_0x5d4784){logger[_0x3769('0xe')](_0x3769('0x3b'),_0x1d4537);logger[_0x3769('0x11')]('MoveContactManagedDialer',_0x1d4537,JSON[_0x3769('0x13')](_0x5d4784));_0x1ad8bb(_0x5d4784);})['catch'](function(_0x4eb532){logger['error']('MoveContactManagedDialer',_0x4eb532[_0x3769('0x16')],_0x1d4537);_0x57f8a9(_0x765a68[_0x3769('0x14')](0x1f4,_0x4eb532[_0x3769('0x16')]));});});};exports['CountReScheduled']=function(_0x15c589){var _0x3990c7=this;return new Promise(function(_0x145703,_0x2f95be){return db['CmHopper'][_0x3769('0x19')]({'raw':_0x15c589[_0x3769('0x1a')]?_0x15c589[_0x3769('0x1a')][_0x3769('0x1b')]===undefined?!![]:![]:!![],'where':_0x15c589[_0x3769('0x1a')]?_0x15c589[_0x3769('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x3769('0x3d'),db[_0x3769('0x2e')]['fn']('IF',db[_0x3769('0x2e')][_0x3769('0x3e')](_0x3769('0x3f')+util[_0x3769('0x40')](_0x3769('0x41'),moment()['format'](_0x3769('0x42')))+_0x3769('0x43')))),'contactsRescheduled']]})[_0x3769('0xd')](function(_0x4e5edf){logger[_0x3769('0xe')]('CountReScheduled',_0x15c589);logger[_0x3769('0x11')](_0x3769('0x44'),_0x15c589,JSON[_0x3769('0x13')](_0x4e5edf));_0x145703(_0x4e5edf);})[_0x3769('0x23')](function(_0x22336a){logger[_0x3769('0x14')](_0x3769('0x44'),_0x22336a['message'],_0x15c589);_0x2f95be(_0x3990c7['error'](0x1f4,_0x22336a[_0x3769('0x16')]));});});};exports[_0x3769('0x45')]=function(_0x3afa73){var _0x2b1cb1=this;return new Promise(function(_0x10cd4d,_0x5aa9e3){return db['CmContact'][_0x3769('0x2d')]()[_0x3769('0xd')](function(_0xa7c424){return db[_0x3769('0x2e')]['transaction'](function(_0x53f360){return db[_0x3769('0x18')][_0x3769('0x19')]({'where':_0x3afa73[_0x3769('0x1a')]?_0x3afa73[_0x3769('0x1a')][_0x3769('0x1c')]||null:null,'attributes':_0x3afa73[_0x3769('0x1a')]?_0x3afa73[_0x3769('0x1a')]['attributes']||null:null,'limit':0x1,'order':_0x3afa73[_0x3769('0x1a')]?_0x3afa73[_0x3769('0x1a')][_0x3769('0x30')]||null:null,'group':db[_0x3769('0x18')]['UserId'],'transaction':_0x53f360,'lock':_0x53f360[_0x3769('0x46')][_0x3769('0x47')],'include':_0x3afa73[_0x3769('0x1a')]?_0x3afa73['options'][_0x3769('0x1f')]?_[_0x3769('0x20')](_0x3afa73[_0x3769('0x1a')][_0x3769('0x1f')],function(_0x19d116){return{'model':db[_0x19d116[_0x3769('0x21')]],'as':_0x19d116['as'],'attributes':_0x19d116['attributes'],'include':_0x19d116[_0x3769('0x1f')]?_[_0x3769('0x20')](_0x19d116[_0x3769('0x1f')],function(_0x12f617){return{'model':db[_0x12f617[_0x3769('0x21')]],'as':_0x12f617['as'],'attributes':_0x12f617['attributes'],'include':_0x12f617[_0x3769('0x1f')]?_[_0x3769('0x20')](_0x12f617['include'],function(_0x177720){return{'model':db[_0x177720[_0x3769('0x21')]],'as':_0x177720['as'],'attributes':_0x177720[_0x3769('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3769('0xd')](function(_0x29d4ee){var _0x4eddfd=[];for(var _0x37c638=0x0;_0x37c638<_0x29d4ee[_0x3769('0x37')];_0x37c638+=0x1){_0x4eddfd[_0x3769('0x39')](_0x29d4ee[_0x37c638][_0x3769('0x27')](_0x3afa73[_0x3769('0x25')],{'transaction':_0x53f360}));}return BPromise['all'](_0x4eddfd);});})['then'](function(_0x43ab9b){logger[_0x3769('0xe')](_0x3769('0x45'),_0x3afa73);logger[_0x3769('0x11')]('GetContactRecallMe',_0x3afa73,JSON[_0x3769('0x13')](_0x43ab9b));_0x10cd4d(_0x43ab9b);})['catch'](function(_0x4580e1){logger['error'](_0x3769('0x45'),_0x4580e1['message'],_0x3afa73);_0x5aa9e3(_0x2b1cb1['error'](0x1f4,_0x4580e1[_0x3769('0x16')]));});});});};exports['GetCmHopperPreview']=function(_0x1e2390){var _0x4e8219=this;return new Promise(function(_0x2b6425,_0x26013f){db[_0x3769('0x2c')][_0x3769('0x2d')]()[_0x3769('0xd')](function(_0xd421be){return db['CmHopper'][_0x3769('0x19')]({'raw':_0x1e2390['options']?_0x1e2390[_0x3769('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1e2390['options']?_0x1e2390[_0x3769('0x1a')]['where']||null:null,'attributes':_0x1e2390[_0x3769('0x1a')]?_0x1e2390[_0x3769('0x1a')][_0x3769('0x1d')]||null:null,'limit':_0x1e2390[_0x3769('0x1a')]?_0x1e2390[_0x3769('0x1a')][_0x3769('0x1e')]||null:null,'include':_0x1e2390[_0x3769('0x1a')]?_0x1e2390['options'][_0x3769('0x1f')]?_['map'](_0x1e2390[_0x3769('0x1a')][_0x3769('0x1f')],function(_0x534f5a){return{'model':db[_0x534f5a[_0x3769('0x21')]],'as':_0x534f5a['as'],'attributes':_0x534f5a['as']==='Contact'?_[_0x3769('0x32')](_0xd421be):_0x534f5a[_0x3769('0x1d')],'include':_0x534f5a['include']?_[_0x3769('0x20')](_0x534f5a[_0x3769('0x1f')],function(_0x2441bd){return{'model':db[_0x2441bd[_0x3769('0x21')]],'as':_0x2441bd['as'],'attributes':_0x2441bd[_0x3769('0x1d')],'include':_0x2441bd[_0x3769('0x1f')]?_['map'](_0x2441bd[_0x3769('0x1f')],function(_0x8099a1){return{'model':db[_0x8099a1[_0x3769('0x21')]],'as':_0x8099a1['as'],'attributes':_0x8099a1[_0x3769('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3769('0xd')](function(_0x3eec94){logger['info'](_0x3769('0x17'),_0x1e2390);logger[_0x3769('0x11')](_0x3769('0x17'),_0x1e2390,JSON[_0x3769('0x13')](_0x3eec94));_0x2b6425(_0x3eec94);})[_0x3769('0x23')](function(_0x156cda){logger[_0x3769('0x14')](_0x3769('0x17'),_0x156cda[_0x3769('0x16')],_0x1e2390);_0x26013f(_0x4e8219[_0x3769('0x14')](0x1f4,_0x156cda['message']));});});});}; \ No newline at end of file +var _0x6117=['CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','contactsRescheduled','GetContactRecallMe','length','GetCmHopperPreview','Contact','keys','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetCmHopper','CmHopper','findAll','options','raw','where','limit','map','model','attributes','include','ShowCmHopper','CreateCmHopper','create','body','UpdateCmHopper','update','destroy','DestroyCmHopper','describe','sequelize','transaction','order','LOCK','UPDATE','CmContact','User','Agent','name','voicePause','UserId','push','includes','all','GetContactDialer','CmHopperFinal','MoveContactManagedDialer'];(function(_0x4f064a,_0x203382){var _0x30657b=function(_0x54751e){while(--_0x54751e){_0x4f064a['push'](_0x4f064a['shift']());}};_0x30657b(++_0x203382);}(_0x6117,0xdf));var _0x7611=function(_0x48bb75,_0x514a11){_0x48bb75=_0x48bb75-0x0;var _0xc5a3b3=_0x6117[_0x48bb75];return _0xc5a3b3;};'use strict';var _=require(_0x7611('0x0'));var util=require(_0x7611('0x1'));var moment=require(_0x7611('0x2'));var BPromise=require(_0x7611('0x3'));var rs=require(_0x7611('0x4'));var fs=require('fs');var Redis=require(_0x7611('0x5'));var db=require(_0x7611('0x6'))['db'];var utils=require(_0x7611('0x7'));var logger=require(_0x7611('0x8'))(_0x7611('0x9'));var config=require(_0x7611('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7611('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48abda,_0x5ad475,_0x4c177c){return new BPromise(function(_0x2a08b6,_0x35a407){return client[_0x7611('0xc')](_0x48abda,_0x4c177c)[_0x7611('0xd')](function(_0x29d0a3){logger[_0x7611('0xe')](_0x7611('0xf'),_0x5ad475,_0x7611('0x10'));logger[_0x7611('0x11')](_0x7611('0x12'),_0x5ad475,'request\x20sent',JSON[_0x7611('0x13')](_0x29d0a3));if(_0x29d0a3[_0x7611('0x14')]){if(_0x29d0a3[_0x7611('0x14')]['code']===0x1f4){logger[_0x7611('0x14')](_0x7611('0xf'),_0x5ad475,_0x29d0a3[_0x7611('0x14')]['message']);return _0x35a407(_0x29d0a3[_0x7611('0x14')][_0x7611('0x15')]);}logger[_0x7611('0x14')](_0x7611('0xf'),_0x5ad475,_0x29d0a3[_0x7611('0x14')][_0x7611('0x15')]);return _0x2a08b6(_0x29d0a3[_0x7611('0x14')][_0x7611('0x15')]);}else{logger['info'](_0x7611('0xf'),_0x5ad475,_0x7611('0x10'));_0x2a08b6(_0x29d0a3[_0x7611('0x16')][_0x7611('0x15')]);}})[_0x7611('0x17')](function(_0x3acaea){logger[_0x7611('0x14')](_0x7611('0xf'),_0x5ad475,_0x3acaea);_0x35a407(_0x3acaea);});});}exports[_0x7611('0x18')]=function(_0x52158e){var _0x3dd35b=this;return new Promise(function(_0x2e0f14,_0xcd7018){return db[_0x7611('0x19')][_0x7611('0x1a')]({'raw':_0x52158e[_0x7611('0x1b')]?_0x52158e[_0x7611('0x1b')][_0x7611('0x1c')]===undefined?!![]:![]:!![],'where':_0x52158e[_0x7611('0x1b')]?_0x52158e[_0x7611('0x1b')][_0x7611('0x1d')]||null:null,'attributes':_0x52158e[_0x7611('0x1b')]?_0x52158e[_0x7611('0x1b')]['attributes']||null:null,'limit':_0x52158e[_0x7611('0x1b')]?_0x52158e[_0x7611('0x1b')][_0x7611('0x1e')]||null:null,'include':_0x52158e[_0x7611('0x1b')]?_0x52158e[_0x7611('0x1b')]['include']?_[_0x7611('0x1f')](_0x52158e[_0x7611('0x1b')]['include'],function(_0x1938da){return{'model':db[_0x1938da[_0x7611('0x20')]],'as':_0x1938da['as'],'attributes':_0x1938da[_0x7611('0x21')],'include':_0x1938da[_0x7611('0x22')]?_['map'](_0x1938da['include'],function(_0x276c40){return{'model':db[_0x276c40[_0x7611('0x20')]],'as':_0x276c40['as'],'attributes':_0x276c40['attributes'],'include':_0x276c40[_0x7611('0x22')]?_[_0x7611('0x1f')](_0x276c40['include'],function(_0x3cddd6){return{'model':db[_0x3cddd6[_0x7611('0x20')]],'as':_0x3cddd6['as'],'attributes':_0x3cddd6['attributes']};}):[]};}):[]};}):[]:[]})[_0x7611('0xd')](function(_0x251304){logger['info'](_0x7611('0x18'),_0x52158e);logger[_0x7611('0x11')]('GetCmHopper',_0x52158e,JSON['stringify'](_0x251304));_0x2e0f14(_0x251304);})[_0x7611('0x17')](function(_0x44f6c0){logger[_0x7611('0x14')](_0x7611('0x18'),_0x44f6c0[_0x7611('0x15')],_0x52158e);_0xcd7018(_0x3dd35b[_0x7611('0x14')](0x1f4,_0x44f6c0['message']));});});};exports['ShowCmHopper']=function(_0x18591d){var _0x1576ea=this;return new Promise(function(_0x2ed3fd,_0x5e0232){return db['CmHopper']['find']({'raw':_0x18591d[_0x7611('0x1b')]?_0x18591d[_0x7611('0x1b')][_0x7611('0x1c')]===undefined?!![]:![]:!![],'where':_0x18591d[_0x7611('0x1b')]?_0x18591d['options'][_0x7611('0x1d')]||null:null,'attributes':_0x18591d[_0x7611('0x1b')]?_0x18591d[_0x7611('0x1b')][_0x7611('0x21')]||null:null,'include':_0x18591d[_0x7611('0x1b')]?_0x18591d[_0x7611('0x1b')][_0x7611('0x22')]?_[_0x7611('0x1f')](_0x18591d[_0x7611('0x1b')][_0x7611('0x22')],function(_0x1d4cae){return{'model':db[_0x1d4cae[_0x7611('0x20')]],'as':_0x1d4cae['as'],'attributes':_0x1d4cae[_0x7611('0x21')],'include':_0x1d4cae[_0x7611('0x22')]?_[_0x7611('0x1f')](_0x1d4cae[_0x7611('0x22')],function(_0x3bd925){return{'model':db[_0x3bd925[_0x7611('0x20')]],'as':_0x3bd925['as'],'attributes':_0x3bd925['attributes'],'include':_0x3bd925['include']?_['map'](_0x3bd925[_0x7611('0x22')],function(_0x4bb45f){return{'model':db[_0x4bb45f[_0x7611('0x20')]],'as':_0x4bb45f['as'],'attributes':_0x4bb45f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7611('0xd')](function(_0x4067b1){logger[_0x7611('0xe')]('ShowCmHopper',_0x18591d);logger[_0x7611('0x11')](_0x7611('0x23'),_0x18591d,JSON['stringify'](_0x4067b1));_0x2ed3fd(_0x4067b1);})[_0x7611('0x17')](function(_0x20af99){logger[_0x7611('0x14')](_0x7611('0x23'),_0x20af99[_0x7611('0x15')],_0x18591d);_0x5e0232(_0x1576ea[_0x7611('0x14')](0x1f4,_0x20af99['message']));});});};exports[_0x7611('0x24')]=function(_0x288038){var _0x97fb15=this;return new Promise(function(_0x1638b4,_0x1cd5bb){return db['CmHopper'][_0x7611('0x25')](_0x288038[_0x7611('0x26')],{'raw':_0x288038[_0x7611('0x1b')]?_0x288038[_0x7611('0x1b')][_0x7611('0x1c')]===undefined?!![]:![]:!![]})[_0x7611('0xd')](function(_0x36759b){logger['info']('CreateCmHopper',_0x288038);logger[_0x7611('0x11')](_0x7611('0x24'),_0x288038,JSON['stringify'](_0x36759b));_0x1638b4(_0x36759b);})['catch'](function(_0x8935bc){logger[_0x7611('0x14')](_0x7611('0x24'),_0x8935bc[_0x7611('0x15')],_0x288038);_0x1cd5bb(_0x97fb15['error'](0x1f4,_0x8935bc['message']));});});};exports[_0x7611('0x27')]=function(_0x55b9b6){var _0xddaf20=this;return new Promise(function(_0x5375c4,_0x1515e9){return db[_0x7611('0x19')][_0x7611('0x28')](_0x55b9b6[_0x7611('0x26')],{'raw':_0x55b9b6[_0x7611('0x1b')]?_0x55b9b6['options'][_0x7611('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55b9b6[_0x7611('0x1b')]?_0x55b9b6['options'][_0x7611('0x1d')]||null:null,'attributes':_0x55b9b6[_0x7611('0x1b')]?_0x55b9b6[_0x7611('0x1b')]['attributes']||null:null,'limit':_0x55b9b6[_0x7611('0x1b')]?_0x55b9b6['options'][_0x7611('0x1e')]||null:null})[_0x7611('0xd')](function(_0x37fa07){logger['info'](_0x7611('0x27'),_0x55b9b6);logger[_0x7611('0x11')](_0x7611('0x27'),_0x55b9b6,JSON[_0x7611('0x13')](_0x37fa07));_0x5375c4(_0x37fa07);})[_0x7611('0x17')](function(_0x5c4639){logger[_0x7611('0x14')](_0x7611('0x27'),_0x5c4639['message'],_0x55b9b6);_0x1515e9(_0xddaf20[_0x7611('0x14')](0x1f4,_0x5c4639[_0x7611('0x15')]));});});};exports['DestroyCmHopper']=function(_0x3b7f7a){var _0x2868cd=this;return new Promise(function(_0xc9a635,_0x15f9e6){return db['CmHopper'][_0x7611('0x29')]({'where':_0x3b7f7a['options']?_0x3b7f7a[_0x7611('0x1b')][_0x7611('0x1d')]||null:null})[_0x7611('0xd')](function(_0x55abf9){logger[_0x7611('0xe')](_0x7611('0x2a'),_0x3b7f7a);logger[_0x7611('0x11')](_0x7611('0x2a'),_0x3b7f7a,JSON[_0x7611('0x13')](_0x55abf9));_0xc9a635(_0x55abf9);})[_0x7611('0x17')](function(_0x541e89){logger['error'](_0x7611('0x2a'),_0x541e89['message'],_0x3b7f7a);_0x15f9e6(_0x2868cd[_0x7611('0x14')](0x1f4,_0x541e89[_0x7611('0x15')]));});});};exports['GetContactDialer']=function(_0x12d6ae){var _0xb2e77=this;return new Promise(function(_0x21396e,_0x390174){return db['CmContact'][_0x7611('0x2b')]()[_0x7611('0xd')](function(_0xa85b2d){return db[_0x7611('0x2c')][_0x7611('0x2d')](function(_0x114126){return db[_0x7611('0x19')][_0x7611('0x1a')]({'where':_0x12d6ae[_0x7611('0x1b')]?_0x12d6ae['options']['where']||null:null,'attributes':_0x12d6ae['options']?_0x12d6ae[_0x7611('0x1b')][_0x7611('0x21')]||null:null,'limit':_0x12d6ae[_0x7611('0x1b')]?_0x12d6ae[_0x7611('0x1b')][_0x7611('0x1e')]||null:null,'order':_0x12d6ae[_0x7611('0x1b')]?_0x12d6ae['options'][_0x7611('0x2e')]||null:null,'transaction':_0x114126,'lock':_0x114126[_0x7611('0x2f')][_0x7611('0x30')],'include':[{'model':db[_0x7611('0x31')],'as':'Contact','attributes':_['keys'](_0xa85b2d)},{'model':db[_0x7611('0x32')],'as':_0x7611('0x33'),'attributes':['id',_0x7611('0x34'),_0x7611('0x35')]}]})[_0x7611('0xd')](function(_0x34a5c2){var _0x2ddb36=[];var _0x4a886a=[];for(var _0x390f32=0x0;_0x390f32<_0x34a5c2['length'];_0x390f32+=0x1){var _0x30fa53=_0x34a5c2[_0x390f32][_0x7611('0x36')];if(_0x30fa53===null){_0x2ddb36[_0x7611('0x37')](_0x34a5c2[_0x390f32][_0x7611('0x28')](_0x12d6ae['body'],{'transaction':_0x114126}));}else if(!_0x4a886a[_0x7611('0x38')](_0x30fa53)){_0x4a886a[_0x7611('0x37')](_0x30fa53);_0x2ddb36[_0x7611('0x37')](_0x34a5c2[_0x390f32][_0x7611('0x28')](_0x12d6ae['body'],{'transaction':_0x114126}));}}return BPromise[_0x7611('0x39')](_0x2ddb36);});})['then'](function(_0x3a7707){logger[_0x7611('0xe')](_0x7611('0x3a'),_0x12d6ae);logger[_0x7611('0x11')](_0x7611('0x3a'),_0x12d6ae,JSON[_0x7611('0x13')](_0x3a7707));_0x21396e(_0x3a7707);})[_0x7611('0x17')](function(_0x5010cc){logger['error'](_0x7611('0x3a'),_0x5010cc[_0x7611('0x15')],_0x12d6ae);_0x390174(_0xb2e77[_0x7611('0x14')](0x1f4,_0x5010cc[_0x7611('0x15')]));});});});};exports['MoveContactManagedDialer']=function(_0xab4fdb){var _0x1016ae=this;return new Promise(function(_0x2d2a3d,_0x2a57e8){return db['sequelize'][_0x7611('0x2d')](function(_0x36a155){return db[_0x7611('0x3b')][_0x7611('0x25')](_0xab4fdb[_0x7611('0x26')],{'raw':_0xab4fdb[_0x7611('0x1b')]?_0xab4fdb[_0x7611('0x1b')][_0x7611('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x36a155})[_0x7611('0xd')](function(){return db[_0x7611('0x19')]['destroy']({'where':_0xab4fdb[_0x7611('0x1b')]?_0xab4fdb[_0x7611('0x1b')][_0x7611('0x1d')]||null:null,'transaction':_0x36a155});});})[_0x7611('0xd')](function(_0xaad8d9){logger[_0x7611('0xe')]('MoveContactManagedDialer',_0xab4fdb);logger[_0x7611('0x11')](_0x7611('0x3c'),_0xab4fdb,JSON[_0x7611('0x13')](_0xaad8d9));_0x2d2a3d(_0xaad8d9);})[_0x7611('0x17')](function(_0x1491ef){logger[_0x7611('0x14')]('MoveContactManagedDialer',_0x1491ef[_0x7611('0x15')],_0xab4fdb);_0x2a57e8(_0x1016ae[_0x7611('0x14')](0x1f4,_0x1491ef[_0x7611('0x15')]));});});};exports[_0x7611('0x3d')]=function(_0x18cc69){var _0x32fa0b=this;return new Promise(function(_0x1471ec,_0x5967d2){return db[_0x7611('0x19')][_0x7611('0x1a')]({'raw':_0x18cc69[_0x7611('0x1b')]?_0x18cc69[_0x7611('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x18cc69[_0x7611('0x1b')]?_0x18cc69[_0x7611('0x1b')][_0x7611('0x1d')]||null:null,'attributes':[[db[_0x7611('0x2c')]['fn'](_0x7611('0x3e'),db[_0x7611('0x2c')]['fn']('IF',db['sequelize']['literal'](_0x7611('0x3f')+util['format']('\x22%s\x22',moment()[_0x7611('0x40')]('YYYY-MM-DD\x20HH:mm:ss'))+'\x20,\x201,\x20null'))),_0x7611('0x41')]]})[_0x7611('0xd')](function(_0x480017){logger[_0x7611('0xe')](_0x7611('0x3d'),_0x18cc69);logger['debug']('CountReScheduled',_0x18cc69,JSON[_0x7611('0x13')](_0x480017));_0x1471ec(_0x480017);})[_0x7611('0x17')](function(_0x3c8605){logger[_0x7611('0x14')](_0x7611('0x3d'),_0x3c8605[_0x7611('0x15')],_0x18cc69);_0x5967d2(_0x32fa0b[_0x7611('0x14')](0x1f4,_0x3c8605[_0x7611('0x15')]));});});};exports[_0x7611('0x42')]=function(_0x3e64bc){var _0x57c016=this;return new Promise(function(_0x24dd7b,_0x316a25){return db['CmContact'][_0x7611('0x2b')]()['then'](function(_0x3f3a01){return db[_0x7611('0x2c')]['transaction'](function(_0x299b90){return db[_0x7611('0x19')][_0x7611('0x1a')]({'where':_0x3e64bc[_0x7611('0x1b')]?_0x3e64bc['options'][_0x7611('0x1d')]||null:null,'attributes':_0x3e64bc[_0x7611('0x1b')]?_0x3e64bc['options'][_0x7611('0x21')]||null:null,'limit':0x1,'order':_0x3e64bc['options']?_0x3e64bc[_0x7611('0x1b')][_0x7611('0x2e')]||null:null,'group':db[_0x7611('0x19')][_0x7611('0x36')],'transaction':_0x299b90,'lock':_0x299b90[_0x7611('0x2f')][_0x7611('0x30')],'include':_0x3e64bc[_0x7611('0x1b')]?_0x3e64bc[_0x7611('0x1b')][_0x7611('0x22')]?_[_0x7611('0x1f')](_0x3e64bc[_0x7611('0x1b')][_0x7611('0x22')],function(_0x709697){return{'model':db[_0x709697[_0x7611('0x20')]],'as':_0x709697['as'],'attributes':_0x709697[_0x7611('0x21')],'include':_0x709697[_0x7611('0x22')]?_['map'](_0x709697[_0x7611('0x22')],function(_0x128b1d){return{'model':db[_0x128b1d[_0x7611('0x20')]],'as':_0x128b1d['as'],'attributes':_0x128b1d[_0x7611('0x21')],'include':_0x128b1d[_0x7611('0x22')]?_[_0x7611('0x1f')](_0x128b1d[_0x7611('0x22')],function(_0xcb6d0b){return{'model':db[_0xcb6d0b[_0x7611('0x20')]],'as':_0xcb6d0b['as'],'attributes':_0xcb6d0b['attributes']};}):[]};}):[]};}):[]:[]})[_0x7611('0xd')](function(_0x5a7c04){var _0x42ae04=[];for(var _0x51495a=0x0;_0x51495a<_0x5a7c04[_0x7611('0x43')];_0x51495a+=0x1){_0x42ae04[_0x7611('0x37')](_0x5a7c04[_0x51495a][_0x7611('0x28')](_0x3e64bc[_0x7611('0x26')],{'transaction':_0x299b90}));}return BPromise['all'](_0x42ae04);});})['then'](function(_0x10f38b){logger[_0x7611('0xe')](_0x7611('0x42'),_0x3e64bc);logger[_0x7611('0x11')]('GetContactRecallMe',_0x3e64bc,JSON[_0x7611('0x13')](_0x10f38b));_0x24dd7b(_0x10f38b);})[_0x7611('0x17')](function(_0x231cf3){logger[_0x7611('0x14')](_0x7611('0x42'),_0x231cf3['message'],_0x3e64bc);_0x316a25(_0x57c016[_0x7611('0x14')](0x1f4,_0x231cf3[_0x7611('0x15')]));});});});};exports[_0x7611('0x44')]=function(_0x3ee306){var _0x49d385=this;return new Promise(function(_0x56d359,_0x25f044){db[_0x7611('0x31')][_0x7611('0x2b')]()['then'](function(_0xaeddc8){return db[_0x7611('0x19')][_0x7611('0x1a')]({'raw':_0x3ee306['options']?_0x3ee306[_0x7611('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3ee306[_0x7611('0x1b')]?_0x3ee306[_0x7611('0x1b')][_0x7611('0x1d')]||null:null,'attributes':_0x3ee306['options']?_0x3ee306[_0x7611('0x1b')][_0x7611('0x21')]||null:null,'limit':_0x3ee306[_0x7611('0x1b')]?_0x3ee306[_0x7611('0x1b')]['limit']||null:null,'include':_0x3ee306[_0x7611('0x1b')]?_0x3ee306[_0x7611('0x1b')][_0x7611('0x22')]?_[_0x7611('0x1f')](_0x3ee306[_0x7611('0x1b')][_0x7611('0x22')],function(_0xfe7995){return{'model':db[_0xfe7995[_0x7611('0x20')]],'as':_0xfe7995['as'],'attributes':_0xfe7995['as']===_0x7611('0x45')?_[_0x7611('0x46')](_0xaeddc8):_0xfe7995[_0x7611('0x21')],'include':_0xfe7995['include']?_[_0x7611('0x1f')](_0xfe7995[_0x7611('0x22')],function(_0x38cab0){return{'model':db[_0x38cab0[_0x7611('0x20')]],'as':_0x38cab0['as'],'attributes':_0x38cab0[_0x7611('0x21')],'include':_0x38cab0[_0x7611('0x22')]?_[_0x7611('0x1f')](_0x38cab0[_0x7611('0x22')],function(_0x1a2c7a){return{'model':db[_0x1a2c7a[_0x7611('0x20')]],'as':_0x1a2c7a['as'],'attributes':_0x1a2c7a[_0x7611('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7611('0xd')](function(_0x3b3cd5){logger['info'](_0x7611('0x18'),_0x3ee306);logger[_0x7611('0x11')](_0x7611('0x18'),_0x3ee306,JSON[_0x7611('0x13')](_0x3b3cd5));_0x56d359(_0x3b3cd5);})[_0x7611('0x17')](function(_0x127ea2){logger['error'](_0x7611('0x18'),_0x127ea2['message'],_0x3ee306);_0x25f044(_0x49d385[_0x7611('0x14')](0x1f4,_0x127ea2[_0x7611('0x15')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index e322353..f8dae9a 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 _0x6f49=['getOpenContacts','show','post','/preview','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f49,0x168));var _0x96f4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f49[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x96f4('0x0'));var util=require(_0x96f4('0x1'));var path=require(_0x96f4('0x2'));var timeout=require(_0x96f4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x96f4('0x4'));var auth=require(_0x96f4('0x5'));var interaction=require(_0x96f4('0x6'));var config=require(_0x96f4('0x7'));var controller=require(_0x96f4('0x8'));router['get']('/',auth[_0x96f4('0x9')](),controller[_0x96f4('0xa')]);router[_0x96f4('0xb')](_0x96f4('0xc'),auth[_0x96f4('0x9')](),controller[_0x96f4('0xd')]);router[_0x96f4('0xb')](_0x96f4('0xe'),auth[_0x96f4('0x9')](),controller[_0x96f4('0xf')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x96f4('0x10')]);router[_0x96f4('0x11')]('/',auth[_0x96f4('0x9')](),controller['create']);router['post'](_0x96f4('0x12'),auth[_0x96f4('0x9')](),controller['getPreview']);router[_0x96f4('0x13')]('/:id',auth[_0x96f4('0x9')](),controller[_0x96f4('0x14')]);router[_0x96f4('0x15')](_0x96f4('0x16'),auth[_0x96f4('0x9')](),controller[_0x96f4('0x17')]);module[_0x96f4('0x18')]=router; \ No newline at end of file +var _0x7786=['destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller','isAuthenticated','index','get','/describe','describe','/opencontacts','getOpenContacts','/:id','post','/preview','getPreview','update','delete'];(function(_0x2e32b3,_0xdbee5d){var _0x25bdb3=function(_0x4c3be4){while(--_0x4c3be4){_0x2e32b3['push'](_0x2e32b3['shift']());}};_0x25bdb3(++_0xdbee5d);}(_0x7786,0x8c));var _0x6778=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7786[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6778('0x0'));var util=require(_0x6778('0x1'));var path=require('path');var timeout=require(_0x6778('0x2'));var express=require(_0x6778('0x3'));var router=express['Router']();var fs_extra=require(_0x6778('0x4'));var auth=require(_0x6778('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6778('0x6'));var controller=require(_0x6778('0x7'));router['get']('/',auth[_0x6778('0x8')](),controller[_0x6778('0x9')]);router[_0x6778('0xa')](_0x6778('0xb'),auth['isAuthenticated'](),controller[_0x6778('0xc')]);router[_0x6778('0xa')](_0x6778('0xd'),auth[_0x6778('0x8')](),controller[_0x6778('0xe')]);router['get'](_0x6778('0xf'),auth[_0x6778('0x8')](),controller['show']);router[_0x6778('0x10')]('/',auth[_0x6778('0x8')](),controller['create']);router[_0x6778('0x10')](_0x6778('0x11'),auth[_0x6778('0x8')](),controller[_0x6778('0x12')]);router['put'](_0x6778('0xf'),auth[_0x6778('0x8')](),controller[_0x6778('0x13')]);router[_0x6778('0x14')](_0x6778('0xf'),auth['isAuthenticated'](),controller[_0x6778('0x15')]);module[_0x6778('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 7d691f9..ca35980 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 _0x6f7b=['sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x13e51e,_0x5ef374){var _0xb81e46=function(_0x41b0bb){while(--_0x41b0bb){_0x13e51e['push'](_0x13e51e['shift']());}};_0xb81e46(++_0x5ef374);}(_0x6f7b,0x168));var _0xb6f7=function(_0x1f790c,_0x2ed497){_0x1f790c=_0x1f790c-0x0;var _0x10b729=_0x6f7b[_0x1f790c];return _0x10b729;};'use strict';var moment=require('moment');var Sequelize=require(_0xb6f7('0x0'));module[_0xb6f7('0x1')]={'phone':{'type':Sequelize[_0xb6f7('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xb6f7('0x3')],'unique':_0xb6f7('0x4')},'ListId':{'type':Sequelize[_0xb6f7('0x3')],'unique':_0xb6f7('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xb6f7('0x4')}}; \ No newline at end of file +var _0x7953=['moment','sequelize','exports','STRING','INTEGER','contactListQueue'];(function(_0x269538,_0x5d953a){var _0x3bdf70=function(_0x3cc34f){while(--_0x3cc34f){_0x269538['push'](_0x269538['shift']());}};_0x3bdf70(++_0x5d953a);}(_0x7953,0x66));var _0x3795=function(_0xf67f45,_0x36e087){_0xf67f45=_0xf67f45-0x0;var _0xd9ab5=_0x7953[_0xf67f45];return _0xd9ab5;};'use strict';var moment=require(_0x3795('0x0'));var Sequelize=require(_0x3795('0x1'));module[_0x3795('0x2')]={'phone':{'type':Sequelize[_0x3795('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x3795('0x4')],'unique':_0x3795('0x5')},'ListId':{'type':Sequelize[_0x3795('0x4')],'unique':_0x3795('0x5')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index b7d0d48..3970cac 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 _0xbfe7=['../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','set','Content-Range','apply','save','update','then','end','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','offset','sort','pick','filters','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','body','find','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x5887c8,_0x4b2ac9){var _0x2f9bef=function(_0x3a5e6d){while(--_0x3a5e6d){_0x5887c8['push'](_0x5887c8['shift']());}};_0x2f9bef(++_0x4b2ac9);}(_0xbfe7,0x83));var _0x7bfe=function(_0x2a6a23,_0x24b83d){_0x2a6a23=_0x2a6a23-0x0;var _0x33f615=_0xbfe7[_0x2a6a23];return _0x33f615;};'use strict';var emlformat=require(_0x7bfe('0x0'));var rimraf=require(_0x7bfe('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7bfe('0x2'));var rp=require(_0x7bfe('0x3'));var moment=require('moment');var BPromise=require(_0x7bfe('0x4'));var Mustache=require(_0x7bfe('0x5'));var util=require(_0x7bfe('0x6'));var path=require('path');var sox=require(_0x7bfe('0x7'));var csv=require(_0x7bfe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bfe('0x9'));var _=require(_0x7bfe('0xa'));var squel=require(_0x7bfe('0xb'));var crypto=require(_0x7bfe('0xc'));var jsforce=require(_0x7bfe('0xd'));var deskjs=require(_0x7bfe('0xe'));var toCsv=require(_0x7bfe('0x8'));var querystring=require(_0x7bfe('0xf'));var Papa=require(_0x7bfe('0x10'));var Redis=require(_0x7bfe('0x11'));var authService=require(_0x7bfe('0x12'));var qs=require(_0x7bfe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7bfe('0x14'));var logger=require(_0x7bfe('0x15'))(_0x7bfe('0x16'));var utils=require(_0x7bfe('0x17'));var config=require(_0x7bfe('0x18'));var licenseUtil=require(_0x7bfe('0x19'));var db=require(_0x7bfe('0x1a'))['db'];function respondWithStatusCode(_0x14c990,_0x11d9de){_0x11d9de=_0x11d9de||0xcc;return function(_0x54368c){if(_0x54368c){return _0x14c990[_0x7bfe('0x1b')](_0x11d9de);}return _0x14c990[_0x7bfe('0x1c')](_0x11d9de)['end']();};}function respondWithResult(_0x5acb09,_0x8db28f){_0x8db28f=_0x8db28f||0xc8;return function(_0x2fdc17){if(_0x2fdc17){return _0x5acb09[_0x7bfe('0x1c')](_0x8db28f)[_0x7bfe('0x1d')](_0x2fdc17);}};}function respondWithFilteredResult(_0x4a67cb,_0x5acd10){return function(_0x3394df){if(_0x3394df){var _0x1786d0=typeof _0x5acd10['offset']===_0x7bfe('0x1e')&&typeof _0x5acd10[_0x7bfe('0x1f')]===_0x7bfe('0x1e');var _0x1a6a11=_0x3394df[_0x7bfe('0x20')];var _0x39ab71=_0x1786d0?0x0:_0x5acd10['offset'];var _0x382fe5=_0x1786d0?_0x3394df[_0x7bfe('0x20')]:_0x5acd10['offset']+_0x5acd10['limit'];var _0x21b1bb;if(_0x382fe5>=_0x1a6a11){_0x382fe5=_0x1a6a11;_0x21b1bb=0xc8;}else{_0x21b1bb=0xce;}_0x4a67cb[_0x7bfe('0x1c')](_0x21b1bb);return _0x4a67cb[_0x7bfe('0x21')](_0x7bfe('0x22'),_0x39ab71+'-'+_0x382fe5+'/'+_0x1a6a11)[_0x7bfe('0x1d')](_0x3394df);}return null;};}function patchUpdates(_0x57b462){return function(_0x33f339){try{jsonpatch[_0x7bfe('0x23')](_0x33f339,_0x57b462,!![]);}catch(_0x466d83){return BPromise['reject'](_0x466d83);}return _0x33f339[_0x7bfe('0x24')]();};}function saveUpdates(_0xa7f8d,_0x2aee5a){return function(_0x49af42){if(_0x49af42){return _0x49af42[_0x7bfe('0x25')](_0xa7f8d)[_0x7bfe('0x26')](function(_0x1fa432){return _0x1fa432;});}return null;};}function removeEntity(_0x519528,_0x3f3408){return function(_0x175063){if(_0x175063){return _0x175063['destroy']()['then'](function(){_0x519528[_0x7bfe('0x1c')](0xcc)[_0x7bfe('0x27')]();});}};}function handleEntityNotFound(_0x266111,_0x4a1827){return function(_0x454e47){if(!_0x454e47){_0x266111[_0x7bfe('0x1b')](0x194);}return _0x454e47;};}function handleError(_0x194ea0,_0x10613d){_0x10613d=_0x10613d||0x1f4;return function(_0x270a34){logger[_0x7bfe('0x28')](_0x270a34[_0x7bfe('0x29')]);if(_0x270a34[_0x7bfe('0x2a')]){delete _0x270a34[_0x7bfe('0x2a')];}_0x194ea0[_0x7bfe('0x1c')](_0x10613d)[_0x7bfe('0x2b')](_0x270a34);};}exports[_0x7bfe('0x2c')]=function(_0xb789a4,_0x3c6b9c){var _0x5e03e7={},_0x299bf1={},_0x56268c={'count':0x0,'rows':[]};var _0x4b6588=_[_0x7bfe('0x2d')](db[_0x7bfe('0x2e')][_0x7bfe('0x2f')],function(_0x286c6a){return{'name':_0x286c6a[_0x7bfe('0x30')],'type':_0x286c6a[_0x7bfe('0x31')][_0x7bfe('0x32')]};});_0x299bf1[_0x7bfe('0x33')]=_[_0x7bfe('0x2d')](_0x4b6588,_0x7bfe('0x2a'));_0x299bf1[_0x7bfe('0x34')]=_[_0x7bfe('0x35')](_0xb789a4[_0x7bfe('0x34')]);_0x299bf1['filters']=_[_0x7bfe('0x36')](_0x299bf1[_0x7bfe('0x33')],_0x299bf1['query']);_0x5e03e7[_0x7bfe('0x37')]=_['intersection'](_0x299bf1[_0x7bfe('0x33')],qs[_0x7bfe('0x38')](_0xb789a4[_0x7bfe('0x34')][_0x7bfe('0x38')]));_0x5e03e7[_0x7bfe('0x37')]=_0x5e03e7[_0x7bfe('0x37')][_0x7bfe('0x39')]?_0x5e03e7[_0x7bfe('0x37')]:_0x299bf1[_0x7bfe('0x33')];if(!_0xb789a4['query']['hasOwnProperty'](_0x7bfe('0x3a'))){_0x5e03e7[_0x7bfe('0x1f')]=qs['limit'](_0xb789a4[_0x7bfe('0x34')]['limit']);_0x5e03e7['offset']=qs['offset'](_0xb789a4[_0x7bfe('0x34')][_0x7bfe('0x3b')]);}_0x5e03e7['order']=qs['sort'](_0xb789a4[_0x7bfe('0x34')][_0x7bfe('0x3c')]);_0x5e03e7['where']=qs['filters'](_[_0x7bfe('0x3d')](_0xb789a4[_0x7bfe('0x34')],_0x299bf1[_0x7bfe('0x3e')]),_0x4b6588);if(_0xb789a4[_0x7bfe('0x34')]['filter']){_0x5e03e7[_0x7bfe('0x3f')]=_[_0x7bfe('0x40')](_0x5e03e7[_0x7bfe('0x3f')],{'$or':_['map'](_0x4b6588,function(_0x21a011){if(_0x21a011[_0x7bfe('0x31')]!==_0x7bfe('0x41')){var _0x3c7bdc={};_0x3c7bdc[_0x21a011[_0x7bfe('0x2a')]]={'$like':'%'+_0xb789a4[_0x7bfe('0x34')][_0x7bfe('0x42')]+'%'};return _0x3c7bdc;}})});}_0x5e03e7=_[_0x7bfe('0x40')]({},_0x5e03e7,_0xb789a4[_0x7bfe('0x43')]);var _0x59c2fd={'where':_0x5e03e7[_0x7bfe('0x3f')]};return db[_0x7bfe('0x2e')][_0x7bfe('0x20')](_0x59c2fd)[_0x7bfe('0x26')](function(_0x526242){_0x56268c[_0x7bfe('0x20')]=_0x526242;if(_0xb789a4[_0x7bfe('0x34')][_0x7bfe('0x44')]){_0x5e03e7[_0x7bfe('0x45')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x7bfe('0x46')](_0x5e03e7);})[_0x7bfe('0x26')](function(_0x41b978){_0x56268c['rows']=_0x41b978;return _0x56268c;})[_0x7bfe('0x26')](respondWithFilteredResult(_0x3c6b9c,_0x5e03e7))[_0x7bfe('0x47')](handleError(_0x3c6b9c,null));};exports[_0x7bfe('0x48')]=function(_0x187374,_0x8e3de4){var _0x52a07c={'raw':!![],'where':{'id':_0x187374[_0x7bfe('0x49')]['id']}},_0x55f4d8={};_0x55f4d8[_0x7bfe('0x33')]=_['keys'](db[_0x7bfe('0x2e')]['rawAttributes']);_0x55f4d8[_0x7bfe('0x34')]=_[_0x7bfe('0x35')](_0x187374['query']);_0x55f4d8[_0x7bfe('0x3e')]=_[_0x7bfe('0x36')](_0x55f4d8['model'],_0x55f4d8['query']);_0x52a07c[_0x7bfe('0x37')]=_[_0x7bfe('0x36')](_0x55f4d8['model'],qs['fields'](_0x187374[_0x7bfe('0x34')][_0x7bfe('0x38')]));_0x52a07c[_0x7bfe('0x37')]=_0x52a07c[_0x7bfe('0x37')]['length']?_0x52a07c[_0x7bfe('0x37')]:_0x55f4d8[_0x7bfe('0x33')];if(_0x187374[_0x7bfe('0x34')]['includeAll']){_0x52a07c[_0x7bfe('0x45')]=[{'all':!![]}];}_0x52a07c=_[_0x7bfe('0x40')]({},_0x52a07c,_0x187374[_0x7bfe('0x43')]);return db[_0x7bfe('0x2e')]['find'](_0x52a07c)['then'](handleEntityNotFound(_0x8e3de4,null))['then'](respondWithResult(_0x8e3de4,null))[_0x7bfe('0x47')](handleError(_0x8e3de4,null));};exports['update']=function(_0x2d73f6,_0x3b5aed){if(_0x2d73f6[_0x7bfe('0x4a')]['id']){delete _0x2d73f6[_0x7bfe('0x4a')]['id'];}return db[_0x7bfe('0x2e')][_0x7bfe('0x4b')]({'where':{'id':_0x2d73f6[_0x7bfe('0x49')]['id']}})[_0x7bfe('0x26')](handleEntityNotFound(_0x3b5aed,null))[_0x7bfe('0x26')](saveUpdates(_0x2d73f6[_0x7bfe('0x4a')],null))[_0x7bfe('0x26')](respondWithResult(_0x3b5aed,null))[_0x7bfe('0x47')](handleError(_0x3b5aed,null));};exports[_0x7bfe('0x4c')]=function(_0x2976e6,_0x583120){return db[_0x7bfe('0x2e')][_0x7bfe('0x4b')]({'where':{'id':_0x2976e6[_0x7bfe('0x49')]['id']}})[_0x7bfe('0x26')](handleEntityNotFound(_0x583120,null))[_0x7bfe('0x26')](removeEntity(_0x583120,null))[_0x7bfe('0x47')](handleError(_0x583120,null));};exports[_0x7bfe('0x4d')]=function(_0x3f4a3b,_0x9524a1){return db[_0x7bfe('0x2e')]['describe']()['then'](respondWithResult(_0x9524a1,null))[_0x7bfe('0x47')](handleError(_0x9524a1,null));}; \ No newline at end of file +var _0x0bae=['query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','params','rawAttributes','includeAll','include','find','catch','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','CmHopperBlack','type','key','model'];(function(_0x1c5584,_0x598d58){var _0x549095=function(_0x1858c5){while(--_0x1858c5){_0x1c5584['push'](_0x1c5584['shift']());}};_0x549095(++_0x598d58);}(_0x0bae,0x146));var _0xe0ba=function(_0x1e60b9,_0x4d5d45){_0x1e60b9=_0x1e60b9-0x0;var _0x37af34=_0x0bae[_0x1e60b9];return _0x37af34;};'use strict';var emlformat=require(_0xe0ba('0x0'));var rimraf=require(_0xe0ba('0x1'));var zipdir=require(_0xe0ba('0x2'));var jsonpatch=require(_0xe0ba('0x3'));var rp=require(_0xe0ba('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe0ba('0x5'));var path=require(_0xe0ba('0x6'));var sox=require(_0xe0ba('0x7'));var csv=require(_0xe0ba('0x8'));var ejs=require(_0xe0ba('0x9'));var fs=require('fs');var fs_extra=require(_0xe0ba('0xa'));var _=require(_0xe0ba('0xb'));var squel=require('squel');var crypto=require(_0xe0ba('0xc'));var jsforce=require(_0xe0ba('0xd'));var deskjs=require(_0xe0ba('0xe'));var toCsv=require(_0xe0ba('0x8'));var querystring=require(_0xe0ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0ba('0x10'));var authService=require(_0xe0ba('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0ba('0x12'));var hardwareService=require(_0xe0ba('0x13'));var logger=require(_0xe0ba('0x14'))(_0xe0ba('0x15'));var utils=require(_0xe0ba('0x16'));var config=require(_0xe0ba('0x17'));var licenseUtil=require(_0xe0ba('0x18'));var db=require(_0xe0ba('0x19'))['db'];function respondWithStatusCode(_0x21ac77,_0x5b1361){_0x5b1361=_0x5b1361||0xcc;return function(_0x42a013){if(_0x42a013){return _0x21ac77['sendStatus'](_0x5b1361);}return _0x21ac77[_0xe0ba('0x1a')](_0x5b1361)[_0xe0ba('0x1b')]();};}function respondWithResult(_0x5c73fc,_0x42a03c){_0x42a03c=_0x42a03c||0xc8;return function(_0x4f9f91){if(_0x4f9f91){return _0x5c73fc[_0xe0ba('0x1a')](_0x42a03c)[_0xe0ba('0x1c')](_0x4f9f91);}};}function respondWithFilteredResult(_0x54f21e,_0x3b019a){return function(_0x426786){if(_0x426786){var _0x2e7a5a=typeof _0x3b019a[_0xe0ba('0x1d')]===_0xe0ba('0x1e')&&typeof _0x3b019a[_0xe0ba('0x1f')]===_0xe0ba('0x1e');var _0x5abaf5=_0x426786['count'];var _0x26f5c3=_0x2e7a5a?0x0:_0x3b019a[_0xe0ba('0x1d')];var _0x3f0b37=_0x2e7a5a?_0x426786[_0xe0ba('0x20')]:_0x3b019a[_0xe0ba('0x1d')]+_0x3b019a[_0xe0ba('0x1f')];var _0xced1cf;if(_0x3f0b37>=_0x5abaf5){_0x3f0b37=_0x5abaf5;_0xced1cf=0xc8;}else{_0xced1cf=0xce;}_0x54f21e[_0xe0ba('0x1a')](_0xced1cf);return _0x54f21e['set'](_0xe0ba('0x21'),_0x26f5c3+'-'+_0x3f0b37+'/'+_0x5abaf5)[_0xe0ba('0x1c')](_0x426786);}return null;};}function patchUpdates(_0x5c640a){return function(_0x2d7afa){try{jsonpatch['apply'](_0x2d7afa,_0x5c640a,!![]);}catch(_0x59dd5e){return BPromise['reject'](_0x59dd5e);}return _0x2d7afa[_0xe0ba('0x22')]();};}function saveUpdates(_0x598d8f,_0x23efac){return function(_0x59d068){if(_0x59d068){return _0x59d068[_0xe0ba('0x23')](_0x598d8f)[_0xe0ba('0x24')](function(_0x1bc0cf){return _0x1bc0cf;});}return null;};}function removeEntity(_0xb2ff87,_0x42cfa4){return function(_0x3e5701){if(_0x3e5701){return _0x3e5701[_0xe0ba('0x25')]()[_0xe0ba('0x24')](function(){_0xb2ff87[_0xe0ba('0x1a')](0xcc)[_0xe0ba('0x1b')]();});}};}function handleEntityNotFound(_0xfa5e7e,_0x41f120){return function(_0x35092c){if(!_0x35092c){_0xfa5e7e[_0xe0ba('0x26')](0x194);}return _0x35092c;};}function handleError(_0x591737,_0x5a7117){_0x5a7117=_0x5a7117||0x1f4;return function(_0x219eb3){logger[_0xe0ba('0x27')](_0x219eb3[_0xe0ba('0x28')]);if(_0x219eb3[_0xe0ba('0x29')]){delete _0x219eb3[_0xe0ba('0x29')];}_0x591737[_0xe0ba('0x1a')](_0x5a7117)[_0xe0ba('0x2a')](_0x219eb3);};}exports[_0xe0ba('0x2b')]=function(_0xcb0e11,_0x3241e9){var _0x53954f={},_0x6d286a={},_0x59fead={'count':0x0,'rows':[]};var _0x5a2d2e=_[_0xe0ba('0x2c')](db[_0xe0ba('0x2d')]['rawAttributes'],function(_0xd83c44){return{'name':_0xd83c44['fieldName'],'type':_0xd83c44[_0xe0ba('0x2e')][_0xe0ba('0x2f')]};});_0x6d286a[_0xe0ba('0x30')]=_['map'](_0x5a2d2e,_0xe0ba('0x29'));_0x6d286a[_0xe0ba('0x31')]=_[_0xe0ba('0x32')](_0xcb0e11[_0xe0ba('0x31')]);_0x6d286a[_0xe0ba('0x33')]=_['intersection'](_0x6d286a[_0xe0ba('0x30')],_0x6d286a[_0xe0ba('0x31')]);_0x53954f[_0xe0ba('0x34')]=_[_0xe0ba('0x35')](_0x6d286a[_0xe0ba('0x30')],qs[_0xe0ba('0x36')](_0xcb0e11[_0xe0ba('0x31')][_0xe0ba('0x36')]));_0x53954f[_0xe0ba('0x34')]=_0x53954f[_0xe0ba('0x34')][_0xe0ba('0x37')]?_0x53954f[_0xe0ba('0x34')]:_0x6d286a['model'];if(!_0xcb0e11[_0xe0ba('0x31')][_0xe0ba('0x38')](_0xe0ba('0x39'))){_0x53954f['limit']=qs[_0xe0ba('0x1f')](_0xcb0e11[_0xe0ba('0x31')][_0xe0ba('0x1f')]);_0x53954f[_0xe0ba('0x1d')]=qs['offset'](_0xcb0e11[_0xe0ba('0x31')]['offset']);}_0x53954f[_0xe0ba('0x3a')]=qs[_0xe0ba('0x3b')](_0xcb0e11[_0xe0ba('0x31')][_0xe0ba('0x3b')]);_0x53954f[_0xe0ba('0x3c')]=qs['filters'](_[_0xe0ba('0x3d')](_0xcb0e11[_0xe0ba('0x31')],_0x6d286a['filters']),_0x5a2d2e);if(_0xcb0e11['query'][_0xe0ba('0x3e')]){_0x53954f['where']=_[_0xe0ba('0x3f')](_0x53954f['where'],{'$or':_[_0xe0ba('0x2c')](_0x5a2d2e,function(_0x551cdc){if(_0x551cdc['type']!=='VIRTUAL'){var _0x345492={};_0x345492[_0x551cdc['name']]={'$like':'%'+_0xcb0e11[_0xe0ba('0x31')][_0xe0ba('0x3e')]+'%'};return _0x345492;}})});}_0x53954f=_[_0xe0ba('0x3f')]({},_0x53954f,_0xcb0e11[_0xe0ba('0x40')]);var _0x4f4c7e={'where':_0x53954f[_0xe0ba('0x3c')]};return db['CmHopperBlack']['count'](_0x4f4c7e)[_0xe0ba('0x24')](function(_0x5e1977){_0x59fead['count']=_0x5e1977;if(_0xcb0e11[_0xe0ba('0x31')]['includeAll']){_0x53954f['include']=[{'all':!![]}];}return db[_0xe0ba('0x2d')][_0xe0ba('0x41')](_0x53954f);})['then'](function(_0x268c41){_0x59fead[_0xe0ba('0x42')]=_0x268c41;return _0x59fead;})['then'](respondWithFilteredResult(_0x3241e9,_0x53954f))['catch'](handleError(_0x3241e9,null));};exports['show']=function(_0x1137c6,_0x2b1f8c){var _0xa81c0a={'raw':!![],'where':{'id':_0x1137c6[_0xe0ba('0x43')]['id']}},_0x14b594={};_0x14b594[_0xe0ba('0x30')]=_['keys'](db[_0xe0ba('0x2d')][_0xe0ba('0x44')]);_0x14b594[_0xe0ba('0x31')]=_[_0xe0ba('0x32')](_0x1137c6[_0xe0ba('0x31')]);_0x14b594[_0xe0ba('0x33')]=_['intersection'](_0x14b594['model'],_0x14b594[_0xe0ba('0x31')]);_0xa81c0a[_0xe0ba('0x34')]=_[_0xe0ba('0x35')](_0x14b594[_0xe0ba('0x30')],qs[_0xe0ba('0x36')](_0x1137c6[_0xe0ba('0x31')]['fields']));_0xa81c0a[_0xe0ba('0x34')]=_0xa81c0a[_0xe0ba('0x34')]['length']?_0xa81c0a[_0xe0ba('0x34')]:_0x14b594[_0xe0ba('0x30')];if(_0x1137c6[_0xe0ba('0x31')][_0xe0ba('0x45')]){_0xa81c0a[_0xe0ba('0x46')]=[{'all':!![]}];}_0xa81c0a=_[_0xe0ba('0x3f')]({},_0xa81c0a,_0x1137c6['options']);return db['CmHopperBlack'][_0xe0ba('0x47')](_0xa81c0a)['then'](handleEntityNotFound(_0x2b1f8c,null))[_0xe0ba('0x24')](respondWithResult(_0x2b1f8c,null))[_0xe0ba('0x48')](handleError(_0x2b1f8c,null));};exports[_0xe0ba('0x23')]=function(_0x4e3a89,_0x327aa0){if(_0x4e3a89['body']['id']){delete _0x4e3a89[_0xe0ba('0x49')]['id'];}return db[_0xe0ba('0x2d')][_0xe0ba('0x47')]({'where':{'id':_0x4e3a89[_0xe0ba('0x43')]['id']}})['then'](handleEntityNotFound(_0x327aa0,null))[_0xe0ba('0x24')](saveUpdates(_0x4e3a89['body'],null))['then'](respondWithResult(_0x327aa0,null))[_0xe0ba('0x48')](handleError(_0x327aa0,null));};exports[_0xe0ba('0x25')]=function(_0x17f1dd,_0x1fe678){return db[_0xe0ba('0x2d')][_0xe0ba('0x47')]({'where':{'id':_0x17f1dd[_0xe0ba('0x43')]['id']}})[_0xe0ba('0x24')](handleEntityNotFound(_0x1fe678,null))[_0xe0ba('0x24')](removeEntity(_0x1fe678,null))['catch'](handleError(_0x1fe678,null));};exports[_0xe0ba('0x4a')]=function(_0x4cb06c,_0x12efd4){return db[_0xe0ba('0x2d')][_0xe0ba('0x4a')]()[_0xe0ba('0x24')](respondWithResult(_0x12efd4,null))[_0xe0ba('0x48')](handleError(_0x12efd4,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index f3b8c53..28484fe 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 _0xbe14=['request-promise','path','rimraf','../../config/environment','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe14,0x119));var _0x4be1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbe14[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4be1('0x0'));var util=require(_0x4be1('0x1'));var logger=require('../../config/logger')(_0x4be1('0x2'));var moment=require(_0x4be1('0x3'));var BPromise=require(_0x4be1('0x4'));var rp=require(_0x4be1('0x5'));var fs=require('fs');var path=require(_0x4be1('0x6'));var rimraf=require(_0x4be1('0x7'));var config=require(_0x4be1('0x8'));var attributes=require('./cmHopperBlack.attributes');module[_0x4be1('0x9')]=function(_0x193eef,_0x5b2ed0){return _0x193eef[_0x4be1('0xa')](_0x4be1('0xb'),attributes,{'tableName':_0x4be1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba9c=['request-promise','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xba9c,0x1ca));var _0xcba9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xcba9('0x0'));var rp=require(_0xcba9('0x1'));var fs=require('fs');var path=require(_0xcba9('0x2'));var rimraf=require(_0xcba9('0x3'));var config=require('../../config/environment');var attributes=require(_0xcba9('0x4'));module[_0xcba9('0x5')]=function(_0x548044,_0xb6a30){return _0x548044[_0xcba9('0x6')](_0xcba9('0x7'),attributes,{'tableName':_0xcba9('0x8'),'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 9bbdb77..2e8e662 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 _0x8de9=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CmHopperBlack','findAll','raw','options','where','attributes','map','include','model','GetCmHopperBlack','catch','UpdateCmHopperBlack','update','limit','destroy','DestroyCmHopperBlack','lodash','moment','bluebird','randomstring'];(function(_0xceaae1,_0x225ba5){var _0xba34de=function(_0x4c1819){while(--_0x4c1819){_0xceaae1['push'](_0xceaae1['shift']());}};_0xba34de(++_0x225ba5);}(_0x8de9,0x152));var _0x98de=function(_0x495753,_0x5e2a5a){_0x495753=_0x495753-0x0;var _0x5e321e=_0x8de9[_0x495753];return _0x5e321e;};'use strict';var _=require(_0x98de('0x0'));var util=require('util');var moment=require(_0x98de('0x1'));var BPromise=require(_0x98de('0x2'));var rs=require(_0x98de('0x3'));var fs=require('fs');var Redis=require(_0x98de('0x4'));var db=require(_0x98de('0x5'))['db'];var utils=require(_0x98de('0x6'));var logger=require(_0x98de('0x7'))(_0x98de('0x8'));var config=require(_0x98de('0x9'));var jayson=require(_0x98de('0xa'));var client=jayson['client'][_0x98de('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194a47,_0x572b72,_0x443221){return new BPromise(function(_0x19341a,_0x3f058a){return client[_0x98de('0xc')](_0x194a47,_0x443221)[_0x98de('0xd')](function(_0xb297a2){logger[_0x98de('0xe')](_0x98de('0xf'),_0x572b72,_0x98de('0x10'));logger[_0x98de('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x572b72,_0x98de('0x10'),JSON[_0x98de('0x12')](_0xb297a2));if(_0xb297a2[_0x98de('0x13')]){if(_0xb297a2[_0x98de('0x13')][_0x98de('0x14')]===0x1f4){logger[_0x98de('0x13')](_0x98de('0xf'),_0x572b72,_0xb297a2[_0x98de('0x13')][_0x98de('0x15')]);return _0x3f058a(_0xb297a2[_0x98de('0x13')][_0x98de('0x15')]);}logger[_0x98de('0x13')](_0x98de('0xf'),_0x572b72,_0xb297a2['error'][_0x98de('0x15')]);return _0x19341a(_0xb297a2[_0x98de('0x13')]['message']);}else{logger[_0x98de('0xe')](_0x98de('0xf'),_0x572b72,_0x98de('0x10'));_0x19341a(_0xb297a2['result']['message']);}})['catch'](function(_0x7f5c27){logger[_0x98de('0x13')](_0x98de('0xf'),_0x572b72,_0x7f5c27);_0x3f058a(_0x7f5c27);});});}exports['GetCmHopperBlack']=function(_0x1b6554){var _0x2e1866=this;return new Promise(function(_0x3503b1,_0x97fdfe){return db[_0x98de('0x16')][_0x98de('0x17')]({'raw':_0x1b6554['options']?_0x1b6554['options'][_0x98de('0x18')]===undefined?!![]:![]:!![],'where':_0x1b6554['options']?_0x1b6554[_0x98de('0x19')][_0x98de('0x1a')]||null:null,'attributes':_0x1b6554[_0x98de('0x19')]?_0x1b6554['options'][_0x98de('0x1b')]||null:null,'limit':_0x1b6554[_0x98de('0x19')]?_0x1b6554[_0x98de('0x19')]['limit']||null:null,'include':_0x1b6554[_0x98de('0x19')]?_0x1b6554[_0x98de('0x19')]['include']?_[_0x98de('0x1c')](_0x1b6554[_0x98de('0x19')][_0x98de('0x1d')],function(_0x395000){return{'model':db[_0x395000[_0x98de('0x1e')]],'as':_0x395000['as'],'attributes':_0x395000[_0x98de('0x1b')],'include':_0x395000['include']?_[_0x98de('0x1c')](_0x395000[_0x98de('0x1d')],function(_0xfe21aa){return{'model':db[_0xfe21aa[_0x98de('0x1e')]],'as':_0xfe21aa['as'],'attributes':_0xfe21aa[_0x98de('0x1b')],'include':_0xfe21aa[_0x98de('0x1d')]?_[_0x98de('0x1c')](_0xfe21aa[_0x98de('0x1d')],function(_0x440762){return{'model':db[_0x440762['model']],'as':_0x440762['as'],'attributes':_0x440762[_0x98de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x98de('0xd')](function(_0x5bc1d3){logger['info']('GetCmHopperBlack',_0x1b6554);logger[_0x98de('0x11')](_0x98de('0x1f'),_0x1b6554,JSON['stringify'](_0x5bc1d3));_0x3503b1(_0x5bc1d3);})[_0x98de('0x20')](function(_0x156e8e){logger[_0x98de('0x13')](_0x98de('0x1f'),_0x156e8e[_0x98de('0x15')],_0x1b6554);_0x97fdfe(_0x2e1866[_0x98de('0x13')](0x1f4,_0x156e8e[_0x98de('0x15')]));});});};exports[_0x98de('0x21')]=function(_0x48370a){var _0x47d59b=this;return new Promise(function(_0x4108ac,_0x41175b){return db[_0x98de('0x16')][_0x98de('0x22')](_0x48370a['body'],{'raw':_0x48370a['options']?_0x48370a['options'][_0x98de('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48370a[_0x98de('0x19')]?_0x48370a[_0x98de('0x19')][_0x98de('0x1a')]||null:null,'attributes':_0x48370a['options']?_0x48370a[_0x98de('0x19')][_0x98de('0x1b')]||null:null,'limit':_0x48370a[_0x98de('0x19')]?_0x48370a[_0x98de('0x19')][_0x98de('0x23')]||null:null})[_0x98de('0xd')](function(_0x238405){logger['info'](_0x98de('0x21'),_0x48370a);logger[_0x98de('0x11')](_0x98de('0x21'),_0x48370a,JSON[_0x98de('0x12')](_0x238405));_0x4108ac(_0x238405);})['catch'](function(_0xb8883e){logger[_0x98de('0x13')](_0x98de('0x21'),_0xb8883e[_0x98de('0x15')],_0x48370a);_0x41175b(_0x47d59b[_0x98de('0x13')](0x1f4,_0xb8883e['message']));});});};exports['DestroyCmHopperBlack']=function(_0x19e913){var _0x4cfd0d=this;return new Promise(function(_0x5e66bc,_0x4c5245){return db[_0x98de('0x16')][_0x98de('0x24')]({'where':_0x19e913['options']?_0x19e913[_0x98de('0x19')][_0x98de('0x1a')]||null:null})[_0x98de('0xd')](function(_0x1f84a7){logger[_0x98de('0xe')](_0x98de('0x25'),_0x19e913);logger[_0x98de('0x11')](_0x98de('0x25'),_0x19e913,JSON[_0x98de('0x12')](_0x1f84a7));_0x5e66bc(_0x1f84a7);})[_0x98de('0x20')](function(_0x58375b){logger['error']('DestroyCmHopperBlack',_0x58375b[_0x98de('0x15')],_0x19e913);_0x4c5245(_0x4cfd0d[_0x98de('0x13')](0x1f4,_0x58375b['message']));});});}; \ No newline at end of file +var _0x77a0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CmHopperBlack','options','raw','where','attributes','limit','include','model','map','then','GetCmHopperBlack','update','body','UpdateCmHopperBlack','destroy','DestroyCmHopperBlack','util'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x77a0,0x1ed));var _0x077a=function(_0x29341c,_0x1564e8){_0x29341c=_0x29341c-0x0;var _0x3c7172=_0x77a0[_0x29341c];return _0x3c7172;};'use strict';var _=require('lodash');var util=require(_0x077a('0x0'));var moment=require(_0x077a('0x1'));var BPromise=require(_0x077a('0x2'));var rs=require(_0x077a('0x3'));var fs=require('fs');var Redis=require(_0x077a('0x4'));var db=require(_0x077a('0x5'))['db'];var utils=require(_0x077a('0x6'));var logger=require(_0x077a('0x7'))(_0x077a('0x8'));var config=require(_0x077a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x077a('0xa')][_0x077a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56d6b6,_0x17a64b,_0x27dabc){return new BPromise(function(_0x5de2b8,_0x4225b8){return client[_0x077a('0xc')](_0x56d6b6,_0x27dabc)['then'](function(_0x55a443){logger[_0x077a('0xd')](_0x077a('0xe'),_0x17a64b,_0x077a('0xf'));logger[_0x077a('0x10')](_0x077a('0x11'),_0x17a64b,'request\x20sent',JSON[_0x077a('0x12')](_0x55a443));if(_0x55a443[_0x077a('0x13')]){if(_0x55a443[_0x077a('0x13')]['code']===0x1f4){logger[_0x077a('0x13')](_0x077a('0xe'),_0x17a64b,_0x55a443[_0x077a('0x13')][_0x077a('0x14')]);return _0x4225b8(_0x55a443[_0x077a('0x13')][_0x077a('0x14')]);}logger[_0x077a('0x13')](_0x077a('0xe'),_0x17a64b,_0x55a443[_0x077a('0x13')][_0x077a('0x14')]);return _0x5de2b8(_0x55a443[_0x077a('0x13')][_0x077a('0x14')]);}else{logger[_0x077a('0xd')]('CmHopperBlack,\x20%s,\x20%s',_0x17a64b,_0x077a('0xf'));_0x5de2b8(_0x55a443['result'][_0x077a('0x14')]);}})[_0x077a('0x15')](function(_0x3cc481){logger[_0x077a('0x13')](_0x077a('0xe'),_0x17a64b,_0x3cc481);_0x4225b8(_0x3cc481);});});}exports['GetCmHopperBlack']=function(_0x2479ac){var _0x402e08=this;return new Promise(function(_0x2d2ae0,_0xf262c5){return db[_0x077a('0x16')]['findAll']({'raw':_0x2479ac[_0x077a('0x17')]?_0x2479ac[_0x077a('0x17')][_0x077a('0x18')]===undefined?!![]:![]:!![],'where':_0x2479ac['options']?_0x2479ac['options'][_0x077a('0x19')]||null:null,'attributes':_0x2479ac['options']?_0x2479ac[_0x077a('0x17')][_0x077a('0x1a')]||null:null,'limit':_0x2479ac[_0x077a('0x17')]?_0x2479ac['options'][_0x077a('0x1b')]||null:null,'include':_0x2479ac[_0x077a('0x17')]?_0x2479ac[_0x077a('0x17')][_0x077a('0x1c')]?_['map'](_0x2479ac[_0x077a('0x17')]['include'],function(_0xd7a27e){return{'model':db[_0xd7a27e[_0x077a('0x1d')]],'as':_0xd7a27e['as'],'attributes':_0xd7a27e[_0x077a('0x1a')],'include':_0xd7a27e[_0x077a('0x1c')]?_[_0x077a('0x1e')](_0xd7a27e[_0x077a('0x1c')],function(_0x453863){return{'model':db[_0x453863[_0x077a('0x1d')]],'as':_0x453863['as'],'attributes':_0x453863[_0x077a('0x1a')],'include':_0x453863[_0x077a('0x1c')]?_[_0x077a('0x1e')](_0x453863['include'],function(_0xa3ffff){return{'model':db[_0xa3ffff[_0x077a('0x1d')]],'as':_0xa3ffff['as'],'attributes':_0xa3ffff['attributes']};}):[]};}):[]};}):[]:[]})[_0x077a('0x1f')](function(_0x287fe0){logger[_0x077a('0xd')](_0x077a('0x20'),_0x2479ac);logger[_0x077a('0x10')](_0x077a('0x20'),_0x2479ac,JSON[_0x077a('0x12')](_0x287fe0));_0x2d2ae0(_0x287fe0);})[_0x077a('0x15')](function(_0x3b8aa8){logger[_0x077a('0x13')](_0x077a('0x20'),_0x3b8aa8[_0x077a('0x14')],_0x2479ac);_0xf262c5(_0x402e08[_0x077a('0x13')](0x1f4,_0x3b8aa8[_0x077a('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x496ac1){var _0x43027b=this;return new Promise(function(_0x10881f,_0x17b20f){return db[_0x077a('0x16')][_0x077a('0x21')](_0x496ac1[_0x077a('0x22')],{'raw':_0x496ac1[_0x077a('0x17')]?_0x496ac1[_0x077a('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x496ac1[_0x077a('0x17')]?_0x496ac1[_0x077a('0x17')][_0x077a('0x19')]||null:null,'attributes':_0x496ac1[_0x077a('0x17')]?_0x496ac1[_0x077a('0x17')][_0x077a('0x1a')]||null:null,'limit':_0x496ac1[_0x077a('0x17')]?_0x496ac1[_0x077a('0x17')]['limit']||null:null})['then'](function(_0x1b1819){logger[_0x077a('0xd')]('UpdateCmHopperBlack',_0x496ac1);logger[_0x077a('0x10')](_0x077a('0x23'),_0x496ac1,JSON[_0x077a('0x12')](_0x1b1819));_0x10881f(_0x1b1819);})[_0x077a('0x15')](function(_0x15b099){logger[_0x077a('0x13')]('UpdateCmHopperBlack',_0x15b099[_0x077a('0x14')],_0x496ac1);_0x17b20f(_0x43027b[_0x077a('0x13')](0x1f4,_0x15b099['message']));});});};exports['DestroyCmHopperBlack']=function(_0x43b511){var _0x1f9518=this;return new Promise(function(_0x5e5cad,_0xf42c22){return db[_0x077a('0x16')][_0x077a('0x24')]({'where':_0x43b511[_0x077a('0x17')]?_0x43b511['options'][_0x077a('0x19')]||null:null})['then'](function(_0x25683f){logger[_0x077a('0xd')](_0x077a('0x25'),_0x43b511);logger[_0x077a('0x10')](_0x077a('0x25'),_0x43b511,JSON[_0x077a('0x12')](_0x25683f));_0x5e5cad(_0x25683f);})['catch'](function(_0x41e920){logger[_0x077a('0x13')](_0x077a('0x25'),_0x41e920[_0x077a('0x14')],_0x43b511);_0xf42c22(_0x1f9518[_0x077a('0x13')](0x1f4,_0x41e920[_0x077a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 2f0708a..152c01e 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 _0x0f4d=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','/:id','update','destroy','exports','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x57677f,_0x5610d4){var _0x50060e=function(_0x14388a){while(--_0x14388a){_0x57677f['push'](_0x57677f['shift']());}};_0x50060e(++_0x5610d4);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x4b3fc8,_0x4ea526){_0x4b3fc8=_0x4b3fc8-0x0;var _0xf87eff=_0x0f4d[_0x4b3fc8];return _0xf87eff;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd0f4('0x0'));var express=require('express');var router=express[_0xd0f4('0x1')]();var fs_extra=require(_0xd0f4('0x2'));var auth=require(_0xd0f4('0x3'));var interaction=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var controller=require(_0xd0f4('0x6'));router[_0xd0f4('0x7')]('/',auth[_0xd0f4('0x8')](),controller['index']);router[_0xd0f4('0x7')](_0xd0f4('0x9'),auth['isAuthenticated'](),controller[_0xd0f4('0xa')]);router[_0xd0f4('0x7')]('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xb')]);router['put'](_0xd0f4('0xc'),auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xd')]);router['delete']('/:id',auth[_0xd0f4('0x8')](),controller[_0xd0f4('0xe')]);module[_0xd0f4('0xf')]=router; \ No newline at end of file +var _0x0adf=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','put','update','delete','multer','util'];(function(_0x188d31,_0x576e87){var _0x30ed33=function(_0x15f9a5){while(--_0x15f9a5){_0x188d31['push'](_0x188d31['shift']());}};_0x30ed33(++_0x576e87);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x58b170,_0x2bc3f9){_0x58b170=_0x58b170-0x0;var _0xe0b22a=_0x0adf[_0x58b170];return _0xe0b22a;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xb')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['show']);router[_0xf0ad('0xf')]('/:id',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e07fc7c..0489392 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 _0x0570=['setDataValue','BOOLEAN','sequelize','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff'];(function(_0x150127,_0x17fd1d){var _0x422e40=function(_0x3a654c){while(--_0x3a654c){_0x150127['push'](_0x150127['shift']());}};_0x422e40(++_0x17fd1d);}(_0x0570,0x19c));var _0x0057=function(_0xde1ad4,_0x189c1b){_0xde1ad4=_0xde1ad4-0x0;var _0x4989d9=_0x0570[_0xde1ad4];return _0x4989d9;};'use strict';var Sequelize=require(_0x0057('0x0'));var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x0057('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0057('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0057('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0057('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0057('0x2')]},'calleridnum':{'type':Sequelize[_0x0057('0x2')]},'calleridname':{'type':Sequelize[_0x0057('0x2')]},'starttime':{'type':Sequelize[_0x0057('0x3')]},'responsetime':{'type':Sequelize[_0x0057('0x3')]},'answertime':{'type':Sequelize[_0x0057('0x3')]},'droptime':{'type':Sequelize[_0x0057('0x3')]},'endtime':{'type':Sequelize[_0x0057('0x3')]},'ringtime':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0057('0x2')]},'campaign':{'type':Sequelize[_0x0057('0x2')]},'campaigntype':{'type':Sequelize[_0x0057('0x2')]},'membername':{'type':Sequelize[_0x0057('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0057('0x2')]},'secondDisposition':{'type':Sequelize[_0x0057('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x0057('0x3')],'set':function(_0xa2a73f){var _0xdc52da=this[_0x0057('0x4')](_0x0057('0x5'));if(_0xdc52da&&_0xa2a73f){this['setDataValue'](_0x0057('0x6'),moment(_0xa2a73f)[_0x0057('0x7')](moment(_0xdc52da),'seconds'));}return this[_0x0057('0x8')]('dispositionat',_0xa2a73f);}},'amd':{'type':Sequelize[_0x0057('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0057('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0057('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0057('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0057('0x3')]},'callback':{'type':Sequelize[_0x0057('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0057('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0057('0x3')]},'deleted':{'type':Sequelize[_0x0057('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0057('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0057('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0057('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7000=['STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','exports','INTEGER'];(function(_0x524f22,_0x534e7c){var _0x3481e1=function(_0x5be54e){while(--_0x5be54e){_0x524f22['push'](_0x524f22['shift']());}};_0x3481e1(++_0x534e7c);}(_0x7000,0x1ba));var _0x0700=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x7000[_0x45e98e];return _0x374dba;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x0700('0x0')]={'state':{'type':Sequelize[_0x0700('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0700('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0700('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0700('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0700('0x2')]},'calleridnum':{'type':Sequelize[_0x0700('0x2')]},'calleridname':{'type':Sequelize[_0x0700('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x0700('0x3')]},'answertime':{'type':Sequelize[_0x0700('0x3')]},'droptime':{'type':Sequelize[_0x0700('0x3')]},'endtime':{'type':Sequelize[_0x0700('0x3')]},'ringtime':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0700('0x2')]},'campaign':{'type':Sequelize[_0x0700('0x2')]},'campaigntype':{'type':Sequelize[_0x0700('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x0700('0x2')]},'disposition':{'type':Sequelize[_0x0700('0x2')]},'secondDisposition':{'type':Sequelize[_0x0700('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1310f3){var _0x484687=this[_0x0700('0x4')](_0x0700('0x5'));if(_0x484687&&_0x1310f3){this[_0x0700('0x6')](_0x0700('0x7'),moment(_0x1310f3)[_0x0700('0x8')](moment(_0x484687),_0x0700('0x9')));}return this[_0x0700('0x6')](_0x0700('0xa'),_0x1310f3);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0700('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x0700('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0700('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0700('0x3')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0700('0x3')]},'deleted':{'type':Sequelize[_0x0700('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0700('0x3')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x0700('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0700('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 792d45e..6b72e54 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 _0x90b1=['uniqueid','countContactsQueueCampaignHopperFinal','findAll','params','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','VoiceQueue','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20NOT\x20IN\x20(?)','select','calleridnum','state\x20=\x204','moveContactsIvrCampaignHopperFinal','Campaign','into','ListId','ANY_VALUE(CampaignId)','CampaignId','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','destroy','error','name','send','index','map','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','pick','filter','merge','where','type','options','CmHopperFinal','includeAll','rows','include','find','catch','update','body'];(function(_0x5925b5,_0x35005c){var _0x5b2ac2=function(_0x5d517e){while(--_0x5d517e){_0x5925b5['push'](_0x5925b5['shift']());}};_0x5b2ac2(++_0x35005c);}(_0x90b1,0x1bb));var _0x190b=function(_0x2bdc75,_0x1100ec){_0x2bdc75=_0x2bdc75-0x0;var _0x103e50=_0x90b1[_0x2bdc75];return _0x103e50;};'use strict';var emlformat=require(_0x190b('0x0'));var rimraf=require(_0x190b('0x1'));var zipdir=require(_0x190b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x190b('0x3'));var BPromise=require(_0x190b('0x4'));var Mustache=require(_0x190b('0x5'));var util=require(_0x190b('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(_0x190b('0x7'));var _=require(_0x190b('0x8'));var squel=require(_0x190b('0x9'));var crypto=require(_0x190b('0xa'));var jsforce=require(_0x190b('0xb'));var deskjs=require(_0x190b('0xc'));var toCsv=require(_0x190b('0xd'));var querystring=require('querystring');var Papa=require(_0x190b('0xe'));var Redis=require(_0x190b('0xf'));var authService=require(_0x190b('0x10'));var qs=require(_0x190b('0x11'));var as=require(_0x190b('0x12'));var hardwareService=require(_0x190b('0x13'));var logger=require(_0x190b('0x14'))(_0x190b('0x15'));var utils=require('../../config/utils');var config=require(_0x190b('0x16'));var licenseUtil=require(_0x190b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d63ac,_0x596c48){_0x596c48=_0x596c48||0xcc;return function(_0x286c81){if(_0x286c81){return _0x4d63ac[_0x190b('0x18')](_0x596c48);}return _0x4d63ac[_0x190b('0x19')](_0x596c48)[_0x190b('0x1a')]();};}function respondWithResult(_0x2e12d4,_0x13544c){_0x13544c=_0x13544c||0xc8;return function(_0x1ff180){if(_0x1ff180){return _0x2e12d4[_0x190b('0x19')](_0x13544c)[_0x190b('0x1b')](_0x1ff180);}};}function respondWithFilteredResult(_0x1a046f,_0xab346){return function(_0x3e8781){if(_0x3e8781){var _0x3fbfc3=typeof _0xab346[_0x190b('0x1c')]===_0x190b('0x1d')&&typeof _0xab346['limit']===_0x190b('0x1d');var _0x5efbed=_0x3e8781[_0x190b('0x1e')];var _0x21e458=_0x3fbfc3?0x0:_0xab346[_0x190b('0x1c')];var _0x16c009=_0x3fbfc3?_0x3e8781['count']:_0xab346[_0x190b('0x1c')]+_0xab346[_0x190b('0x1f')];var _0x441a2b;if(_0x16c009>=_0x5efbed){_0x16c009=_0x5efbed;_0x441a2b=0xc8;}else{_0x441a2b=0xce;}_0x1a046f[_0x190b('0x19')](_0x441a2b);return _0x1a046f[_0x190b('0x20')](_0x190b('0x21'),_0x21e458+'-'+_0x16c009+'/'+_0x5efbed)['json'](_0x3e8781);}return null;};}function patchUpdates(_0x3ed24c){return function(_0x14f0a5){try{jsonpatch['apply'](_0x14f0a5,_0x3ed24c,!![]);}catch(_0xb4c32b){return BPromise['reject'](_0xb4c32b);}return _0x14f0a5['save']();};}function saveUpdates(_0xcd15e5,_0x42e7f2){return function(_0x332006){if(_0x332006){return _0x332006['update'](_0xcd15e5)[_0x190b('0x22')](function(_0x2e633e){return _0x2e633e;});}return null;};}function removeEntity(_0x16e989,_0x292ce3){return function(_0x3b8c74){if(_0x3b8c74){return _0x3b8c74[_0x190b('0x23')]()[_0x190b('0x22')](function(){_0x16e989['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x262a63,_0x1a5f86){return function(_0x50605b){if(!_0x50605b){_0x262a63['sendStatus'](0x194);}return _0x50605b;};}function handleError(_0x3260d5,_0x4e2a93){_0x4e2a93=_0x4e2a93||0x1f4;return function(_0x328e5e){logger[_0x190b('0x24')](_0x328e5e['stack']);if(_0x328e5e[_0x190b('0x25')]){delete _0x328e5e[_0x190b('0x25')];}_0x3260d5['status'](_0x4e2a93)[_0x190b('0x26')](_0x328e5e);};}exports[_0x190b('0x27')]=function(_0x359b4a,_0x494f3f){var _0x536d7b={},_0x3730cc={},_0x4d5f3f={'count':0x0,'rows':[]};var _0x14be2c=_[_0x190b('0x28')](db['CmHopperFinal'][_0x190b('0x29')],function(_0x580b92){return{'name':_0x580b92[_0x190b('0x2a')],'type':_0x580b92['type'][_0x190b('0x2b')]};});_0x3730cc['model']=_[_0x190b('0x28')](_0x14be2c,_0x190b('0x25'));_0x3730cc['query']=_[_0x190b('0x2c')](_0x359b4a[_0x190b('0x2d')]);_0x3730cc[_0x190b('0x2e')]=_[_0x190b('0x2f')](_0x3730cc[_0x190b('0x30')],_0x3730cc[_0x190b('0x2d')]);_0x536d7b[_0x190b('0x31')]=_[_0x190b('0x2f')](_0x3730cc['model'],qs['fields'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x32')]));_0x536d7b['attributes']=_0x536d7b[_0x190b('0x31')][_0x190b('0x33')]?_0x536d7b[_0x190b('0x31')]:_0x3730cc[_0x190b('0x30')];if(!_0x359b4a[_0x190b('0x2d')][_0x190b('0x34')](_0x190b('0x35'))){_0x536d7b['limit']=qs['limit'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1f')]);_0x536d7b[_0x190b('0x1c')]=qs['offset'](_0x359b4a[_0x190b('0x2d')][_0x190b('0x1c')]);}_0x536d7b[_0x190b('0x36')]=qs['sort'](_0x359b4a[_0x190b('0x2d')]['sort']);_0x536d7b['where']=qs[_0x190b('0x2e')](_[_0x190b('0x37')](_0x359b4a['query'],_0x3730cc[_0x190b('0x2e')]),_0x14be2c);if(_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]){_0x536d7b['where']=_[_0x190b('0x39')](_0x536d7b[_0x190b('0x3a')],{'$or':_['map'](_0x14be2c,function(_0x5d006d){if(_0x5d006d[_0x190b('0x3b')]!=='VIRTUAL'){var _0x46bdba={};_0x46bdba[_0x5d006d[_0x190b('0x25')]]={'$like':'%'+_0x359b4a[_0x190b('0x2d')][_0x190b('0x38')]+'%'};return _0x46bdba;}})});}_0x536d7b=_['merge']({},_0x536d7b,_0x359b4a[_0x190b('0x3c')]);var _0x5f118c={'where':_0x536d7b[_0x190b('0x3a')]};return db[_0x190b('0x3d')]['count'](_0x5f118c)[_0x190b('0x22')](function(_0x2a75d2){_0x4d5f3f[_0x190b('0x1e')]=_0x2a75d2;if(_0x359b4a['query'][_0x190b('0x3e')]){_0x536d7b['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x536d7b);})[_0x190b('0x22')](function(_0x3aef1d){_0x4d5f3f[_0x190b('0x3f')]=_0x3aef1d;return _0x4d5f3f;})[_0x190b('0x22')](respondWithFilteredResult(_0x494f3f,_0x536d7b))['catch'](handleError(_0x494f3f,null));};exports['show']=function(_0x4045b7,_0x492240){var _0x110891={'raw':!![],'where':{'id':_0x4045b7['params']['id']}},_0x3d67f0={};_0x3d67f0[_0x190b('0x30')]=_[_0x190b('0x2c')](db[_0x190b('0x3d')]['rawAttributes']);_0x3d67f0[_0x190b('0x2d')]=_[_0x190b('0x2c')](_0x4045b7['query']);_0x3d67f0[_0x190b('0x2e')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],_0x3d67f0[_0x190b('0x2d')]);_0x110891[_0x190b('0x31')]=_['intersection'](_0x3d67f0[_0x190b('0x30')],qs['fields'](_0x4045b7[_0x190b('0x2d')][_0x190b('0x32')]));_0x110891[_0x190b('0x31')]=_0x110891[_0x190b('0x31')][_0x190b('0x33')]?_0x110891[_0x190b('0x31')]:_0x3d67f0[_0x190b('0x30')];if(_0x4045b7['query'][_0x190b('0x3e')]){_0x110891[_0x190b('0x40')]=[{'all':!![]}];}_0x110891=_[_0x190b('0x39')]({},_0x110891,_0x4045b7['options']);return db[_0x190b('0x3d')][_0x190b('0x41')](_0x110891)[_0x190b('0x22')](handleEntityNotFound(_0x492240,null))[_0x190b('0x22')](respondWithResult(_0x492240,null))[_0x190b('0x42')](handleError(_0x492240,null));};exports['describe']=function(_0x1f2262,_0xadc789){return db[_0x190b('0x3d')]['describe']()[_0x190b('0x22')](respondWithResult(_0xadc789,null))[_0x190b('0x42')](handleError(_0xadc789,null));};exports[_0x190b('0x43')]=function(_0x505e52,_0x4cb561){if(_0x505e52[_0x190b('0x44')][_0x190b('0x45')]){delete _0x505e52[_0x190b('0x44')][_0x190b('0x45')];}return db[_0x190b('0x3d')][_0x190b('0x41')]({'where':{'uniqueid':_0x505e52['params']['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x4cb561,null))[_0x190b('0x22')](saveUpdates(_0x505e52[_0x190b('0x44')],null))['then'](respondWithResult(_0x4cb561,null))[_0x190b('0x42')](handleError(_0x4cb561,null));};exports[_0x190b('0x46')]=function(_0x215ab6,_0x503700,_0xbc6757){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x215ab6[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db['sequelize']['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),_0x190b('0x50')],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')]('`state`\x20=\x2019,\x201,\x20null'))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0x503700,null))[_0x190b('0x22')](respondWithResult(_0x503700,null))['catch'](handleError(_0x503700,null));};exports[_0x190b('0x58')]=function(_0x270b59,_0xffe7cb,_0x405e04){return db[_0x190b('0x3d')][_0x190b('0x47')]({'raw':![],'where':{'CampaignId':_0x270b59[_0x190b('0x48')]['id']},'attributes':[[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x4c')))),_0x190b('0x4d')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')]['literal'](_0x190b('0x59')))),_0x190b('0x4e')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x4f')))),'busyContacts'],[db[_0x190b('0x49')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x51')))),'congestionContacts'],[db['sequelize']['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x52')))),_0x190b('0x53')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db['sequelize']['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')](_0x190b('0x54')))),_0x190b('0x55')],[db[_0x190b('0x49')]['fn']('COUNT',db[_0x190b('0x49')]['fn']('IF',db[_0x190b('0x49')][_0x190b('0x4b')]('`state`\x20=\x2022,\x201,\x20null'))),_0x190b('0x5a')],[db[_0x190b('0x49')]['fn'](_0x190b('0x4a'),db[_0x190b('0x49')]['fn']('IF',db['sequelize'][_0x190b('0x4b')](_0x190b('0x5b')))),_0x190b('0x57')]]})[_0x190b('0x22')](handleEntityNotFound(_0xffe7cb,null))['then'](respondWithResult(_0xffe7cb,null))[_0x190b('0x42')](handleError(_0xffe7cb,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x2495c9,_0x348beb,_0x360d39){return db[_0x190b('0x5c')]['find']({'where':{'id':_0x2495c9[_0x190b('0x48')]['id']}})['then'](handleEntityNotFound(_0x348beb,null))[_0x190b('0x22')](function(_0x5073d2){var _0x49b60c;if(_0x5073d2){_0x49b60c=squel[_0x190b('0x5d')]()['into'](_0x190b('0x5e'))[_0x190b('0x5f')]([_0x190b('0x60'),_0x190b('0x61'),_0x190b('0x62'),'ListId',_0x190b('0x63'),_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),'phone')[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))['field'](_0x190b('0x69'),_0x190b('0x62'))[_0x190b('0x66')](_0x190b('0x6a'),'ListId')[_0x190b('0x66')](_0x190b('0x6b'),_0x190b('0x63'))['field'](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')]('NOW()',_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']())[_0x190b('0x3a')](_0x190b('0x6f'),_0x2495c9['body'][_0x190b('0x70')][_0x190b('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')[_0x190b('0x3a')](_0x190b('0x72'),squel['select']()['field'](_0x190b('0x60'))[_0x190b('0x6c')](_0x190b('0x5e'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9['params']['id']['toString']()))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x6e'),_0x2495c9[_0x190b('0x48')]['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')]['query'](_0x49b60c);}return[];})['then'](respondWithResult(_0x348beb,null))[_0x190b('0x42')](handleError(_0x348beb,null));};exports[_0x190b('0x76')]=function(_0x4b988d,_0x40ac95,_0x18c5f4){return db[_0x190b('0x77')]['find']({'where':{'id':_0x4b988d[_0x190b('0x48')]['id']}})[_0x190b('0x22')](handleEntityNotFound(_0x40ac95,null))['then'](function(_0x23298e){var _0x2ba27b;if(_0x23298e){_0x2ba27b=squel['insert']()[_0x190b('0x78')]('cm_hopper')['fromQuery'](['phone','scheduledAt',_0x190b('0x62'),_0x190b('0x79'),'CampaignId',_0x190b('0x64'),_0x190b('0x65')],squel['select']()[_0x190b('0x66')](_0x190b('0x67'),_0x190b('0x60'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x61'))[_0x190b('0x66')](_0x190b('0x69'),_0x190b('0x62'))['field'](_0x190b('0x6a'),'ListId')['field'](_0x190b('0x7a'),_0x190b('0x7b'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x64'))[_0x190b('0x66')](_0x190b('0x68'),_0x190b('0x65'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x6f'),_0x4b988d[_0x190b('0x44')][_0x190b('0x70')][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x7d'))[_0x190b('0x3a')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x60'))['from'](_0x190b('0x5e'))[_0x190b('0x3a')]('CampaignId\x20=\x20?',_0x4b988d['params']['id'][_0x190b('0x71')]()))[_0x190b('0x3a')](_0x190b('0x72'),squel[_0x190b('0x73')]()[_0x190b('0x66')](_0x190b('0x74'))[_0x190b('0x6c')](_0x190b('0x6d'))[_0x190b('0x3a')](_0x190b('0x7c'),_0x4b988d['params']['id'][_0x190b('0x71')]())[_0x190b('0x3a')](_0x190b('0x75')))['group'](_0x190b('0x62')))[_0x190b('0x71')]();return db[_0x190b('0x49')][_0x190b('0x2d')](_0x2ba27b);}return[];})[_0x190b('0x22')](respondWithResult(_0x40ac95,null))[_0x190b('0x42')](handleError(_0x40ac95,null));};exports['checkContactHopper']=function(_0x476c86,_0x298824,_0x5e7c76){return db[_0x190b('0x7e')][_0x190b('0x7f')]({'where':{'VoiceQueueId':_0x476c86[_0x190b('0x44')][_0x190b('0x63')],'CampaignId':_0x476c86[_0x190b('0x44')][_0x190b('0x7b')],'ContactId':_0x476c86[_0x190b('0x44')][_0x190b('0x62')]}})['then'](handleEntityNotFound(_0x298824,null))[_0x190b('0x22')](function(_0x1b3168){if(_0x1b3168){return _0x1b3168;}return null;})[_0x190b('0x22')](respondWithResult(_0x298824,null))[_0x190b('0x42')](handleError(_0x298824,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../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','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0x5d17,0x114));var _0x75d1=function(_0x50faaa,_0x59d114){_0x50faaa=_0x50faaa-0x0;var _0x48300e=_0x5d17[_0x50faaa];return _0x48300e;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2438367..4e0e959 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 _0xa6c0=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid'];(function(_0x47b6ca,_0x325eb9){var _0x177fd7=function(_0x3d6705){while(--_0x3d6705){_0x47b6ca['push'](_0x47b6ca['shift']());}};_0x177fd7(++_0x325eb9);}(_0xa6c0,0xd2));var _0x0a6c=function(_0x271b22,_0x3a80ff){_0x271b22=_0x271b22-0x0;var _0x49a57c=_0xa6c0[_0x271b22];return _0x49a57c;};'use strict';var _=require(_0x0a6c('0x0'));var util=require(_0x0a6c('0x1'));var logger=require(_0x0a6c('0x2'))('api');var moment=require(_0x0a6c('0x3'));var BPromise=require(_0x0a6c('0x4'));var rp=require(_0x0a6c('0x5'));var fs=require('fs');var path=require(_0x0a6c('0x6'));var rimraf=require('rimraf');var config=require(_0x0a6c('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x0a6c('0x8')]=function(_0x7a010b,_0xc55d0e){return _0x7a010b[_0x0a6c('0x9')](_0x0a6c('0xa'),attributes,{'tableName':_0x0a6c('0xb'),'paranoid':![],'indexes':[{'name':_0x0a6c('0xc'),'fields':[_0x0a6c('0xc')]},{'name':'uniqueid','fields':[_0x0a6c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb472=['bluebird','path','rimraf','../../config/environment','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api'];(function(_0x35e7d2,_0x25747f){var _0x27cb14=function(_0x56947a){while(--_0x56947a){_0x35e7d2['push'](_0x35e7d2['shift']());}};_0x27cb14(++_0x25747f);}(_0xb472,0x19c));var _0x2b47=function(_0x2073f6,_0x211297){_0x2073f6=_0x2073f6-0x0;var _0x2859a3=_0xb472[_0x2073f6];return _0x2859a3;};'use strict';var _=require(_0x2b47('0x0'));var util=require(_0x2b47('0x1'));var logger=require(_0x2b47('0x2'))(_0x2b47('0x3'));var moment=require('moment');var BPromise=require(_0x2b47('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b47('0x5'));var rimraf=require(_0x2b47('0x6'));var config=require(_0x2b47('0x7'));var attributes=require('./cmHopperFinal.attributes');module['exports']=function(_0xe4b98,_0x31c219){return _0xe4b98[_0x2b47('0x8')](_0x2b47('0x9'),attributes,{'tableName':_0x2b47('0xa'),'paranoid':![],'indexes':[{'name':_0x2b47('0xb'),'fields':[_0x2b47('0xb')]},{'name':_0x2b47('0xc'),'fields':[_0x2b47('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 99cc176..e2340a7 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(_0x3498d2,_0x26d831){var _0x4c3375=function(_0x428384){while(--_0x428384){_0x3498d2['push'](_0x3498d2['shift']());}};_0x4c3375(++_0x26d831);}(_0xb10b,0x12a));var _0xbb10=function(_0x30fe8c,_0x272cb9){_0x30fe8c=_0x30fe8c-0x0;var _0x4f1068=_0xb10b[_0x30fe8c];return _0x4f1068;};'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(_0x47cc4b,_0x3fe9ab){var _0x142bc8=function(_0x63c207){while(--_0x63c207){_0x47cc4b['push'](_0x47cc4b['shift']());}};_0x142bc8(++_0x3fe9ab);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e16e9,_0x1ce58e){_0x4e16e9=_0x4e16e9-0x0;var _0x4f9971=_0xb10b[_0x4e16e9];return _0x4f9971;};'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 f07373c..1d751bd 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 _0x2209=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','checkContactHopper','put','update'];(function(_0x5191a7,_0x43790a){var _0x4d03a5=function(_0x1c24d7){while(--_0x1c24d7){_0x5191a7['push'](_0x5191a7['shift']());}};_0x4d03a5(++_0x43790a);}(_0x2209,0x1b0));var _0x9220=function(_0x305921,_0x26cc2f){_0x305921=_0x305921-0x0;var _0x12d9ba=_0x2209[_0x305921];return _0x12d9ba;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x9220('0x0'));var express=require('express');var router=express[_0x9220('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9220('0x2'));var interaction=require(_0x9220('0x3'));var config=require(_0x9220('0x4'));var controller=require(_0x9220('0x5'));router['get']('/',auth[_0x9220('0x6')](),controller[_0x9220('0x7')]);router['get'](_0x9220('0x8'),auth[_0x9220('0x6')](),controller[_0x9220('0x9')]);router[_0x9220('0xa')](_0x9220('0xb'),auth['isAuthenticated'](),controller[_0x9220('0xc')]);router[_0x9220('0xa')](_0x9220('0xd'),auth[_0x9220('0x6')](),controller[_0x9220('0xe')]);router[_0x9220('0xa')](_0x9220('0xf'),auth['isAuthenticated'](),controller[_0x9220('0x10')]);router[_0x9220('0x11')](_0x9220('0x12'),auth[_0x9220('0x6')](),controller[_0x9220('0x13')]);router[_0x9220('0x11')](_0x9220('0x14'),auth[_0x9220('0x6')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x9220('0x11')]('/checkContactHopper',auth[_0x9220('0x6')](),controller[_0x9220('0x15')]);router[_0x9220('0x16')](_0x9220('0xb'),auth[_0x9220('0x6')](),controller[_0x9220('0x17')]);module['exports']=router; \ No newline at end of file +var _0xccef=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','put','update','exports'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xccef,0x1d4));var _0xfcce=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xccef[_0x21a9d9];return _0x46adce;};'use strict';var multer=require('multer');var util=require(_0xfcce('0x0'));var path=require('path');var timeout=require(_0xfcce('0x1'));var express=require(_0xfcce('0x2'));var router=express[_0xfcce('0x3')]();var fs_extra=require(_0xfcce('0x4'));var auth=require(_0xfcce('0x5'));var interaction=require(_0xfcce('0x6'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0xfcce('0x7')]('/',auth['isAuthenticated'](),controller[_0xfcce('0x8')]);router[_0xfcce('0x7')](_0xfcce('0x9'),auth[_0xfcce('0xa')](),controller[_0xfcce('0xb')]);router[_0xfcce('0x7')](_0xfcce('0xc'),auth['isAuthenticated'](),controller[_0xfcce('0xd')]);router[_0xfcce('0x7')](_0xfcce('0xe'),auth[_0xfcce('0xa')](),controller[_0xfcce('0xf')]);router[_0xfcce('0x7')](_0xfcce('0x10'),auth[_0xfcce('0xa')](),controller[_0xfcce('0x11')]);router[_0xfcce('0x12')](_0xfcce('0x13'),auth['isAuthenticated'](),controller[_0xfcce('0x14')]);router[_0xfcce('0x12')](_0xfcce('0x15'),auth[_0xfcce('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xfcce('0x12')](_0xfcce('0x16'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0xfcce('0x17')](_0xfcce('0xc'),auth[_0xfcce('0xa')](),controller[_0xfcce('0x18')]);module[_0xfcce('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 3ebf2d8..c44b94a 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 _0xf39f=['DATE','BOOLEAN','INTEGER','STRING'];(function(_0x2ceb31,_0x40ecf1){var _0x168859=function(_0x3de469){while(--_0x3de469){_0x2ceb31['push'](_0x2ceb31['shift']());}};_0x168859(++_0x40ecf1);}(_0xf39f,0x126));var _0xff39=function(_0x136933,_0x405515){_0x136933=_0x136933-0x0;var _0x14f6a3=_0xf39f[_0x136933];return _0x14f6a3;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xff39('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xff39('0x1')]},'scheduledat':{'type':Sequelize[_0xff39('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xff39('0x1')]},'originatecalleridname':{'type':Sequelize[_0xff39('0x1')]},'calleridnum':{'type':Sequelize[_0xff39('0x1')]},'calleridname':{'type':Sequelize[_0xff39('0x1')]},'starttime':{'type':Sequelize[_0xff39('0x2')]},'responsetime':{'type':Sequelize[_0xff39('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xff39('0x2')]},'endtime':{'type':Sequelize[_0xff39('0x2')]},'ringtime':{'type':Sequelize[_0xff39('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xff39('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xff39('0x1')]},'campaign':{'type':Sequelize[_0xff39('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xff39('0x1')]},'reason':{'type':Sequelize[_0xff39('0x1')]},'amd':{'type':Sequelize[_0xff39('0x3')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xff39('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xff39('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xff39('0x2')]},'recallme':{'type':Sequelize[_0xff39('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xff39('0x2')]},'edited':{'type':Sequelize[_0xff39('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xff39('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xff39('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfbc3=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x4745b4,_0x206184){var _0x27b179=function(_0x45328c){while(--_0x45328c){_0x4745b4['push'](_0x4745b4['shift']());}};_0x27b179(++_0x206184);}(_0xfbc3,0x1a1));var _0x3fbc=function(_0x19ddbb,_0x1b7892){_0x19ddbb=_0x19ddbb-0x0;var _0x4cfb96=_0xfbc3[_0x19ddbb];return _0x4cfb96;};'use strict';var Sequelize=require(_0x3fbc('0x0'));module[_0x3fbc('0x1')]={'state':{'type':Sequelize[_0x3fbc('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x3fbc('0x3')]},'scheduledat':{'type':Sequelize[_0x3fbc('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x3fbc('0x3')]},'calleridnum':{'type':Sequelize[_0x3fbc('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3fbc('0x4')]},'answertime':{'type':Sequelize[_0x3fbc('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3fbc('0x4')]},'ringtime':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3fbc('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3fbc('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3fbc('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x3fbc('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3fbc('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3fbc('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x3fbc('0x4')]},'edited':{'type':Sequelize[_0x3fbc('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3fbc('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2a5a6a1..877aac2 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 _0x4b0d=['send','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','show','params','include','find','catch','create','body','describe','uniqueid','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','apply','reject','save','update','then','destroy','error','name'];(function(_0x3f537b,_0x1431b7){var _0x23ae6d=function(_0x517639){while(--_0x517639){_0x3f537b['push'](_0x3f537b['shift']());}};_0x23ae6d(++_0x1431b7);}(_0x4b0d,0xf3));var _0xd4b0=function(_0x223a7c,_0x11ebdc){_0x223a7c=_0x223a7c-0x0;var _0x22e78a=_0x4b0d[_0x223a7c];return _0x22e78a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd4b0('0x0'));var jsonpatch=require(_0xd4b0('0x1'));var rp=require(_0xd4b0('0x2'));var moment=require(_0xd4b0('0x3'));var BPromise=require(_0xd4b0('0x4'));var Mustache=require('mustache');var util=require(_0xd4b0('0x5'));var path=require('path');var sox=require(_0xd4b0('0x6'));var csv=require(_0xd4b0('0x7'));var ejs=require(_0xd4b0('0x8'));var fs=require('fs');var fs_extra=require(_0xd4b0('0x9'));var _=require('lodash');var squel=require(_0xd4b0('0xa'));var crypto=require(_0xd4b0('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd4b0('0xc'));var toCsv=require(_0xd4b0('0x7'));var querystring=require('querystring');var Papa=require(_0xd4b0('0xd'));var Redis=require(_0xd4b0('0xe'));var authService=require(_0xd4b0('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd4b0('0x10'));var logger=require(_0xd4b0('0x11'))(_0xd4b0('0x12'));var utils=require(_0xd4b0('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5bcc21,_0x3eeb92){_0x3eeb92=_0x3eeb92||0xcc;return function(_0x48df37){if(_0x48df37){return _0x5bcc21[_0xd4b0('0x14')](_0x3eeb92);}return _0x5bcc21['status'](_0x3eeb92)[_0xd4b0('0x15')]();};}function respondWithResult(_0x4b6e07,_0x592759){_0x592759=_0x592759||0xc8;return function(_0x4a6b0c){if(_0x4a6b0c){return _0x4b6e07[_0xd4b0('0x16')](_0x592759)[_0xd4b0('0x17')](_0x4a6b0c);}};}function respondWithFilteredResult(_0x4969fa,_0x16b349){return function(_0x57eebf){if(_0x57eebf){var _0x57a230=typeof _0x16b349[_0xd4b0('0x18')]==='undefined'&&typeof _0x16b349[_0xd4b0('0x19')]===_0xd4b0('0x1a');var _0x303af7=_0x57eebf['count'];var _0x41c163=_0x57a230?0x0:_0x16b349['offset'];var _0x2dfbbb=_0x57a230?_0x57eebf['count']:_0x16b349['offset']+_0x16b349[_0xd4b0('0x19')];var _0x35ce51;if(_0x2dfbbb>=_0x303af7){_0x2dfbbb=_0x303af7;_0x35ce51=0xc8;}else{_0x35ce51=0xce;}_0x4969fa['status'](_0x35ce51);return _0x4969fa[_0xd4b0('0x1b')](_0xd4b0('0x1c'),_0x41c163+'-'+_0x2dfbbb+'/'+_0x303af7)[_0xd4b0('0x17')](_0x57eebf);}return null;};}function patchUpdates(_0x153f59){return function(_0x46c724){try{jsonpatch[_0xd4b0('0x1d')](_0x46c724,_0x153f59,!![]);}catch(_0x2bcc55){return BPromise[_0xd4b0('0x1e')](_0x2bcc55);}return _0x46c724[_0xd4b0('0x1f')]();};}function saveUpdates(_0x615a13,_0x32681b){return function(_0x358c69){if(_0x358c69){return _0x358c69[_0xd4b0('0x20')](_0x615a13)[_0xd4b0('0x21')](function(_0x399ae4){return _0x399ae4;});}return null;};}function removeEntity(_0x2d4ecd,_0x21d61e){return function(_0x42ca61){if(_0x42ca61){return _0x42ca61[_0xd4b0('0x22')]()[_0xd4b0('0x21')](function(){_0x2d4ecd[_0xd4b0('0x16')](0xcc)[_0xd4b0('0x15')]();});}};}function handleEntityNotFound(_0x1a3ded,_0x12588b){return function(_0x3d377d){if(!_0x3d377d){_0x1a3ded['sendStatus'](0x194);}return _0x3d377d;};}function handleError(_0x31159c,_0x376b41){_0x376b41=_0x376b41||0x1f4;return function(_0x40d690){logger[_0xd4b0('0x23')](_0x40d690['stack']);if(_0x40d690['name']){delete _0x40d690[_0xd4b0('0x24')];}_0x31159c[_0xd4b0('0x16')](_0x376b41)[_0xd4b0('0x25')](_0x40d690);};}exports['index']=function(_0x509b0c,_0x3ef5a7){var _0x2d241f={},_0x212435={},_0x274c8f={'count':0x0,'rows':[]};var _0x50fada=_[_0xd4b0('0x26')](db[_0xd4b0('0x27')][_0xd4b0('0x28')],function(_0x7e38a3){return{'name':_0x7e38a3[_0xd4b0('0x29')],'type':_0x7e38a3['type'][_0xd4b0('0x2a')]};});_0x212435[_0xd4b0('0x2b')]=_[_0xd4b0('0x26')](_0x50fada,_0xd4b0('0x24'));_0x212435[_0xd4b0('0x2c')]=_[_0xd4b0('0x2d')](_0x509b0c[_0xd4b0('0x2c')]);_0x212435[_0xd4b0('0x2e')]=_[_0xd4b0('0x2f')](_0x212435[_0xd4b0('0x2b')],_0x212435[_0xd4b0('0x2c')]);_0x2d241f[_0xd4b0('0x30')]=_[_0xd4b0('0x2f')](_0x212435[_0xd4b0('0x2b')],qs[_0xd4b0('0x31')](_0x509b0c[_0xd4b0('0x2c')][_0xd4b0('0x31')]));_0x2d241f['attributes']=_0x2d241f[_0xd4b0('0x30')][_0xd4b0('0x32')]?_0x2d241f[_0xd4b0('0x30')]:_0x212435[_0xd4b0('0x2b')];if(!_0x509b0c[_0xd4b0('0x2c')][_0xd4b0('0x33')]('nolimit')){_0x2d241f[_0xd4b0('0x19')]=qs[_0xd4b0('0x19')](_0x509b0c[_0xd4b0('0x2c')][_0xd4b0('0x19')]);_0x2d241f[_0xd4b0('0x18')]=qs[_0xd4b0('0x18')](_0x509b0c[_0xd4b0('0x2c')][_0xd4b0('0x18')]);}_0x2d241f['order']=qs[_0xd4b0('0x34')](_0x509b0c[_0xd4b0('0x2c')][_0xd4b0('0x34')]);_0x2d241f['where']=qs[_0xd4b0('0x2e')](_[_0xd4b0('0x35')](_0x509b0c[_0xd4b0('0x2c')],_0x212435['filters']),_0x50fada);if(_0x509b0c[_0xd4b0('0x2c')][_0xd4b0('0x36')]){_0x2d241f[_0xd4b0('0x37')]=_['merge'](_0x2d241f[_0xd4b0('0x37')],{'$or':_[_0xd4b0('0x26')](_0x50fada,function(_0x154003){if(_0x154003['type']!==_0xd4b0('0x38')){var _0x3a13df={};_0x3a13df[_0x154003['name']]={'$like':'%'+_0x509b0c[_0xd4b0('0x2c')]['filter']+'%'};return _0x3a13df;}})});}_0x2d241f=_[_0xd4b0('0x39')]({},_0x2d241f,_0x509b0c[_0xd4b0('0x3a')]);var _0x3a50a8={'where':_0x2d241f[_0xd4b0('0x37')]};return db[_0xd4b0('0x27')][_0xd4b0('0x3b')](_0x3a50a8)[_0xd4b0('0x21')](function(_0x2cad28){_0x274c8f[_0xd4b0('0x3b')]=_0x2cad28;if(_0x509b0c[_0xd4b0('0x2c')][_0xd4b0('0x3c')]){_0x2d241f['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x2d241f);})[_0xd4b0('0x21')](function(_0x15bf11){_0x274c8f['rows']=_0x15bf11;return _0x274c8f;})[_0xd4b0('0x21')](respondWithFilteredResult(_0x3ef5a7,_0x2d241f))['catch'](handleError(_0x3ef5a7,null));};exports[_0xd4b0('0x3d')]=function(_0x4f6cc1,_0x15ec26){var _0x58564a={'raw':!![],'where':{'id':_0x4f6cc1[_0xd4b0('0x3e')]['id']}},_0x4a91f6={};_0x4a91f6[_0xd4b0('0x2b')]=_[_0xd4b0('0x2d')](db[_0xd4b0('0x27')][_0xd4b0('0x28')]);_0x4a91f6[_0xd4b0('0x2c')]=_[_0xd4b0('0x2d')](_0x4f6cc1[_0xd4b0('0x2c')]);_0x4a91f6[_0xd4b0('0x2e')]=_['intersection'](_0x4a91f6[_0xd4b0('0x2b')],_0x4a91f6[_0xd4b0('0x2c')]);_0x58564a[_0xd4b0('0x30')]=_[_0xd4b0('0x2f')](_0x4a91f6[_0xd4b0('0x2b')],qs[_0xd4b0('0x31')](_0x4f6cc1[_0xd4b0('0x2c')][_0xd4b0('0x31')]));_0x58564a['attributes']=_0x58564a[_0xd4b0('0x30')][_0xd4b0('0x32')]?_0x58564a['attributes']:_0x4a91f6[_0xd4b0('0x2b')];if(_0x4f6cc1[_0xd4b0('0x2c')][_0xd4b0('0x3c')]){_0x58564a[_0xd4b0('0x3f')]=[{'all':!![]}];}_0x58564a=_['merge']({},_0x58564a,_0x4f6cc1[_0xd4b0('0x3a')]);return db[_0xd4b0('0x27')][_0xd4b0('0x40')](_0x58564a)['then'](handleEntityNotFound(_0x15ec26,null))['then'](respondWithResult(_0x15ec26,null))[_0xd4b0('0x41')](handleError(_0x15ec26,null));};exports[_0xd4b0('0x42')]=function(_0x28f521,_0x3d7e9e){return db[_0xd4b0('0x27')][_0xd4b0('0x42')](_0x28f521[_0xd4b0('0x43')],{})['then'](respondWithResult(_0x3d7e9e,0xc9))[_0xd4b0('0x41')](handleError(_0x3d7e9e,null));};exports[_0xd4b0('0x44')]=function(_0x5167b6,_0x5357a8){return db['CmHopperHistory']['describe']()[_0xd4b0('0x21')](respondWithResult(_0x5357a8,null))[_0xd4b0('0x41')](handleError(_0x5357a8,null));};exports[_0xd4b0('0x20')]=function(_0x2100ef,_0xde0cd3){if(_0x2100ef[_0xd4b0('0x43')][_0xd4b0('0x45')]){delete _0x2100ef[_0xd4b0('0x43')][_0xd4b0('0x45')];}return db[_0xd4b0('0x27')][_0xd4b0('0x40')]({'where':{'uniqueid':_0x2100ef[_0xd4b0('0x3e')]['id']}})[_0xd4b0('0x21')](handleEntityNotFound(_0xde0cd3,null))[_0xd4b0('0x21')](saveUpdates(_0x2100ef['body'],null))[_0xd4b0('0x21')](respondWithResult(_0xde0cd3,null))[_0xd4b0('0x41')](handleError(_0xde0cd3,null));}; \ No newline at end of file +var _0xdb4c=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','status','end','offset','undefined','limit','count','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','CmHopperHistory','fieldName','type','key','model','map','query','keys'];(function(_0x39609c,_0x50aea){var _0xff6513=function(_0x18cc38){while(--_0x18cc38){_0x39609c['push'](_0x39609c['shift']());}};_0xff6513(++_0x50aea);}(_0xdb4c,0xfc));var _0xcdb4=function(_0x3d8d8a,_0xb5e907){_0x3d8d8a=_0x3d8d8a-0x0;var _0x431d37=_0xdb4c[_0x3d8d8a];return _0x431d37;};'use strict';var emlformat=require(_0xcdb4('0x0'));var rimraf=require(_0xcdb4('0x1'));var zipdir=require(_0xcdb4('0x2'));var jsonpatch=require(_0xcdb4('0x3'));var rp=require('request-promise');var moment=require(_0xcdb4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcdb4('0x5'));var util=require(_0xcdb4('0x6'));var path=require('path');var sox=require(_0xcdb4('0x7'));var csv=require('to-csv');var ejs=require(_0xcdb4('0x8'));var fs=require('fs');var fs_extra=require(_0xcdb4('0x9'));var _=require(_0xcdb4('0xa'));var squel=require(_0xcdb4('0xb'));var crypto=require(_0xcdb4('0xc'));var jsforce=require(_0xcdb4('0xd'));var deskjs=require(_0xcdb4('0xe'));var toCsv=require(_0xcdb4('0xf'));var querystring=require(_0xcdb4('0x10'));var Papa=require(_0xcdb4('0x11'));var Redis=require(_0xcdb4('0x12'));var authService=require(_0xcdb4('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcdb4('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcdb4('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcdb4('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3443eb,_0x2c5cc2){_0x2c5cc2=_0x2c5cc2||0xcc;return function(_0x4d4fad){if(_0x4d4fad){return _0x3443eb['sendStatus'](_0x2c5cc2);}return _0x3443eb[_0xcdb4('0x17')](_0x2c5cc2)[_0xcdb4('0x18')]();};}function respondWithResult(_0x2102f9,_0x107815){_0x107815=_0x107815||0xc8;return function(_0x426a40){if(_0x426a40){return _0x2102f9[_0xcdb4('0x17')](_0x107815)['json'](_0x426a40);}};}function respondWithFilteredResult(_0x25284a,_0x56233d){return function(_0x2e301c){if(_0x2e301c){var _0x26cd09=typeof _0x56233d[_0xcdb4('0x19')]===_0xcdb4('0x1a')&&typeof _0x56233d[_0xcdb4('0x1b')]===_0xcdb4('0x1a');var _0x485575=_0x2e301c[_0xcdb4('0x1c')];var _0x4edfd9=_0x26cd09?0x0:_0x56233d['offset'];var _0x369067=_0x26cd09?_0x2e301c[_0xcdb4('0x1c')]:_0x56233d[_0xcdb4('0x19')]+_0x56233d[_0xcdb4('0x1b')];var _0x5ef213;if(_0x369067>=_0x485575){_0x369067=_0x485575;_0x5ef213=0xc8;}else{_0x5ef213=0xce;}_0x25284a[_0xcdb4('0x17')](_0x5ef213);return _0x25284a['set']('Content-Range',_0x4edfd9+'-'+_0x369067+'/'+_0x485575)[_0xcdb4('0x1d')](_0x2e301c);}return null;};}function patchUpdates(_0x22899c){return function(_0x593de4){try{jsonpatch[_0xcdb4('0x1e')](_0x593de4,_0x22899c,!![]);}catch(_0x13fd1c){return BPromise[_0xcdb4('0x1f')](_0x13fd1c);}return _0x593de4[_0xcdb4('0x20')]();};}function saveUpdates(_0x3cac19,_0x3d8200){return function(_0x1bab32){if(_0x1bab32){return _0x1bab32['update'](_0x3cac19)[_0xcdb4('0x21')](function(_0x11d123){return _0x11d123;});}return null;};}function removeEntity(_0x1bc2b5,_0x46c1e0){return function(_0x536a62){if(_0x536a62){return _0x536a62[_0xcdb4('0x22')]()['then'](function(){_0x1bc2b5[_0xcdb4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x592fb7,_0x48e32c){return function(_0x2a3bc5){if(!_0x2a3bc5){_0x592fb7[_0xcdb4('0x23')](0x194);}return _0x2a3bc5;};}function handleError(_0x4d5b7b,_0x4a168d){_0x4a168d=_0x4a168d||0x1f4;return function(_0x2b5c53){logger[_0xcdb4('0x24')](_0x2b5c53[_0xcdb4('0x25')]);if(_0x2b5c53[_0xcdb4('0x26')]){delete _0x2b5c53['name'];}_0x4d5b7b[_0xcdb4('0x17')](_0x4a168d)[_0xcdb4('0x27')](_0x2b5c53);};}exports['index']=function(_0x2534de,_0x290508){var _0x305ff3={},_0x12bdb2={},_0x18f74a={'count':0x0,'rows':[]};var _0x150cfe=_['map'](db[_0xcdb4('0x28')]['rawAttributes'],function(_0x49421b){return{'name':_0x49421b[_0xcdb4('0x29')],'type':_0x49421b[_0xcdb4('0x2a')][_0xcdb4('0x2b')]};});_0x12bdb2[_0xcdb4('0x2c')]=_[_0xcdb4('0x2d')](_0x150cfe,_0xcdb4('0x26'));_0x12bdb2[_0xcdb4('0x2e')]=_[_0xcdb4('0x2f')](_0x2534de['query']);_0x12bdb2[_0xcdb4('0x30')]=_[_0xcdb4('0x31')](_0x12bdb2[_0xcdb4('0x2c')],_0x12bdb2[_0xcdb4('0x2e')]);_0x305ff3[_0xcdb4('0x32')]=_[_0xcdb4('0x31')](_0x12bdb2['model'],qs[_0xcdb4('0x33')](_0x2534de['query'][_0xcdb4('0x33')]));_0x305ff3['attributes']=_0x305ff3[_0xcdb4('0x32')][_0xcdb4('0x34')]?_0x305ff3[_0xcdb4('0x32')]:_0x12bdb2['model'];if(!_0x2534de[_0xcdb4('0x2e')][_0xcdb4('0x35')](_0xcdb4('0x36'))){_0x305ff3[_0xcdb4('0x1b')]=qs['limit'](_0x2534de[_0xcdb4('0x2e')][_0xcdb4('0x1b')]);_0x305ff3[_0xcdb4('0x19')]=qs[_0xcdb4('0x19')](_0x2534de[_0xcdb4('0x2e')][_0xcdb4('0x19')]);}_0x305ff3[_0xcdb4('0x37')]=qs['sort'](_0x2534de['query'][_0xcdb4('0x38')]);_0x305ff3[_0xcdb4('0x39')]=qs[_0xcdb4('0x30')](_[_0xcdb4('0x3a')](_0x2534de['query'],_0x12bdb2['filters']),_0x150cfe);if(_0x2534de[_0xcdb4('0x2e')][_0xcdb4('0x3b')]){_0x305ff3[_0xcdb4('0x39')]=_[_0xcdb4('0x3c')](_0x305ff3[_0xcdb4('0x39')],{'$or':_['map'](_0x150cfe,function(_0x4a4689){if(_0x4a4689[_0xcdb4('0x2a')]!==_0xcdb4('0x3d')){var _0x28531c={};_0x28531c[_0x4a4689[_0xcdb4('0x26')]]={'$like':'%'+_0x2534de[_0xcdb4('0x2e')]['filter']+'%'};return _0x28531c;}})});}_0x305ff3=_[_0xcdb4('0x3c')]({},_0x305ff3,_0x2534de[_0xcdb4('0x3e')]);var _0xbf7a97={'where':_0x305ff3['where']};return db[_0xcdb4('0x28')]['count'](_0xbf7a97)[_0xcdb4('0x21')](function(_0x3d0b7c){_0x18f74a[_0xcdb4('0x1c')]=_0x3d0b7c;if(_0x2534de[_0xcdb4('0x2e')][_0xcdb4('0x3f')]){_0x305ff3[_0xcdb4('0x40')]=[{'all':!![]}];}return db[_0xcdb4('0x28')][_0xcdb4('0x41')](_0x305ff3);})[_0xcdb4('0x21')](function(_0x1510e8){_0x18f74a['rows']=_0x1510e8;return _0x18f74a;})[_0xcdb4('0x21')](respondWithFilteredResult(_0x290508,_0x305ff3))[_0xcdb4('0x42')](handleError(_0x290508,null));};exports['show']=function(_0x672924,_0x212f09){var _0x3ff645={'raw':!![],'where':{'id':_0x672924[_0xcdb4('0x43')]['id']}},_0x312012={};_0x312012[_0xcdb4('0x2c')]=_['keys'](db['CmHopperHistory'][_0xcdb4('0x44')]);_0x312012[_0xcdb4('0x2e')]=_[_0xcdb4('0x2f')](_0x672924[_0xcdb4('0x2e')]);_0x312012[_0xcdb4('0x30')]=_[_0xcdb4('0x31')](_0x312012[_0xcdb4('0x2c')],_0x312012[_0xcdb4('0x2e')]);_0x3ff645['attributes']=_[_0xcdb4('0x31')](_0x312012['model'],qs[_0xcdb4('0x33')](_0x672924[_0xcdb4('0x2e')]['fields']));_0x3ff645['attributes']=_0x3ff645[_0xcdb4('0x32')][_0xcdb4('0x34')]?_0x3ff645['attributes']:_0x312012[_0xcdb4('0x2c')];if(_0x672924[_0xcdb4('0x2e')]['includeAll']){_0x3ff645[_0xcdb4('0x40')]=[{'all':!![]}];}_0x3ff645=_['merge']({},_0x3ff645,_0x672924['options']);return db['CmHopperHistory'][_0xcdb4('0x45')](_0x3ff645)[_0xcdb4('0x21')](handleEntityNotFound(_0x212f09,null))['then'](respondWithResult(_0x212f09,null))[_0xcdb4('0x42')](handleError(_0x212f09,null));};exports[_0xcdb4('0x46')]=function(_0x448b7e,_0x289627){return db[_0xcdb4('0x28')]['create'](_0x448b7e[_0xcdb4('0x47')],{})[_0xcdb4('0x21')](respondWithResult(_0x289627,0xc9))[_0xcdb4('0x42')](handleError(_0x289627,null));};exports[_0xcdb4('0x48')]=function(_0x2c7e9a,_0x4e68ed){return db[_0xcdb4('0x28')][_0xcdb4('0x48')]()[_0xcdb4('0x21')](respondWithResult(_0x4e68ed,null))[_0xcdb4('0x42')](handleError(_0x4e68ed,null));};exports[_0xcdb4('0x49')]=function(_0x522f7e,_0x5d60c7){if(_0x522f7e[_0xcdb4('0x47')][_0xcdb4('0x4a')]){delete _0x522f7e[_0xcdb4('0x47')][_0xcdb4('0x4a')];}return db[_0xcdb4('0x28')][_0xcdb4('0x45')]({'where':{'uniqueid':_0x522f7e[_0xcdb4('0x43')]['id']}})[_0xcdb4('0x21')](handleEntityNotFound(_0x5d60c7,null))[_0xcdb4('0x21')](saveUpdates(_0x522f7e[_0xcdb4('0x47')],null))[_0xcdb4('0x21')](respondWithResult(_0x5d60c7,null))[_0xcdb4('0x42')](handleError(_0x5d60c7,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c92a961..1b48b19 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 _0x18b2=['api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x18b2,0x85));var _0x218b=function(_0x3ef3ee,_0x4e6221){_0x3ef3ee=_0x3ef3ee-0x0;var _0x2c587d=_0x18b2[_0x3ef3ee];return _0x2c587d;};'use strict';var _=require('lodash');var util=require(_0x218b('0x0'));var logger=require(_0x218b('0x1'))(_0x218b('0x2'));var moment=require('moment');var BPromise=require(_0x218b('0x3'));var rp=require(_0x218b('0x4'));var fs=require('fs');var path=require(_0x218b('0x5'));var rimraf=require(_0x218b('0x6'));var config=require(_0x218b('0x7'));var attributes=require(_0x218b('0x8'));module[_0x218b('0x9')]=function(_0x3a9261,_0x1c2c17){return _0x3a9261[_0x218b('0xa')](_0x218b('0xb'),attributes,{'tableName':_0x218b('0xc'),'paranoid':![],'indexes':[{'name':_0x218b('0xd'),'fields':[_0x218b('0xd')]},{'name':_0x218b('0xe'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x042a=['moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x042a,0x1d9));var _0xa042=function(_0x54b72e,_0x329cb6){_0x54b72e=_0x54b72e-0x0;var _0x39a289=_0x042a[_0x54b72e];return _0x39a289;};'use strict';var _=require(_0xa042('0x0'));var util=require('util');var logger=require(_0xa042('0x1'))(_0xa042('0x2'));var moment=require(_0xa042('0x3'));var BPromise=require('bluebird');var rp=require(_0xa042('0x4'));var fs=require('fs');var path=require(_0xa042('0x5'));var rimraf=require(_0xa042('0x6'));var config=require(_0xa042('0x7'));var attributes=require(_0xa042('0x8'));module[_0xa042('0x9')]=function(_0x622ece,_0xc35608){return _0x622ece['define'](_0xa042('0xa'),attributes,{'tableName':_0xa042('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xa042('0xc')]},{'name':'uniqueid','fields':[_0xa042('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 596e30b..01ff915 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 _0x3e1d=['raw','debug','AvgHandleTime','findAll','sequelize','COUNT','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','literal','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x3e1d,0xad));var _0xd3e1=function(_0x276015,_0x57eb3d){_0x276015=_0x276015-0x0;var _0x385345=_0x3e1d[_0x276015];return _0x385345;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd3e1('0x0'));var BPromise=require(_0xd3e1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd3e1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xd3e1('0x3'));var logger=require(_0xd3e1('0x4'))(_0xd3e1('0x5'));var config=require('../../config/environment');var jayson=require(_0xd3e1('0x6'));var client=jayson[_0xd3e1('0x7')][_0xd3e1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x40dab3,_0x1d7951,_0x35af20){return new BPromise(function(_0x217f96,_0x2a7a7a){return client[_0xd3e1('0x9')](_0x40dab3,_0x35af20)[_0xd3e1('0xa')](function(_0x1ef91b){logger[_0xd3e1('0xb')](_0xd3e1('0xc'),_0x1d7951,_0xd3e1('0xd'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1d7951,_0xd3e1('0xd'),JSON[_0xd3e1('0xe')](_0x1ef91b));if(_0x1ef91b[_0xd3e1('0xf')]){if(_0x1ef91b[_0xd3e1('0xf')][_0xd3e1('0x10')]===0x1f4){logger[_0xd3e1('0xf')]('CmHopperHistory,\x20%s,\x20%s',_0x1d7951,_0x1ef91b['error'][_0xd3e1('0x11')]);return _0x2a7a7a(_0x1ef91b['error'][_0xd3e1('0x11')]);}logger[_0xd3e1('0xf')](_0xd3e1('0xc'),_0x1d7951,_0x1ef91b[_0xd3e1('0xf')][_0xd3e1('0x11')]);return _0x217f96(_0x1ef91b[_0xd3e1('0xf')][_0xd3e1('0x11')]);}else{logger[_0xd3e1('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x1d7951,_0xd3e1('0xd'));_0x217f96(_0x1ef91b[_0xd3e1('0x12')]['message']);}})[_0xd3e1('0x13')](function(_0x5c276e){logger[_0xd3e1('0xf')](_0xd3e1('0xc'),_0x1d7951,_0x5c276e);_0x2a7a7a(_0x5c276e);});});}exports[_0xd3e1('0x14')]=function(_0x348e41){var _0x5e50eb=this;return new Promise(function(_0x4f2710,_0x1f3fad){return db[_0xd3e1('0x15')][_0xd3e1('0x16')](_0x348e41[_0xd3e1('0x17')],{'raw':_0x348e41[_0xd3e1('0x18')]?_0x348e41['options'][_0xd3e1('0x19')]===undefined?!![]:![]:!![]})[_0xd3e1('0xa')](function(_0x2cf294){logger['info'](_0xd3e1('0x14'),_0x348e41);logger[_0xd3e1('0x1a')](_0xd3e1('0x14'),_0x348e41,JSON['stringify'](_0x2cf294));_0x4f2710(_0x2cf294);})[_0xd3e1('0x13')](function(_0x49d02a){logger['error'](_0xd3e1('0x14'),_0x49d02a['message'],_0x348e41);_0x1f3fad(_0x5e50eb['error'](0x1f4,_0x49d02a['message']));});});};exports[_0xd3e1('0x1b')]=function(_0x3cdce1){var _0x17d24b=this;return new Promise(function(_0x467894,_0x3229b5){return db[_0xd3e1('0x15')][_0xd3e1('0x1c')]({'raw':_0x3cdce1[_0xd3e1('0x18')]?_0x3cdce1[_0xd3e1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3cdce1[_0xd3e1('0x18')]?_0x3cdce1['options']['where']||null:null,'attributes':[[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db['sequelize']['col']('id')),_0xd3e1('0x1f')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db['sequelize']['fn']('IF',db[_0xd3e1('0x1d')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0xd3e1('0x20')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db['sequelize']['fn']('IF',db[_0xd3e1('0x1d')]['literal'](_0xd3e1('0x21')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db[_0xd3e1('0x1d')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xd3e1('0x22')],[db[_0xd3e1('0x1d')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0xd3e1('0x1d')][_0xd3e1('0x23')](_0xd3e1('0x24')))),_0xd3e1('0x25')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x26'),db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize'][_0xd3e1('0x23')](_0xd3e1('0x27')))),_0xd3e1('0x28')]]})[_0xd3e1('0xa')](function(_0x3d3dd9){logger['info']('AvgHandleTime',_0x3cdce1);logger[_0xd3e1('0x1a')](_0xd3e1('0x1b'),_0x3cdce1,JSON[_0xd3e1('0xe')](_0x3d3dd9));_0x467894(_0x3d3dd9);})[_0xd3e1('0x13')](function(_0x5174da){logger[_0xd3e1('0xf')](_0xd3e1('0x1b'),_0x5174da['message'],_0x3cdce1);_0x3229b5(_0x17d24b['error'](0x1f4,_0x5174da[_0xd3e1('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x9e7dee){var _0x5248bb=this;return new Promise(function(_0x402a05,_0x5cd963){return db[_0xd3e1('0x15')][_0xd3e1('0x1c')]({'raw':_0x9e7dee[_0xd3e1('0x18')]?_0x9e7dee[_0xd3e1('0x18')][_0xd3e1('0x19')]===undefined?!![]:![]:!![],'where':_0x9e7dee['options']?_0x9e7dee['options'][_0xd3e1('0x29')]||null:null,'attributes':[[_0xd3e1('0x2a'),_0xd3e1('0x2b')],[db[_0xd3e1('0x1d')]['fn']('COUNT',db[_0xd3e1('0x1d')]['fn']('IF',db[_0xd3e1('0x1d')]['literal'](_0xd3e1('0x2c')))),_0xd3e1('0x2d')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd3e1('0x1d')][_0xd3e1('0x23')](_0xd3e1('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db[_0xd3e1('0x1d')]['literal'](_0xd3e1('0x2f')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),'outboundBusyCallsDay'],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xd3e1('0x30')))),_0xd3e1('0x31')],[db[_0xd3e1('0x1d')]['fn']('COUNT',db[_0xd3e1('0x1d')]['fn']('IF',db[_0xd3e1('0x1d')][_0xd3e1('0x23')](_0xd3e1('0x32')))),_0xd3e1('0x33')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize'][_0xd3e1('0x23')](_0xd3e1('0x34')))),_0xd3e1('0x35')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db[_0xd3e1('0x1d')][_0xd3e1('0x23')]('`state`\x20=\x2012,\x201,\x20null'))),_0xd3e1('0x36')],[db['sequelize']['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize'][_0xd3e1('0x23')](_0xd3e1('0x37')))),'outboundBlacklistCallsDay'],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db[_0xd3e1('0x1d')][_0xd3e1('0x23')](_0xd3e1('0x38')))),_0xd3e1('0x39')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize'][_0xd3e1('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0xd3e1('0x1d')]['fn']('COUNT',db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize'][_0xd3e1('0x23')](_0xd3e1('0x3a')))),_0xd3e1('0x3b')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db['sequelize']['fn']('IF',db[_0xd3e1('0x1d')][_0xd3e1('0x23')]('`state`\x20=\x2020,\x201,\x20null'))),_0xd3e1('0x3c')],[db[_0xd3e1('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xd3e1('0x1d')][_0xd3e1('0x23')](_0xd3e1('0x3d')))),'outboundReCallsDay']],'group':[_0xd3e1('0x2a')]})[_0xd3e1('0xa')](function(_0x305916){logger[_0xd3e1('0xb')](_0xd3e1('0x3e'),_0x9e7dee);logger[_0xd3e1('0x1a')]('GetVoiceQueueHopperHistory',_0x9e7dee,JSON[_0xd3e1('0xe')](_0x305916));_0x402a05(_0x305916);})['catch'](function(_0xafe2f2){logger[_0xd3e1('0xf')](_0xd3e1('0x3e'),_0xafe2f2[_0xd3e1('0x11')],_0x9e7dee);_0x5cd963(_0x5248bb[_0xd3e1('0xf')](0x1f4,_0xafe2f2[_0xd3e1('0x11')]));});});};exports['GetCampaignHopperHistory']=function(_0x59f3c0){var _0x32cef5=this;return new Promise(function(_0x15bbcf,_0xe8f911){return db[_0xd3e1('0x15')][_0xd3e1('0x1c')]({'raw':_0x59f3c0['options']?_0x59f3c0[_0xd3e1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x59f3c0[_0xd3e1('0x18')]?_0x59f3c0['options'][_0xd3e1('0x29')]||null:null,'attributes':[[_0xd3e1('0x2a'),_0xd3e1('0x2b')],[db[_0xd3e1('0x1d')]['fn']('COUNT',db['sequelize']['col']('id')),_0xd3e1('0x3f')],[db[_0xd3e1('0x1d')]['fn'](_0xd3e1('0x1e'),db[_0xd3e1('0x1d')]['fn']('IF',db['sequelize']['literal'](_0xd3e1('0x2f')))),_0xd3e1('0x40')]],'group':[_0xd3e1('0x2a')]})[_0xd3e1('0xa')](function(_0x41924b){logger[_0xd3e1('0xb')](_0xd3e1('0x41'),_0x59f3c0);logger[_0xd3e1('0x1a')](_0xd3e1('0x41'),_0x59f3c0,JSON[_0xd3e1('0xe')](_0x41924b));_0x15bbcf(_0x41924b);})[_0xd3e1('0x13')](function(_0x3e813f){logger[_0xd3e1('0xf')](_0xd3e1('0x41'),_0x3e813f[_0xd3e1('0x11')],_0x59f3c0);_0xe8f911(_0x32cef5[_0xd3e1('0xf')](0x1f4,_0x3e813f['message']));});});}; \ No newline at end of file +var _0x9567=['outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','col','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateCmHopperHistory','create','options','stringify','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','raw','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9567,0xdc));var _0x7956=function(_0x95f4e1,_0x5585bf){_0x95f4e1=_0x95f4e1-0x0;var _0xb2c148=_0x9567[_0x95f4e1];return _0xb2c148;};'use strict';var _=require(_0x7956('0x0'));var util=require(_0x7956('0x1'));var moment=require(_0x7956('0x2'));var BPromise=require(_0x7956('0x3'));var rs=require(_0x7956('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7956('0x5'));var logger=require(_0x7956('0x6'))('rpc');var config=require(_0x7956('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7956('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1819b6,_0x31b50d,_0x48b2b3){return new BPromise(function(_0x3c213a,_0x50038a){return client[_0x7956('0x9')](_0x1819b6,_0x48b2b3)[_0x7956('0xa')](function(_0x53310c){logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,'request\x20sent');logger[_0x7956('0xd')](_0x7956('0xe'),_0x31b50d,_0x7956('0xf'),JSON['stringify'](_0x53310c));if(_0x53310c[_0x7956('0x10')]){if(_0x53310c[_0x7956('0x10')][_0x7956('0x11')]===0x1f4){logger[_0x7956('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x50038a(_0x53310c[_0x7956('0x10')]['message']);}logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);return _0x3c213a(_0x53310c[_0x7956('0x10')][_0x7956('0x12')]);}else{logger[_0x7956('0xb')](_0x7956('0xc'),_0x31b50d,_0x7956('0xf'));_0x3c213a(_0x53310c[_0x7956('0x13')][_0x7956('0x12')]);}})[_0x7956('0x14')](function(_0x18ae51){logger[_0x7956('0x10')](_0x7956('0xc'),_0x31b50d,_0x18ae51);_0x50038a(_0x18ae51);});});}exports[_0x7956('0x15')]=function(_0x5e6b90){var _0x5c3afb=this;return new Promise(function(_0x10b29c,_0x811122){return db['CmHopperHistory'][_0x7956('0x16')](_0x5e6b90['body'],{'raw':_0x5e6b90[_0x7956('0x17')]?_0x5e6b90[_0x7956('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x7956('0xa')](function(_0x2e31cd){logger[_0x7956('0xb')]('CreateCmHopperHistory',_0x5e6b90);logger[_0x7956('0xd')]('CreateCmHopperHistory',_0x5e6b90,JSON[_0x7956('0x18')](_0x2e31cd));_0x10b29c(_0x2e31cd);})['catch'](function(_0x427500){logger[_0x7956('0x10')](_0x7956('0x15'),_0x427500[_0x7956('0x12')],_0x5e6b90);_0x811122(_0x5c3afb['error'](0x1f4,_0x427500[_0x7956('0x12')]));});});};exports[_0x7956('0x19')]=function(_0x432a2d){var _0x51020f=this;return new Promise(function(_0x53d1c4,_0x45f866){return db[_0x7956('0x1a')][_0x7956('0x1b')]({'raw':_0x432a2d[_0x7956('0x17')]?_0x432a2d[_0x7956('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x432a2d[_0x7956('0x17')]?_0x432a2d[_0x7956('0x17')][_0x7956('0x1c')]||null:null,'attributes':[[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['col']('id')),_0x7956('0x1f')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')](_0x7956('0x21')))),_0x7956('0x22')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')](_0x7956('0x23')))),_0x7956('0x24')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')]('`state`\x20=\x2011,\x201,\x20null'))),_0x7956('0x25')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x26'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x7956('0x27')],[db[_0x7956('0x1d')]['fn']('AVG',db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')](_0x7956('0x28')))),_0x7956('0x29')]]})[_0x7956('0xa')](function(_0x22c3fe){logger[_0x7956('0xb')](_0x7956('0x19'),_0x432a2d);logger[_0x7956('0xd')](_0x7956('0x19'),_0x432a2d,JSON[_0x7956('0x18')](_0x22c3fe));_0x53d1c4(_0x22c3fe);})[_0x7956('0x14')](function(_0x322108){logger[_0x7956('0x10')](_0x7956('0x19'),_0x322108['message'],_0x432a2d);_0x45f866(_0x51020f[_0x7956('0x10')](0x1f4,_0x322108[_0x7956('0x12')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x3a758b){var _0x4fd2a9=this;return new Promise(function(_0x56f18a,_0x4d7dcd){return db['CmHopperHistory'][_0x7956('0x1b')]({'raw':_0x3a758b['options']?_0x3a758b[_0x7956('0x17')][_0x7956('0x2a')]===undefined?!![]:![]:!![],'where':_0x3a758b[_0x7956('0x17')]?_0x3a758b[_0x7956('0x17')][_0x7956('0x1c')]||null:null,'attributes':[[_0x7956('0x2b'),_0x7956('0x2c')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db['sequelize']['fn']('IF',db[_0x7956('0x1d')]['literal'](_0x7956('0x2d')))),_0x7956('0x2e')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db['sequelize']['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0x7956('0x1d')]['fn']('COUNT',db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')]('`state`\x20=\x204,\x201,\x20null'))),_0x7956('0x2f')],[db[_0x7956('0x1d')]['fn']('COUNT',db[_0x7956('0x1d')]['fn']('IF',db['sequelize'][_0x7956('0x20')](_0x7956('0x30')))),_0x7956('0x31')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x7956('0x20')](_0x7956('0x32')))),_0x7956('0x33')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db['sequelize'][_0x7956('0x20')](_0x7956('0x34')))),_0x7956('0x35')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')](_0x7956('0x36')))),_0x7956('0x37')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x7956('0x38')],[db['sequelize']['fn']('COUNT',db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')](_0x7956('0x39')))),_0x7956('0x3a')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')](_0x7956('0x3b')))),_0x7956('0x3c')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')](_0x7956('0x3d')))),_0x7956('0x3e')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db['sequelize'][_0x7956('0x20')](_0x7956('0x3f')))),_0x7956('0x40')],[db['sequelize']['fn'](_0x7956('0x1e'),db['sequelize']['fn']('IF',db[_0x7956('0x1d')][_0x7956('0x20')]('`state`\x20=\x2020,\x201,\x20null'))),_0x7956('0x3e')],[db[_0x7956('0x1d')]['fn']('COUNT',db[_0x7956('0x1d')]['fn']('IF',db[_0x7956('0x1d')]['literal'](_0x7956('0x41')))),_0x7956('0x42')]],'group':[_0x7956('0x2b')]})[_0x7956('0xa')](function(_0x3c592a){logger[_0x7956('0xb')](_0x7956('0x43'),_0x3a758b);logger['debug'](_0x7956('0x43'),_0x3a758b,JSON[_0x7956('0x18')](_0x3c592a));_0x56f18a(_0x3c592a);})[_0x7956('0x14')](function(_0x43e920){logger['error'](_0x7956('0x43'),_0x43e920[_0x7956('0x12')],_0x3a758b);_0x4d7dcd(_0x4fd2a9[_0x7956('0x10')](0x1f4,_0x43e920[_0x7956('0x12')]));});});};exports[_0x7956('0x44')]=function(_0x125c46){var _0x23e7ee=this;return new Promise(function(_0x277d78,_0x3d7a33){return db[_0x7956('0x1a')][_0x7956('0x1b')]({'raw':_0x125c46[_0x7956('0x17')]?_0x125c46[_0x7956('0x17')][_0x7956('0x2a')]===undefined?!![]:![]:!![],'where':_0x125c46['options']?_0x125c46[_0x7956('0x17')][_0x7956('0x1c')]||null:null,'attributes':[[_0x7956('0x2b'),_0x7956('0x2c')],[db['sequelize']['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')][_0x7956('0x45')]('id')),_0x7956('0x46')],[db[_0x7956('0x1d')]['fn'](_0x7956('0x1e'),db[_0x7956('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x7956('0x21')))),'ivrAnswerCallsDay']],'group':[_0x7956('0x2b')]})[_0x7956('0xa')](function(_0x27619d){logger[_0x7956('0xb')](_0x7956('0x44'),_0x125c46);logger[_0x7956('0xd')](_0x7956('0x44'),_0x125c46,JSON[_0x7956('0x18')](_0x27619d));_0x277d78(_0x27619d);})[_0x7956('0x14')](function(_0x5d41ca){logger[_0x7956('0x10')](_0x7956('0x44'),_0x5d41ca[_0x7956('0x12')],_0x125c46);_0x3d7a33(_0x23e7ee['error'](0x1f4,_0x5d41ca[_0x7956('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 9f26606..99ebe5e 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 _0xc3b3=['/:id','show','post','update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperHistory.controller','get','index','isAuthenticated','describe'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0xc3b3,0x1d0));var _0x3c3b=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0xc3b3[_0xda464c];return _0x19e222;};'use strict';var multer=require(_0x3c3b('0x0'));var util=require('util');var path=require(_0x3c3b('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c3b('0x2'));var router=express[_0x3c3b('0x3')]();var fs_extra=require(_0x3c3b('0x4'));var auth=require(_0x3c3b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c3b('0x6'));var controller=require(_0x3c3b('0x7'));router[_0x3c3b('0x8')]('/',auth['isAuthenticated'](),controller[_0x3c3b('0x9')]);router['get']('/describe',auth[_0x3c3b('0xa')](),controller[_0x3c3b('0xb')]);router['get'](_0x3c3b('0xc'),auth[_0x3c3b('0xa')](),controller[_0x3c3b('0xd')]);router[_0x3c3b('0xe')]('/',auth[_0x3c3b('0xa')](),controller['create']);router['put'](_0x3c3b('0xc'),auth[_0x3c3b('0xa')](),controller[_0x3c3b('0xf')]);module[_0x3c3b('0x10')]=router; \ No newline at end of file +var _0xf29c=['./cmHopperHistory.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','create','put','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x2b3432,_0x307757){var _0x538cba=function(_0x5e4622){while(--_0x5e4622){_0x2b3432['push'](_0x2b3432['shift']());}};_0x538cba(++_0x307757);}(_0xf29c,0xb7));var _0xcf29=function(_0x3c2acd,_0x141224){_0x3c2acd=_0x3c2acd-0x0;var _0x511ffd=_0xf29c[_0x3c2acd];return _0x511ffd;};'use strict';var multer=require('multer');var util=require(_0xcf29('0x0'));var path=require('path');var timeout=require(_0xcf29('0x1'));var express=require(_0xcf29('0x2'));var router=express[_0xcf29('0x3')]();var fs_extra=require(_0xcf29('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xcf29('0x5'));var config=require(_0xcf29('0x6'));var controller=require(_0xcf29('0x7'));router['get']('/',auth[_0xcf29('0x8')](),controller[_0xcf29('0x9')]);router['get'](_0xcf29('0xa'),auth['isAuthenticated'](),controller[_0xcf29('0xb')]);router[_0xcf29('0xc')](_0xcf29('0xd'),auth['isAuthenticated'](),controller[_0xcf29('0xe')]);router[_0xcf29('0xf')]('/',auth['isAuthenticated'](),controller[_0xcf29('0x10')]);router[_0xcf29('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0xcf29('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 84a982c..b1bbb3d 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 _0xd8b1=['name','sequelize','exports','STRING'];(function(_0x14646a,_0x531e01){var _0x437ad4=function(_0x25b553){while(--_0x25b553){_0x14646a['push'](_0x14646a['shift']());}};_0x437ad4(++_0x531e01);}(_0xd8b1,0x105));var _0x1d8b=function(_0xd7befa,_0x364407){_0xd7befa=_0xd7befa-0x0;var _0x2e759f=_0xd8b1[_0xd7befa];return _0x2e759f;};'use strict';var Sequelize=require(_0x1d8b('0x0'));module[_0x1d8b('0x1')]={'name':{'type':Sequelize[_0x1d8b('0x2')],'unique':_0x1d8b('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1d8b('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x385b=['exports','name','STRING'];(function(_0x52b677,_0x5a545b){var _0x4f523c=function(_0x5b5a9c){while(--_0x5b5a9c){_0x52b677['push'](_0x52b677['shift']());}};_0x4f523c(++_0x5a545b);}(_0x385b,0x1a7));var _0xb385=function(_0x50b53a,_0x50f7bc){_0x50b53a=_0x50b53a-0x0;var _0x116765=_0x385b[_0x50b53a];return _0x116765;};'use strict';var Sequelize=require('sequelize');module[_0xb385('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xb385('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb385('0x2')]},'dialPrefix':{'type':Sequelize[_0xb385('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index fcd658e..d39e32f 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 _0x70e9=['name','send','index','CmList','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ListId','Disposition','getDispositions','removeDispositions','addContacts','isArray','tags','join','push','each','CmContact','omit','dataValues','message','Malformed\x20request\x20syntax','CustomFields','cf_%d','raw','getContacts','getContactsCsv','CmCustomField','concat','format','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','emit','userCmList:save','ids','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','Lists','UserProfileResource','stack'];(function(_0x377a8c,_0x57a459){var _0x7f9a03=function(_0x4c9750){while(--_0x4c9750){_0x377a8c['push'](_0x377a8c['shift']());}};_0x7f9a03(++_0x57a459);}(_0x70e9,0x193));var _0x970e=function(_0x582e3,_0x46a532){_0x582e3=_0x582e3-0x0;var _0x2c1526=_0x70e9[_0x582e3];return _0x2c1526;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x970e('0x0'));var zipdir=require(_0x970e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x970e('0x2'));var moment=require(_0x970e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x970e('0x4'));var util=require('util');var path=require(_0x970e('0x5'));var sox=require(_0x970e('0x6'));var csv=require(_0x970e('0x7'));var ejs=require(_0x970e('0x8'));var fs=require('fs');var fs_extra=require(_0x970e('0x9'));var _=require(_0x970e('0xa'));var squel=require(_0x970e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x970e('0xc'));var toCsv=require(_0x970e('0x7'));var querystring=require('querystring');var Papa=require(_0x970e('0xd'));var Redis=require(_0x970e('0xe'));var authService=require(_0x970e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x970e('0x10'));var hardwareService=require(_0x970e('0x11'));var logger=require(_0x970e('0x12'))(_0x970e('0x13'));var utils=require(_0x970e('0x14'));var config=require(_0x970e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x970e('0x16'))['db'];config[_0x970e('0x17')]=_[_0x970e('0x18')](config[_0x970e('0x17')],{'host':_0x970e('0x19'),'port':0x18eb});var socket=require(_0x970e('0x1a'))(new Redis(config[_0x970e('0x17')]));require(_0x970e('0x1b'))['register'](socket);function respondWithStatusCode(_0x15576b,_0x389a08){_0x389a08=_0x389a08||0xcc;return function(_0x580dc0){if(_0x580dc0){return _0x15576b[_0x970e('0x1c')](_0x389a08);}return _0x15576b[_0x970e('0x1d')](_0x389a08)[_0x970e('0x1e')]();};}function respondWithResult(_0x43bdac,_0x515501){_0x515501=_0x515501||0xc8;return function(_0x1eab63){if(_0x1eab63){return _0x43bdac[_0x970e('0x1d')](_0x515501)[_0x970e('0x1f')](_0x1eab63);}};}function respondWithFilteredResult(_0x4244a2,_0x47885b){return function(_0x58fc94){if(_0x58fc94){var _0x124982=typeof _0x47885b[_0x970e('0x20')]===_0x970e('0x21')&&typeof _0x47885b['limit']===_0x970e('0x21');var _0x27d068=_0x58fc94[_0x970e('0x22')];var _0x3c79cc=_0x124982?0x0:_0x47885b[_0x970e('0x20')];var _0x4d5eec=_0x124982?_0x58fc94['count']:_0x47885b[_0x970e('0x20')]+_0x47885b['limit'];var _0x407ef0;if(_0x4d5eec>=_0x27d068){_0x4d5eec=_0x27d068;_0x407ef0=0xc8;}else{_0x407ef0=0xce;}_0x4244a2[_0x970e('0x1d')](_0x407ef0);return _0x4244a2[_0x970e('0x23')]('Content-Range',_0x3c79cc+'-'+_0x4d5eec+'/'+_0x27d068)['json'](_0x58fc94);}return null;};}function patchUpdates(_0x193fb6){return function(_0x357fee){try{jsonpatch[_0x970e('0x24')](_0x357fee,_0x193fb6,!![]);}catch(_0xd5165a){return BPromise[_0x970e('0x25')](_0xd5165a);}return _0x357fee[_0x970e('0x26')]();};}function saveUpdates(_0x5a2179,_0x129d20){return function(_0x2ed145){if(_0x2ed145){return _0x2ed145['update'](_0x5a2179)[_0x970e('0x27')](function(_0xcabde3){return _0xcabde3;});}return null;};}function removeEntity(_0x1b9414,_0x375dd2){return function(_0xdd4f14){if(_0xdd4f14){return _0xdd4f14[_0x970e('0x28')]()[_0x970e('0x27')](function(){var _0x43df3f=_0xdd4f14['get']({'plain':!![]});var _0x422e2e=_0x970e('0x29');return db[_0x970e('0x2a')][_0x970e('0x28')]({'where':{'type':_0x422e2e,'resourceId':_0x43df3f['id']}})[_0x970e('0x27')](function(){return _0xdd4f14;});})[_0x970e('0x27')](function(){_0x1b9414[_0x970e('0x1d')](0xcc)[_0x970e('0x1e')]();});}};}function handleEntityNotFound(_0x5e5052,_0x4af467){return function(_0x434db6){if(!_0x434db6){_0x5e5052[_0x970e('0x1c')](0x194);}return _0x434db6;};}function handleError(_0x3d3593,_0x12d585){_0x12d585=_0x12d585||0x1f4;return function(_0x2d5f2f){logger['error'](_0x2d5f2f[_0x970e('0x2b')]);if(_0x2d5f2f[_0x970e('0x2c')]){delete _0x2d5f2f['name'];}_0x3d3593[_0x970e('0x1d')](_0x12d585)[_0x970e('0x2d')](_0x2d5f2f);};}exports[_0x970e('0x2e')]=function(_0x284c42,_0x1f50df){var _0x182c21={},_0x5c01f7={},_0x275bb5={'count':0x0,'rows':[]};var _0xfa8133=_['map'](db[_0x970e('0x2f')][_0x970e('0x30')],function(_0x5cc381){return{'name':_0x5cc381[_0x970e('0x31')],'type':_0x5cc381[_0x970e('0x32')]['key']};});_0x5c01f7['model']=_[_0x970e('0x33')](_0xfa8133,'name');_0x5c01f7[_0x970e('0x34')]=_['keys'](_0x284c42[_0x970e('0x34')]);_0x5c01f7[_0x970e('0x35')]=_[_0x970e('0x36')](_0x5c01f7[_0x970e('0x37')],_0x5c01f7[_0x970e('0x34')]);_0x182c21[_0x970e('0x38')]=_['intersection'](_0x5c01f7[_0x970e('0x37')],qs[_0x970e('0x39')](_0x284c42[_0x970e('0x34')][_0x970e('0x39')]));_0x182c21[_0x970e('0x38')]=_0x182c21['attributes'][_0x970e('0x3a')]?_0x182c21[_0x970e('0x38')]:_0x5c01f7[_0x970e('0x37')];if(!_0x284c42[_0x970e('0x34')][_0x970e('0x3b')](_0x970e('0x3c'))){_0x182c21[_0x970e('0x3d')]=qs[_0x970e('0x3d')](_0x284c42['query']['limit']);_0x182c21[_0x970e('0x20')]=qs[_0x970e('0x20')](_0x284c42[_0x970e('0x34')][_0x970e('0x20')]);}_0x182c21[_0x970e('0x3e')]=qs[_0x970e('0x3f')](_0x284c42[_0x970e('0x34')][_0x970e('0x3f')]);_0x182c21[_0x970e('0x40')]=qs['filters'](_[_0x970e('0x41')](_0x284c42[_0x970e('0x34')],_0x5c01f7['filters']),_0xfa8133);if(_0x284c42['query'][_0x970e('0x42')]){_0x182c21[_0x970e('0x40')]=_[_0x970e('0x43')](_0x182c21['where'],{'$or':_['map'](_0xfa8133,function(_0x26c5d7){if(_0x26c5d7[_0x970e('0x32')]!==_0x970e('0x44')){var _0x46f9c9={};_0x46f9c9[_0x26c5d7['name']]={'$like':'%'+_0x284c42[_0x970e('0x34')][_0x970e('0x42')]+'%'};return _0x46f9c9;}})});}_0x182c21=_[_0x970e('0x43')]({},_0x182c21,_0x284c42[_0x970e('0x45')]);var _0xdc75d4={'where':_0x182c21[_0x970e('0x40')]};return db[_0x970e('0x2f')]['count'](_0xdc75d4)[_0x970e('0x27')](function(_0x48288e){_0x275bb5[_0x970e('0x22')]=_0x48288e;if(_0x284c42[_0x970e('0x34')][_0x970e('0x46')]){_0x182c21['include']=[{'all':!![]}];}return db[_0x970e('0x2f')][_0x970e('0x47')](_0x182c21);})[_0x970e('0x27')](function(_0x12e9cf){_0x275bb5[_0x970e('0x48')]=_0x12e9cf;return _0x275bb5;})[_0x970e('0x27')](respondWithFilteredResult(_0x1f50df,_0x182c21))['catch'](handleError(_0x1f50df,null));};exports[_0x970e('0x49')]=function(_0x3c6834,_0xdcde38){var _0xc20464={'raw':![],'where':{'id':_0x3c6834[_0x970e('0x4a')]['id']}},_0xe3646e={};_0xe3646e[_0x970e('0x37')]=_[_0x970e('0x4b')](db['CmList']['rawAttributes']);_0xe3646e[_0x970e('0x34')]=_[_0x970e('0x4b')](_0x3c6834[_0x970e('0x34')]);_0xe3646e[_0x970e('0x35')]=_[_0x970e('0x36')](_0xe3646e[_0x970e('0x37')],_0xe3646e[_0x970e('0x34')]);_0xc20464[_0x970e('0x38')]=_[_0x970e('0x36')](_0xe3646e['model'],qs['fields'](_0x3c6834[_0x970e('0x34')][_0x970e('0x39')]));_0xc20464[_0x970e('0x38')]=_0xc20464[_0x970e('0x38')][_0x970e('0x3a')]?_0xc20464['attributes']:_0xe3646e['model'];if(_0x3c6834[_0x970e('0x34')][_0x970e('0x46')]){_0xc20464[_0x970e('0x4c')]=[{'all':!![]}];}_0xc20464=_['merge']({},_0xc20464,_0x3c6834[_0x970e('0x45')]);return db['CmList'][_0x970e('0x4d')](_0xc20464)[_0x970e('0x27')](handleEntityNotFound(_0xdcde38,null))[_0x970e('0x27')](respondWithResult(_0xdcde38,null))[_0x970e('0x4e')](handleError(_0xdcde38,null));};exports[_0x970e('0x4f')]=function(_0x2e8ec9,_0x3e9622){return db[_0x970e('0x2f')]['create'](_0x2e8ec9[_0x970e('0x50')],{})[_0x970e('0x27')](function(_0x17d5f0){var _0x19b584=_0x2e8ec9['user']['get']({'plain':!![]});if(!_0x19b584)throw new Error(_0x970e('0x51'));if(_0x19b584[_0x970e('0x52')]===_0x970e('0x53')){var _0x1e5888=_0x17d5f0[_0x970e('0x54')]({'plain':!![]});var _0x344cf4=_0x970e('0x29');return db[_0x970e('0x55')][_0x970e('0x4d')]({'where':{'name':_0x344cf4,'userProfileId':_0x19b584[_0x970e('0x56')]},'raw':!![]})[_0x970e('0x27')](function(_0x5b0bd2){if(_0x5b0bd2&&_0x5b0bd2[_0x970e('0x57')]===0x0){return db[_0x970e('0x2a')][_0x970e('0x4f')]({'name':_0x1e5888[_0x970e('0x2c')],'resourceId':_0x1e5888['id'],'type':_0x5b0bd2['name'],'sectionId':_0x5b0bd2['id']},{})[_0x970e('0x27')](function(){return _0x17d5f0;});}else{return _0x17d5f0;}})[_0x970e('0x4e')](function(_0x1e1d2c){logger[_0x970e('0x58')](_0x970e('0x59'),_0x1e1d2c);throw _0x1e1d2c;});}return _0x17d5f0;})['then'](respondWithResult(_0x3e9622,0xc9))[_0x970e('0x4e')](handleError(_0x3e9622,null));};exports[_0x970e('0x5a')]=function(_0x314257,_0xee6b45){if(_0x314257[_0x970e('0x50')]['id']){delete _0x314257[_0x970e('0x50')]['id'];}return db['CmList']['find']({'where':{'id':_0x314257[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0xee6b45,null))[_0x970e('0x27')](saveUpdates(_0x314257[_0x970e('0x50')],null))[_0x970e('0x27')](respondWithResult(_0xee6b45,null))[_0x970e('0x4e')](handleError(_0xee6b45,null));};exports[_0x970e('0x28')]=function(_0x286dd9,_0x987da2){return db[_0x970e('0x2f')][_0x970e('0x4d')]({'where':{'id':_0x286dd9[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x987da2,null))[_0x970e('0x27')](removeEntity(_0x987da2,null))['catch'](handleError(_0x987da2,null));};exports['describe']=function(_0x49bc76,_0x531beb){return db['CmList'][_0x970e('0x5b')]()[_0x970e('0x27')](respondWithResult(_0x531beb,null))[_0x970e('0x4e')](handleError(_0x531beb,null));};exports[_0x970e('0x5c')]=function(_0x28f55a,_0xaa2c5,_0x5aac66){if(_0x28f55a[_0x970e('0x50')]['id']){delete _0x28f55a[_0x970e('0x50')]['id'];}return db['CmList']['find']({'where':{'id':_0x28f55a['params']['id']}})[_0x970e('0x27')](handleEntityNotFound(_0xaa2c5,null))[_0x970e('0x27')](function(_0x3780e6){if(_0x3780e6){_0x28f55a[_0x970e('0x50')][_0x970e('0x5d')]=_0x3780e6['id'];return db[_0x970e('0x5e')]['create'](_0x28f55a[_0x970e('0x50')]);}})['then'](respondWithResult(_0xaa2c5,null))[_0x970e('0x4e')](handleError(_0xaa2c5,null));};exports[_0x970e('0x5f')]=function(_0x5223ac,_0x2b5ee9,_0x5e4de0){var _0x33bba6={'raw':![],'where':{}};var _0x21a057={};var _0x322ae5={'count':0x0,'rows':[]};return db[_0x970e('0x2f')]['findOne']({'where':{'id':_0x5223ac[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x2b5ee9,null))[_0x970e('0x27')](function(_0x3b893e){if(_0x3b893e){_0x21a057['model']=_[_0x970e('0x4b')](db[_0x970e('0x5e')][_0x970e('0x30')]);_0x21a057[_0x970e('0x34')]=_[_0x970e('0x4b')](_0x5223ac[_0x970e('0x34')]);_0x21a057['filters']=_['intersection'](_0x21a057[_0x970e('0x37')],_0x21a057[_0x970e('0x34')]);_0x33bba6[_0x970e('0x38')]=_['intersection'](_0x21a057[_0x970e('0x37')],qs[_0x970e('0x39')](_0x5223ac[_0x970e('0x34')]['fields']));_0x33bba6[_0x970e('0x38')]=_0x33bba6['attributes'][_0x970e('0x3a')]?_0x33bba6[_0x970e('0x38')]:_0x21a057['model'];if(!_0x5223ac[_0x970e('0x34')][_0x970e('0x3b')](_0x970e('0x3c'))){_0x33bba6[_0x970e('0x3d')]=qs['limit'](_0x5223ac[_0x970e('0x34')]['limit']);_0x33bba6[_0x970e('0x20')]=qs[_0x970e('0x20')](_0x5223ac[_0x970e('0x34')]['offset']);}_0x33bba6['order']=qs['sort'](_0x5223ac[_0x970e('0x34')][_0x970e('0x3f')]);_0x33bba6[_0x970e('0x40')]=qs[_0x970e('0x35')](_[_0x970e('0x41')](_0x5223ac[_0x970e('0x34')],_0x21a057['filters']));_0x33bba6[_0x970e('0x40')]['ListId']=_0x3b893e['id'];if(_0x5223ac[_0x970e('0x34')][_0x970e('0x42')]){_0x33bba6[_0x970e('0x40')]=_[_0x970e('0x43')](_0x33bba6[_0x970e('0x40')],{'$or':_[_0x970e('0x33')](_0x33bba6['attributes'],function(_0x696aaa){var _0x9e8cfc={};_0x9e8cfc[_0x696aaa]={'$like':'%'+_0x5223ac['query'][_0x970e('0x42')]+'%'};return _0x9e8cfc;})});}_0x33bba6=_[_0x970e('0x43')]({},_0x33bba6,_0x5223ac['options']);return db[_0x970e('0x5e')][_0x970e('0x22')]({'where':_0x33bba6[_0x970e('0x40')]})[_0x970e('0x27')](function(_0x369432){_0x322ae5[_0x970e('0x22')]=_0x369432;if(_0x5223ac[_0x970e('0x34')][_0x970e('0x46')]){_0x33bba6['include']=[{'all':!![]}];}return db['Disposition']['findAll'](_0x33bba6);})['then'](function(_0xa11dea){_0x322ae5['rows']=_0xa11dea;return _0x322ae5;});}})[_0x970e('0x27')](respondWithFilteredResult(_0x2b5ee9,_0x33bba6))[_0x970e('0x4e')](handleError(_0x2b5ee9,null));};exports[_0x970e('0x60')]=function(_0x561876,_0x24d024,_0x2179a3){return db[_0x970e('0x2f')][_0x970e('0x4d')]({'where':{'id':_0x561876[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x24d024,null))['then'](function(_0x50ae80){if(_0x50ae80){return _0x50ae80[_0x970e('0x60')](_0x561876['query']['ids']);}})[_0x970e('0x27')](respondWithStatusCode(_0x24d024,null))[_0x970e('0x4e')](handleError(_0x24d024,null));};exports[_0x970e('0x61')]=function(_0x438f01,_0x2168ea,_0x1ba93f){return db[_0x970e('0x2f')][_0x970e('0x4d')]({'where':{'id':_0x438f01[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x2168ea,null))[_0x970e('0x27')](function(_0x4ad406){if(_0x4ad406){var _0x3b3952=[];var _0x8cef1f={'success':[],'errors':[]};return db['CmContact'][_0x970e('0x5b')]()[_0x970e('0x27')](function(_0x1f55e7){if(_0x438f01['body']['tags']&&_[_0x970e('0x62')](_0x438f01[_0x970e('0x50')][_0x970e('0x63')])){if(_0x438f01['body']['tags'][_0x970e('0x3a')]){_0x438f01['body'][_0x970e('0x63')]=_0x438f01['body'][_0x970e('0x63')][_0x970e('0x64')](';')+';';}else{_0x438f01[_0x970e('0x50')][_0x970e('0x63')]=null;}}else{_0x438f01[_0x970e('0x50')]['tags']=null;}if(_0x438f01[_0x970e('0x50')]&&_[_0x970e('0x62')](_0x438f01['body'])){for(var _0x9bd90f=0x0;_0x9bd90f<_0x438f01[_0x970e('0x50')][_0x970e('0x3a')];_0x9bd90f+=0x1){_0x438f01[_0x970e('0x50')][_0x9bd90f]['ListId']=_0x438f01[_0x970e('0x4a')]['id'];_0x3b3952[_0x970e('0x65')](_0x438f01[_0x970e('0x50')][_0x9bd90f]);}return BPromise[_0x970e('0x66')](_0x3b3952,function(_0x3a1086){return db[_0x970e('0x67')][_0x970e('0x4f')](_[_0x970e('0x68')](_0x3a1086,['ids','id'])||{},{'fields':_[_0x970e('0x4b')](_0x1f55e7),'raw':!![]})[_0x970e('0x27')](function(_0x437793){_0x8cef1f['success'][_0x970e('0x65')](_0x437793[_0x970e('0x69')]);})[_0x970e('0x4e')](function(_0x5adf6c){_0x8cef1f['errors']['push']({'data':_0x3a1086,'error':_0x5adf6c[_0x970e('0x6a')]});});})[_0x970e('0x27')](function(_0x1537dd){return _0x8cef1f;})[_0x970e('0x4e')](function(_0x472077){return _0x472077;});}else{_0x2168ea['status'](0x190)[_0x970e('0x1f')]({'message':_0x970e('0x6b')});}});}})[_0x970e('0x27')](respondWithResult(_0x2168ea,null))[_0x970e('0x4e')](handleError(_0x2168ea,null));};exports['getContacts']=function(_0x1a731b,_0x22e79d,_0x19fd40){var _0x38beb5;return db[_0x970e('0x2f')][_0x970e('0x4d')]({'where':{'id':_0x1a731b['params']['id']},'include':[{'model':db['CmCustomField'],'as':'CustomFields'}]})[_0x970e('0x27')](handleEntityNotFound(_0x22e79d,null))[_0x970e('0x27')](function(_0x9b5b00){if(_0x9b5b00){_0x38beb5=_0x9b5b00;return db[_0x970e('0x67')][_0x970e('0x30')];}})[_0x970e('0x27')](function(_0x23b140){if(_0x23b140){var _0x2e1a7b={};var _0x17a197={};_0x17a197[_0x970e('0x37')]=_['concat'](_['keys'](_0x23b140),_[_0x970e('0x33')](_0x38beb5[_0x970e('0x6c')],function(_0x4a8dbf){return util['format'](_0x970e('0x6d'),_0x4a8dbf['id']);}));_0x17a197['query']=_[_0x970e('0x4b')](_0x1a731b[_0x970e('0x34')]);_0x17a197[_0x970e('0x35')]=_[_0x970e('0x36')](_0x17a197['model'],_0x17a197[_0x970e('0x34')]);_0x2e1a7b['attributes']=_[_0x970e('0x36')](_0x17a197[_0x970e('0x37')],qs[_0x970e('0x39')](_0x1a731b[_0x970e('0x34')][_0x970e('0x39')]));_0x2e1a7b[_0x970e('0x38')]=_0x2e1a7b[_0x970e('0x38')]['length']?_0x2e1a7b[_0x970e('0x38')]:_0x17a197['model'];if(!_0x1a731b[_0x970e('0x34')]['hasOwnProperty'](_0x970e('0x3c'))){_0x2e1a7b[_0x970e('0x3d')]=qs[_0x970e('0x3d')](_0x1a731b[_0x970e('0x34')][_0x970e('0x3d')]);_0x2e1a7b[_0x970e('0x20')]=qs[_0x970e('0x20')](_0x1a731b[_0x970e('0x34')]['offset']);}_0x2e1a7b[_0x970e('0x3e')]=qs['sort'](_0x1a731b[_0x970e('0x34')][_0x970e('0x3f')]);_0x2e1a7b['where']=qs[_0x970e('0x35')](_[_0x970e('0x41')](_0x1a731b[_0x970e('0x34')],_0x17a197[_0x970e('0x35')]));_0x2e1a7b[_0x970e('0x6e')]=!![];if(_0x1a731b[_0x970e('0x34')][_0x970e('0x42')]){_0x2e1a7b[_0x970e('0x40')]=_[_0x970e('0x43')](_0x2e1a7b['where'],{'$or':_[_0x970e('0x33')](_0x2e1a7b[_0x970e('0x38')],function(_0x1df4c7){var _0x464128={};_0x464128[_0x1df4c7]={'$like':'%'+_0x1a731b['query'][_0x970e('0x42')]+'%'};return _0x464128;})});}_0x2e1a7b=_[_0x970e('0x43')]({},_0x2e1a7b,_0x1a731b[_0x970e('0x45')]);return _0x38beb5[_0x970e('0x6f')](_0x2e1a7b);}})['then'](respondWithResult(_0x22e79d,null))[_0x970e('0x4e')](handleError(_0x22e79d,null));};exports[_0x970e('0x70')]=function(_0xa1ce21,_0x44c8a9,_0x4a4291){var _0x2f5688;return db[_0x970e('0x2f')][_0x970e('0x4d')]({'where':{'id':_0xa1ce21[_0x970e('0x4a')]['id']},'include':[{'model':db[_0x970e('0x71')],'as':'CustomFields'}]})[_0x970e('0x27')](handleEntityNotFound(_0x44c8a9,null))['then'](function(_0xc5804e){if(_0xc5804e){_0x2f5688=_0xc5804e;return db[_0x970e('0x67')][_0x970e('0x30')];}})[_0x970e('0x27')](function(_0x533faf){if(_0x533faf){var _0x4c63b6={};var _0x307115={};_0x307115[_0x970e('0x37')]=_[_0x970e('0x72')](_[_0x970e('0x4b')](_0x533faf),_[_0x970e('0x33')](_0x2f5688[_0x970e('0x6c')],function(_0x249af2){return util[_0x970e('0x73')](_0x970e('0x6d'),_0x249af2['id']);}));_0x307115[_0x970e('0x34')]=_['keys'](_0xa1ce21[_0x970e('0x34')]);_0x307115[_0x970e('0x35')]=_[_0x970e('0x36')](_0x307115[_0x970e('0x37')],_0x307115[_0x970e('0x34')]);_0x4c63b6['attributes']=_[_0x970e('0x36')](_0x307115[_0x970e('0x37')],qs['fields'](_0xa1ce21['query']['fields']));_0x4c63b6[_0x970e('0x38')]=_0x4c63b6[_0x970e('0x38')][_0x970e('0x3a')]?_0x4c63b6[_0x970e('0x38')]:_0x307115[_0x970e('0x37')];if(!_0xa1ce21[_0x970e('0x34')][_0x970e('0x3b')]('nolimit')){_0x4c63b6[_0x970e('0x3d')]=qs[_0x970e('0x3d')](_0xa1ce21[_0x970e('0x34')]['limit']);_0x4c63b6[_0x970e('0x20')]=qs[_0x970e('0x20')](_0xa1ce21['query'][_0x970e('0x20')]);}_0x4c63b6[_0x970e('0x3e')]=qs[_0x970e('0x3f')](_0xa1ce21[_0x970e('0x34')][_0x970e('0x3f')]);_0x4c63b6[_0x970e('0x40')]=qs[_0x970e('0x35')](_['pick'](_0xa1ce21[_0x970e('0x34')],_0x307115['filters']));_0x4c63b6[_0x970e('0x6e')]=!![];if(_0xa1ce21['query'][_0x970e('0x42')]){_0x4c63b6['where']=_[_0x970e('0x43')](_0x4c63b6[_0x970e('0x40')],{'$or':_['map'](_0x4c63b6[_0x970e('0x38')],function(_0x3365bf){var _0x5b09e8={};_0x5b09e8[_0x3365bf]={'$like':'%'+_0xa1ce21[_0x970e('0x34')]['filter']+'%'};return _0x5b09e8;})});}_0x4c63b6=_[_0x970e('0x43')]({},_0x4c63b6,_0xa1ce21[_0x970e('0x45')]);return _0x2f5688[_0x970e('0x6f')](_0x4c63b6);}})['then'](function(_0x8b62b1){if(!_[_0x970e('0x74')](_0x8b62b1)){var _0x510f2c=toCsv(_0x8b62b1);var _0x22b6b4=Date['now']();fs[_0x970e('0x75')](util[_0x970e('0x73')](_0x970e('0x76'),_0x2f5688['id'],_0x22b6b4),_0x510f2c);_0x44c8a9[_0x970e('0x77')]('Content-disposition','attachment;\x20filename='+util[_0x970e('0x73')](_0x970e('0x78'),_0x2f5688['id'],_0x22b6b4));_0x44c8a9['setHeader'](_0x970e('0x79'),_0x970e('0x7a'));return _0x44c8a9[_0x970e('0x7b')](util[_0x970e('0x73')](_0x970e('0x76'),_0x2f5688['id'],_0x22b6b4));}else{return _0x44c8a9['sendStatus'](0xcc);}})[_0x970e('0x4e')](handleError(_0x44c8a9,null));};exports[_0x970e('0x7c')]=function(_0x1781c2,_0x25c1bc,_0x456871){var _0x319a0d;delete _0x1781c2[_0x970e('0x50')]['id'];return db[_0x970e('0x2f')][_0x970e('0x7d')]({'where':{'id':_0x1781c2[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x25c1bc,null))[_0x970e('0x27')](function(_0x172d60){if(_0x172d60){return db[_0x970e('0x7e')][_0x970e('0x7f')](function(_0x8a2fca){return db[_0x970e('0x71')]['create'](_0x1781c2[_0x970e('0x50')],{'transaction':_0x8a2fca})['then'](function(_0x4daeec){_0x319a0d=_0x4daeec;return _0x172d60[_0x970e('0x80')](_0x4daeec,{'transaction':_0x8a2fca});})[_0x970e('0x27')](function(){var _0x5b895a={'type':db[_0x970e('0x81')][_0x970e('0x82')],'transaction':_0x8a2fca};switch(_0x1781c2[_0x970e('0x50')]['type']){case _0x970e('0x83'):_0x5b895a[_0x970e('0x32')]=db['Sequelize']['TEXT'];break;case'number':_0x5b895a[_0x970e('0x32')]=db[_0x970e('0x81')]['INTEGER'];break;case _0x970e('0x84'):_0x5b895a[_0x970e('0x32')]=db[_0x970e('0x81')][_0x970e('0x85')];_0x5b895a[_0x970e('0x86')]=![];break;default:}return db[_0x970e('0x7e')][_0x970e('0x87')][_0x970e('0x88')](_0x970e('0x89'),util['format'](_0x970e('0x8a'),_0x319a0d['id']),_0x5b895a);})['then'](function(){return _0x319a0d;});});}})[_0x970e('0x27')](respondWithResult(_0x25c1bc,null))[_0x970e('0x4e')](handleError(_0x25c1bc,null));};exports[_0x970e('0x8b')]=function(_0x27100c,_0x51e87e,_0x4cae11){var _0x4b0696={};var _0x26c5de={};var _0x178dc9;var _0x2270ee;return db['CmList'][_0x970e('0x7d')]({'where':{'id':_0x27100c['params']['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x51e87e,null))[_0x970e('0x27')](function(_0x5ef538){if(_0x5ef538){_0x178dc9=_0x5ef538;_0x26c5de[_0x970e('0x37')]=_[_0x970e('0x4b')](db[_0x970e('0x71')]['rawAttributes']);_0x26c5de[_0x970e('0x34')]=_[_0x970e('0x4b')](_0x27100c['query']);_0x26c5de['filters']=_[_0x970e('0x36')](_0x26c5de[_0x970e('0x37')],_0x26c5de[_0x970e('0x34')]);_0x4b0696[_0x970e('0x38')]=_['intersection'](_0x26c5de[_0x970e('0x37')],qs[_0x970e('0x39')](_0x27100c[_0x970e('0x34')][_0x970e('0x39')]));_0x4b0696[_0x970e('0x38')]=_0x4b0696[_0x970e('0x38')][_0x970e('0x3a')]?_0x4b0696[_0x970e('0x38')]:_0x26c5de[_0x970e('0x37')];_0x4b0696[_0x970e('0x3e')]=qs['sort'](_0x27100c[_0x970e('0x34')][_0x970e('0x3f')]);_0x4b0696[_0x970e('0x40')]=qs['filters'](_[_0x970e('0x41')](_0x27100c[_0x970e('0x34')],_0x26c5de[_0x970e('0x35')]));_0x4b0696[_0x970e('0x40')]=_[_0x970e('0x43')](_0x4b0696['where'],{'$or':[{'ListId':_0x5ef538['id']},{'ListId':null}]});if(_0x27100c['query'][_0x970e('0x42')]){_0x4b0696[_0x970e('0x40')]=_[_0x970e('0x43')](_0x4b0696[_0x970e('0x40')],{'$or':_[_0x970e('0x33')](_0x4b0696[_0x970e('0x38')],function(_0x1e17e6){var _0x502e16={};_0x502e16[_0x1e17e6]={'$like':'%'+_0x27100c['query']['filter']+'%'};return _0x502e16;})});}_0x4b0696=_[_0x970e('0x43')]({},_0x4b0696,_0x27100c[_0x970e('0x45')]);return db[_0x970e('0x71')][_0x970e('0x8c')](_0x4b0696);}})[_0x970e('0x27')](respondWithResult(_0x51e87e,null))['catch'](handleError(_0x51e87e,null));};exports[_0x970e('0x8d')]=function(_0x7430fd,_0x104a6b,_0x39cec6){return db[_0x970e('0x2f')][_0x970e('0x4d')]({'where':{'id':_0x7430fd[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x104a6b,null))[_0x970e('0x27')](function(_0x44efba){if(_0x44efba){return _0x44efba['addAgents'](_0x7430fd[_0x970e('0x50')]['ids'],_['omit'](_0x7430fd[_0x970e('0x50')],['ids','id'])||{})['spread'](function(_0xa659b3){for(var _0x274ec2=0x0;_0x274ec2<_0x7430fd[_0x970e('0x50')]['ids']['length'];_0x274ec2+=0x1){socket[_0x970e('0x8e')](_0x970e('0x8f'),{'UserId':Number(_0x7430fd['body'][_0x970e('0x90')][_0x274ec2]),'CmListId':Number(_0x7430fd[_0x970e('0x4a')]['id'])});}return _0xa659b3;});}})[_0x970e('0x27')](respondWithResult(_0x104a6b,null))[_0x970e('0x4e')](handleError(_0x104a6b,null));};exports[_0x970e('0x91')]=function(_0x19e5cc,_0x5f5d84,_0x569c7c){return db[_0x970e('0x2f')][_0x970e('0x4d')]({'where':{'id':_0x19e5cc['params']['id']}})['then'](handleEntityNotFound(_0x5f5d84,null))[_0x970e('0x27')](function(_0x2df778){if(_0x2df778){return _0x2df778[_0x970e('0x91')](_0x19e5cc[_0x970e('0x34')]['ids'])['then'](function(){if(_[_0x970e('0x62')](_0x19e5cc[_0x970e('0x34')]['ids'])){for(var _0x56de02=0x0;_0x56de02<_0x19e5cc[_0x970e('0x34')][_0x970e('0x90')][_0x970e('0x3a')];_0x56de02+=0x1){socket[_0x970e('0x8e')](_0x970e('0x92'),{'UserId':Number(_0x19e5cc[_0x970e('0x34')][_0x970e('0x90')][_0x56de02]),'CmListId':Number(_0x19e5cc[_0x970e('0x4a')]['id'])});}}else{socket[_0x970e('0x8e')](_0x970e('0x92'),{'UserId':Number(_0x19e5cc['query'][_0x970e('0x90')]),'CmListId':Number(_0x19e5cc['params']['id'])});}});}})[_0x970e('0x27')](respondWithStatusCode(_0x5f5d84,null))[_0x970e('0x4e')](handleError(_0x5f5d84,null));};exports[_0x970e('0x93')]=function(_0x3ef359,_0x17afca,_0x3509d0){var _0x4ca22b={};var _0x28860e={};var _0x5bafb2;var _0x5b8532;return db[_0x970e('0x2f')][_0x970e('0x7d')]({'where':{'id':_0x3ef359[_0x970e('0x4a')]['id']}})[_0x970e('0x27')](handleEntityNotFound(_0x17afca,null))[_0x970e('0x27')](function(_0x28148e){if(_0x28148e){_0x5bafb2=_0x28148e;_0x28860e['model']=_[_0x970e('0x4b')](db[_0x970e('0x94')][_0x970e('0x30')]);_0x28860e['query']=_[_0x970e('0x4b')](_0x3ef359[_0x970e('0x34')]);_0x28860e[_0x970e('0x35')]=_[_0x970e('0x36')](_0x28860e[_0x970e('0x37')],_0x28860e[_0x970e('0x34')]);_0x4ca22b[_0x970e('0x38')]=_[_0x970e('0x36')](_0x28860e[_0x970e('0x37')],qs[_0x970e('0x39')](_0x3ef359['query']['fields']));_0x4ca22b[_0x970e('0x38')]=_0x4ca22b['attributes'][_0x970e('0x3a')]?_0x4ca22b[_0x970e('0x38')]:_0x28860e[_0x970e('0x37')];_0x4ca22b['order']=qs[_0x970e('0x3f')](_0x3ef359[_0x970e('0x34')][_0x970e('0x3f')]);_0x4ca22b[_0x970e('0x40')]=qs['filters'](_['pick'](_0x3ef359[_0x970e('0x34')],_0x28860e[_0x970e('0x35')]));if(_0x3ef359[_0x970e('0x34')][_0x970e('0x42')]){_0x4ca22b[_0x970e('0x40')]=_['merge'](_0x4ca22b[_0x970e('0x40')],{'$or':_[_0x970e('0x33')](_0x4ca22b[_0x970e('0x38')],function(_0x28404d){var _0x3ad8d1={};_0x3ad8d1[_0x28404d]={'$like':'%'+_0x3ef359[_0x970e('0x34')][_0x970e('0x42')]+'%'};return _0x3ad8d1;})});}_0x4ca22b=_[_0x970e('0x43')]({},_0x4ca22b,_0x3ef359[_0x970e('0x45')]);return _0x5bafb2['getAgents'](_0x4ca22b);}})['then'](function(_0x269448){if(_0x269448){_0x5b8532=_0x269448['length'];if(!_0x3ef359[_0x970e('0x34')][_0x970e('0x3b')](_0x970e('0x3c'))){_0x4ca22b['limit']=qs[_0x970e('0x3d')](_0x3ef359[_0x970e('0x34')]['limit']);_0x4ca22b[_0x970e('0x20')]=qs[_0x970e('0x20')](_0x3ef359['query']['offset']);}return _0x5bafb2[_0x970e('0x93')](_0x4ca22b);}})['then'](function(_0x293ea0){if(_0x293ea0){return _0x293ea0?{'count':_0x5b8532,'rows':_0x293ea0}:null;}})['then'](respondWithResult(_0x17afca,null))['catch'](handleError(_0x17afca,null));}; \ No newline at end of file +var _0x54a0=['count','offset','limit','apply','reject','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','catch','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','describe','addDisposition','ListId','Disposition','getDispositions','findOne','nolimit','order','removeDispositions','ids','CmContact','tags','join','isArray','push','each','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','format','cf_%d','raw','getContactsCsv','CmCustomField','concat','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','addCustomField','sequelize','transaction','addCustomFields','TEXT','text','INTEGER','switch','Sequelize','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','addAgents','omit','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','undefined'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x54a0,0x6c));var _0x054a=function(_0x125df6,_0x5e9f0c){_0x125df6=_0x125df6-0x0;var _0x24eb88=_0x54a0[_0x125df6];return _0x24eb88;};'use strict';var emlformat=require(_0x054a('0x0'));var rimraf=require(_0x054a('0x1'));var zipdir=require(_0x054a('0x2'));var jsonpatch=require(_0x054a('0x3'));var rp=require(_0x054a('0x4'));var moment=require(_0x054a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x054a('0x6'));var util=require(_0x054a('0x7'));var path=require('path');var sox=require(_0x054a('0x8'));var csv=require(_0x054a('0x9'));var ejs=require(_0x054a('0xa'));var fs=require('fs');var fs_extra=require(_0x054a('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x054a('0xc'));var deskjs=require(_0x054a('0xd'));var toCsv=require(_0x054a('0x9'));var querystring=require('querystring');var Papa=require(_0x054a('0xe'));var Redis=require(_0x054a('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x054a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x054a('0x11'))('api');var utils=require(_0x054a('0x12'));var config=require(_0x054a('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x054a('0x14')]=_['defaults'](config[_0x054a('0x14')],{'host':_0x054a('0x15'),'port':0x18eb});var socket=require(_0x054a('0x16'))(new Redis(config[_0x054a('0x14')]));require(_0x054a('0x17'))[_0x054a('0x18')](socket);function respondWithStatusCode(_0x4e7973,_0x38e0a6){_0x38e0a6=_0x38e0a6||0xcc;return function(_0x723955){if(_0x723955){return _0x4e7973[_0x054a('0x19')](_0x38e0a6);}return _0x4e7973[_0x054a('0x1a')](_0x38e0a6)[_0x054a('0x1b')]();};}function respondWithResult(_0x51a762,_0xe2c3bd){_0xe2c3bd=_0xe2c3bd||0xc8;return function(_0x58f43d){if(_0x58f43d){return _0x51a762['status'](_0xe2c3bd)[_0x054a('0x1c')](_0x58f43d);}};}function respondWithFilteredResult(_0x50cadf,_0x30a2c2){return function(_0x44328d){if(_0x44328d){var _0x5ce203=typeof _0x30a2c2['offset']===_0x054a('0x1d')&&typeof _0x30a2c2['limit']===_0x054a('0x1d');var _0x353b54=_0x44328d[_0x054a('0x1e')];var _0x2e79de=_0x5ce203?0x0:_0x30a2c2[_0x054a('0x1f')];var _0x1b0573=_0x5ce203?_0x44328d[_0x054a('0x1e')]:_0x30a2c2[_0x054a('0x1f')]+_0x30a2c2[_0x054a('0x20')];var _0x4a6168;if(_0x1b0573>=_0x353b54){_0x1b0573=_0x353b54;_0x4a6168=0xc8;}else{_0x4a6168=0xce;}_0x50cadf['status'](_0x4a6168);return _0x50cadf['set']('Content-Range',_0x2e79de+'-'+_0x1b0573+'/'+_0x353b54)[_0x054a('0x1c')](_0x44328d);}return null;};}function patchUpdates(_0x704da6){return function(_0x3f7d95){try{jsonpatch[_0x054a('0x21')](_0x3f7d95,_0x704da6,!![]);}catch(_0x2b57aa){return BPromise[_0x054a('0x22')](_0x2b57aa);}return _0x3f7d95['save']();};}function saveUpdates(_0x31d8c5,_0x99689f){return function(_0x5a4754){if(_0x5a4754){return _0x5a4754[_0x054a('0x23')](_0x31d8c5)[_0x054a('0x24')](function(_0xabcd2e){return _0xabcd2e;});}return null;};}function removeEntity(_0x4211e8,_0x131f0f){return function(_0x35ba3c){if(_0x35ba3c){return _0x35ba3c[_0x054a('0x25')]()[_0x054a('0x24')](function(){var _0x3d7b7d=_0x35ba3c[_0x054a('0x26')]({'plain':!![]});var _0x4d16d5=_0x054a('0x27');return db[_0x054a('0x28')]['destroy']({'where':{'type':_0x4d16d5,'resourceId':_0x3d7b7d['id']}})[_0x054a('0x24')](function(){return _0x35ba3c;});})[_0x054a('0x24')](function(){_0x4211e8[_0x054a('0x1a')](0xcc)[_0x054a('0x1b')]();});}};}function handleEntityNotFound(_0x228458,_0x16073f){return function(_0x30c706){if(!_0x30c706){_0x228458[_0x054a('0x19')](0x194);}return _0x30c706;};}function handleError(_0x45a141,_0x264d5b){_0x264d5b=_0x264d5b||0x1f4;return function(_0x116c1d){logger[_0x054a('0x29')](_0x116c1d[_0x054a('0x2a')]);if(_0x116c1d[_0x054a('0x2b')]){delete _0x116c1d[_0x054a('0x2b')];}_0x45a141[_0x054a('0x1a')](_0x264d5b)[_0x054a('0x2c')](_0x116c1d);};}exports[_0x054a('0x2d')]=function(_0x37e790,_0x1fb0cd){var _0x317e49={},_0x418af1={},_0x57ff3f={'count':0x0,'rows':[]};var _0x2a069c=_[_0x054a('0x2e')](db['CmList'][_0x054a('0x2f')],function(_0xc3e4eb){return{'name':_0xc3e4eb[_0x054a('0x30')],'type':_0xc3e4eb[_0x054a('0x31')]['key']};});_0x418af1[_0x054a('0x32')]=_[_0x054a('0x2e')](_0x2a069c,_0x054a('0x2b'));_0x418af1['query']=_[_0x054a('0x33')](_0x37e790[_0x054a('0x34')]);_0x418af1[_0x054a('0x35')]=_[_0x054a('0x36')](_0x418af1['model'],_0x418af1['query']);_0x317e49[_0x054a('0x37')]=_[_0x054a('0x36')](_0x418af1['model'],qs['fields'](_0x37e790[_0x054a('0x34')]['fields']));_0x317e49[_0x054a('0x37')]=_0x317e49[_0x054a('0x37')][_0x054a('0x38')]?_0x317e49[_0x054a('0x37')]:_0x418af1[_0x054a('0x32')];if(!_0x37e790[_0x054a('0x34')][_0x054a('0x39')]('nolimit')){_0x317e49['limit']=qs['limit'](_0x37e790[_0x054a('0x34')]['limit']);_0x317e49[_0x054a('0x1f')]=qs[_0x054a('0x1f')](_0x37e790[_0x054a('0x34')][_0x054a('0x1f')]);}_0x317e49['order']=qs['sort'](_0x37e790[_0x054a('0x34')][_0x054a('0x3a')]);_0x317e49[_0x054a('0x3b')]=qs[_0x054a('0x35')](_[_0x054a('0x3c')](_0x37e790[_0x054a('0x34')],_0x418af1[_0x054a('0x35')]),_0x2a069c);if(_0x37e790[_0x054a('0x34')][_0x054a('0x3d')]){_0x317e49['where']=_[_0x054a('0x3e')](_0x317e49[_0x054a('0x3b')],{'$or':_['map'](_0x2a069c,function(_0x1f08bc){if(_0x1f08bc[_0x054a('0x31')]!==_0x054a('0x3f')){var _0x8fd417={};_0x8fd417[_0x1f08bc[_0x054a('0x2b')]]={'$like':'%'+_0x37e790[_0x054a('0x34')]['filter']+'%'};return _0x8fd417;}})});}_0x317e49=_['merge']({},_0x317e49,_0x37e790[_0x054a('0x40')]);var _0x280060={'where':_0x317e49[_0x054a('0x3b')]};return db[_0x054a('0x41')][_0x054a('0x1e')](_0x280060)['then'](function(_0x46f27b){_0x57ff3f['count']=_0x46f27b;if(_0x37e790[_0x054a('0x34')][_0x054a('0x42')]){_0x317e49[_0x054a('0x43')]=[{'all':!![]}];}return db['CmList'][_0x054a('0x44')](_0x317e49);})[_0x054a('0x24')](function(_0x324846){_0x57ff3f['rows']=_0x324846;return _0x57ff3f;})[_0x054a('0x24')](respondWithFilteredResult(_0x1fb0cd,_0x317e49))[_0x054a('0x45')](handleError(_0x1fb0cd,null));};exports['show']=function(_0x53e482,_0x54f200){var _0x524a1c={'raw':![],'where':{'id':_0x53e482[_0x054a('0x46')]['id']}},_0x36399c={};_0x36399c[_0x054a('0x32')]=_['keys'](db['CmList']['rawAttributes']);_0x36399c[_0x054a('0x34')]=_[_0x054a('0x33')](_0x53e482[_0x054a('0x34')]);_0x36399c[_0x054a('0x35')]=_[_0x054a('0x36')](_0x36399c[_0x054a('0x32')],_0x36399c[_0x054a('0x34')]);_0x524a1c[_0x054a('0x37')]=_[_0x054a('0x36')](_0x36399c[_0x054a('0x32')],qs['fields'](_0x53e482[_0x054a('0x34')][_0x054a('0x47')]));_0x524a1c['attributes']=_0x524a1c[_0x054a('0x37')][_0x054a('0x38')]?_0x524a1c[_0x054a('0x37')]:_0x36399c[_0x054a('0x32')];if(_0x53e482[_0x054a('0x34')][_0x054a('0x42')]){_0x524a1c[_0x054a('0x43')]=[{'all':!![]}];}_0x524a1c=_[_0x054a('0x3e')]({},_0x524a1c,_0x53e482[_0x054a('0x40')]);return db[_0x054a('0x41')][_0x054a('0x48')](_0x524a1c)['then'](handleEntityNotFound(_0x54f200,null))[_0x054a('0x24')](respondWithResult(_0x54f200,null))[_0x054a('0x45')](handleError(_0x54f200,null));};exports[_0x054a('0x49')]=function(_0x5babba,_0x3fa9bf){return db[_0x054a('0x41')][_0x054a('0x49')](_0x5babba[_0x054a('0x4a')],{})[_0x054a('0x24')](function(_0x354af4){var _0x133cf8=_0x5babba[_0x054a('0x4b')][_0x054a('0x26')]({'plain':!![]});if(!_0x133cf8)throw new Error(_0x054a('0x4c'));if(_0x133cf8[_0x054a('0x4d')]===_0x054a('0x4b')){var _0x57065e=_0x354af4[_0x054a('0x26')]({'plain':!![]});var _0x35fbb6=_0x054a('0x27');return db['UserProfileSection'][_0x054a('0x48')]({'where':{'name':_0x35fbb6,'userProfileId':_0x133cf8['userProfileId']},'raw':!![]})[_0x054a('0x24')](function(_0x22e385){if(_0x22e385&&_0x22e385[_0x054a('0x4e')]===0x0){return db[_0x054a('0x28')]['create']({'name':_0x57065e[_0x054a('0x2b')],'resourceId':_0x57065e['id'],'type':_0x22e385[_0x054a('0x2b')],'sectionId':_0x22e385['id']},{})[_0x054a('0x24')](function(){return _0x354af4;});}else{return _0x354af4;}})[_0x054a('0x45')](function(_0x5319b4){logger[_0x054a('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5319b4);throw _0x5319b4;});}return _0x354af4;})[_0x054a('0x24')](respondWithResult(_0x3fa9bf,0xc9))[_0x054a('0x45')](handleError(_0x3fa9bf,null));};exports['update']=function(_0x31374e,_0x3d814d){if(_0x31374e[_0x054a('0x4a')]['id']){delete _0x31374e['body']['id'];}return db['CmList'][_0x054a('0x48')]({'where':{'id':_0x31374e['params']['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x3d814d,null))['then'](saveUpdates(_0x31374e[_0x054a('0x4a')],null))['then'](respondWithResult(_0x3d814d,null))[_0x054a('0x45')](handleError(_0x3d814d,null));};exports[_0x054a('0x25')]=function(_0x40bee6,_0x12e341){return db[_0x054a('0x41')][_0x054a('0x48')]({'where':{'id':_0x40bee6[_0x054a('0x46')]['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x12e341,null))[_0x054a('0x24')](removeEntity(_0x12e341,null))[_0x054a('0x45')](handleError(_0x12e341,null));};exports[_0x054a('0x4f')]=function(_0x1d6656,_0x5a82e1){return db[_0x054a('0x41')][_0x054a('0x4f')]()[_0x054a('0x24')](respondWithResult(_0x5a82e1,null))[_0x054a('0x45')](handleError(_0x5a82e1,null));};exports[_0x054a('0x50')]=function(_0x5b403e,_0x5ecfac,_0xe51916){if(_0x5b403e[_0x054a('0x4a')]['id']){delete _0x5b403e[_0x054a('0x4a')]['id'];}return db[_0x054a('0x41')]['find']({'where':{'id':_0x5b403e[_0x054a('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ecfac,null))[_0x054a('0x24')](function(_0x4de720){if(_0x4de720){_0x5b403e['body'][_0x054a('0x51')]=_0x4de720['id'];return db[_0x054a('0x52')][_0x054a('0x49')](_0x5b403e[_0x054a('0x4a')]);}})[_0x054a('0x24')](respondWithResult(_0x5ecfac,null))[_0x054a('0x45')](handleError(_0x5ecfac,null));};exports[_0x054a('0x53')]=function(_0xc0e1ae,_0x51eded,_0x17140a){var _0x38958e={'raw':![],'where':{}};var _0x5753b3={};var _0x50f8e6={'count':0x0,'rows':[]};return db['CmList'][_0x054a('0x54')]({'where':{'id':_0xc0e1ae['params']['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x51eded,null))[_0x054a('0x24')](function(_0x20ef53){if(_0x20ef53){_0x5753b3[_0x054a('0x32')]=_[_0x054a('0x33')](db[_0x054a('0x52')][_0x054a('0x2f')]);_0x5753b3[_0x054a('0x34')]=_[_0x054a('0x33')](_0xc0e1ae[_0x054a('0x34')]);_0x5753b3[_0x054a('0x35')]=_[_0x054a('0x36')](_0x5753b3['model'],_0x5753b3[_0x054a('0x34')]);_0x38958e[_0x054a('0x37')]=_[_0x054a('0x36')](_0x5753b3[_0x054a('0x32')],qs[_0x054a('0x47')](_0xc0e1ae[_0x054a('0x34')][_0x054a('0x47')]));_0x38958e['attributes']=_0x38958e[_0x054a('0x37')][_0x054a('0x38')]?_0x38958e[_0x054a('0x37')]:_0x5753b3[_0x054a('0x32')];if(!_0xc0e1ae[_0x054a('0x34')]['hasOwnProperty'](_0x054a('0x55'))){_0x38958e['limit']=qs[_0x054a('0x20')](_0xc0e1ae[_0x054a('0x34')][_0x054a('0x20')]);_0x38958e[_0x054a('0x1f')]=qs[_0x054a('0x1f')](_0xc0e1ae[_0x054a('0x34')][_0x054a('0x1f')]);}_0x38958e[_0x054a('0x56')]=qs[_0x054a('0x3a')](_0xc0e1ae[_0x054a('0x34')][_0x054a('0x3a')]);_0x38958e[_0x054a('0x3b')]=qs[_0x054a('0x35')](_[_0x054a('0x3c')](_0xc0e1ae[_0x054a('0x34')],_0x5753b3['filters']));_0x38958e[_0x054a('0x3b')][_0x054a('0x51')]=_0x20ef53['id'];if(_0xc0e1ae[_0x054a('0x34')][_0x054a('0x3d')]){_0x38958e[_0x054a('0x3b')]=_[_0x054a('0x3e')](_0x38958e['where'],{'$or':_['map'](_0x38958e[_0x054a('0x37')],function(_0xd14a1c){var _0x2bc0fd={};_0x2bc0fd[_0xd14a1c]={'$like':'%'+_0xc0e1ae[_0x054a('0x34')]['filter']+'%'};return _0x2bc0fd;})});}_0x38958e=_[_0x054a('0x3e')]({},_0x38958e,_0xc0e1ae[_0x054a('0x40')]);return db['Disposition'][_0x054a('0x1e')]({'where':_0x38958e['where']})['then'](function(_0x196f3e){_0x50f8e6[_0x054a('0x1e')]=_0x196f3e;if(_0xc0e1ae[_0x054a('0x34')]['includeAll']){_0x38958e[_0x054a('0x43')]=[{'all':!![]}];}return db[_0x054a('0x52')]['findAll'](_0x38958e);})[_0x054a('0x24')](function(_0x15b6ce){_0x50f8e6['rows']=_0x15b6ce;return _0x50f8e6;});}})[_0x054a('0x24')](respondWithFilteredResult(_0x51eded,_0x38958e))[_0x054a('0x45')](handleError(_0x51eded,null));};exports['removeDispositions']=function(_0x4f7ee8,_0x58b6e7,_0x332887){return db[_0x054a('0x41')]['find']({'where':{'id':_0x4f7ee8[_0x054a('0x46')]['id']}})['then'](handleEntityNotFound(_0x58b6e7,null))['then'](function(_0x52f4e2){if(_0x52f4e2){return _0x52f4e2[_0x054a('0x57')](_0x4f7ee8['query'][_0x054a('0x58')]);}})[_0x054a('0x24')](respondWithStatusCode(_0x58b6e7,null))[_0x054a('0x45')](handleError(_0x58b6e7,null));};exports['addContacts']=function(_0x41347e,_0x557321,_0x450ddc){return db['CmList']['find']({'where':{'id':_0x41347e[_0x054a('0x46')]['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x557321,null))['then'](function(_0x5493ba){if(_0x5493ba){var _0xd091b2=[];var _0x406732={'success':[],'errors':[]};return db[_0x054a('0x59')][_0x054a('0x4f')]()[_0x054a('0x24')](function(_0x15a6a6){if(_0x41347e[_0x054a('0x4a')][_0x054a('0x5a')]&&_['isArray'](_0x41347e[_0x054a('0x4a')]['tags'])){if(_0x41347e[_0x054a('0x4a')]['tags'][_0x054a('0x38')]){_0x41347e[_0x054a('0x4a')][_0x054a('0x5a')]=_0x41347e['body']['tags'][_0x054a('0x5b')](';')+';';}else{_0x41347e[_0x054a('0x4a')][_0x054a('0x5a')]=null;}}else{_0x41347e['body'][_0x054a('0x5a')]=null;}if(_0x41347e[_0x054a('0x4a')]&&_[_0x054a('0x5c')](_0x41347e[_0x054a('0x4a')])){for(var _0x5d4672=0x0;_0x5d4672<_0x41347e[_0x054a('0x4a')][_0x054a('0x38')];_0x5d4672+=0x1){_0x41347e['body'][_0x5d4672][_0x054a('0x51')]=_0x41347e[_0x054a('0x46')]['id'];_0xd091b2[_0x054a('0x5d')](_0x41347e[_0x054a('0x4a')][_0x5d4672]);}return BPromise[_0x054a('0x5e')](_0xd091b2,function(_0x4bb0e6){return db[_0x054a('0x59')]['create'](_['omit'](_0x4bb0e6,[_0x054a('0x58'),'id'])||{},{'fields':_[_0x054a('0x33')](_0x15a6a6),'raw':!![]})[_0x054a('0x24')](function(_0x1d13d3){_0x406732['success']['push'](_0x1d13d3[_0x054a('0x5f')]);})[_0x054a('0x45')](function(_0x5a8141){_0x406732[_0x054a('0x60')]['push']({'data':_0x4bb0e6,'error':_0x5a8141[_0x054a('0x61')]});});})[_0x054a('0x24')](function(_0x5798fb){return _0x406732;})[_0x054a('0x45')](function(_0x2708bd){return _0x2708bd;});}else{_0x557321['status'](0x190)[_0x054a('0x1c')]({'message':_0x054a('0x62')});}});}})[_0x054a('0x24')](respondWithResult(_0x557321,null))['catch'](handleError(_0x557321,null));};exports[_0x054a('0x63')]=function(_0x549ed1,_0x1e6af3,_0xbddd9e){var _0x45a2eb;return db[_0x054a('0x41')]['find']({'where':{'id':_0x549ed1['params']['id']},'include':[{'model':db['CmCustomField'],'as':_0x054a('0x64')}]})[_0x054a('0x24')](handleEntityNotFound(_0x1e6af3,null))[_0x054a('0x24')](function(_0x40305d){if(_0x40305d){_0x45a2eb=_0x40305d;return db[_0x054a('0x59')][_0x054a('0x2f')];}})[_0x054a('0x24')](function(_0x576715){if(_0x576715){var _0x365ab3={};var _0x235485={};_0x235485[_0x054a('0x32')]=_['concat'](_[_0x054a('0x33')](_0x576715),_[_0x054a('0x2e')](_0x45a2eb['CustomFields'],function(_0x5c26ba){return util[_0x054a('0x65')](_0x054a('0x66'),_0x5c26ba['id']);}));_0x235485[_0x054a('0x34')]=_[_0x054a('0x33')](_0x549ed1['query']);_0x235485['filters']=_[_0x054a('0x36')](_0x235485[_0x054a('0x32')],_0x235485[_0x054a('0x34')]);_0x365ab3[_0x054a('0x37')]=_[_0x054a('0x36')](_0x235485['model'],qs['fields'](_0x549ed1['query'][_0x054a('0x47')]));_0x365ab3['attributes']=_0x365ab3[_0x054a('0x37')][_0x054a('0x38')]?_0x365ab3['attributes']:_0x235485[_0x054a('0x32')];if(!_0x549ed1['query'][_0x054a('0x39')](_0x054a('0x55'))){_0x365ab3[_0x054a('0x20')]=qs['limit'](_0x549ed1[_0x054a('0x34')][_0x054a('0x20')]);_0x365ab3[_0x054a('0x1f')]=qs[_0x054a('0x1f')](_0x549ed1[_0x054a('0x34')][_0x054a('0x1f')]);}_0x365ab3[_0x054a('0x56')]=qs[_0x054a('0x3a')](_0x549ed1['query'][_0x054a('0x3a')]);_0x365ab3[_0x054a('0x3b')]=qs[_0x054a('0x35')](_['pick'](_0x549ed1['query'],_0x235485[_0x054a('0x35')]));_0x365ab3[_0x054a('0x67')]=!![];if(_0x549ed1[_0x054a('0x34')][_0x054a('0x3d')]){_0x365ab3[_0x054a('0x3b')]=_[_0x054a('0x3e')](_0x365ab3[_0x054a('0x3b')],{'$or':_[_0x054a('0x2e')](_0x365ab3[_0x054a('0x37')],function(_0x31d1f4){var _0xe36391={};_0xe36391[_0x31d1f4]={'$like':'%'+_0x549ed1[_0x054a('0x34')][_0x054a('0x3d')]+'%'};return _0xe36391;})});}_0x365ab3=_[_0x054a('0x3e')]({},_0x365ab3,_0x549ed1[_0x054a('0x40')]);return _0x45a2eb[_0x054a('0x63')](_0x365ab3);}})[_0x054a('0x24')](respondWithResult(_0x1e6af3,null))[_0x054a('0x45')](handleError(_0x1e6af3,null));};exports[_0x054a('0x68')]=function(_0x19d71b,_0x58522f,_0x4d0a9d){var _0x43aebd;return db[_0x054a('0x41')]['find']({'where':{'id':_0x19d71b[_0x054a('0x46')]['id']},'include':[{'model':db[_0x054a('0x69')],'as':_0x054a('0x64')}]})['then'](handleEntityNotFound(_0x58522f,null))[_0x054a('0x24')](function(_0x43a4f5){if(_0x43a4f5){_0x43aebd=_0x43a4f5;return db[_0x054a('0x59')][_0x054a('0x2f')];}})[_0x054a('0x24')](function(_0x3e70e3){if(_0x3e70e3){var _0x2919e2={};var _0x7de892={};_0x7de892[_0x054a('0x32')]=_[_0x054a('0x6a')](_[_0x054a('0x33')](_0x3e70e3),_[_0x054a('0x2e')](_0x43aebd[_0x054a('0x64')],function(_0x11e2b2){return util[_0x054a('0x65')]('cf_%d',_0x11e2b2['id']);}));_0x7de892[_0x054a('0x34')]=_[_0x054a('0x33')](_0x19d71b[_0x054a('0x34')]);_0x7de892[_0x054a('0x35')]=_[_0x054a('0x36')](_0x7de892[_0x054a('0x32')],_0x7de892[_0x054a('0x34')]);_0x2919e2['attributes']=_[_0x054a('0x36')](_0x7de892[_0x054a('0x32')],qs[_0x054a('0x47')](_0x19d71b['query'][_0x054a('0x47')]));_0x2919e2[_0x054a('0x37')]=_0x2919e2[_0x054a('0x37')][_0x054a('0x38')]?_0x2919e2[_0x054a('0x37')]:_0x7de892[_0x054a('0x32')];if(!_0x19d71b[_0x054a('0x34')]['hasOwnProperty']('nolimit')){_0x2919e2[_0x054a('0x20')]=qs[_0x054a('0x20')](_0x19d71b[_0x054a('0x34')][_0x054a('0x20')]);_0x2919e2[_0x054a('0x1f')]=qs[_0x054a('0x1f')](_0x19d71b[_0x054a('0x34')][_0x054a('0x1f')]);}_0x2919e2[_0x054a('0x56')]=qs[_0x054a('0x3a')](_0x19d71b['query'][_0x054a('0x3a')]);_0x2919e2['where']=qs[_0x054a('0x35')](_[_0x054a('0x3c')](_0x19d71b[_0x054a('0x34')],_0x7de892['filters']));_0x2919e2[_0x054a('0x67')]=!![];if(_0x19d71b[_0x054a('0x34')][_0x054a('0x3d')]){_0x2919e2[_0x054a('0x3b')]=_[_0x054a('0x3e')](_0x2919e2[_0x054a('0x3b')],{'$or':_[_0x054a('0x2e')](_0x2919e2[_0x054a('0x37')],function(_0x48ef39){var _0x283bbd={};_0x283bbd[_0x48ef39]={'$like':'%'+_0x19d71b['query'][_0x054a('0x3d')]+'%'};return _0x283bbd;})});}_0x2919e2=_['merge']({},_0x2919e2,_0x19d71b[_0x054a('0x40')]);return _0x43aebd[_0x054a('0x63')](_0x2919e2);}})[_0x054a('0x24')](function(_0x37f37f){if(!_[_0x054a('0x6b')](_0x37f37f)){var _0x1cd573=toCsv(_0x37f37f);var _0x175812=Date[_0x054a('0x6c')]();fs['writeFileSync'](util[_0x054a('0x65')](_0x054a('0x6d'),_0x43aebd['id'],_0x175812),_0x1cd573);_0x58522f[_0x054a('0x6e')]('Content-disposition',_0x054a('0x6f')+util[_0x054a('0x65')](_0x054a('0x70'),_0x43aebd['id'],_0x175812));_0x58522f[_0x054a('0x6e')](_0x054a('0x71'),_0x054a('0x72'));return _0x58522f['download'](util[_0x054a('0x65')](_0x054a('0x6d'),_0x43aebd['id'],_0x175812));}else{return _0x58522f['sendStatus'](0xcc);}})[_0x054a('0x45')](handleError(_0x58522f,null));};exports[_0x054a('0x73')]=function(_0x4e7093,_0x2bcd91,_0x30b710){var _0x185c23;delete _0x4e7093[_0x054a('0x4a')]['id'];return db[_0x054a('0x41')][_0x054a('0x54')]({'where':{'id':_0x4e7093[_0x054a('0x46')]['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x2bcd91,null))[_0x054a('0x24')](function(_0x3d0fae){if(_0x3d0fae){return db[_0x054a('0x74')][_0x054a('0x75')](function(_0x1eb013){return db[_0x054a('0x69')][_0x054a('0x49')](_0x4e7093[_0x054a('0x4a')],{'transaction':_0x1eb013})[_0x054a('0x24')](function(_0x372085){_0x185c23=_0x372085;return _0x3d0fae[_0x054a('0x76')](_0x372085,{'transaction':_0x1eb013});})[_0x054a('0x24')](function(){var _0x27edd2={'type':db['Sequelize'][_0x054a('0x77')],'transaction':_0x1eb013};switch(_0x4e7093[_0x054a('0x4a')][_0x054a('0x31')]){case _0x054a('0x78'):_0x27edd2[_0x054a('0x31')]=db['Sequelize']['TEXT'];break;case'number':_0x27edd2[_0x054a('0x31')]=db['Sequelize'][_0x054a('0x79')];break;case _0x054a('0x7a'):_0x27edd2[_0x054a('0x31')]=db[_0x054a('0x7b')][_0x054a('0x7c')];_0x27edd2[_0x054a('0x7d')]=![];break;default:}return db['sequelize'][_0x054a('0x7e')][_0x054a('0x7f')](_0x054a('0x80'),util[_0x054a('0x65')](_0x054a('0x81'),_0x185c23['id']),_0x27edd2);})[_0x054a('0x24')](function(){return _0x185c23;});});}})[_0x054a('0x24')](respondWithResult(_0x2bcd91,null))[_0x054a('0x45')](handleError(_0x2bcd91,null));};exports['getCustomFields']=function(_0x59440a,_0x34581e,_0x36f289){var _0x49e3e8={};var _0x2232fc={};var _0x49b553;var _0xabd202;return db['CmList']['findOne']({'where':{'id':_0x59440a[_0x054a('0x46')]['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x34581e,null))[_0x054a('0x24')](function(_0x237ce6){if(_0x237ce6){_0x49b553=_0x237ce6;_0x2232fc['model']=_[_0x054a('0x33')](db[_0x054a('0x69')]['rawAttributes']);_0x2232fc[_0x054a('0x34')]=_[_0x054a('0x33')](_0x59440a[_0x054a('0x34')]);_0x2232fc['filters']=_[_0x054a('0x36')](_0x2232fc[_0x054a('0x32')],_0x2232fc[_0x054a('0x34')]);_0x49e3e8['attributes']=_[_0x054a('0x36')](_0x2232fc[_0x054a('0x32')],qs['fields'](_0x59440a[_0x054a('0x34')][_0x054a('0x47')]));_0x49e3e8[_0x054a('0x37')]=_0x49e3e8['attributes'][_0x054a('0x38')]?_0x49e3e8[_0x054a('0x37')]:_0x2232fc[_0x054a('0x32')];_0x49e3e8[_0x054a('0x56')]=qs[_0x054a('0x3a')](_0x59440a['query'][_0x054a('0x3a')]);_0x49e3e8[_0x054a('0x3b')]=qs[_0x054a('0x35')](_['pick'](_0x59440a[_0x054a('0x34')],_0x2232fc[_0x054a('0x35')]));_0x49e3e8[_0x054a('0x3b')]=_[_0x054a('0x3e')](_0x49e3e8['where'],{'$or':[{'ListId':_0x237ce6['id']},{'ListId':null}]});if(_0x59440a[_0x054a('0x34')][_0x054a('0x3d')]){_0x49e3e8['where']=_[_0x054a('0x3e')](_0x49e3e8[_0x054a('0x3b')],{'$or':_[_0x054a('0x2e')](_0x49e3e8[_0x054a('0x37')],function(_0x597431){var _0xbb440c={};_0xbb440c[_0x597431]={'$like':'%'+_0x59440a[_0x054a('0x34')][_0x054a('0x3d')]+'%'};return _0xbb440c;})});}_0x49e3e8=_[_0x054a('0x3e')]({},_0x49e3e8,_0x59440a['options']);return db[_0x054a('0x69')]['findAndCountAll'](_0x49e3e8);}})[_0x054a('0x24')](respondWithResult(_0x34581e,null))[_0x054a('0x45')](handleError(_0x34581e,null));};exports['addAgents']=function(_0x2778da,_0xfe5e22,_0x23b253){return db['CmList'][_0x054a('0x48')]({'where':{'id':_0x2778da[_0x054a('0x46')]['id']}})[_0x054a('0x24')](handleEntityNotFound(_0xfe5e22,null))[_0x054a('0x24')](function(_0x51ced4){if(_0x51ced4){return _0x51ced4[_0x054a('0x82')](_0x2778da[_0x054a('0x4a')][_0x054a('0x58')],_[_0x054a('0x83')](_0x2778da[_0x054a('0x4a')],[_0x054a('0x58'),'id'])||{})[_0x054a('0x84')](function(_0x3ae523){for(var _0x22fe95=0x0;_0x22fe95<_0x2778da[_0x054a('0x4a')][_0x054a('0x58')][_0x054a('0x38')];_0x22fe95+=0x1){socket[_0x054a('0x85')](_0x054a('0x86'),{'UserId':Number(_0x2778da['body'][_0x054a('0x58')][_0x22fe95]),'CmListId':Number(_0x2778da[_0x054a('0x46')]['id'])});}return _0x3ae523;});}})[_0x054a('0x24')](respondWithResult(_0xfe5e22,null))[_0x054a('0x45')](handleError(_0xfe5e22,null));};exports[_0x054a('0x87')]=function(_0x29492b,_0x1bab88,_0x360b5c){return db[_0x054a('0x41')][_0x054a('0x48')]({'where':{'id':_0x29492b[_0x054a('0x46')]['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x1bab88,null))[_0x054a('0x24')](function(_0x215657){if(_0x215657){return _0x215657[_0x054a('0x87')](_0x29492b[_0x054a('0x34')][_0x054a('0x58')])[_0x054a('0x24')](function(){if(_[_0x054a('0x5c')](_0x29492b[_0x054a('0x34')][_0x054a('0x58')])){for(var _0x5114f1=0x0;_0x5114f1<_0x29492b[_0x054a('0x34')][_0x054a('0x58')][_0x054a('0x38')];_0x5114f1+=0x1){socket['emit'](_0x054a('0x88'),{'UserId':Number(_0x29492b[_0x054a('0x34')]['ids'][_0x5114f1]),'CmListId':Number(_0x29492b[_0x054a('0x46')]['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x29492b[_0x054a('0x34')]['ids']),'CmListId':Number(_0x29492b[_0x054a('0x46')]['id'])});}});}})[_0x054a('0x24')](respondWithStatusCode(_0x1bab88,null))[_0x054a('0x45')](handleError(_0x1bab88,null));};exports['getAgents']=function(_0x42bbee,_0x569b2d,_0x1898a8){var _0x3cc83e={};var _0x521e1e={};var _0x4c8e6d;var _0x2b4470;return db[_0x054a('0x41')][_0x054a('0x54')]({'where':{'id':_0x42bbee[_0x054a('0x46')]['id']}})[_0x054a('0x24')](handleEntityNotFound(_0x569b2d,null))[_0x054a('0x24')](function(_0x48b780){if(_0x48b780){_0x4c8e6d=_0x48b780;_0x521e1e[_0x054a('0x32')]=_[_0x054a('0x33')](db['User'][_0x054a('0x2f')]);_0x521e1e['query']=_['keys'](_0x42bbee[_0x054a('0x34')]);_0x521e1e[_0x054a('0x35')]=_[_0x054a('0x36')](_0x521e1e[_0x054a('0x32')],_0x521e1e['query']);_0x3cc83e[_0x054a('0x37')]=_['intersection'](_0x521e1e[_0x054a('0x32')],qs[_0x054a('0x47')](_0x42bbee[_0x054a('0x34')][_0x054a('0x47')]));_0x3cc83e[_0x054a('0x37')]=_0x3cc83e[_0x054a('0x37')][_0x054a('0x38')]?_0x3cc83e[_0x054a('0x37')]:_0x521e1e[_0x054a('0x32')];_0x3cc83e[_0x054a('0x56')]=qs[_0x054a('0x3a')](_0x42bbee['query'][_0x054a('0x3a')]);_0x3cc83e[_0x054a('0x3b')]=qs[_0x054a('0x35')](_[_0x054a('0x3c')](_0x42bbee[_0x054a('0x34')],_0x521e1e[_0x054a('0x35')]));if(_0x42bbee['query'][_0x054a('0x3d')]){_0x3cc83e['where']=_[_0x054a('0x3e')](_0x3cc83e[_0x054a('0x3b')],{'$or':_['map'](_0x3cc83e['attributes'],function(_0xf1c74b){var _0x267b06={};_0x267b06[_0xf1c74b]={'$like':'%'+_0x42bbee[_0x054a('0x34')]['filter']+'%'};return _0x267b06;})});}_0x3cc83e=_[_0x054a('0x3e')]({},_0x3cc83e,_0x42bbee[_0x054a('0x40')]);return _0x4c8e6d[_0x054a('0x89')](_0x3cc83e);}})[_0x054a('0x24')](function(_0x1303cd){if(_0x1303cd){_0x2b4470=_0x1303cd[_0x054a('0x38')];if(!_0x42bbee[_0x054a('0x34')]['hasOwnProperty'](_0x054a('0x55'))){_0x3cc83e[_0x054a('0x20')]=qs[_0x054a('0x20')](_0x42bbee['query'][_0x054a('0x20')]);_0x3cc83e[_0x054a('0x1f')]=qs[_0x054a('0x1f')](_0x42bbee[_0x054a('0x34')][_0x054a('0x1f')]);}return _0x4c8e6d[_0x054a('0x89')](_0x3cc83e);}})[_0x054a('0x24')](function(_0x47ed3b){if(_0x47ed3b){return _0x47ed3b?{'count':_0x2b4470,'rows':_0x47ed3b}:null;}})[_0x054a('0x24')](respondWithResult(_0x569b2d,null))[_0x054a('0x45')](handleError(_0x569b2d,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index f9fe993..5e7a076 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x5a7282,_0xa6e195){var _0x4928ec=function(_0x55594b){while(--_0x55594b){_0x5a7282['push'](_0x5a7282['shift']());}};_0x4928ec(++_0xa6e195);}(_0x814b,0x1a2));var _0xb814=function(_0x2b9d5c,_0x173518){_0x2b9d5c=_0x2b9d5c-0x0;var _0x37bb93=_0x814b[_0x2b9d5c];return _0x37bb93;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x2acbb3,_0x29e1b4){var _0x5c0cc7=function(_0x48c6a5){while(--_0x48c6a5){_0x2acbb3['push'](_0x2acbb3['shift']());}};_0x5c0cc7(++_0x29e1b4);}(_0x814b,0x1a2));var _0xb814=function(_0x2085f3,_0x50105b){_0x2085f3=_0x2085f3-0x0;var _0x384e3c=_0x814b[_0x2085f3];return _0x384e3c;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 1fcb958..104f414 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 _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x2aa980,_0x40a9c2){var _0x5d08b9=function(_0x53af64){while(--_0x53af64){_0x2aa980['push'](_0x2aa980['shift']());}};_0x5d08b9(++_0x40a9c2);}(_0xb821,0xa7));var _0x1b82=function(_0x393937,_0x36cc42){_0x393937=_0x393937-0x0;var _0x1cd074=_0xb821[_0x393937];return _0x1cd074;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ea3=['CmList','cm_lists','lodash','util','../../config/logger','api','bluebird','path','./cmList.attributes','exports','define'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0x4ea3,0x70));var _0x34ea=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ea3[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var logger=require(_0x34ea('0x2'))(_0x34ea('0x3'));var moment=require('moment');var BPromise=require(_0x34ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34ea('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x34ea('0x6'));module[_0x34ea('0x7')]=function(_0x962596,_0x123d48){return _0x962596[_0x34ea('0x8')](_0x34ea('0x9'),attributes,{'tableName':_0x34ea('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 b43e96a..116f069 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 _0x490d=['defaults','localhost','socket.io-emitter','register','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis'];(function(_0x1d6a78,_0x43772b){var _0x1db9d7=function(_0x4d8a40){while(--_0x4d8a40){_0x1d6a78['push'](_0x1d6a78['shift']());}};_0x1db9d7(++_0x43772b);}(_0x490d,0xcd));var _0xd490=function(_0x19e326,_0x5730d2){_0x19e326=_0x19e326-0x0;var _0x1e896b=_0x490d[_0x19e326];return _0x1e896b;};'use strict';var _=require(_0xd490('0x0'));var util=require(_0xd490('0x1'));var moment=require(_0xd490('0x2'));var BPromise=require(_0xd490('0x3'));var rs=require(_0xd490('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd490('0x5'))['db'];var utils=require(_0xd490('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd490('0x7'));var jayson=require(_0xd490('0x8'));var client=jayson['client'][_0xd490('0x9')]({'port':0x232a});config[_0xd490('0xa')]=_[_0xd490('0xb')](config[_0xd490('0xa')],{'host':_0xd490('0xc'),'port':0x18eb});var socket=require(_0xd490('0xd'))(new Redis(config[_0xd490('0xa')]));require('./cmList.socket')[_0xd490('0xe')](socket);function respondWithRpcPromise(_0x61c7d8,_0x1164c9,_0x9fcd97){return new BPromise(function(_0x182c9e,_0x38a672){return client['request'](_0x61c7d8,_0x9fcd97)[_0xd490('0xf')](function(_0xebda96){logger[_0xd490('0x10')](_0xd490('0x11'),_0x1164c9,_0xd490('0x12'));logger[_0xd490('0x13')](_0xd490('0x14'),_0x1164c9,_0xd490('0x12'),JSON[_0xd490('0x15')](_0xebda96));if(_0xebda96[_0xd490('0x16')]){if(_0xebda96[_0xd490('0x16')][_0xd490('0x17')]===0x1f4){logger['error'](_0xd490('0x11'),_0x1164c9,_0xebda96[_0xd490('0x16')][_0xd490('0x18')]);return _0x38a672(_0xebda96['error'][_0xd490('0x18')]);}logger[_0xd490('0x16')](_0xd490('0x11'),_0x1164c9,_0xebda96[_0xd490('0x16')]['message']);return _0x182c9e(_0xebda96[_0xd490('0x16')]['message']);}else{logger[_0xd490('0x10')](_0xd490('0x11'),_0x1164c9,'request\x20sent');_0x182c9e(_0xebda96[_0xd490('0x19')][_0xd490('0x18')]);}})[_0xd490('0x1a')](function(_0x4a8ffa){logger[_0xd490('0x16')](_0xd490('0x11'),_0x1164c9,_0x4a8ffa);_0x38a672(_0x4a8ffa);});});} \ No newline at end of file +var _0xfe48=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults','redis','socket.io-emitter','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xfe48,0x13d));var _0x8fe4=function(_0x206e7c,_0x1d8477){_0x206e7c=_0x206e7c-0x0;var _0x26299f=_0xfe48[_0x206e7c];return _0x26299f;};'use strict';var _=require('lodash');var util=require(_0x8fe4('0x0'));var moment=require(_0x8fe4('0x1'));var BPromise=require(_0x8fe4('0x2'));var rs=require(_0x8fe4('0x3'));var fs=require('fs');var Redis=require(_0x8fe4('0x4'));var db=require(_0x8fe4('0x5'))['db'];var utils=require(_0x8fe4('0x6'));var logger=require(_0x8fe4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8fe4('0x8'));var client=jayson[_0x8fe4('0x9')][_0x8fe4('0xa')]({'port':0x232a});config['redis']=_[_0x8fe4('0xb')](config[_0x8fe4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8fe4('0xd'))(new Redis(config[_0x8fe4('0xc')]));require(_0x8fe4('0xe'))[_0x8fe4('0xf')](socket);function respondWithRpcPromise(_0x50d7ce,_0x3f8a2e,_0x2afb8d){return new BPromise(function(_0x1d5a9d,_0x1b98be){return client[_0x8fe4('0x10')](_0x50d7ce,_0x2afb8d)[_0x8fe4('0x11')](function(_0x443bd1){logger[_0x8fe4('0x12')](_0x8fe4('0x13'),_0x3f8a2e,_0x8fe4('0x14'));logger[_0x8fe4('0x15')](_0x8fe4('0x16'),_0x3f8a2e,_0x8fe4('0x14'),JSON[_0x8fe4('0x17')](_0x443bd1));if(_0x443bd1[_0x8fe4('0x18')]){if(_0x443bd1[_0x8fe4('0x18')][_0x8fe4('0x19')]===0x1f4){logger['error'](_0x8fe4('0x13'),_0x3f8a2e,_0x443bd1[_0x8fe4('0x18')]['message']);return _0x1b98be(_0x443bd1[_0x8fe4('0x18')]['message']);}logger[_0x8fe4('0x18')](_0x8fe4('0x13'),_0x3f8a2e,_0x443bd1[_0x8fe4('0x18')]['message']);return _0x1d5a9d(_0x443bd1[_0x8fe4('0x18')][_0x8fe4('0x1a')]);}else{logger[_0x8fe4('0x12')]('CmList,\x20%s,\x20%s',_0x3f8a2e,'request\x20sent');_0x1d5a9d(_0x443bd1[_0x8fe4('0x1b')]['message']);}})[_0x8fe4('0x1c')](function(_0x48da29){logger[_0x8fe4('0x18')](_0x8fe4('0x13'),_0x3f8a2e,_0x48da29);_0x1b98be(_0x48da29);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 5c46d57..8980c6b 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 _0x9723=['remove','emit','register','cmList:','./cmList.events','save'];(function(_0x2963f2,_0x395f69){var _0x27425d=function(_0x1a74ae){while(--_0x1a74ae){_0x2963f2['push'](_0x2963f2['shift']());}};_0x27425d(++_0x395f69);}(_0x9723,0xac));var _0x3972=function(_0x137da3,_0xa6277a){_0x137da3=_0x137da3-0x0;var _0x1ac46c=_0x9723[_0x137da3];return _0x1ac46c;};'use strict';var CmListEvents=require(_0x3972('0x0'));var events=[_0x3972('0x1'),_0x3972('0x2'),'update'];function createListener(_0x497ebb,_0x7cd32a){return function(_0x1df559){_0x7cd32a[_0x3972('0x3')](_0x497ebb,_0x1df559);};}function removeListener(_0x1d7302,_0xa1be6a){return function(){CmListEvents['removeListener'](_0x1d7302,_0xa1be6a);};}exports[_0x3972('0x4')]=function(_0x58c21f){for(var _0x284a1d=0x0,_0x437518=events['length'];_0x284a1d<_0x437518;_0x284a1d++){var _0x43e92d=events[_0x284a1d];var _0x358576=createListener(_0x3972('0x5')+_0x43e92d,_0x58c21f);CmListEvents['on'](_0x43e92d,_0x358576);}}; \ No newline at end of file +var _0xab21=['register','length','./cmList.events','save','update','removeListener'];(function(_0x4917fd,_0xcdf68c){var _0x152e63=function(_0x245525){while(--_0x245525){_0x4917fd['push'](_0x4917fd['shift']());}};_0x152e63(++_0xcdf68c);}(_0xab21,0x10a));var _0x1ab2=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xab21[_0xc0a3d3];return _0x3386e8;};'use strict';var CmListEvents=require(_0x1ab2('0x0'));var events=[_0x1ab2('0x1'),'remove',_0x1ab2('0x2')];function createListener(_0x35f50a,_0x53077d){return function(_0x5cfd5d){_0x53077d['emit'](_0x35f50a,_0x5cfd5d);};}function removeListener(_0x4c72a9,_0x80beec){return function(){CmListEvents[_0x1ab2('0x3')](_0x4c72a9,_0x80beec);};}exports[_0x1ab2('0x4')]=function(_0x321865){for(var _0x227600=0x0,_0x245408=events[_0x1ab2('0x5')];_0x227600<_0x245408;_0x227600++){var _0x4cff3c=events[_0x227600];var _0x15d56=createListener('cmList:'+_0x4cff3c,_0x321865);CmListEvents['on'](_0x4cff3c,_0x15d56);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 8a8bba7..5d9a50a 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 _0x79d3=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','util','path','connect-timeout','express','Router'];(function(_0x387780,_0x35000a){var _0x894f91=function(_0x3cc263){while(--_0x3cc263){_0x387780['push'](_0x387780['shift']());}};_0x894f91(++_0x35000a);}(_0x79d3,0x13b));var _0x379d=function(_0x412c8f,_0x11ec94){_0x412c8f=_0x412c8f-0x0;var _0x27c005=_0x79d3[_0x412c8f];return _0x27c005;};'use strict';var multer=require('multer');var util=require(_0x379d('0x0'));var path=require(_0x379d('0x1'));var timeout=require(_0x379d('0x2'));var express=require(_0x379d('0x3'));var router=express[_0x379d('0x4')]();var fs_extra=require(_0x379d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x379d('0x6'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0x379d('0x7')]('/',auth[_0x379d('0x8')](),controller[_0x379d('0x9')]);router[_0x379d('0x7')](_0x379d('0xa'),auth['isAuthenticated'](),controller['describe']);router['get'](_0x379d('0xb'),auth[_0x379d('0x8')](),controller[_0x379d('0xc')]);router[_0x379d('0x7')](_0x379d('0xd'),auth[_0x379d('0x8')](),controller[_0x379d('0xe')]);router[_0x379d('0x7')](_0x379d('0xf'),auth[_0x379d('0x8')](),controller[_0x379d('0x10')]);router['get']('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router[_0x379d('0x7')](_0x379d('0x11'),auth[_0x379d('0x8')](),controller[_0x379d('0x12')]);router[_0x379d('0x7')](_0x379d('0x13'),auth['isAuthenticated'](),controller[_0x379d('0x14')]);router[_0x379d('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x379d('0x15')](_0x379d('0xd'),auth['isAuthenticated'](),controller[_0x379d('0x16')]);router['post']('/:id/contacts',auth[_0x379d('0x8')](),controller[_0x379d('0x17')]);router[_0x379d('0x15')](_0x379d('0x11'),auth[_0x379d('0x8')](),controller[_0x379d('0x18')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x379d('0x19')]);router[_0x379d('0x1a')](_0x379d('0xb'),auth[_0x379d('0x8')](),controller[_0x379d('0x1b')]);router[_0x379d('0x1c')](_0x379d('0xb'),auth[_0x379d('0x8')](),controller[_0x379d('0x1d')]);router[_0x379d('0x1c')](_0x379d('0xd'),auth[_0x379d('0x8')](),controller[_0x379d('0x1e')]);router[_0x379d('0x1c')]('/:id/users',auth[_0x379d('0x8')](),controller[_0x379d('0x1f')]);module['exports']=router; \ No newline at end of file +var _0xccf0=['/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','/:id/contacts','addContacts','addCustomField','addAgents','put','delete','destroy','/:id/dispositions','removeDispositions','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','getDispositions'];(function(_0x1422d9,_0x41e85f){var _0x16f49e=function(_0x310f0a){while(--_0x310f0a){_0x1422d9['push'](_0x1422d9['shift']());}};_0x16f49e(++_0x41e85f);}(_0xccf0,0x171));var _0x0ccf=function(_0x392229,_0x569552){_0x392229=_0x392229-0x0;var _0x1ff9b2=_0xccf0[_0x392229];return _0x1ff9b2;};'use strict';var multer=require('multer');var util=require(_0x0ccf('0x0'));var path=require(_0x0ccf('0x1'));var timeout=require(_0x0ccf('0x2'));var express=require('express');var router=express[_0x0ccf('0x3')]();var fs_extra=require(_0x0ccf('0x4'));var auth=require(_0x0ccf('0x5'));var interaction=require(_0x0ccf('0x6'));var config=require(_0x0ccf('0x7'));var controller=require('./cmList.controller');router[_0x0ccf('0x8')]('/',auth[_0x0ccf('0x9')](),controller[_0x0ccf('0xa')]);router[_0x0ccf('0x8')]('/describe',auth[_0x0ccf('0x9')](),controller[_0x0ccf('0xb')]);router[_0x0ccf('0x8')](_0x0ccf('0xc'),auth[_0x0ccf('0x9')](),controller[_0x0ccf('0xd')]);router['get']('/:id/dispositions',auth[_0x0ccf('0x9')](),controller[_0x0ccf('0xe')]);router[_0x0ccf('0x8')]('/:id/contacts',auth[_0x0ccf('0x9')](),controller['getContacts']);router['get'](_0x0ccf('0xf'),auth['isAuthenticated'](),controller[_0x0ccf('0x10')]);router[_0x0ccf('0x8')](_0x0ccf('0x11'),auth[_0x0ccf('0x9')](),controller[_0x0ccf('0x12')]);router['get'](_0x0ccf('0x13'),auth[_0x0ccf('0x9')](),controller['getAgents']);router[_0x0ccf('0x14')]('/',auth[_0x0ccf('0x9')](),controller[_0x0ccf('0x15')]);router[_0x0ccf('0x14')]('/:id/dispositions',auth[_0x0ccf('0x9')](),controller['addDisposition']);router[_0x0ccf('0x14')](_0x0ccf('0x16'),auth[_0x0ccf('0x9')](),controller[_0x0ccf('0x17')]);router[_0x0ccf('0x14')](_0x0ccf('0x11'),auth[_0x0ccf('0x9')](),controller[_0x0ccf('0x18')]);router[_0x0ccf('0x14')](_0x0ccf('0x13'),auth['isAuthenticated'](),controller[_0x0ccf('0x19')]);router[_0x0ccf('0x1a')]('/:id',auth[_0x0ccf('0x9')](),controller['update']);router[_0x0ccf('0x1b')](_0x0ccf('0xc'),auth['isAuthenticated'](),controller[_0x0ccf('0x1c')]);router[_0x0ccf('0x1b')](_0x0ccf('0x1d'),auth[_0x0ccf('0x9')](),controller[_0x0ccf('0x1e')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x0ccf('0x1f')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index bfc3ebf..ec084e6 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 _0x7998=['field','STRING','exports','getDataValue'];(function(_0x153b5c,_0x397518){var _0x28067f=function(_0x2cd95){while(--_0x2cd95){_0x153b5c['push'](_0x153b5c['shift']());}};_0x28067f(++_0x397518);}(_0x7998,0x1c6));var _0x8799=function(_0x2f6734,_0x2657be){_0x2f6734=_0x2f6734-0x0;var _0x2551d7=_0x7998[_0x2f6734];return _0x2551d7;};'use strict';var Sequelize=require('sequelize');module[_0x8799('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x102a8a){return this[_0x8799('0x1')](_0x8799('0x2'));}},'field':{'type':Sequelize[_0x8799('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x8799('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x8799('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x0c78=['exports','VIRTUAL','field','STRING'];(function(_0x17b76e,_0x4724ac){var _0x9a26f6=function(_0x3bca98){while(--_0x3bca98){_0x17b76e['push'](_0x17b76e['shift']());}};_0x9a26f6(++_0x4724ac);}(_0x0c78,0x198));var _0x80c7=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x0c78[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');module[_0x80c7('0x0')]={'name':{'type':Sequelize[_0x80c7('0x1')],'get':function(_0x4fad1c){return this['getDataValue'](_0x80c7('0x2'));}},'field':{'type':Sequelize[_0x80c7('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x80c7('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x80c7('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 85cc48b..8430795 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1d2943,_0x224ebf){var _0x1a588e=function(_0x23c04a){while(--_0x23c04a){_0x1d2943['push'](_0x1d2943['shift']());}};_0x1a588e(++_0x224ebf);}(_0x7a54,0x106));var _0x47a5=function(_0x32ee25,_0x3d6ef6){_0x32ee25=_0x32ee25-0x0;var _0x7b7113=_0x7a54[_0x32ee25];return _0x7b7113;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xb60f98,_0x2665f9){var _0x47dc6a=function(_0x4569c4){while(--_0x4569c4){_0xb60f98['push'](_0xb60f98['shift']());}};_0x47dc6a(++_0x2665f9);}(_0x7a54,0x106));var _0x47a5=function(_0x1c8adf,_0x1b57e3){_0x1c8adf=_0x1c8adf-0x0;var _0x1e6459=_0x7a54[_0x1c8adf];return _0x1e6459;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5a1587a..88e46b1 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 _0xdd7b=['tools_conditions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./condition.attributes','define','Condition'];(function(_0x3b901f,_0x1b1073){var _0xf67dce=function(_0x300b6c){while(--_0x300b6c){_0x3b901f['push'](_0x3b901f['shift']());}};_0xf67dce(++_0x1b1073);}(_0xdd7b,0x121));var _0xbdd7=function(_0x55597d,_0x49222a){_0x55597d=_0x55597d-0x0;var _0x31bd80=_0xdd7b[_0x55597d];return _0x31bd80;};'use strict';var _=require(_0xbdd7('0x0'));var util=require('util');var logger=require(_0xbdd7('0x1'))(_0xbdd7('0x2'));var moment=require(_0xbdd7('0x3'));var BPromise=require(_0xbdd7('0x4'));var rp=require(_0xbdd7('0x5'));var fs=require('fs');var path=require(_0xbdd7('0x6'));var rimraf=require(_0xbdd7('0x7'));var config=require('../../config/environment');var attributes=require(_0xbdd7('0x8'));module['exports']=function(_0xd25bb7,_0x2116a8){return _0xd25bb7[_0xbdd7('0x9')](_0xbdd7('0xa'),attributes,{'tableName':_0xbdd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbe89=['./condition.attributes','Condition','tools_conditions','lodash','util','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbe89,0x174));var _0x9be8=function(_0x4ec233,_0x568d2f){_0x4ec233=_0x4ec233-0x0;var _0x291531=_0xbe89[_0x4ec233];return _0x291531;};'use strict';var _=require(_0x9be8('0x0'));var util=require(_0x9be8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9be8('0x2'));var BPromise=require(_0x9be8('0x3'));var rp=require(_0x9be8('0x4'));var fs=require('fs');var path=require(_0x9be8('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9be8('0x6'));module['exports']=function(_0x3ccc38,_0x19603b){return _0x3ccc38['define'](_0x9be8('0x7'),attributes,{'tableName':_0x9be8('0x8'),'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 14d2d54..3b6ab84 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 _0x1aec=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x14f2fe,_0x1f101b){var _0x2432b7=function(_0x1e8a94){while(--_0x1e8a94){_0x14f2fe['push'](_0x14f2fe['shift']());}};_0x2432b7(++_0x1f101b);}(_0x1aec,0x100));var _0xc1ae=function(_0x301795,_0x148e19){_0x301795=_0x301795-0x0;var _0x30e83a=_0x1aec[_0x301795];return _0x30e83a;};'use strict';var _=require(_0xc1ae('0x0'));var util=require(_0xc1ae('0x1'));var moment=require(_0xc1ae('0x2'));var BPromise=require(_0xc1ae('0x3'));var rs=require(_0xc1ae('0x4'));var fs=require('fs');var Redis=require(_0xc1ae('0x5'));var db=require(_0xc1ae('0x6'))['db'];var utils=require(_0xc1ae('0x7'));var logger=require(_0xc1ae('0x8'))(_0xc1ae('0x9'));var config=require('../../config/environment');var jayson=require(_0xc1ae('0xa'));var client=jayson[_0xc1ae('0xb')][_0xc1ae('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x597f13,_0x379005,_0x2a14bc){return new BPromise(function(_0x45059c,_0x423107){return client[_0xc1ae('0xd')](_0x597f13,_0x2a14bc)['then'](function(_0x273695){logger[_0xc1ae('0xe')](_0xc1ae('0xf'),_0x379005,_0xc1ae('0x10'));logger[_0xc1ae('0x11')]('Condition,\x20%s,\x20%s,\x20%s',_0x379005,_0xc1ae('0x10'),JSON[_0xc1ae('0x12')](_0x273695));if(_0x273695[_0xc1ae('0x13')]){if(_0x273695[_0xc1ae('0x13')]['code']===0x1f4){logger[_0xc1ae('0x13')](_0xc1ae('0xf'),_0x379005,_0x273695[_0xc1ae('0x13')][_0xc1ae('0x14')]);return _0x423107(_0x273695[_0xc1ae('0x13')]['message']);}logger[_0xc1ae('0x13')]('Condition,\x20%s,\x20%s',_0x379005,_0x273695[_0xc1ae('0x13')][_0xc1ae('0x14')]);return _0x45059c(_0x273695[_0xc1ae('0x13')][_0xc1ae('0x14')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x379005,'request\x20sent');_0x45059c(_0x273695[_0xc1ae('0x15')]['message']);}})[_0xc1ae('0x16')](function(_0x185801){logger[_0xc1ae('0x13')](_0xc1ae('0xf'),_0x379005,_0x185801);_0x423107(_0x185801);});});} \ No newline at end of file +var _0x3998=['code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x202d24,_0x5e8641){var _0x2b3a8e=function(_0x4c7c4a){while(--_0x4c7c4a){_0x202d24['push'](_0x202d24['shift']());}};_0x2b3a8e(++_0x5e8641);}(_0x3998,0xd6));var _0x8399=function(_0x399c8a,_0x46f35c){_0x399c8a=_0x399c8a-0x0;var _0x22db77=_0x3998[_0x399c8a];return _0x22db77;};'use strict';var _=require(_0x8399('0x0'));var util=require(_0x8399('0x1'));var moment=require(_0x8399('0x2'));var BPromise=require(_0x8399('0x3'));var rs=require(_0x8399('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8399('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8399('0x6'))(_0x8399('0x7'));var config=require(_0x8399('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8399('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x514500,_0x1ca05b,_0x525c0a){return new BPromise(function(_0x8a57d4,_0x20d3c4){return client['request'](_0x514500,_0x525c0a)[_0x8399('0xa')](function(_0x4f2a97){logger['info'](_0x8399('0xb'),_0x1ca05b,_0x8399('0xc'));logger[_0x8399('0xd')](_0x8399('0xe'),_0x1ca05b,_0x8399('0xc'),JSON[_0x8399('0xf')](_0x4f2a97));if(_0x4f2a97['error']){if(_0x4f2a97[_0x8399('0x10')][_0x8399('0x11')]===0x1f4){logger[_0x8399('0x10')](_0x8399('0xb'),_0x1ca05b,_0x4f2a97[_0x8399('0x10')][_0x8399('0x12')]);return _0x20d3c4(_0x4f2a97[_0x8399('0x10')][_0x8399('0x12')]);}logger['error'](_0x8399('0xb'),_0x1ca05b,_0x4f2a97[_0x8399('0x10')][_0x8399('0x12')]);return _0x8a57d4(_0x4f2a97[_0x8399('0x10')][_0x8399('0x12')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x1ca05b,_0x8399('0xc'));_0x8a57d4(_0x4f2a97[_0x8399('0x13')][_0x8399('0x12')]);}})[_0x8399('0x14')](function(_0x7160a5){logger[_0x8399('0x10')](_0x8399('0xb'),_0x1ca05b,_0x7160a5);_0x20d3c4(_0x7160a5);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 8fe8c8d..d45d8e6 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 _0x2524=['../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','express'];(function(_0x52ed85,_0x5fb114){var _0x1dbf36=function(_0x45d87d){while(--_0x45d87d){_0x52ed85['push'](_0x52ed85['shift']());}};_0x1dbf36(++_0x5fb114);}(_0x2524,0x13e));var _0x4252=function(_0x19fbbe,_0x5d646b){_0x19fbbe=_0x19fbbe-0x0;var _0x250648=_0x2524[_0x19fbbe];return _0x250648;};'use strict';var multer=require(_0x4252('0x0'));var util=require(_0x4252('0x1'));var path=require(_0x4252('0x2'));var timeout=require('connect-timeout');var express=require(_0x4252('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4252('0x4'));var interaction=require(_0x4252('0x5'));var config=require(_0x4252('0x6'));var controller=require(_0x4252('0x7'));router['put']('/:id',auth[_0x4252('0x8')](),controller[_0x4252('0x9')]);router[_0x4252('0xa')](_0x4252('0xb'),auth['isAuthenticated'](),controller[_0x4252('0xc')]);module[_0x4252('0xd')]=router; \ No newline at end of file +var _0x7deb=['destroy','exports','multer','util','path','connect-timeout','express','Router','./condition.controller','/:id','isAuthenticated','update','delete'];(function(_0x1623c8,_0x4112ca){var _0x2e662d=function(_0x2c4f29){while(--_0x2c4f29){_0x1623c8['push'](_0x1623c8['shift']());}};_0x2e662d(++_0x4112ca);}(_0x7deb,0x77));var _0xb7de=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x7deb[_0x102977];return _0x15c466;};'use strict';var multer=require(_0xb7de('0x0'));var util=require(_0xb7de('0x1'));var path=require(_0xb7de('0x2'));var timeout=require(_0xb7de('0x3'));var express=require(_0xb7de('0x4'));var router=express[_0xb7de('0x5')]();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(_0xb7de('0x6'));router['put'](_0xb7de('0x7'),auth[_0xb7de('0x8')](),controller[_0xb7de('0x9')]);router[_0xb7de('0xa')](_0xb7de('0x7'),auth[_0xb7de('0x8')](),controller[_0xb7de('0xb')]);module[_0xb7de('0xc')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 703a260..d0dd3a5 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 _0xe706=['STRING','sequelize','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe706,0xa3));var _0x6e70=function(_0x55ae99,_0x5ab789){_0x55ae99=_0x55ae99-0x0;var _0x4297e1=_0xe706[_0x55ae99];return _0x4297e1;};'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 _0xbaf0=['name','exports','STRING'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 226c5ae..d6ce22e 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 _0x719a=['attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','findOne','length','options','getItems','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','CustomDashboards','UserProfileResource','destroy','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','params','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','includeAll','omit','createdAt','updatedAt','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','attrVoiceQueues','attrSerie1','total','attrSerie2','attrSerie3','web-report'];(function(_0x1aa9ac,_0x4c4c7d){var _0x705dfb=function(_0x187d9e){while(--_0x187d9e){_0x1aa9ac['push'](_0x1aa9ac['shift']());}};_0x705dfb(++_0x4c4c7d);}(_0x719a,0x81));var _0xa719=function(_0xa4ff36,_0x3e673c){_0xa4ff36=_0xa4ff36-0x0;var _0x2772fc=_0x719a[_0xa4ff36];return _0x2772fc;};'use strict';var emlformat=require(_0xa719('0x0'));var rimraf=require(_0xa719('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa719('0x2'));var moment=require(_0xa719('0x3'));var BPromise=require(_0xa719('0x4'));var Mustache=require('mustache');var util=require(_0xa719('0x5'));var path=require(_0xa719('0x6'));var sox=require(_0xa719('0x7'));var csv=require('to-csv');var ejs=require(_0xa719('0x8'));var fs=require('fs');var fs_extra=require(_0xa719('0x9'));var _=require(_0xa719('0xa'));var squel=require(_0xa719('0xb'));var crypto=require(_0xa719('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa719('0xd'));var authService=require(_0xa719('0xe'));var qs=require(_0xa719('0xf'));var as=require(_0xa719('0x10'));var hardwareService=require(_0xa719('0x11'));var logger=require(_0xa719('0x12'))('api');var utils=require(_0xa719('0x13'));var config=require(_0xa719('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa719('0x15'))['db'];config[_0xa719('0x16')]=_['defaults'](config[_0xa719('0x16')],{'host':_0xa719('0x17'),'port':0x18eb});var socket=require(_0xa719('0x18'))(new Redis(config['redis']));require(_0xa719('0x19'))[_0xa719('0x1a')](socket);function respondWithStatusCode(_0xa0087c,_0x47865c){_0x47865c=_0x47865c||0xcc;return function(_0x1fd45d){if(_0x1fd45d){return _0xa0087c[_0xa719('0x1b')](_0x47865c);}return _0xa0087c[_0xa719('0x1c')](_0x47865c)[_0xa719('0x1d')]();};}function respondWithResult(_0x3e5876,_0xaf308b){_0xaf308b=_0xaf308b||0xc8;return function(_0x27ece3){if(_0x27ece3){return _0x3e5876[_0xa719('0x1c')](_0xaf308b)[_0xa719('0x1e')](_0x27ece3);}};}function respondWithFilteredResult(_0x360e60,_0x27108b){return function(_0xf1af9c){if(_0xf1af9c){var _0x4dc52e=typeof _0x27108b[_0xa719('0x1f')]===_0xa719('0x20')&&typeof _0x27108b['limit']===_0xa719('0x20');var _0x1a3ec7=_0xf1af9c[_0xa719('0x21')];var _0xfd6a2b=_0x4dc52e?0x0:_0x27108b[_0xa719('0x1f')];var _0x198db6=_0x4dc52e?_0xf1af9c[_0xa719('0x21')]:_0x27108b[_0xa719('0x1f')]+_0x27108b[_0xa719('0x22')];var _0x3b36f5;if(_0x198db6>=_0x1a3ec7){_0x198db6=_0x1a3ec7;_0x3b36f5=0xc8;}else{_0x3b36f5=0xce;}_0x360e60['status'](_0x3b36f5);return _0x360e60['set']('Content-Range',_0xfd6a2b+'-'+_0x198db6+'/'+_0x1a3ec7)['json'](_0xf1af9c);}return null;};}function patchUpdates(_0x134668){return function(_0x48eba0){try{jsonpatch[_0xa719('0x23')](_0x48eba0,_0x134668,!![]);}catch(_0x296983){return BPromise[_0xa719('0x24')](_0x296983);}return _0x48eba0[_0xa719('0x25')]();};}function saveUpdates(_0x4cc5c7,_0xa816aa){return function(_0x14fa54){if(_0x14fa54){return _0x14fa54[_0xa719('0x26')](_0x4cc5c7)['then'](function(_0x4177db){return _0x4177db;});}return null;};}function removeEntity(_0x46bda7,_0x41c115){return function(_0x528f41){if(_0x528f41){return _0x528f41['destroy']()[_0xa719('0x27')](function(){var _0x392e97=_0x528f41['get']({'plain':!![]});var _0x4980ed=_0xa719('0x28');return db[_0xa719('0x29')][_0xa719('0x2a')]({'where':{'type':_0x4980ed,'resourceId':_0x392e97['id']}})[_0xa719('0x27')](function(){return _0x528f41;});})[_0xa719('0x27')](function(){_0x46bda7[_0xa719('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59352a,_0x1575df){return function(_0x39af03){if(!_0x39af03){_0x59352a['sendStatus'](0x194);}return _0x39af03;};}function handleError(_0x529fbd,_0xac7124){_0xac7124=_0xac7124||0x1f4;return function(_0x5e2a84){logger[_0xa719('0x2b')](_0x5e2a84['stack']);if(_0x5e2a84[_0xa719('0x2c')]){delete _0x5e2a84['name'];}_0x529fbd[_0xa719('0x1c')](_0xac7124)[_0xa719('0x2d')](_0x5e2a84);};}exports[_0xa719('0x2e')]=function(_0x22b445,_0x168641){var _0x196011={},_0x22fb00={},_0xe6b0f9={'count':0x0,'rows':[]};var _0x130898=_[_0xa719('0x2f')](db[_0xa719('0x30')][_0xa719('0x31')],function(_0x265b2b){return{'name':_0x265b2b[_0xa719('0x32')],'type':_0x265b2b[_0xa719('0x33')][_0xa719('0x34')]};});_0x22fb00['model']=_[_0xa719('0x2f')](_0x130898,_0xa719('0x2c'));_0x22fb00[_0xa719('0x35')]=_[_0xa719('0x36')](_0x22b445[_0xa719('0x35')]);_0x22fb00[_0xa719('0x37')]=_['intersection'](_0x22fb00[_0xa719('0x38')],_0x22fb00[_0xa719('0x35')]);_0x196011[_0xa719('0x39')]=_['intersection'](_0x22fb00[_0xa719('0x38')],qs[_0xa719('0x3a')](_0x22b445['query'][_0xa719('0x3a')]));_0x196011[_0xa719('0x39')]=_0x196011['attributes']['length']?_0x196011[_0xa719('0x39')]:_0x22fb00[_0xa719('0x38')];if(!_0x22b445[_0xa719('0x35')][_0xa719('0x3b')](_0xa719('0x3c'))){_0x196011[_0xa719('0x22')]=qs[_0xa719('0x22')](_0x22b445[_0xa719('0x35')]['limit']);_0x196011[_0xa719('0x1f')]=qs[_0xa719('0x1f')](_0x22b445[_0xa719('0x35')][_0xa719('0x1f')]);}_0x196011[_0xa719('0x3d')]=qs[_0xa719('0x3e')](_0x22b445['query'][_0xa719('0x3e')]);_0x196011[_0xa719('0x3f')]=qs[_0xa719('0x37')](_[_0xa719('0x40')](_0x22b445[_0xa719('0x35')],_0x22fb00['filters']),_0x130898);if(_0x22b445[_0xa719('0x35')][_0xa719('0x41')]){_0x196011[_0xa719('0x3f')]=_[_0xa719('0x42')](_0x196011[_0xa719('0x3f')],{'$or':_['map'](_0x130898,function(_0x3995c9){if(_0x3995c9[_0xa719('0x33')]!==_0xa719('0x43')){var _0x2a55d7={};_0x2a55d7[_0x3995c9[_0xa719('0x2c')]]={'$like':'%'+_0x22b445[_0xa719('0x35')][_0xa719('0x41')]+'%'};return _0x2a55d7;}})});}_0x196011=_['merge']({},_0x196011,_0x22b445['options']);var _0xf5993b={'where':_0x196011[_0xa719('0x3f')]};return db[_0xa719('0x30')][_0xa719('0x21')](_0xf5993b)[_0xa719('0x27')](function(_0x385015){_0xe6b0f9[_0xa719('0x21')]=_0x385015;if(_0x22b445[_0xa719('0x35')]['includeAll']){_0x196011[_0xa719('0x44')]=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x196011);})[_0xa719('0x27')](function(_0x20d3ec){_0xe6b0f9[_0xa719('0x45')]=_0x20d3ec;return _0xe6b0f9;})[_0xa719('0x27')](respondWithFilteredResult(_0x168641,_0x196011))[_0xa719('0x46')](handleError(_0x168641,null));};exports['show']=function(_0x1da898,_0x556390){var _0x2302e7={'raw':![],'where':{'id':_0x1da898[_0xa719('0x47')]['id']}},_0x355a80={};_0x355a80['model']=_[_0xa719('0x36')](db['Dashboard'][_0xa719('0x31')]);_0x355a80['query']=_[_0xa719('0x36')](_0x1da898[_0xa719('0x35')]);_0x355a80[_0xa719('0x37')]=_[_0xa719('0x48')](_0x355a80[_0xa719('0x38')],_0x355a80[_0xa719('0x35')]);_0x2302e7[_0xa719('0x39')]=_[_0xa719('0x48')](_0x355a80[_0xa719('0x38')],qs[_0xa719('0x3a')](_0x1da898[_0xa719('0x35')][_0xa719('0x3a')]));_0x2302e7[_0xa719('0x39')]=_0x2302e7[_0xa719('0x39')]['length']?_0x2302e7[_0xa719('0x39')]:_0x355a80['model'];if(_0x1da898[_0xa719('0x35')]['includeAll']){_0x2302e7[_0xa719('0x44')]=[{'all':!![]}];}_0x2302e7=_[_0xa719('0x42')]({},_0x2302e7,_0x1da898['options']);return db[_0xa719('0x30')][_0xa719('0x49')](_0x2302e7)[_0xa719('0x27')](handleEntityNotFound(_0x556390,null))[_0xa719('0x27')](respondWithResult(_0x556390,null))[_0xa719('0x46')](handleError(_0x556390,null));};exports[_0xa719('0x4a')]=function(_0x417bd8,_0xd444c){return db[_0xa719('0x30')]['create'](_0x417bd8[_0xa719('0x4b')],{})[_0xa719('0x27')](function(_0x287517){var _0x121f9f=_0x417bd8[_0xa719('0x4c')][_0xa719('0x4d')]({'plain':!![]});if(!_0x121f9f)throw new Error(_0xa719('0x4e'));if(_0x121f9f[_0xa719('0x4f')]===_0xa719('0x4c')){var _0x16fcc2=_0x287517[_0xa719('0x4d')]({'plain':!![]});var _0x33231f=_0xa719('0x28');return db[_0xa719('0x50')][_0xa719('0x49')]({'where':{'name':_0x33231f,'userProfileId':_0x121f9f[_0xa719('0x51')]},'raw':!![]})[_0xa719('0x27')](function(_0x39b1a3){if(_0x39b1a3&&_0x39b1a3[_0xa719('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x16fcc2[_0xa719('0x2c')],'resourceId':_0x16fcc2['id'],'type':_0x39b1a3[_0xa719('0x2c')],'sectionId':_0x39b1a3['id']},{})['then'](function(){return _0x287517;});}else{return _0x287517;}})[_0xa719('0x46')](function(_0xc944eb){logger['error'](_0xa719('0x53'),_0xc944eb);throw _0xc944eb;});}return _0x287517;})[_0xa719('0x27')](respondWithResult(_0xd444c,0xc9))[_0xa719('0x46')](handleError(_0xd444c,null));};exports['clone']=function(_0x430ccb,_0x19f857){var _0x488494={'where':{'id':_0x430ccb[_0xa719('0x47')]['id']}},_0x38ea62={};_0x38ea62[_0xa719('0x38')]=_[_0xa719('0x36')](db['Dashboard'][_0xa719('0x31')]);_0x488494[_0xa719('0x39')]=_[_0xa719('0x48')](_0x38ea62[_0xa719('0x38')],qs['fields'](_0x430ccb['query'][_0xa719('0x3a')]));_0x488494[_0xa719('0x39')]=_0x488494[_0xa719('0x39')]['length']?_0x488494[_0xa719('0x39')]:_0x38ea62[_0xa719('0x38')];if(_0x430ccb[_0xa719('0x35')][_0xa719('0x54')]){_0x488494[_0xa719('0x44')]=[{'all':!![]}];}_0x488494=_[_0xa719('0x42')]({},_0x488494,_0x430ccb['options']);return db['Dashboard']['find'](_0x488494)[_0xa719('0x27')](handleEntityNotFound(_0x19f857,null))[_0xa719('0x27')](function(_0x580b4d){if(_0x580b4d){var _0x37dfc7=_0x580b4d[_0xa719('0x4d')]({'plain':!![]});_0x37dfc7=qs[_0xa719('0x55')](_0x37dfc7,['id',_0xa719('0x56'),_0xa719('0x57')]);_0x430ccb['body']=_[_0xa719('0x55')](_0x430ccb[_0xa719('0x4b')],['id','createdAt',_0xa719('0x57')]);return db[_0xa719('0x30')][_0xa719('0x4a')](_[_0xa719('0x42')](_0x37dfc7,_0x430ccb[_0xa719('0x4b')]),{'include':_0x430ccb[_0xa719('0x35')][_0xa719('0x54')]?[{'all':!![]}]:undefined})['then'](function(_0x11c81f){var _0x542e39=_0x430ccb['user'][_0xa719('0x4d')]({'plain':!![]});if(!_0x542e39)throw new Error(_0xa719('0x4e'));if(_0x542e39[_0xa719('0x4f')]===_0xa719('0x4c')){var _0xd1f26b=_0x11c81f['get']({'plain':!![]});var _0x3f5891='CustomDashboards';return db[_0xa719('0x50')][_0xa719('0x49')]({'where':{'name':_0x3f5891,'userProfileId':_0x542e39['userProfileId']},'raw':!![]})[_0xa719('0x27')](function(_0x47ac45){if(_0x47ac45&&_0x47ac45['autoAssociation']===0x0){return db['UserProfileResource'][_0xa719('0x4a')]({'name':_0xd1f26b[_0xa719('0x2c')],'resourceId':_0xd1f26b['id'],'type':_0x47ac45[_0xa719('0x2c')],'sectionId':_0x47ac45['id']},{})[_0xa719('0x27')](function(){return _0x11c81f;});}else{return _0x11c81f;}})[_0xa719('0x46')](function(_0x50f219){logger['error'](_0xa719('0x53'),_0x50f219);throw _0x50f219;});}return _0x11c81f;});}})['then'](respondWithResult(_0x19f857,0xc9))[_0xa719('0x46')](handleError(_0x19f857,null));};exports[_0xa719('0x26')]=function(_0x278bac,_0x42fad1){if(_0x278bac[_0xa719('0x4b')]['id']){delete _0x278bac[_0xa719('0x4b')]['id'];}return db[_0xa719('0x30')][_0xa719('0x49')]({'where':{'id':_0x278bac['params']['id']}})[_0xa719('0x27')](handleEntityNotFound(_0x42fad1,null))[_0xa719('0x27')](saveUpdates(_0x278bac[_0xa719('0x4b')],null))[_0xa719('0x27')](respondWithResult(_0x42fad1,null))[_0xa719('0x46')](handleError(_0x42fad1,null));};exports[_0xa719('0x2a')]=function(_0x5a3290,_0x50d05b){return db[_0xa719('0x30')][_0xa719('0x49')]({'where':{'id':_0x5a3290['params']['id']}})[_0xa719('0x27')](handleEntityNotFound(_0x50d05b,null))[_0xa719('0x27')](removeEntity(_0x50d05b,null))[_0xa719('0x46')](handleError(_0x50d05b,null));};function widgetAttributes(_0x29d444){try{switch(_0x29d444[_0xa719('0x33')]){case _0xa719('0x58'):return[{'name':_0xa719('0x59'),'value':_0x29d444['attrUrl']||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x0]?_0x29d444[_0xa719('0x5a')][0x0][_0xa719('0x5b')]:undefined)||'https://'}];case _0xa719('0x5c'):return[{'name':'attrPath','value':_0x29d444[_0xa719('0x5d')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x0]?_0x29d444[_0xa719('0x5a')][0x0][_0xa719('0x5b')]:undefined)||''}];case _0xa719('0x5e'):return[{'name':_0xa719('0x5f'),'value':_0x29d444[_0xa719('0x5f')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444['attrs'][0x0]?_0x29d444[_0xa719('0x5a')][0x0][_0xa719('0x5b')]:undefined)||_0xa719('0x60')},{'name':_0xa719('0x61'),'value':_0x29d444[_0xa719('0x61')]||(_0x29d444['attrs']&&_0x29d444[_0xa719('0x5a')][0x1]?_0x29d444[_0xa719('0x5a')][0x1][_0xa719('0x5b')]:undefined)||'0.00'},{'name':_0xa719('0x62'),'value':_0x29d444[_0xa719('0x62')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x2]?_0x29d444[_0xa719('0x5a')][0x2][_0xa719('0x5b')]:undefined)||0xc}];case _0xa719('0x63'):return[{'name':_0xa719('0x64'),'value':_0x29d444['attrMetric']||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x0]?_0x29d444[_0xa719('0x5a')][0x0][_0xa719('0x5b')]:undefined)||'total'},{'name':_0xa719('0x65'),'value':_0x29d444[_0xa719('0x65')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x1]?_0x29d444[_0xa719('0x5a')][0x1]['value']:undefined)||[]},{'name':_0xa719('0x62'),'value':_0x29d444[_0xa719('0x62')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444['attrs'][0x2]?_0x29d444[_0xa719('0x5a')][0x2][_0xa719('0x5b')]:undefined)||0x14}];case'multibar-chart':case'pie-chart':return[{'name':_0xa719('0x66'),'value':_0x29d444[_0xa719('0x66')]||(_0x29d444['attrs']&&_0x29d444[_0xa719('0x5a')][0x0]?_0x29d444[_0xa719('0x5a')][0x0][_0xa719('0x5b')]:undefined)||_0xa719('0x67')},{'name':_0xa719('0x68'),'value':_0x29d444[_0xa719('0x68')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x1]?_0x29d444[_0xa719('0x5a')][0x1]['value']:undefined)||null},{'name':_0xa719('0x69'),'value':_0x29d444['attrSerie3']||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x2]?_0x29d444[_0xa719('0x5a')][0x2][_0xa719('0x5b')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x29d444[_0xa719('0x65')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x3]?_0x29d444[_0xa719('0x5a')][0x3][_0xa719('0x5b')]:undefined)||[]}];case _0xa719('0x6a'):return[{'name':_0xa719('0x6b'),'type':_0x29d444[_0xa719('0x6c')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x0]?_0x29d444[_0xa719('0x5a')][0x0][_0xa719('0x33')]:undefined)||null,'value':_0x29d444['attrReport']||(_0x29d444[_0xa719('0x5a')]&&_0x29d444['attrs'][0x0]?_0x29d444[_0xa719('0x5a')][0x0][_0xa719('0x5b')]:undefined)||null},{'name':'attrRefresh','value':_0x29d444[_0xa719('0x6d')]||(_0x29d444[_0xa719('0x5a')]&&_0x29d444[_0xa719('0x5a')][0x1]?_0x29d444[_0xa719('0x5a')][0x1][_0xa719('0x5b')]:undefined)||0x0}];default:return[];}}catch(_0x445db9){logger[_0xa719('0x2b')](_0xa719('0x6e'),JSON[_0xa719('0x6f')](_0x445db9));return[];}}exports[_0xa719('0x70')]=function(_0x17f199,_0x37fb8e,_0x534c9b){if(_0x17f199[_0xa719('0x4b')]['id']){delete _0x17f199[_0xa719('0x4b')]['id'];}return db[_0xa719('0x30')][_0xa719('0x49')]({'where':{'id':_0x17f199[_0xa719('0x47')]['id']}})[_0xa719('0x27')](handleEntityNotFound(_0x37fb8e,null))['then'](function(_0x5be1a6){if(_0x5be1a6){_0x17f199[_0xa719('0x4b')]['DashboardId']=_0x5be1a6['id'];_0x17f199[_0xa719('0x4b')][_0xa719('0x5a')]=widgetAttributes(_0x17f199[_0xa719('0x4b')]);return db[_0xa719('0x71')][_0xa719('0x4a')](_0x17f199[_0xa719('0x4b')]);}})[_0xa719('0x27')](respondWithResult(_0x37fb8e,null))[_0xa719('0x46')](handleError(_0x37fb8e,null));};exports['getItems']=function(_0x1d2042,_0x580ffc,_0x3a9e3d){var _0x3c1684={};var _0x13d7d4={};var _0x2a2767;var _0x14150d;return db['Dashboard'][_0xa719('0x72')]({'where':{'id':_0x1d2042[_0xa719('0x47')]['id']}})['then'](handleEntityNotFound(_0x580ffc,null))['then'](function(_0x5e4e03){if(_0x5e4e03){_0x2a2767=_0x5e4e03;_0x13d7d4[_0xa719('0x38')]=_[_0xa719('0x36')](db[_0xa719('0x71')][_0xa719('0x31')]);_0x13d7d4[_0xa719('0x35')]=_[_0xa719('0x36')](_0x1d2042[_0xa719('0x35')]);_0x13d7d4[_0xa719('0x37')]=_['intersection'](_0x13d7d4[_0xa719('0x38')],_0x13d7d4[_0xa719('0x35')]);_0x3c1684[_0xa719('0x39')]=_['intersection'](_0x13d7d4[_0xa719('0x38')],qs[_0xa719('0x3a')](_0x1d2042[_0xa719('0x35')]['fields']));_0x3c1684['attributes']=_0x3c1684[_0xa719('0x39')][_0xa719('0x73')]?_0x3c1684['attributes']:_0x13d7d4['model'];_0x3c1684[_0xa719('0x3d')]=qs[_0xa719('0x3e')](_0x1d2042[_0xa719('0x35')]['sort']);_0x3c1684[_0xa719('0x3f')]=qs[_0xa719('0x37')](_['pick'](_0x1d2042[_0xa719('0x35')],_0x13d7d4[_0xa719('0x37')]));if(_0x1d2042['query'][_0xa719('0x41')]){_0x3c1684[_0xa719('0x3f')]=_['merge'](_0x3c1684[_0xa719('0x3f')],{'$or':_['map'](_0x3c1684[_0xa719('0x39')],function(_0x89a764){var _0x33047c={};_0x33047c[_0x89a764]={'$like':'%'+_0x1d2042[_0xa719('0x35')][_0xa719('0x41')]+'%'};return _0x33047c;})});}_0x3c1684=_['merge']({},_0x3c1684,_0x1d2042[_0xa719('0x74')]);return _0x2a2767[_0xa719('0x75')](_0x3c1684);}})[_0xa719('0x27')](function(_0x2340c3){if(_0x2340c3){_0x14150d=_0x2340c3[_0xa719('0x73')];if(!_0x1d2042[_0xa719('0x35')][_0xa719('0x3b')](_0xa719('0x3c'))){_0x3c1684[_0xa719('0x22')]=qs[_0xa719('0x22')](_0x1d2042['query'][_0xa719('0x22')]);_0x3c1684[_0xa719('0x1f')]=qs[_0xa719('0x1f')](_0x1d2042[_0xa719('0x35')][_0xa719('0x1f')]);}return _0x2a2767[_0xa719('0x75')](_0x3c1684);}})[_0xa719('0x27')](function(_0x4810aa){if(_0x4810aa){return _0x4810aa?{'count':_0x14150d,'rows':_0x4810aa}:null;}})[_0xa719('0x27')](respondWithResult(_0x580ffc,null))[_0xa719('0x46')](handleError(_0x580ffc,null));}; \ No newline at end of file +var _0xfaf6=['rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','CustomDashboards','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','includeAll','omit','createdAt','updatedAt','role','autoAssociation','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','hasOwnProperty','nolimit','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','get','error','name','index','map','Dashboard','fieldName','type','filters','intersection','query','attributes','fields','length','model','sort','pick','filter','where','merge','findAll','rows','show','params','keys'];(function(_0x51fbc7,_0x2603b2){var _0x348f25=function(_0x59d53c){while(--_0x59d53c){_0x51fbc7['push'](_0x51fbc7['shift']());}};_0x348f25(++_0x2603b2);}(_0xfaf6,0x1aa));var _0x6faf=function(_0x255df4,_0x53c56b){_0x255df4=_0x255df4-0x0;var _0x2c17ba=_0xfaf6[_0x255df4];return _0x2c17ba;};'use strict';var emlformat=require(_0x6faf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6faf('0x1'));var jsonpatch=require(_0x6faf('0x2'));var rp=require('request-promise');var moment=require(_0x6faf('0x3'));var BPromise=require(_0x6faf('0x4'));var Mustache=require(_0x6faf('0x5'));var util=require(_0x6faf('0x6'));var path=require(_0x6faf('0x7'));var sox=require('sox');var csv=require(_0x6faf('0x8'));var ejs=require(_0x6faf('0x9'));var fs=require('fs');var fs_extra=require(_0x6faf('0xa'));var _=require(_0x6faf('0xb'));var squel=require(_0x6faf('0xc'));var crypto=require(_0x6faf('0xd'));var jsforce=require(_0x6faf('0xe'));var deskjs=require(_0x6faf('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6faf('0x10'));var Papa=require(_0x6faf('0x11'));var Redis=require(_0x6faf('0x12'));var authService=require(_0x6faf('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6faf('0x14'));var hardwareService=require(_0x6faf('0x15'));var logger=require(_0x6faf('0x16'))(_0x6faf('0x17'));var utils=require(_0x6faf('0x18'));var config=require(_0x6faf('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x6faf('0x1a'))['db'];config[_0x6faf('0x1b')]=_[_0x6faf('0x1c')](config[_0x6faf('0x1b')],{'host':_0x6faf('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6faf('0x1b')]));require(_0x6faf('0x1e'))['register'](socket);function respondWithStatusCode(_0x2fd1d1,_0x303246){_0x303246=_0x303246||0xcc;return function(_0x13122e){if(_0x13122e){return _0x2fd1d1[_0x6faf('0x1f')](_0x303246);}return _0x2fd1d1[_0x6faf('0x20')](_0x303246)[_0x6faf('0x21')]();};}function respondWithResult(_0x39a601,_0x4f2471){_0x4f2471=_0x4f2471||0xc8;return function(_0x259235){if(_0x259235){return _0x39a601[_0x6faf('0x20')](_0x4f2471)[_0x6faf('0x22')](_0x259235);}};}function respondWithFilteredResult(_0x44e114,_0xe4eebb){return function(_0x105963){if(_0x105963){var _0x25bd09=typeof _0xe4eebb[_0x6faf('0x23')]===_0x6faf('0x24')&&typeof _0xe4eebb[_0x6faf('0x25')]==='undefined';var _0x22fda4=_0x105963[_0x6faf('0x26')];var _0x33bef9=_0x25bd09?0x0:_0xe4eebb[_0x6faf('0x23')];var _0x50dc78=_0x25bd09?_0x105963['count']:_0xe4eebb[_0x6faf('0x23')]+_0xe4eebb[_0x6faf('0x25')];var _0x2f0bd9;if(_0x50dc78>=_0x22fda4){_0x50dc78=_0x22fda4;_0x2f0bd9=0xc8;}else{_0x2f0bd9=0xce;}_0x44e114[_0x6faf('0x20')](_0x2f0bd9);return _0x44e114['set'](_0x6faf('0x27'),_0x33bef9+'-'+_0x50dc78+'/'+_0x22fda4)[_0x6faf('0x22')](_0x105963);}return null;};}function patchUpdates(_0x181d58){return function(_0x5b4691){try{jsonpatch[_0x6faf('0x28')](_0x5b4691,_0x181d58,!![]);}catch(_0x8a4670){return BPromise[_0x6faf('0x29')](_0x8a4670);}return _0x5b4691['save']();};}function saveUpdates(_0x240a62,_0x43f977){return function(_0x2f498e){if(_0x2f498e){return _0x2f498e[_0x6faf('0x2a')](_0x240a62)[_0x6faf('0x2b')](function(_0x1669e1){return _0x1669e1;});}return null;};}function removeEntity(_0xb92307,_0x3655b8){return function(_0x2f4823){if(_0x2f4823){return _0x2f4823[_0x6faf('0x2c')]()[_0x6faf('0x2b')](function(){var _0x57d5ad=_0x2f4823[_0x6faf('0x2d')]({'plain':!![]});var _0x2190ff='CustomDashboards';return db['UserProfileResource'][_0x6faf('0x2c')]({'where':{'type':_0x2190ff,'resourceId':_0x57d5ad['id']}})[_0x6faf('0x2b')](function(){return _0x2f4823;});})[_0x6faf('0x2b')](function(){_0xb92307[_0x6faf('0x20')](0xcc)[_0x6faf('0x21')]();});}};}function handleEntityNotFound(_0x546ef8,_0x1f9992){return function(_0x1e5f18){if(!_0x1e5f18){_0x546ef8[_0x6faf('0x1f')](0x194);}return _0x1e5f18;};}function handleError(_0xe7fe2c,_0x2989fb){_0x2989fb=_0x2989fb||0x1f4;return function(_0x15acdc){logger[_0x6faf('0x2e')](_0x15acdc['stack']);if(_0x15acdc[_0x6faf('0x2f')]){delete _0x15acdc[_0x6faf('0x2f')];}_0xe7fe2c['status'](_0x2989fb)['send'](_0x15acdc);};}exports[_0x6faf('0x30')]=function(_0x305f82,_0x5ce964){var _0x2b9e75={},_0x5bb9bc={},_0x404cdb={'count':0x0,'rows':[]};var _0x1d14d8=_[_0x6faf('0x31')](db[_0x6faf('0x32')]['rawAttributes'],function(_0x5bf62b){return{'name':_0x5bf62b[_0x6faf('0x33')],'type':_0x5bf62b[_0x6faf('0x34')]['key']};});_0x5bb9bc['model']=_[_0x6faf('0x31')](_0x1d14d8,_0x6faf('0x2f'));_0x5bb9bc['query']=_['keys'](_0x305f82['query']);_0x5bb9bc[_0x6faf('0x35')]=_[_0x6faf('0x36')](_0x5bb9bc['model'],_0x5bb9bc[_0x6faf('0x37')]);_0x2b9e75[_0x6faf('0x38')]=_['intersection'](_0x5bb9bc['model'],qs['fields'](_0x305f82[_0x6faf('0x37')][_0x6faf('0x39')]));_0x2b9e75[_0x6faf('0x38')]=_0x2b9e75[_0x6faf('0x38')][_0x6faf('0x3a')]?_0x2b9e75[_0x6faf('0x38')]:_0x5bb9bc[_0x6faf('0x3b')];if(!_0x305f82[_0x6faf('0x37')]['hasOwnProperty']('nolimit')){_0x2b9e75[_0x6faf('0x25')]=qs[_0x6faf('0x25')](_0x305f82[_0x6faf('0x37')][_0x6faf('0x25')]);_0x2b9e75[_0x6faf('0x23')]=qs[_0x6faf('0x23')](_0x305f82['query'][_0x6faf('0x23')]);}_0x2b9e75['order']=qs[_0x6faf('0x3c')](_0x305f82['query'][_0x6faf('0x3c')]);_0x2b9e75['where']=qs[_0x6faf('0x35')](_[_0x6faf('0x3d')](_0x305f82['query'],_0x5bb9bc[_0x6faf('0x35')]),_0x1d14d8);if(_0x305f82[_0x6faf('0x37')][_0x6faf('0x3e')]){_0x2b9e75[_0x6faf('0x3f')]=_[_0x6faf('0x40')](_0x2b9e75[_0x6faf('0x3f')],{'$or':_[_0x6faf('0x31')](_0x1d14d8,function(_0x24dcc3){if(_0x24dcc3[_0x6faf('0x34')]!=='VIRTUAL'){var _0x4b4c97={};_0x4b4c97[_0x24dcc3[_0x6faf('0x2f')]]={'$like':'%'+_0x305f82[_0x6faf('0x37')]['filter']+'%'};return _0x4b4c97;}})});}_0x2b9e75=_[_0x6faf('0x40')]({},_0x2b9e75,_0x305f82['options']);var _0x2a7f63={'where':_0x2b9e75[_0x6faf('0x3f')]};return db[_0x6faf('0x32')][_0x6faf('0x26')](_0x2a7f63)[_0x6faf('0x2b')](function(_0x43f12d){_0x404cdb[_0x6faf('0x26')]=_0x43f12d;if(_0x305f82[_0x6faf('0x37')]['includeAll']){_0x2b9e75['include']=[{'all':!![]}];}return db[_0x6faf('0x32')][_0x6faf('0x41')](_0x2b9e75);})[_0x6faf('0x2b')](function(_0x1c50f6){_0x404cdb[_0x6faf('0x42')]=_0x1c50f6;return _0x404cdb;})['then'](respondWithFilteredResult(_0x5ce964,_0x2b9e75))['catch'](handleError(_0x5ce964,null));};exports[_0x6faf('0x43')]=function(_0x240b3c,_0x578f59){var _0x319123={'raw':![],'where':{'id':_0x240b3c[_0x6faf('0x44')]['id']}},_0xdc7263={};_0xdc7263['model']=_[_0x6faf('0x45')](db[_0x6faf('0x32')][_0x6faf('0x46')]);_0xdc7263['query']=_[_0x6faf('0x45')](_0x240b3c[_0x6faf('0x37')]);_0xdc7263[_0x6faf('0x35')]=_[_0x6faf('0x36')](_0xdc7263[_0x6faf('0x3b')],_0xdc7263[_0x6faf('0x37')]);_0x319123[_0x6faf('0x38')]=_['intersection'](_0xdc7263[_0x6faf('0x3b')],qs['fields'](_0x240b3c['query'][_0x6faf('0x39')]));_0x319123[_0x6faf('0x38')]=_0x319123[_0x6faf('0x38')]['length']?_0x319123[_0x6faf('0x38')]:_0xdc7263[_0x6faf('0x3b')];if(_0x240b3c['query']['includeAll']){_0x319123['include']=[{'all':!![]}];}_0x319123=_[_0x6faf('0x40')]({},_0x319123,_0x240b3c[_0x6faf('0x47')]);return db[_0x6faf('0x32')][_0x6faf('0x48')](_0x319123)[_0x6faf('0x2b')](handleEntityNotFound(_0x578f59,null))[_0x6faf('0x2b')](respondWithResult(_0x578f59,null))['catch'](handleError(_0x578f59,null));};exports['create']=function(_0xaae9aa,_0x308028){return db[_0x6faf('0x32')][_0x6faf('0x49')](_0xaae9aa[_0x6faf('0x4a')],{})[_0x6faf('0x2b')](function(_0x4438e9){var _0x18f19f=_0xaae9aa['user'][_0x6faf('0x2d')]({'plain':!![]});if(!_0x18f19f)throw new Error(_0x6faf('0x4b'));if(_0x18f19f['role']===_0x6faf('0x4c')){var _0x51abd7=_0x4438e9[_0x6faf('0x2d')]({'plain':!![]});var _0x42d996=_0x6faf('0x4d');return db[_0x6faf('0x4e')][_0x6faf('0x48')]({'where':{'name':_0x42d996,'userProfileId':_0x18f19f[_0x6faf('0x4f')]},'raw':!![]})['then'](function(_0x1057f8){if(_0x1057f8&&_0x1057f8['autoAssociation']===0x0){return db[_0x6faf('0x50')][_0x6faf('0x49')]({'name':_0x51abd7[_0x6faf('0x2f')],'resourceId':_0x51abd7['id'],'type':_0x1057f8[_0x6faf('0x2f')],'sectionId':_0x1057f8['id']},{})[_0x6faf('0x2b')](function(){return _0x4438e9;});}else{return _0x4438e9;}})['catch'](function(_0x2abce2){logger[_0x6faf('0x2e')](_0x6faf('0x51'),_0x2abce2);throw _0x2abce2;});}return _0x4438e9;})['then'](respondWithResult(_0x308028,0xc9))[_0x6faf('0x52')](handleError(_0x308028,null));};exports[_0x6faf('0x53')]=function(_0x39a472,_0x3cb11a){var _0x2b8fc5={'where':{'id':_0x39a472[_0x6faf('0x44')]['id']}},_0x5d948f={};_0x5d948f['model']=_['keys'](db[_0x6faf('0x32')][_0x6faf('0x46')]);_0x2b8fc5[_0x6faf('0x38')]=_['intersection'](_0x5d948f['model'],qs[_0x6faf('0x39')](_0x39a472[_0x6faf('0x37')][_0x6faf('0x39')]));_0x2b8fc5[_0x6faf('0x38')]=_0x2b8fc5[_0x6faf('0x38')][_0x6faf('0x3a')]?_0x2b8fc5['attributes']:_0x5d948f[_0x6faf('0x3b')];if(_0x39a472[_0x6faf('0x37')][_0x6faf('0x54')]){_0x2b8fc5['include']=[{'all':!![]}];}_0x2b8fc5=_['merge']({},_0x2b8fc5,_0x39a472[_0x6faf('0x47')]);return db['Dashboard'][_0x6faf('0x48')](_0x2b8fc5)['then'](handleEntityNotFound(_0x3cb11a,null))[_0x6faf('0x2b')](function(_0x241241){if(_0x241241){var _0x420300=_0x241241[_0x6faf('0x2d')]({'plain':!![]});_0x420300=qs[_0x6faf('0x55')](_0x420300,['id',_0x6faf('0x56'),_0x6faf('0x57')]);_0x39a472[_0x6faf('0x4a')]=_[_0x6faf('0x55')](_0x39a472[_0x6faf('0x4a')],['id',_0x6faf('0x56'),'updatedAt']);return db[_0x6faf('0x32')][_0x6faf('0x49')](_[_0x6faf('0x40')](_0x420300,_0x39a472['body']),{'include':_0x39a472[_0x6faf('0x37')][_0x6faf('0x54')]?[{'all':!![]}]:undefined})[_0x6faf('0x2b')](function(_0x55e93d){var _0x3ece5b=_0x39a472['user'][_0x6faf('0x2d')]({'plain':!![]});if(!_0x3ece5b)throw new Error(_0x6faf('0x4b'));if(_0x3ece5b[_0x6faf('0x58')]===_0x6faf('0x4c')){var _0x4de0ba=_0x55e93d[_0x6faf('0x2d')]({'plain':!![]});var _0x43ba65=_0x6faf('0x4d');return db[_0x6faf('0x4e')][_0x6faf('0x48')]({'where':{'name':_0x43ba65,'userProfileId':_0x3ece5b[_0x6faf('0x4f')]},'raw':!![]})['then'](function(_0x159629){if(_0x159629&&_0x159629[_0x6faf('0x59')]===0x0){return db[_0x6faf('0x50')]['create']({'name':_0x4de0ba[_0x6faf('0x2f')],'resourceId':_0x4de0ba['id'],'type':_0x159629[_0x6faf('0x2f')],'sectionId':_0x159629['id']},{})[_0x6faf('0x2b')](function(){return _0x55e93d;});}else{return _0x55e93d;}})[_0x6faf('0x52')](function(_0x230452){logger[_0x6faf('0x2e')](_0x6faf('0x51'),_0x230452);throw _0x230452;});}return _0x55e93d;});}})['then'](respondWithResult(_0x3cb11a,0xc9))[_0x6faf('0x52')](handleError(_0x3cb11a,null));};exports[_0x6faf('0x2a')]=function(_0xb0697a,_0x3f5cad){if(_0xb0697a['body']['id']){delete _0xb0697a[_0x6faf('0x4a')]['id'];}return db[_0x6faf('0x32')][_0x6faf('0x48')]({'where':{'id':_0xb0697a[_0x6faf('0x44')]['id']}})['then'](handleEntityNotFound(_0x3f5cad,null))['then'](saveUpdates(_0xb0697a[_0x6faf('0x4a')],null))['then'](respondWithResult(_0x3f5cad,null))[_0x6faf('0x52')](handleError(_0x3f5cad,null));};exports[_0x6faf('0x2c')]=function(_0x3a755d,_0x2f5c49){return db[_0x6faf('0x32')][_0x6faf('0x48')]({'where':{'id':_0x3a755d[_0x6faf('0x44')]['id']}})[_0x6faf('0x2b')](handleEntityNotFound(_0x2f5c49,null))[_0x6faf('0x2b')](removeEntity(_0x2f5c49,null))['catch'](handleError(_0x2f5c49,null));};function widgetAttributes(_0xc64824){try{switch(_0xc64824[_0x6faf('0x34')]){case _0x6faf('0x5a'):return[{'name':_0x6faf('0x5b'),'value':_0xc64824[_0x6faf('0x5b')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x0]?_0xc64824[_0x6faf('0x5c')][0x0][_0x6faf('0x5d')]:undefined)||_0x6faf('0x5e')}];case _0x6faf('0x5f'):return[{'name':'attrPath','value':_0xc64824[_0x6faf('0x60')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x0]?_0xc64824[_0x6faf('0x5c')][0x0][_0x6faf('0x5d')]:undefined)||''}];case _0x6faf('0x61'):return[{'name':_0x6faf('0x62'),'value':_0xc64824[_0x6faf('0x62')]||(_0xc64824['attrs']&&_0xc64824[_0x6faf('0x5c')][0x0]?_0xc64824[_0x6faf('0x5c')][0x0]['value']:undefined)||_0x6faf('0x63')},{'name':_0x6faf('0x64'),'value':_0xc64824['attrTimezone']||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x1]?_0xc64824[_0x6faf('0x5c')][0x1][_0x6faf('0x5d')]:undefined)||_0x6faf('0x65')},{'name':'attrFontSize','value':_0xc64824[_0x6faf('0x66')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x2]?_0xc64824[_0x6faf('0x5c')][0x2][_0x6faf('0x5d')]:undefined)||0xc}];case _0x6faf('0x67'):return[{'name':_0x6faf('0x68'),'value':_0xc64824[_0x6faf('0x68')]||(_0xc64824['attrs']&&_0xc64824[_0x6faf('0x5c')][0x0]?_0xc64824[_0x6faf('0x5c')][0x0][_0x6faf('0x5d')]:undefined)||_0x6faf('0x69')},{'name':_0x6faf('0x6a'),'value':_0xc64824[_0x6faf('0x6a')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x1]?_0xc64824['attrs'][0x1][_0x6faf('0x5d')]:undefined)||[]},{'name':_0x6faf('0x66'),'value':_0xc64824[_0x6faf('0x66')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824['attrs'][0x2]?_0xc64824[_0x6faf('0x5c')][0x2][_0x6faf('0x5d')]:undefined)||0x14}];case _0x6faf('0x6b'):case _0x6faf('0x6c'):return[{'name':_0x6faf('0x6d'),'value':_0xc64824['attrSerie1']||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824['attrs'][0x0]?_0xc64824[_0x6faf('0x5c')][0x0]['value']:undefined)||_0x6faf('0x69')},{'name':_0x6faf('0x6e'),'value':_0xc64824[_0x6faf('0x6e')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824['attrs'][0x1]?_0xc64824[_0x6faf('0x5c')][0x1][_0x6faf('0x5d')]:undefined)||null},{'name':_0x6faf('0x6f'),'value':_0xc64824[_0x6faf('0x6f')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x2]?_0xc64824[_0x6faf('0x5c')][0x2][_0x6faf('0x5d')]:undefined)||null},{'name':'attrVoiceQueues','value':_0xc64824[_0x6faf('0x6a')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x3]?_0xc64824['attrs'][0x3]['value']:undefined)||[]}];case _0x6faf('0x70'):return[{'name':'attrReport','type':_0xc64824[_0x6faf('0x71')]||(_0xc64824['attrs']&&_0xc64824[_0x6faf('0x5c')][0x0]?_0xc64824[_0x6faf('0x5c')][0x0][_0x6faf('0x34')]:undefined)||null,'value':_0xc64824[_0x6faf('0x72')]||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x0]?_0xc64824['attrs'][0x0][_0x6faf('0x5d')]:undefined)||null},{'name':_0x6faf('0x73'),'value':_0xc64824['attrRefresh']||(_0xc64824[_0x6faf('0x5c')]&&_0xc64824[_0x6faf('0x5c')][0x1]?_0xc64824['attrs'][0x1][_0x6faf('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x26fea9){logger[_0x6faf('0x2e')](_0x6faf('0x74'),JSON[_0x6faf('0x75')](_0x26fea9));return[];}}exports[_0x6faf('0x76')]=function(_0x4b8002,_0x17bf00,_0x96045e){if(_0x4b8002['body']['id']){delete _0x4b8002[_0x6faf('0x4a')]['id'];}return db[_0x6faf('0x32')][_0x6faf('0x48')]({'where':{'id':_0x4b8002[_0x6faf('0x44')]['id']}})[_0x6faf('0x2b')](handleEntityNotFound(_0x17bf00,null))[_0x6faf('0x2b')](function(_0x26f4a9){if(_0x26f4a9){_0x4b8002[_0x6faf('0x4a')]['DashboardId']=_0x26f4a9['id'];_0x4b8002[_0x6faf('0x4a')][_0x6faf('0x5c')]=widgetAttributes(_0x4b8002['body']);return db[_0x6faf('0x77')][_0x6faf('0x49')](_0x4b8002[_0x6faf('0x4a')]);}})[_0x6faf('0x2b')](respondWithResult(_0x17bf00,null))[_0x6faf('0x52')](handleError(_0x17bf00,null));};exports[_0x6faf('0x78')]=function(_0x5683e9,_0x30505e,_0x3d7684){var _0x1dfc6d={};var _0x5cda55={};var _0x3a6e3;var _0x351c1e;return db[_0x6faf('0x32')][_0x6faf('0x79')]({'where':{'id':_0x5683e9[_0x6faf('0x44')]['id']}})[_0x6faf('0x2b')](handleEntityNotFound(_0x30505e,null))[_0x6faf('0x2b')](function(_0x479996){if(_0x479996){_0x3a6e3=_0x479996;_0x5cda55[_0x6faf('0x3b')]=_['keys'](db[_0x6faf('0x77')]['rawAttributes']);_0x5cda55[_0x6faf('0x37')]=_['keys'](_0x5683e9[_0x6faf('0x37')]);_0x5cda55[_0x6faf('0x35')]=_[_0x6faf('0x36')](_0x5cda55[_0x6faf('0x3b')],_0x5cda55[_0x6faf('0x37')]);_0x1dfc6d[_0x6faf('0x38')]=_[_0x6faf('0x36')](_0x5cda55[_0x6faf('0x3b')],qs[_0x6faf('0x39')](_0x5683e9[_0x6faf('0x37')][_0x6faf('0x39')]));_0x1dfc6d[_0x6faf('0x38')]=_0x1dfc6d[_0x6faf('0x38')][_0x6faf('0x3a')]?_0x1dfc6d[_0x6faf('0x38')]:_0x5cda55[_0x6faf('0x3b')];_0x1dfc6d['order']=qs[_0x6faf('0x3c')](_0x5683e9[_0x6faf('0x37')]['sort']);_0x1dfc6d['where']=qs[_0x6faf('0x35')](_['pick'](_0x5683e9[_0x6faf('0x37')],_0x5cda55[_0x6faf('0x35')]));if(_0x5683e9['query']['filter']){_0x1dfc6d[_0x6faf('0x3f')]=_['merge'](_0x1dfc6d[_0x6faf('0x3f')],{'$or':_[_0x6faf('0x31')](_0x1dfc6d[_0x6faf('0x38')],function(_0x323ccb){var _0x4f955b={};_0x4f955b[_0x323ccb]={'$like':'%'+_0x5683e9['query'][_0x6faf('0x3e')]+'%'};return _0x4f955b;})});}_0x1dfc6d=_['merge']({},_0x1dfc6d,_0x5683e9[_0x6faf('0x47')]);return _0x3a6e3[_0x6faf('0x78')](_0x1dfc6d);}})['then'](function(_0x4dba9d){if(_0x4dba9d){_0x351c1e=_0x4dba9d['length'];if(!_0x5683e9['query'][_0x6faf('0x7a')](_0x6faf('0x7b'))){_0x1dfc6d[_0x6faf('0x25')]=qs['limit'](_0x5683e9[_0x6faf('0x37')][_0x6faf('0x25')]);_0x1dfc6d['offset']=qs[_0x6faf('0x23')](_0x5683e9[_0x6faf('0x37')]['offset']);}return _0x3a6e3[_0x6faf('0x78')](_0x1dfc6d);}})['then'](function(_0x16d612){if(_0x16d612){return _0x16d612?{'count':_0x351c1e,'rows':_0x16d612}:null;}})['then'](respondWithResult(_0x30505e,null))['catch'](handleError(_0x30505e,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 79ab847..b4fc94d 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 _0xc7f8=['../../mysqldb','Dashboard','setMaxListeners','save','remove','emit','hook','events'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc7f8,0xcf));var _0x8c7f=function(_0x211816,_0x458c15){_0x211816=_0x211816-0x0;var _0x160827=_0xc7f8[_0x211816];return _0x160827;};'use strict';var EventEmitter=require(_0x8c7f('0x0'));var Dashboard=require(_0x8c7f('0x1'))['db'][_0x8c7f('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8c7f('0x3')](0x0);var events={'afterCreate':_0x8c7f('0x4'),'afterUpdate':'update','afterDestroy':_0x8c7f('0x5')};function emitEvent(_0x1884f0){return function(_0x418a1b,_0x1ff10c,_0x36e2ef){DashboardEvents[_0x8c7f('0x6')](_0x1884f0+':'+_0x418a1b['id'],_0x418a1b);DashboardEvents[_0x8c7f('0x6')](_0x1884f0,_0x418a1b);_0x36e2ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x8c7f('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x4e09=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','Dashboard'];(function(_0xb54f15,_0x4e7d71){var _0x34f533=function(_0x3c3735){while(--_0x3c3735){_0xb54f15['push'](_0xb54f15['shift']());}};_0x34f533(++_0x4e7d71);}(_0x4e09,0x166));var _0x94e0=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4e09[_0x27af45];return _0x18df21;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x94e0('0x0'))['db'][_0x94e0('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x94e0('0x2')](0x0);var events={'afterCreate':_0x94e0('0x3'),'afterUpdate':_0x94e0('0x4'),'afterDestroy':_0x94e0('0x5')};function emitEvent(_0x486304){return function(_0x6f7a2f,_0x335c1a,_0x43807e){DashboardEvents[_0x94e0('0x6')](_0x486304+':'+_0x6f7a2f['id'],_0x6f7a2f);DashboardEvents[_0x94e0('0x6')](_0x486304,_0x6f7a2f);_0x43807e(null);};}for(var e in events){if(events[_0x94e0('0x7')](e)){var event=events[e];Dashboard[_0x94e0('0x8')](e,emitEvent(event));}}module[_0x94e0('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 6e00fa2..e77cf42 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 _0x0a17=['exports','define','Dashboard','dashboards','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes'];(function(_0x36cb89,_0x42613f){var _0x40894e=function(_0x368a54){while(--_0x368a54){_0x36cb89['push'](_0x36cb89['shift']());}};_0x40894e(++_0x42613f);}(_0x0a17,0x130));var _0x70a1=function(_0x45e112,_0x2c0ea2){_0x45e112=_0x45e112-0x0;var _0x3b57b7=_0x0a17[_0x45e112];return _0x3b57b7;};'use strict';var _=require('lodash');var util=require(_0x70a1('0x0'));var logger=require(_0x70a1('0x1'))('api');var moment=require(_0x70a1('0x2'));var BPromise=require(_0x70a1('0x3'));var rp=require(_0x70a1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x70a1('0x5'));var config=require(_0x70a1('0x6'));var attributes=require(_0x70a1('0x7'));module[_0x70a1('0x8')]=function(_0x5930cc,_0x51d6ff){return _0x5930cc[_0x70a1('0x9')](_0x70a1('0xa'),attributes,{'tableName':_0x70a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca57=['dashboards','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard'];(function(_0x34fc1b,_0x549083){var _0x2dae2c=function(_0x3abca0){while(--_0x3abca0){_0x34fc1b['push'](_0x34fc1b['shift']());}};_0x2dae2c(++_0x549083);}(_0xca57,0x1d5));var _0x7ca5=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xca57[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0x7ca5('0x0'));var util=require(_0x7ca5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7ca5('0x2'));var BPromise=require(_0x7ca5('0x3'));var rp=require(_0x7ca5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca5('0x5'));var config=require(_0x7ca5('0x6'));var attributes=require(_0x7ca5('0x7'));module[_0x7ca5('0x8')]=function(_0x5cfdb9,_0x13a4aa){return _0x5cfdb9[_0x7ca5('0x9')](_0x7ca5('0xa'),attributes,{'tableName':_0x7ca5('0xb'),'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 c3e4862..0c1f863 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 _0x61ba=['localhost','register','request','then','info','error','code','Dashboard,\x20%s,\x20%s','message','request\x20sent','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x2dc577,_0x4eb9d4){var _0x2dbdd6=function(_0x5425d7){while(--_0x5425d7){_0x2dc577['push'](_0x2dc577['shift']());}};_0x2dbdd6(++_0x4eb9d4);}(_0x61ba,0x164));var _0xa61b=function(_0x6da35d,_0x4b5e23){_0x6da35d=_0x6da35d-0x0;var _0x4fedb5=_0x61ba[_0x6da35d];return _0x4fedb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa61b('0x0'));var rs=require(_0xa61b('0x1'));var fs=require('fs');var Redis=require(_0xa61b('0x2'));var db=require(_0xa61b('0x3'))['db'];var utils=require(_0xa61b('0x4'));var logger=require(_0xa61b('0x5'))(_0xa61b('0x6'));var config=require(_0xa61b('0x7'));var jayson=require(_0xa61b('0x8'));var client=jayson['client'][_0xa61b('0x9')]({'port':0x232a});config[_0xa61b('0xa')]=_[_0xa61b('0xb')](config['redis'],{'host':_0xa61b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa61b('0xa')]));require('./dashboard.socket')[_0xa61b('0xd')](socket);function respondWithRpcPromise(_0x33fd51,_0x1a40a1,_0x398d2d){return new BPromise(function(_0x292881,_0x4887ae){return client[_0xa61b('0xe')](_0x33fd51,_0x398d2d)[_0xa61b('0xf')](function(_0x487877){logger[_0xa61b('0x10')]('Dashboard,\x20%s,\x20%s',_0x1a40a1,'request\x20sent');logger['debug']('Dashboard,\x20%s,\x20%s,\x20%s',_0x1a40a1,'request\x20sent',JSON['stringify'](_0x487877));if(_0x487877['error']){if(_0x487877[_0xa61b('0x11')][_0xa61b('0x12')]===0x1f4){logger[_0xa61b('0x11')](_0xa61b('0x13'),_0x1a40a1,_0x487877['error'][_0xa61b('0x14')]);return _0x4887ae(_0x487877[_0xa61b('0x11')][_0xa61b('0x14')]);}logger[_0xa61b('0x11')](_0xa61b('0x13'),_0x1a40a1,_0x487877[_0xa61b('0x11')][_0xa61b('0x14')]);return _0x292881(_0x487877[_0xa61b('0x11')]['message']);}else{logger[_0xa61b('0x10')](_0xa61b('0x13'),_0x1a40a1,_0xa61b('0x15'));_0x292881(_0x487877['result'][_0xa61b('0x14')]);}})[_0xa61b('0x16')](function(_0x529f40){logger[_0xa61b('0x11')]('Dashboard,\x20%s,\x20%s',_0x1a40a1,_0x529f40);_0x4887ae(_0x529f40);});});} \ No newline at end of file +var _0xda9d=['socket.io-emitter','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','defaults','redis','localhost'];(function(_0x56f0fa,_0x2559f8){var _0x1b7d94=function(_0x248380){while(--_0x248380){_0x56f0fa['push'](_0x56f0fa['shift']());}};_0x1b7d94(++_0x2559f8);}(_0xda9d,0x85));var _0xdda9=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0xda9d[_0x6f1a87];return _0x2495c7;};'use strict';var _=require('lodash');var util=require(_0xdda9('0x0'));var moment=require(_0xdda9('0x1'));var BPromise=require(_0xdda9('0x2'));var rs=require(_0xdda9('0x3'));var fs=require('fs');var Redis=require(_0xdda9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdda9('0x5'));var logger=require('../../config/logger')(_0xdda9('0x6'));var config=require('../../config/environment');var jayson=require(_0xdda9('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xdda9('0x8')](config[_0xdda9('0x9')],{'host':_0xdda9('0xa'),'port':0x18eb});var socket=require(_0xdda9('0xb'))(new Redis(config['redis']));require(_0xdda9('0xc'))[_0xdda9('0xd')](socket);function respondWithRpcPromise(_0x23e9b0,_0x2914f4,_0xae53f){return new BPromise(function(_0x12f643,_0x56f8da){return client['request'](_0x23e9b0,_0xae53f)['then'](function(_0x391a26){logger[_0xdda9('0xe')](_0xdda9('0xf'),_0x2914f4,'request\x20sent');logger[_0xdda9('0x10')](_0xdda9('0x11'),_0x2914f4,_0xdda9('0x12'),JSON['stringify'](_0x391a26));if(_0x391a26['error']){if(_0x391a26[_0xdda9('0x13')][_0xdda9('0x14')]===0x1f4){logger[_0xdda9('0x13')](_0xdda9('0xf'),_0x2914f4,_0x391a26[_0xdda9('0x13')][_0xdda9('0x15')]);return _0x56f8da(_0x391a26[_0xdda9('0x13')][_0xdda9('0x15')]);}logger[_0xdda9('0x13')](_0xdda9('0xf'),_0x2914f4,_0x391a26[_0xdda9('0x13')][_0xdda9('0x15')]);return _0x12f643(_0x391a26[_0xdda9('0x13')][_0xdda9('0x15')]);}else{logger[_0xdda9('0xe')]('Dashboard,\x20%s,\x20%s',_0x2914f4,_0xdda9('0x12'));_0x12f643(_0x391a26[_0xdda9('0x16')][_0xdda9('0x15')]);}})[_0xdda9('0x17')](function(_0x12271f){logger[_0xdda9('0x13')](_0xdda9('0xf'),_0x2914f4,_0x12271f);_0x56f8da(_0x12271f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9d9dcfe..b01adb4 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 _0x1862=['./dashboard.events','save','update','emit','removeListener','length','dashboard:'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0x1862,0x10a));var _0x2186=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1862[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardEvents=require(_0x2186('0x0'));var events=[_0x2186('0x1'),'remove',_0x2186('0x2')];function createListener(_0x323789,_0xdd830b){return function(_0x24f3a3){_0xdd830b[_0x2186('0x3')](_0x323789,_0x24f3a3);};}function removeListener(_0x95ef38,_0x4e8185){return function(){DashboardEvents[_0x2186('0x4')](_0x95ef38,_0x4e8185);};}exports['register']=function(_0x25cdc5){for(var _0x1a6219=0x0,_0x41e23f=events[_0x2186('0x5')];_0x1a6219<_0x41e23f;_0x1a6219++){var _0x2347b1=events[_0x1a6219];var _0x2a95ce=createListener(_0x2186('0x6')+_0x2347b1,_0x25cdc5);DashboardEvents['on'](_0x2347b1,_0x2a95ce);}}; \ No newline at end of file +var _0x591d=['length','dashboard:','./dashboard.events','save','remove','removeListener','register'];(function(_0x22d364,_0x169783){var _0x37114c=function(_0x3a8b42){while(--_0x3a8b42){_0x22d364['push'](_0x22d364['shift']());}};_0x37114c(++_0x169783);}(_0x591d,0xf7));var _0xd591=function(_0x2763d4,_0x31a26c){_0x2763d4=_0x2763d4-0x0;var _0x44f37b=_0x591d[_0x2763d4];return _0x44f37b;};'use strict';var DashboardEvents=require(_0xd591('0x0'));var events=[_0xd591('0x1'),_0xd591('0x2'),'update'];function createListener(_0x4f550f,_0x485e57){return function(_0x39c15d){_0x485e57['emit'](_0x4f550f,_0x39c15d);};}function removeListener(_0xd5fd5c,_0x30d35f){return function(){DashboardEvents[_0xd591('0x3')](_0xd5fd5c,_0x30d35f);};}exports[_0xd591('0x4')]=function(_0x2791ee){for(var _0x4382d0=0x0,_0x444266=events[_0xd591('0x5')];_0x4382d0<_0x444266;_0x4382d0++){var _0x11d521=events[_0x4382d0];var _0x1b97eb=createListener(_0xd591('0x6')+_0x11d521,_0x2791ee);DashboardEvents['on'](_0x11d521,_0x1b97eb);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 1f4bcd8..7f5ca28 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 _0x01fc=['post','create','/:id/clone','/:id/items','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','isAuthenticated','index','/:id','show','get','getItems'];(function(_0x556634,_0x520958){var _0x4429fd=function(_0x1e7eb9){while(--_0x1e7eb9){_0x556634['push'](_0x556634['shift']());}};_0x4429fd(++_0x520958);}(_0x01fc,0xd7));var _0xc01f=function(_0x15f6ea,_0x3bcf63){_0x15f6ea=_0x15f6ea-0x0;var _0x4da7ff=_0x01fc[_0x15f6ea];return _0x4da7ff;};'use strict';var multer=require(_0xc01f('0x0'));var util=require(_0xc01f('0x1'));var path=require('path');var timeout=require(_0xc01f('0x2'));var express=require(_0xc01f('0x3'));var router=express[_0xc01f('0x4')]();var fs_extra=require(_0xc01f('0x5'));var auth=require(_0xc01f('0x6'));var interaction=require(_0xc01f('0x7'));var config=require('../../config/environment');var controller=require(_0xc01f('0x8'));router['get']('/',auth[_0xc01f('0x9')](),controller[_0xc01f('0xa')]);router['get'](_0xc01f('0xb'),auth[_0xc01f('0x9')](),controller[_0xc01f('0xc')]);router[_0xc01f('0xd')]('/:id/items',auth[_0xc01f('0x9')](),controller[_0xc01f('0xe')]);router[_0xc01f('0xf')]('/',auth[_0xc01f('0x9')](),controller[_0xc01f('0x10')]);router[_0xc01f('0xf')](_0xc01f('0x11'),auth[_0xc01f('0x9')](),controller['clone']);router['post'](_0xc01f('0x12'),auth['isAuthenticated'](),controller['addItem']);router[_0xc01f('0x13')](_0xc01f('0xb'),auth[_0xc01f('0x9')](),controller[_0xc01f('0x14')]);router[_0xc01f('0x15')]('/:id',auth[_0xc01f('0x9')](),controller[_0xc01f('0x16')]);module['exports']=router; \ No newline at end of file +var _0x629c=['path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','/:id','update','delete','exports','util'];(function(_0x122ae5,_0x282486){var _0x3d403c=function(_0x195102){while(--_0x195102){_0x122ae5['push'](_0x122ae5['shift']());}};_0x3d403c(++_0x282486);}(_0x629c,0x1b7));var _0xc629=function(_0x28fbc3,_0x3a5a1a){_0x28fbc3=_0x28fbc3-0x0;var _0x57cc75=_0x629c[_0x28fbc3];return _0x57cc75;};'use strict';var multer=require('multer');var util=require(_0xc629('0x0'));var path=require(_0xc629('0x1'));var timeout=require('connect-timeout');var express=require(_0xc629('0x2'));var router=express[_0xc629('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc629('0x4'));var interaction=require(_0xc629('0x5'));var config=require('../../config/environment');var controller=require('./dashboard.controller');router[_0xc629('0x6')]('/',auth[_0xc629('0x7')](),controller[_0xc629('0x8')]);router[_0xc629('0x6')]('/:id',auth[_0xc629('0x7')](),controller[_0xc629('0x9')]);router[_0xc629('0x6')](_0xc629('0xa'),auth['isAuthenticated'](),controller[_0xc629('0xb')]);router[_0xc629('0xc')]('/',auth[_0xc629('0x7')](),controller[_0xc629('0xd')]);router[_0xc629('0xc')](_0xc629('0xe'),auth['isAuthenticated'](),controller[_0xc629('0xf')]);router[_0xc629('0xc')](_0xc629('0xa'),auth['isAuthenticated'](),controller[_0xc629('0x10')]);router[_0xc629('0x11')](_0xc629('0x12'),auth[_0xc629('0x7')](),controller[_0xc629('0x13')]);router[_0xc629('0x14')](_0xc629('0x12'),auth[_0xc629('0x7')](),controller['destroy']);module[_0xc629('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index cc918fe..e87b544 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 _0xe3da=['squel','lodash','exports','STRING','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize'];(function(_0x3e3ed4,_0x4844bb){var _0x2decf8=function(_0x32a9b3){while(--_0x32a9b3){_0x3e3ed4['push'](_0x3e3ed4['shift']());}};_0x2decf8(++_0x4844bb);}(_0xe3da,0x1cd));var _0xae3d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe3da[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0xae3d('0x0'));var squel=require(_0xae3d('0x1'));var _=require(_0xae3d('0x2'));module[_0xae3d('0x3')]={'title':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xae3d('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xae3d('0x5')](_0xae3d('0x6')),'get':function(){try{return JSON[_0xae3d('0x7')](this[_0xae3d('0x8')](_0xae3d('0x9')));}catch(_0x26282d){return[];}},'set':function(_0xa9a1a){try{this[_0xae3d('0xa')](_0xae3d('0x9'),JSON[_0xae3d('0xb')](_0xa9a1a));}catch(_0x583b98){this[_0xae3d('0xa')](_0xae3d('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xae3d('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xae3d('0xc')]},'col':{'type':Sequelize[_0xae3d('0xc')]},'background':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':_0xae3d('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xae3d('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xae3d('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xda19=['TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','STRING'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xda19,0xd5));var _0x9da1=function(_0x3d2065,_0x5557c0){_0x3d2065=_0x3d2065-0x0;var _0x3a62e6=_0xda19[_0x3d2065];return _0x3a62e6;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));module['exports']={'title':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9da1('0x3')]('long'),'get':function(){try{return JSON[_0x9da1('0x4')](this[_0x9da1('0x5')](_0x9da1('0x6')));}catch(_0x470043){return[];}},'set':function(_0x156faf){try{this[_0x9da1('0x7')](_0x9da1('0x6'),JSON[_0x9da1('0x8')](_0x156faf));}catch(_0x1c24e6){this[_0x9da1('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9da1('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9da1('0x9')]},'background':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9da1('0x2')]},'titleFontSize':{'type':Sequelize[_0x9da1('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 959388d..86d9684 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 _0xa1ef=['then','destroy','error','stack','name','show','params','model','DashboardItem','rawAttributes','query','intersection','attributes','fields','includeAll','merge','options','catch','find','type','attrUrl','attrs','value','custom','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','reject','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1ef,0x130));var _0xfa1e=function(_0x1f808f,_0x172b10){_0x1f808f=_0x1f808f-0x0;var _0x282348=_0xa1ef[_0x1f808f];return _0x282348;};'use strict';var emlformat=require(_0xfa1e('0x0'));var rimraf=require(_0xfa1e('0x1'));var zipdir=require(_0xfa1e('0x2'));var jsonpatch=require(_0xfa1e('0x3'));var rp=require(_0xfa1e('0x4'));var moment=require(_0xfa1e('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfa1e('0x6'));var path=require('path');var sox=require(_0xfa1e('0x7'));var csv=require(_0xfa1e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfa1e('0x9'));var _=require(_0xfa1e('0xa'));var squel=require(_0xfa1e('0xb'));var crypto=require(_0xfa1e('0xc'));var jsforce=require(_0xfa1e('0xd'));var deskjs=require(_0xfa1e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa1e('0xf'));var Papa=require(_0xfa1e('0x10'));var Redis=require('ioredis');var authService=require(_0xfa1e('0x11'));var qs=require(_0xfa1e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfa1e('0x13'));var logger=require(_0xfa1e('0x14'))(_0xfa1e('0x15'));var utils=require('../../config/utils');var config=require(_0xfa1e('0x16'));var licenseUtil=require(_0xfa1e('0x17'));var db=require(_0xfa1e('0x18'))['db'];config[_0xfa1e('0x19')]=_['defaults'](config[_0xfa1e('0x19')],{'host':_0xfa1e('0x1a'),'port':0x18eb});var socket=require(_0xfa1e('0x1b'))(new Redis(config['redis']));require(_0xfa1e('0x1c'))['register'](socket);function respondWithStatusCode(_0x50a490,_0x215e68){_0x215e68=_0x215e68||0xcc;return function(_0x4cfd5d){if(_0x4cfd5d){return _0x50a490[_0xfa1e('0x1d')](_0x215e68);}return _0x50a490[_0xfa1e('0x1e')](_0x215e68)[_0xfa1e('0x1f')]();};}function respondWithResult(_0x2f803f,_0x1be03d){_0x1be03d=_0x1be03d||0xc8;return function(_0x37bc5c){if(_0x37bc5c){return _0x2f803f[_0xfa1e('0x1e')](_0x1be03d)[_0xfa1e('0x20')](_0x37bc5c);}};}function respondWithFilteredResult(_0x53465f,_0x50c89b){return function(_0x24c818){if(_0x24c818){var _0x1a7ea0=typeof _0x50c89b['offset']===_0xfa1e('0x21')&&typeof _0x50c89b['limit']===_0xfa1e('0x21');var _0x2d72fc=_0x24c818[_0xfa1e('0x22')];var _0x34571d=_0x1a7ea0?0x0:_0x50c89b[_0xfa1e('0x23')];var _0x462912=_0x1a7ea0?_0x24c818[_0xfa1e('0x22')]:_0x50c89b['offset']+_0x50c89b['limit'];var _0x35747e;if(_0x462912>=_0x2d72fc){_0x462912=_0x2d72fc;_0x35747e=0xc8;}else{_0x35747e=0xce;}_0x53465f[_0xfa1e('0x1e')](_0x35747e);return _0x53465f[_0xfa1e('0x24')](_0xfa1e('0x25'),_0x34571d+'-'+_0x462912+'/'+_0x2d72fc)[_0xfa1e('0x20')](_0x24c818);}return null;};}function patchUpdates(_0x1955b4){return function(_0x3edfe3){try{jsonpatch['apply'](_0x3edfe3,_0x1955b4,!![]);}catch(_0x28c814){return BPromise[_0xfa1e('0x26')](_0x28c814);}return _0x3edfe3['save']();};}function saveUpdates(_0x4c8aeb,_0x48d646){return function(_0x50dd89){if(_0x50dd89){return _0x50dd89[_0xfa1e('0x27')](_0x4c8aeb)[_0xfa1e('0x28')](function(_0x394bb4){return _0x394bb4;});}return null;};}function removeEntity(_0x2e69d0,_0x234299){return function(_0x172ef3){if(_0x172ef3){return _0x172ef3[_0xfa1e('0x29')]()[_0xfa1e('0x28')](function(){_0x2e69d0[_0xfa1e('0x1e')](0xcc)[_0xfa1e('0x1f')]();});}};}function handleEntityNotFound(_0x54e07a,_0x13d452){return function(_0x4fb8ff){if(!_0x4fb8ff){_0x54e07a[_0xfa1e('0x1d')](0x194);}return _0x4fb8ff;};}function handleError(_0x4d3366,_0xdc0ec7){_0xdc0ec7=_0xdc0ec7||0x1f4;return function(_0x347b21){logger[_0xfa1e('0x2a')](_0x347b21[_0xfa1e('0x2b')]);if(_0x347b21[_0xfa1e('0x2c')]){delete _0x347b21[_0xfa1e('0x2c')];}_0x4d3366['status'](_0xdc0ec7)['send'](_0x347b21);};}exports[_0xfa1e('0x2d')]=function(_0x506c7a,_0x16a829){var _0x40d5f1={'raw':![],'where':{'id':_0x506c7a[_0xfa1e('0x2e')]['id']}},_0x1c24ca={};_0x1c24ca[_0xfa1e('0x2f')]=_['keys'](db[_0xfa1e('0x30')][_0xfa1e('0x31')]);_0x1c24ca[_0xfa1e('0x32')]=_['keys'](_0x506c7a['query']);_0x1c24ca['filters']=_[_0xfa1e('0x33')](_0x1c24ca[_0xfa1e('0x2f')],_0x1c24ca['query']);_0x40d5f1[_0xfa1e('0x34')]=_[_0xfa1e('0x33')](_0x1c24ca[_0xfa1e('0x2f')],qs[_0xfa1e('0x35')](_0x506c7a['query'][_0xfa1e('0x35')]));_0x40d5f1['attributes']=_0x40d5f1['attributes']['length']?_0x40d5f1[_0xfa1e('0x34')]:_0x1c24ca['model'];if(_0x506c7a[_0xfa1e('0x32')][_0xfa1e('0x36')]){_0x40d5f1['include']=[{'all':!![]}];}_0x40d5f1=_[_0xfa1e('0x37')]({},_0x40d5f1,_0x506c7a[_0xfa1e('0x38')]);return db[_0xfa1e('0x30')]['find'](_0x40d5f1)[_0xfa1e('0x28')](handleEntityNotFound(_0x16a829,null))[_0xfa1e('0x28')](respondWithResult(_0x16a829,null))[_0xfa1e('0x39')](handleError(_0x16a829,null));};exports[_0xfa1e('0x29')]=function(_0x435329,_0x1ae8dc){return db[_0xfa1e('0x30')][_0xfa1e('0x3a')]({'where':{'id':_0x435329[_0xfa1e('0x2e')]['id']}})[_0xfa1e('0x28')](handleEntityNotFound(_0x1ae8dc,null))[_0xfa1e('0x28')](removeEntity(_0x1ae8dc,null))[_0xfa1e('0x39')](handleError(_0x1ae8dc,null));};function widgetAttributes(_0x18547e){try{switch(_0x18547e[_0xfa1e('0x3b')]){case'iframe':return[{'name':_0xfa1e('0x3c'),'value':_0x18547e[_0xfa1e('0x3c')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e['attrs'][0x0]?_0x18547e[_0xfa1e('0x3d')][0x0][_0xfa1e('0x3e')]:undefined)||'https://'}];case _0xfa1e('0x3f'):return[{'name':'attrPath','value':_0x18547e['attrPath']||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e[_0xfa1e('0x3d')][0x0]?_0x18547e[_0xfa1e('0x3d')][0x0][_0xfa1e('0x3e')]:undefined)||''}];case _0xfa1e('0x40'):return[{'name':_0xfa1e('0x41'),'value':_0x18547e['attrHourFormat']||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e[_0xfa1e('0x3d')][0x0]?_0x18547e[_0xfa1e('0x3d')][0x0]['value']:undefined)||_0xfa1e('0x42')},{'name':_0xfa1e('0x43'),'value':_0x18547e[_0xfa1e('0x43')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e['attrs'][0x1]?_0x18547e[_0xfa1e('0x3d')][0x1][_0xfa1e('0x3e')]:undefined)||'0.00'},{'name':'attrFontSize','value':_0x18547e[_0xfa1e('0x44')]||(_0x18547e['attrs']&&_0x18547e[_0xfa1e('0x3d')][0x2]?_0x18547e[_0xfa1e('0x3d')][0x2]['value']:undefined)||0xc}];case _0xfa1e('0x45'):return[{'name':_0xfa1e('0x46'),'value':_0x18547e[_0xfa1e('0x46')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e['attrs'][0x0]?_0x18547e['attrs'][0x0][_0xfa1e('0x3e')]:undefined)||_0xfa1e('0x47')},{'name':_0xfa1e('0x48'),'value':_0x18547e[_0xfa1e('0x48')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e[_0xfa1e('0x3d')][0x1]?_0x18547e[_0xfa1e('0x3d')][0x1][_0xfa1e('0x3e')]:undefined)||[]},{'name':_0xfa1e('0x44'),'value':_0x18547e[_0xfa1e('0x44')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e[_0xfa1e('0x3d')][0x2]?_0x18547e['attrs'][0x2][_0xfa1e('0x3e')]:undefined)||0x14}];case _0xfa1e('0x49'):case _0xfa1e('0x4a'):return[{'name':_0xfa1e('0x4b'),'value':_0x18547e[_0xfa1e('0x4b')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e['attrs'][0x0]?_0x18547e[_0xfa1e('0x3d')][0x0]['value']:undefined)||_0xfa1e('0x47')},{'name':_0xfa1e('0x4c'),'value':_0x18547e['attrSerie2']||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e[_0xfa1e('0x3d')][0x1]?_0x18547e[_0xfa1e('0x3d')][0x1][_0xfa1e('0x3e')]:undefined)||null},{'name':_0xfa1e('0x4d'),'value':_0x18547e[_0xfa1e('0x4d')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e[_0xfa1e('0x3d')][0x2]?_0x18547e[_0xfa1e('0x3d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x18547e[_0xfa1e('0x48')]||(_0x18547e[_0xfa1e('0x3d')]&&_0x18547e['attrs'][0x3]?_0x18547e['attrs'][0x3][_0xfa1e('0x3e')]:undefined)||[]}];case _0xfa1e('0x4e'):return[{'name':_0xfa1e('0x4f'),'type':_0x18547e[_0xfa1e('0x50')]||(_0x18547e['attrs']&&_0x18547e['attrs'][0x0]?_0x18547e[_0xfa1e('0x3d')][0x0][_0xfa1e('0x3b')]:undefined)||null,'value':_0x18547e[_0xfa1e('0x4f')]||(_0x18547e['attrs']&&_0x18547e['attrs'][0x0]?_0x18547e[_0xfa1e('0x3d')][0x0]['value']:undefined)||null},{'name':_0xfa1e('0x51'),'value':_0x18547e[_0xfa1e('0x51')]||(_0x18547e['attrs']&&_0x18547e[_0xfa1e('0x3d')][0x1]?_0x18547e['attrs'][0x1][_0xfa1e('0x3e')]:undefined)||0x0}];default:return[];}}catch(_0x524cce){logger[_0xfa1e('0x2a')](_0xfa1e('0x52'),JSON[_0xfa1e('0x53')](_0x524cce));return[];}}exports[_0xfa1e('0x54')]=function(_0x460bc9,_0x56f439){if(_0x460bc9[_0xfa1e('0x55')]){_0x460bc9['body'][_0xfa1e('0x3d')]=widgetAttributes(_0x460bc9['body']);}return db[_0xfa1e('0x30')][_0xfa1e('0x54')](_0x460bc9[_0xfa1e('0x55')],{})['then'](respondWithResult(_0x56f439,0xc9))['catch'](handleError(_0x56f439,null));};exports[_0xfa1e('0x27')]=function(_0x37c74b,_0x1197cd){if(_0x37c74b[_0xfa1e('0x55')]['id']){delete _0x37c74b['body']['id'];}_0x37c74b[_0xfa1e('0x55')][_0xfa1e('0x3d')]=widgetAttributes(_0x37c74b['body']);return db[_0xfa1e('0x30')][_0xfa1e('0x3a')]({'where':{'id':_0x37c74b[_0xfa1e('0x2e')]['id']}})[_0xfa1e('0x28')](handleEntityNotFound(_0x1197cd,null))[_0xfa1e('0x28')](saveUpdates(_0x37c74b[_0xfa1e('0x55')],null))[_0xfa1e('0x28')](respondWithResult(_0x1197cd,null))[_0xfa1e('0x39')](handleError(_0x1197cd,null));}; \ No newline at end of file +var _0xc0d3=['params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','stack','send','show'];(function(_0x4a9beb,_0x159482){var _0x2d4c58=function(_0x28dabf){while(--_0x28dabf){_0x4a9beb['push'](_0x4a9beb['shift']());}};_0x2d4c58(++_0x159482);}(_0xc0d3,0x191));var _0x3c0d=function(_0x39aba9,_0x2dc880){_0x39aba9=_0x39aba9-0x0;var _0x3d9b00=_0xc0d3[_0x39aba9];return _0x3d9b00;};'use strict';var emlformat=require(_0x3c0d('0x0'));var rimraf=require(_0x3c0d('0x1'));var zipdir=require(_0x3c0d('0x2'));var jsonpatch=require(_0x3c0d('0x3'));var rp=require(_0x3c0d('0x4'));var moment=require(_0x3c0d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3c0d('0x6'));var util=require('util');var path=require(_0x3c0d('0x7'));var sox=require(_0x3c0d('0x8'));var csv=require(_0x3c0d('0x9'));var ejs=require(_0x3c0d('0xa'));var fs=require('fs');var fs_extra=require(_0x3c0d('0xb'));var _=require(_0x3c0d('0xc'));var squel=require(_0x3c0d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3c0d('0x9'));var querystring=require('querystring');var Papa=require(_0x3c0d('0xe'));var Redis=require(_0x3c0d('0xf'));var authService=require(_0x3c0d('0x10'));var qs=require(_0x3c0d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c0d('0x12'));var logger=require(_0x3c0d('0x13'))(_0x3c0d('0x14'));var utils=require(_0x3c0d('0x15'));var config=require(_0x3c0d('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x3c0d('0x17')](config['redis'],{'host':_0x3c0d('0x18'),'port':0x18eb});var socket=require(_0x3c0d('0x19'))(new Redis(config[_0x3c0d('0x1a')]));require(_0x3c0d('0x1b'))[_0x3c0d('0x1c')](socket);function respondWithStatusCode(_0x448c6f,_0xc249bf){_0xc249bf=_0xc249bf||0xcc;return function(_0x1e4469){if(_0x1e4469){return _0x448c6f[_0x3c0d('0x1d')](_0xc249bf);}return _0x448c6f[_0x3c0d('0x1e')](_0xc249bf)['end']();};}function respondWithResult(_0x22481b,_0x544142){_0x544142=_0x544142||0xc8;return function(_0x4cb4fb){if(_0x4cb4fb){return _0x22481b[_0x3c0d('0x1e')](_0x544142)[_0x3c0d('0x1f')](_0x4cb4fb);}};}function respondWithFilteredResult(_0x49b8dd,_0x1ce0e1){return function(_0x3a31a3){if(_0x3a31a3){var _0x3d6c04=typeof _0x1ce0e1[_0x3c0d('0x20')]===_0x3c0d('0x21')&&typeof _0x1ce0e1[_0x3c0d('0x22')]==='undefined';var _0x1be730=_0x3a31a3[_0x3c0d('0x23')];var _0x46b791=_0x3d6c04?0x0:_0x1ce0e1[_0x3c0d('0x20')];var _0x31a3c3=_0x3d6c04?_0x3a31a3[_0x3c0d('0x23')]:_0x1ce0e1[_0x3c0d('0x20')]+_0x1ce0e1[_0x3c0d('0x22')];var _0xfe1e26;if(_0x31a3c3>=_0x1be730){_0x31a3c3=_0x1be730;_0xfe1e26=0xc8;}else{_0xfe1e26=0xce;}_0x49b8dd['status'](_0xfe1e26);return _0x49b8dd[_0x3c0d('0x24')](_0x3c0d('0x25'),_0x46b791+'-'+_0x31a3c3+'/'+_0x1be730)[_0x3c0d('0x1f')](_0x3a31a3);}return null;};}function patchUpdates(_0x593919){return function(_0x3a6f71){try{jsonpatch['apply'](_0x3a6f71,_0x593919,!![]);}catch(_0x57f5b7){return BPromise['reject'](_0x57f5b7);}return _0x3a6f71['save']();};}function saveUpdates(_0x514bdd,_0x55c956){return function(_0x5c381f){if(_0x5c381f){return _0x5c381f['update'](_0x514bdd)[_0x3c0d('0x26')](function(_0xc32b7a){return _0xc32b7a;});}return null;};}function removeEntity(_0x52438c,_0x46b7ef){return function(_0x4e8a86){if(_0x4e8a86){return _0x4e8a86[_0x3c0d('0x27')]()['then'](function(){_0x52438c[_0x3c0d('0x1e')](0xcc)[_0x3c0d('0x28')]();});}};}function handleEntityNotFound(_0x5dd1eb,_0x8d38bb){return function(_0x4543aa){if(!_0x4543aa){_0x5dd1eb[_0x3c0d('0x1d')](0x194);}return _0x4543aa;};}function handleError(_0x180914,_0x359332){_0x359332=_0x359332||0x1f4;return function(_0x2b34ae){logger['error'](_0x2b34ae[_0x3c0d('0x29')]);if(_0x2b34ae['name']){delete _0x2b34ae['name'];}_0x180914[_0x3c0d('0x1e')](_0x359332)[_0x3c0d('0x2a')](_0x2b34ae);};}exports[_0x3c0d('0x2b')]=function(_0x213452,_0x149b59){var _0x3b0d5c={'raw':![],'where':{'id':_0x213452[_0x3c0d('0x2c')]['id']}},_0x2434ae={};_0x2434ae[_0x3c0d('0x2d')]=_[_0x3c0d('0x2e')](db[_0x3c0d('0x2f')][_0x3c0d('0x30')]);_0x2434ae['query']=_['keys'](_0x213452[_0x3c0d('0x31')]);_0x2434ae[_0x3c0d('0x32')]=_[_0x3c0d('0x33')](_0x2434ae[_0x3c0d('0x2d')],_0x2434ae[_0x3c0d('0x31')]);_0x3b0d5c[_0x3c0d('0x34')]=_[_0x3c0d('0x33')](_0x2434ae[_0x3c0d('0x2d')],qs[_0x3c0d('0x35')](_0x213452[_0x3c0d('0x31')][_0x3c0d('0x35')]));_0x3b0d5c[_0x3c0d('0x34')]=_0x3b0d5c[_0x3c0d('0x34')][_0x3c0d('0x36')]?_0x3b0d5c['attributes']:_0x2434ae['model'];if(_0x213452[_0x3c0d('0x31')][_0x3c0d('0x37')]){_0x3b0d5c['include']=[{'all':!![]}];}_0x3b0d5c=_['merge']({},_0x3b0d5c,_0x213452[_0x3c0d('0x38')]);return db[_0x3c0d('0x2f')][_0x3c0d('0x39')](_0x3b0d5c)[_0x3c0d('0x26')](handleEntityNotFound(_0x149b59,null))['then'](respondWithResult(_0x149b59,null))[_0x3c0d('0x3a')](handleError(_0x149b59,null));};exports[_0x3c0d('0x27')]=function(_0x197d10,_0x22b202){return db[_0x3c0d('0x2f')]['find']({'where':{'id':_0x197d10[_0x3c0d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x22b202,null))[_0x3c0d('0x26')](removeEntity(_0x22b202,null))[_0x3c0d('0x3a')](handleError(_0x22b202,null));};function widgetAttributes(_0x110245){try{switch(_0x110245[_0x3c0d('0x3b')]){case _0x3c0d('0x3c'):return[{'name':'attrUrl','value':_0x110245[_0x3c0d('0x3d')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x0]?_0x110245[_0x3c0d('0x3e')][0x0][_0x3c0d('0x3f')]:undefined)||_0x3c0d('0x40')}];case _0x3c0d('0x41'):return[{'name':_0x3c0d('0x42'),'value':_0x110245[_0x3c0d('0x42')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x0]?_0x110245[_0x3c0d('0x3e')][0x0][_0x3c0d('0x3f')]:undefined)||''}];case _0x3c0d('0x43'):return[{'name':_0x3c0d('0x44'),'value':_0x110245['attrHourFormat']||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x0]?_0x110245['attrs'][0x0][_0x3c0d('0x3f')]:undefined)||_0x3c0d('0x45')},{'name':_0x3c0d('0x46'),'value':_0x110245[_0x3c0d('0x46')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x1]?_0x110245[_0x3c0d('0x3e')][0x1][_0x3c0d('0x3f')]:undefined)||'0.00'},{'name':_0x3c0d('0x47'),'value':_0x110245['attrFontSize']||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x2]?_0x110245['attrs'][0x2][_0x3c0d('0x3f')]:undefined)||0xc}];case _0x3c0d('0x48'):return[{'name':'attrMetric','value':_0x110245['attrMetric']||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x0]?_0x110245[_0x3c0d('0x3e')][0x0][_0x3c0d('0x3f')]:undefined)||_0x3c0d('0x49')},{'name':_0x3c0d('0x4a'),'value':_0x110245[_0x3c0d('0x4a')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245['attrs'][0x1]?_0x110245['attrs'][0x1][_0x3c0d('0x3f')]:undefined)||[]},{'name':_0x3c0d('0x47'),'value':_0x110245['attrFontSize']||(_0x110245[_0x3c0d('0x3e')]&&_0x110245['attrs'][0x2]?_0x110245[_0x3c0d('0x3e')][0x2][_0x3c0d('0x3f')]:undefined)||0x14}];case _0x3c0d('0x4b'):case _0x3c0d('0x4c'):return[{'name':_0x3c0d('0x4d'),'value':_0x110245[_0x3c0d('0x4d')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x0]?_0x110245[_0x3c0d('0x3e')][0x0]['value']:undefined)||_0x3c0d('0x49')},{'name':_0x3c0d('0x4e'),'value':_0x110245[_0x3c0d('0x4e')]||(_0x110245['attrs']&&_0x110245[_0x3c0d('0x3e')][0x1]?_0x110245[_0x3c0d('0x3e')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x110245['attrSerie3']||(_0x110245['attrs']&&_0x110245[_0x3c0d('0x3e')][0x2]?_0x110245['attrs'][0x2][_0x3c0d('0x3f')]:undefined)||null},{'name':_0x3c0d('0x4a'),'value':_0x110245[_0x3c0d('0x4a')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245['attrs'][0x3]?_0x110245[_0x3c0d('0x3e')][0x3][_0x3c0d('0x3f')]:undefined)||[]}];case _0x3c0d('0x4f'):return[{'name':_0x3c0d('0x50'),'type':_0x110245[_0x3c0d('0x51')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245[_0x3c0d('0x3e')][0x0]?_0x110245['attrs'][0x0][_0x3c0d('0x3b')]:undefined)||null,'value':_0x110245['attrReport']||(_0x110245[_0x3c0d('0x3e')]&&_0x110245['attrs'][0x0]?_0x110245[_0x3c0d('0x3e')][0x0][_0x3c0d('0x3f')]:undefined)||null},{'name':_0x3c0d('0x52'),'value':_0x110245[_0x3c0d('0x52')]||(_0x110245[_0x3c0d('0x3e')]&&_0x110245['attrs'][0x1]?_0x110245[_0x3c0d('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x5e5472){logger[_0x3c0d('0x53')](_0x3c0d('0x54'),JSON[_0x3c0d('0x55')](_0x5e5472));return[];}}exports[_0x3c0d('0x56')]=function(_0x389389,_0x5a96d7){if(_0x389389['body']){_0x389389[_0x3c0d('0x57')][_0x3c0d('0x3e')]=widgetAttributes(_0x389389[_0x3c0d('0x57')]);}return db[_0x3c0d('0x2f')]['create'](_0x389389[_0x3c0d('0x57')],{})[_0x3c0d('0x26')](respondWithResult(_0x5a96d7,0xc9))[_0x3c0d('0x3a')](handleError(_0x5a96d7,null));};exports[_0x3c0d('0x58')]=function(_0xcbac6b,_0x3e0a87){if(_0xcbac6b[_0x3c0d('0x57')]['id']){delete _0xcbac6b[_0x3c0d('0x57')]['id'];}_0xcbac6b['body'][_0x3c0d('0x3e')]=widgetAttributes(_0xcbac6b[_0x3c0d('0x57')]);return db[_0x3c0d('0x2f')]['find']({'where':{'id':_0xcbac6b[_0x3c0d('0x2c')]['id']}})[_0x3c0d('0x26')](handleEntityNotFound(_0x3e0a87,null))['then'](saveUpdates(_0xcbac6b[_0x3c0d('0x57')],null))[_0x3c0d('0x26')](respondWithResult(_0x3e0a87,null))[_0x3c0d('0x3a')](handleError(_0x3e0a87,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d58a32c..abdc014 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 _0x0519=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x2799e4,_0x275478){var _0x88ae9b=function(_0xed8204){while(--_0xed8204){_0x2799e4['push'](_0x2799e4['shift']());}};_0x88ae9b(++_0x275478);}(_0x0519,0x16c));var _0x9051=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0x0519[_0x20cc29];return _0x28d513;};'use strict';var EventEmitter=require(_0x9051('0x0'));var DashboardItem=require(_0x9051('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9051('0x2'),'afterUpdate':_0x9051('0x3'),'afterDestroy':_0x9051('0x4')};function emitEvent(_0x1429db){return function(_0x293648,_0x4c3641,_0x374005){DashboardItemEvents['emit'](_0x1429db+':'+_0x293648['id'],_0x293648);DashboardItemEvents[_0x9051('0x5')](_0x1429db,_0x293648);_0x374005(null);};}for(var e in events){if(events[_0x9051('0x6')](e)){var event=events[e];DashboardItem[_0x9051('0x7')](e,emitEvent(event));}}module[_0x9051('0x8')]=DashboardItemEvents; \ No newline at end of file +var _0x7e82=['exports','events','../../mysqldb','DashboardItem','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x107267,_0x1bcc4f){var _0x261669=function(_0xbcee32){while(--_0xbcee32){_0x107267['push'](_0x107267['shift']());}};_0x261669(++_0x1bcc4f);}(_0x7e82,0x105));var _0x27e8=function(_0x3dbace,_0x49c97f){_0x3dbace=_0x3dbace-0x0;var _0x15b487=_0x7e82[_0x3dbace];return _0x15b487;};'use strict';var EventEmitter=require(_0x27e8('0x0'));var DashboardItem=require(_0x27e8('0x1'))['db'][_0x27e8('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x27e8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x27e8('0x4'),'afterDestroy':_0x27e8('0x5')};function emitEvent(_0x54ce3c){return function(_0x5c3f46,_0x8b5e2b,_0x376a0b){DashboardItemEvents[_0x27e8('0x6')](_0x54ce3c+':'+_0x5c3f46['id'],_0x5c3f46);DashboardItemEvents['emit'](_0x54ce3c,_0x5c3f46);_0x376a0b(null);};}for(var e in events){if(events[_0x27e8('0x7')](e)){var event=events[e];DashboardItem[_0x27e8('0x8')](e,emitEvent(event));}}module[_0x27e8('0x9')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 13a4823..9dde857 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 _0x8ff3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DashboardItem','dashboard_items','util'];(function(_0x3bc7bd,_0x1e7bbc){var _0x2f3d89=function(_0x516f01){while(--_0x516f01){_0x3bc7bd['push'](_0x3bc7bd['shift']());}};_0x2f3d89(++_0x1e7bbc);}(_0x8ff3,0x1bb));var _0x38ff=function(_0x2e1777,_0x1f056a){_0x2e1777=_0x2e1777-0x0;var _0x35628f=_0x8ff3[_0x2e1777];return _0x35628f;};'use strict';var _=require('lodash');var util=require(_0x38ff('0x0'));var logger=require('../../config/logger')(_0x38ff('0x1'));var moment=require(_0x38ff('0x2'));var BPromise=require(_0x38ff('0x3'));var rp=require(_0x38ff('0x4'));var fs=require('fs');var path=require(_0x38ff('0x5'));var rimraf=require(_0x38ff('0x6'));var config=require(_0x38ff('0x7'));var attributes=require('./dashboardItem.attributes');module[_0x38ff('0x8')]=function(_0x42ba39,_0x141c18){return _0x42ba39[_0x38ff('0x9')](_0x38ff('0xa'),attributes,{'tableName':_0x38ff('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e41=['../../config/environment','./dashboardItem.attributes','define','DashboardItem','dashboard_items','lodash','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x4e41,0xf7));var _0x14e4=function(_0x2e9782,_0xe29fa2){_0x2e9782=_0x2e9782-0x0;var _0x174ed2=_0x4e41[_0x2e9782];return _0x174ed2;};'use strict';var _=require(_0x14e4('0x0'));var util=require('util');var logger=require(_0x14e4('0x1'))('api');var moment=require(_0x14e4('0x2'));var BPromise=require(_0x14e4('0x3'));var rp=require(_0x14e4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x14e4('0x5'));var config=require(_0x14e4('0x6'));var attributes=require(_0x14e4('0x7'));module['exports']=function(_0x3e529c,_0x356a86){return _0x3e529c[_0x14e4('0x8')](_0x14e4('0x9'),attributes,{'tableName':_0x14e4('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 e642c96..355b5a5 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 _0x70c5=['randomstring','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','bluebird'];(function(_0x1822b6,_0x50df6e){var _0x28cb71=function(_0x1f982b){while(--_0x1f982b){_0x1822b6['push'](_0x1822b6['shift']());}};_0x28cb71(++_0x50df6e);}(_0x70c5,0x1dd));var _0x570c=function(_0x1013fc,_0x4e1740){_0x1013fc=_0x1013fc-0x0;var _0x2989d6=_0x70c5[_0x1013fc];return _0x2989d6;};'use strict';var _=require(_0x570c('0x0'));var util=require(_0x570c('0x1'));var moment=require('moment');var BPromise=require(_0x570c('0x2'));var rs=require(_0x570c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x570c('0x4'))(_0x570c('0x5'));var config=require('../../config/environment');var jayson=require(_0x570c('0x6'));var client=jayson[_0x570c('0x7')][_0x570c('0x8')]({'port':0x232a});config[_0x570c('0x9')]=_[_0x570c('0xa')](config[_0x570c('0x9')],{'host':_0x570c('0xb'),'port':0x18eb});var socket=require(_0x570c('0xc'))(new Redis(config[_0x570c('0x9')]));require(_0x570c('0xd'))[_0x570c('0xe')](socket);function respondWithRpcPromise(_0x354ff7,_0x3a474d,_0x3e0fed){return new BPromise(function(_0x1ac337,_0x401707){return client[_0x570c('0xf')](_0x354ff7,_0x3e0fed)[_0x570c('0x10')](function(_0x29aa79){logger[_0x570c('0x11')](_0x570c('0x12'),_0x3a474d,_0x570c('0x13'));logger['debug'](_0x570c('0x14'),_0x3a474d,_0x570c('0x13'),JSON[_0x570c('0x15')](_0x29aa79));if(_0x29aa79[_0x570c('0x16')]){if(_0x29aa79['error']['code']===0x1f4){logger[_0x570c('0x16')](_0x570c('0x12'),_0x3a474d,_0x29aa79[_0x570c('0x16')][_0x570c('0x17')]);return _0x401707(_0x29aa79[_0x570c('0x16')][_0x570c('0x17')]);}logger[_0x570c('0x16')]('DashboardItem,\x20%s,\x20%s',_0x3a474d,_0x29aa79[_0x570c('0x16')][_0x570c('0x17')]);return _0x1ac337(_0x29aa79[_0x570c('0x16')][_0x570c('0x17')]);}else{logger[_0x570c('0x11')](_0x570c('0x12'),_0x3a474d,_0x570c('0x13'));_0x1ac337(_0x29aa79['result']['message']);}})['catch'](function(_0xdbcd3){logger[_0x570c('0x16')](_0x570c('0x12'),_0x3a474d,_0xdbcd3);_0x401707(_0xdbcd3);});});} \ No newline at end of file +var _0xbc38=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./dashboardItem.socket','register','request','info'];(function(_0x461ef9,_0x2e0a90){var _0x496c3b=function(_0x3abc12){while(--_0x3abc12){_0x461ef9['push'](_0x461ef9['shift']());}};_0x496c3b(++_0x2e0a90);}(_0xbc38,0x166));var _0x8bc3=function(_0x564f18,_0x3ce169){_0x564f18=_0x564f18-0x0;var _0x3a785b=_0xbc38[_0x564f18];return _0x3a785b;};'use strict';var _=require(_0x8bc3('0x0'));var util=require(_0x8bc3('0x1'));var moment=require(_0x8bc3('0x2'));var BPromise=require(_0x8bc3('0x3'));var rs=require(_0x8bc3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bc3('0x5'))['db'];var utils=require(_0x8bc3('0x6'));var logger=require(_0x8bc3('0x7'))(_0x8bc3('0x8'));var config=require(_0x8bc3('0x9'));var jayson=require(_0x8bc3('0xa'));var client=jayson[_0x8bc3('0xb')][_0x8bc3('0xc')]({'port':0x232a});config[_0x8bc3('0xd')]=_['defaults'](config[_0x8bc3('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x8bc3('0xe'))(new Redis(config[_0x8bc3('0xd')]));require(_0x8bc3('0xf'))[_0x8bc3('0x10')](socket);function respondWithRpcPromise(_0x1b3110,_0x5a48dd,_0x200be8){return new BPromise(function(_0x387b93,_0x18f09f){return client[_0x8bc3('0x11')](_0x1b3110,_0x200be8)['then'](function(_0x2885ea){logger[_0x8bc3('0x12')]('DashboardItem,\x20%s,\x20%s',_0x5a48dd,'request\x20sent');logger[_0x8bc3('0x13')](_0x8bc3('0x14'),_0x5a48dd,_0x8bc3('0x15'),JSON[_0x8bc3('0x16')](_0x2885ea));if(_0x2885ea[_0x8bc3('0x17')]){if(_0x2885ea['error'][_0x8bc3('0x18')]===0x1f4){logger['error'](_0x8bc3('0x19'),_0x5a48dd,_0x2885ea['error'][_0x8bc3('0x1a')]);return _0x18f09f(_0x2885ea[_0x8bc3('0x17')][_0x8bc3('0x1a')]);}logger['error'](_0x8bc3('0x19'),_0x5a48dd,_0x2885ea['error']['message']);return _0x387b93(_0x2885ea[_0x8bc3('0x17')][_0x8bc3('0x1a')]);}else{logger[_0x8bc3('0x12')](_0x8bc3('0x19'),_0x5a48dd,_0x8bc3('0x15'));_0x387b93(_0x2885ea[_0x8bc3('0x1b')][_0x8bc3('0x1a')]);}})[_0x8bc3('0x1c')](function(_0x1ef5af){logger[_0x8bc3('0x17')](_0x8bc3('0x19'),_0x5a48dd,_0x1ef5af);_0x18f09f(_0x1ef5af);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 9c122bf..746f1c9 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 _0xd4e6=['remove','update','removeListener','register','length','./dashboardItem.events'];(function(_0x1d5e95,_0x30032a){var _0x113ca3=function(_0x354e98){while(--_0x354e98){_0x1d5e95['push'](_0x1d5e95['shift']());}};_0x113ca3(++_0x30032a);}(_0xd4e6,0x1c1));var _0x6d4e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xd4e6[_0x4c7fb5];return _0x2e10ac;};'use strict';var DashboardItemEvents=require(_0x6d4e('0x0'));var events=['save',_0x6d4e('0x1'),_0x6d4e('0x2')];function createListener(_0x3bbeac,_0x2f94df){return function(_0x357d51){_0x2f94df['emit'](_0x3bbeac,_0x357d51);};}function removeListener(_0x33162c,_0x28c234){return function(){DashboardItemEvents[_0x6d4e('0x3')](_0x33162c,_0x28c234);};}exports[_0x6d4e('0x4')]=function(_0x25b270){for(var _0x447c9d=0x0,_0x52f869=events[_0x6d4e('0x5')];_0x447c9d<_0x52f869;_0x447c9d++){var _0x333672=events[_0x447c9d];var _0x4bd347=createListener('dashboardItem:'+_0x333672,_0x25b270);DashboardItemEvents['on'](_0x333672,_0x4bd347);}}; \ No newline at end of file +var _0x7306=['update','emit','removeListener','register','dashboardItem:','./dashboardItem.events','remove'];(function(_0x382c64,_0x22d880){var _0x36591c=function(_0x14b325){while(--_0x14b325){_0x382c64['push'](_0x382c64['shift']());}};_0x36591c(++_0x22d880);}(_0x7306,0xec));var _0x6730=function(_0x4e3511,_0x247153){_0x4e3511=_0x4e3511-0x0;var _0x529922=_0x7306[_0x4e3511];return _0x529922;};'use strict';var DashboardItemEvents=require(_0x6730('0x0'));var events=['save',_0x6730('0x1'),_0x6730('0x2')];function createListener(_0x1473c3,_0x49071d){return function(_0x11a3f3){_0x49071d[_0x6730('0x3')](_0x1473c3,_0x11a3f3);};}function removeListener(_0x5c10c0,_0x36810f){return function(){DashboardItemEvents[_0x6730('0x4')](_0x5c10c0,_0x36810f);};}exports[_0x6730('0x5')]=function(_0x52fbd3){for(var _0x3debb2=0x0,_0x26de18=events['length'];_0x3debb2<_0x26de18;_0x3debb2++){var _0x4167aa=events[_0x3debb2];var _0x74834b=createListener(_0x6730('0x6')+_0x4167aa,_0x52fbd3);DashboardItemEvents['on'](_0x4167aa,_0x74834b);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a6fc8e8..091697f 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 _0x0975=['../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','post','isAuthenticated','create','put','/:id','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1d87a7,_0x5b6526){var _0xd46ae0=function(_0xebb284){while(--_0xebb284){_0x1d87a7['push'](_0x1d87a7['shift']());}};_0xd46ae0(++_0x5b6526);}(_0x0975,0x17b));var _0x5097=function(_0x3fe86e,_0x4b6e4f){_0x3fe86e=_0x3fe86e-0x0;var _0x2549da=_0x0975[_0x3fe86e];return _0x2549da;};'use strict';var multer=require('multer');var util=require(_0x5097('0x0'));var path=require('path');var timeout=require(_0x5097('0x1'));var express=require('express');var router=express[_0x5097('0x2')]();var fs_extra=require(_0x5097('0x3'));var auth=require(_0x5097('0x4'));var interaction=require(_0x5097('0x5'));var config=require(_0x5097('0x6'));var controller=require(_0x5097('0x7'));router[_0x5097('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5097('0x9')]('/',auth[_0x5097('0xa')](),controller[_0x5097('0xb')]);router[_0x5097('0xc')](_0x5097('0xd'),auth[_0x5097('0xa')](),controller['update']);router[_0x5097('0xe')](_0x5097('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x5097('0xf')]=router; \ No newline at end of file +var _0xe834=['util','path','connect-timeout','Router','../../config/environment','./dashboardItem.controller','get','isAuthenticated','post','create','/:id','delete','destroy','multer'];(function(_0x19f293,_0x3b66e0){var _0x2a5755=function(_0xca09a4){while(--_0xca09a4){_0x19f293['push'](_0x19f293['shift']());}};_0x2a5755(++_0x3b66e0);}(_0xe834,0x15d));var _0x4e83=function(_0xeb6f8d,_0x1138f1){_0xeb6f8d=_0xeb6f8d-0x0;var _0x41f045=_0xe834[_0xeb6f8d];return _0x41f045;};'use strict';var multer=require(_0x4e83('0x0'));var util=require(_0x4e83('0x1'));var path=require(_0x4e83('0x2'));var timeout=require(_0x4e83('0x3'));var express=require('express');var router=express[_0x4e83('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4e83('0x5'));var controller=require(_0x4e83('0x6'));router[_0x4e83('0x7')]('/:id',auth[_0x4e83('0x8')](),controller['show']);router[_0x4e83('0x9')]('/',auth['isAuthenticated'](),controller[_0x4e83('0xa')]);router['put'](_0x4e83('0xb'),auth[_0x4e83('0x8')](),controller['update']);router[_0x4e83('0xc')](_0x4e83('0xb'),auth[_0x4e83('0x8')](),controller[_0x4e83('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index d321e2c..4f58c25 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 _0x7d2d=['STRING','exports','ENUM','second','third','first'];(function(_0x3ae34a,_0x143082){var _0x4c9edc=function(_0x2796c8){while(--_0x2796c8){_0x3ae34a['push'](_0x3ae34a['shift']());}};_0x4c9edc(++_0x143082);}(_0x7d2d,0x157));var _0xd7d2=function(_0x524c5d,_0x38a68f){_0x524c5d=_0x524c5d-0x0;var _0x585c3e=_0x7d2d[_0x524c5d];return _0x585c3e;};'use strict';var Sequelize=require('sequelize');module[_0xd7d2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0xd7d2('0x1')]('first',_0xd7d2('0x2'),_0xd7d2('0x3')),'allowNull':![],'defaultValue':_0xd7d2('0x4')},'description':{'type':Sequelize[_0xd7d2('0x5')]}}; \ No newline at end of file +var _0x37e4=['exports','ENUM','first','second','third','sequelize'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0x37e4,0xa1));var _0x437e=function(_0x159ec6,_0x4f8302){_0x159ec6=_0x159ec6-0x0;var _0x173d2f=_0x37e4[_0x159ec6];return _0x173d2f;};'use strict';var Sequelize=require(_0x437e('0x0'));module[_0x437e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x437e('0x2')](_0x437e('0x3'),_0x437e('0x4'),_0x437e('0x5')),'allowNull':![],'defaultValue':_0x437e('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 5853fe5..2186a7b 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 _0x749a=['VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','get','UserProfileResource','stack','name','index','Disposition','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x749a,0xbe));var _0xa749=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x749a[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0xa749('0x0'));var rimraf=require(_0xa749('0x1'));var zipdir=require(_0xa749('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa749('0x3'));var moment=require('moment');var BPromise=require(_0xa749('0x4'));var Mustache=require(_0xa749('0x5'));var util=require(_0xa749('0x6'));var path=require(_0xa749('0x7'));var sox=require('sox');var csv=require(_0xa749('0x8'));var ejs=require(_0xa749('0x9'));var fs=require('fs');var fs_extra=require(_0xa749('0xa'));var _=require(_0xa749('0xb'));var squel=require(_0xa749('0xc'));var crypto=require(_0xa749('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa749('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa749('0xf'));var Papa=require(_0xa749('0x10'));var Redis=require(_0xa749('0x11'));var authService=require(_0xa749('0x12'));var qs=require(_0xa749('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa749('0x14'));var logger=require(_0xa749('0x15'))(_0xa749('0x16'));var utils=require(_0xa749('0x17'));var config=require(_0xa749('0x18'));var licenseUtil=require(_0xa749('0x19'));var db=require(_0xa749('0x1a'))['db'];function respondWithStatusCode(_0x45e3d9,_0x1a1379){_0x1a1379=_0x1a1379||0xcc;return function(_0x1d223f){if(_0x1d223f){return _0x45e3d9[_0xa749('0x1b')](_0x1a1379);}return _0x45e3d9[_0xa749('0x1c')](_0x1a1379)[_0xa749('0x1d')]();};}function respondWithResult(_0x5eae34,_0x450f6d){_0x450f6d=_0x450f6d||0xc8;return function(_0x29da16){if(_0x29da16){return _0x5eae34[_0xa749('0x1c')](_0x450f6d)[_0xa749('0x1e')](_0x29da16);}};}function respondWithFilteredResult(_0x2e46e7,_0x3bcf79){return function(_0x4fc2ff){if(_0x4fc2ff){var _0xaf116c=typeof _0x3bcf79[_0xa749('0x1f')]==='undefined'&&typeof _0x3bcf79['limit']===_0xa749('0x20');var _0x38784d=_0x4fc2ff[_0xa749('0x21')];var _0x385d55=_0xaf116c?0x0:_0x3bcf79[_0xa749('0x1f')];var _0x41a928=_0xaf116c?_0x4fc2ff[_0xa749('0x21')]:_0x3bcf79[_0xa749('0x1f')]+_0x3bcf79['limit'];var _0x35f49a;if(_0x41a928>=_0x38784d){_0x41a928=_0x38784d;_0x35f49a=0xc8;}else{_0x35f49a=0xce;}_0x2e46e7[_0xa749('0x1c')](_0x35f49a);return _0x2e46e7[_0xa749('0x22')](_0xa749('0x23'),_0x385d55+'-'+_0x41a928+'/'+_0x38784d)[_0xa749('0x1e')](_0x4fc2ff);}return null;};}function patchUpdates(_0x572237){return function(_0x2ee317){try{jsonpatch[_0xa749('0x24')](_0x2ee317,_0x572237,!![]);}catch(_0x3a07c5){return BPromise['reject'](_0x3a07c5);}return _0x2ee317[_0xa749('0x25')]();};}function saveUpdates(_0x444522,_0x250ce1){return function(_0x1870db){if(_0x1870db){return _0x1870db[_0xa749('0x26')](_0x444522)[_0xa749('0x27')](function(_0x3cdecb){return _0x3cdecb;});}return null;};}function removeEntity(_0x35b7dc,_0xc3e2e4){return function(_0x2b349a){if(_0x2b349a){return _0x2b349a['destroy']()[_0xa749('0x27')](function(){var _0x1c21f4=_0x2b349a[_0xa749('0x28')]({'plain':!![]});var _0x1ab337='Dispositions';return db[_0xa749('0x29')]['destroy']({'where':{'type':_0x1ab337,'resourceId':_0x1c21f4['id']}})[_0xa749('0x27')](function(){return _0x2b349a;});})[_0xa749('0x27')](function(){_0x35b7dc[_0xa749('0x1c')](0xcc)[_0xa749('0x1d')]();});}};}function handleEntityNotFound(_0x41c122,_0xec7ad0){return function(_0x380192){if(!_0x380192){_0x41c122[_0xa749('0x1b')](0x194);}return _0x380192;};}function handleError(_0x5e94f4,_0x244c4c){_0x244c4c=_0x244c4c||0x1f4;return function(_0x54fe75){logger['error'](_0x54fe75[_0xa749('0x2a')]);if(_0x54fe75[_0xa749('0x2b')]){delete _0x54fe75[_0xa749('0x2b')];}_0x5e94f4[_0xa749('0x1c')](_0x244c4c)['send'](_0x54fe75);};}exports[_0xa749('0x2c')]=function(_0x9779ce,_0x5334a5){var _0x2895d3={},_0x5799c9={},_0x59738a={'count':0x0,'rows':[]};var _0x27bea7=_['map'](db[_0xa749('0x2d')][_0xa749('0x2e')],function(_0x5b05f0){return{'name':_0x5b05f0[_0xa749('0x2f')],'type':_0x5b05f0[_0xa749('0x30')][_0xa749('0x31')]};});_0x5799c9[_0xa749('0x32')]=_[_0xa749('0x33')](_0x27bea7,'name');_0x5799c9[_0xa749('0x34')]=_[_0xa749('0x35')](_0x9779ce[_0xa749('0x34')]);_0x5799c9[_0xa749('0x36')]=_[_0xa749('0x37')](_0x5799c9[_0xa749('0x32')],_0x5799c9[_0xa749('0x34')]);_0x2895d3[_0xa749('0x38')]=_['intersection'](_0x5799c9[_0xa749('0x32')],qs[_0xa749('0x39')](_0x9779ce[_0xa749('0x34')][_0xa749('0x39')]));_0x2895d3['attributes']=_0x2895d3[_0xa749('0x38')][_0xa749('0x3a')]?_0x2895d3[_0xa749('0x38')]:_0x5799c9[_0xa749('0x32')];if(!_0x9779ce['query'][_0xa749('0x3b')](_0xa749('0x3c'))){_0x2895d3[_0xa749('0x3d')]=qs['limit'](_0x9779ce[_0xa749('0x34')][_0xa749('0x3d')]);_0x2895d3[_0xa749('0x1f')]=qs[_0xa749('0x1f')](_0x9779ce['query']['offset']);}_0x2895d3[_0xa749('0x3e')]=qs['sort'](_0x9779ce['query'][_0xa749('0x3f')]);_0x2895d3[_0xa749('0x40')]=qs['filters'](_[_0xa749('0x41')](_0x9779ce[_0xa749('0x34')],_0x5799c9[_0xa749('0x36')]),_0x27bea7);if(_0x9779ce['query'][_0xa749('0x42')]){_0x2895d3['where']=_[_0xa749('0x43')](_0x2895d3[_0xa749('0x40')],{'$or':_[_0xa749('0x33')](_0x27bea7,function(_0x35873b){if(_0x35873b[_0xa749('0x30')]!==_0xa749('0x44')){var _0x2f27ea={};_0x2f27ea[_0x35873b['name']]={'$like':'%'+_0x9779ce[_0xa749('0x34')][_0xa749('0x42')]+'%'};return _0x2f27ea;}})});}_0x2895d3=_[_0xa749('0x43')]({},_0x2895d3,_0x9779ce[_0xa749('0x45')]);var _0x7b3628={'where':_0x2895d3[_0xa749('0x40')]};return db[_0xa749('0x2d')][_0xa749('0x21')](_0x7b3628)[_0xa749('0x27')](function(_0x548e66){_0x59738a[_0xa749('0x21')]=_0x548e66;if(_0x9779ce[_0xa749('0x34')][_0xa749('0x46')]){_0x2895d3[_0xa749('0x47')]=[{'all':!![]}];}return db[_0xa749('0x2d')][_0xa749('0x48')](_0x2895d3);})[_0xa749('0x27')](function(_0x27a88f){_0x59738a[_0xa749('0x49')]=_0x27a88f;return _0x59738a;})['then'](respondWithFilteredResult(_0x5334a5,_0x2895d3))[_0xa749('0x4a')](handleError(_0x5334a5,null));};exports['show']=function(_0x3b6973,_0x1f545b){var _0x1ec9c9={'raw':!![],'where':{'id':_0x3b6973[_0xa749('0x4b')]['id']}},_0x3653c5={};_0x3653c5[_0xa749('0x32')]=_['keys'](db[_0xa749('0x2d')][_0xa749('0x2e')]);_0x3653c5[_0xa749('0x34')]=_[_0xa749('0x35')](_0x3b6973[_0xa749('0x34')]);_0x3653c5[_0xa749('0x36')]=_['intersection'](_0x3653c5[_0xa749('0x32')],_0x3653c5[_0xa749('0x34')]);_0x1ec9c9['attributes']=_[_0xa749('0x37')](_0x3653c5[_0xa749('0x32')],qs[_0xa749('0x39')](_0x3b6973[_0xa749('0x34')][_0xa749('0x39')]));_0x1ec9c9[_0xa749('0x38')]=_0x1ec9c9['attributes'][_0xa749('0x3a')]?_0x1ec9c9['attributes']:_0x3653c5[_0xa749('0x32')];if(_0x3b6973[_0xa749('0x34')][_0xa749('0x46')]){_0x1ec9c9['include']=[{'all':!![]}];}_0x1ec9c9=_[_0xa749('0x43')]({},_0x1ec9c9,_0x3b6973[_0xa749('0x45')]);return db['Disposition'][_0xa749('0x4c')](_0x1ec9c9)[_0xa749('0x27')](handleEntityNotFound(_0x1f545b,null))[_0xa749('0x27')](respondWithResult(_0x1f545b,null))[_0xa749('0x4a')](handleError(_0x1f545b,null));};exports[_0xa749('0x4d')]=function(_0x390639,_0x6486a){return db[_0xa749('0x2d')][_0xa749('0x4d')](_0x390639[_0xa749('0x4e')],{})['then'](function(_0xb3617e){var _0x53dae9=_0x390639[_0xa749('0x4f')][_0xa749('0x28')]({'plain':!![]});if(!_0x53dae9)throw new Error(_0xa749('0x50'));if(_0x53dae9[_0xa749('0x51')]===_0xa749('0x4f')){var _0x392f90=_0xb3617e[_0xa749('0x28')]({'plain':!![]});var _0x464d09='Dispositions';return db[_0xa749('0x52')][_0xa749('0x4c')]({'where':{'name':_0x464d09,'userProfileId':_0x53dae9['userProfileId']},'raw':!![]})[_0xa749('0x27')](function(_0x1134d6){if(_0x1134d6&&_0x1134d6[_0xa749('0x53')]===0x0){return db[_0xa749('0x29')][_0xa749('0x4d')]({'name':_0x392f90[_0xa749('0x2b')],'resourceId':_0x392f90['id'],'type':_0x1134d6[_0xa749('0x2b')],'sectionId':_0x1134d6['id']},{})[_0xa749('0x27')](function(){return _0xb3617e;});}else{return _0xb3617e;}})['catch'](function(_0x15dfc0){logger['error'](_0xa749('0x54'),_0x15dfc0);throw _0x15dfc0;});}return _0xb3617e;})[_0xa749('0x27')](respondWithResult(_0x6486a,0xc9))[_0xa749('0x4a')](handleError(_0x6486a,null));};exports[_0xa749('0x26')]=function(_0x366551,_0x7e7d83){if(_0x366551['body']['id']){delete _0x366551['body']['id'];}return db[_0xa749('0x2d')][_0xa749('0x4c')]({'where':{'id':_0x366551[_0xa749('0x4b')]['id']}})[_0xa749('0x27')](handleEntityNotFound(_0x7e7d83,null))['then'](saveUpdates(_0x366551['body'],null))['then'](respondWithResult(_0x7e7d83,null))['catch'](handleError(_0x7e7d83,null));};exports[_0xa749('0x55')]=function(_0x31c546,_0x48b2ca){return db[_0xa749('0x2d')][_0xa749('0x4c')]({'where':{'id':_0x31c546['params']['id']}})[_0xa749('0x27')](handleEntityNotFound(_0x48b2ca,null))[_0xa749('0x27')](removeEntity(_0x48b2ca,null))[_0xa749('0x4a')](handleError(_0x48b2ca,null));}; \ No newline at end of file +var _0x5e89=['rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Dispositions','UserProfileResource','end','error','stack','name','send','Disposition'];(function(_0x447ef1,_0x374cd2){var _0x3d72ec=function(_0x3e10b){while(--_0x3e10b){_0x447ef1['push'](_0x447ef1['shift']());}};_0x3d72ec(++_0x374cd2);}(_0x5e89,0x19d));var _0x95e8=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x5e89[_0x2b4411];return _0x8e41ef;};'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(_0x95e8('0x0'));var moment=require(_0x95e8('0x1'));var BPromise=require(_0x95e8('0x2'));var Mustache=require(_0x95e8('0x3'));var util=require(_0x95e8('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x95e8('0x5'));var ejs=require(_0x95e8('0x6'));var fs=require('fs');var fs_extra=require(_0x95e8('0x7'));var _=require(_0x95e8('0x8'));var squel=require('squel');var crypto=require(_0x95e8('0x9'));var jsforce=require(_0x95e8('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x95e8('0x5'));var querystring=require(_0x95e8('0xb'));var Papa=require(_0x95e8('0xc'));var Redis=require(_0x95e8('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x95e8('0xe'));var as=require(_0x95e8('0xf'));var hardwareService=require(_0x95e8('0x10'));var logger=require(_0x95e8('0x11'))(_0x95e8('0x12'));var utils=require(_0x95e8('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57f809,_0x27384f){_0x27384f=_0x27384f||0xcc;return function(_0x131cb6){if(_0x131cb6){return _0x57f809[_0x95e8('0x14')](_0x27384f);}return _0x57f809[_0x95e8('0x15')](_0x27384f)['end']();};}function respondWithResult(_0x4915d8,_0xb95157){_0xb95157=_0xb95157||0xc8;return function(_0x198e00){if(_0x198e00){return _0x4915d8['status'](_0xb95157)[_0x95e8('0x16')](_0x198e00);}};}function respondWithFilteredResult(_0x152efd,_0x31892e){return function(_0x51208e){if(_0x51208e){var _0x1961d8=typeof _0x31892e[_0x95e8('0x17')]===_0x95e8('0x18')&&typeof _0x31892e[_0x95e8('0x19')]===_0x95e8('0x18');var _0x360e1b=_0x51208e[_0x95e8('0x1a')];var _0x2b8bb8=_0x1961d8?0x0:_0x31892e[_0x95e8('0x17')];var _0x476ecd=_0x1961d8?_0x51208e[_0x95e8('0x1a')]:_0x31892e[_0x95e8('0x17')]+_0x31892e[_0x95e8('0x19')];var _0x6bd10c;if(_0x476ecd>=_0x360e1b){_0x476ecd=_0x360e1b;_0x6bd10c=0xc8;}else{_0x6bd10c=0xce;}_0x152efd[_0x95e8('0x15')](_0x6bd10c);return _0x152efd[_0x95e8('0x1b')](_0x95e8('0x1c'),_0x2b8bb8+'-'+_0x476ecd+'/'+_0x360e1b)[_0x95e8('0x16')](_0x51208e);}return null;};}function patchUpdates(_0xe3455d){return function(_0x39a80e){try{jsonpatch[_0x95e8('0x1d')](_0x39a80e,_0xe3455d,!![]);}catch(_0x25d4ca){return BPromise[_0x95e8('0x1e')](_0x25d4ca);}return _0x39a80e['save']();};}function saveUpdates(_0x1e0ebf,_0x5b1e6b){return function(_0x53db19){if(_0x53db19){return _0x53db19[_0x95e8('0x1f')](_0x1e0ebf)[_0x95e8('0x20')](function(_0x5e340d){return _0x5e340d;});}return null;};}function removeEntity(_0x540697,_0x571969){return function(_0x25b551){if(_0x25b551){return _0x25b551[_0x95e8('0x21')]()['then'](function(){var _0x32e859=_0x25b551[_0x95e8('0x22')]({'plain':!![]});var _0x6d97a9=_0x95e8('0x23');return db[_0x95e8('0x24')][_0x95e8('0x21')]({'where':{'type':_0x6d97a9,'resourceId':_0x32e859['id']}})['then'](function(){return _0x25b551;});})[_0x95e8('0x20')](function(){_0x540697['status'](0xcc)[_0x95e8('0x25')]();});}};}function handleEntityNotFound(_0x1344d3,_0x458b9f){return function(_0x3faf80){if(!_0x3faf80){_0x1344d3[_0x95e8('0x14')](0x194);}return _0x3faf80;};}function handleError(_0x4a3b5d,_0x56a45c){_0x56a45c=_0x56a45c||0x1f4;return function(_0x2849a3){logger[_0x95e8('0x26')](_0x2849a3[_0x95e8('0x27')]);if(_0x2849a3[_0x95e8('0x28')]){delete _0x2849a3[_0x95e8('0x28')];}_0x4a3b5d['status'](_0x56a45c)[_0x95e8('0x29')](_0x2849a3);};}exports['index']=function(_0x2236b1,_0x14c45d){var _0xc2295e={},_0x30113d={},_0x105c98={'count':0x0,'rows':[]};var _0x2c4664=_['map'](db[_0x95e8('0x2a')][_0x95e8('0x2b')],function(_0x2bbfea){return{'name':_0x2bbfea[_0x95e8('0x2c')],'type':_0x2bbfea[_0x95e8('0x2d')][_0x95e8('0x2e')]};});_0x30113d[_0x95e8('0x2f')]=_[_0x95e8('0x30')](_0x2c4664,_0x95e8('0x28'));_0x30113d[_0x95e8('0x31')]=_[_0x95e8('0x32')](_0x2236b1[_0x95e8('0x31')]);_0x30113d['filters']=_[_0x95e8('0x33')](_0x30113d[_0x95e8('0x2f')],_0x30113d[_0x95e8('0x31')]);_0xc2295e[_0x95e8('0x34')]=_[_0x95e8('0x33')](_0x30113d['model'],qs['fields'](_0x2236b1[_0x95e8('0x31')][_0x95e8('0x35')]));_0xc2295e[_0x95e8('0x34')]=_0xc2295e[_0x95e8('0x34')][_0x95e8('0x36')]?_0xc2295e['attributes']:_0x30113d['model'];if(!_0x2236b1[_0x95e8('0x31')]['hasOwnProperty'](_0x95e8('0x37'))){_0xc2295e[_0x95e8('0x19')]=qs[_0x95e8('0x19')](_0x2236b1['query'][_0x95e8('0x19')]);_0xc2295e[_0x95e8('0x17')]=qs[_0x95e8('0x17')](_0x2236b1[_0x95e8('0x31')][_0x95e8('0x17')]);}_0xc2295e['order']=qs['sort'](_0x2236b1[_0x95e8('0x31')][_0x95e8('0x38')]);_0xc2295e[_0x95e8('0x39')]=qs[_0x95e8('0x3a')](_[_0x95e8('0x3b')](_0x2236b1['query'],_0x30113d['filters']),_0x2c4664);if(_0x2236b1[_0x95e8('0x31')][_0x95e8('0x3c')]){_0xc2295e[_0x95e8('0x39')]=_['merge'](_0xc2295e[_0x95e8('0x39')],{'$or':_[_0x95e8('0x30')](_0x2c4664,function(_0x105a49){if(_0x105a49[_0x95e8('0x2d')]!==_0x95e8('0x3d')){var _0x29ce23={};_0x29ce23[_0x105a49[_0x95e8('0x28')]]={'$like':'%'+_0x2236b1['query'][_0x95e8('0x3c')]+'%'};return _0x29ce23;}})});}_0xc2295e=_['merge']({},_0xc2295e,_0x2236b1[_0x95e8('0x3e')]);var _0x121244={'where':_0xc2295e[_0x95e8('0x39')]};return db[_0x95e8('0x2a')]['count'](_0x121244)[_0x95e8('0x20')](function(_0x25498a){_0x105c98[_0x95e8('0x1a')]=_0x25498a;if(_0x2236b1['query'][_0x95e8('0x3f')]){_0xc2295e[_0x95e8('0x40')]=[{'all':!![]}];}return db[_0x95e8('0x2a')]['findAll'](_0xc2295e);})['then'](function(_0x4f3f76){_0x105c98['rows']=_0x4f3f76;return _0x105c98;})['then'](respondWithFilteredResult(_0x14c45d,_0xc2295e))[_0x95e8('0x41')](handleError(_0x14c45d,null));};exports['show']=function(_0x40a001,_0x560cff){var _0x12a28b={'raw':!![],'where':{'id':_0x40a001[_0x95e8('0x42')]['id']}},_0x5e5d4f={};_0x5e5d4f[_0x95e8('0x2f')]=_[_0x95e8('0x32')](db[_0x95e8('0x2a')][_0x95e8('0x2b')]);_0x5e5d4f[_0x95e8('0x31')]=_[_0x95e8('0x32')](_0x40a001['query']);_0x5e5d4f[_0x95e8('0x3a')]=_['intersection'](_0x5e5d4f[_0x95e8('0x2f')],_0x5e5d4f[_0x95e8('0x31')]);_0x12a28b[_0x95e8('0x34')]=_[_0x95e8('0x33')](_0x5e5d4f['model'],qs[_0x95e8('0x35')](_0x40a001[_0x95e8('0x31')][_0x95e8('0x35')]));_0x12a28b['attributes']=_0x12a28b[_0x95e8('0x34')][_0x95e8('0x36')]?_0x12a28b['attributes']:_0x5e5d4f[_0x95e8('0x2f')];if(_0x40a001[_0x95e8('0x31')][_0x95e8('0x3f')]){_0x12a28b['include']=[{'all':!![]}];}_0x12a28b=_['merge']({},_0x12a28b,_0x40a001[_0x95e8('0x3e')]);return db[_0x95e8('0x2a')][_0x95e8('0x43')](_0x12a28b)[_0x95e8('0x20')](handleEntityNotFound(_0x560cff,null))[_0x95e8('0x20')](respondWithResult(_0x560cff,null))[_0x95e8('0x41')](handleError(_0x560cff,null));};exports[_0x95e8('0x44')]=function(_0x3cf543,_0x234ac0){return db['Disposition']['create'](_0x3cf543[_0x95e8('0x45')],{})[_0x95e8('0x20')](function(_0x182548){var _0x5b1068=_0x3cf543[_0x95e8('0x46')][_0x95e8('0x22')]({'plain':!![]});if(!_0x5b1068)throw new Error(_0x95e8('0x47'));if(_0x5b1068[_0x95e8('0x48')]===_0x95e8('0x46')){var _0x49fd9a=_0x182548['get']({'plain':!![]});var _0x11d9cf=_0x95e8('0x23');return db[_0x95e8('0x49')][_0x95e8('0x43')]({'where':{'name':_0x11d9cf,'userProfileId':_0x5b1068[_0x95e8('0x4a')]},'raw':!![]})['then'](function(_0xabeba3){if(_0xabeba3&&_0xabeba3['autoAssociation']===0x0){return db[_0x95e8('0x24')]['create']({'name':_0x49fd9a[_0x95e8('0x28')],'resourceId':_0x49fd9a['id'],'type':_0xabeba3[_0x95e8('0x28')],'sectionId':_0xabeba3['id']},{})[_0x95e8('0x20')](function(){return _0x182548;});}else{return _0x182548;}})[_0x95e8('0x41')](function(_0x9f4be7){logger[_0x95e8('0x26')](_0x95e8('0x4b'),_0x9f4be7);throw _0x9f4be7;});}return _0x182548;})[_0x95e8('0x20')](respondWithResult(_0x234ac0,0xc9))['catch'](handleError(_0x234ac0,null));};exports[_0x95e8('0x1f')]=function(_0x5d7223,_0x5b2f80){if(_0x5d7223[_0x95e8('0x45')]['id']){delete _0x5d7223[_0x95e8('0x45')]['id'];}return db[_0x95e8('0x2a')][_0x95e8('0x43')]({'where':{'id':_0x5d7223[_0x95e8('0x42')]['id']}})[_0x95e8('0x20')](handleEntityNotFound(_0x5b2f80,null))[_0x95e8('0x20')](saveUpdates(_0x5d7223[_0x95e8('0x45')],null))[_0x95e8('0x20')](respondWithResult(_0x5b2f80,null))['catch'](handleError(_0x5b2f80,null));};exports[_0x95e8('0x21')]=function(_0xafeae8,_0x3a2b7a){return db['Disposition'][_0x95e8('0x43')]({'where':{'id':_0xafeae8['params']['id']}})[_0x95e8('0x20')](handleEntityNotFound(_0x3a2b7a,null))['then'](removeEntity(_0x3a2b7a,null))[_0x95e8('0x41')](handleError(_0x3a2b7a,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 07f992c..f987bf1 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 _0x1eae=['name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0xef6e51,_0x33bc46){var _0x3f7dd1=function(_0x294500){while(--_0x294500){_0xef6e51['push'](_0xef6e51['shift']());}};_0x3f7dd1(++_0x33bc46);}(_0x1eae,0x12e));var _0xe1ea=function(_0xbcd2,_0x103af2){_0xbcd2=_0xbcd2-0x0;var _0x1cc39b=_0x1eae[_0xbcd2];return _0x1cc39b;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var logger=require(_0xe1ea('0x2'))(_0xe1ea('0x3'));var moment=require(_0xe1ea('0x4'));var BPromise=require(_0xe1ea('0x5'));var rp=require(_0xe1ea('0x6'));var fs=require('fs');var path=require(_0xe1ea('0x7'));var rimraf=require('rimraf');var config=require(_0xe1ea('0x8'));var attributes=require(_0xe1ea('0x9'));module[_0xe1ea('0xa')]=function(_0x58c6c8,_0x20e53f){return _0x58c6c8[_0xe1ea('0xb')]('Disposition',attributes,{'tableName':_0xe1ea('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xe1ea('0xd'),'fields':[_0xe1ea('0xe'),_0xe1ea('0xf')]},{'unique':!![],'name':_0xe1ea('0x10'),'fields':[_0xe1ea('0xe'),_0xe1ea('0x11')]},{'unique':!![],'name':_0xe1ea('0x12'),'fields':[_0xe1ea('0xe'),'MailAccountId']},{'unique':!![],'name':'name_sms','fields':[_0xe1ea('0xe'),_0xe1ea('0x13')]},{'unique':!![],'name':_0xe1ea('0x14'),'fields':[_0xe1ea('0xe'),_0xe1ea('0x15')]},{'unique':!![],'name':_0xe1ea('0x16'),'fields':[_0xe1ea('0xe'),'OpenchannelAccountId']},{'unique':!![],'name':_0xe1ea('0x17'),'fields':[_0xe1ea('0xe'),_0xe1ea('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeded=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','name_whatsapp','WhatsappAccountId','lodash','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeded,0xd6));var _0xdede=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xeded[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xdede('0x0'));var util=require(_0xdede('0x1'));var logger=require(_0xdede('0x2'))(_0xdede('0x3'));var moment=require(_0xdede('0x4'));var BPromise=require(_0xdede('0x5'));var rp=require(_0xdede('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdede('0x7'));var attributes=require(_0xdede('0x8'));module[_0xdede('0x9')]=function(_0x35e689,_0x5f3c45){return _0x35e689[_0xdede('0xa')]('Disposition',attributes,{'tableName':_0xdede('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0xdede('0xc'),_0xdede('0xd')]},{'unique':!![],'name':_0xdede('0xe'),'fields':['name',_0xdede('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0xdede('0xc'),_0xdede('0x10')]},{'unique':!![],'name':_0xdede('0x11'),'fields':[_0xdede('0xc'),_0xdede('0x12')]},{'unique':!![],'name':_0xdede('0x13'),'fields':[_0xdede('0xc'),_0xdede('0x14')]},{'unique':!![],'name':_0xdede('0x15'),'fields':['name','OpenchannelAccountId']},{'unique':!![],'name':_0xdede('0x16'),'fields':['name',_0xdede('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index a0ca88d..f4f725b 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(_0x50d3eb,_0x125bcd){var _0x3dda5d=function(_0x379373){while(--_0x379373){_0x50d3eb['push'](_0x50d3eb['shift']());}};_0x3dda5d(++_0x125bcd);}(_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 +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(_0x1bf12c,_0x1abc15){var _0x473342=function(_0x2cc8cf){while(--_0x2cc8cf){_0x1bf12c['push'](_0x1bf12c['shift']());}};_0x473342(++_0x1abc15);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 5e69b2b..c034d83 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 _0x5fe9=['express','fs-extra','../../components/auth/service','./disposition.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5097f2,_0x5c79de){var _0x395309=function(_0x43d0d6){while(--_0x43d0d6){_0x5097f2['push'](_0x5097f2['shift']());}};_0x395309(++_0x5c79de);}(_0x5fe9,0xe0));var _0x95fe=function(_0x32868b,_0x37c5fe){_0x32868b=_0x32868b-0x0;var _0x385cf9=_0x5fe9[_0x32868b];return _0x385cf9;};'use strict';var multer=require(_0x95fe('0x0'));var util=require(_0x95fe('0x1'));var path=require(_0x95fe('0x2'));var timeout=require(_0x95fe('0x3'));var express=require(_0x95fe('0x4'));var router=express['Router']();var fs_extra=require(_0x95fe('0x5'));var auth=require(_0x95fe('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x95fe('0x7'));router[_0x95fe('0x8')]('/',auth[_0x95fe('0x9')](),controller[_0x95fe('0xa')]);router[_0x95fe('0x8')](_0x95fe('0xb'),auth[_0x95fe('0x9')](),controller[_0x95fe('0xc')]);router['post']('/',auth[_0x95fe('0x9')](),controller[_0x95fe('0xd')]);router[_0x95fe('0xe')](_0x95fe('0xb'),auth[_0x95fe('0x9')](),controller[_0x95fe('0xf')]);router[_0x95fe('0x10')](_0x95fe('0xb'),auth['isAuthenticated'](),controller[_0x95fe('0x11')]);module[_0x95fe('0x12')]=router; \ No newline at end of file +var _0xa239=['isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0xa239,0x82));var _0x9a23=function(_0x1fac7f,_0xf37ed3){_0x1fac7f=_0x1fac7f-0x0;var _0x377dde=_0xa239[_0x1fac7f];return _0x377dde;};'use strict';var multer=require(_0x9a23('0x0'));var util=require(_0x9a23('0x1'));var path=require(_0x9a23('0x2'));var timeout=require(_0x9a23('0x3'));var express=require(_0x9a23('0x4'));var router=express['Router']();var fs_extra=require(_0x9a23('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9a23('0x6'));var config=require(_0x9a23('0x7'));var controller=require(_0x9a23('0x8'));router[_0x9a23('0x9')]('/',auth[_0x9a23('0xa')](),controller[_0x9a23('0xb')]);router['get'](_0x9a23('0xc'),auth[_0x9a23('0xa')](),controller['show']);router[_0x9a23('0xd')]('/',auth['isAuthenticated'](),controller[_0x9a23('0xe')]);router[_0x9a23('0xf')](_0x9a23('0xc'),auth[_0x9a23('0xa')](),controller[_0x9a23('0x10')]);router[_0x9a23('0x11')]('/:id',auth[_0x9a23('0xa')](),controller[_0x9a23('0x12')]);module[_0x9a23('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 8c1707b..a90ec4e 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 _0xa8cb=['2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x29474a,_0x2b2bca){var _0x5c154b=function(_0x16a5ae){while(--_0x16a5ae){_0x29474a['push'](_0x29474a['shift']());}};_0x5c154b(++_0x2b2bca);}(_0xa8cb,0x1c3));var _0xba8c=function(_0x2018e0,_0x56cbc6){_0x2018e0=_0x2018e0-0x0;var _0x2c6715=_0xa8cb[_0x2018e0];return _0x2c6715;};'use strict';var Sequelize=require(_0xba8c('0x0'));module[_0xba8c('0x1')]={'name':{'type':Sequelize[_0xba8c('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xba8c('0x2')]},'ecm':{'type':Sequelize[_0xba8c('0x3')](_0xba8c('0x4'),'no'),'defaultValue':_0xba8c('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xba8c('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xba8c('0x3')](_0xba8c('0x5'),_0xba8c('0x6'),_0xba8c('0x7'),_0xba8c('0x8'),'12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0xba8c('0x3')]('2400',_0xba8c('0x6'),_0xba8c('0x7'),_0xba8c('0x8'),_0xba8c('0x9'),_0xba8c('0xa')),'defaultValue':_0xba8c('0xa')},'modem':{'type':Sequelize[_0xba8c('0x2')],'defaultValue':_0xba8c('0xb')},'gateway':{'type':Sequelize[_0xba8c('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xba8c('0x3')](_0xba8c('0xc'),_0xba8c('0xd'),_0xba8c('0xe'),'KHOMP'),'defaultValue':_0xba8c('0xc')},'key':{'type':Sequelize[_0xba8c('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xba8c('0xf')],'defaultValue':function(){return _0xba8c('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xba8c('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xba8c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xba8c('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xba8c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xba8c('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xba8c('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba8c('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0xba8c('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xba8c('0x11')],'defaultValue':![],'comment':_0xba8c('0x14'),'set':function(_0x2cae0d){if(!_0x2cae0d)this[_0xba8c('0x15')](_0xba8c('0x16'),null);this[_0xba8c('0x15')](_0xba8c('0x17'),_0x2cae0d);}}}; \ No newline at end of file +var _0x293a=['9600','14400','4800','12000','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','7200'];(function(_0x419c0d,_0x3078d8){var _0x15f9fa=function(_0x4d2c9f){while(--_0x4d2c9f){_0x419c0d['push'](_0x419c0d['shift']());}};_0x15f9fa(++_0x3078d8);}(_0x293a,0xc0));var _0xa293=function(_0x3e0196,_0x523693){_0x3e0196=_0x3e0196-0x0;var _0x5cbafb=_0x293a[_0x3e0196];return _0x5cbafb;};'use strict';var Sequelize=require(_0xa293('0x0'));module['exports']={'name':{'type':Sequelize[_0xa293('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa293('0x1')]},'ecm':{'type':Sequelize[_0xa293('0x2')](_0xa293('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xa293('0x1')],'defaultValue':_0xa293('0x4')},'localstationid':{'type':Sequelize[_0xa293('0x1')],'unique':_0xa293('0x5')},'minrate':{'type':Sequelize[_0xa293('0x2')](_0xa293('0x6'),'4800',_0xa293('0x7'),_0xa293('0x8'),'12000',_0xa293('0x9')),'defaultValue':_0xa293('0xa')},'maxrate':{'type':Sequelize[_0xa293('0x2')]('2400',_0xa293('0xa'),'7200',_0xa293('0x8'),_0xa293('0xb'),_0xa293('0x9')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xa293('0xc')},'gateway':{'type':Sequelize[_0xa293('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa293('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa293('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP',_0xa293('0xe'),_0xa293('0xf'),_0xa293('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa293('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa293('0x11')],'defaultValue':function(){return _0xa293('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa293('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa293('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa293('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa293('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xa293('0x14')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa293('0x15'),'set':function(_0x1bb755){if(!_0x1bb755)this[_0xa293('0x16')](_0xa293('0x17'),null);this[_0xa293('0x16')](_0xa293('0x18'),_0x1bb755);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index d6a6d33..9d8460d 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 _0xa469=['priority','appdata','push','Answer','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','createdAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','send','CmList','List','Contacts','updatedAt','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','client','http','request','then','info','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','get','FaxAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getDispositions','findOne','Disposition','length','FaxAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','order','removeAnswers','FaxInteraction','omit','CmContact','Contact','User','Owner','internal','Tag','color','tag','sequelize','transaction','bulkCreate','FaxApplication','findAndCountAll','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension'];(function(_0x11e1b7,_0x3acab9){var _0x1fa024=function(_0x67a944){while(--_0x67a944){_0x11e1b7['push'](_0x11e1b7['shift']());}};_0x1fa024(++_0x3acab9);}(_0xa469,0x1bc));var _0x9a46=function(_0x1f6cef,_0x4c7a95){_0x1f6cef=_0x1f6cef-0x0;var _0x186474=_0xa469[_0x1f6cef];return _0x186474;};'use strict';var emlformat=require(_0x9a46('0x0'));var rimraf=require(_0x9a46('0x1'));var zipdir=require(_0x9a46('0x2'));var jsonpatch=require(_0x9a46('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a46('0x4'));var Mustache=require(_0x9a46('0x5'));var util=require(_0x9a46('0x6'));var path=require(_0x9a46('0x7'));var sox=require(_0x9a46('0x8'));var csv=require(_0x9a46('0x9'));var ejs=require(_0x9a46('0xa'));var fs=require('fs');var fs_extra=require(_0x9a46('0xb'));var _=require(_0x9a46('0xc'));var squel=require(_0x9a46('0xd'));var crypto=require(_0x9a46('0xe'));var jsforce=require(_0x9a46('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9a46('0x10'));var Papa=require(_0x9a46('0x11'));var Redis=require(_0x9a46('0x12'));var authService=require(_0x9a46('0x13'));var qs=require(_0x9a46('0x14'));var as=require(_0x9a46('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a46('0x16'))(_0x9a46('0x17'));var utils=require(_0x9a46('0x18'));var config=require(_0x9a46('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9a46('0x1a')]=_[_0x9a46('0x1b')](config[_0x9a46('0x1a')],{'host':_0x9a46('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a46('0x1a')]));require('./faxAccount.socket')[_0x9a46('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9a46('0x1e')][_0x9a46('0x1f')]({'port':0x232c});var client9002=jayson[_0x9a46('0x1e')][_0x9a46('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3c2a73,_0x575f34,_0x364cb6,_0x588feb){return new BPromise(function(_0x35f104,_0x34670f){var _0x4a24a5=_0x588feb||client;return _0x4a24a5[_0x9a46('0x20')](_0x3c2a73,_0x364cb6)[_0x9a46('0x21')](function(_0x420949){logger[_0x9a46('0x22')]('FaxAccount,\x20%s,\x20%s',_0x575f34,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x575f34,'request\x20sent',JSON[_0x9a46('0x23')](_0x420949));if(_0x420949[_0x9a46('0x24')]){if(_0x420949[_0x9a46('0x24')][_0x9a46('0x25')]===0x1f4){logger[_0x9a46('0x24')]('FaxAccount,\x20%s,\x20%s',_0x575f34,_0x420949['error'][_0x9a46('0x26')]);return _0x34670f(_0x420949[_0x9a46('0x24')][_0x9a46('0x26')]);}logger[_0x9a46('0x24')](_0x9a46('0x27'),_0x575f34,_0x420949[_0x9a46('0x24')]['message']);return _0x35f104(_0x420949[_0x9a46('0x24')][_0x9a46('0x26')]);}else{logger[_0x9a46('0x22')](_0x9a46('0x27'),_0x575f34,_0x9a46('0x28'));_0x35f104(_0x420949[_0x9a46('0x29')][_0x9a46('0x26')]);}})[_0x9a46('0x2a')](function(_0x52604f){logger[_0x9a46('0x24')]('FaxAccount,\x20%s,\x20%s',_0x575f34,_0x52604f);_0x34670f(_0x52604f);});});}function respondWithStatusCode(_0x598dd6,_0x2c0500){_0x2c0500=_0x2c0500||0xcc;return function(_0x4ad934){if(_0x4ad934){return _0x598dd6[_0x9a46('0x2b')](_0x2c0500);}return _0x598dd6[_0x9a46('0x2c')](_0x2c0500)[_0x9a46('0x2d')]();};}function respondWithResult(_0x1ff2df,_0x45d867){_0x45d867=_0x45d867||0xc8;return function(_0x3b853e){if(_0x3b853e){return _0x1ff2df[_0x9a46('0x2c')](_0x45d867)['json'](_0x3b853e);}};}function respondWithFilteredResult(_0x1855b4,_0x2994ca){return function(_0x3cef2e){if(_0x3cef2e){var _0x23373f=typeof _0x2994ca[_0x9a46('0x2e')]===_0x9a46('0x2f')&&typeof _0x2994ca[_0x9a46('0x30')]===_0x9a46('0x2f');var _0x117380=_0x3cef2e[_0x9a46('0x31')];var _0x16aaa2=_0x23373f?0x0:_0x2994ca['offset'];var _0x275c4f=_0x23373f?_0x3cef2e[_0x9a46('0x31')]:_0x2994ca[_0x9a46('0x2e')]+_0x2994ca[_0x9a46('0x30')];var _0x474c3a;if(_0x275c4f>=_0x117380){_0x275c4f=_0x117380;_0x474c3a=0xc8;}else{_0x474c3a=0xce;}_0x1855b4[_0x9a46('0x2c')](_0x474c3a);return _0x1855b4[_0x9a46('0x32')](_0x9a46('0x33'),_0x16aaa2+'-'+_0x275c4f+'/'+_0x117380)[_0x9a46('0x34')](_0x3cef2e);}return null;};}function patchUpdates(_0x241eb9){return function(_0x26af48){try{jsonpatch[_0x9a46('0x35')](_0x26af48,_0x241eb9,!![]);}catch(_0x5bf875){return BPromise[_0x9a46('0x36')](_0x5bf875);}return _0x26af48['save']();};}function saveUpdates(_0x52a11a,_0x242ee8){return function(_0x43aa48){if(_0x43aa48){return _0x43aa48['update'](_0x52a11a)[_0x9a46('0x21')](function(_0x35d75b){return _0x35d75b;});}return null;};}function removeEntity(_0x4c851c,_0x1e1559){return function(_0x2dea41){if(_0x2dea41){return _0x2dea41[_0x9a46('0x37')]()[_0x9a46('0x21')](function(){var _0x520d5d=_0x2dea41[_0x9a46('0x38')]({'plain':!![]});var _0x16bcb8=_0x9a46('0x39');return db[_0x9a46('0x3a')][_0x9a46('0x37')]({'where':{'type':_0x16bcb8,'resourceId':_0x520d5d['id']}})[_0x9a46('0x21')](function(){return _0x2dea41;});})['then'](function(){_0x4c851c['status'](0xcc)[_0x9a46('0x2d')]();});}};}function handleEntityNotFound(_0x25a14d,_0x3a59bf){return function(_0x3efc0d){if(!_0x3efc0d){_0x25a14d[_0x9a46('0x2b')](0x194);}return _0x3efc0d;};}function handleError(_0x2739a8,_0x3ef1bc){_0x3ef1bc=_0x3ef1bc||0x1f4;return function(_0x2e7392){logger['error'](_0x2e7392['stack']);if(_0x2e7392[_0x9a46('0x3b')]){delete _0x2e7392['name'];}_0x2739a8['status'](_0x3ef1bc)['send'](_0x2e7392);};}exports[_0x9a46('0x3c')]=function(_0x5d425f,_0x52f280){var _0x59c53a={'include':[{'model':db[_0x9a46('0x3d')],'as':_0x9a46('0x3e')}]},_0x2c123e={},_0xdc6672={'count':0x0,'rows':[]};var _0x324f09=_['map'](db[_0x9a46('0x3f')][_0x9a46('0x40')],function(_0x52a88b){return{'name':_0x52a88b[_0x9a46('0x41')],'type':_0x52a88b[_0x9a46('0x42')][_0x9a46('0x43')]};});_0x2c123e[_0x9a46('0x44')]=_[_0x9a46('0x45')](_0x324f09,_0x9a46('0x3b'));_0x2c123e[_0x9a46('0x46')]=_[_0x9a46('0x47')](_0x5d425f['query']);_0x2c123e['filters']=_[_0x9a46('0x48')](_0x2c123e[_0x9a46('0x44')],_0x2c123e[_0x9a46('0x46')]);_0x59c53a[_0x9a46('0x49')]=_[_0x9a46('0x48')](_0x2c123e[_0x9a46('0x44')],qs[_0x9a46('0x4a')](_0x5d425f['query'][_0x9a46('0x4a')]));_0x59c53a[_0x9a46('0x49')]=_0x59c53a['attributes']['length']?_0x59c53a[_0x9a46('0x49')]:_0x2c123e[_0x9a46('0x44')];if(!_0x5d425f[_0x9a46('0x46')][_0x9a46('0x4b')](_0x9a46('0x4c'))){_0x59c53a['limit']=qs[_0x9a46('0x30')](_0x5d425f[_0x9a46('0x46')][_0x9a46('0x30')]);_0x59c53a[_0x9a46('0x2e')]=qs['offset'](_0x5d425f[_0x9a46('0x46')][_0x9a46('0x2e')]);}_0x59c53a['order']=qs[_0x9a46('0x4d')](_0x5d425f[_0x9a46('0x46')][_0x9a46('0x4d')]);_0x59c53a[_0x9a46('0x4e')]=qs['filters'](_[_0x9a46('0x4f')](_0x5d425f[_0x9a46('0x46')],_0x2c123e[_0x9a46('0x50')]),_0x324f09);if(_0x5d425f['query']['filter']){_0x59c53a[_0x9a46('0x4e')]=_[_0x9a46('0x51')](_0x59c53a['where'],{'$or':_['map'](_0x324f09,function(_0x51733f){if(_0x51733f[_0x9a46('0x42')]!==_0x9a46('0x52')){var _0x2e69da={};_0x2e69da[_0x51733f[_0x9a46('0x3b')]]={'$like':'%'+_0x5d425f[_0x9a46('0x46')][_0x9a46('0x53')]+'%'};return _0x2e69da;}})});}_0x59c53a=_['merge']({},_0x59c53a,_0x5d425f[_0x9a46('0x54')]);var _0x404a58={'where':_0x59c53a['where']};return db['FaxAccount'][_0x9a46('0x31')](_0x404a58)[_0x9a46('0x21')](function(_0x50e31d){_0xdc6672[_0x9a46('0x31')]=_0x50e31d;if(_0x5d425f[_0x9a46('0x46')]['includeAll']){_0x59c53a[_0x9a46('0x55')]=[{'all':!![]}];}return db[_0x9a46('0x3f')][_0x9a46('0x56')](_0x59c53a);})[_0x9a46('0x21')](function(_0x2bfe94){_0xdc6672[_0x9a46('0x57')]=_0x2bfe94;return _0xdc6672;})[_0x9a46('0x21')](respondWithFilteredResult(_0x52f280,_0x59c53a))['catch'](handleError(_0x52f280,null));};exports[_0x9a46('0x58')]=function(_0x1289c8,_0x3c04eb){var _0x548445={'raw':![],'where':{'id':_0x1289c8[_0x9a46('0x59')]['id']},'include':[{'model':db[_0x9a46('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2a7de6={};_0x2a7de6['model']=_[_0x9a46('0x47')](db[_0x9a46('0x3f')][_0x9a46('0x40')]);_0x2a7de6[_0x9a46('0x46')]=_[_0x9a46('0x47')](_0x1289c8[_0x9a46('0x46')]);_0x2a7de6[_0x9a46('0x50')]=_[_0x9a46('0x48')](_0x2a7de6[_0x9a46('0x44')],_0x2a7de6[_0x9a46('0x46')]);_0x548445[_0x9a46('0x49')]=_['intersection'](_0x2a7de6[_0x9a46('0x44')],qs[_0x9a46('0x4a')](_0x1289c8[_0x9a46('0x46')][_0x9a46('0x4a')]));_0x548445['attributes']=_0x548445[_0x9a46('0x49')]['length']?_0x548445['attributes']:_0x2a7de6[_0x9a46('0x44')];if(_0x1289c8[_0x9a46('0x46')][_0x9a46('0x5a')]){_0x548445[_0x9a46('0x55')]=[{'all':!![]}];}_0x548445=_['merge']({},_0x548445,_0x1289c8[_0x9a46('0x54')]);return db['FaxAccount']['find'](_0x548445)[_0x9a46('0x21')](handleEntityNotFound(_0x3c04eb,null))[_0x9a46('0x21')](respondWithResult(_0x3c04eb,null))[_0x9a46('0x2a')](handleError(_0x3c04eb,null));};exports[_0x9a46('0x5b')]=function(_0x3b401,_0x11338d){return db[_0x9a46('0x3f')][_0x9a46('0x5b')](_0x3b401[_0x9a46('0x5c')],{})['then'](function(_0x593ce6){var _0x3d562a=_0x3b401['user'][_0x9a46('0x38')]({'plain':!![]});if(!_0x3d562a)throw new Error(_0x9a46('0x5d'));if(_0x3d562a['role']===_0x9a46('0x5e')){var _0x58c39f=_0x593ce6['get']({'plain':!![]});var _0x2372ea='FaxAccounts';return db['UserProfileSection'][_0x9a46('0x5f')]({'where':{'name':_0x2372ea,'userProfileId':_0x3d562a[_0x9a46('0x60')]},'raw':!![]})[_0x9a46('0x21')](function(_0x2a46ff){if(_0x2a46ff&&_0x2a46ff[_0x9a46('0x61')]===0x0){return db[_0x9a46('0x3a')]['create']({'name':_0x58c39f[_0x9a46('0x3b')],'resourceId':_0x58c39f['id'],'type':_0x2a46ff[_0x9a46('0x3b')],'sectionId':_0x2a46ff['id']},{})[_0x9a46('0x21')](function(){return _0x593ce6;});}else{return _0x593ce6;}})['catch'](function(_0x3d81c7){logger[_0x9a46('0x24')](_0x9a46('0x62'),_0x3d81c7);throw _0x3d81c7;});}return _0x593ce6;})[_0x9a46('0x21')](respondWithResult(_0x11338d,0xc9))[_0x9a46('0x2a')](handleError(_0x11338d,null));};exports['update']=function(_0x19254,_0x11f164){if(_0x19254[_0x9a46('0x5c')]['id']){delete _0x19254[_0x9a46('0x5c')]['id'];}return db[_0x9a46('0x3f')][_0x9a46('0x5f')]({'where':{'id':_0x19254[_0x9a46('0x59')]['id']},'include':[{'model':db[_0x9a46('0x3d')],'as':_0x9a46('0x3e')}]})[_0x9a46('0x21')](handleEntityNotFound(_0x11f164,null))[_0x9a46('0x21')](saveUpdates(_0x19254[_0x9a46('0x5c')],null))[_0x9a46('0x21')](respondWithResult(_0x11f164,null))[_0x9a46('0x2a')](handleError(_0x11f164,null));};exports[_0x9a46('0x37')]=function(_0x193ee7,_0x461f6b){return db[_0x9a46('0x3f')][_0x9a46('0x5f')]({'where':{'id':_0x193ee7[_0x9a46('0x59')]['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x461f6b,null))[_0x9a46('0x21')](removeEntity(_0x461f6b,null))[_0x9a46('0x2a')](handleError(_0x461f6b,null));};exports[_0x9a46('0x63')]=function(_0x59dcd3,_0x5a2866){return db[_0x9a46('0x3f')]['describe']()[_0x9a46('0x21')](respondWithResult(_0x5a2866,null))['catch'](handleError(_0x5a2866,null));};exports['addDisposition']=function(_0x17f044,_0x21647a,_0x39d219){if(_0x17f044['body']['id']){delete _0x17f044[_0x9a46('0x5c')]['id'];}return db['FaxAccount'][_0x9a46('0x5f')]({'where':{'id':_0x17f044['params']['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x21647a,null))[_0x9a46('0x21')](function(_0x22f93d){if(_0x22f93d){_0x17f044[_0x9a46('0x5c')]['FaxAccountId']=_0x22f93d['id'];return db['Disposition'][_0x9a46('0x5b')](_0x17f044[_0x9a46('0x5c')]);}})[_0x9a46('0x21')](respondWithResult(_0x21647a,null))[_0x9a46('0x2a')](handleError(_0x21647a,null));};exports[_0x9a46('0x64')]=function(_0x582722,_0x2d8867,_0x2b3b99){var _0x23a2db={'raw':![],'where':{}};var _0x87fe36={};var _0x4642e7={'count':0x0,'rows':[]};return db[_0x9a46('0x3f')][_0x9a46('0x65')]({'where':{'id':_0x582722[_0x9a46('0x59')]['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x2d8867,null))['then'](function(_0x17ad46){if(_0x17ad46){_0x87fe36[_0x9a46('0x44')]=_['keys'](db[_0x9a46('0x66')][_0x9a46('0x40')]);_0x87fe36[_0x9a46('0x46')]=_[_0x9a46('0x47')](_0x582722[_0x9a46('0x46')]);_0x87fe36['filters']=_[_0x9a46('0x48')](_0x87fe36[_0x9a46('0x44')],_0x87fe36['query']);_0x23a2db[_0x9a46('0x49')]=_[_0x9a46('0x48')](_0x87fe36[_0x9a46('0x44')],qs[_0x9a46('0x4a')](_0x582722['query'][_0x9a46('0x4a')]));_0x23a2db[_0x9a46('0x49')]=_0x23a2db[_0x9a46('0x49')][_0x9a46('0x67')]?_0x23a2db[_0x9a46('0x49')]:_0x87fe36[_0x9a46('0x44')];if(!_0x582722['query'][_0x9a46('0x4b')](_0x9a46('0x4c'))){_0x23a2db[_0x9a46('0x30')]=qs[_0x9a46('0x30')](_0x582722[_0x9a46('0x46')]['limit']);_0x23a2db[_0x9a46('0x2e')]=qs[_0x9a46('0x2e')](_0x582722[_0x9a46('0x46')][_0x9a46('0x2e')]);}_0x23a2db['order']=qs[_0x9a46('0x4d')](_0x582722['query'][_0x9a46('0x4d')]);_0x23a2db[_0x9a46('0x4e')]=qs['filters'](_['pick'](_0x582722[_0x9a46('0x46')],_0x87fe36[_0x9a46('0x50')]));_0x23a2db[_0x9a46('0x4e')][_0x9a46('0x68')]=_0x17ad46['id'];if(_0x582722['query'][_0x9a46('0x53')]){_0x23a2db[_0x9a46('0x4e')]=_[_0x9a46('0x51')](_0x23a2db[_0x9a46('0x4e')],{'$or':_[_0x9a46('0x45')](_0x23a2db[_0x9a46('0x49')],function(_0x575921){var _0x23c02e={};_0x23c02e[_0x575921]={'$like':'%'+_0x582722[_0x9a46('0x46')][_0x9a46('0x53')]+'%'};return _0x23c02e;})});}_0x23a2db=_[_0x9a46('0x51')]({},_0x23a2db,_0x582722[_0x9a46('0x54')]);return db[_0x9a46('0x66')]['count']({'where':_0x23a2db[_0x9a46('0x4e')]})['then'](function(_0x12d5a7){_0x4642e7[_0x9a46('0x31')]=_0x12d5a7;if(_0x582722['query']['includeAll']){_0x23a2db[_0x9a46('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x9a46('0x56')](_0x23a2db);})[_0x9a46('0x21')](function(_0x917ff1){_0x4642e7[_0x9a46('0x57')]=_0x917ff1;return _0x4642e7;});}})[_0x9a46('0x21')](respondWithFilteredResult(_0x2d8867,_0x23a2db))[_0x9a46('0x2a')](handleError(_0x2d8867,null));};exports[_0x9a46('0x69')]=function(_0x4da1d6,_0x375daa,_0x5a4644){return db[_0x9a46('0x3f')][_0x9a46('0x5f')]({'where':{'id':_0x4da1d6[_0x9a46('0x59')]['id']}})['then'](handleEntityNotFound(_0x375daa,null))[_0x9a46('0x21')](function(_0x18bb1a){if(_0x18bb1a){return _0x18bb1a[_0x9a46('0x69')](_0x4da1d6[_0x9a46('0x46')][_0x9a46('0x6a')]);}})['then'](respondWithStatusCode(_0x375daa,null))['catch'](handleError(_0x375daa,null));};exports[_0x9a46('0x6b')]=function(_0x5b7ff7,_0x41031e,_0x4d4e42){if(_0x5b7ff7[_0x9a46('0x5c')]['id']){delete _0x5b7ff7[_0x9a46('0x5c')]['id'];}return db[_0x9a46('0x3f')][_0x9a46('0x5f')]({'where':{'id':_0x5b7ff7['params']['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x41031e,null))[_0x9a46('0x21')](function(_0x4ad640){if(_0x4ad640){_0x5b7ff7[_0x9a46('0x5c')][_0x9a46('0x68')]=_0x4ad640['id'];return db[_0x9a46('0x6c')]['create'](_0x5b7ff7['body']);}})['then'](respondWithResult(_0x41031e,null))[_0x9a46('0x2a')](handleError(_0x41031e,null));};exports[_0x9a46('0x6d')]=function(_0x48a406,_0x2b2839,_0x2d627a){var _0x515fa8={'raw':![],'where':{}};var _0x11ccff={};var _0x204cc5={'count':0x0,'rows':[]};return db[_0x9a46('0x3f')][_0x9a46('0x65')]({'where':{'id':_0x48a406[_0x9a46('0x59')]['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x2b2839,null))[_0x9a46('0x21')](function(_0xf91da3){if(_0xf91da3){_0x11ccff['model']=_[_0x9a46('0x47')](db[_0x9a46('0x6c')][_0x9a46('0x40')]);_0x11ccff[_0x9a46('0x46')]=_[_0x9a46('0x47')](_0x48a406[_0x9a46('0x46')]);_0x11ccff['filters']=_[_0x9a46('0x48')](_0x11ccff['model'],_0x11ccff[_0x9a46('0x46')]);_0x515fa8[_0x9a46('0x49')]=_['intersection'](_0x11ccff[_0x9a46('0x44')],qs['fields'](_0x48a406[_0x9a46('0x46')][_0x9a46('0x4a')]));_0x515fa8[_0x9a46('0x49')]=_0x515fa8['attributes'][_0x9a46('0x67')]?_0x515fa8[_0x9a46('0x49')]:_0x11ccff[_0x9a46('0x44')];if(!_0x48a406['query']['hasOwnProperty'](_0x9a46('0x4c'))){_0x515fa8[_0x9a46('0x30')]=qs[_0x9a46('0x30')](_0x48a406[_0x9a46('0x46')]['limit']);_0x515fa8[_0x9a46('0x2e')]=qs['offset'](_0x48a406['query'][_0x9a46('0x2e')]);}_0x515fa8[_0x9a46('0x6e')]=qs[_0x9a46('0x4d')](_0x48a406['query'][_0x9a46('0x4d')]);_0x515fa8[_0x9a46('0x4e')]=qs['filters'](_[_0x9a46('0x4f')](_0x48a406[_0x9a46('0x46')],_0x11ccff[_0x9a46('0x50')]));_0x515fa8['where']['FaxAccountId']=_0xf91da3['id'];if(_0x48a406[_0x9a46('0x46')]['filter']){_0x515fa8[_0x9a46('0x4e')]=_[_0x9a46('0x51')](_0x515fa8['where'],{'$or':_[_0x9a46('0x45')](_0x515fa8['attributes'],function(_0x11c54e){var _0x241ac6={};_0x241ac6[_0x11c54e]={'$like':'%'+_0x48a406[_0x9a46('0x46')]['filter']+'%'};return _0x241ac6;})});}_0x515fa8=_[_0x9a46('0x51')]({},_0x515fa8,_0x48a406[_0x9a46('0x54')]);return db[_0x9a46('0x6c')][_0x9a46('0x31')]({'where':_0x515fa8['where']})['then'](function(_0x29c252){_0x204cc5['count']=_0x29c252;if(_0x48a406[_0x9a46('0x46')][_0x9a46('0x5a')]){_0x515fa8['include']=[{'all':!![]}];}return db[_0x9a46('0x6c')][_0x9a46('0x56')](_0x515fa8);})[_0x9a46('0x21')](function(_0x4846a9){_0x204cc5[_0x9a46('0x57')]=_0x4846a9;return _0x204cc5;});}})['then'](respondWithFilteredResult(_0x2b2839,_0x515fa8))['catch'](handleError(_0x2b2839,null));};exports[_0x9a46('0x6f')]=function(_0x343d29,_0x5764d6,_0x55a654){return db[_0x9a46('0x3f')]['find']({'where':{'id':_0x343d29[_0x9a46('0x59')]['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x5764d6,null))[_0x9a46('0x21')](function(_0xce1329){if(_0xce1329){return _0xce1329[_0x9a46('0x6f')](_0x343d29['query'][_0x9a46('0x6a')]);}})[_0x9a46('0x21')](respondWithStatusCode(_0x5764d6,null))[_0x9a46('0x2a')](handleError(_0x5764d6,null));};exports['addInteraction']=function(_0xaf3271,_0xbc8f2a,_0x31596c){return db[_0x9a46('0x70')][_0x9a46('0x5f')]({'where':{'id':_0xaf3271[_0x9a46('0x59')]['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0xbc8f2a,null))[_0x9a46('0x21')](function(_0x55cc20){if(_0x55cc20){return _0x55cc20['addInteraction'](_0xaf3271[_0x9a46('0x5c')][_0x9a46('0x6a')],_[_0x9a46('0x71')](_0xaf3271[_0x9a46('0x5c')],[_0x9a46('0x6a'),'id'])||{});}})[_0x9a46('0x21')](respondWithResult(_0xbc8f2a,null))[_0x9a46('0x2a')](handleError(_0xbc8f2a,null));};exports['getInteractions']=function(_0x500926,_0x3d7e07,_0x4a1cce){var _0x327780={'raw':![],'where':{}};var _0x325ae6={};var _0x5d72f6={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x500926[_0x9a46('0x59')]['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x3d7e07,null))[_0x9a46('0x21')](function(_0x1dc4af){if(_0x1dc4af){_0x325ae6[_0x9a46('0x44')]=_[_0x9a46('0x47')](db['FaxInteraction']['rawAttributes']);_0x325ae6[_0x9a46('0x46')]=_[_0x9a46('0x47')](_0x500926[_0x9a46('0x46')]);_0x325ae6[_0x9a46('0x50')]=_[_0x9a46('0x48')](_0x325ae6[_0x9a46('0x44')],_0x325ae6[_0x9a46('0x46')]);_0x327780['attributes']=_[_0x9a46('0x48')](_0x325ae6[_0x9a46('0x44')],qs['fields'](_0x500926[_0x9a46('0x46')][_0x9a46('0x4a')]));_0x327780[_0x9a46('0x49')]=_0x327780[_0x9a46('0x49')][_0x9a46('0x67')]?_0x327780[_0x9a46('0x49')]:_0x325ae6[_0x9a46('0x44')];if(!_0x500926[_0x9a46('0x46')][_0x9a46('0x4b')]('nolimit')){_0x327780[_0x9a46('0x30')]=qs[_0x9a46('0x30')](_0x500926[_0x9a46('0x46')]['limit']);_0x327780[_0x9a46('0x2e')]=qs['offset'](_0x500926[_0x9a46('0x46')][_0x9a46('0x2e')]);}_0x327780[_0x9a46('0x6e')]=qs[_0x9a46('0x4d')](_0x500926[_0x9a46('0x46')][_0x9a46('0x4d')]);_0x327780[_0x9a46('0x4e')]=qs['filters'](_['pick'](_0x500926[_0x9a46('0x46')],_0x325ae6[_0x9a46('0x50')]));_0x327780[_0x9a46('0x4e')][_0x9a46('0x68')]=_0x1dc4af['id'];if(_0x500926[_0x9a46('0x46')][_0x9a46('0x53')]){_0x327780[_0x9a46('0x4e')]=_[_0x9a46('0x51')](_0x327780['where'],{'$or':_[_0x9a46('0x45')](_0x327780[_0x9a46('0x49')],function(_0x998d1a){var _0x417e1a={};_0x417e1a[_0x998d1a]={'$like':'%'+_0x500926['query'][_0x9a46('0x53')]+'%'};return _0x417e1a;})});}_0x327780=_[_0x9a46('0x51')]({},_0x327780,_0x500926[_0x9a46('0x54')]);return db[_0x9a46('0x70')][_0x9a46('0x31')]({'where':_0x327780[_0x9a46('0x4e')]})['then'](function(_0x3d1bf8){_0x5d72f6[_0x9a46('0x31')]=_0x3d1bf8;if(_0x500926[_0x9a46('0x46')][_0x9a46('0x5a')]){_0x327780[_0x9a46('0x55')]=[{'model':db[_0x9a46('0x72')],'as':_0x9a46('0x73'),'required':![]},{'model':db[_0x9a46('0x74')],'as':_0x9a46('0x75'),'attributes':[_0x9a46('0x3b'),'fullname',_0x9a46('0x76')],'required':![]},{'model':db[_0x9a46('0x77')],'as':'Tags','attributes':['id','name',_0x9a46('0x78')],'where':_0x500926['query'][_0x9a46('0x79')]?{'id':_0x500926[_0x9a46('0x46')][_0x9a46('0x79')]}:undefined,'required':_0x500926[_0x9a46('0x46')][_0x9a46('0x79')]?!![]:![]}];}return db[_0x9a46('0x70')][_0x9a46('0x56')](_0x327780);})['then'](function(_0x56f816){_0x5d72f6[_0x9a46('0x57')]=_0x56f816;return _0x5d72f6;});}})[_0x9a46('0x21')](respondWithFilteredResult(_0x3d7e07,_0x327780))[_0x9a46('0x2a')](handleError(_0x3d7e07,null));};exports['addApplications']=function(_0x566128,_0x1897c7,_0x241780){return db[_0x9a46('0x3f')][_0x9a46('0x65')]({'where':{'id':_0x566128[_0x9a46('0x59')]['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x1897c7,null))[_0x9a46('0x21')](function(_0x4faf04){if(_0x4faf04){return db[_0x9a46('0x7a')][_0x9a46('0x7b')](function(_0x488523){return db['FaxApplication'][_0x9a46('0x37')]({'where':{'FaxAccountId':_0x566128['params']['id']},'transaction':_0x488523})[_0x9a46('0x21')](function(_0x16d0bb){var _0x291770=_[_0x9a46('0x45')](_0x566128[_0x9a46('0x5c')],function(_0x37ccbf){_0x37ccbf[_0x9a46('0x68')]=_0x566128[_0x9a46('0x59')]['id'];return _0x37ccbf;});return db['FaxApplication'][_0x9a46('0x7c')](_0x291770,{'transaction':_0x488523});});})[_0x9a46('0x21')](function(){return db[_0x9a46('0x7d')][_0x9a46('0x7e')]({'where':{'FaxAccountId':_0x566128['params']['id']},'order':'priority'});});}})[_0x9a46('0x21')](respondWithResult(_0x1897c7,null))['catch'](handleError(_0x1897c7,null));};exports[_0x9a46('0x7f')]=function(_0xbd8b62,_0x3df114,_0x48a357){var _0x58ebcb={};var _0x1f2374={};var _0x2600e3;var _0x18852e;return db['FaxAccount'][_0x9a46('0x65')]({'where':{'id':_0xbd8b62['params']['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x3df114,null))[_0x9a46('0x21')](function(_0x736090){if(_0x736090){_0x2600e3=_0x736090;_0x1f2374[_0x9a46('0x44')]=_['keys'](db[_0x9a46('0x7d')][_0x9a46('0x40')]);_0x1f2374['query']=_[_0x9a46('0x47')](_0xbd8b62[_0x9a46('0x46')]);_0x1f2374[_0x9a46('0x50')]=_[_0x9a46('0x48')](_0x1f2374[_0x9a46('0x44')],_0x1f2374['query']);_0x58ebcb[_0x9a46('0x49')]=_[_0x9a46('0x48')](_0x1f2374['model'],qs['fields'](_0xbd8b62[_0x9a46('0x46')][_0x9a46('0x4a')]));_0x58ebcb['attributes']=_0x58ebcb[_0x9a46('0x49')][_0x9a46('0x67')]?_0x58ebcb[_0x9a46('0x49')]:_0x1f2374['model'];_0x58ebcb['order']=qs[_0x9a46('0x4d')](_0xbd8b62[_0x9a46('0x46')]['sort']);_0x58ebcb[_0x9a46('0x4e')]=qs[_0x9a46('0x50')](_[_0x9a46('0x4f')](_0xbd8b62[_0x9a46('0x46')],_0x1f2374[_0x9a46('0x50')]));if(_0xbd8b62[_0x9a46('0x46')][_0x9a46('0x53')]){_0x58ebcb[_0x9a46('0x4e')]=_['merge'](_0x58ebcb[_0x9a46('0x4e')],{'$or':_[_0x9a46('0x45')](_0x58ebcb['attributes'],function(_0x29669a){var _0x5156b9={};_0x5156b9[_0x29669a]={'$like':'%'+_0xbd8b62[_0x9a46('0x46')][_0x9a46('0x53')]+'%'};return _0x5156b9;})});}_0x58ebcb=_[_0x9a46('0x51')]({},_0x58ebcb,_0xbd8b62[_0x9a46('0x54')]);return _0x2600e3[_0x9a46('0x7f')](_0x58ebcb);}})[_0x9a46('0x21')](function(_0x3b396c){if(_0x3b396c){_0x18852e=_0x3b396c[_0x9a46('0x67')];if(!_0xbd8b62[_0x9a46('0x46')]['hasOwnProperty'](_0x9a46('0x4c'))){_0x58ebcb[_0x9a46('0x30')]=qs[_0x9a46('0x30')](_0xbd8b62['query'][_0x9a46('0x30')]);_0x58ebcb[_0x9a46('0x2e')]=qs['offset'](_0xbd8b62[_0x9a46('0x46')][_0x9a46('0x2e')]);}return _0x2600e3[_0x9a46('0x7f')](_0x58ebcb);}})['then'](function(_0x131457){if(_0x131457){return _0x131457?{'count':_0x18852e,'rows':_0x131457}:null;}})[_0x9a46('0x21')](respondWithResult(_0x3df114,null))[_0x9a46('0x2a')](handleError(_0x3df114,null));};function Extension(_0x5da8a9,_0x481516,_0x4f0a45,_0x3a8aaa){this['context']=_0x9a46('0x80');this[_0x9a46('0x81')]=_0x5da8a9[_0x9a46('0x82')];this[_0x9a46('0x83')]=_0x3a8aaa;this[_0x9a46('0x42')]=_0x9a46('0x84');this[_0x9a46('0x85')]=_0x9a46('0x86');this['FaxAccountId']=_0x5da8a9['id'];this[_0x9a46('0x87')]=_0x481516;this[_0x9a46('0x88')]=_0x4f0a45;}function createExtensionsReciveFax(_0x98964e){var _0x2dc328=0x1;var _0x8352fd=[];_0x8352fd[_0x9a46('0x89')](new Extension(_0x98964e,_0x2dc328,'',_0x9a46('0x8a')));_0x2dc328+=0x1;_0x8352fd['push'](new Extension(_0x98964e,_0x2dc328,'CDR(type)=inbound-fax',_0x9a46('0x8b')));_0x2dc328+=0x1;for(var _0x153829 in _0x98964e){if(_0x98964e[_0x9a46('0x4b')](_0x153829)&&(_0x153829===_0x9a46('0x8c')||_0x153829===_0x9a46('0x82')||_0x153829==='gateway'||_0x153829===_0x9a46('0x8d')||_0x153829===_0x9a46('0x8e')||_0x153829===_0x9a46('0x8f')||_0x153829===_0x9a46('0x90')||_0x153829===_0x9a46('0x91')||_0x153829===_0x9a46('0x92'))){_0x8352fd[_0x9a46('0x89')](new Extension(_0x98964e,_0x2dc328,_0x9a46('0x93')+_0x153829+')='+_0x98964e[_0x153829],_0x9a46('0x8b')));_0x2dc328+=0x1;}}_0x8352fd[_0x9a46('0x89')](new Extension(_0x98964e,_0x2dc328,'6',_0x9a46('0x94')));_0x2dc328+=0x1;_0x8352fd[_0x9a46('0x89')](new Extension(_0x98964e,_0x2dc328,'/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',_0x9a46('0x95')));_0x2dc328=0x0;return _0x8352fd;}exports[_0x9a46('0x96')]=function(_0x2c6403,_0x3454ba,_0x1a9ec1){var _0x11710a;return db[_0x9a46('0x7a')][_0x9a46('0x7b')](function(_0xec13dc){return db[_0x9a46('0x3f')][_0x9a46('0x5b')](_0x2c6403['body'],{'transaction':_0xec13dc})['then'](function(_0x15e6ba){_0x11710a=_0x15e6ba[_0x9a46('0x38')]({'plain':!![]});return db[_0x9a46('0x97')][_0x9a46('0x7c')](createExtensionsReciveFax(_0x11710a),{'transaction':_0xec13dc});});})['then'](function(){return _0x11710a;})[_0x9a46('0x21')](respondWithResult(_0x3454ba,null))[_0x9a46('0x2a')](handleError(_0x3454ba,null));};exports[_0x9a46('0x98')]=function(_0x349019,_0x27ba3e,_0xa94cac){var _0x11f5cc;return db[_0x9a46('0x7a')][_0x9a46('0x7b')](function(_0x391338){return db['FaxAccount']['update'](_0x349019[_0x9a46('0x5c')],{'where':{'id':_0x349019[_0x9a46('0x5c')]['id']},'transaction':_0x391338})[_0x9a46('0x21')](function(_0x5dc94f){return db[_0x9a46('0x97')][_0x9a46('0x37')]({'where':{'FaxAccountId':_0x349019[_0x9a46('0x5c')]['id']},'transaction':_0x391338})[_0x9a46('0x21')](function(_0xdf21ab){return db[_0x9a46('0x97')][_0x9a46('0x7c')](createExtensionsReciveFax(_[_0x9a46('0x71')](_0x349019[_0x9a46('0x5c')],[_0x9a46('0x99'),'key',_0x9a46('0x9a'),'updatedAt',_0x9a46('0x9b'),_0x9a46('0x9c')])),{'transaction':_0x391338});});});})['then'](function(){return db[_0x9a46('0x3f')][_0x9a46('0x9d')](_0x349019['body']['id']);})[_0x9a46('0x21')](respondWithResult(_0x27ba3e,null))['catch'](handleError(_0x27ba3e,null));};exports['getMessages']=function(_0x317812,_0x1786a4,_0x331912){var _0x5be097={'raw':!![],'where':{}};var _0x5730c0={};var _0x45a96e={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x317812[_0x9a46('0x59')]['id']}})['then'](handleEntityNotFound(_0x1786a4,null))[_0x9a46('0x21')](function(_0x48ebb9){if(_0x48ebb9){_0x5730c0[_0x9a46('0x44')]=_['keys'](db[_0x9a46('0x9e')]['rawAttributes']);_0x5730c0[_0x9a46('0x46')]=_[_0x9a46('0x47')](_0x317812[_0x9a46('0x46')]);_0x5730c0[_0x9a46('0x50')]=_[_0x9a46('0x48')](_0x5730c0[_0x9a46('0x44')],_0x5730c0[_0x9a46('0x46')]);_0x5be097[_0x9a46('0x49')]=_[_0x9a46('0x48')](_0x5730c0['model'],qs[_0x9a46('0x4a')](_0x317812[_0x9a46('0x46')][_0x9a46('0x4a')]));_0x5be097[_0x9a46('0x49')]=_0x5be097[_0x9a46('0x49')][_0x9a46('0x67')]?_0x5be097[_0x9a46('0x49')]:_0x5730c0['model'];if(!_0x317812['query']['hasOwnProperty']('nolimit')){_0x5be097[_0x9a46('0x30')]=qs[_0x9a46('0x30')](_0x317812['query'][_0x9a46('0x30')]);_0x5be097[_0x9a46('0x2e')]=qs[_0x9a46('0x2e')](_0x317812['query'][_0x9a46('0x2e')]);}_0x5be097['order']=qs[_0x9a46('0x4d')](_0x317812[_0x9a46('0x46')][_0x9a46('0x4d')]);_0x5be097[_0x9a46('0x4e')]=qs[_0x9a46('0x50')](_[_0x9a46('0x4f')](_0x317812['query'],_0x5730c0[_0x9a46('0x50')]));_0x5be097[_0x9a46('0x4e')][_0x9a46('0x68')]=_0x48ebb9['id'];if(_0x317812['query'][_0x9a46('0x53')]){_0x5be097['where']=_[_0x9a46('0x51')](_0x5be097['where'],{'$or':_['map'](_0x5be097[_0x9a46('0x49')],function(_0x2e9b60){var _0x3c7e3c={};_0x3c7e3c[_0x2e9b60]={'$like':'%'+_0x317812[_0x9a46('0x46')]['filter']+'%'};return _0x3c7e3c;})});}if(_0x317812[_0x9a46('0x46')][_0x9a46('0x9f')]){var _0x200a70=_0x317812[_0x9a46('0x46')]['$gte'][_0x9a46('0xa0')](',');var _0x2eda7e={};_0x2eda7e[_0x200a70[0x0]]={'$gte':moment(_0x200a70[0x1])[_0x9a46('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x5be097[_0x9a46('0x4e')]=_[_0x9a46('0x51')](_0x5be097[_0x9a46('0x4e')],_0x2eda7e);}_0x5be097=_[_0x9a46('0x51')]({},_0x5be097,_0x317812[_0x9a46('0x54')]);return db['FaxMessage'][_0x9a46('0x31')]({'where':_0x5be097['where']})[_0x9a46('0x21')](function(_0x3720c0){_0x45a96e[_0x9a46('0x31')]=_0x3720c0;if(_0x317812[_0x9a46('0x46')][_0x9a46('0x5a')]){_0x5be097[_0x9a46('0x55')]=[{'all':!![]}];}return db[_0x9a46('0x9e')][_0x9a46('0x56')](_0x5be097);})[_0x9a46('0x21')](function(_0x4052bf){_0x45a96e['rows']=_0x4052bf;return _0x45a96e;});}})[_0x9a46('0x21')](respondWithFilteredResult(_0x1786a4,_0x5be097))[_0x9a46('0x2a')](handleError(_0x1786a4,null));};exports[_0x9a46('0xa2')]=function(_0x5cfad1,_0x41ae82,_0x377088){var _0x41018b,_0x4834b0={},_0x32f0b0;if(_0x5cfad1[_0x9a46('0x5c')]['to']){_0x32f0b0=_0x5cfad1[_0x9a46('0x5c')]['to'][0x0];}return db[_0x9a46('0x3f')][_0x9a46('0x5f')]({'where':{'id':_0x5cfad1[_0x9a46('0x59')]['id']},'include':[{'model':db[_0x9a46('0xa3')],'as':_0x9a46('0xa4'),'include':[{'model':db['CmContact'],'as':_0x9a46('0xa5'),'where':{'fax':_0x32f0b0},'limit':0x1,'order':[[_0x9a46('0xa6'),_0x9a46('0xa7')]]}]}]})[_0x9a46('0x21')](handleEntityNotFound(_0x41ae82,null))['then'](function(_0x504a6b){_0x41018b=_0x504a6b;if(_0x5cfad1[_0x9a46('0x5c')]['attachments']&&_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][_0x9a46('0x67')]){for(var _0x47d3bc=0x0;_0x47d3bc<_0x5cfad1['body'][_0x9a46('0xa8')][_0x9a46('0x67')];_0x47d3bc+=0x1){_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][_0x47d3bc]={'filename':_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][_0x47d3bc][_0x9a46('0x3b')],'id':_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][_0x47d3bc]['id'],'path':path[_0x9a46('0xa9')](config[_0x9a46('0xaa')],_0x9a46('0xab'),_0x5cfad1['body']['attachments'][_0x47d3bc]['basename'])};}}return respondWithRpcPromise(_0x9a46('0xac'),_0x9a46('0xac'),{'FaxAccountId':_[_0x9a46('0xad')](_0x5cfad1['params']['id'])?undefined:_0x5cfad1['params']['id'],'path':_[_0x9a46('0xad')](_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][0x0]['path'])?undefined:_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][0x0][_0x9a46('0x7')],'fax':_['isNil'](_0x5cfad1[_0x9a46('0x5c')]['to'][0x0])?undefined:_0x5cfad1['body']['to'][0x0]},client9002);})['then'](function(){if(_0x41018b){if(_[_0x9a46('0xad')](_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xae')])){_0x5cfad1[_0x9a46('0x5c')]['from']=util[_0x9a46('0xa1')](_0x9a46('0xaf'),_0x41018b[_0x9a46('0x3b')],_0x41018b[_0x9a46('0xb0')]);}if(_0x41018b[_0x9a46('0xa4')]){if(_0x41018b['List'][_0x9a46('0xa5')]['length']){return _0x41018b[_0x9a46('0xa4')][_0x9a46('0xa5')][0x0];}else{return db[_0x9a46('0x72')][_0x9a46('0x5b')](_[_0x9a46('0x1b')](_0x5cfad1[_0x9a46('0x5c')],{'firstName':_0x5cfad1[_0x9a46('0x5c')]['to'][0x0],'phone':_0x5cfad1[_0x9a46('0x5c')]['to'][0x0],'fax':_0x5cfad1[_0x9a46('0x5c')]['to'][0x0],'ListId':_0x41018b[_0x9a46('0x9c')]}));}}else{throw new Error(_0x9a46('0xb1'));}}else{throw new Error(_0x9a46('0xb2'));}})[_0x9a46('0x21')](function(_0x122fa8){if(_0x122fa8){return db[_0x9a46('0x70')][_0x9a46('0x5f')]({'where':{'ContactId':_0x122fa8['id'],'closed':![],'FaxAccountId':_0x41018b['id']}})[_0x9a46('0x21')](function(_0x25bc1e){if(_0x25bc1e){return[_0x25bc1e,![]];}return db[_0x9a46('0x70')]['create']({'UserId':_0x5cfad1[_0x9a46('0x5e')]['id'],'ContactId':_0x122fa8['id'],'FaxAccountId':_0x41018b['id'],'fax':_0x5cfad1[_0x9a46('0x5c')]['to'][0x0],'firstMsgDirection':_0x9a46('0xb3'),'Messages':[_['merge'](_0x5cfad1[_0x9a46('0x5c')],{'read':![],'body':_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][0x0][_0x9a46('0xb4')],'FaxAccountId':_0x41018b['id'],'UserId':_0x5cfad1[_0x9a46('0x5e')]['id'],'ContactId':_0x122fa8['id'],'AttachmentId':_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][0x0]['id']})]},{'include':[{'model':db[_0x9a46('0x9e')],'as':_0x9a46('0xb5')}]})[_0x9a46('0x21')](function(_0x3add3b){return[_0x3add3b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x9a46('0xb6')](function(_0x8294ae,_0x59e97e){if(_0x59e97e){return _0x8294ae;}return db[_0x9a46('0x9e')][_0x9a46('0x5b')]({'direction':_0x9a46('0xb3'),'read':![],'body':_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][0x0][_0x9a46('0xb4')],'FaxAccountId':_0x41018b['id'],'FaxInteractionId':_0x8294ae['id'],'UserId':_0x5cfad1['user']['id'],'ContactId':_0x8294ae[_0x9a46('0xb7')],'AttachmentId':_0x5cfad1[_0x9a46('0x5c')]['attachments'][0x0]['id']})[_0x9a46('0x21')](function(_0x105b6a){_0x8294ae[_0x9a46('0xb8')][_0x9a46('0xb5')]=[];_0x8294ae[_0x9a46('0xb8')][_0x9a46('0xb5')]['push'](_0x105b6a[_0x9a46('0xb8')]);return _0x8294ae;});})[_0x9a46('0x21')](function(_0x10b979){respondWithRpcPromise(_0x9a46('0xb9'),_0x9a46('0xb9'),{'FaxAccountId':_['isNil'](_0x5cfad1[_0x9a46('0x59')]['id'])?undefined:_0x5cfad1[_0x9a46('0x59')]['id'],'path':_[_0x9a46('0xad')](_0x5cfad1[_0x9a46('0x5c')]['attachments'][0x0][_0x9a46('0x7')])?undefined:_0x5cfad1[_0x9a46('0x5c')][_0x9a46('0xa8')][0x0][_0x9a46('0x7')],'fax':_[_0x9a46('0xad')](_0x5cfad1[_0x9a46('0x5c')]['to'][0x0])?undefined:_0x5cfad1[_0x9a46('0x5c')]['to'][0x0],'AttachmentId':_0x5cfad1['body']['attachments'][0x0]['id']},client9002)[_0x9a46('0x21')](function(_0x5d58c8){logger['info']('SendFaxRpc,\x20%s',_0x5d58c8);})[_0x9a46('0x2a')](function(_0x2405fc){logger[_0x9a46('0x22')](_0x9a46('0xba'),_0x2405fc);});return _0x10b979;})[_0x9a46('0x21')](respondWithResult(_0x41ae82,null))['catch'](handleError(_0x41ae82,null));};exports[_0x9a46('0xbb')]=function(_0x2a1729,_0x4303ac,_0x4d9d69){return db[_0x9a46('0x3f')][_0x9a46('0x5f')]({'where':{'id':_0x2a1729['params']['id']}})[_0x9a46('0x21')](handleEntityNotFound(_0x4303ac,null))[_0x9a46('0x21')](function(_0x102dc4){if(_0x102dc4){return _0x102dc4[_0x9a46('0xbb')](_0x2a1729['body'][_0x9a46('0x6a')],_[_0x9a46('0x71')](_0x2a1729[_0x9a46('0x5c')],[_0x9a46('0x6a'),'id'])||{})[_0x9a46('0xb6')](function(_0x3a0b6c){for(var _0x3d5829=0x0;_0x3d5829<_0x2a1729[_0x9a46('0x5c')][_0x9a46('0x6a')][_0x9a46('0x67')];_0x3d5829+=0x1){socket[_0x9a46('0xbc')]('userFaxAccount:save',{'UserId':Number(_0x2a1729['body']['ids'][_0x3d5829]),'FaxAccountId':Number(_0x2a1729['params']['id'])});}return _0x3a0b6c;});}})[_0x9a46('0x21')](respondWithResult(_0x4303ac,null))['catch'](handleError(_0x4303ac,null));};exports[_0x9a46('0xbd')]=function(_0x570ef7,_0x3f36ed,_0x2ac1ad){return db[_0x9a46('0x3f')][_0x9a46('0x5f')]({'where':{'id':_0x570ef7[_0x9a46('0x59')]['id']}})['then'](handleEntityNotFound(_0x3f36ed,null))[_0x9a46('0x21')](function(_0x4e5969){if(_0x4e5969){return _0x4e5969[_0x9a46('0xbd')](_0x570ef7[_0x9a46('0x46')][_0x9a46('0x6a')])[_0x9a46('0x21')](function(){if(_[_0x9a46('0xbe')](_0x570ef7['query'][_0x9a46('0x6a')])){for(var _0x37bde3=0x0;_0x37bde3<_0x570ef7[_0x9a46('0x46')][_0x9a46('0x6a')][_0x9a46('0x67')];_0x37bde3+=0x1){socket[_0x9a46('0xbc')](_0x9a46('0xbf'),{'UserId':Number(_0x570ef7[_0x9a46('0x46')][_0x9a46('0x6a')][_0x37bde3]),'FaxAccountId':Number(_0x570ef7[_0x9a46('0x59')]['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x570ef7[_0x9a46('0x46')][_0x9a46('0x6a')]),'FaxAccountId':Number(_0x570ef7[_0x9a46('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x3f36ed,null))[_0x9a46('0x2a')](handleError(_0x3f36ed,null));};exports['getAgents']=function(_0x23f61a,_0x4bc5cc,_0x430caf){var _0x35e4b3={};var _0x263f48={};var _0x1fcd3d;var _0x2505fb;return db[_0x9a46('0x3f')]['findOne']({'where':{'id':_0x23f61a['params']['id']}})['then'](handleEntityNotFound(_0x4bc5cc,null))['then'](function(_0x1fb4c0){if(_0x1fb4c0){_0x1fcd3d=_0x1fb4c0;_0x263f48[_0x9a46('0x44')]=_[_0x9a46('0x47')](db[_0x9a46('0x74')][_0x9a46('0x40')]);_0x263f48[_0x9a46('0x46')]=_[_0x9a46('0x47')](_0x23f61a[_0x9a46('0x46')]);_0x263f48[_0x9a46('0x50')]=_[_0x9a46('0x48')](_0x263f48[_0x9a46('0x44')],_0x263f48[_0x9a46('0x46')]);_0x35e4b3[_0x9a46('0x49')]=_[_0x9a46('0x48')](_0x263f48[_0x9a46('0x44')],qs[_0x9a46('0x4a')](_0x23f61a[_0x9a46('0x46')][_0x9a46('0x4a')]));_0x35e4b3[_0x9a46('0x49')]=_0x35e4b3['attributes'][_0x9a46('0x67')]?_0x35e4b3[_0x9a46('0x49')]:_0x263f48['model'];_0x35e4b3[_0x9a46('0x6e')]=qs['sort'](_0x23f61a['query'][_0x9a46('0x4d')]);_0x35e4b3[_0x9a46('0x4e')]=qs[_0x9a46('0x50')](_[_0x9a46('0x4f')](_0x23f61a[_0x9a46('0x46')],_0x263f48[_0x9a46('0x50')]));if(_0x23f61a[_0x9a46('0x46')]['filter']){_0x35e4b3['where']=_[_0x9a46('0x51')](_0x35e4b3[_0x9a46('0x4e')],{'$or':_[_0x9a46('0x45')](_0x35e4b3[_0x9a46('0x49')],function(_0x1b5fc6){var _0x528c16={};_0x528c16[_0x1b5fc6]={'$like':'%'+_0x23f61a[_0x9a46('0x46')][_0x9a46('0x53')]+'%'};return _0x528c16;})});}_0x35e4b3=_['merge']({},_0x35e4b3,_0x23f61a[_0x9a46('0x54')]);return _0x1fcd3d[_0x9a46('0xc0')](_0x35e4b3);}})[_0x9a46('0x21')](function(_0x2ec638){if(_0x2ec638){_0x2505fb=_0x2ec638[_0x9a46('0x67')];if(!_0x23f61a[_0x9a46('0x46')]['hasOwnProperty'](_0x9a46('0x4c'))){_0x35e4b3[_0x9a46('0x30')]=qs[_0x9a46('0x30')](_0x23f61a[_0x9a46('0x46')][_0x9a46('0x30')]);_0x35e4b3[_0x9a46('0x2e')]=qs[_0x9a46('0x2e')](_0x23f61a[_0x9a46('0x46')][_0x9a46('0x2e')]);}return _0x1fcd3d[_0x9a46('0xc0')](_0x35e4b3);}})[_0x9a46('0x21')](function(_0x597bae){if(_0x597bae){return _0x597bae?{'count':_0x2505fb,'rows':_0x597bae}:null;}})[_0x9a46('0x21')](respondWithResult(_0x4bc5cc,null))[_0x9a46('0x2a')](handleError(_0x4bc5cc,null));}; \ No newline at end of file +var _0xece2=['/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','json','undefined','limit','offset','count','Content-Range','update','then','get','FaxAccounts','UserProfileResource','status','name','send','index','map','FaxAccount','fieldName','type','key','query','attributes','model','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','rows','show','params','mandatoryDispositionPause','keys','intersection','includeAll','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','destroy','describe','addDisposition','Disposition','create','order','FaxAccountId','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','findOne','CmContact','Contact','User','Owner','fullname','Tags','color','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','getApplications','rawAttributes','context','from-voip-provider','localstationid','app','system','Fax\x20Extension','appdata','push','Set','ecm','gateway','faxdetect','headerinfo','maxrate','modem','t38timeout','FAXOPT(','Wait'];(function(_0x50fd7b,_0xe67a49){var _0x51b9ee=function(_0x21e00c){while(--_0x21e00c){_0x50fd7b['push'](_0x50fd7b['shift']());}};_0x51b9ee(++_0xe67a49);}(_0xece2,0x19f));var _0x2ece=function(_0x58e6c4,_0x214b41){_0x58e6c4=_0x58e6c4-0x0;var _0x3aa127=_0xece2[_0x58e6c4];return _0x3aa127;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ece('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ece('0x1'));var rp=require(_0x2ece('0x2'));var moment=require(_0x2ece('0x3'));var BPromise=require(_0x2ece('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2ece('0x5'));var csv=require(_0x2ece('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2ece('0x7'));var _=require(_0x2ece('0x8'));var squel=require(_0x2ece('0x9'));var crypto=require('crypto');var jsforce=require(_0x2ece('0xa'));var deskjs=require(_0x2ece('0xb'));var toCsv=require(_0x2ece('0x6'));var querystring=require(_0x2ece('0xc'));var Papa=require('papaparse');var Redis=require(_0x2ece('0xd'));var authService=require(_0x2ece('0xe'));var qs=require(_0x2ece('0xf'));var as=require(_0x2ece('0x10'));var hardwareService=require(_0x2ece('0x11'));var logger=require(_0x2ece('0x12'))(_0x2ece('0x13'));var utils=require(_0x2ece('0x14'));var config=require(_0x2ece('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x2ece('0x16')],{'host':_0x2ece('0x17'),'port':0x18eb});var socket=require(_0x2ece('0x18'))(new Redis(config[_0x2ece('0x16')]));require('./faxAccount.socket')[_0x2ece('0x19')](socket);var jayson=require(_0x2ece('0x1a'));var client=jayson[_0x2ece('0x1b')][_0x2ece('0x1c')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3834fc,_0x4ff1ac,_0x1fbbfd,_0x178bd3){return new BPromise(function(_0x170ab8,_0x1a496a){var _0x477719=_0x178bd3||client;return _0x477719['request'](_0x3834fc,_0x1fbbfd)['then'](function(_0x53c988){logger[_0x2ece('0x1d')](_0x2ece('0x1e'),_0x4ff1ac,'request\x20sent');logger[_0x2ece('0x1f')](_0x2ece('0x20'),_0x4ff1ac,_0x2ece('0x21'),JSON[_0x2ece('0x22')](_0x53c988));if(_0x53c988[_0x2ece('0x23')]){if(_0x53c988[_0x2ece('0x23')][_0x2ece('0x24')]===0x1f4){logger[_0x2ece('0x23')]('FaxAccount,\x20%s,\x20%s',_0x4ff1ac,_0x53c988[_0x2ece('0x23')]['message']);return _0x1a496a(_0x53c988['error'][_0x2ece('0x25')]);}logger[_0x2ece('0x23')](_0x2ece('0x1e'),_0x4ff1ac,_0x53c988['error']['message']);return _0x170ab8(_0x53c988[_0x2ece('0x23')][_0x2ece('0x25')]);}else{logger[_0x2ece('0x1d')](_0x2ece('0x1e'),_0x4ff1ac,_0x2ece('0x21'));_0x170ab8(_0x53c988['result'][_0x2ece('0x25')]);}})[_0x2ece('0x26')](function(_0x4eee17){logger[_0x2ece('0x23')](_0x2ece('0x1e'),_0x4ff1ac,_0x4eee17);_0x1a496a(_0x4eee17);});});}function respondWithStatusCode(_0x2231ed,_0x2d5e89){_0x2d5e89=_0x2d5e89||0xcc;return function(_0xc0987b){if(_0xc0987b){return _0x2231ed[_0x2ece('0x27')](_0x2d5e89);}return _0x2231ed['status'](_0x2d5e89)[_0x2ece('0x28')]();};}function respondWithResult(_0x2f5a93,_0x309c3e){_0x309c3e=_0x309c3e||0xc8;return function(_0x2ca12b){if(_0x2ca12b){return _0x2f5a93['status'](_0x309c3e)[_0x2ece('0x29')](_0x2ca12b);}};}function respondWithFilteredResult(_0x1b5d71,_0x27e732){return function(_0xeafa22){if(_0xeafa22){var _0x25041a=typeof _0x27e732['offset']===_0x2ece('0x2a')&&typeof _0x27e732[_0x2ece('0x2b')]===_0x2ece('0x2a');var _0x266277=_0xeafa22['count'];var _0xe50f76=_0x25041a?0x0:_0x27e732[_0x2ece('0x2c')];var _0x3a9d42=_0x25041a?_0xeafa22[_0x2ece('0x2d')]:_0x27e732[_0x2ece('0x2c')]+_0x27e732[_0x2ece('0x2b')];var _0x15b84a;if(_0x3a9d42>=_0x266277){_0x3a9d42=_0x266277;_0x15b84a=0xc8;}else{_0x15b84a=0xce;}_0x1b5d71['status'](_0x15b84a);return _0x1b5d71['set'](_0x2ece('0x2e'),_0xe50f76+'-'+_0x3a9d42+'/'+_0x266277)[_0x2ece('0x29')](_0xeafa22);}return null;};}function patchUpdates(_0x162b43){return function(_0x37e93f){try{jsonpatch['apply'](_0x37e93f,_0x162b43,!![]);}catch(_0x2bec59){return BPromise['reject'](_0x2bec59);}return _0x37e93f['save']();};}function saveUpdates(_0x4d0bbd,_0x266c2c){return function(_0x6cc083){if(_0x6cc083){return _0x6cc083[_0x2ece('0x2f')](_0x4d0bbd)['then'](function(_0x21bc27){return _0x21bc27;});}return null;};}function removeEntity(_0x4a64ef,_0xcc958a){return function(_0x107c20){if(_0x107c20){return _0x107c20['destroy']()[_0x2ece('0x30')](function(){var _0x58184e=_0x107c20[_0x2ece('0x31')]({'plain':!![]});var _0x59b469=_0x2ece('0x32');return db[_0x2ece('0x33')]['destroy']({'where':{'type':_0x59b469,'resourceId':_0x58184e['id']}})[_0x2ece('0x30')](function(){return _0x107c20;});})['then'](function(){_0x4a64ef[_0x2ece('0x34')](0xcc)[_0x2ece('0x28')]();});}};}function handleEntityNotFound(_0x3b132f,_0x233146){return function(_0x34f799){if(!_0x34f799){_0x3b132f[_0x2ece('0x27')](0x194);}return _0x34f799;};}function handleError(_0x473bf1,_0x32dcc1){_0x32dcc1=_0x32dcc1||0x1f4;return function(_0x5637f0){logger[_0x2ece('0x23')](_0x5637f0['stack']);if(_0x5637f0[_0x2ece('0x35')]){delete _0x5637f0[_0x2ece('0x35')];}_0x473bf1[_0x2ece('0x34')](_0x32dcc1)[_0x2ece('0x36')](_0x5637f0);};}exports[_0x2ece('0x37')]=function(_0x79c85c,_0x36c8c9){var _0x21b82c={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0xce62c5={},_0x4ea1d9={'count':0x0,'rows':[]};var _0x39f99f=_[_0x2ece('0x38')](db[_0x2ece('0x39')]['rawAttributes'],function(_0xe567d9){return{'name':_0xe567d9[_0x2ece('0x3a')],'type':_0xe567d9[_0x2ece('0x3b')][_0x2ece('0x3c')]};});_0xce62c5['model']=_[_0x2ece('0x38')](_0x39f99f,'name');_0xce62c5[_0x2ece('0x3d')]=_['keys'](_0x79c85c['query']);_0xce62c5['filters']=_['intersection'](_0xce62c5['model'],_0xce62c5[_0x2ece('0x3d')]);_0x21b82c[_0x2ece('0x3e')]=_['intersection'](_0xce62c5[_0x2ece('0x3f')],qs['fields'](_0x79c85c[_0x2ece('0x3d')][_0x2ece('0x40')]));_0x21b82c[_0x2ece('0x3e')]=_0x21b82c[_0x2ece('0x3e')][_0x2ece('0x41')]?_0x21b82c[_0x2ece('0x3e')]:_0xce62c5['model'];if(!_0x79c85c[_0x2ece('0x3d')][_0x2ece('0x42')](_0x2ece('0x43'))){_0x21b82c['limit']=qs['limit'](_0x79c85c[_0x2ece('0x3d')][_0x2ece('0x2b')]);_0x21b82c[_0x2ece('0x2c')]=qs[_0x2ece('0x2c')](_0x79c85c[_0x2ece('0x3d')][_0x2ece('0x2c')]);}_0x21b82c['order']=qs[_0x2ece('0x44')](_0x79c85c[_0x2ece('0x3d')][_0x2ece('0x44')]);_0x21b82c[_0x2ece('0x45')]=qs[_0x2ece('0x46')](_[_0x2ece('0x47')](_0x79c85c[_0x2ece('0x3d')],_0xce62c5[_0x2ece('0x46')]),_0x39f99f);if(_0x79c85c['query'][_0x2ece('0x48')]){_0x21b82c['where']=_[_0x2ece('0x49')](_0x21b82c[_0x2ece('0x45')],{'$or':_['map'](_0x39f99f,function(_0x57f0c1){if(_0x57f0c1[_0x2ece('0x3b')]!==_0x2ece('0x4a')){var _0x2bc0b={};_0x2bc0b[_0x57f0c1['name']]={'$like':'%'+_0x79c85c['query'][_0x2ece('0x48')]+'%'};return _0x2bc0b;}})});}_0x21b82c=_[_0x2ece('0x49')]({},_0x21b82c,_0x79c85c[_0x2ece('0x4b')]);var _0x4c2393={'where':_0x21b82c['where']};return db[_0x2ece('0x39')][_0x2ece('0x2d')](_0x4c2393)[_0x2ece('0x30')](function(_0x14a60f){_0x4ea1d9[_0x2ece('0x2d')]=_0x14a60f;if(_0x79c85c[_0x2ece('0x3d')]['includeAll']){_0x21b82c[_0x2ece('0x4c')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x21b82c);})[_0x2ece('0x30')](function(_0x484c22){_0x4ea1d9[_0x2ece('0x4d')]=_0x484c22;return _0x4ea1d9;})['then'](respondWithFilteredResult(_0x36c8c9,_0x21b82c))[_0x2ece('0x26')](handleError(_0x36c8c9,null));};exports[_0x2ece('0x4e')]=function(_0x1b6c6f,_0x5531d3){var _0x5901c9={'raw':![],'where':{'id':_0x1b6c6f[_0x2ece('0x4f')]['id']},'include':[{'model':db['Pause'],'as':_0x2ece('0x50')}]},_0x2e6be7={};_0x2e6be7[_0x2ece('0x3f')]=_[_0x2ece('0x51')](db[_0x2ece('0x39')]['rawAttributes']);_0x2e6be7[_0x2ece('0x3d')]=_[_0x2ece('0x51')](_0x1b6c6f[_0x2ece('0x3d')]);_0x2e6be7['filters']=_[_0x2ece('0x52')](_0x2e6be7[_0x2ece('0x3f')],_0x2e6be7[_0x2ece('0x3d')]);_0x5901c9['attributes']=_['intersection'](_0x2e6be7['model'],qs[_0x2ece('0x40')](_0x1b6c6f[_0x2ece('0x3d')][_0x2ece('0x40')]));_0x5901c9[_0x2ece('0x3e')]=_0x5901c9['attributes'][_0x2ece('0x41')]?_0x5901c9[_0x2ece('0x3e')]:_0x2e6be7[_0x2ece('0x3f')];if(_0x1b6c6f[_0x2ece('0x3d')][_0x2ece('0x53')]){_0x5901c9[_0x2ece('0x4c')]=[{'all':!![]}];}_0x5901c9=_[_0x2ece('0x49')]({},_0x5901c9,_0x1b6c6f[_0x2ece('0x4b')]);return db[_0x2ece('0x39')][_0x2ece('0x54')](_0x5901c9)['then'](handleEntityNotFound(_0x5531d3,null))[_0x2ece('0x30')](respondWithResult(_0x5531d3,null))[_0x2ece('0x26')](handleError(_0x5531d3,null));};exports['create']=function(_0x3963c0,_0x11b375){return db['FaxAccount']['create'](_0x3963c0['body'],{})[_0x2ece('0x30')](function(_0x22a9d2){var _0x53271d=_0x3963c0[_0x2ece('0x55')][_0x2ece('0x31')]({'plain':!![]});if(!_0x53271d)throw new Error(_0x2ece('0x56'));if(_0x53271d['role']===_0x2ece('0x55')){var _0x84d93=_0x22a9d2['get']({'plain':!![]});var _0x3f4ef8='FaxAccounts';return db['UserProfileSection'][_0x2ece('0x54')]({'where':{'name':_0x3f4ef8,'userProfileId':_0x53271d[_0x2ece('0x57')]},'raw':!![]})[_0x2ece('0x30')](function(_0x1462a5){if(_0x1462a5&&_0x1462a5['autoAssociation']===0x0){return db[_0x2ece('0x33')]['create']({'name':_0x84d93[_0x2ece('0x35')],'resourceId':_0x84d93['id'],'type':_0x1462a5['name'],'sectionId':_0x1462a5['id']},{})[_0x2ece('0x30')](function(){return _0x22a9d2;});}else{return _0x22a9d2;}})[_0x2ece('0x26')](function(_0x5d8c1d){logger[_0x2ece('0x23')](_0x2ece('0x58'),_0x5d8c1d);throw _0x5d8c1d;});}return _0x22a9d2;})[_0x2ece('0x30')](respondWithResult(_0x11b375,0xc9))[_0x2ece('0x26')](handleError(_0x11b375,null));};exports[_0x2ece('0x2f')]=function(_0x3effff,_0x35baaf){if(_0x3effff[_0x2ece('0x59')]['id']){delete _0x3effff[_0x2ece('0x59')]['id'];}return db['FaxAccount'][_0x2ece('0x54')]({'where':{'id':_0x3effff[_0x2ece('0x4f')]['id']},'include':[{'model':db[_0x2ece('0x5a')],'as':_0x2ece('0x50')}]})[_0x2ece('0x30')](handleEntityNotFound(_0x35baaf,null))[_0x2ece('0x30')](saveUpdates(_0x3effff['body'],null))['then'](respondWithResult(_0x35baaf,null))[_0x2ece('0x26')](handleError(_0x35baaf,null));};exports[_0x2ece('0x5b')]=function(_0x4c286d,_0x4f57db){return db[_0x2ece('0x39')][_0x2ece('0x54')]({'where':{'id':_0x4c286d[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x4f57db,null))['then'](removeEntity(_0x4f57db,null))['catch'](handleError(_0x4f57db,null));};exports[_0x2ece('0x5c')]=function(_0xc68071,_0x494c34){return db[_0x2ece('0x39')][_0x2ece('0x5c')]()[_0x2ece('0x30')](respondWithResult(_0x494c34,null))[_0x2ece('0x26')](handleError(_0x494c34,null));};exports[_0x2ece('0x5d')]=function(_0x5be909,_0x1eae98,_0x5d35c5){if(_0x5be909[_0x2ece('0x59')]['id']){delete _0x5be909[_0x2ece('0x59')]['id'];}return db[_0x2ece('0x39')][_0x2ece('0x54')]({'where':{'id':_0x5be909[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x1eae98,null))[_0x2ece('0x30')](function(_0x3769fd){if(_0x3769fd){_0x5be909['body']['FaxAccountId']=_0x3769fd['id'];return db[_0x2ece('0x5e')][_0x2ece('0x5f')](_0x5be909[_0x2ece('0x59')]);}})[_0x2ece('0x30')](respondWithResult(_0x1eae98,null))[_0x2ece('0x26')](handleError(_0x1eae98,null));};exports['getDispositions']=function(_0xe9b139,_0x10409c,_0x298e12){var _0x5d43aa={'raw':![],'where':{}};var _0xefc2f1={};var _0x40261e={'count':0x0,'rows':[]};return db[_0x2ece('0x39')]['findOne']({'where':{'id':_0xe9b139[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x10409c,null))['then'](function(_0x5473fa){if(_0x5473fa){_0xefc2f1[_0x2ece('0x3f')]=_[_0x2ece('0x51')](db[_0x2ece('0x5e')]['rawAttributes']);_0xefc2f1[_0x2ece('0x3d')]=_[_0x2ece('0x51')](_0xe9b139[_0x2ece('0x3d')]);_0xefc2f1[_0x2ece('0x46')]=_[_0x2ece('0x52')](_0xefc2f1['model'],_0xefc2f1[_0x2ece('0x3d')]);_0x5d43aa['attributes']=_[_0x2ece('0x52')](_0xefc2f1[_0x2ece('0x3f')],qs[_0x2ece('0x40')](_0xe9b139[_0x2ece('0x3d')][_0x2ece('0x40')]));_0x5d43aa[_0x2ece('0x3e')]=_0x5d43aa[_0x2ece('0x3e')]['length']?_0x5d43aa[_0x2ece('0x3e')]:_0xefc2f1[_0x2ece('0x3f')];if(!_0xe9b139[_0x2ece('0x3d')][_0x2ece('0x42')]('nolimit')){_0x5d43aa[_0x2ece('0x2b')]=qs['limit'](_0xe9b139[_0x2ece('0x3d')]['limit']);_0x5d43aa['offset']=qs[_0x2ece('0x2c')](_0xe9b139[_0x2ece('0x3d')][_0x2ece('0x2c')]);}_0x5d43aa[_0x2ece('0x60')]=qs[_0x2ece('0x44')](_0xe9b139[_0x2ece('0x3d')][_0x2ece('0x44')]);_0x5d43aa[_0x2ece('0x45')]=qs['filters'](_[_0x2ece('0x47')](_0xe9b139[_0x2ece('0x3d')],_0xefc2f1[_0x2ece('0x46')]));_0x5d43aa[_0x2ece('0x45')][_0x2ece('0x61')]=_0x5473fa['id'];if(_0xe9b139[_0x2ece('0x3d')]['filter']){_0x5d43aa['where']=_[_0x2ece('0x49')](_0x5d43aa['where'],{'$or':_[_0x2ece('0x38')](_0x5d43aa[_0x2ece('0x3e')],function(_0x414306){var _0x3982f2={};_0x3982f2[_0x414306]={'$like':'%'+_0xe9b139[_0x2ece('0x3d')]['filter']+'%'};return _0x3982f2;})});}_0x5d43aa=_[_0x2ece('0x49')]({},_0x5d43aa,_0xe9b139[_0x2ece('0x4b')]);return db[_0x2ece('0x5e')]['count']({'where':_0x5d43aa[_0x2ece('0x45')]})[_0x2ece('0x30')](function(_0x49df57){_0x40261e[_0x2ece('0x2d')]=_0x49df57;if(_0xe9b139[_0x2ece('0x3d')][_0x2ece('0x53')]){_0x5d43aa[_0x2ece('0x4c')]=[{'all':!![]}];}return db[_0x2ece('0x5e')][_0x2ece('0x62')](_0x5d43aa);})['then'](function(_0x78e5be){_0x40261e['rows']=_0x78e5be;return _0x40261e;});}})['then'](respondWithFilteredResult(_0x10409c,_0x5d43aa))[_0x2ece('0x26')](handleError(_0x10409c,null));};exports[_0x2ece('0x63')]=function(_0x547aab,_0x2deed7,_0x1feb2c){return db['FaxAccount'][_0x2ece('0x54')]({'where':{'id':_0x547aab[_0x2ece('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2deed7,null))[_0x2ece('0x30')](function(_0x143f29){if(_0x143f29){return _0x143f29['removeDispositions'](_0x547aab[_0x2ece('0x3d')][_0x2ece('0x64')]);}})[_0x2ece('0x30')](respondWithStatusCode(_0x2deed7,null))[_0x2ece('0x26')](handleError(_0x2deed7,null));};exports[_0x2ece('0x65')]=function(_0x19d473,_0x1fd808,_0x157685){if(_0x19d473['body']['id']){delete _0x19d473[_0x2ece('0x59')]['id'];}return db['FaxAccount'][_0x2ece('0x54')]({'where':{'id':_0x19d473[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x1fd808,null))[_0x2ece('0x30')](function(_0x12e5c7){if(_0x12e5c7){_0x19d473[_0x2ece('0x59')][_0x2ece('0x61')]=_0x12e5c7['id'];return db['CannedAnswer'][_0x2ece('0x5f')](_0x19d473['body']);}})[_0x2ece('0x30')](respondWithResult(_0x1fd808,null))[_0x2ece('0x26')](handleError(_0x1fd808,null));};exports[_0x2ece('0x66')]=function(_0x19e570,_0x4e8a22,_0x10f045){var _0x3787f2={'raw':![],'where':{}};var _0xbd0fa6={};var _0xce140e={'count':0x0,'rows':[]};return db[_0x2ece('0x39')]['findOne']({'where':{'id':_0x19e570[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x4e8a22,null))[_0x2ece('0x30')](function(_0x7a1996){if(_0x7a1996){_0xbd0fa6['model']=_[_0x2ece('0x51')](db[_0x2ece('0x67')]['rawAttributes']);_0xbd0fa6[_0x2ece('0x3d')]=_['keys'](_0x19e570[_0x2ece('0x3d')]);_0xbd0fa6['filters']=_[_0x2ece('0x52')](_0xbd0fa6[_0x2ece('0x3f')],_0xbd0fa6[_0x2ece('0x3d')]);_0x3787f2[_0x2ece('0x3e')]=_[_0x2ece('0x52')](_0xbd0fa6[_0x2ece('0x3f')],qs[_0x2ece('0x40')](_0x19e570[_0x2ece('0x3d')][_0x2ece('0x40')]));_0x3787f2[_0x2ece('0x3e')]=_0x3787f2['attributes'][_0x2ece('0x41')]?_0x3787f2['attributes']:_0xbd0fa6['model'];if(!_0x19e570[_0x2ece('0x3d')][_0x2ece('0x42')](_0x2ece('0x43'))){_0x3787f2[_0x2ece('0x2b')]=qs[_0x2ece('0x2b')](_0x19e570['query']['limit']);_0x3787f2[_0x2ece('0x2c')]=qs['offset'](_0x19e570[_0x2ece('0x3d')][_0x2ece('0x2c')]);}_0x3787f2[_0x2ece('0x60')]=qs[_0x2ece('0x44')](_0x19e570[_0x2ece('0x3d')]['sort']);_0x3787f2[_0x2ece('0x45')]=qs['filters'](_[_0x2ece('0x47')](_0x19e570[_0x2ece('0x3d')],_0xbd0fa6['filters']));_0x3787f2[_0x2ece('0x45')][_0x2ece('0x61')]=_0x7a1996['id'];if(_0x19e570['query'][_0x2ece('0x48')]){_0x3787f2[_0x2ece('0x45')]=_[_0x2ece('0x49')](_0x3787f2[_0x2ece('0x45')],{'$or':_[_0x2ece('0x38')](_0x3787f2[_0x2ece('0x3e')],function(_0x514f1d){var _0xe30136={};_0xe30136[_0x514f1d]={'$like':'%'+_0x19e570['query']['filter']+'%'};return _0xe30136;})});}_0x3787f2=_['merge']({},_0x3787f2,_0x19e570['options']);return db[_0x2ece('0x67')][_0x2ece('0x2d')]({'where':_0x3787f2[_0x2ece('0x45')]})['then'](function(_0x10e30f){_0xce140e[_0x2ece('0x2d')]=_0x10e30f;if(_0x19e570[_0x2ece('0x3d')][_0x2ece('0x53')]){_0x3787f2['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3787f2);})[_0x2ece('0x30')](function(_0x542529){_0xce140e[_0x2ece('0x4d')]=_0x542529;return _0xce140e;});}})[_0x2ece('0x30')](respondWithFilteredResult(_0x4e8a22,_0x3787f2))[_0x2ece('0x26')](handleError(_0x4e8a22,null));};exports[_0x2ece('0x68')]=function(_0x14ac83,_0x20416b,_0x125bf9){return db['FaxAccount']['find']({'where':{'id':_0x14ac83[_0x2ece('0x4f')]['id']}})['then'](handleEntityNotFound(_0x20416b,null))[_0x2ece('0x30')](function(_0x4b3854){if(_0x4b3854){return _0x4b3854['removeAnswers'](_0x14ac83['query'][_0x2ece('0x64')]);}})[_0x2ece('0x30')](respondWithStatusCode(_0x20416b,null))['catch'](handleError(_0x20416b,null));};exports['addInteraction']=function(_0x3abaab,_0xfbc482,_0x5e94d9){return db[_0x2ece('0x69')]['find']({'where':{'id':_0x3abaab[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0xfbc482,null))[_0x2ece('0x30')](function(_0x30a9d5){if(_0x30a9d5){return _0x30a9d5[_0x2ece('0x6a')](_0x3abaab[_0x2ece('0x59')][_0x2ece('0x64')],_[_0x2ece('0x6b')](_0x3abaab['body'],[_0x2ece('0x64'),'id'])||{});}})[_0x2ece('0x30')](respondWithResult(_0xfbc482,null))[_0x2ece('0x26')](handleError(_0xfbc482,null));};exports[_0x2ece('0x6c')]=function(_0x2843d2,_0x254823,_0x252585){var _0x469343={'raw':![],'where':{}};var _0x5605c8={};var _0x31b58b={'count':0x0,'rows':[]};return db[_0x2ece('0x39')][_0x2ece('0x6d')]({'where':{'id':_0x2843d2['params']['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x254823,null))[_0x2ece('0x30')](function(_0x4d7b64){if(_0x4d7b64){_0x5605c8[_0x2ece('0x3f')]=_[_0x2ece('0x51')](db[_0x2ece('0x69')]['rawAttributes']);_0x5605c8['query']=_['keys'](_0x2843d2[_0x2ece('0x3d')]);_0x5605c8[_0x2ece('0x46')]=_['intersection'](_0x5605c8['model'],_0x5605c8[_0x2ece('0x3d')]);_0x469343[_0x2ece('0x3e')]=_[_0x2ece('0x52')](_0x5605c8[_0x2ece('0x3f')],qs[_0x2ece('0x40')](_0x2843d2[_0x2ece('0x3d')]['fields']));_0x469343[_0x2ece('0x3e')]=_0x469343[_0x2ece('0x3e')]['length']?_0x469343[_0x2ece('0x3e')]:_0x5605c8[_0x2ece('0x3f')];if(!_0x2843d2[_0x2ece('0x3d')][_0x2ece('0x42')](_0x2ece('0x43'))){_0x469343[_0x2ece('0x2b')]=qs[_0x2ece('0x2b')](_0x2843d2[_0x2ece('0x3d')]['limit']);_0x469343[_0x2ece('0x2c')]=qs[_0x2ece('0x2c')](_0x2843d2[_0x2ece('0x3d')][_0x2ece('0x2c')]);}_0x469343[_0x2ece('0x60')]=qs['sort'](_0x2843d2[_0x2ece('0x3d')][_0x2ece('0x44')]);_0x469343[_0x2ece('0x45')]=qs['filters'](_[_0x2ece('0x47')](_0x2843d2[_0x2ece('0x3d')],_0x5605c8[_0x2ece('0x46')]));_0x469343['where'][_0x2ece('0x61')]=_0x4d7b64['id'];if(_0x2843d2[_0x2ece('0x3d')][_0x2ece('0x48')]){_0x469343[_0x2ece('0x45')]=_[_0x2ece('0x49')](_0x469343[_0x2ece('0x45')],{'$or':_[_0x2ece('0x38')](_0x469343[_0x2ece('0x3e')],function(_0x142d03){var _0x4e0cb9={};_0x4e0cb9[_0x142d03]={'$like':'%'+_0x2843d2[_0x2ece('0x3d')][_0x2ece('0x48')]+'%'};return _0x4e0cb9;})});}_0x469343=_[_0x2ece('0x49')]({},_0x469343,_0x2843d2['options']);return db['FaxInteraction']['count']({'where':_0x469343[_0x2ece('0x45')]})[_0x2ece('0x30')](function(_0x170e15){_0x31b58b['count']=_0x170e15;if(_0x2843d2[_0x2ece('0x3d')][_0x2ece('0x53')]){_0x469343[_0x2ece('0x4c')]=[{'model':db[_0x2ece('0x6e')],'as':_0x2ece('0x6f'),'required':![]},{'model':db[_0x2ece('0x70')],'as':_0x2ece('0x71'),'attributes':[_0x2ece('0x35'),_0x2ece('0x72'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x2ece('0x73'),'attributes':['id','name',_0x2ece('0x74')],'where':_0x2843d2[_0x2ece('0x3d')]['tag']?{'id':_0x2843d2[_0x2ece('0x3d')][_0x2ece('0x75')]}:undefined,'required':_0x2843d2['query'][_0x2ece('0x75')]?!![]:![]}];}return db[_0x2ece('0x69')][_0x2ece('0x62')](_0x469343);})[_0x2ece('0x30')](function(_0x61cef8){_0x31b58b[_0x2ece('0x4d')]=_0x61cef8;return _0x31b58b;});}})['then'](respondWithFilteredResult(_0x254823,_0x469343))[_0x2ece('0x26')](handleError(_0x254823,null));};exports[_0x2ece('0x76')]=function(_0x3f97a9,_0x1d081c,_0x25f586){return db[_0x2ece('0x39')][_0x2ece('0x6d')]({'where':{'id':_0x3f97a9[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x1d081c,null))['then'](function(_0x4971f0){if(_0x4971f0){return db[_0x2ece('0x77')][_0x2ece('0x78')](function(_0x6e43fc){return db['FaxApplication'][_0x2ece('0x5b')]({'where':{'FaxAccountId':_0x3f97a9['params']['id']},'transaction':_0x6e43fc})[_0x2ece('0x30')](function(_0x5f270c){var _0x5dc5bc=_['map'](_0x3f97a9['body'],function(_0x59dc5f){_0x59dc5f['FaxAccountId']=_0x3f97a9[_0x2ece('0x4f')]['id'];return _0x59dc5f;});return db[_0x2ece('0x79')][_0x2ece('0x7a')](_0x5dc5bc,{'transaction':_0x6e43fc});});})['then'](function(){return db[_0x2ece('0x79')]['findAndCountAll']({'where':{'FaxAccountId':_0x3f97a9['params']['id']},'order':'priority'});});}})[_0x2ece('0x30')](respondWithResult(_0x1d081c,null))[_0x2ece('0x26')](handleError(_0x1d081c,null));};exports[_0x2ece('0x7b')]=function(_0x139ff1,_0x3e8624,_0x4d3fad){var _0x53861a={};var _0x21a17c={};var _0x3f0fd0;var _0x448803;return db[_0x2ece('0x39')][_0x2ece('0x6d')]({'where':{'id':_0x139ff1[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x3e8624,null))['then'](function(_0x42f3d9){if(_0x42f3d9){_0x3f0fd0=_0x42f3d9;_0x21a17c[_0x2ece('0x3f')]=_[_0x2ece('0x51')](db[_0x2ece('0x79')][_0x2ece('0x7c')]);_0x21a17c[_0x2ece('0x3d')]=_[_0x2ece('0x51')](_0x139ff1['query']);_0x21a17c[_0x2ece('0x46')]=_['intersection'](_0x21a17c['model'],_0x21a17c[_0x2ece('0x3d')]);_0x53861a[_0x2ece('0x3e')]=_['intersection'](_0x21a17c[_0x2ece('0x3f')],qs[_0x2ece('0x40')](_0x139ff1[_0x2ece('0x3d')][_0x2ece('0x40')]));_0x53861a['attributes']=_0x53861a[_0x2ece('0x3e')][_0x2ece('0x41')]?_0x53861a['attributes']:_0x21a17c[_0x2ece('0x3f')];_0x53861a[_0x2ece('0x60')]=qs[_0x2ece('0x44')](_0x139ff1['query'][_0x2ece('0x44')]);_0x53861a[_0x2ece('0x45')]=qs[_0x2ece('0x46')](_[_0x2ece('0x47')](_0x139ff1[_0x2ece('0x3d')],_0x21a17c[_0x2ece('0x46')]));if(_0x139ff1[_0x2ece('0x3d')][_0x2ece('0x48')]){_0x53861a[_0x2ece('0x45')]=_[_0x2ece('0x49')](_0x53861a['where'],{'$or':_[_0x2ece('0x38')](_0x53861a['attributes'],function(_0x5be12a){var _0x16c6b0={};_0x16c6b0[_0x5be12a]={'$like':'%'+_0x139ff1['query']['filter']+'%'};return _0x16c6b0;})});}_0x53861a=_[_0x2ece('0x49')]({},_0x53861a,_0x139ff1[_0x2ece('0x4b')]);return _0x3f0fd0[_0x2ece('0x7b')](_0x53861a);}})[_0x2ece('0x30')](function(_0x8416d0){if(_0x8416d0){_0x448803=_0x8416d0[_0x2ece('0x41')];if(!_0x139ff1['query'][_0x2ece('0x42')]('nolimit')){_0x53861a[_0x2ece('0x2b')]=qs['limit'](_0x139ff1[_0x2ece('0x3d')][_0x2ece('0x2b')]);_0x53861a[_0x2ece('0x2c')]=qs['offset'](_0x139ff1['query'][_0x2ece('0x2c')]);}return _0x3f0fd0[_0x2ece('0x7b')](_0x53861a);}})[_0x2ece('0x30')](function(_0x58ee49){if(_0x58ee49){return _0x58ee49?{'count':_0x448803,'rows':_0x58ee49}:null;}})['then'](respondWithResult(_0x3e8624,null))[_0x2ece('0x26')](handleError(_0x3e8624,null));};function Extension(_0x16556f,_0x1c2c5e,_0x5adfe7,_0x49d1a4){this[_0x2ece('0x7d')]=_0x2ece('0x7e');this['exten']=_0x16556f[_0x2ece('0x7f')];this[_0x2ece('0x80')]=_0x49d1a4;this[_0x2ece('0x3b')]=_0x2ece('0x81');this['description']=_0x2ece('0x82');this[_0x2ece('0x61')]=_0x16556f['id'];this['priority']=_0x1c2c5e;this[_0x2ece('0x83')]=_0x5adfe7;}function createExtensionsReciveFax(_0x3b8e42){var _0x377225=0x1;var _0x4d6fe5=[];_0x4d6fe5[_0x2ece('0x84')](new Extension(_0x3b8e42,_0x377225,'','Answer'));_0x377225+=0x1;_0x4d6fe5['push'](new Extension(_0x3b8e42,_0x377225,'CDR(type)=inbound-fax',_0x2ece('0x85')));_0x377225+=0x1;for(var _0x403d9f in _0x3b8e42){if(_0x3b8e42['hasOwnProperty'](_0x403d9f)&&(_0x403d9f===_0x2ece('0x86')||_0x403d9f==='localstationid'||_0x403d9f===_0x2ece('0x87')||_0x403d9f===_0x2ece('0x88')||_0x403d9f===_0x2ece('0x89')||_0x403d9f===_0x2ece('0x8a')||_0x403d9f==='minrate'||_0x403d9f===_0x2ece('0x8b')||_0x403d9f===_0x2ece('0x8c'))){_0x4d6fe5[_0x2ece('0x84')](new Extension(_0x3b8e42,_0x377225,_0x2ece('0x8d')+_0x403d9f+')='+_0x3b8e42[_0x403d9f],_0x2ece('0x85')));_0x377225+=0x1;}}_0x4d6fe5['push'](new Extension(_0x3b8e42,_0x377225,'6',_0x2ece('0x8e')));_0x377225+=0x1;_0x4d6fe5[_0x2ece('0x84')](new Extension(_0x3b8e42,_0x377225,_0x2ece('0x8f'),'ReceiveFax'));_0x377225=0x0;return _0x4d6fe5;}exports[_0x2ece('0x90')]=function(_0x2edf3f,_0x37d18d,_0x5a0db0){var _0x540ecc;return db[_0x2ece('0x77')][_0x2ece('0x78')](function(_0x5da3af){return db[_0x2ece('0x39')]['create'](_0x2edf3f[_0x2ece('0x59')],{'transaction':_0x5da3af})[_0x2ece('0x30')](function(_0xf5501c){_0x540ecc=_0xf5501c[_0x2ece('0x31')]({'plain':!![]});return db[_0x2ece('0x91')]['bulkCreate'](createExtensionsReciveFax(_0x540ecc),{'transaction':_0x5da3af});});})[_0x2ece('0x30')](function(){return _0x540ecc;})['then'](respondWithResult(_0x37d18d,null))['catch'](handleError(_0x37d18d,null));};exports[_0x2ece('0x92')]=function(_0x3b766e,_0x50614f,_0x1673b2){var _0x1ca181;return db[_0x2ece('0x77')][_0x2ece('0x78')](function(_0x5a87c3){return db[_0x2ece('0x39')][_0x2ece('0x2f')](_0x3b766e[_0x2ece('0x59')],{'where':{'id':_0x3b766e['body']['id']},'transaction':_0x5a87c3})[_0x2ece('0x30')](function(_0x170151){return db[_0x2ece('0x91')][_0x2ece('0x5b')]({'where':{'FaxAccountId':_0x3b766e[_0x2ece('0x59')]['id']},'transaction':_0x5a87c3})[_0x2ece('0x30')](function(_0x31b4b8){return db[_0x2ece('0x91')]['bulkCreate'](createExtensionsReciveFax(_[_0x2ece('0x6b')](_0x3b766e[_0x2ece('0x59')],[_0x2ece('0x93'),_0x2ece('0x3c'),'createdAt',_0x2ece('0x94'),_0x2ece('0x95'),_0x2ece('0x96')])),{'transaction':_0x5a87c3});});});})[_0x2ece('0x30')](function(){return db[_0x2ece('0x39')][_0x2ece('0x97')](_0x3b766e[_0x2ece('0x59')]['id']);})[_0x2ece('0x30')](respondWithResult(_0x50614f,null))[_0x2ece('0x26')](handleError(_0x50614f,null));};exports['getMessages']=function(_0xbfba69,_0x4b0b9a,_0x193507){var _0x21a242={'raw':!![],'where':{}};var _0x3bb862={};var _0x5779a4={'count':0x0,'rows':[]};return db[_0x2ece('0x39')]['findOne']({'where':{'id':_0xbfba69[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x4b0b9a,null))['then'](function(_0x54a6cb){if(_0x54a6cb){_0x3bb862['model']=_[_0x2ece('0x51')](db[_0x2ece('0x98')]['rawAttributes']);_0x3bb862['query']=_[_0x2ece('0x51')](_0xbfba69[_0x2ece('0x3d')]);_0x3bb862[_0x2ece('0x46')]=_['intersection'](_0x3bb862[_0x2ece('0x3f')],_0x3bb862[_0x2ece('0x3d')]);_0x21a242[_0x2ece('0x3e')]=_[_0x2ece('0x52')](_0x3bb862[_0x2ece('0x3f')],qs['fields'](_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x40')]));_0x21a242[_0x2ece('0x3e')]=_0x21a242[_0x2ece('0x3e')][_0x2ece('0x41')]?_0x21a242[_0x2ece('0x3e')]:_0x3bb862[_0x2ece('0x3f')];if(!_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x42')](_0x2ece('0x43'))){_0x21a242[_0x2ece('0x2b')]=qs[_0x2ece('0x2b')](_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x2b')]);_0x21a242[_0x2ece('0x2c')]=qs[_0x2ece('0x2c')](_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x2c')]);}_0x21a242[_0x2ece('0x60')]=qs[_0x2ece('0x44')](_0xbfba69[_0x2ece('0x3d')]['sort']);_0x21a242['where']=qs['filters'](_['pick'](_0xbfba69[_0x2ece('0x3d')],_0x3bb862['filters']));_0x21a242[_0x2ece('0x45')]['FaxAccountId']=_0x54a6cb['id'];if(_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x48')]){_0x21a242[_0x2ece('0x45')]=_[_0x2ece('0x49')](_0x21a242[_0x2ece('0x45')],{'$or':_[_0x2ece('0x38')](_0x21a242['attributes'],function(_0x517108){var _0x2c7cf9={};_0x2c7cf9[_0x517108]={'$like':'%'+_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x48')]+'%'};return _0x2c7cf9;})});}if(_0xbfba69[_0x2ece('0x3d')]['$gte']){var _0x22f514=_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x99')][_0x2ece('0x9a')](',');var _0x13aa9d={};_0x13aa9d[_0x22f514[0x0]]={'$gte':moment(_0x22f514[0x1])[_0x2ece('0x9b')](_0x2ece('0x9c'))};_0x21a242[_0x2ece('0x45')]=_['merge'](_0x21a242['where'],_0x13aa9d);}_0x21a242=_[_0x2ece('0x49')]({},_0x21a242,_0xbfba69[_0x2ece('0x4b')]);return db[_0x2ece('0x98')]['count']({'where':_0x21a242[_0x2ece('0x45')]})['then'](function(_0x569003){_0x5779a4[_0x2ece('0x2d')]=_0x569003;if(_0xbfba69[_0x2ece('0x3d')][_0x2ece('0x53')]){_0x21a242[_0x2ece('0x4c')]=[{'all':!![]}];}return db[_0x2ece('0x98')][_0x2ece('0x62')](_0x21a242);})[_0x2ece('0x30')](function(_0x5ca01d){_0x5779a4[_0x2ece('0x4d')]=_0x5ca01d;return _0x5779a4;});}})[_0x2ece('0x30')](respondWithFilteredResult(_0x4b0b9a,_0x21a242))['catch'](handleError(_0x4b0b9a,null));};exports['send']=function(_0x2019aa,_0x1d9fa5,_0x157f73){var _0x35d3ef,_0x521778={},_0x18fa06;if(_0x2019aa[_0x2ece('0x59')]['to']){_0x18fa06=_0x2019aa[_0x2ece('0x59')]['to'][0x0];}return db['FaxAccount'][_0x2ece('0x54')]({'where':{'id':_0x2019aa[_0x2ece('0x4f')]['id']},'include':[{'model':db[_0x2ece('0x9d')],'as':_0x2ece('0x9e'),'include':[{'model':db[_0x2ece('0x6e')],'as':_0x2ece('0x9f'),'where':{'fax':_0x18fa06},'limit':0x1,'order':[[_0x2ece('0x94'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1d9fa5,null))[_0x2ece('0x30')](function(_0x35dcac){_0x35d3ef=_0x35dcac;if(_0x2019aa[_0x2ece('0x59')]['attachments']&&_0x2019aa['body'][_0x2ece('0xa0')][_0x2ece('0x41')]){for(var _0x1c65b3=0x0;_0x1c65b3<_0x2019aa[_0x2ece('0x59')]['attachments'][_0x2ece('0x41')];_0x1c65b3+=0x1){_0x2019aa[_0x2ece('0x59')][_0x2ece('0xa0')][_0x1c65b3]={'filename':_0x2019aa['body'][_0x2ece('0xa0')][_0x1c65b3]['name'],'id':_0x2019aa[_0x2ece('0x59')]['attachments'][_0x1c65b3]['id'],'path':path[_0x2ece('0xa1')](config[_0x2ece('0xa2')],_0x2ece('0xa3'),_0x2019aa[_0x2ece('0x59')][_0x2ece('0xa0')][_0x1c65b3][_0x2ece('0xa4')])};}}return respondWithRpcPromise(_0x2ece('0xa5'),_0x2ece('0xa5'),{'FaxAccountId':_[_0x2ece('0xa6')](_0x2019aa[_0x2ece('0x4f')]['id'])?undefined:_0x2019aa['params']['id'],'path':_[_0x2ece('0xa6')](_0x2019aa[_0x2ece('0x59')][_0x2ece('0xa0')][0x0][_0x2ece('0xa7')])?undefined:_0x2019aa[_0x2ece('0x59')][_0x2ece('0xa0')][0x0][_0x2ece('0xa7')],'fax':_[_0x2ece('0xa6')](_0x2019aa[_0x2ece('0x59')]['to'][0x0])?undefined:_0x2019aa['body']['to'][0x0]},client9002);})[_0x2ece('0x30')](function(){if(_0x35d3ef){if(_[_0x2ece('0xa6')](_0x2019aa['body'][_0x2ece('0xa8')])){_0x2019aa['body'][_0x2ece('0xa8')]=util[_0x2ece('0x9b')](_0x2ece('0xa9'),_0x35d3ef['name'],_0x35d3ef['fax']);}if(_0x35d3ef['List']){if(_0x35d3ef[_0x2ece('0x9e')][_0x2ece('0x9f')][_0x2ece('0x41')]){return _0x35d3ef[_0x2ece('0x9e')][_0x2ece('0x9f')][0x0];}else{return db[_0x2ece('0x6e')]['create'](_['defaults'](_0x2019aa[_0x2ece('0x59')],{'firstName':_0x2019aa[_0x2ece('0x59')]['to'][0x0],'phone':_0x2019aa[_0x2ece('0x59')]['to'][0x0],'fax':_0x2019aa[_0x2ece('0x59')]['to'][0x0],'ListId':_0x35d3ef[_0x2ece('0x96')]}));}}else{throw new Error(_0x2ece('0xaa'));}}else{throw new Error(_0x2ece('0xab'));}})[_0x2ece('0x30')](function(_0x5049d3){if(_0x5049d3){return db[_0x2ece('0x69')]['find']({'where':{'ContactId':_0x5049d3['id'],'closed':![],'FaxAccountId':_0x35d3ef['id']}})[_0x2ece('0x30')](function(_0x5e81f9){if(_0x5e81f9){return[_0x5e81f9,![]];}return db[_0x2ece('0x69')]['create']({'UserId':_0x2019aa[_0x2ece('0x55')]['id'],'ContactId':_0x5049d3['id'],'FaxAccountId':_0x35d3ef['id'],'fax':_0x2019aa[_0x2ece('0x59')]['to'][0x0],'firstMsgDirection':_0x2ece('0xac'),'Messages':[_['merge'](_0x2019aa['body'],{'read':![],'body':_0x2019aa[_0x2ece('0x59')][_0x2ece('0xa0')][0x0][_0x2ece('0xad')],'FaxAccountId':_0x35d3ef['id'],'UserId':_0x2019aa[_0x2ece('0x55')]['id'],'ContactId':_0x5049d3['id'],'AttachmentId':_0x2019aa[_0x2ece('0x59')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x2ece('0x98')],'as':_0x2ece('0xae')}]})[_0x2ece('0x30')](function(_0xbd9b03){return[_0xbd9b03,!![]];});});}else{throw new Error(_0x2ece('0xaf'));}})[_0x2ece('0xb0')](function(_0x146886,_0x98b4a){if(_0x98b4a){return _0x146886;}return db[_0x2ece('0x98')][_0x2ece('0x5f')]({'direction':_0x2ece('0xac'),'read':![],'body':_0x2019aa['body']['attachments'][0x0][_0x2ece('0xad')],'FaxAccountId':_0x35d3ef['id'],'FaxInteractionId':_0x146886['id'],'UserId':_0x2019aa['user']['id'],'ContactId':_0x146886[_0x2ece('0xb1')],'AttachmentId':_0x2019aa[_0x2ece('0x59')][_0x2ece('0xa0')][0x0]['id']})[_0x2ece('0x30')](function(_0xbccd8d){_0x146886[_0x2ece('0xb2')][_0x2ece('0xae')]=[];_0x146886['dataValues'][_0x2ece('0xae')][_0x2ece('0x84')](_0xbccd8d[_0x2ece('0xb2')]);return _0x146886;});})['then'](function(_0x13550e){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x2019aa[_0x2ece('0x4f')]['id'])?undefined:_0x2019aa[_0x2ece('0x4f')]['id'],'path':_[_0x2ece('0xa6')](_0x2019aa['body'][_0x2ece('0xa0')][0x0]['path'])?undefined:_0x2019aa['body'][_0x2ece('0xa0')][0x0][_0x2ece('0xa7')],'fax':_['isNil'](_0x2019aa[_0x2ece('0x59')]['to'][0x0])?undefined:_0x2019aa[_0x2ece('0x59')]['to'][0x0],'AttachmentId':_0x2019aa['body'][_0x2ece('0xa0')][0x0]['id']},client9002)[_0x2ece('0x30')](function(_0x25ac65){logger[_0x2ece('0x1d')](_0x2ece('0xb3'),_0x25ac65);})[_0x2ece('0x26')](function(_0x19cda0){logger[_0x2ece('0x1d')](_0x2ece('0xb3'),_0x19cda0);});return _0x13550e;})[_0x2ece('0x30')](respondWithResult(_0x1d9fa5,null))[_0x2ece('0x26')](handleError(_0x1d9fa5,null));};exports[_0x2ece('0xb4')]=function(_0x2faf93,_0x76f572,_0x267238){return db[_0x2ece('0x39')][_0x2ece('0x54')]({'where':{'id':_0x2faf93[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x76f572,null))[_0x2ece('0x30')](function(_0x1ce175){if(_0x1ce175){return _0x1ce175['addAgents'](_0x2faf93[_0x2ece('0x59')][_0x2ece('0x64')],_[_0x2ece('0x6b')](_0x2faf93[_0x2ece('0x59')],[_0x2ece('0x64'),'id'])||{})[_0x2ece('0xb0')](function(_0x2bb261){for(var _0x223a4=0x0;_0x223a4<_0x2faf93[_0x2ece('0x59')][_0x2ece('0x64')][_0x2ece('0x41')];_0x223a4+=0x1){socket[_0x2ece('0xb5')](_0x2ece('0xb6'),{'UserId':Number(_0x2faf93['body'][_0x2ece('0x64')][_0x223a4]),'FaxAccountId':Number(_0x2faf93[_0x2ece('0x4f')]['id'])});}return _0x2bb261;});}})[_0x2ece('0x30')](respondWithResult(_0x76f572,null))[_0x2ece('0x26')](handleError(_0x76f572,null));};exports[_0x2ece('0xb7')]=function(_0x321777,_0x51d328,_0x443b4a){return db['FaxAccount'][_0x2ece('0x54')]({'where':{'id':_0x321777[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x51d328,null))['then'](function(_0x23d389){if(_0x23d389){return _0x23d389['removeAgents'](_0x321777[_0x2ece('0x3d')][_0x2ece('0x64')])[_0x2ece('0x30')](function(){if(_['isArray'](_0x321777[_0x2ece('0x3d')][_0x2ece('0x64')])){for(var _0x25155e=0x0;_0x25155e<_0x321777[_0x2ece('0x3d')][_0x2ece('0x64')][_0x2ece('0x41')];_0x25155e+=0x1){socket[_0x2ece('0xb5')](_0x2ece('0xb8'),{'UserId':Number(_0x321777['query'][_0x2ece('0x64')][_0x25155e]),'FaxAccountId':Number(_0x321777[_0x2ece('0x4f')]['id'])});}}else{socket[_0x2ece('0xb5')](_0x2ece('0xb8'),{'UserId':Number(_0x321777[_0x2ece('0x3d')][_0x2ece('0x64')]),'FaxAccountId':Number(_0x321777[_0x2ece('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x51d328,null))[_0x2ece('0x26')](handleError(_0x51d328,null));};exports[_0x2ece('0xb9')]=function(_0x1eed53,_0x2a2780,_0x389491){var _0x136455={};var _0x48952d={};var _0x1e1450;var _0x36fd5f;return db['FaxAccount'][_0x2ece('0x6d')]({'where':{'id':_0x1eed53[_0x2ece('0x4f')]['id']}})[_0x2ece('0x30')](handleEntityNotFound(_0x2a2780,null))[_0x2ece('0x30')](function(_0x488888){if(_0x488888){_0x1e1450=_0x488888;_0x48952d[_0x2ece('0x3f')]=_[_0x2ece('0x51')](db[_0x2ece('0x70')][_0x2ece('0x7c')]);_0x48952d['query']=_[_0x2ece('0x51')](_0x1eed53[_0x2ece('0x3d')]);_0x48952d['filters']=_[_0x2ece('0x52')](_0x48952d[_0x2ece('0x3f')],_0x48952d[_0x2ece('0x3d')]);_0x136455[_0x2ece('0x3e')]=_['intersection'](_0x48952d[_0x2ece('0x3f')],qs[_0x2ece('0x40')](_0x1eed53[_0x2ece('0x3d')][_0x2ece('0x40')]));_0x136455[_0x2ece('0x3e')]=_0x136455['attributes'][_0x2ece('0x41')]?_0x136455[_0x2ece('0x3e')]:_0x48952d[_0x2ece('0x3f')];_0x136455[_0x2ece('0x60')]=qs['sort'](_0x1eed53[_0x2ece('0x3d')][_0x2ece('0x44')]);_0x136455[_0x2ece('0x45')]=qs[_0x2ece('0x46')](_[_0x2ece('0x47')](_0x1eed53[_0x2ece('0x3d')],_0x48952d[_0x2ece('0x46')]));if(_0x1eed53['query'][_0x2ece('0x48')]){_0x136455['where']=_[_0x2ece('0x49')](_0x136455['where'],{'$or':_[_0x2ece('0x38')](_0x136455[_0x2ece('0x3e')],function(_0x1754c1){var _0x2059e9={};_0x2059e9[_0x1754c1]={'$like':'%'+_0x1eed53[_0x2ece('0x3d')][_0x2ece('0x48')]+'%'};return _0x2059e9;})});}_0x136455=_['merge']({},_0x136455,_0x1eed53['options']);return _0x1e1450[_0x2ece('0xb9')](_0x136455);}})[_0x2ece('0x30')](function(_0x1252bd){if(_0x1252bd){_0x36fd5f=_0x1252bd[_0x2ece('0x41')];if(!_0x1eed53[_0x2ece('0x3d')][_0x2ece('0x42')](_0x2ece('0x43'))){_0x136455[_0x2ece('0x2b')]=qs[_0x2ece('0x2b')](_0x1eed53['query']['limit']);_0x136455[_0x2ece('0x2c')]=qs[_0x2ece('0x2c')](_0x1eed53[_0x2ece('0x3d')]['offset']);}return _0x1e1450['getAgents'](_0x136455);}})[_0x2ece('0x30')](function(_0x24b4f9){if(_0x24b4f9){return _0x24b4f9?{'count':_0x36fd5f,'rows':_0x24b4f9}:null;}})[_0x2ece('0x30')](respondWithResult(_0x2a2780,null))[_0x2ece('0x26')](handleError(_0x2a2780,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 4dbe2c4..010ee8f 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 _0x17ac=['FaxAccount','save','emit','hasOwnProperty'];(function(_0x34c0bf,_0x3b8460){var _0x315559=function(_0x42f409){while(--_0x42f409){_0x34c0bf['push'](_0x34c0bf['shift']());}};_0x315559(++_0x3b8460);}(_0x17ac,0xf8));var _0xc17a=function(_0x4ec772,_0x524b7e){_0x4ec772=_0x4ec772-0x0;var _0x405499=_0x17ac[_0x4ec772];return _0x405499;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0xc17a('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc17a('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x513cbe){return function(_0x1649b5,_0x5a89df,_0x510dd1){FaxAccountEvents[_0xc17a('0x2')](_0x513cbe+':'+_0x1649b5['id'],_0x1649b5);FaxAccountEvents['emit'](_0x513cbe,_0x1649b5);_0x510dd1(null);};}for(var e in events){if(events[_0xc17a('0x3')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xc822=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','hasOwnProperty','hook','exports','events'];(function(_0xef3e49,_0x43da8c){var _0x1949c2=function(_0x3b27a5){while(--_0x3b27a5){_0xef3e49['push'](_0xef3e49['shift']());}};_0x1949c2(++_0x43da8c);}(_0xc822,0xd7));var _0x2c82=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xc822[_0x3899d1];return _0xeb4a7d;};'use strict';var EventEmitter=require(_0x2c82('0x0'));var FaxAccount=require(_0x2c82('0x1'))['db'][_0x2c82('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x2c82('0x3')](0x0);var events={'afterCreate':_0x2c82('0x4'),'afterUpdate':'update','afterDestroy':_0x2c82('0x5')};function emitEvent(_0x57b817){return function(_0x326bdd,_0x1c6031,_0x56275b){FaxAccountEvents['emit'](_0x57b817+':'+_0x326bdd['id'],_0x326bdd);FaxAccountEvents['emit'](_0x57b817,_0x326bdd);_0x56275b(null);};}for(var e in events){if(events[_0x2c82('0x6')](e)){var event=events[e];FaxAccount[_0x2c82('0x7')](e,emitEvent(event));}}module[_0x2c82('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 5641612..72ae561 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 _0x89f7=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts'];(function(_0xa6cc5c,_0x239c99){var _0x44803d=function(_0x515b6e){while(--_0x515b6e){_0xa6cc5c['push'](_0xa6cc5c['shift']());}};_0x44803d(++_0x239c99);}(_0x89f7,0x1d4));var _0x789f=function(_0x47878f,_0x48d3bf){_0x47878f=_0x47878f-0x0;var _0x4b05b8=_0x89f7[_0x47878f];return _0x4b05b8;};'use strict';var _=require(_0x789f('0x0'));var util=require(_0x789f('0x1'));var logger=require(_0x789f('0x2'))('api');var moment=require(_0x789f('0x3'));var BPromise=require(_0x789f('0x4'));var rp=require(_0x789f('0x5'));var fs=require('fs');var path=require(_0x789f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x789f('0x7'));module[_0x789f('0x8')]=function(_0x3c9b5b,_0x41b19b){return _0x3c9b5b[_0x789f('0x9')](_0x789f('0xa'),attributes,{'tableName':_0x789f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6fe=['../../config/environment','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5821ff,_0x249291){var _0x3ad881=function(_0x3b3169){while(--_0x3b3169){_0x5821ff['push'](_0x5821ff['shift']());}};_0x3ad881(++_0x249291);}(_0xf6fe,0x1b8));var _0xef6f=function(_0x49be0d,_0x5177a9){_0x49be0d=_0x49be0d-0x0;var _0x47c761=_0xf6fe[_0x49be0d];return _0x47c761;};'use strict';var _=require('lodash');var util=require(_0xef6f('0x0'));var logger=require(_0xef6f('0x1'))(_0xef6f('0x2'));var moment=require(_0xef6f('0x3'));var BPromise=require(_0xef6f('0x4'));var rp=require(_0xef6f('0x5'));var fs=require('fs');var path=require(_0xef6f('0x6'));var rimraf=require(_0xef6f('0x7'));var config=require(_0xef6f('0x8'));var attributes=require(_0xef6f('0x9'));module[_0xef6f('0xa')]=function(_0x402b51,_0x153010){return _0x402b51[_0xef6f('0xb')](_0xef6f('0xc'),attributes,{'tableName':_0xef6f('0xd'),'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 dba10c6..e739ecd 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 _0x77b4=['name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','register','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetFaxAccount','findAll','options','raw','limit','include','map','attributes','NotifyFaxAccount','fax','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','body','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','length','defaults','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','push','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','UserId','User','find'];(function(_0x3923c4,_0x5219b1){var _0x472839=function(_0x67210a){while(--_0x67210a){_0x3923c4['push'](_0x3923c4['shift']());}};_0x472839(++_0x5219b1);}(_0x77b4,0x10e));var _0x477b=function(_0x1b8d5b,_0x1105a6){_0x1b8d5b=_0x1b8d5b-0x0;var _0x211c98=_0x77b4[_0x1b8d5b];return _0x211c98;};'use strict';var _=require(_0x477b('0x0'));var util=require(_0x477b('0x1'));var moment=require(_0x477b('0x2'));var BPromise=require(_0x477b('0x3'));var rs=require(_0x477b('0x4'));var fs=require('fs');var Redis=require(_0x477b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x477b('0x6'));var logger=require(_0x477b('0x7'))(_0x477b('0x8'));var config=require(_0x477b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x477b('0xa')]({'port':0x232c});config[_0x477b('0xb')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x477b('0xb')]));require('./faxAccount.socket')[_0x477b('0xc')](socket);function respondWithRpcPromise(_0x467248,_0x37879b,_0x222cb2){return new BPromise(function(_0x2946df,_0x2ce1c0){return client['request'](_0x467248,_0x222cb2)[_0x477b('0xd')](function(_0xc412ab){logger[_0x477b('0xe')](_0x477b('0xf'),_0x37879b,_0x477b('0x10'));logger[_0x477b('0x11')](_0x477b('0x12'),_0x37879b,_0x477b('0x10'),JSON[_0x477b('0x13')](_0xc412ab));if(_0xc412ab['error']){if(_0xc412ab['error'][_0x477b('0x14')]===0x1f4){logger['error'](_0x477b('0xf'),_0x37879b,_0xc412ab[_0x477b('0x15')][_0x477b('0x16')]);return _0x2ce1c0(_0xc412ab[_0x477b('0x15')]['message']);}logger[_0x477b('0x15')](_0x477b('0xf'),_0x37879b,_0xc412ab[_0x477b('0x15')][_0x477b('0x16')]);return _0x2946df(_0xc412ab[_0x477b('0x15')]['message']);}else{logger[_0x477b('0xe')](_0x477b('0xf'),_0x37879b,'request\x20sent');_0x2946df(_0xc412ab[_0x477b('0x17')]['message']);}})[_0x477b('0x18')](function(_0x4172ad){logger[_0x477b('0x15')](_0x477b('0xf'),_0x37879b,_0x4172ad);_0x2ce1c0(_0x4172ad);});});}exports[_0x477b('0x19')]=function(_0x5ba835){var _0x5a056c=this;return new Promise(function(_0x3b0b31,_0x371f56){return db['FaxAccount'][_0x477b('0x1a')]({'raw':_0x5ba835[_0x477b('0x1b')]?_0x5ba835[_0x477b('0x1b')][_0x477b('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ba835[_0x477b('0x1b')]?_0x5ba835[_0x477b('0x1b')]['where']||null:null,'attributes':_0x5ba835[_0x477b('0x1b')]?_0x5ba835[_0x477b('0x1b')]['attributes']||null:null,'limit':_0x5ba835[_0x477b('0x1b')]?_0x5ba835[_0x477b('0x1b')][_0x477b('0x1d')]||null:null,'include':_0x5ba835['options']?_0x5ba835[_0x477b('0x1b')][_0x477b('0x1e')]?_['map'](_0x5ba835['options'][_0x477b('0x1e')],function(_0x4b0e20){return{'model':db[_0x4b0e20['model']],'as':_0x4b0e20['as'],'attributes':_0x4b0e20['attributes'],'include':_0x4b0e20[_0x477b('0x1e')]?_[_0x477b('0x1f')](_0x4b0e20[_0x477b('0x1e')],function(_0xcd82c0){return{'model':db[_0xcd82c0['model']],'as':_0xcd82c0['as'],'attributes':_0xcd82c0[_0x477b('0x20')],'include':_0xcd82c0['include']?_[_0x477b('0x1f')](_0xcd82c0['include'],function(_0x6cbda){return{'model':db[_0x6cbda['model']],'as':_0x6cbda['as'],'attributes':_0x6cbda[_0x477b('0x20')]};}):[]};}):[]};}):[]:[]})[_0x477b('0xd')](function(_0x29e552){logger['info'](_0x477b('0x19'),_0x5ba835);logger[_0x477b('0x11')](_0x477b('0x19'),_0x5ba835,JSON[_0x477b('0x13')](_0x29e552));_0x3b0b31(_0x29e552);})[_0x477b('0x18')](function(_0x1690d8){logger['error'](_0x477b('0x19'),_0x1690d8[_0x477b('0x16')],_0x5ba835);_0x371f56(_0x5a056c[_0x477b('0x15')](0x1f4,_0x1690d8[_0x477b('0x16')]));});});};exports[_0x477b('0x21')]=function(_0x2a243a,_0x5bcca7,_0xf7d33f){var _0x4c8144=this;return new Promise(function(_0x395f45,_0x4865f6){var _0x394886={'body':_0x2a243a['body'],'channel':_0x477b('0x22')};var _0x49109a=[];var _0x4d5b36=[];var _0x5f134a={};return db['CmContact'][_0x477b('0x23')]()[_0x477b('0xd')](function(_0x2aeaad){if(!_0x2aeaad){throw new db[(_0x477b('0x24'))][(_0x477b('0x25'))](_0x477b('0x26'));}_0x49109a=_[_0x477b('0x27')](_['keys'](_0x2aeaad),[_0x477b('0x28'),_0x477b('0x29')]);_0x4d5b36=_[_0x477b('0x27')](_[_0x477b('0x2a')](_0x2aeaad),[_0x477b('0x28'),'updatedAt',_0x477b('0x2b'),'ListId']);if(_0x2a243a[_0x477b('0x2c')]['id']){delete _0x2a243a['body']['id'];}if(_[_0x477b('0x2d')](_0x2a243a[_0x477b('0x2c')]['from'])){throw new db[(_0x477b('0x24'))][(_0x477b('0x25'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x2a243a[_0x477b('0x2c')][_0x477b('0x2c')])||_0x2a243a[_0x477b('0x2c')]['body']===''){throw new db[(_0x477b('0x24'))][(_0x477b('0x25'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x477b('0x2d')](_0x2a243a[_0x477b('0x2c')][_0x477b('0x2e')])){throw new db[(_0x477b('0x24'))][(_0x477b('0x25'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d5b36);}if(!_[_0x477b('0x2f')](_0x4d5b36,_0x2a243a[_0x477b('0x2c')][_0x477b('0x2e')])){throw new db['Sequelize'][(_0x477b('0x25'))](_0x477b('0x30')+_0x4d5b36);}_0x5f134a[_0x2a243a[_0x477b('0x2c')][_0x477b('0x2e')]]=_0x2a243a[_0x477b('0x2c')][_0x477b('0x31')];})['then'](function(){return db[_0x477b('0x32')]['find']({'where':{'id':_0x2a243a[_0x477b('0x33')]['id']},'include':[{'model':db[_0x477b('0x34')],'as':_0x477b('0x35'),'include':[{'model':db['CmContact'],'as':_0x477b('0x36'),'where':_0x5f134a,'limit':0x1,'order':[[_0x477b('0x29'),_0x477b('0x37')]]}]},{'model':db[_0x477b('0x38')],'as':_0x477b('0x39')}]});})[_0x477b('0xd')](function(_0x221833){if(_0x221833&&_0x221833['List']){var _0x37dcd4=_0x221833[_0x477b('0x3a')]({'plain':!![]});_0x394886[_0x477b('0x33')]=_0x37dcd4;_0x394886[_0x477b('0x3b')]=_0x37dcd4[_0x477b('0x39')];_0x394886[_0x477b('0x3c')]=_0x37dcd4[_0x477b('0x35')];_0x394886[_0x477b('0x3b')]=_[_0x477b('0x3d')](_0x394886['applications'],[_0x477b('0x3e')],['asc']);if(_0x394886[_0x477b('0x33')][_0x477b('0x39')]){delete _0x394886[_0x477b('0x33')][_0x477b('0x39')];}if(_0x394886[_0x477b('0x33')][_0x477b('0x35')]&&_0x394886[_0x477b('0x33')][_0x477b('0x35')][_0x477b('0x36')][_0x477b('0x3f')]){return _0x394886[_0x477b('0x33')][_0x477b('0x35')][_0x477b('0x36')][0x0];}var _0x4c1d7d=_[_0x477b('0x40')](_0x2a243a[_0x477b('0x2c')],{'firstName':_0x2a243a[_0x477b('0x2c')]['from'],'ListId':_0x37dcd4[_0x477b('0x41')]});_0x4c1d7d[_0x2a243a[_0x477b('0x2c')]['mapKey']]=_0x2a243a[_0x477b('0x2c')][_0x477b('0x31')];return db['CmContact'][_0x477b('0x42')](_0x4c1d7d,{'fields':_0x49109a,'raw':!![]});}})[_0x477b('0xd')](function(_0x5865fe){_0x394886[_0x477b('0x43')]=_0x5865fe;if(_0x5865fe){var _0x2dae2f={'ContactId':_0x5865fe['id'],'FaxAccountId':_0x2a243a[_0x477b('0x33')]['id'],'fax':_0x5865fe[_0x477b('0x22')]};return db[_0x477b('0x44')]['find']({'where':{'ContactId':_0x5865fe['id'],'closed':![],'FaxAccountId':_0x2a243a['account']['id']}})[_0x477b('0xd')](function(_0x147c25){if(_0x147c25){return[_0x147c25,![]];}return db[_0x477b('0x44')][_0x477b('0x42')](_0x2dae2f)[_0x477b('0xd')](function(_0x27f38e){return[_0x27f38e,!![]];});});}else{throw new Error(_0x477b('0x45'));}})[_0x477b('0x46')](function(_0xce44ec,_0x297d9d){var _0x2858b8=_0xce44ec['get']({'plain':!![]});if(_0x297d9d){if(_0x394886['account']['autoclose']){_0x394886[_0x477b('0x3b')][_0x477b('0x47')]({'id':0x0,'priority':_0x394886[_0x477b('0x3b')][_0x477b('0x3f')]+0x1,'app':_0x477b('0x48'),'appdata':_0x477b('0x49'),'interval':_0x477b('0x4a')});}_0x2858b8['created']=!![];}else{_0x2858b8[_0x477b('0x4b')]=![];}_0x394886['interaction']=_0x2858b8;return db[_0x477b('0x4c')][_0x477b('0x42')]({'body':_0x2a243a[_0x477b('0x2c')]['body'],'FaxAccountId':_0x2a243a[_0x477b('0x33')]['id'],'FaxInteractionId':_0xce44ec['id'],'direction':'in','ContactId':_0xce44ec['ContactId'],'AttachmentId':_0x2a243a[_0x477b('0x2c')][_0x477b('0x4d')]});})['then'](function(_0x4acffc){_0x394886[_0x477b('0x16')]=_0x4acffc;if(_0x394886[_0x477b('0x4e')][_0x477b('0x4f')]){return db[_0x477b('0x50')][_0x477b('0x51')]({'attributes':['id',_0x477b('0x52')],'where':{'id':_0x394886['interaction']['UserId']}})[_0x477b('0xd')](function(_0x3429a8){if(_0x3429a8){_0x394886[_0x477b('0x3b')][_0x477b('0x53')]({'id':0x0,'priority':0x0,'app':_0x477b('0x54'),'appdata':_0x3429a8[_0x477b('0x52')]+','+(_0x394886['account'][_0x477b('0x55')]||0xa),'interval':_0x477b('0x4a')});}return respondWithRpcPromise(_0x477b('0x56'),_0x477b('0x57'),_0x394886);});}return respondWithRpcPromise(_0x477b('0x56'),'startRouting',_0x394886);})['then'](function(_0x15754f){_0x395f45(_0x15754f);})[_0x477b('0x18')](function(_0x514c5a){_0x4865f6(_0x4c8144[_0x477b('0x15')](0x1f4,_0x514c5a[_0x477b('0x16')]));});});}; \ No newline at end of file +var _0xd2f9=['NotifyFaxAccount','body','fax','ValidationError','no\x20available\x20attributes','keys','createdAt','difference','updatedAt','ListId','isNil','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','from','find','account','CmList','List','CmContact','Contacts','DESC','Applications','get','applications','list','orderBy','priority','length','create','contact','FaxInteraction','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','defaults','redis','localhost','request','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','where','map','include','model','attributes','then'];(function(_0x1d97d0,_0x13db27){var _0x552dcc=function(_0x293f36){while(--_0x293f36){_0x1d97d0['push'](_0x1d97d0['shift']());}};_0x552dcc(++_0x13db27);}(_0xd2f9,0x130));var _0x9d2f=function(_0x42c6f1,_0x338d7b){_0x42c6f1=_0x42c6f1-0x0;var _0x3c7398=_0xd2f9[_0x42c6f1];return _0x3c7398;};'use strict';var _=require('lodash');var util=require(_0x9d2f('0x0'));var moment=require(_0x9d2f('0x1'));var BPromise=require(_0x9d2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9d2f('0x3'));var db=require(_0x9d2f('0x4'))['db'];var utils=require(_0x9d2f('0x5'));var logger=require(_0x9d2f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9d2f('0x7')]['http']({'port':0x232c});config['redis']=_[_0x9d2f('0x8')](config[_0x9d2f('0x9')],{'host':_0x9d2f('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x172871,_0x3aaf37,_0x1fbed1){return new BPromise(function(_0x358ff0,_0x4cf394){return client[_0x9d2f('0xb')](_0x172871,_0x1fbed1)['then'](function(_0x32abe3){logger[_0x9d2f('0xc')]('FaxAccount,\x20%s,\x20%s',_0x3aaf37,_0x9d2f('0xd'));logger[_0x9d2f('0xe')](_0x9d2f('0xf'),_0x3aaf37,_0x9d2f('0xd'),JSON[_0x9d2f('0x10')](_0x32abe3));if(_0x32abe3[_0x9d2f('0x11')]){if(_0x32abe3['error']['code']===0x1f4){logger[_0x9d2f('0x11')](_0x9d2f('0x12'),_0x3aaf37,_0x32abe3['error'][_0x9d2f('0x13')]);return _0x4cf394(_0x32abe3[_0x9d2f('0x11')][_0x9d2f('0x13')]);}logger['error'](_0x9d2f('0x12'),_0x3aaf37,_0x32abe3[_0x9d2f('0x11')]['message']);return _0x358ff0(_0x32abe3[_0x9d2f('0x11')][_0x9d2f('0x13')]);}else{logger[_0x9d2f('0xc')](_0x9d2f('0x12'),_0x3aaf37,_0x9d2f('0xd'));_0x358ff0(_0x32abe3[_0x9d2f('0x14')]['message']);}})[_0x9d2f('0x15')](function(_0x4cf207){logger[_0x9d2f('0x11')](_0x9d2f('0x12'),_0x3aaf37,_0x4cf207);_0x4cf394(_0x4cf207);});});}exports[_0x9d2f('0x16')]=function(_0x3bbeb5){var _0x2b4f4e=this;return new Promise(function(_0x3e026a,_0x369c77){return db[_0x9d2f('0x17')][_0x9d2f('0x18')]({'raw':_0x3bbeb5[_0x9d2f('0x19')]?_0x3bbeb5['options']['raw']===undefined?!![]:![]:!![],'where':_0x3bbeb5['options']?_0x3bbeb5[_0x9d2f('0x19')][_0x9d2f('0x1a')]||null:null,'attributes':_0x3bbeb5['options']?_0x3bbeb5[_0x9d2f('0x19')]['attributes']||null:null,'limit':_0x3bbeb5[_0x9d2f('0x19')]?_0x3bbeb5[_0x9d2f('0x19')]['limit']||null:null,'include':_0x3bbeb5[_0x9d2f('0x19')]?_0x3bbeb5[_0x9d2f('0x19')]['include']?_[_0x9d2f('0x1b')](_0x3bbeb5[_0x9d2f('0x19')][_0x9d2f('0x1c')],function(_0xae57ef){return{'model':db[_0xae57ef[_0x9d2f('0x1d')]],'as':_0xae57ef['as'],'attributes':_0xae57ef[_0x9d2f('0x1e')],'include':_0xae57ef['include']?_[_0x9d2f('0x1b')](_0xae57ef[_0x9d2f('0x1c')],function(_0x40f198){return{'model':db[_0x40f198[_0x9d2f('0x1d')]],'as':_0x40f198['as'],'attributes':_0x40f198[_0x9d2f('0x1e')],'include':_0x40f198['include']?_[_0x9d2f('0x1b')](_0x40f198[_0x9d2f('0x1c')],function(_0x280b5a){return{'model':db[_0x280b5a[_0x9d2f('0x1d')]],'as':_0x280b5a['as'],'attributes':_0x280b5a[_0x9d2f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9d2f('0x1f')](function(_0x49a121){logger['info']('GetFaxAccount',_0x3bbeb5);logger[_0x9d2f('0xe')](_0x9d2f('0x16'),_0x3bbeb5,JSON[_0x9d2f('0x10')](_0x49a121));_0x3e026a(_0x49a121);})['catch'](function(_0x59d9e3){logger[_0x9d2f('0x11')](_0x9d2f('0x16'),_0x59d9e3['message'],_0x3bbeb5);_0x369c77(_0x2b4f4e[_0x9d2f('0x11')](0x1f4,_0x59d9e3['message']));});});};exports[_0x9d2f('0x20')]=function(_0x4bdc7c,_0x4e987e,_0x37f248){var _0x54f73a=this;return new Promise(function(_0x34b10c,_0xe13e28){var _0x3dfa01={'body':_0x4bdc7c[_0x9d2f('0x21')],'channel':_0x9d2f('0x22')};var _0x36dd89=[];var _0x531b74=[];var _0x5af678={};return db['CmContact']['describe']()[_0x9d2f('0x1f')](function(_0x4adb45){if(!_0x4adb45){throw new db['Sequelize'][(_0x9d2f('0x23'))](_0x9d2f('0x24'));}_0x36dd89=_['difference'](_[_0x9d2f('0x25')](_0x4adb45),[_0x9d2f('0x26'),'updatedAt']);_0x531b74=_[_0x9d2f('0x27')](_[_0x9d2f('0x25')](_0x4adb45),[_0x9d2f('0x26'),_0x9d2f('0x28'),'CompanyId',_0x9d2f('0x29')]);if(_0x4bdc7c[_0x9d2f('0x21')]['id']){delete _0x4bdc7c[_0x9d2f('0x21')]['id'];}if(_[_0x9d2f('0x2a')](_0x4bdc7c[_0x9d2f('0x21')]['from'])){throw new db[(_0x9d2f('0x2b'))][(_0x9d2f('0x23'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4bdc7c[_0x9d2f('0x21')]['body'])||_0x4bdc7c[_0x9d2f('0x21')][_0x9d2f('0x21')]===''){throw new db['Sequelize'][(_0x9d2f('0x23'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4bdc7c['body']['mapKey'])){throw new db[(_0x9d2f('0x2b'))][(_0x9d2f('0x23'))](_0x9d2f('0x2c')+_0x531b74);}if(!_[_0x9d2f('0x2d')](_0x531b74,_0x4bdc7c[_0x9d2f('0x21')]['mapKey'])){throw new db[(_0x9d2f('0x2b'))][(_0x9d2f('0x23'))](_0x9d2f('0x2e')+_0x531b74);}_0x5af678[_0x4bdc7c[_0x9d2f('0x21')][_0x9d2f('0x2f')]]=_0x4bdc7c['body'][_0x9d2f('0x30')];})['then'](function(){return db[_0x9d2f('0x17')][_0x9d2f('0x31')]({'where':{'id':_0x4bdc7c[_0x9d2f('0x32')]['id']},'include':[{'model':db[_0x9d2f('0x33')],'as':_0x9d2f('0x34'),'include':[{'model':db[_0x9d2f('0x35')],'as':_0x9d2f('0x36'),'where':_0x5af678,'limit':0x1,'order':[[_0x9d2f('0x28'),_0x9d2f('0x37')]]}]},{'model':db['FaxApplication'],'as':_0x9d2f('0x38')}]});})['then'](function(_0xcb12d5){if(_0xcb12d5&&_0xcb12d5['List']){var _0x5ba096=_0xcb12d5[_0x9d2f('0x39')]({'plain':!![]});_0x3dfa01['account']=_0x5ba096;_0x3dfa01[_0x9d2f('0x3a')]=_0x5ba096['Applications'];_0x3dfa01[_0x9d2f('0x3b')]=_0x5ba096[_0x9d2f('0x34')];_0x3dfa01['applications']=_[_0x9d2f('0x3c')](_0x3dfa01[_0x9d2f('0x3a')],[_0x9d2f('0x3d')],['asc']);if(_0x3dfa01[_0x9d2f('0x32')][_0x9d2f('0x38')]){delete _0x3dfa01[_0x9d2f('0x32')]['Applications'];}if(_0x3dfa01[_0x9d2f('0x32')][_0x9d2f('0x34')]&&_0x3dfa01['account'][_0x9d2f('0x34')][_0x9d2f('0x36')][_0x9d2f('0x3e')]){return _0x3dfa01[_0x9d2f('0x32')][_0x9d2f('0x34')][_0x9d2f('0x36')][0x0];}var _0x1ca4e6=_['defaults'](_0x4bdc7c[_0x9d2f('0x21')],{'firstName':_0x4bdc7c[_0x9d2f('0x21')]['from'],'ListId':_0x5ba096[_0x9d2f('0x29')]});_0x1ca4e6[_0x4bdc7c['body'][_0x9d2f('0x2f')]]=_0x4bdc7c[_0x9d2f('0x21')][_0x9d2f('0x30')];return db[_0x9d2f('0x35')][_0x9d2f('0x3f')](_0x1ca4e6,{'fields':_0x36dd89,'raw':!![]});}})[_0x9d2f('0x1f')](function(_0x33525a){_0x3dfa01[_0x9d2f('0x40')]=_0x33525a;if(_0x33525a){var _0x2dc782={'ContactId':_0x33525a['id'],'FaxAccountId':_0x4bdc7c[_0x9d2f('0x32')]['id'],'fax':_0x33525a[_0x9d2f('0x22')]};return db[_0x9d2f('0x41')][_0x9d2f('0x31')]({'where':{'ContactId':_0x33525a['id'],'closed':![],'FaxAccountId':_0x4bdc7c['account']['id']}})[_0x9d2f('0x1f')](function(_0x3c0bbd){if(_0x3c0bbd){return[_0x3c0bbd,![]];}return db[_0x9d2f('0x41')]['create'](_0x2dc782)['then'](function(_0x4245b6){return[_0x4245b6,!![]];});});}else{throw new Error(_0x9d2f('0x42'));}})['spread'](function(_0x461d51,_0x68a21e){var _0x2d8c36=_0x461d51['get']({'plain':!![]});if(_0x68a21e){if(_0x3dfa01['account'][_0x9d2f('0x43')]){_0x3dfa01[_0x9d2f('0x3a')][_0x9d2f('0x44')]({'id':0x0,'priority':_0x3dfa01[_0x9d2f('0x3a')][_0x9d2f('0x3e')]+0x1,'app':_0x9d2f('0x45'),'appdata':_0x9d2f('0x46'),'interval':_0x9d2f('0x47')});}_0x2d8c36[_0x9d2f('0x48')]=!![];}else{_0x2d8c36[_0x9d2f('0x48')]=![];}_0x3dfa01['interaction']=_0x2d8c36;return db[_0x9d2f('0x49')]['create']({'body':_0x4bdc7c[_0x9d2f('0x21')][_0x9d2f('0x21')],'FaxAccountId':_0x4bdc7c[_0x9d2f('0x32')]['id'],'FaxInteractionId':_0x461d51['id'],'direction':'in','ContactId':_0x461d51[_0x9d2f('0x4a')],'AttachmentId':_0x4bdc7c[_0x9d2f('0x21')]['AttachmentId']});})[_0x9d2f('0x1f')](function(_0x3e5bfc){_0x3dfa01['message']=_0x3e5bfc;if(_0x3dfa01[_0x9d2f('0x4b')][_0x9d2f('0x4c')]){return db[_0x9d2f('0x4d')][_0x9d2f('0x31')]({'attributes':['id',_0x9d2f('0x4e')],'where':{'id':_0x3dfa01['interaction'][_0x9d2f('0x4c')]}})[_0x9d2f('0x1f')](function(_0x1a7588){if(_0x1a7588){_0x3dfa01[_0x9d2f('0x3a')][_0x9d2f('0x4f')]({'id':0x0,'priority':0x0,'app':_0x9d2f('0x50'),'appdata':_0x1a7588[_0x9d2f('0x4e')]+','+(_0x3dfa01[_0x9d2f('0x32')][_0x9d2f('0x51')]||0xa),'interval':_0x9d2f('0x47')});}return respondWithRpcPromise(_0x9d2f('0x52'),_0x9d2f('0x53'),_0x3dfa01);});}return respondWithRpcPromise(_0x9d2f('0x52'),_0x9d2f('0x53'),_0x3dfa01);})[_0x9d2f('0x1f')](function(_0x3942aa){_0x34b10c(_0x3942aa);})[_0x9d2f('0x15')](function(_0x3295ca){_0xe13e28(_0x54f73a[_0x9d2f('0x11')](0x1f4,_0x3295ca[_0x9d2f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 6d27fcd..45f97f7 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 _0x37f4=['length','faxAccount:','./faxAccount.events','save','update','removeListener','register'];(function(_0x5475d6,_0x22ff15){var _0x321a0e=function(_0x2371ff){while(--_0x2371ff){_0x5475d6['push'](_0x5475d6['shift']());}};_0x321a0e(++_0x22ff15);}(_0x37f4,0x12f));var _0x437f=function(_0x33eff9,_0x39e31e){_0x33eff9=_0x33eff9-0x0;var _0x546d13=_0x37f4[_0x33eff9];return _0x546d13;};'use strict';var FaxAccountEvents=require(_0x437f('0x0'));var events=[_0x437f('0x1'),'remove',_0x437f('0x2')];function createListener(_0xee8b6d,_0x1b4fe2){return function(_0xa5e717){_0x1b4fe2['emit'](_0xee8b6d,_0xa5e717);};}function removeListener(_0x525ee1,_0x4e5a34){return function(){FaxAccountEvents[_0x437f('0x3')](_0x525ee1,_0x4e5a34);};}exports[_0x437f('0x4')]=function(_0x431d1f){for(var _0x2e90c9=0x0,_0x4e5a15=events[_0x437f('0x5')];_0x2e90c9<_0x4e5a15;_0x2e90c9++){var _0x25b10a=events[_0x2e90c9];var _0x2df1c0=createListener(_0x437f('0x6')+_0x25b10a,_0x431d1f);FaxAccountEvents['on'](_0x25b10a,_0x2df1c0);}}; \ No newline at end of file +var _0xb600=['removeListener','length','faxAccount:','./faxAccount.events','save','update','emit'];(function(_0x5a691d,_0x1c9ab6){var _0x5cb564=function(_0x2cbcd2){while(--_0x2cbcd2){_0x5a691d['push'](_0x5a691d['shift']());}};_0x5cb564(++_0x1c9ab6);}(_0xb600,0x14c));var _0x0b60=function(_0x4debdd,_0x114aab){_0x4debdd=_0x4debdd-0x0;var _0x4a83e6=_0xb600[_0x4debdd];return _0x4a83e6;};'use strict';var FaxAccountEvents=require(_0x0b60('0x0'));var events=[_0x0b60('0x1'),'remove',_0x0b60('0x2')];function createListener(_0x2a4193,_0x33208c){return function(_0xdb58d8){_0x33208c[_0x0b60('0x3')](_0x2a4193,_0xdb58d8);};}function removeListener(_0x150079,_0x413b64){return function(){FaxAccountEvents[_0x0b60('0x4')](_0x150079,_0x413b64);};}exports['register']=function(_0x4d9284){for(var _0x12490f=0x0,_0x95ff32=events[_0x0b60('0x5')];_0x12490f<_0x95ff32;_0x12490f++){var _0x12ecaf=events[_0x12490f];var _0x49585a=createListener(_0x0b60('0x6')+_0x12ecaf,_0x4d9284);FaxAccountEvents['on'](_0x12ecaf,_0x49585a);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 68c9869..70e1c57 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(_0x34b6ba,_0x2ebe76){var _0x34779a=function(_0x1e509f){while(--_0x1e509f){_0x34b6ba['push'](_0x34b6ba['shift']());}};_0x34779a(++_0x2ebe76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x47a204,_0x24b906){var _0x5623fc=function(_0x4404ac){while(--_0x4404ac){_0x47a204['push'](_0x47a204['shift']());}};_0x5623fc(++_0x24b906);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 1f190c3..4b39ce0 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 _0xd46a=['STRING','TEXT'];(function(_0x497d84,_0x4fad8d){var _0x28b334=function(_0xf9fa69){while(--_0xf9fa69){_0x497d84['push'](_0x497d84['shift']());}};_0x28b334(++_0x4fad8d);}(_0xd46a,0x80));var _0xad46=function(_0x2d7b36,_0x15ac53){_0x2d7b36=_0x2d7b36-0x0;var _0x598095=_0xd46a[_0x2d7b36];return _0x598095;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xad46('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xad46('0x1')]()},'description':{'type':Sequelize[_0xad46('0x0')]},'interval':{'type':Sequelize[_0xad46('0x0')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xeeca=['STRING','noop','TEXT','sequelize','INTEGER'];(function(_0x45ffc0,_0x4f090b){var _0x1f0074=function(_0x46e65c){while(--_0x46e65c){_0x45ffc0['push'](_0x45ffc0['shift']());}};_0x1f0074(++_0x4f090b);}(_0xeeca,0xbc));var _0xaeec=function(_0x119705,_0xba9427){_0x119705=_0x119705-0x0;var _0x2affc2=_0xeeca[_0x119705];return _0x2affc2;};'use strict';var Sequelize=require(_0xaeec('0x0'));module['exports']={'priority':{'type':Sequelize[_0xaeec('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xaeec('0x2')],'allowNull':![],'defaultValue':_0xaeec('0x3')},'appdata':{'type':Sequelize[_0xaeec('0x4')]()},'description':{'type':Sequelize[_0xaeec('0x2')]},'interval':{'type':Sequelize[_0xaeec('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 94f2405..6bafccc 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 _0x6d45=['status','end','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','hasOwnProperty','sort','where','pick','filters','merge','VIRTUAL','filter','options','FaxApplication','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x5bf86c,_0x1dd8be){var _0x118bbe=function(_0x3cfe72){while(--_0x3cfe72){_0x5bf86c['push'](_0x5bf86c['shift']());}};_0x118bbe(++_0x1dd8be);}(_0x6d45,0x1d5));var _0x56d4=function(_0x554e9d,_0x14a8ed){_0x554e9d=_0x554e9d-0x0;var _0x5cf618=_0x6d45[_0x554e9d];return _0x5cf618;};'use strict';var emlformat=require(_0x56d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56d4('0x1'));var jsonpatch=require(_0x56d4('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x56d4('0x3'));var util=require('util');var path=require(_0x56d4('0x4'));var sox=require(_0x56d4('0x5'));var csv=require(_0x56d4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56d4('0x7'));var _=require(_0x56d4('0x8'));var squel=require(_0x56d4('0x9'));var crypto=require(_0x56d4('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x56d4('0xb'));var toCsv=require(_0x56d4('0x6'));var querystring=require(_0x56d4('0xc'));var Papa=require(_0x56d4('0xd'));var Redis=require('ioredis');var authService=require(_0x56d4('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x56d4('0xf'))('api');var utils=require(_0x56d4('0x10'));var config=require(_0x56d4('0x11'));var licenseUtil=require(_0x56d4('0x12'));var db=require(_0x56d4('0x13'))['db'];function respondWithStatusCode(_0x4754a1,_0x25b660){_0x25b660=_0x25b660||0xcc;return function(_0x53c4b6){if(_0x53c4b6){return _0x4754a1[_0x56d4('0x14')](_0x25b660);}return _0x4754a1[_0x56d4('0x15')](_0x25b660)[_0x56d4('0x16')]();};}function respondWithResult(_0x5141a2,_0x1acbe3){_0x1acbe3=_0x1acbe3||0xc8;return function(_0x3fe86a){if(_0x3fe86a){return _0x5141a2['status'](_0x1acbe3)[_0x56d4('0x17')](_0x3fe86a);}};}function respondWithFilteredResult(_0x5cb030,_0x2fb04c){return function(_0x50403c){if(_0x50403c){var _0x27b42a=typeof _0x2fb04c[_0x56d4('0x18')]===_0x56d4('0x19')&&typeof _0x2fb04c[_0x56d4('0x1a')]==='undefined';var _0x57640e=_0x50403c['count'];var _0x3ca6cd=_0x27b42a?0x0:_0x2fb04c[_0x56d4('0x18')];var _0x1a5709=_0x27b42a?_0x50403c['count']:_0x2fb04c[_0x56d4('0x18')]+_0x2fb04c[_0x56d4('0x1a')];var _0x1aa458;if(_0x1a5709>=_0x57640e){_0x1a5709=_0x57640e;_0x1aa458=0xc8;}else{_0x1aa458=0xce;}_0x5cb030[_0x56d4('0x15')](_0x1aa458);return _0x5cb030[_0x56d4('0x1b')](_0x56d4('0x1c'),_0x3ca6cd+'-'+_0x1a5709+'/'+_0x57640e)[_0x56d4('0x17')](_0x50403c);}return null;};}function patchUpdates(_0x32c141){return function(_0x358a30){try{jsonpatch['apply'](_0x358a30,_0x32c141,!![]);}catch(_0x2be747){return BPromise[_0x56d4('0x1d')](_0x2be747);}return _0x358a30[_0x56d4('0x1e')]();};}function saveUpdates(_0x576e88,_0x245cdd){return function(_0xcb3f3){if(_0xcb3f3){return _0xcb3f3[_0x56d4('0x1f')](_0x576e88)[_0x56d4('0x20')](function(_0x5c07d7){return _0x5c07d7;});}return null;};}function removeEntity(_0x10f545,_0x1d3833){return function(_0x100db8){if(_0x100db8){return _0x100db8[_0x56d4('0x21')]()[_0x56d4('0x20')](function(){_0x10f545[_0x56d4('0x15')](0xcc)[_0x56d4('0x16')]();});}};}function handleEntityNotFound(_0x25f594,_0x83fcf6){return function(_0x35ff27){if(!_0x35ff27){_0x25f594['sendStatus'](0x194);}return _0x35ff27;};}function handleError(_0x5ae544,_0x57ff20){_0x57ff20=_0x57ff20||0x1f4;return function(_0xd6fa){logger[_0x56d4('0x22')](_0xd6fa['stack']);if(_0xd6fa['name']){delete _0xd6fa[_0x56d4('0x23')];}_0x5ae544[_0x56d4('0x15')](_0x57ff20)[_0x56d4('0x24')](_0xd6fa);};}exports[_0x56d4('0x25')]=function(_0x20e05a,_0x280d64){var _0xe54d54={},_0x18d514={},_0x14dd47={'count':0x0,'rows':[]};var _0x5727bb=_[_0x56d4('0x26')](db['FaxApplication'][_0x56d4('0x27')],function(_0x1d8204){return{'name':_0x1d8204['fieldName'],'type':_0x1d8204[_0x56d4('0x28')][_0x56d4('0x29')]};});_0x18d514['model']=_[_0x56d4('0x26')](_0x5727bb,_0x56d4('0x23'));_0x18d514['query']=_[_0x56d4('0x2a')](_0x20e05a[_0x56d4('0x2b')]);_0x18d514['filters']=_[_0x56d4('0x2c')](_0x18d514[_0x56d4('0x2d')],_0x18d514[_0x56d4('0x2b')]);_0xe54d54['attributes']=_[_0x56d4('0x2c')](_0x18d514['model'],qs[_0x56d4('0x2e')](_0x20e05a[_0x56d4('0x2b')]['fields']));_0xe54d54[_0x56d4('0x2f')]=_0xe54d54[_0x56d4('0x2f')]['length']?_0xe54d54[_0x56d4('0x2f')]:_0x18d514[_0x56d4('0x2d')];if(!_0x20e05a[_0x56d4('0x2b')][_0x56d4('0x30')]('nolimit')){_0xe54d54[_0x56d4('0x1a')]=qs[_0x56d4('0x1a')](_0x20e05a[_0x56d4('0x2b')]['limit']);_0xe54d54[_0x56d4('0x18')]=qs[_0x56d4('0x18')](_0x20e05a['query'][_0x56d4('0x18')]);}_0xe54d54['order']=qs['sort'](_0x20e05a[_0x56d4('0x2b')][_0x56d4('0x31')]);_0xe54d54[_0x56d4('0x32')]=qs['filters'](_[_0x56d4('0x33')](_0x20e05a[_0x56d4('0x2b')],_0x18d514[_0x56d4('0x34')]),_0x5727bb);if(_0x20e05a[_0x56d4('0x2b')]['filter']){_0xe54d54[_0x56d4('0x32')]=_[_0x56d4('0x35')](_0xe54d54[_0x56d4('0x32')],{'$or':_[_0x56d4('0x26')](_0x5727bb,function(_0x245bb1){if(_0x245bb1[_0x56d4('0x28')]!==_0x56d4('0x36')){var _0x1129e7={};_0x1129e7[_0x245bb1['name']]={'$like':'%'+_0x20e05a['query'][_0x56d4('0x37')]+'%'};return _0x1129e7;}})});}_0xe54d54=_[_0x56d4('0x35')]({},_0xe54d54,_0x20e05a[_0x56d4('0x38')]);var _0x5a434c={'where':_0xe54d54[_0x56d4('0x32')]};return db[_0x56d4('0x39')][_0x56d4('0x3a')](_0x5a434c)['then'](function(_0x368c51){_0x14dd47[_0x56d4('0x3a')]=_0x368c51;if(_0x20e05a[_0x56d4('0x2b')][_0x56d4('0x3b')]){_0xe54d54[_0x56d4('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0x56d4('0x3d')](_0xe54d54);})[_0x56d4('0x20')](function(_0x117b2b){_0x14dd47[_0x56d4('0x3e')]=_0x117b2b;return _0x14dd47;})['then'](respondWithFilteredResult(_0x280d64,_0xe54d54))[_0x56d4('0x3f')](handleError(_0x280d64,null));};exports[_0x56d4('0x40')]=function(_0x5233f9,_0x14754b){var _0x40734f={'raw':!![],'where':{'id':_0x5233f9[_0x56d4('0x41')]['id']}},_0x5ef60b={};_0x5ef60b['model']=_[_0x56d4('0x2a')](db[_0x56d4('0x39')]['rawAttributes']);_0x5ef60b[_0x56d4('0x2b')]=_['keys'](_0x5233f9['query']);_0x5ef60b[_0x56d4('0x34')]=_[_0x56d4('0x2c')](_0x5ef60b['model'],_0x5ef60b[_0x56d4('0x2b')]);_0x40734f[_0x56d4('0x2f')]=_[_0x56d4('0x2c')](_0x5ef60b[_0x56d4('0x2d')],qs[_0x56d4('0x2e')](_0x5233f9[_0x56d4('0x2b')][_0x56d4('0x2e')]));_0x40734f[_0x56d4('0x2f')]=_0x40734f[_0x56d4('0x2f')][_0x56d4('0x42')]?_0x40734f[_0x56d4('0x2f')]:_0x5ef60b[_0x56d4('0x2d')];if(_0x5233f9[_0x56d4('0x2b')][_0x56d4('0x3b')]){_0x40734f[_0x56d4('0x3c')]=[{'all':!![]}];}_0x40734f=_['merge']({},_0x40734f,_0x5233f9['options']);return db[_0x56d4('0x39')][_0x56d4('0x43')](_0x40734f)['then'](handleEntityNotFound(_0x14754b,null))[_0x56d4('0x20')](respondWithResult(_0x14754b,null))[_0x56d4('0x3f')](handleError(_0x14754b,null));};exports[_0x56d4('0x44')]=function(_0x434237,_0x5ed482){return db['FaxApplication'][_0x56d4('0x44')](_0x434237[_0x56d4('0x45')],{})[_0x56d4('0x20')](respondWithResult(_0x5ed482,0xc9))['catch'](handleError(_0x5ed482,null));};exports[_0x56d4('0x1f')]=function(_0xbf4da6,_0x1d9301){if(_0xbf4da6['body']['id']){delete _0xbf4da6[_0x56d4('0x45')]['id'];}return db[_0x56d4('0x39')]['find']({'where':{'id':_0xbf4da6[_0x56d4('0x41')]['id']}})[_0x56d4('0x20')](handleEntityNotFound(_0x1d9301,null))[_0x56d4('0x20')](saveUpdates(_0xbf4da6[_0x56d4('0x45')],null))[_0x56d4('0x20')](respondWithResult(_0x1d9301,null))[_0x56d4('0x3f')](handleError(_0x1d9301,null));};exports['destroy']=function(_0x383018,_0x2ed971){return db[_0x56d4('0x39')]['find']({'where':{'id':_0x383018[_0x56d4('0x41')]['id']}})[_0x56d4('0x20')](handleEntityNotFound(_0x2ed971,null))[_0x56d4('0x20')](removeEntity(_0x2ed971,null))['catch'](handleError(_0x2ed971,null));}; \ No newline at end of file +var _0x6b53=['sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','type','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x31d3cd,_0x3a0db0){var _0x4f02b1=function(_0x4873e8){while(--_0x4873e8){_0x31d3cd['push'](_0x31d3cd['shift']());}};_0x4f02b1(++_0x3a0db0);}(_0x6b53,0x18c));var _0x36b5=function(_0x457957,_0x136453){_0x457957=_0x457957-0x0;var _0x801cc7=_0x6b53[_0x457957];return _0x801cc7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36b5('0x0'));var zipdir=require(_0x36b5('0x1'));var jsonpatch=require(_0x36b5('0x2'));var rp=require(_0x36b5('0x3'));var moment=require('moment');var BPromise=require(_0x36b5('0x4'));var Mustache=require(_0x36b5('0x5'));var util=require(_0x36b5('0x6'));var path=require(_0x36b5('0x7'));var sox=require(_0x36b5('0x8'));var csv=require(_0x36b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x36b5('0xa'));var _=require(_0x36b5('0xb'));var squel=require(_0x36b5('0xc'));var crypto=require('crypto');var jsforce=require(_0x36b5('0xd'));var deskjs=require(_0x36b5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x36b5('0xf'));var Papa=require(_0x36b5('0x10'));var Redis=require(_0x36b5('0x11'));var authService=require(_0x36b5('0x12'));var qs=require(_0x36b5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36b5('0x14'));var logger=require(_0x36b5('0x15'))(_0x36b5('0x16'));var utils=require(_0x36b5('0x17'));var config=require(_0x36b5('0x18'));var licenseUtil=require(_0x36b5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e11d1,_0x495510){_0x495510=_0x495510||0xcc;return function(_0xea74b6){if(_0xea74b6){return _0x3e11d1[_0x36b5('0x1a')](_0x495510);}return _0x3e11d1['status'](_0x495510)[_0x36b5('0x1b')]();};}function respondWithResult(_0x443bc7,_0x4854c2){_0x4854c2=_0x4854c2||0xc8;return function(_0x40dd50){if(_0x40dd50){return _0x443bc7[_0x36b5('0x1c')](_0x4854c2)['json'](_0x40dd50);}};}function respondWithFilteredResult(_0x31f393,_0x2d634d){return function(_0x2031f2){if(_0x2031f2){var _0x4f49a3=typeof _0x2d634d[_0x36b5('0x1d')]===_0x36b5('0x1e')&&typeof _0x2d634d[_0x36b5('0x1f')]===_0x36b5('0x1e');var _0x4d4c1c=_0x2031f2[_0x36b5('0x20')];var _0x4af2c4=_0x4f49a3?0x0:_0x2d634d[_0x36b5('0x1d')];var _0x4d0a28=_0x4f49a3?_0x2031f2[_0x36b5('0x20')]:_0x2d634d[_0x36b5('0x1d')]+_0x2d634d[_0x36b5('0x1f')];var _0x3c19c2;if(_0x4d0a28>=_0x4d4c1c){_0x4d0a28=_0x4d4c1c;_0x3c19c2=0xc8;}else{_0x3c19c2=0xce;}_0x31f393[_0x36b5('0x1c')](_0x3c19c2);return _0x31f393['set'](_0x36b5('0x21'),_0x4af2c4+'-'+_0x4d0a28+'/'+_0x4d4c1c)[_0x36b5('0x22')](_0x2031f2);}return null;};}function patchUpdates(_0xa0451d){return function(_0x538c56){try{jsonpatch[_0x36b5('0x23')](_0x538c56,_0xa0451d,!![]);}catch(_0x26d7ec){return BPromise['reject'](_0x26d7ec);}return _0x538c56[_0x36b5('0x24')]();};}function saveUpdates(_0xead4a8,_0x564768){return function(_0x31b528){if(_0x31b528){return _0x31b528[_0x36b5('0x25')](_0xead4a8)[_0x36b5('0x26')](function(_0x8f293e){return _0x8f293e;});}return null;};}function removeEntity(_0x47ffc9,_0x52efbd){return function(_0x4ae6f2){if(_0x4ae6f2){return _0x4ae6f2[_0x36b5('0x27')]()['then'](function(){_0x47ffc9[_0x36b5('0x1c')](0xcc)[_0x36b5('0x1b')]();});}};}function handleEntityNotFound(_0x199ea5,_0x1c162a){return function(_0x2dc061){if(!_0x2dc061){_0x199ea5[_0x36b5('0x1a')](0x194);}return _0x2dc061;};}function handleError(_0x115965,_0x215643){_0x215643=_0x215643||0x1f4;return function(_0x18769f){logger[_0x36b5('0x28')](_0x18769f[_0x36b5('0x29')]);if(_0x18769f['name']){delete _0x18769f[_0x36b5('0x2a')];}_0x115965[_0x36b5('0x1c')](_0x215643)[_0x36b5('0x2b')](_0x18769f);};}exports[_0x36b5('0x2c')]=function(_0x577192,_0x3d067b){var _0x13f54d={},_0x133175={},_0x50b5c6={'count':0x0,'rows':[]};var _0x58d161=_['map'](db[_0x36b5('0x2d')][_0x36b5('0x2e')],function(_0x46a650){return{'name':_0x46a650['fieldName'],'type':_0x46a650[_0x36b5('0x2f')][_0x36b5('0x30')]};});_0x133175[_0x36b5('0x31')]=_[_0x36b5('0x32')](_0x58d161,_0x36b5('0x2a'));_0x133175[_0x36b5('0x33')]=_[_0x36b5('0x34')](_0x577192[_0x36b5('0x33')]);_0x133175['filters']=_['intersection'](_0x133175[_0x36b5('0x31')],_0x133175[_0x36b5('0x33')]);_0x13f54d['attributes']=_[_0x36b5('0x35')](_0x133175[_0x36b5('0x31')],qs[_0x36b5('0x36')](_0x577192['query'][_0x36b5('0x36')]));_0x13f54d['attributes']=_0x13f54d[_0x36b5('0x37')][_0x36b5('0x38')]?_0x13f54d['attributes']:_0x133175[_0x36b5('0x31')];if(!_0x577192[_0x36b5('0x33')][_0x36b5('0x39')](_0x36b5('0x3a'))){_0x13f54d[_0x36b5('0x1f')]=qs[_0x36b5('0x1f')](_0x577192[_0x36b5('0x33')][_0x36b5('0x1f')]);_0x13f54d[_0x36b5('0x1d')]=qs['offset'](_0x577192[_0x36b5('0x33')][_0x36b5('0x1d')]);}_0x13f54d[_0x36b5('0x3b')]=qs[_0x36b5('0x3c')](_0x577192[_0x36b5('0x33')][_0x36b5('0x3c')]);_0x13f54d[_0x36b5('0x3d')]=qs[_0x36b5('0x3e')](_['pick'](_0x577192[_0x36b5('0x33')],_0x133175[_0x36b5('0x3e')]),_0x58d161);if(_0x577192['query'][_0x36b5('0x3f')]){_0x13f54d[_0x36b5('0x3d')]=_[_0x36b5('0x40')](_0x13f54d[_0x36b5('0x3d')],{'$or':_[_0x36b5('0x32')](_0x58d161,function(_0x54f872){if(_0x54f872[_0x36b5('0x2f')]!==_0x36b5('0x41')){var _0x46888c={};_0x46888c[_0x54f872['name']]={'$like':'%'+_0x577192[_0x36b5('0x33')][_0x36b5('0x3f')]+'%'};return _0x46888c;}})});}_0x13f54d=_['merge']({},_0x13f54d,_0x577192['options']);var _0x415f3b={'where':_0x13f54d[_0x36b5('0x3d')]};return db[_0x36b5('0x2d')][_0x36b5('0x20')](_0x415f3b)[_0x36b5('0x26')](function(_0x44db09){_0x50b5c6['count']=_0x44db09;if(_0x577192[_0x36b5('0x33')][_0x36b5('0x42')]){_0x13f54d[_0x36b5('0x43')]=[{'all':!![]}];}return db[_0x36b5('0x2d')][_0x36b5('0x44')](_0x13f54d);})['then'](function(_0x274cb9){_0x50b5c6[_0x36b5('0x45')]=_0x274cb9;return _0x50b5c6;})[_0x36b5('0x26')](respondWithFilteredResult(_0x3d067b,_0x13f54d))['catch'](handleError(_0x3d067b,null));};exports[_0x36b5('0x46')]=function(_0x47309d,_0x370cf6){var _0x3aca6f={'raw':!![],'where':{'id':_0x47309d[_0x36b5('0x47')]['id']}},_0x1723e8={};_0x1723e8[_0x36b5('0x31')]=_[_0x36b5('0x34')](db[_0x36b5('0x2d')][_0x36b5('0x2e')]);_0x1723e8[_0x36b5('0x33')]=_[_0x36b5('0x34')](_0x47309d[_0x36b5('0x33')]);_0x1723e8[_0x36b5('0x3e')]=_[_0x36b5('0x35')](_0x1723e8[_0x36b5('0x31')],_0x1723e8[_0x36b5('0x33')]);_0x3aca6f[_0x36b5('0x37')]=_[_0x36b5('0x35')](_0x1723e8[_0x36b5('0x31')],qs[_0x36b5('0x36')](_0x47309d[_0x36b5('0x33')]['fields']));_0x3aca6f['attributes']=_0x3aca6f[_0x36b5('0x37')]['length']?_0x3aca6f['attributes']:_0x1723e8['model'];if(_0x47309d[_0x36b5('0x33')][_0x36b5('0x42')]){_0x3aca6f['include']=[{'all':!![]}];}_0x3aca6f=_['merge']({},_0x3aca6f,_0x47309d[_0x36b5('0x48')]);return db[_0x36b5('0x2d')][_0x36b5('0x49')](_0x3aca6f)[_0x36b5('0x26')](handleEntityNotFound(_0x370cf6,null))[_0x36b5('0x26')](respondWithResult(_0x370cf6,null))[_0x36b5('0x4a')](handleError(_0x370cf6,null));};exports['create']=function(_0x27b094,_0x5c2ffb){return db[_0x36b5('0x2d')]['create'](_0x27b094[_0x36b5('0x4b')],{})[_0x36b5('0x26')](respondWithResult(_0x5c2ffb,0xc9))['catch'](handleError(_0x5c2ffb,null));};exports[_0x36b5('0x25')]=function(_0x33e438,_0x23c338){if(_0x33e438[_0x36b5('0x4b')]['id']){delete _0x33e438[_0x36b5('0x4b')]['id'];}return db['FaxApplication'][_0x36b5('0x49')]({'where':{'id':_0x33e438[_0x36b5('0x47')]['id']}})[_0x36b5('0x26')](handleEntityNotFound(_0x23c338,null))['then'](saveUpdates(_0x33e438['body'],null))[_0x36b5('0x26')](respondWithResult(_0x23c338,null))[_0x36b5('0x4a')](handleError(_0x23c338,null));};exports['destroy']=function(_0x412a7b,_0xb8eeeb){return db['FaxApplication'][_0x36b5('0x49')]({'where':{'id':_0x412a7b[_0x36b5('0x47')]['id']}})[_0x36b5('0x26')](handleEntityNotFound(_0xb8eeeb,null))['then'](removeEntity(_0xb8eeeb,null))['catch'](handleError(_0xb8eeeb,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index c690d3d..350d989 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 _0x493f=['request-promise','path','rimraf','../../config/environment','define','FaxApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x2b0e98,_0x4cd5d3){var _0x1a213b=function(_0x281835){while(--_0x281835){_0x2b0e98['push'](_0x2b0e98['shift']());}};_0x1a213b(++_0x4cd5d3);}(_0x493f,0x119));var _0xf493=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x493f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf493('0x0'));var util=require(_0xf493('0x1'));var logger=require('../../config/logger')(_0xf493('0x2'));var moment=require(_0xf493('0x3'));var BPromise=require(_0xf493('0x4'));var rp=require(_0xf493('0x5'));var fs=require('fs');var path=require(_0xf493('0x6'));var rimraf=require(_0xf493('0x7'));var config=require(_0xf493('0x8'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x3d15d0,_0x46a6c4){return _0x3d15d0[_0xf493('0x9')](_0xf493('0xa'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf493('0xb'),'collate':_0xf493('0xc')});}; \ No newline at end of file +var _0x5644=['lodash','util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./faxApplication.attributes','define','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x4b273d,_0x3b8902){var _0x3f4985=function(_0x4b4213){while(--_0x4b4213){_0x4b273d['push'](_0x4b273d['shift']());}};_0x3f4985(++_0x3b8902);}(_0x5644,0xc0));var _0x4564=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0x5644[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0x4564('0x0'));var util=require(_0x4564('0x1'));var logger=require(_0x4564('0x2'))('api');var moment=require(_0x4564('0x3'));var BPromise=require(_0x4564('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4564('0x5'));var config=require(_0x4564('0x6'));var attributes=require(_0x4564('0x7'));module['exports']=function(_0x58ffa8,_0x495f6e){return _0x58ffa8[_0x4564('0x8')]('FaxApplication',attributes,{'tableName':_0x4564('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4564('0xa'),'collate':_0x4564('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 1495637..6985390 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 _0xbe62=['../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateFaxApplication','update','body','options','raw','where','attributes','limit','stringify','lodash','bluebird','randomstring','ioredis'];(function(_0x3191e3,_0x4c7c43){var _0x4f6541=function(_0xf2390c){while(--_0xf2390c){_0x3191e3['push'](_0x3191e3['shift']());}};_0x4f6541(++_0x4c7c43);}(_0xbe62,0xf8));var _0x2be6=function(_0x1a6529,_0x44451a){_0x1a6529=_0x1a6529-0x0;var _0x5a6373=_0xbe62[_0x1a6529];return _0x5a6373;};'use strict';var _=require(_0x2be6('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2be6('0x1'));var rs=require(_0x2be6('0x2'));var fs=require('fs');var Redis=require(_0x2be6('0x3'));var db=require(_0x2be6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2be6('0x5'))(_0x2be6('0x6'));var config=require('../../config/environment');var jayson=require(_0x2be6('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x495c15,_0x261d54,_0x2d041e){return new BPromise(function(_0x50ecb3,_0x13999b){return client[_0x2be6('0x8')](_0x495c15,_0x2d041e)[_0x2be6('0x9')](function(_0x4bc8d8){logger[_0x2be6('0xa')](_0x2be6('0xb'),_0x261d54,_0x2be6('0xc'));logger[_0x2be6('0xd')](_0x2be6('0xe'),_0x261d54,_0x2be6('0xc'),JSON['stringify'](_0x4bc8d8));if(_0x4bc8d8[_0x2be6('0xf')]){if(_0x4bc8d8[_0x2be6('0xf')]['code']===0x1f4){logger[_0x2be6('0xf')](_0x2be6('0xb'),_0x261d54,_0x4bc8d8['error']['message']);return _0x13999b(_0x4bc8d8[_0x2be6('0xf')][_0x2be6('0x10')]);}logger[_0x2be6('0xf')](_0x2be6('0xb'),_0x261d54,_0x4bc8d8['error'][_0x2be6('0x10')]);return _0x50ecb3(_0x4bc8d8['error'][_0x2be6('0x10')]);}else{logger['info'](_0x2be6('0xb'),_0x261d54,_0x2be6('0xc'));_0x50ecb3(_0x4bc8d8[_0x2be6('0x11')][_0x2be6('0x10')]);}})[_0x2be6('0x12')](function(_0x37b3eb){logger[_0x2be6('0xf')](_0x2be6('0xb'),_0x261d54,_0x37b3eb);_0x13999b(_0x37b3eb);});});}exports[_0x2be6('0x13')]=function(_0x4733da){var _0x168af4=this;return new Promise(function(_0x57193b,_0x1e430d){return db['FaxApplication'][_0x2be6('0x14')](_0x4733da[_0x2be6('0x15')],{'raw':_0x4733da[_0x2be6('0x16')]?_0x4733da[_0x2be6('0x16')][_0x2be6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4733da[_0x2be6('0x16')]?_0x4733da[_0x2be6('0x16')][_0x2be6('0x18')]||null:null,'attributes':_0x4733da[_0x2be6('0x16')]?_0x4733da['options'][_0x2be6('0x19')]||null:null,'limit':_0x4733da[_0x2be6('0x16')]?_0x4733da[_0x2be6('0x16')][_0x2be6('0x1a')]||null:null})[_0x2be6('0x9')](function(_0x3a16b5){logger['info'](_0x2be6('0x13'),_0x4733da);logger[_0x2be6('0xd')]('UpdateFaxApplication',_0x4733da,JSON[_0x2be6('0x1b')](_0x3a16b5));_0x57193b(_0x3a16b5);})['catch'](function(_0x315dae){logger['error'](_0x2be6('0x13'),_0x315dae[_0x2be6('0x10')],_0x4733da);_0x1e430d(_0x168af4[_0x2be6('0xf')](0x1f4,_0x315dae[_0x2be6('0x10')]));});});}; \ No newline at end of file +var _0xdf32=['FaxApplication,\x20%s,\x20%s','message','info','result','UpdateFaxApplication','FaxApplication','update','options','raw','where','attributes','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x32fe45,_0x20cc79){var _0xc98e1f=function(_0x1c613c){while(--_0x1c613c){_0x32fe45['push'](_0x32fe45['shift']());}};_0xc98e1f(++_0x20cc79);}(_0xdf32,0x1bc));var _0x2df3=function(_0x5577e4,_0xe82143){_0x5577e4=_0x5577e4-0x0;var _0x1df633=_0xdf32[_0x5577e4];return _0x1df633;};'use strict';var _=require('lodash');var util=require(_0x2df3('0x0'));var moment=require(_0x2df3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2df3('0x2'));var db=require(_0x2df3('0x3'))['db'];var utils=require(_0x2df3('0x4'));var logger=require('../../config/logger')(_0x2df3('0x5'));var config=require(_0x2df3('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2df3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15d8d4,_0x3a3cdc,_0x266a2d){return new BPromise(function(_0x96f226,_0x33b2d0){return client[_0x2df3('0x8')](_0x15d8d4,_0x266a2d)[_0x2df3('0x9')](function(_0x5535a6){logger['info']('FaxApplication,\x20%s,\x20%s',_0x3a3cdc,_0x2df3('0xa'));logger[_0x2df3('0xb')](_0x2df3('0xc'),_0x3a3cdc,_0x2df3('0xa'),JSON['stringify'](_0x5535a6));if(_0x5535a6[_0x2df3('0xd')]){if(_0x5535a6[_0x2df3('0xd')][_0x2df3('0xe')]===0x1f4){logger['error'](_0x2df3('0xf'),_0x3a3cdc,_0x5535a6[_0x2df3('0xd')][_0x2df3('0x10')]);return _0x33b2d0(_0x5535a6[_0x2df3('0xd')]['message']);}logger[_0x2df3('0xd')]('FaxApplication,\x20%s,\x20%s',_0x3a3cdc,_0x5535a6['error'][_0x2df3('0x10')]);return _0x96f226(_0x5535a6['error'][_0x2df3('0x10')]);}else{logger[_0x2df3('0x11')](_0x2df3('0xf'),_0x3a3cdc,_0x2df3('0xa'));_0x96f226(_0x5535a6[_0x2df3('0x12')][_0x2df3('0x10')]);}})['catch'](function(_0x2e487b){logger[_0x2df3('0xd')](_0x2df3('0xf'),_0x3a3cdc,_0x2e487b);_0x33b2d0(_0x2e487b);});});}exports[_0x2df3('0x13')]=function(_0x5c8ef6){var _0x5d55ba=this;return new Promise(function(_0x52b1f5,_0xc38e5b){return db[_0x2df3('0x14')][_0x2df3('0x15')](_0x5c8ef6['body'],{'raw':_0x5c8ef6['options']?_0x5c8ef6[_0x2df3('0x16')][_0x2df3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c8ef6[_0x2df3('0x16')]?_0x5c8ef6[_0x2df3('0x16')][_0x2df3('0x18')]||null:null,'attributes':_0x5c8ef6[_0x2df3('0x16')]?_0x5c8ef6[_0x2df3('0x16')][_0x2df3('0x19')]||null:null,'limit':_0x5c8ef6[_0x2df3('0x16')]?_0x5c8ef6['options']['limit']||null:null})[_0x2df3('0x9')](function(_0x3ad946){logger[_0x2df3('0x11')](_0x2df3('0x13'),_0x5c8ef6);logger[_0x2df3('0xb')](_0x2df3('0x13'),_0x5c8ef6,JSON['stringify'](_0x3ad946));_0x52b1f5(_0x3ad946);})[_0x2df3('0x1a')](function(_0x43512d){logger[_0x2df3('0xd')](_0x2df3('0x13'),_0x43512d[_0x2df3('0x10')],_0x5c8ef6);_0xc38e5b(_0x5d55ba[_0x2df3('0xd')](0x1f4,_0x43512d[_0x2df3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ff27b3f..6fab842 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 _0x8603=['../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x8603,0x190));var _0x3860=function(_0x5a38bc,_0x4665e4){_0x5a38bc=_0x5a38bc-0x0;var _0x1af6dc=_0x8603[_0x5a38bc];return _0x1af6dc;};'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 _0xefda=['post','create','update','delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','/:id','isAuthenticated'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xefda,0x96));var _0xaefd=function(_0xdd4b19,_0xdd94b9){_0xdd4b19=_0xdd4b19-0x0;var _0x3390f8=_0xefda[_0xdd4b19];return _0x3390f8;};'use strict';var multer=require(_0xaefd('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xaefd('0x1'));var express=require(_0xaefd('0x2'));var router=express['Router']();var fs_extra=require(_0xaefd('0x3'));var auth=require(_0xaefd('0x4'));var interaction=require(_0xaefd('0x5'));var config=require(_0xaefd('0x6'));var controller=require(_0xaefd('0x7'));router[_0xaefd('0x8')]('/',auth['isAuthenticated'](),controller[_0xaefd('0x9')]);router[_0xaefd('0x8')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller['show']);router[_0xaefd('0xc')]('/',auth[_0xaefd('0xb')](),controller[_0xaefd('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xaefd('0xe')]);router[_0xaefd('0xf')](_0xaefd('0xa'),auth[_0xaefd('0xb')](),controller[_0xaefd('0x10')]);module[_0xaefd('0x11')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 61d611c..ffd81a3 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 _0x459d=['exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x459d,0x92));var _0xd459=function(_0x1071f7,_0x5f4f14){_0x1071f7=_0x1071f7-0x0;var _0x3d1419=_0x459d[_0x1071f7];return _0x3d1419;};'use strict';var Sequelize=require(_0xd459('0x0'));module[_0xd459('0x1')]={'closed':{'type':Sequelize[_0xd459('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd459('0x3')]},'disposition':{'type':Sequelize[_0xd459('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd459('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xd459('0x5')]('in',_0xd459('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd459('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd459('0x5')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x0c0f=['DATE','ENUM','out','sequelize','exports','BOOLEAN','STRING'];(function(_0x4d9058,_0x18ca07){var _0x4ee95b=function(_0x1a0f96){while(--_0x1a0f96){_0x4d9058['push'](_0x4d9058['shift']());}};_0x4ee95b(++_0x18ca07);}(_0x0c0f,0x96));var _0xf0c0=function(_0x24d729,_0x1784f7){_0x24d729=_0x24d729-0x0;var _0x4ccbe5=_0x0c0f[_0x24d729];return _0x4ccbe5;};'use strict';var Sequelize=require(_0xf0c0('0x0'));module[_0xf0c0('0x1')]={'closed':{'type':Sequelize[_0xf0c0('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xf0c0('0x3')]},'thirdDisposition':{'type':Sequelize[_0xf0c0('0x3')]},'note':{'type':Sequelize[_0xf0c0('0x3')]},'read1stAt':{'type':Sequelize[_0xf0c0('0x4')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xf0c0('0x5')]('in',_0xf0c0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf0c0('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 a29d542..a36409d 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 _0x589e=['sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','limit','undefined','offset','Content-Range','apply','save','then','error','name','Users','map','fullname','TagIds','Tags','split','forEach','index','FaxInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','field','color','from','select','u.id','u.fullname','ui.FaxInteractionId','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_messages','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','Contact','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','isEmpty','FaxAccountId','i.FaxAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','t.id\x20IN\x20?','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','role','agent','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','c.fax','Contact.fax','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','FaxInteractionId','push','all','rows','catch','show','include','options','create','params','destroy','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','format','YYYY-MM-DD\x20HH:mm:ss','findAll','setTags','spread','emit','faxInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','existsSync','createReadStream','pipe','createWriteStream','basename','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','mustache'];(function(_0x44f088,_0x5bea33){var _0x2f4d09=function(_0x36fe66){while(--_0x36fe66){_0x44f088['push'](_0x44f088['shift']());}};_0x2f4d09(++_0x5bea33);}(_0x589e,0xcd));var _0xe589=function(_0x12b650,_0xe936a0){_0x12b650=_0x12b650-0x0;var _0x2027e8=_0x589e[_0x12b650];return _0x2027e8;};'use strict';var emlformat=require(_0xe589('0x0'));var rimraf=require(_0xe589('0x1'));var zipdir=require(_0xe589('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe589('0x3'));var util=require('util');var path=require('path');var sox=require(_0xe589('0x4'));var csv=require(_0xe589('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe589('0x6'));var squel=require('squel');var crypto=require(_0xe589('0x7'));var jsforce=require(_0xe589('0x8'));var deskjs=require(_0xe589('0x9'));var toCsv=require('to-csv');var querystring=require(_0xe589('0xa'));var Papa=require(_0xe589('0xb'));var Redis=require(_0xe589('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe589('0xd'));var as=require(_0xe589('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe589('0xf'))(_0xe589('0x10'));var utils=require(_0xe589('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xe589('0x12'));var db=require(_0xe589('0x13'))['db'];config[_0xe589('0x14')]=_['defaults'](config['redis'],{'host':_0xe589('0x15'),'port':0x18eb});var socket=require(_0xe589('0x16'))(new Redis(config[_0xe589('0x14')]));require(_0xe589('0x17'))[_0xe589('0x18')](socket);function respondWithStatusCode(_0x513493,_0x2a7e3b){_0x2a7e3b=_0x2a7e3b||0xcc;return function(_0x2a65ab){if(_0x2a65ab){return _0x513493[_0xe589('0x19')](_0x2a7e3b);}return _0x513493[_0xe589('0x1a')](_0x2a7e3b)[_0xe589('0x1b')]();};}function respondWithResult(_0x1434c5,_0x572f10){_0x572f10=_0x572f10||0xc8;return function(_0x2f09c1){if(_0x2f09c1){return _0x1434c5[_0xe589('0x1a')](_0x572f10)[_0xe589('0x1c')](_0x2f09c1);}};}function respondWithFilteredResult(_0x132074,_0x371ae3){return function(_0x54d5c1){if(_0x54d5c1){var _0x5c9c57=typeof _0x371ae3['offset']==='undefined'&&typeof _0x371ae3[_0xe589('0x1d')]===_0xe589('0x1e');var _0x23a493=_0x54d5c1['count'];var _0x231393=_0x5c9c57?0x0:_0x371ae3[_0xe589('0x1f')];var _0x4f913b=_0x5c9c57?_0x54d5c1['count']:_0x371ae3[_0xe589('0x1f')]+_0x371ae3[_0xe589('0x1d')];var _0x2a3fb3;if(_0x4f913b>=_0x23a493){_0x4f913b=_0x23a493;_0x2a3fb3=0xc8;}else{_0x2a3fb3=0xce;}_0x132074[_0xe589('0x1a')](_0x2a3fb3);return _0x132074['set'](_0xe589('0x20'),_0x231393+'-'+_0x4f913b+'/'+_0x23a493)[_0xe589('0x1c')](_0x54d5c1);}return null;};}function patchUpdates(_0x161344){return function(_0x24846c){try{jsonpatch[_0xe589('0x21')](_0x24846c,_0x161344,!![]);}catch(_0x5b31b7){return BPromise['reject'](_0x5b31b7);}return _0x24846c[_0xe589('0x22')]();};}function saveUpdates(_0x309d11,_0x173b68){return function(_0x199d8c){if(_0x199d8c){return _0x199d8c['update'](_0x309d11)[_0xe589('0x23')](function(_0x26aca1){return _0x26aca1;});}return null;};}function removeEntity(_0x4b80be,_0x2d1611){return function(_0x26f387){if(_0x26f387){return _0x26f387['destroy']()[_0xe589('0x23')](function(){_0x4b80be[_0xe589('0x1a')](0xcc)[_0xe589('0x1b')]();});}};}function handleEntityNotFound(_0x154185,_0x35513a){return function(_0x5f3340){if(!_0x5f3340){_0x154185[_0xe589('0x19')](0x194);}return _0x5f3340;};}function handleError(_0x31b006,_0x16b07d){_0x16b07d=_0x16b07d||0x1f4;return function(_0x303979){logger[_0xe589('0x24')](_0x303979['stack']);if(_0x303979[_0xe589('0x25')]){delete _0x303979[_0xe589('0x25')];}_0x31b006[_0xe589('0x1a')](_0x16b07d)['send'](_0x303979);};}function getInteractionUsers(_0xf345db,_0x32e4bd){return new BPromise(function(_0x1690fa,_0x14a4ab){try{if(_0x32e4bd[_0xf345db['id']]){_0xf345db[_0xe589('0x26')]=_[_0xe589('0x27')](_0x32e4bd[_0xf345db['id']],function(_0x3ca527){return{'id':_0x3ca527['id'],'fullname':_0x3ca527[_0xe589('0x28')]};});}}catch(_0x1a732a){_0x14a4ab(_0x1a732a);}_0x1690fa(_0xf345db);});}function getInteractionTags(_0x2f8b65,_0x55eb68){return new BPromise(function(_0x213b76,_0x30eb51){try{if(_0x2f8b65[_0xe589('0x29')]){_0x2f8b65[_0xe589('0x2a')]=[];_0x2f8b65[_0xe589('0x29')][_0xe589('0x2b')](',')[_0xe589('0x2c')](function(_0x374d37){_0x2f8b65[_0xe589('0x2a')]['push'](_0x55eb68[_0x374d37]);});}delete _0x2f8b65['TagIds'];}catch(_0x21898b){_0x30eb51(_0x21898b);}_0x213b76(_0x2f8b65);});}function updateFaxInteraction(_0x18095b,_0x3306b4,_0x416390){return new BPromise(function(_0x3c40cd,_0x4c3c50){return getInteractionUsers(_0x18095b,_0x416390)['then'](function(_0x1a7c75){return getInteractionTags(_0x1a7c75,_0x3306b4);})[_0xe589('0x23')](function(_0xd46ae6){_0x3c40cd(_0xd46ae6);})['catch'](function(_0x50993b){_0x4c3c50(_0x50993b);});});}exports[_0xe589('0x2d')]=function(_0x3fcd0f,_0x4a661a){var _0xb287b1={},_0x1ece48={},_0xdd9187={'count':0x0,'rows':[]};var _0x3f7254=_[_0xe589('0x27')](db[_0xe589('0x2e')][_0xe589('0x2f')],function(_0x43a7c7){return{'name':_0x43a7c7[_0xe589('0x30')],'type':_0x43a7c7['type'][_0xe589('0x31')]};});_0x1ece48[_0xe589('0x32')]=_[_0xe589('0x27')](_0x3f7254,_0xe589('0x25'));_0x1ece48[_0xe589('0x33')]=_[_0xe589('0x34')](_0x3fcd0f[_0xe589('0x33')]);_0x1ece48[_0xe589('0x35')]=_[_0xe589('0x36')](_0x1ece48[_0xe589('0x32')],_0x1ece48[_0xe589('0x33')]);_0xb287b1['attributes']=_[_0xe589('0x36')](_0x1ece48[_0xe589('0x32')],qs[_0xe589('0x37')](_0x3fcd0f['query'][_0xe589('0x37')]));_0xb287b1[_0xe589('0x38')]=_0xb287b1[_0xe589('0x38')][_0xe589('0x39')]?_0xb287b1[_0xe589('0x38')]:_0x1ece48['model'];if(!_0x3fcd0f[_0xe589('0x33')][_0xe589('0x3a')](_0xe589('0x3b'))){_0xb287b1[_0xe589('0x1d')]=qs[_0xe589('0x1d')](_0x3fcd0f[_0xe589('0x33')][_0xe589('0x1d')]);_0xb287b1['offset']=qs[_0xe589('0x1f')](_0x3fcd0f[_0xe589('0x33')]['offset']);}_0xb287b1[_0xe589('0x3c')]=qs[_0xe589('0x3d')](_0x3fcd0f[_0xe589('0x33')][_0xe589('0x3d')]);_0xb287b1[_0xe589('0x3e')]=qs['filters'](_[_0xe589('0x3f')](_0x3fcd0f[_0xe589('0x33')],_0x1ece48[_0xe589('0x35')]),_0x3f7254);var _0x563860=[];var _0x37824b=squel['select']()['field']('id')[_0xe589('0x40')](_0xe589('0x25'))[_0xe589('0x40')](_0xe589('0x41'))[_0xe589('0x42')]('tools_tags');var _0x51cc1d=squel[_0xe589('0x43')]()[_0xe589('0x40')](_0xe589('0x44'))[_0xe589('0x40')](_0xe589('0x45'))[_0xe589('0x40')](_0xe589('0x46'))[_0xe589('0x42')]('user_has_fax_interactions','ui')[_0xe589('0x47')](_0xe589('0x48'),'u',_0xe589('0x49'));var _0x2f6484=squel[_0xe589('0x43')]()[_0xe589('0x42')]('fax_interactions','i')[_0xe589('0x47')](_0xe589('0x4a'),'c',_0xe589('0x4b'))[_0xe589('0x47')](_0xe589('0x48'),'o',_0xe589('0x4c'))[_0xe589('0x47')](_0xe589('0x4d'),'a',_0xe589('0x4e'))['left_join'](_0xe589('0x4f'),'me','me.FaxInteractionId\x20=\x20i.id')[_0xe589('0x47')](_0xe589('0x50'),'it',_0xe589('0x51'))[_0xe589('0x47')]('tools_tags','t',_0xe589('0x52'));var _0x275e9d=squel['expr']();var _0x14723d=[];var _0x4e35e5=squel[_0xe589('0x53')]();var _0x5c2c09;if(_0x3fcd0f[_0xe589('0x33')]['search']){_0x5c2c09=as[_0xe589('0x54')](_0x3fcd0f[_0xe589('0x33')][_0xe589('0x55')]);var _0x1777a2=_0x5c2c09[_0xe589('0x56')];for(var _0x2496b9=0x0;_0x2496b9<_0x5c2c09[_0xe589('0x57')][_0xe589('0x39')];_0x2496b9++){var _0x3e8df7=_0x5c2c09['conditions'][_0x2496b9];var _0x5decb0='i';var _0x12e6f1=_[_0xe589('0x58')](_0x3f7254,[_0xe589('0x25'),_0x3e8df7[_0xe589('0x40')]]);if(!_0x12e6f1){switch(_0x3e8df7[_0xe589('0x40')]){case'unreadMessages':if(_0x3e8df7[_0xe589('0x59')]==0x1){_0x2f6484['having']('`'+_0x3e8df7['field']+'`\x20=\x200');}else{_0x2f6484[_0xe589('0x5a')]('`'+_0x3e8df7['field']+'`\x20>\x200');}break;case _0xe589('0x5b'):if(_0x3e8df7['operator']==='$substring'){if(_0x3e8df7[_0xe589('0x59')]['split']('\x20')[_0xe589('0x39')]>0x1){_0x275e9d[_0x1777a2](_0xe589('0x5c'),qs[_0xe589('0x5d')](_0x3e8df7[_0xe589('0x59')]),null);}else{var _0x3ef93e='%'+_0x3e8df7[_0xe589('0x59')]+'%';_0x275e9d[_0x1777a2](_0xe589('0x5e'),_0x3ef93e,_0x3ef93e,_0x3ef93e);}}else{_0x12e6f1=_[_0xe589('0x58')](_0x3f7254,[_0xe589('0x25'),_0xe589('0x5f')]);_0x3e8df7['field']=_0xe589('0x5f');_0x19a94a=as[_0xe589('0x60')](_0x5decb0,_0x12e6f1[_0xe589('0x61')],_0x3e8df7);_0x275e9d[_0x1777a2](_0x19a94a[_0xe589('0x62')],_0x19a94a[_0xe589('0x59')][_0xe589('0x63')],_0x19a94a[_0xe589('0x59')][_0xe589('0x1b')]);}break;case _0xe589('0x64'):var _0x344de2=_0x3e8df7[_0xe589('0x59')][_0xe589('0x2b')](',')[_0xe589('0x27')](function(_0x558ad9){return Number(_0x558ad9);});_0x344de2[_0xe589('0x2c')](function(_0x9acabb){_0x4e35e5['or'](_0xe589('0x65'),'%,'+_0x9acabb+',%');});_0x14723d=_['union'](_0x14723d,_0x344de2);break;case _0xe589('0x66'):if(_0x3e8df7[_0xe589('0x67')]===_0xe589('0x68')){_0x275e9d[_0x1777a2](_0xe589('0x69'),'%'+_0x3e8df7[_0xe589('0x59')]+'%',null);}else{_0x12e6f1=_[_0xe589('0x58')](_0x3f7254,[_0xe589('0x25'),_0xe589('0x6a')]);_0x3e8df7[_0xe589('0x40')]=_0xe589('0x6a');_0x19a94a=as[_0xe589('0x60')](_0x5decb0,_0x12e6f1['type'],_0x3e8df7);_0x275e9d[_0x1777a2](_0x19a94a[_0xe589('0x62')],_0x19a94a[_0xe589('0x59')][_0xe589('0x63')],_0x19a94a[_0xe589('0x59')]['end']);}break;case _0xe589('0x6b'):_0x19a94a=as[_0xe589('0x60')]('me',null,_0x3e8df7);_0x275e9d[_0x1777a2](_0x19a94a['text'],_0x19a94a[_0xe589('0x59')]['start'],_0x19a94a[_0xe589('0x59')]['end']);break;}}else{var _0x19a94a=as[_0xe589('0x60')](_0x5decb0,_0x12e6f1[_0xe589('0x61')],_0x3e8df7);_0x275e9d[_0x1777a2](_0x19a94a[_0xe589('0x62')],_0x19a94a['value']['start'],_0x19a94a['value']['end']);}}}else{var _0x55923=_(_0x3fcd0f[_0xe589('0x33')])['keys']()[_0xe589('0x27')](function(_0x2f9812){return _['some'](_0x3f7254,[_0xe589('0x25'),_0x2f9812])?_0x2f9812:undefined;})['compact']()['value']();if(!_[_0xe589('0x6c')](_0x55923)){_0x55923[_0xe589('0x2c')](function(_0x11d447){if(_0x11d447===_0xe589('0x6d')){_0x2f6484[_0xe589('0x3e')](_0xe589('0x6e'),[]['concat'](_0x3fcd0f[_0xe589('0x33')][_0x11d447]));}else if(_0x11d447===_0xe589('0x6f')){var _0x580e4a=JSON[_0xe589('0x70')](_0x3fcd0f[_0xe589('0x33')][_0x11d447])[_0xe589('0x71')];var _0x289aa8=JSON['parse'](_0x3fcd0f[_0xe589('0x33')][_0x11d447])[_0xe589('0x72')];_0x2f6484[_0xe589('0x3e')](_0xe589('0x73'),_0x580e4a,_0x289aa8);}else{if(_0x3fcd0f[_0xe589('0x33')][_0x11d447]==='null'){_0x2f6484['where']('i.'+_0x11d447+_0xe589('0x74'));}else{_0x2f6484[_0xe589('0x3e')]('i.'+_0x11d447+_0xe589('0x75'),_0x3fcd0f[_0xe589('0x33')][_0x11d447]);}}});}if(_0x3fcd0f['query']['read']){if(_0x3fcd0f[_0xe589('0x33')]['read']==0x1){_0x2f6484['having'](_0xe589('0x76'));}else{_0x2f6484[_0xe589('0x5a')]('`unreadMessages`\x20>\x200');}}if(_0x3fcd0f[_0xe589('0x33')][_0xe589('0x77')]){_0x14723d=_[_0xe589('0x78')](_0x3fcd0f['query']['tag'])?_0x3fcd0f['query']['tag']:new Array(_0x3fcd0f[_0xe589('0x33')][_0xe589('0x77')]);_0x14723d[_0xe589('0x2c')](function(_0x32c847){_0x4e35e5['or'](_0xe589('0x65'),'%,'+_0x32c847+',%');});}if(_0x3fcd0f[_0xe589('0x33')][_0xe589('0x79')]){var _0x5d9110=_0x3fcd0f[_0xe589('0x33')][_0xe589('0x79')][_0xe589('0x7a')]('\x5c','\x5c\x5c')[_0xe589('0x7a')](/'/g,'\x27\x27');if(qs[_0xe589('0x7b')](_0x5d9110)){_0x275e9d['or'](_0xe589('0x7c'),_0x5d9110+'%')['or']('i.fax\x20LIKE\x20?',_0x5d9110+'%');}_0x275e9d['or'](_0xe589('0x7d'),_0x5d9110+'%');}}_0x2f6484['where'](_0x275e9d);_0x2f6484[_0xe589('0x7e')]('i.id');var _0x193a74={'type':db[_0xe589('0x7f')][_0xe589('0x80')]['SELECT'],'raw':!![]};var _0x38895d=_0x2f6484[_0xe589('0x81')]();_0x38895d[_0xe589('0x40')](_0xe589('0x82'));_0x38895d['field'](_0xe589('0x83'),'unreadMessages');if(_0xb287b1[_0xe589('0x3c')]){_0xb287b1[_0xe589('0x3c')][_0xe589('0x2c')](function(_0x470f32){var _0x524c31=_0x470f32[0x0]===_0xe589('0x84')?_0x470f32[0x0]:'i.'+_0x470f32[0x0];_0x2f6484[_0xe589('0x3c')](_0x524c31,_0x470f32[0x1]==='DESC'?![]:!![]);});}if(!_[_0xe589('0x6c')](_0x14723d)){_0x2f6484[_0xe589('0x5a')](_0x4e35e5);_0x38895d[_0xe589('0x3e')](_0xe589('0x85'),_0x14723d);}BPromise[_0xe589('0x86')]()['then'](function(){if(!_0x5c2c09){if(_0x3fcd0f[_0xe589('0x33')][_0xe589('0x6d')])return;_0x38895d['where'](_0xe589('0x87'));_0x2f6484[_0xe589('0x3e')](_0xe589('0x87'));return;}if(_0x3fcd0f[_0xe589('0x88')]['role']!=='agent')return;return _0x3fcd0f[_0xe589('0x88')][_0xe589('0x89')]({'attributes':['id'],'raw':!![]})[_0xe589('0x23')](function(_0x1cf41c){if(_[_0xe589('0x6c')](_0x1cf41c)){_0x38895d[_0xe589('0x3e')](_0xe589('0x8a'));_0x2f6484[_0xe589('0x3e')](_0xe589('0x8a'));}else{_0x38895d['where'](_0xe589('0x6e'),_[_0xe589('0x27')](_0x1cf41c,'id'));_0x2f6484[_0xe589('0x3e')](_0xe589('0x6e'),_[_0xe589('0x27')](_0x1cf41c,'id'));}});})['then'](function(){if(_0x3fcd0f['user'][_0xe589('0x8b')]===_0xe589('0x8c')&&!_0x5c2c09&&!_0x3fcd0f[_0xe589('0x33')]['FaxAccountId'])return[];return db[_0xe589('0x8d')][_0xe589('0x33')](_0x38895d[_0xe589('0x8e')](),_0x193a74);})['then'](function(_0x2571bb){_0xdd9187[_0xe589('0x8f')]=_0x2571bb[_0xe589('0x39')];if(_0xdd9187[_0xe589('0x8f')]===0x0)return[];return db[_0xe589('0x8d')][_0xe589('0x33')](_0x37824b[_0xe589('0x8e')](),_0x193a74)[_0xe589('0x23')](function(_0x3539fd){_0x563860=_[_0xe589('0x90')](_0x3539fd,'id');_0x193a74=_[_0xe589('0x91')](_0x193a74,{'model':db[_0xe589('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fcd0f['query'][_0xe589('0x37')]){_0xb287b1['attributes'][_0xe589('0x2c')](function(_0x39dc8f){_0x2f6484['field']('i.'+_0x39dc8f);});}else{_0x2f6484[_0xe589('0x40')](_0xe589('0x83'),'unreadMessages');_0x2f6484[_0xe589('0x40')](_0xe589('0x92'),_0xe589('0x93'));_0x2f6484[_0xe589('0x40')](_0xe589('0x94'),_0xe589('0x95'));_0x2f6484[_0xe589('0x40')]('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',_0xe589('0x84'));_0x2f6484[_0xe589('0x40')](_0xe589('0x96'));_0x2f6484['field'](_0xe589('0x97'),_0xe589('0x98'));_0x2f6484[_0xe589('0x40')](_0xe589('0x99'),_0xe589('0x9a'));_0x2f6484[_0xe589('0x40')]('c.email',_0xe589('0x9b'));_0x2f6484[_0xe589('0x40')](_0xe589('0x9c'),'Contact.phone');_0x2f6484[_0xe589('0x40')]('c.mobile','Contact.mobile');_0x2f6484[_0xe589('0x40')](_0xe589('0x9d'),_0xe589('0x9e'));_0x2f6484['field'](_0xe589('0x9f'),'Owner.fullname');_0x2f6484['field'](_0xe589('0xa0'),'Owner.internal');_0x2f6484[_0xe589('0x40')](_0xe589('0xa1'),_0xe589('0x29'));}if(_0xb287b1[_0xe589('0x1d')])_0x2f6484[_0xe589('0x1d')](_0xb287b1[_0xe589('0x1d')]);if(_0xb287b1[_0xe589('0x1f')])_0x2f6484['offset'](_0xb287b1[_0xe589('0x1f')]);return db[_0xe589('0x8d')][_0xe589('0x33')](_0x2f6484['toString'](),_0x193a74);})['then'](function(_0x2144f2){if(_0x2144f2[_0xe589('0x39')]>0x0)_0x51cc1d[_0xe589('0x3e')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x2144f2,'id'));return db[_0xe589('0x8d')]['query'](_0x51cc1d['toString'](),_0x193a74)[_0xe589('0x23')](function(_0xcaae67){var _0x3a8c5c=_[_0xe589('0xa2')](_0xcaae67,_0xe589('0xa3'));var _0x3a0f33=[];_0x2144f2[_0xe589('0x2c')](function(_0x209095){_0x3a0f33[_0xe589('0xa4')](updateFaxInteraction(_0x209095,_0x563860,_0x3a8c5c));});return BPromise[_0xe589('0xa5')](_0x3a0f33);});});})[_0xe589('0x23')](function(_0x562889){_0xdd9187[_0xe589('0xa6')]=_0x562889;return _0xdd9187;})[_0xe589('0x23')](respondWithFilteredResult(_0x4a661a,_0xb287b1))[_0xe589('0xa7')](handleError(_0x4a661a,null));};exports[_0xe589('0xa8')]=function(_0x17b5d6,_0x4ff87d){var _0x281ecc={'raw':![],'where':{'id':_0x17b5d6['params']['id']}},_0x2a7073={};_0x2a7073[_0xe589('0x32')]=_[_0xe589('0x34')](db[_0xe589('0x2e')]['rawAttributes']);_0x2a7073[_0xe589('0x33')]=_[_0xe589('0x34')](_0x17b5d6[_0xe589('0x33')]);_0x2a7073[_0xe589('0x35')]=_[_0xe589('0x36')](_0x2a7073[_0xe589('0x32')],_0x2a7073[_0xe589('0x33')]);_0x281ecc[_0xe589('0x38')]=_['intersection'](_0x2a7073['model'],qs['fields'](_0x17b5d6['query'][_0xe589('0x37')]));_0x281ecc[_0xe589('0x38')]=_0x281ecc['attributes'][_0xe589('0x39')]?_0x281ecc[_0xe589('0x38')]:_0x2a7073[_0xe589('0x32')];if(_0x17b5d6[_0xe589('0x33')]['includeAll']){_0x281ecc[_0xe589('0xa9')]=[{'all':!![]}];}_0x281ecc=_[_0xe589('0x91')]({},_0x281ecc,_0x17b5d6[_0xe589('0xaa')]);return db[_0xe589('0x2e')][_0xe589('0x58')](_0x281ecc)[_0xe589('0x23')](handleEntityNotFound(_0x4ff87d,null))[_0xe589('0x23')](respondWithResult(_0x4ff87d,null))[_0xe589('0xa7')](handleError(_0x4ff87d,null));};exports[_0xe589('0xab')]=function(_0x143b01,_0x446c9d){return db[_0xe589('0x2e')][_0xe589('0xab')](_0x143b01[_0xe589('0x6b')],{})[_0xe589('0x23')](respondWithResult(_0x446c9d,0xc9))['catch'](handleError(_0x446c9d,null));};exports['update']=function(_0x2aff46,_0x1c0907){if(_0x2aff46[_0xe589('0x6b')]['id']){delete _0x2aff46['body']['id'];}return db[_0xe589('0x2e')][_0xe589('0x58')]({'where':{'id':_0x2aff46[_0xe589('0xac')]['id']}})[_0xe589('0x23')](handleEntityNotFound(_0x1c0907,null))[_0xe589('0x23')](saveUpdates(_0x2aff46[_0xe589('0x6b')],null))['then'](respondWithResult(_0x1c0907,null))[_0xe589('0xa7')](handleError(_0x1c0907,null));};exports[_0xe589('0xad')]=function(_0x40c347,_0x1902cc){return db[_0xe589('0x2e')][_0xe589('0x58')]({'where':{'id':_0x40c347[_0xe589('0xac')]['id']}})[_0xe589('0x23')](handleEntityNotFound(_0x1902cc,null))[_0xe589('0x23')](removeEntity(_0x1902cc,null))['catch'](handleError(_0x1902cc,null));};exports[_0xe589('0xae')]=function(_0x8491cc,_0x1c2ea7){return db[_0xe589('0x2e')][_0xe589('0xae')]()['then'](respondWithResult(_0x1c2ea7,null))[_0xe589('0xa7')](handleError(_0x1c2ea7,null));};exports[_0xe589('0xaf')]=function(_0x145ffb,_0x45980e,_0x5cd9f0){return db[_0xe589('0xb0')][_0xe589('0x58')]({'where':{'id':_0x145ffb[_0xe589('0xac')]['id']}})[_0xe589('0x23')](handleEntityNotFound(_0x45980e,null))[_0xe589('0x23')](function(_0x55ba68){if(_0x55ba68){return _0x55ba68['addMessage'](_0x145ffb[_0xe589('0x6b')][_0xe589('0xb1')],_[_0xe589('0xb2')](_0x145ffb[_0xe589('0x6b')],['ids','id'])||{});}})[_0xe589('0x23')](respondWithResult(_0x45980e,null))[_0xe589('0xa7')](handleError(_0x45980e,null));};exports[_0xe589('0xb3')]=function(_0x43698f,_0x186f91,_0x4da3ec){var _0x48f3fd={'raw':![],'where':{}};var _0x5152a5={};var _0x4b5c15={'count':0x0,'rows':[]};return db[_0xe589('0x2e')][_0xe589('0xb4')]({'where':{'id':_0x43698f[_0xe589('0xac')]['id']}})['then'](handleEntityNotFound(_0x186f91,null))[_0xe589('0x23')](function(_0x5ddb8f){if(_0x5ddb8f){_0x5152a5['model']=_[_0xe589('0x34')](db[_0xe589('0xb0')][_0xe589('0x2f')]);_0x5152a5[_0xe589('0x33')]=_[_0xe589('0x34')](_0x43698f['query']);_0x5152a5[_0xe589('0x35')]=_[_0xe589('0x36')](_0x5152a5[_0xe589('0x32')],_0x5152a5['query']);_0x48f3fd[_0xe589('0x38')]=_[_0xe589('0x36')](_0x5152a5[_0xe589('0x32')],qs['fields'](_0x43698f['query'][_0xe589('0x37')]));_0x48f3fd[_0xe589('0x38')]=_0x48f3fd['attributes'][_0xe589('0x39')]?_0x48f3fd[_0xe589('0x38')]:_0x5152a5[_0xe589('0x32')];if(!_0x43698f[_0xe589('0x33')]['hasOwnProperty'](_0xe589('0x3b'))){_0x48f3fd['limit']=qs['limit'](_0x43698f[_0xe589('0x33')][_0xe589('0x1d')]);_0x48f3fd[_0xe589('0x1f')]=qs[_0xe589('0x1f')](_0x43698f[_0xe589('0x33')][_0xe589('0x1f')]);}_0x48f3fd[_0xe589('0x3c')]=qs[_0xe589('0x3d')](_0x43698f[_0xe589('0x33')][_0xe589('0x3d')]);_0x48f3fd[_0xe589('0x3e')]=qs['filters'](_['pick'](_0x43698f[_0xe589('0x33')],_0x5152a5[_0xe589('0x35')]));_0x48f3fd['where']['FaxInteractionId']=_0x5ddb8f['id'];if(_0x43698f[_0xe589('0x33')]['filter']){_0x48f3fd[_0xe589('0x3e')]=_[_0xe589('0x91')](_0x48f3fd[_0xe589('0x3e')],{'$or':_[_0xe589('0x27')](_0x48f3fd['attributes'],function(_0x248dfd){var _0x26562e={};_0x26562e[_0x248dfd]={'$like':'%'+_0x43698f[_0xe589('0x33')]['filter']+'%'};return _0x26562e;})});}if(_0x43698f['query'][_0xe589('0x71')]){var _0x50f9eb=_0x43698f[_0xe589('0x33')][_0xe589('0x71')][_0xe589('0x2b')](',');var _0x2699eb={};_0x2699eb[_0x50f9eb[0x0]]={'$gte':moment(_0x50f9eb[0x1])[_0xe589('0xb5')](_0xe589('0xb6'))};_0x48f3fd[_0xe589('0x3e')]=_['merge'](_0x48f3fd['where'],_0x2699eb);}_0x48f3fd=_[_0xe589('0x91')]({},_0x48f3fd,_0x43698f[_0xe589('0xaa')]);return db[_0xe589('0xb0')][_0xe589('0x8f')]({'where':_0x48f3fd[_0xe589('0x3e')]})[_0xe589('0x23')](function(_0x2244b6){_0x4b5c15[_0xe589('0x8f')]=_0x2244b6;if(_0x43698f[_0xe589('0x33')]['includeAll']){_0x48f3fd[_0xe589('0xa9')]=[{'all':!![]}];}return db[_0xe589('0xb0')][_0xe589('0xb7')](_0x48f3fd);})[_0xe589('0x23')](function(_0xeec560){_0x4b5c15[_0xe589('0xa6')]=_0xeec560;return _0x4b5c15;});}})['then'](respondWithFilteredResult(_0x186f91,_0x48f3fd))[_0xe589('0xa7')](handleError(_0x186f91,null));};exports['addTags']=function(_0x2c6b2f,_0xdc5188,_0x650a31){return db[_0xe589('0x2e')][_0xe589('0x58')]({'where':{'id':_0x2c6b2f[_0xe589('0xac')]['id']}})[_0xe589('0x23')](handleEntityNotFound(_0xdc5188,null))[_0xe589('0x23')](function(_0x4ba1e0){if(_0x4ba1e0){return _0x4ba1e0[_0xe589('0xb8')](_0x2c6b2f[_0xe589('0x6b')]['ids'],_['omit'](_0x2c6b2f[_0xe589('0x6b')],[_0xe589('0xb1'),'id'])||{})[_0xe589('0xb9')](function(){return db[_0xe589('0x64')]['findAll']({'attributes':['id',_0xe589('0x25'),_0xe589('0x41')],'where':{'id':_0x2c6b2f[_0xe589('0x6b')][_0xe589('0xb1')]}});})[_0xe589('0x23')](function(_0x5db56b){socket[_0xe589('0xba')](_0xe589('0xbb'),{'id':Number(_0x2c6b2f[_0xe589('0xac')]['id']),'tags':_0x5db56b||[]});return{'id':Number(_0x2c6b2f[_0xe589('0xac')]['id']),'tags':_0x5db56b||[]};});}})[_0xe589('0x23')](respondWithResult(_0xdc5188,null))[_0xe589('0xa7')](handleError(_0xdc5188,null));};exports['removeTags']=function(_0x218706,_0x3af182,_0x3ead57){return db['FaxInteraction']['find']({'where':{'id':_0x218706[_0xe589('0xac')]['id']}})[_0xe589('0x23')](handleEntityNotFound(_0x3af182,null))['then'](function(_0x1e9a15){if(_0x1e9a15){return _0x1e9a15[_0xe589('0xbc')](_0x218706['query'][_0xe589('0xb1')]);}})[_0xe589('0x23')](respondWithStatusCode(_0x3af182,null))['catch'](handleError(_0x3af182,null));};exports['download']=function(_0x4aa45c,_0x18e867){var _0x2c546c=moment()[_0xe589('0xbd')]()['toString']();var _0x155d8b=path[_0xe589('0xbe')](config[_0xe589('0xbf')],_0xe589('0xc0'),_0xe589('0xc1'),_0xe589('0xc2'));var _0x338d13=path[_0xe589('0xbe')](config['root'],_0xe589('0xc0'),_0xe589('0xc1'),_0xe589('0xc3'));var _0x881487=path[_0xe589('0xbe')](_0x155d8b,_0x2c546c);var _0x3dabaa=util['format'](_0xe589('0xc4'),_0x4aa45c[_0xe589('0xac')]['id'],_0x2c546c);var _0x3e5b81=path['join'](_0x155d8b,_0x3dabaa);var _0x223a75=[];_0x223a75[_0xe589('0xa4')]({'model':db[_0xe589('0xc5')],'as':_0xe589('0xc5'),'raw':!![]});var _0x5f24a1=[{'model':db[_0xe589('0xb0')],'as':'Messages','attributes':['id',_0xe589('0x6b'),_0xe589('0x6f')],'include':_0x223a75}];return db[_0xe589('0x2e')][_0xe589('0x58')]({'where':{'id':_0x4aa45c[_0xe589('0xac')]['id']},'include':_0x5f24a1})[_0xe589('0x23')](handleEntityNotFound(_0x18e867,null))[_0xe589('0x23')](function(_0x28c08d){if(_0x28c08d&&_0x28c08d[_0xe589('0xc6')]){var _0x3757c8=_0x28c08d[_0xe589('0xc7')]({'plain':!![]});fs['mkdirSync'](_0x881487);for(var _0x32fe82=0x0;_0x32fe82<_0x3757c8[_0xe589('0xc6')]['length'];_0x32fe82++){var _0x2208f2=_0x3757c8[_0xe589('0xc6')][_0x32fe82][_0xe589('0xc5')];if(_0x2208f2){var _0x275795=path['join'](_0x338d13,_0x2208f2['basename']);if(fs[_0xe589('0xc8')](_0x275795)){fs[_0xe589('0xc9')](_0x275795)[_0xe589('0xca')](fs[_0xe589('0xcb')](path['join'](_0x881487,_0x2208f2[_0xe589('0xcc')])));}}}return BPromise[_0xe589('0x86')]()[_0xe589('0x23')](function(){return new BPromise(function(_0x335b40,_0x14f6ef){zipdir(_0x881487,{'saveTo':_0x3e5b81},function(_0x247140,_0xb33df7){if(_0x247140)return _0x14f6ef(_0x247140);return _0x335b40(_0xb33df7);});})[_0xe589('0x23')](function(){return new BPromise(function(_0x21d4e8,_0x19f222){rimraf(_0x881487,function(_0x3484ad){if(_0x3484ad)_0x19f222(_0x3484ad);return _0x21d4e8();});});})[_0xe589('0x23')](function(){return _0x18e867[_0xe589('0xcd')](_0x3e5b81,_0x3dabaa,function(_0x4805e3){if(_0x4805e3){console[_0xe589('0xce')](_0xe589('0xcf'),_0x4805e3);}else{fs[_0xe589('0xd0')](_0x3e5b81);}});});});}else{return _0x18e867[_0xe589('0x19')](0xc8);}})[_0xe589('0xa7')](handleError(_0x18e867,null));}; \ No newline at end of file +var _0x41a2=['TagIds','split','forEach','Tags','catch','index','map','FaxInteraction','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','select','field','color','tools_tags','u.fullname','from','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_messages','me.FaxInteractionId\x20=\x20i.id','expr','parseSearch','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','UserId','some','isEmpty','where','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','toString','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','push','all','rows','show','params','includeAll','include','options','create','body','destroy','describe','addMessage','FaxMessage','ids','omit','findOne','FaxInteractionId','merge','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','spread','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','unlinkSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','limit','count','reject','update','then','error','stack','name','send','Users'];(function(_0x5193d2,_0xbc25c7){var _0x280f9a=function(_0x1dc67a){while(--_0x1dc67a){_0x5193d2['push'](_0x5193d2['shift']());}};_0x280f9a(++_0xbc25c7);}(_0x41a2,0x179));var _0x241a=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x41a2[_0x5b3950];return _0x41e436;};'use strict';var emlformat=require(_0x241a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x241a('0x1'));var rp=require(_0x241a('0x2'));var moment=require(_0x241a('0x3'));var BPromise=require(_0x241a('0x4'));var Mustache=require(_0x241a('0x5'));var util=require('util');var path=require('path');var sox=require(_0x241a('0x6'));var csv=require(_0x241a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x241a('0x8'));var _=require(_0x241a('0x9'));var squel=require(_0x241a('0xa'));var crypto=require(_0x241a('0xb'));var jsforce=require(_0x241a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x241a('0x7'));var querystring=require(_0x241a('0xd'));var Papa=require('papaparse');var Redis=require(_0x241a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x241a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x241a('0x10'));var logger=require(_0x241a('0x11'))(_0x241a('0x12'));var utils=require(_0x241a('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x241a('0x14'));var db=require(_0x241a('0x15'))['db'];config[_0x241a('0x16')]=_['defaults'](config['redis'],{'host':_0x241a('0x17'),'port':0x18eb});var socket=require(_0x241a('0x18'))(new Redis(config['redis']));require(_0x241a('0x19'))[_0x241a('0x1a')](socket);function respondWithStatusCode(_0x29bd48,_0x12391f){_0x12391f=_0x12391f||0xcc;return function(_0x5d5d72){if(_0x5d5d72){return _0x29bd48[_0x241a('0x1b')](_0x12391f);}return _0x29bd48[_0x241a('0x1c')](_0x12391f)[_0x241a('0x1d')]();};}function respondWithResult(_0x2712e1,_0x7c4280){_0x7c4280=_0x7c4280||0xc8;return function(_0x2a5d94){if(_0x2a5d94){return _0x2712e1['status'](_0x7c4280)[_0x241a('0x1e')](_0x2a5d94);}};}function respondWithFilteredResult(_0x5093a3,_0x191285){return function(_0x3084d6){if(_0x3084d6){var _0x189ae7=typeof _0x191285['offset']==='undefined'&&typeof _0x191285[_0x241a('0x1f')]==='undefined';var _0x2e4946=_0x3084d6['count'];var _0x121a18=_0x189ae7?0x0:_0x191285['offset'];var _0x1bbf8b=_0x189ae7?_0x3084d6[_0x241a('0x20')]:_0x191285['offset']+_0x191285[_0x241a('0x1f')];var _0x40e304;if(_0x1bbf8b>=_0x2e4946){_0x1bbf8b=_0x2e4946;_0x40e304=0xc8;}else{_0x40e304=0xce;}_0x5093a3[_0x241a('0x1c')](_0x40e304);return _0x5093a3['set']('Content-Range',_0x121a18+'-'+_0x1bbf8b+'/'+_0x2e4946)['json'](_0x3084d6);}return null;};}function patchUpdates(_0x588033){return function(_0x48f501){try{jsonpatch['apply'](_0x48f501,_0x588033,!![]);}catch(_0x458abb){return BPromise[_0x241a('0x21')](_0x458abb);}return _0x48f501['save']();};}function saveUpdates(_0x3aa6af,_0xe0f1e4){return function(_0x5d7e3c){if(_0x5d7e3c){return _0x5d7e3c[_0x241a('0x22')](_0x3aa6af)[_0x241a('0x23')](function(_0x2d90d7){return _0x2d90d7;});}return null;};}function removeEntity(_0x3a43c2,_0xe48fee){return function(_0x66d09){if(_0x66d09){return _0x66d09['destroy']()[_0x241a('0x23')](function(){_0x3a43c2[_0x241a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6d35,_0x1c29a0){return function(_0x530c54){if(!_0x530c54){_0x1e6d35[_0x241a('0x1b')](0x194);}return _0x530c54;};}function handleError(_0x460a40,_0x184c4f){_0x184c4f=_0x184c4f||0x1f4;return function(_0x537f61){logger[_0x241a('0x24')](_0x537f61[_0x241a('0x25')]);if(_0x537f61[_0x241a('0x26')]){delete _0x537f61[_0x241a('0x26')];}_0x460a40['status'](_0x184c4f)[_0x241a('0x27')](_0x537f61);};}function getInteractionUsers(_0x740079,_0x32b304){return new BPromise(function(_0x417cd7,_0x510cdb){try{if(_0x32b304[_0x740079['id']]){_0x740079[_0x241a('0x28')]=_['map'](_0x32b304[_0x740079['id']],function(_0x528f3e){return{'id':_0x528f3e['id'],'fullname':_0x528f3e['fullname']};});}}catch(_0x51e617){_0x510cdb(_0x51e617);}_0x417cd7(_0x740079);});}function getInteractionTags(_0x531ba7,_0x503587){return new BPromise(function(_0x4ad84b,_0x47a90b){try{if(_0x531ba7['TagIds']){_0x531ba7['Tags']=[];_0x531ba7[_0x241a('0x29')][_0x241a('0x2a')](',')[_0x241a('0x2b')](function(_0x4ac9bc){_0x531ba7[_0x241a('0x2c')]['push'](_0x503587[_0x4ac9bc]);});}delete _0x531ba7[_0x241a('0x29')];}catch(_0xb3f921){_0x47a90b(_0xb3f921);}_0x4ad84b(_0x531ba7);});}function updateFaxInteraction(_0x381be2,_0x14afd7,_0x25496d){return new BPromise(function(_0x608dc6,_0x26009b){return getInteractionUsers(_0x381be2,_0x25496d)[_0x241a('0x23')](function(_0x50acf9){return getInteractionTags(_0x50acf9,_0x14afd7);})[_0x241a('0x23')](function(_0x589c55){_0x608dc6(_0x589c55);})[_0x241a('0x2d')](function(_0x1deaab){_0x26009b(_0x1deaab);});});}exports[_0x241a('0x2e')]=function(_0x21e3c6,_0x487e15){var _0x26e327={},_0x539083={},_0x333ccd={'count':0x0,'rows':[]};var _0x406d1c=_[_0x241a('0x2f')](db[_0x241a('0x30')][_0x241a('0x31')],function(_0x110414){return{'name':_0x110414['fieldName'],'type':_0x110414[_0x241a('0x32')][_0x241a('0x33')]};});_0x539083[_0x241a('0x34')]=_[_0x241a('0x2f')](_0x406d1c,'name');_0x539083[_0x241a('0x35')]=_[_0x241a('0x36')](_0x21e3c6[_0x241a('0x35')]);_0x539083[_0x241a('0x37')]=_[_0x241a('0x38')](_0x539083[_0x241a('0x34')],_0x539083[_0x241a('0x35')]);_0x26e327[_0x241a('0x39')]=_[_0x241a('0x38')](_0x539083[_0x241a('0x34')],qs[_0x241a('0x3a')](_0x21e3c6[_0x241a('0x35')]['fields']));_0x26e327[_0x241a('0x39')]=_0x26e327[_0x241a('0x39')][_0x241a('0x3b')]?_0x26e327[_0x241a('0x39')]:_0x539083[_0x241a('0x34')];if(!_0x21e3c6[_0x241a('0x35')][_0x241a('0x3c')](_0x241a('0x3d'))){_0x26e327[_0x241a('0x1f')]=qs['limit'](_0x21e3c6[_0x241a('0x35')][_0x241a('0x1f')]);_0x26e327[_0x241a('0x3e')]=qs[_0x241a('0x3e')](_0x21e3c6['query']['offset']);}_0x26e327[_0x241a('0x3f')]=qs[_0x241a('0x40')](_0x21e3c6[_0x241a('0x35')][_0x241a('0x40')]);_0x26e327['where']=qs[_0x241a('0x37')](_['pick'](_0x21e3c6[_0x241a('0x35')],_0x539083[_0x241a('0x37')]),_0x406d1c);var _0x3ea547=[];var _0x2e533f=squel[_0x241a('0x41')]()['field']('id')[_0x241a('0x42')](_0x241a('0x26'))['field'](_0x241a('0x43'))['from'](_0x241a('0x44'));var _0x21d124=squel[_0x241a('0x41')]()['field']('u.id')[_0x241a('0x42')](_0x241a('0x45'))[_0x241a('0x42')]('ui.FaxInteractionId')[_0x241a('0x46')](_0x241a('0x47'),'ui')[_0x241a('0x48')](_0x241a('0x49'),'u',_0x241a('0x4a'));var _0x528070=squel[_0x241a('0x41')]()[_0x241a('0x46')]('fax_interactions','i')[_0x241a('0x48')]('cm_contacts','c',_0x241a('0x4b'))[_0x241a('0x48')](_0x241a('0x49'),'o',_0x241a('0x4c'))[_0x241a('0x48')]('fax_accounts','a',_0x241a('0x4d'))[_0x241a('0x48')](_0x241a('0x4e'),'me',_0x241a('0x4f'))[_0x241a('0x48')]('fax_interaction_has_tags','it','it.FaxInteractionId\x20=\x20i.id')[_0x241a('0x48')](_0x241a('0x44'),'t','t.id\x20=\x20it.TagId');var _0x25ab6c=squel[_0x241a('0x50')]();var _0x26f72b=[];var _0x5db98b=squel[_0x241a('0x50')]();var _0x2dd485;if(_0x21e3c6['query']['search']){_0x2dd485=as[_0x241a('0x51')](_0x21e3c6[_0x241a('0x35')]['search']);var _0x7ebf07=_0x2dd485['sqlOperator'];for(var _0x4b758a=0x0;_0x4b758a<_0x2dd485[_0x241a('0x52')][_0x241a('0x3b')];_0x4b758a++){var _0x583290=_0x2dd485[_0x241a('0x52')][_0x4b758a];var _0xc1ac58='i';var _0x57f4b3=_[_0x241a('0x53')](_0x406d1c,[_0x241a('0x26'),_0x583290['field']]);if(!_0x57f4b3){switch(_0x583290[_0x241a('0x42')]){case _0x241a('0x54'):if(_0x583290[_0x241a('0x55')]==0x1){_0x528070[_0x241a('0x56')]('`'+_0x583290[_0x241a('0x42')]+'`\x20=\x200');}else{_0x528070['having']('`'+_0x583290[_0x241a('0x42')]+_0x241a('0x57'));}break;case _0x241a('0x58'):if(_0x583290['operator']===_0x241a('0x59')){if(_0x583290[_0x241a('0x55')][_0x241a('0x2a')]('\x20')[_0x241a('0x3b')]>0x1){_0x25ab6c[_0x7ebf07](_0x241a('0x5a'),qs['getFullTextValue'](_0x583290['value']),null);}else{var _0x5e3d33='%'+_0x583290['value']+'%';_0x25ab6c[_0x7ebf07](_0x241a('0x5b'),_0x5e3d33,_0x5e3d33,_0x5e3d33);}}else{_0x57f4b3=_[_0x241a('0x53')](_0x406d1c,[_0x241a('0x26'),_0x241a('0x5c')]);_0x583290[_0x241a('0x42')]=_0x241a('0x5c');_0x37c161=as[_0x241a('0x5d')](_0xc1ac58,_0x57f4b3[_0x241a('0x32')],_0x583290);_0x25ab6c[_0x7ebf07](_0x37c161[_0x241a('0x5e')],_0x37c161['value'][_0x241a('0x5f')],_0x37c161[_0x241a('0x55')]['end']);}break;case'Tag':var _0x49deda=_0x583290[_0x241a('0x55')][_0x241a('0x2a')](',')[_0x241a('0x2f')](function(_0x3154a9){return Number(_0x3154a9);});_0x49deda['forEach'](function(_0x480e44){_0x5db98b['or'](_0x241a('0x60'),'%,'+_0x480e44+',%');});_0x26f72b=_[_0x241a('0x61')](_0x26f72b,_0x49deda);break;case _0x241a('0x62'):if(_0x583290[_0x241a('0x63')]===_0x241a('0x59')){_0x25ab6c[_0x7ebf07]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x583290[_0x241a('0x55')]+'%',null);}else{_0x57f4b3=_[_0x241a('0x53')](_0x406d1c,['name',_0x241a('0x64')]);_0x583290[_0x241a('0x42')]=_0x241a('0x64');_0x37c161=as[_0x241a('0x5d')](_0xc1ac58,_0x57f4b3[_0x241a('0x32')],_0x583290);_0x25ab6c[_0x7ebf07](_0x37c161[_0x241a('0x5e')],_0x37c161[_0x241a('0x55')]['start'],_0x37c161[_0x241a('0x55')][_0x241a('0x1d')]);}break;case'body':_0x37c161=as['buildExpression']('me',null,_0x583290);_0x25ab6c[_0x7ebf07](_0x37c161[_0x241a('0x5e')],_0x37c161['value'][_0x241a('0x5f')],_0x37c161[_0x241a('0x55')]['end']);break;}}else{var _0x37c161=as[_0x241a('0x5d')](_0xc1ac58,_0x57f4b3[_0x241a('0x32')],_0x583290);_0x25ab6c[_0x7ebf07](_0x37c161[_0x241a('0x5e')],_0x37c161[_0x241a('0x55')]['start'],_0x37c161[_0x241a('0x55')][_0x241a('0x1d')]);}}}else{var _0x1fabd8=_(_0x21e3c6[_0x241a('0x35')])['keys']()[_0x241a('0x2f')](function(_0x3c16ac){return _[_0x241a('0x65')](_0x406d1c,[_0x241a('0x26'),_0x3c16ac])?_0x3c16ac:undefined;})['compact']()[_0x241a('0x55')]();if(!_[_0x241a('0x66')](_0x1fabd8)){_0x1fabd8[_0x241a('0x2b')](function(_0x23d585){if(_0x23d585==='FaxAccountId'){_0x528070[_0x241a('0x67')]('i.FaxAccountId\x20IN\x20?',[][_0x241a('0x68')](_0x21e3c6[_0x241a('0x35')][_0x23d585]));}else if(_0x23d585===_0x241a('0x69')){var _0x46772e=JSON[_0x241a('0x6a')](_0x21e3c6[_0x241a('0x35')][_0x23d585])[_0x241a('0x6b')];var _0x37fa10=JSON[_0x241a('0x6a')](_0x21e3c6[_0x241a('0x35')][_0x23d585])[_0x241a('0x6c')];_0x528070[_0x241a('0x67')](_0x241a('0x6d'),_0x46772e,_0x37fa10);}else{if(_0x21e3c6['query'][_0x23d585]===_0x241a('0x6e')){_0x528070['where']('i.'+_0x23d585+_0x241a('0x6f'));}else{_0x528070[_0x241a('0x67')]('i.'+_0x23d585+'\x20=\x20?',_0x21e3c6[_0x241a('0x35')][_0x23d585]);}}});}if(_0x21e3c6['query'][_0x241a('0x70')]){if(_0x21e3c6['query']['read']==0x1){_0x528070[_0x241a('0x56')](_0x241a('0x71'));}else{_0x528070['having'](_0x241a('0x72'));}}if(_0x21e3c6[_0x241a('0x35')][_0x241a('0x73')]){_0x26f72b=_[_0x241a('0x74')](_0x21e3c6[_0x241a('0x35')]['tag'])?_0x21e3c6['query'][_0x241a('0x73')]:new Array(_0x21e3c6[_0x241a('0x35')][_0x241a('0x73')]);_0x26f72b[_0x241a('0x2b')](function(_0x4c1ddb){_0x5db98b['or'](_0x241a('0x60'),'%,'+_0x4c1ddb+',%');});}if(_0x21e3c6[_0x241a('0x35')][_0x241a('0x75')]){var _0x4ce5d9=_0x21e3c6['query'][_0x241a('0x75')][_0x241a('0x76')]('\x5c','\x5c\x5c')[_0x241a('0x76')](/'/g,'\x27\x27');if(qs[_0x241a('0x77')](_0x4ce5d9)){_0x25ab6c['or']('i.id\x20LIKE\x20?',_0x4ce5d9+'%')['or'](_0x241a('0x78'),_0x4ce5d9+'%');}_0x25ab6c['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x4ce5d9+'%');}}_0x528070['where'](_0x25ab6c);_0x528070[_0x241a('0x79')](_0x241a('0x7a'));var _0x292cb8={'type':db[_0x241a('0x7b')][_0x241a('0x7c')][_0x241a('0x7d')],'raw':!![]};var _0x39de12=_0x528070['clone']();_0x39de12[_0x241a('0x42')](_0x241a('0x7a'));_0x39de12['field'](_0x241a('0x7e'),_0x241a('0x54'));if(_0x26e327[_0x241a('0x3f')]){_0x26e327['order']['forEach'](function(_0x405189){var _0xccd51b=_0x405189[0x0]===_0x241a('0x7f')?_0x405189[0x0]:'i.'+_0x405189[0x0];_0x528070[_0x241a('0x3f')](_0xccd51b,_0x405189[0x1]===_0x241a('0x80')?![]:!![]);});}if(!_['isEmpty'](_0x26f72b)){_0x528070[_0x241a('0x56')](_0x5db98b);_0x39de12[_0x241a('0x67')](_0x241a('0x81'),_0x26f72b);}BPromise[_0x241a('0x82')]()[_0x241a('0x23')](function(){if(!_0x2dd485){if(_0x21e3c6['query'][_0x241a('0x83')])return;_0x39de12[_0x241a('0x67')](_0x241a('0x84'));_0x528070['where'](_0x241a('0x84'));return;}if(_0x21e3c6[_0x241a('0x85')][_0x241a('0x86')]!==_0x241a('0x87'))return;return _0x21e3c6[_0x241a('0x85')][_0x241a('0x88')]({'attributes':['id'],'raw':!![]})[_0x241a('0x23')](function(_0x8d5a67){if(_[_0x241a('0x66')](_0x8d5a67)){_0x39de12[_0x241a('0x67')](_0x241a('0x89'));_0x528070[_0x241a('0x67')](_0x241a('0x89'));}else{_0x39de12['where'](_0x241a('0x8a'),_['map'](_0x8d5a67,'id'));_0x528070['where'](_0x241a('0x8a'),_[_0x241a('0x2f')](_0x8d5a67,'id'));}});})[_0x241a('0x23')](function(){if(_0x21e3c6['user']['role']===_0x241a('0x87')&&!_0x2dd485&&!_0x21e3c6[_0x241a('0x35')][_0x241a('0x83')])return[];return db[_0x241a('0x8b')]['query'](_0x39de12[_0x241a('0x8c')](),_0x292cb8);})['then'](function(_0x21b4d6){_0x333ccd[_0x241a('0x20')]=_0x21b4d6[_0x241a('0x3b')];if(_0x333ccd[_0x241a('0x20')]===0x0)return[];return db['sequelize'][_0x241a('0x35')](_0x2e533f[_0x241a('0x8c')](),_0x292cb8)[_0x241a('0x23')](function(_0x5c0eda){_0x3ea547=_[_0x241a('0x8d')](_0x5c0eda,'id');_0x292cb8=_['merge'](_0x292cb8,{'model':db[_0x241a('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x21e3c6[_0x241a('0x35')][_0x241a('0x3a')]){_0x26e327['attributes'][_0x241a('0x2b')](function(_0x5e31ad){_0x528070['field']('i.'+_0x5e31ad);});}else{_0x528070['field'](_0x241a('0x7e'),_0x241a('0x54'));_0x528070[_0x241a('0x42')](_0x241a('0x8e'),_0x241a('0x8f'));_0x528070[_0x241a('0x42')]('a.mandatoryDisposition',_0x241a('0x90'));_0x528070['field'](_0x241a('0x91'),_0x241a('0x7f'));_0x528070['field'](_0x241a('0x92'));_0x528070[_0x241a('0x42')]('c.firstName',_0x241a('0x93'));_0x528070[_0x241a('0x42')](_0x241a('0x94'),_0x241a('0x95'));_0x528070['field'](_0x241a('0x96'),_0x241a('0x97'));_0x528070['field'](_0x241a('0x98'),_0x241a('0x99'));_0x528070[_0x241a('0x42')](_0x241a('0x9a'),_0x241a('0x9b'));_0x528070['field'](_0x241a('0x9c'),_0x241a('0x9d'));_0x528070[_0x241a('0x42')](_0x241a('0x9e'),_0x241a('0x9f'));_0x528070[_0x241a('0x42')]('o.internal',_0x241a('0xa0'));_0x528070['field'](_0x241a('0xa1'),_0x241a('0x29'));}if(_0x26e327['limit'])_0x528070[_0x241a('0x1f')](_0x26e327[_0x241a('0x1f')]);if(_0x26e327[_0x241a('0x3e')])_0x528070[_0x241a('0x3e')](_0x26e327['offset']);return db['sequelize'][_0x241a('0x35')](_0x528070['toString'](),_0x292cb8);})['then'](function(_0xbcb435){if(_0xbcb435[_0x241a('0x3b')]>0x0)_0x21d124[_0x241a('0x67')](_0x241a('0xa2'),_[_0x241a('0x2f')](_0xbcb435,'id'));return db['sequelize'][_0x241a('0x35')](_0x21d124['toString'](),_0x292cb8)[_0x241a('0x23')](function(_0x5c287b){var _0x32c59c=_[_0x241a('0xa3')](_0x5c287b,'FaxInteractionId');var _0x41284c=[];_0xbcb435[_0x241a('0x2b')](function(_0x447b6a){_0x41284c[_0x241a('0xa4')](updateFaxInteraction(_0x447b6a,_0x3ea547,_0x32c59c));});return BPromise[_0x241a('0xa5')](_0x41284c);});});})[_0x241a('0x23')](function(_0x582392){_0x333ccd[_0x241a('0xa6')]=_0x582392;return _0x333ccd;})['then'](respondWithFilteredResult(_0x487e15,_0x26e327))[_0x241a('0x2d')](handleError(_0x487e15,null));};exports[_0x241a('0xa7')]=function(_0xca64fb,_0xefef7c){var _0x4dd135={'raw':![],'where':{'id':_0xca64fb[_0x241a('0xa8')]['id']}},_0x97b1dc={};_0x97b1dc[_0x241a('0x34')]=_[_0x241a('0x36')](db[_0x241a('0x30')][_0x241a('0x31')]);_0x97b1dc[_0x241a('0x35')]=_['keys'](_0xca64fb[_0x241a('0x35')]);_0x97b1dc[_0x241a('0x37')]=_['intersection'](_0x97b1dc[_0x241a('0x34')],_0x97b1dc[_0x241a('0x35')]);_0x4dd135['attributes']=_[_0x241a('0x38')](_0x97b1dc[_0x241a('0x34')],qs[_0x241a('0x3a')](_0xca64fb[_0x241a('0x35')][_0x241a('0x3a')]));_0x4dd135[_0x241a('0x39')]=_0x4dd135[_0x241a('0x39')][_0x241a('0x3b')]?_0x4dd135[_0x241a('0x39')]:_0x97b1dc[_0x241a('0x34')];if(_0xca64fb[_0x241a('0x35')][_0x241a('0xa9')]){_0x4dd135[_0x241a('0xaa')]=[{'all':!![]}];}_0x4dd135=_['merge']({},_0x4dd135,_0xca64fb[_0x241a('0xab')]);return db[_0x241a('0x30')][_0x241a('0x53')](_0x4dd135)[_0x241a('0x23')](handleEntityNotFound(_0xefef7c,null))[_0x241a('0x23')](respondWithResult(_0xefef7c,null))[_0x241a('0x2d')](handleError(_0xefef7c,null));};exports[_0x241a('0xac')]=function(_0x391ec3,_0xc2bc41){return db['FaxInteraction'][_0x241a('0xac')](_0x391ec3[_0x241a('0xad')],{})[_0x241a('0x23')](respondWithResult(_0xc2bc41,0xc9))[_0x241a('0x2d')](handleError(_0xc2bc41,null));};exports['update']=function(_0x5313fd,_0x348333){if(_0x5313fd[_0x241a('0xad')]['id']){delete _0x5313fd[_0x241a('0xad')]['id'];}return db['FaxInteraction'][_0x241a('0x53')]({'where':{'id':_0x5313fd['params']['id']}})[_0x241a('0x23')](handleEntityNotFound(_0x348333,null))[_0x241a('0x23')](saveUpdates(_0x5313fd[_0x241a('0xad')],null))[_0x241a('0x23')](respondWithResult(_0x348333,null))['catch'](handleError(_0x348333,null));};exports[_0x241a('0xae')]=function(_0x2f9e44,_0x45d397){return db[_0x241a('0x30')]['find']({'where':{'id':_0x2f9e44[_0x241a('0xa8')]['id']}})[_0x241a('0x23')](handleEntityNotFound(_0x45d397,null))[_0x241a('0x23')](removeEntity(_0x45d397,null))['catch'](handleError(_0x45d397,null));};exports[_0x241a('0xaf')]=function(_0x278709,_0x5cee03){return db[_0x241a('0x30')][_0x241a('0xaf')]()[_0x241a('0x23')](respondWithResult(_0x5cee03,null))['catch'](handleError(_0x5cee03,null));};exports[_0x241a('0xb0')]=function(_0x3f886a,_0x2b6577,_0x396ed4){return db[_0x241a('0xb1')][_0x241a('0x53')]({'where':{'id':_0x3f886a[_0x241a('0xa8')]['id']}})[_0x241a('0x23')](handleEntityNotFound(_0x2b6577,null))[_0x241a('0x23')](function(_0xbfa727){if(_0xbfa727){return _0xbfa727[_0x241a('0xb0')](_0x3f886a[_0x241a('0xad')][_0x241a('0xb2')],_[_0x241a('0xb3')](_0x3f886a[_0x241a('0xad')],[_0x241a('0xb2'),'id'])||{});}})['then'](respondWithResult(_0x2b6577,null))[_0x241a('0x2d')](handleError(_0x2b6577,null));};exports['getMessages']=function(_0x14587a,_0x589c9a,_0x3c4612){var _0x34b7f7={'raw':![],'where':{}};var _0x3d5e5f={};var _0x5c69f0={'count':0x0,'rows':[]};return db[_0x241a('0x30')][_0x241a('0xb4')]({'where':{'id':_0x14587a[_0x241a('0xa8')]['id']}})['then'](handleEntityNotFound(_0x589c9a,null))[_0x241a('0x23')](function(_0x1a90c0){if(_0x1a90c0){_0x3d5e5f[_0x241a('0x34')]=_[_0x241a('0x36')](db[_0x241a('0xb1')][_0x241a('0x31')]);_0x3d5e5f[_0x241a('0x35')]=_[_0x241a('0x36')](_0x14587a[_0x241a('0x35')]);_0x3d5e5f[_0x241a('0x37')]=_[_0x241a('0x38')](_0x3d5e5f[_0x241a('0x34')],_0x3d5e5f[_0x241a('0x35')]);_0x34b7f7[_0x241a('0x39')]=_[_0x241a('0x38')](_0x3d5e5f[_0x241a('0x34')],qs[_0x241a('0x3a')](_0x14587a['query'][_0x241a('0x3a')]));_0x34b7f7['attributes']=_0x34b7f7[_0x241a('0x39')][_0x241a('0x3b')]?_0x34b7f7['attributes']:_0x3d5e5f['model'];if(!_0x14587a[_0x241a('0x35')][_0x241a('0x3c')](_0x241a('0x3d'))){_0x34b7f7[_0x241a('0x1f')]=qs[_0x241a('0x1f')](_0x14587a[_0x241a('0x35')][_0x241a('0x1f')]);_0x34b7f7[_0x241a('0x3e')]=qs[_0x241a('0x3e')](_0x14587a[_0x241a('0x35')]['offset']);}_0x34b7f7[_0x241a('0x3f')]=qs['sort'](_0x14587a[_0x241a('0x35')][_0x241a('0x40')]);_0x34b7f7[_0x241a('0x67')]=qs[_0x241a('0x37')](_['pick'](_0x14587a[_0x241a('0x35')],_0x3d5e5f['filters']));_0x34b7f7[_0x241a('0x67')][_0x241a('0xb5')]=_0x1a90c0['id'];if(_0x14587a['query'][_0x241a('0x75')]){_0x34b7f7[_0x241a('0x67')]=_[_0x241a('0xb6')](_0x34b7f7['where'],{'$or':_['map'](_0x34b7f7[_0x241a('0x39')],function(_0x2c9e99){var _0x3e10a7={};_0x3e10a7[_0x2c9e99]={'$like':'%'+_0x14587a[_0x241a('0x35')][_0x241a('0x75')]+'%'};return _0x3e10a7;})});}if(_0x14587a[_0x241a('0x35')][_0x241a('0x6b')]){var _0x52a3e2=_0x14587a[_0x241a('0x35')][_0x241a('0x6b')][_0x241a('0x2a')](',');var _0x21be8c={};_0x21be8c[_0x52a3e2[0x0]]={'$gte':moment(_0x52a3e2[0x1])[_0x241a('0xb7')](_0x241a('0xb8'))};_0x34b7f7[_0x241a('0x67')]=_[_0x241a('0xb6')](_0x34b7f7[_0x241a('0x67')],_0x21be8c);}_0x34b7f7=_[_0x241a('0xb6')]({},_0x34b7f7,_0x14587a['options']);return db[_0x241a('0xb1')]['count']({'where':_0x34b7f7[_0x241a('0x67')]})[_0x241a('0x23')](function(_0x387ec1){_0x5c69f0[_0x241a('0x20')]=_0x387ec1;if(_0x14587a[_0x241a('0x35')][_0x241a('0xa9')]){_0x34b7f7[_0x241a('0xaa')]=[{'all':!![]}];}return db['FaxMessage'][_0x241a('0xb9')](_0x34b7f7);})[_0x241a('0x23')](function(_0x550529){_0x5c69f0[_0x241a('0xa6')]=_0x550529;return _0x5c69f0;});}})['then'](respondWithFilteredResult(_0x589c9a,_0x34b7f7))['catch'](handleError(_0x589c9a,null));};exports[_0x241a('0xba')]=function(_0x5c44c4,_0x1f52cf,_0x2ba15c){return db[_0x241a('0x30')][_0x241a('0x53')]({'where':{'id':_0x5c44c4['params']['id']}})[_0x241a('0x23')](handleEntityNotFound(_0x1f52cf,null))[_0x241a('0x23')](function(_0x59fff8){if(_0x59fff8){return _0x59fff8['setTags'](_0x5c44c4[_0x241a('0xad')][_0x241a('0xb2')],_[_0x241a('0xb3')](_0x5c44c4[_0x241a('0xad')],[_0x241a('0xb2'),'id'])||{})[_0x241a('0xbb')](function(){return db['Tag'][_0x241a('0xb9')]({'attributes':['id',_0x241a('0x26'),_0x241a('0x43')],'where':{'id':_0x5c44c4[_0x241a('0xad')][_0x241a('0xb2')]}});})[_0x241a('0x23')](function(_0x1a7470){socket['emit'](_0x241a('0xbc'),{'id':Number(_0x5c44c4[_0x241a('0xa8')]['id']),'tags':_0x1a7470||[]});return{'id':Number(_0x5c44c4[_0x241a('0xa8')]['id']),'tags':_0x1a7470||[]};});}})[_0x241a('0x23')](respondWithResult(_0x1f52cf,null))['catch'](handleError(_0x1f52cf,null));};exports[_0x241a('0xbd')]=function(_0x515a4e,_0x326551,_0x2711a3){return db[_0x241a('0x30')]['find']({'where':{'id':_0x515a4e['params']['id']}})[_0x241a('0x23')](handleEntityNotFound(_0x326551,null))['then'](function(_0x27c511){if(_0x27c511){return _0x27c511[_0x241a('0xbd')](_0x515a4e['query'][_0x241a('0xb2')]);}})[_0x241a('0x23')](respondWithStatusCode(_0x326551,null))[_0x241a('0x2d')](handleError(_0x326551,null));};exports[_0x241a('0xbe')]=function(_0x3d3426,_0x2e14b6){var _0x1f0b17=moment()[_0x241a('0xbf')]()[_0x241a('0x8c')]();var _0x10b237=path[_0x241a('0xc0')](config[_0x241a('0xc1')],_0x241a('0xc2'),_0x241a('0xc3'),_0x241a('0xc4'));var _0x3f16f9=path[_0x241a('0xc0')](config[_0x241a('0xc1')],'server',_0x241a('0xc3'),_0x241a('0xc5'));var _0x2d075a=path['join'](_0x10b237,_0x1f0b17);var _0x5326e7=util[_0x241a('0xb7')]('transcript-%d-%s.zip',_0x3d3426[_0x241a('0xa8')]['id'],_0x1f0b17);var _0x38af64=path[_0x241a('0xc0')](_0x10b237,_0x5326e7);var _0x2a7314=[];_0x2a7314[_0x241a('0xa4')]({'model':db[_0x241a('0xc6')],'as':_0x241a('0xc6'),'raw':!![]});var _0x10cedc=[{'model':db[_0x241a('0xb1')],'as':'Messages','attributes':['id',_0x241a('0xad'),'createdAt'],'include':_0x2a7314}];return db['FaxInteraction'][_0x241a('0x53')]({'where':{'id':_0x3d3426[_0x241a('0xa8')]['id']},'include':_0x10cedc})[_0x241a('0x23')](handleEntityNotFound(_0x2e14b6,null))[_0x241a('0x23')](function(_0x3da363){if(_0x3da363&&_0x3da363[_0x241a('0xc7')]){var _0x2b360a=_0x3da363[_0x241a('0xc8')]({'plain':!![]});fs[_0x241a('0xc9')](_0x2d075a);for(var _0x1bb8ea=0x0;_0x1bb8ea<_0x2b360a[_0x241a('0xc7')][_0x241a('0x3b')];_0x1bb8ea++){var _0xf33b20=_0x2b360a[_0x241a('0xc7')][_0x1bb8ea]['Attachment'];if(_0xf33b20){var _0x388163=path['join'](_0x3f16f9,_0xf33b20[_0x241a('0xca')]);if(fs[_0x241a('0xcb')](_0x388163)){fs[_0x241a('0xcc')](_0x388163)[_0x241a('0xcd')](fs[_0x241a('0xce')](path['join'](_0x2d075a,_0xf33b20['basename'])));}}}return BPromise['resolve']()[_0x241a('0x23')](function(){return new BPromise(function(_0x370db8,_0x20ad4d){zipdir(_0x2d075a,{'saveTo':_0x38af64},function(_0x4a6a8f,_0x101266){if(_0x4a6a8f)return _0x20ad4d(_0x4a6a8f);return _0x370db8(_0x101266);});})[_0x241a('0x23')](function(){return new BPromise(function(_0xd9cc65,_0x54ac41){rimraf(_0x2d075a,function(_0x17cc4d){if(_0x17cc4d)_0x54ac41(_0x17cc4d);return _0xd9cc65();});});})[_0x241a('0x23')](function(){return _0x2e14b6['download'](_0x38af64,_0x5326e7,function(_0x1be2a9){if(_0x1be2a9){console[_0x241a('0xcf')]('err',_0x1be2a9);}else{fs[_0x241a('0xd0')](_0x38af64);}});});});}else{return _0x2e14b6[_0x241a('0x1b')](0xc8);}})['catch'](handleError(_0x2e14b6,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 1302ec6..4a492a2 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 _0xdc5b=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','FaxInteraction','../../mysqldb','save','update','remove','getUsers'];(function(_0x26990c,_0x27fd72){var _0x4d076b=function(_0x475b80){while(--_0x475b80){_0x26990c['push'](_0x26990c['shift']());}};_0x4d076b(++_0x27fd72);}(_0xdc5b,0x1bb));var _0xbdc5=function(_0x59651d,_0x2fa32b){_0x59651d=_0x59651d-0x0;var _0x3bc0ca=_0xdc5b[_0x59651d];return _0x3bc0ca;};'use strict';var EventEmitter=require(_0xbdc5('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xbdc5('0x1')];var FaxMessage=require(_0xbdc5('0x2'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbdc5('0x3'),'afterUpdate':_0xbdc5('0x4'),'afterDestroy':_0xbdc5('0x5')};function emitEvent(_0x4b671e){return function(_0x411360,_0x30e6e6,_0x443c0c){_0x411360[_0xbdc5('0x6')]({'attributes':['id'],'raw':!![]})[_0xbdc5('0x7')](function(_0x5d37bc){_0x411360[_0xbdc5('0x8')](_0xbdc5('0x9'),_0x5d37bc[_0xbdc5('0xa')](function(_0x3790c6){return{'id':_0x3790c6['id']};}));return FaxMessage[_0xbdc5('0xb')]({'where':{'FaxInteractionId':_0x411360['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbdc5('0x7')](function(_0x573d10){_0x411360['setDataValue'](_0xbdc5('0xc'),_0x573d10[_0xbdc5('0xd')]);FaxInteractionEvents['emit'](_0x4b671e+':'+_0x411360['id'],_0x411360);FaxInteractionEvents[_0xbdc5('0xe')](_0x4b671e,_0x411360);_0x443c0c(null);})[_0xbdc5('0xf')](_0x443c0c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0xbdc5('0x10')](e,emitEvent(event));}}module[_0xbdc5('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x1f82=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x1f82,0x161));var _0x21f8=function(_0x41f3c8,_0x5976b4){_0x41f3c8=_0x41f3c8-0x0;var _0x58d4f7=_0x1f82[_0x41f3c8];return _0x58d4f7;};'use strict';var EventEmitter=require(_0x21f8('0x0'));var FaxInteraction=require(_0x21f8('0x1'))['db'][_0x21f8('0x2')];var FaxMessage=require(_0x21f8('0x1'))['db'][_0x21f8('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x21f8('0x4')](0x0);var events={'afterCreate':_0x21f8('0x5'),'afterUpdate':_0x21f8('0x6'),'afterDestroy':_0x21f8('0x7')};function emitEvent(_0x35a016){return function(_0x345c23,_0x1e25c8,_0xdd573){_0x345c23[_0x21f8('0x8')]({'attributes':['id'],'raw':!![]})[_0x21f8('0x9')](function(_0x26c5f2){_0x345c23[_0x21f8('0xa')](_0x21f8('0xb'),_0x26c5f2[_0x21f8('0xc')](function(_0x385d73){return{'id':_0x385d73['id']};}));return FaxMessage[_0x21f8('0xd')]({'where':{'FaxInteractionId':_0x345c23['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x518768){_0x345c23[_0x21f8('0xa')](_0x21f8('0xe'),_0x518768['length']);FaxInteractionEvents['emit'](_0x35a016+':'+_0x345c23['id'],_0x345c23);FaxInteractionEvents[_0x21f8('0xf')](_0x35a016,_0x345c23);_0xdd573(null);})['catch'](_0xdd573(null));};}for(var e in events){if(events[_0x21f8('0x10')](e)){var event=events[e];FaxInteraction[_0x21f8('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 7ed62ec..0cc3ef6 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 _0x937d=['path','rimraf','../../config/environment','exports','FaxInteraction','fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','moment','bluebird','request-promise'];(function(_0x239cee,_0xf786c8){var _0x4fe6b6=function(_0x2d6a20){while(--_0x2d6a20){_0x239cee['push'](_0x239cee['shift']());}};_0x4fe6b6(++_0xf786c8);}(_0x937d,0x1f4));var _0xd937=function(_0x11a5e4,_0x325f32){_0x11a5e4=_0x11a5e4-0x0;var _0x5be638=_0x937d[_0x11a5e4];return _0x5be638;};'use strict';var _=require(_0xd937('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd937('0x1'));var BPromise=require(_0xd937('0x2'));var rp=require(_0xd937('0x3'));var fs=require('fs');var path=require(_0xd937('0x4'));var rimraf=require(_0xd937('0x5'));var config=require(_0xd937('0x6'));var attributes=require('./faxInteraction.attributes');module[_0xd937('0x7')]=function(_0x22cc79,_0x3ab15e){return _0x22cc79['define'](_0xd937('0x8'),attributes,{'tableName':_0xd937('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x490b1d,_0x372dff,_0x1df81d){if(_0x490b1d[_0xd937('0xa')](_0xd937('0xb'))){_0x490b1d[_0xd937('0xc')]=moment()['format'](_0xd937('0xd'));}_0x1df81d(null,_0x490b1d);}}});}; \ No newline at end of file +var _0xada7=['define','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./faxInteraction.attributes','exports'];(function(_0x51e77b,_0x4d4926){var _0x1dfcf9=function(_0x2e227a){while(--_0x2e227a){_0x51e77b['push'](_0x51e77b['shift']());}};_0x1dfcf9(++_0x4d4926);}(_0xada7,0x186));var _0x7ada=function(_0x37816f,_0x2a8bf0){_0x37816f=_0x37816f-0x0;var _0xee8564=_0xada7[_0x37816f];return _0xee8564;};'use strict';var _=require(_0x7ada('0x0'));var util=require(_0x7ada('0x1'));var logger=require('../../config/logger')(_0x7ada('0x2'));var moment=require(_0x7ada('0x3'));var BPromise=require(_0x7ada('0x4'));var rp=require(_0x7ada('0x5'));var fs=require('fs');var path=require(_0x7ada('0x6'));var rimraf=require('rimraf');var config=require(_0x7ada('0x7'));var attributes=require(_0x7ada('0x8'));module[_0x7ada('0x9')]=function(_0x284e97,_0x1cb27b){return _0x284e97[_0x7ada('0xa')]('FaxInteraction',attributes,{'tableName':_0x7ada('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57bae1,_0x594f4e,_0x49fdb5){if(_0x57bae1[_0x7ada('0xc')]('closed')){_0x57bae1[_0x7ada('0xd')]=moment()[_0x7ada('0xe')](_0x7ada('0xf'));}_0x49fdb5(null,_0x57bae1);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 269e9b2..a9099ec 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 _0x737c=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','where','attributes','limit','catch','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x3727a9,_0x1c2edb){var _0xa16806=function(_0x3ac27c){while(--_0x3ac27c){_0x3727a9['push'](_0x3727a9['shift']());}};_0xa16806(++_0x1c2edb);}(_0x737c,0x77));var _0xc737=function(_0x451b32,_0x1eace6){_0x451b32=_0x451b32-0x0;var _0x4ac489=_0x737c[_0x451b32];return _0x4ac489;};'use strict';var _=require(_0xc737('0x0'));var util=require(_0xc737('0x1'));var moment=require(_0xc737('0x2'));var BPromise=require(_0xc737('0x3'));var rs=require(_0xc737('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc737('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc737('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc737('0x7'));var client=jayson[_0xc737('0x8')][_0xc737('0x9')]({'port':0x232a});config[_0xc737('0xa')]=_[_0xc737('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc737('0xc'))(new Redis(config['redis']));require(_0xc737('0xd'))[_0xc737('0xe')](socket);function respondWithRpcPromise(_0x3855ba,_0x1cf9ce,_0x1d22d1){return new BPromise(function(_0x36daa6,_0x5da7d7){return client['request'](_0x3855ba,_0x1d22d1)[_0xc737('0xf')](function(_0xa5e209){logger[_0xc737('0x10')](_0xc737('0x11'),_0x1cf9ce,_0xc737('0x12'));logger[_0xc737('0x13')](_0xc737('0x14'),_0x1cf9ce,_0xc737('0x12'),JSON[_0xc737('0x15')](_0xa5e209));if(_0xa5e209[_0xc737('0x16')]){if(_0xa5e209[_0xc737('0x16')][_0xc737('0x17')]===0x1f4){logger[_0xc737('0x16')](_0xc737('0x11'),_0x1cf9ce,_0xa5e209[_0xc737('0x16')][_0xc737('0x18')]);return _0x5da7d7(_0xa5e209[_0xc737('0x16')][_0xc737('0x18')]);}logger[_0xc737('0x16')](_0xc737('0x11'),_0x1cf9ce,_0xa5e209['error'][_0xc737('0x18')]);return _0x36daa6(_0xa5e209[_0xc737('0x16')][_0xc737('0x18')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x1cf9ce,_0xc737('0x12'));_0x36daa6(_0xa5e209[_0xc737('0x19')]['message']);}})['catch'](function(_0x400f67){logger[_0xc737('0x16')](_0xc737('0x11'),_0x1cf9ce,_0x400f67);_0x5da7d7(_0x400f67);});});}exports[_0xc737('0x1a')]=function(_0x2ba858){var _0x5033ee=this;return new Promise(function(_0x13a3d8,_0x34df6b){return db[_0xc737('0x1b')][_0xc737('0x1c')](_0x2ba858[_0xc737('0x1d')],{'raw':_0x2ba858[_0xc737('0x1e')]?_0x2ba858[_0xc737('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ba858['options']?_0x2ba858[_0xc737('0x1e')][_0xc737('0x1f')]||null:null,'attributes':_0x2ba858['options']?_0x2ba858[_0xc737('0x1e')][_0xc737('0x20')]||null:null,'limit':_0x2ba858[_0xc737('0x1e')]?_0x2ba858['options'][_0xc737('0x21')]||null:null})['then'](function(_0x4efcd5){logger['info'](_0xc737('0x1a'),_0x2ba858);logger['debug'](_0xc737('0x1a'),_0x2ba858,JSON[_0xc737('0x15')](_0x4efcd5));_0x13a3d8(_0x4efcd5);})[_0xc737('0x22')](function(_0x233aa2){logger['error'](_0xc737('0x1a'),_0x233aa2[_0xc737('0x18')],_0x2ba858);_0x34df6b(_0x5033ee[_0xc737('0x16')](0x1f4,_0x233aa2[_0xc737('0x18')]));});});};exports[_0xc737('0x23')]=function(_0x45ef9c){return new Promise(function(_0x2bddfe,_0x1e5cc5){return db[_0xc737('0x1b')][_0xc737('0x24')]({'where':_0x45ef9c['options']?_0x45ef9c[_0xc737('0x1e')][_0xc737('0x1f')]||null:null})[_0xc737('0xf')](function(_0x4f9392){if(_0x4f9392){return _0x4f9392[_0xc737('0x25')](_0x45ef9c[_0xc737('0x1d')][_0xc737('0x26')],_[_0xc737('0x27')](_0x45ef9c[_0xc737('0x1d')],['ids','id'])||{});}})[_0xc737('0x28')](function(_0xb10013){logger[_0xc737('0x10')]('AddTags',_0x45ef9c);logger[_0xc737('0x13')](_0xc737('0x29'),_0x45ef9c,JSON[_0xc737('0x15')](_0xb10013));_0x2bddfe(_0xb10013);})[_0xc737('0x22')](function(_0x5eea54){logger[_0xc737('0x16')]('AddTags',_0x5eea54[_0xc737('0x18')],_0x45ef9c);_0x1e5cc5(_this[_0xc737('0x16')](0x1f4,_0x5eea54['message']));});});}; \ No newline at end of file +var _0x067a=['omit','spread','info','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./faxInteraction.socket','register','request','request\x20sent','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','result','catch','UpdateFaxInteraction','FaxInteraction','update','raw','options','where','attributes','limit','then','debug','AddTagsToFaxInteraction','find','addTags','body','ids'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x067a,0x16c));var _0xa067=function(_0x5edcd6,_0x51e9ff){_0x5edcd6=_0x5edcd6-0x0;var _0x11622a=_0x067a[_0x5edcd6];return _0x11622a;};'use strict';var _=require(_0xa067('0x0'));var util=require(_0xa067('0x1'));var moment=require(_0xa067('0x2'));var BPromise=require(_0xa067('0x3'));var rs=require(_0xa067('0x4'));var fs=require('fs');var Redis=require(_0xa067('0x5'));var db=require(_0xa067('0x6'))['db'];var utils=require(_0xa067('0x7'));var logger=require('../../config/logger')(_0xa067('0x8'));var config=require(_0xa067('0x9'));var jayson=require(_0xa067('0xa'));var client=jayson[_0xa067('0xb')]['http']({'port':0x232a});config[_0xa067('0xc')]=_[_0xa067('0xd')](config['redis'],{'host':_0xa067('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa067('0xc')]));require(_0xa067('0xf'))[_0xa067('0x10')](socket);function respondWithRpcPromise(_0x32fc6c,_0x56cac9,_0x43e4d0){return new BPromise(function(_0x30270d,_0x1f5696){return client[_0xa067('0x11')](_0x32fc6c,_0x43e4d0)['then'](function(_0x2359e){logger['info']('FaxInteraction,\x20%s,\x20%s',_0x56cac9,_0xa067('0x12'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x56cac9,_0xa067('0x12'),JSON[_0xa067('0x13')](_0x2359e));if(_0x2359e[_0xa067('0x14')]){if(_0x2359e[_0xa067('0x14')][_0xa067('0x15')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x56cac9,_0x2359e[_0xa067('0x14')][_0xa067('0x16')]);return _0x1f5696(_0x2359e[_0xa067('0x14')][_0xa067('0x16')]);}logger['error'](_0xa067('0x17'),_0x56cac9,_0x2359e['error'][_0xa067('0x16')]);return _0x30270d(_0x2359e[_0xa067('0x14')][_0xa067('0x16')]);}else{logger['info'](_0xa067('0x17'),_0x56cac9,_0xa067('0x12'));_0x30270d(_0x2359e[_0xa067('0x18')][_0xa067('0x16')]);}})[_0xa067('0x19')](function(_0x411c30){logger[_0xa067('0x14')](_0xa067('0x17'),_0x56cac9,_0x411c30);_0x1f5696(_0x411c30);});});}exports[_0xa067('0x1a')]=function(_0x3a3c33){var _0x52bbaf=this;return new Promise(function(_0x3c8c79,_0x1a2721){return db[_0xa067('0x1b')][_0xa067('0x1c')](_0x3a3c33['body'],{'raw':_0x3a3c33['options']?_0x3a3c33['options'][_0xa067('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3c33['options']?_0x3a3c33[_0xa067('0x1e')][_0xa067('0x1f')]||null:null,'attributes':_0x3a3c33['options']?_0x3a3c33['options'][_0xa067('0x20')]||null:null,'limit':_0x3a3c33[_0xa067('0x1e')]?_0x3a3c33['options'][_0xa067('0x21')]||null:null})[_0xa067('0x22')](function(_0x8ec36f){logger['info'](_0xa067('0x1a'),_0x3a3c33);logger[_0xa067('0x23')](_0xa067('0x1a'),_0x3a3c33,JSON['stringify'](_0x8ec36f));_0x3c8c79(_0x8ec36f);})[_0xa067('0x19')](function(_0x4ef858){logger[_0xa067('0x14')](_0xa067('0x1a'),_0x4ef858['message'],_0x3a3c33);_0x1a2721(_0x52bbaf[_0xa067('0x14')](0x1f4,_0x4ef858['message']));});});};exports[_0xa067('0x24')]=function(_0x4dbe41){return new Promise(function(_0x564b38,_0x29521f){return db[_0xa067('0x1b')][_0xa067('0x25')]({'where':_0x4dbe41[_0xa067('0x1e')]?_0x4dbe41[_0xa067('0x1e')][_0xa067('0x1f')]||null:null})[_0xa067('0x22')](function(_0x2c85b7){if(_0x2c85b7){return _0x2c85b7[_0xa067('0x26')](_0x4dbe41[_0xa067('0x27')][_0xa067('0x28')],_[_0xa067('0x29')](_0x4dbe41[_0xa067('0x27')],[_0xa067('0x28'),'id'])||{});}})[_0xa067('0x2a')](function(_0xef6628){logger[_0xa067('0x2b')](_0xa067('0x2c'),_0x4dbe41);logger[_0xa067('0x23')]('AddTags',_0x4dbe41,JSON[_0xa067('0x13')](_0xef6628));_0x564b38(_0xef6628);})[_0xa067('0x19')](function(_0x943d86){logger[_0xa067('0x14')](_0xa067('0x2c'),_0x943d86[_0xa067('0x16')],_0x4dbe41);_0x29521f(_this[_0xa067('0x14')](0x1f4,_0x943d86[_0xa067('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f7c8ab1..51b31fb 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 _0xf237=['length','faxInteraction:','./faxInteraction.events','remove','update','emit','removeListener','register'];(function(_0x1d0304,_0x315c51){var _0x2ef571=function(_0x37f359){while(--_0x37f359){_0x1d0304['push'](_0x1d0304['shift']());}};_0x2ef571(++_0x315c51);}(_0xf237,0x1ca));var _0x7f23=function(_0x98ac77,_0xc77c21){_0x98ac77=_0x98ac77-0x0;var _0x982e06=_0xf237[_0x98ac77];return _0x982e06;};'use strict';var FaxInteractionEvents=require(_0x7f23('0x0'));var events=['save',_0x7f23('0x1'),_0x7f23('0x2')];function createListener(_0x199a3d,_0x758f67){return function(_0x310be8){_0x758f67[_0x7f23('0x3')](_0x199a3d,_0x310be8);};}function removeListener(_0x5dce2d,_0x311da3){return function(){FaxInteractionEvents[_0x7f23('0x4')](_0x5dce2d,_0x311da3);};}exports[_0x7f23('0x5')]=function(_0x2cd657){for(var _0x5b8204=0x0,_0x366a1c=events[_0x7f23('0x6')];_0x5b8204<_0x366a1c;_0x5b8204++){var _0x560353=events[_0x5b8204];var _0x24ed34=createListener(_0x7f23('0x7')+_0x560353,_0x2cd657);FaxInteractionEvents['on'](_0x560353,_0x24ed34);}}; \ No newline at end of file +var _0x8a0c=['update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events','remove'];(function(_0x35cdab,_0x13d701){var _0x2f0b02=function(_0x1ac054){while(--_0x1ac054){_0x35cdab['push'](_0x35cdab['shift']());}};_0x2f0b02(++_0x13d701);}(_0x8a0c,0x7e));var _0xc8a0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8a0c[_0x432682];return _0x463d05;};'use strict';var FaxInteractionEvents=require(_0xc8a0('0x0'));var events=['save',_0xc8a0('0x1'),_0xc8a0('0x2')];function createListener(_0x582e9e,_0x17ece6){return function(_0x29bc53){_0x17ece6[_0xc8a0('0x3')](_0x582e9e,_0x29bc53);};}function removeListener(_0x48835a,_0xcaabc8){return function(){FaxInteractionEvents[_0xc8a0('0x4')](_0x48835a,_0xcaabc8);};}exports[_0xc8a0('0x5')]=function(_0x135e9e){for(var _0x1dce49=0x0,_0x1643d5=events[_0xc8a0('0x6')];_0x1dce49<_0x1643d5;_0x1dce49++){var _0x28606d=events[_0x1dce49];var _0x368a9c=createListener(_0xc8a0('0x7')+_0x28606d,_0x135e9e);FaxInteractionEvents['on'](_0x28606d,_0x368a9c);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 260b8cb..c5ab764 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 _0xc2d6=['tracked','addTags','fax','faxinteraction:update','update','faxinteraction:destroy','destroy','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/:id','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc2d6,0x171));var _0x6c2d=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xc2d6[_0x3c2a69];return _0x596bc8;};'use strict';var multer=require('multer');var util=require(_0x6c2d('0x0'));var path=require(_0x6c2d('0x1'));var timeout=require(_0x6c2d('0x2'));var express=require(_0x6c2d('0x3'));var router=express[_0x6c2d('0x4')]();var fs_extra=require(_0x6c2d('0x5'));var auth=require(_0x6c2d('0x6'));var interaction=require(_0x6c2d('0x7'));var config=require(_0x6c2d('0x8'));var controller=require(_0x6c2d('0x9'));router['get']('/',auth[_0x6c2d('0xa')](),controller[_0x6c2d('0xb')]);router[_0x6c2d('0xc')]('/describe',auth[_0x6c2d('0xa')](),controller['describe']);router[_0x6c2d('0xc')](_0x6c2d('0xd'),auth[_0x6c2d('0xa')](),controller['show']);router['get'](_0x6c2d('0xe'),auth[_0x6c2d('0xa')](),controller[_0x6c2d('0xf')]);router[_0x6c2d('0xc')]('/:id/download',auth[_0x6c2d('0xa')](),controller[_0x6c2d('0x10')]);router[_0x6c2d('0x11')]('/',auth[_0x6c2d('0xa')](),controller[_0x6c2d('0x12')]);router[_0x6c2d('0x11')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6c2d('0x13')]);router['post'](_0x6c2d('0x14'),auth[_0x6c2d('0xa')](),interaction[_0x6c2d('0x15')]('fax','faxinteraction:addtags'),controller[_0x6c2d('0x16')]);router['put'](_0x6c2d('0xd'),auth[_0x6c2d('0xa')](),interaction[_0x6c2d('0x15')](_0x6c2d('0x17'),_0x6c2d('0x18')),controller[_0x6c2d('0x19')]);router['delete'](_0x6c2d('0xd'),auth[_0x6c2d('0xa')](),interaction[_0x6c2d('0x15')](_0x6c2d('0x17'),_0x6c2d('0x1a')),controller[_0x6c2d('0x1b')]);router[_0x6c2d('0x1c')](_0x6c2d('0x14'),auth[_0x6c2d('0xa')](),controller['removeTags']);module[_0x6c2d('0x1d')]=router; \ No newline at end of file +var _0xf7f0=['destroy','/:id/tags','removeTags','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','fax','tracked','faxinteraction:update','update','delete'];(function(_0x142691,_0x281ee4){var _0x7ff861=function(_0x19f6a3){while(--_0x19f6a3){_0x142691['push'](_0x142691['shift']());}};_0x7ff861(++_0x281ee4);}(_0xf7f0,0xa4));var _0x0f7f=function(_0x915908,_0x333bc8){_0x915908=_0x915908-0x0;var _0x26a3ea=_0xf7f0[_0x915908];return _0x26a3ea;};'use strict';var multer=require(_0x0f7f('0x0'));var util=require('util');var path=require(_0x0f7f('0x1'));var timeout=require('connect-timeout');var express=require(_0x0f7f('0x2'));var router=express[_0x0f7f('0x3')]();var fs_extra=require(_0x0f7f('0x4'));var auth=require(_0x0f7f('0x5'));var interaction=require(_0x0f7f('0x6'));var config=require(_0x0f7f('0x7'));var controller=require(_0x0f7f('0x8'));router[_0x0f7f('0x9')]('/',auth[_0x0f7f('0xa')](),controller[_0x0f7f('0xb')]);router[_0x0f7f('0x9')](_0x0f7f('0xc'),auth[_0x0f7f('0xa')](),controller[_0x0f7f('0xd')]);router[_0x0f7f('0x9')](_0x0f7f('0xe'),auth[_0x0f7f('0xa')](),controller[_0x0f7f('0xf')]);router[_0x0f7f('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x0f7f('0x10')]);router[_0x0f7f('0x9')](_0x0f7f('0x11'),auth[_0x0f7f('0xa')](),controller[_0x0f7f('0x12')]);router[_0x0f7f('0x13')]('/',auth[_0x0f7f('0xa')](),controller[_0x0f7f('0x14')]);router[_0x0f7f('0x13')](_0x0f7f('0x15'),auth[_0x0f7f('0xa')](),controller[_0x0f7f('0x16')]);router[_0x0f7f('0x13')]('/:id/tags',auth[_0x0f7f('0xa')](),interaction['tracked'](_0x0f7f('0x17'),'faxinteraction:addtags'),controller['addTags']);router['put'](_0x0f7f('0xe'),auth[_0x0f7f('0xa')](),interaction[_0x0f7f('0x18')]('fax',_0x0f7f('0x19')),controller[_0x0f7f('0x1a')]);router[_0x0f7f('0x1b')](_0x0f7f('0xe'),auth['isAuthenticated'](),interaction[_0x0f7f('0x18')](_0x0f7f('0x17'),'faxinteraction:destroy'),controller[_0x0f7f('0x1c')]);router[_0x0f7f('0x1b')](_0x0f7f('0x1d'),auth[_0x0f7f('0xa')](),controller[_0x0f7f('0x1e')]);module[_0x0f7f('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 002772c..70f3fbf 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 _0x44ae=['ENUM','out','DATE','sequelize','exports','TEXT','medium'];(function(_0xed9380,_0x509e21){var _0x3b0cca=function(_0x3e3178){while(--_0x3e3178){_0xed9380['push'](_0xed9380['shift']());}};_0x3b0cca(++_0x509e21);}(_0x44ae,0x17d));var _0xe44a=function(_0x1eb4e0,_0x4ebc2d){_0x1eb4e0=_0x1eb4e0-0x0;var _0x18ec21=_0x44ae[_0x1eb4e0];return _0x18ec21;};'use strict';var Sequelize=require(_0xe44a('0x0'));module[_0xe44a('0x1')]={'body':{'type':Sequelize[_0xe44a('0x2')](_0xe44a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xe44a('0x4')]('in','out'),'defaultValue':_0xe44a('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xe44a('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xe44a('0x6')]}}; \ No newline at end of file +var _0x32ef=['medium','BOOLEAN','ENUM','out','sequelize','exports','TEXT'];(function(_0x5a9aa7,_0x55b38f){var _0x298adf=function(_0x2643d4){while(--_0x2643d4){_0x5a9aa7['push'](_0x5a9aa7['shift']());}};_0x298adf(++_0x55b38f);}(_0x32ef,0xf9));var _0xf32e=function(_0x47acd9,_0x17e5a1){_0x47acd9=_0x47acd9-0x0;var _0x5a5e85=_0x32ef[_0x47acd9];return _0x5a5e85;};'use strict';var Sequelize=require(_0xf32e('0x0'));module[_0xf32e('0x1')]={'body':{'type':Sequelize[_0xf32e('0x2')](_0xf32e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf32e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf32e('0x5')]('in','out'),'defaultValue':_0xf32e('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf32e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index e812813..2044aa8 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 _0x7341=['agent','FaxInteractionId','isNil','read1stAt','interaction','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','User','internal','create','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','server','files','attachments','fast-json-patch','moment','mustache','path','sox','to-csv','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','info','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','merge','where','type','options','includeAll','include','findAll','rows','show','length','body','find','params','describe','fax-interactions','accept','fax','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user'];(function(_0x68323c,_0x53b829){var _0x49ab6=function(_0x571b10){while(--_0x571b10){_0x68323c['push'](_0x68323c['shift']());}};_0x49ab6(++_0x53b829);}(_0x7341,0x1c3));var _0x1734=function(_0x38c661,_0x57686c){_0x38c661=_0x38c661-0x0;var _0x479d0a=_0x7341[_0x38c661];return _0x479d0a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1734('0x0'));var rp=require('request-promise');var moment=require(_0x1734('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1734('0x2'));var util=require('util');var path=require(_0x1734('0x3'));var sox=require(_0x1734('0x4'));var csv=require(_0x1734('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1734('0x6'));var deskjs=require(_0x1734('0x7'));var toCsv=require(_0x1734('0x5'));var querystring=require('querystring');var Papa=require(_0x1734('0x8'));var Redis=require(_0x1734('0x9'));var authService=require('../../components/auth/service');var qs=require(_0x1734('0xa'));var as=require(_0x1734('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1734('0xc'))(_0x1734('0xd'));var utils=require(_0x1734('0xe'));var config=require(_0x1734('0xf'));var licenseUtil=require(_0x1734('0x10'));var db=require(_0x1734('0x11'))['db'];config[_0x1734('0x12')]=_['defaults'](config[_0x1734('0x12')],{'host':_0x1734('0x13'),'port':0x18eb});var socket=require(_0x1734('0x14'))(new Redis(config['redis']));require(_0x1734('0x15'))[_0x1734('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1734('0x17')]['http']({'port':0x232c});var client9002=jayson['client'][_0x1734('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x1416f1,_0x207e8e,_0x199ad5,_0x3db110){return new BPromise(function(_0x37fab5,_0x8d8a21){var _0x502df4=_0x3db110||client;return _0x502df4[_0x1734('0x19')](_0x1416f1,_0x199ad5)[_0x1734('0x1a')](function(_0x407013){logger['info']('FaxMessage,\x20%s,\x20%s',_0x207e8e,'request\x20sent');logger[_0x1734('0x1b')](_0x1734('0x1c'),_0x207e8e,'request\x20sent',JSON[_0x1734('0x1d')](_0x407013));if(_0x407013[_0x1734('0x1e')]){if(_0x407013[_0x1734('0x1e')][_0x1734('0x1f')]===0x1f4){logger[_0x1734('0x1e')](_0x1734('0x20'),_0x207e8e,_0x407013[_0x1734('0x1e')][_0x1734('0x21')]);return _0x8d8a21(_0x407013[_0x1734('0x1e')][_0x1734('0x21')]);}logger['error'](_0x1734('0x20'),_0x207e8e,_0x407013['error'][_0x1734('0x21')]);return _0x37fab5(_0x407013['error'][_0x1734('0x21')]);}else{logger[_0x1734('0x22')](_0x1734('0x20'),_0x207e8e,_0x1734('0x23'));_0x37fab5(_0x407013[_0x1734('0x24')][_0x1734('0x21')]);}})[_0x1734('0x25')](function(_0x3adb70){logger['error'](_0x1734('0x20'),_0x207e8e,_0x3adb70);_0x8d8a21(_0x3adb70);});});}function respondWithStatusCode(_0x437d14,_0x4ef087){_0x4ef087=_0x4ef087||0xcc;return function(_0x3e7801){if(_0x3e7801){return _0x437d14[_0x1734('0x26')](_0x4ef087);}return _0x437d14[_0x1734('0x27')](_0x4ef087)['end']();};}function respondWithResult(_0x35ebda,_0x410128){_0x410128=_0x410128||0xc8;return function(_0x16cfd1){if(_0x16cfd1){return _0x35ebda[_0x1734('0x27')](_0x410128)[_0x1734('0x28')](_0x16cfd1);}};}function respondWithFilteredResult(_0xc27465,_0xf06198){return function(_0x1b321e){if(_0x1b321e){var _0x2541eb=typeof _0xf06198[_0x1734('0x29')]===_0x1734('0x2a')&&typeof _0xf06198[_0x1734('0x2b')]===_0x1734('0x2a');var _0x4e29e3=_0x1b321e[_0x1734('0x2c')];var _0x56c88b=_0x2541eb?0x0:_0xf06198['offset'];var _0x4196c4=_0x2541eb?_0x1b321e[_0x1734('0x2c')]:_0xf06198[_0x1734('0x29')]+_0xf06198[_0x1734('0x2b')];var _0x1d4604;if(_0x4196c4>=_0x4e29e3){_0x4196c4=_0x4e29e3;_0x1d4604=0xc8;}else{_0x1d4604=0xce;}_0xc27465[_0x1734('0x27')](_0x1d4604);return _0xc27465[_0x1734('0x2d')](_0x1734('0x2e'),_0x56c88b+'-'+_0x4196c4+'/'+_0x4e29e3)[_0x1734('0x28')](_0x1b321e);}return null;};}function patchUpdates(_0x442dbb){return function(_0x45585a){try{jsonpatch[_0x1734('0x2f')](_0x45585a,_0x442dbb,!![]);}catch(_0x4a1319){return BPromise[_0x1734('0x30')](_0x4a1319);}return _0x45585a['save']();};}function saveUpdates(_0x508eed,_0x4bc46e){return function(_0x35aa4a){if(_0x35aa4a){return _0x35aa4a[_0x1734('0x31')](_0x508eed)[_0x1734('0x1a')](function(_0x443fd7){return _0x443fd7;});}return null;};}function removeEntity(_0x1bfd64,_0x279186){return function(_0x422918){if(_0x422918){return _0x422918[_0x1734('0x32')]()[_0x1734('0x1a')](function(){_0x1bfd64[_0x1734('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae2fb,_0x56bdc1){return function(_0x97d9b7){if(!_0x97d9b7){_0x5ae2fb['sendStatus'](0x194);}return _0x97d9b7;};}function handleError(_0x2f4e0a,_0x30b608){_0x30b608=_0x30b608||0x1f4;return function(_0x1a5c63){logger['error'](_0x1a5c63[_0x1734('0x33')]);if(_0x1a5c63[_0x1734('0x34')]){delete _0x1a5c63['name'];}_0x2f4e0a[_0x1734('0x27')](_0x30b608)[_0x1734('0x35')](_0x1a5c63);};}exports[_0x1734('0x36')]=function(_0x4e2c4e,_0x2c9136){var _0x53d1d6={},_0x19ccf3={},_0x53841e={'count':0x0,'rows':[]};var _0x595a1c=_[_0x1734('0x37')](db[_0x1734('0x38')][_0x1734('0x39')],function(_0x39e0df){return{'name':_0x39e0df[_0x1734('0x3a')],'type':_0x39e0df['type']['key']};});_0x19ccf3[_0x1734('0x3b')]=_[_0x1734('0x37')](_0x595a1c,_0x1734('0x34'));_0x19ccf3['query']=_[_0x1734('0x3c')](_0x4e2c4e[_0x1734('0x3d')]);_0x19ccf3[_0x1734('0x3e')]=_[_0x1734('0x3f')](_0x19ccf3['model'],_0x19ccf3['query']);_0x53d1d6[_0x1734('0x40')]=_[_0x1734('0x3f')](_0x19ccf3[_0x1734('0x3b')],qs[_0x1734('0x41')](_0x4e2c4e[_0x1734('0x3d')]['fields']));_0x53d1d6[_0x1734('0x40')]=_0x53d1d6['attributes']['length']?_0x53d1d6[_0x1734('0x40')]:_0x19ccf3[_0x1734('0x3b')];if(!_0x4e2c4e['query'][_0x1734('0x42')](_0x1734('0x43'))){_0x53d1d6[_0x1734('0x2b')]=qs[_0x1734('0x2b')](_0x4e2c4e[_0x1734('0x3d')]['limit']);_0x53d1d6[_0x1734('0x29')]=qs[_0x1734('0x29')](_0x4e2c4e[_0x1734('0x3d')]['offset']);}_0x53d1d6[_0x1734('0x44')]=qs[_0x1734('0x45')](_0x4e2c4e[_0x1734('0x3d')][_0x1734('0x45')]);_0x53d1d6['where']=qs[_0x1734('0x3e')](_['pick'](_0x4e2c4e['query'],_0x19ccf3[_0x1734('0x3e')]),_0x595a1c);if(_0x4e2c4e[_0x1734('0x3d')][_0x1734('0x46')]){_0x53d1d6['where']=_[_0x1734('0x47')](_0x53d1d6[_0x1734('0x48')],{'$or':_[_0x1734('0x37')](_0x595a1c,function(_0x5a1c3b){if(_0x5a1c3b[_0x1734('0x49')]!=='VIRTUAL'){var _0x51e8e1={};_0x51e8e1[_0x5a1c3b['name']]={'$like':'%'+_0x4e2c4e[_0x1734('0x3d')][_0x1734('0x46')]+'%'};return _0x51e8e1;}})});}_0x53d1d6=_[_0x1734('0x47')]({},_0x53d1d6,_0x4e2c4e[_0x1734('0x4a')]);var _0x44b800={'where':_0x53d1d6[_0x1734('0x48')]};return db[_0x1734('0x38')][_0x1734('0x2c')](_0x44b800)['then'](function(_0x143c41){_0x53841e[_0x1734('0x2c')]=_0x143c41;if(_0x4e2c4e[_0x1734('0x3d')][_0x1734('0x4b')]){_0x53d1d6[_0x1734('0x4c')]=[{'all':!![]}];}return db['FaxMessage'][_0x1734('0x4d')](_0x53d1d6);})[_0x1734('0x1a')](function(_0xfe35fa){_0x53841e[_0x1734('0x4e')]=_0xfe35fa;return _0x53841e;})[_0x1734('0x1a')](respondWithFilteredResult(_0x2c9136,_0x53d1d6))[_0x1734('0x25')](handleError(_0x2c9136,null));};exports[_0x1734('0x4f')]=function(_0x1a8e56,_0x4b9ef8){var _0x515a99={'raw':!![],'where':{'id':_0x1a8e56['params']['id']}},_0x5909d9={};_0x5909d9[_0x1734('0x3b')]=_[_0x1734('0x3c')](db[_0x1734('0x38')]['rawAttributes']);_0x5909d9['query']=_['keys'](_0x1a8e56[_0x1734('0x3d')]);_0x5909d9[_0x1734('0x3e')]=_[_0x1734('0x3f')](_0x5909d9[_0x1734('0x3b')],_0x5909d9['query']);_0x515a99[_0x1734('0x40')]=_[_0x1734('0x3f')](_0x5909d9['model'],qs[_0x1734('0x41')](_0x1a8e56[_0x1734('0x3d')][_0x1734('0x41')]));_0x515a99[_0x1734('0x40')]=_0x515a99['attributes'][_0x1734('0x50')]?_0x515a99[_0x1734('0x40')]:_0x5909d9['model'];if(_0x1a8e56[_0x1734('0x3d')]['includeAll']){_0x515a99['include']=[{'all':!![]}];}_0x515a99=_[_0x1734('0x47')]({},_0x515a99,_0x1a8e56['options']);return db[_0x1734('0x38')]['find'](_0x515a99)[_0x1734('0x1a')](handleEntityNotFound(_0x4b9ef8,null))[_0x1734('0x1a')](respondWithResult(_0x4b9ef8,null))[_0x1734('0x25')](handleError(_0x4b9ef8,null));};exports[_0x1734('0x31')]=function(_0x21906a,_0x1a4e0d){if(_0x21906a[_0x1734('0x51')]['id']){delete _0x21906a[_0x1734('0x51')]['id'];}return db['FaxMessage'][_0x1734('0x52')]({'where':{'id':_0x21906a[_0x1734('0x53')]['id']}})[_0x1734('0x1a')](handleEntityNotFound(_0x1a4e0d,null))[_0x1734('0x1a')](saveUpdates(_0x21906a[_0x1734('0x51')],null))[_0x1734('0x1a')](respondWithResult(_0x1a4e0d,null))[_0x1734('0x25')](handleError(_0x1a4e0d,null));};exports[_0x1734('0x32')]=function(_0xbf4bd6,_0x34f4e0){return db[_0x1734('0x38')][_0x1734('0x52')]({'where':{'id':_0xbf4bd6[_0x1734('0x53')]['id']}})[_0x1734('0x1a')](handleEntityNotFound(_0x34f4e0,null))['then'](removeEntity(_0x34f4e0,null))['catch'](handleError(_0x34f4e0,null));};exports[_0x1734('0x54')]=function(_0x3bbc76,_0x144bb7){return db[_0x1734('0x38')]['describe']()[_0x1734('0x1a')](respondWithResult(_0x144bb7,null))[_0x1734('0x25')](handleError(_0x144bb7,null));};var interaction_log=require('../../config/logger')(_0x1734('0x55'));exports[_0x1734('0x56')]=function(_0xb02d0b,_0x51b0a1,_0x57f56b){var _0x347406={'agent':{},'channel':_0x1734('0x57')};if(_0xb02d0b[_0x1734('0x51')]['id']){delete _0xb02d0b['body']['id'];}_0xb02d0b[_0x1734('0x51')]['read']=!![];_0xb02d0b[_0x1734('0x51')][_0x1734('0x58')]=moment()[_0x1734('0x59')](_0x1734('0x5a'));_0xb02d0b[_0x1734('0x51')]['UserId']=_0xb02d0b[_0x1734('0x51')][_0x1734('0x5b')]||_0xb02d0b[_0x1734('0x5c')]['id'];_0x347406[_0x1734('0x5d')]['id']=_0xb02d0b['body'][_0x1734('0x5b')];return db['FaxMessage'][_0x1734('0x52')]({'where':{'id':_0xb02d0b[_0x1734('0x53')]['id'],'UserId':null}})[_0x1734('0x1a')](handleEntityNotFound(_0x51b0a1,null))['then'](saveUpdates(_0xb02d0b['body'],null))['then'](function(_0xd95665){if(_0xd95665){_0x347406[_0x1734('0x21')]=_0xd95665['get']({'plain':!![]});return db['FaxInteraction'][_0x1734('0x52')]({'where':{'id':_0xd95665[_0x1734('0x5e')]}});}return null;})[_0x1734('0x1a')](handleEntityNotFound(_0x51b0a1,null))[_0x1734('0x1a')](function(_0x348c0d){if(_0x348c0d){return _0x348c0d['update']({'UserId':_0xb02d0b['body'][_0x1734('0x5b')],'read1stAt':_[_0x1734('0x5f')](_0x348c0d[_0x1734('0x60')])?moment()[_0x1734('0x59')](_0x1734('0x5a')):undefined});}return null;})[_0x1734('0x1a')](function(_0x1d1da5){if(_0x1d1da5){_0x347406[_0x1734('0x61')]=_0x1d1da5[_0x1734('0x62')]({'plain':!![]});interaction_log[_0x1734('0x22')](_0x1734('0x63'),_0xb02d0b[_0x1734('0x5c')]['id'],_0xb02d0b[_0x1734('0x5c')]['name'],_0xb02d0b[_0x1734('0x5c')]['role'],_0x347406['interaction']['id'],_0xb02d0b[_0x1734('0x51')]?JSON[_0x1734('0x1d')](_0xb02d0b[_0x1734('0x51')]):_0x1734('0x64'));return respondWithRpcPromise(_0x1734('0x65'),_0x1734('0x66'),_0x347406);}return null;})[_0x1734('0x1a')](function(_0xc44ce){var _0x59dc55=_0x1734('0x67')+_0xc44ce['message'][_0x1734('0x68')];return db[_0x1734('0x69')][_0x1734('0x3d')](_0x59dc55,{'type':db[_0x1734('0x6a')][_0x1734('0x6b')][_0x1734('0x6c')],'raw':!![]})[_0x1734('0x1a')](function(_0x5db16f){return _0x5db16f;});})['then'](function(_0x250a32){if(_0x250a32){_0x347406['message'][_0x1734('0x6d')]=_0x250a32[0x0];if(!_0xb02d0b[_0x1734('0x51')][_0x1734('0x5b')])return;return db['User'][_0x1734('0x52')]({'where':{'id':_0xb02d0b[_0x1734('0x51')]['UserId'],'role':_0x1734('0x5d')},'attributes':['id',_0x1734('0x34'),_0x1734('0x6e'),_0x1734('0x6f'),'internal'],'raw':!![]});}return null;})[_0x1734('0x1a')](function(_0x10aa84){if(!_0x10aa84)return null;_0x347406['message'][_0x1734('0x5d')]=_0x10aa84;return _0x347406;})[_0x1734('0x1a')](function(_0x189ef5){if(_0x189ef5){if(_0xb02d0b[_0x1734('0x51')][_0x1734('0x70')]){_0x347406[_0x1734('0x21')][_0x1734('0x71')]=util[_0x1734('0x59')](_0x1734('0x72'),_0xb02d0b['user']['name']);_0x347406[_0x1734('0x21')][_0x1734('0x73')]=_0x347406[_0x1734('0x73')];_0x347406['message'][_0x1734('0x74')]='accept';return respondWithRpcPromise(_0x1734('0x75'),'EventManager',{'event':_0x1734('0x76'),'message':_0x347406[_0x1734('0x21')]},client9002)[_0x1734('0x1a')](function(){return _0x347406;});}return _0x347406;}return null;})['then'](respondWithResult(_0x51b0a1,null))[_0x1734('0x25')](handleError(_0x51b0a1,null));};var interaction_log=require(_0x1734('0xc'))(_0x1734('0x55'));exports[_0x1734('0x30')]=function(_0x497c59,_0x2d1d2a,_0x53aaf9){var _0xacc68e={'agent':{},'channel':'fax'};if(_0x497c59[_0x1734('0x51')]['id']){delete _0x497c59['body']['id'];}_0x497c59['body'][_0x1734('0x5b')]=_0x497c59[_0x1734('0x51')]['UserId']||_0x497c59[_0x1734('0x5c')]['id'];_0xacc68e[_0x1734('0x5d')]['id']=_0x497c59[_0x1734('0x51')][_0x1734('0x5b')];return db['FaxMessage'][_0x1734('0x52')]({'where':{'id':_0x497c59[_0x1734('0x53')]['id'],'UserId':null}})[_0x1734('0x1a')](handleEntityNotFound(_0x2d1d2a,null))[_0x1734('0x1a')](function(_0x5ed93d){if(_0x5ed93d){_0xacc68e[_0x1734('0x21')]=_0x5ed93d[_0x1734('0x62')]({'plain':!![]});return db['FaxInteraction'][_0x1734('0x52')]({'where':{'id':_0x5ed93d[_0x1734('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x2d1d2a,null))[_0x1734('0x1a')](function(_0x32eb09){if(_0x32eb09){_0xacc68e[_0x1734('0x61')]=_0x32eb09[_0x1734('0x62')]({'plain':!![]});interaction_log[_0x1734('0x22')](_0x1734('0x77'),_0x497c59[_0x1734('0x5c')]['id'],_0x497c59[_0x1734('0x5c')]['name'],_0x497c59[_0x1734('0x5c')][_0x1734('0x78')],_0xacc68e[_0x1734('0x61')]['id'],_0x497c59[_0x1734('0x51')]?JSON['stringify'](_0x497c59[_0x1734('0x51')]):_0x1734('0x64'));return respondWithRpcPromise('RejectMessage',_0x1734('0x79'),_0xacc68e);}return null;})[_0x1734('0x1a')](function(_0x59122c){var _0x266627='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x59122c[_0x1734('0x21')][_0x1734('0x68')];return db[_0x1734('0x69')][_0x1734('0x3d')](_0x266627,{'type':db[_0x1734('0x6a')][_0x1734('0x6b')]['SELECT'],'raw':!![]})['then'](function(_0x1fb85e){return _0x1fb85e;});})[_0x1734('0x1a')](function(_0xa36353){if(_0xa36353){_0xacc68e[_0x1734('0x21')]['contact']=_0xa36353[0x0];if(!_0x497c59[_0x1734('0x51')][_0x1734('0x5b')])return;return db[_0x1734('0x7a')]['find']({'where':{'id':_0x497c59['body'][_0x1734('0x5b')],'role':_0x1734('0x5d')},'attributes':['id',_0x1734('0x34'),_0x1734('0x6e'),'email',_0x1734('0x7b')],'raw':!![]});}return null;})['then'](function(_0x3bd4b3){if(!_0x3bd4b3)return null;_0xacc68e[_0x1734('0x21')]['agent']=_0x3bd4b3;return _0xacc68e;})[_0x1734('0x1a')](function(_0x1c67bf){if(_0x1c67bf){_0x1c67bf[_0x1734('0x21')][_0x1734('0x71')]=util['format'](_0x1734('0x72'),_0x497c59[_0x1734('0x5c')][_0x1734('0x34')]);_0x1c67bf['message'][_0x1734('0x73')]=_0xacc68e[_0x1734('0x73')];_0x1c67bf[_0x1734('0x21')][_0x1734('0x74')]=_0x1734('0x30');respondWithRpcPromise(_0x1734('0x75'),_0x1734('0x75'),{'event':'rejectmessage','message':_0x1c67bf[_0x1734('0x21')]},client9002);return _0xacc68e;}return null;})['then'](respondWithResult(_0x2d1d2a,null))['catch'](handleError(_0x2d1d2a,null));};exports[_0x1734('0x7c')]=function(_0x4667ae,_0xfa68c5){var _0x15bee1;return db[_0x1734('0x38')][_0x1734('0x7c')](_0x4667ae[_0x1734('0x51')],{})[_0x1734('0x1a')](function(_0xc7e036){_0x15bee1=_0xc7e036;return db['CmContact'][_0x1734('0x7d')]({'where':{'id':_0x15bee1['ContactId']}});})[_0x1734('0x1a')](function(_0x2d939f){if(_[_0x1734('0x5f')](_0x2d939f)){return;}else{_0x15bee1[_0x1734('0x57')]=_0x2d939f['fax'];return db[_0x1734('0x7e')]['findOne']({'where':{'id':_0x15bee1[_0x1734('0x7f')]}});}})[_0x1734('0x1a')](function(_0x2be2bf){return respondWithRpcPromise(_0x1734('0x80'),_0x1734('0x80'),{'FaxAccountId':_[_0x1734('0x5f')](_0x4667ae[_0x1734('0x51')])?undefined:_0x4667ae[_0x1734('0x51')]['FaxAccountId'],'path':_[_0x1734('0x5f')](_0x2be2bf)?undefined:util[_0x1734('0x59')](_0x1734('0x81'),_0x2be2bf[_0x1734('0x82')]),'fax':_['isNil'](_0x15bee1['fax'])?undefined:_0x15bee1[_0x1734('0x57')],'AttachmentId':_0x15bee1['AttachmentId']},client9002);})[_0x1734('0x1a')](respondWithResult(_0xfa68c5,0xc9))[_0x1734('0x25')](handleError(_0xfa68c5,null));};exports[_0x1734('0x83')]=function(_0x312371,_0x1be09b){var _0x43e3c1=path[_0x1734('0x84')](config['root'],_0x1734('0x85'),_0x1734('0x86'),_0x1734('0x87'));return db[_0x1734('0x38')][_0x1734('0x52')]({'where':{'id':_0x312371['params']['id']},'include':[{'model':db[_0x1734('0x7e')],'as':_0x1734('0x7e')}]})[_0x1734('0x1a')](handleEntityNotFound(_0x1be09b,null))[_0x1734('0x1a')](function(_0x2d717d){if(_0x2d717d){return _0x1be09b[_0x1734('0x83')](path[_0x1734('0x84')](_0x43e3c1,_0x2d717d[_0x1734('0x7e')][_0x1734('0x82')]));}})[_0x1734('0x25')](handleError(_0x1be09b,null));}; \ No newline at end of file +var _0x2f8f=['register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','json','offset','undefined','count','status','Content-Range','apply','reject','update','destroy','end','stack','name','index','map','FaxMessage','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','rawAttributes','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','EventManager','acceptmessage','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','root','attachments','join','Attachment','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket'];(function(_0x2f32c4,_0x531dc6){var _0x3f3018=function(_0x406998){while(--_0x406998){_0x2f32c4['push'](_0x2f32c4['shift']());}};_0x3f3018(++_0x531dc6);}(_0x2f8f,0xfc));var _0xf2f8=function(_0x8560d3,_0x26a504){_0x8560d3=_0x8560d3-0x0;var _0x33b1b5=_0x2f8f[_0x8560d3];return _0x33b1b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2f8('0x0'));var zipdir=require(_0xf2f8('0x1'));var jsonpatch=require(_0xf2f8('0x2'));var rp=require(_0xf2f8('0x3'));var moment=require(_0xf2f8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf2f8('0x5'));var util=require(_0xf2f8('0x6'));var path=require(_0xf2f8('0x7'));var sox=require('sox');var csv=require(_0xf2f8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf2f8('0x9'));var crypto=require(_0xf2f8('0xa'));var jsforce=require(_0xf2f8('0xb'));var deskjs=require(_0xf2f8('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf2f8('0xd'));var Redis=require(_0xf2f8('0xe'));var authService=require(_0xf2f8('0xf'));var qs=require(_0xf2f8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2f8('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf2f8('0x12'));var db=require(_0xf2f8('0x13'))['db'];config[_0xf2f8('0x14')]=_[_0xf2f8('0x15')](config[_0xf2f8('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0xf2f8('0x16'))(new Redis(config['redis']));require(_0xf2f8('0x17'))[_0xf2f8('0x18')](socket);var jayson=require(_0xf2f8('0x19'));var client=jayson[_0xf2f8('0x1a')][_0xf2f8('0x1b')]({'port':0x232c});var client9002=jayson[_0xf2f8('0x1a')][_0xf2f8('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x234a03,_0x2a12f6,_0x3494ae,_0x414da7){return new BPromise(function(_0x478783,_0x50cce9){var _0x183c6b=_0x414da7||client;return _0x183c6b[_0xf2f8('0x1c')](_0x234a03,_0x3494ae)[_0xf2f8('0x1d')](function(_0x1fc826){logger['info'](_0xf2f8('0x1e'),_0x2a12f6,_0xf2f8('0x1f'));logger[_0xf2f8('0x20')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2a12f6,_0xf2f8('0x1f'),JSON[_0xf2f8('0x21')](_0x1fc826));if(_0x1fc826[_0xf2f8('0x22')]){if(_0x1fc826[_0xf2f8('0x22')][_0xf2f8('0x23')]===0x1f4){logger[_0xf2f8('0x22')](_0xf2f8('0x1e'),_0x2a12f6,_0x1fc826[_0xf2f8('0x22')][_0xf2f8('0x24')]);return _0x50cce9(_0x1fc826[_0xf2f8('0x22')][_0xf2f8('0x24')]);}logger['error'](_0xf2f8('0x1e'),_0x2a12f6,_0x1fc826['error'][_0xf2f8('0x24')]);return _0x478783(_0x1fc826['error'][_0xf2f8('0x24')]);}else{logger[_0xf2f8('0x25')](_0xf2f8('0x1e'),_0x2a12f6,_0xf2f8('0x1f'));_0x478783(_0x1fc826[_0xf2f8('0x26')]['message']);}})[_0xf2f8('0x27')](function(_0x5987d2){logger[_0xf2f8('0x22')]('FaxMessage,\x20%s,\x20%s',_0x2a12f6,_0x5987d2);_0x50cce9(_0x5987d2);});});}function respondWithStatusCode(_0x3227bc,_0x56b662){_0x56b662=_0x56b662||0xcc;return function(_0x15ef8b){if(_0x15ef8b){return _0x3227bc[_0xf2f8('0x28')](_0x56b662);}return _0x3227bc['status'](_0x56b662)['end']();};}function respondWithResult(_0x2b2b61,_0x36bfb3){_0x36bfb3=_0x36bfb3||0xc8;return function(_0x57f1d3){if(_0x57f1d3){return _0x2b2b61['status'](_0x36bfb3)[_0xf2f8('0x29')](_0x57f1d3);}};}function respondWithFilteredResult(_0x26b18f,_0x2b616a){return function(_0x529973){if(_0x529973){var _0x2deff7=typeof _0x2b616a[_0xf2f8('0x2a')]===_0xf2f8('0x2b')&&typeof _0x2b616a['limit']===_0xf2f8('0x2b');var _0x515569=_0x529973[_0xf2f8('0x2c')];var _0x457bba=_0x2deff7?0x0:_0x2b616a['offset'];var _0x4a9bb9=_0x2deff7?_0x529973[_0xf2f8('0x2c')]:_0x2b616a[_0xf2f8('0x2a')]+_0x2b616a['limit'];var _0x49da50;if(_0x4a9bb9>=_0x515569){_0x4a9bb9=_0x515569;_0x49da50=0xc8;}else{_0x49da50=0xce;}_0x26b18f[_0xf2f8('0x2d')](_0x49da50);return _0x26b18f['set'](_0xf2f8('0x2e'),_0x457bba+'-'+_0x4a9bb9+'/'+_0x515569)[_0xf2f8('0x29')](_0x529973);}return null;};}function patchUpdates(_0x56c5e4){return function(_0x59e2fb){try{jsonpatch[_0xf2f8('0x2f')](_0x59e2fb,_0x56c5e4,!![]);}catch(_0x9792e0){return BPromise[_0xf2f8('0x30')](_0x9792e0);}return _0x59e2fb['save']();};}function saveUpdates(_0xff9862,_0x2ff335){return function(_0x4ccd89){if(_0x4ccd89){return _0x4ccd89[_0xf2f8('0x31')](_0xff9862)['then'](function(_0x3eb2e6){return _0x3eb2e6;});}return null;};}function removeEntity(_0x2a6cb1,_0x363d65){return function(_0x1335ea){if(_0x1335ea){return _0x1335ea[_0xf2f8('0x32')]()['then'](function(){_0x2a6cb1[_0xf2f8('0x2d')](0xcc)[_0xf2f8('0x33')]();});}};}function handleEntityNotFound(_0xf1e679,_0x5aee73){return function(_0x293a41){if(!_0x293a41){_0xf1e679['sendStatus'](0x194);}return _0x293a41;};}function handleError(_0x3df090,_0x5deeb4){_0x5deeb4=_0x5deeb4||0x1f4;return function(_0x2d3f23){logger[_0xf2f8('0x22')](_0x2d3f23[_0xf2f8('0x34')]);if(_0x2d3f23['name']){delete _0x2d3f23[_0xf2f8('0x35')];}_0x3df090[_0xf2f8('0x2d')](_0x5deeb4)['send'](_0x2d3f23);};}exports[_0xf2f8('0x36')]=function(_0x30f8d2,_0xab60d3){var _0x13484e={},_0x5fd8e2={},_0x169f4a={'count':0x0,'rows':[]};var _0x2c5c47=_[_0xf2f8('0x37')](db[_0xf2f8('0x38')]['rawAttributes'],function(_0x19a634){return{'name':_0x19a634[_0xf2f8('0x39')],'type':_0x19a634[_0xf2f8('0x3a')][_0xf2f8('0x3b')]};});_0x5fd8e2[_0xf2f8('0x3c')]=_['map'](_0x2c5c47,_0xf2f8('0x35'));_0x5fd8e2[_0xf2f8('0x3d')]=_[_0xf2f8('0x3e')](_0x30f8d2['query']);_0x5fd8e2[_0xf2f8('0x3f')]=_[_0xf2f8('0x40')](_0x5fd8e2[_0xf2f8('0x3c')],_0x5fd8e2[_0xf2f8('0x3d')]);_0x13484e[_0xf2f8('0x41')]=_[_0xf2f8('0x40')](_0x5fd8e2[_0xf2f8('0x3c')],qs[_0xf2f8('0x42')](_0x30f8d2[_0xf2f8('0x3d')][_0xf2f8('0x42')]));_0x13484e[_0xf2f8('0x41')]=_0x13484e[_0xf2f8('0x41')][_0xf2f8('0x43')]?_0x13484e['attributes']:_0x5fd8e2['model'];if(!_0x30f8d2['query'][_0xf2f8('0x44')](_0xf2f8('0x45'))){_0x13484e[_0xf2f8('0x46')]=qs[_0xf2f8('0x46')](_0x30f8d2[_0xf2f8('0x3d')][_0xf2f8('0x46')]);_0x13484e[_0xf2f8('0x2a')]=qs['offset'](_0x30f8d2[_0xf2f8('0x3d')][_0xf2f8('0x2a')]);}_0x13484e['order']=qs[_0xf2f8('0x47')](_0x30f8d2[_0xf2f8('0x3d')][_0xf2f8('0x47')]);_0x13484e[_0xf2f8('0x48')]=qs[_0xf2f8('0x3f')](_['pick'](_0x30f8d2[_0xf2f8('0x3d')],_0x5fd8e2[_0xf2f8('0x3f')]),_0x2c5c47);if(_0x30f8d2[_0xf2f8('0x3d')][_0xf2f8('0x49')]){_0x13484e[_0xf2f8('0x48')]=_['merge'](_0x13484e['where'],{'$or':_[_0xf2f8('0x37')](_0x2c5c47,function(_0x318539){if(_0x318539[_0xf2f8('0x3a')]!==_0xf2f8('0x4a')){var _0x1de509={};_0x1de509[_0x318539['name']]={'$like':'%'+_0x30f8d2[_0xf2f8('0x3d')][_0xf2f8('0x49')]+'%'};return _0x1de509;}})});}_0x13484e=_[_0xf2f8('0x4b')]({},_0x13484e,_0x30f8d2[_0xf2f8('0x4c')]);var _0x2cb946={'where':_0x13484e[_0xf2f8('0x48')]};return db['FaxMessage']['count'](_0x2cb946)[_0xf2f8('0x1d')](function(_0x59f081){_0x169f4a[_0xf2f8('0x2c')]=_0x59f081;if(_0x30f8d2[_0xf2f8('0x3d')][_0xf2f8('0x4d')]){_0x13484e[_0xf2f8('0x4e')]=[{'all':!![]}];}return db[_0xf2f8('0x38')]['findAll'](_0x13484e);})[_0xf2f8('0x1d')](function(_0x451ff6){_0x169f4a[_0xf2f8('0x4f')]=_0x451ff6;return _0x169f4a;})['then'](respondWithFilteredResult(_0xab60d3,_0x13484e))[_0xf2f8('0x27')](handleError(_0xab60d3,null));};exports[_0xf2f8('0x50')]=function(_0x3372ed,_0x2c34f3){var _0x2bf7b9={'raw':!![],'where':{'id':_0x3372ed['params']['id']}},_0x433d07={};_0x433d07['model']=_['keys'](db['FaxMessage'][_0xf2f8('0x51')]);_0x433d07[_0xf2f8('0x3d')]=_[_0xf2f8('0x3e')](_0x3372ed[_0xf2f8('0x3d')]);_0x433d07[_0xf2f8('0x3f')]=_[_0xf2f8('0x40')](_0x433d07[_0xf2f8('0x3c')],_0x433d07[_0xf2f8('0x3d')]);_0x2bf7b9[_0xf2f8('0x41')]=_[_0xf2f8('0x40')](_0x433d07[_0xf2f8('0x3c')],qs[_0xf2f8('0x42')](_0x3372ed['query'][_0xf2f8('0x42')]));_0x2bf7b9['attributes']=_0x2bf7b9[_0xf2f8('0x41')][_0xf2f8('0x43')]?_0x2bf7b9[_0xf2f8('0x41')]:_0x433d07[_0xf2f8('0x3c')];if(_0x3372ed[_0xf2f8('0x3d')]['includeAll']){_0x2bf7b9[_0xf2f8('0x4e')]=[{'all':!![]}];}_0x2bf7b9=_[_0xf2f8('0x4b')]({},_0x2bf7b9,_0x3372ed['options']);return db[_0xf2f8('0x38')][_0xf2f8('0x52')](_0x2bf7b9)[_0xf2f8('0x1d')](handleEntityNotFound(_0x2c34f3,null))[_0xf2f8('0x1d')](respondWithResult(_0x2c34f3,null))[_0xf2f8('0x27')](handleError(_0x2c34f3,null));};exports[_0xf2f8('0x31')]=function(_0x3a23a3,_0x3304df){if(_0x3a23a3[_0xf2f8('0x53')]['id']){delete _0x3a23a3[_0xf2f8('0x53')]['id'];}return db[_0xf2f8('0x38')][_0xf2f8('0x52')]({'where':{'id':_0x3a23a3[_0xf2f8('0x54')]['id']}})[_0xf2f8('0x1d')](handleEntityNotFound(_0x3304df,null))[_0xf2f8('0x1d')](saveUpdates(_0x3a23a3[_0xf2f8('0x53')],null))[_0xf2f8('0x1d')](respondWithResult(_0x3304df,null))['catch'](handleError(_0x3304df,null));};exports[_0xf2f8('0x32')]=function(_0x15d366,_0x4f7e05){return db[_0xf2f8('0x38')]['find']({'where':{'id':_0x15d366[_0xf2f8('0x54')]['id']}})[_0xf2f8('0x1d')](handleEntityNotFound(_0x4f7e05,null))[_0xf2f8('0x1d')](removeEntity(_0x4f7e05,null))[_0xf2f8('0x27')](handleError(_0x4f7e05,null));};exports[_0xf2f8('0x55')]=function(_0x22da38,_0x123f02){return db[_0xf2f8('0x38')][_0xf2f8('0x55')]()['then'](respondWithResult(_0x123f02,null))[_0xf2f8('0x27')](handleError(_0x123f02,null));};var interaction_log=require(_0xf2f8('0x56'))(_0xf2f8('0x57'));exports[_0xf2f8('0x58')]=function(_0x4633b6,_0x4e78ae,_0x1cf38d){var _0x30d814={'agent':{},'channel':_0xf2f8('0x59')};if(_0x4633b6[_0xf2f8('0x53')]['id']){delete _0x4633b6['body']['id'];}_0x4633b6['body'][_0xf2f8('0x5a')]=!![];_0x4633b6[_0xf2f8('0x53')][_0xf2f8('0x5b')]=moment()[_0xf2f8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4633b6['body'][_0xf2f8('0x5d')]=_0x4633b6['body'][_0xf2f8('0x5d')]||_0x4633b6[_0xf2f8('0x5e')]['id'];_0x30d814[_0xf2f8('0x5f')]['id']=_0x4633b6['body'][_0xf2f8('0x5d')];return db[_0xf2f8('0x38')][_0xf2f8('0x52')]({'where':{'id':_0x4633b6[_0xf2f8('0x54')]['id'],'UserId':null}})[_0xf2f8('0x1d')](handleEntityNotFound(_0x4e78ae,null))[_0xf2f8('0x1d')](saveUpdates(_0x4633b6[_0xf2f8('0x53')],null))[_0xf2f8('0x1d')](function(_0x19a5fb){if(_0x19a5fb){_0x30d814[_0xf2f8('0x24')]=_0x19a5fb[_0xf2f8('0x60')]({'plain':!![]});return db[_0xf2f8('0x61')]['find']({'where':{'id':_0x19a5fb[_0xf2f8('0x62')]}});}return null;})[_0xf2f8('0x1d')](handleEntityNotFound(_0x4e78ae,null))[_0xf2f8('0x1d')](function(_0x2d2c57){if(_0x2d2c57){return _0x2d2c57[_0xf2f8('0x31')]({'UserId':_0x4633b6[_0xf2f8('0x53')][_0xf2f8('0x5d')],'read1stAt':_[_0xf2f8('0x63')](_0x2d2c57[_0xf2f8('0x64')])?moment()[_0xf2f8('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xf2f8('0x1d')](function(_0x39a0d1){if(_0x39a0d1){_0x30d814['interaction']=_0x39a0d1[_0xf2f8('0x60')]({'plain':!![]});interaction_log[_0xf2f8('0x25')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4633b6[_0xf2f8('0x5e')]['id'],_0x4633b6[_0xf2f8('0x5e')][_0xf2f8('0x35')],_0x4633b6[_0xf2f8('0x5e')]['role'],_0x30d814['interaction']['id'],_0x4633b6[_0xf2f8('0x53')]?JSON['stringify'](_0x4633b6[_0xf2f8('0x53')]):_0xf2f8('0x65'));return respondWithRpcPromise(_0xf2f8('0x66'),_0xf2f8('0x67'),_0x30d814);}return null;})[_0xf2f8('0x1d')](function(_0x5e89f1){var _0x59ed6e=_0xf2f8('0x68')+_0x5e89f1['message'][_0xf2f8('0x69')];return db[_0xf2f8('0x6a')][_0xf2f8('0x3d')](_0x59ed6e,{'type':db[_0xf2f8('0x6b')][_0xf2f8('0x6c')][_0xf2f8('0x6d')],'raw':!![]})[_0xf2f8('0x1d')](function(_0x5d8ac5){return _0x5d8ac5;});})[_0xf2f8('0x1d')](function(_0x4c9eee){if(_0x4c9eee){_0x30d814['message'][_0xf2f8('0x6e')]=_0x4c9eee[0x0];if(!_0x4633b6['body'][_0xf2f8('0x5d')])return;return db[_0xf2f8('0x6f')]['find']({'where':{'id':_0x4633b6['body']['UserId'],'role':'agent'},'attributes':['id',_0xf2f8('0x35'),_0xf2f8('0x70'),_0xf2f8('0x71'),_0xf2f8('0x72')],'raw':!![]});}return null;})['then'](function(_0x256634){if(!_0x256634)return null;_0x30d814[_0xf2f8('0x24')][_0xf2f8('0x5f')]=_0x256634;return _0x30d814;})['then'](function(_0x5e0f88){if(_0x5e0f88){if(_0x4633b6['body'][_0xf2f8('0x73')]){_0x30d814[_0xf2f8('0x24')][_0xf2f8('0x74')]=util[_0xf2f8('0x5c')](_0xf2f8('0x75'),_0x4633b6[_0xf2f8('0x5e')][_0xf2f8('0x35')]);_0x30d814['message']['channel']=_0x30d814[_0xf2f8('0x76')];_0x30d814[_0xf2f8('0x24')]['event']=_0xf2f8('0x58');return respondWithRpcPromise(_0xf2f8('0x77'),_0xf2f8('0x77'),{'event':_0xf2f8('0x78'),'message':_0x30d814[_0xf2f8('0x24')]},client9002)[_0xf2f8('0x1d')](function(){return _0x30d814;});}return _0x30d814;}return null;})[_0xf2f8('0x1d')](respondWithResult(_0x4e78ae,null))[_0xf2f8('0x27')](handleError(_0x4e78ae,null));};var interaction_log=require(_0xf2f8('0x56'))('fax-interactions');exports[_0xf2f8('0x30')]=function(_0x3feb67,_0x4ae75a,_0x1fcae0){var _0x3c1f8f={'agent':{},'channel':_0xf2f8('0x59')};if(_0x3feb67[_0xf2f8('0x53')]['id']){delete _0x3feb67[_0xf2f8('0x53')]['id'];}_0x3feb67[_0xf2f8('0x53')][_0xf2f8('0x5d')]=_0x3feb67[_0xf2f8('0x53')][_0xf2f8('0x5d')]||_0x3feb67['user']['id'];_0x3c1f8f[_0xf2f8('0x5f')]['id']=_0x3feb67['body']['UserId'];return db[_0xf2f8('0x38')][_0xf2f8('0x52')]({'where':{'id':_0x3feb67[_0xf2f8('0x54')]['id'],'UserId':null}})[_0xf2f8('0x1d')](handleEntityNotFound(_0x4ae75a,null))[_0xf2f8('0x1d')](function(_0x395fa7){if(_0x395fa7){_0x3c1f8f[_0xf2f8('0x24')]=_0x395fa7[_0xf2f8('0x60')]({'plain':!![]});return db[_0xf2f8('0x61')][_0xf2f8('0x52')]({'where':{'id':_0x395fa7['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4ae75a,null))['then'](function(_0x2e9888){if(_0x2e9888){_0x3c1f8f[_0xf2f8('0x79')]=_0x2e9888['get']({'plain':!![]});interaction_log[_0xf2f8('0x25')](_0xf2f8('0x7a'),_0x3feb67[_0xf2f8('0x5e')]['id'],_0x3feb67[_0xf2f8('0x5e')][_0xf2f8('0x35')],_0x3feb67[_0xf2f8('0x5e')]['role'],_0x3c1f8f['interaction']['id'],_0x3feb67['body']?JSON[_0xf2f8('0x21')](_0x3feb67[_0xf2f8('0x53')]):_0xf2f8('0x65'));return respondWithRpcPromise(_0xf2f8('0x7b'),_0xf2f8('0x7c'),_0x3c1f8f);}return null;})[_0xf2f8('0x1d')](function(_0x2e1bd7){var _0x16b2db=_0xf2f8('0x68')+_0x2e1bd7[_0xf2f8('0x24')][_0xf2f8('0x69')];return db[_0xf2f8('0x6a')]['query'](_0x16b2db,{'type':db[_0xf2f8('0x6b')][_0xf2f8('0x6c')]['SELECT'],'raw':!![]})[_0xf2f8('0x1d')](function(_0x5abc45){return _0x5abc45;});})['then'](function(_0x5bb8db){if(_0x5bb8db){_0x3c1f8f[_0xf2f8('0x24')][_0xf2f8('0x6e')]=_0x5bb8db[0x0];if(!_0x3feb67[_0xf2f8('0x53')][_0xf2f8('0x5d')])return;return db[_0xf2f8('0x6f')][_0xf2f8('0x52')]({'where':{'id':_0x3feb67[_0xf2f8('0x53')]['UserId'],'role':_0xf2f8('0x5f')},'attributes':['id',_0xf2f8('0x35'),_0xf2f8('0x70'),_0xf2f8('0x71'),_0xf2f8('0x72')],'raw':!![]});}return null;})['then'](function(_0x3e1ba1){if(!_0x3e1ba1)return null;_0x3c1f8f[_0xf2f8('0x24')][_0xf2f8('0x5f')]=_0x3e1ba1;return _0x3c1f8f;})[_0xf2f8('0x1d')](function(_0x290735){if(_0x290735){_0x290735['message'][_0xf2f8('0x74')]=util[_0xf2f8('0x5c')](_0xf2f8('0x75'),_0x3feb67[_0xf2f8('0x5e')][_0xf2f8('0x35')]);_0x290735[_0xf2f8('0x24')]['channel']=_0x3c1f8f[_0xf2f8('0x76')];_0x290735[_0xf2f8('0x24')][_0xf2f8('0x7d')]='reject';respondWithRpcPromise(_0xf2f8('0x77'),_0xf2f8('0x77'),{'event':_0xf2f8('0x7e'),'message':_0x290735[_0xf2f8('0x24')]},client9002);return _0x3c1f8f;}return null;})[_0xf2f8('0x1d')](respondWithResult(_0x4ae75a,null))['catch'](handleError(_0x4ae75a,null));};exports['create']=function(_0x56ed08,_0x5a2d51){var _0x3d1215;return db[_0xf2f8('0x38')]['create'](_0x56ed08['body'],{})[_0xf2f8('0x1d')](function(_0x4ed34c){_0x3d1215=_0x4ed34c;return db[_0xf2f8('0x7f')][_0xf2f8('0x80')]({'where':{'id':_0x3d1215['ContactId']}});})[_0xf2f8('0x1d')](function(_0x3f547d){if(_['isNil'](_0x3f547d)){return;}else{_0x3d1215[_0xf2f8('0x59')]=_0x3f547d[_0xf2f8('0x59')];return db['Attachment']['findOne']({'where':{'id':_0x3d1215[_0xf2f8('0x81')]}});}})[_0xf2f8('0x1d')](function(_0x2a7e60){return respondWithRpcPromise(_0xf2f8('0x82'),_0xf2f8('0x82'),{'FaxAccountId':_[_0xf2f8('0x63')](_0x56ed08[_0xf2f8('0x53')])?undefined:_0x56ed08['body'][_0xf2f8('0x83')],'path':_[_0xf2f8('0x63')](_0x2a7e60)?undefined:util[_0xf2f8('0x5c')](_0xf2f8('0x84'),_0x2a7e60[_0xf2f8('0x85')]),'fax':_[_0xf2f8('0x63')](_0x3d1215[_0xf2f8('0x59')])?undefined:_0x3d1215[_0xf2f8('0x59')],'AttachmentId':_0x3d1215['AttachmentId']},client9002);})[_0xf2f8('0x1d')](respondWithResult(_0x5a2d51,0xc9))[_0xf2f8('0x27')](handleError(_0x5a2d51,null));};exports['download']=function(_0x361909,_0x154bb1){var _0x296d64=path['join'](config[_0xf2f8('0x86')],'server','files',_0xf2f8('0x87'));return db[_0xf2f8('0x38')][_0xf2f8('0x52')]({'where':{'id':_0x361909['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0xf2f8('0x1d')](handleEntityNotFound(_0x154bb1,null))[_0xf2f8('0x1d')](function(_0x389337){if(_0x389337){return _0x154bb1['download'](path[_0xf2f8('0x88')](_0x296d64,_0x389337[_0xf2f8('0x89')][_0xf2f8('0x85')]));}})[_0xf2f8('0x27')](handleError(_0x154bb1,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 700c5d4..46fadef 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 _0x2d72=['FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x5b1156,_0x42f214){var _0x131f15=function(_0x52ffb7){while(--_0x52ffb7){_0x5b1156['push'](_0x5b1156['shift']());}};_0x131f15(++_0x42f214);}(_0x2d72,0xa8));var _0x22d7=function(_0x122c2a,_0x495240){_0x122c2a=_0x122c2a-0x0;var _0x46df47=_0x2d72[_0x122c2a];return _0x46df47;};'use strict';var EventEmitter=require(_0x22d7('0x0'));var FaxMessage=require(_0x22d7('0x1'))['db'][_0x22d7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x22d7('0x3')](0x0);var events={'afterCreate':_0x22d7('0x4'),'afterUpdate':_0x22d7('0x5'),'afterDestroy':_0x22d7('0x6')};function emitEvent(_0x1738ec){return function(_0x35cf66,_0xfd6d11,_0x17cfba){FaxMessageEvents[_0x22d7('0x7')](_0x1738ec+':'+_0x35cf66['id'],_0x35cf66);FaxMessageEvents[_0x22d7('0x7')](_0x1738ec,_0x35cf66);_0x17cfba(null);};}for(var e in events){if(events[_0x22d7('0x8')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x22d7('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xd8fb=['../../mysqldb','FaxMessage','setMaxListeners','emit','hasOwnProperty','exports','events'];(function(_0x4a4fb8,_0x1c8af){var _0x1d27c8=function(_0x56ae4f){while(--_0x56ae4f){_0x4a4fb8['push'](_0x4a4fb8['shift']());}};_0x1d27c8(++_0x1c8af);}(_0xd8fb,0x99));var _0xbd8f=function(_0x55a76d,_0x33d0c6){_0x55a76d=_0x55a76d-0x0;var _0x2e616c=_0xd8fb[_0x55a76d];return _0x2e616c;};'use strict';var EventEmitter=require(_0xbd8f('0x0'));var FaxMessage=require(_0xbd8f('0x1'))['db'][_0xbd8f('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xbd8f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x455a12){return function(_0x43d177,_0x53cccc,_0x400dfb){FaxMessageEvents[_0xbd8f('0x4')](_0x455a12+':'+_0x43d177['id'],_0x43d177);FaxMessageEvents['emit'](_0x455a12,_0x43d177);_0x400dfb(null);};}for(var e in events){if(events[_0xbd8f('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xbd8f('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9db7dd9..1f9d124 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 _0x2826=['FULLTEXT','models','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./faxMessage.attributes','exports','fti_fax_messages','body'];(function(_0x52a7e1,_0x189bf3){var _0x4f4495=function(_0x5d1915){while(--_0x5d1915){_0x52a7e1['push'](_0x52a7e1['shift']());}};_0x4f4495(++_0x189bf3);}(_0x2826,0x128));var _0x6282=function(_0x1ebce7,_0x5762ba){_0x1ebce7=_0x1ebce7-0x0;var _0x1eb9c5=_0x2826[_0x1ebce7];return _0x1eb9c5;};'use strict';var _=require(_0x6282('0x0'));var util=require(_0x6282('0x1'));var logger=require(_0x6282('0x2'))(_0x6282('0x3'));var moment=require(_0x6282('0x4'));var BPromise=require(_0x6282('0x5'));var rp=require(_0x6282('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6282('0x7'));var config=require('../../config/environment');var attributes=require(_0x6282('0x8'));module[_0x6282('0x9')]=function(_0x54ee06,_0x3824e3){return _0x54ee06['define']('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x6282('0xa'),'fields':[_0x6282('0xb')],'type':_0x6282('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x320eb6,_0x5df54d,_0x2b59e5){var _0x4330a6=_0x54ee06[_0x6282('0xd')];var _0x45916a=_0x320eb6['get']({'plain':!![]});if(_0x45916a[_0x6282('0xe')][_0x6282('0xf')]()==='in'||_0x45916a[_0x6282('0xe')][_0x6282('0xf')]()===_0x6282('0x10')&&!_0x45916a['secret']&&!_[_0x6282('0x11')](_0x45916a[_0x6282('0x12')])){_0x4330a6[_0x6282('0x13')][_0x6282('0x14')]({'where':{'id':_0x45916a[_0x6282('0x15')]}})[_0x6282('0x16')](function(_0x51019){if(_0x51019){_0x51019['update']({'lastMsgAt':_0x45916a[_0x6282('0x17')],'lastMsgDirection':_0x45916a['direction'][_0x6282('0xf')]()});}})[_0x6282('0x18')](function(_0x984df7){console[_0x6282('0x19')](_0x984df7);});}_0x2b59e5();}},'charset':_0x6282('0x1a'),'collate':_0x6282('0x1b')});}; \ No newline at end of file +var _0x9235=['request-promise','../../config/environment','./faxMessage.attributes','define','FaxMessage','fti_fax_messages','body','models','get','direction','toLowerCase','out','secret','isNil','FaxInteraction','findOne','FaxInteractionId','then','update','catch','lodash','util','../../config/logger','api','moment'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x9235,0x1d6));var _0x5923=function(_0x194bff,_0x582e27){_0x194bff=_0x194bff-0x0;var _0x1142bf=_0x9235[_0x194bff];return _0x1142bf;};'use strict';var _=require(_0x5923('0x0'));var util=require(_0x5923('0x1'));var logger=require(_0x5923('0x2'))(_0x5923('0x3'));var moment=require(_0x5923('0x4'));var BPromise=require('bluebird');var rp=require(_0x5923('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5923('0x6'));var attributes=require(_0x5923('0x7'));module['exports']=function(_0x5a1cd3,_0x4d8025){return _0x5a1cd3[_0x5923('0x8')](_0x5923('0x9'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x5923('0xa'),'fields':[_0x5923('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x173816,_0x57632c,_0x1c9297){var _0x21a599=_0x5a1cd3[_0x5923('0xc')];var _0x4284af=_0x173816[_0x5923('0xd')]({'plain':!![]});if(_0x4284af[_0x5923('0xe')][_0x5923('0xf')]()==='in'||_0x4284af[_0x5923('0xe')][_0x5923('0xf')]()===_0x5923('0x10')&&!_0x4284af[_0x5923('0x11')]&&!_[_0x5923('0x12')](_0x4284af['UserId'])){_0x21a599[_0x5923('0x13')][_0x5923('0x14')]({'where':{'id':_0x4284af[_0x5923('0x15')]}})[_0x5923('0x16')](function(_0x3ca507){if(_0x3ca507){_0x3ca507[_0x5923('0x17')]({'lastMsgAt':_0x4284af['createdAt'],'lastMsgDirection':_0x4284af[_0x5923('0xe')][_0x5923('0xf')]()});}})[_0x5923('0x18')](function(_0x543ea5){console['error'](_0x543ea5);});}_0x1c9297();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index d2336ff..87794cf 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 _0x17ba=['CreateFaxMessage','FaxMessage','create','options','raw','info','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch'];(function(_0x57d253,_0x16c549){var _0x5b7f52=function(_0x1007d9){while(--_0x1007d9){_0x57d253['push'](_0x57d253['shift']());}};_0x5b7f52(++_0x16c549);}(_0x17ba,0xab));var _0xa17b=function(_0x272b16,_0x439471){_0x272b16=_0x272b16-0x0;var _0x158fb8=_0x17ba[_0x272b16];return _0x158fb8;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});config[_0xa17b('0xd')]=_[_0xa17b('0xe')](config[_0xa17b('0xd')],{'host':_0xa17b('0xf'),'port':0x18eb});var socket=require(_0xa17b('0x10'))(new Redis(config[_0xa17b('0xd')]));require(_0xa17b('0x11'))[_0xa17b('0x12')](socket);function respondWithRpcPromise(_0x578799,_0x2556c4,_0x38b8f1){return new BPromise(function(_0x322dc0,_0x1e799a){return client[_0xa17b('0x13')](_0x578799,_0x38b8f1)[_0xa17b('0x14')](function(_0xc5ef2e){logger['info'](_0xa17b('0x15'),_0x2556c4,_0xa17b('0x16'));logger[_0xa17b('0x17')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'),JSON[_0xa17b('0x18')](_0xc5ef2e));if(_0xc5ef2e[_0xa17b('0x19')]){if(_0xc5ef2e[_0xa17b('0x19')]['code']===0x1f4){logger[_0xa17b('0x19')]('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xc5ef2e[_0xa17b('0x19')][_0xa17b('0x1a')]);return _0x1e799a(_0xc5ef2e['error'][_0xa17b('0x1a')]);}logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0xc5ef2e[_0xa17b('0x19')]['message']);return _0x322dc0(_0xc5ef2e[_0xa17b('0x19')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2556c4,_0xa17b('0x16'));_0x322dc0(_0xc5ef2e[_0xa17b('0x1b')]['message']);}})[_0xa17b('0x1c')](function(_0x166d44){logger[_0xa17b('0x19')](_0xa17b('0x15'),_0x2556c4,_0x166d44);_0x1e799a(_0x166d44);});});}exports[_0xa17b('0x1d')]=function(_0x1ecaa2){var _0x24afc2=this;return new Promise(function(_0x584a0a,_0x610c2b){return db[_0xa17b('0x1e')][_0xa17b('0x1f')](_0x1ecaa2['body'],{'raw':_0x1ecaa2[_0xa17b('0x20')]?_0x1ecaa2[_0xa17b('0x20')][_0xa17b('0x21')]===undefined?!![]:![]:!![]})[_0xa17b('0x14')](function(_0x3c7ec2){logger[_0xa17b('0x22')]('CreateFaxMessage',_0x1ecaa2);logger[_0xa17b('0x17')]('CreateFaxMessage',_0x1ecaa2,JSON[_0xa17b('0x18')](_0x3c7ec2));_0x584a0a(_0x3c7ec2);})[_0xa17b('0x1c')](function(_0x4ba608){logger['error'](_0xa17b('0x1d'),_0x4ba608[_0xa17b('0x1a')],_0x1ecaa2);_0x610c2b(_0x24afc2[_0xa17b('0x19')](0x1f4,_0x4ba608[_0xa17b('0x1a')]));});});};exports[_0xa17b('0x23')]=function(_0x3a64f5){var _0x4cd38e=this;return new Promise(function(_0x47aff8,_0x5c98fe){return db['FaxMessage'][_0xa17b('0x24')](_0x3a64f5['body'],{'raw':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5['options'][_0xa17b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x25')]||null:null,'attributes':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x26')]||null:null,'limit':_0x3a64f5[_0xa17b('0x20')]?_0x3a64f5[_0xa17b('0x20')][_0xa17b('0x27')]||null:null})[_0xa17b('0x14')](function(_0x573585){logger['info']('UpdateFaxMessage',_0x3a64f5);logger[_0xa17b('0x17')](_0xa17b('0x23'),_0x3a64f5,JSON[_0xa17b('0x18')](_0x573585));_0x47aff8(_0x573585);})[_0xa17b('0x1c')](function(_0x16dd1f){logger[_0xa17b('0x19')](_0xa17b('0x23'),_0x16dd1f[_0xa17b('0x1a')],_0x3a64f5);_0x5c98fe(_0x4cd38e['error'](0x1f4,_0x16dd1f[_0xa17b('0x1a')]));});});}; \ No newline at end of file +var _0xb903=['options','raw','then','stringify','UpdateFaxMessage','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','request','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','FaxMessage,\x20%s,\x20%s','message','result','catch','CreateFaxMessage','FaxMessage','create','body'];(function(_0x3c8be4,_0x11b2d0){var _0x18f21a=function(_0x4dad61){while(--_0x4dad61){_0x3c8be4['push'](_0x3c8be4['shift']());}};_0x18f21a(++_0x11b2d0);}(_0xb903,0x185));var _0x3b90=function(_0x386392,_0xeec16){_0x386392=_0x386392-0x0;var _0x3b8f3a=_0xb903[_0x386392];return _0x3b8f3a;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3b90('0xc')],{'host':_0x3b90('0xd'),'port':0x18eb});var socket=require(_0x3b90('0xe'))(new Redis(config[_0x3b90('0xc')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x52401e,_0x51f916,_0x56261b){return new BPromise(function(_0x55db3f,_0x336913){return client[_0x3b90('0xf')](_0x52401e,_0x56261b)['then'](function(_0x30c49c){logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));logger[_0x3b90('0x12')](_0x3b90('0x13'),_0x51f916,'request\x20sent',JSON['stringify'](_0x30c49c));if(_0x30c49c[_0x3b90('0x14')]){if(_0x30c49c['error']['code']===0x1f4){logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c['error']['message']);return _0x336913(_0x30c49c[_0x3b90('0x14')][_0x3b90('0x16')]);}logger[_0x3b90('0x14')](_0x3b90('0x15'),_0x51f916,_0x30c49c[_0x3b90('0x14')]['message']);return _0x55db3f(_0x30c49c['error'][_0x3b90('0x16')]);}else{logger[_0x3b90('0x10')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x3b90('0x11'));_0x55db3f(_0x30c49c[_0x3b90('0x17')][_0x3b90('0x16')]);}})[_0x3b90('0x18')](function(_0x4f388b){logger[_0x3b90('0x14')]('FaxMessage,\x20%s,\x20%s',_0x51f916,_0x4f388b);_0x336913(_0x4f388b);});});}exports[_0x3b90('0x19')]=function(_0x231690){var _0x535894=this;return new Promise(function(_0x39ae7c,_0x12e1cf){return db[_0x3b90('0x1a')][_0x3b90('0x1b')](_0x231690[_0x3b90('0x1c')],{'raw':_0x231690[_0x3b90('0x1d')]?_0x231690[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![]})[_0x3b90('0x1f')](function(_0x3e5bb8){logger['info'](_0x3b90('0x19'),_0x231690);logger[_0x3b90('0x12')](_0x3b90('0x19'),_0x231690,JSON[_0x3b90('0x20')](_0x3e5bb8));_0x39ae7c(_0x3e5bb8);})[_0x3b90('0x18')](function(_0x93b8e7){logger['error']('CreateFaxMessage',_0x93b8e7[_0x3b90('0x16')],_0x231690);_0x12e1cf(_0x535894[_0x3b90('0x14')](0x1f4,_0x93b8e7[_0x3b90('0x16')]));});});};exports[_0x3b90('0x21')]=function(_0x583523){var _0x414462=this;return new Promise(function(_0x2936d7,_0x1787d1){return db['FaxMessage'][_0x3b90('0x22')](_0x583523[_0x3b90('0x1c')],{'raw':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x583523[_0x3b90('0x1d')]?_0x583523['options'][_0x3b90('0x23')]||null:null,'attributes':_0x583523['options']?_0x583523[_0x3b90('0x1d')][_0x3b90('0x24')]||null:null,'limit':_0x583523[_0x3b90('0x1d')]?_0x583523[_0x3b90('0x1d')][_0x3b90('0x25')]||null:null})[_0x3b90('0x1f')](function(_0x290283){logger[_0x3b90('0x10')]('UpdateFaxMessage',_0x583523);logger['debug'](_0x3b90('0x21'),_0x583523,JSON[_0x3b90('0x20')](_0x290283));_0x2936d7(_0x290283);})[_0x3b90('0x18')](function(_0x1c2e84){logger['error']('UpdateFaxMessage',_0x1c2e84[_0x3b90('0x16')],_0x583523);_0x1787d1(_0x414462[_0x3b90('0x14')](0x1f4,_0x1c2e84[_0x3b90('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 2e0cf0e..4ec14f4 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 _0x7ee3=['remove','update','emit','removeListener','faxMessage:','save'];(function(_0x5093e9,_0x5154d0){var _0x4c9a22=function(_0x15176d){while(--_0x15176d){_0x5093e9['push'](_0x5093e9['shift']());}};_0x4c9a22(++_0x5154d0);}(_0x7ee3,0x1c7));var _0x37ee=function(_0x3259bf,_0x21afb7){_0x3259bf=_0x3259bf-0x0;var _0x2f9c30=_0x7ee3[_0x3259bf];return _0x2f9c30;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0x37ee('0x0'),_0x37ee('0x1'),_0x37ee('0x2')];function createListener(_0x1bb625,_0xdaa0c3){return function(_0x1f5be0){_0xdaa0c3[_0x37ee('0x3')](_0x1bb625,_0x1f5be0);};}function removeListener(_0x4a7ab3,_0x176ec0){return function(){FaxMessageEvents[_0x37ee('0x4')](_0x4a7ab3,_0x176ec0);};}exports['register']=function(_0x5c2487){for(var _0x5e326b=0x0,_0x16f5f9=events['length'];_0x5e326b<_0x16f5f9;_0x5e326b++){var _0x3d217d=events[_0x5e326b];var _0x492ffc=createListener(_0x37ee('0x5')+_0x3d217d,_0x5c2487);FaxMessageEvents['on'](_0x3d217d,_0x492ffc);}}; \ No newline at end of file +var _0xa9c9=['remove','update','emit','removeListener','faxMessage:','./faxMessage.events'];(function(_0x47e9d5,_0xe21a96){var _0x1cff20=function(_0x1af5f1){while(--_0x1af5f1){_0x47e9d5['push'](_0x47e9d5['shift']());}};_0x1cff20(++_0xe21a96);}(_0xa9c9,0x1d9));var _0x9a9c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xa9c9[_0x11005e];return _0x29338f;};'use strict';var FaxMessageEvents=require(_0x9a9c('0x0'));var events=['save',_0x9a9c('0x1'),_0x9a9c('0x2')];function createListener(_0x1dd4f4,_0x336ded){return function(_0x27943b){_0x336ded[_0x9a9c('0x3')](_0x1dd4f4,_0x27943b);};}function removeListener(_0x3ebcea,_0x258d1e){return function(){FaxMessageEvents[_0x9a9c('0x4')](_0x3ebcea,_0x258d1e);};}exports['register']=function(_0x20df71){for(var _0x437509=0x0,_0x15e8cf=events['length'];_0x437509<_0x15e8cf;_0x437509++){var _0x33c49b=events[_0x437509];var _0x5594cf=createListener(_0x9a9c('0x5')+_0x33c49b,_0x20df71);FaxMessageEvents['on'](_0x33c49b,_0x5594cf);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 9edf6fa..6b2d06c 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 _0xb58b=['Router','fs-extra','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','/:id/accept','accept','reject','destroy','exports','util','path','connect-timeout'];(function(_0x21155e,_0x8608a4){var _0x126a73=function(_0x17519d){while(--_0x17519d){_0x21155e['push'](_0x21155e['shift']());}};_0x126a73(++_0x8608a4);}(_0xb58b,0x1f1));var _0xbb58=function(_0x618639,_0x2110b3){_0x618639=_0x618639-0x0;var _0x3f382b=_0xb58b[_0x618639];return _0x3f382b;};'use strict';var multer=require('multer');var util=require(_0xbb58('0x0'));var path=require(_0xbb58('0x1'));var timeout=require(_0xbb58('0x2'));var express=require('express');var router=express[_0xbb58('0x3')]();var fs_extra=require(_0xbb58('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb58('0x5'));var config=require('../../config/environment');var controller=require(_0xbb58('0x6'));router[_0xbb58('0x7')]('/',auth[_0xbb58('0x8')](),controller['index']);router[_0xbb58('0x7')](_0xbb58('0x9'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xa')]);router[_0xbb58('0x7')](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller[_0xbb58('0xc')]);router[_0xbb58('0x7')](_0xbb58('0xd'),auth[_0xbb58('0x8')](),controller['download']);router[_0xbb58('0xe')]('/',auth['isAuthenticated'](),interaction[_0xbb58('0xf')](_0xbb58('0x10'),_0xbb58('0x11')),controller[_0xbb58('0x12')]);router['put'](_0xbb58('0xb'),auth[_0xbb58('0x8')](),controller['update']);router[_0xbb58('0x13')](_0xbb58('0x14'),auth[_0xbb58('0x8')](),controller[_0xbb58('0x15')]);router[_0xbb58('0x13')]('/:id/reject',auth[_0xbb58('0x8')](),controller[_0xbb58('0x16')]);router['delete']('/:id',auth[_0xbb58('0x8')](),controller[_0xbb58('0x17')]);module[_0xbb58('0x18')]=router; \ No newline at end of file +var _0xbb53=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','tracked','faxmessage:create','put','update','/:id/accept','accept','reject','destroy'];(function(_0x5b6020,_0xbb8363){var _0x23bda1=function(_0x47abb9){while(--_0x47abb9){_0x5b6020['push'](_0x5b6020['shift']());}};_0x23bda1(++_0xbb8363);}(_0xbb53,0x121));var _0x3bb5=function(_0x30cd88,_0x54cad1){_0x30cd88=_0x30cd88-0x0;var _0x3994db=_0xbb53[_0x30cd88];return _0x3994db;};'use strict';var multer=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var path=require(_0x3bb5('0x2'));var timeout=require(_0x3bb5('0x3'));var express=require(_0x3bb5('0x4'));var router=express[_0x3bb5('0x5')]();var fs_extra=require(_0x3bb5('0x6'));var auth=require(_0x3bb5('0x7'));var interaction=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var controller=require('./faxMessage.controller');router['get']('/',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xb')]);router[_0x3bb5('0xc')](_0x3bb5('0xd'),auth[_0x3bb5('0xa')](),controller['describe']);router['get']('/:id',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xe')]);router[_0x3bb5('0xc')]('/:id/download',auth[_0x3bb5('0xa')](),controller['download']);router['post']('/',auth[_0x3bb5('0xa')](),interaction[_0x3bb5('0xf')]('fax',_0x3bb5('0x10')),controller['create']);router[_0x3bb5('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x3bb5('0x12')]);router[_0x3bb5('0x11')](_0x3bb5('0x13'),auth['isAuthenticated'](),controller[_0x3bb5('0x14')]);router[_0x3bb5('0x11')]('/:id/reject',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x15')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3bb5('0x16')]);module[_0x3bb5('0x17')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 78901cd..b65e5f8 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 _0xd4ad=['STRING','name','rrmemory','beepall','sequelize','exports'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x1fea21,_0x48ce70){_0x1fea21=_0x1fea21-0x0;var _0x52808f=_0xd4ad[_0x1fea21];return _0x52808f;};'use strict';var Sequelize=require(_0xdd4a('0x0'));module[_0xdd4a('0x1')]={'name':{'type':Sequelize[_0xdd4a('0x2')],'unique':_0xdd4a('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xdd4a('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdd4a('0x4'),_0xdd4a('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xb391=['exports','name','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x589112,_0x2b248f){var _0x6dc860=function(_0x3b30bf){while(--_0x3b30bf){_0x589112['push'](_0x589112['shift']());}};_0x6dc860(++_0x2b248f);}(_0xb391,0x137));var _0x1b39=function(_0x382bdd,_0x4e0534){_0x382bdd=_0x382bdd-0x0;var _0x1f29d8=_0xb391[_0x382bdd];return _0x1f29d8;};'use strict';var Sequelize=require(_0x1b39('0x0'));module[_0x1b39('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b39('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b39('0x3')]},'timeout':{'type':Sequelize[_0x1b39('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x1b39('0x5'),_0x1b39('0x6'),_0x1b39('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x1b39('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index c373d7c..16bde8b 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 _0x84d9=['squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxQueue.socket','register','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','get','FaxQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','options','includeAll','include','findAll','rows','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','findOne','UserFaxQueue','length','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','getTeams','Team','filter','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','every','includes','all','union','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','emit','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x5557aa,_0x554f79){var _0x4148d6=function(_0x518593){while(--_0x518593){_0x5557aa['push'](_0x5557aa['shift']());}};_0x4148d6(++_0x554f79);}(_0x84d9,0x7e));var _0x984d=function(_0x5119c9,_0x498f99){_0x5119c9=_0x5119c9-0x0;var _0x53e10f=_0x84d9[_0x5119c9];return _0x53e10f;};'use strict';var emlformat=require(_0x984d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x984d('0x1'));var jsonpatch=require(_0x984d('0x2'));var rp=require(_0x984d('0x3'));var moment=require('moment');var BPromise=require(_0x984d('0x4'));var Mustache=require(_0x984d('0x5'));var util=require(_0x984d('0x6'));var path=require(_0x984d('0x7'));var sox=require(_0x984d('0x8'));var csv=require(_0x984d('0x9'));var ejs=require(_0x984d('0xa'));var fs=require('fs');var fs_extra=require(_0x984d('0xb'));var _=require(_0x984d('0xc'));var squel=require(_0x984d('0xd'));var crypto=require(_0x984d('0xe'));var jsforce=require(_0x984d('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x984d('0x10'));var Papa=require('papaparse');var Redis=require(_0x984d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x984d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x984d('0x13'));var logger=require(_0x984d('0x14'))(_0x984d('0x15'));var utils=require(_0x984d('0x16'));var config=require(_0x984d('0x17'));var licenseUtil=require(_0x984d('0x18'));var db=require(_0x984d('0x19'))['db'];config['redis']=_[_0x984d('0x1a')](config[_0x984d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x984d('0x1c'))(new Redis(config[_0x984d('0x1b')]));require(_0x984d('0x1d'))[_0x984d('0x1e')](socket);function respondWithStatusCode(_0x545bc9,_0x59a28a){_0x59a28a=_0x59a28a||0xcc;return function(_0x5c1b66){if(_0x5c1b66){return _0x545bc9['sendStatus'](_0x59a28a);}return _0x545bc9[_0x984d('0x1f')](_0x59a28a)[_0x984d('0x20')]();};}function respondWithResult(_0x493817,_0x5b3f2e){_0x5b3f2e=_0x5b3f2e||0xc8;return function(_0x3a9a8e){if(_0x3a9a8e){return _0x493817['status'](_0x5b3f2e)[_0x984d('0x21')](_0x3a9a8e);}};}function respondWithFilteredResult(_0x54885c,_0x26a5be){return function(_0x582f2e){if(_0x582f2e){var _0x4fd5c8=typeof _0x26a5be[_0x984d('0x22')]===_0x984d('0x23')&&typeof _0x26a5be['limit']===_0x984d('0x23');var _0x2ee0f9=_0x582f2e[_0x984d('0x24')];var _0x4cc8ee=_0x4fd5c8?0x0:_0x26a5be[_0x984d('0x22')];var _0x2f61a9=_0x4fd5c8?_0x582f2e['count']:_0x26a5be[_0x984d('0x22')]+_0x26a5be['limit'];var _0x3e0763;if(_0x2f61a9>=_0x2ee0f9){_0x2f61a9=_0x2ee0f9;_0x3e0763=0xc8;}else{_0x3e0763=0xce;}_0x54885c['status'](_0x3e0763);return _0x54885c[_0x984d('0x25')]('Content-Range',_0x4cc8ee+'-'+_0x2f61a9+'/'+_0x2ee0f9)[_0x984d('0x21')](_0x582f2e);}return null;};}function patchUpdates(_0x10e269){return function(_0x169a9c){try{jsonpatch[_0x984d('0x26')](_0x169a9c,_0x10e269,!![]);}catch(_0x756e04){return BPromise['reject'](_0x756e04);}return _0x169a9c[_0x984d('0x27')]();};}function saveUpdates(_0x1b4a07,_0x5313b4){return function(_0x4dba10){if(_0x4dba10){return _0x4dba10[_0x984d('0x28')](_0x1b4a07)[_0x984d('0x29')](function(_0x4c7e38){return _0x4c7e38;});}return null;};}function removeEntity(_0x2bde48,_0x59f102){return function(_0x159975){if(_0x159975){return _0x159975[_0x984d('0x2a')]()[_0x984d('0x29')](function(){var _0x390cd8=_0x159975[_0x984d('0x2b')]({'plain':!![]});var _0x52e673=_0x984d('0x2c');return db[_0x984d('0x2d')][_0x984d('0x2a')]({'where':{'type':_0x52e673,'resourceId':_0x390cd8['id']}})[_0x984d('0x29')](function(){return _0x159975;});})[_0x984d('0x29')](function(){_0x2bde48[_0x984d('0x1f')](0xcc)[_0x984d('0x20')]();});}};}function handleEntityNotFound(_0x2c17a0,_0x22ca2a){return function(_0x572b69){if(!_0x572b69){_0x2c17a0[_0x984d('0x2e')](0x194);}return _0x572b69;};}function handleError(_0x2e2b5,_0x7c991b){_0x7c991b=_0x7c991b||0x1f4;return function(_0x151c2f){logger[_0x984d('0x2f')](_0x151c2f[_0x984d('0x30')]);if(_0x151c2f[_0x984d('0x31')]){delete _0x151c2f[_0x984d('0x31')];}_0x2e2b5[_0x984d('0x1f')](_0x7c991b)[_0x984d('0x32')](_0x151c2f);};}exports[_0x984d('0x33')]=function(_0xa67f68,_0x35c8bb){var _0x1187a2={},_0x1374e0={},_0xb625f5={'count':0x0,'rows':[]};var _0x343cc5=_[_0x984d('0x34')](db[_0x984d('0x35')][_0x984d('0x36')],function(_0x491d5f){return{'name':_0x491d5f[_0x984d('0x37')],'type':_0x491d5f['type'][_0x984d('0x38')]};});_0x1374e0[_0x984d('0x39')]=_[_0x984d('0x34')](_0x343cc5,_0x984d('0x31'));_0x1374e0['query']=_[_0x984d('0x3a')](_0xa67f68[_0x984d('0x3b')]);_0x1374e0[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x1374e0['model'],_0x1374e0[_0x984d('0x3b')]);_0x1187a2[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x1374e0[_0x984d('0x39')],qs[_0x984d('0x3f')](_0xa67f68[_0x984d('0x3b')][_0x984d('0x3f')]));_0x1187a2[_0x984d('0x3e')]=_0x1187a2[_0x984d('0x3e')]['length']?_0x1187a2[_0x984d('0x3e')]:_0x1374e0[_0x984d('0x39')];if(!_0xa67f68['query'][_0x984d('0x40')](_0x984d('0x41'))){_0x1187a2[_0x984d('0x42')]=qs['limit'](_0xa67f68[_0x984d('0x3b')][_0x984d('0x42')]);_0x1187a2['offset']=qs[_0x984d('0x22')](_0xa67f68['query'][_0x984d('0x22')]);}_0x1187a2[_0x984d('0x43')]=qs['sort'](_0xa67f68[_0x984d('0x3b')][_0x984d('0x44')]);_0x1187a2[_0x984d('0x45')]=qs[_0x984d('0x3c')](_[_0x984d('0x46')](_0xa67f68[_0x984d('0x3b')],_0x1374e0['filters']),_0x343cc5);if(_0xa67f68[_0x984d('0x3b')]['filter']){_0x1187a2[_0x984d('0x45')]=_[_0x984d('0x47')](_0x1187a2['where'],{'$or':_[_0x984d('0x34')](_0x343cc5,function(_0x218b27){if(_0x218b27[_0x984d('0x48')]!=='VIRTUAL'){var _0x1a49a2={};_0x1a49a2[_0x218b27[_0x984d('0x31')]]={'$like':'%'+_0xa67f68[_0x984d('0x3b')]['filter']+'%'};return _0x1a49a2;}})});}_0x1187a2=_[_0x984d('0x47')]({},_0x1187a2,_0xa67f68[_0x984d('0x49')]);var _0x4d61cc={'where':_0x1187a2[_0x984d('0x45')]};return db[_0x984d('0x35')][_0x984d('0x24')](_0x4d61cc)[_0x984d('0x29')](function(_0x58453a){_0xb625f5['count']=_0x58453a;if(_0xa67f68[_0x984d('0x3b')][_0x984d('0x4a')]){_0x1187a2[_0x984d('0x4b')]=[{'all':!![]}];}return db[_0x984d('0x35')][_0x984d('0x4c')](_0x1187a2);})[_0x984d('0x29')](function(_0x3f2c18){_0xb625f5[_0x984d('0x4d')]=_0x3f2c18;return _0xb625f5;})[_0x984d('0x29')](respondWithFilteredResult(_0x35c8bb,_0x1187a2))['catch'](handleError(_0x35c8bb,null));};exports['show']=function(_0x5c3888,_0x4e3152){var _0x1462bf={'raw':!![],'where':{'id':_0x5c3888[_0x984d('0x4e')]['id']}},_0x211cf7={};_0x211cf7[_0x984d('0x39')]=_[_0x984d('0x3a')](db['FaxQueue'][_0x984d('0x36')]);_0x211cf7[_0x984d('0x3b')]=_[_0x984d('0x3a')](_0x5c3888['query']);_0x211cf7[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x211cf7['model'],_0x211cf7[_0x984d('0x3b')]);_0x1462bf['attributes']=_[_0x984d('0x3d')](_0x211cf7[_0x984d('0x39')],qs[_0x984d('0x3f')](_0x5c3888[_0x984d('0x3b')][_0x984d('0x3f')]));_0x1462bf[_0x984d('0x3e')]=_0x1462bf[_0x984d('0x3e')]['length']?_0x1462bf[_0x984d('0x3e')]:_0x211cf7['model'];if(_0x5c3888['query'][_0x984d('0x4a')]){_0x1462bf[_0x984d('0x4b')]=[{'all':!![]}];}_0x1462bf=_[_0x984d('0x47')]({},_0x1462bf,_0x5c3888['options']);return db[_0x984d('0x35')]['find'](_0x1462bf)[_0x984d('0x29')](handleEntityNotFound(_0x4e3152,null))[_0x984d('0x29')](respondWithResult(_0x4e3152,null))[_0x984d('0x4f')](handleError(_0x4e3152,null));};exports[_0x984d('0x50')]=function(_0x288a53,_0x40cbaa){return db[_0x984d('0x35')][_0x984d('0x50')](_0x288a53[_0x984d('0x51')],{})[_0x984d('0x29')](function(_0x24ffee){var _0x432ed9=_0x288a53[_0x984d('0x52')][_0x984d('0x2b')]({'plain':!![]});if(!_0x432ed9)throw new Error(_0x984d('0x53'));if(_0x432ed9[_0x984d('0x54')]===_0x984d('0x52')){var _0x17f027=_0x24ffee['get']({'plain':!![]});var _0x504558=_0x984d('0x2c');return db[_0x984d('0x55')]['find']({'where':{'name':_0x504558,'userProfileId':_0x432ed9[_0x984d('0x56')]},'raw':!![]})['then'](function(_0x152db5){if(_0x152db5&&_0x152db5['autoAssociation']===0x0){return db[_0x984d('0x2d')]['create']({'name':_0x17f027['name'],'resourceId':_0x17f027['id'],'type':_0x152db5[_0x984d('0x31')],'sectionId':_0x152db5['id']},{})[_0x984d('0x29')](function(){return _0x24ffee;});}else{return _0x24ffee;}})[_0x984d('0x4f')](function(_0xd3b492){logger['error'](_0x984d('0x57'),_0xd3b492);throw _0xd3b492;});}return _0x24ffee;})[_0x984d('0x29')](respondWithResult(_0x40cbaa,0xc9))[_0x984d('0x4f')](handleError(_0x40cbaa,null));};exports[_0x984d('0x28')]=function(_0xebfca5,_0x343aae){if(_0xebfca5[_0x984d('0x51')]['id']){delete _0xebfca5[_0x984d('0x51')]['id'];}return db[_0x984d('0x35')]['find']({'where':{'id':_0xebfca5['params']['id']}})['then'](handleEntityNotFound(_0x343aae,null))[_0x984d('0x29')](saveUpdates(_0xebfca5[_0x984d('0x51')],null))[_0x984d('0x29')](respondWithResult(_0x343aae,null))[_0x984d('0x4f')](handleError(_0x343aae,null));};exports[_0x984d('0x2a')]=function(_0x2f2e7b,_0x1b9d46){return db[_0x984d('0x35')][_0x984d('0x58')]({'where':{'id':_0x2f2e7b[_0x984d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1b9d46,null))[_0x984d('0x29')](removeEntity(_0x1b9d46,null))[_0x984d('0x4f')](handleError(_0x1b9d46,null));};exports[_0x984d('0x59')]=function(_0x5d0494,_0x216b40){return db[_0x984d('0x35')][_0x984d('0x59')]()[_0x984d('0x29')](respondWithResult(_0x216b40,null))[_0x984d('0x4f')](handleError(_0x216b40,null));};exports['getMembers']=function(_0x5786ea,_0x1d4efd,_0x1d6b8c){var _0x5ed201={'raw':!![],'where':{}},_0x2e7fdb={},_0x26e049;return db['FaxQueue'][_0x984d('0x5a')]({'where':{'id':_0x5786ea['params']['id']}})['then'](handleEntityNotFound(_0x1d4efd,null))[_0x984d('0x29')](function(_0x5509e4){if(_0x5509e4){_0x26e049=_0x5509e4[_0x984d('0x2b')]({'plain':!![]});_0x2e7fdb[_0x984d('0x39')]=_[_0x984d('0x3a')](db[_0x984d('0x5b')][_0x984d('0x36')]);_0x2e7fdb['query']=_['keys'](_0x5786ea['query']);_0x2e7fdb[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0x2e7fdb[_0x984d('0x39')],_0x2e7fdb[_0x984d('0x3b')]);_0x5ed201[_0x984d('0x3e')]=_[_0x984d('0x3d')](_0x2e7fdb['model'],qs['fields'](_0x5786ea['query']['fields']));_0x5ed201[_0x984d('0x3e')]=_0x5ed201[_0x984d('0x3e')][_0x984d('0x5c')]?_0x5ed201[_0x984d('0x3e')]:_0x2e7fdb[_0x984d('0x39')];if(!_0x5786ea['query'][_0x984d('0x40')](_0x984d('0x41'))){_0x5ed201[_0x984d('0x42')]=qs[_0x984d('0x42')](_0x5786ea[_0x984d('0x3b')][_0x984d('0x42')]);_0x5ed201[_0x984d('0x22')]=qs[_0x984d('0x22')](_0x5786ea[_0x984d('0x3b')][_0x984d('0x22')]);}_0x5ed201['order']=qs['sort'](_0x5786ea[_0x984d('0x3b')][_0x984d('0x44')]);_0x5ed201[_0x984d('0x45')]=qs[_0x984d('0x3c')](_['pick'](_0x5786ea[_0x984d('0x3b')],_0x2e7fdb['filters']));_0x5ed201['where'][_0x984d('0x5d')]=_0x5509e4['id'];if(_0x5786ea[_0x984d('0x3b')]['filter']){_0x5ed201[_0x984d('0x45')]=_[_0x984d('0x47')](_0x5ed201['where'],{'$or':_[_0x984d('0x34')](_0x5ed201['attributes'],function(_0x3a1018){var _0x246618={};_0x246618[_0x3a1018]={'$like':'%'+_0x5786ea['query']['filter']+'%'};return _0x246618;})});}_0x5ed201=_[_0x984d('0x47')]({},_0x5ed201,_0x5786ea[_0x984d('0x49')]);return db['UserFaxQueue'][_0x984d('0x4c')](_0x5ed201);}})['then'](function(_0x1b9beb){if(_0x1b9beb){return db[_0x984d('0x5e')][_0x984d('0x5f')]({'where':{'id':_['map'](_0x1b9beb,_0x984d('0x60')),'role':_0x984d('0x61')},'attributes':['id','name',_0x984d('0x62'),_0x984d('0x63'),_0x984d('0x64')]});}})[_0x984d('0x29')](function(_0x401773){if(_0x401773){return{'count':_0x401773['count'],'rows':_[_0x984d('0x34')](_0x401773[_0x984d('0x4d')],function(_0x34fa4f){return{'membername':_0x34fa4f['name'],'UserId':_0x34fa4f['id'],'queue_name':_0x26e049[_0x984d('0x31')],'FaxQueueId':_0x26e049['id'],'interface':util['format']('%s/%s','SIP',_0x34fa4f[_0x984d('0x31')]),'penalty':0x0,'paused':_0x34fa4f[_0x984d('0x62')],'createdAt':_0x34fa4f[_0x984d('0x64')],'updatedAt':_0x34fa4f[_0x984d('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x984d('0x29')](respondWithFilteredResult(_0x1d4efd,_0x5ed201))[_0x984d('0x4f')](handleError(_0x1d4efd,null));};exports[_0x984d('0x65')]=function(_0x383f98,_0x4354f4,_0xe33747){var _0xb84747={};var _0xd88ec1={};var _0xa4c79e;var _0x50dc81;return db[_0x984d('0x35')][_0x984d('0x5a')]({'where':{'id':_0x383f98[_0x984d('0x4e')]['id']}})[_0x984d('0x29')](handleEntityNotFound(_0x4354f4,null))['then'](function(_0x54e05e){if(_0x54e05e){_0xa4c79e=_0x54e05e;_0xd88ec1[_0x984d('0x39')]=_['keys'](db[_0x984d('0x66')]['rawAttributes']);_0xd88ec1['query']=_[_0x984d('0x3a')](_0x383f98[_0x984d('0x3b')]);_0xd88ec1[_0x984d('0x3c')]=_[_0x984d('0x3d')](_0xd88ec1[_0x984d('0x39')],_0xd88ec1['query']);_0xb84747[_0x984d('0x3e')]=_['intersection'](_0xd88ec1[_0x984d('0x39')],qs[_0x984d('0x3f')](_0x383f98['query'][_0x984d('0x3f')]));_0xb84747[_0x984d('0x3e')]=_0xb84747[_0x984d('0x3e')]['length']?_0xb84747[_0x984d('0x3e')]:_0xd88ec1['model'];_0xb84747['order']=qs['sort'](_0x383f98[_0x984d('0x3b')][_0x984d('0x44')]);_0xb84747[_0x984d('0x45')]=qs[_0x984d('0x3c')](_[_0x984d('0x46')](_0x383f98[_0x984d('0x3b')],_0xd88ec1['filters']));if(_0x383f98[_0x984d('0x3b')][_0x984d('0x67')]){_0xb84747['where']=_['merge'](_0xb84747[_0x984d('0x45')],{'$or':_[_0x984d('0x34')](_0xb84747[_0x984d('0x3e')],function(_0x126a43){var _0x29e4ad={};_0x29e4ad[_0x126a43]={'$like':'%'+_0x383f98[_0x984d('0x3b')][_0x984d('0x67')]+'%'};return _0x29e4ad;})});}_0xb84747=_[_0x984d('0x47')]({},_0xb84747,_0x383f98[_0x984d('0x49')]);return _0xa4c79e[_0x984d('0x65')](_0xb84747);}})['then'](function(_0x900f4f){if(_0x900f4f){_0x50dc81=_0x900f4f[_0x984d('0x5c')];if(!_0x383f98[_0x984d('0x3b')]['hasOwnProperty'](_0x984d('0x41'))){_0xb84747[_0x984d('0x42')]=qs['limit'](_0x383f98[_0x984d('0x3b')]['limit']);_0xb84747['offset']=qs[_0x984d('0x22')](_0x383f98[_0x984d('0x3b')][_0x984d('0x22')]);}return _0xa4c79e['getTeams'](_0xb84747);}})[_0x984d('0x29')](function(_0x4d9ce7){if(_0x4d9ce7){return _0x4d9ce7?{'count':_0x50dc81,'rows':_0x4d9ce7}:null;}})[_0x984d('0x29')](respondWithResult(_0x4354f4,null))[_0x984d('0x4f')](handleError(_0x4354f4,null));};exports[_0x984d('0x68')]=function(_0x27bebe,_0x4ed649,_0x3b6168){var _0x5c1bf3=_0x27bebe['body'][_0x984d('0x69')];return db[_0x984d('0x66')][_0x984d('0x4c')]({'where':{'id':_0x5c1bf3},'attributes':['id'],'include':[{'model':db[_0x984d('0x5e')],'as':_0x984d('0x6a'),'attributes':['id','name',_0x984d('0x6b'),_0x984d('0x6c'),'interface'],'raw':!![]}]})['then'](function(_0x4e5c24){if(_0x4e5c24){var _0x437b1a=_[_0x984d('0x6d')](_0x4e5c24,function(_0x26efd0){var _0x5002cf=_0x26efd0[_0x984d('0x2b')]({'plain':!![]});return _0x5002cf['Agents'];});return db['FaxQueue'][_0x984d('0x58')]({'where':{'id':_0x27bebe[_0x984d('0x4e')]['id']}})[_0x984d('0x29')](function(_0xa220e3){return db[_0x984d('0x6e')][_0x984d('0x6f')](function(_0xa549b){return _0xa220e3[_0x984d('0x68')](_0x5c1bf3,{'transaction':_0xa549b})[_0x984d('0x29')](function(){return BPromise[_0x984d('0x70')](_0x437b1a,function(_0x91ceca){return db[_0x984d('0x5b')][_0x984d('0x71')]({'where':{'UserId':_0x91ceca['id'],'FaxQueueId':_0x27bebe[_0x984d('0x4e')]['id']},'transaction':_0xa549b});});})[_0x984d('0x29')](function(){_0x437b1a[_0x984d('0x72')](function(_0x5dbb2d){socket['emit'](_0x984d('0x73'),{'UserId':_0x5dbb2d['id'],'FaxQueueId':_0xa220e3['id']});});});});});}})[_0x984d('0x29')](respondWithStatusCode(_0x4ed649,null))[_0x984d('0x4f')](handleError(_0x4ed649,null));};exports[_0x984d('0x74')]=function(_0x3ae0e4,_0x2d7e91,_0x36765b){return db['Team']['findAll']({'where':{'id':_0x3ae0e4['query'][_0x984d('0x69')]},'attributes':['id'],'include':[{'model':db[_0x984d('0x5e')],'as':_0x984d('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x984d('0x29')](handleEntityNotFound(_0x2d7e91,null))[_0x984d('0x29')](function(_0x400080){var _0xb4cd53=_[_0x984d('0x34')](_0x400080,'id');var _0x2e7046=[];var _0x556117=[];var _0x20bbea=squel[_0x984d('0x75')]();_0x20bbea[_0x984d('0x76')](_0x984d('0x77'))['from'](_0x984d('0x78'),'tq')[_0x984d('0x79')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x984d('0x7a'),_0x3ae0e4[_0x984d('0x4e')]['id']);for(var _0x506669=0x0;_0x506669<_0x400080[_0x984d('0x5c')];_0x506669+=0x1){let _0xa59f1d=_0x400080[_0x506669];for(var _0x39cfd9=0x0;_0x39cfd9<_0xa59f1d[_0x984d('0x6a')]['length'];_0x39cfd9+=0x1){let _0x5c633f=_0xa59f1d['Agents'][_0x39cfd9];var _0x2ca6a1=_0x20bbea[_0x984d('0x7b')]();_0x2ca6a1[_0x984d('0x45')](_0x984d('0x7c'),_0x5c633f['id']);_0x556117['push'](db[_0x984d('0x6e')][_0x984d('0x3b')](_0x2ca6a1[_0x984d('0x7d')](),{'type':db[_0x984d('0x6e')]['QueryTypes'][_0x984d('0x7e')]})[_0x984d('0x29')](function(_0x404b7d){if(_0x404b7d[_0x984d('0x5c')]===0x1){return _0x5c633f['id'];}else{var _0x49b111=_[_0x984d('0x7f')](_['map'](_0x404b7d,'TeamId'),function(_0xa29f18){return _[_0x984d('0x80')](_0xb4cd53,_0xa29f18);});if(_0x49b111){return _0x5c633f['id'];}}}));}}return BPromise[_0x984d('0x81')](_0x556117)[_0x984d('0x29')](function(_0xd5f722){_0x2e7046=_(_0x2e7046)[_0x984d('0x82')](_0xd5f722)['compact']()[_0x984d('0x83')]();return db[_0x984d('0x35')][_0x984d('0x58')]({'where':{'id':_0x3ae0e4['params']['id']}})[_0x984d('0x29')](function(_0x1d7633){return db['sequelize'][_0x984d('0x6f')](function(_0x149c41){return _0x1d7633[_0x984d('0x74')](_0x3ae0e4[_0x984d('0x3b')][_0x984d('0x69')],{'transaction':_0x149c41})[_0x984d('0x29')](function(){if(!_[_0x984d('0x84')](_0x2e7046)){return _0x1d7633[_0x984d('0x85')](_0x2e7046,{'transaction':_0x149c41});}})['then'](function(){_0x2e7046[_0x984d('0x72')](function(_0x3e336b){socket['emit'](_0x984d('0x86'),{'UserId':_0x3e336b,'FaxQueueId':_0x1d7633['id']});});});});});});})['then'](respondWithStatusCode(_0x2d7e91,null))[_0x984d('0x4f')](handleError(_0x2d7e91,null));};exports[_0x984d('0x87')]=function(_0x3305c8,_0x1cc203,_0x30505f){return db[_0x984d('0x35')][_0x984d('0x58')]({'where':{'id':_0x3305c8[_0x984d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1cc203,null))[_0x984d('0x29')](function(_0x24a05f){if(_0x24a05f){return _0x24a05f[_0x984d('0x87')](_0x3305c8[_0x984d('0x51')][_0x984d('0x69')],_['omit'](_0x3305c8[_0x984d('0x51')],['ids','id'])||{})['spread'](function(_0x21aa79){for(var _0x4356e5=0x0;_0x4356e5<_0x3305c8[_0x984d('0x51')][_0x984d('0x69')][_0x984d('0x5c')];_0x4356e5+=0x1){socket[_0x984d('0x88')](_0x984d('0x73'),{'UserId':Number(_0x3305c8[_0x984d('0x51')]['ids'][_0x4356e5]),'FaxQueueId':Number(_0x3305c8['params']['id'])});}return _0x21aa79;});}})[_0x984d('0x29')](respondWithResult(_0x1cc203,null))[_0x984d('0x4f')](handleError(_0x1cc203,null));};exports[_0x984d('0x85')]=function(_0x38f3e2,_0x1dc1ca,_0xb33298){return db['FaxQueue'][_0x984d('0x58')]({'where':{'id':_0x38f3e2[_0x984d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1dc1ca,null))[_0x984d('0x29')](function(_0x5ca174){if(_0x5ca174){return _0x5ca174[_0x984d('0x85')](_0x38f3e2[_0x984d('0x3b')][_0x984d('0x69')])[_0x984d('0x29')](function(){if(_[_0x984d('0x89')](_0x38f3e2['query'][_0x984d('0x69')])){for(var _0x235ae4=0x0;_0x235ae4<_0x38f3e2[_0x984d('0x3b')][_0x984d('0x69')]['length'];_0x235ae4+=0x1){socket[_0x984d('0x88')](_0x984d('0x86'),{'UserId':Number(_0x38f3e2[_0x984d('0x3b')][_0x984d('0x69')][_0x235ae4]),'FaxQueueId':Number(_0x38f3e2[_0x984d('0x4e')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x38f3e2[_0x984d('0x3b')][_0x984d('0x69')]),'FaxQueueId':Number(_0x38f3e2['params']['id'])});}});}})[_0x984d('0x29')](respondWithStatusCode(_0x1dc1ca,null))[_0x984d('0x4f')](handleError(_0x1dc1ca,null));};exports[_0x984d('0x8a')]=function(_0x10956e,_0x279cb0,_0x33bc93){var _0x29de08={};var _0x40d5c5={};var _0x53fe4c;var _0x30bd9e;return db['FaxQueue'][_0x984d('0x5a')]({'where':{'id':_0x10956e[_0x984d('0x4e')]['id']}})[_0x984d('0x29')](handleEntityNotFound(_0x279cb0,null))['then'](function(_0x4e3938){if(_0x4e3938){_0x53fe4c=_0x4e3938;_0x40d5c5[_0x984d('0x39')]=_[_0x984d('0x3a')](db[_0x984d('0x5e')][_0x984d('0x36')]);_0x40d5c5[_0x984d('0x3b')]=_[_0x984d('0x3a')](_0x10956e[_0x984d('0x3b')]);_0x40d5c5['filters']=_[_0x984d('0x3d')](_0x40d5c5[_0x984d('0x39')],_0x40d5c5[_0x984d('0x3b')]);_0x29de08['attributes']=_['intersection'](_0x40d5c5[_0x984d('0x39')],qs[_0x984d('0x3f')](_0x10956e[_0x984d('0x3b')]['fields']));_0x29de08['attributes']=_0x29de08['attributes'][_0x984d('0x5c')]?_0x29de08[_0x984d('0x3e')]:_0x40d5c5[_0x984d('0x39')];_0x29de08['order']=qs[_0x984d('0x44')](_0x10956e[_0x984d('0x3b')][_0x984d('0x44')]);_0x29de08[_0x984d('0x45')]=qs[_0x984d('0x3c')](_['pick'](_0x10956e[_0x984d('0x3b')],_0x40d5c5[_0x984d('0x3c')]));if(_0x10956e[_0x984d('0x3b')][_0x984d('0x67')]){_0x29de08[_0x984d('0x45')]=_[_0x984d('0x47')](_0x29de08['where'],{'$or':_[_0x984d('0x34')](_0x29de08['attributes'],function(_0xcdeb49){var _0x2dfd58={};_0x2dfd58[_0xcdeb49]={'$like':'%'+_0x10956e['query']['filter']+'%'};return _0x2dfd58;})});}_0x29de08=_[_0x984d('0x47')]({},_0x29de08,_0x10956e[_0x984d('0x49')]);return _0x53fe4c[_0x984d('0x8a')](_0x29de08);}})['then'](function(_0x49bedd){if(_0x49bedd){_0x30bd9e=_0x49bedd['length'];if(!_0x10956e[_0x984d('0x3b')][_0x984d('0x40')](_0x984d('0x41'))){_0x29de08['limit']=qs[_0x984d('0x42')](_0x10956e[_0x984d('0x3b')][_0x984d('0x42')]);_0x29de08[_0x984d('0x22')]=qs[_0x984d('0x22')](_0x10956e[_0x984d('0x3b')][_0x984d('0x22')]);}return _0x53fe4c[_0x984d('0x8a')](_0x29de08);}})['then'](function(_0x160f60){if(_0x160f60){return _0x160f60?{'count':_0x30bd9e,'rows':_0x160f60}:null;}})[_0x984d('0x29')](respondWithResult(_0x279cb0,null))[_0x984d('0x4f')](handleError(_0x279cb0,null));}; \ No newline at end of file +var _0x7065=['isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','name','send','index','map','FaxQueue','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','show','params','length','options','find','catch','create','body','role','FaxQueues','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','agent','createdAt','rows','format','%s/%s','SIP','updatedAt','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','all','compact','isEmpty','userFaxQueue:remove','addAgents','omit','removeAgents'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7065,0x116));var _0x5706=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7065[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5706('0x0'));var rimraf=require(_0x5706('0x1'));var zipdir=require(_0x5706('0x2'));var jsonpatch=require(_0x5706('0x3'));var rp=require(_0x5706('0x4'));var moment=require(_0x5706('0x5'));var BPromise=require(_0x5706('0x6'));var Mustache=require(_0x5706('0x7'));var util=require('util');var path=require(_0x5706('0x8'));var sox=require(_0x5706('0x9'));var csv=require(_0x5706('0xa'));var ejs=require(_0x5706('0xb'));var fs=require('fs');var fs_extra=require(_0x5706('0xc'));var _=require('lodash');var squel=require(_0x5706('0xd'));var crypto=require(_0x5706('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5706('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5706('0x10'));var Redis=require(_0x5706('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5706('0x12'));var logger=require('../../config/logger')(_0x5706('0x13'));var utils=require(_0x5706('0x14'));var config=require(_0x5706('0x15'));var licenseUtil=require(_0x5706('0x16'));var db=require('../../mysqldb')['db'];config[_0x5706('0x17')]=_[_0x5706('0x18')](config[_0x5706('0x17')],{'host':_0x5706('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5706('0x1a'))['register'](socket);function respondWithStatusCode(_0x4f4beb,_0x2d58f7){_0x2d58f7=_0x2d58f7||0xcc;return function(_0x28b189){if(_0x28b189){return _0x4f4beb[_0x5706('0x1b')](_0x2d58f7);}return _0x4f4beb[_0x5706('0x1c')](_0x2d58f7)[_0x5706('0x1d')]();};}function respondWithResult(_0x24c75e,_0x13cb71){_0x13cb71=_0x13cb71||0xc8;return function(_0xbd6152){if(_0xbd6152){return _0x24c75e['status'](_0x13cb71)[_0x5706('0x1e')](_0xbd6152);}};}function respondWithFilteredResult(_0xe1fae7,_0x40d0ba){return function(_0x3f86f9){if(_0x3f86f9){var _0x1f3140=typeof _0x40d0ba[_0x5706('0x1f')]==='undefined'&&typeof _0x40d0ba['limit']===_0x5706('0x20');var _0x1ca5e8=_0x3f86f9[_0x5706('0x21')];var _0x36be06=_0x1f3140?0x0:_0x40d0ba[_0x5706('0x1f')];var _0x45737a=_0x1f3140?_0x3f86f9[_0x5706('0x21')]:_0x40d0ba[_0x5706('0x1f')]+_0x40d0ba[_0x5706('0x22')];var _0x4dfb40;if(_0x45737a>=_0x1ca5e8){_0x45737a=_0x1ca5e8;_0x4dfb40=0xc8;}else{_0x4dfb40=0xce;}_0xe1fae7['status'](_0x4dfb40);return _0xe1fae7[_0x5706('0x23')](_0x5706('0x24'),_0x36be06+'-'+_0x45737a+'/'+_0x1ca5e8)[_0x5706('0x1e')](_0x3f86f9);}return null;};}function patchUpdates(_0x2a89dc){return function(_0x1a7d05){try{jsonpatch[_0x5706('0x25')](_0x1a7d05,_0x2a89dc,!![]);}catch(_0x4b9668){return BPromise['reject'](_0x4b9668);}return _0x1a7d05[_0x5706('0x26')]();};}function saveUpdates(_0x20bb46,_0x315d2d){return function(_0x474033){if(_0x474033){return _0x474033[_0x5706('0x27')](_0x20bb46)['then'](function(_0x4a35ed){return _0x4a35ed;});}return null;};}function removeEntity(_0x17ea28,_0x2d6331){return function(_0x1bb30e){if(_0x1bb30e){return _0x1bb30e[_0x5706('0x28')]()[_0x5706('0x29')](function(){var _0x1288e8=_0x1bb30e[_0x5706('0x2a')]({'plain':!![]});var _0x2b9f6f='FaxQueues';return db[_0x5706('0x2b')][_0x5706('0x28')]({'where':{'type':_0x2b9f6f,'resourceId':_0x1288e8['id']}})[_0x5706('0x29')](function(){return _0x1bb30e;});})[_0x5706('0x29')](function(){_0x17ea28[_0x5706('0x1c')](0xcc)[_0x5706('0x1d')]();});}};}function handleEntityNotFound(_0x5db4d7,_0x16be17){return function(_0xd3feae){if(!_0xd3feae){_0x5db4d7['sendStatus'](0x194);}return _0xd3feae;};}function handleError(_0x129edd,_0x46a32c){_0x46a32c=_0x46a32c||0x1f4;return function(_0x29640e){logger['error'](_0x29640e['stack']);if(_0x29640e['name']){delete _0x29640e[_0x5706('0x2c')];}_0x129edd[_0x5706('0x1c')](_0x46a32c)[_0x5706('0x2d')](_0x29640e);};}exports[_0x5706('0x2e')]=function(_0x5bfa89,_0x12411a){var _0x2cdb7c={},_0x2d3aa5={},_0x2c8a91={'count':0x0,'rows':[]};var _0x12df1b=_[_0x5706('0x2f')](db[_0x5706('0x30')][_0x5706('0x31')],function(_0x481b60){return{'name':_0x481b60[_0x5706('0x32')],'type':_0x481b60['type'][_0x5706('0x33')]};});_0x2d3aa5[_0x5706('0x34')]=_[_0x5706('0x2f')](_0x12df1b,_0x5706('0x2c'));_0x2d3aa5['query']=_[_0x5706('0x35')](_0x5bfa89[_0x5706('0x36')]);_0x2d3aa5[_0x5706('0x37')]=_[_0x5706('0x38')](_0x2d3aa5[_0x5706('0x34')],_0x2d3aa5[_0x5706('0x36')]);_0x2cdb7c[_0x5706('0x39')]=_[_0x5706('0x38')](_0x2d3aa5[_0x5706('0x34')],qs[_0x5706('0x3a')](_0x5bfa89[_0x5706('0x36')][_0x5706('0x3a')]));_0x2cdb7c['attributes']=_0x2cdb7c[_0x5706('0x39')]['length']?_0x2cdb7c[_0x5706('0x39')]:_0x2d3aa5[_0x5706('0x34')];if(!_0x5bfa89[_0x5706('0x36')][_0x5706('0x3b')]('nolimit')){_0x2cdb7c[_0x5706('0x22')]=qs['limit'](_0x5bfa89['query'][_0x5706('0x22')]);_0x2cdb7c[_0x5706('0x1f')]=qs[_0x5706('0x1f')](_0x5bfa89[_0x5706('0x36')][_0x5706('0x1f')]);}_0x2cdb7c[_0x5706('0x3c')]=qs[_0x5706('0x3d')](_0x5bfa89[_0x5706('0x36')]['sort']);_0x2cdb7c[_0x5706('0x3e')]=qs[_0x5706('0x37')](_[_0x5706('0x3f')](_0x5bfa89[_0x5706('0x36')],_0x2d3aa5[_0x5706('0x37')]),_0x12df1b);if(_0x5bfa89[_0x5706('0x36')][_0x5706('0x40')]){_0x2cdb7c[_0x5706('0x3e')]=_[_0x5706('0x41')](_0x2cdb7c[_0x5706('0x3e')],{'$or':_[_0x5706('0x2f')](_0x12df1b,function(_0x593728){if(_0x593728[_0x5706('0x42')]!==_0x5706('0x43')){var _0x3c08ae={};_0x3c08ae[_0x593728[_0x5706('0x2c')]]={'$like':'%'+_0x5bfa89['query'][_0x5706('0x40')]+'%'};return _0x3c08ae;}})});}_0x2cdb7c=_[_0x5706('0x41')]({},_0x2cdb7c,_0x5bfa89['options']);var _0x450f35={'where':_0x2cdb7c['where']};return db[_0x5706('0x30')]['count'](_0x450f35)[_0x5706('0x29')](function(_0x1be6d1){_0x2c8a91[_0x5706('0x21')]=_0x1be6d1;if(_0x5bfa89[_0x5706('0x36')][_0x5706('0x44')]){_0x2cdb7c['include']=[{'all':!![]}];}return db['FaxQueue'][_0x5706('0x45')](_0x2cdb7c);})[_0x5706('0x29')](function(_0x559550){_0x2c8a91['rows']=_0x559550;return _0x2c8a91;})['then'](respondWithFilteredResult(_0x12411a,_0x2cdb7c))['catch'](handleError(_0x12411a,null));};exports[_0x5706('0x46')]=function(_0x4be7b2,_0x256a2b){var _0x5519de={'raw':!![],'where':{'id':_0x4be7b2[_0x5706('0x47')]['id']}},_0x5d1a18={};_0x5d1a18[_0x5706('0x34')]=_[_0x5706('0x35')](db[_0x5706('0x30')][_0x5706('0x31')]);_0x5d1a18[_0x5706('0x36')]=_[_0x5706('0x35')](_0x4be7b2['query']);_0x5d1a18['filters']=_[_0x5706('0x38')](_0x5d1a18[_0x5706('0x34')],_0x5d1a18[_0x5706('0x36')]);_0x5519de[_0x5706('0x39')]=_[_0x5706('0x38')](_0x5d1a18[_0x5706('0x34')],qs[_0x5706('0x3a')](_0x4be7b2[_0x5706('0x36')]['fields']));_0x5519de[_0x5706('0x39')]=_0x5519de[_0x5706('0x39')][_0x5706('0x48')]?_0x5519de['attributes']:_0x5d1a18['model'];if(_0x4be7b2[_0x5706('0x36')][_0x5706('0x44')]){_0x5519de['include']=[{'all':!![]}];}_0x5519de=_['merge']({},_0x5519de,_0x4be7b2[_0x5706('0x49')]);return db[_0x5706('0x30')][_0x5706('0x4a')](_0x5519de)[_0x5706('0x29')](handleEntityNotFound(_0x256a2b,null))[_0x5706('0x29')](respondWithResult(_0x256a2b,null))[_0x5706('0x4b')](handleError(_0x256a2b,null));};exports[_0x5706('0x4c')]=function(_0x5538f9,_0x53556e){return db[_0x5706('0x30')]['create'](_0x5538f9[_0x5706('0x4d')],{})[_0x5706('0x29')](function(_0x158bab){var _0x52b5dd=_0x5538f9['user'][_0x5706('0x2a')]({'plain':!![]});if(!_0x52b5dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x52b5dd[_0x5706('0x4e')]==='user'){var _0x1f7763=_0x158bab[_0x5706('0x2a')]({'plain':!![]});var _0x51581f=_0x5706('0x4f');return db[_0x5706('0x50')]['find']({'where':{'name':_0x51581f,'userProfileId':_0x52b5dd[_0x5706('0x51')]},'raw':!![]})['then'](function(_0x565971){if(_0x565971&&_0x565971[_0x5706('0x52')]===0x0){return db[_0x5706('0x2b')][_0x5706('0x4c')]({'name':_0x1f7763[_0x5706('0x2c')],'resourceId':_0x1f7763['id'],'type':_0x565971[_0x5706('0x2c')],'sectionId':_0x565971['id']},{})[_0x5706('0x29')](function(){return _0x158bab;});}else{return _0x158bab;}})[_0x5706('0x4b')](function(_0x16c279){logger[_0x5706('0x53')](_0x5706('0x54'),_0x16c279);throw _0x16c279;});}return _0x158bab;})[_0x5706('0x29')](respondWithResult(_0x53556e,0xc9))[_0x5706('0x4b')](handleError(_0x53556e,null));};exports[_0x5706('0x27')]=function(_0x1d7408,_0x23bf20){if(_0x1d7408[_0x5706('0x4d')]['id']){delete _0x1d7408[_0x5706('0x4d')]['id'];}return db[_0x5706('0x30')][_0x5706('0x4a')]({'where':{'id':_0x1d7408['params']['id']}})[_0x5706('0x29')](handleEntityNotFound(_0x23bf20,null))['then'](saveUpdates(_0x1d7408[_0x5706('0x4d')],null))['then'](respondWithResult(_0x23bf20,null))['catch'](handleError(_0x23bf20,null));};exports['destroy']=function(_0x36cfb0,_0x16fea0){return db[_0x5706('0x30')]['find']({'where':{'id':_0x36cfb0[_0x5706('0x47')]['id']}})['then'](handleEntityNotFound(_0x16fea0,null))[_0x5706('0x29')](removeEntity(_0x16fea0,null))['catch'](handleError(_0x16fea0,null));};exports[_0x5706('0x55')]=function(_0x497c96,_0x1a6644){return db[_0x5706('0x30')][_0x5706('0x55')]()[_0x5706('0x29')](respondWithResult(_0x1a6644,null))[_0x5706('0x4b')](handleError(_0x1a6644,null));};exports[_0x5706('0x56')]=function(_0x46a145,_0x3d45ef,_0x2f5559){var _0x296b37={'raw':!![],'where':{}},_0x49da60={},_0x594ccc;return db[_0x5706('0x30')][_0x5706('0x57')]({'where':{'id':_0x46a145['params']['id']}})[_0x5706('0x29')](handleEntityNotFound(_0x3d45ef,null))['then'](function(_0x53ac93){if(_0x53ac93){_0x594ccc=_0x53ac93[_0x5706('0x2a')]({'plain':!![]});_0x49da60[_0x5706('0x34')]=_[_0x5706('0x35')](db[_0x5706('0x58')][_0x5706('0x31')]);_0x49da60['query']=_[_0x5706('0x35')](_0x46a145[_0x5706('0x36')]);_0x49da60['filters']=_[_0x5706('0x38')](_0x49da60['model'],_0x49da60[_0x5706('0x36')]);_0x296b37[_0x5706('0x39')]=_[_0x5706('0x38')](_0x49da60['model'],qs[_0x5706('0x3a')](_0x46a145[_0x5706('0x36')][_0x5706('0x3a')]));_0x296b37['attributes']=_0x296b37['attributes'][_0x5706('0x48')]?_0x296b37['attributes']:_0x49da60[_0x5706('0x34')];if(!_0x46a145['query'][_0x5706('0x3b')](_0x5706('0x59'))){_0x296b37[_0x5706('0x22')]=qs[_0x5706('0x22')](_0x46a145[_0x5706('0x36')][_0x5706('0x22')]);_0x296b37[_0x5706('0x1f')]=qs[_0x5706('0x1f')](_0x46a145[_0x5706('0x36')][_0x5706('0x1f')]);}_0x296b37[_0x5706('0x3c')]=qs[_0x5706('0x3d')](_0x46a145['query'][_0x5706('0x3d')]);_0x296b37[_0x5706('0x3e')]=qs['filters'](_['pick'](_0x46a145[_0x5706('0x36')],_0x49da60[_0x5706('0x37')]));_0x296b37[_0x5706('0x3e')][_0x5706('0x5a')]=_0x53ac93['id'];if(_0x46a145[_0x5706('0x36')]['filter']){_0x296b37['where']=_[_0x5706('0x41')](_0x296b37['where'],{'$or':_['map'](_0x296b37[_0x5706('0x39')],function(_0x252b85){var _0x34e861={};_0x34e861[_0x252b85]={'$like':'%'+_0x46a145[_0x5706('0x36')][_0x5706('0x40')]+'%'};return _0x34e861;})});}_0x296b37=_[_0x5706('0x41')]({},_0x296b37,_0x46a145[_0x5706('0x49')]);return db[_0x5706('0x58')][_0x5706('0x45')](_0x296b37);}})['then'](function(_0x3a0454){if(_0x3a0454){return db[_0x5706('0x5b')]['findAndCountAll']({'where':{'id':_[_0x5706('0x2f')](_0x3a0454,'UserId'),'role':_0x5706('0x5c')},'attributes':['id','name','faxPause','updatedAt',_0x5706('0x5d')]});}})[_0x5706('0x29')](function(_0x4f08c5){if(_0x4f08c5){return{'count':_0x4f08c5['count'],'rows':_[_0x5706('0x2f')](_0x4f08c5[_0x5706('0x5e')],function(_0x1d7815){return{'membername':_0x1d7815['name'],'UserId':_0x1d7815['id'],'queue_name':_0x594ccc[_0x5706('0x2c')],'FaxQueueId':_0x594ccc['id'],'interface':util[_0x5706('0x5f')](_0x5706('0x60'),_0x5706('0x61'),_0x1d7815['name']),'penalty':0x0,'paused':_0x1d7815['faxPause'],'createdAt':_0x1d7815[_0x5706('0x5d')],'updatedAt':_0x1d7815[_0x5706('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5706('0x29')](respondWithFilteredResult(_0x3d45ef,_0x296b37))[_0x5706('0x4b')](handleError(_0x3d45ef,null));};exports['getTeams']=function(_0x292cc9,_0x103a32,_0x10285c){var _0x436a18={};var _0x49985e={};var _0x34014d;var _0x4487cd;return db[_0x5706('0x30')]['findOne']({'where':{'id':_0x292cc9[_0x5706('0x47')]['id']}})[_0x5706('0x29')](handleEntityNotFound(_0x103a32,null))[_0x5706('0x29')](function(_0x581b3d){if(_0x581b3d){_0x34014d=_0x581b3d;_0x49985e[_0x5706('0x34')]=_[_0x5706('0x35')](db[_0x5706('0x63')]['rawAttributes']);_0x49985e[_0x5706('0x36')]=_[_0x5706('0x35')](_0x292cc9[_0x5706('0x36')]);_0x49985e[_0x5706('0x37')]=_['intersection'](_0x49985e['model'],_0x49985e[_0x5706('0x36')]);_0x436a18['attributes']=_[_0x5706('0x38')](_0x49985e[_0x5706('0x34')],qs['fields'](_0x292cc9[_0x5706('0x36')]['fields']));_0x436a18[_0x5706('0x39')]=_0x436a18[_0x5706('0x39')][_0x5706('0x48')]?_0x436a18[_0x5706('0x39')]:_0x49985e['model'];_0x436a18[_0x5706('0x3c')]=qs[_0x5706('0x3d')](_0x292cc9['query']['sort']);_0x436a18[_0x5706('0x3e')]=qs[_0x5706('0x37')](_[_0x5706('0x3f')](_0x292cc9[_0x5706('0x36')],_0x49985e[_0x5706('0x37')]));if(_0x292cc9['query'][_0x5706('0x40')]){_0x436a18[_0x5706('0x3e')]=_[_0x5706('0x41')](_0x436a18[_0x5706('0x3e')],{'$or':_[_0x5706('0x2f')](_0x436a18[_0x5706('0x39')],function(_0x49db79){var _0x36ab44={};_0x36ab44[_0x49db79]={'$like':'%'+_0x292cc9['query'][_0x5706('0x40')]+'%'};return _0x36ab44;})});}_0x436a18=_[_0x5706('0x41')]({},_0x436a18,_0x292cc9[_0x5706('0x49')]);return _0x34014d['getTeams'](_0x436a18);}})[_0x5706('0x29')](function(_0x400fda){if(_0x400fda){_0x4487cd=_0x400fda['length'];if(!_0x292cc9[_0x5706('0x36')]['hasOwnProperty'](_0x5706('0x59'))){_0x436a18[_0x5706('0x22')]=qs[_0x5706('0x22')](_0x292cc9[_0x5706('0x36')][_0x5706('0x22')]);_0x436a18[_0x5706('0x1f')]=qs[_0x5706('0x1f')](_0x292cc9['query'][_0x5706('0x1f')]);}return _0x34014d[_0x5706('0x64')](_0x436a18);}})[_0x5706('0x29')](function(_0x2e72d2){if(_0x2e72d2){return _0x2e72d2?{'count':_0x4487cd,'rows':_0x2e72d2}:null;}})[_0x5706('0x29')](respondWithResult(_0x103a32,null))[_0x5706('0x4b')](handleError(_0x103a32,null));};exports[_0x5706('0x65')]=function(_0x457bec,_0x2bc56b,_0x1026cd){var _0x1b37a0=_0x457bec['body'][_0x5706('0x66')];return db[_0x5706('0x63')][_0x5706('0x45')]({'where':{'id':_0x1b37a0},'attributes':['id'],'include':[{'model':db[_0x5706('0x5b')],'as':_0x5706('0x67'),'attributes':['id',_0x5706('0x2c'),_0x5706('0x68'),_0x5706('0x69'),_0x5706('0x6a')],'raw':!![]}]})['then'](function(_0x4551b6){if(_0x4551b6){var _0x678a72=_[_0x5706('0x6b')](_0x4551b6,function(_0x334d24){var _0x26f846=_0x334d24[_0x5706('0x2a')]({'plain':!![]});return _0x26f846[_0x5706('0x67')];});return db['FaxQueue'][_0x5706('0x4a')]({'where':{'id':_0x457bec[_0x5706('0x47')]['id']}})[_0x5706('0x29')](function(_0x11058d){return db[_0x5706('0x6c')][_0x5706('0x6d')](function(_0x2e45a1){return _0x11058d['addTeams'](_0x1b37a0,{'transaction':_0x2e45a1})[_0x5706('0x29')](function(){return BPromise[_0x5706('0x6e')](_0x678a72,function(_0x58fe8d){return db[_0x5706('0x58')][_0x5706('0x6f')]({'where':{'UserId':_0x58fe8d['id'],'FaxQueueId':_0x457bec[_0x5706('0x47')]['id']},'transaction':_0x2e45a1});});})[_0x5706('0x29')](function(){_0x678a72[_0x5706('0x70')](function(_0x9265e7){socket[_0x5706('0x71')](_0x5706('0x72'),{'UserId':_0x9265e7['id'],'FaxQueueId':_0x11058d['id']});});});});});}})[_0x5706('0x29')](respondWithStatusCode(_0x2bc56b,null))[_0x5706('0x4b')](handleError(_0x2bc56b,null));};exports[_0x5706('0x73')]=function(_0x496fa6,_0x27289b,_0x263ae9){return db[_0x5706('0x63')][_0x5706('0x45')]({'where':{'id':_0x496fa6[_0x5706('0x36')][_0x5706('0x66')]},'attributes':['id'],'include':[{'model':db[_0x5706('0x5b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x27289b,null))[_0x5706('0x29')](function(_0x35e9a3){var _0x3b1f6a=_['map'](_0x35e9a3,'id');var _0x42c4e2=[];var _0x57e4b2=[];var _0x55583e=squel[_0x5706('0x74')]();_0x55583e[_0x5706('0x75')](_0x5706('0x76'))['from']('team_has_fax_queues','tq')[_0x5706('0x77')](_0x5706('0x78'),'ut',_0x5706('0x79'))[_0x5706('0x3e')](_0x5706('0x7a'),_0x496fa6[_0x5706('0x47')]['id']);for(var _0x9af919=0x0;_0x9af919<_0x35e9a3['length'];_0x9af919+=0x1){let _0x30f5dd=_0x35e9a3[_0x9af919];for(var _0x5f45e4=0x0;_0x5f45e4<_0x30f5dd[_0x5706('0x67')][_0x5706('0x48')];_0x5f45e4+=0x1){let _0x1ebb00=_0x30f5dd[_0x5706('0x67')][_0x5f45e4];var _0x586e82=_0x55583e[_0x5706('0x7b')]();_0x586e82[_0x5706('0x3e')](_0x5706('0x7c'),_0x1ebb00['id']);_0x57e4b2['push'](db[_0x5706('0x6c')][_0x5706('0x36')](_0x586e82[_0x5706('0x7d')](),{'type':db[_0x5706('0x6c')][_0x5706('0x7e')][_0x5706('0x7f')]})[_0x5706('0x29')](function(_0x593b8f){if(_0x593b8f['length']===0x1){return _0x1ebb00['id'];}else{var _0xe8c536=_['every'](_[_0x5706('0x2f')](_0x593b8f,_0x5706('0x80')),function(_0x21864e){return _['includes'](_0x3b1f6a,_0x21864e);});if(_0xe8c536){return _0x1ebb00['id'];}}}));}}return BPromise[_0x5706('0x81')](_0x57e4b2)[_0x5706('0x29')](function(_0x18ac34){_0x42c4e2=_(_0x42c4e2)['union'](_0x18ac34)[_0x5706('0x82')]()['value']();return db[_0x5706('0x30')][_0x5706('0x4a')]({'where':{'id':_0x496fa6[_0x5706('0x47')]['id']}})[_0x5706('0x29')](function(_0x4febbf){return db[_0x5706('0x6c')][_0x5706('0x6d')](function(_0x4c8692){return _0x4febbf['removeTeams'](_0x496fa6['query'][_0x5706('0x66')],{'transaction':_0x4c8692})[_0x5706('0x29')](function(){if(!_[_0x5706('0x83')](_0x42c4e2)){return _0x4febbf['removeAgents'](_0x42c4e2,{'transaction':_0x4c8692});}})['then'](function(){_0x42c4e2[_0x5706('0x70')](function(_0x518851){socket[_0x5706('0x71')](_0x5706('0x84'),{'UserId':_0x518851,'FaxQueueId':_0x4febbf['id']});});});});});});})[_0x5706('0x29')](respondWithStatusCode(_0x27289b,null))['catch'](handleError(_0x27289b,null));};exports[_0x5706('0x85')]=function(_0x320a6d,_0x1d6da3,_0x4b37da){return db[_0x5706('0x30')][_0x5706('0x4a')]({'where':{'id':_0x320a6d[_0x5706('0x47')]['id']}})[_0x5706('0x29')](handleEntityNotFound(_0x1d6da3,null))[_0x5706('0x29')](function(_0xd96512){if(_0xd96512){return _0xd96512[_0x5706('0x85')](_0x320a6d['body'][_0x5706('0x66')],_[_0x5706('0x86')](_0x320a6d[_0x5706('0x4d')],['ids','id'])||{})['spread'](function(_0x200080){for(var _0x4b7dd6=0x0;_0x4b7dd6<_0x320a6d[_0x5706('0x4d')][_0x5706('0x66')][_0x5706('0x48')];_0x4b7dd6+=0x1){socket['emit'](_0x5706('0x72'),{'UserId':Number(_0x320a6d['body'][_0x5706('0x66')][_0x4b7dd6]),'FaxQueueId':Number(_0x320a6d[_0x5706('0x47')]['id'])});}return _0x200080;});}})[_0x5706('0x29')](respondWithResult(_0x1d6da3,null))[_0x5706('0x4b')](handleError(_0x1d6da3,null));};exports[_0x5706('0x87')]=function(_0x5eca81,_0x20afee,_0x1bf963){return db[_0x5706('0x30')][_0x5706('0x4a')]({'where':{'id':_0x5eca81['params']['id']}})[_0x5706('0x29')](handleEntityNotFound(_0x20afee,null))['then'](function(_0x5cf98f){if(_0x5cf98f){return _0x5cf98f[_0x5706('0x87')](_0x5eca81[_0x5706('0x36')]['ids'])['then'](function(){if(_[_0x5706('0x88')](_0x5eca81['query'][_0x5706('0x66')])){for(var _0xe95dc4=0x0;_0xe95dc4<_0x5eca81[_0x5706('0x36')]['ids'][_0x5706('0x48')];_0xe95dc4+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x5eca81[_0x5706('0x36')][_0x5706('0x66')][_0xe95dc4]),'FaxQueueId':Number(_0x5eca81[_0x5706('0x47')]['id'])});}}else{socket['emit'](_0x5706('0x84'),{'UserId':Number(_0x5eca81['query']['ids']),'FaxQueueId':Number(_0x5eca81[_0x5706('0x47')]['id'])});}});}})[_0x5706('0x29')](respondWithStatusCode(_0x20afee,null))[_0x5706('0x4b')](handleError(_0x20afee,null));};exports[_0x5706('0x89')]=function(_0x3725de,_0x376013,_0x2a87c9){var _0x12bb6b={};var _0x3633c5={};var _0xedf293;var _0x22e27a;return db[_0x5706('0x30')][_0x5706('0x57')]({'where':{'id':_0x3725de['params']['id']}})[_0x5706('0x29')](handleEntityNotFound(_0x376013,null))['then'](function(_0x5a907f){if(_0x5a907f){_0xedf293=_0x5a907f;_0x3633c5[_0x5706('0x34')]=_[_0x5706('0x35')](db[_0x5706('0x5b')]['rawAttributes']);_0x3633c5['query']=_[_0x5706('0x35')](_0x3725de[_0x5706('0x36')]);_0x3633c5[_0x5706('0x37')]=_[_0x5706('0x38')](_0x3633c5[_0x5706('0x34')],_0x3633c5[_0x5706('0x36')]);_0x12bb6b[_0x5706('0x39')]=_[_0x5706('0x38')](_0x3633c5['model'],qs[_0x5706('0x3a')](_0x3725de[_0x5706('0x36')][_0x5706('0x3a')]));_0x12bb6b[_0x5706('0x39')]=_0x12bb6b[_0x5706('0x39')][_0x5706('0x48')]?_0x12bb6b[_0x5706('0x39')]:_0x3633c5[_0x5706('0x34')];_0x12bb6b[_0x5706('0x3c')]=qs[_0x5706('0x3d')](_0x3725de['query'][_0x5706('0x3d')]);_0x12bb6b[_0x5706('0x3e')]=qs['filters'](_[_0x5706('0x3f')](_0x3725de['query'],_0x3633c5[_0x5706('0x37')]));if(_0x3725de[_0x5706('0x36')][_0x5706('0x40')]){_0x12bb6b['where']=_[_0x5706('0x41')](_0x12bb6b[_0x5706('0x3e')],{'$or':_['map'](_0x12bb6b[_0x5706('0x39')],function(_0x1d7c91){var _0x268dd4={};_0x268dd4[_0x1d7c91]={'$like':'%'+_0x3725de['query'][_0x5706('0x40')]+'%'};return _0x268dd4;})});}_0x12bb6b=_[_0x5706('0x41')]({},_0x12bb6b,_0x3725de[_0x5706('0x49')]);return _0xedf293['getAgents'](_0x12bb6b);}})['then'](function(_0x56fbd8){if(_0x56fbd8){_0x22e27a=_0x56fbd8['length'];if(!_0x3725de[_0x5706('0x36')][_0x5706('0x3b')](_0x5706('0x59'))){_0x12bb6b[_0x5706('0x22')]=qs[_0x5706('0x22')](_0x3725de[_0x5706('0x36')][_0x5706('0x22')]);_0x12bb6b[_0x5706('0x1f')]=qs[_0x5706('0x1f')](_0x3725de['query']['offset']);}return _0xedf293[_0x5706('0x89')](_0x12bb6b);}})[_0x5706('0x29')](function(_0x2bc484){if(_0x2bc484){return _0x2bc484?{'count':_0x22e27a,'rows':_0x2bc484}:null;}})[_0x5706('0x29')](respondWithResult(_0x376013,null))['catch'](handleError(_0x376013,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index ab3d5fa..fef0ecb 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 _0xceba=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x12a66f,_0x30e98d){var _0x36a7d9=function(_0x235039){while(--_0x235039){_0x12a66f['push'](_0x12a66f['shift']());}};_0x36a7d9(++_0x30e98d);}(_0xceba,0x19f));var _0xaceb=function(_0x3ec02f,_0x21ae0f){_0x3ec02f=_0x3ec02f-0x0;var _0xe64fde=_0xceba[_0x3ec02f];return _0xe64fde;};'use strict';var EventEmitter=require(_0xaceb('0x0'));var FaxQueue=require(_0xaceb('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xaceb('0x2')](0x0);var events={'afterCreate':_0xaceb('0x3'),'afterUpdate':_0xaceb('0x4'),'afterDestroy':'remove'};function emitEvent(_0x35237c){return function(_0x4e3992,_0x3799d,_0x5f3466){FaxQueueEvents[_0xaceb('0x5')](_0x35237c+':'+_0x4e3992['id'],_0x4e3992);FaxQueueEvents[_0xaceb('0x5')](_0x35237c,_0x4e3992);_0x5f3466(null);};}for(var e in events){if(events[_0xaceb('0x6')](e)){var event=events[e];FaxQueue[_0xaceb('0x7')](e,emitEvent(event));}}module[_0xaceb('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0xa088=['hasOwnProperty','exports','events','FaxQueue','setMaxListeners','save','remove','emit'];(function(_0x3f1046,_0x3ce4fd){var _0x285ced=function(_0x8aeb05){while(--_0x8aeb05){_0x3f1046['push'](_0x3f1046['shift']());}};_0x285ced(++_0x3ce4fd);}(_0xa088,0x1aa));var _0x8a08=function(_0x556967,_0x15a6b6){_0x556967=_0x556967-0x0;var _0x3945d9=_0xa088[_0x556967];return _0x3945d9;};'use strict';var EventEmitter=require(_0x8a08('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x8a08('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8a08('0x2')](0x0);var events={'afterCreate':_0x8a08('0x3'),'afterUpdate':'update','afterDestroy':_0x8a08('0x4')};function emitEvent(_0x5a4cdb){return function(_0x568fad,_0x3aa06c,_0x409559){FaxQueueEvents['emit'](_0x5a4cdb+':'+_0x568fad['id'],_0x568fad);FaxQueueEvents[_0x8a08('0x5')](_0x5a4cdb,_0x568fad);_0x409559(null);};}for(var e in events){if(events[_0x8a08('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x8a08('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 4f32169..762af2e 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 _0x3867=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues'];(function(_0x5a1f44,_0x1f0c68){var _0x45bd64=function(_0x4ea456){while(--_0x4ea456){_0x5a1f44['push'](_0x5a1f44['shift']());}};_0x45bd64(++_0x1f0c68);}(_0x3867,0x68));var _0x7386=function(_0x324f1d,_0x47dcec){_0x324f1d=_0x324f1d-0x0;var _0x95be02=_0x3867[_0x324f1d];return _0x95be02;};'use strict';var _=require('lodash');var util=require(_0x7386('0x0'));var logger=require(_0x7386('0x1'))('api');var moment=require(_0x7386('0x2'));var BPromise=require(_0x7386('0x3'));var rp=require(_0x7386('0x4'));var fs=require('fs');var path=require(_0x7386('0x5'));var rimraf=require(_0x7386('0x6'));var config=require(_0x7386('0x7'));var attributes=require(_0x7386('0x8'));module[_0x7386('0x9')]=function(_0x14fb19,_0xf413c6){return _0x14fb19[_0x7386('0xa')](_0x7386('0xb'),attributes,{'tableName':_0x7386('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d8b=['../../config/environment','./faxQueue.attributes','exports','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x879540,_0x23ea86){var _0x17fe4c=function(_0x250399){while(--_0x250399){_0x879540['push'](_0x879540['shift']());}};_0x17fe4c(++_0x23ea86);}(_0x8d8b,0x143));var _0xb8d8=function(_0xde0c5b,_0x3408af){_0xde0c5b=_0xde0c5b-0x0;var _0x5a178c=_0x8d8b[_0xde0c5b];return _0x5a178c;};'use strict';var _=require(_0xb8d8('0x0'));var util=require(_0xb8d8('0x1'));var logger=require('../../config/logger')(_0xb8d8('0x2'));var moment=require(_0xb8d8('0x3'));var BPromise=require('bluebird');var rp=require(_0xb8d8('0x4'));var fs=require('fs');var path=require(_0xb8d8('0x5'));var rimraf=require(_0xb8d8('0x6'));var config=require(_0xb8d8('0x7'));var attributes=require(_0xb8d8('0x8'));module[_0xb8d8('0x9')]=function(_0x2e1471,_0xb8af1e){return _0x2e1471['define']('FaxQueue',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 c54101c..08cd3f4 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 _0x68eb=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','./faxQueue.socket','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetFaxQueue','options','where','attributes','include','map','model','debug','ShowFaxQueue','FaxQueue','raw','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x31e584,_0x4d9f7f){var _0x5686d0=function(_0x1f9e99){while(--_0x1f9e99){_0x31e584['push'](_0x31e584['shift']());}};_0x5686d0(++_0x4d9f7f);}(_0x68eb,0xaf));var _0xb68e=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0x68eb[_0x1bb6aa];return _0x2ef28e;};'use strict';var _=require('lodash');var util=require(_0xb68e('0x0'));var moment=require('moment');var BPromise=require(_0xb68e('0x1'));var rs=require(_0xb68e('0x2'));var fs=require('fs');var Redis=require(_0xb68e('0x3'));var db=require(_0xb68e('0x4'))['db'];var utils=require(_0xb68e('0x5'));var logger=require(_0xb68e('0x6'))('rpc');var config=require(_0xb68e('0x7'));var jayson=require(_0xb68e('0x8'));var client=jayson[_0xb68e('0x9')][_0xb68e('0xa')]({'port':0x232a});config['redis']=_[_0xb68e('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xb68e('0xc'))(new Redis(config[_0xb68e('0xd')]));require(_0xb68e('0xe'))['register'](socket);function respondWithRpcPromise(_0x5e246f,_0x479e26,_0xc07526){return new BPromise(function(_0x1ae30f,_0x3d32ed){return client['request'](_0x5e246f,_0xc07526)[_0xb68e('0xf')](function(_0x3b67bf){logger[_0xb68e('0x10')](_0xb68e('0x11'),_0x479e26,_0xb68e('0x12'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x479e26,_0xb68e('0x12'),JSON[_0xb68e('0x13')](_0x3b67bf));if(_0x3b67bf[_0xb68e('0x14')]){if(_0x3b67bf[_0xb68e('0x14')][_0xb68e('0x15')]===0x1f4){logger[_0xb68e('0x14')]('FaxQueue,\x20%s,\x20%s',_0x479e26,_0x3b67bf['error'][_0xb68e('0x16')]);return _0x3d32ed(_0x3b67bf[_0xb68e('0x14')]['message']);}logger['error'](_0xb68e('0x11'),_0x479e26,_0x3b67bf['error'][_0xb68e('0x16')]);return _0x1ae30f(_0x3b67bf[_0xb68e('0x14')][_0xb68e('0x16')]);}else{logger[_0xb68e('0x10')](_0xb68e('0x11'),_0x479e26,_0xb68e('0x12'));_0x1ae30f(_0x3b67bf[_0xb68e('0x17')]['message']);}})['catch'](function(_0x1548eb){logger[_0xb68e('0x14')]('FaxQueue,\x20%s,\x20%s',_0x479e26,_0x1548eb);_0x3d32ed(_0x1548eb);});});}exports[_0xb68e('0x18')]=function(_0x3ee5b1){var _0x36d71a=this;return new Promise(function(_0x38687b,_0x240f10){return db['FaxQueue']['findAll']({'raw':_0x3ee5b1[_0xb68e('0x19')]?_0x3ee5b1[_0xb68e('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3ee5b1[_0xb68e('0x19')]?_0x3ee5b1['options'][_0xb68e('0x1a')]||null:null,'attributes':_0x3ee5b1[_0xb68e('0x19')]?_0x3ee5b1['options'][_0xb68e('0x1b')]||null:null,'limit':_0x3ee5b1[_0xb68e('0x19')]?_0x3ee5b1[_0xb68e('0x19')]['limit']||null:null,'include':_0x3ee5b1[_0xb68e('0x19')]?_0x3ee5b1['options'][_0xb68e('0x1c')]?_[_0xb68e('0x1d')](_0x3ee5b1[_0xb68e('0x19')][_0xb68e('0x1c')],function(_0x2d32cc){return{'model':db[_0x2d32cc[_0xb68e('0x1e')]],'as':_0x2d32cc['as'],'attributes':_0x2d32cc[_0xb68e('0x1b')],'include':_0x2d32cc[_0xb68e('0x1c')]?_['map'](_0x2d32cc[_0xb68e('0x1c')],function(_0x5e988b){return{'model':db[_0x5e988b[_0xb68e('0x1e')]],'as':_0x5e988b['as'],'attributes':_0x5e988b[_0xb68e('0x1b')],'include':_0x5e988b[_0xb68e('0x1c')]?_['map'](_0x5e988b[_0xb68e('0x1c')],function(_0x592fb7){return{'model':db[_0x592fb7[_0xb68e('0x1e')]],'as':_0x592fb7['as'],'attributes':_0x592fb7[_0xb68e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb68e('0xf')](function(_0x3e9e4f){logger[_0xb68e('0x10')](_0xb68e('0x18'),_0x3ee5b1);logger[_0xb68e('0x1f')]('GetFaxQueue',_0x3ee5b1,JSON[_0xb68e('0x13')](_0x3e9e4f));_0x38687b(_0x3e9e4f);})['catch'](function(_0x12f0a3){logger['error'](_0xb68e('0x18'),_0x12f0a3[_0xb68e('0x16')],_0x3ee5b1);_0x240f10(_0x36d71a[_0xb68e('0x14')](0x1f4,_0x12f0a3[_0xb68e('0x16')]));});});};exports[_0xb68e('0x20')]=function(_0x258134){var _0x1b725e=this;return new Promise(function(_0x4f0e0c,_0x9eb9cd){return db[_0xb68e('0x21')]['find']({'raw':_0x258134[_0xb68e('0x19')]?_0x258134['options'][_0xb68e('0x22')]===undefined?!![]:![]:!![],'where':_0x258134['options']?_0x258134[_0xb68e('0x19')]['where']||null:null,'attributes':_0x258134[_0xb68e('0x19')]?_0x258134[_0xb68e('0x19')][_0xb68e('0x1b')]||null:null,'include':_0x258134[_0xb68e('0x19')]?_0x258134['options'][_0xb68e('0x1c')]?_[_0xb68e('0x1d')](_0x258134[_0xb68e('0x19')][_0xb68e('0x1c')],function(_0x2c962b){return{'model':db[_0x2c962b[_0xb68e('0x1e')]],'as':_0x2c962b['as'],'attributes':_0x2c962b[_0xb68e('0x1b')],'include':_0x2c962b[_0xb68e('0x1c')]?_[_0xb68e('0x1d')](_0x2c962b[_0xb68e('0x1c')],function(_0x36074f){return{'model':db[_0x36074f[_0xb68e('0x1e')]],'as':_0x36074f['as'],'attributes':_0x36074f[_0xb68e('0x1b')],'include':_0x36074f[_0xb68e('0x1c')]?_[_0xb68e('0x1d')](_0x36074f[_0xb68e('0x1c')],function(_0x2cc90b){return{'model':db[_0x2cc90b[_0xb68e('0x1e')]],'as':_0x2cc90b['as'],'attributes':_0x2cc90b[_0xb68e('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x286066){logger['info']('ShowFaxQueue',_0x258134);logger[_0xb68e('0x1f')]('ShowFaxQueue',_0x258134,JSON['stringify'](_0x286066));_0x4f0e0c(_0x286066);})[_0xb68e('0x23')](function(_0x4c998c){logger[_0xb68e('0x14')](_0xb68e('0x20'),_0x4c998c[_0xb68e('0x16')],_0x258134);_0x9eb9cd(_0x1b725e['error'](0x1f4,_0x4c998c[_0xb68e('0x16')]));});});}; \ No newline at end of file +var _0xb890=['find','where','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxQueue','options','raw','attributes','limit','include','model','map','GetFaxQueue','ShowFaxQueue'];(function(_0x4169d8,_0x3d7cd4){var _0x32084a=function(_0x5f59c6){while(--_0x5f59c6){_0x4169d8['push'](_0x4169d8['shift']());}};_0x32084a(++_0x3d7cd4);}(_0xb890,0x14c));var _0x0b89=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb890[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b89('0x0'));var util=require(_0x0b89('0x1'));var moment=require(_0x0b89('0x2'));var BPromise=require(_0x0b89('0x3'));var rs=require(_0x0b89('0x4'));var fs=require('fs');var Redis=require(_0x0b89('0x5'));var db=require(_0x0b89('0x6'))['db'];var utils=require(_0x0b89('0x7'));var logger=require(_0x0b89('0x8'))(_0x0b89('0x9'));var config=require(_0x0b89('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x0b89('0xb')]['http']({'port':0x232a});config[_0x0b89('0xc')]=_['defaults'](config[_0x0b89('0xc')],{'host':_0x0b89('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b89('0xc')]));require(_0x0b89('0xe'))[_0x0b89('0xf')](socket);function respondWithRpcPromise(_0x32b7cd,_0xb00875,_0x3fe8e1){return new BPromise(function(_0x5ca19b,_0xb15178){return client[_0x0b89('0x10')](_0x32b7cd,_0x3fe8e1)[_0x0b89('0x11')](function(_0x472cad){logger['info'](_0x0b89('0x12'),_0xb00875,_0x0b89('0x13'));logger[_0x0b89('0x14')](_0x0b89('0x15'),_0xb00875,_0x0b89('0x13'),JSON['stringify'](_0x472cad));if(_0x472cad[_0x0b89('0x16')]){if(_0x472cad[_0x0b89('0x16')][_0x0b89('0x17')]===0x1f4){logger[_0x0b89('0x16')](_0x0b89('0x12'),_0xb00875,_0x472cad[_0x0b89('0x16')][_0x0b89('0x18')]);return _0xb15178(_0x472cad[_0x0b89('0x16')][_0x0b89('0x18')]);}logger[_0x0b89('0x16')](_0x0b89('0x12'),_0xb00875,_0x472cad[_0x0b89('0x16')]['message']);return _0x5ca19b(_0x472cad[_0x0b89('0x16')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0xb00875,'request\x20sent');_0x5ca19b(_0x472cad[_0x0b89('0x19')][_0x0b89('0x18')]);}})[_0x0b89('0x1a')](function(_0x44259c){logger['error'](_0x0b89('0x12'),_0xb00875,_0x44259c);_0xb15178(_0x44259c);});});}exports['GetFaxQueue']=function(_0x16a4c9){var _0x32aa72=this;return new Promise(function(_0x4cf7ac,_0xb8c0ce){return db[_0x0b89('0x1b')]['findAll']({'raw':_0x16a4c9[_0x0b89('0x1c')]?_0x16a4c9[_0x0b89('0x1c')][_0x0b89('0x1d')]===undefined?!![]:![]:!![],'where':_0x16a4c9[_0x0b89('0x1c')]?_0x16a4c9[_0x0b89('0x1c')]['where']||null:null,'attributes':_0x16a4c9[_0x0b89('0x1c')]?_0x16a4c9[_0x0b89('0x1c')][_0x0b89('0x1e')]||null:null,'limit':_0x16a4c9['options']?_0x16a4c9['options'][_0x0b89('0x1f')]||null:null,'include':_0x16a4c9[_0x0b89('0x1c')]?_0x16a4c9[_0x0b89('0x1c')]['include']?_['map'](_0x16a4c9[_0x0b89('0x1c')][_0x0b89('0x20')],function(_0x41bbeb){return{'model':db[_0x41bbeb[_0x0b89('0x21')]],'as':_0x41bbeb['as'],'attributes':_0x41bbeb[_0x0b89('0x1e')],'include':_0x41bbeb[_0x0b89('0x20')]?_['map'](_0x41bbeb[_0x0b89('0x20')],function(_0x53317e){return{'model':db[_0x53317e[_0x0b89('0x21')]],'as':_0x53317e['as'],'attributes':_0x53317e[_0x0b89('0x1e')],'include':_0x53317e[_0x0b89('0x20')]?_[_0x0b89('0x22')](_0x53317e[_0x0b89('0x20')],function(_0x23738d){return{'model':db[_0x23738d[_0x0b89('0x21')]],'as':_0x23738d['as'],'attributes':_0x23738d[_0x0b89('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x59e0c4){logger['info'](_0x0b89('0x23'),_0x16a4c9);logger[_0x0b89('0x14')](_0x0b89('0x23'),_0x16a4c9,JSON['stringify'](_0x59e0c4));_0x4cf7ac(_0x59e0c4);})[_0x0b89('0x1a')](function(_0x345514){logger[_0x0b89('0x16')](_0x0b89('0x23'),_0x345514[_0x0b89('0x18')],_0x16a4c9);_0xb8c0ce(_0x32aa72[_0x0b89('0x16')](0x1f4,_0x345514[_0x0b89('0x18')]));});});};exports[_0x0b89('0x24')]=function(_0x3fcfd8){var _0x1c461e=this;return new Promise(function(_0x18698b,_0x433153){return db[_0x0b89('0x1b')][_0x0b89('0x25')]({'raw':_0x3fcfd8[_0x0b89('0x1c')]?_0x3fcfd8[_0x0b89('0x1c')][_0x0b89('0x1d')]===undefined?!![]:![]:!![],'where':_0x3fcfd8[_0x0b89('0x1c')]?_0x3fcfd8[_0x0b89('0x1c')][_0x0b89('0x26')]||null:null,'attributes':_0x3fcfd8['options']?_0x3fcfd8[_0x0b89('0x1c')][_0x0b89('0x1e')]||null:null,'include':_0x3fcfd8['options']?_0x3fcfd8[_0x0b89('0x1c')][_0x0b89('0x20')]?_[_0x0b89('0x22')](_0x3fcfd8[_0x0b89('0x1c')][_0x0b89('0x20')],function(_0x8ebc10){return{'model':db[_0x8ebc10[_0x0b89('0x21')]],'as':_0x8ebc10['as'],'attributes':_0x8ebc10[_0x0b89('0x1e')],'include':_0x8ebc10['include']?_[_0x0b89('0x22')](_0x8ebc10['include'],function(_0x4011cc){return{'model':db[_0x4011cc['model']],'as':_0x4011cc['as'],'attributes':_0x4011cc['attributes'],'include':_0x4011cc[_0x0b89('0x20')]?_['map'](_0x4011cc['include'],function(_0x2fd272){return{'model':db[_0x2fd272[_0x0b89('0x21')]],'as':_0x2fd272['as'],'attributes':_0x2fd272[_0x0b89('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x0b89('0x11')](function(_0x23bfde){logger[_0x0b89('0x27')](_0x0b89('0x24'),_0x3fcfd8);logger['debug'](_0x0b89('0x24'),_0x3fcfd8,JSON[_0x0b89('0x28')](_0x23bfde));_0x18698b(_0x23bfde);})[_0x0b89('0x1a')](function(_0x28dd39){logger[_0x0b89('0x16')](_0x0b89('0x24'),_0x28dd39['message'],_0x3fcfd8);_0x433153(_0x1c461e[_0x0b89('0x16')](0x1f4,_0x28dd39[_0x0b89('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 040966c..2d0dba2 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 _0xb079=['register','save','remove','update','emit','removeListener'];(function(_0x28ed2d,_0x1e063a){var _0x4b15a0=function(_0x32ad81){while(--_0x32ad81){_0x28ed2d['push'](_0x28ed2d['shift']());}};_0x4b15a0(++_0x1e063a);}(_0xb079,0x1c9));var _0x9b07=function(_0xeb6773,_0x4b3682){_0xeb6773=_0xeb6773-0x0;var _0x4259ea=_0xb079[_0xeb6773];return _0x4259ea;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x9b07('0x0'),_0x9b07('0x1'),_0x9b07('0x2')];function createListener(_0x158a14,_0x22f945){return function(_0x3c199c){_0x22f945[_0x9b07('0x3')](_0x158a14,_0x3c199c);};}function removeListener(_0x14a884,_0x3bf703){return function(){FaxQueueEvents[_0x9b07('0x4')](_0x14a884,_0x3bf703);};}exports[_0x9b07('0x5')]=function(_0x4a6f57){for(var _0x1ebf90=0x0,_0x2be1ef=events['length'];_0x1ebf90<_0x2be1ef;_0x1ebf90++){var _0x17a4bc=events[_0x1ebf90];var _0x5a0395=createListener('faxQueue:'+_0x17a4bc,_0x4a6f57);FaxQueueEvents['on'](_0x17a4bc,_0x5a0395);}}; \ No newline at end of file +var _0x7bee=['length','faxQueue:','save','remove','update','emit','removeListener'];(function(_0x4940a6,_0x448570){var _0x101ffe=function(_0x39c461){while(--_0x39c461){_0x4940a6['push'](_0x4940a6['shift']());}};_0x101ffe(++_0x448570);}(_0x7bee,0x13d));var _0xe7be=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7bee[_0x4b369d];return _0x571a98;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0xe7be('0x0'),_0xe7be('0x1'),_0xe7be('0x2')];function createListener(_0x30cc00,_0x3d4282){return function(_0x590b88){_0x3d4282[_0xe7be('0x3')](_0x30cc00,_0x590b88);};}function removeListener(_0xdb373e,_0x47a88e){return function(){FaxQueueEvents[_0xe7be('0x4')](_0xdb373e,_0x47a88e);};}exports['register']=function(_0x4d8520){for(var _0x16eab1=0x0,_0x554764=events[_0xe7be('0x5')];_0x16eab1<_0x554764;_0x16eab1++){var _0x595be3=events[_0x16eab1];var _0x1d5cff=createListener(_0xe7be('0x6')+_0x595be3,_0x4d8520);FaxQueueEvents['on'](_0x595be3,_0x1d5cff);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4248966..e6bc229 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','update','delete','removeAgents','exports','multer','util','path'];(function(_0x448f50,_0x5587ba){var _0x2af4c3=function(_0x5f2616){while(--_0x5f2616){_0x448f50['push'](_0x448f50['shift']());}};_0x2af4c3(++_0x5587ba);}(_0x2ef3,0xba));var _0x32ef=function(_0x3a3f8e,_0x24d926){_0x3a3f8e=_0x3a3f8e-0x0;var _0x581c36=_0x2ef3[_0x3a3f8e];return _0x581c36;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getMembers']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['get'](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['post']('/',auth[_0x32ef('0xb')](),controller[_0x32ef('0x14')]);router['post']('/:id/teams',auth[_0x32ef('0xb')](),controller['addTeams']);router[_0x32ef('0x15')](_0x32ef('0x12'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x32ef('0x17')]);router[_0x32ef('0x18')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x32ef('0x18')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller['removeTeams']);router[_0x32ef('0x18')](_0x32ef('0x12'),auth['isAuthenticated'](),controller[_0x32ef('0x19')]);module[_0x32ef('0x1a')]=router; \ No newline at end of file +var _0xd8fb=['addTeams','addAgents','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','isAuthenticated','create','/:id/teams'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xd8fb,0x99));var _0xbd8f=function(_0x1067dc,_0x428247){_0x1067dc=_0x1067dc-0x0;var _0x2f2b16=_0xd8fb[_0x1067dc];return _0x2f2b16;};'use strict';var multer=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var path=require(_0xbd8f('0x2'));var timeout=require(_0xbd8f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xbd8f('0x4'));var interaction=require(_0xbd8f('0x5'));var config=require('../../config/environment');var controller=require(_0xbd8f('0x6'));router[_0xbd8f('0x7')]('/',auth['isAuthenticated'](),controller[_0xbd8f('0x8')]);router['get'](_0xbd8f('0x9'),auth['isAuthenticated'](),controller[_0xbd8f('0xa')]);router[_0xbd8f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xbd8f('0xb')]);router[_0xbd8f('0x7')](_0xbd8f('0xc'),auth['isAuthenticated'](),controller[_0xbd8f('0xd')]);router[_0xbd8f('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbd8f('0xe')]);router[_0xbd8f('0x7')](_0xbd8f('0xf'),auth['isAuthenticated'](),controller[_0xbd8f('0x10')]);router[_0xbd8f('0x11')]('/',auth[_0xbd8f('0x12')](),controller[_0xbd8f('0x13')]);router[_0xbd8f('0x11')](_0xbd8f('0x14'),auth[_0xbd8f('0x12')](),controller[_0xbd8f('0x15')]);router[_0xbd8f('0x11')]('/:id/users',auth[_0xbd8f('0x12')](),controller[_0xbd8f('0x16')]);router[_0xbd8f('0x17')](_0xbd8f('0x18'),auth['isAuthenticated'](),controller[_0xbd8f('0x19')]);router[_0xbd8f('0x1a')]('/:id',auth[_0xbd8f('0x12')](),controller[_0xbd8f('0x1b')]);router['delete'](_0xbd8f('0x14'),auth[_0xbd8f('0x12')](),controller['removeTeams']);router['delete'](_0xbd8f('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xbd8f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index b0659d6..2126307 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 _0xc418=['STRING','DATE','moment','sequelize','exports'];(function(_0x5ae44f,_0x359101){var _0x14c3f8=function(_0x540515){while(--_0x540515){_0x5ae44f['push'](_0x5ae44f['shift']());}};_0x14c3f8(++_0x359101);}(_0xc418,0xd9));var _0x8c41=function(_0x4eafa6,_0x7ab32){_0x4eafa6=_0x4eafa6-0x0;var _0x1fe917=_0xc418[_0x4eafa6];return _0x1fe917;};'use strict';var moment=require(_0x8c41('0x0'));var Sequelize=require(_0x8c41('0x1'));module[_0x8c41('0x2')]={'uniqueid':{'type':Sequelize[_0x8c41('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8c41('0x3')]},'joinAt':{'type':Sequelize[_0x8c41('0x4')]},'leaveAt':{'type':Sequelize[_0x8c41('0x4')]},'acceptAt':{'type':Sequelize[_0x8c41('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c41('0x3')]}}; \ No newline at end of file +var _0xec19=['exports','STRING','DATE','moment'];(function(_0x5be527,_0x47a3f2){var _0x3f0f16=function(_0x16a756){while(--_0x16a756){_0x5be527['push'](_0x5be527['shift']());}};_0x3f0f16(++_0x47a3f2);}(_0xec19,0x7f));var _0x9ec1=function(_0x586c86,_0x1948fa){_0x586c86=_0x586c86-0x0;var _0x515e57=_0xec19[_0x586c86];return _0x515e57;};'use strict';var moment=require(_0x9ec1('0x0'));var Sequelize=require('sequelize');module[_0x9ec1('0x1')]={'uniqueid':{'type':Sequelize[_0x9ec1('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9ec1('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9ec1('0x3')]},'acceptAt':{'type':Sequelize[_0x9ec1('0x3')]},'exitAt':{'type':Sequelize[_0x9ec1('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index b0aa201..e184a3a 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 _0xfb30=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb30,0x88));var _0x0fb3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xfb30[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0x0fb3('0x0'));var rimraf=require(_0x0fb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0fb3('0x2'));var moment=require('moment');var BPromise=require(_0x0fb3('0x3'));var Mustache=require(_0x0fb3('0x4'));var util=require(_0x0fb3('0x5'));var path=require(_0x0fb3('0x6'));var sox=require(_0x0fb3('0x7'));var csv=require(_0x0fb3('0x8'));var ejs=require(_0x0fb3('0x9'));var fs=require('fs');var fs_extra=require(_0x0fb3('0xa'));var _=require(_0x0fb3('0xb'));var squel=require(_0x0fb3('0xc'));var crypto=require(_0x0fb3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0fb3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0fb3('0xf'));var Papa=require(_0x0fb3('0x10'));var Redis=require(_0x0fb3('0x11'));var authService=require(_0x0fb3('0x12'));var qs=require(_0x0fb3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fb3('0x14'))(_0x0fb3('0x15'));var utils=require(_0x0fb3('0x16'));var config=require(_0x0fb3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fb3('0x18'))['db'];function respondWithStatusCode(_0x419d55,_0x4eddbe){_0x4eddbe=_0x4eddbe||0xcc;return function(_0x289ac5){if(_0x289ac5){return _0x419d55[_0x0fb3('0x19')](_0x4eddbe);}return _0x419d55[_0x0fb3('0x1a')](_0x4eddbe)[_0x0fb3('0x1b')]();};}function respondWithResult(_0xb2742,_0x116af7){_0x116af7=_0x116af7||0xc8;return function(_0x172cbb){if(_0x172cbb){return _0xb2742[_0x0fb3('0x1a')](_0x116af7)['json'](_0x172cbb);}};}function respondWithFilteredResult(_0x28eb50,_0x390f57){return function(_0x38db4c){if(_0x38db4c){var _0x3bfca3=typeof _0x390f57[_0x0fb3('0x1c')]===_0x0fb3('0x1d')&&typeof _0x390f57[_0x0fb3('0x1e')]===_0x0fb3('0x1d');var _0x57bca4=_0x38db4c[_0x0fb3('0x1f')];var _0x5c6559=_0x3bfca3?0x0:_0x390f57['offset'];var _0x5e2024=_0x3bfca3?_0x38db4c[_0x0fb3('0x1f')]:_0x390f57[_0x0fb3('0x1c')]+_0x390f57[_0x0fb3('0x1e')];var _0x500079;if(_0x5e2024>=_0x57bca4){_0x5e2024=_0x57bca4;_0x500079=0xc8;}else{_0x500079=0xce;}_0x28eb50[_0x0fb3('0x1a')](_0x500079);return _0x28eb50[_0x0fb3('0x20')](_0x0fb3('0x21'),_0x5c6559+'-'+_0x5e2024+'/'+_0x57bca4)[_0x0fb3('0x22')](_0x38db4c);}return null;};}function patchUpdates(_0x40ddf6){return function(_0x4bf44){try{jsonpatch[_0x0fb3('0x23')](_0x4bf44,_0x40ddf6,!![]);}catch(_0x4be3a1){return BPromise[_0x0fb3('0x24')](_0x4be3a1);}return _0x4bf44[_0x0fb3('0x25')]();};}function saveUpdates(_0x242953,_0x3c53e7){return function(_0x3b19c3){if(_0x3b19c3){return _0x3b19c3[_0x0fb3('0x26')](_0x242953)['then'](function(_0x3f1152){return _0x3f1152;});}return null;};}function removeEntity(_0xeb97c8,_0x2e678a){return function(_0x2ebfcb){if(_0x2ebfcb){return _0x2ebfcb[_0x0fb3('0x27')]()[_0x0fb3('0x28')](function(){_0xeb97c8[_0x0fb3('0x1a')](0xcc)[_0x0fb3('0x1b')]();});}};}function handleEntityNotFound(_0xc7949f,_0x576456){return function(_0x20b79e){if(!_0x20b79e){_0xc7949f['sendStatus'](0x194);}return _0x20b79e;};}function handleError(_0x998064,_0x48602e){_0x48602e=_0x48602e||0x1f4;return function(_0x427783){logger[_0x0fb3('0x29')](_0x427783[_0x0fb3('0x2a')]);if(_0x427783[_0x0fb3('0x2b')]){delete _0x427783['name'];}_0x998064['status'](_0x48602e)[_0x0fb3('0x2c')](_0x427783);};}exports['index']=function(_0xbf2629,_0x25bdd2){var _0x1d9987={},_0x111e9f={},_0x2708ef={'count':0x0,'rows':[]};var _0x2af61c=_[_0x0fb3('0x2d')](db[_0x0fb3('0x2e')][_0x0fb3('0x2f')],function(_0x63a500){return{'name':_0x63a500[_0x0fb3('0x30')],'type':_0x63a500[_0x0fb3('0x31')][_0x0fb3('0x32')]};});_0x111e9f[_0x0fb3('0x33')]=_[_0x0fb3('0x2d')](_0x2af61c,_0x0fb3('0x2b'));_0x111e9f[_0x0fb3('0x34')]=_[_0x0fb3('0x35')](_0xbf2629[_0x0fb3('0x34')]);_0x111e9f['filters']=_[_0x0fb3('0x36')](_0x111e9f[_0x0fb3('0x33')],_0x111e9f['query']);_0x1d9987[_0x0fb3('0x37')]=_[_0x0fb3('0x36')](_0x111e9f['model'],qs[_0x0fb3('0x38')](_0xbf2629['query'][_0x0fb3('0x38')]));_0x1d9987[_0x0fb3('0x37')]=_0x1d9987['attributes'][_0x0fb3('0x39')]?_0x1d9987[_0x0fb3('0x37')]:_0x111e9f['model'];if(!_0xbf2629[_0x0fb3('0x34')]['hasOwnProperty'](_0x0fb3('0x3a'))){_0x1d9987[_0x0fb3('0x1e')]=qs[_0x0fb3('0x1e')](_0xbf2629[_0x0fb3('0x34')][_0x0fb3('0x1e')]);_0x1d9987[_0x0fb3('0x1c')]=qs[_0x0fb3('0x1c')](_0xbf2629['query'][_0x0fb3('0x1c')]);}_0x1d9987[_0x0fb3('0x3b')]=qs[_0x0fb3('0x3c')](_0xbf2629[_0x0fb3('0x34')][_0x0fb3('0x3c')]);_0x1d9987[_0x0fb3('0x3d')]=qs[_0x0fb3('0x3e')](_['pick'](_0xbf2629[_0x0fb3('0x34')],_0x111e9f[_0x0fb3('0x3e')]),_0x2af61c);if(_0xbf2629[_0x0fb3('0x34')][_0x0fb3('0x3f')]){_0x1d9987['where']=_[_0x0fb3('0x40')](_0x1d9987['where'],{'$or':_[_0x0fb3('0x2d')](_0x2af61c,function(_0x569e31){if(_0x569e31[_0x0fb3('0x31')]!==_0x0fb3('0x41')){var _0x2a75f9={};_0x2a75f9[_0x569e31[_0x0fb3('0x2b')]]={'$like':'%'+_0xbf2629['query'][_0x0fb3('0x3f')]+'%'};return _0x2a75f9;}})});}_0x1d9987=_[_0x0fb3('0x40')]({},_0x1d9987,_0xbf2629[_0x0fb3('0x42')]);var _0x10ea57={'where':_0x1d9987[_0x0fb3('0x3d')]};return db[_0x0fb3('0x2e')][_0x0fb3('0x1f')](_0x10ea57)[_0x0fb3('0x28')](function(_0x42507c){_0x2708ef[_0x0fb3('0x1f')]=_0x42507c;if(_0xbf2629[_0x0fb3('0x34')]['includeAll']){_0x1d9987[_0x0fb3('0x43')]=[{'all':!![]}];}return db[_0x0fb3('0x2e')][_0x0fb3('0x44')](_0x1d9987);})['then'](function(_0x45f666){_0x2708ef[_0x0fb3('0x45')]=_0x45f666;return _0x2708ef;})[_0x0fb3('0x28')](respondWithFilteredResult(_0x25bdd2,_0x1d9987))[_0x0fb3('0x46')](handleError(_0x25bdd2,null));};exports[_0x0fb3('0x47')]=function(_0x4bf567,_0x62634b){var _0x48c0e7={'raw':!![],'where':{'id':_0x4bf567['params']['id']}},_0xfd091f={};_0xfd091f[_0x0fb3('0x33')]=_[_0x0fb3('0x35')](db[_0x0fb3('0x2e')][_0x0fb3('0x2f')]);_0xfd091f[_0x0fb3('0x34')]=_[_0x0fb3('0x35')](_0x4bf567[_0x0fb3('0x34')]);_0xfd091f[_0x0fb3('0x3e')]=_[_0x0fb3('0x36')](_0xfd091f[_0x0fb3('0x33')],_0xfd091f['query']);_0x48c0e7[_0x0fb3('0x37')]=_['intersection'](_0xfd091f[_0x0fb3('0x33')],qs[_0x0fb3('0x38')](_0x4bf567[_0x0fb3('0x34')][_0x0fb3('0x38')]));_0x48c0e7[_0x0fb3('0x37')]=_0x48c0e7[_0x0fb3('0x37')][_0x0fb3('0x39')]?_0x48c0e7[_0x0fb3('0x37')]:_0xfd091f[_0x0fb3('0x33')];if(_0x4bf567[_0x0fb3('0x34')][_0x0fb3('0x48')]){_0x48c0e7[_0x0fb3('0x43')]=[{'all':!![]}];}_0x48c0e7=_['merge']({},_0x48c0e7,_0x4bf567[_0x0fb3('0x42')]);return db[_0x0fb3('0x2e')][_0x0fb3('0x49')](_0x48c0e7)['then'](handleEntityNotFound(_0x62634b,null))['then'](respondWithResult(_0x62634b,null))['catch'](handleError(_0x62634b,null));};exports[_0x0fb3('0x4a')]=function(_0x3948a0,_0x289360){return db['FaxQueueReport'][_0x0fb3('0x4a')](_0x3948a0[_0x0fb3('0x4b')],{})[_0x0fb3('0x28')](respondWithResult(_0x289360,0xc9))['catch'](handleError(_0x289360,null));};exports['update']=function(_0x57e92a,_0x16a2fc){if(_0x57e92a[_0x0fb3('0x4b')]['id']){delete _0x57e92a[_0x0fb3('0x4b')]['id'];}return db[_0x0fb3('0x2e')][_0x0fb3('0x49')]({'where':{'id':_0x57e92a['params']['id']}})[_0x0fb3('0x28')](handleEntityNotFound(_0x16a2fc,null))[_0x0fb3('0x28')](saveUpdates(_0x57e92a['body'],null))[_0x0fb3('0x28')](respondWithResult(_0x16a2fc,null))[_0x0fb3('0x46')](handleError(_0x16a2fc,null));};exports[_0x0fb3('0x27')]=function(_0xa9033e,_0x2beb43){return db[_0x0fb3('0x2e')][_0x0fb3('0x49')]({'where':{'id':_0xa9033e[_0x0fb3('0x4c')]['id']}})[_0x0fb3('0x28')](handleEntityNotFound(_0x2beb43,null))[_0x0fb3('0x28')](removeEntity(_0x2beb43,null))[_0x0fb3('0x46')](handleError(_0x2beb43,null));};exports[_0x0fb3('0x4d')]=function(_0x19302e,_0x4062ac){return db['FaxQueueReport'][_0x0fb3('0x4d')]()[_0x0fb3('0x28')](respondWithResult(_0x4062ac,null))[_0x0fb3('0x46')](handleError(_0x4062ac,null));}; \ No newline at end of file +var _0xcd31=['util','path','sox','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','sendStatus','status','offset','count','limit','set','Content-Range','reject','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','FaxQueueReport','includeAll','include','rows','catch','intersection','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xcd31,0x15d));var _0x1cd3=function(_0x4969fa,_0x139af4){_0x4969fa=_0x4969fa-0x0;var _0x1e5037=_0xcd31[_0x4969fa];return _0x1e5037;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cd3('0x0'));var zipdir=require(_0x1cd3('0x1'));var jsonpatch=require(_0x1cd3('0x2'));var rp=require('request-promise');var moment=require(_0x1cd3('0x3'));var BPromise=require(_0x1cd3('0x4'));var Mustache=require(_0x1cd3('0x5'));var util=require(_0x1cd3('0x6'));var path=require(_0x1cd3('0x7'));var sox=require(_0x1cd3('0x8'));var csv=require('to-csv');var ejs=require(_0x1cd3('0x9'));var fs=require('fs');var fs_extra=require(_0x1cd3('0xa'));var _=require(_0x1cd3('0xb'));var squel=require('squel');var crypto=require(_0x1cd3('0xc'));var jsforce=require(_0x1cd3('0xd'));var deskjs=require(_0x1cd3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1cd3('0xf'));var Papa=require(_0x1cd3('0x10'));var Redis=require(_0x1cd3('0x11'));var authService=require(_0x1cd3('0x12'));var qs=require(_0x1cd3('0x13'));var as=require(_0x1cd3('0x14'));var hardwareService=require(_0x1cd3('0x15'));var logger=require('../../config/logger')(_0x1cd3('0x16'));var utils=require(_0x1cd3('0x17'));var config=require(_0x1cd3('0x18'));var licenseUtil=require(_0x1cd3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe288e,_0x4c9c6d){_0x4c9c6d=_0x4c9c6d||0xcc;return function(_0x41016f){if(_0x41016f){return _0xfe288e[_0x1cd3('0x1a')](_0x4c9c6d);}return _0xfe288e[_0x1cd3('0x1b')](_0x4c9c6d)['end']();};}function respondWithResult(_0x5b885f,_0x1a874c){_0x1a874c=_0x1a874c||0xc8;return function(_0x1def57){if(_0x1def57){return _0x5b885f[_0x1cd3('0x1b')](_0x1a874c)['json'](_0x1def57);}};}function respondWithFilteredResult(_0x2b28cf,_0x40cbbf){return function(_0x5a2b84){if(_0x5a2b84){var _0x418da3=typeof _0x40cbbf['offset']==='undefined'&&typeof _0x40cbbf['limit']==='undefined';var _0x5ca15c=_0x5a2b84['count'];var _0x14c491=_0x418da3?0x0:_0x40cbbf[_0x1cd3('0x1c')];var _0xf82a46=_0x418da3?_0x5a2b84[_0x1cd3('0x1d')]:_0x40cbbf[_0x1cd3('0x1c')]+_0x40cbbf[_0x1cd3('0x1e')];var _0x35870b;if(_0xf82a46>=_0x5ca15c){_0xf82a46=_0x5ca15c;_0x35870b=0xc8;}else{_0x35870b=0xce;}_0x2b28cf[_0x1cd3('0x1b')](_0x35870b);return _0x2b28cf[_0x1cd3('0x1f')](_0x1cd3('0x20'),_0x14c491+'-'+_0xf82a46+'/'+_0x5ca15c)['json'](_0x5a2b84);}return null;};}function patchUpdates(_0x33fc72){return function(_0x2368b3){try{jsonpatch['apply'](_0x2368b3,_0x33fc72,!![]);}catch(_0x26b59a){return BPromise[_0x1cd3('0x21')](_0x26b59a);}return _0x2368b3['save']();};}function saveUpdates(_0x20cda5,_0x159d22){return function(_0x330741){if(_0x330741){return _0x330741[_0x1cd3('0x22')](_0x20cda5)['then'](function(_0x4f6920){return _0x4f6920;});}return null;};}function removeEntity(_0x29ff8c,_0x1a6dad){return function(_0x49c7b1){if(_0x49c7b1){return _0x49c7b1['destroy']()[_0x1cd3('0x23')](function(){_0x29ff8c[_0x1cd3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55aa9c,_0x34b15f){return function(_0x1589fa){if(!_0x1589fa){_0x55aa9c['sendStatus'](0x194);}return _0x1589fa;};}function handleError(_0x5635f9,_0x1c86f6){_0x1c86f6=_0x1c86f6||0x1f4;return function(_0xc311a9){logger[_0x1cd3('0x24')](_0xc311a9['stack']);if(_0xc311a9['name']){delete _0xc311a9[_0x1cd3('0x25')];}_0x5635f9['status'](_0x1c86f6)[_0x1cd3('0x26')](_0xc311a9);};}exports[_0x1cd3('0x27')]=function(_0x268501,_0x4b7c0b){var _0xae9d0c={},_0x53979a={},_0x47578c={'count':0x0,'rows':[]};var _0x3e3afb=_[_0x1cd3('0x28')](db['FaxQueueReport'][_0x1cd3('0x29')],function(_0x909bc6){return{'name':_0x909bc6[_0x1cd3('0x2a')],'type':_0x909bc6[_0x1cd3('0x2b')][_0x1cd3('0x2c')]};});_0x53979a['model']=_[_0x1cd3('0x28')](_0x3e3afb,_0x1cd3('0x25'));_0x53979a[_0x1cd3('0x2d')]=_[_0x1cd3('0x2e')](_0x268501[_0x1cd3('0x2d')]);_0x53979a[_0x1cd3('0x2f')]=_['intersection'](_0x53979a[_0x1cd3('0x30')],_0x53979a[_0x1cd3('0x2d')]);_0xae9d0c['attributes']=_['intersection'](_0x53979a[_0x1cd3('0x30')],qs[_0x1cd3('0x31')](_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x31')]));_0xae9d0c[_0x1cd3('0x32')]=_0xae9d0c['attributes'][_0x1cd3('0x33')]?_0xae9d0c['attributes']:_0x53979a['model'];if(!_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x34')](_0x1cd3('0x35'))){_0xae9d0c[_0x1cd3('0x1e')]=qs['limit'](_0x268501[_0x1cd3('0x2d')]['limit']);_0xae9d0c[_0x1cd3('0x1c')]=qs[_0x1cd3('0x1c')](_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x1c')]);}_0xae9d0c['order']=qs['sort'](_0x268501[_0x1cd3('0x2d')]['sort']);_0xae9d0c[_0x1cd3('0x36')]=qs[_0x1cd3('0x2f')](_[_0x1cd3('0x37')](_0x268501[_0x1cd3('0x2d')],_0x53979a[_0x1cd3('0x2f')]),_0x3e3afb);if(_0x268501['query']['filter']){_0xae9d0c['where']=_['merge'](_0xae9d0c[_0x1cd3('0x36')],{'$or':_['map'](_0x3e3afb,function(_0x285845){if(_0x285845['type']!==_0x1cd3('0x38')){var _0x1af9a6={};_0x1af9a6[_0x285845['name']]={'$like':'%'+_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x39')]+'%'};return _0x1af9a6;}})});}_0xae9d0c=_[_0x1cd3('0x3a')]({},_0xae9d0c,_0x268501['options']);var _0x53e2dd={'where':_0xae9d0c[_0x1cd3('0x36')]};return db[_0x1cd3('0x3b')][_0x1cd3('0x1d')](_0x53e2dd)[_0x1cd3('0x23')](function(_0x2cc3a3){_0x47578c[_0x1cd3('0x1d')]=_0x2cc3a3;if(_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x3c')]){_0xae9d0c[_0x1cd3('0x3d')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0xae9d0c);})['then'](function(_0x42a2ed){_0x47578c[_0x1cd3('0x3e')]=_0x42a2ed;return _0x47578c;})['then'](respondWithFilteredResult(_0x4b7c0b,_0xae9d0c))[_0x1cd3('0x3f')](handleError(_0x4b7c0b,null));};exports['show']=function(_0x40b662,_0x2f6a00){var _0x2109a2={'raw':!![],'where':{'id':_0x40b662['params']['id']}},_0x326f08={};_0x326f08['model']=_['keys'](db[_0x1cd3('0x3b')]['rawAttributes']);_0x326f08['query']=_[_0x1cd3('0x2e')](_0x40b662['query']);_0x326f08[_0x1cd3('0x2f')]=_[_0x1cd3('0x40')](_0x326f08[_0x1cd3('0x30')],_0x326f08[_0x1cd3('0x2d')]);_0x2109a2[_0x1cd3('0x32')]=_[_0x1cd3('0x40')](_0x326f08[_0x1cd3('0x30')],qs[_0x1cd3('0x31')](_0x40b662['query'][_0x1cd3('0x31')]));_0x2109a2[_0x1cd3('0x32')]=_0x2109a2[_0x1cd3('0x32')]['length']?_0x2109a2['attributes']:_0x326f08[_0x1cd3('0x30')];if(_0x40b662[_0x1cd3('0x2d')][_0x1cd3('0x3c')]){_0x2109a2[_0x1cd3('0x3d')]=[{'all':!![]}];}_0x2109a2=_[_0x1cd3('0x3a')]({},_0x2109a2,_0x40b662[_0x1cd3('0x41')]);return db[_0x1cd3('0x3b')]['find'](_0x2109a2)[_0x1cd3('0x23')](handleEntityNotFound(_0x2f6a00,null))[_0x1cd3('0x23')](respondWithResult(_0x2f6a00,null))[_0x1cd3('0x3f')](handleError(_0x2f6a00,null));};exports['create']=function(_0x57c84d,_0x2605c5){return db[_0x1cd3('0x3b')][_0x1cd3('0x42')](_0x57c84d[_0x1cd3('0x43')],{})[_0x1cd3('0x23')](respondWithResult(_0x2605c5,0xc9))['catch'](handleError(_0x2605c5,null));};exports['update']=function(_0x500fcf,_0x3cde0b){if(_0x500fcf[_0x1cd3('0x43')]['id']){delete _0x500fcf[_0x1cd3('0x43')]['id'];}return db[_0x1cd3('0x3b')][_0x1cd3('0x44')]({'where':{'id':_0x500fcf['params']['id']}})['then'](handleEntityNotFound(_0x3cde0b,null))[_0x1cd3('0x23')](saveUpdates(_0x500fcf[_0x1cd3('0x43')],null))['then'](respondWithResult(_0x3cde0b,null))[_0x1cd3('0x3f')](handleError(_0x3cde0b,null));};exports[_0x1cd3('0x45')]=function(_0x2542f6,_0x5c7d9c){return db['FaxQueueReport'][_0x1cd3('0x44')]({'where':{'id':_0x2542f6['params']['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x5c7d9c,null))[_0x1cd3('0x23')](removeEntity(_0x5c7d9c,null))[_0x1cd3('0x3f')](handleError(_0x5c7d9c,null));};exports[_0x1cd3('0x46')]=function(_0x44037e,_0xfaecf0){return db[_0x1cd3('0x3b')][_0x1cd3('0x46')]()['then'](respondWithResult(_0xfaecf0,null))[_0x1cd3('0x3f')](handleError(_0xfaecf0,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b785c28..26f98a9 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 _0xe14b=['bluebird','path','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','moment'];(function(_0x1cdfe2,_0x21df15){var _0x56a2c6=function(_0x10ad3c){while(--_0x10ad3c){_0x1cdfe2['push'](_0x1cdfe2['shift']());}};_0x56a2c6(++_0x21df15);}(_0xe14b,0x93));var _0xbe14=function(_0x564a49,_0x4b6fc2){_0x564a49=_0x564a49-0x0;var _0x4dc82d=_0xe14b[_0x564a49];return _0x4dc82d;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','lodash','util','../../config/logger','api','moment'];(function(_0x4843df,_0x5442d2){var _0x41be42=function(_0x249bf8){while(--_0x249bf8){_0x4843df['push'](_0x4843df['shift']());}};_0x41be42(++_0x5442d2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xc4aa[_0x1694f5];return _0x5b4321;};'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 0a5d216..d947ae9 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 _0x2a04=['../../config/environment','client','http','then','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x27e11d,_0xea5194){var _0x31584a=function(_0x48205d){while(--_0x48205d){_0x27e11d['push'](_0x27e11d['shift']());}};_0x31584a(++_0xea5194);}(_0x2a04,0x158));var _0x42a0=function(_0x3d8073,_0x5a3a09){_0x3d8073=_0x3d8073-0x0;var _0x2e01b1=_0x2a04[_0x3d8073];return _0x2e01b1;};'use strict';var _=require(_0x42a0('0x0'));var util=require(_0x42a0('0x1'));var moment=require(_0x42a0('0x2'));var BPromise=require(_0x42a0('0x3'));var rs=require(_0x42a0('0x4'));var fs=require('fs');var Redis=require(_0x42a0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x42a0('0x6'))(_0x42a0('0x7'));var config=require(_0x42a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x42a0('0x9')][_0x42a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x333894,_0x2d0fa3,_0x509caa){return new BPromise(function(_0x5f0c52,_0x53de44){return client['request'](_0x333894,_0x509caa)[_0x42a0('0xb')](function(_0x2bee4a){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2d0fa3,'request\x20sent');logger[_0x42a0('0xc')](_0x42a0('0xd'),_0x2d0fa3,_0x42a0('0xe'),JSON[_0x42a0('0xf')](_0x2bee4a));if(_0x2bee4a[_0x42a0('0x10')]){if(_0x2bee4a[_0x42a0('0x10')][_0x42a0('0x11')]===0x1f4){logger[_0x42a0('0x10')](_0x42a0('0x12'),_0x2d0fa3,_0x2bee4a['error'][_0x42a0('0x13')]);return _0x53de44(_0x2bee4a[_0x42a0('0x10')][_0x42a0('0x13')]);}logger['error'](_0x42a0('0x12'),_0x2d0fa3,_0x2bee4a[_0x42a0('0x10')][_0x42a0('0x13')]);return _0x5f0c52(_0x2bee4a[_0x42a0('0x10')]['message']);}else{logger[_0x42a0('0x14')](_0x42a0('0x12'),_0x2d0fa3,_0x42a0('0xe'));_0x5f0c52(_0x2bee4a[_0x42a0('0x15')][_0x42a0('0x13')]);}})[_0x42a0('0x16')](function(_0x20f0e2){logger[_0x42a0('0x10')]('FaxQueueReport,\x20%s,\x20%s',_0x2d0fa3,_0x20f0e2);_0x53de44(_0x20f0e2);});});}exports[_0x42a0('0x17')]=function(_0x336700){var _0x269264=this;return new Promise(function(_0x21d2e4,_0x2cae8d){return db['FaxQueueReport'][_0x42a0('0x18')](_0x336700[_0x42a0('0x19')],{'raw':_0x336700['options']?_0x336700[_0x42a0('0x1a')][_0x42a0('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x17133d){logger[_0x42a0('0x14')](_0x42a0('0x17'),_0x336700);logger['debug'](_0x42a0('0x17'),_0x336700,JSON[_0x42a0('0xf')](_0x17133d));_0x21d2e4(_0x17133d);})[_0x42a0('0x16')](function(_0x2af611){logger['error'](_0x42a0('0x17'),_0x2af611[_0x42a0('0x13')],_0x336700);_0x2cae8d(_0x269264[_0x42a0('0x10')](0x1f4,_0x2af611[_0x42a0('0x13')]));});});};exports[_0x42a0('0x1c')]=function(_0x3550e8){var _0x45a9f4=this;return new Promise(function(_0x3a7ddf,_0x5c0ff){return db['FaxQueueReport'][_0x42a0('0x1d')](_0x3550e8['body'],{'raw':_0x3550e8[_0x42a0('0x1a')]?_0x3550e8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3550e8['options']?_0x3550e8[_0x42a0('0x1a')]['where']||null:null,'attributes':_0x3550e8[_0x42a0('0x1a')]?_0x3550e8[_0x42a0('0x1a')][_0x42a0('0x1e')]||null:null,'limit':_0x3550e8[_0x42a0('0x1a')]?_0x3550e8[_0x42a0('0x1a')][_0x42a0('0x1f')]||null:null})['then'](function(_0x5c6ae3){logger[_0x42a0('0x14')](_0x42a0('0x1c'),_0x3550e8);logger[_0x42a0('0xc')]('UpdateFaxQueueReport',_0x3550e8,JSON[_0x42a0('0xf')](_0x5c6ae3));_0x3a7ddf(_0x5c6ae3);})[_0x42a0('0x16')](function(_0x2a2a58){logger[_0x42a0('0x10')](_0x42a0('0x1c'),_0x2a2a58[_0x42a0('0x13')],_0x3550e8);_0x5c0ff(_0x45a9f4['error'](0x1f4,_0x2a2a58['message']));});});}; \ No newline at end of file +var _0xb67e=['message','info','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','stringify','UpdateFaxQueueReport','where','attributes','limit','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x5a6961,_0xd41ca6){var _0x4af0a6=function(_0x1201fe){while(--_0x1201fe){_0x5a6961['push'](_0x5a6961['shift']());}};_0x4af0a6(++_0xd41ca6);}(_0xb67e,0x104));var _0xeb67=function(_0x5b29e7,_0x18cd9d){_0x5b29e7=_0x5b29e7-0x0;var _0x573aaa=_0xb67e[_0x5b29e7];return _0x573aaa;};'use strict';var _=require(_0xeb67('0x0'));var util=require(_0xeb67('0x1'));var moment=require(_0xeb67('0x2'));var BPromise=require(_0xeb67('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb67('0x4'));var db=require(_0xeb67('0x5'))['db'];var utils=require(_0xeb67('0x6'));var logger=require(_0xeb67('0x7'))(_0xeb67('0x8'));var config=require(_0xeb67('0x9'));var jayson=require(_0xeb67('0xa'));var client=jayson[_0xeb67('0xb')][_0xeb67('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20c496,_0x4aa80a,_0x219e38){return new BPromise(function(_0x26ad90,_0x310bc8){return client[_0xeb67('0xd')](_0x20c496,_0x219e38)[_0xeb67('0xe')](function(_0x3b5a61){logger['info'](_0xeb67('0xf'),_0x4aa80a,_0xeb67('0x10'));logger[_0xeb67('0x11')](_0xeb67('0x12'),_0x4aa80a,'request\x20sent',JSON['stringify'](_0x3b5a61));if(_0x3b5a61[_0xeb67('0x13')]){if(_0x3b5a61['error']['code']===0x1f4){logger['error'](_0xeb67('0xf'),_0x4aa80a,_0x3b5a61[_0xeb67('0x13')]['message']);return _0x310bc8(_0x3b5a61[_0xeb67('0x13')]['message']);}logger[_0xeb67('0x13')](_0xeb67('0xf'),_0x4aa80a,_0x3b5a61[_0xeb67('0x13')][_0xeb67('0x14')]);return _0x26ad90(_0x3b5a61[_0xeb67('0x13')][_0xeb67('0x14')]);}else{logger[_0xeb67('0x15')](_0xeb67('0xf'),_0x4aa80a,_0xeb67('0x10'));_0x26ad90(_0x3b5a61[_0xeb67('0x16')][_0xeb67('0x14')]);}})['catch'](function(_0x3b4e82){logger['error'](_0xeb67('0xf'),_0x4aa80a,_0x3b4e82);_0x310bc8(_0x3b4e82);});});}exports[_0xeb67('0x17')]=function(_0x34de74){var _0x283510=this;return new Promise(function(_0x15f4d2,_0x297c7e){return db[_0xeb67('0x18')][_0xeb67('0x19')](_0x34de74[_0xeb67('0x1a')],{'raw':_0x34de74[_0xeb67('0x1b')]?_0x34de74[_0xeb67('0x1b')][_0xeb67('0x1c')]===undefined?!![]:![]:!![]})[_0xeb67('0xe')](function(_0x1bdd1b){logger['info'](_0xeb67('0x17'),_0x34de74);logger[_0xeb67('0x11')](_0xeb67('0x17'),_0x34de74,JSON[_0xeb67('0x1d')](_0x1bdd1b));_0x15f4d2(_0x1bdd1b);})['catch'](function(_0xcb0ce7){logger[_0xeb67('0x13')](_0xeb67('0x17'),_0xcb0ce7['message'],_0x34de74);_0x297c7e(_0x283510[_0xeb67('0x13')](0x1f4,_0xcb0ce7[_0xeb67('0x14')]));});});};exports[_0xeb67('0x1e')]=function(_0x5f4b92){var _0x3685cf=this;return new Promise(function(_0x4f213b,_0x3ff405){return db['FaxQueueReport']['update'](_0x5f4b92[_0xeb67('0x1a')],{'raw':_0x5f4b92[_0xeb67('0x1b')]?_0x5f4b92['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f4b92[_0xeb67('0x1b')]?_0x5f4b92[_0xeb67('0x1b')][_0xeb67('0x1f')]||null:null,'attributes':_0x5f4b92[_0xeb67('0x1b')]?_0x5f4b92[_0xeb67('0x1b')][_0xeb67('0x20')]||null:null,'limit':_0x5f4b92[_0xeb67('0x1b')]?_0x5f4b92[_0xeb67('0x1b')][_0xeb67('0x21')]||null:null})[_0xeb67('0xe')](function(_0x3a0bd8){logger['info']('UpdateFaxQueueReport',_0x5f4b92);logger[_0xeb67('0x11')](_0xeb67('0x1e'),_0x5f4b92,JSON[_0xeb67('0x1d')](_0x3a0bd8));_0x4f213b(_0x3a0bd8);})[_0xeb67('0x22')](function(_0x41cccc){logger[_0xeb67('0x13')](_0xeb67('0x1e'),_0x41cccc['message'],_0x5f4b92);_0x3ff405(_0x3685cf[_0xeb67('0x13')](0x1f4,_0x41cccc[_0xeb67('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e677a8c..5fa804c 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 _0xce01=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','destroy','exports'];(function(_0x1bc897,_0x46982a){var _0x47cd67=function(_0x37c65d){while(--_0x37c65d){_0x1bc897['push'](_0x1bc897['shift']());}};_0x47cd67(++_0x46982a);}(_0xce01,0x1a4));var _0x1ce0=function(_0x1ccf29,_0x1bf3db){_0x1ccf29=_0x1ccf29-0x0;var _0x2403ed=_0xce01[_0x1ccf29];return _0x2403ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1ce0('0x0'));var timeout=require(_0x1ce0('0x1'));var express=require(_0x1ce0('0x2'));var router=express['Router']();var fs_extra=require(_0x1ce0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1ce0('0x4'));var config=require(_0x1ce0('0x5'));var controller=require(_0x1ce0('0x6'));router[_0x1ce0('0x7')]('/',auth['isAuthenticated'](),controller[_0x1ce0('0x8')]);router[_0x1ce0('0x7')](_0x1ce0('0x9'),auth[_0x1ce0('0xa')](),controller[_0x1ce0('0xb')]);router[_0x1ce0('0x7')]('/:id',auth[_0x1ce0('0xa')](),controller[_0x1ce0('0xc')]);router[_0x1ce0('0xd')]('/',auth[_0x1ce0('0xa')](),controller[_0x1ce0('0xe')]);router[_0x1ce0('0xf')](_0x1ce0('0x10'),auth[_0x1ce0('0xa')](),controller[_0x1ce0('0x11')]);router['delete']('/:id',auth[_0x1ce0('0xa')](),controller[_0x1ce0('0x12')]);module[_0x1ce0('0x13')]=router; \ No newline at end of file +var _0x2df0=['../../components/interaction/service','get','index','/describe','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f6574,_0x541007){var _0x552408=function(_0x57332f){while(--_0x57332f){_0x2f6574['push'](_0x2f6574['shift']());}};_0x552408(++_0x541007);}(_0x2df0,0x92));var _0x02df=function(_0xc89191,_0x189c00){_0xc89191=_0xc89191-0x0;var _0x3f5bff=_0x2df0[_0xc89191];return _0x3f5bff;};'use strict';var multer=require('multer');var util=require(_0x02df('0x0'));var path=require(_0x02df('0x1'));var timeout=require('connect-timeout');var express=require(_0x02df('0x2'));var router=express[_0x02df('0x3')]();var fs_extra=require(_0x02df('0x4'));var auth=require(_0x02df('0x5'));var interaction=require(_0x02df('0x6'));var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x02df('0x7')]('/',auth['isAuthenticated'](),controller[_0x02df('0x8')]);router['get'](_0x02df('0x9'),auth[_0x02df('0xa')](),controller['describe']);router[_0x02df('0x7')](_0x02df('0xb'),auth[_0x02df('0xa')](),controller[_0x02df('0xc')]);router[_0x02df('0xd')]('/',auth[_0x02df('0xa')](),controller[_0x02df('0xe')]);router['put'](_0x02df('0xb'),auth[_0x02df('0xa')](),controller[_0x02df('0xf')]);router[_0x02df('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x02df('0x11')]);module[_0x02df('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 0ccbedc..61bf029 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 _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x9bde,0xe1));var _0xe9bd=function(_0x298a50,_0x122c22){_0x298a50=_0x298a50-0x0;var _0x5b604f=_0x9bde[_0x298a50];return _0x5b604f;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x25cd6d,_0x30a718){var _0x7811e1=function(_0x29c1a1){while(--_0x29c1a1){_0x25cd6d['push'](_0x25cd6d['shift']());}};_0x7811e1(++_0x30a718);}(_0x54ef,0x112));var _0xf54e=function(_0x34549d,_0x736b24){_0x34549d=_0x34549d-0x0;var _0x2d4b3a=_0x54ef[_0x34549d];return _0x2d4b3a;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 5d8a6f8..d307f90 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 _0x0f92=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','status','end','name','index','map','FaxTransferReport','rawAttributes','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','include','create','body','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse'];(function(_0x230afe,_0x1d25ff){var _0x2308fe=function(_0x357178){while(--_0x357178){_0x230afe['push'](_0x230afe['shift']());}};_0x2308fe(++_0x1d25ff);}(_0x0f92,0xca));var _0x20f9=function(_0x125602,_0x51fc5a){_0x125602=_0x125602-0x0;var _0x338951=_0x0f92[_0x125602];return _0x338951;};'use strict';var emlformat=require(_0x20f9('0x0'));var rimraf=require(_0x20f9('0x1'));var zipdir=require(_0x20f9('0x2'));var jsonpatch=require(_0x20f9('0x3'));var rp=require(_0x20f9('0x4'));var moment=require(_0x20f9('0x5'));var BPromise=require(_0x20f9('0x6'));var Mustache=require(_0x20f9('0x7'));var util=require(_0x20f9('0x8'));var path=require(_0x20f9('0x9'));var sox=require('sox');var csv=require(_0x20f9('0xa'));var ejs=require(_0x20f9('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x20f9('0xc'));var crypto=require(_0x20f9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x20f9('0xe'));var toCsv=require(_0x20f9('0xa'));var querystring=require(_0x20f9('0xf'));var Papa=require(_0x20f9('0x10'));var Redis=require('ioredis');var authService=require(_0x20f9('0x11'));var qs=require(_0x20f9('0x12'));var as=require(_0x20f9('0x13'));var hardwareService=require(_0x20f9('0x14'));var logger=require(_0x20f9('0x15'))(_0x20f9('0x16'));var utils=require(_0x20f9('0x17'));var config=require(_0x20f9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x20f9('0x19'))['db'];function respondWithStatusCode(_0x114f6c,_0xdf82d9){_0xdf82d9=_0xdf82d9||0xcc;return function(_0x5dec61){if(_0x5dec61){return _0x114f6c[_0x20f9('0x1a')](_0xdf82d9);}return _0x114f6c['status'](_0xdf82d9)['end']();};}function respondWithResult(_0xcf8e42,_0x41bef5){_0x41bef5=_0x41bef5||0xc8;return function(_0x3eb765){if(_0x3eb765){return _0xcf8e42['status'](_0x41bef5)[_0x20f9('0x1b')](_0x3eb765);}};}function respondWithFilteredResult(_0x49ffb4,_0x509c00){return function(_0xc30132){if(_0xc30132){var _0xf5df6f=typeof _0x509c00[_0x20f9('0x1c')]===_0x20f9('0x1d')&&typeof _0x509c00[_0x20f9('0x1e')]===_0x20f9('0x1d');var _0x5a41de=_0xc30132[_0x20f9('0x1f')];var _0x11c6c1=_0xf5df6f?0x0:_0x509c00['offset'];var _0x10ca3a=_0xf5df6f?_0xc30132[_0x20f9('0x1f')]:_0x509c00[_0x20f9('0x1c')]+_0x509c00['limit'];var _0x2dacdb;if(_0x10ca3a>=_0x5a41de){_0x10ca3a=_0x5a41de;_0x2dacdb=0xc8;}else{_0x2dacdb=0xce;}_0x49ffb4['status'](_0x2dacdb);return _0x49ffb4[_0x20f9('0x20')](_0x20f9('0x21'),_0x11c6c1+'-'+_0x10ca3a+'/'+_0x5a41de)[_0x20f9('0x1b')](_0xc30132);}return null;};}function patchUpdates(_0x404f63){return function(_0x7a93ff){try{jsonpatch['apply'](_0x7a93ff,_0x404f63,!![]);}catch(_0xd982fa){return BPromise[_0x20f9('0x22')](_0xd982fa);}return _0x7a93ff[_0x20f9('0x23')]();};}function saveUpdates(_0x826cda,_0x1860c2){return function(_0x292de6){if(_0x292de6){return _0x292de6[_0x20f9('0x24')](_0x826cda)[_0x20f9('0x25')](function(_0x589d32){return _0x589d32;});}return null;};}function removeEntity(_0x2c3875,_0x1235e1){return function(_0x3170d3){if(_0x3170d3){return _0x3170d3['destroy']()[_0x20f9('0x25')](function(){_0x2c3875[_0x20f9('0x26')](0xcc)[_0x20f9('0x27')]();});}};}function handleEntityNotFound(_0x400316,_0x48ba98){return function(_0x513d6f){if(!_0x513d6f){_0x400316[_0x20f9('0x1a')](0x194);}return _0x513d6f;};}function handleError(_0xc44b99,_0x2eaa5d){_0x2eaa5d=_0x2eaa5d||0x1f4;return function(_0x469a59){logger['error'](_0x469a59['stack']);if(_0x469a59[_0x20f9('0x28')]){delete _0x469a59[_0x20f9('0x28')];}_0xc44b99['status'](_0x2eaa5d)['send'](_0x469a59);};}exports[_0x20f9('0x29')]=function(_0x30fa58,_0x3d9f3d){var _0xaddceb={},_0x2e87b1={},_0x108d2b={'count':0x0,'rows':[]};var _0x42a74d=_[_0x20f9('0x2a')](db[_0x20f9('0x2b')][_0x20f9('0x2c')],function(_0x25530a){return{'name':_0x25530a['fieldName'],'type':_0x25530a['type']['key']};});_0x2e87b1[_0x20f9('0x2d')]=_['map'](_0x42a74d,_0x20f9('0x28'));_0x2e87b1['query']=_['keys'](_0x30fa58[_0x20f9('0x2e')]);_0x2e87b1[_0x20f9('0x2f')]=_[_0x20f9('0x30')](_0x2e87b1[_0x20f9('0x2d')],_0x2e87b1[_0x20f9('0x2e')]);_0xaddceb['attributes']=_['intersection'](_0x2e87b1['model'],qs[_0x20f9('0x31')](_0x30fa58[_0x20f9('0x2e')][_0x20f9('0x31')]));_0xaddceb[_0x20f9('0x32')]=_0xaddceb[_0x20f9('0x32')][_0x20f9('0x33')]?_0xaddceb[_0x20f9('0x32')]:_0x2e87b1['model'];if(!_0x30fa58[_0x20f9('0x2e')][_0x20f9('0x34')](_0x20f9('0x35'))){_0xaddceb[_0x20f9('0x1e')]=qs[_0x20f9('0x1e')](_0x30fa58[_0x20f9('0x2e')][_0x20f9('0x1e')]);_0xaddceb[_0x20f9('0x1c')]=qs[_0x20f9('0x1c')](_0x30fa58[_0x20f9('0x2e')][_0x20f9('0x1c')]);}_0xaddceb['order']=qs['sort'](_0x30fa58[_0x20f9('0x2e')]['sort']);_0xaddceb[_0x20f9('0x36')]=qs[_0x20f9('0x2f')](_[_0x20f9('0x37')](_0x30fa58[_0x20f9('0x2e')],_0x2e87b1[_0x20f9('0x2f')]),_0x42a74d);if(_0x30fa58[_0x20f9('0x2e')]['filter']){_0xaddceb[_0x20f9('0x36')]=_[_0x20f9('0x38')](_0xaddceb['where'],{'$or':_[_0x20f9('0x2a')](_0x42a74d,function(_0x4e797e){if(_0x4e797e[_0x20f9('0x39')]!==_0x20f9('0x3a')){var _0x4e3134={};_0x4e3134[_0x4e797e[_0x20f9('0x28')]]={'$like':'%'+_0x30fa58[_0x20f9('0x2e')][_0x20f9('0x3b')]+'%'};return _0x4e3134;}})});}_0xaddceb=_[_0x20f9('0x38')]({},_0xaddceb,_0x30fa58[_0x20f9('0x3c')]);var _0x4c4d6d={'where':_0xaddceb[_0x20f9('0x36')]};return db[_0x20f9('0x2b')][_0x20f9('0x1f')](_0x4c4d6d)[_0x20f9('0x25')](function(_0x296a5a){_0x108d2b[_0x20f9('0x1f')]=_0x296a5a;if(_0x30fa58['query'][_0x20f9('0x3d')]){_0xaddceb['include']=[{'all':!![]}];}return db[_0x20f9('0x2b')][_0x20f9('0x3e')](_0xaddceb);})['then'](function(_0x5794a0){_0x108d2b['rows']=_0x5794a0;return _0x108d2b;})['then'](respondWithFilteredResult(_0x3d9f3d,_0xaddceb))[_0x20f9('0x3f')](handleError(_0x3d9f3d,null));};exports[_0x20f9('0x40')]=function(_0x5c416b,_0x3b3a48){var _0x9d0353={'raw':!![],'where':{'id':_0x5c416b[_0x20f9('0x41')]['id']}},_0x13ed25={};_0x13ed25[_0x20f9('0x2d')]=_[_0x20f9('0x42')](db['FaxTransferReport']['rawAttributes']);_0x13ed25[_0x20f9('0x2e')]=_[_0x20f9('0x42')](_0x5c416b[_0x20f9('0x2e')]);_0x13ed25[_0x20f9('0x2f')]=_[_0x20f9('0x30')](_0x13ed25[_0x20f9('0x2d')],_0x13ed25['query']);_0x9d0353[_0x20f9('0x32')]=_[_0x20f9('0x30')](_0x13ed25[_0x20f9('0x2d')],qs['fields'](_0x5c416b[_0x20f9('0x2e')]['fields']));_0x9d0353['attributes']=_0x9d0353[_0x20f9('0x32')]['length']?_0x9d0353['attributes']:_0x13ed25[_0x20f9('0x2d')];if(_0x5c416b[_0x20f9('0x2e')]['includeAll']){_0x9d0353[_0x20f9('0x43')]=[{'all':!![]}];}_0x9d0353=_[_0x20f9('0x38')]({},_0x9d0353,_0x5c416b[_0x20f9('0x3c')]);return db[_0x20f9('0x2b')]['find'](_0x9d0353)[_0x20f9('0x25')](handleEntityNotFound(_0x3b3a48,null))[_0x20f9('0x25')](respondWithResult(_0x3b3a48,null))[_0x20f9('0x3f')](handleError(_0x3b3a48,null));};exports[_0x20f9('0x44')]=function(_0x530437,_0x6361ad){return db[_0x20f9('0x2b')][_0x20f9('0x44')](_0x530437[_0x20f9('0x45')],{})[_0x20f9('0x25')](respondWithResult(_0x6361ad,0xc9))[_0x20f9('0x3f')](handleError(_0x6361ad,null));};exports['update']=function(_0x2e05a6,_0x437373){if(_0x2e05a6[_0x20f9('0x45')]['id']){delete _0x2e05a6[_0x20f9('0x45')]['id'];}return db[_0x20f9('0x2b')]['find']({'where':{'id':_0x2e05a6['params']['id']}})[_0x20f9('0x25')](handleEntityNotFound(_0x437373,null))[_0x20f9('0x25')](saveUpdates(_0x2e05a6[_0x20f9('0x45')],null))['then'](respondWithResult(_0x437373,null))[_0x20f9('0x3f')](handleError(_0x437373,null));};exports[_0x20f9('0x46')]=function(_0x5d7ba8,_0x17abd7){return db[_0x20f9('0x2b')][_0x20f9('0x47')]({'where':{'id':_0x5d7ba8['params']['id']}})[_0x20f9('0x25')](handleEntityNotFound(_0x17abd7,null))['then'](removeEntity(_0x17abd7,null))[_0x20f9('0x3f')](handleError(_0x17abd7,null));};exports[_0x20f9('0x48')]=function(_0x1f373d,_0x3a2fd8){return db[_0x20f9('0x2b')][_0x20f9('0x48')]()['then'](respondWithResult(_0x3a2fd8,null))[_0x20f9('0x3f')](handleError(_0x3a2fd8,null));}; \ No newline at end of file +var _0x0fa5=['end','status','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','fast-json-patch','request-promise','mustache','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xc38835,_0x3c43a0){var _0x4be4c6=function(_0x27ebc0){while(--_0x27ebc0){_0xc38835['push'](_0xc38835['shift']());}};_0x4be4c6(++_0x3c43a0);}(_0x0fa5,0xc2));var _0x50fa=function(_0x4b03c9,_0x17ce03){_0x4b03c9=_0x4b03c9-0x0;var _0x161ba2=_0x0fa5[_0x4b03c9];return _0x161ba2;};'use strict';var emlformat=require(_0x50fa('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x50fa('0x1'));var rp=require(_0x50fa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x50fa('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x50fa('0x4'));var jsforce=require(_0x50fa('0x5'));var deskjs=require(_0x50fa('0x6'));var toCsv=require(_0x50fa('0x7'));var querystring=require(_0x50fa('0x8'));var Papa=require(_0x50fa('0x9'));var Redis=require(_0x50fa('0xa'));var authService=require(_0x50fa('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x50fa('0xc'));var hardwareService=require(_0x50fa('0xd'));var logger=require(_0x50fa('0xe'))('api');var utils=require(_0x50fa('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x50fa('0x10'));var db=require(_0x50fa('0x11'))['db'];function respondWithStatusCode(_0x3d7c0d,_0x2af3ec){_0x2af3ec=_0x2af3ec||0xcc;return function(_0x49d11d){if(_0x49d11d){return _0x3d7c0d[_0x50fa('0x12')](_0x2af3ec);}return _0x3d7c0d['status'](_0x2af3ec)[_0x50fa('0x13')]();};}function respondWithResult(_0x40cfb5,_0x19fee9){_0x19fee9=_0x19fee9||0xc8;return function(_0x815089){if(_0x815089){return _0x40cfb5[_0x50fa('0x14')](_0x19fee9)[_0x50fa('0x15')](_0x815089);}};}function respondWithFilteredResult(_0x181d82,_0x473b06){return function(_0x2c07ff){if(_0x2c07ff){var _0x40edf3=typeof _0x473b06[_0x50fa('0x16')]==='undefined'&&typeof _0x473b06[_0x50fa('0x17')]===_0x50fa('0x18');var _0x19df7e=_0x2c07ff[_0x50fa('0x19')];var _0xa14402=_0x40edf3?0x0:_0x473b06[_0x50fa('0x16')];var _0x46f703=_0x40edf3?_0x2c07ff[_0x50fa('0x19')]:_0x473b06[_0x50fa('0x16')]+_0x473b06[_0x50fa('0x17')];var _0x57c77e;if(_0x46f703>=_0x19df7e){_0x46f703=_0x19df7e;_0x57c77e=0xc8;}else{_0x57c77e=0xce;}_0x181d82['status'](_0x57c77e);return _0x181d82[_0x50fa('0x1a')]('Content-Range',_0xa14402+'-'+_0x46f703+'/'+_0x19df7e)['json'](_0x2c07ff);}return null;};}function patchUpdates(_0x15c850){return function(_0x4dc1db){try{jsonpatch[_0x50fa('0x1b')](_0x4dc1db,_0x15c850,!![]);}catch(_0x3c2ebb){return BPromise[_0x50fa('0x1c')](_0x3c2ebb);}return _0x4dc1db[_0x50fa('0x1d')]();};}function saveUpdates(_0x1f484f,_0xbf7482){return function(_0x5a99c5){if(_0x5a99c5){return _0x5a99c5['update'](_0x1f484f)[_0x50fa('0x1e')](function(_0x3504b2){return _0x3504b2;});}return null;};}function removeEntity(_0x3adcc7,_0x5151af){return function(_0x9bcff0){if(_0x9bcff0){return _0x9bcff0['destroy']()[_0x50fa('0x1e')](function(){_0x3adcc7[_0x50fa('0x14')](0xcc)[_0x50fa('0x13')]();});}};}function handleEntityNotFound(_0x4bfc2b,_0x54483f){return function(_0x297d23){if(!_0x297d23){_0x4bfc2b[_0x50fa('0x12')](0x194);}return _0x297d23;};}function handleError(_0x434421,_0x44cfda){_0x44cfda=_0x44cfda||0x1f4;return function(_0x223a54){logger[_0x50fa('0x1f')](_0x223a54[_0x50fa('0x20')]);if(_0x223a54['name']){delete _0x223a54[_0x50fa('0x21')];}_0x434421['status'](_0x44cfda)[_0x50fa('0x22')](_0x223a54);};}exports[_0x50fa('0x23')]=function(_0x371a69,_0x334566){var _0x1103fe={},_0x5a530e={},_0x83fc47={'count':0x0,'rows':[]};var _0xe3211e=_['map'](db['FaxTransferReport'][_0x50fa('0x24')],function(_0x1acdd2){return{'name':_0x1acdd2['fieldName'],'type':_0x1acdd2[_0x50fa('0x25')][_0x50fa('0x26')]};});_0x5a530e['model']=_[_0x50fa('0x27')](_0xe3211e,_0x50fa('0x21'));_0x5a530e[_0x50fa('0x28')]=_[_0x50fa('0x29')](_0x371a69[_0x50fa('0x28')]);_0x5a530e['filters']=_[_0x50fa('0x2a')](_0x5a530e[_0x50fa('0x2b')],_0x5a530e[_0x50fa('0x28')]);_0x1103fe[_0x50fa('0x2c')]=_['intersection'](_0x5a530e[_0x50fa('0x2b')],qs[_0x50fa('0x2d')](_0x371a69['query'][_0x50fa('0x2d')]));_0x1103fe[_0x50fa('0x2c')]=_0x1103fe[_0x50fa('0x2c')][_0x50fa('0x2e')]?_0x1103fe['attributes']:_0x5a530e[_0x50fa('0x2b')];if(!_0x371a69[_0x50fa('0x28')][_0x50fa('0x2f')](_0x50fa('0x30'))){_0x1103fe['limit']=qs['limit'](_0x371a69[_0x50fa('0x28')][_0x50fa('0x17')]);_0x1103fe[_0x50fa('0x16')]=qs[_0x50fa('0x16')](_0x371a69[_0x50fa('0x28')][_0x50fa('0x16')]);}_0x1103fe[_0x50fa('0x31')]=qs[_0x50fa('0x32')](_0x371a69[_0x50fa('0x28')][_0x50fa('0x32')]);_0x1103fe[_0x50fa('0x33')]=qs['filters'](_[_0x50fa('0x34')](_0x371a69[_0x50fa('0x28')],_0x5a530e[_0x50fa('0x35')]),_0xe3211e);if(_0x371a69[_0x50fa('0x28')][_0x50fa('0x36')]){_0x1103fe[_0x50fa('0x33')]=_[_0x50fa('0x37')](_0x1103fe['where'],{'$or':_[_0x50fa('0x27')](_0xe3211e,function(_0x4dca8b){if(_0x4dca8b[_0x50fa('0x25')]!==_0x50fa('0x38')){var _0x138840={};_0x138840[_0x4dca8b[_0x50fa('0x21')]]={'$like':'%'+_0x371a69[_0x50fa('0x28')][_0x50fa('0x36')]+'%'};return _0x138840;}})});}_0x1103fe=_[_0x50fa('0x37')]({},_0x1103fe,_0x371a69[_0x50fa('0x39')]);var _0x1e8054={'where':_0x1103fe[_0x50fa('0x33')]};return db[_0x50fa('0x3a')][_0x50fa('0x19')](_0x1e8054)[_0x50fa('0x1e')](function(_0x1a662a){_0x83fc47[_0x50fa('0x19')]=_0x1a662a;if(_0x371a69[_0x50fa('0x28')][_0x50fa('0x3b')]){_0x1103fe[_0x50fa('0x3c')]=[{'all':!![]}];}return db[_0x50fa('0x3a')][_0x50fa('0x3d')](_0x1103fe);})['then'](function(_0x3efac0){_0x83fc47[_0x50fa('0x3e')]=_0x3efac0;return _0x83fc47;})[_0x50fa('0x1e')](respondWithFilteredResult(_0x334566,_0x1103fe))[_0x50fa('0x3f')](handleError(_0x334566,null));};exports[_0x50fa('0x40')]=function(_0x45ef2c,_0x45803f){var _0x556f48={'raw':!![],'where':{'id':_0x45ef2c[_0x50fa('0x41')]['id']}},_0x32d21f={};_0x32d21f['model']=_[_0x50fa('0x29')](db[_0x50fa('0x3a')][_0x50fa('0x24')]);_0x32d21f[_0x50fa('0x28')]=_['keys'](_0x45ef2c[_0x50fa('0x28')]);_0x32d21f['filters']=_['intersection'](_0x32d21f[_0x50fa('0x2b')],_0x32d21f['query']);_0x556f48[_0x50fa('0x2c')]=_[_0x50fa('0x2a')](_0x32d21f[_0x50fa('0x2b')],qs[_0x50fa('0x2d')](_0x45ef2c['query'][_0x50fa('0x2d')]));_0x556f48[_0x50fa('0x2c')]=_0x556f48[_0x50fa('0x2c')][_0x50fa('0x2e')]?_0x556f48[_0x50fa('0x2c')]:_0x32d21f['model'];if(_0x45ef2c[_0x50fa('0x28')][_0x50fa('0x3b')]){_0x556f48[_0x50fa('0x3c')]=[{'all':!![]}];}_0x556f48=_[_0x50fa('0x37')]({},_0x556f48,_0x45ef2c[_0x50fa('0x39')]);return db[_0x50fa('0x3a')][_0x50fa('0x42')](_0x556f48)['then'](handleEntityNotFound(_0x45803f,null))[_0x50fa('0x1e')](respondWithResult(_0x45803f,null))['catch'](handleError(_0x45803f,null));};exports[_0x50fa('0x43')]=function(_0x588b53,_0x116c48){return db[_0x50fa('0x3a')]['create'](_0x588b53[_0x50fa('0x44')],{})[_0x50fa('0x1e')](respondWithResult(_0x116c48,0xc9))['catch'](handleError(_0x116c48,null));};exports[_0x50fa('0x45')]=function(_0x123187,_0x249607){if(_0x123187['body']['id']){delete _0x123187['body']['id'];}return db[_0x50fa('0x3a')][_0x50fa('0x42')]({'where':{'id':_0x123187[_0x50fa('0x41')]['id']}})[_0x50fa('0x1e')](handleEntityNotFound(_0x249607,null))['then'](saveUpdates(_0x123187[_0x50fa('0x44')],null))['then'](respondWithResult(_0x249607,null))['catch'](handleError(_0x249607,null));};exports['destroy']=function(_0x362241,_0x2bb0ca){return db[_0x50fa('0x3a')][_0x50fa('0x42')]({'where':{'id':_0x362241['params']['id']}})[_0x50fa('0x1e')](handleEntityNotFound(_0x2bb0ca,null))[_0x50fa('0x1e')](removeEntity(_0x2bb0ca,null))[_0x50fa('0x3f')](handleError(_0x2bb0ca,null));};exports[_0x50fa('0x46')]=function(_0x504a19,_0x344b0c){return db[_0x50fa('0x3a')][_0x50fa('0x46')]()[_0x50fa('0x1e')](respondWithResult(_0x344b0c,null))[_0x50fa('0x3f')](handleError(_0x344b0c,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index aeac214..810aa36 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 _0x34cf=['request-promise','path','rimraf','define','FaxTransferReport','report_fax_transfer','uniqueid','util','../../config/logger','moment','bluebird'];(function(_0x5155fd,_0xaa956f){var _0x1bf312=function(_0x1e8a0e){while(--_0x1e8a0e){_0x5155fd['push'](_0x5155fd['shift']());}};_0x1bf312(++_0xaa956f);}(_0x34cf,0xd8));var _0xf34c=function(_0x272009,_0x23fe1e){_0x272009=_0x272009-0x0;var _0x4a51c1=_0x34cf[_0x272009];return _0x4a51c1;};'use strict';var _=require('lodash');var util=require(_0xf34c('0x0'));var logger=require(_0xf34c('0x1'))('api');var moment=require(_0xf34c('0x2'));var BPromise=require(_0xf34c('0x3'));var rp=require(_0xf34c('0x4'));var fs=require('fs');var path=require(_0xf34c('0x5'));var rimraf=require(_0xf34c('0x6'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module['exports']=function(_0x24a028,_0x3d7ace){return _0x24a028[_0xf34c('0x7')](_0xf34c('0x8'),attributes,{'tableName':_0xf34c('0x9'),'paranoid':![],'indexes':[{'name':_0xf34c('0xa'),'fields':[_0xf34c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x77ec=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','uniqueid','lodash','util'];(function(_0x20c1c7,_0x55f442){var _0x5ab7f6=function(_0x5c6198){while(--_0x5c6198){_0x20c1c7['push'](_0x20c1c7['shift']());}};_0x5ab7f6(++_0x55f442);}(_0x77ec,0x1ab));var _0xc77e=function(_0xeacdd0,_0x413eb9){_0xeacdd0=_0xeacdd0-0x0;var _0x224d1f=_0x77ec[_0xeacdd0];return _0x224d1f;};'use strict';var _=require(_0xc77e('0x0'));var util=require(_0xc77e('0x1'));var logger=require(_0xc77e('0x2'))(_0xc77e('0x3'));var moment=require(_0xc77e('0x4'));var BPromise=require(_0xc77e('0x5'));var rp=require(_0xc77e('0x6'));var fs=require('fs');var path=require(_0xc77e('0x7'));var rimraf=require(_0xc77e('0x8'));var config=require('../../config/environment');var attributes=require(_0xc77e('0x9'));module[_0xc77e('0xa')]=function(_0x4204bc,_0x3d9c54){return _0x4204bc[_0xc77e('0xb')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xc77e('0xc'),'fields':[_0xc77e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 717d6cc..e9e9397 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 _0xbe4a=['util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','FaxTransferReport,\x20%s,\x20%s','info','result','lodash'];(function(_0x23d7e4,_0x4ac4da){var _0x2ba227=function(_0x3a9551){while(--_0x3a9551){_0x23d7e4['push'](_0x23d7e4['shift']());}};_0x2ba227(++_0x4ac4da);}(_0xbe4a,0x18f));var _0xabe4=function(_0x5ea326,_0x3d52fa){_0x5ea326=_0x5ea326-0x0;var _0x48cf87=_0xbe4a[_0x5ea326];return _0x48cf87;};'use strict';var _=require(_0xabe4('0x0'));var util=require(_0xabe4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xabe4('0x2'));var fs=require('fs');var Redis=require(_0xabe4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xabe4('0x4'));var logger=require(_0xabe4('0x5'))(_0xabe4('0x6'));var config=require(_0xabe4('0x7'));var jayson=require(_0xabe4('0x8'));var client=jayson[_0xabe4('0x9')][_0xabe4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x323f1c,_0x5128e8,_0x367c43){return new BPromise(function(_0x3bbab2,_0x1a26a5){return client[_0xabe4('0xb')](_0x323f1c,_0x367c43)['then'](function(_0x2978cf){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x5128e8,_0xabe4('0xc'));logger['debug'](_0xabe4('0xd'),_0x5128e8,_0xabe4('0xc'),JSON['stringify'](_0x2978cf));if(_0x2978cf['error']){if(_0x2978cf[_0xabe4('0xe')][_0xabe4('0xf')]===0x1f4){logger[_0xabe4('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x5128e8,_0x2978cf['error']['message']);return _0x1a26a5(_0x2978cf[_0xabe4('0xe')][_0xabe4('0x10')]);}logger[_0xabe4('0xe')](_0xabe4('0x11'),_0x5128e8,_0x2978cf[_0xabe4('0xe')][_0xabe4('0x10')]);return _0x3bbab2(_0x2978cf[_0xabe4('0xe')]['message']);}else{logger[_0xabe4('0x12')](_0xabe4('0x11'),_0x5128e8,_0xabe4('0xc'));_0x3bbab2(_0x2978cf[_0xabe4('0x13')][_0xabe4('0x10')]);}})['catch'](function(_0x205b6e){logger[_0xabe4('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x5128e8,_0x205b6e);_0x1a26a5(_0x205b6e);});});} \ No newline at end of file +var _0x68a8=['request\x20sent','debug','error','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','FaxTransferReport,\x20%s,\x20%s'];(function(_0x1aeac9,_0x4afadf){var _0x5dddc9=function(_0x182297){while(--_0x182297){_0x1aeac9['push'](_0x1aeac9['shift']());}};_0x5dddc9(++_0x4afadf);}(_0x68a8,0x16f));var _0x868a=function(_0x1ec6c8,_0x227b67){_0x1ec6c8=_0x1ec6c8-0x0;var _0x4a67b0=_0x68a8[_0x1ec6c8];return _0x4a67b0;};'use strict';var _=require(_0x868a('0x0'));var util=require('util');var moment=require(_0x868a('0x1'));var BPromise=require(_0x868a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x868a('0x3'));var db=require(_0x868a('0x4'))['db'];var utils=require(_0x868a('0x5'));var logger=require(_0x868a('0x6'))('rpc');var config=require(_0x868a('0x7'));var jayson=require(_0x868a('0x8'));var client=jayson[_0x868a('0x9')][_0x868a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x493bec,_0xa2b1af,_0x7bc88){return new BPromise(function(_0x314e87,_0x1b836c){return client[_0x868a('0xb')](_0x493bec,_0x7bc88)['then'](function(_0x20cfa1){logger['info'](_0x868a('0xc'),_0xa2b1af,_0x868a('0xd'));logger[_0x868a('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0xa2b1af,_0x868a('0xd'),JSON['stringify'](_0x20cfa1));if(_0x20cfa1[_0x868a('0xf')]){if(_0x20cfa1['error']['code']===0x1f4){logger[_0x868a('0xf')](_0x868a('0xc'),_0xa2b1af,_0x20cfa1['error']['message']);return _0x1b836c(_0x20cfa1['error'][_0x868a('0x10')]);}logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xa2b1af,_0x20cfa1[_0x868a('0xf')][_0x868a('0x10')]);return _0x314e87(_0x20cfa1[_0x868a('0xf')][_0x868a('0x10')]);}else{logger[_0x868a('0x11')](_0x868a('0xc'),_0xa2b1af,_0x868a('0xd'));_0x314e87(_0x20cfa1[_0x868a('0x12')]['message']);}})[_0x868a('0x13')](function(_0x47dd0d){logger[_0x868a('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0xa2b1af,_0x47dd0d);_0x1b836c(_0x47dd0d);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 2f5c5c2..be800a8 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 _0xc62d=['./faxTransferReport.controller','get','isAuthenticated','/describe','describe','post','create','/:id','update','delete','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x4fce7c,_0x2bbad3){var _0x105889=function(_0x14a0b8){while(--_0x14a0b8){_0x4fce7c['push'](_0x4fce7c['shift']());}};_0x105889(++_0x2bbad3);}(_0xc62d,0x12b));var _0xdc62=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xc62d[_0x52ea08];return _0x28d546;};'use strict';var multer=require(_0xdc62('0x0'));var util=require('util');var path=require(_0xdc62('0x1'));var timeout=require(_0xdc62('0x2'));var express=require('express');var router=express[_0xdc62('0x3')]();var fs_extra=require(_0xdc62('0x4'));var auth=require(_0xdc62('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xdc62('0x6'));var controller=require(_0xdc62('0x7'));router[_0xdc62('0x8')]('/',auth[_0xdc62('0x9')](),controller['index']);router[_0xdc62('0x8')](_0xdc62('0xa'),auth[_0xdc62('0x9')](),controller[_0xdc62('0xb')]);router[_0xdc62('0x8')]('/:id',auth[_0xdc62('0x9')](),controller['show']);router[_0xdc62('0xc')]('/',auth[_0xdc62('0x9')](),controller[_0xdc62('0xd')]);router['put'](_0xdc62('0xe'),auth[_0xdc62('0x9')](),controller[_0xdc62('0xf')]);router[_0xdc62('0x10')]('/:id',auth[_0xdc62('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc4f7=['express','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','show','post','create','update','delete','/:id','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc4f7,0x11b));var _0x7c4f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc4f7[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7c4f('0x0'));var util=require(_0x7c4f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7c4f('0x2'));var router=express['Router']();var fs_extra=require(_0x7c4f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7c4f('0x4'));var config=require(_0x7c4f('0x5'));var controller=require(_0x7c4f('0x6'));router[_0x7c4f('0x7')]('/',auth[_0x7c4f('0x8')](),controller[_0x7c4f('0x9')]);router[_0x7c4f('0x7')](_0x7c4f('0xa'),auth[_0x7c4f('0x8')](),controller['describe']);router['get']('/:id',auth[_0x7c4f('0x8')](),controller[_0x7c4f('0xb')]);router[_0x7c4f('0xc')]('/',auth[_0x7c4f('0x8')](),controller[_0x7c4f('0xd')]);router['put']('/:id',auth[_0x7c4f('0x8')](),controller[_0x7c4f('0xe')]);router[_0x7c4f('0xf')](_0x7c4f('0x10'),auth[_0x7c4f('0x8')](),controller[_0x7c4f('0x11')]);module[_0x7c4f('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0766f3d..9c01cbb 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 _0x4132=['getConfigurations','/:id/fields','create','post','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x4972ec,_0xe91d87){var _0x13e352=function(_0x25f93e){while(--_0x25f93e){_0x4972ec['push'](_0x4972ec['shift']());}};_0x13e352(++_0xe91d87);}(_0x4132,0x1ec));var _0x2413=function(_0xb1ac67,_0xc4630d){_0xb1ac67=_0xb1ac67-0x0;var _0x4d7929=_0x4132[_0xb1ac67];return _0x4d7929;};'use strict';var multer=require(_0x2413('0x0'));var util=require(_0x2413('0x1'));var path=require('path');var timeout=require(_0x2413('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2413('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2413('0x4'));var controller=require(_0x2413('0x5'));router[_0x2413('0x6')]('/',auth[_0x2413('0x7')](),controller[_0x2413('0x8')]);router[_0x2413('0x6')](_0x2413('0x9'),auth[_0x2413('0x7')](),controller[_0x2413('0xa')]);router[_0x2413('0x6')](_0x2413('0xb'),auth['isAuthenticated'](),controller[_0x2413('0xc')]);router['get'](_0x2413('0xd'),auth[_0x2413('0x7')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0x2413('0xe')]);router[_0x2413('0xf')](_0x2413('0xb'),auth['isAuthenticated'](),controller[_0x2413('0x10')]);router['put']('/:id',auth[_0x2413('0x7')](),controller[_0x2413('0x11')]);router[_0x2413('0x12')](_0x2413('0x9'),auth['isAuthenticated'](),controller[_0x2413('0x13')]);module[_0x2413('0x14')]=router; \ No newline at end of file +var _0xbc77=['fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','get','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','update','delete','destroy','exports','multer','connect-timeout','Router'];(function(_0x323b6c,_0x263e71){var _0x124c3e=function(_0x14d35f){while(--_0x14d35f){_0x323b6c['push'](_0x323b6c['shift']());}};_0x124c3e(++_0x263e71);}(_0xbc77,0x15d));var _0x7bc7=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xbc77[_0x303c30];return _0x43161b;};'use strict';var multer=require(_0x7bc7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7bc7('0x1'));var express=require('express');var router=express[_0x7bc7('0x2')]();var fs_extra=require(_0x7bc7('0x3'));var auth=require(_0x7bc7('0x4'));var interaction=require(_0x7bc7('0x5'));var config=require('../../config/environment');var controller=require(_0x7bc7('0x6'));router[_0x7bc7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7bc7('0x7')](_0x7bc7('0x8'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xa')]);router[_0x7bc7('0x7')](_0x7bc7('0xb'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xc')]);router['get'](_0x7bc7('0xd'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xe')]);router['post']('/',auth[_0x7bc7('0x9')](),controller[_0x7bc7('0xf')]);router[_0x7bc7('0x10')](_0x7bc7('0xb'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x11')]);router['put'](_0x7bc7('0x8'),auth[_0x7bc7('0x9')](),controller[_0x7bc7('0x12')]);router[_0x7bc7('0x13')](_0x7bc7('0x8'),auth['isAuthenticated'](),controller[_0x7bc7('0x14')]);module[_0x7bc7('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 674e422..f8357da 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 _0x092c=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x271060,_0x3f86b1){var _0x40540b=function(_0x1735a7){while(--_0x1735a7){_0x271060['push'](_0x271060['shift']());}};_0x40540b(++_0x3f86b1);}(_0x092c,0x161));var _0xc092=function(_0x198cd5,_0x4525ba){_0x198cd5=_0x198cd5-0x0;var _0x52e8ce=_0x092c[_0x198cd5];return _0x52e8ce;};'use strict';var Sequelize=require(_0xc092('0x0'));module[_0xc092('0x1')]={'name':{'type':Sequelize[_0xc092('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc092('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0xc092('0x3')]('basic'),'defaultValue':_0xc092('0x4')},'password':{'type':Sequelize[_0xc092('0x2')]},'consumerKey':{'type':Sequelize[_0xc092('0x2')]},'consumerSecret':{'type':Sequelize[_0xc092('0x2')]},'token':{'type':Sequelize[_0xc092('0x2')]},'tokenSecret':{'type':Sequelize[_0xc092('0x2')]},'serverUrl':{'type':Sequelize[_0xc092('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc092('0x3')](_0xc092('0x5'),_0xc092('0x6')),'defaultValue':_0xc092('0x5')}}; \ No newline at end of file +var _0x0b2c=['newTab','sequelize','STRING','ENUM','basic','integrationTab'];(function(_0x4fdc26,_0x5765b4){var _0x3df58f=function(_0x284cd0){while(--_0x284cd0){_0x4fdc26['push'](_0x4fdc26['shift']());}};_0x3df58f(++_0x5765b4);}(_0x0b2c,0x11b));var _0xc0b2=function(_0x454d0c,_0x2ac073){_0x454d0c=_0x454d0c-0x0;var _0x566ead=_0x0b2c[_0x454d0c];return _0x566ead;};'use strict';var Sequelize=require(_0xc0b2('0x0'));module['exports']={'name':{'type':Sequelize[_0xc0b2('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc0b2('0x1')]},'remoteUri':{'type':Sequelize[_0xc0b2('0x1')]},'authType':{'type':Sequelize[_0xc0b2('0x2')](_0xc0b2('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xc0b2('0x1')]},'consumerKey':{'type':Sequelize[_0xc0b2('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xc0b2('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc0b2('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc0b2('0x4'),_0xc0b2('0x5')),'defaultValue':_0xc0b2('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 9540f3a..7b8a9d0 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 _0x2868=['DeskField','getFields','priority','remoteUri','username','password','consumerSecret','token','substring','GET','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','%s:%s','base64','concat','entries','label','statusCode','stringify','send','test','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','DeskAccount','then','includeAll','findAll','rows','catch','show','include','find','create','body','params','destroy','getConfigurations','findOne','DeskConfiguration','order','nolimit','addConfiguration','Subjects','channel'];(function(_0x12022b,_0x14e724){var _0x36152b=function(_0xbcffac){while(--_0xbcffac){_0x12022b['push'](_0x12022b['shift']());}};_0x36152b(++_0x14e724);}(_0x2868,0x15c));var _0x8286=function(_0x1887f2,_0x5ab5d8){_0x1887f2=_0x1887f2-0x0;var _0x5b8fb7=_0x2868[_0x1887f2];return _0x5b8fb7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8286('0x0'));var zipdir=require(_0x8286('0x1'));var jsonpatch=require(_0x8286('0x2'));var rp=require('request-promise');var moment=require(_0x8286('0x3'));var BPromise=require(_0x8286('0x4'));var Mustache=require(_0x8286('0x5'));var util=require(_0x8286('0x6'));var path=require(_0x8286('0x7'));var sox=require(_0x8286('0x8'));var csv=require('to-csv');var ejs=require(_0x8286('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8286('0xa'));var squel=require(_0x8286('0xb'));var crypto=require('crypto');var jsforce=require(_0x8286('0xc'));var deskjs=require(_0x8286('0xd'));var toCsv=require(_0x8286('0xe'));var querystring=require('querystring');var Papa=require(_0x8286('0xf'));var Redis=require(_0x8286('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8286('0x11'));var as=require(_0x8286('0x12'));var hardwareService=require(_0x8286('0x13'));var logger=require(_0x8286('0x14'))(_0x8286('0x15'));var utils=require(_0x8286('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8286('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1e7356,_0x51c7c4){_0x51c7c4=_0x51c7c4||0xcc;return function(_0x2c8b7d){if(_0x2c8b7d){return _0x1e7356['sendStatus'](_0x51c7c4);}return _0x1e7356[_0x8286('0x18')](_0x51c7c4)[_0x8286('0x19')]();};}function respondWithResult(_0x30784e,_0x3df17d){_0x3df17d=_0x3df17d||0xc8;return function(_0x3b1fef){if(_0x3b1fef){return _0x30784e[_0x8286('0x18')](_0x3df17d)[_0x8286('0x1a')](_0x3b1fef);}};}function respondWithFilteredResult(_0x3d66df,_0x219432){return function(_0x46af58){if(_0x46af58){var _0x38ad99=typeof _0x219432[_0x8286('0x1b')]==='undefined'&&typeof _0x219432[_0x8286('0x1c')]===_0x8286('0x1d');var _0xdf2930=_0x46af58[_0x8286('0x1e')];var _0xdc0b7=_0x38ad99?0x0:_0x219432[_0x8286('0x1b')];var _0x500e90=_0x38ad99?_0x46af58[_0x8286('0x1e')]:_0x219432[_0x8286('0x1b')]+_0x219432[_0x8286('0x1c')];var _0x20f2de;if(_0x500e90>=_0xdf2930){_0x500e90=_0xdf2930;_0x20f2de=0xc8;}else{_0x20f2de=0xce;}_0x3d66df[_0x8286('0x18')](_0x20f2de);return _0x3d66df['set'](_0x8286('0x1f'),_0xdc0b7+'-'+_0x500e90+'/'+_0xdf2930)[_0x8286('0x1a')](_0x46af58);}return null;};}function patchUpdates(_0x458a7c){return function(_0x44493b){try{jsonpatch[_0x8286('0x20')](_0x44493b,_0x458a7c,!![]);}catch(_0x20de56){return BPromise[_0x8286('0x21')](_0x20de56);}return _0x44493b['save']();};}function saveUpdates(_0x35eebc,_0x2dd992){return function(_0x500c1c){if(_0x500c1c){return _0x500c1c[_0x8286('0x22')](_0x35eebc)['then'](function(_0x358a6b){return _0x358a6b;});}return null;};}function removeEntity(_0x6decfc,_0x2c0cc3){return function(_0x594a4e){if(_0x594a4e){return _0x594a4e['destroy']()['then'](function(){_0x6decfc[_0x8286('0x18')](0xcc)[_0x8286('0x19')]();});}};}function handleEntityNotFound(_0x5414c4,_0x14725e){return function(_0x55d575){if(!_0x55d575){_0x5414c4[_0x8286('0x23')](0x194);}return _0x55d575;};}function handleError(_0x1734a6,_0x4255d3){_0x4255d3=_0x4255d3||0x1f4;return function(_0x27de34){logger[_0x8286('0x24')](_0x27de34[_0x8286('0x25')]);if(_0x27de34[_0x8286('0x26')]){delete _0x27de34[_0x8286('0x26')];}_0x1734a6[_0x8286('0x18')](_0x4255d3)['send'](_0x27de34);};}exports[_0x8286('0x27')]=function(_0x595054,_0x541e9e){var _0x4e1d6c={},_0x258b36={},_0x3c7b83={'count':0x0,'rows':[]};var _0x9d4964=_[_0x8286('0x28')](db['DeskAccount'][_0x8286('0x29')],function(_0x2b677b){return{'name':_0x2b677b[_0x8286('0x2a')],'type':_0x2b677b[_0x8286('0x2b')]['key']};});_0x258b36['model']=_['map'](_0x9d4964,'name');_0x258b36['query']=_[_0x8286('0x2c')](_0x595054[_0x8286('0x2d')]);_0x258b36[_0x8286('0x2e')]=_[_0x8286('0x2f')](_0x258b36[_0x8286('0x30')],_0x258b36['query']);_0x4e1d6c[_0x8286('0x31')]=_[_0x8286('0x2f')](_0x258b36['model'],qs[_0x8286('0x32')](_0x595054[_0x8286('0x2d')][_0x8286('0x32')]));_0x4e1d6c[_0x8286('0x31')]=_0x4e1d6c[_0x8286('0x31')][_0x8286('0x33')]?_0x4e1d6c[_0x8286('0x31')]:_0x258b36[_0x8286('0x30')];if(!_0x595054[_0x8286('0x2d')]['hasOwnProperty']('nolimit')){_0x4e1d6c[_0x8286('0x1c')]=qs[_0x8286('0x1c')](_0x595054[_0x8286('0x2d')][_0x8286('0x1c')]);_0x4e1d6c[_0x8286('0x1b')]=qs[_0x8286('0x1b')](_0x595054[_0x8286('0x2d')][_0x8286('0x1b')]);}_0x4e1d6c['order']=qs[_0x8286('0x34')](_0x595054['query']['sort']);_0x4e1d6c[_0x8286('0x35')]=qs['filters'](_[_0x8286('0x36')](_0x595054[_0x8286('0x2d')],_0x258b36[_0x8286('0x2e')]),_0x9d4964);if(_0x595054[_0x8286('0x2d')][_0x8286('0x37')]){_0x4e1d6c[_0x8286('0x35')]=_[_0x8286('0x38')](_0x4e1d6c['where'],{'$or':_[_0x8286('0x28')](_0x9d4964,function(_0x80724b){if(_0x80724b['type']!==_0x8286('0x39')){var _0x17c43f={};_0x17c43f[_0x80724b[_0x8286('0x26')]]={'$like':'%'+_0x595054[_0x8286('0x2d')][_0x8286('0x37')]+'%'};return _0x17c43f;}})});}_0x4e1d6c=_['merge']({},_0x4e1d6c,_0x595054[_0x8286('0x3a')]);var _0x31c48c={'where':_0x4e1d6c[_0x8286('0x35')]};return db[_0x8286('0x3b')][_0x8286('0x1e')](_0x31c48c)[_0x8286('0x3c')](function(_0x3a4929){_0x3c7b83['count']=_0x3a4929;if(_0x595054[_0x8286('0x2d')][_0x8286('0x3d')]){_0x4e1d6c['include']=[{'all':!![]}];}return db['DeskAccount'][_0x8286('0x3e')](_0x4e1d6c);})['then'](function(_0x9be7d8){_0x3c7b83[_0x8286('0x3f')]=_0x9be7d8;return _0x3c7b83;})['then'](respondWithFilteredResult(_0x541e9e,_0x4e1d6c))[_0x8286('0x40')](handleError(_0x541e9e,null));};exports[_0x8286('0x41')]=function(_0x4f78c2,_0x45caa3){var _0x1224c7={'raw':![],'where':{'id':_0x4f78c2['params']['id']}},_0x362a15={};_0x362a15[_0x8286('0x30')]=_[_0x8286('0x2c')](db['DeskAccount']['rawAttributes']);_0x362a15[_0x8286('0x2d')]=_['keys'](_0x4f78c2[_0x8286('0x2d')]);_0x362a15[_0x8286('0x2e')]=_[_0x8286('0x2f')](_0x362a15['model'],_0x362a15[_0x8286('0x2d')]);_0x1224c7[_0x8286('0x31')]=_['intersection'](_0x362a15[_0x8286('0x30')],qs[_0x8286('0x32')](_0x4f78c2['query']['fields']));_0x1224c7[_0x8286('0x31')]=_0x1224c7[_0x8286('0x31')][_0x8286('0x33')]?_0x1224c7[_0x8286('0x31')]:_0x362a15[_0x8286('0x30')];if(_0x4f78c2[_0x8286('0x2d')][_0x8286('0x3d')]){_0x1224c7[_0x8286('0x42')]=[{'all':!![]}];}_0x1224c7=_[_0x8286('0x38')]({},_0x1224c7,_0x4f78c2['options']);return db['DeskAccount'][_0x8286('0x43')](_0x1224c7)['then'](handleEntityNotFound(_0x45caa3,null))[_0x8286('0x3c')](respondWithResult(_0x45caa3,null))[_0x8286('0x40')](handleError(_0x45caa3,null));};exports[_0x8286('0x44')]=function(_0x4089af,_0x58f047){return db['DeskAccount']['create'](_0x4089af[_0x8286('0x45')],{})[_0x8286('0x3c')](respondWithResult(_0x58f047,0xc9))[_0x8286('0x40')](handleError(_0x58f047,null));};exports[_0x8286('0x22')]=function(_0x5057f8,_0x3d9b5c){if(_0x5057f8[_0x8286('0x45')]['id']){delete _0x5057f8[_0x8286('0x45')]['id'];}return db['DeskAccount'][_0x8286('0x43')]({'where':{'id':_0x5057f8[_0x8286('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d9b5c,null))['then'](saveUpdates(_0x5057f8[_0x8286('0x45')],null))[_0x8286('0x3c')](respondWithResult(_0x3d9b5c,null))[_0x8286('0x40')](handleError(_0x3d9b5c,null));};exports[_0x8286('0x47')]=function(_0xf29495,_0x51c036){return db[_0x8286('0x3b')][_0x8286('0x43')]({'where':{'id':_0xf29495['params']['id']}})[_0x8286('0x3c')](handleEntityNotFound(_0x51c036,null))[_0x8286('0x3c')](removeEntity(_0x51c036,null))['catch'](handleError(_0x51c036,null));};exports[_0x8286('0x48')]=function(_0x384c89,_0x431334,_0x96b065){var _0x47a5a1={};var _0x5653c5={};var _0x3cc687;var _0x47f619;return db[_0x8286('0x3b')][_0x8286('0x49')]({'where':{'id':_0x384c89[_0x8286('0x46')]['id']}})[_0x8286('0x3c')](handleEntityNotFound(_0x431334,null))['then'](function(_0x4ed8dc){if(_0x4ed8dc){_0x3cc687=_0x4ed8dc;_0x5653c5['model']=_[_0x8286('0x2c')](db[_0x8286('0x4a')][_0x8286('0x29')]);_0x5653c5['query']=_[_0x8286('0x2c')](_0x384c89[_0x8286('0x2d')]);_0x5653c5[_0x8286('0x2e')]=_[_0x8286('0x2f')](_0x5653c5[_0x8286('0x30')],_0x5653c5[_0x8286('0x2d')]);_0x47a5a1[_0x8286('0x31')]=_[_0x8286('0x2f')](_0x5653c5[_0x8286('0x30')],qs[_0x8286('0x32')](_0x384c89[_0x8286('0x2d')]['fields']));_0x47a5a1['attributes']=_0x47a5a1[_0x8286('0x31')][_0x8286('0x33')]?_0x47a5a1[_0x8286('0x31')]:_0x5653c5[_0x8286('0x30')];_0x47a5a1[_0x8286('0x4b')]=qs[_0x8286('0x34')](_0x384c89[_0x8286('0x2d')][_0x8286('0x34')]);_0x47a5a1[_0x8286('0x35')]=qs[_0x8286('0x2e')](_[_0x8286('0x36')](_0x384c89[_0x8286('0x2d')],_0x5653c5['filters']));if(_0x384c89[_0x8286('0x2d')][_0x8286('0x37')]){_0x47a5a1[_0x8286('0x35')]=_[_0x8286('0x38')](_0x47a5a1['where'],{'$or':_[_0x8286('0x28')](_0x47a5a1[_0x8286('0x31')],function(_0x28240a){var _0x3953ed={};_0x3953ed[_0x28240a]={'$like':'%'+_0x384c89[_0x8286('0x2d')]['filter']+'%'};return _0x3953ed;})});}_0x47a5a1=_[_0x8286('0x38')]({},_0x47a5a1,_0x384c89[_0x8286('0x3a')]);return _0x3cc687[_0x8286('0x48')](_0x47a5a1);}})[_0x8286('0x3c')](function(_0x1cb8b4){if(_0x1cb8b4){_0x47f619=_0x1cb8b4[_0x8286('0x33')];if(!_0x384c89[_0x8286('0x2d')]['hasOwnProperty'](_0x8286('0x4c'))){_0x47a5a1[_0x8286('0x1c')]=qs[_0x8286('0x1c')](_0x384c89[_0x8286('0x2d')][_0x8286('0x1c')]);_0x47a5a1['offset']=qs[_0x8286('0x1b')](_0x384c89['query']['offset']);}return _0x3cc687[_0x8286('0x48')](_0x47a5a1);}})[_0x8286('0x3c')](function(_0xa2c4e6){if(_0xa2c4e6){return _0xa2c4e6?{'count':_0x47f619,'rows':_0xa2c4e6}:null;}})[_0x8286('0x3c')](respondWithResult(_0x431334,null))['catch'](handleError(_0x431334,null));};exports[_0x8286('0x4d')]=function(_0x5c6ab9,_0x40195d,_0xbfed5d){if(_0x5c6ab9['body']['id']){delete _0x5c6ab9[_0x8286('0x45')]['id'];}return db[_0x8286('0x3b')][_0x8286('0x49')]({'where':{'id':_0x5c6ab9['params']['id']}})[_0x8286('0x3c')](handleEntityNotFound(_0x40195d,null))['then'](function(_0x51824c){if(_0x51824c){_0x5c6ab9[_0x8286('0x45')]['AccountId']=_0x51824c['id'];_0x5c6ab9[_0x8286('0x45')][_0x8286('0x4e')]=integrations['getSubjects'](_0x5c6ab9[_0x8286('0x45')][_0x8286('0x4f')],_0x5c6ab9[_0x8286('0x45')]['type']);_0x5c6ab9['body']['Descriptions']=integrations['getDescriptions'](_0x5c6ab9['body']['channel'],_0x5c6ab9[_0x8286('0x45')][_0x8286('0x2b')]);return db[_0x8286('0x4a')][_0x8286('0x44')](_0x5c6ab9[_0x8286('0x45')],{'include':[{'model':db['DeskField'],'as':_0x8286('0x4e')},{'model':db[_0x8286('0x50')],'as':'Descriptions'}]});}return null;})[_0x8286('0x3c')](respondWithResult(_0x40195d,null))[_0x8286('0x40')](handleError(_0x40195d,null));};exports[_0x8286('0x51')]=function(_0x528da2,_0x155192,_0x1d0f7){var _0x157ff6=[{'name':_0x8286('0x52'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x1396b2='';return db[_0x8286('0x3b')][_0x8286('0x49')]({'where':{'id':_0x528da2[_0x8286('0x46')]['id']},'attributes':['id',_0x8286('0x53'),'authType',_0x8286('0x54'),_0x8286('0x55'),'consumerKey',_0x8286('0x56'),_0x8286('0x57'),'tokenSecret']})['then'](handleEntityNotFound(_0x155192,null))['then'](function(_0xfb5bfa){if(_0xfb5bfa){_0x1396b2=_0xfb5bfa[_0x8286('0x53')];var _0x4fa512=_0x1396b2['slice'](-0x1);if(_0x4fa512==='/'){_0x1396b2=_0x1396b2[_0x8286('0x58')](0x0,_0x1396b2['lastIndexOf'](_0x4fa512));}var _0x23ba27={'method':_0x8286('0x59'),'uri':util['format'](_0x8286('0x5a'),_0x1396b2),'headers':{'Content-Type':_0x8286('0x5b'),'Accept':'application/json'},'json':!![]};if(_0xfb5bfa[_0x8286('0x5c')]===_0x8286('0x5d')){_0x23ba27[_0x8286('0x5e')][_0x8286('0x5f')]=util[_0x8286('0x60')](_0x8286('0x61'),new Buffer(util[_0x8286('0x60')](_0x8286('0x62'),_0xfb5bfa[_0x8286('0x54')],_0xfb5bfa[_0x8286('0x55')]))['toString'](_0x8286('0x63')));}return rp(_0x23ba27)[_0x8286('0x3c')](function(_0x3b419a){return _0x157ff6[_0x8286('0x64')](_['map'](_0x3b419a['_embedded'][_0x8286('0x65')],function(_0x49f7a8){return{'id':_0x49f7a8[_0x8286('0x26')],'name':_0x49f7a8['name'],'type':_0x49f7a8[_0x8286('0x2b')],'active':_0x49f7a8['active'],'label':_0x49f7a8[_0x8286('0x66')],'custom':!![]};}));});}})['then'](function(_0x21ff3a){return{'count':_0x21ff3a[_0x8286('0x33')],'rows':_0x21ff3a};})[_0x8286('0x3c')](respondWithResult(_0x155192,null))['catch'](function(_0x2db714){var _0x25cbdc=_0x528da2[_0x8286('0x2d')]['test']?0x1f4:_0x2db714[_0x8286('0x67')]||0x1f4;logger[_0x8286('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0x8286('0x51'),_0x25cbdc,JSON[_0x8286('0x68')](_0x2db714));delete _0x2db714[_0x8286('0x26')];if(_0x25cbdc===0x191){_0x25cbdc=0x190;}_0x155192[_0x8286('0x18')](_0x25cbdc)[_0x8286('0x69')](_0x528da2[_0x8286('0x2d')][_0x8286('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x2db714['statusCode']}:_0x2db714);});}; \ No newline at end of file +var _0xf238=['%s:%s','password','toString','base64','concat','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','slice','substring','GET','format','%s/custom_fields','application/json','headers','Authorization'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf238,0x173));var _0x8f23=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0xf238[_0xa3c06b];return _0x33aa1d;};'use strict';var emlformat=require(_0x8f23('0x0'));var rimraf=require(_0x8f23('0x1'));var zipdir=require(_0x8f23('0x2'));var jsonpatch=require(_0x8f23('0x3'));var rp=require(_0x8f23('0x4'));var moment=require(_0x8f23('0x5'));var BPromise=require(_0x8f23('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8f23('0x7'));var sox=require(_0x8f23('0x8'));var csv=require(_0x8f23('0x9'));var ejs=require(_0x8f23('0xa'));var fs=require('fs');var fs_extra=require(_0x8f23('0xb'));var _=require(_0x8f23('0xc'));var squel=require(_0x8f23('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8f23('0xe'));var toCsv=require(_0x8f23('0x9'));var querystring=require(_0x8f23('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8f23('0x10'));var qs=require(_0x8f23('0x11'));var as=require(_0x8f23('0x12'));var hardwareService=require(_0x8f23('0x13'));var logger=require(_0x8f23('0x14'))(_0x8f23('0x15'));var utils=require(_0x8f23('0x16'));var config=require(_0x8f23('0x17'));var licenseUtil=require(_0x8f23('0x18'));var db=require(_0x8f23('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4a48ad,_0x542a05){_0x542a05=_0x542a05||0xcc;return function(_0x1da0ff){if(_0x1da0ff){return _0x4a48ad[_0x8f23('0x1a')](_0x542a05);}return _0x4a48ad[_0x8f23('0x1b')](_0x542a05)[_0x8f23('0x1c')]();};}function respondWithResult(_0x3c8051,_0x36263c){_0x36263c=_0x36263c||0xc8;return function(_0x472c4a){if(_0x472c4a){return _0x3c8051[_0x8f23('0x1b')](_0x36263c)['json'](_0x472c4a);}};}function respondWithFilteredResult(_0x210dbc,_0x4eef03){return function(_0xdaf194){if(_0xdaf194){var _0xd25baf=typeof _0x4eef03[_0x8f23('0x1d')]===_0x8f23('0x1e')&&typeof _0x4eef03['limit']==='undefined';var _0x3d4236=_0xdaf194['count'];var _0x43a9e6=_0xd25baf?0x0:_0x4eef03[_0x8f23('0x1d')];var _0x542536=_0xd25baf?_0xdaf194[_0x8f23('0x1f')]:_0x4eef03[_0x8f23('0x1d')]+_0x4eef03['limit'];var _0x4717e2;if(_0x542536>=_0x3d4236){_0x542536=_0x3d4236;_0x4717e2=0xc8;}else{_0x4717e2=0xce;}_0x210dbc[_0x8f23('0x1b')](_0x4717e2);return _0x210dbc['set'](_0x8f23('0x20'),_0x43a9e6+'-'+_0x542536+'/'+_0x3d4236)[_0x8f23('0x21')](_0xdaf194);}return null;};}function patchUpdates(_0x3e7463){return function(_0x328426){try{jsonpatch[_0x8f23('0x22')](_0x328426,_0x3e7463,!![]);}catch(_0x201d22){return BPromise['reject'](_0x201d22);}return _0x328426[_0x8f23('0x23')]();};}function saveUpdates(_0x5e66ff,_0x38c484){return function(_0x2b69f3){if(_0x2b69f3){return _0x2b69f3[_0x8f23('0x24')](_0x5e66ff)['then'](function(_0x2bf825){return _0x2bf825;});}return null;};}function removeEntity(_0x59815d,_0x232e4e){return function(_0x32e93e){if(_0x32e93e){return _0x32e93e[_0x8f23('0x25')]()[_0x8f23('0x26')](function(){_0x59815d['status'](0xcc)[_0x8f23('0x1c')]();});}};}function handleEntityNotFound(_0x4a2664,_0x19942b){return function(_0x520198){if(!_0x520198){_0x4a2664[_0x8f23('0x1a')](0x194);}return _0x520198;};}function handleError(_0x10ac76,_0xc2966d){_0xc2966d=_0xc2966d||0x1f4;return function(_0x27d43e){logger[_0x8f23('0x27')](_0x27d43e[_0x8f23('0x28')]);if(_0x27d43e[_0x8f23('0x29')]){delete _0x27d43e[_0x8f23('0x29')];}_0x10ac76[_0x8f23('0x1b')](_0xc2966d)[_0x8f23('0x2a')](_0x27d43e);};}exports[_0x8f23('0x2b')]=function(_0xa01676,_0x4c1c5c){var _0x32671b={},_0x599e1a={},_0x38b811={'count':0x0,'rows':[]};var _0x146129=_[_0x8f23('0x2c')](db[_0x8f23('0x2d')][_0x8f23('0x2e')],function(_0x2425f3){return{'name':_0x2425f3[_0x8f23('0x2f')],'type':_0x2425f3[_0x8f23('0x30')][_0x8f23('0x31')]};});_0x599e1a['model']=_[_0x8f23('0x2c')](_0x146129,_0x8f23('0x29'));_0x599e1a[_0x8f23('0x32')]=_[_0x8f23('0x33')](_0xa01676['query']);_0x599e1a[_0x8f23('0x34')]=_['intersection'](_0x599e1a[_0x8f23('0x35')],_0x599e1a[_0x8f23('0x32')]);_0x32671b[_0x8f23('0x36')]=_['intersection'](_0x599e1a[_0x8f23('0x35')],qs[_0x8f23('0x37')](_0xa01676[_0x8f23('0x32')]['fields']));_0x32671b[_0x8f23('0x36')]=_0x32671b[_0x8f23('0x36')][_0x8f23('0x38')]?_0x32671b[_0x8f23('0x36')]:_0x599e1a[_0x8f23('0x35')];if(!_0xa01676['query'][_0x8f23('0x39')](_0x8f23('0x3a'))){_0x32671b[_0x8f23('0x3b')]=qs[_0x8f23('0x3b')](_0xa01676[_0x8f23('0x32')][_0x8f23('0x3b')]);_0x32671b[_0x8f23('0x1d')]=qs[_0x8f23('0x1d')](_0xa01676[_0x8f23('0x32')][_0x8f23('0x1d')]);}_0x32671b[_0x8f23('0x3c')]=qs[_0x8f23('0x3d')](_0xa01676[_0x8f23('0x32')][_0x8f23('0x3d')]);_0x32671b[_0x8f23('0x3e')]=qs[_0x8f23('0x34')](_[_0x8f23('0x3f')](_0xa01676[_0x8f23('0x32')],_0x599e1a[_0x8f23('0x34')]),_0x146129);if(_0xa01676[_0x8f23('0x32')][_0x8f23('0x40')]){_0x32671b[_0x8f23('0x3e')]=_[_0x8f23('0x41')](_0x32671b[_0x8f23('0x3e')],{'$or':_[_0x8f23('0x2c')](_0x146129,function(_0x19d260){if(_0x19d260[_0x8f23('0x30')]!==_0x8f23('0x42')){var _0x106408={};_0x106408[_0x19d260[_0x8f23('0x29')]]={'$like':'%'+_0xa01676['query'][_0x8f23('0x40')]+'%'};return _0x106408;}})});}_0x32671b=_[_0x8f23('0x41')]({},_0x32671b,_0xa01676[_0x8f23('0x43')]);var _0x1eb8e3={'where':_0x32671b['where']};return db['DeskAccount']['count'](_0x1eb8e3)[_0x8f23('0x26')](function(_0x227534){_0x38b811[_0x8f23('0x1f')]=_0x227534;if(_0xa01676[_0x8f23('0x32')][_0x8f23('0x44')]){_0x32671b[_0x8f23('0x45')]=[{'all':!![]}];}return db[_0x8f23('0x2d')][_0x8f23('0x46')](_0x32671b);})[_0x8f23('0x26')](function(_0x303967){_0x38b811['rows']=_0x303967;return _0x38b811;})[_0x8f23('0x26')](respondWithFilteredResult(_0x4c1c5c,_0x32671b))[_0x8f23('0x47')](handleError(_0x4c1c5c,null));};exports[_0x8f23('0x48')]=function(_0x5e0dff,_0x5ccf6e){var _0x540f7b={'raw':![],'where':{'id':_0x5e0dff[_0x8f23('0x49')]['id']}},_0x474c2f={};_0x474c2f[_0x8f23('0x35')]=_[_0x8f23('0x33')](db[_0x8f23('0x2d')][_0x8f23('0x2e')]);_0x474c2f['query']=_[_0x8f23('0x33')](_0x5e0dff[_0x8f23('0x32')]);_0x474c2f[_0x8f23('0x34')]=_[_0x8f23('0x4a')](_0x474c2f[_0x8f23('0x35')],_0x474c2f['query']);_0x540f7b['attributes']=_[_0x8f23('0x4a')](_0x474c2f[_0x8f23('0x35')],qs[_0x8f23('0x37')](_0x5e0dff[_0x8f23('0x32')][_0x8f23('0x37')]));_0x540f7b[_0x8f23('0x36')]=_0x540f7b[_0x8f23('0x36')][_0x8f23('0x38')]?_0x540f7b[_0x8f23('0x36')]:_0x474c2f[_0x8f23('0x35')];if(_0x5e0dff[_0x8f23('0x32')][_0x8f23('0x44')]){_0x540f7b['include']=[{'all':!![]}];}_0x540f7b=_[_0x8f23('0x41')]({},_0x540f7b,_0x5e0dff[_0x8f23('0x43')]);return db[_0x8f23('0x2d')][_0x8f23('0x4b')](_0x540f7b)['then'](handleEntityNotFound(_0x5ccf6e,null))['then'](respondWithResult(_0x5ccf6e,null))[_0x8f23('0x47')](handleError(_0x5ccf6e,null));};exports[_0x8f23('0x4c')]=function(_0xedc7b2,_0x181a78){return db[_0x8f23('0x2d')][_0x8f23('0x4c')](_0xedc7b2[_0x8f23('0x4d')],{})[_0x8f23('0x26')](respondWithResult(_0x181a78,0xc9))[_0x8f23('0x47')](handleError(_0x181a78,null));};exports['update']=function(_0x369468,_0x452719){if(_0x369468['body']['id']){delete _0x369468[_0x8f23('0x4d')]['id'];}return db[_0x8f23('0x2d')]['find']({'where':{'id':_0x369468[_0x8f23('0x49')]['id']}})[_0x8f23('0x26')](handleEntityNotFound(_0x452719,null))['then'](saveUpdates(_0x369468['body'],null))[_0x8f23('0x26')](respondWithResult(_0x452719,null))[_0x8f23('0x47')](handleError(_0x452719,null));};exports['destroy']=function(_0x53e864,_0x4a2623){return db[_0x8f23('0x2d')][_0x8f23('0x4b')]({'where':{'id':_0x53e864[_0x8f23('0x49')]['id']}})[_0x8f23('0x26')](handleEntityNotFound(_0x4a2623,null))[_0x8f23('0x26')](removeEntity(_0x4a2623,null))[_0x8f23('0x47')](handleError(_0x4a2623,null));};exports['getConfigurations']=function(_0xc006a6,_0x5795ff,_0x126e34){var _0x53b1a9={};var _0x458c0a={};var _0x1f9902;var _0x363c46;return db[_0x8f23('0x2d')][_0x8f23('0x4e')]({'where':{'id':_0xc006a6[_0x8f23('0x49')]['id']}})['then'](handleEntityNotFound(_0x5795ff,null))[_0x8f23('0x26')](function(_0x504c77){if(_0x504c77){_0x1f9902=_0x504c77;_0x458c0a['model']=_[_0x8f23('0x33')](db[_0x8f23('0x4f')][_0x8f23('0x2e')]);_0x458c0a[_0x8f23('0x32')]=_[_0x8f23('0x33')](_0xc006a6['query']);_0x458c0a['filters']=_[_0x8f23('0x4a')](_0x458c0a[_0x8f23('0x35')],_0x458c0a[_0x8f23('0x32')]);_0x53b1a9[_0x8f23('0x36')]=_[_0x8f23('0x4a')](_0x458c0a[_0x8f23('0x35')],qs[_0x8f23('0x37')](_0xc006a6['query'][_0x8f23('0x37')]));_0x53b1a9[_0x8f23('0x36')]=_0x53b1a9['attributes'][_0x8f23('0x38')]?_0x53b1a9[_0x8f23('0x36')]:_0x458c0a['model'];_0x53b1a9[_0x8f23('0x3c')]=qs[_0x8f23('0x3d')](_0xc006a6[_0x8f23('0x32')][_0x8f23('0x3d')]);_0x53b1a9[_0x8f23('0x3e')]=qs[_0x8f23('0x34')](_[_0x8f23('0x3f')](_0xc006a6[_0x8f23('0x32')],_0x458c0a['filters']));if(_0xc006a6[_0x8f23('0x32')][_0x8f23('0x40')]){_0x53b1a9[_0x8f23('0x3e')]=_[_0x8f23('0x41')](_0x53b1a9[_0x8f23('0x3e')],{'$or':_[_0x8f23('0x2c')](_0x53b1a9[_0x8f23('0x36')],function(_0x7054a8){var _0x4a8293={};_0x4a8293[_0x7054a8]={'$like':'%'+_0xc006a6[_0x8f23('0x32')][_0x8f23('0x40')]+'%'};return _0x4a8293;})});}_0x53b1a9=_[_0x8f23('0x41')]({},_0x53b1a9,_0xc006a6[_0x8f23('0x43')]);return _0x1f9902[_0x8f23('0x50')](_0x53b1a9);}})['then'](function(_0x489555){if(_0x489555){_0x363c46=_0x489555[_0x8f23('0x38')];if(!_0xc006a6['query'][_0x8f23('0x39')](_0x8f23('0x3a'))){_0x53b1a9[_0x8f23('0x3b')]=qs[_0x8f23('0x3b')](_0xc006a6[_0x8f23('0x32')][_0x8f23('0x3b')]);_0x53b1a9[_0x8f23('0x1d')]=qs[_0x8f23('0x1d')](_0xc006a6['query'][_0x8f23('0x1d')]);}return _0x1f9902[_0x8f23('0x50')](_0x53b1a9);}})[_0x8f23('0x26')](function(_0x3ba690){if(_0x3ba690){return _0x3ba690?{'count':_0x363c46,'rows':_0x3ba690}:null;}})[_0x8f23('0x26')](respondWithResult(_0x5795ff,null))[_0x8f23('0x47')](handleError(_0x5795ff,null));};exports[_0x8f23('0x51')]=function(_0x1ac15a,_0x56d4da,_0x4d01d1){if(_0x1ac15a[_0x8f23('0x4d')]['id']){delete _0x1ac15a[_0x8f23('0x4d')]['id'];}return db[_0x8f23('0x2d')]['findOne']({'where':{'id':_0x1ac15a[_0x8f23('0x49')]['id']}})[_0x8f23('0x26')](handleEntityNotFound(_0x56d4da,null))[_0x8f23('0x26')](function(_0xa5dfb1){if(_0xa5dfb1){_0x1ac15a['body'][_0x8f23('0x52')]=_0xa5dfb1['id'];_0x1ac15a[_0x8f23('0x4d')][_0x8f23('0x53')]=integrations[_0x8f23('0x54')](_0x1ac15a[_0x8f23('0x4d')][_0x8f23('0x55')],_0x1ac15a['body'][_0x8f23('0x30')]);_0x1ac15a[_0x8f23('0x4d')][_0x8f23('0x56')]=integrations['getDescriptions'](_0x1ac15a[_0x8f23('0x4d')][_0x8f23('0x55')],_0x1ac15a['body'][_0x8f23('0x30')]);return db[_0x8f23('0x4f')]['create'](_0x1ac15a[_0x8f23('0x4d')],{'include':[{'model':db[_0x8f23('0x57')],'as':_0x8f23('0x53')},{'model':db['DeskField'],'as':_0x8f23('0x56')}]});}return null;})[_0x8f23('0x26')](respondWithResult(_0x56d4da,null))[_0x8f23('0x47')](handleError(_0x56d4da,null));};exports[_0x8f23('0x58')]=function(_0x3b7c55,_0x2a5c75,_0x240cc3){var _0x50f174=[{'name':_0x8f23('0x59'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x159742='';return db[_0x8f23('0x2d')][_0x8f23('0x4e')]({'where':{'id':_0x3b7c55[_0x8f23('0x49')]['id']},'attributes':['id',_0x8f23('0x5a'),_0x8f23('0x5b'),_0x8f23('0x5c'),'password',_0x8f23('0x5d'),_0x8f23('0x5e'),_0x8f23('0x5f'),_0x8f23('0x60')]})[_0x8f23('0x26')](handleEntityNotFound(_0x2a5c75,null))[_0x8f23('0x26')](function(_0x1336c0){if(_0x1336c0){_0x159742=_0x1336c0[_0x8f23('0x5a')];var _0x3dc7bf=_0x159742[_0x8f23('0x61')](-0x1);if(_0x3dc7bf==='/'){_0x159742=_0x159742[_0x8f23('0x62')](0x0,_0x159742['lastIndexOf'](_0x3dc7bf));}var _0x1dbe6f={'method':_0x8f23('0x63'),'uri':util[_0x8f23('0x64')](_0x8f23('0x65'),_0x159742),'headers':{'Content-Type':'application/json','Accept':_0x8f23('0x66')},'json':!![]};if(_0x1336c0[_0x8f23('0x5b')]==='basic'){_0x1dbe6f[_0x8f23('0x67')][_0x8f23('0x68')]=util[_0x8f23('0x64')]('Basic\x20%s',new Buffer(util[_0x8f23('0x64')](_0x8f23('0x69'),_0x1336c0[_0x8f23('0x5c')],_0x1336c0[_0x8f23('0x6a')]))[_0x8f23('0x6b')](_0x8f23('0x6c')));}return rp(_0x1dbe6f)[_0x8f23('0x26')](function(_0x32cb0d){return _0x50f174[_0x8f23('0x6d')](_['map'](_0x32cb0d[_0x8f23('0x6e')][_0x8f23('0x6f')],function(_0x1ce058){return{'id':_0x1ce058[_0x8f23('0x29')],'name':_0x1ce058[_0x8f23('0x29')],'type':_0x1ce058[_0x8f23('0x30')],'active':_0x1ce058[_0x8f23('0x70')],'label':_0x1ce058[_0x8f23('0x71')],'custom':!![]};}));});}})[_0x8f23('0x26')](function(_0x8f5f0a){return{'count':_0x8f5f0a[_0x8f23('0x38')],'rows':_0x8f5f0a};})[_0x8f23('0x26')](respondWithResult(_0x2a5c75,null))[_0x8f23('0x47')](function(_0x2d4bba){var _0x411e62=_0x3b7c55[_0x8f23('0x32')][_0x8f23('0x72')]?0x1f4:_0x2d4bba[_0x8f23('0x73')]||0x1f4;logger['error'](_0x8f23('0x74'),_0x8f23('0x58'),_0x411e62,JSON[_0x8f23('0x75')](_0x2d4bba));delete _0x2d4bba['name'];if(_0x411e62===0x191){_0x411e62=0x190;}_0x2a5c75[_0x8f23('0x1b')](_0x411e62)['send'](_0x3b7c55['query'][_0x8f23('0x72')]?{'message':_0x8f23('0x76'),'statusCode':_0x2d4bba[_0x8f23('0x73')]}:_0x2d4bba);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ccf9fd3..63ed5c0 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 _0x8a3b=['int_desk_accounts','lodash','util','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes','define','DeskAccount'];(function(_0x4192a0,_0x5d118f){var _0x347178=function(_0xd7ad7a){while(--_0xd7ad7a){_0x4192a0['push'](_0x4192a0['shift']());}};_0x347178(++_0x5d118f);}(_0x8a3b,0xa1));var _0xb8a3=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x8a3b[_0x1b5aea];return _0x15cfc6;};'use strict';var _=require(_0xb8a3('0x0'));var util=require(_0xb8a3('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xb8a3('0x2'));var rp=require(_0xb8a3('0x3'));var fs=require('fs');var path=require(_0xb8a3('0x4'));var rimraf=require(_0xb8a3('0x5'));var config=require('../../config/environment');var attributes=require(_0xb8a3('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x11be62,_0x1c6cd8){return _0x11be62[_0xb8a3('0x7')](_0xb8a3('0x8'),attributes,{'tableName':_0xb8a3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe769=['api','request-promise','path','../../config/environment','./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x5e60a6,_0x484133){var _0x11e36f=function(_0x7ab0bf){while(--_0x7ab0bf){_0x5e60a6['push'](_0x5e60a6['shift']());}};_0x11e36f(++_0x484133);}(_0xe769,0x1c0));var _0x9e76=function(_0x401554,_0x34b410){_0x401554=_0x401554-0x0;var _0x5b70e9=_0xe769[_0x401554];return _0x5b70e9;};'use strict';var _=require(_0x9e76('0x0'));var util=require(_0x9e76('0x1'));var logger=require(_0x9e76('0x2'))(_0x9e76('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9e76('0x4'));var fs=require('fs');var path=require(_0x9e76('0x5'));var rimraf=require('rimraf');var config=require(_0x9e76('0x6'));var attributes=require(_0x9e76('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x23d334,_0x15977c){return _0x23d334[_0x9e76('0x8')](_0x9e76('0x9'),attributes,{'tableName':_0x9e76('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 209392a..2821421 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 _0x692e=['find','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','map','include','model'];(function(_0x473fc7,_0x45f5cf){var _0x751c85=function(_0x2b1444){while(--_0x2b1444){_0x473fc7['push'](_0x473fc7['shift']());}};_0x751c85(++_0x45f5cf);}(_0x692e,0x178));var _0xe692=function(_0x4cf6fe,_0x2cb72f){_0x4cf6fe=_0x4cf6fe-0x0;var _0x25d421=_0x692e[_0x4cf6fe];return _0x25d421;};'use strict';var _=require(_0xe692('0x0'));var util=require(_0xe692('0x1'));var moment=require(_0xe692('0x2'));var BPromise=require(_0xe692('0x3'));var rs=require(_0xe692('0x4'));var fs=require('fs');var Redis=require(_0xe692('0x5'));var db=require(_0xe692('0x6'))['db'];var utils=require(_0xe692('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xe692('0x8'));var jayson=require(_0xe692('0x9'));var client=jayson[_0xe692('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x461c8c,_0x20bc5b,_0x3fcd28){return new BPromise(function(_0x5d3787,_0x37a2fc){return client['request'](_0x461c8c,_0x3fcd28)[_0xe692('0xb')](function(_0x8bb632){logger[_0xe692('0xc')](_0xe692('0xd'),_0x20bc5b,_0xe692('0xe'));logger[_0xe692('0xf')](_0xe692('0x10'),_0x20bc5b,_0xe692('0xe'),JSON[_0xe692('0x11')](_0x8bb632));if(_0x8bb632[_0xe692('0x12')]){if(_0x8bb632[_0xe692('0x12')][_0xe692('0x13')]===0x1f4){logger['error'](_0xe692('0xd'),_0x20bc5b,_0x8bb632[_0xe692('0x12')][_0xe692('0x14')]);return _0x37a2fc(_0x8bb632['error'][_0xe692('0x14')]);}logger[_0xe692('0x12')](_0xe692('0xd'),_0x20bc5b,_0x8bb632[_0xe692('0x12')][_0xe692('0x14')]);return _0x5d3787(_0x8bb632[_0xe692('0x12')][_0xe692('0x14')]);}else{logger['info'](_0xe692('0xd'),_0x20bc5b,_0xe692('0xe'));_0x5d3787(_0x8bb632[_0xe692('0x15')][_0xe692('0x14')]);}})['catch'](function(_0x5e8bdf){logger[_0xe692('0x12')](_0xe692('0xd'),_0x20bc5b,_0x5e8bdf);_0x37a2fc(_0x5e8bdf);});});}exports[_0xe692('0x16')]=function(_0x5ed2a0){var _0x1e86f7=this;return new Promise(function(_0xfbe471,_0x991059){return db[_0xe692('0x17')][_0xe692('0x18')]({'raw':_0x5ed2a0[_0xe692('0x19')]?_0x5ed2a0['options'][_0xe692('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ed2a0[_0xe692('0x19')]?_0x5ed2a0[_0xe692('0x19')][_0xe692('0x1b')]||null:null,'attributes':_0x5ed2a0[_0xe692('0x19')]?_0x5ed2a0[_0xe692('0x19')][_0xe692('0x1c')]||null:null,'limit':_0x5ed2a0['options']?_0x5ed2a0[_0xe692('0x19')]['limit']||null:null,'include':_0x5ed2a0[_0xe692('0x19')]?_0x5ed2a0[_0xe692('0x19')]['include']?_[_0xe692('0x1d')](_0x5ed2a0[_0xe692('0x19')][_0xe692('0x1e')],function(_0x1a9c20){return{'model':db[_0x1a9c20[_0xe692('0x1f')]],'as':_0x1a9c20['as'],'attributes':_0x1a9c20['attributes'],'include':_0x1a9c20[_0xe692('0x1e')]?_[_0xe692('0x1d')](_0x1a9c20[_0xe692('0x1e')],function(_0x228ea2){return{'model':db[_0x228ea2[_0xe692('0x1f')]],'as':_0x228ea2['as'],'attributes':_0x228ea2[_0xe692('0x1c')],'include':_0x228ea2['include']?_[_0xe692('0x1d')](_0x228ea2[_0xe692('0x1e')],function(_0x324937){return{'model':db[_0x324937['model']],'as':_0x324937['as'],'attributes':_0x324937[_0xe692('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe692('0xb')](function(_0x5a97b5){logger['info'](_0xe692('0x16'),_0x5ed2a0);logger[_0xe692('0xf')]('GetDeskAccount',_0x5ed2a0,JSON[_0xe692('0x11')](_0x5a97b5));_0xfbe471(_0x5a97b5);})['catch'](function(_0x426146){logger[_0xe692('0x12')]('GetDeskAccount',_0x426146[_0xe692('0x14')],_0x5ed2a0);_0x991059(_0x1e86f7[_0xe692('0x12')](0x1f4,_0x426146[_0xe692('0x14')]));});});};exports['ShowDeskAccount']=function(_0x41810d){var _0xef6c51=this;return new Promise(function(_0x2e2544,_0x18eeea){return db[_0xe692('0x17')][_0xe692('0x20')]({'raw':_0x41810d[_0xe692('0x19')]?_0x41810d['options'][_0xe692('0x1a')]===undefined?!![]:![]:!![],'where':_0x41810d[_0xe692('0x19')]?_0x41810d[_0xe692('0x19')][_0xe692('0x1b')]||null:null,'attributes':_0x41810d[_0xe692('0x19')]?_0x41810d[_0xe692('0x19')][_0xe692('0x1c')]||null:null,'include':_0x41810d[_0xe692('0x19')]?_0x41810d[_0xe692('0x19')][_0xe692('0x1e')]?_[_0xe692('0x1d')](_0x41810d[_0xe692('0x19')][_0xe692('0x1e')],function(_0x2c1433){return{'model':db[_0x2c1433[_0xe692('0x1f')]],'as':_0x2c1433['as'],'attributes':_0x2c1433[_0xe692('0x1c')],'include':_0x2c1433[_0xe692('0x1e')]?_['map'](_0x2c1433[_0xe692('0x1e')],function(_0x4249d4){return{'model':db[_0x4249d4[_0xe692('0x1f')]],'as':_0x4249d4['as'],'attributes':_0x4249d4[_0xe692('0x1c')],'include':_0x4249d4[_0xe692('0x1e')]?_[_0xe692('0x1d')](_0x4249d4[_0xe692('0x1e')],function(_0x12dbd1){return{'model':db[_0x12dbd1[_0xe692('0x1f')]],'as':_0x12dbd1['as'],'attributes':_0x12dbd1[_0xe692('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27fde2){logger['info'](_0xe692('0x21'),_0x41810d);logger[_0xe692('0xf')](_0xe692('0x21'),_0x41810d,JSON[_0xe692('0x11')](_0x27fde2));_0x2e2544(_0x27fde2);})['catch'](function(_0x17f4b0){logger[_0xe692('0x12')]('ShowDeskAccount',_0x17f4b0['message'],_0x41810d);_0x18eeea(_0xef6c51[_0xe692('0x12')](0x1f4,_0x17f4b0[_0xe692('0x14')]));});});}; \ No newline at end of file +var _0x45dd=['where','attributes','limit','include','map','model','then','stringify','ShowDeskAccount','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw'];(function(_0x2d5a82,_0x20f34c){var _0x4ef2f4=function(_0x38500c){while(--_0x38500c){_0x2d5a82['push'](_0x2d5a82['shift']());}};_0x4ef2f4(++_0x20f34c);}(_0x45dd,0xf8));var _0xd45d=function(_0x30acc3,_0x15e68d){_0x30acc3=_0x30acc3-0x0;var _0x52f8fe=_0x45dd[_0x30acc3];return _0x52f8fe;};'use strict';var _=require(_0xd45d('0x0'));var util=require(_0xd45d('0x1'));var moment=require('moment');var BPromise=require(_0xd45d('0x2'));var rs=require(_0xd45d('0x3'));var fs=require('fs');var Redis=require(_0xd45d('0x4'));var db=require(_0xd45d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd45d('0x6'))(_0xd45d('0x7'));var config=require(_0xd45d('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd45d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36ac58,_0x17b0fa,_0x3e035f){return new BPromise(function(_0x2a45a4,_0x53813e){return client['request'](_0x36ac58,_0x3e035f)['then'](function(_0x50fffe){logger[_0xd45d('0xa')](_0xd45d('0xb'),_0x17b0fa,_0xd45d('0xc'));logger[_0xd45d('0xd')](_0xd45d('0xe'),_0x17b0fa,_0xd45d('0xc'),JSON['stringify'](_0x50fffe));if(_0x50fffe[_0xd45d('0xf')]){if(_0x50fffe['error'][_0xd45d('0x10')]===0x1f4){logger['error'](_0xd45d('0xb'),_0x17b0fa,_0x50fffe[_0xd45d('0xf')][_0xd45d('0x11')]);return _0x53813e(_0x50fffe[_0xd45d('0xf')][_0xd45d('0x11')]);}logger[_0xd45d('0xf')]('DeskAccount,\x20%s,\x20%s',_0x17b0fa,_0x50fffe[_0xd45d('0xf')][_0xd45d('0x11')]);return _0x2a45a4(_0x50fffe[_0xd45d('0xf')][_0xd45d('0x11')]);}else{logger[_0xd45d('0xa')](_0xd45d('0xb'),_0x17b0fa,_0xd45d('0xc'));_0x2a45a4(_0x50fffe['result']['message']);}})[_0xd45d('0x12')](function(_0x9e25ef){logger[_0xd45d('0xf')](_0xd45d('0xb'),_0x17b0fa,_0x9e25ef);_0x53813e(_0x9e25ef);});});}exports[_0xd45d('0x13')]=function(_0x196344){var _0x41260e=this;return new Promise(function(_0x5364c5,_0x5d50c0){return db[_0xd45d('0x14')][_0xd45d('0x15')]({'raw':_0x196344['options']?_0x196344[_0xd45d('0x16')][_0xd45d('0x17')]===undefined?!![]:![]:!![],'where':_0x196344[_0xd45d('0x16')]?_0x196344[_0xd45d('0x16')][_0xd45d('0x18')]||null:null,'attributes':_0x196344[_0xd45d('0x16')]?_0x196344[_0xd45d('0x16')][_0xd45d('0x19')]||null:null,'limit':_0x196344[_0xd45d('0x16')]?_0x196344['options'][_0xd45d('0x1a')]||null:null,'include':_0x196344[_0xd45d('0x16')]?_0x196344['options'][_0xd45d('0x1b')]?_[_0xd45d('0x1c')](_0x196344['options'][_0xd45d('0x1b')],function(_0x52d584){return{'model':db[_0x52d584[_0xd45d('0x1d')]],'as':_0x52d584['as'],'attributes':_0x52d584[_0xd45d('0x19')],'include':_0x52d584['include']?_[_0xd45d('0x1c')](_0x52d584[_0xd45d('0x1b')],function(_0x19fc53){return{'model':db[_0x19fc53[_0xd45d('0x1d')]],'as':_0x19fc53['as'],'attributes':_0x19fc53['attributes'],'include':_0x19fc53[_0xd45d('0x1b')]?_[_0xd45d('0x1c')](_0x19fc53[_0xd45d('0x1b')],function(_0x3ea501){return{'model':db[_0x3ea501['model']],'as':_0x3ea501['as'],'attributes':_0x3ea501[_0xd45d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd45d('0x1e')](function(_0x3b665e){logger[_0xd45d('0xa')](_0xd45d('0x13'),_0x196344);logger[_0xd45d('0xd')]('GetDeskAccount',_0x196344,JSON[_0xd45d('0x1f')](_0x3b665e));_0x5364c5(_0x3b665e);})[_0xd45d('0x12')](function(_0x44dbb5){logger[_0xd45d('0xf')]('GetDeskAccount',_0x44dbb5[_0xd45d('0x11')],_0x196344);_0x5d50c0(_0x41260e[_0xd45d('0xf')](0x1f4,_0x44dbb5[_0xd45d('0x11')]));});});};exports[_0xd45d('0x20')]=function(_0xb8cfb){var _0x45939f=this;return new Promise(function(_0x143bc4,_0x54e1cb){return db[_0xd45d('0x14')][_0xd45d('0x21')]({'raw':_0xb8cfb['options']?_0xb8cfb[_0xd45d('0x16')][_0xd45d('0x17')]===undefined?!![]:![]:!![],'where':_0xb8cfb[_0xd45d('0x16')]?_0xb8cfb['options'][_0xd45d('0x18')]||null:null,'attributes':_0xb8cfb[_0xd45d('0x16')]?_0xb8cfb[_0xd45d('0x16')][_0xd45d('0x19')]||null:null,'include':_0xb8cfb[_0xd45d('0x16')]?_0xb8cfb[_0xd45d('0x16')][_0xd45d('0x1b')]?_[_0xd45d('0x1c')](_0xb8cfb[_0xd45d('0x16')]['include'],function(_0x4d9c5d){return{'model':db[_0x4d9c5d[_0xd45d('0x1d')]],'as':_0x4d9c5d['as'],'attributes':_0x4d9c5d['attributes'],'include':_0x4d9c5d[_0xd45d('0x1b')]?_[_0xd45d('0x1c')](_0x4d9c5d[_0xd45d('0x1b')],function(_0x100496){return{'model':db[_0x100496[_0xd45d('0x1d')]],'as':_0x100496['as'],'attributes':_0x100496[_0xd45d('0x19')],'include':_0x100496[_0xd45d('0x1b')]?_['map'](_0x100496[_0xd45d('0x1b')],function(_0x1d5acd){return{'model':db[_0x1d5acd['model']],'as':_0x1d5acd['as'],'attributes':_0x1d5acd[_0xd45d('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd45d('0x1e')](function(_0x2ecea0){logger['info'](_0xd45d('0x20'),_0xb8cfb);logger['debug']('ShowDeskAccount',_0xb8cfb,JSON['stringify'](_0x2ecea0));_0x143bc4(_0x2ecea0);})['catch'](function(_0x525c69){logger['error'](_0xd45d('0x20'),_0x525c69['message'],_0xb8cfb);_0x54e1cb(_0x45939f[_0xd45d('0xf')](0x1f4,_0x525c69[_0xd45d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index e3afd0c..2d7e2e7 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(_0x3a2708,_0x33c786){var _0x38d954=function(_0x5c7bc5){while(--_0x5c7bc5){_0x3a2708['push'](_0x3a2708['shift']());}};_0x38d954(++_0x33c786);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file +var _0x34e8=['../../config/environment','./intDeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x371e7d,_0xfbd650){var _0x1dfbdf=function(_0x136bf0){while(--_0x136bf0){_0x371e7d['push'](_0x371e7d['shift']());}};_0x1dfbdf(++_0xfbd650);}(_0x34e8,0x12c));var _0x834e=function(_0x1a4d91,_0x2ad11a){_0x1a4d91=_0x1a4d91-0x0;var _0x43abec=_0x34e8[_0x1a4d91];return _0x43abec;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xa')](_0x834e('0xf'),auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0xa')](_0x834e('0x11'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0xa')](_0x834e('0x13'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);router[_0x834e('0xa')](_0x834e('0x15'),auth['isAuthenticated'](),controller[_0x834e('0x16')]);router[_0x834e('0x17')]('/',auth['isAuthenticated'](),controller[_0x834e('0x18')]);router[_0x834e('0x17')](_0x834e('0x15'),auth[_0x834e('0xd')](),controller['setTags']);router[_0x834e('0x19')](_0x834e('0xc'),auth['isAuthenticated'](),controller[_0x834e('0x1a')]);router['delete'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller['destroy']);module[_0x834e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index a3b646b..5bb4083 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 _0x5737=['STRING'];(function(_0x241ada,_0x38127a){var _0x3662b7=function(_0x35e5a0){while(--_0x35e5a0){_0x241ada['push'](_0x241ada['shift']());}};_0x3662b7(++_0x38127a);}(_0x5737,0x126));var _0x7573=function(_0x78409a,_0x15cdd1){_0x78409a=_0x78409a-0x0;var _0xabcc52=_0x5737[_0x78409a];return _0xabcc52;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7573('0x0')]}}; \ No newline at end of file +var _0xbb46=['STRING','sequelize','exports'];(function(_0x2c1df5,_0x46c135){var _0x1097f9=function(_0x11c087){while(--_0x11c087){_0x2c1df5['push'](_0x2c1df5['shift']());}};_0x1097f9(++_0x46c135);}(_0xbb46,0x1c0));var _0x6bb4=function(_0x3f99a8,_0x160bf7){_0x3f99a8=_0x3f99a8-0x0;var _0x25c907=_0xbb46[_0x3f99a8];return _0x25c907;};'use strict';var Sequelize=require(_0x6bb4('0x0'));module[_0x6bb4('0x1')]={'name':{'type':Sequelize[_0x6bb4('0x2')]},'description':{'type':Sequelize[_0x6bb4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 4f64a99..02b7639 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 _0x2212=['undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','rows','catch','show','find','create','body','params','findOne','getFields','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x2cdd50,_0x4dea9e){var _0x3f5f7c=function(_0x35e90a){while(--_0x35e90a){_0x2cdd50['push'](_0x2cdd50['shift']());}};_0x3f5f7c(++_0x4dea9e);}(_0x2212,0x1cb));var _0x2221=function(_0x27edba,_0x3b8b4f){_0x27edba=_0x27edba-0x0;var _0x4d2d31=_0x2212[_0x27edba];return _0x4d2d31;};'use strict';var emlformat=require(_0x2221('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2221('0x1'));var jsonpatch=require(_0x2221('0x2'));var rp=require(_0x2221('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2221('0x4'));var path=require(_0x2221('0x5'));var sox=require('sox');var csv=require(_0x2221('0x6'));var ejs=require(_0x2221('0x7'));var fs=require('fs');var fs_extra=require(_0x2221('0x8'));var _=require(_0x2221('0x9'));var squel=require('squel');var crypto=require(_0x2221('0xa'));var jsforce=require(_0x2221('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2221('0xc'));var Papa=require(_0x2221('0xd'));var Redis=require(_0x2221('0xe'));var authService=require(_0x2221('0xf'));var qs=require(_0x2221('0x10'));var as=require(_0x2221('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2221('0x12'))(_0x2221('0x13'));var utils=require(_0x2221('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2221('0x15'))['db'];function respondWithStatusCode(_0xd3bd36,_0x279215){_0x279215=_0x279215||0xcc;return function(_0x26b48e){if(_0x26b48e){return _0xd3bd36[_0x2221('0x16')](_0x279215);}return _0xd3bd36['status'](_0x279215)[_0x2221('0x17')]();};}function respondWithResult(_0x532b30,_0x5ea05b){_0x5ea05b=_0x5ea05b||0xc8;return function(_0x2d9265){if(_0x2d9265){return _0x532b30[_0x2221('0x18')](_0x5ea05b)[_0x2221('0x19')](_0x2d9265);}};}function respondWithFilteredResult(_0x2013bc,_0x146b19){return function(_0x4057d3){if(_0x4057d3){var _0x5b2da6=typeof _0x146b19[_0x2221('0x1a')]===_0x2221('0x1b')&&typeof _0x146b19[_0x2221('0x1c')]===_0x2221('0x1b');var _0x552dd9=_0x4057d3['count'];var _0x56cc09=_0x5b2da6?0x0:_0x146b19[_0x2221('0x1a')];var _0x419989=_0x5b2da6?_0x4057d3[_0x2221('0x1d')]:_0x146b19[_0x2221('0x1a')]+_0x146b19[_0x2221('0x1c')];var _0x55a045;if(_0x419989>=_0x552dd9){_0x419989=_0x552dd9;_0x55a045=0xc8;}else{_0x55a045=0xce;}_0x2013bc[_0x2221('0x18')](_0x55a045);return _0x2013bc[_0x2221('0x1e')](_0x2221('0x1f'),_0x56cc09+'-'+_0x419989+'/'+_0x552dd9)[_0x2221('0x19')](_0x4057d3);}return null;};}function patchUpdates(_0x4dc7b9){return function(_0x1bb682){try{jsonpatch[_0x2221('0x20')](_0x1bb682,_0x4dc7b9,!![]);}catch(_0x211586){return BPromise[_0x2221('0x21')](_0x211586);}return _0x1bb682['save']();};}function saveUpdates(_0xf31a15,_0x2f4adc){return function(_0x426d8b){if(_0x426d8b){return _0x426d8b[_0x2221('0x22')](_0xf31a15)['then'](function(_0x548858){return _0x548858;});}return null;};}function removeEntity(_0x56a3a3,_0x5bb7d1){return function(_0x3e137a){if(_0x3e137a){return _0x3e137a[_0x2221('0x23')]()[_0x2221('0x24')](function(){_0x56a3a3['status'](0xcc)[_0x2221('0x17')]();});}};}function handleEntityNotFound(_0x4a0be7,_0x4e96a3){return function(_0x1265b1){if(!_0x1265b1){_0x4a0be7[_0x2221('0x16')](0x194);}return _0x1265b1;};}function handleError(_0x36771d,_0x7f2116){_0x7f2116=_0x7f2116||0x1f4;return function(_0xc12393){logger[_0x2221('0x25')](_0xc12393[_0x2221('0x26')]);if(_0xc12393[_0x2221('0x27')]){delete _0xc12393[_0x2221('0x27')];}_0x36771d[_0x2221('0x18')](_0x7f2116)[_0x2221('0x28')](_0xc12393);};}exports[_0x2221('0x29')]=function(_0x191828,_0x193927){var _0x1ec820={},_0x241f6d={},_0x40c3f8={'count':0x0,'rows':[]};var _0x440956=_['map'](db['DeskConfiguration'][_0x2221('0x2a')],function(_0xb0302a){return{'name':_0xb0302a[_0x2221('0x2b')],'type':_0xb0302a['type']['key']};});_0x241f6d['model']=_[_0x2221('0x2c')](_0x440956,'name');_0x241f6d[_0x2221('0x2d')]=_[_0x2221('0x2e')](_0x191828[_0x2221('0x2d')]);_0x241f6d[_0x2221('0x2f')]=_[_0x2221('0x30')](_0x241f6d[_0x2221('0x31')],_0x241f6d['query']);_0x1ec820[_0x2221('0x32')]=_[_0x2221('0x30')](_0x241f6d[_0x2221('0x31')],qs[_0x2221('0x33')](_0x191828[_0x2221('0x2d')][_0x2221('0x33')]));_0x1ec820['attributes']=_0x1ec820[_0x2221('0x32')][_0x2221('0x34')]?_0x1ec820[_0x2221('0x32')]:_0x241f6d[_0x2221('0x31')];if(!_0x191828['query'][_0x2221('0x35')](_0x2221('0x36'))){_0x1ec820[_0x2221('0x1c')]=qs['limit'](_0x191828[_0x2221('0x2d')][_0x2221('0x1c')]);_0x1ec820['offset']=qs[_0x2221('0x1a')](_0x191828[_0x2221('0x2d')][_0x2221('0x1a')]);}_0x1ec820[_0x2221('0x37')]=qs[_0x2221('0x38')](_0x191828[_0x2221('0x2d')]['sort']);_0x1ec820['where']=qs[_0x2221('0x2f')](_[_0x2221('0x39')](_0x191828[_0x2221('0x2d')],_0x241f6d[_0x2221('0x2f')]),_0x440956);if(_0x191828[_0x2221('0x2d')][_0x2221('0x3a')]){_0x1ec820[_0x2221('0x3b')]=_[_0x2221('0x3c')](_0x1ec820[_0x2221('0x3b')],{'$or':_[_0x2221('0x2c')](_0x440956,function(_0x1a6b05){if(_0x1a6b05['type']!==_0x2221('0x3d')){var _0x306019={};_0x306019[_0x1a6b05[_0x2221('0x27')]]={'$like':'%'+_0x191828[_0x2221('0x2d')][_0x2221('0x3a')]+'%'};return _0x306019;}})});}_0x1ec820=_['merge']({},_0x1ec820,_0x191828[_0x2221('0x3e')]);var _0xb7f036={'where':_0x1ec820[_0x2221('0x3b')]};return db[_0x2221('0x3f')][_0x2221('0x1d')](_0xb7f036)[_0x2221('0x24')](function(_0x38679e){_0x40c3f8[_0x2221('0x1d')]=_0x38679e;if(_0x191828['query'][_0x2221('0x40')]){_0x1ec820[_0x2221('0x41')]=[{'all':!![]}];}return db[_0x2221('0x3f')]['findAll'](_0x1ec820);})[_0x2221('0x24')](function(_0x4cd529){_0x40c3f8[_0x2221('0x42')]=_0x4cd529;return _0x40c3f8;})[_0x2221('0x24')](respondWithFilteredResult(_0x193927,_0x1ec820))[_0x2221('0x43')](handleError(_0x193927,null));};exports[_0x2221('0x44')]=function(_0x366e14,_0x1f8ef1){var _0x4a4e5e={'raw':![],'where':{'id':_0x366e14['params']['id']}},_0x301639={};_0x301639[_0x2221('0x31')]=_[_0x2221('0x2e')](db[_0x2221('0x3f')][_0x2221('0x2a')]);_0x301639[_0x2221('0x2d')]=_['keys'](_0x366e14[_0x2221('0x2d')]);_0x301639[_0x2221('0x2f')]=_[_0x2221('0x30')](_0x301639['model'],_0x301639[_0x2221('0x2d')]);_0x4a4e5e['attributes']=_[_0x2221('0x30')](_0x301639[_0x2221('0x31')],qs['fields'](_0x366e14[_0x2221('0x2d')][_0x2221('0x33')]));_0x4a4e5e[_0x2221('0x32')]=_0x4a4e5e[_0x2221('0x32')][_0x2221('0x34')]?_0x4a4e5e[_0x2221('0x32')]:_0x301639[_0x2221('0x31')];if(_0x366e14[_0x2221('0x2d')]['includeAll']){_0x4a4e5e[_0x2221('0x41')]=[{'all':!![]}];}_0x4a4e5e=_[_0x2221('0x3c')]({},_0x4a4e5e,_0x366e14[_0x2221('0x3e')]);return db[_0x2221('0x3f')][_0x2221('0x45')](_0x4a4e5e)[_0x2221('0x24')](handleEntityNotFound(_0x1f8ef1,null))[_0x2221('0x24')](respondWithResult(_0x1f8ef1,null))[_0x2221('0x43')](handleError(_0x1f8ef1,null));};exports[_0x2221('0x46')]=function(_0xc49ec1,_0x356c78){return db['DeskConfiguration'][_0x2221('0x46')](_0xc49ec1[_0x2221('0x47')],{})[_0x2221('0x24')](respondWithResult(_0x356c78,0xc9))[_0x2221('0x43')](handleError(_0x356c78,null));};exports[_0x2221('0x22')]=function(_0xfd09b6,_0xda39e7){if(_0xfd09b6[_0x2221('0x47')]['id']){delete _0xfd09b6['body']['id'];}return db[_0x2221('0x3f')][_0x2221('0x45')]({'where':{'id':_0xfd09b6[_0x2221('0x48')]['id']}})[_0x2221('0x24')](handleEntityNotFound(_0xda39e7,null))[_0x2221('0x24')](saveUpdates(_0xfd09b6[_0x2221('0x47')],null))['then'](respondWithResult(_0xda39e7,null))[_0x2221('0x43')](handleError(_0xda39e7,null));};exports[_0x2221('0x23')]=function(_0x266af8,_0x427091){return db[_0x2221('0x3f')][_0x2221('0x45')]({'where':{'id':_0x266af8[_0x2221('0x48')]['id']}})[_0x2221('0x24')](handleEntityNotFound(_0x427091,null))['then'](removeEntity(_0x427091,null))[_0x2221('0x43')](handleError(_0x427091,null));};exports['getFields']=function(_0x27269d,_0x58f07d,_0x4ba7cb){var _0x5ba0c6={};var _0x2f5236={};var _0x2a7656;var _0x14c3b6;return db[_0x2221('0x3f')][_0x2221('0x49')]({'where':{'id':_0x27269d[_0x2221('0x48')]['id']}})[_0x2221('0x24')](handleEntityNotFound(_0x58f07d,null))['then'](function(_0x11b7fa){if(_0x11b7fa){_0x2a7656=_0x11b7fa;_0x2f5236[_0x2221('0x31')]=_[_0x2221('0x2e')](db['DeskField'][_0x2221('0x2a')]);_0x2f5236['query']=_[_0x2221('0x2e')](_0x27269d[_0x2221('0x2d')]);_0x2f5236[_0x2221('0x2f')]=_[_0x2221('0x30')](_0x2f5236[_0x2221('0x31')],_0x2f5236[_0x2221('0x2d')]);_0x5ba0c6[_0x2221('0x32')]=_['intersection'](_0x2f5236[_0x2221('0x31')],qs[_0x2221('0x33')](_0x27269d[_0x2221('0x2d')][_0x2221('0x33')]));_0x5ba0c6['attributes']=_0x5ba0c6[_0x2221('0x32')][_0x2221('0x34')]?_0x5ba0c6[_0x2221('0x32')]:_0x2f5236[_0x2221('0x31')];_0x5ba0c6['order']=qs['sort'](_0x27269d[_0x2221('0x2d')][_0x2221('0x38')]);_0x5ba0c6[_0x2221('0x3b')]=qs[_0x2221('0x2f')](_[_0x2221('0x39')](_0x27269d[_0x2221('0x2d')],_0x2f5236[_0x2221('0x2f')]));if(_0x27269d[_0x2221('0x2d')]['filter']){_0x5ba0c6['where']=_[_0x2221('0x3c')](_0x5ba0c6[_0x2221('0x3b')],{'$or':_[_0x2221('0x2c')](_0x5ba0c6['attributes'],function(_0x18213c){var _0x207a75={};_0x207a75[_0x18213c]={'$like':'%'+_0x27269d[_0x2221('0x2d')][_0x2221('0x3a')]+'%'};return _0x207a75;})});}_0x5ba0c6=_['merge']({},_0x5ba0c6,_0x27269d['options']);return _0x2a7656['getFields'](_0x5ba0c6);}})[_0x2221('0x24')](function(_0x13405c){if(_0x13405c){_0x14c3b6=_0x13405c[_0x2221('0x34')];if(!_0x27269d[_0x2221('0x2d')]['hasOwnProperty'](_0x2221('0x36'))){_0x5ba0c6[_0x2221('0x1c')]=qs[_0x2221('0x1c')](_0x27269d[_0x2221('0x2d')][_0x2221('0x1c')]);_0x5ba0c6[_0x2221('0x1a')]=qs[_0x2221('0x1a')](_0x27269d[_0x2221('0x2d')][_0x2221('0x1a')]);}return _0x2a7656[_0x2221('0x4a')](_0x5ba0c6);}})[_0x2221('0x24')](function(_0x29eae8){if(_0x29eae8){return _0x29eae8?{'count':_0x14c3b6,'rows':_0x29eae8}:null;}})['then'](respondWithResult(_0x58f07d,null))[_0x2221('0x43')](handleError(_0x58f07d,null));};exports['getSubjects']=function(_0x145712,_0x2e184a,_0x182807){var _0x97c182={};var _0x33151d={};var _0x2fe62c;var _0x835eb9;return db[_0x2221('0x3f')][_0x2221('0x49')]({'where':{'id':_0x145712[_0x2221('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e184a,null))[_0x2221('0x24')](function(_0x51f292){if(_0x51f292){_0x2fe62c=_0x51f292;_0x33151d[_0x2221('0x31')]=_[_0x2221('0x2e')](db[_0x2221('0x4b')]['rawAttributes']);_0x33151d['query']=_[_0x2221('0x2e')](_0x145712['query']);_0x33151d[_0x2221('0x2f')]=_[_0x2221('0x30')](_0x33151d[_0x2221('0x31')],_0x33151d[_0x2221('0x2d')]);_0x97c182[_0x2221('0x32')]=_[_0x2221('0x30')](_0x33151d[_0x2221('0x31')],qs[_0x2221('0x33')](_0x145712['query']['fields']));_0x97c182['attributes']=_0x97c182[_0x2221('0x32')][_0x2221('0x34')]?_0x97c182[_0x2221('0x32')]:_0x33151d['model'];_0x97c182['order']=qs[_0x2221('0x38')](_0x145712[_0x2221('0x2d')][_0x2221('0x38')]);_0x97c182[_0x2221('0x3b')]=qs['filters'](_[_0x2221('0x39')](_0x145712[_0x2221('0x2d')],_0x33151d[_0x2221('0x2f')]));if(_0x145712[_0x2221('0x2d')][_0x2221('0x3a')]){_0x97c182[_0x2221('0x3b')]=_['merge'](_0x97c182[_0x2221('0x3b')],{'$or':_[_0x2221('0x2c')](_0x97c182[_0x2221('0x32')],function(_0x2a7a68){var _0x472e15={};_0x472e15[_0x2a7a68]={'$like':'%'+_0x145712['query'][_0x2221('0x3a')]+'%'};return _0x472e15;})});}_0x97c182=_[_0x2221('0x3c')]({},_0x97c182,_0x145712[_0x2221('0x3e')]);return _0x2fe62c['getSubjects'](_0x97c182);}})[_0x2221('0x24')](function(_0x29394d){if(_0x29394d){_0x835eb9=_0x29394d[_0x2221('0x34')];if(!_0x145712[_0x2221('0x2d')][_0x2221('0x35')](_0x2221('0x36'))){_0x97c182[_0x2221('0x1c')]=qs[_0x2221('0x1c')](_0x145712[_0x2221('0x2d')][_0x2221('0x1c')]);_0x97c182[_0x2221('0x1a')]=qs['offset'](_0x145712[_0x2221('0x2d')][_0x2221('0x1a')]);}return _0x2fe62c[_0x2221('0x4c')](_0x97c182);}})['then'](function(_0x4c1ae3){if(_0x4c1ae3){return _0x4c1ae3?{'count':_0x835eb9,'rows':_0x4c1ae3}:null;}})[_0x2221('0x24')](respondWithResult(_0x2e184a,null))['catch'](handleError(_0x2e184a,null));};exports[_0x2221('0x4d')]=function(_0x2d875b,_0x14193,_0x5577d0){var _0x363aae={};var _0x1ba010={};var _0xa4f166;var _0x4d3fdf;return db[_0x2221('0x3f')][_0x2221('0x49')]({'where':{'id':_0x2d875b['params']['id']}})[_0x2221('0x24')](handleEntityNotFound(_0x14193,null))[_0x2221('0x24')](function(_0x198382){if(_0x198382){_0xa4f166=_0x198382;_0x1ba010[_0x2221('0x31')]=_[_0x2221('0x2e')](db[_0x2221('0x4b')][_0x2221('0x2a')]);_0x1ba010[_0x2221('0x2d')]=_['keys'](_0x2d875b[_0x2221('0x2d')]);_0x1ba010['filters']=_[_0x2221('0x30')](_0x1ba010['model'],_0x1ba010[_0x2221('0x2d')]);_0x363aae[_0x2221('0x32')]=_[_0x2221('0x30')](_0x1ba010[_0x2221('0x31')],qs[_0x2221('0x33')](_0x2d875b['query']['fields']));_0x363aae['attributes']=_0x363aae[_0x2221('0x32')][_0x2221('0x34')]?_0x363aae[_0x2221('0x32')]:_0x1ba010[_0x2221('0x31')];_0x363aae[_0x2221('0x37')]=qs['sort'](_0x2d875b[_0x2221('0x2d')]['sort']);_0x363aae[_0x2221('0x3b')]=qs[_0x2221('0x2f')](_[_0x2221('0x39')](_0x2d875b['query'],_0x1ba010['filters']));if(_0x2d875b[_0x2221('0x2d')][_0x2221('0x3a')]){_0x363aae[_0x2221('0x3b')]=_[_0x2221('0x3c')](_0x363aae[_0x2221('0x3b')],{'$or':_['map'](_0x363aae[_0x2221('0x32')],function(_0x359734){var _0x567470={};_0x567470[_0x359734]={'$like':'%'+_0x2d875b[_0x2221('0x2d')][_0x2221('0x3a')]+'%'};return _0x567470;})});}_0x363aae=_[_0x2221('0x3c')]({},_0x363aae,_0x2d875b[_0x2221('0x3e')]);return _0xa4f166['getDescriptions'](_0x363aae);}})[_0x2221('0x24')](function(_0x3e8fb5){if(_0x3e8fb5){_0x4d3fdf=_0x3e8fb5['length'];if(!_0x2d875b[_0x2221('0x2d')][_0x2221('0x35')](_0x2221('0x36'))){_0x363aae['limit']=qs[_0x2221('0x1c')](_0x2d875b['query'][_0x2221('0x1c')]);_0x363aae[_0x2221('0x1a')]=qs[_0x2221('0x1a')](_0x2d875b[_0x2221('0x2d')][_0x2221('0x1a')]);}return _0xa4f166[_0x2221('0x4d')](_0x363aae);}})[_0x2221('0x24')](function(_0x534915){if(_0x534915){return _0x534915?{'count':_0x4d3fdf,'rows':_0x534915}:null;}})[_0x2221('0x24')](respondWithResult(_0x14193,null))['catch'](handleError(_0x14193,null));};exports[_0x2221('0x4e')]=function(_0x46ab9a,_0x2de9cb,_0x3eec7c){var _0x580b64={};var _0x3174c5={};var _0x5836fe;var _0x507ecd;return db['DeskConfiguration'][_0x2221('0x49')]({'where':{'id':_0x46ab9a[_0x2221('0x48')]['id']}})[_0x2221('0x24')](handleEntityNotFound(_0x2de9cb,null))[_0x2221('0x24')](function(_0x37c908){if(_0x37c908){_0x5836fe=_0x37c908;_0x3174c5['model']=_['keys'](db[_0x2221('0x4f')]['rawAttributes']);_0x3174c5[_0x2221('0x2d')]=_['keys'](_0x46ab9a[_0x2221('0x2d')]);_0x3174c5[_0x2221('0x2f')]=_['intersection'](_0x3174c5[_0x2221('0x31')],_0x3174c5[_0x2221('0x2d')]);_0x580b64[_0x2221('0x32')]=_['intersection'](_0x3174c5['model'],qs[_0x2221('0x33')](_0x46ab9a['query'][_0x2221('0x33')]));_0x580b64[_0x2221('0x32')]=_0x580b64[_0x2221('0x32')]['length']?_0x580b64[_0x2221('0x32')]:_0x3174c5['model'];_0x580b64[_0x2221('0x37')]=qs[_0x2221('0x38')](_0x46ab9a[_0x2221('0x2d')]['sort']);_0x580b64[_0x2221('0x3b')]=qs[_0x2221('0x2f')](_[_0x2221('0x39')](_0x46ab9a[_0x2221('0x2d')],_0x3174c5[_0x2221('0x2f')]));if(_0x46ab9a['query'][_0x2221('0x3a')]){_0x580b64[_0x2221('0x3b')]=_[_0x2221('0x3c')](_0x580b64[_0x2221('0x3b')],{'$or':_[_0x2221('0x2c')](_0x580b64[_0x2221('0x32')],function(_0x35f19d){var _0x575106={};_0x575106[_0x35f19d]={'$like':'%'+_0x46ab9a[_0x2221('0x2d')][_0x2221('0x3a')]+'%'};return _0x575106;})});}_0x580b64=_[_0x2221('0x3c')]({},_0x580b64,_0x46ab9a[_0x2221('0x3e')]);return _0x5836fe[_0x2221('0x4e')](_0x580b64);}})[_0x2221('0x24')](function(_0x3b336d){if(_0x3b336d){_0x507ecd=_0x3b336d[_0x2221('0x34')];if(!_0x46ab9a['query'][_0x2221('0x35')](_0x2221('0x36'))){_0x580b64[_0x2221('0x1c')]=qs[_0x2221('0x1c')](_0x46ab9a[_0x2221('0x2d')][_0x2221('0x1c')]);_0x580b64[_0x2221('0x1a')]=qs['offset'](_0x46ab9a[_0x2221('0x2d')][_0x2221('0x1a')]);}return _0x5836fe[_0x2221('0x4e')](_0x580b64);}})[_0x2221('0x24')](function(_0xd519e4){if(_0xd519e4){return _0xd519e4?{'count':_0x507ecd,'rows':_0xd519e4}:null;}})[_0x2221('0x24')](respondWithResult(_0x2de9cb,null))[_0x2221('0x43')](handleError(_0x2de9cb,null));};exports[_0x2221('0x50')]=function(_0x184d3c,_0x39db63,_0x3e5723){if(_0x184d3c[_0x2221('0x47')]['id']){delete _0x184d3c[_0x2221('0x47')]['id'];}return db[_0x2221('0x3f')][_0x2221('0x49')]({'where':{'id':_0x184d3c[_0x2221('0x48')]['id']}})[_0x2221('0x24')](handleEntityNotFound(_0x39db63,null))[_0x2221('0x24')](function(_0x1e6c49){if(_0x1e6c49){return _0x1e6c49['setTags'](_0x184d3c[_0x2221('0x47')]['ids']||[]);}return null;})[_0x2221('0x24')](respondWithResult(_0x39db63,null))[_0x2221('0x43')](handleError(_0x39db63,null));}; \ No newline at end of file +var _0x2792=['findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','json','apply','reject','then','destroy','sendStatus','error','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','VIRTUAL','filter','merge','options','where','include','rows','show','params','includeAll','find','catch','create','update','body','getFields'];(function(_0x904be7,_0x4f71cd){var _0x35fe03=function(_0x21e98d){while(--_0x21e98d){_0x904be7['push'](_0x904be7['shift']());}};_0x35fe03(++_0x4f71cd);}(_0x2792,0x1e6));var _0x2279=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x2792[_0x46cf00];return _0x3974dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2279('0x0'));var zipdir=require(_0x2279('0x1'));var jsonpatch=require(_0x2279('0x2'));var rp=require(_0x2279('0x3'));var moment=require(_0x2279('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2279('0x5'));var util=require(_0x2279('0x6'));var path=require(_0x2279('0x7'));var sox=require('sox');var csv=require(_0x2279('0x8'));var ejs=require(_0x2279('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2279('0xa'));var jsforce=require(_0x2279('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2279('0xc'));var Redis=require(_0x2279('0xd'));var authService=require(_0x2279('0xe'));var qs=require(_0x2279('0xf'));var as=require(_0x2279('0x10'));var hardwareService=require(_0x2279('0x11'));var logger=require(_0x2279('0x12'))('api');var utils=require(_0x2279('0x13'));var config=require(_0x2279('0x14'));var licenseUtil=require(_0x2279('0x15'));var db=require(_0x2279('0x16'))['db'];function respondWithStatusCode(_0x359179,_0x203ce4){_0x203ce4=_0x203ce4||0xcc;return function(_0x24dfce){if(_0x24dfce){return _0x359179['sendStatus'](_0x203ce4);}return _0x359179[_0x2279('0x17')](_0x203ce4)[_0x2279('0x18')]();};}function respondWithResult(_0x3d44f4,_0x287ea5){_0x287ea5=_0x287ea5||0xc8;return function(_0x2d2552){if(_0x2d2552){return _0x3d44f4['status'](_0x287ea5)['json'](_0x2d2552);}};}function respondWithFilteredResult(_0x3d5de7,_0x408ade){return function(_0x6dac6f){if(_0x6dac6f){var _0x31cd2c=typeof _0x408ade[_0x2279('0x19')]==='undefined'&&typeof _0x408ade[_0x2279('0x1a')]===_0x2279('0x1b');var _0x4f2b4e=_0x6dac6f[_0x2279('0x1c')];var _0x2b2eb7=_0x31cd2c?0x0:_0x408ade[_0x2279('0x19')];var _0x41b4c0=_0x31cd2c?_0x6dac6f['count']:_0x408ade[_0x2279('0x19')]+_0x408ade[_0x2279('0x1a')];var _0x442c70;if(_0x41b4c0>=_0x4f2b4e){_0x41b4c0=_0x4f2b4e;_0x442c70=0xc8;}else{_0x442c70=0xce;}_0x3d5de7[_0x2279('0x17')](_0x442c70);return _0x3d5de7['set']('Content-Range',_0x2b2eb7+'-'+_0x41b4c0+'/'+_0x4f2b4e)[_0x2279('0x1d')](_0x6dac6f);}return null;};}function patchUpdates(_0x35b744){return function(_0x1c7714){try{jsonpatch[_0x2279('0x1e')](_0x1c7714,_0x35b744,!![]);}catch(_0x371379){return BPromise[_0x2279('0x1f')](_0x371379);}return _0x1c7714['save']();};}function saveUpdates(_0x47ecf5,_0x51216b){return function(_0x20ba52){if(_0x20ba52){return _0x20ba52['update'](_0x47ecf5)[_0x2279('0x20')](function(_0x5202ae){return _0x5202ae;});}return null;};}function removeEntity(_0x1e828d,_0x174669){return function(_0x2d499b){if(_0x2d499b){return _0x2d499b[_0x2279('0x21')]()[_0x2279('0x20')](function(){_0x1e828d[_0x2279('0x17')](0xcc)[_0x2279('0x18')]();});}};}function handleEntityNotFound(_0x75de78,_0x2af7d9){return function(_0x3d7d17){if(!_0x3d7d17){_0x75de78[_0x2279('0x22')](0x194);}return _0x3d7d17;};}function handleError(_0x196c36,_0x16494a){_0x16494a=_0x16494a||0x1f4;return function(_0x41a612){logger[_0x2279('0x23')](_0x41a612['stack']);if(_0x41a612[_0x2279('0x24')]){delete _0x41a612[_0x2279('0x24')];}_0x196c36[_0x2279('0x17')](_0x16494a)[_0x2279('0x25')](_0x41a612);};}exports[_0x2279('0x26')]=function(_0x239adb,_0xaebd6b){var _0x21ecac={},_0x24176b={},_0x5c6439={'count':0x0,'rows':[]};var _0x51a3df=_[_0x2279('0x27')](db[_0x2279('0x28')][_0x2279('0x29')],function(_0x5af5d3){return{'name':_0x5af5d3[_0x2279('0x2a')],'type':_0x5af5d3[_0x2279('0x2b')][_0x2279('0x2c')]};});_0x24176b['model']=_[_0x2279('0x27')](_0x51a3df,_0x2279('0x24'));_0x24176b[_0x2279('0x2d')]=_[_0x2279('0x2e')](_0x239adb[_0x2279('0x2d')]);_0x24176b[_0x2279('0x2f')]=_[_0x2279('0x30')](_0x24176b['model'],_0x24176b[_0x2279('0x2d')]);_0x21ecac[_0x2279('0x31')]=_[_0x2279('0x30')](_0x24176b[_0x2279('0x32')],qs[_0x2279('0x33')](_0x239adb[_0x2279('0x2d')][_0x2279('0x33')]));_0x21ecac[_0x2279('0x31')]=_0x21ecac[_0x2279('0x31')][_0x2279('0x34')]?_0x21ecac['attributes']:_0x24176b[_0x2279('0x32')];if(!_0x239adb['query'][_0x2279('0x35')](_0x2279('0x36'))){_0x21ecac[_0x2279('0x1a')]=qs['limit'](_0x239adb[_0x2279('0x2d')][_0x2279('0x1a')]);_0x21ecac[_0x2279('0x19')]=qs['offset'](_0x239adb[_0x2279('0x2d')]['offset']);}_0x21ecac[_0x2279('0x37')]=qs[_0x2279('0x38')](_0x239adb[_0x2279('0x2d')]['sort']);_0x21ecac['where']=qs[_0x2279('0x2f')](_[_0x2279('0x39')](_0x239adb['query'],_0x24176b[_0x2279('0x2f')]),_0x51a3df);if(_0x239adb['query']['filter']){_0x21ecac['where']=_['merge'](_0x21ecac['where'],{'$or':_[_0x2279('0x27')](_0x51a3df,function(_0x2cedf9){if(_0x2cedf9['type']!==_0x2279('0x3a')){var _0xdfa2b5={};_0xdfa2b5[_0x2cedf9['name']]={'$like':'%'+_0x239adb[_0x2279('0x2d')][_0x2279('0x3b')]+'%'};return _0xdfa2b5;}})});}_0x21ecac=_[_0x2279('0x3c')]({},_0x21ecac,_0x239adb[_0x2279('0x3d')]);var _0x5c3acb={'where':_0x21ecac[_0x2279('0x3e')]};return db['DeskConfiguration']['count'](_0x5c3acb)['then'](function(_0x38cc2a){_0x5c6439['count']=_0x38cc2a;if(_0x239adb['query']['includeAll']){_0x21ecac[_0x2279('0x3f')]=[{'all':!![]}];}return db[_0x2279('0x28')]['findAll'](_0x21ecac);})[_0x2279('0x20')](function(_0x25586e){_0x5c6439[_0x2279('0x40')]=_0x25586e;return _0x5c6439;})['then'](respondWithFilteredResult(_0xaebd6b,_0x21ecac))['catch'](handleError(_0xaebd6b,null));};exports[_0x2279('0x41')]=function(_0x259861,_0x5901c5){var _0x198dcb={'raw':![],'where':{'id':_0x259861[_0x2279('0x42')]['id']}},_0x1b91a8={};_0x1b91a8[_0x2279('0x32')]=_[_0x2279('0x2e')](db[_0x2279('0x28')][_0x2279('0x29')]);_0x1b91a8[_0x2279('0x2d')]=_[_0x2279('0x2e')](_0x259861[_0x2279('0x2d')]);_0x1b91a8[_0x2279('0x2f')]=_[_0x2279('0x30')](_0x1b91a8['model'],_0x1b91a8[_0x2279('0x2d')]);_0x198dcb[_0x2279('0x31')]=_[_0x2279('0x30')](_0x1b91a8[_0x2279('0x32')],qs['fields'](_0x259861[_0x2279('0x2d')][_0x2279('0x33')]));_0x198dcb[_0x2279('0x31')]=_0x198dcb[_0x2279('0x31')][_0x2279('0x34')]?_0x198dcb[_0x2279('0x31')]:_0x1b91a8['model'];if(_0x259861[_0x2279('0x2d')][_0x2279('0x43')]){_0x198dcb[_0x2279('0x3f')]=[{'all':!![]}];}_0x198dcb=_[_0x2279('0x3c')]({},_0x198dcb,_0x259861[_0x2279('0x3d')]);return db[_0x2279('0x28')][_0x2279('0x44')](_0x198dcb)[_0x2279('0x20')](handleEntityNotFound(_0x5901c5,null))[_0x2279('0x20')](respondWithResult(_0x5901c5,null))[_0x2279('0x45')](handleError(_0x5901c5,null));};exports[_0x2279('0x46')]=function(_0x38bc4c,_0x10249d){return db[_0x2279('0x28')][_0x2279('0x46')](_0x38bc4c['body'],{})[_0x2279('0x20')](respondWithResult(_0x10249d,0xc9))[_0x2279('0x45')](handleError(_0x10249d,null));};exports[_0x2279('0x47')]=function(_0x3c58cf,_0x36af1f){if(_0x3c58cf[_0x2279('0x48')]['id']){delete _0x3c58cf[_0x2279('0x48')]['id'];}return db[_0x2279('0x28')][_0x2279('0x44')]({'where':{'id':_0x3c58cf['params']['id']}})['then'](handleEntityNotFound(_0x36af1f,null))[_0x2279('0x20')](saveUpdates(_0x3c58cf[_0x2279('0x48')],null))[_0x2279('0x20')](respondWithResult(_0x36af1f,null))[_0x2279('0x45')](handleError(_0x36af1f,null));};exports['destroy']=function(_0x46ee00,_0x5694b8){return db[_0x2279('0x28')]['find']({'where':{'id':_0x46ee00[_0x2279('0x42')]['id']}})[_0x2279('0x20')](handleEntityNotFound(_0x5694b8,null))[_0x2279('0x20')](removeEntity(_0x5694b8,null))[_0x2279('0x45')](handleError(_0x5694b8,null));};exports[_0x2279('0x49')]=function(_0x3992ea,_0x1d2cf5,_0x48edc6){var _0x20e21f={};var _0x10ff69={};var _0x144dc9;var _0x494684;return db[_0x2279('0x28')][_0x2279('0x4a')]({'where':{'id':_0x3992ea[_0x2279('0x42')]['id']}})[_0x2279('0x20')](handleEntityNotFound(_0x1d2cf5,null))[_0x2279('0x20')](function(_0x4e3a20){if(_0x4e3a20){_0x144dc9=_0x4e3a20;_0x10ff69[_0x2279('0x32')]=_[_0x2279('0x2e')](db[_0x2279('0x4b')][_0x2279('0x29')]);_0x10ff69[_0x2279('0x2d')]=_['keys'](_0x3992ea['query']);_0x10ff69['filters']=_['intersection'](_0x10ff69[_0x2279('0x32')],_0x10ff69[_0x2279('0x2d')]);_0x20e21f[_0x2279('0x31')]=_['intersection'](_0x10ff69[_0x2279('0x32')],qs[_0x2279('0x33')](_0x3992ea[_0x2279('0x2d')][_0x2279('0x33')]));_0x20e21f[_0x2279('0x31')]=_0x20e21f[_0x2279('0x31')][_0x2279('0x34')]?_0x20e21f[_0x2279('0x31')]:_0x10ff69['model'];_0x20e21f[_0x2279('0x37')]=qs[_0x2279('0x38')](_0x3992ea[_0x2279('0x2d')][_0x2279('0x38')]);_0x20e21f[_0x2279('0x3e')]=qs['filters'](_[_0x2279('0x39')](_0x3992ea[_0x2279('0x2d')],_0x10ff69['filters']));if(_0x3992ea['query'][_0x2279('0x3b')]){_0x20e21f['where']=_[_0x2279('0x3c')](_0x20e21f[_0x2279('0x3e')],{'$or':_[_0x2279('0x27')](_0x20e21f[_0x2279('0x31')],function(_0x17aa0e){var _0x2d5be7={};_0x2d5be7[_0x17aa0e]={'$like':'%'+_0x3992ea[_0x2279('0x2d')][_0x2279('0x3b')]+'%'};return _0x2d5be7;})});}_0x20e21f=_[_0x2279('0x3c')]({},_0x20e21f,_0x3992ea[_0x2279('0x3d')]);return _0x144dc9['getFields'](_0x20e21f);}})[_0x2279('0x20')](function(_0x212c77){if(_0x212c77){_0x494684=_0x212c77['length'];if(!_0x3992ea['query'][_0x2279('0x35')](_0x2279('0x36'))){_0x20e21f[_0x2279('0x1a')]=qs[_0x2279('0x1a')](_0x3992ea[_0x2279('0x2d')]['limit']);_0x20e21f[_0x2279('0x19')]=qs[_0x2279('0x19')](_0x3992ea[_0x2279('0x2d')][_0x2279('0x19')]);}return _0x144dc9[_0x2279('0x49')](_0x20e21f);}})[_0x2279('0x20')](function(_0x10dba9){if(_0x10dba9){return _0x10dba9?{'count':_0x494684,'rows':_0x10dba9}:null;}})[_0x2279('0x20')](respondWithResult(_0x1d2cf5,null))['catch'](handleError(_0x1d2cf5,null));};exports[_0x2279('0x4c')]=function(_0x11197a,_0x5c2eef,_0x41a603){var _0x42a2e1={};var _0x49afda={};var _0x20d86c;var _0x3c9f78;return db[_0x2279('0x28')]['findOne']({'where':{'id':_0x11197a[_0x2279('0x42')]['id']}})[_0x2279('0x20')](handleEntityNotFound(_0x5c2eef,null))[_0x2279('0x20')](function(_0x571abe){if(_0x571abe){_0x20d86c=_0x571abe;_0x49afda[_0x2279('0x32')]=_[_0x2279('0x2e')](db['DeskField']['rawAttributes']);_0x49afda[_0x2279('0x2d')]=_[_0x2279('0x2e')](_0x11197a[_0x2279('0x2d')]);_0x49afda['filters']=_[_0x2279('0x30')](_0x49afda[_0x2279('0x32')],_0x49afda[_0x2279('0x2d')]);_0x42a2e1[_0x2279('0x31')]=_[_0x2279('0x30')](_0x49afda[_0x2279('0x32')],qs['fields'](_0x11197a[_0x2279('0x2d')][_0x2279('0x33')]));_0x42a2e1[_0x2279('0x31')]=_0x42a2e1[_0x2279('0x31')][_0x2279('0x34')]?_0x42a2e1['attributes']:_0x49afda[_0x2279('0x32')];_0x42a2e1[_0x2279('0x37')]=qs[_0x2279('0x38')](_0x11197a[_0x2279('0x2d')][_0x2279('0x38')]);_0x42a2e1[_0x2279('0x3e')]=qs[_0x2279('0x2f')](_[_0x2279('0x39')](_0x11197a[_0x2279('0x2d')],_0x49afda[_0x2279('0x2f')]));if(_0x11197a[_0x2279('0x2d')][_0x2279('0x3b')]){_0x42a2e1[_0x2279('0x3e')]=_[_0x2279('0x3c')](_0x42a2e1[_0x2279('0x3e')],{'$or':_[_0x2279('0x27')](_0x42a2e1[_0x2279('0x31')],function(_0x21630f){var _0x50c381={};_0x50c381[_0x21630f]={'$like':'%'+_0x11197a[_0x2279('0x2d')][_0x2279('0x3b')]+'%'};return _0x50c381;})});}_0x42a2e1=_[_0x2279('0x3c')]({},_0x42a2e1,_0x11197a['options']);return _0x20d86c[_0x2279('0x4c')](_0x42a2e1);}})[_0x2279('0x20')](function(_0x22dbde){if(_0x22dbde){_0x3c9f78=_0x22dbde[_0x2279('0x34')];if(!_0x11197a[_0x2279('0x2d')][_0x2279('0x35')]('nolimit')){_0x42a2e1[_0x2279('0x1a')]=qs[_0x2279('0x1a')](_0x11197a['query'][_0x2279('0x1a')]);_0x42a2e1[_0x2279('0x19')]=qs[_0x2279('0x19')](_0x11197a[_0x2279('0x2d')][_0x2279('0x19')]);}return _0x20d86c[_0x2279('0x4c')](_0x42a2e1);}})['then'](function(_0x1148be){if(_0x1148be){return _0x1148be?{'count':_0x3c9f78,'rows':_0x1148be}:null;}})[_0x2279('0x20')](respondWithResult(_0x5c2eef,null))[_0x2279('0x45')](handleError(_0x5c2eef,null));};exports[_0x2279('0x4d')]=function(_0x1d2bbf,_0x4d88b1,_0x50df3a){var _0x519496={};var _0x45100c={};var _0x5e2e9c;var _0x1d6247;return db[_0x2279('0x28')][_0x2279('0x4a')]({'where':{'id':_0x1d2bbf[_0x2279('0x42')]['id']}})[_0x2279('0x20')](handleEntityNotFound(_0x4d88b1,null))[_0x2279('0x20')](function(_0xc53e83){if(_0xc53e83){_0x5e2e9c=_0xc53e83;_0x45100c[_0x2279('0x32')]=_['keys'](db['DeskField'][_0x2279('0x29')]);_0x45100c['query']=_[_0x2279('0x2e')](_0x1d2bbf[_0x2279('0x2d')]);_0x45100c[_0x2279('0x2f')]=_[_0x2279('0x30')](_0x45100c[_0x2279('0x32')],_0x45100c[_0x2279('0x2d')]);_0x519496[_0x2279('0x31')]=_[_0x2279('0x30')](_0x45100c[_0x2279('0x32')],qs[_0x2279('0x33')](_0x1d2bbf[_0x2279('0x2d')]['fields']));_0x519496[_0x2279('0x31')]=_0x519496[_0x2279('0x31')][_0x2279('0x34')]?_0x519496[_0x2279('0x31')]:_0x45100c[_0x2279('0x32')];_0x519496[_0x2279('0x37')]=qs['sort'](_0x1d2bbf['query'][_0x2279('0x38')]);_0x519496[_0x2279('0x3e')]=qs['filters'](_[_0x2279('0x39')](_0x1d2bbf[_0x2279('0x2d')],_0x45100c[_0x2279('0x2f')]));if(_0x1d2bbf[_0x2279('0x2d')]['filter']){_0x519496[_0x2279('0x3e')]=_['merge'](_0x519496['where'],{'$or':_[_0x2279('0x27')](_0x519496[_0x2279('0x31')],function(_0x26a794){var _0x1dffde={};_0x1dffde[_0x26a794]={'$like':'%'+_0x1d2bbf[_0x2279('0x2d')][_0x2279('0x3b')]+'%'};return _0x1dffde;})});}_0x519496=_[_0x2279('0x3c')]({},_0x519496,_0x1d2bbf[_0x2279('0x3d')]);return _0x5e2e9c[_0x2279('0x4d')](_0x519496);}})[_0x2279('0x20')](function(_0x1dd43e){if(_0x1dd43e){_0x1d6247=_0x1dd43e['length'];if(!_0x1d2bbf[_0x2279('0x2d')][_0x2279('0x35')](_0x2279('0x36'))){_0x519496['limit']=qs[_0x2279('0x1a')](_0x1d2bbf[_0x2279('0x2d')][_0x2279('0x1a')]);_0x519496[_0x2279('0x19')]=qs[_0x2279('0x19')](_0x1d2bbf[_0x2279('0x2d')][_0x2279('0x19')]);}return _0x5e2e9c[_0x2279('0x4d')](_0x519496);}})[_0x2279('0x20')](function(_0x52101a){if(_0x52101a){return _0x52101a?{'count':_0x1d6247,'rows':_0x52101a}:null;}})[_0x2279('0x20')](respondWithResult(_0x4d88b1,null))['catch'](handleError(_0x4d88b1,null));};exports[_0x2279('0x4e')]=function(_0x24d2cc,_0x3c28e0,_0x48455d){var _0x380922={};var _0x1062e4={};var _0x3c4eac;var _0x4c1395;return db[_0x2279('0x28')][_0x2279('0x4a')]({'where':{'id':_0x24d2cc['params']['id']}})['then'](handleEntityNotFound(_0x3c28e0,null))[_0x2279('0x20')](function(_0x295ff5){if(_0x295ff5){_0x3c4eac=_0x295ff5;_0x1062e4[_0x2279('0x32')]=_[_0x2279('0x2e')](db['Tag'][_0x2279('0x29')]);_0x1062e4['query']=_[_0x2279('0x2e')](_0x24d2cc['query']);_0x1062e4[_0x2279('0x2f')]=_[_0x2279('0x30')](_0x1062e4[_0x2279('0x32')],_0x1062e4[_0x2279('0x2d')]);_0x380922['attributes']=_['intersection'](_0x1062e4[_0x2279('0x32')],qs[_0x2279('0x33')](_0x24d2cc[_0x2279('0x2d')][_0x2279('0x33')]));_0x380922[_0x2279('0x31')]=_0x380922[_0x2279('0x31')][_0x2279('0x34')]?_0x380922[_0x2279('0x31')]:_0x1062e4[_0x2279('0x32')];_0x380922[_0x2279('0x37')]=qs[_0x2279('0x38')](_0x24d2cc[_0x2279('0x2d')]['sort']);_0x380922[_0x2279('0x3e')]=qs[_0x2279('0x2f')](_[_0x2279('0x39')](_0x24d2cc[_0x2279('0x2d')],_0x1062e4['filters']));if(_0x24d2cc[_0x2279('0x2d')]['filter']){_0x380922[_0x2279('0x3e')]=_['merge'](_0x380922[_0x2279('0x3e')],{'$or':_[_0x2279('0x27')](_0x380922[_0x2279('0x31')],function(_0x1946fa){var _0x489d2c={};_0x489d2c[_0x1946fa]={'$like':'%'+_0x24d2cc[_0x2279('0x2d')]['filter']+'%'};return _0x489d2c;})});}_0x380922=_[_0x2279('0x3c')]({},_0x380922,_0x24d2cc[_0x2279('0x3d')]);return _0x3c4eac['getTags'](_0x380922);}})[_0x2279('0x20')](function(_0x3ebf89){if(_0x3ebf89){_0x4c1395=_0x3ebf89[_0x2279('0x34')];if(!_0x24d2cc[_0x2279('0x2d')][_0x2279('0x35')](_0x2279('0x36'))){_0x380922[_0x2279('0x1a')]=qs[_0x2279('0x1a')](_0x24d2cc[_0x2279('0x2d')][_0x2279('0x1a')]);_0x380922[_0x2279('0x19')]=qs['offset'](_0x24d2cc[_0x2279('0x2d')]['offset']);}return _0x3c4eac[_0x2279('0x4e')](_0x380922);}})[_0x2279('0x20')](function(_0x54108e){if(_0x54108e){return _0x54108e?{'count':_0x4c1395,'rows':_0x54108e}:null;}})[_0x2279('0x20')](respondWithResult(_0x3c28e0,null))['catch'](handleError(_0x3c28e0,null));};exports[_0x2279('0x4f')]=function(_0x55c73e,_0x296002,_0x5c2e1b){if(_0x55c73e[_0x2279('0x48')]['id']){delete _0x55c73e[_0x2279('0x48')]['id'];}return db[_0x2279('0x28')][_0x2279('0x4a')]({'where':{'id':_0x55c73e[_0x2279('0x42')]['id']}})[_0x2279('0x20')](handleEntityNotFound(_0x296002,null))['then'](function(_0x34501d){if(_0x34501d){return _0x34501d['setTags'](_0x55c73e[_0x2279('0x48')]['ids']||[]);}return null;})['then'](respondWithResult(_0x296002,null))[_0x2279('0x45')](handleError(_0x296002,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 30ee690..8b5e950 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 _0x069d=['define','int_desk_configurations','lodash','../../config/logger','moment','bluebird','path','rimraf','./intDeskConfiguration.attributes','exports'];(function(_0x4ff980,_0x1d1dd0){var _0x4fd350=function(_0x3f477c){while(--_0x3f477c){_0x4ff980['push'](_0x4ff980['shift']());}};_0x4fd350(++_0x1d1dd0);}(_0x069d,0x11a));var _0xd069=function(_0x502be4,_0x1307cd){_0x502be4=_0x502be4-0x0;var _0x564c8c=_0x069d[_0x502be4];return _0x564c8c;};'use strict';var _=require(_0xd069('0x0'));var util=require('util');var logger=require(_0xd069('0x1'))('api');var moment=require(_0xd069('0x2'));var BPromise=require(_0xd069('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd069('0x4'));var rimraf=require(_0xd069('0x5'));var config=require('../../config/environment');var attributes=require(_0xd069('0x6'));module[_0xd069('0x7')]=function(_0x50ee01,_0x2935b6){return _0x50ee01[_0xd069('0x8')]('DeskConfiguration',attributes,{'tableName':_0xd069('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb218=['path','rimraf','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','../../config/logger','api','moment','request-promise'];(function(_0x366ce0,_0x4c3fad){var _0x5ae1c0=function(_0x6a4ad6){while(--_0x6a4ad6){_0x366ce0['push'](_0x366ce0['shift']());}};_0x5ae1c0(++_0x4c3fad);}(_0xb218,0x192));var _0x8b21=function(_0x4720d6,_0x7226fb){_0x4720d6=_0x4720d6-0x0;var _0x14b3a8=_0xb218[_0x4720d6];return _0x14b3a8;};'use strict';var _=require(_0x8b21('0x0'));var util=require('util');var logger=require(_0x8b21('0x1'))(_0x8b21('0x2'));var moment=require(_0x8b21('0x3'));var BPromise=require('bluebird');var rp=require(_0x8b21('0x4'));var fs=require('fs');var path=require(_0x8b21('0x5'));var rimraf=require(_0x8b21('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b21('0x7'));module['exports']=function(_0x40bc36,_0x54f840){return _0x40bc36[_0x8b21('0x8')](_0x8b21('0x9'),attributes,{'tableName':_0x8b21('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index 19f6651..9cf1666 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 _0x2b4a=['error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify'];(function(_0x4d1c84,_0xc98d3){var _0x5c0cfd=function(_0x20041a){while(--_0x20041a){_0x4d1c84['push'](_0x4d1c84['shift']());}};_0x5c0cfd(++_0xc98d3);}(_0x2b4a,0x13e));var _0xa2b4=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x2b4a[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0xa2b4('0x0'));var util=require(_0xa2b4('0x1'));var moment=require(_0xa2b4('0x2'));var BPromise=require(_0xa2b4('0x3'));var rs=require(_0xa2b4('0x4'));var fs=require('fs');var Redis=require(_0xa2b4('0x5'));var db=require(_0xa2b4('0x6'))['db'];var utils=require(_0xa2b4('0x7'));var logger=require('../../config/logger')(_0xa2b4('0x8'));var config=require(_0xa2b4('0x9'));var jayson=require(_0xa2b4('0xa'));var client=jayson[_0xa2b4('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x136da5,_0x4533c0,_0x5e19a8){return new BPromise(function(_0x39139c,_0x912f94){return client[_0xa2b4('0xc')](_0x136da5,_0x5e19a8)[_0xa2b4('0xd')](function(_0x5fbcff){logger[_0xa2b4('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x4533c0,'request\x20sent');logger[_0xa2b4('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4533c0,_0xa2b4('0x10'),JSON[_0xa2b4('0x11')](_0x5fbcff));if(_0x5fbcff[_0xa2b4('0x12')]){if(_0x5fbcff[_0xa2b4('0x12')][_0xa2b4('0x13')]===0x1f4){logger[_0xa2b4('0x12')](_0xa2b4('0x14'),_0x4533c0,_0x5fbcff[_0xa2b4('0x12')][_0xa2b4('0x15')]);return _0x912f94(_0x5fbcff[_0xa2b4('0x12')][_0xa2b4('0x15')]);}logger[_0xa2b4('0x12')](_0xa2b4('0x14'),_0x4533c0,_0x5fbcff[_0xa2b4('0x12')]['message']);return _0x39139c(_0x5fbcff[_0xa2b4('0x12')][_0xa2b4('0x15')]);}else{logger[_0xa2b4('0xe')](_0xa2b4('0x14'),_0x4533c0,_0xa2b4('0x10'));_0x39139c(_0x5fbcff[_0xa2b4('0x16')]['message']);}})[_0xa2b4('0x17')](function(_0x1b7bc3){logger[_0xa2b4('0x12')](_0xa2b4('0x14'),_0x4533c0,_0x1b7bc3);_0x912f94(_0x1b7bc3);});});} \ No newline at end of file +var _0xfdad=['error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4ea9c3,_0x4c197a){var _0x416d38=function(_0x1b1c63){while(--_0x1b1c63){_0x4ea9c3['push'](_0x4ea9c3['shift']());}};_0x416d38(++_0x4c197a);}(_0xfdad,0x164));var _0xdfda=function(_0x805499,_0x588265){_0x805499=_0x805499-0x0;var _0x302bd3=_0xfdad[_0x805499];return _0x302bd3;};'use strict';var _=require(_0xdfda('0x0'));var util=require(_0xdfda('0x1'));var moment=require('moment');var BPromise=require(_0xdfda('0x2'));var rs=require(_0xdfda('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfda('0x4'))['db'];var utils=require(_0xdfda('0x5'));var logger=require(_0xdfda('0x6'))('rpc');var config=require(_0xdfda('0x7'));var jayson=require(_0xdfda('0x8'));var client=jayson['client'][_0xdfda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3f5f08,_0x279ec4,_0x421757){return new BPromise(function(_0x3d1480,_0x3bb88e){return client[_0xdfda('0xa')](_0x3f5f08,_0x421757)[_0xdfda('0xb')](function(_0x3048fa){logger[_0xdfda('0xc')](_0xdfda('0xd'),_0x279ec4,_0xdfda('0xe'));logger[_0xdfda('0xf')](_0xdfda('0x10'),_0x279ec4,_0xdfda('0xe'),JSON[_0xdfda('0x11')](_0x3048fa));if(_0x3048fa['error']){if(_0x3048fa[_0xdfda('0x12')][_0xdfda('0x13')]===0x1f4){logger[_0xdfda('0x12')](_0xdfda('0xd'),_0x279ec4,_0x3048fa[_0xdfda('0x12')]['message']);return _0x3bb88e(_0x3048fa[_0xdfda('0x12')]['message']);}logger['error'](_0xdfda('0xd'),_0x279ec4,_0x3048fa[_0xdfda('0x12')][_0xdfda('0x14')]);return _0x3d1480(_0x3048fa['error'][_0xdfda('0x14')]);}else{logger['info'](_0xdfda('0xd'),_0x279ec4,_0xdfda('0xe'));_0x3d1480(_0x3048fa[_0xdfda('0x15')][_0xdfda('0x14')]);}})['catch'](function(_0x5baf98){logger[_0xdfda('0x12')](_0xdfda('0xd'),_0x279ec4,_0x5baf98);_0x3bb88e(_0x5baf98);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 3dadb52..606a391 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 _0x23b3=['isAuthenticated','post','create','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','index','/:id'];(function(_0x578f16,_0x3aad5e){var _0x2ae26c=function(_0x4b1397){while(--_0x4b1397){_0x578f16['push'](_0x578f16['shift']());}};_0x2ae26c(++_0x3aad5e);}(_0x23b3,0x101));var _0x323b=function(_0x30123b,_0x2b155d){_0x30123b=_0x30123b-0x0;var _0x24eb6f=_0x23b3[_0x30123b];return _0x24eb6f;};'use strict';var multer=require(_0x323b('0x0'));var util=require(_0x323b('0x1'));var path=require('path');var timeout=require(_0x323b('0x2'));var express=require(_0x323b('0x3'));var router=express[_0x323b('0x4')]();var fs_extra=require(_0x323b('0x5'));var auth=require(_0x323b('0x6'));var interaction=require(_0x323b('0x7'));var config=require(_0x323b('0x8'));var controller=require(_0x323b('0x9'));router[_0x323b('0xa')]('/',auth['isAuthenticated'](),controller[_0x323b('0xb')]);router['get'](_0x323b('0xc'),auth[_0x323b('0xd')](),controller['show']);router[_0x323b('0xe')]('/',auth[_0x323b('0xd')](),controller[_0x323b('0xf')]);router['put'](_0x323b('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x323b('0x10')]('/:id',auth[_0x323b('0xd')](),controller['destroy']);module[_0x323b('0x11')]=router; \ No newline at end of file +var _0x77de=['get','/:id','show','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x5da8a9,_0x26ee48){var _0x26f36f=function(_0x23328d){while(--_0x23328d){_0x5da8a9['push'](_0x5da8a9['shift']());}};_0x26f36f(++_0x26ee48);}(_0x77de,0x1d0));var _0xe77d=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x77de[_0x13ac10];return _0x28eda2;};'use strict';var multer=require(_0xe77d('0x0'));var util=require(_0xe77d('0x1'));var path=require(_0xe77d('0x2'));var timeout=require(_0xe77d('0x3'));var express=require('express');var router=express[_0xe77d('0x4')]();var fs_extra=require(_0xe77d('0x5'));var auth=require(_0xe77d('0x6'));var interaction=require(_0xe77d('0x7'));var config=require(_0xe77d('0x8'));var controller=require('./intDeskField.controller');router['get']('/',auth[_0xe77d('0x9')](),controller[_0xe77d('0xa')]);router[_0xe77d('0xb')](_0xe77d('0xc'),auth[_0xe77d('0x9')](),controller[_0xe77d('0xd')]);router[_0xe77d('0xe')]('/',auth[_0xe77d('0x9')](),controller[_0xe77d('0xf')]);router['put'](_0xe77d('0xc'),auth[_0xe77d('0x9')](),controller[_0xe77d('0x10')]);router[_0xe77d('0x11')](_0xe77d('0xc'),auth[_0xe77d('0x9')](),controller[_0xe77d('0x12')]);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 454c07e..26f7083 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 _0x557c=['STRING','customVariable','BOOLEAN','exports','ENUM','variable','keyValue','picklist','string'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x557c,0x13e));var _0xc557=function(_0x443fda,_0xb06d0a){_0x443fda=_0x443fda-0x0;var _0x58360d=_0x557c[_0x443fda];return _0x58360d;};'use strict';var Sequelize=require('sequelize');module[_0xc557('0x0')]={'type':{'type':Sequelize[_0xc557('0x1')]('string',_0xc557('0x2'),'customVariable',_0xc557('0x3'),_0xc557('0x4')),'defaultValue':_0xc557('0x5')},'content':{'type':Sequelize[_0xc557('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc557('0x5'),_0xc557('0x2'),_0xc557('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xc557('0x6')]},'nameField':{'type':Sequelize[_0xc557('0x6')]},'customField':{'type':Sequelize[_0xc557('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa212=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x5e597b,_0x2217b9){var _0x917c0c=function(_0x1227ec){while(--_0x1227ec){_0x5e597b['push'](_0x5e597b['shift']());}};_0x917c0c(++_0x2217b9);}(_0xa212,0x15e));var _0x2a21=function(_0x420eec,_0x551dd9){_0x420eec=_0x420eec-0x0;var _0x227765=_0xa212[_0x420eec];return _0x227765;};'use strict';var Sequelize=require(_0x2a21('0x0'));module[_0x2a21('0x1')]={'type':{'type':Sequelize[_0x2a21('0x2')](_0x2a21('0x3'),_0x2a21('0x4'),_0x2a21('0x5'),_0x2a21('0x6'),'picklist'),'defaultValue':_0x2a21('0x3')},'content':{'type':Sequelize[_0x2a21('0x7')]},'key':{'type':Sequelize[_0x2a21('0x7')]},'keyType':{'type':Sequelize[_0x2a21('0x2')](_0x2a21('0x3'),'variable',_0x2a21('0x5'))},'keyContent':{'type':Sequelize[_0x2a21('0x7')]},'idField':{'type':Sequelize[_0x2a21('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x2a21('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 62843e0..ab412ad 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 _0x2cc4=['path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','DeskField','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0xacf184,_0x2765db){var _0x588924=function(_0x4b03fd){while(--_0x4b03fd){_0xacf184['push'](_0xacf184['shift']());}};_0x588924(++_0x2765db);}(_0x2cc4,0xdd));var _0x42cc=function(_0x36436d,_0x20292c){_0x36436d=_0x36436d-0x0;var _0x34615d=_0x2cc4[_0x36436d];return _0x34615d;};'use strict';var emlformat=require(_0x42cc('0x0'));var rimraf=require(_0x42cc('0x1'));var zipdir=require(_0x42cc('0x2'));var jsonpatch=require(_0x42cc('0x3'));var rp=require(_0x42cc('0x4'));var moment=require('moment');var BPromise=require(_0x42cc('0x5'));var Mustache=require(_0x42cc('0x6'));var util=require('util');var path=require(_0x42cc('0x7'));var sox=require(_0x42cc('0x8'));var csv=require(_0x42cc('0x9'));var ejs=require(_0x42cc('0xa'));var fs=require('fs');var fs_extra=require(_0x42cc('0xb'));var _=require('lodash');var squel=require(_0x42cc('0xc'));var crypto=require(_0x42cc('0xd'));var jsforce=require(_0x42cc('0xe'));var deskjs=require(_0x42cc('0xf'));var toCsv=require(_0x42cc('0x9'));var querystring=require(_0x42cc('0x10'));var Papa=require(_0x42cc('0x11'));var Redis=require(_0x42cc('0x12'));var authService=require(_0x42cc('0x13'));var qs=require(_0x42cc('0x14'));var as=require(_0x42cc('0x15'));var hardwareService=require(_0x42cc('0x16'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x42cc('0x17'));var db=require(_0x42cc('0x18'))['db'];function respondWithStatusCode(_0x1f07dc,_0x1ad371){_0x1ad371=_0x1ad371||0xcc;return function(_0x4f03b9){if(_0x4f03b9){return _0x1f07dc[_0x42cc('0x19')](_0x1ad371);}return _0x1f07dc[_0x42cc('0x1a')](_0x1ad371)[_0x42cc('0x1b')]();};}function respondWithResult(_0xb60b1d,_0x2917f4){_0x2917f4=_0x2917f4||0xc8;return function(_0x3ea8b0){if(_0x3ea8b0){return _0xb60b1d[_0x42cc('0x1a')](_0x2917f4)[_0x42cc('0x1c')](_0x3ea8b0);}};}function respondWithFilteredResult(_0x59b79f,_0xffc1cb){return function(_0xb02471){if(_0xb02471){var _0x2162d8=typeof _0xffc1cb[_0x42cc('0x1d')]===_0x42cc('0x1e')&&typeof _0xffc1cb['limit']===_0x42cc('0x1e');var _0x5b2203=_0xb02471[_0x42cc('0x1f')];var _0x28815d=_0x2162d8?0x0:_0xffc1cb[_0x42cc('0x1d')];var _0xade693=_0x2162d8?_0xb02471[_0x42cc('0x1f')]:_0xffc1cb[_0x42cc('0x1d')]+_0xffc1cb[_0x42cc('0x20')];var _0x4f901e;if(_0xade693>=_0x5b2203){_0xade693=_0x5b2203;_0x4f901e=0xc8;}else{_0x4f901e=0xce;}_0x59b79f[_0x42cc('0x1a')](_0x4f901e);return _0x59b79f[_0x42cc('0x21')](_0x42cc('0x22'),_0x28815d+'-'+_0xade693+'/'+_0x5b2203)[_0x42cc('0x1c')](_0xb02471);}return null;};}function patchUpdates(_0x519fda){return function(_0x449583){try{jsonpatch[_0x42cc('0x23')](_0x449583,_0x519fda,!![]);}catch(_0x8be7cc){return BPromise['reject'](_0x8be7cc);}return _0x449583['save']();};}function saveUpdates(_0x55b590,_0x1a3f57){return function(_0x42c599){if(_0x42c599){return _0x42c599[_0x42cc('0x24')](_0x55b590)[_0x42cc('0x25')](function(_0x24d9cb){return _0x24d9cb;});}return null;};}function removeEntity(_0x53fedc,_0x11484b){return function(_0x3eae7e){if(_0x3eae7e){return _0x3eae7e[_0x42cc('0x26')]()[_0x42cc('0x25')](function(){_0x53fedc[_0x42cc('0x1a')](0xcc)[_0x42cc('0x1b')]();});}};}function handleEntityNotFound(_0x241d71,_0x4979d7){return function(_0xc0a184){if(!_0xc0a184){_0x241d71['sendStatus'](0x194);}return _0xc0a184;};}function handleError(_0x54bb01,_0x3309fc){_0x3309fc=_0x3309fc||0x1f4;return function(_0x4f8541){logger[_0x42cc('0x27')](_0x4f8541[_0x42cc('0x28')]);if(_0x4f8541[_0x42cc('0x29')]){delete _0x4f8541[_0x42cc('0x29')];}_0x54bb01['status'](_0x3309fc)['send'](_0x4f8541);};}exports[_0x42cc('0x2a')]=function(_0x27475e,_0x4a5aac){var _0x55db2f={},_0x1093e0={},_0x1ef9f2={'count':0x0,'rows':[]};var _0x47efab=_[_0x42cc('0x2b')](db[_0x42cc('0x2c')][_0x42cc('0x2d')],function(_0x518456){return{'name':_0x518456[_0x42cc('0x2e')],'type':_0x518456[_0x42cc('0x2f')]['key']};});_0x1093e0[_0x42cc('0x30')]=_['map'](_0x47efab,_0x42cc('0x29'));_0x1093e0[_0x42cc('0x31')]=_[_0x42cc('0x32')](_0x27475e[_0x42cc('0x31')]);_0x1093e0['filters']=_[_0x42cc('0x33')](_0x1093e0[_0x42cc('0x30')],_0x1093e0['query']);_0x55db2f['attributes']=_[_0x42cc('0x33')](_0x1093e0[_0x42cc('0x30')],qs['fields'](_0x27475e[_0x42cc('0x31')][_0x42cc('0x34')]));_0x55db2f['attributes']=_0x55db2f[_0x42cc('0x35')][_0x42cc('0x36')]?_0x55db2f['attributes']:_0x1093e0[_0x42cc('0x30')];if(!_0x27475e[_0x42cc('0x31')][_0x42cc('0x37')](_0x42cc('0x38'))){_0x55db2f[_0x42cc('0x20')]=qs[_0x42cc('0x20')](_0x27475e[_0x42cc('0x31')][_0x42cc('0x20')]);_0x55db2f[_0x42cc('0x1d')]=qs[_0x42cc('0x1d')](_0x27475e[_0x42cc('0x31')][_0x42cc('0x1d')]);}_0x55db2f[_0x42cc('0x39')]=qs[_0x42cc('0x3a')](_0x27475e[_0x42cc('0x31')][_0x42cc('0x3a')]);_0x55db2f[_0x42cc('0x3b')]=qs[_0x42cc('0x3c')](_[_0x42cc('0x3d')](_0x27475e[_0x42cc('0x31')],_0x1093e0[_0x42cc('0x3c')]),_0x47efab);if(_0x27475e['query'][_0x42cc('0x3e')]){_0x55db2f[_0x42cc('0x3b')]=_[_0x42cc('0x3f')](_0x55db2f[_0x42cc('0x3b')],{'$or':_['map'](_0x47efab,function(_0x313421){if(_0x313421[_0x42cc('0x2f')]!==_0x42cc('0x40')){var _0x3b010a={};_0x3b010a[_0x313421[_0x42cc('0x29')]]={'$like':'%'+_0x27475e[_0x42cc('0x31')]['filter']+'%'};return _0x3b010a;}})});}_0x55db2f=_['merge']({},_0x55db2f,_0x27475e[_0x42cc('0x41')]);var _0x549ae6={'where':_0x55db2f[_0x42cc('0x3b')]};return db[_0x42cc('0x2c')][_0x42cc('0x1f')](_0x549ae6)[_0x42cc('0x25')](function(_0x5a75ed){_0x1ef9f2['count']=_0x5a75ed;if(_0x27475e[_0x42cc('0x31')][_0x42cc('0x42')]){_0x55db2f[_0x42cc('0x43')]=[{'all':!![]}];}return db[_0x42cc('0x2c')][_0x42cc('0x44')](_0x55db2f);})['then'](function(_0x13767f){_0x1ef9f2[_0x42cc('0x45')]=_0x13767f;return _0x1ef9f2;})[_0x42cc('0x25')](respondWithFilteredResult(_0x4a5aac,_0x55db2f))[_0x42cc('0x46')](handleError(_0x4a5aac,null));};exports[_0x42cc('0x47')]=function(_0x1d9e80,_0x2a1f48){var _0x1cdd17={'raw':!![],'where':{'id':_0x1d9e80[_0x42cc('0x48')]['id']}},_0x136d89={};_0x136d89[_0x42cc('0x30')]=_[_0x42cc('0x32')](db[_0x42cc('0x2c')][_0x42cc('0x2d')]);_0x136d89[_0x42cc('0x31')]=_[_0x42cc('0x32')](_0x1d9e80['query']);_0x136d89['filters']=_[_0x42cc('0x33')](_0x136d89[_0x42cc('0x30')],_0x136d89[_0x42cc('0x31')]);_0x1cdd17[_0x42cc('0x35')]=_[_0x42cc('0x33')](_0x136d89[_0x42cc('0x30')],qs[_0x42cc('0x34')](_0x1d9e80[_0x42cc('0x31')][_0x42cc('0x34')]));_0x1cdd17[_0x42cc('0x35')]=_0x1cdd17[_0x42cc('0x35')][_0x42cc('0x36')]?_0x1cdd17[_0x42cc('0x35')]:_0x136d89['model'];if(_0x1d9e80[_0x42cc('0x31')][_0x42cc('0x42')]){_0x1cdd17[_0x42cc('0x43')]=[{'all':!![]}];}_0x1cdd17=_['merge']({},_0x1cdd17,_0x1d9e80['options']);return db[_0x42cc('0x2c')]['find'](_0x1cdd17)[_0x42cc('0x25')](handleEntityNotFound(_0x2a1f48,null))[_0x42cc('0x25')](respondWithResult(_0x2a1f48,null))[_0x42cc('0x46')](handleError(_0x2a1f48,null));};exports[_0x42cc('0x49')]=function(_0x548a59,_0x98b91c){return db['DeskField']['create'](_0x548a59[_0x42cc('0x4a')],{})[_0x42cc('0x25')](respondWithResult(_0x98b91c,0xc9))[_0x42cc('0x46')](handleError(_0x98b91c,null));};exports[_0x42cc('0x24')]=function(_0x3e31e5,_0x2e8ae3){if(_0x3e31e5[_0x42cc('0x4a')]['id']){delete _0x3e31e5[_0x42cc('0x4a')]['id'];}return db[_0x42cc('0x2c')][_0x42cc('0x4b')]({'where':{'id':_0x3e31e5[_0x42cc('0x48')]['id']}})[_0x42cc('0x25')](handleEntityNotFound(_0x2e8ae3,null))[_0x42cc('0x25')](saveUpdates(_0x3e31e5[_0x42cc('0x4a')],null))[_0x42cc('0x25')](respondWithResult(_0x2e8ae3,null))['catch'](handleError(_0x2e8ae3,null));};exports[_0x42cc('0x26')]=function(_0x3659ef,_0x3cc4a4){return db[_0x42cc('0x2c')][_0x42cc('0x4b')]({'where':{'id':_0x3659ef['params']['id']}})[_0x42cc('0x25')](handleEntityNotFound(_0x3cc4a4,null))[_0x42cc('0x25')](removeEntity(_0x3cc4a4,null))[_0x42cc('0x46')](handleError(_0x3cc4a4,null));}; \ No newline at end of file +var _0x5334=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x4b13f0,_0x1273df){var _0x2a1955=function(_0x5634ea){while(--_0x5634ea){_0x4b13f0['push'](_0x4b13f0['shift']());}};_0x2a1955(++_0x1273df);}(_0x5334,0x84));var _0x4533=function(_0x5d126d,_0x7c5874){_0x5d126d=_0x5d126d-0x0;var _0x2cdba9=_0x5334[_0x5d126d];return _0x2cdba9;};'use strict';var emlformat=require(_0x4533('0x0'));var rimraf=require(_0x4533('0x1'));var zipdir=require(_0x4533('0x2'));var jsonpatch=require(_0x4533('0x3'));var rp=require(_0x4533('0x4'));var moment=require('moment');var BPromise=require(_0x4533('0x5'));var Mustache=require('mustache');var util=require(_0x4533('0x6'));var path=require(_0x4533('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4533('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4533('0x9'));var deskjs=require(_0x4533('0xa'));var toCsv=require(_0x4533('0xb'));var querystring=require(_0x4533('0xc'));var Papa=require(_0x4533('0xd'));var Redis=require(_0x4533('0xe'));var authService=require(_0x4533('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4533('0x10'));var hardwareService=require(_0x4533('0x11'));var logger=require(_0x4533('0x12'))(_0x4533('0x13'));var utils=require('../../config/utils');var config=require(_0x4533('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4533('0x15'))['db'];function respondWithStatusCode(_0x439210,_0x45ba67){_0x45ba67=_0x45ba67||0xcc;return function(_0x19b74e){if(_0x19b74e){return _0x439210['sendStatus'](_0x45ba67);}return _0x439210[_0x4533('0x16')](_0x45ba67)[_0x4533('0x17')]();};}function respondWithResult(_0x187f05,_0x18d4f0){_0x18d4f0=_0x18d4f0||0xc8;return function(_0x533a26){if(_0x533a26){return _0x187f05[_0x4533('0x16')](_0x18d4f0)['json'](_0x533a26);}};}function respondWithFilteredResult(_0x4c703c,_0x466545){return function(_0x34dea9){if(_0x34dea9){var _0x5da8b8=typeof _0x466545[_0x4533('0x18')]===_0x4533('0x19')&&typeof _0x466545[_0x4533('0x1a')]==='undefined';var _0x3ed873=_0x34dea9['count'];var _0x3ddb36=_0x5da8b8?0x0:_0x466545[_0x4533('0x18')];var _0x56ab4f=_0x5da8b8?_0x34dea9[_0x4533('0x1b')]:_0x466545['offset']+_0x466545['limit'];var _0x1c5cdd;if(_0x56ab4f>=_0x3ed873){_0x56ab4f=_0x3ed873;_0x1c5cdd=0xc8;}else{_0x1c5cdd=0xce;}_0x4c703c[_0x4533('0x16')](_0x1c5cdd);return _0x4c703c['set']('Content-Range',_0x3ddb36+'-'+_0x56ab4f+'/'+_0x3ed873)[_0x4533('0x1c')](_0x34dea9);}return null;};}function patchUpdates(_0x3b18c1){return function(_0x3467ba){try{jsonpatch[_0x4533('0x1d')](_0x3467ba,_0x3b18c1,!![]);}catch(_0x6766eb){return BPromise[_0x4533('0x1e')](_0x6766eb);}return _0x3467ba[_0x4533('0x1f')]();};}function saveUpdates(_0x5c3abb,_0x231bae){return function(_0xd55c04){if(_0xd55c04){return _0xd55c04[_0x4533('0x20')](_0x5c3abb)['then'](function(_0x513011){return _0x513011;});}return null;};}function removeEntity(_0x138fd9,_0x11e93a){return function(_0x4c640c){if(_0x4c640c){return _0x4c640c['destroy']()[_0x4533('0x21')](function(){_0x138fd9[_0x4533('0x16')](0xcc)[_0x4533('0x17')]();});}};}function handleEntityNotFound(_0x4d8189,_0x44786f){return function(_0x39b261){if(!_0x39b261){_0x4d8189[_0x4533('0x22')](0x194);}return _0x39b261;};}function handleError(_0x3fba67,_0x19ab4d){_0x19ab4d=_0x19ab4d||0x1f4;return function(_0x3fc5b0){logger[_0x4533('0x23')](_0x3fc5b0[_0x4533('0x24')]);if(_0x3fc5b0[_0x4533('0x25')]){delete _0x3fc5b0['name'];}_0x3fba67['status'](_0x19ab4d)[_0x4533('0x26')](_0x3fc5b0);};}exports['index']=function(_0x3fd76a,_0x4e2b80){var _0x159fea={},_0x42ba2d={},_0x38706b={'count':0x0,'rows':[]};var _0x4300c1=_[_0x4533('0x27')](db[_0x4533('0x28')][_0x4533('0x29')],function(_0xa58dd1){return{'name':_0xa58dd1[_0x4533('0x2a')],'type':_0xa58dd1[_0x4533('0x2b')][_0x4533('0x2c')]};});_0x42ba2d[_0x4533('0x2d')]=_[_0x4533('0x27')](_0x4300c1,'name');_0x42ba2d[_0x4533('0x2e')]=_['keys'](_0x3fd76a[_0x4533('0x2e')]);_0x42ba2d[_0x4533('0x2f')]=_[_0x4533('0x30')](_0x42ba2d[_0x4533('0x2d')],_0x42ba2d[_0x4533('0x2e')]);_0x159fea[_0x4533('0x31')]=_[_0x4533('0x30')](_0x42ba2d[_0x4533('0x2d')],qs[_0x4533('0x32')](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x32')]));_0x159fea[_0x4533('0x31')]=_0x159fea['attributes'][_0x4533('0x33')]?_0x159fea[_0x4533('0x31')]:_0x42ba2d[_0x4533('0x2d')];if(!_0x3fd76a[_0x4533('0x2e')][_0x4533('0x34')]('nolimit')){_0x159fea[_0x4533('0x1a')]=qs[_0x4533('0x1a')](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x1a')]);_0x159fea[_0x4533('0x18')]=qs[_0x4533('0x18')](_0x3fd76a['query'][_0x4533('0x18')]);}_0x159fea[_0x4533('0x35')]=qs['sort'](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x36')]);_0x159fea[_0x4533('0x37')]=qs[_0x4533('0x2f')](_[_0x4533('0x38')](_0x3fd76a[_0x4533('0x2e')],_0x42ba2d[_0x4533('0x2f')]),_0x4300c1);if(_0x3fd76a[_0x4533('0x2e')][_0x4533('0x39')]){_0x159fea[_0x4533('0x37')]=_['merge'](_0x159fea[_0x4533('0x37')],{'$or':_[_0x4533('0x27')](_0x4300c1,function(_0x296d31){if(_0x296d31[_0x4533('0x2b')]!==_0x4533('0x3a')){var _0x17af88={};_0x17af88[_0x296d31[_0x4533('0x25')]]={'$like':'%'+_0x3fd76a[_0x4533('0x2e')][_0x4533('0x39')]+'%'};return _0x17af88;}})});}_0x159fea=_[_0x4533('0x3b')]({},_0x159fea,_0x3fd76a[_0x4533('0x3c')]);var _0x2e49a1={'where':_0x159fea['where']};return db['DeskField'][_0x4533('0x1b')](_0x2e49a1)['then'](function(_0x4260e6){_0x38706b[_0x4533('0x1b')]=_0x4260e6;if(_0x3fd76a[_0x4533('0x2e')][_0x4533('0x3d')]){_0x159fea[_0x4533('0x3e')]=[{'all':!![]}];}return db[_0x4533('0x28')][_0x4533('0x3f')](_0x159fea);})[_0x4533('0x21')](function(_0x11bc6b){_0x38706b[_0x4533('0x40')]=_0x11bc6b;return _0x38706b;})[_0x4533('0x21')](respondWithFilteredResult(_0x4e2b80,_0x159fea))[_0x4533('0x41')](handleError(_0x4e2b80,null));};exports[_0x4533('0x42')]=function(_0x5c4a04,_0x1aaedc){var _0x556dd9={'raw':!![],'where':{'id':_0x5c4a04['params']['id']}},_0x57d7c3={};_0x57d7c3['model']=_[_0x4533('0x43')](db[_0x4533('0x28')][_0x4533('0x29')]);_0x57d7c3[_0x4533('0x2e')]=_['keys'](_0x5c4a04[_0x4533('0x2e')]);_0x57d7c3[_0x4533('0x2f')]=_[_0x4533('0x30')](_0x57d7c3[_0x4533('0x2d')],_0x57d7c3[_0x4533('0x2e')]);_0x556dd9[_0x4533('0x31')]=_[_0x4533('0x30')](_0x57d7c3['model'],qs[_0x4533('0x32')](_0x5c4a04['query']['fields']));_0x556dd9[_0x4533('0x31')]=_0x556dd9[_0x4533('0x31')][_0x4533('0x33')]?_0x556dd9[_0x4533('0x31')]:_0x57d7c3['model'];if(_0x5c4a04['query'][_0x4533('0x3d')]){_0x556dd9['include']=[{'all':!![]}];}_0x556dd9=_[_0x4533('0x3b')]({},_0x556dd9,_0x5c4a04[_0x4533('0x3c')]);return db['DeskField']['find'](_0x556dd9)['then'](handleEntityNotFound(_0x1aaedc,null))['then'](respondWithResult(_0x1aaedc,null))['catch'](handleError(_0x1aaedc,null));};exports[_0x4533('0x44')]=function(_0x4797a3,_0x429447){return db['DeskField'][_0x4533('0x44')](_0x4797a3['body'],{})['then'](respondWithResult(_0x429447,0xc9))[_0x4533('0x41')](handleError(_0x429447,null));};exports['update']=function(_0x1394cb,_0x59e358){if(_0x1394cb[_0x4533('0x45')]['id']){delete _0x1394cb[_0x4533('0x45')]['id'];}return db['DeskField'][_0x4533('0x46')]({'where':{'id':_0x1394cb[_0x4533('0x47')]['id']}})[_0x4533('0x21')](handleEntityNotFound(_0x59e358,null))[_0x4533('0x21')](saveUpdates(_0x1394cb[_0x4533('0x45')],null))['then'](respondWithResult(_0x59e358,null))[_0x4533('0x41')](handleError(_0x59e358,null));};exports[_0x4533('0x48')]=function(_0x5260e9,_0x2454ed){return db[_0x4533('0x28')][_0x4533('0x46')]({'where':{'id':_0x5260e9[_0x4533('0x47')]['id']}})[_0x4533('0x21')](handleEntityNotFound(_0x2454ed,null))[_0x4533('0x21')](removeEntity(_0x2454ed,null))[_0x4533('0x41')](handleError(_0x2454ed,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index a0ed647..6cdbd71 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 _0x1ff6=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDeskField.attributes','exports','int_desk_fields','desk_unique_index','idField'];(function(_0x333220,_0x2d7896){var _0x3b1ad1=function(_0x1a5130){while(--_0x1a5130){_0x333220['push'](_0x333220['shift']());}};_0x3b1ad1(++_0x2d7896);}(_0x1ff6,0x70));var _0x61ff=function(_0x580489,_0x30760c){_0x580489=_0x580489-0x0;var _0x1db098=_0x1ff6[_0x580489];return _0x1db098;};'use strict';var _=require(_0x61ff('0x0'));var util=require(_0x61ff('0x1'));var logger=require(_0x61ff('0x2'))(_0x61ff('0x3'));var moment=require(_0x61ff('0x4'));var BPromise=require(_0x61ff('0x5'));var rp=require(_0x61ff('0x6'));var fs=require('fs');var path=require(_0x61ff('0x7'));var rimraf=require(_0x61ff('0x8'));var config=require('../../config/environment');var attributes=require(_0x61ff('0x9'));module[_0x61ff('0xa')]=function(_0x41284f,_0x983e2b){return _0x41284f['define']('DeskField',attributes,{'tableName':_0x61ff('0xb'),'paranoid':![],'indexes':[{'name':_0x61ff('0xc'),'fields':[_0x61ff('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0e6b=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x4bf568,_0x3dfd7d){var _0x1abe53=function(_0x34f5ef){while(--_0x34f5ef){_0x4bf568['push'](_0x4bf568['shift']());}};_0x1abe53(++_0x3dfd7d);}(_0x0e6b,0x15b));var _0xb0e6=function(_0x405385,_0x56f573){_0x405385=_0x405385-0x0;var _0x43837b=_0x0e6b[_0x405385];return _0x43837b;};'use strict';var _=require(_0xb0e6('0x0'));var util=require(_0xb0e6('0x1'));var logger=require(_0xb0e6('0x2'))(_0xb0e6('0x3'));var moment=require(_0xb0e6('0x4'));var BPromise=require('bluebird');var rp=require(_0xb0e6('0x5'));var fs=require('fs');var path=require(_0xb0e6('0x6'));var rimraf=require(_0xb0e6('0x7'));var config=require(_0xb0e6('0x8'));var attributes=require(_0xb0e6('0x9'));module[_0xb0e6('0xa')]=function(_0x403d64,_0x2a44bc){return _0x403d64[_0xb0e6('0xb')](_0xb0e6('0xc'),attributes,{'tableName':_0xb0e6('0xd'),'paranoid':![],'indexes':[{'name':_0xb0e6('0xe'),'fields':[_0xb0e6('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index aa898c4..2f3fe84 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 _0xf86f=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','util'];(function(_0x3825ff,_0x48f9f6){var _0x25c97d=function(_0x803b7e){while(--_0x803b7e){_0x3825ff['push'](_0x3825ff['shift']());}};_0x25c97d(++_0x48f9f6);}(_0xf86f,0xfb));var _0xff86=function(_0x685346,_0x3ef2e5){_0x685346=_0x685346-0x0;var _0x52e15b=_0xf86f[_0x685346];return _0x52e15b;};'use strict';var _=require('lodash');var util=require(_0xff86('0x0'));var moment=require('moment');var BPromise=require(_0xff86('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xff86('0x2'));var db=require(_0xff86('0x3'))['db'];var utils=require(_0xff86('0x4'));var logger=require(_0xff86('0x5'))(_0xff86('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xff86('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287882,_0x389170,_0x573846){return new BPromise(function(_0x2270ec,_0x5de836){return client[_0xff86('0x8')](_0x287882,_0x573846)['then'](function(_0x562234){logger['info'](_0xff86('0x9'),_0x389170,_0xff86('0xa'));logger[_0xff86('0xb')](_0xff86('0xc'),_0x389170,_0xff86('0xa'),JSON[_0xff86('0xd')](_0x562234));if(_0x562234[_0xff86('0xe')]){if(_0x562234[_0xff86('0xe')]['code']===0x1f4){logger[_0xff86('0xe')](_0xff86('0x9'),_0x389170,_0x562234[_0xff86('0xe')]['message']);return _0x5de836(_0x562234[_0xff86('0xe')][_0xff86('0xf')]);}logger[_0xff86('0xe')]('DeskField,\x20%s,\x20%s',_0x389170,_0x562234[_0xff86('0xe')][_0xff86('0xf')]);return _0x2270ec(_0x562234[_0xff86('0xe')][_0xff86('0xf')]);}else{logger[_0xff86('0x10')](_0xff86('0x9'),_0x389170,_0xff86('0xa'));_0x2270ec(_0x562234['result'][_0xff86('0xf')]);}})[_0xff86('0x11')](function(_0x1a7858){logger[_0xff86('0xe')](_0xff86('0x9'),_0x389170,_0x1a7858);_0x5de836(_0x1a7858);});});} \ No newline at end of file +var _0x1bfc=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0x1bfc,0x1ba));var _0xc1bf=function(_0x27b503,_0xe3fa84){_0x27b503=_0x27b503-0x0;var _0x6b3a41=_0x1bfc[_0x27b503];return _0x6b3a41;};'use strict';var _=require(_0xc1bf('0x0'));var util=require(_0xc1bf('0x1'));var moment=require('moment');var BPromise=require(_0xc1bf('0x2'));var rs=require(_0xc1bf('0x3'));var fs=require('fs');var Redis=require(_0xc1bf('0x4'));var db=require(_0xc1bf('0x5'))['db'];var utils=require(_0xc1bf('0x6'));var logger=require(_0xc1bf('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc1bf('0x8'));var client=jayson['client'][_0xc1bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x520ae9,_0x1187e8,_0x5cc586){return new BPromise(function(_0x2b17e8,_0x1ed5a2){return client[_0xc1bf('0xa')](_0x520ae9,_0x5cc586)[_0xc1bf('0xb')](function(_0x4cb242){logger[_0xc1bf('0xc')]('DeskField,\x20%s,\x20%s',_0x1187e8,_0xc1bf('0xd'));logger[_0xc1bf('0xe')](_0xc1bf('0xf'),_0x1187e8,_0xc1bf('0xd'),JSON[_0xc1bf('0x10')](_0x4cb242));if(_0x4cb242[_0xc1bf('0x11')]){if(_0x4cb242[_0xc1bf('0x11')][_0xc1bf('0x12')]===0x1f4){logger[_0xc1bf('0x11')](_0xc1bf('0x13'),_0x1187e8,_0x4cb242[_0xc1bf('0x11')][_0xc1bf('0x14')]);return _0x1ed5a2(_0x4cb242[_0xc1bf('0x11')][_0xc1bf('0x14')]);}logger[_0xc1bf('0x11')]('DeskField,\x20%s,\x20%s',_0x1187e8,_0x4cb242[_0xc1bf('0x11')]['message']);return _0x2b17e8(_0x4cb242[_0xc1bf('0x11')][_0xc1bf('0x14')]);}else{logger[_0xc1bf('0xc')]('DeskField,\x20%s,\x20%s',_0x1187e8,'request\x20sent');_0x2b17e8(_0x4cb242['result'][_0xc1bf('0x14')]);}})[_0xc1bf('0x15')](function(_0x388648){logger['error'](_0xc1bf('0x13'),_0x1187e8,_0x388648);_0x1ed5a2(_0x388648);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e47b493..5ead053 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 _0xd4be=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1f23c2,_0x2c504a){var _0xcca82b=function(_0x1d9e9b){while(--_0x1d9e9b){_0x1f23c2['push'](_0x1f23c2['shift']());}};_0xcca82b(++_0x2c504a);}(_0xd4be,0xa7));var _0xed4b=function(_0x462100,_0x156c3b){_0x462100=_0x462100-0x0;var _0x4401a3=_0xd4be[_0x462100];return _0x4401a3;};'use strict';var multer=require(_0xed4b('0x0'));var util=require(_0xed4b('0x1'));var path=require(_0xed4b('0x2'));var timeout=require('connect-timeout');var express=require(_0xed4b('0x3'));var router=express[_0xed4b('0x4')]();var fs_extra=require(_0xed4b('0x5'));var auth=require(_0xed4b('0x6'));var interaction=require(_0xed4b('0x7'));var config=require('../../config/environment');var controller=require(_0xed4b('0x8'));router[_0xed4b('0x9')]('/',auth[_0xed4b('0xa')](),controller[_0xed4b('0xb')]);router[_0xed4b('0x9')](_0xed4b('0xc'),auth['isAuthenticated'](),controller[_0xed4b('0xd')]);router[_0xed4b('0x9')](_0xed4b('0xe'),auth[_0xed4b('0xa')](),controller['getConfigurations']);router[_0xed4b('0x9')](_0xed4b('0xf'),auth['isAuthenticated'](),controller[_0xed4b('0x10')]);router[_0xed4b('0x11')]('/',auth[_0xed4b('0xa')](),controller[_0xed4b('0x12')]);router['post'](_0xed4b('0xe'),auth[_0xed4b('0xa')](),controller[_0xed4b('0x13')]);router[_0xed4b('0x14')](_0xed4b('0xc'),auth['isAuthenticated'](),controller[_0xed4b('0x15')]);router[_0xed4b('0x16')](_0xed4b('0xc'),auth['isAuthenticated'](),controller[_0xed4b('0x17')]);module[_0xed4b('0x18')]=router; \ No newline at end of file +var _0x8b76=['isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id/configurations'];(function(_0x3b4897,_0x5f3d9b){var _0x4694e1=function(_0xd923d6){while(--_0xd923d6){_0x3b4897['push'](_0x3b4897['shift']());}};_0x4694e1(++_0x5f3d9b);}(_0x8b76,0xfd));var _0x68b7=function(_0xb14b94,_0x4e1672){_0xb14b94=_0xb14b94-0x0;var _0xe2b84f=_0x8b76[_0xb14b94];return _0xe2b84f;};'use strict';var multer=require(_0x68b7('0x0'));var util=require(_0x68b7('0x1'));var path=require(_0x68b7('0x2'));var timeout=require(_0x68b7('0x3'));var express=require('express');var router=express[_0x68b7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x68b7('0x5'));var interaction=require(_0x68b7('0x6'));var config=require(_0x68b7('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x68b7('0x8')]('/',auth['isAuthenticated'](),controller[_0x68b7('0x9')]);router[_0x68b7('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x68b7('0xa'),auth[_0x68b7('0xb')](),controller[_0x68b7('0xc')]);router[_0x68b7('0x8')](_0x68b7('0xd'),auth[_0x68b7('0xb')](),controller[_0x68b7('0xe')]);router[_0x68b7('0xf')]('/',auth[_0x68b7('0xb')](),controller[_0x68b7('0x10')]);router[_0x68b7('0xf')]('/:id/configurations',auth[_0x68b7('0xb')](),controller[_0x68b7('0x11')]);router[_0x68b7('0x12')](_0x68b7('0x13'),auth[_0x68b7('0xb')](),controller['update']);router[_0x68b7('0x14')](_0x68b7('0x13'),auth[_0x68b7('0xb')](),controller[_0x68b7('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e70954c..74ab1ca 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 _0x39cd=['exports','STRING','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x39cd,0x11c));var _0xd39c=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x39cd[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0xd39c('0x0'));module[_0xd39c('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd39c('0x2')]},'password':{'type':Sequelize[_0xd39c('0x2')]},'remoteUri':{'type':Sequelize[_0xd39c('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xd39c('0x2')]},'clientSecret':{'type':Sequelize[_0xd39c('0x2')]},'serverUrl':{'type':Sequelize[_0xd39c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd39c('0x2')]}}; \ No newline at end of file +var _0xe81e=['exports','STRING','sequelize'];(function(_0x37d0fa,_0x4f43d9){var _0x3cc391=function(_0x52edd3){while(--_0x52edd3){_0x37d0fa['push'](_0x37d0fa['shift']());}};_0x3cc391(++_0x4f43d9);}(_0xe81e,0xb6));var _0xee81=function(_0x143e89,_0x5cb0ba){_0x143e89=_0x143e89-0x0;var _0x4aa264=_0xe81e[_0x143e89];return _0x4aa264;};'use strict';var Sequelize=require(_0xee81('0x0'));module[_0xee81('0x1')]={'name':{'type':Sequelize[_0xee81('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xee81('0x2')]},'remoteUri':{'type':Sequelize[_0xee81('0x2')]},'tenantId':{'type':Sequelize[_0xee81('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xee81('0x2')]},'serverUrl':{'type':Sequelize[_0xee81('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xee81('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index b809007..28ac063 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 _0x1ee2=['modifiedbyyominame','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statuscode','subjectidname','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','password','tenantId','clientSecret','remoteUri','substring','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','access_token','Bearer\x20','4.0','MetadataId','GET','EntityDefinitions(','Attributes','includes','@odata.type','lastIndexOf','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','forEach','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Options','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','OptionSet','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','DisplayName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','send','index','Dynamics365Account','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','find','create','body','update','getConfigurations','findOne','Dynamics365Configuration','order','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Field','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyname','customeridtype','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname'];(function(_0x500254,_0x3d6928){var _0x33406a=function(_0x2d5700){while(--_0x2d5700){_0x500254['push'](_0x500254['shift']());}};_0x33406a(++_0x3d6928);}(_0x1ee2,0x11c));var _0x21ee=function(_0x3419db,_0x184c2e){_0x3419db=_0x3419db-0x0;var _0x42997d=_0x1ee2[_0x3419db];return _0x42997d;};'use strict';var emlformat=require(_0x21ee('0x0'));var rimraf=require(_0x21ee('0x1'));var zipdir=require(_0x21ee('0x2'));var jsonpatch=require(_0x21ee('0x3'));var rp=require(_0x21ee('0x4'));var moment=require('moment');var BPromise=require(_0x21ee('0x5'));var Mustache=require(_0x21ee('0x6'));var util=require('util');var path=require('path');var sox=require(_0x21ee('0x7'));var csv=require(_0x21ee('0x8'));var ejs=require(_0x21ee('0x9'));var fs=require('fs');var fs_extra=require(_0x21ee('0xa'));var _=require('lodash');var squel=require(_0x21ee('0xb'));var crypto=require(_0x21ee('0xc'));var jsforce=require(_0x21ee('0xd'));var deskjs=require(_0x21ee('0xe'));var toCsv=require(_0x21ee('0x8'));var querystring=require(_0x21ee('0xf'));var Papa=require(_0x21ee('0x10'));var Redis=require(_0x21ee('0x11'));var authService=require(_0x21ee('0x12'));var qs=require(_0x21ee('0x13'));var as=require(_0x21ee('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x21ee('0x15'));var config=require(_0x21ee('0x16'));var licenseUtil=require(_0x21ee('0x17'));var db=require(_0x21ee('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x435aa0,_0x177ebe){_0x177ebe=_0x177ebe||0xcc;return function(_0x177e3f){if(_0x177e3f){return _0x435aa0[_0x21ee('0x19')](_0x177ebe);}return _0x435aa0[_0x21ee('0x1a')](_0x177ebe)[_0x21ee('0x1b')]();};}function respondWithResult(_0x213947,_0x5800ee){_0x5800ee=_0x5800ee||0xc8;return function(_0x300cf0){if(_0x300cf0){return _0x213947[_0x21ee('0x1a')](_0x5800ee)[_0x21ee('0x1c')](_0x300cf0);}};}function respondWithFilteredResult(_0x31bed3,_0x240bef){return function(_0x2b2889){if(_0x2b2889){var _0x5830ab=typeof _0x240bef[_0x21ee('0x1d')]===_0x21ee('0x1e')&&typeof _0x240bef[_0x21ee('0x1f')]===_0x21ee('0x1e');var _0x31bbc1=_0x2b2889[_0x21ee('0x20')];var _0x11fa79=_0x5830ab?0x0:_0x240bef[_0x21ee('0x1d')];var _0x3b70d2=_0x5830ab?_0x2b2889[_0x21ee('0x20')]:_0x240bef[_0x21ee('0x1d')]+_0x240bef[_0x21ee('0x1f')];var _0x525029;if(_0x3b70d2>=_0x31bbc1){_0x3b70d2=_0x31bbc1;_0x525029=0xc8;}else{_0x525029=0xce;}_0x31bed3[_0x21ee('0x1a')](_0x525029);return _0x31bed3[_0x21ee('0x21')]('Content-Range',_0x11fa79+'-'+_0x3b70d2+'/'+_0x31bbc1)[_0x21ee('0x1c')](_0x2b2889);}return null;};}function patchUpdates(_0x5b29f2){return function(_0x18e8b7){try{jsonpatch[_0x21ee('0x22')](_0x18e8b7,_0x5b29f2,!![]);}catch(_0x1d19c5){return BPromise[_0x21ee('0x23')](_0x1d19c5);}return _0x18e8b7[_0x21ee('0x24')]();};}function saveUpdates(_0x313923,_0x2fb6a3){return function(_0x362f25){if(_0x362f25){return _0x362f25['update'](_0x313923)[_0x21ee('0x25')](function(_0x262769){return _0x262769;});}return null;};}function removeEntity(_0x51cf71,_0x2a878f){return function(_0x5ae320){if(_0x5ae320){return _0x5ae320[_0x21ee('0x26')]()[_0x21ee('0x25')](function(){_0x51cf71[_0x21ee('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3de275,_0x5d8826){return function(_0x24671b){if(!_0x24671b){_0x3de275[_0x21ee('0x19')](0x194);}return _0x24671b;};}function handleError(_0xd0abe3,_0x4df92c){_0x4df92c=_0x4df92c||0x1f4;return function(_0x3476c7){logger['error'](_0x3476c7[_0x21ee('0x27')]);if(_0x3476c7[_0x21ee('0x28')]){delete _0x3476c7['name'];}_0xd0abe3[_0x21ee('0x1a')](_0x4df92c)[_0x21ee('0x29')](_0x3476c7);};}exports[_0x21ee('0x2a')]=function(_0x56a777,_0x304745){var _0x3c2014={},_0x6547e={},_0x4bbc1a={'count':0x0,'rows':[]};var _0x2fbc7c=_['map'](db[_0x21ee('0x2b')][_0x21ee('0x2c')],function(_0x2aaa7d){return{'name':_0x2aaa7d[_0x21ee('0x2d')],'type':_0x2aaa7d[_0x21ee('0x2e')][_0x21ee('0x2f')]};});_0x6547e[_0x21ee('0x30')]=_[_0x21ee('0x31')](_0x2fbc7c,'name');_0x6547e[_0x21ee('0x32')]=_[_0x21ee('0x33')](_0x56a777[_0x21ee('0x32')]);_0x6547e[_0x21ee('0x34')]=_[_0x21ee('0x35')](_0x6547e[_0x21ee('0x30')],_0x6547e[_0x21ee('0x32')]);_0x3c2014[_0x21ee('0x36')]=_['intersection'](_0x6547e['model'],qs[_0x21ee('0x37')](_0x56a777[_0x21ee('0x32')][_0x21ee('0x37')]));_0x3c2014['attributes']=_0x3c2014[_0x21ee('0x36')][_0x21ee('0x38')]?_0x3c2014[_0x21ee('0x36')]:_0x6547e[_0x21ee('0x30')];if(!_0x56a777[_0x21ee('0x32')][_0x21ee('0x39')](_0x21ee('0x3a'))){_0x3c2014[_0x21ee('0x1f')]=qs[_0x21ee('0x1f')](_0x56a777[_0x21ee('0x32')][_0x21ee('0x1f')]);_0x3c2014[_0x21ee('0x1d')]=qs[_0x21ee('0x1d')](_0x56a777[_0x21ee('0x32')][_0x21ee('0x1d')]);}_0x3c2014['order']=qs['sort'](_0x56a777[_0x21ee('0x32')][_0x21ee('0x3b')]);_0x3c2014['where']=qs[_0x21ee('0x34')](_[_0x21ee('0x3c')](_0x56a777[_0x21ee('0x32')],_0x6547e[_0x21ee('0x34')]),_0x2fbc7c);if(_0x56a777['query'][_0x21ee('0x3d')]){_0x3c2014[_0x21ee('0x3e')]=_[_0x21ee('0x3f')](_0x3c2014['where'],{'$or':_[_0x21ee('0x31')](_0x2fbc7c,function(_0x1e484c){if(_0x1e484c[_0x21ee('0x2e')]!==_0x21ee('0x40')){var _0x145899={};_0x145899[_0x1e484c[_0x21ee('0x28')]]={'$like':'%'+_0x56a777[_0x21ee('0x32')][_0x21ee('0x3d')]+'%'};return _0x145899;}})});}_0x3c2014=_[_0x21ee('0x3f')]({},_0x3c2014,_0x56a777[_0x21ee('0x41')]);var _0x2169a4={'where':_0x3c2014[_0x21ee('0x3e')]};return db['Dynamics365Account'][_0x21ee('0x20')](_0x2169a4)['then'](function(_0x11a88c){_0x4bbc1a['count']=_0x11a88c;if(_0x56a777[_0x21ee('0x32')][_0x21ee('0x42')]){_0x3c2014['include']=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x3c2014);})[_0x21ee('0x25')](function(_0x32d995){_0x4bbc1a[_0x21ee('0x43')]=_0x32d995;return _0x4bbc1a;})[_0x21ee('0x25')](respondWithFilteredResult(_0x304745,_0x3c2014))[_0x21ee('0x44')](handleError(_0x304745,null));};exports[_0x21ee('0x45')]=function(_0x3c08a0,_0x4535cb){var _0x1f7c54={'raw':![],'where':{'id':_0x3c08a0[_0x21ee('0x46')]['id']}},_0x1b7f86={};_0x1b7f86[_0x21ee('0x30')]=_[_0x21ee('0x33')](db['Dynamics365Account']['rawAttributes']);_0x1b7f86['query']=_[_0x21ee('0x33')](_0x3c08a0[_0x21ee('0x32')]);_0x1b7f86[_0x21ee('0x34')]=_[_0x21ee('0x35')](_0x1b7f86[_0x21ee('0x30')],_0x1b7f86[_0x21ee('0x32')]);_0x1f7c54[_0x21ee('0x36')]=_[_0x21ee('0x35')](_0x1b7f86[_0x21ee('0x30')],qs[_0x21ee('0x37')](_0x3c08a0[_0x21ee('0x32')][_0x21ee('0x37')]));_0x1f7c54[_0x21ee('0x36')]=_0x1f7c54[_0x21ee('0x36')][_0x21ee('0x38')]?_0x1f7c54[_0x21ee('0x36')]:_0x1b7f86[_0x21ee('0x30')];if(_0x3c08a0[_0x21ee('0x32')][_0x21ee('0x42')]){_0x1f7c54[_0x21ee('0x47')]=[{'all':!![]}];}_0x1f7c54=_[_0x21ee('0x3f')]({},_0x1f7c54,_0x3c08a0[_0x21ee('0x41')]);return db[_0x21ee('0x2b')][_0x21ee('0x48')](_0x1f7c54)['then'](handleEntityNotFound(_0x4535cb,null))['then'](respondWithResult(_0x4535cb,null))[_0x21ee('0x44')](handleError(_0x4535cb,null));};exports[_0x21ee('0x49')]=function(_0x39e2b2,_0x212a05){return db[_0x21ee('0x2b')]['create'](_0x39e2b2[_0x21ee('0x4a')],{})[_0x21ee('0x25')](respondWithResult(_0x212a05,0xc9))['catch'](handleError(_0x212a05,null));};exports[_0x21ee('0x4b')]=function(_0x41c1cf,_0x94555e){if(_0x41c1cf[_0x21ee('0x4a')]['id']){delete _0x41c1cf[_0x21ee('0x4a')]['id'];}return db['Dynamics365Account'][_0x21ee('0x48')]({'where':{'id':_0x41c1cf[_0x21ee('0x46')]['id']}})['then'](handleEntityNotFound(_0x94555e,null))[_0x21ee('0x25')](saveUpdates(_0x41c1cf[_0x21ee('0x4a')],null))['then'](respondWithResult(_0x94555e,null))['catch'](handleError(_0x94555e,null));};exports[_0x21ee('0x26')]=function(_0x8e3848,_0x36afa1){return db[_0x21ee('0x2b')][_0x21ee('0x48')]({'where':{'id':_0x8e3848[_0x21ee('0x46')]['id']}})[_0x21ee('0x25')](handleEntityNotFound(_0x36afa1,null))[_0x21ee('0x25')](removeEntity(_0x36afa1,null))[_0x21ee('0x44')](handleError(_0x36afa1,null));};exports[_0x21ee('0x4c')]=function(_0x6043e3,_0x5f4c9b,_0x56d665){var _0xe3ac39={};var _0xf24870={};var _0x241f05;var _0x1b5297;return db['Dynamics365Account'][_0x21ee('0x4d')]({'where':{'id':_0x6043e3[_0x21ee('0x46')]['id']}})[_0x21ee('0x25')](handleEntityNotFound(_0x5f4c9b,null))['then'](function(_0x3a2ef1){if(_0x3a2ef1){_0x241f05=_0x3a2ef1;_0xf24870[_0x21ee('0x30')]=_['keys'](db[_0x21ee('0x4e')][_0x21ee('0x2c')]);_0xf24870[_0x21ee('0x32')]=_[_0x21ee('0x33')](_0x6043e3[_0x21ee('0x32')]);_0xf24870[_0x21ee('0x34')]=_['intersection'](_0xf24870[_0x21ee('0x30')],_0xf24870[_0x21ee('0x32')]);_0xe3ac39[_0x21ee('0x36')]=_[_0x21ee('0x35')](_0xf24870['model'],qs[_0x21ee('0x37')](_0x6043e3[_0x21ee('0x32')][_0x21ee('0x37')]));_0xe3ac39[_0x21ee('0x36')]=_0xe3ac39['attributes']['length']?_0xe3ac39[_0x21ee('0x36')]:_0xf24870[_0x21ee('0x30')];_0xe3ac39[_0x21ee('0x4f')]=qs[_0x21ee('0x3b')](_0x6043e3[_0x21ee('0x32')][_0x21ee('0x3b')]);_0xe3ac39[_0x21ee('0x3e')]=qs[_0x21ee('0x34')](_[_0x21ee('0x3c')](_0x6043e3[_0x21ee('0x32')],_0xf24870[_0x21ee('0x34')]));if(_0x6043e3[_0x21ee('0x32')]['filter']){_0xe3ac39['where']=_[_0x21ee('0x3f')](_0xe3ac39['where'],{'$or':_[_0x21ee('0x31')](_0xe3ac39[_0x21ee('0x36')],function(_0x3389d3){var _0x52444e={};_0x52444e[_0x3389d3]={'$like':'%'+_0x6043e3[_0x21ee('0x32')][_0x21ee('0x3d')]+'%'};return _0x52444e;})});}_0xe3ac39=_[_0x21ee('0x3f')]({},_0xe3ac39,_0x6043e3['options']);return _0x241f05['getConfigurations'](_0xe3ac39);}})[_0x21ee('0x25')](function(_0x369b43){if(_0x369b43){_0x1b5297=_0x369b43[_0x21ee('0x38')];if(!_0x6043e3[_0x21ee('0x32')]['hasOwnProperty'](_0x21ee('0x3a'))){_0xe3ac39[_0x21ee('0x1f')]=qs[_0x21ee('0x1f')](_0x6043e3[_0x21ee('0x32')][_0x21ee('0x1f')]);_0xe3ac39[_0x21ee('0x1d')]=qs[_0x21ee('0x1d')](_0x6043e3['query'][_0x21ee('0x1d')]);}return _0x241f05[_0x21ee('0x4c')](_0xe3ac39);}})['then'](function(_0x38bfdc){if(_0x38bfdc){return _0x38bfdc?{'count':_0x1b5297,'rows':_0x38bfdc}:null;}})[_0x21ee('0x25')](respondWithResult(_0x5f4c9b,null))['catch'](handleError(_0x5f4c9b,null));};exports[_0x21ee('0x50')]=function(_0x3338e1,_0x417e6f,_0x417442){if(_0x3338e1[_0x21ee('0x4a')]['id']){delete _0x3338e1['body']['id'];}return db[_0x21ee('0x2b')][_0x21ee('0x4d')]({'where':{'id':_0x3338e1[_0x21ee('0x46')]['id']}})[_0x21ee('0x25')](handleEntityNotFound(_0x417e6f,null))[_0x21ee('0x25')](function(_0x5516ed){if(_0x5516ed){_0x3338e1[_0x21ee('0x4a')]['AccountId']=_0x5516ed['id'];_0x3338e1[_0x21ee('0x4a')][_0x21ee('0x51')]=integrations[_0x21ee('0x52')](_0x3338e1[_0x21ee('0x4a')]['channel'],_0x3338e1[_0x21ee('0x4a')]['type']);_0x3338e1[_0x21ee('0x4a')][_0x21ee('0x53')]=integrations[_0x21ee('0x54')](_0x3338e1[_0x21ee('0x4a')]['channel'],_0x3338e1[_0x21ee('0x4a')][_0x21ee('0x2e')]);return db[_0x21ee('0x4e')][_0x21ee('0x49')](_0x3338e1[_0x21ee('0x4a')],{'include':[{'model':db[_0x21ee('0x55')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x21ee('0x53')}]});}return null;})[_0x21ee('0x25')](respondWithResult(_0x417e6f,null))[_0x21ee('0x44')](handleError(_0x417e6f,null));};exports['getFields']=function(_0x34b823,_0x5775a8,_0x41286b){var _0x4702eb=_0x34b823[_0x21ee('0x32')][_0x21ee('0x56')];var _0x177f56=_0x4702eb===_0x21ee('0x57')?_0x21ee('0x58'):'PhoneCall';var _0x10935d='';var _0x183367='';var _0x3dfa13='';var _0x41ac05='';var _0x498277='';var _0x342a74='';var _0x439d25='';var _0x1c7872='';var _0x20f61c=[_0x21ee('0x59'),'description',_0x21ee('0x5a'),_0x21ee('0x5b'),_0x21ee('0x5c'),_0x21ee('0x5d'),_0x21ee('0x5e'),_0x21ee('0x5f'),_0x21ee('0x60'),_0x21ee('0x61')];var _0x3045c2=[_0x21ee('0x62'),_0x21ee('0x63'),'actualserviceunits','billedserviceunits',_0x21ee('0x64'),_0x21ee('0x65'),_0x21ee('0x66'),_0x21ee('0x67'),_0x21ee('0x68'),_0x21ee('0x69'),_0x21ee('0x6a'),_0x21ee('0x6b'),'createdon',_0x21ee('0x6c'),'createdonbehalfbyyominame','customeridname',_0x21ee('0x6d'),_0x21ee('0x6e'),'emailaddress',_0x21ee('0x6f'),_0x21ee('0x70'),_0x21ee('0x71'),_0x21ee('0x72'),_0x21ee('0x73'),_0x21ee('0x74'),_0x21ee('0x75'),_0x21ee('0x76'),_0x21ee('0x77'),_0x21ee('0x78'),_0x21ee('0x79'),_0x21ee('0x7a'),_0x21ee('0x7b'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x21ee('0x7c'),'modifiedon',_0x21ee('0x7d'),'modifiedonbehalfbyyominame',_0x21ee('0x7e'),_0x21ee('0x7f'),'numberofchildincidents',_0x21ee('0x80'),_0x21ee('0x81'),_0x21ee('0x82'),_0x21ee('0x83'),'owneridyominame',_0x21ee('0x84'),'primarycontactidname','primarycontactidyominame','prioritycodename',_0x21ee('0x85'),_0x21ee('0x86'),_0x21ee('0x87'),_0x21ee('0x88'),_0x21ee('0x89'),_0x21ee('0x8a'),_0x21ee('0x8b'),_0x21ee('0x8c'),_0x21ee('0x8d'),_0x21ee('0x8e'),'socialprofileidname','statecode',_0x21ee('0x8f'),_0x21ee('0x90'),'ticketnumber','timezoneruleversionnumber',_0x21ee('0x91'),_0x21ee('0x92'),_0x21ee('0x93'),'versionnumber'];var _0x3e2611=_0x20f61c[_0x21ee('0x94')](_0x3045c2);return db['Dynamics365Account'][_0x21ee('0x4d')]({'where':{'id':_0x34b823[_0x21ee('0x46')]['id']},'attributes':['id',_0x21ee('0x95'),_0x21ee('0x96'),'remoteUri',_0x21ee('0x97'),'clientId',_0x21ee('0x98')]})['then'](handleEntityNotFound(_0x5775a8,null))[_0x21ee('0x25')](function(_0x5f1037){if(_0x5f1037){_0x1c7872=_0x5f1037[_0x21ee('0x99')];var _0x46d591=_0x1c7872['slice'](-0x1);if(_0x46d591==='/'){_0x1c7872=_0x1c7872[_0x21ee('0x9a')](0x0,_0x1c7872['lastIndexOf'](_0x46d591));}_0x439d25=util[_0x21ee('0x9b')](_0x21ee('0x9c'),_0x1c7872);var _0x3c4712={'method':_0x21ee('0x9d'),'uri':_0x21ee('0x9e')+_0x5f1037['tenantId']+_0x21ee('0x9f'),'form':{'client_id':_0x5f1037[_0x21ee('0xa0')],'resource':_0x1c7872,'username':_0x5f1037['username'],'password':_0x5f1037[_0x21ee('0x96')],'grant_type':_0x21ee('0x96'),'client_secret':_0x5f1037[_0x21ee('0x98')]},'json':!![]};return rp(_0x3c4712);}})['then'](function(_0x1f08bc){_0x342a74=_0x1f08bc[_0x21ee('0xa1')];var _0xe886c5={'method':'GET','uri':encodeURI(_0x439d25+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x177f56+'\x27'),'headers':{'Authorization':_0x21ee('0xa2')+_0x342a74,'If-None-Match':null,'OData-Version':_0x21ee('0xa3')},'json':!![]};return rp(_0xe886c5);})['then'](function(_0x55bf8a){var _0x6f4da9=_0x55bf8a['value'][0x0];var _0x9a4a33=_0x6f4da9[_0x21ee('0xa4')];var _0x480c4c={'method':_0x21ee('0xa5'),'uri':_0x439d25+_0x21ee('0xa6')+_0x9a4a33+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0x21ee('0xa2')+_0x342a74,'If-None-Match':null,'OData-Version':_0x21ee('0xa3')},'json':!![]};return rp(_0x480c4c);})[_0x21ee('0x25')](function(_0x35be15){_0x10935d=_0x35be15;_0x183367=_0x10935d[_0x21ee('0xa7')];_0x183367=_['remove'](_0x183367,function(_0x422067){return!_0x3e2611[_0x21ee('0xa8')](_0x422067['LogicalName']);});var _0x2e3183=[];var _0x2160e0=[];_0x183367['forEach'](function(_0x350fa0){if(_0x350fa0[_0x21ee('0xa9')]){var _0x25b407=_0x350fa0[_0x21ee('0xa9')][_0x21ee('0x9a')](_0x350fa0[_0x21ee('0xa9')][_0x21ee('0xaa')]('.')+0x1);if(_0x25b407===_0x21ee('0xab')){_0x2e3183[_0x21ee('0xac')](getSelectList(_0x439d25,_0x4702eb,_0x2160e0,_0x10935d['MetadataId'],_0x350fa0[_0x21ee('0xa4')],_0x342a74));}}});return Promise[_0x21ee('0xad')](_0x2e3183);})[_0x21ee('0x25')](function(_0x12d6ae){_0x3dfa13=_0x12d6ae[0x0];var _0x53c513=[];var _0x5bc7c4=[];_0x183367['forEach'](function(_0x17e2ef){if(!_[_0x21ee('0xae')](_0x17e2ef[_0x21ee('0xa9')])){var _0x141c71=_0x17e2ef[_0x21ee('0xa9')][_0x21ee('0x9a')](_0x17e2ef[_0x21ee('0xa9')][_0x21ee('0xaa')]('.')+0x1);if(_0x141c71===_0x21ee('0xaf')){_0x53c513[_0x21ee('0xac')](getBooleanList(_0x439d25,_0x4702eb,_0x5bc7c4,_0x10935d[_0x21ee('0xa4')],_0x17e2ef[_0x21ee('0xa4')],_0x342a74));}}});return Promise[_0x21ee('0xad')](_0x53c513);})[_0x21ee('0x25')](function(_0x5ceafa){_0x41ac05=_0x5ceafa[0x0];var _0x5e193a=[];var _0x48220a=[];_0x183367[_0x21ee('0xb0')](function(_0x38978e){if(_0x38978e[_0x21ee('0xa9')]){var _0x389329=_0x38978e[_0x21ee('0xa9')][_0x21ee('0x9a')](_0x38978e[_0x21ee('0xa9')][_0x21ee('0xaa')]('.')+0x1);if(_0x389329===_0x21ee('0xb1')||_0x389329===_0x21ee('0xb2')||_0x389329===_0x21ee('0xb3')||_0x389329===_0x21ee('0xb4')||_0x389329===_0x21ee('0xb5')||_0x389329===_0x21ee('0xb6')||_0x389329===_0x21ee('0xb7')||_0x389329===_0x21ee('0xb8')||_0x389329==='StateAttributeMetadata'||_0x389329===_0x21ee('0xb9')){_0x5e193a[_0x21ee('0xac')](getInputList(_0x439d25,_0x4702eb,_0x389329,_0x48220a,_0x10935d[_0x21ee('0xa4')],_0x38978e[_0x21ee('0xa4')],_0x342a74));}}});return Promise[_0x21ee('0xad')](_0x5e193a);})[_0x21ee('0x25')](function(_0x12577e){_0x498277=_0x12577e[0x0];var _0x3e2d59=_0x3dfa13[_0x21ee('0x94')](_0x41ac05)['concat'](_0x498277);var _0x5ce4cf={'count':_0x3e2d59[_0x21ee('0x38')],'rows':_0x3e2d59};return _0x5ce4cf;})[_0x21ee('0x25')](respondWithResult(_0x5775a8,null))[_0x21ee('0x44')](function(_0x30887c){var _0x26517d=_0x34b823[_0x21ee('0x32')]['test']?0x1f4:_0x30887c[_0x21ee('0xba')]||0x1f4;logger['error'](_0x30887c[_0x21ee('0x27')]);delete _0x30887c[_0x21ee('0x28')];if(_0x26517d===0x191){_0x26517d=0x190;}_0x5775a8[_0x21ee('0x1a')](_0x26517d)[_0x21ee('0x29')](_0x34b823['query'][_0x21ee('0xbb')]?{'message':_0x21ee('0xbc'),'statusCode':_0x30887c[_0x21ee('0xba')]}:_0x30887c);});};function getSelectList(_0x1462dd,_0x54f5b9,_0x3f991b,_0x4a0eb7,_0x20e012,_0x2c5bd4){var _0x56a4a2={'method':_0x21ee('0xa5'),'uri':_0x1462dd+'EntityDefinitions('+_0x4a0eb7+_0x21ee('0xbd')+_0x20e012+_0x21ee('0xbe')+_0x21ee('0xbf'),'headers':{'Authorization':_0x21ee('0xa2')+_0x2c5bd4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x56a4a2)['then'](function(_0x2052f0){var _0xd84450=[];var _0x4fd970=_0x2052f0['OptionSet'][_0x21ee('0xc0')];_0x4fd970[_0x21ee('0xb0')](function(_0x4c8302){_0xd84450[_0x21ee('0xac')]({'name':_0x4c8302[_0x21ee('0xc1')]['UserLocalizedLabel'][_0x21ee('0xc1')],'value':String(_0x4c8302[_0x21ee('0xc2')])});});var _0x11e574={'id':_0x54f5b9+'_'+_0x2052f0['LogicalName'],'name':_0x2052f0['DisplayName'][_0x21ee('0xc3')][_0x21ee('0xc1')],'custom':![],'options':_0xd84450};_0x3f991b[_0x21ee('0xac')](_0x11e574);return _0x3f991b;});}function getBooleanList(_0x2a429d,_0x30b3ab,_0x2f7e3c,_0x1d8ab9,_0x3a6cce,_0x489d30){var _0x483e8c={'method':_0x21ee('0xa5'),'uri':_0x2a429d+_0x21ee('0xa6')+_0x1d8ab9+_0x21ee('0xbd')+_0x3a6cce+_0x21ee('0xc4'),'headers':{'Authorization':_0x21ee('0xa2')+_0x489d30,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x483e8c)['then'](function(_0x30cd1f){var _0x4afe1b=[];_0x4afe1b[_0x21ee('0xac')]({'name':_0x30cd1f['OptionSet'][_0x21ee('0xc5')][_0x21ee('0xc1')][_0x21ee('0xc3')][_0x21ee('0xc1')],'value':'true'},{'name':_0x30cd1f[_0x21ee('0xc6')][_0x21ee('0xc7')][_0x21ee('0xc1')][_0x21ee('0xc3')][_0x21ee('0xc1')],'value':_0x21ee('0xc8')});var _0x29a49a={'id':_0x30b3ab+'_'+_0x30cd1f[_0x21ee('0xc9')],'name':_0x30cd1f['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x4afe1b};_0x2f7e3c[_0x21ee('0xac')](_0x29a49a);return _0x2f7e3c;});}function getInputList(_0x58dab8,_0x1806c1,_0x524b2b,_0x18a3f0,_0x134d9c,_0x41148f,_0x5d16f7){var _0x351f29={'method':'GET','uri':_0x58dab8+_0x21ee('0xa6')+_0x134d9c+_0x21ee('0xbd')+_0x41148f+_0x21ee('0xca')+_0x524b2b+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x21ee('0xa2')+_0x5d16f7,'If-None-Match':null,'OData-Version':_0x21ee('0xa3')},'json':!![]};return rp(_0x351f29)[_0x21ee('0x25')](function(_0x3f8fc8){var _0x3a02cd={'id':_0x1806c1+'_'+_0x3f8fc8[_0x21ee('0xc9')],'name':_0x3f8fc8[_0x21ee('0xcb')][_0x21ee('0xc3')]?_0x3f8fc8['DisplayName'][_0x21ee('0xc3')][_0x21ee('0xc1')]:_0x3f8fc8[_0x21ee('0xc9')],'custom':![],'options':[]};_0x18a3f0['push'](_0x3a02cd);return _0x18a3f0;});} \ No newline at end of file +var _0xecd5=['primarycontactidname','prioritycodename','productserialnumber','responseby','responsiblecontactidname','slainvokedidname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','username','password','remoteUri','tenantId','clientId','clientSecret','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','MetadataId','all','isNil','substring','BooleanAttributeMetadata','push','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','4.0','Options','Label','Value','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','TrueOption','true','false',')/Microsoft.Dynamics.CRM.','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','body','params','getConfigurations','findOne','Dynamics365Configuration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidyominame','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','influencescore','lastonholdtime','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','owneridname','owneridtype','owneridyominame','parentcaseidname'];(function(_0x4781e8,_0x1aa4f7){var _0x35d350=function(_0x3d2316){while(--_0x3d2316){_0x4781e8['push'](_0x4781e8['shift']());}};_0x35d350(++_0x1aa4f7);}(_0xecd5,0x110));var _0x5ecd=function(_0x17ea1b,_0x302c77){_0x17ea1b=_0x17ea1b-0x0;var _0x1ec141=_0xecd5[_0x17ea1b];return _0x1ec141;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ecd('0x0'));var zipdir=require(_0x5ecd('0x1'));var jsonpatch=require(_0x5ecd('0x2'));var rp=require('request-promise');var moment=require(_0x5ecd('0x3'));var BPromise=require(_0x5ecd('0x4'));var Mustache=require(_0x5ecd('0x5'));var util=require(_0x5ecd('0x6'));var path=require('path');var sox=require(_0x5ecd('0x7'));var csv=require('to-csv');var ejs=require(_0x5ecd('0x8'));var fs=require('fs');var fs_extra=require(_0x5ecd('0x9'));var _=require('lodash');var squel=require(_0x5ecd('0xa'));var crypto=require(_0x5ecd('0xb'));var jsforce=require(_0x5ecd('0xc'));var deskjs=require(_0x5ecd('0xd'));var toCsv=require(_0x5ecd('0xe'));var querystring=require(_0x5ecd('0xf'));var Papa=require(_0x5ecd('0x10'));var Redis=require(_0x5ecd('0x11'));var authService=require(_0x5ecd('0x12'));var qs=require(_0x5ecd('0x13'));var as=require(_0x5ecd('0x14'));var hardwareService=require(_0x5ecd('0x15'));var logger=require('../../config/logger')(_0x5ecd('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5ecd('0x17'));var db=require(_0x5ecd('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4fc1ec,_0x3eaad7){_0x3eaad7=_0x3eaad7||0xcc;return function(_0x2106a0){if(_0x2106a0){return _0x4fc1ec[_0x5ecd('0x19')](_0x3eaad7);}return _0x4fc1ec[_0x5ecd('0x1a')](_0x3eaad7)['end']();};}function respondWithResult(_0x3b918c,_0x3b54f1){_0x3b54f1=_0x3b54f1||0xc8;return function(_0x50e11c){if(_0x50e11c){return _0x3b918c[_0x5ecd('0x1a')](_0x3b54f1)[_0x5ecd('0x1b')](_0x50e11c);}};}function respondWithFilteredResult(_0x48442a,_0x458899){return function(_0x4a0e19){if(_0x4a0e19){var _0x308374=typeof _0x458899[_0x5ecd('0x1c')]===_0x5ecd('0x1d')&&typeof _0x458899[_0x5ecd('0x1e')]===_0x5ecd('0x1d');var _0x423ae8=_0x4a0e19[_0x5ecd('0x1f')];var _0x189c3b=_0x308374?0x0:_0x458899[_0x5ecd('0x1c')];var _0x1f7309=_0x308374?_0x4a0e19[_0x5ecd('0x1f')]:_0x458899[_0x5ecd('0x1c')]+_0x458899['limit'];var _0x249988;if(_0x1f7309>=_0x423ae8){_0x1f7309=_0x423ae8;_0x249988=0xc8;}else{_0x249988=0xce;}_0x48442a[_0x5ecd('0x1a')](_0x249988);return _0x48442a[_0x5ecd('0x20')](_0x5ecd('0x21'),_0x189c3b+'-'+_0x1f7309+'/'+_0x423ae8)[_0x5ecd('0x1b')](_0x4a0e19);}return null;};}function patchUpdates(_0x5e7d1f){return function(_0x17d9a4){try{jsonpatch['apply'](_0x17d9a4,_0x5e7d1f,!![]);}catch(_0x450669){return BPromise[_0x5ecd('0x22')](_0x450669);}return _0x17d9a4[_0x5ecd('0x23')]();};}function saveUpdates(_0x3c8e2b,_0x31a6d9){return function(_0x4becfd){if(_0x4becfd){return _0x4becfd[_0x5ecd('0x24')](_0x3c8e2b)[_0x5ecd('0x25')](function(_0x1d9161){return _0x1d9161;});}return null;};}function removeEntity(_0x57168b,_0xe80905){return function(_0x2dd9f0){if(_0x2dd9f0){return _0x2dd9f0[_0x5ecd('0x26')]()[_0x5ecd('0x25')](function(){_0x57168b[_0x5ecd('0x1a')](0xcc)[_0x5ecd('0x27')]();});}};}function handleEntityNotFound(_0x3d0086,_0x14b07b){return function(_0x57ae4c){if(!_0x57ae4c){_0x3d0086[_0x5ecd('0x19')](0x194);}return _0x57ae4c;};}function handleError(_0x5ae414,_0x12a109){_0x12a109=_0x12a109||0x1f4;return function(_0x36d964){logger[_0x5ecd('0x28')](_0x36d964[_0x5ecd('0x29')]);if(_0x36d964[_0x5ecd('0x2a')]){delete _0x36d964['name'];}_0x5ae414[_0x5ecd('0x1a')](_0x12a109)[_0x5ecd('0x2b')](_0x36d964);};}exports[_0x5ecd('0x2c')]=function(_0x38c87d,_0x389b88){var _0x1c3eb8={},_0xbc27b4={},_0x2ccc01={'count':0x0,'rows':[]};var _0x253b1b=_[_0x5ecd('0x2d')](db[_0x5ecd('0x2e')][_0x5ecd('0x2f')],function(_0x209551){return{'name':_0x209551[_0x5ecd('0x30')],'type':_0x209551[_0x5ecd('0x31')][_0x5ecd('0x32')]};});_0xbc27b4[_0x5ecd('0x33')]=_['map'](_0x253b1b,_0x5ecd('0x2a'));_0xbc27b4[_0x5ecd('0x34')]=_[_0x5ecd('0x35')](_0x38c87d[_0x5ecd('0x34')]);_0xbc27b4[_0x5ecd('0x36')]=_['intersection'](_0xbc27b4[_0x5ecd('0x33')],_0xbc27b4[_0x5ecd('0x34')]);_0x1c3eb8[_0x5ecd('0x37')]=_[_0x5ecd('0x38')](_0xbc27b4[_0x5ecd('0x33')],qs['fields'](_0x38c87d[_0x5ecd('0x34')][_0x5ecd('0x39')]));_0x1c3eb8[_0x5ecd('0x37')]=_0x1c3eb8['attributes'][_0x5ecd('0x3a')]?_0x1c3eb8[_0x5ecd('0x37')]:_0xbc27b4[_0x5ecd('0x33')];if(!_0x38c87d[_0x5ecd('0x34')][_0x5ecd('0x3b')](_0x5ecd('0x3c'))){_0x1c3eb8['limit']=qs[_0x5ecd('0x1e')](_0x38c87d['query']['limit']);_0x1c3eb8[_0x5ecd('0x1c')]=qs[_0x5ecd('0x1c')](_0x38c87d[_0x5ecd('0x34')][_0x5ecd('0x1c')]);}_0x1c3eb8[_0x5ecd('0x3d')]=qs[_0x5ecd('0x3e')](_0x38c87d['query']['sort']);_0x1c3eb8[_0x5ecd('0x3f')]=qs[_0x5ecd('0x36')](_[_0x5ecd('0x40')](_0x38c87d[_0x5ecd('0x34')],_0xbc27b4[_0x5ecd('0x36')]),_0x253b1b);if(_0x38c87d[_0x5ecd('0x34')][_0x5ecd('0x41')]){_0x1c3eb8['where']=_[_0x5ecd('0x42')](_0x1c3eb8[_0x5ecd('0x3f')],{'$or':_[_0x5ecd('0x2d')](_0x253b1b,function(_0x5f3c24){if(_0x5f3c24[_0x5ecd('0x31')]!==_0x5ecd('0x43')){var _0x1683cc={};_0x1683cc[_0x5f3c24['name']]={'$like':'%'+_0x38c87d['query']['filter']+'%'};return _0x1683cc;}})});}_0x1c3eb8=_[_0x5ecd('0x42')]({},_0x1c3eb8,_0x38c87d['options']);var _0x84853e={'where':_0x1c3eb8[_0x5ecd('0x3f')]};return db['Dynamics365Account'][_0x5ecd('0x1f')](_0x84853e)[_0x5ecd('0x25')](function(_0x1c6550){_0x2ccc01['count']=_0x1c6550;if(_0x38c87d[_0x5ecd('0x34')][_0x5ecd('0x44')]){_0x1c3eb8[_0x5ecd('0x45')]=[{'all':!![]}];}return db[_0x5ecd('0x2e')][_0x5ecd('0x46')](_0x1c3eb8);})['then'](function(_0x129eed){_0x2ccc01[_0x5ecd('0x47')]=_0x129eed;return _0x2ccc01;})['then'](respondWithFilteredResult(_0x389b88,_0x1c3eb8))['catch'](handleError(_0x389b88,null));};exports[_0x5ecd('0x48')]=function(_0x2a48b4,_0x4691bb){var _0x4ba58b={'raw':![],'where':{'id':_0x2a48b4['params']['id']}},_0x1c90ac={};_0x1c90ac[_0x5ecd('0x33')]=_['keys'](db['Dynamics365Account']['rawAttributes']);_0x1c90ac[_0x5ecd('0x34')]=_[_0x5ecd('0x35')](_0x2a48b4[_0x5ecd('0x34')]);_0x1c90ac['filters']=_['intersection'](_0x1c90ac[_0x5ecd('0x33')],_0x1c90ac['query']);_0x4ba58b[_0x5ecd('0x37')]=_[_0x5ecd('0x38')](_0x1c90ac[_0x5ecd('0x33')],qs['fields'](_0x2a48b4['query']['fields']));_0x4ba58b['attributes']=_0x4ba58b[_0x5ecd('0x37')]['length']?_0x4ba58b['attributes']:_0x1c90ac[_0x5ecd('0x33')];if(_0x2a48b4[_0x5ecd('0x34')]['includeAll']){_0x4ba58b[_0x5ecd('0x45')]=[{'all':!![]}];}_0x4ba58b=_[_0x5ecd('0x42')]({},_0x4ba58b,_0x2a48b4[_0x5ecd('0x49')]);return db['Dynamics365Account'][_0x5ecd('0x4a')](_0x4ba58b)[_0x5ecd('0x25')](handleEntityNotFound(_0x4691bb,null))[_0x5ecd('0x25')](respondWithResult(_0x4691bb,null))[_0x5ecd('0x4b')](handleError(_0x4691bb,null));};exports[_0x5ecd('0x4c')]=function(_0x3e6504,_0x2cf571){return db[_0x5ecd('0x2e')][_0x5ecd('0x4c')](_0x3e6504['body'],{})[_0x5ecd('0x25')](respondWithResult(_0x2cf571,0xc9))[_0x5ecd('0x4b')](handleError(_0x2cf571,null));};exports[_0x5ecd('0x24')]=function(_0x35b68e,_0x926519){if(_0x35b68e[_0x5ecd('0x4d')]['id']){delete _0x35b68e[_0x5ecd('0x4d')]['id'];}return db[_0x5ecd('0x2e')]['find']({'where':{'id':_0x35b68e[_0x5ecd('0x4e')]['id']}})[_0x5ecd('0x25')](handleEntityNotFound(_0x926519,null))['then'](saveUpdates(_0x35b68e[_0x5ecd('0x4d')],null))[_0x5ecd('0x25')](respondWithResult(_0x926519,null))['catch'](handleError(_0x926519,null));};exports[_0x5ecd('0x26')]=function(_0x3dce65,_0x3e1088){return db['Dynamics365Account'][_0x5ecd('0x4a')]({'where':{'id':_0x3dce65[_0x5ecd('0x4e')]['id']}})[_0x5ecd('0x25')](handleEntityNotFound(_0x3e1088,null))[_0x5ecd('0x25')](removeEntity(_0x3e1088,null))['catch'](handleError(_0x3e1088,null));};exports[_0x5ecd('0x4f')]=function(_0x526377,_0x296446,_0x1d8827){var _0x3bf8a6={};var _0x2d932b={};var _0x7ae83a;var _0x4ee23d;return db[_0x5ecd('0x2e')][_0x5ecd('0x50')]({'where':{'id':_0x526377[_0x5ecd('0x4e')]['id']}})[_0x5ecd('0x25')](handleEntityNotFound(_0x296446,null))[_0x5ecd('0x25')](function(_0x3ee671){if(_0x3ee671){_0x7ae83a=_0x3ee671;_0x2d932b[_0x5ecd('0x33')]=_['keys'](db[_0x5ecd('0x51')]['rawAttributes']);_0x2d932b[_0x5ecd('0x34')]=_[_0x5ecd('0x35')](_0x526377[_0x5ecd('0x34')]);_0x2d932b[_0x5ecd('0x36')]=_['intersection'](_0x2d932b[_0x5ecd('0x33')],_0x2d932b[_0x5ecd('0x34')]);_0x3bf8a6[_0x5ecd('0x37')]=_[_0x5ecd('0x38')](_0x2d932b[_0x5ecd('0x33')],qs[_0x5ecd('0x39')](_0x526377[_0x5ecd('0x34')][_0x5ecd('0x39')]));_0x3bf8a6[_0x5ecd('0x37')]=_0x3bf8a6[_0x5ecd('0x37')]['length']?_0x3bf8a6['attributes']:_0x2d932b[_0x5ecd('0x33')];_0x3bf8a6['order']=qs[_0x5ecd('0x3e')](_0x526377[_0x5ecd('0x34')]['sort']);_0x3bf8a6[_0x5ecd('0x3f')]=qs[_0x5ecd('0x36')](_['pick'](_0x526377['query'],_0x2d932b[_0x5ecd('0x36')]));if(_0x526377['query'][_0x5ecd('0x41')]){_0x3bf8a6[_0x5ecd('0x3f')]=_[_0x5ecd('0x42')](_0x3bf8a6[_0x5ecd('0x3f')],{'$or':_[_0x5ecd('0x2d')](_0x3bf8a6[_0x5ecd('0x37')],function(_0x126044){var _0x7728cd={};_0x7728cd[_0x126044]={'$like':'%'+_0x526377['query'][_0x5ecd('0x41')]+'%'};return _0x7728cd;})});}_0x3bf8a6=_[_0x5ecd('0x42')]({},_0x3bf8a6,_0x526377[_0x5ecd('0x49')]);return _0x7ae83a[_0x5ecd('0x4f')](_0x3bf8a6);}})[_0x5ecd('0x25')](function(_0x3216fb){if(_0x3216fb){_0x4ee23d=_0x3216fb[_0x5ecd('0x3a')];if(!_0x526377[_0x5ecd('0x34')][_0x5ecd('0x3b')](_0x5ecd('0x3c'))){_0x3bf8a6[_0x5ecd('0x1e')]=qs[_0x5ecd('0x1e')](_0x526377[_0x5ecd('0x34')][_0x5ecd('0x1e')]);_0x3bf8a6[_0x5ecd('0x1c')]=qs[_0x5ecd('0x1c')](_0x526377[_0x5ecd('0x34')][_0x5ecd('0x1c')]);}return _0x7ae83a[_0x5ecd('0x4f')](_0x3bf8a6);}})[_0x5ecd('0x25')](function(_0x4b8a5e){if(_0x4b8a5e){return _0x4b8a5e?{'count':_0x4ee23d,'rows':_0x4b8a5e}:null;}})[_0x5ecd('0x25')](respondWithResult(_0x296446,null))['catch'](handleError(_0x296446,null));};exports['addConfiguration']=function(_0x109855,_0x103ed8,_0x6976c4){if(_0x109855['body']['id']){delete _0x109855[_0x5ecd('0x4d')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x109855[_0x5ecd('0x4e')]['id']}})[_0x5ecd('0x25')](handleEntityNotFound(_0x103ed8,null))['then'](function(_0x41f6b6){if(_0x41f6b6){_0x109855['body'][_0x5ecd('0x52')]=_0x41f6b6['id'];_0x109855[_0x5ecd('0x4d')][_0x5ecd('0x53')]=integrations[_0x5ecd('0x54')](_0x109855[_0x5ecd('0x4d')][_0x5ecd('0x55')],_0x109855[_0x5ecd('0x4d')]['type']);_0x109855[_0x5ecd('0x4d')][_0x5ecd('0x56')]=integrations[_0x5ecd('0x57')](_0x109855[_0x5ecd('0x4d')][_0x5ecd('0x55')],_0x109855[_0x5ecd('0x4d')][_0x5ecd('0x31')]);return db[_0x5ecd('0x51')][_0x5ecd('0x4c')](_0x109855['body'],{'include':[{'model':db[_0x5ecd('0x58')],'as':_0x5ecd('0x53')},{'model':db['Dynamics365Field'],'as':_0x5ecd('0x56')}]});}return null;})[_0x5ecd('0x25')](respondWithResult(_0x103ed8,null))[_0x5ecd('0x4b')](handleError(_0x103ed8,null));};exports[_0x5ecd('0x59')]=function(_0x221444,_0x72aae1,_0x265d64){var _0x2f673e=_0x221444['query']['ticketType'];var _0x318ece=_0x2f673e===_0x5ecd('0x5a')?_0x5ecd('0x5b'):_0x5ecd('0x5c');var _0x3ee317='';var _0x260683='';var _0xacf40a='';var _0x52c4f0='';var _0x4ef1a4='';var _0x1bdfbc='';var _0x488dea='';var _0x396634='';var _0x341bca=[_0x5ecd('0x5d'),_0x5ecd('0x5e'),_0x5ecd('0x5f'),_0x5ecd('0x60'),_0x5ecd('0x61'),'subject',_0x5ecd('0x62'),_0x5ecd('0x63'),_0x5ecd('0x64'),_0x5ecd('0x65')];var _0x46a40a=['accountidname',_0x5ecd('0x66'),'actualserviceunits',_0x5ecd('0x67'),_0x5ecd('0x68'),'contactidyominame',_0x5ecd('0x69'),_0x5ecd('0x6a'),_0x5ecd('0x6b'),'createdbyexternalpartyyominame',_0x5ecd('0x6c'),_0x5ecd('0x6d'),_0x5ecd('0x6e'),_0x5ecd('0x6f'),_0x5ecd('0x70'),_0x5ecd('0x71'),_0x5ecd('0x72'),'customeridyominame',_0x5ecd('0x73'),'entitlementidname','entityimage_timestamp',_0x5ecd('0x74'),_0x5ecd('0x75'),_0x5ecd('0x76'),_0x5ecd('0x77'),'followupby','importsequencenumber',_0x5ecd('0x78'),'kbarticleidname',_0x5ecd('0x79'),'masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname',_0x5ecd('0x7a'),_0x5ecd('0x7b'),'modifiedonbehalfbyname',_0x5ecd('0x7c'),_0x5ecd('0x7d'),_0x5ecd('0x7e'),_0x5ecd('0x7f'),'onholdtime','overriddencreatedon',_0x5ecd('0x80'),_0x5ecd('0x81'),_0x5ecd('0x82'),_0x5ecd('0x83'),_0x5ecd('0x84'),'primarycontactidyominame',_0x5ecd('0x85'),'productidname',_0x5ecd('0x86'),'resolveby','resolvebykpiidname',_0x5ecd('0x87'),_0x5ecd('0x88'),'responsiblecontactidyominame','sentimentvalue',_0x5ecd('0x89'),'slaname',_0x5ecd('0x8a'),'statecode',_0x5ecd('0x8b'),_0x5ecd('0x8c'),_0x5ecd('0x8d'),_0x5ecd('0x8e'),_0x5ecd('0x8f'),_0x5ecd('0x90'),'utcconversiontimezonecode','versionnumber'];var _0x515936=_0x341bca['concat'](_0x46a40a);return db[_0x5ecd('0x2e')][_0x5ecd('0x50')]({'where':{'id':_0x221444['params']['id']},'attributes':['id',_0x5ecd('0x91'),_0x5ecd('0x92'),_0x5ecd('0x93'),_0x5ecd('0x94'),_0x5ecd('0x95'),_0x5ecd('0x96')]})['then'](handleEntityNotFound(_0x72aae1,null))[_0x5ecd('0x25')](function(_0x44effe){if(_0x44effe){_0x396634=_0x44effe['remoteUri'];var _0x3f7d05=_0x396634['slice'](-0x1);if(_0x3f7d05==='/'){_0x396634=_0x396634['substring'](0x0,_0x396634[_0x5ecd('0x97')](_0x3f7d05));}_0x488dea=util[_0x5ecd('0x98')](_0x5ecd('0x99'),_0x396634);var _0x5819a9={'method':_0x5ecd('0x9a'),'uri':_0x5ecd('0x9b')+_0x44effe[_0x5ecd('0x94')]+_0x5ecd('0x9c'),'form':{'client_id':_0x44effe['clientId'],'resource':_0x396634,'username':_0x44effe[_0x5ecd('0x91')],'password':_0x44effe[_0x5ecd('0x92')],'grant_type':'password','client_secret':_0x44effe['clientSecret']},'json':!![]};return rp(_0x5819a9);}})[_0x5ecd('0x25')](function(_0x54c57d){_0x1bdfbc=_0x54c57d[_0x5ecd('0x9d')];var _0xd71428={'method':_0x5ecd('0x9e'),'uri':encodeURI(_0x488dea+_0x5ecd('0x9f')+_0x318ece+'\x27'),'headers':{'Authorization':_0x5ecd('0xa0')+_0x1bdfbc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0xd71428);})['then'](function(_0x65338b){var _0x47d81a=_0x65338b['value'][0x0];var _0x30b67b=_0x47d81a['MetadataId'];var _0x3519d7={'method':_0x5ecd('0x9e'),'uri':_0x488dea+_0x5ecd('0xa1')+_0x30b67b+_0x5ecd('0xa2'),'headers':{'Authorization':_0x5ecd('0xa0')+_0x1bdfbc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3519d7);})[_0x5ecd('0x25')](function(_0x2f4e9b){_0x3ee317=_0x2f4e9b;_0x260683=_0x3ee317['Attributes'];_0x260683=_[_0x5ecd('0xa3')](_0x260683,function(_0x199ad7){return!_0x515936[_0x5ecd('0xa4')](_0x199ad7[_0x5ecd('0xa5')]);});var _0x47cbcf=[];var _0x2534d4=[];_0x260683[_0x5ecd('0xa6')](function(_0x34eb72){if(_0x34eb72[_0x5ecd('0xa7')]){var _0x314b46=_0x34eb72[_0x5ecd('0xa7')]['substring'](_0x34eb72['@odata.type'][_0x5ecd('0x97')]('.')+0x1);if(_0x314b46===_0x5ecd('0xa8')){_0x47cbcf['push'](getSelectList(_0x488dea,_0x2f673e,_0x2534d4,_0x3ee317[_0x5ecd('0xa9')],_0x34eb72[_0x5ecd('0xa9')],_0x1bdfbc));}}});return Promise[_0x5ecd('0xaa')](_0x47cbcf);})[_0x5ecd('0x25')](function(_0x5acea2){_0xacf40a=_0x5acea2[0x0];var _0xd1f075=[];var _0x5df195=[];_0x260683[_0x5ecd('0xa6')](function(_0x3ccf74){if(!_[_0x5ecd('0xab')](_0x3ccf74['@odata.type'])){var _0x91e75f=_0x3ccf74[_0x5ecd('0xa7')][_0x5ecd('0xac')](_0x3ccf74[_0x5ecd('0xa7')][_0x5ecd('0x97')]('.')+0x1);if(_0x91e75f===_0x5ecd('0xad')){_0xd1f075[_0x5ecd('0xae')](getBooleanList(_0x488dea,_0x2f673e,_0x5df195,_0x3ee317[_0x5ecd('0xa9')],_0x3ccf74['MetadataId'],_0x1bdfbc));}}});return Promise[_0x5ecd('0xaa')](_0xd1f075);})['then'](function(_0x5ba799){_0x52c4f0=_0x5ba799[0x0];var _0x5c4422=[];var _0x6271c3=[];_0x260683[_0x5ecd('0xa6')](function(_0xb8e902){if(_0xb8e902[_0x5ecd('0xa7')]){var _0x246ada=_0xb8e902[_0x5ecd('0xa7')][_0x5ecd('0xac')](_0xb8e902['@odata.type'][_0x5ecd('0x97')]('.')+0x1);if(_0x246ada===_0x5ecd('0xaf')||_0x246ada===_0x5ecd('0xb0')||_0x246ada===_0x5ecd('0xb1')||_0x246ada===_0x5ecd('0xb2')||_0x246ada==='MemoAttributeMetadata'||_0x246ada==='DateTimeAttributeMetadata'||_0x246ada===_0x5ecd('0xb3')||_0x246ada===_0x5ecd('0xb4')||_0x246ada===_0x5ecd('0xb5')||_0x246ada===_0x5ecd('0xb6')){_0x5c4422[_0x5ecd('0xae')](getInputList(_0x488dea,_0x2f673e,_0x246ada,_0x6271c3,_0x3ee317[_0x5ecd('0xa9')],_0xb8e902[_0x5ecd('0xa9')],_0x1bdfbc));}}});return Promise[_0x5ecd('0xaa')](_0x5c4422);})[_0x5ecd('0x25')](function(_0x3ee224){_0x4ef1a4=_0x3ee224[0x0];var _0x6ecade=_0xacf40a['concat'](_0x52c4f0)[_0x5ecd('0xb7')](_0x4ef1a4);var _0x38e32d={'count':_0x6ecade[_0x5ecd('0x3a')],'rows':_0x6ecade};return _0x38e32d;})[_0x5ecd('0x25')](respondWithResult(_0x72aae1,null))[_0x5ecd('0x4b')](function(_0x152522){var _0x298b5b=_0x221444[_0x5ecd('0x34')][_0x5ecd('0xb8')]?0x1f4:_0x152522[_0x5ecd('0xb9')]||0x1f4;logger[_0x5ecd('0x28')](_0x152522[_0x5ecd('0x29')]);delete _0x152522[_0x5ecd('0x2a')];if(_0x298b5b===0x191){_0x298b5b=0x190;}_0x72aae1[_0x5ecd('0x1a')](_0x298b5b)[_0x5ecd('0x2b')](_0x221444[_0x5ecd('0x34')][_0x5ecd('0xb8')]?{'message':_0x5ecd('0xba'),'statusCode':_0x152522[_0x5ecd('0xb9')]}:_0x152522);});};function getSelectList(_0x1d3103,_0x57e9bc,_0x552972,_0x349b30,_0x75c19e,_0x4b574d){var _0x3a6751={'method':_0x5ecd('0x9e'),'uri':_0x1d3103+_0x5ecd('0xa1')+_0x349b30+_0x5ecd('0xbb')+_0x75c19e+_0x5ecd('0xbc')+_0x5ecd('0xbd'),'headers':{'Authorization':_0x5ecd('0xa0')+_0x4b574d,'If-None-Match':null,'OData-Version':_0x5ecd('0xbe')},'json':!![]};return rp(_0x3a6751)[_0x5ecd('0x25')](function(_0x364d72){var _0x2fddfe=[];var _0x4dcf36=_0x364d72['OptionSet'][_0x5ecd('0xbf')];_0x4dcf36[_0x5ecd('0xa6')](function(_0x442a5e){_0x2fddfe[_0x5ecd('0xae')]({'name':_0x442a5e[_0x5ecd('0xc0')]['UserLocalizedLabel'][_0x5ecd('0xc0')],'value':String(_0x442a5e[_0x5ecd('0xc1')])});});var _0x5f3134={'id':_0x57e9bc+'_'+_0x364d72[_0x5ecd('0xa5')],'name':_0x364d72[_0x5ecd('0xc2')][_0x5ecd('0xc3')][_0x5ecd('0xc0')],'custom':![],'options':_0x2fddfe};_0x552972[_0x5ecd('0xae')](_0x5f3134);return _0x552972;});}function getBooleanList(_0x32ab23,_0x1484c0,_0xc99a45,_0x5a5474,_0x3c28bd,_0x7769f2){var _0x252bc7={'method':_0x5ecd('0x9e'),'uri':_0x32ab23+_0x5ecd('0xa1')+_0x5a5474+')/Attributes('+_0x3c28bd+_0x5ecd('0xc4'),'headers':{'Authorization':'Bearer\x20'+_0x7769f2,'If-None-Match':null,'OData-Version':_0x5ecd('0xbe')},'json':!![]};return rp(_0x252bc7)['then'](function(_0x2417e7){var _0x275ac3=[];_0x275ac3[_0x5ecd('0xae')]({'name':_0x2417e7[_0x5ecd('0xc5')][_0x5ecd('0xc6')][_0x5ecd('0xc0')][_0x5ecd('0xc3')][_0x5ecd('0xc0')],'value':_0x5ecd('0xc7')},{'name':_0x2417e7[_0x5ecd('0xc5')]['FalseOption'][_0x5ecd('0xc0')][_0x5ecd('0xc3')][_0x5ecd('0xc0')],'value':_0x5ecd('0xc8')});var _0x14cf5b={'id':_0x1484c0+'_'+_0x2417e7[_0x5ecd('0xa5')],'name':_0x2417e7[_0x5ecd('0xc2')][_0x5ecd('0xc3')]['Label'],'custom':![],'options':_0x275ac3};_0xc99a45['push'](_0x14cf5b);return _0xc99a45;});}function getInputList(_0x37a414,_0x4f1767,_0x1a5238,_0x357eb7,_0x200d55,_0x3334af,_0x39f556){var _0x26ec24={'method':_0x5ecd('0x9e'),'uri':_0x37a414+_0x5ecd('0xa1')+_0x200d55+_0x5ecd('0xbb')+_0x3334af+_0x5ecd('0xc9')+_0x1a5238+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x5ecd('0xa0')+_0x39f556,'If-None-Match':null,'OData-Version':_0x5ecd('0xbe')},'json':!![]};return rp(_0x26ec24)[_0x5ecd('0x25')](function(_0x3b95ae){var _0x3f9eb6={'id':_0x4f1767+'_'+_0x3b95ae[_0x5ecd('0xa5')],'name':_0x3b95ae['DisplayName'][_0x5ecd('0xc3')]?_0x3b95ae[_0x5ecd('0xc2')][_0x5ecd('0xc3')][_0x5ecd('0xc0')]:_0x3b95ae[_0x5ecd('0xa5')],'custom':![],'options':[]};_0x357eb7[_0x5ecd('0xae')](_0x3f9eb6);return _0x357eb7;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index e5a6b98..a013837 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(_0x14ef75,_0x4f0a30){var _0x148011=function(_0x26f932){while(--_0x26f932){_0x14ef75['push'](_0x14ef75['shift']());}};_0x148011(++_0x4f0a30);}(_0xe706,0xa3));var _0x6e70=function(_0x86a8fa,_0x323e96){_0x86a8fa=_0x86a8fa-0x0;var _0x551384=_0xe706[_0x86a8fa];return _0x551384;};'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(_0x253fa3,_0x547fed){var _0xf01923=function(_0x5dbcd6){while(--_0x5dbcd6){_0x253fa3['push'](_0x253fa3['shift']());}};_0xf01923(++_0x547fed);}(_0xe706,0xa3));var _0x6e70=function(_0x24bcc4,_0x226525){_0x24bcc4=_0x24bcc4-0x0;var _0x2e6411=_0xe706[_0x24bcc4];return _0x2e6411;};'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 b803a76..d8585fe 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 _0x1096=['message','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','Dynamics365Account','find','ShowDynamics365Account','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Dynamics365Account,\x20%s,\x20%s'];(function(_0x345850,_0x3e2d7f){var _0x11bc00=function(_0x509ed8){while(--_0x509ed8){_0x345850['push'](_0x345850['shift']());}};_0x11bc00(++_0x3e2d7f);}(_0x1096,0x7f));var _0x6109=function(_0x566fc2,_0x229de0){_0x566fc2=_0x566fc2-0x0;var _0x36e4c6=_0x1096[_0x566fc2];return _0x36e4c6;};'use strict';var _=require(_0x6109('0x0'));var util=require(_0x6109('0x1'));var moment=require(_0x6109('0x2'));var BPromise=require(_0x6109('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6109('0x4'));var db=require(_0x6109('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6109('0x6'))(_0x6109('0x7'));var config=require(_0x6109('0x8'));var jayson=require(_0x6109('0x9'));var client=jayson[_0x6109('0xa')][_0x6109('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5928de,_0x12311c,_0x5941c0){return new BPromise(function(_0x3f0780,_0x78f88a){return client['request'](_0x5928de,_0x5941c0)[_0x6109('0xc')](function(_0x51fcf7){logger[_0x6109('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x12311c,'request\x20sent');logger[_0x6109('0xe')](_0x6109('0xf'),_0x12311c,_0x6109('0x10'),JSON[_0x6109('0x11')](_0x51fcf7));if(_0x51fcf7['error']){if(_0x51fcf7['error'][_0x6109('0x12')]===0x1f4){logger[_0x6109('0x13')](_0x6109('0x14'),_0x12311c,_0x51fcf7['error'][_0x6109('0x15')]);return _0x78f88a(_0x51fcf7[_0x6109('0x13')][_0x6109('0x15')]);}logger[_0x6109('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x12311c,_0x51fcf7[_0x6109('0x13')][_0x6109('0x15')]);return _0x3f0780(_0x51fcf7['error']['message']);}else{logger['info'](_0x6109('0x14'),_0x12311c,_0x6109('0x10'));_0x3f0780(_0x51fcf7[_0x6109('0x16')][_0x6109('0x15')]);}})[_0x6109('0x17')](function(_0x65273c){logger[_0x6109('0x13')](_0x6109('0x14'),_0x12311c,_0x65273c);_0x78f88a(_0x65273c);});});}exports[_0x6109('0x18')]=function(_0x551ba6){var _0x2f1327=this;return new Promise(function(_0x6c1531,_0x57a533){return db['Dynamics365Account'][_0x6109('0x19')]({'raw':_0x551ba6['options']?_0x551ba6[_0x6109('0x1a')][_0x6109('0x1b')]===undefined?!![]:![]:!![],'where':_0x551ba6[_0x6109('0x1a')]?_0x551ba6['options'][_0x6109('0x1c')]||null:null,'attributes':_0x551ba6[_0x6109('0x1a')]?_0x551ba6['options'][_0x6109('0x1d')]||null:null,'limit':_0x551ba6[_0x6109('0x1a')]?_0x551ba6[_0x6109('0x1a')][_0x6109('0x1e')]||null:null,'include':_0x551ba6[_0x6109('0x1a')]?_0x551ba6['options']['include']?_[_0x6109('0x1f')](_0x551ba6['options'][_0x6109('0x20')],function(_0x5d468f){return{'model':db[_0x5d468f[_0x6109('0x21')]],'as':_0x5d468f['as'],'attributes':_0x5d468f['attributes'],'include':_0x5d468f['include']?_[_0x6109('0x1f')](_0x5d468f['include'],function(_0x2a32a1){return{'model':db[_0x2a32a1[_0x6109('0x21')]],'as':_0x2a32a1['as'],'attributes':_0x2a32a1['attributes'],'include':_0x2a32a1[_0x6109('0x20')]?_[_0x6109('0x1f')](_0x2a32a1[_0x6109('0x20')],function(_0x7406ab){return{'model':db[_0x7406ab[_0x6109('0x21')]],'as':_0x7406ab['as'],'attributes':_0x7406ab[_0x6109('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x6109('0xc')](function(_0xa41751){logger[_0x6109('0xd')](_0x6109('0x18'),_0x551ba6);logger[_0x6109('0xe')](_0x6109('0x18'),_0x551ba6,JSON[_0x6109('0x11')](_0xa41751));_0x6c1531(_0xa41751);})[_0x6109('0x17')](function(_0x259531){logger['error'](_0x6109('0x18'),_0x259531[_0x6109('0x15')],_0x551ba6);_0x57a533(_0x2f1327[_0x6109('0x13')](0x1f4,_0x259531[_0x6109('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x14bc0a){var _0x1973f2=this;return new Promise(function(_0x25b5ce,_0x6c07ec){return db[_0x6109('0x22')][_0x6109('0x23')]({'raw':_0x14bc0a[_0x6109('0x1a')]?_0x14bc0a[_0x6109('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x14bc0a[_0x6109('0x1a')]?_0x14bc0a['options'][_0x6109('0x1c')]||null:null,'attributes':_0x14bc0a[_0x6109('0x1a')]?_0x14bc0a[_0x6109('0x1a')][_0x6109('0x1d')]||null:null,'include':_0x14bc0a[_0x6109('0x1a')]?_0x14bc0a[_0x6109('0x1a')][_0x6109('0x20')]?_[_0x6109('0x1f')](_0x14bc0a[_0x6109('0x1a')]['include'],function(_0x4535e6){return{'model':db[_0x4535e6['model']],'as':_0x4535e6['as'],'attributes':_0x4535e6['attributes'],'include':_0x4535e6[_0x6109('0x20')]?_[_0x6109('0x1f')](_0x4535e6[_0x6109('0x20')],function(_0x1f3004){return{'model':db[_0x1f3004['model']],'as':_0x1f3004['as'],'attributes':_0x1f3004['attributes'],'include':_0x1f3004[_0x6109('0x20')]?_['map'](_0x1f3004[_0x6109('0x20')],function(_0x4c3b2f){return{'model':db[_0x4c3b2f[_0x6109('0x21')]],'as':_0x4c3b2f['as'],'attributes':_0x4c3b2f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6109('0xc')](function(_0x21b11c){logger['info'](_0x6109('0x24'),_0x14bc0a);logger[_0x6109('0xe')](_0x6109('0x24'),_0x14bc0a,JSON[_0x6109('0x11')](_0x21b11c));_0x25b5ce(_0x21b11c);})['catch'](function(_0x564f14){logger[_0x6109('0x13')](_0x6109('0x24'),_0x564f14[_0x6109('0x15')],_0x14bc0a);_0x6c07ec(_0x1973f2[_0x6109('0x13')](0x1f4,_0x564f14[_0x6109('0x15')]));});});}; \ No newline at end of file +var _0xe36e=['request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','GetDynamics365Account','Dynamics365Account','options','raw','where','attributes','limit','include','map','model','catch','find','ShowDynamics365Account','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x1e3aa4,_0x207bd0){var _0x218cdd=function(_0x40861b){while(--_0x40861b){_0x1e3aa4['push'](_0x1e3aa4['shift']());}};_0x218cdd(++_0x207bd0);}(_0xe36e,0x126));var _0xee36=function(_0x569b58,_0x35b85a){_0x569b58=_0x569b58-0x0;var _0x20cb62=_0xe36e[_0x569b58];return _0x20cb62;};'use strict';var _=require(_0xee36('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee36('0x1'));var rs=require(_0xee36('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xee36('0x3'))['db'];var utils=require(_0xee36('0x4'));var logger=require('../../config/logger')(_0xee36('0x5'));var config=require(_0xee36('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xee36('0x7')][_0xee36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2279f1,_0x3bf3c2,_0x20418a){return new BPromise(function(_0x29de52,_0x3ae17d){return client[_0xee36('0x9')](_0x2279f1,_0x20418a)[_0xee36('0xa')](function(_0x1ebb22){logger[_0xee36('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x3bf3c2,_0xee36('0xc'));logger[_0xee36('0xd')](_0xee36('0xe'),_0x3bf3c2,'request\x20sent',JSON[_0xee36('0xf')](_0x1ebb22));if(_0x1ebb22['error']){if(_0x1ebb22[_0xee36('0x10')][_0xee36('0x11')]===0x1f4){logger[_0xee36('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x3bf3c2,_0x1ebb22[_0xee36('0x10')][_0xee36('0x12')]);return _0x3ae17d(_0x1ebb22[_0xee36('0x10')][_0xee36('0x12')]);}logger['error'](_0xee36('0x13'),_0x3bf3c2,_0x1ebb22[_0xee36('0x10')][_0xee36('0x12')]);return _0x29de52(_0x1ebb22[_0xee36('0x10')][_0xee36('0x12')]);}else{logger[_0xee36('0xb')]('Dynamics365Account,\x20%s,\x20%s',_0x3bf3c2,_0xee36('0xc'));_0x29de52(_0x1ebb22[_0xee36('0x14')]['message']);}})['catch'](function(_0x575ba4){logger[_0xee36('0x10')](_0xee36('0x13'),_0x3bf3c2,_0x575ba4);_0x3ae17d(_0x575ba4);});});}exports[_0xee36('0x15')]=function(_0x3d7901){var _0x4a25cc=this;return new Promise(function(_0x22081e,_0x5dd243){return db[_0xee36('0x16')]['findAll']({'raw':_0x3d7901[_0xee36('0x17')]?_0x3d7901[_0xee36('0x17')][_0xee36('0x18')]===undefined?!![]:![]:!![],'where':_0x3d7901['options']?_0x3d7901[_0xee36('0x17')][_0xee36('0x19')]||null:null,'attributes':_0x3d7901[_0xee36('0x17')]?_0x3d7901[_0xee36('0x17')][_0xee36('0x1a')]||null:null,'limit':_0x3d7901[_0xee36('0x17')]?_0x3d7901[_0xee36('0x17')][_0xee36('0x1b')]||null:null,'include':_0x3d7901[_0xee36('0x17')]?_0x3d7901['options'][_0xee36('0x1c')]?_['map'](_0x3d7901['options']['include'],function(_0x5d454d){return{'model':db[_0x5d454d['model']],'as':_0x5d454d['as'],'attributes':_0x5d454d[_0xee36('0x1a')],'include':_0x5d454d[_0xee36('0x1c')]?_[_0xee36('0x1d')](_0x5d454d[_0xee36('0x1c')],function(_0x248bb5){return{'model':db[_0x248bb5['model']],'as':_0x248bb5['as'],'attributes':_0x248bb5['attributes'],'include':_0x248bb5[_0xee36('0x1c')]?_[_0xee36('0x1d')](_0x248bb5[_0xee36('0x1c')],function(_0x57e37e){return{'model':db[_0x57e37e[_0xee36('0x1e')]],'as':_0x57e37e['as'],'attributes':_0x57e37e[_0xee36('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xee36('0xa')](function(_0x2e2e1f){logger[_0xee36('0xb')]('GetDynamics365Account',_0x3d7901);logger[_0xee36('0xd')]('GetDynamics365Account',_0x3d7901,JSON[_0xee36('0xf')](_0x2e2e1f));_0x22081e(_0x2e2e1f);})[_0xee36('0x1f')](function(_0x1b8e99){logger['error'](_0xee36('0x15'),_0x1b8e99[_0xee36('0x12')],_0x3d7901);_0x5dd243(_0x4a25cc[_0xee36('0x10')](0x1f4,_0x1b8e99[_0xee36('0x12')]));});});};exports['ShowDynamics365Account']=function(_0x128ee6){var _0x4da162=this;return new Promise(function(_0x7716ab,_0x18d6a7){return db['Dynamics365Account'][_0xee36('0x20')]({'raw':_0x128ee6[_0xee36('0x17')]?_0x128ee6[_0xee36('0x17')][_0xee36('0x18')]===undefined?!![]:![]:!![],'where':_0x128ee6[_0xee36('0x17')]?_0x128ee6[_0xee36('0x17')]['where']||null:null,'attributes':_0x128ee6['options']?_0x128ee6[_0xee36('0x17')][_0xee36('0x1a')]||null:null,'include':_0x128ee6[_0xee36('0x17')]?_0x128ee6['options'][_0xee36('0x1c')]?_['map'](_0x128ee6['options'][_0xee36('0x1c')],function(_0x582693){return{'model':db[_0x582693['model']],'as':_0x582693['as'],'attributes':_0x582693[_0xee36('0x1a')],'include':_0x582693[_0xee36('0x1c')]?_[_0xee36('0x1d')](_0x582693[_0xee36('0x1c')],function(_0x3f46ec){return{'model':db[_0x3f46ec[_0xee36('0x1e')]],'as':_0x3f46ec['as'],'attributes':_0x3f46ec[_0xee36('0x1a')],'include':_0x3f46ec[_0xee36('0x1c')]?_[_0xee36('0x1d')](_0x3f46ec['include'],function(_0x2102d1){return{'model':db[_0x2102d1['model']],'as':_0x2102d1['as'],'attributes':_0x2102d1[_0xee36('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xee36('0xa')](function(_0x165cfa){logger[_0xee36('0xb')](_0xee36('0x21'),_0x128ee6);logger[_0xee36('0xd')](_0xee36('0x21'),_0x128ee6,JSON['stringify'](_0x165cfa));_0x7716ab(_0x165cfa);})['catch'](function(_0x28cac6){logger[_0xee36('0x10')](_0xee36('0x21'),_0x28cac6[_0xee36('0x12')],_0x128ee6);_0x18d6a7(_0x4da162[_0xee36('0x10')](0x1f4,_0x28cac6['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e543b44..fd88e67 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 _0x5b0a=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer'];(function(_0x36436d,_0x20292c){var _0x34615d=function(_0x5447af){while(--_0x5447af){_0x36436d['push'](_0x36436d['shift']());}};_0x34615d(++_0x20292c);}(_0x5b0a,0x1af));var _0xa5b0=function(_0x128ffd,_0x149888){_0x128ffd=_0x128ffd-0x0;var _0x3b5072=_0x5b0a[_0x128ffd];return _0x3b5072;};'use strict';var multer=require(_0xa5b0('0x0'));var util=require(_0xa5b0('0x1'));var path=require(_0xa5b0('0x2'));var timeout=require(_0xa5b0('0x3'));var express=require('express');var router=express[_0xa5b0('0x4')]();var fs_extra=require(_0xa5b0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa5b0('0x6'));var config=require(_0xa5b0('0x7'));var controller=require(_0xa5b0('0x8'));router['get']('/',auth[_0xa5b0('0x9')](),controller['index']);router['get'](_0xa5b0('0xa'),auth['isAuthenticated'](),controller[_0xa5b0('0xb')]);router[_0xa5b0('0xc')](_0xa5b0('0xd'),auth[_0xa5b0('0x9')](),controller[_0xa5b0('0xe')]);router[_0xa5b0('0xc')](_0xa5b0('0xf'),auth[_0xa5b0('0x9')](),controller[_0xa5b0('0x10')]);router[_0xa5b0('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa5b0('0x11')]);router[_0xa5b0('0x12')]('/',auth[_0xa5b0('0x9')](),controller['create']);router[_0xa5b0('0x13')](_0xa5b0('0xa'),auth['isAuthenticated'](),controller[_0xa5b0('0x14')]);router[_0xa5b0('0x15')]('/:id',auth[_0xa5b0('0x9')](),controller[_0xa5b0('0x16')]);module[_0xa5b0('0x17')]=router; \ No newline at end of file +var _0x4189=['getDescriptions','post','create','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Configuration.controller','isAuthenticated','index','/:id','show','get','/:id/fields','getFields','/:id/subjects'];(function(_0x2dd27d,_0x5567a7){var _0x5d6b98=function(_0x2c43f0){while(--_0x2c43f0){_0x2dd27d['push'](_0x2dd27d['shift']());}};_0x5d6b98(++_0x5567a7);}(_0x4189,0x160));var _0x9418=function(_0x4feabe,_0x665a35){_0x4feabe=_0x4feabe-0x0;var _0x3314c0=_0x4189[_0x4feabe];return _0x3314c0;};'use strict';var multer=require(_0x9418('0x0'));var util=require('util');var path=require(_0x9418('0x1'));var timeout=require(_0x9418('0x2'));var express=require(_0x9418('0x3'));var router=express['Router']();var fs_extra=require(_0x9418('0x4'));var auth=require(_0x9418('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9418('0x6'));var controller=require(_0x9418('0x7'));router['get']('/',auth[_0x9418('0x8')](),controller[_0x9418('0x9')]);router['get'](_0x9418('0xa'),auth[_0x9418('0x8')](),controller[_0x9418('0xb')]);router[_0x9418('0xc')](_0x9418('0xd'),auth[_0x9418('0x8')](),controller[_0x9418('0xe')]);router[_0x9418('0xc')](_0x9418('0xf'),auth[_0x9418('0x8')](),controller['getSubjects']);router[_0x9418('0xc')]('/:id/descriptions',auth[_0x9418('0x8')](),controller[_0x9418('0x10')]);router[_0x9418('0x11')]('/',auth['isAuthenticated'](),controller[_0x9418('0x12')]);router[_0x9418('0x13')](_0x9418('0xa'),auth[_0x9418('0x8')](),controller[_0x9418('0x14')]);router[_0x9418('0x15')](_0x9418('0xa'),auth[_0x9418('0x8')](),controller[_0x9418('0x16')]);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 f7d6426..3f6d174 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 _0xe88c=['STRING','ENUM','incident','exports'];(function(_0x4f0b7d,_0x515942){var _0x599cf3=function(_0x496712){while(--_0x496712){_0x4f0b7d['push'](_0x4f0b7d['shift']());}};_0x599cf3(++_0x515942);}(_0xe88c,0xdf));var _0xce88=function(_0x3dcae6,_0x24652e){_0x3dcae6=_0x3dcae6-0x0;var _0x24fc25=_0xe88c[_0x3dcae6];return _0x24fc25;};'use strict';var Sequelize=require('sequelize');module[_0xce88('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xce88('0x1')]},'ticketType':{'type':Sequelize[_0xce88('0x2')](_0xce88('0x3'),'phonecall'),'defaultValue':'incident'}}; \ No newline at end of file +var _0x7edc=['ENUM','incident','phonecall','sequelize','exports','STRING'];(function(_0x2de126,_0x89472){var _0xddd384=function(_0x1d3f60){while(--_0x1d3f60){_0x2de126['push'](_0x2de126['shift']());}};_0xddd384(++_0x89472);}(_0x7edc,0xed));var _0xc7ed=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x7edc[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0xc7ed('0x0'));module[_0xc7ed('0x1')]={'name':{'type':Sequelize[_0xc7ed('0x2')]},'description':{'type':Sequelize[_0xc7ed('0x2')]},'ticketType':{'type':Sequelize[_0xc7ed('0x3')](_0xc7ed('0x4'),_0xc7ed('0x5')),'defaultValue':_0xc7ed('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 6955bdf..7be3e9d 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 _0x0358=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','Dynamics365Field','pick','getFields','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x58cf01,_0x22d21d){var _0x2e0b2e=function(_0x9f0811){while(--_0x9f0811){_0x58cf01['push'](_0x58cf01['shift']());}};_0x2e0b2e(++_0x22d21d);}(_0x0358,0x1f4));var _0x8035=function(_0x1ca4d2,_0x1fd105){_0x1ca4d2=_0x1ca4d2-0x0;var _0x5d4ff8=_0x0358[_0x1ca4d2];return _0x5d4ff8;};'use strict';var emlformat=require(_0x8035('0x0'));var rimraf=require(_0x8035('0x1'));var zipdir=require(_0x8035('0x2'));var jsonpatch=require(_0x8035('0x3'));var rp=require('request-promise');var moment=require(_0x8035('0x4'));var BPromise=require(_0x8035('0x5'));var Mustache=require(_0x8035('0x6'));var util=require(_0x8035('0x7'));var path=require(_0x8035('0x8'));var sox=require('sox');var csv=require(_0x8035('0x9'));var ejs=require(_0x8035('0xa'));var fs=require('fs');var fs_extra=require(_0x8035('0xb'));var _=require(_0x8035('0xc'));var squel=require(_0x8035('0xd'));var crypto=require(_0x8035('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8035('0xf'));var toCsv=require(_0x8035('0x9'));var querystring=require(_0x8035('0x10'));var Papa=require(_0x8035('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8035('0x12'));var as=require(_0x8035('0x13'));var hardwareService=require(_0x8035('0x14'));var logger=require(_0x8035('0x15'))(_0x8035('0x16'));var utils=require(_0x8035('0x17'));var config=require(_0x8035('0x18'));var licenseUtil=require(_0x8035('0x19'));var db=require(_0x8035('0x1a'))['db'];function respondWithStatusCode(_0x3ebffe,_0x59a275){_0x59a275=_0x59a275||0xcc;return function(_0x452f27){if(_0x452f27){return _0x3ebffe[_0x8035('0x1b')](_0x59a275);}return _0x3ebffe[_0x8035('0x1c')](_0x59a275)[_0x8035('0x1d')]();};}function respondWithResult(_0x450a0a,_0x329fb0){_0x329fb0=_0x329fb0||0xc8;return function(_0x4c3b79){if(_0x4c3b79){return _0x450a0a[_0x8035('0x1c')](_0x329fb0)['json'](_0x4c3b79);}};}function respondWithFilteredResult(_0x594a85,_0x11cb95){return function(_0x4fa5ea){if(_0x4fa5ea){var _0x2012bd=typeof _0x11cb95['offset']==='undefined'&&typeof _0x11cb95[_0x8035('0x1e')]===_0x8035('0x1f');var _0x22899f=_0x4fa5ea['count'];var _0x2bffb6=_0x2012bd?0x0:_0x11cb95[_0x8035('0x20')];var _0x20875c=_0x2012bd?_0x4fa5ea[_0x8035('0x21')]:_0x11cb95[_0x8035('0x20')]+_0x11cb95[_0x8035('0x1e')];var _0x1391f6;if(_0x20875c>=_0x22899f){_0x20875c=_0x22899f;_0x1391f6=0xc8;}else{_0x1391f6=0xce;}_0x594a85[_0x8035('0x1c')](_0x1391f6);return _0x594a85[_0x8035('0x22')](_0x8035('0x23'),_0x2bffb6+'-'+_0x20875c+'/'+_0x22899f)[_0x8035('0x24')](_0x4fa5ea);}return null;};}function patchUpdates(_0x1e05ff){return function(_0x4ac522){try{jsonpatch[_0x8035('0x25')](_0x4ac522,_0x1e05ff,!![]);}catch(_0x4d5b8f){return BPromise[_0x8035('0x26')](_0x4d5b8f);}return _0x4ac522[_0x8035('0x27')]();};}function saveUpdates(_0x97c99b,_0x171e03){return function(_0xcb5984){if(_0xcb5984){return _0xcb5984[_0x8035('0x28')](_0x97c99b)['then'](function(_0x3d8c21){return _0x3d8c21;});}return null;};}function removeEntity(_0x2eda33,_0x5ed94f){return function(_0x61a7dc){if(_0x61a7dc){return _0x61a7dc[_0x8035('0x29')]()[_0x8035('0x2a')](function(){_0x2eda33[_0x8035('0x1c')](0xcc)[_0x8035('0x1d')]();});}};}function handleEntityNotFound(_0x37b1ba,_0x2d8bc9){return function(_0x3413da){if(!_0x3413da){_0x37b1ba[_0x8035('0x1b')](0x194);}return _0x3413da;};}function handleError(_0x22169f,_0x36cb03){_0x36cb03=_0x36cb03||0x1f4;return function(_0xec8452){logger[_0x8035('0x2b')](_0xec8452[_0x8035('0x2c')]);if(_0xec8452[_0x8035('0x2d')]){delete _0xec8452[_0x8035('0x2d')];}_0x22169f[_0x8035('0x1c')](_0x36cb03)[_0x8035('0x2e')](_0xec8452);};}exports[_0x8035('0x2f')]=function(_0x38d170,_0x49cda8){var _0x2565ed={},_0x1f41ad={},_0x34340e={'count':0x0,'rows':[]};var _0x1ccc82=_[_0x8035('0x30')](db[_0x8035('0x31')][_0x8035('0x32')],function(_0x494361){return{'name':_0x494361[_0x8035('0x33')],'type':_0x494361[_0x8035('0x34')][_0x8035('0x35')]};});_0x1f41ad[_0x8035('0x36')]=_[_0x8035('0x30')](_0x1ccc82,_0x8035('0x2d'));_0x1f41ad[_0x8035('0x37')]=_[_0x8035('0x38')](_0x38d170[_0x8035('0x37')]);_0x1f41ad[_0x8035('0x39')]=_[_0x8035('0x3a')](_0x1f41ad['model'],_0x1f41ad[_0x8035('0x37')]);_0x2565ed[_0x8035('0x3b')]=_[_0x8035('0x3a')](_0x1f41ad['model'],qs[_0x8035('0x3c')](_0x38d170[_0x8035('0x37')]['fields']));_0x2565ed[_0x8035('0x3b')]=_0x2565ed['attributes'][_0x8035('0x3d')]?_0x2565ed[_0x8035('0x3b')]:_0x1f41ad['model'];if(!_0x38d170[_0x8035('0x37')][_0x8035('0x3e')](_0x8035('0x3f'))){_0x2565ed[_0x8035('0x1e')]=qs[_0x8035('0x1e')](_0x38d170[_0x8035('0x37')]['limit']);_0x2565ed[_0x8035('0x20')]=qs[_0x8035('0x20')](_0x38d170[_0x8035('0x37')][_0x8035('0x20')]);}_0x2565ed[_0x8035('0x40')]=qs[_0x8035('0x41')](_0x38d170['query']['sort']);_0x2565ed['where']=qs[_0x8035('0x39')](_['pick'](_0x38d170['query'],_0x1f41ad[_0x8035('0x39')]),_0x1ccc82);if(_0x38d170[_0x8035('0x37')][_0x8035('0x42')]){_0x2565ed['where']=_[_0x8035('0x43')](_0x2565ed['where'],{'$or':_[_0x8035('0x30')](_0x1ccc82,function(_0x56474f){if(_0x56474f[_0x8035('0x34')]!==_0x8035('0x44')){var _0x2d4f41={};_0x2d4f41[_0x56474f[_0x8035('0x2d')]]={'$like':'%'+_0x38d170[_0x8035('0x37')]['filter']+'%'};return _0x2d4f41;}})});}_0x2565ed=_['merge']({},_0x2565ed,_0x38d170[_0x8035('0x45')]);var _0x51d6ba={'where':_0x2565ed[_0x8035('0x46')]};return db[_0x8035('0x31')][_0x8035('0x21')](_0x51d6ba)[_0x8035('0x2a')](function(_0x34fbf5){_0x34340e['count']=_0x34fbf5;if(_0x38d170[_0x8035('0x37')]['includeAll']){_0x2565ed[_0x8035('0x47')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x8035('0x48')](_0x2565ed);})[_0x8035('0x2a')](function(_0x33987c){_0x34340e[_0x8035('0x49')]=_0x33987c;return _0x34340e;})['then'](respondWithFilteredResult(_0x49cda8,_0x2565ed))[_0x8035('0x4a')](handleError(_0x49cda8,null));};exports[_0x8035('0x4b')]=function(_0x14e3f6,_0x376b7e){var _0x3beb1d={'raw':![],'where':{'id':_0x14e3f6[_0x8035('0x4c')]['id']}},_0x3238fc={};_0x3238fc['model']=_['keys'](db['Dynamics365Configuration'][_0x8035('0x32')]);_0x3238fc[_0x8035('0x37')]=_[_0x8035('0x38')](_0x14e3f6['query']);_0x3238fc[_0x8035('0x39')]=_[_0x8035('0x3a')](_0x3238fc['model'],_0x3238fc[_0x8035('0x37')]);_0x3beb1d[_0x8035('0x3b')]=_[_0x8035('0x3a')](_0x3238fc[_0x8035('0x36')],qs[_0x8035('0x3c')](_0x14e3f6[_0x8035('0x37')]['fields']));_0x3beb1d[_0x8035('0x3b')]=_0x3beb1d[_0x8035('0x3b')]['length']?_0x3beb1d[_0x8035('0x3b')]:_0x3238fc[_0x8035('0x36')];if(_0x14e3f6[_0x8035('0x37')][_0x8035('0x4d')]){_0x3beb1d[_0x8035('0x47')]=[{'all':!![]}];}_0x3beb1d=_['merge']({},_0x3beb1d,_0x14e3f6[_0x8035('0x45')]);return db['Dynamics365Configuration'][_0x8035('0x4e')](_0x3beb1d)[_0x8035('0x2a')](handleEntityNotFound(_0x376b7e,null))[_0x8035('0x2a')](respondWithResult(_0x376b7e,null))[_0x8035('0x4a')](handleError(_0x376b7e,null));};exports[_0x8035('0x4f')]=function(_0x5d4624,_0x557d06){return db[_0x8035('0x31')]['create'](_0x5d4624[_0x8035('0x50')],{})[_0x8035('0x2a')](respondWithResult(_0x557d06,0xc9))[_0x8035('0x4a')](handleError(_0x557d06,null));};exports[_0x8035('0x28')]=function(_0x449664,_0x360dd4){if(_0x449664['body']['id']){delete _0x449664['body']['id'];}return db[_0x8035('0x31')][_0x8035('0x4e')]({'where':{'id':_0x449664[_0x8035('0x4c')]['id']}})[_0x8035('0x2a')](handleEntityNotFound(_0x360dd4,null))['then'](saveUpdates(_0x449664[_0x8035('0x50')],null))['then'](respondWithResult(_0x360dd4,null))[_0x8035('0x4a')](handleError(_0x360dd4,null));};exports['destroy']=function(_0x47947d,_0x5ed8d8){return db[_0x8035('0x31')][_0x8035('0x4e')]({'where':{'id':_0x47947d[_0x8035('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5ed8d8,null))['then'](removeEntity(_0x5ed8d8,null))[_0x8035('0x4a')](handleError(_0x5ed8d8,null));};exports['getFields']=function(_0x1b7acc,_0x20aedf,_0x49640c){var _0x40a8ff={};var _0x505621={};var _0x26083;var _0x42584c;return db[_0x8035('0x31')][_0x8035('0x51')]({'where':{'id':_0x1b7acc[_0x8035('0x4c')]['id']}})[_0x8035('0x2a')](handleEntityNotFound(_0x20aedf,null))['then'](function(_0xa5b5b1){if(_0xa5b5b1){_0x26083=_0xa5b5b1;_0x505621[_0x8035('0x36')]=_[_0x8035('0x38')](db[_0x8035('0x52')][_0x8035('0x32')]);_0x505621['query']=_['keys'](_0x1b7acc[_0x8035('0x37')]);_0x505621[_0x8035('0x39')]=_[_0x8035('0x3a')](_0x505621['model'],_0x505621[_0x8035('0x37')]);_0x40a8ff[_0x8035('0x3b')]=_[_0x8035('0x3a')](_0x505621[_0x8035('0x36')],qs[_0x8035('0x3c')](_0x1b7acc[_0x8035('0x37')][_0x8035('0x3c')]));_0x40a8ff[_0x8035('0x3b')]=_0x40a8ff['attributes']['length']?_0x40a8ff[_0x8035('0x3b')]:_0x505621[_0x8035('0x36')];_0x40a8ff[_0x8035('0x40')]=qs[_0x8035('0x41')](_0x1b7acc['query'][_0x8035('0x41')]);_0x40a8ff[_0x8035('0x46')]=qs[_0x8035('0x39')](_[_0x8035('0x53')](_0x1b7acc[_0x8035('0x37')],_0x505621[_0x8035('0x39')]));if(_0x1b7acc[_0x8035('0x37')][_0x8035('0x42')]){_0x40a8ff[_0x8035('0x46')]=_['merge'](_0x40a8ff[_0x8035('0x46')],{'$or':_[_0x8035('0x30')](_0x40a8ff['attributes'],function(_0x21409a){var _0x47d029={};_0x47d029[_0x21409a]={'$like':'%'+_0x1b7acc[_0x8035('0x37')][_0x8035('0x42')]+'%'};return _0x47d029;})});}_0x40a8ff=_[_0x8035('0x43')]({},_0x40a8ff,_0x1b7acc[_0x8035('0x45')]);return _0x26083[_0x8035('0x54')](_0x40a8ff);}})[_0x8035('0x2a')](function(_0x3d26ca){if(_0x3d26ca){_0x42584c=_0x3d26ca[_0x8035('0x3d')];if(!_0x1b7acc[_0x8035('0x37')]['hasOwnProperty'](_0x8035('0x3f'))){_0x40a8ff[_0x8035('0x1e')]=qs[_0x8035('0x1e')](_0x1b7acc[_0x8035('0x37')][_0x8035('0x1e')]);_0x40a8ff['offset']=qs[_0x8035('0x20')](_0x1b7acc[_0x8035('0x37')][_0x8035('0x20')]);}return _0x26083[_0x8035('0x54')](_0x40a8ff);}})[_0x8035('0x2a')](function(_0x326482){if(_0x326482){return _0x326482?{'count':_0x42584c,'rows':_0x326482}:null;}})[_0x8035('0x2a')](respondWithResult(_0x20aedf,null))['catch'](handleError(_0x20aedf,null));};exports[_0x8035('0x55')]=function(_0x17338d,_0xa3e462,_0x14ca0b){var _0x227faa={};var _0x124aa7={};var _0x44273a;var _0x239756;return db[_0x8035('0x31')][_0x8035('0x51')]({'where':{'id':_0x17338d[_0x8035('0x4c')]['id']}})[_0x8035('0x2a')](handleEntityNotFound(_0xa3e462,null))[_0x8035('0x2a')](function(_0x17907c){if(_0x17907c){_0x44273a=_0x17907c;_0x124aa7[_0x8035('0x36')]=_[_0x8035('0x38')](db[_0x8035('0x52')][_0x8035('0x32')]);_0x124aa7['query']=_[_0x8035('0x38')](_0x17338d[_0x8035('0x37')]);_0x124aa7[_0x8035('0x39')]=_[_0x8035('0x3a')](_0x124aa7[_0x8035('0x36')],_0x124aa7[_0x8035('0x37')]);_0x227faa[_0x8035('0x3b')]=_[_0x8035('0x3a')](_0x124aa7['model'],qs[_0x8035('0x3c')](_0x17338d[_0x8035('0x37')][_0x8035('0x3c')]));_0x227faa['attributes']=_0x227faa[_0x8035('0x3b')][_0x8035('0x3d')]?_0x227faa[_0x8035('0x3b')]:_0x124aa7[_0x8035('0x36')];_0x227faa[_0x8035('0x40')]=qs[_0x8035('0x41')](_0x17338d[_0x8035('0x37')][_0x8035('0x41')]);_0x227faa[_0x8035('0x46')]=qs[_0x8035('0x39')](_['pick'](_0x17338d[_0x8035('0x37')],_0x124aa7[_0x8035('0x39')]));if(_0x17338d['query'][_0x8035('0x42')]){_0x227faa['where']=_[_0x8035('0x43')](_0x227faa[_0x8035('0x46')],{'$or':_[_0x8035('0x30')](_0x227faa[_0x8035('0x3b')],function(_0x48494c){var _0x516ebc={};_0x516ebc[_0x48494c]={'$like':'%'+_0x17338d[_0x8035('0x37')]['filter']+'%'};return _0x516ebc;})});}_0x227faa=_[_0x8035('0x43')]({},_0x227faa,_0x17338d[_0x8035('0x45')]);return _0x44273a['getSubjects'](_0x227faa);}})[_0x8035('0x2a')](function(_0x4eca0c){if(_0x4eca0c){_0x239756=_0x4eca0c[_0x8035('0x3d')];if(!_0x17338d[_0x8035('0x37')][_0x8035('0x3e')](_0x8035('0x3f'))){_0x227faa[_0x8035('0x1e')]=qs['limit'](_0x17338d[_0x8035('0x37')][_0x8035('0x1e')]);_0x227faa[_0x8035('0x20')]=qs[_0x8035('0x20')](_0x17338d[_0x8035('0x37')][_0x8035('0x20')]);}return _0x44273a[_0x8035('0x55')](_0x227faa);}})[_0x8035('0x2a')](function(_0x53a2ba){if(_0x53a2ba){return _0x53a2ba?{'count':_0x239756,'rows':_0x53a2ba}:null;}})[_0x8035('0x2a')](respondWithResult(_0xa3e462,null))[_0x8035('0x4a')](handleError(_0xa3e462,null));};exports[_0x8035('0x56')]=function(_0x5aa9b3,_0x3c3795,_0x1f1439){var _0x1758bf={};var _0x359bd6={};var _0x275e73;var _0xf39b17;return db[_0x8035('0x31')][_0x8035('0x51')]({'where':{'id':_0x5aa9b3[_0x8035('0x4c')]['id']}})[_0x8035('0x2a')](handleEntityNotFound(_0x3c3795,null))['then'](function(_0x28e6f3){if(_0x28e6f3){_0x275e73=_0x28e6f3;_0x359bd6['model']=_[_0x8035('0x38')](db[_0x8035('0x52')][_0x8035('0x32')]);_0x359bd6['query']=_[_0x8035('0x38')](_0x5aa9b3[_0x8035('0x37')]);_0x359bd6[_0x8035('0x39')]=_[_0x8035('0x3a')](_0x359bd6[_0x8035('0x36')],_0x359bd6[_0x8035('0x37')]);_0x1758bf[_0x8035('0x3b')]=_[_0x8035('0x3a')](_0x359bd6[_0x8035('0x36')],qs[_0x8035('0x3c')](_0x5aa9b3[_0x8035('0x37')][_0x8035('0x3c')]));_0x1758bf[_0x8035('0x3b')]=_0x1758bf[_0x8035('0x3b')][_0x8035('0x3d')]?_0x1758bf['attributes']:_0x359bd6[_0x8035('0x36')];_0x1758bf[_0x8035('0x40')]=qs['sort'](_0x5aa9b3[_0x8035('0x37')][_0x8035('0x41')]);_0x1758bf[_0x8035('0x46')]=qs['filters'](_[_0x8035('0x53')](_0x5aa9b3[_0x8035('0x37')],_0x359bd6[_0x8035('0x39')]));if(_0x5aa9b3[_0x8035('0x37')][_0x8035('0x42')]){_0x1758bf['where']=_[_0x8035('0x43')](_0x1758bf['where'],{'$or':_['map'](_0x1758bf[_0x8035('0x3b')],function(_0x5491d6){var _0x326eb9={};_0x326eb9[_0x5491d6]={'$like':'%'+_0x5aa9b3[_0x8035('0x37')]['filter']+'%'};return _0x326eb9;})});}_0x1758bf=_['merge']({},_0x1758bf,_0x5aa9b3[_0x8035('0x45')]);return _0x275e73[_0x8035('0x56')](_0x1758bf);}})['then'](function(_0x444634){if(_0x444634){_0xf39b17=_0x444634[_0x8035('0x3d')];if(!_0x5aa9b3[_0x8035('0x37')][_0x8035('0x3e')](_0x8035('0x3f'))){_0x1758bf[_0x8035('0x1e')]=qs[_0x8035('0x1e')](_0x5aa9b3[_0x8035('0x37')][_0x8035('0x1e')]);_0x1758bf[_0x8035('0x20')]=qs[_0x8035('0x20')](_0x5aa9b3[_0x8035('0x37')][_0x8035('0x20')]);}return _0x275e73[_0x8035('0x56')](_0x1758bf);}})[_0x8035('0x2a')](function(_0x3acc56){if(_0x3acc56){return _0x3acc56?{'count':_0xf39b17,'rows':_0x3acc56}:null;}})[_0x8035('0x2a')](respondWithResult(_0x3c3795,null))[_0x8035('0x4a')](handleError(_0x3c3795,null));}; \ No newline at end of file +var _0x9c87=['intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','destroy','then','error','stack','name','map','Dynamics365Configuration','rawAttributes','key','model','query','keys'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9c87,0xbc));var _0x79c8=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0x9c87[_0x510c60];return _0x49c4aa;};'use strict';var emlformat=require(_0x79c8('0x0'));var rimraf=require(_0x79c8('0x1'));var zipdir=require(_0x79c8('0x2'));var jsonpatch=require(_0x79c8('0x3'));var rp=require(_0x79c8('0x4'));var moment=require(_0x79c8('0x5'));var BPromise=require(_0x79c8('0x6'));var Mustache=require(_0x79c8('0x7'));var util=require(_0x79c8('0x8'));var path=require(_0x79c8('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x79c8('0xa'));var fs=require('fs');var fs_extra=require(_0x79c8('0xb'));var _=require(_0x79c8('0xc'));var squel=require(_0x79c8('0xd'));var crypto=require(_0x79c8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x79c8('0xf'));var toCsv=require(_0x79c8('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x79c8('0x11'));var authService=require(_0x79c8('0x12'));var qs=require(_0x79c8('0x13'));var as=require(_0x79c8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x79c8('0x15'))(_0x79c8('0x16'));var utils=require(_0x79c8('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x79c8('0x18'));var db=require(_0x79c8('0x19'))['db'];function respondWithStatusCode(_0x1515c3,_0x1095c0){_0x1095c0=_0x1095c0||0xcc;return function(_0x15446f){if(_0x15446f){return _0x1515c3[_0x79c8('0x1a')](_0x1095c0);}return _0x1515c3[_0x79c8('0x1b')](_0x1095c0)[_0x79c8('0x1c')]();};}function respondWithResult(_0x4c4417,_0x5f4bb0){_0x5f4bb0=_0x5f4bb0||0xc8;return function(_0x137d83){if(_0x137d83){return _0x4c4417[_0x79c8('0x1b')](_0x5f4bb0)['json'](_0x137d83);}};}function respondWithFilteredResult(_0x330da8,_0x2f575e){return function(_0x5a7322){if(_0x5a7322){var _0x1772d5=typeof _0x2f575e[_0x79c8('0x1d')]===_0x79c8('0x1e')&&typeof _0x2f575e[_0x79c8('0x1f')]===_0x79c8('0x1e');var _0x2acc74=_0x5a7322[_0x79c8('0x20')];var _0xdeaebe=_0x1772d5?0x0:_0x2f575e[_0x79c8('0x1d')];var _0x130d15=_0x1772d5?_0x5a7322[_0x79c8('0x20')]:_0x2f575e[_0x79c8('0x1d')]+_0x2f575e[_0x79c8('0x1f')];var _0x31298a;if(_0x130d15>=_0x2acc74){_0x130d15=_0x2acc74;_0x31298a=0xc8;}else{_0x31298a=0xce;}_0x330da8[_0x79c8('0x1b')](_0x31298a);return _0x330da8['set']('Content-Range',_0xdeaebe+'-'+_0x130d15+'/'+_0x2acc74)[_0x79c8('0x21')](_0x5a7322);}return null;};}function patchUpdates(_0x3fa0cf){return function(_0x4100f4){try{jsonpatch[_0x79c8('0x22')](_0x4100f4,_0x3fa0cf,!![]);}catch(_0x563bb3){return BPromise['reject'](_0x563bb3);}return _0x4100f4[_0x79c8('0x23')]();};}function saveUpdates(_0x32a944,_0x4ebf69){return function(_0xe5b96){if(_0xe5b96){return _0xe5b96[_0x79c8('0x24')](_0x32a944)['then'](function(_0x525a35){return _0x525a35;});}return null;};}function removeEntity(_0x4c523b,_0x4a595a){return function(_0x585b42){if(_0x585b42){return _0x585b42[_0x79c8('0x25')]()[_0x79c8('0x26')](function(){_0x4c523b[_0x79c8('0x1b')](0xcc)[_0x79c8('0x1c')]();});}};}function handleEntityNotFound(_0x26310e,_0x5f4fae){return function(_0x413ad0){if(!_0x413ad0){_0x26310e[_0x79c8('0x1a')](0x194);}return _0x413ad0;};}function handleError(_0x6f11dd,_0xfb234b){_0xfb234b=_0xfb234b||0x1f4;return function(_0x151c2b){logger[_0x79c8('0x27')](_0x151c2b[_0x79c8('0x28')]);if(_0x151c2b['name']){delete _0x151c2b[_0x79c8('0x29')];}_0x6f11dd['status'](_0xfb234b)['send'](_0x151c2b);};}exports['index']=function(_0x257e77,_0x4f9f74){var _0x21ee29={},_0x4a2755={},_0x51f236={'count':0x0,'rows':[]};var _0x115112=_[_0x79c8('0x2a')](db[_0x79c8('0x2b')][_0x79c8('0x2c')],function(_0x24cbb8){return{'name':_0x24cbb8['fieldName'],'type':_0x24cbb8['type'][_0x79c8('0x2d')]};});_0x4a2755[_0x79c8('0x2e')]=_[_0x79c8('0x2a')](_0x115112,_0x79c8('0x29'));_0x4a2755[_0x79c8('0x2f')]=_[_0x79c8('0x30')](_0x257e77[_0x79c8('0x2f')]);_0x4a2755['filters']=_[_0x79c8('0x31')](_0x4a2755[_0x79c8('0x2e')],_0x4a2755[_0x79c8('0x2f')]);_0x21ee29[_0x79c8('0x32')]=_[_0x79c8('0x31')](_0x4a2755[_0x79c8('0x2e')],qs[_0x79c8('0x33')](_0x257e77['query'][_0x79c8('0x33')]));_0x21ee29['attributes']=_0x21ee29[_0x79c8('0x32')]['length']?_0x21ee29[_0x79c8('0x32')]:_0x4a2755[_0x79c8('0x2e')];if(!_0x257e77[_0x79c8('0x2f')][_0x79c8('0x34')](_0x79c8('0x35'))){_0x21ee29[_0x79c8('0x1f')]=qs[_0x79c8('0x1f')](_0x257e77[_0x79c8('0x2f')][_0x79c8('0x1f')]);_0x21ee29[_0x79c8('0x1d')]=qs['offset'](_0x257e77[_0x79c8('0x2f')][_0x79c8('0x1d')]);}_0x21ee29[_0x79c8('0x36')]=qs['sort'](_0x257e77[_0x79c8('0x2f')][_0x79c8('0x37')]);_0x21ee29['where']=qs[_0x79c8('0x38')](_[_0x79c8('0x39')](_0x257e77[_0x79c8('0x2f')],_0x4a2755[_0x79c8('0x38')]),_0x115112);if(_0x257e77[_0x79c8('0x2f')]['filter']){_0x21ee29[_0x79c8('0x3a')]=_[_0x79c8('0x3b')](_0x21ee29[_0x79c8('0x3a')],{'$or':_['map'](_0x115112,function(_0x281588){if(_0x281588[_0x79c8('0x3c')]!=='VIRTUAL'){var _0x1946b4={};_0x1946b4[_0x281588[_0x79c8('0x29')]]={'$like':'%'+_0x257e77[_0x79c8('0x2f')][_0x79c8('0x3d')]+'%'};return _0x1946b4;}})});}_0x21ee29=_[_0x79c8('0x3b')]({},_0x21ee29,_0x257e77[_0x79c8('0x3e')]);var _0x46d085={'where':_0x21ee29[_0x79c8('0x3a')]};return db[_0x79c8('0x2b')]['count'](_0x46d085)['then'](function(_0x28fb23){_0x51f236[_0x79c8('0x20')]=_0x28fb23;if(_0x257e77['query'][_0x79c8('0x3f')]){_0x21ee29[_0x79c8('0x40')]=[{'all':!![]}];}return db[_0x79c8('0x2b')][_0x79c8('0x41')](_0x21ee29);})[_0x79c8('0x26')](function(_0x2b16e6){_0x51f236[_0x79c8('0x42')]=_0x2b16e6;return _0x51f236;})[_0x79c8('0x26')](respondWithFilteredResult(_0x4f9f74,_0x21ee29))['catch'](handleError(_0x4f9f74,null));};exports[_0x79c8('0x43')]=function(_0x14a8af,_0x48e8ee){var _0x1d0eba={'raw':![],'where':{'id':_0x14a8af[_0x79c8('0x44')]['id']}},_0x48afe3={};_0x48afe3[_0x79c8('0x2e')]=_[_0x79c8('0x30')](db[_0x79c8('0x2b')]['rawAttributes']);_0x48afe3[_0x79c8('0x2f')]=_['keys'](_0x14a8af[_0x79c8('0x2f')]);_0x48afe3[_0x79c8('0x38')]=_['intersection'](_0x48afe3[_0x79c8('0x2e')],_0x48afe3['query']);_0x1d0eba[_0x79c8('0x32')]=_[_0x79c8('0x31')](_0x48afe3[_0x79c8('0x2e')],qs['fields'](_0x14a8af[_0x79c8('0x2f')][_0x79c8('0x33')]));_0x1d0eba[_0x79c8('0x32')]=_0x1d0eba[_0x79c8('0x32')][_0x79c8('0x45')]?_0x1d0eba['attributes']:_0x48afe3['model'];if(_0x14a8af[_0x79c8('0x2f')][_0x79c8('0x3f')]){_0x1d0eba['include']=[{'all':!![]}];}_0x1d0eba=_['merge']({},_0x1d0eba,_0x14a8af['options']);return db[_0x79c8('0x2b')][_0x79c8('0x46')](_0x1d0eba)[_0x79c8('0x26')](handleEntityNotFound(_0x48e8ee,null))[_0x79c8('0x26')](respondWithResult(_0x48e8ee,null))['catch'](handleError(_0x48e8ee,null));};exports[_0x79c8('0x47')]=function(_0x29548b,_0x1cf2f3){return db['Dynamics365Configuration'][_0x79c8('0x47')](_0x29548b[_0x79c8('0x48')],{})[_0x79c8('0x26')](respondWithResult(_0x1cf2f3,0xc9))['catch'](handleError(_0x1cf2f3,null));};exports['update']=function(_0x45ff89,_0x3ff4ba){if(_0x45ff89[_0x79c8('0x48')]['id']){delete _0x45ff89[_0x79c8('0x48')]['id'];}return db[_0x79c8('0x2b')][_0x79c8('0x46')]({'where':{'id':_0x45ff89[_0x79c8('0x44')]['id']}})[_0x79c8('0x26')](handleEntityNotFound(_0x3ff4ba,null))[_0x79c8('0x26')](saveUpdates(_0x45ff89[_0x79c8('0x48')],null))[_0x79c8('0x26')](respondWithResult(_0x3ff4ba,null))[_0x79c8('0x49')](handleError(_0x3ff4ba,null));};exports[_0x79c8('0x25')]=function(_0x527a66,_0x1add48){return db[_0x79c8('0x2b')]['find']({'where':{'id':_0x527a66[_0x79c8('0x44')]['id']}})[_0x79c8('0x26')](handleEntityNotFound(_0x1add48,null))[_0x79c8('0x26')](removeEntity(_0x1add48,null))['catch'](handleError(_0x1add48,null));};exports[_0x79c8('0x4a')]=function(_0x23df5e,_0x5e7152,_0x4b3fdb){var _0x1a284e={};var _0x103c89={};var _0x138c03;var _0x8e8a8c;return db[_0x79c8('0x2b')][_0x79c8('0x4b')]({'where':{'id':_0x23df5e[_0x79c8('0x44')]['id']}})[_0x79c8('0x26')](handleEntityNotFound(_0x5e7152,null))[_0x79c8('0x26')](function(_0x1b9265){if(_0x1b9265){_0x138c03=_0x1b9265;_0x103c89[_0x79c8('0x2e')]=_[_0x79c8('0x30')](db[_0x79c8('0x4c')][_0x79c8('0x2c')]);_0x103c89['query']=_['keys'](_0x23df5e[_0x79c8('0x2f')]);_0x103c89[_0x79c8('0x38')]=_[_0x79c8('0x31')](_0x103c89[_0x79c8('0x2e')],_0x103c89['query']);_0x1a284e[_0x79c8('0x32')]=_[_0x79c8('0x31')](_0x103c89[_0x79c8('0x2e')],qs[_0x79c8('0x33')](_0x23df5e[_0x79c8('0x2f')][_0x79c8('0x33')]));_0x1a284e[_0x79c8('0x32')]=_0x1a284e['attributes'][_0x79c8('0x45')]?_0x1a284e[_0x79c8('0x32')]:_0x103c89[_0x79c8('0x2e')];_0x1a284e[_0x79c8('0x36')]=qs[_0x79c8('0x37')](_0x23df5e['query']['sort']);_0x1a284e['where']=qs[_0x79c8('0x38')](_['pick'](_0x23df5e[_0x79c8('0x2f')],_0x103c89[_0x79c8('0x38')]));if(_0x23df5e[_0x79c8('0x2f')][_0x79c8('0x3d')]){_0x1a284e['where']=_[_0x79c8('0x3b')](_0x1a284e['where'],{'$or':_[_0x79c8('0x2a')](_0x1a284e['attributes'],function(_0x4acc99){var _0x25011e={};_0x25011e[_0x4acc99]={'$like':'%'+_0x23df5e[_0x79c8('0x2f')][_0x79c8('0x3d')]+'%'};return _0x25011e;})});}_0x1a284e=_[_0x79c8('0x3b')]({},_0x1a284e,_0x23df5e[_0x79c8('0x3e')]);return _0x138c03['getFields'](_0x1a284e);}})['then'](function(_0x5f525c){if(_0x5f525c){_0x8e8a8c=_0x5f525c[_0x79c8('0x45')];if(!_0x23df5e['query'][_0x79c8('0x34')]('nolimit')){_0x1a284e['limit']=qs[_0x79c8('0x1f')](_0x23df5e[_0x79c8('0x2f')]['limit']);_0x1a284e[_0x79c8('0x1d')]=qs[_0x79c8('0x1d')](_0x23df5e[_0x79c8('0x2f')][_0x79c8('0x1d')]);}return _0x138c03[_0x79c8('0x4a')](_0x1a284e);}})[_0x79c8('0x26')](function(_0x1b27b7){if(_0x1b27b7){return _0x1b27b7?{'count':_0x8e8a8c,'rows':_0x1b27b7}:null;}})[_0x79c8('0x26')](respondWithResult(_0x5e7152,null))['catch'](handleError(_0x5e7152,null));};exports[_0x79c8('0x4d')]=function(_0x30b660,_0x2295f7,_0x5301a4){var _0x2ae35c={};var _0x1daa96={};var _0x266948;var _0x4ed8bb;return db[_0x79c8('0x2b')][_0x79c8('0x4b')]({'where':{'id':_0x30b660[_0x79c8('0x44')]['id']}})[_0x79c8('0x26')](handleEntityNotFound(_0x2295f7,null))['then'](function(_0x458f07){if(_0x458f07){_0x266948=_0x458f07;_0x1daa96[_0x79c8('0x2e')]=_[_0x79c8('0x30')](db[_0x79c8('0x4c')][_0x79c8('0x2c')]);_0x1daa96[_0x79c8('0x2f')]=_['keys'](_0x30b660[_0x79c8('0x2f')]);_0x1daa96[_0x79c8('0x38')]=_[_0x79c8('0x31')](_0x1daa96[_0x79c8('0x2e')],_0x1daa96[_0x79c8('0x2f')]);_0x2ae35c[_0x79c8('0x32')]=_[_0x79c8('0x31')](_0x1daa96[_0x79c8('0x2e')],qs[_0x79c8('0x33')](_0x30b660[_0x79c8('0x2f')][_0x79c8('0x33')]));_0x2ae35c['attributes']=_0x2ae35c[_0x79c8('0x32')]['length']?_0x2ae35c[_0x79c8('0x32')]:_0x1daa96[_0x79c8('0x2e')];_0x2ae35c[_0x79c8('0x36')]=qs['sort'](_0x30b660['query'][_0x79c8('0x37')]);_0x2ae35c['where']=qs[_0x79c8('0x38')](_['pick'](_0x30b660['query'],_0x1daa96[_0x79c8('0x38')]));if(_0x30b660[_0x79c8('0x2f')][_0x79c8('0x3d')]){_0x2ae35c[_0x79c8('0x3a')]=_['merge'](_0x2ae35c[_0x79c8('0x3a')],{'$or':_[_0x79c8('0x2a')](_0x2ae35c[_0x79c8('0x32')],function(_0x23424f){var _0x4a9170={};_0x4a9170[_0x23424f]={'$like':'%'+_0x30b660[_0x79c8('0x2f')][_0x79c8('0x3d')]+'%'};return _0x4a9170;})});}_0x2ae35c=_['merge']({},_0x2ae35c,_0x30b660[_0x79c8('0x3e')]);return _0x266948[_0x79c8('0x4d')](_0x2ae35c);}})[_0x79c8('0x26')](function(_0x59fa53){if(_0x59fa53){_0x4ed8bb=_0x59fa53[_0x79c8('0x45')];if(!_0x30b660[_0x79c8('0x2f')][_0x79c8('0x34')]('nolimit')){_0x2ae35c[_0x79c8('0x1f')]=qs[_0x79c8('0x1f')](_0x30b660['query']['limit']);_0x2ae35c[_0x79c8('0x1d')]=qs[_0x79c8('0x1d')](_0x30b660[_0x79c8('0x2f')][_0x79c8('0x1d')]);}return _0x266948['getSubjects'](_0x2ae35c);}})[_0x79c8('0x26')](function(_0x3e7ed2){if(_0x3e7ed2){return _0x3e7ed2?{'count':_0x4ed8bb,'rows':_0x3e7ed2}:null;}})['then'](respondWithResult(_0x2295f7,null))[_0x79c8('0x49')](handleError(_0x2295f7,null));};exports[_0x79c8('0x4e')]=function(_0x494339,_0x54e9c8,_0x2442bc){var _0x1c0926={};var _0x1ec0ec={};var _0xbbfe6e;var _0x41b097;return db['Dynamics365Configuration'][_0x79c8('0x4b')]({'where':{'id':_0x494339[_0x79c8('0x44')]['id']}})[_0x79c8('0x26')](handleEntityNotFound(_0x54e9c8,null))[_0x79c8('0x26')](function(_0x1f22d2){if(_0x1f22d2){_0xbbfe6e=_0x1f22d2;_0x1ec0ec[_0x79c8('0x2e')]=_[_0x79c8('0x30')](db[_0x79c8('0x4c')][_0x79c8('0x2c')]);_0x1ec0ec[_0x79c8('0x2f')]=_[_0x79c8('0x30')](_0x494339[_0x79c8('0x2f')]);_0x1ec0ec['filters']=_['intersection'](_0x1ec0ec['model'],_0x1ec0ec['query']);_0x1c0926['attributes']=_[_0x79c8('0x31')](_0x1ec0ec[_0x79c8('0x2e')],qs[_0x79c8('0x33')](_0x494339[_0x79c8('0x2f')][_0x79c8('0x33')]));_0x1c0926['attributes']=_0x1c0926['attributes']['length']?_0x1c0926['attributes']:_0x1ec0ec[_0x79c8('0x2e')];_0x1c0926[_0x79c8('0x36')]=qs[_0x79c8('0x37')](_0x494339[_0x79c8('0x2f')][_0x79c8('0x37')]);_0x1c0926[_0x79c8('0x3a')]=qs[_0x79c8('0x38')](_['pick'](_0x494339[_0x79c8('0x2f')],_0x1ec0ec[_0x79c8('0x38')]));if(_0x494339['query'][_0x79c8('0x3d')]){_0x1c0926['where']=_['merge'](_0x1c0926[_0x79c8('0x3a')],{'$or':_['map'](_0x1c0926[_0x79c8('0x32')],function(_0x36bb54){var _0x1698cd={};_0x1698cd[_0x36bb54]={'$like':'%'+_0x494339[_0x79c8('0x2f')][_0x79c8('0x3d')]+'%'};return _0x1698cd;})});}_0x1c0926=_[_0x79c8('0x3b')]({},_0x1c0926,_0x494339[_0x79c8('0x3e')]);return _0xbbfe6e[_0x79c8('0x4e')](_0x1c0926);}})[_0x79c8('0x26')](function(_0x462a40){if(_0x462a40){_0x41b097=_0x462a40[_0x79c8('0x45')];if(!_0x494339['query']['hasOwnProperty']('nolimit')){_0x1c0926[_0x79c8('0x1f')]=qs[_0x79c8('0x1f')](_0x494339[_0x79c8('0x2f')]['limit']);_0x1c0926[_0x79c8('0x1d')]=qs[_0x79c8('0x1d')](_0x494339['query'][_0x79c8('0x1d')]);}return _0xbbfe6e[_0x79c8('0x4e')](_0x1c0926);}})[_0x79c8('0x26')](function(_0x1bde0b){if(_0x1bde0b){return _0x1bde0b?{'count':_0x41b097,'rows':_0x1bde0b}:null;}})[_0x79c8('0x26')](respondWithResult(_0x54e9c8,null))[_0x79c8('0x49')](handleError(_0x54e9c8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a8b8936..3427a85 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 _0xdace=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x24d47f,_0x1ccf94){var _0x25854a=function(_0x3ade7e){while(--_0x3ade7e){_0x24d47f['push'](_0x24d47f['shift']());}};_0x25854a(++_0x1ccf94);}(_0xdace,0xc5));var _0xedac=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xdace[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var logger=require(_0xedac('0x1'))(_0xedac('0x2'));var moment=require(_0xedac('0x3'));var BPromise=require('bluebird');var rp=require(_0xedac('0x4'));var fs=require('fs');var path=require(_0xedac('0x5'));var rimraf=require(_0xedac('0x6'));var config=require(_0xedac('0x7'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xedac('0x8')]=function(_0x1cba89,_0x39328a){return _0x1cba89['define'](_0xedac('0x9'),attributes,{'tableName':_0xedac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x434b09,_0x2fca8b){var _0xb78f93=function(_0x13b8a4){while(--_0x13b8a4){_0x434b09['push'](_0x434b09['shift']());}};_0xb78f93(++_0x2fca8b);}(_0xf109,0xce));var _0x9f10=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xf109[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 75731f4..1519dff 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 _0xbfbc=['../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x1ea24f,_0x5f1e2c){var _0xe1637a=function(_0x144767){while(--_0x144767){_0x1ea24f['push'](_0x1ea24f['shift']());}};_0xe1637a(++_0x5f1e2c);}(_0xbfbc,0xdf));var _0xcbfb=function(_0x10478d,_0x222fa){_0x10478d=_0x10478d-0x0;var _0x4a8484=_0xbfbc[_0x10478d];return _0x4a8484;};'use strict';var _=require(_0xcbfb('0x0'));var util=require(_0xcbfb('0x1'));var moment=require(_0xcbfb('0x2'));var BPromise=require(_0xcbfb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbfb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbfb('0x5'));var logger=require(_0xcbfb('0x6'))('rpc');var config=require(_0xcbfb('0x7'));var jayson=require(_0xcbfb('0x8'));var client=jayson[_0xcbfb('0x9')][_0xcbfb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x476a8e,_0x544537,_0x5586f1){return new BPromise(function(_0x33fa51,_0x854fff){return client[_0xcbfb('0xb')](_0x476a8e,_0x5586f1)['then'](function(_0x464905){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x544537,_0xcbfb('0xc'));logger[_0xcbfb('0xd')](_0xcbfb('0xe'),_0x544537,'request\x20sent',JSON[_0xcbfb('0xf')](_0x464905));if(_0x464905[_0xcbfb('0x10')]){if(_0x464905[_0xcbfb('0x10')][_0xcbfb('0x11')]===0x1f4){logger[_0xcbfb('0x10')](_0xcbfb('0x12'),_0x544537,_0x464905['error'][_0xcbfb('0x13')]);return _0x854fff(_0x464905[_0xcbfb('0x10')]['message']);}logger['error'](_0xcbfb('0x12'),_0x544537,_0x464905[_0xcbfb('0x10')][_0xcbfb('0x13')]);return _0x33fa51(_0x464905[_0xcbfb('0x10')][_0xcbfb('0x13')]);}else{logger[_0xcbfb('0x14')](_0xcbfb('0x12'),_0x544537,'request\x20sent');_0x33fa51(_0x464905[_0xcbfb('0x15')][_0xcbfb('0x13')]);}})[_0xcbfb('0x16')](function(_0x43a8c8){logger[_0xcbfb('0x10')](_0xcbfb('0x12'),_0x544537,_0x43a8c8);_0x854fff(_0x43a8c8);});});} \ No newline at end of file +var _0xfe8d=['randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xfe8d,0x1a2));var _0xdfe8=function(_0x56b4d3,_0x5bf073){_0x56b4d3=_0x56b4d3-0x0;var _0x37986c=_0xfe8d[_0x56b4d3];return _0x37986c;};'use strict';var _=require(_0xdfe8('0x0'));var util=require(_0xdfe8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdfe8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdfe8('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdfe8('0x4'));var config=require(_0xdfe8('0x5'));var jayson=require(_0xdfe8('0x6'));var client=jayson['client'][_0xdfe8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d32d1,_0x214822,_0x10d34b){return new BPromise(function(_0x3c21c4,_0x3c4ab9){return client[_0xdfe8('0x8')](_0x5d32d1,_0x10d34b)['then'](function(_0x5b5c8d){logger[_0xdfe8('0x9')](_0xdfe8('0xa'),_0x214822,_0xdfe8('0xb'));logger[_0xdfe8('0xc')](_0xdfe8('0xd'),_0x214822,_0xdfe8('0xb'),JSON[_0xdfe8('0xe')](_0x5b5c8d));if(_0x5b5c8d[_0xdfe8('0xf')]){if(_0x5b5c8d['error'][_0xdfe8('0x10')]===0x1f4){logger['error'](_0xdfe8('0xa'),_0x214822,_0x5b5c8d[_0xdfe8('0xf')][_0xdfe8('0x11')]);return _0x3c4ab9(_0x5b5c8d['error'][_0xdfe8('0x11')]);}logger[_0xdfe8('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x214822,_0x5b5c8d[_0xdfe8('0xf')]['message']);return _0x3c21c4(_0x5b5c8d['error'][_0xdfe8('0x11')]);}else{logger['info'](_0xdfe8('0xa'),_0x214822,_0xdfe8('0xb'));_0x3c21c4(_0x5b5c8d[_0xdfe8('0x12')][_0xdfe8('0x11')]);}})[_0xdfe8('0x13')](function(_0x1aec71){logger[_0xdfe8('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x214822,_0x1aec71);_0x3c4ab9(_0x1aec71);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 6f62972..4c97eae 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 _0x176c=['./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc0cb13,_0x158574){var _0x1b7697=function(_0x18e5d9){while(--_0x18e5d9){_0xc0cb13['push'](_0xc0cb13['shift']());}};_0x1b7697(++_0x158574);}(_0x176c,0x14e));var _0xc176=function(_0x286b2c,_0x5d1865){_0x286b2c=_0x286b2c-0x0;var _0x1b5c86=_0x176c[_0x286b2c];return _0x1b5c86;};'use strict';var multer=require('multer');var util=require(_0xc176('0x0'));var path=require('path');var timeout=require(_0xc176('0x1'));var express=require(_0xc176('0x2'));var router=express[_0xc176('0x3')]();var fs_extra=require(_0xc176('0x4'));var auth=require(_0xc176('0x5'));var interaction=require(_0xc176('0x6'));var config=require(_0xc176('0x7'));var controller=require(_0xc176('0x8'));router[_0xc176('0x9')]('/',auth[_0xc176('0xa')](),controller[_0xc176('0xb')]);router[_0xc176('0x9')](_0xc176('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc176('0xd')]('/',auth['isAuthenticated'](),controller[_0xc176('0xe')]);router[_0xc176('0xf')](_0xc176('0xc'),auth[_0xc176('0xa')](),controller[_0xc176('0x10')]);router[_0xc176('0x11')](_0xc176('0xc'),auth[_0xc176('0xa')](),controller[_0xc176('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc8bf=['get','isAuthenticated','index','/:id','show','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0xc8bf,0xc9));var _0xfc8b=function(_0x51da26,_0x279bba){_0x51da26=_0x51da26-0x0;var _0x5e19a2=_0xc8bf[_0x51da26];return _0x5e19a2;};'use strict';var multer=require(_0xfc8b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfc8b('0x1'));var express=require('express');var router=express[_0xfc8b('0x2')]();var fs_extra=require(_0xfc8b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xfc8b('0x4'));var config=require(_0xfc8b('0x5'));var controller=require(_0xfc8b('0x6'));router[_0xfc8b('0x7')]('/',auth[_0xfc8b('0x8')](),controller[_0xfc8b('0x9')]);router['get'](_0xfc8b('0xa'),auth['isAuthenticated'](),controller[_0xfc8b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xfc8b('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xfc8b('0x8')](),controller['destroy']);module[_0xfc8b('0xc')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ef0c295..bb55225 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 _0xc54e=['ENUM','string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xc54e,0x85));var _0xec54=function(_0x4dbc5d,_0x2d0a51){_0x4dbc5d=_0x4dbc5d-0x0;var _0x45b461=_0xc54e[_0x4dbc5d];return _0x45b461;};'use strict';var Sequelize=require(_0xec54('0x0'));module[_0xec54('0x1')]={'type':{'type':Sequelize[_0xec54('0x2')](_0xec54('0x3'),_0xec54('0x4'),'customVariable',_0xec54('0x5'),_0xec54('0x6')),'defaultValue':_0xec54('0x3')},'content':{'type':Sequelize[_0xec54('0x7')]},'key':{'type':Sequelize[_0xec54('0x7')]},'keyType':{'type':Sequelize[_0xec54('0x2')](_0xec54('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xec54('0x7')]},'idField':{'type':Sequelize[_0xec54('0x7')]},'nameField':{'type':Sequelize[_0xec54('0x7')]},'customField':{'type':Sequelize[_0xec54('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xec54('0x7')]}}; \ No newline at end of file +var _0xbe8d=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x9d5051,_0x5e6a92){var _0x2efa9d=function(_0x4275ea){while(--_0x4275ea){_0x9d5051['push'](_0x9d5051['shift']());}};_0x2efa9d(++_0x5e6a92);}(_0xbe8d,0xd2));var _0xdbe8=function(_0x496cba,_0x92dd1f){_0x496cba=_0x496cba-0x0;var _0x248927=_0xbe8d[_0x496cba];return _0x248927;};'use strict';var Sequelize=require(_0xdbe8('0x0'));module[_0xdbe8('0x1')]={'type':{'type':Sequelize[_0xdbe8('0x2')](_0xdbe8('0x3'),_0xdbe8('0x4'),_0xdbe8('0x5'),_0xdbe8('0x6'),_0xdbe8('0x7')),'defaultValue':_0xdbe8('0x3')},'content':{'type':Sequelize[_0xdbe8('0x8')]},'key':{'type':Sequelize[_0xdbe8('0x8')]},'keyType':{'type':Sequelize[_0xdbe8('0x2')](_0xdbe8('0x3'),_0xdbe8('0x4'),_0xdbe8('0x5'))},'keyContent':{'type':Sequelize[_0xdbe8('0x8')]},'idField':{'type':Sequelize[_0xdbe8('0x8')]},'nameField':{'type':Sequelize[_0xdbe8('0x8')]},'customField':{'type':Sequelize[_0xdbe8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdbe8('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1aeb0cf..6649f3d 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 _0xeebc=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','catch','params','rawAttributes','includeAll','find','create','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','Dynamics365Field','fieldName','type','query','keys','filters','intersection','model'];(function(_0x53c4f8,_0x44ccaf){var _0x416458=function(_0x2632aa){while(--_0x2632aa){_0x53c4f8['push'](_0x53c4f8['shift']());}};_0x416458(++_0x44ccaf);}(_0xeebc,0x181));var _0xceeb=function(_0x2a480b,_0x5e891a){_0x2a480b=_0x2a480b-0x0;var _0x180438=_0xeebc[_0x2a480b];return _0x180438;};'use strict';var emlformat=require(_0xceeb('0x0'));var rimraf=require(_0xceeb('0x1'));var zipdir=require(_0xceeb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xceeb('0x3'));var moment=require(_0xceeb('0x4'));var BPromise=require(_0xceeb('0x5'));var Mustache=require(_0xceeb('0x6'));var util=require(_0xceeb('0x7'));var path=require(_0xceeb('0x8'));var sox=require(_0xceeb('0x9'));var csv=require(_0xceeb('0xa'));var ejs=require(_0xceeb('0xb'));var fs=require('fs');var fs_extra=require(_0xceeb('0xc'));var _=require(_0xceeb('0xd'));var squel=require('squel');var crypto=require(_0xceeb('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xceeb('0xf'));var toCsv=require(_0xceeb('0xa'));var querystring=require(_0xceeb('0x10'));var Papa=require(_0xceeb('0x11'));var Redis=require(_0xceeb('0x12'));var authService=require(_0xceeb('0x13'));var qs=require(_0xceeb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xceeb('0x15'));var logger=require(_0xceeb('0x16'))(_0xceeb('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xceeb('0x18'))['db'];function respondWithStatusCode(_0x359b5e,_0x2ff6de){_0x2ff6de=_0x2ff6de||0xcc;return function(_0x29d560){if(_0x29d560){return _0x359b5e[_0xceeb('0x19')](_0x2ff6de);}return _0x359b5e['status'](_0x2ff6de)[_0xceeb('0x1a')]();};}function respondWithResult(_0xec14e4,_0x33e481){_0x33e481=_0x33e481||0xc8;return function(_0x445326){if(_0x445326){return _0xec14e4[_0xceeb('0x1b')](_0x33e481)[_0xceeb('0x1c')](_0x445326);}};}function respondWithFilteredResult(_0x4cab43,_0x364185){return function(_0x134fe9){if(_0x134fe9){var _0x3f475b=typeof _0x364185[_0xceeb('0x1d')]===_0xceeb('0x1e')&&typeof _0x364185[_0xceeb('0x1f')]===_0xceeb('0x1e');var _0x5a377b=_0x134fe9[_0xceeb('0x20')];var _0x3e27d9=_0x3f475b?0x0:_0x364185[_0xceeb('0x1d')];var _0x2a86b8=_0x3f475b?_0x134fe9[_0xceeb('0x20')]:_0x364185['offset']+_0x364185[_0xceeb('0x1f')];var _0x75dbe6;if(_0x2a86b8>=_0x5a377b){_0x2a86b8=_0x5a377b;_0x75dbe6=0xc8;}else{_0x75dbe6=0xce;}_0x4cab43['status'](_0x75dbe6);return _0x4cab43[_0xceeb('0x21')](_0xceeb('0x22'),_0x3e27d9+'-'+_0x2a86b8+'/'+_0x5a377b)[_0xceeb('0x1c')](_0x134fe9);}return null;};}function patchUpdates(_0x133ef6){return function(_0x57e229){try{jsonpatch[_0xceeb('0x23')](_0x57e229,_0x133ef6,!![]);}catch(_0x153f3c){return BPromise['reject'](_0x153f3c);}return _0x57e229[_0xceeb('0x24')]();};}function saveUpdates(_0x56abc3,_0x5b7f25){return function(_0x528f7b){if(_0x528f7b){return _0x528f7b[_0xceeb('0x25')](_0x56abc3)[_0xceeb('0x26')](function(_0x14627e){return _0x14627e;});}return null;};}function removeEntity(_0x8e3ad5,_0x1c89b5){return function(_0x5263c3){if(_0x5263c3){return _0x5263c3[_0xceeb('0x27')]()[_0xceeb('0x26')](function(){_0x8e3ad5[_0xceeb('0x1b')](0xcc)[_0xceeb('0x1a')]();});}};}function handleEntityNotFound(_0x19533b,_0x41a7e6){return function(_0x4a15c8){if(!_0x4a15c8){_0x19533b[_0xceeb('0x19')](0x194);}return _0x4a15c8;};}function handleError(_0x2b2704,_0x29ba07){_0x29ba07=_0x29ba07||0x1f4;return function(_0x29a4b9){logger[_0xceeb('0x28')](_0x29a4b9[_0xceeb('0x29')]);if(_0x29a4b9[_0xceeb('0x2a')]){delete _0x29a4b9[_0xceeb('0x2a')];}_0x2b2704['status'](_0x29ba07)[_0xceeb('0x2b')](_0x29a4b9);};}exports['index']=function(_0x3fbf5f,_0xe3ea12){var _0x49e953={},_0x52e5d5={},_0x26b354={'count':0x0,'rows':[]};var _0x903291=_[_0xceeb('0x2c')](db[_0xceeb('0x2d')]['rawAttributes'],function(_0x39e855){return{'name':_0x39e855[_0xceeb('0x2e')],'type':_0x39e855[_0xceeb('0x2f')]['key']};});_0x52e5d5['model']=_['map'](_0x903291,_0xceeb('0x2a'));_0x52e5d5[_0xceeb('0x30')]=_[_0xceeb('0x31')](_0x3fbf5f[_0xceeb('0x30')]);_0x52e5d5[_0xceeb('0x32')]=_[_0xceeb('0x33')](_0x52e5d5[_0xceeb('0x34')],_0x52e5d5[_0xceeb('0x30')]);_0x49e953[_0xceeb('0x35')]=_[_0xceeb('0x33')](_0x52e5d5[_0xceeb('0x34')],qs[_0xceeb('0x36')](_0x3fbf5f[_0xceeb('0x30')][_0xceeb('0x36')]));_0x49e953[_0xceeb('0x35')]=_0x49e953[_0xceeb('0x35')][_0xceeb('0x37')]?_0x49e953[_0xceeb('0x35')]:_0x52e5d5['model'];if(!_0x3fbf5f[_0xceeb('0x30')][_0xceeb('0x38')](_0xceeb('0x39'))){_0x49e953[_0xceeb('0x1f')]=qs[_0xceeb('0x1f')](_0x3fbf5f[_0xceeb('0x30')][_0xceeb('0x1f')]);_0x49e953[_0xceeb('0x1d')]=qs[_0xceeb('0x1d')](_0x3fbf5f[_0xceeb('0x30')][_0xceeb('0x1d')]);}_0x49e953[_0xceeb('0x3a')]=qs[_0xceeb('0x3b')](_0x3fbf5f['query'][_0xceeb('0x3b')]);_0x49e953['where']=qs[_0xceeb('0x32')](_['pick'](_0x3fbf5f[_0xceeb('0x30')],_0x52e5d5[_0xceeb('0x32')]),_0x903291);if(_0x3fbf5f[_0xceeb('0x30')][_0xceeb('0x3c')]){_0x49e953[_0xceeb('0x3d')]=_[_0xceeb('0x3e')](_0x49e953[_0xceeb('0x3d')],{'$or':_[_0xceeb('0x2c')](_0x903291,function(_0x33d03a){if(_0x33d03a[_0xceeb('0x2f')]!==_0xceeb('0x3f')){var _0x22c89a={};_0x22c89a[_0x33d03a['name']]={'$like':'%'+_0x3fbf5f[_0xceeb('0x30')][_0xceeb('0x3c')]+'%'};return _0x22c89a;}})});}_0x49e953=_[_0xceeb('0x3e')]({},_0x49e953,_0x3fbf5f[_0xceeb('0x40')]);var _0x29f2ec={'where':_0x49e953[_0xceeb('0x3d')]};return db[_0xceeb('0x2d')]['count'](_0x29f2ec)[_0xceeb('0x26')](function(_0x322a9f){_0x26b354[_0xceeb('0x20')]=_0x322a9f;if(_0x3fbf5f[_0xceeb('0x30')]['includeAll']){_0x49e953[_0xceeb('0x41')]=[{'all':!![]}];}return db[_0xceeb('0x2d')][_0xceeb('0x42')](_0x49e953);})['then'](function(_0xafc11b){_0x26b354['rows']=_0xafc11b;return _0x26b354;})[_0xceeb('0x26')](respondWithFilteredResult(_0xe3ea12,_0x49e953))[_0xceeb('0x43')](handleError(_0xe3ea12,null));};exports['show']=function(_0x11bacb,_0x4f569b){var _0x438bf8={'raw':!![],'where':{'id':_0x11bacb[_0xceeb('0x44')]['id']}},_0x2bb092={};_0x2bb092[_0xceeb('0x34')]=_[_0xceeb('0x31')](db['Dynamics365Field'][_0xceeb('0x45')]);_0x2bb092[_0xceeb('0x30')]=_[_0xceeb('0x31')](_0x11bacb[_0xceeb('0x30')]);_0x2bb092['filters']=_[_0xceeb('0x33')](_0x2bb092[_0xceeb('0x34')],_0x2bb092[_0xceeb('0x30')]);_0x438bf8['attributes']=_[_0xceeb('0x33')](_0x2bb092['model'],qs['fields'](_0x11bacb[_0xceeb('0x30')]['fields']));_0x438bf8[_0xceeb('0x35')]=_0x438bf8['attributes'][_0xceeb('0x37')]?_0x438bf8[_0xceeb('0x35')]:_0x2bb092[_0xceeb('0x34')];if(_0x11bacb[_0xceeb('0x30')][_0xceeb('0x46')]){_0x438bf8['include']=[{'all':!![]}];}_0x438bf8=_[_0xceeb('0x3e')]({},_0x438bf8,_0x11bacb['options']);return db['Dynamics365Field'][_0xceeb('0x47')](_0x438bf8)[_0xceeb('0x26')](handleEntityNotFound(_0x4f569b,null))[_0xceeb('0x26')](respondWithResult(_0x4f569b,null))[_0xceeb('0x43')](handleError(_0x4f569b,null));};exports[_0xceeb('0x48')]=function(_0x3e7a17,_0x2e4067){return db[_0xceeb('0x2d')][_0xceeb('0x48')](_0x3e7a17['body'],{})[_0xceeb('0x26')](respondWithResult(_0x2e4067,0xc9))[_0xceeb('0x43')](handleError(_0x2e4067,null));};exports['update']=function(_0x47778b,_0x3b28da){if(_0x47778b['body']['id']){delete _0x47778b['body']['id'];}return db[_0xceeb('0x2d')][_0xceeb('0x47')]({'where':{'id':_0x47778b[_0xceeb('0x44')]['id']}})[_0xceeb('0x26')](handleEntityNotFound(_0x3b28da,null))[_0xceeb('0x26')](saveUpdates(_0x47778b['body'],null))['then'](respondWithResult(_0x3b28da,null))['catch'](handleError(_0x3b28da,null));};exports[_0xceeb('0x27')]=function(_0x4515d0,_0x37ce63){return db['Dynamics365Field'][_0xceeb('0x47')]({'where':{'id':_0x4515d0[_0xceeb('0x44')]['id']}})[_0xceeb('0x26')](handleEntityNotFound(_0x37ce63,null))[_0xceeb('0x26')](removeEntity(_0x37ce63,null))[_0xceeb('0x43')](handleError(_0x37ce63,null));}; \ No newline at end of file +var _0x6cbc=['filters','pick','filter','where','merge','type','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','params','find','create','update','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','sendStatus','error','stack','name','send','index','Dynamics365Field','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x517984,_0x51aa94){var _0x11ea8c=function(_0x4b5b00){while(--_0x4b5b00){_0x517984['push'](_0x517984['shift']());}};_0x11ea8c(++_0x51aa94);}(_0x6cbc,0x1ab));var _0xc6cb=function(_0x1c3a0f,_0x565875){_0x1c3a0f=_0x1c3a0f-0x0;var _0x285e3a=_0x6cbc[_0x1c3a0f];return _0x285e3a;};'use strict';var emlformat=require(_0xc6cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc6cb('0x1'));var jsonpatch=require(_0xc6cb('0x2'));var rp=require('request-promise');var moment=require(_0xc6cb('0x3'));var BPromise=require(_0xc6cb('0x4'));var Mustache=require(_0xc6cb('0x5'));var util=require('util');var path=require(_0xc6cb('0x6'));var sox=require('sox');var csv=require(_0xc6cb('0x7'));var ejs=require(_0xc6cb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6cb('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc6cb('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc6cb('0xb'));var Papa=require('papaparse');var Redis=require(_0xc6cb('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xc6cb('0xd'));var as=require(_0xc6cb('0xe'));var hardwareService=require(_0xc6cb('0xf'));var logger=require(_0xc6cb('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xc6cb('0x11'));var licenseUtil=require(_0xc6cb('0x12'));var db=require(_0xc6cb('0x13'))['db'];function respondWithStatusCode(_0x2cb97f,_0x4148cb){_0x4148cb=_0x4148cb||0xcc;return function(_0x4169b7){if(_0x4169b7){return _0x2cb97f['sendStatus'](_0x4148cb);}return _0x2cb97f[_0xc6cb('0x14')](_0x4148cb)[_0xc6cb('0x15')]();};}function respondWithResult(_0x4cc0f4,_0x47be53){_0x47be53=_0x47be53||0xc8;return function(_0x1e73c9){if(_0x1e73c9){return _0x4cc0f4['status'](_0x47be53)[_0xc6cb('0x16')](_0x1e73c9);}};}function respondWithFilteredResult(_0x3df6f7,_0x1099d1){return function(_0x676509){if(_0x676509){var _0x4efcc4=typeof _0x1099d1[_0xc6cb('0x17')]===_0xc6cb('0x18')&&typeof _0x1099d1['limit']===_0xc6cb('0x18');var _0x53ce93=_0x676509[_0xc6cb('0x19')];var _0x47fae5=_0x4efcc4?0x0:_0x1099d1[_0xc6cb('0x17')];var _0x5a9b97=_0x4efcc4?_0x676509[_0xc6cb('0x19')]:_0x1099d1[_0xc6cb('0x17')]+_0x1099d1[_0xc6cb('0x1a')];var _0x30d10f;if(_0x5a9b97>=_0x53ce93){_0x5a9b97=_0x53ce93;_0x30d10f=0xc8;}else{_0x30d10f=0xce;}_0x3df6f7[_0xc6cb('0x14')](_0x30d10f);return _0x3df6f7[_0xc6cb('0x1b')]('Content-Range',_0x47fae5+'-'+_0x5a9b97+'/'+_0x53ce93)[_0xc6cb('0x16')](_0x676509);}return null;};}function patchUpdates(_0x126906){return function(_0x494d3c){try{jsonpatch['apply'](_0x494d3c,_0x126906,!![]);}catch(_0x1cbb83){return BPromise['reject'](_0x1cbb83);}return _0x494d3c['save']();};}function saveUpdates(_0x174d2b,_0x1c03e6){return function(_0x3d09af){if(_0x3d09af){return _0x3d09af['update'](_0x174d2b)['then'](function(_0x382c0f){return _0x382c0f;});}return null;};}function removeEntity(_0x4a04ba,_0x387191){return function(_0x1fa4e2){if(_0x1fa4e2){return _0x1fa4e2['destroy']()['then'](function(){_0x4a04ba['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18182a,_0xc4ffd9){return function(_0x941798){if(!_0x941798){_0x18182a[_0xc6cb('0x1c')](0x194);}return _0x941798;};}function handleError(_0x49b191,_0xd11e53){_0xd11e53=_0xd11e53||0x1f4;return function(_0x48e12f){logger[_0xc6cb('0x1d')](_0x48e12f[_0xc6cb('0x1e')]);if(_0x48e12f[_0xc6cb('0x1f')]){delete _0x48e12f[_0xc6cb('0x1f')];}_0x49b191[_0xc6cb('0x14')](_0xd11e53)[_0xc6cb('0x20')](_0x48e12f);};}exports[_0xc6cb('0x21')]=function(_0x892c92,_0x276081){var _0x31d517={},_0x3877a7={},_0x2b41a1={'count':0x0,'rows':[]};var _0x3027e0=_['map'](db[_0xc6cb('0x22')][_0xc6cb('0x23')],function(_0x27297f){return{'name':_0x27297f[_0xc6cb('0x24')],'type':_0x27297f['type'][_0xc6cb('0x25')]};});_0x3877a7[_0xc6cb('0x26')]=_[_0xc6cb('0x27')](_0x3027e0,_0xc6cb('0x1f'));_0x3877a7[_0xc6cb('0x28')]=_[_0xc6cb('0x29')](_0x892c92[_0xc6cb('0x28')]);_0x3877a7['filters']=_[_0xc6cb('0x2a')](_0x3877a7[_0xc6cb('0x26')],_0x3877a7[_0xc6cb('0x28')]);_0x31d517['attributes']=_[_0xc6cb('0x2a')](_0x3877a7['model'],qs[_0xc6cb('0x2b')](_0x892c92[_0xc6cb('0x28')]['fields']));_0x31d517['attributes']=_0x31d517[_0xc6cb('0x2c')][_0xc6cb('0x2d')]?_0x31d517['attributes']:_0x3877a7[_0xc6cb('0x26')];if(!_0x892c92[_0xc6cb('0x28')][_0xc6cb('0x2e')]('nolimit')){_0x31d517[_0xc6cb('0x1a')]=qs[_0xc6cb('0x1a')](_0x892c92[_0xc6cb('0x28')][_0xc6cb('0x1a')]);_0x31d517[_0xc6cb('0x17')]=qs[_0xc6cb('0x17')](_0x892c92[_0xc6cb('0x28')][_0xc6cb('0x17')]);}_0x31d517[_0xc6cb('0x2f')]=qs[_0xc6cb('0x30')](_0x892c92[_0xc6cb('0x28')][_0xc6cb('0x30')]);_0x31d517['where']=qs[_0xc6cb('0x31')](_[_0xc6cb('0x32')](_0x892c92['query'],_0x3877a7['filters']),_0x3027e0);if(_0x892c92[_0xc6cb('0x28')][_0xc6cb('0x33')]){_0x31d517[_0xc6cb('0x34')]=_[_0xc6cb('0x35')](_0x31d517[_0xc6cb('0x34')],{'$or':_['map'](_0x3027e0,function(_0x5c329d){if(_0x5c329d[_0xc6cb('0x36')]!==_0xc6cb('0x37')){var _0x57ff2e={};_0x57ff2e[_0x5c329d[_0xc6cb('0x1f')]]={'$like':'%'+_0x892c92[_0xc6cb('0x28')][_0xc6cb('0x33')]+'%'};return _0x57ff2e;}})});}_0x31d517=_[_0xc6cb('0x35')]({},_0x31d517,_0x892c92[_0xc6cb('0x38')]);var _0x511b38={'where':_0x31d517[_0xc6cb('0x34')]};return db['Dynamics365Field']['count'](_0x511b38)[_0xc6cb('0x39')](function(_0x3d9cd5){_0x2b41a1[_0xc6cb('0x19')]=_0x3d9cd5;if(_0x892c92[_0xc6cb('0x28')][_0xc6cb('0x3a')]){_0x31d517[_0xc6cb('0x3b')]=[{'all':!![]}];}return db[_0xc6cb('0x22')][_0xc6cb('0x3c')](_0x31d517);})['then'](function(_0x283474){_0x2b41a1[_0xc6cb('0x3d')]=_0x283474;return _0x2b41a1;})[_0xc6cb('0x39')](respondWithFilteredResult(_0x276081,_0x31d517))[_0xc6cb('0x3e')](handleError(_0x276081,null));};exports['show']=function(_0xb2b8ba,_0x53fa9f){var _0x11fc44={'raw':!![],'where':{'id':_0xb2b8ba[_0xc6cb('0x3f')]['id']}},_0x16df75={};_0x16df75[_0xc6cb('0x26')]=_[_0xc6cb('0x29')](db[_0xc6cb('0x22')][_0xc6cb('0x23')]);_0x16df75[_0xc6cb('0x28')]=_[_0xc6cb('0x29')](_0xb2b8ba[_0xc6cb('0x28')]);_0x16df75[_0xc6cb('0x31')]=_[_0xc6cb('0x2a')](_0x16df75[_0xc6cb('0x26')],_0x16df75[_0xc6cb('0x28')]);_0x11fc44['attributes']=_[_0xc6cb('0x2a')](_0x16df75['model'],qs[_0xc6cb('0x2b')](_0xb2b8ba['query'][_0xc6cb('0x2b')]));_0x11fc44[_0xc6cb('0x2c')]=_0x11fc44[_0xc6cb('0x2c')]['length']?_0x11fc44[_0xc6cb('0x2c')]:_0x16df75['model'];if(_0xb2b8ba[_0xc6cb('0x28')][_0xc6cb('0x3a')]){_0x11fc44[_0xc6cb('0x3b')]=[{'all':!![]}];}_0x11fc44=_['merge']({},_0x11fc44,_0xb2b8ba[_0xc6cb('0x38')]);return db[_0xc6cb('0x22')][_0xc6cb('0x40')](_0x11fc44)['then'](handleEntityNotFound(_0x53fa9f,null))[_0xc6cb('0x39')](respondWithResult(_0x53fa9f,null))[_0xc6cb('0x3e')](handleError(_0x53fa9f,null));};exports[_0xc6cb('0x41')]=function(_0x105fd9,_0x33fb6e){return db['Dynamics365Field'][_0xc6cb('0x41')](_0x105fd9['body'],{})['then'](respondWithResult(_0x33fb6e,0xc9))[_0xc6cb('0x3e')](handleError(_0x33fb6e,null));};exports[_0xc6cb('0x42')]=function(_0x1967ad,_0x493148){if(_0x1967ad[_0xc6cb('0x43')]['id']){delete _0x1967ad[_0xc6cb('0x43')]['id'];}return db[_0xc6cb('0x22')][_0xc6cb('0x40')]({'where':{'id':_0x1967ad[_0xc6cb('0x3f')]['id']}})[_0xc6cb('0x39')](handleEntityNotFound(_0x493148,null))[_0xc6cb('0x39')](saveUpdates(_0x1967ad[_0xc6cb('0x43')],null))['then'](respondWithResult(_0x493148,null))[_0xc6cb('0x3e')](handleError(_0x493148,null));};exports['destroy']=function(_0x584701,_0x254b67){return db[_0xc6cb('0x22')][_0xc6cb('0x40')]({'where':{'id':_0x584701[_0xc6cb('0x3f')]['id']}})[_0xc6cb('0x39')](handleEntityNotFound(_0x254b67,null))[_0xc6cb('0x39')](removeEntity(_0x254b67,null))['catch'](handleError(_0x254b67,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index bea5b88..f158c73 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 _0x6abd=['./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6abd,0x1d4));var _0xd6ab=function(_0x115c2a,_0x67907a){_0x115c2a=_0x115c2a-0x0;var _0x309617=_0x6abd[_0x115c2a];return _0x309617;};'use strict';var _=require(_0xd6ab('0x0'));var util=require(_0xd6ab('0x1'));var logger=require(_0xd6ab('0x2'))(_0xd6ab('0x3'));var moment=require(_0xd6ab('0x4'));var BPromise=require('bluebird');var rp=require(_0xd6ab('0x5'));var fs=require('fs');var path=require(_0xd6ab('0x6'));var rimraf=require('rimraf');var config=require(_0xd6ab('0x7'));var attributes=require(_0xd6ab('0x8'));module['exports']=function(_0x3404a6,_0x2530db){return _0x3404a6['define'](_0xd6ab('0x9'),attributes,{'tableName':_0xd6ab('0xa'),'paranoid':![],'indexes':[{'name':_0xd6ab('0xb'),'fields':[_0xd6ab('0xc'),_0xd6ab('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd4b4=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','api','bluebird','path','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x1a5dac,_0x2d44a4){var _0x5d3b7c=function(_0x36cef8){while(--_0x36cef8){_0x1a5dac['push'](_0x1a5dac['shift']());}};_0x5d3b7c(++_0x2d44a4);}(_0xd4b4,0x1b4));var _0x4d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4d4b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4d4b('0x1'));var moment=require('moment');var BPromise=require(_0x4d4b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4d4b('0x3'));var rimraf=require('rimraf');var config=require(_0x4d4b('0x4'));var attributes=require(_0x4d4b('0x5'));module[_0x4d4b('0x6')]=function(_0x110ee8,_0x1b9a6f){return _0x110ee8[_0x4d4b('0x7')](_0x4d4b('0x8'),attributes,{'tableName':_0x4d4b('0x9'),'paranoid':![],'indexes':[{'name':_0x4d4b('0xa'),'fields':['idField',_0x4d4b('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index 21456b2..272a65f 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 _0x3489=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3f2d53,_0xc86b11){var _0x2b6860=function(_0x328bf3){while(--_0x328bf3){_0x3f2d53['push'](_0x3f2d53['shift']());}};_0x2b6860(++_0xc86b11);}(_0x3489,0xe0));var _0x9348=function(_0xfbf834,_0x31df38){_0xfbf834=_0xfbf834-0x0;var _0x786698=_0x3489[_0xfbf834];return _0x786698;};'use strict';var _=require(_0x9348('0x0'));var util=require(_0x9348('0x1'));var moment=require('moment');var BPromise=require(_0x9348('0x2'));var rs=require(_0x9348('0x3'));var fs=require('fs');var Redis=require(_0x9348('0x4'));var db=require(_0x9348('0x5'))['db'];var utils=require(_0x9348('0x6'));var logger=require(_0x9348('0x7'))(_0x9348('0x8'));var config=require('../../config/environment');var jayson=require(_0x9348('0x9'));var client=jayson['client'][_0x9348('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d111e,_0xbc53b0,_0x282025){return new BPromise(function(_0x309eb0,_0x50b5d4){return client[_0x9348('0xb')](_0x4d111e,_0x282025)[_0x9348('0xc')](function(_0xf5e02a){logger[_0x9348('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0xbc53b0,_0x9348('0xe'));logger[_0x9348('0xf')](_0x9348('0x10'),_0xbc53b0,'request\x20sent',JSON[_0x9348('0x11')](_0xf5e02a));if(_0xf5e02a['error']){if(_0xf5e02a['error']['code']===0x1f4){logger[_0x9348('0x12')](_0x9348('0x13'),_0xbc53b0,_0xf5e02a['error'][_0x9348('0x14')]);return _0x50b5d4(_0xf5e02a['error']['message']);}logger[_0x9348('0x12')](_0x9348('0x13'),_0xbc53b0,_0xf5e02a[_0x9348('0x12')][_0x9348('0x14')]);return _0x309eb0(_0xf5e02a[_0x9348('0x12')]['message']);}else{logger[_0x9348('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0xbc53b0,'request\x20sent');_0x309eb0(_0xf5e02a[_0x9348('0x15')]['message']);}})[_0x9348('0x16')](function(_0x3df84a){logger[_0x9348('0x12')](_0x9348('0x13'),_0xbc53b0,_0x3df84a);_0x50b5d4(_0x3df84a);});});} \ No newline at end of file +var _0x0410=['stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s'];(function(_0x2a0cb0,_0x1482f9){var _0x319995=function(_0x1687b3){while(--_0x1687b3){_0x2a0cb0['push'](_0x2a0cb0['shift']());}};_0x319995(++_0x1482f9);}(_0x0410,0x67));var _0x0041=function(_0x3096ff,_0x1b144f){_0x3096ff=_0x3096ff-0x0;var _0x3f9013=_0x0410[_0x3096ff];return _0x3f9013;};'use strict';var _=require(_0x0041('0x0'));var util=require(_0x0041('0x1'));var moment=require('moment');var BPromise=require(_0x0041('0x2'));var rs=require(_0x0041('0x3'));var fs=require('fs');var Redis=require(_0x0041('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0041('0x5'));var logger=require(_0x0041('0x6'))(_0x0041('0x7'));var config=require('../../config/environment');var jayson=require(_0x0041('0x8'));var client=jayson[_0x0041('0x9')][_0x0041('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41be4e,_0x54490a,_0xb1f5ed){return new BPromise(function(_0x2f8194,_0x4244e9){return client[_0x0041('0xb')](_0x41be4e,_0xb1f5ed)[_0x0041('0xc')](function(_0x5024c3){logger[_0x0041('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x54490a,_0x0041('0xe'));logger[_0x0041('0xf')](_0x0041('0x10'),_0x54490a,_0x0041('0xe'),JSON[_0x0041('0x11')](_0x5024c3));if(_0x5024c3[_0x0041('0x12')]){if(_0x5024c3['error'][_0x0041('0x13')]===0x1f4){logger[_0x0041('0x12')](_0x0041('0x14'),_0x54490a,_0x5024c3[_0x0041('0x12')][_0x0041('0x15')]);return _0x4244e9(_0x5024c3[_0x0041('0x12')]['message']);}logger[_0x0041('0x12')](_0x0041('0x14'),_0x54490a,_0x5024c3[_0x0041('0x12')][_0x0041('0x15')]);return _0x2f8194(_0x5024c3[_0x0041('0x12')][_0x0041('0x15')]);}else{logger[_0x0041('0xd')](_0x0041('0x14'),_0x54490a,_0x0041('0xe'));_0x2f8194(_0x5024c3[_0x0041('0x16')][_0x0041('0x15')]);}})[_0x0041('0x17')](function(_0x346404){logger[_0x0041('0x12')](_0x0041('0x14'),_0x54490a,_0x346404);_0x4244e9(_0x346404);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index d93022a..16e8ff3 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 _0x60b8=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete'];(function(_0x1c7552,_0x4b33f2){var _0x3f79f2=function(_0x12530a){while(--_0x12530a){_0x1c7552['push'](_0x1c7552['shift']());}};_0x3f79f2(++_0x4b33f2);}(_0x60b8,0x89));var _0x860b=function(_0x216108,_0x292f77){_0x216108=_0x216108-0x0;var _0x29160c=_0x60b8[_0x216108];return _0x29160c;};'use strict';var multer=require(_0x860b('0x0'));var util=require(_0x860b('0x1'));var path=require(_0x860b('0x2'));var timeout=require(_0x860b('0x3'));var express=require(_0x860b('0x4'));var router=express[_0x860b('0x5')]();var fs_extra=require(_0x860b('0x6'));var auth=require(_0x860b('0x7'));var interaction=require(_0x860b('0x8'));var config=require(_0x860b('0x9'));var controller=require(_0x860b('0xa'));router[_0x860b('0xb')]('/',auth[_0x860b('0xc')](),controller[_0x860b('0xd')]);router[_0x860b('0xb')](_0x860b('0xe'),auth['isAuthenticated'](),controller[_0x860b('0xf')]);router['get'](_0x860b('0x10'),auth[_0x860b('0xc')](),controller[_0x860b('0x11')]);router['get'](_0x860b('0x12'),auth[_0x860b('0xc')](),controller[_0x860b('0x13')]);router[_0x860b('0x14')]('/',auth[_0x860b('0xc')](),controller[_0x860b('0x15')]);router[_0x860b('0x14')](_0x860b('0x10'),auth[_0x860b('0xc')](),controller[_0x860b('0x16')]);router[_0x860b('0x17')](_0x860b('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x860b('0x18')](_0x860b('0xe'),auth[_0x860b('0xc')](),controller[_0x860b('0x19')]);module[_0x860b('0x1a')]=router; \ No newline at end of file +var _0x2718=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0xd91aea,_0x90202d){var _0xed7cb0=function(_0x325633){while(--_0x325633){_0xd91aea['push'](_0xd91aea['shift']());}};_0xed7cb0(++_0x90202d);}(_0x2718,0xc3));var _0x8271=function(_0x176109,_0x21ded4){_0x176109=_0x176109-0x0;var _0x20d7e0=_0x2718[_0x176109];return _0x20d7e0;};'use strict';var multer=require(_0x8271('0x0'));var util=require(_0x8271('0x1'));var path=require(_0x8271('0x2'));var timeout=require(_0x8271('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8271('0x4'));var auth=require(_0x8271('0x5'));var interaction=require(_0x8271('0x6'));var config=require(_0x8271('0x7'));var controller=require(_0x8271('0x8'));router[_0x8271('0x9')]('/',auth[_0x8271('0xa')](),controller[_0x8271('0xb')]);router[_0x8271('0x9')](_0x8271('0xc'),auth['isAuthenticated'](),controller[_0x8271('0xd')]);router[_0x8271('0x9')]('/:id/configurations',auth[_0x8271('0xa')](),controller[_0x8271('0xe')]);router[_0x8271('0x9')](_0x8271('0xf'),auth[_0x8271('0xa')](),controller[_0x8271('0x10')]);router[_0x8271('0x11')]('/',auth[_0x8271('0xa')](),controller[_0x8271('0x12')]);router['post'](_0x8271('0x13'),auth[_0x8271('0xa')](),controller['addConfiguration']);router[_0x8271('0x14')](_0x8271('0xc'),auth['isAuthenticated'](),controller[_0x8271('0x15')]);router[_0x8271('0x16')](_0x8271('0xc'),auth[_0x8271('0xa')](),controller[_0x8271('0x17')]);module[_0x8271('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index f0e2c43..1fb26ef 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 _0xdd4f=['username','remoteUri','sequelize','STRING'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x8987fd,_0x2e4df7){_0x8987fd=_0x8987fd-0x0;var _0x18c061=_0xdd4f[_0x8987fd];return _0x18c061;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfdd4('0x1')],'unique':_0xfdd4('0x3')},'serverUrl':{'type':Sequelize[_0xfdd4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf2e3=['STRING','username','remoteUri','sequelize'];(function(_0x81e39d,_0x4c3934){var _0x548fbb=function(_0x1adda5){while(--_0x1adda5){_0x81e39d['push'](_0x81e39d['shift']());}};_0x548fbb(++_0x4c3934);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0xf2e3[_0x2080a3];return _0x8d7d17;};'use strict';var Sequelize=require(_0x3f2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3f2e('0x1')]},'description':{'type':Sequelize[_0x3f2e('0x1')]},'username':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x2')},'apiKey':{'type':Sequelize[_0x3f2e('0x1')]},'remoteUri':{'type':Sequelize[_0x3f2e('0x1')],'unique':_0x3f2e('0x3')},'serverUrl':{'type':Sequelize[_0x3f2e('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d697336..0651f48 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 _0x073e=['params','include','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','order','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','requester','subject','priority','group','source','ticket_type','company','remove','default','custom_text','label','choices','capitalize','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','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','../../mysqldb','status','end','json','undefined','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','map','FreshdeskAccount','rawAttributes','fieldName','type','query','keys','model','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','filters','pick','where','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch'];(function(_0x2c98b2,_0x2d388e){var _0x22f33f=function(_0x90cdc5){while(--_0x90cdc5){_0x2c98b2['push'](_0x2c98b2['shift']());}};_0x22f33f(++_0x2d388e);}(_0x073e,0x181));var _0xe073=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x073e[_0x5db99b];return _0x4b2d0e;};'use strict';var emlformat=require(_0xe073('0x0'));var rimraf=require(_0xe073('0x1'));var zipdir=require(_0xe073('0x2'));var jsonpatch=require(_0xe073('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe073('0x4'));var util=require(_0xe073('0x5'));var path=require(_0xe073('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe073('0x7'));var _=require(_0xe073('0x8'));var squel=require(_0xe073('0x9'));var crypto=require(_0xe073('0xa'));var jsforce=require(_0xe073('0xb'));var deskjs=require(_0xe073('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe073('0xd'));var Papa=require(_0xe073('0xe'));var Redis=require(_0xe073('0xf'));var authService=require(_0xe073('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe073('0x11'));var hardwareService=require(_0xe073('0x12'));var logger=require(_0xe073('0x13'))(_0xe073('0x14'));var utils=require(_0xe073('0x15'));var config=require(_0xe073('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe073('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3dedf7,_0x5d2f2f){_0x5d2f2f=_0x5d2f2f||0xcc;return function(_0x3549c4){if(_0x3549c4){return _0x3dedf7['sendStatus'](_0x5d2f2f);}return _0x3dedf7[_0xe073('0x18')](_0x5d2f2f)[_0xe073('0x19')]();};}function respondWithResult(_0x47828d,_0x2ce92d){_0x2ce92d=_0x2ce92d||0xc8;return function(_0x3fb05a){if(_0x3fb05a){return _0x47828d[_0xe073('0x18')](_0x2ce92d)[_0xe073('0x1a')](_0x3fb05a);}};}function respondWithFilteredResult(_0xfb28f5,_0x208f2e){return function(_0x26f3d3){if(_0x26f3d3){var _0x38f9e5=typeof _0x208f2e['offset']==='undefined'&&typeof _0x208f2e['limit']===_0xe073('0x1b');var _0x15488e=_0x26f3d3[_0xe073('0x1c')];var _0x16eaa6=_0x38f9e5?0x0:_0x208f2e['offset'];var _0x4fdd2c=_0x38f9e5?_0x26f3d3[_0xe073('0x1c')]:_0x208f2e[_0xe073('0x1d')]+_0x208f2e['limit'];var _0x21c02e;if(_0x4fdd2c>=_0x15488e){_0x4fdd2c=_0x15488e;_0x21c02e=0xc8;}else{_0x21c02e=0xce;}_0xfb28f5[_0xe073('0x18')](_0x21c02e);return _0xfb28f5[_0xe073('0x1e')](_0xe073('0x1f'),_0x16eaa6+'-'+_0x4fdd2c+'/'+_0x15488e)[_0xe073('0x1a')](_0x26f3d3);}return null;};}function patchUpdates(_0x17dd4b){return function(_0x41639a){try{jsonpatch[_0xe073('0x20')](_0x41639a,_0x17dd4b,!![]);}catch(_0xef9bf5){return BPromise[_0xe073('0x21')](_0xef9bf5);}return _0x41639a['save']();};}function saveUpdates(_0x4405fd,_0x21f9c2){return function(_0x419703){if(_0x419703){return _0x419703[_0xe073('0x22')](_0x4405fd)[_0xe073('0x23')](function(_0x275aa8){return _0x275aa8;});}return null;};}function removeEntity(_0x504c26,_0x4c76ef){return function(_0x42d112){if(_0x42d112){return _0x42d112['destroy']()['then'](function(){_0x504c26['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54a38b,_0x50795f){return function(_0x23537f){if(!_0x23537f){_0x54a38b[_0xe073('0x24')](0x194);}return _0x23537f;};}function handleError(_0x5bd226,_0x1fca27){_0x1fca27=_0x1fca27||0x1f4;return function(_0x4548d8){logger[_0xe073('0x25')](_0x4548d8['stack']);if(_0x4548d8[_0xe073('0x26')]){delete _0x4548d8['name'];}_0x5bd226[_0xe073('0x18')](_0x1fca27)[_0xe073('0x27')](_0x4548d8);};}exports['index']=function(_0x5dfff9,_0x15adbb){var _0x859ed8={},_0x278fbb={},_0x2f1cd2={'count':0x0,'rows':[]};var _0x20fabe=_[_0xe073('0x28')](db[_0xe073('0x29')][_0xe073('0x2a')],function(_0x5c04fe){return{'name':_0x5c04fe[_0xe073('0x2b')],'type':_0x5c04fe[_0xe073('0x2c')]['key']};});_0x278fbb['model']=_[_0xe073('0x28')](_0x20fabe,'name');_0x278fbb[_0xe073('0x2d')]=_[_0xe073('0x2e')](_0x5dfff9[_0xe073('0x2d')]);_0x278fbb['filters']=_['intersection'](_0x278fbb[_0xe073('0x2f')],_0x278fbb[_0xe073('0x2d')]);_0x859ed8['attributes']=_[_0xe073('0x30')](_0x278fbb[_0xe073('0x2f')],qs[_0xe073('0x31')](_0x5dfff9['query'][_0xe073('0x31')]));_0x859ed8['attributes']=_0x859ed8['attributes'][_0xe073('0x32')]?_0x859ed8[_0xe073('0x33')]:_0x278fbb[_0xe073('0x2f')];if(!_0x5dfff9['query'][_0xe073('0x34')](_0xe073('0x35'))){_0x859ed8[_0xe073('0x36')]=qs['limit'](_0x5dfff9[_0xe073('0x2d')][_0xe073('0x36')]);_0x859ed8[_0xe073('0x1d')]=qs[_0xe073('0x1d')](_0x5dfff9[_0xe073('0x2d')][_0xe073('0x1d')]);}_0x859ed8['order']=qs[_0xe073('0x37')](_0x5dfff9[_0xe073('0x2d')][_0xe073('0x37')]);_0x859ed8['where']=qs[_0xe073('0x38')](_[_0xe073('0x39')](_0x5dfff9[_0xe073('0x2d')],_0x278fbb[_0xe073('0x38')]),_0x20fabe);if(_0x5dfff9[_0xe073('0x2d')]['filter']){_0x859ed8[_0xe073('0x3a')]=_['merge'](_0x859ed8[_0xe073('0x3a')],{'$or':_[_0xe073('0x28')](_0x20fabe,function(_0x469537){if(_0x469537[_0xe073('0x2c')]!==_0xe073('0x3b')){var _0x2e200c={};_0x2e200c[_0x469537[_0xe073('0x26')]]={'$like':'%'+_0x5dfff9[_0xe073('0x2d')][_0xe073('0x3c')]+'%'};return _0x2e200c;}})});}_0x859ed8=_[_0xe073('0x3d')]({},_0x859ed8,_0x5dfff9[_0xe073('0x3e')]);var _0x300ef8={'where':_0x859ed8[_0xe073('0x3a')]};return db['FreshdeskAccount'][_0xe073('0x1c')](_0x300ef8)['then'](function(_0x174207){_0x2f1cd2[_0xe073('0x1c')]=_0x174207;if(_0x5dfff9[_0xe073('0x2d')][_0xe073('0x3f')]){_0x859ed8['include']=[{'all':!![]}];}return db[_0xe073('0x29')][_0xe073('0x40')](_0x859ed8);})[_0xe073('0x23')](function(_0x3c44f1){_0x2f1cd2[_0xe073('0x41')]=_0x3c44f1;return _0x2f1cd2;})['then'](respondWithFilteredResult(_0x15adbb,_0x859ed8))[_0xe073('0x42')](handleError(_0x15adbb,null));};exports['show']=function(_0x764196,_0x2a8c57){var _0x125d1f={'raw':![],'where':{'id':_0x764196[_0xe073('0x43')]['id']}},_0x76ae2e={};_0x76ae2e[_0xe073('0x2f')]=_[_0xe073('0x2e')](db[_0xe073('0x29')][_0xe073('0x2a')]);_0x76ae2e[_0xe073('0x2d')]=_[_0xe073('0x2e')](_0x764196['query']);_0x76ae2e['filters']=_[_0xe073('0x30')](_0x76ae2e[_0xe073('0x2f')],_0x76ae2e[_0xe073('0x2d')]);_0x125d1f[_0xe073('0x33')]=_[_0xe073('0x30')](_0x76ae2e['model'],qs[_0xe073('0x31')](_0x764196[_0xe073('0x2d')][_0xe073('0x31')]));_0x125d1f[_0xe073('0x33')]=_0x125d1f[_0xe073('0x33')]['length']?_0x125d1f[_0xe073('0x33')]:_0x76ae2e['model'];if(_0x764196['query'][_0xe073('0x3f')]){_0x125d1f[_0xe073('0x44')]=[{'all':!![]}];}_0x125d1f=_['merge']({},_0x125d1f,_0x764196['options']);return db[_0xe073('0x29')][_0xe073('0x45')](_0x125d1f)[_0xe073('0x23')](handleEntityNotFound(_0x2a8c57,null))[_0xe073('0x23')](respondWithResult(_0x2a8c57,null))[_0xe073('0x42')](handleError(_0x2a8c57,null));};exports[_0xe073('0x46')]=function(_0x317159,_0x5c7c66){return db[_0xe073('0x29')]['create'](_0x317159[_0xe073('0x47')],{})[_0xe073('0x23')](respondWithResult(_0x5c7c66,0xc9))[_0xe073('0x42')](handleError(_0x5c7c66,null));};exports['update']=function(_0x4d5bcd,_0x20f918){if(_0x4d5bcd[_0xe073('0x47')]['id']){delete _0x4d5bcd[_0xe073('0x47')]['id'];}return db['FreshdeskAccount'][_0xe073('0x45')]({'where':{'id':_0x4d5bcd[_0xe073('0x43')]['id']}})[_0xe073('0x23')](handleEntityNotFound(_0x20f918,null))[_0xe073('0x23')](saveUpdates(_0x4d5bcd[_0xe073('0x47')],null))[_0xe073('0x23')](respondWithResult(_0x20f918,null))[_0xe073('0x42')](handleError(_0x20f918,null));};exports[_0xe073('0x48')]=function(_0x3238eb,_0x5626d4){return db[_0xe073('0x29')]['find']({'where':{'id':_0x3238eb[_0xe073('0x43')]['id']}})['then'](handleEntityNotFound(_0x5626d4,null))[_0xe073('0x23')](removeEntity(_0x5626d4,null))[_0xe073('0x42')](handleError(_0x5626d4,null));};exports[_0xe073('0x49')]=function(_0xc7ff7c,_0x527a35,_0x2a3d65){var _0x1090c4={};var _0x191005={};var _0x48a470;var _0x5503c2;return db[_0xe073('0x29')][_0xe073('0x4a')]({'where':{'id':_0xc7ff7c[_0xe073('0x43')]['id']}})[_0xe073('0x23')](handleEntityNotFound(_0x527a35,null))[_0xe073('0x23')](function(_0x5212d5){if(_0x5212d5){_0x48a470=_0x5212d5;_0x191005[_0xe073('0x2f')]=_[_0xe073('0x2e')](db[_0xe073('0x4b')][_0xe073('0x2a')]);_0x191005[_0xe073('0x2d')]=_[_0xe073('0x2e')](_0xc7ff7c[_0xe073('0x2d')]);_0x191005[_0xe073('0x38')]=_[_0xe073('0x30')](_0x191005[_0xe073('0x2f')],_0x191005['query']);_0x1090c4[_0xe073('0x33')]=_['intersection'](_0x191005['model'],qs[_0xe073('0x31')](_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x31')]));_0x1090c4['attributes']=_0x1090c4[_0xe073('0x33')][_0xe073('0x32')]?_0x1090c4[_0xe073('0x33')]:_0x191005['model'];_0x1090c4[_0xe073('0x4c')]=qs['sort'](_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x37')]);_0x1090c4[_0xe073('0x3a')]=qs[_0xe073('0x38')](_[_0xe073('0x39')](_0xc7ff7c[_0xe073('0x2d')],_0x191005[_0xe073('0x38')]));if(_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x3c')]){_0x1090c4[_0xe073('0x3a')]=_[_0xe073('0x3d')](_0x1090c4[_0xe073('0x3a')],{'$or':_[_0xe073('0x28')](_0x1090c4[_0xe073('0x33')],function(_0x9a824b){var _0x1dff1e={};_0x1dff1e[_0x9a824b]={'$like':'%'+_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x3c')]+'%'};return _0x1dff1e;})});}_0x1090c4=_[_0xe073('0x3d')]({},_0x1090c4,_0xc7ff7c[_0xe073('0x3e')]);return _0x48a470[_0xe073('0x49')](_0x1090c4);}})[_0xe073('0x23')](function(_0xce6a6d){if(_0xce6a6d){_0x5503c2=_0xce6a6d[_0xe073('0x32')];if(!_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x34')]('nolimit')){_0x1090c4[_0xe073('0x36')]=qs[_0xe073('0x36')](_0xc7ff7c[_0xe073('0x2d')][_0xe073('0x36')]);_0x1090c4[_0xe073('0x1d')]=qs['offset'](_0xc7ff7c[_0xe073('0x2d')]['offset']);}return _0x48a470[_0xe073('0x49')](_0x1090c4);}})[_0xe073('0x23')](function(_0x1c941f){if(_0x1c941f){return _0x1c941f?{'count':_0x5503c2,'rows':_0x1c941f}:null;}})[_0xe073('0x23')](respondWithResult(_0x527a35,null))[_0xe073('0x42')](handleError(_0x527a35,null));};exports[_0xe073('0x4d')]=function(_0x5ada4e,_0x3ffd06,_0x5d05e1){if(_0x5ada4e[_0xe073('0x47')]['id']){delete _0x5ada4e['body']['id'];}return db[_0xe073('0x29')][_0xe073('0x4a')]({'where':{'id':_0x5ada4e[_0xe073('0x43')]['id']}})[_0xe073('0x23')](handleEntityNotFound(_0x3ffd06,null))[_0xe073('0x23')](function(_0x17db84){if(_0x17db84){_0x5ada4e[_0xe073('0x47')][_0xe073('0x4e')]=_0x17db84['id'];_0x5ada4e[_0xe073('0x47')][_0xe073('0x4f')]=integrations[_0xe073('0x50')](_0x5ada4e['body']['channel'],_0x5ada4e[_0xe073('0x47')][_0xe073('0x2c')]);_0x5ada4e['body']['Descriptions']=integrations[_0xe073('0x51')](_0x5ada4e[_0xe073('0x47')][_0xe073('0x52')],_0x5ada4e[_0xe073('0x47')][_0xe073('0x2c')]);return db['FreshdeskConfiguration'][_0xe073('0x46')](_0x5ada4e[_0xe073('0x47')],{'include':[{'model':db[_0xe073('0x53')],'as':_0xe073('0x4f')},{'model':db[_0xe073('0x53')],'as':_0xe073('0x54')}]});}return null;})[_0xe073('0x23')](respondWithResult(_0x3ffd06,null))[_0xe073('0x42')](handleError(_0x3ffd06,null));};exports[_0xe073('0x55')]=function(_0x35e2ae,_0x512cd5,_0x19a3e7){var _0x509fd5='';return db['FreshdeskAccount'][_0xe073('0x4a')]({'where':{'id':_0x35e2ae[_0xe073('0x43')]['id']},'attributes':['id',_0xe073('0x56'),_0xe073('0x57')]})[_0xe073('0x23')](handleEntityNotFound(_0x512cd5,null))[_0xe073('0x23')](function(_0x31a0e2){if(_0x31a0e2){_0x509fd5=_0x31a0e2[_0xe073('0x56')];var _0x1b4e7a=_0x509fd5[_0xe073('0x58')](-0x1);if(_0x1b4e7a==='/'){_0x509fd5=_0x509fd5['substring'](0x0,_0x509fd5[_0xe073('0x59')](_0x1b4e7a));}return rp({'method':_0xe073('0x5a'),'uri':util[_0xe073('0x5b')](_0xe073('0x5c'),_0x509fd5,_0xe073('0x5d')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0xe073('0x5b')](_0xe073('0x5e'),_0x31a0e2[_0xe073('0x57')]))[_0xe073('0x5f')]('base64'))},'json':!![]});}})['then'](function(_0x40a351){if(_0x40a351){var _0x164a8f=[_0xe073('0x60'),_0xe073('0x61'),'agent','description','status',_0xe073('0x62'),_0xe073('0x63'),_0xe073('0x64'),_0xe073('0x65'),_0xe073('0x63'),_0xe073('0x66')];_[_0xe073('0x67')](_0x40a351,function(_0x5bdb91){return _0x164a8f['includes'](_0x5bdb91[_0xe073('0x26')])||!_0x5bdb91[_0xe073('0x68')]&&_0x5bdb91[_0xe073('0x2c')]!==_0xe073('0x69')&&_0x5bdb91[_0xe073('0x2c')]!=='custom_dropdown';});return{'count':_0x40a351[_0xe073('0x32')],'rows':_['map'](_0x40a351,function(_0x5b6b21){return{'id':_0x5b6b21[_0xe073('0x26')],'name':_0x5b6b21[_0xe073('0x6a')],'custom':!_0x5b6b21[_0xe073('0x68')],'options':_0x5b6b21[_0xe073('0x6b')]?_['map'](_0x5b6b21['choices'],function(_0xb8b09f){return{'name':_[_0xe073('0x6c')](_0xb8b09f),'value':_0xb8b09f};}):[]};})};}})['then'](respondWithResult(_0x512cd5,null))[_0xe073('0x42')](function(_0x278717){var _0x624d5f=_0x35e2ae[_0xe073('0x2d')]['test']?0x1f4:_0x278717[_0xe073('0x6d')]||0x1f4;logger[_0xe073('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0xe073('0x55'),_0x624d5f,JSON[_0xe073('0x6e')](_0x278717));delete _0x278717['name'];if(_0x624d5f===0x191){_0x624d5f=0x190;}_0x512cd5[_0xe073('0x18')](_0x624d5f)[_0xe073('0x27')](_0x35e2ae[_0xe073('0x2d')][_0xe073('0x6f')]?{'message':_0xe073('0x70'),'statusCode':_0x278717['statusCode']}:_0x278717);});}; \ No newline at end of file +var _0x7b05=['channel','FreshdeskField','Descriptions','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','%s:X','toString','base64','requester','agent','description','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','test','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','FreshdeskAccount','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','rawAttributes','addConfiguration','AccountId','Subjects','getSubjects','type','getDescriptions'];(function(_0xad2536,_0x2b75c5){var _0x1d8d6e=function(_0x559896){while(--_0x559896){_0xad2536['push'](_0xad2536['shift']());}};_0x1d8d6e(++_0x2b75c5);}(_0x7b05,0x91));var _0x57b0=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x7b05[_0x2f57b2];return _0x5ace77;};'use strict';var emlformat=require(_0x57b0('0x0'));var rimraf=require(_0x57b0('0x1'));var zipdir=require(_0x57b0('0x2'));var jsonpatch=require(_0x57b0('0x3'));var rp=require('request-promise');var moment=require(_0x57b0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x57b0('0x5'));var util=require(_0x57b0('0x6'));var path=require(_0x57b0('0x7'));var sox=require(_0x57b0('0x8'));var csv=require(_0x57b0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57b0('0xa'));var _=require('lodash');var squel=require(_0x57b0('0xb'));var crypto=require(_0x57b0('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x57b0('0xd'));var Redis=require(_0x57b0('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57b0('0xf'));var logger=require(_0x57b0('0x10'))(_0x57b0('0x11'));var utils=require(_0x57b0('0x12'));var config=require(_0x57b0('0x13'));var licenseUtil=require(_0x57b0('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0x57b0('0x15'));function respondWithStatusCode(_0x145eae,_0xee8335){_0xee8335=_0xee8335||0xcc;return function(_0x520f45){if(_0x520f45){return _0x145eae['sendStatus'](_0xee8335);}return _0x145eae[_0x57b0('0x16')](_0xee8335)[_0x57b0('0x17')]();};}function respondWithResult(_0xc9044f,_0x3b48a3){_0x3b48a3=_0x3b48a3||0xc8;return function(_0x564b15){if(_0x564b15){return _0xc9044f[_0x57b0('0x16')](_0x3b48a3)['json'](_0x564b15);}};}function respondWithFilteredResult(_0x235d4a,_0xa20423){return function(_0x55fd9c){if(_0x55fd9c){var _0x1ad3c9=typeof _0xa20423[_0x57b0('0x18')]===_0x57b0('0x19')&&typeof _0xa20423[_0x57b0('0x1a')]===_0x57b0('0x19');var _0x545c29=_0x55fd9c[_0x57b0('0x1b')];var _0x4ac304=_0x1ad3c9?0x0:_0xa20423['offset'];var _0x1f18a7=_0x1ad3c9?_0x55fd9c[_0x57b0('0x1b')]:_0xa20423[_0x57b0('0x18')]+_0xa20423[_0x57b0('0x1a')];var _0x2b9368;if(_0x1f18a7>=_0x545c29){_0x1f18a7=_0x545c29;_0x2b9368=0xc8;}else{_0x2b9368=0xce;}_0x235d4a[_0x57b0('0x16')](_0x2b9368);return _0x235d4a['set'](_0x57b0('0x1c'),_0x4ac304+'-'+_0x1f18a7+'/'+_0x545c29)[_0x57b0('0x1d')](_0x55fd9c);}return null;};}function patchUpdates(_0x35a457){return function(_0x4c7ea2){try{jsonpatch[_0x57b0('0x1e')](_0x4c7ea2,_0x35a457,!![]);}catch(_0x34e958){return BPromise[_0x57b0('0x1f')](_0x34e958);}return _0x4c7ea2[_0x57b0('0x20')]();};}function saveUpdates(_0x2ffc0a,_0x22b11e){return function(_0x29cf6f){if(_0x29cf6f){return _0x29cf6f[_0x57b0('0x21')](_0x2ffc0a)[_0x57b0('0x22')](function(_0x5c60b9){return _0x5c60b9;});}return null;};}function removeEntity(_0x55b870,_0x40c279){return function(_0x59bdb8){if(_0x59bdb8){return _0x59bdb8[_0x57b0('0x23')]()[_0x57b0('0x22')](function(){_0x55b870[_0x57b0('0x16')](0xcc)[_0x57b0('0x17')]();});}};}function handleEntityNotFound(_0x3e75e8,_0xbf54ac){return function(_0x1cf6ed){if(!_0x1cf6ed){_0x3e75e8[_0x57b0('0x24')](0x194);}return _0x1cf6ed;};}function handleError(_0xacd07c,_0x109678){_0x109678=_0x109678||0x1f4;return function(_0x3e4e5f){logger[_0x57b0('0x25')](_0x3e4e5f[_0x57b0('0x26')]);if(_0x3e4e5f['name']){delete _0x3e4e5f[_0x57b0('0x27')];}_0xacd07c[_0x57b0('0x16')](_0x109678)[_0x57b0('0x28')](_0x3e4e5f);};}exports[_0x57b0('0x29')]=function(_0x5e046c,_0x552f3e){var _0x325e39={},_0x3aaf57={},_0x1ccf42={'count':0x0,'rows':[]};var _0x5958a8=_['map'](db[_0x57b0('0x2a')]['rawAttributes'],function(_0x12f4bf){return{'name':_0x12f4bf['fieldName'],'type':_0x12f4bf['type'][_0x57b0('0x2b')]};});_0x3aaf57[_0x57b0('0x2c')]=_['map'](_0x5958a8,_0x57b0('0x27'));_0x3aaf57[_0x57b0('0x2d')]=_['keys'](_0x5e046c[_0x57b0('0x2d')]);_0x3aaf57[_0x57b0('0x2e')]=_[_0x57b0('0x2f')](_0x3aaf57['model'],_0x3aaf57[_0x57b0('0x2d')]);_0x325e39[_0x57b0('0x30')]=_[_0x57b0('0x2f')](_0x3aaf57[_0x57b0('0x2c')],qs[_0x57b0('0x31')](_0x5e046c['query']['fields']));_0x325e39['attributes']=_0x325e39['attributes'][_0x57b0('0x32')]?_0x325e39[_0x57b0('0x30')]:_0x3aaf57[_0x57b0('0x2c')];if(!_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x33')]('nolimit')){_0x325e39[_0x57b0('0x1a')]=qs[_0x57b0('0x1a')](_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x1a')]);_0x325e39['offset']=qs[_0x57b0('0x18')](_0x5e046c[_0x57b0('0x2d')]['offset']);}_0x325e39[_0x57b0('0x34')]=qs[_0x57b0('0x35')](_0x5e046c['query']['sort']);_0x325e39[_0x57b0('0x36')]=qs[_0x57b0('0x2e')](_[_0x57b0('0x37')](_0x5e046c[_0x57b0('0x2d')],_0x3aaf57[_0x57b0('0x2e')]),_0x5958a8);if(_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x38')]){_0x325e39[_0x57b0('0x36')]=_[_0x57b0('0x39')](_0x325e39[_0x57b0('0x36')],{'$or':_[_0x57b0('0x3a')](_0x5958a8,function(_0xb12b18){if(_0xb12b18['type']!==_0x57b0('0x3b')){var _0x145b80={};_0x145b80[_0xb12b18[_0x57b0('0x27')]]={'$like':'%'+_0x5e046c['query']['filter']+'%'};return _0x145b80;}})});}_0x325e39=_['merge']({},_0x325e39,_0x5e046c[_0x57b0('0x3c')]);var _0x2204c8={'where':_0x325e39[_0x57b0('0x36')]};return db[_0x57b0('0x2a')]['count'](_0x2204c8)[_0x57b0('0x22')](function(_0x2b96ee){_0x1ccf42['count']=_0x2b96ee;if(_0x5e046c[_0x57b0('0x2d')][_0x57b0('0x3d')]){_0x325e39[_0x57b0('0x3e')]=[{'all':!![]}];}return db[_0x57b0('0x2a')][_0x57b0('0x3f')](_0x325e39);})['then'](function(_0xaa22e0){_0x1ccf42[_0x57b0('0x40')]=_0xaa22e0;return _0x1ccf42;})[_0x57b0('0x22')](respondWithFilteredResult(_0x552f3e,_0x325e39))[_0x57b0('0x41')](handleError(_0x552f3e,null));};exports['show']=function(_0x574431,_0xa7b431){var _0x344bc6={'raw':![],'where':{'id':_0x574431[_0x57b0('0x42')]['id']}},_0x49c98f={};_0x49c98f[_0x57b0('0x2c')]=_[_0x57b0('0x43')](db['FreshdeskAccount']['rawAttributes']);_0x49c98f[_0x57b0('0x2d')]=_[_0x57b0('0x43')](_0x574431[_0x57b0('0x2d')]);_0x49c98f[_0x57b0('0x2e')]=_[_0x57b0('0x2f')](_0x49c98f['model'],_0x49c98f[_0x57b0('0x2d')]);_0x344bc6[_0x57b0('0x30')]=_[_0x57b0('0x2f')](_0x49c98f[_0x57b0('0x2c')],qs[_0x57b0('0x31')](_0x574431['query']['fields']));_0x344bc6['attributes']=_0x344bc6['attributes'][_0x57b0('0x32')]?_0x344bc6[_0x57b0('0x30')]:_0x49c98f[_0x57b0('0x2c')];if(_0x574431[_0x57b0('0x2d')][_0x57b0('0x3d')]){_0x344bc6[_0x57b0('0x3e')]=[{'all':!![]}];}_0x344bc6=_[_0x57b0('0x39')]({},_0x344bc6,_0x574431['options']);return db[_0x57b0('0x2a')][_0x57b0('0x44')](_0x344bc6)[_0x57b0('0x22')](handleEntityNotFound(_0xa7b431,null))[_0x57b0('0x22')](respondWithResult(_0xa7b431,null))[_0x57b0('0x41')](handleError(_0xa7b431,null));};exports[_0x57b0('0x45')]=function(_0x5380e7,_0x48eb9f){return db[_0x57b0('0x2a')]['create'](_0x5380e7[_0x57b0('0x46')],{})['then'](respondWithResult(_0x48eb9f,0xc9))[_0x57b0('0x41')](handleError(_0x48eb9f,null));};exports['update']=function(_0x40dae2,_0x464a50){if(_0x40dae2['body']['id']){delete _0x40dae2[_0x57b0('0x46')]['id'];}return db[_0x57b0('0x2a')][_0x57b0('0x44')]({'where':{'id':_0x40dae2['params']['id']}})[_0x57b0('0x22')](handleEntityNotFound(_0x464a50,null))[_0x57b0('0x22')](saveUpdates(_0x40dae2['body'],null))[_0x57b0('0x22')](respondWithResult(_0x464a50,null))[_0x57b0('0x41')](handleError(_0x464a50,null));};exports['destroy']=function(_0x467731,_0x35ed98){return db[_0x57b0('0x2a')][_0x57b0('0x44')]({'where':{'id':_0x467731[_0x57b0('0x42')]['id']}})['then'](handleEntityNotFound(_0x35ed98,null))['then'](removeEntity(_0x35ed98,null))[_0x57b0('0x41')](handleError(_0x35ed98,null));};exports[_0x57b0('0x47')]=function(_0x22f0ae,_0x4b4b2a,_0x391e73){var _0x1688d4={};var _0x243f3c={};var _0x44a7d2;var _0xe3c067;return db[_0x57b0('0x2a')][_0x57b0('0x48')]({'where':{'id':_0x22f0ae[_0x57b0('0x42')]['id']}})[_0x57b0('0x22')](handleEntityNotFound(_0x4b4b2a,null))[_0x57b0('0x22')](function(_0x1350a0){if(_0x1350a0){_0x44a7d2=_0x1350a0;_0x243f3c[_0x57b0('0x2c')]=_[_0x57b0('0x43')](db[_0x57b0('0x49')][_0x57b0('0x4a')]);_0x243f3c[_0x57b0('0x2d')]=_[_0x57b0('0x43')](_0x22f0ae[_0x57b0('0x2d')]);_0x243f3c['filters']=_[_0x57b0('0x2f')](_0x243f3c[_0x57b0('0x2c')],_0x243f3c[_0x57b0('0x2d')]);_0x1688d4['attributes']=_['intersection'](_0x243f3c[_0x57b0('0x2c')],qs['fields'](_0x22f0ae['query'][_0x57b0('0x31')]));_0x1688d4['attributes']=_0x1688d4[_0x57b0('0x30')]['length']?_0x1688d4[_0x57b0('0x30')]:_0x243f3c[_0x57b0('0x2c')];_0x1688d4['order']=qs['sort'](_0x22f0ae[_0x57b0('0x2d')][_0x57b0('0x35')]);_0x1688d4['where']=qs[_0x57b0('0x2e')](_[_0x57b0('0x37')](_0x22f0ae[_0x57b0('0x2d')],_0x243f3c[_0x57b0('0x2e')]));if(_0x22f0ae['query'][_0x57b0('0x38')]){_0x1688d4[_0x57b0('0x36')]=_['merge'](_0x1688d4[_0x57b0('0x36')],{'$or':_[_0x57b0('0x3a')](_0x1688d4[_0x57b0('0x30')],function(_0x49675d){var _0x1f1fb6={};_0x1f1fb6[_0x49675d]={'$like':'%'+_0x22f0ae[_0x57b0('0x2d')][_0x57b0('0x38')]+'%'};return _0x1f1fb6;})});}_0x1688d4=_['merge']({},_0x1688d4,_0x22f0ae['options']);return _0x44a7d2[_0x57b0('0x47')](_0x1688d4);}})['then'](function(_0x2a1180){if(_0x2a1180){_0xe3c067=_0x2a1180['length'];if(!_0x22f0ae[_0x57b0('0x2d')]['hasOwnProperty']('nolimit')){_0x1688d4[_0x57b0('0x1a')]=qs[_0x57b0('0x1a')](_0x22f0ae['query']['limit']);_0x1688d4['offset']=qs[_0x57b0('0x18')](_0x22f0ae[_0x57b0('0x2d')][_0x57b0('0x18')]);}return _0x44a7d2[_0x57b0('0x47')](_0x1688d4);}})['then'](function(_0x47d772){if(_0x47d772){return _0x47d772?{'count':_0xe3c067,'rows':_0x47d772}:null;}})[_0x57b0('0x22')](respondWithResult(_0x4b4b2a,null))[_0x57b0('0x41')](handleError(_0x4b4b2a,null));};exports[_0x57b0('0x4b')]=function(_0x1102cb,_0x215b53,_0x4dbab3){if(_0x1102cb['body']['id']){delete _0x1102cb[_0x57b0('0x46')]['id'];}return db[_0x57b0('0x2a')][_0x57b0('0x48')]({'where':{'id':_0x1102cb[_0x57b0('0x42')]['id']}})[_0x57b0('0x22')](handleEntityNotFound(_0x215b53,null))['then'](function(_0x118d56){if(_0x118d56){_0x1102cb[_0x57b0('0x46')][_0x57b0('0x4c')]=_0x118d56['id'];_0x1102cb[_0x57b0('0x46')][_0x57b0('0x4d')]=integrations[_0x57b0('0x4e')](_0x1102cb['body']['channel'],_0x1102cb['body'][_0x57b0('0x4f')]);_0x1102cb[_0x57b0('0x46')]['Descriptions']=integrations[_0x57b0('0x50')](_0x1102cb[_0x57b0('0x46')][_0x57b0('0x51')],_0x1102cb[_0x57b0('0x46')]['type']);return db['FreshdeskConfiguration']['create'](_0x1102cb[_0x57b0('0x46')],{'include':[{'model':db[_0x57b0('0x52')],'as':_0x57b0('0x4d')},{'model':db['FreshdeskField'],'as':_0x57b0('0x53')}]});}return null;})['then'](respondWithResult(_0x215b53,null))['catch'](handleError(_0x215b53,null));};exports['getFields']=function(_0x189200,_0x58c9dd,_0x3363ed){var _0x9b131f='';return db[_0x57b0('0x2a')][_0x57b0('0x48')]({'where':{'id':_0x189200[_0x57b0('0x42')]['id']},'attributes':['id',_0x57b0('0x54'),_0x57b0('0x55')]})[_0x57b0('0x22')](handleEntityNotFound(_0x58c9dd,null))[_0x57b0('0x22')](function(_0x4e843b){if(_0x4e843b){_0x9b131f=_0x4e843b[_0x57b0('0x54')];var _0x1f14b7=_0x9b131f[_0x57b0('0x56')](-0x1);if(_0x1f14b7==='/'){_0x9b131f=_0x9b131f['substring'](0x0,_0x9b131f[_0x57b0('0x57')](_0x1f14b7));}return rp({'method':_0x57b0('0x58'),'uri':util[_0x57b0('0x59')](_0x57b0('0x5a'),_0x9b131f,_0x57b0('0x5b')),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x57b0('0x59')](_0x57b0('0x5c'),_0x4e843b['apiKey']))[_0x57b0('0x5d')](_0x57b0('0x5e')))},'json':!![]});}})[_0x57b0('0x22')](function(_0x53aec2){if(_0x53aec2){var _0x52858c=[_0x57b0('0x5f'),'subject',_0x57b0('0x60'),_0x57b0('0x61'),_0x57b0('0x16'),_0x57b0('0x62'),_0x57b0('0x63'),_0x57b0('0x64'),_0x57b0('0x65'),_0x57b0('0x63'),'company'];_[_0x57b0('0x66')](_0x53aec2,function(_0x22a123){return _0x52858c[_0x57b0('0x67')](_0x22a123[_0x57b0('0x27')])||!_0x22a123['default']&&_0x22a123[_0x57b0('0x4f')]!==_0x57b0('0x68')&&_0x22a123['type']!==_0x57b0('0x69');});return{'count':_0x53aec2[_0x57b0('0x32')],'rows':_[_0x57b0('0x3a')](_0x53aec2,function(_0x3db1d8){return{'id':_0x3db1d8['name'],'name':_0x3db1d8['label'],'custom':!_0x3db1d8[_0x57b0('0x6a')],'options':_0x3db1d8[_0x57b0('0x6b')]?_[_0x57b0('0x3a')](_0x3db1d8[_0x57b0('0x6b')],function(_0x2de69c){return{'name':_[_0x57b0('0x6c')](_0x2de69c),'value':_0x2de69c};}):[]};})};}})[_0x57b0('0x22')](respondWithResult(_0x58c9dd,null))[_0x57b0('0x41')](function(_0x3018ce){var _0x255d3a=_0x189200[_0x57b0('0x2d')][_0x57b0('0x6d')]?0x1f4:_0x3018ce['statusCode']||0x1f4;logger[_0x57b0('0x25')]('getFields,\x20%s,\x20%s,\x20%s',_0x57b0('0x6e'),_0x255d3a,JSON[_0x57b0('0x6f')](_0x3018ce));delete _0x3018ce[_0x57b0('0x27')];if(_0x255d3a===0x191){_0x255d3a=0x190;}_0x58c9dd[_0x57b0('0x16')](_0x255d3a)[_0x57b0('0x28')](_0x189200[_0x57b0('0x2d')][_0x57b0('0x6d')]?{'message':_0x57b0('0x70'),'statusCode':_0x3018ce['statusCode']}:_0x3018ce);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index e94ee03..a5d83f2 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 _0xa5b5=['api','moment','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xa5b5,0x1eb));var _0x5a5b=function(_0x54c955,_0xe4591f){_0x54c955=_0x54c955-0x0;var _0x48240b=_0xa5b5[_0x54c955];return _0x48240b;};'use strict';var _=require(_0x5a5b('0x0'));var util=require(_0x5a5b('0x1'));var logger=require(_0x5a5b('0x2'))(_0x5a5b('0x3'));var moment=require(_0x5a5b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5a5b('0x5'));var config=require(_0x5a5b('0x6'));var attributes=require(_0x5a5b('0x7'));var integrations=require(_0x5a5b('0x8'));module[_0x5a5b('0x9')]=function(_0x49fe23,_0x33cb04){return _0x49fe23[_0x5a5b('0xa')](_0x5a5b('0xb'),attributes,{'tableName':_0x5a5b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d77=['../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','moment','request-promise','path','rimraf'];(function(_0x5a2660,_0x52e389){var _0x542d3b=function(_0x15a105){while(--_0x15a105){_0x5a2660['push'](_0x5a2660['shift']());}};_0x542d3b(++_0x52e389);}(_0x1d77,0x152));var _0x71d7=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x1d77[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x71d7('0x0'));var BPromise=require('bluebird');var rp=require(_0x71d7('0x1'));var fs=require('fs');var path=require(_0x71d7('0x2'));var rimraf=require(_0x71d7('0x3'));var config=require(_0x71d7('0x4'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x71d7('0x5'));module['exports']=function(_0xcba87b,_0x407e93){return _0xcba87b[_0x71d7('0x6')](_0x71d7('0x7'),attributes,{'tableName':_0x71d7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index f05923f..6542906 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 _0xa3b3=['request','then','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','info','result','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','include','model','map','debug','GetFreshdeskAccount','ShowFreshdeskAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x2f867f,_0x320006){var _0x79f7d4=function(_0x4153a5){while(--_0x4153a5){_0x2f867f['push'](_0x2f867f['shift']());}};_0x79f7d4(++_0x320006);}(_0xa3b3,0x81));var _0x3a3b=function(_0x209801,_0x548dbc){_0x209801=_0x209801-0x0;var _0x193dfa=_0xa3b3[_0x209801];return _0x193dfa;};'use strict';var _=require(_0x3a3b('0x0'));var util=require(_0x3a3b('0x1'));var moment=require('moment');var BPromise=require(_0x3a3b('0x2'));var rs=require(_0x3a3b('0x3'));var fs=require('fs');var Redis=require(_0x3a3b('0x4'));var db=require(_0x3a3b('0x5'))['db'];var utils=require(_0x3a3b('0x6'));var logger=require(_0x3a3b('0x7'))('rpc');var config=require(_0x3a3b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a3b('0x9')][_0x3a3b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5834b7,_0x55ba23,_0x426e85){return new BPromise(function(_0x67184a,_0x181b06){return client[_0x3a3b('0xb')](_0x5834b7,_0x426e85)[_0x3a3b('0xc')](function(_0x11df27){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x55ba23,_0x3a3b('0xd'));logger['debug'](_0x3a3b('0xe'),_0x55ba23,'request\x20sent',JSON[_0x3a3b('0xf')](_0x11df27));if(_0x11df27['error']){if(_0x11df27[_0x3a3b('0x10')][_0x3a3b('0x11')]===0x1f4){logger[_0x3a3b('0x10')](_0x3a3b('0x12'),_0x55ba23,_0x11df27[_0x3a3b('0x10')]['message']);return _0x181b06(_0x11df27['error'][_0x3a3b('0x13')]);}logger[_0x3a3b('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x55ba23,_0x11df27['error'][_0x3a3b('0x13')]);return _0x67184a(_0x11df27['error'][_0x3a3b('0x13')]);}else{logger[_0x3a3b('0x14')](_0x3a3b('0x12'),_0x55ba23,_0x3a3b('0xd'));_0x67184a(_0x11df27[_0x3a3b('0x15')]['message']);}})[_0x3a3b('0x16')](function(_0x599591){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x55ba23,_0x599591);_0x181b06(_0x599591);});});}exports['GetFreshdeskAccount']=function(_0x1ac88c){var _0x3722c2=this;return new Promise(function(_0x5ea006,_0x1af571){return db[_0x3a3b('0x17')][_0x3a3b('0x18')]({'raw':_0x1ac88c['options']?_0x1ac88c[_0x3a3b('0x19')][_0x3a3b('0x1a')]===undefined?!![]:![]:!![],'where':_0x1ac88c['options']?_0x1ac88c[_0x3a3b('0x19')]['where']||null:null,'attributes':_0x1ac88c[_0x3a3b('0x19')]?_0x1ac88c[_0x3a3b('0x19')][_0x3a3b('0x1b')]||null:null,'limit':_0x1ac88c[_0x3a3b('0x19')]?_0x1ac88c[_0x3a3b('0x19')][_0x3a3b('0x1c')]||null:null,'include':_0x1ac88c['options']?_0x1ac88c['options'][_0x3a3b('0x1d')]?_['map'](_0x1ac88c[_0x3a3b('0x19')][_0x3a3b('0x1d')],function(_0x5943d5){return{'model':db[_0x5943d5[_0x3a3b('0x1e')]],'as':_0x5943d5['as'],'attributes':_0x5943d5[_0x3a3b('0x1b')],'include':_0x5943d5['include']?_[_0x3a3b('0x1f')](_0x5943d5[_0x3a3b('0x1d')],function(_0x18e76a){return{'model':db[_0x18e76a[_0x3a3b('0x1e')]],'as':_0x18e76a['as'],'attributes':_0x18e76a['attributes'],'include':_0x18e76a['include']?_['map'](_0x18e76a[_0x3a3b('0x1d')],function(_0x17ade7){return{'model':db[_0x17ade7['model']],'as':_0x17ade7['as'],'attributes':_0x17ade7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a3b('0xc')](function(_0x2cf980){logger[_0x3a3b('0x14')]('GetFreshdeskAccount',_0x1ac88c);logger[_0x3a3b('0x20')](_0x3a3b('0x21'),_0x1ac88c,JSON[_0x3a3b('0xf')](_0x2cf980));_0x5ea006(_0x2cf980);})[_0x3a3b('0x16')](function(_0x15a72c){logger[_0x3a3b('0x10')](_0x3a3b('0x21'),_0x15a72c['message'],_0x1ac88c);_0x1af571(_0x3722c2['error'](0x1f4,_0x15a72c[_0x3a3b('0x13')]));});});};exports[_0x3a3b('0x22')]=function(_0x400d50){var _0x1e265c=this;return new Promise(function(_0x1d9a6b,_0x38b9f7){return db[_0x3a3b('0x17')]['find']({'raw':_0x400d50['options']?_0x400d50[_0x3a3b('0x19')][_0x3a3b('0x1a')]===undefined?!![]:![]:!![],'where':_0x400d50['options']?_0x400d50[_0x3a3b('0x19')]['where']||null:null,'attributes':_0x400d50[_0x3a3b('0x19')]?_0x400d50[_0x3a3b('0x19')][_0x3a3b('0x1b')]||null:null,'include':_0x400d50['options']?_0x400d50['options'][_0x3a3b('0x1d')]?_[_0x3a3b('0x1f')](_0x400d50[_0x3a3b('0x19')][_0x3a3b('0x1d')],function(_0x33bcc2){return{'model':db[_0x33bcc2[_0x3a3b('0x1e')]],'as':_0x33bcc2['as'],'attributes':_0x33bcc2[_0x3a3b('0x1b')],'include':_0x33bcc2[_0x3a3b('0x1d')]?_[_0x3a3b('0x1f')](_0x33bcc2[_0x3a3b('0x1d')],function(_0x4b9fad){return{'model':db[_0x4b9fad[_0x3a3b('0x1e')]],'as':_0x4b9fad['as'],'attributes':_0x4b9fad[_0x3a3b('0x1b')],'include':_0x4b9fad[_0x3a3b('0x1d')]?_[_0x3a3b('0x1f')](_0x4b9fad[_0x3a3b('0x1d')],function(_0x3f1f0c){return{'model':db[_0x3f1f0c['model']],'as':_0x3f1f0c['as'],'attributes':_0x3f1f0c[_0x3a3b('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5d8081){logger[_0x3a3b('0x14')]('ShowFreshdeskAccount',_0x400d50);logger[_0x3a3b('0x20')]('ShowFreshdeskAccount',_0x400d50,JSON[_0x3a3b('0xf')](_0x5d8081));_0x1d9a6b(_0x5d8081);})['catch'](function(_0x344c03){logger[_0x3a3b('0x10')](_0x3a3b('0x22'),_0x344c03[_0x3a3b('0x13')],_0x400d50);_0x38b9f7(_0x1e265c[_0x3a3b('0x10')](0x1f4,_0x344c03[_0x3a3b('0x13')]));});});}; \ No newline at end of file +var _0xa01a=['ShowFreshdeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshdeskAccount','FreshdeskAccount','options','raw','where','attributes','include','map','model','catch'];(function(_0x18ad55,_0x490824){var _0x4e3acd=function(_0x25855d){while(--_0x25855d){_0x18ad55['push'](_0x18ad55['shift']());}};_0x4e3acd(++_0x490824);}(_0xa01a,0x6e));var _0xaa01=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xa01a[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xaa01('0x0'));var util=require(_0xaa01('0x1'));var moment=require(_0xaa01('0x2'));var BPromise=require(_0xaa01('0x3'));var rs=require(_0xaa01('0x4'));var fs=require('fs');var Redis=require(_0xaa01('0x5'));var db=require(_0xaa01('0x6'))['db'];var utils=require(_0xaa01('0x7'));var logger=require(_0xaa01('0x8'))(_0xaa01('0x9'));var config=require(_0xaa01('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xaa01('0xb')][_0xaa01('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa86434,_0x3f2a54,_0xd8de02){return new BPromise(function(_0xc1d563,_0xe71053){return client[_0xaa01('0xd')](_0xa86434,_0xd8de02)[_0xaa01('0xe')](function(_0x46f7bb){logger[_0xaa01('0xf')](_0xaa01('0x10'),_0x3f2a54,_0xaa01('0x11'));logger[_0xaa01('0x12')](_0xaa01('0x13'),_0x3f2a54,_0xaa01('0x11'),JSON[_0xaa01('0x14')](_0x46f7bb));if(_0x46f7bb[_0xaa01('0x15')]){if(_0x46f7bb[_0xaa01('0x15')]['code']===0x1f4){logger[_0xaa01('0x15')](_0xaa01('0x10'),_0x3f2a54,_0x46f7bb['error'][_0xaa01('0x16')]);return _0xe71053(_0x46f7bb[_0xaa01('0x15')][_0xaa01('0x16')]);}logger[_0xaa01('0x15')](_0xaa01('0x10'),_0x3f2a54,_0x46f7bb[_0xaa01('0x15')][_0xaa01('0x16')]);return _0xc1d563(_0x46f7bb[_0xaa01('0x15')][_0xaa01('0x16')]);}else{logger['info'](_0xaa01('0x10'),_0x3f2a54,_0xaa01('0x11'));_0xc1d563(_0x46f7bb[_0xaa01('0x17')]['message']);}})['catch'](function(_0x558e55){logger[_0xaa01('0x15')](_0xaa01('0x10'),_0x3f2a54,_0x558e55);_0xe71053(_0x558e55);});});}exports[_0xaa01('0x18')]=function(_0x41b890){var _0x8f0c8d=this;return new Promise(function(_0x3fca94,_0x3add63){return db[_0xaa01('0x19')]['findAll']({'raw':_0x41b890[_0xaa01('0x1a')]?_0x41b890['options'][_0xaa01('0x1b')]===undefined?!![]:![]:!![],'where':_0x41b890[_0xaa01('0x1a')]?_0x41b890[_0xaa01('0x1a')][_0xaa01('0x1c')]||null:null,'attributes':_0x41b890[_0xaa01('0x1a')]?_0x41b890['options'][_0xaa01('0x1d')]||null:null,'limit':_0x41b890['options']?_0x41b890[_0xaa01('0x1a')]['limit']||null:null,'include':_0x41b890[_0xaa01('0x1a')]?_0x41b890['options'][_0xaa01('0x1e')]?_[_0xaa01('0x1f')](_0x41b890[_0xaa01('0x1a')]['include'],function(_0x5878b5){return{'model':db[_0x5878b5[_0xaa01('0x20')]],'as':_0x5878b5['as'],'attributes':_0x5878b5[_0xaa01('0x1d')],'include':_0x5878b5[_0xaa01('0x1e')]?_['map'](_0x5878b5[_0xaa01('0x1e')],function(_0xc0f5eb){return{'model':db[_0xc0f5eb[_0xaa01('0x20')]],'as':_0xc0f5eb['as'],'attributes':_0xc0f5eb[_0xaa01('0x1d')],'include':_0xc0f5eb['include']?_[_0xaa01('0x1f')](_0xc0f5eb[_0xaa01('0x1e')],function(_0x5d1bcf){return{'model':db[_0x5d1bcf['model']],'as':_0x5d1bcf['as'],'attributes':_0x5d1bcf[_0xaa01('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaa01('0xe')](function(_0x647186){logger[_0xaa01('0xf')]('GetFreshdeskAccount',_0x41b890);logger['debug']('GetFreshdeskAccount',_0x41b890,JSON[_0xaa01('0x14')](_0x647186));_0x3fca94(_0x647186);})[_0xaa01('0x21')](function(_0x3c05f9){logger[_0xaa01('0x15')](_0xaa01('0x18'),_0x3c05f9[_0xaa01('0x16')],_0x41b890);_0x3add63(_0x8f0c8d[_0xaa01('0x15')](0x1f4,_0x3c05f9[_0xaa01('0x16')]));});});};exports[_0xaa01('0x22')]=function(_0x7f9b5f){var _0x23d722=this;return new Promise(function(_0x5e2f83,_0x42a52c){return db[_0xaa01('0x19')][_0xaa01('0x23')]({'raw':_0x7f9b5f[_0xaa01('0x1a')]?_0x7f9b5f[_0xaa01('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x7f9b5f[_0xaa01('0x1a')]?_0x7f9b5f[_0xaa01('0x1a')][_0xaa01('0x1c')]||null:null,'attributes':_0x7f9b5f['options']?_0x7f9b5f[_0xaa01('0x1a')][_0xaa01('0x1d')]||null:null,'include':_0x7f9b5f[_0xaa01('0x1a')]?_0x7f9b5f[_0xaa01('0x1a')][_0xaa01('0x1e')]?_[_0xaa01('0x1f')](_0x7f9b5f['options'][_0xaa01('0x1e')],function(_0x1d2a45){return{'model':db[_0x1d2a45[_0xaa01('0x20')]],'as':_0x1d2a45['as'],'attributes':_0x1d2a45[_0xaa01('0x1d')],'include':_0x1d2a45[_0xaa01('0x1e')]?_[_0xaa01('0x1f')](_0x1d2a45['include'],function(_0x10f7e3){return{'model':db[_0x10f7e3[_0xaa01('0x20')]],'as':_0x10f7e3['as'],'attributes':_0x10f7e3['attributes'],'include':_0x10f7e3[_0xaa01('0x1e')]?_[_0xaa01('0x1f')](_0x10f7e3['include'],function(_0x15fd00){return{'model':db[_0x15fd00[_0xaa01('0x20')]],'as':_0x15fd00['as'],'attributes':_0x15fd00[_0xaa01('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xaa01('0xe')](function(_0x28e998){logger[_0xaa01('0xf')](_0xaa01('0x22'),_0x7f9b5f);logger[_0xaa01('0x12')](_0xaa01('0x22'),_0x7f9b5f,JSON['stringify'](_0x28e998));_0x5e2f83(_0x28e998);})[_0xaa01('0x21')](function(_0x31d047){logger[_0xaa01('0x15')](_0xaa01('0x22'),_0x31d047[_0xaa01('0x16')],_0x7f9b5f);_0x42a52c(_0x23d722[_0xaa01('0x15')](0x1f4,_0x31d047[_0xaa01('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a6562fd..8da9584 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 _0x1854=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','show','isAuthenticated','getFields','/:id/subjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','put','update','delete','destroy','exports','multer'];(function(_0x503be0,_0x254ab5){var _0x2300f6=function(_0x17c3c4){while(--_0x17c3c4){_0x503be0['push'](_0x503be0['shift']());}};_0x2300f6(++_0x254ab5);}(_0x1854,0xfc));var _0x4185=function(_0x3c66e5,_0xab5ea3){_0x3c66e5=_0x3c66e5-0x0;var _0x678a=_0x1854[_0x3c66e5];return _0x678a;};'use strict';var multer=require(_0x4185('0x0'));var util=require(_0x4185('0x1'));var path=require(_0x4185('0x2'));var timeout=require('connect-timeout');var express=require(_0x4185('0x3'));var router=express[_0x4185('0x4')]();var fs_extra=require(_0x4185('0x5'));var auth=require(_0x4185('0x6'));var interaction=require(_0x4185('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x4185('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4185('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x4185('0x9')]);router[_0x4185('0x8')]('/:id/fields',auth[_0x4185('0xa')](),controller[_0x4185('0xb')]);router[_0x4185('0x8')](_0x4185('0xc'),auth[_0x4185('0xa')](),controller['getSubjects']);router[_0x4185('0x8')](_0x4185('0xd'),auth[_0x4185('0xa')](),controller[_0x4185('0xe')]);router[_0x4185('0x8')]('/:id/tags',auth[_0x4185('0xa')](),controller[_0x4185('0xf')]);router[_0x4185('0x10')]('/',auth[_0x4185('0xa')](),controller['create']);router[_0x4185('0x10')](_0x4185('0x11'),auth[_0x4185('0xa')](),controller['setTags']);router[_0x4185('0x12')]('/:id',auth[_0x4185('0xa')](),controller[_0x4185('0x13')]);router[_0x4185('0x14')]('/:id',auth[_0x4185('0xa')](),controller[_0x4185('0x15')]);module[_0x4185('0x16')]=router; \ No newline at end of file +var _0x804a=['/:id/tags','getTags','post','create','setTags','/:id','delete','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x3951aa,_0x160aa3){var _0x49a97d=function(_0x28c224){while(--_0x28c224){_0x3951aa['push'](_0x3951aa['shift']());}};_0x49a97d(++_0x160aa3);}(_0x804a,0x17f));var _0xa804=function(_0x207e2b,_0x40adfc){_0x207e2b=_0x207e2b-0x0;var _0x4695e7=_0x804a[_0x207e2b];return _0x4695e7;};'use strict';var multer=require(_0xa804('0x0'));var util=require(_0xa804('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa804('0x2'));var router=express[_0xa804('0x3')]();var fs_extra=require(_0xa804('0x4'));var auth=require(_0xa804('0x5'));var interaction=require(_0xa804('0x6'));var config=require(_0xa804('0x7'));var controller=require(_0xa804('0x8'));router[_0xa804('0x9')]('/',auth[_0xa804('0xa')](),controller[_0xa804('0xb')]);router[_0xa804('0x9')]('/:id',auth[_0xa804('0xa')](),controller[_0xa804('0xc')]);router['get'](_0xa804('0xd'),auth[_0xa804('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth[_0xa804('0xa')](),controller[_0xa804('0xe')]);router[_0xa804('0x9')](_0xa804('0xf'),auth['isAuthenticated'](),controller[_0xa804('0x10')]);router[_0xa804('0x9')](_0xa804('0x11'),auth['isAuthenticated'](),controller[_0xa804('0x12')]);router[_0xa804('0x13')]('/',auth[_0xa804('0xa')](),controller[_0xa804('0x14')]);router['post'](_0xa804('0x11'),auth[_0xa804('0xa')](),controller[_0xa804('0x15')]);router['put'](_0xa804('0x16'),auth[_0xa804('0xa')](),controller['update']);router[_0xa804('0x17')](_0xa804('0x16'),auth[_0xa804('0xa')](),controller[_0xa804('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ba71181..19fab2d 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 _0xc247=['STRING','exports'];(function(_0x118cae,_0x28a979){var _0x16edc7=function(_0x287180){while(--_0x287180){_0x118cae['push'](_0x118cae['shift']());}};_0x16edc7(++_0x28a979);}(_0xc247,0x113));var _0x7c24=function(_0x291aaf,_0x4c6d8d){_0x291aaf=_0x291aaf-0x0;var _0x5571e6=_0xc247[_0x291aaf];return _0x5571e6;};'use strict';var Sequelize=require('sequelize');module[_0x7c24('0x0')]={'name':{'type':Sequelize[_0x7c24('0x1')]},'description':{'type':Sequelize[_0x7c24('0x1')]}}; \ No newline at end of file +var _0xc15a=['STRING','sequelize'];(function(_0x5b281d,_0xf5d323){var _0x2b6c4e=function(_0x348a6b){while(--_0x348a6b){_0x5b281d['push'](_0x5b281d['shift']());}};_0x2b6c4e(++_0xf5d323);}(_0xc15a,0x99));var _0xac15=function(_0x41f67c,_0x4c287a){_0x41f67c=_0x41f67c-0x0;var _0x7a08f=_0xc15a[_0x41f67c];return _0x7a08f;};'use strict';var Sequelize=require(_0xac15('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xac15('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index aac87ee..504e48c 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 _0xdf97=['includeAll','find','create','body','params','getFields','findOne','nolimit','getSubjects','FreshdeskField','hasOwnProperty','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','FreshdeskConfiguration','length'];(function(_0x114daf,_0x3d27cf){var _0x2fc135=function(_0x29f8c9){while(--_0x29f8c9){_0x114daf['push'](_0x114daf['shift']());}};_0x2fc135(++_0x3d27cf);}(_0xdf97,0x64));var _0x7df9=function(_0x429eff,_0x483eb9){_0x429eff=_0x429eff-0x0;var _0x1316cd=_0xdf97[_0x429eff];return _0x1316cd;};'use strict';var emlformat=require(_0x7df9('0x0'));var rimraf=require(_0x7df9('0x1'));var zipdir=require(_0x7df9('0x2'));var jsonpatch=require(_0x7df9('0x3'));var rp=require(_0x7df9('0x4'));var moment=require(_0x7df9('0x5'));var BPromise=require(_0x7df9('0x6'));var Mustache=require(_0x7df9('0x7'));var util=require(_0x7df9('0x8'));var path=require(_0x7df9('0x9'));var sox=require(_0x7df9('0xa'));var csv=require(_0x7df9('0xb'));var ejs=require(_0x7df9('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7df9('0xd'));var squel=require(_0x7df9('0xe'));var crypto=require('crypto');var jsforce=require(_0x7df9('0xf'));var deskjs=require(_0x7df9('0x10'));var toCsv=require(_0x7df9('0xb'));var querystring=require(_0x7df9('0x11'));var Papa=require('papaparse');var Redis=require(_0x7df9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7df9('0x13'));var as=require(_0x7df9('0x14'));var hardwareService=require(_0x7df9('0x15'));var logger=require('../../config/logger')(_0x7df9('0x16'));var utils=require(_0x7df9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7df9('0x18'));var db=require(_0x7df9('0x19'))['db'];function respondWithStatusCode(_0x573c1d,_0x2796dd){_0x2796dd=_0x2796dd||0xcc;return function(_0x2efe59){if(_0x2efe59){return _0x573c1d[_0x7df9('0x1a')](_0x2796dd);}return _0x573c1d[_0x7df9('0x1b')](_0x2796dd)[_0x7df9('0x1c')]();};}function respondWithResult(_0x179ea2,_0xf25466){_0xf25466=_0xf25466||0xc8;return function(_0x239d89){if(_0x239d89){return _0x179ea2[_0x7df9('0x1b')](_0xf25466)[_0x7df9('0x1d')](_0x239d89);}};}function respondWithFilteredResult(_0x23cd65,_0x56df4b){return function(_0x299f4b){if(_0x299f4b){var _0x5cf933=typeof _0x56df4b['offset']===_0x7df9('0x1e')&&typeof _0x56df4b[_0x7df9('0x1f')]===_0x7df9('0x1e');var _0x12cdd7=_0x299f4b[_0x7df9('0x20')];var _0x11be6b=_0x5cf933?0x0:_0x56df4b[_0x7df9('0x21')];var _0x402f66=_0x5cf933?_0x299f4b[_0x7df9('0x20')]:_0x56df4b[_0x7df9('0x21')]+_0x56df4b[_0x7df9('0x1f')];var _0x2a5458;if(_0x402f66>=_0x12cdd7){_0x402f66=_0x12cdd7;_0x2a5458=0xc8;}else{_0x2a5458=0xce;}_0x23cd65[_0x7df9('0x1b')](_0x2a5458);return _0x23cd65[_0x7df9('0x22')]('Content-Range',_0x11be6b+'-'+_0x402f66+'/'+_0x12cdd7)['json'](_0x299f4b);}return null;};}function patchUpdates(_0x411689){return function(_0x51042f){try{jsonpatch[_0x7df9('0x23')](_0x51042f,_0x411689,!![]);}catch(_0x15afd7){return BPromise['reject'](_0x15afd7);}return _0x51042f['save']();};}function saveUpdates(_0x17858a,_0x5da220){return function(_0x1a8514){if(_0x1a8514){return _0x1a8514[_0x7df9('0x24')](_0x17858a)[_0x7df9('0x25')](function(_0x2f0db4){return _0x2f0db4;});}return null;};}function removeEntity(_0x4f8fdb,_0x51f864){return function(_0x555b6b){if(_0x555b6b){return _0x555b6b[_0x7df9('0x26')]()['then'](function(){_0x4f8fdb[_0x7df9('0x1b')](0xcc)[_0x7df9('0x1c')]();});}};}function handleEntityNotFound(_0x5b8466,_0x3c56dc){return function(_0x25a56d){if(!_0x25a56d){_0x5b8466[_0x7df9('0x1a')](0x194);}return _0x25a56d;};}function handleError(_0x45141c,_0x13a2e4){_0x13a2e4=_0x13a2e4||0x1f4;return function(_0x40c5d5){logger[_0x7df9('0x27')](_0x40c5d5[_0x7df9('0x28')]);if(_0x40c5d5[_0x7df9('0x29')]){delete _0x40c5d5['name'];}_0x45141c[_0x7df9('0x1b')](_0x13a2e4)['send'](_0x40c5d5);};}exports[_0x7df9('0x2a')]=function(_0x1362c5,_0x46da3f){var _0x4850d3={},_0x3532e6={},_0x47b33d={'count':0x0,'rows':[]};var _0x1daa02=_[_0x7df9('0x2b')](db['FreshdeskConfiguration'][_0x7df9('0x2c')],function(_0x24311c){return{'name':_0x24311c[_0x7df9('0x2d')],'type':_0x24311c[_0x7df9('0x2e')][_0x7df9('0x2f')]};});_0x3532e6['model']=_['map'](_0x1daa02,'name');_0x3532e6['query']=_[_0x7df9('0x30')](_0x1362c5[_0x7df9('0x31')]);_0x3532e6[_0x7df9('0x32')]=_[_0x7df9('0x33')](_0x3532e6[_0x7df9('0x34')],_0x3532e6[_0x7df9('0x31')]);_0x4850d3[_0x7df9('0x35')]=_[_0x7df9('0x33')](_0x3532e6[_0x7df9('0x34')],qs[_0x7df9('0x36')](_0x1362c5['query'][_0x7df9('0x36')]));_0x4850d3['attributes']=_0x4850d3['attributes']['length']?_0x4850d3[_0x7df9('0x35')]:_0x3532e6['model'];if(!_0x1362c5[_0x7df9('0x31')]['hasOwnProperty']('nolimit')){_0x4850d3['limit']=qs['limit'](_0x1362c5['query']['limit']);_0x4850d3[_0x7df9('0x21')]=qs['offset'](_0x1362c5['query'][_0x7df9('0x21')]);}_0x4850d3[_0x7df9('0x37')]=qs[_0x7df9('0x38')](_0x1362c5[_0x7df9('0x31')]['sort']);_0x4850d3[_0x7df9('0x39')]=qs[_0x7df9('0x32')](_[_0x7df9('0x3a')](_0x1362c5[_0x7df9('0x31')],_0x3532e6[_0x7df9('0x32')]),_0x1daa02);if(_0x1362c5[_0x7df9('0x31')][_0x7df9('0x3b')]){_0x4850d3[_0x7df9('0x39')]=_[_0x7df9('0x3c')](_0x4850d3[_0x7df9('0x39')],{'$or':_[_0x7df9('0x2b')](_0x1daa02,function(_0x2d7210){if(_0x2d7210[_0x7df9('0x2e')]!==_0x7df9('0x3d')){var _0x41a44d={};_0x41a44d[_0x2d7210[_0x7df9('0x29')]]={'$like':'%'+_0x1362c5[_0x7df9('0x31')][_0x7df9('0x3b')]+'%'};return _0x41a44d;}})});}_0x4850d3=_[_0x7df9('0x3c')]({},_0x4850d3,_0x1362c5[_0x7df9('0x3e')]);var _0x1aff69={'where':_0x4850d3[_0x7df9('0x39')]};return db['FreshdeskConfiguration'][_0x7df9('0x20')](_0x1aff69)['then'](function(_0xb4cb36){_0x47b33d[_0x7df9('0x20')]=_0xb4cb36;if(_0x1362c5[_0x7df9('0x31')]['includeAll']){_0x4850d3[_0x7df9('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0x7df9('0x40')](_0x4850d3);})[_0x7df9('0x25')](function(_0x14d018){_0x47b33d[_0x7df9('0x41')]=_0x14d018;return _0x47b33d;})[_0x7df9('0x25')](respondWithFilteredResult(_0x46da3f,_0x4850d3))[_0x7df9('0x42')](handleError(_0x46da3f,null));};exports[_0x7df9('0x43')]=function(_0x580cca,_0x531616){var _0x5bf99b={'raw':![],'where':{'id':_0x580cca['params']['id']}},_0x5ebded={};_0x5ebded[_0x7df9('0x34')]=_[_0x7df9('0x30')](db[_0x7df9('0x44')][_0x7df9('0x2c')]);_0x5ebded['query']=_[_0x7df9('0x30')](_0x580cca[_0x7df9('0x31')]);_0x5ebded[_0x7df9('0x32')]=_['intersection'](_0x5ebded[_0x7df9('0x34')],_0x5ebded[_0x7df9('0x31')]);_0x5bf99b[_0x7df9('0x35')]=_[_0x7df9('0x33')](_0x5ebded[_0x7df9('0x34')],qs[_0x7df9('0x36')](_0x580cca[_0x7df9('0x31')][_0x7df9('0x36')]));_0x5bf99b[_0x7df9('0x35')]=_0x5bf99b['attributes'][_0x7df9('0x45')]?_0x5bf99b[_0x7df9('0x35')]:_0x5ebded[_0x7df9('0x34')];if(_0x580cca[_0x7df9('0x31')][_0x7df9('0x46')]){_0x5bf99b[_0x7df9('0x3f')]=[{'all':!![]}];}_0x5bf99b=_[_0x7df9('0x3c')]({},_0x5bf99b,_0x580cca[_0x7df9('0x3e')]);return db[_0x7df9('0x44')][_0x7df9('0x47')](_0x5bf99b)[_0x7df9('0x25')](handleEntityNotFound(_0x531616,null))[_0x7df9('0x25')](respondWithResult(_0x531616,null))['catch'](handleError(_0x531616,null));};exports[_0x7df9('0x48')]=function(_0x4d6a8e,_0x109172){return db[_0x7df9('0x44')][_0x7df9('0x48')](_0x4d6a8e[_0x7df9('0x49')],{})[_0x7df9('0x25')](respondWithResult(_0x109172,0xc9))[_0x7df9('0x42')](handleError(_0x109172,null));};exports['update']=function(_0x2fde06,_0x172b47){if(_0x2fde06[_0x7df9('0x49')]['id']){delete _0x2fde06[_0x7df9('0x49')]['id'];}return db['FreshdeskConfiguration'][_0x7df9('0x47')]({'where':{'id':_0x2fde06[_0x7df9('0x4a')]['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x172b47,null))[_0x7df9('0x25')](saveUpdates(_0x2fde06[_0x7df9('0x49')],null))[_0x7df9('0x25')](respondWithResult(_0x172b47,null))['catch'](handleError(_0x172b47,null));};exports[_0x7df9('0x26')]=function(_0x3db3e5,_0x175efc){return db[_0x7df9('0x44')][_0x7df9('0x47')]({'where':{'id':_0x3db3e5[_0x7df9('0x4a')]['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x175efc,null))[_0x7df9('0x25')](removeEntity(_0x175efc,null))[_0x7df9('0x42')](handleError(_0x175efc,null));};exports[_0x7df9('0x4b')]=function(_0x124402,_0x501f68,_0xad64cf){var _0x5a9618={};var _0x399c58={};var _0x114fbd;var _0x1e0307;return db[_0x7df9('0x44')][_0x7df9('0x4c')]({'where':{'id':_0x124402[_0x7df9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x501f68,null))[_0x7df9('0x25')](function(_0x737484){if(_0x737484){_0x114fbd=_0x737484;_0x399c58[_0x7df9('0x34')]=_[_0x7df9('0x30')](db['FreshdeskField'][_0x7df9('0x2c')]);_0x399c58['query']=_['keys'](_0x124402[_0x7df9('0x31')]);_0x399c58['filters']=_[_0x7df9('0x33')](_0x399c58[_0x7df9('0x34')],_0x399c58['query']);_0x5a9618[_0x7df9('0x35')]=_[_0x7df9('0x33')](_0x399c58[_0x7df9('0x34')],qs[_0x7df9('0x36')](_0x124402[_0x7df9('0x31')][_0x7df9('0x36')]));_0x5a9618[_0x7df9('0x35')]=_0x5a9618['attributes'][_0x7df9('0x45')]?_0x5a9618[_0x7df9('0x35')]:_0x399c58[_0x7df9('0x34')];_0x5a9618[_0x7df9('0x37')]=qs[_0x7df9('0x38')](_0x124402[_0x7df9('0x31')]['sort']);_0x5a9618[_0x7df9('0x39')]=qs['filters'](_[_0x7df9('0x3a')](_0x124402['query'],_0x399c58[_0x7df9('0x32')]));if(_0x124402[_0x7df9('0x31')][_0x7df9('0x3b')]){_0x5a9618[_0x7df9('0x39')]=_[_0x7df9('0x3c')](_0x5a9618[_0x7df9('0x39')],{'$or':_[_0x7df9('0x2b')](_0x5a9618[_0x7df9('0x35')],function(_0x207f05){var _0x5e04d4={};_0x5e04d4[_0x207f05]={'$like':'%'+_0x124402[_0x7df9('0x31')]['filter']+'%'};return _0x5e04d4;})});}_0x5a9618=_['merge']({},_0x5a9618,_0x124402[_0x7df9('0x3e')]);return _0x114fbd['getFields'](_0x5a9618);}})[_0x7df9('0x25')](function(_0x374f0a){if(_0x374f0a){_0x1e0307=_0x374f0a['length'];if(!_0x124402[_0x7df9('0x31')]['hasOwnProperty'](_0x7df9('0x4d'))){_0x5a9618[_0x7df9('0x1f')]=qs[_0x7df9('0x1f')](_0x124402[_0x7df9('0x31')][_0x7df9('0x1f')]);_0x5a9618['offset']=qs[_0x7df9('0x21')](_0x124402[_0x7df9('0x31')]['offset']);}return _0x114fbd[_0x7df9('0x4b')](_0x5a9618);}})[_0x7df9('0x25')](function(_0x51fcf2){if(_0x51fcf2){return _0x51fcf2?{'count':_0x1e0307,'rows':_0x51fcf2}:null;}})['then'](respondWithResult(_0x501f68,null))[_0x7df9('0x42')](handleError(_0x501f68,null));};exports[_0x7df9('0x4e')]=function(_0x2ab23d,_0x5ca483,_0x590710){var _0x214131={};var _0x3c5d2d={};var _0x248acf;var _0x58287f;return db['FreshdeskConfiguration'][_0x7df9('0x4c')]({'where':{'id':_0x2ab23d['params']['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x5ca483,null))[_0x7df9('0x25')](function(_0x297ce4){if(_0x297ce4){_0x248acf=_0x297ce4;_0x3c5d2d[_0x7df9('0x34')]=_[_0x7df9('0x30')](db[_0x7df9('0x4f')][_0x7df9('0x2c')]);_0x3c5d2d[_0x7df9('0x31')]=_['keys'](_0x2ab23d['query']);_0x3c5d2d['filters']=_[_0x7df9('0x33')](_0x3c5d2d[_0x7df9('0x34')],_0x3c5d2d[_0x7df9('0x31')]);_0x214131[_0x7df9('0x35')]=_[_0x7df9('0x33')](_0x3c5d2d[_0x7df9('0x34')],qs[_0x7df9('0x36')](_0x2ab23d[_0x7df9('0x31')][_0x7df9('0x36')]));_0x214131[_0x7df9('0x35')]=_0x214131[_0x7df9('0x35')]['length']?_0x214131[_0x7df9('0x35')]:_0x3c5d2d[_0x7df9('0x34')];_0x214131[_0x7df9('0x37')]=qs[_0x7df9('0x38')](_0x2ab23d[_0x7df9('0x31')][_0x7df9('0x38')]);_0x214131[_0x7df9('0x39')]=qs[_0x7df9('0x32')](_['pick'](_0x2ab23d[_0x7df9('0x31')],_0x3c5d2d[_0x7df9('0x32')]));if(_0x2ab23d['query'][_0x7df9('0x3b')]){_0x214131[_0x7df9('0x39')]=_[_0x7df9('0x3c')](_0x214131[_0x7df9('0x39')],{'$or':_[_0x7df9('0x2b')](_0x214131[_0x7df9('0x35')],function(_0x56d120){var _0x223e9c={};_0x223e9c[_0x56d120]={'$like':'%'+_0x2ab23d[_0x7df9('0x31')][_0x7df9('0x3b')]+'%'};return _0x223e9c;})});}_0x214131=_['merge']({},_0x214131,_0x2ab23d[_0x7df9('0x3e')]);return _0x248acf[_0x7df9('0x4e')](_0x214131);}})[_0x7df9('0x25')](function(_0x5ae844){if(_0x5ae844){_0x58287f=_0x5ae844['length'];if(!_0x2ab23d['query'][_0x7df9('0x50')]('nolimit')){_0x214131[_0x7df9('0x1f')]=qs['limit'](_0x2ab23d[_0x7df9('0x31')][_0x7df9('0x1f')]);_0x214131[_0x7df9('0x21')]=qs[_0x7df9('0x21')](_0x2ab23d['query']['offset']);}return _0x248acf[_0x7df9('0x4e')](_0x214131);}})[_0x7df9('0x25')](function(_0x5e623a){if(_0x5e623a){return _0x5e623a?{'count':_0x58287f,'rows':_0x5e623a}:null;}})[_0x7df9('0x25')](respondWithResult(_0x5ca483,null))[_0x7df9('0x42')](handleError(_0x5ca483,null));};exports[_0x7df9('0x51')]=function(_0x598f5c,_0x4569a3,_0x2cbb52){var _0x3a55fc={};var _0x4c4710={};var _0x5051b7;var _0x3729ca;return db[_0x7df9('0x44')][_0x7df9('0x4c')]({'where':{'id':_0x598f5c['params']['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x4569a3,null))[_0x7df9('0x25')](function(_0x18412b){if(_0x18412b){_0x5051b7=_0x18412b;_0x4c4710[_0x7df9('0x34')]=_[_0x7df9('0x30')](db[_0x7df9('0x4f')][_0x7df9('0x2c')]);_0x4c4710[_0x7df9('0x31')]=_['keys'](_0x598f5c[_0x7df9('0x31')]);_0x4c4710[_0x7df9('0x32')]=_[_0x7df9('0x33')](_0x4c4710[_0x7df9('0x34')],_0x4c4710[_0x7df9('0x31')]);_0x3a55fc['attributes']=_['intersection'](_0x4c4710[_0x7df9('0x34')],qs[_0x7df9('0x36')](_0x598f5c[_0x7df9('0x31')][_0x7df9('0x36')]));_0x3a55fc[_0x7df9('0x35')]=_0x3a55fc['attributes'][_0x7df9('0x45')]?_0x3a55fc[_0x7df9('0x35')]:_0x4c4710[_0x7df9('0x34')];_0x3a55fc[_0x7df9('0x37')]=qs['sort'](_0x598f5c[_0x7df9('0x31')][_0x7df9('0x38')]);_0x3a55fc[_0x7df9('0x39')]=qs[_0x7df9('0x32')](_[_0x7df9('0x3a')](_0x598f5c['query'],_0x4c4710[_0x7df9('0x32')]));if(_0x598f5c[_0x7df9('0x31')][_0x7df9('0x3b')]){_0x3a55fc[_0x7df9('0x39')]=_[_0x7df9('0x3c')](_0x3a55fc[_0x7df9('0x39')],{'$or':_[_0x7df9('0x2b')](_0x3a55fc[_0x7df9('0x35')],function(_0xc2e64c){var _0x532576={};_0x532576[_0xc2e64c]={'$like':'%'+_0x598f5c['query'][_0x7df9('0x3b')]+'%'};return _0x532576;})});}_0x3a55fc=_[_0x7df9('0x3c')]({},_0x3a55fc,_0x598f5c['options']);return _0x5051b7[_0x7df9('0x51')](_0x3a55fc);}})['then'](function(_0x97b19e){if(_0x97b19e){_0x3729ca=_0x97b19e['length'];if(!_0x598f5c['query'][_0x7df9('0x50')](_0x7df9('0x4d'))){_0x3a55fc[_0x7df9('0x1f')]=qs[_0x7df9('0x1f')](_0x598f5c[_0x7df9('0x31')]['limit']);_0x3a55fc['offset']=qs[_0x7df9('0x21')](_0x598f5c[_0x7df9('0x31')][_0x7df9('0x21')]);}return _0x5051b7['getDescriptions'](_0x3a55fc);}})[_0x7df9('0x25')](function(_0xf645ca){if(_0xf645ca){return _0xf645ca?{'count':_0x3729ca,'rows':_0xf645ca}:null;}})['then'](respondWithResult(_0x4569a3,null))[_0x7df9('0x42')](handleError(_0x4569a3,null));};exports[_0x7df9('0x52')]=function(_0x5d92c5,_0x2e69ff,_0x8d6249){var _0x4ba40d={};var _0x15b961={};var _0x1fde65;var _0x5b0a49;return db[_0x7df9('0x44')][_0x7df9('0x4c')]({'where':{'id':_0x5d92c5[_0x7df9('0x4a')]['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x2e69ff,null))[_0x7df9('0x25')](function(_0x2b27e1){if(_0x2b27e1){_0x1fde65=_0x2b27e1;_0x15b961[_0x7df9('0x34')]=_[_0x7df9('0x30')](db['Tag'][_0x7df9('0x2c')]);_0x15b961[_0x7df9('0x31')]=_[_0x7df9('0x30')](_0x5d92c5[_0x7df9('0x31')]);_0x15b961[_0x7df9('0x32')]=_[_0x7df9('0x33')](_0x15b961[_0x7df9('0x34')],_0x15b961[_0x7df9('0x31')]);_0x4ba40d['attributes']=_['intersection'](_0x15b961['model'],qs['fields'](_0x5d92c5[_0x7df9('0x31')][_0x7df9('0x36')]));_0x4ba40d[_0x7df9('0x35')]=_0x4ba40d[_0x7df9('0x35')][_0x7df9('0x45')]?_0x4ba40d[_0x7df9('0x35')]:_0x15b961[_0x7df9('0x34')];_0x4ba40d['order']=qs[_0x7df9('0x38')](_0x5d92c5[_0x7df9('0x31')][_0x7df9('0x38')]);_0x4ba40d[_0x7df9('0x39')]=qs[_0x7df9('0x32')](_[_0x7df9('0x3a')](_0x5d92c5[_0x7df9('0x31')],_0x15b961[_0x7df9('0x32')]));if(_0x5d92c5[_0x7df9('0x31')][_0x7df9('0x3b')]){_0x4ba40d[_0x7df9('0x39')]=_['merge'](_0x4ba40d[_0x7df9('0x39')],{'$or':_[_0x7df9('0x2b')](_0x4ba40d[_0x7df9('0x35')],function(_0x462d56){var _0x4b78ee={};_0x4b78ee[_0x462d56]={'$like':'%'+_0x5d92c5[_0x7df9('0x31')][_0x7df9('0x3b')]+'%'};return _0x4b78ee;})});}_0x4ba40d=_[_0x7df9('0x3c')]({},_0x4ba40d,_0x5d92c5[_0x7df9('0x3e')]);return _0x1fde65['getTags'](_0x4ba40d);}})['then'](function(_0x474ebc){if(_0x474ebc){_0x5b0a49=_0x474ebc[_0x7df9('0x45')];if(!_0x5d92c5[_0x7df9('0x31')]['hasOwnProperty'](_0x7df9('0x4d'))){_0x4ba40d[_0x7df9('0x1f')]=qs['limit'](_0x5d92c5[_0x7df9('0x31')][_0x7df9('0x1f')]);_0x4ba40d['offset']=qs[_0x7df9('0x21')](_0x5d92c5[_0x7df9('0x31')]['offset']);}return _0x1fde65[_0x7df9('0x52')](_0x4ba40d);}})['then'](function(_0x494991){if(_0x494991){return _0x494991?{'count':_0x5b0a49,'rows':_0x494991}:null;}})[_0x7df9('0x25')](respondWithResult(_0x2e69ff,null))[_0x7df9('0x42')](handleError(_0x2e69ff,null));};exports[_0x7df9('0x53')]=function(_0x544837,_0x37c58b,_0x5c8e72){if(_0x544837[_0x7df9('0x49')]['id']){delete _0x544837[_0x7df9('0x49')]['id'];}return db[_0x7df9('0x44')]['findOne']({'where':{'id':_0x544837['params']['id']}})[_0x7df9('0x25')](handleEntityNotFound(_0x37c58b,null))[_0x7df9('0x25')](function(_0x1261b1){if(_0x1261b1){return _0x1261b1['setTags'](_0x544837[_0x7df9('0x49')][_0x7df9('0x54')]||[]);}return null;})[_0x7df9('0x25')](respondWithResult(_0x37c58b,null))[_0x7df9('0x42')](handleError(_0x37c58b,null));}; \ No newline at end of file +var _0x7e13=['order','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','index','rawAttributes','type','model','map','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','rows','catch','show','find','create','body','params','destroy','getFields','findOne','FreshdeskField','getSubjects'];(function(_0x190255,_0x52c84c){var _0x24f0bd=function(_0x5771eb){while(--_0x5771eb){_0x190255['push'](_0x190255['shift']());}};_0x24f0bd(++_0x52c84c);}(_0x7e13,0x14a));var _0x37e1=function(_0x3bfc8b,_0x2ed077){_0x3bfc8b=_0x3bfc8b-0x0;var _0x123881=_0x7e13[_0x3bfc8b];return _0x123881;};'use strict';var emlformat=require(_0x37e1('0x0'));var rimraf=require(_0x37e1('0x1'));var zipdir=require(_0x37e1('0x2'));var jsonpatch=require(_0x37e1('0x3'));var rp=require('request-promise');var moment=require(_0x37e1('0x4'));var BPromise=require(_0x37e1('0x5'));var Mustache=require(_0x37e1('0x6'));var util=require(_0x37e1('0x7'));var path=require('path');var sox=require(_0x37e1('0x8'));var csv=require(_0x37e1('0x9'));var ejs=require(_0x37e1('0xa'));var fs=require('fs');var fs_extra=require(_0x37e1('0xb'));var _=require(_0x37e1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x37e1('0xd'));var toCsv=require(_0x37e1('0x9'));var querystring=require(_0x37e1('0xe'));var Papa=require(_0x37e1('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x37e1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x37e1('0x11'));var logger=require('../../config/logger')(_0x37e1('0x12'));var utils=require(_0x37e1('0x13'));var config=require(_0x37e1('0x14'));var licenseUtil=require(_0x37e1('0x15'));var db=require(_0x37e1('0x16'))['db'];function respondWithStatusCode(_0x54400d,_0x37bac8){_0x37bac8=_0x37bac8||0xcc;return function(_0x44aac5){if(_0x44aac5){return _0x54400d['sendStatus'](_0x37bac8);}return _0x54400d[_0x37e1('0x17')](_0x37bac8)['end']();};}function respondWithResult(_0x2ecd1b,_0x5e2c03){_0x5e2c03=_0x5e2c03||0xc8;return function(_0x38540f){if(_0x38540f){return _0x2ecd1b['status'](_0x5e2c03)[_0x37e1('0x18')](_0x38540f);}};}function respondWithFilteredResult(_0x3dad33,_0x59abc3){return function(_0x4f8ee6){if(_0x4f8ee6){var _0x109109=typeof _0x59abc3[_0x37e1('0x19')]===_0x37e1('0x1a')&&typeof _0x59abc3[_0x37e1('0x1b')]===_0x37e1('0x1a');var _0x98ebc1=_0x4f8ee6[_0x37e1('0x1c')];var _0x25408a=_0x109109?0x0:_0x59abc3[_0x37e1('0x19')];var _0x550492=_0x109109?_0x4f8ee6[_0x37e1('0x1c')]:_0x59abc3[_0x37e1('0x19')]+_0x59abc3['limit'];var _0x5a8af1;if(_0x550492>=_0x98ebc1){_0x550492=_0x98ebc1;_0x5a8af1=0xc8;}else{_0x5a8af1=0xce;}_0x3dad33[_0x37e1('0x17')](_0x5a8af1);return _0x3dad33['set'](_0x37e1('0x1d'),_0x25408a+'-'+_0x550492+'/'+_0x98ebc1)[_0x37e1('0x18')](_0x4f8ee6);}return null;};}function patchUpdates(_0x352972){return function(_0x29c048){try{jsonpatch[_0x37e1('0x1e')](_0x29c048,_0x352972,!![]);}catch(_0x22322c){return BPromise[_0x37e1('0x1f')](_0x22322c);}return _0x29c048[_0x37e1('0x20')]();};}function saveUpdates(_0x3fc474,_0x539f89){return function(_0x57538c){if(_0x57538c){return _0x57538c[_0x37e1('0x21')](_0x3fc474)[_0x37e1('0x22')](function(_0x4a46fb){return _0x4a46fb;});}return null;};}function removeEntity(_0x7f3d1a,_0xbcee5){return function(_0x57d785){if(_0x57d785){return _0x57d785['destroy']()[_0x37e1('0x22')](function(){_0x7f3d1a[_0x37e1('0x17')](0xcc)[_0x37e1('0x23')]();});}};}function handleEntityNotFound(_0x380cd6,_0x4d90e3){return function(_0x13c28d){if(!_0x13c28d){_0x380cd6[_0x37e1('0x24')](0x194);}return _0x13c28d;};}function handleError(_0x630551,_0x562fa1){_0x562fa1=_0x562fa1||0x1f4;return function(_0x167ebd){logger['error'](_0x167ebd[_0x37e1('0x25')]);if(_0x167ebd[_0x37e1('0x26')]){delete _0x167ebd['name'];}_0x630551[_0x37e1('0x17')](_0x562fa1)['send'](_0x167ebd);};}exports[_0x37e1('0x27')]=function(_0x5f39e6,_0x320597){var _0x45d3bd={},_0x1631c4={},_0x2f9a6f={'count':0x0,'rows':[]};var _0x532b9b=_['map'](db['FreshdeskConfiguration'][_0x37e1('0x28')],function(_0xde2cff){return{'name':_0xde2cff['fieldName'],'type':_0xde2cff[_0x37e1('0x29')]['key']};});_0x1631c4[_0x37e1('0x2a')]=_[_0x37e1('0x2b')](_0x532b9b,_0x37e1('0x26'));_0x1631c4['query']=_[_0x37e1('0x2c')](_0x5f39e6['query']);_0x1631c4['filters']=_[_0x37e1('0x2d')](_0x1631c4[_0x37e1('0x2a')],_0x1631c4[_0x37e1('0x2e')]);_0x45d3bd[_0x37e1('0x2f')]=_['intersection'](_0x1631c4[_0x37e1('0x2a')],qs[_0x37e1('0x30')](_0x5f39e6[_0x37e1('0x2e')][_0x37e1('0x30')]));_0x45d3bd[_0x37e1('0x2f')]=_0x45d3bd['attributes'][_0x37e1('0x31')]?_0x45d3bd['attributes']:_0x1631c4[_0x37e1('0x2a')];if(!_0x5f39e6[_0x37e1('0x2e')][_0x37e1('0x32')](_0x37e1('0x33'))){_0x45d3bd[_0x37e1('0x1b')]=qs[_0x37e1('0x1b')](_0x5f39e6[_0x37e1('0x2e')]['limit']);_0x45d3bd[_0x37e1('0x19')]=qs[_0x37e1('0x19')](_0x5f39e6[_0x37e1('0x2e')][_0x37e1('0x19')]);}_0x45d3bd['order']=qs[_0x37e1('0x34')](_0x5f39e6[_0x37e1('0x2e')][_0x37e1('0x34')]);_0x45d3bd['where']=qs[_0x37e1('0x35')](_[_0x37e1('0x36')](_0x5f39e6[_0x37e1('0x2e')],_0x1631c4['filters']),_0x532b9b);if(_0x5f39e6[_0x37e1('0x2e')][_0x37e1('0x37')]){_0x45d3bd[_0x37e1('0x38')]=_[_0x37e1('0x39')](_0x45d3bd[_0x37e1('0x38')],{'$or':_[_0x37e1('0x2b')](_0x532b9b,function(_0x2e1505){if(_0x2e1505[_0x37e1('0x29')]!==_0x37e1('0x3a')){var _0x2dd6c1={};_0x2dd6c1[_0x2e1505[_0x37e1('0x26')]]={'$like':'%'+_0x5f39e6['query'][_0x37e1('0x37')]+'%'};return _0x2dd6c1;}})});}_0x45d3bd=_['merge']({},_0x45d3bd,_0x5f39e6[_0x37e1('0x3b')]);var _0x57231b={'where':_0x45d3bd['where']};return db[_0x37e1('0x3c')][_0x37e1('0x1c')](_0x57231b)[_0x37e1('0x22')](function(_0x281756){_0x2f9a6f[_0x37e1('0x1c')]=_0x281756;if(_0x5f39e6[_0x37e1('0x2e')][_0x37e1('0x3d')]){_0x45d3bd[_0x37e1('0x3e')]=[{'all':!![]}];}return db[_0x37e1('0x3c')]['findAll'](_0x45d3bd);})[_0x37e1('0x22')](function(_0x3970a4){_0x2f9a6f[_0x37e1('0x3f')]=_0x3970a4;return _0x2f9a6f;})['then'](respondWithFilteredResult(_0x320597,_0x45d3bd))[_0x37e1('0x40')](handleError(_0x320597,null));};exports[_0x37e1('0x41')]=function(_0x5bf969,_0x194a44){var _0x51701b={'raw':![],'where':{'id':_0x5bf969['params']['id']}},_0x1a6241={};_0x1a6241['model']=_[_0x37e1('0x2c')](db['FreshdeskConfiguration'][_0x37e1('0x28')]);_0x1a6241[_0x37e1('0x2e')]=_[_0x37e1('0x2c')](_0x5bf969['query']);_0x1a6241[_0x37e1('0x35')]=_[_0x37e1('0x2d')](_0x1a6241[_0x37e1('0x2a')],_0x1a6241['query']);_0x51701b['attributes']=_[_0x37e1('0x2d')](_0x1a6241[_0x37e1('0x2a')],qs[_0x37e1('0x30')](_0x5bf969[_0x37e1('0x2e')][_0x37e1('0x30')]));_0x51701b[_0x37e1('0x2f')]=_0x51701b[_0x37e1('0x2f')][_0x37e1('0x31')]?_0x51701b[_0x37e1('0x2f')]:_0x1a6241['model'];if(_0x5bf969[_0x37e1('0x2e')]['includeAll']){_0x51701b[_0x37e1('0x3e')]=[{'all':!![]}];}_0x51701b=_[_0x37e1('0x39')]({},_0x51701b,_0x5bf969[_0x37e1('0x3b')]);return db[_0x37e1('0x3c')][_0x37e1('0x42')](_0x51701b)[_0x37e1('0x22')](handleEntityNotFound(_0x194a44,null))[_0x37e1('0x22')](respondWithResult(_0x194a44,null))[_0x37e1('0x40')](handleError(_0x194a44,null));};exports[_0x37e1('0x43')]=function(_0x19e075,_0x4a6827){return db[_0x37e1('0x3c')]['create'](_0x19e075['body'],{})[_0x37e1('0x22')](respondWithResult(_0x4a6827,0xc9))[_0x37e1('0x40')](handleError(_0x4a6827,null));};exports[_0x37e1('0x21')]=function(_0x56b871,_0x5bcd41){if(_0x56b871[_0x37e1('0x44')]['id']){delete _0x56b871[_0x37e1('0x44')]['id'];}return db[_0x37e1('0x3c')][_0x37e1('0x42')]({'where':{'id':_0x56b871[_0x37e1('0x45')]['id']}})['then'](handleEntityNotFound(_0x5bcd41,null))[_0x37e1('0x22')](saveUpdates(_0x56b871[_0x37e1('0x44')],null))[_0x37e1('0x22')](respondWithResult(_0x5bcd41,null))[_0x37e1('0x40')](handleError(_0x5bcd41,null));};exports[_0x37e1('0x46')]=function(_0x4040c2,_0x3d3f2d){return db['FreshdeskConfiguration'][_0x37e1('0x42')]({'where':{'id':_0x4040c2[_0x37e1('0x45')]['id']}})[_0x37e1('0x22')](handleEntityNotFound(_0x3d3f2d,null))[_0x37e1('0x22')](removeEntity(_0x3d3f2d,null))['catch'](handleError(_0x3d3f2d,null));};exports[_0x37e1('0x47')]=function(_0x52ddaa,_0x42a213,_0x4e25da){var _0x57d3ab={};var _0x36664d={};var _0x2d0dd9;var _0x17ea3c;return db[_0x37e1('0x3c')][_0x37e1('0x48')]({'where':{'id':_0x52ddaa['params']['id']}})[_0x37e1('0x22')](handleEntityNotFound(_0x42a213,null))[_0x37e1('0x22')](function(_0x1337b7){if(_0x1337b7){_0x2d0dd9=_0x1337b7;_0x36664d[_0x37e1('0x2a')]=_[_0x37e1('0x2c')](db[_0x37e1('0x49')][_0x37e1('0x28')]);_0x36664d[_0x37e1('0x2e')]=_[_0x37e1('0x2c')](_0x52ddaa['query']);_0x36664d[_0x37e1('0x35')]=_[_0x37e1('0x2d')](_0x36664d['model'],_0x36664d['query']);_0x57d3ab['attributes']=_[_0x37e1('0x2d')](_0x36664d[_0x37e1('0x2a')],qs[_0x37e1('0x30')](_0x52ddaa[_0x37e1('0x2e')][_0x37e1('0x30')]));_0x57d3ab['attributes']=_0x57d3ab[_0x37e1('0x2f')]['length']?_0x57d3ab[_0x37e1('0x2f')]:_0x36664d['model'];_0x57d3ab['order']=qs[_0x37e1('0x34')](_0x52ddaa['query'][_0x37e1('0x34')]);_0x57d3ab[_0x37e1('0x38')]=qs['filters'](_[_0x37e1('0x36')](_0x52ddaa[_0x37e1('0x2e')],_0x36664d[_0x37e1('0x35')]));if(_0x52ddaa['query'][_0x37e1('0x37')]){_0x57d3ab[_0x37e1('0x38')]=_[_0x37e1('0x39')](_0x57d3ab['where'],{'$or':_['map'](_0x57d3ab[_0x37e1('0x2f')],function(_0x561759){var _0x50bde7={};_0x50bde7[_0x561759]={'$like':'%'+_0x52ddaa['query'][_0x37e1('0x37')]+'%'};return _0x50bde7;})});}_0x57d3ab=_[_0x37e1('0x39')]({},_0x57d3ab,_0x52ddaa[_0x37e1('0x3b')]);return _0x2d0dd9['getFields'](_0x57d3ab);}})[_0x37e1('0x22')](function(_0x1c3000){if(_0x1c3000){_0x17ea3c=_0x1c3000[_0x37e1('0x31')];if(!_0x52ddaa[_0x37e1('0x2e')][_0x37e1('0x32')]('nolimit')){_0x57d3ab[_0x37e1('0x1b')]=qs['limit'](_0x52ddaa[_0x37e1('0x2e')][_0x37e1('0x1b')]);_0x57d3ab['offset']=qs[_0x37e1('0x19')](_0x52ddaa[_0x37e1('0x2e')][_0x37e1('0x19')]);}return _0x2d0dd9[_0x37e1('0x47')](_0x57d3ab);}})['then'](function(_0x3c620b){if(_0x3c620b){return _0x3c620b?{'count':_0x17ea3c,'rows':_0x3c620b}:null;}})[_0x37e1('0x22')](respondWithResult(_0x42a213,null))[_0x37e1('0x40')](handleError(_0x42a213,null));};exports[_0x37e1('0x4a')]=function(_0xd6cbf7,_0xe74144,_0x1ec201){var _0x2b25b9={};var _0x5df67a={};var _0x1f8d1f;var _0x38da63;return db[_0x37e1('0x3c')][_0x37e1('0x48')]({'where':{'id':_0xd6cbf7['params']['id']}})[_0x37e1('0x22')](handleEntityNotFound(_0xe74144,null))[_0x37e1('0x22')](function(_0x491d52){if(_0x491d52){_0x1f8d1f=_0x491d52;_0x5df67a[_0x37e1('0x2a')]=_[_0x37e1('0x2c')](db[_0x37e1('0x49')][_0x37e1('0x28')]);_0x5df67a[_0x37e1('0x2e')]=_['keys'](_0xd6cbf7[_0x37e1('0x2e')]);_0x5df67a[_0x37e1('0x35')]=_[_0x37e1('0x2d')](_0x5df67a['model'],_0x5df67a[_0x37e1('0x2e')]);_0x2b25b9['attributes']=_[_0x37e1('0x2d')](_0x5df67a[_0x37e1('0x2a')],qs[_0x37e1('0x30')](_0xd6cbf7[_0x37e1('0x2e')]['fields']));_0x2b25b9[_0x37e1('0x2f')]=_0x2b25b9['attributes'][_0x37e1('0x31')]?_0x2b25b9[_0x37e1('0x2f')]:_0x5df67a[_0x37e1('0x2a')];_0x2b25b9[_0x37e1('0x4b')]=qs[_0x37e1('0x34')](_0xd6cbf7['query']['sort']);_0x2b25b9[_0x37e1('0x38')]=qs['filters'](_[_0x37e1('0x36')](_0xd6cbf7[_0x37e1('0x2e')],_0x5df67a[_0x37e1('0x35')]));if(_0xd6cbf7[_0x37e1('0x2e')][_0x37e1('0x37')]){_0x2b25b9[_0x37e1('0x38')]=_[_0x37e1('0x39')](_0x2b25b9[_0x37e1('0x38')],{'$or':_['map'](_0x2b25b9[_0x37e1('0x2f')],function(_0x5c54dd){var _0x37e42a={};_0x37e42a[_0x5c54dd]={'$like':'%'+_0xd6cbf7['query'][_0x37e1('0x37')]+'%'};return _0x37e42a;})});}_0x2b25b9=_['merge']({},_0x2b25b9,_0xd6cbf7[_0x37e1('0x3b')]);return _0x1f8d1f[_0x37e1('0x4a')](_0x2b25b9);}})['then'](function(_0x35d7ef){if(_0x35d7ef){_0x38da63=_0x35d7ef['length'];if(!_0xd6cbf7['query'][_0x37e1('0x32')](_0x37e1('0x33'))){_0x2b25b9[_0x37e1('0x1b')]=qs[_0x37e1('0x1b')](_0xd6cbf7['query'][_0x37e1('0x1b')]);_0x2b25b9[_0x37e1('0x19')]=qs[_0x37e1('0x19')](_0xd6cbf7['query'][_0x37e1('0x19')]);}return _0x1f8d1f[_0x37e1('0x4a')](_0x2b25b9);}})['then'](function(_0x5bd1ae){if(_0x5bd1ae){return _0x5bd1ae?{'count':_0x38da63,'rows':_0x5bd1ae}:null;}})[_0x37e1('0x22')](respondWithResult(_0xe74144,null))[_0x37e1('0x40')](handleError(_0xe74144,null));};exports[_0x37e1('0x4c')]=function(_0x4c944b,_0x3ebb0b,_0x2445f5){var _0x2d46ab={};var _0x52b714={};var _0x2582c0;var _0x2408f5;return db[_0x37e1('0x3c')][_0x37e1('0x48')]({'where':{'id':_0x4c944b['params']['id']}})[_0x37e1('0x22')](handleEntityNotFound(_0x3ebb0b,null))[_0x37e1('0x22')](function(_0x31916f){if(_0x31916f){_0x2582c0=_0x31916f;_0x52b714['model']=_[_0x37e1('0x2c')](db[_0x37e1('0x49')][_0x37e1('0x28')]);_0x52b714[_0x37e1('0x2e')]=_['keys'](_0x4c944b['query']);_0x52b714[_0x37e1('0x35')]=_[_0x37e1('0x2d')](_0x52b714['model'],_0x52b714[_0x37e1('0x2e')]);_0x2d46ab['attributes']=_[_0x37e1('0x2d')](_0x52b714['model'],qs[_0x37e1('0x30')](_0x4c944b[_0x37e1('0x2e')][_0x37e1('0x30')]));_0x2d46ab['attributes']=_0x2d46ab['attributes'][_0x37e1('0x31')]?_0x2d46ab[_0x37e1('0x2f')]:_0x52b714[_0x37e1('0x2a')];_0x2d46ab[_0x37e1('0x4b')]=qs[_0x37e1('0x34')](_0x4c944b[_0x37e1('0x2e')][_0x37e1('0x34')]);_0x2d46ab[_0x37e1('0x38')]=qs[_0x37e1('0x35')](_[_0x37e1('0x36')](_0x4c944b[_0x37e1('0x2e')],_0x52b714[_0x37e1('0x35')]));if(_0x4c944b[_0x37e1('0x2e')][_0x37e1('0x37')]){_0x2d46ab[_0x37e1('0x38')]=_[_0x37e1('0x39')](_0x2d46ab[_0x37e1('0x38')],{'$or':_[_0x37e1('0x2b')](_0x2d46ab[_0x37e1('0x2f')],function(_0x44a70c){var _0x19837c={};_0x19837c[_0x44a70c]={'$like':'%'+_0x4c944b[_0x37e1('0x2e')][_0x37e1('0x37')]+'%'};return _0x19837c;})});}_0x2d46ab=_[_0x37e1('0x39')]({},_0x2d46ab,_0x4c944b[_0x37e1('0x3b')]);return _0x2582c0[_0x37e1('0x4c')](_0x2d46ab);}})[_0x37e1('0x22')](function(_0x2a0281){if(_0x2a0281){_0x2408f5=_0x2a0281[_0x37e1('0x31')];if(!_0x4c944b['query'][_0x37e1('0x32')](_0x37e1('0x33'))){_0x2d46ab[_0x37e1('0x1b')]=qs['limit'](_0x4c944b[_0x37e1('0x2e')][_0x37e1('0x1b')]);_0x2d46ab['offset']=qs[_0x37e1('0x19')](_0x4c944b['query'][_0x37e1('0x19')]);}return _0x2582c0['getDescriptions'](_0x2d46ab);}})[_0x37e1('0x22')](function(_0x2ab3b5){if(_0x2ab3b5){return _0x2ab3b5?{'count':_0x2408f5,'rows':_0x2ab3b5}:null;}})[_0x37e1('0x22')](respondWithResult(_0x3ebb0b,null))[_0x37e1('0x40')](handleError(_0x3ebb0b,null));};exports[_0x37e1('0x4d')]=function(_0x4d4ea9,_0x1218ee,_0x6c1dd3){var _0x2a6931={};var _0x3bb357={};var _0x4363a7;var _0x337fff;return db[_0x37e1('0x3c')]['findOne']({'where':{'id':_0x4d4ea9[_0x37e1('0x45')]['id']}})[_0x37e1('0x22')](handleEntityNotFound(_0x1218ee,null))['then'](function(_0x1bd062){if(_0x1bd062){_0x4363a7=_0x1bd062;_0x3bb357[_0x37e1('0x2a')]=_['keys'](db[_0x37e1('0x4e')]['rawAttributes']);_0x3bb357['query']=_[_0x37e1('0x2c')](_0x4d4ea9[_0x37e1('0x2e')]);_0x3bb357['filters']=_[_0x37e1('0x2d')](_0x3bb357['model'],_0x3bb357[_0x37e1('0x2e')]);_0x2a6931['attributes']=_[_0x37e1('0x2d')](_0x3bb357[_0x37e1('0x2a')],qs[_0x37e1('0x30')](_0x4d4ea9[_0x37e1('0x2e')]['fields']));_0x2a6931[_0x37e1('0x2f')]=_0x2a6931[_0x37e1('0x2f')][_0x37e1('0x31')]?_0x2a6931[_0x37e1('0x2f')]:_0x3bb357[_0x37e1('0x2a')];_0x2a6931[_0x37e1('0x4b')]=qs['sort'](_0x4d4ea9['query'][_0x37e1('0x34')]);_0x2a6931[_0x37e1('0x38')]=qs['filters'](_[_0x37e1('0x36')](_0x4d4ea9[_0x37e1('0x2e')],_0x3bb357[_0x37e1('0x35')]));if(_0x4d4ea9[_0x37e1('0x2e')][_0x37e1('0x37')]){_0x2a6931[_0x37e1('0x38')]=_[_0x37e1('0x39')](_0x2a6931['where'],{'$or':_[_0x37e1('0x2b')](_0x2a6931[_0x37e1('0x2f')],function(_0x2ae3ca){var _0x44e03a={};_0x44e03a[_0x2ae3ca]={'$like':'%'+_0x4d4ea9[_0x37e1('0x2e')][_0x37e1('0x37')]+'%'};return _0x44e03a;})});}_0x2a6931=_[_0x37e1('0x39')]({},_0x2a6931,_0x4d4ea9[_0x37e1('0x3b')]);return _0x4363a7[_0x37e1('0x4d')](_0x2a6931);}})[_0x37e1('0x22')](function(_0x32e162){if(_0x32e162){_0x337fff=_0x32e162['length'];if(!_0x4d4ea9['query'][_0x37e1('0x32')]('nolimit')){_0x2a6931[_0x37e1('0x1b')]=qs[_0x37e1('0x1b')](_0x4d4ea9[_0x37e1('0x2e')][_0x37e1('0x1b')]);_0x2a6931[_0x37e1('0x19')]=qs[_0x37e1('0x19')](_0x4d4ea9[_0x37e1('0x2e')][_0x37e1('0x19')]);}return _0x4363a7[_0x37e1('0x4d')](_0x2a6931);}})[_0x37e1('0x22')](function(_0x35bfbb){if(_0x35bfbb){return _0x35bfbb?{'count':_0x337fff,'rows':_0x35bfbb}:null;}})[_0x37e1('0x22')](respondWithResult(_0x1218ee,null))['catch'](handleError(_0x1218ee,null));};exports[_0x37e1('0x4f')]=function(_0x43a38f,_0x172a2f,_0x4f4de6){if(_0x43a38f[_0x37e1('0x44')]['id']){delete _0x43a38f[_0x37e1('0x44')]['id'];}return db[_0x37e1('0x3c')]['findOne']({'where':{'id':_0x43a38f[_0x37e1('0x45')]['id']}})[_0x37e1('0x22')](handleEntityNotFound(_0x172a2f,null))[_0x37e1('0x22')](function(_0x59fa53){if(_0x59fa53){return _0x59fa53['setTags'](_0x43a38f[_0x37e1('0x44')][_0x37e1('0x50')]||[]);}return null;})[_0x37e1('0x22')](respondWithResult(_0x172a2f,null))[_0x37e1('0x40')](handleError(_0x172a2f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 916bc48..3e4b80a 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 _0x15d0=['exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api','bluebird','request-promise','path','rimraf','./intFreshdeskConfiguration.attributes'];(function(_0x2682d0,_0x5d481a){var _0x5140e3=function(_0x246702){while(--_0x246702){_0x2682d0['push'](_0x2682d0['shift']());}};_0x5140e3(++_0x5d481a);}(_0x15d0,0x16f));var _0x015d=function(_0x2fad77,_0x4b5e6c){_0x2fad77=_0x2fad77-0x0;var _0x5cbdb7=_0x15d0[_0x2fad77];return _0x5cbdb7;};'use strict';var _=require(_0x015d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x015d('0x1'));var moment=require('moment');var BPromise=require(_0x015d('0x2'));var rp=require(_0x015d('0x3'));var fs=require('fs');var path=require(_0x015d('0x4'));var rimraf=require(_0x015d('0x5'));var config=require('../../config/environment');var attributes=require(_0x015d('0x6'));module[_0x015d('0x7')]=function(_0x4499bd,_0x26bd1d){return _0x4499bd[_0x015d('0x8')](_0x015d('0x9'),attributes,{'tableName':_0x015d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc29e=['FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports'];(function(_0x42ad6b,_0x39a94){var _0x442838=function(_0x4dc38c){while(--_0x4dc38c){_0x42ad6b['push'](_0x42ad6b['shift']());}};_0x442838(++_0x39a94);}(_0xc29e,0x84));var _0xec29=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc29e[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xec29('0x0'));var util=require(_0xec29('0x1'));var logger=require(_0xec29('0x2'))('api');var moment=require(_0xec29('0x3'));var BPromise=require(_0xec29('0x4'));var rp=require(_0xec29('0x5'));var fs=require('fs');var path=require(_0xec29('0x6'));var rimraf=require(_0xec29('0x7'));var config=require(_0xec29('0x8'));var attributes=require(_0xec29('0x9'));module[_0xec29('0xa')]=function(_0x447288,_0x4beb12){return _0x447288['define'](_0xec29('0xb'),attributes,{'tableName':_0xec29('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 2272b15..f381383 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 _0xff88=['../../config/utils','../../config/environment','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb'];(function(_0x272b2b,_0x3d66ea){var _0x2e2178=function(_0x110325){while(--_0x110325){_0x272b2b['push'](_0x272b2b['shift']());}};_0x2e2178(++_0x3d66ea);}(_0xff88,0xea));var _0x8ff8=function(_0x2af9a2,_0x31c47e){_0x2af9a2=_0x2af9a2-0x0;var _0x53f1ee=_0xff88[_0x2af9a2];return _0x53f1ee;};'use strict';var _=require(_0x8ff8('0x0'));var util=require('util');var moment=require(_0x8ff8('0x1'));var BPromise=require(_0x8ff8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ff8('0x3'))['db'];var utils=require(_0x8ff8('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8ff8('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dd2a1,_0x420dc5,_0x442671){return new BPromise(function(_0x5cd22b,_0x15adaa){return client[_0x8ff8('0x6')](_0x3dd2a1,_0x442671)[_0x8ff8('0x7')](function(_0x17b98a){logger[_0x8ff8('0x8')](_0x8ff8('0x9'),_0x420dc5,_0x8ff8('0xa'));logger['debug'](_0x8ff8('0xb'),_0x420dc5,_0x8ff8('0xa'),JSON[_0x8ff8('0xc')](_0x17b98a));if(_0x17b98a['error']){if(_0x17b98a[_0x8ff8('0xd')][_0x8ff8('0xe')]===0x1f4){logger['error'](_0x8ff8('0x9'),_0x420dc5,_0x17b98a[_0x8ff8('0xd')][_0x8ff8('0xf')]);return _0x15adaa(_0x17b98a[_0x8ff8('0xd')][_0x8ff8('0xf')]);}logger[_0x8ff8('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x420dc5,_0x17b98a['error'][_0x8ff8('0xf')]);return _0x5cd22b(_0x17b98a[_0x8ff8('0xd')][_0x8ff8('0xf')]);}else{logger[_0x8ff8('0x8')](_0x8ff8('0x9'),_0x420dc5,'request\x20sent');_0x5cd22b(_0x17b98a['result'][_0x8ff8('0xf')]);}})[_0x8ff8('0x10')](function(_0x4227e1){logger[_0x8ff8('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x420dc5,_0x4227e1);_0x15adaa(_0x4227e1);});});} \ No newline at end of file +var _0x2e17=['../../config/utils','../../config/logger','jayson/promise','client','request','then','info','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring'];(function(_0x58c47d,_0x58e823){var _0x1f95e1=function(_0x51c204){while(--_0x51c204){_0x58c47d['push'](_0x58c47d['shift']());}};_0x1f95e1(++_0x58e823);}(_0x2e17,0x164));var _0x72e1=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0x2e17[_0x9aada2];return _0x196dff;};'use strict';var _=require('lodash');var util=require(_0x72e1('0x0'));var moment=require(_0x72e1('0x1'));var BPromise=require(_0x72e1('0x2'));var rs=require(_0x72e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x72e1('0x4'));var logger=require(_0x72e1('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x72e1('0x6'));var client=jayson[_0x72e1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31bc70,_0x1dca72,_0x427e1f){return new BPromise(function(_0x42d0ec,_0x4563b9){return client[_0x72e1('0x8')](_0x31bc70,_0x427e1f)[_0x72e1('0x9')](function(_0x84c30a){logger[_0x72e1('0xa')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x1dca72,_0x72e1('0xb'));logger[_0x72e1('0xc')](_0x72e1('0xd'),_0x1dca72,'request\x20sent',JSON[_0x72e1('0xe')](_0x84c30a));if(_0x84c30a[_0x72e1('0xf')]){if(_0x84c30a[_0x72e1('0xf')][_0x72e1('0x10')]===0x1f4){logger['error'](_0x72e1('0x11'),_0x1dca72,_0x84c30a['error']['message']);return _0x4563b9(_0x84c30a['error']['message']);}logger[_0x72e1('0xf')](_0x72e1('0x11'),_0x1dca72,_0x84c30a[_0x72e1('0xf')][_0x72e1('0x12')]);return _0x42d0ec(_0x84c30a[_0x72e1('0xf')][_0x72e1('0x12')]);}else{logger[_0x72e1('0xa')](_0x72e1('0x11'),_0x1dca72,'request\x20sent');_0x42d0ec(_0x84c30a[_0x72e1('0x13')][_0x72e1('0x12')]);}})['catch'](function(_0x4d905b){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x1dca72,_0x4d905b);_0x4563b9(_0x4d905b);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 79a430b..597e92a 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 _0xc7c9=['./intFreshdeskField.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3e0325,_0x44044d){var _0x436a8d=function(_0x1dccaa){while(--_0x1dccaa){_0x3e0325['push'](_0x3e0325['shift']());}};_0x436a8d(++_0x44044d);}(_0xc7c9,0x14f));var _0x9c7c=function(_0x318251,_0x25d317){_0x318251=_0x318251-0x0;var _0x1fda16=_0xc7c9[_0x318251];return _0x1fda16;};'use strict';var multer=require(_0x9c7c('0x0'));var util=require(_0x9c7c('0x1'));var path=require('path');var timeout=require(_0x9c7c('0x2'));var express=require(_0x9c7c('0x3'));var router=express[_0x9c7c('0x4')]();var fs_extra=require(_0x9c7c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9c7c('0x6'));var config=require('../../config/environment');var controller=require(_0x9c7c('0x7'));router['get']('/',auth[_0x9c7c('0x8')](),controller[_0x9c7c('0x9')]);router[_0x9c7c('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x9c7c('0xb')]);router[_0x9c7c('0xc')]('/',auth[_0x9c7c('0x8')](),controller['create']);router[_0x9c7c('0xd')](_0x9c7c('0xe'),auth[_0x9c7c('0x8')](),controller[_0x9c7c('0xf')]);router[_0x9c7c('0x10')](_0x9c7c('0xe'),auth[_0x9c7c('0x8')](),controller[_0x9c7c('0x11')]);module[_0x9c7c('0x12')]=router; \ No newline at end of file +var _0x0a43=['destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put','delete','/:id'];(function(_0x104099,_0x1590ce){var _0x1852ab=function(_0x59d836){while(--_0x59d836){_0x104099['push'](_0x104099['shift']());}};_0x1852ab(++_0x1590ce);}(_0x0a43,0xfe));var _0x30a4=function(_0x5149ef,_0x953a79){_0x5149ef=_0x5149ef-0x0;var _0xba29ad=_0x0a43[_0x5149ef];return _0xba29ad;};'use strict';var multer=require(_0x30a4('0x0'));var util=require('util');var path=require(_0x30a4('0x1'));var timeout=require('connect-timeout');var express=require(_0x30a4('0x2'));var router=express[_0x30a4('0x3')]();var fs_extra=require(_0x30a4('0x4'));var auth=require(_0x30a4('0x5'));var interaction=require(_0x30a4('0x6'));var config=require(_0x30a4('0x7'));var controller=require('./intFreshdeskField.controller');router[_0x30a4('0x8')]('/',auth[_0x30a4('0x9')](),controller[_0x30a4('0xa')]);router[_0x30a4('0x8')]('/:id',auth[_0x30a4('0x9')](),controller[_0x30a4('0xb')]);router[_0x30a4('0xc')]('/',auth[_0x30a4('0x9')](),controller['create']);router[_0x30a4('0xd')]('/:id',auth[_0x30a4('0x9')](),controller['update']);router[_0x30a4('0xe')](_0x30a4('0xf'),auth[_0x30a4('0x9')](),controller[_0x30a4('0x10')]);module[_0x30a4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 3f1f1e5..9b51e9a 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 _0xe5fe=['string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN','sequelize','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe5fe,0x120));var _0xee5f=function(_0xdf1d42,_0x146425){_0xdf1d42=_0xdf1d42-0x0;var _0x191f16=_0xe5fe[_0xdf1d42];return _0x191f16;};'use strict';var Sequelize=require(_0xee5f('0x0'));module[_0xee5f('0x1')]={'type':{'type':Sequelize['ENUM'](_0xee5f('0x2'),_0xee5f('0x3'),_0xee5f('0x4'),_0xee5f('0x5'),_0xee5f('0x6')),'defaultValue':_0xee5f('0x2')},'content':{'type':Sequelize[_0xee5f('0x7')]},'key':{'type':Sequelize[_0xee5f('0x7')]},'keyType':{'type':Sequelize[_0xee5f('0x8')]('string',_0xee5f('0x3'),_0xee5f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xee5f('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xee5f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee5f('0x7')]}}; \ No newline at end of file +var _0xb2bd=['STRING','variable','string','customVariable','keyValue','picklist'];(function(_0x2a7da4,_0x49d8d0){var _0x5002fe=function(_0x4913d8){while(--_0x4913d8){_0x2a7da4['push'](_0x2a7da4['shift']());}};_0x5002fe(++_0x49d8d0);}(_0xb2bd,0xe6));var _0xdb2b=function(_0x1ebee0,_0x1b28d5){_0x1ebee0=_0x1ebee0-0x0;var _0x514bad=_0xb2bd[_0x1ebee0];return _0x514bad;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xdb2b('0x0'),'variable',_0xdb2b('0x1'),_0xdb2b('0x2'),_0xdb2b('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdb2b('0x4')]},'key':{'type':Sequelize[_0xdb2b('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0xdb2b('0x0'),_0xdb2b('0x5'),_0xdb2b('0x1'))},'keyContent':{'type':Sequelize[_0xdb2b('0x4')]},'idField':{'type':Sequelize[_0xdb2b('0x4')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb2b('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8744e7c..0c2ccea 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 _0xc29b=['request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','index','map','FreshdeskField','fieldName','type','key','model','query','keys','filters','attributes','fields','length','offset','sort','where','pick','VIRTUAL','filter','options','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','include','create','body','find','eml-format','rimraf','zip-dir'];(function(_0x374cad,_0x377560){var _0x4d7633=function(_0x54eb3a){while(--_0x54eb3a){_0x374cad['push'](_0x374cad['shift']());}};_0x4d7633(++_0x377560);}(_0xc29b,0x12d));var _0xbc29=function(_0x53113d,_0x157f5e){_0x53113d=_0x53113d-0x0;var _0xfac184=_0xc29b[_0x53113d];return _0xfac184;};'use strict';var emlformat=require(_0xbc29('0x0'));var rimraf=require(_0xbc29('0x1'));var zipdir=require(_0xbc29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc29('0x3'));var moment=require(_0xbc29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbc29('0x5'));var util=require(_0xbc29('0x6'));var path=require(_0xbc29('0x7'));var sox=require(_0xbc29('0x8'));var csv=require(_0xbc29('0x9'));var ejs=require(_0xbc29('0xa'));var fs=require('fs');var fs_extra=require(_0xbc29('0xb'));var _=require(_0xbc29('0xc'));var squel=require(_0xbc29('0xd'));var crypto=require(_0xbc29('0xe'));var jsforce=require(_0xbc29('0xf'));var deskjs=require(_0xbc29('0x10'));var toCsv=require(_0xbc29('0x9'));var querystring=require(_0xbc29('0x11'));var Papa=require(_0xbc29('0x12'));var Redis=require(_0xbc29('0x13'));var authService=require(_0xbc29('0x14'));var qs=require(_0xbc29('0x15'));var as=require(_0xbc29('0x16'));var hardwareService=require(_0xbc29('0x17'));var logger=require('../../config/logger')(_0xbc29('0x18'));var utils=require(_0xbc29('0x19'));var config=require(_0xbc29('0x1a'));var licenseUtil=require(_0xbc29('0x1b'));var db=require(_0xbc29('0x1c'))['db'];function respondWithStatusCode(_0x2794c6,_0x352c9e){_0x352c9e=_0x352c9e||0xcc;return function(_0x5e581f){if(_0x5e581f){return _0x2794c6[_0xbc29('0x1d')](_0x352c9e);}return _0x2794c6[_0xbc29('0x1e')](_0x352c9e)[_0xbc29('0x1f')]();};}function respondWithResult(_0x515ea8,_0x483fbe){_0x483fbe=_0x483fbe||0xc8;return function(_0x1892fc){if(_0x1892fc){return _0x515ea8['status'](_0x483fbe)[_0xbc29('0x20')](_0x1892fc);}};}function respondWithFilteredResult(_0x3f0264,_0x46eb03){return function(_0x490030){if(_0x490030){var _0x3b31b1=typeof _0x46eb03['offset']===_0xbc29('0x21')&&typeof _0x46eb03[_0xbc29('0x22')]===_0xbc29('0x21');var _0x1e7f15=_0x490030[_0xbc29('0x23')];var _0x42b0be=_0x3b31b1?0x0:_0x46eb03['offset'];var _0x9e84e3=_0x3b31b1?_0x490030[_0xbc29('0x23')]:_0x46eb03['offset']+_0x46eb03['limit'];var _0x30c251;if(_0x9e84e3>=_0x1e7f15){_0x9e84e3=_0x1e7f15;_0x30c251=0xc8;}else{_0x30c251=0xce;}_0x3f0264['status'](_0x30c251);return _0x3f0264['set'](_0xbc29('0x24'),_0x42b0be+'-'+_0x9e84e3+'/'+_0x1e7f15)[_0xbc29('0x20')](_0x490030);}return null;};}function patchUpdates(_0x1912ea){return function(_0x371adc){try{jsonpatch[_0xbc29('0x25')](_0x371adc,_0x1912ea,!![]);}catch(_0x3b6304){return BPromise[_0xbc29('0x26')](_0x3b6304);}return _0x371adc[_0xbc29('0x27')]();};}function saveUpdates(_0x5cdc9e,_0x115592){return function(_0x35920d){if(_0x35920d){return _0x35920d[_0xbc29('0x28')](_0x5cdc9e)[_0xbc29('0x29')](function(_0x1ae3f2){return _0x1ae3f2;});}return null;};}function removeEntity(_0x5c6f6d,_0x24523f){return function(_0x3ca9dc){if(_0x3ca9dc){return _0x3ca9dc[_0xbc29('0x2a')]()[_0xbc29('0x29')](function(){_0x5c6f6d['status'](0xcc)[_0xbc29('0x1f')]();});}};}function handleEntityNotFound(_0x3ad136,_0x536bd2){return function(_0xd3d9a5){if(!_0xd3d9a5){_0x3ad136[_0xbc29('0x1d')](0x194);}return _0xd3d9a5;};}function handleError(_0x511fa7,_0x4983b5){_0x4983b5=_0x4983b5||0x1f4;return function(_0x2c7b63){logger['error'](_0x2c7b63['stack']);if(_0x2c7b63[_0xbc29('0x2b')]){delete _0x2c7b63[_0xbc29('0x2b')];}_0x511fa7[_0xbc29('0x1e')](_0x4983b5)['send'](_0x2c7b63);};}exports[_0xbc29('0x2c')]=function(_0x3febdf,_0x1e11b3){var _0x2f23c2={},_0x1797c9={},_0x549cb5={'count':0x0,'rows':[]};var _0x55971f=_[_0xbc29('0x2d')](db[_0xbc29('0x2e')]['rawAttributes'],function(_0x2d89e1){return{'name':_0x2d89e1[_0xbc29('0x2f')],'type':_0x2d89e1[_0xbc29('0x30')][_0xbc29('0x31')]};});_0x1797c9[_0xbc29('0x32')]=_[_0xbc29('0x2d')](_0x55971f,'name');_0x1797c9[_0xbc29('0x33')]=_[_0xbc29('0x34')](_0x3febdf[_0xbc29('0x33')]);_0x1797c9[_0xbc29('0x35')]=_['intersection'](_0x1797c9[_0xbc29('0x32')],_0x1797c9[_0xbc29('0x33')]);_0x2f23c2[_0xbc29('0x36')]=_['intersection'](_0x1797c9['model'],qs[_0xbc29('0x37')](_0x3febdf[_0xbc29('0x33')][_0xbc29('0x37')]));_0x2f23c2['attributes']=_0x2f23c2[_0xbc29('0x36')][_0xbc29('0x38')]?_0x2f23c2[_0xbc29('0x36')]:_0x1797c9[_0xbc29('0x32')];if(!_0x3febdf['query']['hasOwnProperty']('nolimit')){_0x2f23c2[_0xbc29('0x22')]=qs[_0xbc29('0x22')](_0x3febdf[_0xbc29('0x33')]['limit']);_0x2f23c2['offset']=qs[_0xbc29('0x39')](_0x3febdf[_0xbc29('0x33')]['offset']);}_0x2f23c2['order']=qs[_0xbc29('0x3a')](_0x3febdf[_0xbc29('0x33')][_0xbc29('0x3a')]);_0x2f23c2[_0xbc29('0x3b')]=qs[_0xbc29('0x35')](_[_0xbc29('0x3c')](_0x3febdf['query'],_0x1797c9['filters']),_0x55971f);if(_0x3febdf[_0xbc29('0x33')]['filter']){_0x2f23c2[_0xbc29('0x3b')]=_['merge'](_0x2f23c2[_0xbc29('0x3b')],{'$or':_[_0xbc29('0x2d')](_0x55971f,function(_0x37afc4){if(_0x37afc4[_0xbc29('0x30')]!==_0xbc29('0x3d')){var _0x1d2e98={};_0x1d2e98[_0x37afc4[_0xbc29('0x2b')]]={'$like':'%'+_0x3febdf[_0xbc29('0x33')][_0xbc29('0x3e')]+'%'};return _0x1d2e98;}})});}_0x2f23c2=_['merge']({},_0x2f23c2,_0x3febdf[_0xbc29('0x3f')]);var _0x202804={'where':_0x2f23c2[_0xbc29('0x3b')]};return db[_0xbc29('0x2e')][_0xbc29('0x23')](_0x202804)['then'](function(_0x1e91bd){_0x549cb5[_0xbc29('0x23')]=_0x1e91bd;if(_0x3febdf[_0xbc29('0x33')]['includeAll']){_0x2f23c2['include']=[{'all':!![]}];}return db[_0xbc29('0x2e')][_0xbc29('0x40')](_0x2f23c2);})[_0xbc29('0x29')](function(_0xf8bd18){_0x549cb5[_0xbc29('0x41')]=_0xf8bd18;return _0x549cb5;})[_0xbc29('0x29')](respondWithFilteredResult(_0x1e11b3,_0x2f23c2))[_0xbc29('0x42')](handleError(_0x1e11b3,null));};exports[_0xbc29('0x43')]=function(_0x38f119,_0x3522f1){var _0x86bad5={'raw':!![],'where':{'id':_0x38f119[_0xbc29('0x44')]['id']}},_0x33508d={};_0x33508d['model']=_[_0xbc29('0x34')](db['FreshdeskField'][_0xbc29('0x45')]);_0x33508d[_0xbc29('0x33')]=_[_0xbc29('0x34')](_0x38f119[_0xbc29('0x33')]);_0x33508d['filters']=_[_0xbc29('0x46')](_0x33508d[_0xbc29('0x32')],_0x33508d[_0xbc29('0x33')]);_0x86bad5[_0xbc29('0x36')]=_[_0xbc29('0x46')](_0x33508d['model'],qs[_0xbc29('0x37')](_0x38f119[_0xbc29('0x33')][_0xbc29('0x37')]));_0x86bad5[_0xbc29('0x36')]=_0x86bad5[_0xbc29('0x36')]['length']?_0x86bad5['attributes']:_0x33508d[_0xbc29('0x32')];if(_0x38f119[_0xbc29('0x33')][_0xbc29('0x47')]){_0x86bad5[_0xbc29('0x48')]=[{'all':!![]}];}_0x86bad5=_['merge']({},_0x86bad5,_0x38f119[_0xbc29('0x3f')]);return db[_0xbc29('0x2e')]['find'](_0x86bad5)[_0xbc29('0x29')](handleEntityNotFound(_0x3522f1,null))['then'](respondWithResult(_0x3522f1,null))[_0xbc29('0x42')](handleError(_0x3522f1,null));};exports['create']=function(_0x54a625,_0x2866b2){return db[_0xbc29('0x2e')][_0xbc29('0x49')](_0x54a625[_0xbc29('0x4a')],{})['then'](respondWithResult(_0x2866b2,0xc9))[_0xbc29('0x42')](handleError(_0x2866b2,null));};exports['update']=function(_0x55c0cc,_0x2ff594){if(_0x55c0cc[_0xbc29('0x4a')]['id']){delete _0x55c0cc[_0xbc29('0x4a')]['id'];}return db[_0xbc29('0x2e')][_0xbc29('0x4b')]({'where':{'id':_0x55c0cc[_0xbc29('0x44')]['id']}})[_0xbc29('0x29')](handleEntityNotFound(_0x2ff594,null))[_0xbc29('0x29')](saveUpdates(_0x55c0cc['body'],null))[_0xbc29('0x29')](respondWithResult(_0x2ff594,null))[_0xbc29('0x42')](handleError(_0x2ff594,null));};exports[_0xbc29('0x2a')]=function(_0x599ba7,_0x3f4323){return db[_0xbc29('0x2e')]['find']({'where':{'id':_0x599ba7[_0xbc29('0x44')]['id']}})[_0xbc29('0x29')](handleEntityNotFound(_0x3f4323,null))[_0xbc29('0x29')](removeEntity(_0x3f4323,null))[_0xbc29('0x42')](handleError(_0x3f4323,null));}; \ No newline at end of file +var _0x3667=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','options','includeAll','findAll','catch','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1378a1,_0x270139){var _0x2fa34b=function(_0x40e7ae){while(--_0x40e7ae){_0x1378a1['push'](_0x1378a1['shift']());}};_0x2fa34b(++_0x270139);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x7366('0x0'));var rimraf=require(_0x7366('0x1'));var zipdir=require(_0x7366('0x2'));var jsonpatch=require(_0x7366('0x3'));var rp=require(_0x7366('0x4'));var moment=require('moment');var BPromise=require(_0x7366('0x5'));var Mustache=require(_0x7366('0x6'));var util=require('util');var path=require(_0x7366('0x7'));var sox=require(_0x7366('0x8'));var csv=require(_0x7366('0x9'));var ejs=require(_0x7366('0xa'));var fs=require('fs');var fs_extra=require(_0x7366('0xb'));var _=require('lodash');var squel=require(_0x7366('0xc'));var crypto=require(_0x7366('0xd'));var jsforce=require(_0x7366('0xe'));var deskjs=require(_0x7366('0xf'));var toCsv=require(_0x7366('0x9'));var querystring=require(_0x7366('0x10'));var Papa=require(_0x7366('0x11'));var Redis=require(_0x7366('0x12'));var authService=require(_0x7366('0x13'));var qs=require(_0x7366('0x14'));var as=require(_0x7366('0x15'));var hardwareService=require(_0x7366('0x16'));var logger=require(_0x7366('0x17'))(_0x7366('0x18'));var utils=require(_0x7366('0x19'));var config=require(_0x7366('0x1a'));var licenseUtil=require(_0x7366('0x1b'));var db=require(_0x7366('0x1c'))['db'];function respondWithStatusCode(_0xd5bac8,_0x3e3a73){_0x3e3a73=_0x3e3a73||0xcc;return function(_0x262659){if(_0x262659){return _0xd5bac8[_0x7366('0x1d')](_0x3e3a73);}return _0xd5bac8[_0x7366('0x1e')](_0x3e3a73)[_0x7366('0x1f')]();};}function respondWithResult(_0x308253,_0x27500c){_0x27500c=_0x27500c||0xc8;return function(_0x22562f){if(_0x22562f){return _0x308253[_0x7366('0x1e')](_0x27500c)['json'](_0x22562f);}};}function respondWithFilteredResult(_0x23e763,_0x308752){return function(_0x338719){if(_0x338719){var _0x2c0422=typeof _0x308752[_0x7366('0x20')]===_0x7366('0x21')&&typeof _0x308752[_0x7366('0x22')]===_0x7366('0x21');var _0x83e5d5=_0x338719[_0x7366('0x23')];var _0x1a71f5=_0x2c0422?0x0:_0x308752['offset'];var _0x208ac8=_0x2c0422?_0x338719['count']:_0x308752[_0x7366('0x20')]+_0x308752[_0x7366('0x22')];var _0x3f23cd;if(_0x208ac8>=_0x83e5d5){_0x208ac8=_0x83e5d5;_0x3f23cd=0xc8;}else{_0x3f23cd=0xce;}_0x23e763['status'](_0x3f23cd);return _0x23e763[_0x7366('0x24')](_0x7366('0x25'),_0x1a71f5+'-'+_0x208ac8+'/'+_0x83e5d5)[_0x7366('0x26')](_0x338719);}return null;};}function patchUpdates(_0x532ce2){return function(_0x16e038){try{jsonpatch[_0x7366('0x27')](_0x16e038,_0x532ce2,!![]);}catch(_0x482946){return BPromise[_0x7366('0x28')](_0x482946);}return _0x16e038[_0x7366('0x29')]();};}function saveUpdates(_0xaab659,_0x1a12d2){return function(_0x3c30a2){if(_0x3c30a2){return _0x3c30a2[_0x7366('0x2a')](_0xaab659)[_0x7366('0x2b')](function(_0x22ed7e){return _0x22ed7e;});}return null;};}function removeEntity(_0x2095a1,_0x301220){return function(_0x12aed6){if(_0x12aed6){return _0x12aed6[_0x7366('0x2c')]()[_0x7366('0x2b')](function(){_0x2095a1['status'](0xcc)[_0x7366('0x1f')]();});}};}function handleEntityNotFound(_0x4fe7cf,_0x379146){return function(_0x4ab987){if(!_0x4ab987){_0x4fe7cf['sendStatus'](0x194);}return _0x4ab987;};}function handleError(_0x383055,_0x4d4cb5){_0x4d4cb5=_0x4d4cb5||0x1f4;return function(_0x254374){logger['error'](_0x254374[_0x7366('0x2d')]);if(_0x254374[_0x7366('0x2e')]){delete _0x254374['name'];}_0x383055[_0x7366('0x1e')](_0x4d4cb5)['send'](_0x254374);};}exports[_0x7366('0x2f')]=function(_0x2b61af,_0x4a4e67){var _0x3cef4a={},_0x507baf={},_0xc58ac7={'count':0x0,'rows':[]};var _0x46f80f=_[_0x7366('0x30')](db[_0x7366('0x31')][_0x7366('0x32')],function(_0x5e075c){return{'name':_0x5e075c[_0x7366('0x33')],'type':_0x5e075c[_0x7366('0x34')]['key']};});_0x507baf['model']=_['map'](_0x46f80f,'name');_0x507baf[_0x7366('0x35')]=_[_0x7366('0x36')](_0x2b61af[_0x7366('0x35')]);_0x507baf[_0x7366('0x37')]=_['intersection'](_0x507baf[_0x7366('0x38')],_0x507baf[_0x7366('0x35')]);_0x3cef4a[_0x7366('0x39')]=_[_0x7366('0x3a')](_0x507baf['model'],qs[_0x7366('0x3b')](_0x2b61af[_0x7366('0x35')]['fields']));_0x3cef4a[_0x7366('0x39')]=_0x3cef4a[_0x7366('0x39')][_0x7366('0x3c')]?_0x3cef4a[_0x7366('0x39')]:_0x507baf[_0x7366('0x38')];if(!_0x2b61af[_0x7366('0x35')][_0x7366('0x3d')](_0x7366('0x3e'))){_0x3cef4a[_0x7366('0x22')]=qs['limit'](_0x2b61af[_0x7366('0x35')][_0x7366('0x22')]);_0x3cef4a['offset']=qs[_0x7366('0x20')](_0x2b61af[_0x7366('0x35')][_0x7366('0x20')]);}_0x3cef4a['order']=qs[_0x7366('0x3f')](_0x2b61af['query'][_0x7366('0x3f')]);_0x3cef4a['where']=qs['filters'](_[_0x7366('0x40')](_0x2b61af['query'],_0x507baf[_0x7366('0x37')]),_0x46f80f);if(_0x2b61af[_0x7366('0x35')]['filter']){_0x3cef4a[_0x7366('0x41')]=_['merge'](_0x3cef4a[_0x7366('0x41')],{'$or':_[_0x7366('0x30')](_0x46f80f,function(_0x5e58c5){if(_0x5e58c5[_0x7366('0x34')]!=='VIRTUAL'){var _0x8ed827={};_0x8ed827[_0x5e58c5[_0x7366('0x2e')]]={'$like':'%'+_0x2b61af[_0x7366('0x35')]['filter']+'%'};return _0x8ed827;}})});}_0x3cef4a=_[_0x7366('0x42')]({},_0x3cef4a,_0x2b61af[_0x7366('0x43')]);var _0x14ec01={'where':_0x3cef4a[_0x7366('0x41')]};return db[_0x7366('0x31')][_0x7366('0x23')](_0x14ec01)[_0x7366('0x2b')](function(_0x4d45dd){_0xc58ac7['count']=_0x4d45dd;if(_0x2b61af[_0x7366('0x35')][_0x7366('0x44')]){_0x3cef4a['include']=[{'all':!![]}];}return db[_0x7366('0x31')][_0x7366('0x45')](_0x3cef4a);})['then'](function(_0x432f79){_0xc58ac7['rows']=_0x432f79;return _0xc58ac7;})[_0x7366('0x2b')](respondWithFilteredResult(_0x4a4e67,_0x3cef4a))[_0x7366('0x46')](handleError(_0x4a4e67,null));};exports['show']=function(_0x5b5a95,_0x3bc879){var _0xedc3c7={'raw':!![],'where':{'id':_0x5b5a95[_0x7366('0x47')]['id']}},_0x2ac2e6={};_0x2ac2e6['model']=_[_0x7366('0x36')](db[_0x7366('0x31')][_0x7366('0x32')]);_0x2ac2e6[_0x7366('0x35')]=_[_0x7366('0x36')](_0x5b5a95[_0x7366('0x35')]);_0x2ac2e6[_0x7366('0x37')]=_['intersection'](_0x2ac2e6[_0x7366('0x38')],_0x2ac2e6[_0x7366('0x35')]);_0xedc3c7[_0x7366('0x39')]=_['intersection'](_0x2ac2e6[_0x7366('0x38')],qs[_0x7366('0x3b')](_0x5b5a95['query'][_0x7366('0x3b')]));_0xedc3c7[_0x7366('0x39')]=_0xedc3c7[_0x7366('0x39')]['length']?_0xedc3c7[_0x7366('0x39')]:_0x2ac2e6[_0x7366('0x38')];if(_0x5b5a95[_0x7366('0x35')]['includeAll']){_0xedc3c7[_0x7366('0x48')]=[{'all':!![]}];}_0xedc3c7=_[_0x7366('0x42')]({},_0xedc3c7,_0x5b5a95[_0x7366('0x43')]);return db['FreshdeskField'][_0x7366('0x49')](_0xedc3c7)[_0x7366('0x2b')](handleEntityNotFound(_0x3bc879,null))[_0x7366('0x2b')](respondWithResult(_0x3bc879,null))[_0x7366('0x46')](handleError(_0x3bc879,null));};exports['create']=function(_0x3725aa,_0x2d1c52){return db[_0x7366('0x31')][_0x7366('0x4a')](_0x3725aa[_0x7366('0x4b')],{})[_0x7366('0x2b')](respondWithResult(_0x2d1c52,0xc9))[_0x7366('0x46')](handleError(_0x2d1c52,null));};exports[_0x7366('0x2a')]=function(_0x2ad8bf,_0x59f078){if(_0x2ad8bf[_0x7366('0x4b')]['id']){delete _0x2ad8bf[_0x7366('0x4b')]['id'];}return db['FreshdeskField'][_0x7366('0x49')]({'where':{'id':_0x2ad8bf[_0x7366('0x47')]['id']}})['then'](handleEntityNotFound(_0x59f078,null))[_0x7366('0x2b')](saveUpdates(_0x2ad8bf['body'],null))[_0x7366('0x2b')](respondWithResult(_0x59f078,null))[_0x7366('0x46')](handleError(_0x59f078,null));};exports[_0x7366('0x2c')]=function(_0x22026a,_0x588b31){return db[_0x7366('0x31')][_0x7366('0x49')]({'where':{'id':_0x22026a[_0x7366('0x47')]['id']}})[_0x7366('0x2b')](handleEntityNotFound(_0x588b31,null))[_0x7366('0x2b')](removeEntity(_0x588b31,null))[_0x7366('0x46')](handleError(_0x588b31,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c72f29a..7f8b09f 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 _0x546b=['../../config/environment','exports','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b7b69,_0x75290){var _0x3d33e9=function(_0x173b5a){while(--_0x173b5a){_0x3b7b69['push'](_0x3b7b69['shift']());}};_0x3d33e9(++_0x75290);}(_0x546b,0x16e));var _0xb546=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x546b[_0x245afe];return _0x4eefde;};'use strict';var _=require(_0xb546('0x0'));var util=require(_0xb546('0x1'));var logger=require(_0xb546('0x2'))(_0xb546('0x3'));var moment=require(_0xb546('0x4'));var BPromise=require(_0xb546('0x5'));var rp=require(_0xb546('0x6'));var fs=require('fs');var path=require(_0xb546('0x7'));var rimraf=require(_0xb546('0x8'));var config=require(_0xb546('0x9'));var attributes=require('./intFreshdeskField.attributes');module[_0xb546('0xa')]=function(_0x44fe37,_0x22795b){return _0x44fe37['define'](_0xb546('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xb546('0xc'),'fields':[_0xb546('0xd'),_0xb546('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd24f=['int_freshdesk_fields','idField','FieldId','lodash','util','../../config/logger','path','./intFreshdeskField.attributes','exports','define','FreshdeskField'];(function(_0x58ec5e,_0x286e1d){var _0x4967c5=function(_0x160913){while(--_0x160913){_0x58ec5e['push'](_0x58ec5e['shift']());}};_0x4967c5(++_0x286e1d);}(_0xd24f,0x16e));var _0xfd24=function(_0x316af7,_0x72e80c){_0x316af7=_0x316af7-0x0;var _0x286d96=_0xd24f[_0x316af7];return _0x286d96;};'use strict';var _=require(_0xfd24('0x0'));var util=require(_0xfd24('0x1'));var logger=require(_0xfd24('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd24('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd24('0x4'));module[_0xfd24('0x5')]=function(_0x17d388,_0x1447d9){return _0x17d388[_0xfd24('0x6')](_0xfd24('0x7'),attributes,{'tableName':_0xfd24('0x8'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0xfd24('0x9'),_0xfd24('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index a5a95e4..a3aac8c 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 _0xc53f=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshdeskField,\x20%s,\x20%s','info','catch','lodash','util','moment','bluebird'];(function(_0x554548,_0x3d8cdc){var _0x440393=function(_0x4810eb){while(--_0x4810eb){_0x554548['push'](_0x554548['shift']());}};_0x440393(++_0x3d8cdc);}(_0xc53f,0xc2));var _0xfc53=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc53f[_0x1ddedd];return _0xa3e1ac;};'use strict';var _=require(_0xfc53('0x0'));var util=require(_0xfc53('0x1'));var moment=require(_0xfc53('0x2'));var BPromise=require(_0xfc53('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc53('0x4'));var db=require(_0xfc53('0x5'))['db'];var utils=require(_0xfc53('0x6'));var logger=require('../../config/logger')(_0xfc53('0x7'));var config=require(_0xfc53('0x8'));var jayson=require(_0xfc53('0x9'));var client=jayson[_0xfc53('0xa')][_0xfc53('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51bcd3,_0x289d1f,_0x5df1c3){return new BPromise(function(_0x2b13d4,_0x693981){return client[_0xfc53('0xc')](_0x51bcd3,_0x5df1c3)[_0xfc53('0xd')](function(_0x50d5d6){logger['info']('FreshdeskField,\x20%s,\x20%s',_0x289d1f,'request\x20sent');logger[_0xfc53('0xe')](_0xfc53('0xf'),_0x289d1f,'request\x20sent',JSON[_0xfc53('0x10')](_0x50d5d6));if(_0x50d5d6[_0xfc53('0x11')]){if(_0x50d5d6[_0xfc53('0x11')]['code']===0x1f4){logger[_0xfc53('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x289d1f,_0x50d5d6[_0xfc53('0x11')]['message']);return _0x693981(_0x50d5d6['error'][_0xfc53('0x12')]);}logger[_0xfc53('0x11')](_0xfc53('0x13'),_0x289d1f,_0x50d5d6[_0xfc53('0x11')][_0xfc53('0x12')]);return _0x2b13d4(_0x50d5d6[_0xfc53('0x11')][_0xfc53('0x12')]);}else{logger[_0xfc53('0x14')](_0xfc53('0x13'),_0x289d1f,'request\x20sent');_0x2b13d4(_0x50d5d6['result']['message']);}})[_0xfc53('0x15')](function(_0x360b9a){logger[_0xfc53('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x289d1f,_0x360b9a);_0x693981(_0x360b9a);});});} \ No newline at end of file +var _0x3ef6=['catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','request\x20sent','debug','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3ef6,0xc9));var _0x63ef=function(_0x13b228,_0x348b33){_0x13b228=_0x13b228-0x0;var _0xa6567d=_0x3ef6[_0x13b228];return _0xa6567d;};'use strict';var _=require(_0x63ef('0x0'));var util=require(_0x63ef('0x1'));var moment=require(_0x63ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x63ef('0x3'));var fs=require('fs');var Redis=require(_0x63ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x63ef('0x5'));var logger=require(_0x63ef('0x6'))(_0x63ef('0x7'));var config=require(_0x63ef('0x8'));var jayson=require(_0x63ef('0x9'));var client=jayson['client'][_0x63ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11d166,_0x1215f2,_0x3750ab){return new BPromise(function(_0x26167e,_0x3dce65){return client['request'](_0x11d166,_0x3750ab)['then'](function(_0xeee5c0){logger[_0x63ef('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x1215f2,_0x63ef('0xc'));logger[_0x63ef('0xd')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x1215f2,_0x63ef('0xc'),JSON[_0x63ef('0xe')](_0xeee5c0));if(_0xeee5c0['error']){if(_0xeee5c0[_0x63ef('0xf')][_0x63ef('0x10')]===0x1f4){logger['error'](_0x63ef('0x11'),_0x1215f2,_0xeee5c0[_0x63ef('0xf')][_0x63ef('0x12')]);return _0x3dce65(_0xeee5c0[_0x63ef('0xf')][_0x63ef('0x12')]);}logger[_0x63ef('0xf')](_0x63ef('0x11'),_0x1215f2,_0xeee5c0[_0x63ef('0xf')][_0x63ef('0x12')]);return _0x26167e(_0xeee5c0[_0x63ef('0xf')][_0x63ef('0x12')]);}else{logger[_0x63ef('0xb')](_0x63ef('0x11'),_0x1215f2,_0x63ef('0xc'));_0x26167e(_0xeee5c0['result'][_0x63ef('0x12')]);}})[_0x63ef('0x13')](function(_0x12a014){logger[_0x63ef('0xf')](_0x63ef('0x11'),_0x1215f2,_0x12a014);_0x3dce65(_0x12a014);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 528e12b..23e7e45 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 _0x2f68=['create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/configurations','/:id/fields','getFields','post'];(function(_0x4d4763,_0xb8a269){var _0x440409=function(_0x193f1d){while(--_0x193f1d){_0x4d4763['push'](_0x4d4763['shift']());}};_0x440409(++_0xb8a269);}(_0x2f68,0x9a));var _0x82f6=function(_0x190260,_0x470d4f){_0x190260=_0x190260-0x0;var _0x4b15a8=_0x2f68[_0x190260];return _0x4b15a8;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var fs_extra=require(_0x82f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x82f6('0x7')]('/',auth[_0x82f6('0x8')](),controller['index']);router['get'](_0x82f6('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x82f6('0x7')](_0x82f6('0xa'),auth[_0x82f6('0x8')](),controller['getConfigurations']);router[_0x82f6('0x7')](_0x82f6('0xb'),auth['isAuthenticated'](),controller[_0x82f6('0xc')]);router[_0x82f6('0xd')]('/',auth[_0x82f6('0x8')](),controller[_0x82f6('0xe')]);router[_0x82f6('0xd')](_0x82f6('0xa'),auth['isAuthenticated'](),controller[_0x82f6('0xf')]);router[_0x82f6('0x10')]('/:id',auth[_0x82f6('0x8')](),controller[_0x82f6('0x11')]);router[_0x82f6('0x12')](_0x82f6('0x9'),auth[_0x82f6('0x8')](),controller[_0x82f6('0x13')]);module[_0x82f6('0x14')]=router; \ No newline at end of file +var _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x4e693c,_0x1814ca){var _0x385853=function(_0x2d0b5d){while(--_0x2d0b5d){_0x4e693c['push'](_0x4e693c['shift']());}};_0x385853(++_0x1814ca);}(_0x2e54,0x1dd));var _0x42e5=function(_0x2962dc,_0x2c5710){_0x2962dc=_0x2962dc-0x0;var _0x345f68=_0x2e54[_0x2962dc];return _0x345f68;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1fcb08f..09efa17 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 _0x1967=['STRING','username','remoteUri','exports'];(function(_0x37153e,_0x15c383){var _0x3d2981=function(_0x2226fe){while(--_0x2226fe){_0x37153e['push'](_0x37153e['shift']());}};_0x3d2981(++_0x15c383);}(_0x1967,0x173));var _0x7196=function(_0x3e313f,_0x402be2){_0x3e313f=_0x3e313f-0x0;var _0x52a50f=_0x1967[_0x3e313f];return _0x52a50f;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'name':{'type':Sequelize[_0x7196('0x1')]},'description':{'type':Sequelize[_0x7196('0x1')]},'username':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x2')},'apiKey':{'type':Sequelize[_0x7196('0x1')]},'remoteUri':{'type':Sequelize[_0x7196('0x1')],'unique':_0x7196('0x3')},'serverUrl':{'type':Sequelize[_0x7196('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xe820=['sequelize','STRING','username'];(function(_0x2e8a55,_0x588d95){var _0x3cf4cf=function(_0x4226e4){while(--_0x4226e4){_0x2e8a55['push'](_0x2e8a55['shift']());}};_0x3cf4cf(++_0x588d95);}(_0xe820,0xd2));var _0x0e82=function(_0x5a15e7,_0x381bdc){_0x5a15e7=_0x5a15e7-0x0;var _0x841f44=_0xe820[_0x5a15e7];return _0x841f44;};'use strict';var Sequelize=require(_0x0e82('0x0'));module['exports']={'name':{'type':Sequelize[_0x0e82('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0e82('0x2')},'apiKey':{'type':Sequelize[_0x0e82('0x1')]},'remoteUri':{'type':Sequelize[_0x0e82('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0e82('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b2d381c..8a805bf 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 _0xed70=['statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','FreshsalesAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','create','body','find','params','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','test'];(function(_0x4adf44,_0x188e88){var _0x3bcb5d=function(_0xc6aaee){while(--_0xc6aaee){_0x4adf44['push'](_0x4adf44['shift']());}};_0x3bcb5d(++_0x188e88);}(_0xed70,0x13d));var _0x0ed7=function(_0x5b17ba,_0x41da67){_0x5b17ba=_0x5b17ba-0x0;var _0x3ece49=_0xed70[_0x5b17ba];return _0x3ece49;};'use strict';var emlformat=require(_0x0ed7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ed7('0x1'));var jsonpatch=require(_0x0ed7('0x2'));var rp=require(_0x0ed7('0x3'));var moment=require(_0x0ed7('0x4'));var BPromise=require(_0x0ed7('0x5'));var Mustache=require(_0x0ed7('0x6'));var util=require(_0x0ed7('0x7'));var path=require(_0x0ed7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ed7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ed7('0xa'));var squel=require(_0x0ed7('0xb'));var crypto=require(_0x0ed7('0xc'));var jsforce=require(_0x0ed7('0xd'));var deskjs=require(_0x0ed7('0xe'));var toCsv=require(_0x0ed7('0xf'));var querystring=require(_0x0ed7('0x10'));var Papa=require(_0x0ed7('0x11'));var Redis=require(_0x0ed7('0x12'));var authService=require(_0x0ed7('0x13'));var qs=require(_0x0ed7('0x14'));var as=require(_0x0ed7('0x15'));var hardwareService=require(_0x0ed7('0x16'));var logger=require(_0x0ed7('0x17'))(_0x0ed7('0x18'));var utils=require('../../config/utils');var config=require(_0x0ed7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ed7('0x1a'))['db'];var integrations=require(_0x0ed7('0x1b'));function respondWithStatusCode(_0x23bb9b,_0x26288b){_0x26288b=_0x26288b||0xcc;return function(_0x51e330){if(_0x51e330){return _0x23bb9b['sendStatus'](_0x26288b);}return _0x23bb9b[_0x0ed7('0x1c')](_0x26288b)[_0x0ed7('0x1d')]();};}function respondWithResult(_0xe431,_0x5e83b2){_0x5e83b2=_0x5e83b2||0xc8;return function(_0x6bd246){if(_0x6bd246){return _0xe431[_0x0ed7('0x1c')](_0x5e83b2)['json'](_0x6bd246);}};}function respondWithFilteredResult(_0x34e602,_0x228b7e){return function(_0x57abb7){if(_0x57abb7){var _0x2e4484=typeof _0x228b7e[_0x0ed7('0x1e')]===_0x0ed7('0x1f')&&typeof _0x228b7e['limit']===_0x0ed7('0x1f');var _0x37dcb1=_0x57abb7[_0x0ed7('0x20')];var _0x46fc39=_0x2e4484?0x0:_0x228b7e['offset'];var _0x2915aa=_0x2e4484?_0x57abb7['count']:_0x228b7e[_0x0ed7('0x1e')]+_0x228b7e[_0x0ed7('0x21')];var _0x1e5451;if(_0x2915aa>=_0x37dcb1){_0x2915aa=_0x37dcb1;_0x1e5451=0xc8;}else{_0x1e5451=0xce;}_0x34e602[_0x0ed7('0x1c')](_0x1e5451);return _0x34e602['set'](_0x0ed7('0x22'),_0x46fc39+'-'+_0x2915aa+'/'+_0x37dcb1)['json'](_0x57abb7);}return null;};}function patchUpdates(_0xddf7ff){return function(_0x1f2dfe){try{jsonpatch[_0x0ed7('0x23')](_0x1f2dfe,_0xddf7ff,!![]);}catch(_0x50ea36){return BPromise[_0x0ed7('0x24')](_0x50ea36);}return _0x1f2dfe[_0x0ed7('0x25')]();};}function saveUpdates(_0x4c4e92,_0x4942a7){return function(_0x33bb1d){if(_0x33bb1d){return _0x33bb1d[_0x0ed7('0x26')](_0x4c4e92)[_0x0ed7('0x27')](function(_0x2682b7){return _0x2682b7;});}return null;};}function removeEntity(_0x168f5e,_0x56e0b3){return function(_0x5c4fde){if(_0x5c4fde){return _0x5c4fde[_0x0ed7('0x28')]()['then'](function(){_0x168f5e[_0x0ed7('0x1c')](0xcc)[_0x0ed7('0x1d')]();});}};}function handleEntityNotFound(_0x454568,_0x2f21ce){return function(_0x201861){if(!_0x201861){_0x454568['sendStatus'](0x194);}return _0x201861;};}function handleError(_0x1ee648,_0x1f18ed){_0x1f18ed=_0x1f18ed||0x1f4;return function(_0x885751){logger[_0x0ed7('0x29')](_0x885751['stack']);if(_0x885751[_0x0ed7('0x2a')]){delete _0x885751[_0x0ed7('0x2a')];}_0x1ee648[_0x0ed7('0x1c')](_0x1f18ed)['send'](_0x885751);};}exports[_0x0ed7('0x2b')]=function(_0x440e0e,_0x318574){var _0x130bab={},_0x16c82b={},_0x14b952={'count':0x0,'rows':[]};var _0x52983d=_[_0x0ed7('0x2c')](db[_0x0ed7('0x2d')]['rawAttributes'],function(_0x1d729a){return{'name':_0x1d729a[_0x0ed7('0x2e')],'type':_0x1d729a[_0x0ed7('0x2f')][_0x0ed7('0x30')]};});_0x16c82b[_0x0ed7('0x31')]=_[_0x0ed7('0x2c')](_0x52983d,'name');_0x16c82b[_0x0ed7('0x32')]=_[_0x0ed7('0x33')](_0x440e0e[_0x0ed7('0x32')]);_0x16c82b[_0x0ed7('0x34')]=_[_0x0ed7('0x35')](_0x16c82b['model'],_0x16c82b[_0x0ed7('0x32')]);_0x130bab[_0x0ed7('0x36')]=_[_0x0ed7('0x35')](_0x16c82b['model'],qs[_0x0ed7('0x37')](_0x440e0e[_0x0ed7('0x32')][_0x0ed7('0x37')]));_0x130bab['attributes']=_0x130bab[_0x0ed7('0x36')][_0x0ed7('0x38')]?_0x130bab[_0x0ed7('0x36')]:_0x16c82b[_0x0ed7('0x31')];if(!_0x440e0e[_0x0ed7('0x32')][_0x0ed7('0x39')](_0x0ed7('0x3a'))){_0x130bab[_0x0ed7('0x21')]=qs[_0x0ed7('0x21')](_0x440e0e[_0x0ed7('0x32')][_0x0ed7('0x21')]);_0x130bab['offset']=qs[_0x0ed7('0x1e')](_0x440e0e['query'][_0x0ed7('0x1e')]);}_0x130bab[_0x0ed7('0x3b')]=qs[_0x0ed7('0x3c')](_0x440e0e['query'][_0x0ed7('0x3c')]);_0x130bab['where']=qs[_0x0ed7('0x34')](_['pick'](_0x440e0e[_0x0ed7('0x32')],_0x16c82b[_0x0ed7('0x34')]),_0x52983d);if(_0x440e0e[_0x0ed7('0x32')][_0x0ed7('0x3d')]){_0x130bab[_0x0ed7('0x3e')]=_[_0x0ed7('0x3f')](_0x130bab['where'],{'$or':_[_0x0ed7('0x2c')](_0x52983d,function(_0x1c5fcb){if(_0x1c5fcb[_0x0ed7('0x2f')]!==_0x0ed7('0x40')){var _0x225b8a={};_0x225b8a[_0x1c5fcb[_0x0ed7('0x2a')]]={'$like':'%'+_0x440e0e['query'][_0x0ed7('0x3d')]+'%'};return _0x225b8a;}})});}_0x130bab=_['merge']({},_0x130bab,_0x440e0e[_0x0ed7('0x41')]);var _0x258430={'where':_0x130bab['where']};return db['FreshsalesAccount'][_0x0ed7('0x20')](_0x258430)[_0x0ed7('0x27')](function(_0x1c9d52){_0x14b952[_0x0ed7('0x20')]=_0x1c9d52;if(_0x440e0e[_0x0ed7('0x32')][_0x0ed7('0x42')]){_0x130bab[_0x0ed7('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x0ed7('0x44')](_0x130bab);})[_0x0ed7('0x27')](function(_0x45a3ff){_0x14b952['rows']=_0x45a3ff;return _0x14b952;})[_0x0ed7('0x27')](respondWithFilteredResult(_0x318574,_0x130bab))[_0x0ed7('0x45')](handleError(_0x318574,null));};exports[_0x0ed7('0x46')]=function(_0x365de1,_0x1e9fe3){var _0x2e591e={'raw':![],'where':{'id':_0x365de1['params']['id']}},_0x464cde={};_0x464cde['model']=_[_0x0ed7('0x33')](db['FreshsalesAccount'][_0x0ed7('0x47')]);_0x464cde[_0x0ed7('0x32')]=_['keys'](_0x365de1[_0x0ed7('0x32')]);_0x464cde[_0x0ed7('0x34')]=_[_0x0ed7('0x35')](_0x464cde['model'],_0x464cde[_0x0ed7('0x32')]);_0x2e591e[_0x0ed7('0x36')]=_[_0x0ed7('0x35')](_0x464cde[_0x0ed7('0x31')],qs[_0x0ed7('0x37')](_0x365de1[_0x0ed7('0x32')]['fields']));_0x2e591e[_0x0ed7('0x36')]=_0x2e591e[_0x0ed7('0x36')]['length']?_0x2e591e['attributes']:_0x464cde[_0x0ed7('0x31')];if(_0x365de1['query']['includeAll']){_0x2e591e[_0x0ed7('0x43')]=[{'all':!![]}];}_0x2e591e=_[_0x0ed7('0x3f')]({},_0x2e591e,_0x365de1[_0x0ed7('0x41')]);return db[_0x0ed7('0x2d')]['find'](_0x2e591e)['then'](handleEntityNotFound(_0x1e9fe3,null))['then'](respondWithResult(_0x1e9fe3,null))[_0x0ed7('0x45')](handleError(_0x1e9fe3,null));};exports[_0x0ed7('0x48')]=function(_0x4e7f8d,_0x41c61d){return db['FreshsalesAccount'][_0x0ed7('0x48')](_0x4e7f8d[_0x0ed7('0x49')],{})['then'](respondWithResult(_0x41c61d,0xc9))[_0x0ed7('0x45')](handleError(_0x41c61d,null));};exports[_0x0ed7('0x26')]=function(_0x274001,_0x47deb7){if(_0x274001[_0x0ed7('0x49')]['id']){delete _0x274001['body']['id'];}return db[_0x0ed7('0x2d')][_0x0ed7('0x4a')]({'where':{'id':_0x274001[_0x0ed7('0x4b')]['id']}})[_0x0ed7('0x27')](handleEntityNotFound(_0x47deb7,null))[_0x0ed7('0x27')](saveUpdates(_0x274001[_0x0ed7('0x49')],null))[_0x0ed7('0x27')](respondWithResult(_0x47deb7,null))[_0x0ed7('0x45')](handleError(_0x47deb7,null));};exports[_0x0ed7('0x28')]=function(_0xcf984f,_0xf28a6a){return db[_0x0ed7('0x2d')][_0x0ed7('0x4a')]({'where':{'id':_0xcf984f[_0x0ed7('0x4b')]['id']}})[_0x0ed7('0x27')](handleEntityNotFound(_0xf28a6a,null))[_0x0ed7('0x27')](removeEntity(_0xf28a6a,null))[_0x0ed7('0x45')](handleError(_0xf28a6a,null));};exports[_0x0ed7('0x4c')]=function(_0x248789,_0x46fa65,_0x418e50){var _0xca3ef8={};var _0x27a37b={};var _0x307bd5;var _0xc03082;return db[_0x0ed7('0x2d')][_0x0ed7('0x4d')]({'where':{'id':_0x248789['params']['id']}})[_0x0ed7('0x27')](handleEntityNotFound(_0x46fa65,null))[_0x0ed7('0x27')](function(_0x2557ba){if(_0x2557ba){_0x307bd5=_0x2557ba;_0x27a37b[_0x0ed7('0x31')]=_[_0x0ed7('0x33')](db['FreshsalesConfiguration'][_0x0ed7('0x47')]);_0x27a37b[_0x0ed7('0x32')]=_[_0x0ed7('0x33')](_0x248789[_0x0ed7('0x32')]);_0x27a37b[_0x0ed7('0x34')]=_['intersection'](_0x27a37b[_0x0ed7('0x31')],_0x27a37b[_0x0ed7('0x32')]);_0xca3ef8['attributes']=_[_0x0ed7('0x35')](_0x27a37b[_0x0ed7('0x31')],qs[_0x0ed7('0x37')](_0x248789[_0x0ed7('0x32')][_0x0ed7('0x37')]));_0xca3ef8[_0x0ed7('0x36')]=_0xca3ef8[_0x0ed7('0x36')][_0x0ed7('0x38')]?_0xca3ef8[_0x0ed7('0x36')]:_0x27a37b[_0x0ed7('0x31')];_0xca3ef8['order']=qs['sort'](_0x248789[_0x0ed7('0x32')][_0x0ed7('0x3c')]);_0xca3ef8['where']=qs[_0x0ed7('0x34')](_[_0x0ed7('0x4e')](_0x248789[_0x0ed7('0x32')],_0x27a37b['filters']));if(_0x248789[_0x0ed7('0x32')][_0x0ed7('0x3d')]){_0xca3ef8[_0x0ed7('0x3e')]=_[_0x0ed7('0x3f')](_0xca3ef8['where'],{'$or':_[_0x0ed7('0x2c')](_0xca3ef8['attributes'],function(_0x3743d7){var _0x39d1ee={};_0x39d1ee[_0x3743d7]={'$like':'%'+_0x248789[_0x0ed7('0x32')][_0x0ed7('0x3d')]+'%'};return _0x39d1ee;})});}_0xca3ef8=_[_0x0ed7('0x3f')]({},_0xca3ef8,_0x248789['options']);return _0x307bd5['getConfigurations'](_0xca3ef8);}})[_0x0ed7('0x27')](function(_0x1f91c7){if(_0x1f91c7){_0xc03082=_0x1f91c7['length'];if(!_0x248789[_0x0ed7('0x32')][_0x0ed7('0x39')]('nolimit')){_0xca3ef8['limit']=qs[_0x0ed7('0x21')](_0x248789['query'][_0x0ed7('0x21')]);_0xca3ef8[_0x0ed7('0x1e')]=qs[_0x0ed7('0x1e')](_0x248789[_0x0ed7('0x32')][_0x0ed7('0x1e')]);}return _0x307bd5[_0x0ed7('0x4c')](_0xca3ef8);}})[_0x0ed7('0x27')](function(_0x575271){if(_0x575271){return _0x575271?{'count':_0xc03082,'rows':_0x575271}:null;}})['then'](respondWithResult(_0x46fa65,null))[_0x0ed7('0x45')](handleError(_0x46fa65,null));};exports[_0x0ed7('0x4f')]=function(_0x3f63f4,_0x2a86d2,_0xe791d3){if(_0x3f63f4[_0x0ed7('0x49')]['id']){delete _0x3f63f4['body']['id'];}return db[_0x0ed7('0x2d')]['findOne']({'where':{'id':_0x3f63f4['params']['id']}})[_0x0ed7('0x27')](handleEntityNotFound(_0x2a86d2,null))[_0x0ed7('0x27')](function(_0x3e5af8){if(_0x3e5af8){_0x3f63f4['body'][_0x0ed7('0x50')]=_0x3e5af8['id'];_0x3f63f4[_0x0ed7('0x49')][_0x0ed7('0x51')]=integrations[_0x0ed7('0x52')](_0x3f63f4['body']['channel'],_0x3f63f4['body'][_0x0ed7('0x2f')]);_0x3f63f4[_0x0ed7('0x49')][_0x0ed7('0x53')]=integrations['getDescriptions'](_0x3f63f4[_0x0ed7('0x49')][_0x0ed7('0x54')],_0x3f63f4[_0x0ed7('0x49')][_0x0ed7('0x2f')]);return db[_0x0ed7('0x55')][_0x0ed7('0x48')](_0x3f63f4[_0x0ed7('0x49')],{'include':[{'model':db[_0x0ed7('0x56')],'as':_0x0ed7('0x51')},{'model':db[_0x0ed7('0x56')],'as':_0x0ed7('0x53')}]});}return null;})[_0x0ed7('0x27')](respondWithResult(_0x2a86d2,null))['catch'](handleError(_0x2a86d2,null));};exports['getFields']=function(_0x436415,_0x5d169e,_0x3850cf){var _0x502d8d='';var _0x595863='';return db[_0x0ed7('0x2d')][_0x0ed7('0x4d')]({'where':{'id':_0x436415[_0x0ed7('0x4b')]['id']},'attributes':['id',_0x0ed7('0x57'),_0x0ed7('0x58'),_0x0ed7('0x59')]})['then'](handleEntityNotFound(_0x5d169e,null))['then'](function(_0x3bad41){if(_0x3bad41){_0x595863=_0x3bad41['username'];_0x502d8d=_0x3bad41['remoteUri'];var _0x3226d4=_0x3bad41['remoteUri']['slice'](-0x1);if(_0x3226d4==='/'){_0x502d8d=_0x502d8d[_0x0ed7('0x5a')](0x0,_0x502d8d[_0x0ed7('0x5b')](_0x3226d4));}return rp({'method':_0x0ed7('0x5c'),'uri':util[_0x0ed7('0x5d')](_0x0ed7('0x5e'),_0x502d8d,_0x0ed7('0x5f')),'headers':{'Authorization':_0x0ed7('0x60')+_0x3bad41['apiKey']},'json':!![]});}})[_0x0ed7('0x27')](function(_0x23de9e){if(_0x23de9e){var _0xae9ca7=_0x23de9e[_0x0ed7('0x61')];var _0x419762=![];var _0x501635=null;for(_0x501635=0x0;_0x501635<_0xae9ca7[_0x0ed7('0x38')];_0x501635++){if(_0xae9ca7[_0x501635]['email']===_0x595863){_0x419762=!![];}}if(_0x419762){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x0ed7('0x27')](respondWithResult(_0x5d169e,null))[_0x0ed7('0x45')](function(_0x203126){var _0x2df7f2=_0x436415[_0x0ed7('0x32')][_0x0ed7('0x62')]?0x1f4:_0x203126[_0x0ed7('0x63')]||0x1f4;logger[_0x0ed7('0x29')](_0x0ed7('0x64'),'getFields',_0x2df7f2,JSON[_0x0ed7('0x65')](_0x203126));delete _0x203126[_0x0ed7('0x2a')];if(_0x2df7f2===0x191){_0x2df7f2=0x190;}_0x5d169e[_0x0ed7('0x1c')](_0x2df7f2)[_0x0ed7('0x66')](_0x436415['query'][_0x0ed7('0x62')]?{'message':_0x0ed7('0x67'),'statusCode':_0x203126['statusCode']}:_0x203126);});}; \ No newline at end of file +var _0x5822=['jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','length','find','catch','create','body','getConfigurations','findOne','FreshsalesConfiguration','sort','hasOwnProperty','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','remoteUri','apiKey','slice','substring','GET','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel'];(function(_0x5e1787,_0x5e1ea6){var _0x48a9e4=function(_0x296bbb){while(--_0x296bbb){_0x5e1787['push'](_0x5e1787['shift']());}};_0x48a9e4(++_0x5e1ea6);}(_0x5822,0xc8));var _0x2582=function(_0x5e709a,_0x1d7975){_0x5e709a=_0x5e709a-0x0;var _0x57401a=_0x5822[_0x5e709a];return _0x57401a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2582('0x0'));var zipdir=require(_0x2582('0x1'));var jsonpatch=require(_0x2582('0x2'));var rp=require('request-promise');var moment=require(_0x2582('0x3'));var BPromise=require(_0x2582('0x4'));var Mustache=require(_0x2582('0x5'));var util=require(_0x2582('0x6'));var path=require('path');var sox=require(_0x2582('0x7'));var csv=require('to-csv');var ejs=require(_0x2582('0x8'));var fs=require('fs');var fs_extra=require(_0x2582('0x9'));var _=require(_0x2582('0xa'));var squel=require(_0x2582('0xb'));var crypto=require('crypto');var jsforce=require(_0x2582('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2582('0xd'));var querystring=require(_0x2582('0xe'));var Papa=require(_0x2582('0xf'));var Redis=require(_0x2582('0x10'));var authService=require(_0x2582('0x11'));var qs=require(_0x2582('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2582('0x13'));var logger=require(_0x2582('0x14'))(_0x2582('0x15'));var utils=require('../../config/utils');var config=require(_0x2582('0x16'));var licenseUtil=require(_0x2582('0x17'));var db=require(_0x2582('0x18'))['db'];var integrations=require(_0x2582('0x19'));function respondWithStatusCode(_0x32022,_0xfc854b){_0xfc854b=_0xfc854b||0xcc;return function(_0x1ed4d4){if(_0x1ed4d4){return _0x32022[_0x2582('0x1a')](_0xfc854b);}return _0x32022['status'](_0xfc854b)[_0x2582('0x1b')]();};}function respondWithResult(_0x168d36,_0x44e5c5){_0x44e5c5=_0x44e5c5||0xc8;return function(_0x1b7be9){if(_0x1b7be9){return _0x168d36[_0x2582('0x1c')](_0x44e5c5)[_0x2582('0x1d')](_0x1b7be9);}};}function respondWithFilteredResult(_0x24054d,_0x10c033){return function(_0x5890ef){if(_0x5890ef){var _0x125f50=typeof _0x10c033[_0x2582('0x1e')]===_0x2582('0x1f')&&typeof _0x10c033[_0x2582('0x20')]===_0x2582('0x1f');var _0x4fe80c=_0x5890ef[_0x2582('0x21')];var _0x39f38b=_0x125f50?0x0:_0x10c033[_0x2582('0x1e')];var _0x196e12=_0x125f50?_0x5890ef[_0x2582('0x21')]:_0x10c033[_0x2582('0x1e')]+_0x10c033[_0x2582('0x20')];var _0x560d49;if(_0x196e12>=_0x4fe80c){_0x196e12=_0x4fe80c;_0x560d49=0xc8;}else{_0x560d49=0xce;}_0x24054d[_0x2582('0x1c')](_0x560d49);return _0x24054d[_0x2582('0x22')](_0x2582('0x23'),_0x39f38b+'-'+_0x196e12+'/'+_0x4fe80c)['json'](_0x5890ef);}return null;};}function patchUpdates(_0x39d1f9){return function(_0x5cfc44){try{jsonpatch[_0x2582('0x24')](_0x5cfc44,_0x39d1f9,!![]);}catch(_0x17f3a3){return BPromise['reject'](_0x17f3a3);}return _0x5cfc44[_0x2582('0x25')]();};}function saveUpdates(_0x14f729,_0x10f29b){return function(_0x75cbb3){if(_0x75cbb3){return _0x75cbb3[_0x2582('0x26')](_0x14f729)[_0x2582('0x27')](function(_0x42c2d6){return _0x42c2d6;});}return null;};}function removeEntity(_0x2993f1,_0x169989){return function(_0x2504b9){if(_0x2504b9){return _0x2504b9[_0x2582('0x28')]()[_0x2582('0x27')](function(){_0x2993f1[_0x2582('0x1c')](0xcc)[_0x2582('0x1b')]();});}};}function handleEntityNotFound(_0x4916b4,_0x2896d4){return function(_0x2cef50){if(!_0x2cef50){_0x4916b4[_0x2582('0x1a')](0x194);}return _0x2cef50;};}function handleError(_0xd8d64c,_0x4be81a){_0x4be81a=_0x4be81a||0x1f4;return function(_0x14e336){logger[_0x2582('0x29')](_0x14e336[_0x2582('0x2a')]);if(_0x14e336[_0x2582('0x2b')]){delete _0x14e336[_0x2582('0x2b')];}_0xd8d64c['status'](_0x4be81a)[_0x2582('0x2c')](_0x14e336);};}exports[_0x2582('0x2d')]=function(_0x4d5d49,_0x3ea3dc){var _0x181b52={},_0x35df9d={},_0x527031={'count':0x0,'rows':[]};var _0x4a1661=_[_0x2582('0x2e')](db[_0x2582('0x2f')]['rawAttributes'],function(_0x19c442){return{'name':_0x19c442[_0x2582('0x30')],'type':_0x19c442[_0x2582('0x31')][_0x2582('0x32')]};});_0x35df9d[_0x2582('0x33')]=_[_0x2582('0x2e')](_0x4a1661,_0x2582('0x2b'));_0x35df9d['query']=_[_0x2582('0x34')](_0x4d5d49[_0x2582('0x35')]);_0x35df9d[_0x2582('0x36')]=_[_0x2582('0x37')](_0x35df9d[_0x2582('0x33')],_0x35df9d['query']);_0x181b52[_0x2582('0x38')]=_[_0x2582('0x37')](_0x35df9d[_0x2582('0x33')],qs['fields'](_0x4d5d49[_0x2582('0x35')][_0x2582('0x39')]));_0x181b52[_0x2582('0x38')]=_0x181b52[_0x2582('0x38')]['length']?_0x181b52[_0x2582('0x38')]:_0x35df9d[_0x2582('0x33')];if(!_0x4d5d49[_0x2582('0x35')]['hasOwnProperty'](_0x2582('0x3a'))){_0x181b52[_0x2582('0x20')]=qs[_0x2582('0x20')](_0x4d5d49[_0x2582('0x35')]['limit']);_0x181b52[_0x2582('0x1e')]=qs['offset'](_0x4d5d49[_0x2582('0x35')][_0x2582('0x1e')]);}_0x181b52[_0x2582('0x3b')]=qs['sort'](_0x4d5d49['query']['sort']);_0x181b52['where']=qs[_0x2582('0x36')](_[_0x2582('0x3c')](_0x4d5d49[_0x2582('0x35')],_0x35df9d[_0x2582('0x36')]),_0x4a1661);if(_0x4d5d49['query'][_0x2582('0x3d')]){_0x181b52[_0x2582('0x3e')]=_[_0x2582('0x3f')](_0x181b52[_0x2582('0x3e')],{'$or':_['map'](_0x4a1661,function(_0x349611){if(_0x349611[_0x2582('0x31')]!==_0x2582('0x40')){var _0x300f18={};_0x300f18[_0x349611[_0x2582('0x2b')]]={'$like':'%'+_0x4d5d49['query'][_0x2582('0x3d')]+'%'};return _0x300f18;}})});}_0x181b52=_['merge']({},_0x181b52,_0x4d5d49[_0x2582('0x41')]);var _0x5596fb={'where':_0x181b52[_0x2582('0x3e')]};return db[_0x2582('0x2f')]['count'](_0x5596fb)[_0x2582('0x27')](function(_0x2a620c){_0x527031[_0x2582('0x21')]=_0x2a620c;if(_0x4d5d49[_0x2582('0x35')][_0x2582('0x42')]){_0x181b52[_0x2582('0x43')]=[{'all':!![]}];}return db[_0x2582('0x2f')][_0x2582('0x44')](_0x181b52);})[_0x2582('0x27')](function(_0x3ac2f9){_0x527031[_0x2582('0x45')]=_0x3ac2f9;return _0x527031;})['then'](respondWithFilteredResult(_0x3ea3dc,_0x181b52))['catch'](handleError(_0x3ea3dc,null));};exports['show']=function(_0x538df4,_0x4d1605){var _0x129d4a={'raw':![],'where':{'id':_0x538df4[_0x2582('0x46')]['id']}},_0x5c6ed7={};_0x5c6ed7[_0x2582('0x33')]=_[_0x2582('0x34')](db[_0x2582('0x2f')][_0x2582('0x47')]);_0x5c6ed7[_0x2582('0x35')]=_[_0x2582('0x34')](_0x538df4[_0x2582('0x35')]);_0x5c6ed7[_0x2582('0x36')]=_['intersection'](_0x5c6ed7['model'],_0x5c6ed7[_0x2582('0x35')]);_0x129d4a[_0x2582('0x38')]=_[_0x2582('0x37')](_0x5c6ed7[_0x2582('0x33')],qs[_0x2582('0x39')](_0x538df4[_0x2582('0x35')][_0x2582('0x39')]));_0x129d4a['attributes']=_0x129d4a[_0x2582('0x38')][_0x2582('0x48')]?_0x129d4a[_0x2582('0x38')]:_0x5c6ed7[_0x2582('0x33')];if(_0x538df4[_0x2582('0x35')][_0x2582('0x42')]){_0x129d4a[_0x2582('0x43')]=[{'all':!![]}];}_0x129d4a=_[_0x2582('0x3f')]({},_0x129d4a,_0x538df4[_0x2582('0x41')]);return db[_0x2582('0x2f')][_0x2582('0x49')](_0x129d4a)['then'](handleEntityNotFound(_0x4d1605,null))[_0x2582('0x27')](respondWithResult(_0x4d1605,null))[_0x2582('0x4a')](handleError(_0x4d1605,null));};exports[_0x2582('0x4b')]=function(_0x8a52c,_0x3c5182){return db['FreshsalesAccount'][_0x2582('0x4b')](_0x8a52c[_0x2582('0x4c')],{})['then'](respondWithResult(_0x3c5182,0xc9))[_0x2582('0x4a')](handleError(_0x3c5182,null));};exports[_0x2582('0x26')]=function(_0x5d6bf1,_0x10d408){if(_0x5d6bf1[_0x2582('0x4c')]['id']){delete _0x5d6bf1[_0x2582('0x4c')]['id'];}return db[_0x2582('0x2f')][_0x2582('0x49')]({'where':{'id':_0x5d6bf1[_0x2582('0x46')]['id']}})[_0x2582('0x27')](handleEntityNotFound(_0x10d408,null))[_0x2582('0x27')](saveUpdates(_0x5d6bf1['body'],null))[_0x2582('0x27')](respondWithResult(_0x10d408,null))[_0x2582('0x4a')](handleError(_0x10d408,null));};exports[_0x2582('0x28')]=function(_0x1829a0,_0x3b4a76){return db[_0x2582('0x2f')][_0x2582('0x49')]({'where':{'id':_0x1829a0[_0x2582('0x46')]['id']}})[_0x2582('0x27')](handleEntityNotFound(_0x3b4a76,null))[_0x2582('0x27')](removeEntity(_0x3b4a76,null))[_0x2582('0x4a')](handleError(_0x3b4a76,null));};exports[_0x2582('0x4d')]=function(_0x304d4a,_0x38dd59,_0x5d19a1){var _0x3cf5d2={};var _0x599f94={};var _0x3692a2;var _0x59d72e;return db[_0x2582('0x2f')][_0x2582('0x4e')]({'where':{'id':_0x304d4a['params']['id']}})[_0x2582('0x27')](handleEntityNotFound(_0x38dd59,null))[_0x2582('0x27')](function(_0x4bc0e1){if(_0x4bc0e1){_0x3692a2=_0x4bc0e1;_0x599f94[_0x2582('0x33')]=_[_0x2582('0x34')](db[_0x2582('0x4f')][_0x2582('0x47')]);_0x599f94['query']=_['keys'](_0x304d4a[_0x2582('0x35')]);_0x599f94[_0x2582('0x36')]=_[_0x2582('0x37')](_0x599f94[_0x2582('0x33')],_0x599f94[_0x2582('0x35')]);_0x3cf5d2['attributes']=_[_0x2582('0x37')](_0x599f94['model'],qs[_0x2582('0x39')](_0x304d4a[_0x2582('0x35')][_0x2582('0x39')]));_0x3cf5d2[_0x2582('0x38')]=_0x3cf5d2[_0x2582('0x38')][_0x2582('0x48')]?_0x3cf5d2[_0x2582('0x38')]:_0x599f94[_0x2582('0x33')];_0x3cf5d2['order']=qs[_0x2582('0x50')](_0x304d4a[_0x2582('0x35')]['sort']);_0x3cf5d2[_0x2582('0x3e')]=qs[_0x2582('0x36')](_[_0x2582('0x3c')](_0x304d4a[_0x2582('0x35')],_0x599f94[_0x2582('0x36')]));if(_0x304d4a[_0x2582('0x35')]['filter']){_0x3cf5d2['where']=_[_0x2582('0x3f')](_0x3cf5d2[_0x2582('0x3e')],{'$or':_[_0x2582('0x2e')](_0x3cf5d2[_0x2582('0x38')],function(_0x3bde99){var _0x2badc6={};_0x2badc6[_0x3bde99]={'$like':'%'+_0x304d4a[_0x2582('0x35')][_0x2582('0x3d')]+'%'};return _0x2badc6;})});}_0x3cf5d2=_[_0x2582('0x3f')]({},_0x3cf5d2,_0x304d4a[_0x2582('0x41')]);return _0x3692a2[_0x2582('0x4d')](_0x3cf5d2);}})[_0x2582('0x27')](function(_0x55c7f8){if(_0x55c7f8){_0x59d72e=_0x55c7f8['length'];if(!_0x304d4a[_0x2582('0x35')][_0x2582('0x51')](_0x2582('0x3a'))){_0x3cf5d2['limit']=qs[_0x2582('0x20')](_0x304d4a[_0x2582('0x35')][_0x2582('0x20')]);_0x3cf5d2[_0x2582('0x1e')]=qs[_0x2582('0x1e')](_0x304d4a[_0x2582('0x35')][_0x2582('0x1e')]);}return _0x3692a2[_0x2582('0x4d')](_0x3cf5d2);}})[_0x2582('0x27')](function(_0x1857e1){if(_0x1857e1){return _0x1857e1?{'count':_0x59d72e,'rows':_0x1857e1}:null;}})[_0x2582('0x27')](respondWithResult(_0x38dd59,null))[_0x2582('0x4a')](handleError(_0x38dd59,null));};exports[_0x2582('0x52')]=function(_0x119e1e,_0x4e64ee,_0x24235e){if(_0x119e1e['body']['id']){delete _0x119e1e[_0x2582('0x4c')]['id'];}return db[_0x2582('0x2f')][_0x2582('0x4e')]({'where':{'id':_0x119e1e[_0x2582('0x46')]['id']}})[_0x2582('0x27')](handleEntityNotFound(_0x4e64ee,null))['then'](function(_0x238ce0){if(_0x238ce0){_0x119e1e[_0x2582('0x4c')]['AccountId']=_0x238ce0['id'];_0x119e1e[_0x2582('0x4c')][_0x2582('0x53')]=integrations[_0x2582('0x54')](_0x119e1e[_0x2582('0x4c')][_0x2582('0x55')],_0x119e1e[_0x2582('0x4c')][_0x2582('0x31')]);_0x119e1e[_0x2582('0x4c')][_0x2582('0x56')]=integrations[_0x2582('0x57')](_0x119e1e[_0x2582('0x4c')][_0x2582('0x55')],_0x119e1e[_0x2582('0x4c')][_0x2582('0x31')]);return db['FreshsalesConfiguration'][_0x2582('0x4b')](_0x119e1e[_0x2582('0x4c')],{'include':[{'model':db['FreshsalesField'],'as':_0x2582('0x53')},{'model':db[_0x2582('0x58')],'as':_0x2582('0x56')}]});}return null;})[_0x2582('0x27')](respondWithResult(_0x4e64ee,null))['catch'](handleError(_0x4e64ee,null));};exports['getFields']=function(_0xd7d502,_0x47c4f7,_0x253332){var _0x3565e9='';var _0x4caa67='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0xd7d502[_0x2582('0x46')]['id']},'attributes':['id',_0x2582('0x59'),_0x2582('0x5a'),_0x2582('0x5b')]})[_0x2582('0x27')](handleEntityNotFound(_0x47c4f7,null))[_0x2582('0x27')](function(_0x4e33dd){if(_0x4e33dd){_0x4caa67=_0x4e33dd[_0x2582('0x59')];_0x3565e9=_0x4e33dd[_0x2582('0x5a')];var _0x4f78e8=_0x4e33dd[_0x2582('0x5a')][_0x2582('0x5c')](-0x1);if(_0x4f78e8==='/'){_0x3565e9=_0x3565e9[_0x2582('0x5d')](0x0,_0x3565e9['lastIndexOf'](_0x4f78e8));}return rp({'method':_0x2582('0x5e'),'uri':util['format']('%s%s',_0x3565e9,_0x2582('0x5f')),'headers':{'Authorization':_0x2582('0x60')+_0x4e33dd[_0x2582('0x5b')]},'json':!![]});}})[_0x2582('0x27')](function(_0x5370f7){if(_0x5370f7){var _0x30bf9f=_0x5370f7[_0x2582('0x61')];var _0x43118b=![];var _0x5708bc=null;for(_0x5708bc=0x0;_0x5708bc<_0x30bf9f[_0x2582('0x48')];_0x5708bc++){if(_0x30bf9f[_0x5708bc][_0x2582('0x62')]===_0x4caa67){_0x43118b=!![];}}if(_0x43118b){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x2582('0x63')});}}})[_0x2582('0x27')](respondWithResult(_0x47c4f7,null))['catch'](function(_0x5882fc){var _0x6520de=_0xd7d502[_0x2582('0x35')][_0x2582('0x64')]?0x1f4:_0x5882fc[_0x2582('0x65')]||0x1f4;logger[_0x2582('0x29')](_0x2582('0x66'),_0x2582('0x67'),_0x6520de,JSON[_0x2582('0x68')](_0x5882fc));delete _0x5882fc['name'];if(_0x6520de===0x191){_0x6520de=0x190;}_0x47c4f7[_0x2582('0x1c')](_0x6520de)[_0x2582('0x2c')](_0xd7d502[_0x2582('0x35')][_0x2582('0x64')]?{'message':_0x2582('0x69'),'statusCode':_0x5882fc['statusCode']}:_0x5882fc);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 616a508..ac782a8 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 _0x2272=['request-promise','path','rimraf','../../components/integrations/configuration','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x4552ea,_0x5607ea){var _0x28fec0=function(_0x41323e){while(--_0x41323e){_0x4552ea['push'](_0x4552ea['shift']());}};_0x28fec0(++_0x5607ea);}(_0x2272,0xd8));var _0x2227=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2272[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var logger=require(_0x2227('0x2'))(_0x2227('0x3'));var moment=require(_0x2227('0x4'));var BPromise=require('bluebird');var rp=require(_0x2227('0x5'));var fs=require('fs');var path=require(_0x2227('0x6'));var rimraf=require(_0x2227('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x2227('0x8'));module[_0x2227('0x9')]=function(_0xb33647,_0x2591db){return _0xb33647[_0x2227('0xa')](_0x2227('0xb'),attributes,{'tableName':_0x2227('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4991=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4991,0xf7));var _0x1499=function(_0x260b8a,_0x69f617){_0x260b8a=_0x260b8a-0x0;var _0x3feaf0=_0x4991[_0x260b8a];return _0x3feaf0;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));var integrations=require(_0x1499('0x9'));module['exports']=function(_0x2a8e96,_0x1c3bd7){return _0x2a8e96[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'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 caaf9cb..5a7f149 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 _0x4975=['jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','GetFreshsalesAccount','ShowFreshsalesAccount','find','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4975,0x86));var _0x5497=function(_0x398bcf,_0x46db49){_0x398bcf=_0x398bcf-0x0;var _0x443ece=_0x4975[_0x398bcf];return _0x443ece;};'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')]('FreshsalesAccount,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});}exports['GetFreshsalesAccount']=function(_0x3f4d20){var _0x1bf442=this;return new Promise(function(_0x3a47fd,_0x5d9e24){return db[_0x5497('0x17')][_0x5497('0x18')]({'raw':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1b')]||null:null,'attributes':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1c')]||null:null,'limit':_0x3f4d20['options']?_0x3f4d20[_0x5497('0x19')]['limit']||null:null,'include':_0x3f4d20[_0x5497('0x19')]?_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x3f4d20[_0x5497('0x19')][_0x5497('0x1d')],function(_0x5018fa){return{'model':db[_0x5018fa['model']],'as':_0x5018fa['as'],'attributes':_0x5018fa[_0x5497('0x1c')],'include':_0x5018fa[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5018fa[_0x5497('0x1d')],function(_0x5223b5){return{'model':db[_0x5223b5[_0x5497('0x1f')]],'as':_0x5223b5['as'],'attributes':_0x5223b5['attributes'],'include':_0x5223b5[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x5223b5[_0x5497('0x1d')],function(_0x34a1a5){return{'model':db[_0x34a1a5[_0x5497('0x1f')]],'as':_0x34a1a5['as'],'attributes':_0x34a1a5[_0x5497('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af5f4){logger['info']('GetFreshsalesAccount',_0x3f4d20);logger['debug'](_0x5497('0x20'),_0x3f4d20,JSON['stringify'](_0x4af5f4));_0x3a47fd(_0x4af5f4);})['catch'](function(_0xc3465){logger[_0x5497('0x13')](_0x5497('0x20'),_0xc3465['message'],_0x3f4d20);_0x5d9e24(_0x1bf442['error'](0x1f4,_0xc3465['message']));});});};exports[_0x5497('0x21')]=function(_0x471e0b){var _0xf4c117=this;return new Promise(function(_0x5b8f79,_0x489f71){return db['FreshsalesAccount'][_0x5497('0x22')]({'raw':_0x471e0b['options']?_0x471e0b[_0x5497('0x19')][_0x5497('0x1a')]===undefined?!![]:![]:!![],'where':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1b')]||null:null,'attributes':_0x471e0b[_0x5497('0x19')]?_0x471e0b['options'][_0x5497('0x1c')]||null:null,'include':_0x471e0b[_0x5497('0x19')]?_0x471e0b[_0x5497('0x19')]['include']?_[_0x5497('0x1e')](_0x471e0b[_0x5497('0x19')][_0x5497('0x1d')],function(_0x362b96){return{'model':db[_0x362b96[_0x5497('0x1f')]],'as':_0x362b96['as'],'attributes':_0x362b96['attributes'],'include':_0x362b96[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x362b96['include'],function(_0x1ffc9b){return{'model':db[_0x1ffc9b[_0x5497('0x1f')]],'as':_0x1ffc9b['as'],'attributes':_0x1ffc9b[_0x5497('0x1c')],'include':_0x1ffc9b[_0x5497('0x1d')]?_[_0x5497('0x1e')](_0x1ffc9b[_0x5497('0x1d')],function(_0x580e86){return{'model':db[_0x580e86[_0x5497('0x1f')]],'as':_0x580e86['as'],'attributes':_0x580e86['attributes']};}):[]};}):[]};}):[]:[]})[_0x5497('0x23')](function(_0x212199){logger[_0x5497('0xd')]('ShowFreshsalesAccount',_0x471e0b);logger['debug'](_0x5497('0x21'),_0x471e0b,JSON[_0x5497('0x12')](_0x212199));_0x5b8f79(_0x212199);})[_0x5497('0x16')](function(_0x429cbf){logger[_0x5497('0x13')](_0x5497('0x21'),_0x429cbf['message'],_0x471e0b);_0x489f71(_0xf4c117[_0x5497('0x13')](0x1f4,_0x429cbf[_0x5497('0x14')]));});});}; \ No newline at end of file +var _0x33af=['include','map','model','ShowFreshsalesAccount','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit'];(function(_0x359bbe,_0x5b7fcc){var _0x1b3353=function(_0x34b41c){while(--_0x34b41c){_0x359bbe['push'](_0x359bbe['shift']());}};_0x1b3353(++_0x5b7fcc);}(_0x33af,0xec));var _0xf33a=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x33af[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});}exports[_0xf33a('0x15')]=function(_0x524109){var _0x2946ef=this;return new Promise(function(_0x23d9e2,_0x38d69a){return db[_0xf33a('0x16')]['findAll']({'raw':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x18')]===undefined?!![]:![]:!![],'where':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x19')]||null:null,'attributes':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x1a')]||null:null,'limit':_0x524109[_0xf33a('0x17')]?_0x524109['options'][_0xf33a('0x1b')]||null:null,'include':_0x524109[_0xf33a('0x17')]?_0x524109[_0xf33a('0x17')][_0xf33a('0x1c')]?_[_0xf33a('0x1d')](_0x524109['options'][_0xf33a('0x1c')],function(_0x5882ba){return{'model':db[_0x5882ba[_0xf33a('0x1e')]],'as':_0x5882ba['as'],'attributes':_0x5882ba[_0xf33a('0x1a')],'include':_0x5882ba[_0xf33a('0x1c')]?_[_0xf33a('0x1d')](_0x5882ba[_0xf33a('0x1c')],function(_0x4b9801){return{'model':db[_0x4b9801[_0xf33a('0x1e')]],'as':_0x4b9801['as'],'attributes':_0x4b9801[_0xf33a('0x1a')],'include':_0x4b9801['include']?_['map'](_0x4b9801[_0xf33a('0x1c')],function(_0x5f0a53){return{'model':db[_0x5f0a53['model']],'as':_0x5f0a53['as'],'attributes':_0x5f0a53[_0xf33a('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x79d653){logger['info'](_0xf33a('0x15'),_0x524109);logger[_0xf33a('0xe')](_0xf33a('0x15'),_0x524109,JSON[_0xf33a('0xf')](_0x79d653));_0x23d9e2(_0x79d653);})[_0xf33a('0x14')](function(_0x3068a9){logger[_0xf33a('0x10')](_0xf33a('0x15'),_0x3068a9[_0xf33a('0x12')],_0x524109);_0x38d69a(_0x2946ef[_0xf33a('0x10')](0x1f4,_0x3068a9[_0xf33a('0x12')]));});});};exports[_0xf33a('0x1f')]=function(_0x22c9f2){var _0x3f714e=this;return new Promise(function(_0x2fd098,_0x5eb14a){return db[_0xf33a('0x16')][_0xf33a('0x20')]({'raw':_0x22c9f2[_0xf33a('0x17')]?_0x22c9f2[_0xf33a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x22c9f2[_0xf33a('0x17')]?_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x19')]||null:null,'attributes':_0x22c9f2[_0xf33a('0x17')]?_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x1a')]||null:null,'include':_0x22c9f2['options']?_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x1c')]?_[_0xf33a('0x1d')](_0x22c9f2[_0xf33a('0x17')][_0xf33a('0x1c')],function(_0x57e7be){return{'model':db[_0x57e7be['model']],'as':_0x57e7be['as'],'attributes':_0x57e7be[_0xf33a('0x1a')],'include':_0x57e7be['include']?_['map'](_0x57e7be['include'],function(_0x2c4840){return{'model':db[_0x2c4840[_0xf33a('0x1e')]],'as':_0x2c4840['as'],'attributes':_0x2c4840['attributes'],'include':_0x2c4840[_0xf33a('0x1c')]?_['map'](_0x2c4840[_0xf33a('0x1c')],function(_0x1f11b3){return{'model':db[_0x1f11b3[_0xf33a('0x1e')]],'as':_0x1f11b3['as'],'attributes':_0x1f11b3[_0xf33a('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf33a('0xa')](function(_0x23c92b){logger['info'](_0xf33a('0x1f'),_0x22c9f2);logger[_0xf33a('0xe')]('ShowFreshsalesAccount',_0x22c9f2,JSON[_0xf33a('0xf')](_0x23c92b));_0x2fd098(_0x23c92b);})[_0xf33a('0x14')](function(_0x3e0a98){logger['error'](_0xf33a('0x1f'),_0x3e0a98[_0xf33a('0x12')],_0x22c9f2);_0x5eb14a(_0x3f714e[_0xf33a('0x10')](0x1f4,_0x3e0a98[_0xf33a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index dd596e7..f18265d 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 _0x361e=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','getDescriptions','getFields','update','destroy'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0x361e,0x1ba));var _0xe361=function(_0x2f1e26,_0x1a8d51){_0x2f1e26=_0x2f1e26-0x0;var _0x76232b=_0x361e[_0x2f1e26];return _0x76232b;};'use strict';var multer=require(_0xe361('0x0'));var util=require(_0xe361('0x1'));var path=require(_0xe361('0x2'));var timeout=require(_0xe361('0x3'));var express=require(_0xe361('0x4'));var router=express['Router']();var fs_extra=require(_0xe361('0x5'));var auth=require(_0xe361('0x6'));var interaction=require(_0xe361('0x7'));var config=require(_0xe361('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xe361('0x9')]('/',auth[_0xe361('0xa')](),controller[_0xe361('0xb')]);router['get'](_0xe361('0xc'),auth['isAuthenticated'](),controller[_0xe361('0xd')]);router[_0xe361('0x9')](_0xe361('0xe'),auth['isAuthenticated'](),controller[_0xe361('0xf')]);router[_0xe361('0x9')]('/:id/descriptions',auth[_0xe361('0xa')](),controller[_0xe361('0x10')]);router[_0xe361('0x9')]('/:id/fields',auth[_0xe361('0xa')](),controller[_0xe361('0x11')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe361('0xc'),auth[_0xe361('0xa')](),controller[_0xe361('0x12')]);router['delete'](_0xe361('0xc'),auth[_0xe361('0xa')](),controller[_0xe361('0x13')]);module[_0xe361('0x14')]=router; \ No newline at end of file +var _0xeac7=['express','Router','fs-extra','./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated','/:id/subjects','/:id/descriptions','/:id/fields','getFields','post','create','update','destroy','exports','multer','util','path','connect-timeout'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xeac7,0x10d));var _0x7eac=function(_0x1aebf6,_0x1f469e){_0x1aebf6=_0x1aebf6-0x0;var _0x10c109=_0xeac7[_0x1aebf6];return _0x10c109;};'use strict';var multer=require(_0x7eac('0x0'));var util=require(_0x7eac('0x1'));var path=require(_0x7eac('0x2'));var timeout=require(_0x7eac('0x3'));var express=require(_0x7eac('0x4'));var router=express[_0x7eac('0x5')]();var fs_extra=require(_0x7eac('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x7eac('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7eac('0x8')]);router[_0x7eac('0x9')](_0x7eac('0xa'),auth[_0x7eac('0xb')](),controller['show']);router['get'](_0x7eac('0xc'),auth[_0x7eac('0xb')](),controller['getSubjects']);router[_0x7eac('0x9')](_0x7eac('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router['get'](_0x7eac('0xe'),auth[_0x7eac('0xb')](),controller[_0x7eac('0xf')]);router[_0x7eac('0x10')]('/',auth[_0x7eac('0xb')](),controller[_0x7eac('0x11')]);router['put'](_0x7eac('0xa'),auth[_0x7eac('0xb')](),controller[_0x7eac('0x12')]);router['delete'](_0x7eac('0xa'),auth['isAuthenticated'](),controller[_0x7eac('0x13')]);module[_0x7eac('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 6e102fa..a2d891c 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 _0xe323=['exports','STRING'];(function(_0x2665b0,_0x53517c){var _0x5d3a62=function(_0x29ba3b){while(--_0x29ba3b){_0x2665b0['push'](_0x2665b0['shift']());}};_0x5d3a62(++_0x53517c);}(_0xe323,0xa8));var _0x3e32=function(_0x1875a5,_0x55afb2){_0x1875a5=_0x1875a5-0x0;var _0x42acab=_0xe323[_0x1875a5];return _0x42acab;};'use strict';var Sequelize=require('sequelize');module[_0x3e32('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3e32('0x1')]}}; \ No newline at end of file +var _0x3f8b=['STRING','sequelize','exports'];(function(_0x3474ac,_0x22d0f7){var _0x5345ec=function(_0x45056e){while(--_0x45056e){_0x3474ac['push'](_0x3474ac['shift']());}};_0x5345ec(++_0x22d0f7);}(_0x3f8b,0x82));var _0xb3f8=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x3f8b[_0x56f7e2];return _0x36240b;};'use strict';var Sequelize=require(_0xb3f8('0x0'));module[_0xb3f8('0x1')]={'name':{'type':Sequelize[_0xb3f8('0x2')]},'description':{'type':Sequelize[_0xb3f8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ac58e6b..a9490e4 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 _0x3373=['intersection','attributes','model','fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','rawAttributes','length','include','create','body','find','destroy','getSubjects','findOne','getDescriptions','FreshsalesField','nolimit','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','error','stack','name','send','index','map','FreshsalesConfiguration','type','key','keys','query','filters'];(function(_0xe0b410,_0x389a8d){var _0x280891=function(_0x21cfdd){while(--_0x21cfdd){_0xe0b410['push'](_0xe0b410['shift']());}};_0x280891(++_0x389a8d);}(_0x3373,0x11b));var _0x3337=function(_0x3c0a1b,_0x52007e){_0x3c0a1b=_0x3c0a1b-0x0;var _0x6ba8a3=_0x3373[_0x3c0a1b];return _0x6ba8a3;};'use strict';var emlformat=require(_0x3337('0x0'));var rimraf=require(_0x3337('0x1'));var zipdir=require(_0x3337('0x2'));var jsonpatch=require(_0x3337('0x3'));var rp=require(_0x3337('0x4'));var moment=require(_0x3337('0x5'));var BPromise=require(_0x3337('0x6'));var Mustache=require(_0x3337('0x7'));var util=require(_0x3337('0x8'));var path=require(_0x3337('0x9'));var sox=require(_0x3337('0xa'));var csv=require('to-csv');var ejs=require(_0x3337('0xb'));var fs=require('fs');var fs_extra=require(_0x3337('0xc'));var _=require(_0x3337('0xd'));var squel=require(_0x3337('0xe'));var crypto=require('crypto');var jsforce=require(_0x3337('0xf'));var deskjs=require(_0x3337('0x10'));var toCsv=require(_0x3337('0x11'));var querystring=require('querystring');var Papa=require(_0x3337('0x12'));var Redis=require(_0x3337('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x3337('0x14'));var as=require(_0x3337('0x15'));var hardwareService=require(_0x3337('0x16'));var logger=require(_0x3337('0x17'))(_0x3337('0x18'));var utils=require(_0x3337('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3337('0x1a'));var db=require(_0x3337('0x1b'))['db'];function respondWithStatusCode(_0x4f6e89,_0x3ff8e8){_0x3ff8e8=_0x3ff8e8||0xcc;return function(_0x5e93c0){if(_0x5e93c0){return _0x4f6e89['sendStatus'](_0x3ff8e8);}return _0x4f6e89[_0x3337('0x1c')](_0x3ff8e8)[_0x3337('0x1d')]();};}function respondWithResult(_0x4b3640,_0x528424){_0x528424=_0x528424||0xc8;return function(_0x217014){if(_0x217014){return _0x4b3640[_0x3337('0x1c')](_0x528424)[_0x3337('0x1e')](_0x217014);}};}function respondWithFilteredResult(_0x19f603,_0x1c6bd4){return function(_0x31043e){if(_0x31043e){var _0x51ca6b=typeof _0x1c6bd4[_0x3337('0x1f')]===_0x3337('0x20')&&typeof _0x1c6bd4[_0x3337('0x21')]===_0x3337('0x20');var _0x354515=_0x31043e['count'];var _0x2ed54d=_0x51ca6b?0x0:_0x1c6bd4[_0x3337('0x1f')];var _0x3003ea=_0x51ca6b?_0x31043e[_0x3337('0x22')]:_0x1c6bd4[_0x3337('0x1f')]+_0x1c6bd4[_0x3337('0x21')];var _0x4e14ec;if(_0x3003ea>=_0x354515){_0x3003ea=_0x354515;_0x4e14ec=0xc8;}else{_0x4e14ec=0xce;}_0x19f603['status'](_0x4e14ec);return _0x19f603[_0x3337('0x23')]('Content-Range',_0x2ed54d+'-'+_0x3003ea+'/'+_0x354515)[_0x3337('0x1e')](_0x31043e);}return null;};}function patchUpdates(_0x76fcc2){return function(_0xc43087){try{jsonpatch[_0x3337('0x24')](_0xc43087,_0x76fcc2,!![]);}catch(_0x2701cf){return BPromise['reject'](_0x2701cf);}return _0xc43087[_0x3337('0x25')]();};}function saveUpdates(_0x175f08,_0x1b6c21){return function(_0x35dd80){if(_0x35dd80){return _0x35dd80[_0x3337('0x26')](_0x175f08)['then'](function(_0x49676f){return _0x49676f;});}return null;};}function removeEntity(_0x285d88,_0x2e6e1a){return function(_0x4fa6d2){if(_0x4fa6d2){return _0x4fa6d2['destroy']()[_0x3337('0x27')](function(){_0x285d88[_0x3337('0x1c')](0xcc)[_0x3337('0x1d')]();});}};}function handleEntityNotFound(_0x16f250,_0x39c422){return function(_0x3f94cc){if(!_0x3f94cc){_0x16f250[_0x3337('0x28')](0x194);}return _0x3f94cc;};}function handleError(_0x4d34d1,_0x4aeba8){_0x4aeba8=_0x4aeba8||0x1f4;return function(_0x5ad090){logger[_0x3337('0x29')](_0x5ad090[_0x3337('0x2a')]);if(_0x5ad090[_0x3337('0x2b')]){delete _0x5ad090[_0x3337('0x2b')];}_0x4d34d1[_0x3337('0x1c')](_0x4aeba8)[_0x3337('0x2c')](_0x5ad090);};}exports[_0x3337('0x2d')]=function(_0xc037cd,_0x3ebc2d){var _0x18196b={},_0x21d769={},_0x2c7d6c={'count':0x0,'rows':[]};var _0x5a9971=_[_0x3337('0x2e')](db[_0x3337('0x2f')]['rawAttributes'],function(_0x3b66fc){return{'name':_0x3b66fc['fieldName'],'type':_0x3b66fc[_0x3337('0x30')][_0x3337('0x31')]};});_0x21d769['model']=_[_0x3337('0x2e')](_0x5a9971,_0x3337('0x2b'));_0x21d769['query']=_[_0x3337('0x32')](_0xc037cd[_0x3337('0x33')]);_0x21d769[_0x3337('0x34')]=_[_0x3337('0x35')](_0x21d769['model'],_0x21d769['query']);_0x18196b[_0x3337('0x36')]=_['intersection'](_0x21d769[_0x3337('0x37')],qs[_0x3337('0x38')](_0xc037cd['query'][_0x3337('0x38')]));_0x18196b[_0x3337('0x36')]=_0x18196b[_0x3337('0x36')]['length']?_0x18196b['attributes']:_0x21d769['model'];if(!_0xc037cd[_0x3337('0x33')][_0x3337('0x39')]('nolimit')){_0x18196b[_0x3337('0x21')]=qs[_0x3337('0x21')](_0xc037cd[_0x3337('0x33')][_0x3337('0x21')]);_0x18196b[_0x3337('0x1f')]=qs[_0x3337('0x1f')](_0xc037cd['query'][_0x3337('0x1f')]);}_0x18196b[_0x3337('0x3a')]=qs[_0x3337('0x3b')](_0xc037cd[_0x3337('0x33')][_0x3337('0x3b')]);_0x18196b['where']=qs['filters'](_[_0x3337('0x3c')](_0xc037cd[_0x3337('0x33')],_0x21d769[_0x3337('0x34')]),_0x5a9971);if(_0xc037cd[_0x3337('0x33')][_0x3337('0x3d')]){_0x18196b[_0x3337('0x3e')]=_['merge'](_0x18196b[_0x3337('0x3e')],{'$or':_[_0x3337('0x2e')](_0x5a9971,function(_0x1d1211){if(_0x1d1211[_0x3337('0x30')]!==_0x3337('0x3f')){var _0x98a37d={};_0x98a37d[_0x1d1211[_0x3337('0x2b')]]={'$like':'%'+_0xc037cd['query'][_0x3337('0x3d')]+'%'};return _0x98a37d;}})});}_0x18196b=_[_0x3337('0x40')]({},_0x18196b,_0xc037cd[_0x3337('0x41')]);var _0x17d479={'where':_0x18196b[_0x3337('0x3e')]};return db[_0x3337('0x2f')][_0x3337('0x22')](_0x17d479)[_0x3337('0x27')](function(_0x1b9f4a){_0x2c7d6c['count']=_0x1b9f4a;if(_0xc037cd[_0x3337('0x33')][_0x3337('0x42')]){_0x18196b['include']=[{'all':!![]}];}return db[_0x3337('0x2f')][_0x3337('0x43')](_0x18196b);})[_0x3337('0x27')](function(_0x2aa3db){_0x2c7d6c['rows']=_0x2aa3db;return _0x2c7d6c;})[_0x3337('0x27')](respondWithFilteredResult(_0x3ebc2d,_0x18196b))[_0x3337('0x44')](handleError(_0x3ebc2d,null));};exports[_0x3337('0x45')]=function(_0x114b5a,_0x4666ea){var _0x40c6ef={'raw':![],'where':{'id':_0x114b5a[_0x3337('0x46')]['id']}},_0x28b445={};_0x28b445['model']=_[_0x3337('0x32')](db['FreshsalesConfiguration'][_0x3337('0x47')]);_0x28b445[_0x3337('0x33')]=_[_0x3337('0x32')](_0x114b5a[_0x3337('0x33')]);_0x28b445[_0x3337('0x34')]=_[_0x3337('0x35')](_0x28b445[_0x3337('0x37')],_0x28b445[_0x3337('0x33')]);_0x40c6ef[_0x3337('0x36')]=_[_0x3337('0x35')](_0x28b445['model'],qs['fields'](_0x114b5a[_0x3337('0x33')][_0x3337('0x38')]));_0x40c6ef[_0x3337('0x36')]=_0x40c6ef[_0x3337('0x36')][_0x3337('0x48')]?_0x40c6ef[_0x3337('0x36')]:_0x28b445[_0x3337('0x37')];if(_0x114b5a[_0x3337('0x33')][_0x3337('0x42')]){_0x40c6ef[_0x3337('0x49')]=[{'all':!![]}];}_0x40c6ef=_[_0x3337('0x40')]({},_0x40c6ef,_0x114b5a['options']);return db['FreshsalesConfiguration']['find'](_0x40c6ef)[_0x3337('0x27')](handleEntityNotFound(_0x4666ea,null))[_0x3337('0x27')](respondWithResult(_0x4666ea,null))[_0x3337('0x44')](handleError(_0x4666ea,null));};exports[_0x3337('0x4a')]=function(_0x4941ed,_0x47a022){return db[_0x3337('0x2f')][_0x3337('0x4a')](_0x4941ed[_0x3337('0x4b')],{})['then'](respondWithResult(_0x47a022,0xc9))[_0x3337('0x44')](handleError(_0x47a022,null));};exports[_0x3337('0x26')]=function(_0x4984c0,_0xaee8d4){if(_0x4984c0[_0x3337('0x4b')]['id']){delete _0x4984c0[_0x3337('0x4b')]['id'];}return db[_0x3337('0x2f')][_0x3337('0x4c')]({'where':{'id':_0x4984c0[_0x3337('0x46')]['id']}})[_0x3337('0x27')](handleEntityNotFound(_0xaee8d4,null))['then'](saveUpdates(_0x4984c0[_0x3337('0x4b')],null))[_0x3337('0x27')](respondWithResult(_0xaee8d4,null))['catch'](handleError(_0xaee8d4,null));};exports[_0x3337('0x4d')]=function(_0x517c71,_0x4b6433){return db[_0x3337('0x2f')]['find']({'where':{'id':_0x517c71[_0x3337('0x46')]['id']}})[_0x3337('0x27')](handleEntityNotFound(_0x4b6433,null))['then'](removeEntity(_0x4b6433,null))[_0x3337('0x44')](handleError(_0x4b6433,null));};exports[_0x3337('0x4e')]=function(_0x592912,_0x1b2b94,_0x118bc3){var _0x50941f={};var _0x4b3feb={};var _0x1c9196;var _0x51c551;return db['FreshsalesConfiguration'][_0x3337('0x4f')]({'where':{'id':_0x592912['params']['id']}})[_0x3337('0x27')](handleEntityNotFound(_0x1b2b94,null))['then'](function(_0x93d4aa){if(_0x93d4aa){_0x1c9196=_0x93d4aa;_0x4b3feb['model']=_[_0x3337('0x32')](db['FreshsalesField']['rawAttributes']);_0x4b3feb[_0x3337('0x33')]=_[_0x3337('0x32')](_0x592912['query']);_0x4b3feb['filters']=_['intersection'](_0x4b3feb[_0x3337('0x37')],_0x4b3feb['query']);_0x50941f[_0x3337('0x36')]=_[_0x3337('0x35')](_0x4b3feb[_0x3337('0x37')],qs['fields'](_0x592912[_0x3337('0x33')][_0x3337('0x38')]));_0x50941f[_0x3337('0x36')]=_0x50941f[_0x3337('0x36')][_0x3337('0x48')]?_0x50941f['attributes']:_0x4b3feb[_0x3337('0x37')];_0x50941f[_0x3337('0x3a')]=qs['sort'](_0x592912[_0x3337('0x33')]['sort']);_0x50941f['where']=qs[_0x3337('0x34')](_[_0x3337('0x3c')](_0x592912['query'],_0x4b3feb[_0x3337('0x34')]));if(_0x592912[_0x3337('0x33')][_0x3337('0x3d')]){_0x50941f[_0x3337('0x3e')]=_[_0x3337('0x40')](_0x50941f['where'],{'$or':_[_0x3337('0x2e')](_0x50941f[_0x3337('0x36')],function(_0x2db394){var _0x462ae7={};_0x462ae7[_0x2db394]={'$like':'%'+_0x592912['query'][_0x3337('0x3d')]+'%'};return _0x462ae7;})});}_0x50941f=_[_0x3337('0x40')]({},_0x50941f,_0x592912[_0x3337('0x41')]);return _0x1c9196[_0x3337('0x4e')](_0x50941f);}})[_0x3337('0x27')](function(_0x3edf2f){if(_0x3edf2f){_0x51c551=_0x3edf2f[_0x3337('0x48')];if(!_0x592912[_0x3337('0x33')][_0x3337('0x39')]('nolimit')){_0x50941f['limit']=qs[_0x3337('0x21')](_0x592912[_0x3337('0x33')][_0x3337('0x21')]);_0x50941f[_0x3337('0x1f')]=qs['offset'](_0x592912[_0x3337('0x33')][_0x3337('0x1f')]);}return _0x1c9196['getSubjects'](_0x50941f);}})['then'](function(_0x5c6250){if(_0x5c6250){return _0x5c6250?{'count':_0x51c551,'rows':_0x5c6250}:null;}})[_0x3337('0x27')](respondWithResult(_0x1b2b94,null))[_0x3337('0x44')](handleError(_0x1b2b94,null));};exports[_0x3337('0x50')]=function(_0x3f62af,_0x59b632,_0x20fe18){var _0x3bfa40={};var _0x2c3ba9={};var _0x313223;var _0x18e86b;return db[_0x3337('0x2f')]['findOne']({'where':{'id':_0x3f62af[_0x3337('0x46')]['id']}})['then'](handleEntityNotFound(_0x59b632,null))[_0x3337('0x27')](function(_0x3f0f07){if(_0x3f0f07){_0x313223=_0x3f0f07;_0x2c3ba9[_0x3337('0x37')]=_[_0x3337('0x32')](db[_0x3337('0x51')][_0x3337('0x47')]);_0x2c3ba9[_0x3337('0x33')]=_[_0x3337('0x32')](_0x3f62af[_0x3337('0x33')]);_0x2c3ba9[_0x3337('0x34')]=_['intersection'](_0x2c3ba9[_0x3337('0x37')],_0x2c3ba9[_0x3337('0x33')]);_0x3bfa40[_0x3337('0x36')]=_[_0x3337('0x35')](_0x2c3ba9['model'],qs[_0x3337('0x38')](_0x3f62af[_0x3337('0x33')][_0x3337('0x38')]));_0x3bfa40[_0x3337('0x36')]=_0x3bfa40['attributes']['length']?_0x3bfa40[_0x3337('0x36')]:_0x2c3ba9['model'];_0x3bfa40['order']=qs[_0x3337('0x3b')](_0x3f62af[_0x3337('0x33')]['sort']);_0x3bfa40[_0x3337('0x3e')]=qs[_0x3337('0x34')](_['pick'](_0x3f62af[_0x3337('0x33')],_0x2c3ba9['filters']));if(_0x3f62af[_0x3337('0x33')][_0x3337('0x3d')]){_0x3bfa40[_0x3337('0x3e')]=_[_0x3337('0x40')](_0x3bfa40['where'],{'$or':_['map'](_0x3bfa40[_0x3337('0x36')],function(_0xdcacc1){var _0x23e49f={};_0x23e49f[_0xdcacc1]={'$like':'%'+_0x3f62af[_0x3337('0x33')][_0x3337('0x3d')]+'%'};return _0x23e49f;})});}_0x3bfa40=_[_0x3337('0x40')]({},_0x3bfa40,_0x3f62af[_0x3337('0x41')]);return _0x313223[_0x3337('0x50')](_0x3bfa40);}})[_0x3337('0x27')](function(_0x3bd96c){if(_0x3bd96c){_0x18e86b=_0x3bd96c[_0x3337('0x48')];if(!_0x3f62af[_0x3337('0x33')][_0x3337('0x39')](_0x3337('0x52'))){_0x3bfa40[_0x3337('0x21')]=qs[_0x3337('0x21')](_0x3f62af['query'][_0x3337('0x21')]);_0x3bfa40[_0x3337('0x1f')]=qs[_0x3337('0x1f')](_0x3f62af[_0x3337('0x33')]['offset']);}return _0x313223[_0x3337('0x50')](_0x3bfa40);}})[_0x3337('0x27')](function(_0x50712){if(_0x50712){return _0x50712?{'count':_0x18e86b,'rows':_0x50712}:null;}})[_0x3337('0x27')](respondWithResult(_0x59b632,null))['catch'](handleError(_0x59b632,null));};exports['getFields']=function(_0x22c178,_0x2e1243,_0x570f07){var _0x510335={};var _0x229932={};var _0x1306d2;var _0x5e87d4;return db[_0x3337('0x2f')][_0x3337('0x4f')]({'where':{'id':_0x22c178[_0x3337('0x46')]['id']}})[_0x3337('0x27')](handleEntityNotFound(_0x2e1243,null))[_0x3337('0x27')](function(_0x16a98d){if(_0x16a98d){_0x1306d2=_0x16a98d;_0x229932[_0x3337('0x37')]=_[_0x3337('0x32')](db[_0x3337('0x51')][_0x3337('0x47')]);_0x229932['query']=_[_0x3337('0x32')](_0x22c178[_0x3337('0x33')]);_0x229932[_0x3337('0x34')]=_['intersection'](_0x229932[_0x3337('0x37')],_0x229932[_0x3337('0x33')]);_0x510335[_0x3337('0x36')]=_[_0x3337('0x35')](_0x229932[_0x3337('0x37')],qs[_0x3337('0x38')](_0x22c178[_0x3337('0x33')][_0x3337('0x38')]));_0x510335['attributes']=_0x510335[_0x3337('0x36')][_0x3337('0x48')]?_0x510335[_0x3337('0x36')]:_0x229932[_0x3337('0x37')];_0x510335[_0x3337('0x3a')]=qs[_0x3337('0x3b')](_0x22c178[_0x3337('0x33')][_0x3337('0x3b')]);_0x510335[_0x3337('0x3e')]=qs[_0x3337('0x34')](_[_0x3337('0x3c')](_0x22c178[_0x3337('0x33')],_0x229932[_0x3337('0x34')]));if(_0x22c178['query']['filter']){_0x510335[_0x3337('0x3e')]=_['merge'](_0x510335['where'],{'$or':_['map'](_0x510335['attributes'],function(_0x2e0fca){var _0x2f0c59={};_0x2f0c59[_0x2e0fca]={'$like':'%'+_0x22c178[_0x3337('0x33')]['filter']+'%'};return _0x2f0c59;})});}_0x510335=_[_0x3337('0x40')]({},_0x510335,_0x22c178[_0x3337('0x41')]);return _0x1306d2[_0x3337('0x53')](_0x510335);}})['then'](function(_0x100a8e){if(_0x100a8e){_0x5e87d4=_0x100a8e[_0x3337('0x48')];if(!_0x22c178['query'][_0x3337('0x39')](_0x3337('0x52'))){_0x510335[_0x3337('0x21')]=qs[_0x3337('0x21')](_0x22c178[_0x3337('0x33')][_0x3337('0x21')]);_0x510335[_0x3337('0x1f')]=qs[_0x3337('0x1f')](_0x22c178['query']['offset']);}return _0x1306d2['getFields'](_0x510335);}})[_0x3337('0x27')](function(_0x577636){if(_0x577636){return _0x577636?{'count':_0x5e87d4,'rows':_0x577636}:null;}})[_0x3337('0x27')](respondWithResult(_0x2e1243,null))[_0x3337('0x44')](handleError(_0x2e1243,null));}; \ No newline at end of file +var _0x243e=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','set','json','apply','save','update','stack','name','send','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','then','includeAll','include','catch','show','params','options','find','create','body','destroy','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','request-promise','mustache'];(function(_0x115777,_0x1079fb){var _0x40b553=function(_0x314bc3){while(--_0x314bc3){_0x115777['push'](_0x115777['shift']());}};_0x40b553(++_0x1079fb);}(_0x243e,0xe0));var _0xe243=function(_0x21ae69,_0x1e0f27){_0x21ae69=_0x21ae69-0x0;var _0x371cfe=_0x243e[_0x21ae69];return _0x371cfe;};'use strict';var emlformat=require(_0xe243('0x0'));var rimraf=require(_0xe243('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe243('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe243('0x3'));var util=require(_0xe243('0x4'));var path=require(_0xe243('0x5'));var sox=require(_0xe243('0x6'));var csv=require(_0xe243('0x7'));var ejs=require(_0xe243('0x8'));var fs=require('fs');var fs_extra=require(_0xe243('0x9'));var _=require(_0xe243('0xa'));var squel=require(_0xe243('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe243('0xc'));var toCsv=require(_0xe243('0x7'));var querystring=require(_0xe243('0xd'));var Papa=require('papaparse');var Redis=require(_0xe243('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe243('0xf'));var as=require(_0xe243('0x10'));var hardwareService=require(_0xe243('0x11'));var logger=require(_0xe243('0x12'))('api');var utils=require(_0xe243('0x13'));var config=require(_0xe243('0x14'));var licenseUtil=require(_0xe243('0x15'));var db=require(_0xe243('0x16'))['db'];function respondWithStatusCode(_0x2d8d68,_0x2f2c72){_0x2f2c72=_0x2f2c72||0xcc;return function(_0x5f37b3){if(_0x5f37b3){return _0x2d8d68['sendStatus'](_0x2f2c72);}return _0x2d8d68[_0xe243('0x17')](_0x2f2c72)[_0xe243('0x18')]();};}function respondWithResult(_0x36a8f1,_0xd413d){_0xd413d=_0xd413d||0xc8;return function(_0x3f461d){if(_0x3f461d){return _0x36a8f1['status'](_0xd413d)['json'](_0x3f461d);}};}function respondWithFilteredResult(_0x1dae7b,_0x3d6aa6){return function(_0x5a6902){if(_0x5a6902){var _0x284fb6=typeof _0x3d6aa6['offset']===_0xe243('0x19')&&typeof _0x3d6aa6[_0xe243('0x1a')]===_0xe243('0x19');var _0x3209db=_0x5a6902['count'];var _0x3e8f24=_0x284fb6?0x0:_0x3d6aa6['offset'];var _0x4c9ff1=_0x284fb6?_0x5a6902['count']:_0x3d6aa6[_0xe243('0x1b')]+_0x3d6aa6[_0xe243('0x1a')];var _0x5c5ae3;if(_0x4c9ff1>=_0x3209db){_0x4c9ff1=_0x3209db;_0x5c5ae3=0xc8;}else{_0x5c5ae3=0xce;}_0x1dae7b[_0xe243('0x17')](_0x5c5ae3);return _0x1dae7b[_0xe243('0x1c')]('Content-Range',_0x3e8f24+'-'+_0x4c9ff1+'/'+_0x3209db)[_0xe243('0x1d')](_0x5a6902);}return null;};}function patchUpdates(_0x39768e){return function(_0x3a03c4){try{jsonpatch[_0xe243('0x1e')](_0x3a03c4,_0x39768e,!![]);}catch(_0x1b6661){return BPromise['reject'](_0x1b6661);}return _0x3a03c4[_0xe243('0x1f')]();};}function saveUpdates(_0x4424e7,_0x2053ac){return function(_0x15cdcd){if(_0x15cdcd){return _0x15cdcd[_0xe243('0x20')](_0x4424e7)['then'](function(_0x3113df){return _0x3113df;});}return null;};}function removeEntity(_0x3d01c8,_0xf033af){return function(_0xe8a56e){if(_0xe8a56e){return _0xe8a56e['destroy']()['then'](function(){_0x3d01c8[_0xe243('0x17')](0xcc)[_0xe243('0x18')]();});}};}function handleEntityNotFound(_0x31f457,_0x1f46f0){return function(_0x48d68e){if(!_0x48d68e){_0x31f457['sendStatus'](0x194);}return _0x48d68e;};}function handleError(_0x5dc68f,_0x4d2b3e){_0x4d2b3e=_0x4d2b3e||0x1f4;return function(_0x4c22ae){logger['error'](_0x4c22ae[_0xe243('0x21')]);if(_0x4c22ae[_0xe243('0x22')]){delete _0x4c22ae['name'];}_0x5dc68f[_0xe243('0x17')](_0x4d2b3e)[_0xe243('0x23')](_0x4c22ae);};}exports['index']=function(_0x92a910,_0x52fb0a){var _0x42b454={},_0x4ec321={},_0x309043={'count':0x0,'rows':[]};var _0xdece8b=_[_0xe243('0x24')](db[_0xe243('0x25')][_0xe243('0x26')],function(_0x1fc5f4){return{'name':_0x1fc5f4[_0xe243('0x27')],'type':_0x1fc5f4[_0xe243('0x28')][_0xe243('0x29')]};});_0x4ec321['model']=_[_0xe243('0x24')](_0xdece8b,_0xe243('0x22'));_0x4ec321[_0xe243('0x2a')]=_[_0xe243('0x2b')](_0x92a910['query']);_0x4ec321[_0xe243('0x2c')]=_[_0xe243('0x2d')](_0x4ec321[_0xe243('0x2e')],_0x4ec321[_0xe243('0x2a')]);_0x42b454[_0xe243('0x2f')]=_[_0xe243('0x2d')](_0x4ec321[_0xe243('0x2e')],qs[_0xe243('0x30')](_0x92a910[_0xe243('0x2a')][_0xe243('0x30')]));_0x42b454[_0xe243('0x2f')]=_0x42b454['attributes'][_0xe243('0x31')]?_0x42b454[_0xe243('0x2f')]:_0x4ec321[_0xe243('0x2e')];if(!_0x92a910[_0xe243('0x2a')][_0xe243('0x32')](_0xe243('0x33'))){_0x42b454['limit']=qs['limit'](_0x92a910['query']['limit']);_0x42b454[_0xe243('0x1b')]=qs['offset'](_0x92a910['query']['offset']);}_0x42b454[_0xe243('0x34')]=qs[_0xe243('0x35')](_0x92a910[_0xe243('0x2a')]['sort']);_0x42b454[_0xe243('0x36')]=qs['filters'](_[_0xe243('0x37')](_0x92a910[_0xe243('0x2a')],_0x4ec321['filters']),_0xdece8b);if(_0x92a910[_0xe243('0x2a')][_0xe243('0x38')]){_0x42b454[_0xe243('0x36')]=_[_0xe243('0x39')](_0x42b454[_0xe243('0x36')],{'$or':_['map'](_0xdece8b,function(_0x167b1a){if(_0x167b1a[_0xe243('0x28')]!==_0xe243('0x3a')){var _0x376834={};_0x376834[_0x167b1a['name']]={'$like':'%'+_0x92a910['query'][_0xe243('0x38')]+'%'};return _0x376834;}})});}_0x42b454=_['merge']({},_0x42b454,_0x92a910['options']);var _0x4bc725={'where':_0x42b454[_0xe243('0x36')]};return db[_0xe243('0x25')][_0xe243('0x3b')](_0x4bc725)[_0xe243('0x3c')](function(_0x4990aa){_0x309043[_0xe243('0x3b')]=_0x4990aa;if(_0x92a910[_0xe243('0x2a')][_0xe243('0x3d')]){_0x42b454[_0xe243('0x3e')]=[{'all':!![]}];}return db[_0xe243('0x25')]['findAll'](_0x42b454);})[_0xe243('0x3c')](function(_0x5e4ec8){_0x309043['rows']=_0x5e4ec8;return _0x309043;})[_0xe243('0x3c')](respondWithFilteredResult(_0x52fb0a,_0x42b454))[_0xe243('0x3f')](handleError(_0x52fb0a,null));};exports[_0xe243('0x40')]=function(_0x108ff6,_0x4d51c){var _0x29b548={'raw':![],'where':{'id':_0x108ff6[_0xe243('0x41')]['id']}},_0x23d90a={};_0x23d90a[_0xe243('0x2e')]=_['keys'](db[_0xe243('0x25')]['rawAttributes']);_0x23d90a[_0xe243('0x2a')]=_[_0xe243('0x2b')](_0x108ff6[_0xe243('0x2a')]);_0x23d90a[_0xe243('0x2c')]=_[_0xe243('0x2d')](_0x23d90a[_0xe243('0x2e')],_0x23d90a[_0xe243('0x2a')]);_0x29b548[_0xe243('0x2f')]=_['intersection'](_0x23d90a[_0xe243('0x2e')],qs['fields'](_0x108ff6[_0xe243('0x2a')][_0xe243('0x30')]));_0x29b548['attributes']=_0x29b548[_0xe243('0x2f')][_0xe243('0x31')]?_0x29b548[_0xe243('0x2f')]:_0x23d90a[_0xe243('0x2e')];if(_0x108ff6['query'][_0xe243('0x3d')]){_0x29b548[_0xe243('0x3e')]=[{'all':!![]}];}_0x29b548=_[_0xe243('0x39')]({},_0x29b548,_0x108ff6[_0xe243('0x42')]);return db[_0xe243('0x25')][_0xe243('0x43')](_0x29b548)[_0xe243('0x3c')](handleEntityNotFound(_0x4d51c,null))[_0xe243('0x3c')](respondWithResult(_0x4d51c,null))[_0xe243('0x3f')](handleError(_0x4d51c,null));};exports[_0xe243('0x44')]=function(_0x13c8d8,_0x5b18cb){return db[_0xe243('0x25')][_0xe243('0x44')](_0x13c8d8[_0xe243('0x45')],{})['then'](respondWithResult(_0x5b18cb,0xc9))['catch'](handleError(_0x5b18cb,null));};exports[_0xe243('0x20')]=function(_0x4fba3e,_0x301ea1){if(_0x4fba3e[_0xe243('0x45')]['id']){delete _0x4fba3e[_0xe243('0x45')]['id'];}return db[_0xe243('0x25')]['find']({'where':{'id':_0x4fba3e[_0xe243('0x41')]['id']}})[_0xe243('0x3c')](handleEntityNotFound(_0x301ea1,null))[_0xe243('0x3c')](saveUpdates(_0x4fba3e[_0xe243('0x45')],null))['then'](respondWithResult(_0x301ea1,null))['catch'](handleError(_0x301ea1,null));};exports[_0xe243('0x46')]=function(_0x948e5b,_0x59c02b){return db[_0xe243('0x25')][_0xe243('0x43')]({'where':{'id':_0x948e5b[_0xe243('0x41')]['id']}})['then'](handleEntityNotFound(_0x59c02b,null))[_0xe243('0x3c')](removeEntity(_0x59c02b,null))[_0xe243('0x3f')](handleError(_0x59c02b,null));};exports[_0xe243('0x47')]=function(_0x2e2167,_0x810ba3,_0x556c21){var _0x3ee0a7={};var _0x486559={};var _0x3d68a8;var _0x1fcbc2;return db[_0xe243('0x25')][_0xe243('0x48')]({'where':{'id':_0x2e2167['params']['id']}})['then'](handleEntityNotFound(_0x810ba3,null))[_0xe243('0x3c')](function(_0x1453de){if(_0x1453de){_0x3d68a8=_0x1453de;_0x486559[_0xe243('0x2e')]=_['keys'](db[_0xe243('0x49')][_0xe243('0x26')]);_0x486559[_0xe243('0x2a')]=_['keys'](_0x2e2167[_0xe243('0x2a')]);_0x486559[_0xe243('0x2c')]=_[_0xe243('0x2d')](_0x486559[_0xe243('0x2e')],_0x486559[_0xe243('0x2a')]);_0x3ee0a7[_0xe243('0x2f')]=_['intersection'](_0x486559[_0xe243('0x2e')],qs[_0xe243('0x30')](_0x2e2167[_0xe243('0x2a')][_0xe243('0x30')]));_0x3ee0a7['attributes']=_0x3ee0a7[_0xe243('0x2f')][_0xe243('0x31')]?_0x3ee0a7[_0xe243('0x2f')]:_0x486559['model'];_0x3ee0a7['order']=qs[_0xe243('0x35')](_0x2e2167['query']['sort']);_0x3ee0a7['where']=qs[_0xe243('0x2c')](_[_0xe243('0x37')](_0x2e2167['query'],_0x486559[_0xe243('0x2c')]));if(_0x2e2167[_0xe243('0x2a')][_0xe243('0x38')]){_0x3ee0a7[_0xe243('0x36')]=_[_0xe243('0x39')](_0x3ee0a7[_0xe243('0x36')],{'$or':_[_0xe243('0x24')](_0x3ee0a7[_0xe243('0x2f')],function(_0x2f863b){var _0x335c02={};_0x335c02[_0x2f863b]={'$like':'%'+_0x2e2167[_0xe243('0x2a')][_0xe243('0x38')]+'%'};return _0x335c02;})});}_0x3ee0a7=_[_0xe243('0x39')]({},_0x3ee0a7,_0x2e2167[_0xe243('0x42')]);return _0x3d68a8[_0xe243('0x47')](_0x3ee0a7);}})['then'](function(_0x34913d){if(_0x34913d){_0x1fcbc2=_0x34913d[_0xe243('0x31')];if(!_0x2e2167[_0xe243('0x2a')][_0xe243('0x32')](_0xe243('0x33'))){_0x3ee0a7[_0xe243('0x1a')]=qs[_0xe243('0x1a')](_0x2e2167['query'][_0xe243('0x1a')]);_0x3ee0a7['offset']=qs[_0xe243('0x1b')](_0x2e2167['query'][_0xe243('0x1b')]);}return _0x3d68a8[_0xe243('0x47')](_0x3ee0a7);}})[_0xe243('0x3c')](function(_0x2f95b0){if(_0x2f95b0){return _0x2f95b0?{'count':_0x1fcbc2,'rows':_0x2f95b0}:null;}})[_0xe243('0x3c')](respondWithResult(_0x810ba3,null))['catch'](handleError(_0x810ba3,null));};exports[_0xe243('0x4a')]=function(_0x26da2b,_0x19fd1f,_0xf22327){var _0x51ccfc={};var _0x1d8cbd={};var _0x468f9c;var _0x1a924d;return db['FreshsalesConfiguration'][_0xe243('0x48')]({'where':{'id':_0x26da2b[_0xe243('0x41')]['id']}})[_0xe243('0x3c')](handleEntityNotFound(_0x19fd1f,null))[_0xe243('0x3c')](function(_0x50fcd2){if(_0x50fcd2){_0x468f9c=_0x50fcd2;_0x1d8cbd[_0xe243('0x2e')]=_[_0xe243('0x2b')](db[_0xe243('0x49')]['rawAttributes']);_0x1d8cbd[_0xe243('0x2a')]=_[_0xe243('0x2b')](_0x26da2b[_0xe243('0x2a')]);_0x1d8cbd[_0xe243('0x2c')]=_[_0xe243('0x2d')](_0x1d8cbd[_0xe243('0x2e')],_0x1d8cbd[_0xe243('0x2a')]);_0x51ccfc[_0xe243('0x2f')]=_['intersection'](_0x1d8cbd[_0xe243('0x2e')],qs['fields'](_0x26da2b[_0xe243('0x2a')][_0xe243('0x30')]));_0x51ccfc['attributes']=_0x51ccfc['attributes'][_0xe243('0x31')]?_0x51ccfc[_0xe243('0x2f')]:_0x1d8cbd[_0xe243('0x2e')];_0x51ccfc[_0xe243('0x34')]=qs['sort'](_0x26da2b[_0xe243('0x2a')][_0xe243('0x35')]);_0x51ccfc[_0xe243('0x36')]=qs[_0xe243('0x2c')](_[_0xe243('0x37')](_0x26da2b[_0xe243('0x2a')],_0x1d8cbd[_0xe243('0x2c')]));if(_0x26da2b[_0xe243('0x2a')][_0xe243('0x38')]){_0x51ccfc[_0xe243('0x36')]=_[_0xe243('0x39')](_0x51ccfc[_0xe243('0x36')],{'$or':_['map'](_0x51ccfc[_0xe243('0x2f')],function(_0x5636e5){var _0x14b8a2={};_0x14b8a2[_0x5636e5]={'$like':'%'+_0x26da2b[_0xe243('0x2a')]['filter']+'%'};return _0x14b8a2;})});}_0x51ccfc=_[_0xe243('0x39')]({},_0x51ccfc,_0x26da2b[_0xe243('0x42')]);return _0x468f9c[_0xe243('0x4a')](_0x51ccfc);}})[_0xe243('0x3c')](function(_0x2b7b8a){if(_0x2b7b8a){_0x1a924d=_0x2b7b8a[_0xe243('0x31')];if(!_0x26da2b['query'][_0xe243('0x32')](_0xe243('0x33'))){_0x51ccfc[_0xe243('0x1a')]=qs[_0xe243('0x1a')](_0x26da2b[_0xe243('0x2a')][_0xe243('0x1a')]);_0x51ccfc[_0xe243('0x1b')]=qs['offset'](_0x26da2b[_0xe243('0x2a')][_0xe243('0x1b')]);}return _0x468f9c[_0xe243('0x4a')](_0x51ccfc);}})[_0xe243('0x3c')](function(_0x2bcf4b){if(_0x2bcf4b){return _0x2bcf4b?{'count':_0x1a924d,'rows':_0x2bcf4b}:null;}})[_0xe243('0x3c')](respondWithResult(_0x19fd1f,null))[_0xe243('0x3f')](handleError(_0x19fd1f,null));};exports[_0xe243('0x4b')]=function(_0x2a187d,_0x39fef8,_0x3a8bb1){var _0x4aedcf={};var _0x4019a5={};var _0x534726;var _0x90b8e1;return db[_0xe243('0x25')][_0xe243('0x48')]({'where':{'id':_0x2a187d[_0xe243('0x41')]['id']}})[_0xe243('0x3c')](handleEntityNotFound(_0x39fef8,null))[_0xe243('0x3c')](function(_0x5f2b0e){if(_0x5f2b0e){_0x534726=_0x5f2b0e;_0x4019a5[_0xe243('0x2e')]=_[_0xe243('0x2b')](db[_0xe243('0x49')]['rawAttributes']);_0x4019a5[_0xe243('0x2a')]=_[_0xe243('0x2b')](_0x2a187d[_0xe243('0x2a')]);_0x4019a5[_0xe243('0x2c')]=_[_0xe243('0x2d')](_0x4019a5['model'],_0x4019a5[_0xe243('0x2a')]);_0x4aedcf[_0xe243('0x2f')]=_[_0xe243('0x2d')](_0x4019a5['model'],qs[_0xe243('0x30')](_0x2a187d['query']['fields']));_0x4aedcf['attributes']=_0x4aedcf[_0xe243('0x2f')][_0xe243('0x31')]?_0x4aedcf[_0xe243('0x2f')]:_0x4019a5[_0xe243('0x2e')];_0x4aedcf[_0xe243('0x34')]=qs[_0xe243('0x35')](_0x2a187d['query'][_0xe243('0x35')]);_0x4aedcf[_0xe243('0x36')]=qs[_0xe243('0x2c')](_[_0xe243('0x37')](_0x2a187d['query'],_0x4019a5[_0xe243('0x2c')]));if(_0x2a187d['query'][_0xe243('0x38')]){_0x4aedcf[_0xe243('0x36')]=_[_0xe243('0x39')](_0x4aedcf[_0xe243('0x36')],{'$or':_[_0xe243('0x24')](_0x4aedcf['attributes'],function(_0x43b5f5){var _0xab54ae={};_0xab54ae[_0x43b5f5]={'$like':'%'+_0x2a187d[_0xe243('0x2a')][_0xe243('0x38')]+'%'};return _0xab54ae;})});}_0x4aedcf=_['merge']({},_0x4aedcf,_0x2a187d[_0xe243('0x42')]);return _0x534726[_0xe243('0x4b')](_0x4aedcf);}})[_0xe243('0x3c')](function(_0x2ec20b){if(_0x2ec20b){_0x90b8e1=_0x2ec20b[_0xe243('0x31')];if(!_0x2a187d[_0xe243('0x2a')][_0xe243('0x32')](_0xe243('0x33'))){_0x4aedcf[_0xe243('0x1a')]=qs[_0xe243('0x1a')](_0x2a187d[_0xe243('0x2a')]['limit']);_0x4aedcf['offset']=qs[_0xe243('0x1b')](_0x2a187d[_0xe243('0x2a')][_0xe243('0x1b')]);}return _0x534726[_0xe243('0x4b')](_0x4aedcf);}})['then'](function(_0x1ad423){if(_0x1ad423){return _0x1ad423?{'count':_0x90b8e1,'rows':_0x1ad423}:null;}})[_0xe243('0x3c')](respondWithResult(_0x39fef8,null))[_0xe243('0x3f')](handleError(_0x39fef8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 719b058..999d961 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 _0x9c32=['api','bluebird','request-promise','rimraf','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x5c1500,_0x883c8e){var _0x4c7c33=function(_0x4c8f71){while(--_0x4c8f71){_0x5c1500['push'](_0x5c1500['shift']());}};_0x4c7c33(++_0x883c8e);}(_0x9c32,0xd9));var _0x29c3=function(_0x31abb6,_0x540bcf){_0x31abb6=_0x31abb6-0x0;var _0xcbbea2=_0x9c32[_0x31abb6];return _0xcbbea2;};'use strict';var _=require(_0x29c3('0x0'));var util=require(_0x29c3('0x1'));var logger=require(_0x29c3('0x2'))(_0x29c3('0x3'));var moment=require('moment');var BPromise=require(_0x29c3('0x4'));var rp=require(_0x29c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x29c3('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x1c6090,_0x54ebe4){return _0x1c6090[_0x29c3('0x7')](_0x29c3('0x8'),attributes,{'tableName':_0x29c3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9a0=['exports','define','int_freshsales_configurations','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3b40ac,_0x49cdc7){var _0x2c6b8a=function(_0x36f61e){while(--_0x36f61e){_0x3b40ac['push'](_0x3b40ac['shift']());}};_0x2c6b8a(++_0x49cdc7);}(_0xf9a0,0x1a7));var _0x0f9a=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xf9a0[_0x489b87];return _0x1823b6;};'use strict';var _=require(_0x0f9a('0x0'));var util=require(_0x0f9a('0x1'));var logger=require(_0x0f9a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0f9a('0x3'));var rp=require(_0x0f9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f9a('0x5'));var config=require(_0x0f9a('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x0f9a('0x7')]=function(_0x22824a,_0x259325){return _0x22824a[_0x0f9a('0x8')]('FreshsalesConfiguration',attributes,{'tableName':_0x0f9a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index d223b7f..c2e6180 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 _0xcc6e=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','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','error','code','message','result','catch'];(function(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0xcc6e,0xfa));var _0xecc6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc6e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xecc6('0x0'));var util=require(_0xecc6('0x1'));var moment=require('moment');var BPromise=require(_0xecc6('0x2'));var rs=require(_0xecc6('0x3'));var fs=require('fs');var Redis=require(_0xecc6('0x4'));var db=require(_0xecc6('0x5'))['db'];var utils=require(_0xecc6('0x6'));var logger=require(_0xecc6('0x7'))(_0xecc6('0x8'));var config=require(_0xecc6('0x9'));var jayson=require(_0xecc6('0xa'));var client=jayson[_0xecc6('0xb')][_0xecc6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x325f60,_0x30f04a,_0x566f8e){return new BPromise(function(_0x3b5498,_0xbcb54b){return client[_0xecc6('0xd')](_0x325f60,_0x566f8e)[_0xecc6('0xe')](function(_0xa196da){logger[_0xecc6('0xf')](_0xecc6('0x10'),_0x30f04a,_0xecc6('0x11'));logger[_0xecc6('0x12')](_0xecc6('0x13'),_0x30f04a,_0xecc6('0x11'),JSON['stringify'](_0xa196da));if(_0xa196da[_0xecc6('0x14')]){if(_0xa196da[_0xecc6('0x14')][_0xecc6('0x15')]===0x1f4){logger[_0xecc6('0x14')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x30f04a,_0xa196da[_0xecc6('0x14')][_0xecc6('0x16')]);return _0xbcb54b(_0xa196da[_0xecc6('0x14')]['message']);}logger[_0xecc6('0x14')](_0xecc6('0x10'),_0x30f04a,_0xa196da[_0xecc6('0x14')]['message']);return _0x3b5498(_0xa196da[_0xecc6('0x14')][_0xecc6('0x16')]);}else{logger['info'](_0xecc6('0x10'),_0x30f04a,'request\x20sent');_0x3b5498(_0xa196da[_0xecc6('0x17')][_0xecc6('0x16')]);}})[_0xecc6('0x18')](function(_0x1ee828){logger['error'](_0xecc6('0x10'),_0x30f04a,_0x1ee828);_0xbcb54b(_0x1ee828);});});} \ No newline at end of file +var _0x2f3c=['jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xe58ae2,_0x30a065){var _0x369b69=function(_0xa6a029){while(--_0xa6a029){_0xe58ae2['push'](_0xe58ae2['shift']());}};_0x369b69(++_0x30a065);}(_0x2f3c,0xd4));var _0xc2f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2f3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc2f3('0x1'));var rs=require(_0xc2f3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc2f3('0x3'))['db'];var utils=require(_0xc2f3('0x4'));var logger=require(_0xc2f3('0x5'))(_0xc2f3('0x6'));var config=require(_0xc2f3('0x7'));var jayson=require(_0xc2f3('0x8'));var client=jayson[_0xc2f3('0x9')][_0xc2f3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59289b,_0x53555b,_0x12e50d){return new BPromise(function(_0x5aa9d8,_0x525eb1){return client['request'](_0x59289b,_0x12e50d)[_0xc2f3('0xb')](function(_0x3c5333){logger[_0xc2f3('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x53555b,_0xc2f3('0xd'));logger[_0xc2f3('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x53555b,_0xc2f3('0xd'),JSON[_0xc2f3('0xf')](_0x3c5333));if(_0x3c5333['error']){if(_0x3c5333[_0xc2f3('0x10')][_0xc2f3('0x11')]===0x1f4){logger[_0xc2f3('0x10')](_0xc2f3('0x12'),_0x53555b,_0x3c5333[_0xc2f3('0x10')][_0xc2f3('0x13')]);return _0x525eb1(_0x3c5333[_0xc2f3('0x10')][_0xc2f3('0x13')]);}logger[_0xc2f3('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x53555b,_0x3c5333['error'][_0xc2f3('0x13')]);return _0x5aa9d8(_0x3c5333[_0xc2f3('0x10')][_0xc2f3('0x13')]);}else{logger[_0xc2f3('0xc')](_0xc2f3('0x12'),_0x53555b,_0xc2f3('0xd'));_0x5aa9d8(_0x3c5333[_0xc2f3('0x14')][_0xc2f3('0x13')]);}})[_0xc2f3('0x15')](function(_0x11e4ed){logger[_0xc2f3('0x10')](_0xc2f3('0x12'),_0x53555b,_0x11e4ed);_0x525eb1(_0x11e4ed);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 7593d94..9949a93 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 _0x3e25=['./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e25,0x14f));var _0x53e2=function(_0x30ead9,_0x229cdc){_0x30ead9=_0x30ead9-0x0;var _0x3ab4a9=_0x3e25[_0x30ead9];return _0x3ab4a9;};'use strict';var multer=require(_0x53e2('0x0'));var util=require(_0x53e2('0x1'));var path=require(_0x53e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x53e2('0x3'));var router=express['Router']();var fs_extra=require(_0x53e2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x53e2('0x5'));var config=require(_0x53e2('0x6'));var controller=require(_0x53e2('0x7'));router[_0x53e2('0x8')]('/',auth[_0x53e2('0x9')](),controller[_0x53e2('0xa')]);router[_0x53e2('0x8')](_0x53e2('0xb'),auth[_0x53e2('0x9')](),controller[_0x53e2('0xc')]);router[_0x53e2('0xd')]('/',auth[_0x53e2('0x9')](),controller[_0x53e2('0xe')]);router[_0x53e2('0xf')](_0x53e2('0xb'),auth[_0x53e2('0x9')](),controller[_0x53e2('0x10')]);router[_0x53e2('0x11')]('/:id',auth[_0x53e2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9234=['/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','isAuthenticated','index'];(function(_0x3384a5,_0x43d89d){var _0x4ba987=function(_0xa12044){while(--_0xa12044){_0x3384a5['push'](_0x3384a5['shift']());}};_0x4ba987(++_0x43d89d);}(_0x9234,0x1bd));var _0x4923=function(_0x32cf96,_0x7502d5){_0x32cf96=_0x32cf96-0x0;var _0x125cc1=_0x9234[_0x32cf96];return _0x125cc1;};'use strict';var multer=require(_0x4923('0x0'));var util=require('util');var path=require(_0x4923('0x1'));var timeout=require(_0x4923('0x2'));var express=require(_0x4923('0x3'));var router=express[_0x4923('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4923('0x5'));var interaction=require(_0x4923('0x6'));var config=require('../../config/environment');var controller=require(_0x4923('0x7'));router[_0x4923('0x8')]('/',auth[_0x4923('0x9')](),controller[_0x4923('0xa')]);router[_0x4923('0x8')](_0x4923('0xb'),auth[_0x4923('0x9')](),controller['show']);router[_0x4923('0xc')]('/',auth['isAuthenticated'](),controller[_0x4923('0xd')]);router[_0x4923('0xe')](_0x4923('0xb'),auth['isAuthenticated'](),controller[_0x4923('0xf')]);router[_0x4923('0x10')](_0x4923('0xb'),auth[_0x4923('0x9')](),controller[_0x4923('0x11')]);module[_0x4923('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index ad3d7b5..7ed1ae7 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 _0x108c=['variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','string'];(function(_0x1173d9,_0xf7cd90){var _0x4cec13=function(_0x10c0e0){while(--_0x10c0e0){_0x1173d9['push'](_0x1173d9['shift']());}};_0x4cec13(++_0xf7cd90);}(_0x108c,0x1bd));var _0xc108=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x108c[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xc108('0x0'));module[_0xc108('0x1')]={'type':{'type':Sequelize['ENUM'](_0xc108('0x2'),_0xc108('0x3'),_0xc108('0x4'),_0xc108('0x5'),'picklist'),'defaultValue':_0xc108('0x2')},'content':{'type':Sequelize[_0xc108('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xc108('0x2'),_0xc108('0x3'),_0xc108('0x4'))},'keyContent':{'type':Sequelize[_0xc108('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc108('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbba0=['variable','customVariable','sequelize','exports','ENUM','string','keyValue','picklist','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xbba0,0x110));var _0x0bba=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xbba0[_0x47aa64];return _0x549c7a;};'use strict';var Sequelize=require(_0x0bba('0x0'));module[_0x0bba('0x1')]={'type':{'type':Sequelize[_0x0bba('0x2')](_0x0bba('0x3'),'variable','customVariable',_0x0bba('0x4'),_0x0bba('0x5')),'defaultValue':_0x0bba('0x3')},'content':{'type':Sequelize[_0x0bba('0x6')]},'key':{'type':Sequelize[_0x0bba('0x6')]},'keyType':{'type':Sequelize[_0x0bba('0x2')](_0x0bba('0x3'),_0x0bba('0x7'),_0x0bba('0x8'))},'keyContent':{'type':Sequelize[_0x0bba('0x6')]},'idField':{'type':Sequelize[_0x0bba('0x6')]},'nameField':{'type':Sequelize[_0x0bba('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index b6138f5..3e9ee6b 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 _0xa342=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','offset','count','Content-Range','reject','save','update','then','end','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','include','findAll','params','includeAll','options','catch','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x4bd173,_0x87b895){var _0x7c02c9=function(_0xc23606){while(--_0xc23606){_0x4bd173['push'](_0x4bd173['shift']());}};_0x7c02c9(++_0x87b895);}(_0xa342,0x1b8));var _0x2a34=function(_0x302b96,_0x35fc32){_0x302b96=_0x302b96-0x0;var _0x1e3320=_0xa342[_0x302b96];return _0x1e3320;};'use strict';var emlformat=require(_0x2a34('0x0'));var rimraf=require(_0x2a34('0x1'));var zipdir=require(_0x2a34('0x2'));var jsonpatch=require(_0x2a34('0x3'));var rp=require(_0x2a34('0x4'));var moment=require(_0x2a34('0x5'));var BPromise=require(_0x2a34('0x6'));var Mustache=require(_0x2a34('0x7'));var util=require(_0x2a34('0x8'));var path=require(_0x2a34('0x9'));var sox=require(_0x2a34('0xa'));var csv=require(_0x2a34('0xb'));var ejs=require(_0x2a34('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a34('0xd'));var squel=require(_0x2a34('0xe'));var crypto=require(_0x2a34('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2a34('0x10'));var Papa=require(_0x2a34('0x11'));var Redis=require(_0x2a34('0x12'));var authService=require(_0x2a34('0x13'));var qs=require(_0x2a34('0x14'));var as=require(_0x2a34('0x15'));var hardwareService=require(_0x2a34('0x16'));var logger=require(_0x2a34('0x17'))('api');var utils=require(_0x2a34('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x2a34('0x19'));var db=require(_0x2a34('0x1a'))['db'];function respondWithStatusCode(_0x31d748,_0x1778ea){_0x1778ea=_0x1778ea||0xcc;return function(_0x3b22d3){if(_0x3b22d3){return _0x31d748[_0x2a34('0x1b')](_0x1778ea);}return _0x31d748[_0x2a34('0x1c')](_0x1778ea)['end']();};}function respondWithResult(_0x5cee24,_0x18b55e){_0x18b55e=_0x18b55e||0xc8;return function(_0x5b1c16){if(_0x5b1c16){return _0x5cee24[_0x2a34('0x1c')](_0x18b55e)[_0x2a34('0x1d')](_0x5b1c16);}};}function respondWithFilteredResult(_0x3672d4,_0xb3f393){return function(_0x3d7054){if(_0x3d7054){var _0x53ddb7=typeof _0xb3f393['offset']===_0x2a34('0x1e')&&typeof _0xb3f393[_0x2a34('0x1f')]==='undefined';var _0x78b6cb=_0x3d7054['count'];var _0x10960f=_0x53ddb7?0x0:_0xb3f393[_0x2a34('0x20')];var _0x3ef167=_0x53ddb7?_0x3d7054[_0x2a34('0x21')]:_0xb3f393['offset']+_0xb3f393[_0x2a34('0x1f')];var _0x18caa4;if(_0x3ef167>=_0x78b6cb){_0x3ef167=_0x78b6cb;_0x18caa4=0xc8;}else{_0x18caa4=0xce;}_0x3672d4[_0x2a34('0x1c')](_0x18caa4);return _0x3672d4['set'](_0x2a34('0x22'),_0x10960f+'-'+_0x3ef167+'/'+_0x78b6cb)[_0x2a34('0x1d')](_0x3d7054);}return null;};}function patchUpdates(_0x47787e){return function(_0x1fa7c0){try{jsonpatch['apply'](_0x1fa7c0,_0x47787e,!![]);}catch(_0x33f77b){return BPromise[_0x2a34('0x23')](_0x33f77b);}return _0x1fa7c0[_0x2a34('0x24')]();};}function saveUpdates(_0x34cacd,_0x3d4b43){return function(_0x42152){if(_0x42152){return _0x42152[_0x2a34('0x25')](_0x34cacd)[_0x2a34('0x26')](function(_0x1b1e85){return _0x1b1e85;});}return null;};}function removeEntity(_0x8ffbc7,_0x46b358){return function(_0x5a3ae1){if(_0x5a3ae1){return _0x5a3ae1['destroy']()[_0x2a34('0x26')](function(){_0x8ffbc7[_0x2a34('0x1c')](0xcc)[_0x2a34('0x27')]();});}};}function handleEntityNotFound(_0x138a30,_0x752ebe){return function(_0x312781){if(!_0x312781){_0x138a30[_0x2a34('0x1b')](0x194);}return _0x312781;};}function handleError(_0x4e7865,_0x2814de){_0x2814de=_0x2814de||0x1f4;return function(_0xd4865){logger[_0x2a34('0x28')](_0xd4865['stack']);if(_0xd4865[_0x2a34('0x29')]){delete _0xd4865[_0x2a34('0x29')];}_0x4e7865['status'](_0x2814de)[_0x2a34('0x2a')](_0xd4865);};}exports[_0x2a34('0x2b')]=function(_0x553783,_0x3188fa){var _0x1e753a={},_0x2382e0={},_0xba65a5={'count':0x0,'rows':[]};var _0x3073af=_[_0x2a34('0x2c')](db[_0x2a34('0x2d')][_0x2a34('0x2e')],function(_0x3af01f){return{'name':_0x3af01f[_0x2a34('0x2f')],'type':_0x3af01f[_0x2a34('0x30')][_0x2a34('0x31')]};});_0x2382e0[_0x2a34('0x32')]=_[_0x2a34('0x2c')](_0x3073af,_0x2a34('0x29'));_0x2382e0['query']=_[_0x2a34('0x33')](_0x553783[_0x2a34('0x34')]);_0x2382e0[_0x2a34('0x35')]=_[_0x2a34('0x36')](_0x2382e0[_0x2a34('0x32')],_0x2382e0[_0x2a34('0x34')]);_0x1e753a['attributes']=_[_0x2a34('0x36')](_0x2382e0[_0x2a34('0x32')],qs[_0x2a34('0x37')](_0x553783[_0x2a34('0x34')][_0x2a34('0x37')]));_0x1e753a[_0x2a34('0x38')]=_0x1e753a[_0x2a34('0x38')][_0x2a34('0x39')]?_0x1e753a[_0x2a34('0x38')]:_0x2382e0[_0x2a34('0x32')];if(!_0x553783['query'][_0x2a34('0x3a')](_0x2a34('0x3b'))){_0x1e753a['limit']=qs['limit'](_0x553783[_0x2a34('0x34')][_0x2a34('0x1f')]);_0x1e753a[_0x2a34('0x20')]=qs[_0x2a34('0x20')](_0x553783[_0x2a34('0x34')][_0x2a34('0x20')]);}_0x1e753a['order']=qs['sort'](_0x553783['query'][_0x2a34('0x3c')]);_0x1e753a[_0x2a34('0x3d')]=qs[_0x2a34('0x35')](_[_0x2a34('0x3e')](_0x553783[_0x2a34('0x34')],_0x2382e0[_0x2a34('0x35')]),_0x3073af);if(_0x553783[_0x2a34('0x34')][_0x2a34('0x3f')]){_0x1e753a[_0x2a34('0x3d')]=_[_0x2a34('0x40')](_0x1e753a[_0x2a34('0x3d')],{'$or':_[_0x2a34('0x2c')](_0x3073af,function(_0x4c05fe){if(_0x4c05fe[_0x2a34('0x30')]!==_0x2a34('0x41')){var _0x45b57e={};_0x45b57e[_0x4c05fe[_0x2a34('0x29')]]={'$like':'%'+_0x553783[_0x2a34('0x34')][_0x2a34('0x3f')]+'%'};return _0x45b57e;}})});}_0x1e753a=_[_0x2a34('0x40')]({},_0x1e753a,_0x553783['options']);var _0x755282={'where':_0x1e753a[_0x2a34('0x3d')]};return db['FreshsalesField'][_0x2a34('0x21')](_0x755282)['then'](function(_0x4437fb){_0xba65a5[_0x2a34('0x21')]=_0x4437fb;if(_0x553783['query']['includeAll']){_0x1e753a[_0x2a34('0x42')]=[{'all':!![]}];}return db[_0x2a34('0x2d')][_0x2a34('0x43')](_0x1e753a);})['then'](function(_0x482975){_0xba65a5['rows']=_0x482975;return _0xba65a5;})[_0x2a34('0x26')](respondWithFilteredResult(_0x3188fa,_0x1e753a))['catch'](handleError(_0x3188fa,null));};exports['show']=function(_0x3399ef,_0x13216b){var _0x43b938={'raw':!![],'where':{'id':_0x3399ef[_0x2a34('0x44')]['id']}},_0x28f33b={};_0x28f33b[_0x2a34('0x32')]=_[_0x2a34('0x33')](db['FreshsalesField']['rawAttributes']);_0x28f33b[_0x2a34('0x34')]=_[_0x2a34('0x33')](_0x3399ef['query']);_0x28f33b['filters']=_['intersection'](_0x28f33b[_0x2a34('0x32')],_0x28f33b['query']);_0x43b938['attributes']=_[_0x2a34('0x36')](_0x28f33b[_0x2a34('0x32')],qs[_0x2a34('0x37')](_0x3399ef['query'][_0x2a34('0x37')]));_0x43b938[_0x2a34('0x38')]=_0x43b938[_0x2a34('0x38')][_0x2a34('0x39')]?_0x43b938[_0x2a34('0x38')]:_0x28f33b['model'];if(_0x3399ef[_0x2a34('0x34')][_0x2a34('0x45')]){_0x43b938[_0x2a34('0x42')]=[{'all':!![]}];}_0x43b938=_[_0x2a34('0x40')]({},_0x43b938,_0x3399ef[_0x2a34('0x46')]);return db[_0x2a34('0x2d')]['find'](_0x43b938)['then'](handleEntityNotFound(_0x13216b,null))[_0x2a34('0x26')](respondWithResult(_0x13216b,null))[_0x2a34('0x47')](handleError(_0x13216b,null));};exports['create']=function(_0x459327,_0x1a1b25){return db[_0x2a34('0x2d')][_0x2a34('0x48')](_0x459327[_0x2a34('0x49')],{})[_0x2a34('0x26')](respondWithResult(_0x1a1b25,0xc9))['catch'](handleError(_0x1a1b25,null));};exports[_0x2a34('0x25')]=function(_0x51c5ec,_0x38cf8f){if(_0x51c5ec[_0x2a34('0x49')]['id']){delete _0x51c5ec['body']['id'];}return db['FreshsalesField'][_0x2a34('0x4a')]({'where':{'id':_0x51c5ec[_0x2a34('0x44')]['id']}})['then'](handleEntityNotFound(_0x38cf8f,null))[_0x2a34('0x26')](saveUpdates(_0x51c5ec[_0x2a34('0x49')],null))[_0x2a34('0x26')](respondWithResult(_0x38cf8f,null))[_0x2a34('0x47')](handleError(_0x38cf8f,null));};exports[_0x2a34('0x4b')]=function(_0x49efc6,_0x1eb5bb){return db[_0x2a34('0x2d')][_0x2a34('0x4a')]({'where':{'id':_0x49efc6[_0x2a34('0x44')]['id']}})[_0x2a34('0x26')](handleEntityNotFound(_0x1eb5bb,null))[_0x2a34('0x26')](removeEntity(_0x1eb5bb,null))[_0x2a34('0x47')](handleError(_0x1eb5bb,null));}; \ No newline at end of file +var _0xfe28=['hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','FreshsalesField','fieldName','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0xfe28,0x148));var _0x8fe2=function(_0x5d0e2e,_0x2bc4b8){_0x5d0e2e=_0x5d0e2e-0x0;var _0x337fa5=_0xfe28[_0x5d0e2e];return _0x337fa5;};'use strict';var emlformat=require(_0x8fe2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8fe2('0x1'));var jsonpatch=require(_0x8fe2('0x2'));var rp=require(_0x8fe2('0x3'));var moment=require(_0x8fe2('0x4'));var BPromise=require(_0x8fe2('0x5'));var Mustache=require(_0x8fe2('0x6'));var util=require(_0x8fe2('0x7'));var path=require(_0x8fe2('0x8'));var sox=require(_0x8fe2('0x9'));var csv=require(_0x8fe2('0xa'));var ejs=require(_0x8fe2('0xb'));var fs=require('fs');var fs_extra=require(_0x8fe2('0xc'));var _=require(_0x8fe2('0xd'));var squel=require(_0x8fe2('0xe'));var crypto=require(_0x8fe2('0xf'));var jsforce=require(_0x8fe2('0x10'));var deskjs=require(_0x8fe2('0x11'));var toCsv=require('to-csv');var querystring=require(_0x8fe2('0x12'));var Papa=require(_0x8fe2('0x13'));var Redis=require('ioredis');var authService=require(_0x8fe2('0x14'));var qs=require(_0x8fe2('0x15'));var as=require(_0x8fe2('0x16'));var hardwareService=require(_0x8fe2('0x17'));var logger=require(_0x8fe2('0x18'))('api');var utils=require(_0x8fe2('0x19'));var config=require(_0x8fe2('0x1a'));var licenseUtil=require(_0x8fe2('0x1b'));var db=require(_0x8fe2('0x1c'))['db'];function respondWithStatusCode(_0x30e5fb,_0x51cf5b){_0x51cf5b=_0x51cf5b||0xcc;return function(_0x1d6f03){if(_0x1d6f03){return _0x30e5fb[_0x8fe2('0x1d')](_0x51cf5b);}return _0x30e5fb[_0x8fe2('0x1e')](_0x51cf5b)['end']();};}function respondWithResult(_0x20ef38,_0x3c726f){_0x3c726f=_0x3c726f||0xc8;return function(_0x4bcd91){if(_0x4bcd91){return _0x20ef38[_0x8fe2('0x1e')](_0x3c726f)[_0x8fe2('0x1f')](_0x4bcd91);}};}function respondWithFilteredResult(_0x3ff201,_0x39b955){return function(_0x537f3a){if(_0x537f3a){var _0x24dc49=typeof _0x39b955['offset']===_0x8fe2('0x20')&&typeof _0x39b955['limit']===_0x8fe2('0x20');var _0x1b0f5e=_0x537f3a['count'];var _0x4d695f=_0x24dc49?0x0:_0x39b955['offset'];var _0x56479b=_0x24dc49?_0x537f3a[_0x8fe2('0x21')]:_0x39b955['offset']+_0x39b955[_0x8fe2('0x22')];var _0x387463;if(_0x56479b>=_0x1b0f5e){_0x56479b=_0x1b0f5e;_0x387463=0xc8;}else{_0x387463=0xce;}_0x3ff201[_0x8fe2('0x1e')](_0x387463);return _0x3ff201[_0x8fe2('0x23')](_0x8fe2('0x24'),_0x4d695f+'-'+_0x56479b+'/'+_0x1b0f5e)[_0x8fe2('0x1f')](_0x537f3a);}return null;};}function patchUpdates(_0x428e8b){return function(_0x4a6f2d){try{jsonpatch[_0x8fe2('0x25')](_0x4a6f2d,_0x428e8b,!![]);}catch(_0x13b4a6){return BPromise[_0x8fe2('0x26')](_0x13b4a6);}return _0x4a6f2d['save']();};}function saveUpdates(_0x38e3a9,_0x2d8a2c){return function(_0x3f2d69){if(_0x3f2d69){return _0x3f2d69[_0x8fe2('0x27')](_0x38e3a9)[_0x8fe2('0x28')](function(_0x42040b){return _0x42040b;});}return null;};}function removeEntity(_0x112ed0,_0x15854b){return function(_0x546567){if(_0x546567){return _0x546567[_0x8fe2('0x29')]()['then'](function(){_0x112ed0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50bd5b,_0x44b0f2){return function(_0x220717){if(!_0x220717){_0x50bd5b['sendStatus'](0x194);}return _0x220717;};}function handleError(_0x496ba6,_0x2d474a){_0x2d474a=_0x2d474a||0x1f4;return function(_0x416d09){logger[_0x8fe2('0x2a')](_0x416d09[_0x8fe2('0x2b')]);if(_0x416d09[_0x8fe2('0x2c')]){delete _0x416d09['name'];}_0x496ba6['status'](_0x2d474a)['send'](_0x416d09);};}exports[_0x8fe2('0x2d')]=function(_0x42929c,_0x150b54){var _0x4af0bc={},_0x43a180={},_0x4a6617={'count':0x0,'rows':[]};var _0x559bb0=_[_0x8fe2('0x2e')](db[_0x8fe2('0x2f')]['rawAttributes'],function(_0x4fe0ca){return{'name':_0x4fe0ca[_0x8fe2('0x30')],'type':_0x4fe0ca['type'][_0x8fe2('0x31')]};});_0x43a180[_0x8fe2('0x32')]=_[_0x8fe2('0x2e')](_0x559bb0,_0x8fe2('0x2c'));_0x43a180[_0x8fe2('0x33')]=_[_0x8fe2('0x34')](_0x42929c[_0x8fe2('0x33')]);_0x43a180[_0x8fe2('0x35')]=_['intersection'](_0x43a180[_0x8fe2('0x32')],_0x43a180[_0x8fe2('0x33')]);_0x4af0bc[_0x8fe2('0x36')]=_[_0x8fe2('0x37')](_0x43a180[_0x8fe2('0x32')],qs[_0x8fe2('0x38')](_0x42929c[_0x8fe2('0x33')]['fields']));_0x4af0bc[_0x8fe2('0x36')]=_0x4af0bc[_0x8fe2('0x36')]['length']?_0x4af0bc['attributes']:_0x43a180[_0x8fe2('0x32')];if(!_0x42929c[_0x8fe2('0x33')][_0x8fe2('0x39')](_0x8fe2('0x3a'))){_0x4af0bc['limit']=qs[_0x8fe2('0x22')](_0x42929c[_0x8fe2('0x33')]['limit']);_0x4af0bc[_0x8fe2('0x3b')]=qs[_0x8fe2('0x3b')](_0x42929c[_0x8fe2('0x33')][_0x8fe2('0x3b')]);}_0x4af0bc[_0x8fe2('0x3c')]=qs[_0x8fe2('0x3d')](_0x42929c[_0x8fe2('0x33')][_0x8fe2('0x3d')]);_0x4af0bc[_0x8fe2('0x3e')]=qs['filters'](_['pick'](_0x42929c[_0x8fe2('0x33')],_0x43a180[_0x8fe2('0x35')]),_0x559bb0);if(_0x42929c[_0x8fe2('0x33')][_0x8fe2('0x3f')]){_0x4af0bc[_0x8fe2('0x3e')]=_[_0x8fe2('0x40')](_0x4af0bc[_0x8fe2('0x3e')],{'$or':_[_0x8fe2('0x2e')](_0x559bb0,function(_0x54e3ae){if(_0x54e3ae[_0x8fe2('0x41')]!==_0x8fe2('0x42')){var _0x5885b3={};_0x5885b3[_0x54e3ae[_0x8fe2('0x2c')]]={'$like':'%'+_0x42929c[_0x8fe2('0x33')][_0x8fe2('0x3f')]+'%'};return _0x5885b3;}})});}_0x4af0bc=_[_0x8fe2('0x40')]({},_0x4af0bc,_0x42929c[_0x8fe2('0x43')]);var _0x1976ed={'where':_0x4af0bc[_0x8fe2('0x3e')]};return db[_0x8fe2('0x2f')][_0x8fe2('0x21')](_0x1976ed)[_0x8fe2('0x28')](function(_0x3dcc12){_0x4a6617['count']=_0x3dcc12;if(_0x42929c['query']['includeAll']){_0x4af0bc[_0x8fe2('0x44')]=[{'all':!![]}];}return db[_0x8fe2('0x2f')][_0x8fe2('0x45')](_0x4af0bc);})[_0x8fe2('0x28')](function(_0x128fe5){_0x4a6617[_0x8fe2('0x46')]=_0x128fe5;return _0x4a6617;})['then'](respondWithFilteredResult(_0x150b54,_0x4af0bc))[_0x8fe2('0x47')](handleError(_0x150b54,null));};exports[_0x8fe2('0x48')]=function(_0x2e4afd,_0x17e36d){var _0xb3b1a8={'raw':!![],'where':{'id':_0x2e4afd[_0x8fe2('0x49')]['id']}},_0x80deb0={};_0x80deb0[_0x8fe2('0x32')]=_[_0x8fe2('0x34')](db[_0x8fe2('0x2f')]['rawAttributes']);_0x80deb0[_0x8fe2('0x33')]=_[_0x8fe2('0x34')](_0x2e4afd[_0x8fe2('0x33')]);_0x80deb0[_0x8fe2('0x35')]=_[_0x8fe2('0x37')](_0x80deb0[_0x8fe2('0x32')],_0x80deb0[_0x8fe2('0x33')]);_0xb3b1a8[_0x8fe2('0x36')]=_[_0x8fe2('0x37')](_0x80deb0[_0x8fe2('0x32')],qs[_0x8fe2('0x38')](_0x2e4afd['query'][_0x8fe2('0x38')]));_0xb3b1a8[_0x8fe2('0x36')]=_0xb3b1a8['attributes']['length']?_0xb3b1a8[_0x8fe2('0x36')]:_0x80deb0[_0x8fe2('0x32')];if(_0x2e4afd[_0x8fe2('0x33')]['includeAll']){_0xb3b1a8[_0x8fe2('0x44')]=[{'all':!![]}];}_0xb3b1a8=_[_0x8fe2('0x40')]({},_0xb3b1a8,_0x2e4afd['options']);return db[_0x8fe2('0x2f')][_0x8fe2('0x4a')](_0xb3b1a8)[_0x8fe2('0x28')](handleEntityNotFound(_0x17e36d,null))[_0x8fe2('0x28')](respondWithResult(_0x17e36d,null))[_0x8fe2('0x47')](handleError(_0x17e36d,null));};exports[_0x8fe2('0x4b')]=function(_0x40d9d7,_0xc11f5b){return db[_0x8fe2('0x2f')]['create'](_0x40d9d7[_0x8fe2('0x4c')],{})['then'](respondWithResult(_0xc11f5b,0xc9))['catch'](handleError(_0xc11f5b,null));};exports[_0x8fe2('0x27')]=function(_0x5ca21a,_0x318839){if(_0x5ca21a[_0x8fe2('0x4c')]['id']){delete _0x5ca21a['body']['id'];}return db[_0x8fe2('0x2f')][_0x8fe2('0x4a')]({'where':{'id':_0x5ca21a[_0x8fe2('0x49')]['id']}})['then'](handleEntityNotFound(_0x318839,null))[_0x8fe2('0x28')](saveUpdates(_0x5ca21a[_0x8fe2('0x4c')],null))[_0x8fe2('0x28')](respondWithResult(_0x318839,null))['catch'](handleError(_0x318839,null));};exports[_0x8fe2('0x29')]=function(_0x5e6aed,_0x5c9c41){return db[_0x8fe2('0x2f')]['find']({'where':{'id':_0x5e6aed[_0x8fe2('0x49')]['id']}})[_0x8fe2('0x28')](handleEntityNotFound(_0x5c9c41,null))[_0x8fe2('0x28')](removeEntity(_0x5c9c41,null))[_0x8fe2('0x47')](handleError(_0x5c9c41,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index d6b9900..0081916 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 _0x5523=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','int_freshsales_fields','idField','FieldId','../../config/logger'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x5523,0x137));var _0x3552=function(_0x2fde99,_0x583b4d){_0x2fde99=_0x2fde99-0x0;var _0x2d4dbd=_0x5523[_0x2fde99];return _0x2d4dbd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3552('0x0'))(_0x3552('0x1'));var moment=require(_0x3552('0x2'));var BPromise=require(_0x3552('0x3'));var rp=require(_0x3552('0x4'));var fs=require('fs');var path=require(_0x3552('0x5'));var rimraf=require(_0x3552('0x6'));var config=require(_0x3552('0x7'));var attributes=require(_0x3552('0x8'));module[_0x3552('0x9')]=function(_0x3225aa,_0x58385b){return _0x3225aa['define']('FreshsalesField',attributes,{'tableName':_0x3552('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x3552('0xb'),_0x3552('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcdd2=['int_freshsales_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x3acee8,_0x5f3924){var _0x5046cc=function(_0x338def){while(--_0x338def){_0x3acee8['push'](_0x3acee8['shift']());}};_0x5046cc(++_0x5f3924);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require(_0x2cdd('0x2'))(_0x2cdd('0x3'));var moment=require('moment');var BPromise=require(_0x2cdd('0x4'));var rp=require(_0x2cdd('0x5'));var fs=require('fs');var path=require(_0x2cdd('0x6'));var rimraf=require(_0x2cdd('0x7'));var config=require('../../config/environment');var attributes=require(_0x2cdd('0x8'));module[_0x2cdd('0x9')]=function(_0x5f3b53,_0x1cc1ac){return _0x5f3b53[_0x2cdd('0xa')](_0x2cdd('0xb'),attributes,{'tableName':_0x2cdd('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index f87de1c..9615153 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 _0x5496=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x275e8e,_0x245b70){var _0x474f66=function(_0x12bda4){while(--_0x12bda4){_0x275e8e['push'](_0x275e8e['shift']());}};_0x474f66(++_0x245b70);}(_0x5496,0x175));var _0x6549=function(_0x46a573,_0x14b23a){_0x46a573=_0x46a573-0x0;var _0x26f05a=_0x5496[_0x46a573];return _0x26f05a;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var moment=require(_0x6549('0x2'));var BPromise=require(_0x6549('0x3'));var rs=require(_0x6549('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6549('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6549('0x6'))(_0x6549('0x7'));var config=require(_0x6549('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6549('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1d8cea,_0x4fcffd,_0x1ca8fc){return new BPromise(function(_0x3442c3,_0x1ef2a6){return client['request'](_0x1d8cea,_0x1ca8fc)[_0x6549('0xa')](function(_0x35d008){logger[_0x6549('0xb')](_0x6549('0xc'),_0x4fcffd,_0x6549('0xd'));logger[_0x6549('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x4fcffd,'request\x20sent',JSON[_0x6549('0xf')](_0x35d008));if(_0x35d008[_0x6549('0x10')]){if(_0x35d008[_0x6549('0x10')][_0x6549('0x11')]===0x1f4){logger[_0x6549('0x10')]('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x35d008['error'][_0x6549('0x12')]);return _0x1ef2a6(_0x35d008[_0x6549('0x10')]['message']);}logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);return _0x3442c3(_0x35d008[_0x6549('0x10')][_0x6549('0x12')]);}else{logger['info']('FreshsalesField,\x20%s,\x20%s',_0x4fcffd,_0x6549('0xd'));_0x3442c3(_0x35d008[_0x6549('0x13')]['message']);}})[_0x6549('0x14')](function(_0x67acc0){logger[_0x6549('0x10')](_0x6549('0xc'),_0x4fcffd,_0x67acc0);_0x1ef2a6(_0x67acc0);});});} \ No newline at end of file +var _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0x170d36,_0x10c9a5){var _0x3e0af0=function(_0x318db2){while(--_0x318db2){_0x170d36['push'](_0x170d36['shift']());}};_0x3e0af0(++_0x10c9a5);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x12c77b,_0x54c711){_0x12c77b=_0x12c77b-0x0;var _0x46525e=_0xc1c6[_0x12c77b];return _0x46525e;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index c6d058f..9bc9078 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1bf6e6,_0x6c12a2){var _0x5afbe5=function(_0x2f3b58){while(--_0x2f3b58){_0x1bf6e6['push'](_0x1bf6e6['shift']());}};_0x5afbe5(++_0x6c12a2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x55449d,_0x2324b9){var _0x478b17=function(_0xadc97){while(--_0xadc97){_0x55449d['push'](_0x55449d['shift']());}};_0x478b17(++_0x2324b9);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 71a42db..3a6bb79 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 _0xa4e3=['ENUM','integrationTab','newTab','sequelize','STRING','username'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0xa4e3,0x129));var _0x3a4e=function(_0x4ba9a2,_0xa63060){_0x4ba9a2=_0x4ba9a2-0x0;var _0x44d7d3=_0xa4e3[_0x4ba9a2];return _0x44d7d3;};'use strict';var Sequelize=require(_0x3a4e('0x0'));module['exports']={'name':{'type':Sequelize[_0x3a4e('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3a4e('0x1')],'unique':_0x3a4e('0x2')},'remoteUri':{'type':Sequelize[_0x3a4e('0x1')]},'password':{'type':Sequelize[_0x3a4e('0x1')]},'clientId':{'type':Sequelize[_0x3a4e('0x1')]},'clientSecret':{'type':Sequelize[_0x3a4e('0x1')]},'securityToken':{'type':Sequelize[_0x3a4e('0x1')]},'serverUrl':{'type':Sequelize[_0x3a4e('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x3a4e('0x3')](_0x3a4e('0x4'),_0x3a4e('0x5')),'defaultValue':_0x3a4e('0x4')}}; \ No newline at end of file +var _0xa775=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x40a283,_0x351095){var _0x4abc38=function(_0x35ec66){while(--_0x35ec66){_0x40a283['push'](_0x40a283['shift']());}};_0x4abc38(++_0x351095);}(_0xa775,0xf6));var _0x5a77=function(_0xbdfd18,_0xf7038e){_0xbdfd18=_0xbdfd18-0x0;var _0x4cd8d2=_0xa775[_0xbdfd18];return _0x4cd8d2;};'use strict';var Sequelize=require(_0x5a77('0x0'));module['exports']={'name':{'type':Sequelize[_0x5a77('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x5a77('0x2')},'remoteUri':{'type':Sequelize[_0x5a77('0x1')]},'password':{'type':Sequelize[_0x5a77('0x1')]},'clientId':{'type':Sequelize[_0x5a77('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x5a77('0x1')]},'serverUrl':{'type':Sequelize[_0x5a77('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5a77('0x3')](_0x5a77('0x4'),_0x5a77('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index d680776..7d5bc89 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 _0xc9f4=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','catch','show','params','includeAll','find','create','body','update','getConfigurations','findOne','keys','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','Task','remoteUri','clientId','clientSecret','username','securityToken','slice','substring','Connection','login','concat','isNil','ticketType','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','textarea','phone','includes','custom','picklistValues','label','value','True','true','False','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xc9f4,0x1d9));var _0x4c9f=function(_0x410393,_0x3b790c){_0x410393=_0x410393-0x0;var _0x5c0be1=_0xc9f4[_0x410393];return _0x5c0be1;};'use strict';var emlformat=require(_0x4c9f('0x0'));var rimraf=require(_0x4c9f('0x1'));var zipdir=require(_0x4c9f('0x2'));var jsonpatch=require(_0x4c9f('0x3'));var rp=require(_0x4c9f('0x4'));var moment=require(_0x4c9f('0x5'));var BPromise=require(_0x4c9f('0x6'));var Mustache=require(_0x4c9f('0x7'));var util=require(_0x4c9f('0x8'));var path=require(_0x4c9f('0x9'));var sox=require(_0x4c9f('0xa'));var csv=require(_0x4c9f('0xb'));var ejs=require(_0x4c9f('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c9f('0xd'));var squel=require(_0x4c9f('0xe'));var crypto=require(_0x4c9f('0xf'));var jsforce=require(_0x4c9f('0x10'));var deskjs=require(_0x4c9f('0x11'));var toCsv=require(_0x4c9f('0xb'));var querystring=require(_0x4c9f('0x12'));var Papa=require('papaparse');var Redis=require(_0x4c9f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4c9f('0x14'));var as=require(_0x4c9f('0x15'));var hardwareService=require(_0x4c9f('0x16'));var logger=require(_0x4c9f('0x17'))(_0x4c9f('0x18'));var utils=require(_0x4c9f('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x4c9f('0x1a'));function respondWithStatusCode(_0x4fee5f,_0x54e462){_0x54e462=_0x54e462||0xcc;return function(_0x5187fa){if(_0x5187fa){return _0x4fee5f[_0x4c9f('0x1b')](_0x54e462);}return _0x4fee5f[_0x4c9f('0x1c')](_0x54e462)[_0x4c9f('0x1d')]();};}function respondWithResult(_0x2ac532,_0x46b873){_0x46b873=_0x46b873||0xc8;return function(_0x1b533b){if(_0x1b533b){return _0x2ac532[_0x4c9f('0x1c')](_0x46b873)[_0x4c9f('0x1e')](_0x1b533b);}};}function respondWithFilteredResult(_0x35edfb,_0xc3bb9d){return function(_0x147bea){if(_0x147bea){var _0xd89ea6=typeof _0xc3bb9d[_0x4c9f('0x1f')]===_0x4c9f('0x20')&&typeof _0xc3bb9d[_0x4c9f('0x21')]==='undefined';var _0x23faf2=_0x147bea[_0x4c9f('0x22')];var _0x3105c4=_0xd89ea6?0x0:_0xc3bb9d[_0x4c9f('0x1f')];var _0x1c0efc=_0xd89ea6?_0x147bea[_0x4c9f('0x22')]:_0xc3bb9d[_0x4c9f('0x1f')]+_0xc3bb9d[_0x4c9f('0x21')];var _0x33f10b;if(_0x1c0efc>=_0x23faf2){_0x1c0efc=_0x23faf2;_0x33f10b=0xc8;}else{_0x33f10b=0xce;}_0x35edfb[_0x4c9f('0x1c')](_0x33f10b);return _0x35edfb[_0x4c9f('0x23')](_0x4c9f('0x24'),_0x3105c4+'-'+_0x1c0efc+'/'+_0x23faf2)[_0x4c9f('0x1e')](_0x147bea);}return null;};}function patchUpdates(_0x5a8e77){return function(_0x25c64d){try{jsonpatch['apply'](_0x25c64d,_0x5a8e77,!![]);}catch(_0x6ba778){return BPromise[_0x4c9f('0x25')](_0x6ba778);}return _0x25c64d[_0x4c9f('0x26')]();};}function saveUpdates(_0x2151bb,_0x1c4c30){return function(_0x1c53b0){if(_0x1c53b0){return _0x1c53b0['update'](_0x2151bb)[_0x4c9f('0x27')](function(_0x540a19){return _0x540a19;});}return null;};}function removeEntity(_0x10e9d8,_0x5d0f96){return function(_0x835a20){if(_0x835a20){return _0x835a20[_0x4c9f('0x28')]()[_0x4c9f('0x27')](function(){_0x10e9d8[_0x4c9f('0x1c')](0xcc)[_0x4c9f('0x1d')]();});}};}function handleEntityNotFound(_0x4668e1,_0x375681){return function(_0x30aa80){if(!_0x30aa80){_0x4668e1[_0x4c9f('0x1b')](0x194);}return _0x30aa80;};}function handleError(_0x2669cb,_0x17f099){_0x17f099=_0x17f099||0x1f4;return function(_0x5b86d7){logger['error'](_0x5b86d7[_0x4c9f('0x29')]);if(_0x5b86d7[_0x4c9f('0x2a')]){delete _0x5b86d7[_0x4c9f('0x2a')];}_0x2669cb[_0x4c9f('0x1c')](_0x17f099)[_0x4c9f('0x2b')](_0x5b86d7);};}exports[_0x4c9f('0x2c')]=function(_0xd41f62,_0x163998){var _0x46ed27={},_0x2fcd8f={},_0x405801={'count':0x0,'rows':[]};var _0x3f0bb9=_[_0x4c9f('0x2d')](db[_0x4c9f('0x2e')][_0x4c9f('0x2f')],function(_0x236543){return{'name':_0x236543['fieldName'],'type':_0x236543[_0x4c9f('0x30')][_0x4c9f('0x31')]};});_0x2fcd8f[_0x4c9f('0x32')]=_[_0x4c9f('0x2d')](_0x3f0bb9,_0x4c9f('0x2a'));_0x2fcd8f[_0x4c9f('0x33')]=_['keys'](_0xd41f62[_0x4c9f('0x33')]);_0x2fcd8f['filters']=_[_0x4c9f('0x34')](_0x2fcd8f['model'],_0x2fcd8f[_0x4c9f('0x33')]);_0x46ed27[_0x4c9f('0x35')]=_[_0x4c9f('0x34')](_0x2fcd8f['model'],qs[_0x4c9f('0x36')](_0xd41f62[_0x4c9f('0x33')]['fields']));_0x46ed27['attributes']=_0x46ed27[_0x4c9f('0x35')]['length']?_0x46ed27[_0x4c9f('0x35')]:_0x2fcd8f[_0x4c9f('0x32')];if(!_0xd41f62[_0x4c9f('0x33')][_0x4c9f('0x37')]('nolimit')){_0x46ed27[_0x4c9f('0x21')]=qs['limit'](_0xd41f62['query'][_0x4c9f('0x21')]);_0x46ed27[_0x4c9f('0x1f')]=qs[_0x4c9f('0x1f')](_0xd41f62[_0x4c9f('0x33')][_0x4c9f('0x1f')]);}_0x46ed27[_0x4c9f('0x38')]=qs[_0x4c9f('0x39')](_0xd41f62[_0x4c9f('0x33')][_0x4c9f('0x39')]);_0x46ed27[_0x4c9f('0x3a')]=qs[_0x4c9f('0x3b')](_['pick'](_0xd41f62[_0x4c9f('0x33')],_0x2fcd8f[_0x4c9f('0x3b')]),_0x3f0bb9);if(_0xd41f62[_0x4c9f('0x33')][_0x4c9f('0x3c')]){_0x46ed27['where']=_[_0x4c9f('0x3d')](_0x46ed27[_0x4c9f('0x3a')],{'$or':_[_0x4c9f('0x2d')](_0x3f0bb9,function(_0x365162){if(_0x365162[_0x4c9f('0x30')]!==_0x4c9f('0x3e')){var _0x78ce72={};_0x78ce72[_0x365162[_0x4c9f('0x2a')]]={'$like':'%'+_0xd41f62[_0x4c9f('0x33')][_0x4c9f('0x3c')]+'%'};return _0x78ce72;}})});}_0x46ed27=_[_0x4c9f('0x3d')]({},_0x46ed27,_0xd41f62[_0x4c9f('0x3f')]);var _0x53867b={'where':_0x46ed27[_0x4c9f('0x3a')]};return db['SalesforceAccount'][_0x4c9f('0x22')](_0x53867b)[_0x4c9f('0x27')](function(_0x36cdfb){_0x405801[_0x4c9f('0x22')]=_0x36cdfb;if(_0xd41f62['query']['includeAll']){_0x46ed27[_0x4c9f('0x40')]=[{'all':!![]}];}return db['SalesforceAccount']['findAll'](_0x46ed27);})[_0x4c9f('0x27')](function(_0x4bebe2){_0x405801[_0x4c9f('0x41')]=_0x4bebe2;return _0x405801;})[_0x4c9f('0x27')](respondWithFilteredResult(_0x163998,_0x46ed27))[_0x4c9f('0x42')](handleError(_0x163998,null));};exports[_0x4c9f('0x43')]=function(_0x4a66be,_0xdbfde2){var _0x1a81f1={'raw':![],'where':{'id':_0x4a66be[_0x4c9f('0x44')]['id']}},_0x23c3cd={};_0x23c3cd['model']=_['keys'](db[_0x4c9f('0x2e')][_0x4c9f('0x2f')]);_0x23c3cd['query']=_['keys'](_0x4a66be[_0x4c9f('0x33')]);_0x23c3cd['filters']=_[_0x4c9f('0x34')](_0x23c3cd[_0x4c9f('0x32')],_0x23c3cd[_0x4c9f('0x33')]);_0x1a81f1['attributes']=_[_0x4c9f('0x34')](_0x23c3cd[_0x4c9f('0x32')],qs[_0x4c9f('0x36')](_0x4a66be[_0x4c9f('0x33')][_0x4c9f('0x36')]));_0x1a81f1[_0x4c9f('0x35')]=_0x1a81f1[_0x4c9f('0x35')]['length']?_0x1a81f1['attributes']:_0x23c3cd[_0x4c9f('0x32')];if(_0x4a66be['query'][_0x4c9f('0x45')]){_0x1a81f1[_0x4c9f('0x40')]=[{'all':!![]}];}_0x1a81f1=_[_0x4c9f('0x3d')]({},_0x1a81f1,_0x4a66be[_0x4c9f('0x3f')]);return db['SalesforceAccount'][_0x4c9f('0x46')](_0x1a81f1)['then'](handleEntityNotFound(_0xdbfde2,null))[_0x4c9f('0x27')](respondWithResult(_0xdbfde2,null))['catch'](handleError(_0xdbfde2,null));};exports[_0x4c9f('0x47')]=function(_0x5b6d55,_0x39c693){return db[_0x4c9f('0x2e')][_0x4c9f('0x47')](_0x5b6d55[_0x4c9f('0x48')],{})['then'](respondWithResult(_0x39c693,0xc9))[_0x4c9f('0x42')](handleError(_0x39c693,null));};exports[_0x4c9f('0x49')]=function(_0x2f2e3c,_0x2a65bb){if(_0x2f2e3c[_0x4c9f('0x48')]['id']){delete _0x2f2e3c['body']['id'];}return db[_0x4c9f('0x2e')]['find']({'where':{'id':_0x2f2e3c[_0x4c9f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2a65bb,null))['then'](saveUpdates(_0x2f2e3c[_0x4c9f('0x48')],null))['then'](respondWithResult(_0x2a65bb,null))[_0x4c9f('0x42')](handleError(_0x2a65bb,null));};exports[_0x4c9f('0x28')]=function(_0x575323,_0x2e7a95){return db[_0x4c9f('0x2e')]['find']({'where':{'id':_0x575323['params']['id']}})[_0x4c9f('0x27')](handleEntityNotFound(_0x2e7a95,null))[_0x4c9f('0x27')](removeEntity(_0x2e7a95,null))[_0x4c9f('0x42')](handleError(_0x2e7a95,null));};exports[_0x4c9f('0x4a')]=function(_0x16b644,_0x5ceec3,_0x5f4071){var _0x4a12d2={};var _0x493624={};var _0x161c86;var _0x20db78;return db['SalesforceAccount'][_0x4c9f('0x4b')]({'where':{'id':_0x16b644[_0x4c9f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ceec3,null))[_0x4c9f('0x27')](function(_0x5aa277){if(_0x5aa277){_0x161c86=_0x5aa277;_0x493624['model']=_[_0x4c9f('0x4c')](db['SalesforceConfiguration']['rawAttributes']);_0x493624[_0x4c9f('0x33')]=_['keys'](_0x16b644[_0x4c9f('0x33')]);_0x493624[_0x4c9f('0x3b')]=_[_0x4c9f('0x34')](_0x493624[_0x4c9f('0x32')],_0x493624[_0x4c9f('0x33')]);_0x4a12d2[_0x4c9f('0x35')]=_[_0x4c9f('0x34')](_0x493624['model'],qs[_0x4c9f('0x36')](_0x16b644[_0x4c9f('0x33')][_0x4c9f('0x36')]));_0x4a12d2[_0x4c9f('0x35')]=_0x4a12d2['attributes'][_0x4c9f('0x4d')]?_0x4a12d2['attributes']:_0x493624[_0x4c9f('0x32')];_0x4a12d2[_0x4c9f('0x38')]=qs[_0x4c9f('0x39')](_0x16b644[_0x4c9f('0x33')]['sort']);_0x4a12d2['where']=qs[_0x4c9f('0x3b')](_['pick'](_0x16b644[_0x4c9f('0x33')],_0x493624[_0x4c9f('0x3b')]));if(_0x16b644[_0x4c9f('0x33')][_0x4c9f('0x3c')]){_0x4a12d2[_0x4c9f('0x3a')]=_[_0x4c9f('0x3d')](_0x4a12d2['where'],{'$or':_['map'](_0x4a12d2[_0x4c9f('0x35')],function(_0x15d937){var _0x5e5e78={};_0x5e5e78[_0x15d937]={'$like':'%'+_0x16b644[_0x4c9f('0x33')][_0x4c9f('0x3c')]+'%'};return _0x5e5e78;})});}_0x4a12d2=_[_0x4c9f('0x3d')]({},_0x4a12d2,_0x16b644[_0x4c9f('0x3f')]);return _0x161c86[_0x4c9f('0x4a')](_0x4a12d2);}})[_0x4c9f('0x27')](function(_0x416fbf){if(_0x416fbf){_0x20db78=_0x416fbf[_0x4c9f('0x4d')];if(!_0x16b644[_0x4c9f('0x33')][_0x4c9f('0x37')](_0x4c9f('0x4e'))){_0x4a12d2[_0x4c9f('0x21')]=qs[_0x4c9f('0x21')](_0x16b644['query'][_0x4c9f('0x21')]);_0x4a12d2[_0x4c9f('0x1f')]=qs[_0x4c9f('0x1f')](_0x16b644[_0x4c9f('0x33')][_0x4c9f('0x1f')]);}return _0x161c86[_0x4c9f('0x4a')](_0x4a12d2);}})[_0x4c9f('0x27')](function(_0x403c4d){if(_0x403c4d){return _0x403c4d?{'count':_0x20db78,'rows':_0x403c4d}:null;}})[_0x4c9f('0x27')](respondWithResult(_0x5ceec3,null))[_0x4c9f('0x42')](handleError(_0x5ceec3,null));};exports[_0x4c9f('0x4f')]=function(_0x3844ae,_0x5b8fa6,_0x6225c6){if(_0x3844ae[_0x4c9f('0x48')]['id']){delete _0x3844ae[_0x4c9f('0x48')]['id'];}return db[_0x4c9f('0x2e')][_0x4c9f('0x4b')]({'where':{'id':_0x3844ae['params']['id']}})[_0x4c9f('0x27')](handleEntityNotFound(_0x5b8fa6,null))['then'](function(_0x5086ba){if(_0x5086ba){_0x3844ae[_0x4c9f('0x48')][_0x4c9f('0x50')]=_0x5086ba['id'];_0x3844ae[_0x4c9f('0x48')][_0x4c9f('0x51')]=integrations[_0x4c9f('0x52')](_0x3844ae[_0x4c9f('0x48')][_0x4c9f('0x53')],_0x3844ae['body'][_0x4c9f('0x30')]);_0x3844ae[_0x4c9f('0x48')][_0x4c9f('0x54')]=integrations['getDescriptions'](_0x3844ae[_0x4c9f('0x48')][_0x4c9f('0x53')],_0x3844ae[_0x4c9f('0x48')][_0x4c9f('0x30')]);return db[_0x4c9f('0x55')][_0x4c9f('0x47')](_0x3844ae[_0x4c9f('0x48')],{'include':[{'model':db[_0x4c9f('0x56')],'as':_0x4c9f('0x51')},{'model':db[_0x4c9f('0x56')],'as':_0x4c9f('0x54')}]});}return null;})[_0x4c9f('0x27')](respondWithResult(_0x5b8fa6,null))[_0x4c9f('0x42')](handleError(_0x5b8fa6,null));};exports['getFields']=function(_0xf2fd28,_0x862ad8,_0x82e734){var _0x14cae3;var _0x301dec='';var _0x45febf=_0x4c9f('0x57');return db['SalesforceAccount'][_0x4c9f('0x4b')]({'where':{'id':_0xf2fd28['params']['id']},'attributes':['id',_0x4c9f('0x58'),_0x4c9f('0x59'),_0x4c9f('0x5a'),_0x4c9f('0x5b'),'password',_0x4c9f('0x5c')]})[_0x4c9f('0x27')](handleEntityNotFound(_0x862ad8,null))[_0x4c9f('0x27')](function(_0x2ed974){if(_0x2ed974){_0x301dec=_0x2ed974[_0x4c9f('0x58')];var _0x51e1c5=_0x301dec[_0x4c9f('0x5d')](-0x1);if(_0x51e1c5==='/'){_0x301dec=_0x301dec[_0x4c9f('0x5e')](0x0,_0x301dec['lastIndexOf'](_0x51e1c5));}_0x14cae3=new jsforce[(_0x4c9f('0x5f'))]({'oauth2':{'loginUrl':_0x301dec,'clientId':_0x2ed974['clientId'],'clientSecret':_0x2ed974[_0x4c9f('0x5a')]}});return _0x14cae3[_0x4c9f('0x60')](_0x2ed974['username'],_0x2ed974['password'][_0x4c9f('0x61')](_0x2ed974[_0x4c9f('0x5c')]));}})[_0x4c9f('0x27')](function(_0x2f0d88){if(_0x2f0d88){if(!_[_0x4c9f('0x62')](_0xf2fd28[_0x4c9f('0x33')]['ticketType'])){_0x45febf=_0xf2fd28[_0x4c9f('0x33')][_0x4c9f('0x63')];}return _0x14cae3['sobject'](_0x45febf)['describe']();}})[_0x4c9f('0x27')](function(_0x151ceb){var _0x13914e=['OwnerId',_0x4c9f('0x64'),_0x4c9f('0x65'),_0x4c9f('0x66'),_0x4c9f('0x67'),_0x4c9f('0x68')];var _0xd9bb14=[_0x4c9f('0x69'),_0x4c9f('0x6a'),_0x4c9f('0x6b'),_0x4c9f('0x6c'),'email',_0x4c9f('0x6d'),_0x4c9f('0x6e')];if(_0x151ceb){_['remove'](_0x151ceb[_0x4c9f('0x36')],function(_0xdf75f6){return _0x13914e[_0x4c9f('0x6f')](_0xdf75f6[_0x4c9f('0x2a')])||!_0xd9bb14[_0x4c9f('0x6f')](_0xdf75f6[_0x4c9f('0x30')]);});return{'count':_0x151ceb[_0x4c9f('0x36')][_0x4c9f('0x4d')],'rows':_[_0x4c9f('0x2d')](_0x151ceb[_0x4c9f('0x36')],function(_0x540ddb){return{'id':_0x540ddb[_0x4c9f('0x2a')],'name':_0x540ddb['label'],'custom':_0x540ddb[_0x4c9f('0x70')],'options':_0x540ddb[_0x4c9f('0x71')][_0x4c9f('0x4d')]>0x0?_[_0x4c9f('0x2d')](_0x540ddb['picklistValues'],function(_0x4278b8){return{'name':_0x4278b8[_0x4c9f('0x72')],'value':_0x4278b8[_0x4c9f('0x73')]};}):_0x540ddb[_0x4c9f('0x30')]==_0x4c9f('0x6c')?[{'name':_0x4c9f('0x74'),'value':_0x4c9f('0x75')},{'name':_0x4c9f('0x76'),'value':'false'}]:[]};})};}})[_0x4c9f('0x27')](respondWithResult(_0x862ad8,null))[_0x4c9f('0x42')](function(_0x57f505){var _0xc0e94a=_0xf2fd28[_0x4c9f('0x33')]['test']?0x1f4:_0x57f505[_0x4c9f('0x77')]||0x1f4;logger[_0x4c9f('0x78')](_0x4c9f('0x79'),'getFields',_0xc0e94a,JSON[_0x4c9f('0x7a')](_0x57f505));delete _0x57f505[_0x4c9f('0x2a')];if(_0xc0e94a===0x191){_0xc0e94a=0x190;}_0x862ad8[_0x4c9f('0x1c')](_0xc0e94a)['send'](_0xf2fd28[_0x4c9f('0x33')][_0x4c9f('0x7b')]?{'message':_0x4c9f('0x7c'),'statusCode':_0x57f505[_0x4c9f('0x77')]}:_0x57f505);});}; \ No newline at end of file +var _0x203a=['merge','options','includeAll','include','findAll','show','params','find','create','update','body','getConfigurations','SalesforceConfiguration','catch','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','remove','includes','custom','picklistValues','label','value','boolean','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','index','SalesforceAccount','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','type','VIRTUAL'];(function(_0x3fe7e4,_0x553eba){var _0x5e6d33=function(_0x268b30){while(--_0x268b30){_0x3fe7e4['push'](_0x3fe7e4['shift']());}};_0x5e6d33(++_0x553eba);}(_0x203a,0xbb));var _0xa203=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x203a[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0xa203('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa203('0x1'));var jsonpatch=require(_0xa203('0x2'));var rp=require(_0xa203('0x3'));var moment=require(_0xa203('0x4'));var BPromise=require(_0xa203('0x5'));var Mustache=require(_0xa203('0x6'));var util=require('util');var path=require(_0xa203('0x7'));var sox=require(_0xa203('0x8'));var csv=require(_0xa203('0x9'));var ejs=require(_0xa203('0xa'));var fs=require('fs');var fs_extra=require(_0xa203('0xb'));var _=require(_0xa203('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa203('0xd'));var deskjs=require(_0xa203('0xe'));var toCsv=require(_0xa203('0x9'));var querystring=require(_0xa203('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa203('0x10'));var as=require(_0xa203('0x11'));var hardwareService=require(_0xa203('0x12'));var logger=require(_0xa203('0x13'))('api');var utils=require(_0xa203('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa203('0x15'))['db'];var integrations=require(_0xa203('0x16'));function respondWithStatusCode(_0x2fe779,_0x90fd4b){_0x90fd4b=_0x90fd4b||0xcc;return function(_0x4abbbe){if(_0x4abbbe){return _0x2fe779[_0xa203('0x17')](_0x90fd4b);}return _0x2fe779[_0xa203('0x18')](_0x90fd4b)[_0xa203('0x19')]();};}function respondWithResult(_0x4a9816,_0x1b1d29){_0x1b1d29=_0x1b1d29||0xc8;return function(_0x351931){if(_0x351931){return _0x4a9816[_0xa203('0x18')](_0x1b1d29)['json'](_0x351931);}};}function respondWithFilteredResult(_0x8787ab,_0x47190f){return function(_0x3a10b8){if(_0x3a10b8){var _0x20eeb9=typeof _0x47190f[_0xa203('0x1a')]===_0xa203('0x1b')&&typeof _0x47190f['limit']===_0xa203('0x1b');var _0x3982bb=_0x3a10b8['count'];var _0x29a090=_0x20eeb9?0x0:_0x47190f[_0xa203('0x1a')];var _0x520f87=_0x20eeb9?_0x3a10b8[_0xa203('0x1c')]:_0x47190f[_0xa203('0x1a')]+_0x47190f['limit'];var _0x52a4fb;if(_0x520f87>=_0x3982bb){_0x520f87=_0x3982bb;_0x52a4fb=0xc8;}else{_0x52a4fb=0xce;}_0x8787ab[_0xa203('0x18')](_0x52a4fb);return _0x8787ab[_0xa203('0x1d')](_0xa203('0x1e'),_0x29a090+'-'+_0x520f87+'/'+_0x3982bb)['json'](_0x3a10b8);}return null;};}function patchUpdates(_0x2fb49b){return function(_0x2fc77b){try{jsonpatch['apply'](_0x2fc77b,_0x2fb49b,!![]);}catch(_0x5efb74){return BPromise['reject'](_0x5efb74);}return _0x2fc77b[_0xa203('0x1f')]();};}function saveUpdates(_0x13f7ae,_0x206d17){return function(_0x2947d6){if(_0x2947d6){return _0x2947d6['update'](_0x13f7ae)[_0xa203('0x20')](function(_0x23ccec){return _0x23ccec;});}return null;};}function removeEntity(_0x4bb370,_0x4f1fd2){return function(_0x41397a){if(_0x41397a){return _0x41397a[_0xa203('0x21')]()['then'](function(){_0x4bb370['status'](0xcc)[_0xa203('0x19')]();});}};}function handleEntityNotFound(_0x1a807f,_0x3308da){return function(_0x151781){if(!_0x151781){_0x1a807f[_0xa203('0x17')](0x194);}return _0x151781;};}function handleError(_0x3a4561,_0x346d0){_0x346d0=_0x346d0||0x1f4;return function(_0x2b8acc){logger[_0xa203('0x22')](_0x2b8acc[_0xa203('0x23')]);if(_0x2b8acc['name']){delete _0x2b8acc[_0xa203('0x24')];}_0x3a4561[_0xa203('0x18')](_0x346d0)['send'](_0x2b8acc);};}exports[_0xa203('0x25')]=function(_0x16fad3,_0x239fa3){var _0x1a9165={},_0x3beaf3={},_0x4c7ffc={'count':0x0,'rows':[]};var _0xf97ee2=_['map'](db[_0xa203('0x26')][_0xa203('0x27')],function(_0x5a80d6){return{'name':_0x5a80d6['fieldName'],'type':_0x5a80d6['type']['key']};});_0x3beaf3[_0xa203('0x28')]=_[_0xa203('0x29')](_0xf97ee2,_0xa203('0x24'));_0x3beaf3[_0xa203('0x2a')]=_[_0xa203('0x2b')](_0x16fad3['query']);_0x3beaf3[_0xa203('0x2c')]=_[_0xa203('0x2d')](_0x3beaf3[_0xa203('0x28')],_0x3beaf3[_0xa203('0x2a')]);_0x1a9165[_0xa203('0x2e')]=_[_0xa203('0x2d')](_0x3beaf3[_0xa203('0x28')],qs[_0xa203('0x2f')](_0x16fad3[_0xa203('0x2a')]['fields']));_0x1a9165[_0xa203('0x2e')]=_0x1a9165['attributes'][_0xa203('0x30')]?_0x1a9165[_0xa203('0x2e')]:_0x3beaf3[_0xa203('0x28')];if(!_0x16fad3[_0xa203('0x2a')][_0xa203('0x31')](_0xa203('0x32'))){_0x1a9165[_0xa203('0x33')]=qs[_0xa203('0x33')](_0x16fad3['query'][_0xa203('0x33')]);_0x1a9165[_0xa203('0x1a')]=qs['offset'](_0x16fad3[_0xa203('0x2a')][_0xa203('0x1a')]);}_0x1a9165[_0xa203('0x34')]=qs[_0xa203('0x35')](_0x16fad3[_0xa203('0x2a')][_0xa203('0x35')]);_0x1a9165[_0xa203('0x36')]=qs[_0xa203('0x2c')](_[_0xa203('0x37')](_0x16fad3[_0xa203('0x2a')],_0x3beaf3[_0xa203('0x2c')]),_0xf97ee2);if(_0x16fad3[_0xa203('0x2a')][_0xa203('0x38')]){_0x1a9165[_0xa203('0x36')]=_['merge'](_0x1a9165['where'],{'$or':_['map'](_0xf97ee2,function(_0x355233){if(_0x355233[_0xa203('0x39')]!==_0xa203('0x3a')){var _0x2c9933={};_0x2c9933[_0x355233[_0xa203('0x24')]]={'$like':'%'+_0x16fad3[_0xa203('0x2a')][_0xa203('0x38')]+'%'};return _0x2c9933;}})});}_0x1a9165=_[_0xa203('0x3b')]({},_0x1a9165,_0x16fad3[_0xa203('0x3c')]);var _0x3587e9={'where':_0x1a9165[_0xa203('0x36')]};return db[_0xa203('0x26')][_0xa203('0x1c')](_0x3587e9)[_0xa203('0x20')](function(_0x23be9d){_0x4c7ffc[_0xa203('0x1c')]=_0x23be9d;if(_0x16fad3['query'][_0xa203('0x3d')]){_0x1a9165[_0xa203('0x3e')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xa203('0x3f')](_0x1a9165);})[_0xa203('0x20')](function(_0x3886d0){_0x4c7ffc['rows']=_0x3886d0;return _0x4c7ffc;})[_0xa203('0x20')](respondWithFilteredResult(_0x239fa3,_0x1a9165))['catch'](handleError(_0x239fa3,null));};exports[_0xa203('0x40')]=function(_0x205952,_0x776307){var _0x3c5c15={'raw':![],'where':{'id':_0x205952[_0xa203('0x41')]['id']}},_0x3f868d={};_0x3f868d[_0xa203('0x28')]=_['keys'](db['SalesforceAccount'][_0xa203('0x27')]);_0x3f868d['query']=_[_0xa203('0x2b')](_0x205952['query']);_0x3f868d[_0xa203('0x2c')]=_[_0xa203('0x2d')](_0x3f868d[_0xa203('0x28')],_0x3f868d[_0xa203('0x2a')]);_0x3c5c15[_0xa203('0x2e')]=_[_0xa203('0x2d')](_0x3f868d[_0xa203('0x28')],qs[_0xa203('0x2f')](_0x205952[_0xa203('0x2a')][_0xa203('0x2f')]));_0x3c5c15['attributes']=_0x3c5c15[_0xa203('0x2e')][_0xa203('0x30')]?_0x3c5c15['attributes']:_0x3f868d[_0xa203('0x28')];if(_0x205952['query']['includeAll']){_0x3c5c15[_0xa203('0x3e')]=[{'all':!![]}];}_0x3c5c15=_[_0xa203('0x3b')]({},_0x3c5c15,_0x205952[_0xa203('0x3c')]);return db['SalesforceAccount'][_0xa203('0x42')](_0x3c5c15)['then'](handleEntityNotFound(_0x776307,null))[_0xa203('0x20')](respondWithResult(_0x776307,null))['catch'](handleError(_0x776307,null));};exports[_0xa203('0x43')]=function(_0x12b573,_0x10d653){return db[_0xa203('0x26')][_0xa203('0x43')](_0x12b573['body'],{})[_0xa203('0x20')](respondWithResult(_0x10d653,0xc9))['catch'](handleError(_0x10d653,null));};exports[_0xa203('0x44')]=function(_0x4195d5,_0x38fcae){if(_0x4195d5['body']['id']){delete _0x4195d5[_0xa203('0x45')]['id'];}return db[_0xa203('0x26')]['find']({'where':{'id':_0x4195d5[_0xa203('0x41')]['id']}})[_0xa203('0x20')](handleEntityNotFound(_0x38fcae,null))['then'](saveUpdates(_0x4195d5['body'],null))['then'](respondWithResult(_0x38fcae,null))['catch'](handleError(_0x38fcae,null));};exports[_0xa203('0x21')]=function(_0x5a9533,_0x513c7f){return db[_0xa203('0x26')][_0xa203('0x42')]({'where':{'id':_0x5a9533['params']['id']}})['then'](handleEntityNotFound(_0x513c7f,null))['then'](removeEntity(_0x513c7f,null))['catch'](handleError(_0x513c7f,null));};exports[_0xa203('0x46')]=function(_0x2bcee0,_0x5e1fde,_0x1d77e4){var _0x4ef2e4={};var _0x38da2e={};var _0x32eb2b;var _0x50664b;return db[_0xa203('0x26')]['findOne']({'where':{'id':_0x2bcee0[_0xa203('0x41')]['id']}})[_0xa203('0x20')](handleEntityNotFound(_0x5e1fde,null))[_0xa203('0x20')](function(_0x181652){if(_0x181652){_0x32eb2b=_0x181652;_0x38da2e['model']=_[_0xa203('0x2b')](db[_0xa203('0x47')][_0xa203('0x27')]);_0x38da2e[_0xa203('0x2a')]=_[_0xa203('0x2b')](_0x2bcee0['query']);_0x38da2e['filters']=_[_0xa203('0x2d')](_0x38da2e[_0xa203('0x28')],_0x38da2e[_0xa203('0x2a')]);_0x4ef2e4[_0xa203('0x2e')]=_[_0xa203('0x2d')](_0x38da2e['model'],qs['fields'](_0x2bcee0['query']['fields']));_0x4ef2e4[_0xa203('0x2e')]=_0x4ef2e4[_0xa203('0x2e')][_0xa203('0x30')]?_0x4ef2e4['attributes']:_0x38da2e['model'];_0x4ef2e4[_0xa203('0x34')]=qs[_0xa203('0x35')](_0x2bcee0['query']['sort']);_0x4ef2e4['where']=qs[_0xa203('0x2c')](_[_0xa203('0x37')](_0x2bcee0[_0xa203('0x2a')],_0x38da2e[_0xa203('0x2c')]));if(_0x2bcee0[_0xa203('0x2a')][_0xa203('0x38')]){_0x4ef2e4[_0xa203('0x36')]=_[_0xa203('0x3b')](_0x4ef2e4[_0xa203('0x36')],{'$or':_[_0xa203('0x29')](_0x4ef2e4[_0xa203('0x2e')],function(_0x52fdbb){var _0x5d0641={};_0x5d0641[_0x52fdbb]={'$like':'%'+_0x2bcee0[_0xa203('0x2a')]['filter']+'%'};return _0x5d0641;})});}_0x4ef2e4=_[_0xa203('0x3b')]({},_0x4ef2e4,_0x2bcee0[_0xa203('0x3c')]);return _0x32eb2b[_0xa203('0x46')](_0x4ef2e4);}})[_0xa203('0x20')](function(_0x1b5084){if(_0x1b5084){_0x50664b=_0x1b5084[_0xa203('0x30')];if(!_0x2bcee0['query']['hasOwnProperty'](_0xa203('0x32'))){_0x4ef2e4[_0xa203('0x33')]=qs[_0xa203('0x33')](_0x2bcee0[_0xa203('0x2a')]['limit']);_0x4ef2e4['offset']=qs[_0xa203('0x1a')](_0x2bcee0[_0xa203('0x2a')]['offset']);}return _0x32eb2b[_0xa203('0x46')](_0x4ef2e4);}})[_0xa203('0x20')](function(_0x22b5fc){if(_0x22b5fc){return _0x22b5fc?{'count':_0x50664b,'rows':_0x22b5fc}:null;}})['then'](respondWithResult(_0x5e1fde,null))[_0xa203('0x48')](handleError(_0x5e1fde,null));};exports[_0xa203('0x49')]=function(_0x57a0e0,_0x58b7ee,_0x4b7558){if(_0x57a0e0[_0xa203('0x45')]['id']){delete _0x57a0e0['body']['id'];}return db[_0xa203('0x26')][_0xa203('0x4a')]({'where':{'id':_0x57a0e0[_0xa203('0x41')]['id']}})[_0xa203('0x20')](handleEntityNotFound(_0x58b7ee,null))[_0xa203('0x20')](function(_0x5d8ec6){if(_0x5d8ec6){_0x57a0e0[_0xa203('0x45')][_0xa203('0x4b')]=_0x5d8ec6['id'];_0x57a0e0[_0xa203('0x45')]['Subjects']=integrations[_0xa203('0x4c')](_0x57a0e0[_0xa203('0x45')][_0xa203('0x4d')],_0x57a0e0[_0xa203('0x45')]['type']);_0x57a0e0[_0xa203('0x45')][_0xa203('0x4e')]=integrations[_0xa203('0x4f')](_0x57a0e0[_0xa203('0x45')]['channel'],_0x57a0e0['body']['type']);return db['SalesforceConfiguration'][_0xa203('0x43')](_0x57a0e0[_0xa203('0x45')],{'include':[{'model':db[_0xa203('0x50')],'as':_0xa203('0x51')},{'model':db[_0xa203('0x50')],'as':'Descriptions'}]});}return null;})[_0xa203('0x20')](respondWithResult(_0x58b7ee,null))[_0xa203('0x48')](handleError(_0x58b7ee,null));};exports[_0xa203('0x52')]=function(_0x5ed39a,_0x3ff003,_0x33086e){var _0x345341;var _0xc4c4b5='';var _0x1ee23f=_0xa203('0x53');return db['SalesforceAccount'][_0xa203('0x4a')]({'where':{'id':_0x5ed39a[_0xa203('0x41')]['id']},'attributes':['id','remoteUri','clientId',_0xa203('0x54'),_0xa203('0x55'),_0xa203('0x56'),_0xa203('0x57')]})['then'](handleEntityNotFound(_0x3ff003,null))['then'](function(_0x2b2494){if(_0x2b2494){_0xc4c4b5=_0x2b2494[_0xa203('0x58')];var _0x347708=_0xc4c4b5[_0xa203('0x59')](-0x1);if(_0x347708==='/'){_0xc4c4b5=_0xc4c4b5[_0xa203('0x5a')](0x0,_0xc4c4b5[_0xa203('0x5b')](_0x347708));}_0x345341=new jsforce[(_0xa203('0x5c'))]({'oauth2':{'loginUrl':_0xc4c4b5,'clientId':_0x2b2494[_0xa203('0x5d')],'clientSecret':_0x2b2494[_0xa203('0x54')]}});return _0x345341[_0xa203('0x5e')](_0x2b2494[_0xa203('0x55')],_0x2b2494['password'][_0xa203('0x5f')](_0x2b2494[_0xa203('0x57')]));}})[_0xa203('0x20')](function(_0x4be2f7){if(_0x4be2f7){if(!_[_0xa203('0x60')](_0x5ed39a[_0xa203('0x2a')]['ticketType'])){_0x1ee23f=_0x5ed39a['query'][_0xa203('0x61')];}return _0x345341[_0xa203('0x62')](_0x1ee23f)[_0xa203('0x63')]();}})[_0xa203('0x20')](function(_0x26e3f8){var _0x417add=[_0xa203('0x64'),_0xa203('0x65'),_0xa203('0x66'),_0xa203('0x67'),_0xa203('0x68'),_0xa203('0x69')];var _0x34c422=[_0xa203('0x6a'),_0xa203('0x6b'),_0xa203('0x6c'),'boolean','email','textarea','phone'];if(_0x26e3f8){_[_0xa203('0x6d')](_0x26e3f8[_0xa203('0x2f')],function(_0xb59862){return _0x417add[_0xa203('0x6e')](_0xb59862[_0xa203('0x24')])||!_0x34c422[_0xa203('0x6e')](_0xb59862['type']);});return{'count':_0x26e3f8[_0xa203('0x2f')][_0xa203('0x30')],'rows':_['map'](_0x26e3f8[_0xa203('0x2f')],function(_0x470d04){return{'id':_0x470d04[_0xa203('0x24')],'name':_0x470d04['label'],'custom':_0x470d04[_0xa203('0x6f')],'options':_0x470d04[_0xa203('0x70')][_0xa203('0x30')]>0x0?_['map'](_0x470d04[_0xa203('0x70')],function(_0x180589){return{'name':_0x180589[_0xa203('0x71')],'value':_0x180589[_0xa203('0x72')]};}):_0x470d04[_0xa203('0x39')]==_0xa203('0x73')?[{'name':_0xa203('0x74'),'value':_0xa203('0x75')},{'name':_0xa203('0x76'),'value':'false'}]:[]};})};}})[_0xa203('0x20')](respondWithResult(_0x3ff003,null))['catch'](function(_0x56a8af){var _0x269ad8=_0x5ed39a[_0xa203('0x2a')][_0xa203('0x77')]?0x1f4:_0x56a8af[_0xa203('0x78')]||0x1f4;logger[_0xa203('0x22')](_0xa203('0x79'),_0xa203('0x52'),_0x269ad8,JSON['stringify'](_0x56a8af));delete _0x56a8af['name'];if(_0x269ad8===0x191){_0x269ad8=0x190;}_0x3ff003['status'](_0x269ad8)[_0xa203('0x7a')](_0x5ed39a['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0x56a8af[_0xa203('0x78')]}:_0x56a8af);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index df8dbe6..1a4cd4f 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 _0xa9f3=['exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x280221,_0x2d0576){var _0x11abd3=function(_0x503920){while(--_0x503920){_0x280221['push'](_0x280221['shift']());}};_0x11abd3(++_0x2d0576);}(_0xa9f3,0x1e8));var _0x3a9f=function(_0x8ad955,_0x272bfe){_0x8ad955=_0x8ad955-0x0;var _0x4c7422=_0xa9f3[_0x8ad955];return _0x4c7422;};'use strict';var _=require(_0x3a9f('0x0'));var util=require(_0x3a9f('0x1'));var logger=require(_0x3a9f('0x2'))(_0x3a9f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3a9f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a9f('0x5'));var config=require(_0x3a9f('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x3a9f('0x7')]=function(_0x208a55,_0x5ccc63){return _0x208a55[_0x3a9f('0x8')](_0x3a9f('0x9'),attributes,{'tableName':_0x3a9f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7817=['api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','lodash','util','../../config/logger'];(function(_0x232017,_0x577072){var _0x5709fa=function(_0x58973d){while(--_0x58973d){_0x232017['push'](_0x232017['shift']());}};_0x5709fa(++_0x577072);}(_0x7817,0x1e1));var _0x7781=function(_0x4fd6de,_0x35bb52){_0x4fd6de=_0x4fd6de-0x0;var _0x58d6d5=_0x7817[_0x4fd6de];return _0x58d6d5;};'use strict';var _=require(_0x7781('0x0'));var util=require(_0x7781('0x1'));var logger=require(_0x7781('0x2'))(_0x7781('0x3'));var moment=require(_0x7781('0x4'));var BPromise=require(_0x7781('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7781('0x6'));var rimraf=require(_0x7781('0x7'));var config=require(_0x7781('0x8'));var attributes=require(_0x7781('0x9'));var integrations=require(_0x7781('0xa'));module['exports']=function(_0x59b3f8,_0x2ac93d){return _0x59b3f8['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index aca5d34..9705ac0 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 _0x7de8=['stringify','ShowSalesforceAccount','raw','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','SalesforceAccount','findAll','options','where','include','map','model','attributes','info','GetSalesforceAccount'];(function(_0x57cfb9,_0x244eed){var _0x1d2721=function(_0x4272b1){while(--_0x4272b1){_0x57cfb9['push'](_0x57cfb9['shift']());}};_0x1d2721(++_0x244eed);}(_0x7de8,0x8b));var _0x87de=function(_0x342749,_0x15313b){_0x342749=_0x342749-0x0;var _0x31dad8=_0x7de8[_0x342749];return _0x31dad8;};'use strict';var _=require(_0x87de('0x0'));var util=require(_0x87de('0x1'));var moment=require(_0x87de('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87de('0x3'));var db=require(_0x87de('0x4'))['db'];var utils=require(_0x87de('0x5'));var logger=require(_0x87de('0x6'))(_0x87de('0x7'));var config=require('../../config/environment');var jayson=require(_0x87de('0x8'));var client=jayson[_0x87de('0x9')][_0x87de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x531cc8,_0x552135,_0x364c1e){return new BPromise(function(_0x4bbf6a,_0x3eced5){return client[_0x87de('0xb')](_0x531cc8,_0x364c1e)[_0x87de('0xc')](function(_0x325f54){logger['info'](_0x87de('0xd'),_0x552135,_0x87de('0xe'));logger[_0x87de('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x552135,_0x87de('0xe'),JSON['stringify'](_0x325f54));if(_0x325f54['error']){if(_0x325f54[_0x87de('0x10')][_0x87de('0x11')]===0x1f4){logger[_0x87de('0x10')](_0x87de('0xd'),_0x552135,_0x325f54[_0x87de('0x10')][_0x87de('0x12')]);return _0x3eced5(_0x325f54['error'][_0x87de('0x12')]);}logger['error'](_0x87de('0xd'),_0x552135,_0x325f54[_0x87de('0x10')]['message']);return _0x4bbf6a(_0x325f54[_0x87de('0x10')]['message']);}else{logger['info'](_0x87de('0xd'),_0x552135,_0x87de('0xe'));_0x4bbf6a(_0x325f54[_0x87de('0x13')][_0x87de('0x12')]);}})[_0x87de('0x14')](function(_0x30061a){logger[_0x87de('0x10')](_0x87de('0xd'),_0x552135,_0x30061a);_0x3eced5(_0x30061a);});});}exports['GetSalesforceAccount']=function(_0x1bf69e){var _0x4ca1a6=this;return new Promise(function(_0x365c55,_0x351a79){return db[_0x87de('0x15')][_0x87de('0x16')]({'raw':_0x1bf69e[_0x87de('0x17')]?_0x1bf69e[_0x87de('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1bf69e['options']?_0x1bf69e[_0x87de('0x17')][_0x87de('0x18')]||null:null,'attributes':_0x1bf69e['options']?_0x1bf69e[_0x87de('0x17')]['attributes']||null:null,'limit':_0x1bf69e[_0x87de('0x17')]?_0x1bf69e['options']['limit']||null:null,'include':_0x1bf69e[_0x87de('0x17')]?_0x1bf69e[_0x87de('0x17')][_0x87de('0x19')]?_[_0x87de('0x1a')](_0x1bf69e['options'][_0x87de('0x19')],function(_0x4c5633){return{'model':db[_0x4c5633[_0x87de('0x1b')]],'as':_0x4c5633['as'],'attributes':_0x4c5633[_0x87de('0x1c')],'include':_0x4c5633[_0x87de('0x19')]?_[_0x87de('0x1a')](_0x4c5633[_0x87de('0x19')],function(_0x309ebd){return{'model':db[_0x309ebd[_0x87de('0x1b')]],'as':_0x309ebd['as'],'attributes':_0x309ebd['attributes'],'include':_0x309ebd['include']?_[_0x87de('0x1a')](_0x309ebd['include'],function(_0x51194c){return{'model':db[_0x51194c['model']],'as':_0x51194c['as'],'attributes':_0x51194c[_0x87de('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ff9db){logger[_0x87de('0x1d')](_0x87de('0x1e'),_0x1bf69e);logger[_0x87de('0xf')]('GetSalesforceAccount',_0x1bf69e,JSON[_0x87de('0x1f')](_0x4ff9db));_0x365c55(_0x4ff9db);})[_0x87de('0x14')](function(_0x48e898){logger[_0x87de('0x10')](_0x87de('0x1e'),_0x48e898[_0x87de('0x12')],_0x1bf69e);_0x351a79(_0x4ca1a6['error'](0x1f4,_0x48e898['message']));});});};exports[_0x87de('0x20')]=function(_0x386338){var _0x32db1f=this;return new Promise(function(_0x15d9ba,_0x54a2b1){return db[_0x87de('0x15')]['find']({'raw':_0x386338['options']?_0x386338[_0x87de('0x17')][_0x87de('0x21')]===undefined?!![]:![]:!![],'where':_0x386338[_0x87de('0x17')]?_0x386338['options'][_0x87de('0x18')]||null:null,'attributes':_0x386338[_0x87de('0x17')]?_0x386338[_0x87de('0x17')][_0x87de('0x1c')]||null:null,'include':_0x386338[_0x87de('0x17')]?_0x386338[_0x87de('0x17')]['include']?_[_0x87de('0x1a')](_0x386338[_0x87de('0x17')][_0x87de('0x19')],function(_0x12c2fa){return{'model':db[_0x12c2fa[_0x87de('0x1b')]],'as':_0x12c2fa['as'],'attributes':_0x12c2fa[_0x87de('0x1c')],'include':_0x12c2fa[_0x87de('0x19')]?_[_0x87de('0x1a')](_0x12c2fa[_0x87de('0x19')],function(_0x4e0683){return{'model':db[_0x4e0683[_0x87de('0x1b')]],'as':_0x4e0683['as'],'attributes':_0x4e0683[_0x87de('0x1c')],'include':_0x4e0683[_0x87de('0x19')]?_[_0x87de('0x1a')](_0x4e0683[_0x87de('0x19')],function(_0x340837){return{'model':db[_0x340837['model']],'as':_0x340837['as'],'attributes':_0x340837[_0x87de('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x87de('0xc')](function(_0x4d4a39){logger[_0x87de('0x1d')](_0x87de('0x20'),_0x386338);logger[_0x87de('0xf')](_0x87de('0x20'),_0x386338,JSON['stringify'](_0x4d4a39));_0x15d9ba(_0x4d4a39);})[_0x87de('0x14')](function(_0x2bcccf){logger[_0x87de('0x10')](_0x87de('0x20'),_0x2bcccf[_0x87de('0x12')],_0x386338);_0x54a2b1(_0x32db1f[_0x87de('0x10')](0x1f4,_0x2bcccf['message']));});});}; \ No newline at end of file +var _0x649c=['SalesforceAccount','find','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','GetSalesforceAccount','options','raw','limit','include','map','model','attributes','catch','ShowSalesforceAccount'];(function(_0x2c63a4,_0x18a34f){var _0x210eb8=function(_0x300bb0){while(--_0x300bb0){_0x2c63a4['push'](_0x2c63a4['shift']());}};_0x210eb8(++_0x18a34f);}(_0x649c,0x113));var _0xc649=function(_0x3b2e7e,_0x2dcb12){_0x3b2e7e=_0x3b2e7e-0x0;var _0x32758e=_0x649c[_0x3b2e7e];return _0x32758e;};'use strict';var _=require(_0xc649('0x0'));var util=require(_0xc649('0x1'));var moment=require(_0xc649('0x2'));var BPromise=require('bluebird');var rs=require(_0xc649('0x3'));var fs=require('fs');var Redis=require(_0xc649('0x4'));var db=require(_0xc649('0x5'))['db'];var utils=require(_0xc649('0x6'));var logger=require(_0xc649('0x7'))('rpc');var config=require(_0xc649('0x8'));var jayson=require(_0xc649('0x9'));var client=jayson[_0xc649('0xa')][_0xc649('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ed97b,_0x3e2cb1,_0x333cfd){return new BPromise(function(_0x46ced1,_0x40e575){return client['request'](_0x5ed97b,_0x333cfd)[_0xc649('0xc')](function(_0x54059e){logger[_0xc649('0xd')](_0xc649('0xe'),_0x3e2cb1,'request\x20sent');logger[_0xc649('0xf')](_0xc649('0x10'),_0x3e2cb1,_0xc649('0x11'),JSON['stringify'](_0x54059e));if(_0x54059e['error']){if(_0x54059e[_0xc649('0x12')]['code']===0x1f4){logger[_0xc649('0x12')](_0xc649('0xe'),_0x3e2cb1,_0x54059e['error'][_0xc649('0x13')]);return _0x40e575(_0x54059e['error'][_0xc649('0x13')]);}logger['error'](_0xc649('0xe'),_0x3e2cb1,_0x54059e[_0xc649('0x12')][_0xc649('0x13')]);return _0x46ced1(_0x54059e[_0xc649('0x12')][_0xc649('0x13')]);}else{logger[_0xc649('0xd')](_0xc649('0xe'),_0x3e2cb1,_0xc649('0x11'));_0x46ced1(_0x54059e[_0xc649('0x14')][_0xc649('0x13')]);}})['catch'](function(_0x1e473e){logger[_0xc649('0x12')](_0xc649('0xe'),_0x3e2cb1,_0x1e473e);_0x40e575(_0x1e473e);});});}exports[_0xc649('0x15')]=function(_0x5193e0){var _0x4d2e72=this;return new Promise(function(_0x3b299a,_0x3c151f){return db['SalesforceAccount']['findAll']({'raw':_0x5193e0[_0xc649('0x16')]?_0x5193e0[_0xc649('0x16')][_0xc649('0x17')]===undefined?!![]:![]:!![],'where':_0x5193e0[_0xc649('0x16')]?_0x5193e0['options']['where']||null:null,'attributes':_0x5193e0[_0xc649('0x16')]?_0x5193e0[_0xc649('0x16')]['attributes']||null:null,'limit':_0x5193e0['options']?_0x5193e0['options'][_0xc649('0x18')]||null:null,'include':_0x5193e0[_0xc649('0x16')]?_0x5193e0[_0xc649('0x16')][_0xc649('0x19')]?_['map'](_0x5193e0[_0xc649('0x16')][_0xc649('0x19')],function(_0x1ceb2b){return{'model':db[_0x1ceb2b['model']],'as':_0x1ceb2b['as'],'attributes':_0x1ceb2b['attributes'],'include':_0x1ceb2b[_0xc649('0x19')]?_[_0xc649('0x1a')](_0x1ceb2b[_0xc649('0x19')],function(_0x11989a){return{'model':db[_0x11989a[_0xc649('0x1b')]],'as':_0x11989a['as'],'attributes':_0x11989a[_0xc649('0x1c')],'include':_0x11989a[_0xc649('0x19')]?_[_0xc649('0x1a')](_0x11989a[_0xc649('0x19')],function(_0xa90c23){return{'model':db[_0xa90c23[_0xc649('0x1b')]],'as':_0xa90c23['as'],'attributes':_0xa90c23[_0xc649('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc649('0xc')](function(_0x4822da){logger[_0xc649('0xd')](_0xc649('0x15'),_0x5193e0);logger[_0xc649('0xf')](_0xc649('0x15'),_0x5193e0,JSON['stringify'](_0x4822da));_0x3b299a(_0x4822da);})[_0xc649('0x1d')](function(_0x159fd0){logger[_0xc649('0x12')]('GetSalesforceAccount',_0x159fd0[_0xc649('0x13')],_0x5193e0);_0x3c151f(_0x4d2e72[_0xc649('0x12')](0x1f4,_0x159fd0[_0xc649('0x13')]));});});};exports[_0xc649('0x1e')]=function(_0xda50a6){var _0xadd301=this;return new Promise(function(_0x55facf,_0xebc7c1){return db[_0xc649('0x1f')][_0xc649('0x20')]({'raw':_0xda50a6[_0xc649('0x16')]?_0xda50a6[_0xc649('0x16')][_0xc649('0x17')]===undefined?!![]:![]:!![],'where':_0xda50a6['options']?_0xda50a6['options'][_0xc649('0x21')]||null:null,'attributes':_0xda50a6[_0xc649('0x16')]?_0xda50a6['options'][_0xc649('0x1c')]||null:null,'include':_0xda50a6[_0xc649('0x16')]?_0xda50a6[_0xc649('0x16')][_0xc649('0x19')]?_[_0xc649('0x1a')](_0xda50a6[_0xc649('0x16')][_0xc649('0x19')],function(_0x1b6c7d){return{'model':db[_0x1b6c7d[_0xc649('0x1b')]],'as':_0x1b6c7d['as'],'attributes':_0x1b6c7d[_0xc649('0x1c')],'include':_0x1b6c7d[_0xc649('0x19')]?_[_0xc649('0x1a')](_0x1b6c7d['include'],function(_0x50b544){return{'model':db[_0x50b544[_0xc649('0x1b')]],'as':_0x50b544['as'],'attributes':_0x50b544['attributes'],'include':_0x50b544[_0xc649('0x19')]?_[_0xc649('0x1a')](_0x50b544['include'],function(_0xd39b74){return{'model':db[_0xd39b74[_0xc649('0x1b')]],'as':_0xd39b74['as'],'attributes':_0xd39b74[_0xc649('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc649('0xc')](function(_0x4d0a3a){logger['info'](_0xc649('0x1e'),_0xda50a6);logger[_0xc649('0xf')](_0xc649('0x1e'),_0xda50a6,JSON['stringify'](_0x4d0a3a));_0x55facf(_0x4d0a3a);})[_0xc649('0x1d')](function(_0xbba88c){logger[_0xc649('0x12')](_0xc649('0x1e'),_0xbba88c['message'],_0xda50a6);_0xebc7c1(_0xadd301['error'](0x1f4,_0xbba88c['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 32f9283..d3d89d3 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xdb28,0x106));var _0x8db2=function(_0x4cf203,_0x1fac4f){_0x4cf203=_0x4cf203-0x0;var _0x1ad4b8=_0xdb28[_0x4cf203];return _0x1ad4b8;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x53b8c5,_0x5ad590){var _0x30dc81=function(_0x3fc789){while(--_0x3fc789){_0x53b8c5['push'](_0x53b8c5['shift']());}};_0x30dc81(++_0x5ad590);}(_0xadb5,0xad));var _0x5adb=function(_0x11502c,_0x4b70e0){_0x11502c=_0x11502c-0x0;var _0x4cfb16=_0xadb5[_0x11502c];return _0x4cfb16;};'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('./intSalesforceConfiguration.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('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index fb57543..22b2f9c 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 _0x21eb=['contact','lead','account_contact_lead','account','exports','STRING','Task','Case','ENUM','contact_lead'];(function(_0x59f30a,_0x533ac9){var _0x5c895d=function(_0x2f2a2a){while(--_0x2f2a2a){_0x59f30a['push'](_0x59f30a['shift']());}};_0x5c895d(++_0x533ac9);}(_0x21eb,0xc2));var _0xb21e=function(_0x1d60a4,_0x54b54a){_0x1d60a4=_0x1d60a4-0x0;var _0x4a59a3=_0x21eb[_0x1d60a4];return _0x4a59a3;};'use strict';var Sequelize=require('sequelize');module[_0xb21e('0x0')]={'name':{'type':Sequelize[_0xb21e('0x1')]},'description':{'type':Sequelize[_0xb21e('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xb21e('0x2'),_0xb21e('0x3')),'defaultValue':_0xb21e('0x2')},'moduleSearch':{'type':Sequelize[_0xb21e('0x4')](_0xb21e('0x5'),_0xb21e('0x6'),_0xb21e('0x7'),_0xb21e('0x8'),_0xb21e('0x9')),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0xb21e('0x4')]('nothing',_0xb21e('0x6'),_0xb21e('0x7'),_0xb21e('0x9')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xb21e('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xb21e('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xb21e('0x1')]}}; \ No newline at end of file +var _0x573c=['lead','account_contact_lead','contact_lead','nothing','account','sequelize','exports','STRING','ENUM','Task','Case','contact'];(function(_0x8b9e62,_0x173b44){var _0x31a9a0=function(_0x5cacf7){while(--_0x5cacf7){_0x8b9e62['push'](_0x8b9e62['shift']());}};_0x31a9a0(++_0x173b44);}(_0x573c,0x125));var _0xc573=function(_0x4f0663,_0x229121){_0x4f0663=_0x4f0663-0x0;var _0x19249a=_0x573c[_0x4f0663];return _0x19249a;};'use strict';var Sequelize=require(_0xc573('0x0'));module[_0xc573('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc573('0x2')]},'ticketType':{'type':Sequelize[_0xc573('0x3')](_0xc573('0x4'),_0xc573('0x5')),'defaultValue':_0xc573('0x4')},'moduleSearch':{'type':Sequelize[_0xc573('0x3')]('contact_lead',_0xc573('0x6'),_0xc573('0x7'),_0xc573('0x8'),'account'),'defaultValue':_0xc573('0x9')},'moduleCreate':{'type':Sequelize['ENUM'](_0xc573('0xa'),_0xc573('0x6'),_0xc573('0x7'),_0xc573('0xb')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xc573('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xc573('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xc573('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xc573('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index f8d7057..6bd8d0a 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 _0x8f97=['fast-json-patch','bluebird','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','rows','catch','show','params','keys','include','find','create','body','update','findOne','order','getFields','getSubjects','SalesforceField','getDescriptions','rimraf','zip-dir'];(function(_0x19f9d4,_0x557b37){var _0xc382c6=function(_0x43b537){while(--_0x43b537){_0x19f9d4['push'](_0x19f9d4['shift']());}};_0xc382c6(++_0x557b37);}(_0x8f97,0x13e));var _0x78f9=function(_0x3d6eb1,_0x1f99b1){_0x3d6eb1=_0x3d6eb1-0x0;var _0x4e5356=_0x8f97[_0x3d6eb1];return _0x4e5356;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78f9('0x0'));var zipdir=require(_0x78f9('0x1'));var jsonpatch=require(_0x78f9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x78f9('0x3'));var Mustache=require(_0x78f9('0x4'));var util=require(_0x78f9('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x78f9('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78f9('0x7'));var _=require(_0x78f9('0x8'));var squel=require(_0x78f9('0x9'));var crypto=require('crypto');var jsforce=require(_0x78f9('0xa'));var deskjs=require(_0x78f9('0xb'));var toCsv=require(_0x78f9('0x6'));var querystring=require(_0x78f9('0xc'));var Papa=require(_0x78f9('0xd'));var Redis=require(_0x78f9('0xe'));var authService=require(_0x78f9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x78f9('0x10'));var hardwareService=require(_0x78f9('0x11'));var logger=require(_0x78f9('0x12'))(_0x78f9('0x13'));var utils=require('../../config/utils');var config=require(_0x78f9('0x14'));var licenseUtil=require(_0x78f9('0x15'));var db=require(_0x78f9('0x16'))['db'];function respondWithStatusCode(_0xa0b8b7,_0x517b09){_0x517b09=_0x517b09||0xcc;return function(_0x3812a6){if(_0x3812a6){return _0xa0b8b7[_0x78f9('0x17')](_0x517b09);}return _0xa0b8b7[_0x78f9('0x18')](_0x517b09)['end']();};}function respondWithResult(_0x6dec88,_0x1655fb){_0x1655fb=_0x1655fb||0xc8;return function(_0x343c63){if(_0x343c63){return _0x6dec88['status'](_0x1655fb)[_0x78f9('0x19')](_0x343c63);}};}function respondWithFilteredResult(_0x4e3cbf,_0x3750eb){return function(_0x9ce907){if(_0x9ce907){var _0x355e63=typeof _0x3750eb[_0x78f9('0x1a')]===_0x78f9('0x1b')&&typeof _0x3750eb['limit']===_0x78f9('0x1b');var _0xfda7cf=_0x9ce907[_0x78f9('0x1c')];var _0x209f2f=_0x355e63?0x0:_0x3750eb[_0x78f9('0x1a')];var _0x534d6c=_0x355e63?_0x9ce907[_0x78f9('0x1c')]:_0x3750eb['offset']+_0x3750eb[_0x78f9('0x1d')];var _0x3a46df;if(_0x534d6c>=_0xfda7cf){_0x534d6c=_0xfda7cf;_0x3a46df=0xc8;}else{_0x3a46df=0xce;}_0x4e3cbf[_0x78f9('0x18')](_0x3a46df);return _0x4e3cbf[_0x78f9('0x1e')](_0x78f9('0x1f'),_0x209f2f+'-'+_0x534d6c+'/'+_0xfda7cf)['json'](_0x9ce907);}return null;};}function patchUpdates(_0x7e5f7d){return function(_0x4e6e67){try{jsonpatch[_0x78f9('0x20')](_0x4e6e67,_0x7e5f7d,!![]);}catch(_0x3bbda5){return BPromise[_0x78f9('0x21')](_0x3bbda5);}return _0x4e6e67[_0x78f9('0x22')]();};}function saveUpdates(_0x1f75e6,_0x54a9b3){return function(_0x2d42ee){if(_0x2d42ee){return _0x2d42ee['update'](_0x1f75e6)[_0x78f9('0x23')](function(_0x544106){return _0x544106;});}return null;};}function removeEntity(_0x43b71a,_0x13c101){return function(_0x53b187){if(_0x53b187){return _0x53b187[_0x78f9('0x24')]()[_0x78f9('0x23')](function(){_0x43b71a[_0x78f9('0x18')](0xcc)[_0x78f9('0x25')]();});}};}function handleEntityNotFound(_0x211406,_0xe3f4f8){return function(_0x29740d){if(!_0x29740d){_0x211406['sendStatus'](0x194);}return _0x29740d;};}function handleError(_0x3b6119,_0x276e6d){_0x276e6d=_0x276e6d||0x1f4;return function(_0x3c6b71){logger[_0x78f9('0x26')](_0x3c6b71[_0x78f9('0x27')]);if(_0x3c6b71['name']){delete _0x3c6b71[_0x78f9('0x28')];}_0x3b6119[_0x78f9('0x18')](_0x276e6d)[_0x78f9('0x29')](_0x3c6b71);};}exports[_0x78f9('0x2a')]=function(_0x1153d5,_0x2d26a6){var _0x1cb295={},_0x1f8ec6={},_0x2eedbf={'count':0x0,'rows':[]};var _0x2762ca=_[_0x78f9('0x2b')](db['SalesforceConfiguration'][_0x78f9('0x2c')],function(_0x2337e1){return{'name':_0x2337e1['fieldName'],'type':_0x2337e1['type'][_0x78f9('0x2d')]};});_0x1f8ec6[_0x78f9('0x2e')]=_[_0x78f9('0x2b')](_0x2762ca,_0x78f9('0x28'));_0x1f8ec6[_0x78f9('0x2f')]=_['keys'](_0x1153d5['query']);_0x1f8ec6[_0x78f9('0x30')]=_[_0x78f9('0x31')](_0x1f8ec6[_0x78f9('0x2e')],_0x1f8ec6[_0x78f9('0x2f')]);_0x1cb295[_0x78f9('0x32')]=_['intersection'](_0x1f8ec6['model'],qs[_0x78f9('0x33')](_0x1153d5['query']['fields']));_0x1cb295[_0x78f9('0x32')]=_0x1cb295['attributes'][_0x78f9('0x34')]?_0x1cb295['attributes']:_0x1f8ec6[_0x78f9('0x2e')];if(!_0x1153d5[_0x78f9('0x2f')][_0x78f9('0x35')](_0x78f9('0x36'))){_0x1cb295[_0x78f9('0x1d')]=qs[_0x78f9('0x1d')](_0x1153d5[_0x78f9('0x2f')][_0x78f9('0x1d')]);_0x1cb295[_0x78f9('0x1a')]=qs[_0x78f9('0x1a')](_0x1153d5[_0x78f9('0x2f')]['offset']);}_0x1cb295['order']=qs[_0x78f9('0x37')](_0x1153d5[_0x78f9('0x2f')][_0x78f9('0x37')]);_0x1cb295[_0x78f9('0x38')]=qs[_0x78f9('0x30')](_[_0x78f9('0x39')](_0x1153d5[_0x78f9('0x2f')],_0x1f8ec6['filters']),_0x2762ca);if(_0x1153d5[_0x78f9('0x2f')][_0x78f9('0x3a')]){_0x1cb295[_0x78f9('0x38')]=_['merge'](_0x1cb295[_0x78f9('0x38')],{'$or':_['map'](_0x2762ca,function(_0x2b08b5){if(_0x2b08b5['type']!==_0x78f9('0x3b')){var _0x24f787={};_0x24f787[_0x2b08b5[_0x78f9('0x28')]]={'$like':'%'+_0x1153d5['query'][_0x78f9('0x3a')]+'%'};return _0x24f787;}})});}_0x1cb295=_[_0x78f9('0x3c')]({},_0x1cb295,_0x1153d5[_0x78f9('0x3d')]);var _0x2846c3={'where':_0x1cb295[_0x78f9('0x38')]};return db[_0x78f9('0x3e')][_0x78f9('0x1c')](_0x2846c3)[_0x78f9('0x23')](function(_0x40750b){_0x2eedbf[_0x78f9('0x1c')]=_0x40750b;if(_0x1153d5['query'][_0x78f9('0x3f')]){_0x1cb295['include']=[{'all':!![]}];}return db[_0x78f9('0x3e')]['findAll'](_0x1cb295);})[_0x78f9('0x23')](function(_0x3086b0){_0x2eedbf[_0x78f9('0x40')]=_0x3086b0;return _0x2eedbf;})[_0x78f9('0x23')](respondWithFilteredResult(_0x2d26a6,_0x1cb295))[_0x78f9('0x41')](handleError(_0x2d26a6,null));};exports[_0x78f9('0x42')]=function(_0x6b4c69,_0x351786){var _0x9c7674={'raw':![],'where':{'id':_0x6b4c69[_0x78f9('0x43')]['id']}},_0x4ab9b7={};_0x4ab9b7['model']=_[_0x78f9('0x44')](db['SalesforceConfiguration']['rawAttributes']);_0x4ab9b7[_0x78f9('0x2f')]=_[_0x78f9('0x44')](_0x6b4c69[_0x78f9('0x2f')]);_0x4ab9b7['filters']=_[_0x78f9('0x31')](_0x4ab9b7['model'],_0x4ab9b7[_0x78f9('0x2f')]);_0x9c7674[_0x78f9('0x32')]=_[_0x78f9('0x31')](_0x4ab9b7['model'],qs[_0x78f9('0x33')](_0x6b4c69[_0x78f9('0x2f')][_0x78f9('0x33')]));_0x9c7674[_0x78f9('0x32')]=_0x9c7674[_0x78f9('0x32')][_0x78f9('0x34')]?_0x9c7674[_0x78f9('0x32')]:_0x4ab9b7['model'];if(_0x6b4c69[_0x78f9('0x2f')]['includeAll']){_0x9c7674[_0x78f9('0x45')]=[{'all':!![]}];}_0x9c7674=_[_0x78f9('0x3c')]({},_0x9c7674,_0x6b4c69[_0x78f9('0x3d')]);return db[_0x78f9('0x3e')][_0x78f9('0x46')](_0x9c7674)[_0x78f9('0x23')](handleEntityNotFound(_0x351786,null))[_0x78f9('0x23')](respondWithResult(_0x351786,null))[_0x78f9('0x41')](handleError(_0x351786,null));};exports[_0x78f9('0x47')]=function(_0xcc7e2b,_0x12587f){return db[_0x78f9('0x3e')][_0x78f9('0x47')](_0xcc7e2b[_0x78f9('0x48')],{})['then'](respondWithResult(_0x12587f,0xc9))['catch'](handleError(_0x12587f,null));};exports[_0x78f9('0x49')]=function(_0x37cec7,_0x40f00){if(_0x37cec7['body']['id']){delete _0x37cec7[_0x78f9('0x48')]['id'];}return db[_0x78f9('0x3e')][_0x78f9('0x46')]({'where':{'id':_0x37cec7[_0x78f9('0x43')]['id']}})[_0x78f9('0x23')](handleEntityNotFound(_0x40f00,null))['then'](saveUpdates(_0x37cec7['body'],null))[_0x78f9('0x23')](respondWithResult(_0x40f00,null))[_0x78f9('0x41')](handleError(_0x40f00,null));};exports[_0x78f9('0x24')]=function(_0x2767d1,_0x3dfaa5){return db[_0x78f9('0x3e')][_0x78f9('0x46')]({'where':{'id':_0x2767d1[_0x78f9('0x43')]['id']}})[_0x78f9('0x23')](handleEntityNotFound(_0x3dfaa5,null))['then'](removeEntity(_0x3dfaa5,null))[_0x78f9('0x41')](handleError(_0x3dfaa5,null));};exports['getFields']=function(_0x1c931b,_0x247920,_0x5d4714){var _0x52c1f3={};var _0xa09bb9={};var _0x3ddd03;var _0x34d027;return db[_0x78f9('0x3e')][_0x78f9('0x4a')]({'where':{'id':_0x1c931b[_0x78f9('0x43')]['id']}})[_0x78f9('0x23')](handleEntityNotFound(_0x247920,null))[_0x78f9('0x23')](function(_0x694ebd){if(_0x694ebd){_0x3ddd03=_0x694ebd;_0xa09bb9[_0x78f9('0x2e')]=_[_0x78f9('0x44')](db['SalesforceField']['rawAttributes']);_0xa09bb9[_0x78f9('0x2f')]=_[_0x78f9('0x44')](_0x1c931b[_0x78f9('0x2f')]);_0xa09bb9[_0x78f9('0x30')]=_[_0x78f9('0x31')](_0xa09bb9[_0x78f9('0x2e')],_0xa09bb9[_0x78f9('0x2f')]);_0x52c1f3[_0x78f9('0x32')]=_[_0x78f9('0x31')](_0xa09bb9[_0x78f9('0x2e')],qs['fields'](_0x1c931b[_0x78f9('0x2f')][_0x78f9('0x33')]));_0x52c1f3[_0x78f9('0x32')]=_0x52c1f3[_0x78f9('0x32')][_0x78f9('0x34')]?_0x52c1f3['attributes']:_0xa09bb9[_0x78f9('0x2e')];_0x52c1f3[_0x78f9('0x4b')]=qs[_0x78f9('0x37')](_0x1c931b[_0x78f9('0x2f')]['sort']);_0x52c1f3['where']=qs['filters'](_[_0x78f9('0x39')](_0x1c931b['query'],_0xa09bb9['filters']));if(_0x1c931b[_0x78f9('0x2f')][_0x78f9('0x3a')]){_0x52c1f3[_0x78f9('0x38')]=_[_0x78f9('0x3c')](_0x52c1f3[_0x78f9('0x38')],{'$or':_[_0x78f9('0x2b')](_0x52c1f3[_0x78f9('0x32')],function(_0x714320){var _0x5c2f25={};_0x5c2f25[_0x714320]={'$like':'%'+_0x1c931b['query'][_0x78f9('0x3a')]+'%'};return _0x5c2f25;})});}_0x52c1f3=_['merge']({},_0x52c1f3,_0x1c931b['options']);return _0x3ddd03[_0x78f9('0x4c')](_0x52c1f3);}})['then'](function(_0x491aff){if(_0x491aff){_0x34d027=_0x491aff[_0x78f9('0x34')];if(!_0x1c931b[_0x78f9('0x2f')][_0x78f9('0x35')](_0x78f9('0x36'))){_0x52c1f3['limit']=qs['limit'](_0x1c931b['query']['limit']);_0x52c1f3[_0x78f9('0x1a')]=qs[_0x78f9('0x1a')](_0x1c931b[_0x78f9('0x2f')][_0x78f9('0x1a')]);}return _0x3ddd03[_0x78f9('0x4c')](_0x52c1f3);}})[_0x78f9('0x23')](function(_0x1cc0b3){if(_0x1cc0b3){return _0x1cc0b3?{'count':_0x34d027,'rows':_0x1cc0b3}:null;}})[_0x78f9('0x23')](respondWithResult(_0x247920,null))[_0x78f9('0x41')](handleError(_0x247920,null));};exports[_0x78f9('0x4d')]=function(_0x3cdc8a,_0x480459,_0x9633c2){var _0x2e5a40={};var _0x47ed25={};var _0x5a94f7;var _0x5e193d;return db[_0x78f9('0x3e')]['findOne']({'where':{'id':_0x3cdc8a['params']['id']}})[_0x78f9('0x23')](handleEntityNotFound(_0x480459,null))[_0x78f9('0x23')](function(_0x3bc8fb){if(_0x3bc8fb){_0x5a94f7=_0x3bc8fb;_0x47ed25[_0x78f9('0x2e')]=_[_0x78f9('0x44')](db[_0x78f9('0x4e')]['rawAttributes']);_0x47ed25[_0x78f9('0x2f')]=_['keys'](_0x3cdc8a[_0x78f9('0x2f')]);_0x47ed25['filters']=_[_0x78f9('0x31')](_0x47ed25[_0x78f9('0x2e')],_0x47ed25[_0x78f9('0x2f')]);_0x2e5a40['attributes']=_[_0x78f9('0x31')](_0x47ed25[_0x78f9('0x2e')],qs[_0x78f9('0x33')](_0x3cdc8a[_0x78f9('0x2f')][_0x78f9('0x33')]));_0x2e5a40[_0x78f9('0x32')]=_0x2e5a40[_0x78f9('0x32')]['length']?_0x2e5a40[_0x78f9('0x32')]:_0x47ed25[_0x78f9('0x2e')];_0x2e5a40['order']=qs[_0x78f9('0x37')](_0x3cdc8a[_0x78f9('0x2f')][_0x78f9('0x37')]);_0x2e5a40[_0x78f9('0x38')]=qs[_0x78f9('0x30')](_[_0x78f9('0x39')](_0x3cdc8a[_0x78f9('0x2f')],_0x47ed25[_0x78f9('0x30')]));if(_0x3cdc8a[_0x78f9('0x2f')]['filter']){_0x2e5a40[_0x78f9('0x38')]=_['merge'](_0x2e5a40[_0x78f9('0x38')],{'$or':_[_0x78f9('0x2b')](_0x2e5a40[_0x78f9('0x32')],function(_0x31de0c){var _0x2a3dcc={};_0x2a3dcc[_0x31de0c]={'$like':'%'+_0x3cdc8a[_0x78f9('0x2f')][_0x78f9('0x3a')]+'%'};return _0x2a3dcc;})});}_0x2e5a40=_[_0x78f9('0x3c')]({},_0x2e5a40,_0x3cdc8a['options']);return _0x5a94f7[_0x78f9('0x4d')](_0x2e5a40);}})[_0x78f9('0x23')](function(_0x41b7ac){if(_0x41b7ac){_0x5e193d=_0x41b7ac[_0x78f9('0x34')];if(!_0x3cdc8a[_0x78f9('0x2f')]['hasOwnProperty'](_0x78f9('0x36'))){_0x2e5a40[_0x78f9('0x1d')]=qs['limit'](_0x3cdc8a[_0x78f9('0x2f')][_0x78f9('0x1d')]);_0x2e5a40[_0x78f9('0x1a')]=qs[_0x78f9('0x1a')](_0x3cdc8a['query'][_0x78f9('0x1a')]);}return _0x5a94f7[_0x78f9('0x4d')](_0x2e5a40);}})[_0x78f9('0x23')](function(_0x20c073){if(_0x20c073){return _0x20c073?{'count':_0x5e193d,'rows':_0x20c073}:null;}})[_0x78f9('0x23')](respondWithResult(_0x480459,null))[_0x78f9('0x41')](handleError(_0x480459,null));};exports[_0x78f9('0x4f')]=function(_0x286045,_0x91fb80,_0x32c1b5){var _0x56fab8={};var _0x341c49={};var _0x3058e4;var _0x591426;return db[_0x78f9('0x3e')][_0x78f9('0x4a')]({'where':{'id':_0x286045[_0x78f9('0x43')]['id']}})[_0x78f9('0x23')](handleEntityNotFound(_0x91fb80,null))[_0x78f9('0x23')](function(_0x21f8ce){if(_0x21f8ce){_0x3058e4=_0x21f8ce;_0x341c49[_0x78f9('0x2e')]=_[_0x78f9('0x44')](db[_0x78f9('0x4e')][_0x78f9('0x2c')]);_0x341c49[_0x78f9('0x2f')]=_[_0x78f9('0x44')](_0x286045['query']);_0x341c49[_0x78f9('0x30')]=_[_0x78f9('0x31')](_0x341c49[_0x78f9('0x2e')],_0x341c49['query']);_0x56fab8['attributes']=_[_0x78f9('0x31')](_0x341c49[_0x78f9('0x2e')],qs['fields'](_0x286045[_0x78f9('0x2f')][_0x78f9('0x33')]));_0x56fab8['attributes']=_0x56fab8['attributes'][_0x78f9('0x34')]?_0x56fab8[_0x78f9('0x32')]:_0x341c49[_0x78f9('0x2e')];_0x56fab8[_0x78f9('0x4b')]=qs[_0x78f9('0x37')](_0x286045[_0x78f9('0x2f')][_0x78f9('0x37')]);_0x56fab8['where']=qs[_0x78f9('0x30')](_[_0x78f9('0x39')](_0x286045[_0x78f9('0x2f')],_0x341c49[_0x78f9('0x30')]));if(_0x286045[_0x78f9('0x2f')][_0x78f9('0x3a')]){_0x56fab8[_0x78f9('0x38')]=_[_0x78f9('0x3c')](_0x56fab8['where'],{'$or':_[_0x78f9('0x2b')](_0x56fab8[_0x78f9('0x32')],function(_0x225c0c){var _0x2850e3={};_0x2850e3[_0x225c0c]={'$like':'%'+_0x286045[_0x78f9('0x2f')][_0x78f9('0x3a')]+'%'};return _0x2850e3;})});}_0x56fab8=_[_0x78f9('0x3c')]({},_0x56fab8,_0x286045['options']);return _0x3058e4[_0x78f9('0x4f')](_0x56fab8);}})[_0x78f9('0x23')](function(_0xc19f57){if(_0xc19f57){_0x591426=_0xc19f57[_0x78f9('0x34')];if(!_0x286045[_0x78f9('0x2f')][_0x78f9('0x35')](_0x78f9('0x36'))){_0x56fab8[_0x78f9('0x1d')]=qs[_0x78f9('0x1d')](_0x286045['query'][_0x78f9('0x1d')]);_0x56fab8[_0x78f9('0x1a')]=qs['offset'](_0x286045[_0x78f9('0x2f')][_0x78f9('0x1a')]);}return _0x3058e4[_0x78f9('0x4f')](_0x56fab8);}})['then'](function(_0x33ffe8){if(_0x33ffe8){return _0x33ffe8?{'count':_0x591426,'rows':_0x33ffe8}:null;}})[_0x78f9('0x23')](respondWithResult(_0x91fb80,null))[_0x78f9('0x41')](handleError(_0x91fb80,null));}; \ No newline at end of file +var _0x2c79=['length','nolimit','order','sort','pick','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes'];(function(_0x4f8938,_0xb5503a){var _0x141fa3=function(_0x2ac848){while(--_0x2ac848){_0x4f8938['push'](_0x4f8938['shift']());}};_0x141fa3(++_0xb5503a);}(_0x2c79,0x106));var _0x92c7=function(_0x2088c8,_0x390a07){_0x2088c8=_0x2088c8-0x0;var _0x4db9fb=_0x2c79[_0x2088c8];return _0x4db9fb;};'use strict';var emlformat=require(_0x92c7('0x0'));var rimraf=require(_0x92c7('0x1'));var zipdir=require(_0x92c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92c7('0x3'));var moment=require(_0x92c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x92c7('0x5'));var util=require('util');var path=require(_0x92c7('0x6'));var sox=require(_0x92c7('0x7'));var csv=require(_0x92c7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x92c7('0x9'));var _=require('lodash');var squel=require(_0x92c7('0xa'));var crypto=require(_0x92c7('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x92c7('0xc'));var toCsv=require(_0x92c7('0x8'));var querystring=require('querystring');var Papa=require(_0x92c7('0xd'));var Redis=require(_0x92c7('0xe'));var authService=require(_0x92c7('0xf'));var qs=require(_0x92c7('0x10'));var as=require(_0x92c7('0x11'));var hardwareService=require(_0x92c7('0x12'));var logger=require('../../config/logger')(_0x92c7('0x13'));var utils=require(_0x92c7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x92c7('0x15'))['db'];function respondWithStatusCode(_0x137f33,_0x12ffc5){_0x12ffc5=_0x12ffc5||0xcc;return function(_0x4f48b1){if(_0x4f48b1){return _0x137f33[_0x92c7('0x16')](_0x12ffc5);}return _0x137f33[_0x92c7('0x17')](_0x12ffc5)['end']();};}function respondWithResult(_0x32e862,_0x3eeba6){_0x3eeba6=_0x3eeba6||0xc8;return function(_0x208a7a){if(_0x208a7a){return _0x32e862[_0x92c7('0x17')](_0x3eeba6)[_0x92c7('0x18')](_0x208a7a);}};}function respondWithFilteredResult(_0x53b8b3,_0x47f75d){return function(_0x16aa68){if(_0x16aa68){var _0x5b6e1c=typeof _0x47f75d[_0x92c7('0x19')]===_0x92c7('0x1a')&&typeof _0x47f75d[_0x92c7('0x1b')]===_0x92c7('0x1a');var _0x3bb57d=_0x16aa68[_0x92c7('0x1c')];var _0x33f0b6=_0x5b6e1c?0x0:_0x47f75d[_0x92c7('0x19')];var _0x1b0dea=_0x5b6e1c?_0x16aa68[_0x92c7('0x1c')]:_0x47f75d['offset']+_0x47f75d['limit'];var _0x45ae38;if(_0x1b0dea>=_0x3bb57d){_0x1b0dea=_0x3bb57d;_0x45ae38=0xc8;}else{_0x45ae38=0xce;}_0x53b8b3[_0x92c7('0x17')](_0x45ae38);return _0x53b8b3[_0x92c7('0x1d')](_0x92c7('0x1e'),_0x33f0b6+'-'+_0x1b0dea+'/'+_0x3bb57d)[_0x92c7('0x18')](_0x16aa68);}return null;};}function patchUpdates(_0x1f7f1b){return function(_0xc5ff3a){try{jsonpatch['apply'](_0xc5ff3a,_0x1f7f1b,!![]);}catch(_0x37368d){return BPromise[_0x92c7('0x1f')](_0x37368d);}return _0xc5ff3a[_0x92c7('0x20')]();};}function saveUpdates(_0x35131b,_0xe3ad22){return function(_0x27e529){if(_0x27e529){return _0x27e529[_0x92c7('0x21')](_0x35131b)[_0x92c7('0x22')](function(_0x278c37){return _0x278c37;});}return null;};}function removeEntity(_0x429003,_0x4f9bf1){return function(_0x3afab9){if(_0x3afab9){return _0x3afab9[_0x92c7('0x23')]()[_0x92c7('0x22')](function(){_0x429003[_0x92c7('0x17')](0xcc)[_0x92c7('0x24')]();});}};}function handleEntityNotFound(_0x44f830,_0x508ddb){return function(_0x2f35cc){if(!_0x2f35cc){_0x44f830['sendStatus'](0x194);}return _0x2f35cc;};}function handleError(_0x35fdf0,_0x5eee43){_0x5eee43=_0x5eee43||0x1f4;return function(_0x22d0b0){logger[_0x92c7('0x25')](_0x22d0b0[_0x92c7('0x26')]);if(_0x22d0b0[_0x92c7('0x27')]){delete _0x22d0b0[_0x92c7('0x27')];}_0x35fdf0[_0x92c7('0x17')](_0x5eee43)[_0x92c7('0x28')](_0x22d0b0);};}exports[_0x92c7('0x29')]=function(_0x200ccf,_0x4cb3c1){var _0x3b023a={},_0x5838ab={},_0x1fb046={'count':0x0,'rows':[]};var _0x5129ba=_[_0x92c7('0x2a')](db[_0x92c7('0x2b')][_0x92c7('0x2c')],function(_0x754b70){return{'name':_0x754b70['fieldName'],'type':_0x754b70[_0x92c7('0x2d')][_0x92c7('0x2e')]};});_0x5838ab[_0x92c7('0x2f')]=_[_0x92c7('0x2a')](_0x5129ba,_0x92c7('0x27'));_0x5838ab['query']=_[_0x92c7('0x30')](_0x200ccf[_0x92c7('0x31')]);_0x5838ab[_0x92c7('0x32')]=_[_0x92c7('0x33')](_0x5838ab[_0x92c7('0x2f')],_0x5838ab[_0x92c7('0x31')]);_0x3b023a['attributes']=_['intersection'](_0x5838ab[_0x92c7('0x2f')],qs[_0x92c7('0x34')](_0x200ccf['query'][_0x92c7('0x34')]));_0x3b023a['attributes']=_0x3b023a[_0x92c7('0x35')][_0x92c7('0x36')]?_0x3b023a[_0x92c7('0x35')]:_0x5838ab[_0x92c7('0x2f')];if(!_0x200ccf[_0x92c7('0x31')]['hasOwnProperty'](_0x92c7('0x37'))){_0x3b023a[_0x92c7('0x1b')]=qs[_0x92c7('0x1b')](_0x200ccf[_0x92c7('0x31')][_0x92c7('0x1b')]);_0x3b023a[_0x92c7('0x19')]=qs[_0x92c7('0x19')](_0x200ccf['query'][_0x92c7('0x19')]);}_0x3b023a[_0x92c7('0x38')]=qs[_0x92c7('0x39')](_0x200ccf['query'][_0x92c7('0x39')]);_0x3b023a['where']=qs[_0x92c7('0x32')](_[_0x92c7('0x3a')](_0x200ccf[_0x92c7('0x31')],_0x5838ab[_0x92c7('0x32')]),_0x5129ba);if(_0x200ccf[_0x92c7('0x31')]['filter']){_0x3b023a[_0x92c7('0x3b')]=_[_0x92c7('0x3c')](_0x3b023a[_0x92c7('0x3b')],{'$or':_[_0x92c7('0x2a')](_0x5129ba,function(_0x4da093){if(_0x4da093[_0x92c7('0x2d')]!=='VIRTUAL'){var _0x35798f={};_0x35798f[_0x4da093[_0x92c7('0x27')]]={'$like':'%'+_0x200ccf[_0x92c7('0x31')][_0x92c7('0x3d')]+'%'};return _0x35798f;}})});}_0x3b023a=_['merge']({},_0x3b023a,_0x200ccf[_0x92c7('0x3e')]);var _0x2764f7={'where':_0x3b023a[_0x92c7('0x3b')]};return db[_0x92c7('0x2b')][_0x92c7('0x1c')](_0x2764f7)[_0x92c7('0x22')](function(_0x4b7850){_0x1fb046['count']=_0x4b7850;if(_0x200ccf[_0x92c7('0x31')][_0x92c7('0x3f')]){_0x3b023a[_0x92c7('0x40')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x92c7('0x41')](_0x3b023a);})[_0x92c7('0x22')](function(_0x324c90){_0x1fb046[_0x92c7('0x42')]=_0x324c90;return _0x1fb046;})[_0x92c7('0x22')](respondWithFilteredResult(_0x4cb3c1,_0x3b023a))[_0x92c7('0x43')](handleError(_0x4cb3c1,null));};exports[_0x92c7('0x44')]=function(_0x1926f7,_0x40d63f){var _0x2a3095={'raw':![],'where':{'id':_0x1926f7[_0x92c7('0x45')]['id']}},_0x559bf0={};_0x559bf0[_0x92c7('0x2f')]=_[_0x92c7('0x30')](db['SalesforceConfiguration']['rawAttributes']);_0x559bf0[_0x92c7('0x31')]=_[_0x92c7('0x30')](_0x1926f7[_0x92c7('0x31')]);_0x559bf0['filters']=_[_0x92c7('0x33')](_0x559bf0['model'],_0x559bf0[_0x92c7('0x31')]);_0x2a3095['attributes']=_['intersection'](_0x559bf0['model'],qs[_0x92c7('0x34')](_0x1926f7[_0x92c7('0x31')][_0x92c7('0x34')]));_0x2a3095[_0x92c7('0x35')]=_0x2a3095['attributes']['length']?_0x2a3095[_0x92c7('0x35')]:_0x559bf0[_0x92c7('0x2f')];if(_0x1926f7[_0x92c7('0x31')]['includeAll']){_0x2a3095[_0x92c7('0x40')]=[{'all':!![]}];}_0x2a3095=_[_0x92c7('0x3c')]({},_0x2a3095,_0x1926f7[_0x92c7('0x3e')]);return db[_0x92c7('0x2b')][_0x92c7('0x46')](_0x2a3095)[_0x92c7('0x22')](handleEntityNotFound(_0x40d63f,null))[_0x92c7('0x22')](respondWithResult(_0x40d63f,null))['catch'](handleError(_0x40d63f,null));};exports[_0x92c7('0x47')]=function(_0x195d1c,_0x4cceed){return db[_0x92c7('0x2b')][_0x92c7('0x47')](_0x195d1c[_0x92c7('0x48')],{})[_0x92c7('0x22')](respondWithResult(_0x4cceed,0xc9))['catch'](handleError(_0x4cceed,null));};exports['update']=function(_0x4c8456,_0x435c28){if(_0x4c8456['body']['id']){delete _0x4c8456[_0x92c7('0x48')]['id'];}return db['SalesforceConfiguration'][_0x92c7('0x46')]({'where':{'id':_0x4c8456[_0x92c7('0x45')]['id']}})[_0x92c7('0x22')](handleEntityNotFound(_0x435c28,null))[_0x92c7('0x22')](saveUpdates(_0x4c8456[_0x92c7('0x48')],null))[_0x92c7('0x22')](respondWithResult(_0x435c28,null))['catch'](handleError(_0x435c28,null));};exports[_0x92c7('0x23')]=function(_0xf090e2,_0x444b54){return db[_0x92c7('0x2b')]['find']({'where':{'id':_0xf090e2[_0x92c7('0x45')]['id']}})[_0x92c7('0x22')](handleEntityNotFound(_0x444b54,null))[_0x92c7('0x22')](removeEntity(_0x444b54,null))[_0x92c7('0x43')](handleError(_0x444b54,null));};exports[_0x92c7('0x49')]=function(_0x2266cb,_0x480b10,_0x5813e8){var _0x42c83c={};var _0x1d1bad={};var _0x1aba2f;var _0x16a61b;return db[_0x92c7('0x2b')][_0x92c7('0x4a')]({'where':{'id':_0x2266cb[_0x92c7('0x45')]['id']}})[_0x92c7('0x22')](handleEntityNotFound(_0x480b10,null))['then'](function(_0xf5e798){if(_0xf5e798){_0x1aba2f=_0xf5e798;_0x1d1bad['model']=_['keys'](db[_0x92c7('0x4b')][_0x92c7('0x2c')]);_0x1d1bad[_0x92c7('0x31')]=_['keys'](_0x2266cb[_0x92c7('0x31')]);_0x1d1bad[_0x92c7('0x32')]=_[_0x92c7('0x33')](_0x1d1bad[_0x92c7('0x2f')],_0x1d1bad[_0x92c7('0x31')]);_0x42c83c[_0x92c7('0x35')]=_[_0x92c7('0x33')](_0x1d1bad[_0x92c7('0x2f')],qs[_0x92c7('0x34')](_0x2266cb[_0x92c7('0x31')][_0x92c7('0x34')]));_0x42c83c[_0x92c7('0x35')]=_0x42c83c['attributes'][_0x92c7('0x36')]?_0x42c83c[_0x92c7('0x35')]:_0x1d1bad[_0x92c7('0x2f')];_0x42c83c[_0x92c7('0x38')]=qs[_0x92c7('0x39')](_0x2266cb[_0x92c7('0x31')][_0x92c7('0x39')]);_0x42c83c[_0x92c7('0x3b')]=qs[_0x92c7('0x32')](_[_0x92c7('0x3a')](_0x2266cb[_0x92c7('0x31')],_0x1d1bad[_0x92c7('0x32')]));if(_0x2266cb[_0x92c7('0x31')][_0x92c7('0x3d')]){_0x42c83c['where']=_[_0x92c7('0x3c')](_0x42c83c[_0x92c7('0x3b')],{'$or':_['map'](_0x42c83c[_0x92c7('0x35')],function(_0x2c42bc){var _0x335ee5={};_0x335ee5[_0x2c42bc]={'$like':'%'+_0x2266cb[_0x92c7('0x31')][_0x92c7('0x3d')]+'%'};return _0x335ee5;})});}_0x42c83c=_[_0x92c7('0x3c')]({},_0x42c83c,_0x2266cb[_0x92c7('0x3e')]);return _0x1aba2f[_0x92c7('0x49')](_0x42c83c);}})[_0x92c7('0x22')](function(_0x5c3c5f){if(_0x5c3c5f){_0x16a61b=_0x5c3c5f[_0x92c7('0x36')];if(!_0x2266cb[_0x92c7('0x31')][_0x92c7('0x4c')](_0x92c7('0x37'))){_0x42c83c['limit']=qs[_0x92c7('0x1b')](_0x2266cb[_0x92c7('0x31')]['limit']);_0x42c83c[_0x92c7('0x19')]=qs['offset'](_0x2266cb[_0x92c7('0x31')][_0x92c7('0x19')]);}return _0x1aba2f[_0x92c7('0x49')](_0x42c83c);}})[_0x92c7('0x22')](function(_0x1b0f4e){if(_0x1b0f4e){return _0x1b0f4e?{'count':_0x16a61b,'rows':_0x1b0f4e}:null;}})[_0x92c7('0x22')](respondWithResult(_0x480b10,null))['catch'](handleError(_0x480b10,null));};exports[_0x92c7('0x4d')]=function(_0x2fd2a8,_0x329330,_0xa1661f){var _0x3df7fc={};var _0x293fab={};var _0x403275;var _0x6e4351;return db['SalesforceConfiguration'][_0x92c7('0x4a')]({'where':{'id':_0x2fd2a8[_0x92c7('0x45')]['id']}})[_0x92c7('0x22')](handleEntityNotFound(_0x329330,null))[_0x92c7('0x22')](function(_0x26a466){if(_0x26a466){_0x403275=_0x26a466;_0x293fab['model']=_[_0x92c7('0x30')](db[_0x92c7('0x4b')][_0x92c7('0x2c')]);_0x293fab[_0x92c7('0x31')]=_[_0x92c7('0x30')](_0x2fd2a8['query']);_0x293fab['filters']=_[_0x92c7('0x33')](_0x293fab[_0x92c7('0x2f')],_0x293fab[_0x92c7('0x31')]);_0x3df7fc[_0x92c7('0x35')]=_[_0x92c7('0x33')](_0x293fab[_0x92c7('0x2f')],qs[_0x92c7('0x34')](_0x2fd2a8[_0x92c7('0x31')][_0x92c7('0x34')]));_0x3df7fc['attributes']=_0x3df7fc[_0x92c7('0x35')][_0x92c7('0x36')]?_0x3df7fc[_0x92c7('0x35')]:_0x293fab[_0x92c7('0x2f')];_0x3df7fc[_0x92c7('0x38')]=qs['sort'](_0x2fd2a8[_0x92c7('0x31')][_0x92c7('0x39')]);_0x3df7fc[_0x92c7('0x3b')]=qs[_0x92c7('0x32')](_['pick'](_0x2fd2a8['query'],_0x293fab[_0x92c7('0x32')]));if(_0x2fd2a8['query']['filter']){_0x3df7fc[_0x92c7('0x3b')]=_[_0x92c7('0x3c')](_0x3df7fc[_0x92c7('0x3b')],{'$or':_[_0x92c7('0x2a')](_0x3df7fc[_0x92c7('0x35')],function(_0x412e78){var _0x55893b={};_0x55893b[_0x412e78]={'$like':'%'+_0x2fd2a8[_0x92c7('0x31')][_0x92c7('0x3d')]+'%'};return _0x55893b;})});}_0x3df7fc=_[_0x92c7('0x3c')]({},_0x3df7fc,_0x2fd2a8[_0x92c7('0x3e')]);return _0x403275[_0x92c7('0x4d')](_0x3df7fc);}})['then'](function(_0x4c2719){if(_0x4c2719){_0x6e4351=_0x4c2719['length'];if(!_0x2fd2a8[_0x92c7('0x31')][_0x92c7('0x4c')]('nolimit')){_0x3df7fc[_0x92c7('0x1b')]=qs[_0x92c7('0x1b')](_0x2fd2a8[_0x92c7('0x31')][_0x92c7('0x1b')]);_0x3df7fc[_0x92c7('0x19')]=qs[_0x92c7('0x19')](_0x2fd2a8['query'][_0x92c7('0x19')]);}return _0x403275[_0x92c7('0x4d')](_0x3df7fc);}})[_0x92c7('0x22')](function(_0x1a633c){if(_0x1a633c){return _0x1a633c?{'count':_0x6e4351,'rows':_0x1a633c}:null;}})[_0x92c7('0x22')](respondWithResult(_0x329330,null))[_0x92c7('0x43')](handleError(_0x329330,null));};exports['getDescriptions']=function(_0x3f5975,_0x14cf7f,_0x408741){var _0x295e15={};var _0xd0c88f={};var _0x17d10d;var _0xf1e599;return db[_0x92c7('0x2b')][_0x92c7('0x4a')]({'where':{'id':_0x3f5975[_0x92c7('0x45')]['id']}})['then'](handleEntityNotFound(_0x14cf7f,null))[_0x92c7('0x22')](function(_0x218adb){if(_0x218adb){_0x17d10d=_0x218adb;_0xd0c88f[_0x92c7('0x2f')]=_[_0x92c7('0x30')](db[_0x92c7('0x4b')]['rawAttributes']);_0xd0c88f[_0x92c7('0x31')]=_[_0x92c7('0x30')](_0x3f5975['query']);_0xd0c88f[_0x92c7('0x32')]=_[_0x92c7('0x33')](_0xd0c88f[_0x92c7('0x2f')],_0xd0c88f[_0x92c7('0x31')]);_0x295e15['attributes']=_[_0x92c7('0x33')](_0xd0c88f[_0x92c7('0x2f')],qs['fields'](_0x3f5975[_0x92c7('0x31')]['fields']));_0x295e15[_0x92c7('0x35')]=_0x295e15[_0x92c7('0x35')]['length']?_0x295e15[_0x92c7('0x35')]:_0xd0c88f['model'];_0x295e15[_0x92c7('0x38')]=qs['sort'](_0x3f5975[_0x92c7('0x31')][_0x92c7('0x39')]);_0x295e15[_0x92c7('0x3b')]=qs[_0x92c7('0x32')](_[_0x92c7('0x3a')](_0x3f5975[_0x92c7('0x31')],_0xd0c88f[_0x92c7('0x32')]));if(_0x3f5975[_0x92c7('0x31')][_0x92c7('0x3d')]){_0x295e15[_0x92c7('0x3b')]=_['merge'](_0x295e15[_0x92c7('0x3b')],{'$or':_['map'](_0x295e15[_0x92c7('0x35')],function(_0x450b78){var _0x2dd913={};_0x2dd913[_0x450b78]={'$like':'%'+_0x3f5975[_0x92c7('0x31')][_0x92c7('0x3d')]+'%'};return _0x2dd913;})});}_0x295e15=_[_0x92c7('0x3c')]({},_0x295e15,_0x3f5975[_0x92c7('0x3e')]);return _0x17d10d[_0x92c7('0x4e')](_0x295e15);}})[_0x92c7('0x22')](function(_0x1b13ff){if(_0x1b13ff){_0xf1e599=_0x1b13ff[_0x92c7('0x36')];if(!_0x3f5975[_0x92c7('0x31')]['hasOwnProperty']('nolimit')){_0x295e15[_0x92c7('0x1b')]=qs[_0x92c7('0x1b')](_0x3f5975[_0x92c7('0x31')]['limit']);_0x295e15['offset']=qs[_0x92c7('0x19')](_0x3f5975['query'][_0x92c7('0x19')]);}return _0x17d10d['getDescriptions'](_0x295e15);}})[_0x92c7('0x22')](function(_0x132258){if(_0x132258){return _0x132258?{'count':_0xf1e599,'rows':_0x132258}:null;}})[_0x92c7('0x22')](respondWithResult(_0x14cf7f,null))['catch'](handleError(_0x14cf7f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 565ffa1..be38946 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 _0x0017=['rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','int_salesforce_configurations','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x115154,_0x1cf8b8){var _0x260665=function(_0x58c343){while(--_0x58c343){_0x115154['push'](_0x115154['shift']());}};_0x260665(++_0x1cf8b8);}(_0x0017,0x9f));var _0x7001=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0x0017[_0x725a4c];return _0x37b2cc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7001('0x0'))(_0x7001('0x1'));var moment=require(_0x7001('0x2'));var BPromise=require(_0x7001('0x3'));var rp=require(_0x7001('0x4'));var fs=require('fs');var path=require(_0x7001('0x5'));var rimraf=require(_0x7001('0x6'));var config=require(_0x7001('0x7'));var attributes=require(_0x7001('0x8'));module['exports']=function(_0x4f0fe2,_0x42c14d){return _0x4f0fe2[_0x7001('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x7001('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa53f=['int_salesforce_configurations','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration'];(function(_0x2b46dc,_0x203a3e){var _0x19deff=function(_0x3eebdc){while(--_0x3eebdc){_0x2b46dc['push'](_0x2b46dc['shift']());}};_0x19deff(++_0x203a3e);}(_0xa53f,0xf1));var _0xfa53=function(_0x8505a7,_0x2dd593){_0x8505a7=_0x8505a7-0x0;var _0x146bf0=_0xa53f[_0x8505a7];return _0x146bf0;};'use strict';var _=require('lodash');var util=require(_0xfa53('0x0'));var logger=require(_0xfa53('0x1'))(_0xfa53('0x2'));var moment=require(_0xfa53('0x3'));var BPromise=require(_0xfa53('0x4'));var rp=require(_0xfa53('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfa53('0x6'));var attributes=require(_0xfa53('0x7'));module[_0xfa53('0x8')]=function(_0x19a1ac,_0x2fa5c2){return _0x19a1ac[_0xfa53('0x9')](_0xfa53('0xa'),attributes,{'tableName':_0xfa53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index daa5d93..50562a7 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 _0xdc30=['result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x5b6d0d,_0x280c4c){var _0x5d49aa=function(_0x4aa52d){while(--_0x4aa52d){_0x5b6d0d['push'](_0x5b6d0d['shift']());}};_0x5d49aa(++_0x280c4c);}(_0xdc30,0x199));var _0x0dc3=function(_0x23ca3a,_0xe44c43){_0x23ca3a=_0x23ca3a-0x0;var _0x5c1aab=_0xdc30[_0x23ca3a];return _0x5c1aab;};'use strict';var _=require(_0x0dc3('0x0'));var util=require(_0x0dc3('0x1'));var moment=require(_0x0dc3('0x2'));var BPromise=require(_0x0dc3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dc3('0x4'));var db=require(_0x0dc3('0x5'))['db'];var utils=require(_0x0dc3('0x6'));var logger=require(_0x0dc3('0x7'))(_0x0dc3('0x8'));var config=require(_0x0dc3('0x9'));var jayson=require(_0x0dc3('0xa'));var client=jayson[_0x0dc3('0xb')][_0x0dc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c0d3d,_0x530b00,_0xa14f58){return new BPromise(function(_0x548d57,_0x583308){return client[_0x0dc3('0xd')](_0x3c0d3d,_0xa14f58)[_0x0dc3('0xe')](function(_0x2b499b){logger[_0x0dc3('0xf')](_0x0dc3('0x10'),_0x530b00,'request\x20sent');logger[_0x0dc3('0x11')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x530b00,_0x0dc3('0x12'),JSON[_0x0dc3('0x13')](_0x2b499b));if(_0x2b499b[_0x0dc3('0x14')]){if(_0x2b499b[_0x0dc3('0x14')][_0x0dc3('0x15')]===0x1f4){logger[_0x0dc3('0x14')](_0x0dc3('0x10'),_0x530b00,_0x2b499b[_0x0dc3('0x14')][_0x0dc3('0x16')]);return _0x583308(_0x2b499b[_0x0dc3('0x14')][_0x0dc3('0x16')]);}logger[_0x0dc3('0x14')](_0x0dc3('0x10'),_0x530b00,_0x2b499b['error'][_0x0dc3('0x16')]);return _0x548d57(_0x2b499b[_0x0dc3('0x14')]['message']);}else{logger[_0x0dc3('0xf')]('SalesforceConfiguration,\x20%s,\x20%s',_0x530b00,'request\x20sent');_0x548d57(_0x2b499b[_0x0dc3('0x17')]['message']);}})['catch'](function(_0x259cce){logger['error'](_0x0dc3('0x10'),_0x530b00,_0x259cce);_0x583308(_0x259cce);});});} \ No newline at end of file +var _0x1622=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x500471,_0xc97759){var _0x51b6c1=function(_0x1e4609){while(--_0x1e4609){_0x500471['push'](_0x500471['shift']());}};_0x51b6c1(++_0xc97759);}(_0x1622,0x6b));var _0x2162=function(_0xe7c422,_0x2ebbe4){_0xe7c422=_0xe7c422-0x0;var _0x4005e7=_0x1622[_0xe7c422];return _0x4005e7;};'use strict';var _=require(_0x2162('0x0'));var util=require('util');var moment=require(_0x2162('0x1'));var BPromise=require(_0x2162('0x2'));var rs=require(_0x2162('0x3'));var fs=require('fs');var Redis=require(_0x2162('0x4'));var db=require(_0x2162('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2162('0x6'))(_0x2162('0x7'));var config=require(_0x2162('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2162('0x9')][_0x2162('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x718b3e,_0x1ad67a,_0x2373f8){return new BPromise(function(_0x4c92ee,_0x550489){return client[_0x2162('0xb')](_0x718b3e,_0x2373f8)['then'](function(_0x434f0f){logger[_0x2162('0xc')](_0x2162('0xd'),_0x1ad67a,'request\x20sent');logger[_0x2162('0xe')](_0x2162('0xf'),_0x1ad67a,_0x2162('0x10'),JSON['stringify'](_0x434f0f));if(_0x434f0f[_0x2162('0x11')]){if(_0x434f0f[_0x2162('0x11')]['code']===0x1f4){logger['error'](_0x2162('0xd'),_0x1ad67a,_0x434f0f[_0x2162('0x11')][_0x2162('0x12')]);return _0x550489(_0x434f0f['error'][_0x2162('0x12')]);}logger['error'](_0x2162('0xd'),_0x1ad67a,_0x434f0f[_0x2162('0x11')]['message']);return _0x4c92ee(_0x434f0f[_0x2162('0x11')][_0x2162('0x12')]);}else{logger['info'](_0x2162('0xd'),_0x1ad67a,_0x2162('0x10'));_0x4c92ee(_0x434f0f[_0x2162('0x13')]['message']);}})[_0x2162('0x14')](function(_0x3b5a05){logger[_0x2162('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1ad67a,_0x3b5a05);_0x550489(_0x3b5a05);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 60d64b7..e996b7a 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 _0xc3fd=['/:id','show','post','isAuthenticated','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index'];(function(_0x32179c,_0x32fb68){var _0xad3766=function(_0x597f3f){while(--_0x597f3f){_0x32179c['push'](_0x32179c['shift']());}};_0xad3766(++_0x32fb68);}(_0xc3fd,0x72));var _0xdc3f=function(_0x163a93,_0xc01671){_0x163a93=_0x163a93-0x0;var _0x196385=_0xc3fd[_0x163a93];return _0x196385;};'use strict';var multer=require(_0xdc3f('0x0'));var util=require(_0xdc3f('0x1'));var path=require(_0xdc3f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdc3f('0x3'));var router=express[_0xdc3f('0x4')]();var fs_extra=require(_0xdc3f('0x5'));var auth=require(_0xdc3f('0x6'));var interaction=require(_0xdc3f('0x7'));var config=require(_0xdc3f('0x8'));var controller=require(_0xdc3f('0x9'));router[_0xdc3f('0xa')]('/',auth['isAuthenticated'](),controller[_0xdc3f('0xb')]);router[_0xdc3f('0xa')](_0xdc3f('0xc'),auth['isAuthenticated'](),controller[_0xdc3f('0xd')]);router[_0xdc3f('0xe')]('/',auth[_0xdc3f('0xf')](),controller[_0xdc3f('0x10')]);router[_0xdc3f('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdc3f('0x12')](_0xdc3f('0xc'),auth[_0xdc3f('0xf')](),controller[_0xdc3f('0x13')]);module[_0xdc3f('0x14')]=router; \ No newline at end of file +var _0x6b9a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intSalesforceField.controller','get','isAuthenticated','post','create','update','delete','destroy','exports','multer','util'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0x6b9a,0xca));var _0xa6b9=function(_0xbec092,_0x51026e){_0xbec092=_0xbec092-0x0;var _0x141035=_0x6b9a[_0xbec092];return _0x141035;};'use strict';var multer=require(_0xa6b9('0x0'));var util=require(_0xa6b9('0x1'));var path=require(_0xa6b9('0x2'));var timeout=require(_0xa6b9('0x3'));var express=require(_0xa6b9('0x4'));var router=express[_0xa6b9('0x5')]();var fs_extra=require(_0xa6b9('0x6'));var auth=require(_0xa6b9('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa6b9('0x8'));router[_0xa6b9('0x9')]('/',auth[_0xa6b9('0xa')](),controller['index']);router[_0xa6b9('0x9')]('/:id',auth[_0xa6b9('0xa')](),controller['show']);router[_0xa6b9('0xb')]('/',auth[_0xa6b9('0xa')](),controller[_0xa6b9('0xc')]);router['put']('/:id',auth[_0xa6b9('0xa')](),controller[_0xa6b9('0xd')]);router[_0xa6b9('0xe')]('/:id',auth[_0xa6b9('0xa')](),controller[_0xa6b9('0xf')]);module[_0xa6b9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 47319d1..c4bb359 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 _0xb996=['keyValue','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0xb996,0x1b2));var _0x6b99=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xb996[_0x4ea69d];return _0x5318e0;};'use strict';var Sequelize=require(_0x6b99('0x0'));module[_0x6b99('0x1')]={'type':{'type':Sequelize[_0x6b99('0x2')](_0x6b99('0x3'),_0x6b99('0x4'),_0x6b99('0x5'),_0x6b99('0x6'),'picklist'),'defaultValue':_0x6b99('0x3')},'content':{'type':Sequelize[_0x6b99('0x7')]},'key':{'type':Sequelize[_0x6b99('0x7')]},'keyType':{'type':Sequelize[_0x6b99('0x2')](_0x6b99('0x3'),'variable',_0x6b99('0x5'))},'keyContent':{'type':Sequelize[_0x6b99('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x6b99('0x7')]}}; \ No newline at end of file +var _0x649d=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x339f4e,_0x53b4fe){var _0x2b9950=function(_0x21fdea){while(--_0x21fdea){_0x339f4e['push'](_0x339f4e['shift']());}};_0x2b9950(++_0x53b4fe);}(_0x649d,0x15c));var _0xd649=function(_0x9557b3,_0x123d11){_0x9557b3=_0x9557b3-0x0;var _0x24d6cd=_0x649d[_0x9557b3];return _0x24d6cd;};'use strict';var Sequelize=require(_0xd649('0x0'));module[_0xd649('0x1')]={'type':{'type':Sequelize[_0xd649('0x2')](_0xd649('0x3'),_0xd649('0x4'),_0xd649('0x5'),_0xd649('0x6'),'picklist'),'defaultValue':_0xd649('0x3')},'content':{'type':Sequelize[_0xd649('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd649('0x2')](_0xd649('0x3'),'variable',_0xd649('0x5'))},'keyContent':{'type':Sequelize[_0xd649('0x7')]},'idField':{'type':Sequelize[_0xd649('0x7')]},'variableName':{'type':Sequelize[_0xd649('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e1ad5d5..4109b7c 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 _0x7968=['stack','name','send','map','SalesforceField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','findAll','rows','show','params','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x3ade37,_0x238dbc){var _0x1c1502=function(_0x3561da){while(--_0x3561da){_0x3ade37['push'](_0x3ade37['shift']());}};_0x1c1502(++_0x238dbc);}(_0x7968,0xb8));var _0x8796=function(_0x1f2ef9,_0x1107c2){_0x1f2ef9=_0x1f2ef9-0x0;var _0x291091=_0x7968[_0x1f2ef9];return _0x291091;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8796('0x0'));var jsonpatch=require(_0x8796('0x1'));var rp=require(_0x8796('0x2'));var moment=require(_0x8796('0x3'));var BPromise=require(_0x8796('0x4'));var Mustache=require(_0x8796('0x5'));var util=require(_0x8796('0x6'));var path=require(_0x8796('0x7'));var sox=require(_0x8796('0x8'));var csv=require(_0x8796('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8796('0xa'));var squel=require(_0x8796('0xb'));var crypto=require(_0x8796('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8796('0xd'));var Papa=require(_0x8796('0xe'));var Redis=require(_0x8796('0xf'));var authService=require(_0x8796('0x10'));var qs=require(_0x8796('0x11'));var as=require(_0x8796('0x12'));var hardwareService=require(_0x8796('0x13'));var logger=require(_0x8796('0x14'))('api');var utils=require(_0x8796('0x15'));var config=require(_0x8796('0x16'));var licenseUtil=require(_0x8796('0x17'));var db=require(_0x8796('0x18'))['db'];function respondWithStatusCode(_0x3c2c6f,_0x45c8dd){_0x45c8dd=_0x45c8dd||0xcc;return function(_0x5711a1){if(_0x5711a1){return _0x3c2c6f[_0x8796('0x19')](_0x45c8dd);}return _0x3c2c6f['status'](_0x45c8dd)[_0x8796('0x1a')]();};}function respondWithResult(_0x1e8fae,_0x486b99){_0x486b99=_0x486b99||0xc8;return function(_0x5845db){if(_0x5845db){return _0x1e8fae[_0x8796('0x1b')](_0x486b99)[_0x8796('0x1c')](_0x5845db);}};}function respondWithFilteredResult(_0x30a053,_0x4c226d){return function(_0x452110){if(_0x452110){var _0x304829=typeof _0x4c226d['offset']==='undefined'&&typeof _0x4c226d[_0x8796('0x1d')]===_0x8796('0x1e');var _0x288ccb=_0x452110[_0x8796('0x1f')];var _0x14c16e=_0x304829?0x0:_0x4c226d[_0x8796('0x20')];var _0x6a9d83=_0x304829?_0x452110[_0x8796('0x1f')]:_0x4c226d[_0x8796('0x20')]+_0x4c226d[_0x8796('0x1d')];var _0x135245;if(_0x6a9d83>=_0x288ccb){_0x6a9d83=_0x288ccb;_0x135245=0xc8;}else{_0x135245=0xce;}_0x30a053['status'](_0x135245);return _0x30a053[_0x8796('0x21')](_0x8796('0x22'),_0x14c16e+'-'+_0x6a9d83+'/'+_0x288ccb)[_0x8796('0x1c')](_0x452110);}return null;};}function patchUpdates(_0x3e2986){return function(_0x27a938){try{jsonpatch[_0x8796('0x23')](_0x27a938,_0x3e2986,!![]);}catch(_0xcfdc59){return BPromise[_0x8796('0x24')](_0xcfdc59);}return _0x27a938[_0x8796('0x25')]();};}function saveUpdates(_0x82fa02,_0x30c0c4){return function(_0x5d7539){if(_0x5d7539){return _0x5d7539[_0x8796('0x26')](_0x82fa02)[_0x8796('0x27')](function(_0x3c3bec){return _0x3c3bec;});}return null;};}function removeEntity(_0x15b05e,_0x16a8ff){return function(_0x5049a6){if(_0x5049a6){return _0x5049a6[_0x8796('0x28')]()[_0x8796('0x27')](function(){_0x15b05e[_0x8796('0x1b')](0xcc)[_0x8796('0x1a')]();});}};}function handleEntityNotFound(_0x5c8cee,_0x1e2db3){return function(_0x3d4deb){if(!_0x3d4deb){_0x5c8cee[_0x8796('0x19')](0x194);}return _0x3d4deb;};}function handleError(_0x53f20c,_0x3a8ca7){_0x3a8ca7=_0x3a8ca7||0x1f4;return function(_0xb09820){logger['error'](_0xb09820[_0x8796('0x29')]);if(_0xb09820[_0x8796('0x2a')]){delete _0xb09820[_0x8796('0x2a')];}_0x53f20c[_0x8796('0x1b')](_0x3a8ca7)[_0x8796('0x2b')](_0xb09820);};}exports['index']=function(_0x1e8df2,_0x5d89c8){var _0x59898b={},_0xf8224={},_0x41c922={'count':0x0,'rows':[]};var _0x2a495d=_[_0x8796('0x2c')](db[_0x8796('0x2d')][_0x8796('0x2e')],function(_0x35afc1){return{'name':_0x35afc1[_0x8796('0x2f')],'type':_0x35afc1[_0x8796('0x30')][_0x8796('0x31')]};});_0xf8224[_0x8796('0x32')]=_['map'](_0x2a495d,'name');_0xf8224[_0x8796('0x33')]=_[_0x8796('0x34')](_0x1e8df2[_0x8796('0x33')]);_0xf8224[_0x8796('0x35')]=_[_0x8796('0x36')](_0xf8224[_0x8796('0x32')],_0xf8224[_0x8796('0x33')]);_0x59898b[_0x8796('0x37')]=_[_0x8796('0x36')](_0xf8224[_0x8796('0x32')],qs[_0x8796('0x38')](_0x1e8df2[_0x8796('0x33')][_0x8796('0x38')]));_0x59898b[_0x8796('0x37')]=_0x59898b[_0x8796('0x37')][_0x8796('0x39')]?_0x59898b[_0x8796('0x37')]:_0xf8224[_0x8796('0x32')];if(!_0x1e8df2['query']['hasOwnProperty'](_0x8796('0x3a'))){_0x59898b[_0x8796('0x1d')]=qs['limit'](_0x1e8df2[_0x8796('0x33')][_0x8796('0x1d')]);_0x59898b[_0x8796('0x20')]=qs[_0x8796('0x20')](_0x1e8df2[_0x8796('0x33')][_0x8796('0x20')]);}_0x59898b[_0x8796('0x3b')]=qs['sort'](_0x1e8df2['query'][_0x8796('0x3c')]);_0x59898b[_0x8796('0x3d')]=qs[_0x8796('0x35')](_[_0x8796('0x3e')](_0x1e8df2[_0x8796('0x33')],_0xf8224[_0x8796('0x35')]),_0x2a495d);if(_0x1e8df2[_0x8796('0x33')]['filter']){_0x59898b[_0x8796('0x3d')]=_['merge'](_0x59898b[_0x8796('0x3d')],{'$or':_[_0x8796('0x2c')](_0x2a495d,function(_0x1bf75c){if(_0x1bf75c['type']!==_0x8796('0x3f')){var _0x1fc019={};_0x1fc019[_0x1bf75c[_0x8796('0x2a')]]={'$like':'%'+_0x1e8df2[_0x8796('0x33')][_0x8796('0x40')]+'%'};return _0x1fc019;}})});}_0x59898b=_[_0x8796('0x41')]({},_0x59898b,_0x1e8df2['options']);var _0x47e459={'where':_0x59898b['where']};return db[_0x8796('0x2d')][_0x8796('0x1f')](_0x47e459)[_0x8796('0x27')](function(_0x858208){_0x41c922['count']=_0x858208;if(_0x1e8df2[_0x8796('0x33')][_0x8796('0x42')]){_0x59898b['include']=[{'all':!![]}];}return db['SalesforceField'][_0x8796('0x43')](_0x59898b);})['then'](function(_0x3d93ef){_0x41c922[_0x8796('0x44')]=_0x3d93ef;return _0x41c922;})['then'](respondWithFilteredResult(_0x5d89c8,_0x59898b))['catch'](handleError(_0x5d89c8,null));};exports[_0x8796('0x45')]=function(_0x5910c0,_0x2b440c){var _0x2d6a61={'raw':!![],'where':{'id':_0x5910c0[_0x8796('0x46')]['id']}},_0x4c3c42={};_0x4c3c42[_0x8796('0x32')]=_[_0x8796('0x34')](db[_0x8796('0x2d')][_0x8796('0x2e')]);_0x4c3c42['query']=_[_0x8796('0x34')](_0x5910c0[_0x8796('0x33')]);_0x4c3c42[_0x8796('0x35')]=_['intersection'](_0x4c3c42[_0x8796('0x32')],_0x4c3c42[_0x8796('0x33')]);_0x2d6a61[_0x8796('0x37')]=_[_0x8796('0x36')](_0x4c3c42[_0x8796('0x32')],qs['fields'](_0x5910c0[_0x8796('0x33')][_0x8796('0x38')]));_0x2d6a61['attributes']=_0x2d6a61[_0x8796('0x37')]['length']?_0x2d6a61['attributes']:_0x4c3c42['model'];if(_0x5910c0[_0x8796('0x33')]['includeAll']){_0x2d6a61['include']=[{'all':!![]}];}_0x2d6a61=_[_0x8796('0x41')]({},_0x2d6a61,_0x5910c0['options']);return db[_0x8796('0x2d')][_0x8796('0x47')](_0x2d6a61)[_0x8796('0x27')](handleEntityNotFound(_0x2b440c,null))[_0x8796('0x27')](respondWithResult(_0x2b440c,null))[_0x8796('0x48')](handleError(_0x2b440c,null));};exports[_0x8796('0x49')]=function(_0x4fe28f,_0x21140b){return db[_0x8796('0x2d')]['create'](_0x4fe28f[_0x8796('0x4a')],{})[_0x8796('0x27')](respondWithResult(_0x21140b,0xc9))['catch'](handleError(_0x21140b,null));};exports[_0x8796('0x26')]=function(_0x3f020c,_0x184c54){if(_0x3f020c[_0x8796('0x4a')]['id']){delete _0x3f020c[_0x8796('0x4a')]['id'];}return db[_0x8796('0x2d')]['find']({'where':{'id':_0x3f020c[_0x8796('0x46')]['id']}})['then'](handleEntityNotFound(_0x184c54,null))[_0x8796('0x27')](saveUpdates(_0x3f020c[_0x8796('0x4a')],null))[_0x8796('0x27')](respondWithResult(_0x184c54,null))[_0x8796('0x48')](handleError(_0x184c54,null));};exports['destroy']=function(_0x48d18e,_0xe126b5){return db['SalesforceField'][_0x8796('0x47')]({'where':{'id':_0x48d18e['params']['id']}})[_0x8796('0x27')](handleEntityNotFound(_0xe126b5,null))[_0x8796('0x27')](removeEntity(_0xe126b5,null))[_0x8796('0x48')](handleError(_0xe126b5,null));}; \ No newline at end of file +var _0x1482=['map','SalesforceField','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','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/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','Content-Range','apply','reject','update','then','destroy','end','stack','name','send'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0x1482,0xb7));var _0x2148=function(_0x334400,_0x56f981){_0x334400=_0x334400-0x0;var _0x55991b=_0x1482[_0x334400];return _0x55991b;};'use strict';var emlformat=require(_0x2148('0x0'));var rimraf=require(_0x2148('0x1'));var zipdir=require(_0x2148('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2148('0x3'));var moment=require(_0x2148('0x4'));var BPromise=require(_0x2148('0x5'));var Mustache=require(_0x2148('0x6'));var util=require(_0x2148('0x7'));var path=require(_0x2148('0x8'));var sox=require(_0x2148('0x9'));var csv=require(_0x2148('0xa'));var ejs=require(_0x2148('0xb'));var fs=require('fs');var fs_extra=require(_0x2148('0xc'));var _=require(_0x2148('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2148('0xe'));var deskjs=require(_0x2148('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2148('0x10'));var Papa=require('papaparse');var Redis=require(_0x2148('0x11'));var authService=require(_0x2148('0x12'));var qs=require(_0x2148('0x13'));var as=require(_0x2148('0x14'));var hardwareService=require(_0x2148('0x15'));var logger=require(_0x2148('0x16'))(_0x2148('0x17'));var utils=require(_0x2148('0x18'));var config=require(_0x2148('0x19'));var licenseUtil=require(_0x2148('0x1a'));var db=require(_0x2148('0x1b'))['db'];function respondWithStatusCode(_0x28da3e,_0x55c5a1){_0x55c5a1=_0x55c5a1||0xcc;return function(_0x1e7352){if(_0x1e7352){return _0x28da3e[_0x2148('0x1c')](_0x55c5a1);}return _0x28da3e[_0x2148('0x1d')](_0x55c5a1)['end']();};}function respondWithResult(_0x390e6c,_0x5005a5){_0x5005a5=_0x5005a5||0xc8;return function(_0x6722a7){if(_0x6722a7){return _0x390e6c[_0x2148('0x1d')](_0x5005a5)[_0x2148('0x1e')](_0x6722a7);}};}function respondWithFilteredResult(_0x3d21f0,_0x273a16){return function(_0x49d145){if(_0x49d145){var _0x5a666c=typeof _0x273a16[_0x2148('0x1f')]===_0x2148('0x20')&&typeof _0x273a16[_0x2148('0x21')]===_0x2148('0x20');var _0x4c0b85=_0x49d145[_0x2148('0x22')];var _0x59d199=_0x5a666c?0x0:_0x273a16[_0x2148('0x1f')];var _0x28a673=_0x5a666c?_0x49d145['count']:_0x273a16[_0x2148('0x1f')]+_0x273a16[_0x2148('0x21')];var _0x1022b4;if(_0x28a673>=_0x4c0b85){_0x28a673=_0x4c0b85;_0x1022b4=0xc8;}else{_0x1022b4=0xce;}_0x3d21f0[_0x2148('0x1d')](_0x1022b4);return _0x3d21f0['set'](_0x2148('0x23'),_0x59d199+'-'+_0x28a673+'/'+_0x4c0b85)['json'](_0x49d145);}return null;};}function patchUpdates(_0x16d329){return function(_0x133bf4){try{jsonpatch[_0x2148('0x24')](_0x133bf4,_0x16d329,!![]);}catch(_0x2f62e0){return BPromise[_0x2148('0x25')](_0x2f62e0);}return _0x133bf4['save']();};}function saveUpdates(_0x11cb18,_0x293e58){return function(_0x12a081){if(_0x12a081){return _0x12a081[_0x2148('0x26')](_0x11cb18)[_0x2148('0x27')](function(_0x22685a){return _0x22685a;});}return null;};}function removeEntity(_0x369942,_0x82ee59){return function(_0x547734){if(_0x547734){return _0x547734[_0x2148('0x28')]()[_0x2148('0x27')](function(){_0x369942[_0x2148('0x1d')](0xcc)[_0x2148('0x29')]();});}};}function handleEntityNotFound(_0x5218bc,_0x22dd26){return function(_0x17e5bf){if(!_0x17e5bf){_0x5218bc[_0x2148('0x1c')](0x194);}return _0x17e5bf;};}function handleError(_0x3c0dd9,_0x42257a){_0x42257a=_0x42257a||0x1f4;return function(_0x12f070){logger['error'](_0x12f070[_0x2148('0x2a')]);if(_0x12f070[_0x2148('0x2b')]){delete _0x12f070['name'];}_0x3c0dd9[_0x2148('0x1d')](_0x42257a)[_0x2148('0x2c')](_0x12f070);};}exports['index']=function(_0x3095f7,_0x33db86){var _0x2a46bc={},_0x484ff={},_0x1808c2={'count':0x0,'rows':[]};var _0x383526=_[_0x2148('0x2d')](db[_0x2148('0x2e')][_0x2148('0x2f')],function(_0x34b020){return{'name':_0x34b020['fieldName'],'type':_0x34b020['type'][_0x2148('0x30')]};});_0x484ff[_0x2148('0x31')]=_['map'](_0x383526,_0x2148('0x2b'));_0x484ff['query']=_[_0x2148('0x32')](_0x3095f7[_0x2148('0x33')]);_0x484ff[_0x2148('0x34')]=_[_0x2148('0x35')](_0x484ff['model'],_0x484ff[_0x2148('0x33')]);_0x2a46bc[_0x2148('0x36')]=_['intersection'](_0x484ff[_0x2148('0x31')],qs['fields'](_0x3095f7[_0x2148('0x33')][_0x2148('0x37')]));_0x2a46bc[_0x2148('0x36')]=_0x2a46bc[_0x2148('0x36')][_0x2148('0x38')]?_0x2a46bc[_0x2148('0x36')]:_0x484ff[_0x2148('0x31')];if(!_0x3095f7[_0x2148('0x33')]['hasOwnProperty'](_0x2148('0x39'))){_0x2a46bc[_0x2148('0x21')]=qs[_0x2148('0x21')](_0x3095f7[_0x2148('0x33')]['limit']);_0x2a46bc['offset']=qs[_0x2148('0x1f')](_0x3095f7['query']['offset']);}_0x2a46bc['order']=qs[_0x2148('0x3a')](_0x3095f7[_0x2148('0x33')]['sort']);_0x2a46bc[_0x2148('0x3b')]=qs[_0x2148('0x34')](_[_0x2148('0x3c')](_0x3095f7[_0x2148('0x33')],_0x484ff['filters']),_0x383526);if(_0x3095f7[_0x2148('0x33')][_0x2148('0x3d')]){_0x2a46bc[_0x2148('0x3b')]=_[_0x2148('0x3e')](_0x2a46bc[_0x2148('0x3b')],{'$or':_[_0x2148('0x2d')](_0x383526,function(_0x52bfd4){if(_0x52bfd4[_0x2148('0x3f')]!==_0x2148('0x40')){var _0x4e9b21={};_0x4e9b21[_0x52bfd4[_0x2148('0x2b')]]={'$like':'%'+_0x3095f7[_0x2148('0x33')][_0x2148('0x3d')]+'%'};return _0x4e9b21;}})});}_0x2a46bc=_['merge']({},_0x2a46bc,_0x3095f7[_0x2148('0x41')]);var _0x5070c1={'where':_0x2a46bc[_0x2148('0x3b')]};return db[_0x2148('0x2e')][_0x2148('0x22')](_0x5070c1)[_0x2148('0x27')](function(_0x5d5d37){_0x1808c2[_0x2148('0x22')]=_0x5d5d37;if(_0x3095f7[_0x2148('0x33')]['includeAll']){_0x2a46bc[_0x2148('0x42')]=[{'all':!![]}];}return db[_0x2148('0x2e')][_0x2148('0x43')](_0x2a46bc);})['then'](function(_0x378fd2){_0x1808c2[_0x2148('0x44')]=_0x378fd2;return _0x1808c2;})[_0x2148('0x27')](respondWithFilteredResult(_0x33db86,_0x2a46bc))[_0x2148('0x45')](handleError(_0x33db86,null));};exports[_0x2148('0x46')]=function(_0x582923,_0x1242e6){var _0x5acbd8={'raw':!![],'where':{'id':_0x582923[_0x2148('0x47')]['id']}},_0xeb4392={};_0xeb4392[_0x2148('0x31')]=_['keys'](db['SalesforceField']['rawAttributes']);_0xeb4392[_0x2148('0x33')]=_[_0x2148('0x32')](_0x582923[_0x2148('0x33')]);_0xeb4392[_0x2148('0x34')]=_[_0x2148('0x35')](_0xeb4392['model'],_0xeb4392[_0x2148('0x33')]);_0x5acbd8[_0x2148('0x36')]=_[_0x2148('0x35')](_0xeb4392[_0x2148('0x31')],qs[_0x2148('0x37')](_0x582923[_0x2148('0x33')][_0x2148('0x37')]));_0x5acbd8[_0x2148('0x36')]=_0x5acbd8[_0x2148('0x36')]['length']?_0x5acbd8['attributes']:_0xeb4392[_0x2148('0x31')];if(_0x582923[_0x2148('0x33')][_0x2148('0x48')]){_0x5acbd8[_0x2148('0x42')]=[{'all':!![]}];}_0x5acbd8=_[_0x2148('0x3e')]({},_0x5acbd8,_0x582923[_0x2148('0x41')]);return db['SalesforceField'][_0x2148('0x49')](_0x5acbd8)[_0x2148('0x27')](handleEntityNotFound(_0x1242e6,null))[_0x2148('0x27')](respondWithResult(_0x1242e6,null))[_0x2148('0x45')](handleError(_0x1242e6,null));};exports[_0x2148('0x4a')]=function(_0x1f057a,_0x507526){return db[_0x2148('0x2e')][_0x2148('0x4a')](_0x1f057a[_0x2148('0x4b')],{})['then'](respondWithResult(_0x507526,0xc9))[_0x2148('0x45')](handleError(_0x507526,null));};exports[_0x2148('0x26')]=function(_0x4f91cd,_0x3d4827){if(_0x4f91cd[_0x2148('0x4b')]['id']){delete _0x4f91cd[_0x2148('0x4b')]['id'];}return db['SalesforceField'][_0x2148('0x49')]({'where':{'id':_0x4f91cd['params']['id']}})[_0x2148('0x27')](handleEntityNotFound(_0x3d4827,null))[_0x2148('0x27')](saveUpdates(_0x4f91cd[_0x2148('0x4b')],null))[_0x2148('0x27')](respondWithResult(_0x3d4827,null))[_0x2148('0x45')](handleError(_0x3d4827,null));};exports['destroy']=function(_0x4dbe42,_0x20dda7){return db[_0x2148('0x2e')][_0x2148('0x49')]({'where':{'id':_0x4dbe42[_0x2148('0x47')]['id']}})[_0x2148('0x27')](handleEntityNotFound(_0x20dda7,null))['then'](removeEntity(_0x20dda7,null))['catch'](handleError(_0x20dda7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 1576567..ad4a3a8 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 _0x2b38=['moment','request-promise','../../config/environment','./intSalesforceField.attributes','exports','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x426eb9,_0x25b4ef){var _0x37439c=function(_0x3d8c1e){while(--_0x3d8c1e){_0x426eb9['push'](_0x426eb9['shift']());}};_0x37439c(++_0x25b4ef);}(_0x2b38,0x114));var _0x82b3=function(_0xd0facf,_0x4c3d35){_0xd0facf=_0xd0facf-0x0;var _0x965c00=_0x2b38[_0xd0facf];return _0x965c00;};'use strict';var _=require(_0x82b3('0x0'));var util=require(_0x82b3('0x1'));var logger=require(_0x82b3('0x2'))(_0x82b3('0x3'));var moment=require(_0x82b3('0x4'));var BPromise=require('bluebird');var rp=require(_0x82b3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x82b3('0x6'));var attributes=require(_0x82b3('0x7'));module[_0x82b3('0x8')]=function(_0x390180,_0x4b2bc7){return _0x390180['define'](_0x82b3('0x9'),attributes,{'tableName':_0x82b3('0xa'),'paranoid':![],'indexes':[{'name':_0x82b3('0xb'),'fields':[_0x82b3('0xc'),_0x82b3('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x78de=['util','../../config/logger','api','bluebird','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x278f85,_0x41d868){var _0x3788a8=function(_0x263dfb){while(--_0x263dfb){_0x278f85['push'](_0x278f85['shift']());}};_0x3788a8(++_0x41d868);}(_0x78de,0x16b));var _0xe78d=function(_0xa087f5,_0x34fd10){_0xa087f5=_0xa087f5-0x0;var _0x4c8806=_0x78de[_0xa087f5];return _0x4c8806;};'use strict';var _=require(_0xe78d('0x0'));var util=require(_0xe78d('0x1'));var logger=require(_0xe78d('0x2'))(_0xe78d('0x3'));var moment=require('moment');var BPromise=require(_0xe78d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe78d('0x5'));var attributes=require(_0xe78d('0x6'));module[_0xe78d('0x7')]=function(_0x458a00,_0x43a21a){return _0x458a00[_0xe78d('0x8')](_0xe78d('0x9'),attributes,{'tableName':_0xe78d('0xa'),'paranoid':![],'indexes':[{'name':_0xe78d('0xb'),'fields':[_0xe78d('0xc'),_0xe78d('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 75c1794..fb0e62a 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 _0x3dd6=['SalesforceField,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5e02ab,_0x9fd326){var _0x12ec6a=function(_0x347c6c){while(--_0x347c6c){_0x5e02ab['push'](_0x5e02ab['shift']());}};_0x12ec6a(++_0x9fd326);}(_0x3dd6,0x1a5));var _0x63dd=function(_0x4d120d,_0x55a2c9){_0x4d120d=_0x4d120d-0x0;var _0x12b156=_0x3dd6[_0x4d120d];return _0x12b156;};'use strict';var _=require(_0x63dd('0x0'));var util=require(_0x63dd('0x1'));var moment=require('moment');var BPromise=require(_0x63dd('0x2'));var rs=require(_0x63dd('0x3'));var fs=require('fs');var Redis=require(_0x63dd('0x4'));var db=require(_0x63dd('0x5'))['db'];var utils=require(_0x63dd('0x6'));var logger=require(_0x63dd('0x7'))('rpc');var config=require(_0x63dd('0x8'));var jayson=require(_0x63dd('0x9'));var client=jayson[_0x63dd('0xa')][_0x63dd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58831f,_0x56e96e,_0x3f38b1){return new BPromise(function(_0x2e7c1e,_0x466d74){return client['request'](_0x58831f,_0x3f38b1)[_0x63dd('0xc')](function(_0x40a5bd){logger[_0x63dd('0xd')]('SalesforceField,\x20%s,\x20%s',_0x56e96e,_0x63dd('0xe'));logger['debug'](_0x63dd('0xf'),_0x56e96e,_0x63dd('0xe'),JSON[_0x63dd('0x10')](_0x40a5bd));if(_0x40a5bd[_0x63dd('0x11')]){if(_0x40a5bd['error'][_0x63dd('0x12')]===0x1f4){logger[_0x63dd('0x11')](_0x63dd('0x13'),_0x56e96e,_0x40a5bd[_0x63dd('0x11')][_0x63dd('0x14')]);return _0x466d74(_0x40a5bd[_0x63dd('0x11')][_0x63dd('0x14')]);}logger['error'](_0x63dd('0x13'),_0x56e96e,_0x40a5bd[_0x63dd('0x11')][_0x63dd('0x14')]);return _0x2e7c1e(_0x40a5bd['error']['message']);}else{logger['info'](_0x63dd('0x13'),_0x56e96e,_0x63dd('0xe'));_0x2e7c1e(_0x40a5bd[_0x63dd('0x15')]['message']);}})['catch'](function(_0x1d554e){logger['error'](_0x63dd('0x13'),_0x56e96e,_0x1d554e);_0x466d74(_0x1d554e);});});} \ No newline at end of file +var _0x4501=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x99084,_0x2674d7){var _0x12faaa=function(_0x1f0547){while(--_0x1f0547){_0x99084['push'](_0x99084['shift']());}};_0x12faaa(++_0x2674d7);}(_0x4501,0xa8));var _0x1450=function(_0x1ec0a5,_0x4b7358){_0x1ec0a5=_0x1ec0a5-0x0;var _0x4cfc63=_0x4501[_0x1ec0a5];return _0x4cfc63;};'use strict';var _=require(_0x1450('0x0'));var util=require(_0x1450('0x1'));var moment=require('moment');var BPromise=require(_0x1450('0x2'));var rs=require(_0x1450('0x3'));var fs=require('fs');var Redis=require(_0x1450('0x4'));var db=require(_0x1450('0x5'))['db'];var utils=require(_0x1450('0x6'));var logger=require(_0x1450('0x7'))(_0x1450('0x8'));var config=require(_0x1450('0x9'));var jayson=require(_0x1450('0xa'));var client=jayson[_0x1450('0xb')][_0x1450('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x549e67,_0x3ef91b,_0x3fabd1){return new BPromise(function(_0x4bd065,_0x5839bc){return client['request'](_0x549e67,_0x3fabd1)['then'](function(_0x21f047){logger['info'](_0x1450('0xd'),_0x3ef91b,_0x1450('0xe'));logger['debug'](_0x1450('0xf'),_0x3ef91b,'request\x20sent',JSON[_0x1450('0x10')](_0x21f047));if(_0x21f047[_0x1450('0x11')]){if(_0x21f047[_0x1450('0x11')][_0x1450('0x12')]===0x1f4){logger[_0x1450('0x11')](_0x1450('0xd'),_0x3ef91b,_0x21f047[_0x1450('0x11')][_0x1450('0x13')]);return _0x5839bc(_0x21f047[_0x1450('0x11')]['message']);}logger['error'](_0x1450('0xd'),_0x3ef91b,_0x21f047['error']['message']);return _0x4bd065(_0x21f047['error'][_0x1450('0x13')]);}else{logger[_0x1450('0x14')](_0x1450('0xd'),_0x3ef91b,'request\x20sent');_0x4bd065(_0x21f047['result'][_0x1450('0x13')]);}})['catch'](function(_0x39dc82){logger[_0x1450('0x11')]('SalesforceField,\x20%s,\x20%s',_0x3ef91b,_0x39dc82);_0x5839bc(_0x39dc82);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 1dad5b1..18110cf 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 _0xd9ed=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x556bca,_0x573fb9){var _0x16c8fd=function(_0x469625){while(--_0x469625){_0x556bca['push'](_0x556bca['shift']());}};_0x16c8fd(++_0x573fb9);}(_0xd9ed,0x135));var _0xdd9e=function(_0x191eb8,_0x34fd01){_0x191eb8=_0x191eb8-0x0;var _0x3801f2=_0xd9ed[_0x191eb8];return _0x3801f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdd9e('0x0'));var timeout=require(_0xdd9e('0x1'));var express=require(_0xdd9e('0x2'));var router=express[_0xdd9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdd9e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdd9e('0x5'));var controller=require('./intServicenowAccount.controller');router[_0xdd9e('0x6')]('/',auth[_0xdd9e('0x7')](),controller[_0xdd9e('0x8')]);router[_0xdd9e('0x6')](_0xdd9e('0x9'),auth[_0xdd9e('0x7')](),controller[_0xdd9e('0xa')]);router['get'](_0xdd9e('0xb'),auth[_0xdd9e('0x7')](),controller[_0xdd9e('0xc')]);router[_0xdd9e('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xdd9e('0xd')]);router[_0xdd9e('0xe')]('/',auth['isAuthenticated'](),controller[_0xdd9e('0xf')]);router[_0xdd9e('0xe')](_0xdd9e('0xb'),auth[_0xdd9e('0x7')](),controller[_0xdd9e('0x10')]);router[_0xdd9e('0x11')](_0xdd9e('0x9'),auth[_0xdd9e('0x7')](),controller['update']);router[_0xdd9e('0x12')]('/:id',auth[_0xdd9e('0x7')](),controller[_0xdd9e('0x13')]);module[_0xdd9e('0x14')]=router; \ No newline at end of file +var _0xf60a=['exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','put','update','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf60a,0x166));var _0xaf60=function(_0x39512c,_0x367bd8){_0x39512c=_0x39512c-0x0;var _0x5e31ca=_0xf60a[_0x39512c];return _0x5e31ca;};'use strict';var multer=require('multer');var util=require(_0xaf60('0x0'));var path=require(_0xaf60('0x1'));var timeout=require(_0xaf60('0x2'));var express=require(_0xaf60('0x3'));var router=express['Router']();var fs_extra=require(_0xaf60('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaf60('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xaf60('0x6')]('/',auth[_0xaf60('0x7')](),controller[_0xaf60('0x8')]);router[_0xaf60('0x6')](_0xaf60('0x9'),auth[_0xaf60('0x7')](),controller[_0xaf60('0xa')]);router['get'](_0xaf60('0xb'),auth['isAuthenticated'](),controller[_0xaf60('0xc')]);router[_0xaf60('0x6')]('/:id/fields',auth[_0xaf60('0x7')](),controller['getFields']);router['post']('/',auth['isAuthenticated'](),controller[_0xaf60('0xd')]);router[_0xaf60('0xe')](_0xaf60('0xb'),auth[_0xaf60('0x7')](),controller[_0xaf60('0xf')]);router[_0xaf60('0x10')](_0xaf60('0x9'),auth[_0xaf60('0x7')](),controller[_0xaf60('0x11')]);router[_0xaf60('0x12')]('/:id',auth[_0xaf60('0x7')](),controller[_0xaf60('0x13')]);module[_0xaf60('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8346445..d331bdb 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 _0xe81d=['STRING','username','remoteUri','sequelize','exports'];(function(_0x2a2684,_0x405ba6){var _0x2436d8=function(_0x24c6ae){while(--_0x24c6ae){_0x2a2684['push'](_0x2a2684['shift']());}};_0x2436d8(++_0x405ba6);}(_0xe81d,0x1e8));var _0xde81=function(_0x5c8628,_0x5f54cc){_0x5c8628=_0x5c8628-0x0;var _0x54c839=_0xe81d[_0x5c8628];return _0x54c839;};'use strict';var Sequelize=require(_0xde81('0x0'));module[_0xde81('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xde81('0x2')]},'username':{'type':Sequelize[_0xde81('0x2')],'unique':_0xde81('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xde81('0x2')]},'remoteUri':{'type':Sequelize[_0xde81('0x2')],'unique':_0xde81('0x4')},'serverUrl':{'type':Sequelize[_0xde81('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x4f44=['sequelize','STRING','remoteUri'];(function(_0x2ef44b,_0x553359){var _0x2405b9=function(_0x278290){while(--_0x278290){_0x2ef44b['push'](_0x2ef44b['shift']());}};_0x2405b9(++_0x553359);}(_0x4f44,0x144));var _0x44f4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4f44[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x44f4('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x44f4('0x1')]},'username':{'type':Sequelize[_0x44f4('0x1')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x44f4('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x44f4('0x2')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 0eee9bd..07fb316 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 _0x5647=['sys_mod_count','escalation','correlation_id','username','password','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','statusCode','test','Wrong\x20credentials','boolean','true','False','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','params','rawAttributes','include','find','catch','create','update','body','destroy','getConfigurations','findOne','ServicenowConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','severity','category','parent','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','delivery_plan','impact','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','assigned_to','comments','approval','comments_and_work_notes','due_date'];(function(_0x542356,_0x4b4a5e){var _0x338e8f=function(_0x49b3d6){while(--_0x49b3d6){_0x542356['push'](_0x542356['shift']());}};_0x338e8f(++_0x4b4a5e);}(_0x5647,0x19a));var _0x7564=function(_0x23e202,_0x4762da){_0x23e202=_0x23e202-0x0;var _0xdbeddc=_0x5647[_0x23e202];return _0xdbeddc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7564('0x0'));var zipdir=require(_0x7564('0x1'));var jsonpatch=require(_0x7564('0x2'));var rp=require(_0x7564('0x3'));var moment=require(_0x7564('0x4'));var BPromise=require(_0x7564('0x5'));var Mustache=require(_0x7564('0x6'));var util=require(_0x7564('0x7'));var path=require(_0x7564('0x8'));var sox=require(_0x7564('0x9'));var csv=require('to-csv');var ejs=require(_0x7564('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7564('0xb'));var squel=require(_0x7564('0xc'));var crypto=require(_0x7564('0xd'));var jsforce=require(_0x7564('0xe'));var deskjs=require(_0x7564('0xf'));var toCsv=require(_0x7564('0x10'));var querystring=require('querystring');var Papa=require(_0x7564('0x11'));var Redis=require(_0x7564('0x12'));var authService=require(_0x7564('0x13'));var qs=require(_0x7564('0x14'));var as=require(_0x7564('0x15'));var hardwareService=require(_0x7564('0x16'));var logger=require(_0x7564('0x17'))('api');var utils=require(_0x7564('0x18'));var config=require(_0x7564('0x19'));var licenseUtil=require(_0x7564('0x1a'));var db=require(_0x7564('0x1b'))['db'];var integrations=require(_0x7564('0x1c'));function respondWithStatusCode(_0x42279b,_0x282bc1){_0x282bc1=_0x282bc1||0xcc;return function(_0x1c5901){if(_0x1c5901){return _0x42279b[_0x7564('0x1d')](_0x282bc1);}return _0x42279b[_0x7564('0x1e')](_0x282bc1)[_0x7564('0x1f')]();};}function respondWithResult(_0x3f38e6,_0x5e8466){_0x5e8466=_0x5e8466||0xc8;return function(_0x58caa4){if(_0x58caa4){return _0x3f38e6['status'](_0x5e8466)[_0x7564('0x20')](_0x58caa4);}};}function respondWithFilteredResult(_0x12334d,_0xdb147b){return function(_0x381d48){if(_0x381d48){var _0x56831f=typeof _0xdb147b[_0x7564('0x21')]==='undefined'&&typeof _0xdb147b[_0x7564('0x22')]===_0x7564('0x23');var _0x15a831=_0x381d48[_0x7564('0x24')];var _0x3d545a=_0x56831f?0x0:_0xdb147b[_0x7564('0x21')];var _0x798241=_0x56831f?_0x381d48[_0x7564('0x24')]:_0xdb147b['offset']+_0xdb147b[_0x7564('0x22')];var _0x11a0f6;if(_0x798241>=_0x15a831){_0x798241=_0x15a831;_0x11a0f6=0xc8;}else{_0x11a0f6=0xce;}_0x12334d[_0x7564('0x1e')](_0x11a0f6);return _0x12334d['set'](_0x7564('0x25'),_0x3d545a+'-'+_0x798241+'/'+_0x15a831)['json'](_0x381d48);}return null;};}function patchUpdates(_0x2cd255){return function(_0x2d4813){try{jsonpatch[_0x7564('0x26')](_0x2d4813,_0x2cd255,!![]);}catch(_0x549694){return BPromise[_0x7564('0x27')](_0x549694);}return _0x2d4813[_0x7564('0x28')]();};}function saveUpdates(_0x385264,_0x23ace9){return function(_0x3ad9e8){if(_0x3ad9e8){return _0x3ad9e8['update'](_0x385264)['then'](function(_0x29dfbb){return _0x29dfbb;});}return null;};}function removeEntity(_0x2fbd62,_0x4d7a0c){return function(_0x184598){if(_0x184598){return _0x184598['destroy']()[_0x7564('0x29')](function(){_0x2fbd62[_0x7564('0x1e')](0xcc)[_0x7564('0x1f')]();});}};}function handleEntityNotFound(_0x4b257e,_0x171731){return function(_0x473862){if(!_0x473862){_0x4b257e[_0x7564('0x1d')](0x194);}return _0x473862;};}function handleError(_0x1c36a0,_0x25d37a){_0x25d37a=_0x25d37a||0x1f4;return function(_0x5716a9){logger[_0x7564('0x2a')](_0x5716a9[_0x7564('0x2b')]);if(_0x5716a9[_0x7564('0x2c')]){delete _0x5716a9['name'];}_0x1c36a0[_0x7564('0x1e')](_0x25d37a)[_0x7564('0x2d')](_0x5716a9);};}exports[_0x7564('0x2e')]=function(_0x58ce7a,_0x36266c){var _0x491458={},_0x1c0a83={},_0x3cfbfa={'count':0x0,'rows':[]};var _0x461615=_[_0x7564('0x2f')](db[_0x7564('0x30')]['rawAttributes'],function(_0x53ca10){return{'name':_0x53ca10[_0x7564('0x31')],'type':_0x53ca10[_0x7564('0x32')][_0x7564('0x33')]};});_0x1c0a83[_0x7564('0x34')]=_[_0x7564('0x2f')](_0x461615,'name');_0x1c0a83[_0x7564('0x35')]=_[_0x7564('0x36')](_0x58ce7a[_0x7564('0x35')]);_0x1c0a83[_0x7564('0x37')]=_[_0x7564('0x38')](_0x1c0a83[_0x7564('0x34')],_0x1c0a83[_0x7564('0x35')]);_0x491458[_0x7564('0x39')]=_['intersection'](_0x1c0a83[_0x7564('0x34')],qs['fields'](_0x58ce7a[_0x7564('0x35')][_0x7564('0x3a')]));_0x491458[_0x7564('0x39')]=_0x491458['attributes'][_0x7564('0x3b')]?_0x491458[_0x7564('0x39')]:_0x1c0a83[_0x7564('0x34')];if(!_0x58ce7a['query'][_0x7564('0x3c')](_0x7564('0x3d'))){_0x491458[_0x7564('0x22')]=qs[_0x7564('0x22')](_0x58ce7a[_0x7564('0x35')][_0x7564('0x22')]);_0x491458[_0x7564('0x21')]=qs['offset'](_0x58ce7a['query'][_0x7564('0x21')]);}_0x491458[_0x7564('0x3e')]=qs['sort'](_0x58ce7a['query'][_0x7564('0x3f')]);_0x491458[_0x7564('0x40')]=qs[_0x7564('0x37')](_[_0x7564('0x41')](_0x58ce7a[_0x7564('0x35')],_0x1c0a83[_0x7564('0x37')]),_0x461615);if(_0x58ce7a[_0x7564('0x35')]['filter']){_0x491458[_0x7564('0x40')]=_['merge'](_0x491458[_0x7564('0x40')],{'$or':_[_0x7564('0x2f')](_0x461615,function(_0x15213c){if(_0x15213c['type']!==_0x7564('0x42')){var _0x46a007={};_0x46a007[_0x15213c[_0x7564('0x2c')]]={'$like':'%'+_0x58ce7a[_0x7564('0x35')]['filter']+'%'};return _0x46a007;}})});}_0x491458=_[_0x7564('0x43')]({},_0x491458,_0x58ce7a[_0x7564('0x44')]);var _0x59675a={'where':_0x491458[_0x7564('0x40')]};return db[_0x7564('0x30')][_0x7564('0x24')](_0x59675a)[_0x7564('0x29')](function(_0x288b3b){_0x3cfbfa[_0x7564('0x24')]=_0x288b3b;if(_0x58ce7a[_0x7564('0x35')][_0x7564('0x45')]){_0x491458['include']=[{'all':!![]}];}return db[_0x7564('0x30')]['findAll'](_0x491458);})[_0x7564('0x29')](function(_0x2206ea){_0x3cfbfa['rows']=_0x2206ea;return _0x3cfbfa;})['then'](respondWithFilteredResult(_0x36266c,_0x491458))['catch'](handleError(_0x36266c,null));};exports['show']=function(_0x476bb9,_0x5abc67){var _0x17c0e4={'raw':![],'where':{'id':_0x476bb9[_0x7564('0x46')]['id']}},_0x246c6c={};_0x246c6c[_0x7564('0x34')]=_['keys'](db['ServicenowAccount'][_0x7564('0x47')]);_0x246c6c['query']=_[_0x7564('0x36')](_0x476bb9['query']);_0x246c6c[_0x7564('0x37')]=_[_0x7564('0x38')](_0x246c6c[_0x7564('0x34')],_0x246c6c[_0x7564('0x35')]);_0x17c0e4[_0x7564('0x39')]=_[_0x7564('0x38')](_0x246c6c[_0x7564('0x34')],qs[_0x7564('0x3a')](_0x476bb9[_0x7564('0x35')][_0x7564('0x3a')]));_0x17c0e4['attributes']=_0x17c0e4[_0x7564('0x39')]['length']?_0x17c0e4[_0x7564('0x39')]:_0x246c6c[_0x7564('0x34')];if(_0x476bb9[_0x7564('0x35')]['includeAll']){_0x17c0e4[_0x7564('0x48')]=[{'all':!![]}];}_0x17c0e4=_[_0x7564('0x43')]({},_0x17c0e4,_0x476bb9[_0x7564('0x44')]);return db[_0x7564('0x30')][_0x7564('0x49')](_0x17c0e4)[_0x7564('0x29')](handleEntityNotFound(_0x5abc67,null))[_0x7564('0x29')](respondWithResult(_0x5abc67,null))[_0x7564('0x4a')](handleError(_0x5abc67,null));};exports[_0x7564('0x4b')]=function(_0x119782,_0x37a706){return db[_0x7564('0x30')][_0x7564('0x4b')](_0x119782['body'],{})[_0x7564('0x29')](respondWithResult(_0x37a706,0xc9))[_0x7564('0x4a')](handleError(_0x37a706,null));};exports[_0x7564('0x4c')]=function(_0x313d95,_0x3f83ef){if(_0x313d95[_0x7564('0x4d')]['id']){delete _0x313d95[_0x7564('0x4d')]['id'];}return db[_0x7564('0x30')][_0x7564('0x49')]({'where':{'id':_0x313d95['params']['id']}})[_0x7564('0x29')](handleEntityNotFound(_0x3f83ef,null))[_0x7564('0x29')](saveUpdates(_0x313d95[_0x7564('0x4d')],null))[_0x7564('0x29')](respondWithResult(_0x3f83ef,null))[_0x7564('0x4a')](handleError(_0x3f83ef,null));};exports[_0x7564('0x4e')]=function(_0x5c048e,_0x118ca4){return db['ServicenowAccount']['find']({'where':{'id':_0x5c048e[_0x7564('0x46')]['id']}})[_0x7564('0x29')](handleEntityNotFound(_0x118ca4,null))[_0x7564('0x29')](removeEntity(_0x118ca4,null))[_0x7564('0x4a')](handleError(_0x118ca4,null));};exports[_0x7564('0x4f')]=function(_0x1c8b4f,_0x4a80eb,_0x242418){var _0x391aa1={};var _0x1a3cb9={};var _0x760ae1;var _0x121fe5;return db[_0x7564('0x30')][_0x7564('0x50')]({'where':{'id':_0x1c8b4f[_0x7564('0x46')]['id']}})[_0x7564('0x29')](handleEntityNotFound(_0x4a80eb,null))[_0x7564('0x29')](function(_0x821b64){if(_0x821b64){_0x760ae1=_0x821b64;_0x1a3cb9[_0x7564('0x34')]=_[_0x7564('0x36')](db[_0x7564('0x51')][_0x7564('0x47')]);_0x1a3cb9[_0x7564('0x35')]=_[_0x7564('0x36')](_0x1c8b4f[_0x7564('0x35')]);_0x1a3cb9['filters']=_[_0x7564('0x38')](_0x1a3cb9['model'],_0x1a3cb9[_0x7564('0x35')]);_0x391aa1[_0x7564('0x39')]=_[_0x7564('0x38')](_0x1a3cb9[_0x7564('0x34')],qs[_0x7564('0x3a')](_0x1c8b4f[_0x7564('0x35')][_0x7564('0x3a')]));_0x391aa1[_0x7564('0x39')]=_0x391aa1[_0x7564('0x39')][_0x7564('0x3b')]?_0x391aa1[_0x7564('0x39')]:_0x1a3cb9[_0x7564('0x34')];_0x391aa1['order']=qs[_0x7564('0x3f')](_0x1c8b4f[_0x7564('0x35')][_0x7564('0x3f')]);_0x391aa1[_0x7564('0x40')]=qs['filters'](_['pick'](_0x1c8b4f[_0x7564('0x35')],_0x1a3cb9[_0x7564('0x37')]));if(_0x1c8b4f[_0x7564('0x35')][_0x7564('0x52')]){_0x391aa1[_0x7564('0x40')]=_['merge'](_0x391aa1[_0x7564('0x40')],{'$or':_['map'](_0x391aa1[_0x7564('0x39')],function(_0x59bdf1){var _0x52e95f={};_0x52e95f[_0x59bdf1]={'$like':'%'+_0x1c8b4f['query'][_0x7564('0x52')]+'%'};return _0x52e95f;})});}_0x391aa1=_[_0x7564('0x43')]({},_0x391aa1,_0x1c8b4f[_0x7564('0x44')]);return _0x760ae1[_0x7564('0x4f')](_0x391aa1);}})[_0x7564('0x29')](function(_0x49ecb1){if(_0x49ecb1){_0x121fe5=_0x49ecb1[_0x7564('0x3b')];if(!_0x1c8b4f['query'][_0x7564('0x3c')]('nolimit')){_0x391aa1['limit']=qs[_0x7564('0x22')](_0x1c8b4f[_0x7564('0x35')]['limit']);_0x391aa1[_0x7564('0x21')]=qs[_0x7564('0x21')](_0x1c8b4f[_0x7564('0x35')][_0x7564('0x21')]);}return _0x760ae1[_0x7564('0x4f')](_0x391aa1);}})[_0x7564('0x29')](function(_0x211774){if(_0x211774){return _0x211774?{'count':_0x121fe5,'rows':_0x211774}:null;}})[_0x7564('0x29')](respondWithResult(_0x4a80eb,null))['catch'](handleError(_0x4a80eb,null));};exports[_0x7564('0x53')]=function(_0x53e881,_0x594ba0,_0x9a65b0){if(_0x53e881[_0x7564('0x4d')]['id']){delete _0x53e881[_0x7564('0x4d')]['id'];}return db[_0x7564('0x30')][_0x7564('0x50')]({'where':{'id':_0x53e881['params']['id']}})[_0x7564('0x29')](handleEntityNotFound(_0x594ba0,null))[_0x7564('0x29')](function(_0x4720f3){if(_0x4720f3){_0x53e881[_0x7564('0x4d')][_0x7564('0x54')]=_0x4720f3['id'];_0x53e881['body'][_0x7564('0x55')]=integrations[_0x7564('0x56')](_0x53e881['body'][_0x7564('0x57')],_0x53e881['body']['type']);_0x53e881[_0x7564('0x4d')]['Descriptions']=integrations[_0x7564('0x58')](_0x53e881[_0x7564('0x4d')]['channel'],_0x53e881[_0x7564('0x4d')]['type']);return db['ServicenowConfiguration'][_0x7564('0x4b')](_0x53e881['body'],{'include':[{'model':db[_0x7564('0x59')],'as':_0x7564('0x55')},{'model':db[_0x7564('0x59')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x594ba0,null))[_0x7564('0x4a')](handleError(_0x594ba0,null));};exports[_0x7564('0x5a')]=function(_0x283d29,_0x3d4e10,_0x5ce0c9){var _0x3801be=[_0x7564('0x5b'),_0x7564('0x5c'),_0x7564('0x5d'),_0x7564('0x5e'),_0x7564('0x5f'),_0x7564('0x60'),'incident_state',_0x7564('0x61'),_0x7564('0x62')];var _0x35f53e=[_0x7564('0x63'),_0x7564('0x5b'),'caused_by','watch_list','upon_reject',_0x7564('0x64'),_0x7564('0x65'),_0x7564('0x5c'),_0x7564('0x66'),'number',_0x7564('0x67'),_0x7564('0x68'),_0x7564('0x69'),'user_input',_0x7564('0x6a'),_0x7564('0x6b'),'state',_0x7564('0x6c'),'knowledge',_0x7564('0x3e'),_0x7564('0x6d'),_0x7564('0x6e'),'cmdb_ci',_0x7564('0x6f'),_0x7564('0x70'),'active','work_notes_list',_0x7564('0x71'),_0x7564('0x72'),_0x7564('0x73'),_0x7564('0x74'),_0x7564('0x75'),_0x7564('0x76'),_0x7564('0x77'),_0x7564('0x78'),_0x7564('0x79'),_0x7564('0x7a'),'reopened_time',_0x7564('0x7b'),_0x7564('0x7c'),_0x7564('0x7d'),_0x7564('0x5e'),_0x7564('0x7e'),_0x7564('0x7f'),'close_code',_0x7564('0x80'),_0x7564('0x81'),_0x7564('0x82'),_0x7564('0x83'),_0x7564('0x84'),_0x7564('0x85'),_0x7564('0x86'),_0x7564('0x87'),_0x7564('0x60'),_0x7564('0x88'),_0x7564('0x89'),'closed_by',_0x7564('0x8a'),_0x7564('0x8b'),_0x7564('0x8c'),_0x7564('0x8d'),_0x7564('0x8e'),_0x7564('0x8f'),_0x7564('0x90'),_0x7564('0x91'),'company','reassignment_count','activity_due',_0x7564('0x92'),_0x7564('0x61'),_0x7564('0x93'),'sla_due',_0x7564('0x94'),_0x7564('0x95'),_0x7564('0x96'),_0x7564('0x97'),'reopen_count','sys_tags',_0x7564('0x98'),'upon_approval',_0x7564('0x99'),'location',_0x7564('0x62')];var _0x517545='';var _0x36cb62='';var _0x564715=[];var _0x383876='';var _0x3daeed='';var _0x12f094=[];var _0x18046d='';var _0x39c0c6='';var _0x3bcc26={};var _0x21dde3='';return db[_0x7564('0x30')][_0x7564('0x50')]({'where':{'id':_0x283d29[_0x7564('0x46')]['id']},'attributes':['id',_0x7564('0x9a'),_0x7564('0x9b'),'email','remoteUri',_0x7564('0x9c')]})[_0x7564('0x29')](handleEntityNotFound(_0x3d4e10,null))[_0x7564('0x29')](function(_0x34d628){if(_0x34d628){_0x21dde3=_0x34d628['remoteUri'];var _0x36f561=_0x21dde3[_0x7564('0x9d')](-0x1);if(_0x36f561==='/'){_0x21dde3=_0x21dde3[_0x7564('0x9e')](0x0,_0x21dde3[_0x7564('0x9f')](_0x36f561));}_0x39c0c6=util[_0x7564('0xa0')]('%s/api/now/doc/table/schema/',_0x21dde3);_0x18046d=util[_0x7564('0xa0')](_0x7564('0xa1'),_0x21dde3);_0x3bcc26={'user':_0x34d628[_0x7564('0x9a')],'pass':_0x34d628[_0x7564('0x9b')]};var _0xef5e7c={'method':'GET','uri':_0x39c0c6+_0x7564('0xa2'),'auth':_0x3bcc26,'json':!![]};return rp(_0xef5e7c);}})[_0x7564('0x29')](function(_0x11ba5a){if(_0x11ba5a[_0x7564('0xa3')][_0x7564('0x3b')]>0x0){_0x517545=_0x11ba5a[_0x7564('0xa3')];}console[_0x7564('0xa4')](_0x7564('0xa5'),_0x517545);_0x12f094=[];_0x36cb62=Object[_0x7564('0xa6')]([],_0x517545);_[_0x7564('0xa7')](_0x36cb62,function(_0x2ae5ab){return!_0x3801be[_0x7564('0xa8')](_0x2ae5ab[_0x7564('0x2c')]);});_0x36cb62[_0x7564('0xa9')](function(_0x3bca0d){var _0x394790=createFieldObject(_0x18046d,_0x3bcc26,_0x3bca0d[_0x7564('0xaa')],_0x3bca0d[_0x7564('0x2c')],_0x3bca0d[_0x7564('0xab')],![]);_0x12f094['push'](_0x394790);});return Promise[_0x7564('0xac')](_0x12f094);})[_0x7564('0x29')](function(_0x2c07e2){_0x564715=_0x2c07e2;_0x383876=Object[_0x7564('0xa6')]([],_0x517545);console[_0x7564('0xa4')](_0x7564('0xad'),_0x517545);_[_0x7564('0xa7')](_0x383876,function(_0x5bd05){return _0x35f53e['includes'](_0x5bd05[_0x7564('0x2c')]);});console[_0x7564('0xa4')](_0x7564('0xae'),_0x383876);_0x12f094=[];_0x383876[_0x7564('0xa9')](function(_0x71b876){var _0x524629=createFieldObject(_0x18046d,_0x3bcc26,_0x71b876[_0x7564('0xaa')],_0x71b876[_0x7564('0x2c')],_0x71b876[_0x7564('0xab')],!![]);_0x12f094[_0x7564('0xaf')](_0x524629);});return Promise[_0x7564('0xac')](_0x12f094);})[_0x7564('0x29')](function(_0x15310f){_0x3daeed=_0x15310f;var _0x37fb63=_0x564715[_0x7564('0xb0')](_0x3daeed);return{'count':_0x37fb63[_0x7564('0x3b')],'rows':_0x37fb63};})[_0x7564('0x29')](respondWithResult(_0x3d4e10,null))[_0x7564('0x4a')](function(_0x4b5fe5){console['log']('ServiceNow\x20error:\x20'+_0x4b5fe5);var _0x3c4f58=_0x283d29[_0x7564('0x35')]['test']?0x1f4:_0x4b5fe5[_0x7564('0xb1')]||0x1f4;logger[_0x7564('0x2a')](_0x4b5fe5[_0x7564('0x2b')]);delete _0x4b5fe5[_0x7564('0x2c')];if(_0x3c4f58===0x191){_0x3c4f58=0x190;}_0x3d4e10['status'](_0x3c4f58)[_0x7564('0x2d')](_0x283d29[_0x7564('0x35')][_0x7564('0xb2')]?{'message':_0x7564('0xb3'),'statusCode':_0x4b5fe5[_0x7564('0xb1')]}:_0x4b5fe5);});};function createFieldObject(_0x592a90,_0x366af7,_0x4a72d0,_0x1ec687,_0x924703,_0x13ecd7){return new Promise(function(_0x41143f,_0x45e37a){var _0x286cd5={'id':_0x1ec687,'name':_0x924703,'custom':_0x13ecd7};if(_0x4a72d0===_0x7564('0xb4')){_0x286cd5[_0x7564('0x44')]=[{'name':'True','value':_0x7564('0xb5')},{'name':_0x7564('0xb6'),'value':_0x7564('0xb7')}];_0x41143f(_0x286cd5);}else{var _0x25766a={'method':_0x7564('0xb8'),'uri':_0x592a90+_0x7564('0xb9')+_0x1ec687,'auth':_0x366af7,'json':!![]};return rp(_0x25766a)['then'](function(_0x4f9ebe){var _0x3b0e07=[];if(_0x4f9ebe[_0x7564('0xa3')][_0x7564('0x3b')]>0x0){_0x4f9ebe[_0x7564('0xa3')]['forEach'](function(_0x20458e){if(_0x20458e[_0x7564('0xba')]===_0x7564('0xb7')){var _0x3fc6d8={'name':_0x20458e['label'],'value':_0x20458e['value']};_0x3b0e07[_0x7564('0xaf')](_0x3fc6d8);}});}_0x286cd5[_0x7564('0x44')]=_0x3b0e07;if(_0x286cd5['options'][_0x7564('0x3b')]>0x0){_0x41143f(_0x286cd5);}else{if(_0x13ecd7==![]){_0x41143f();}else{_0x41143f(_0x286cd5);}}});}});} \ No newline at end of file +var _0xfb51=['severity','category','parent','caused_by','watch_list','upon_reject','child_incidents','number','sys_updated_by','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','work_end','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','close_notes','parent_incident','sys_id','contact_type','reopened_by','urgency','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','username','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','password','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','label','push','all','log','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','concat','ServiceNow\x20error:\x20','test','Wrong\x20credentials','statusCode','boolean','True','false','GET','sys_choice?sysparm_query=name=incident^element=','inactive','value','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','ServicenowAccount','options','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','nolimit','addConfiguration','Subjects','getSubjects','channel','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','incident_state'];(function(_0x207245,_0x4f04f0){var _0x2f91d4=function(_0x280771){while(--_0x280771){_0x207245['push'](_0x207245['shift']());}};_0x2f91d4(++_0x4f04f0);}(_0xfb51,0x113));var _0x1fb5=function(_0x2f7023,_0x1aa399){_0x2f7023=_0x2f7023-0x0;var _0x2f5e4e=_0xfb51[_0x2f7023];return _0x2f5e4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fb5('0x0'));var zipdir=require(_0x1fb5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1fb5('0x2'));var Mustache=require(_0x1fb5('0x3'));var util=require('util');var path=require(_0x1fb5('0x4'));var sox=require(_0x1fb5('0x5'));var csv=require(_0x1fb5('0x6'));var ejs=require(_0x1fb5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fb5('0x8'));var squel=require('squel');var crypto=require(_0x1fb5('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x1fb5('0xa'));var toCsv=require(_0x1fb5('0x6'));var querystring=require(_0x1fb5('0xb'));var Papa=require(_0x1fb5('0xc'));var Redis=require(_0x1fb5('0xd'));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(_0x1fb5('0xe'))(_0x1fb5('0xf'));var utils=require(_0x1fb5('0x10'));var config=require(_0x1fb5('0x11'));var licenseUtil=require(_0x1fb5('0x12'));var db=require(_0x1fb5('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x556a72,_0x5c50be){_0x5c50be=_0x5c50be||0xcc;return function(_0x18bfee){if(_0x18bfee){return _0x556a72['sendStatus'](_0x5c50be);}return _0x556a72['status'](_0x5c50be)[_0x1fb5('0x14')]();};}function respondWithResult(_0x784324,_0x3776cd){_0x3776cd=_0x3776cd||0xc8;return function(_0x543084){if(_0x543084){return _0x784324[_0x1fb5('0x15')](_0x3776cd)[_0x1fb5('0x16')](_0x543084);}};}function respondWithFilteredResult(_0x48ee84,_0x27adfd){return function(_0x65a6f4){if(_0x65a6f4){var _0x1c1996=typeof _0x27adfd['offset']===_0x1fb5('0x17')&&typeof _0x27adfd[_0x1fb5('0x18')]===_0x1fb5('0x17');var _0x3b50ab=_0x65a6f4['count'];var _0x25398e=_0x1c1996?0x0:_0x27adfd[_0x1fb5('0x19')];var _0x5cf519=_0x1c1996?_0x65a6f4[_0x1fb5('0x1a')]:_0x27adfd[_0x1fb5('0x19')]+_0x27adfd[_0x1fb5('0x18')];var _0x13aa82;if(_0x5cf519>=_0x3b50ab){_0x5cf519=_0x3b50ab;_0x13aa82=0xc8;}else{_0x13aa82=0xce;}_0x48ee84[_0x1fb5('0x15')](_0x13aa82);return _0x48ee84[_0x1fb5('0x1b')](_0x1fb5('0x1c'),_0x25398e+'-'+_0x5cf519+'/'+_0x3b50ab)[_0x1fb5('0x16')](_0x65a6f4);}return null;};}function patchUpdates(_0xecc5d5){return function(_0x48a0f7){try{jsonpatch[_0x1fb5('0x1d')](_0x48a0f7,_0xecc5d5,!![]);}catch(_0x4f13d5){return BPromise['reject'](_0x4f13d5);}return _0x48a0f7[_0x1fb5('0x1e')]();};}function saveUpdates(_0x1343ec,_0x955235){return function(_0x60d206){if(_0x60d206){return _0x60d206[_0x1fb5('0x1f')](_0x1343ec)[_0x1fb5('0x20')](function(_0x5d2169){return _0x5d2169;});}return null;};}function removeEntity(_0x94d8e8,_0x2b36c2){return function(_0x14c476){if(_0x14c476){return _0x14c476[_0x1fb5('0x21')]()[_0x1fb5('0x20')](function(){_0x94d8e8['status'](0xcc)[_0x1fb5('0x14')]();});}};}function handleEntityNotFound(_0x422edd,_0x1c8b35){return function(_0x1b46c0){if(!_0x1b46c0){_0x422edd[_0x1fb5('0x22')](0x194);}return _0x1b46c0;};}function handleError(_0x1cee2b,_0x565e78){_0x565e78=_0x565e78||0x1f4;return function(_0x51a57d){logger[_0x1fb5('0x23')](_0x51a57d['stack']);if(_0x51a57d[_0x1fb5('0x24')]){delete _0x51a57d[_0x1fb5('0x24')];}_0x1cee2b['status'](_0x565e78)[_0x1fb5('0x25')](_0x51a57d);};}exports['index']=function(_0x4a1127,_0x48b77a){var _0x3f2c0f={},_0x3961d0={},_0x166e3c={'count':0x0,'rows':[]};var _0x3adf7a=_[_0x1fb5('0x26')](db['ServicenowAccount'][_0x1fb5('0x27')],function(_0x15260f){return{'name':_0x15260f[_0x1fb5('0x28')],'type':_0x15260f[_0x1fb5('0x29')]['key']};});_0x3961d0['model']=_[_0x1fb5('0x26')](_0x3adf7a,_0x1fb5('0x24'));_0x3961d0[_0x1fb5('0x2a')]=_[_0x1fb5('0x2b')](_0x4a1127[_0x1fb5('0x2a')]);_0x3961d0[_0x1fb5('0x2c')]=_[_0x1fb5('0x2d')](_0x3961d0[_0x1fb5('0x2e')],_0x3961d0[_0x1fb5('0x2a')]);_0x3f2c0f['attributes']=_[_0x1fb5('0x2d')](_0x3961d0[_0x1fb5('0x2e')],qs['fields'](_0x4a1127[_0x1fb5('0x2a')][_0x1fb5('0x2f')]));_0x3f2c0f['attributes']=_0x3f2c0f[_0x1fb5('0x30')][_0x1fb5('0x31')]?_0x3f2c0f['attributes']:_0x3961d0[_0x1fb5('0x2e')];if(!_0x4a1127['query'][_0x1fb5('0x32')]('nolimit')){_0x3f2c0f[_0x1fb5('0x18')]=qs[_0x1fb5('0x18')](_0x4a1127[_0x1fb5('0x2a')][_0x1fb5('0x18')]);_0x3f2c0f[_0x1fb5('0x19')]=qs[_0x1fb5('0x19')](_0x4a1127['query'][_0x1fb5('0x19')]);}_0x3f2c0f['order']=qs['sort'](_0x4a1127[_0x1fb5('0x2a')][_0x1fb5('0x33')]);_0x3f2c0f[_0x1fb5('0x34')]=qs[_0x1fb5('0x2c')](_[_0x1fb5('0x35')](_0x4a1127['query'],_0x3961d0[_0x1fb5('0x2c')]),_0x3adf7a);if(_0x4a1127['query'][_0x1fb5('0x36')]){_0x3f2c0f[_0x1fb5('0x34')]=_[_0x1fb5('0x37')](_0x3f2c0f[_0x1fb5('0x34')],{'$or':_[_0x1fb5('0x26')](_0x3adf7a,function(_0x2a271d){if(_0x2a271d[_0x1fb5('0x29')]!==_0x1fb5('0x38')){var _0x52c462={};_0x52c462[_0x2a271d['name']]={'$like':'%'+_0x4a1127[_0x1fb5('0x2a')][_0x1fb5('0x36')]+'%'};return _0x52c462;}})});}_0x3f2c0f=_[_0x1fb5('0x37')]({},_0x3f2c0f,_0x4a1127['options']);var _0x4b580f={'where':_0x3f2c0f['where']};return db['ServicenowAccount']['count'](_0x4b580f)[_0x1fb5('0x20')](function(_0xd2bf0d){_0x166e3c['count']=_0xd2bf0d;if(_0x4a1127[_0x1fb5('0x2a')][_0x1fb5('0x39')]){_0x3f2c0f[_0x1fb5('0x3a')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x1fb5('0x3b')](_0x3f2c0f);})['then'](function(_0x4b67ed){_0x166e3c[_0x1fb5('0x3c')]=_0x4b67ed;return _0x166e3c;})[_0x1fb5('0x20')](respondWithFilteredResult(_0x48b77a,_0x3f2c0f))[_0x1fb5('0x3d')](handleError(_0x48b77a,null));};exports['show']=function(_0x5b904e,_0x55bf20){var _0x2fce69={'raw':![],'where':{'id':_0x5b904e[_0x1fb5('0x3e')]['id']}},_0x3f254c={};_0x3f254c[_0x1fb5('0x2e')]=_[_0x1fb5('0x2b')](db[_0x1fb5('0x3f')]['rawAttributes']);_0x3f254c['query']=_[_0x1fb5('0x2b')](_0x5b904e[_0x1fb5('0x2a')]);_0x3f254c['filters']=_['intersection'](_0x3f254c[_0x1fb5('0x2e')],_0x3f254c[_0x1fb5('0x2a')]);_0x2fce69['attributes']=_['intersection'](_0x3f254c[_0x1fb5('0x2e')],qs[_0x1fb5('0x2f')](_0x5b904e['query'][_0x1fb5('0x2f')]));_0x2fce69[_0x1fb5('0x30')]=_0x2fce69[_0x1fb5('0x30')][_0x1fb5('0x31')]?_0x2fce69[_0x1fb5('0x30')]:_0x3f254c[_0x1fb5('0x2e')];if(_0x5b904e[_0x1fb5('0x2a')][_0x1fb5('0x39')]){_0x2fce69[_0x1fb5('0x3a')]=[{'all':!![]}];}_0x2fce69=_[_0x1fb5('0x37')]({},_0x2fce69,_0x5b904e[_0x1fb5('0x40')]);return db[_0x1fb5('0x3f')][_0x1fb5('0x41')](_0x2fce69)[_0x1fb5('0x20')](handleEntityNotFound(_0x55bf20,null))[_0x1fb5('0x20')](respondWithResult(_0x55bf20,null))['catch'](handleError(_0x55bf20,null));};exports[_0x1fb5('0x42')]=function(_0x3ed23f,_0xf9ce82){return db[_0x1fb5('0x3f')]['create'](_0x3ed23f[_0x1fb5('0x43')],{})[_0x1fb5('0x20')](respondWithResult(_0xf9ce82,0xc9))['catch'](handleError(_0xf9ce82,null));};exports[_0x1fb5('0x1f')]=function(_0x3cbc58,_0x48cae3){if(_0x3cbc58[_0x1fb5('0x43')]['id']){delete _0x3cbc58['body']['id'];}return db['ServicenowAccount'][_0x1fb5('0x41')]({'where':{'id':_0x3cbc58[_0x1fb5('0x3e')]['id']}})[_0x1fb5('0x20')](handleEntityNotFound(_0x48cae3,null))['then'](saveUpdates(_0x3cbc58['body'],null))['then'](respondWithResult(_0x48cae3,null))[_0x1fb5('0x3d')](handleError(_0x48cae3,null));};exports[_0x1fb5('0x21')]=function(_0x59b6dc,_0x5ee93a){return db[_0x1fb5('0x3f')][_0x1fb5('0x41')]({'where':{'id':_0x59b6dc[_0x1fb5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5ee93a,null))[_0x1fb5('0x20')](removeEntity(_0x5ee93a,null))[_0x1fb5('0x3d')](handleError(_0x5ee93a,null));};exports[_0x1fb5('0x44')]=function(_0x17e155,_0x832214,_0x40a713){var _0x41d50b={};var _0x553e0b={};var _0x13117b;var _0x1f010a;return db[_0x1fb5('0x3f')][_0x1fb5('0x45')]({'where':{'id':_0x17e155[_0x1fb5('0x3e')]['id']}})['then'](handleEntityNotFound(_0x832214,null))[_0x1fb5('0x20')](function(_0x4c0d9b){if(_0x4c0d9b){_0x13117b=_0x4c0d9b;_0x553e0b[_0x1fb5('0x2e')]=_[_0x1fb5('0x2b')](db[_0x1fb5('0x46')][_0x1fb5('0x27')]);_0x553e0b[_0x1fb5('0x2a')]=_[_0x1fb5('0x2b')](_0x17e155[_0x1fb5('0x2a')]);_0x553e0b[_0x1fb5('0x2c')]=_[_0x1fb5('0x2d')](_0x553e0b[_0x1fb5('0x2e')],_0x553e0b[_0x1fb5('0x2a')]);_0x41d50b[_0x1fb5('0x30')]=_[_0x1fb5('0x2d')](_0x553e0b[_0x1fb5('0x2e')],qs['fields'](_0x17e155[_0x1fb5('0x2a')][_0x1fb5('0x2f')]));_0x41d50b[_0x1fb5('0x30')]=_0x41d50b[_0x1fb5('0x30')]['length']?_0x41d50b[_0x1fb5('0x30')]:_0x553e0b[_0x1fb5('0x2e')];_0x41d50b[_0x1fb5('0x47')]=qs[_0x1fb5('0x33')](_0x17e155[_0x1fb5('0x2a')][_0x1fb5('0x33')]);_0x41d50b['where']=qs['filters'](_['pick'](_0x17e155['query'],_0x553e0b[_0x1fb5('0x2c')]));if(_0x17e155['query'][_0x1fb5('0x36')]){_0x41d50b[_0x1fb5('0x34')]=_[_0x1fb5('0x37')](_0x41d50b[_0x1fb5('0x34')],{'$or':_[_0x1fb5('0x26')](_0x41d50b[_0x1fb5('0x30')],function(_0x47791d){var _0x224d6b={};_0x224d6b[_0x47791d]={'$like':'%'+_0x17e155['query'][_0x1fb5('0x36')]+'%'};return _0x224d6b;})});}_0x41d50b=_['merge']({},_0x41d50b,_0x17e155['options']);return _0x13117b[_0x1fb5('0x44')](_0x41d50b);}})[_0x1fb5('0x20')](function(_0x5b883c){if(_0x5b883c){_0x1f010a=_0x5b883c['length'];if(!_0x17e155[_0x1fb5('0x2a')]['hasOwnProperty'](_0x1fb5('0x48'))){_0x41d50b[_0x1fb5('0x18')]=qs['limit'](_0x17e155[_0x1fb5('0x2a')]['limit']);_0x41d50b[_0x1fb5('0x19')]=qs[_0x1fb5('0x19')](_0x17e155[_0x1fb5('0x2a')][_0x1fb5('0x19')]);}return _0x13117b['getConfigurations'](_0x41d50b);}})['then'](function(_0x3bf77b){if(_0x3bf77b){return _0x3bf77b?{'count':_0x1f010a,'rows':_0x3bf77b}:null;}})[_0x1fb5('0x20')](respondWithResult(_0x832214,null))['catch'](handleError(_0x832214,null));};exports[_0x1fb5('0x49')]=function(_0x12b88d,_0x4e5796,_0x170fdc){if(_0x12b88d[_0x1fb5('0x43')]['id']){delete _0x12b88d[_0x1fb5('0x43')]['id'];}return db[_0x1fb5('0x3f')][_0x1fb5('0x45')]({'where':{'id':_0x12b88d[_0x1fb5('0x3e')]['id']}})[_0x1fb5('0x20')](handleEntityNotFound(_0x4e5796,null))[_0x1fb5('0x20')](function(_0x50d9af){if(_0x50d9af){_0x12b88d[_0x1fb5('0x43')]['AccountId']=_0x50d9af['id'];_0x12b88d[_0x1fb5('0x43')][_0x1fb5('0x4a')]=integrations[_0x1fb5('0x4b')](_0x12b88d[_0x1fb5('0x43')][_0x1fb5('0x4c')],_0x12b88d['body'][_0x1fb5('0x29')]);_0x12b88d[_0x1fb5('0x43')]['Descriptions']=integrations[_0x1fb5('0x4d')](_0x12b88d['body']['channel'],_0x12b88d[_0x1fb5('0x43')][_0x1fb5('0x29')]);return db[_0x1fb5('0x46')][_0x1fb5('0x42')](_0x12b88d[_0x1fb5('0x43')],{'include':[{'model':db[_0x1fb5('0x4e')],'as':_0x1fb5('0x4a')},{'model':db[_0x1fb5('0x4e')],'as':'Descriptions'}]});}return null;})[_0x1fb5('0x20')](respondWithResult(_0x4e5796,null))[_0x1fb5('0x3d')](handleError(_0x4e5796,null));};exports[_0x1fb5('0x4f')]=function(_0x2830fa,_0x298958,_0x131aac){var _0x4faa4d=['made_sla',_0x1fb5('0x50'),_0x1fb5('0x51'),_0x1fb5('0x52'),_0x1fb5('0x53'),'notify',_0x1fb5('0x54'),_0x1fb5('0x55'),_0x1fb5('0x56')];var _0x584488=[_0x1fb5('0x57'),'made_sla',_0x1fb5('0x58'),_0x1fb5('0x59'),_0x1fb5('0x5a'),'sys_updated_on',_0x1fb5('0x5b'),_0x1fb5('0x50'),'approval_history',_0x1fb5('0x5c'),'resolved_by',_0x1fb5('0x5d'),'opened_by','user_input',_0x1fb5('0x5e'),'sys_domain',_0x1fb5('0x5f'),_0x1fb5('0x60'),_0x1fb5('0x51'),_0x1fb5('0x47'),_0x1fb5('0x61'),_0x1fb5('0x62'),_0x1fb5('0x63'),_0x1fb5('0x64'),_0x1fb5('0x65'),_0x1fb5('0x66'),_0x1fb5('0x67'),'business_service',_0x1fb5('0x68'),_0x1fb5('0x69'),_0x1fb5('0x6a'),_0x1fb5('0x6b'),_0x1fb5('0x6c'),_0x1fb5('0x6d'),'business_duration','group_list',_0x1fb5('0x6e'),'reopened_time',_0x1fb5('0x6f'),_0x1fb5('0x70'),_0x1fb5('0x71'),_0x1fb5('0x52'),_0x1fb5('0x72'),_0x1fb5('0x73'),_0x1fb5('0x53'),_0x1fb5('0x74'),_0x1fb5('0x75'),'work_start','assignment_group',_0x1fb5('0x76'),_0x1fb5('0x77'),_0x1fb5('0x78'),_0x1fb5('0x79'),_0x1fb5('0x7a'),_0x1fb5('0x7b'),_0x1fb5('0x7c'),'closed_by','follow_up',_0x1fb5('0x7d'),_0x1fb5('0x7e'),_0x1fb5('0x7f'),_0x1fb5('0x80'),_0x1fb5('0x54'),_0x1fb5('0x81'),'problem_id',_0x1fb5('0x82'),_0x1fb5('0x83'),_0x1fb5('0x84'),_0x1fb5('0x85'),_0x1fb5('0x55'),_0x1fb5('0x86'),_0x1fb5('0x87'),_0x1fb5('0x88'),_0x1fb5('0x89'),_0x1fb5('0x8a'),_0x1fb5('0x8b'),_0x1fb5('0x8c'),_0x1fb5('0x8d'),_0x1fb5('0x8e'),_0x1fb5('0x8f'),_0x1fb5('0x90'),'location',_0x1fb5('0x56')];var _0x3d3fe9='';var _0xf25920='';var _0x4199d5=[];var _0x3a568c='';var _0x285cd0='';var _0x531ae4=[];var _0x2c2e4c='';var _0x19a694='';var _0x567d50={};var _0x35ee69='';return db['ServicenowAccount'][_0x1fb5('0x45')]({'where':{'id':_0x2830fa[_0x1fb5('0x3e')]['id']},'attributes':['id',_0x1fb5('0x91'),'password',_0x1fb5('0x92'),_0x1fb5('0x93'),_0x1fb5('0x94')]})[_0x1fb5('0x20')](handleEntityNotFound(_0x298958,null))[_0x1fb5('0x20')](function(_0x315482){if(_0x315482){_0x35ee69=_0x315482['remoteUri'];var _0x1ae32e=_0x35ee69[_0x1fb5('0x95')](-0x1);if(_0x1ae32e==='/'){_0x35ee69=_0x35ee69[_0x1fb5('0x96')](0x0,_0x35ee69[_0x1fb5('0x97')](_0x1ae32e));}_0x19a694=util[_0x1fb5('0x98')]('%s/api/now/doc/table/schema/',_0x35ee69);_0x2c2e4c=util[_0x1fb5('0x98')]('%s/api/now/table/',_0x35ee69);_0x567d50={'user':_0x315482[_0x1fb5('0x91')],'pass':_0x315482[_0x1fb5('0x99')]};var _0x1992d8={'method':'GET','uri':_0x19a694+_0x1fb5('0x9a'),'auth':_0x567d50,'json':!![]};return rp(_0x1992d8);}})['then'](function(_0x59cfc9){if(_0x59cfc9['result'][_0x1fb5('0x31')]>0x0){_0x3d3fe9=_0x59cfc9[_0x1fb5('0x9b')];}console['log'](_0x1fb5('0x9c'),_0x3d3fe9);_0x531ae4=[];_0xf25920=Object[_0x1fb5('0x9d')]([],_0x3d3fe9);_[_0x1fb5('0x9e')](_0xf25920,function(_0x3a2134){return!_0x4faa4d[_0x1fb5('0x9f')](_0x3a2134['name']);});_0xf25920[_0x1fb5('0xa0')](function(_0x1e2a48){var _0x28409c=createFieldObject(_0x2c2e4c,_0x567d50,_0x1e2a48['internalType'],_0x1e2a48[_0x1fb5('0x24')],_0x1e2a48[_0x1fb5('0xa1')],![]);_0x531ae4[_0x1fb5('0xa2')](_0x28409c);});return Promise[_0x1fb5('0xa3')](_0x531ae4);})[_0x1fb5('0x20')](function(_0x3c873e){_0x4199d5=_0x3c873e;_0x3a568c=Object[_0x1fb5('0x9d')]([],_0x3d3fe9);console[_0x1fb5('0xa4')](_0x1fb5('0xa5'),_0x3d3fe9);_[_0x1fb5('0x9e')](_0x3a568c,function(_0x300bc5){return _0x584488[_0x1fb5('0x9f')](_0x300bc5['name']);});console[_0x1fb5('0xa4')](_0x1fb5('0xa6'),_0x3a568c);_0x531ae4=[];_0x3a568c[_0x1fb5('0xa0')](function(_0x1fd3d8){var _0x3b2def=createFieldObject(_0x2c2e4c,_0x567d50,_0x1fd3d8[_0x1fb5('0xa7')],_0x1fd3d8[_0x1fb5('0x24')],_0x1fd3d8[_0x1fb5('0xa1')],!![]);_0x531ae4[_0x1fb5('0xa2')](_0x3b2def);});return Promise[_0x1fb5('0xa3')](_0x531ae4);})['then'](function(_0x7dd4dc){_0x285cd0=_0x7dd4dc;var _0x249cdc=_0x4199d5[_0x1fb5('0xa8')](_0x285cd0);return{'count':_0x249cdc[_0x1fb5('0x31')],'rows':_0x249cdc};})['then'](respondWithResult(_0x298958,null))[_0x1fb5('0x3d')](function(_0x339b8f){console[_0x1fb5('0xa4')](_0x1fb5('0xa9')+_0x339b8f);var _0x153298=_0x2830fa[_0x1fb5('0x2a')][_0x1fb5('0xaa')]?0x1f4:_0x339b8f['statusCode']||0x1f4;logger[_0x1fb5('0x23')](_0x339b8f['stack']);delete _0x339b8f[_0x1fb5('0x24')];if(_0x153298===0x191){_0x153298=0x190;}_0x298958[_0x1fb5('0x15')](_0x153298)['send'](_0x2830fa[_0x1fb5('0x2a')]['test']?{'message':_0x1fb5('0xab'),'statusCode':_0x339b8f[_0x1fb5('0xac')]}:_0x339b8f);});};function createFieldObject(_0xb40998,_0x4df419,_0x4fdcc2,_0xfa9df1,_0x58c8f5,_0x1fd963){return new Promise(function(_0x57bb9a,_0x385c01){var _0x2cd892={'id':_0xfa9df1,'name':_0x58c8f5,'custom':_0x1fd963};if(_0x4fdcc2===_0x1fb5('0xad')){_0x2cd892[_0x1fb5('0x40')]=[{'name':_0x1fb5('0xae'),'value':'true'},{'name':'False','value':_0x1fb5('0xaf')}];_0x57bb9a(_0x2cd892);}else{var _0x27ef1f={'method':_0x1fb5('0xb0'),'uri':_0xb40998+_0x1fb5('0xb1')+_0xfa9df1,'auth':_0x4df419,'json':!![]};return rp(_0x27ef1f)[_0x1fb5('0x20')](function(_0x1b2892){var _0x2621d4=[];if(_0x1b2892['result'][_0x1fb5('0x31')]>0x0){_0x1b2892[_0x1fb5('0x9b')]['forEach'](function(_0x2d3b37){if(_0x2d3b37[_0x1fb5('0xb2')]===_0x1fb5('0xaf')){var _0x4166bc={'name':_0x2d3b37['label'],'value':_0x2d3b37[_0x1fb5('0xb3')]};_0x2621d4['push'](_0x4166bc);}});}_0x2cd892[_0x1fb5('0x40')]=_0x2621d4;if(_0x2cd892[_0x1fb5('0x40')][_0x1fb5('0x31')]>0x0){_0x57bb9a(_0x2cd892);}else{if(_0x1fd963==![]){_0x57bb9a();}else{_0x57bb9a(_0x2cd892);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f39a783..852b422 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 _0x4c60=['exports','define','ServicenowAccount','lodash','util','../../config/logger','api','bluebird','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0xebc99c,_0x3a899b){var _0x3e83b3=function(_0x34894d){while(--_0x34894d){_0xebc99c['push'](_0xebc99c['shift']());}};_0x3e83b3(++_0x3a899b);}(_0x4c60,0xc1));var _0x04c6=function(_0x1ca968,_0x280ed9){_0x1ca968=_0x1ca968-0x0;var _0x5545a3=_0x4c60[_0x1ca968];return _0x5545a3;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var logger=require(_0x04c6('0x2'))(_0x04c6('0x3'));var moment=require('moment');var BPromise=require(_0x04c6('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(_0x04c6('0x5'));var integrations=require(_0x04c6('0x6'));module[_0x04c6('0x7')]=function(_0x12bd5d,_0x2b9041){return _0x12bd5d[_0x04c6('0x8')](_0x04c6('0x9'),attributes,{'tableName':'int_servicenow_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x542174,_0xf4190){_0x542174=_0x542174-0x0;var _0x3b4c31=_0x3f8a[_0x542174];return _0x3b4c31;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'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 016ad7c..8306ecf 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 _0x13f5=['ServicenowAccount','find','raw','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','map','model','ShowServicenowAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13f5,0x123));var _0x513f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x13f5[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x513f('0x0'));var moment=require('moment');var BPromise=require(_0x513f('0x1'));var rs=require(_0x513f('0x2'));var fs=require('fs');var Redis=require(_0x513f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x513f('0x4'));var logger=require(_0x513f('0x5'))(_0x513f('0x6'));var config=require(_0x513f('0x7'));var jayson=require(_0x513f('0x8'));var client=jayson[_0x513f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37b62d,_0x488db0,_0x34eda1){return new BPromise(function(_0x28c69c,_0x1020fb){return client[_0x513f('0xa')](_0x37b62d,_0x34eda1)[_0x513f('0xb')](function(_0x2cdccc){logger[_0x513f('0xc')](_0x513f('0xd'),_0x488db0,_0x513f('0xe'));logger[_0x513f('0xf')](_0x513f('0x10'),_0x488db0,'request\x20sent',JSON[_0x513f('0x11')](_0x2cdccc));if(_0x2cdccc['error']){if(_0x2cdccc[_0x513f('0x12')][_0x513f('0x13')]===0x1f4){logger[_0x513f('0x12')](_0x513f('0xd'),_0x488db0,_0x2cdccc[_0x513f('0x12')][_0x513f('0x14')]);return _0x1020fb(_0x2cdccc[_0x513f('0x12')]['message']);}logger[_0x513f('0x12')](_0x513f('0xd'),_0x488db0,_0x2cdccc[_0x513f('0x12')]['message']);return _0x28c69c(_0x2cdccc[_0x513f('0x12')][_0x513f('0x14')]);}else{logger[_0x513f('0xc')](_0x513f('0xd'),_0x488db0,_0x513f('0xe'));_0x28c69c(_0x2cdccc[_0x513f('0x15')]['message']);}})[_0x513f('0x16')](function(_0x20ae2d){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x488db0,_0x20ae2d);_0x1020fb(_0x20ae2d);});});}exports[_0x513f('0x17')]=function(_0x55639c){var _0x2842dd=this;return new Promise(function(_0x2baaac,_0x129275){return db['ServicenowAccount'][_0x513f('0x18')]({'raw':_0x55639c[_0x513f('0x19')]?_0x55639c['options']['raw']===undefined?!![]:![]:!![],'where':_0x55639c[_0x513f('0x19')]?_0x55639c['options'][_0x513f('0x1a')]||null:null,'attributes':_0x55639c[_0x513f('0x19')]?_0x55639c['options'][_0x513f('0x1b')]||null:null,'limit':_0x55639c[_0x513f('0x19')]?_0x55639c['options'][_0x513f('0x1c')]||null:null,'include':_0x55639c[_0x513f('0x19')]?_0x55639c[_0x513f('0x19')][_0x513f('0x1d')]?_[_0x513f('0x1e')](_0x55639c[_0x513f('0x19')][_0x513f('0x1d')],function(_0x2b031c){return{'model':db[_0x2b031c[_0x513f('0x1f')]],'as':_0x2b031c['as'],'attributes':_0x2b031c['attributes'],'include':_0x2b031c['include']?_[_0x513f('0x1e')](_0x2b031c[_0x513f('0x1d')],function(_0x35cd95){return{'model':db[_0x35cd95[_0x513f('0x1f')]],'as':_0x35cd95['as'],'attributes':_0x35cd95[_0x513f('0x1b')],'include':_0x35cd95[_0x513f('0x1d')]?_['map'](_0x35cd95[_0x513f('0x1d')],function(_0x1c83bf){return{'model':db[_0x1c83bf[_0x513f('0x1f')]],'as':_0x1c83bf['as'],'attributes':_0x1c83bf[_0x513f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4adcc8){logger[_0x513f('0xc')]('GetServicenowAccount',_0x55639c);logger[_0x513f('0xf')](_0x513f('0x17'),_0x55639c,JSON[_0x513f('0x11')](_0x4adcc8));_0x2baaac(_0x4adcc8);})['catch'](function(_0x2faf1c){logger[_0x513f('0x12')]('GetServicenowAccount',_0x2faf1c[_0x513f('0x14')],_0x55639c);_0x129275(_0x2842dd[_0x513f('0x12')](0x1f4,_0x2faf1c[_0x513f('0x14')]));});});};exports[_0x513f('0x20')]=function(_0x179c0b){var _0x79834a=this;return new Promise(function(_0x5c10df,_0x5d556f){return db[_0x513f('0x21')][_0x513f('0x22')]({'raw':_0x179c0b[_0x513f('0x19')]?_0x179c0b['options'][_0x513f('0x23')]===undefined?!![]:![]:!![],'where':_0x179c0b[_0x513f('0x19')]?_0x179c0b[_0x513f('0x19')][_0x513f('0x1a')]||null:null,'attributes':_0x179c0b['options']?_0x179c0b['options'][_0x513f('0x1b')]||null:null,'include':_0x179c0b[_0x513f('0x19')]?_0x179c0b[_0x513f('0x19')]['include']?_[_0x513f('0x1e')](_0x179c0b[_0x513f('0x19')]['include'],function(_0x17716c){return{'model':db[_0x17716c[_0x513f('0x1f')]],'as':_0x17716c['as'],'attributes':_0x17716c[_0x513f('0x1b')],'include':_0x17716c[_0x513f('0x1d')]?_['map'](_0x17716c['include'],function(_0x12185e){return{'model':db[_0x12185e[_0x513f('0x1f')]],'as':_0x12185e['as'],'attributes':_0x12185e[_0x513f('0x1b')],'include':_0x12185e[_0x513f('0x1d')]?_[_0x513f('0x1e')](_0x12185e[_0x513f('0x1d')],function(_0x304fa8){return{'model':db[_0x304fa8[_0x513f('0x1f')]],'as':_0x304fa8['as'],'attributes':_0x304fa8[_0x513f('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x671248){logger['info'](_0x513f('0x20'),_0x179c0b);logger['debug'](_0x513f('0x20'),_0x179c0b,JSON[_0x513f('0x11')](_0x671248));_0x5c10df(_0x671248);})[_0x513f('0x16')](function(_0x5f1598){logger[_0x513f('0x12')](_0x513f('0x20'),_0x5f1598['message'],_0x179c0b);_0x5d556f(_0x79834a[_0x513f('0x12')](0x1f4,_0x5f1598[_0x513f('0x14')]));});});}; \ No newline at end of file +var _0x178f=['error','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','findAll','options','where','attributes','limit','include','model','map','ShowServicenowAccount','ServicenowAccount','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x178f,0xc0));var _0xf178=function(_0x4f6896,_0x39d70a){_0x4f6896=_0x4f6896-0x0;var _0x2e9e5c=_0x178f[_0x4f6896];return _0x2e9e5c;};'use strict';var _=require(_0xf178('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf178('0x1'));var rs=require(_0xf178('0x2'));var fs=require('fs');var Redis=require(_0xf178('0x3'));var db=require(_0xf178('0x4'))['db'];var utils=require(_0xf178('0x5'));var logger=require(_0xf178('0x6'))('rpc');var config=require(_0xf178('0x7'));var jayson=require(_0xf178('0x8'));var client=jayson[_0xf178('0x9')][_0xf178('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41cb35,_0x1c7f74,_0x357ab6){return new BPromise(function(_0x4dae64,_0x5a5e3a){return client[_0xf178('0xb')](_0x41cb35,_0x357ab6)[_0xf178('0xc')](function(_0x46009a){logger[_0xf178('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x1c7f74,_0xf178('0xe'));logger[_0xf178('0xf')](_0xf178('0x10'),_0x1c7f74,_0xf178('0xe'),JSON[_0xf178('0x11')](_0x46009a));if(_0x46009a['error']){if(_0x46009a['error']['code']===0x1f4){logger[_0xf178('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x1c7f74,_0x46009a[_0xf178('0x12')][_0xf178('0x13')]);return _0x5a5e3a(_0x46009a['error'][_0xf178('0x13')]);}logger[_0xf178('0x12')](_0xf178('0x14'),_0x1c7f74,_0x46009a[_0xf178('0x12')][_0xf178('0x13')]);return _0x4dae64(_0x46009a[_0xf178('0x12')][_0xf178('0x13')]);}else{logger[_0xf178('0xd')](_0xf178('0x14'),_0x1c7f74,'request\x20sent');_0x4dae64(_0x46009a[_0xf178('0x15')][_0xf178('0x13')]);}})[_0xf178('0x16')](function(_0x5b6967){logger[_0xf178('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x1c7f74,_0x5b6967);_0x5a5e3a(_0x5b6967);});});}exports[_0xf178('0x17')]=function(_0x41ae80){var _0x16beb6=this;return new Promise(function(_0x1fcf8c,_0x416758){return db['ServicenowAccount'][_0xf178('0x18')]({'raw':_0x41ae80['options']?_0x41ae80[_0xf178('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x41ae80['options']?_0x41ae80['options'][_0xf178('0x1a')]||null:null,'attributes':_0x41ae80[_0xf178('0x19')]?_0x41ae80[_0xf178('0x19')][_0xf178('0x1b')]||null:null,'limit':_0x41ae80['options']?_0x41ae80[_0xf178('0x19')][_0xf178('0x1c')]||null:null,'include':_0x41ae80[_0xf178('0x19')]?_0x41ae80[_0xf178('0x19')][_0xf178('0x1d')]?_['map'](_0x41ae80[_0xf178('0x19')][_0xf178('0x1d')],function(_0x3dcc90){return{'model':db[_0x3dcc90[_0xf178('0x1e')]],'as':_0x3dcc90['as'],'attributes':_0x3dcc90[_0xf178('0x1b')],'include':_0x3dcc90[_0xf178('0x1d')]?_[_0xf178('0x1f')](_0x3dcc90[_0xf178('0x1d')],function(_0x156ece){return{'model':db[_0x156ece[_0xf178('0x1e')]],'as':_0x156ece['as'],'attributes':_0x156ece[_0xf178('0x1b')],'include':_0x156ece[_0xf178('0x1d')]?_[_0xf178('0x1f')](_0x156ece[_0xf178('0x1d')],function(_0xeeeb46){return{'model':db[_0xeeeb46[_0xf178('0x1e')]],'as':_0xeeeb46['as'],'attributes':_0xeeeb46[_0xf178('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9245b1){logger[_0xf178('0xd')](_0xf178('0x17'),_0x41ae80);logger[_0xf178('0xf')]('GetServicenowAccount',_0x41ae80,JSON[_0xf178('0x11')](_0x9245b1));_0x1fcf8c(_0x9245b1);})[_0xf178('0x16')](function(_0x46859b){logger[_0xf178('0x12')](_0xf178('0x17'),_0x46859b['message'],_0x41ae80);_0x416758(_0x16beb6[_0xf178('0x12')](0x1f4,_0x46859b[_0xf178('0x13')]));});});};exports[_0xf178('0x20')]=function(_0x1608a1){var _0x2c8466=this;return new Promise(function(_0x51ab3d,_0x19803b){return db[_0xf178('0x21')]['find']({'raw':_0x1608a1[_0xf178('0x19')]?_0x1608a1[_0xf178('0x19')][_0xf178('0x22')]===undefined?!![]:![]:!![],'where':_0x1608a1['options']?_0x1608a1[_0xf178('0x19')][_0xf178('0x1a')]||null:null,'attributes':_0x1608a1[_0xf178('0x19')]?_0x1608a1[_0xf178('0x19')]['attributes']||null:null,'include':_0x1608a1[_0xf178('0x19')]?_0x1608a1['options']['include']?_[_0xf178('0x1f')](_0x1608a1[_0xf178('0x19')][_0xf178('0x1d')],function(_0xce2815){return{'model':db[_0xce2815['model']],'as':_0xce2815['as'],'attributes':_0xce2815['attributes'],'include':_0xce2815[_0xf178('0x1d')]?_[_0xf178('0x1f')](_0xce2815[_0xf178('0x1d')],function(_0x18e58c){return{'model':db[_0x18e58c['model']],'as':_0x18e58c['as'],'attributes':_0x18e58c['attributes'],'include':_0x18e58c[_0xf178('0x1d')]?_['map'](_0x18e58c['include'],function(_0x4ba11c){return{'model':db[_0x4ba11c[_0xf178('0x1e')]],'as':_0x4ba11c['as'],'attributes':_0x4ba11c[_0xf178('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf178('0xc')](function(_0x2fdc4b){logger[_0xf178('0xd')](_0xf178('0x20'),_0x1608a1);logger[_0xf178('0xf')](_0xf178('0x20'),_0x1608a1,JSON[_0xf178('0x11')](_0x2fdc4b));_0x51ab3d(_0x2fdc4b);})[_0xf178('0x16')](function(_0x3338e7){logger[_0xf178('0x12')](_0xf178('0x20'),_0x3338e7[_0xf178('0x13')],_0x1608a1);_0x19803b(_0x2c8466[_0xf178('0x12')](0x1f4,_0x3338e7['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index b85768d..3dc646a 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 _0x0057=['/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x7ab2dc,_0x176ed4){var _0x534aad=function(_0x2eebb1){while(--_0x2eebb1){_0x7ab2dc['push'](_0x7ab2dc['shift']());}};_0x534aad(++_0x176ed4);}(_0x0057,0xa1));var _0x7005=function(_0x37320f,_0x40ac81){_0x37320f=_0x37320f-0x0;var _0x341eff=_0x0057[_0x37320f];return _0x341eff;};'use strict';var multer=require(_0x7005('0x0'));var util=require('util');var path=require(_0x7005('0x1'));var timeout=require(_0x7005('0x2'));var express=require(_0x7005('0x3'));var router=express[_0x7005('0x4')]();var fs_extra=require(_0x7005('0x5'));var auth=require(_0x7005('0x6'));var interaction=require(_0x7005('0x7'));var config=require(_0x7005('0x8'));var controller=require(_0x7005('0x9'));router[_0x7005('0xa')]('/',auth[_0x7005('0xb')](),controller[_0x7005('0xc')]);router['get'](_0x7005('0xd'),auth[_0x7005('0xb')](),controller['show']);router[_0x7005('0xa')](_0x7005('0xe'),auth[_0x7005('0xb')](),controller[_0x7005('0xf')]);router['get'](_0x7005('0x10'),auth[_0x7005('0xb')](),controller[_0x7005('0x11')]);router['get']('/:id/descriptions',auth[_0x7005('0xb')](),controller[_0x7005('0x12')]);router[_0x7005('0x13')]('/',auth[_0x7005('0xb')](),controller[_0x7005('0x14')]);router[_0x7005('0x15')](_0x7005('0xd'),auth[_0x7005('0xb')](),controller['update']);router[_0x7005('0x16')]('/:id',auth[_0x7005('0xb')](),controller[_0x7005('0x17')]);module[_0x7005('0x18')]=router; \ No newline at end of file +var _0x946f=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x31b735,_0x849cc1){var _0x1dc7ed=function(_0x336009){while(--_0x336009){_0x31b735['push'](_0x31b735['shift']());}};_0x1dc7ed(++_0x849cc1);}(_0x946f,0x93));var _0xf946=function(_0x1b1706,_0x40c92a){_0x1b1706=_0x1b1706-0x0;var _0x3cb3cc=_0x946f[_0x1b1706];return _0x3cb3cc;};'use strict';var multer=require('multer');var util=require(_0xf946('0x0'));var path=require(_0xf946('0x1'));var timeout=require(_0xf946('0x2'));var express=require('express');var router=express[_0xf946('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf946('0x4'));var config=require(_0xf946('0x5'));var controller=require(_0xf946('0x6'));router[_0xf946('0x7')]('/',auth[_0xf946('0x8')](),controller[_0xf946('0x9')]);router[_0xf946('0x7')](_0xf946('0xa'),auth['isAuthenticated'](),controller[_0xf946('0xb')]);router[_0xf946('0x7')](_0xf946('0xc'),auth[_0xf946('0x8')](),controller[_0xf946('0xd')]);router[_0xf946('0x7')](_0xf946('0xe'),auth[_0xf946('0x8')](),controller[_0xf946('0xf')]);router[_0xf946('0x7')](_0xf946('0x10'),auth[_0xf946('0x8')](),controller[_0xf946('0x11')]);router[_0xf946('0x12')]('/',auth[_0xf946('0x8')](),controller[_0xf946('0x13')]);router['put'](_0xf946('0xa'),auth[_0xf946('0x8')](),controller[_0xf946('0x14')]);router[_0xf946('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf946('0x16')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 96adcff..f036f26 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 _0x2810=['exports','STRING','sequelize'];(function(_0xaa413e,_0x4d49ce){var _0x52ead8=function(_0x4d7bc6){while(--_0x4d7bc6){_0xaa413e['push'](_0xaa413e['shift']());}};_0x52ead8(++_0x4d49ce);}(_0x2810,0x68));var _0x0281=function(_0x36a1d7,_0x13f0ca){_0x36a1d7=_0x36a1d7-0x0;var _0x108416=_0x2810[_0x36a1d7];return _0x108416;};'use strict';var Sequelize=require(_0x0281('0x0'));module[_0x0281('0x1')]={'name':{'type':Sequelize[_0x0281('0x2')]},'description':{'type':Sequelize[_0x0281('0x2')]}}; \ No newline at end of file +var _0x7b18=['STRING'];(function(_0x24a5b6,_0x319c12){var _0xee7f16=function(_0x2b6387){while(--_0x2b6387){_0x24a5b6['push'](_0x24a5b6['shift']());}};_0xee7f16(++_0x319c12);}(_0x7b18,0x120));var _0x87b1=function(_0x4837e6,_0x5d3e26){_0x4837e6=_0x4837e6-0x0;var _0x25d3d8=_0x7b18[_0x4837e6];return _0x25d3d8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87b1('0x0')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index cc00928..b025435 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 _0x1e9d=['send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','ServicenowField','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','reject','save','update','destroy','then','sendStatus','stack','name'];(function(_0x1836ea,_0x6af967){var _0x9e0cc1=function(_0xb1a81c){while(--_0xb1a81c){_0x1836ea['push'](_0x1836ea['shift']());}};_0x9e0cc1(++_0x6af967);}(_0x1e9d,0x194));var _0xd1e9=function(_0x41596f,_0x32c13d){_0x41596f=_0x41596f-0x0;var _0x36c787=_0x1e9d[_0x41596f];return _0x36c787;};'use strict';var emlformat=require(_0xd1e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd1e9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd1e9('0x2'));var moment=require('moment');var BPromise=require(_0xd1e9('0x3'));var Mustache=require(_0xd1e9('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd1e9('0x5'));var fs=require('fs');var fs_extra=require(_0xd1e9('0x6'));var _=require(_0xd1e9('0x7'));var squel=require(_0xd1e9('0x8'));var crypto=require(_0xd1e9('0x9'));var jsforce=require(_0xd1e9('0xa'));var deskjs=require(_0xd1e9('0xb'));var toCsv=require(_0xd1e9('0xc'));var querystring=require(_0xd1e9('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd1e9('0xe'));var as=require(_0xd1e9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1e9('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xd1e9('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1e9('0x12'))['db'];function respondWithStatusCode(_0x77a4d0,_0x436776){_0x436776=_0x436776||0xcc;return function(_0x231b08){if(_0x231b08){return _0x77a4d0['sendStatus'](_0x436776);}return _0x77a4d0[_0xd1e9('0x13')](_0x436776)[_0xd1e9('0x14')]();};}function respondWithResult(_0x370a96,_0x100e90){_0x100e90=_0x100e90||0xc8;return function(_0x32092f){if(_0x32092f){return _0x370a96['status'](_0x100e90)['json'](_0x32092f);}};}function respondWithFilteredResult(_0x2c20ab,_0xb7abc5){return function(_0x53fe9a){if(_0x53fe9a){var _0x4b45b3=typeof _0xb7abc5[_0xd1e9('0x15')]===_0xd1e9('0x16')&&typeof _0xb7abc5[_0xd1e9('0x17')]===_0xd1e9('0x16');var _0x2cc757=_0x53fe9a[_0xd1e9('0x18')];var _0x15de21=_0x4b45b3?0x0:_0xb7abc5[_0xd1e9('0x15')];var _0x37f25b=_0x4b45b3?_0x53fe9a[_0xd1e9('0x18')]:_0xb7abc5[_0xd1e9('0x15')]+_0xb7abc5['limit'];var _0x4887b9;if(_0x37f25b>=_0x2cc757){_0x37f25b=_0x2cc757;_0x4887b9=0xc8;}else{_0x4887b9=0xce;}_0x2c20ab['status'](_0x4887b9);return _0x2c20ab[_0xd1e9('0x19')]('Content-Range',_0x15de21+'-'+_0x37f25b+'/'+_0x2cc757)['json'](_0x53fe9a);}return null;};}function patchUpdates(_0x59bbc1){return function(_0x148a8e){try{jsonpatch['apply'](_0x148a8e,_0x59bbc1,!![]);}catch(_0x148e05){return BPromise[_0xd1e9('0x1a')](_0x148e05);}return _0x148a8e[_0xd1e9('0x1b')]();};}function saveUpdates(_0xaf08f9,_0x14cd1e){return function(_0x3cf3b0){if(_0x3cf3b0){return _0x3cf3b0[_0xd1e9('0x1c')](_0xaf08f9)['then'](function(_0x389f47){return _0x389f47;});}return null;};}function removeEntity(_0x3062e2,_0x2c3751){return function(_0xebada1){if(_0xebada1){return _0xebada1[_0xd1e9('0x1d')]()[_0xd1e9('0x1e')](function(){_0x3062e2['status'](0xcc)[_0xd1e9('0x14')]();});}};}function handleEntityNotFound(_0x49ecff,_0x4c0732){return function(_0x17f5de){if(!_0x17f5de){_0x49ecff[_0xd1e9('0x1f')](0x194);}return _0x17f5de;};}function handleError(_0x361b9b,_0x522e78){_0x522e78=_0x522e78||0x1f4;return function(_0x4ac457){logger['error'](_0x4ac457[_0xd1e9('0x20')]);if(_0x4ac457['name']){delete _0x4ac457[_0xd1e9('0x21')];}_0x361b9b[_0xd1e9('0x13')](_0x522e78)[_0xd1e9('0x22')](_0x4ac457);};}exports['index']=function(_0x304f2e,_0x2fbada){var _0xc5179d={},_0x421eed={},_0x35f59d={'count':0x0,'rows':[]};var _0x383f1c=_[_0xd1e9('0x23')](db[_0xd1e9('0x24')][_0xd1e9('0x25')],function(_0x47d219){return{'name':_0x47d219[_0xd1e9('0x26')],'type':_0x47d219[_0xd1e9('0x27')][_0xd1e9('0x28')]};});_0x421eed['model']=_[_0xd1e9('0x23')](_0x383f1c,'name');_0x421eed[_0xd1e9('0x29')]=_[_0xd1e9('0x2a')](_0x304f2e[_0xd1e9('0x29')]);_0x421eed[_0xd1e9('0x2b')]=_['intersection'](_0x421eed[_0xd1e9('0x2c')],_0x421eed['query']);_0xc5179d[_0xd1e9('0x2d')]=_[_0xd1e9('0x2e')](_0x421eed[_0xd1e9('0x2c')],qs[_0xd1e9('0x2f')](_0x304f2e[_0xd1e9('0x29')][_0xd1e9('0x2f')]));_0xc5179d[_0xd1e9('0x2d')]=_0xc5179d[_0xd1e9('0x2d')][_0xd1e9('0x30')]?_0xc5179d[_0xd1e9('0x2d')]:_0x421eed[_0xd1e9('0x2c')];if(!_0x304f2e[_0xd1e9('0x29')]['hasOwnProperty']('nolimit')){_0xc5179d['limit']=qs['limit'](_0x304f2e[_0xd1e9('0x29')][_0xd1e9('0x17')]);_0xc5179d['offset']=qs['offset'](_0x304f2e[_0xd1e9('0x29')][_0xd1e9('0x15')]);}_0xc5179d[_0xd1e9('0x31')]=qs[_0xd1e9('0x32')](_0x304f2e[_0xd1e9('0x29')][_0xd1e9('0x32')]);_0xc5179d[_0xd1e9('0x33')]=qs['filters'](_['pick'](_0x304f2e[_0xd1e9('0x29')],_0x421eed[_0xd1e9('0x2b')]),_0x383f1c);if(_0x304f2e['query']['filter']){_0xc5179d[_0xd1e9('0x33')]=_[_0xd1e9('0x34')](_0xc5179d[_0xd1e9('0x33')],{'$or':_['map'](_0x383f1c,function(_0x355aad){if(_0x355aad[_0xd1e9('0x27')]!==_0xd1e9('0x35')){var _0x2a2511={};_0x2a2511[_0x355aad[_0xd1e9('0x21')]]={'$like':'%'+_0x304f2e[_0xd1e9('0x29')][_0xd1e9('0x36')]+'%'};return _0x2a2511;}})});}_0xc5179d=_[_0xd1e9('0x34')]({},_0xc5179d,_0x304f2e[_0xd1e9('0x37')]);var _0x40b5dc={'where':_0xc5179d['where']};return db[_0xd1e9('0x24')][_0xd1e9('0x18')](_0x40b5dc)[_0xd1e9('0x1e')](function(_0x21841d){_0x35f59d[_0xd1e9('0x18')]=_0x21841d;if(_0x304f2e[_0xd1e9('0x29')][_0xd1e9('0x38')]){_0xc5179d[_0xd1e9('0x39')]=[{'all':!![]}];}return db[_0xd1e9('0x24')]['findAll'](_0xc5179d);})[_0xd1e9('0x1e')](function(_0x457633){_0x35f59d[_0xd1e9('0x3a')]=_0x457633;return _0x35f59d;})['then'](respondWithFilteredResult(_0x2fbada,_0xc5179d))[_0xd1e9('0x3b')](handleError(_0x2fbada,null));};exports[_0xd1e9('0x3c')]=function(_0x121050,_0x2685f7){var _0x3aacd4={'raw':![],'where':{'id':_0x121050[_0xd1e9('0x3d')]['id']}},_0x3b153b={};_0x3b153b[_0xd1e9('0x2c')]=_['keys'](db[_0xd1e9('0x24')]['rawAttributes']);_0x3b153b[_0xd1e9('0x29')]=_[_0xd1e9('0x2a')](_0x121050['query']);_0x3b153b[_0xd1e9('0x2b')]=_[_0xd1e9('0x2e')](_0x3b153b[_0xd1e9('0x2c')],_0x3b153b['query']);_0x3aacd4[_0xd1e9('0x2d')]=_[_0xd1e9('0x2e')](_0x3b153b['model'],qs[_0xd1e9('0x2f')](_0x121050['query'][_0xd1e9('0x2f')]));_0x3aacd4[_0xd1e9('0x2d')]=_0x3aacd4[_0xd1e9('0x2d')]['length']?_0x3aacd4[_0xd1e9('0x2d')]:_0x3b153b[_0xd1e9('0x2c')];if(_0x121050[_0xd1e9('0x29')][_0xd1e9('0x38')]){_0x3aacd4[_0xd1e9('0x39')]=[{'all':!![]}];}_0x3aacd4=_[_0xd1e9('0x34')]({},_0x3aacd4,_0x121050[_0xd1e9('0x37')]);return db['ServicenowConfiguration'][_0xd1e9('0x3e')](_0x3aacd4)['then'](handleEntityNotFound(_0x2685f7,null))[_0xd1e9('0x1e')](respondWithResult(_0x2685f7,null))[_0xd1e9('0x3b')](handleError(_0x2685f7,null));};exports[_0xd1e9('0x3f')]=function(_0x53d011,_0x42f1ce){return db[_0xd1e9('0x24')][_0xd1e9('0x3f')](_0x53d011['body'],{})[_0xd1e9('0x1e')](respondWithResult(_0x42f1ce,0xc9))[_0xd1e9('0x3b')](handleError(_0x42f1ce,null));};exports[_0xd1e9('0x1c')]=function(_0x3d5e3e,_0x202e6c){if(_0x3d5e3e[_0xd1e9('0x40')]['id']){delete _0x3d5e3e[_0xd1e9('0x40')]['id'];}return db['ServicenowConfiguration'][_0xd1e9('0x3e')]({'where':{'id':_0x3d5e3e['params']['id']}})['then'](handleEntityNotFound(_0x202e6c,null))[_0xd1e9('0x1e')](saveUpdates(_0x3d5e3e[_0xd1e9('0x40')],null))[_0xd1e9('0x1e')](respondWithResult(_0x202e6c,null))[_0xd1e9('0x3b')](handleError(_0x202e6c,null));};exports[_0xd1e9('0x1d')]=function(_0x3b706b,_0x418e62){return db[_0xd1e9('0x24')][_0xd1e9('0x3e')]({'where':{'id':_0x3b706b[_0xd1e9('0x3d')]['id']}})[_0xd1e9('0x1e')](handleEntityNotFound(_0x418e62,null))[_0xd1e9('0x1e')](removeEntity(_0x418e62,null))[_0xd1e9('0x3b')](handleError(_0x418e62,null));};exports[_0xd1e9('0x41')]=function(_0x8e5fb2,_0x3a6689,_0x30163b){var _0x3467c0={};var _0x5ea2ed={};var _0x12973e;var _0x38fe10;return db['ServicenowConfiguration'][_0xd1e9('0x42')]({'where':{'id':_0x8e5fb2[_0xd1e9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3a6689,null))[_0xd1e9('0x1e')](function(_0x510f2f){if(_0x510f2f){_0x12973e=_0x510f2f;_0x5ea2ed[_0xd1e9('0x2c')]=_['keys'](db[_0xd1e9('0x43')][_0xd1e9('0x25')]);_0x5ea2ed[_0xd1e9('0x29')]=_[_0xd1e9('0x2a')](_0x8e5fb2['query']);_0x5ea2ed[_0xd1e9('0x2b')]=_['intersection'](_0x5ea2ed['model'],_0x5ea2ed[_0xd1e9('0x29')]);_0x3467c0[_0xd1e9('0x2d')]=_['intersection'](_0x5ea2ed['model'],qs['fields'](_0x8e5fb2[_0xd1e9('0x29')][_0xd1e9('0x2f')]));_0x3467c0[_0xd1e9('0x2d')]=_0x3467c0[_0xd1e9('0x2d')]['length']?_0x3467c0[_0xd1e9('0x2d')]:_0x5ea2ed[_0xd1e9('0x2c')];_0x3467c0[_0xd1e9('0x31')]=qs['sort'](_0x8e5fb2[_0xd1e9('0x29')][_0xd1e9('0x32')]);_0x3467c0[_0xd1e9('0x33')]=qs['filters'](_[_0xd1e9('0x44')](_0x8e5fb2['query'],_0x5ea2ed[_0xd1e9('0x2b')]));if(_0x8e5fb2[_0xd1e9('0x29')][_0xd1e9('0x36')]){_0x3467c0[_0xd1e9('0x33')]=_[_0xd1e9('0x34')](_0x3467c0['where'],{'$or':_[_0xd1e9('0x23')](_0x3467c0[_0xd1e9('0x2d')],function(_0x3b84fb){var _0x3a5167={};_0x3a5167[_0x3b84fb]={'$like':'%'+_0x8e5fb2[_0xd1e9('0x29')]['filter']+'%'};return _0x3a5167;})});}_0x3467c0=_[_0xd1e9('0x34')]({},_0x3467c0,_0x8e5fb2['options']);return _0x12973e[_0xd1e9('0x41')](_0x3467c0);}})[_0xd1e9('0x1e')](function(_0x17d585){if(_0x17d585){_0x38fe10=_0x17d585[_0xd1e9('0x30')];if(!_0x8e5fb2[_0xd1e9('0x29')][_0xd1e9('0x45')](_0xd1e9('0x46'))){_0x3467c0[_0xd1e9('0x17')]=qs[_0xd1e9('0x17')](_0x8e5fb2[_0xd1e9('0x29')][_0xd1e9('0x17')]);_0x3467c0[_0xd1e9('0x15')]=qs[_0xd1e9('0x15')](_0x8e5fb2[_0xd1e9('0x29')]['offset']);}return _0x12973e[_0xd1e9('0x41')](_0x3467c0);}})['then'](function(_0x394234){if(_0x394234){return _0x394234?{'count':_0x38fe10,'rows':_0x394234}:null;}})['then'](respondWithResult(_0x3a6689,null))['catch'](handleError(_0x3a6689,null));};exports['getSubjects']=function(_0x267f4c,_0x28e00d,_0x1efa15){var _0x411634={};var _0x414265={};var _0x53c640;var _0x4a1bbd;return db[_0xd1e9('0x24')][_0xd1e9('0x42')]({'where':{'id':_0x267f4c[_0xd1e9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x28e00d,null))['then'](function(_0x14a677){if(_0x14a677){_0x53c640=_0x14a677;_0x414265[_0xd1e9('0x2c')]=_[_0xd1e9('0x2a')](db[_0xd1e9('0x43')]['rawAttributes']);_0x414265[_0xd1e9('0x29')]=_[_0xd1e9('0x2a')](_0x267f4c[_0xd1e9('0x29')]);_0x414265['filters']=_[_0xd1e9('0x2e')](_0x414265[_0xd1e9('0x2c')],_0x414265['query']);_0x411634[_0xd1e9('0x2d')]=_[_0xd1e9('0x2e')](_0x414265[_0xd1e9('0x2c')],qs[_0xd1e9('0x2f')](_0x267f4c[_0xd1e9('0x29')][_0xd1e9('0x2f')]));_0x411634['attributes']=_0x411634[_0xd1e9('0x2d')][_0xd1e9('0x30')]?_0x411634['attributes']:_0x414265['model'];_0x411634['order']=qs[_0xd1e9('0x32')](_0x267f4c[_0xd1e9('0x29')][_0xd1e9('0x32')]);_0x411634[_0xd1e9('0x33')]=qs[_0xd1e9('0x2b')](_[_0xd1e9('0x44')](_0x267f4c[_0xd1e9('0x29')],_0x414265['filters']));if(_0x267f4c[_0xd1e9('0x29')][_0xd1e9('0x36')]){_0x411634['where']=_[_0xd1e9('0x34')](_0x411634[_0xd1e9('0x33')],{'$or':_[_0xd1e9('0x23')](_0x411634['attributes'],function(_0x5c6327){var _0x287042={};_0x287042[_0x5c6327]={'$like':'%'+_0x267f4c[_0xd1e9('0x29')][_0xd1e9('0x36')]+'%'};return _0x287042;})});}_0x411634=_[_0xd1e9('0x34')]({},_0x411634,_0x267f4c['options']);return _0x53c640[_0xd1e9('0x47')](_0x411634);}})[_0xd1e9('0x1e')](function(_0x3a9493){if(_0x3a9493){_0x4a1bbd=_0x3a9493[_0xd1e9('0x30')];if(!_0x267f4c[_0xd1e9('0x29')][_0xd1e9('0x45')](_0xd1e9('0x46'))){_0x411634[_0xd1e9('0x17')]=qs[_0xd1e9('0x17')](_0x267f4c['query'][_0xd1e9('0x17')]);_0x411634[_0xd1e9('0x15')]=qs[_0xd1e9('0x15')](_0x267f4c['query']['offset']);}return _0x53c640[_0xd1e9('0x47')](_0x411634);}})[_0xd1e9('0x1e')](function(_0x284427){if(_0x284427){return _0x284427?{'count':_0x4a1bbd,'rows':_0x284427}:null;}})[_0xd1e9('0x1e')](respondWithResult(_0x28e00d,null))[_0xd1e9('0x3b')](handleError(_0x28e00d,null));};exports[_0xd1e9('0x48')]=function(_0x50c4bb,_0x5911f1,_0x5a31cb){var _0x464914={};var _0x440cd8={};var _0x54cbdd;var _0x55d699;return db[_0xd1e9('0x24')][_0xd1e9('0x42')]({'where':{'id':_0x50c4bb[_0xd1e9('0x3d')]['id']}})[_0xd1e9('0x1e')](handleEntityNotFound(_0x5911f1,null))['then'](function(_0x43958d){if(_0x43958d){_0x54cbdd=_0x43958d;_0x440cd8[_0xd1e9('0x2c')]=_[_0xd1e9('0x2a')](db[_0xd1e9('0x43')]['rawAttributes']);_0x440cd8[_0xd1e9('0x29')]=_[_0xd1e9('0x2a')](_0x50c4bb['query']);_0x440cd8['filters']=_[_0xd1e9('0x2e')](_0x440cd8[_0xd1e9('0x2c')],_0x440cd8[_0xd1e9('0x29')]);_0x464914[_0xd1e9('0x2d')]=_[_0xd1e9('0x2e')](_0x440cd8[_0xd1e9('0x2c')],qs[_0xd1e9('0x2f')](_0x50c4bb['query'][_0xd1e9('0x2f')]));_0x464914['attributes']=_0x464914[_0xd1e9('0x2d')][_0xd1e9('0x30')]?_0x464914[_0xd1e9('0x2d')]:_0x440cd8[_0xd1e9('0x2c')];_0x464914[_0xd1e9('0x31')]=qs[_0xd1e9('0x32')](_0x50c4bb[_0xd1e9('0x29')][_0xd1e9('0x32')]);_0x464914[_0xd1e9('0x33')]=qs[_0xd1e9('0x2b')](_[_0xd1e9('0x44')](_0x50c4bb[_0xd1e9('0x29')],_0x440cd8[_0xd1e9('0x2b')]));if(_0x50c4bb[_0xd1e9('0x29')]['filter']){_0x464914[_0xd1e9('0x33')]=_[_0xd1e9('0x34')](_0x464914[_0xd1e9('0x33')],{'$or':_[_0xd1e9('0x23')](_0x464914[_0xd1e9('0x2d')],function(_0x34738f){var _0xf94e13={};_0xf94e13[_0x34738f]={'$like':'%'+_0x50c4bb[_0xd1e9('0x29')]['filter']+'%'};return _0xf94e13;})});}_0x464914=_[_0xd1e9('0x34')]({},_0x464914,_0x50c4bb['options']);return _0x54cbdd[_0xd1e9('0x48')](_0x464914);}})[_0xd1e9('0x1e')](function(_0x41edc4){if(_0x41edc4){_0x55d699=_0x41edc4[_0xd1e9('0x30')];if(!_0x50c4bb[_0xd1e9('0x29')][_0xd1e9('0x45')](_0xd1e9('0x46'))){_0x464914[_0xd1e9('0x17')]=qs[_0xd1e9('0x17')](_0x50c4bb[_0xd1e9('0x29')][_0xd1e9('0x17')]);_0x464914['offset']=qs[_0xd1e9('0x15')](_0x50c4bb['query'][_0xd1e9('0x15')]);}return _0x54cbdd['getDescriptions'](_0x464914);}})[_0xd1e9('0x1e')](function(_0x178b94){if(_0x178b94){return _0x178b94?{'count':_0x55d699,'rows':_0x178b94}:null;}})['then'](respondWithResult(_0x5911f1,null))[_0xd1e9('0x3b')](handleError(_0x5911f1,null));}; \ No newline at end of file +var _0xb052=['stack','name','send','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','then','find','catch','create','body','params','findOne','ServicenowField','getSubjects','getDescriptions','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','destroy','end'];(function(_0x486687,_0x1d3097){var _0x4d7919=function(_0x43c0ae){while(--_0x43c0ae){_0x486687['push'](_0x486687['shift']());}};_0x4d7919(++_0x1d3097);}(_0xb052,0x1de));var _0x2b05=function(_0x5f46e7,_0x62f9f8){_0x5f46e7=_0x5f46e7-0x0;var _0x567e95=_0xb052[_0x5f46e7];return _0x567e95;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b05('0x0'));var rp=require('request-promise');var moment=require(_0x2b05('0x1'));var BPromise=require(_0x2b05('0x2'));var Mustache=require(_0x2b05('0x3'));var util=require('util');var path=require('path');var sox=require(_0x2b05('0x4'));var csv=require(_0x2b05('0x5'));var ejs=require(_0x2b05('0x6'));var fs=require('fs');var fs_extra=require(_0x2b05('0x7'));var _=require('lodash');var squel=require(_0x2b05('0x8'));var crypto=require('crypto');var jsforce=require(_0x2b05('0x9'));var deskjs=require(_0x2b05('0xa'));var toCsv=require(_0x2b05('0x5'));var querystring=require(_0x2b05('0xb'));var Papa=require('papaparse');var Redis=require(_0x2b05('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b05('0xd'));var logger=require(_0x2b05('0xe'))('api');var utils=require(_0x2b05('0xf'));var config=require(_0x2b05('0x10'));var licenseUtil=require(_0x2b05('0x11'));var db=require(_0x2b05('0x12'))['db'];function respondWithStatusCode(_0x134c15,_0x431943){_0x431943=_0x431943||0xcc;return function(_0x100616){if(_0x100616){return _0x134c15[_0x2b05('0x13')](_0x431943);}return _0x134c15[_0x2b05('0x14')](_0x431943)['end']();};}function respondWithResult(_0x11d545,_0x59ee91){_0x59ee91=_0x59ee91||0xc8;return function(_0x2493ed){if(_0x2493ed){return _0x11d545[_0x2b05('0x14')](_0x59ee91)['json'](_0x2493ed);}};}function respondWithFilteredResult(_0x1a7348,_0x5dca10){return function(_0x358b03){if(_0x358b03){var _0x288cc0=typeof _0x5dca10[_0x2b05('0x15')]==='undefined'&&typeof _0x5dca10[_0x2b05('0x16')]===_0x2b05('0x17');var _0x4ced27=_0x358b03[_0x2b05('0x18')];var _0xbcb474=_0x288cc0?0x0:_0x5dca10[_0x2b05('0x15')];var _0x2f505a=_0x288cc0?_0x358b03['count']:_0x5dca10['offset']+_0x5dca10[_0x2b05('0x16')];var _0x13105d;if(_0x2f505a>=_0x4ced27){_0x2f505a=_0x4ced27;_0x13105d=0xc8;}else{_0x13105d=0xce;}_0x1a7348['status'](_0x13105d);return _0x1a7348['set'](_0x2b05('0x19'),_0xbcb474+'-'+_0x2f505a+'/'+_0x4ced27)[_0x2b05('0x1a')](_0x358b03);}return null;};}function patchUpdates(_0x863a16){return function(_0x47a1c8){try{jsonpatch[_0x2b05('0x1b')](_0x47a1c8,_0x863a16,!![]);}catch(_0xd2be7){return BPromise[_0x2b05('0x1c')](_0xd2be7);}return _0x47a1c8[_0x2b05('0x1d')]();};}function saveUpdates(_0x414654,_0x297900){return function(_0x4ccced){if(_0x4ccced){return _0x4ccced[_0x2b05('0x1e')](_0x414654)['then'](function(_0x58e84f){return _0x58e84f;});}return null;};}function removeEntity(_0x46b9c0,_0x241463){return function(_0x43caf6){if(_0x43caf6){return _0x43caf6[_0x2b05('0x1f')]()['then'](function(){_0x46b9c0['status'](0xcc)[_0x2b05('0x20')]();});}};}function handleEntityNotFound(_0x75a181,_0x34f641){return function(_0x15ed22){if(!_0x15ed22){_0x75a181[_0x2b05('0x13')](0x194);}return _0x15ed22;};}function handleError(_0x33c4b1,_0x4ff463){_0x4ff463=_0x4ff463||0x1f4;return function(_0x1de3c1){logger['error'](_0x1de3c1[_0x2b05('0x21')]);if(_0x1de3c1[_0x2b05('0x22')]){delete _0x1de3c1[_0x2b05('0x22')];}_0x33c4b1[_0x2b05('0x14')](_0x4ff463)[_0x2b05('0x23')](_0x1de3c1);};}exports['index']=function(_0x4e8bf3,_0x578f1f){var _0x3cb8ab={},_0x405348={},_0x56176a={'count':0x0,'rows':[]};var _0x474ef3=_[_0x2b05('0x24')](db[_0x2b05('0x25')][_0x2b05('0x26')],function(_0x3df988){return{'name':_0x3df988[_0x2b05('0x27')],'type':_0x3df988[_0x2b05('0x28')][_0x2b05('0x29')]};});_0x405348[_0x2b05('0x2a')]=_[_0x2b05('0x24')](_0x474ef3,'name');_0x405348['query']=_[_0x2b05('0x2b')](_0x4e8bf3[_0x2b05('0x2c')]);_0x405348[_0x2b05('0x2d')]=_[_0x2b05('0x2e')](_0x405348[_0x2b05('0x2a')],_0x405348[_0x2b05('0x2c')]);_0x3cb8ab[_0x2b05('0x2f')]=_[_0x2b05('0x2e')](_0x405348[_0x2b05('0x2a')],qs[_0x2b05('0x30')](_0x4e8bf3[_0x2b05('0x2c')][_0x2b05('0x30')]));_0x3cb8ab['attributes']=_0x3cb8ab[_0x2b05('0x2f')][_0x2b05('0x31')]?_0x3cb8ab[_0x2b05('0x2f')]:_0x405348[_0x2b05('0x2a')];if(!_0x4e8bf3[_0x2b05('0x2c')][_0x2b05('0x32')](_0x2b05('0x33'))){_0x3cb8ab[_0x2b05('0x16')]=qs[_0x2b05('0x16')](_0x4e8bf3[_0x2b05('0x2c')][_0x2b05('0x16')]);_0x3cb8ab['offset']=qs[_0x2b05('0x15')](_0x4e8bf3[_0x2b05('0x2c')][_0x2b05('0x15')]);}_0x3cb8ab[_0x2b05('0x34')]=qs[_0x2b05('0x35')](_0x4e8bf3[_0x2b05('0x2c')][_0x2b05('0x35')]);_0x3cb8ab[_0x2b05('0x36')]=qs[_0x2b05('0x2d')](_[_0x2b05('0x37')](_0x4e8bf3['query'],_0x405348[_0x2b05('0x2d')]),_0x474ef3);if(_0x4e8bf3[_0x2b05('0x2c')][_0x2b05('0x38')]){_0x3cb8ab[_0x2b05('0x36')]=_[_0x2b05('0x39')](_0x3cb8ab[_0x2b05('0x36')],{'$or':_['map'](_0x474ef3,function(_0xc7cf71){if(_0xc7cf71[_0x2b05('0x28')]!==_0x2b05('0x3a')){var _0x26406e={};_0x26406e[_0xc7cf71['name']]={'$like':'%'+_0x4e8bf3[_0x2b05('0x2c')][_0x2b05('0x38')]+'%'};return _0x26406e;}})});}_0x3cb8ab=_[_0x2b05('0x39')]({},_0x3cb8ab,_0x4e8bf3[_0x2b05('0x3b')]);var _0x234b08={'where':_0x3cb8ab[_0x2b05('0x36')]};return db[_0x2b05('0x25')]['count'](_0x234b08)['then'](function(_0x104736){_0x56176a[_0x2b05('0x18')]=_0x104736;if(_0x4e8bf3['query'][_0x2b05('0x3c')]){_0x3cb8ab[_0x2b05('0x3d')]=[{'all':!![]}];}return db[_0x2b05('0x25')][_0x2b05('0x3e')](_0x3cb8ab);})[_0x2b05('0x3f')](function(_0x576abf){_0x56176a['rows']=_0x576abf;return _0x56176a;})[_0x2b05('0x3f')](respondWithFilteredResult(_0x578f1f,_0x3cb8ab))['catch'](handleError(_0x578f1f,null));};exports['show']=function(_0x1e35bd,_0x2c8844){var _0x221560={'raw':![],'where':{'id':_0x1e35bd['params']['id']}},_0x589271={};_0x589271[_0x2b05('0x2a')]=_[_0x2b05('0x2b')](db[_0x2b05('0x25')][_0x2b05('0x26')]);_0x589271[_0x2b05('0x2c')]=_[_0x2b05('0x2b')](_0x1e35bd['query']);_0x589271[_0x2b05('0x2d')]=_[_0x2b05('0x2e')](_0x589271['model'],_0x589271[_0x2b05('0x2c')]);_0x221560['attributes']=_[_0x2b05('0x2e')](_0x589271[_0x2b05('0x2a')],qs[_0x2b05('0x30')](_0x1e35bd[_0x2b05('0x2c')]['fields']));_0x221560['attributes']=_0x221560[_0x2b05('0x2f')][_0x2b05('0x31')]?_0x221560[_0x2b05('0x2f')]:_0x589271[_0x2b05('0x2a')];if(_0x1e35bd[_0x2b05('0x2c')]['includeAll']){_0x221560[_0x2b05('0x3d')]=[{'all':!![]}];}_0x221560=_[_0x2b05('0x39')]({},_0x221560,_0x1e35bd[_0x2b05('0x3b')]);return db[_0x2b05('0x25')][_0x2b05('0x40')](_0x221560)[_0x2b05('0x3f')](handleEntityNotFound(_0x2c8844,null))['then'](respondWithResult(_0x2c8844,null))[_0x2b05('0x41')](handleError(_0x2c8844,null));};exports[_0x2b05('0x42')]=function(_0x2360af,_0x3f0e2d){return db[_0x2b05('0x25')][_0x2b05('0x42')](_0x2360af['body'],{})[_0x2b05('0x3f')](respondWithResult(_0x3f0e2d,0xc9))[_0x2b05('0x41')](handleError(_0x3f0e2d,null));};exports['update']=function(_0x57ccaa,_0x29aaec){if(_0x57ccaa['body']['id']){delete _0x57ccaa[_0x2b05('0x43')]['id'];}return db[_0x2b05('0x25')][_0x2b05('0x40')]({'where':{'id':_0x57ccaa[_0x2b05('0x44')]['id']}})[_0x2b05('0x3f')](handleEntityNotFound(_0x29aaec,null))['then'](saveUpdates(_0x57ccaa[_0x2b05('0x43')],null))[_0x2b05('0x3f')](respondWithResult(_0x29aaec,null))[_0x2b05('0x41')](handleError(_0x29aaec,null));};exports[_0x2b05('0x1f')]=function(_0x4ef9c9,_0x2987ac){return db[_0x2b05('0x25')][_0x2b05('0x40')]({'where':{'id':_0x4ef9c9['params']['id']}})[_0x2b05('0x3f')](handleEntityNotFound(_0x2987ac,null))[_0x2b05('0x3f')](removeEntity(_0x2987ac,null))[_0x2b05('0x41')](handleError(_0x2987ac,null));};exports['getFields']=function(_0x402d07,_0x28e515,_0x37d4f4){var _0x46a1f3={};var _0x2e3aef={};var _0x31caf9;var _0x4f335c;return db[_0x2b05('0x25')][_0x2b05('0x45')]({'where':{'id':_0x402d07[_0x2b05('0x44')]['id']}})[_0x2b05('0x3f')](handleEntityNotFound(_0x28e515,null))[_0x2b05('0x3f')](function(_0x3d8bdd){if(_0x3d8bdd){_0x31caf9=_0x3d8bdd;_0x2e3aef['model']=_['keys'](db[_0x2b05('0x46')][_0x2b05('0x26')]);_0x2e3aef[_0x2b05('0x2c')]=_[_0x2b05('0x2b')](_0x402d07['query']);_0x2e3aef[_0x2b05('0x2d')]=_[_0x2b05('0x2e')](_0x2e3aef['model'],_0x2e3aef[_0x2b05('0x2c')]);_0x46a1f3['attributes']=_[_0x2b05('0x2e')](_0x2e3aef[_0x2b05('0x2a')],qs[_0x2b05('0x30')](_0x402d07[_0x2b05('0x2c')]['fields']));_0x46a1f3[_0x2b05('0x2f')]=_0x46a1f3['attributes'][_0x2b05('0x31')]?_0x46a1f3[_0x2b05('0x2f')]:_0x2e3aef[_0x2b05('0x2a')];_0x46a1f3[_0x2b05('0x34')]=qs[_0x2b05('0x35')](_0x402d07[_0x2b05('0x2c')][_0x2b05('0x35')]);_0x46a1f3[_0x2b05('0x36')]=qs[_0x2b05('0x2d')](_[_0x2b05('0x37')](_0x402d07[_0x2b05('0x2c')],_0x2e3aef[_0x2b05('0x2d')]));if(_0x402d07[_0x2b05('0x2c')]['filter']){_0x46a1f3[_0x2b05('0x36')]=_[_0x2b05('0x39')](_0x46a1f3[_0x2b05('0x36')],{'$or':_['map'](_0x46a1f3[_0x2b05('0x2f')],function(_0x1ad8a1){var _0x3165ec={};_0x3165ec[_0x1ad8a1]={'$like':'%'+_0x402d07[_0x2b05('0x2c')][_0x2b05('0x38')]+'%'};return _0x3165ec;})});}_0x46a1f3=_['merge']({},_0x46a1f3,_0x402d07['options']);return _0x31caf9['getFields'](_0x46a1f3);}})[_0x2b05('0x3f')](function(_0x347a2d){if(_0x347a2d){_0x4f335c=_0x347a2d['length'];if(!_0x402d07[_0x2b05('0x2c')]['hasOwnProperty'](_0x2b05('0x33'))){_0x46a1f3[_0x2b05('0x16')]=qs['limit'](_0x402d07[_0x2b05('0x2c')][_0x2b05('0x16')]);_0x46a1f3[_0x2b05('0x15')]=qs['offset'](_0x402d07['query'][_0x2b05('0x15')]);}return _0x31caf9['getFields'](_0x46a1f3);}})[_0x2b05('0x3f')](function(_0x2ce5a9){if(_0x2ce5a9){return _0x2ce5a9?{'count':_0x4f335c,'rows':_0x2ce5a9}:null;}})[_0x2b05('0x3f')](respondWithResult(_0x28e515,null))[_0x2b05('0x41')](handleError(_0x28e515,null));};exports['getSubjects']=function(_0x1e71b0,_0x1c81b8,_0x2b2274){var _0x488e25={};var _0x49115f={};var _0x283caf;var _0x50daa7;return db[_0x2b05('0x25')][_0x2b05('0x45')]({'where':{'id':_0x1e71b0['params']['id']}})[_0x2b05('0x3f')](handleEntityNotFound(_0x1c81b8,null))[_0x2b05('0x3f')](function(_0x5f1cdf){if(_0x5f1cdf){_0x283caf=_0x5f1cdf;_0x49115f['model']=_[_0x2b05('0x2b')](db[_0x2b05('0x46')][_0x2b05('0x26')]);_0x49115f[_0x2b05('0x2c')]=_[_0x2b05('0x2b')](_0x1e71b0[_0x2b05('0x2c')]);_0x49115f[_0x2b05('0x2d')]=_['intersection'](_0x49115f['model'],_0x49115f[_0x2b05('0x2c')]);_0x488e25[_0x2b05('0x2f')]=_[_0x2b05('0x2e')](_0x49115f[_0x2b05('0x2a')],qs[_0x2b05('0x30')](_0x1e71b0[_0x2b05('0x2c')]['fields']));_0x488e25[_0x2b05('0x2f')]=_0x488e25[_0x2b05('0x2f')][_0x2b05('0x31')]?_0x488e25['attributes']:_0x49115f[_0x2b05('0x2a')];_0x488e25['order']=qs[_0x2b05('0x35')](_0x1e71b0[_0x2b05('0x2c')][_0x2b05('0x35')]);_0x488e25[_0x2b05('0x36')]=qs[_0x2b05('0x2d')](_[_0x2b05('0x37')](_0x1e71b0['query'],_0x49115f['filters']));if(_0x1e71b0[_0x2b05('0x2c')][_0x2b05('0x38')]){_0x488e25[_0x2b05('0x36')]=_[_0x2b05('0x39')](_0x488e25[_0x2b05('0x36')],{'$or':_[_0x2b05('0x24')](_0x488e25[_0x2b05('0x2f')],function(_0x27f2b9){var _0x43c7a6={};_0x43c7a6[_0x27f2b9]={'$like':'%'+_0x1e71b0[_0x2b05('0x2c')]['filter']+'%'};return _0x43c7a6;})});}_0x488e25=_['merge']({},_0x488e25,_0x1e71b0['options']);return _0x283caf[_0x2b05('0x47')](_0x488e25);}})[_0x2b05('0x3f')](function(_0x225e0c){if(_0x225e0c){_0x50daa7=_0x225e0c[_0x2b05('0x31')];if(!_0x1e71b0['query'][_0x2b05('0x32')](_0x2b05('0x33'))){_0x488e25[_0x2b05('0x16')]=qs['limit'](_0x1e71b0[_0x2b05('0x2c')][_0x2b05('0x16')]);_0x488e25[_0x2b05('0x15')]=qs[_0x2b05('0x15')](_0x1e71b0['query']['offset']);}return _0x283caf[_0x2b05('0x47')](_0x488e25);}})[_0x2b05('0x3f')](function(_0x2aa192){if(_0x2aa192){return _0x2aa192?{'count':_0x50daa7,'rows':_0x2aa192}:null;}})[_0x2b05('0x3f')](respondWithResult(_0x1c81b8,null))['catch'](handleError(_0x1c81b8,null));};exports[_0x2b05('0x48')]=function(_0x5e5e25,_0x162a87,_0x595899){var _0x5880e4={};var _0x4de61d={};var _0x3b6132;var _0x1329d0;return db['ServicenowConfiguration'][_0x2b05('0x45')]({'where':{'id':_0x5e5e25[_0x2b05('0x44')]['id']}})[_0x2b05('0x3f')](handleEntityNotFound(_0x162a87,null))[_0x2b05('0x3f')](function(_0x388a27){if(_0x388a27){_0x3b6132=_0x388a27;_0x4de61d['model']=_[_0x2b05('0x2b')](db[_0x2b05('0x46')][_0x2b05('0x26')]);_0x4de61d[_0x2b05('0x2c')]=_[_0x2b05('0x2b')](_0x5e5e25[_0x2b05('0x2c')]);_0x4de61d[_0x2b05('0x2d')]=_[_0x2b05('0x2e')](_0x4de61d[_0x2b05('0x2a')],_0x4de61d[_0x2b05('0x2c')]);_0x5880e4[_0x2b05('0x2f')]=_[_0x2b05('0x2e')](_0x4de61d[_0x2b05('0x2a')],qs['fields'](_0x5e5e25['query']['fields']));_0x5880e4[_0x2b05('0x2f')]=_0x5880e4[_0x2b05('0x2f')][_0x2b05('0x31')]?_0x5880e4[_0x2b05('0x2f')]:_0x4de61d['model'];_0x5880e4[_0x2b05('0x34')]=qs[_0x2b05('0x35')](_0x5e5e25[_0x2b05('0x2c')][_0x2b05('0x35')]);_0x5880e4['where']=qs[_0x2b05('0x2d')](_[_0x2b05('0x37')](_0x5e5e25[_0x2b05('0x2c')],_0x4de61d[_0x2b05('0x2d')]));if(_0x5e5e25[_0x2b05('0x2c')]['filter']){_0x5880e4['where']=_[_0x2b05('0x39')](_0x5880e4[_0x2b05('0x36')],{'$or':_[_0x2b05('0x24')](_0x5880e4[_0x2b05('0x2f')],function(_0x308308){var _0x43014b={};_0x43014b[_0x308308]={'$like':'%'+_0x5e5e25['query'][_0x2b05('0x38')]+'%'};return _0x43014b;})});}_0x5880e4=_[_0x2b05('0x39')]({},_0x5880e4,_0x5e5e25[_0x2b05('0x3b')]);return _0x3b6132[_0x2b05('0x48')](_0x5880e4);}})[_0x2b05('0x3f')](function(_0x2fefa0){if(_0x2fefa0){_0x1329d0=_0x2fefa0[_0x2b05('0x31')];if(!_0x5e5e25[_0x2b05('0x2c')][_0x2b05('0x32')](_0x2b05('0x33'))){_0x5880e4[_0x2b05('0x16')]=qs['limit'](_0x5e5e25['query'][_0x2b05('0x16')]);_0x5880e4[_0x2b05('0x15')]=qs[_0x2b05('0x15')](_0x5e5e25[_0x2b05('0x2c')][_0x2b05('0x15')]);}return _0x3b6132[_0x2b05('0x48')](_0x5880e4);}})[_0x2b05('0x3f')](function(_0x545826){if(_0x545826){return _0x545826?{'count':_0x1329d0,'rows':_0x545826}:null;}})[_0x2b05('0x3f')](respondWithResult(_0x162a87,null))['catch'](handleError(_0x162a87,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e1e1cfb..15b71bf 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 _0x3014=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','moment','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x3014,0x1d7));var _0x4301=function(_0x1ee9e3,_0x2dd132){_0x1ee9e3=_0x1ee9e3-0x0;var _0x3138b1=_0x3014[_0x1ee9e3];return _0x3138b1;};'use strict';var _=require(_0x4301('0x0'));var util=require(_0x4301('0x1'));var logger=require('../../config/logger')(_0x4301('0x2'));var moment=require(_0x4301('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4301('0x4'));var rimraf=require(_0x4301('0x5'));var config=require(_0x4301('0x6'));var attributes=require(_0x4301('0x7'));module[_0x4301('0x8')]=function(_0x42ced6,_0x42ac4b){return _0x42ced6[_0x4301('0x9')](_0x4301('0xa'),attributes,{'tableName':_0x4301('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x69af=['ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define'];(function(_0x33c45a,_0xf2b91){var _0x51f680=function(_0x2fb67c){while(--_0x2fb67c){_0x33c45a['push'](_0x33c45a['shift']());}};_0x51f680(++_0xf2b91);}(_0x69af,0x17b));var _0xf69a=function(_0x6bdd21,_0x51891a){_0x6bdd21=_0x6bdd21-0x0;var _0x44ed07=_0x69af[_0x6bdd21];return _0x44ed07;};'use strict';var _=require('lodash');var util=require(_0xf69a('0x0'));var logger=require(_0xf69a('0x1'))(_0xf69a('0x2'));var moment=require(_0xf69a('0x3'));var BPromise=require(_0xf69a('0x4'));var rp=require(_0xf69a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf69a('0x6'));var config=require(_0xf69a('0x7'));var attributes=require(_0xf69a('0x8'));module[_0xf69a('0x9')]=function(_0x723700,_0x5953c9){return _0x723700[_0xf69a('0xa')](_0xf69a('0xb'),attributes,{'tableName':_0xf69a('0xc'),'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 d7acf3b..7ef79ab 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 _0x7750=['then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x5b814a,_0x3063cc){var _0xa4979b=function(_0x36daba){while(--_0x36daba){_0x5b814a['push'](_0x5b814a['shift']());}};_0xa4979b(++_0x3063cc);}(_0x7750,0x182));var _0x0775=function(_0x2859c3,_0x468ad3){_0x2859c3=_0x2859c3-0x0;var _0x3cea96=_0x7750[_0x2859c3];return _0x3cea96;};'use strict';var _=require(_0x0775('0x0'));var util=require('util');var moment=require(_0x0775('0x1'));var BPromise=require(_0x0775('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0775('0x3'));var logger=require(_0x0775('0x4'))(_0x0775('0x5'));var config=require(_0x0775('0x6'));var jayson=require(_0x0775('0x7'));var client=jayson[_0x0775('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183a4d,_0x556d9f,_0x1ba3f5){return new BPromise(function(_0x4e017e,_0x2bf626){return client[_0x0775('0x9')](_0x183a4d,_0x1ba3f5)[_0x0775('0xa')](function(_0x55c5e9){logger[_0x0775('0xb')](_0x0775('0xc'),_0x556d9f,'request\x20sent');logger[_0x0775('0xd')](_0x0775('0xe'),_0x556d9f,_0x0775('0xf'),JSON[_0x0775('0x10')](_0x55c5e9));if(_0x55c5e9[_0x0775('0x11')]){if(_0x55c5e9[_0x0775('0x11')][_0x0775('0x12')]===0x1f4){logger['error'](_0x0775('0xc'),_0x556d9f,_0x55c5e9[_0x0775('0x11')][_0x0775('0x13')]);return _0x2bf626(_0x55c5e9[_0x0775('0x11')]['message']);}logger[_0x0775('0x11')](_0x0775('0xc'),_0x556d9f,_0x55c5e9[_0x0775('0x11')]['message']);return _0x4e017e(_0x55c5e9['error'][_0x0775('0x13')]);}else{logger[_0x0775('0xb')](_0x0775('0xc'),_0x556d9f,_0x0775('0xf'));_0x4e017e(_0x55c5e9[_0x0775('0x14')]['message']);}})[_0x0775('0x15')](function(_0x4e5f88){logger['error'](_0x0775('0xc'),_0x556d9f,_0x4e5f88);_0x2bf626(_0x4e5f88);});});} \ No newline at end of file +var _0x8745=['request','info','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http'];(function(_0x41db4f,_0x5ad658){var _0x98ecba=function(_0x5cbe49){while(--_0x5cbe49){_0x41db4f['push'](_0x41db4f['shift']());}};_0x98ecba(++_0x5ad658);}(_0x8745,0x136));var _0x5874=function(_0x59379d,_0x119332){_0x59379d=_0x59379d-0x0;var _0x1113ce=_0x8745[_0x59379d];return _0x1113ce;};'use strict';var _=require(_0x5874('0x0'));var util=require(_0x5874('0x1'));var moment=require(_0x5874('0x2'));var BPromise=require(_0x5874('0x3'));var rs=require(_0x5874('0x4'));var fs=require('fs');var Redis=require(_0x5874('0x5'));var db=require(_0x5874('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5874('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5874('0x8')][_0x5874('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fbe6b,_0x24929c,_0x5e2d0c){return new BPromise(function(_0x198637,_0x4d8dce){return client[_0x5874('0xa')](_0x4fbe6b,_0x5e2d0c)['then'](function(_0x5390ab){logger[_0x5874('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x24929c,'request\x20sent');logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x24929c,_0x5874('0xc'),JSON[_0x5874('0xd')](_0x5390ab));if(_0x5390ab[_0x5874('0xe')]){if(_0x5390ab['error'][_0x5874('0xf')]===0x1f4){logger[_0x5874('0xe')](_0x5874('0x10'),_0x24929c,_0x5390ab['error']['message']);return _0x4d8dce(_0x5390ab['error']['message']);}logger[_0x5874('0xe')](_0x5874('0x10'),_0x24929c,_0x5390ab[_0x5874('0xe')][_0x5874('0x11')]);return _0x198637(_0x5390ab[_0x5874('0xe')][_0x5874('0x11')]);}else{logger[_0x5874('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x24929c,_0x5874('0xc'));_0x198637(_0x5390ab[_0x5874('0x12')][_0x5874('0x11')]);}})[_0x5874('0x13')](function(_0x3b869c){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x24929c,_0x3b869c);_0x4d8dce(_0x3b869c);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index d1be10c..54f418f 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 _0xd633=['path','express','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','/:id','isAuthenticated','show','create','update','destroy','exports','multer'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xd633,0x77));var _0x3d63=function(_0x59455d,_0x41772f){_0x59455d=_0x59455d-0x0;var _0x4da35b=_0xd633[_0x59455d];return _0x4da35b;};'use strict';var multer=require(_0x3d63('0x0'));var util=require('util');var path=require(_0x3d63('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d63('0x2'));var router=express[_0x3d63('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3d63('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3d63('0x5'));var controller=require(_0x3d63('0x6'));router[_0x3d63('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3d63('0x7')](_0x3d63('0x8'),auth[_0x3d63('0x9')](),controller[_0x3d63('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3d63('0xb')]);router['put']('/:id',auth[_0x3d63('0x9')](),controller[_0x3d63('0xc')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x3d63('0xd')]);module[_0x3d63('0xe')]=router; \ No newline at end of file +var _0x0c7f=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0c7f,0xa9));var _0xf0c7=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0c7f[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0xf0c7('0x0'));var util=require(_0xf0c7('0x1'));var path=require('path');var timeout=require(_0xf0c7('0x2'));var express=require(_0xf0c7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf0c7('0x4'));var interaction=require(_0xf0c7('0x5'));var config=require(_0xf0c7('0x6'));var controller=require(_0xf0c7('0x7'));router[_0xf0c7('0x8')]('/',auth['isAuthenticated'](),controller[_0xf0c7('0x9')]);router[_0xf0c7('0x8')](_0xf0c7('0xa'),auth[_0xf0c7('0xb')](),controller[_0xf0c7('0xc')]);router[_0xf0c7('0xd')]('/',auth[_0xf0c7('0xb')](),controller['create']);router[_0xf0c7('0xe')](_0xf0c7('0xa'),auth['isAuthenticated'](),controller[_0xf0c7('0xf')]);router[_0xf0c7('0x10')]('/:id',auth[_0xf0c7('0xb')](),controller[_0xf0c7('0x11')]);module[_0xf0c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2840035..3b2eb5e 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 _0xe63c=['BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x2986b0,_0x4beda9){var _0x1e79d4=function(_0x258027){while(--_0x258027){_0x2986b0['push'](_0x2986b0['shift']());}};_0x1e79d4(++_0x4beda9);}(_0xe63c,0x17b));var _0xce63=function(_0x28aeb2,_0x319b38){_0x28aeb2=_0x28aeb2-0x0;var _0x1d33e1=_0xe63c[_0x28aeb2];return _0x1d33e1;};'use strict';var Sequelize=require(_0xce63('0x0'));module['exports']={'type':{'type':Sequelize[_0xce63('0x1')](_0xce63('0x2'),_0xce63('0x3'),'customVariable',_0xce63('0x4'),_0xce63('0x5')),'defaultValue':_0xce63('0x2')},'content':{'type':Sequelize[_0xce63('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xce63('0x1')]('string',_0xce63('0x3'),_0xce63('0x7'))},'keyContent':{'type':Sequelize[_0xce63('0x6')]},'idField':{'type':Sequelize[_0xce63('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xce63('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xce63('0x6')]}}; \ No newline at end of file +var _0x97b0=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x11a604,_0x2dba4f){var _0x553fde=function(_0x56b782){while(--_0x56b782){_0x11a604['push'](_0x11a604['shift']());}};_0x553fde(++_0x2dba4f);}(_0x97b0,0x81));var _0x097b=function(_0x544fd8,_0x1d305a){_0x544fd8=_0x544fd8-0x0;var _0x33a1b2=_0x97b0[_0x544fd8];return _0x33a1b2;};'use strict';var Sequelize=require(_0x097b('0x0'));module[_0x097b('0x1')]={'type':{'type':Sequelize[_0x097b('0x2')]('string',_0x097b('0x3'),_0x097b('0x4'),_0x097b('0x5'),_0x097b('0x6')),'defaultValue':_0x097b('0x7')},'content':{'type':Sequelize[_0x097b('0x8')]},'key':{'type':Sequelize[_0x097b('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x097b('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x097b('0x8')]},'nameField':{'type':Sequelize[_0x097b('0x8')]},'customField':{'type':Sequelize[_0x097b('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x097b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 459d490..ad9093c 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 _0xa2e9=['util','path','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','type','VIRTUAL','merge','options','ServicenowField','includeAll','include','show','length','find','catch','create','body','params','destroy','rimraf','fast-json-patch','request-promise','moment','bluebird'];(function(_0x496f0a,_0x4df10d){var _0x138acf=function(_0x1043fc){while(--_0x1043fc){_0x496f0a['push'](_0x496f0a['shift']());}};_0x138acf(++_0x4df10d);}(_0xa2e9,0xc7));var _0x9a2e=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xa2e9[_0x33155c];return _0x5becf7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a2e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a2e('0x1'));var rp=require(_0x9a2e('0x2'));var moment=require(_0x9a2e('0x3'));var BPromise=require(_0x9a2e('0x4'));var Mustache=require('mustache');var util=require(_0x9a2e('0x5'));var path=require(_0x9a2e('0x6'));var sox=require('sox');var csv=require(_0x9a2e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a2e('0x8'));var squel=require(_0x9a2e('0x9'));var crypto=require(_0x9a2e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9a2e('0xb'));var Papa=require('papaparse');var Redis=require(_0x9a2e('0xc'));var authService=require(_0x9a2e('0xd'));var qs=require(_0x9a2e('0xe'));var as=require(_0x9a2e('0xf'));var hardwareService=require(_0x9a2e('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x9a2e('0x11'));var config=require(_0x9a2e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a2e('0x13'))['db'];function respondWithStatusCode(_0x228ac0,_0x4df6e9){_0x4df6e9=_0x4df6e9||0xcc;return function(_0x3b660f){if(_0x3b660f){return _0x228ac0[_0x9a2e('0x14')](_0x4df6e9);}return _0x228ac0[_0x9a2e('0x15')](_0x4df6e9)[_0x9a2e('0x16')]();};}function respondWithResult(_0x3ea339,_0x16d3dd){_0x16d3dd=_0x16d3dd||0xc8;return function(_0x143742){if(_0x143742){return _0x3ea339[_0x9a2e('0x15')](_0x16d3dd)['json'](_0x143742);}};}function respondWithFilteredResult(_0x34f8f4,_0xe79f59){return function(_0x23cb79){if(_0x23cb79){var _0x322d7d=typeof _0xe79f59[_0x9a2e('0x17')]===_0x9a2e('0x18')&&typeof _0xe79f59[_0x9a2e('0x19')]===_0x9a2e('0x18');var _0x243dbb=_0x23cb79[_0x9a2e('0x1a')];var _0x791a13=_0x322d7d?0x0:_0xe79f59['offset'];var _0x2518bc=_0x322d7d?_0x23cb79[_0x9a2e('0x1a')]:_0xe79f59['offset']+_0xe79f59[_0x9a2e('0x19')];var _0xbd2d82;if(_0x2518bc>=_0x243dbb){_0x2518bc=_0x243dbb;_0xbd2d82=0xc8;}else{_0xbd2d82=0xce;}_0x34f8f4[_0x9a2e('0x15')](_0xbd2d82);return _0x34f8f4['set']('Content-Range',_0x791a13+'-'+_0x2518bc+'/'+_0x243dbb)[_0x9a2e('0x1b')](_0x23cb79);}return null;};}function patchUpdates(_0x6b589a){return function(_0x4f59cc){try{jsonpatch[_0x9a2e('0x1c')](_0x4f59cc,_0x6b589a,!![]);}catch(_0x1e85b0){return BPromise[_0x9a2e('0x1d')](_0x1e85b0);}return _0x4f59cc[_0x9a2e('0x1e')]();};}function saveUpdates(_0x498b61,_0xdc21d0){return function(_0x3648f4){if(_0x3648f4){return _0x3648f4[_0x9a2e('0x1f')](_0x498b61)[_0x9a2e('0x20')](function(_0xc52d34){return _0xc52d34;});}return null;};}function removeEntity(_0x3eaf3b,_0x5965cf){return function(_0x17163c){if(_0x17163c){return _0x17163c['destroy']()['then'](function(){_0x3eaf3b[_0x9a2e('0x15')](0xcc)[_0x9a2e('0x16')]();});}};}function handleEntityNotFound(_0x5466af,_0x14ecc2){return function(_0x434df0){if(!_0x434df0){_0x5466af[_0x9a2e('0x14')](0x194);}return _0x434df0;};}function handleError(_0x36b5ab,_0xe9401a){_0xe9401a=_0xe9401a||0x1f4;return function(_0x52e7e6){logger[_0x9a2e('0x21')](_0x52e7e6[_0x9a2e('0x22')]);if(_0x52e7e6[_0x9a2e('0x23')]){delete _0x52e7e6[_0x9a2e('0x23')];}_0x36b5ab[_0x9a2e('0x15')](_0xe9401a)['send'](_0x52e7e6);};}exports[_0x9a2e('0x24')]=function(_0x59c749,_0x5bbce1){var _0x58d52d={},_0x1568bc={},_0x571376={'count':0x0,'rows':[]};var _0xc53736=_[_0x9a2e('0x25')](db['ServicenowField'][_0x9a2e('0x26')],function(_0x1df23b){return{'name':_0x1df23b[_0x9a2e('0x27')],'type':_0x1df23b['type'][_0x9a2e('0x28')]};});_0x1568bc[_0x9a2e('0x29')]=_[_0x9a2e('0x25')](_0xc53736,_0x9a2e('0x23'));_0x1568bc['query']=_[_0x9a2e('0x2a')](_0x59c749['query']);_0x1568bc['filters']=_[_0x9a2e('0x2b')](_0x1568bc[_0x9a2e('0x29')],_0x1568bc[_0x9a2e('0x2c')]);_0x58d52d[_0x9a2e('0x2d')]=_[_0x9a2e('0x2b')](_0x1568bc[_0x9a2e('0x29')],qs[_0x9a2e('0x2e')](_0x59c749['query'][_0x9a2e('0x2e')]));_0x58d52d[_0x9a2e('0x2d')]=_0x58d52d[_0x9a2e('0x2d')]['length']?_0x58d52d['attributes']:_0x1568bc[_0x9a2e('0x29')];if(!_0x59c749[_0x9a2e('0x2c')][_0x9a2e('0x2f')](_0x9a2e('0x30'))){_0x58d52d[_0x9a2e('0x19')]=qs[_0x9a2e('0x19')](_0x59c749[_0x9a2e('0x2c')][_0x9a2e('0x19')]);_0x58d52d[_0x9a2e('0x17')]=qs[_0x9a2e('0x17')](_0x59c749[_0x9a2e('0x2c')][_0x9a2e('0x17')]);}_0x58d52d[_0x9a2e('0x31')]=qs[_0x9a2e('0x32')](_0x59c749[_0x9a2e('0x2c')]['sort']);_0x58d52d[_0x9a2e('0x33')]=qs[_0x9a2e('0x34')](_['pick'](_0x59c749[_0x9a2e('0x2c')],_0x1568bc['filters']),_0xc53736);if(_0x59c749[_0x9a2e('0x2c')]['filter']){_0x58d52d[_0x9a2e('0x33')]=_['merge'](_0x58d52d[_0x9a2e('0x33')],{'$or':_[_0x9a2e('0x25')](_0xc53736,function(_0x22bd87){if(_0x22bd87[_0x9a2e('0x35')]!==_0x9a2e('0x36')){var _0x3c2cc2={};_0x3c2cc2[_0x22bd87[_0x9a2e('0x23')]]={'$like':'%'+_0x59c749[_0x9a2e('0x2c')]['filter']+'%'};return _0x3c2cc2;}})});}_0x58d52d=_[_0x9a2e('0x37')]({},_0x58d52d,_0x59c749[_0x9a2e('0x38')]);var _0x5c5bfe={'where':_0x58d52d['where']};return db[_0x9a2e('0x39')][_0x9a2e('0x1a')](_0x5c5bfe)[_0x9a2e('0x20')](function(_0xa2544b){_0x571376['count']=_0xa2544b;if(_0x59c749[_0x9a2e('0x2c')][_0x9a2e('0x3a')]){_0x58d52d[_0x9a2e('0x3b')]=[{'all':!![]}];}return db[_0x9a2e('0x39')]['findAll'](_0x58d52d);})[_0x9a2e('0x20')](function(_0x1c14c1){_0x571376['rows']=_0x1c14c1;return _0x571376;})[_0x9a2e('0x20')](respondWithFilteredResult(_0x5bbce1,_0x58d52d))['catch'](handleError(_0x5bbce1,null));};exports[_0x9a2e('0x3c')]=function(_0x199288,_0x2315d7){var _0x408fca={'raw':!![],'where':{'id':_0x199288['params']['id']}},_0x33cc22={};_0x33cc22[_0x9a2e('0x29')]=_['keys'](db['ServicenowField'][_0x9a2e('0x26')]);_0x33cc22['query']=_[_0x9a2e('0x2a')](_0x199288[_0x9a2e('0x2c')]);_0x33cc22[_0x9a2e('0x34')]=_['intersection'](_0x33cc22['model'],_0x33cc22[_0x9a2e('0x2c')]);_0x408fca[_0x9a2e('0x2d')]=_['intersection'](_0x33cc22[_0x9a2e('0x29')],qs[_0x9a2e('0x2e')](_0x199288[_0x9a2e('0x2c')][_0x9a2e('0x2e')]));_0x408fca[_0x9a2e('0x2d')]=_0x408fca[_0x9a2e('0x2d')][_0x9a2e('0x3d')]?_0x408fca[_0x9a2e('0x2d')]:_0x33cc22['model'];if(_0x199288[_0x9a2e('0x2c')]['includeAll']){_0x408fca[_0x9a2e('0x3b')]=[{'all':!![]}];}_0x408fca=_[_0x9a2e('0x37')]({},_0x408fca,_0x199288['options']);return db[_0x9a2e('0x39')][_0x9a2e('0x3e')](_0x408fca)[_0x9a2e('0x20')](handleEntityNotFound(_0x2315d7,null))[_0x9a2e('0x20')](respondWithResult(_0x2315d7,null))[_0x9a2e('0x3f')](handleError(_0x2315d7,null));};exports['create']=function(_0x55ebc3,_0x3307a2){return db[_0x9a2e('0x39')][_0x9a2e('0x40')](_0x55ebc3[_0x9a2e('0x41')],{})['then'](respondWithResult(_0x3307a2,0xc9))[_0x9a2e('0x3f')](handleError(_0x3307a2,null));};exports[_0x9a2e('0x1f')]=function(_0x32433c,_0x3bad1e){if(_0x32433c['body']['id']){delete _0x32433c[_0x9a2e('0x41')]['id'];}return db['ServicenowField'][_0x9a2e('0x3e')]({'where':{'id':_0x32433c[_0x9a2e('0x42')]['id']}})[_0x9a2e('0x20')](handleEntityNotFound(_0x3bad1e,null))[_0x9a2e('0x20')](saveUpdates(_0x32433c['body'],null))[_0x9a2e('0x20')](respondWithResult(_0x3bad1e,null))[_0x9a2e('0x3f')](handleError(_0x3bad1e,null));};exports[_0x9a2e('0x43')]=function(_0x6725a5,_0xc6c220){return db[_0x9a2e('0x39')][_0x9a2e('0x3e')]({'where':{'id':_0x6725a5[_0x9a2e('0x42')]['id']}})[_0x9a2e('0x20')](handleEntityNotFound(_0xc6c220,null))[_0x9a2e('0x20')](removeEntity(_0xc6c220,null))[_0x9a2e('0x3f')](handleError(_0xc6c220,null));}; \ No newline at end of file +var _0x29d1=['then','destroy','sendStatus','error','stack','name','send','index','ServicenowField','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update'];(function(_0x470e46,_0x17c669){var _0x3fc02c=function(_0x541b3e){while(--_0x541b3e){_0x470e46['push'](_0x470e46['shift']());}};_0x3fc02c(++_0x17c669);}(_0x29d1,0xb7));var _0x129d=function(_0x12c7c4,_0x445b21){_0x12c7c4=_0x12c7c4-0x0;var _0x30bbdb=_0x29d1[_0x12c7c4];return _0x30bbdb;};'use strict';var emlformat=require(_0x129d('0x0'));var rimraf=require(_0x129d('0x1'));var zipdir=require(_0x129d('0x2'));var jsonpatch=require(_0x129d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x129d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x129d('0x5'));var csv=require('to-csv');var ejs=require(_0x129d('0x6'));var fs=require('fs');var fs_extra=require(_0x129d('0x7'));var _=require('lodash');var squel=require(_0x129d('0x8'));var crypto=require(_0x129d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x129d('0xa'));var toCsv=require(_0x129d('0xb'));var querystring=require(_0x129d('0xc'));var Papa=require('papaparse');var Redis=require(_0x129d('0xd'));var authService=require(_0x129d('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x129d('0xf'));var logger=require('../../config/logger')(_0x129d('0x10'));var utils=require(_0x129d('0x11'));var config=require(_0x129d('0x12'));var licenseUtil=require(_0x129d('0x13'));var db=require(_0x129d('0x14'))['db'];function respondWithStatusCode(_0x448b0a,_0x48d9ae){_0x48d9ae=_0x48d9ae||0xcc;return function(_0x980aca){if(_0x980aca){return _0x448b0a['sendStatus'](_0x48d9ae);}return _0x448b0a[_0x129d('0x15')](_0x48d9ae)[_0x129d('0x16')]();};}function respondWithResult(_0x4b679e,_0x5c659d){_0x5c659d=_0x5c659d||0xc8;return function(_0x4d5b6a){if(_0x4d5b6a){return _0x4b679e[_0x129d('0x15')](_0x5c659d)[_0x129d('0x17')](_0x4d5b6a);}};}function respondWithFilteredResult(_0x14c310,_0x520ce3){return function(_0x5d21c2){if(_0x5d21c2){var _0x17edc5=typeof _0x520ce3[_0x129d('0x18')]===_0x129d('0x19')&&typeof _0x520ce3[_0x129d('0x1a')]===_0x129d('0x19');var _0x3e9f69=_0x5d21c2['count'];var _0x87a229=_0x17edc5?0x0:_0x520ce3[_0x129d('0x18')];var _0x929a2d=_0x17edc5?_0x5d21c2[_0x129d('0x1b')]:_0x520ce3[_0x129d('0x18')]+_0x520ce3[_0x129d('0x1a')];var _0x137f27;if(_0x929a2d>=_0x3e9f69){_0x929a2d=_0x3e9f69;_0x137f27=0xc8;}else{_0x137f27=0xce;}_0x14c310[_0x129d('0x15')](_0x137f27);return _0x14c310[_0x129d('0x1c')]('Content-Range',_0x87a229+'-'+_0x929a2d+'/'+_0x3e9f69)[_0x129d('0x17')](_0x5d21c2);}return null;};}function patchUpdates(_0x4dd189){return function(_0x277157){try{jsonpatch[_0x129d('0x1d')](_0x277157,_0x4dd189,!![]);}catch(_0x9b19ad){return BPromise[_0x129d('0x1e')](_0x9b19ad);}return _0x277157[_0x129d('0x1f')]();};}function saveUpdates(_0x15c3fc,_0x5f01af){return function(_0x123662){if(_0x123662){return _0x123662[_0x129d('0x20')](_0x15c3fc)[_0x129d('0x21')](function(_0x428b38){return _0x428b38;});}return null;};}function removeEntity(_0x17361e,_0x37f305){return function(_0x2bdf3e){if(_0x2bdf3e){return _0x2bdf3e[_0x129d('0x22')]()['then'](function(){_0x17361e[_0x129d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10e64a,_0x566df0){return function(_0x3d7932){if(!_0x3d7932){_0x10e64a[_0x129d('0x23')](0x194);}return _0x3d7932;};}function handleError(_0x34af8e,_0x59756e){_0x59756e=_0x59756e||0x1f4;return function(_0x3bb02a){logger[_0x129d('0x24')](_0x3bb02a[_0x129d('0x25')]);if(_0x3bb02a[_0x129d('0x26')]){delete _0x3bb02a[_0x129d('0x26')];}_0x34af8e[_0x129d('0x15')](_0x59756e)[_0x129d('0x27')](_0x3bb02a);};}exports[_0x129d('0x28')]=function(_0xe9f2fd,_0x2aa8c8){var _0x26daab={},_0x354f0d={},_0x5dac46={'count':0x0,'rows':[]};var _0x4c780e=_['map'](db[_0x129d('0x29')]['rawAttributes'],function(_0x3e3c6e){return{'name':_0x3e3c6e['fieldName'],'type':_0x3e3c6e[_0x129d('0x2a')][_0x129d('0x2b')]};});_0x354f0d[_0x129d('0x2c')]=_['map'](_0x4c780e,_0x129d('0x26'));_0x354f0d[_0x129d('0x2d')]=_['keys'](_0xe9f2fd[_0x129d('0x2d')]);_0x354f0d[_0x129d('0x2e')]=_[_0x129d('0x2f')](_0x354f0d['model'],_0x354f0d[_0x129d('0x2d')]);_0x26daab[_0x129d('0x30')]=_[_0x129d('0x2f')](_0x354f0d[_0x129d('0x2c')],qs['fields'](_0xe9f2fd[_0x129d('0x2d')][_0x129d('0x31')]));_0x26daab[_0x129d('0x30')]=_0x26daab['attributes'][_0x129d('0x32')]?_0x26daab[_0x129d('0x30')]:_0x354f0d[_0x129d('0x2c')];if(!_0xe9f2fd[_0x129d('0x2d')][_0x129d('0x33')]('nolimit')){_0x26daab[_0x129d('0x1a')]=qs[_0x129d('0x1a')](_0xe9f2fd['query'][_0x129d('0x1a')]);_0x26daab[_0x129d('0x18')]=qs[_0x129d('0x18')](_0xe9f2fd['query'][_0x129d('0x18')]);}_0x26daab[_0x129d('0x34')]=qs[_0x129d('0x35')](_0xe9f2fd[_0x129d('0x2d')][_0x129d('0x35')]);_0x26daab[_0x129d('0x36')]=qs['filters'](_[_0x129d('0x37')](_0xe9f2fd[_0x129d('0x2d')],_0x354f0d[_0x129d('0x2e')]),_0x4c780e);if(_0xe9f2fd['query'][_0x129d('0x38')]){_0x26daab['where']=_[_0x129d('0x39')](_0x26daab[_0x129d('0x36')],{'$or':_[_0x129d('0x3a')](_0x4c780e,function(_0x445ca7){if(_0x445ca7[_0x129d('0x2a')]!=='VIRTUAL'){var _0x4ddccc={};_0x4ddccc[_0x445ca7[_0x129d('0x26')]]={'$like':'%'+_0xe9f2fd[_0x129d('0x2d')][_0x129d('0x38')]+'%'};return _0x4ddccc;}})});}_0x26daab=_[_0x129d('0x39')]({},_0x26daab,_0xe9f2fd[_0x129d('0x3b')]);var _0x376d06={'where':_0x26daab[_0x129d('0x36')]};return db[_0x129d('0x29')][_0x129d('0x1b')](_0x376d06)[_0x129d('0x21')](function(_0x310a58){_0x5dac46[_0x129d('0x1b')]=_0x310a58;if(_0xe9f2fd[_0x129d('0x2d')][_0x129d('0x3c')]){_0x26daab[_0x129d('0x3d')]=[{'all':!![]}];}return db[_0x129d('0x29')][_0x129d('0x3e')](_0x26daab);})[_0x129d('0x21')](function(_0x130f1d){_0x5dac46[_0x129d('0x3f')]=_0x130f1d;return _0x5dac46;})['then'](respondWithFilteredResult(_0x2aa8c8,_0x26daab))[_0x129d('0x40')](handleError(_0x2aa8c8,null));};exports[_0x129d('0x41')]=function(_0x4ce355,_0x35b607){var _0x410899={'raw':!![],'where':{'id':_0x4ce355['params']['id']}},_0xa68150={};_0xa68150['model']=_[_0x129d('0x42')](db[_0x129d('0x29')][_0x129d('0x43')]);_0xa68150[_0x129d('0x2d')]=_[_0x129d('0x42')](_0x4ce355[_0x129d('0x2d')]);_0xa68150[_0x129d('0x2e')]=_[_0x129d('0x2f')](_0xa68150['model'],_0xa68150[_0x129d('0x2d')]);_0x410899[_0x129d('0x30')]=_[_0x129d('0x2f')](_0xa68150[_0x129d('0x2c')],qs[_0x129d('0x31')](_0x4ce355[_0x129d('0x2d')]['fields']));_0x410899[_0x129d('0x30')]=_0x410899[_0x129d('0x30')][_0x129d('0x32')]?_0x410899[_0x129d('0x30')]:_0xa68150['model'];if(_0x4ce355[_0x129d('0x2d')][_0x129d('0x3c')]){_0x410899[_0x129d('0x3d')]=[{'all':!![]}];}_0x410899=_[_0x129d('0x39')]({},_0x410899,_0x4ce355[_0x129d('0x3b')]);return db[_0x129d('0x29')][_0x129d('0x44')](_0x410899)[_0x129d('0x21')](handleEntityNotFound(_0x35b607,null))[_0x129d('0x21')](respondWithResult(_0x35b607,null))[_0x129d('0x40')](handleError(_0x35b607,null));};exports[_0x129d('0x45')]=function(_0x379c7f,_0x2d8b66){return db[_0x129d('0x29')][_0x129d('0x45')](_0x379c7f['body'],{})['then'](respondWithResult(_0x2d8b66,0xc9))[_0x129d('0x40')](handleError(_0x2d8b66,null));};exports[_0x129d('0x20')]=function(_0x5b7ce2,_0x2111f9){if(_0x5b7ce2[_0x129d('0x46')]['id']){delete _0x5b7ce2['body']['id'];}return db['ServicenowField'][_0x129d('0x44')]({'where':{'id':_0x5b7ce2[_0x129d('0x47')]['id']}})['then'](handleEntityNotFound(_0x2111f9,null))[_0x129d('0x21')](saveUpdates(_0x5b7ce2[_0x129d('0x46')],null))[_0x129d('0x21')](respondWithResult(_0x2111f9,null))[_0x129d('0x40')](handleError(_0x2111f9,null));};exports[_0x129d('0x22')]=function(_0x2941d3,_0x49de59){return db[_0x129d('0x29')][_0x129d('0x44')]({'where':{'id':_0x2941d3[_0x129d('0x47')]['id']}})[_0x129d('0x21')](handleEntityNotFound(_0x49de59,null))[_0x129d('0x21')](removeEntity(_0x49de59,null))[_0x129d('0x40')](handleError(_0x49de59,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 0525731..1fee06b 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 _0x17c1=['util','moment','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash'];(function(_0x32b30c,_0x2d5ec8){var _0xcfc212=function(_0x42e668){while(--_0x42e668){_0x32b30c['push'](_0x32b30c['shift']());}};_0xcfc212(++_0x2d5ec8);}(_0x17c1,0x149));var _0x117c=function(_0x163049,_0x702e46){_0x163049=_0x163049-0x0;var _0x5a5157=_0x17c1[_0x163049];return _0x5a5157;};'use strict';var _=require(_0x117c('0x0'));var util=require(_0x117c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x117c('0x2'));var BPromise=require('bluebird');var rp=require(_0x117c('0x3'));var fs=require('fs');var path=require(_0x117c('0x4'));var rimraf=require(_0x117c('0x5'));var config=require(_0x117c('0x6'));var attributes=require(_0x117c('0x7'));module[_0x117c('0x8')]=function(_0x46bd01,_0x3bc6d5){return _0x46bd01[_0x117c('0x9')](_0x117c('0xa'),attributes,{'tableName':_0x117c('0xb'),'paranoid':![],'indexes':[{'name':_0x117c('0xc'),'fields':[_0x117c('0xd'),_0x117c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3adf=['../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util'];(function(_0x9d639c,_0x524dbe){var _0x1671de=function(_0x27888e){while(--_0x27888e){_0x9d639c['push'](_0x9d639c['shift']());}};_0x1671de(++_0x524dbe);}(_0x3adf,0x1c0));var _0xf3ad=function(_0x13a750,_0x16a1ba){_0x13a750=_0x13a750-0x0;var _0x5b064e=_0x3adf[_0x13a750];return _0x5b064e;};'use strict';var _=require(_0xf3ad('0x0'));var util=require(_0xf3ad('0x1'));var logger=require(_0xf3ad('0x2'))(_0xf3ad('0x3'));var moment=require('moment');var BPromise=require(_0xf3ad('0x4'));var rp=require(_0xf3ad('0x5'));var fs=require('fs');var path=require(_0xf3ad('0x6'));var rimraf=require(_0xf3ad('0x7'));var config=require('../../config/environment');var attributes=require(_0xf3ad('0x8'));module[_0xf3ad('0x9')]=function(_0x21bb52,_0x4fd137){return _0x21bb52[_0xf3ad('0xa')](_0xf3ad('0xb'),attributes,{'tableName':_0xf3ad('0xc'),'paranoid':![],'indexes':[{'name':_0xf3ad('0xd'),'fields':[_0xf3ad('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index 88fa778..e000fa8 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x30d74b,_0x4e619f){var _0x5c13e5=function(_0x449d8){while(--_0x449d8){_0x30d74b['push'](_0x30d74b['shift']());}};_0x5c13e5(++_0x4e619f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x12fb70,_0x53ec23){var _0x4e5462=function(_0x55afb5){while(--_0x55afb5){_0x12fb70['push'](_0x12fb70['shift']());}};_0x4e5462(++_0x53ec23);}(_0xe706,0xa3));var _0x6e70=function(_0x217a6f,_0x3ecd8b){_0x217a6f=_0x217a6f-0x0;var _0x5553f3=_0xe706[_0x217a6f];return _0x5553f3;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 48c475c..b009124 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xb36a02,_0x3686ba){var _0x17dc0d=function(_0x55e2df){while(--_0x55e2df){_0xb36a02['push'](_0xb36a02['shift']());}};_0x17dc0d(++_0x3686ba);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0xd5c290,_0x5a711e){var _0x16868f=function(_0x274416){while(--_0x274416){_0xd5c290['push'](_0xd5c290['shift']());}};_0x16868f(++_0x5a711e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 5644d27..089668c 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(_0x5d5764,_0x31f48c){var _0x5a3258=function(_0xe21662){while(--_0xe21662){_0x5d5764['push'](_0x5d5764['shift']());}};_0x5a3258(++_0x31f48c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0xcfbe0f,_0x4b3f61){var _0x4d1e88=function(_0x46f3f8){while(--_0x46f3f8){_0xcfbe0f['push'](_0xcfbe0f['shift']());}};_0x4d1e88(++_0x4b3f61);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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 6cd091f..cb547f2 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 _0xba50=['util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','update','then','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','body','find','getConfigurations','SugarcrmConfiguration','hasOwnProperty','findOne','AccountId','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','format','get_module_fields','values','module_fields','remove','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xba50,0x15a));var _0x0ba5=function(_0x5747e9,_0x1da002){_0x5747e9=_0x5747e9-0x0;var _0x381bf2=_0xba50[_0x5747e9];return _0x381bf2;};'use strict';var emlformat=require(_0x0ba5('0x0'));var rimraf=require(_0x0ba5('0x1'));var zipdir=require(_0x0ba5('0x2'));var jsonpatch=require(_0x0ba5('0x3'));var rp=require(_0x0ba5('0x4'));var moment=require(_0x0ba5('0x5'));var BPromise=require(_0x0ba5('0x6'));var Mustache=require(_0x0ba5('0x7'));var util=require(_0x0ba5('0x8'));var path=require(_0x0ba5('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0ba5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ba5('0xb'));var squel=require(_0x0ba5('0xc'));var crypto=require(_0x0ba5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0ba5('0xe'));var toCsv=require(_0x0ba5('0xf'));var querystring=require(_0x0ba5('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0ba5('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ba5('0x12'))(_0x0ba5('0x13'));var utils=require(_0x0ba5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0ba5('0x15'));var db=require(_0x0ba5('0x16'))['db'];var integrations=require(_0x0ba5('0x17'));function respondWithStatusCode(_0x2f28e9,_0x1ad4dd){_0x1ad4dd=_0x1ad4dd||0xcc;return function(_0x5798cb){if(_0x5798cb){return _0x2f28e9['sendStatus'](_0x1ad4dd);}return _0x2f28e9[_0x0ba5('0x18')](_0x1ad4dd)[_0x0ba5('0x19')]();};}function respondWithResult(_0x279501,_0xf2f71e){_0xf2f71e=_0xf2f71e||0xc8;return function(_0x32daf8){if(_0x32daf8){return _0x279501[_0x0ba5('0x18')](_0xf2f71e)['json'](_0x32daf8);}};}function respondWithFilteredResult(_0x78a4cc,_0x58d099){return function(_0x13e61c){if(_0x13e61c){var _0x4e21ae=typeof _0x58d099['offset']===_0x0ba5('0x1a')&&typeof _0x58d099[_0x0ba5('0x1b')]===_0x0ba5('0x1a');var _0x1e6170=_0x13e61c[_0x0ba5('0x1c')];var _0x2daf91=_0x4e21ae?0x0:_0x58d099[_0x0ba5('0x1d')];var _0x1284a0=_0x4e21ae?_0x13e61c[_0x0ba5('0x1c')]:_0x58d099['offset']+_0x58d099[_0x0ba5('0x1b')];var _0x898a3f;if(_0x1284a0>=_0x1e6170){_0x1284a0=_0x1e6170;_0x898a3f=0xc8;}else{_0x898a3f=0xce;}_0x78a4cc[_0x0ba5('0x18')](_0x898a3f);return _0x78a4cc['set'](_0x0ba5('0x1e'),_0x2daf91+'-'+_0x1284a0+'/'+_0x1e6170)[_0x0ba5('0x1f')](_0x13e61c);}return null;};}function patchUpdates(_0x3b2d66){return function(_0x1eafd5){try{jsonpatch['apply'](_0x1eafd5,_0x3b2d66,!![]);}catch(_0xaf3964){return BPromise[_0x0ba5('0x20')](_0xaf3964);}return _0x1eafd5[_0x0ba5('0x21')]();};}function saveUpdates(_0x5361ef,_0x2a3bfb){return function(_0x262344){if(_0x262344){return _0x262344[_0x0ba5('0x22')](_0x5361ef)[_0x0ba5('0x23')](function(_0x1b85fb){return _0x1b85fb;});}return null;};}function removeEntity(_0x143fc3,_0x16bf8f){return function(_0x1f1d9f){if(_0x1f1d9f){return _0x1f1d9f['destroy']()[_0x0ba5('0x23')](function(){_0x143fc3[_0x0ba5('0x18')](0xcc)[_0x0ba5('0x19')]();});}};}function handleEntityNotFound(_0x4427b6,_0x5a066d){return function(_0xef19df){if(!_0xef19df){_0x4427b6['sendStatus'](0x194);}return _0xef19df;};}function handleError(_0x85c30d,_0x5584e8){_0x5584e8=_0x5584e8||0x1f4;return function(_0x3baff8){logger[_0x0ba5('0x24')](_0x3baff8[_0x0ba5('0x25')]);if(_0x3baff8[_0x0ba5('0x26')]){delete _0x3baff8[_0x0ba5('0x26')];}_0x85c30d[_0x0ba5('0x18')](_0x5584e8)[_0x0ba5('0x27')](_0x3baff8);};}exports[_0x0ba5('0x28')]=function(_0x6bcf08,_0x48b6a1){var _0x182d6e={},_0x4c4af5={},_0x3fc943={'count':0x0,'rows':[]};var _0x314a20=_['map'](db[_0x0ba5('0x29')][_0x0ba5('0x2a')],function(_0x4d1e02){return{'name':_0x4d1e02[_0x0ba5('0x2b')],'type':_0x4d1e02[_0x0ba5('0x2c')][_0x0ba5('0x2d')]};});_0x4c4af5[_0x0ba5('0x2e')]=_[_0x0ba5('0x2f')](_0x314a20,'name');_0x4c4af5[_0x0ba5('0x30')]=_[_0x0ba5('0x31')](_0x6bcf08[_0x0ba5('0x30')]);_0x4c4af5['filters']=_[_0x0ba5('0x32')](_0x4c4af5['model'],_0x4c4af5[_0x0ba5('0x30')]);_0x182d6e[_0x0ba5('0x33')]=_[_0x0ba5('0x32')](_0x4c4af5[_0x0ba5('0x2e')],qs[_0x0ba5('0x34')](_0x6bcf08['query'][_0x0ba5('0x34')]));_0x182d6e['attributes']=_0x182d6e[_0x0ba5('0x33')][_0x0ba5('0x35')]?_0x182d6e[_0x0ba5('0x33')]:_0x4c4af5[_0x0ba5('0x2e')];if(!_0x6bcf08['query']['hasOwnProperty'](_0x0ba5('0x36'))){_0x182d6e[_0x0ba5('0x1b')]=qs[_0x0ba5('0x1b')](_0x6bcf08[_0x0ba5('0x30')][_0x0ba5('0x1b')]);_0x182d6e[_0x0ba5('0x1d')]=qs[_0x0ba5('0x1d')](_0x6bcf08[_0x0ba5('0x30')][_0x0ba5('0x1d')]);}_0x182d6e[_0x0ba5('0x37')]=qs[_0x0ba5('0x38')](_0x6bcf08[_0x0ba5('0x30')][_0x0ba5('0x38')]);_0x182d6e[_0x0ba5('0x39')]=qs['filters'](_[_0x0ba5('0x3a')](_0x6bcf08['query'],_0x4c4af5[_0x0ba5('0x3b')]),_0x314a20);if(_0x6bcf08['query'][_0x0ba5('0x3c')]){_0x182d6e[_0x0ba5('0x39')]=_[_0x0ba5('0x3d')](_0x182d6e[_0x0ba5('0x39')],{'$or':_[_0x0ba5('0x2f')](_0x314a20,function(_0x472b85){if(_0x472b85[_0x0ba5('0x2c')]!==_0x0ba5('0x3e')){var _0x395cf6={};_0x395cf6[_0x472b85[_0x0ba5('0x26')]]={'$like':'%'+_0x6bcf08['query'][_0x0ba5('0x3c')]+'%'};return _0x395cf6;}})});}_0x182d6e=_[_0x0ba5('0x3d')]({},_0x182d6e,_0x6bcf08[_0x0ba5('0x3f')]);var _0x2f13d8={'where':_0x182d6e[_0x0ba5('0x39')]};return db[_0x0ba5('0x29')][_0x0ba5('0x1c')](_0x2f13d8)[_0x0ba5('0x23')](function(_0x3de593){_0x3fc943[_0x0ba5('0x1c')]=_0x3de593;if(_0x6bcf08['query']['includeAll']){_0x182d6e[_0x0ba5('0x40')]=[{'all':!![]}];}return db[_0x0ba5('0x29')][_0x0ba5('0x41')](_0x182d6e);})['then'](function(_0x1e7d5d){_0x3fc943[_0x0ba5('0x42')]=_0x1e7d5d;return _0x3fc943;})['then'](respondWithFilteredResult(_0x48b6a1,_0x182d6e))[_0x0ba5('0x43')](handleError(_0x48b6a1,null));};exports[_0x0ba5('0x44')]=function(_0x387a9d,_0x37f291){var _0xc04fcc={'raw':![],'where':{'id':_0x387a9d[_0x0ba5('0x45')]['id']}},_0x47520c={};_0x47520c[_0x0ba5('0x2e')]=_[_0x0ba5('0x31')](db[_0x0ba5('0x29')][_0x0ba5('0x2a')]);_0x47520c[_0x0ba5('0x30')]=_['keys'](_0x387a9d['query']);_0x47520c[_0x0ba5('0x3b')]=_[_0x0ba5('0x32')](_0x47520c[_0x0ba5('0x2e')],_0x47520c[_0x0ba5('0x30')]);_0xc04fcc[_0x0ba5('0x33')]=_[_0x0ba5('0x32')](_0x47520c[_0x0ba5('0x2e')],qs['fields'](_0x387a9d[_0x0ba5('0x30')][_0x0ba5('0x34')]));_0xc04fcc[_0x0ba5('0x33')]=_0xc04fcc[_0x0ba5('0x33')][_0x0ba5('0x35')]?_0xc04fcc[_0x0ba5('0x33')]:_0x47520c[_0x0ba5('0x2e')];if(_0x387a9d['query']['includeAll']){_0xc04fcc['include']=[{'all':!![]}];}_0xc04fcc=_['merge']({},_0xc04fcc,_0x387a9d[_0x0ba5('0x3f')]);return db['SugarcrmAccount']['find'](_0xc04fcc)[_0x0ba5('0x23')](handleEntityNotFound(_0x37f291,null))[_0x0ba5('0x23')](respondWithResult(_0x37f291,null))[_0x0ba5('0x43')](handleError(_0x37f291,null));};exports[_0x0ba5('0x46')]=function(_0x490223,_0xdc2257){return db[_0x0ba5('0x29')][_0x0ba5('0x46')](_0x490223[_0x0ba5('0x47')],{})[_0x0ba5('0x23')](respondWithResult(_0xdc2257,0xc9))[_0x0ba5('0x43')](handleError(_0xdc2257,null));};exports[_0x0ba5('0x22')]=function(_0x34ace7,_0x2fa196){if(_0x34ace7[_0x0ba5('0x47')]['id']){delete _0x34ace7[_0x0ba5('0x47')]['id'];}return db[_0x0ba5('0x29')][_0x0ba5('0x48')]({'where':{'id':_0x34ace7['params']['id']}})[_0x0ba5('0x23')](handleEntityNotFound(_0x2fa196,null))[_0x0ba5('0x23')](saveUpdates(_0x34ace7['body'],null))['then'](respondWithResult(_0x2fa196,null))[_0x0ba5('0x43')](handleError(_0x2fa196,null));};exports['destroy']=function(_0x42f176,_0x463973){return db[_0x0ba5('0x29')]['find']({'where':{'id':_0x42f176[_0x0ba5('0x45')]['id']}})[_0x0ba5('0x23')](handleEntityNotFound(_0x463973,null))['then'](removeEntity(_0x463973,null))[_0x0ba5('0x43')](handleError(_0x463973,null));};exports[_0x0ba5('0x49')]=function(_0x37aa56,_0x511113,_0x25bab1){var _0x48519a={};var _0x582c56={};var _0x35d49c;var _0x136d3e;return db[_0x0ba5('0x29')]['findOne']({'where':{'id':_0x37aa56[_0x0ba5('0x45')]['id']}})[_0x0ba5('0x23')](handleEntityNotFound(_0x511113,null))[_0x0ba5('0x23')](function(_0x46e3a5){if(_0x46e3a5){_0x35d49c=_0x46e3a5;_0x582c56[_0x0ba5('0x2e')]=_[_0x0ba5('0x31')](db[_0x0ba5('0x4a')]['rawAttributes']);_0x582c56[_0x0ba5('0x30')]=_[_0x0ba5('0x31')](_0x37aa56['query']);_0x582c56[_0x0ba5('0x3b')]=_[_0x0ba5('0x32')](_0x582c56[_0x0ba5('0x2e')],_0x582c56[_0x0ba5('0x30')]);_0x48519a[_0x0ba5('0x33')]=_['intersection'](_0x582c56[_0x0ba5('0x2e')],qs[_0x0ba5('0x34')](_0x37aa56[_0x0ba5('0x30')][_0x0ba5('0x34')]));_0x48519a['attributes']=_0x48519a[_0x0ba5('0x33')][_0x0ba5('0x35')]?_0x48519a[_0x0ba5('0x33')]:_0x582c56[_0x0ba5('0x2e')];_0x48519a['order']=qs[_0x0ba5('0x38')](_0x37aa56[_0x0ba5('0x30')][_0x0ba5('0x38')]);_0x48519a[_0x0ba5('0x39')]=qs['filters'](_[_0x0ba5('0x3a')](_0x37aa56['query'],_0x582c56[_0x0ba5('0x3b')]));if(_0x37aa56['query'][_0x0ba5('0x3c')]){_0x48519a[_0x0ba5('0x39')]=_[_0x0ba5('0x3d')](_0x48519a['where'],{'$or':_[_0x0ba5('0x2f')](_0x48519a[_0x0ba5('0x33')],function(_0x18165d){var _0x384b26={};_0x384b26[_0x18165d]={'$like':'%'+_0x37aa56[_0x0ba5('0x30')][_0x0ba5('0x3c')]+'%'};return _0x384b26;})});}_0x48519a=_[_0x0ba5('0x3d')]({},_0x48519a,_0x37aa56['options']);return _0x35d49c[_0x0ba5('0x49')](_0x48519a);}})[_0x0ba5('0x23')](function(_0xf2caaf){if(_0xf2caaf){_0x136d3e=_0xf2caaf['length'];if(!_0x37aa56[_0x0ba5('0x30')][_0x0ba5('0x4b')]('nolimit')){_0x48519a[_0x0ba5('0x1b')]=qs['limit'](_0x37aa56[_0x0ba5('0x30')][_0x0ba5('0x1b')]);_0x48519a['offset']=qs[_0x0ba5('0x1d')](_0x37aa56[_0x0ba5('0x30')]['offset']);}return _0x35d49c[_0x0ba5('0x49')](_0x48519a);}})['then'](function(_0x397180){if(_0x397180){return _0x397180?{'count':_0x136d3e,'rows':_0x397180}:null;}})[_0x0ba5('0x23')](respondWithResult(_0x511113,null))[_0x0ba5('0x43')](handleError(_0x511113,null));};exports['addConfiguration']=function(_0x3231d4,_0x55d464,_0x4d61ad){if(_0x3231d4['body']['id']){delete _0x3231d4[_0x0ba5('0x47')]['id'];}return db['SugarcrmAccount'][_0x0ba5('0x4c')]({'where':{'id':_0x3231d4['params']['id']}})['then'](handleEntityNotFound(_0x55d464,null))[_0x0ba5('0x23')](function(_0x11506c){if(_0x11506c){_0x3231d4['body'][_0x0ba5('0x4d')]=_0x11506c['id'];_0x3231d4[_0x0ba5('0x47')][_0x0ba5('0x4e')]=integrations['getSubjects'](_0x3231d4['body'][_0x0ba5('0x4f')],_0x3231d4['body'][_0x0ba5('0x2c')]);_0x3231d4['body']['Descriptions']=integrations[_0x0ba5('0x50')](_0x3231d4['body']['channel'],_0x3231d4[_0x0ba5('0x47')][_0x0ba5('0x2c')]);return db['SugarcrmConfiguration'][_0x0ba5('0x46')](_0x3231d4[_0x0ba5('0x47')],{'include':[{'model':db[_0x0ba5('0x51')],'as':'Subjects'},{'model':db[_0x0ba5('0x51')],'as':_0x0ba5('0x52')}]});}return null;})[_0x0ba5('0x23')](respondWithResult(_0x55d464,null))['catch'](handleError(_0x55d464,null));};exports[_0x0ba5('0x53')]=function(_0x38db3c,_0x276e2e,_0x1e48ea){var _0x3c797c='';var _0x2d1b39=['id',_0x0ba5('0x26'),_0x0ba5('0x54'),_0x0ba5('0x55'),_0x0ba5('0x56'),_0x0ba5('0x57'),_0x0ba5('0x58'),_0x0ba5('0x59'),_0x0ba5('0x5a'),_0x0ba5('0x5b'),_0x0ba5('0x5c'),_0x0ba5('0x5d')];return db[_0x0ba5('0x29')]['findOne']({'where':{'id':_0x38db3c[_0x0ba5('0x45')]['id']},'attributes':['id',_0x0ba5('0x5e'),_0x0ba5('0x5f'),'remoteUri']})['then'](handleEntityNotFound(_0x276e2e,null))[_0x0ba5('0x23')](function(_0x2bf3e2){if(_0x2bf3e2){_0x3c797c=_0x2bf3e2[_0x0ba5('0x60')];var _0x552423=_0x3c797c[_0x0ba5('0x61')](-0x1);if(_0x552423==='/'){_0x3c797c=_0x3c797c['substring'](0x0,_0x3c797c[_0x0ba5('0x62')](_0x552423));}return rp({'method':_0x0ba5('0x63'),'uri':util['format'](_0x0ba5('0x64'),_0x3c797c,_0x0ba5('0x65')),'json':!![],'form':{'method':_0x0ba5('0x66'),'input_type':_0x0ba5('0x67'),'response_type':_0x0ba5('0x67'),'rest_data':JSON[_0x0ba5('0x68')]({'user_auth':{'user_name':_0x2bf3e2[_0x0ba5('0x5e')],'password':_0x2bf3e2[_0x0ba5('0x5f')],'encryption':_0x0ba5('0x69')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x0ba5('0x23')](function(_0x581e97){if(_0x581e97&&_0x581e97[_0x0ba5('0x26')]!==_0x0ba5('0x6a')&&_0x581e97[_0x0ba5('0x26')]!=='Password\x20Expired'){return rp({'method':_0x0ba5('0x63'),'uri':util[_0x0ba5('0x6b')]('%s%s',_0x3c797c,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x0ba5('0x6c'),'input_type':_0x0ba5('0x67'),'response_type':_0x0ba5('0x67'),'rest_data':JSON[_0x0ba5('0x68')]({'session':_0x581e97['id'],'module_name':'Calls'})}})[_0x0ba5('0x23')](function(_0x1d53ec){if(_0x1d53ec){var _0xcc1049=_[_0x0ba5('0x6d')](_0x1d53ec[_0x0ba5('0x6e')]);_[_0x0ba5('0x6f')](_0xcc1049,function(_0x3e8082){return _0x2d1b39['includes'](_0x3e8082[_0x0ba5('0x26')]);});return{'count':_0xcc1049[_0x0ba5('0x35')],'rows':_[_0x0ba5('0x2f')](_0xcc1049,function(_0x340fe2){return{'id':_0x340fe2['name'],'name':_0x340fe2[_0x0ba5('0x70')],'custom':_[_0x0ba5('0x71')](_0x340fe2['name'],'_c')?!![]:![],'options':_0x340fe2['options']?_[_0x0ba5('0x2f')](_['values'](_0x340fe2[_0x0ba5('0x3f')]),function(_0xe5cbbe){return{'name':_0xe5cbbe['value'],'value':_0xe5cbbe[_0x0ba5('0x26')]};}):[]};})};}})[_0x0ba5('0x23')](respondWithResult(_0x276e2e,null))[_0x0ba5('0x43')](function(_0x5636f6){var _0xdcad36=_0x38db3c[_0x0ba5('0x30')][_0x0ba5('0x72')]?0x1f4:_0x5636f6[_0x0ba5('0x73')]||0x1f4;logger['error'](_0x0ba5('0x74'),_0x0ba5('0x53'),_0xdcad36,JSON[_0x0ba5('0x68')](_0x5636f6));delete _0x5636f6['name'];if(_0xdcad36===0x191){_0xdcad36=0x190;}_0x276e2e['status'](_0xdcad36)[_0x0ba5('0x27')](_0x38db3c[_0x0ba5('0x30')][_0x0ba5('0x72')]?{'message':_0x0ba5('0x75'),'statusCode':_0x5636f6[_0x0ba5('0x73')]}:_0x5636f6);});}else{var _0x3d9d01=0x1f4;_0x276e2e[_0x0ba5('0x18')](_0x3d9d01)[_0x0ba5('0x27')]({'message':_0x0ba5('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xeccd=['../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','json','apply','reject','save','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','order','sort','where','filters','pick','filter','merge','options','includeAll','SugarcrmAccount','findAll','catch','length','include','create','body','update','find','params','destroy','getConfigurations','SugarcrmConfiguration','hasOwnProperty','nolimit','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','assigned_user_id','created_by','description','date_start','parent_id','parent_name','username','password','remoteUri','slice','substring','POST','format','%s%s','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','module_fields','remove','includes','endsWith','values','value','test','statusCode','error','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x33ea36,_0xa032ac){var _0x1c2498=function(_0x37ed3d){while(--_0x37ed3d){_0x33ea36['push'](_0x33ea36['shift']());}};_0x1c2498(++_0xa032ac);}(_0xeccd,0x1b2));var _0xdecc=function(_0x23190a,_0x3c1385){_0x23190a=_0x23190a-0x0;var _0x1e8dd0=_0xeccd[_0x23190a];return _0x1e8dd0;};'use strict';var emlformat=require(_0xdecc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdecc('0x1'));var jsonpatch=require(_0xdecc('0x2'));var rp=require(_0xdecc('0x3'));var moment=require(_0xdecc('0x4'));var BPromise=require(_0xdecc('0x5'));var Mustache=require(_0xdecc('0x6'));var util=require('util');var path=require('path');var sox=require(_0xdecc('0x7'));var csv=require(_0xdecc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdecc('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdecc('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdecc('0x8'));var querystring=require('querystring');var Papa=require(_0xdecc('0xb'));var Redis=require(_0xdecc('0xc'));var authService=require(_0xdecc('0xd'));var qs=require(_0xdecc('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdecc('0xf'));var logger=require(_0xdecc('0x10'))(_0xdecc('0x11'));var utils=require(_0xdecc('0x12'));var config=require(_0xdecc('0x13'));var licenseUtil=require(_0xdecc('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xdecc('0x15'));function respondWithStatusCode(_0x5090d0,_0x20bf15){_0x20bf15=_0x20bf15||0xcc;return function(_0x352d90){if(_0x352d90){return _0x5090d0[_0xdecc('0x16')](_0x20bf15);}return _0x5090d0[_0xdecc('0x17')](_0x20bf15)[_0xdecc('0x18')]();};}function respondWithResult(_0xcc5b7f,_0x15e673){_0x15e673=_0x15e673||0xc8;return function(_0x3d5532){if(_0x3d5532){return _0xcc5b7f[_0xdecc('0x17')](_0x15e673)['json'](_0x3d5532);}};}function respondWithFilteredResult(_0x3184e8,_0x535680){return function(_0x2c5220){if(_0x2c5220){var _0x1dcd6a=typeof _0x535680[_0xdecc('0x19')]===_0xdecc('0x1a')&&typeof _0x535680['limit']==='undefined';var _0x24dde9=_0x2c5220[_0xdecc('0x1b')];var _0x4ac16d=_0x1dcd6a?0x0:_0x535680[_0xdecc('0x19')];var _0x3ccf96=_0x1dcd6a?_0x2c5220['count']:_0x535680[_0xdecc('0x19')]+_0x535680[_0xdecc('0x1c')];var _0x400bf3;if(_0x3ccf96>=_0x24dde9){_0x3ccf96=_0x24dde9;_0x400bf3=0xc8;}else{_0x400bf3=0xce;}_0x3184e8['status'](_0x400bf3);return _0x3184e8['set']('Content-Range',_0x4ac16d+'-'+_0x3ccf96+'/'+_0x24dde9)[_0xdecc('0x1d')](_0x2c5220);}return null;};}function patchUpdates(_0x110c32){return function(_0x180579){try{jsonpatch[_0xdecc('0x1e')](_0x180579,_0x110c32,!![]);}catch(_0x100b3e){return BPromise[_0xdecc('0x1f')](_0x100b3e);}return _0x180579[_0xdecc('0x20')]();};}function saveUpdates(_0x330984,_0x34acf0){return function(_0x2768ce){if(_0x2768ce){return _0x2768ce['update'](_0x330984)['then'](function(_0x1a3002){return _0x1a3002;});}return null;};}function removeEntity(_0x4544af,_0x5a9aac){return function(_0x3b766e){if(_0x3b766e){return _0x3b766e['destroy']()[_0xdecc('0x21')](function(){_0x4544af[_0xdecc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c0b7,_0x14c059){return function(_0x1a1ba3){if(!_0x1a1ba3){_0x31c0b7[_0xdecc('0x16')](0x194);}return _0x1a1ba3;};}function handleError(_0x39d96c,_0x494e3a){_0x494e3a=_0x494e3a||0x1f4;return function(_0xe6df3a){logger['error'](_0xe6df3a[_0xdecc('0x22')]);if(_0xe6df3a[_0xdecc('0x23')]){delete _0xe6df3a[_0xdecc('0x23')];}_0x39d96c[_0xdecc('0x17')](_0x494e3a)[_0xdecc('0x24')](_0xe6df3a);};}exports[_0xdecc('0x25')]=function(_0x5e401e,_0x5b8628){var _0x472a5c={},_0x11e04a={},_0x2e23b8={'count':0x0,'rows':[]};var _0xbb91ac=_[_0xdecc('0x26')](db['SugarcrmAccount'][_0xdecc('0x27')],function(_0x2ecf24){return{'name':_0x2ecf24[_0xdecc('0x28')],'type':_0x2ecf24[_0xdecc('0x29')][_0xdecc('0x2a')]};});_0x11e04a[_0xdecc('0x2b')]=_[_0xdecc('0x26')](_0xbb91ac,'name');_0x11e04a['query']=_[_0xdecc('0x2c')](_0x5e401e['query']);_0x11e04a['filters']=_[_0xdecc('0x2d')](_0x11e04a[_0xdecc('0x2b')],_0x11e04a[_0xdecc('0x2e')]);_0x472a5c[_0xdecc('0x2f')]=_['intersection'](_0x11e04a[_0xdecc('0x2b')],qs[_0xdecc('0x30')](_0x5e401e[_0xdecc('0x2e')][_0xdecc('0x30')]));_0x472a5c['attributes']=_0x472a5c[_0xdecc('0x2f')]['length']?_0x472a5c[_0xdecc('0x2f')]:_0x11e04a[_0xdecc('0x2b')];if(!_0x5e401e[_0xdecc('0x2e')]['hasOwnProperty']('nolimit')){_0x472a5c[_0xdecc('0x1c')]=qs[_0xdecc('0x1c')](_0x5e401e['query'][_0xdecc('0x1c')]);_0x472a5c[_0xdecc('0x19')]=qs[_0xdecc('0x19')](_0x5e401e[_0xdecc('0x2e')]['offset']);}_0x472a5c[_0xdecc('0x31')]=qs[_0xdecc('0x32')](_0x5e401e[_0xdecc('0x2e')][_0xdecc('0x32')]);_0x472a5c[_0xdecc('0x33')]=qs[_0xdecc('0x34')](_[_0xdecc('0x35')](_0x5e401e[_0xdecc('0x2e')],_0x11e04a['filters']),_0xbb91ac);if(_0x5e401e[_0xdecc('0x2e')][_0xdecc('0x36')]){_0x472a5c[_0xdecc('0x33')]=_[_0xdecc('0x37')](_0x472a5c[_0xdecc('0x33')],{'$or':_[_0xdecc('0x26')](_0xbb91ac,function(_0x5cf73b){if(_0x5cf73b[_0xdecc('0x29')]!=='VIRTUAL'){var _0x594c2a={};_0x594c2a[_0x5cf73b[_0xdecc('0x23')]]={'$like':'%'+_0x5e401e[_0xdecc('0x2e')][_0xdecc('0x36')]+'%'};return _0x594c2a;}})});}_0x472a5c=_['merge']({},_0x472a5c,_0x5e401e[_0xdecc('0x38')]);var _0x3ed199={'where':_0x472a5c[_0xdecc('0x33')]};return db['SugarcrmAccount'][_0xdecc('0x1b')](_0x3ed199)[_0xdecc('0x21')](function(_0x370465){_0x2e23b8[_0xdecc('0x1b')]=_0x370465;if(_0x5e401e['query'][_0xdecc('0x39')]){_0x472a5c['include']=[{'all':!![]}];}return db[_0xdecc('0x3a')][_0xdecc('0x3b')](_0x472a5c);})[_0xdecc('0x21')](function(_0x150e2d){_0x2e23b8['rows']=_0x150e2d;return _0x2e23b8;})[_0xdecc('0x21')](respondWithFilteredResult(_0x5b8628,_0x472a5c))[_0xdecc('0x3c')](handleError(_0x5b8628,null));};exports['show']=function(_0x235bc6,_0x1b8a57){var _0x2cfd81={'raw':![],'where':{'id':_0x235bc6['params']['id']}},_0x3ede23={};_0x3ede23[_0xdecc('0x2b')]=_[_0xdecc('0x2c')](db[_0xdecc('0x3a')][_0xdecc('0x27')]);_0x3ede23[_0xdecc('0x2e')]=_[_0xdecc('0x2c')](_0x235bc6[_0xdecc('0x2e')]);_0x3ede23[_0xdecc('0x34')]=_[_0xdecc('0x2d')](_0x3ede23['model'],_0x3ede23[_0xdecc('0x2e')]);_0x2cfd81[_0xdecc('0x2f')]=_[_0xdecc('0x2d')](_0x3ede23[_0xdecc('0x2b')],qs[_0xdecc('0x30')](_0x235bc6[_0xdecc('0x2e')][_0xdecc('0x30')]));_0x2cfd81[_0xdecc('0x2f')]=_0x2cfd81[_0xdecc('0x2f')][_0xdecc('0x3d')]?_0x2cfd81['attributes']:_0x3ede23[_0xdecc('0x2b')];if(_0x235bc6[_0xdecc('0x2e')][_0xdecc('0x39')]){_0x2cfd81[_0xdecc('0x3e')]=[{'all':!![]}];}_0x2cfd81=_['merge']({},_0x2cfd81,_0x235bc6[_0xdecc('0x38')]);return db[_0xdecc('0x3a')]['find'](_0x2cfd81)['then'](handleEntityNotFound(_0x1b8a57,null))[_0xdecc('0x21')](respondWithResult(_0x1b8a57,null))[_0xdecc('0x3c')](handleError(_0x1b8a57,null));};exports[_0xdecc('0x3f')]=function(_0xd2ee50,_0x565310){return db[_0xdecc('0x3a')]['create'](_0xd2ee50[_0xdecc('0x40')],{})['then'](respondWithResult(_0x565310,0xc9))[_0xdecc('0x3c')](handleError(_0x565310,null));};exports[_0xdecc('0x41')]=function(_0x15cd50,_0x474deb){if(_0x15cd50['body']['id']){delete _0x15cd50[_0xdecc('0x40')]['id'];}return db['SugarcrmAccount'][_0xdecc('0x42')]({'where':{'id':_0x15cd50[_0xdecc('0x43')]['id']}})[_0xdecc('0x21')](handleEntityNotFound(_0x474deb,null))[_0xdecc('0x21')](saveUpdates(_0x15cd50[_0xdecc('0x40')],null))['then'](respondWithResult(_0x474deb,null))[_0xdecc('0x3c')](handleError(_0x474deb,null));};exports[_0xdecc('0x44')]=function(_0x3a0fdc,_0x126ce9){return db[_0xdecc('0x3a')][_0xdecc('0x42')]({'where':{'id':_0x3a0fdc[_0xdecc('0x43')]['id']}})['then'](handleEntityNotFound(_0x126ce9,null))[_0xdecc('0x21')](removeEntity(_0x126ce9,null))[_0xdecc('0x3c')](handleError(_0x126ce9,null));};exports[_0xdecc('0x45')]=function(_0x3d6c57,_0x3300d3,_0x33557c){var _0x32c885={};var _0x274e99={};var _0x3bb94b;var _0x3f4e49;return db['SugarcrmAccount']['findOne']({'where':{'id':_0x3d6c57[_0xdecc('0x43')]['id']}})['then'](handleEntityNotFound(_0x3300d3,null))['then'](function(_0x3cb5d0){if(_0x3cb5d0){_0x3bb94b=_0x3cb5d0;_0x274e99[_0xdecc('0x2b')]=_[_0xdecc('0x2c')](db[_0xdecc('0x46')]['rawAttributes']);_0x274e99[_0xdecc('0x2e')]=_['keys'](_0x3d6c57[_0xdecc('0x2e')]);_0x274e99['filters']=_['intersection'](_0x274e99[_0xdecc('0x2b')],_0x274e99['query']);_0x32c885[_0xdecc('0x2f')]=_[_0xdecc('0x2d')](_0x274e99[_0xdecc('0x2b')],qs['fields'](_0x3d6c57[_0xdecc('0x2e')]['fields']));_0x32c885['attributes']=_0x32c885['attributes'][_0xdecc('0x3d')]?_0x32c885[_0xdecc('0x2f')]:_0x274e99[_0xdecc('0x2b')];_0x32c885[_0xdecc('0x31')]=qs['sort'](_0x3d6c57[_0xdecc('0x2e')]['sort']);_0x32c885[_0xdecc('0x33')]=qs['filters'](_['pick'](_0x3d6c57['query'],_0x274e99[_0xdecc('0x34')]));if(_0x3d6c57['query']['filter']){_0x32c885[_0xdecc('0x33')]=_[_0xdecc('0x37')](_0x32c885[_0xdecc('0x33')],{'$or':_[_0xdecc('0x26')](_0x32c885[_0xdecc('0x2f')],function(_0x489dae){var _0x210adf={};_0x210adf[_0x489dae]={'$like':'%'+_0x3d6c57['query'][_0xdecc('0x36')]+'%'};return _0x210adf;})});}_0x32c885=_[_0xdecc('0x37')]({},_0x32c885,_0x3d6c57['options']);return _0x3bb94b[_0xdecc('0x45')](_0x32c885);}})[_0xdecc('0x21')](function(_0x46daa0){if(_0x46daa0){_0x3f4e49=_0x46daa0['length'];if(!_0x3d6c57[_0xdecc('0x2e')][_0xdecc('0x47')](_0xdecc('0x48'))){_0x32c885[_0xdecc('0x1c')]=qs[_0xdecc('0x1c')](_0x3d6c57[_0xdecc('0x2e')][_0xdecc('0x1c')]);_0x32c885[_0xdecc('0x19')]=qs[_0xdecc('0x19')](_0x3d6c57[_0xdecc('0x2e')][_0xdecc('0x19')]);}return _0x3bb94b[_0xdecc('0x45')](_0x32c885);}})['then'](function(_0x1bd83b){if(_0x1bd83b){return _0x1bd83b?{'count':_0x3f4e49,'rows':_0x1bd83b}:null;}})['then'](respondWithResult(_0x3300d3,null))[_0xdecc('0x3c')](handleError(_0x3300d3,null));};exports['addConfiguration']=function(_0x20f09a,_0x1dced7,_0x3ea1ca){if(_0x20f09a['body']['id']){delete _0x20f09a[_0xdecc('0x40')]['id'];}return db[_0xdecc('0x3a')][_0xdecc('0x49')]({'where':{'id':_0x20f09a['params']['id']}})['then'](handleEntityNotFound(_0x1dced7,null))[_0xdecc('0x21')](function(_0x4bcdf1){if(_0x4bcdf1){_0x20f09a[_0xdecc('0x40')][_0xdecc('0x4a')]=_0x4bcdf1['id'];_0x20f09a['body'][_0xdecc('0x4b')]=integrations[_0xdecc('0x4c')](_0x20f09a[_0xdecc('0x40')][_0xdecc('0x4d')],_0x20f09a[_0xdecc('0x40')][_0xdecc('0x29')]);_0x20f09a[_0xdecc('0x40')][_0xdecc('0x4e')]=integrations[_0xdecc('0x4f')](_0x20f09a[_0xdecc('0x40')]['channel'],_0x20f09a['body']['type']);return db[_0xdecc('0x46')]['create'](_0x20f09a[_0xdecc('0x40')],{'include':[{'model':db['SugarcrmField'],'as':_0xdecc('0x4b')},{'model':db['SugarcrmField'],'as':_0xdecc('0x4e')}]});}return null;})['then'](respondWithResult(_0x1dced7,null))['catch'](handleError(_0x1dced7,null));};exports[_0xdecc('0x50')]=function(_0x247b12,_0x52a1b4,_0x30b536){var _0x27670a='';var _0x1ac778=['id',_0xdecc('0x23'),_0xdecc('0x51'),_0xdecc('0x52'),_0xdecc('0x53'),_0xdecc('0x54'),'duration_hours','duration_minutes',_0xdecc('0x55'),'parent_type',_0xdecc('0x56'),'direction'];return db[_0xdecc('0x3a')][_0xdecc('0x49')]({'where':{'id':_0x247b12['params']['id']},'attributes':['id',_0xdecc('0x57'),_0xdecc('0x58'),_0xdecc('0x59')]})['then'](handleEntityNotFound(_0x52a1b4,null))[_0xdecc('0x21')](function(_0x553385){if(_0x553385){_0x27670a=_0x553385[_0xdecc('0x59')];var _0x2e3286=_0x27670a[_0xdecc('0x5a')](-0x1);if(_0x2e3286==='/'){_0x27670a=_0x27670a[_0xdecc('0x5b')](0x0,_0x27670a['lastIndexOf'](_0x2e3286));}return rp({'method':_0xdecc('0x5c'),'uri':util[_0xdecc('0x5d')](_0xdecc('0x5e'),_0x27670a,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xdecc('0x5f'),'rest_data':JSON[_0xdecc('0x60')]({'user_auth':{'user_name':_0x553385['username'],'password':_0x553385[_0xdecc('0x58')],'encryption':_0xdecc('0x61')},'application':_0xdecc('0x62')})}});}})[_0xdecc('0x21')](function(_0x134290){if(_0x134290&&_0x134290[_0xdecc('0x23')]!=='Invalid\x20Login'&&_0x134290[_0xdecc('0x23')]!==_0xdecc('0x63')){return rp({'method':'POST','uri':util[_0xdecc('0x5d')]('%s%s',_0x27670a,_0xdecc('0x64')),'json':!![],'form':{'method':_0xdecc('0x65'),'input_type':'JSON','response_type':_0xdecc('0x5f'),'rest_data':JSON[_0xdecc('0x60')]({'session':_0x134290['id'],'module_name':_0xdecc('0x66')})}})[_0xdecc('0x21')](function(_0x5068fd){if(_0x5068fd){var _0x21b039=_['values'](_0x5068fd[_0xdecc('0x67')]);_[_0xdecc('0x68')](_0x21b039,function(_0x3a704f){return _0x1ac778[_0xdecc('0x69')](_0x3a704f[_0xdecc('0x23')]);});return{'count':_0x21b039[_0xdecc('0x3d')],'rows':_[_0xdecc('0x26')](_0x21b039,function(_0x2c8c9b){return{'id':_0x2c8c9b[_0xdecc('0x23')],'name':_0x2c8c9b['label'],'custom':_[_0xdecc('0x6a')](_0x2c8c9b['name'],'_c')?!![]:![],'options':_0x2c8c9b['options']?_[_0xdecc('0x26')](_[_0xdecc('0x6b')](_0x2c8c9b[_0xdecc('0x38')]),function(_0xb885d9){return{'name':_0xb885d9[_0xdecc('0x6c')],'value':_0xb885d9['name']};}):[]};})};}})[_0xdecc('0x21')](respondWithResult(_0x52a1b4,null))['catch'](function(_0x1207a0){var _0x1f1d9f=_0x247b12[_0xdecc('0x2e')][_0xdecc('0x6d')]?0x1f4:_0x1207a0[_0xdecc('0x6e')]||0x1f4;logger[_0xdecc('0x6f')]('getFields,\x20%s,\x20%s,\x20%s',_0xdecc('0x50'),_0x1f1d9f,JSON[_0xdecc('0x60')](_0x1207a0));delete _0x1207a0[_0xdecc('0x23')];if(_0x1f1d9f===0x191){_0x1f1d9f=0x190;}_0x52a1b4[_0xdecc('0x17')](_0x1f1d9f)[_0xdecc('0x24')](_0x247b12[_0xdecc('0x2e')][_0xdecc('0x6d')]?{'message':'Wrong\x20credentials','statusCode':_0x1207a0[_0xdecc('0x6e')]}:_0x1207a0);});}else{var _0x10a70d=0x1f4;_0x52a1b4['status'](_0x10a70d)[_0xdecc('0x24')]({'message':_0xdecc('0x70'),'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 0521986..f8a485f 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 _0x29e9=['path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','int_sugarcrm_accounts','api','request-promise'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x29e9,0xbe));var _0x929e=function(_0x58a69f,_0x2b1abc){_0x58a69f=_0x58a69f-0x0;var _0x55a74c=_0x29e9[_0x58a69f];return _0x55a74c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x929e('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x929e('0x1'));var fs=require('fs');var path=require(_0x929e('0x2'));var rimraf=require(_0x929e('0x3'));var config=require(_0x929e('0x4'));var attributes=require(_0x929e('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x1454e1,_0x4bd8bb){return _0x1454e1[_0x929e('0x6')]('SugarcrmAccount',attributes,{'tableName':_0x929e('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6918=['../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x4cd3db,_0x28e2a0){var _0x20135a=function(_0x27cdca){while(--_0x27cdca){_0x4cd3db['push'](_0x4cd3db['shift']());}};_0x20135a(++_0x28e2a0);}(_0x6918,0xc8));var _0x8691=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6918[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x8691('0x0'));var logger=require(_0x8691('0x1'))(_0x8691('0x2'));var moment=require(_0x8691('0x3'));var BPromise=require(_0x8691('0x4'));var rp=require(_0x8691('0x5'));var fs=require('fs');var path=require(_0x8691('0x6'));var rimraf=require(_0x8691('0x7'));var config=require(_0x8691('0x8'));var attributes=require(_0x8691('0x9'));var integrations=require(_0x8691('0xa'));module['exports']=function(_0x4a5f14,_0xa2579){return _0x4a5f14[_0x8691('0xb')](_0x8691('0xc'),attributes,{'tableName':_0x8691('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 8b247c0..6689d50 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 _0x5a89=['debug','ShowSugarcrmAccount','find','util','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','attributes','include','map','model'];(function(_0x1ee963,_0x49e2ca){var _0x4037b6=function(_0x59662e){while(--_0x59662e){_0x1ee963['push'](_0x1ee963['shift']());}};_0x4037b6(++_0x49e2ca);}(_0x5a89,0xa3));var _0x95a8=function(_0x975d73,_0x58abf7){_0x975d73=_0x975d73-0x0;var _0x400bcb=_0x5a89[_0x975d73];return _0x400bcb;};'use strict';var _=require('lodash');var util=require(_0x95a8('0x0'));var moment=require('moment');var BPromise=require(_0x95a8('0x1'));var rs=require(_0x95a8('0x2'));var fs=require('fs');var Redis=require(_0x95a8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x95a8('0x4'));var jayson=require(_0x95a8('0x5'));var client=jayson[_0x95a8('0x6')][_0x95a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5ade72,_0x2857d3,_0x27584f){return new BPromise(function(_0x510951,_0x2f375a){return client[_0x95a8('0x8')](_0x5ade72,_0x27584f)[_0x95a8('0x9')](function(_0x4480c5){logger[_0x95a8('0xa')](_0x95a8('0xb'),_0x2857d3,_0x95a8('0xc'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x2857d3,_0x95a8('0xc'),JSON[_0x95a8('0xd')](_0x4480c5));if(_0x4480c5[_0x95a8('0xe')]){if(_0x4480c5[_0x95a8('0xe')][_0x95a8('0xf')]===0x1f4){logger[_0x95a8('0xe')](_0x95a8('0xb'),_0x2857d3,_0x4480c5[_0x95a8('0xe')][_0x95a8('0x10')]);return _0x2f375a(_0x4480c5[_0x95a8('0xe')]['message']);}logger[_0x95a8('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0x2857d3,_0x4480c5[_0x95a8('0xe')][_0x95a8('0x10')]);return _0x510951(_0x4480c5['error'][_0x95a8('0x10')]);}else{logger[_0x95a8('0xa')](_0x95a8('0xb'),_0x2857d3,'request\x20sent');_0x510951(_0x4480c5[_0x95a8('0x11')][_0x95a8('0x10')]);}})[_0x95a8('0x12')](function(_0x4b27ee){logger[_0x95a8('0xe')](_0x95a8('0xb'),_0x2857d3,_0x4b27ee);_0x2f375a(_0x4b27ee);});});}exports[_0x95a8('0x13')]=function(_0x17e66f){var _0x5192c7=this;return new Promise(function(_0x23b676,_0x91ba0c){return db[_0x95a8('0x14')][_0x95a8('0x15')]({'raw':_0x17e66f[_0x95a8('0x16')]?_0x17e66f[_0x95a8('0x16')][_0x95a8('0x17')]===undefined?!![]:![]:!![],'where':_0x17e66f['options']?_0x17e66f[_0x95a8('0x16')][_0x95a8('0x18')]||null:null,'attributes':_0x17e66f['options']?_0x17e66f[_0x95a8('0x16')][_0x95a8('0x19')]||null:null,'limit':_0x17e66f[_0x95a8('0x16')]?_0x17e66f[_0x95a8('0x16')]['limit']||null:null,'include':_0x17e66f[_0x95a8('0x16')]?_0x17e66f[_0x95a8('0x16')][_0x95a8('0x1a')]?_[_0x95a8('0x1b')](_0x17e66f[_0x95a8('0x16')][_0x95a8('0x1a')],function(_0x5c3ca6){return{'model':db[_0x5c3ca6['model']],'as':_0x5c3ca6['as'],'attributes':_0x5c3ca6[_0x95a8('0x19')],'include':_0x5c3ca6[_0x95a8('0x1a')]?_[_0x95a8('0x1b')](_0x5c3ca6[_0x95a8('0x1a')],function(_0x2c480b){return{'model':db[_0x2c480b[_0x95a8('0x1c')]],'as':_0x2c480b['as'],'attributes':_0x2c480b[_0x95a8('0x19')],'include':_0x2c480b[_0x95a8('0x1a')]?_[_0x95a8('0x1b')](_0x2c480b[_0x95a8('0x1a')],function(_0x261881){return{'model':db[_0x261881[_0x95a8('0x1c')]],'as':_0x261881['as'],'attributes':_0x261881[_0x95a8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x95a8('0x9')](function(_0x447b57){logger[_0x95a8('0xa')](_0x95a8('0x13'),_0x17e66f);logger[_0x95a8('0x1d')](_0x95a8('0x13'),_0x17e66f,JSON[_0x95a8('0xd')](_0x447b57));_0x23b676(_0x447b57);})[_0x95a8('0x12')](function(_0x3a6b09){logger[_0x95a8('0xe')](_0x95a8('0x13'),_0x3a6b09[_0x95a8('0x10')],_0x17e66f);_0x91ba0c(_0x5192c7[_0x95a8('0xe')](0x1f4,_0x3a6b09['message']));});});};exports[_0x95a8('0x1e')]=function(_0x24e719){var _0x4ad658=this;return new Promise(function(_0x3a66ba,_0x3bc6f2){return db[_0x95a8('0x14')][_0x95a8('0x1f')]({'raw':_0x24e719['options']?_0x24e719[_0x95a8('0x16')][_0x95a8('0x17')]===undefined?!![]:![]:!![],'where':_0x24e719[_0x95a8('0x16')]?_0x24e719[_0x95a8('0x16')][_0x95a8('0x18')]||null:null,'attributes':_0x24e719['options']?_0x24e719[_0x95a8('0x16')][_0x95a8('0x19')]||null:null,'include':_0x24e719['options']?_0x24e719['options'][_0x95a8('0x1a')]?_['map'](_0x24e719[_0x95a8('0x16')][_0x95a8('0x1a')],function(_0x48c7fd){return{'model':db[_0x48c7fd[_0x95a8('0x1c')]],'as':_0x48c7fd['as'],'attributes':_0x48c7fd[_0x95a8('0x19')],'include':_0x48c7fd[_0x95a8('0x1a')]?_[_0x95a8('0x1b')](_0x48c7fd['include'],function(_0x25a74b){return{'model':db[_0x25a74b[_0x95a8('0x1c')]],'as':_0x25a74b['as'],'attributes':_0x25a74b[_0x95a8('0x19')],'include':_0x25a74b['include']?_[_0x95a8('0x1b')](_0x25a74b[_0x95a8('0x1a')],function(_0x513eee){return{'model':db[_0x513eee['model']],'as':_0x513eee['as'],'attributes':_0x513eee[_0x95a8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x95a8('0x9')](function(_0x2f1d05){logger[_0x95a8('0xa')](_0x95a8('0x1e'),_0x24e719);logger[_0x95a8('0x1d')](_0x95a8('0x1e'),_0x24e719,JSON[_0x95a8('0xd')](_0x2f1d05));_0x3a66ba(_0x2f1d05);})[_0x95a8('0x12')](function(_0x5ab59e){logger[_0x95a8('0xe')](_0x95a8('0x1e'),_0x5ab59e[_0x95a8('0x10')],_0x24e719);_0x3bc6f2(_0x4ad658[_0x95a8('0xe')](0x1f4,_0x5ab59e[_0x95a8('0x10')]));});});}; \ No newline at end of file +var _0x3566=['SugarcrmAccount','options','raw','where','attributes','limit','map','include','model','debug','ShowSugarcrmAccount','find','lodash','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSugarcrmAccount'];(function(_0x2d9ece,_0x282f1c){var _0x4e2c19=function(_0x14ff16){while(--_0x14ff16){_0x2d9ece['push'](_0x2d9ece['shift']());}};_0x4e2c19(++_0x282f1c);}(_0x3566,0x156));var _0x6356=function(_0x5cd71d,_0x5420b0){_0x5cd71d=_0x5cd71d-0x0;var _0x15cec7=_0x3566[_0x5cd71d];return _0x15cec7;};'use strict';var _=require(_0x6356('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6356('0x1'));var rs=require(_0x6356('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6356('0x3'));var logger=require(_0x6356('0x4'))(_0x6356('0x5'));var config=require('../../config/environment');var jayson=require(_0x6356('0x6'));var client=jayson['client'][_0x6356('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x124451,_0x41ced7,_0x238dd3){return new BPromise(function(_0x3572d0,_0x371642){return client[_0x6356('0x8')](_0x124451,_0x238dd3)[_0x6356('0x9')](function(_0x4b9037){logger[_0x6356('0xa')](_0x6356('0xb'),_0x41ced7,'request\x20sent');logger['debug'](_0x6356('0xc'),_0x41ced7,_0x6356('0xd'),JSON[_0x6356('0xe')](_0x4b9037));if(_0x4b9037[_0x6356('0xf')]){if(_0x4b9037[_0x6356('0xf')][_0x6356('0x10')]===0x1f4){logger[_0x6356('0xf')](_0x6356('0xb'),_0x41ced7,_0x4b9037[_0x6356('0xf')][_0x6356('0x11')]);return _0x371642(_0x4b9037['error'][_0x6356('0x11')]);}logger[_0x6356('0xf')](_0x6356('0xb'),_0x41ced7,_0x4b9037[_0x6356('0xf')][_0x6356('0x11')]);return _0x3572d0(_0x4b9037['error'][_0x6356('0x11')]);}else{logger[_0x6356('0xa')]('SugarcrmAccount,\x20%s,\x20%s',_0x41ced7,_0x6356('0xd'));_0x3572d0(_0x4b9037[_0x6356('0x12')][_0x6356('0x11')]);}})[_0x6356('0x13')](function(_0x9664e2){logger[_0x6356('0xf')](_0x6356('0xb'),_0x41ced7,_0x9664e2);_0x371642(_0x9664e2);});});}exports[_0x6356('0x14')]=function(_0x25d930){var _0x5eb7ff=this;return new Promise(function(_0x1ba3eb,_0x496e71){return db[_0x6356('0x15')]['findAll']({'raw':_0x25d930['options']?_0x25d930[_0x6356('0x16')][_0x6356('0x17')]===undefined?!![]:![]:!![],'where':_0x25d930[_0x6356('0x16')]?_0x25d930[_0x6356('0x16')][_0x6356('0x18')]||null:null,'attributes':_0x25d930['options']?_0x25d930[_0x6356('0x16')][_0x6356('0x19')]||null:null,'limit':_0x25d930[_0x6356('0x16')]?_0x25d930[_0x6356('0x16')][_0x6356('0x1a')]||null:null,'include':_0x25d930[_0x6356('0x16')]?_0x25d930['options']['include']?_[_0x6356('0x1b')](_0x25d930[_0x6356('0x16')][_0x6356('0x1c')],function(_0x159378){return{'model':db[_0x159378[_0x6356('0x1d')]],'as':_0x159378['as'],'attributes':_0x159378['attributes'],'include':_0x159378['include']?_[_0x6356('0x1b')](_0x159378[_0x6356('0x1c')],function(_0x29884f){return{'model':db[_0x29884f[_0x6356('0x1d')]],'as':_0x29884f['as'],'attributes':_0x29884f[_0x6356('0x19')],'include':_0x29884f[_0x6356('0x1c')]?_[_0x6356('0x1b')](_0x29884f[_0x6356('0x1c')],function(_0x36d8da){return{'model':db[_0x36d8da['model']],'as':_0x36d8da['as'],'attributes':_0x36d8da['attributes']};}):[]};}):[]};}):[]:[]})[_0x6356('0x9')](function(_0x7e90cd){logger[_0x6356('0xa')](_0x6356('0x14'),_0x25d930);logger[_0x6356('0x1e')]('GetSugarcrmAccount',_0x25d930,JSON[_0x6356('0xe')](_0x7e90cd));_0x1ba3eb(_0x7e90cd);})[_0x6356('0x13')](function(_0x1c5ae4){logger[_0x6356('0xf')](_0x6356('0x14'),_0x1c5ae4['message'],_0x25d930);_0x496e71(_0x5eb7ff[_0x6356('0xf')](0x1f4,_0x1c5ae4[_0x6356('0x11')]));});});};exports[_0x6356('0x1f')]=function(_0x14e697){var _0x1e9b29=this;return new Promise(function(_0x2e9ad,_0x3db8eb){return db[_0x6356('0x15')][_0x6356('0x20')]({'raw':_0x14e697[_0x6356('0x16')]?_0x14e697[_0x6356('0x16')][_0x6356('0x17')]===undefined?!![]:![]:!![],'where':_0x14e697['options']?_0x14e697[_0x6356('0x16')][_0x6356('0x18')]||null:null,'attributes':_0x14e697['options']?_0x14e697[_0x6356('0x16')][_0x6356('0x19')]||null:null,'include':_0x14e697[_0x6356('0x16')]?_0x14e697['options'][_0x6356('0x1c')]?_['map'](_0x14e697[_0x6356('0x16')][_0x6356('0x1c')],function(_0x109673){return{'model':db[_0x109673[_0x6356('0x1d')]],'as':_0x109673['as'],'attributes':_0x109673[_0x6356('0x19')],'include':_0x109673['include']?_['map'](_0x109673[_0x6356('0x1c')],function(_0x486fbc){return{'model':db[_0x486fbc[_0x6356('0x1d')]],'as':_0x486fbc['as'],'attributes':_0x486fbc[_0x6356('0x19')],'include':_0x486fbc[_0x6356('0x1c')]?_[_0x6356('0x1b')](_0x486fbc[_0x6356('0x1c')],function(_0x38e7ca){return{'model':db[_0x38e7ca['model']],'as':_0x38e7ca['as'],'attributes':_0x38e7ca[_0x6356('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4856fd){logger[_0x6356('0xa')](_0x6356('0x1f'),_0x14e697);logger[_0x6356('0x1e')](_0x6356('0x1f'),_0x14e697,JSON[_0x6356('0xe')](_0x4856fd));_0x2e9ad(_0x4856fd);})[_0x6356('0x13')](function(_0x49c58f){logger['error'](_0x6356('0x1f'),_0x49c58f['message'],_0x14e697);_0x3db8eb(_0x1e9b29['error'](0x1f4,_0x49c58f['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bf54d98..5d64f8e 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 _0xb7a5=['/:id/descriptions','getDescriptions','post','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects'];(function(_0x3ef0d0,_0x4b6e6c){var _0x4dcaeb=function(_0x559753){while(--_0x559753){_0x3ef0d0['push'](_0x3ef0d0['shift']());}};_0x4dcaeb(++_0x4b6e6c);}(_0xb7a5,0x1bf));var _0x5b7a=function(_0x1a9b36,_0x25bd22){_0x1a9b36=_0x1a9b36-0x0;var _0x176453=_0xb7a5[_0x1a9b36];return _0x176453;};'use strict';var multer=require('multer');var util=require(_0x5b7a('0x0'));var path=require(_0x5b7a('0x1'));var timeout=require('connect-timeout');var express=require(_0x5b7a('0x2'));var router=express[_0x5b7a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5b7a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5b7a('0x5'));var controller=require(_0x5b7a('0x6'));router[_0x5b7a('0x7')]('/',auth[_0x5b7a('0x8')](),controller[_0x5b7a('0x9')]);router[_0x5b7a('0x7')](_0x5b7a('0xa'),auth[_0x5b7a('0x8')](),controller[_0x5b7a('0xb')]);router[_0x5b7a('0x7')](_0x5b7a('0xc'),auth['isAuthenticated'](),controller[_0x5b7a('0xd')]);router[_0x5b7a('0x7')]('/:id/subjects',auth[_0x5b7a('0x8')](),controller[_0x5b7a('0xe')]);router[_0x5b7a('0x7')](_0x5b7a('0xf'),auth[_0x5b7a('0x8')](),controller[_0x5b7a('0x10')]);router[_0x5b7a('0x11')]('/',auth[_0x5b7a('0x8')](),controller['create']);router['put'](_0x5b7a('0xa'),auth[_0x5b7a('0x8')](),controller[_0x5b7a('0x12')]);router[_0x5b7a('0x13')]('/:id',auth[_0x5b7a('0x8')](),controller[_0x5b7a('0x14')]);module[_0x5b7a('0x15')]=router; \ No newline at end of file +var _0xadad=['/:id','/:id/fields','getFields','/:id/subjects','post','create','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xadad,0xa9));var _0xdada=function(_0x561f60,_0xecbaee){_0x561f60=_0x561f60-0x0;var _0x28b6cc=_0xadad[_0x561f60];return _0x28b6cc;};'use strict';var multer=require(_0xdada('0x0'));var util=require(_0xdada('0x1'));var path=require(_0xdada('0x2'));var timeout=require(_0xdada('0x3'));var express=require(_0xdada('0x4'));var router=express[_0xdada('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdada('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdada('0x7'));var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0xdada('0x8')](),controller[_0xdada('0x9')]);router[_0xdada('0xa')](_0xdada('0xb'),auth[_0xdada('0x8')](),controller['show']);router[_0xdada('0xa')](_0xdada('0xc'),auth['isAuthenticated'](),controller[_0xdada('0xd')]);router['get'](_0xdada('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xdada('0xa')]('/:id/descriptions',auth[_0xdada('0x8')](),controller['getDescriptions']);router[_0xdada('0xf')]('/',auth[_0xdada('0x8')](),controller[_0xdada('0x10')]);router['put'](_0xdada('0xb'),auth[_0xdada('0x8')](),controller[_0xdada('0x11')]);router['delete'](_0xdada('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 32733cf..3f53458 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 _0x0eba=['STRING','sequelize','exports'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0x0eba,0x1ea));var _0xa0eb=function(_0x5443b7,_0x504c2b){_0x5443b7=_0x5443b7-0x0;var _0x4c198f=_0x0eba[_0x5443b7];return _0x4c198f;};'use strict';var Sequelize=require(_0xa0eb('0x0'));module[_0xa0eb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa0eb('0x2')]}}; \ No newline at end of file +var _0xcd4d=['sequelize','exports','STRING'];(function(_0x1412e7,_0x23e956){var _0x283c3d=function(_0x5e8173){while(--_0x5e8173){_0x1412e7['push'](_0x1412e7['shift']());}};_0x283c3d(++_0x23e956);}(_0xcd4d,0xcc));var _0xdcd4=function(_0x1ea887,_0x581218){_0x1ea887=_0x1ea887-0x0;var _0x4f5d52=_0xcd4d[_0x1ea887];return _0x4f5d52;};'use strict';var Sequelize=require(_0xdcd4('0x0'));module[_0xdcd4('0x1')]={'name':{'type':Sequelize[_0xdcd4('0x2')]},'description':{'type':Sequelize[_0xdcd4('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 1ef8648..990dac2 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 _0x1402=['where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','findOne','SugarcrmField','getFields','getSubjects','pick','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','fs-extra','lodash','crypto','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','limit','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','send','index','SugarcrmConfiguration','rawAttributes','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x318666,_0x58de8f){var _0x251b10=function(_0x43d92f){while(--_0x43d92f){_0x318666['push'](_0x318666['shift']());}};_0x251b10(++_0x58de8f);}(_0x1402,0x14e));var _0x2140=function(_0x104993,_0x3f9a6b){_0x104993=_0x104993-0x0;var _0x105a96=_0x1402[_0x104993];return _0x105a96;};'use strict';var emlformat=require(_0x2140('0x0'));var rimraf=require(_0x2140('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2140('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2140('0x3'));var Mustache=require(_0x2140('0x4'));var util=require('util');var path=require('path');var sox=require(_0x2140('0x5'));var csv=require(_0x2140('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2140('0x7'));var _=require(_0x2140('0x8'));var squel=require('squel');var crypto=require(_0x2140('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2140('0xa'));var toCsv=require(_0x2140('0x6'));var querystring=require('querystring');var Papa=require(_0x2140('0xb'));var Redis=require(_0x2140('0xc'));var authService=require(_0x2140('0xd'));var qs=require(_0x2140('0xe'));var as=require(_0x2140('0xf'));var hardwareService=require(_0x2140('0x10'));var logger=require(_0x2140('0x11'))(_0x2140('0x12'));var utils=require(_0x2140('0x13'));var config=require(_0x2140('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x291bf4,_0x405d5d){_0x405d5d=_0x405d5d||0xcc;return function(_0x2d94e7){if(_0x2d94e7){return _0x291bf4[_0x2140('0x15')](_0x405d5d);}return _0x291bf4[_0x2140('0x16')](_0x405d5d)['end']();};}function respondWithResult(_0x5a2da2,_0x360d81){_0x360d81=_0x360d81||0xc8;return function(_0x76ba56){if(_0x76ba56){return _0x5a2da2[_0x2140('0x16')](_0x360d81)['json'](_0x76ba56);}};}function respondWithFilteredResult(_0x25f11d,_0x3ebbcc){return function(_0x1a6ce4){if(_0x1a6ce4){var _0x28e2cf=typeof _0x3ebbcc['offset']==='undefined'&&typeof _0x3ebbcc[_0x2140('0x17')]===_0x2140('0x18');var _0x4a8831=_0x1a6ce4[_0x2140('0x19')];var _0x15af8f=_0x28e2cf?0x0:_0x3ebbcc['offset'];var _0x3e0fd3=_0x28e2cf?_0x1a6ce4[_0x2140('0x19')]:_0x3ebbcc[_0x2140('0x1a')]+_0x3ebbcc[_0x2140('0x17')];var _0x498f8d;if(_0x3e0fd3>=_0x4a8831){_0x3e0fd3=_0x4a8831;_0x498f8d=0xc8;}else{_0x498f8d=0xce;}_0x25f11d[_0x2140('0x16')](_0x498f8d);return _0x25f11d[_0x2140('0x1b')](_0x2140('0x1c'),_0x15af8f+'-'+_0x3e0fd3+'/'+_0x4a8831)[_0x2140('0x1d')](_0x1a6ce4);}return null;};}function patchUpdates(_0x51ff19){return function(_0x4a2f8b){try{jsonpatch[_0x2140('0x1e')](_0x4a2f8b,_0x51ff19,!![]);}catch(_0x113dd7){return BPromise[_0x2140('0x1f')](_0x113dd7);}return _0x4a2f8b['save']();};}function saveUpdates(_0x4b15f5,_0x14dbc7){return function(_0x1eb0f4){if(_0x1eb0f4){return _0x1eb0f4[_0x2140('0x20')](_0x4b15f5)[_0x2140('0x21')](function(_0x48a8b1){return _0x48a8b1;});}return null;};}function removeEntity(_0x13c20e,_0x3f7c0a){return function(_0xff13a3){if(_0xff13a3){return _0xff13a3[_0x2140('0x22')]()[_0x2140('0x21')](function(){_0x13c20e[_0x2140('0x16')](0xcc)[_0x2140('0x23')]();});}};}function handleEntityNotFound(_0x18465c,_0x27c716){return function(_0x300109){if(!_0x300109){_0x18465c[_0x2140('0x15')](0x194);}return _0x300109;};}function handleError(_0x20cb22,_0x1c18d1){_0x1c18d1=_0x1c18d1||0x1f4;return function(_0x29acfb){logger[_0x2140('0x24')](_0x29acfb[_0x2140('0x25')]);if(_0x29acfb['name']){delete _0x29acfb['name'];}_0x20cb22['status'](_0x1c18d1)[_0x2140('0x26')](_0x29acfb);};}exports[_0x2140('0x27')]=function(_0x47ad48,_0x8fed42){var _0x43a6e3={},_0x147e2b={},_0x55a997={'count':0x0,'rows':[]};var _0x160663=_['map'](db[_0x2140('0x28')][_0x2140('0x29')],function(_0x5aba37){return{'name':_0x5aba37['fieldName'],'type':_0x5aba37[_0x2140('0x2a')][_0x2140('0x2b')]};});_0x147e2b['model']=_['map'](_0x160663,_0x2140('0x2c'));_0x147e2b[_0x2140('0x2d')]=_['keys'](_0x47ad48[_0x2140('0x2d')]);_0x147e2b[_0x2140('0x2e')]=_[_0x2140('0x2f')](_0x147e2b[_0x2140('0x30')],_0x147e2b[_0x2140('0x2d')]);_0x43a6e3[_0x2140('0x31')]=_[_0x2140('0x2f')](_0x147e2b[_0x2140('0x30')],qs['fields'](_0x47ad48[_0x2140('0x2d')][_0x2140('0x32')]));_0x43a6e3[_0x2140('0x31')]=_0x43a6e3[_0x2140('0x31')][_0x2140('0x33')]?_0x43a6e3[_0x2140('0x31')]:_0x147e2b[_0x2140('0x30')];if(!_0x47ad48[_0x2140('0x2d')][_0x2140('0x34')](_0x2140('0x35'))){_0x43a6e3[_0x2140('0x17')]=qs['limit'](_0x47ad48['query'][_0x2140('0x17')]);_0x43a6e3[_0x2140('0x1a')]=qs[_0x2140('0x1a')](_0x47ad48[_0x2140('0x2d')][_0x2140('0x1a')]);}_0x43a6e3[_0x2140('0x36')]=qs[_0x2140('0x37')](_0x47ad48['query'][_0x2140('0x37')]);_0x43a6e3[_0x2140('0x38')]=qs['filters'](_['pick'](_0x47ad48[_0x2140('0x2d')],_0x147e2b['filters']),_0x160663);if(_0x47ad48[_0x2140('0x2d')][_0x2140('0x39')]){_0x43a6e3['where']=_[_0x2140('0x3a')](_0x43a6e3[_0x2140('0x38')],{'$or':_[_0x2140('0x3b')](_0x160663,function(_0x29da8c){if(_0x29da8c[_0x2140('0x2a')]!==_0x2140('0x3c')){var _0x4065ab={};_0x4065ab[_0x29da8c['name']]={'$like':'%'+_0x47ad48[_0x2140('0x2d')]['filter']+'%'};return _0x4065ab;}})});}_0x43a6e3=_['merge']({},_0x43a6e3,_0x47ad48[_0x2140('0x3d')]);var _0x3ac844={'where':_0x43a6e3[_0x2140('0x38')]};return db[_0x2140('0x28')][_0x2140('0x19')](_0x3ac844)[_0x2140('0x21')](function(_0x4ca116){_0x55a997[_0x2140('0x19')]=_0x4ca116;if(_0x47ad48[_0x2140('0x2d')][_0x2140('0x3e')]){_0x43a6e3[_0x2140('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x2140('0x40')](_0x43a6e3);})[_0x2140('0x21')](function(_0x2753c2){_0x55a997['rows']=_0x2753c2;return _0x55a997;})[_0x2140('0x21')](respondWithFilteredResult(_0x8fed42,_0x43a6e3))[_0x2140('0x41')](handleError(_0x8fed42,null));};exports[_0x2140('0x42')]=function(_0xfcf932,_0x296d19){var _0x1f5631={'raw':![],'where':{'id':_0xfcf932[_0x2140('0x43')]['id']}},_0x259fc7={};_0x259fc7['model']=_[_0x2140('0x44')](db['SugarcrmConfiguration']['rawAttributes']);_0x259fc7[_0x2140('0x2d')]=_[_0x2140('0x44')](_0xfcf932[_0x2140('0x2d')]);_0x259fc7[_0x2140('0x2e')]=_[_0x2140('0x2f')](_0x259fc7[_0x2140('0x30')],_0x259fc7['query']);_0x1f5631[_0x2140('0x31')]=_[_0x2140('0x2f')](_0x259fc7['model'],qs[_0x2140('0x32')](_0xfcf932['query']['fields']));_0x1f5631['attributes']=_0x1f5631[_0x2140('0x31')][_0x2140('0x33')]?_0x1f5631[_0x2140('0x31')]:_0x259fc7[_0x2140('0x30')];if(_0xfcf932[_0x2140('0x2d')]['includeAll']){_0x1f5631[_0x2140('0x3f')]=[{'all':!![]}];}_0x1f5631=_['merge']({},_0x1f5631,_0xfcf932[_0x2140('0x3d')]);return db[_0x2140('0x28')][_0x2140('0x45')](_0x1f5631)[_0x2140('0x21')](handleEntityNotFound(_0x296d19,null))[_0x2140('0x21')](respondWithResult(_0x296d19,null))[_0x2140('0x41')](handleError(_0x296d19,null));};exports[_0x2140('0x46')]=function(_0x407f16,_0x2050fc){return db[_0x2140('0x28')][_0x2140('0x46')](_0x407f16['body'],{})[_0x2140('0x21')](respondWithResult(_0x2050fc,0xc9))[_0x2140('0x41')](handleError(_0x2050fc,null));};exports[_0x2140('0x20')]=function(_0x51627b,_0x9f6b70){if(_0x51627b[_0x2140('0x47')]['id']){delete _0x51627b[_0x2140('0x47')]['id'];}return db[_0x2140('0x28')]['find']({'where':{'id':_0x51627b['params']['id']}})[_0x2140('0x21')](handleEntityNotFound(_0x9f6b70,null))[_0x2140('0x21')](saveUpdates(_0x51627b[_0x2140('0x47')],null))[_0x2140('0x21')](respondWithResult(_0x9f6b70,null))[_0x2140('0x41')](handleError(_0x9f6b70,null));};exports['destroy']=function(_0x1f035c,_0x5bd49c){return db[_0x2140('0x28')][_0x2140('0x45')]({'where':{'id':_0x1f035c[_0x2140('0x43')]['id']}})[_0x2140('0x21')](handleEntityNotFound(_0x5bd49c,null))[_0x2140('0x21')](removeEntity(_0x5bd49c,null))['catch'](handleError(_0x5bd49c,null));};exports['getFields']=function(_0x49bd41,_0x14bc64,_0x50f006){var _0x5c716b={};var _0x1fe21b={};var _0x13b72c;var _0x35da8d;return db['SugarcrmConfiguration'][_0x2140('0x48')]({'where':{'id':_0x49bd41[_0x2140('0x43')]['id']}})[_0x2140('0x21')](handleEntityNotFound(_0x14bc64,null))[_0x2140('0x21')](function(_0x5bd122){if(_0x5bd122){_0x13b72c=_0x5bd122;_0x1fe21b[_0x2140('0x30')]=_[_0x2140('0x44')](db[_0x2140('0x49')]['rawAttributes']);_0x1fe21b[_0x2140('0x2d')]=_[_0x2140('0x44')](_0x49bd41['query']);_0x1fe21b[_0x2140('0x2e')]=_['intersection'](_0x1fe21b[_0x2140('0x30')],_0x1fe21b[_0x2140('0x2d')]);_0x5c716b[_0x2140('0x31')]=_['intersection'](_0x1fe21b[_0x2140('0x30')],qs[_0x2140('0x32')](_0x49bd41['query']['fields']));_0x5c716b['attributes']=_0x5c716b[_0x2140('0x31')][_0x2140('0x33')]?_0x5c716b[_0x2140('0x31')]:_0x1fe21b['model'];_0x5c716b[_0x2140('0x36')]=qs[_0x2140('0x37')](_0x49bd41[_0x2140('0x2d')][_0x2140('0x37')]);_0x5c716b[_0x2140('0x38')]=qs[_0x2140('0x2e')](_['pick'](_0x49bd41[_0x2140('0x2d')],_0x1fe21b[_0x2140('0x2e')]));if(_0x49bd41[_0x2140('0x2d')]['filter']){_0x5c716b[_0x2140('0x38')]=_[_0x2140('0x3a')](_0x5c716b[_0x2140('0x38')],{'$or':_[_0x2140('0x3b')](_0x5c716b[_0x2140('0x31')],function(_0x1ae57a){var _0x305f1a={};_0x305f1a[_0x1ae57a]={'$like':'%'+_0x49bd41['query']['filter']+'%'};return _0x305f1a;})});}_0x5c716b=_[_0x2140('0x3a')]({},_0x5c716b,_0x49bd41['options']);return _0x13b72c[_0x2140('0x4a')](_0x5c716b);}})[_0x2140('0x21')](function(_0x5a9931){if(_0x5a9931){_0x35da8d=_0x5a9931[_0x2140('0x33')];if(!_0x49bd41[_0x2140('0x2d')][_0x2140('0x34')](_0x2140('0x35'))){_0x5c716b[_0x2140('0x17')]=qs['limit'](_0x49bd41['query'][_0x2140('0x17')]);_0x5c716b[_0x2140('0x1a')]=qs['offset'](_0x49bd41[_0x2140('0x2d')][_0x2140('0x1a')]);}return _0x13b72c[_0x2140('0x4a')](_0x5c716b);}})[_0x2140('0x21')](function(_0x316ab5){if(_0x316ab5){return _0x316ab5?{'count':_0x35da8d,'rows':_0x316ab5}:null;}})[_0x2140('0x21')](respondWithResult(_0x14bc64,null))[_0x2140('0x41')](handleError(_0x14bc64,null));};exports[_0x2140('0x4b')]=function(_0x55e66c,_0x75adaa,_0x3d6c3e){var _0x3c1065={};var _0x2fabbd={};var _0x5f3581;var _0x5e1df8;return db[_0x2140('0x28')][_0x2140('0x48')]({'where':{'id':_0x55e66c[_0x2140('0x43')]['id']}})[_0x2140('0x21')](handleEntityNotFound(_0x75adaa,null))[_0x2140('0x21')](function(_0x53a82f){if(_0x53a82f){_0x5f3581=_0x53a82f;_0x2fabbd[_0x2140('0x30')]=_['keys'](db[_0x2140('0x49')][_0x2140('0x29')]);_0x2fabbd['query']=_[_0x2140('0x44')](_0x55e66c['query']);_0x2fabbd[_0x2140('0x2e')]=_['intersection'](_0x2fabbd[_0x2140('0x30')],_0x2fabbd[_0x2140('0x2d')]);_0x3c1065[_0x2140('0x31')]=_[_0x2140('0x2f')](_0x2fabbd[_0x2140('0x30')],qs[_0x2140('0x32')](_0x55e66c[_0x2140('0x2d')][_0x2140('0x32')]));_0x3c1065['attributes']=_0x3c1065[_0x2140('0x31')][_0x2140('0x33')]?_0x3c1065[_0x2140('0x31')]:_0x2fabbd[_0x2140('0x30')];_0x3c1065['order']=qs[_0x2140('0x37')](_0x55e66c['query'][_0x2140('0x37')]);_0x3c1065[_0x2140('0x38')]=qs['filters'](_[_0x2140('0x4c')](_0x55e66c[_0x2140('0x2d')],_0x2fabbd['filters']));if(_0x55e66c['query'][_0x2140('0x39')]){_0x3c1065['where']=_[_0x2140('0x3a')](_0x3c1065[_0x2140('0x38')],{'$or':_[_0x2140('0x3b')](_0x3c1065[_0x2140('0x31')],function(_0x226a0a){var _0x155e4e={};_0x155e4e[_0x226a0a]={'$like':'%'+_0x55e66c[_0x2140('0x2d')][_0x2140('0x39')]+'%'};return _0x155e4e;})});}_0x3c1065=_['merge']({},_0x3c1065,_0x55e66c['options']);return _0x5f3581[_0x2140('0x4b')](_0x3c1065);}})[_0x2140('0x21')](function(_0x19a38f){if(_0x19a38f){_0x5e1df8=_0x19a38f[_0x2140('0x33')];if(!_0x55e66c[_0x2140('0x2d')][_0x2140('0x34')]('nolimit')){_0x3c1065[_0x2140('0x17')]=qs[_0x2140('0x17')](_0x55e66c[_0x2140('0x2d')][_0x2140('0x17')]);_0x3c1065[_0x2140('0x1a')]=qs[_0x2140('0x1a')](_0x55e66c['query']['offset']);}return _0x5f3581['getSubjects'](_0x3c1065);}})[_0x2140('0x21')](function(_0x3713e0){if(_0x3713e0){return _0x3713e0?{'count':_0x5e1df8,'rows':_0x3713e0}:null;}})[_0x2140('0x21')](respondWithResult(_0x75adaa,null))[_0x2140('0x41')](handleError(_0x75adaa,null));};exports[_0x2140('0x4d')]=function(_0x329ed0,_0x37f287,_0x101c7b){var _0x234c05={};var _0x1bead7={};var _0x25974a;var _0x4306c3;return db[_0x2140('0x28')][_0x2140('0x48')]({'where':{'id':_0x329ed0['params']['id']}})[_0x2140('0x21')](handleEntityNotFound(_0x37f287,null))['then'](function(_0x1c4e96){if(_0x1c4e96){_0x25974a=_0x1c4e96;_0x1bead7['model']=_['keys'](db[_0x2140('0x49')]['rawAttributes']);_0x1bead7[_0x2140('0x2d')]=_['keys'](_0x329ed0[_0x2140('0x2d')]);_0x1bead7['filters']=_['intersection'](_0x1bead7[_0x2140('0x30')],_0x1bead7[_0x2140('0x2d')]);_0x234c05[_0x2140('0x31')]=_[_0x2140('0x2f')](_0x1bead7[_0x2140('0x30')],qs[_0x2140('0x32')](_0x329ed0[_0x2140('0x2d')][_0x2140('0x32')]));_0x234c05[_0x2140('0x31')]=_0x234c05[_0x2140('0x31')][_0x2140('0x33')]?_0x234c05[_0x2140('0x31')]:_0x1bead7[_0x2140('0x30')];_0x234c05[_0x2140('0x36')]=qs['sort'](_0x329ed0['query'][_0x2140('0x37')]);_0x234c05['where']=qs['filters'](_[_0x2140('0x4c')](_0x329ed0['query'],_0x1bead7[_0x2140('0x2e')]));if(_0x329ed0[_0x2140('0x2d')][_0x2140('0x39')]){_0x234c05[_0x2140('0x38')]=_[_0x2140('0x3a')](_0x234c05[_0x2140('0x38')],{'$or':_[_0x2140('0x3b')](_0x234c05[_0x2140('0x31')],function(_0x408234){var _0x8ead1d={};_0x8ead1d[_0x408234]={'$like':'%'+_0x329ed0[_0x2140('0x2d')][_0x2140('0x39')]+'%'};return _0x8ead1d;})});}_0x234c05=_[_0x2140('0x3a')]({},_0x234c05,_0x329ed0[_0x2140('0x3d')]);return _0x25974a[_0x2140('0x4d')](_0x234c05);}})[_0x2140('0x21')](function(_0x9bcdc5){if(_0x9bcdc5){_0x4306c3=_0x9bcdc5['length'];if(!_0x329ed0[_0x2140('0x2d')][_0x2140('0x34')](_0x2140('0x35'))){_0x234c05[_0x2140('0x17')]=qs[_0x2140('0x17')](_0x329ed0[_0x2140('0x2d')][_0x2140('0x17')]);_0x234c05[_0x2140('0x1a')]=qs[_0x2140('0x1a')](_0x329ed0[_0x2140('0x2d')][_0x2140('0x1a')]);}return _0x25974a[_0x2140('0x4d')](_0x234c05);}})['then'](function(_0x5b0fd8){if(_0x5b0fd8){return _0x5b0fd8?{'count':_0x4306c3,'rows':_0x5b0fd8}:null;}})[_0x2140('0x21')](respondWithResult(_0x37f287,null))['catch'](handleError(_0x37f287,null));}; \ No newline at end of file +var _0x8771=['merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','end','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where'];(function(_0x5ef28e,_0x86eea9){var _0x19c86e=function(_0x112b54){while(--_0x112b54){_0x5ef28e['push'](_0x5ef28e['shift']());}};_0x19c86e(++_0x86eea9);}(_0x8771,0x1f2));var _0x1877=function(_0x49c957,_0x3509d8){_0x49c957=_0x49c957-0x0;var _0x5b1d38=_0x8771[_0x49c957];return _0x5b1d38;};'use strict';var emlformat=require(_0x1877('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1877('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1877('0x2'));var moment=require(_0x1877('0x3'));var BPromise=require(_0x1877('0x4'));var Mustache=require(_0x1877('0x5'));var util=require(_0x1877('0x6'));var path=require(_0x1877('0x7'));var sox=require(_0x1877('0x8'));var csv=require('to-csv');var ejs=require(_0x1877('0x9'));var fs=require('fs');var fs_extra=require(_0x1877('0xa'));var _=require(_0x1877('0xb'));var squel=require('squel');var crypto=require(_0x1877('0xc'));var jsforce=require(_0x1877('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1877('0xe'));var querystring=require('querystring');var Papa=require(_0x1877('0xf'));var Redis=require(_0x1877('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1877('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1877('0x12'))(_0x1877('0x13'));var utils=require(_0x1877('0x14'));var config=require(_0x1877('0x15'));var licenseUtil=require(_0x1877('0x16'));var db=require(_0x1877('0x17'))['db'];function respondWithStatusCode(_0x2f5a2a,_0x2b61cb){_0x2b61cb=_0x2b61cb||0xcc;return function(_0x22d3d0){if(_0x22d3d0){return _0x2f5a2a[_0x1877('0x18')](_0x2b61cb);}return _0x2f5a2a[_0x1877('0x19')](_0x2b61cb)['end']();};}function respondWithResult(_0x469608,_0x50a5d5){_0x50a5d5=_0x50a5d5||0xc8;return function(_0xf0200d){if(_0xf0200d){return _0x469608[_0x1877('0x19')](_0x50a5d5)['json'](_0xf0200d);}};}function respondWithFilteredResult(_0x1b8120,_0xd401e5){return function(_0x3ea34b){if(_0x3ea34b){var _0x57c08e=typeof _0xd401e5[_0x1877('0x1a')]===_0x1877('0x1b')&&typeof _0xd401e5[_0x1877('0x1c')]==='undefined';var _0x53462e=_0x3ea34b[_0x1877('0x1d')];var _0x30e342=_0x57c08e?0x0:_0xd401e5['offset'];var _0x9af89b=_0x57c08e?_0x3ea34b[_0x1877('0x1d')]:_0xd401e5[_0x1877('0x1a')]+_0xd401e5[_0x1877('0x1c')];var _0x469f2f;if(_0x9af89b>=_0x53462e){_0x9af89b=_0x53462e;_0x469f2f=0xc8;}else{_0x469f2f=0xce;}_0x1b8120[_0x1877('0x19')](_0x469f2f);return _0x1b8120[_0x1877('0x1e')](_0x1877('0x1f'),_0x30e342+'-'+_0x9af89b+'/'+_0x53462e)[_0x1877('0x20')](_0x3ea34b);}return null;};}function patchUpdates(_0x2ca0f0){return function(_0x3c0dc3){try{jsonpatch['apply'](_0x3c0dc3,_0x2ca0f0,!![]);}catch(_0x3dcfdb){return BPromise['reject'](_0x3dcfdb);}return _0x3c0dc3[_0x1877('0x21')]();};}function saveUpdates(_0xdf1491,_0x48ca25){return function(_0x4b67ec){if(_0x4b67ec){return _0x4b67ec[_0x1877('0x22')](_0xdf1491)[_0x1877('0x23')](function(_0x122cdf){return _0x122cdf;});}return null;};}function removeEntity(_0xb26361,_0x12f18c){return function(_0x423538){if(_0x423538){return _0x423538[_0x1877('0x24')]()[_0x1877('0x23')](function(){_0xb26361[_0x1877('0x19')](0xcc)[_0x1877('0x25')]();});}};}function handleEntityNotFound(_0xef431f,_0x5425a8){return function(_0x155751){if(!_0x155751){_0xef431f[_0x1877('0x18')](0x194);}return _0x155751;};}function handleError(_0xd67288,_0x2ca499){_0x2ca499=_0x2ca499||0x1f4;return function(_0x18720){logger['error'](_0x18720[_0x1877('0x26')]);if(_0x18720[_0x1877('0x27')]){delete _0x18720[_0x1877('0x27')];}_0xd67288[_0x1877('0x19')](_0x2ca499)[_0x1877('0x28')](_0x18720);};}exports[_0x1877('0x29')]=function(_0x2677a7,_0x5c4486){var _0x355781={},_0x43c756={},_0xe6cdf0={'count':0x0,'rows':[]};var _0x27be66=_[_0x1877('0x2a')](db[_0x1877('0x2b')][_0x1877('0x2c')],function(_0x328be9){return{'name':_0x328be9[_0x1877('0x2d')],'type':_0x328be9['type'][_0x1877('0x2e')]};});_0x43c756['model']=_['map'](_0x27be66,_0x1877('0x27'));_0x43c756[_0x1877('0x2f')]=_[_0x1877('0x30')](_0x2677a7[_0x1877('0x2f')]);_0x43c756['filters']=_[_0x1877('0x31')](_0x43c756['model'],_0x43c756[_0x1877('0x2f')]);_0x355781['attributes']=_['intersection'](_0x43c756[_0x1877('0x32')],qs[_0x1877('0x33')](_0x2677a7[_0x1877('0x2f')][_0x1877('0x33')]));_0x355781[_0x1877('0x34')]=_0x355781[_0x1877('0x34')][_0x1877('0x35')]?_0x355781[_0x1877('0x34')]:_0x43c756['model'];if(!_0x2677a7[_0x1877('0x2f')][_0x1877('0x36')](_0x1877('0x37'))){_0x355781[_0x1877('0x1c')]=qs['limit'](_0x2677a7['query'][_0x1877('0x1c')]);_0x355781[_0x1877('0x1a')]=qs['offset'](_0x2677a7[_0x1877('0x2f')]['offset']);}_0x355781[_0x1877('0x38')]=qs[_0x1877('0x39')](_0x2677a7['query'][_0x1877('0x39')]);_0x355781['where']=qs[_0x1877('0x3a')](_[_0x1877('0x3b')](_0x2677a7[_0x1877('0x2f')],_0x43c756[_0x1877('0x3a')]),_0x27be66);if(_0x2677a7[_0x1877('0x2f')][_0x1877('0x3c')]){_0x355781[_0x1877('0x3d')]=_[_0x1877('0x3e')](_0x355781['where'],{'$or':_[_0x1877('0x2a')](_0x27be66,function(_0x2a7059){if(_0x2a7059['type']!==_0x1877('0x3f')){var _0x4e11f8={};_0x4e11f8[_0x2a7059[_0x1877('0x27')]]={'$like':'%'+_0x2677a7[_0x1877('0x2f')][_0x1877('0x3c')]+'%'};return _0x4e11f8;}})});}_0x355781=_['merge']({},_0x355781,_0x2677a7['options']);var _0x5ab350={'where':_0x355781[_0x1877('0x3d')]};return db[_0x1877('0x2b')][_0x1877('0x1d')](_0x5ab350)[_0x1877('0x23')](function(_0xa815f){_0xe6cdf0[_0x1877('0x1d')]=_0xa815f;if(_0x2677a7['query'][_0x1877('0x40')]){_0x355781[_0x1877('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x1877('0x42')](_0x355781);})[_0x1877('0x23')](function(_0xae505c){_0xe6cdf0[_0x1877('0x43')]=_0xae505c;return _0xe6cdf0;})['then'](respondWithFilteredResult(_0x5c4486,_0x355781))[_0x1877('0x44')](handleError(_0x5c4486,null));};exports[_0x1877('0x45')]=function(_0x4b2db9,_0x433744){var _0x38eeba={'raw':![],'where':{'id':_0x4b2db9[_0x1877('0x46')]['id']}},_0x52bf00={};_0x52bf00['model']=_[_0x1877('0x30')](db[_0x1877('0x2b')][_0x1877('0x2c')]);_0x52bf00[_0x1877('0x2f')]=_[_0x1877('0x30')](_0x4b2db9[_0x1877('0x2f')]);_0x52bf00[_0x1877('0x3a')]=_['intersection'](_0x52bf00['model'],_0x52bf00[_0x1877('0x2f')]);_0x38eeba['attributes']=_['intersection'](_0x52bf00[_0x1877('0x32')],qs[_0x1877('0x33')](_0x4b2db9[_0x1877('0x2f')][_0x1877('0x33')]));_0x38eeba[_0x1877('0x34')]=_0x38eeba[_0x1877('0x34')][_0x1877('0x35')]?_0x38eeba[_0x1877('0x34')]:_0x52bf00[_0x1877('0x32')];if(_0x4b2db9['query']['includeAll']){_0x38eeba[_0x1877('0x41')]=[{'all':!![]}];}_0x38eeba=_[_0x1877('0x3e')]({},_0x38eeba,_0x4b2db9[_0x1877('0x47')]);return db[_0x1877('0x2b')][_0x1877('0x48')](_0x38eeba)[_0x1877('0x23')](handleEntityNotFound(_0x433744,null))[_0x1877('0x23')](respondWithResult(_0x433744,null))[_0x1877('0x44')](handleError(_0x433744,null));};exports[_0x1877('0x49')]=function(_0x18e1aa,_0x5c37be){return db[_0x1877('0x2b')][_0x1877('0x49')](_0x18e1aa[_0x1877('0x4a')],{})[_0x1877('0x23')](respondWithResult(_0x5c37be,0xc9))['catch'](handleError(_0x5c37be,null));};exports[_0x1877('0x22')]=function(_0x5174a6,_0x369109){if(_0x5174a6['body']['id']){delete _0x5174a6[_0x1877('0x4a')]['id'];}return db[_0x1877('0x2b')][_0x1877('0x48')]({'where':{'id':_0x5174a6[_0x1877('0x46')]['id']}})['then'](handleEntityNotFound(_0x369109,null))['then'](saveUpdates(_0x5174a6[_0x1877('0x4a')],null))[_0x1877('0x23')](respondWithResult(_0x369109,null))[_0x1877('0x44')](handleError(_0x369109,null));};exports[_0x1877('0x24')]=function(_0x557065,_0x2c9641){return db[_0x1877('0x2b')][_0x1877('0x48')]({'where':{'id':_0x557065[_0x1877('0x46')]['id']}})['then'](handleEntityNotFound(_0x2c9641,null))[_0x1877('0x23')](removeEntity(_0x2c9641,null))[_0x1877('0x44')](handleError(_0x2c9641,null));};exports[_0x1877('0x4b')]=function(_0x5b944b,_0x2d7758,_0x11bdee){var _0x3b6d09={};var _0x5c077a={};var _0x198116;var _0x2a4340;return db[_0x1877('0x2b')][_0x1877('0x4c')]({'where':{'id':_0x5b944b[_0x1877('0x46')]['id']}})['then'](handleEntityNotFound(_0x2d7758,null))['then'](function(_0x305981){if(_0x305981){_0x198116=_0x305981;_0x5c077a['model']=_['keys'](db[_0x1877('0x4d')][_0x1877('0x2c')]);_0x5c077a[_0x1877('0x2f')]=_['keys'](_0x5b944b[_0x1877('0x2f')]);_0x5c077a[_0x1877('0x3a')]=_[_0x1877('0x31')](_0x5c077a[_0x1877('0x32')],_0x5c077a[_0x1877('0x2f')]);_0x3b6d09[_0x1877('0x34')]=_[_0x1877('0x31')](_0x5c077a[_0x1877('0x32')],qs[_0x1877('0x33')](_0x5b944b[_0x1877('0x2f')][_0x1877('0x33')]));_0x3b6d09['attributes']=_0x3b6d09[_0x1877('0x34')][_0x1877('0x35')]?_0x3b6d09[_0x1877('0x34')]:_0x5c077a[_0x1877('0x32')];_0x3b6d09[_0x1877('0x38')]=qs[_0x1877('0x39')](_0x5b944b['query']['sort']);_0x3b6d09['where']=qs[_0x1877('0x3a')](_['pick'](_0x5b944b[_0x1877('0x2f')],_0x5c077a['filters']));if(_0x5b944b['query']['filter']){_0x3b6d09[_0x1877('0x3d')]=_['merge'](_0x3b6d09['where'],{'$or':_['map'](_0x3b6d09[_0x1877('0x34')],function(_0x2a602){var _0x3ab936={};_0x3ab936[_0x2a602]={'$like':'%'+_0x5b944b[_0x1877('0x2f')][_0x1877('0x3c')]+'%'};return _0x3ab936;})});}_0x3b6d09=_[_0x1877('0x3e')]({},_0x3b6d09,_0x5b944b['options']);return _0x198116['getFields'](_0x3b6d09);}})[_0x1877('0x23')](function(_0x38d00c){if(_0x38d00c){_0x2a4340=_0x38d00c[_0x1877('0x35')];if(!_0x5b944b[_0x1877('0x2f')][_0x1877('0x36')]('nolimit')){_0x3b6d09[_0x1877('0x1c')]=qs[_0x1877('0x1c')](_0x5b944b[_0x1877('0x2f')][_0x1877('0x1c')]);_0x3b6d09[_0x1877('0x1a')]=qs['offset'](_0x5b944b[_0x1877('0x2f')][_0x1877('0x1a')]);}return _0x198116[_0x1877('0x4b')](_0x3b6d09);}})[_0x1877('0x23')](function(_0xdc4b34){if(_0xdc4b34){return _0xdc4b34?{'count':_0x2a4340,'rows':_0xdc4b34}:null;}})[_0x1877('0x23')](respondWithResult(_0x2d7758,null))[_0x1877('0x44')](handleError(_0x2d7758,null));};exports[_0x1877('0x4e')]=function(_0x3099a0,_0xffe151,_0x2f0940){var _0xf3d0df={};var _0x36922c={};var _0x423e4d;var _0x461be3;return db[_0x1877('0x2b')][_0x1877('0x4c')]({'where':{'id':_0x3099a0[_0x1877('0x46')]['id']}})[_0x1877('0x23')](handleEntityNotFound(_0xffe151,null))[_0x1877('0x23')](function(_0x49752c){if(_0x49752c){_0x423e4d=_0x49752c;_0x36922c['model']=_[_0x1877('0x30')](db[_0x1877('0x4d')][_0x1877('0x2c')]);_0x36922c['query']=_['keys'](_0x3099a0['query']);_0x36922c[_0x1877('0x3a')]=_[_0x1877('0x31')](_0x36922c['model'],_0x36922c['query']);_0xf3d0df[_0x1877('0x34')]=_['intersection'](_0x36922c[_0x1877('0x32')],qs[_0x1877('0x33')](_0x3099a0[_0x1877('0x2f')][_0x1877('0x33')]));_0xf3d0df[_0x1877('0x34')]=_0xf3d0df[_0x1877('0x34')]['length']?_0xf3d0df['attributes']:_0x36922c[_0x1877('0x32')];_0xf3d0df[_0x1877('0x38')]=qs[_0x1877('0x39')](_0x3099a0[_0x1877('0x2f')][_0x1877('0x39')]);_0xf3d0df['where']=qs[_0x1877('0x3a')](_[_0x1877('0x3b')](_0x3099a0['query'],_0x36922c[_0x1877('0x3a')]));if(_0x3099a0[_0x1877('0x2f')]['filter']){_0xf3d0df[_0x1877('0x3d')]=_[_0x1877('0x3e')](_0xf3d0df[_0x1877('0x3d')],{'$or':_[_0x1877('0x2a')](_0xf3d0df[_0x1877('0x34')],function(_0x216b91){var _0x37dcc1={};_0x37dcc1[_0x216b91]={'$like':'%'+_0x3099a0['query'][_0x1877('0x3c')]+'%'};return _0x37dcc1;})});}_0xf3d0df=_[_0x1877('0x3e')]({},_0xf3d0df,_0x3099a0['options']);return _0x423e4d[_0x1877('0x4e')](_0xf3d0df);}})[_0x1877('0x23')](function(_0x405bbf){if(_0x405bbf){_0x461be3=_0x405bbf[_0x1877('0x35')];if(!_0x3099a0[_0x1877('0x2f')][_0x1877('0x36')](_0x1877('0x37'))){_0xf3d0df[_0x1877('0x1c')]=qs[_0x1877('0x1c')](_0x3099a0[_0x1877('0x2f')][_0x1877('0x1c')]);_0xf3d0df[_0x1877('0x1a')]=qs['offset'](_0x3099a0[_0x1877('0x2f')]['offset']);}return _0x423e4d[_0x1877('0x4e')](_0xf3d0df);}})[_0x1877('0x23')](function(_0x5b9213){if(_0x5b9213){return _0x5b9213?{'count':_0x461be3,'rows':_0x5b9213}:null;}})[_0x1877('0x23')](respondWithResult(_0xffe151,null))[_0x1877('0x44')](handleError(_0xffe151,null));};exports[_0x1877('0x4f')]=function(_0x47afa2,_0x329ab8,_0x4cc910){var _0x4cf276={};var _0x258f54={};var _0x5d1e01;var _0x3ece82;return db[_0x1877('0x2b')][_0x1877('0x4c')]({'where':{'id':_0x47afa2[_0x1877('0x46')]['id']}})[_0x1877('0x23')](handleEntityNotFound(_0x329ab8,null))['then'](function(_0x10fa0f){if(_0x10fa0f){_0x5d1e01=_0x10fa0f;_0x258f54['model']=_[_0x1877('0x30')](db[_0x1877('0x4d')][_0x1877('0x2c')]);_0x258f54[_0x1877('0x2f')]=_[_0x1877('0x30')](_0x47afa2[_0x1877('0x2f')]);_0x258f54[_0x1877('0x3a')]=_['intersection'](_0x258f54['model'],_0x258f54['query']);_0x4cf276[_0x1877('0x34')]=_[_0x1877('0x31')](_0x258f54[_0x1877('0x32')],qs[_0x1877('0x33')](_0x47afa2[_0x1877('0x2f')][_0x1877('0x33')]));_0x4cf276[_0x1877('0x34')]=_0x4cf276[_0x1877('0x34')][_0x1877('0x35')]?_0x4cf276[_0x1877('0x34')]:_0x258f54[_0x1877('0x32')];_0x4cf276[_0x1877('0x38')]=qs[_0x1877('0x39')](_0x47afa2[_0x1877('0x2f')][_0x1877('0x39')]);_0x4cf276[_0x1877('0x3d')]=qs[_0x1877('0x3a')](_[_0x1877('0x3b')](_0x47afa2[_0x1877('0x2f')],_0x258f54[_0x1877('0x3a')]));if(_0x47afa2['query'][_0x1877('0x3c')]){_0x4cf276['where']=_['merge'](_0x4cf276['where'],{'$or':_[_0x1877('0x2a')](_0x4cf276[_0x1877('0x34')],function(_0xba9e00){var _0x3b2be3={};_0x3b2be3[_0xba9e00]={'$like':'%'+_0x47afa2[_0x1877('0x2f')][_0x1877('0x3c')]+'%'};return _0x3b2be3;})});}_0x4cf276=_[_0x1877('0x3e')]({},_0x4cf276,_0x47afa2[_0x1877('0x47')]);return _0x5d1e01[_0x1877('0x4f')](_0x4cf276);}})[_0x1877('0x23')](function(_0x40e433){if(_0x40e433){_0x3ece82=_0x40e433['length'];if(!_0x47afa2[_0x1877('0x2f')][_0x1877('0x36')](_0x1877('0x37'))){_0x4cf276['limit']=qs[_0x1877('0x1c')](_0x47afa2[_0x1877('0x2f')]['limit']);_0x4cf276[_0x1877('0x1a')]=qs[_0x1877('0x1a')](_0x47afa2['query'][_0x1877('0x1a')]);}return _0x5d1e01[_0x1877('0x4f')](_0x4cf276);}})[_0x1877('0x23')](function(_0x5eab51){if(_0x5eab51){return _0x5eab51?{'count':_0x3ece82,'rows':_0x5eab51}:null;}})[_0x1877('0x23')](respondWithResult(_0x329ab8,null))[_0x1877('0x44')](handleError(_0x329ab8,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 6f9de04..cc1a2d3 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 _0x4502=['./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','util','api','moment','request-promise'];(function(_0x513097,_0x46c1e1){var _0xe09ef1=function(_0x577d42){while(--_0x577d42){_0x513097['push'](_0x513097['shift']());}};_0xe09ef1(++_0x46c1e1);}(_0x4502,0xb9));var _0x2450=function(_0x3d4c62,_0x342081){_0x3d4c62=_0x3d4c62-0x0;var _0x3dfbd5=_0x4502[_0x3d4c62];return _0x3dfbd5;};'use strict';var _=require('lodash');var util=require(_0x2450('0x0'));var logger=require('../../config/logger')(_0x2450('0x1'));var moment=require(_0x2450('0x2'));var BPromise=require('bluebird');var rp=require(_0x2450('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2450('0x4'));module[_0x2450('0x5')]=function(_0x34470d,_0x316c72){return _0x34470d[_0x2450('0x6')](_0x2450('0x7'),attributes,{'tableName':_0x2450('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0ed=['rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x9bc14e,_0x4d7830){var _0x517acc=function(_0x42c407){while(--_0x42c407){_0x9bc14e['push'](_0x9bc14e['shift']());}};_0x517acc(++_0x4d7830);}(_0xd0ed,0x149));var _0xdd0e=function(_0x3443a9,_0x2210cd){_0x3443a9=_0x3443a9-0x0;var _0x1e0875=_0xd0ed[_0x3443a9];return _0x1e0875;};'use strict';var _=require(_0xdd0e('0x0'));var util=require(_0xdd0e('0x1'));var logger=require('../../config/logger')(_0xdd0e('0x2'));var moment=require(_0xdd0e('0x3'));var BPromise=require(_0xdd0e('0x4'));var rp=require(_0xdd0e('0x5'));var fs=require('fs');var path=require(_0xdd0e('0x6'));var rimraf=require(_0xdd0e('0x7'));var config=require('../../config/environment');var attributes=require(_0xdd0e('0x8'));module['exports']=function(_0x311bd0,_0x1ef2c9){return _0x311bd0[_0xdd0e('0x9')](_0xdd0e('0xa'),attributes,{'tableName':_0xdd0e('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 1871475..2bad829 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 _0xf3c4=['lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch'];(function(_0x523095,_0xce2961){var _0x9fadc4=function(_0x5978a0){while(--_0x5978a0){_0x523095['push'](_0x523095['shift']());}};_0x9fadc4(++_0xce2961);}(_0xf3c4,0x72));var _0x4f3c=function(_0x2ad216,_0x43eba1){_0x2ad216=_0x2ad216-0x0;var _0x189cb6=_0xf3c4[_0x2ad216];return _0x189cb6;};'use strict';var _=require(_0x4f3c('0x0'));var util=require(_0x4f3c('0x1'));var moment=require(_0x4f3c('0x2'));var BPromise=require(_0x4f3c('0x3'));var rs=require(_0x4f3c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f3c('0x5'))(_0x4f3c('0x6'));var config=require(_0x4f3c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4f3c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e5fd6,_0x26f613,_0x10b29e){return new BPromise(function(_0x534db7,_0x28abdf){return client[_0x4f3c('0x9')](_0x1e5fd6,_0x10b29e)['then'](function(_0x5d5fac){logger[_0x4f3c('0xa')](_0x4f3c('0xb'),_0x26f613,'request\x20sent');logger['debug'](_0x4f3c('0xc'),_0x26f613,'request\x20sent',JSON['stringify'](_0x5d5fac));if(_0x5d5fac['error']){if(_0x5d5fac[_0x4f3c('0xd')][_0x4f3c('0xe')]===0x1f4){logger[_0x4f3c('0xd')](_0x4f3c('0xb'),_0x26f613,_0x5d5fac[_0x4f3c('0xd')][_0x4f3c('0xf')]);return _0x28abdf(_0x5d5fac[_0x4f3c('0xd')][_0x4f3c('0xf')]);}logger[_0x4f3c('0xd')](_0x4f3c('0xb'),_0x26f613,_0x5d5fac[_0x4f3c('0xd')][_0x4f3c('0xf')]);return _0x534db7(_0x5d5fac[_0x4f3c('0xd')][_0x4f3c('0xf')]);}else{logger[_0x4f3c('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x26f613,_0x4f3c('0x10'));_0x534db7(_0x5d5fac[_0x4f3c('0x11')]['message']);}})[_0x4f3c('0x12')](function(_0x536665){logger[_0x4f3c('0xd')](_0x4f3c('0xb'),_0x26f613,_0x536665);_0x28abdf(_0x536665);});});} \ No newline at end of file +var _0x4f49=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x66eb98,_0x58c8fc){var _0x2ef5a7=function(_0x27204b){while(--_0x27204b){_0x66eb98['push'](_0x66eb98['shift']());}};_0x2ef5a7(++_0x58c8fc);}(_0x4f49,0xd2));var _0x94f4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4f49[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x94f4('0x0'));var util=require(_0x94f4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x94f4('0x2'));var fs=require('fs');var Redis=require(_0x94f4('0x3'));var db=require(_0x94f4('0x4'))['db'];var utils=require(_0x94f4('0x5'));var logger=require(_0x94f4('0x6'))('rpc');var config=require(_0x94f4('0x7'));var jayson=require(_0x94f4('0x8'));var client=jayson[_0x94f4('0x9')][_0x94f4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb7bdda,_0x974b46,_0x4626f5){return new BPromise(function(_0x446394,_0xb13d65){return client[_0x94f4('0xb')](_0xb7bdda,_0x4626f5)[_0x94f4('0xc')](function(_0x2d099a){logger[_0x94f4('0xd')](_0x94f4('0xe'),_0x974b46,_0x94f4('0xf'));logger[_0x94f4('0x10')](_0x94f4('0x11'),_0x974b46,_0x94f4('0xf'),JSON[_0x94f4('0x12')](_0x2d099a));if(_0x2d099a[_0x94f4('0x13')]){if(_0x2d099a['error']['code']===0x1f4){logger['error'](_0x94f4('0xe'),_0x974b46,_0x2d099a[_0x94f4('0x13')][_0x94f4('0x14')]);return _0xb13d65(_0x2d099a[_0x94f4('0x13')][_0x94f4('0x14')]);}logger[_0x94f4('0x13')](_0x94f4('0xe'),_0x974b46,_0x2d099a[_0x94f4('0x13')][_0x94f4('0x14')]);return _0x446394(_0x2d099a[_0x94f4('0x13')][_0x94f4('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x974b46,'request\x20sent');_0x446394(_0x2d099a[_0x94f4('0x15')][_0x94f4('0x14')]);}})[_0x94f4('0x16')](function(_0x5ee171){logger['error'](_0x94f4('0xe'),_0x974b46,_0x5ee171);_0xb13d65(_0x5ee171);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 9c5532e..99e804a 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 _0xc775=['put','/:id','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','create'];(function(_0x33d615,_0x1a5af7){var _0x254611=function(_0x23c410){while(--_0x23c410){_0x33d615['push'](_0x33d615['shift']());}};_0x254611(++_0x1a5af7);}(_0xc775,0xd4));var _0x5c77=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xc775[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x5c77('0x0'));var path=require(_0x5c77('0x1'));var timeout=require(_0x5c77('0x2'));var express=require(_0x5c77('0x3'));var router=express[_0x5c77('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5c77('0x5'));var interaction=require(_0x5c77('0x6'));var config=require(_0x5c77('0x7'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5c77('0x8')]);router[_0x5c77('0x9')]('/:id',auth[_0x5c77('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5c77('0xb')]);router[_0x5c77('0xc')](_0x5c77('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5c77('0xd'),auth[_0x5c77('0xa')](),controller[_0x5c77('0xe')]);module[_0x5c77('0xf')]=router; \ No newline at end of file +var _0x65c4=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x3eef2d,_0x5631b5){var _0x46ca06=function(_0x4141d5){while(--_0x4141d5){_0x3eef2d['push'](_0x3eef2d['shift']());}};_0x46ca06(++_0x5631b5);}(_0x65c4,0x155));var _0x465c=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0x65c4[_0x18afca];return _0x11603f;};'use strict';var multer=require(_0x465c('0x0'));var util=require(_0x465c('0x1'));var path=require('path');var timeout=require(_0x465c('0x2'));var express=require(_0x465c('0x3'));var router=express['Router']();var fs_extra=require(_0x465c('0x4'));var auth=require(_0x465c('0x5'));var interaction=require(_0x465c('0x6'));var config=require(_0x465c('0x7'));var controller=require(_0x465c('0x8'));router['get']('/',auth[_0x465c('0x9')](),controller[_0x465c('0xa')]);router[_0x465c('0xb')](_0x465c('0xc'),auth['isAuthenticated'](),controller[_0x465c('0xd')]);router[_0x465c('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x465c('0xf')](_0x465c('0xc'),auth[_0x465c('0x9')](),controller[_0x465c('0x10')]);router['delete'](_0x465c('0xc'),auth[_0x465c('0x9')](),controller[_0x465c('0x11')]);module[_0x465c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 9d554cd..5c208ad 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 _0x9013=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','sequelize','exports'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x9013,0xbb));var _0x3901=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9013[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x3901('0x0'));module[_0x3901('0x1')]={'type':{'type':Sequelize[_0x3901('0x2')](_0x3901('0x3'),_0x3901('0x4'),_0x3901('0x5'),_0x3901('0x6'),_0x3901('0x7')),'defaultValue':_0x3901('0x3')},'content':{'type':Sequelize[_0x3901('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3901('0x2')]('string',_0x3901('0x4'),_0x3901('0x5'))},'keyContent':{'type':Sequelize[_0x3901('0x8')]},'idField':{'type':Sequelize[_0x3901('0x8')]},'nameField':{'type':Sequelize[_0x3901('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc93f=['STRING','BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x5ec893,_0x55a18b){var _0x4497e5=function(_0x1d429d){while(--_0x1d429d){_0x5ec893['push'](_0x5ec893['shift']());}};_0x4497e5(++_0x55a18b);}(_0xc93f,0x161));var _0xfc93=function(_0x139c46,_0x37530d){_0x139c46=_0x139c46-0x0;var _0xfce12b=_0xc93f[_0x139c46];return _0xfce12b;};'use strict';var Sequelize=require(_0xfc93('0x0'));module['exports']={'type':{'type':Sequelize[_0xfc93('0x1')](_0xfc93('0x2'),_0xfc93('0x3'),_0xfc93('0x4'),_0xfc93('0x5'),_0xfc93('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfc93('0x7')]},'key':{'type':Sequelize[_0xfc93('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xfc93('0x2'),_0xfc93('0x3'),_0xfc93('0x4'))},'keyContent':{'type':Sequelize[_0xfc93('0x7')]},'idField':{'type':Sequelize[_0xfc93('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfc93('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 56c4c47..4576c88 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 _0xb87e=['limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x5a93f0,_0x172b1b){var _0x53844d=function(_0x19ba69){while(--_0x19ba69){_0x5a93f0['push'](_0x5a93f0['shift']());}};_0x53844d(++_0x172b1b);}(_0xb87e,0x1b5));var _0xeb87=function(_0x53a9e7,_0x586464){_0x53a9e7=_0x53a9e7-0x0;var _0x363b50=_0xb87e[_0x53a9e7];return _0x363b50;};'use strict';var emlformat=require(_0xeb87('0x0'));var rimraf=require(_0xeb87('0x1'));var zipdir=require(_0xeb87('0x2'));var jsonpatch=require(_0xeb87('0x3'));var rp=require(_0xeb87('0x4'));var moment=require(_0xeb87('0x5'));var BPromise=require(_0xeb87('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xeb87('0x7'));var sox=require(_0xeb87('0x8'));var csv=require(_0xeb87('0x9'));var ejs=require(_0xeb87('0xa'));var fs=require('fs');var fs_extra=require(_0xeb87('0xb'));var _=require(_0xeb87('0xc'));var squel=require(_0xeb87('0xd'));var crypto=require(_0xeb87('0xe'));var jsforce=require(_0xeb87('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeb87('0x9'));var querystring=require(_0xeb87('0x10'));var Papa=require(_0xeb87('0x11'));var Redis=require(_0xeb87('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb87('0x13'));var logger=require(_0xeb87('0x14'))(_0xeb87('0x15'));var utils=require(_0xeb87('0x16'));var config=require(_0xeb87('0x17'));var licenseUtil=require(_0xeb87('0x18'));var db=require(_0xeb87('0x19'))['db'];function respondWithStatusCode(_0x5a627b,_0x24d1e9){_0x24d1e9=_0x24d1e9||0xcc;return function(_0x5552a1){if(_0x5552a1){return _0x5a627b[_0xeb87('0x1a')](_0x24d1e9);}return _0x5a627b[_0xeb87('0x1b')](_0x24d1e9)['end']();};}function respondWithResult(_0x44ed05,_0x3f1da5){_0x3f1da5=_0x3f1da5||0xc8;return function(_0x1ec330){if(_0x1ec330){return _0x44ed05['status'](_0x3f1da5)[_0xeb87('0x1c')](_0x1ec330);}};}function respondWithFilteredResult(_0x290ed5,_0x15d517){return function(_0x26ace5){if(_0x26ace5){var _0x23fd89=typeof _0x15d517[_0xeb87('0x1d')]===_0xeb87('0x1e')&&typeof _0x15d517[_0xeb87('0x1f')]==='undefined';var _0x4ccf56=_0x26ace5[_0xeb87('0x20')];var _0x6f75ef=_0x23fd89?0x0:_0x15d517[_0xeb87('0x1d')];var _0xdb24a0=_0x23fd89?_0x26ace5['count']:_0x15d517[_0xeb87('0x1d')]+_0x15d517[_0xeb87('0x1f')];var _0x133eeb;if(_0xdb24a0>=_0x4ccf56){_0xdb24a0=_0x4ccf56;_0x133eeb=0xc8;}else{_0x133eeb=0xce;}_0x290ed5[_0xeb87('0x1b')](_0x133eeb);return _0x290ed5[_0xeb87('0x21')](_0xeb87('0x22'),_0x6f75ef+'-'+_0xdb24a0+'/'+_0x4ccf56)[_0xeb87('0x1c')](_0x26ace5);}return null;};}function patchUpdates(_0x13e623){return function(_0x5d0cb2){try{jsonpatch[_0xeb87('0x23')](_0x5d0cb2,_0x13e623,!![]);}catch(_0x3144ce){return BPromise[_0xeb87('0x24')](_0x3144ce);}return _0x5d0cb2[_0xeb87('0x25')]();};}function saveUpdates(_0x33a90a,_0x242deb){return function(_0x5bb5ce){if(_0x5bb5ce){return _0x5bb5ce[_0xeb87('0x26')](_0x33a90a)[_0xeb87('0x27')](function(_0x309d3){return _0x309d3;});}return null;};}function removeEntity(_0x5a288b,_0x37ff97){return function(_0x586aa3){if(_0x586aa3){return _0x586aa3[_0xeb87('0x28')]()[_0xeb87('0x27')](function(){_0x5a288b[_0xeb87('0x1b')](0xcc)[_0xeb87('0x29')]();});}};}function handleEntityNotFound(_0x5f4758,_0x13420b){return function(_0x3e3539){if(!_0x3e3539){_0x5f4758[_0xeb87('0x1a')](0x194);}return _0x3e3539;};}function handleError(_0x3c2d72,_0x419081){_0x419081=_0x419081||0x1f4;return function(_0x5f4196){logger[_0xeb87('0x2a')](_0x5f4196[_0xeb87('0x2b')]);if(_0x5f4196[_0xeb87('0x2c')]){delete _0x5f4196[_0xeb87('0x2c')];}_0x3c2d72[_0xeb87('0x1b')](_0x419081)[_0xeb87('0x2d')](_0x5f4196);};}exports['index']=function(_0x58f8be,_0x35a15e){var _0x3d1b67={},_0x3e5250={},_0x3334ab={'count':0x0,'rows':[]};var _0x3e2e8c=_[_0xeb87('0x2e')](db[_0xeb87('0x2f')][_0xeb87('0x30')],function(_0x1e9a21){return{'name':_0x1e9a21[_0xeb87('0x31')],'type':_0x1e9a21[_0xeb87('0x32')][_0xeb87('0x33')]};});_0x3e5250[_0xeb87('0x34')]=_[_0xeb87('0x2e')](_0x3e2e8c,_0xeb87('0x2c'));_0x3e5250[_0xeb87('0x35')]=_[_0xeb87('0x36')](_0x58f8be[_0xeb87('0x35')]);_0x3e5250[_0xeb87('0x37')]=_['intersection'](_0x3e5250['model'],_0x3e5250[_0xeb87('0x35')]);_0x3d1b67[_0xeb87('0x38')]=_['intersection'](_0x3e5250[_0xeb87('0x34')],qs[_0xeb87('0x39')](_0x58f8be[_0xeb87('0x35')][_0xeb87('0x39')]));_0x3d1b67[_0xeb87('0x38')]=_0x3d1b67['attributes'][_0xeb87('0x3a')]?_0x3d1b67[_0xeb87('0x38')]:_0x3e5250[_0xeb87('0x34')];if(!_0x58f8be[_0xeb87('0x35')][_0xeb87('0x3b')]('nolimit')){_0x3d1b67[_0xeb87('0x1f')]=qs['limit'](_0x58f8be[_0xeb87('0x35')][_0xeb87('0x1f')]);_0x3d1b67[_0xeb87('0x1d')]=qs['offset'](_0x58f8be[_0xeb87('0x35')][_0xeb87('0x1d')]);}_0x3d1b67[_0xeb87('0x3c')]=qs[_0xeb87('0x3d')](_0x58f8be[_0xeb87('0x35')]['sort']);_0x3d1b67[_0xeb87('0x3e')]=qs[_0xeb87('0x37')](_[_0xeb87('0x3f')](_0x58f8be['query'],_0x3e5250[_0xeb87('0x37')]),_0x3e2e8c);if(_0x58f8be[_0xeb87('0x35')][_0xeb87('0x40')]){_0x3d1b67['where']=_[_0xeb87('0x41')](_0x3d1b67['where'],{'$or':_[_0xeb87('0x2e')](_0x3e2e8c,function(_0x1ce046){if(_0x1ce046['type']!=='VIRTUAL'){var _0x376705={};_0x376705[_0x1ce046[_0xeb87('0x2c')]]={'$like':'%'+_0x58f8be[_0xeb87('0x35')][_0xeb87('0x40')]+'%'};return _0x376705;}})});}_0x3d1b67=_['merge']({},_0x3d1b67,_0x58f8be[_0xeb87('0x42')]);var _0x3bdd91={'where':_0x3d1b67[_0xeb87('0x3e')]};return db[_0xeb87('0x2f')][_0xeb87('0x20')](_0x3bdd91)[_0xeb87('0x27')](function(_0x519208){_0x3334ab[_0xeb87('0x20')]=_0x519208;if(_0x58f8be[_0xeb87('0x35')][_0xeb87('0x43')]){_0x3d1b67[_0xeb87('0x44')]=[{'all':!![]}];}return db['SugarcrmField'][_0xeb87('0x45')](_0x3d1b67);})[_0xeb87('0x27')](function(_0xa0935c){_0x3334ab[_0xeb87('0x46')]=_0xa0935c;return _0x3334ab;})[_0xeb87('0x27')](respondWithFilteredResult(_0x35a15e,_0x3d1b67))[_0xeb87('0x47')](handleError(_0x35a15e,null));};exports[_0xeb87('0x48')]=function(_0x3eef53,_0x150d56){var _0x1e5963={'raw':!![],'where':{'id':_0x3eef53[_0xeb87('0x49')]['id']}},_0xa03bec={};_0xa03bec['model']=_[_0xeb87('0x36')](db[_0xeb87('0x2f')][_0xeb87('0x30')]);_0xa03bec[_0xeb87('0x35')]=_['keys'](_0x3eef53[_0xeb87('0x35')]);_0xa03bec[_0xeb87('0x37')]=_[_0xeb87('0x4a')](_0xa03bec[_0xeb87('0x34')],_0xa03bec['query']);_0x1e5963[_0xeb87('0x38')]=_[_0xeb87('0x4a')](_0xa03bec['model'],qs[_0xeb87('0x39')](_0x3eef53[_0xeb87('0x35')][_0xeb87('0x39')]));_0x1e5963[_0xeb87('0x38')]=_0x1e5963[_0xeb87('0x38')][_0xeb87('0x3a')]?_0x1e5963[_0xeb87('0x38')]:_0xa03bec['model'];if(_0x3eef53[_0xeb87('0x35')][_0xeb87('0x43')]){_0x1e5963[_0xeb87('0x44')]=[{'all':!![]}];}_0x1e5963=_[_0xeb87('0x41')]({},_0x1e5963,_0x3eef53[_0xeb87('0x42')]);return db[_0xeb87('0x2f')][_0xeb87('0x4b')](_0x1e5963)[_0xeb87('0x27')](handleEntityNotFound(_0x150d56,null))[_0xeb87('0x27')](respondWithResult(_0x150d56,null))[_0xeb87('0x47')](handleError(_0x150d56,null));};exports[_0xeb87('0x4c')]=function(_0x1be94c,_0x5c62ea){return db[_0xeb87('0x2f')][_0xeb87('0x4c')](_0x1be94c[_0xeb87('0x4d')],{})[_0xeb87('0x27')](respondWithResult(_0x5c62ea,0xc9))['catch'](handleError(_0x5c62ea,null));};exports[_0xeb87('0x26')]=function(_0x521496,_0x414f5d){if(_0x521496[_0xeb87('0x4d')]['id']){delete _0x521496['body']['id'];}return db[_0xeb87('0x2f')][_0xeb87('0x4b')]({'where':{'id':_0x521496[_0xeb87('0x49')]['id']}})[_0xeb87('0x27')](handleEntityNotFound(_0x414f5d,null))[_0xeb87('0x27')](saveUpdates(_0x521496[_0xeb87('0x4d')],null))['then'](respondWithResult(_0x414f5d,null))['catch'](handleError(_0x414f5d,null));};exports[_0xeb87('0x28')]=function(_0x135831,_0x41bb06){return db[_0xeb87('0x2f')][_0xeb87('0x4b')]({'where':{'id':_0x135831[_0xeb87('0x49')]['id']}})[_0xeb87('0x27')](handleEntityNotFound(_0x41bb06,null))[_0xeb87('0x27')](removeEntity(_0x41bb06,null))[_0xeb87('0x47')](handleError(_0x41bb06,null));}; \ No newline at end of file +var _0x4d50=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','stack','name','map','SugarcrmField','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','then','rows','catch','params','rawAttributes','options','find','create','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x22729c,_0x558cfb){var _0x51421f=function(_0x1347c9){while(--_0x1347c9){_0x22729c['push'](_0x22729c['shift']());}};_0x51421f(++_0x558cfb);}(_0x4d50,0xd1));var _0x04d5=function(_0x5dee0a,_0x18e36f){_0x5dee0a=_0x5dee0a-0x0;var _0x36ea55=_0x4d50[_0x5dee0a];return _0x36ea55;};'use strict';var emlformat=require(_0x04d5('0x0'));var rimraf=require(_0x04d5('0x1'));var zipdir=require(_0x04d5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x04d5('0x3'));var BPromise=require(_0x04d5('0x4'));var Mustache=require(_0x04d5('0x5'));var util=require(_0x04d5('0x6'));var path=require(_0x04d5('0x7'));var sox=require(_0x04d5('0x8'));var csv=require(_0x04d5('0x9'));var ejs=require(_0x04d5('0xa'));var fs=require('fs');var fs_extra=require(_0x04d5('0xb'));var _=require(_0x04d5('0xc'));var squel=require(_0x04d5('0xd'));var crypto=require(_0x04d5('0xe'));var jsforce=require(_0x04d5('0xf'));var deskjs=require(_0x04d5('0x10'));var toCsv=require(_0x04d5('0x9'));var querystring=require(_0x04d5('0x11'));var Papa=require(_0x04d5('0x12'));var Redis=require(_0x04d5('0x13'));var authService=require(_0x04d5('0x14'));var qs=require(_0x04d5('0x15'));var as=require(_0x04d5('0x16'));var hardwareService=require(_0x04d5('0x17'));var logger=require(_0x04d5('0x18'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x04d5('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a969c,_0x2a674d){_0x2a674d=_0x2a674d||0xcc;return function(_0x567338){if(_0x567338){return _0x4a969c[_0x04d5('0x1a')](_0x2a674d);}return _0x4a969c['status'](_0x2a674d)['end']();};}function respondWithResult(_0x531827,_0x19cf4d){_0x19cf4d=_0x19cf4d||0xc8;return function(_0x49255a){if(_0x49255a){return _0x531827[_0x04d5('0x1b')](_0x19cf4d)[_0x04d5('0x1c')](_0x49255a);}};}function respondWithFilteredResult(_0x297e9e,_0xaa51bb){return function(_0x40d8b0){if(_0x40d8b0){var _0x4d3b95=typeof _0xaa51bb[_0x04d5('0x1d')]==='undefined'&&typeof _0xaa51bb[_0x04d5('0x1e')]===_0x04d5('0x1f');var _0x3ea736=_0x40d8b0[_0x04d5('0x20')];var _0xa31497=_0x4d3b95?0x0:_0xaa51bb[_0x04d5('0x1d')];var _0x43985d=_0x4d3b95?_0x40d8b0['count']:_0xaa51bb[_0x04d5('0x1d')]+_0xaa51bb[_0x04d5('0x1e')];var _0x505a9c;if(_0x43985d>=_0x3ea736){_0x43985d=_0x3ea736;_0x505a9c=0xc8;}else{_0x505a9c=0xce;}_0x297e9e[_0x04d5('0x1b')](_0x505a9c);return _0x297e9e[_0x04d5('0x21')](_0x04d5('0x22'),_0xa31497+'-'+_0x43985d+'/'+_0x3ea736)[_0x04d5('0x1c')](_0x40d8b0);}return null;};}function patchUpdates(_0x14098b){return function(_0x5a03f8){try{jsonpatch[_0x04d5('0x23')](_0x5a03f8,_0x14098b,!![]);}catch(_0x18c823){return BPromise[_0x04d5('0x24')](_0x18c823);}return _0x5a03f8[_0x04d5('0x25')]();};}function saveUpdates(_0x54509d,_0x18e4ec){return function(_0xb34b8c){if(_0xb34b8c){return _0xb34b8c['update'](_0x54509d)['then'](function(_0xd3eb25){return _0xd3eb25;});}return null;};}function removeEntity(_0xb4a0ca,_0x45dd0a){return function(_0x114d72){if(_0x114d72){return _0x114d72[_0x04d5('0x26')]()['then'](function(){_0xb4a0ca[_0x04d5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a2336,_0xb6960c){return function(_0xbb05aa){if(!_0xbb05aa){_0x1a2336[_0x04d5('0x1a')](0x194);}return _0xbb05aa;};}function handleError(_0x2f74e2,_0x58298f){_0x58298f=_0x58298f||0x1f4;return function(_0x3c873e){logger['error'](_0x3c873e[_0x04d5('0x27')]);if(_0x3c873e[_0x04d5('0x28')]){delete _0x3c873e[_0x04d5('0x28')];}_0x2f74e2['status'](_0x58298f)['send'](_0x3c873e);};}exports['index']=function(_0x4cc6af,_0x14fe64){var _0x1ed7b6={},_0x5c1375={},_0x14305b={'count':0x0,'rows':[]};var _0x4c85c8=_[_0x04d5('0x29')](db[_0x04d5('0x2a')]['rawAttributes'],function(_0x47a3b9){return{'name':_0x47a3b9[_0x04d5('0x2b')],'type':_0x47a3b9[_0x04d5('0x2c')][_0x04d5('0x2d')]};});_0x5c1375['model']=_[_0x04d5('0x29')](_0x4c85c8,_0x04d5('0x28'));_0x5c1375[_0x04d5('0x2e')]=_[_0x04d5('0x2f')](_0x4cc6af['query']);_0x5c1375[_0x04d5('0x30')]=_['intersection'](_0x5c1375['model'],_0x5c1375[_0x04d5('0x2e')]);_0x1ed7b6['attributes']=_[_0x04d5('0x31')](_0x5c1375['model'],qs[_0x04d5('0x32')](_0x4cc6af[_0x04d5('0x2e')][_0x04d5('0x32')]));_0x1ed7b6['attributes']=_0x1ed7b6[_0x04d5('0x33')][_0x04d5('0x34')]?_0x1ed7b6[_0x04d5('0x33')]:_0x5c1375[_0x04d5('0x35')];if(!_0x4cc6af[_0x04d5('0x2e')][_0x04d5('0x36')](_0x04d5('0x37'))){_0x1ed7b6[_0x04d5('0x1e')]=qs[_0x04d5('0x1e')](_0x4cc6af[_0x04d5('0x2e')]['limit']);_0x1ed7b6[_0x04d5('0x1d')]=qs['offset'](_0x4cc6af['query'][_0x04d5('0x1d')]);}_0x1ed7b6[_0x04d5('0x38')]=qs[_0x04d5('0x39')](_0x4cc6af[_0x04d5('0x2e')][_0x04d5('0x39')]);_0x1ed7b6[_0x04d5('0x3a')]=qs['filters'](_[_0x04d5('0x3b')](_0x4cc6af[_0x04d5('0x2e')],_0x5c1375[_0x04d5('0x30')]),_0x4c85c8);if(_0x4cc6af[_0x04d5('0x2e')][_0x04d5('0x3c')]){_0x1ed7b6['where']=_[_0x04d5('0x3d')](_0x1ed7b6[_0x04d5('0x3a')],{'$or':_[_0x04d5('0x29')](_0x4c85c8,function(_0x1a63f8){if(_0x1a63f8['type']!==_0x04d5('0x3e')){var _0x178a59={};_0x178a59[_0x1a63f8[_0x04d5('0x28')]]={'$like':'%'+_0x4cc6af[_0x04d5('0x2e')]['filter']+'%'};return _0x178a59;}})});}_0x1ed7b6=_[_0x04d5('0x3d')]({},_0x1ed7b6,_0x4cc6af['options']);var _0x402433={'where':_0x1ed7b6['where']};return db['SugarcrmField'][_0x04d5('0x20')](_0x402433)['then'](function(_0x2d8efc){_0x14305b[_0x04d5('0x20')]=_0x2d8efc;if(_0x4cc6af[_0x04d5('0x2e')][_0x04d5('0x3f')]){_0x1ed7b6[_0x04d5('0x40')]=[{'all':!![]}];}return db[_0x04d5('0x2a')][_0x04d5('0x41')](_0x1ed7b6);})[_0x04d5('0x42')](function(_0x406b79){_0x14305b[_0x04d5('0x43')]=_0x406b79;return _0x14305b;})[_0x04d5('0x42')](respondWithFilteredResult(_0x14fe64,_0x1ed7b6))[_0x04d5('0x44')](handleError(_0x14fe64,null));};exports['show']=function(_0x3e04ac,_0x549762){var _0x17a5fe={'raw':!![],'where':{'id':_0x3e04ac[_0x04d5('0x45')]['id']}},_0x4c9f53={};_0x4c9f53[_0x04d5('0x35')]=_[_0x04d5('0x2f')](db[_0x04d5('0x2a')][_0x04d5('0x46')]);_0x4c9f53[_0x04d5('0x2e')]=_['keys'](_0x3e04ac['query']);_0x4c9f53['filters']=_[_0x04d5('0x31')](_0x4c9f53[_0x04d5('0x35')],_0x4c9f53[_0x04d5('0x2e')]);_0x17a5fe[_0x04d5('0x33')]=_[_0x04d5('0x31')](_0x4c9f53[_0x04d5('0x35')],qs[_0x04d5('0x32')](_0x3e04ac['query'][_0x04d5('0x32')]));_0x17a5fe[_0x04d5('0x33')]=_0x17a5fe[_0x04d5('0x33')][_0x04d5('0x34')]?_0x17a5fe[_0x04d5('0x33')]:_0x4c9f53[_0x04d5('0x35')];if(_0x3e04ac[_0x04d5('0x2e')]['includeAll']){_0x17a5fe[_0x04d5('0x40')]=[{'all':!![]}];}_0x17a5fe=_[_0x04d5('0x3d')]({},_0x17a5fe,_0x3e04ac[_0x04d5('0x47')]);return db[_0x04d5('0x2a')][_0x04d5('0x48')](_0x17a5fe)[_0x04d5('0x42')](handleEntityNotFound(_0x549762,null))[_0x04d5('0x42')](respondWithResult(_0x549762,null))[_0x04d5('0x44')](handleError(_0x549762,null));};exports[_0x04d5('0x49')]=function(_0x46cf35,_0x4817f5){return db['SugarcrmField'][_0x04d5('0x49')](_0x46cf35['body'],{})[_0x04d5('0x42')](respondWithResult(_0x4817f5,0xc9))[_0x04d5('0x44')](handleError(_0x4817f5,null));};exports[_0x04d5('0x4a')]=function(_0x52156a,_0x7feba5){if(_0x52156a[_0x04d5('0x4b')]['id']){delete _0x52156a['body']['id'];}return db['SugarcrmField'][_0x04d5('0x48')]({'where':{'id':_0x52156a['params']['id']}})[_0x04d5('0x42')](handleEntityNotFound(_0x7feba5,null))[_0x04d5('0x42')](saveUpdates(_0x52156a['body'],null))[_0x04d5('0x42')](respondWithResult(_0x7feba5,null))[_0x04d5('0x44')](handleError(_0x7feba5,null));};exports[_0x04d5('0x26')]=function(_0x20d5b1,_0x47fbe7){return db[_0x04d5('0x2a')][_0x04d5('0x48')]({'where':{'id':_0x20d5b1[_0x04d5('0x45')]['id']}})[_0x04d5('0x42')](handleEntityNotFound(_0x47fbe7,null))['then'](removeEntity(_0x47fbe7,null))[_0x04d5('0x44')](handleError(_0x47fbe7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 244a8d7..b97e85c 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 _0x5336=['request-promise','path','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34620e,_0x582015){var _0x3d33cd=function(_0x19dc7f){while(--_0x19dc7f){_0x34620e['push'](_0x34620e['shift']());}};_0x3d33cd(++_0x582015);}(_0x5336,0x14a));var _0x6533=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x5336[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x6533('0x0'));var util=require(_0x6533('0x1'));var logger=require(_0x6533('0x2'))(_0x6533('0x3'));var moment=require(_0x6533('0x4'));var BPromise=require(_0x6533('0x5'));var rp=require(_0x6533('0x6'));var fs=require('fs');var path=require(_0x6533('0x7'));var rimraf=require('rimraf');var config=require(_0x6533('0x8'));var attributes=require(_0x6533('0x9'));module['exports']=function(_0x5c6e73,_0xb9e180){return _0x5c6e73[_0x6533('0xa')](_0x6533('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x6533('0xc'),_0x6533('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaa45=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','FieldId','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x9b56bb,_0x2f7341){var _0x404ad1=function(_0x1c2a8a){while(--_0x1c2a8a){_0x9b56bb['push'](_0x9b56bb['shift']());}};_0x404ad1(++_0x2f7341);}(_0xaa45,0x94));var _0x5aa4=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xaa45[_0x1034ca];return _0x1a023a;};'use strict';var _=require('lodash');var util=require(_0x5aa4('0x0'));var logger=require(_0x5aa4('0x1'))('api');var moment=require(_0x5aa4('0x2'));var BPromise=require(_0x5aa4('0x3'));var rp=require(_0x5aa4('0x4'));var fs=require('fs');var path=require(_0x5aa4('0x5'));var rimraf=require(_0x5aa4('0x6'));var config=require(_0x5aa4('0x7'));var attributes=require(_0x5aa4('0x8'));module[_0x5aa4('0x9')]=function(_0x14f71a,_0xf90998){return _0x14f71a[_0x5aa4('0xa')](_0x5aa4('0xb'),attributes,{'tableName':_0x5aa4('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':['idField',_0x5aa4('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index d3e2b4d..093b87d 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 _0x9206=['../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5b04e9,_0x20b5af){var _0x18a96e=function(_0x4cf7b7){while(--_0x4cf7b7){_0x5b04e9['push'](_0x5b04e9['shift']());}};_0x18a96e(++_0x20b5af);}(_0x9206,0x1f1));var _0x6920=function(_0x39f1d5,_0x1b875c){_0x39f1d5=_0x39f1d5-0x0;var _0x1d452f=_0x9206[_0x39f1d5];return _0x1d452f;};'use strict';var _=require('lodash');var util=require(_0x6920('0x0'));var moment=require(_0x6920('0x1'));var BPromise=require(_0x6920('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6920('0x3'))['db'];var utils=require(_0x6920('0x4'));var logger=require(_0x6920('0x5'))(_0x6920('0x6'));var config=require(_0x6920('0x7'));var jayson=require(_0x6920('0x8'));var client=jayson[_0x6920('0x9')][_0x6920('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16e099,_0x5e1478,_0xd9197b){return new BPromise(function(_0x126be4,_0xd156c7){return client[_0x6920('0xb')](_0x16e099,_0xd9197b)[_0x6920('0xc')](function(_0x1eed8e){logger[_0x6920('0xd')](_0x6920('0xe'),_0x5e1478,'request\x20sent');logger[_0x6920('0xf')](_0x6920('0x10'),_0x5e1478,_0x6920('0x11'),JSON[_0x6920('0x12')](_0x1eed8e));if(_0x1eed8e[_0x6920('0x13')]){if(_0x1eed8e['error'][_0x6920('0x14')]===0x1f4){logger[_0x6920('0x13')](_0x6920('0xe'),_0x5e1478,_0x1eed8e[_0x6920('0x13')][_0x6920('0x15')]);return _0xd156c7(_0x1eed8e[_0x6920('0x13')]['message']);}logger['error'](_0x6920('0xe'),_0x5e1478,_0x1eed8e[_0x6920('0x13')]['message']);return _0x126be4(_0x1eed8e['error'][_0x6920('0x15')]);}else{logger[_0x6920('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x5e1478,_0x6920('0x11'));_0x126be4(_0x1eed8e[_0x6920('0x16')][_0x6920('0x15')]);}})[_0x6920('0x17')](function(_0x11e7af){logger['error'](_0x6920('0xe'),_0x5e1478,_0x11e7af);_0xd156c7(_0x11e7af);});});} \ No newline at end of file +var _0xf232=['util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch'];(function(_0x1a8f86,_0x5ed9c4){var _0x20d876=function(_0x596e1b){while(--_0x596e1b){_0x1a8f86['push'](_0x1a8f86['shift']());}};_0x20d876(++_0x5ed9c4);}(_0xf232,0xa8));var _0x2f23=function(_0x50ea1f,_0x3dcbf5){_0x50ea1f=_0x50ea1f-0x0;var _0x4bb74e=_0xf232[_0x50ea1f];return _0x4bb74e;};'use strict';var _=require('lodash');var util=require(_0x2f23('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f23('0x1'));var fs=require('fs');var Redis=require(_0x2f23('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2f23('0x3'))(_0x2f23('0x4'));var config=require(_0x2f23('0x5'));var jayson=require(_0x2f23('0x6'));var client=jayson[_0x2f23('0x7')][_0x2f23('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41128a,_0x230e42,_0x2d75b3){return new BPromise(function(_0x4ab90f,_0x279a38){return client[_0x2f23('0x9')](_0x41128a,_0x2d75b3)[_0x2f23('0xa')](function(_0x42752d){logger[_0x2f23('0xb')](_0x2f23('0xc'),_0x230e42,_0x2f23('0xd'));logger['debug'](_0x2f23('0xe'),_0x230e42,'request\x20sent',JSON[_0x2f23('0xf')](_0x42752d));if(_0x42752d['error']){if(_0x42752d['error'][_0x2f23('0x10')]===0x1f4){logger[_0x2f23('0x11')](_0x2f23('0xc'),_0x230e42,_0x42752d[_0x2f23('0x11')][_0x2f23('0x12')]);return _0x279a38(_0x42752d[_0x2f23('0x11')][_0x2f23('0x12')]);}logger['error'](_0x2f23('0xc'),_0x230e42,_0x42752d[_0x2f23('0x11')][_0x2f23('0x12')]);return _0x4ab90f(_0x42752d[_0x2f23('0x11')][_0x2f23('0x12')]);}else{logger[_0x2f23('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x230e42,'request\x20sent');_0x4ab90f(_0x42752d[_0x2f23('0x13')]['message']);}})[_0x2f23('0x14')](function(_0x523edf){logger[_0x2f23('0x11')](_0x2f23('0xc'),_0x230e42,_0x523edf);_0x279a38(_0x523edf);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index b74adcf..6624e28 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 _0xbb91=['isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0x32c018,_0xf9491c){var _0x2ffb15=function(_0x2ad00d){while(--_0x2ad00d){_0x32c018['push'](_0x32c018['shift']());}};_0x2ffb15(++_0xf9491c);}(_0xbb91,0xce));var _0x1bb9=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0xbb91[_0x4828b1];return _0x1fec1b;};'use strict';var multer=require(_0x1bb9('0x0'));var util=require(_0x1bb9('0x1'));var path=require(_0x1bb9('0x2'));var timeout=require('connect-timeout');var express=require(_0x1bb9('0x3'));var router=express[_0x1bb9('0x4')]();var fs_extra=require(_0x1bb9('0x5'));var auth=require(_0x1bb9('0x6'));var interaction=require(_0x1bb9('0x7'));var config=require(_0x1bb9('0x8'));var controller=require(_0x1bb9('0x9'));router['get']('/',auth[_0x1bb9('0xa')](),controller[_0x1bb9('0xb')]);router[_0x1bb9('0xc')](_0x1bb9('0xd'),auth[_0x1bb9('0xa')](),controller['show']);router['get'](_0x1bb9('0xe'),auth[_0x1bb9('0xa')](),controller[_0x1bb9('0xf')]);router['get']('/:id/fields',auth[_0x1bb9('0xa')](),controller[_0x1bb9('0x10')]);router[_0x1bb9('0x11')]('/',auth[_0x1bb9('0xa')](),controller[_0x1bb9('0x12')]);router[_0x1bb9('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1bb9('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1bb9('0x14')]);router[_0x1bb9('0x15')](_0x1bb9('0xd'),auth[_0x1bb9('0xa')](),controller[_0x1bb9('0x16')]);module[_0x1bb9('0x17')]=router; \ No newline at end of file +var _0xa5c0=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','index','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','/:id','update','delete','destroy','exports','multer'];(function(_0x2fc1f6,_0x34dbc3){var _0x3f2bdc=function(_0xd395f0){while(--_0xd395f0){_0x2fc1f6['push'](_0x2fc1f6['shift']());}};_0x3f2bdc(++_0x34dbc3);}(_0xa5c0,0xbf));var _0x0a5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5c0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0a5c('0x0'));var util=require(_0x0a5c('0x1'));var path=require(_0x0a5c('0x2'));var timeout=require('connect-timeout');var express=require(_0x0a5c('0x3'));var router=express[_0x0a5c('0x4')]();var fs_extra=require(_0x0a5c('0x5'));var auth=require(_0x0a5c('0x6'));var interaction=require(_0x0a5c('0x7'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x0a5c('0x8')]);router['get']('/:id',auth[_0x0a5c('0x9')](),controller[_0x0a5c('0xa')]);router[_0x0a5c('0xb')](_0x0a5c('0xc'),auth[_0x0a5c('0x9')](),controller[_0x0a5c('0xd')]);router[_0x0a5c('0xb')]('/:id/fields',auth[_0x0a5c('0x9')](),controller[_0x0a5c('0xe')]);router['post']('/',auth[_0x0a5c('0x9')](),controller[_0x0a5c('0xf')]);router[_0x0a5c('0x10')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a5c('0x11')]);router[_0x0a5c('0x12')](_0x0a5c('0x13'),auth[_0x0a5c('0x9')](),controller[_0x0a5c('0x14')]);router[_0x0a5c('0x15')](_0x0a5c('0x13'),auth[_0x0a5c('0x9')](),controller[_0x0a5c('0x16')]);module[_0x0a5c('0x17')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index a3cf77b..30b33b9 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 _0x54f7=['sequelize','STRING','HelpDesk'];(function(_0x7facef,_0xdb1c67){var _0x1ee9e9=function(_0x20a11b){while(--_0x20a11b){_0x7facef['push'](_0x7facef['shift']());}};_0x1ee9e9(++_0xdb1c67);}(_0x54f7,0x177));var _0x754f=function(_0x70986d,_0x19a05b){_0x70986d=_0x70986d-0x0;var _0x1d9dcd=_0x54f7[_0x70986d];return _0x1d9dcd;};'use strict';var Sequelize=require(_0x754f('0x0'));module['exports']={'name':{'type':Sequelize[_0x754f('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x754f('0x1')]},'username':{'type':Sequelize[_0x754f('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x754f('0x1')],'allowNull':![],'defaultValue':_0x754f('0x2')},'remoteUri':{'type':Sequelize[_0x754f('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x754f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x413a=['exports','STRING','sequelize'];(function(_0x5a2c7b,_0x441265){var _0x3ad931=function(_0x3a3b19){while(--_0x3a3b19){_0x5a2c7b['push'](_0x5a2c7b['shift']());}};_0x3ad931(++_0x441265);}(_0x413a,0x92));var _0xa413=function(_0x3b2f44,_0x1fbdb2){_0x3b2f44=_0x3b2f44-0x0;var _0x5ce33a=_0x413a[_0x3b2f44];return _0x5ce33a;};'use strict';var Sequelize=require(_0xa413('0x0'));module[_0xa413('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xa413('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xa413('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xa413('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xa413('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f7973fc..302b0ba 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 _0x6473=['mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','body','getConfigurations','VtigerConfiguration','hasOwnProperty','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','username','description','moduleName','accessKey','remoteUri','slice','format','GET','success','POST','login','token','describe','result','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','label','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x39314c,_0x17c98b){var _0x49696f=function(_0x5bb33a){while(--_0x5bb33a){_0x39314c['push'](_0x39314c['shift']());}};_0x49696f(++_0x17c98b);}(_0x6473,0x16b));var _0x3647=function(_0x1a31b5,_0x3dde6a){_0x1a31b5=_0x1a31b5-0x0;var _0x35da67=_0x6473[_0x1a31b5];return _0x35da67;};'use strict';var emlformat=require(_0x3647('0x0'));var rimraf=require(_0x3647('0x1'));var zipdir=require(_0x3647('0x2'));var jsonpatch=require(_0x3647('0x3'));var rp=require(_0x3647('0x4'));var moment=require(_0x3647('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3647('0x6'));var util=require(_0x3647('0x7'));var path=require(_0x3647('0x8'));var sox=require(_0x3647('0x9'));var csv=require(_0x3647('0xa'));var ejs=require(_0x3647('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x3647('0xc'));var deskjs=require(_0x3647('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3647('0xe'));var Papa=require(_0x3647('0xf'));var Redis=require(_0x3647('0x10'));var authService=require(_0x3647('0x11'));var qs=require(_0x3647('0x12'));var as=require(_0x3647('0x13'));var hardwareService=require(_0x3647('0x14'));var logger=require(_0x3647('0x15'))(_0x3647('0x16'));var utils=require(_0x3647('0x17'));var config=require(_0x3647('0x18'));var licenseUtil=require(_0x3647('0x19'));var db=require(_0x3647('0x1a'))['db'];var integrations=require(_0x3647('0x1b'));function respondWithStatusCode(_0x3f7241,_0x74eae1){_0x74eae1=_0x74eae1||0xcc;return function(_0x27555c){if(_0x27555c){return _0x3f7241[_0x3647('0x1c')](_0x74eae1);}return _0x3f7241[_0x3647('0x1d')](_0x74eae1)[_0x3647('0x1e')]();};}function respondWithResult(_0x206371,_0x36e651){_0x36e651=_0x36e651||0xc8;return function(_0x1fb47f){if(_0x1fb47f){return _0x206371[_0x3647('0x1d')](_0x36e651)[_0x3647('0x1f')](_0x1fb47f);}};}function respondWithFilteredResult(_0x54155f,_0x28ee22){return function(_0x1f39c9){if(_0x1f39c9){var _0x426d43=typeof _0x28ee22[_0x3647('0x20')]===_0x3647('0x21')&&typeof _0x28ee22['limit']===_0x3647('0x21');var _0x2838fb=_0x1f39c9[_0x3647('0x22')];var _0x495609=_0x426d43?0x0:_0x28ee22[_0x3647('0x20')];var _0x5115ca=_0x426d43?_0x1f39c9[_0x3647('0x22')]:_0x28ee22[_0x3647('0x20')]+_0x28ee22['limit'];var _0x216617;if(_0x5115ca>=_0x2838fb){_0x5115ca=_0x2838fb;_0x216617=0xc8;}else{_0x216617=0xce;}_0x54155f[_0x3647('0x1d')](_0x216617);return _0x54155f[_0x3647('0x23')](_0x3647('0x24'),_0x495609+'-'+_0x5115ca+'/'+_0x2838fb)['json'](_0x1f39c9);}return null;};}function patchUpdates(_0x1d7bee){return function(_0x5836a6){try{jsonpatch[_0x3647('0x25')](_0x5836a6,_0x1d7bee,!![]);}catch(_0x22fc58){return BPromise[_0x3647('0x26')](_0x22fc58);}return _0x5836a6[_0x3647('0x27')]();};}function saveUpdates(_0x560d9b,_0x1c70bf){return function(_0x40ce73){if(_0x40ce73){return _0x40ce73[_0x3647('0x28')](_0x560d9b)['then'](function(_0x36c32a){return _0x36c32a;});}return null;};}function removeEntity(_0x2f167b,_0x2c34a9){return function(_0x2026e5){if(_0x2026e5){return _0x2026e5[_0x3647('0x29')]()[_0x3647('0x2a')](function(){_0x2f167b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2aa725,_0x595f4e){return function(_0x571fcd){if(!_0x571fcd){_0x2aa725[_0x3647('0x1c')](0x194);}return _0x571fcd;};}function handleError(_0x27e16c,_0x36875d){_0x36875d=_0x36875d||0x1f4;return function(_0x13622c){logger[_0x3647('0x2b')](_0x13622c[_0x3647('0x2c')]);if(_0x13622c[_0x3647('0x2d')]){delete _0x13622c[_0x3647('0x2d')];}_0x27e16c[_0x3647('0x1d')](_0x36875d)[_0x3647('0x2e')](_0x13622c);};}exports[_0x3647('0x2f')]=function(_0x29c983,_0x506aad){var _0x147a77={},_0x2663df={},_0x4511a0={'count':0x0,'rows':[]};var _0x797880=_[_0x3647('0x30')](db[_0x3647('0x31')][_0x3647('0x32')],function(_0x3fc1f1){return{'name':_0x3fc1f1['fieldName'],'type':_0x3fc1f1[_0x3647('0x33')][_0x3647('0x34')]};});_0x2663df[_0x3647('0x35')]=_['map'](_0x797880,_0x3647('0x2d'));_0x2663df[_0x3647('0x36')]=_['keys'](_0x29c983[_0x3647('0x36')]);_0x2663df[_0x3647('0x37')]=_[_0x3647('0x38')](_0x2663df[_0x3647('0x35')],_0x2663df[_0x3647('0x36')]);_0x147a77[_0x3647('0x39')]=_[_0x3647('0x38')](_0x2663df[_0x3647('0x35')],qs['fields'](_0x29c983[_0x3647('0x36')][_0x3647('0x3a')]));_0x147a77[_0x3647('0x39')]=_0x147a77['attributes'][_0x3647('0x3b')]?_0x147a77[_0x3647('0x39')]:_0x2663df[_0x3647('0x35')];if(!_0x29c983['query']['hasOwnProperty'](_0x3647('0x3c'))){_0x147a77['limit']=qs[_0x3647('0x3d')](_0x29c983[_0x3647('0x36')][_0x3647('0x3d')]);_0x147a77[_0x3647('0x20')]=qs[_0x3647('0x20')](_0x29c983[_0x3647('0x36')][_0x3647('0x20')]);}_0x147a77[_0x3647('0x3e')]=qs[_0x3647('0x3f')](_0x29c983[_0x3647('0x36')][_0x3647('0x3f')]);_0x147a77[_0x3647('0x40')]=qs[_0x3647('0x37')](_[_0x3647('0x41')](_0x29c983[_0x3647('0x36')],_0x2663df[_0x3647('0x37')]),_0x797880);if(_0x29c983[_0x3647('0x36')][_0x3647('0x42')]){_0x147a77['where']=_[_0x3647('0x43')](_0x147a77[_0x3647('0x40')],{'$or':_[_0x3647('0x30')](_0x797880,function(_0x777c54){if(_0x777c54[_0x3647('0x33')]!=='VIRTUAL'){var _0xbfa34f={};_0xbfa34f[_0x777c54[_0x3647('0x2d')]]={'$like':'%'+_0x29c983[_0x3647('0x36')]['filter']+'%'};return _0xbfa34f;}})});}_0x147a77=_[_0x3647('0x43')]({},_0x147a77,_0x29c983[_0x3647('0x44')]);var _0x255928={'where':_0x147a77[_0x3647('0x40')]};return db[_0x3647('0x31')][_0x3647('0x22')](_0x255928)['then'](function(_0x2be52c){_0x4511a0[_0x3647('0x22')]=_0x2be52c;if(_0x29c983[_0x3647('0x36')][_0x3647('0x45')]){_0x147a77['include']=[{'all':!![]}];}return db[_0x3647('0x31')][_0x3647('0x46')](_0x147a77);})[_0x3647('0x2a')](function(_0x279119){_0x4511a0[_0x3647('0x47')]=_0x279119;return _0x4511a0;})[_0x3647('0x2a')](respondWithFilteredResult(_0x506aad,_0x147a77))[_0x3647('0x48')](handleError(_0x506aad,null));};exports[_0x3647('0x49')]=function(_0x2b2dd6,_0x258dce){var _0x74ee99={'raw':![],'where':{'id':_0x2b2dd6[_0x3647('0x4a')]['id']}},_0x294589={};_0x294589[_0x3647('0x35')]=_[_0x3647('0x4b')](db[_0x3647('0x31')][_0x3647('0x32')]);_0x294589['query']=_[_0x3647('0x4b')](_0x2b2dd6[_0x3647('0x36')]);_0x294589['filters']=_[_0x3647('0x38')](_0x294589['model'],_0x294589[_0x3647('0x36')]);_0x74ee99[_0x3647('0x39')]=_[_0x3647('0x38')](_0x294589['model'],qs['fields'](_0x2b2dd6[_0x3647('0x36')][_0x3647('0x3a')]));_0x74ee99[_0x3647('0x39')]=_0x74ee99[_0x3647('0x39')][_0x3647('0x3b')]?_0x74ee99['attributes']:_0x294589[_0x3647('0x35')];if(_0x2b2dd6[_0x3647('0x36')][_0x3647('0x45')]){_0x74ee99[_0x3647('0x4c')]=[{'all':!![]}];}_0x74ee99=_[_0x3647('0x43')]({},_0x74ee99,_0x2b2dd6[_0x3647('0x44')]);return db[_0x3647('0x31')][_0x3647('0x4d')](_0x74ee99)[_0x3647('0x2a')](handleEntityNotFound(_0x258dce,null))[_0x3647('0x2a')](respondWithResult(_0x258dce,null))[_0x3647('0x48')](handleError(_0x258dce,null));};exports['create']=function(_0x554744,_0x2ec5de){return db[_0x3647('0x31')]['create'](_0x554744[_0x3647('0x4e')],{})[_0x3647('0x2a')](respondWithResult(_0x2ec5de,0xc9))[_0x3647('0x48')](handleError(_0x2ec5de,null));};exports[_0x3647('0x28')]=function(_0x231166,_0x273019){if(_0x231166['body']['id']){delete _0x231166[_0x3647('0x4e')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x231166[_0x3647('0x4a')]['id']}})[_0x3647('0x2a')](handleEntityNotFound(_0x273019,null))[_0x3647('0x2a')](saveUpdates(_0x231166[_0x3647('0x4e')],null))['then'](respondWithResult(_0x273019,null))[_0x3647('0x48')](handleError(_0x273019,null));};exports[_0x3647('0x29')]=function(_0x70e942,_0x31c610){return db[_0x3647('0x31')][_0x3647('0x4d')]({'where':{'id':_0x70e942['params']['id']}})[_0x3647('0x2a')](handleEntityNotFound(_0x31c610,null))['then'](removeEntity(_0x31c610,null))['catch'](handleError(_0x31c610,null));};exports[_0x3647('0x4f')]=function(_0x2b4983,_0x1376d7,_0x1c8014){var _0x2df153={};var _0x234f25={};var _0xa60ddc;var _0x53c521;return db[_0x3647('0x31')]['findOne']({'where':{'id':_0x2b4983[_0x3647('0x4a')]['id']}})[_0x3647('0x2a')](handleEntityNotFound(_0x1376d7,null))['then'](function(_0x554e1f){if(_0x554e1f){_0xa60ddc=_0x554e1f;_0x234f25[_0x3647('0x35')]=_[_0x3647('0x4b')](db[_0x3647('0x50')]['rawAttributes']);_0x234f25[_0x3647('0x36')]=_[_0x3647('0x4b')](_0x2b4983[_0x3647('0x36')]);_0x234f25['filters']=_[_0x3647('0x38')](_0x234f25[_0x3647('0x35')],_0x234f25['query']);_0x2df153[_0x3647('0x39')]=_[_0x3647('0x38')](_0x234f25[_0x3647('0x35')],qs[_0x3647('0x3a')](_0x2b4983[_0x3647('0x36')][_0x3647('0x3a')]));_0x2df153['attributes']=_0x2df153[_0x3647('0x39')][_0x3647('0x3b')]?_0x2df153[_0x3647('0x39')]:_0x234f25[_0x3647('0x35')];_0x2df153[_0x3647('0x3e')]=qs[_0x3647('0x3f')](_0x2b4983[_0x3647('0x36')]['sort']);_0x2df153[_0x3647('0x40')]=qs[_0x3647('0x37')](_[_0x3647('0x41')](_0x2b4983['query'],_0x234f25[_0x3647('0x37')]));if(_0x2b4983[_0x3647('0x36')][_0x3647('0x42')]){_0x2df153['where']=_[_0x3647('0x43')](_0x2df153['where'],{'$or':_[_0x3647('0x30')](_0x2df153[_0x3647('0x39')],function(_0xc50dc0){var _0x423b4a={};_0x423b4a[_0xc50dc0]={'$like':'%'+_0x2b4983[_0x3647('0x36')][_0x3647('0x42')]+'%'};return _0x423b4a;})});}_0x2df153=_['merge']({},_0x2df153,_0x2b4983[_0x3647('0x44')]);return _0xa60ddc[_0x3647('0x4f')](_0x2df153);}})['then'](function(_0x43d9d6){if(_0x43d9d6){_0x53c521=_0x43d9d6['length'];if(!_0x2b4983[_0x3647('0x36')][_0x3647('0x51')](_0x3647('0x3c'))){_0x2df153['limit']=qs[_0x3647('0x3d')](_0x2b4983[_0x3647('0x36')][_0x3647('0x3d')]);_0x2df153[_0x3647('0x20')]=qs[_0x3647('0x20')](_0x2b4983[_0x3647('0x36')][_0x3647('0x20')]);}return _0xa60ddc[_0x3647('0x4f')](_0x2df153);}})[_0x3647('0x2a')](function(_0x77711){if(_0x77711){return _0x77711?{'count':_0x53c521,'rows':_0x77711}:null;}})['then'](respondWithResult(_0x1376d7,null))[_0x3647('0x48')](handleError(_0x1376d7,null));};exports['addConfiguration']=function(_0x1e930b,_0x40d4ce,_0x19d762){if(_0x1e930b[_0x3647('0x4e')]['id']){delete _0x1e930b[_0x3647('0x4e')]['id'];}return db[_0x3647('0x31')][_0x3647('0x52')]({'where':{'id':_0x1e930b[_0x3647('0x4a')]['id']}})[_0x3647('0x2a')](handleEntityNotFound(_0x40d4ce,null))['then'](function(_0x4aba15){if(_0x4aba15){_0x1e930b[_0x3647('0x4e')]['AccountId']=_0x4aba15['id'];_0x1e930b[_0x3647('0x4e')][_0x3647('0x53')]=integrations[_0x3647('0x54')](_0x1e930b['body'][_0x3647('0x55')],_0x1e930b[_0x3647('0x4e')][_0x3647('0x33')]);_0x1e930b[_0x3647('0x4e')][_0x3647('0x56')]=integrations[_0x3647('0x57')](_0x1e930b[_0x3647('0x4e')][_0x3647('0x55')],_0x1e930b['body'][_0x3647('0x33')]);return db[_0x3647('0x50')]['create'](_0x1e930b[_0x3647('0x4e')],{'include':[{'model':db[_0x3647('0x58')],'as':_0x3647('0x53')},{'model':db[_0x3647('0x58')],'as':_0x3647('0x56')}]});}return null;})['then'](respondWithResult(_0x40d4ce,null))[_0x3647('0x48')](handleError(_0x40d4ce,null));};var md5=require(_0x3647('0x59'));exports['getFields']=function(_0x549f1f,_0x4b4287,_0x36a784){var _0x56f2b8=null;var _0x11f734=null;var _0x8f5db7=null;var _0x255354=null;var _0x371934='';return db[_0x3647('0x31')][_0x3647('0x52')]({'where':{'id':_0x549f1f['params']['id']},'attributes':['id',_0x3647('0x2d'),_0x3647('0x5a'),_0x3647('0x5b'),_0x3647('0x5c'),'remoteUri','serverUrl',_0x3647('0x5d')]})[_0x3647('0x2a')](handleEntityNotFound(_0x4b4287,null))['then'](function(_0x1e3a57){if(_0x1e3a57){_0x56f2b8=_0x1e3a57[_0x3647('0x5a')];_0x11f734=_0x1e3a57[_0x3647('0x5d')];_0x8f5db7=_0x1e3a57['moduleName'];_0x371934=_0x1e3a57[_0x3647('0x5e')];var _0x4d3f1e=_0x371934[_0x3647('0x5f')](-0x1);if(_0x4d3f1e==='/'){_0x371934=_0x371934['substring'](0x0,_0x371934['lastIndexOf'](_0x4d3f1e));}_0x255354=util[_0x3647('0x60')]('%s/webservice.php',_0x371934);var _0x46c656={'method':_0x3647('0x61'),'uri':_0x255354,'qs':{'operation':'getchallenge','username':_0x1e3a57['username']},'json':!![]};return rp(_0x46c656);}})[_0x3647('0x2a')](function(_0x4b2fd9){if(_0x4b2fd9[_0x3647('0x62')]){var _0x3cda1={'method':_0x3647('0x63'),'uri':_0x255354,'form':{'operation':_0x3647('0x64'),'username':_0x56f2b8,'accessKey':md5(_0x4b2fd9['result'][_0x3647('0x65')]+_0x11f734)},'json':!![]};return rp(_0x3cda1);}})[_0x3647('0x2a')](function(_0x556081){if(_0x556081['success']){var _0x1ba09a={'method':_0x3647('0x61'),'uri':_0x255354,'qs':{'operation':_0x3647('0x66'),'username':_0x56f2b8,'sessionName':_0x556081[_0x3647('0x67')][_0x3647('0x68')],'elementType':_0x8f5db7},'json':!![]};return rp(_0x1ba09a);}})[_0x3647('0x2a')](function(_0x3be433){if(_0x3be433[_0x3647('0x62')]){var _0x2a2112=[_0x3647('0x69'),_0x3647('0x6a'),_0x3647('0x6b')];_[_0x3647('0x6c')](_0x3be433[_0x3647('0x67')][_0x3647('0x3a')],function(_0x5524d1){return _0x2a2112[_0x3647('0x6d')](_0x5524d1['type'][_0x3647('0x2d')]);});_[_0x3647('0x6c')](_0x3be433[_0x3647('0x67')][_0x3647('0x3a')],function(_0x105874){return _0x105874[_0x3647('0x6e')]===_0x3647('0x6f');});return{'count':_0x3be433[_0x3647('0x67')][_0x3647('0x3a')][_0x3647('0x3b')],'rows':_[_0x3647('0x30')](_0x3be433['result'][_0x3647('0x3a')],function(_0x47dc32){return{'id':_0x47dc32['name'],'name':_0x47dc32['label'],'custom':_[_0x3647('0x70')](_0x47dc32['name'],_0x3647('0x71'))?!![]:![],'options':_0x47dc32[_0x3647('0x33')][_0x3647('0x2d')]===_0x3647('0x72')&&_0x47dc32['type'][_0x3647('0x73')][_0x3647('0x3b')]>0x0?_[_0x3647('0x30')](_0x47dc32[_0x3647('0x33')]['picklistValues'],function(_0x3c1ba8){return{'name':_0x3c1ba8[_0x3647('0x74')],'value':_0x3c1ba8['value']};}):[]};})};}})[_0x3647('0x2a')](respondWithResult(_0x4b4287,null))[_0x3647('0x48')](function(_0x1b8fd2){console['log'](_0x3647('0x75')+_0x1b8fd2);var _0x458039=_0x549f1f[_0x3647('0x36')][_0x3647('0x76')]?0x1f4:_0x1b8fd2[_0x3647('0x77')]||0x1f4;logger['error'](_0x3647('0x78'),_0x3647('0x79'),_0x458039,JSON['stringify'](_0x1b8fd2));delete _0x1b8fd2[_0x3647('0x2d')];if(_0x458039===0x191){_0x458039=0x190;}_0x4b4287[_0x3647('0x1d')](_0x458039)[_0x3647('0x2e')](_0x549f1f[_0x3647('0x36')]['test']?{'message':_0x3647('0x7a'),'statusCode':_0x1b8fd2['statusCode']}:_0x1b8fd2);});}; \ No newline at end of file +var _0x087f=['vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','update','error','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VtigerAccount','then','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','getConfigurations','VtigerConfiguration','length','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions','md5','getFields','findOne','username','description','serverUrl','accessKey','remoteUri','slice','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x087f,0x1f1));var _0xf087=function(_0x1af90e,_0x613cc2){_0x1af90e=_0x1af90e-0x0;var _0x430138=_0x087f[_0x1af90e];return _0x430138;};'use strict';var emlformat=require(_0xf087('0x0'));var rimraf=require(_0xf087('0x1'));var zipdir=require(_0xf087('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf087('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf087('0x4'));var util=require(_0xf087('0x5'));var path=require(_0xf087('0x6'));var sox=require(_0xf087('0x7'));var csv=require(_0xf087('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf087('0x9'));var _=require(_0xf087('0xa'));var squel=require('squel');var crypto=require(_0xf087('0xb'));var jsforce=require(_0xf087('0xc'));var deskjs=require(_0xf087('0xd'));var toCsv=require(_0xf087('0x8'));var querystring=require(_0xf087('0xe'));var Papa=require(_0xf087('0xf'));var Redis=require(_0xf087('0x10'));var authService=require(_0xf087('0x11'));var qs=require(_0xf087('0x12'));var as=require(_0xf087('0x13'));var hardwareService=require(_0xf087('0x14'));var logger=require(_0xf087('0x15'))(_0xf087('0x16'));var utils=require(_0xf087('0x17'));var config=require(_0xf087('0x18'));var licenseUtil=require(_0xf087('0x19'));var db=require(_0xf087('0x1a'))['db'];var integrations=require(_0xf087('0x1b'));function respondWithStatusCode(_0x2713ce,_0x3ddf65){_0x3ddf65=_0x3ddf65||0xcc;return function(_0x32d95f){if(_0x32d95f){return _0x2713ce[_0xf087('0x1c')](_0x3ddf65);}return _0x2713ce[_0xf087('0x1d')](_0x3ddf65)[_0xf087('0x1e')]();};}function respondWithResult(_0x1cfeb9,_0x223113){_0x223113=_0x223113||0xc8;return function(_0x7e8375){if(_0x7e8375){return _0x1cfeb9[_0xf087('0x1d')](_0x223113)[_0xf087('0x1f')](_0x7e8375);}};}function respondWithFilteredResult(_0x4ff6fe,_0xf3ca5f){return function(_0x1df02b){if(_0x1df02b){var _0xb3f46=typeof _0xf3ca5f['offset']==='undefined'&&typeof _0xf3ca5f[_0xf087('0x20')]===_0xf087('0x21');var _0x24a10c=_0x1df02b[_0xf087('0x22')];var _0x27c2bd=_0xb3f46?0x0:_0xf3ca5f[_0xf087('0x23')];var _0x3e66f2=_0xb3f46?_0x1df02b[_0xf087('0x22')]:_0xf3ca5f[_0xf087('0x23')]+_0xf3ca5f['limit'];var _0x5d0605;if(_0x3e66f2>=_0x24a10c){_0x3e66f2=_0x24a10c;_0x5d0605=0xc8;}else{_0x5d0605=0xce;}_0x4ff6fe['status'](_0x5d0605);return _0x4ff6fe['set']('Content-Range',_0x27c2bd+'-'+_0x3e66f2+'/'+_0x24a10c)[_0xf087('0x1f')](_0x1df02b);}return null;};}function patchUpdates(_0x5da127){return function(_0x2f4c05){try{jsonpatch[_0xf087('0x24')](_0x2f4c05,_0x5da127,!![]);}catch(_0x151282){return BPromise[_0xf087('0x25')](_0x151282);}return _0x2f4c05['save']();};}function saveUpdates(_0x32e536,_0xec52){return function(_0x3d50bd){if(_0x3d50bd){return _0x3d50bd[_0xf087('0x26')](_0x32e536)['then'](function(_0x35ab53){return _0x35ab53;});}return null;};}function removeEntity(_0xa2042b,_0x31b41c){return function(_0x218894){if(_0x218894){return _0x218894['destroy']()['then'](function(){_0xa2042b[_0xf087('0x1d')](0xcc)[_0xf087('0x1e')]();});}};}function handleEntityNotFound(_0x53e171,_0x258725){return function(_0x318693){if(!_0x318693){_0x53e171[_0xf087('0x1c')](0x194);}return _0x318693;};}function handleError(_0x3472f0,_0x4e7ce3){_0x4e7ce3=_0x4e7ce3||0x1f4;return function(_0x43c6fa){logger[_0xf087('0x27')](_0x43c6fa['stack']);if(_0x43c6fa[_0xf087('0x28')]){delete _0x43c6fa[_0xf087('0x28')];}_0x3472f0['status'](_0x4e7ce3)[_0xf087('0x29')](_0x43c6fa);};}exports[_0xf087('0x2a')]=function(_0x515ea2,_0x329d2d){var _0x32dd39={},_0x161adb={},_0x322731={'count':0x0,'rows':[]};var _0xa172cc=_[_0xf087('0x2b')](db['VtigerAccount'][_0xf087('0x2c')],function(_0x37c0ad){return{'name':_0x37c0ad[_0xf087('0x2d')],'type':_0x37c0ad[_0xf087('0x2e')][_0xf087('0x2f')]};});_0x161adb['model']=_[_0xf087('0x2b')](_0xa172cc,_0xf087('0x28'));_0x161adb[_0xf087('0x30')]=_['keys'](_0x515ea2[_0xf087('0x30')]);_0x161adb[_0xf087('0x31')]=_[_0xf087('0x32')](_0x161adb[_0xf087('0x33')],_0x161adb[_0xf087('0x30')]);_0x32dd39[_0xf087('0x34')]=_[_0xf087('0x32')](_0x161adb[_0xf087('0x33')],qs['fields'](_0x515ea2[_0xf087('0x30')][_0xf087('0x35')]));_0x32dd39['attributes']=_0x32dd39['attributes']['length']?_0x32dd39['attributes']:_0x161adb[_0xf087('0x33')];if(!_0x515ea2[_0xf087('0x30')][_0xf087('0x36')](_0xf087('0x37'))){_0x32dd39['limit']=qs[_0xf087('0x20')](_0x515ea2[_0xf087('0x30')][_0xf087('0x20')]);_0x32dd39[_0xf087('0x23')]=qs[_0xf087('0x23')](_0x515ea2[_0xf087('0x30')]['offset']);}_0x32dd39[_0xf087('0x38')]=qs[_0xf087('0x39')](_0x515ea2[_0xf087('0x30')]['sort']);_0x32dd39[_0xf087('0x3a')]=qs[_0xf087('0x31')](_[_0xf087('0x3b')](_0x515ea2['query'],_0x161adb[_0xf087('0x31')]),_0xa172cc);if(_0x515ea2[_0xf087('0x30')][_0xf087('0x3c')]){_0x32dd39[_0xf087('0x3a')]=_['merge'](_0x32dd39[_0xf087('0x3a')],{'$or':_[_0xf087('0x2b')](_0xa172cc,function(_0x2def57){if(_0x2def57[_0xf087('0x2e')]!=='VIRTUAL'){var _0x3e19f3={};_0x3e19f3[_0x2def57['name']]={'$like':'%'+_0x515ea2[_0xf087('0x30')][_0xf087('0x3c')]+'%'};return _0x3e19f3;}})});}_0x32dd39=_[_0xf087('0x3d')]({},_0x32dd39,_0x515ea2[_0xf087('0x3e')]);var _0x4fd2a4={'where':_0x32dd39['where']};return db[_0xf087('0x3f')]['count'](_0x4fd2a4)[_0xf087('0x40')](function(_0x198cce){_0x322731[_0xf087('0x22')]=_0x198cce;if(_0x515ea2[_0xf087('0x30')][_0xf087('0x41')]){_0x32dd39[_0xf087('0x42')]=[{'all':!![]}];}return db[_0xf087('0x3f')][_0xf087('0x43')](_0x32dd39);})[_0xf087('0x40')](function(_0x3de55b){_0x322731[_0xf087('0x44')]=_0x3de55b;return _0x322731;})[_0xf087('0x40')](respondWithFilteredResult(_0x329d2d,_0x32dd39))['catch'](handleError(_0x329d2d,null));};exports[_0xf087('0x45')]=function(_0x17d676,_0x259e18){var _0x57fc7b={'raw':![],'where':{'id':_0x17d676[_0xf087('0x46')]['id']}},_0x47d2f5={};_0x47d2f5[_0xf087('0x33')]=_[_0xf087('0x47')](db[_0xf087('0x3f')][_0xf087('0x2c')]);_0x47d2f5[_0xf087('0x30')]=_[_0xf087('0x47')](_0x17d676['query']);_0x47d2f5[_0xf087('0x31')]=_[_0xf087('0x32')](_0x47d2f5[_0xf087('0x33')],_0x47d2f5['query']);_0x57fc7b[_0xf087('0x34')]=_[_0xf087('0x32')](_0x47d2f5['model'],qs['fields'](_0x17d676[_0xf087('0x30')][_0xf087('0x35')]));_0x57fc7b[_0xf087('0x34')]=_0x57fc7b[_0xf087('0x34')]['length']?_0x57fc7b[_0xf087('0x34')]:_0x47d2f5[_0xf087('0x33')];if(_0x17d676['query']['includeAll']){_0x57fc7b[_0xf087('0x42')]=[{'all':!![]}];}_0x57fc7b=_['merge']({},_0x57fc7b,_0x17d676[_0xf087('0x3e')]);return db[_0xf087('0x3f')][_0xf087('0x48')](_0x57fc7b)[_0xf087('0x40')](handleEntityNotFound(_0x259e18,null))[_0xf087('0x40')](respondWithResult(_0x259e18,null))[_0xf087('0x49')](handleError(_0x259e18,null));};exports[_0xf087('0x4a')]=function(_0xc195d3,_0x4194e9){return db['VtigerAccount'][_0xf087('0x4a')](_0xc195d3[_0xf087('0x4b')],{})[_0xf087('0x40')](respondWithResult(_0x4194e9,0xc9))['catch'](handleError(_0x4194e9,null));};exports[_0xf087('0x26')]=function(_0x220d32,_0x435bc8){if(_0x220d32[_0xf087('0x4b')]['id']){delete _0x220d32[_0xf087('0x4b')]['id'];}return db[_0xf087('0x3f')][_0xf087('0x48')]({'where':{'id':_0x220d32[_0xf087('0x46')]['id']}})[_0xf087('0x40')](handleEntityNotFound(_0x435bc8,null))[_0xf087('0x40')](saveUpdates(_0x220d32[_0xf087('0x4b')],null))[_0xf087('0x40')](respondWithResult(_0x435bc8,null))[_0xf087('0x49')](handleError(_0x435bc8,null));};exports[_0xf087('0x4c')]=function(_0xea7a0d,_0x4a0450){return db[_0xf087('0x3f')][_0xf087('0x48')]({'where':{'id':_0xea7a0d[_0xf087('0x46')]['id']}})['then'](handleEntityNotFound(_0x4a0450,null))['then'](removeEntity(_0x4a0450,null))['catch'](handleError(_0x4a0450,null));};exports[_0xf087('0x4d')]=function(_0x1ac079,_0x138676,_0x64da76){var _0x29d1b4={};var _0x52fbc9={};var _0x1ff50c;var _0x50f368;return db[_0xf087('0x3f')]['findOne']({'where':{'id':_0x1ac079[_0xf087('0x46')]['id']}})['then'](handleEntityNotFound(_0x138676,null))[_0xf087('0x40')](function(_0x40c5f0){if(_0x40c5f0){_0x1ff50c=_0x40c5f0;_0x52fbc9['model']=_[_0xf087('0x47')](db[_0xf087('0x4e')]['rawAttributes']);_0x52fbc9['query']=_[_0xf087('0x47')](_0x1ac079['query']);_0x52fbc9[_0xf087('0x31')]=_[_0xf087('0x32')](_0x52fbc9[_0xf087('0x33')],_0x52fbc9[_0xf087('0x30')]);_0x29d1b4[_0xf087('0x34')]=_['intersection'](_0x52fbc9[_0xf087('0x33')],qs[_0xf087('0x35')](_0x1ac079[_0xf087('0x30')][_0xf087('0x35')]));_0x29d1b4[_0xf087('0x34')]=_0x29d1b4[_0xf087('0x34')][_0xf087('0x4f')]?_0x29d1b4[_0xf087('0x34')]:_0x52fbc9[_0xf087('0x33')];_0x29d1b4[_0xf087('0x38')]=qs[_0xf087('0x39')](_0x1ac079[_0xf087('0x30')][_0xf087('0x39')]);_0x29d1b4['where']=qs[_0xf087('0x31')](_[_0xf087('0x3b')](_0x1ac079[_0xf087('0x30')],_0x52fbc9[_0xf087('0x31')]));if(_0x1ac079['query'][_0xf087('0x3c')]){_0x29d1b4[_0xf087('0x3a')]=_['merge'](_0x29d1b4[_0xf087('0x3a')],{'$or':_[_0xf087('0x2b')](_0x29d1b4['attributes'],function(_0x4e2348){var _0x35d7a2={};_0x35d7a2[_0x4e2348]={'$like':'%'+_0x1ac079[_0xf087('0x30')]['filter']+'%'};return _0x35d7a2;})});}_0x29d1b4=_[_0xf087('0x3d')]({},_0x29d1b4,_0x1ac079['options']);return _0x1ff50c[_0xf087('0x4d')](_0x29d1b4);}})['then'](function(_0x4763a6){if(_0x4763a6){_0x50f368=_0x4763a6[_0xf087('0x4f')];if(!_0x1ac079[_0xf087('0x30')]['hasOwnProperty'](_0xf087('0x37'))){_0x29d1b4[_0xf087('0x20')]=qs[_0xf087('0x20')](_0x1ac079[_0xf087('0x30')][_0xf087('0x20')]);_0x29d1b4[_0xf087('0x23')]=qs[_0xf087('0x23')](_0x1ac079['query'][_0xf087('0x23')]);}return _0x1ff50c[_0xf087('0x4d')](_0x29d1b4);}})[_0xf087('0x40')](function(_0xfdb34c){if(_0xfdb34c){return _0xfdb34c?{'count':_0x50f368,'rows':_0xfdb34c}:null;}})['then'](respondWithResult(_0x138676,null))['catch'](handleError(_0x138676,null));};exports['addConfiguration']=function(_0x18442e,_0x306089,_0x2d96fd){if(_0x18442e['body']['id']){delete _0x18442e[_0xf087('0x4b')]['id'];}return db[_0xf087('0x3f')]['findOne']({'where':{'id':_0x18442e[_0xf087('0x46')]['id']}})['then'](handleEntityNotFound(_0x306089,null))[_0xf087('0x40')](function(_0x456c11){if(_0x456c11){_0x18442e[_0xf087('0x4b')]['AccountId']=_0x456c11['id'];_0x18442e[_0xf087('0x4b')][_0xf087('0x50')]=integrations[_0xf087('0x51')](_0x18442e['body']['channel'],_0x18442e[_0xf087('0x4b')][_0xf087('0x2e')]);_0x18442e[_0xf087('0x4b')]['Descriptions']=integrations[_0xf087('0x52')](_0x18442e[_0xf087('0x4b')][_0xf087('0x53')],_0x18442e[_0xf087('0x4b')][_0xf087('0x2e')]);return db[_0xf087('0x4e')]['create'](_0x18442e[_0xf087('0x4b')],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xf087('0x54')],'as':_0xf087('0x55')}]});}return null;})[_0xf087('0x40')](respondWithResult(_0x306089,null))['catch'](handleError(_0x306089,null));};var md5=require(_0xf087('0x56'));exports[_0xf087('0x57')]=function(_0x1b9194,_0x125ff3,_0xf666cc){var _0x2b1d17=null;var _0xc75c86=null;var _0x5c017c=null;var _0x12c982=null;var _0xbbd4a0='';return db['VtigerAccount'][_0xf087('0x58')]({'where':{'id':_0x1b9194[_0xf087('0x46')]['id']},'attributes':['id','name',_0xf087('0x59'),_0xf087('0x5a'),'moduleName','remoteUri',_0xf087('0x5b'),_0xf087('0x5c')]})[_0xf087('0x40')](handleEntityNotFound(_0x125ff3,null))[_0xf087('0x40')](function(_0x5a58dd){if(_0x5a58dd){_0x2b1d17=_0x5a58dd[_0xf087('0x59')];_0xc75c86=_0x5a58dd[_0xf087('0x5c')];_0x5c017c=_0x5a58dd['moduleName'];_0xbbd4a0=_0x5a58dd[_0xf087('0x5d')];var _0xf31daf=_0xbbd4a0[_0xf087('0x5e')](-0x1);if(_0xf31daf==='/'){_0xbbd4a0=_0xbbd4a0['substring'](0x0,_0xbbd4a0[_0xf087('0x5f')](_0xf31daf));}_0x12c982=util[_0xf087('0x60')](_0xf087('0x61'),_0xbbd4a0);var _0x435568={'method':'GET','uri':_0x12c982,'qs':{'operation':_0xf087('0x62'),'username':_0x5a58dd[_0xf087('0x59')]},'json':!![]};return rp(_0x435568);}})[_0xf087('0x40')](function(_0x58b60d){if(_0x58b60d[_0xf087('0x63')]){var _0x2627f2={'method':_0xf087('0x64'),'uri':_0x12c982,'form':{'operation':_0xf087('0x65'),'username':_0x2b1d17,'accessKey':md5(_0x58b60d[_0xf087('0x66')]['token']+_0xc75c86)},'json':!![]};return rp(_0x2627f2);}})[_0xf087('0x40')](function(_0x3dcfd2){if(_0x3dcfd2[_0xf087('0x63')]){var _0x1cc875={'method':'GET','uri':_0x12c982,'qs':{'operation':_0xf087('0x67'),'username':_0x2b1d17,'sessionName':_0x3dcfd2[_0xf087('0x66')][_0xf087('0x68')],'elementType':_0x5c017c},'json':!![]};return rp(_0x1cc875);}})[_0xf087('0x40')](function(_0x2f21cb){if(_0x2f21cb[_0xf087('0x63')]){var _0x1402af=[_0xf087('0x69'),_0xf087('0x6a'),_0xf087('0x6b')];_[_0xf087('0x6c')](_0x2f21cb[_0xf087('0x66')]['fields'],function(_0x53ae55){return _0x1402af[_0xf087('0x6d')](_0x53ae55[_0xf087('0x2e')]['name']);});_[_0xf087('0x6c')](_0x2f21cb[_0xf087('0x66')]['fields'],function(_0x46d4f8){return _0x46d4f8[_0xf087('0x6e')]===_0xf087('0x6f');});return{'count':_0x2f21cb[_0xf087('0x66')]['fields'][_0xf087('0x4f')],'rows':_[_0xf087('0x2b')](_0x2f21cb[_0xf087('0x66')]['fields'],function(_0x879e4a){return{'id':_0x879e4a[_0xf087('0x28')],'name':_0x879e4a[_0xf087('0x70')],'custom':_[_0xf087('0x71')](_0x879e4a[_0xf087('0x28')],_0xf087('0x72'))?!![]:![],'options':_0x879e4a[_0xf087('0x2e')]['name']===_0xf087('0x73')&&_0x879e4a[_0xf087('0x2e')][_0xf087('0x74')]['length']>0x0?_[_0xf087('0x2b')](_0x879e4a[_0xf087('0x2e')][_0xf087('0x74')],function(_0x58c6a3){return{'name':_0x58c6a3[_0xf087('0x70')],'value':_0x58c6a3[_0xf087('0x75')]};}):[]};})};}})[_0xf087('0x40')](respondWithResult(_0x125ff3,null))[_0xf087('0x49')](function(_0xd0ec07){console['log'](_0xf087('0x76')+_0xd0ec07);var _0x370952=_0x1b9194['query'][_0xf087('0x77')]?0x1f4:_0xd0ec07[_0xf087('0x78')]||0x1f4;logger['error'](_0xf087('0x79'),_0xf087('0x57'),_0x370952,JSON['stringify'](_0xd0ec07));delete _0xd0ec07['name'];if(_0x370952===0x191){_0x370952=0x190;}_0x125ff3[_0xf087('0x1d')](_0x370952)[_0xf087('0x29')](_0x1b9194['query'][_0xf087('0x77')]?{'message':_0xf087('0x7a'),'statusCode':_0xd0ec07[_0xf087('0x78')]}:_0xd0ec07);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 57bad54..503845d 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 _0x91f4=['path','./intVtigerAccount.attributes','../../components/integrations/configuration','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x8c6164,_0x1dc7db){var _0x1ca172=function(_0x1c8d48){while(--_0x1c8d48){_0x8c6164['push'](_0x8c6164['shift']());}};_0x1ca172(++_0x1dc7db);}(_0x91f4,0x158));var _0x491f=function(_0xed24c4,_0x196ffe){_0xed24c4=_0xed24c4-0x0;var _0x6ddcf4=_0x91f4[_0xed24c4];return _0x6ddcf4;};'use strict';var _=require(_0x491f('0x0'));var util=require(_0x491f('0x1'));var logger=require(_0x491f('0x2'))(_0x491f('0x3'));var moment=require(_0x491f('0x4'));var BPromise=require('bluebird');var rp=require(_0x491f('0x5'));var fs=require('fs');var path=require(_0x491f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x491f('0x7'));var integrations=require(_0x491f('0x8'));module['exports']=function(_0x1b606b,_0x51b210){return _0x1b606b['define']('VtigerAccount',attributes,{'tableName':_0x491f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1017=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1ee906,_0x78771b){var _0x1030cb=function(_0x1d37db){while(--_0x1d37db){_0x1ee906['push'](_0x1ee906['shift']());}};_0x1030cb(++_0x78771b);}(_0x1017,0x164));var _0x7101=function(_0x22ba9b,_0x53ecf9){_0x22ba9b=_0x22ba9b-0x0;var _0x5ccdbc=_0x1017[_0x22ba9b];return _0x5ccdbc;};'use strict';var _=require(_0x7101('0x0'));var util=require(_0x7101('0x1'));var logger=require(_0x7101('0x2'))(_0x7101('0x3'));var moment=require(_0x7101('0x4'));var BPromise=require(_0x7101('0x5'));var rp=require(_0x7101('0x6'));var fs=require('fs');var path=require(_0x7101('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7101('0x8'));var integrations=require(_0x7101('0x9'));module[_0x7101('0xa')]=function(_0x1054c9,_0xec3d6a){return _0x1054c9[_0x7101('0xb')](_0x7101('0xc'),attributes,{'tableName':_0x7101('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index bd01564..0ce175c 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 _0xbc9d=['VtigerAccount','options','raw','where','limit','include','model','attributes','map','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVtigerAccount'];(function(_0x5a68ca,_0x4f0d71){var _0x444ab8=function(_0x5a45c9){while(--_0x5a45c9){_0x5a68ca['push'](_0x5a68ca['shift']());}};_0x444ab8(++_0x4f0d71);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x282477,_0x3363c7){_0x282477=_0x282477-0x0;var _0x1cdbad=_0xbc9d[_0x282477];return _0x1cdbad;};'use strict';var _=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var moment=require(_0xdbc9('0x2'));var BPromise=require(_0xdbc9('0x3'));var rs=require(_0xdbc9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdbc9('0x5'))(_0xdbc9('0x6'));var config=require(_0xdbc9('0x7'));var jayson=require(_0xdbc9('0x8'));var client=jayson[_0xdbc9('0x9')][_0xdbc9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x381a0e,_0x4a9246,_0x2dbd23){return new BPromise(function(_0x181f8a,_0x3d4918){return client['request'](_0x381a0e,_0x2dbd23)[_0xdbc9('0xb')](function(_0x53cff1){logger['info'](_0xdbc9('0xc'),_0x4a9246,_0xdbc9('0xd'));logger[_0xdbc9('0xe')](_0xdbc9('0xf'),_0x4a9246,'request\x20sent',JSON[_0xdbc9('0x10')](_0x53cff1));if(_0x53cff1[_0xdbc9('0x11')]){if(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x12')]===0x1f4){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1['error']['message']);return _0x3d4918(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x53cff1[_0xdbc9('0x11')]['message']);return _0x181f8a(_0x53cff1[_0xdbc9('0x11')][_0xdbc9('0x13')]);}else{logger[_0xdbc9('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x4a9246,_0xdbc9('0xd'));_0x181f8a(_0x53cff1[_0xdbc9('0x15')]['message']);}})[_0xdbc9('0x16')](function(_0x37856d){logger[_0xdbc9('0x11')](_0xdbc9('0xc'),_0x4a9246,_0x37856d);_0x3d4918(_0x37856d);});});}exports[_0xdbc9('0x17')]=function(_0x33f1bd){var _0x9f343d=this;return new Promise(function(_0xc2ddd2,_0x2ad952){return db[_0xdbc9('0x18')]['findAll']({'raw':_0x33f1bd[_0xdbc9('0x19')]?_0x33f1bd['options'][_0xdbc9('0x1a')]===undefined?!![]:![]:!![],'where':_0x33f1bd[_0xdbc9('0x19')]?_0x33f1bd['options'][_0xdbc9('0x1b')]||null:null,'attributes':_0x33f1bd['options']?_0x33f1bd['options']['attributes']||null:null,'limit':_0x33f1bd['options']?_0x33f1bd[_0xdbc9('0x19')][_0xdbc9('0x1c')]||null:null,'include':_0x33f1bd['options']?_0x33f1bd[_0xdbc9('0x19')][_0xdbc9('0x1d')]?_['map'](_0x33f1bd[_0xdbc9('0x19')][_0xdbc9('0x1d')],function(_0x1b1c0d){return{'model':db[_0x1b1c0d[_0xdbc9('0x1e')]],'as':_0x1b1c0d['as'],'attributes':_0x1b1c0d[_0xdbc9('0x1f')],'include':_0x1b1c0d[_0xdbc9('0x1d')]?_[_0xdbc9('0x20')](_0x1b1c0d[_0xdbc9('0x1d')],function(_0x3c8c1d){return{'model':db[_0x3c8c1d['model']],'as':_0x3c8c1d['as'],'attributes':_0x3c8c1d[_0xdbc9('0x1f')],'include':_0x3c8c1d[_0xdbc9('0x1d')]?_[_0xdbc9('0x20')](_0x3c8c1d[_0xdbc9('0x1d')],function(_0x24fdec){return{'model':db[_0x24fdec['model']],'as':_0x24fdec['as'],'attributes':_0x24fdec[_0xdbc9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdbc9('0xb')](function(_0x5300bd){logger['info'](_0xdbc9('0x17'),_0x33f1bd);logger[_0xdbc9('0xe')](_0xdbc9('0x17'),_0x33f1bd,JSON['stringify'](_0x5300bd));_0xc2ddd2(_0x5300bd);})[_0xdbc9('0x16')](function(_0x539e57){logger['error'](_0xdbc9('0x17'),_0x539e57['message'],_0x33f1bd);_0x2ad952(_0x9f343d['error'](0x1f4,_0x539e57[_0xdbc9('0x13')]));});});};exports[_0xdbc9('0x21')]=function(_0x1cb557){var _0x4db824=this;return new Promise(function(_0x35eaf8,_0x22f8aa){return db['VtigerAccount']['find']({'raw':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557[_0xdbc9('0x19')][_0xdbc9('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557[_0xdbc9('0x19')][_0xdbc9('0x1b')]||null:null,'attributes':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557['options'][_0xdbc9('0x1f')]||null:null,'include':_0x1cb557[_0xdbc9('0x19')]?_0x1cb557[_0xdbc9('0x19')][_0xdbc9('0x1d')]?_[_0xdbc9('0x20')](_0x1cb557[_0xdbc9('0x19')]['include'],function(_0x1cf210){return{'model':db[_0x1cf210['model']],'as':_0x1cf210['as'],'attributes':_0x1cf210['attributes'],'include':_0x1cf210['include']?_['map'](_0x1cf210['include'],function(_0x321a37){return{'model':db[_0x321a37[_0xdbc9('0x1e')]],'as':_0x321a37['as'],'attributes':_0x321a37[_0xdbc9('0x1f')],'include':_0x321a37['include']?_[_0xdbc9('0x20')](_0x321a37[_0xdbc9('0x1d')],function(_0x2c1053){return{'model':db[_0x2c1053[_0xdbc9('0x1e')]],'as':_0x2c1053['as'],'attributes':_0x2c1053[_0xdbc9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xdbc9('0xb')](function(_0x5bc477){logger[_0xdbc9('0x14')](_0xdbc9('0x21'),_0x1cb557);logger[_0xdbc9('0xe')]('ShowVtigerAccount',_0x1cb557,JSON[_0xdbc9('0x10')](_0x5bc477));_0x35eaf8(_0x5bc477);})[_0xdbc9('0x16')](function(_0x30fa5c){logger[_0xdbc9('0x11')]('ShowVtigerAccount',_0x30fa5c['message'],_0x1cb557);_0x22f8aa(_0x4db824[_0xdbc9('0x11')](0x1f4,_0x30fa5c[_0xdbc9('0x13')]));});});}; \ No newline at end of file +var _0x4024=['attributes','include','map','model','then','debug','ShowVtigerAccount','find','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','info','request\x20sent','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','options'];(function(_0x3f48ad,_0x2e7026){var _0x4d5d7a=function(_0x926da2){while(--_0x926da2){_0x3f48ad['push'](_0x3f48ad['shift']());}};_0x4d5d7a(++_0x2e7026);}(_0x4024,0x89));var _0x4402=function(_0x12a4a8,_0x1b7491){_0x12a4a8=_0x12a4a8-0x0;var _0x310b28=_0x4024[_0x12a4a8];return _0x310b28;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x168acd,_0x4ed77d,_0x3045ae){return new BPromise(function(_0x5d7ca4,_0x5c0b70){return client[_0x4402('0x9')](_0x168acd,_0x3045ae)['then'](function(_0x4d2882){logger[_0x4402('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x4ed77d,_0x4402('0xb'));logger['debug'](_0x4402('0xc'),_0x4ed77d,'request\x20sent',JSON[_0x4402('0xd')](_0x4d2882));if(_0x4d2882[_0x4402('0xe')]){if(_0x4d2882['error'][_0x4402('0xf')]===0x1f4){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882['error'][_0x4402('0x11')]);return _0x5c0b70(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);return _0x5d7ca4(_0x4d2882[_0x4402('0xe')][_0x4402('0x11')]);}else{logger[_0x4402('0xa')](_0x4402('0x10'),_0x4ed77d,_0x4402('0xb'));_0x5d7ca4(_0x4d2882[_0x4402('0x12')][_0x4402('0x11')]);}})[_0x4402('0x13')](function(_0x30c390){logger[_0x4402('0xe')](_0x4402('0x10'),_0x4ed77d,_0x30c390);_0x5c0b70(_0x30c390);});});}exports[_0x4402('0x14')]=function(_0x231382){var _0x5b127f=this;return new Promise(function(_0x494389,_0x663ab7){return db[_0x4402('0x15')]['findAll']({'raw':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x231382[_0x4402('0x16')]?_0x231382['options']['where']||null:null,'attributes':_0x231382[_0x4402('0x16')]?_0x231382[_0x4402('0x16')][_0x4402('0x17')]||null:null,'limit':_0x231382['options']?_0x231382[_0x4402('0x16')]['limit']||null:null,'include':_0x231382['options']?_0x231382[_0x4402('0x16')][_0x4402('0x18')]?_[_0x4402('0x19')](_0x231382[_0x4402('0x16')][_0x4402('0x18')],function(_0x2e6fee){return{'model':db[_0x2e6fee[_0x4402('0x1a')]],'as':_0x2e6fee['as'],'attributes':_0x2e6fee[_0x4402('0x17')],'include':_0x2e6fee[_0x4402('0x18')]?_['map'](_0x2e6fee[_0x4402('0x18')],function(_0x4e1c04){return{'model':db[_0x4e1c04[_0x4402('0x1a')]],'as':_0x4e1c04['as'],'attributes':_0x4e1c04[_0x4402('0x17')],'include':_0x4e1c04[_0x4402('0x18')]?_[_0x4402('0x19')](_0x4e1c04['include'],function(_0x15c19f){return{'model':db[_0x15c19f['model']],'as':_0x15c19f['as'],'attributes':_0x15c19f['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x395e49){logger[_0x4402('0xa')](_0x4402('0x14'),_0x231382);logger[_0x4402('0x1c')]('GetVtigerAccount',_0x231382,JSON[_0x4402('0xd')](_0x395e49));_0x494389(_0x395e49);})['catch'](function(_0x71da2f){logger[_0x4402('0xe')](_0x4402('0x14'),_0x71da2f['message'],_0x231382);_0x663ab7(_0x5b127f[_0x4402('0xe')](0x1f4,_0x71da2f[_0x4402('0x11')]));});});};exports[_0x4402('0x1d')]=function(_0x3f4bcb){var _0x2526d1=this;return new Promise(function(_0x605702,_0x1189b8){return db[_0x4402('0x15')][_0x4402('0x1e')]({'raw':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb['options'][_0x4402('0x1f')]||null:null,'attributes':_0x3f4bcb['options']?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x17')]||null:null,'include':_0x3f4bcb[_0x4402('0x16')]?_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')]?_['map'](_0x3f4bcb[_0x4402('0x16')][_0x4402('0x18')],function(_0x169340){return{'model':db[_0x169340['model']],'as':_0x169340['as'],'attributes':_0x169340[_0x4402('0x17')],'include':_0x169340[_0x4402('0x18')]?_['map'](_0x169340[_0x4402('0x18')],function(_0x437e83){return{'model':db[_0x437e83[_0x4402('0x1a')]],'as':_0x437e83['as'],'attributes':_0x437e83[_0x4402('0x17')],'include':_0x437e83[_0x4402('0x18')]?_[_0x4402('0x19')](_0x437e83[_0x4402('0x18')],function(_0x6e9fb7){return{'model':db[_0x6e9fb7[_0x4402('0x1a')]],'as':_0x6e9fb7['as'],'attributes':_0x6e9fb7['attributes']};}):[]};}):[]};}):[]:[]})[_0x4402('0x1b')](function(_0x28fee8){logger[_0x4402('0xa')]('ShowVtigerAccount',_0x3f4bcb);logger[_0x4402('0x1c')](_0x4402('0x1d'),_0x3f4bcb,JSON['stringify'](_0x28fee8));_0x605702(_0x28fee8);})['catch'](function(_0x2b9d51){logger[_0x4402('0xe')](_0x4402('0x1d'),_0x2b9d51[_0x4402('0x11')],_0x3f4bcb);_0x1189b8(_0x2526d1['error'](0x1f4,_0x2b9d51['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 8746472..765c7f4 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 _0x990a=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post'];(function(_0x48a556,_0x4370e7){var _0xf3256b=function(_0x2f3bd0){while(--_0x2f3bd0){_0x48a556['push'](_0x48a556['shift']());}};_0xf3256b(++_0x4370e7);}(_0x990a,0x9b));var _0xa990=function(_0x1c2091,_0x18ccff){_0x1c2091=_0x1c2091-0x0;var _0x3450a2=_0x990a[_0x1c2091];return _0x3450a2;};'use strict';var multer=require(_0xa990('0x0'));var util=require(_0xa990('0x1'));var path=require(_0xa990('0x2'));var timeout=require(_0xa990('0x3'));var express=require(_0xa990('0x4'));var router=express[_0xa990('0x5')]();var fs_extra=require(_0xa990('0x6'));var auth=require(_0xa990('0x7'));var interaction=require(_0xa990('0x8'));var config=require('../../config/environment');var controller=require(_0xa990('0x9'));router[_0xa990('0xa')]('/',auth[_0xa990('0xb')](),controller['index']);router[_0xa990('0xa')](_0xa990('0xc'),auth[_0xa990('0xb')](),controller[_0xa990('0xd')]);router[_0xa990('0xa')](_0xa990('0xe'),auth['isAuthenticated'](),controller[_0xa990('0xf')]);router[_0xa990('0xa')](_0xa990('0x10'),auth['isAuthenticated'](),controller[_0xa990('0x11')]);router['get']('/:id/descriptions',auth[_0xa990('0xb')](),controller[_0xa990('0x12')]);router[_0xa990('0x13')]('/',auth['isAuthenticated'](),controller[_0xa990('0x14')]);router[_0xa990('0x15')](_0xa990('0xc'),auth[_0xa990('0xb')](),controller[_0xa990('0x16')]);router[_0xa990('0x17')](_0xa990('0xc'),auth['isAuthenticated'](),controller[_0xa990('0x18')]);module['exports']=router; \ No newline at end of file +var _0x397a=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','create','/:id','delete','exports','multer'];(function(_0x198a75,_0x4783e4){var _0x8ac793=function(_0x52283f){while(--_0x52283f){_0x198a75['push'](_0x198a75['shift']());}};_0x8ac793(++_0x4783e4);}(_0x397a,0x110));var _0xa397=function(_0x3a01e4,_0x5dc400){_0x3a01e4=_0x3a01e4-0x0;var _0xfd4d3f=_0x397a[_0x3a01e4];return _0xfd4d3f;};'use strict';var multer=require(_0xa397('0x0'));var util=require(_0xa397('0x1'));var path=require(_0xa397('0x2'));var timeout=require(_0xa397('0x3'));var express=require('express');var router=express[_0xa397('0x4')]();var fs_extra=require(_0xa397('0x5'));var auth=require(_0xa397('0x6'));var interaction=require(_0xa397('0x7'));var config=require(_0xa397('0x8'));var controller=require(_0xa397('0x9'));router[_0xa397('0xa')]('/',auth[_0xa397('0xb')](),controller[_0xa397('0xc')]);router[_0xa397('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xa397('0xd'),auth[_0xa397('0xb')](),controller['getFields']);router['get']('/:id/subjects',auth[_0xa397('0xb')](),controller[_0xa397('0xe')]);router[_0xa397('0xa')](_0xa397('0xf'),auth[_0xa397('0xb')](),controller[_0xa397('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa397('0x11')]);router['put'](_0xa397('0x12'),auth['isAuthenticated'](),controller['update']);router[_0xa397('0x13')](_0xa397('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0xa397('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 7fffae2..6b8b0fc 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 _0xed34=['exports','STRING'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0xed34,0xde));var _0x4ed3=function(_0x2bb4c6,_0x4b8585){_0x2bb4c6=_0x2bb4c6-0x0;var _0x16d6ef=_0xed34[_0x2bb4c6];return _0x16d6ef;};'use strict';var Sequelize=require('sequelize');module[_0x4ed3('0x0')]={'name':{'type':Sequelize[_0x4ed3('0x1')]},'description':{'type':Sequelize[_0x4ed3('0x1')]}}; \ No newline at end of file +var _0x942f=['sequelize','STRING'];(function(_0x4f4e4b,_0x46ea73){var _0x23a628=function(_0x56791){while(--_0x56791){_0x4f4e4b['push'](_0x4f4e4b['shift']());}};_0x23a628(++_0x46ea73);}(_0x942f,0x18a));var _0xf942=function(_0x1e3e34,_0x1e7dfe){_0x1e3e34=_0x1e3e34-0x0;var _0x167846=_0x942f[_0x1e3e34];return _0x167846;};'use strict';var Sequelize=require(_0xf942('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf942('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index f5b9c7c..b65ff3c 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 _0x7ee3=['hasOwnProperty','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','VtigerConfiguration','includeAll','findAll','rows','catch','params','find','create','body','getFields','findOne','VtigerField','order'];(function(_0x36c506,_0x5172bb){var _0x3f6b08=function(_0x56c192){while(--_0x56c192){_0x36c506['push'](_0x36c506['shift']());}};_0x3f6b08(++_0x5172bb);}(_0x7ee3,0xf3));var _0x37ee=function(_0x2d9f8f,_0x40bc79){_0x2d9f8f=_0x2d9f8f-0x0;var _0x240df4=_0x7ee3[_0x2d9f8f];return _0x240df4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x37ee('0x0'));var zipdir=require(_0x37ee('0x1'));var jsonpatch=require(_0x37ee('0x2'));var rp=require(_0x37ee('0x3'));var moment=require(_0x37ee('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x37ee('0x5'));var util=require(_0x37ee('0x6'));var path=require(_0x37ee('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x37ee('0x8'));var squel=require(_0x37ee('0x9'));var crypto=require(_0x37ee('0xa'));var jsforce=require(_0x37ee('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x37ee('0xc'));var querystring=require('querystring');var Papa=require(_0x37ee('0xd'));var Redis=require(_0x37ee('0xe'));var authService=require(_0x37ee('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x37ee('0x10'));var hardwareService=require(_0x37ee('0x11'));var logger=require(_0x37ee('0x12'))('api');var utils=require(_0x37ee('0x13'));var config=require(_0x37ee('0x14'));var licenseUtil=require(_0x37ee('0x15'));var db=require(_0x37ee('0x16'))['db'];function respondWithStatusCode(_0x3f08fa,_0x50860d){_0x50860d=_0x50860d||0xcc;return function(_0x1607f4){if(_0x1607f4){return _0x3f08fa[_0x37ee('0x17')](_0x50860d);}return _0x3f08fa[_0x37ee('0x18')](_0x50860d)[_0x37ee('0x19')]();};}function respondWithResult(_0x3fb652,_0x42efdc){_0x42efdc=_0x42efdc||0xc8;return function(_0x61b2ad){if(_0x61b2ad){return _0x3fb652[_0x37ee('0x18')](_0x42efdc)[_0x37ee('0x1a')](_0x61b2ad);}};}function respondWithFilteredResult(_0x1a9b44,_0x35cbd8){return function(_0x1fbfc4){if(_0x1fbfc4){var _0x290abe=typeof _0x35cbd8[_0x37ee('0x1b')]===_0x37ee('0x1c')&&typeof _0x35cbd8['limit']===_0x37ee('0x1c');var _0x134395=_0x1fbfc4['count'];var _0x41675b=_0x290abe?0x0:_0x35cbd8[_0x37ee('0x1b')];var _0x2ac544=_0x290abe?_0x1fbfc4[_0x37ee('0x1d')]:_0x35cbd8[_0x37ee('0x1b')]+_0x35cbd8[_0x37ee('0x1e')];var _0x2a6b7e;if(_0x2ac544>=_0x134395){_0x2ac544=_0x134395;_0x2a6b7e=0xc8;}else{_0x2a6b7e=0xce;}_0x1a9b44[_0x37ee('0x18')](_0x2a6b7e);return _0x1a9b44[_0x37ee('0x1f')](_0x37ee('0x20'),_0x41675b+'-'+_0x2ac544+'/'+_0x134395)[_0x37ee('0x1a')](_0x1fbfc4);}return null;};}function patchUpdates(_0x335e02){return function(_0x188d44){try{jsonpatch[_0x37ee('0x21')](_0x188d44,_0x335e02,!![]);}catch(_0x3e31c3){return BPromise[_0x37ee('0x22')](_0x3e31c3);}return _0x188d44[_0x37ee('0x23')]();};}function saveUpdates(_0x434144,_0x5c023f){return function(_0x2ca054){if(_0x2ca054){return _0x2ca054[_0x37ee('0x24')](_0x434144)[_0x37ee('0x25')](function(_0x278890){return _0x278890;});}return null;};}function removeEntity(_0x2dd430,_0x150941){return function(_0xfdf7aa){if(_0xfdf7aa){return _0xfdf7aa[_0x37ee('0x26')]()[_0x37ee('0x25')](function(){_0x2dd430[_0x37ee('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c2d2b,_0xd6605f){return function(_0x145f30){if(!_0x145f30){_0x2c2d2b['sendStatus'](0x194);}return _0x145f30;};}function handleError(_0xb8cfdf,_0x154a9c){_0x154a9c=_0x154a9c||0x1f4;return function(_0xa378a6){logger[_0x37ee('0x27')](_0xa378a6[_0x37ee('0x28')]);if(_0xa378a6[_0x37ee('0x29')]){delete _0xa378a6[_0x37ee('0x29')];}_0xb8cfdf[_0x37ee('0x18')](_0x154a9c)[_0x37ee('0x2a')](_0xa378a6);};}exports[_0x37ee('0x2b')]=function(_0x3775d8,_0x5dab71){var _0x40478e={},_0x239a37={},_0x2fcf36={'count':0x0,'rows':[]};var _0x1b6205=_[_0x37ee('0x2c')](db['VtigerConfiguration'][_0x37ee('0x2d')],function(_0x3c1cc7){return{'name':_0x3c1cc7[_0x37ee('0x2e')],'type':_0x3c1cc7[_0x37ee('0x2f')]['key']};});_0x239a37[_0x37ee('0x30')]=_[_0x37ee('0x2c')](_0x1b6205,_0x37ee('0x29'));_0x239a37[_0x37ee('0x31')]=_[_0x37ee('0x32')](_0x3775d8[_0x37ee('0x31')]);_0x239a37[_0x37ee('0x33')]=_[_0x37ee('0x34')](_0x239a37['model'],_0x239a37[_0x37ee('0x31')]);_0x40478e[_0x37ee('0x35')]=_[_0x37ee('0x34')](_0x239a37['model'],qs[_0x37ee('0x36')](_0x3775d8[_0x37ee('0x31')][_0x37ee('0x36')]));_0x40478e[_0x37ee('0x35')]=_0x40478e[_0x37ee('0x35')][_0x37ee('0x37')]?_0x40478e[_0x37ee('0x35')]:_0x239a37[_0x37ee('0x30')];if(!_0x3775d8[_0x37ee('0x31')]['hasOwnProperty'](_0x37ee('0x38'))){_0x40478e[_0x37ee('0x1e')]=qs[_0x37ee('0x1e')](_0x3775d8[_0x37ee('0x31')][_0x37ee('0x1e')]);_0x40478e['offset']=qs['offset'](_0x3775d8[_0x37ee('0x31')][_0x37ee('0x1b')]);}_0x40478e['order']=qs[_0x37ee('0x39')](_0x3775d8[_0x37ee('0x31')][_0x37ee('0x39')]);_0x40478e[_0x37ee('0x3a')]=qs[_0x37ee('0x33')](_[_0x37ee('0x3b')](_0x3775d8[_0x37ee('0x31')],_0x239a37[_0x37ee('0x33')]),_0x1b6205);if(_0x3775d8[_0x37ee('0x31')]['filter']){_0x40478e['where']=_[_0x37ee('0x3c')](_0x40478e[_0x37ee('0x3a')],{'$or':_[_0x37ee('0x2c')](_0x1b6205,function(_0x42e3fe){if(_0x42e3fe[_0x37ee('0x2f')]!==_0x37ee('0x3d')){var _0xa2627b={};_0xa2627b[_0x42e3fe['name']]={'$like':'%'+_0x3775d8[_0x37ee('0x31')][_0x37ee('0x3e')]+'%'};return _0xa2627b;}})});}_0x40478e=_[_0x37ee('0x3c')]({},_0x40478e,_0x3775d8[_0x37ee('0x3f')]);var _0x3eae41={'where':_0x40478e[_0x37ee('0x3a')]};return db[_0x37ee('0x40')][_0x37ee('0x1d')](_0x3eae41)[_0x37ee('0x25')](function(_0x50499f){_0x2fcf36['count']=_0x50499f;if(_0x3775d8['query'][_0x37ee('0x41')]){_0x40478e['include']=[{'all':!![]}];}return db[_0x37ee('0x40')][_0x37ee('0x42')](_0x40478e);})[_0x37ee('0x25')](function(_0x299969){_0x2fcf36[_0x37ee('0x43')]=_0x299969;return _0x2fcf36;})['then'](respondWithFilteredResult(_0x5dab71,_0x40478e))[_0x37ee('0x44')](handleError(_0x5dab71,null));};exports['show']=function(_0xcb8188,_0x1904ac){var _0xb87cd4={'raw':![],'where':{'id':_0xcb8188[_0x37ee('0x45')]['id']}},_0x51b647={};_0x51b647[_0x37ee('0x30')]=_[_0x37ee('0x32')](db[_0x37ee('0x40')][_0x37ee('0x2d')]);_0x51b647[_0x37ee('0x31')]=_[_0x37ee('0x32')](_0xcb8188['query']);_0x51b647[_0x37ee('0x33')]=_[_0x37ee('0x34')](_0x51b647['model'],_0x51b647[_0x37ee('0x31')]);_0xb87cd4['attributes']=_[_0x37ee('0x34')](_0x51b647[_0x37ee('0x30')],qs['fields'](_0xcb8188[_0x37ee('0x31')][_0x37ee('0x36')]));_0xb87cd4['attributes']=_0xb87cd4['attributes'][_0x37ee('0x37')]?_0xb87cd4[_0x37ee('0x35')]:_0x51b647[_0x37ee('0x30')];if(_0xcb8188[_0x37ee('0x31')]['includeAll']){_0xb87cd4['include']=[{'all':!![]}];}_0xb87cd4=_[_0x37ee('0x3c')]({},_0xb87cd4,_0xcb8188['options']);return db['VtigerConfiguration'][_0x37ee('0x46')](_0xb87cd4)[_0x37ee('0x25')](handleEntityNotFound(_0x1904ac,null))[_0x37ee('0x25')](respondWithResult(_0x1904ac,null))[_0x37ee('0x44')](handleError(_0x1904ac,null));};exports[_0x37ee('0x47')]=function(_0x1173bd,_0x1d80a2){return db[_0x37ee('0x40')][_0x37ee('0x47')](_0x1173bd[_0x37ee('0x48')],{})[_0x37ee('0x25')](respondWithResult(_0x1d80a2,0xc9))['catch'](handleError(_0x1d80a2,null));};exports['update']=function(_0x5b14aa,_0x34f91d){if(_0x5b14aa['body']['id']){delete _0x5b14aa[_0x37ee('0x48')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x5b14aa[_0x37ee('0x45')]['id']}})[_0x37ee('0x25')](handleEntityNotFound(_0x34f91d,null))[_0x37ee('0x25')](saveUpdates(_0x5b14aa[_0x37ee('0x48')],null))['then'](respondWithResult(_0x34f91d,null))['catch'](handleError(_0x34f91d,null));};exports[_0x37ee('0x26')]=function(_0x4e9d21,_0x15ce4e){return db['VtigerConfiguration'][_0x37ee('0x46')]({'where':{'id':_0x4e9d21[_0x37ee('0x45')]['id']}})[_0x37ee('0x25')](handleEntityNotFound(_0x15ce4e,null))[_0x37ee('0x25')](removeEntity(_0x15ce4e,null))[_0x37ee('0x44')](handleError(_0x15ce4e,null));};exports[_0x37ee('0x49')]=function(_0x4524bb,_0x271e1b,_0x30c755){var _0x46c378={};var _0x545c90={};var _0x575e2d;var _0x5254d2;return db[_0x37ee('0x40')][_0x37ee('0x4a')]({'where':{'id':_0x4524bb[_0x37ee('0x45')]['id']}})[_0x37ee('0x25')](handleEntityNotFound(_0x271e1b,null))['then'](function(_0x598c0d){if(_0x598c0d){_0x575e2d=_0x598c0d;_0x545c90[_0x37ee('0x30')]=_[_0x37ee('0x32')](db[_0x37ee('0x4b')][_0x37ee('0x2d')]);_0x545c90[_0x37ee('0x31')]=_[_0x37ee('0x32')](_0x4524bb['query']);_0x545c90['filters']=_[_0x37ee('0x34')](_0x545c90['model'],_0x545c90[_0x37ee('0x31')]);_0x46c378[_0x37ee('0x35')]=_[_0x37ee('0x34')](_0x545c90[_0x37ee('0x30')],qs[_0x37ee('0x36')](_0x4524bb[_0x37ee('0x31')][_0x37ee('0x36')]));_0x46c378[_0x37ee('0x35')]=_0x46c378[_0x37ee('0x35')][_0x37ee('0x37')]?_0x46c378['attributes']:_0x545c90[_0x37ee('0x30')];_0x46c378[_0x37ee('0x4c')]=qs['sort'](_0x4524bb[_0x37ee('0x31')][_0x37ee('0x39')]);_0x46c378[_0x37ee('0x3a')]=qs[_0x37ee('0x33')](_[_0x37ee('0x3b')](_0x4524bb['query'],_0x545c90[_0x37ee('0x33')]));if(_0x4524bb[_0x37ee('0x31')][_0x37ee('0x3e')]){_0x46c378[_0x37ee('0x3a')]=_['merge'](_0x46c378[_0x37ee('0x3a')],{'$or':_[_0x37ee('0x2c')](_0x46c378[_0x37ee('0x35')],function(_0x5f379c){var _0x4a0d63={};_0x4a0d63[_0x5f379c]={'$like':'%'+_0x4524bb[_0x37ee('0x31')][_0x37ee('0x3e')]+'%'};return _0x4a0d63;})});}_0x46c378=_[_0x37ee('0x3c')]({},_0x46c378,_0x4524bb[_0x37ee('0x3f')]);return _0x575e2d[_0x37ee('0x49')](_0x46c378);}})['then'](function(_0x1072b3){if(_0x1072b3){_0x5254d2=_0x1072b3[_0x37ee('0x37')];if(!_0x4524bb[_0x37ee('0x31')][_0x37ee('0x4d')]('nolimit')){_0x46c378[_0x37ee('0x1e')]=qs[_0x37ee('0x1e')](_0x4524bb[_0x37ee('0x31')][_0x37ee('0x1e')]);_0x46c378[_0x37ee('0x1b')]=qs[_0x37ee('0x1b')](_0x4524bb[_0x37ee('0x31')][_0x37ee('0x1b')]);}return _0x575e2d['getFields'](_0x46c378);}})['then'](function(_0x512e17){if(_0x512e17){return _0x512e17?{'count':_0x5254d2,'rows':_0x512e17}:null;}})[_0x37ee('0x25')](respondWithResult(_0x271e1b,null))['catch'](handleError(_0x271e1b,null));};exports[_0x37ee('0x4e')]=function(_0x1456a0,_0x26d6f3,_0x174692){var _0x3562d9={};var _0x1285d6={};var _0x510ba7;var _0x4a9d05;return db['VtigerConfiguration'][_0x37ee('0x4a')]({'where':{'id':_0x1456a0[_0x37ee('0x45')]['id']}})['then'](handleEntityNotFound(_0x26d6f3,null))[_0x37ee('0x25')](function(_0x58589d){if(_0x58589d){_0x510ba7=_0x58589d;_0x1285d6[_0x37ee('0x30')]=_[_0x37ee('0x32')](db[_0x37ee('0x4b')][_0x37ee('0x2d')]);_0x1285d6['query']=_['keys'](_0x1456a0['query']);_0x1285d6[_0x37ee('0x33')]=_[_0x37ee('0x34')](_0x1285d6[_0x37ee('0x30')],_0x1285d6[_0x37ee('0x31')]);_0x3562d9[_0x37ee('0x35')]=_[_0x37ee('0x34')](_0x1285d6[_0x37ee('0x30')],qs[_0x37ee('0x36')](_0x1456a0[_0x37ee('0x31')]['fields']));_0x3562d9[_0x37ee('0x35')]=_0x3562d9[_0x37ee('0x35')]['length']?_0x3562d9[_0x37ee('0x35')]:_0x1285d6[_0x37ee('0x30')];_0x3562d9[_0x37ee('0x4c')]=qs[_0x37ee('0x39')](_0x1456a0[_0x37ee('0x31')]['sort']);_0x3562d9[_0x37ee('0x3a')]=qs[_0x37ee('0x33')](_['pick'](_0x1456a0['query'],_0x1285d6[_0x37ee('0x33')]));if(_0x1456a0['query']['filter']){_0x3562d9[_0x37ee('0x3a')]=_[_0x37ee('0x3c')](_0x3562d9[_0x37ee('0x3a')],{'$or':_[_0x37ee('0x2c')](_0x3562d9['attributes'],function(_0x1d40eb){var _0x1ea650={};_0x1ea650[_0x1d40eb]={'$like':'%'+_0x1456a0[_0x37ee('0x31')][_0x37ee('0x3e')]+'%'};return _0x1ea650;})});}_0x3562d9=_[_0x37ee('0x3c')]({},_0x3562d9,_0x1456a0[_0x37ee('0x3f')]);return _0x510ba7[_0x37ee('0x4e')](_0x3562d9);}})[_0x37ee('0x25')](function(_0x443bea){if(_0x443bea){_0x4a9d05=_0x443bea['length'];if(!_0x1456a0[_0x37ee('0x31')][_0x37ee('0x4d')]('nolimit')){_0x3562d9[_0x37ee('0x1e')]=qs[_0x37ee('0x1e')](_0x1456a0[_0x37ee('0x31')][_0x37ee('0x1e')]);_0x3562d9[_0x37ee('0x1b')]=qs[_0x37ee('0x1b')](_0x1456a0[_0x37ee('0x31')][_0x37ee('0x1b')]);}return _0x510ba7['getSubjects'](_0x3562d9);}})[_0x37ee('0x25')](function(_0x3c5ea3){if(_0x3c5ea3){return _0x3c5ea3?{'count':_0x4a9d05,'rows':_0x3c5ea3}:null;}})['then'](respondWithResult(_0x26d6f3,null))[_0x37ee('0x44')](handleError(_0x26d6f3,null));};exports[_0x37ee('0x4f')]=function(_0x477ba8,_0x193243,_0x1db912){var _0x2d20f9={};var _0x5f2f66={};var _0x4e06ce;var _0xad3458;return db[_0x37ee('0x40')][_0x37ee('0x4a')]({'where':{'id':_0x477ba8['params']['id']}})[_0x37ee('0x25')](handleEntityNotFound(_0x193243,null))[_0x37ee('0x25')](function(_0x3e5bfe){if(_0x3e5bfe){_0x4e06ce=_0x3e5bfe;_0x5f2f66['model']=_['keys'](db['VtigerField'][_0x37ee('0x2d')]);_0x5f2f66[_0x37ee('0x31')]=_[_0x37ee('0x32')](_0x477ba8[_0x37ee('0x31')]);_0x5f2f66['filters']=_[_0x37ee('0x34')](_0x5f2f66[_0x37ee('0x30')],_0x5f2f66[_0x37ee('0x31')]);_0x2d20f9[_0x37ee('0x35')]=_[_0x37ee('0x34')](_0x5f2f66[_0x37ee('0x30')],qs[_0x37ee('0x36')](_0x477ba8[_0x37ee('0x31')][_0x37ee('0x36')]));_0x2d20f9[_0x37ee('0x35')]=_0x2d20f9[_0x37ee('0x35')][_0x37ee('0x37')]?_0x2d20f9['attributes']:_0x5f2f66['model'];_0x2d20f9[_0x37ee('0x4c')]=qs[_0x37ee('0x39')](_0x477ba8[_0x37ee('0x31')]['sort']);_0x2d20f9[_0x37ee('0x3a')]=qs[_0x37ee('0x33')](_[_0x37ee('0x3b')](_0x477ba8['query'],_0x5f2f66[_0x37ee('0x33')]));if(_0x477ba8[_0x37ee('0x31')][_0x37ee('0x3e')]){_0x2d20f9[_0x37ee('0x3a')]=_[_0x37ee('0x3c')](_0x2d20f9[_0x37ee('0x3a')],{'$or':_['map'](_0x2d20f9[_0x37ee('0x35')],function(_0x166c85){var _0x3c3e9f={};_0x3c3e9f[_0x166c85]={'$like':'%'+_0x477ba8[_0x37ee('0x31')][_0x37ee('0x3e')]+'%'};return _0x3c3e9f;})});}_0x2d20f9=_[_0x37ee('0x3c')]({},_0x2d20f9,_0x477ba8['options']);return _0x4e06ce[_0x37ee('0x4f')](_0x2d20f9);}})[_0x37ee('0x25')](function(_0x2445bc){if(_0x2445bc){_0xad3458=_0x2445bc['length'];if(!_0x477ba8[_0x37ee('0x31')]['hasOwnProperty'](_0x37ee('0x38'))){_0x2d20f9[_0x37ee('0x1e')]=qs[_0x37ee('0x1e')](_0x477ba8[_0x37ee('0x31')][_0x37ee('0x1e')]);_0x2d20f9[_0x37ee('0x1b')]=qs[_0x37ee('0x1b')](_0x477ba8['query'][_0x37ee('0x1b')]);}return _0x4e06ce[_0x37ee('0x4f')](_0x2d20f9);}})['then'](function(_0x32f59b){if(_0x32f59b){return _0x32f59b?{'count':_0xad3458,'rows':_0x32f59b}:null;}})[_0x37ee('0x25')](respondWithResult(_0x193243,null))[_0x37ee('0x44')](handleError(_0x193243,null));}; \ No newline at end of file +var _0x2ec1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','count','set','apply','reject','save','update','then','destroy','name','send','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','nolimit','limit','offset','order','sort','filters','pick','where','type','filter','merge','includeAll','include','rows','catch','params','options','find','create','body','findOne','VtigerField','getFields','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x3ee72d,_0x21b36e){var _0x49e47a=function(_0x4c301a){while(--_0x4c301a){_0x3ee72d['push'](_0x3ee72d['shift']());}};_0x49e47a(++_0x21b36e);}(_0x2ec1,0x92));var _0x12ec=function(_0x2bd8a6,_0x5b9211){_0x2bd8a6=_0x2bd8a6-0x0;var _0x1e037a=_0x2ec1[_0x2bd8a6];return _0x1e037a;};'use strict';var emlformat=require(_0x12ec('0x0'));var rimraf=require(_0x12ec('0x1'));var zipdir=require(_0x12ec('0x2'));var jsonpatch=require(_0x12ec('0x3'));var rp=require(_0x12ec('0x4'));var moment=require(_0x12ec('0x5'));var BPromise=require(_0x12ec('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x12ec('0x7'));var csv=require(_0x12ec('0x8'));var ejs=require(_0x12ec('0x9'));var fs=require('fs');var fs_extra=require(_0x12ec('0xa'));var _=require(_0x12ec('0xb'));var squel=require('squel');var crypto=require(_0x12ec('0xc'));var jsforce=require(_0x12ec('0xd'));var deskjs=require(_0x12ec('0xe'));var toCsv=require(_0x12ec('0x8'));var querystring=require(_0x12ec('0xf'));var Papa=require(_0x12ec('0x10'));var Redis=require(_0x12ec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x12ec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x12ec('0x13'));var logger=require(_0x12ec('0x14'))(_0x12ec('0x15'));var utils=require(_0x12ec('0x16'));var config=require(_0x12ec('0x17'));var licenseUtil=require(_0x12ec('0x18'));var db=require(_0x12ec('0x19'))['db'];function respondWithStatusCode(_0x298d68,_0x557507){_0x557507=_0x557507||0xcc;return function(_0x590886){if(_0x590886){return _0x298d68[_0x12ec('0x1a')](_0x557507);}return _0x298d68['status'](_0x557507)[_0x12ec('0x1b')]();};}function respondWithResult(_0x10293f,_0x1212c3){_0x1212c3=_0x1212c3||0xc8;return function(_0x22558b){if(_0x22558b){return _0x10293f[_0x12ec('0x1c')](_0x1212c3)[_0x12ec('0x1d')](_0x22558b);}};}function respondWithFilteredResult(_0x8c93d6,_0xa7d67){return function(_0x3b7b05){if(_0x3b7b05){var _0x41e9ae=typeof _0xa7d67['offset']===_0x12ec('0x1e')&&typeof _0xa7d67['limit']===_0x12ec('0x1e');var _0x20a229=_0x3b7b05[_0x12ec('0x1f')];var _0x26a85c=_0x41e9ae?0x0:_0xa7d67['offset'];var _0x1280c6=_0x41e9ae?_0x3b7b05[_0x12ec('0x1f')]:_0xa7d67['offset']+_0xa7d67['limit'];var _0x1b9a15;if(_0x1280c6>=_0x20a229){_0x1280c6=_0x20a229;_0x1b9a15=0xc8;}else{_0x1b9a15=0xce;}_0x8c93d6['status'](_0x1b9a15);return _0x8c93d6[_0x12ec('0x20')]('Content-Range',_0x26a85c+'-'+_0x1280c6+'/'+_0x20a229)[_0x12ec('0x1d')](_0x3b7b05);}return null;};}function patchUpdates(_0x42dab1){return function(_0x23ffab){try{jsonpatch[_0x12ec('0x21')](_0x23ffab,_0x42dab1,!![]);}catch(_0x100a57){return BPromise[_0x12ec('0x22')](_0x100a57);}return _0x23ffab[_0x12ec('0x23')]();};}function saveUpdates(_0x2919fa,_0x475a0e){return function(_0x2a14b7){if(_0x2a14b7){return _0x2a14b7[_0x12ec('0x24')](_0x2919fa)[_0x12ec('0x25')](function(_0x542ea4){return _0x542ea4;});}return null;};}function removeEntity(_0x37de0d,_0x41566a){return function(_0x25076d){if(_0x25076d){return _0x25076d[_0x12ec('0x26')]()[_0x12ec('0x25')](function(){_0x37de0d[_0x12ec('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11de52,_0x3373cd){return function(_0x4abb29){if(!_0x4abb29){_0x11de52[_0x12ec('0x1a')](0x194);}return _0x4abb29;};}function handleError(_0x37ce3b,_0x45336f){_0x45336f=_0x45336f||0x1f4;return function(_0x2c9ebd){logger['error'](_0x2c9ebd['stack']);if(_0x2c9ebd[_0x12ec('0x27')]){delete _0x2c9ebd[_0x12ec('0x27')];}_0x37ce3b[_0x12ec('0x1c')](_0x45336f)[_0x12ec('0x28')](_0x2c9ebd);};}exports['index']=function(_0x568a61,_0x293f0f){var _0x402fc5={},_0x41fa66={},_0x18fa3b={'count':0x0,'rows':[]};var _0x4db2a9=_['map'](db[_0x12ec('0x29')][_0x12ec('0x2a')],function(_0x138595){return{'name':_0x138595[_0x12ec('0x2b')],'type':_0x138595['type'][_0x12ec('0x2c')]};});_0x41fa66[_0x12ec('0x2d')]=_[_0x12ec('0x2e')](_0x4db2a9,_0x12ec('0x27'));_0x41fa66[_0x12ec('0x2f')]=_[_0x12ec('0x30')](_0x568a61['query']);_0x41fa66['filters']=_[_0x12ec('0x31')](_0x41fa66[_0x12ec('0x2d')],_0x41fa66['query']);_0x402fc5[_0x12ec('0x32')]=_[_0x12ec('0x31')](_0x41fa66['model'],qs[_0x12ec('0x33')](_0x568a61[_0x12ec('0x2f')][_0x12ec('0x33')]));_0x402fc5['attributes']=_0x402fc5[_0x12ec('0x32')][_0x12ec('0x34')]?_0x402fc5[_0x12ec('0x32')]:_0x41fa66[_0x12ec('0x2d')];if(!_0x568a61[_0x12ec('0x2f')]['hasOwnProperty'](_0x12ec('0x35'))){_0x402fc5['limit']=qs[_0x12ec('0x36')](_0x568a61[_0x12ec('0x2f')][_0x12ec('0x36')]);_0x402fc5[_0x12ec('0x37')]=qs['offset'](_0x568a61[_0x12ec('0x2f')]['offset']);}_0x402fc5[_0x12ec('0x38')]=qs[_0x12ec('0x39')](_0x568a61[_0x12ec('0x2f')][_0x12ec('0x39')]);_0x402fc5['where']=qs[_0x12ec('0x3a')](_[_0x12ec('0x3b')](_0x568a61[_0x12ec('0x2f')],_0x41fa66['filters']),_0x4db2a9);if(_0x568a61['query']['filter']){_0x402fc5['where']=_['merge'](_0x402fc5[_0x12ec('0x3c')],{'$or':_[_0x12ec('0x2e')](_0x4db2a9,function(_0x3b363a){if(_0x3b363a[_0x12ec('0x3d')]!=='VIRTUAL'){var _0x32c71d={};_0x32c71d[_0x3b363a[_0x12ec('0x27')]]={'$like':'%'+_0x568a61[_0x12ec('0x2f')][_0x12ec('0x3e')]+'%'};return _0x32c71d;}})});}_0x402fc5=_[_0x12ec('0x3f')]({},_0x402fc5,_0x568a61['options']);var _0x46c2b8={'where':_0x402fc5[_0x12ec('0x3c')]};return db[_0x12ec('0x29')][_0x12ec('0x1f')](_0x46c2b8)['then'](function(_0x314d96){_0x18fa3b[_0x12ec('0x1f')]=_0x314d96;if(_0x568a61[_0x12ec('0x2f')][_0x12ec('0x40')]){_0x402fc5[_0x12ec('0x41')]=[{'all':!![]}];}return db[_0x12ec('0x29')]['findAll'](_0x402fc5);})['then'](function(_0x4dd154){_0x18fa3b[_0x12ec('0x42')]=_0x4dd154;return _0x18fa3b;})[_0x12ec('0x25')](respondWithFilteredResult(_0x293f0f,_0x402fc5))[_0x12ec('0x43')](handleError(_0x293f0f,null));};exports['show']=function(_0x132f93,_0x1fb77e){var _0x74a4d7={'raw':![],'where':{'id':_0x132f93[_0x12ec('0x44')]['id']}},_0x26347a={};_0x26347a['model']=_['keys'](db['VtigerConfiguration'][_0x12ec('0x2a')]);_0x26347a['query']=_[_0x12ec('0x30')](_0x132f93['query']);_0x26347a[_0x12ec('0x3a')]=_[_0x12ec('0x31')](_0x26347a[_0x12ec('0x2d')],_0x26347a[_0x12ec('0x2f')]);_0x74a4d7[_0x12ec('0x32')]=_[_0x12ec('0x31')](_0x26347a[_0x12ec('0x2d')],qs[_0x12ec('0x33')](_0x132f93['query'][_0x12ec('0x33')]));_0x74a4d7[_0x12ec('0x32')]=_0x74a4d7['attributes'][_0x12ec('0x34')]?_0x74a4d7[_0x12ec('0x32')]:_0x26347a[_0x12ec('0x2d')];if(_0x132f93[_0x12ec('0x2f')][_0x12ec('0x40')]){_0x74a4d7[_0x12ec('0x41')]=[{'all':!![]}];}_0x74a4d7=_[_0x12ec('0x3f')]({},_0x74a4d7,_0x132f93[_0x12ec('0x45')]);return db[_0x12ec('0x29')][_0x12ec('0x46')](_0x74a4d7)[_0x12ec('0x25')](handleEntityNotFound(_0x1fb77e,null))[_0x12ec('0x25')](respondWithResult(_0x1fb77e,null))[_0x12ec('0x43')](handleError(_0x1fb77e,null));};exports[_0x12ec('0x47')]=function(_0x50101e,_0x399fcf){return db[_0x12ec('0x29')][_0x12ec('0x47')](_0x50101e[_0x12ec('0x48')],{})[_0x12ec('0x25')](respondWithResult(_0x399fcf,0xc9))[_0x12ec('0x43')](handleError(_0x399fcf,null));};exports[_0x12ec('0x24')]=function(_0x423028,_0xc237f1){if(_0x423028['body']['id']){delete _0x423028[_0x12ec('0x48')]['id'];}return db[_0x12ec('0x29')][_0x12ec('0x46')]({'where':{'id':_0x423028[_0x12ec('0x44')]['id']}})[_0x12ec('0x25')](handleEntityNotFound(_0xc237f1,null))[_0x12ec('0x25')](saveUpdates(_0x423028[_0x12ec('0x48')],null))['then'](respondWithResult(_0xc237f1,null))[_0x12ec('0x43')](handleError(_0xc237f1,null));};exports['destroy']=function(_0x4ab490,_0x542a88){return db[_0x12ec('0x29')][_0x12ec('0x46')]({'where':{'id':_0x4ab490[_0x12ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x542a88,null))[_0x12ec('0x25')](removeEntity(_0x542a88,null))[_0x12ec('0x43')](handleError(_0x542a88,null));};exports['getFields']=function(_0x4ee72b,_0x42a1cc,_0x32747b){var _0x43d570={};var _0x368cb5={};var _0x1b202e;var _0x262643;return db[_0x12ec('0x29')][_0x12ec('0x49')]({'where':{'id':_0x4ee72b[_0x12ec('0x44')]['id']}})[_0x12ec('0x25')](handleEntityNotFound(_0x42a1cc,null))[_0x12ec('0x25')](function(_0x481bb2){if(_0x481bb2){_0x1b202e=_0x481bb2;_0x368cb5[_0x12ec('0x2d')]=_['keys'](db[_0x12ec('0x4a')][_0x12ec('0x2a')]);_0x368cb5[_0x12ec('0x2f')]=_[_0x12ec('0x30')](_0x4ee72b['query']);_0x368cb5[_0x12ec('0x3a')]=_['intersection'](_0x368cb5[_0x12ec('0x2d')],_0x368cb5[_0x12ec('0x2f')]);_0x43d570[_0x12ec('0x32')]=_[_0x12ec('0x31')](_0x368cb5[_0x12ec('0x2d')],qs[_0x12ec('0x33')](_0x4ee72b['query'][_0x12ec('0x33')]));_0x43d570[_0x12ec('0x32')]=_0x43d570['attributes']['length']?_0x43d570[_0x12ec('0x32')]:_0x368cb5['model'];_0x43d570[_0x12ec('0x38')]=qs[_0x12ec('0x39')](_0x4ee72b['query']['sort']);_0x43d570[_0x12ec('0x3c')]=qs[_0x12ec('0x3a')](_[_0x12ec('0x3b')](_0x4ee72b[_0x12ec('0x2f')],_0x368cb5[_0x12ec('0x3a')]));if(_0x4ee72b['query'][_0x12ec('0x3e')]){_0x43d570[_0x12ec('0x3c')]=_[_0x12ec('0x3f')](_0x43d570[_0x12ec('0x3c')],{'$or':_[_0x12ec('0x2e')](_0x43d570[_0x12ec('0x32')],function(_0xb883eb){var _0x7965aa={};_0x7965aa[_0xb883eb]={'$like':'%'+_0x4ee72b[_0x12ec('0x2f')][_0x12ec('0x3e')]+'%'};return _0x7965aa;})});}_0x43d570=_[_0x12ec('0x3f')]({},_0x43d570,_0x4ee72b[_0x12ec('0x45')]);return _0x1b202e[_0x12ec('0x4b')](_0x43d570);}})['then'](function(_0x2ec802){if(_0x2ec802){_0x262643=_0x2ec802[_0x12ec('0x34')];if(!_0x4ee72b[_0x12ec('0x2f')][_0x12ec('0x4c')](_0x12ec('0x35'))){_0x43d570[_0x12ec('0x36')]=qs[_0x12ec('0x36')](_0x4ee72b[_0x12ec('0x2f')]['limit']);_0x43d570[_0x12ec('0x37')]=qs[_0x12ec('0x37')](_0x4ee72b[_0x12ec('0x2f')][_0x12ec('0x37')]);}return _0x1b202e[_0x12ec('0x4b')](_0x43d570);}})[_0x12ec('0x25')](function(_0x39b7bb){if(_0x39b7bb){return _0x39b7bb?{'count':_0x262643,'rows':_0x39b7bb}:null;}})[_0x12ec('0x25')](respondWithResult(_0x42a1cc,null))[_0x12ec('0x43')](handleError(_0x42a1cc,null));};exports[_0x12ec('0x4d')]=function(_0x323c05,_0x177b54,_0x1d3d23){var _0x3f8a31={};var _0x62f297={};var _0x25d2c1;var _0x4c93b2;return db[_0x12ec('0x29')]['findOne']({'where':{'id':_0x323c05[_0x12ec('0x44')]['id']}})[_0x12ec('0x25')](handleEntityNotFound(_0x177b54,null))['then'](function(_0x104a0c){if(_0x104a0c){_0x25d2c1=_0x104a0c;_0x62f297[_0x12ec('0x2d')]=_[_0x12ec('0x30')](db[_0x12ec('0x4a')][_0x12ec('0x2a')]);_0x62f297[_0x12ec('0x2f')]=_[_0x12ec('0x30')](_0x323c05[_0x12ec('0x2f')]);_0x62f297[_0x12ec('0x3a')]=_[_0x12ec('0x31')](_0x62f297['model'],_0x62f297[_0x12ec('0x2f')]);_0x3f8a31['attributes']=_['intersection'](_0x62f297[_0x12ec('0x2d')],qs[_0x12ec('0x33')](_0x323c05[_0x12ec('0x2f')][_0x12ec('0x33')]));_0x3f8a31[_0x12ec('0x32')]=_0x3f8a31[_0x12ec('0x32')]['length']?_0x3f8a31[_0x12ec('0x32')]:_0x62f297['model'];_0x3f8a31[_0x12ec('0x38')]=qs[_0x12ec('0x39')](_0x323c05['query'][_0x12ec('0x39')]);_0x3f8a31['where']=qs[_0x12ec('0x3a')](_[_0x12ec('0x3b')](_0x323c05[_0x12ec('0x2f')],_0x62f297['filters']));if(_0x323c05['query'][_0x12ec('0x3e')]){_0x3f8a31[_0x12ec('0x3c')]=_['merge'](_0x3f8a31[_0x12ec('0x3c')],{'$or':_[_0x12ec('0x2e')](_0x3f8a31[_0x12ec('0x32')],function(_0x45de1e){var _0x4be8e1={};_0x4be8e1[_0x45de1e]={'$like':'%'+_0x323c05[_0x12ec('0x2f')][_0x12ec('0x3e')]+'%'};return _0x4be8e1;})});}_0x3f8a31=_[_0x12ec('0x3f')]({},_0x3f8a31,_0x323c05['options']);return _0x25d2c1[_0x12ec('0x4d')](_0x3f8a31);}})[_0x12ec('0x25')](function(_0x7361f8){if(_0x7361f8){_0x4c93b2=_0x7361f8[_0x12ec('0x34')];if(!_0x323c05[_0x12ec('0x2f')][_0x12ec('0x4c')](_0x12ec('0x35'))){_0x3f8a31['limit']=qs[_0x12ec('0x36')](_0x323c05['query'][_0x12ec('0x36')]);_0x3f8a31['offset']=qs[_0x12ec('0x37')](_0x323c05[_0x12ec('0x2f')][_0x12ec('0x37')]);}return _0x25d2c1['getSubjects'](_0x3f8a31);}})[_0x12ec('0x25')](function(_0x4b44ba){if(_0x4b44ba){return _0x4b44ba?{'count':_0x4c93b2,'rows':_0x4b44ba}:null;}})[_0x12ec('0x25')](respondWithResult(_0x177b54,null))[_0x12ec('0x43')](handleError(_0x177b54,null));};exports[_0x12ec('0x4e')]=function(_0x252a57,_0x815d01,_0x3c51dc){var _0x251cec={};var _0x54ee85={};var _0x4ff4ab;var _0x373936;return db[_0x12ec('0x29')][_0x12ec('0x49')]({'where':{'id':_0x252a57['params']['id']}})[_0x12ec('0x25')](handleEntityNotFound(_0x815d01,null))[_0x12ec('0x25')](function(_0x3458ef){if(_0x3458ef){_0x4ff4ab=_0x3458ef;_0x54ee85[_0x12ec('0x2d')]=_[_0x12ec('0x30')](db[_0x12ec('0x4a')][_0x12ec('0x2a')]);_0x54ee85[_0x12ec('0x2f')]=_[_0x12ec('0x30')](_0x252a57[_0x12ec('0x2f')]);_0x54ee85[_0x12ec('0x3a')]=_[_0x12ec('0x31')](_0x54ee85[_0x12ec('0x2d')],_0x54ee85[_0x12ec('0x2f')]);_0x251cec[_0x12ec('0x32')]=_['intersection'](_0x54ee85[_0x12ec('0x2d')],qs[_0x12ec('0x33')](_0x252a57[_0x12ec('0x2f')][_0x12ec('0x33')]));_0x251cec[_0x12ec('0x32')]=_0x251cec[_0x12ec('0x32')][_0x12ec('0x34')]?_0x251cec['attributes']:_0x54ee85[_0x12ec('0x2d')];_0x251cec['order']=qs[_0x12ec('0x39')](_0x252a57[_0x12ec('0x2f')][_0x12ec('0x39')]);_0x251cec[_0x12ec('0x3c')]=qs[_0x12ec('0x3a')](_[_0x12ec('0x3b')](_0x252a57[_0x12ec('0x2f')],_0x54ee85[_0x12ec('0x3a')]));if(_0x252a57[_0x12ec('0x2f')]['filter']){_0x251cec[_0x12ec('0x3c')]=_[_0x12ec('0x3f')](_0x251cec['where'],{'$or':_[_0x12ec('0x2e')](_0x251cec[_0x12ec('0x32')],function(_0x4fcdb9){var _0x4b9923={};_0x4b9923[_0x4fcdb9]={'$like':'%'+_0x252a57[_0x12ec('0x2f')][_0x12ec('0x3e')]+'%'};return _0x4b9923;})});}_0x251cec=_[_0x12ec('0x3f')]({},_0x251cec,_0x252a57[_0x12ec('0x45')]);return _0x4ff4ab[_0x12ec('0x4e')](_0x251cec);}})[_0x12ec('0x25')](function(_0x246a7d){if(_0x246a7d){_0x373936=_0x246a7d['length'];if(!_0x252a57[_0x12ec('0x2f')][_0x12ec('0x4c')](_0x12ec('0x35'))){_0x251cec['limit']=qs['limit'](_0x252a57[_0x12ec('0x2f')][_0x12ec('0x36')]);_0x251cec['offset']=qs[_0x12ec('0x37')](_0x252a57[_0x12ec('0x2f')][_0x12ec('0x37')]);}return _0x4ff4ab[_0x12ec('0x4e')](_0x251cec);}})['then'](function(_0x556257){if(_0x556257){return _0x556257?{'count':_0x373936,'rows':_0x556257}:null;}})['then'](respondWithResult(_0x815d01,null))[_0x12ec('0x43')](handleError(_0x815d01,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 2af2ab0..2144a36 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 _0x9489=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x51489,_0x3e95a4){var _0x3ead23=function(_0x3c6efe){while(--_0x3c6efe){_0x51489['push'](_0x51489['shift']());}};_0x3ead23(++_0x3e95a4);}(_0x9489,0x157));var _0x9948=function(_0x55c0da,_0x302a3f){_0x55c0da=_0x55c0da-0x0;var _0x28c096=_0x9489[_0x55c0da];return _0x28c096;};'use strict';var _=require(_0x9948('0x0'));var util=require(_0x9948('0x1'));var logger=require(_0x9948('0x2'))(_0x9948('0x3'));var moment=require(_0x9948('0x4'));var BPromise=require(_0x9948('0x5'));var rp=require(_0x9948('0x6'));var fs=require('fs');var path=require(_0x9948('0x7'));var rimraf=require(_0x9948('0x8'));var config=require(_0x9948('0x9'));var attributes=require(_0x9948('0xa'));module[_0x9948('0xb')]=function(_0x153b07,_0x24ee17){return _0x153b07[_0x9948('0xc')](_0x9948('0xd'),attributes,{'tableName':_0x9948('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa59e=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa59e,0x12b));var _0xea59=function(_0x75e5f1,_0x14fd55){_0x75e5f1=_0x75e5f1-0x0;var _0x5564f3=_0xa59e[_0x75e5f1];return _0x5564f3;};'use strict';var _=require('lodash');var util=require(_0xea59('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xea59('0x1'));var BPromise=require(_0xea59('0x2'));var rp=require(_0xea59('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea59('0x4'));var config=require(_0xea59('0x5'));var attributes=require(_0xea59('0x6'));module[_0xea59('0x7')]=function(_0x532c8e,_0x5ae916){return _0x532c8e['define'](_0xea59('0x8'),attributes,{'tableName':_0xea59('0x9'),'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 17af24f..10f99c6 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 _0x9f8a=['client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x9f8a,0x1b0));var _0xa9f8=function(_0x28ccad,_0x413b5b){_0x28ccad=_0x28ccad-0x0;var _0x3271cc=_0x9f8a[_0x28ccad];return _0x3271cc;};'use strict';var _=require('lodash');var util=require(_0xa9f8('0x0'));var moment=require(_0xa9f8('0x1'));var BPromise=require(_0xa9f8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9f8('0x3'));var db=require(_0xa9f8('0x4'))['db'];var utils=require(_0xa9f8('0x5'));var logger=require(_0xa9f8('0x6'))(_0xa9f8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa9f8('0x8')][_0xa9f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32cc03,_0x442526,_0x1535c8){return new BPromise(function(_0xaaf114,_0x572f9c){return client[_0xa9f8('0xa')](_0x32cc03,_0x1535c8)[_0xa9f8('0xb')](function(_0xa50415){logger[_0xa9f8('0xc')](_0xa9f8('0xd'),_0x442526,_0xa9f8('0xe'));logger['debug'](_0xa9f8('0xf'),_0x442526,'request\x20sent',JSON[_0xa9f8('0x10')](_0xa50415));if(_0xa50415[_0xa9f8('0x11')]){if(_0xa50415[_0xa9f8('0x11')]['code']===0x1f4){logger[_0xa9f8('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x442526,_0xa50415['error']['message']);return _0x572f9c(_0xa50415['error'][_0xa9f8('0x12')]);}logger[_0xa9f8('0x11')](_0xa9f8('0xd'),_0x442526,_0xa50415[_0xa9f8('0x11')]['message']);return _0xaaf114(_0xa50415['error'][_0xa9f8('0x12')]);}else{logger[_0xa9f8('0xc')](_0xa9f8('0xd'),_0x442526,_0xa9f8('0xe'));_0xaaf114(_0xa50415['result'][_0xa9f8('0x12')]);}})[_0xa9f8('0x13')](function(_0x25850a){logger[_0xa9f8('0x11')](_0xa9f8('0xd'),_0x442526,_0x25850a);_0x572f9c(_0x25850a);});});} \ No newline at end of file +var _0xbaf1=['randomstring','rpc','../../config/environment','client','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird'];(function(_0x36bab3,_0x19ce33){var _0x2d3989=function(_0x2a4f60){while(--_0x2a4f60){_0x36bab3['push'](_0x36bab3['shift']());}};_0x2d3989(++_0x19ce33);}(_0xbaf1,0x95));var _0x1baf=function(_0x294d2c,_0x4ec825){_0x294d2c=_0x294d2c-0x0;var _0x4c7417=_0xbaf1[_0x294d2c];return _0x4c7417;};'use strict';var _=require(_0x1baf('0x0'));var util=require('util');var moment=require(_0x1baf('0x1'));var BPromise=require(_0x1baf('0x2'));var rs=require(_0x1baf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1baf('0x4'));var config=require(_0x1baf('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1baf('0x6')][_0x1baf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1609a7,_0x3f0b57,_0x5c236c){return new BPromise(function(_0x2b9b1e,_0xb8800f){return client[_0x1baf('0x8')](_0x1609a7,_0x5c236c)[_0x1baf('0x9')](function(_0x5215b9){logger[_0x1baf('0xa')](_0x1baf('0xb'),_0x3f0b57,'request\x20sent');logger[_0x1baf('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x3f0b57,_0x1baf('0xd'),JSON[_0x1baf('0xe')](_0x5215b9));if(_0x5215b9[_0x1baf('0xf')]){if(_0x5215b9[_0x1baf('0xf')]['code']===0x1f4){logger[_0x1baf('0xf')](_0x1baf('0xb'),_0x3f0b57,_0x5215b9[_0x1baf('0xf')][_0x1baf('0x10')]);return _0xb8800f(_0x5215b9[_0x1baf('0xf')][_0x1baf('0x10')]);}logger[_0x1baf('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0x3f0b57,_0x5215b9['error'][_0x1baf('0x10')]);return _0x2b9b1e(_0x5215b9[_0x1baf('0xf')][_0x1baf('0x10')]);}else{logger['info'](_0x1baf('0xb'),_0x3f0b57,'request\x20sent');_0x2b9b1e(_0x5215b9[_0x1baf('0x11')][_0x1baf('0x10')]);}})[_0x1baf('0x12')](function(_0x24f8cd){logger[_0x1baf('0xf')](_0x1baf('0xb'),_0x3f0b57,_0x24f8cd);_0xb8800f(_0x24f8cd);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index cd36008..7805225 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 _0x53f1=['get','isAuthenticated','post','create','delete','/:id','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x30a6d6,_0x7a1026){var _0x1af246=function(_0x497203){while(--_0x497203){_0x30a6d6['push'](_0x30a6d6['shift']());}};_0x1af246(++_0x7a1026);}(_0x53f1,0x170));var _0x153f=function(_0x4ee0be,_0x200c1f){_0x4ee0be=_0x4ee0be-0x0;var _0x533b75=_0x53f1[_0x4ee0be];return _0x533b75;};'use strict';var multer=require(_0x153f('0x0'));var util=require('util');var path=require(_0x153f('0x1'));var timeout=require('connect-timeout');var express=require(_0x153f('0x2'));var router=express[_0x153f('0x3')]();var fs_extra=require(_0x153f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x153f('0x5'));var config=require(_0x153f('0x6'));var controller=require('./intVtigerField.controller');router[_0x153f('0x7')]('/',auth[_0x153f('0x8')](),controller['index']);router[_0x153f('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x153f('0x9')]('/',auth['isAuthenticated'](),controller[_0x153f('0xa')]);router['put']('/:id',auth[_0x153f('0x8')](),controller['update']);router[_0x153f('0xb')](_0x153f('0xc'),auth[_0x153f('0x8')](),controller[_0x153f('0xd')]);module[_0x153f('0xe')]=router; \ No newline at end of file +var _0x7ca5=['../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x257a28,_0x2cd00d){var _0x13bccc=function(_0x32c46f){while(--_0x32c46f){_0x257a28['push'](_0x257a28['shift']());}};_0x13bccc(++_0x2cd00d);}(_0x7ca5,0x1ed));var _0x57ca=function(_0x16c5a6,_0x27c3b5){_0x16c5a6=_0x16c5a6-0x0;var _0x36e3cb=_0x7ca5[_0x16c5a6];return _0x36e3cb;};'use strict';var multer=require(_0x57ca('0x0'));var util=require(_0x57ca('0x1'));var path=require(_0x57ca('0x2'));var timeout=require('connect-timeout');var express=require(_0x57ca('0x3'));var router=express[_0x57ca('0x4')]();var fs_extra=require(_0x57ca('0x5'));var auth=require(_0x57ca('0x6'));var interaction=require(_0x57ca('0x7'));var config=require(_0x57ca('0x8'));var controller=require(_0x57ca('0x9'));router[_0x57ca('0xa')]('/',auth[_0x57ca('0xb')](),controller[_0x57ca('0xc')]);router[_0x57ca('0xa')](_0x57ca('0xd'),auth[_0x57ca('0xb')](),controller[_0x57ca('0xe')]);router[_0x57ca('0xf')]('/',auth[_0x57ca('0xb')](),controller[_0x57ca('0x10')]);router[_0x57ca('0x11')](_0x57ca('0xd'),auth[_0x57ca('0xb')](),controller[_0x57ca('0x12')]);router['delete'](_0x57ca('0xd'),auth[_0x57ca('0xb')](),controller[_0x57ca('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 6b38ea7..37e4691 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 _0xac9e=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x23c058,_0x3a2777){var _0x3885cf=function(_0x2ab66b){while(--_0x2ab66b){_0x23c058['push'](_0x23c058['shift']());}};_0x3885cf(++_0x3a2777);}(_0xac9e,0xcc));var _0xeac9=function(_0x5e732c,_0x4a2898){_0x5e732c=_0x5e732c-0x0;var _0x133861=_0xac9e[_0x5e732c];return _0x133861;};'use strict';var Sequelize=require(_0xeac9('0x0'));module[_0xeac9('0x1')]={'type':{'type':Sequelize[_0xeac9('0x2')]('string',_0xeac9('0x3'),_0xeac9('0x4'),_0xeac9('0x5'),_0xeac9('0x6')),'defaultValue':_0xeac9('0x7')},'content':{'type':Sequelize[_0xeac9('0x8')]},'key':{'type':Sequelize[_0xeac9('0x8')]},'keyType':{'type':Sequelize[_0xeac9('0x2')](_0xeac9('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xeac9('0x8')]},'idField':{'type':Sequelize[_0xeac9('0x8')]},'nameField':{'type':Sequelize[_0xeac9('0x8')]},'customField':{'type':Sequelize[_0xeac9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeac9('0x8')]}}; \ No newline at end of file +var _0x1899=['sequelize','exports','ENUM','variable','customVariable','string','STRING','BOOLEAN'];(function(_0x5ce34a,_0x57887e){var _0x309350=function(_0x52a947){while(--_0x52a947){_0x5ce34a['push'](_0x5ce34a['shift']());}};_0x309350(++_0x57887e);}(_0x1899,0x180));var _0x9189=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x1899[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x9189('0x0'));module[_0x9189('0x1')]={'type':{'type':Sequelize[_0x9189('0x2')]('string',_0x9189('0x3'),_0x9189('0x4'),'keyValue','picklist'),'defaultValue':_0x9189('0x5')},'content':{'type':Sequelize[_0x9189('0x6')]},'key':{'type':Sequelize[_0x9189('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0x9189('0x3'),_0x9189('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9189('0x6')]},'nameField':{'type':Sequelize[_0x9189('0x6')]},'customField':{'type':Sequelize[_0x9189('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9189('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index ae97981..c9e58bc 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 _0xbf48=['limit','set','apply','reject','save','update','then','destroy','error','stack','name','map','VtigerField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x2d33d4,_0x31a540){var _0x2e2ecd=function(_0x32fab7){while(--_0x32fab7){_0x2d33d4['push'](_0x2d33d4['shift']());}};_0x2e2ecd(++_0x31a540);}(_0xbf48,0x77));var _0x8bf4=function(_0x289ab6,_0x365c3c){_0x289ab6=_0x289ab6-0x0;var _0x5e3231=_0xbf48[_0x289ab6];return _0x5e3231;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8bf4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8bf4('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8bf4('0x2'));var util=require(_0x8bf4('0x3'));var path=require(_0x8bf4('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8bf4('0x5'));var _=require(_0x8bf4('0x6'));var squel=require(_0x8bf4('0x7'));var crypto=require(_0x8bf4('0x8'));var jsforce=require(_0x8bf4('0x9'));var deskjs=require(_0x8bf4('0xa'));var toCsv=require(_0x8bf4('0xb'));var querystring=require('querystring');var Papa=require(_0x8bf4('0xc'));var Redis=require(_0x8bf4('0xd'));var authService=require(_0x8bf4('0xe'));var qs=require(_0x8bf4('0xf'));var as=require(_0x8bf4('0x10'));var hardwareService=require(_0x8bf4('0x11'));var logger=require(_0x8bf4('0x12'))(_0x8bf4('0x13'));var utils=require(_0x8bf4('0x14'));var config=require(_0x8bf4('0x15'));var licenseUtil=require(_0x8bf4('0x16'));var db=require(_0x8bf4('0x17'))['db'];function respondWithStatusCode(_0x193741,_0x743080){_0x743080=_0x743080||0xcc;return function(_0x414b87){if(_0x414b87){return _0x193741[_0x8bf4('0x18')](_0x743080);}return _0x193741[_0x8bf4('0x19')](_0x743080)[_0x8bf4('0x1a')]();};}function respondWithResult(_0x26506d,_0x4a9b46){_0x4a9b46=_0x4a9b46||0xc8;return function(_0x234963){if(_0x234963){return _0x26506d[_0x8bf4('0x19')](_0x4a9b46)[_0x8bf4('0x1b')](_0x234963);}};}function respondWithFilteredResult(_0x1d441a,_0x52b5dc){return function(_0x36fe97){if(_0x36fe97){var _0x4db890=typeof _0x52b5dc['offset']===_0x8bf4('0x1c')&&typeof _0x52b5dc['limit']===_0x8bf4('0x1c');var _0xfff479=_0x36fe97[_0x8bf4('0x1d')];var _0xb74e73=_0x4db890?0x0:_0x52b5dc[_0x8bf4('0x1e')];var _0x5a13dd=_0x4db890?_0x36fe97[_0x8bf4('0x1d')]:_0x52b5dc[_0x8bf4('0x1e')]+_0x52b5dc[_0x8bf4('0x1f')];var _0x433826;if(_0x5a13dd>=_0xfff479){_0x5a13dd=_0xfff479;_0x433826=0xc8;}else{_0x433826=0xce;}_0x1d441a[_0x8bf4('0x19')](_0x433826);return _0x1d441a[_0x8bf4('0x20')]('Content-Range',_0xb74e73+'-'+_0x5a13dd+'/'+_0xfff479)[_0x8bf4('0x1b')](_0x36fe97);}return null;};}function patchUpdates(_0xa22a36){return function(_0x227701){try{jsonpatch[_0x8bf4('0x21')](_0x227701,_0xa22a36,!![]);}catch(_0x5beba9){return BPromise[_0x8bf4('0x22')](_0x5beba9);}return _0x227701[_0x8bf4('0x23')]();};}function saveUpdates(_0x2721ff,_0x23b345){return function(_0x5e22ce){if(_0x5e22ce){return _0x5e22ce[_0x8bf4('0x24')](_0x2721ff)[_0x8bf4('0x25')](function(_0x1cfaf0){return _0x1cfaf0;});}return null;};}function removeEntity(_0x53d03d,_0x18cff7){return function(_0x31ec05){if(_0x31ec05){return _0x31ec05[_0x8bf4('0x26')]()[_0x8bf4('0x25')](function(){_0x53d03d[_0x8bf4('0x19')](0xcc)[_0x8bf4('0x1a')]();});}};}function handleEntityNotFound(_0x310724,_0x2cfcad){return function(_0x3e7feb){if(!_0x3e7feb){_0x310724[_0x8bf4('0x18')](0x194);}return _0x3e7feb;};}function handleError(_0x2b6fe9,_0x265e8d){_0x265e8d=_0x265e8d||0x1f4;return function(_0xfa6d5a){logger[_0x8bf4('0x27')](_0xfa6d5a[_0x8bf4('0x28')]);if(_0xfa6d5a[_0x8bf4('0x29')]){delete _0xfa6d5a[_0x8bf4('0x29')];}_0x2b6fe9['status'](_0x265e8d)['send'](_0xfa6d5a);};}exports['index']=function(_0x293125,_0x208122){var _0x2662cc={},_0x1803f0={},_0x4908ef={'count':0x0,'rows':[]};var _0x442c58=_[_0x8bf4('0x2a')](db[_0x8bf4('0x2b')][_0x8bf4('0x2c')],function(_0x29a2d9){return{'name':_0x29a2d9['fieldName'],'type':_0x29a2d9[_0x8bf4('0x2d')][_0x8bf4('0x2e')]};});_0x1803f0['model']=_['map'](_0x442c58,_0x8bf4('0x29'));_0x1803f0[_0x8bf4('0x2f')]=_[_0x8bf4('0x30')](_0x293125[_0x8bf4('0x2f')]);_0x1803f0[_0x8bf4('0x31')]=_[_0x8bf4('0x32')](_0x1803f0[_0x8bf4('0x33')],_0x1803f0[_0x8bf4('0x2f')]);_0x2662cc[_0x8bf4('0x34')]=_['intersection'](_0x1803f0[_0x8bf4('0x33')],qs[_0x8bf4('0x35')](_0x293125['query']['fields']));_0x2662cc[_0x8bf4('0x34')]=_0x2662cc[_0x8bf4('0x34')][_0x8bf4('0x36')]?_0x2662cc[_0x8bf4('0x34')]:_0x1803f0[_0x8bf4('0x33')];if(!_0x293125[_0x8bf4('0x2f')][_0x8bf4('0x37')](_0x8bf4('0x38'))){_0x2662cc[_0x8bf4('0x1f')]=qs[_0x8bf4('0x1f')](_0x293125[_0x8bf4('0x2f')][_0x8bf4('0x1f')]);_0x2662cc[_0x8bf4('0x1e')]=qs[_0x8bf4('0x1e')](_0x293125[_0x8bf4('0x2f')]['offset']);}_0x2662cc[_0x8bf4('0x39')]=qs[_0x8bf4('0x3a')](_0x293125['query'][_0x8bf4('0x3a')]);_0x2662cc['where']=qs[_0x8bf4('0x31')](_[_0x8bf4('0x3b')](_0x293125[_0x8bf4('0x2f')],_0x1803f0[_0x8bf4('0x31')]),_0x442c58);if(_0x293125[_0x8bf4('0x2f')][_0x8bf4('0x3c')]){_0x2662cc[_0x8bf4('0x3d')]=_[_0x8bf4('0x3e')](_0x2662cc[_0x8bf4('0x3d')],{'$or':_[_0x8bf4('0x2a')](_0x442c58,function(_0x40fb82){if(_0x40fb82[_0x8bf4('0x2d')]!==_0x8bf4('0x3f')){var _0x310f7a={};_0x310f7a[_0x40fb82[_0x8bf4('0x29')]]={'$like':'%'+_0x293125[_0x8bf4('0x2f')][_0x8bf4('0x3c')]+'%'};return _0x310f7a;}})});}_0x2662cc=_[_0x8bf4('0x3e')]({},_0x2662cc,_0x293125[_0x8bf4('0x40')]);var _0x29c370={'where':_0x2662cc['where']};return db[_0x8bf4('0x2b')][_0x8bf4('0x1d')](_0x29c370)[_0x8bf4('0x25')](function(_0x198931){_0x4908ef[_0x8bf4('0x1d')]=_0x198931;if(_0x293125[_0x8bf4('0x2f')][_0x8bf4('0x41')]){_0x2662cc['include']=[{'all':!![]}];}return db[_0x8bf4('0x2b')][_0x8bf4('0x42')](_0x2662cc);})['then'](function(_0x240ebd){_0x4908ef[_0x8bf4('0x43')]=_0x240ebd;return _0x4908ef;})['then'](respondWithFilteredResult(_0x208122,_0x2662cc))[_0x8bf4('0x44')](handleError(_0x208122,null));};exports[_0x8bf4('0x45')]=function(_0x3eaa63,_0x4b15d0){var _0x4a35a3={'raw':!![],'where':{'id':_0x3eaa63[_0x8bf4('0x46')]['id']}},_0x4bc332={};_0x4bc332['model']=_[_0x8bf4('0x30')](db[_0x8bf4('0x2b')][_0x8bf4('0x2c')]);_0x4bc332[_0x8bf4('0x2f')]=_[_0x8bf4('0x30')](_0x3eaa63[_0x8bf4('0x2f')]);_0x4bc332[_0x8bf4('0x31')]=_[_0x8bf4('0x32')](_0x4bc332[_0x8bf4('0x33')],_0x4bc332['query']);_0x4a35a3['attributes']=_[_0x8bf4('0x32')](_0x4bc332[_0x8bf4('0x33')],qs[_0x8bf4('0x35')](_0x3eaa63[_0x8bf4('0x2f')][_0x8bf4('0x35')]));_0x4a35a3['attributes']=_0x4a35a3[_0x8bf4('0x34')][_0x8bf4('0x36')]?_0x4a35a3[_0x8bf4('0x34')]:_0x4bc332['model'];if(_0x3eaa63['query'][_0x8bf4('0x41')]){_0x4a35a3[_0x8bf4('0x47')]=[{'all':!![]}];}_0x4a35a3=_['merge']({},_0x4a35a3,_0x3eaa63[_0x8bf4('0x40')]);return db['VtigerField'][_0x8bf4('0x48')](_0x4a35a3)[_0x8bf4('0x25')](handleEntityNotFound(_0x4b15d0,null))['then'](respondWithResult(_0x4b15d0,null))[_0x8bf4('0x44')](handleError(_0x4b15d0,null));};exports[_0x8bf4('0x49')]=function(_0x119493,_0x56ddd5){return db[_0x8bf4('0x2b')][_0x8bf4('0x49')](_0x119493[_0x8bf4('0x4a')],{})[_0x8bf4('0x25')](respondWithResult(_0x56ddd5,0xc9))[_0x8bf4('0x44')](handleError(_0x56ddd5,null));};exports[_0x8bf4('0x24')]=function(_0x13b78d,_0x22725d){if(_0x13b78d['body']['id']){delete _0x13b78d['body']['id'];}return db[_0x8bf4('0x2b')]['find']({'where':{'id':_0x13b78d[_0x8bf4('0x46')]['id']}})[_0x8bf4('0x25')](handleEntityNotFound(_0x22725d,null))[_0x8bf4('0x25')](saveUpdates(_0x13b78d[_0x8bf4('0x4a')],null))[_0x8bf4('0x25')](respondWithResult(_0x22725d,null))[_0x8bf4('0x44')](handleError(_0x22725d,null));};exports[_0x8bf4('0x26')]=function(_0x4f00a2,_0x56f1ab){return db[_0x8bf4('0x2b')][_0x8bf4('0x48')]({'where':{'id':_0x4f00a2[_0x8bf4('0x46')]['id']}})[_0x8bf4('0x25')](handleEntityNotFound(_0x56f1ab,null))[_0x8bf4('0x25')](removeEntity(_0x56f1ab,null))[_0x8bf4('0x44')](handleError(_0x56f1ab,null));}; \ No newline at end of file +var _0xd517=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','VtigerField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','catch','includeAll','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd517,0x1dd));var _0x7d51=function(_0x233cb1,_0x8ca9a2){_0x233cb1=_0x233cb1-0x0;var _0x29ee7e=_0xd517[_0x233cb1];return _0x29ee7e;};'use strict';var emlformat=require(_0x7d51('0x0'));var rimraf=require(_0x7d51('0x1'));var zipdir=require(_0x7d51('0x2'));var jsonpatch=require(_0x7d51('0x3'));var rp=require(_0x7d51('0x4'));var moment=require('moment');var BPromise=require(_0x7d51('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7d51('0x6'));var sox=require(_0x7d51('0x7'));var csv=require(_0x7d51('0x8'));var ejs=require(_0x7d51('0x9'));var fs=require('fs');var fs_extra=require(_0x7d51('0xa'));var _=require(_0x7d51('0xb'));var squel=require(_0x7d51('0xc'));var crypto=require(_0x7d51('0xd'));var jsforce=require(_0x7d51('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7d51('0xf'));var Papa=require(_0x7d51('0x10'));var Redis=require(_0x7d51('0x11'));var authService=require(_0x7d51('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d51('0x13'));var logger=require(_0x7d51('0x14'))(_0x7d51('0x15'));var utils=require('../../config/utils');var config=require(_0x7d51('0x16'));var licenseUtil=require(_0x7d51('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x862d23,_0x4d2446){_0x4d2446=_0x4d2446||0xcc;return function(_0x5df8db){if(_0x5df8db){return _0x862d23[_0x7d51('0x18')](_0x4d2446);}return _0x862d23['status'](_0x4d2446)['end']();};}function respondWithResult(_0xdffda4,_0xe77939){_0xe77939=_0xe77939||0xc8;return function(_0xad66fb){if(_0xad66fb){return _0xdffda4['status'](_0xe77939)['json'](_0xad66fb);}};}function respondWithFilteredResult(_0x305c26,_0x1ea497){return function(_0x31c95c){if(_0x31c95c){var _0x102eb7=typeof _0x1ea497['offset']===_0x7d51('0x19')&&typeof _0x1ea497[_0x7d51('0x1a')]==='undefined';var _0x55968a=_0x31c95c[_0x7d51('0x1b')];var _0x2ef330=_0x102eb7?0x0:_0x1ea497[_0x7d51('0x1c')];var _0x48a5e5=_0x102eb7?_0x31c95c[_0x7d51('0x1b')]:_0x1ea497[_0x7d51('0x1c')]+_0x1ea497[_0x7d51('0x1a')];var _0x48b55b;if(_0x48a5e5>=_0x55968a){_0x48a5e5=_0x55968a;_0x48b55b=0xc8;}else{_0x48b55b=0xce;}_0x305c26[_0x7d51('0x1d')](_0x48b55b);return _0x305c26['set'](_0x7d51('0x1e'),_0x2ef330+'-'+_0x48a5e5+'/'+_0x55968a)['json'](_0x31c95c);}return null;};}function patchUpdates(_0x3401f8){return function(_0x401c96){try{jsonpatch[_0x7d51('0x1f')](_0x401c96,_0x3401f8,!![]);}catch(_0x207f3c){return BPromise[_0x7d51('0x20')](_0x207f3c);}return _0x401c96[_0x7d51('0x21')]();};}function saveUpdates(_0x2ebce3,_0x17463e){return function(_0x1d9daf){if(_0x1d9daf){return _0x1d9daf[_0x7d51('0x22')](_0x2ebce3)[_0x7d51('0x23')](function(_0x1f940a){return _0x1f940a;});}return null;};}function removeEntity(_0x44f118,_0x1e1f8c){return function(_0x24bf87){if(_0x24bf87){return _0x24bf87[_0x7d51('0x24')]()[_0x7d51('0x23')](function(){_0x44f118['status'](0xcc)[_0x7d51('0x25')]();});}};}function handleEntityNotFound(_0x9dc472,_0x4d197a){return function(_0x20d785){if(!_0x20d785){_0x9dc472[_0x7d51('0x18')](0x194);}return _0x20d785;};}function handleError(_0xd262e6,_0x12ee8a){_0x12ee8a=_0x12ee8a||0x1f4;return function(_0xf98473){logger[_0x7d51('0x26')](_0xf98473[_0x7d51('0x27')]);if(_0xf98473[_0x7d51('0x28')]){delete _0xf98473[_0x7d51('0x28')];}_0xd262e6[_0x7d51('0x1d')](_0x12ee8a)['send'](_0xf98473);};}exports['index']=function(_0x5029eb,_0x2b5b48){var _0x3e4b64={},_0x34bb5b={},_0x5ae6c6={'count':0x0,'rows':[]};var _0x17e735=_['map'](db[_0x7d51('0x29')][_0x7d51('0x2a')],function(_0x3d8969){return{'name':_0x3d8969[_0x7d51('0x2b')],'type':_0x3d8969[_0x7d51('0x2c')][_0x7d51('0x2d')]};});_0x34bb5b[_0x7d51('0x2e')]=_[_0x7d51('0x2f')](_0x17e735,_0x7d51('0x28'));_0x34bb5b[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x5029eb[_0x7d51('0x30')]);_0x34bb5b[_0x7d51('0x32')]=_[_0x7d51('0x33')](_0x34bb5b[_0x7d51('0x2e')],_0x34bb5b['query']);_0x3e4b64['attributes']=_[_0x7d51('0x33')](_0x34bb5b['model'],qs[_0x7d51('0x34')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x34')]));_0x3e4b64['attributes']=_0x3e4b64[_0x7d51('0x35')][_0x7d51('0x36')]?_0x3e4b64[_0x7d51('0x35')]:_0x34bb5b[_0x7d51('0x2e')];if(!_0x5029eb[_0x7d51('0x30')][_0x7d51('0x37')]('nolimit')){_0x3e4b64[_0x7d51('0x1a')]=qs[_0x7d51('0x1a')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x1a')]);_0x3e4b64['offset']=qs[_0x7d51('0x1c')](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x1c')]);}_0x3e4b64[_0x7d51('0x38')]=qs['sort'](_0x5029eb[_0x7d51('0x30')][_0x7d51('0x39')]);_0x3e4b64['where']=qs['filters'](_[_0x7d51('0x3a')](_0x5029eb[_0x7d51('0x30')],_0x34bb5b[_0x7d51('0x32')]),_0x17e735);if(_0x5029eb[_0x7d51('0x30')][_0x7d51('0x3b')]){_0x3e4b64['where']=_[_0x7d51('0x3c')](_0x3e4b64[_0x7d51('0x3d')],{'$or':_['map'](_0x17e735,function(_0x1e3734){if(_0x1e3734[_0x7d51('0x2c')]!==_0x7d51('0x3e')){var _0x323adb={};_0x323adb[_0x1e3734[_0x7d51('0x28')]]={'$like':'%'+_0x5029eb[_0x7d51('0x30')][_0x7d51('0x3b')]+'%'};return _0x323adb;}})});}_0x3e4b64=_['merge']({},_0x3e4b64,_0x5029eb[_0x7d51('0x3f')]);var _0x27b37b={'where':_0x3e4b64['where']};return db[_0x7d51('0x29')][_0x7d51('0x1b')](_0x27b37b)['then'](function(_0x2ba385){_0x5ae6c6['count']=_0x2ba385;if(_0x5029eb[_0x7d51('0x30')]['includeAll']){_0x3e4b64['include']=[{'all':!![]}];}return db[_0x7d51('0x29')]['findAll'](_0x3e4b64);})[_0x7d51('0x23')](function(_0x3ba4a3){_0x5ae6c6['rows']=_0x3ba4a3;return _0x5ae6c6;})[_0x7d51('0x23')](respondWithFilteredResult(_0x2b5b48,_0x3e4b64))[_0x7d51('0x40')](handleError(_0x2b5b48,null));};exports['show']=function(_0x4819cc,_0x9b98d0){var _0x470859={'raw':!![],'where':{'id':_0x4819cc['params']['id']}},_0x54b829={};_0x54b829[_0x7d51('0x2e')]=_[_0x7d51('0x31')](db[_0x7d51('0x29')]['rawAttributes']);_0x54b829[_0x7d51('0x30')]=_[_0x7d51('0x31')](_0x4819cc[_0x7d51('0x30')]);_0x54b829['filters']=_[_0x7d51('0x33')](_0x54b829[_0x7d51('0x2e')],_0x54b829[_0x7d51('0x30')]);_0x470859['attributes']=_[_0x7d51('0x33')](_0x54b829[_0x7d51('0x2e')],qs[_0x7d51('0x34')](_0x4819cc[_0x7d51('0x30')][_0x7d51('0x34')]));_0x470859[_0x7d51('0x35')]=_0x470859[_0x7d51('0x35')][_0x7d51('0x36')]?_0x470859[_0x7d51('0x35')]:_0x54b829[_0x7d51('0x2e')];if(_0x4819cc[_0x7d51('0x30')][_0x7d51('0x41')]){_0x470859[_0x7d51('0x42')]=[{'all':!![]}];}_0x470859=_[_0x7d51('0x3c')]({},_0x470859,_0x4819cc[_0x7d51('0x3f')]);return db[_0x7d51('0x29')][_0x7d51('0x43')](_0x470859)[_0x7d51('0x23')](handleEntityNotFound(_0x9b98d0,null))[_0x7d51('0x23')](respondWithResult(_0x9b98d0,null))[_0x7d51('0x40')](handleError(_0x9b98d0,null));};exports[_0x7d51('0x44')]=function(_0x46ccb5,_0x52969d){return db[_0x7d51('0x29')][_0x7d51('0x44')](_0x46ccb5[_0x7d51('0x45')],{})[_0x7d51('0x23')](respondWithResult(_0x52969d,0xc9))[_0x7d51('0x40')](handleError(_0x52969d,null));};exports[_0x7d51('0x22')]=function(_0x595619,_0x302d4e){if(_0x595619['body']['id']){delete _0x595619['body']['id'];}return db[_0x7d51('0x29')][_0x7d51('0x43')]({'where':{'id':_0x595619[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x302d4e,null))[_0x7d51('0x23')](saveUpdates(_0x595619[_0x7d51('0x45')],null))[_0x7d51('0x23')](respondWithResult(_0x302d4e,null))[_0x7d51('0x40')](handleError(_0x302d4e,null));};exports[_0x7d51('0x24')]=function(_0x5b7ad3,_0x31d9d4){return db[_0x7d51('0x29')][_0x7d51('0x43')]({'where':{'id':_0x5b7ad3[_0x7d51('0x46')]['id']}})[_0x7d51('0x23')](handleEntityNotFound(_0x31d9d4,null))[_0x7d51('0x23')](removeEntity(_0x31d9d4,null))['catch'](handleError(_0x31d9d4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 2a5bed0..23c152c 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 _0x54ee=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','define'];(function(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0x54ee,0x1d5));var _0xe54e=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x54ee[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0xe54e('0x0'));var util=require(_0xe54e('0x1'));var logger=require(_0xe54e('0x2'))(_0xe54e('0x3'));var moment=require(_0xe54e('0x4'));var BPromise=require('bluebird');var rp=require(_0xe54e('0x5'));var fs=require('fs');var path=require(_0xe54e('0x6'));var rimraf=require(_0xe54e('0x7'));var config=require(_0xe54e('0x8'));var attributes=require(_0xe54e('0x9'));module['exports']=function(_0x17207c,_0x343e87){return _0x17207c[_0xe54e('0xa')]('VtigerField',attributes,{'tableName':_0xe54e('0xb'),'paranoid':![],'indexes':[{'name':_0xe54e('0xc'),'fields':[_0xe54e('0xd'),_0xe54e('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbd6b=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xbd6b,0x76));var _0xbbd6=function(_0x100bc0,_0x184f9a){_0x100bc0=_0x100bc0-0x0;var _0x57bff0=_0xbd6b[_0x100bc0];return _0x57bff0;};'use strict';var _=require(_0xbbd6('0x0'));var util=require(_0xbbd6('0x1'));var logger=require(_0xbbd6('0x2'))(_0xbbd6('0x3'));var moment=require(_0xbbd6('0x4'));var BPromise=require(_0xbbd6('0x5'));var rp=require(_0xbbd6('0x6'));var fs=require('fs');var path=require(_0xbbd6('0x7'));var rimraf=require(_0xbbd6('0x8'));var config=require(_0xbbd6('0x9'));var attributes=require(_0xbbd6('0xa'));module[_0xbbd6('0xb')]=function(_0xc97b4b,_0xcc66d){return _0xc97b4b[_0xbbd6('0xc')](_0xbbd6('0xd'),attributes,{'tableName':_0xbbd6('0xe'),'paranoid':![],'indexes':[{'name':_0xbbd6('0xf'),'fields':[_0xbbd6('0x10'),_0xbbd6('0x11')],'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 f1af6ac..ed2c7c3 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 _0x0d5d=['debug','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x5eea86,_0x351c31){var _0x2a4945=function(_0x5caa94){while(--_0x5caa94){_0x5eea86['push'](_0x5eea86['shift']());}};_0x2a4945(++_0x351c31);}(_0x0d5d,0x125));var _0xd0d5=function(_0x57ec23,_0x310749){_0x57ec23=_0x57ec23-0x0;var _0x4a70eb=_0x0d5d[_0x57ec23];return _0x4a70eb;};'use strict';var _=require('lodash');var util=require(_0xd0d5('0x0'));var moment=require('moment');var BPromise=require(_0xd0d5('0x1'));var rs=require(_0xd0d5('0x2'));var fs=require('fs');var Redis=require(_0xd0d5('0x3'));var db=require(_0xd0d5('0x4'))['db'];var utils=require(_0xd0d5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd0d5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd0d5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20c40d,_0xfac49a,_0x5daed0){return new BPromise(function(_0x4dbdb1,_0x1fba24){return client[_0xd0d5('0x8')](_0x20c40d,_0x5daed0)[_0xd0d5('0x9')](function(_0x354674){logger[_0xd0d5('0xa')](_0xd0d5('0xb'),_0xfac49a,_0xd0d5('0xc'));logger[_0xd0d5('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0xfac49a,_0xd0d5('0xc'),JSON[_0xd0d5('0xe')](_0x354674));if(_0x354674[_0xd0d5('0xf')]){if(_0x354674[_0xd0d5('0xf')]['code']===0x1f4){logger[_0xd0d5('0xf')](_0xd0d5('0xb'),_0xfac49a,_0x354674[_0xd0d5('0xf')][_0xd0d5('0x10')]);return _0x1fba24(_0x354674[_0xd0d5('0xf')][_0xd0d5('0x10')]);}logger['error'](_0xd0d5('0xb'),_0xfac49a,_0x354674['error'][_0xd0d5('0x10')]);return _0x4dbdb1(_0x354674[_0xd0d5('0xf')][_0xd0d5('0x10')]);}else{logger['info']('VtigerField,\x20%s,\x20%s',_0xfac49a,_0xd0d5('0xc'));_0x4dbdb1(_0x354674[_0xd0d5('0x11')]['message']);}})['catch'](function(_0x16742d){logger[_0xd0d5('0xf')](_0xd0d5('0xb'),_0xfac49a,_0x16742d);_0x1fba24(_0x16742d);});});} \ No newline at end of file +var _0x1154=['stringify','error','code','message','result','catch','lodash','bluebird','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x150332,_0x2b1bb7){var _0x49b39a=function(_0x5855be){while(--_0x5855be){_0x150332['push'](_0x150332['shift']());}};_0x49b39a(++_0x2b1bb7);}(_0x1154,0xcc));var _0x4115=function(_0x352bf1,_0x31e95b){_0x352bf1=_0x352bf1-0x0;var _0xe51459=_0x1154[_0x352bf1];return _0xe51459;};'use strict';var _=require(_0x4115('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4115('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4115('0x2'))(_0x4115('0x3'));var config=require(_0x4115('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4115('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x201cb1,_0x3138fe,_0x1fc5fe){return new BPromise(function(_0x5c6c72,_0x3ed74c){return client[_0x4115('0x6')](_0x201cb1,_0x1fc5fe)[_0x4115('0x7')](function(_0x3a8a4c){logger[_0x4115('0x8')](_0x4115('0x9'),_0x3138fe,_0x4115('0xa'));logger[_0x4115('0xb')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x3138fe,'request\x20sent',JSON[_0x4115('0xc')](_0x3a8a4c));if(_0x3a8a4c[_0x4115('0xd')]){if(_0x3a8a4c[_0x4115('0xd')][_0x4115('0xe')]===0x1f4){logger[_0x4115('0xd')](_0x4115('0x9'),_0x3138fe,_0x3a8a4c[_0x4115('0xd')][_0x4115('0xf')]);return _0x3ed74c(_0x3a8a4c['error']['message']);}logger[_0x4115('0xd')](_0x4115('0x9'),_0x3138fe,_0x3a8a4c['error'][_0x4115('0xf')]);return _0x5c6c72(_0x3a8a4c[_0x4115('0xd')][_0x4115('0xf')]);}else{logger['info'](_0x4115('0x9'),_0x3138fe,_0x4115('0xa'));_0x5c6c72(_0x3a8a4c[_0x4115('0x10')][_0x4115('0xf')]);}})[_0x4115('0x11')](function(_0x9b5636){logger[_0x4115('0xd')]('VtigerField,\x20%s,\x20%s',_0x3138fe,_0x9b5636);_0x3ed74c(_0x9b5636);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 7a0d136..2ea6dd8 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 _0x261a=['/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','index','isAuthenticated','show'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x261a,0x1e6));var _0xa261=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x261a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xa261('0x0'));var util=require(_0xa261('0x1'));var path=require('path');var timeout=require(_0xa261('0x2'));var express=require(_0xa261('0x3'));var router=express[_0xa261('0x4')]();var fs_extra=require(_0xa261('0x5'));var auth=require(_0xa261('0x6'));var interaction=require(_0xa261('0x7'));var config=require(_0xa261('0x8'));var controller=require(_0xa261('0x9'));router[_0xa261('0xa')]('/',auth['isAuthenticated'](),controller[_0xa261('0xb')]);router[_0xa261('0xa')]('/:id',auth[_0xa261('0xc')](),controller[_0xa261('0xd')]);router[_0xa261('0xa')](_0xa261('0xe'),auth[_0xa261('0xc')](),controller[_0xa261('0xf')]);router[_0xa261('0xa')]('/:id/fields',auth[_0xa261('0xc')](),controller[_0xa261('0x10')]);router[_0xa261('0x11')]('/',auth[_0xa261('0xc')](),controller[_0xa261('0x12')]);router[_0xa261('0x11')](_0xa261('0xe'),auth[_0xa261('0xc')](),controller[_0xa261('0x13')]);router[_0xa261('0x14')](_0xa261('0x15'),auth[_0xa261('0xc')](),controller[_0xa261('0x16')]);router[_0xa261('0x17')](_0xa261('0x15'),auth[_0xa261('0xc')](),controller['destroy']);module[_0xa261('0x18')]=router; \ No newline at end of file +var _0x2678=['get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller'];(function(_0x1a0972,_0x405c36){var _0x4cee4f=function(_0x59cdb4){while(--_0x59cdb4){_0x1a0972['push'](_0x1a0972['shift']());}};_0x4cee4f(++_0x405c36);}(_0x2678,0x13b));var _0x8267=function(_0x23e9e3,_0xc00b){_0x23e9e3=_0x23e9e3-0x0;var _0x33b5b9=_0x2678[_0x23e9e3];return _0x33b5b9;};'use strict';var multer=require(_0x8267('0x0'));var util=require(_0x8267('0x1'));var path=require(_0x8267('0x2'));var timeout=require(_0x8267('0x3'));var express=require(_0x8267('0x4'));var router=express[_0x8267('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8267('0x6'));var interaction=require(_0x8267('0x7'));var config=require(_0x8267('0x8'));var controller=require(_0x8267('0x9'));router[_0x8267('0xa')]('/',auth[_0x8267('0xb')](),controller[_0x8267('0xc')]);router[_0x8267('0xa')](_0x8267('0xd'),auth[_0x8267('0xb')](),controller[_0x8267('0xe')]);router[_0x8267('0xa')](_0x8267('0xf'),auth[_0x8267('0xb')](),controller['getConfigurations']);router[_0x8267('0xa')]('/:id/fields',auth[_0x8267('0xb')](),controller[_0x8267('0x10')]);router[_0x8267('0x11')]('/',auth[_0x8267('0xb')](),controller[_0x8267('0x12')]);router[_0x8267('0x11')]('/:id/configurations',auth[_0x8267('0xb')](),controller[_0x8267('0x13')]);router[_0x8267('0x14')](_0x8267('0xd'),auth['isAuthenticated'](),controller[_0x8267('0x15')]);router[_0x8267('0x16')](_0x8267('0xd'),auth[_0x8267('0xb')](),controller[_0x8267('0x17')]);module[_0x8267('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 83ec99a..62b349d 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 _0xd101=['token','ENUM','integrationTab','newTab','sequelize','STRING','username','remoteUri','password'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd101,0xc1));var _0x1d10=function(_0x39d768,_0x50079e){_0x39d768=_0x39d768-0x0;var _0x4783f5=_0xd101[_0x39d768];return _0x4783f5;};'use strict';var Sequelize=require(_0x1d10('0x0'));module['exports']={'name':{'type':Sequelize[_0x1d10('0x1')]},'description':{'type':Sequelize[_0x1d10('0x1')]},'username':{'type':Sequelize[_0x1d10('0x1')],'unique':_0x1d10('0x2')},'password':{'type':Sequelize[_0x1d10('0x1')]},'token':{'type':Sequelize[_0x1d10('0x1')]},'remoteUri':{'type':Sequelize[_0x1d10('0x1')],'unique':_0x1d10('0x3')},'authType':{'type':Sequelize['ENUM'](_0x1d10('0x4'),_0x1d10('0x5')),'defaultValue':_0x1d10('0x4')},'serverUrl':{'type':Sequelize[_0x1d10('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1d10('0x6')](_0x1d10('0x7'),_0x1d10('0x8')),'defaultValue':_0x1d10('0x7')}}; \ No newline at end of file +var _0x44c2=['sequelize','exports','STRING','username','remoteUri','ENUM','password','integrationTab'];(function(_0x28219b,_0x1362df){var _0x3f2cd1=function(_0x1511ae){while(--_0x1511ae){_0x28219b['push'](_0x28219b['shift']());}};_0x3f2cd1(++_0x1362df);}(_0x44c2,0x100));var _0x244c=function(_0xb7b878,_0x5c3b92){_0xb7b878=_0xb7b878-0x0;var _0x3c84b9=_0x44c2[_0xb7b878];return _0x3c84b9;};'use strict';var Sequelize=require(_0x244c('0x0'));module[_0x244c('0x1')]={'name':{'type':Sequelize[_0x244c('0x2')]},'description':{'type':Sequelize[_0x244c('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x244c('0x3')},'password':{'type':Sequelize[_0x244c('0x2')]},'token':{'type':Sequelize[_0x244c('0x2')]},'remoteUri':{'type':Sequelize[_0x244c('0x2')],'unique':_0x244c('0x4')},'authType':{'type':Sequelize[_0x244c('0x5')]('password','token'),'defaultValue':_0x244c('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x244c('0x5')]('integrationTab','newTab'),'defaultValue':_0x244c('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index d907941..d146cb5 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.controller.js +++ b/server/api/intZendeskAccount/intZendeskAccount.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfcc=['position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','ZendeskAccount','count','include','findAll','rows','then','catch','show','params','includeAll','find','create','body','findOne','ZendeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','Basic\x20%s','format','%s:%s','password','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xbfcc[_0x1602ef];return _0x5870ee;};'use strict';var emlformat=require(_0xcbfc('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcbfc('0x1'));var rp=require(_0xcbfc('0x2'));var moment=require(_0xcbfc('0x3'));var BPromise=require(_0xcbfc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcbfc('0x5'));var ejs=require(_0xcbfc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcbfc('0x7'));var squel=require('squel');var crypto=require(_0xcbfc('0x8'));var jsforce=require(_0xcbfc('0x9'));var deskjs=require(_0xcbfc('0xa'));var toCsv=require(_0xcbfc('0x5'));var querystring=require('querystring');var Papa=require(_0xcbfc('0xb'));var Redis=require(_0xcbfc('0xc'));var authService=require(_0xcbfc('0xd'));var qs=require(_0xcbfc('0xe'));var as=require(_0xcbfc('0xf'));var hardwareService=require(_0xcbfc('0x10'));var logger=require('../../config/logger')(_0xcbfc('0x11'));var utils=require(_0xcbfc('0x12'));var config=require(_0xcbfc('0x13'));var licenseUtil=require(_0xcbfc('0x14'));var db=require(_0xcbfc('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3bfd05,_0x86f67c){_0x86f67c=_0x86f67c||0xcc;return function(_0x80d08d){if(_0x80d08d){return _0x3bfd05['sendStatus'](_0x86f67c);}return _0x3bfd05[_0xcbfc('0x16')](_0x86f67c)[_0xcbfc('0x17')]();};}function respondWithResult(_0x2f2bdd,_0x45a5cc){_0x45a5cc=_0x45a5cc||0xc8;return function(_0x16b659){if(_0x16b659){return _0x2f2bdd['status'](_0x45a5cc)[_0xcbfc('0x18')](_0x16b659);}};}function respondWithFilteredResult(_0x1963de,_0x1ec8c4){return function(_0x4317e4){if(_0x4317e4){var _0x50c6b6=typeof _0x1ec8c4['offset']===_0xcbfc('0x19')&&typeof _0x1ec8c4[_0xcbfc('0x1a')]===_0xcbfc('0x19');var _0x4d6946=_0x4317e4['count'];var _0x33f731=_0x50c6b6?0x0:_0x1ec8c4[_0xcbfc('0x1b')];var _0x344510=_0x50c6b6?_0x4317e4['count']:_0x1ec8c4[_0xcbfc('0x1b')]+_0x1ec8c4['limit'];var _0x28f7fb;if(_0x344510>=_0x4d6946){_0x344510=_0x4d6946;_0x28f7fb=0xc8;}else{_0x28f7fb=0xce;}_0x1963de[_0xcbfc('0x16')](_0x28f7fb);return _0x1963de[_0xcbfc('0x1c')](_0xcbfc('0x1d'),_0x33f731+'-'+_0x344510+'/'+_0x4d6946)[_0xcbfc('0x18')](_0x4317e4);}return null;};}function patchUpdates(_0x2653b1){return function(_0x5f09b0){try{jsonpatch[_0xcbfc('0x1e')](_0x5f09b0,_0x2653b1,!![]);}catch(_0x37ec3e){return BPromise['reject'](_0x37ec3e);}return _0x5f09b0[_0xcbfc('0x1f')]();};}function saveUpdates(_0x5a449b,_0x4cc8b3){return function(_0x4e2427){if(_0x4e2427){return _0x4e2427[_0xcbfc('0x20')](_0x5a449b)['then'](function(_0x4a1915){return _0x4a1915;});}return null;};}function removeEntity(_0x1b3e42,_0x34cffa){return function(_0x3ceeff){if(_0x3ceeff){return _0x3ceeff[_0xcbfc('0x21')]()['then'](function(){_0x1b3e42[_0xcbfc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x280b78,_0x75bca0){return function(_0x53951a){if(!_0x53951a){_0x280b78[_0xcbfc('0x22')](0x194);}return _0x53951a;};}function handleError(_0x3b73a3,_0x4ab48e){_0x4ab48e=_0x4ab48e||0x1f4;return function(_0x1b2c01){logger[_0xcbfc('0x23')](_0x1b2c01[_0xcbfc('0x24')]);if(_0x1b2c01[_0xcbfc('0x25')]){delete _0x1b2c01['name'];}_0x3b73a3[_0xcbfc('0x16')](_0x4ab48e)[_0xcbfc('0x26')](_0x1b2c01);};}exports['index']=function(_0x1f6a14,_0x26463f){var _0x7cbdfa={},_0x388d41={},_0x2b4286={'count':0x0,'rows':[]};var _0x19d2e=_[_0xcbfc('0x27')](db['ZendeskAccount'][_0xcbfc('0x28')],function(_0x433300){return{'name':_0x433300[_0xcbfc('0x29')],'type':_0x433300[_0xcbfc('0x2a')]['key']};});_0x388d41[_0xcbfc('0x2b')]=_[_0xcbfc('0x27')](_0x19d2e,_0xcbfc('0x25'));_0x388d41[_0xcbfc('0x2c')]=_[_0xcbfc('0x2d')](_0x1f6a14[_0xcbfc('0x2c')]);_0x388d41[_0xcbfc('0x2e')]=_['intersection'](_0x388d41[_0xcbfc('0x2b')],_0x388d41[_0xcbfc('0x2c')]);_0x7cbdfa['attributes']=_[_0xcbfc('0x2f')](_0x388d41[_0xcbfc('0x2b')],qs[_0xcbfc('0x30')](_0x1f6a14['query']['fields']));_0x7cbdfa['attributes']=_0x7cbdfa[_0xcbfc('0x31')][_0xcbfc('0x32')]?_0x7cbdfa[_0xcbfc('0x31')]:_0x388d41[_0xcbfc('0x2b')];if(!_0x1f6a14[_0xcbfc('0x2c')][_0xcbfc('0x33')](_0xcbfc('0x34'))){_0x7cbdfa[_0xcbfc('0x1a')]=qs['limit'](_0x1f6a14[_0xcbfc('0x2c')][_0xcbfc('0x1a')]);_0x7cbdfa['offset']=qs[_0xcbfc('0x1b')](_0x1f6a14['query'][_0xcbfc('0x1b')]);}_0x7cbdfa[_0xcbfc('0x35')]=qs[_0xcbfc('0x36')](_0x1f6a14['query'][_0xcbfc('0x36')]);_0x7cbdfa['where']=qs['filters'](_[_0xcbfc('0x37')](_0x1f6a14[_0xcbfc('0x2c')],_0x388d41[_0xcbfc('0x2e')]),_0x19d2e);if(_0x1f6a14[_0xcbfc('0x2c')][_0xcbfc('0x38')]){_0x7cbdfa[_0xcbfc('0x39')]=_[_0xcbfc('0x3a')](_0x7cbdfa[_0xcbfc('0x39')],{'$or':_['map'](_0x19d2e,function(_0x15fb08){if(_0x15fb08['type']!==_0xcbfc('0x3b')){var _0x44064d={};_0x44064d[_0x15fb08[_0xcbfc('0x25')]]={'$like':'%'+_0x1f6a14[_0xcbfc('0x2c')]['filter']+'%'};return _0x44064d;}})});}_0x7cbdfa=_['merge']({},_0x7cbdfa,_0x1f6a14[_0xcbfc('0x3c')]);var _0x1c678b={'where':_0x7cbdfa[_0xcbfc('0x39')]};return db[_0xcbfc('0x3d')][_0xcbfc('0x3e')](_0x1c678b)['then'](function(_0x1901b4){_0x2b4286[_0xcbfc('0x3e')]=_0x1901b4;if(_0x1f6a14[_0xcbfc('0x2c')]['includeAll']){_0x7cbdfa[_0xcbfc('0x3f')]=[{'all':!![]}];}return db[_0xcbfc('0x3d')][_0xcbfc('0x40')](_0x7cbdfa);})['then'](function(_0x28266c){_0x2b4286[_0xcbfc('0x41')]=_0x28266c;return _0x2b4286;})[_0xcbfc('0x42')](respondWithFilteredResult(_0x26463f,_0x7cbdfa))[_0xcbfc('0x43')](handleError(_0x26463f,null));};exports[_0xcbfc('0x44')]=function(_0x28447a,_0x1e14bb){var _0x561544={'raw':![],'where':{'id':_0x28447a[_0xcbfc('0x45')]['id']}},_0x2de7fe={};_0x2de7fe['model']=_[_0xcbfc('0x2d')](db[_0xcbfc('0x3d')][_0xcbfc('0x28')]);_0x2de7fe[_0xcbfc('0x2c')]=_[_0xcbfc('0x2d')](_0x28447a[_0xcbfc('0x2c')]);_0x2de7fe[_0xcbfc('0x2e')]=_[_0xcbfc('0x2f')](_0x2de7fe['model'],_0x2de7fe[_0xcbfc('0x2c')]);_0x561544[_0xcbfc('0x31')]=_[_0xcbfc('0x2f')](_0x2de7fe[_0xcbfc('0x2b')],qs[_0xcbfc('0x30')](_0x28447a[_0xcbfc('0x2c')][_0xcbfc('0x30')]));_0x561544['attributes']=_0x561544[_0xcbfc('0x31')][_0xcbfc('0x32')]?_0x561544['attributes']:_0x2de7fe[_0xcbfc('0x2b')];if(_0x28447a[_0xcbfc('0x2c')][_0xcbfc('0x46')]){_0x561544['include']=[{'all':!![]}];}_0x561544=_[_0xcbfc('0x3a')]({},_0x561544,_0x28447a[_0xcbfc('0x3c')]);return db[_0xcbfc('0x3d')][_0xcbfc('0x47')](_0x561544)[_0xcbfc('0x42')](handleEntityNotFound(_0x1e14bb,null))[_0xcbfc('0x42')](respondWithResult(_0x1e14bb,null))[_0xcbfc('0x43')](handleError(_0x1e14bb,null));};exports['create']=function(_0x5a87b6,_0x237f30){return db[_0xcbfc('0x3d')][_0xcbfc('0x48')](_0x5a87b6[_0xcbfc('0x49')],{})['then'](respondWithResult(_0x237f30,0xc9))['catch'](handleError(_0x237f30,null));};exports[_0xcbfc('0x20')]=function(_0xe5c5ef,_0x12340f){if(_0xe5c5ef['body']['id']){delete _0xe5c5ef[_0xcbfc('0x49')]['id'];}return db[_0xcbfc('0x3d')][_0xcbfc('0x47')]({'where':{'id':_0xe5c5ef['params']['id']}})[_0xcbfc('0x42')](handleEntityNotFound(_0x12340f,null))[_0xcbfc('0x42')](saveUpdates(_0xe5c5ef[_0xcbfc('0x49')],null))[_0xcbfc('0x42')](respondWithResult(_0x12340f,null))[_0xcbfc('0x43')](handleError(_0x12340f,null));};exports[_0xcbfc('0x21')]=function(_0x222b58,_0x374998){return db[_0xcbfc('0x3d')][_0xcbfc('0x47')]({'where':{'id':_0x222b58['params']['id']}})[_0xcbfc('0x42')](handleEntityNotFound(_0x374998,null))[_0xcbfc('0x42')](removeEntity(_0x374998,null))[_0xcbfc('0x43')](handleError(_0x374998,null));};exports['getConfigurations']=function(_0x28ae7f,_0x1a89c1,_0x4b7038){var _0x54de8={};var _0x5ce8e3={};var _0x38db76;var _0x25e48d;return db['ZendeskAccount'][_0xcbfc('0x4a')]({'where':{'id':_0x28ae7f[_0xcbfc('0x45')]['id']}})['then'](handleEntityNotFound(_0x1a89c1,null))[_0xcbfc('0x42')](function(_0x34db13){if(_0x34db13){_0x38db76=_0x34db13;_0x5ce8e3[_0xcbfc('0x2b')]=_[_0xcbfc('0x2d')](db[_0xcbfc('0x4b')][_0xcbfc('0x28')]);_0x5ce8e3[_0xcbfc('0x2c')]=_[_0xcbfc('0x2d')](_0x28ae7f[_0xcbfc('0x2c')]);_0x5ce8e3[_0xcbfc('0x2e')]=_['intersection'](_0x5ce8e3[_0xcbfc('0x2b')],_0x5ce8e3['query']);_0x54de8['attributes']=_['intersection'](_0x5ce8e3[_0xcbfc('0x2b')],qs[_0xcbfc('0x30')](_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x30')]));_0x54de8[_0xcbfc('0x31')]=_0x54de8[_0xcbfc('0x31')][_0xcbfc('0x32')]?_0x54de8[_0xcbfc('0x31')]:_0x5ce8e3['model'];_0x54de8[_0xcbfc('0x35')]=qs[_0xcbfc('0x36')](_0x28ae7f[_0xcbfc('0x2c')]['sort']);_0x54de8[_0xcbfc('0x39')]=qs[_0xcbfc('0x2e')](_[_0xcbfc('0x37')](_0x28ae7f[_0xcbfc('0x2c')],_0x5ce8e3[_0xcbfc('0x2e')]));if(_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x38')]){_0x54de8['where']=_[_0xcbfc('0x3a')](_0x54de8['where'],{'$or':_[_0xcbfc('0x27')](_0x54de8[_0xcbfc('0x31')],function(_0x5de047){var _0x2c6b23={};_0x2c6b23[_0x5de047]={'$like':'%'+_0x28ae7f['query'][_0xcbfc('0x38')]+'%'};return _0x2c6b23;})});}_0x54de8=_[_0xcbfc('0x3a')]({},_0x54de8,_0x28ae7f[_0xcbfc('0x3c')]);return _0x38db76[_0xcbfc('0x4c')](_0x54de8);}})[_0xcbfc('0x42')](function(_0x1b2b24){if(_0x1b2b24){_0x25e48d=_0x1b2b24['length'];if(!_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x33')]('nolimit')){_0x54de8[_0xcbfc('0x1a')]=qs[_0xcbfc('0x1a')](_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x1a')]);_0x54de8[_0xcbfc('0x1b')]=qs[_0xcbfc('0x1b')](_0x28ae7f[_0xcbfc('0x2c')][_0xcbfc('0x1b')]);}return _0x38db76['getConfigurations'](_0x54de8);}})[_0xcbfc('0x42')](function(_0x3f01da){if(_0x3f01da){return _0x3f01da?{'count':_0x25e48d,'rows':_0x3f01da}:null;}})[_0xcbfc('0x42')](respondWithResult(_0x1a89c1,null))[_0xcbfc('0x43')](handleError(_0x1a89c1,null));};exports[_0xcbfc('0x4d')]=function(_0x2fb0c2,_0x209d61,_0x380539){if(_0x2fb0c2[_0xcbfc('0x49')]['id']){delete _0x2fb0c2[_0xcbfc('0x49')]['id'];}return db['ZendeskAccount'][_0xcbfc('0x4a')]({'where':{'id':_0x2fb0c2[_0xcbfc('0x45')]['id']}})['then'](handleEntityNotFound(_0x209d61,null))[_0xcbfc('0x42')](function(_0x510a43){if(_0x510a43){_0x2fb0c2['body'][_0xcbfc('0x4e')]=_0x510a43['id'];_0x2fb0c2[_0xcbfc('0x49')][_0xcbfc('0x4f')]=integrations[_0xcbfc('0x50')](_0x2fb0c2[_0xcbfc('0x49')]['channel'],_0x2fb0c2['body'][_0xcbfc('0x2a')]);_0x2fb0c2[_0xcbfc('0x49')][_0xcbfc('0x51')]=integrations[_0xcbfc('0x52')](_0x2fb0c2[_0xcbfc('0x49')]['channel'],_0x2fb0c2[_0xcbfc('0x49')][_0xcbfc('0x2a')]);return db[_0xcbfc('0x4b')]['create'](_0x2fb0c2['body'],{'include':[{'model':db['ZendeskField'],'as':_0xcbfc('0x4f')},{'model':db['ZendeskField'],'as':'Descriptions'}]});}return null;})[_0xcbfc('0x42')](respondWithResult(_0x209d61,null))['catch'](handleError(_0x209d61,null));};exports[_0xcbfc('0x53')]=function(_0x34e671,_0xed28ff,_0x461e5b){var _0x16d91a='';return db[_0xcbfc('0x3d')][_0xcbfc('0x4a')]({'where':{'id':_0x34e671[_0xcbfc('0x45')]['id']},'attributes':['id',_0xcbfc('0x54'),'password',_0xcbfc('0x55'),_0xcbfc('0x56'),_0xcbfc('0x57')]})['then'](handleEntityNotFound(_0xed28ff,null))[_0xcbfc('0x42')](function(_0x1640e9){if(_0x1640e9){_0x16d91a=_0x1640e9[_0xcbfc('0x57')];var _0x318346=_0x16d91a[_0xcbfc('0x58')](-0x1);if(_0x318346==='/'){_0x16d91a=_0x16d91a[_0xcbfc('0x59')](0x0,_0x16d91a[_0xcbfc('0x5a')](_0x318346));}var _0x562380={'method':_0xcbfc('0x5b'),'uri':util['format'](_0xcbfc('0x5c'),_0x16d91a,_0xcbfc('0x5d')),'json':!![]};switch(_0x1640e9[_0xcbfc('0x56')]){case'password':_0x562380[_0xcbfc('0x5e')]={'Authorization':util['format'](_0xcbfc('0x5f'),new Buffer(util[_0xcbfc('0x60')](_0xcbfc('0x61'),_0x1640e9[_0xcbfc('0x54')],_0x1640e9[_0xcbfc('0x62')]))[_0xcbfc('0x63')](_0xcbfc('0x64')))};break;case'token':_0x562380[_0xcbfc('0x5e')]={'Authorization':util[_0xcbfc('0x60')](_0xcbfc('0x5f'),new Buffer(util['format'](_0xcbfc('0x65'),_0x1640e9['username'],_0x1640e9[_0xcbfc('0x55')]))[_0xcbfc('0x63')](_0xcbfc('0x64')))};break;default:throw new db['Sequelize'][(_0xcbfc('0x66'))](_0xcbfc('0x67'));}return rp(_0x562380);}})['then'](function(_0xb3378d){if(_0xb3378d){var _0x58be73=[_0xcbfc('0x68'),'description',_0xcbfc('0x69'),_0xcbfc('0x6a')];_['remove'](_0xb3378d[_0xcbfc('0x5d')],function(_0x4cf2e1){return _0x58be73[_0xcbfc('0x6b')](_0x4cf2e1[_0xcbfc('0x2a')]);});return{'count':_0xb3378d[_0xcbfc('0x5d')][_0xcbfc('0x32')],'rows':_['map'](_0xb3378d[_0xcbfc('0x5d')],function(_0x4c1e0a){return{'id':_0x4c1e0a['id'],'name':_0x4c1e0a[_0xcbfc('0x6c')]>0x7?_0x4c1e0a[_0xcbfc('0x6d')]:_0x4c1e0a[_0xcbfc('0x2a')],'custom':_0x4c1e0a[_0xcbfc('0x6c')]>0x7?!![]:![],'options':_0x4c1e0a[_0xcbfc('0x6e')]?_0x4c1e0a[_0xcbfc('0x6e')]:_0x4c1e0a[_0xcbfc('0x6f')]?_0x4c1e0a[_0xcbfc('0x6f')]:[]};})};}})[_0xcbfc('0x42')](respondWithResult(_0xed28ff,null))[_0xcbfc('0x43')](function(_0x3a3b24){var _0x297513=_0x34e671[_0xcbfc('0x2c')][_0xcbfc('0x70')]?0x1f4:_0x3a3b24[_0xcbfc('0x71')]||0x1f4;logger[_0xcbfc('0x23')](_0xcbfc('0x72'),'getFields',_0x297513,JSON[_0xcbfc('0x73')](_0x3a3b24));delete _0x3a3b24['name'];if(_0x297513===0x191){_0x297513=0x190;}_0xed28ff[_0xcbfc('0x16')](_0x297513)['send'](_0x34e671[_0xcbfc('0x2c')][_0xcbfc('0x70')]?{'message':_0xcbfc('0x74'),'statusCode':_0x3a3b24[_0xcbfc('0x71')]}:_0x3a3b24);});}; \ No newline at end of file +var _0xe5b5=['attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne','ZendeskConfiguration','pick','map','addConfiguration','channel','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','base64','%s/token:%s','toString','Sequelize','Unknown\x20authentication\x20type','group','assignee','remove','position','title','system_field_options','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','model','query','keys','intersection'];(function(_0x515e72,_0x224638){var _0x21d3bf=function(_0x46dfbe){while(--_0x46dfbe){_0x515e72['push'](_0x515e72['shift']());}};_0x21d3bf(++_0x224638);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x5a27e8,_0x492a2f){_0x5a27e8=_0x5a27e8-0x0;var _0x4e38f7=_0xe5b5[_0x5a27e8];return _0x4e38f7;};'use strict';var emlformat=require(_0x5e5b('0x0'));var rimraf=require(_0x5e5b('0x1'));var zipdir=require(_0x5e5b('0x2'));var jsonpatch=require(_0x5e5b('0x3'));var rp=require(_0x5e5b('0x4'));var moment=require(_0x5e5b('0x5'));var BPromise=require(_0x5e5b('0x6'));var Mustache=require(_0x5e5b('0x7'));var util=require(_0x5e5b('0x8'));var path=require(_0x5e5b('0x9'));var sox=require(_0x5e5b('0xa'));var csv=require(_0x5e5b('0xb'));var ejs=require(_0x5e5b('0xc'));var fs=require('fs');var fs_extra=require(_0x5e5b('0xd'));var _=require(_0x5e5b('0xe'));var squel=require(_0x5e5b('0xf'));var crypto=require(_0x5e5b('0x10'));var jsforce=require(_0x5e5b('0x11'));var deskjs=require(_0x5e5b('0x12'));var toCsv=require(_0x5e5b('0xb'));var querystring=require(_0x5e5b('0x13'));var Papa=require(_0x5e5b('0x14'));var Redis=require(_0x5e5b('0x15'));var authService=require('../../components/auth/service');var qs=require(_0x5e5b('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5e5b('0x17'));var logger=require(_0x5e5b('0x18'))(_0x5e5b('0x19'));var utils=require(_0x5e5b('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x5e5b('0x1b'));function respondWithStatusCode(_0x18434e,_0x4559a0){_0x4559a0=_0x4559a0||0xcc;return function(_0x1694ff){if(_0x1694ff){return _0x18434e[_0x5e5b('0x1c')](_0x4559a0);}return _0x18434e[_0x5e5b('0x1d')](_0x4559a0)[_0x5e5b('0x1e')]();};}function respondWithResult(_0x49edd0,_0x2b37fa){_0x2b37fa=_0x2b37fa||0xc8;return function(_0x2e92c3){if(_0x2e92c3){return _0x49edd0['status'](_0x2b37fa)[_0x5e5b('0x1f')](_0x2e92c3);}};}function respondWithFilteredResult(_0x578c14,_0x4e9509){return function(_0x13a1cb){if(_0x13a1cb){var _0x444435=typeof _0x4e9509[_0x5e5b('0x20')]==='undefined'&&typeof _0x4e9509[_0x5e5b('0x21')]==='undefined';var _0x1796af=_0x13a1cb[_0x5e5b('0x22')];var _0x4c5f9a=_0x444435?0x0:_0x4e9509[_0x5e5b('0x20')];var _0x1560e1=_0x444435?_0x13a1cb[_0x5e5b('0x22')]:_0x4e9509['offset']+_0x4e9509[_0x5e5b('0x21')];var _0x3f1103;if(_0x1560e1>=_0x1796af){_0x1560e1=_0x1796af;_0x3f1103=0xc8;}else{_0x3f1103=0xce;}_0x578c14['status'](_0x3f1103);return _0x578c14[_0x5e5b('0x23')](_0x5e5b('0x24'),_0x4c5f9a+'-'+_0x1560e1+'/'+_0x1796af)[_0x5e5b('0x1f')](_0x13a1cb);}return null;};}function patchUpdates(_0x2d8252){return function(_0x2cb0bb){try{jsonpatch[_0x5e5b('0x25')](_0x2cb0bb,_0x2d8252,!![]);}catch(_0x93df5c){return BPromise[_0x5e5b('0x26')](_0x93df5c);}return _0x2cb0bb['save']();};}function saveUpdates(_0x512e46,_0x256a00){return function(_0x3326fb){if(_0x3326fb){return _0x3326fb[_0x5e5b('0x27')](_0x512e46)[_0x5e5b('0x28')](function(_0x2e38ed){return _0x2e38ed;});}return null;};}function removeEntity(_0x28cd95,_0x135c6c){return function(_0x18903e){if(_0x18903e){return _0x18903e[_0x5e5b('0x29')]()[_0x5e5b('0x28')](function(){_0x28cd95[_0x5e5b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebb11,_0x75800d){return function(_0x3527a8){if(!_0x3527a8){_0x1ebb11['sendStatus'](0x194);}return _0x3527a8;};}function handleError(_0x988e5d,_0xdb2863){_0xdb2863=_0xdb2863||0x1f4;return function(_0x5ee866){logger[_0x5e5b('0x2a')](_0x5ee866[_0x5e5b('0x2b')]);if(_0x5ee866[_0x5e5b('0x2c')]){delete _0x5ee866[_0x5e5b('0x2c')];}_0x988e5d[_0x5e5b('0x1d')](_0xdb2863)[_0x5e5b('0x2d')](_0x5ee866);};}exports[_0x5e5b('0x2e')]=function(_0x2b4351,_0x3f6b25){var _0x42da3b={},_0xcb272c={},_0x28157a={'count':0x0,'rows':[]};var _0x4ed688=_['map'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')],function(_0xb68419){return{'name':_0xb68419[_0x5e5b('0x31')],'type':_0xb68419[_0x5e5b('0x32')]['key']};});_0xcb272c[_0x5e5b('0x33')]=_['map'](_0x4ed688,_0x5e5b('0x2c'));_0xcb272c[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x2b4351[_0x5e5b('0x34')]);_0xcb272c['filters']=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],_0xcb272c['query']);_0x42da3b[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0xcb272c[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x42da3b[_0x5e5b('0x37')]=_0x42da3b[_0x5e5b('0x37')]['length']?_0x42da3b[_0x5e5b('0x37')]:_0xcb272c[_0x5e5b('0x33')];if(!_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x42da3b[_0x5e5b('0x21')]=qs['limit'](_0x2b4351['query'][_0x5e5b('0x21')]);_0x42da3b[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x2b4351['query'][_0x5e5b('0x20')]);}_0x42da3b[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x2b4351[_0x5e5b('0x34')]['sort']);_0x42da3b[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_['pick'](_0x2b4351['query'],_0xcb272c[_0x5e5b('0x3e')]),_0x4ed688);if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]){_0x42da3b['where']=_[_0x5e5b('0x40')](_0x42da3b['where'],{'$or':_['map'](_0x4ed688,function(_0x261057){if(_0x261057[_0x5e5b('0x32')]!==_0x5e5b('0x41')){var _0xc666f7={};_0xc666f7[_0x261057[_0x5e5b('0x2c')]]={'$like':'%'+_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x3f')]+'%'};return _0xc666f7;}})});}_0x42da3b=_[_0x5e5b('0x40')]({},_0x42da3b,_0x2b4351[_0x5e5b('0x42')]);var _0x53b88f={'where':_0x42da3b[_0x5e5b('0x3d')]};return db[_0x5e5b('0x2f')]['count'](_0x53b88f)[_0x5e5b('0x28')](function(_0x4b54b0){_0x28157a[_0x5e5b('0x22')]=_0x4b54b0;if(_0x2b4351[_0x5e5b('0x34')][_0x5e5b('0x43')]){_0x42da3b[_0x5e5b('0x44')]=[{'all':!![]}];}return db[_0x5e5b('0x2f')][_0x5e5b('0x45')](_0x42da3b);})[_0x5e5b('0x28')](function(_0x24d81f){_0x28157a[_0x5e5b('0x46')]=_0x24d81f;return _0x28157a;})[_0x5e5b('0x28')](respondWithFilteredResult(_0x3f6b25,_0x42da3b))[_0x5e5b('0x47')](handleError(_0x3f6b25,null));};exports['show']=function(_0x2b81dd,_0x40e8ce){var _0x46fec9={'raw':![],'where':{'id':_0x2b81dd[_0x5e5b('0x48')]['id']}},_0x570413={};_0x570413[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x2f')][_0x5e5b('0x30')]);_0x570413['query']=_[_0x5e5b('0x35')](_0x2b81dd['query']);_0x570413['filters']=_['intersection'](_0x570413[_0x5e5b('0x33')],_0x570413['query']);_0x46fec9[_0x5e5b('0x37')]=_['intersection'](_0x570413[_0x5e5b('0x33')],qs[_0x5e5b('0x38')](_0x2b81dd[_0x5e5b('0x34')][_0x5e5b('0x38')]));_0x46fec9[_0x5e5b('0x37')]=_0x46fec9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x46fec9['attributes']:_0x570413['model'];if(_0x2b81dd[_0x5e5b('0x34')]['includeAll']){_0x46fec9['include']=[{'all':!![]}];}_0x46fec9=_['merge']({},_0x46fec9,_0x2b81dd[_0x5e5b('0x42')]);return db['ZendeskAccount'][_0x5e5b('0x4a')](_0x46fec9)[_0x5e5b('0x28')](handleEntityNotFound(_0x40e8ce,null))[_0x5e5b('0x28')](respondWithResult(_0x40e8ce,null))[_0x5e5b('0x47')](handleError(_0x40e8ce,null));};exports[_0x5e5b('0x4b')]=function(_0x192445,_0x4fd265){return db[_0x5e5b('0x2f')][_0x5e5b('0x4b')](_0x192445['body'],{})[_0x5e5b('0x28')](respondWithResult(_0x4fd265,0xc9))['catch'](handleError(_0x4fd265,null));};exports[_0x5e5b('0x27')]=function(_0x36d8fa,_0x42ebaf){if(_0x36d8fa[_0x5e5b('0x4c')]['id']){delete _0x36d8fa['body']['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4a')]({'where':{'id':_0x36d8fa['params']['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x42ebaf,null))[_0x5e5b('0x28')](saveUpdates(_0x36d8fa[_0x5e5b('0x4c')],null))[_0x5e5b('0x28')](respondWithResult(_0x42ebaf,null))[_0x5e5b('0x47')](handleError(_0x42ebaf,null));};exports[_0x5e5b('0x29')]=function(_0x50fc9c,_0x690f8c){return db[_0x5e5b('0x2f')]['find']({'where':{'id':_0x50fc9c[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x690f8c,null))[_0x5e5b('0x28')](removeEntity(_0x690f8c,null))['catch'](handleError(_0x690f8c,null));};exports[_0x5e5b('0x4d')]=function(_0x3e0ce5,_0x1f32f2,_0x4844ec){var _0x3877e9={};var _0x2e04d6={};var _0x239804;var _0x4a4e0f;return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x3e0ce5['params']['id']}})['then'](handleEntityNotFound(_0x1f32f2,null))[_0x5e5b('0x28')](function(_0x13eee9){if(_0x13eee9){_0x239804=_0x13eee9;_0x2e04d6[_0x5e5b('0x33')]=_['keys'](db[_0x5e5b('0x4f')][_0x5e5b('0x30')]);_0x2e04d6[_0x5e5b('0x34')]=_[_0x5e5b('0x35')](_0x3e0ce5[_0x5e5b('0x34')]);_0x2e04d6[_0x5e5b('0x3e')]=_['intersection'](_0x2e04d6['model'],_0x2e04d6[_0x5e5b('0x34')]);_0x3877e9[_0x5e5b('0x37')]=_[_0x5e5b('0x36')](_0x2e04d6[_0x5e5b('0x33')],qs['fields'](_0x3e0ce5[_0x5e5b('0x34')]['fields']));_0x3877e9[_0x5e5b('0x37')]=_0x3877e9[_0x5e5b('0x37')][_0x5e5b('0x49')]?_0x3877e9[_0x5e5b('0x37')]:_0x2e04d6[_0x5e5b('0x33')];_0x3877e9[_0x5e5b('0x3b')]=qs[_0x5e5b('0x3c')](_0x3e0ce5[_0x5e5b('0x34')]['sort']);_0x3877e9[_0x5e5b('0x3d')]=qs[_0x5e5b('0x3e')](_[_0x5e5b('0x50')](_0x3e0ce5[_0x5e5b('0x34')],_0x2e04d6[_0x5e5b('0x3e')]));if(_0x3e0ce5['query'][_0x5e5b('0x3f')]){_0x3877e9[_0x5e5b('0x3d')]=_[_0x5e5b('0x40')](_0x3877e9[_0x5e5b('0x3d')],{'$or':_[_0x5e5b('0x51')](_0x3877e9['attributes'],function(_0x13fb51){var _0x5d9ff9={};_0x5d9ff9[_0x13fb51]={'$like':'%'+_0x3e0ce5[_0x5e5b('0x34')]['filter']+'%'};return _0x5d9ff9;})});}_0x3877e9=_[_0x5e5b('0x40')]({},_0x3877e9,_0x3e0ce5[_0x5e5b('0x42')]);return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x229a2d){if(_0x229a2d){_0x4a4e0f=_0x229a2d[_0x5e5b('0x49')];if(!_0x3e0ce5['query'][_0x5e5b('0x39')](_0x5e5b('0x3a'))){_0x3877e9[_0x5e5b('0x21')]=qs[_0x5e5b('0x21')](_0x3e0ce5['query']['limit']);_0x3877e9[_0x5e5b('0x20')]=qs[_0x5e5b('0x20')](_0x3e0ce5['query'][_0x5e5b('0x20')]);}return _0x239804[_0x5e5b('0x4d')](_0x3877e9);}})[_0x5e5b('0x28')](function(_0x470042){if(_0x470042){return _0x470042?{'count':_0x4a4e0f,'rows':_0x470042}:null;}})[_0x5e5b('0x28')](respondWithResult(_0x1f32f2,null))['catch'](handleError(_0x1f32f2,null));};exports[_0x5e5b('0x52')]=function(_0x61faf2,_0x494b1d,_0x4795a7){if(_0x61faf2['body']['id']){delete _0x61faf2[_0x5e5b('0x4c')]['id'];}return db[_0x5e5b('0x2f')][_0x5e5b('0x4e')]({'where':{'id':_0x61faf2[_0x5e5b('0x48')]['id']}})[_0x5e5b('0x28')](handleEntityNotFound(_0x494b1d,null))['then'](function(_0x28d834){if(_0x28d834){_0x61faf2[_0x5e5b('0x4c')]['AccountId']=_0x28d834['id'];_0x61faf2[_0x5e5b('0x4c')]['Subjects']=integrations['getSubjects'](_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x54')]=integrations[_0x5e5b('0x55')](_0x61faf2['body'][_0x5e5b('0x53')],_0x61faf2[_0x5e5b('0x4c')][_0x5e5b('0x32')]);return db[_0x5e5b('0x4f')][_0x5e5b('0x4b')](_0x61faf2[_0x5e5b('0x4c')],{'include':[{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x57')},{'model':db[_0x5e5b('0x56')],'as':_0x5e5b('0x54')}]});}return null;})[_0x5e5b('0x28')](respondWithResult(_0x494b1d,null))['catch'](handleError(_0x494b1d,null));};exports[_0x5e5b('0x58')]=function(_0x1a3d7b,_0x3c57ad,_0x271af6){var _0xc7171a='';return db['ZendeskAccount'][_0x5e5b('0x4e')]({'where':{'id':_0x1a3d7b[_0x5e5b('0x48')]['id']},'attributes':['id',_0x5e5b('0x59'),_0x5e5b('0x5a'),_0x5e5b('0x5b'),_0x5e5b('0x5c'),'remoteUri']})[_0x5e5b('0x28')](handleEntityNotFound(_0x3c57ad,null))[_0x5e5b('0x28')](function(_0x359c04){if(_0x359c04){_0xc7171a=_0x359c04['remoteUri'];var _0xc8316a=_0xc7171a[_0x5e5b('0x5d')](-0x1);if(_0xc8316a==='/'){_0xc7171a=_0xc7171a[_0x5e5b('0x5e')](0x0,_0xc7171a[_0x5e5b('0x5f')](_0xc8316a));}var _0x344c25={'method':_0x5e5b('0x60'),'uri':util[_0x5e5b('0x61')](_0x5e5b('0x62'),_0xc7171a,_0x5e5b('0x63')),'json':!![]};switch(_0x359c04['authType']){case _0x5e5b('0x5a'):_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')](_0x5e5b('0x64'),new Buffer(util['format']('%s:%s',_0x359c04[_0x5e5b('0x59')],_0x359c04[_0x5e5b('0x5a')]))['toString'](_0x5e5b('0x65')))};break;case'token':_0x344c25['headers']={'Authorization':util[_0x5e5b('0x61')]('Basic\x20%s',new Buffer(util[_0x5e5b('0x61')](_0x5e5b('0x66'),_0x359c04[_0x5e5b('0x59')],_0x359c04['token']))[_0x5e5b('0x67')](_0x5e5b('0x65')))};break;default:throw new db[(_0x5e5b('0x68'))]['ValidationError'](_0x5e5b('0x69'));}return rp(_0x344c25);}})[_0x5e5b('0x28')](function(_0x58aef4){if(_0x58aef4){var _0x388dbe=['subject','description',_0x5e5b('0x6a'),_0x5e5b('0x6b')];_[_0x5e5b('0x6c')](_0x58aef4[_0x5e5b('0x63')],function(_0x1a7c5c){return _0x388dbe['includes'](_0x1a7c5c[_0x5e5b('0x32')]);});return{'count':_0x58aef4[_0x5e5b('0x63')]['length'],'rows':_['map'](_0x58aef4[_0x5e5b('0x63')],function(_0x467c6b){return{'id':_0x467c6b['id'],'name':_0x467c6b[_0x5e5b('0x6d')]>0x7?_0x467c6b[_0x5e5b('0x6e')]:_0x467c6b[_0x5e5b('0x32')],'custom':_0x467c6b[_0x5e5b('0x6d')]>0x7?!![]:![],'options':_0x467c6b['system_field_options']?_0x467c6b[_0x5e5b('0x6f')]:_0x467c6b[_0x5e5b('0x70')]?_0x467c6b[_0x5e5b('0x70')]:[]};})};}})['then'](respondWithResult(_0x3c57ad,null))['catch'](function(_0x24bcc9){var _0x1eb8cd=_0x1a3d7b[_0x5e5b('0x34')]['test']?0x1f4:_0x24bcc9[_0x5e5b('0x71')]||0x1f4;logger[_0x5e5b('0x2a')](_0x5e5b('0x72'),'getFields',_0x1eb8cd,JSON[_0x5e5b('0x73')](_0x24bcc9));delete _0x24bcc9[_0x5e5b('0x2c')];if(_0x1eb8cd===0x191){_0x1eb8cd=0x190;}_0x3c57ad[_0x5e5b('0x1d')](_0x1eb8cd)['send'](_0x1a3d7b[_0x5e5b('0x34')][_0x5e5b('0x74')]?{'message':_0x5e5b('0x75'),'statusCode':_0x24bcc9[_0x5e5b('0x71')]}:_0x24bcc9);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1194677..dd8cc0c 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 _0x6e78=['exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes'];(function(_0x5e42a7,_0x3eba35){var _0x36d21b=function(_0x567f0a){while(--_0x567f0a){_0x5e42a7['push'](_0x5e42a7['shift']());}};_0x36d21b(++_0x3eba35);}(_0x6e78,0xba));var _0x86e7=function(_0x34a10c,_0x7ce96a){_0x34a10c=_0x34a10c-0x0;var _0x3015ab=_0x6e78[_0x34a10c];return _0x3015ab;};'use strict';var _=require(_0x86e7('0x0'));var util=require(_0x86e7('0x1'));var logger=require(_0x86e7('0x2'))(_0x86e7('0x3'));var moment=require('moment');var BPromise=require(_0x86e7('0x4'));var rp=require(_0x86e7('0x5'));var fs=require('fs');var path=require(_0x86e7('0x6'));var rimraf=require(_0x86e7('0x7'));var config=require('../../config/environment');var attributes=require(_0x86e7('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x86e7('0x9')]=function(_0x393f05,_0x20aed1){return _0x393f05[_0x86e7('0xa')](_0x86e7('0xb'),attributes,{'tableName':_0x86e7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba51=['../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes'];(function(_0x202c61,_0x3673e0){var _0x540691=function(_0x409610){while(--_0x409610){_0x202c61['push'](_0x202c61['shift']());}};_0x540691(++_0x3673e0);}(_0xba51,0x7c));var _0x1ba5=function(_0x61c0bb,_0x48e4bf){_0x61c0bb=_0x61c0bb-0x0;var _0x5d549a=_0xba51[_0x61c0bb];return _0x5d549a;};'use strict';var _=require(_0x1ba5('0x0'));var util=require('util');var logger=require(_0x1ba5('0x1'))(_0x1ba5('0x2'));var moment=require('moment');var BPromise=require(_0x1ba5('0x3'));var rp=require(_0x1ba5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ba5('0x5'));var config=require(_0x1ba5('0x6'));var attributes=require(_0x1ba5('0x7'));var integrations=require(_0x1ba5('0x8'));module[_0x1ba5('0x9')]=function(_0x455f12,_0x221fed){return _0x455f12['define'](_0x1ba5('0xa'),attributes,{'tableName':_0x1ba5('0xb'),'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 4080a1a..3a88e94 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 _0x5b5a=['jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','GetZendeskAccount','findAll','options','where','attributes','limit','include','map','model','stringify','catch','ZendeskAccount','find','ShowZendeskAccount','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b1af5,_0x391176){var _0x595bed=function(_0x2d4d15){while(--_0x2d4d15){_0x3b1af5['push'](_0x3b1af5['shift']());}};_0x595bed(++_0x391176);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x5458a6,_0x1688c5){_0x5458a6=_0x5458a6-0x0;var _0x2669fc=_0x5b5a[_0x5458a6];return _0x2669fc;};'use strict';var _=require('lodash');var util=require(_0xa5b5('0x0'));var moment=require(_0xa5b5('0x1'));var BPromise=require('bluebird');var rs=require(_0xa5b5('0x2'));var fs=require('fs');var Redis=require(_0xa5b5('0x3'));var db=require(_0xa5b5('0x4'))['db'];var utils=require(_0xa5b5('0x5'));var logger=require(_0xa5b5('0x6'))(_0xa5b5('0x7'));var config=require(_0xa5b5('0x8'));var jayson=require(_0xa5b5('0x9'));var client=jayson['client'][_0xa5b5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c137,_0x513641,_0x32a09a){return new BPromise(function(_0x1936d6,_0x1157ee){return client[_0xa5b5('0xb')](_0x29c137,_0x32a09a)[_0xa5b5('0xc')](function(_0x307afa){logger[_0xa5b5('0xd')](_0xa5b5('0xe'),_0x513641,_0xa5b5('0xf'));logger[_0xa5b5('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x513641,'request\x20sent',JSON['stringify'](_0x307afa));if(_0x307afa['error']){if(_0x307afa[_0xa5b5('0x11')]['code']===0x1f4){logger[_0xa5b5('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x513641,_0x307afa[_0xa5b5('0x11')][_0xa5b5('0x12')]);return _0x1157ee(_0x307afa[_0xa5b5('0x11')][_0xa5b5('0x12')]);}logger[_0xa5b5('0x11')](_0xa5b5('0xe'),_0x513641,_0x307afa[_0xa5b5('0x11')]['message']);return _0x1936d6(_0x307afa['error'][_0xa5b5('0x12')]);}else{logger['info'](_0xa5b5('0xe'),_0x513641,_0xa5b5('0xf'));_0x1936d6(_0x307afa[_0xa5b5('0x13')]['message']);}})['catch'](function(_0x4d3274){logger['error'](_0xa5b5('0xe'),_0x513641,_0x4d3274);_0x1157ee(_0x4d3274);});});}exports[_0xa5b5('0x14')]=function(_0x17ee0b){var _0x32b72f=this;return new Promise(function(_0x434cba,_0x2c8669){return db['ZendeskAccount'][_0xa5b5('0x15')]({'raw':_0x17ee0b[_0xa5b5('0x16')]?_0x17ee0b[_0xa5b5('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x17ee0b[_0xa5b5('0x16')]?_0x17ee0b[_0xa5b5('0x16')][_0xa5b5('0x17')]||null:null,'attributes':_0x17ee0b[_0xa5b5('0x16')]?_0x17ee0b[_0xa5b5('0x16')][_0xa5b5('0x18')]||null:null,'limit':_0x17ee0b[_0xa5b5('0x16')]?_0x17ee0b[_0xa5b5('0x16')][_0xa5b5('0x19')]||null:null,'include':_0x17ee0b[_0xa5b5('0x16')]?_0x17ee0b[_0xa5b5('0x16')][_0xa5b5('0x1a')]?_[_0xa5b5('0x1b')](_0x17ee0b[_0xa5b5('0x16')][_0xa5b5('0x1a')],function(_0x1472a8){return{'model':db[_0x1472a8[_0xa5b5('0x1c')]],'as':_0x1472a8['as'],'attributes':_0x1472a8[_0xa5b5('0x18')],'include':_0x1472a8[_0xa5b5('0x1a')]?_[_0xa5b5('0x1b')](_0x1472a8[_0xa5b5('0x1a')],function(_0x2a90d6){return{'model':db[_0x2a90d6[_0xa5b5('0x1c')]],'as':_0x2a90d6['as'],'attributes':_0x2a90d6[_0xa5b5('0x18')],'include':_0x2a90d6[_0xa5b5('0x1a')]?_[_0xa5b5('0x1b')](_0x2a90d6[_0xa5b5('0x1a')],function(_0x4acc67){return{'model':db[_0x4acc67[_0xa5b5('0x1c')]],'as':_0x4acc67['as'],'attributes':_0x4acc67[_0xa5b5('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa5b5('0xc')](function(_0x40c2ee){logger['info'](_0xa5b5('0x14'),_0x17ee0b);logger[_0xa5b5('0x10')](_0xa5b5('0x14'),_0x17ee0b,JSON[_0xa5b5('0x1d')](_0x40c2ee));_0x434cba(_0x40c2ee);})[_0xa5b5('0x1e')](function(_0x540e6e){logger[_0xa5b5('0x11')]('GetZendeskAccount',_0x540e6e[_0xa5b5('0x12')],_0x17ee0b);_0x2c8669(_0x32b72f[_0xa5b5('0x11')](0x1f4,_0x540e6e[_0xa5b5('0x12')]));});});};exports['ShowZendeskAccount']=function(_0x427806){var _0x4b0134=this;return new Promise(function(_0x15fd8b,_0x3b24a6){return db[_0xa5b5('0x1f')][_0xa5b5('0x20')]({'raw':_0x427806[_0xa5b5('0x16')]?_0x427806[_0xa5b5('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x427806[_0xa5b5('0x16')]?_0x427806[_0xa5b5('0x16')][_0xa5b5('0x17')]||null:null,'attributes':_0x427806[_0xa5b5('0x16')]?_0x427806[_0xa5b5('0x16')][_0xa5b5('0x18')]||null:null,'include':_0x427806['options']?_0x427806[_0xa5b5('0x16')][_0xa5b5('0x1a')]?_[_0xa5b5('0x1b')](_0x427806[_0xa5b5('0x16')][_0xa5b5('0x1a')],function(_0xc72388){return{'model':db[_0xc72388[_0xa5b5('0x1c')]],'as':_0xc72388['as'],'attributes':_0xc72388[_0xa5b5('0x18')],'include':_0xc72388[_0xa5b5('0x1a')]?_[_0xa5b5('0x1b')](_0xc72388[_0xa5b5('0x1a')],function(_0x9aa791){return{'model':db[_0x9aa791[_0xa5b5('0x1c')]],'as':_0x9aa791['as'],'attributes':_0x9aa791[_0xa5b5('0x18')],'include':_0x9aa791[_0xa5b5('0x1a')]?_[_0xa5b5('0x1b')](_0x9aa791['include'],function(_0xf96dbe){return{'model':db[_0xf96dbe[_0xa5b5('0x1c')]],'as':_0xf96dbe['as'],'attributes':_0xf96dbe[_0xa5b5('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ace90){logger[_0xa5b5('0xd')](_0xa5b5('0x21'),_0x427806);logger[_0xa5b5('0x10')](_0xa5b5('0x21'),_0x427806,JSON['stringify'](_0x3ace90));_0x15fd8b(_0x3ace90);})[_0xa5b5('0x1e')](function(_0x37ef86){logger[_0xa5b5('0x11')]('ShowZendeskAccount',_0x37ef86[_0xa5b5('0x12')],_0x427806);_0x3b24a6(_0x4b0134['error'](0x1f4,_0x37ef86[_0xa5b5('0x12')]));});});}; \ No newline at end of file +var _0x00a5=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetZendeskAccount','ZendeskAccount','raw','options','where','attributes','limit','include','model','catch','ShowZendeskAccount','find','map','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x55be98,_0xdc9bef){var _0x2c5b65=function(_0x4a6650){while(--_0x4a6650){_0x55be98['push'](_0x55be98['shift']());}};_0x2c5b65(++_0xdc9bef);}(_0x00a5,0x19e));var _0x500a=function(_0x3c78bd,_0x408333){_0x3c78bd=_0x3c78bd-0x0;var _0x3d0fe5=_0x00a5[_0x3c78bd];return _0x3d0fe5;};'use strict';var _=require(_0x500a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x500a('0x1'));var fs=require('fs');var Redis=require(_0x500a('0x2'));var db=require(_0x500a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x500a('0x4'))('rpc');var config=require(_0x500a('0x5'));var jayson=require(_0x500a('0x6'));var client=jayson[_0x500a('0x7')][_0x500a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x34f8a1,_0x431dcb,_0x33587d){return new BPromise(function(_0x466b6f,_0x3917f9){return client[_0x500a('0x9')](_0x34f8a1,_0x33587d)[_0x500a('0xa')](function(_0x31859d){logger[_0x500a('0xb')](_0x500a('0xc'),_0x431dcb,_0x500a('0xd'));logger[_0x500a('0xe')](_0x500a('0xf'),_0x431dcb,'request\x20sent',JSON[_0x500a('0x10')](_0x31859d));if(_0x31859d[_0x500a('0x11')]){if(_0x31859d[_0x500a('0x11')][_0x500a('0x12')]===0x1f4){logger[_0x500a('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x431dcb,_0x31859d[_0x500a('0x11')][_0x500a('0x13')]);return _0x3917f9(_0x31859d['error'][_0x500a('0x13')]);}logger[_0x500a('0x11')](_0x500a('0xc'),_0x431dcb,_0x31859d[_0x500a('0x11')][_0x500a('0x13')]);return _0x466b6f(_0x31859d[_0x500a('0x11')][_0x500a('0x13')]);}else{logger[_0x500a('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x431dcb,_0x500a('0xd'));_0x466b6f(_0x31859d['result'][_0x500a('0x13')]);}})['catch'](function(_0x5208c8){logger[_0x500a('0x11')](_0x500a('0xc'),_0x431dcb,_0x5208c8);_0x3917f9(_0x5208c8);});});}exports[_0x500a('0x14')]=function(_0x1a0924){var _0x4cdc8b=this;return new Promise(function(_0x268845,_0x352545){return db[_0x500a('0x15')]['findAll']({'raw':_0x1a0924['options']?_0x1a0924['options'][_0x500a('0x16')]===undefined?!![]:![]:!![],'where':_0x1a0924[_0x500a('0x17')]?_0x1a0924['options'][_0x500a('0x18')]||null:null,'attributes':_0x1a0924[_0x500a('0x17')]?_0x1a0924[_0x500a('0x17')][_0x500a('0x19')]||null:null,'limit':_0x1a0924[_0x500a('0x17')]?_0x1a0924[_0x500a('0x17')][_0x500a('0x1a')]||null:null,'include':_0x1a0924[_0x500a('0x17')]?_0x1a0924['options']['include']?_['map'](_0x1a0924['options'][_0x500a('0x1b')],function(_0x725933){return{'model':db[_0x725933[_0x500a('0x1c')]],'as':_0x725933['as'],'attributes':_0x725933[_0x500a('0x19')],'include':_0x725933[_0x500a('0x1b')]?_['map'](_0x725933[_0x500a('0x1b')],function(_0xa849b8){return{'model':db[_0xa849b8[_0x500a('0x1c')]],'as':_0xa849b8['as'],'attributes':_0xa849b8[_0x500a('0x19')],'include':_0xa849b8[_0x500a('0x1b')]?_['map'](_0xa849b8[_0x500a('0x1b')],function(_0x3a0401){return{'model':db[_0x3a0401[_0x500a('0x1c')]],'as':_0x3a0401['as'],'attributes':_0x3a0401[_0x500a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x500a('0xa')](function(_0x1a9faf){logger['info'](_0x500a('0x14'),_0x1a0924);logger['debug'](_0x500a('0x14'),_0x1a0924,JSON['stringify'](_0x1a9faf));_0x268845(_0x1a9faf);})[_0x500a('0x1d')](function(_0x1a6a23){logger[_0x500a('0x11')]('GetZendeskAccount',_0x1a6a23[_0x500a('0x13')],_0x1a0924);_0x352545(_0x4cdc8b[_0x500a('0x11')](0x1f4,_0x1a6a23['message']));});});};exports[_0x500a('0x1e')]=function(_0x2e3e65){var _0x403a9e=this;return new Promise(function(_0x6acdec,_0x2a7b5a){return db['ZendeskAccount'][_0x500a('0x1f')]({'raw':_0x2e3e65[_0x500a('0x17')]?_0x2e3e65['options'][_0x500a('0x16')]===undefined?!![]:![]:!![],'where':_0x2e3e65[_0x500a('0x17')]?_0x2e3e65['options']['where']||null:null,'attributes':_0x2e3e65[_0x500a('0x17')]?_0x2e3e65[_0x500a('0x17')][_0x500a('0x19')]||null:null,'include':_0x2e3e65['options']?_0x2e3e65[_0x500a('0x17')][_0x500a('0x1b')]?_[_0x500a('0x20')](_0x2e3e65['options'][_0x500a('0x1b')],function(_0x18693d){return{'model':db[_0x18693d[_0x500a('0x1c')]],'as':_0x18693d['as'],'attributes':_0x18693d['attributes'],'include':_0x18693d[_0x500a('0x1b')]?_[_0x500a('0x20')](_0x18693d[_0x500a('0x1b')],function(_0x51156b){return{'model':db[_0x51156b[_0x500a('0x1c')]],'as':_0x51156b['as'],'attributes':_0x51156b[_0x500a('0x19')],'include':_0x51156b[_0x500a('0x1b')]?_[_0x500a('0x20')](_0x51156b[_0x500a('0x1b')],function(_0x3f0f0f){return{'model':db[_0x3f0f0f[_0x500a('0x1c')]],'as':_0x3f0f0f['as'],'attributes':_0x3f0f0f[_0x500a('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x42317e){logger[_0x500a('0xb')](_0x500a('0x1e'),_0x2e3e65);logger[_0x500a('0xe')]('ShowZendeskAccount',_0x2e3e65,JSON['stringify'](_0x42317e));_0x6acdec(_0x42317e);})[_0x500a('0x1d')](function(_0x50fe02){logger[_0x500a('0x11')](_0x500a('0x1e'),_0x50fe02[_0x500a('0x13')],_0x2e3e65);_0x2a7b5a(_0x403a9e['error'](0x1f4,_0x50fe02['message']));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 8f945d7..40c951c 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(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0xb688,0xcf));var _0x8b68=function(_0x20140e,_0x3958f2){_0x20140e=_0x20140e-0x0;var _0x2b546a=_0xb688[_0x20140e];return _0x2b546a;};'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 _0x5eb8=['getTags','post','/:id/tags','setTags','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x23afe6,_0x250cdb){var _0x4093b0=function(_0x220892){while(--_0x220892){_0x23afe6['push'](_0x23afe6['shift']());}};_0x4093b0(++_0x250cdb);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1de2bd,_0x953fb){_0x1de2bd=_0x1de2bd-0x0;var _0x595960=_0x5eb8[_0x1de2bd];return _0x595960;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x9')](_0x85eb('0x12'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x9')]('/:id/tags',auth[_0x85eb('0xa')](),controller[_0x85eb('0x14')]);router[_0x85eb('0x15')]('/',auth[_0x85eb('0xa')](),controller['create']);router['post'](_0x85eb('0x16'),auth['isAuthenticated'](),controller[_0x85eb('0x17')]);router[_0x85eb('0x18')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x19')]);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x1a')]);module[_0x85eb('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 522939f..ad30d7c 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 _0x76a5=['sequelize','STRING'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x76a5,0x17e));var _0x576a=function(_0x1fddfd,_0x153a74){_0x1fddfd=_0x1fddfd-0x0;var _0x595b32=_0x76a5[_0x1fddfd];return _0x595b32;};'use strict';var Sequelize=require(_0x576a('0x0'));module['exports']={'name':{'type':Sequelize[_0x576a('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe42d=['STRING','sequelize','exports'];(function(_0x101b49,_0x157ffb){var _0x4b24bc=function(_0x2b485c){while(--_0x2b485c){_0x101b49['push'](_0x101b49['shift']());}};_0x4b24bc(++_0x157ffb);}(_0xe42d,0xf4));var _0xde42=function(_0x175330,_0xa38af3){_0x175330=_0x175330-0x0;var _0x4d4072=_0xe42d[_0x175330];return _0x4d4072;};'use strict';var Sequelize=require(_0xde42('0x0'));module[_0xde42('0x1')]={'name':{'type':Sequelize[_0xde42('0x2')]},'description':{'type':Sequelize[_0xde42('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 39c87ba..73d9685 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 _0xbe60=['options','then','includeAll','include','ZendeskConfiguration','findAll','rows','catch','show','keys','find','body','params','getFields','findOne','ZendeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','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/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','error','name','send','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge'];(function(_0x19baab,_0x3b2716){var _0x317bf6=function(_0x1a2a92){while(--_0x1a2a92){_0x19baab['push'](_0x19baab['shift']());}};_0x317bf6(++_0x3b2716);}(_0xbe60,0x68));var _0x0be6=function(_0x2f56ba,_0x12ef65){_0x2f56ba=_0x2f56ba-0x0;var _0x11dfd3=_0xbe60[_0x2f56ba];return _0x11dfd3;};'use strict';var emlformat=require(_0x0be6('0x0'));var rimraf=require(_0x0be6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0be6('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0be6('0x3'));var Mustache=require(_0x0be6('0x4'));var util=require(_0x0be6('0x5'));var path=require(_0x0be6('0x6'));var sox=require(_0x0be6('0x7'));var csv=require(_0x0be6('0x8'));var ejs=require(_0x0be6('0x9'));var fs=require('fs');var fs_extra=require(_0x0be6('0xa'));var _=require(_0x0be6('0xb'));var squel=require('squel');var crypto=require(_0x0be6('0xc'));var jsforce=require(_0x0be6('0xd'));var deskjs=require(_0x0be6('0xe'));var toCsv=require(_0x0be6('0x8'));var querystring=require(_0x0be6('0xf'));var Papa=require(_0x0be6('0x10'));var Redis=require(_0x0be6('0x11'));var authService=require(_0x0be6('0x12'));var qs=require(_0x0be6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0be6('0x14'));var logger=require(_0x0be6('0x15'))(_0x0be6('0x16'));var utils=require(_0x0be6('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0be6('0x18'));var db=require(_0x0be6('0x19'))['db'];function respondWithStatusCode(_0x2c3aef,_0x9b5fca){_0x9b5fca=_0x9b5fca||0xcc;return function(_0x38804b){if(_0x38804b){return _0x2c3aef[_0x0be6('0x1a')](_0x9b5fca);}return _0x2c3aef[_0x0be6('0x1b')](_0x9b5fca)[_0x0be6('0x1c')]();};}function respondWithResult(_0x583ad5,_0x5bce90){_0x5bce90=_0x5bce90||0xc8;return function(_0x30e79d){if(_0x30e79d){return _0x583ad5['status'](_0x5bce90)['json'](_0x30e79d);}};}function respondWithFilteredResult(_0x4de5b2,_0x41ec98){return function(_0x29f154){if(_0x29f154){var _0x419d77=typeof _0x41ec98[_0x0be6('0x1d')]===_0x0be6('0x1e')&&typeof _0x41ec98[_0x0be6('0x1f')]===_0x0be6('0x1e');var _0x5a1ee7=_0x29f154[_0x0be6('0x20')];var _0x106912=_0x419d77?0x0:_0x41ec98[_0x0be6('0x1d')];var _0x285f88=_0x419d77?_0x29f154[_0x0be6('0x20')]:_0x41ec98['offset']+_0x41ec98['limit'];var _0x41d04a;if(_0x285f88>=_0x5a1ee7){_0x285f88=_0x5a1ee7;_0x41d04a=0xc8;}else{_0x41d04a=0xce;}_0x4de5b2['status'](_0x41d04a);return _0x4de5b2['set'](_0x0be6('0x21'),_0x106912+'-'+_0x285f88+'/'+_0x5a1ee7)[_0x0be6('0x22')](_0x29f154);}return null;};}function patchUpdates(_0x4009ba){return function(_0x1605a0){try{jsonpatch[_0x0be6('0x23')](_0x1605a0,_0x4009ba,!![]);}catch(_0x1996bb){return BPromise['reject'](_0x1996bb);}return _0x1605a0[_0x0be6('0x24')]();};}function saveUpdates(_0x508b06,_0x52bdfb){return function(_0x5e515f){if(_0x5e515f){return _0x5e515f[_0x0be6('0x25')](_0x508b06)['then'](function(_0x15e41f){return _0x15e41f;});}return null;};}function removeEntity(_0x1ef2f3,_0x1a7220){return function(_0x17439b){if(_0x17439b){return _0x17439b[_0x0be6('0x26')]()['then'](function(){_0x1ef2f3[_0x0be6('0x1b')](0xcc)[_0x0be6('0x1c')]();});}};}function handleEntityNotFound(_0x4c99ea,_0x57e3e9){return function(_0xe29aa5){if(!_0xe29aa5){_0x4c99ea[_0x0be6('0x1a')](0x194);}return _0xe29aa5;};}function handleError(_0x1a54fc,_0x519fce){_0x519fce=_0x519fce||0x1f4;return function(_0xefe1e2){logger[_0x0be6('0x27')](_0xefe1e2['stack']);if(_0xefe1e2[_0x0be6('0x28')]){delete _0xefe1e2[_0x0be6('0x28')];}_0x1a54fc[_0x0be6('0x1b')](_0x519fce)[_0x0be6('0x29')](_0xefe1e2);};}exports['index']=function(_0x5628b3,_0x33d3eb){var _0x1dc92d={},_0x33384e={},_0x410f88={'count':0x0,'rows':[]};var _0x2ad7ad=_['map'](db['ZendeskConfiguration'][_0x0be6('0x2a')],function(_0x474e42){return{'name':_0x474e42['fieldName'],'type':_0x474e42['type']['key']};});_0x33384e[_0x0be6('0x2b')]=_['map'](_0x2ad7ad,_0x0be6('0x28'));_0x33384e[_0x0be6('0x2c')]=_['keys'](_0x5628b3[_0x0be6('0x2c')]);_0x33384e[_0x0be6('0x2d')]=_[_0x0be6('0x2e')](_0x33384e['model'],_0x33384e[_0x0be6('0x2c')]);_0x1dc92d[_0x0be6('0x2f')]=_[_0x0be6('0x2e')](_0x33384e['model'],qs[_0x0be6('0x30')](_0x5628b3['query'][_0x0be6('0x30')]));_0x1dc92d[_0x0be6('0x2f')]=_0x1dc92d[_0x0be6('0x2f')][_0x0be6('0x31')]?_0x1dc92d[_0x0be6('0x2f')]:_0x33384e[_0x0be6('0x2b')];if(!_0x5628b3['query'][_0x0be6('0x32')](_0x0be6('0x33'))){_0x1dc92d[_0x0be6('0x1f')]=qs['limit'](_0x5628b3[_0x0be6('0x2c')][_0x0be6('0x1f')]);_0x1dc92d[_0x0be6('0x1d')]=qs[_0x0be6('0x1d')](_0x5628b3[_0x0be6('0x2c')]['offset']);}_0x1dc92d[_0x0be6('0x34')]=qs[_0x0be6('0x35')](_0x5628b3[_0x0be6('0x2c')][_0x0be6('0x35')]);_0x1dc92d[_0x0be6('0x36')]=qs[_0x0be6('0x2d')](_[_0x0be6('0x37')](_0x5628b3[_0x0be6('0x2c')],_0x33384e['filters']),_0x2ad7ad);if(_0x5628b3[_0x0be6('0x2c')][_0x0be6('0x38')]){_0x1dc92d[_0x0be6('0x36')]=_['merge'](_0x1dc92d[_0x0be6('0x36')],{'$or':_[_0x0be6('0x39')](_0x2ad7ad,function(_0x11a242){if(_0x11a242['type']!==_0x0be6('0x3a')){var _0x44bd76={};_0x44bd76[_0x11a242['name']]={'$like':'%'+_0x5628b3[_0x0be6('0x2c')]['filter']+'%'};return _0x44bd76;}})});}_0x1dc92d=_[_0x0be6('0x3b')]({},_0x1dc92d,_0x5628b3[_0x0be6('0x3c')]);var _0x5d491e={'where':_0x1dc92d[_0x0be6('0x36')]};return db['ZendeskConfiguration']['count'](_0x5d491e)[_0x0be6('0x3d')](function(_0x3c59ad){_0x410f88[_0x0be6('0x20')]=_0x3c59ad;if(_0x5628b3[_0x0be6('0x2c')][_0x0be6('0x3e')]){_0x1dc92d[_0x0be6('0x3f')]=[{'all':!![]}];}return db[_0x0be6('0x40')][_0x0be6('0x41')](_0x1dc92d);})[_0x0be6('0x3d')](function(_0x4a651e){_0x410f88[_0x0be6('0x42')]=_0x4a651e;return _0x410f88;})[_0x0be6('0x3d')](respondWithFilteredResult(_0x33d3eb,_0x1dc92d))[_0x0be6('0x43')](handleError(_0x33d3eb,null));};exports[_0x0be6('0x44')]=function(_0x49c5fa,_0xd388fa){var _0x4be96d={'raw':![],'where':{'id':_0x49c5fa['params']['id']}},_0x234400={};_0x234400[_0x0be6('0x2b')]=_[_0x0be6('0x45')](db[_0x0be6('0x40')]['rawAttributes']);_0x234400[_0x0be6('0x2c')]=_[_0x0be6('0x45')](_0x49c5fa[_0x0be6('0x2c')]);_0x234400['filters']=_['intersection'](_0x234400[_0x0be6('0x2b')],_0x234400[_0x0be6('0x2c')]);_0x4be96d['attributes']=_['intersection'](_0x234400[_0x0be6('0x2b')],qs[_0x0be6('0x30')](_0x49c5fa[_0x0be6('0x2c')][_0x0be6('0x30')]));_0x4be96d[_0x0be6('0x2f')]=_0x4be96d['attributes'][_0x0be6('0x31')]?_0x4be96d['attributes']:_0x234400[_0x0be6('0x2b')];if(_0x49c5fa[_0x0be6('0x2c')][_0x0be6('0x3e')]){_0x4be96d[_0x0be6('0x3f')]=[{'all':!![]}];}_0x4be96d=_[_0x0be6('0x3b')]({},_0x4be96d,_0x49c5fa[_0x0be6('0x3c')]);return db[_0x0be6('0x40')][_0x0be6('0x46')](_0x4be96d)[_0x0be6('0x3d')](handleEntityNotFound(_0xd388fa,null))[_0x0be6('0x3d')](respondWithResult(_0xd388fa,null))[_0x0be6('0x43')](handleError(_0xd388fa,null));};exports['create']=function(_0x12395e,_0x4b8726){return db[_0x0be6('0x40')]['create'](_0x12395e[_0x0be6('0x47')],{})[_0x0be6('0x3d')](respondWithResult(_0x4b8726,0xc9))[_0x0be6('0x43')](handleError(_0x4b8726,null));};exports[_0x0be6('0x25')]=function(_0xc8664c,_0x59bc0f){if(_0xc8664c[_0x0be6('0x47')]['id']){delete _0xc8664c['body']['id'];}return db[_0x0be6('0x40')][_0x0be6('0x46')]({'where':{'id':_0xc8664c['params']['id']}})[_0x0be6('0x3d')](handleEntityNotFound(_0x59bc0f,null))[_0x0be6('0x3d')](saveUpdates(_0xc8664c[_0x0be6('0x47')],null))[_0x0be6('0x3d')](respondWithResult(_0x59bc0f,null))[_0x0be6('0x43')](handleError(_0x59bc0f,null));};exports[_0x0be6('0x26')]=function(_0x4b7386,_0x4dbfc6){return db[_0x0be6('0x40')][_0x0be6('0x46')]({'where':{'id':_0x4b7386[_0x0be6('0x48')]['id']}})[_0x0be6('0x3d')](handleEntityNotFound(_0x4dbfc6,null))['then'](removeEntity(_0x4dbfc6,null))['catch'](handleError(_0x4dbfc6,null));};exports[_0x0be6('0x49')]=function(_0x285c3a,_0x32855a,_0x5f2e30){var _0x5bfa84={};var _0xa55da5={};var _0x67285a;var _0x47ed9b;return db[_0x0be6('0x40')][_0x0be6('0x4a')]({'where':{'id':_0x285c3a[_0x0be6('0x48')]['id']}})[_0x0be6('0x3d')](handleEntityNotFound(_0x32855a,null))['then'](function(_0x18da18){if(_0x18da18){_0x67285a=_0x18da18;_0xa55da5[_0x0be6('0x2b')]=_[_0x0be6('0x45')](db[_0x0be6('0x4b')][_0x0be6('0x2a')]);_0xa55da5[_0x0be6('0x2c')]=_[_0x0be6('0x45')](_0x285c3a[_0x0be6('0x2c')]);_0xa55da5[_0x0be6('0x2d')]=_[_0x0be6('0x2e')](_0xa55da5[_0x0be6('0x2b')],_0xa55da5['query']);_0x5bfa84[_0x0be6('0x2f')]=_[_0x0be6('0x2e')](_0xa55da5[_0x0be6('0x2b')],qs['fields'](_0x285c3a[_0x0be6('0x2c')][_0x0be6('0x30')]));_0x5bfa84[_0x0be6('0x2f')]=_0x5bfa84[_0x0be6('0x2f')]['length']?_0x5bfa84[_0x0be6('0x2f')]:_0xa55da5[_0x0be6('0x2b')];_0x5bfa84[_0x0be6('0x34')]=qs[_0x0be6('0x35')](_0x285c3a[_0x0be6('0x2c')][_0x0be6('0x35')]);_0x5bfa84[_0x0be6('0x36')]=qs['filters'](_['pick'](_0x285c3a[_0x0be6('0x2c')],_0xa55da5[_0x0be6('0x2d')]));if(_0x285c3a[_0x0be6('0x2c')][_0x0be6('0x38')]){_0x5bfa84['where']=_[_0x0be6('0x3b')](_0x5bfa84[_0x0be6('0x36')],{'$or':_[_0x0be6('0x39')](_0x5bfa84[_0x0be6('0x2f')],function(_0xefe9d){var _0x36740e={};_0x36740e[_0xefe9d]={'$like':'%'+_0x285c3a[_0x0be6('0x2c')][_0x0be6('0x38')]+'%'};return _0x36740e;})});}_0x5bfa84=_[_0x0be6('0x3b')]({},_0x5bfa84,_0x285c3a['options']);return _0x67285a['getFields'](_0x5bfa84);}})['then'](function(_0x3a5528){if(_0x3a5528){_0x47ed9b=_0x3a5528['length'];if(!_0x285c3a[_0x0be6('0x2c')]['hasOwnProperty'](_0x0be6('0x33'))){_0x5bfa84[_0x0be6('0x1f')]=qs[_0x0be6('0x1f')](_0x285c3a[_0x0be6('0x2c')][_0x0be6('0x1f')]);_0x5bfa84['offset']=qs[_0x0be6('0x1d')](_0x285c3a[_0x0be6('0x2c')][_0x0be6('0x1d')]);}return _0x67285a[_0x0be6('0x49')](_0x5bfa84);}})[_0x0be6('0x3d')](function(_0xa108cc){if(_0xa108cc){return _0xa108cc?{'count':_0x47ed9b,'rows':_0xa108cc}:null;}})[_0x0be6('0x3d')](respondWithResult(_0x32855a,null))[_0x0be6('0x43')](handleError(_0x32855a,null));};exports[_0x0be6('0x4c')]=function(_0x2f3ec4,_0x3ae9c5,_0x529bf2){var _0x5ac322={};var _0x576366={};var _0x29f9bd;var _0x26402f;return db[_0x0be6('0x40')][_0x0be6('0x4a')]({'where':{'id':_0x2f3ec4[_0x0be6('0x48')]['id']}})[_0x0be6('0x3d')](handleEntityNotFound(_0x3ae9c5,null))[_0x0be6('0x3d')](function(_0x5967ce){if(_0x5967ce){_0x29f9bd=_0x5967ce;_0x576366[_0x0be6('0x2b')]=_[_0x0be6('0x45')](db['ZendeskField'][_0x0be6('0x2a')]);_0x576366[_0x0be6('0x2c')]=_[_0x0be6('0x45')](_0x2f3ec4[_0x0be6('0x2c')]);_0x576366[_0x0be6('0x2d')]=_[_0x0be6('0x2e')](_0x576366[_0x0be6('0x2b')],_0x576366[_0x0be6('0x2c')]);_0x5ac322[_0x0be6('0x2f')]=_[_0x0be6('0x2e')](_0x576366['model'],qs[_0x0be6('0x30')](_0x2f3ec4['query']['fields']));_0x5ac322['attributes']=_0x5ac322[_0x0be6('0x2f')][_0x0be6('0x31')]?_0x5ac322[_0x0be6('0x2f')]:_0x576366[_0x0be6('0x2b')];_0x5ac322[_0x0be6('0x34')]=qs[_0x0be6('0x35')](_0x2f3ec4[_0x0be6('0x2c')][_0x0be6('0x35')]);_0x5ac322['where']=qs[_0x0be6('0x2d')](_[_0x0be6('0x37')](_0x2f3ec4['query'],_0x576366['filters']));if(_0x2f3ec4[_0x0be6('0x2c')][_0x0be6('0x38')]){_0x5ac322[_0x0be6('0x36')]=_[_0x0be6('0x3b')](_0x5ac322[_0x0be6('0x36')],{'$or':_[_0x0be6('0x39')](_0x5ac322['attributes'],function(_0x1a294e){var _0x53b160={};_0x53b160[_0x1a294e]={'$like':'%'+_0x2f3ec4['query'][_0x0be6('0x38')]+'%'};return _0x53b160;})});}_0x5ac322=_[_0x0be6('0x3b')]({},_0x5ac322,_0x2f3ec4[_0x0be6('0x3c')]);return _0x29f9bd['getSubjects'](_0x5ac322);}})[_0x0be6('0x3d')](function(_0x410f05){if(_0x410f05){_0x26402f=_0x410f05[_0x0be6('0x31')];if(!_0x2f3ec4['query'][_0x0be6('0x32')](_0x0be6('0x33'))){_0x5ac322[_0x0be6('0x1f')]=qs[_0x0be6('0x1f')](_0x2f3ec4['query'][_0x0be6('0x1f')]);_0x5ac322[_0x0be6('0x1d')]=qs[_0x0be6('0x1d')](_0x2f3ec4[_0x0be6('0x2c')][_0x0be6('0x1d')]);}return _0x29f9bd[_0x0be6('0x4c')](_0x5ac322);}})[_0x0be6('0x3d')](function(_0xa99bab){if(_0xa99bab){return _0xa99bab?{'count':_0x26402f,'rows':_0xa99bab}:null;}})['then'](respondWithResult(_0x3ae9c5,null))[_0x0be6('0x43')](handleError(_0x3ae9c5,null));};exports[_0x0be6('0x4d')]=function(_0x3659df,_0x2a2f64,_0x33ee29){var _0x3da03a={};var _0x569773={};var _0x1ad1c3;var _0x55bba8;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x3659df[_0x0be6('0x48')]['id']}})['then'](handleEntityNotFound(_0x2a2f64,null))[_0x0be6('0x3d')](function(_0x2d99c5){if(_0x2d99c5){_0x1ad1c3=_0x2d99c5;_0x569773[_0x0be6('0x2b')]=_[_0x0be6('0x45')](db['ZendeskField']['rawAttributes']);_0x569773[_0x0be6('0x2c')]=_[_0x0be6('0x45')](_0x3659df[_0x0be6('0x2c')]);_0x569773['filters']=_[_0x0be6('0x2e')](_0x569773['model'],_0x569773['query']);_0x3da03a['attributes']=_[_0x0be6('0x2e')](_0x569773[_0x0be6('0x2b')],qs[_0x0be6('0x30')](_0x3659df[_0x0be6('0x2c')][_0x0be6('0x30')]));_0x3da03a[_0x0be6('0x2f')]=_0x3da03a[_0x0be6('0x2f')]['length']?_0x3da03a[_0x0be6('0x2f')]:_0x569773[_0x0be6('0x2b')];_0x3da03a[_0x0be6('0x34')]=qs[_0x0be6('0x35')](_0x3659df['query'][_0x0be6('0x35')]);_0x3da03a['where']=qs[_0x0be6('0x2d')](_[_0x0be6('0x37')](_0x3659df['query'],_0x569773[_0x0be6('0x2d')]));if(_0x3659df[_0x0be6('0x2c')][_0x0be6('0x38')]){_0x3da03a['where']=_[_0x0be6('0x3b')](_0x3da03a[_0x0be6('0x36')],{'$or':_[_0x0be6('0x39')](_0x3da03a['attributes'],function(_0x632098){var _0x61fbe5={};_0x61fbe5[_0x632098]={'$like':'%'+_0x3659df[_0x0be6('0x2c')]['filter']+'%'};return _0x61fbe5;})});}_0x3da03a=_[_0x0be6('0x3b')]({},_0x3da03a,_0x3659df[_0x0be6('0x3c')]);return _0x1ad1c3[_0x0be6('0x4d')](_0x3da03a);}})[_0x0be6('0x3d')](function(_0x5383cc){if(_0x5383cc){_0x55bba8=_0x5383cc[_0x0be6('0x31')];if(!_0x3659df[_0x0be6('0x2c')][_0x0be6('0x32')](_0x0be6('0x33'))){_0x3da03a[_0x0be6('0x1f')]=qs[_0x0be6('0x1f')](_0x3659df[_0x0be6('0x2c')][_0x0be6('0x1f')]);_0x3da03a[_0x0be6('0x1d')]=qs[_0x0be6('0x1d')](_0x3659df[_0x0be6('0x2c')][_0x0be6('0x1d')]);}return _0x1ad1c3['getDescriptions'](_0x3da03a);}})[_0x0be6('0x3d')](function(_0x170edd){if(_0x170edd){return _0x170edd?{'count':_0x55bba8,'rows':_0x170edd}:null;}})['then'](respondWithResult(_0x2a2f64,null))['catch'](handleError(_0x2a2f64,null));};exports[_0x0be6('0x4e')]=function(_0x5f4c1c,_0x3e4d70,_0x208cb5){var _0x3a14aa={};var _0x56491c={};var _0x2e4b0f;var _0xa4d6f6;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x5f4c1c[_0x0be6('0x48')]['id']}})[_0x0be6('0x3d')](handleEntityNotFound(_0x3e4d70,null))['then'](function(_0x5a6b2b){if(_0x5a6b2b){_0x2e4b0f=_0x5a6b2b;_0x56491c[_0x0be6('0x2b')]=_[_0x0be6('0x45')](db[_0x0be6('0x4f')][_0x0be6('0x2a')]);_0x56491c[_0x0be6('0x2c')]=_[_0x0be6('0x45')](_0x5f4c1c[_0x0be6('0x2c')]);_0x56491c[_0x0be6('0x2d')]=_['intersection'](_0x56491c[_0x0be6('0x2b')],_0x56491c[_0x0be6('0x2c')]);_0x3a14aa[_0x0be6('0x2f')]=_[_0x0be6('0x2e')](_0x56491c[_0x0be6('0x2b')],qs[_0x0be6('0x30')](_0x5f4c1c[_0x0be6('0x2c')][_0x0be6('0x30')]));_0x3a14aa[_0x0be6('0x2f')]=_0x3a14aa[_0x0be6('0x2f')][_0x0be6('0x31')]?_0x3a14aa[_0x0be6('0x2f')]:_0x56491c[_0x0be6('0x2b')];_0x3a14aa[_0x0be6('0x34')]=qs[_0x0be6('0x35')](_0x5f4c1c[_0x0be6('0x2c')][_0x0be6('0x35')]);_0x3a14aa['where']=qs[_0x0be6('0x2d')](_[_0x0be6('0x37')](_0x5f4c1c[_0x0be6('0x2c')],_0x56491c['filters']));if(_0x5f4c1c[_0x0be6('0x2c')][_0x0be6('0x38')]){_0x3a14aa[_0x0be6('0x36')]=_['merge'](_0x3a14aa[_0x0be6('0x36')],{'$or':_[_0x0be6('0x39')](_0x3a14aa[_0x0be6('0x2f')],function(_0x3fcf3c){var _0x260f8e={};_0x260f8e[_0x3fcf3c]={'$like':'%'+_0x5f4c1c[_0x0be6('0x2c')][_0x0be6('0x38')]+'%'};return _0x260f8e;})});}_0x3a14aa=_[_0x0be6('0x3b')]({},_0x3a14aa,_0x5f4c1c[_0x0be6('0x3c')]);return _0x2e4b0f[_0x0be6('0x4e')](_0x3a14aa);}})[_0x0be6('0x3d')](function(_0x1dd7d0){if(_0x1dd7d0){_0xa4d6f6=_0x1dd7d0[_0x0be6('0x31')];if(!_0x5f4c1c[_0x0be6('0x2c')][_0x0be6('0x32')](_0x0be6('0x33'))){_0x3a14aa[_0x0be6('0x1f')]=qs['limit'](_0x5f4c1c[_0x0be6('0x2c')][_0x0be6('0x1f')]);_0x3a14aa['offset']=qs[_0x0be6('0x1d')](_0x5f4c1c[_0x0be6('0x2c')][_0x0be6('0x1d')]);}return _0x2e4b0f[_0x0be6('0x4e')](_0x3a14aa);}})[_0x0be6('0x3d')](function(_0x11708a){if(_0x11708a){return _0x11708a?{'count':_0xa4d6f6,'rows':_0x11708a}:null;}})[_0x0be6('0x3d')](respondWithResult(_0x3e4d70,null))['catch'](handleError(_0x3e4d70,null));};exports[_0x0be6('0x50')]=function(_0x1c4060,_0x42d560,_0xbba87d){if(_0x1c4060[_0x0be6('0x47')]['id']){delete _0x1c4060[_0x0be6('0x47')]['id'];}return db[_0x0be6('0x40')][_0x0be6('0x4a')]({'where':{'id':_0x1c4060['params']['id']}})[_0x0be6('0x3d')](handleEntityNotFound(_0x42d560,null))[_0x0be6('0x3d')](function(_0x588771){if(_0x588771){return _0x588771[_0x0be6('0x50')](_0x1c4060['body'][_0x0be6('0x51')]||[]);}return null;})[_0x0be6('0x3d')](respondWithResult(_0x42d560,null))['catch'](handleError(_0x42d560,null));}; \ No newline at end of file +var _0xe5b6=['destroy','then','sendStatus','stack','name','index','map','ZendeskConfiguration','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','rows','catch','length','find','create','body','params','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','Tag','setTags','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','end','status','undefined','limit','offset','count','apply','save','update'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0xe5b6,0xc1));var _0x6e5b=function(_0x554627,_0x4886e2){_0x554627=_0x554627-0x0;var _0x542622=_0xe5b6[_0x554627];return _0x542622;};'use strict';var emlformat=require(_0x6e5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e5b('0x1'));var jsonpatch=require(_0x6e5b('0x2'));var rp=require(_0x6e5b('0x3'));var moment=require(_0x6e5b('0x4'));var BPromise=require(_0x6e5b('0x5'));var Mustache=require('mustache');var util=require(_0x6e5b('0x6'));var path=require(_0x6e5b('0x7'));var sox=require('sox');var csv=require(_0x6e5b('0x8'));var ejs=require(_0x6e5b('0x9'));var fs=require('fs');var fs_extra=require(_0x6e5b('0xa'));var _=require(_0x6e5b('0xb'));var squel=require(_0x6e5b('0xc'));var crypto=require(_0x6e5b('0xd'));var jsforce=require(_0x6e5b('0xe'));var deskjs=require(_0x6e5b('0xf'));var toCsv=require(_0x6e5b('0x8'));var querystring=require(_0x6e5b('0x10'));var Papa=require('papaparse');var Redis=require(_0x6e5b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6e5b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e5b('0x13'))(_0x6e5b('0x14'));var utils=require(_0x6e5b('0x15'));var config=require(_0x6e5b('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aaab0,_0x5685cd){_0x5685cd=_0x5685cd||0xcc;return function(_0x7e5e2a){if(_0x7e5e2a){return _0x3aaab0['sendStatus'](_0x5685cd);}return _0x3aaab0['status'](_0x5685cd)[_0x6e5b('0x17')]();};}function respondWithResult(_0x4fa85a,_0x2cbfb5){_0x2cbfb5=_0x2cbfb5||0xc8;return function(_0x1726d5){if(_0x1726d5){return _0x4fa85a[_0x6e5b('0x18')](_0x2cbfb5)['json'](_0x1726d5);}};}function respondWithFilteredResult(_0x57c6b3,_0x10b23d){return function(_0x49ce8c){if(_0x49ce8c){var _0x57fcc7=typeof _0x10b23d['offset']===_0x6e5b('0x19')&&typeof _0x10b23d[_0x6e5b('0x1a')]==='undefined';var _0x1e68af=_0x49ce8c['count'];var _0x5cc5c1=_0x57fcc7?0x0:_0x10b23d[_0x6e5b('0x1b')];var _0x58c85e=_0x57fcc7?_0x49ce8c[_0x6e5b('0x1c')]:_0x10b23d['offset']+_0x10b23d[_0x6e5b('0x1a')];var _0x559bf5;if(_0x58c85e>=_0x1e68af){_0x58c85e=_0x1e68af;_0x559bf5=0xc8;}else{_0x559bf5=0xce;}_0x57c6b3[_0x6e5b('0x18')](_0x559bf5);return _0x57c6b3['set']('Content-Range',_0x5cc5c1+'-'+_0x58c85e+'/'+_0x1e68af)['json'](_0x49ce8c);}return null;};}function patchUpdates(_0x547e64){return function(_0x470e08){try{jsonpatch[_0x6e5b('0x1d')](_0x470e08,_0x547e64,!![]);}catch(_0x3f92e5){return BPromise['reject'](_0x3f92e5);}return _0x470e08[_0x6e5b('0x1e')]();};}function saveUpdates(_0x485101,_0x30dc65){return function(_0x27a706){if(_0x27a706){return _0x27a706[_0x6e5b('0x1f')](_0x485101)['then'](function(_0x233418){return _0x233418;});}return null;};}function removeEntity(_0x5a6618,_0x382ee7){return function(_0x5a5a23){if(_0x5a5a23){return _0x5a5a23[_0x6e5b('0x20')]()[_0x6e5b('0x21')](function(){_0x5a6618[_0x6e5b('0x18')](0xcc)[_0x6e5b('0x17')]();});}};}function handleEntityNotFound(_0x5d643d,_0x961d54){return function(_0x183c44){if(!_0x183c44){_0x5d643d[_0x6e5b('0x22')](0x194);}return _0x183c44;};}function handleError(_0x20abbd,_0x4eed05){_0x4eed05=_0x4eed05||0x1f4;return function(_0x493c69){logger['error'](_0x493c69[_0x6e5b('0x23')]);if(_0x493c69['name']){delete _0x493c69[_0x6e5b('0x24')];}_0x20abbd[_0x6e5b('0x18')](_0x4eed05)['send'](_0x493c69);};}exports[_0x6e5b('0x25')]=function(_0xa96e83,_0x24ee42){var _0xe13123={},_0x335b89={},_0x25e505={'count':0x0,'rows':[]};var _0x131f43=_[_0x6e5b('0x26')](db[_0x6e5b('0x27')][_0x6e5b('0x28')],function(_0xf62838){return{'name':_0xf62838['fieldName'],'type':_0xf62838[_0x6e5b('0x29')][_0x6e5b('0x2a')]};});_0x335b89['model']=_[_0x6e5b('0x26')](_0x131f43,_0x6e5b('0x24'));_0x335b89[_0x6e5b('0x2b')]=_[_0x6e5b('0x2c')](_0xa96e83['query']);_0x335b89['filters']=_[_0x6e5b('0x2d')](_0x335b89[_0x6e5b('0x2e')],_0x335b89[_0x6e5b('0x2b')]);_0xe13123[_0x6e5b('0x2f')]=_['intersection'](_0x335b89[_0x6e5b('0x2e')],qs[_0x6e5b('0x30')](_0xa96e83['query'][_0x6e5b('0x30')]));_0xe13123['attributes']=_0xe13123[_0x6e5b('0x2f')]['length']?_0xe13123[_0x6e5b('0x2f')]:_0x335b89[_0x6e5b('0x2e')];if(!_0xa96e83[_0x6e5b('0x2b')][_0x6e5b('0x31')](_0x6e5b('0x32'))){_0xe13123[_0x6e5b('0x1a')]=qs[_0x6e5b('0x1a')](_0xa96e83[_0x6e5b('0x2b')]['limit']);_0xe13123[_0x6e5b('0x1b')]=qs[_0x6e5b('0x1b')](_0xa96e83['query'][_0x6e5b('0x1b')]);}_0xe13123[_0x6e5b('0x33')]=qs[_0x6e5b('0x34')](_0xa96e83[_0x6e5b('0x2b')]['sort']);_0xe13123[_0x6e5b('0x35')]=qs[_0x6e5b('0x36')](_[_0x6e5b('0x37')](_0xa96e83[_0x6e5b('0x2b')],_0x335b89[_0x6e5b('0x36')]),_0x131f43);if(_0xa96e83[_0x6e5b('0x2b')][_0x6e5b('0x38')]){_0xe13123['where']=_['merge'](_0xe13123[_0x6e5b('0x35')],{'$or':_[_0x6e5b('0x26')](_0x131f43,function(_0x6d6006){if(_0x6d6006[_0x6e5b('0x29')]!=='VIRTUAL'){var _0x1c2a38={};_0x1c2a38[_0x6d6006[_0x6e5b('0x24')]]={'$like':'%'+_0xa96e83[_0x6e5b('0x2b')][_0x6e5b('0x38')]+'%'};return _0x1c2a38;}})});}_0xe13123=_[_0x6e5b('0x39')]({},_0xe13123,_0xa96e83[_0x6e5b('0x3a')]);var _0x12d252={'where':_0xe13123[_0x6e5b('0x35')]};return db['ZendeskConfiguration'][_0x6e5b('0x1c')](_0x12d252)[_0x6e5b('0x21')](function(_0x37a23b){_0x25e505[_0x6e5b('0x1c')]=_0x37a23b;if(_0xa96e83['query'][_0x6e5b('0x3b')]){_0xe13123['include']=[{'all':!![]}];}return db['ZendeskConfiguration']['findAll'](_0xe13123);})[_0x6e5b('0x21')](function(_0x36544c){_0x25e505[_0x6e5b('0x3c')]=_0x36544c;return _0x25e505;})[_0x6e5b('0x21')](respondWithFilteredResult(_0x24ee42,_0xe13123))[_0x6e5b('0x3d')](handleError(_0x24ee42,null));};exports['show']=function(_0x356c20,_0x4bd357){var _0x12db90={'raw':![],'where':{'id':_0x356c20['params']['id']}},_0x253785={};_0x253785['model']=_[_0x6e5b('0x2c')](db[_0x6e5b('0x27')][_0x6e5b('0x28')]);_0x253785[_0x6e5b('0x2b')]=_[_0x6e5b('0x2c')](_0x356c20[_0x6e5b('0x2b')]);_0x253785[_0x6e5b('0x36')]=_[_0x6e5b('0x2d')](_0x253785[_0x6e5b('0x2e')],_0x253785['query']);_0x12db90[_0x6e5b('0x2f')]=_['intersection'](_0x253785['model'],qs[_0x6e5b('0x30')](_0x356c20[_0x6e5b('0x2b')]['fields']));_0x12db90[_0x6e5b('0x2f')]=_0x12db90['attributes'][_0x6e5b('0x3e')]?_0x12db90[_0x6e5b('0x2f')]:_0x253785[_0x6e5b('0x2e')];if(_0x356c20['query'][_0x6e5b('0x3b')]){_0x12db90['include']=[{'all':!![]}];}_0x12db90=_[_0x6e5b('0x39')]({},_0x12db90,_0x356c20[_0x6e5b('0x3a')]);return db['ZendeskConfiguration'][_0x6e5b('0x3f')](_0x12db90)[_0x6e5b('0x21')](handleEntityNotFound(_0x4bd357,null))[_0x6e5b('0x21')](respondWithResult(_0x4bd357,null))[_0x6e5b('0x3d')](handleError(_0x4bd357,null));};exports[_0x6e5b('0x40')]=function(_0x49243d,_0x4b4527){return db[_0x6e5b('0x27')][_0x6e5b('0x40')](_0x49243d[_0x6e5b('0x41')],{})['then'](respondWithResult(_0x4b4527,0xc9))['catch'](handleError(_0x4b4527,null));};exports[_0x6e5b('0x1f')]=function(_0x2cb4dd,_0xed1f40){if(_0x2cb4dd['body']['id']){delete _0x2cb4dd[_0x6e5b('0x41')]['id'];}return db[_0x6e5b('0x27')]['find']({'where':{'id':_0x2cb4dd['params']['id']}})['then'](handleEntityNotFound(_0xed1f40,null))[_0x6e5b('0x21')](saveUpdates(_0x2cb4dd[_0x6e5b('0x41')],null))[_0x6e5b('0x21')](respondWithResult(_0xed1f40,null))[_0x6e5b('0x3d')](handleError(_0xed1f40,null));};exports['destroy']=function(_0x474958,_0x672744){return db['ZendeskConfiguration'][_0x6e5b('0x3f')]({'where':{'id':_0x474958[_0x6e5b('0x42')]['id']}})['then'](handleEntityNotFound(_0x672744,null))['then'](removeEntity(_0x672744,null))[_0x6e5b('0x3d')](handleError(_0x672744,null));};exports[_0x6e5b('0x43')]=function(_0x14caec,_0x2f1334,_0x4247e7){var _0x43a7bc={};var _0x29ff09={};var _0x2d0a86;var _0x565cd3;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x14caec[_0x6e5b('0x42')]['id']}})[_0x6e5b('0x21')](handleEntityNotFound(_0x2f1334,null))['then'](function(_0x25dce1){if(_0x25dce1){_0x2d0a86=_0x25dce1;_0x29ff09[_0x6e5b('0x2e')]=_['keys'](db[_0x6e5b('0x44')]['rawAttributes']);_0x29ff09[_0x6e5b('0x2b')]=_['keys'](_0x14caec[_0x6e5b('0x2b')]);_0x29ff09[_0x6e5b('0x36')]=_[_0x6e5b('0x2d')](_0x29ff09[_0x6e5b('0x2e')],_0x29ff09[_0x6e5b('0x2b')]);_0x43a7bc[_0x6e5b('0x2f')]=_[_0x6e5b('0x2d')](_0x29ff09[_0x6e5b('0x2e')],qs[_0x6e5b('0x30')](_0x14caec[_0x6e5b('0x2b')][_0x6e5b('0x30')]));_0x43a7bc[_0x6e5b('0x2f')]=_0x43a7bc[_0x6e5b('0x2f')][_0x6e5b('0x3e')]?_0x43a7bc[_0x6e5b('0x2f')]:_0x29ff09['model'];_0x43a7bc['order']=qs['sort'](_0x14caec[_0x6e5b('0x2b')][_0x6e5b('0x34')]);_0x43a7bc['where']=qs[_0x6e5b('0x36')](_['pick'](_0x14caec['query'],_0x29ff09[_0x6e5b('0x36')]));if(_0x14caec['query']['filter']){_0x43a7bc['where']=_[_0x6e5b('0x39')](_0x43a7bc[_0x6e5b('0x35')],{'$or':_[_0x6e5b('0x26')](_0x43a7bc['attributes'],function(_0x2fa348){var _0x29b24e={};_0x29b24e[_0x2fa348]={'$like':'%'+_0x14caec[_0x6e5b('0x2b')][_0x6e5b('0x38')]+'%'};return _0x29b24e;})});}_0x43a7bc=_[_0x6e5b('0x39')]({},_0x43a7bc,_0x14caec['options']);return _0x2d0a86[_0x6e5b('0x43')](_0x43a7bc);}})[_0x6e5b('0x21')](function(_0x603d49){if(_0x603d49){_0x565cd3=_0x603d49[_0x6e5b('0x3e')];if(!_0x14caec[_0x6e5b('0x2b')]['hasOwnProperty'](_0x6e5b('0x32'))){_0x43a7bc['limit']=qs[_0x6e5b('0x1a')](_0x14caec['query'][_0x6e5b('0x1a')]);_0x43a7bc[_0x6e5b('0x1b')]=qs[_0x6e5b('0x1b')](_0x14caec['query']['offset']);}return _0x2d0a86[_0x6e5b('0x43')](_0x43a7bc);}})[_0x6e5b('0x21')](function(_0x2f73a8){if(_0x2f73a8){return _0x2f73a8?{'count':_0x565cd3,'rows':_0x2f73a8}:null;}})['then'](respondWithResult(_0x2f1334,null))[_0x6e5b('0x3d')](handleError(_0x2f1334,null));};exports[_0x6e5b('0x45')]=function(_0x5498fb,_0x37812f,_0x2637c0){var _0x17020b={};var _0x1f6281={};var _0xab7996;var _0x482eb1;return db[_0x6e5b('0x27')][_0x6e5b('0x46')]({'where':{'id':_0x5498fb[_0x6e5b('0x42')]['id']}})['then'](handleEntityNotFound(_0x37812f,null))[_0x6e5b('0x21')](function(_0x878aae){if(_0x878aae){_0xab7996=_0x878aae;_0x1f6281[_0x6e5b('0x2e')]=_['keys'](db[_0x6e5b('0x44')][_0x6e5b('0x28')]);_0x1f6281[_0x6e5b('0x2b')]=_[_0x6e5b('0x2c')](_0x5498fb[_0x6e5b('0x2b')]);_0x1f6281[_0x6e5b('0x36')]=_[_0x6e5b('0x2d')](_0x1f6281['model'],_0x1f6281[_0x6e5b('0x2b')]);_0x17020b[_0x6e5b('0x2f')]=_[_0x6e5b('0x2d')](_0x1f6281[_0x6e5b('0x2e')],qs[_0x6e5b('0x30')](_0x5498fb[_0x6e5b('0x2b')][_0x6e5b('0x30')]));_0x17020b['attributes']=_0x17020b[_0x6e5b('0x2f')][_0x6e5b('0x3e')]?_0x17020b[_0x6e5b('0x2f')]:_0x1f6281[_0x6e5b('0x2e')];_0x17020b[_0x6e5b('0x33')]=qs['sort'](_0x5498fb[_0x6e5b('0x2b')][_0x6e5b('0x34')]);_0x17020b[_0x6e5b('0x35')]=qs[_0x6e5b('0x36')](_[_0x6e5b('0x37')](_0x5498fb[_0x6e5b('0x2b')],_0x1f6281[_0x6e5b('0x36')]));if(_0x5498fb['query'][_0x6e5b('0x38')]){_0x17020b[_0x6e5b('0x35')]=_[_0x6e5b('0x39')](_0x17020b[_0x6e5b('0x35')],{'$or':_[_0x6e5b('0x26')](_0x17020b[_0x6e5b('0x2f')],function(_0x259a5c){var _0xacec14={};_0xacec14[_0x259a5c]={'$like':'%'+_0x5498fb['query'][_0x6e5b('0x38')]+'%'};return _0xacec14;})});}_0x17020b=_[_0x6e5b('0x39')]({},_0x17020b,_0x5498fb[_0x6e5b('0x3a')]);return _0xab7996[_0x6e5b('0x45')](_0x17020b);}})[_0x6e5b('0x21')](function(_0x73ee79){if(_0x73ee79){_0x482eb1=_0x73ee79[_0x6e5b('0x3e')];if(!_0x5498fb[_0x6e5b('0x2b')][_0x6e5b('0x31')](_0x6e5b('0x32'))){_0x17020b[_0x6e5b('0x1a')]=qs[_0x6e5b('0x1a')](_0x5498fb[_0x6e5b('0x2b')][_0x6e5b('0x1a')]);_0x17020b[_0x6e5b('0x1b')]=qs[_0x6e5b('0x1b')](_0x5498fb['query'][_0x6e5b('0x1b')]);}return _0xab7996['getSubjects'](_0x17020b);}})[_0x6e5b('0x21')](function(_0x3069fb){if(_0x3069fb){return _0x3069fb?{'count':_0x482eb1,'rows':_0x3069fb}:null;}})['then'](respondWithResult(_0x37812f,null))['catch'](handleError(_0x37812f,null));};exports[_0x6e5b('0x47')]=function(_0x7b4f53,_0x4001d0,_0x2a046a){var _0x1b9f65={};var _0x18054f={};var _0x3253ca;var _0x87f1e7;return db[_0x6e5b('0x27')]['findOne']({'where':{'id':_0x7b4f53[_0x6e5b('0x42')]['id']}})['then'](handleEntityNotFound(_0x4001d0,null))[_0x6e5b('0x21')](function(_0x1f7ba4){if(_0x1f7ba4){_0x3253ca=_0x1f7ba4;_0x18054f[_0x6e5b('0x2e')]=_[_0x6e5b('0x2c')](db[_0x6e5b('0x44')][_0x6e5b('0x28')]);_0x18054f[_0x6e5b('0x2b')]=_['keys'](_0x7b4f53[_0x6e5b('0x2b')]);_0x18054f[_0x6e5b('0x36')]=_[_0x6e5b('0x2d')](_0x18054f['model'],_0x18054f['query']);_0x1b9f65[_0x6e5b('0x2f')]=_[_0x6e5b('0x2d')](_0x18054f[_0x6e5b('0x2e')],qs[_0x6e5b('0x30')](_0x7b4f53[_0x6e5b('0x2b')]['fields']));_0x1b9f65[_0x6e5b('0x2f')]=_0x1b9f65[_0x6e5b('0x2f')]['length']?_0x1b9f65[_0x6e5b('0x2f')]:_0x18054f['model'];_0x1b9f65[_0x6e5b('0x33')]=qs[_0x6e5b('0x34')](_0x7b4f53[_0x6e5b('0x2b')][_0x6e5b('0x34')]);_0x1b9f65[_0x6e5b('0x35')]=qs['filters'](_[_0x6e5b('0x37')](_0x7b4f53[_0x6e5b('0x2b')],_0x18054f['filters']));if(_0x7b4f53[_0x6e5b('0x2b')][_0x6e5b('0x38')]){_0x1b9f65[_0x6e5b('0x35')]=_[_0x6e5b('0x39')](_0x1b9f65[_0x6e5b('0x35')],{'$or':_[_0x6e5b('0x26')](_0x1b9f65[_0x6e5b('0x2f')],function(_0x252846){var _0x2d9700={};_0x2d9700[_0x252846]={'$like':'%'+_0x7b4f53[_0x6e5b('0x2b')]['filter']+'%'};return _0x2d9700;})});}_0x1b9f65=_[_0x6e5b('0x39')]({},_0x1b9f65,_0x7b4f53['options']);return _0x3253ca[_0x6e5b('0x47')](_0x1b9f65);}})[_0x6e5b('0x21')](function(_0x47821){if(_0x47821){_0x87f1e7=_0x47821['length'];if(!_0x7b4f53[_0x6e5b('0x2b')][_0x6e5b('0x31')](_0x6e5b('0x32'))){_0x1b9f65[_0x6e5b('0x1a')]=qs[_0x6e5b('0x1a')](_0x7b4f53['query']['limit']);_0x1b9f65['offset']=qs[_0x6e5b('0x1b')](_0x7b4f53['query'][_0x6e5b('0x1b')]);}return _0x3253ca[_0x6e5b('0x47')](_0x1b9f65);}})[_0x6e5b('0x21')](function(_0x16e051){if(_0x16e051){return _0x16e051?{'count':_0x87f1e7,'rows':_0x16e051}:null;}})[_0x6e5b('0x21')](respondWithResult(_0x4001d0,null))[_0x6e5b('0x3d')](handleError(_0x4001d0,null));};exports[_0x6e5b('0x48')]=function(_0x248bbd,_0x1dc9c0,_0x429028){var _0x28896d={};var _0x52b7bb={};var _0x1b7587;var _0x116d6d;return db[_0x6e5b('0x27')]['findOne']({'where':{'id':_0x248bbd[_0x6e5b('0x42')]['id']}})['then'](handleEntityNotFound(_0x1dc9c0,null))[_0x6e5b('0x21')](function(_0x651776){if(_0x651776){_0x1b7587=_0x651776;_0x52b7bb['model']=_['keys'](db[_0x6e5b('0x49')]['rawAttributes']);_0x52b7bb[_0x6e5b('0x2b')]=_[_0x6e5b('0x2c')](_0x248bbd[_0x6e5b('0x2b')]);_0x52b7bb[_0x6e5b('0x36')]=_['intersection'](_0x52b7bb[_0x6e5b('0x2e')],_0x52b7bb['query']);_0x28896d[_0x6e5b('0x2f')]=_[_0x6e5b('0x2d')](_0x52b7bb[_0x6e5b('0x2e')],qs['fields'](_0x248bbd[_0x6e5b('0x2b')][_0x6e5b('0x30')]));_0x28896d[_0x6e5b('0x2f')]=_0x28896d[_0x6e5b('0x2f')][_0x6e5b('0x3e')]?_0x28896d[_0x6e5b('0x2f')]:_0x52b7bb[_0x6e5b('0x2e')];_0x28896d[_0x6e5b('0x33')]=qs[_0x6e5b('0x34')](_0x248bbd['query'][_0x6e5b('0x34')]);_0x28896d['where']=qs['filters'](_['pick'](_0x248bbd['query'],_0x52b7bb[_0x6e5b('0x36')]));if(_0x248bbd[_0x6e5b('0x2b')][_0x6e5b('0x38')]){_0x28896d[_0x6e5b('0x35')]=_[_0x6e5b('0x39')](_0x28896d[_0x6e5b('0x35')],{'$or':_['map'](_0x28896d[_0x6e5b('0x2f')],function(_0x1d5dc1){var _0x1782bd={};_0x1782bd[_0x1d5dc1]={'$like':'%'+_0x248bbd[_0x6e5b('0x2b')][_0x6e5b('0x38')]+'%'};return _0x1782bd;})});}_0x28896d=_['merge']({},_0x28896d,_0x248bbd[_0x6e5b('0x3a')]);return _0x1b7587[_0x6e5b('0x48')](_0x28896d);}})['then'](function(_0x4276ce){if(_0x4276ce){_0x116d6d=_0x4276ce[_0x6e5b('0x3e')];if(!_0x248bbd[_0x6e5b('0x2b')][_0x6e5b('0x31')]('nolimit')){_0x28896d[_0x6e5b('0x1a')]=qs[_0x6e5b('0x1a')](_0x248bbd[_0x6e5b('0x2b')][_0x6e5b('0x1a')]);_0x28896d[_0x6e5b('0x1b')]=qs[_0x6e5b('0x1b')](_0x248bbd[_0x6e5b('0x2b')][_0x6e5b('0x1b')]);}return _0x1b7587[_0x6e5b('0x48')](_0x28896d);}})[_0x6e5b('0x21')](function(_0x3033c6){if(_0x3033c6){return _0x3033c6?{'count':_0x116d6d,'rows':_0x3033c6}:null;}})['then'](respondWithResult(_0x1dc9c0,null))[_0x6e5b('0x3d')](handleError(_0x1dc9c0,null));};exports[_0x6e5b('0x4a')]=function(_0x5d3cd0,_0x1c3e8e,_0x1323bf){if(_0x5d3cd0[_0x6e5b('0x41')]['id']){delete _0x5d3cd0[_0x6e5b('0x41')]['id'];}return db[_0x6e5b('0x27')][_0x6e5b('0x46')]({'where':{'id':_0x5d3cd0['params']['id']}})['then'](handleEntityNotFound(_0x1c3e8e,null))[_0x6e5b('0x21')](function(_0x3a324c){if(_0x3a324c){return _0x3a324c[_0x6e5b('0x4a')](_0x5d3cd0['body']['ids']||[]);}return null;})[_0x6e5b('0x21')](respondWithResult(_0x1c3e8e,null))[_0x6e5b('0x3d')](handleError(_0x1c3e8e,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index d112d73..3e24178 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 _0x34b7=['request-promise','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','../../config/logger','api','moment','bluebird'];(function(_0x2fad8a,_0x26de69){var _0x494d7d=function(_0x52fe59){while(--_0x52fe59){_0x2fad8a['push'](_0x2fad8a['shift']());}};_0x494d7d(++_0x26de69);}(_0x34b7,0x196));var _0x734b=function(_0x2b51c2,_0x401991){_0x2b51c2=_0x2b51c2-0x0;var _0x234ecd=_0x34b7[_0x2b51c2];return _0x234ecd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x734b('0x0'))(_0x734b('0x1'));var moment=require(_0x734b('0x2'));var BPromise=require(_0x734b('0x3'));var rp=require(_0x734b('0x4'));var fs=require('fs');var path=require(_0x734b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x734b('0x6'));module[_0x734b('0x7')]=function(_0x2f3128,_0x34fd70){return _0x2f3128[_0x734b('0x8')](_0x734b('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x065e=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x2e47a7,_0x48d263){var _0x171e31=function(_0x3af3a3){while(--_0x3af3a3){_0x2e47a7['push'](_0x2e47a7['shift']());}};_0x171e31(++_0x48d263);}(_0x065e,0x1a7));var _0xe065=function(_0x1383b9,_0xf06f84){_0x1383b9=_0x1383b9-0x0;var _0x4a3862=_0x065e[_0x1383b9];return _0x4a3862;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('ZendeskConfiguration',attributes,{'tableName':_0xe065('0x7'),'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 011f1b2..9332434 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 _0x1d8c=['../../config/logger','../../config/environment','client','http','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x1a5227,_0x300d98){var _0x2bf089=function(_0x53ed88){while(--_0x53ed88){_0x1a5227['push'](_0x1a5227['shift']());}};_0x2bf089(++_0x300d98);}(_0x1d8c,0x12b));var _0xc1d8=function(_0x942272,_0x3c182f){_0x942272=_0x942272-0x0;var _0x3c748d=_0x1d8c[_0x942272];return _0x3c748d;};'use strict';var _=require(_0xc1d8('0x0'));var util=require(_0xc1d8('0x1'));var moment=require('moment');var BPromise=require(_0xc1d8('0x2'));var rs=require(_0xc1d8('0x3'));var fs=require('fs');var Redis=require(_0xc1d8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc1d8('0x5'))('rpc');var config=require(_0xc1d8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc1d8('0x7')][_0xc1d8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc41ac8,_0x3764f8,_0x46334a){return new BPromise(function(_0x3e3fa7,_0x519a07){return client['request'](_0xc41ac8,_0x46334a)[_0xc1d8('0x9')](function(_0x2201d5){logger[_0xc1d8('0xa')](_0xc1d8('0xb'),_0x3764f8,_0xc1d8('0xc'));logger[_0xc1d8('0xd')](_0xc1d8('0xe'),_0x3764f8,_0xc1d8('0xc'),JSON['stringify'](_0x2201d5));if(_0x2201d5[_0xc1d8('0xf')]){if(_0x2201d5[_0xc1d8('0xf')][_0xc1d8('0x10')]===0x1f4){logger[_0xc1d8('0xf')](_0xc1d8('0xb'),_0x3764f8,_0x2201d5['error'][_0xc1d8('0x11')]);return _0x519a07(_0x2201d5[_0xc1d8('0xf')][_0xc1d8('0x11')]);}logger[_0xc1d8('0xf')](_0xc1d8('0xb'),_0x3764f8,_0x2201d5[_0xc1d8('0xf')][_0xc1d8('0x11')]);return _0x3e3fa7(_0x2201d5[_0xc1d8('0xf')][_0xc1d8('0x11')]);}else{logger[_0xc1d8('0xa')](_0xc1d8('0xb'),_0x3764f8,_0xc1d8('0xc'));_0x3e3fa7(_0x2201d5[_0xc1d8('0x12')][_0xc1d8('0x11')]);}})['catch'](function(_0x359031){logger[_0xc1d8('0xf')](_0xc1d8('0xb'),_0x3764f8,_0x359031);_0x519a07(_0x359031);});});} \ No newline at end of file +var _0x5571=['request\x20sent','stringify','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x4c0998,_0x165050){var _0x1110e2=function(_0x7cb8c3){while(--_0x7cb8c3){_0x4c0998['push'](_0x4c0998['shift']());}};_0x1110e2(++_0x165050);}(_0x5571,0x182));var _0x1557=function(_0x332a78,_0x4d38b3){_0x332a78=_0x332a78-0x0;var _0x537ac5=_0x5571[_0x332a78];return _0x537ac5;};'use strict';var _=require(_0x1557('0x0'));var util=require('util');var moment=require(_0x1557('0x1'));var BPromise=require(_0x1557('0x2'));var rs=require(_0x1557('0x3'));var fs=require('fs');var Redis=require(_0x1557('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1557('0x5'));var logger=require(_0x1557('0x6'))(_0x1557('0x7'));var config=require(_0x1557('0x8'));var jayson=require(_0x1557('0x9'));var client=jayson[_0x1557('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51d4c9,_0x3b8db8,_0x14587f){return new BPromise(function(_0x13e087,_0xb5cc85){return client[_0x1557('0xb')](_0x51d4c9,_0x14587f)[_0x1557('0xc')](function(_0x22a09b){logger['info'](_0x1557('0xd'),_0x3b8db8,'request\x20sent');logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3b8db8,_0x1557('0xe'),JSON[_0x1557('0xf')](_0x22a09b));if(_0x22a09b[_0x1557('0x10')]){if(_0x22a09b[_0x1557('0x10')][_0x1557('0x11')]===0x1f4){logger['error'](_0x1557('0xd'),_0x3b8db8,_0x22a09b[_0x1557('0x10')][_0x1557('0x12')]);return _0xb5cc85(_0x22a09b[_0x1557('0x10')]['message']);}logger['error'](_0x1557('0xd'),_0x3b8db8,_0x22a09b[_0x1557('0x10')][_0x1557('0x12')]);return _0x13e087(_0x22a09b[_0x1557('0x10')]['message']);}else{logger[_0x1557('0x13')](_0x1557('0xd'),_0x3b8db8,_0x1557('0xe'));_0x13e087(_0x22a09b['result']['message']);}})['catch'](function(_0x507945){logger[_0x1557('0x10')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3b8db8,_0x507945);_0xb5cc85(_0x507945);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 7e85951..83c9c02 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 _0x47f4=['update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create'];(function(_0x1080db,_0x29f019){var _0x5516c4=function(_0x12fa81){while(--_0x12fa81){_0x1080db['push'](_0x1080db['shift']());}};_0x5516c4(++_0x29f019);}(_0x47f4,0xed));var _0x447f=function(_0x461a87,_0x1f9756){_0x461a87=_0x461a87-0x0;var _0x4be025=_0x47f4[_0x461a87];return _0x4be025;};'use strict';var multer=require(_0x447f('0x0'));var util=require(_0x447f('0x1'));var path=require(_0x447f('0x2'));var timeout=require(_0x447f('0x3'));var express=require('express');var router=express[_0x447f('0x4')]();var fs_extra=require(_0x447f('0x5'));var auth=require(_0x447f('0x6'));var interaction=require(_0x447f('0x7'));var config=require(_0x447f('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x447f('0x9')](),controller[_0x447f('0xa')]);router[_0x447f('0xb')](_0x447f('0xc'),auth[_0x447f('0x9')](),controller['show']);router[_0x447f('0xd')]('/',auth[_0x447f('0x9')](),controller[_0x447f('0xe')]);router['put'](_0x447f('0xc'),auth['isAuthenticated'](),controller[_0x447f('0xf')]);router[_0x447f('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x447f('0x11')]=router; \ No newline at end of file +var _0x1391=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2d2155,_0x41b4e4){var _0x1c92b8=function(_0x47c689){while(--_0x47c689){_0x2d2155['push'](_0x2d2155['shift']());}};_0x1c92b8(++_0x41b4e4);}(_0x1391,0x16e));var _0x1139=function(_0x487b0c,_0x14ff74){_0x487b0c=_0x487b0c-0x0;var _0x1adbdc=_0x1391[_0x487b0c];return _0x1adbdc;};'use strict';var multer=require(_0x1139('0x0'));var util=require(_0x1139('0x1'));var path=require(_0x1139('0x2'));var timeout=require(_0x1139('0x3'));var express=require('express');var router=express[_0x1139('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1139('0x5'));var interaction=require(_0x1139('0x6'));var config=require(_0x1139('0x7'));var controller=require(_0x1139('0x8'));router[_0x1139('0x9')]('/',auth[_0x1139('0xa')](),controller[_0x1139('0xb')]);router[_0x1139('0x9')](_0x1139('0xc'),auth['isAuthenticated'](),controller[_0x1139('0xd')]);router['post']('/',auth[_0x1139('0xa')](),controller[_0x1139('0xe')]);router[_0x1139('0xf')]('/:id',auth[_0x1139('0xa')](),controller[_0x1139('0x10')]);router[_0x1139('0x11')](_0x1139('0xc'),auth[_0x1139('0xa')](),controller[_0x1139('0x12')]);module[_0x1139('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index dd41469..b241d08 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 _0x48e9=['exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN','sequelize'];(function(_0x539b71,_0x4daf0b){var _0x3d1a59=function(_0x1a59ed){while(--_0x1a59ed){_0x539b71['push'](_0x539b71['shift']());}};_0x3d1a59(++_0x4daf0b);}(_0x48e9,0x9f));var _0x948e=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x48e9[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x948e('0x0'));module[_0x948e('0x1')]={'type':{'type':Sequelize['ENUM'](_0x948e('0x2'),'variable',_0x948e('0x3'),_0x948e('0x4'),_0x948e('0x5')),'defaultValue':_0x948e('0x2')},'content':{'type':Sequelize[_0x948e('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x948e('0x7')]('string',_0x948e('0x8'),_0x948e('0x3'))},'keyContent':{'type':Sequelize[_0x948e('0x6')]},'idField':{'type':Sequelize[_0x948e('0x6')]},'nameField':{'type':Sequelize[_0x948e('0x6')]},'customField':{'type':Sequelize[_0x948e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdfa8=['exports','ENUM','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x46977e,_0x2c4bc7){var _0x3ba9f0=function(_0x9bb2aa){while(--_0x9bb2aa){_0x46977e['push'](_0x46977e['shift']());}};_0x3ba9f0(++_0x2c4bc7);}(_0xdfa8,0x68));var _0x8dfa=function(_0x1e3912,_0x3a7f14){_0x1e3912=_0x1e3912-0x0;var _0xe57487=_0xdfa8[_0x1e3912];return _0xe57487;};'use strict';var Sequelize=require('sequelize');module[_0x8dfa('0x0')]={'type':{'type':Sequelize[_0x8dfa('0x1')]('string','variable',_0x8dfa('0x2'),_0x8dfa('0x3'),_0x8dfa('0x4')),'defaultValue':_0x8dfa('0x5')},'content':{'type':Sequelize[_0x8dfa('0x6')]},'key':{'type':Sequelize[_0x8dfa('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x8dfa('0x5'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8dfa('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8dfa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8dfa('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d097540..18b457a 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 _0x3d53=['lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','options','includeAll','rows','catch','keys','find','create','body','update','destroy','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x1ef5bb,_0x1f6f91){var _0x1083eb=function(_0x3c8975){while(--_0x3c8975){_0x1ef5bb['push'](_0x1ef5bb['shift']());}};_0x1083eb(++_0x1f6f91);}(_0x3d53,0xc9));var _0x33d5=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0x3d53[_0xec034];return _0x2c5a19;};'use strict';var emlformat=require(_0x33d5('0x0'));var rimraf=require(_0x33d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x33d5('0x2'));var moment=require(_0x33d5('0x3'));var BPromise=require(_0x33d5('0x4'));var Mustache=require(_0x33d5('0x5'));var util=require(_0x33d5('0x6'));var path=require(_0x33d5('0x7'));var sox=require(_0x33d5('0x8'));var csv=require(_0x33d5('0x9'));var ejs=require(_0x33d5('0xa'));var fs=require('fs');var fs_extra=require(_0x33d5('0xb'));var _=require(_0x33d5('0xc'));var squel=require(_0x33d5('0xd'));var crypto=require(_0x33d5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x33d5('0xf'));var toCsv=require(_0x33d5('0x9'));var querystring=require(_0x33d5('0x10'));var Papa=require(_0x33d5('0x11'));var Redis=require(_0x33d5('0x12'));var authService=require(_0x33d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x33d5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x33d5('0x15'));var db=require(_0x33d5('0x16'))['db'];function respondWithStatusCode(_0x328dac,_0x3f489c){_0x3f489c=_0x3f489c||0xcc;return function(_0x15489c){if(_0x15489c){return _0x328dac[_0x33d5('0x17')](_0x3f489c);}return _0x328dac[_0x33d5('0x18')](_0x3f489c)[_0x33d5('0x19')]();};}function respondWithResult(_0x3f62e0,_0x4e3b83){_0x4e3b83=_0x4e3b83||0xc8;return function(_0x213b5b){if(_0x213b5b){return _0x3f62e0[_0x33d5('0x18')](_0x4e3b83)[_0x33d5('0x1a')](_0x213b5b);}};}function respondWithFilteredResult(_0x5c550a,_0x3c9b0c){return function(_0x354f0b){if(_0x354f0b){var _0x488a3c=typeof _0x3c9b0c['offset']===_0x33d5('0x1b')&&typeof _0x3c9b0c[_0x33d5('0x1c')]===_0x33d5('0x1b');var _0x6559de=_0x354f0b[_0x33d5('0x1d')];var _0x67f3f4=_0x488a3c?0x0:_0x3c9b0c['offset'];var _0x2af5bc=_0x488a3c?_0x354f0b[_0x33d5('0x1d')]:_0x3c9b0c[_0x33d5('0x1e')]+_0x3c9b0c[_0x33d5('0x1c')];var _0x2918c1;if(_0x2af5bc>=_0x6559de){_0x2af5bc=_0x6559de;_0x2918c1=0xc8;}else{_0x2918c1=0xce;}_0x5c550a[_0x33d5('0x18')](_0x2918c1);return _0x5c550a[_0x33d5('0x1f')](_0x33d5('0x20'),_0x67f3f4+'-'+_0x2af5bc+'/'+_0x6559de)[_0x33d5('0x1a')](_0x354f0b);}return null;};}function patchUpdates(_0x56562c){return function(_0x8fe4ab){try{jsonpatch[_0x33d5('0x21')](_0x8fe4ab,_0x56562c,!![]);}catch(_0x2072cf){return BPromise['reject'](_0x2072cf);}return _0x8fe4ab[_0x33d5('0x22')]();};}function saveUpdates(_0x558245,_0x59d564){return function(_0x42f1e5){if(_0x42f1e5){return _0x42f1e5['update'](_0x558245)[_0x33d5('0x23')](function(_0x13736e){return _0x13736e;});}return null;};}function removeEntity(_0x16c848,_0xa040a0){return function(_0x56fe24){if(_0x56fe24){return _0x56fe24['destroy']()[_0x33d5('0x23')](function(){_0x16c848[_0x33d5('0x18')](0xcc)[_0x33d5('0x19')]();});}};}function handleEntityNotFound(_0x247df9,_0x2de52a){return function(_0x572714){if(!_0x572714){_0x247df9[_0x33d5('0x17')](0x194);}return _0x572714;};}function handleError(_0x55b7f1,_0x3840a2){_0x3840a2=_0x3840a2||0x1f4;return function(_0x479a4c){logger['error'](_0x479a4c[_0x33d5('0x24')]);if(_0x479a4c[_0x33d5('0x25')]){delete _0x479a4c['name'];}_0x55b7f1[_0x33d5('0x18')](_0x3840a2)[_0x33d5('0x26')](_0x479a4c);};}exports[_0x33d5('0x27')]=function(_0x2769cf,_0x1df1b8){var _0x2ab1b6={},_0x33c033={},_0x12b82f={'count':0x0,'rows':[]};var _0xf0411c=_[_0x33d5('0x28')](db[_0x33d5('0x29')][_0x33d5('0x2a')],function(_0x25606a){return{'name':_0x25606a[_0x33d5('0x2b')],'type':_0x25606a[_0x33d5('0x2c')][_0x33d5('0x2d')]};});_0x33c033[_0x33d5('0x2e')]=_[_0x33d5('0x28')](_0xf0411c,_0x33d5('0x25'));_0x33c033[_0x33d5('0x2f')]=_['keys'](_0x2769cf[_0x33d5('0x2f')]);_0x33c033[_0x33d5('0x30')]=_[_0x33d5('0x31')](_0x33c033[_0x33d5('0x2e')],_0x33c033[_0x33d5('0x2f')]);_0x2ab1b6[_0x33d5('0x32')]=_[_0x33d5('0x31')](_0x33c033[_0x33d5('0x2e')],qs[_0x33d5('0x33')](_0x2769cf['query'][_0x33d5('0x33')]));_0x2ab1b6[_0x33d5('0x32')]=_0x2ab1b6[_0x33d5('0x32')][_0x33d5('0x34')]?_0x2ab1b6[_0x33d5('0x32')]:_0x33c033[_0x33d5('0x2e')];if(!_0x2769cf[_0x33d5('0x2f')][_0x33d5('0x35')]('nolimit')){_0x2ab1b6[_0x33d5('0x1c')]=qs[_0x33d5('0x1c')](_0x2769cf[_0x33d5('0x2f')]['limit']);_0x2ab1b6[_0x33d5('0x1e')]=qs[_0x33d5('0x1e')](_0x2769cf[_0x33d5('0x2f')]['offset']);}_0x2ab1b6[_0x33d5('0x36')]=qs['sort'](_0x2769cf[_0x33d5('0x2f')][_0x33d5('0x37')]);_0x2ab1b6[_0x33d5('0x38')]=qs[_0x33d5('0x30')](_[_0x33d5('0x39')](_0x2769cf[_0x33d5('0x2f')],_0x33c033[_0x33d5('0x30')]),_0xf0411c);if(_0x2769cf[_0x33d5('0x2f')][_0x33d5('0x3a')]){_0x2ab1b6[_0x33d5('0x38')]=_['merge'](_0x2ab1b6[_0x33d5('0x38')],{'$or':_['map'](_0xf0411c,function(_0x5bde5b){if(_0x5bde5b['type']!==_0x33d5('0x3b')){var _0x2617cf={};_0x2617cf[_0x5bde5b[_0x33d5('0x25')]]={'$like':'%'+_0x2769cf[_0x33d5('0x2f')][_0x33d5('0x3a')]+'%'};return _0x2617cf;}})});}_0x2ab1b6=_['merge']({},_0x2ab1b6,_0x2769cf[_0x33d5('0x3c')]);var _0x234b9c={'where':_0x2ab1b6[_0x33d5('0x38')]};return db['ZendeskField'][_0x33d5('0x1d')](_0x234b9c)['then'](function(_0x51d486){_0x12b82f['count']=_0x51d486;if(_0x2769cf[_0x33d5('0x2f')][_0x33d5('0x3d')]){_0x2ab1b6['include']=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x2ab1b6);})[_0x33d5('0x23')](function(_0x18d192){_0x12b82f[_0x33d5('0x3e')]=_0x18d192;return _0x12b82f;})['then'](respondWithFilteredResult(_0x1df1b8,_0x2ab1b6))[_0x33d5('0x3f')](handleError(_0x1df1b8,null));};exports['show']=function(_0x399680,_0x7ee153){var _0x39a17e={'raw':!![],'where':{'id':_0x399680['params']['id']}},_0x3572b4={};_0x3572b4[_0x33d5('0x2e')]=_[_0x33d5('0x40')](db[_0x33d5('0x29')][_0x33d5('0x2a')]);_0x3572b4[_0x33d5('0x2f')]=_[_0x33d5('0x40')](_0x399680['query']);_0x3572b4[_0x33d5('0x30')]=_[_0x33d5('0x31')](_0x3572b4['model'],_0x3572b4[_0x33d5('0x2f')]);_0x39a17e[_0x33d5('0x32')]=_[_0x33d5('0x31')](_0x3572b4[_0x33d5('0x2e')],qs[_0x33d5('0x33')](_0x399680[_0x33d5('0x2f')][_0x33d5('0x33')]));_0x39a17e['attributes']=_0x39a17e[_0x33d5('0x32')]['length']?_0x39a17e[_0x33d5('0x32')]:_0x3572b4[_0x33d5('0x2e')];if(_0x399680['query'][_0x33d5('0x3d')]){_0x39a17e['include']=[{'all':!![]}];}_0x39a17e=_['merge']({},_0x39a17e,_0x399680[_0x33d5('0x3c')]);return db['ZendeskField'][_0x33d5('0x41')](_0x39a17e)[_0x33d5('0x23')](handleEntityNotFound(_0x7ee153,null))['then'](respondWithResult(_0x7ee153,null))[_0x33d5('0x3f')](handleError(_0x7ee153,null));};exports[_0x33d5('0x42')]=function(_0x3b96ab,_0x4f6d70){return db[_0x33d5('0x29')][_0x33d5('0x42')](_0x3b96ab[_0x33d5('0x43')],{})[_0x33d5('0x23')](respondWithResult(_0x4f6d70,0xc9))[_0x33d5('0x3f')](handleError(_0x4f6d70,null));};exports[_0x33d5('0x44')]=function(_0xbb6f96,_0x2c3fdc){if(_0xbb6f96[_0x33d5('0x43')]['id']){delete _0xbb6f96[_0x33d5('0x43')]['id'];}return db['ZendeskField'][_0x33d5('0x41')]({'where':{'id':_0xbb6f96['params']['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x2c3fdc,null))['then'](saveUpdates(_0xbb6f96[_0x33d5('0x43')],null))[_0x33d5('0x23')](respondWithResult(_0x2c3fdc,null))[_0x33d5('0x3f')](handleError(_0x2c3fdc,null));};exports[_0x33d5('0x45')]=function(_0x393a89,_0x3682a3){return db[_0x33d5('0x29')][_0x33d5('0x41')]({'where':{'id':_0x393a89[_0x33d5('0x46')]['id']}})[_0x33d5('0x23')](handleEntityNotFound(_0x3682a3,null))[_0x33d5('0x23')](removeEntity(_0x3682a3,null))[_0x33d5('0x3f')](handleError(_0x3682a3,null));}; \ No newline at end of file +var _0x5ff8=['intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskField','includeAll','rows','catch','length','include','create','body','find','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5ff8,0x13e));var _0x85ff=function(_0x2c8e46,_0x39b89b){_0x2c8e46=_0x2c8e46-0x0;var _0xf94a29=_0x5ff8[_0x2c8e46];return _0xf94a29;};'use strict';var emlformat=require(_0x85ff('0x0'));var rimraf=require(_0x85ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x85ff('0x2'));var moment=require(_0x85ff('0x3'));var BPromise=require(_0x85ff('0x4'));var Mustache=require(_0x85ff('0x5'));var util=require('util');var path=require(_0x85ff('0x6'));var sox=require(_0x85ff('0x7'));var csv=require('to-csv');var ejs=require(_0x85ff('0x8'));var fs=require('fs');var fs_extra=require(_0x85ff('0x9'));var _=require(_0x85ff('0xa'));var squel=require('squel');var crypto=require(_0x85ff('0xb'));var jsforce=require(_0x85ff('0xc'));var deskjs=require(_0x85ff('0xd'));var toCsv=require(_0x85ff('0xe'));var querystring=require(_0x85ff('0xf'));var Papa=require('papaparse');var Redis=require(_0x85ff('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x85ff('0x11'));var as=require(_0x85ff('0x12'));var hardwareService=require(_0x85ff('0x13'));var logger=require('../../config/logger')(_0x85ff('0x14'));var utils=require(_0x85ff('0x15'));var config=require(_0x85ff('0x16'));var licenseUtil=require(_0x85ff('0x17'));var db=require(_0x85ff('0x18'))['db'];function respondWithStatusCode(_0x5c796c,_0x33e1f9){_0x33e1f9=_0x33e1f9||0xcc;return function(_0x201149){if(_0x201149){return _0x5c796c[_0x85ff('0x19')](_0x33e1f9);}return _0x5c796c['status'](_0x33e1f9)[_0x85ff('0x1a')]();};}function respondWithResult(_0x5249b6,_0x564f23){_0x564f23=_0x564f23||0xc8;return function(_0x47e108){if(_0x47e108){return _0x5249b6[_0x85ff('0x1b')](_0x564f23)[_0x85ff('0x1c')](_0x47e108);}};}function respondWithFilteredResult(_0x221cb9,_0x46c064){return function(_0xafc2af){if(_0xafc2af){var _0x5d3900=typeof _0x46c064[_0x85ff('0x1d')]===_0x85ff('0x1e')&&typeof _0x46c064[_0x85ff('0x1f')]===_0x85ff('0x1e');var _0x5807c=_0xafc2af[_0x85ff('0x20')];var _0xa60d95=_0x5d3900?0x0:_0x46c064[_0x85ff('0x1d')];var _0x531baa=_0x5d3900?_0xafc2af['count']:_0x46c064[_0x85ff('0x1d')]+_0x46c064[_0x85ff('0x1f')];var _0x43ef80;if(_0x531baa>=_0x5807c){_0x531baa=_0x5807c;_0x43ef80=0xc8;}else{_0x43ef80=0xce;}_0x221cb9['status'](_0x43ef80);return _0x221cb9[_0x85ff('0x21')]('Content-Range',_0xa60d95+'-'+_0x531baa+'/'+_0x5807c)[_0x85ff('0x1c')](_0xafc2af);}return null;};}function patchUpdates(_0x113de6){return function(_0x160ff5){try{jsonpatch['apply'](_0x160ff5,_0x113de6,!![]);}catch(_0x24b76a){return BPromise['reject'](_0x24b76a);}return _0x160ff5[_0x85ff('0x22')]();};}function saveUpdates(_0x2d99f3,_0x5b51cb){return function(_0x206f70){if(_0x206f70){return _0x206f70[_0x85ff('0x23')](_0x2d99f3)['then'](function(_0x29e360){return _0x29e360;});}return null;};}function removeEntity(_0x53a10b,_0x2de4a1){return function(_0xfb7d5f){if(_0xfb7d5f){return _0xfb7d5f[_0x85ff('0x24')]()[_0x85ff('0x25')](function(){_0x53a10b[_0x85ff('0x1b')](0xcc)[_0x85ff('0x1a')]();});}};}function handleEntityNotFound(_0x598d7e,_0x8cbd97){return function(_0x19e5a3){if(!_0x19e5a3){_0x598d7e['sendStatus'](0x194);}return _0x19e5a3;};}function handleError(_0x1123f5,_0x520231){_0x520231=_0x520231||0x1f4;return function(_0x342792){logger[_0x85ff('0x26')](_0x342792[_0x85ff('0x27')]);if(_0x342792[_0x85ff('0x28')]){delete _0x342792[_0x85ff('0x28')];}_0x1123f5[_0x85ff('0x1b')](_0x520231)[_0x85ff('0x29')](_0x342792);};}exports[_0x85ff('0x2a')]=function(_0x3bad69,_0x2f92d0){var _0x22bde5={},_0x1147f0={},_0x4a08b7={'count':0x0,'rows':[]};var _0x395eed=_['map'](db['ZendeskField'][_0x85ff('0x2b')],function(_0xe6445f){return{'name':_0xe6445f[_0x85ff('0x2c')],'type':_0xe6445f[_0x85ff('0x2d')][_0x85ff('0x2e')]};});_0x1147f0[_0x85ff('0x2f')]=_[_0x85ff('0x30')](_0x395eed,'name');_0x1147f0[_0x85ff('0x31')]=_[_0x85ff('0x32')](_0x3bad69[_0x85ff('0x31')]);_0x1147f0[_0x85ff('0x33')]=_[_0x85ff('0x34')](_0x1147f0[_0x85ff('0x2f')],_0x1147f0[_0x85ff('0x31')]);_0x22bde5['attributes']=_['intersection'](_0x1147f0[_0x85ff('0x2f')],qs[_0x85ff('0x35')](_0x3bad69[_0x85ff('0x31')][_0x85ff('0x35')]));_0x22bde5[_0x85ff('0x36')]=_0x22bde5[_0x85ff('0x36')]['length']?_0x22bde5['attributes']:_0x1147f0[_0x85ff('0x2f')];if(!_0x3bad69[_0x85ff('0x31')]['hasOwnProperty'](_0x85ff('0x37'))){_0x22bde5[_0x85ff('0x1f')]=qs[_0x85ff('0x1f')](_0x3bad69[_0x85ff('0x31')]['limit']);_0x22bde5['offset']=qs[_0x85ff('0x1d')](_0x3bad69[_0x85ff('0x31')]['offset']);}_0x22bde5[_0x85ff('0x38')]=qs[_0x85ff('0x39')](_0x3bad69['query'][_0x85ff('0x39')]);_0x22bde5[_0x85ff('0x3a')]=qs['filters'](_[_0x85ff('0x3b')](_0x3bad69[_0x85ff('0x31')],_0x1147f0[_0x85ff('0x33')]),_0x395eed);if(_0x3bad69[_0x85ff('0x31')][_0x85ff('0x3c')]){_0x22bde5['where']=_[_0x85ff('0x3d')](_0x22bde5['where'],{'$or':_[_0x85ff('0x30')](_0x395eed,function(_0x322477){if(_0x322477['type']!==_0x85ff('0x3e')){var _0x489688={};_0x489688[_0x322477['name']]={'$like':'%'+_0x3bad69[_0x85ff('0x31')][_0x85ff('0x3c')]+'%'};return _0x489688;}})});}_0x22bde5=_['merge']({},_0x22bde5,_0x3bad69[_0x85ff('0x3f')]);var _0x326edc={'where':_0x22bde5[_0x85ff('0x3a')]};return db[_0x85ff('0x40')][_0x85ff('0x20')](_0x326edc)[_0x85ff('0x25')](function(_0x2db609){_0x4a08b7[_0x85ff('0x20')]=_0x2db609;if(_0x3bad69[_0x85ff('0x31')][_0x85ff('0x41')]){_0x22bde5['include']=[{'all':!![]}];}return db[_0x85ff('0x40')]['findAll'](_0x22bde5);})[_0x85ff('0x25')](function(_0x247d04){_0x4a08b7[_0x85ff('0x42')]=_0x247d04;return _0x4a08b7;})['then'](respondWithFilteredResult(_0x2f92d0,_0x22bde5))[_0x85ff('0x43')](handleError(_0x2f92d0,null));};exports['show']=function(_0xdc8ad6,_0x3729b8){var _0x4dd283={'raw':!![],'where':{'id':_0xdc8ad6['params']['id']}},_0x2c8146={};_0x2c8146['model']=_['keys'](db[_0x85ff('0x40')][_0x85ff('0x2b')]);_0x2c8146['query']=_['keys'](_0xdc8ad6[_0x85ff('0x31')]);_0x2c8146[_0x85ff('0x33')]=_[_0x85ff('0x34')](_0x2c8146[_0x85ff('0x2f')],_0x2c8146[_0x85ff('0x31')]);_0x4dd283['attributes']=_[_0x85ff('0x34')](_0x2c8146[_0x85ff('0x2f')],qs['fields'](_0xdc8ad6['query'][_0x85ff('0x35')]));_0x4dd283[_0x85ff('0x36')]=_0x4dd283[_0x85ff('0x36')][_0x85ff('0x44')]?_0x4dd283[_0x85ff('0x36')]:_0x2c8146[_0x85ff('0x2f')];if(_0xdc8ad6[_0x85ff('0x31')]['includeAll']){_0x4dd283[_0x85ff('0x45')]=[{'all':!![]}];}_0x4dd283=_[_0x85ff('0x3d')]({},_0x4dd283,_0xdc8ad6[_0x85ff('0x3f')]);return db[_0x85ff('0x40')]['find'](_0x4dd283)[_0x85ff('0x25')](handleEntityNotFound(_0x3729b8,null))[_0x85ff('0x25')](respondWithResult(_0x3729b8,null))[_0x85ff('0x43')](handleError(_0x3729b8,null));};exports[_0x85ff('0x46')]=function(_0x4655d0,_0x5eca46){return db[_0x85ff('0x40')]['create'](_0x4655d0[_0x85ff('0x47')],{})['then'](respondWithResult(_0x5eca46,0xc9))[_0x85ff('0x43')](handleError(_0x5eca46,null));};exports[_0x85ff('0x23')]=function(_0x53e092,_0x112eec){if(_0x53e092[_0x85ff('0x47')]['id']){delete _0x53e092[_0x85ff('0x47')]['id'];}return db[_0x85ff('0x40')][_0x85ff('0x48')]({'where':{'id':_0x53e092[_0x85ff('0x49')]['id']}})[_0x85ff('0x25')](handleEntityNotFound(_0x112eec,null))[_0x85ff('0x25')](saveUpdates(_0x53e092[_0x85ff('0x47')],null))[_0x85ff('0x25')](respondWithResult(_0x112eec,null))[_0x85ff('0x43')](handleError(_0x112eec,null));};exports[_0x85ff('0x24')]=function(_0x5ee489,_0x42d5b7){return db[_0x85ff('0x40')][_0x85ff('0x48')]({'where':{'id':_0x5ee489['params']['id']}})[_0x85ff('0x25')](handleEntityNotFound(_0x42d5b7,null))[_0x85ff('0x25')](removeEntity(_0x42d5b7,null))[_0x85ff('0x43')](handleError(_0x42d5b7,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 13e5376..9f1ff14 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 _0xe912=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe912,0x192));var _0x2e91=function(_0x324dbb,_0x4b2c6d){_0x324dbb=_0x324dbb-0x0;var _0x581d8a=_0xe912[_0x324dbb];return _0x581d8a;};'use strict';var _=require(_0x2e91('0x0'));var util=require(_0x2e91('0x1'));var logger=require(_0x2e91('0x2'))(_0x2e91('0x3'));var moment=require('moment');var BPromise=require(_0x2e91('0x4'));var rp=require(_0x2e91('0x5'));var fs=require('fs');var path=require(_0x2e91('0x6'));var rimraf=require(_0x2e91('0x7'));var config=require(_0x2e91('0x8'));var attributes=require(_0x2e91('0x9'));module[_0x2e91('0xa')]=function(_0x2b44da,_0xb505cd){return _0x2b44da['define']('ZendeskField',attributes,{'tableName':_0x2e91('0xb'),'paranoid':![],'indexes':[{'name':_0x2e91('0xc'),'fields':[_0x2e91('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ad4=['int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define','ZendeskField'];(function(_0x389adb,_0x166f1c){var _0x59768e=function(_0x24f76e){while(--_0x24f76e){_0x389adb['push'](_0x389adb['shift']());}};_0x59768e(++_0x166f1c);}(_0x3ad4,0x12a));var _0x43ad=function(_0x52121d,_0x1d1704){_0x52121d=_0x52121d-0x0;var _0x448627=_0x3ad4[_0x52121d];return _0x448627;};'use strict';var _=require(_0x43ad('0x0'));var util=require(_0x43ad('0x1'));var logger=require(_0x43ad('0x2'))('api');var moment=require(_0x43ad('0x3'));var BPromise=require(_0x43ad('0x4'));var rp=require(_0x43ad('0x5'));var fs=require('fs');var path=require(_0x43ad('0x6'));var rimraf=require('rimraf');var config=require(_0x43ad('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x1ebefe,_0x34dc24){return _0x1ebefe[_0x43ad('0x8')](_0x43ad('0x9'),attributes,{'tableName':_0x43ad('0xa'),'paranoid':![],'indexes':[{'name':_0x43ad('0xb'),'fields':[_0x43ad('0xc'),_0x43ad('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 77f984d..c04834a 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 _0xd3bc=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x5045d5,_0x20ff68){var _0x2d7189=function(_0x42bb02){while(--_0x42bb02){_0x5045d5['push'](_0x5045d5['shift']());}};_0x2d7189(++_0x20ff68);}(_0xd3bc,0x6b));var _0xcd3b=function(_0x3e6664,_0x2e755){_0x3e6664=_0x3e6664-0x0;var _0x2f6ebc=_0xd3bc[_0x3e6664];return _0x2f6ebc;};'use strict';var _=require(_0xcd3b('0x0'));var util=require(_0xcd3b('0x1'));var moment=require(_0xcd3b('0x2'));var BPromise=require(_0xcd3b('0x3'));var rs=require(_0xcd3b('0x4'));var fs=require('fs');var Redis=require(_0xcd3b('0x5'));var db=require(_0xcd3b('0x6'))['db'];var utils=require(_0xcd3b('0x7'));var logger=require('../../config/logger')(_0xcd3b('0x8'));var config=require(_0xcd3b('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f9475,_0xe33958,_0x528026){return new BPromise(function(_0x455db3,_0xdb191d){return client['request'](_0x1f9475,_0x528026)[_0xcd3b('0xa')](function(_0x17d705){logger[_0xcd3b('0xb')](_0xcd3b('0xc'),_0xe33958,_0xcd3b('0xd'));logger[_0xcd3b('0xe')](_0xcd3b('0xf'),_0xe33958,_0xcd3b('0xd'),JSON[_0xcd3b('0x10')](_0x17d705));if(_0x17d705['error']){if(_0x17d705['error']['code']===0x1f4){logger[_0xcd3b('0x11')]('ZendeskField,\x20%s,\x20%s',_0xe33958,_0x17d705['error']['message']);return _0xdb191d(_0x17d705[_0xcd3b('0x11')][_0xcd3b('0x12')]);}logger[_0xcd3b('0x11')](_0xcd3b('0xc'),_0xe33958,_0x17d705['error'][_0xcd3b('0x12')]);return _0x455db3(_0x17d705['error']['message']);}else{logger[_0xcd3b('0xb')](_0xcd3b('0xc'),_0xe33958,_0xcd3b('0xd'));_0x455db3(_0x17d705[_0xcd3b('0x13')][_0xcd3b('0x12')]);}})[_0xcd3b('0x14')](function(_0x1394f2){logger[_0xcd3b('0x11')](_0xcd3b('0xc'),_0xe33958,_0x1394f2);_0xdb191d(_0x1394f2);});});} \ No newline at end of file +var _0x5ca9=['info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ca9,0x1ac));var _0x95ca=function(_0xd090ca,_0x2b3075){_0xd090ca=_0xd090ca-0x0;var _0x6b276e=_0x5ca9[_0xd090ca];return _0x6b276e;};'use strict';var _=require(_0x95ca('0x0'));var util=require('util');var moment=require(_0x95ca('0x1'));var BPromise=require(_0x95ca('0x2'));var rs=require(_0x95ca('0x3'));var fs=require('fs');var Redis=require(_0x95ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x95ca('0x5'));var logger=require('../../config/logger')(_0x95ca('0x6'));var config=require(_0x95ca('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x95ca('0x8')][_0x95ca('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3902e0,_0x24580c,_0x12bd3c){return new BPromise(function(_0x170b4c,_0x5ee830){return client[_0x95ca('0xa')](_0x3902e0,_0x12bd3c)[_0x95ca('0xb')](function(_0x3b9945){logger[_0x95ca('0xc')](_0x95ca('0xd'),_0x24580c,_0x95ca('0xe'));logger['debug'](_0x95ca('0xf'),_0x24580c,_0x95ca('0xe'),JSON[_0x95ca('0x10')](_0x3b9945));if(_0x3b9945[_0x95ca('0x11')]){if(_0x3b9945[_0x95ca('0x11')][_0x95ca('0x12')]===0x1f4){logger[_0x95ca('0x11')](_0x95ca('0xd'),_0x24580c,_0x3b9945[_0x95ca('0x11')][_0x95ca('0x13')]);return _0x5ee830(_0x3b9945[_0x95ca('0x11')][_0x95ca('0x13')]);}logger[_0x95ca('0x11')]('ZendeskField,\x20%s,\x20%s',_0x24580c,_0x3b9945[_0x95ca('0x11')][_0x95ca('0x13')]);return _0x170b4c(_0x3b9945[_0x95ca('0x11')]['message']);}else{logger['info'](_0x95ca('0xd'),_0x24580c,_0x95ca('0xe'));_0x170b4c(_0x3b9945[_0x95ca('0x14')][_0x95ca('0x13')]);}})[_0x95ca('0x15')](function(_0x597e7c){logger[_0x95ca('0x11')](_0x95ca('0xd'),_0x24580c,_0x597e7c);_0x5ee830(_0x597e7c);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 9b0c72a..86f8989 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 _0x6e1e=['isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','put','update','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intZohoAccount.controller','get'];(function(_0x56327a,_0xc545a0){var _0x175852=function(_0x30a1d2){while(--_0x30a1d2){_0x56327a['push'](_0x56327a['shift']());}};_0x175852(++_0xc545a0);}(_0x6e1e,0x1eb));var _0xe6e1=function(_0x4076ed,_0x4ef74e){_0x4076ed=_0x4076ed-0x0;var _0x57b632=_0x6e1e[_0x4076ed];return _0x57b632;};'use strict';var multer=require(_0xe6e1('0x0'));var util=require(_0xe6e1('0x1'));var path=require(_0xe6e1('0x2'));var timeout=require('connect-timeout');var express=require(_0xe6e1('0x3'));var router=express[_0xe6e1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe6e1('0x5'));var interaction=require(_0xe6e1('0x6'));var config=require('../../config/environment');var controller=require(_0xe6e1('0x7'));router[_0xe6e1('0x8')]('/',auth[_0xe6e1('0x9')](),controller[_0xe6e1('0xa')]);router[_0xe6e1('0x8')](_0xe6e1('0xb'),auth[_0xe6e1('0x9')](),controller[_0xe6e1('0xc')]);router[_0xe6e1('0x8')](_0xe6e1('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xe6e1('0xe'),auth['isAuthenticated'](),controller[_0xe6e1('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe6e1('0xd'),auth[_0xe6e1('0x9')](),controller['addConfiguration']);router[_0xe6e1('0x10')](_0xe6e1('0xb'),auth[_0xe6e1('0x9')](),controller[_0xe6e1('0x11')]);router[_0xe6e1('0x12')]('/:id',auth[_0xe6e1('0x9')](),controller[_0xe6e1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x828a=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','get','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x828a,0x8f));var _0xa828=function(_0x125c1c,_0x5efd2f){_0x125c1c=_0x125c1c-0x0;var _0x5ad05c=_0x828a[_0x125c1c];return _0x5ad05c;};'use strict';var multer=require(_0xa828('0x0'));var util=require('util');var path=require(_0xa828('0x1'));var timeout=require(_0xa828('0x2'));var express=require('express');var router=express[_0xa828('0x3')]();var fs_extra=require(_0xa828('0x4'));var auth=require(_0xa828('0x5'));var interaction=require(_0xa828('0x6'));var config=require(_0xa828('0x7'));var controller=require(_0xa828('0x8'));router['get']('/',auth[_0xa828('0x9')](),controller[_0xa828('0xa')]);router[_0xa828('0xb')]('/:id',auth[_0xa828('0x9')](),controller[_0xa828('0xc')]);router[_0xa828('0xb')](_0xa828('0xd'),auth[_0xa828('0x9')](),controller[_0xa828('0xe')]);router[_0xa828('0xb')](_0xa828('0xf'),auth['isAuthenticated'](),controller[_0xa828('0x10')]);router[_0xa828('0x11')]('/',auth['isAuthenticated'](),controller[_0xa828('0x12')]);router['post'](_0xa828('0xd'),auth[_0xa828('0x9')](),controller[_0xa828('0x13')]);router[_0xa828('0x14')](_0xa828('0x15'),auth[_0xa828('0x9')](),controller[_0xa828('0x16')]);router[_0xa828('0x17')](_0xa828('0x15'),auth['isAuthenticated'](),controller[_0xa828('0x18')]);module[_0xa828('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 88e0c66..010ace3 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 _0xdace=['STRING','sequelize'];(function(_0x1a8a81,_0xd5392a){var _0x39319e=function(_0x171258){while(--_0x171258){_0x1a8a81['push'](_0x1a8a81['shift']());}};_0x39319e(++_0xd5392a);}(_0xdace,0xc5));var _0xedac=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xdace[_0x12a2a6];return _0x1754ae;};'use strict';var Sequelize=require(_0xedac('0x0'));module['exports']={'name':{'type':Sequelize[_0xedac('0x1')]},'description':{'type':Sequelize[_0xedac('0x1')]},'host':{'type':Sequelize[_0xedac('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xedac('0x1')]},'clientSecret':{'type':Sequelize[_0xedac('0x1')]},'serverUrl':{'type':Sequelize[_0xedac('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xedac('0x1')]},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5636=['sequelize','exports','STRING'];(function(_0x145694,_0x5df469){var _0x1e0d17=function(_0x3e8d4a){while(--_0x3e8d4a){_0x145694['push'](_0x145694['shift']());}};_0x1e0d17(++_0x5df469);}(_0x5636,0x102));var _0x6563=function(_0x297a2d,_0x216d7d){_0x297a2d=_0x297a2d-0x0;var _0xbc4018=_0x5636[_0x297a2d];return _0xbc4018;};'use strict';var Sequelize=require(_0x6563('0x0'));module[_0x6563('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x6563('0x2')]},'clientId':{'type':Sequelize[_0x6563('0x2')]},'clientSecret':{'type':Sequelize[_0x6563('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0x6563('0x2')]},'refreshToken':{'type':Sequelize[_0x6563('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index f9967e7..9791a7f 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 _0x8275=['zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','host','zoho.eu','com','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','remove','includes','api_name','system_mandatory','push','display_label','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../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','ZohoAccount','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','options','include','findAll','show','keys','rawAttributes','includeAll','find','catch','create','body','params','getConfigurations','findOne','ZohoConfiguration','order','filter','nolimit','AccountId','Subjects','channel','Descriptions','getDescriptions','ZohoField'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0x8275,0xad));var _0x5827=function(_0x402b1f,_0x3df329){_0x402b1f=_0x402b1f-0x0;var _0x5d22f2=_0x8275[_0x402b1f];return _0x5d22f2;};'use strict';var emlformat=require(_0x5827('0x0'));var rimraf=require(_0x5827('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5827('0x2'));var rp=require(_0x5827('0x3'));var moment=require('moment');var BPromise=require(_0x5827('0x4'));var Mustache=require(_0x5827('0x5'));var util=require(_0x5827('0x6'));var path=require(_0x5827('0x7'));var sox=require('sox');var csv=require(_0x5827('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5827('0x9'));var _=require(_0x5827('0xa'));var squel=require(_0x5827('0xb'));var crypto=require(_0x5827('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5827('0x8'));var querystring=require(_0x5827('0xd'));var Papa=require(_0x5827('0xe'));var Redis=require(_0x5827('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5827('0x10'));var as=require(_0x5827('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5827('0x12'))('api');var utils=require(_0x5827('0x13'));var config=require(_0x5827('0x14'));var licenseUtil=require(_0x5827('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5827('0x16'));function respondWithStatusCode(_0x83b171,_0x3325bd){_0x3325bd=_0x3325bd||0xcc;return function(_0x430524){if(_0x430524){return _0x83b171[_0x5827('0x17')](_0x3325bd);}return _0x83b171[_0x5827('0x18')](_0x3325bd)[_0x5827('0x19')]();};}function respondWithResult(_0x3ac172,_0x509d24){_0x509d24=_0x509d24||0xc8;return function(_0x3dabd9){if(_0x3dabd9){return _0x3ac172['status'](_0x509d24)[_0x5827('0x1a')](_0x3dabd9);}};}function respondWithFilteredResult(_0x4adc2c,_0x1556a7){return function(_0x3cea9f){if(_0x3cea9f){var _0x56ae0d=typeof _0x1556a7['offset']===_0x5827('0x1b')&&typeof _0x1556a7[_0x5827('0x1c')]==='undefined';var _0x4d3f06=_0x3cea9f[_0x5827('0x1d')];var _0x6cc3b4=_0x56ae0d?0x0:_0x1556a7[_0x5827('0x1e')];var _0x46928a=_0x56ae0d?_0x3cea9f[_0x5827('0x1d')]:_0x1556a7[_0x5827('0x1e')]+_0x1556a7[_0x5827('0x1c')];var _0x3a383d;if(_0x46928a>=_0x4d3f06){_0x46928a=_0x4d3f06;_0x3a383d=0xc8;}else{_0x3a383d=0xce;}_0x4adc2c[_0x5827('0x18')](_0x3a383d);return _0x4adc2c[_0x5827('0x1f')](_0x5827('0x20'),_0x6cc3b4+'-'+_0x46928a+'/'+_0x4d3f06)['json'](_0x3cea9f);}return null;};}function patchUpdates(_0x298f6d){return function(_0x282824){try{jsonpatch[_0x5827('0x21')](_0x282824,_0x298f6d,!![]);}catch(_0x3647cc){return BPromise[_0x5827('0x22')](_0x3647cc);}return _0x282824[_0x5827('0x23')]();};}function saveUpdates(_0x5ac4bb,_0x3366fe){return function(_0x58ac4f){if(_0x58ac4f){return _0x58ac4f[_0x5827('0x24')](_0x5ac4bb)[_0x5827('0x25')](function(_0x381d0b){return _0x381d0b;});}return null;};}function removeEntity(_0x4ae54c,_0x277682){return function(_0x5688ac){if(_0x5688ac){return _0x5688ac[_0x5827('0x26')]()[_0x5827('0x25')](function(){_0x4ae54c[_0x5827('0x18')](0xcc)[_0x5827('0x19')]();});}};}function handleEntityNotFound(_0x1c509b,_0x43c11f){return function(_0x1baa8e){if(!_0x1baa8e){_0x1c509b[_0x5827('0x17')](0x194);}return _0x1baa8e;};}function handleError(_0x2612d0,_0x3daa9c){_0x3daa9c=_0x3daa9c||0x1f4;return function(_0x979157){logger[_0x5827('0x27')](_0x979157[_0x5827('0x28')]);if(_0x979157[_0x5827('0x29')]){delete _0x979157[_0x5827('0x29')];}_0x2612d0[_0x5827('0x18')](_0x3daa9c)[_0x5827('0x2a')](_0x979157);};}exports['index']=function(_0xf09153,_0x2567a2){var _0x27aa9={},_0x543895={},_0xfd4964={'count':0x0,'rows':[]};var _0x3509e9=_[_0x5827('0x2b')](db[_0x5827('0x2c')]['rawAttributes'],function(_0x5964ac){return{'name':_0x5964ac[_0x5827('0x2d')],'type':_0x5964ac['type'][_0x5827('0x2e')]};});_0x543895['model']=_[_0x5827('0x2b')](_0x3509e9,_0x5827('0x29'));_0x543895[_0x5827('0x2f')]=_['keys'](_0xf09153[_0x5827('0x2f')]);_0x543895[_0x5827('0x30')]=_[_0x5827('0x31')](_0x543895[_0x5827('0x32')],_0x543895[_0x5827('0x2f')]);_0x27aa9[_0x5827('0x33')]=_[_0x5827('0x31')](_0x543895[_0x5827('0x32')],qs[_0x5827('0x34')](_0xf09153['query'][_0x5827('0x34')]));_0x27aa9[_0x5827('0x33')]=_0x27aa9[_0x5827('0x33')][_0x5827('0x35')]?_0x27aa9[_0x5827('0x33')]:_0x543895['model'];if(!_0xf09153[_0x5827('0x2f')][_0x5827('0x36')]('nolimit')){_0x27aa9['limit']=qs[_0x5827('0x1c')](_0xf09153[_0x5827('0x2f')][_0x5827('0x1c')]);_0x27aa9[_0x5827('0x1e')]=qs[_0x5827('0x1e')](_0xf09153['query'][_0x5827('0x1e')]);}_0x27aa9['order']=qs[_0x5827('0x37')](_0xf09153['query']['sort']);_0x27aa9[_0x5827('0x38')]=qs['filters'](_[_0x5827('0x39')](_0xf09153[_0x5827('0x2f')],_0x543895[_0x5827('0x30')]),_0x3509e9);if(_0xf09153[_0x5827('0x2f')]['filter']){_0x27aa9['where']=_[_0x5827('0x3a')](_0x27aa9['where'],{'$or':_['map'](_0x3509e9,function(_0x415a00){if(_0x415a00[_0x5827('0x3b')]!==_0x5827('0x3c')){var _0x5071c5={};_0x5071c5[_0x415a00[_0x5827('0x29')]]={'$like':'%'+_0xf09153[_0x5827('0x2f')]['filter']+'%'};return _0x5071c5;}})});}_0x27aa9=_[_0x5827('0x3a')]({},_0x27aa9,_0xf09153[_0x5827('0x3d')]);var _0x40cc20={'where':_0x27aa9[_0x5827('0x38')]};return db[_0x5827('0x2c')][_0x5827('0x1d')](_0x40cc20)[_0x5827('0x25')](function(_0x2fad50){_0xfd4964['count']=_0x2fad50;if(_0xf09153[_0x5827('0x2f')]['includeAll']){_0x27aa9[_0x5827('0x3e')]=[{'all':!![]}];}return db[_0x5827('0x2c')][_0x5827('0x3f')](_0x27aa9);})['then'](function(_0x2411dd){_0xfd4964['rows']=_0x2411dd;return _0xfd4964;})[_0x5827('0x25')](respondWithFilteredResult(_0x2567a2,_0x27aa9))['catch'](handleError(_0x2567a2,null));};exports[_0x5827('0x40')]=function(_0xf4afbd,_0x5dca03){var _0x5d504b={'raw':![],'where':{'id':_0xf4afbd['params']['id']}},_0xf61a11={};_0xf61a11[_0x5827('0x32')]=_[_0x5827('0x41')](db[_0x5827('0x2c')][_0x5827('0x42')]);_0xf61a11[_0x5827('0x2f')]=_[_0x5827('0x41')](_0xf4afbd['query']);_0xf61a11['filters']=_[_0x5827('0x31')](_0xf61a11[_0x5827('0x32')],_0xf61a11['query']);_0x5d504b[_0x5827('0x33')]=_['intersection'](_0xf61a11['model'],qs['fields'](_0xf4afbd[_0x5827('0x2f')][_0x5827('0x34')]));_0x5d504b['attributes']=_0x5d504b['attributes']['length']?_0x5d504b[_0x5827('0x33')]:_0xf61a11[_0x5827('0x32')];if(_0xf4afbd[_0x5827('0x2f')][_0x5827('0x43')]){_0x5d504b['include']=[{'all':!![]}];}_0x5d504b=_[_0x5827('0x3a')]({},_0x5d504b,_0xf4afbd['options']);return db[_0x5827('0x2c')][_0x5827('0x44')](_0x5d504b)[_0x5827('0x25')](handleEntityNotFound(_0x5dca03,null))[_0x5827('0x25')](respondWithResult(_0x5dca03,null))[_0x5827('0x45')](handleError(_0x5dca03,null));};exports[_0x5827('0x46')]=function(_0x1228ef,_0x54f84c){return db[_0x5827('0x2c')]['create'](_0x1228ef[_0x5827('0x47')],{})[_0x5827('0x25')](respondWithResult(_0x54f84c,0xc9))['catch'](handleError(_0x54f84c,null));};exports[_0x5827('0x24')]=function(_0x2cd756,_0x3b19ca){if(_0x2cd756[_0x5827('0x47')]['id']){delete _0x2cd756[_0x5827('0x47')]['id'];}return db[_0x5827('0x2c')][_0x5827('0x44')]({'where':{'id':_0x2cd756['params']['id']}})['then'](handleEntityNotFound(_0x3b19ca,null))[_0x5827('0x25')](saveUpdates(_0x2cd756[_0x5827('0x47')],null))[_0x5827('0x25')](respondWithResult(_0x3b19ca,null))['catch'](handleError(_0x3b19ca,null));};exports[_0x5827('0x26')]=function(_0x3cdff3,_0x3d214f){return db[_0x5827('0x2c')][_0x5827('0x44')]({'where':{'id':_0x3cdff3[_0x5827('0x48')]['id']}})['then'](handleEntityNotFound(_0x3d214f,null))[_0x5827('0x25')](removeEntity(_0x3d214f,null))[_0x5827('0x45')](handleError(_0x3d214f,null));};exports[_0x5827('0x49')]=function(_0x12499f,_0x189cc1,_0x20bc90){var _0x58af4b={};var _0xb1ca15={};var _0x5acee3;var _0x39d3f6;return db[_0x5827('0x2c')][_0x5827('0x4a')]({'where':{'id':_0x12499f[_0x5827('0x48')]['id']}})[_0x5827('0x25')](handleEntityNotFound(_0x189cc1,null))[_0x5827('0x25')](function(_0x4ae63f){if(_0x4ae63f){_0x5acee3=_0x4ae63f;_0xb1ca15['model']=_[_0x5827('0x41')](db[_0x5827('0x4b')][_0x5827('0x42')]);_0xb1ca15[_0x5827('0x2f')]=_['keys'](_0x12499f['query']);_0xb1ca15[_0x5827('0x30')]=_[_0x5827('0x31')](_0xb1ca15['model'],_0xb1ca15[_0x5827('0x2f')]);_0x58af4b['attributes']=_[_0x5827('0x31')](_0xb1ca15['model'],qs[_0x5827('0x34')](_0x12499f[_0x5827('0x2f')][_0x5827('0x34')]));_0x58af4b[_0x5827('0x33')]=_0x58af4b[_0x5827('0x33')][_0x5827('0x35')]?_0x58af4b[_0x5827('0x33')]:_0xb1ca15['model'];_0x58af4b[_0x5827('0x4c')]=qs[_0x5827('0x37')](_0x12499f['query']['sort']);_0x58af4b[_0x5827('0x38')]=qs[_0x5827('0x30')](_['pick'](_0x12499f[_0x5827('0x2f')],_0xb1ca15[_0x5827('0x30')]));if(_0x12499f[_0x5827('0x2f')][_0x5827('0x4d')]){_0x58af4b['where']=_[_0x5827('0x3a')](_0x58af4b[_0x5827('0x38')],{'$or':_['map'](_0x58af4b[_0x5827('0x33')],function(_0x5d75c0){var _0x2d8a08={};_0x2d8a08[_0x5d75c0]={'$like':'%'+_0x12499f['query'][_0x5827('0x4d')]+'%'};return _0x2d8a08;})});}_0x58af4b=_[_0x5827('0x3a')]({},_0x58af4b,_0x12499f[_0x5827('0x3d')]);return _0x5acee3[_0x5827('0x49')](_0x58af4b);}})[_0x5827('0x25')](function(_0x492b36){if(_0x492b36){_0x39d3f6=_0x492b36[_0x5827('0x35')];if(!_0x12499f[_0x5827('0x2f')]['hasOwnProperty'](_0x5827('0x4e'))){_0x58af4b[_0x5827('0x1c')]=qs[_0x5827('0x1c')](_0x12499f[_0x5827('0x2f')]['limit']);_0x58af4b[_0x5827('0x1e')]=qs[_0x5827('0x1e')](_0x12499f['query'][_0x5827('0x1e')]);}return _0x5acee3[_0x5827('0x49')](_0x58af4b);}})[_0x5827('0x25')](function(_0x1f61d1){if(_0x1f61d1){return _0x1f61d1?{'count':_0x39d3f6,'rows':_0x1f61d1}:null;}})[_0x5827('0x25')](respondWithResult(_0x189cc1,null))['catch'](handleError(_0x189cc1,null));};exports['addConfiguration']=function(_0x11024d,_0x582b7a,_0x270f60){if(_0x11024d[_0x5827('0x47')]['id']){delete _0x11024d[_0x5827('0x47')]['id'];}return db[_0x5827('0x2c')][_0x5827('0x4a')]({'where':{'id':_0x11024d['params']['id']}})[_0x5827('0x25')](handleEntityNotFound(_0x582b7a,null))['then'](function(_0x8e5dcb){if(_0x8e5dcb){_0x11024d[_0x5827('0x47')][_0x5827('0x4f')]=_0x8e5dcb['id'];_0x11024d[_0x5827('0x47')][_0x5827('0x50')]=integrations['getSubjects'](_0x11024d[_0x5827('0x47')][_0x5827('0x51')],_0x11024d[_0x5827('0x47')][_0x5827('0x3b')]);_0x11024d[_0x5827('0x47')][_0x5827('0x52')]=integrations[_0x5827('0x53')](_0x11024d[_0x5827('0x47')][_0x5827('0x51')],_0x11024d[_0x5827('0x47')][_0x5827('0x3b')]);return db[_0x5827('0x4b')][_0x5827('0x46')](_0x11024d[_0x5827('0x47')],{'include':[{'model':db[_0x5827('0x54')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x5827('0x52')}]});}return null;})[_0x5827('0x25')](respondWithResult(_0x582b7a,null))[_0x5827('0x45')](handleError(_0x582b7a,null));};function getAccessToken(_0x44d057){return new Promise(function(_0x115111,_0x33638c){var _0x4329b9;switch(_0x44d057[_0x5827('0x55')]){case'US':_0x4329b9=_0x5827('0x56');break;case'AU':_0x4329b9=_0x5827('0x57');break;case'EU':_0x4329b9=_0x5827('0x58');break;case'IN':_0x4329b9=_0x5827('0x59');break;case'CN':_0x4329b9='https://accounts.zoho.com.cn';break;default:_0x4329b9=_0x5827('0x58');break;}var _0x2dc2a7={'method':_0x5827('0x5a'),'uri':_0x4329b9+_0x5827('0x5b'),'qs':{'refresh_token':_0x44d057[_0x5827('0x5c')],'client_id':_0x44d057[_0x5827('0x5d')],'client_secret':_0x44d057[_0x5827('0x5e')],'grant_type':_0x5827('0x5f')},'json':!![]};return rp(_0x2dc2a7)[_0x5827('0x25')](function(_0x2f213c){if(_0x2f213c[_0x5827('0x60')]){_0x115111(_0x2f213c[_0x5827('0x60')]);}else{_0x33638c(_0x5827('0x61'));}})['catch'](function(_0x2e6960){_0x33638c(_0x2e6960);});});}exports[_0x5827('0x62')]=function(_0x37637f,_0x5ebfba,_0x5a34b9){var _0x58a557,_0x24059c,_0x4a0975,_0x28ae02,_0x3ebdf9;return db[_0x5827('0x2c')]['findOne']({'where':{'id':_0x37637f[_0x5827('0x48')]['id']},'attributes':['id','host',_0x5827('0x55'),_0x5827('0x5d'),_0x5827('0x5e'),_0x5827('0x63'),'code','refreshToken']})[_0x5827('0x25')](handleEntityNotFound(_0x5ebfba,null))[_0x5827('0x25')](function(_0x57752c){_0x3ebdf9=_0x57752c;_0x58a557=_0x3ebdf9[_0x5827('0x64')];_0x24059c=_0x58a557===_0x5827('0x65')?'eu':_0x5827('0x66');_0x4a0975=_0x3ebdf9[_0x5827('0x63')];var _0x2e70ab=_0x4a0975['slice'](-0x1);if(_0x2e70ab==='/'||_0x2e70ab==='\x5c'||_0x2e70ab===':'){_0x4a0975=_0x4a0975['substring'](0x0,_0x4a0975['lastIndexOf'](_0x2e70ab));}if(!_0x3ebdf9['refreshToken']){throw new Error(_0x5827('0x67'));}return getAccessToken(_0x3ebdf9);})[_0x5827('0x25')](function(_0x395d50){if(_0x395d50){return rp({'method':_0x5827('0x68'),'uri':util['format'](_0x5827('0x69'),_0x24059c),'qs':{'module':'Calls'},'headers':{'Authorization':_0x5827('0x6a')+_0x395d50},'json':!![]});}})['then'](function(_0x19a774){if(_0x19a774){if(_0x19a774[_0x5827('0x6b')]&&_0x19a774['response'][_0x5827('0x27')]){throw new Error(_0x19a774['response'][_0x5827('0x27')][_0x5827('0x6c')]);}var _0x78e2db=[];var _0x2af5b8=[];var _0x42d429=[_0x5827('0x6d'),_0x5827('0x6e'),_0x5827('0x6f'),_0x5827('0x70'),_0x5827('0x71'),_0x5827('0x72'),_0x5827('0x73'),'Call_Type'];_0x2af5b8=_[_0x5827('0x74')](_0x19a774[_0x5827('0x34')],function(_0x30fe53){return _0x42d429[_0x5827('0x75')](_0x30fe53[_0x5827('0x76')]);});for(var _0x1bf336=0x0;_0x1bf336<_0x2af5b8['length'];_0x1bf336++){if(_0x2af5b8[_0x1bf336][_0x5827('0x77')]===![]){_0x78e2db[_0x5827('0x78')]({'id':_0x2af5b8[_0x1bf336]['id'],'name':_0x2af5b8[_0x1bf336][_0x5827('0x79')],'custom':_0x2af5b8[_0x1bf336]['custom_field'],'options':_0x2af5b8[_0x1bf336][_0x5827('0x7a')]===_0x5827('0x7b')&&_0x2af5b8[_0x1bf336][_0x5827('0x7c')][_0x5827('0x35')]>-0x1?_[_0x5827('0x2b')](_0x2af5b8[_0x1bf336][_0x5827('0x7c')],function(_0x5e3d26){return{'name':_0x5e3d26,'value':_0x5e3d26};}):[]});}}return{'count':_0x78e2db[_0x5827('0x35')],'rows':_0x78e2db};}else{return{'count':0x0,'rows':[]};}})[_0x5827('0x25')](respondWithResult(_0x5ebfba,null))['catch'](function(_0x3f7355){var _0xcd15b=_0x37637f['query'][_0x5827('0x7d')]?0x1f4:_0x3f7355[_0x5827('0x7e')]||0x1f4;logger['error'](_0x5827('0x7f'),_0x5827('0x62'),_0xcd15b,JSON[_0x5827('0x80')](_0x3f7355));delete _0x3f7355['name'];if(_0xcd15b===0x191){_0xcd15b=0x190;}_0x5ebfba['status'](_0xcd15b)[_0x5827('0x2a')](_0x37637f[_0x5827('0x2f')][_0x5827('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x3f7355[_0x5827('0x7e')]}:_0x3f7355);});}; \ No newline at end of file +var _0xa3c6=['filters','getConfigurations','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientSecret','refresh_token','access_token','getFields','host','clientId','code','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','system_mandatory','push','display_label','custom_field','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','error','name','send','index','map','ZohoAccount','rawAttributes','type','key','model','keys','query','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','intersection','length','find','create','body','params','destroy','ZohoConfiguration'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa3c6,0x1ca));var _0x6a3c=function(_0x275f2d,_0x1a4aa5){_0x275f2d=_0x275f2d-0x0;var _0x1b9430=_0xa3c6[_0x275f2d];return _0x1b9430;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a3c('0x0'));var zipdir=require(_0x6a3c('0x1'));var jsonpatch=require(_0x6a3c('0x2'));var rp=require(_0x6a3c('0x3'));var moment=require(_0x6a3c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6a3c('0x5'));var util=require(_0x6a3c('0x6'));var path=require(_0x6a3c('0x7'));var sox=require(_0x6a3c('0x8'));var csv=require(_0x6a3c('0x9'));var ejs=require(_0x6a3c('0xa'));var fs=require('fs');var fs_extra=require(_0x6a3c('0xb'));var _=require('lodash');var squel=require(_0x6a3c('0xc'));var crypto=require(_0x6a3c('0xd'));var jsforce=require(_0x6a3c('0xe'));var deskjs=require(_0x6a3c('0xf'));var toCsv=require(_0x6a3c('0x9'));var querystring=require(_0x6a3c('0x10'));var Papa=require(_0x6a3c('0x11'));var Redis=require(_0x6a3c('0x12'));var authService=require(_0x6a3c('0x13'));var qs=require(_0x6a3c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6a3c('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a3c('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6a3c('0x17'));var db=require(_0x6a3c('0x18'))['db'];var integrations=require(_0x6a3c('0x19'));function respondWithStatusCode(_0x567f3c,_0x2e7c6d){_0x2e7c6d=_0x2e7c6d||0xcc;return function(_0x6f246b){if(_0x6f246b){return _0x567f3c[_0x6a3c('0x1a')](_0x2e7c6d);}return _0x567f3c[_0x6a3c('0x1b')](_0x2e7c6d)[_0x6a3c('0x1c')]();};}function respondWithResult(_0x5a2c48,_0xa94ffa){_0xa94ffa=_0xa94ffa||0xc8;return function(_0x1494ae){if(_0x1494ae){return _0x5a2c48[_0x6a3c('0x1b')](_0xa94ffa)[_0x6a3c('0x1d')](_0x1494ae);}};}function respondWithFilteredResult(_0x50638b,_0x44be33){return function(_0x5bbc9b){if(_0x5bbc9b){var _0xc16e87=typeof _0x44be33[_0x6a3c('0x1e')]===_0x6a3c('0x1f')&&typeof _0x44be33['limit']===_0x6a3c('0x1f');var _0x10c098=_0x5bbc9b[_0x6a3c('0x20')];var _0x3bc67d=_0xc16e87?0x0:_0x44be33[_0x6a3c('0x1e')];var _0x55e390=_0xc16e87?_0x5bbc9b['count']:_0x44be33[_0x6a3c('0x1e')]+_0x44be33[_0x6a3c('0x21')];var _0x24c8c7;if(_0x55e390>=_0x10c098){_0x55e390=_0x10c098;_0x24c8c7=0xc8;}else{_0x24c8c7=0xce;}_0x50638b[_0x6a3c('0x1b')](_0x24c8c7);return _0x50638b['set'](_0x6a3c('0x22'),_0x3bc67d+'-'+_0x55e390+'/'+_0x10c098)[_0x6a3c('0x1d')](_0x5bbc9b);}return null;};}function patchUpdates(_0x491666){return function(_0x1b6d7b){try{jsonpatch['apply'](_0x1b6d7b,_0x491666,!![]);}catch(_0x1acee7){return BPromise[_0x6a3c('0x23')](_0x1acee7);}return _0x1b6d7b['save']();};}function saveUpdates(_0x18ecf6,_0x13cbae){return function(_0x544656){if(_0x544656){return _0x544656[_0x6a3c('0x24')](_0x18ecf6)[_0x6a3c('0x25')](function(_0x519845){return _0x519845;});}return null;};}function removeEntity(_0x394bc3,_0x280e73){return function(_0x24f192){if(_0x24f192){return _0x24f192['destroy']()[_0x6a3c('0x25')](function(){_0x394bc3[_0x6a3c('0x1b')](0xcc)[_0x6a3c('0x1c')]();});}};}function handleEntityNotFound(_0x9da7dc,_0x3f92b3){return function(_0x2b2ed9){if(!_0x2b2ed9){_0x9da7dc[_0x6a3c('0x1a')](0x194);}return _0x2b2ed9;};}function handleError(_0x317b90,_0x32dec1){_0x32dec1=_0x32dec1||0x1f4;return function(_0x39b7ad){logger[_0x6a3c('0x26')](_0x39b7ad['stack']);if(_0x39b7ad[_0x6a3c('0x27')]){delete _0x39b7ad[_0x6a3c('0x27')];}_0x317b90[_0x6a3c('0x1b')](_0x32dec1)[_0x6a3c('0x28')](_0x39b7ad);};}exports[_0x6a3c('0x29')]=function(_0x316c9b,_0x52aada){var _0x156e37={},_0x1f85b7={},_0x328087={'count':0x0,'rows':[]};var _0x4ac59b=_[_0x6a3c('0x2a')](db[_0x6a3c('0x2b')][_0x6a3c('0x2c')],function(_0x5392ba){return{'name':_0x5392ba['fieldName'],'type':_0x5392ba[_0x6a3c('0x2d')][_0x6a3c('0x2e')]};});_0x1f85b7[_0x6a3c('0x2f')]=_['map'](_0x4ac59b,_0x6a3c('0x27'));_0x1f85b7['query']=_[_0x6a3c('0x30')](_0x316c9b['query']);_0x1f85b7['filters']=_['intersection'](_0x1f85b7[_0x6a3c('0x2f')],_0x1f85b7[_0x6a3c('0x31')]);_0x156e37[_0x6a3c('0x32')]=_['intersection'](_0x1f85b7[_0x6a3c('0x2f')],qs[_0x6a3c('0x33')](_0x316c9b[_0x6a3c('0x31')][_0x6a3c('0x33')]));_0x156e37['attributes']=_0x156e37[_0x6a3c('0x32')]['length']?_0x156e37[_0x6a3c('0x32')]:_0x1f85b7['model'];if(!_0x316c9b[_0x6a3c('0x31')]['hasOwnProperty']('nolimit')){_0x156e37[_0x6a3c('0x21')]=qs[_0x6a3c('0x21')](_0x316c9b[_0x6a3c('0x31')][_0x6a3c('0x21')]);_0x156e37[_0x6a3c('0x1e')]=qs[_0x6a3c('0x1e')](_0x316c9b[_0x6a3c('0x31')][_0x6a3c('0x1e')]);}_0x156e37[_0x6a3c('0x34')]=qs[_0x6a3c('0x35')](_0x316c9b[_0x6a3c('0x31')][_0x6a3c('0x35')]);_0x156e37[_0x6a3c('0x36')]=qs['filters'](_[_0x6a3c('0x37')](_0x316c9b[_0x6a3c('0x31')],_0x1f85b7['filters']),_0x4ac59b);if(_0x316c9b[_0x6a3c('0x31')][_0x6a3c('0x38')]){_0x156e37[_0x6a3c('0x36')]=_[_0x6a3c('0x39')](_0x156e37[_0x6a3c('0x36')],{'$or':_[_0x6a3c('0x2a')](_0x4ac59b,function(_0x3989ec){if(_0x3989ec[_0x6a3c('0x2d')]!==_0x6a3c('0x3a')){var _0x5c85fd={};_0x5c85fd[_0x3989ec[_0x6a3c('0x27')]]={'$like':'%'+_0x316c9b[_0x6a3c('0x31')][_0x6a3c('0x38')]+'%'};return _0x5c85fd;}})});}_0x156e37=_[_0x6a3c('0x39')]({},_0x156e37,_0x316c9b[_0x6a3c('0x3b')]);var _0x18d785={'where':_0x156e37[_0x6a3c('0x36')]};return db[_0x6a3c('0x2b')][_0x6a3c('0x20')](_0x18d785)[_0x6a3c('0x25')](function(_0x30fe48){_0x328087[_0x6a3c('0x20')]=_0x30fe48;if(_0x316c9b[_0x6a3c('0x31')][_0x6a3c('0x3c')]){_0x156e37[_0x6a3c('0x3d')]=[{'all':!![]}];}return db[_0x6a3c('0x2b')][_0x6a3c('0x3e')](_0x156e37);})['then'](function(_0x3b83ad){_0x328087[_0x6a3c('0x3f')]=_0x3b83ad;return _0x328087;})[_0x6a3c('0x25')](respondWithFilteredResult(_0x52aada,_0x156e37))[_0x6a3c('0x40')](handleError(_0x52aada,null));};exports[_0x6a3c('0x41')]=function(_0x7aedbb,_0x428e85){var _0x332ac2={'raw':![],'where':{'id':_0x7aedbb['params']['id']}},_0x2034f6={};_0x2034f6[_0x6a3c('0x2f')]=_[_0x6a3c('0x30')](db[_0x6a3c('0x2b')][_0x6a3c('0x2c')]);_0x2034f6[_0x6a3c('0x31')]=_[_0x6a3c('0x30')](_0x7aedbb[_0x6a3c('0x31')]);_0x2034f6['filters']=_[_0x6a3c('0x42')](_0x2034f6[_0x6a3c('0x2f')],_0x2034f6[_0x6a3c('0x31')]);_0x332ac2[_0x6a3c('0x32')]=_[_0x6a3c('0x42')](_0x2034f6[_0x6a3c('0x2f')],qs[_0x6a3c('0x33')](_0x7aedbb['query'][_0x6a3c('0x33')]));_0x332ac2[_0x6a3c('0x32')]=_0x332ac2[_0x6a3c('0x32')][_0x6a3c('0x43')]?_0x332ac2[_0x6a3c('0x32')]:_0x2034f6[_0x6a3c('0x2f')];if(_0x7aedbb[_0x6a3c('0x31')]['includeAll']){_0x332ac2[_0x6a3c('0x3d')]=[{'all':!![]}];}_0x332ac2=_[_0x6a3c('0x39')]({},_0x332ac2,_0x7aedbb['options']);return db[_0x6a3c('0x2b')][_0x6a3c('0x44')](_0x332ac2)[_0x6a3c('0x25')](handleEntityNotFound(_0x428e85,null))[_0x6a3c('0x25')](respondWithResult(_0x428e85,null))[_0x6a3c('0x40')](handleError(_0x428e85,null));};exports['create']=function(_0x4f4aa7,_0x1ca4f0){return db[_0x6a3c('0x2b')][_0x6a3c('0x45')](_0x4f4aa7['body'],{})[_0x6a3c('0x25')](respondWithResult(_0x1ca4f0,0xc9))[_0x6a3c('0x40')](handleError(_0x1ca4f0,null));};exports[_0x6a3c('0x24')]=function(_0x6882bf,_0x1df82c){if(_0x6882bf['body']['id']){delete _0x6882bf[_0x6a3c('0x46')]['id'];}return db['ZohoAccount'][_0x6a3c('0x44')]({'where':{'id':_0x6882bf[_0x6a3c('0x47')]['id']}})[_0x6a3c('0x25')](handleEntityNotFound(_0x1df82c,null))[_0x6a3c('0x25')](saveUpdates(_0x6882bf[_0x6a3c('0x46')],null))[_0x6a3c('0x25')](respondWithResult(_0x1df82c,null))['catch'](handleError(_0x1df82c,null));};exports[_0x6a3c('0x48')]=function(_0x125a9a,_0x1350ef){return db[_0x6a3c('0x2b')][_0x6a3c('0x44')]({'where':{'id':_0x125a9a[_0x6a3c('0x47')]['id']}})[_0x6a3c('0x25')](handleEntityNotFound(_0x1350ef,null))[_0x6a3c('0x25')](removeEntity(_0x1350ef,null))['catch'](handleError(_0x1350ef,null));};exports['getConfigurations']=function(_0x22dbd0,_0x219993,_0xd0173e){var _0x480209={};var _0x462bf4={};var _0x29ee3c;var _0x44a00e;return db[_0x6a3c('0x2b')]['findOne']({'where':{'id':_0x22dbd0[_0x6a3c('0x47')]['id']}})[_0x6a3c('0x25')](handleEntityNotFound(_0x219993,null))[_0x6a3c('0x25')](function(_0x1855ac){if(_0x1855ac){_0x29ee3c=_0x1855ac;_0x462bf4[_0x6a3c('0x2f')]=_[_0x6a3c('0x30')](db[_0x6a3c('0x49')][_0x6a3c('0x2c')]);_0x462bf4[_0x6a3c('0x31')]=_[_0x6a3c('0x30')](_0x22dbd0['query']);_0x462bf4[_0x6a3c('0x4a')]=_['intersection'](_0x462bf4[_0x6a3c('0x2f')],_0x462bf4[_0x6a3c('0x31')]);_0x480209[_0x6a3c('0x32')]=_[_0x6a3c('0x42')](_0x462bf4[_0x6a3c('0x2f')],qs['fields'](_0x22dbd0[_0x6a3c('0x31')][_0x6a3c('0x33')]));_0x480209[_0x6a3c('0x32')]=_0x480209[_0x6a3c('0x32')][_0x6a3c('0x43')]?_0x480209[_0x6a3c('0x32')]:_0x462bf4[_0x6a3c('0x2f')];_0x480209[_0x6a3c('0x34')]=qs[_0x6a3c('0x35')](_0x22dbd0[_0x6a3c('0x31')][_0x6a3c('0x35')]);_0x480209[_0x6a3c('0x36')]=qs[_0x6a3c('0x4a')](_[_0x6a3c('0x37')](_0x22dbd0[_0x6a3c('0x31')],_0x462bf4[_0x6a3c('0x4a')]));if(_0x22dbd0[_0x6a3c('0x31')]['filter']){_0x480209[_0x6a3c('0x36')]=_[_0x6a3c('0x39')](_0x480209['where'],{'$or':_[_0x6a3c('0x2a')](_0x480209[_0x6a3c('0x32')],function(_0x51f36c){var _0x3c6c09={};_0x3c6c09[_0x51f36c]={'$like':'%'+_0x22dbd0[_0x6a3c('0x31')][_0x6a3c('0x38')]+'%'};return _0x3c6c09;})});}_0x480209=_[_0x6a3c('0x39')]({},_0x480209,_0x22dbd0[_0x6a3c('0x3b')]);return _0x29ee3c[_0x6a3c('0x4b')](_0x480209);}})[_0x6a3c('0x25')](function(_0x2b9fed){if(_0x2b9fed){_0x44a00e=_0x2b9fed['length'];if(!_0x22dbd0['query'][_0x6a3c('0x4c')]('nolimit')){_0x480209[_0x6a3c('0x21')]=qs['limit'](_0x22dbd0[_0x6a3c('0x31')][_0x6a3c('0x21')]);_0x480209[_0x6a3c('0x1e')]=qs[_0x6a3c('0x1e')](_0x22dbd0[_0x6a3c('0x31')]['offset']);}return _0x29ee3c[_0x6a3c('0x4b')](_0x480209);}})['then'](function(_0x2b813d){if(_0x2b813d){return _0x2b813d?{'count':_0x44a00e,'rows':_0x2b813d}:null;}})['then'](respondWithResult(_0x219993,null))[_0x6a3c('0x40')](handleError(_0x219993,null));};exports[_0x6a3c('0x4d')]=function(_0x5af664,_0x288945,_0x46d4e1){if(_0x5af664[_0x6a3c('0x46')]['id']){delete _0x5af664[_0x6a3c('0x46')]['id'];}return db['ZohoAccount'][_0x6a3c('0x4e')]({'where':{'id':_0x5af664['params']['id']}})[_0x6a3c('0x25')](handleEntityNotFound(_0x288945,null))[_0x6a3c('0x25')](function(_0x4c3f72){if(_0x4c3f72){_0x5af664[_0x6a3c('0x46')][_0x6a3c('0x4f')]=_0x4c3f72['id'];_0x5af664[_0x6a3c('0x46')][_0x6a3c('0x50')]=integrations[_0x6a3c('0x51')](_0x5af664[_0x6a3c('0x46')][_0x6a3c('0x52')],_0x5af664[_0x6a3c('0x46')][_0x6a3c('0x2d')]);_0x5af664[_0x6a3c('0x46')]['Descriptions']=integrations['getDescriptions'](_0x5af664[_0x6a3c('0x46')]['channel'],_0x5af664[_0x6a3c('0x46')][_0x6a3c('0x2d')]);return db[_0x6a3c('0x49')]['create'](_0x5af664[_0x6a3c('0x46')],{'include':[{'model':db['ZohoField'],'as':_0x6a3c('0x50')},{'model':db[_0x6a3c('0x53')],'as':_0x6a3c('0x54')}]});}return null;})[_0x6a3c('0x25')](respondWithResult(_0x288945,null))[_0x6a3c('0x40')](handleError(_0x288945,null));};function getAccessToken(_0x4fb2e7){return new Promise(function(_0x70a08d,_0x587276){var _0x5a68ad;switch(_0x4fb2e7[_0x6a3c('0x55')]){case'US':_0x5a68ad=_0x6a3c('0x56');break;case'AU':_0x5a68ad=_0x6a3c('0x57');break;case'EU':_0x5a68ad=_0x6a3c('0x58');break;case'IN':_0x5a68ad=_0x6a3c('0x59');break;case'CN':_0x5a68ad=_0x6a3c('0x5a');break;default:_0x5a68ad='https://accounts.zoho.eu';break;}var _0x2b1224={'method':_0x6a3c('0x5b'),'uri':_0x5a68ad+_0x6a3c('0x5c'),'qs':{'refresh_token':_0x4fb2e7[_0x6a3c('0x5d')],'client_id':_0x4fb2e7['clientId'],'client_secret':_0x4fb2e7[_0x6a3c('0x5e')],'grant_type':_0x6a3c('0x5f')},'json':!![]};return rp(_0x2b1224)['then'](function(_0x1f6d03){if(_0x1f6d03['access_token']){_0x70a08d(_0x1f6d03[_0x6a3c('0x60')]);}else{_0x587276('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x6a3c('0x40')](function(_0x22044a){_0x587276(_0x22044a);});});}exports[_0x6a3c('0x61')]=function(_0x4df011,_0x550855,_0x438442){var _0x34942f,_0xa0b0e9,_0x40b27b,_0x43c906,_0xcc5b08;return db[_0x6a3c('0x2b')][_0x6a3c('0x4e')]({'where':{'id':_0x4df011[_0x6a3c('0x47')]['id']},'attributes':['id',_0x6a3c('0x62'),_0x6a3c('0x55'),_0x6a3c('0x63'),_0x6a3c('0x5e'),'serverUrl',_0x6a3c('0x64'),'refreshToken']})[_0x6a3c('0x25')](handleEntityNotFound(_0x550855,null))['then'](function(_0x79ce8f){_0xcc5b08=_0x79ce8f;_0x34942f=_0xcc5b08['host'];_0xa0b0e9=_0x34942f===_0x6a3c('0x65')?'eu':_0x6a3c('0x66');_0x40b27b=_0xcc5b08[_0x6a3c('0x67')];var _0x47593a=_0x40b27b[_0x6a3c('0x68')](-0x1);if(_0x47593a==='/'||_0x47593a==='\x5c'||_0x47593a===':'){_0x40b27b=_0x40b27b[_0x6a3c('0x69')](0x0,_0x40b27b[_0x6a3c('0x6a')](_0x47593a));}if(!_0xcc5b08[_0x6a3c('0x5d')]){throw new Error(_0x6a3c('0x6b'));}return getAccessToken(_0xcc5b08);})[_0x6a3c('0x25')](function(_0x2ed10e){if(_0x2ed10e){return rp({'method':_0x6a3c('0x6c'),'uri':util[_0x6a3c('0x6d')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xa0b0e9),'qs':{'module':_0x6a3c('0x6e')},'headers':{'Authorization':_0x6a3c('0x6f')+_0x2ed10e},'json':!![]});}})[_0x6a3c('0x25')](function(_0x79d6d){if(_0x79d6d){if(_0x79d6d[_0x6a3c('0x70')]&&_0x79d6d[_0x6a3c('0x70')][_0x6a3c('0x26')]){throw new Error(_0x79d6d[_0x6a3c('0x70')][_0x6a3c('0x26')][_0x6a3c('0x71')]);}var _0x4abdaa=[];var _0x303199=[];var _0xb74728=[_0x6a3c('0x72'),_0x6a3c('0x73'),'Description','WhoId',_0x6a3c('0x74'),_0x6a3c('0x75'),_0x6a3c('0x76'),_0x6a3c('0x77')];_0x303199=_[_0x6a3c('0x78')](_0x79d6d[_0x6a3c('0x33')],function(_0x27d0b8){return _0xb74728[_0x6a3c('0x79')](_0x27d0b8['api_name']);});for(var _0x2716c0=0x0;_0x2716c0<_0x303199['length'];_0x2716c0++){if(_0x303199[_0x2716c0][_0x6a3c('0x7a')]===![]){_0x4abdaa[_0x6a3c('0x7b')]({'id':_0x303199[_0x2716c0]['id'],'name':_0x303199[_0x2716c0][_0x6a3c('0x7c')],'custom':_0x303199[_0x2716c0][_0x6a3c('0x7d')],'options':_0x303199[_0x2716c0][_0x6a3c('0x7e')]==='picklist'&&_0x303199[_0x2716c0]['pick_list_values'][_0x6a3c('0x43')]>-0x1?_['map'](_0x303199[_0x2716c0][_0x6a3c('0x7f')],function(_0x22866f){return{'name':_0x22866f,'value':_0x22866f};}):[]});}}return{'count':_0x4abdaa[_0x6a3c('0x43')],'rows':_0x4abdaa};}else{return{'count':0x0,'rows':[]};}})[_0x6a3c('0x25')](respondWithResult(_0x550855,null))['catch'](function(_0x479cc8){var _0x474544=_0x4df011[_0x6a3c('0x31')]['test']?0x1f4:_0x479cc8[_0x6a3c('0x80')]||0x1f4;logger[_0x6a3c('0x26')](_0x6a3c('0x81'),_0x6a3c('0x61'),_0x474544,JSON[_0x6a3c('0x82')](_0x479cc8));delete _0x479cc8['name'];if(_0x474544===0x191){_0x474544=0x190;}_0x550855['status'](_0x474544)[_0x6a3c('0x28')](_0x4df011[_0x6a3c('0x31')][_0x6a3c('0x83')]?{'message':_0x6a3c('0x84'),'statusCode':_0x479cc8[_0x6a3c('0x80')]}:_0x479cc8);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index cd20579..2c1e6ab 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 _0x9e95=['serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','then','parse','refresh_token','refreshToken','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','inspect','catch','https://accounts.zoho.com','application/x-www-form-urlencoded','name','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed'];(function(_0x4aacd6,_0x4ae629){var _0x527d40=function(_0x16150a){while(--_0x16150a){_0x4aacd6['push'](_0x4aacd6['shift']());}};_0x527d40(++_0x4ae629);}(_0x9e95,0xc9));var _0x59e9=function(_0x146d4d,_0x26112e){_0x146d4d=_0x146d4d-0x0;var _0x30d545=_0x9e95[_0x146d4d];return _0x30d545;};'use strict';var _=require(_0x59e9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x59e9('0x1'));var moment=require(_0x59e9('0x2'));var BPromise=require(_0x59e9('0x3'));var rp=require(_0x59e9('0x4'));var fs=require('fs');var path=require(_0x59e9('0x5'));var rimraf=require(_0x59e9('0x6'));var config=require(_0x59e9('0x7'));var attributes=require(_0x59e9('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x59e9('0x9')]=function(_0x30c7ce,_0x4aab11){return _0x30c7ce[_0x59e9('0xa')](_0x59e9('0xb'),attributes,{'tableName':_0x59e9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x433b29,_0x6ab5d3,_0x7d279c){if(_0x433b29['changed']('zone')||_0x433b29[_0x59e9('0xd')](_0x59e9('0xe'))||_0x433b29[_0x59e9('0xd')](_0x59e9('0xf'))||_0x433b29[_0x59e9('0xd')](_0x59e9('0x10'))||_0x433b29[_0x59e9('0xd')](_0x59e9('0x11'))||_0x433b29[_0x59e9('0xd')](_0x59e9('0x12'))){var _0x2c1762,_0x13f2fb;_0x2c1762=_0x433b29[_0x59e9('0xe')];var _0x2dca9c=_0x2c1762[_0x59e9('0x13')](-0x1);if(_0x2dca9c==='/'||_0x2dca9c==='\x5c'||_0x2dca9c===':'){_0x2c1762=_0x2c1762[_0x59e9('0x14')](0x0,_0x2c1762[_0x59e9('0x15')](_0x2dca9c));}switch(_0x433b29[_0x59e9('0x16')]){case'US':_0x13f2fb='https://accounts.zoho.com';break;case'AU':_0x13f2fb=_0x59e9('0x17');break;case'IN':_0x13f2fb=_0x59e9('0x18');break;case'CN':_0x13f2fb=_0x59e9('0x19');break;default:_0x13f2fb=_0x59e9('0x1a');break;}var _0x58ce02={'method':_0x59e9('0x1b'),'uri':_0x13f2fb+_0x59e9('0x1c'),'form':{'grant_type':_0x59e9('0x1d'),'client_id':_0x433b29[_0x59e9('0xf')],'client_secret':_0x433b29[_0x59e9('0x10')],'redirect_uri':_0x433b29[_0x59e9('0xe')],'code':_0x433b29[_0x59e9('0x11')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x58ce02)[_0x59e9('0x1e')](function(_0x28214f){var _0x441f82=JSON[_0x59e9('0x1f')](_0x28214f);if(_0x441f82[_0x59e9('0x20')]){_0x433b29[_0x59e9('0x21')]=_0x441f82[_0x59e9('0x20')];logger['info'](util[_0x59e9('0x22')](_0x59e9('0x23'),_0x433b29['name'],_0x433b29['id']));}else{logger[_0x59e9('0x24')](util[_0x59e9('0x22')](_0x59e9('0x25'),_0x433b29['name'],_0x433b29['id']),util[_0x59e9('0x26')](_0x441f82,{'showHidden':![],'depth':null}));}return _0x7d279c(null,_0x6ab5d3);})[_0x59e9('0x27')](function(_0x5ad4a0){logger[_0x59e9('0x24')](util['format'](_0x59e9('0x25'),_0x433b29['name'],_0x433b29['id']),util[_0x59e9('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x7d279c(_0x5ad4a0);});}else{return _0x7d279c(null,_0x6ab5d3);}},'beforeUpdate':function(_0x1846e5,_0x370ad0,_0x2cabd7){if(_0x1846e5[_0x59e9('0xd')](_0x59e9('0x16'))||_0x1846e5['changed']('serverUrl')||_0x1846e5[_0x59e9('0xd')](_0x59e9('0xf'))||_0x1846e5[_0x59e9('0xd')]('clientSecret')||_0x1846e5[_0x59e9('0xd')](_0x59e9('0x11'))||_0x1846e5[_0x59e9('0xd')](_0x59e9('0x12'))){var _0x4f025e,_0x58f5af;_0x4f025e=_0x1846e5['serverUrl'];var _0x26e935=_0x4f025e[_0x59e9('0x13')](-0x1);if(_0x26e935==='/'||_0x26e935==='\x5c'||_0x26e935===':'){_0x4f025e=_0x4f025e[_0x59e9('0x14')](0x0,_0x4f025e[_0x59e9('0x15')](_0x26e935));}switch(_0x1846e5[_0x59e9('0x16')]){case'US':_0x58f5af=_0x59e9('0x28');break;case'AU':_0x58f5af=_0x59e9('0x17');break;case'IN':_0x58f5af='https://accounts.zoho.in';break;case'CN':_0x58f5af='https://accounts.zoho.com.cn';break;default:_0x58f5af=_0x59e9('0x1a');break;}var _0x2950ef={'method':_0x59e9('0x1b'),'uri':_0x58f5af+_0x59e9('0x1c'),'form':{'grant_type':_0x59e9('0x1d'),'client_id':_0x1846e5[_0x59e9('0xf')],'client_secret':_0x1846e5[_0x59e9('0x10')],'redirect_uri':_0x1846e5['serverUrl'],'code':_0x1846e5[_0x59e9('0x11')]},'headers':{'Content-Type':_0x59e9('0x29')}};return rp(_0x2950ef)[_0x59e9('0x1e')](function(_0x140831){var _0x39f1af=JSON['parse'](_0x140831);if(_0x39f1af[_0x59e9('0x20')]){_0x1846e5[_0x59e9('0x21')]=_0x39f1af[_0x59e9('0x20')];logger['info'](util[_0x59e9('0x22')](_0x59e9('0x23'),_0x1846e5[_0x59e9('0x2a')],_0x1846e5['id']));}else{logger['error'](util[_0x59e9('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1846e5[_0x59e9('0x2a')],_0x1846e5['id']),util[_0x59e9('0x26')](_0x39f1af,{'showHidden':![],'depth':null}));}return _0x2cabd7(null,_0x370ad0);})[_0x59e9('0x27')](function(_0x243a6a){logger['error'](util[_0x59e9('0x22')](_0x59e9('0x25'),_0x1846e5[_0x59e9('0x2a')],_0x1846e5['id']),util[_0x59e9('0x26')](parsedResult,{'showHidden':![],'depth':null}));return _0x2cabd7(_0x243a6a);});}else{return _0x2cabd7(null,_0x370ad0);}}}});}; \ No newline at end of file +var _0xbedc=['ZohoAccount','int_zoho_accounts','changed','zone','clientId','clientSecret','code','host','serverUrl','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x6ea81a,_0x5c03ed){var _0x371747=function(_0x39cc6f){while(--_0x39cc6f){_0x6ea81a['push'](_0x6ea81a['shift']());}};_0x371747(++_0x5c03ed);}(_0xbedc,0x1c0));var _0xcbed=function(_0x4f2031,_0x37a74d){_0x4f2031=_0x4f2031-0x0;var _0x5984df=_0xbedc[_0x4f2031];return _0x5984df;};'use strict';var _=require('lodash');var util=require(_0xcbed('0x0'));var logger=require(_0xcbed('0x1'))('api');var moment=require(_0xcbed('0x2'));var BPromise=require(_0xcbed('0x3'));var rp=require(_0xcbed('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcbed('0x5'));var config=require(_0xcbed('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xcbed('0x7')]=function(_0x53d201,_0x24a0e0){return _0x53d201['define'](_0xcbed('0x8'),attributes,{'tableName':_0xcbed('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xdbf9de,_0x2f3f8e,_0x40ca58){if(_0xdbf9de[_0xcbed('0xa')](_0xcbed('0xb'))||_0xdbf9de[_0xcbed('0xa')]('serverUrl')||_0xdbf9de['changed'](_0xcbed('0xc'))||_0xdbf9de[_0xcbed('0xa')](_0xcbed('0xd'))||_0xdbf9de[_0xcbed('0xa')](_0xcbed('0xe'))||_0xdbf9de[_0xcbed('0xa')](_0xcbed('0xf'))){var _0x420f17,_0x1b507f;_0x420f17=_0xdbf9de[_0xcbed('0x10')];var _0x45c83f=_0x420f17[_0xcbed('0x11')](-0x1);if(_0x45c83f==='/'||_0x45c83f==='\x5c'||_0x45c83f===':'){_0x420f17=_0x420f17[_0xcbed('0x12')](0x0,_0x420f17['lastIndexOf'](_0x45c83f));}switch(_0xdbf9de[_0xcbed('0xb')]){case'US':_0x1b507f=_0xcbed('0x13');break;case'AU':_0x1b507f=_0xcbed('0x14');break;case'IN':_0x1b507f=_0xcbed('0x15');break;case'CN':_0x1b507f=_0xcbed('0x16');break;default:_0x1b507f=_0xcbed('0x17');break;}var _0x3f3e60={'method':_0xcbed('0x18'),'uri':_0x1b507f+'/oauth/v2/token','form':{'grant_type':_0xcbed('0x19'),'client_id':_0xdbf9de[_0xcbed('0xc')],'client_secret':_0xdbf9de[_0xcbed('0xd')],'redirect_uri':_0xdbf9de[_0xcbed('0x10')],'code':_0xdbf9de['code']},'headers':{'Content-Type':_0xcbed('0x1a')}};return rp(_0x3f3e60)[_0xcbed('0x1b')](function(_0x4b4daf){var _0x33ce79=JSON[_0xcbed('0x1c')](_0x4b4daf);if(_0x33ce79[_0xcbed('0x1d')]){_0xdbf9de['refreshToken']=_0x33ce79[_0xcbed('0x1d')];logger['info'](util[_0xcbed('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0xdbf9de[_0xcbed('0x1f')],_0xdbf9de['id']));}else{logger[_0xcbed('0x20')](util['format'](_0xcbed('0x21'),_0xdbf9de[_0xcbed('0x1f')],_0xdbf9de['id']),util[_0xcbed('0x22')](_0x33ce79,{'showHidden':![],'depth':null}));}return _0x40ca58(null,_0x2f3f8e);})[_0xcbed('0x23')](function(_0x4797a9){logger[_0xcbed('0x20')](util[_0xcbed('0x1e')](_0xcbed('0x21'),_0xdbf9de[_0xcbed('0x1f')],_0xdbf9de['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x40ca58(_0x4797a9);});}else{return _0x40ca58(null,_0x2f3f8e);}},'beforeUpdate':function(_0x11afd7,_0x70837a,_0x513512){if(_0x11afd7[_0xcbed('0xa')]('zone')||_0x11afd7['changed']('serverUrl')||_0x11afd7[_0xcbed('0xa')](_0xcbed('0xc'))||_0x11afd7['changed'](_0xcbed('0xd'))||_0x11afd7[_0xcbed('0xa')]('code')||_0x11afd7[_0xcbed('0xa')]('host')){var _0x42b395,_0x1d575f;_0x42b395=_0x11afd7[_0xcbed('0x10')];var _0x50d324=_0x42b395[_0xcbed('0x11')](-0x1);if(_0x50d324==='/'||_0x50d324==='\x5c'||_0x50d324===':'){_0x42b395=_0x42b395[_0xcbed('0x12')](0x0,_0x42b395[_0xcbed('0x24')](_0x50d324));}switch(_0x11afd7[_0xcbed('0xb')]){case'US':_0x1d575f=_0xcbed('0x13');break;case'AU':_0x1d575f=_0xcbed('0x14');break;case'IN':_0x1d575f=_0xcbed('0x15');break;case'CN':_0x1d575f=_0xcbed('0x16');break;default:_0x1d575f=_0xcbed('0x17');break;}var _0x2c3f5a={'method':_0xcbed('0x18'),'uri':_0x1d575f+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x11afd7[_0xcbed('0xc')],'client_secret':_0x11afd7['clientSecret'],'redirect_uri':_0x11afd7['serverUrl'],'code':_0x11afd7['code']},'headers':{'Content-Type':_0xcbed('0x1a')}};return rp(_0x2c3f5a)[_0xcbed('0x1b')](function(_0x3b2f67){var _0x4a0258=JSON[_0xcbed('0x1c')](_0x3b2f67);if(_0x4a0258[_0xcbed('0x1d')]){_0x11afd7['refreshToken']=_0x4a0258[_0xcbed('0x1d')];logger['info'](util[_0xcbed('0x1e')](_0xcbed('0x25'),_0x11afd7[_0xcbed('0x1f')],_0x11afd7['id']));}else{logger[_0xcbed('0x20')](util[_0xcbed('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x11afd7[_0xcbed('0x1f')],_0x11afd7['id']),util['inspect'](_0x4a0258,{'showHidden':![],'depth':null}));}return _0x513512(null,_0x70837a);})['catch'](function(_0xc6808){logger['error'](util[_0xcbed('0x1e')](_0xcbed('0x21'),_0x11afd7[_0xcbed('0x1f')],_0x11afd7['id']),util[_0xcbed('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x513512(_0xc6808);});}else{return _0x513512(null,_0x70837a);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3b7980a..1474ea4 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 _0x5b12=['where','include','model','attributes','map','ShowZohoAccount','find','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','options'];(function(_0xcb0ee7,_0x240a3f){var _0x1a5966=function(_0x487e85){while(--_0x487e85){_0xcb0ee7['push'](_0xcb0ee7['shift']());}};_0x1a5966(++_0x240a3f);}(_0x5b12,0xa3));var _0x25b1=function(_0x18a95b,_0x51ba10){_0x18a95b=_0x18a95b-0x0;var _0x2adeff=_0x5b12[_0x18a95b];return _0x2adeff;};'use strict';var _=require(_0x25b1('0x0'));var util=require(_0x25b1('0x1'));var moment=require(_0x25b1('0x2'));var BPromise=require('bluebird');var rs=require(_0x25b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x25b1('0x4'))['db'];var utils=require(_0x25b1('0x5'));var logger=require('../../config/logger')(_0x25b1('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x25b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb95b,_0x1f715d,_0x28c980){return new BPromise(function(_0x451c66,_0x2a46e0){return client[_0x25b1('0x8')](_0x5bb95b,_0x28c980)[_0x25b1('0x9')](function(_0x3346ed){logger[_0x25b1('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x1f715d,_0x25b1('0xb'));logger[_0x25b1('0xc')](_0x25b1('0xd'),_0x1f715d,_0x25b1('0xb'),JSON[_0x25b1('0xe')](_0x3346ed));if(_0x3346ed[_0x25b1('0xf')]){if(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x10')]===0x1f4){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);return _0x2a46e0(_0x3346ed[_0x25b1('0xf')][_0x25b1('0x12')]);}logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x3346ed['error'][_0x25b1('0x12')]);return _0x451c66(_0x3346ed[_0x25b1('0xf')]['message']);}else{logger[_0x25b1('0xa')](_0x25b1('0x11'),_0x1f715d,_0x25b1('0xb'));_0x451c66(_0x3346ed['result']['message']);}})[_0x25b1('0x13')](function(_0x573ec2){logger[_0x25b1('0xf')](_0x25b1('0x11'),_0x1f715d,_0x573ec2);_0x2a46e0(_0x573ec2);});});}exports[_0x25b1('0x14')]=function(_0x27ccc9){var _0x1f78c2=this;return new Promise(function(_0x2a7d14,_0x17024a){return db[_0x25b1('0x15')]['findAll']({'raw':_0x27ccc9['options']?_0x27ccc9[_0x25b1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options'][_0x25b1('0x17')]||null:null,'attributes':_0x27ccc9['options']?_0x27ccc9[_0x25b1('0x16')]['attributes']||null:null,'limit':_0x27ccc9[_0x25b1('0x16')]?_0x27ccc9['options']['limit']||null:null,'include':_0x27ccc9['options']?_0x27ccc9[_0x25b1('0x16')][_0x25b1('0x18')]?_['map'](_0x27ccc9[_0x25b1('0x16')][_0x25b1('0x18')],function(_0x1e5915){return{'model':db[_0x1e5915[_0x25b1('0x19')]],'as':_0x1e5915['as'],'attributes':_0x1e5915[_0x25b1('0x1a')],'include':_0x1e5915['include']?_[_0x25b1('0x1b')](_0x1e5915[_0x25b1('0x18')],function(_0xd22469){return{'model':db[_0xd22469[_0x25b1('0x19')]],'as':_0xd22469['as'],'attributes':_0xd22469[_0x25b1('0x1a')],'include':_0xd22469[_0x25b1('0x18')]?_['map'](_0xd22469[_0x25b1('0x18')],function(_0x27dd68){return{'model':db[_0x27dd68[_0x25b1('0x19')]],'as':_0x27dd68['as'],'attributes':_0x27dd68['attributes']};}):[]};}):[]};}):[]:[]})[_0x25b1('0x9')](function(_0x9e175f){logger[_0x25b1('0xa')]('GetZohoAccount',_0x27ccc9);logger[_0x25b1('0xc')]('GetZohoAccount',_0x27ccc9,JSON[_0x25b1('0xe')](_0x9e175f));_0x2a7d14(_0x9e175f);})[_0x25b1('0x13')](function(_0x3a4475){logger[_0x25b1('0xf')](_0x25b1('0x14'),_0x3a4475[_0x25b1('0x12')],_0x27ccc9);_0x17024a(_0x1f78c2[_0x25b1('0xf')](0x1f4,_0x3a4475['message']));});});};exports[_0x25b1('0x1c')]=function(_0xca56f0){var _0x925e99=this;return new Promise(function(_0x26f323,_0x274205){return db['ZohoAccount'][_0x25b1('0x1d')]({'raw':_0xca56f0[_0x25b1('0x16')]?_0xca56f0[_0x25b1('0x16')][_0x25b1('0x1e')]===undefined?!![]:![]:!![],'where':_0xca56f0[_0x25b1('0x16')]?_0xca56f0['options']['where']||null:null,'attributes':_0xca56f0[_0x25b1('0x16')]?_0xca56f0['options'][_0x25b1('0x1a')]||null:null,'include':_0xca56f0[_0x25b1('0x16')]?_0xca56f0[_0x25b1('0x16')]['include']?_['map'](_0xca56f0[_0x25b1('0x16')][_0x25b1('0x18')],function(_0x26d3bc){return{'model':db[_0x26d3bc['model']],'as':_0x26d3bc['as'],'attributes':_0x26d3bc[_0x25b1('0x1a')],'include':_0x26d3bc[_0x25b1('0x18')]?_[_0x25b1('0x1b')](_0x26d3bc[_0x25b1('0x18')],function(_0x54f598){return{'model':db[_0x54f598[_0x25b1('0x19')]],'as':_0x54f598['as'],'attributes':_0x54f598[_0x25b1('0x1a')],'include':_0x54f598[_0x25b1('0x18')]?_['map'](_0x54f598['include'],function(_0x357b50){return{'model':db[_0x357b50['model']],'as':_0x357b50['as'],'attributes':_0x357b50[_0x25b1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x25b1('0x9')](function(_0x3ea659){logger[_0x25b1('0xa')](_0x25b1('0x1c'),_0xca56f0);logger[_0x25b1('0xc')](_0x25b1('0x1c'),_0xca56f0,JSON[_0x25b1('0xe')](_0x3ea659));_0x26f323(_0x3ea659);})[_0x25b1('0x13')](function(_0x154f8f){logger[_0x25b1('0xf')](_0x25b1('0x1c'),_0x154f8f[_0x25b1('0x12')],_0xca56f0);_0x274205(_0x925e99[_0x25b1('0xf')](0x1f4,_0x154f8f[_0x25b1('0x12')]));});});}; \ No newline at end of file +var _0x8383=['message','info','result','ZohoAccount','options','raw','where','limit','include','map','attributes','model','GetZohoAccount','catch','find','ShowZohoAccount','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8383,0x98));var _0x3838=function(_0x3910cc,_0x380744){_0x3910cc=_0x3910cc-0x0;var _0x51ab60=_0x8383[_0x3910cc];return _0x51ab60;};'use strict';var _=require(_0x3838('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3838('0x1'));var rs=require(_0x3838('0x2'));var fs=require('fs');var Redis=require(_0x3838('0x3'));var db=require(_0x3838('0x4'))['db'];var utils=require(_0x3838('0x5'));var logger=require(_0x3838('0x6'))(_0x3838('0x7'));var config=require(_0x3838('0x8'));var jayson=require(_0x3838('0x9'));var client=jayson[_0x3838('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239750,_0x235001,_0x4cf52b){return new BPromise(function(_0x2abbda,_0x5e2e42){return client[_0x3838('0xb')](_0x239750,_0x4cf52b)[_0x3838('0xc')](function(_0x340c39){logger['info'](_0x3838('0xd'),_0x235001,_0x3838('0xe'));logger[_0x3838('0xf')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x235001,_0x3838('0xe'),JSON[_0x3838('0x10')](_0x340c39));if(_0x340c39[_0x3838('0x11')]){if(_0x340c39[_0x3838('0x11')]['code']===0x1f4){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')]['message']);return _0x5e2e42(_0x340c39[_0x3838('0x11')]['message']);}logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')][_0x3838('0x12')]);return _0x2abbda(_0x340c39[_0x3838('0x11')]['message']);}else{logger[_0x3838('0x13')](_0x3838('0xd'),_0x235001,_0x3838('0xe'));_0x2abbda(_0x340c39[_0x3838('0x14')][_0x3838('0x12')]);}})['catch'](function(_0x464fd9){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x464fd9);_0x5e2e42(_0x464fd9);});});}exports['GetZohoAccount']=function(_0x45aa66){var _0x14379b=this;return new Promise(function(_0x4a9a7a,_0xf69d52){return db[_0x3838('0x15')]['findAll']({'raw':_0x45aa66[_0x3838('0x16')]?_0x45aa66['options'][_0x3838('0x17')]===undefined?!![]:![]:!![],'where':_0x45aa66[_0x3838('0x16')]?_0x45aa66[_0x3838('0x16')][_0x3838('0x18')]||null:null,'attributes':_0x45aa66[_0x3838('0x16')]?_0x45aa66['options']['attributes']||null:null,'limit':_0x45aa66[_0x3838('0x16')]?_0x45aa66['options'][_0x3838('0x19')]||null:null,'include':_0x45aa66[_0x3838('0x16')]?_0x45aa66[_0x3838('0x16')][_0x3838('0x1a')]?_[_0x3838('0x1b')](_0x45aa66[_0x3838('0x16')][_0x3838('0x1a')],function(_0x1e8d61){return{'model':db[_0x1e8d61['model']],'as':_0x1e8d61['as'],'attributes':_0x1e8d61[_0x3838('0x1c')],'include':_0x1e8d61['include']?_[_0x3838('0x1b')](_0x1e8d61[_0x3838('0x1a')],function(_0x55eaa5){return{'model':db[_0x55eaa5[_0x3838('0x1d')]],'as':_0x55eaa5['as'],'attributes':_0x55eaa5[_0x3838('0x1c')],'include':_0x55eaa5['include']?_[_0x3838('0x1b')](_0x55eaa5[_0x3838('0x1a')],function(_0x537f85){return{'model':db[_0x537f85[_0x3838('0x1d')]],'as':_0x537f85['as'],'attributes':_0x537f85['attributes']};}):[]};}):[]};}):[]:[]})[_0x3838('0xc')](function(_0x5c26b9){logger['info'](_0x3838('0x1e'),_0x45aa66);logger[_0x3838('0xf')](_0x3838('0x1e'),_0x45aa66,JSON[_0x3838('0x10')](_0x5c26b9));_0x4a9a7a(_0x5c26b9);})[_0x3838('0x1f')](function(_0x4b6519){logger[_0x3838('0x11')](_0x3838('0x1e'),_0x4b6519[_0x3838('0x12')],_0x45aa66);_0xf69d52(_0x14379b['error'](0x1f4,_0x4b6519[_0x3838('0x12')]));});});};exports['ShowZohoAccount']=function(_0x2549bd){var _0x4b1a0c=this;return new Promise(function(_0x441a7f,_0x2a725c){return db['ZohoAccount'][_0x3838('0x20')]({'raw':_0x2549bd['options']?_0x2549bd['options'][_0x3838('0x17')]===undefined?!![]:![]:!![],'where':_0x2549bd[_0x3838('0x16')]?_0x2549bd['options']['where']||null:null,'attributes':_0x2549bd[_0x3838('0x16')]?_0x2549bd['options'][_0x3838('0x1c')]||null:null,'include':_0x2549bd[_0x3838('0x16')]?_0x2549bd[_0x3838('0x16')][_0x3838('0x1a')]?_[_0x3838('0x1b')](_0x2549bd[_0x3838('0x16')]['include'],function(_0x21de44){return{'model':db[_0x21de44[_0x3838('0x1d')]],'as':_0x21de44['as'],'attributes':_0x21de44[_0x3838('0x1c')],'include':_0x21de44[_0x3838('0x1a')]?_[_0x3838('0x1b')](_0x21de44[_0x3838('0x1a')],function(_0xc2262b){return{'model':db[_0xc2262b[_0x3838('0x1d')]],'as':_0xc2262b['as'],'attributes':_0xc2262b[_0x3838('0x1c')],'include':_0xc2262b[_0x3838('0x1a')]?_[_0x3838('0x1b')](_0xc2262b['include'],function(_0x470704){return{'model':db[_0x470704[_0x3838('0x1d')]],'as':_0x470704['as'],'attributes':_0x470704[_0x3838('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3838('0xc')](function(_0x5ad388){logger[_0x3838('0x13')](_0x3838('0x21'),_0x2549bd);logger[_0x3838('0xf')](_0x3838('0x21'),_0x2549bd,JSON['stringify'](_0x5ad388));_0x441a7f(_0x5ad388);})[_0x3838('0x1f')](function(_0x3c8ceb){logger[_0x3838('0x11')](_0x3838('0x21'),_0x3c8ceb['message'],_0x2549bd);_0x2a725c(_0x4b1a0c[_0x3838('0x11')](0x1f4,_0x3c8ceb[_0x3838('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 5195dd6..b6d47c8 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 _0xeaa2=['exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy'];(function(_0xc3f706,_0x22d505){var _0x1b63cf=function(_0x33368a){while(--_0x33368a){_0xc3f706['push'](_0xc3f706['shift']());}};_0x1b63cf(++_0x22d505);}(_0xeaa2,0x199));var _0x2eaa=function(_0x40bc32,_0x428c83){_0x40bc32=_0x40bc32-0x0;var _0x2351e3=_0xeaa2[_0x40bc32];return _0x2351e3;};'use strict';var multer=require('multer');var util=require(_0x2eaa('0x0'));var path=require('path');var timeout=require(_0x2eaa('0x1'));var express=require(_0x2eaa('0x2'));var router=express['Router']();var fs_extra=require(_0x2eaa('0x3'));var auth=require(_0x2eaa('0x4'));var interaction=require(_0x2eaa('0x5'));var config=require(_0x2eaa('0x6'));var controller=require(_0x2eaa('0x7'));router[_0x2eaa('0x8')]('/',auth[_0x2eaa('0x9')](),controller['index']);router[_0x2eaa('0x8')](_0x2eaa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x2eaa('0x8')](_0x2eaa('0xb'),auth[_0x2eaa('0x9')](),controller[_0x2eaa('0xc')]);router[_0x2eaa('0x8')](_0x2eaa('0xd'),auth[_0x2eaa('0x9')](),controller[_0x2eaa('0xe')]);router['get'](_0x2eaa('0xf'),auth[_0x2eaa('0x9')](),controller[_0x2eaa('0x10')]);router[_0x2eaa('0x11')]('/',auth[_0x2eaa('0x9')](),controller[_0x2eaa('0x12')]);router[_0x2eaa('0x13')](_0x2eaa('0xa'),auth[_0x2eaa('0x9')](),controller[_0x2eaa('0x14')]);router[_0x2eaa('0x15')](_0x2eaa('0xa'),auth[_0x2eaa('0x9')](),controller[_0x2eaa('0x16')]);module[_0x2eaa('0x17')]=router; \ No newline at end of file +var _0xe13f=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields'];(function(_0x13068f,_0x1da78d){var _0x4fc6f3=function(_0x1754e4){while(--_0x1754e4){_0x13068f['push'](_0x13068f['shift']());}};_0x4fc6f3(++_0x1da78d);}(_0xe13f,0x1dd));var _0xfe13=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe13f[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0xfe13('0x0'));var util=require(_0xfe13('0x1'));var path=require(_0xfe13('0x2'));var timeout=require(_0xfe13('0x3'));var express=require(_0xfe13('0x4'));var router=express[_0xfe13('0x5')]();var fs_extra=require(_0xfe13('0x6'));var auth=require(_0xfe13('0x7'));var interaction=require(_0xfe13('0x8'));var config=require(_0xfe13('0x9'));var controller=require(_0xfe13('0xa'));router[_0xfe13('0xb')]('/',auth[_0xfe13('0xc')](),controller[_0xfe13('0xd')]);router[_0xfe13('0xb')]('/:id',auth[_0xfe13('0xc')](),controller[_0xfe13('0xe')]);router['get'](_0xfe13('0xf'),auth[_0xfe13('0xc')](),controller[_0xfe13('0x10')]);router[_0xfe13('0xb')](_0xfe13('0x11'),auth[_0xfe13('0xc')](),controller[_0xfe13('0x12')]);router[_0xfe13('0xb')](_0xfe13('0x13'),auth[_0xfe13('0xc')](),controller[_0xfe13('0x14')]);router[_0xfe13('0x15')]('/',auth['isAuthenticated'](),controller[_0xfe13('0x16')]);router[_0xfe13('0x17')]('/:id',auth[_0xfe13('0xc')](),controller[_0xfe13('0x18')]);router[_0xfe13('0x19')](_0xfe13('0x1a'),auth[_0xfe13('0xc')](),controller[_0xfe13('0x1b')]);module[_0xfe13('0x1c')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index aa48899..fef4601 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 _0x9a39=['contact','nothing','contact_lead','sequelize','exports','STRING','ENUM','lead'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a39,0x133));var _0x99a3=function(_0x52d358,_0x4fc692){_0x52d358=_0x52d358-0x0;var _0x4f1cff=_0x9a39[_0x52d358];return _0x4f1cff;};'use strict';var Sequelize=require(_0x99a3('0x0'));module[_0x99a3('0x1')]={'name':{'type':Sequelize[_0x99a3('0x2')]},'moduleCreate':{'type':Sequelize[_0x99a3('0x3')](_0x99a3('0x4'),_0x99a3('0x5'),_0x99a3('0x6')),'defaultValue':_0x99a3('0x4')},'moduleSearch':{'type':Sequelize[_0x99a3('0x3')](_0x99a3('0x7'),_0x99a3('0x5'),_0x99a3('0x4')),'defaultValue':_0x99a3('0x7')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x341c=['exports','ENUM','nothing','lead','contact_lead','contact','STRING'];(function(_0x3b249a,_0x3300e6){var _0xb9ddc=function(_0x12c361){while(--_0x12c361){_0x3b249a['push'](_0x3b249a['shift']());}};_0xb9ddc(++_0x3300e6);}(_0x341c,0xb6));var _0xc341=function(_0x273b7e,_0x1b642f){_0x273b7e=_0x273b7e-0x0;var _0x5df145=_0x341c[_0x273b7e];return _0x5df145;};'use strict';var Sequelize=require('sequelize');module[_0xc341('0x0')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xc341('0x1')]('lead','contact',_0xc341('0x2')),'defaultValue':_0xc341('0x3')},'moduleSearch':{'type':Sequelize[_0xc341('0x1')](_0xc341('0x4'),_0xc341('0x5'),'lead'),'defaultValue':_0xc341('0x4')},'description':{'type':Sequelize[_0xc341('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index d0a293f..0b0965e 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 _0x4752=['find','create','body','catch','getFields','findOne','ZohoField','pick','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','findAll','show','params','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4752,0xaa));var _0x2475=function(_0x1dea9f,_0x125553){_0x1dea9f=_0x1dea9f-0x0;var _0x5b7853=_0x4752[_0x1dea9f];return _0x5b7853;};'use strict';var emlformat=require(_0x2475('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2475('0x1'));var rp=require(_0x2475('0x2'));var moment=require(_0x2475('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2475('0x4'));var util=require(_0x2475('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x2475('0x6'));var ejs=require(_0x2475('0x7'));var fs=require('fs');var fs_extra=require(_0x2475('0x8'));var _=require('lodash');var squel=require(_0x2475('0x9'));var crypto=require('crypto');var jsforce=require(_0x2475('0xa'));var deskjs=require(_0x2475('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2475('0xc'));var Papa=require(_0x2475('0xd'));var Redis=require(_0x2475('0xe'));var authService=require(_0x2475('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2475('0x10'));var logger=require(_0x2475('0x11'))(_0x2475('0x12'));var utils=require(_0x2475('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2475('0x14'));var db=require(_0x2475('0x15'))['db'];function respondWithStatusCode(_0x2e94f7,_0x5d7b56){_0x5d7b56=_0x5d7b56||0xcc;return function(_0x4ff2a8){if(_0x4ff2a8){return _0x2e94f7[_0x2475('0x16')](_0x5d7b56);}return _0x2e94f7[_0x2475('0x17')](_0x5d7b56)[_0x2475('0x18')]();};}function respondWithResult(_0x10e19d,_0x1786a0){_0x1786a0=_0x1786a0||0xc8;return function(_0x3db1e8){if(_0x3db1e8){return _0x10e19d['status'](_0x1786a0)[_0x2475('0x19')](_0x3db1e8);}};}function respondWithFilteredResult(_0xd069c6,_0x338d4c){return function(_0x122081){if(_0x122081){var _0x1c5733=typeof _0x338d4c['offset']===_0x2475('0x1a')&&typeof _0x338d4c['limit']===_0x2475('0x1a');var _0x4036e1=_0x122081[_0x2475('0x1b')];var _0x253211=_0x1c5733?0x0:_0x338d4c[_0x2475('0x1c')];var _0x44be89=_0x1c5733?_0x122081[_0x2475('0x1b')]:_0x338d4c[_0x2475('0x1c')]+_0x338d4c[_0x2475('0x1d')];var _0x35cab2;if(_0x44be89>=_0x4036e1){_0x44be89=_0x4036e1;_0x35cab2=0xc8;}else{_0x35cab2=0xce;}_0xd069c6['status'](_0x35cab2);return _0xd069c6[_0x2475('0x1e')](_0x2475('0x1f'),_0x253211+'-'+_0x44be89+'/'+_0x4036e1)[_0x2475('0x19')](_0x122081);}return null;};}function patchUpdates(_0x4b2843){return function(_0xd78537){try{jsonpatch[_0x2475('0x20')](_0xd78537,_0x4b2843,!![]);}catch(_0x3e97b0){return BPromise[_0x2475('0x21')](_0x3e97b0);}return _0xd78537[_0x2475('0x22')]();};}function saveUpdates(_0x63ac84,_0x3e4f8b){return function(_0x3bab93){if(_0x3bab93){return _0x3bab93[_0x2475('0x23')](_0x63ac84)[_0x2475('0x24')](function(_0x175dda){return _0x175dda;});}return null;};}function removeEntity(_0x2e6263,_0x1e71bf){return function(_0x3fd1fb){if(_0x3fd1fb){return _0x3fd1fb[_0x2475('0x25')]()[_0x2475('0x24')](function(){_0x2e6263[_0x2475('0x17')](0xcc)[_0x2475('0x18')]();});}};}function handleEntityNotFound(_0x1e3292,_0x3e9fe3){return function(_0x411de2){if(!_0x411de2){_0x1e3292[_0x2475('0x16')](0x194);}return _0x411de2;};}function handleError(_0x2a1662,_0x48dc55){_0x48dc55=_0x48dc55||0x1f4;return function(_0x2c7253){logger[_0x2475('0x26')](_0x2c7253[_0x2475('0x27')]);if(_0x2c7253[_0x2475('0x28')]){delete _0x2c7253[_0x2475('0x28')];}_0x2a1662[_0x2475('0x17')](_0x48dc55)[_0x2475('0x29')](_0x2c7253);};}exports[_0x2475('0x2a')]=function(_0x4bfc01,_0x3c9865){var _0x2df27a={},_0xd643b2={},_0x2b6c87={'count':0x0,'rows':[]};var _0x452cfd=_[_0x2475('0x2b')](db['ZohoConfiguration'][_0x2475('0x2c')],function(_0x3f8ce0){return{'name':_0x3f8ce0['fieldName'],'type':_0x3f8ce0[_0x2475('0x2d')][_0x2475('0x2e')]};});_0xd643b2[_0x2475('0x2f')]=_[_0x2475('0x2b')](_0x452cfd,_0x2475('0x28'));_0xd643b2[_0x2475('0x30')]=_[_0x2475('0x31')](_0x4bfc01[_0x2475('0x30')]);_0xd643b2[_0x2475('0x32')]=_[_0x2475('0x33')](_0xd643b2[_0x2475('0x2f')],_0xd643b2[_0x2475('0x30')]);_0x2df27a[_0x2475('0x34')]=_[_0x2475('0x33')](_0xd643b2['model'],qs[_0x2475('0x35')](_0x4bfc01[_0x2475('0x30')][_0x2475('0x35')]));_0x2df27a[_0x2475('0x34')]=_0x2df27a[_0x2475('0x34')]['length']?_0x2df27a['attributes']:_0xd643b2[_0x2475('0x2f')];if(!_0x4bfc01[_0x2475('0x30')][_0x2475('0x36')](_0x2475('0x37'))){_0x2df27a[_0x2475('0x1d')]=qs[_0x2475('0x1d')](_0x4bfc01['query'][_0x2475('0x1d')]);_0x2df27a[_0x2475('0x1c')]=qs['offset'](_0x4bfc01[_0x2475('0x30')]['offset']);}_0x2df27a[_0x2475('0x38')]=qs['sort'](_0x4bfc01[_0x2475('0x30')][_0x2475('0x39')]);_0x2df27a[_0x2475('0x3a')]=qs[_0x2475('0x32')](_['pick'](_0x4bfc01[_0x2475('0x30')],_0xd643b2[_0x2475('0x32')]),_0x452cfd);if(_0x4bfc01['query'][_0x2475('0x3b')]){_0x2df27a[_0x2475('0x3a')]=_[_0x2475('0x3c')](_0x2df27a['where'],{'$or':_[_0x2475('0x2b')](_0x452cfd,function(_0x3bd584){if(_0x3bd584[_0x2475('0x2d')]!==_0x2475('0x3d')){var _0x3f4083={};_0x3f4083[_0x3bd584[_0x2475('0x28')]]={'$like':'%'+_0x4bfc01['query'][_0x2475('0x3b')]+'%'};return _0x3f4083;}})});}_0x2df27a=_[_0x2475('0x3c')]({},_0x2df27a,_0x4bfc01[_0x2475('0x3e')]);var _0x239f2a={'where':_0x2df27a['where']};return db[_0x2475('0x3f')]['count'](_0x239f2a)[_0x2475('0x24')](function(_0x1fde51){_0x2b6c87[_0x2475('0x1b')]=_0x1fde51;if(_0x4bfc01[_0x2475('0x30')][_0x2475('0x40')]){_0x2df27a[_0x2475('0x41')]=[{'all':!![]}];}return db[_0x2475('0x3f')][_0x2475('0x42')](_0x2df27a);})[_0x2475('0x24')](function(_0xe17dc6){_0x2b6c87['rows']=_0xe17dc6;return _0x2b6c87;})[_0x2475('0x24')](respondWithFilteredResult(_0x3c9865,_0x2df27a))['catch'](handleError(_0x3c9865,null));};exports[_0x2475('0x43')]=function(_0x3d1296,_0x2a9605){var _0x2c1cf2={'raw':![],'where':{'id':_0x3d1296[_0x2475('0x44')]['id']}},_0x8018c9={};_0x8018c9['model']=_[_0x2475('0x31')](db[_0x2475('0x3f')][_0x2475('0x2c')]);_0x8018c9['query']=_[_0x2475('0x31')](_0x3d1296[_0x2475('0x30')]);_0x8018c9[_0x2475('0x32')]=_['intersection'](_0x8018c9[_0x2475('0x2f')],_0x8018c9[_0x2475('0x30')]);_0x2c1cf2[_0x2475('0x34')]=_['intersection'](_0x8018c9['model'],qs['fields'](_0x3d1296[_0x2475('0x30')][_0x2475('0x35')]));_0x2c1cf2[_0x2475('0x34')]=_0x2c1cf2[_0x2475('0x34')][_0x2475('0x45')]?_0x2c1cf2[_0x2475('0x34')]:_0x8018c9[_0x2475('0x2f')];if(_0x3d1296[_0x2475('0x30')][_0x2475('0x40')]){_0x2c1cf2[_0x2475('0x41')]=[{'all':!![]}];}_0x2c1cf2=_['merge']({},_0x2c1cf2,_0x3d1296[_0x2475('0x3e')]);return db[_0x2475('0x3f')][_0x2475('0x46')](_0x2c1cf2)[_0x2475('0x24')](handleEntityNotFound(_0x2a9605,null))['then'](respondWithResult(_0x2a9605,null))['catch'](handleError(_0x2a9605,null));};exports['create']=function(_0x357473,_0x2c303c){return db[_0x2475('0x3f')][_0x2475('0x47')](_0x357473[_0x2475('0x48')],{})['then'](respondWithResult(_0x2c303c,0xc9))[_0x2475('0x49')](handleError(_0x2c303c,null));};exports[_0x2475('0x23')]=function(_0x58721f,_0x1e064b){if(_0x58721f[_0x2475('0x48')]['id']){delete _0x58721f['body']['id'];}return db[_0x2475('0x3f')]['find']({'where':{'id':_0x58721f['params']['id']}})[_0x2475('0x24')](handleEntityNotFound(_0x1e064b,null))[_0x2475('0x24')](saveUpdates(_0x58721f[_0x2475('0x48')],null))[_0x2475('0x24')](respondWithResult(_0x1e064b,null))[_0x2475('0x49')](handleError(_0x1e064b,null));};exports[_0x2475('0x25')]=function(_0xae820,_0x5a6e8c){return db[_0x2475('0x3f')][_0x2475('0x46')]({'where':{'id':_0xae820[_0x2475('0x44')]['id']}})[_0x2475('0x24')](handleEntityNotFound(_0x5a6e8c,null))[_0x2475('0x24')](removeEntity(_0x5a6e8c,null))[_0x2475('0x49')](handleError(_0x5a6e8c,null));};exports[_0x2475('0x4a')]=function(_0xd7b7ca,_0x31f067,_0x27d296){var _0x562584={};var _0x557b4d={};var _0x4a2c21;var _0x43d173;return db[_0x2475('0x3f')][_0x2475('0x4b')]({'where':{'id':_0xd7b7ca[_0x2475('0x44')]['id']}})[_0x2475('0x24')](handleEntityNotFound(_0x31f067,null))['then'](function(_0x37edd9){if(_0x37edd9){_0x4a2c21=_0x37edd9;_0x557b4d[_0x2475('0x2f')]=_[_0x2475('0x31')](db[_0x2475('0x4c')][_0x2475('0x2c')]);_0x557b4d[_0x2475('0x30')]=_[_0x2475('0x31')](_0xd7b7ca[_0x2475('0x30')]);_0x557b4d[_0x2475('0x32')]=_['intersection'](_0x557b4d[_0x2475('0x2f')],_0x557b4d[_0x2475('0x30')]);_0x562584[_0x2475('0x34')]=_[_0x2475('0x33')](_0x557b4d[_0x2475('0x2f')],qs[_0x2475('0x35')](_0xd7b7ca[_0x2475('0x30')][_0x2475('0x35')]));_0x562584['attributes']=_0x562584[_0x2475('0x34')][_0x2475('0x45')]?_0x562584[_0x2475('0x34')]:_0x557b4d['model'];_0x562584[_0x2475('0x38')]=qs[_0x2475('0x39')](_0xd7b7ca[_0x2475('0x30')][_0x2475('0x39')]);_0x562584['where']=qs[_0x2475('0x32')](_[_0x2475('0x4d')](_0xd7b7ca[_0x2475('0x30')],_0x557b4d['filters']));if(_0xd7b7ca[_0x2475('0x30')][_0x2475('0x3b')]){_0x562584['where']=_['merge'](_0x562584[_0x2475('0x3a')],{'$or':_[_0x2475('0x2b')](_0x562584[_0x2475('0x34')],function(_0x1ad962){var _0x455dca={};_0x455dca[_0x1ad962]={'$like':'%'+_0xd7b7ca[_0x2475('0x30')][_0x2475('0x3b')]+'%'};return _0x455dca;})});}_0x562584=_[_0x2475('0x3c')]({},_0x562584,_0xd7b7ca[_0x2475('0x3e')]);return _0x4a2c21[_0x2475('0x4a')](_0x562584);}})['then'](function(_0xe03dc7){if(_0xe03dc7){_0x43d173=_0xe03dc7[_0x2475('0x45')];if(!_0xd7b7ca[_0x2475('0x30')][_0x2475('0x36')](_0x2475('0x37'))){_0x562584['limit']=qs[_0x2475('0x1d')](_0xd7b7ca[_0x2475('0x30')][_0x2475('0x1d')]);_0x562584['offset']=qs[_0x2475('0x1c')](_0xd7b7ca[_0x2475('0x30')]['offset']);}return _0x4a2c21[_0x2475('0x4a')](_0x562584);}})[_0x2475('0x24')](function(_0x8b8d89){if(_0x8b8d89){return _0x8b8d89?{'count':_0x43d173,'rows':_0x8b8d89}:null;}})[_0x2475('0x24')](respondWithResult(_0x31f067,null))[_0x2475('0x49')](handleError(_0x31f067,null));};exports['getSubjects']=function(_0x52c3fd,_0xacd432,_0x3a48b8){var _0x3c8aec={};var _0x360e4b={};var _0x54262e;var _0x41172b;return db['ZohoConfiguration'][_0x2475('0x4b')]({'where':{'id':_0x52c3fd[_0x2475('0x44')]['id']}})[_0x2475('0x24')](handleEntityNotFound(_0xacd432,null))[_0x2475('0x24')](function(_0x38a862){if(_0x38a862){_0x54262e=_0x38a862;_0x360e4b[_0x2475('0x2f')]=_[_0x2475('0x31')](db['ZohoField'][_0x2475('0x2c')]);_0x360e4b[_0x2475('0x30')]=_['keys'](_0x52c3fd[_0x2475('0x30')]);_0x360e4b[_0x2475('0x32')]=_[_0x2475('0x33')](_0x360e4b['model'],_0x360e4b['query']);_0x3c8aec[_0x2475('0x34')]=_[_0x2475('0x33')](_0x360e4b[_0x2475('0x2f')],qs['fields'](_0x52c3fd[_0x2475('0x30')][_0x2475('0x35')]));_0x3c8aec[_0x2475('0x34')]=_0x3c8aec[_0x2475('0x34')][_0x2475('0x45')]?_0x3c8aec['attributes']:_0x360e4b['model'];_0x3c8aec[_0x2475('0x38')]=qs['sort'](_0x52c3fd[_0x2475('0x30')][_0x2475('0x39')]);_0x3c8aec[_0x2475('0x3a')]=qs['filters'](_[_0x2475('0x4d')](_0x52c3fd[_0x2475('0x30')],_0x360e4b[_0x2475('0x32')]));if(_0x52c3fd[_0x2475('0x30')][_0x2475('0x3b')]){_0x3c8aec['where']=_[_0x2475('0x3c')](_0x3c8aec[_0x2475('0x3a')],{'$or':_[_0x2475('0x2b')](_0x3c8aec['attributes'],function(_0x21795e){var _0x42faf2={};_0x42faf2[_0x21795e]={'$like':'%'+_0x52c3fd[_0x2475('0x30')][_0x2475('0x3b')]+'%'};return _0x42faf2;})});}_0x3c8aec=_[_0x2475('0x3c')]({},_0x3c8aec,_0x52c3fd[_0x2475('0x3e')]);return _0x54262e[_0x2475('0x4e')](_0x3c8aec);}})[_0x2475('0x24')](function(_0x5786f7){if(_0x5786f7){_0x41172b=_0x5786f7[_0x2475('0x45')];if(!_0x52c3fd[_0x2475('0x30')][_0x2475('0x36')](_0x2475('0x37'))){_0x3c8aec['limit']=qs[_0x2475('0x1d')](_0x52c3fd['query'][_0x2475('0x1d')]);_0x3c8aec[_0x2475('0x1c')]=qs[_0x2475('0x1c')](_0x52c3fd[_0x2475('0x30')][_0x2475('0x1c')]);}return _0x54262e['getSubjects'](_0x3c8aec);}})[_0x2475('0x24')](function(_0x5976d1){if(_0x5976d1){return _0x5976d1?{'count':_0x41172b,'rows':_0x5976d1}:null;}})[_0x2475('0x24')](respondWithResult(_0xacd432,null))[_0x2475('0x49')](handleError(_0xacd432,null));};exports[_0x2475('0x4f')]=function(_0x262e4e,_0x14e76b,_0x25c9ac){var _0x2734d6={};var _0x10dc8c={};var _0x398c05;var _0x35c2b0;return db['ZohoConfiguration'][_0x2475('0x4b')]({'where':{'id':_0x262e4e[_0x2475('0x44')]['id']}})[_0x2475('0x24')](handleEntityNotFound(_0x14e76b,null))['then'](function(_0x5bb1ab){if(_0x5bb1ab){_0x398c05=_0x5bb1ab;_0x10dc8c[_0x2475('0x2f')]=_[_0x2475('0x31')](db['ZohoField'][_0x2475('0x2c')]);_0x10dc8c[_0x2475('0x30')]=_['keys'](_0x262e4e[_0x2475('0x30')]);_0x10dc8c[_0x2475('0x32')]=_[_0x2475('0x33')](_0x10dc8c['model'],_0x10dc8c[_0x2475('0x30')]);_0x2734d6['attributes']=_[_0x2475('0x33')](_0x10dc8c[_0x2475('0x2f')],qs[_0x2475('0x35')](_0x262e4e[_0x2475('0x30')][_0x2475('0x35')]));_0x2734d6[_0x2475('0x34')]=_0x2734d6['attributes'][_0x2475('0x45')]?_0x2734d6[_0x2475('0x34')]:_0x10dc8c[_0x2475('0x2f')];_0x2734d6[_0x2475('0x38')]=qs[_0x2475('0x39')](_0x262e4e['query'][_0x2475('0x39')]);_0x2734d6[_0x2475('0x3a')]=qs['filters'](_[_0x2475('0x4d')](_0x262e4e[_0x2475('0x30')],_0x10dc8c['filters']));if(_0x262e4e[_0x2475('0x30')][_0x2475('0x3b')]){_0x2734d6[_0x2475('0x3a')]=_['merge'](_0x2734d6[_0x2475('0x3a')],{'$or':_[_0x2475('0x2b')](_0x2734d6[_0x2475('0x34')],function(_0x4fd49b){var _0x1495bf={};_0x1495bf[_0x4fd49b]={'$like':'%'+_0x262e4e[_0x2475('0x30')][_0x2475('0x3b')]+'%'};return _0x1495bf;})});}_0x2734d6=_[_0x2475('0x3c')]({},_0x2734d6,_0x262e4e[_0x2475('0x3e')]);return _0x398c05[_0x2475('0x4f')](_0x2734d6);}})['then'](function(_0x1eafe7){if(_0x1eafe7){_0x35c2b0=_0x1eafe7[_0x2475('0x45')];if(!_0x262e4e[_0x2475('0x30')][_0x2475('0x36')](_0x2475('0x37'))){_0x2734d6['limit']=qs[_0x2475('0x1d')](_0x262e4e[_0x2475('0x30')]['limit']);_0x2734d6[_0x2475('0x1c')]=qs[_0x2475('0x1c')](_0x262e4e[_0x2475('0x30')][_0x2475('0x1c')]);}return _0x398c05[_0x2475('0x4f')](_0x2734d6);}})[_0x2475('0x24')](function(_0x59063e){if(_0x59063e){return _0x59063e?{'count':_0x35c2b0,'rows':_0x59063e}:null;}})[_0x2475('0x24')](respondWithResult(_0x14e76b,null))[_0x2475('0x49')](handleError(_0x14e76b,null));}; \ No newline at end of file +var _0x0c6a=['model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','ZohoField','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ZohoConfiguration','fieldName','type','key'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x0c6a,0x16f));var _0xa0c6=function(_0x392a06,_0x233e23){_0x392a06=_0x392a06-0x0;var _0x42fb44=_0x0c6a[_0x392a06];return _0x42fb44;};'use strict';var emlformat=require(_0xa0c6('0x0'));var rimraf=require(_0xa0c6('0x1'));var zipdir=require(_0xa0c6('0x2'));var jsonpatch=require(_0xa0c6('0x3'));var rp=require(_0xa0c6('0x4'));var moment=require(_0xa0c6('0x5'));var BPromise=require(_0xa0c6('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa0c6('0x7'));var sox=require(_0xa0c6('0x8'));var csv=require('to-csv');var ejs=require(_0xa0c6('0x9'));var fs=require('fs');var fs_extra=require(_0xa0c6('0xa'));var _=require(_0xa0c6('0xb'));var squel=require(_0xa0c6('0xc'));var crypto=require(_0xa0c6('0xd'));var jsforce=require(_0xa0c6('0xe'));var deskjs=require(_0xa0c6('0xf'));var toCsv=require(_0xa0c6('0x10'));var querystring=require('querystring');var Papa=require(_0xa0c6('0x11'));var Redis=require(_0xa0c6('0x12'));var authService=require(_0xa0c6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa0c6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa0c6('0x15'));var utils=require(_0xa0c6('0x16'));var config=require(_0xa0c6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa0c6('0x18'))['db'];function respondWithStatusCode(_0x5e8ff8,_0x22fae9){_0x22fae9=_0x22fae9||0xcc;return function(_0x488965){if(_0x488965){return _0x5e8ff8[_0xa0c6('0x19')](_0x22fae9);}return _0x5e8ff8[_0xa0c6('0x1a')](_0x22fae9)[_0xa0c6('0x1b')]();};}function respondWithResult(_0x1788c7,_0x1335d3){_0x1335d3=_0x1335d3||0xc8;return function(_0x2a8772){if(_0x2a8772){return _0x1788c7[_0xa0c6('0x1a')](_0x1335d3)[_0xa0c6('0x1c')](_0x2a8772);}};}function respondWithFilteredResult(_0x43b389,_0x470838){return function(_0x2a7791){if(_0x2a7791){var _0x2029f2=typeof _0x470838[_0xa0c6('0x1d')]===_0xa0c6('0x1e')&&typeof _0x470838['limit']===_0xa0c6('0x1e');var _0x3fffba=_0x2a7791['count'];var _0x16ff95=_0x2029f2?0x0:_0x470838['offset'];var _0x3d01e1=_0x2029f2?_0x2a7791[_0xa0c6('0x1f')]:_0x470838['offset']+_0x470838['limit'];var _0x5bc2a7;if(_0x3d01e1>=_0x3fffba){_0x3d01e1=_0x3fffba;_0x5bc2a7=0xc8;}else{_0x5bc2a7=0xce;}_0x43b389[_0xa0c6('0x1a')](_0x5bc2a7);return _0x43b389[_0xa0c6('0x20')](_0xa0c6('0x21'),_0x16ff95+'-'+_0x3d01e1+'/'+_0x3fffba)[_0xa0c6('0x1c')](_0x2a7791);}return null;};}function patchUpdates(_0x50fd15){return function(_0x36664e){try{jsonpatch[_0xa0c6('0x22')](_0x36664e,_0x50fd15,!![]);}catch(_0x28e584){return BPromise['reject'](_0x28e584);}return _0x36664e[_0xa0c6('0x23')]();};}function saveUpdates(_0x489608,_0x186557){return function(_0x599f71){if(_0x599f71){return _0x599f71[_0xa0c6('0x24')](_0x489608)[_0xa0c6('0x25')](function(_0x5f3826){return _0x5f3826;});}return null;};}function removeEntity(_0x1b406a,_0x2ed025){return function(_0x5abb3f){if(_0x5abb3f){return _0x5abb3f[_0xa0c6('0x26')]()[_0xa0c6('0x25')](function(){_0x1b406a[_0xa0c6('0x1a')](0xcc)[_0xa0c6('0x1b')]();});}};}function handleEntityNotFound(_0x451200,_0x283c5e){return function(_0x43414b){if(!_0x43414b){_0x451200[_0xa0c6('0x19')](0x194);}return _0x43414b;};}function handleError(_0x1745d5,_0x4bcfaa){_0x4bcfaa=_0x4bcfaa||0x1f4;return function(_0x55301e){logger[_0xa0c6('0x27')](_0x55301e[_0xa0c6('0x28')]);if(_0x55301e[_0xa0c6('0x29')]){delete _0x55301e[_0xa0c6('0x29')];}_0x1745d5[_0xa0c6('0x1a')](_0x4bcfaa)[_0xa0c6('0x2a')](_0x55301e);};}exports[_0xa0c6('0x2b')]=function(_0x5176e,_0x27f35e){var _0x3555c8={},_0x4c42c3={},_0x6097f9={'count':0x0,'rows':[]};var _0xe49e68=_['map'](db[_0xa0c6('0x2c')]['rawAttributes'],function(_0x2afff4){return{'name':_0x2afff4[_0xa0c6('0x2d')],'type':_0x2afff4[_0xa0c6('0x2e')][_0xa0c6('0x2f')]};});_0x4c42c3[_0xa0c6('0x30')]=_[_0xa0c6('0x31')](_0xe49e68,_0xa0c6('0x29'));_0x4c42c3[_0xa0c6('0x32')]=_[_0xa0c6('0x33')](_0x5176e[_0xa0c6('0x32')]);_0x4c42c3[_0xa0c6('0x34')]=_[_0xa0c6('0x35')](_0x4c42c3[_0xa0c6('0x30')],_0x4c42c3[_0xa0c6('0x32')]);_0x3555c8[_0xa0c6('0x36')]=_['intersection'](_0x4c42c3['model'],qs[_0xa0c6('0x37')](_0x5176e[_0xa0c6('0x32')]['fields']));_0x3555c8[_0xa0c6('0x36')]=_0x3555c8[_0xa0c6('0x36')][_0xa0c6('0x38')]?_0x3555c8[_0xa0c6('0x36')]:_0x4c42c3[_0xa0c6('0x30')];if(!_0x5176e[_0xa0c6('0x32')][_0xa0c6('0x39')](_0xa0c6('0x3a'))){_0x3555c8[_0xa0c6('0x3b')]=qs[_0xa0c6('0x3b')](_0x5176e[_0xa0c6('0x32')][_0xa0c6('0x3b')]);_0x3555c8['offset']=qs[_0xa0c6('0x1d')](_0x5176e[_0xa0c6('0x32')][_0xa0c6('0x1d')]);}_0x3555c8['order']=qs[_0xa0c6('0x3c')](_0x5176e['query'][_0xa0c6('0x3c')]);_0x3555c8[_0xa0c6('0x3d')]=qs[_0xa0c6('0x34')](_[_0xa0c6('0x3e')](_0x5176e[_0xa0c6('0x32')],_0x4c42c3['filters']),_0xe49e68);if(_0x5176e[_0xa0c6('0x32')][_0xa0c6('0x3f')]){_0x3555c8[_0xa0c6('0x3d')]=_[_0xa0c6('0x40')](_0x3555c8[_0xa0c6('0x3d')],{'$or':_[_0xa0c6('0x31')](_0xe49e68,function(_0x18347c){if(_0x18347c[_0xa0c6('0x2e')]!==_0xa0c6('0x41')){var _0x1321f2={};_0x1321f2[_0x18347c[_0xa0c6('0x29')]]={'$like':'%'+_0x5176e['query'][_0xa0c6('0x3f')]+'%'};return _0x1321f2;}})});}_0x3555c8=_[_0xa0c6('0x40')]({},_0x3555c8,_0x5176e[_0xa0c6('0x42')]);var _0x30b87e={'where':_0x3555c8[_0xa0c6('0x3d')]};return db[_0xa0c6('0x2c')][_0xa0c6('0x1f')](_0x30b87e)[_0xa0c6('0x25')](function(_0x5bbdfa){_0x6097f9['count']=_0x5bbdfa;if(_0x5176e[_0xa0c6('0x32')]['includeAll']){_0x3555c8[_0xa0c6('0x43')]=[{'all':!![]}];}return db[_0xa0c6('0x2c')][_0xa0c6('0x44')](_0x3555c8);})[_0xa0c6('0x25')](function(_0x275fd6){_0x6097f9['rows']=_0x275fd6;return _0x6097f9;})['then'](respondWithFilteredResult(_0x27f35e,_0x3555c8))[_0xa0c6('0x45')](handleError(_0x27f35e,null));};exports[_0xa0c6('0x46')]=function(_0x17d1cc,_0x1198be){var _0xc27073={'raw':![],'where':{'id':_0x17d1cc[_0xa0c6('0x47')]['id']}},_0x4c4b79={};_0x4c4b79[_0xa0c6('0x30')]=_[_0xa0c6('0x33')](db[_0xa0c6('0x2c')][_0xa0c6('0x48')]);_0x4c4b79['query']=_[_0xa0c6('0x33')](_0x17d1cc[_0xa0c6('0x32')]);_0x4c4b79[_0xa0c6('0x34')]=_['intersection'](_0x4c4b79[_0xa0c6('0x30')],_0x4c4b79[_0xa0c6('0x32')]);_0xc27073[_0xa0c6('0x36')]=_['intersection'](_0x4c4b79['model'],qs[_0xa0c6('0x37')](_0x17d1cc[_0xa0c6('0x32')][_0xa0c6('0x37')]));_0xc27073[_0xa0c6('0x36')]=_0xc27073[_0xa0c6('0x36')][_0xa0c6('0x38')]?_0xc27073[_0xa0c6('0x36')]:_0x4c4b79['model'];if(_0x17d1cc[_0xa0c6('0x32')][_0xa0c6('0x49')]){_0xc27073[_0xa0c6('0x43')]=[{'all':!![]}];}_0xc27073=_[_0xa0c6('0x40')]({},_0xc27073,_0x17d1cc['options']);return db[_0xa0c6('0x2c')][_0xa0c6('0x4a')](_0xc27073)['then'](handleEntityNotFound(_0x1198be,null))[_0xa0c6('0x25')](respondWithResult(_0x1198be,null))['catch'](handleError(_0x1198be,null));};exports[_0xa0c6('0x4b')]=function(_0x7b0084,_0x2a735a){return db[_0xa0c6('0x2c')]['create'](_0x7b0084['body'],{})['then'](respondWithResult(_0x2a735a,0xc9))['catch'](handleError(_0x2a735a,null));};exports[_0xa0c6('0x24')]=function(_0x51e500,_0x140042){if(_0x51e500['body']['id']){delete _0x51e500[_0xa0c6('0x4c')]['id'];}return db[_0xa0c6('0x2c')]['find']({'where':{'id':_0x51e500[_0xa0c6('0x47')]['id']}})[_0xa0c6('0x25')](handleEntityNotFound(_0x140042,null))[_0xa0c6('0x25')](saveUpdates(_0x51e500['body'],null))[_0xa0c6('0x25')](respondWithResult(_0x140042,null))[_0xa0c6('0x45')](handleError(_0x140042,null));};exports['destroy']=function(_0x26b69f,_0x2d0f76){return db[_0xa0c6('0x2c')][_0xa0c6('0x4a')]({'where':{'id':_0x26b69f['params']['id']}})[_0xa0c6('0x25')](handleEntityNotFound(_0x2d0f76,null))['then'](removeEntity(_0x2d0f76,null))['catch'](handleError(_0x2d0f76,null));};exports[_0xa0c6('0x4d')]=function(_0x4bbd6b,_0x41c304,_0x22fe47){var _0x138d64={};var _0x2f7be6={};var _0x4acd58;var _0x9f20c3;return db[_0xa0c6('0x2c')][_0xa0c6('0x4e')]({'where':{'id':_0x4bbd6b[_0xa0c6('0x47')]['id']}})[_0xa0c6('0x25')](handleEntityNotFound(_0x41c304,null))[_0xa0c6('0x25')](function(_0x45c8a7){if(_0x45c8a7){_0x4acd58=_0x45c8a7;_0x2f7be6[_0xa0c6('0x30')]=_['keys'](db[_0xa0c6('0x4f')][_0xa0c6('0x48')]);_0x2f7be6[_0xa0c6('0x32')]=_[_0xa0c6('0x33')](_0x4bbd6b[_0xa0c6('0x32')]);_0x2f7be6['filters']=_[_0xa0c6('0x35')](_0x2f7be6[_0xa0c6('0x30')],_0x2f7be6['query']);_0x138d64[_0xa0c6('0x36')]=_[_0xa0c6('0x35')](_0x2f7be6[_0xa0c6('0x30')],qs[_0xa0c6('0x37')](_0x4bbd6b[_0xa0c6('0x32')][_0xa0c6('0x37')]));_0x138d64[_0xa0c6('0x36')]=_0x138d64['attributes']['length']?_0x138d64['attributes']:_0x2f7be6[_0xa0c6('0x30')];_0x138d64['order']=qs[_0xa0c6('0x3c')](_0x4bbd6b[_0xa0c6('0x32')][_0xa0c6('0x3c')]);_0x138d64[_0xa0c6('0x3d')]=qs[_0xa0c6('0x34')](_['pick'](_0x4bbd6b['query'],_0x2f7be6[_0xa0c6('0x34')]));if(_0x4bbd6b[_0xa0c6('0x32')][_0xa0c6('0x3f')]){_0x138d64[_0xa0c6('0x3d')]=_['merge'](_0x138d64[_0xa0c6('0x3d')],{'$or':_[_0xa0c6('0x31')](_0x138d64[_0xa0c6('0x36')],function(_0x442ffc){var _0x240188={};_0x240188[_0x442ffc]={'$like':'%'+_0x4bbd6b[_0xa0c6('0x32')]['filter']+'%'};return _0x240188;})});}_0x138d64=_[_0xa0c6('0x40')]({},_0x138d64,_0x4bbd6b[_0xa0c6('0x42')]);return _0x4acd58[_0xa0c6('0x4d')](_0x138d64);}})[_0xa0c6('0x25')](function(_0x56f5e1){if(_0x56f5e1){_0x9f20c3=_0x56f5e1[_0xa0c6('0x38')];if(!_0x4bbd6b[_0xa0c6('0x32')][_0xa0c6('0x39')](_0xa0c6('0x3a'))){_0x138d64[_0xa0c6('0x3b')]=qs['limit'](_0x4bbd6b[_0xa0c6('0x32')][_0xa0c6('0x3b')]);_0x138d64[_0xa0c6('0x1d')]=qs['offset'](_0x4bbd6b[_0xa0c6('0x32')]['offset']);}return _0x4acd58[_0xa0c6('0x4d')](_0x138d64);}})[_0xa0c6('0x25')](function(_0x3204f2){if(_0x3204f2){return _0x3204f2?{'count':_0x9f20c3,'rows':_0x3204f2}:null;}})['then'](respondWithResult(_0x41c304,null))[_0xa0c6('0x45')](handleError(_0x41c304,null));};exports[_0xa0c6('0x50')]=function(_0x474fb4,_0x1ccf59,_0x3a8e47){var _0x595608={};var _0x8c9056={};var _0x12dede;var _0x2db17b;return db['ZohoConfiguration'][_0xa0c6('0x4e')]({'where':{'id':_0x474fb4[_0xa0c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1ccf59,null))[_0xa0c6('0x25')](function(_0x21bccd){if(_0x21bccd){_0x12dede=_0x21bccd;_0x8c9056[_0xa0c6('0x30')]=_[_0xa0c6('0x33')](db[_0xa0c6('0x4f')][_0xa0c6('0x48')]);_0x8c9056['query']=_[_0xa0c6('0x33')](_0x474fb4[_0xa0c6('0x32')]);_0x8c9056['filters']=_[_0xa0c6('0x35')](_0x8c9056[_0xa0c6('0x30')],_0x8c9056[_0xa0c6('0x32')]);_0x595608[_0xa0c6('0x36')]=_[_0xa0c6('0x35')](_0x8c9056['model'],qs[_0xa0c6('0x37')](_0x474fb4[_0xa0c6('0x32')][_0xa0c6('0x37')]));_0x595608['attributes']=_0x595608[_0xa0c6('0x36')][_0xa0c6('0x38')]?_0x595608[_0xa0c6('0x36')]:_0x8c9056[_0xa0c6('0x30')];_0x595608[_0xa0c6('0x51')]=qs[_0xa0c6('0x3c')](_0x474fb4[_0xa0c6('0x32')]['sort']);_0x595608[_0xa0c6('0x3d')]=qs['filters'](_[_0xa0c6('0x3e')](_0x474fb4[_0xa0c6('0x32')],_0x8c9056[_0xa0c6('0x34')]));if(_0x474fb4['query'][_0xa0c6('0x3f')]){_0x595608[_0xa0c6('0x3d')]=_[_0xa0c6('0x40')](_0x595608[_0xa0c6('0x3d')],{'$or':_[_0xa0c6('0x31')](_0x595608[_0xa0c6('0x36')],function(_0x4ce374){var _0x1c64f2={};_0x1c64f2[_0x4ce374]={'$like':'%'+_0x474fb4[_0xa0c6('0x32')][_0xa0c6('0x3f')]+'%'};return _0x1c64f2;})});}_0x595608=_[_0xa0c6('0x40')]({},_0x595608,_0x474fb4['options']);return _0x12dede[_0xa0c6('0x50')](_0x595608);}})['then'](function(_0x3bacd4){if(_0x3bacd4){_0x2db17b=_0x3bacd4[_0xa0c6('0x38')];if(!_0x474fb4[_0xa0c6('0x32')][_0xa0c6('0x39')](_0xa0c6('0x3a'))){_0x595608[_0xa0c6('0x3b')]=qs[_0xa0c6('0x3b')](_0x474fb4['query'][_0xa0c6('0x3b')]);_0x595608[_0xa0c6('0x1d')]=qs[_0xa0c6('0x1d')](_0x474fb4[_0xa0c6('0x32')][_0xa0c6('0x1d')]);}return _0x12dede[_0xa0c6('0x50')](_0x595608);}})[_0xa0c6('0x25')](function(_0x1ef56f){if(_0x1ef56f){return _0x1ef56f?{'count':_0x2db17b,'rows':_0x1ef56f}:null;}})[_0xa0c6('0x25')](respondWithResult(_0x1ccf59,null))[_0xa0c6('0x45')](handleError(_0x1ccf59,null));};exports[_0xa0c6('0x52')]=function(_0x9259b8,_0x1c357a,_0x4e99ed){var _0x3587f8={};var _0x14938b={};var _0x30be97;var _0x37a666;return db[_0xa0c6('0x2c')][_0xa0c6('0x4e')]({'where':{'id':_0x9259b8[_0xa0c6('0x47')]['id']}})['then'](handleEntityNotFound(_0x1c357a,null))[_0xa0c6('0x25')](function(_0x211860){if(_0x211860){_0x30be97=_0x211860;_0x14938b[_0xa0c6('0x30')]=_[_0xa0c6('0x33')](db[_0xa0c6('0x4f')]['rawAttributes']);_0x14938b[_0xa0c6('0x32')]=_[_0xa0c6('0x33')](_0x9259b8[_0xa0c6('0x32')]);_0x14938b[_0xa0c6('0x34')]=_[_0xa0c6('0x35')](_0x14938b[_0xa0c6('0x30')],_0x14938b[_0xa0c6('0x32')]);_0x3587f8[_0xa0c6('0x36')]=_[_0xa0c6('0x35')](_0x14938b['model'],qs[_0xa0c6('0x37')](_0x9259b8[_0xa0c6('0x32')][_0xa0c6('0x37')]));_0x3587f8[_0xa0c6('0x36')]=_0x3587f8[_0xa0c6('0x36')][_0xa0c6('0x38')]?_0x3587f8[_0xa0c6('0x36')]:_0x14938b['model'];_0x3587f8[_0xa0c6('0x51')]=qs['sort'](_0x9259b8[_0xa0c6('0x32')][_0xa0c6('0x3c')]);_0x3587f8[_0xa0c6('0x3d')]=qs[_0xa0c6('0x34')](_[_0xa0c6('0x3e')](_0x9259b8[_0xa0c6('0x32')],_0x14938b[_0xa0c6('0x34')]));if(_0x9259b8[_0xa0c6('0x32')][_0xa0c6('0x3f')]){_0x3587f8[_0xa0c6('0x3d')]=_[_0xa0c6('0x40')](_0x3587f8['where'],{'$or':_[_0xa0c6('0x31')](_0x3587f8[_0xa0c6('0x36')],function(_0x42eca6){var _0x4cff99={};_0x4cff99[_0x42eca6]={'$like':'%'+_0x9259b8[_0xa0c6('0x32')][_0xa0c6('0x3f')]+'%'};return _0x4cff99;})});}_0x3587f8=_[_0xa0c6('0x40')]({},_0x3587f8,_0x9259b8[_0xa0c6('0x42')]);return _0x30be97[_0xa0c6('0x52')](_0x3587f8);}})['then'](function(_0x3cf09d){if(_0x3cf09d){_0x37a666=_0x3cf09d[_0xa0c6('0x38')];if(!_0x9259b8[_0xa0c6('0x32')][_0xa0c6('0x39')](_0xa0c6('0x3a'))){_0x3587f8['limit']=qs[_0xa0c6('0x3b')](_0x9259b8['query'][_0xa0c6('0x3b')]);_0x3587f8['offset']=qs[_0xa0c6('0x1d')](_0x9259b8['query'][_0xa0c6('0x1d')]);}return _0x30be97[_0xa0c6('0x52')](_0x3587f8);}})[_0xa0c6('0x25')](function(_0xb454bc){if(_0xb454bc){return _0xb454bc?{'count':_0x37a666,'rows':_0xb454bc}:null;}})[_0xa0c6('0x25')](respondWithResult(_0x1c357a,null))[_0xa0c6('0x45')](handleError(_0x1c357a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 923a168..e90177f 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 _0x9c2b=['path','rimraf','../../config/environment','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4ab35a,_0x34172a){var _0x9a8a87=function(_0x1c175d){while(--_0x1c175d){_0x4ab35a['push'](_0x4ab35a['shift']());}};_0x9a8a87(++_0x34172a);}(_0x9c2b,0x192));var _0xb9c2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9c2b[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xb9c2('0x0'));var util=require(_0xb9c2('0x1'));var logger=require(_0xb9c2('0x2'))('api');var moment=require(_0xb9c2('0x3'));var BPromise=require(_0xb9c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb9c2('0x5'));var rimraf=require(_0xb9c2('0x6'));var config=require(_0xb9c2('0x7'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x109286,_0x2af3d1){return _0x109286[_0xb9c2('0x8')](_0xb9c2('0x9'),attributes,{'tableName':_0xb9c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae9e=['define','int_zoho_configurations','util','api','request-promise','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x51c24d,_0x18d8af){var _0x155dbc=function(_0x4d91bc){while(--_0x4d91bc){_0x51c24d['push'](_0x51c24d['shift']());}};_0x155dbc(++_0x18d8af);}(_0xae9e,0x162));var _0xeae9=function(_0xa1d931,_0x46ba23){_0xa1d931=_0xa1d931-0x0;var _0x103d20=_0xae9e[_0xa1d931];return _0x103d20;};'use strict';var _=require('lodash');var util=require(_0xeae9('0x0'));var logger=require('../../config/logger')(_0xeae9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xeae9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeae9('0x3'));var config=require('../../config/environment');var attributes=require(_0xeae9('0x4'));module[_0xeae9('0x5')]=function(_0x251903,_0x20c8f6){return _0x251903[_0xeae9('0x6')]('ZohoConfiguration',attributes,{'tableName':_0xeae9('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 8aa7644..4b713a7 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 _0xf91e=['ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0xd288f2,_0x54e474){var _0x4ef27a=function(_0x413409){while(--_0x413409){_0xd288f2['push'](_0xd288f2['shift']());}};_0x4ef27a(++_0x54e474);}(_0xf91e,0xf3));var _0xef91=function(_0x3d0cf5,_0x58e533){_0x3d0cf5=_0x3d0cf5-0x0;var _0xa1ba43=_0xf91e[_0x3d0cf5];return _0xa1ba43;};'use strict';var _=require(_0xef91('0x0'));var util=require(_0xef91('0x1'));var moment=require(_0xef91('0x2'));var BPromise=require('bluebird');var rs=require(_0xef91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xef91('0x4'))['db'];var utils=require(_0xef91('0x5'));var logger=require(_0xef91('0x6'))('rpc');var config=require(_0xef91('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xef91('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9df361,_0x37147f,_0x1f1391){return new BPromise(function(_0x1126b7,_0x3cf58e){return client[_0xef91('0x9')](_0x9df361,_0x1f1391)['then'](function(_0x420cd2){logger[_0xef91('0xa')]('ZohoConfiguration,\x20%s,\x20%s',_0x37147f,_0xef91('0xb'));logger[_0xef91('0xc')](_0xef91('0xd'),_0x37147f,_0xef91('0xb'),JSON[_0xef91('0xe')](_0x420cd2));if(_0x420cd2[_0xef91('0xf')]){if(_0x420cd2['error'][_0xef91('0x10')]===0x1f4){logger['error'](_0xef91('0x11'),_0x37147f,_0x420cd2[_0xef91('0xf')][_0xef91('0x12')]);return _0x3cf58e(_0x420cd2[_0xef91('0xf')][_0xef91('0x12')]);}logger['error'](_0xef91('0x11'),_0x37147f,_0x420cd2[_0xef91('0xf')]['message']);return _0x1126b7(_0x420cd2[_0xef91('0xf')][_0xef91('0x12')]);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x37147f,_0xef91('0xb'));_0x1126b7(_0x420cd2[_0xef91('0x13')]['message']);}})['catch'](function(_0x23e36d){logger[_0xef91('0xf')](_0xef91('0x11'),_0x37147f,_0x23e36d);_0x3cf58e(_0x23e36d);});});} \ No newline at end of file +var _0x62f1=['ZohoConfiguration,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2abeee,_0x1d7879){var _0x17929b=function(_0x3e54c9){while(--_0x3e54c9){_0x2abeee['push'](_0x2abeee['shift']());}};_0x17929b(++_0x1d7879);}(_0x62f1,0x1a6));var _0x162f=function(_0x4af55d,_0x3f2511){_0x4af55d=_0x4af55d-0x0;var _0x49012a=_0x62f1[_0x4af55d];return _0x49012a;};'use strict';var _=require('lodash');var util=require(_0x162f('0x0'));var moment=require(_0x162f('0x1'));var BPromise=require(_0x162f('0x2'));var rs=require(_0x162f('0x3'));var fs=require('fs');var Redis=require(_0x162f('0x4'));var db=require(_0x162f('0x5'))['db'];var utils=require(_0x162f('0x6'));var logger=require(_0x162f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x162f('0x8'));var client=jayson['client'][_0x162f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x60dfa6,_0x11422c,_0x86aca9){return new BPromise(function(_0x302abd,_0x23d337){return client['request'](_0x60dfa6,_0x86aca9)[_0x162f('0xa')](function(_0x41a179){logger[_0x162f('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x11422c,_0x162f('0xc'));logger[_0x162f('0xd')](_0x162f('0xe'),_0x11422c,_0x162f('0xc'),JSON[_0x162f('0xf')](_0x41a179));if(_0x41a179[_0x162f('0x10')]){if(_0x41a179[_0x162f('0x10')][_0x162f('0x11')]===0x1f4){logger[_0x162f('0x10')](_0x162f('0x12'),_0x11422c,_0x41a179[_0x162f('0x10')]['message']);return _0x23d337(_0x41a179[_0x162f('0x10')]['message']);}logger[_0x162f('0x10')](_0x162f('0x12'),_0x11422c,_0x41a179['error'][_0x162f('0x13')]);return _0x302abd(_0x41a179[_0x162f('0x10')][_0x162f('0x13')]);}else{logger[_0x162f('0xb')](_0x162f('0x12'),_0x11422c,_0x162f('0xc'));_0x302abd(_0x41a179[_0x162f('0x14')][_0x162f('0x13')]);}})[_0x162f('0x15')](function(_0x4894ad){logger[_0x162f('0x10')]('ZohoConfiguration,\x20%s,\x20%s',_0x11422c,_0x4894ad);_0x23d337(_0x4894ad);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index dce144e..53be26b 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 _0x87e2=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','show','post','create','/:id','update'];(function(_0x19fd3e,_0x1338b3){var _0x293b61=function(_0x412ad0){while(--_0x412ad0){_0x19fd3e['push'](_0x19fd3e['shift']());}};_0x293b61(++_0x1338b3);}(_0x87e2,0x92));var _0x287e=function(_0x247147,_0x5744c9){_0x247147=_0x247147-0x0;var _0x1e26a9=_0x87e2[_0x247147];return _0x1e26a9;};'use strict';var multer=require(_0x287e('0x0'));var util=require(_0x287e('0x1'));var path=require(_0x287e('0x2'));var timeout=require(_0x287e('0x3'));var express=require(_0x287e('0x4'));var router=express[_0x287e('0x5')]();var fs_extra=require(_0x287e('0x6'));var auth=require(_0x287e('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoField.controller');router['get']('/',auth[_0x287e('0x8')](),controller[_0x287e('0x9')]);router[_0x287e('0xa')]('/:id',auth[_0x287e('0x8')](),controller[_0x287e('0xb')]);router[_0x287e('0xc')]('/',auth[_0x287e('0x8')](),controller[_0x287e('0xd')]);router['put'](_0x287e('0xe'),auth[_0x287e('0x8')](),controller[_0x287e('0xf')]);router[_0x287e('0x10')](_0x287e('0xe'),auth[_0x287e('0x8')](),controller['destroy']);module[_0x287e('0x11')]=router; \ No newline at end of file +var _0x0895=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','delete','destroy'];(function(_0x25701b,_0x2a6976){var _0x3a8a2c=function(_0x1a5e78){while(--_0x1a5e78){_0x25701b['push'](_0x25701b['shift']());}};_0x3a8a2c(++_0x2a6976);}(_0x0895,0x1e7));var _0x5089=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0895[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x5089('0x0'));var path=require(_0x5089('0x1'));var timeout=require(_0x5089('0x2'));var express=require('express');var router=express[_0x5089('0x3')]();var fs_extra=require(_0x5089('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5089('0x5'));var config=require(_0x5089('0x6'));var controller=require(_0x5089('0x7'));router[_0x5089('0x8')]('/',auth[_0x5089('0x9')](),controller[_0x5089('0xa')]);router[_0x5089('0x8')]('/:id',auth[_0x5089('0x9')](),controller[_0x5089('0xb')]);router[_0x5089('0xc')]('/',auth[_0x5089('0x9')](),controller[_0x5089('0xd')]);router[_0x5089('0xe')]('/:id',auth[_0x5089('0x9')](),controller['update']);router[_0x5089('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5089('0x10')]);module[_0x5089('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 9c28316..11be444 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 _0xe69e=['string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM'];(function(_0x3571e5,_0x34ecf2){var _0x4e9b47=function(_0x4adcff){while(--_0x4adcff){_0x3571e5['push'](_0x3571e5['shift']());}};_0x4e9b47(++_0x34ecf2);}(_0xe69e,0x130));var _0xee69=function(_0xa9eaa0,_0x4ba2b4){_0xa9eaa0=_0xa9eaa0-0x0;var _0x30897a=_0xe69e[_0xa9eaa0];return _0x30897a;};'use strict';var Sequelize=require('sequelize');module[_0xee69('0x0')]={'type':{'type':Sequelize[_0xee69('0x1')](_0xee69('0x2'),'variable',_0xee69('0x3'),_0xee69('0x4'),_0xee69('0x5')),'defaultValue':_0xee69('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xee69('0x6')]},'keyType':{'type':Sequelize[_0xee69('0x1')](_0xee69('0x2'),_0xee69('0x7'),_0xee69('0x3'))},'keyContent':{'type':Sequelize[_0xee69('0x6')]},'idField':{'type':Sequelize[_0xee69('0x6')]},'nameField':{'type':Sequelize[_0xee69('0x6')]},'customField':{'type':Sequelize[_0xee69('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xee69('0x6')]}}; \ No newline at end of file +var _0xbd44=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x27604f,_0x5ae336){var _0x40d189=function(_0xebacde){while(--_0xebacde){_0x27604f['push'](_0x27604f['shift']());}};_0x40d189(++_0x5ae336);}(_0xbd44,0x16b));var _0x4bd4=function(_0x46fd14,_0xde924c){_0x46fd14=_0x46fd14-0x0;var _0x4fba05=_0xbd44[_0x46fd14];return _0x4fba05;};'use strict';var Sequelize=require(_0x4bd4('0x0'));module[_0x4bd4('0x1')]={'type':{'type':Sequelize[_0x4bd4('0x2')](_0x4bd4('0x3'),_0x4bd4('0x4'),_0x4bd4('0x5'),_0x4bd4('0x6'),_0x4bd4('0x7')),'defaultValue':'string'},'content':{'type':Sequelize[_0x4bd4('0x8')]},'key':{'type':Sequelize[_0x4bd4('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x4bd4('0x3'),_0x4bd4('0x4'),_0x4bd4('0x5'))},'keyContent':{'type':Sequelize[_0x4bd4('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4bd4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4bd4('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7a3bcda..b766051 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 _0xe96f=['update','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','then','includeAll','rows','params','attributes','length','include','options','catch','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save'];(function(_0x3bdc30,_0x119486){var _0x1a4986=function(_0x4a2ed0){while(--_0x4a2ed0){_0x3bdc30['push'](_0x3bdc30['shift']());}};_0x1a4986(++_0x119486);}(_0xe96f,0x199));var _0xfe96=function(_0x27c3b5,_0x2fb31e){_0x27c3b5=_0x27c3b5-0x0;var _0x1fccb1=_0xe96f[_0x27c3b5];return _0x1fccb1;};'use strict';var emlformat=require(_0xfe96('0x0'));var rimraf=require(_0xfe96('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfe96('0x2'));var moment=require(_0xfe96('0x3'));var BPromise=require(_0xfe96('0x4'));var Mustache=require('mustache');var util=require(_0xfe96('0x5'));var path=require(_0xfe96('0x6'));var sox=require(_0xfe96('0x7'));var csv=require(_0xfe96('0x8'));var ejs=require(_0xfe96('0x9'));var fs=require('fs');var fs_extra=require(_0xfe96('0xa'));var _=require(_0xfe96('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfe96('0x8'));var querystring=require(_0xfe96('0xc'));var Papa=require(_0xfe96('0xd'));var Redis=require('ioredis');var authService=require(_0xfe96('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfe96('0xf'));var hardwareService=require(_0xfe96('0x10'));var logger=require(_0xfe96('0x11'))('api');var utils=require(_0xfe96('0x12'));var config=require(_0xfe96('0x13'));var licenseUtil=require(_0xfe96('0x14'));var db=require(_0xfe96('0x15'))['db'];function respondWithStatusCode(_0x11c44c,_0x4da6d1){_0x4da6d1=_0x4da6d1||0xcc;return function(_0x2a261f){if(_0x2a261f){return _0x11c44c[_0xfe96('0x16')](_0x4da6d1);}return _0x11c44c[_0xfe96('0x17')](_0x4da6d1)[_0xfe96('0x18')]();};}function respondWithResult(_0x4efbe6,_0x3cef0c){_0x3cef0c=_0x3cef0c||0xc8;return function(_0x309ff0){if(_0x309ff0){return _0x4efbe6[_0xfe96('0x17')](_0x3cef0c)[_0xfe96('0x19')](_0x309ff0);}};}function respondWithFilteredResult(_0xe7052e,_0x363738){return function(_0x10ac4d){if(_0x10ac4d){var _0x4d56b7=typeof _0x363738['offset']===_0xfe96('0x1a')&&typeof _0x363738[_0xfe96('0x1b')]===_0xfe96('0x1a');var _0x4f97ac=_0x10ac4d[_0xfe96('0x1c')];var _0x230079=_0x4d56b7?0x0:_0x363738[_0xfe96('0x1d')];var _0xf6787e=_0x4d56b7?_0x10ac4d[_0xfe96('0x1c')]:_0x363738[_0xfe96('0x1d')]+_0x363738[_0xfe96('0x1b')];var _0x1f9049;if(_0xf6787e>=_0x4f97ac){_0xf6787e=_0x4f97ac;_0x1f9049=0xc8;}else{_0x1f9049=0xce;}_0xe7052e[_0xfe96('0x17')](_0x1f9049);return _0xe7052e[_0xfe96('0x1e')](_0xfe96('0x1f'),_0x230079+'-'+_0xf6787e+'/'+_0x4f97ac)[_0xfe96('0x19')](_0x10ac4d);}return null;};}function patchUpdates(_0x52fcf9){return function(_0x53a9d3){try{jsonpatch[_0xfe96('0x20')](_0x53a9d3,_0x52fcf9,!![]);}catch(_0x412725){return BPromise[_0xfe96('0x21')](_0x412725);}return _0x53a9d3[_0xfe96('0x22')]();};}function saveUpdates(_0x1e87f1,_0x17f941){return function(_0x1449c2){if(_0x1449c2){return _0x1449c2[_0xfe96('0x23')](_0x1e87f1)['then'](function(_0x309904){return _0x309904;});}return null;};}function removeEntity(_0x31f1ed,_0x5f2f7e){return function(_0x466d7d){if(_0x466d7d){return _0x466d7d[_0xfe96('0x24')]()['then'](function(){_0x31f1ed[_0xfe96('0x17')](0xcc)[_0xfe96('0x18')]();});}};}function handleEntityNotFound(_0x90700b,_0x444e58){return function(_0x1778d9){if(!_0x1778d9){_0x90700b['sendStatus'](0x194);}return _0x1778d9;};}function handleError(_0x21409e,_0x17b9c8){_0x17b9c8=_0x17b9c8||0x1f4;return function(_0x19cd3a){logger[_0xfe96('0x25')](_0x19cd3a[_0xfe96('0x26')]);if(_0x19cd3a[_0xfe96('0x27')]){delete _0x19cd3a[_0xfe96('0x27')];}_0x21409e['status'](_0x17b9c8)[_0xfe96('0x28')](_0x19cd3a);};}exports[_0xfe96('0x29')]=function(_0x52d8a1,_0x48d629){var _0x321861={},_0x5388e4={},_0x27ade7={'count':0x0,'rows':[]};var _0x3fe8eb=_[_0xfe96('0x2a')](db[_0xfe96('0x2b')][_0xfe96('0x2c')],function(_0x14cb2a){return{'name':_0x14cb2a[_0xfe96('0x2d')],'type':_0x14cb2a['type'][_0xfe96('0x2e')]};});_0x5388e4['model']=_[_0xfe96('0x2a')](_0x3fe8eb,_0xfe96('0x27'));_0x5388e4[_0xfe96('0x2f')]=_[_0xfe96('0x30')](_0x52d8a1[_0xfe96('0x2f')]);_0x5388e4[_0xfe96('0x31')]=_[_0xfe96('0x32')](_0x5388e4['model'],_0x5388e4[_0xfe96('0x2f')]);_0x321861['attributes']=_[_0xfe96('0x32')](_0x5388e4[_0xfe96('0x33')],qs[_0xfe96('0x34')](_0x52d8a1[_0xfe96('0x2f')]['fields']));_0x321861['attributes']=_0x321861['attributes']['length']?_0x321861['attributes']:_0x5388e4[_0xfe96('0x33')];if(!_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x35')](_0xfe96('0x36'))){_0x321861[_0xfe96('0x1b')]=qs[_0xfe96('0x1b')](_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x1b')]);_0x321861['offset']=qs[_0xfe96('0x1d')](_0x52d8a1[_0xfe96('0x2f')]['offset']);}_0x321861[_0xfe96('0x37')]=qs['sort'](_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x38')]);_0x321861['where']=qs[_0xfe96('0x31')](_[_0xfe96('0x39')](_0x52d8a1[_0xfe96('0x2f')],_0x5388e4['filters']),_0x3fe8eb);if(_0x52d8a1[_0xfe96('0x2f')]['filter']){_0x321861[_0xfe96('0x3a')]=_[_0xfe96('0x3b')](_0x321861[_0xfe96('0x3a')],{'$or':_[_0xfe96('0x2a')](_0x3fe8eb,function(_0x3df624){if(_0x3df624[_0xfe96('0x3c')]!=='VIRTUAL'){var _0x476f89={};_0x476f89[_0x3df624['name']]={'$like':'%'+_0x52d8a1['query'][_0xfe96('0x3d')]+'%'};return _0x476f89;}})});}_0x321861=_[_0xfe96('0x3b')]({},_0x321861,_0x52d8a1['options']);var _0x228518={'where':_0x321861[_0xfe96('0x3a')]};return db[_0xfe96('0x2b')][_0xfe96('0x1c')](_0x228518)[_0xfe96('0x3e')](function(_0x17621e){_0x27ade7[_0xfe96('0x1c')]=_0x17621e;if(_0x52d8a1[_0xfe96('0x2f')][_0xfe96('0x3f')]){_0x321861['include']=[{'all':!![]}];}return db[_0xfe96('0x2b')]['findAll'](_0x321861);})[_0xfe96('0x3e')](function(_0x3e382b){_0x27ade7[_0xfe96('0x40')]=_0x3e382b;return _0x27ade7;})[_0xfe96('0x3e')](respondWithFilteredResult(_0x48d629,_0x321861))['catch'](handleError(_0x48d629,null));};exports['show']=function(_0x21268c,_0x543f0b){var _0x271994={'raw':!![],'where':{'id':_0x21268c[_0xfe96('0x41')]['id']}},_0x3c14b2={};_0x3c14b2[_0xfe96('0x33')]=_[_0xfe96('0x30')](db[_0xfe96('0x2b')]['rawAttributes']);_0x3c14b2[_0xfe96('0x2f')]=_[_0xfe96('0x30')](_0x21268c[_0xfe96('0x2f')]);_0x3c14b2[_0xfe96('0x31')]=_[_0xfe96('0x32')](_0x3c14b2['model'],_0x3c14b2[_0xfe96('0x2f')]);_0x271994[_0xfe96('0x42')]=_[_0xfe96('0x32')](_0x3c14b2[_0xfe96('0x33')],qs[_0xfe96('0x34')](_0x21268c[_0xfe96('0x2f')][_0xfe96('0x34')]));_0x271994[_0xfe96('0x42')]=_0x271994[_0xfe96('0x42')][_0xfe96('0x43')]?_0x271994[_0xfe96('0x42')]:_0x3c14b2[_0xfe96('0x33')];if(_0x21268c[_0xfe96('0x2f')]['includeAll']){_0x271994[_0xfe96('0x44')]=[{'all':!![]}];}_0x271994=_[_0xfe96('0x3b')]({},_0x271994,_0x21268c[_0xfe96('0x45')]);return db[_0xfe96('0x2b')]['find'](_0x271994)['then'](handleEntityNotFound(_0x543f0b,null))[_0xfe96('0x3e')](respondWithResult(_0x543f0b,null))[_0xfe96('0x46')](handleError(_0x543f0b,null));};exports[_0xfe96('0x47')]=function(_0x57b8a2,_0x45d8cf){return db['ZohoField'][_0xfe96('0x47')](_0x57b8a2[_0xfe96('0x48')],{})[_0xfe96('0x3e')](respondWithResult(_0x45d8cf,0xc9))[_0xfe96('0x46')](handleError(_0x45d8cf,null));};exports['update']=function(_0x131528,_0x1b4cb7){if(_0x131528[_0xfe96('0x48')]['id']){delete _0x131528[_0xfe96('0x48')]['id'];}return db[_0xfe96('0x2b')][_0xfe96('0x49')]({'where':{'id':_0x131528[_0xfe96('0x41')]['id']}})['then'](handleEntityNotFound(_0x1b4cb7,null))[_0xfe96('0x3e')](saveUpdates(_0x131528[_0xfe96('0x48')],null))[_0xfe96('0x3e')](respondWithResult(_0x1b4cb7,null))[_0xfe96('0x46')](handleError(_0x1b4cb7,null));};exports[_0xfe96('0x24')]=function(_0xf21b37,_0x2d4b06){return db[_0xfe96('0x2b')][_0xfe96('0x49')]({'where':{'id':_0xf21b37[_0xfe96('0x41')]['id']}})[_0xfe96('0x3e')](handleEntityNotFound(_0x2d4b06,null))[_0xfe96('0x3e')](removeEntity(_0x2d4b06,null))[_0xfe96('0x46')](handleError(_0x2d4b06,null));}; \ No newline at end of file +var _0xdd83=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x5dd3c3,_0x195198){var _0x2befe1=function(_0xd90a7f){while(--_0xd90a7f){_0x5dd3c3['push'](_0x5dd3c3['shift']());}};_0x2befe1(++_0x195198);}(_0xdd83,0xd2));var _0x3dd8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xdd83[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x3dd8('0x0'));var rimraf=require(_0x3dd8('0x1'));var zipdir=require(_0x3dd8('0x2'));var jsonpatch=require(_0x3dd8('0x3'));var rp=require(_0x3dd8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x3dd8('0x5'));var sox=require(_0x3dd8('0x6'));var csv=require('to-csv');var ejs=require(_0x3dd8('0x7'));var fs=require('fs');var fs_extra=require(_0x3dd8('0x8'));var _=require(_0x3dd8('0x9'));var squel=require(_0x3dd8('0xa'));var crypto=require(_0x3dd8('0xb'));var jsforce=require(_0x3dd8('0xc'));var deskjs=require(_0x3dd8('0xd'));var toCsv=require(_0x3dd8('0xe'));var querystring=require(_0x3dd8('0xf'));var Papa=require(_0x3dd8('0x10'));var Redis=require(_0x3dd8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3dd8('0x12'));var as=require(_0x3dd8('0x13'));var hardwareService=require(_0x3dd8('0x14'));var logger=require(_0x3dd8('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3dd8('0x16'));var licenseUtil=require(_0x3dd8('0x17'));var db=require(_0x3dd8('0x18'))['db'];function respondWithStatusCode(_0xe9f08b,_0x18d772){_0x18d772=_0x18d772||0xcc;return function(_0x340823){if(_0x340823){return _0xe9f08b[_0x3dd8('0x19')](_0x18d772);}return _0xe9f08b[_0x3dd8('0x1a')](_0x18d772)[_0x3dd8('0x1b')]();};}function respondWithResult(_0x476eed,_0x507d49){_0x507d49=_0x507d49||0xc8;return function(_0x316740){if(_0x316740){return _0x476eed[_0x3dd8('0x1a')](_0x507d49)[_0x3dd8('0x1c')](_0x316740);}};}function respondWithFilteredResult(_0x39da00,_0x491232){return function(_0x394b01){if(_0x394b01){var _0x6a3414=typeof _0x491232[_0x3dd8('0x1d')]===_0x3dd8('0x1e')&&typeof _0x491232['limit']===_0x3dd8('0x1e');var _0x1cf72e=_0x394b01[_0x3dd8('0x1f')];var _0x25a803=_0x6a3414?0x0:_0x491232[_0x3dd8('0x1d')];var _0x5cc58b=_0x6a3414?_0x394b01[_0x3dd8('0x1f')]:_0x491232['offset']+_0x491232[_0x3dd8('0x20')];var _0x5cbead;if(_0x5cc58b>=_0x1cf72e){_0x5cc58b=_0x1cf72e;_0x5cbead=0xc8;}else{_0x5cbead=0xce;}_0x39da00[_0x3dd8('0x1a')](_0x5cbead);return _0x39da00['set'](_0x3dd8('0x21'),_0x25a803+'-'+_0x5cc58b+'/'+_0x1cf72e)[_0x3dd8('0x1c')](_0x394b01);}return null;};}function patchUpdates(_0x14f2db){return function(_0x178dda){try{jsonpatch[_0x3dd8('0x22')](_0x178dda,_0x14f2db,!![]);}catch(_0x98af13){return BPromise['reject'](_0x98af13);}return _0x178dda[_0x3dd8('0x23')]();};}function saveUpdates(_0x385d09,_0x40d373){return function(_0x40b32f){if(_0x40b32f){return _0x40b32f[_0x3dd8('0x24')](_0x385d09)[_0x3dd8('0x25')](function(_0x67ff7){return _0x67ff7;});}return null;};}function removeEntity(_0x554c4f,_0x34b552){return function(_0x546479){if(_0x546479){return _0x546479[_0x3dd8('0x26')]()[_0x3dd8('0x25')](function(){_0x554c4f[_0x3dd8('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d717,_0x470aac){return function(_0x4125a8){if(!_0x4125a8){_0x19d717[_0x3dd8('0x19')](0x194);}return _0x4125a8;};}function handleError(_0x2e7dc3,_0x249c87){_0x249c87=_0x249c87||0x1f4;return function(_0xe8fcf1){logger[_0x3dd8('0x27')](_0xe8fcf1[_0x3dd8('0x28')]);if(_0xe8fcf1['name']){delete _0xe8fcf1[_0x3dd8('0x29')];}_0x2e7dc3[_0x3dd8('0x1a')](_0x249c87)[_0x3dd8('0x2a')](_0xe8fcf1);};}exports[_0x3dd8('0x2b')]=function(_0x3daab7,_0x515830){var _0x500ad2={},_0x118e59={},_0x17731b={'count':0x0,'rows':[]};var _0x15d8aa=_[_0x3dd8('0x2c')](db[_0x3dd8('0x2d')][_0x3dd8('0x2e')],function(_0x3e7cee){return{'name':_0x3e7cee[_0x3dd8('0x2f')],'type':_0x3e7cee[_0x3dd8('0x30')][_0x3dd8('0x31')]};});_0x118e59[_0x3dd8('0x32')]=_[_0x3dd8('0x2c')](_0x15d8aa,_0x3dd8('0x29'));_0x118e59[_0x3dd8('0x33')]=_[_0x3dd8('0x34')](_0x3daab7[_0x3dd8('0x33')]);_0x118e59['filters']=_[_0x3dd8('0x35')](_0x118e59[_0x3dd8('0x32')],_0x118e59['query']);_0x500ad2['attributes']=_['intersection'](_0x118e59['model'],qs[_0x3dd8('0x36')](_0x3daab7['query'][_0x3dd8('0x36')]));_0x500ad2[_0x3dd8('0x37')]=_0x500ad2['attributes'][_0x3dd8('0x38')]?_0x500ad2['attributes']:_0x118e59[_0x3dd8('0x32')];if(!_0x3daab7['query'][_0x3dd8('0x39')](_0x3dd8('0x3a'))){_0x500ad2[_0x3dd8('0x20')]=qs[_0x3dd8('0x20')](_0x3daab7[_0x3dd8('0x33')]['limit']);_0x500ad2['offset']=qs[_0x3dd8('0x1d')](_0x3daab7[_0x3dd8('0x33')][_0x3dd8('0x1d')]);}_0x500ad2[_0x3dd8('0x3b')]=qs[_0x3dd8('0x3c')](_0x3daab7[_0x3dd8('0x33')][_0x3dd8('0x3c')]);_0x500ad2[_0x3dd8('0x3d')]=qs['filters'](_[_0x3dd8('0x3e')](_0x3daab7['query'],_0x118e59[_0x3dd8('0x3f')]),_0x15d8aa);if(_0x3daab7['query'][_0x3dd8('0x40')]){_0x500ad2[_0x3dd8('0x3d')]=_[_0x3dd8('0x41')](_0x500ad2[_0x3dd8('0x3d')],{'$or':_[_0x3dd8('0x2c')](_0x15d8aa,function(_0x947813){if(_0x947813['type']!==_0x3dd8('0x42')){var _0x196cb9={};_0x196cb9[_0x947813[_0x3dd8('0x29')]]={'$like':'%'+_0x3daab7[_0x3dd8('0x33')][_0x3dd8('0x40')]+'%'};return _0x196cb9;}})});}_0x500ad2=_[_0x3dd8('0x41')]({},_0x500ad2,_0x3daab7['options']);var _0x2cf0b3={'where':_0x500ad2[_0x3dd8('0x3d')]};return db[_0x3dd8('0x2d')][_0x3dd8('0x1f')](_0x2cf0b3)[_0x3dd8('0x25')](function(_0x54ed52){_0x17731b[_0x3dd8('0x1f')]=_0x54ed52;if(_0x3daab7[_0x3dd8('0x33')][_0x3dd8('0x43')]){_0x500ad2[_0x3dd8('0x44')]=[{'all':!![]}];}return db[_0x3dd8('0x2d')][_0x3dd8('0x45')](_0x500ad2);})[_0x3dd8('0x25')](function(_0x446769){_0x17731b[_0x3dd8('0x46')]=_0x446769;return _0x17731b;})['then'](respondWithFilteredResult(_0x515830,_0x500ad2))['catch'](handleError(_0x515830,null));};exports[_0x3dd8('0x47')]=function(_0xd66d89,_0x5059a2){var _0x1cdaac={'raw':!![],'where':{'id':_0xd66d89[_0x3dd8('0x48')]['id']}},_0x19af6d={};_0x19af6d[_0x3dd8('0x32')]=_[_0x3dd8('0x34')](db[_0x3dd8('0x2d')][_0x3dd8('0x2e')]);_0x19af6d[_0x3dd8('0x33')]=_[_0x3dd8('0x34')](_0xd66d89['query']);_0x19af6d[_0x3dd8('0x3f')]=_['intersection'](_0x19af6d[_0x3dd8('0x32')],_0x19af6d[_0x3dd8('0x33')]);_0x1cdaac['attributes']=_[_0x3dd8('0x35')](_0x19af6d[_0x3dd8('0x32')],qs[_0x3dd8('0x36')](_0xd66d89[_0x3dd8('0x33')][_0x3dd8('0x36')]));_0x1cdaac[_0x3dd8('0x37')]=_0x1cdaac[_0x3dd8('0x37')][_0x3dd8('0x38')]?_0x1cdaac[_0x3dd8('0x37')]:_0x19af6d['model'];if(_0xd66d89['query']['includeAll']){_0x1cdaac['include']=[{'all':!![]}];}_0x1cdaac=_['merge']({},_0x1cdaac,_0xd66d89[_0x3dd8('0x49')]);return db[_0x3dd8('0x2d')][_0x3dd8('0x4a')](_0x1cdaac)[_0x3dd8('0x25')](handleEntityNotFound(_0x5059a2,null))['then'](respondWithResult(_0x5059a2,null))[_0x3dd8('0x4b')](handleError(_0x5059a2,null));};exports['create']=function(_0x23390a,_0x2fa180){return db[_0x3dd8('0x2d')][_0x3dd8('0x4c')](_0x23390a[_0x3dd8('0x4d')],{})[_0x3dd8('0x25')](respondWithResult(_0x2fa180,0xc9))[_0x3dd8('0x4b')](handleError(_0x2fa180,null));};exports['update']=function(_0x40d951,_0x5890f4){if(_0x40d951[_0x3dd8('0x4d')]['id']){delete _0x40d951[_0x3dd8('0x4d')]['id'];}return db['ZohoField'][_0x3dd8('0x4a')]({'where':{'id':_0x40d951['params']['id']}})[_0x3dd8('0x25')](handleEntityNotFound(_0x5890f4,null))[_0x3dd8('0x25')](saveUpdates(_0x40d951['body'],null))[_0x3dd8('0x25')](respondWithResult(_0x5890f4,null))[_0x3dd8('0x4b')](handleError(_0x5890f4,null));};exports['destroy']=function(_0x274c68,_0x23b9cb){return db[_0x3dd8('0x2d')][_0x3dd8('0x4a')]({'where':{'id':_0x274c68[_0x3dd8('0x48')]['id']}})['then'](handleEntityNotFound(_0x23b9cb,null))['then'](removeEntity(_0x23b9cb,null))[_0x3dd8('0x4b')](handleError(_0x23b9cb,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7742121..dc2e14a 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 _0x187d=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x2b7a07,_0x188495){var _0x1372ae=function(_0x29f2b4){while(--_0x29f2b4){_0x2b7a07['push'](_0x2b7a07['shift']());}};_0x1372ae(++_0x188495);}(_0x187d,0x93));var _0xd187=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x187d[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0xd187('0x0'));var util=require('util');var logger=require(_0xd187('0x1'))(_0xd187('0x2'));var moment=require(_0xd187('0x3'));var BPromise=require(_0xd187('0x4'));var rp=require(_0xd187('0x5'));var fs=require('fs');var path=require(_0xd187('0x6'));var rimraf=require('rimraf');var config=require(_0xd187('0x7'));var attributes=require(_0xd187('0x8'));module['exports']=function(_0x1d2533,_0x58ee7){return _0x1d2533[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[{'name':_0xd187('0xc'),'fields':[_0xd187('0xd'),_0xd187('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x1283ad,_0x33c0e0){var _0x12afe0=function(_0x231e75){while(--_0x231e75){_0x1283ad['push'](_0x1283ad['shift']());}};_0x12afe0(++_0x33c0e0);}(_0x4745,0x1e7));var _0x5474=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x4745[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));module[_0x5474('0xb')]=function(_0x4e7ce7,_0x3d1e1){return _0x4e7ce7[_0x5474('0xc')]('ZohoField',attributes,{'tableName':_0x5474('0xd'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x5474('0xe'),_0x5474('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 4c29258..367b409 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 _0x0044=['code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0xea8ad,_0x38e947){var _0x2ac735=function(_0x156d73){while(--_0x156d73){_0xea8ad['push'](_0xea8ad['shift']());}};_0x2ac735(++_0x38e947);}(_0x0044,0x1d3));var _0x4004=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x0044[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require(_0x4004('0x0'));var util=require(_0x4004('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4004('0x2'));var fs=require('fs');var Redis=require(_0x4004('0x3'));var db=require(_0x4004('0x4'))['db'];var utils=require(_0x4004('0x5'));var logger=require('../../config/logger')(_0x4004('0x6'));var config=require('../../config/environment');var jayson=require(_0x4004('0x7'));var client=jayson[_0x4004('0x8')][_0x4004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2696bb,_0x2826fb,_0x41d5a6){return new BPromise(function(_0x103b95,_0x43f193){return client[_0x4004('0xa')](_0x2696bb,_0x41d5a6)[_0x4004('0xb')](function(_0x4d81da){logger['info'](_0x4004('0xc'),_0x2826fb,_0x4004('0xd'));logger[_0x4004('0xe')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x2826fb,_0x4004('0xd'),JSON['stringify'](_0x4d81da));if(_0x4d81da[_0x4004('0xf')]){if(_0x4d81da[_0x4004('0xf')][_0x4004('0x10')]===0x1f4){logger[_0x4004('0xf')](_0x4004('0xc'),_0x2826fb,_0x4d81da[_0x4004('0xf')]['message']);return _0x43f193(_0x4d81da[_0x4004('0xf')][_0x4004('0x11')]);}logger[_0x4004('0xf')](_0x4004('0xc'),_0x2826fb,_0x4d81da[_0x4004('0xf')][_0x4004('0x11')]);return _0x103b95(_0x4d81da['error'][_0x4004('0x11')]);}else{logger[_0x4004('0x12')](_0x4004('0xc'),_0x2826fb,'request\x20sent');_0x103b95(_0x4d81da[_0x4004('0x13')][_0x4004('0x11')]);}})[_0x4004('0x14')](function(_0x4e6761){logger['error'](_0x4004('0xc'),_0x2826fb,_0x4e6761);_0x43f193(_0x4e6761);});});} \ No newline at end of file +var _0xc5f3=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e1ccf,_0x33abc3){var _0x10a1ca=function(_0x1756ba){while(--_0x1756ba){_0x4e1ccf['push'](_0x4e1ccf['shift']());}};_0x10a1ca(++_0x33abc3);}(_0xc5f3,0xc0));var _0x3c5f=function(_0x2add1c,_0x50f7c7){_0x2add1c=_0x2add1c-0x0;var _0x304af0=_0xc5f3[_0x2add1c];return _0x304af0;};'use strict';var _=require(_0x3c5f('0x0'));var util=require(_0x3c5f('0x1'));var moment=require(_0x3c5f('0x2'));var BPromise=require(_0x3c5f('0x3'));var rs=require(_0x3c5f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c5f('0x5'))['db'];var utils=require(_0x3c5f('0x6'));var logger=require(_0x3c5f('0x7'))(_0x3c5f('0x8'));var config=require(_0x3c5f('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x158da6,_0xe3dcf5,_0xff712c){return new BPromise(function(_0x32714f,_0x587049){return client[_0x3c5f('0xa')](_0x158da6,_0xff712c)[_0x3c5f('0xb')](function(_0x5a9979){logger[_0x3c5f('0xc')](_0x3c5f('0xd'),_0xe3dcf5,_0x3c5f('0xe'));logger['debug'](_0x3c5f('0xf'),_0xe3dcf5,_0x3c5f('0xe'),JSON[_0x3c5f('0x10')](_0x5a9979));if(_0x5a9979[_0x3c5f('0x11')]){if(_0x5a9979[_0x3c5f('0x11')][_0x3c5f('0x12')]===0x1f4){logger[_0x3c5f('0x11')]('ZohoField,\x20%s,\x20%s',_0xe3dcf5,_0x5a9979[_0x3c5f('0x11')][_0x3c5f('0x13')]);return _0x587049(_0x5a9979[_0x3c5f('0x11')]['message']);}logger[_0x3c5f('0x11')](_0x3c5f('0xd'),_0xe3dcf5,_0x5a9979[_0x3c5f('0x11')][_0x3c5f('0x13')]);return _0x32714f(_0x5a9979[_0x3c5f('0x11')]['message']);}else{logger['info'](_0x3c5f('0xd'),_0xe3dcf5,_0x3c5f('0xe'));_0x32714f(_0x5a9979['result']['message']);}})[_0x3c5f('0x14')](function(_0x354848){logger[_0x3c5f('0x11')](_0x3c5f('0xd'),_0xe3dcf5,_0x354848);_0x587049(_0x354848);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 261a40a..8369b9b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x37826f,_0x779d5c){var _0x4c15fa=function(_0x5cbb05){while(--_0x5cbb05){_0x37826f['push'](_0x37826f['shift']());}};_0x4c15fa(++_0x779d5c);}(_0xe706,0xa3));var _0x6e70=function(_0x614c88,_0x184f02){_0x614c88=_0x614c88-0x0;var _0x1a768e=_0xe706[_0x614c88];return _0x1a768e;};'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(_0x2af3dc,_0x381780){var _0x3d408c=function(_0x5b0dd0){while(--_0x5b0dd0){_0x2af3dc['push'](_0x2af3dc['shift']());}};_0x3d408c(++_0x381780);}(_0x70e0,0x17b));var _0x070e=function(_0x187f18,_0x5d5ec5){_0x187f18=_0x187f18-0x0;var _0x50c69f=_0x70e0[_0x187f18];return _0x50c69f;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 045ba3f..41372f5 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 _0xe6d7=['STRING','INTEGER','BOOLEAN','state','exports','unique_name_and_version'];(function(_0xf559d9,_0x1f86bf){var _0x510c2b=function(_0xd38209){while(--_0xd38209){_0xf559d9['push'](_0xf559d9['shift']());}};_0x510c2b(++_0x1f86bf);}(_0xe6d7,0x1ae));var _0x7e6d=function(_0x285c76,_0x12ea80){_0x285c76=_0x285c76-0x0;var _0x5ced11=_0xe6d7[_0x285c76];return _0x5ced11;};'use strict';var Sequelize=require('sequelize');module[_0x7e6d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7e6d('0x1')},'version':{'type':Sequelize[_0x7e6d('0x2')],'allowNull':![],'unique':_0x7e6d('0x1')},'main':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x7e6d('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x7e6d('0x3')]},'active':{'type':Sequelize[_0x7e6d('0x4')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x7e6d('0x2')]},'state':{'type':Sequelize[_0x7e6d('0x2')],'unique':_0x7e6d('0x5')},'description':{'type':Sequelize[_0x7e6d('0x2')]},'title':{'type':Sequelize[_0x7e6d('0x2')]},'remoteUri':{'type':Sequelize[_0x7e6d('0x2')]},'link':{'type':Sequelize[_0x7e6d('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0x8c7a=['sequelize','unique_name_and_version','STRING','app.js','INTEGER','BOOLEAN','state'];(function(_0x249f71,_0x51bc1b){var _0x27deec=function(_0x3f5358){while(--_0x3f5358){_0x249f71['push'](_0x249f71['shift']());}};_0x27deec(++_0x51bc1b);}(_0x8c7a,0x8c));var _0xa8c7=function(_0x3a310f,_0x5885f6){_0x3a310f=_0x3a310f-0x0;var _0x54692c=_0x8c7a[_0x3a310f];return _0x54692c;};'use strict';var Sequelize=require(_0xa8c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa8c7('0x1')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa8c7('0x1')},'main':{'type':Sequelize[_0xa8c7('0x2')],'defaultValue':_0xa8c7('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa8c7('0x2')]},'size':{'type':Sequelize[_0xa8c7('0x4')]},'active':{'type':Sequelize[_0xa8c7('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xa8c7('0x2')]},'logo':{'type':Sequelize[_0xa8c7('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xa8c7('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0xa8c7('0x2')]},'remoteUri':{'type':Sequelize[_0xa8c7('0x2')]},'link':{'type':Sequelize[_0xa8c7('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index faf20b7..6136a4d 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 _0xba34=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','Integration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x4af272,_0x83ab96){var _0x44b83e=function(_0x48d85e){while(--_0x48d85e){_0x4af272['push'](_0x4af272['shift']());}};_0x44b83e(++_0x83ab96);}(_0xba34,0x119));var _0x4ba3=function(_0xdf6c06,_0xc36cfa){_0xdf6c06=_0xdf6c06-0x0;var _0x1d3c81=_0xba34[_0xdf6c06];return _0x1d3c81;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['Integration']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));}; \ 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(_0x34870c,_0x553881){var _0xb4bbe4=function(_0x402417){while(--_0x402417){_0x34870c['push'](_0x34870c['shift']());}};_0xb4bbe4(++_0x553881);}(_0xacf4,0xe7));var _0x4acf=function(_0x43a73c,_0x2c5b99){_0x43a73c=_0x43a73c-0x0;var _0x3b5c3b=_0xacf4[_0x43a73c];return _0x3b5c3b;};'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 ed8965a..c658d54 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 _0x7fd1=['api','moment','bluebird','request-promise','../../config/environment','lodash'];(function(_0x41dd1b,_0x3d366a){var _0x32a922=function(_0x34cc53){while(--_0x34cc53){_0x41dd1b['push'](_0x41dd1b['shift']());}};_0x32a922(++_0x3d366a);}(_0x7fd1,0x1c7));var _0x17fd=function(_0x2aca6a,_0x354460){_0x2aca6a=_0x2aca6a-0x0;var _0x4ca12b=_0x7fd1[_0x2aca6a];return _0x4ca12b;};'use strict';var _=require(_0x17fd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x17fd('0x1'));var moment=require(_0x17fd('0x2'));var BPromise=require(_0x17fd('0x3'));var rp=require(_0x17fd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x17fd('0x5'));var attributes=require('./integration.attributes');module['exports']=function(_0x1b82ac,_0x4fda5f){return _0x1b82ac['define']('Integration',attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb04a=['../../config/environment','exports','Integration','lodash','api','moment','bluebird','request-promise','path'];(function(_0x267120,_0x413c07){var _0x54d790=function(_0x1a65d5){while(--_0x1a65d5){_0x267120['push'](_0x267120['shift']());}};_0x54d790(++_0x413c07);}(_0xb04a,0x1aa));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab04('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xab04('0x1'));var moment=require(_0xab04('0x2'));var BPromise=require(_0xab04('0x3'));var rp=require(_0xab04('0x4'));var fs=require('fs');var path=require(_0xab04('0x5'));var rimraf=require('rimraf');var config=require(_0xab04('0x6'));var attributes=require('./integration.attributes');module[_0xab04('0x7')]=function(_0x4484df,_0x3cf70b){return _0x4484df['define'](_0xab04('0x8'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 8cf6170..d3d1197 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 _0x7880=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xa8da34,_0x4d7b12){var _0x3b63ae=function(_0x11b5ef){while(--_0x11b5ef){_0xa8da34['push'](_0xa8da34['shift']());}};_0x3b63ae(++_0x4d7b12);}(_0x7880,0x1f4));var _0x0788=function(_0x4c4664,_0x506a85){_0x4c4664=_0x4c4664-0x0;var _0x2920cf=_0x7880[_0x4c4664];return _0x2920cf;};'use strict';var _=require('lodash');var util=require(_0x0788('0x0'));var moment=require(_0x0788('0x1'));var BPromise=require(_0x0788('0x2'));var rs=require(_0x0788('0x3'));var fs=require('fs');var Redis=require(_0x0788('0x4'));var db=require(_0x0788('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0788('0x6'))(_0x0788('0x7'));var config=require(_0x0788('0x8'));var jayson=require(_0x0788('0x9'));var client=jayson[_0x0788('0xa')][_0x0788('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f9cb8,_0x44bbb5,_0x3c29f3){return new BPromise(function(_0x422f8b,_0x55e48a){return client[_0x0788('0xc')](_0x3f9cb8,_0x3c29f3)['then'](function(_0xabaf81){logger['info'](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));logger[_0x0788('0xf')](_0x0788('0x10'),_0x44bbb5,_0x0788('0xe'),JSON['stringify'](_0xabaf81));if(_0xabaf81[_0x0788('0x11')]){if(_0xabaf81[_0x0788('0x11')][_0x0788('0x12')]===0x1f4){logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')][_0x0788('0x13')]);return _0x55e48a(_0xabaf81['error'][_0x0788('0x13')]);}logger[_0x0788('0x11')](_0x0788('0xd'),_0x44bbb5,_0xabaf81[_0x0788('0x11')]['message']);return _0x422f8b(_0xabaf81[_0x0788('0x11')]['message']);}else{logger[_0x0788('0x14')](_0x0788('0xd'),_0x44bbb5,_0x0788('0xe'));_0x422f8b(_0xabaf81[_0x0788('0x15')][_0x0788('0x13')]);}})[_0x0788('0x16')](function(_0x5e1a29){logger['error'](_0x0788('0xd'),_0x44bbb5,_0x5e1a29);_0x55e48a(_0x5e1a29);});});} \ No newline at end of file +var _0xef0f=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3e0f52,_0x3754e6){var _0xc558fd=function(_0xdebfaf){while(--_0xdebfaf){_0x3e0f52['push'](_0x3e0f52['shift']());}};_0xc558fd(++_0x3754e6);}(_0xef0f,0x168));var _0xfef0=function(_0x5a0d6c,_0x902134){_0x5a0d6c=_0x5a0d6c-0x0;var _0x35c128=_0xef0f[_0x5a0d6c];return _0x35c128;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('Integration,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('Integration,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 782a5bd..2c7acbb 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 _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x16998a,_0x4b6ac9){var _0x5cb28b=function(_0x23346c){while(--_0x23346c){_0x16998a['push'](_0x16998a['shift']());}};_0x5cb28b(++_0x4b6ac9);}(_0x2ef3,0xba));var _0x32ef=function(_0xc9b834,_0x3a6b7d){_0xc9b834=_0xc9b834-0x0;var _0x1f1011=_0x2ef3[_0xc9b834];return _0x1f1011;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file +var _0x2ef3=['express','Router','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x2dd4b1,_0x374b00){var _0x6fd4cb=function(_0x2fe408){while(--_0x2fe408){_0x2dd4b1['push'](_0x2dd4b1['shift']());}};_0x6fd4cb(++_0x374b00);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c604a,_0x31a174){_0x3c604a=_0x3c604a-0x0;var _0x3829ba=_0x2ef3[_0x3c604a];return _0x3829ba;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')]('/',auth[_0x32ef('0xb')](),controller['create']);router['put'](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x11')]('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 4bf394b..5ed88ea 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 _0x336c=['TEXT','ENUM','SENT','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5909bb,_0x32ee6b){var _0x1adac0=function(_0x129b48){while(--_0x129b48){_0x5909bb['push'](_0x5909bb['shift']());}};_0x1adac0(++_0x32ee6b);}(_0x336c,0x1a7));var _0xc336=function(_0x37432c,_0x41a117){_0x37432c=_0x37432c-0x0;var _0x38ffbc=_0x336c[_0x37432c];return _0x38ffbc;};'use strict';var Sequelize=require(_0xc336('0x0'));module[_0xc336('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xc336('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xc336('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc336('0x2')]},'interface':{'type':Sequelize[_0xc336('0x2')]},'membername':{'type':Sequelize[_0xc336('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc336('0x3')]},'holdtime':{'type':Sequelize[_0xc336('0x4')]},'agentcomplete':{'type':Sequelize[_0xc336('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xc336('0x4')]},'agentacw':{'type':Sequelize[_0xc336('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc336('0x4')]},'reason':{'type':Sequelize[_0xc336('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xc336('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc336('0x3')]},'agentdump':{'type':Sequelize[_0xc336('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc336('0x3')]},'lastevent':{'type':Sequelize[_0xc336('0x2')]},'channel':{'type':Sequelize[_0xc336('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0xc336('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc336('0x2')]},'accountcode':{'type':Sequelize[_0xc336('0x2')]},'context':{'type':Sequelize[_0xc336('0x2')]},'exten':{'type':Sequelize[_0xc336('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xc336('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc336('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc336('0x2')]},'destcalleridname':{'type':Sequelize[_0xc336('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc336('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xc336('0x2')]},'destaccountcode':{'type':Sequelize[_0xc336('0x2')]},'destcontext':{'type':Sequelize[_0xc336('0x2')]},'destexten':{'type':Sequelize[_0xc336('0x2')]},'destpriority':{'type':Sequelize[_0xc336('0x2')]},'destuniqueid':{'type':Sequelize[_0xc336('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc336('0x2')]},'subject':{'type':Sequelize[_0xc336('0x2')]},'from':{'type':Sequelize[_0xc336('0x2')]},'to':{'type':Sequelize[_0xc336('0x2')]},'cc':{'type':Sequelize[_0xc336('0x2')]},'attachment':{'type':Sequelize[_0xc336('0x6')]},'html':{'type':Sequelize[_0xc336('0x6')]},'text':{'type':Sequelize[_0xc336('0x6')]},'status':{'type':Sequelize[_0xc336('0x7')](_0xc336('0x8'),'SENDING',_0xc336('0x9'),_0xc336('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0xc336('0x2')]},'projectId':{'type':Sequelize[_0xc336('0x4')]}}; \ No newline at end of file +var _0x85f7=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x85f7,0x1ad));var _0x785f=function(_0x53f9b7,_0x40f890){_0x53f9b7=_0x53f9b7-0x0;var _0x59816c=_0x85f7[_0x53f9b7];return _0x59816c;};'use strict';var Sequelize=require('sequelize');module[_0x785f('0x0')]={'integration':{'type':Sequelize[_0x785f('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x785f('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x785f('0x2')]},'contacts':{'type':Sequelize[_0x785f('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x785f('0x1')]},'calleridname':{'type':Sequelize[_0x785f('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x785f('0x1')]},'membername':{'type':Sequelize[_0x785f('0x1')]},'agentcalledAt':{'type':Sequelize[_0x785f('0x3')]},'agentconnectAt':{'type':Sequelize[_0x785f('0x3')]},'holdtime':{'type':Sequelize[_0x785f('0x2')]},'agentcomplete':{'type':Sequelize[_0x785f('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x785f('0x3')]},'talktime':{'type':Sequelize[_0x785f('0x2')]},'agentacw':{'type':Sequelize[_0x785f('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x785f('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x785f('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x785f('0x3')]},'agentdump':{'type':Sequelize[_0x785f('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x785f('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x785f('0x2')]},'channelstatedesc':{'type':Sequelize[_0x785f('0x1')]},'connectedlinenum':{'type':Sequelize[_0x785f('0x1')]},'connectedlinename':{'type':Sequelize[_0x785f('0x1')]},'language':{'type':Sequelize[_0x785f('0x1')]},'accountcode':{'type':Sequelize[_0x785f('0x1')]},'context':{'type':Sequelize[_0x785f('0x1')]},'exten':{'type':Sequelize[_0x785f('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x785f('0x1')]},'destchannelstate':{'type':Sequelize[_0x785f('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x785f('0x1')]},'destcalleridnum':{'type':Sequelize[_0x785f('0x1')]},'destcalleridname':{'type':Sequelize[_0x785f('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x785f('0x1')]},'destlanguage':{'type':Sequelize[_0x785f('0x1')]},'destaccountcode':{'type':Sequelize[_0x785f('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x785f('0x1')]},'destpriority':{'type':Sequelize[_0x785f('0x1')]},'destuniqueid':{'type':Sequelize[_0x785f('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x785f('0x1')]},'subject':{'type':Sequelize[_0x785f('0x1')]},'from':{'type':Sequelize[_0x785f('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x785f('0x1')]},'attachment':{'type':Sequelize[_0x785f('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x785f('0x5')]},'status':{'type':Sequelize[_0x785f('0x6')](_0x785f('0x7'),_0x785f('0x8'),_0x785f('0x9'),_0x785f('0xa'))},'url':{'type':Sequelize[_0x785f('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x785f('0x1')]},'projectId':{'type':Sequelize[_0x785f('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a10ead9..4b72478 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 _0xc729=['rows','catch','params','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','includeAll','include','findAll'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0xc729,0xed));var _0x9c72=function(_0x4f94d4,_0x236430){_0x4f94d4=_0x4f94d4-0x0;var _0x446c58=_0xc729[_0x4f94d4];return _0x446c58;};'use strict';var emlformat=require(_0x9c72('0x0'));var rimraf=require(_0x9c72('0x1'));var zipdir=require(_0x9c72('0x2'));var jsonpatch=require(_0x9c72('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c72('0x4'));var util=require(_0x9c72('0x5'));var path=require(_0x9c72('0x6'));var sox=require(_0x9c72('0x7'));var csv=require('to-csv');var ejs=require(_0x9c72('0x8'));var fs=require('fs');var fs_extra=require(_0x9c72('0x9'));var _=require(_0x9c72('0xa'));var squel=require(_0x9c72('0xb'));var crypto=require(_0x9c72('0xc'));var jsforce=require(_0x9c72('0xd'));var deskjs=require(_0x9c72('0xe'));var toCsv=require(_0x9c72('0xf'));var querystring=require(_0x9c72('0x10'));var Papa=require(_0x9c72('0x11'));var Redis=require(_0x9c72('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9c72('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c72('0x14'));var logger=require('../../config/logger')(_0x9c72('0x15'));var utils=require(_0x9c72('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9c72('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11a60e,_0x4c3a06){_0x4c3a06=_0x4c3a06||0xcc;return function(_0x1fc5f1){if(_0x1fc5f1){return _0x11a60e[_0x9c72('0x18')](_0x4c3a06);}return _0x11a60e[_0x9c72('0x19')](_0x4c3a06)[_0x9c72('0x1a')]();};}function respondWithResult(_0x11e3c8,_0x38dc4a){_0x38dc4a=_0x38dc4a||0xc8;return function(_0x3665eb){if(_0x3665eb){return _0x11e3c8['status'](_0x38dc4a)['json'](_0x3665eb);}};}function respondWithFilteredResult(_0x33dc7f,_0x1af23d){return function(_0x420a46){if(_0x420a46){var _0x49fc3e=typeof _0x1af23d[_0x9c72('0x1b')]===_0x9c72('0x1c')&&typeof _0x1af23d['limit']===_0x9c72('0x1c');var _0x3a7bdc=_0x420a46[_0x9c72('0x1d')];var _0x177a06=_0x49fc3e?0x0:_0x1af23d[_0x9c72('0x1b')];var _0x3166f3=_0x49fc3e?_0x420a46[_0x9c72('0x1d')]:_0x1af23d['offset']+_0x1af23d[_0x9c72('0x1e')];var _0x25433f;if(_0x3166f3>=_0x3a7bdc){_0x3166f3=_0x3a7bdc;_0x25433f=0xc8;}else{_0x25433f=0xce;}_0x33dc7f[_0x9c72('0x19')](_0x25433f);return _0x33dc7f[_0x9c72('0x1f')](_0x9c72('0x20'),_0x177a06+'-'+_0x3166f3+'/'+_0x3a7bdc)['json'](_0x420a46);}return null;};}function patchUpdates(_0x20edb4){return function(_0x43c96b){try{jsonpatch[_0x9c72('0x21')](_0x43c96b,_0x20edb4,!![]);}catch(_0x1a49b5){return BPromise[_0x9c72('0x22')](_0x1a49b5);}return _0x43c96b[_0x9c72('0x23')]();};}function saveUpdates(_0x169033,_0x4aa0c4){return function(_0x77f0a){if(_0x77f0a){return _0x77f0a[_0x9c72('0x24')](_0x169033)['then'](function(_0x237ad9){return _0x237ad9;});}return null;};}function removeEntity(_0x405158,_0x3ebf67){return function(_0x19485f){if(_0x19485f){return _0x19485f[_0x9c72('0x25')]()[_0x9c72('0x26')](function(){_0x405158[_0x9c72('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x508b57,_0x1b4ae5){return function(_0x4fd61f){if(!_0x4fd61f){_0x508b57['sendStatus'](0x194);}return _0x4fd61f;};}function handleError(_0x5905a9,_0x133eea){_0x133eea=_0x133eea||0x1f4;return function(_0x5b3af3){logger['error'](_0x5b3af3[_0x9c72('0x27')]);if(_0x5b3af3[_0x9c72('0x28')]){delete _0x5b3af3[_0x9c72('0x28')];}_0x5905a9[_0x9c72('0x19')](_0x133eea)[_0x9c72('0x29')](_0x5b3af3);};}exports[_0x9c72('0x2a')]=function(_0x479d12,_0x425799){var _0x52e057={},_0x140e21={},_0x5df9b5={'count':0x0,'rows':[]};var _0x3a81cb=_['map'](db[_0x9c72('0x2b')][_0x9c72('0x2c')],function(_0x5a03d8){return{'name':_0x5a03d8[_0x9c72('0x2d')],'type':_0x5a03d8['type'][_0x9c72('0x2e')]};});_0x140e21[_0x9c72('0x2f')]=_[_0x9c72('0x30')](_0x3a81cb,_0x9c72('0x28'));_0x140e21[_0x9c72('0x31')]=_[_0x9c72('0x32')](_0x479d12[_0x9c72('0x31')]);_0x140e21[_0x9c72('0x33')]=_[_0x9c72('0x34')](_0x140e21[_0x9c72('0x2f')],_0x140e21['query']);_0x52e057['attributes']=_[_0x9c72('0x34')](_0x140e21[_0x9c72('0x2f')],qs[_0x9c72('0x35')](_0x479d12[_0x9c72('0x31')][_0x9c72('0x35')]));_0x52e057[_0x9c72('0x36')]=_0x52e057[_0x9c72('0x36')][_0x9c72('0x37')]?_0x52e057[_0x9c72('0x36')]:_0x140e21[_0x9c72('0x2f')];if(!_0x479d12[_0x9c72('0x31')][_0x9c72('0x38')](_0x9c72('0x39'))){_0x52e057[_0x9c72('0x1e')]=qs['limit'](_0x479d12['query'][_0x9c72('0x1e')]);_0x52e057['offset']=qs['offset'](_0x479d12['query'][_0x9c72('0x1b')]);}_0x52e057[_0x9c72('0x3a')]=qs[_0x9c72('0x3b')](_0x479d12[_0x9c72('0x31')]['sort']);_0x52e057['where']=qs[_0x9c72('0x33')](_[_0x9c72('0x3c')](_0x479d12[_0x9c72('0x31')],_0x140e21[_0x9c72('0x33')]),_0x3a81cb);if(_0x479d12[_0x9c72('0x31')]['filter']){_0x52e057[_0x9c72('0x3d')]=_['merge'](_0x52e057[_0x9c72('0x3d')],{'$or':_[_0x9c72('0x30')](_0x3a81cb,function(_0x1b8ec4){if(_0x1b8ec4[_0x9c72('0x3e')]!==_0x9c72('0x3f')){var _0x57f351={};_0x57f351[_0x1b8ec4['name']]={'$like':'%'+_0x479d12['query']['filter']+'%'};return _0x57f351;}})});}_0x52e057=_['merge']({},_0x52e057,_0x479d12['options']);var _0xd47c0e={'where':_0x52e057['where']};return db['IntegrationReport'][_0x9c72('0x1d')](_0xd47c0e)[_0x9c72('0x26')](function(_0x1779f0){_0x5df9b5[_0x9c72('0x1d')]=_0x1779f0;if(_0x479d12[_0x9c72('0x31')][_0x9c72('0x40')]){_0x52e057[_0x9c72('0x41')]=[{'all':!![]}];}return db[_0x9c72('0x2b')][_0x9c72('0x42')](_0x52e057);})[_0x9c72('0x26')](function(_0x42faa5){_0x5df9b5[_0x9c72('0x43')]=_0x42faa5;return _0x5df9b5;})[_0x9c72('0x26')](respondWithFilteredResult(_0x425799,_0x52e057))[_0x9c72('0x44')](handleError(_0x425799,null));};exports['show']=function(_0xc4c21e,_0x579763){var _0x1410d0={'raw':![],'where':{'id':_0xc4c21e[_0x9c72('0x45')]['id']}},_0x231984={};_0x231984['model']=_[_0x9c72('0x32')](db[_0x9c72('0x2b')][_0x9c72('0x2c')]);_0x231984[_0x9c72('0x31')]=_[_0x9c72('0x32')](_0xc4c21e[_0x9c72('0x31')]);_0x231984[_0x9c72('0x33')]=_[_0x9c72('0x34')](_0x231984[_0x9c72('0x2f')],_0x231984['query']);_0x1410d0[_0x9c72('0x36')]=_['intersection'](_0x231984[_0x9c72('0x2f')],qs[_0x9c72('0x35')](_0xc4c21e[_0x9c72('0x31')][_0x9c72('0x35')]));_0x1410d0[_0x9c72('0x36')]=_0x1410d0[_0x9c72('0x36')][_0x9c72('0x37')]?_0x1410d0[_0x9c72('0x36')]:_0x231984[_0x9c72('0x2f')];if(_0xc4c21e[_0x9c72('0x31')]['includeAll']){_0x1410d0[_0x9c72('0x41')]=[{'all':!![]}];}_0x1410d0=_[_0x9c72('0x46')]({},_0x1410d0,_0xc4c21e[_0x9c72('0x47')]);return db[_0x9c72('0x2b')][_0x9c72('0x48')](_0x1410d0)[_0x9c72('0x26')](handleEntityNotFound(_0x579763,null))[_0x9c72('0x26')](respondWithResult(_0x579763,null))[_0x9c72('0x44')](handleError(_0x579763,null));};exports[_0x9c72('0x49')]=function(_0x2308b0,_0x2347f5){return db[_0x9c72('0x2b')][_0x9c72('0x49')](_0x2308b0[_0x9c72('0x4a')],{})[_0x9c72('0x26')](respondWithResult(_0x2347f5,0xc9))[_0x9c72('0x44')](handleError(_0x2347f5,null));};exports[_0x9c72('0x24')]=function(_0x551e7c,_0x2de695){if(_0x551e7c['body']['id']){delete _0x551e7c[_0x9c72('0x4a')]['id'];}return db['IntegrationReport'][_0x9c72('0x48')]({'where':{'id':_0x551e7c[_0x9c72('0x45')]['id']}})['then'](handleEntityNotFound(_0x2de695,null))[_0x9c72('0x26')](saveUpdates(_0x551e7c[_0x9c72('0x4a')],null))['then'](respondWithResult(_0x2de695,null))[_0x9c72('0x44')](handleError(_0x2de695,null));};exports['destroy']=function(_0x506f98,_0x5430b0){return db[_0x9c72('0x2b')][_0x9c72('0x48')]({'where':{'id':_0x506f98[_0x9c72('0x45')]['id']}})['then'](handleEntityNotFound(_0x5430b0,null))[_0x9c72('0x26')](removeEntity(_0x5430b0,null))[_0x9c72('0x44')](handleError(_0x5430b0,null));};exports[_0x9c72('0x4b')]=function(_0x5a8c8f,_0x17c9b7){return db['IntegrationReport'][_0x9c72('0x4b')]()[_0x9c72('0x26')](respondWithResult(_0x17c9b7,null))['catch'](handleError(_0x17c9b7,null));}; \ No newline at end of file +var _0x5a19=['name','send','map','IntegrationReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','params','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','error','stack'];(function(_0x54f920,_0xe59f0){var _0x57581a=function(_0x407844){while(--_0x407844){_0x54f920['push'](_0x54f920['shift']());}};_0x57581a(++_0xe59f0);}(_0x5a19,0x69));var _0x95a1=function(_0x4ed1d4,_0x512d9a){_0x4ed1d4=_0x4ed1d4-0x0;var _0x28e363=_0x5a19[_0x4ed1d4];return _0x28e363;};'use strict';var emlformat=require(_0x95a1('0x0'));var rimraf=require(_0x95a1('0x1'));var zipdir=require(_0x95a1('0x2'));var jsonpatch=require(_0x95a1('0x3'));var rp=require(_0x95a1('0x4'));var moment=require('moment');var BPromise=require(_0x95a1('0x5'));var Mustache=require(_0x95a1('0x6'));var util=require(_0x95a1('0x7'));var path=require('path');var sox=require(_0x95a1('0x8'));var csv=require(_0x95a1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x95a1('0xa'));var squel=require('squel');var crypto=require(_0x95a1('0xb'));var jsforce=require(_0x95a1('0xc'));var deskjs=require(_0x95a1('0xd'));var toCsv=require(_0x95a1('0x9'));var querystring=require(_0x95a1('0xe'));var Papa=require(_0x95a1('0xf'));var Redis=require(_0x95a1('0x10'));var authService=require(_0x95a1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x95a1('0x12'));var logger=require(_0x95a1('0x13'))(_0x95a1('0x14'));var utils=require(_0x95a1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x95a1('0x16'));var db=require(_0x95a1('0x17'))['db'];function respondWithStatusCode(_0x2e6c33,_0x25e60d){_0x25e60d=_0x25e60d||0xcc;return function(_0x501d6d){if(_0x501d6d){return _0x2e6c33[_0x95a1('0x18')](_0x25e60d);}return _0x2e6c33['status'](_0x25e60d)[_0x95a1('0x19')]();};}function respondWithResult(_0x31cc1e,_0x5d5028){_0x5d5028=_0x5d5028||0xc8;return function(_0x48f4bd){if(_0x48f4bd){return _0x31cc1e[_0x95a1('0x1a')](_0x5d5028)[_0x95a1('0x1b')](_0x48f4bd);}};}function respondWithFilteredResult(_0x180154,_0x3bea98){return function(_0x2aa1a8){if(_0x2aa1a8){var _0x2cbfc1=typeof _0x3bea98[_0x95a1('0x1c')]===_0x95a1('0x1d')&&typeof _0x3bea98[_0x95a1('0x1e')]===_0x95a1('0x1d');var _0x498c46=_0x2aa1a8[_0x95a1('0x1f')];var _0x1c30cc=_0x2cbfc1?0x0:_0x3bea98[_0x95a1('0x1c')];var _0x160cb1=_0x2cbfc1?_0x2aa1a8[_0x95a1('0x1f')]:_0x3bea98[_0x95a1('0x1c')]+_0x3bea98[_0x95a1('0x1e')];var _0x2b3b88;if(_0x160cb1>=_0x498c46){_0x160cb1=_0x498c46;_0x2b3b88=0xc8;}else{_0x2b3b88=0xce;}_0x180154['status'](_0x2b3b88);return _0x180154[_0x95a1('0x20')](_0x95a1('0x21'),_0x1c30cc+'-'+_0x160cb1+'/'+_0x498c46)['json'](_0x2aa1a8);}return null;};}function patchUpdates(_0x1f6c88){return function(_0x3dba38){try{jsonpatch['apply'](_0x3dba38,_0x1f6c88,!![]);}catch(_0x269e51){return BPromise[_0x95a1('0x22')](_0x269e51);}return _0x3dba38[_0x95a1('0x23')]();};}function saveUpdates(_0x1d7928,_0x5384ca){return function(_0x60d18a){if(_0x60d18a){return _0x60d18a[_0x95a1('0x24')](_0x1d7928)['then'](function(_0x390f35){return _0x390f35;});}return null;};}function removeEntity(_0x268dea,_0x2563c4){return function(_0x3bcd4a){if(_0x3bcd4a){return _0x3bcd4a[_0x95a1('0x25')]()[_0x95a1('0x26')](function(){_0x268dea[_0x95a1('0x1a')](0xcc)[_0x95a1('0x19')]();});}};}function handleEntityNotFound(_0x4b8aa3,_0x2d3e1a){return function(_0x354a80){if(!_0x354a80){_0x4b8aa3['sendStatus'](0x194);}return _0x354a80;};}function handleError(_0x3b9e34,_0x269230){_0x269230=_0x269230||0x1f4;return function(_0x112a64){logger[_0x95a1('0x27')](_0x112a64[_0x95a1('0x28')]);if(_0x112a64[_0x95a1('0x29')]){delete _0x112a64['name'];}_0x3b9e34[_0x95a1('0x1a')](_0x269230)[_0x95a1('0x2a')](_0x112a64);};}exports['index']=function(_0x623a3e,_0x583384){var _0x1d5cb9={},_0x40f4a1={},_0x42e738={'count':0x0,'rows':[]};var _0x35a681=_[_0x95a1('0x2b')](db[_0x95a1('0x2c')]['rawAttributes'],function(_0x5a5e59){return{'name':_0x5a5e59['fieldName'],'type':_0x5a5e59[_0x95a1('0x2d')]['key']};});_0x40f4a1[_0x95a1('0x2e')]=_[_0x95a1('0x2b')](_0x35a681,_0x95a1('0x29'));_0x40f4a1[_0x95a1('0x2f')]=_[_0x95a1('0x30')](_0x623a3e[_0x95a1('0x2f')]);_0x40f4a1[_0x95a1('0x31')]=_[_0x95a1('0x32')](_0x40f4a1[_0x95a1('0x2e')],_0x40f4a1[_0x95a1('0x2f')]);_0x1d5cb9[_0x95a1('0x33')]=_[_0x95a1('0x32')](_0x40f4a1[_0x95a1('0x2e')],qs[_0x95a1('0x34')](_0x623a3e[_0x95a1('0x2f')]['fields']));_0x1d5cb9['attributes']=_0x1d5cb9['attributes'][_0x95a1('0x35')]?_0x1d5cb9['attributes']:_0x40f4a1[_0x95a1('0x2e')];if(!_0x623a3e[_0x95a1('0x2f')][_0x95a1('0x36')]('nolimit')){_0x1d5cb9[_0x95a1('0x1e')]=qs[_0x95a1('0x1e')](_0x623a3e[_0x95a1('0x2f')][_0x95a1('0x1e')]);_0x1d5cb9['offset']=qs[_0x95a1('0x1c')](_0x623a3e[_0x95a1('0x2f')][_0x95a1('0x1c')]);}_0x1d5cb9[_0x95a1('0x37')]=qs[_0x95a1('0x38')](_0x623a3e[_0x95a1('0x2f')][_0x95a1('0x38')]);_0x1d5cb9[_0x95a1('0x39')]=qs[_0x95a1('0x31')](_[_0x95a1('0x3a')](_0x623a3e['query'],_0x40f4a1['filters']),_0x35a681);if(_0x623a3e[_0x95a1('0x2f')]['filter']){_0x1d5cb9[_0x95a1('0x39')]=_[_0x95a1('0x3b')](_0x1d5cb9[_0x95a1('0x39')],{'$or':_['map'](_0x35a681,function(_0x2eed0d){if(_0x2eed0d[_0x95a1('0x2d')]!==_0x95a1('0x3c')){var _0x10f16e={};_0x10f16e[_0x2eed0d[_0x95a1('0x29')]]={'$like':'%'+_0x623a3e['query'][_0x95a1('0x3d')]+'%'};return _0x10f16e;}})});}_0x1d5cb9=_[_0x95a1('0x3b')]({},_0x1d5cb9,_0x623a3e[_0x95a1('0x3e')]);var _0x415b8c={'where':_0x1d5cb9[_0x95a1('0x39')]};return db[_0x95a1('0x2c')][_0x95a1('0x1f')](_0x415b8c)[_0x95a1('0x26')](function(_0x1fbc12){_0x42e738[_0x95a1('0x1f')]=_0x1fbc12;if(_0x623a3e['query'][_0x95a1('0x3f')]){_0x1d5cb9[_0x95a1('0x40')]=[{'all':!![]}];}return db[_0x95a1('0x2c')]['findAll'](_0x1d5cb9);})[_0x95a1('0x26')](function(_0x3ce7de){_0x42e738[_0x95a1('0x41')]=_0x3ce7de;return _0x42e738;})[_0x95a1('0x26')](respondWithFilteredResult(_0x583384,_0x1d5cb9))[_0x95a1('0x42')](handleError(_0x583384,null));};exports['show']=function(_0x563c7d,_0x3ff1c6){var _0x40491e={'raw':![],'where':{'id':_0x563c7d[_0x95a1('0x43')]['id']}},_0x3f1610={};_0x3f1610[_0x95a1('0x2e')]=_['keys'](db[_0x95a1('0x2c')][_0x95a1('0x44')]);_0x3f1610[_0x95a1('0x2f')]=_['keys'](_0x563c7d[_0x95a1('0x2f')]);_0x3f1610['filters']=_[_0x95a1('0x32')](_0x3f1610['model'],_0x3f1610[_0x95a1('0x2f')]);_0x40491e['attributes']=_['intersection'](_0x3f1610[_0x95a1('0x2e')],qs[_0x95a1('0x34')](_0x563c7d[_0x95a1('0x2f')][_0x95a1('0x34')]));_0x40491e['attributes']=_0x40491e[_0x95a1('0x33')][_0x95a1('0x35')]?_0x40491e[_0x95a1('0x33')]:_0x3f1610['model'];if(_0x563c7d[_0x95a1('0x2f')][_0x95a1('0x3f')]){_0x40491e[_0x95a1('0x40')]=[{'all':!![]}];}_0x40491e=_[_0x95a1('0x3b')]({},_0x40491e,_0x563c7d['options']);return db[_0x95a1('0x2c')]['find'](_0x40491e)[_0x95a1('0x26')](handleEntityNotFound(_0x3ff1c6,null))[_0x95a1('0x26')](respondWithResult(_0x3ff1c6,null))[_0x95a1('0x42')](handleError(_0x3ff1c6,null));};exports[_0x95a1('0x45')]=function(_0x107c24,_0x4f1fd7){return db[_0x95a1('0x2c')][_0x95a1('0x45')](_0x107c24[_0x95a1('0x46')],{})['then'](respondWithResult(_0x4f1fd7,0xc9))[_0x95a1('0x42')](handleError(_0x4f1fd7,null));};exports[_0x95a1('0x24')]=function(_0x2f64fe,_0x433b22){if(_0x2f64fe[_0x95a1('0x46')]['id']){delete _0x2f64fe[_0x95a1('0x46')]['id'];}return db[_0x95a1('0x2c')]['find']({'where':{'id':_0x2f64fe[_0x95a1('0x43')]['id']}})['then'](handleEntityNotFound(_0x433b22,null))['then'](saveUpdates(_0x2f64fe[_0x95a1('0x46')],null))['then'](respondWithResult(_0x433b22,null))[_0x95a1('0x42')](handleError(_0x433b22,null));};exports[_0x95a1('0x25')]=function(_0x21b593,_0x4aac74){return db[_0x95a1('0x2c')][_0x95a1('0x47')]({'where':{'id':_0x21b593[_0x95a1('0x43')]['id']}})[_0x95a1('0x26')](handleEntityNotFound(_0x4aac74,null))['then'](removeEntity(_0x4aac74,null))['catch'](handleError(_0x4aac74,null));};exports[_0x95a1('0x48')]=function(_0x4bee78,_0x3c7a0c){return db['IntegrationReport']['describe']()[_0x95a1('0x26')](respondWithResult(_0x3c7a0c,null))[_0x95a1('0x42')](handleError(_0x3c7a0c,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index aa9f139..b87d2f7 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 _0x79d0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','IntegrationReport','../../config/logger'];(function(_0x258d86,_0x2ac3f3){var _0x46ff28=function(_0x3ce486){while(--_0x3ce486){_0x258d86['push'](_0x258d86['shift']());}};_0x46ff28(++_0x2ac3f3);}(_0x79d0,0x112));var _0x079d=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x79d0[_0x565c49];return _0x20ca34;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x079d('0x0'))(_0x079d('0x1'));var moment=require(_0x079d('0x2'));var BPromise=require(_0x079d('0x3'));var rp=require(_0x079d('0x4'));var fs=require('fs');var path=require(_0x079d('0x5'));var rimraf=require(_0x079d('0x6'));var config=require(_0x079d('0x7'));var attributes=require('./integrationReport.attributes');module[_0x079d('0x8')]=function(_0x42ff99,_0x35eaf2){return _0x42ff99[_0x079d('0x9')](_0x079d('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf755=['path','rimraf','../../config/environment','./integrationReport.attributes','report_integration','lodash','util','../../config/logger','api','bluebird'];(function(_0x3f1527,_0x2d5968){var _0x42adf8=function(_0x2ac802){while(--_0x2ac802){_0x3f1527['push'](_0x3f1527['shift']());}};_0x42adf8(++_0x2d5968);}(_0xf755,0x73));var _0x5f75=function(_0x47dcd2,_0x5ce4a0){_0x47dcd2=_0x47dcd2-0x0;var _0x160564=_0xf755[_0x47dcd2];return _0x160564;};'use strict';var _=require(_0x5f75('0x0'));var util=require(_0x5f75('0x1'));var logger=require(_0x5f75('0x2'))(_0x5f75('0x3'));var moment=require('moment');var BPromise=require(_0x5f75('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f75('0x5'));var rimraf=require(_0x5f75('0x6'));var config=require(_0x5f75('0x7'));var attributes=require(_0x5f75('0x8'));module['exports']=function(_0x35c56f,_0x126901){return _0x35c56f['define']('IntegrationReport',attributes,{'tableName':_0x5f75('0x9'),'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 d002884..66f4d25 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xc2c7,0x134));var _0x7c2c=function(_0x5afde8,_0x3e897a){_0x5afde8=_0x5afde8-0x0;var _0xc424d3=_0xc2c7[_0x5afde8];return _0xc424d3;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 346cf2d..4084a11 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 _0x2eb2=['fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','put','update','delete','exports','util','path','connect-timeout','express','Router'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x2eb2,0x19f));var _0x22eb=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x2eb2[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./interval.controller');router[_0x22eb('0x7')]('/',auth[_0x22eb('0x8')](),controller[_0x22eb('0x9')]);router[_0x22eb('0x7')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xb')]);router[_0x22eb('0x7')](_0x22eb('0xc'),auth[_0x22eb('0x8')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')]('/',auth['isAuthenticated'](),controller[_0x22eb('0xf')]);router['post']('/:id/sub_intervals',auth[_0x22eb('0x8')](),controller['addInterval']);router[_0x22eb('0xe')](_0x22eb('0x10'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x22eb('0x11')](_0x22eb('0xa'),auth[_0x22eb('0x8')](),controller[_0x22eb('0x12')]);router[_0x22eb('0x13')]('/:id',auth[_0x22eb('0x8')](),controller['destroy']);module[_0x22eb('0x14')]=router; \ No newline at end of file +var _0x2ac4=['show','/:id/sub_intervals','post','/:id/sub_intervals/create_many','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','isAuthenticated','get'];(function(_0x22417f,_0x50d5ea){var _0x346e5c=function(_0x289118){while(--_0x289118){_0x22417f['push'](_0x22417f['shift']());}};_0x346e5c(++_0x50d5ea);}(_0x2ac4,0x68));var _0x42ac=function(_0x4b418f,_0x3b6a96){_0x4b418f=_0x4b418f-0x0;var _0x2ed208=_0x2ac4[_0x4b418f];return _0x2ed208;};'use strict';var multer=require('multer');var util=require(_0x42ac('0x0'));var path=require('path');var timeout=require(_0x42ac('0x1'));var express=require(_0x42ac('0x2'));var router=express[_0x42ac('0x3')]();var fs_extra=require(_0x42ac('0x4'));var auth=require(_0x42ac('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42ac('0x6'));var controller=require(_0x42ac('0x7'));router['get']('/',auth[_0x42ac('0x8')](),controller['index']);router[_0x42ac('0x9')]('/:id',auth[_0x42ac('0x8')](),controller[_0x42ac('0xa')]);router[_0x42ac('0x9')](_0x42ac('0xb'),auth[_0x42ac('0x8')](),controller['getIntervals']);router[_0x42ac('0xc')]('/',auth[_0x42ac('0x8')](),controller['create']);router[_0x42ac('0xc')](_0x42ac('0xb'),auth[_0x42ac('0x8')](),controller['addInterval']);router[_0x42ac('0xc')](_0x42ac('0xd'),auth['isAuthenticated'](),controller['addIntervals']);router[_0x42ac('0xe')](_0x42ac('0xf'),auth[_0x42ac('0x8')](),controller['update']);router[_0x42ac('0x10')](_0x42ac('0xf'),auth[_0x42ac('0x8')](),controller[_0x42ac('0x11')]);module[_0x42ac('0x12')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 882f3bd..a8b1012 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 _0xa15b=['sequelize','exports','STRING'];(function(_0x39d7c6,_0x3df0de){var _0x5f67f6=function(_0x59d4d2){while(--_0x59d4d2){_0x39d7c6['push'](_0x39d7c6['shift']());}};_0x5f67f6(++_0x3df0de);}(_0xa15b,0x18f));var _0xba15=function(_0x33902c,_0x3594b4){_0x33902c=_0x33902c-0x0;var _0x30d394=_0xa15b[_0x33902c];return _0x30d394;};'use strict';var Sequelize=require(_0xba15('0x0'));module[_0xba15('0x1')]={'name':{'type':Sequelize[_0xba15('0x2')]},'description':{'type':Sequelize[_0xba15('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x07c6=['STRING','sequelize','exports'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x07c6,0xeb));var _0x607c=function(_0x5834bc,_0x3d4801){_0x5834bc=_0x5834bc-0x0;var _0x3e183a=_0x07c6[_0x5834bc];return _0x3e183a;};'use strict';var Sequelize=require(_0x607c('0x0'));module[_0x607c('0x1')]={'name':{'type':Sequelize[_0x607c('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x607c('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 8de9d80..529808b 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 _0x65cf=['sequelize','transaction','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','error','name','index','map','Interval','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','autoAssociation','destroy','addInterval','getIntervals','order','sort','filter'];(function(_0x28a133,_0x336e70){var _0x27c2d7=function(_0xf41eca){while(--_0xf41eca){_0x28a133['push'](_0x28a133['shift']());}};_0x27c2d7(++_0x336e70);}(_0x65cf,0xac));var _0xf65c=function(_0x49d8b5,_0x506881){_0x49d8b5=_0x49d8b5-0x0;var _0x42eae1=_0x65cf[_0x49d8b5];return _0x42eae1;};'use strict';var emlformat=require(_0xf65c('0x0'));var rimraf=require(_0xf65c('0x1'));var zipdir=require(_0xf65c('0x2'));var jsonpatch=require(_0xf65c('0x3'));var rp=require(_0xf65c('0x4'));var moment=require(_0xf65c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf65c('0x6'));var util=require('util');var path=require(_0xf65c('0x7'));var sox=require(_0xf65c('0x8'));var csv=require('to-csv');var ejs=require(_0xf65c('0x9'));var fs=require('fs');var fs_extra=require(_0xf65c('0xa'));var _=require(_0xf65c('0xb'));var squel=require(_0xf65c('0xc'));var crypto=require('crypto');var jsforce=require(_0xf65c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf65c('0xe'));var Papa=require(_0xf65c('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf65c('0x10'));var hardwareService=require(_0xf65c('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xf65c('0x12'));var config=require(_0xf65c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf65c('0x14'))['db'];var extensions=require(_0xf65c('0x15'));function respondWithStatusCode(_0xb1a277,_0x240683){_0x240683=_0x240683||0xcc;return function(_0x162481){if(_0x162481){return _0xb1a277[_0xf65c('0x16')](_0x240683);}return _0xb1a277[_0xf65c('0x17')](_0x240683)[_0xf65c('0x18')]();};}function respondWithResult(_0x55ccd4,_0x450f01){_0x450f01=_0x450f01||0xc8;return function(_0x172d3e){if(_0x172d3e){return _0x55ccd4[_0xf65c('0x17')](_0x450f01)['json'](_0x172d3e);}};}function respondWithFilteredResult(_0xdd5e64,_0x256aa4){return function(_0x34a68d){if(_0x34a68d){var _0x4d3742=typeof _0x256aa4['offset']==='undefined'&&typeof _0x256aa4[_0xf65c('0x19')]===_0xf65c('0x1a');var _0x2ad25a=_0x34a68d[_0xf65c('0x1b')];var _0xc8845f=_0x4d3742?0x0:_0x256aa4[_0xf65c('0x1c')];var _0x13ae31=_0x4d3742?_0x34a68d[_0xf65c('0x1b')]:_0x256aa4['offset']+_0x256aa4[_0xf65c('0x19')];var _0x33f4f4;if(_0x13ae31>=_0x2ad25a){_0x13ae31=_0x2ad25a;_0x33f4f4=0xc8;}else{_0x33f4f4=0xce;}_0xdd5e64[_0xf65c('0x17')](_0x33f4f4);return _0xdd5e64['set'](_0xf65c('0x1d'),_0xc8845f+'-'+_0x13ae31+'/'+_0x2ad25a)['json'](_0x34a68d);}return null;};}function patchUpdates(_0x3bb8e5){return function(_0x48ba3f){try{jsonpatch[_0xf65c('0x1e')](_0x48ba3f,_0x3bb8e5,!![]);}catch(_0x1d1a92){return BPromise[_0xf65c('0x1f')](_0x1d1a92);}return _0x48ba3f[_0xf65c('0x20')]();};}function saveUpdates(_0x132487,_0x2f4844){return function(_0x56242e){if(_0x56242e){return _0x56242e[_0xf65c('0x21')](_0x132487)[_0xf65c('0x22')](function(_0x4da554){return _0x4da554;});}return null;};}function removeEntity(_0x40109c,_0x4d87b0){return function(_0x88a62c){if(_0x88a62c){return _0x88a62c['destroy']()[_0xf65c('0x22')](function(){var _0x4b0d41=_0x88a62c[_0xf65c('0x23')]({'plain':!![]});var _0x33f891=_0xf65c('0x24');return db[_0xf65c('0x25')]['destroy']({'where':{'type':_0x33f891,'resourceId':_0x4b0d41['id']}})['then'](function(){return _0x88a62c;});})[_0xf65c('0x22')](function(){_0x40109c[_0xf65c('0x17')](0xcc)[_0xf65c('0x18')]();});}};}function handleEntityNotFound(_0x3e1e12,_0x44fb14){return function(_0x2f5946){if(!_0x2f5946){_0x3e1e12[_0xf65c('0x16')](0x194);}return _0x2f5946;};}function handleError(_0x1f6678,_0x141f2a){_0x141f2a=_0x141f2a||0x1f4;return function(_0x2d8e55){logger[_0xf65c('0x26')](_0x2d8e55['stack']);if(_0x2d8e55[_0xf65c('0x27')]){delete _0x2d8e55[_0xf65c('0x27')];}_0x1f6678[_0xf65c('0x17')](_0x141f2a)['send'](_0x2d8e55);};}exports[_0xf65c('0x28')]=function(_0x38b92a,_0x4c4e80){var _0x1f54b5={},_0xa54610={},_0x5acf5b={'count':0x0,'rows':[]};var _0x1f16c6=_[_0xf65c('0x29')](db[_0xf65c('0x2a')][_0xf65c('0x2b')],function(_0xb43804){return{'name':_0xb43804[_0xf65c('0x2c')],'type':_0xb43804[_0xf65c('0x2d')]['key']};});_0xa54610[_0xf65c('0x2e')]=_[_0xf65c('0x29')](_0x1f16c6,_0xf65c('0x27'));_0xa54610[_0xf65c('0x2f')]=_['keys'](_0x38b92a['query']);_0xa54610['filters']=_[_0xf65c('0x30')](_0xa54610[_0xf65c('0x2e')],_0xa54610[_0xf65c('0x2f')]);_0x1f54b5[_0xf65c('0x31')]=_[_0xf65c('0x30')](_0xa54610['model'],qs[_0xf65c('0x32')](_0x38b92a['query']['fields']));_0x1f54b5['attributes']=_0x1f54b5['attributes'][_0xf65c('0x33')]?_0x1f54b5[_0xf65c('0x31')]:_0xa54610[_0xf65c('0x2e')];if(!_0x38b92a[_0xf65c('0x2f')][_0xf65c('0x34')](_0xf65c('0x35'))){_0x1f54b5[_0xf65c('0x19')]=qs[_0xf65c('0x19')](_0x38b92a['query']['limit']);_0x1f54b5[_0xf65c('0x1c')]=qs[_0xf65c('0x1c')](_0x38b92a['query']['offset']);}_0x1f54b5['order']=qs['sort'](_0x38b92a[_0xf65c('0x2f')]['sort']);_0x1f54b5[_0xf65c('0x36')]=qs[_0xf65c('0x37')](_[_0xf65c('0x38')](_0x38b92a[_0xf65c('0x2f')],_0xa54610[_0xf65c('0x37')]),_0x1f16c6);if(_0x38b92a['query']['filter']){_0x1f54b5[_0xf65c('0x36')]=_['merge'](_0x1f54b5[_0xf65c('0x36')],{'$or':_['map'](_0x1f16c6,function(_0x5203b8){if(_0x5203b8[_0xf65c('0x2d')]!==_0xf65c('0x39')){var _0x20138c={};_0x20138c[_0x5203b8[_0xf65c('0x27')]]={'$like':'%'+_0x38b92a[_0xf65c('0x2f')]['filter']+'%'};return _0x20138c;}})});}_0x1f54b5=_[_0xf65c('0x3a')]({},_0x1f54b5,_0x38b92a[_0xf65c('0x3b')]);var _0x3872cf={'where':_0x1f54b5[_0xf65c('0x36')]};return db[_0xf65c('0x2a')]['count'](_0x3872cf)[_0xf65c('0x22')](function(_0x32a6cf){_0x5acf5b[_0xf65c('0x1b')]=_0x32a6cf;if(_0x38b92a[_0xf65c('0x2f')][_0xf65c('0x3c')]){_0x1f54b5[_0xf65c('0x3d')]=[{'all':!![]}];}return db[_0xf65c('0x2a')][_0xf65c('0x3e')](_0x1f54b5);})['then'](function(_0xe12bb7){_0x5acf5b[_0xf65c('0x3f')]=_0xe12bb7;return _0x5acf5b;})[_0xf65c('0x22')](respondWithFilteredResult(_0x4c4e80,_0x1f54b5))['catch'](handleError(_0x4c4e80,null));};exports['show']=function(_0x5e37ea,_0xc2015c){var _0x34b879={'raw':!![],'where':{'id':_0x5e37ea[_0xf65c('0x40')]['id']}},_0x4969b7={};_0x4969b7[_0xf65c('0x2e')]=_['keys'](db[_0xf65c('0x2a')]['rawAttributes']);_0x4969b7[_0xf65c('0x2f')]=_[_0xf65c('0x41')](_0x5e37ea[_0xf65c('0x2f')]);_0x4969b7[_0xf65c('0x37')]=_[_0xf65c('0x30')](_0x4969b7['model'],_0x4969b7[_0xf65c('0x2f')]);_0x34b879[_0xf65c('0x31')]=_['intersection'](_0x4969b7[_0xf65c('0x2e')],qs['fields'](_0x5e37ea[_0xf65c('0x2f')][_0xf65c('0x32')]));_0x34b879[_0xf65c('0x31')]=_0x34b879[_0xf65c('0x31')][_0xf65c('0x33')]?_0x34b879['attributes']:_0x4969b7['model'];if(_0x5e37ea['query'][_0xf65c('0x3c')]){_0x34b879[_0xf65c('0x3d')]=[{'all':!![]}];}_0x34b879=_[_0xf65c('0x3a')]({},_0x34b879,_0x5e37ea[_0xf65c('0x3b')]);return db[_0xf65c('0x2a')]['find'](_0x34b879)['then'](handleEntityNotFound(_0xc2015c,null))[_0xf65c('0x22')](respondWithResult(_0xc2015c,null))[_0xf65c('0x42')](handleError(_0xc2015c,null));};exports[_0xf65c('0x43')]=function(_0x5b63e5,_0x3d7915){return db[_0xf65c('0x2a')][_0xf65c('0x43')](_0x5b63e5[_0xf65c('0x44')],{})[_0xf65c('0x22')](function(_0x29b4bf){var _0x485eba=_0x5b63e5['user'][_0xf65c('0x23')]({'plain':!![]});if(!_0x485eba)throw new Error(_0xf65c('0x45'));if(_0x485eba['role']===_0xf65c('0x46')){var _0x1b67c3=_0x29b4bf[_0xf65c('0x23')]({'plain':!![]});var _0x5288b8=_0xf65c('0x24');return db[_0xf65c('0x47')][_0xf65c('0x48')]({'where':{'name':_0x5288b8,'userProfileId':_0x485eba['userProfileId']},'raw':!![]})[_0xf65c('0x22')](function(_0x56d063){if(_0x56d063&&_0x56d063[_0xf65c('0x49')]===0x0){return db[_0xf65c('0x25')]['create']({'name':_0x1b67c3[_0xf65c('0x27')],'resourceId':_0x1b67c3['id'],'type':_0x56d063[_0xf65c('0x27')],'sectionId':_0x56d063['id']},{})[_0xf65c('0x22')](function(){return _0x29b4bf;});}else{return _0x29b4bf;}})[_0xf65c('0x42')](function(_0x416b3a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x416b3a);throw _0x416b3a;});}return _0x29b4bf;})[_0xf65c('0x22')](respondWithResult(_0x3d7915,0xc9))['catch'](handleError(_0x3d7915,null));};exports[_0xf65c('0x21')]=function(_0x2250bb,_0x74420e){if(_0x2250bb[_0xf65c('0x44')]['id']){delete _0x2250bb['body']['id'];}return db[_0xf65c('0x2a')][_0xf65c('0x48')]({'where':{'id':_0x2250bb[_0xf65c('0x40')]['id']}})[_0xf65c('0x22')](handleEntityNotFound(_0x74420e,null))['then'](saveUpdates(_0x2250bb['body'],null))[_0xf65c('0x22')](respondWithResult(_0x74420e,null))[_0xf65c('0x42')](handleError(_0x74420e,null));};exports[_0xf65c('0x4a')]=function(_0x533c8b,_0x1de553){return db[_0xf65c('0x2a')][_0xf65c('0x48')]({'where':{'id':_0x533c8b[_0xf65c('0x40')]['id']}})[_0xf65c('0x22')](handleEntityNotFound(_0x1de553,null))[_0xf65c('0x22')](removeEntity(_0x1de553,null))[_0xf65c('0x42')](handleError(_0x1de553,null));};exports[_0xf65c('0x4b')]=function(_0x4322e2,_0x1367b1,_0x4063b6){if(_0x4322e2[_0xf65c('0x44')]['id']){delete _0x4322e2[_0xf65c('0x44')]['id'];}return db['Interval']['find']({'where':{'id':_0x4322e2[_0xf65c('0x40')]['id']}})[_0xf65c('0x22')](handleEntityNotFound(_0x1367b1,null))['then'](function(_0xb3d676){if(_0xb3d676){_0x4322e2[_0xf65c('0x44')]['IntervalId']=_0xb3d676['id'];return db['Interval'][_0xf65c('0x43')](_0x4322e2[_0xf65c('0x44')]);}})[_0xf65c('0x22')](respondWithResult(_0x1367b1,null))[_0xf65c('0x42')](handleError(_0x1367b1,null));};exports[_0xf65c('0x4c')]=function(_0x593e2f,_0x1ebf65,_0x35a545){var _0x241c6c={};var _0xd0a050={};var _0x200088;var _0x179a12;return db[_0xf65c('0x2a')]['findOne']({'where':{'id':_0x593e2f[_0xf65c('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ebf65,null))['then'](function(_0x40b3c1){if(_0x40b3c1){_0x200088=_0x40b3c1;_0xd0a050[_0xf65c('0x2e')]=_[_0xf65c('0x41')](db[_0xf65c('0x2a')][_0xf65c('0x2b')]);_0xd0a050[_0xf65c('0x2f')]=_[_0xf65c('0x41')](_0x593e2f[_0xf65c('0x2f')]);_0xd0a050[_0xf65c('0x37')]=_[_0xf65c('0x30')](_0xd0a050['model'],_0xd0a050[_0xf65c('0x2f')]);_0x241c6c['attributes']=_[_0xf65c('0x30')](_0xd0a050[_0xf65c('0x2e')],qs[_0xf65c('0x32')](_0x593e2f[_0xf65c('0x2f')]['fields']));_0x241c6c[_0xf65c('0x31')]=_0x241c6c[_0xf65c('0x31')]['length']?_0x241c6c['attributes']:_0xd0a050[_0xf65c('0x2e')];_0x241c6c[_0xf65c('0x4d')]=qs[_0xf65c('0x4e')](_0x593e2f[_0xf65c('0x2f')]['sort']);_0x241c6c[_0xf65c('0x36')]=qs['filters'](_[_0xf65c('0x38')](_0x593e2f['query'],_0xd0a050[_0xf65c('0x37')]));if(_0x593e2f[_0xf65c('0x2f')][_0xf65c('0x4f')]){_0x241c6c['where']=_[_0xf65c('0x3a')](_0x241c6c['where'],{'$or':_[_0xf65c('0x29')](_0x241c6c[_0xf65c('0x31')],function(_0x2aae38){var _0x953bba={};_0x953bba[_0x2aae38]={'$like':'%'+_0x593e2f[_0xf65c('0x2f')][_0xf65c('0x4f')]+'%'};return _0x953bba;})});}_0x241c6c=_[_0xf65c('0x3a')]({},_0x241c6c,_0x593e2f['options']);return _0x200088[_0xf65c('0x4c')](_0x241c6c);}})[_0xf65c('0x22')](function(_0x431df6){if(_0x431df6){_0x179a12=_0x431df6[_0xf65c('0x33')];if(!_0x593e2f[_0xf65c('0x2f')]['hasOwnProperty'](_0xf65c('0x35'))){_0x241c6c[_0xf65c('0x19')]=qs[_0xf65c('0x19')](_0x593e2f[_0xf65c('0x2f')][_0xf65c('0x19')]);_0x241c6c[_0xf65c('0x1c')]=qs[_0xf65c('0x1c')](_0x593e2f[_0xf65c('0x2f')]['offset']);}return _0x200088['getIntervals'](_0x241c6c);}})[_0xf65c('0x22')](function(_0x18877c){if(_0x18877c){return _0x18877c?{'count':_0x179a12,'rows':_0x18877c}:null;}})[_0xf65c('0x22')](respondWithResult(_0x1ebf65,null))['catch'](handleError(_0x1ebf65,null));};exports['addIntervals']=function(_0x592566,_0xa46d00,_0xbd2c76){return db[_0xf65c('0x2a')]['findOne']({'where':{'id':_0x592566['params']['id']}})['then'](handleEntityNotFound(_0xa46d00,null))[_0xf65c('0x22')](function(_0x4b903c){if(_0x4b903c){return db[_0xf65c('0x50')][_0xf65c('0x51')](function(_0x1b7791){return db[_0xf65c('0x2a')][_0xf65c('0x4a')]({'where':{'IntervalId':_0x592566[_0xf65c('0x40')]['id']},'transaction':_0x1b7791})[_0xf65c('0x22')](function(_0x342450){var _0x14dad6=_[_0xf65c('0x29')](_0x592566[_0xf65c('0x44')],function(_0x16230b){delete _0x16230b['id'];_0x16230b[_0xf65c('0x52')]=_0x592566[_0xf65c('0x40')]['id'];return _0x16230b;});return db[_0xf65c('0x2a')][_0xf65c('0x53')](_0x14dad6,{'transaction':_0x1b7791});});})[_0xf65c('0x22')](function(){return db[_0xf65c('0x2a')][_0xf65c('0x3e')]({'where':{'IntervalId':_0x592566[_0xf65c('0x40')]['id']}});});}})[_0xf65c('0x22')](respondWithResult(_0xa46d00,null))[_0xf65c('0x42')](handleError(_0xa46d00,null));}; \ No newline at end of file +var _0x45aa=['catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','get','Intervals','UserProfileResource','error','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x360ec,_0x585d47){var _0xf03953=function(_0xf081db){while(--_0xf081db){_0x360ec['push'](_0x360ec['shift']());}};_0xf03953(++_0x585d47);}(_0x45aa,0x75));var _0xa45a=function(_0x1dc7fa,_0x3ebbef){_0x1dc7fa=_0x1dc7fa-0x0;var _0x34cc4c=_0x45aa[_0x1dc7fa];return _0x34cc4c;};'use strict';var emlformat=require(_0xa45a('0x0'));var rimraf=require(_0xa45a('0x1'));var zipdir=require(_0xa45a('0x2'));var jsonpatch=require(_0xa45a('0x3'));var rp=require(_0xa45a('0x4'));var moment=require('moment');var BPromise=require(_0xa45a('0x5'));var Mustache=require(_0xa45a('0x6'));var util=require(_0xa45a('0x7'));var path=require(_0xa45a('0x8'));var sox=require(_0xa45a('0x9'));var csv=require(_0xa45a('0xa'));var ejs=require(_0xa45a('0xb'));var fs=require('fs');var fs_extra=require(_0xa45a('0xc'));var _=require(_0xa45a('0xd'));var squel=require(_0xa45a('0xe'));var crypto=require('crypto');var jsforce=require(_0xa45a('0xf'));var deskjs=require(_0xa45a('0x10'));var toCsv=require(_0xa45a('0xa'));var querystring=require('querystring');var Papa=require(_0xa45a('0x11'));var Redis=require(_0xa45a('0x12'));var authService=require(_0xa45a('0x13'));var qs=require(_0xa45a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa45a('0x15'));var logger=require('../../config/logger')(_0xa45a('0x16'));var utils=require(_0xa45a('0x17'));var config=require(_0xa45a('0x18'));var licenseUtil=require(_0xa45a('0x19'));var db=require(_0xa45a('0x1a'))['db'];var extensions=require(_0xa45a('0x1b'));function respondWithStatusCode(_0x2c4a4e,_0xe18215){_0xe18215=_0xe18215||0xcc;return function(_0x203c86){if(_0x203c86){return _0x2c4a4e[_0xa45a('0x1c')](_0xe18215);}return _0x2c4a4e[_0xa45a('0x1d')](_0xe18215)[_0xa45a('0x1e')]();};}function respondWithResult(_0xef074a,_0x1e5284){_0x1e5284=_0x1e5284||0xc8;return function(_0x55662a){if(_0x55662a){return _0xef074a[_0xa45a('0x1d')](_0x1e5284)[_0xa45a('0x1f')](_0x55662a);}};}function respondWithFilteredResult(_0x122cdd,_0x1149b6){return function(_0x58bc1f){if(_0x58bc1f){var _0xc9722c=typeof _0x1149b6[_0xa45a('0x20')]===_0xa45a('0x21')&&typeof _0x1149b6[_0xa45a('0x22')]===_0xa45a('0x21');var _0x13c58f=_0x58bc1f[_0xa45a('0x23')];var _0x5def63=_0xc9722c?0x0:_0x1149b6[_0xa45a('0x20')];var _0xd6b679=_0xc9722c?_0x58bc1f[_0xa45a('0x23')]:_0x1149b6[_0xa45a('0x20')]+_0x1149b6[_0xa45a('0x22')];var _0x50f357;if(_0xd6b679>=_0x13c58f){_0xd6b679=_0x13c58f;_0x50f357=0xc8;}else{_0x50f357=0xce;}_0x122cdd['status'](_0x50f357);return _0x122cdd[_0xa45a('0x24')]('Content-Range',_0x5def63+'-'+_0xd6b679+'/'+_0x13c58f)[_0xa45a('0x1f')](_0x58bc1f);}return null;};}function patchUpdates(_0x4d214e){return function(_0x312f86){try{jsonpatch['apply'](_0x312f86,_0x4d214e,!![]);}catch(_0x558a0c){return BPromise[_0xa45a('0x25')](_0x558a0c);}return _0x312f86[_0xa45a('0x26')]();};}function saveUpdates(_0x4473c8,_0x60d17b){return function(_0x183f7d){if(_0x183f7d){return _0x183f7d['update'](_0x4473c8)[_0xa45a('0x27')](function(_0x4b42ec){return _0x4b42ec;});}return null;};}function removeEntity(_0x551a11,_0x530c0f){return function(_0x487a51){if(_0x487a51){return _0x487a51[_0xa45a('0x28')]()[_0xa45a('0x27')](function(){var _0x2abdac=_0x487a51[_0xa45a('0x29')]({'plain':!![]});var _0x596936=_0xa45a('0x2a');return db[_0xa45a('0x2b')][_0xa45a('0x28')]({'where':{'type':_0x596936,'resourceId':_0x2abdac['id']}})[_0xa45a('0x27')](function(){return _0x487a51;});})[_0xa45a('0x27')](function(){_0x551a11[_0xa45a('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0c16,_0x3ee41a){return function(_0x5b82dd){if(!_0x5b82dd){_0x5b0c16[_0xa45a('0x1c')](0x194);}return _0x5b82dd;};}function handleError(_0x3b2472,_0x30c2ab){_0x30c2ab=_0x30c2ab||0x1f4;return function(_0x153379){logger[_0xa45a('0x2c')](_0x153379['stack']);if(_0x153379[_0xa45a('0x2d')]){delete _0x153379[_0xa45a('0x2d')];}_0x3b2472[_0xa45a('0x1d')](_0x30c2ab)[_0xa45a('0x2e')](_0x153379);};}exports['index']=function(_0x5a5d1e,_0x13be05){var _0xc4a33f={},_0x3eebea={},_0xc41397={'count':0x0,'rows':[]};var _0x217356=_[_0xa45a('0x2f')](db[_0xa45a('0x30')][_0xa45a('0x31')],function(_0x5df432){return{'name':_0x5df432[_0xa45a('0x32')],'type':_0x5df432[_0xa45a('0x33')][_0xa45a('0x34')]};});_0x3eebea[_0xa45a('0x35')]=_['map'](_0x217356,_0xa45a('0x2d'));_0x3eebea[_0xa45a('0x36')]=_[_0xa45a('0x37')](_0x5a5d1e[_0xa45a('0x36')]);_0x3eebea[_0xa45a('0x38')]=_[_0xa45a('0x39')](_0x3eebea['model'],_0x3eebea[_0xa45a('0x36')]);_0xc4a33f[_0xa45a('0x3a')]=_[_0xa45a('0x39')](_0x3eebea[_0xa45a('0x35')],qs[_0xa45a('0x3b')](_0x5a5d1e['query'][_0xa45a('0x3b')]));_0xc4a33f[_0xa45a('0x3a')]=_0xc4a33f['attributes'][_0xa45a('0x3c')]?_0xc4a33f[_0xa45a('0x3a')]:_0x3eebea[_0xa45a('0x35')];if(!_0x5a5d1e[_0xa45a('0x36')][_0xa45a('0x3d')](_0xa45a('0x3e'))){_0xc4a33f['limit']=qs[_0xa45a('0x22')](_0x5a5d1e[_0xa45a('0x36')][_0xa45a('0x22')]);_0xc4a33f[_0xa45a('0x20')]=qs[_0xa45a('0x20')](_0x5a5d1e['query']['offset']);}_0xc4a33f[_0xa45a('0x3f')]=qs['sort'](_0x5a5d1e[_0xa45a('0x36')][_0xa45a('0x40')]);_0xc4a33f['where']=qs[_0xa45a('0x38')](_['pick'](_0x5a5d1e[_0xa45a('0x36')],_0x3eebea[_0xa45a('0x38')]),_0x217356);if(_0x5a5d1e[_0xa45a('0x36')][_0xa45a('0x41')]){_0xc4a33f[_0xa45a('0x42')]=_[_0xa45a('0x43')](_0xc4a33f['where'],{'$or':_[_0xa45a('0x2f')](_0x217356,function(_0x204611){if(_0x204611[_0xa45a('0x33')]!==_0xa45a('0x44')){var _0x2669f6={};_0x2669f6[_0x204611[_0xa45a('0x2d')]]={'$like':'%'+_0x5a5d1e[_0xa45a('0x36')][_0xa45a('0x41')]+'%'};return _0x2669f6;}})});}_0xc4a33f=_[_0xa45a('0x43')]({},_0xc4a33f,_0x5a5d1e[_0xa45a('0x45')]);var _0x1c16db={'where':_0xc4a33f[_0xa45a('0x42')]};return db[_0xa45a('0x30')][_0xa45a('0x23')](_0x1c16db)[_0xa45a('0x27')](function(_0x10a287){_0xc41397[_0xa45a('0x23')]=_0x10a287;if(_0x5a5d1e[_0xa45a('0x36')][_0xa45a('0x46')]){_0xc4a33f[_0xa45a('0x47')]=[{'all':!![]}];}return db[_0xa45a('0x30')]['findAll'](_0xc4a33f);})[_0xa45a('0x27')](function(_0x2da11a){_0xc41397[_0xa45a('0x48')]=_0x2da11a;return _0xc41397;})['then'](respondWithFilteredResult(_0x13be05,_0xc4a33f))[_0xa45a('0x49')](handleError(_0x13be05,null));};exports[_0xa45a('0x4a')]=function(_0x5f2729,_0x64630b){var _0x5db3fb={'raw':!![],'where':{'id':_0x5f2729[_0xa45a('0x4b')]['id']}},_0x1e582a={};_0x1e582a[_0xa45a('0x35')]=_[_0xa45a('0x37')](db[_0xa45a('0x30')][_0xa45a('0x31')]);_0x1e582a['query']=_[_0xa45a('0x37')](_0x5f2729[_0xa45a('0x36')]);_0x1e582a[_0xa45a('0x38')]=_['intersection'](_0x1e582a['model'],_0x1e582a[_0xa45a('0x36')]);_0x5db3fb[_0xa45a('0x3a')]=_[_0xa45a('0x39')](_0x1e582a['model'],qs['fields'](_0x5f2729[_0xa45a('0x36')][_0xa45a('0x3b')]));_0x5db3fb['attributes']=_0x5db3fb[_0xa45a('0x3a')]['length']?_0x5db3fb['attributes']:_0x1e582a[_0xa45a('0x35')];if(_0x5f2729['query'][_0xa45a('0x46')]){_0x5db3fb[_0xa45a('0x47')]=[{'all':!![]}];}_0x5db3fb=_['merge']({},_0x5db3fb,_0x5f2729['options']);return db[_0xa45a('0x30')][_0xa45a('0x4c')](_0x5db3fb)['then'](handleEntityNotFound(_0x64630b,null))[_0xa45a('0x27')](respondWithResult(_0x64630b,null))[_0xa45a('0x49')](handleError(_0x64630b,null));};exports[_0xa45a('0x4d')]=function(_0x42948b,_0x1eeb2b){return db[_0xa45a('0x30')][_0xa45a('0x4d')](_0x42948b[_0xa45a('0x4e')],{})[_0xa45a('0x27')](function(_0x56cc4d){var _0x2432eb=_0x42948b['user'][_0xa45a('0x29')]({'plain':!![]});if(!_0x2432eb)throw new Error(_0xa45a('0x4f'));if(_0x2432eb[_0xa45a('0x50')]===_0xa45a('0x51')){var _0x4a852d=_0x56cc4d[_0xa45a('0x29')]({'plain':!![]});var _0x35f6c7='Intervals';return db[_0xa45a('0x52')][_0xa45a('0x4c')]({'where':{'name':_0x35f6c7,'userProfileId':_0x2432eb[_0xa45a('0x53')]},'raw':!![]})['then'](function(_0x5c3c68){if(_0x5c3c68&&_0x5c3c68[_0xa45a('0x54')]===0x0){return db[_0xa45a('0x2b')][_0xa45a('0x4d')]({'name':_0x4a852d[_0xa45a('0x2d')],'resourceId':_0x4a852d['id'],'type':_0x5c3c68[_0xa45a('0x2d')],'sectionId':_0x5c3c68['id']},{})['then'](function(){return _0x56cc4d;});}else{return _0x56cc4d;}})[_0xa45a('0x49')](function(_0x1de0e1){logger['error'](_0xa45a('0x55'),_0x1de0e1);throw _0x1de0e1;});}return _0x56cc4d;})['then'](respondWithResult(_0x1eeb2b,0xc9))[_0xa45a('0x49')](handleError(_0x1eeb2b,null));};exports['update']=function(_0x2f5bb2,_0xa9e3c8){if(_0x2f5bb2['body']['id']){delete _0x2f5bb2['body']['id'];}return db['Interval'][_0xa45a('0x4c')]({'where':{'id':_0x2f5bb2[_0xa45a('0x4b')]['id']}})[_0xa45a('0x27')](handleEntityNotFound(_0xa9e3c8,null))[_0xa45a('0x27')](saveUpdates(_0x2f5bb2[_0xa45a('0x4e')],null))[_0xa45a('0x27')](respondWithResult(_0xa9e3c8,null))['catch'](handleError(_0xa9e3c8,null));};exports[_0xa45a('0x28')]=function(_0x3f2040,_0x5a7432){return db[_0xa45a('0x30')][_0xa45a('0x4c')]({'where':{'id':_0x3f2040[_0xa45a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5a7432,null))[_0xa45a('0x27')](removeEntity(_0x5a7432,null))['catch'](handleError(_0x5a7432,null));};exports[_0xa45a('0x56')]=function(_0x231df6,_0x36fae5,_0x3f1ea0){if(_0x231df6['body']['id']){delete _0x231df6[_0xa45a('0x4e')]['id'];}return db[_0xa45a('0x30')][_0xa45a('0x4c')]({'where':{'id':_0x231df6[_0xa45a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x36fae5,null))[_0xa45a('0x27')](function(_0x4341a6){if(_0x4341a6){_0x231df6[_0xa45a('0x4e')][_0xa45a('0x57')]=_0x4341a6['id'];return db['Interval']['create'](_0x231df6[_0xa45a('0x4e')]);}})[_0xa45a('0x27')](respondWithResult(_0x36fae5,null))[_0xa45a('0x49')](handleError(_0x36fae5,null));};exports[_0xa45a('0x58')]=function(_0x1d6036,_0x31c54d,_0x2b218d){var _0x3833a1={};var _0x4245bf={};var _0x3c5410;var _0x8d9eff;return db[_0xa45a('0x30')]['findOne']({'where':{'id':_0x1d6036[_0xa45a('0x4b')]['id']}})[_0xa45a('0x27')](handleEntityNotFound(_0x31c54d,null))['then'](function(_0x2f0529){if(_0x2f0529){_0x3c5410=_0x2f0529;_0x4245bf['model']=_[_0xa45a('0x37')](db[_0xa45a('0x30')][_0xa45a('0x31')]);_0x4245bf[_0xa45a('0x36')]=_[_0xa45a('0x37')](_0x1d6036['query']);_0x4245bf[_0xa45a('0x38')]=_[_0xa45a('0x39')](_0x4245bf['model'],_0x4245bf[_0xa45a('0x36')]);_0x3833a1[_0xa45a('0x3a')]=_[_0xa45a('0x39')](_0x4245bf[_0xa45a('0x35')],qs[_0xa45a('0x3b')](_0x1d6036[_0xa45a('0x36')][_0xa45a('0x3b')]));_0x3833a1[_0xa45a('0x3a')]=_0x3833a1[_0xa45a('0x3a')][_0xa45a('0x3c')]?_0x3833a1['attributes']:_0x4245bf[_0xa45a('0x35')];_0x3833a1['order']=qs[_0xa45a('0x40')](_0x1d6036[_0xa45a('0x36')][_0xa45a('0x40')]);_0x3833a1[_0xa45a('0x42')]=qs[_0xa45a('0x38')](_['pick'](_0x1d6036[_0xa45a('0x36')],_0x4245bf[_0xa45a('0x38')]));if(_0x1d6036['query'][_0xa45a('0x41')]){_0x3833a1[_0xa45a('0x42')]=_[_0xa45a('0x43')](_0x3833a1['where'],{'$or':_[_0xa45a('0x2f')](_0x3833a1['attributes'],function(_0x58c5b6){var _0x11e160={};_0x11e160[_0x58c5b6]={'$like':'%'+_0x1d6036[_0xa45a('0x36')][_0xa45a('0x41')]+'%'};return _0x11e160;})});}_0x3833a1=_[_0xa45a('0x43')]({},_0x3833a1,_0x1d6036[_0xa45a('0x45')]);return _0x3c5410['getIntervals'](_0x3833a1);}})[_0xa45a('0x27')](function(_0x7963ef){if(_0x7963ef){_0x8d9eff=_0x7963ef[_0xa45a('0x3c')];if(!_0x1d6036[_0xa45a('0x36')]['hasOwnProperty'](_0xa45a('0x3e'))){_0x3833a1[_0xa45a('0x22')]=qs[_0xa45a('0x22')](_0x1d6036[_0xa45a('0x36')][_0xa45a('0x22')]);_0x3833a1[_0xa45a('0x20')]=qs['offset'](_0x1d6036[_0xa45a('0x36')][_0xa45a('0x20')]);}return _0x3c5410['getIntervals'](_0x3833a1);}})[_0xa45a('0x27')](function(_0x50ddd1){if(_0x50ddd1){return _0x50ddd1?{'count':_0x8d9eff,'rows':_0x50ddd1}:null;}})['then'](respondWithResult(_0x31c54d,null))['catch'](handleError(_0x31c54d,null));};exports[_0xa45a('0x59')]=function(_0x56a357,_0x46e43c,_0x110fe0){return db[_0xa45a('0x30')][_0xa45a('0x5a')]({'where':{'id':_0x56a357['params']['id']}})[_0xa45a('0x27')](handleEntityNotFound(_0x46e43c,null))[_0xa45a('0x27')](function(_0x1f41b6){if(_0x1f41b6){return db[_0xa45a('0x5b')][_0xa45a('0x5c')](function(_0x46fb86){return db[_0xa45a('0x30')][_0xa45a('0x28')]({'where':{'IntervalId':_0x56a357[_0xa45a('0x4b')]['id']},'transaction':_0x46fb86})[_0xa45a('0x27')](function(_0x6754a2){var _0x172dda=_[_0xa45a('0x2f')](_0x56a357[_0xa45a('0x4e')],function(_0x154230){delete _0x154230['id'];_0x154230[_0xa45a('0x57')]=_0x56a357['params']['id'];return _0x154230;});return db[_0xa45a('0x30')][_0xa45a('0x5d')](_0x172dda,{'transaction':_0x46fb86});});})[_0xa45a('0x27')](function(){return db['Interval'][_0xa45a('0x5e')]({'where':{'IntervalId':_0x56a357[_0xa45a('0x4b')]['id']}});});}})[_0xa45a('0x27')](respondWithResult(_0x46e43c,null))[_0xa45a('0x49')](handleError(_0x46e43c,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index e13f5f5..b243693 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 _0x5700=['bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','exports','define','Interval','tools_intervals','rewrite','../../config/logger','api'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0x5700,0x191));var _0x0570=function(_0x5aaa26,_0x493032){_0x5aaa26=_0x5aaa26-0x0;var _0x58d38b=_0x5700[_0x5aaa26];return _0x58d38b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0570('0x0'))(_0x0570('0x1'));var moment=require('moment');var BPromise=require(_0x0570('0x2'));var rp=require(_0x0570('0x3'));var fs=require('fs');var path=require(_0x0570('0x4'));var rimraf=require(_0x0570('0x5'));var config=require(_0x0570('0x6'));var attributes=require(_0x0570('0x7'));var extensions=require('../../components/extensions/rewrite');module[_0x0570('0x8')]=function(_0x249403,_0x1ff3a1){return _0x249403[_0x0570('0x9')](_0x0570('0xa'),attributes,{'tableName':_0x0570('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3aef17,_0x580081){extensions[_0x0570('0xc')](_0x249403,_0x3aef17);},'afterBulkCreate':function(_0x23050e,_0x1e6558,_0xfbfa3e){_0xfbfa3e();extensions[_0x0570('0xc')](_0x249403,_0x23050e[0x0]);},'afterUpdate':function(_0x1c615c,_0x5c75c7){extensions['rewrite'](_0x249403,_0x1c615c);},'afterDestroy':function(_0x2f94cf,_0x152b5b){extensions[_0x0570('0xc')](_0x249403,_0x2f94cf);}}});}; \ No newline at end of file +var _0xa984=['rewrite','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','Interval'];(function(_0xe8129c,_0x2fb03c){var _0x709fc5=function(_0xb8e0c6){while(--_0xb8e0c6){_0xe8129c['push'](_0xe8129c['shift']());}};_0x709fc5(++_0x2fb03c);}(_0xa984,0x15a));var _0x4a98=function(_0x4dbb79,_0xab00fe){_0x4dbb79=_0x4dbb79-0x0;var _0x53e484=_0xa984[_0x4dbb79];return _0x53e484;};'use strict';var _=require(_0x4a98('0x0'));var util=require(_0x4a98('0x1'));var logger=require(_0x4a98('0x2'))(_0x4a98('0x3'));var moment=require(_0x4a98('0x4'));var BPromise=require(_0x4a98('0x5'));var rp=require(_0x4a98('0x6'));var fs=require('fs');var path=require(_0x4a98('0x7'));var rimraf=require(_0x4a98('0x8'));var config=require(_0x4a98('0x9'));var attributes=require(_0x4a98('0xa'));var extensions=require(_0x4a98('0xb'));module[_0x4a98('0xc')]=function(_0x310c98,_0x4e24d1){return _0x310c98['define'](_0x4a98('0xd'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43bf6d,_0x59e3a5){extensions[_0x4a98('0xe')](_0x310c98,_0x43bf6d);},'afterBulkCreate':function(_0x4eda68,_0xbe2be2,_0x4e552f){_0x4e552f();extensions[_0x4a98('0xe')](_0x310c98,_0x4eda68[0x0]);},'afterUpdate':function(_0x210345,_0x3acb9f){extensions['rewrite'](_0x310c98,_0x210345);},'afterDestroy':function(_0x2fc026,_0x3481c2){extensions[_0x4a98('0xe')](_0x310c98,_0x2fc026);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c417292..a2cf777 100644 --- a/server/api/interval/interval.rpc.js +++ b/server/api/interval/interval.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x544099,_0x372b30){var _0x20ab09=function(_0x149613){while(--_0x149613){_0x544099['push'](_0x544099['shift']());}};_0x20ab09(++_0x372b30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetInterval']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 74e2fc5..1ca71d9 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x201624,_0x51ddca){var _0x3ee1a0=function(_0x1b3c7e){while(--_0x1b3c7e){_0x201624['push'](_0x201624['shift']());}};_0x3ee1a0(++_0x51ddca);}(_0x2ef3,0xba));var _0x32ef=function(_0x1b5590,_0x543462){_0x1b5590=_0x1b5590-0x0;var _0x21f778=_0x2ef3[_0x1b5590];return _0x21f778;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x5f66[_0x3947c9];return _0x2e7871;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 11c7637..c4b3e79 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 _0x2d44=['reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','data','end','statusCode','json','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','api','support','3eAmWpBVP0','summary','Report','description','issuetype','Bug','fields','customfield_11500','email','customfield_11502','newToken','customfield_11503','name','customfield_11504'];(function(_0x5c997a,_0x40f961){var _0x67b821=function(_0x308d8d){while(--_0x308d8d){_0x5c997a['push'](_0x5c997a['shift']());}};_0x67b821(++_0x40f961);}(_0x2d44,0xd4));var _0x42d4=function(_0x5f4843,_0x43c066){_0x5f4843=_0x5f4843-0x0;var _0x512d1c=_0x2d44[_0x5f4843];return _0x512d1c;};'use strict';var BPromise=require(_0x42d4('0x0'));var https=require(_0x42d4('0x1'));var logger=require('../../config/logger')(_0x42d4('0x2'));var USERNAME=_0x42d4('0x3');var PASSWORD=_0x42d4('0x4');function openIssue(_0xd5ef36,_0x45c4c9){var _0x34719f={'fields':{'project':{'key':_0xd5ef36['key']||'MOTGUI'},'summary':(_0xd5ef36[_0x42d4('0x5')]||_0x42d4('0x6'))+'\x20from\x20'+_0xd5ef36['ip'],'description':_0xd5ef36[_0x42d4('0x7')]||JSON['stringify'](_0xd5ef36),'issuetype':{'name':_0xd5ef36[_0x42d4('0x8')]||_0x42d4('0x9')}}};_0x34719f[_0x42d4('0xa')][_0x42d4('0xb')]=_0xd5ef36[_0x42d4('0xc')];_0x34719f['fields']['customfield_11501']=_0xd5ef36['oldToken'];_0x34719f[_0x42d4('0xa')][_0x42d4('0xd')]=_0xd5ef36[_0x42d4('0xe')];_0x34719f[_0x42d4('0xa')][_0x42d4('0xf')]=_0xd5ef36[_0x42d4('0x10')];_0x34719f['fields'][_0x42d4('0x11')]=_0xd5ef36[_0x42d4('0x12')];_0x34719f[_0x42d4('0xa')][_0x42d4('0x13')]=_0xd5ef36['ip'];var _0x58cdc7={'host':_0x42d4('0x14'),'port':0x1bb,'path':_0x42d4('0x15'),'method':_0x42d4('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x42d4('0x17'),'Authorization':_0x42d4('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x42d4('0x19')](_0x42d4('0x1a'))}};var _0x267d6e=JSON[_0x42d4('0x1b')](_0x34719f);var _0x318b9d=https[_0x42d4('0x1c')](_0x58cdc7,function(_0x39331d){_0x39331d[_0x42d4('0x1d')]('utf8');var _0x3ebc50='';_0x39331d['on'](_0x42d4('0x1e'),function(_0x303883){_0x3ebc50+=_0x303883;});_0x39331d['on'](_0x42d4('0x1f'),function(){if(_0x45c4c9){return _0x45c4c9['status'](_0x39331d[_0x42d4('0x20')])[_0x42d4('0x21')](JSON['parse'](_0x3ebc50));}});});_0x318b9d['on'](_0x42d4('0x22'),function(_0x375aa2){if(_0x45c4c9){return _0x45c4c9[_0x42d4('0x23')](0x1f4)[_0x42d4('0x21')]({'errors':[{'message':_0x42d4('0x24'),'type':'api.jira'}]});}});_0x318b9d[_0x42d4('0x25')](_0x267d6e);_0x318b9d[_0x42d4('0x1f')]();}exports[_0x42d4('0x26')]=openIssue;exports[_0x42d4('0x27')]=function(_0xd9e8cf,_0x414c11){_0xd9e8cf[_0x42d4('0x28')]['ip']=_0xd9e8cf[_0x42d4('0x29')][_0x42d4('0x2a')]||_0xd9e8cf[_0x42d4('0x2b')][_0x42d4('0x2c')]||_0xd9e8cf[_0x42d4('0x2d')][_0x42d4('0x2c')]||_0xd9e8cf[_0x42d4('0x2b')]['socket'][_0x42d4('0x2c')];return openIssue(_0xd9e8cf[_0x42d4('0x28')],_0x414c11);}; \ No newline at end of file +var _0xfd12=['oldToken','newToken','customfield_11503','name','customfield_11504','reason','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11501'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xfd12,0x159));var _0x2fd1=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0xfd12[_0x55fa03];return _0x2cd7cd;};'use strict';var BPromise=require(_0x2fd1('0x0'));var https=require(_0x2fd1('0x1'));var logger=require(_0x2fd1('0x2'))(_0x2fd1('0x3'));var USERNAME=_0x2fd1('0x4');var PASSWORD=_0x2fd1('0x5');function openIssue(_0x27cd83,_0x5ec8a6){var _0x523e5c={'fields':{'project':{'key':_0x27cd83['key']||_0x2fd1('0x6')},'summary':(_0x27cd83[_0x2fd1('0x7')]||'Report')+_0x2fd1('0x8')+_0x27cd83['ip'],'description':_0x27cd83[_0x2fd1('0x9')]||JSON[_0x2fd1('0xa')](_0x27cd83),'issuetype':{'name':_0x27cd83[_0x2fd1('0xb')]||_0x2fd1('0xc')}}};_0x523e5c[_0x2fd1('0xd')]['customfield_11500']=_0x27cd83['email'];_0x523e5c[_0x2fd1('0xd')][_0x2fd1('0xe')]=_0x27cd83[_0x2fd1('0xf')];_0x523e5c['fields']['customfield_11502']=_0x27cd83[_0x2fd1('0x10')];_0x523e5c[_0x2fd1('0xd')][_0x2fd1('0x11')]=_0x27cd83[_0x2fd1('0x12')];_0x523e5c[_0x2fd1('0xd')][_0x2fd1('0x13')]=_0x27cd83[_0x2fd1('0x14')];_0x523e5c['fields']['customfield_10102']=_0x27cd83['ip'];var _0x3eaa4d={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':_0x2fd1('0x15'),'timeout':0x4e20,'headers':{'Content-Type':_0x2fd1('0x16'),'Authorization':_0x2fd1('0x17')+new Buffer(USERNAME+':'+PASSWORD)[_0x2fd1('0x18')](_0x2fd1('0x19'))}};var _0x348149=JSON['stringify'](_0x523e5c);var _0x27d71a=https[_0x2fd1('0x1a')](_0x3eaa4d,function(_0x380bce){_0x380bce[_0x2fd1('0x1b')](_0x2fd1('0x1c'));var _0x2b805f='';_0x380bce['on'](_0x2fd1('0x1d'),function(_0x16148f){_0x2b805f+=_0x16148f;});_0x380bce['on']('end',function(){if(_0x5ec8a6){return _0x5ec8a6[_0x2fd1('0x1e')](_0x380bce[_0x2fd1('0x1f')])['json'](JSON[_0x2fd1('0x20')](_0x2b805f));}});});_0x27d71a['on'](_0x2fd1('0x21'),function(_0x170144){if(_0x5ec8a6){return _0x5ec8a6[_0x2fd1('0x1e')](0x1f4)[_0x2fd1('0x22')]({'errors':[{'message':_0x2fd1('0x23'),'type':_0x2fd1('0x24')}]});}});_0x27d71a['write'](_0x348149);_0x27d71a[_0x2fd1('0x25')]();}exports[_0x2fd1('0x26')]=openIssue;exports['send']=function(_0x2fe62b,_0x4fdde3){_0x2fe62b[_0x2fd1('0x27')]['ip']=_0x2fe62b[_0x2fd1('0x28')][_0x2fd1('0x29')]||_0x2fe62b[_0x2fd1('0x2a')][_0x2fd1('0x2b')]||_0x2fe62b['socket']['remoteAddress']||_0x2fe62b[_0x2fd1('0x2a')][_0x2fd1('0x2c')][_0x2fd1('0x2b')];return openIssue(_0x2fe62b[_0x2fd1('0x27')],_0x4fdde3);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 37ada31..faa0ec6 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 _0x153f=['Router','fs-extra','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x1eec5d,_0x2dedda){var _0x56acdd=function(_0x13c7b6){while(--_0x13c7b6){_0x1eec5d['push'](_0x1eec5d['shift']());}};_0x56acdd(++_0x2dedda);}(_0x153f,0x15b));var _0xf153=function(_0x1a0881,_0x3707c5){_0x1a0881=_0x1a0881-0x0;var _0x1e61d4=_0x153f[_0x1a0881];return _0x1e61d4;};'use strict';var multer=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var path=require(_0xf153('0x2'));var timeout=require(_0xf153('0x3'));var express=require(_0xf153('0x4'));var router=express[_0xf153('0x5')]();var fs_extra=require(_0xf153('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf153('0x7'));var config=require('../../config/environment');var controller=require(_0xf153('0x8'));router[_0xf153('0x9')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0xb')]);router[_0xf153('0x9')]('/describe',auth[_0xf153('0xa')](),controller[_0xf153('0xc')]);router[_0xf153('0x9')](_0xf153('0xd'),auth[_0xf153('0xa')](),controller[_0xf153('0xe')]);router[_0xf153('0xf')]('/',auth[_0xf153('0xa')](),controller[_0xf153('0x10')]);router[_0xf153('0x11')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x12')]);router[_0xf153('0x13')]('/:id',auth[_0xf153('0xa')](),controller[_0xf153('0x14')]);module[_0xf153('0x15')]=router; \ No newline at end of file +var _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x390d6e,_0x358698){var _0x1b79a=function(_0x58fdcf){while(--_0x58fdcf){_0x390d6e['push'](_0x390d6e['shift']());}};_0x1b79a(++_0x358698);}(_0x41bb,0xc5));var _0xb41b=function(_0x4ba1ab,_0x4277fe){_0x4ba1ab=_0x4ba1ab-0x0;var _0x39c47e=_0x41bb[_0x4ba1ab];return _0x39c47e;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 4133530..c792d9d 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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x520409,_0x208d5d){_0x520409=_0x520409-0x0;var _0x2a107e=_0x7a54[_0x520409];return _0x2a107e;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x1c7455,_0x4627fa){_0x1c7455=_0x1c7455-0x0;var _0x171a19=_0x7a54[_0x1c7455];return _0x171a19;};'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 9d1db04..88c7307 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 _0xc474=['fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filters','filter','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','sendStatus','error','stack','name','send','JscriptyAnswerReport','rawAttributes'];(function(_0x484001,_0x38d195){var _0x1b22cc=function(_0x46713a){while(--_0x46713a){_0x484001['push'](_0x484001['shift']());}};_0x1b22cc(++_0x38d195);}(_0xc474,0xfc));var _0x4c47=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xc474[_0x45d3f0];return _0x314b79;};'use strict';var emlformat=require(_0x4c47('0x0'));var rimraf=require(_0x4c47('0x1'));var zipdir=require(_0x4c47('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c47('0x3'));var moment=require(_0x4c47('0x4'));var BPromise=require(_0x4c47('0x5'));var Mustache=require(_0x4c47('0x6'));var util=require(_0x4c47('0x7'));var path=require(_0x4c47('0x8'));var sox=require(_0x4c47('0x9'));var csv=require(_0x4c47('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4c47('0xb'));var squel=require(_0x4c47('0xc'));var crypto=require(_0x4c47('0xd'));var jsforce=require(_0x4c47('0xe'));var deskjs=require(_0x4c47('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c47('0x10'));var Papa=require(_0x4c47('0x11'));var Redis=require('ioredis');var authService=require(_0x4c47('0x12'));var qs=require(_0x4c47('0x13'));var as=require(_0x4c47('0x14'));var hardwareService=require(_0x4c47('0x15'));var logger=require('../../config/logger')(_0x4c47('0x16'));var utils=require('../../config/utils');var config=require(_0x4c47('0x17'));var licenseUtil=require(_0x4c47('0x18'));var db=require(_0x4c47('0x19'))['db'];function respondWithStatusCode(_0x496e7b,_0x429553){_0x429553=_0x429553||0xcc;return function(_0x16a4fd){if(_0x16a4fd){return _0x496e7b['sendStatus'](_0x429553);}return _0x496e7b[_0x4c47('0x1a')](_0x429553)['end']();};}function respondWithResult(_0x3d1b6a,_0x121f9e){_0x121f9e=_0x121f9e||0xc8;return function(_0x25d4dc){if(_0x25d4dc){return _0x3d1b6a[_0x4c47('0x1a')](_0x121f9e)['json'](_0x25d4dc);}};}function respondWithFilteredResult(_0xb53c24,_0x78f26b){return function(_0x16c7a9){if(_0x16c7a9){var _0xd162cc=typeof _0x78f26b['offset']==='undefined'&&typeof _0x78f26b['limit']===_0x4c47('0x1b');var _0x92a444=_0x16c7a9[_0x4c47('0x1c')];var _0x5727cf=_0xd162cc?0x0:_0x78f26b[_0x4c47('0x1d')];var _0x254dfc=_0xd162cc?_0x16c7a9[_0x4c47('0x1c')]:_0x78f26b[_0x4c47('0x1d')]+_0x78f26b['limit'];var _0x4cc984;if(_0x254dfc>=_0x92a444){_0x254dfc=_0x92a444;_0x4cc984=0xc8;}else{_0x4cc984=0xce;}_0xb53c24['status'](_0x4cc984);return _0xb53c24[_0x4c47('0x1e')](_0x4c47('0x1f'),_0x5727cf+'-'+_0x254dfc+'/'+_0x92a444)[_0x4c47('0x20')](_0x16c7a9);}return null;};}function patchUpdates(_0x3b156f){return function(_0x52de60){try{jsonpatch[_0x4c47('0x21')](_0x52de60,_0x3b156f,!![]);}catch(_0x27b61a){return BPromise[_0x4c47('0x22')](_0x27b61a);}return _0x52de60[_0x4c47('0x23')]();};}function saveUpdates(_0x20950c,_0x40a984){return function(_0x4d56eb){if(_0x4d56eb){return _0x4d56eb['update'](_0x20950c)['then'](function(_0x1a575a){return _0x1a575a;});}return null;};}function removeEntity(_0x275a10,_0x4d110d){return function(_0x3037a2){if(_0x3037a2){return _0x3037a2['destroy']()[_0x4c47('0x24')](function(){_0x275a10['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x592469,_0x3bacc9){return function(_0x3bd199){if(!_0x3bd199){_0x592469[_0x4c47('0x25')](0x194);}return _0x3bd199;};}function handleError(_0x4eff26,_0x33f440){_0x33f440=_0x33f440||0x1f4;return function(_0x2c0367){logger[_0x4c47('0x26')](_0x2c0367[_0x4c47('0x27')]);if(_0x2c0367[_0x4c47('0x28')]){delete _0x2c0367[_0x4c47('0x28')];}_0x4eff26[_0x4c47('0x1a')](_0x33f440)[_0x4c47('0x29')](_0x2c0367);};}exports['index']=function(_0x36e82b,_0x344a7d){var _0x590b56={},_0x491638={},_0x3b977d={'count':0x0,'rows':[]};var _0x56c130=_['map'](db[_0x4c47('0x2a')][_0x4c47('0x2b')],function(_0x12462a){return{'name':_0x12462a[_0x4c47('0x2c')],'type':_0x12462a[_0x4c47('0x2d')]['key']};});_0x491638[_0x4c47('0x2e')]=_['map'](_0x56c130,_0x4c47('0x28'));_0x491638[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x36e82b['query']);_0x491638['filters']=_['intersection'](_0x491638['model'],_0x491638[_0x4c47('0x2f')]);_0x590b56[_0x4c47('0x31')]=_[_0x4c47('0x32')](_0x491638['model'],qs[_0x4c47('0x33')](_0x36e82b['query'][_0x4c47('0x33')]));_0x590b56[_0x4c47('0x31')]=_0x590b56[_0x4c47('0x31')][_0x4c47('0x34')]?_0x590b56[_0x4c47('0x31')]:_0x491638[_0x4c47('0x2e')];if(!_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x35')]('nolimit')){_0x590b56[_0x4c47('0x36')]=qs[_0x4c47('0x36')](_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x36')]);_0x590b56['offset']=qs['offset'](_0x36e82b['query'][_0x4c47('0x1d')]);}_0x590b56[_0x4c47('0x37')]=qs[_0x4c47('0x38')](_0x36e82b['query']['sort']);_0x590b56['where']=qs['filters'](_[_0x4c47('0x39')](_0x36e82b[_0x4c47('0x2f')],_0x491638[_0x4c47('0x3a')]),_0x56c130);if(_0x36e82b[_0x4c47('0x2f')][_0x4c47('0x3b')]){_0x590b56['where']=_[_0x4c47('0x3c')](_0x590b56[_0x4c47('0x3d')],{'$or':_['map'](_0x56c130,function(_0x1c309b){if(_0x1c309b[_0x4c47('0x2d')]!==_0x4c47('0x3e')){var _0x418098={};_0x418098[_0x1c309b[_0x4c47('0x28')]]={'$like':'%'+_0x36e82b['query'][_0x4c47('0x3b')]+'%'};return _0x418098;}})});}_0x590b56=_[_0x4c47('0x3c')]({},_0x590b56,_0x36e82b[_0x4c47('0x3f')]);var _0x291666={'where':_0x590b56[_0x4c47('0x3d')]};return db['JscriptyAnswerReport'][_0x4c47('0x1c')](_0x291666)[_0x4c47('0x24')](function(_0x5a7135){_0x3b977d[_0x4c47('0x1c')]=_0x5a7135;if(_0x36e82b['query'][_0x4c47('0x40')]){_0x590b56[_0x4c47('0x41')]=[{'all':!![]}];}return db[_0x4c47('0x2a')]['findAll'](_0x590b56);})['then'](function(_0x164105){_0x3b977d[_0x4c47('0x42')]=_0x164105;return _0x3b977d;})[_0x4c47('0x24')](respondWithFilteredResult(_0x344a7d,_0x590b56))['catch'](handleError(_0x344a7d,null));};exports[_0x4c47('0x43')]=function(_0x10669d,_0x40057e){var _0x5a0b1f={'raw':!![],'where':{'id':_0x10669d[_0x4c47('0x44')]['id']}},_0x274596={};_0x274596[_0x4c47('0x2e')]=_[_0x4c47('0x30')](db[_0x4c47('0x2a')][_0x4c47('0x2b')]);_0x274596[_0x4c47('0x2f')]=_[_0x4c47('0x30')](_0x10669d[_0x4c47('0x2f')]);_0x274596[_0x4c47('0x3a')]=_['intersection'](_0x274596[_0x4c47('0x2e')],_0x274596[_0x4c47('0x2f')]);_0x5a0b1f['attributes']=_['intersection'](_0x274596[_0x4c47('0x2e')],qs[_0x4c47('0x33')](_0x10669d['query'][_0x4c47('0x33')]));_0x5a0b1f[_0x4c47('0x31')]=_0x5a0b1f[_0x4c47('0x31')][_0x4c47('0x34')]?_0x5a0b1f[_0x4c47('0x31')]:_0x274596['model'];if(_0x10669d['query'][_0x4c47('0x40')]){_0x5a0b1f[_0x4c47('0x41')]=[{'all':!![]}];}_0x5a0b1f=_[_0x4c47('0x3c')]({},_0x5a0b1f,_0x10669d[_0x4c47('0x3f')]);return db[_0x4c47('0x2a')][_0x4c47('0x45')](_0x5a0b1f)[_0x4c47('0x24')](handleEntityNotFound(_0x40057e,null))['then'](respondWithResult(_0x40057e,null))[_0x4c47('0x46')](handleError(_0x40057e,null));};exports['create']=function(_0x40bbec,_0x460fef){return db[_0x4c47('0x2a')]['create'](_0x40bbec[_0x4c47('0x47')],{})[_0x4c47('0x24')](respondWithResult(_0x460fef,0xc9))[_0x4c47('0x46')](handleError(_0x460fef,null));};exports['update']=function(_0x125b18,_0x4ccb67){if(_0x125b18[_0x4c47('0x47')]['id']){delete _0x125b18['body']['id'];}return db[_0x4c47('0x2a')]['find']({'where':{'id':_0x125b18[_0x4c47('0x44')]['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x4ccb67,null))[_0x4c47('0x24')](saveUpdates(_0x125b18[_0x4c47('0x47')],null))['then'](respondWithResult(_0x4ccb67,null))['catch'](handleError(_0x4ccb67,null));};exports[_0x4c47('0x48')]=function(_0x48ba62,_0x419ee3){return db[_0x4c47('0x2a')][_0x4c47('0x45')]({'where':{'id':_0x48ba62['params']['id']}})[_0x4c47('0x24')](handleEntityNotFound(_0x419ee3,null))[_0x4c47('0x24')](removeEntity(_0x419ee3,null))['catch'](handleError(_0x419ee3,null));};exports['describe']=function(_0x59d746,_0x479332){return db[_0x4c47('0x2a')][_0x4c47('0x49')]()[_0x4c47('0x24')](respondWithResult(_0x479332,null))[_0x4c47('0x46')](handleError(_0x479332,null));}; \ No newline at end of file +var _0x7dee=['fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','count','includeAll','findAll','rows','show','options','catch','create','body','find','params','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes'];(function(_0x262c3c,_0x4dea0d){var _0x54f46a=function(_0x4e4fb8){while(--_0x4e4fb8){_0x262c3c['push'](_0x262c3c['shift']());}};_0x54f46a(++_0x4dea0d);}(_0x7dee,0xb0));var _0xe7de=function(_0x4f98aa,_0x174abd){_0x4f98aa=_0x4f98aa-0x0;var _0x43a4e9=_0x7dee[_0x4f98aa];return _0x43a4e9;};'use strict';var emlformat=require(_0xe7de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe7de('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7de('0x2'));var moment=require(_0xe7de('0x3'));var BPromise=require(_0xe7de('0x4'));var Mustache=require(_0xe7de('0x5'));var util=require('util');var path=require(_0xe7de('0x6'));var sox=require('sox');var csv=require(_0xe7de('0x7'));var ejs=require(_0xe7de('0x8'));var fs=require('fs');var fs_extra=require(_0xe7de('0x9'));var _=require(_0xe7de('0xa'));var squel=require(_0xe7de('0xb'));var crypto=require(_0xe7de('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe7de('0xd'));var toCsv=require(_0xe7de('0x7'));var querystring=require(_0xe7de('0xe'));var Papa=require(_0xe7de('0xf'));var Redis=require('ioredis');var authService=require(_0xe7de('0x10'));var qs=require(_0xe7de('0x11'));var as=require(_0xe7de('0x12'));var hardwareService=require(_0xe7de('0x13'));var logger=require(_0xe7de('0x14'))(_0xe7de('0x15'));var utils=require(_0xe7de('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xe7de('0x17'));var db=require(_0xe7de('0x18'))['db'];function respondWithStatusCode(_0x38c0a1,_0x2c535c){_0x2c535c=_0x2c535c||0xcc;return function(_0x2c49d6){if(_0x2c49d6){return _0x38c0a1['sendStatus'](_0x2c535c);}return _0x38c0a1[_0xe7de('0x19')](_0x2c535c)[_0xe7de('0x1a')]();};}function respondWithResult(_0x280473,_0x41f731){_0x41f731=_0x41f731||0xc8;return function(_0xe68b48){if(_0xe68b48){return _0x280473[_0xe7de('0x19')](_0x41f731)['json'](_0xe68b48);}};}function respondWithFilteredResult(_0x4b70ab,_0x28a0c4){return function(_0x3f62e1){if(_0x3f62e1){var _0x3e49d5=typeof _0x28a0c4[_0xe7de('0x1b')]===_0xe7de('0x1c')&&typeof _0x28a0c4['limit']===_0xe7de('0x1c');var _0x4b1648=_0x3f62e1['count'];var _0x5cb629=_0x3e49d5?0x0:_0x28a0c4[_0xe7de('0x1b')];var _0x1da189=_0x3e49d5?_0x3f62e1['count']:_0x28a0c4[_0xe7de('0x1b')]+_0x28a0c4[_0xe7de('0x1d')];var _0x2850c6;if(_0x1da189>=_0x4b1648){_0x1da189=_0x4b1648;_0x2850c6=0xc8;}else{_0x2850c6=0xce;}_0x4b70ab[_0xe7de('0x19')](_0x2850c6);return _0x4b70ab[_0xe7de('0x1e')](_0xe7de('0x1f'),_0x5cb629+'-'+_0x1da189+'/'+_0x4b1648)[_0xe7de('0x20')](_0x3f62e1);}return null;};}function patchUpdates(_0xfead44){return function(_0x1c6fa6){try{jsonpatch['apply'](_0x1c6fa6,_0xfead44,!![]);}catch(_0x1120c1){return BPromise[_0xe7de('0x21')](_0x1120c1);}return _0x1c6fa6[_0xe7de('0x22')]();};}function saveUpdates(_0x4eb228,_0xc9f494){return function(_0x597346){if(_0x597346){return _0x597346[_0xe7de('0x23')](_0x4eb228)[_0xe7de('0x24')](function(_0x3b0c24){return _0x3b0c24;});}return null;};}function removeEntity(_0x5e97ec,_0x45b4e1){return function(_0x454952){if(_0x454952){return _0x454952[_0xe7de('0x25')]()[_0xe7de('0x24')](function(){_0x5e97ec[_0xe7de('0x19')](0xcc)[_0xe7de('0x1a')]();});}};}function handleEntityNotFound(_0xd7f3ca,_0x1f837e){return function(_0x4c0aff){if(!_0x4c0aff){_0xd7f3ca[_0xe7de('0x26')](0x194);}return _0x4c0aff;};}function handleError(_0x33e7f1,_0x419a94){_0x419a94=_0x419a94||0x1f4;return function(_0x248b9a){logger[_0xe7de('0x27')](_0x248b9a[_0xe7de('0x28')]);if(_0x248b9a[_0xe7de('0x29')]){delete _0x248b9a['name'];}_0x33e7f1[_0xe7de('0x19')](_0x419a94)[_0xe7de('0x2a')](_0x248b9a);};}exports[_0xe7de('0x2b')]=function(_0x3d4d63,_0x25b7cd){var _0x4ff7df={},_0x41b591={},_0x241a37={'count':0x0,'rows':[]};var _0x596cb2=_['map'](db[_0xe7de('0x2c')][_0xe7de('0x2d')],function(_0x225e8e){return{'name':_0x225e8e[_0xe7de('0x2e')],'type':_0x225e8e['type'][_0xe7de('0x2f')]};});_0x41b591[_0xe7de('0x30')]=_[_0xe7de('0x31')](_0x596cb2,_0xe7de('0x29'));_0x41b591['query']=_[_0xe7de('0x32')](_0x3d4d63[_0xe7de('0x33')]);_0x41b591[_0xe7de('0x34')]=_[_0xe7de('0x35')](_0x41b591[_0xe7de('0x30')],_0x41b591[_0xe7de('0x33')]);_0x4ff7df[_0xe7de('0x36')]=_[_0xe7de('0x35')](_0x41b591['model'],qs[_0xe7de('0x37')](_0x3d4d63[_0xe7de('0x33')][_0xe7de('0x37')]));_0x4ff7df[_0xe7de('0x36')]=_0x4ff7df[_0xe7de('0x36')][_0xe7de('0x38')]?_0x4ff7df[_0xe7de('0x36')]:_0x41b591[_0xe7de('0x30')];if(!_0x3d4d63[_0xe7de('0x33')][_0xe7de('0x39')]('nolimit')){_0x4ff7df['limit']=qs[_0xe7de('0x1d')](_0x3d4d63[_0xe7de('0x33')][_0xe7de('0x1d')]);_0x4ff7df[_0xe7de('0x1b')]=qs[_0xe7de('0x1b')](_0x3d4d63[_0xe7de('0x33')][_0xe7de('0x1b')]);}_0x4ff7df[_0xe7de('0x3a')]=qs[_0xe7de('0x3b')](_0x3d4d63[_0xe7de('0x33')]['sort']);_0x4ff7df[_0xe7de('0x3c')]=qs[_0xe7de('0x34')](_[_0xe7de('0x3d')](_0x3d4d63[_0xe7de('0x33')],_0x41b591[_0xe7de('0x34')]),_0x596cb2);if(_0x3d4d63['query']['filter']){_0x4ff7df[_0xe7de('0x3c')]=_[_0xe7de('0x3e')](_0x4ff7df[_0xe7de('0x3c')],{'$or':_[_0xe7de('0x31')](_0x596cb2,function(_0x377b89){if(_0x377b89[_0xe7de('0x3f')]!==_0xe7de('0x40')){var _0x219231={};_0x219231[_0x377b89[_0xe7de('0x29')]]={'$like':'%'+_0x3d4d63['query']['filter']+'%'};return _0x219231;}})});}_0x4ff7df=_[_0xe7de('0x3e')]({},_0x4ff7df,_0x3d4d63['options']);var _0x51ff68={'where':_0x4ff7df['where']};return db[_0xe7de('0x2c')][_0xe7de('0x41')](_0x51ff68)[_0xe7de('0x24')](function(_0x94a7c2){_0x241a37[_0xe7de('0x41')]=_0x94a7c2;if(_0x3d4d63[_0xe7de('0x33')][_0xe7de('0x42')]){_0x4ff7df['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xe7de('0x43')](_0x4ff7df);})[_0xe7de('0x24')](function(_0xa71e89){_0x241a37[_0xe7de('0x44')]=_0xa71e89;return _0x241a37;})['then'](respondWithFilteredResult(_0x25b7cd,_0x4ff7df))['catch'](handleError(_0x25b7cd,null));};exports[_0xe7de('0x45')]=function(_0x495a82,_0x1ad1ac){var _0x5ac35f={'raw':!![],'where':{'id':_0x495a82['params']['id']}},_0x3e33dc={};_0x3e33dc[_0xe7de('0x30')]=_['keys'](db[_0xe7de('0x2c')][_0xe7de('0x2d')]);_0x3e33dc[_0xe7de('0x33')]=_['keys'](_0x495a82[_0xe7de('0x33')]);_0x3e33dc[_0xe7de('0x34')]=_[_0xe7de('0x35')](_0x3e33dc['model'],_0x3e33dc[_0xe7de('0x33')]);_0x5ac35f['attributes']=_[_0xe7de('0x35')](_0x3e33dc[_0xe7de('0x30')],qs[_0xe7de('0x37')](_0x495a82[_0xe7de('0x33')][_0xe7de('0x37')]));_0x5ac35f['attributes']=_0x5ac35f['attributes'][_0xe7de('0x38')]?_0x5ac35f['attributes']:_0x3e33dc['model'];if(_0x495a82[_0xe7de('0x33')][_0xe7de('0x42')]){_0x5ac35f['include']=[{'all':!![]}];}_0x5ac35f=_[_0xe7de('0x3e')]({},_0x5ac35f,_0x495a82[_0xe7de('0x46')]);return db['JscriptyAnswerReport']['find'](_0x5ac35f)[_0xe7de('0x24')](handleEntityNotFound(_0x1ad1ac,null))[_0xe7de('0x24')](respondWithResult(_0x1ad1ac,null))[_0xe7de('0x47')](handleError(_0x1ad1ac,null));};exports['create']=function(_0x2eef24,_0x28eef7){return db[_0xe7de('0x2c')][_0xe7de('0x48')](_0x2eef24[_0xe7de('0x49')],{})[_0xe7de('0x24')](respondWithResult(_0x28eef7,0xc9))[_0xe7de('0x47')](handleError(_0x28eef7,null));};exports[_0xe7de('0x23')]=function(_0x407582,_0x2d8a9a){if(_0x407582[_0xe7de('0x49')]['id']){delete _0x407582['body']['id'];}return db[_0xe7de('0x2c')][_0xe7de('0x4a')]({'where':{'id':_0x407582[_0xe7de('0x4b')]['id']}})[_0xe7de('0x24')](handleEntityNotFound(_0x2d8a9a,null))['then'](saveUpdates(_0x407582[_0xe7de('0x49')],null))[_0xe7de('0x24')](respondWithResult(_0x2d8a9a,null))[_0xe7de('0x47')](handleError(_0x2d8a9a,null));};exports[_0xe7de('0x25')]=function(_0x374d37,_0x427ba6){return db[_0xe7de('0x2c')][_0xe7de('0x4a')]({'where':{'id':_0x374d37[_0xe7de('0x4b')]['id']}})[_0xe7de('0x24')](handleEntityNotFound(_0x427ba6,null))['then'](removeEntity(_0x427ba6,null))[_0xe7de('0x47')](handleError(_0x427ba6,null));};exports[_0xe7de('0x4c')]=function(_0x3aac91,_0x3415a6){return db[_0xe7de('0x2c')][_0xe7de('0x4c')]()['then'](respondWithResult(_0x3415a6,null))[_0xe7de('0x47')](handleError(_0x3415a6,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 4efb221..6cdc912 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 _0x48a2=['exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x1ff86e,_0x2f5363){var _0x4f11e6=function(_0x555705){while(--_0x555705){_0x1ff86e['push'](_0x1ff86e['shift']());}};_0x4f11e6(++_0x2f5363);}(_0x48a2,0x13c));var _0x248a=function(_0x3a1dec,_0x1f943f){_0x3a1dec=_0x3a1dec-0x0;var _0x60ede0=_0x48a2[_0x3a1dec];return _0x60ede0;};'use strict';var _=require('lodash');var util=require(_0x248a('0x0'));var logger=require(_0x248a('0x1'))('api');var moment=require(_0x248a('0x2'));var BPromise=require('bluebird');var rp=require(_0x248a('0x3'));var fs=require('fs');var path=require(_0x248a('0x4'));var rimraf=require(_0x248a('0x5'));var config=require(_0x248a('0x6'));var attributes=require(_0x248a('0x7'));module[_0x248a('0x8')]=function(_0x19f4c1,_0x11a7c4){return _0x19f4c1[_0x248a('0x9')](_0x248a('0xa'),attributes,{'tableName':_0x248a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf18d=['request-promise','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird'];(function(_0x309477,_0x2a2bcb){var _0x162078=function(_0x819044){while(--_0x819044){_0x309477['push'](_0x309477['shift']());}};_0x162078(++_0x2a2bcb);}(_0xf18d,0x127));var _0xdf18=function(_0x56e7ab,_0x5250e6){_0x56e7ab=_0x56e7ab-0x0;var _0x74316a=_0xf18d[_0x56e7ab];return _0x74316a;};'use strict';var _=require(_0xdf18('0x0'));var util=require('util');var logger=require(_0xdf18('0x1'))(_0xdf18('0x2'));var moment=require(_0xdf18('0x3'));var BPromise=require(_0xdf18('0x4'));var rp=require(_0xdf18('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdf18('0x6'));var config=require('../../config/environment');var attributes=require(_0xdf18('0x7'));module[_0xdf18('0x8')]=function(_0x5dc198,_0xd17167){return _0x5dc198[_0xdf18('0x9')](_0xdf18('0xa'),attributes,{'tableName':_0xdf18('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index e6af88c..14cd808 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 _0xdcdd=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0xa346cc,_0x2a9d49){var _0x59b75d=function(_0x4cd177){while(--_0x4cd177){_0xa346cc['push'](_0xa346cc['shift']());}};_0x59b75d(++_0x2a9d49);}(_0xdcdd,0x18b));var _0xddcd=function(_0x3dda11,_0x12a9aa){_0x3dda11=_0x3dda11-0x0;var _0x538bc7=_0xdcdd[_0x3dda11];return _0x538bc7;};'use strict';var _=require('lodash');var util=require(_0xddcd('0x0'));var moment=require(_0xddcd('0x1'));var BPromise=require('bluebird');var rs=require(_0xddcd('0x2'));var fs=require('fs');var Redis=require(_0xddcd('0x3'));var db=require(_0xddcd('0x4'))['db'];var utils=require(_0xddcd('0x5'));var logger=require('../../config/logger')(_0xddcd('0x6'));var config=require(_0xddcd('0x7'));var jayson=require(_0xddcd('0x8'));var client=jayson[_0xddcd('0x9')][_0xddcd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b6ef6,_0x214b1d,_0x34b828){return new BPromise(function(_0x87637e,_0x20af53){return client[_0xddcd('0xb')](_0x5b6ef6,_0x34b828)['then'](function(_0x4a4111){logger[_0xddcd('0xc')](_0xddcd('0xd'),_0x214b1d,_0xddcd('0xe'));logger[_0xddcd('0xf')](_0xddcd('0x10'),_0x214b1d,_0xddcd('0xe'),JSON[_0xddcd('0x11')](_0x4a4111));if(_0x4a4111['error']){if(_0x4a4111[_0xddcd('0x12')]['code']===0x1f4){logger[_0xddcd('0x12')](_0xddcd('0xd'),_0x214b1d,_0x4a4111[_0xddcd('0x12')][_0xddcd('0x13')]);return _0x20af53(_0x4a4111[_0xddcd('0x12')][_0xddcd('0x13')]);}logger[_0xddcd('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x214b1d,_0x4a4111['error']['message']);return _0x87637e(_0x4a4111[_0xddcd('0x12')][_0xddcd('0x13')]);}else{logger[_0xddcd('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x214b1d,_0xddcd('0xe'));_0x87637e(_0x4a4111[_0xddcd('0x14')][_0xddcd('0x13')]);}})[_0xddcd('0x15')](function(_0x942ed5){logger[_0xddcd('0x12')](_0xddcd('0xd'),_0x214b1d,_0x942ed5);_0x20af53(_0x942ed5);});});} \ No newline at end of file +var _0x67e8=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x269afe,_0x107775){var _0x17d6ba=function(_0x4b6735){while(--_0x4b6735){_0x269afe['push'](_0x269afe['shift']());}};_0x17d6ba(++_0x107775);}(_0x67e8,0xcf));var _0x867e=function(_0x285d09,_0x4afc9a){_0x285d09=_0x285d09-0x0;var _0x5a5894=_0x67e8[_0x285d09];return _0x5a5894;};'use strict';var _=require(_0x867e('0x0'));var util=require(_0x867e('0x1'));var moment=require(_0x867e('0x2'));var BPromise=require(_0x867e('0x3'));var rs=require(_0x867e('0x4'));var fs=require('fs');var Redis=require(_0x867e('0x5'));var db=require(_0x867e('0x6'))['db'];var utils=require(_0x867e('0x7'));var logger=require(_0x867e('0x8'))(_0x867e('0x9'));var config=require(_0x867e('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x867e('0xb')][_0x867e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40347a,_0x145eb4,_0x1716c3){return new BPromise(function(_0x2856ad,_0x302300){return client[_0x867e('0xd')](_0x40347a,_0x1716c3)[_0x867e('0xe')](function(_0x4715a1){logger[_0x867e('0xf')](_0x867e('0x10'),_0x145eb4,_0x867e('0x11'));logger[_0x867e('0x12')](_0x867e('0x13'),_0x145eb4,'request\x20sent',JSON[_0x867e('0x14')](_0x4715a1));if(_0x4715a1[_0x867e('0x15')]){if(_0x4715a1[_0x867e('0x15')][_0x867e('0x16')]===0x1f4){logger[_0x867e('0x15')](_0x867e('0x10'),_0x145eb4,_0x4715a1['error']['message']);return _0x302300(_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);}logger['error'](_0x867e('0x10'),_0x145eb4,_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);return _0x2856ad(_0x4715a1[_0x867e('0x15')][_0x867e('0x17')]);}else{logger[_0x867e('0xf')](_0x867e('0x10'),_0x145eb4,_0x867e('0x11'));_0x2856ad(_0x4715a1[_0x867e('0x18')]['message']);}})[_0x867e('0x19')](function(_0x24d2f9){logger[_0x867e('0x15')](_0x867e('0x10'),_0x145eb4,_0x24d2f9);_0x302300(_0x24d2f9);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 518b5d3..0873912 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 _0x9f7c=['../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','/:id','show','/:id/sessions','isAuthenticated','/:id/answers','getAnswers','30s','post','clone','update','destroy','exports','multer','util','Router','fs-extra'];(function(_0x574c87,_0x202e0a){var _0x570782=function(_0x581cd5){while(--_0x581cd5){_0x574c87['push'](_0x574c87['shift']());}};_0x570782(++_0x202e0a);}(_0x9f7c,0x9c));var _0xc9f7=function(_0x241e26,_0x34bebd){_0x241e26=_0x241e26-0x0;var _0x524c17=_0x9f7c[_0x241e26];return _0x524c17;};'use strict';var multer=require(_0xc9f7('0x0'));var util=require(_0xc9f7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc9f7('0x2')]();var fs_extra=require(_0xc9f7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc9f7('0x4'));var config=require(_0xc9f7('0x5'));var controller=require(_0xc9f7('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc9f7('0x7')](_0xc9f7('0x8'),auth['isAuthenticated'](),controller[_0xc9f7('0x9')]);router[_0xc9f7('0x7')](_0xc9f7('0xa'),auth[_0xc9f7('0xb')](),controller['getSessions']);router['get'](_0xc9f7('0xc'),auth[_0xc9f7('0xb')](),controller[_0xc9f7('0xd')]);router[_0xc9f7('0x7')]('/:id/summary',auth[_0xc9f7('0xb')](),timeout(_0xc9f7('0xe')),controller['getSummary']);router[_0xc9f7('0xf')]('/',auth[_0xc9f7('0xb')](),controller['create']);router[_0xc9f7('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0xc9f7('0x10')]);router['put'](_0xc9f7('0x8'),auth[_0xc9f7('0xb')](),controller[_0xc9f7('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc9f7('0x12')]);module[_0xc9f7('0x13')]=router; \ No newline at end of file +var _0x25c1=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','post','/:id/clone'];(function(_0x25bb48,_0x5cb0fb){var _0x334b77=function(_0x2898fa){while(--_0x2898fa){_0x25bb48['push'](_0x25bb48['shift']());}};_0x334b77(++_0x5cb0fb);}(_0x25c1,0x82));var _0x125c=function(_0x3f8cda,_0x4759b4){_0x3f8cda=_0x3f8cda-0x0;var _0x3bb502=_0x25c1[_0x3f8cda];return _0x3bb502;};'use strict';var multer=require(_0x125c('0x0'));var util=require('util');var path=require(_0x125c('0x1'));var timeout=require(_0x125c('0x2'));var express=require(_0x125c('0x3'));var router=express['Router']();var fs_extra=require(_0x125c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x125c('0x5'));var controller=require(_0x125c('0x6'));router[_0x125c('0x7')]('/',auth['isAuthenticated'](),controller[_0x125c('0x8')]);router['get'](_0x125c('0x9'),auth[_0x125c('0xa')](),controller[_0x125c('0xb')]);router[_0x125c('0x7')]('/:id/sessions',auth[_0x125c('0xa')](),controller[_0x125c('0xc')]);router[_0x125c('0x7')](_0x125c('0xd'),auth['isAuthenticated'](),controller[_0x125c('0xe')]);router[_0x125c('0x7')](_0x125c('0xf'),auth[_0x125c('0xa')](),timeout(_0x125c('0x10')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x125c('0x11')]);router[_0x125c('0x12')](_0x125c('0x13'),auth[_0x125c('0xa')](),controller['clone']);router[_0x125c('0x14')](_0x125c('0x9'),auth[_0x125c('0xa')](),controller[_0x125c('0x15')]);router[_0x125c('0x16')]('/:id',auth[_0x125c('0xa')](),controller[_0x125c('0x17')]);module[_0x125c('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index a54fb28..98d77ab 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 _0x92ba=['getDataValue','BOOLEAN','sequelize','lodash','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x4bf0c0,_0x4051de){var _0x47816c=function(_0x56bf74){while(--_0x56bf74){_0x4bf0c0['push'](_0x4bf0c0['shift']());}};_0x47816c(++_0x4051de);}(_0x92ba,0x1ec));var _0xa92b=function(_0x315eb6,_0x54871e){_0x315eb6=_0x315eb6-0x0;var _0x457da3=_0x92ba[_0x315eb6];return _0x457da3;};'use strict';var Sequelize=require(_0xa92b('0x0'));var _=require(_0xa92b('0x1'));var util=require('util');module['exports']={'name':{'type':Sequelize[_0xa92b('0x2')],'unique':_0xa92b('0x3')},'description':{'type':Sequelize[_0xa92b('0x2')]},'formData':{'type':Sequelize[_0xa92b('0x4')](_0xa92b('0x5')),'set':function(_0x22860c){if(_[_0xa92b('0x6')](_0x22860c)){this[_0xa92b('0x7')](_0xa92b('0x8'),JSON[_0xa92b('0x9')](_0x22860c));}else if(_['isString'](_0x22860c)){this[_0xa92b('0x7')](_0xa92b('0x8'),_0x22860c);}else{this['setDataValue'](_0xa92b('0x8'),util[_0xa92b('0xa')](_0xa92b('0xb'),this[_0xa92b('0xc')](_0xa92b('0x3'))||'',this[_0xa92b('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xa92b('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xa92b('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x7554=['formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','STRING','name','TEXT','long','isObjectLike','setDataValue'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7554,0xe8));var _0x4755=function(_0x261cfd,_0xaa8005){_0x261cfd=_0x261cfd-0x0;var _0x17659c=_0x7554[_0x261cfd];return _0x17659c;};'use strict';var Sequelize=require(_0x4755('0x0'));var _=require('lodash');var util=require(_0x4755('0x1'));module['exports']={'name':{'type':Sequelize[_0x4755('0x2')],'unique':_0x4755('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x4755('0x4')](_0x4755('0x5')),'set':function(_0x3515d2){if(_[_0x4755('0x6')](_0x3515d2)){this[_0x4755('0x7')](_0x4755('0x8'),JSON[_0x4755('0x9')](_0x3515d2));}else if(_[_0x4755('0xa')](_0x3515d2)){this['setDataValue']('formData',_0x3515d2);}else{this[_0x4755('0x7')](_0x4755('0x8'),util[_0x4755('0xb')](_0x4755('0xc'),this[_0x4755('0xd')]('name')||'',this[_0x4755('0xd')](_0x4755('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x4755('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x4755('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 9b234a2..7e7f944 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 _0x3f9b=['params','keys','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getSessions','findOne','JscriptySessionReport','nolimit','order','ProjectId','findAll','getAnswers','JscriptyAnswerReport','number','apply','toString','indexOf','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','zip-dir','request-promise','moment','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','get','Projects','error','stack','name','send','index','map','fieldName','type','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','filters','pick','filter','where','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','show'];(function(_0x207276,_0xc044fa){var _0x238d1e=function(_0x3b88f7){while(--_0x3b88f7){_0x207276['push'](_0x207276['shift']());}};_0x238d1e(++_0xc044fa);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x2e10df,_0x20494d){_0x2e10df=_0x2e10df-0x0;var _0x200d43=_0x3f9b[_0x2e10df];return _0x200d43;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb3f9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb3f9('0x1'));var moment=require(_0xb3f9('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb3f9('0x3'));var sox=require(_0xb3f9('0x4'));var csv=require(_0xb3f9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3f9('0x6'));var _=require(_0xb3f9('0x7'));var squel=require(_0xb3f9('0x8'));var crypto=require(_0xb3f9('0x9'));var jsforce=require(_0xb3f9('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3f9('0xb'));var Papa=require(_0xb3f9('0xc'));var Redis=require('ioredis');var authService=require(_0xb3f9('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb3f9('0xe'));var logger=require(_0xb3f9('0xf'))(_0xb3f9('0x10'));var utils=require(_0xb3f9('0x11'));var config=require(_0xb3f9('0x12'));var licenseUtil=require(_0xb3f9('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1cdce2,_0xbbc1cb){_0xbbc1cb=_0xbbc1cb||0xcc;return function(_0x395561){if(_0x395561){return _0x1cdce2[_0xb3f9('0x14')](_0xbbc1cb);}return _0x1cdce2[_0xb3f9('0x15')](_0xbbc1cb)[_0xb3f9('0x16')]();};}function respondWithResult(_0x36c56c,_0x67f3ee){_0x67f3ee=_0x67f3ee||0xc8;return function(_0x590d44){if(_0x590d44){return _0x36c56c[_0xb3f9('0x15')](_0x67f3ee)['json'](_0x590d44);}};}function respondWithFilteredResult(_0x55256c,_0x214c4b){return function(_0x86b55c){if(_0x86b55c){var _0x171378=typeof _0x214c4b[_0xb3f9('0x17')]===_0xb3f9('0x18')&&typeof _0x214c4b[_0xb3f9('0x19')]===_0xb3f9('0x18');var _0x3f89e5=_0x86b55c['count'];var _0x2c69d4=_0x171378?0x0:_0x214c4b['offset'];var _0x5e7e42=_0x171378?_0x86b55c[_0xb3f9('0x1a')]:_0x214c4b['offset']+_0x214c4b[_0xb3f9('0x19')];var _0x33cf23;if(_0x5e7e42>=_0x3f89e5){_0x5e7e42=_0x3f89e5;_0x33cf23=0xc8;}else{_0x33cf23=0xce;}_0x55256c[_0xb3f9('0x15')](_0x33cf23);return _0x55256c[_0xb3f9('0x1b')](_0xb3f9('0x1c'),_0x2c69d4+'-'+_0x5e7e42+'/'+_0x3f89e5)[_0xb3f9('0x1d')](_0x86b55c);}return null;};}function patchUpdates(_0x4b7da0){return function(_0x51b607){try{jsonpatch['apply'](_0x51b607,_0x4b7da0,!![]);}catch(_0xb17d2e){return BPromise[_0xb3f9('0x1e')](_0xb17d2e);}return _0x51b607[_0xb3f9('0x1f')]();};}function saveUpdates(_0x4bffc7,_0x53f664){return function(_0x3446ea){if(_0x3446ea){return _0x3446ea[_0xb3f9('0x20')](_0x4bffc7)[_0xb3f9('0x21')](function(_0x560077){return _0x560077;});}return null;};}function removeEntity(_0x3b8738,_0x503ba7){return function(_0x20e804){if(_0x20e804){return _0x20e804[_0xb3f9('0x22')]()[_0xb3f9('0x21')](function(){var _0x539f7a=_0x20e804[_0xb3f9('0x23')]({'plain':!![]});var _0x1ffd67=_0xb3f9('0x24');return db['UserProfileResource'][_0xb3f9('0x22')]({'where':{'type':_0x1ffd67,'resourceId':_0x539f7a['id']}})[_0xb3f9('0x21')](function(){return _0x20e804;});})['then'](function(){_0x3b8738[_0xb3f9('0x15')](0xcc)[_0xb3f9('0x16')]();});}};}function handleEntityNotFound(_0x138f3d,_0x2bcb3e){return function(_0x1f65df){if(!_0x1f65df){_0x138f3d['sendStatus'](0x194);}return _0x1f65df;};}function handleError(_0x73d0a3,_0x35912b){_0x35912b=_0x35912b||0x1f4;return function(_0x2939f8){logger[_0xb3f9('0x25')](_0x2939f8[_0xb3f9('0x26')]);if(_0x2939f8[_0xb3f9('0x27')]){delete _0x2939f8[_0xb3f9('0x27')];}_0x73d0a3[_0xb3f9('0x15')](_0x35912b)[_0xb3f9('0x28')](_0x2939f8);};}exports[_0xb3f9('0x29')]=function(_0x2752c5,_0xacbe01){var _0x3e990d={},_0x564977={},_0x5d7762={'count':0x0,'rows':[]};var _0x4ccacb=_[_0xb3f9('0x2a')](db['JscriptyProject']['rawAttributes'],function(_0x5c810c){return{'name':_0x5c810c[_0xb3f9('0x2b')],'type':_0x5c810c[_0xb3f9('0x2c')]['key']};});_0x564977[_0xb3f9('0x2d')]=_[_0xb3f9('0x2a')](_0x4ccacb,_0xb3f9('0x27'));_0x564977['query']=_['keys'](_0x2752c5[_0xb3f9('0x2e')]);_0x564977['filters']=_[_0xb3f9('0x2f')](_0x564977[_0xb3f9('0x2d')],_0x564977[_0xb3f9('0x2e')]);_0x3e990d['attributes']=_[_0xb3f9('0x2f')](_0x564977[_0xb3f9('0x2d')],qs[_0xb3f9('0x30')](_0x2752c5['query'][_0xb3f9('0x30')]));_0x3e990d[_0xb3f9('0x31')]=_0x3e990d['attributes'][_0xb3f9('0x32')]?_0x3e990d['attributes']:_0x564977['model'];if(!_0x2752c5[_0xb3f9('0x2e')][_0xb3f9('0x33')]('nolimit')){_0x3e990d['limit']=qs[_0xb3f9('0x19')](_0x2752c5['query'][_0xb3f9('0x19')]);_0x3e990d[_0xb3f9('0x17')]=qs[_0xb3f9('0x17')](_0x2752c5[_0xb3f9('0x2e')]['offset']);}_0x3e990d['order']=qs[_0xb3f9('0x34')](_0x2752c5['query'][_0xb3f9('0x34')]);_0x3e990d['where']=qs[_0xb3f9('0x35')](_[_0xb3f9('0x36')](_0x2752c5[_0xb3f9('0x2e')],_0x564977[_0xb3f9('0x35')]),_0x4ccacb);if(_0x2752c5[_0xb3f9('0x2e')][_0xb3f9('0x37')]){_0x3e990d[_0xb3f9('0x38')]=_[_0xb3f9('0x39')](_0x3e990d[_0xb3f9('0x38')],{'$or':_['map'](_0x4ccacb,function(_0x169b66){if(_0x169b66[_0xb3f9('0x2c')]!==_0xb3f9('0x3a')){var _0x912986={};_0x912986[_0x169b66[_0xb3f9('0x27')]]={'$like':'%'+_0x2752c5[_0xb3f9('0x2e')][_0xb3f9('0x37')]+'%'};return _0x912986;}})});}_0x3e990d=_['merge']({},_0x3e990d,_0x2752c5[_0xb3f9('0x3b')]);var _0x65a948={'where':_0x3e990d[_0xb3f9('0x38')]};return db[_0xb3f9('0x3c')][_0xb3f9('0x1a')](_0x65a948)[_0xb3f9('0x21')](function(_0x3388b7){_0x5d7762[_0xb3f9('0x1a')]=_0x3388b7;if(_0x2752c5['query'][_0xb3f9('0x3d')]){_0x3e990d[_0xb3f9('0x3e')]=[{'all':!![]}];}return db[_0xb3f9('0x3c')]['findAll'](_0x3e990d);})[_0xb3f9('0x21')](function(_0x25d4e7){_0x5d7762[_0xb3f9('0x3f')]=_0x25d4e7;return _0x5d7762;})[_0xb3f9('0x21')](respondWithFilteredResult(_0xacbe01,_0x3e990d))['catch'](handleError(_0xacbe01,null));};exports[_0xb3f9('0x40')]=function(_0x52fe89,_0x1f5616){var _0x81235c={'raw':![],'where':{'id':_0x52fe89[_0xb3f9('0x41')]['id']}},_0xbdc4eb={};_0xbdc4eb[_0xb3f9('0x2d')]=_[_0xb3f9('0x42')](db[_0xb3f9('0x3c')][_0xb3f9('0x43')]);_0xbdc4eb[_0xb3f9('0x2e')]=_['keys'](_0x52fe89['query']);_0xbdc4eb[_0xb3f9('0x35')]=_[_0xb3f9('0x2f')](_0xbdc4eb['model'],_0xbdc4eb[_0xb3f9('0x2e')]);_0x81235c[_0xb3f9('0x31')]=_[_0xb3f9('0x2f')](_0xbdc4eb['model'],qs[_0xb3f9('0x30')](_0x52fe89['query'][_0xb3f9('0x30')]));_0x81235c['attributes']=_0x81235c[_0xb3f9('0x31')][_0xb3f9('0x32')]?_0x81235c[_0xb3f9('0x31')]:_0xbdc4eb[_0xb3f9('0x2d')];if(_0x52fe89[_0xb3f9('0x2e')][_0xb3f9('0x3d')]){_0x81235c['include']=[{'all':!![]}];}_0x81235c=_[_0xb3f9('0x39')]({},_0x81235c,_0x52fe89[_0xb3f9('0x3b')]);return db[_0xb3f9('0x3c')][_0xb3f9('0x44')](_0x81235c)[_0xb3f9('0x21')](handleEntityNotFound(_0x1f5616,null))[_0xb3f9('0x21')](respondWithResult(_0x1f5616,null))[_0xb3f9('0x45')](handleError(_0x1f5616,null));};exports[_0xb3f9('0x46')]=function(_0x245ddd,_0x5d0e91){return db[_0xb3f9('0x3c')][_0xb3f9('0x46')](_0x245ddd[_0xb3f9('0x47')],{})['then'](function(_0x1715af){var _0x555e29=_0x245ddd[_0xb3f9('0x48')][_0xb3f9('0x23')]({'plain':!![]});if(!_0x555e29)throw new Error(_0xb3f9('0x49'));if(_0x555e29[_0xb3f9('0x4a')]==='user'){var _0x184f7b=_0x1715af[_0xb3f9('0x23')]({'plain':!![]});var _0x2a3a6b=_0xb3f9('0x24');return db[_0xb3f9('0x4b')]['find']({'where':{'name':_0x2a3a6b,'userProfileId':_0x555e29[_0xb3f9('0x4c')]},'raw':!![]})[_0xb3f9('0x21')](function(_0x254846){if(_0x254846&&_0x254846[_0xb3f9('0x4d')]===0x0){return db[_0xb3f9('0x4e')][_0xb3f9('0x46')]({'name':_0x184f7b[_0xb3f9('0x27')],'resourceId':_0x184f7b['id'],'type':_0x254846['name'],'sectionId':_0x254846['id']},{})[_0xb3f9('0x21')](function(){return _0x1715af;});}else{return _0x1715af;}})[_0xb3f9('0x45')](function(_0x136362){logger[_0xb3f9('0x25')](_0xb3f9('0x4f'),_0x136362);throw _0x136362;});}return _0x1715af;})['then'](respondWithResult(_0x5d0e91,0xc9))[_0xb3f9('0x45')](handleError(_0x5d0e91,null));};exports[_0xb3f9('0x50')]=function(_0x30579e,_0x1214ce){var _0x565513={'where':{'id':_0x30579e[_0xb3f9('0x41')]['id']}},_0x3fa7b0={};_0x3fa7b0[_0xb3f9('0x2d')]=_['keys'](db[_0xb3f9('0x3c')][_0xb3f9('0x43')]);_0x565513[_0xb3f9('0x31')]=_[_0xb3f9('0x2f')](_0x3fa7b0[_0xb3f9('0x2d')],qs[_0xb3f9('0x30')](_0x30579e[_0xb3f9('0x2e')][_0xb3f9('0x30')]));_0x565513[_0xb3f9('0x31')]=_0x565513[_0xb3f9('0x31')][_0xb3f9('0x32')]?_0x565513[_0xb3f9('0x31')]:_0x3fa7b0[_0xb3f9('0x2d')];if(_0x30579e[_0xb3f9('0x2e')]['includeAll']){_0x565513[_0xb3f9('0x3e')]=[{'all':!![]}];}_0x565513=_[_0xb3f9('0x39')]({},_0x565513,_0x30579e[_0xb3f9('0x3b')]);return db[_0xb3f9('0x3c')][_0xb3f9('0x44')](_0x565513)[_0xb3f9('0x21')](handleEntityNotFound(_0x1214ce,null))[_0xb3f9('0x21')](function(_0x5a8bfb){if(_0x5a8bfb){var _0x165840=_0x5a8bfb[_0xb3f9('0x23')]({'plain':!![]});_0x165840=qs[_0xb3f9('0x51')](_0x165840,['id',_0xb3f9('0x52'),_0xb3f9('0x53')]);_0x30579e['body']=_[_0xb3f9('0x51')](_0x30579e['body'],['id',_0xb3f9('0x52'),_0xb3f9('0x53')]);return db[_0xb3f9('0x3c')][_0xb3f9('0x46')](_[_0xb3f9('0x39')](_0x165840,_0x30579e[_0xb3f9('0x47')]),{'include':_0x30579e['query'][_0xb3f9('0x3d')]?[{'all':!![]}]:undefined})['then'](function(_0x23a3b6){var _0x3e3775=_0x30579e[_0xb3f9('0x48')][_0xb3f9('0x23')]({'plain':!![]});if(!_0x3e3775)throw new Error(_0xb3f9('0x49'));if(_0x3e3775[_0xb3f9('0x4a')]===_0xb3f9('0x48')){var _0x4c7335=_0x23a3b6[_0xb3f9('0x23')]({'plain':!![]});var _0x20f128=_0xb3f9('0x24');return db['UserProfileSection'][_0xb3f9('0x44')]({'where':{'name':_0x20f128,'userProfileId':_0x3e3775[_0xb3f9('0x4c')]},'raw':!![]})[_0xb3f9('0x21')](function(_0x2d287b){if(_0x2d287b&&_0x2d287b[_0xb3f9('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x4c7335[_0xb3f9('0x27')],'resourceId':_0x4c7335['id'],'type':_0x2d287b['name'],'sectionId':_0x2d287b['id']},{})['then'](function(){return _0x23a3b6;});}else{return _0x23a3b6;}})[_0xb3f9('0x45')](function(_0x552032){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x552032);throw _0x552032;});}return _0x23a3b6;});}})[_0xb3f9('0x21')](respondWithResult(_0x1214ce,0xc9))['catch'](handleError(_0x1214ce,null));};exports['update']=function(_0x533597,_0x5bd7af){if(_0x533597['body']['id']){delete _0x533597[_0xb3f9('0x47')]['id'];}return db['JscriptyProject'][_0xb3f9('0x44')]({'where':{'id':_0x533597[_0xb3f9('0x41')]['id']}})['then'](handleEntityNotFound(_0x5bd7af,null))[_0xb3f9('0x21')](saveUpdates(_0x533597['body'],null))[_0xb3f9('0x21')](respondWithResult(_0x5bd7af,null))[_0xb3f9('0x45')](handleError(_0x5bd7af,null));};exports[_0xb3f9('0x22')]=function(_0x1e8135,_0x199077){return db['JscriptyProject'][_0xb3f9('0x44')]({'where':{'id':_0x1e8135['params']['id']}})[_0xb3f9('0x21')](handleEntityNotFound(_0x199077,null))['then'](removeEntity(_0x199077,null))[_0xb3f9('0x45')](handleError(_0x199077,null));};exports[_0xb3f9('0x54')]=function(_0x2af8a5,_0x3d01e6,_0x4c0ac8){var _0x440c6e={'raw':!![],'where':{}};var _0x334e72={};var _0xd32eff={'count':0x0,'rows':[]};return db[_0xb3f9('0x3c')][_0xb3f9('0x55')]({'where':{'id':_0x2af8a5['params']['id']}})[_0xb3f9('0x21')](handleEntityNotFound(_0x3d01e6,null))['then'](function(_0x14c39c){if(_0x14c39c){_0x334e72['model']=_[_0xb3f9('0x42')](db[_0xb3f9('0x56')][_0xb3f9('0x43')]);_0x334e72[_0xb3f9('0x2e')]=_[_0xb3f9('0x42')](_0x2af8a5[_0xb3f9('0x2e')]);_0x334e72[_0xb3f9('0x35')]=_[_0xb3f9('0x2f')](_0x334e72['model'],_0x334e72[_0xb3f9('0x2e')]);_0x440c6e[_0xb3f9('0x31')]=_['intersection'](_0x334e72['model'],qs['fields'](_0x2af8a5[_0xb3f9('0x2e')][_0xb3f9('0x30')]));_0x440c6e['attributes']=_0x440c6e[_0xb3f9('0x31')]['length']?_0x440c6e['attributes']:_0x334e72[_0xb3f9('0x2d')];if(!_0x2af8a5[_0xb3f9('0x2e')]['hasOwnProperty'](_0xb3f9('0x57'))){_0x440c6e[_0xb3f9('0x19')]=qs[_0xb3f9('0x19')](_0x2af8a5[_0xb3f9('0x2e')][_0xb3f9('0x19')]);_0x440c6e[_0xb3f9('0x17')]=qs[_0xb3f9('0x17')](_0x2af8a5[_0xb3f9('0x2e')]['offset']);}_0x440c6e[_0xb3f9('0x58')]=qs[_0xb3f9('0x34')](_0x2af8a5['query'][_0xb3f9('0x34')]);_0x440c6e[_0xb3f9('0x38')]=qs[_0xb3f9('0x35')](_[_0xb3f9('0x36')](_0x2af8a5['query'],_0x334e72[_0xb3f9('0x35')]));_0x440c6e[_0xb3f9('0x38')][_0xb3f9('0x59')]=_0x14c39c['id'];if(_0x2af8a5[_0xb3f9('0x2e')][_0xb3f9('0x37')]){_0x440c6e[_0xb3f9('0x38')]=_[_0xb3f9('0x39')](_0x440c6e['where'],{'$or':_[_0xb3f9('0x2a')](_0x440c6e['attributes'],function(_0x5840d4){var _0x1b08be={};_0x1b08be[_0x5840d4]={'$like':'%'+_0x2af8a5[_0xb3f9('0x2e')][_0xb3f9('0x37')]+'%'};return _0x1b08be;})});}_0x440c6e=_[_0xb3f9('0x39')]({},_0x440c6e,_0x2af8a5[_0xb3f9('0x3b')]);return db[_0xb3f9('0x56')][_0xb3f9('0x1a')]({'where':_0x440c6e['where']})[_0xb3f9('0x21')](function(_0x24d0ab){_0xd32eff[_0xb3f9('0x1a')]=_0x24d0ab;if(_0x2af8a5['query']['includeAll']){_0x440c6e[_0xb3f9('0x3e')]=[{'all':!![]}];}return db[_0xb3f9('0x56')][_0xb3f9('0x5a')](_0x440c6e);})['then'](function(_0x32fd02){_0xd32eff[_0xb3f9('0x3f')]=_0x32fd02;return _0xd32eff;});}})[_0xb3f9('0x21')](respondWithFilteredResult(_0x3d01e6,_0x440c6e))[_0xb3f9('0x45')](handleError(_0x3d01e6,null));};exports[_0xb3f9('0x5b')]=function(_0x3c1ac5,_0x49d328,_0x46da75){var _0x42035d={'raw':!![],'where':{}};var _0xb589a2={};var _0x35b3f2={'count':0x0,'rows':[]};return db[_0xb3f9('0x3c')][_0xb3f9('0x55')]({'where':{'id':_0x3c1ac5[_0xb3f9('0x41')]['id']}})[_0xb3f9('0x21')](handleEntityNotFound(_0x49d328,null))[_0xb3f9('0x21')](function(_0x17d689){if(_0x17d689){_0xb589a2[_0xb3f9('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xb3f9('0x43')]);_0xb589a2[_0xb3f9('0x2e')]=_[_0xb3f9('0x42')](_0x3c1ac5['query']);_0xb589a2['filters']=_['intersection'](_0xb589a2[_0xb3f9('0x2d')],_0xb589a2[_0xb3f9('0x2e')]);_0x42035d['attributes']=_[_0xb3f9('0x2f')](_0xb589a2['model'],qs[_0xb3f9('0x30')](_0x3c1ac5[_0xb3f9('0x2e')]['fields']));_0x42035d[_0xb3f9('0x31')]=_0x42035d[_0xb3f9('0x31')][_0xb3f9('0x32')]?_0x42035d[_0xb3f9('0x31')]:_0xb589a2['model'];if(!_0x3c1ac5[_0xb3f9('0x2e')][_0xb3f9('0x33')]('nolimit')){_0x42035d[_0xb3f9('0x19')]=qs[_0xb3f9('0x19')](_0x3c1ac5['query'][_0xb3f9('0x19')]);_0x42035d[_0xb3f9('0x17')]=qs['offset'](_0x3c1ac5['query'][_0xb3f9('0x17')]);}_0x42035d[_0xb3f9('0x58')]=qs['sort'](_0x3c1ac5[_0xb3f9('0x2e')]['sort']);_0x42035d['where']=qs[_0xb3f9('0x35')](_[_0xb3f9('0x36')](_0x3c1ac5['query'],_0xb589a2[_0xb3f9('0x35')]));_0x42035d[_0xb3f9('0x38')][_0xb3f9('0x59')]=_0x17d689['id'];if(_0x3c1ac5['query'][_0xb3f9('0x37')]){_0x42035d[_0xb3f9('0x38')]=_['merge'](_0x42035d[_0xb3f9('0x38')],{'$or':_[_0xb3f9('0x2a')](_0x42035d[_0xb3f9('0x31')],function(_0x1b936d){var _0x2ba530={};_0x2ba530[_0x1b936d]={'$like':'%'+_0x3c1ac5[_0xb3f9('0x2e')][_0xb3f9('0x37')]+'%'};return _0x2ba530;})});}_0x42035d=_['merge']({},_0x42035d,_0x3c1ac5[_0xb3f9('0x3b')]);return db[_0xb3f9('0x5c')][_0xb3f9('0x1a')]({'where':_0x42035d['where']})[_0xb3f9('0x21')](function(_0x3c81ad){_0x35b3f2[_0xb3f9('0x1a')]=_0x3c81ad;if(_0x3c1ac5[_0xb3f9('0x2e')][_0xb3f9('0x3d')]){_0x42035d[_0xb3f9('0x3e')]=[{'all':!![]}];}return db[_0xb3f9('0x5c')][_0xb3f9('0x5a')](_0x42035d);})[_0xb3f9('0x21')](function(_0x4ee843){_0x35b3f2[_0xb3f9('0x3f')]=_0x4ee843;return _0x35b3f2;});}})['then'](respondWithFilteredResult(_0x49d328,_0x42035d))[_0xb3f9('0x45')](handleError(_0x49d328,null));};function char(_0xfc60d2){return _0xb3f9('0x5d')===typeof _0xfc60d2?String['fromCharCode'][_0xb3f9('0x5e')](null,arguments):_0xfc60d2;}function needsEncapsulation(_0x2a4495){return!!_0x2a4495&&(_0x2a4495[_0xb3f9('0x5f')]()[_0xb3f9('0x60')](char(0xd))>=0x0||_0x2a4495[_0xb3f9('0x5f')]()['indexOf'](char(0xa))>=0x0||_0x2a4495[_0xb3f9('0x5f')]()['indexOf'](char(0x2c))>=0x0||_0x2a4495['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x3752ce){var _0x165b78=char(0x22),_0x23264a='\x5c'+char(0x22),_0x4f005d=_0x3752ce[_0xb3f9('0x5f')]()['replace'](new RegExp(_0x165b78,'g'),_0x23264a);return _0x165b78+_0x4f005d+_0x165b78;}exports['getSummary']=function(_0x3ff615,_0x4b9afd,_0x2ecf8a){var _0x20856a,_0xbceda5;var _0x1738b7={'where':{'ProjectId':_0x3ff615['params']['id']}};if(_0x3ff615[_0xb3f9('0x2e')][_0xb3f9('0x61')]){_0x1738b7[_0xb3f9('0x38')][_0xb3f9('0x62')]=JSON['parse'](_0x3ff615[_0xb3f9('0x2e')][_0xb3f9('0x61')]);}return db[_0xb3f9('0x56')][_0xb3f9('0x5a')](_0x1738b7)[_0xb3f9('0x21')](handleEntityNotFound(_0x4b9afd,null))[_0xb3f9('0x21')](function(_0x17d1e4){if(_0x17d1e4){_0x20856a=_0x17d1e4;return db[_0xb3f9('0x63')][_0xb3f9('0x5a')]({'where':{'SessionId':{'$in':_[_0xb3f9('0x2a')](_0x20856a,'id')},'ProjectId':_0x3ff615[_0xb3f9('0x41')]['id']},'order':_0xb3f9('0x64')});}})[_0xb3f9('0x21')](handleEntityNotFound(_0x4b9afd,null))[_0xb3f9('0x21')](function(_0x45108d){if(_0x45108d){_0xbceda5=_0x45108d;var _0x337784={};for(var _0x1043c6=0x0,_0x36da53=_0xbceda5[_0xb3f9('0x32')];_0x1043c6<_0x36da53;_0x1043c6++){if(!_0x337784['hasOwnProperty'](_0xbceda5[_0x1043c6][_0xb3f9('0x65')])){_0x337784[_0xbceda5[_0x1043c6][_0xb3f9('0x65')]]=needsEncapsulation(_0xbceda5[_0x1043c6][_0xb3f9('0x66')])?encapsulate(_0xbceda5[_0x1043c6][_0xb3f9('0x66')]):_0xbceda5[_0x1043c6][_0xb3f9('0x66')];}}var _0x483b34=[],_0x4b4d95={};for(var _0x166867=0x0,_0x5a3e41=_0x20856a['length'];_0x166867<_0x5a3e41;_0x166867++){_0x4b4d95={'ProjectId':_0x3ff615['params']['id'],'SessionId':_0x20856a[_0x166867]['id'],'StartTime':moment(_0x20856a[_0x166867][_0xb3f9('0x62')])[_0xb3f9('0x67')](_0xb3f9('0x68'))};for(var _0x9f4382=0x0,_0xcbdb52=_0xbceda5['length'];_0x9f4382<_0xcbdb52;_0x9f4382++){if(_0xbceda5[_0x9f4382]['SessionId']==_0x20856a[_0x166867]['id']&&_0x337784[_0xb3f9('0x33')](_0xbceda5[_0x9f4382][_0xb3f9('0x65')])){_0x4b4d95[_0x337784[_0xbceda5[_0x9f4382]['questionId']]]=_0xbceda5[_0x9f4382][_0xb3f9('0x69')];}}for(var _0x4a0d83 in _0x337784){if(!_0x4b4d95[_0xb3f9('0x33')](_0x337784[_0x4a0d83])){_0x4b4d95[_0x337784[_0x4a0d83]]=null;}}_0x483b34[_0xb3f9('0x6a')](_0x4b4d95);}return _0x483b34;}})[_0xb3f9('0x21')](function(_0x30a07b){if(!_[_0xb3f9('0x6b')](_0x30a07b)){var _0x3d24f5=toCsv(_0x30a07b);var _0x28c291=Date[_0xb3f9('0x6c')]();fs[_0xb3f9('0x6d')](util[_0xb3f9('0x67')](_0xb3f9('0x6e'),_0x3ff615[_0xb3f9('0x41')]['id'],_0x28c291),_0x3d24f5);_0x4b9afd[_0xb3f9('0x6f')](_0xb3f9('0x70'),_0xb3f9('0x71')+util[_0xb3f9('0x67')](_0xb3f9('0x72'),_0x3ff615[_0xb3f9('0x41')]['id'],_0x28c291));_0x4b9afd[_0xb3f9('0x6f')]('Content-type',_0xb3f9('0x73'));return _0x4b9afd[_0xb3f9('0x74')](util[_0xb3f9('0x67')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x3ff615[_0xb3f9('0x41')]['id'],_0x28c291));}else{return _0x4b9afd[_0xb3f9('0x14')](0xcc);}})['catch'](handleError(_0x4b9afd,null));}; \ No newline at end of file +var _0xd61e=['json','offset','undefined','limit','count','Content-Range','apply','save','then','destroy','error','name','send','index','map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','JscriptyProject','findAll','catch','show','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Projects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','length','omit','createdAt','updatedAt','userProfileId','UserProfileResource','update','getSessions','findOne','JscriptySessionReport','rawAttributes','ProjectId','rows','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','sendStatus','end','status'];(function(_0x4884d0,_0x146487){var _0x3ef057=function(_0x49c35a){while(--_0x49c35a){_0x4884d0['push'](_0x4884d0['shift']());}};_0x3ef057(++_0x146487);}(_0xd61e,0x13d));var _0xed61=function(_0x56159f,_0x8cf14f){_0x56159f=_0x56159f-0x0;var _0x323502=_0xd61e[_0x56159f];return _0x323502;};'use strict';var emlformat=require(_0xed61('0x0'));var rimraf=require(_0xed61('0x1'));var zipdir=require(_0xed61('0x2'));var jsonpatch=require(_0xed61('0x3'));var rp=require(_0xed61('0x4'));var moment=require(_0xed61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xed61('0x6'));var util=require(_0xed61('0x7'));var path=require(_0xed61('0x8'));var sox=require(_0xed61('0x9'));var csv=require(_0xed61('0xa'));var ejs=require(_0xed61('0xb'));var fs=require('fs');var fs_extra=require(_0xed61('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xed61('0xa'));var querystring=require(_0xed61('0xd'));var Papa=require(_0xed61('0xe'));var Redis=require(_0xed61('0xf'));var authService=require(_0xed61('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xed61('0x11'))(_0xed61('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xeedb63,_0x21511d){_0x21511d=_0x21511d||0xcc;return function(_0x19c74c){if(_0x19c74c){return _0xeedb63[_0xed61('0x13')](_0x21511d);}return _0xeedb63['status'](_0x21511d)[_0xed61('0x14')]();};}function respondWithResult(_0x28f4cb,_0xe08d33){_0xe08d33=_0xe08d33||0xc8;return function(_0x4ac6e2){if(_0x4ac6e2){return _0x28f4cb[_0xed61('0x15')](_0xe08d33)[_0xed61('0x16')](_0x4ac6e2);}};}function respondWithFilteredResult(_0x16fa20,_0x2ad52a){return function(_0x4d3930){if(_0x4d3930){var _0x15198a=typeof _0x2ad52a[_0xed61('0x17')]===_0xed61('0x18')&&typeof _0x2ad52a[_0xed61('0x19')]==='undefined';var _0x39b1d1=_0x4d3930[_0xed61('0x1a')];var _0x4bd841=_0x15198a?0x0:_0x2ad52a[_0xed61('0x17')];var _0x11a277=_0x15198a?_0x4d3930[_0xed61('0x1a')]:_0x2ad52a['offset']+_0x2ad52a[_0xed61('0x19')];var _0xb7879f;if(_0x11a277>=_0x39b1d1){_0x11a277=_0x39b1d1;_0xb7879f=0xc8;}else{_0xb7879f=0xce;}_0x16fa20[_0xed61('0x15')](_0xb7879f);return _0x16fa20['set'](_0xed61('0x1b'),_0x4bd841+'-'+_0x11a277+'/'+_0x39b1d1)[_0xed61('0x16')](_0x4d3930);}return null;};}function patchUpdates(_0xce408c){return function(_0x5ee0b9){try{jsonpatch[_0xed61('0x1c')](_0x5ee0b9,_0xce408c,!![]);}catch(_0x16d63a){return BPromise['reject'](_0x16d63a);}return _0x5ee0b9[_0xed61('0x1d')]();};}function saveUpdates(_0x315020,_0x864dfa){return function(_0x5f3d0f){if(_0x5f3d0f){return _0x5f3d0f['update'](_0x315020)[_0xed61('0x1e')](function(_0x544d49){return _0x544d49;});}return null;};}function removeEntity(_0xa17a06,_0x217e93){return function(_0x2722d0){if(_0x2722d0){return _0x2722d0[_0xed61('0x1f')]()[_0xed61('0x1e')](function(){var _0x5a71f0=_0x2722d0['get']({'plain':!![]});var _0x4a3e02='Projects';return db['UserProfileResource'][_0xed61('0x1f')]({'where':{'type':_0x4a3e02,'resourceId':_0x5a71f0['id']}})['then'](function(){return _0x2722d0;});})[_0xed61('0x1e')](function(){_0xa17a06[_0xed61('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x503bc7,_0x14d140){return function(_0xca7c0c){if(!_0xca7c0c){_0x503bc7[_0xed61('0x13')](0x194);}return _0xca7c0c;};}function handleError(_0x5b83b2,_0x20de9b){_0x20de9b=_0x20de9b||0x1f4;return function(_0xd809ce){logger[_0xed61('0x20')](_0xd809ce['stack']);if(_0xd809ce[_0xed61('0x21')]){delete _0xd809ce['name'];}_0x5b83b2[_0xed61('0x15')](_0x20de9b)[_0xed61('0x22')](_0xd809ce);};}exports[_0xed61('0x23')]=function(_0x50b19d,_0x260ac4){var _0xa5a8aa={},_0x2f23d5={},_0x690795={'count':0x0,'rows':[]};var _0x4b1294=_[_0xed61('0x24')](db['JscriptyProject']['rawAttributes'],function(_0x2df5b6){return{'name':_0x2df5b6[_0xed61('0x25')],'type':_0x2df5b6[_0xed61('0x26')][_0xed61('0x27')]};});_0x2f23d5['model']=_['map'](_0x4b1294,_0xed61('0x21'));_0x2f23d5[_0xed61('0x28')]=_[_0xed61('0x29')](_0x50b19d[_0xed61('0x28')]);_0x2f23d5[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x2f23d5[_0xed61('0x2c')],_0x2f23d5['query']);_0xa5a8aa['attributes']=_[_0xed61('0x2b')](_0x2f23d5['model'],qs[_0xed61('0x2d')](_0x50b19d['query']['fields']));_0xa5a8aa['attributes']=_0xa5a8aa['attributes']['length']?_0xa5a8aa[_0xed61('0x2e')]:_0x2f23d5[_0xed61('0x2c')];if(!_0x50b19d[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0xa5a8aa[_0xed61('0x19')]=qs[_0xed61('0x19')](_0x50b19d[_0xed61('0x28')]['limit']);_0xa5a8aa['offset']=qs[_0xed61('0x17')](_0x50b19d[_0xed61('0x28')][_0xed61('0x17')]);}_0xa5a8aa[_0xed61('0x31')]=qs['sort'](_0x50b19d[_0xed61('0x28')][_0xed61('0x32')]);_0xa5a8aa['where']=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x50b19d[_0xed61('0x28')],_0x2f23d5[_0xed61('0x2a')]),_0x4b1294);if(_0x50b19d['query'][_0xed61('0x34')]){_0xa5a8aa[_0xed61('0x35')]=_[_0xed61('0x36')](_0xa5a8aa[_0xed61('0x35')],{'$or':_[_0xed61('0x24')](_0x4b1294,function(_0x23d66d){if(_0x23d66d[_0xed61('0x26')]!=='VIRTUAL'){var _0x3abfa6={};_0x3abfa6[_0x23d66d[_0xed61('0x21')]]={'$like':'%'+_0x50b19d[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x3abfa6;}})});}_0xa5a8aa=_[_0xed61('0x36')]({},_0xa5a8aa,_0x50b19d[_0xed61('0x37')]);var _0x35ad22={'where':_0xa5a8aa[_0xed61('0x35')]};return db[_0xed61('0x38')][_0xed61('0x1a')](_0x35ad22)[_0xed61('0x1e')](function(_0x16720e){_0x690795[_0xed61('0x1a')]=_0x16720e;if(_0x50b19d[_0xed61('0x28')]['includeAll']){_0xa5a8aa['include']=[{'all':!![]}];}return db[_0xed61('0x38')][_0xed61('0x39')](_0xa5a8aa);})['then'](function(_0x5b9bef){_0x690795['rows']=_0x5b9bef;return _0x690795;})['then'](respondWithFilteredResult(_0x260ac4,_0xa5a8aa))[_0xed61('0x3a')](handleError(_0x260ac4,null));};exports[_0xed61('0x3b')]=function(_0xd92795,_0x16ac3f){var _0x434384={'raw':![],'where':{'id':_0xd92795['params']['id']}},_0x41e094={};_0x41e094[_0xed61('0x2c')]=_[_0xed61('0x29')](db[_0xed61('0x38')]['rawAttributes']);_0x41e094[_0xed61('0x28')]=_[_0xed61('0x29')](_0xd92795[_0xed61('0x28')]);_0x41e094[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x41e094['model'],_0x41e094['query']);_0x434384[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x41e094[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0xd92795['query'][_0xed61('0x2d')]));_0x434384[_0xed61('0x2e')]=_0x434384[_0xed61('0x2e')]['length']?_0x434384[_0xed61('0x2e')]:_0x41e094[_0xed61('0x2c')];if(_0xd92795['query'][_0xed61('0x3c')]){_0x434384[_0xed61('0x3d')]=[{'all':!![]}];}_0x434384=_[_0xed61('0x36')]({},_0x434384,_0xd92795[_0xed61('0x37')]);return db[_0xed61('0x38')][_0xed61('0x3e')](_0x434384)[_0xed61('0x1e')](handleEntityNotFound(_0x16ac3f,null))[_0xed61('0x1e')](respondWithResult(_0x16ac3f,null))[_0xed61('0x3a')](handleError(_0x16ac3f,null));};exports[_0xed61('0x3f')]=function(_0x2bf758,_0x3a6693){return db[_0xed61('0x38')][_0xed61('0x3f')](_0x2bf758[_0xed61('0x40')],{})[_0xed61('0x1e')](function(_0x38059f){var _0x43031b=_0x2bf758[_0xed61('0x41')][_0xed61('0x42')]({'plain':!![]});if(!_0x43031b)throw new Error(_0xed61('0x43'));if(_0x43031b[_0xed61('0x44')]===_0xed61('0x41')){var _0x4908f3=_0x38059f['get']({'plain':!![]});var _0x28950f=_0xed61('0x45');return db[_0xed61('0x46')][_0xed61('0x3e')]({'where':{'name':_0x28950f,'userProfileId':_0x43031b['userProfileId']},'raw':!![]})[_0xed61('0x1e')](function(_0x3ec791){if(_0x3ec791&&_0x3ec791[_0xed61('0x47')]===0x0){return db['UserProfileResource']['create']({'name':_0x4908f3['name'],'resourceId':_0x4908f3['id'],'type':_0x3ec791[_0xed61('0x21')],'sectionId':_0x3ec791['id']},{})[_0xed61('0x1e')](function(){return _0x38059f;});}else{return _0x38059f;}})[_0xed61('0x3a')](function(_0x1d3b9d){logger[_0xed61('0x20')](_0xed61('0x48'),_0x1d3b9d);throw _0x1d3b9d;});}return _0x38059f;})[_0xed61('0x1e')](respondWithResult(_0x3a6693,0xc9))[_0xed61('0x3a')](handleError(_0x3a6693,null));};exports['clone']=function(_0x2bb9b9,_0x258a40){var _0x4c1762={'where':{'id':_0x2bb9b9[_0xed61('0x49')]['id']}},_0x116eea={};_0x116eea[_0xed61('0x2c')]=_['keys'](db[_0xed61('0x38')]['rawAttributes']);_0x4c1762[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x116eea[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0x2bb9b9[_0xed61('0x28')][_0xed61('0x2d')]));_0x4c1762[_0xed61('0x2e')]=_0x4c1762['attributes'][_0xed61('0x4a')]?_0x4c1762[_0xed61('0x2e')]:_0x116eea[_0xed61('0x2c')];if(_0x2bb9b9[_0xed61('0x28')][_0xed61('0x3c')]){_0x4c1762[_0xed61('0x3d')]=[{'all':!![]}];}_0x4c1762=_['merge']({},_0x4c1762,_0x2bb9b9[_0xed61('0x37')]);return db['JscriptyProject'][_0xed61('0x3e')](_0x4c1762)['then'](handleEntityNotFound(_0x258a40,null))[_0xed61('0x1e')](function(_0x44588a){if(_0x44588a){var _0x591909=_0x44588a[_0xed61('0x42')]({'plain':!![]});_0x591909=qs[_0xed61('0x4b')](_0x591909,['id',_0xed61('0x4c'),_0xed61('0x4d')]);_0x2bb9b9[_0xed61('0x40')]=_['omit'](_0x2bb9b9[_0xed61('0x40')],['id',_0xed61('0x4c'),_0xed61('0x4d')]);return db[_0xed61('0x38')][_0xed61('0x3f')](_[_0xed61('0x36')](_0x591909,_0x2bb9b9[_0xed61('0x40')]),{'include':_0x2bb9b9['query']['includeAll']?[{'all':!![]}]:undefined})[_0xed61('0x1e')](function(_0x4729f3){var _0xcd868e=_0x2bb9b9[_0xed61('0x41')][_0xed61('0x42')]({'plain':!![]});if(!_0xcd868e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcd868e[_0xed61('0x44')]===_0xed61('0x41')){var _0x4efb8f=_0x4729f3['get']({'plain':!![]});var _0x22f3d1=_0xed61('0x45');return db[_0xed61('0x46')][_0xed61('0x3e')]({'where':{'name':_0x22f3d1,'userProfileId':_0xcd868e[_0xed61('0x4e')]},'raw':!![]})['then'](function(_0x55ef0b){if(_0x55ef0b&&_0x55ef0b[_0xed61('0x47')]===0x0){return db[_0xed61('0x4f')][_0xed61('0x3f')]({'name':_0x4efb8f[_0xed61('0x21')],'resourceId':_0x4efb8f['id'],'type':_0x55ef0b[_0xed61('0x21')],'sectionId':_0x55ef0b['id']},{})[_0xed61('0x1e')](function(){return _0x4729f3;});}else{return _0x4729f3;}})[_0xed61('0x3a')](function(_0x2882a0){logger[_0xed61('0x20')](_0xed61('0x48'),_0x2882a0);throw _0x2882a0;});}return _0x4729f3;});}})['then'](respondWithResult(_0x258a40,0xc9))[_0xed61('0x3a')](handleError(_0x258a40,null));};exports[_0xed61('0x50')]=function(_0x5aeffd,_0x298a12){if(_0x5aeffd[_0xed61('0x40')]['id']){delete _0x5aeffd[_0xed61('0x40')]['id'];}return db[_0xed61('0x38')][_0xed61('0x3e')]({'where':{'id':_0x5aeffd['params']['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x298a12,null))['then'](saveUpdates(_0x5aeffd['body'],null))[_0xed61('0x1e')](respondWithResult(_0x298a12,null))[_0xed61('0x3a')](handleError(_0x298a12,null));};exports[_0xed61('0x1f')]=function(_0x5e862d,_0x1dc280){return db[_0xed61('0x38')][_0xed61('0x3e')]({'where':{'id':_0x5e862d[_0xed61('0x49')]['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x1dc280,null))['then'](removeEntity(_0x1dc280,null))['catch'](handleError(_0x1dc280,null));};exports[_0xed61('0x51')]=function(_0x32f435,_0xb952c,_0x21ab9c){var _0x32db02={'raw':!![],'where':{}};var _0x5d5d15={};var _0xe89a4={'count':0x0,'rows':[]};return db[_0xed61('0x38')][_0xed61('0x52')]({'where':{'id':_0x32f435[_0xed61('0x49')]['id']}})['then'](handleEntityNotFound(_0xb952c,null))[_0xed61('0x1e')](function(_0x2efa4a){if(_0x2efa4a){_0x5d5d15['model']=_[_0xed61('0x29')](db[_0xed61('0x53')][_0xed61('0x54')]);_0x5d5d15[_0xed61('0x28')]=_[_0xed61('0x29')](_0x32f435[_0xed61('0x28')]);_0x5d5d15[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x5d5d15[_0xed61('0x2c')],_0x5d5d15[_0xed61('0x28')]);_0x32db02['attributes']=_['intersection'](_0x5d5d15[_0xed61('0x2c')],qs[_0xed61('0x2d')](_0x32f435[_0xed61('0x28')]['fields']));_0x32db02['attributes']=_0x32db02[_0xed61('0x2e')][_0xed61('0x4a')]?_0x32db02[_0xed61('0x2e')]:_0x5d5d15[_0xed61('0x2c')];if(!_0x32f435[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0x32db02[_0xed61('0x19')]=qs[_0xed61('0x19')](_0x32f435['query'][_0xed61('0x19')]);_0x32db02[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x32f435[_0xed61('0x28')][_0xed61('0x17')]);}_0x32db02[_0xed61('0x31')]=qs[_0xed61('0x32')](_0x32f435[_0xed61('0x28')]['sort']);_0x32db02[_0xed61('0x35')]=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x32f435[_0xed61('0x28')],_0x5d5d15[_0xed61('0x2a')]));_0x32db02[_0xed61('0x35')][_0xed61('0x55')]=_0x2efa4a['id'];if(_0x32f435[_0xed61('0x28')][_0xed61('0x34')]){_0x32db02[_0xed61('0x35')]=_[_0xed61('0x36')](_0x32db02[_0xed61('0x35')],{'$or':_[_0xed61('0x24')](_0x32db02[_0xed61('0x2e')],function(_0x11af28){var _0x56d2c2={};_0x56d2c2[_0x11af28]={'$like':'%'+_0x32f435[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x56d2c2;})});}_0x32db02=_[_0xed61('0x36')]({},_0x32db02,_0x32f435[_0xed61('0x37')]);return db[_0xed61('0x53')][_0xed61('0x1a')]({'where':_0x32db02['where']})[_0xed61('0x1e')](function(_0x2cfcad){_0xe89a4[_0xed61('0x1a')]=_0x2cfcad;if(_0x32f435[_0xed61('0x28')][_0xed61('0x3c')]){_0x32db02[_0xed61('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xed61('0x39')](_0x32db02);})['then'](function(_0x2a67f3){_0xe89a4[_0xed61('0x56')]=_0x2a67f3;return _0xe89a4;});}})[_0xed61('0x1e')](respondWithFilteredResult(_0xb952c,_0x32db02))['catch'](handleError(_0xb952c,null));};exports[_0xed61('0x57')]=function(_0x5f1c64,_0x4fe78d,_0x1b1140){var _0x1dc2a5={'raw':!![],'where':{}};var _0x2d2037={};var _0x3dfa42={'count':0x0,'rows':[]};return db[_0xed61('0x38')][_0xed61('0x52')]({'where':{'id':_0x5f1c64[_0xed61('0x49')]['id']}})[_0xed61('0x1e')](handleEntityNotFound(_0x4fe78d,null))[_0xed61('0x1e')](function(_0x23d06d){if(_0x23d06d){_0x2d2037[_0xed61('0x2c')]=_[_0xed61('0x29')](db[_0xed61('0x58')][_0xed61('0x54')]);_0x2d2037[_0xed61('0x28')]=_[_0xed61('0x29')](_0x5f1c64[_0xed61('0x28')]);_0x2d2037[_0xed61('0x2a')]=_[_0xed61('0x2b')](_0x2d2037[_0xed61('0x2c')],_0x2d2037[_0xed61('0x28')]);_0x1dc2a5[_0xed61('0x2e')]=_[_0xed61('0x2b')](_0x2d2037['model'],qs['fields'](_0x5f1c64['query'][_0xed61('0x2d')]));_0x1dc2a5[_0xed61('0x2e')]=_0x1dc2a5['attributes'][_0xed61('0x4a')]?_0x1dc2a5[_0xed61('0x2e')]:_0x2d2037[_0xed61('0x2c')];if(!_0x5f1c64[_0xed61('0x28')][_0xed61('0x2f')](_0xed61('0x30'))){_0x1dc2a5[_0xed61('0x19')]=qs['limit'](_0x5f1c64[_0xed61('0x28')][_0xed61('0x19')]);_0x1dc2a5[_0xed61('0x17')]=qs[_0xed61('0x17')](_0x5f1c64[_0xed61('0x28')][_0xed61('0x17')]);}_0x1dc2a5[_0xed61('0x31')]=qs[_0xed61('0x32')](_0x5f1c64[_0xed61('0x28')]['sort']);_0x1dc2a5[_0xed61('0x35')]=qs[_0xed61('0x2a')](_[_0xed61('0x33')](_0x5f1c64[_0xed61('0x28')],_0x2d2037[_0xed61('0x2a')]));_0x1dc2a5[_0xed61('0x35')]['ProjectId']=_0x23d06d['id'];if(_0x5f1c64['query']['filter']){_0x1dc2a5[_0xed61('0x35')]=_['merge'](_0x1dc2a5['where'],{'$or':_[_0xed61('0x24')](_0x1dc2a5['attributes'],function(_0x16ebc7){var _0x1cbabc={};_0x1cbabc[_0x16ebc7]={'$like':'%'+_0x5f1c64[_0xed61('0x28')][_0xed61('0x34')]+'%'};return _0x1cbabc;})});}_0x1dc2a5=_[_0xed61('0x36')]({},_0x1dc2a5,_0x5f1c64[_0xed61('0x37')]);return db[_0xed61('0x58')]['count']({'where':_0x1dc2a5[_0xed61('0x35')]})[_0xed61('0x1e')](function(_0xe42f6){_0x3dfa42['count']=_0xe42f6;if(_0x5f1c64[_0xed61('0x28')][_0xed61('0x3c')]){_0x1dc2a5[_0xed61('0x3d')]=[{'all':!![]}];}return db[_0xed61('0x58')][_0xed61('0x39')](_0x1dc2a5);})[_0xed61('0x1e')](function(_0x320285){_0x3dfa42[_0xed61('0x56')]=_0x320285;return _0x3dfa42;});}})[_0xed61('0x1e')](respondWithFilteredResult(_0x4fe78d,_0x1dc2a5))[_0xed61('0x3a')](handleError(_0x4fe78d,null));};function char(_0xe8e904){return _0xed61('0x59')===typeof _0xe8e904?String[_0xed61('0x5a')][_0xed61('0x1c')](null,arguments):_0xe8e904;}function needsEncapsulation(_0x1a7f79){return!!_0x1a7f79&&(_0x1a7f79[_0xed61('0x5b')]()['indexOf'](char(0xd))>=0x0||_0x1a7f79[_0xed61('0x5b')]()['indexOf'](char(0xa))>=0x0||_0x1a7f79[_0xed61('0x5b')]()[_0xed61('0x5c')](char(0x2c))>=0x0||_0x1a7f79[_0xed61('0x5b')]()[_0xed61('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x22a64a){var _0x5a74c5=char(0x22),_0x20aec3='\x5c'+char(0x22),_0x5eef48=_0x22a64a[_0xed61('0x5b')]()[_0xed61('0x5d')](new RegExp(_0x5a74c5,'g'),_0x20aec3);return _0x5a74c5+_0x5eef48+_0x5a74c5;}exports[_0xed61('0x5e')]=function(_0xe460f9,_0x32a763,_0x1cf2d9){var _0x351241,_0x508ed0;var _0x3c600a={'where':{'ProjectId':_0xe460f9[_0xed61('0x49')]['id']}};if(_0xe460f9[_0xed61('0x28')][_0xed61('0x5f')]){_0x3c600a['where']['starttime']=JSON['parse'](_0xe460f9[_0xed61('0x28')][_0xed61('0x5f')]);}return db['JscriptySessionReport']['findAll'](_0x3c600a)[_0xed61('0x1e')](handleEntityNotFound(_0x32a763,null))[_0xed61('0x1e')](function(_0x4313de){if(_0x4313de){_0x351241=_0x4313de;return db[_0xed61('0x60')][_0xed61('0x39')]({'where':{'SessionId':{'$in':_[_0xed61('0x24')](_0x351241,'id')},'ProjectId':_0xe460f9[_0xed61('0x49')]['id']},'order':_0xed61('0x61')});}})['then'](handleEntityNotFound(_0x32a763,null))[_0xed61('0x1e')](function(_0x4313d2){if(_0x4313d2){_0x508ed0=_0x4313d2;var _0x3f7eb1={};for(var _0x416931=0x0,_0x399f30=_0x508ed0['length'];_0x416931<_0x399f30;_0x416931++){if(!_0x3f7eb1['hasOwnProperty'](_0x508ed0[_0x416931]['questionId'])){_0x3f7eb1[_0x508ed0[_0x416931][_0xed61('0x62')]]=needsEncapsulation(_0x508ed0[_0x416931][_0xed61('0x63')])?encapsulate(_0x508ed0[_0x416931][_0xed61('0x63')]):_0x508ed0[_0x416931]['question'];}}var _0x499015=[],_0x10860e={};for(var _0x14a0e5=0x0,_0x1f07fd=_0x351241[_0xed61('0x4a')];_0x14a0e5<_0x1f07fd;_0x14a0e5++){_0x10860e={'ProjectId':_0xe460f9[_0xed61('0x49')]['id'],'SessionId':_0x351241[_0x14a0e5]['id'],'StartTime':moment(_0x351241[_0x14a0e5][_0xed61('0x64')])[_0xed61('0x65')](_0xed61('0x66'))};for(var _0x4f66e6=0x0,_0x47483f=_0x508ed0[_0xed61('0x4a')];_0x4f66e6<_0x47483f;_0x4f66e6++){if(_0x508ed0[_0x4f66e6][_0xed61('0x67')]==_0x351241[_0x14a0e5]['id']&&_0x3f7eb1[_0xed61('0x2f')](_0x508ed0[_0x4f66e6]['questionId'])){_0x10860e[_0x3f7eb1[_0x508ed0[_0x4f66e6][_0xed61('0x62')]]]=_0x508ed0[_0x4f66e6][_0xed61('0x68')];}}for(var _0x5a065c in _0x3f7eb1){if(!_0x10860e[_0xed61('0x2f')](_0x3f7eb1[_0x5a065c])){_0x10860e[_0x3f7eb1[_0x5a065c]]=null;}}_0x499015[_0xed61('0x69')](_0x10860e);}return _0x499015;}})[_0xed61('0x1e')](function(_0x1cd9b9){if(!_[_0xed61('0x6a')](_0x1cd9b9)){var _0x7c4425=toCsv(_0x1cd9b9);var _0xd7ae25=Date[_0xed61('0x6b')]();fs[_0xed61('0x6c')](util[_0xed61('0x65')](_0xed61('0x6d'),_0xe460f9[_0xed61('0x49')]['id'],_0xd7ae25),_0x7c4425);_0x32a763[_0xed61('0x6e')](_0xed61('0x6f'),_0xed61('0x70')+util[_0xed61('0x65')]('Jscripty_Project_%d_Summary_%s.csv',_0xe460f9['params']['id'],_0xd7ae25));_0x32a763[_0xed61('0x6e')]('Content-type','text/csv');return _0x32a763['download'](util[_0xed61('0x65')](_0xed61('0x6d'),_0xe460f9[_0xed61('0x49')]['id'],_0xd7ae25));}else{return _0x32a763[_0xed61('0x13')](0xcc);}})[_0xed61('0x3a')](handleError(_0x32a763,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index f0db053..32e576f 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 _0x1dcc=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','define','jscripty_projects'];(function(_0x20d913,_0x4ea433){var _0x3ef4d4=function(_0x210a6c){while(--_0x210a6c){_0x20d913['push'](_0x20d913['shift']());}};_0x3ef4d4(++_0x4ea433);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x419d88,_0x411329){_0x419d88=_0x419d88-0x0;var _0x1a9879=_0x1dcc[_0x419d88];return _0x1a9879;};'use strict';var _=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var logger=require(_0xc1dc('0x2'))(_0xc1dc('0x3'));var moment=require('moment');var BPromise=require(_0xc1dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc1dc('0x5'));var rimraf=require(_0xc1dc('0x6'));var config=require(_0xc1dc('0x7'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x1e57ba,_0x381ab6){return _0x1e57ba[_0xc1dc('0x8')]('JscriptyProject',attributes,{'tableName':_0xc1dc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x87d3=['exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./jscriptyProject.attributes'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x87d3,0x86));var _0x387d=function(_0x122e42,_0x222609){_0x122e42=_0x122e42-0x0;var _0x4c019e=_0x87d3[_0x122e42];return _0x4c019e;};'use strict';var _=require(_0x387d('0x0'));var util=require(_0x387d('0x1'));var logger=require(_0x387d('0x2'))(_0x387d('0x3'));var moment=require(_0x387d('0x4'));var BPromise=require(_0x387d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x387d('0x6'));var rimraf=require('rimraf');var config=require(_0x387d('0x7'));var attributes=require(_0x387d('0x8'));module[_0x387d('0x9')]=function(_0x49d349,_0x3e0d03){return _0x49d349[_0x387d('0xa')](_0x387d('0xb'),attributes,{'tableName':_0x387d('0xc'),'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 71f497c..c455967 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x49052b,_0x1612f7){var _0x2f40cf=function(_0x3357a2){while(--_0x3357a2){_0x49052b['push'](_0x49052b['shift']());}};_0x2f40cf(++_0x1612f7);}(_0xaa88,0x137));var _0x8aa8=function(_0x3d27a,_0x31311d){_0x3d27a=_0x3d27a-0x0;var _0x314fd7=_0xaa88[_0x3d27a];return _0x314fd7;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x156386,_0x538afd){var _0x5bfd75=function(_0x3fe567){while(--_0x3fe567){_0x156386['push'](_0x156386['shift']());}};_0x5bfd75(++_0x538afd);}(_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 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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index efbcaa5..d07fbf5 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 _0xabf6=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','describe','/:id','isAuthenticated','show','create','put','update','delete','destroy'];(function(_0x2ea8f8,_0x434b24){var _0x2fe4d7=function(_0x64fe62){while(--_0x64fe62){_0x2ea8f8['push'](_0x2ea8f8['shift']());}};_0x2fe4d7(++_0x434b24);}(_0xabf6,0xf1));var _0x6abf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabf6[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x6abf('0x0'));var util=require(_0x6abf('0x1'));var path=require('path');var timeout=require(_0x6abf('0x2'));var express=require('express');var router=express[_0x6abf('0x3')]();var fs_extra=require(_0x6abf('0x4'));var auth=require(_0x6abf('0x5'));var interaction=require(_0x6abf('0x6'));var config=require('../../config/environment');var controller=require(_0x6abf('0x7'));router[_0x6abf('0x8')]('/',auth['isAuthenticated'](),controller[_0x6abf('0x9')]);router[_0x6abf('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x6abf('0xa')]);router[_0x6abf('0x8')](_0x6abf('0xb'),auth[_0x6abf('0xc')](),controller[_0x6abf('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6abf('0xe')]);router[_0x6abf('0xf')](_0x6abf('0xb'),auth[_0x6abf('0xc')](),controller[_0x6abf('0x10')]);router[_0x6abf('0x11')](_0x6abf('0xb'),auth[_0x6abf('0xc')](),controller[_0x6abf('0x12')]);module[_0x6abf('0x13')]=router; \ No newline at end of file +var _0x2102=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x38a230,_0x220bc3){var _0x15c122=function(_0x52257c){while(--_0x52257c){_0x38a230['push'](_0x38a230['shift']());}};_0x15c122(++_0x220bc3);}(_0x2102,0x9d));var _0x2210=function(_0x6e2e0b,_0x4996fc){_0x6e2e0b=_0x6e2e0b-0x0;var _0x1a63d2=_0x2102[_0x6e2e0b];return _0x1a63d2;};'use strict';var multer=require(_0x2210('0x0'));var util=require('util');var path=require(_0x2210('0x1'));var timeout=require(_0x2210('0x2'));var express=require(_0x2210('0x3'));var router=express[_0x2210('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2210('0x5'));var interaction=require(_0x2210('0x6'));var config=require(_0x2210('0x7'));var controller=require(_0x2210('0x8'));router[_0x2210('0x9')]('/',auth[_0x2210('0xa')](),controller['index']);router[_0x2210('0x9')](_0x2210('0xb'),auth[_0x2210('0xa')](),controller[_0x2210('0xc')]);router['get'](_0x2210('0xd'),auth[_0x2210('0xa')](),controller[_0x2210('0xe')]);router[_0x2210('0xf')]('/',auth[_0x2210('0xa')](),controller['create']);router['put'](_0x2210('0xd'),auth[_0x2210('0xa')](),controller[_0x2210('0x10')]);router[_0x2210('0x11')](_0x2210('0xd'),auth[_0x2210('0xa')](),controller[_0x2210('0x12')]);module[_0x2210('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 8719928..cfcab01 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(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x7a54,0x106));var _0x47a5=function(_0x3d3db4,_0x3d3623){_0x3d3db4=_0x3d3db4-0x0;var _0x20ef24=_0x7a54[_0x3d3db4];return _0x20ef24;};'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(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a54,0x106));var _0x47a5=function(_0x1605d3,_0x11096a){_0x1605d3=_0x1605d3-0x0;var _0x282e2a=_0x7a54[_0x1605d3];return _0x282e2a;};'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 9b24a9e..c95e947 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 _0x6340=['then','destroy','end','error','stack','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','update'];(function(_0x1a8962,_0x4df490){var _0x269b32=function(_0xa876f7){while(--_0xa876f7){_0x1a8962['push'](_0x1a8962['shift']());}};_0x269b32(++_0x4df490);}(_0x6340,0x1e4));var _0x0634=function(_0x73b1cd,_0x176535){_0x73b1cd=_0x73b1cd-0x0;var _0x243426=_0x6340[_0x73b1cd];return _0x243426;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0634('0x0'));var zipdir=require(_0x0634('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0634('0x2'));var moment=require(_0x0634('0x3'));var BPromise=require(_0x0634('0x4'));var Mustache=require(_0x0634('0x5'));var util=require(_0x0634('0x6'));var path=require(_0x0634('0x7'));var sox=require(_0x0634('0x8'));var csv=require(_0x0634('0x9'));var ejs=require(_0x0634('0xa'));var fs=require('fs');var fs_extra=require(_0x0634('0xb'));var _=require(_0x0634('0xc'));var squel=require('squel');var crypto=require(_0x0634('0xd'));var jsforce=require(_0x0634('0xe'));var deskjs=require(_0x0634('0xf'));var toCsv=require(_0x0634('0x9'));var querystring=require(_0x0634('0x10'));var Papa=require('papaparse');var Redis=require(_0x0634('0x11'));var authService=require(_0x0634('0x12'));var qs=require(_0x0634('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0634('0x14'));var logger=require(_0x0634('0x15'))(_0x0634('0x16'));var utils=require('../../config/utils');var config=require(_0x0634('0x17'));var licenseUtil=require(_0x0634('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x25a9ba,_0x1cc562){_0x1cc562=_0x1cc562||0xcc;return function(_0x589d75){if(_0x589d75){return _0x25a9ba[_0x0634('0x19')](_0x1cc562);}return _0x25a9ba['status'](_0x1cc562)['end']();};}function respondWithResult(_0x2eb1df,_0x4b3fc2){_0x4b3fc2=_0x4b3fc2||0xc8;return function(_0x5911b8){if(_0x5911b8){return _0x2eb1df[_0x0634('0x1a')](_0x4b3fc2)['json'](_0x5911b8);}};}function respondWithFilteredResult(_0xbca3d4,_0x384b6f){return function(_0x188754){if(_0x188754){var _0x403cc2=typeof _0x384b6f[_0x0634('0x1b')]===_0x0634('0x1c')&&typeof _0x384b6f[_0x0634('0x1d')]===_0x0634('0x1c');var _0x4618f5=_0x188754['count'];var _0x3c1f3d=_0x403cc2?0x0:_0x384b6f[_0x0634('0x1b')];var _0x4e44fa=_0x403cc2?_0x188754[_0x0634('0x1e')]:_0x384b6f[_0x0634('0x1b')]+_0x384b6f['limit'];var _0x51a150;if(_0x4e44fa>=_0x4618f5){_0x4e44fa=_0x4618f5;_0x51a150=0xc8;}else{_0x51a150=0xce;}_0xbca3d4['status'](_0x51a150);return _0xbca3d4[_0x0634('0x1f')](_0x0634('0x20'),_0x3c1f3d+'-'+_0x4e44fa+'/'+_0x4618f5)['json'](_0x188754);}return null;};}function patchUpdates(_0x149645){return function(_0x367ea4){try{jsonpatch['apply'](_0x367ea4,_0x149645,!![]);}catch(_0x59df40){return BPromise['reject'](_0x59df40);}return _0x367ea4['save']();};}function saveUpdates(_0x197614,_0xa203f6){return function(_0x47a0eb){if(_0x47a0eb){return _0x47a0eb[_0x0634('0x21')](_0x197614)[_0x0634('0x22')](function(_0x1a675e){return _0x1a675e;});}return null;};}function removeEntity(_0x20b1a6,_0x3959b6){return function(_0xfe3cde){if(_0xfe3cde){return _0xfe3cde[_0x0634('0x23')]()[_0x0634('0x22')](function(){_0x20b1a6['status'](0xcc)[_0x0634('0x24')]();});}};}function handleEntityNotFound(_0x2e0618,_0x236cb0){return function(_0x38db08){if(!_0x38db08){_0x2e0618[_0x0634('0x19')](0x194);}return _0x38db08;};}function handleError(_0x314bb3,_0xffca2){_0xffca2=_0xffca2||0x1f4;return function(_0x4eaf69){logger[_0x0634('0x25')](_0x4eaf69[_0x0634('0x26')]);if(_0x4eaf69[_0x0634('0x27')]){delete _0x4eaf69[_0x0634('0x27')];}_0x314bb3[_0x0634('0x1a')](_0xffca2)[_0x0634('0x28')](_0x4eaf69);};}exports['index']=function(_0x39f9e0,_0x4a9e66){var _0x100d6d={},_0x262792={},_0x5482e7={'count':0x0,'rows':[]};var _0xb1d062=_[_0x0634('0x29')](db[_0x0634('0x2a')][_0x0634('0x2b')],function(_0x293850){return{'name':_0x293850[_0x0634('0x2c')],'type':_0x293850[_0x0634('0x2d')]['key']};});_0x262792[_0x0634('0x2e')]=_[_0x0634('0x29')](_0xb1d062,'name');_0x262792[_0x0634('0x2f')]=_[_0x0634('0x30')](_0x39f9e0[_0x0634('0x2f')]);_0x262792[_0x0634('0x31')]=_[_0x0634('0x32')](_0x262792[_0x0634('0x2e')],_0x262792[_0x0634('0x2f')]);_0x100d6d[_0x0634('0x33')]=_[_0x0634('0x32')](_0x262792[_0x0634('0x2e')],qs[_0x0634('0x34')](_0x39f9e0[_0x0634('0x2f')][_0x0634('0x34')]));_0x100d6d[_0x0634('0x33')]=_0x100d6d['attributes'][_0x0634('0x35')]?_0x100d6d[_0x0634('0x33')]:_0x262792[_0x0634('0x2e')];if(!_0x39f9e0[_0x0634('0x2f')][_0x0634('0x36')](_0x0634('0x37'))){_0x100d6d[_0x0634('0x1d')]=qs[_0x0634('0x1d')](_0x39f9e0['query']['limit']);_0x100d6d[_0x0634('0x1b')]=qs[_0x0634('0x1b')](_0x39f9e0[_0x0634('0x2f')]['offset']);}_0x100d6d[_0x0634('0x38')]=qs['sort'](_0x39f9e0[_0x0634('0x2f')]['sort']);_0x100d6d[_0x0634('0x39')]=qs[_0x0634('0x31')](_[_0x0634('0x3a')](_0x39f9e0[_0x0634('0x2f')],_0x262792[_0x0634('0x31')]),_0xb1d062);if(_0x39f9e0['query'][_0x0634('0x3b')]){_0x100d6d[_0x0634('0x39')]=_[_0x0634('0x3c')](_0x100d6d[_0x0634('0x39')],{'$or':_[_0x0634('0x29')](_0xb1d062,function(_0xd143b1){if(_0xd143b1[_0x0634('0x2d')]!==_0x0634('0x3d')){var _0x397c28={};_0x397c28[_0xd143b1[_0x0634('0x27')]]={'$like':'%'+_0x39f9e0['query'][_0x0634('0x3b')]+'%'};return _0x397c28;}})});}_0x100d6d=_[_0x0634('0x3c')]({},_0x100d6d,_0x39f9e0['options']);var _0x41ad67={'where':_0x100d6d[_0x0634('0x39')]};return db[_0x0634('0x2a')][_0x0634('0x1e')](_0x41ad67)['then'](function(_0x3a554c){_0x5482e7[_0x0634('0x1e')]=_0x3a554c;if(_0x39f9e0[_0x0634('0x2f')][_0x0634('0x3e')]){_0x100d6d[_0x0634('0x3f')]=[{'all':!![]}];}return db[_0x0634('0x2a')][_0x0634('0x40')](_0x100d6d);})[_0x0634('0x22')](function(_0x73859c){_0x5482e7[_0x0634('0x41')]=_0x73859c;return _0x5482e7;})[_0x0634('0x22')](respondWithFilteredResult(_0x4a9e66,_0x100d6d))[_0x0634('0x42')](handleError(_0x4a9e66,null));};exports[_0x0634('0x43')]=function(_0xd5347c,_0x4ac07f){var _0x5ad046={'raw':!![],'where':{'id':_0xd5347c[_0x0634('0x44')]['id']}},_0x41aeb5={};_0x41aeb5[_0x0634('0x2e')]=_[_0x0634('0x30')](db[_0x0634('0x2a')]['rawAttributes']);_0x41aeb5[_0x0634('0x2f')]=_[_0x0634('0x30')](_0xd5347c[_0x0634('0x2f')]);_0x41aeb5[_0x0634('0x31')]=_[_0x0634('0x32')](_0x41aeb5[_0x0634('0x2e')],_0x41aeb5[_0x0634('0x2f')]);_0x5ad046[_0x0634('0x33')]=_[_0x0634('0x32')](_0x41aeb5[_0x0634('0x2e')],qs[_0x0634('0x34')](_0xd5347c[_0x0634('0x2f')][_0x0634('0x34')]));_0x5ad046['attributes']=_0x5ad046[_0x0634('0x33')][_0x0634('0x35')]?_0x5ad046[_0x0634('0x33')]:_0x41aeb5[_0x0634('0x2e')];if(_0xd5347c['query'][_0x0634('0x3e')]){_0x5ad046['include']=[{'all':!![]}];}_0x5ad046=_[_0x0634('0x3c')]({},_0x5ad046,_0xd5347c[_0x0634('0x45')]);return db[_0x0634('0x2a')][_0x0634('0x46')](_0x5ad046)[_0x0634('0x22')](handleEntityNotFound(_0x4ac07f,null))[_0x0634('0x22')](respondWithResult(_0x4ac07f,null))[_0x0634('0x42')](handleError(_0x4ac07f,null));};exports[_0x0634('0x47')]=function(_0xa07660,_0x4a11e2){return db[_0x0634('0x2a')]['create'](_0xa07660[_0x0634('0x48')],{})[_0x0634('0x22')](respondWithResult(_0x4a11e2,0xc9))[_0x0634('0x42')](handleError(_0x4a11e2,null));};exports['update']=function(_0x482563,_0x1550fe){if(_0x482563[_0x0634('0x48')]['id']){delete _0x482563['body']['id'];}return db['JscriptyQuestionReport'][_0x0634('0x46')]({'where':{'id':_0x482563[_0x0634('0x44')]['id']}})['then'](handleEntityNotFound(_0x1550fe,null))[_0x0634('0x22')](saveUpdates(_0x482563[_0x0634('0x48')],null))[_0x0634('0x22')](respondWithResult(_0x1550fe,null))[_0x0634('0x42')](handleError(_0x1550fe,null));};exports[_0x0634('0x23')]=function(_0x5349ea,_0x4cb58e){return db[_0x0634('0x2a')][_0x0634('0x46')]({'where':{'id':_0x5349ea[_0x0634('0x44')]['id']}})[_0x0634('0x22')](handleEntityNotFound(_0x4cb58e,null))[_0x0634('0x22')](removeEntity(_0x4cb58e,null))[_0x0634('0x42')](handleError(_0x4cb58e,null));};exports[_0x0634('0x49')]=function(_0x27dbcb,_0x13fea9){return db[_0x0634('0x2a')][_0x0634('0x49')]()[_0x0634('0x22')](respondWithResult(_0x13fea9,null))[_0x0634('0x42')](handleError(_0x13fea9,null));}; \ No newline at end of file +var _0x254e=['undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','JscriptyQuestionReport','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','catch','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x5f746f,_0x5b05ab){var _0x198d15=function(_0x58c7e7){while(--_0x58c7e7){_0x5f746f['push'](_0x5f746f['shift']());}};_0x198d15(++_0x5b05ab);}(_0x254e,0x19c));var _0xe254=function(_0x580ce9,_0x34af34){_0x580ce9=_0x580ce9-0x0;var _0xcdda31=_0x254e[_0x580ce9];return _0xcdda31;};'use strict';var emlformat=require(_0xe254('0x0'));var rimraf=require(_0xe254('0x1'));var zipdir=require(_0xe254('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe254('0x3'));var moment=require(_0xe254('0x4'));var BPromise=require(_0xe254('0x5'));var Mustache=require('mustache');var util=require(_0xe254('0x6'));var path=require(_0xe254('0x7'));var sox=require('sox');var csv=require(_0xe254('0x8'));var ejs=require(_0xe254('0x9'));var fs=require('fs');var fs_extra=require(_0xe254('0xa'));var _=require('lodash');var squel=require(_0xe254('0xb'));var crypto=require(_0xe254('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe254('0xd'));var toCsv=require(_0xe254('0x8'));var querystring=require(_0xe254('0xe'));var Papa=require(_0xe254('0xf'));var Redis=require(_0xe254('0x10'));var authService=require(_0xe254('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe254('0x12'));var hardwareService=require(_0xe254('0x13'));var logger=require(_0xe254('0x14'))(_0xe254('0x15'));var utils=require(_0xe254('0x16'));var config=require(_0xe254('0x17'));var licenseUtil=require(_0xe254('0x18'));var db=require(_0xe254('0x19'))['db'];function respondWithStatusCode(_0x3f3a05,_0x3ea7ad){_0x3ea7ad=_0x3ea7ad||0xcc;return function(_0x4672e8){if(_0x4672e8){return _0x3f3a05[_0xe254('0x1a')](_0x3ea7ad);}return _0x3f3a05[_0xe254('0x1b')](_0x3ea7ad)[_0xe254('0x1c')]();};}function respondWithResult(_0x5e5cd6,_0x977e53){_0x977e53=_0x977e53||0xc8;return function(_0x4a25c9){if(_0x4a25c9){return _0x5e5cd6[_0xe254('0x1b')](_0x977e53)[_0xe254('0x1d')](_0x4a25c9);}};}function respondWithFilteredResult(_0x395f74,_0x477460){return function(_0x188c1c){if(_0x188c1c){var _0x575458=typeof _0x477460[_0xe254('0x1e')]==='undefined'&&typeof _0x477460[_0xe254('0x1f')]===_0xe254('0x20');var _0x110d60=_0x188c1c['count'];var _0x35e4bb=_0x575458?0x0:_0x477460[_0xe254('0x1e')];var _0xf9b5cb=_0x575458?_0x188c1c[_0xe254('0x21')]:_0x477460[_0xe254('0x1e')]+_0x477460[_0xe254('0x1f')];var _0x24b774;if(_0xf9b5cb>=_0x110d60){_0xf9b5cb=_0x110d60;_0x24b774=0xc8;}else{_0x24b774=0xce;}_0x395f74[_0xe254('0x1b')](_0x24b774);return _0x395f74['set'](_0xe254('0x22'),_0x35e4bb+'-'+_0xf9b5cb+'/'+_0x110d60)[_0xe254('0x1d')](_0x188c1c);}return null;};}function patchUpdates(_0x3fd2be){return function(_0x9009d){try{jsonpatch[_0xe254('0x23')](_0x9009d,_0x3fd2be,!![]);}catch(_0x32c0e8){return BPromise[_0xe254('0x24')](_0x32c0e8);}return _0x9009d[_0xe254('0x25')]();};}function saveUpdates(_0x11649e,_0x46b2f6){return function(_0x53b3a0){if(_0x53b3a0){return _0x53b3a0[_0xe254('0x26')](_0x11649e)[_0xe254('0x27')](function(_0x5b9f65){return _0x5b9f65;});}return null;};}function removeEntity(_0x512a47,_0x12f92e){return function(_0xc5c0c0){if(_0xc5c0c0){return _0xc5c0c0[_0xe254('0x28')]()[_0xe254('0x27')](function(){_0x512a47[_0xe254('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4241a5,_0x2c6119){return function(_0xa39089){if(!_0xa39089){_0x4241a5['sendStatus'](0x194);}return _0xa39089;};}function handleError(_0x482aef,_0x2023f5){_0x2023f5=_0x2023f5||0x1f4;return function(_0x1a7e58){logger[_0xe254('0x29')](_0x1a7e58['stack']);if(_0x1a7e58[_0xe254('0x2a')]){delete _0x1a7e58['name'];}_0x482aef[_0xe254('0x1b')](_0x2023f5)[_0xe254('0x2b')](_0x1a7e58);};}exports[_0xe254('0x2c')]=function(_0x1e746e,_0x4022c9){var _0x37c095={},_0x299bd3={},_0xda3a79={'count':0x0,'rows':[]};var _0x1bd980=_['map'](db[_0xe254('0x2d')]['rawAttributes'],function(_0x4b1d18){return{'name':_0x4b1d18['fieldName'],'type':_0x4b1d18[_0xe254('0x2e')][_0xe254('0x2f')]};});_0x299bd3['model']=_[_0xe254('0x30')](_0x1bd980,_0xe254('0x2a'));_0x299bd3[_0xe254('0x31')]=_[_0xe254('0x32')](_0x1e746e['query']);_0x299bd3[_0xe254('0x33')]=_[_0xe254('0x34')](_0x299bd3['model'],_0x299bd3[_0xe254('0x31')]);_0x37c095[_0xe254('0x35')]=_[_0xe254('0x34')](_0x299bd3[_0xe254('0x36')],qs['fields'](_0x1e746e['query'][_0xe254('0x37')]));_0x37c095[_0xe254('0x35')]=_0x37c095['attributes'][_0xe254('0x38')]?_0x37c095[_0xe254('0x35')]:_0x299bd3[_0xe254('0x36')];if(!_0x1e746e[_0xe254('0x31')]['hasOwnProperty'](_0xe254('0x39'))){_0x37c095['limit']=qs['limit'](_0x1e746e['query'][_0xe254('0x1f')]);_0x37c095['offset']=qs['offset'](_0x1e746e[_0xe254('0x31')][_0xe254('0x1e')]);}_0x37c095['order']=qs[_0xe254('0x3a')](_0x1e746e[_0xe254('0x31')][_0xe254('0x3a')]);_0x37c095[_0xe254('0x3b')]=qs['filters'](_['pick'](_0x1e746e[_0xe254('0x31')],_0x299bd3[_0xe254('0x33')]),_0x1bd980);if(_0x1e746e[_0xe254('0x31')][_0xe254('0x3c')]){_0x37c095['where']=_[_0xe254('0x3d')](_0x37c095[_0xe254('0x3b')],{'$or':_['map'](_0x1bd980,function(_0x2794b2){if(_0x2794b2['type']!=='VIRTUAL'){var _0x4dbba0={};_0x4dbba0[_0x2794b2[_0xe254('0x2a')]]={'$like':'%'+_0x1e746e['query'][_0xe254('0x3c')]+'%'};return _0x4dbba0;}})});}_0x37c095=_['merge']({},_0x37c095,_0x1e746e[_0xe254('0x3e')]);var _0x461b49={'where':_0x37c095[_0xe254('0x3b')]};return db[_0xe254('0x2d')][_0xe254('0x21')](_0x461b49)['then'](function(_0x4f8d35){_0xda3a79[_0xe254('0x21')]=_0x4f8d35;if(_0x1e746e[_0xe254('0x31')][_0xe254('0x3f')]){_0x37c095[_0xe254('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xe254('0x41')](_0x37c095);})['then'](function(_0x369ceb){_0xda3a79['rows']=_0x369ceb;return _0xda3a79;})[_0xe254('0x27')](respondWithFilteredResult(_0x4022c9,_0x37c095))['catch'](handleError(_0x4022c9,null));};exports[_0xe254('0x42')]=function(_0x4f20ac,_0x32144d){var _0x9da1ed={'raw':!![],'where':{'id':_0x4f20ac[_0xe254('0x43')]['id']}},_0x3af53f={};_0x3af53f[_0xe254('0x36')]=_[_0xe254('0x32')](db['JscriptyQuestionReport'][_0xe254('0x44')]);_0x3af53f[_0xe254('0x31')]=_[_0xe254('0x32')](_0x4f20ac[_0xe254('0x31')]);_0x3af53f[_0xe254('0x33')]=_[_0xe254('0x34')](_0x3af53f['model'],_0x3af53f[_0xe254('0x31')]);_0x9da1ed[_0xe254('0x35')]=_[_0xe254('0x34')](_0x3af53f[_0xe254('0x36')],qs[_0xe254('0x37')](_0x4f20ac[_0xe254('0x31')]['fields']));_0x9da1ed['attributes']=_0x9da1ed[_0xe254('0x35')][_0xe254('0x38')]?_0x9da1ed['attributes']:_0x3af53f[_0xe254('0x36')];if(_0x4f20ac[_0xe254('0x31')][_0xe254('0x3f')]){_0x9da1ed[_0xe254('0x40')]=[{'all':!![]}];}_0x9da1ed=_[_0xe254('0x3d')]({},_0x9da1ed,_0x4f20ac['options']);return db[_0xe254('0x2d')][_0xe254('0x45')](_0x9da1ed)[_0xe254('0x27')](handleEntityNotFound(_0x32144d,null))[_0xe254('0x27')](respondWithResult(_0x32144d,null))[_0xe254('0x46')](handleError(_0x32144d,null));};exports[_0xe254('0x47')]=function(_0x33dedb,_0x4c928f){return db[_0xe254('0x2d')]['create'](_0x33dedb[_0xe254('0x48')],{})[_0xe254('0x27')](respondWithResult(_0x4c928f,0xc9))[_0xe254('0x46')](handleError(_0x4c928f,null));};exports[_0xe254('0x26')]=function(_0x25e423,_0x32cc9d){if(_0x25e423[_0xe254('0x48')]['id']){delete _0x25e423[_0xe254('0x48')]['id'];}return db[_0xe254('0x2d')][_0xe254('0x45')]({'where':{'id':_0x25e423[_0xe254('0x43')]['id']}})['then'](handleEntityNotFound(_0x32cc9d,null))['then'](saveUpdates(_0x25e423['body'],null))['then'](respondWithResult(_0x32cc9d,null))[_0xe254('0x46')](handleError(_0x32cc9d,null));};exports[_0xe254('0x28')]=function(_0x4180af,_0x3748e4){return db['JscriptyQuestionReport'][_0xe254('0x45')]({'where':{'id':_0x4180af[_0xe254('0x43')]['id']}})[_0xe254('0x27')](handleEntityNotFound(_0x3748e4,null))['then'](removeEntity(_0x3748e4,null))[_0xe254('0x46')](handleError(_0x3748e4,null));};exports[_0xe254('0x49')]=function(_0x40cdb3,_0x2027da){return db[_0xe254('0x2d')][_0xe254('0x49')]()[_0xe254('0x27')](respondWithResult(_0x2027da,null))[_0xe254('0x46')](handleError(_0x2027da,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 8789b98..e783e6c 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 _0x5cef=['exports','JscriptyQuestionReport','report_jscripty_questions','util','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0x5cef,0x99));var _0xf5ce=function(_0x3958b4,_0x25bc39){_0x3958b4=_0x3958b4-0x0;var _0x99e5d6=_0x5cef[_0x3958b4];return _0x99e5d6;};'use strict';var _=require('lodash');var util=require(_0xf5ce('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf5ce('0x1'));var BPromise=require(_0xf5ce('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf5ce('0x3'));var rimraf=require(_0xf5ce('0x4'));var config=require(_0xf5ce('0x5'));var attributes=require(_0xf5ce('0x6'));module[_0xf5ce('0x7')]=function(_0x567c98,_0x9c009f){return _0x567c98['define'](_0xf5ce('0x8'),attributes,{'tableName':_0xf5ce('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47bc=['request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','lodash','util','../../config/logger','bluebird'];(function(_0xb314ab,_0x179f08){var _0xa0916=function(_0x253b9a){while(--_0x253b9a){_0xb314ab['push'](_0xb314ab['shift']());}};_0xa0916(++_0x179f08);}(_0x47bc,0x1be));var _0xc47b=function(_0x1d628d,_0x325eb9){_0x1d628d=_0x1d628d-0x0;var _0x3eff3d=_0x47bc[_0x1d628d];return _0x3eff3d;};'use strict';var _=require(_0xc47b('0x0'));var util=require(_0xc47b('0x1'));var logger=require(_0xc47b('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc47b('0x3'));var rp=require(_0xc47b('0x4'));var fs=require('fs');var path=require(_0xc47b('0x5'));var rimraf=require(_0xc47b('0x6'));var config=require(_0xc47b('0x7'));var attributes=require(_0xc47b('0x8'));module[_0xc47b('0x9')]=function(_0x2de364,_0x4a1158){return _0x2de364['define']('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 1c1991e..9257633 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 _0xa8c7=['request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','http'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xa8c7,0x116));var _0x7a8c=function(_0x691aef,_0xc041ce){_0x691aef=_0x691aef-0x0;var _0x49b997=_0xa8c7[_0x691aef];return _0x49b997;};'use strict';var _=require(_0x7a8c('0x0'));var util=require('util');var moment=require(_0x7a8c('0x1'));var BPromise=require(_0x7a8c('0x2'));var rs=require(_0x7a8c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7a8c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7a8c('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a8c('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x258963,_0x2227a4,_0x222624){return new BPromise(function(_0x488f5f,_0x18e369){return client[_0x7a8c('0x7')](_0x258963,_0x222624)[_0x7a8c('0x8')](function(_0xc5e59c){logger[_0x7a8c('0x9')](_0x7a8c('0xa'),_0x2227a4,'request\x20sent');logger[_0x7a8c('0xb')](_0x7a8c('0xc'),_0x2227a4,_0x7a8c('0xd'),JSON['stringify'](_0xc5e59c));if(_0xc5e59c[_0x7a8c('0xe')]){if(_0xc5e59c[_0x7a8c('0xe')][_0x7a8c('0xf')]===0x1f4){logger[_0x7a8c('0xe')](_0x7a8c('0xa'),_0x2227a4,_0xc5e59c['error']['message']);return _0x18e369(_0xc5e59c[_0x7a8c('0xe')][_0x7a8c('0x10')]);}logger[_0x7a8c('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2227a4,_0xc5e59c[_0x7a8c('0xe')][_0x7a8c('0x10')]);return _0x488f5f(_0xc5e59c['error']['message']);}else{logger[_0x7a8c('0x9')](_0x7a8c('0xa'),_0x2227a4,_0x7a8c('0xd'));_0x488f5f(_0xc5e59c[_0x7a8c('0x11')][_0x7a8c('0x10')]);}})[_0x7a8c('0x12')](function(_0x445952){logger['error'](_0x7a8c('0xa'),_0x2227a4,_0x445952);_0x18e369(_0x445952);});});} \ No newline at end of file +var _0x92d4=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','../../mysqldb'];(function(_0x50763f,_0x2dd4c4){var _0x35023e=function(_0x235a06){while(--_0x235a06){_0x50763f['push'](_0x50763f['shift']());}};_0x35023e(++_0x2dd4c4);}(_0x92d4,0x18b));var _0x492d=function(_0x25be1d,_0x121940){_0x25be1d=_0x25be1d-0x0;var _0x1a01d8=_0x92d4[_0x25be1d];return _0x1a01d8;};'use strict';var _=require(_0x492d('0x0'));var util=require(_0x492d('0x1'));var moment=require(_0x492d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x492d('0x3'))['db'];var utils=require(_0x492d('0x4'));var logger=require(_0x492d('0x5'))('rpc');var config=require(_0x492d('0x6'));var jayson=require(_0x492d('0x7'));var client=jayson[_0x492d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x596ad7,_0x4ff851,_0x29d2e4){return new BPromise(function(_0x507eb7,_0x5c8cd2){return client[_0x492d('0x9')](_0x596ad7,_0x29d2e4)[_0x492d('0xa')](function(_0x5481f7){logger[_0x492d('0xb')](_0x492d('0xc'),_0x4ff851,_0x492d('0xd'));logger[_0x492d('0xe')](_0x492d('0xf'),_0x4ff851,_0x492d('0xd'),JSON[_0x492d('0x10')](_0x5481f7));if(_0x5481f7[_0x492d('0x11')]){if(_0x5481f7[_0x492d('0x11')][_0x492d('0x12')]===0x1f4){logger[_0x492d('0x11')](_0x492d('0xc'),_0x4ff851,_0x5481f7[_0x492d('0x11')][_0x492d('0x13')]);return _0x5c8cd2(_0x5481f7[_0x492d('0x11')][_0x492d('0x13')]);}logger[_0x492d('0x11')](_0x492d('0xc'),_0x4ff851,_0x5481f7['error'][_0x492d('0x13')]);return _0x507eb7(_0x5481f7[_0x492d('0x11')][_0x492d('0x13')]);}else{logger[_0x492d('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4ff851,_0x492d('0xd'));_0x507eb7(_0x5481f7[_0x492d('0x14')][_0x492d('0x13')]);}})['catch'](function(_0x270a19){logger['error'](_0x492d('0xc'),_0x4ff851,_0x270a19);_0x5c8cd2(_0x270a19);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 8d05531..40b93f6 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 _0x0fbd=['update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','post','put'];(function(_0x3048ea,_0x3838c2){var _0x1a13c4=function(_0x2c6a6b){while(--_0x2c6a6b){_0x3048ea['push'](_0x3048ea['shift']());}};_0x1a13c4(++_0x3838c2);}(_0x0fbd,0xca));var _0xd0fb=function(_0x188fce,_0x91bc72){_0x188fce=_0x188fce-0x0;var _0x4ab1f7=_0x0fbd[_0x188fce];return _0x4ab1f7;};'use strict';var multer=require(_0xd0fb('0x0'));var util=require(_0xd0fb('0x1'));var path=require(_0xd0fb('0x2'));var timeout=require('connect-timeout');var express=require(_0xd0fb('0x3'));var router=express[_0xd0fb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd0fb('0x5'));var interaction=require(_0xd0fb('0x6'));var config=require('../../config/environment');var controller=require(_0xd0fb('0x7'));router[_0xd0fb('0x8')]('/',auth[_0xd0fb('0x9')](),controller[_0xd0fb('0xa')]);router[_0xd0fb('0x8')](_0xd0fb('0xb'),auth[_0xd0fb('0x9')](),controller['describe']);router['get'](_0xd0fb('0xc'),auth[_0xd0fb('0x9')](),controller[_0xd0fb('0xd')]);router['get'](_0xd0fb('0xe'),auth[_0xd0fb('0x9')](),controller[_0xd0fb('0xf')]);router[_0xd0fb('0x10')]('/',auth[_0xd0fb('0x9')](),controller['create']);router[_0xd0fb('0x11')](_0xd0fb('0xc'),auth[_0xd0fb('0x9')](),controller[_0xd0fb('0x12')]);router[_0xd0fb('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xd0fb('0x14')]);module[_0xd0fb('0x15')]=router; \ No newline at end of file +var _0xa60d=['getQuestions','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa60d,0x1a7));var _0xda60=function(_0x5277cc,_0x39d5a9){_0x5277cc=_0x5277cc-0x0;var _0x1bba2b=_0xa60d[_0x5277cc];return _0x1bba2b;};'use strict';var multer=require(_0xda60('0x0'));var util=require(_0xda60('0x1'));var path=require(_0xda60('0x2'));var timeout=require(_0xda60('0x3'));var express=require(_0xda60('0x4'));var router=express[_0xda60('0x5')]();var fs_extra=require(_0xda60('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xda60('0x7'));var config=require(_0xda60('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xda60('0x9')]('/',auth[_0xda60('0xa')](),controller[_0xda60('0xb')]);router[_0xda60('0x9')](_0xda60('0xc'),auth[_0xda60('0xa')](),controller[_0xda60('0xd')]);router[_0xda60('0x9')](_0xda60('0xe'),auth[_0xda60('0xa')](),controller[_0xda60('0xf')]);router['get'](_0xda60('0x10'),auth[_0xda60('0xa')](),controller[_0xda60('0x11')]);router[_0xda60('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xda60('0xe'),auth['isAuthenticated'](),controller[_0xda60('0x13')]);router[_0xda60('0x14')](_0xda60('0xe'),auth['isAuthenticated'](),controller[_0xda60('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 7ffcab0..312bada 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 _0xbbb2=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','exports','DATE','setDataValue','starttime','endtime'];(function(_0x45fcb9,_0x5dbc3c){var _0x112e03=function(_0x2b60b6){while(--_0x2b60b6){_0x45fcb9['push'](_0x45fcb9['shift']());}};_0x112e03(++_0x5dbc3c);}(_0xbbb2,0xdb));var _0x2bbb=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xbbb2[_0x3e44fa];return _0x2a0aba;};'use strict';var moment=require(_0x2bbb('0x0'));var Sequelize=require('sequelize');module[_0x2bbb('0x1')]={'starttime':{'type':Sequelize[_0x2bbb('0x2')],'set':function(_0x565bf3){this[_0x2bbb('0x3')](_0x2bbb('0x4'),_0x565bf3);this[_0x2bbb('0x3')](_0x2bbb('0x5'),moment()[_0x2bbb('0x6')](_0x2bbb('0x7')));}},'endtime':{'type':Sequelize[_0x2bbb('0x2')]},'membername':{'type':Sequelize[_0x2bbb('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x2bbb('0x8')]},'uniqueid':{'type':Sequelize[_0x2bbb('0x8')]},'calleridname':{'type':Sequelize[_0x2bbb('0x8')]},'calleridnum':{'type':Sequelize[_0x2bbb('0x8')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3526=['sequelize','exports','DATE','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3526,0x1ef));var _0x6352=function(_0x26c816,_0x32dabe){_0x26c816=_0x26c816-0x0;var _0x5685d0=_0x3526[_0x26c816];return _0x5685d0;};'use strict';var moment=require(_0x6352('0x0'));var Sequelize=require(_0x6352('0x1'));module[_0x6352('0x2')]={'starttime':{'type':Sequelize[_0x6352('0x3')],'set':function(_0x127bbf){this['setDataValue'](_0x6352('0x4'),_0x127bbf);this['setDataValue']('endtime',moment()[_0x6352('0x5')](_0x6352('0x6')));}},'endtime':{'type':Sequelize[_0x6352('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x6352('0x7')]},'queue':{'type':Sequelize[_0x6352('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6352('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 2921176..ecdaee7 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 _0x153c=['status','end','count','offset','limit','set','Content-Range','json','apply','reject','destroy','then','sendStatus','error','stack','name','send','map','JscriptySessionReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','create','body','find','describe','findOne','params','JscriptyQuestionReport','rawAttributes','length','SessionId','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/license/util'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x153c,0xcc));var _0xc153=function(_0x37ab73,_0xf1e575){_0x37ab73=_0x37ab73-0x0;var _0x3390c9=_0x153c[_0x37ab73];return _0x3390c9;};'use strict';var emlformat=require(_0xc153('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc153('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc153('0x2'));var moment=require(_0xc153('0x3'));var BPromise=require(_0xc153('0x4'));var Mustache=require('mustache');var util=require(_0xc153('0x5'));var path=require(_0xc153('0x6'));var sox=require(_0xc153('0x7'));var csv=require('to-csv');var ejs=require(_0xc153('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc153('0x9'));var squel=require(_0xc153('0xa'));var crypto=require(_0xc153('0xb'));var jsforce=require(_0xc153('0xc'));var deskjs=require(_0xc153('0xd'));var toCsv=require(_0xc153('0xe'));var querystring=require(_0xc153('0xf'));var Papa=require('papaparse');var Redis=require(_0xc153('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc153('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc153('0x12'))(_0xc153('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc153('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112802,_0x4a7a17){_0x4a7a17=_0x4a7a17||0xcc;return function(_0x3be1ea){if(_0x3be1ea){return _0x112802['sendStatus'](_0x4a7a17);}return _0x112802[_0xc153('0x15')](_0x4a7a17)[_0xc153('0x16')]();};}function respondWithResult(_0x4240bb,_0x4cf079){_0x4cf079=_0x4cf079||0xc8;return function(_0x681ee9){if(_0x681ee9){return _0x4240bb[_0xc153('0x15')](_0x4cf079)['json'](_0x681ee9);}};}function respondWithFilteredResult(_0x498c1d,_0x3a06e5){return function(_0xc17610){if(_0xc17610){var _0x7db16d=typeof _0x3a06e5['offset']==='undefined'&&typeof _0x3a06e5['limit']==='undefined';var _0xa378ff=_0xc17610[_0xc153('0x17')];var _0x11234e=_0x7db16d?0x0:_0x3a06e5[_0xc153('0x18')];var _0xf57c7f=_0x7db16d?_0xc17610[_0xc153('0x17')]:_0x3a06e5['offset']+_0x3a06e5[_0xc153('0x19')];var _0x40d7a9;if(_0xf57c7f>=_0xa378ff){_0xf57c7f=_0xa378ff;_0x40d7a9=0xc8;}else{_0x40d7a9=0xce;}_0x498c1d[_0xc153('0x15')](_0x40d7a9);return _0x498c1d[_0xc153('0x1a')](_0xc153('0x1b'),_0x11234e+'-'+_0xf57c7f+'/'+_0xa378ff)[_0xc153('0x1c')](_0xc17610);}return null;};}function patchUpdates(_0x11516d){return function(_0x2c8193){try{jsonpatch[_0xc153('0x1d')](_0x2c8193,_0x11516d,!![]);}catch(_0x5707bf){return BPromise[_0xc153('0x1e')](_0x5707bf);}return _0x2c8193['save']();};}function saveUpdates(_0x10039a,_0x2b0fe1){return function(_0x1ef956){if(_0x1ef956){return _0x1ef956['update'](_0x10039a)['then'](function(_0x3817b2){return _0x3817b2;});}return null;};}function removeEntity(_0x529b17,_0xdf84a4){return function(_0x21546d){if(_0x21546d){return _0x21546d[_0xc153('0x1f')]()[_0xc153('0x20')](function(){_0x529b17[_0xc153('0x15')](0xcc)[_0xc153('0x16')]();});}};}function handleEntityNotFound(_0x3cd63,_0x32d3c2){return function(_0xe21a95){if(!_0xe21a95){_0x3cd63[_0xc153('0x21')](0x194);}return _0xe21a95;};}function handleError(_0x3288b2,_0x521944){_0x521944=_0x521944||0x1f4;return function(_0x463ad8){logger[_0xc153('0x22')](_0x463ad8[_0xc153('0x23')]);if(_0x463ad8[_0xc153('0x24')]){delete _0x463ad8[_0xc153('0x24')];}_0x3288b2[_0xc153('0x15')](_0x521944)[_0xc153('0x25')](_0x463ad8);};}exports['index']=function(_0x522a21,_0x20d117){var _0x48110a={},_0x3fe938={},_0x56045f={'count':0x0,'rows':[]};var _0x161cb5=_[_0xc153('0x26')](db[_0xc153('0x27')]['rawAttributes'],function(_0x1b9073){return{'name':_0x1b9073[_0xc153('0x28')],'type':_0x1b9073[_0xc153('0x29')][_0xc153('0x2a')]};});_0x3fe938[_0xc153('0x2b')]=_[_0xc153('0x26')](_0x161cb5,_0xc153('0x24'));_0x3fe938[_0xc153('0x2c')]=_[_0xc153('0x2d')](_0x522a21[_0xc153('0x2c')]);_0x3fe938[_0xc153('0x2e')]=_[_0xc153('0x2f')](_0x3fe938['model'],_0x3fe938[_0xc153('0x2c')]);_0x48110a[_0xc153('0x30')]=_[_0xc153('0x2f')](_0x3fe938[_0xc153('0x2b')],qs[_0xc153('0x31')](_0x522a21[_0xc153('0x2c')]['fields']));_0x48110a['attributes']=_0x48110a[_0xc153('0x30')]['length']?_0x48110a[_0xc153('0x30')]:_0x3fe938[_0xc153('0x2b')];if(!_0x522a21[_0xc153('0x2c')][_0xc153('0x32')](_0xc153('0x33'))){_0x48110a[_0xc153('0x19')]=qs[_0xc153('0x19')](_0x522a21[_0xc153('0x2c')]['limit']);_0x48110a[_0xc153('0x18')]=qs['offset'](_0x522a21[_0xc153('0x2c')]['offset']);}_0x48110a[_0xc153('0x34')]=qs['sort'](_0x522a21[_0xc153('0x2c')][_0xc153('0x35')]);_0x48110a[_0xc153('0x36')]=qs['filters'](_['pick'](_0x522a21[_0xc153('0x2c')],_0x3fe938[_0xc153('0x2e')]),_0x161cb5);if(_0x522a21[_0xc153('0x2c')][_0xc153('0x37')]){_0x48110a['where']=_[_0xc153('0x38')](_0x48110a['where'],{'$or':_[_0xc153('0x26')](_0x161cb5,function(_0x5787fa){if(_0x5787fa['type']!==_0xc153('0x39')){var _0x2d54f6={};_0x2d54f6[_0x5787fa[_0xc153('0x24')]]={'$like':'%'+_0x522a21[_0xc153('0x2c')]['filter']+'%'};return _0x2d54f6;}})});}_0x48110a=_[_0xc153('0x38')]({},_0x48110a,_0x522a21[_0xc153('0x3a')]);var _0x5ae78e={'where':_0x48110a[_0xc153('0x36')]};return db['JscriptySessionReport'][_0xc153('0x17')](_0x5ae78e)['then'](function(_0x35e2fe){_0x56045f[_0xc153('0x17')]=_0x35e2fe;if(_0x522a21[_0xc153('0x2c')][_0xc153('0x3b')]){_0x48110a[_0xc153('0x3c')]=[{'all':!![]}];}return db[_0xc153('0x27')][_0xc153('0x3d')](_0x48110a);})[_0xc153('0x20')](function(_0x632d8a){_0x56045f[_0xc153('0x3e')]=_0x632d8a;return _0x56045f;})[_0xc153('0x20')](respondWithFilteredResult(_0x20d117,_0x48110a))[_0xc153('0x3f')](handleError(_0x20d117,null));};exports[_0xc153('0x40')]=function(_0x22cdcb,_0x557a0d){var _0x4c7660={'raw':!![],'where':{'id':_0x22cdcb['params']['id']}},_0x35ce5b={};_0x35ce5b[_0xc153('0x2b')]=_['keys'](db[_0xc153('0x27')]['rawAttributes']);_0x35ce5b[_0xc153('0x2c')]=_[_0xc153('0x2d')](_0x22cdcb[_0xc153('0x2c')]);_0x35ce5b['filters']=_['intersection'](_0x35ce5b[_0xc153('0x2b')],_0x35ce5b[_0xc153('0x2c')]);_0x4c7660[_0xc153('0x30')]=_['intersection'](_0x35ce5b[_0xc153('0x2b')],qs['fields'](_0x22cdcb['query']['fields']));_0x4c7660[_0xc153('0x30')]=_0x4c7660[_0xc153('0x30')]['length']?_0x4c7660[_0xc153('0x30')]:_0x35ce5b['model'];if(_0x22cdcb[_0xc153('0x2c')][_0xc153('0x3b')]){_0x4c7660['include']=[{'all':!![]}];}_0x4c7660=_[_0xc153('0x38')]({},_0x4c7660,_0x22cdcb[_0xc153('0x3a')]);return db[_0xc153('0x27')]['find'](_0x4c7660)[_0xc153('0x20')](handleEntityNotFound(_0x557a0d,null))[_0xc153('0x20')](respondWithResult(_0x557a0d,null))['catch'](handleError(_0x557a0d,null));};exports[_0xc153('0x41')]=function(_0x3c2859,_0x422ed3){return db['JscriptySessionReport'][_0xc153('0x41')](_0x3c2859[_0xc153('0x42')],{})['then'](respondWithResult(_0x422ed3,0xc9))['catch'](handleError(_0x422ed3,null));};exports['update']=function(_0x108651,_0x46d620){if(_0x108651[_0xc153('0x42')]['id']){delete _0x108651[_0xc153('0x42')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x108651['params']['id']}})[_0xc153('0x20')](handleEntityNotFound(_0x46d620,null))['then'](saveUpdates(_0x108651[_0xc153('0x42')],null))[_0xc153('0x20')](respondWithResult(_0x46d620,null))[_0xc153('0x3f')](handleError(_0x46d620,null));};exports[_0xc153('0x1f')]=function(_0x482dbe,_0x1daaed){return db[_0xc153('0x27')][_0xc153('0x43')]({'where':{'id':_0x482dbe['params']['id']}})[_0xc153('0x20')](handleEntityNotFound(_0x1daaed,null))[_0xc153('0x20')](removeEntity(_0x1daaed,null))['catch'](handleError(_0x1daaed,null));};exports[_0xc153('0x44')]=function(_0xd7e5b5,_0x3a02b2){return db[_0xc153('0x27')][_0xc153('0x44')]()[_0xc153('0x20')](respondWithResult(_0x3a02b2,null))[_0xc153('0x3f')](handleError(_0x3a02b2,null));};exports['getQuestions']=function(_0x2f23f8,_0x33fa98,_0x15c564){var _0x34bae3={'raw':!![],'where':{}};var _0x4b4723={};var _0x4bdd59={'count':0x0,'rows':[]};return db[_0xc153('0x27')][_0xc153('0x45')]({'where':{'id':_0x2f23f8[_0xc153('0x46')]['id']}})[_0xc153('0x20')](handleEntityNotFound(_0x33fa98,null))[_0xc153('0x20')](function(_0x275ab1){if(_0x275ab1){_0x4b4723['model']=_[_0xc153('0x2d')](db[_0xc153('0x47')][_0xc153('0x48')]);_0x4b4723[_0xc153('0x2c')]=_['keys'](_0x2f23f8[_0xc153('0x2c')]);_0x4b4723[_0xc153('0x2e')]=_[_0xc153('0x2f')](_0x4b4723[_0xc153('0x2b')],_0x4b4723[_0xc153('0x2c')]);_0x34bae3[_0xc153('0x30')]=_[_0xc153('0x2f')](_0x4b4723[_0xc153('0x2b')],qs[_0xc153('0x31')](_0x2f23f8[_0xc153('0x2c')][_0xc153('0x31')]));_0x34bae3[_0xc153('0x30')]=_0x34bae3[_0xc153('0x30')][_0xc153('0x49')]?_0x34bae3['attributes']:_0x4b4723[_0xc153('0x2b')];if(!_0x2f23f8[_0xc153('0x2c')][_0xc153('0x32')]('nolimit')){_0x34bae3[_0xc153('0x19')]=qs['limit'](_0x2f23f8[_0xc153('0x2c')]['limit']);_0x34bae3[_0xc153('0x18')]=qs[_0xc153('0x18')](_0x2f23f8[_0xc153('0x2c')]['offset']);}_0x34bae3[_0xc153('0x34')]=qs[_0xc153('0x35')](_0x2f23f8[_0xc153('0x2c')]['sort']);_0x34bae3[_0xc153('0x36')]=qs[_0xc153('0x2e')](_['pick'](_0x2f23f8['query'],_0x4b4723[_0xc153('0x2e')]));_0x34bae3[_0xc153('0x36')][_0xc153('0x4a')]=_0x275ab1['id'];if(_0x2f23f8['query'][_0xc153('0x37')]){_0x34bae3[_0xc153('0x36')]=_[_0xc153('0x38')](_0x34bae3['where'],{'$or':_[_0xc153('0x26')](_0x34bae3[_0xc153('0x30')],function(_0x1e529e){var _0x224785={};_0x224785[_0x1e529e]={'$like':'%'+_0x2f23f8['query'][_0xc153('0x37')]+'%'};return _0x224785;})});}_0x34bae3=_['merge']({},_0x34bae3,_0x2f23f8[_0xc153('0x3a')]);return db[_0xc153('0x47')][_0xc153('0x17')]({'where':_0x34bae3['where']})[_0xc153('0x20')](function(_0x58b824){_0x4bdd59['count']=_0x58b824;if(_0x2f23f8['query'][_0xc153('0x3b')]){_0x34bae3['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xc153('0x3d')](_0x34bae3);})[_0xc153('0x20')](function(_0x402ac5){_0x4bdd59[_0xc153('0x3e')]=_0x402ac5;return _0x4bdd59;});}})[_0xc153('0x20')](respondWithFilteredResult(_0x33fa98,_0x34bae3))['catch'](handleError(_0x33fa98,null));}; \ No newline at end of file +var _0xb3b3=['create','body','destroy','describe','getQuestions','JscriptyQuestionReport','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','save','update','then','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','count','include','rows','show','params','includeAll','find','catch'];(function(_0x26474a,_0x3cfcfd){var _0x32e0e0=function(_0x2b110f){while(--_0x2b110f){_0x26474a['push'](_0x26474a['shift']());}};_0x32e0e0(++_0x3cfcfd);}(_0xb3b3,0x15b));var _0x3b3b=function(_0x3bc3ae,_0x115198){_0x3bc3ae=_0x3bc3ae-0x0;var _0x45bb04=_0xb3b3[_0x3bc3ae];return _0x45bb04;};'use strict';var emlformat=require(_0x3b3b('0x0'));var rimraf=require(_0x3b3b('0x1'));var zipdir=require(_0x3b3b('0x2'));var jsonpatch=require(_0x3b3b('0x3'));var rp=require(_0x3b3b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3b3b('0x5'));var path=require(_0x3b3b('0x6'));var sox=require('sox');var csv=require(_0x3b3b('0x7'));var ejs=require(_0x3b3b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b3b('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3b3b('0x7'));var querystring=require(_0x3b3b('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b3b('0xb'));var as=require(_0x3b3b('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b3b('0xd'))('api');var utils=require(_0x3b3b('0xe'));var config=require(_0x3b3b('0xf'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b3b('0x10'))['db'];function respondWithStatusCode(_0x1b0498,_0xa6e0bc){_0xa6e0bc=_0xa6e0bc||0xcc;return function(_0x88d834){if(_0x88d834){return _0x1b0498[_0x3b3b('0x11')](_0xa6e0bc);}return _0x1b0498['status'](_0xa6e0bc)[_0x3b3b('0x12')]();};}function respondWithResult(_0x39ff11,_0x4d4031){_0x4d4031=_0x4d4031||0xc8;return function(_0x3bcc66){if(_0x3bcc66){return _0x39ff11[_0x3b3b('0x13')](_0x4d4031)[_0x3b3b('0x14')](_0x3bcc66);}};}function respondWithFilteredResult(_0x5bdd0b,_0x123581){return function(_0x1026a6){if(_0x1026a6){var _0x1b2f25=typeof _0x123581[_0x3b3b('0x15')]==='undefined'&&typeof _0x123581[_0x3b3b('0x16')]===_0x3b3b('0x17');var _0x4be9f4=_0x1026a6['count'];var _0x42e848=_0x1b2f25?0x0:_0x123581[_0x3b3b('0x15')];var _0xd5b801=_0x1b2f25?_0x1026a6['count']:_0x123581['offset']+_0x123581[_0x3b3b('0x16')];var _0x5d2db9;if(_0xd5b801>=_0x4be9f4){_0xd5b801=_0x4be9f4;_0x5d2db9=0xc8;}else{_0x5d2db9=0xce;}_0x5bdd0b[_0x3b3b('0x13')](_0x5d2db9);return _0x5bdd0b['set']('Content-Range',_0x42e848+'-'+_0xd5b801+'/'+_0x4be9f4)[_0x3b3b('0x14')](_0x1026a6);}return null;};}function patchUpdates(_0x12998d){return function(_0x153f40){try{jsonpatch['apply'](_0x153f40,_0x12998d,!![]);}catch(_0x923cdb){return BPromise['reject'](_0x923cdb);}return _0x153f40[_0x3b3b('0x18')]();};}function saveUpdates(_0x110529,_0x150658){return function(_0xe38f90){if(_0xe38f90){return _0xe38f90[_0x3b3b('0x19')](_0x110529)[_0x3b3b('0x1a')](function(_0x3ff275){return _0x3ff275;});}return null;};}function removeEntity(_0x460cbf,_0x166e39){return function(_0xf031ba){if(_0xf031ba){return _0xf031ba['destroy']()[_0x3b3b('0x1a')](function(){_0x460cbf[_0x3b3b('0x13')](0xcc)[_0x3b3b('0x12')]();});}};}function handleEntityNotFound(_0x3d3d02,_0x3c98fb){return function(_0x2d10e2){if(!_0x2d10e2){_0x3d3d02[_0x3b3b('0x11')](0x194);}return _0x2d10e2;};}function handleError(_0x188c71,_0x4ac769){_0x4ac769=_0x4ac769||0x1f4;return function(_0x2cfb08){logger['error'](_0x2cfb08[_0x3b3b('0x1b')]);if(_0x2cfb08[_0x3b3b('0x1c')]){delete _0x2cfb08[_0x3b3b('0x1c')];}_0x188c71[_0x3b3b('0x13')](_0x4ac769)[_0x3b3b('0x1d')](_0x2cfb08);};}exports['index']=function(_0x31e37e,_0x109800){var _0x167bc9={},_0x23d331={},_0x3ce919={'count':0x0,'rows':[]};var _0x170731=_[_0x3b3b('0x1e')](db[_0x3b3b('0x1f')][_0x3b3b('0x20')],function(_0x13511a){return{'name':_0x13511a[_0x3b3b('0x21')],'type':_0x13511a[_0x3b3b('0x22')][_0x3b3b('0x23')]};});_0x23d331[_0x3b3b('0x24')]=_['map'](_0x170731,'name');_0x23d331[_0x3b3b('0x25')]=_[_0x3b3b('0x26')](_0x31e37e[_0x3b3b('0x25')]);_0x23d331[_0x3b3b('0x27')]=_[_0x3b3b('0x28')](_0x23d331[_0x3b3b('0x24')],_0x23d331[_0x3b3b('0x25')]);_0x167bc9[_0x3b3b('0x29')]=_[_0x3b3b('0x28')](_0x23d331[_0x3b3b('0x24')],qs[_0x3b3b('0x2a')](_0x31e37e[_0x3b3b('0x25')][_0x3b3b('0x2a')]));_0x167bc9[_0x3b3b('0x29')]=_0x167bc9[_0x3b3b('0x29')][_0x3b3b('0x2b')]?_0x167bc9['attributes']:_0x23d331['model'];if(!_0x31e37e[_0x3b3b('0x25')][_0x3b3b('0x2c')](_0x3b3b('0x2d'))){_0x167bc9['limit']=qs[_0x3b3b('0x16')](_0x31e37e[_0x3b3b('0x25')][_0x3b3b('0x16')]);_0x167bc9[_0x3b3b('0x15')]=qs[_0x3b3b('0x15')](_0x31e37e[_0x3b3b('0x25')][_0x3b3b('0x15')]);}_0x167bc9[_0x3b3b('0x2e')]=qs[_0x3b3b('0x2f')](_0x31e37e['query'][_0x3b3b('0x2f')]);_0x167bc9['where']=qs[_0x3b3b('0x27')](_[_0x3b3b('0x30')](_0x31e37e[_0x3b3b('0x25')],_0x23d331[_0x3b3b('0x27')]),_0x170731);if(_0x31e37e[_0x3b3b('0x25')][_0x3b3b('0x31')]){_0x167bc9['where']=_[_0x3b3b('0x32')](_0x167bc9[_0x3b3b('0x33')],{'$or':_['map'](_0x170731,function(_0x18deb4){if(_0x18deb4['type']!=='VIRTUAL'){var _0x33baff={};_0x33baff[_0x18deb4[_0x3b3b('0x1c')]]={'$like':'%'+_0x31e37e['query'][_0x3b3b('0x31')]+'%'};return _0x33baff;}})});}_0x167bc9=_[_0x3b3b('0x32')]({},_0x167bc9,_0x31e37e[_0x3b3b('0x34')]);var _0x2d8aea={'where':_0x167bc9[_0x3b3b('0x33')]};return db[_0x3b3b('0x1f')][_0x3b3b('0x35')](_0x2d8aea)[_0x3b3b('0x1a')](function(_0x15f26b){_0x3ce919['count']=_0x15f26b;if(_0x31e37e[_0x3b3b('0x25')]['includeAll']){_0x167bc9[_0x3b3b('0x36')]=[{'all':!![]}];}return db[_0x3b3b('0x1f')]['findAll'](_0x167bc9);})[_0x3b3b('0x1a')](function(_0x2cfffb){_0x3ce919[_0x3b3b('0x37')]=_0x2cfffb;return _0x3ce919;})[_0x3b3b('0x1a')](respondWithFilteredResult(_0x109800,_0x167bc9))['catch'](handleError(_0x109800,null));};exports[_0x3b3b('0x38')]=function(_0x62adcf,_0xaa72d){var _0x45191f={'raw':!![],'where':{'id':_0x62adcf[_0x3b3b('0x39')]['id']}},_0x5476a6={};_0x5476a6[_0x3b3b('0x24')]=_[_0x3b3b('0x26')](db[_0x3b3b('0x1f')]['rawAttributes']);_0x5476a6[_0x3b3b('0x25')]=_[_0x3b3b('0x26')](_0x62adcf['query']);_0x5476a6['filters']=_[_0x3b3b('0x28')](_0x5476a6[_0x3b3b('0x24')],_0x5476a6[_0x3b3b('0x25')]);_0x45191f[_0x3b3b('0x29')]=_[_0x3b3b('0x28')](_0x5476a6[_0x3b3b('0x24')],qs[_0x3b3b('0x2a')](_0x62adcf['query'][_0x3b3b('0x2a')]));_0x45191f[_0x3b3b('0x29')]=_0x45191f[_0x3b3b('0x29')]['length']?_0x45191f[_0x3b3b('0x29')]:_0x5476a6[_0x3b3b('0x24')];if(_0x62adcf[_0x3b3b('0x25')][_0x3b3b('0x3a')]){_0x45191f['include']=[{'all':!![]}];}_0x45191f=_[_0x3b3b('0x32')]({},_0x45191f,_0x62adcf['options']);return db['JscriptySessionReport'][_0x3b3b('0x3b')](_0x45191f)[_0x3b3b('0x1a')](handleEntityNotFound(_0xaa72d,null))[_0x3b3b('0x1a')](respondWithResult(_0xaa72d,null))[_0x3b3b('0x3c')](handleError(_0xaa72d,null));};exports['create']=function(_0x2ab63b,_0x473940){return db[_0x3b3b('0x1f')][_0x3b3b('0x3d')](_0x2ab63b[_0x3b3b('0x3e')],{})['then'](respondWithResult(_0x473940,0xc9))['catch'](handleError(_0x473940,null));};exports[_0x3b3b('0x19')]=function(_0x1079dc,_0x428518){if(_0x1079dc[_0x3b3b('0x3e')]['id']){delete _0x1079dc[_0x3b3b('0x3e')]['id'];}return db[_0x3b3b('0x1f')][_0x3b3b('0x3b')]({'where':{'id':_0x1079dc[_0x3b3b('0x39')]['id']}})[_0x3b3b('0x1a')](handleEntityNotFound(_0x428518,null))[_0x3b3b('0x1a')](saveUpdates(_0x1079dc[_0x3b3b('0x3e')],null))['then'](respondWithResult(_0x428518,null))[_0x3b3b('0x3c')](handleError(_0x428518,null));};exports[_0x3b3b('0x3f')]=function(_0x7eef14,_0x4ae4be){return db['JscriptySessionReport'][_0x3b3b('0x3b')]({'where':{'id':_0x7eef14[_0x3b3b('0x39')]['id']}})['then'](handleEntityNotFound(_0x4ae4be,null))[_0x3b3b('0x1a')](removeEntity(_0x4ae4be,null))['catch'](handleError(_0x4ae4be,null));};exports[_0x3b3b('0x40')]=function(_0x440de0,_0x1b5408){return db[_0x3b3b('0x1f')][_0x3b3b('0x40')]()['then'](respondWithResult(_0x1b5408,null))[_0x3b3b('0x3c')](handleError(_0x1b5408,null));};exports[_0x3b3b('0x41')]=function(_0x2d0ce5,_0xce41d,_0xb146bd){var _0x282552={'raw':!![],'where':{}};var _0x4567c4={};var _0x5c62ee={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x2d0ce5['params']['id']}})[_0x3b3b('0x1a')](handleEntityNotFound(_0xce41d,null))[_0x3b3b('0x1a')](function(_0xfb3b89){if(_0xfb3b89){_0x4567c4['model']=_[_0x3b3b('0x26')](db[_0x3b3b('0x42')][_0x3b3b('0x20')]);_0x4567c4[_0x3b3b('0x25')]=_['keys'](_0x2d0ce5['query']);_0x4567c4[_0x3b3b('0x27')]=_['intersection'](_0x4567c4['model'],_0x4567c4['query']);_0x282552['attributes']=_[_0x3b3b('0x28')](_0x4567c4['model'],qs[_0x3b3b('0x2a')](_0x2d0ce5[_0x3b3b('0x25')]['fields']));_0x282552[_0x3b3b('0x29')]=_0x282552[_0x3b3b('0x29')][_0x3b3b('0x2b')]?_0x282552[_0x3b3b('0x29')]:_0x4567c4[_0x3b3b('0x24')];if(!_0x2d0ce5[_0x3b3b('0x25')][_0x3b3b('0x2c')](_0x3b3b('0x2d'))){_0x282552['limit']=qs[_0x3b3b('0x16')](_0x2d0ce5[_0x3b3b('0x25')][_0x3b3b('0x16')]);_0x282552[_0x3b3b('0x15')]=qs[_0x3b3b('0x15')](_0x2d0ce5['query']['offset']);}_0x282552['order']=qs[_0x3b3b('0x2f')](_0x2d0ce5[_0x3b3b('0x25')][_0x3b3b('0x2f')]);_0x282552[_0x3b3b('0x33')]=qs[_0x3b3b('0x27')](_[_0x3b3b('0x30')](_0x2d0ce5[_0x3b3b('0x25')],_0x4567c4['filters']));_0x282552['where']['SessionId']=_0xfb3b89['id'];if(_0x2d0ce5['query']['filter']){_0x282552[_0x3b3b('0x33')]=_[_0x3b3b('0x32')](_0x282552['where'],{'$or':_['map'](_0x282552['attributes'],function(_0x32eedd){var _0x216b7f={};_0x216b7f[_0x32eedd]={'$like':'%'+_0x2d0ce5[_0x3b3b('0x25')][_0x3b3b('0x31')]+'%'};return _0x216b7f;})});}_0x282552=_['merge']({},_0x282552,_0x2d0ce5[_0x3b3b('0x34')]);return db[_0x3b3b('0x42')][_0x3b3b('0x35')]({'where':_0x282552[_0x3b3b('0x33')]})[_0x3b3b('0x1a')](function(_0x4a5f87){_0x5c62ee[_0x3b3b('0x35')]=_0x4a5f87;if(_0x2d0ce5[_0x3b3b('0x25')][_0x3b3b('0x3a')]){_0x282552[_0x3b3b('0x36')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x3b3b('0x43')](_0x282552);})[_0x3b3b('0x1a')](function(_0x2c9112){_0x5c62ee[_0x3b3b('0x37')]=_0x2c9112;return _0x5c62ee;});}})[_0x3b3b('0x1a')](respondWithFilteredResult(_0xce41d,_0x282552))[_0x3b3b('0x3c')](handleError(_0xce41d,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c38889f..864806e 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 _0x7217=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x7217,0x19e));var _0x7721=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x7217[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb65=['moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','util','../../config/logger'];(function(_0x7b65a0,_0x32e185){var _0x3000f2=function(_0x2c9f89){while(--_0x2c9f89){_0x7b65a0['push'](_0x7b65a0['shift']());}};_0x3000f2(++_0x32e185);}(_0xfb65,0x82));var _0x5fb6=function(_0x686734,_0x210104){_0x686734=_0x686734-0x0;var _0x59eebd=_0xfb65[_0x686734];return _0x59eebd;};'use strict';var _=require('lodash');var util=require(_0x5fb6('0x0'));var logger=require(_0x5fb6('0x1'))('api');var moment=require(_0x5fb6('0x2'));var BPromise=require('bluebird');var rp=require(_0x5fb6('0x3'));var fs=require('fs');var path=require(_0x5fb6('0x4'));var rimraf=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var attributes=require(_0x5fb6('0x7'));module[_0x5fb6('0x8')]=function(_0x4dec8f,_0x50782b){return _0x4dec8f[_0x5fb6('0x9')](_0x5fb6('0xa'),attributes,{'tableName':_0x5fb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index d294410..9236c12 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 _0x71ab=['http','request','then','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x722f61,_0x204596){var _0x269816=function(_0xd16913){while(--_0xd16913){_0x722f61['push'](_0x722f61['shift']());}};_0x269816(++_0x204596);}(_0x71ab,0x64));var _0xb71a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x71ab[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file +var _0xbbbc=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x1109eb,_0x68f359){var _0x120d4e=function(_0x570cff){while(--_0x570cff){_0x1109eb['push'](_0x1109eb['shift']());}};_0x120d4e(++_0x68f359);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x1f57e7,_0x31455f){_0x1f57e7=_0x1f57e7-0x0;var _0xc38613=_0xbbbc[_0x1f57e7];return _0xc38613;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5236844..6710184 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 _0x1952=['../../config/environment','./license.controller','index','put','/:id','isAuthenticated','util','path','express','fs-extra'];(function(_0x513b05,_0x18a9b4){var _0x198004=function(_0x588eb5){while(--_0x588eb5){_0x513b05['push'](_0x513b05['shift']());}};_0x198004(++_0x18a9b4);}(_0x1952,0x92));var _0x2195=function(_0x1bbdff,_0x4ad87e){_0x1bbdff=_0x1bbdff-0x0;var _0x17a43d=_0x1952[_0x1bbdff];return _0x17a43d;};'use strict';var multer=require('multer');var util=require(_0x2195('0x0'));var path=require(_0x2195('0x1'));var timeout=require('connect-timeout');var express=require(_0x2195('0x2'));var router=express['Router']();var fs_extra=require(_0x2195('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2195('0x4'));var controller=require(_0x2195('0x5'));router['get']('/',controller[_0x2195('0x6')]);router[_0x2195('0x7')](_0x2195('0x8'),auth[_0x2195('0x9')](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x3ffb=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','update','exports','multer'];(function(_0x4c771b,_0x2c230c){var _0x45f461=function(_0x4d5753){while(--_0x4d5753){_0x4c771b['push'](_0x4c771b['shift']());}};_0x45f461(++_0x2c230c);}(_0x3ffb,0x13f));var _0xb3ff=function(_0x2a5f13,_0x7c63ce){_0x2a5f13=_0x2a5f13-0x0;var _0x5b26ce=_0x3ffb[_0x2a5f13];return _0x5b26ce;};'use strict';var multer=require(_0xb3ff('0x0'));var util=require(_0xb3ff('0x1'));var path=require(_0xb3ff('0x2'));var timeout=require(_0xb3ff('0x3'));var express=require(_0xb3ff('0x4'));var router=express['Router']();var fs_extra=require(_0xb3ff('0x5'));var auth=require(_0xb3ff('0x6'));var interaction=require(_0xb3ff('0x7'));var config=require(_0xb3ff('0x8'));var controller=require(_0xb3ff('0x9'));router[_0xb3ff('0xa')]('/',controller[_0xb3ff('0xb')]);router['put'](_0xb3ff('0xc'),auth[_0xb3ff('0xd')](),controller[_0xb3ff('0xe')]);module[_0xb3ff('0xf')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2b34dc9..5f51e1f 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 _0x2aba=['exports','TEXT','STRING','sequelize'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x2aba,0x127));var _0xa2ab=function(_0x3c082a,_0x39fe84){_0x3c082a=_0x3c082a-0x0;var _0x4fad0e=_0x2aba[_0x3c082a];return _0x4fad0e;};'use strict';var Sequelize=require(_0xa2ab('0x0'));module[_0xa2ab('0x1')]={'license':{'type':Sequelize[_0xa2ab('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xa2ab('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3424=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x528b74,_0xb4471b){var _0x13e688=function(_0x1bc646){while(--_0x1bc646){_0x528b74['push'](_0x528b74['shift']());}};_0x13e688(++_0xb4471b);}(_0x3424,0x1d0));var _0x4342=function(_0x37983a,_0x255f7b){_0x37983a=_0x37983a-0x0;var _0x6de8e3=_0x3424[_0x37983a];return _0x6de8e3;};'use strict';var Sequelize=require(_0x4342('0x0'));module[_0x4342('0x1')]={'license':{'type':Sequelize[_0x4342('0x2')]},'data1':{'type':Sequelize[_0x4342('0x3')]},'data2':{'type':Sequelize[_0x4342('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x4342('0x4')],'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 d6dcf13..17ca042 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 _0x53ec=['Content-Range','apply','reject','save','then','sendStatus','name','send','index','model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','update','body','find','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x5a9be3,_0x23dd47){var _0x1e93de=function(_0x57b283){while(--_0x57b283){_0x5a9be3['push'](_0x5a9be3['shift']());}};_0x1e93de(++_0x23dd47);}(_0x53ec,0x192));var _0xc53e=function(_0x4aa2c9,_0x3c74e5){_0x4aa2c9=_0x4aa2c9-0x0;var _0x212e33=_0x53ec[_0x4aa2c9];return _0x212e33;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];function respondWithStatusCode(_0x863fa,_0x4203aa){_0x4203aa=_0x4203aa||0xcc;return function(_0x56f0e5){if(_0x56f0e5){return _0x863fa['sendStatus'](_0x4203aa);}return _0x863fa[_0xc53e('0x18')](_0x4203aa)[_0xc53e('0x19')]();};}function respondWithResult(_0x7cd798,_0x3d2e17){_0x3d2e17=_0x3d2e17||0xc8;return function(_0x358ef3){if(_0x358ef3){return _0x7cd798[_0xc53e('0x18')](_0x3d2e17)[_0xc53e('0x1a')](_0x358ef3);}};}function respondWithFilteredResult(_0x19c0d1,_0x455e4d){return function(_0x2ad6eb){if(_0x2ad6eb){var _0x5b0a88=typeof _0x455e4d[_0xc53e('0x1b')]===_0xc53e('0x1c')&&typeof _0x455e4d[_0xc53e('0x1d')]===_0xc53e('0x1c');var _0x15333b=_0x2ad6eb[_0xc53e('0x1e')];var _0x164016=_0x5b0a88?0x0:_0x455e4d[_0xc53e('0x1b')];var _0x3b550e=_0x5b0a88?_0x2ad6eb['count']:_0x455e4d['offset']+_0x455e4d[_0xc53e('0x1d')];var _0x2a5bac;if(_0x3b550e>=_0x15333b){_0x3b550e=_0x15333b;_0x2a5bac=0xc8;}else{_0x2a5bac=0xce;}_0x19c0d1[_0xc53e('0x18')](_0x2a5bac);return _0x19c0d1[_0xc53e('0x1f')](_0xc53e('0x20'),_0x164016+'-'+_0x3b550e+'/'+_0x15333b)[_0xc53e('0x1a')](_0x2ad6eb);}return null;};}function patchUpdates(_0x15a015){return function(_0x25702b){try{jsonpatch[_0xc53e('0x21')](_0x25702b,_0x15a015,!![]);}catch(_0x401af6){return BPromise[_0xc53e('0x22')](_0x401af6);}return _0x25702b[_0xc53e('0x23')]();};}function saveUpdates(_0x426467,_0x4fb695){return function(_0x47cfdd){if(_0x47cfdd){return _0x47cfdd['update'](_0x426467)[_0xc53e('0x24')](function(_0x384218){return _0x384218;});}return null;};}function removeEntity(_0x7591c1,_0x4015c8){return function(_0x180811){if(_0x180811){return _0x180811['destroy']()['then'](function(){_0x7591c1[_0xc53e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae55e,_0x3a5ce8){return function(_0x443179){if(!_0x443179){_0x1ae55e[_0xc53e('0x25')](0x194);}return _0x443179;};}function handleError(_0x63c5dc,_0x4df8cf){_0x4df8cf=_0x4df8cf||0x1f4;return function(_0x398e7a){logger['error'](_0x398e7a['stack']);if(_0x398e7a['name']){delete _0x398e7a[_0xc53e('0x26')];}_0x63c5dc['status'](_0x4df8cf)[_0xc53e('0x27')](_0x398e7a);};}var utilLicense=require('../../config/license/util');exports[_0xc53e('0x28')]=function(_0x5112d2,_0x5ce216){var _0x8f0ee6={'raw':!![],'where':{'id':0x1}},_0x6a62b0={};_0x6a62b0[_0xc53e('0x29')]=_[_0xc53e('0x2a')](db[_0xc53e('0x2b')][_0xc53e('0x2c')]);_0x6a62b0[_0xc53e('0x2d')]=_[_0xc53e('0x2a')](_0x5112d2['query']);_0x6a62b0[_0xc53e('0x2e')]=_[_0xc53e('0x2f')](_0x6a62b0[_0xc53e('0x29')],_0x6a62b0['query']);_0x8f0ee6[_0xc53e('0x30')]=_['intersection'](_0x6a62b0[_0xc53e('0x29')],qs[_0xc53e('0x31')](_0x5112d2['query']['fields']));_0x8f0ee6[_0xc53e('0x30')]=_0x8f0ee6[_0xc53e('0x30')][_0xc53e('0x32')]?_0x8f0ee6[_0xc53e('0x30')]:_0x6a62b0[_0xc53e('0x29')];_0x8f0ee6=_[_0xc53e('0x33')]({},_0x8f0ee6,_0x5112d2[_0xc53e('0x34')]);return utilLicense[_0xc53e('0x35')](_0x8f0ee6)['then'](respondWithResult(_0x5ce216,null))[_0xc53e('0x36')](handleError(_0x5ce216,null));};exports[_0xc53e('0x37')]=function(_0x19020b,_0x17ad32){if(_0x19020b[_0xc53e('0x38')]['id']){delete _0x19020b[_0xc53e('0x38')]['id'];}return db[_0xc53e('0x2b')][_0xc53e('0x39')]({'where':{'id':_0x19020b[_0xc53e('0x3a')]['id']}})['then'](handleEntityNotFound(_0x17ad32,null))[_0xc53e('0x24')](function(_0x48d7d0){var _0x1059f3=_0x48d7d0[_0xc53e('0x3b')]({'plain':!![]});return utilLicense['checkLicense'](_0x1059f3,_0x19020b[_0xc53e('0x38')][_0xc53e('0x3c')]);})[_0xc53e('0x24')](function(_0x5ed90b){if(!_0x5ed90b[_0xc53e('0x3d')]){return saveUpdates(_0x19020b[_0xc53e('0x38')],null);}return _0x5ed90b;})[_0xc53e('0x24')](respondWithResult(_0x17ad32,null))[_0xc53e('0x36')](handleError(_0x17ad32,null));}; \ No newline at end of file +var _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x41f524,_0x5cbdc1){var _0x50c071=function(_0x3100db){while(--_0x3100db){_0x41f524['push'](_0x41f524['shift']());}};_0x50c071(++_0x5cbdc1);}(_0x814b,0x1a2));var _0xb814=function(_0x577077,_0x52f056){_0x577077=_0x577077-0x0;var _0x370769=_0x814b[_0x577077];return _0x370769;};'use strict';var emlformat=require(_0xb814('0x0'));var rimraf=require(_0xb814('0x1'));var zipdir=require(_0xb814('0x2'));var jsonpatch=require(_0xb814('0x3'));var rp=require(_0xb814('0x4'));var moment=require(_0xb814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb814('0x6'));var util=require(_0xb814('0x7'));var path=require(_0xb814('0x8'));var sox=require(_0xb814('0x9'));var csv=require(_0xb814('0xa'));var ejs=require(_0xb814('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb814('0xc'));var squel=require(_0xb814('0xd'));var crypto=require('crypto');var jsforce=require(_0xb814('0xe'));var deskjs=require(_0xb814('0xf'));var toCsv=require(_0xb814('0xa'));var querystring=require(_0xb814('0x10'));var Papa=require(_0xb814('0x11'));var Redis=require(_0xb814('0x12'));var authService=require(_0xb814('0x13'));var qs=require(_0xb814('0x14'));var as=require(_0xb814('0x15'));var hardwareService=require(_0xb814('0x16'));var logger=require(_0xb814('0x17'))('api');var utils=require(_0xb814('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb814('0x19'));var db=require(_0xb814('0x1a'))['db'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 1240708..6e72853 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 _0x9f3e=['License','util','api','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x20e72d,_0x4519f9){var _0x5504d1=function(_0x122e2a){while(--_0x122e2a){_0x20e72d['push'](_0x20e72d['shift']());}};_0x5504d1(++_0x4519f9);}(_0x9f3e,0x14e));var _0xe9f3=function(_0x229cc3,_0x361bd5){_0x229cc3=_0x229cc3-0x0;var _0x54619c=_0x9f3e[_0x229cc3];return _0x54619c;};'use strict';var _=require('lodash');var util=require(_0xe9f3('0x0'));var logger=require('../../config/logger')(_0xe9f3('0x1'));var moment=require('moment');var BPromise=require(_0xe9f3('0x2'));var rp=require(_0xe9f3('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9f3('0x4'));var config=require(_0xe9f3('0x5'));var attributes=require(_0xe9f3('0x6'));module[_0xe9f3('0x7')]=function(_0x35214b,_0x2500c9){return _0x35214b['define'](_0xe9f3('0x8'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52e5=['license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./license.attributes','exports','define','License'];(function(_0x47f820,_0x46e2f4){var _0x2ab1ba=function(_0x52a187){while(--_0x52a187){_0x47f820['push'](_0x47f820['shift']());}};_0x2ab1ba(++_0x46e2f4);}(_0x52e5,0x1c1));var _0x552e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x52e5[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x552e('0x0'));var util=require(_0x552e('0x1'));var logger=require(_0x552e('0x2'))(_0x552e('0x3'));var moment=require(_0x552e('0x4'));var BPromise=require(_0x552e('0x5'));var rp=require(_0x552e('0x6'));var fs=require('fs');var path=require(_0x552e('0x7'));var rimraf=require('rimraf');var config=require(_0x552e('0x8'));var attributes=require(_0x552e('0x9'));module[_0x552e('0xa')]=function(_0x24ba6b,_0x348aa5){return _0x24ba6b[_0x552e('0xb')](_0x552e('0xc'),attributes,{'tableName':_0x552e('0xd'),'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 796a481..e4b1e48 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 _0x320d=['License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','stringify','message','error','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x296120,_0x24f8e3){var _0x10c7c2=function(_0xd77ba6){while(--_0xd77ba6){_0x296120['push'](_0x296120['shift']());}};_0x10c7c2(++_0x24f8e3);}(_0x320d,0x15c));var _0xd320=function(_0x1277d7,_0x59fc70){_0x1277d7=_0x1277d7-0x0;var _0x2f8b7c=_0x320d[_0x1277d7];return _0x2f8b7c;};'use strict';var _=require(_0xd320('0x0'));var util=require(_0xd320('0x1'));var moment=require(_0xd320('0x2'));var BPromise=require(_0xd320('0x3'));var rs=require(_0xd320('0x4'));var fs=require('fs');var Redis=require(_0xd320('0x5'));var db=require(_0xd320('0x6'))['db'];var utils=require(_0xd320('0x7'));var logger=require(_0xd320('0x8'))(_0xd320('0x9'));var config=require(_0xd320('0xa'));var jayson=require(_0xd320('0xb'));var client=jayson[_0xd320('0xc')][_0xd320('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x37bd08,_0x55865b,_0x2a09ca){return new BPromise(function(_0x25d850,_0x1a7229){return client[_0xd320('0xe')](_0x37bd08,_0x2a09ca)[_0xd320('0xf')](function(_0x4c5da4){logger['info'](_0xd320('0x10'),_0x55865b,'request\x20sent');logger[_0xd320('0x11')](_0xd320('0x12'),_0x55865b,'request\x20sent',JSON[_0xd320('0x13')](_0x4c5da4));if(_0x4c5da4['error']){if(_0x4c5da4['error']['code']===0x1f4){logger['error'](_0xd320('0x10'),_0x55865b,_0x4c5da4['error']['message']);return _0x1a7229(_0x4c5da4['error'][_0xd320('0x14')]);}logger['error']('License,\x20%s,\x20%s',_0x55865b,_0x4c5da4[_0xd320('0x15')][_0xd320('0x14')]);return _0x25d850(_0x4c5da4[_0xd320('0x15')][_0xd320('0x14')]);}else{logger[_0xd320('0x16')](_0xd320('0x10'),_0x55865b,_0xd320('0x17'));_0x25d850(_0x4c5da4[_0xd320('0x18')]['message']);}})[_0xd320('0x19')](function(_0x5901fd){logger['error'](_0xd320('0x10'),_0x55865b,_0x5901fd);_0x1a7229(_0x5901fd);});});} \ No newline at end of file +var _0x717f=['../../config/environment','jayson/promise','client','http','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','License,\x20%s,\x20%s','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x33d4a2,_0x2baaf4){var _0x2c793f=function(_0x414303){while(--_0x414303){_0x33d4a2['push'](_0x33d4a2['shift']());}};_0x2c793f(++_0x2baaf4);}(_0x717f,0x1c4));var _0xf717=function(_0x4d167e,_0x510d66){_0x4d167e=_0x4d167e-0x0;var _0x12c754=_0x717f[_0x4d167e];return _0x12c754;};'use strict';var _=require(_0xf717('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf717('0x1'));var rs=require(_0xf717('0x2'));var fs=require('fs');var Redis=require(_0xf717('0x3'));var db=require(_0xf717('0x4'))['db'];var utils=require(_0xf717('0x5'));var logger=require(_0xf717('0x6'))(_0xf717('0x7'));var config=require(_0xf717('0x8'));var jayson=require(_0xf717('0x9'));var client=jayson[_0xf717('0xa')][_0xf717('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5120df,_0xa7445a,_0x586a6c){return new BPromise(function(_0x30a175,_0x26d5b7){return client['request'](_0x5120df,_0x586a6c)['then'](function(_0x23ef9d){logger['info']('License,\x20%s,\x20%s',_0xa7445a,_0xf717('0xc'));logger[_0xf717('0xd')](_0xf717('0xe'),_0xa7445a,_0xf717('0xc'),JSON[_0xf717('0xf')](_0x23ef9d));if(_0x23ef9d['error']){if(_0x23ef9d[_0xf717('0x10')][_0xf717('0x11')]===0x1f4){logger['error'](_0xf717('0x12'),_0xa7445a,_0x23ef9d['error']['message']);return _0x26d5b7(_0x23ef9d[_0xf717('0x10')][_0xf717('0x13')]);}logger['error']('License,\x20%s,\x20%s',_0xa7445a,_0x23ef9d['error'][_0xf717('0x13')]);return _0x30a175(_0x23ef9d[_0xf717('0x10')][_0xf717('0x13')]);}else{logger[_0xf717('0x14')]('License,\x20%s,\x20%s',_0xa7445a,_0xf717('0xc'));_0x30a175(_0x23ef9d[_0xf717('0x15')]['message']);}})[_0xf717('0x16')](function(_0x483c06){logger['error']('License,\x20%s,\x20%s',_0xa7445a,_0x483c06);_0x26d5b7(_0x483c06);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 6c50561..5e01274 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 _0x0643=['/:id/applications','getApplications','getMessages','/:id/verify','verifySmtp','addDisposition','addAnswer','post','create','/:id/in_servers','/:id/interactions','addApplications','/:id/send','send','/:id/users','put','update','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','getSmtp'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0x0643,0x168));var _0x3064=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0x0643[_0x5465e6];return _0x10044e;};'use strict';var multer=require(_0x3064('0x0'));var util=require(_0x3064('0x1'));var path=require(_0x3064('0x2'));var timeout=require(_0x3064('0x3'));var express=require('express');var router=express[_0x3064('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3064('0x5'));var controller=require('./mailAccount.controller');router[_0x3064('0x6')]('/',auth[_0x3064('0x7')](),controller[_0x3064('0x8')]);router[_0x3064('0x6')](_0x3064('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x3064('0x6')](_0x3064('0xa'),auth[_0x3064('0x7')](),controller[_0x3064('0xb')]);router[_0x3064('0x6')](_0x3064('0xc'),auth['isAuthenticated'](),controller[_0x3064('0xd')]);router[_0x3064('0x6')](_0x3064('0xe'),auth[_0x3064('0x7')](),controller['getAnswers']);router[_0x3064('0x6')]('/:id/in_servers',auth[_0x3064('0x7')](),controller[_0x3064('0xf')]);router[_0x3064('0x6')](_0x3064('0x10'),auth[_0x3064('0x7')](),controller[_0x3064('0x11')]);router[_0x3064('0x6')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x3064('0x6')](_0x3064('0x12'),auth[_0x3064('0x7')](),controller[_0x3064('0x13')]);router[_0x3064('0x6')]('/:id/messages',auth['isAuthenticated'](),controller[_0x3064('0x14')]);router['get'](_0x3064('0x15'),auth['isAuthenticated'](),controller[_0x3064('0x16')]);router['get']('/:id/users',auth[_0x3064('0x7')](),controller['getAgents']);router['post'](_0x3064('0xc'),auth[_0x3064('0x7')](),controller[_0x3064('0x17')]);router['post']('/:id/canned_answers',auth[_0x3064('0x7')](),controller[_0x3064('0x18')]);router[_0x3064('0x19')]('/',auth['isAuthenticated'](),controller[_0x3064('0x1a')]);router[_0x3064('0x19')](_0x3064('0x1b'),auth[_0x3064('0x7')](),controller['addImap']);router[_0x3064('0x19')]('/:id/out_servers',auth['isAuthenticated'](),controller['addSmtp']);router[_0x3064('0x19')](_0x3064('0x1c'),auth[_0x3064('0x7')](),controller['addInteraction']);router[_0x3064('0x19')](_0x3064('0x12'),auth[_0x3064('0x7')](),controller[_0x3064('0x1d')]);router[_0x3064('0x19')](_0x3064('0x1e'),auth[_0x3064('0x7')](),controller[_0x3064('0x1f')]);router['post'](_0x3064('0x20'),auth[_0x3064('0x7')](),controller['addAgents']);router[_0x3064('0x21')]('/:id',auth[_0x3064('0x7')](),controller[_0x3064('0x22')]);router['delete'](_0x3064('0xc'),auth[_0x3064('0x7')](),controller[_0x3064('0x23')]);router[_0x3064('0x24')]('/:id/canned_answers',auth[_0x3064('0x7')](),controller[_0x3064('0x25')]);router[_0x3064('0x24')]('/:id/in_servers',auth[_0x3064('0x7')](),controller[_0x3064('0x26')]);router[_0x3064('0x24')](_0x3064('0x10'),auth[_0x3064('0x7')](),controller[_0x3064('0x27')]);router[_0x3064('0x24')](_0x3064('0xa'),auth[_0x3064('0x7')](),controller[_0x3064('0x28')]);router[_0x3064('0x24')](_0x3064('0x20'),auth[_0x3064('0x7')](),controller[_0x3064('0x29')]);module['exports']=router; \ No newline at end of file +var _0xc0e4=['update','delete','removeAnswers','removeSmtp','removeAgents','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','verifySmtp','/:id/users','post','addAnswer','create','addSmtp','addInteraction','send','addAgents','put','/:id'];(function(_0x1b1715,_0x3d0c47){var _0x514b90=function(_0xf39b79){while(--_0xf39b79){_0x1b1715['push'](_0x1b1715['shift']());}};_0x514b90(++_0x3d0c47);}(_0xc0e4,0x132));var _0x4c0e=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xc0e4[_0x2becba];return _0x90b5dd;};'use strict';var multer=require(_0x4c0e('0x0'));var util=require(_0x4c0e('0x1'));var path=require(_0x4c0e('0x2'));var timeout=require('connect-timeout');var express=require(_0x4c0e('0x3'));var router=express[_0x4c0e('0x4')]();var fs_extra=require(_0x4c0e('0x5'));var auth=require(_0x4c0e('0x6'));var interaction=require(_0x4c0e('0x7'));var config=require(_0x4c0e('0x8'));var controller=require(_0x4c0e('0x9'));router[_0x4c0e('0xa')]('/',auth[_0x4c0e('0xb')](),controller[_0x4c0e('0xc')]);router[_0x4c0e('0xa')](_0x4c0e('0xd'),auth[_0x4c0e('0xb')](),controller['describe']);router[_0x4c0e('0xa')]('/:id',auth[_0x4c0e('0xb')](),controller[_0x4c0e('0xe')]);router[_0x4c0e('0xa')](_0x4c0e('0xf'),auth['isAuthenticated'](),controller[_0x4c0e('0x10')]);router[_0x4c0e('0xa')](_0x4c0e('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x4c0e('0xa')](_0x4c0e('0x12'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x13')]);router['get'](_0x4c0e('0x14'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x15')]);router[_0x4c0e('0xa')](_0x4c0e('0x16'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x17')]);router[_0x4c0e('0xa')](_0x4c0e('0x18'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x19')]);router[_0x4c0e('0xa')](_0x4c0e('0x1a'),auth[_0x4c0e('0xb')](),controller['getMessages']);router[_0x4c0e('0xa')]('/:id/verify',auth['isAuthenticated'](),controller[_0x4c0e('0x1b')]);router[_0x4c0e('0xa')](_0x4c0e('0x1c'),auth[_0x4c0e('0xb')](),controller['getAgents']);router['post'](_0x4c0e('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x4c0e('0x1d')](_0x4c0e('0x11'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x1e')]);router['post']('/',auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x1f')]);router[_0x4c0e('0x1d')](_0x4c0e('0x12'),auth[_0x4c0e('0xb')](),controller['addImap']);router[_0x4c0e('0x1d')](_0x4c0e('0x14'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x20')]);router[_0x4c0e('0x1d')](_0x4c0e('0x16'),auth['isAuthenticated'](),controller[_0x4c0e('0x21')]);router[_0x4c0e('0x1d')](_0x4c0e('0x18'),auth[_0x4c0e('0xb')](),controller['addApplications']);router[_0x4c0e('0x1d')]('/:id/send',auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x22')]);router[_0x4c0e('0x1d')](_0x4c0e('0x1c'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x23')]);router[_0x4c0e('0x24')](_0x4c0e('0x25'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x26')]);router[_0x4c0e('0x27')](_0x4c0e('0xf'),auth[_0x4c0e('0xb')](),controller['removeDispositions']);router[_0x4c0e('0x27')](_0x4c0e('0x11'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x28')]);router[_0x4c0e('0x27')](_0x4c0e('0x12'),auth[_0x4c0e('0xb')](),controller['removeImap']);router[_0x4c0e('0x27')](_0x4c0e('0x14'),auth[_0x4c0e('0xb')](),controller[_0x4c0e('0x29')]);router[_0x4c0e('0x27')](_0x4c0e('0x25'),auth[_0x4c0e('0xb')](),controller['destroy']);router[_0x4c0e('0x27')](_0x4c0e('0x1c'),auth['isAuthenticated'](),controller[_0x4c0e('0x2a')]);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 b69466c..09b8ba6 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 _0xa3e6=['sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x1b8e5c,_0x4ee590){var _0x7dac1d=function(_0x2aff9a){while(--_0x2aff9a){_0x1b8e5c['push'](_0x1b8e5c['shift']());}};_0x7dac1d(++_0x4ee590);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x359782,_0x247cf9){_0x359782=_0x359782-0x0;var _0x39063e=_0xa3e6[_0x359782];return _0x39063e;};'use strict';var Sequelize=require(_0x6a3e('0x0'));module['exports']={'description':{'type':Sequelize[_0x6a3e('0x1')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x6a3e('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x6a3e('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6a3e('0x2')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x6a3e('0x3')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6a3e('0x1')],'allowNull':![],'defaultValue':_0x6a3e('0x4')},'fontSize':{'type':Sequelize[_0x6a3e('0x5')](0x2)[_0x6a3e('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x6a3e('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x6a3e('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6a3e('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6a3e('0x5')],'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[_0x6a3e('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x6a3e('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xd21a09){if(!_0xd21a09)this[_0x6a3e('0x7')](_0x6a3e('0x8'),null);this[_0x6a3e('0x7')](_0x6a3e('0x9'),_0xd21a09);}}}; \ No newline at end of file +var _0xd847=['STRING','BOOLEAN','TEXT','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports'];(function(_0x397e63,_0x17cd03){var _0x4e1384=function(_0x10fb7e){while(--_0x10fb7e){_0x397e63['push'](_0x397e63['shift']());}};_0x4e1384(++_0x17cd03);}(_0xd847,0x18a));var _0x7d84=function(_0x28a901,_0x2e230a){_0x28a901=_0x28a901-0x0;var _0x3ae998=_0xd847[_0x28a901];return _0x3ae998;};'use strict';var Sequelize=require(_0x7d84('0x0'));module[_0x7d84('0x1')]={'description':{'type':Sequelize[_0x7d84('0x2')]},'name':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7d84('0x4')]},'markAsUnread':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7d84('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x7d84('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7d84('0x4')],'defaultValue':function(){return _0x7d84('0x6');}},'notificationSound':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7d84('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7d84('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x7d84('0x3')],'defaultValue':![],'comment':_0x7d84('0x8'),'set':function(_0x27aa7a){if(!_0x27aa7a)this[_0x7d84('0x9')](_0x7d84('0xa'),null);this[_0x7d84('0x9')](_0x7d84('0xb'),_0x27aa7a);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 38468d2..6bdef59 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 _0x0b97=['MailAccountId','Disposition','create','getDispositions','findOne','length','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','pass','cpassword','authentication','host','port','service','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setSmtp','addInteraction','omit','getInteractions','order','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','Contacts','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','List\x20not\x20found','List','CmContact','messageId','subject','attach','out','Interaction','MailInteraction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./mailAccount.socket','register','client','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','get','MailAccounts','UserProfileResource','end','stack','name','send','index','MailServerIn','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','filter','merge','MailAccount','include','findAll','rows','catch','show','params','intersection','includeAll','options','find','body','Smtp','describe'];(function(_0x2622db,_0x787979){var _0x2390a8=function(_0x512687){while(--_0x512687){_0x2622db['push'](_0x2622db['shift']());}};_0x2390a8(++_0x787979);}(_0x0b97,0x1e8));var _0x70b9=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0b97[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x70b9('0x0'));var rimraf=require(_0x70b9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x70b9('0x2'));var Mustache=require(_0x70b9('0x3'));var util=require(_0x70b9('0x4'));var path=require(_0x70b9('0x5'));var sox=require(_0x70b9('0x6'));var csv=require(_0x70b9('0x7'));var ejs=require(_0x70b9('0x8'));var fs=require('fs');var fs_extra=require(_0x70b9('0x9'));var _=require(_0x70b9('0xa'));var squel=require(_0x70b9('0xb'));var crypto=require(_0x70b9('0xc'));var jsforce=require(_0x70b9('0xd'));var deskjs=require(_0x70b9('0xe'));var toCsv=require(_0x70b9('0x7'));var querystring=require(_0x70b9('0xf'));var Papa=require(_0x70b9('0x10'));var htmlToText=require(_0x70b9('0x11'));var juice=require(_0x70b9('0x12'));var Redis=require(_0x70b9('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x70b9('0x14'));var hardwareService=require(_0x70b9('0x15'));var logger=require(_0x70b9('0x16'))(_0x70b9('0x17'));var utils=require('../../config/utils');var config=require(_0x70b9('0x18'));var licenseUtil=require(_0x70b9('0x19'));var db=require('../../mysqldb')['db'];config[_0x70b9('0x1a')]=_[_0x70b9('0x1b')](config[_0x70b9('0x1a')],{'host':_0x70b9('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x70b9('0x1a')]));require(_0x70b9('0x1d'))[_0x70b9('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x70b9('0x1f')]['http']({'port':0x232b});function respondWithRpcPromise(_0x85ec36,_0x36963b,_0x38efd9,_0x4f148b){return new BPromise(function(_0x454369,_0x4c45c0){var _0x3e8c30=_0x4f148b||client;return _0x3e8c30['request'](_0x85ec36,_0x38efd9)[_0x70b9('0x20')](function(_0x3a0e51){logger[_0x70b9('0x21')](_0x70b9('0x22'),_0x36963b,'request\x20sent');logger[_0x70b9('0x23')](_0x70b9('0x24'),_0x36963b,_0x70b9('0x25'),JSON[_0x70b9('0x26')](_0x3a0e51));if(_0x3a0e51[_0x70b9('0x27')]){if(_0x3a0e51['error'][_0x70b9('0x28')]===0x1f4){logger['error'](_0x70b9('0x22'),_0x36963b,_0x3a0e51['error'][_0x70b9('0x29')]);return _0x4c45c0(_0x3a0e51[_0x70b9('0x27')]['message']);}logger['error'](_0x70b9('0x22'),_0x36963b,_0x3a0e51[_0x70b9('0x27')][_0x70b9('0x29')]);return _0x454369(_0x3a0e51[_0x70b9('0x27')][_0x70b9('0x29')]);}else{logger['info'](_0x70b9('0x22'),_0x36963b,'request\x20sent');_0x454369(_0x3a0e51[_0x70b9('0x2a')][_0x70b9('0x29')]);}})['catch'](function(_0x3dc7ce){logger[_0x70b9('0x27')](_0x70b9('0x22'),_0x36963b,_0x3dc7ce);_0x4c45c0(_0x3dc7ce);});});}function respondWithStatusCode(_0x4849de,_0x5690a1){_0x5690a1=_0x5690a1||0xcc;return function(_0x5a08e0){if(_0x5a08e0){return _0x4849de[_0x70b9('0x2b')](_0x5690a1);}return _0x4849de[_0x70b9('0x2c')](_0x5690a1)['end']();};}function respondWithResult(_0x4e2dad,_0x5c3977){_0x5c3977=_0x5c3977||0xc8;return function(_0x57281b){if(_0x57281b){return _0x4e2dad[_0x70b9('0x2c')](_0x5c3977)['json'](_0x57281b);}};}function respondWithFilteredResult(_0x2a7156,_0x30ed7e){return function(_0x11cad8){if(_0x11cad8){var _0x2ad7f5=typeof _0x30ed7e[_0x70b9('0x2d')]===_0x70b9('0x2e')&&typeof _0x30ed7e[_0x70b9('0x2f')]===_0x70b9('0x2e');var _0x2dca28=_0x11cad8[_0x70b9('0x30')];var _0x2a7ee1=_0x2ad7f5?0x0:_0x30ed7e[_0x70b9('0x2d')];var _0x26e2d7=_0x2ad7f5?_0x11cad8[_0x70b9('0x30')]:_0x30ed7e[_0x70b9('0x2d')]+_0x30ed7e[_0x70b9('0x2f')];var _0x276225;if(_0x26e2d7>=_0x2dca28){_0x26e2d7=_0x2dca28;_0x276225=0xc8;}else{_0x276225=0xce;}_0x2a7156['status'](_0x276225);return _0x2a7156[_0x70b9('0x31')](_0x70b9('0x32'),_0x2a7ee1+'-'+_0x26e2d7+'/'+_0x2dca28)[_0x70b9('0x33')](_0x11cad8);}return null;};}function patchUpdates(_0x29066b){return function(_0x3bfa01){try{jsonpatch[_0x70b9('0x34')](_0x3bfa01,_0x29066b,!![]);}catch(_0x48f8a9){return BPromise['reject'](_0x48f8a9);}return _0x3bfa01[_0x70b9('0x35')]();};}function saveUpdates(_0x55b197,_0x30fa25){return function(_0x292bb9){if(_0x292bb9){return _0x292bb9[_0x70b9('0x36')](_0x55b197)['then'](function(_0x3e44ff){return _0x3e44ff;});}return null;};}function removeEntity(_0x4c9043,_0x2f5791){return function(_0x22428e){if(_0x22428e){return _0x22428e[_0x70b9('0x37')]()['then'](function(){var _0x36cb52=_0x22428e[_0x70b9('0x38')]({'plain':!![]});var _0x2bec81=_0x70b9('0x39');return db[_0x70b9('0x3a')][_0x70b9('0x37')]({'where':{'type':_0x2bec81,'resourceId':_0x36cb52['id']}})[_0x70b9('0x20')](function(){return _0x22428e;});})['then'](function(){_0x4c9043[_0x70b9('0x2c')](0xcc)[_0x70b9('0x3b')]();});}};}function handleEntityNotFound(_0x54ec46,_0x5b6bbf){return function(_0x5f51e7){if(!_0x5f51e7){_0x54ec46[_0x70b9('0x2b')](0x194);}return _0x5f51e7;};}function handleError(_0x784fe4,_0x5638c6){_0x5638c6=_0x5638c6||0x1f4;return function(_0x56019b){logger[_0x70b9('0x27')](_0x56019b[_0x70b9('0x3c')]);if(_0x56019b[_0x70b9('0x3d')]){delete _0x56019b[_0x70b9('0x3d')];}_0x784fe4[_0x70b9('0x2c')](_0x5638c6)[_0x70b9('0x3e')](_0x56019b);};}exports[_0x70b9('0x3f')]=function(_0x2403a9,_0x5871d7){var _0x328f6e={'include':[{'model':db[_0x70b9('0x40')],'as':_0x70b9('0x41')},{'model':db[_0x70b9('0x42')],'as':'Smtp'},{'model':db[_0x70b9('0x43')],'as':_0x70b9('0x44')}]},_0x2b2368={},_0x56f939={'count':0x0,'rows':[]};var _0x2df740=_[_0x70b9('0x45')](db['MailAccount'][_0x70b9('0x46')],function(_0x29cae7){return{'name':_0x29cae7[_0x70b9('0x47')],'type':_0x29cae7[_0x70b9('0x48')][_0x70b9('0x49')]};});_0x2b2368[_0x70b9('0x4a')]=_[_0x70b9('0x45')](_0x2df740,_0x70b9('0x3d'));_0x2b2368[_0x70b9('0x4b')]=_[_0x70b9('0x4c')](_0x2403a9[_0x70b9('0x4b')]);_0x2b2368[_0x70b9('0x4d')]=_['intersection'](_0x2b2368[_0x70b9('0x4a')],_0x2b2368['query']);_0x328f6e[_0x70b9('0x4e')]=_['intersection'](_0x2b2368[_0x70b9('0x4a')],qs[_0x70b9('0x4f')](_0x2403a9[_0x70b9('0x4b')][_0x70b9('0x4f')]));_0x328f6e[_0x70b9('0x4e')]=_0x328f6e['attributes']['length']?_0x328f6e[_0x70b9('0x4e')]:_0x2b2368[_0x70b9('0x4a')];if(!_0x2403a9[_0x70b9('0x4b')][_0x70b9('0x50')](_0x70b9('0x51'))){_0x328f6e[_0x70b9('0x2f')]=qs[_0x70b9('0x2f')](_0x2403a9[_0x70b9('0x4b')][_0x70b9('0x2f')]);_0x328f6e['offset']=qs[_0x70b9('0x2d')](_0x2403a9[_0x70b9('0x4b')][_0x70b9('0x2d')]);}_0x328f6e['order']=qs[_0x70b9('0x52')](_0x2403a9[_0x70b9('0x4b')][_0x70b9('0x52')]);_0x328f6e[_0x70b9('0x53')]=qs[_0x70b9('0x4d')](_['pick'](_0x2403a9['query'],_0x2b2368[_0x70b9('0x4d')]),_0x2df740);if(_0x2403a9[_0x70b9('0x4b')][_0x70b9('0x54')]){_0x328f6e['where']=_[_0x70b9('0x55')](_0x328f6e['where'],{'$or':_['map'](_0x2df740,function(_0x34497b){if(_0x34497b[_0x70b9('0x48')]!=='VIRTUAL'){var _0x4eb435={};_0x4eb435[_0x34497b['name']]={'$like':'%'+_0x2403a9[_0x70b9('0x4b')][_0x70b9('0x54')]+'%'};return _0x4eb435;}})});}_0x328f6e=_[_0x70b9('0x55')]({},_0x328f6e,_0x2403a9['options']);var _0x1ffcc8={'where':_0x328f6e[_0x70b9('0x53')]};return db[_0x70b9('0x56')][_0x70b9('0x30')](_0x1ffcc8)[_0x70b9('0x20')](function(_0x5092cd){_0x56f939[_0x70b9('0x30')]=_0x5092cd;if(_0x2403a9[_0x70b9('0x4b')]['includeAll']){_0x328f6e[_0x70b9('0x57')]=[{'all':!![]}];}return db[_0x70b9('0x56')][_0x70b9('0x58')](_0x328f6e);})['then'](function(_0x4d8683){_0x56f939[_0x70b9('0x59')]=_0x4d8683;return _0x56f939;})[_0x70b9('0x20')](respondWithFilteredResult(_0x5871d7,_0x328f6e))[_0x70b9('0x5a')](handleError(_0x5871d7,null));};exports[_0x70b9('0x5b')]=function(_0x3e62e5,_0x2e9983){var _0x5747ce={'raw':![],'where':{'id':_0x3e62e5[_0x70b9('0x5c')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x70b9('0x41')},{'model':db[_0x70b9('0x42')],'as':'Smtp'},{'model':db[_0x70b9('0x43')],'as':'mandatoryDispositionPause'}]},_0x2cb49d={};_0x2cb49d[_0x70b9('0x4a')]=_['keys'](db[_0x70b9('0x56')][_0x70b9('0x46')]);_0x2cb49d[_0x70b9('0x4b')]=_[_0x70b9('0x4c')](_0x3e62e5[_0x70b9('0x4b')]);_0x2cb49d['filters']=_[_0x70b9('0x5d')](_0x2cb49d[_0x70b9('0x4a')],_0x2cb49d[_0x70b9('0x4b')]);_0x5747ce[_0x70b9('0x4e')]=_[_0x70b9('0x5d')](_0x2cb49d[_0x70b9('0x4a')],qs[_0x70b9('0x4f')](_0x3e62e5['query'][_0x70b9('0x4f')]));_0x5747ce['attributes']=_0x5747ce['attributes']['length']?_0x5747ce[_0x70b9('0x4e')]:_0x2cb49d[_0x70b9('0x4a')];if(_0x3e62e5[_0x70b9('0x4b')][_0x70b9('0x5e')]){_0x5747ce[_0x70b9('0x57')]=[{'all':!![]}];}_0x5747ce=_[_0x70b9('0x55')]({},_0x5747ce,_0x3e62e5[_0x70b9('0x5f')]);return db['MailAccount'][_0x70b9('0x60')](_0x5747ce)[_0x70b9('0x20')](handleEntityNotFound(_0x2e9983,null))[_0x70b9('0x20')](respondWithResult(_0x2e9983,null))[_0x70b9('0x5a')](handleError(_0x2e9983,null));};exports['update']=function(_0x2e6391,_0x501fb2){if(_0x2e6391['body']['id']){delete _0x2e6391[_0x70b9('0x61')]['id'];}return db[_0x70b9('0x56')][_0x70b9('0x60')]({'where':{'id':_0x2e6391[_0x70b9('0x5c')]['id']},'include':[{'model':db[_0x70b9('0x40')],'as':_0x70b9('0x41')},{'model':db[_0x70b9('0x42')],'as':_0x70b9('0x62')},{'model':db[_0x70b9('0x43')],'as':'mandatoryDispositionPause'}]})[_0x70b9('0x20')](handleEntityNotFound(_0x501fb2,null))['then'](saveUpdates(_0x2e6391[_0x70b9('0x61')],null))[_0x70b9('0x20')](function(_0x19e63b){if(_0x19e63b&&_0x2e6391[_0x70b9('0x61')][_0x70b9('0x41')]){return db[_0x70b9('0x40')][_0x70b9('0x36')](_0x2e6391[_0x70b9('0x61')]['Imap'],{'where':{'MailAccountId':_0x19e63b['id']}})[_0x70b9('0x20')](function(){return _0x19e63b;});}return _0x19e63b;})[_0x70b9('0x20')](function(_0x151cf7){if(_0x151cf7&&_0x2e6391['body'][_0x70b9('0x62')]){return db[_0x70b9('0x42')]['update'](_0x2e6391[_0x70b9('0x61')][_0x70b9('0x62')],{'where':{'MailAccountId':_0x151cf7['id']}})['then'](function(){return _0x151cf7;});}return _0x151cf7;})[_0x70b9('0x20')](respondWithResult(_0x501fb2,null))['catch'](handleError(_0x501fb2,null));};exports[_0x70b9('0x63')]=function(_0x165a09,_0x59c83d){return db['MailAccount']['describe']()[_0x70b9('0x20')](respondWithResult(_0x59c83d,null))['catch'](handleError(_0x59c83d,null));};exports['addDisposition']=function(_0x14ea5e,_0x494e90,_0x157f6b){if(_0x14ea5e[_0x70b9('0x61')]['id']){delete _0x14ea5e[_0x70b9('0x61')]['id'];}return db[_0x70b9('0x56')][_0x70b9('0x60')]({'where':{'id':_0x14ea5e['params']['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x494e90,null))['then'](function(_0x34bbcb){if(_0x34bbcb){_0x14ea5e['body'][_0x70b9('0x64')]=_0x34bbcb['id'];return db[_0x70b9('0x65')][_0x70b9('0x66')](_0x14ea5e[_0x70b9('0x61')]);}})[_0x70b9('0x20')](respondWithResult(_0x494e90,null))['catch'](handleError(_0x494e90,null));};exports[_0x70b9('0x67')]=function(_0x36640c,_0x50e584,_0x46af16){var _0x3d0d7a={'raw':![],'where':{}};var _0x988d06={};var _0x114608={'count':0x0,'rows':[]};return db[_0x70b9('0x56')][_0x70b9('0x68')]({'where':{'id':_0x36640c['params']['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x50e584,null))[_0x70b9('0x20')](function(_0x261d77){if(_0x261d77){_0x988d06[_0x70b9('0x4a')]=_[_0x70b9('0x4c')](db['Disposition'][_0x70b9('0x46')]);_0x988d06[_0x70b9('0x4b')]=_['keys'](_0x36640c[_0x70b9('0x4b')]);_0x988d06[_0x70b9('0x4d')]=_['intersection'](_0x988d06[_0x70b9('0x4a')],_0x988d06['query']);_0x3d0d7a[_0x70b9('0x4e')]=_[_0x70b9('0x5d')](_0x988d06[_0x70b9('0x4a')],qs[_0x70b9('0x4f')](_0x36640c[_0x70b9('0x4b')]['fields']));_0x3d0d7a[_0x70b9('0x4e')]=_0x3d0d7a[_0x70b9('0x4e')][_0x70b9('0x69')]?_0x3d0d7a[_0x70b9('0x4e')]:_0x988d06['model'];if(!_0x36640c[_0x70b9('0x4b')]['hasOwnProperty']('nolimit')){_0x3d0d7a[_0x70b9('0x2f')]=qs['limit'](_0x36640c[_0x70b9('0x4b')][_0x70b9('0x2f')]);_0x3d0d7a[_0x70b9('0x2d')]=qs[_0x70b9('0x2d')](_0x36640c[_0x70b9('0x4b')]['offset']);}_0x3d0d7a['order']=qs[_0x70b9('0x52')](_0x36640c[_0x70b9('0x4b')][_0x70b9('0x52')]);_0x3d0d7a[_0x70b9('0x53')]=qs[_0x70b9('0x4d')](_[_0x70b9('0x6a')](_0x36640c['query'],_0x988d06['filters']));_0x3d0d7a[_0x70b9('0x53')][_0x70b9('0x64')]=_0x261d77['id'];if(_0x36640c['query'][_0x70b9('0x54')]){_0x3d0d7a['where']=_['merge'](_0x3d0d7a[_0x70b9('0x53')],{'$or':_[_0x70b9('0x45')](_0x3d0d7a[_0x70b9('0x4e')],function(_0x34177c){var _0x108294={};_0x108294[_0x34177c]={'$like':'%'+_0x36640c[_0x70b9('0x4b')][_0x70b9('0x54')]+'%'};return _0x108294;})});}_0x3d0d7a=_[_0x70b9('0x55')]({},_0x3d0d7a,_0x36640c[_0x70b9('0x5f')]);return db[_0x70b9('0x65')][_0x70b9('0x30')]({'where':_0x3d0d7a['where']})['then'](function(_0x2d401b){_0x114608[_0x70b9('0x30')]=_0x2d401b;if(_0x36640c[_0x70b9('0x4b')]['includeAll']){_0x3d0d7a[_0x70b9('0x57')]=[{'all':!![]}];}return db[_0x70b9('0x65')]['findAll'](_0x3d0d7a);})[_0x70b9('0x20')](function(_0x4bdba8){_0x114608[_0x70b9('0x59')]=_0x4bdba8;return _0x114608;});}})[_0x70b9('0x20')](respondWithFilteredResult(_0x50e584,_0x3d0d7a))[_0x70b9('0x5a')](handleError(_0x50e584,null));};exports[_0x70b9('0x6b')]=function(_0xc30d20,_0xab8ec2,_0x28c633){return db['MailAccount'][_0x70b9('0x60')]({'where':{'id':_0xc30d20[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0xab8ec2,null))[_0x70b9('0x20')](function(_0x37d35d){if(_0x37d35d){return _0x37d35d['removeDispositions'](_0xc30d20[_0x70b9('0x4b')][_0x70b9('0x6c')]);}})[_0x70b9('0x20')](respondWithStatusCode(_0xab8ec2,null))[_0x70b9('0x5a')](handleError(_0xab8ec2,null));};exports[_0x70b9('0x6d')]=function(_0x452aaf,_0x172437,_0x27a8ba){if(_0x452aaf[_0x70b9('0x61')]['id']){delete _0x452aaf['body']['id'];}return db[_0x70b9('0x56')][_0x70b9('0x60')]({'where':{'id':_0x452aaf[_0x70b9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x172437,null))[_0x70b9('0x20')](function(_0x278b51){if(_0x278b51){_0x452aaf[_0x70b9('0x61')][_0x70b9('0x64')]=_0x278b51['id'];return db[_0x70b9('0x6e')][_0x70b9('0x66')](_0x452aaf['body']);}})[_0x70b9('0x20')](respondWithResult(_0x172437,null))[_0x70b9('0x5a')](handleError(_0x172437,null));};exports[_0x70b9('0x6f')]=function(_0x4a80bd,_0x27cf9a,_0x1f8b04){var _0x31ff2a={'raw':![],'where':{}};var _0xb2286a={};var _0x5ec1c2={'count':0x0,'rows':[]};return db['MailAccount'][_0x70b9('0x68')]({'where':{'id':_0x4a80bd['params']['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x27cf9a,null))['then'](function(_0x545cdf){if(_0x545cdf){_0xb2286a['model']=_[_0x70b9('0x4c')](db['CannedAnswer'][_0x70b9('0x46')]);_0xb2286a[_0x70b9('0x4b')]=_[_0x70b9('0x4c')](_0x4a80bd[_0x70b9('0x4b')]);_0xb2286a[_0x70b9('0x4d')]=_[_0x70b9('0x5d')](_0xb2286a['model'],_0xb2286a[_0x70b9('0x4b')]);_0x31ff2a[_0x70b9('0x4e')]=_[_0x70b9('0x5d')](_0xb2286a[_0x70b9('0x4a')],qs['fields'](_0x4a80bd[_0x70b9('0x4b')][_0x70b9('0x4f')]));_0x31ff2a[_0x70b9('0x4e')]=_0x31ff2a[_0x70b9('0x4e')][_0x70b9('0x69')]?_0x31ff2a['attributes']:_0xb2286a[_0x70b9('0x4a')];if(!_0x4a80bd[_0x70b9('0x4b')][_0x70b9('0x50')](_0x70b9('0x51'))){_0x31ff2a[_0x70b9('0x2f')]=qs[_0x70b9('0x2f')](_0x4a80bd[_0x70b9('0x4b')][_0x70b9('0x2f')]);_0x31ff2a['offset']=qs[_0x70b9('0x2d')](_0x4a80bd['query'][_0x70b9('0x2d')]);}_0x31ff2a['order']=qs['sort'](_0x4a80bd[_0x70b9('0x4b')]['sort']);_0x31ff2a['where']=qs[_0x70b9('0x4d')](_[_0x70b9('0x6a')](_0x4a80bd['query'],_0xb2286a[_0x70b9('0x4d')]));_0x31ff2a[_0x70b9('0x53')][_0x70b9('0x64')]=_0x545cdf['id'];if(_0x4a80bd[_0x70b9('0x4b')]['filter']){_0x31ff2a[_0x70b9('0x53')]=_[_0x70b9('0x55')](_0x31ff2a[_0x70b9('0x53')],{'$or':_[_0x70b9('0x45')](_0x31ff2a[_0x70b9('0x4e')],function(_0x69b6cb){var _0x55977b={};_0x55977b[_0x69b6cb]={'$like':'%'+_0x4a80bd[_0x70b9('0x4b')][_0x70b9('0x54')]+'%'};return _0x55977b;})});}_0x31ff2a=_[_0x70b9('0x55')]({},_0x31ff2a,_0x4a80bd[_0x70b9('0x5f')]);return db[_0x70b9('0x6e')]['count']({'where':_0x31ff2a[_0x70b9('0x53')]})['then'](function(_0x200ee9){_0x5ec1c2[_0x70b9('0x30')]=_0x200ee9;if(_0x4a80bd['query'][_0x70b9('0x5e')]){_0x31ff2a[_0x70b9('0x57')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x31ff2a);})[_0x70b9('0x20')](function(_0x1126f3){_0x5ec1c2[_0x70b9('0x59')]=_0x1126f3;return _0x5ec1c2;});}})[_0x70b9('0x20')](respondWithFilteredResult(_0x27cf9a,_0x31ff2a))[_0x70b9('0x5a')](handleError(_0x27cf9a,null));};exports[_0x70b9('0x70')]=function(_0x4f24f2,_0x6126bc,_0x27e7bb){return db[_0x70b9('0x56')][_0x70b9('0x60')]({'where':{'id':_0x4f24f2[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x6126bc,null))[_0x70b9('0x20')](function(_0x407c8c){if(_0x407c8c){return _0x407c8c[_0x70b9('0x70')](_0x4f24f2['query'][_0x70b9('0x6c')]);}})[_0x70b9('0x20')](respondWithStatusCode(_0x6126bc,null))[_0x70b9('0x5a')](handleError(_0x6126bc,null));};exports[_0x70b9('0x66')]=function(_0x3a015d,_0x73cdf){var _0x271843={'name':_0x3a015d[_0x70b9('0x61')][_0x70b9('0x3d')],'key':_0x3a015d[_0x70b9('0x61')][_0x70b9('0x49')],'email':_0x3a015d['body'][_0x70b9('0x71')],'ListId':_0x3a015d[_0x70b9('0x61')][_0x70b9('0x72')],'active':!_[_0x70b9('0x73')](_0x3a015d[_0x70b9('0x61')][_0x70b9('0x74')])?_0x3a015d['body']['active']:!![],'description':_0x3a015d['body']['description']||null,'Imap':{},'Smtp':{}};if(_[_0x70b9('0x73')](_0x3a015d[_0x70b9('0x61')][_0x70b9('0x75')])){if(_0x3a015d[_0x70b9('0x61')][_0x70b9('0x76')]){_0x271843['Imap'][_0x70b9('0x77')]=_0x271843['Smtp'][_0x70b9('0x77')]=_0x3a015d['body'][_0x70b9('0x78')];_0x271843[_0x70b9('0x41')][_0x70b9('0x79')]=_0x271843[_0x70b9('0x62')][_0x70b9('0x7a')]=_0x3a015d['body'][_0x70b9('0x7b')];}else{_0x271843[_0x70b9('0x41')][_0x70b9('0x7c')]=_0x271843[_0x70b9('0x62')][_0x70b9('0x7c')]=![];}_0x271843[_0x70b9('0x41')][_0x70b9('0x7d')]=_0x3a015d[_0x70b9('0x61')][_0x70b9('0x41')][_0x70b9('0x7d')];_0x271843[_0x70b9('0x41')][_0x70b9('0x7e')]=_0x3a015d[_0x70b9('0x61')][_0x70b9('0x41')][_0x70b9('0x7e')];_0x271843[_0x70b9('0x62')][_0x70b9('0x7d')]=_0x3a015d[_0x70b9('0x61')][_0x70b9('0x62')][_0x70b9('0x7d')];_0x271843['Smtp'][_0x70b9('0x7e')]=_0x3a015d[_0x70b9('0x61')][_0x70b9('0x62')][_0x70b9('0x7e')];}else{_0x271843[_0x70b9('0x41')][_0x70b9('0x7f')]=_0x271843[_0x70b9('0x62')]['service']=_0x3a015d[_0x70b9('0x61')]['cservice'];_0x271843['Imap'][_0x70b9('0x77')]=_0x271843[_0x70b9('0x62')]['user']=_0x3a015d[_0x70b9('0x61')][_0x70b9('0x78')];_0x271843[_0x70b9('0x41')][_0x70b9('0x79')]=_0x271843[_0x70b9('0x62')][_0x70b9('0x7a')]=_0x3a015d[_0x70b9('0x61')][_0x70b9('0x7b')];}return db[_0x70b9('0x56')][_0x70b9('0x66')](_0x271843,{'include':[{'model':db['MailServerOut'],'as':_0x70b9('0x62')},{'model':db[_0x70b9('0x40')],'as':_0x70b9('0x41')}]})[_0x70b9('0x20')](function(_0x47f0ef){var _0xf4c125=_0x3a015d[_0x70b9('0x77')][_0x70b9('0x38')]({'plain':!![]});if(!_0xf4c125)throw new Error(_0x70b9('0x80'));if(_0xf4c125[_0x70b9('0x81')]==='user'){var _0x30c456=_0x47f0ef[_0x70b9('0x38')]({'plain':!![]});return db[_0x70b9('0x82')][_0x70b9('0x60')]({'where':{'name':_0x70b9('0x39'),'userProfileId':_0xf4c125[_0x70b9('0x83')]},'raw':!![]})[_0x70b9('0x20')](function(_0x2d6d48){if(_0x2d6d48&&_0x2d6d48['autoAssociation']===0x0){return db[_0x70b9('0x3a')]['create']({'name':_0x30c456[_0x70b9('0x3d')],'resourceId':_0x30c456['id'],'type':_0x2d6d48[_0x70b9('0x3d')],'sectionId':_0x2d6d48['id']},{})[_0x70b9('0x20')](function(){return _0x47f0ef;});}else{return _0x47f0ef;}})[_0x70b9('0x5a')](function(_0x5e8c4c){logger[_0x70b9('0x27')](_0x70b9('0x84'),_0x5e8c4c);throw _0x5e8c4c;});}return _0x47f0ef;})[_0x70b9('0x20')](respondWithResult(_0x73cdf,0xc9))[_0x70b9('0x5a')](handleError(_0x73cdf,null));};exports[_0x70b9('0x85')]=function(_0x4b709a,_0x42621a,_0x589198){return db['MailAccount'][_0x70b9('0x68')]({'where':{'id':_0x4b709a[_0x70b9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x42621a,null))['then'](function(_0x1664b3){if(_0x1664b3){return _0x1664b3[_0x70b9('0x85')]();}return null;})['then'](respondWithResult(_0x42621a,null))[_0x70b9('0x5a')](handleError(_0x42621a,null));};exports[_0x70b9('0x86')]=function(_0x243daa,_0x1e593a,_0x27fea4){if(_0x243daa[_0x70b9('0x61')]['id']){delete _0x243daa[_0x70b9('0x61')]['id'];}return db[_0x70b9('0x56')][_0x70b9('0x60')]({'where':{'id':_0x243daa[_0x70b9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1e593a,null))[_0x70b9('0x20')](function(_0x16d034){if(_0x16d034){_0x243daa[_0x70b9('0x61')][_0x70b9('0x64')]=_0x16d034['id'];return db['MailServerIn']['create'](_0x243daa[_0x70b9('0x61')]);}})['then'](respondWithResult(_0x1e593a,null))[_0x70b9('0x5a')](handleError(_0x1e593a,null));};exports[_0x70b9('0x87')]=function(_0x1f9799,_0x59e13,_0x5ab275){return db['MailAccount'][_0x70b9('0x68')]({'where':{'id':_0x1f9799[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x59e13,null))[_0x70b9('0x20')](function(_0x3f7530){if(_0x3f7530){return _0x3f7530['setImap'](null);}return null;})[_0x70b9('0x20')](respondWithStatusCode(_0x59e13,null))[_0x70b9('0x5a')](handleError(_0x59e13,null));};exports['getSmtp']=function(_0x5acd81,_0x9c2984,_0x168d62){return db['MailAccount'][_0x70b9('0x68')]({'where':{'id':_0x5acd81[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x9c2984,null))[_0x70b9('0x20')](function(_0x1fb64d){if(_0x1fb64d){return _0x1fb64d['getSmtp']();}return null;})[_0x70b9('0x20')](respondWithResult(_0x9c2984,null))[_0x70b9('0x5a')](handleError(_0x9c2984,null));};exports['addSmtp']=function(_0x3d32d3,_0x490073,_0x5f03d2){if(_0x3d32d3['body']['id']){delete _0x3d32d3[_0x70b9('0x61')]['id'];}return db['MailAccount'][_0x70b9('0x60')]({'where':{'id':_0x3d32d3[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x490073,null))[_0x70b9('0x20')](function(_0x5c7866){if(_0x5c7866){_0x3d32d3[_0x70b9('0x61')][_0x70b9('0x64')]=_0x5c7866['id'];return db['MailServerOut'][_0x70b9('0x66')](_0x3d32d3[_0x70b9('0x61')]);}})[_0x70b9('0x20')](respondWithResult(_0x490073,null))[_0x70b9('0x5a')](handleError(_0x490073,null));};exports['removeSmtp']=function(_0x3a14ef,_0x2bf022,_0x37906c){return db['MailAccount'][_0x70b9('0x68')]({'where':{'id':_0x3a14ef['params']['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x2bf022,null))['then'](function(_0x10c5bd){if(_0x10c5bd){return _0x10c5bd[_0x70b9('0x88')](null);}return null;})[_0x70b9('0x20')](respondWithStatusCode(_0x2bf022,null))[_0x70b9('0x5a')](handleError(_0x2bf022,null));};exports['addInteraction']=function(_0x186204,_0x38438e,_0xd33b92){return db['MailInteraction'][_0x70b9('0x60')]({'where':{'id':_0x186204['params']['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x38438e,null))[_0x70b9('0x20')](function(_0x1c242b){if(_0x1c242b){return _0x1c242b[_0x70b9('0x89')](_0x186204['body'][_0x70b9('0x6c')],_[_0x70b9('0x8a')](_0x186204[_0x70b9('0x61')],[_0x70b9('0x6c'),'id'])||{});}})[_0x70b9('0x20')](respondWithResult(_0x38438e,null))[_0x70b9('0x5a')](handleError(_0x38438e,null));};exports[_0x70b9('0x8b')]=function(_0x55bb2e,_0x227e6f,_0x443556){var _0xc53402={'raw':![],'where':{}};var _0x13d6fd={};var _0x1f5550={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x55bb2e['params']['id']}})['then'](handleEntityNotFound(_0x227e6f,null))[_0x70b9('0x20')](function(_0x59bed9){if(_0x59bed9){_0x13d6fd[_0x70b9('0x4a')]=_[_0x70b9('0x4c')](db['MailInteraction']['rawAttributes']);_0x13d6fd['query']=_[_0x70b9('0x4c')](_0x55bb2e[_0x70b9('0x4b')]);_0x13d6fd[_0x70b9('0x4d')]=_['intersection'](_0x13d6fd['model'],_0x13d6fd[_0x70b9('0x4b')]);_0xc53402['attributes']=_[_0x70b9('0x5d')](_0x13d6fd['model'],qs['fields'](_0x55bb2e[_0x70b9('0x4b')]['fields']));_0xc53402[_0x70b9('0x4e')]=_0xc53402['attributes'][_0x70b9('0x69')]?_0xc53402[_0x70b9('0x4e')]:_0x13d6fd[_0x70b9('0x4a')];if(!_0x55bb2e['query'][_0x70b9('0x50')]('nolimit')){_0xc53402[_0x70b9('0x2f')]=qs['limit'](_0x55bb2e[_0x70b9('0x4b')][_0x70b9('0x2f')]);_0xc53402['offset']=qs['offset'](_0x55bb2e[_0x70b9('0x4b')]['offset']);}_0xc53402[_0x70b9('0x8c')]=qs[_0x70b9('0x52')](_0x55bb2e[_0x70b9('0x4b')]['sort']);_0xc53402['where']=qs[_0x70b9('0x4d')](_[_0x70b9('0x6a')](_0x55bb2e[_0x70b9('0x4b')],_0x13d6fd['filters']));_0xc53402[_0x70b9('0x53')][_0x70b9('0x64')]=_0x59bed9['id'];if(_0x55bb2e[_0x70b9('0x4b')][_0x70b9('0x54')]){_0xc53402[_0x70b9('0x53')]=_['merge'](_0xc53402[_0x70b9('0x53')],{'$or':_[_0x70b9('0x45')](_0xc53402[_0x70b9('0x4e')],function(_0x1ed11e){var _0x2a16e7={};_0x2a16e7[_0x1ed11e]={'$like':'%'+_0x55bb2e['query']['filter']+'%'};return _0x2a16e7;})});}_0xc53402=_[_0x70b9('0x55')]({},_0xc53402,_0x55bb2e[_0x70b9('0x5f')]);return db['MailInteraction'][_0x70b9('0x30')]({'where':_0xc53402[_0x70b9('0x53')]})[_0x70b9('0x20')](function(_0x188dd9){_0x1f5550[_0x70b9('0x30')]=_0x188dd9;if(_0x55bb2e[_0x70b9('0x4b')][_0x70b9('0x5e')]){_0xc53402['include']=[{'model':db['CmContact'],'as':_0x70b9('0x8d'),'required':![]},{'model':db[_0x70b9('0x8e')],'as':_0x70b9('0x8f'),'attributes':['name',_0x70b9('0x90'),_0x70b9('0x91')],'required':![]},{'model':db['Tag'],'as':_0x70b9('0x92'),'attributes':['id','name','color'],'where':_0x55bb2e[_0x70b9('0x4b')][_0x70b9('0x93')]?{'id':_0x55bb2e[_0x70b9('0x4b')][_0x70b9('0x93')]}:undefined,'required':_0x55bb2e[_0x70b9('0x4b')][_0x70b9('0x93')]?!![]:![]}];}return db['MailInteraction'][_0x70b9('0x58')](_0xc53402);})['then'](function(_0x36fd02){_0x1f5550[_0x70b9('0x59')]=_0x36fd02;return _0x1f5550;});}})[_0x70b9('0x20')](respondWithFilteredResult(_0x227e6f,_0xc53402))[_0x70b9('0x5a')](handleError(_0x227e6f,null));};exports[_0x70b9('0x94')]=function(_0x485863,_0x4e65ba,_0x4e3454){return db['MailAccount'][_0x70b9('0x68')]({'where':{'id':_0x485863[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x4e65ba,null))[_0x70b9('0x20')](function(_0x531370){if(_0x531370){return db[_0x70b9('0x95')][_0x70b9('0x96')](function(_0x251fc2){return db['MailApplication']['destroy']({'where':{'MailAccountId':_0x485863[_0x70b9('0x5c')]['id']},'transaction':_0x251fc2})['then'](function(_0x4b1c46){var _0x2550a7=_[_0x70b9('0x45')](_0x485863[_0x70b9('0x61')],function(_0x37acff){_0x37acff[_0x70b9('0x64')]=_0x485863[_0x70b9('0x5c')]['id'];return _0x37acff;});return db[_0x70b9('0x97')][_0x70b9('0x98')](_0x2550a7,{'transaction':_0x251fc2});});})[_0x70b9('0x20')](function(){return db['MailApplication'][_0x70b9('0x99')]({'where':{'MailAccountId':_0x485863[_0x70b9('0x5c')]['id']},'order':_0x70b9('0x9a')});});}})[_0x70b9('0x20')](respondWithResult(_0x4e65ba,null))[_0x70b9('0x5a')](handleError(_0x4e65ba,null));};exports[_0x70b9('0x9b')]=function(_0x423995,_0x1caa59,_0x3230f7){var _0x5c94e1={};var _0x434cd3={};var _0x1c51a;var _0x54b3d0;return db[_0x70b9('0x56')][_0x70b9('0x68')]({'where':{'id':_0x423995[_0x70b9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1caa59,null))[_0x70b9('0x20')](function(_0x211841){if(_0x211841){_0x1c51a=_0x211841;_0x434cd3[_0x70b9('0x4a')]=_[_0x70b9('0x4c')](db[_0x70b9('0x97')][_0x70b9('0x46')]);_0x434cd3[_0x70b9('0x4b')]=_[_0x70b9('0x4c')](_0x423995[_0x70b9('0x4b')]);_0x434cd3[_0x70b9('0x4d')]=_[_0x70b9('0x5d')](_0x434cd3['model'],_0x434cd3[_0x70b9('0x4b')]);_0x5c94e1['attributes']=_[_0x70b9('0x5d')](_0x434cd3[_0x70b9('0x4a')],qs[_0x70b9('0x4f')](_0x423995['query'][_0x70b9('0x4f')]));_0x5c94e1[_0x70b9('0x4e')]=_0x5c94e1['attributes'][_0x70b9('0x69')]?_0x5c94e1[_0x70b9('0x4e')]:_0x434cd3[_0x70b9('0x4a')];_0x5c94e1[_0x70b9('0x8c')]=qs['sort'](_0x423995['query'][_0x70b9('0x52')]);_0x5c94e1['where']=qs[_0x70b9('0x4d')](_['pick'](_0x423995[_0x70b9('0x4b')],_0x434cd3[_0x70b9('0x4d')]));if(_0x423995[_0x70b9('0x4b')][_0x70b9('0x54')]){_0x5c94e1[_0x70b9('0x53')]=_[_0x70b9('0x55')](_0x5c94e1[_0x70b9('0x53')],{'$or':_[_0x70b9('0x45')](_0x5c94e1['attributes'],function(_0x53eb4b){var _0x26c9c3={};_0x26c9c3[_0x53eb4b]={'$like':'%'+_0x423995[_0x70b9('0x4b')][_0x70b9('0x54')]+'%'};return _0x26c9c3;})});}_0x5c94e1=_[_0x70b9('0x55')]({},_0x5c94e1,_0x423995['options']);return _0x1c51a[_0x70b9('0x9b')](_0x5c94e1);}})[_0x70b9('0x20')](function(_0x2607d9){if(_0x2607d9){_0x54b3d0=_0x2607d9[_0x70b9('0x69')];if(!_0x423995[_0x70b9('0x4b')]['hasOwnProperty'](_0x70b9('0x51'))){_0x5c94e1[_0x70b9('0x2f')]=qs[_0x70b9('0x2f')](_0x423995[_0x70b9('0x4b')][_0x70b9('0x2f')]);_0x5c94e1[_0x70b9('0x2d')]=qs[_0x70b9('0x2d')](_0x423995[_0x70b9('0x4b')][_0x70b9('0x2d')]);}return _0x1c51a[_0x70b9('0x9b')](_0x5c94e1);}})[_0x70b9('0x20')](function(_0x571968){if(_0x571968){return _0x571968?{'count':_0x54b3d0,'rows':_0x571968}:null;}})[_0x70b9('0x20')](respondWithResult(_0x1caa59,null))[_0x70b9('0x5a')](handleError(_0x1caa59,null));};exports[_0x70b9('0x9c')]=function(_0x4b4c9e,_0x363cc6,_0x5144e3){var _0x100fa1={'raw':!![],'where':{}};var _0x12eeba={};var _0x158f2a={'count':0x0,'rows':[]};return db[_0x70b9('0x56')][_0x70b9('0x68')]({'where':{'id':_0x4b4c9e[_0x70b9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x363cc6,null))[_0x70b9('0x20')](function(_0x5f33ed){if(_0x5f33ed){_0x12eeba[_0x70b9('0x4a')]=_[_0x70b9('0x4c')](db[_0x70b9('0x9d')][_0x70b9('0x46')]);_0x12eeba['query']=_[_0x70b9('0x4c')](_0x4b4c9e[_0x70b9('0x4b')]);_0x12eeba[_0x70b9('0x4d')]=_[_0x70b9('0x5d')](_0x12eeba[_0x70b9('0x4a')],_0x12eeba['query']);_0x100fa1[_0x70b9('0x4e')]=_['intersection'](_0x12eeba[_0x70b9('0x4a')],qs['fields'](_0x4b4c9e['query'][_0x70b9('0x4f')]));_0x100fa1['attributes']=_0x100fa1['attributes'][_0x70b9('0x69')]?_0x100fa1['attributes']:_0x12eeba['model'];if(!_0x4b4c9e[_0x70b9('0x4b')]['hasOwnProperty'](_0x70b9('0x51'))){_0x100fa1[_0x70b9('0x2f')]=qs[_0x70b9('0x2f')](_0x4b4c9e[_0x70b9('0x4b')][_0x70b9('0x2f')]);_0x100fa1[_0x70b9('0x2d')]=qs[_0x70b9('0x2d')](_0x4b4c9e['query'][_0x70b9('0x2d')]);}_0x100fa1[_0x70b9('0x8c')]=qs[_0x70b9('0x52')](_0x4b4c9e['query'][_0x70b9('0x52')]);_0x100fa1[_0x70b9('0x53')]=qs[_0x70b9('0x4d')](_['pick'](_0x4b4c9e[_0x70b9('0x4b')],_0x12eeba[_0x70b9('0x4d')]));_0x100fa1[_0x70b9('0x53')]['MailAccountId']=_0x5f33ed['id'];if(_0x4b4c9e[_0x70b9('0x4b')][_0x70b9('0x54')]){_0x100fa1['where']=_['merge'](_0x100fa1[_0x70b9('0x53')],{'$or':_[_0x70b9('0x45')](_0x100fa1[_0x70b9('0x4e')],function(_0x3b2e02){var _0xa51c49={};_0xa51c49[_0x3b2e02]={'$like':'%'+_0x4b4c9e[_0x70b9('0x4b')][_0x70b9('0x54')]+'%'};return _0xa51c49;})});}if(_0x4b4c9e['query']['$gte']){var _0x45d4c0=_0x4b4c9e[_0x70b9('0x4b')][_0x70b9('0x9e')][_0x70b9('0x9f')](',');var _0xf9dd46={};_0xf9dd46[_0x45d4c0[0x0]]={'$gte':moment(_0x45d4c0[0x1])[_0x70b9('0xa0')](_0x70b9('0xa1'))};_0x100fa1[_0x70b9('0x53')]=_[_0x70b9('0x55')](_0x100fa1['where'],_0xf9dd46);}_0x100fa1=_[_0x70b9('0x55')]({},_0x100fa1,_0x4b4c9e[_0x70b9('0x5f')]);return db['MailMessage'][_0x70b9('0x30')]({'where':_0x100fa1[_0x70b9('0x53')]})[_0x70b9('0x20')](function(_0x6d9528){_0x158f2a[_0x70b9('0x30')]=_0x6d9528;if(_0x4b4c9e[_0x70b9('0x4b')][_0x70b9('0x5e')]){_0x100fa1['include']=[{'all':!![]}];}return db[_0x70b9('0x9d')][_0x70b9('0x58')](_0x100fa1);})['then'](function(_0xbc72b8){if(_0x4b4c9e['query'][_0x70b9('0xa2')]===_0x70b9('0xa3')){for(var _0x6aa058=0x0;_0x6aa058<_0xbc72b8['length'];_0x6aa058++){_0xbc72b8[_0x6aa058][_0x70b9('0x61')]=juice(_0xbc72b8[_0x6aa058][_0x70b9('0x61')]);}}_0x158f2a[_0x70b9('0x59')]=_0xbc72b8;return _0x158f2a;});}})[_0x70b9('0x20')](respondWithFilteredResult(_0x363cc6,_0x100fa1))[_0x70b9('0x5a')](handleError(_0x363cc6,null));};exports[_0x70b9('0x3e')]=function(_0x761b3f,_0x10046a,_0x2b246a){var _0xb726e,_0x460872={},_0xc9efcc;if(_0x761b3f[_0x70b9('0x61')]['to']){_0xc9efcc=_0x761b3f['body']['to']['split'](',')[0x0];}return db[_0x70b9('0x56')]['find']({'where':{'id':_0x761b3f['params']['id']},'include':[{'model':db[_0x70b9('0xa4')],'as':'List','include':[{'model':db['CmContact'],'as':_0x70b9('0xa5'),'where':{'email':_0xc9efcc},'limit':0x1,'order':[[_0x70b9('0xa6'),_0x70b9('0xa7')]]}]},{'model':db[_0x70b9('0x42')],'as':_0x70b9('0x62'),'raw':!![]}]})['then'](handleEntityNotFound(_0x10046a,null))[_0x70b9('0x20')](function(_0x146eb0){if(_0x146eb0){_0xb726e=_0x146eb0;if(_0x146eb0['Smtp']){if(_[_0x70b9('0x73')](_0x761b3f[_0x70b9('0x61')]['from'])){_0x761b3f['body'][_0x70b9('0xa8')]=util[_0x70b9('0xa0')](_0x70b9('0xa9'),_0x146eb0[_0x70b9('0x3d')],_0x146eb0['email']||_0x146eb0[_0x70b9('0x62')][_0x70b9('0x77')]);}if(_0x761b3f[_0x70b9('0x61')]['attachments']&&_0x761b3f['body']['attachments'][_0x70b9('0x69')]){for(var _0x167e80=0x0;_0x167e80<_0x761b3f[_0x70b9('0x61')]['attachments'][_0x70b9('0x69')];_0x167e80+=0x1){_0x761b3f['body'][_0x70b9('0xaa')][_0x167e80]={'filename':_0x761b3f['body'][_0x70b9('0xaa')][_0x167e80][_0x70b9('0x3d')],'path':path['join'](config['root'],_0x70b9('0xab'),_0x761b3f[_0x70b9('0x61')][_0x70b9('0xaa')][_0x167e80][_0x70b9('0xac')])};}}var _0x8d8f66={'tls':{'rejectUnauthorized':![]}};if(_['isNil'](_0x146eb0['Smtp']['service'])){if(_0x146eb0[_0x70b9('0x62')][_0x70b9('0x7c')]){_0x8d8f66[_0x70b9('0xad')]={'user':_0x146eb0[_0x70b9('0x62')][_0x70b9('0x77')],'pass':_0x146eb0[_0x70b9('0x62')][_0x70b9('0x7a')]};}_0x8d8f66[_0x70b9('0x7d')]=_0x146eb0[_0x70b9('0x62')][_0x70b9('0x7d')];_0x8d8f66[_0x70b9('0x7e')]=_0x146eb0[_0x70b9('0x62')][_0x70b9('0x7e')];_0x8d8f66['secure']=_0x146eb0['Smtp'][_0x70b9('0xae')];}else{_0x8d8f66[_0x70b9('0x7f')]=_0x146eb0[_0x70b9('0x62')]['service'];_0x8d8f66[_0x70b9('0xad')]={'user':_0x146eb0[_0x70b9('0x62')][_0x70b9('0x77')],'pass':_0x146eb0[_0x70b9('0x62')][_0x70b9('0x7a')]};}return respondWithRpcPromise('SendMail','sendMail',{'account':_0x8d8f66,'message':_0x761b3f['body']});}else{throw new Error(_0x70b9('0xaf'));}}})[_0x70b9('0x20')](function(_0x1c59ea){if(_0x1c59ea){_0x460872=_0x1c59ea;if(_0xb726e['List']){if(_0xb726e[_0x70b9('0xb0')][_0x70b9('0xa5')]['length']){return _0xb726e[_0x70b9('0xb0')][_0x70b9('0xa5')][0x0];}else{return db[_0x70b9('0xb1')][_0x70b9('0x66')](_['defaults'](_0x761b3f['body'],{'firstName':_0x761b3f[_0x70b9('0x61')]['to'],'email':_0x761b3f[_0x70b9('0x61')]['to'],'phone':_0x761b3f[_0x70b9('0x61')]['to'],'ListId':_0xb726e[_0x70b9('0x72')]}));}}else{throw new Error(_0x70b9('0xaf'));}}})['then'](function(_0x367516){if(_0x367516){var _0xc2b444={'UserId':_0x761b3f['user']['id'],'ContactId':_0x367516['id'],'MailAccountId':_0xb726e['id'],'inReplyTo':_0x460872[_0x70b9('0xb2')],'to':_0x761b3f['body'][_0x70b9('0xa8')],'cc':_0x761b3f['body']['cc'],'subject':_0x761b3f[_0x70b9('0x61')][_0x70b9('0xb3')],'attach':_0x761b3f['body'][_0x70b9('0xb4')],'firstMsgDirection':_0x70b9('0xb5'),'lastMsgAt':moment()[_0x70b9('0xa0')](_0x70b9('0xa1')),'lastMsgDirection':'out','Messages':[_[_0x70b9('0x55')](_0x761b3f[_0x70b9('0x61')],{'messageId':_0x460872[_0x70b9('0xb2')],'sentAt':moment()[_0x70b9('0xa0')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0xb726e['id'],'UserId':_0x761b3f[_0x70b9('0x77')]['id'],'ContactId':_0x367516['id']})]};if(_0x761b3f[_0x70b9('0x61')][_0x70b9('0xb6')]){_0xc2b444=_['merge'](_0xc2b444,_0x761b3f['body'][_0x70b9('0xb6')]);}return db[_0x70b9('0xb7')][_0x70b9('0x66')](_0xc2b444,{'include':[{'model':db[_0x70b9('0x9d')],'as':_0x70b9('0xb8')}]});}})[_0x70b9('0x20')](respondWithResult(_0x10046a,null))[_0x70b9('0x5a')](handleError(_0x10046a,null));};exports[_0x70b9('0xb9')]=function(_0x51e3d9,_0x491570,_0x5cece7){return db['MailAccount'][_0x70b9('0x60')]({'where':{'id':_0x51e3d9['params']['id']},'include':[{'model':db[_0x70b9('0x42')],'as':'Smtp','raw':!![]}]})[_0x70b9('0x20')](handleEntityNotFound(_0x491570,null))[_0x70b9('0x20')](function(_0x3707e6){if(_0x3707e6&&_0x3707e6['Smtp']){var _0xbfc5af={'id':_0x3707e6['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3707e6[_0x70b9('0x62')][_0x70b9('0x7f')]){_0xbfc5af[_0x70b9('0x7f')]=_0x3707e6[_0x70b9('0x62')][_0x70b9('0x7f')];}else{_0xbfc5af['host']=_0x3707e6['Smtp']['host'];_0xbfc5af['port']=_0x3707e6[_0x70b9('0x62')][_0x70b9('0x7e')];_0xbfc5af[_0x70b9('0xae')]=_0x3707e6['Smtp'][_0x70b9('0xae')];}if(_0x3707e6['Smtp'][_0x70b9('0x7c')]){_0xbfc5af[_0x70b9('0xad')]={'user':_0x3707e6['Smtp'][_0x70b9('0x77')],'pass':_0x3707e6[_0x70b9('0x62')][_0x70b9('0x7a')]};}return respondWithRpcPromise(_0x70b9('0xba'),_0x70b9('0xb9'),{'account':_0xbfc5af});}})[_0x70b9('0x20')](respondWithResult(_0x491570,null))['catch'](handleError(_0x491570,null));};exports[_0x70b9('0x37')]=function(_0x47c630,_0x4702e2){return db[_0x70b9('0x56')]['find']({'where':{'id':_0x47c630[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x4702e2,null))['then'](function(_0x228bac){if(_0x228bac&&_0x228bac[_0x70b9('0x7f')]){throw new db[(_0x70b9('0xbb'))][(_0x70b9('0xbc'))](_0x70b9('0xbd'));}return _0x228bac;})[_0x70b9('0x20')](removeEntity(_0x4702e2,null))[_0x70b9('0x5a')](handleError(_0x4702e2,null));};exports[_0x70b9('0xbe')]=function(_0x46433e,_0x20637c,_0x401f23){return db[_0x70b9('0x56')][_0x70b9('0x60')]({'where':{'id':_0x46433e[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x20637c,null))['then'](function(_0x2f0bb0){if(_0x2f0bb0){return _0x2f0bb0[_0x70b9('0xbe')](_0x46433e[_0x70b9('0x61')][_0x70b9('0x6c')],_['omit'](_0x46433e[_0x70b9('0x61')],['ids','id'])||{})['spread'](function(_0x4e48b6){for(var _0x4fa13a=0x0;_0x4fa13a<_0x46433e[_0x70b9('0x61')][_0x70b9('0x6c')][_0x70b9('0x69')];_0x4fa13a+=0x1){socket[_0x70b9('0xbf')]('userMailAccount:save',{'UserId':Number(_0x46433e['body'][_0x70b9('0x6c')][_0x4fa13a]),'MailAccountId':Number(_0x46433e[_0x70b9('0x5c')]['id'])});}return _0x4e48b6;});}})[_0x70b9('0x20')](respondWithResult(_0x20637c,null))['catch'](handleError(_0x20637c,null));};exports[_0x70b9('0xc0')]=function(_0x4e8b95,_0xfdbe05,_0x38bd14){return db['MailAccount'][_0x70b9('0x60')]({'where':{'id':_0x4e8b95[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0xfdbe05,null))['then'](function(_0x4ae7fb){if(_0x4ae7fb){return _0x4ae7fb[_0x70b9('0xc0')](_0x4e8b95['query']['ids'])['then'](function(){if(_[_0x70b9('0xc1')](_0x4e8b95[_0x70b9('0x4b')][_0x70b9('0x6c')])){for(var _0x570cc1=0x0;_0x570cc1<_0x4e8b95[_0x70b9('0x4b')][_0x70b9('0x6c')][_0x70b9('0x69')];_0x570cc1+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x4e8b95[_0x70b9('0x4b')][_0x70b9('0x6c')][_0x570cc1]),'MailAccountId':Number(_0x4e8b95[_0x70b9('0x5c')]['id'])});}}else{socket['emit'](_0x70b9('0xc2'),{'UserId':Number(_0x4e8b95[_0x70b9('0x4b')]['ids']),'MailAccountId':Number(_0x4e8b95['params']['id'])});}});}})[_0x70b9('0x20')](respondWithStatusCode(_0xfdbe05,null))[_0x70b9('0x5a')](handleError(_0xfdbe05,null));};exports['getAgents']=function(_0x232e41,_0x55f72c,_0x3eccd0){var _0x4a7958={};var _0x3d55eb={};var _0xb88002;var _0xee7767;return db[_0x70b9('0x56')][_0x70b9('0x68')]({'where':{'id':_0x232e41[_0x70b9('0x5c')]['id']}})[_0x70b9('0x20')](handleEntityNotFound(_0x55f72c,null))[_0x70b9('0x20')](function(_0xc8011a){if(_0xc8011a){_0xb88002=_0xc8011a;_0x3d55eb[_0x70b9('0x4a')]=_['keys'](db[_0x70b9('0x8e')][_0x70b9('0x46')]);_0x3d55eb[_0x70b9('0x4b')]=_[_0x70b9('0x4c')](_0x232e41['query']);_0x3d55eb['filters']=_[_0x70b9('0x5d')](_0x3d55eb[_0x70b9('0x4a')],_0x3d55eb['query']);_0x4a7958[_0x70b9('0x4e')]=_[_0x70b9('0x5d')](_0x3d55eb['model'],qs[_0x70b9('0x4f')](_0x232e41[_0x70b9('0x4b')][_0x70b9('0x4f')]));_0x4a7958[_0x70b9('0x4e')]=_0x4a7958[_0x70b9('0x4e')][_0x70b9('0x69')]?_0x4a7958[_0x70b9('0x4e')]:_0x3d55eb[_0x70b9('0x4a')];_0x4a7958['order']=qs[_0x70b9('0x52')](_0x232e41[_0x70b9('0x4b')][_0x70b9('0x52')]);_0x4a7958[_0x70b9('0x53')]=qs['filters'](_[_0x70b9('0x6a')](_0x232e41[_0x70b9('0x4b')],_0x3d55eb[_0x70b9('0x4d')]));if(_0x232e41['query'][_0x70b9('0x54')]){_0x4a7958[_0x70b9('0x53')]=_['merge'](_0x4a7958[_0x70b9('0x53')],{'$or':_[_0x70b9('0x45')](_0x4a7958[_0x70b9('0x4e')],function(_0x599076){var _0x40b077={};_0x40b077[_0x599076]={'$like':'%'+_0x232e41[_0x70b9('0x4b')][_0x70b9('0x54')]+'%'};return _0x40b077;})});}_0x4a7958=_[_0x70b9('0x55')]({},_0x4a7958,_0x232e41[_0x70b9('0x5f')]);return _0xb88002['getAgents'](_0x4a7958);}})[_0x70b9('0x20')](function(_0x2cf559){if(_0x2cf559){_0xee7767=_0x2cf559[_0x70b9('0x69')];if(!_0x232e41['query']['hasOwnProperty'](_0x70b9('0x51'))){_0x4a7958['limit']=qs[_0x70b9('0x2f')](_0x232e41['query']['limit']);_0x4a7958[_0x70b9('0x2d')]=qs['offset'](_0x232e41[_0x70b9('0x4b')]['offset']);}return _0xb88002[_0x70b9('0xc3')](_0x4a7958);}})[_0x70b9('0x20')](function(_0x5f271f){if(_0x5f271f){return _0x5f271f?{'count':_0xee7767,'rows':_0x5f271f}:null;}})['then'](respondWithResult(_0x55f72c,null))['catch'](handleError(_0x55f72c,null));}; \ No newline at end of file +var _0xdbf8=['to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','juice','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','get','sendStatus','stack','name','send','index','MailServerIn','Imap','Smtp','Pause','map','MailAccount','fieldName','type','model','keys','filters','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','mandatoryDispositionPause','rawAttributes','find','body','params','MailServerOut','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','description','cservice','cauthentication','user','password','pass','cpassword','authentication','port','host','service','cuser','UserProfileSection','MailAccounts','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addInteraction','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','CmList','List','updatedAt','DESC','from','%s\x20<%s>','attachments','server/files/attachments','basename','auth','secure','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','Interaction','Messages','verifySmtp','VerifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','isArray','userMailAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','path','sox'];(function(_0x5da71f,_0xff7de6){var _0x5c7c18=function(_0x190334){while(--_0x190334){_0x5da71f['push'](_0x5da71f['shift']());}};_0x5c7c18(++_0xff7de6);}(_0xdbf8,0x179));var _0x8dbf=function(_0x43d63c,_0x243986){_0x43d63c=_0x43d63c-0x0;var _0x268d89=_0xdbf8[_0x43d63c];return _0x268d89;};'use strict';var emlformat=require(_0x8dbf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8dbf('0x1'));var jsonpatch=require(_0x8dbf('0x2'));var rp=require(_0x8dbf('0x3'));var moment=require(_0x8dbf('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x8dbf('0x5'));var sox=require(_0x8dbf('0x6'));var csv=require(_0x8dbf('0x7'));var ejs=require(_0x8dbf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8dbf('0x9'));var squel=require(_0x8dbf('0xa'));var crypto=require(_0x8dbf('0xb'));var jsforce=require(_0x8dbf('0xc'));var deskjs=require(_0x8dbf('0xd'));var toCsv=require(_0x8dbf('0x7'));var querystring=require(_0x8dbf('0xe'));var Papa=require(_0x8dbf('0xf'));var htmlToText=require(_0x8dbf('0x10'));var juice=require(_0x8dbf('0x11'));var Redis=require(_0x8dbf('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8dbf('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8dbf('0x14'));var logger=require(_0x8dbf('0x15'))(_0x8dbf('0x16'));var utils=require(_0x8dbf('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x8dbf('0x18'))['db'];config[_0x8dbf('0x19')]=_[_0x8dbf('0x1a')](config['redis'],{'host':_0x8dbf('0x1b'),'port':0x18eb});var socket=require(_0x8dbf('0x1c'))(new Redis(config[_0x8dbf('0x19')]));require(_0x8dbf('0x1d'))[_0x8dbf('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8dbf('0x1f')][_0x8dbf('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x21ad5f,_0x188e29,_0x3eeda4,_0xc9667e){return new BPromise(function(_0x4627f3,_0x227123){var _0x162da4=_0xc9667e||client;return _0x162da4[_0x8dbf('0x21')](_0x21ad5f,_0x3eeda4)[_0x8dbf('0x22')](function(_0x3f1af5){logger[_0x8dbf('0x23')](_0x8dbf('0x24'),_0x188e29,_0x8dbf('0x25'));logger[_0x8dbf('0x26')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x188e29,_0x8dbf('0x25'),JSON[_0x8dbf('0x27')](_0x3f1af5));if(_0x3f1af5[_0x8dbf('0x28')]){if(_0x3f1af5[_0x8dbf('0x28')]['code']===0x1f4){logger['error']('MailAccount,\x20%s,\x20%s',_0x188e29,_0x3f1af5['error'][_0x8dbf('0x29')]);return _0x227123(_0x3f1af5[_0x8dbf('0x28')]['message']);}logger[_0x8dbf('0x28')](_0x8dbf('0x24'),_0x188e29,_0x3f1af5['error'][_0x8dbf('0x29')]);return _0x4627f3(_0x3f1af5[_0x8dbf('0x28')][_0x8dbf('0x29')]);}else{logger[_0x8dbf('0x23')](_0x8dbf('0x24'),_0x188e29,_0x8dbf('0x25'));_0x4627f3(_0x3f1af5['result']['message']);}})['catch'](function(_0x22f5dc){logger['error'](_0x8dbf('0x24'),_0x188e29,_0x22f5dc);_0x227123(_0x22f5dc);});});}function respondWithStatusCode(_0x3e1dd6,_0x2a10c1){_0x2a10c1=_0x2a10c1||0xcc;return function(_0x5f41a8){if(_0x5f41a8){return _0x3e1dd6['sendStatus'](_0x2a10c1);}return _0x3e1dd6[_0x8dbf('0x2a')](_0x2a10c1)[_0x8dbf('0x2b')]();};}function respondWithResult(_0x47c4d6,_0xcc7053){_0xcc7053=_0xcc7053||0xc8;return function(_0x2de092){if(_0x2de092){return _0x47c4d6[_0x8dbf('0x2a')](_0xcc7053)[_0x8dbf('0x2c')](_0x2de092);}};}function respondWithFilteredResult(_0x267608,_0x324eab){return function(_0x5a3333){if(_0x5a3333){var _0x1b79c6=typeof _0x324eab[_0x8dbf('0x2d')]==='undefined'&&typeof _0x324eab[_0x8dbf('0x2e')]===_0x8dbf('0x2f');var _0x7afbda=_0x5a3333[_0x8dbf('0x30')];var _0x1ae45c=_0x1b79c6?0x0:_0x324eab[_0x8dbf('0x2d')];var _0x5b92ae=_0x1b79c6?_0x5a3333[_0x8dbf('0x30')]:_0x324eab[_0x8dbf('0x2d')]+_0x324eab[_0x8dbf('0x2e')];var _0xe2816d;if(_0x5b92ae>=_0x7afbda){_0x5b92ae=_0x7afbda;_0xe2816d=0xc8;}else{_0xe2816d=0xce;}_0x267608['status'](_0xe2816d);return _0x267608[_0x8dbf('0x31')](_0x8dbf('0x32'),_0x1ae45c+'-'+_0x5b92ae+'/'+_0x7afbda)[_0x8dbf('0x2c')](_0x5a3333);}return null;};}function patchUpdates(_0x3606aa){return function(_0x1e3627){try{jsonpatch[_0x8dbf('0x33')](_0x1e3627,_0x3606aa,!![]);}catch(_0x54f63a){return BPromise['reject'](_0x54f63a);}return _0x1e3627[_0x8dbf('0x34')]();};}function saveUpdates(_0x2fecf8,_0x4e7cc1){return function(_0x1c93da){if(_0x1c93da){return _0x1c93da[_0x8dbf('0x35')](_0x2fecf8)[_0x8dbf('0x22')](function(_0x42ee79){return _0x42ee79;});}return null;};}function removeEntity(_0x3f534d,_0x4b39f1){return function(_0x967331){if(_0x967331){return _0x967331[_0x8dbf('0x36')]()[_0x8dbf('0x22')](function(){var _0x3e2da8=_0x967331[_0x8dbf('0x37')]({'plain':!![]});var _0x587111='MailAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x587111,'resourceId':_0x3e2da8['id']}})[_0x8dbf('0x22')](function(){return _0x967331;});})[_0x8dbf('0x22')](function(){_0x3f534d[_0x8dbf('0x2a')](0xcc)[_0x8dbf('0x2b')]();});}};}function handleEntityNotFound(_0x1410d3,_0x552d4b){return function(_0x58b186){if(!_0x58b186){_0x1410d3[_0x8dbf('0x38')](0x194);}return _0x58b186;};}function handleError(_0x40040b,_0x49087e){_0x49087e=_0x49087e||0x1f4;return function(_0x43702d){logger[_0x8dbf('0x28')](_0x43702d[_0x8dbf('0x39')]);if(_0x43702d[_0x8dbf('0x3a')]){delete _0x43702d[_0x8dbf('0x3a')];}_0x40040b[_0x8dbf('0x2a')](_0x49087e)[_0x8dbf('0x3b')](_0x43702d);};}exports[_0x8dbf('0x3c')]=function(_0xacc865,_0xb074f5){var _0x18dca0={'include':[{'model':db[_0x8dbf('0x3d')],'as':_0x8dbf('0x3e')},{'model':db['MailServerOut'],'as':_0x8dbf('0x3f')},{'model':db[_0x8dbf('0x40')],'as':'mandatoryDispositionPause'}]},_0x239dcf={},_0xe2d95c={'count':0x0,'rows':[]};var _0x15614a=_[_0x8dbf('0x41')](db[_0x8dbf('0x42')]['rawAttributes'],function(_0x1e1163){return{'name':_0x1e1163[_0x8dbf('0x43')],'type':_0x1e1163[_0x8dbf('0x44')]['key']};});_0x239dcf[_0x8dbf('0x45')]=_[_0x8dbf('0x41')](_0x15614a,_0x8dbf('0x3a'));_0x239dcf['query']=_[_0x8dbf('0x46')](_0xacc865['query']);_0x239dcf[_0x8dbf('0x47')]=_['intersection'](_0x239dcf[_0x8dbf('0x45')],_0x239dcf[_0x8dbf('0x48')]);_0x18dca0[_0x8dbf('0x49')]=_[_0x8dbf('0x4a')](_0x239dcf[_0x8dbf('0x45')],qs[_0x8dbf('0x4b')](_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x4b')]));_0x18dca0['attributes']=_0x18dca0[_0x8dbf('0x49')][_0x8dbf('0x4c')]?_0x18dca0[_0x8dbf('0x49')]:_0x239dcf[_0x8dbf('0x45')];if(!_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x4d')]('nolimit')){_0x18dca0[_0x8dbf('0x2e')]=qs[_0x8dbf('0x2e')](_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x2e')]);_0x18dca0[_0x8dbf('0x2d')]=qs['offset'](_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x2d')]);}_0x18dca0[_0x8dbf('0x4e')]=qs['sort'](_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x4f')]);_0x18dca0[_0x8dbf('0x50')]=qs['filters'](_[_0x8dbf('0x51')](_0xacc865[_0x8dbf('0x48')],_0x239dcf['filters']),_0x15614a);if(_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x52')]){_0x18dca0['where']=_[_0x8dbf('0x53')](_0x18dca0['where'],{'$or':_[_0x8dbf('0x41')](_0x15614a,function(_0x4b8e6e){if(_0x4b8e6e[_0x8dbf('0x44')]!==_0x8dbf('0x54')){var _0x5f26ff={};_0x5f26ff[_0x4b8e6e[_0x8dbf('0x3a')]]={'$like':'%'+_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x52')]+'%'};return _0x5f26ff;}})});}_0x18dca0=_['merge']({},_0x18dca0,_0xacc865[_0x8dbf('0x55')]);var _0x1f07bf={'where':_0x18dca0[_0x8dbf('0x50')]};return db[_0x8dbf('0x42')][_0x8dbf('0x30')](_0x1f07bf)[_0x8dbf('0x22')](function(_0x3f5548){_0xe2d95c[_0x8dbf('0x30')]=_0x3f5548;if(_0xacc865[_0x8dbf('0x48')][_0x8dbf('0x56')]){_0x18dca0[_0x8dbf('0x57')]=[{'all':!![]}];}return db[_0x8dbf('0x42')][_0x8dbf('0x58')](_0x18dca0);})['then'](function(_0x530b04){_0xe2d95c[_0x8dbf('0x59')]=_0x530b04;return _0xe2d95c;})[_0x8dbf('0x22')](respondWithFilteredResult(_0xb074f5,_0x18dca0))[_0x8dbf('0x5a')](handleError(_0xb074f5,null));};exports[_0x8dbf('0x5b')]=function(_0x3d2115,_0x586404){var _0x37816f={'raw':![],'where':{'id':_0x3d2115['params']['id']},'include':[{'model':db[_0x8dbf('0x3d')],'as':_0x8dbf('0x3e')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x8dbf('0x40')],'as':_0x8dbf('0x5c')}]},_0x2f35e1={};_0x2f35e1[_0x8dbf('0x45')]=_[_0x8dbf('0x46')](db[_0x8dbf('0x42')][_0x8dbf('0x5d')]);_0x2f35e1[_0x8dbf('0x48')]=_[_0x8dbf('0x46')](_0x3d2115[_0x8dbf('0x48')]);_0x2f35e1[_0x8dbf('0x47')]=_[_0x8dbf('0x4a')](_0x2f35e1[_0x8dbf('0x45')],_0x2f35e1['query']);_0x37816f[_0x8dbf('0x49')]=_[_0x8dbf('0x4a')](_0x2f35e1[_0x8dbf('0x45')],qs[_0x8dbf('0x4b')](_0x3d2115[_0x8dbf('0x48')][_0x8dbf('0x4b')]));_0x37816f['attributes']=_0x37816f['attributes'][_0x8dbf('0x4c')]?_0x37816f[_0x8dbf('0x49')]:_0x2f35e1[_0x8dbf('0x45')];if(_0x3d2115[_0x8dbf('0x48')][_0x8dbf('0x56')]){_0x37816f['include']=[{'all':!![]}];}_0x37816f=_[_0x8dbf('0x53')]({},_0x37816f,_0x3d2115['options']);return db[_0x8dbf('0x42')][_0x8dbf('0x5e')](_0x37816f)[_0x8dbf('0x22')](handleEntityNotFound(_0x586404,null))[_0x8dbf('0x22')](respondWithResult(_0x586404,null))[_0x8dbf('0x5a')](handleError(_0x586404,null));};exports[_0x8dbf('0x35')]=function(_0x3336a3,_0x4274e2){if(_0x3336a3[_0x8dbf('0x5f')]['id']){delete _0x3336a3[_0x8dbf('0x5f')]['id'];}return db['MailAccount'][_0x8dbf('0x5e')]({'where':{'id':_0x3336a3[_0x8dbf('0x60')]['id']},'include':[{'model':db[_0x8dbf('0x3d')],'as':_0x8dbf('0x3e')},{'model':db[_0x8dbf('0x61')],'as':_0x8dbf('0x3f')},{'model':db['Pause'],'as':_0x8dbf('0x5c')}]})[_0x8dbf('0x22')](handleEntityNotFound(_0x4274e2,null))[_0x8dbf('0x22')](saveUpdates(_0x3336a3[_0x8dbf('0x5f')],null))['then'](function(_0x126eb9){if(_0x126eb9&&_0x3336a3[_0x8dbf('0x5f')][_0x8dbf('0x3e')]){return db['MailServerIn'][_0x8dbf('0x35')](_0x3336a3[_0x8dbf('0x5f')]['Imap'],{'where':{'MailAccountId':_0x126eb9['id']}})[_0x8dbf('0x22')](function(){return _0x126eb9;});}return _0x126eb9;})[_0x8dbf('0x22')](function(_0x50c5ff){if(_0x50c5ff&&_0x3336a3[_0x8dbf('0x5f')][_0x8dbf('0x3f')]){return db[_0x8dbf('0x61')]['update'](_0x3336a3[_0x8dbf('0x5f')][_0x8dbf('0x3f')],{'where':{'MailAccountId':_0x50c5ff['id']}})[_0x8dbf('0x22')](function(){return _0x50c5ff;});}return _0x50c5ff;})[_0x8dbf('0x22')](respondWithResult(_0x4274e2,null))[_0x8dbf('0x5a')](handleError(_0x4274e2,null));};exports['describe']=function(_0x174b97,_0x50e6b9){return db[_0x8dbf('0x42')]['describe']()[_0x8dbf('0x22')](respondWithResult(_0x50e6b9,null))[_0x8dbf('0x5a')](handleError(_0x50e6b9,null));};exports[_0x8dbf('0x62')]=function(_0x46ab09,_0x1eb152,_0x477b81){if(_0x46ab09[_0x8dbf('0x5f')]['id']){delete _0x46ab09[_0x8dbf('0x5f')]['id'];}return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x46ab09['params']['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x1eb152,null))[_0x8dbf('0x22')](function(_0x4fb607){if(_0x4fb607){_0x46ab09[_0x8dbf('0x5f')][_0x8dbf('0x63')]=_0x4fb607['id'];return db['Disposition'][_0x8dbf('0x64')](_0x46ab09[_0x8dbf('0x5f')]);}})[_0x8dbf('0x22')](respondWithResult(_0x1eb152,null))[_0x8dbf('0x5a')](handleError(_0x1eb152,null));};exports[_0x8dbf('0x65')]=function(_0x3286c8,_0x2e118e,_0x4e07d5){var _0xce9762={'raw':![],'where':{}};var _0x10129a={};var _0x2d665c={'count':0x0,'rows':[]};return db[_0x8dbf('0x42')][_0x8dbf('0x66')]({'where':{'id':_0x3286c8[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x2e118e,null))['then'](function(_0x4a2bc9){if(_0x4a2bc9){_0x10129a[_0x8dbf('0x45')]=_['keys'](db[_0x8dbf('0x67')][_0x8dbf('0x5d')]);_0x10129a[_0x8dbf('0x48')]=_['keys'](_0x3286c8[_0x8dbf('0x48')]);_0x10129a[_0x8dbf('0x47')]=_[_0x8dbf('0x4a')](_0x10129a['model'],_0x10129a[_0x8dbf('0x48')]);_0xce9762[_0x8dbf('0x49')]=_[_0x8dbf('0x4a')](_0x10129a[_0x8dbf('0x45')],qs['fields'](_0x3286c8['query'][_0x8dbf('0x4b')]));_0xce9762[_0x8dbf('0x49')]=_0xce9762['attributes'][_0x8dbf('0x4c')]?_0xce9762[_0x8dbf('0x49')]:_0x10129a['model'];if(!_0x3286c8[_0x8dbf('0x48')][_0x8dbf('0x4d')](_0x8dbf('0x68'))){_0xce9762[_0x8dbf('0x2e')]=qs[_0x8dbf('0x2e')](_0x3286c8['query'][_0x8dbf('0x2e')]);_0xce9762[_0x8dbf('0x2d')]=qs[_0x8dbf('0x2d')](_0x3286c8['query']['offset']);}_0xce9762[_0x8dbf('0x4e')]=qs[_0x8dbf('0x4f')](_0x3286c8[_0x8dbf('0x48')][_0x8dbf('0x4f')]);_0xce9762['where']=qs[_0x8dbf('0x47')](_[_0x8dbf('0x51')](_0x3286c8['query'],_0x10129a['filters']));_0xce9762[_0x8dbf('0x50')][_0x8dbf('0x63')]=_0x4a2bc9['id'];if(_0x3286c8[_0x8dbf('0x48')][_0x8dbf('0x52')]){_0xce9762['where']=_[_0x8dbf('0x53')](_0xce9762['where'],{'$or':_[_0x8dbf('0x41')](_0xce9762[_0x8dbf('0x49')],function(_0x229e41){var _0x47b6c1={};_0x47b6c1[_0x229e41]={'$like':'%'+_0x3286c8[_0x8dbf('0x48')][_0x8dbf('0x52')]+'%'};return _0x47b6c1;})});}_0xce9762=_[_0x8dbf('0x53')]({},_0xce9762,_0x3286c8[_0x8dbf('0x55')]);return db[_0x8dbf('0x67')][_0x8dbf('0x30')]({'where':_0xce9762[_0x8dbf('0x50')]})[_0x8dbf('0x22')](function(_0x5851d7){_0x2d665c[_0x8dbf('0x30')]=_0x5851d7;if(_0x3286c8[_0x8dbf('0x48')]['includeAll']){_0xce9762[_0x8dbf('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x8dbf('0x58')](_0xce9762);})[_0x8dbf('0x22')](function(_0x1622d9){_0x2d665c[_0x8dbf('0x59')]=_0x1622d9;return _0x2d665c;});}})[_0x8dbf('0x22')](respondWithFilteredResult(_0x2e118e,_0xce9762))[_0x8dbf('0x5a')](handleError(_0x2e118e,null));};exports[_0x8dbf('0x69')]=function(_0x28426a,_0x4c4be4,_0x1fe308){return db['MailAccount'][_0x8dbf('0x5e')]({'where':{'id':_0x28426a['params']['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x4c4be4,null))[_0x8dbf('0x22')](function(_0x1a2844){if(_0x1a2844){return _0x1a2844['removeDispositions'](_0x28426a['query'][_0x8dbf('0x6a')]);}})['then'](respondWithStatusCode(_0x4c4be4,null))[_0x8dbf('0x5a')](handleError(_0x4c4be4,null));};exports[_0x8dbf('0x6b')]=function(_0x160792,_0x51f7b1,_0x3d8197){if(_0x160792[_0x8dbf('0x5f')]['id']){delete _0x160792[_0x8dbf('0x5f')]['id'];}return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x160792[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x51f7b1,null))[_0x8dbf('0x22')](function(_0xaa5ca9){if(_0xaa5ca9){_0x160792[_0x8dbf('0x5f')]['MailAccountId']=_0xaa5ca9['id'];return db[_0x8dbf('0x6c')][_0x8dbf('0x64')](_0x160792['body']);}})[_0x8dbf('0x22')](respondWithResult(_0x51f7b1,null))[_0x8dbf('0x5a')](handleError(_0x51f7b1,null));};exports[_0x8dbf('0x6d')]=function(_0x5c1da5,_0x186647,_0x2813cf){var _0x2e83ed={'raw':![],'where':{}};var _0x3c091f={};var _0x2b35e5={'count':0x0,'rows':[]};return db[_0x8dbf('0x42')][_0x8dbf('0x66')]({'where':{'id':_0x5c1da5[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x186647,null))[_0x8dbf('0x22')](function(_0x1b0a71){if(_0x1b0a71){_0x3c091f[_0x8dbf('0x45')]=_['keys'](db[_0x8dbf('0x6c')][_0x8dbf('0x5d')]);_0x3c091f[_0x8dbf('0x48')]=_[_0x8dbf('0x46')](_0x5c1da5[_0x8dbf('0x48')]);_0x3c091f[_0x8dbf('0x47')]=_[_0x8dbf('0x4a')](_0x3c091f['model'],_0x3c091f[_0x8dbf('0x48')]);_0x2e83ed[_0x8dbf('0x49')]=_[_0x8dbf('0x4a')](_0x3c091f[_0x8dbf('0x45')],qs[_0x8dbf('0x4b')](_0x5c1da5[_0x8dbf('0x48')][_0x8dbf('0x4b')]));_0x2e83ed[_0x8dbf('0x49')]=_0x2e83ed[_0x8dbf('0x49')][_0x8dbf('0x4c')]?_0x2e83ed[_0x8dbf('0x49')]:_0x3c091f[_0x8dbf('0x45')];if(!_0x5c1da5['query'][_0x8dbf('0x4d')]('nolimit')){_0x2e83ed[_0x8dbf('0x2e')]=qs[_0x8dbf('0x2e')](_0x5c1da5['query'][_0x8dbf('0x2e')]);_0x2e83ed[_0x8dbf('0x2d')]=qs[_0x8dbf('0x2d')](_0x5c1da5[_0x8dbf('0x48')]['offset']);}_0x2e83ed[_0x8dbf('0x4e')]=qs['sort'](_0x5c1da5['query']['sort']);_0x2e83ed['where']=qs[_0x8dbf('0x47')](_[_0x8dbf('0x51')](_0x5c1da5[_0x8dbf('0x48')],_0x3c091f[_0x8dbf('0x47')]));_0x2e83ed[_0x8dbf('0x50')]['MailAccountId']=_0x1b0a71['id'];if(_0x5c1da5[_0x8dbf('0x48')][_0x8dbf('0x52')]){_0x2e83ed['where']=_[_0x8dbf('0x53')](_0x2e83ed[_0x8dbf('0x50')],{'$or':_[_0x8dbf('0x41')](_0x2e83ed[_0x8dbf('0x49')],function(_0xf7f9b3){var _0x52b094={};_0x52b094[_0xf7f9b3]={'$like':'%'+_0x5c1da5[_0x8dbf('0x48')]['filter']+'%'};return _0x52b094;})});}_0x2e83ed=_[_0x8dbf('0x53')]({},_0x2e83ed,_0x5c1da5[_0x8dbf('0x55')]);return db['CannedAnswer'][_0x8dbf('0x30')]({'where':_0x2e83ed[_0x8dbf('0x50')]})['then'](function(_0x6807bc){_0x2b35e5['count']=_0x6807bc;if(_0x5c1da5[_0x8dbf('0x48')][_0x8dbf('0x56')]){_0x2e83ed['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2e83ed);})[_0x8dbf('0x22')](function(_0x566c42){_0x2b35e5[_0x8dbf('0x59')]=_0x566c42;return _0x2b35e5;});}})[_0x8dbf('0x22')](respondWithFilteredResult(_0x186647,_0x2e83ed))['catch'](handleError(_0x186647,null));};exports['removeAnswers']=function(_0x124e68,_0x2bc018,_0x414481){return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x124e68[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x2bc018,null))['then'](function(_0x5a8ea6){if(_0x5a8ea6){return _0x5a8ea6[_0x8dbf('0x6e')](_0x124e68[_0x8dbf('0x48')][_0x8dbf('0x6a')]);}})[_0x8dbf('0x22')](respondWithStatusCode(_0x2bc018,null))['catch'](handleError(_0x2bc018,null));};exports[_0x8dbf('0x64')]=function(_0x317b8a,_0x46ae42){var _0x53c49e={'name':_0x317b8a[_0x8dbf('0x5f')]['name'],'key':_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x6f')],'email':_0x317b8a['body'][_0x8dbf('0x70')],'ListId':_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x71')],'active':!_[_0x8dbf('0x72')](_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x73')])?_0x317b8a['body'][_0x8dbf('0x73')]:!![],'description':_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x74')]||null,'Imap':{},'Smtp':{}};if(_[_0x8dbf('0x72')](_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x75')])){if(_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x76')]){_0x53c49e[_0x8dbf('0x3e')][_0x8dbf('0x77')]=_0x53c49e[_0x8dbf('0x3f')][_0x8dbf('0x77')]=_0x317b8a['body']['cuser'];_0x53c49e['Imap'][_0x8dbf('0x78')]=_0x53c49e['Smtp'][_0x8dbf('0x79')]=_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x7a')];}else{_0x53c49e[_0x8dbf('0x3e')][_0x8dbf('0x7b')]=_0x53c49e['Smtp'][_0x8dbf('0x7b')]=![];}_0x53c49e[_0x8dbf('0x3e')]['host']=_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x3e')]['host'];_0x53c49e[_0x8dbf('0x3e')][_0x8dbf('0x7c')]=_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x3e')][_0x8dbf('0x7c')];_0x53c49e['Smtp'][_0x8dbf('0x7d')]=_0x317b8a[_0x8dbf('0x5f')]['Smtp'][_0x8dbf('0x7d')];_0x53c49e['Smtp'][_0x8dbf('0x7c')]=_0x317b8a[_0x8dbf('0x5f')]['Smtp'][_0x8dbf('0x7c')];}else{_0x53c49e[_0x8dbf('0x3e')][_0x8dbf('0x7e')]=_0x53c49e[_0x8dbf('0x3f')][_0x8dbf('0x7e')]=_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x75')];_0x53c49e[_0x8dbf('0x3e')][_0x8dbf('0x77')]=_0x53c49e[_0x8dbf('0x3f')][_0x8dbf('0x77')]=_0x317b8a[_0x8dbf('0x5f')][_0x8dbf('0x7f')];_0x53c49e[_0x8dbf('0x3e')]['password']=_0x53c49e['Smtp'][_0x8dbf('0x79')]=_0x317b8a[_0x8dbf('0x5f')]['cpassword'];}return db[_0x8dbf('0x42')][_0x8dbf('0x64')](_0x53c49e,{'include':[{'model':db[_0x8dbf('0x61')],'as':'Smtp'},{'model':db[_0x8dbf('0x3d')],'as':_0x8dbf('0x3e')}]})['then'](function(_0x235966){var _0x22aa30=_0x317b8a['user'][_0x8dbf('0x37')]({'plain':!![]});if(!_0x22aa30)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22aa30['role']===_0x8dbf('0x77')){var _0x208dcc=_0x235966[_0x8dbf('0x37')]({'plain':!![]});return db[_0x8dbf('0x80')][_0x8dbf('0x5e')]({'where':{'name':_0x8dbf('0x81'),'userProfileId':_0x22aa30[_0x8dbf('0x82')]},'raw':!![]})[_0x8dbf('0x22')](function(_0x55cd3c){if(_0x55cd3c&&_0x55cd3c[_0x8dbf('0x83')]===0x0){return db[_0x8dbf('0x84')][_0x8dbf('0x64')]({'name':_0x208dcc[_0x8dbf('0x3a')],'resourceId':_0x208dcc['id'],'type':_0x55cd3c['name'],'sectionId':_0x55cd3c['id']},{})[_0x8dbf('0x22')](function(){return _0x235966;});}else{return _0x235966;}})['catch'](function(_0x1be3c6){logger[_0x8dbf('0x28')](_0x8dbf('0x85'),_0x1be3c6);throw _0x1be3c6;});}return _0x235966;})[_0x8dbf('0x22')](respondWithResult(_0x46ae42,0xc9))['catch'](handleError(_0x46ae42,null));};exports[_0x8dbf('0x86')]=function(_0x280696,_0x1c9a50,_0x177152){return db['MailAccount'][_0x8dbf('0x66')]({'where':{'id':_0x280696[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x1c9a50,null))[_0x8dbf('0x22')](function(_0x3650b3){if(_0x3650b3){return _0x3650b3[_0x8dbf('0x86')]();}return null;})[_0x8dbf('0x22')](respondWithResult(_0x1c9a50,null))[_0x8dbf('0x5a')](handleError(_0x1c9a50,null));};exports[_0x8dbf('0x87')]=function(_0x572f3e,_0x1d965e,_0x308ab4){if(_0x572f3e[_0x8dbf('0x5f')]['id']){delete _0x572f3e[_0x8dbf('0x5f')]['id'];}return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x572f3e[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x1d965e,null))[_0x8dbf('0x22')](function(_0x2e8597){if(_0x2e8597){_0x572f3e['body'][_0x8dbf('0x63')]=_0x2e8597['id'];return db['MailServerIn'][_0x8dbf('0x64')](_0x572f3e[_0x8dbf('0x5f')]);}})[_0x8dbf('0x22')](respondWithResult(_0x1d965e,null))[_0x8dbf('0x5a')](handleError(_0x1d965e,null));};exports[_0x8dbf('0x88')]=function(_0x530b37,_0x22a2ff,_0xabcfb6){return db['MailAccount']['findOne']({'where':{'id':_0x530b37[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x22a2ff,null))[_0x8dbf('0x22')](function(_0x3052ed){if(_0x3052ed){return _0x3052ed['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x22a2ff,null))['catch'](handleError(_0x22a2ff,null));};exports[_0x8dbf('0x89')]=function(_0x50ff22,_0x589ba8,_0x3aa666){return db[_0x8dbf('0x42')][_0x8dbf('0x66')]({'where':{'id':_0x50ff22['params']['id']}})['then'](handleEntityNotFound(_0x589ba8,null))['then'](function(_0x3f2d68){if(_0x3f2d68){return _0x3f2d68['getSmtp']();}return null;})[_0x8dbf('0x22')](respondWithResult(_0x589ba8,null))['catch'](handleError(_0x589ba8,null));};exports['addSmtp']=function(_0x120791,_0x18eb0a,_0x41e5dc){if(_0x120791[_0x8dbf('0x5f')]['id']){delete _0x120791[_0x8dbf('0x5f')]['id'];}return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x120791[_0x8dbf('0x60')]['id']}})['then'](handleEntityNotFound(_0x18eb0a,null))[_0x8dbf('0x22')](function(_0x48efd5){if(_0x48efd5){_0x120791[_0x8dbf('0x5f')]['MailAccountId']=_0x48efd5['id'];return db[_0x8dbf('0x61')][_0x8dbf('0x64')](_0x120791[_0x8dbf('0x5f')]);}})[_0x8dbf('0x22')](respondWithResult(_0x18eb0a,null))[_0x8dbf('0x5a')](handleError(_0x18eb0a,null));};exports['removeSmtp']=function(_0x2cb7a0,_0x31d360,_0x51bbac){return db[_0x8dbf('0x42')]['findOne']({'where':{'id':_0x2cb7a0[_0x8dbf('0x60')]['id']}})['then'](handleEntityNotFound(_0x31d360,null))[_0x8dbf('0x22')](function(_0x49da81){if(_0x49da81){return _0x49da81['setSmtp'](null);}return null;})[_0x8dbf('0x22')](respondWithStatusCode(_0x31d360,null))[_0x8dbf('0x5a')](handleError(_0x31d360,null));};exports[_0x8dbf('0x8a')]=function(_0xe8b16b,_0x39f310,_0x48aef0){return db['MailInteraction'][_0x8dbf('0x5e')]({'where':{'id':_0xe8b16b[_0x8dbf('0x60')]['id']}})['then'](handleEntityNotFound(_0x39f310,null))[_0x8dbf('0x22')](function(_0x337a73){if(_0x337a73){return _0x337a73[_0x8dbf('0x8a')](_0xe8b16b['body'][_0x8dbf('0x6a')],_[_0x8dbf('0x8b')](_0xe8b16b[_0x8dbf('0x5f')],['ids','id'])||{});}})[_0x8dbf('0x22')](respondWithResult(_0x39f310,null))[_0x8dbf('0x5a')](handleError(_0x39f310,null));};exports[_0x8dbf('0x8c')]=function(_0x2a6fc7,_0x463ef6,_0x5c2242){var _0x2fe69e={'raw':![],'where':{}};var _0xc9b514={};var _0xdae5bc={'count':0x0,'rows':[]};return db['MailAccount'][_0x8dbf('0x66')]({'where':{'id':_0x2a6fc7[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x463ef6,null))['then'](function(_0xe000a9){if(_0xe000a9){_0xc9b514[_0x8dbf('0x45')]=_[_0x8dbf('0x46')](db[_0x8dbf('0x8d')][_0x8dbf('0x5d')]);_0xc9b514[_0x8dbf('0x48')]=_[_0x8dbf('0x46')](_0x2a6fc7['query']);_0xc9b514['filters']=_[_0x8dbf('0x4a')](_0xc9b514['model'],_0xc9b514[_0x8dbf('0x48')]);_0x2fe69e[_0x8dbf('0x49')]=_[_0x8dbf('0x4a')](_0xc9b514[_0x8dbf('0x45')],qs[_0x8dbf('0x4b')](_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x4b')]));_0x2fe69e['attributes']=_0x2fe69e['attributes']['length']?_0x2fe69e[_0x8dbf('0x49')]:_0xc9b514[_0x8dbf('0x45')];if(!_0x2a6fc7[_0x8dbf('0x48')]['hasOwnProperty'](_0x8dbf('0x68'))){_0x2fe69e['limit']=qs['limit'](_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x2e')]);_0x2fe69e['offset']=qs['offset'](_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x2d')]);}_0x2fe69e['order']=qs['sort'](_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x4f')]);_0x2fe69e[_0x8dbf('0x50')]=qs[_0x8dbf('0x47')](_[_0x8dbf('0x51')](_0x2a6fc7[_0x8dbf('0x48')],_0xc9b514[_0x8dbf('0x47')]));_0x2fe69e['where'][_0x8dbf('0x63')]=_0xe000a9['id'];if(_0x2a6fc7[_0x8dbf('0x48')]['filter']){_0x2fe69e[_0x8dbf('0x50')]=_['merge'](_0x2fe69e[_0x8dbf('0x50')],{'$or':_[_0x8dbf('0x41')](_0x2fe69e[_0x8dbf('0x49')],function(_0x53d2db){var _0x5dff7d={};_0x5dff7d[_0x53d2db]={'$like':'%'+_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x52')]+'%'};return _0x5dff7d;})});}_0x2fe69e=_[_0x8dbf('0x53')]({},_0x2fe69e,_0x2a6fc7[_0x8dbf('0x55')]);return db[_0x8dbf('0x8d')][_0x8dbf('0x30')]({'where':_0x2fe69e['where']})[_0x8dbf('0x22')](function(_0x5abd52){_0xdae5bc['count']=_0x5abd52;if(_0x2a6fc7['query'][_0x8dbf('0x56')]){_0x2fe69e[_0x8dbf('0x57')]=[{'model':db[_0x8dbf('0x8e')],'as':_0x8dbf('0x8f'),'required':![]},{'model':db[_0x8dbf('0x90')],'as':_0x8dbf('0x91'),'attributes':[_0x8dbf('0x3a'),_0x8dbf('0x92'),_0x8dbf('0x93')],'required':![]},{'model':db[_0x8dbf('0x94')],'as':_0x8dbf('0x95'),'attributes':['id',_0x8dbf('0x3a'),_0x8dbf('0x96')],'where':_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x97')]?{'id':_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x97')]}:undefined,'required':_0x2a6fc7[_0x8dbf('0x48')][_0x8dbf('0x97')]?!![]:![]}];}return db[_0x8dbf('0x8d')][_0x8dbf('0x58')](_0x2fe69e);})[_0x8dbf('0x22')](function(_0x4621f8){_0xdae5bc[_0x8dbf('0x59')]=_0x4621f8;return _0xdae5bc;});}})[_0x8dbf('0x22')](respondWithFilteredResult(_0x463ef6,_0x2fe69e))[_0x8dbf('0x5a')](handleError(_0x463ef6,null));};exports[_0x8dbf('0x98')]=function(_0x20d997,_0x55f65a,_0x127a2a){return db[_0x8dbf('0x42')][_0x8dbf('0x66')]({'where':{'id':_0x20d997[_0x8dbf('0x60')]['id']}})['then'](handleEntityNotFound(_0x55f65a,null))[_0x8dbf('0x22')](function(_0x2e9e6c){if(_0x2e9e6c){return db[_0x8dbf('0x99')]['transaction'](function(_0x3ce9c0){return db['MailApplication'][_0x8dbf('0x36')]({'where':{'MailAccountId':_0x20d997[_0x8dbf('0x60')]['id']},'transaction':_0x3ce9c0})['then'](function(_0x322f5e){var _0x2882fe=_[_0x8dbf('0x41')](_0x20d997[_0x8dbf('0x5f')],function(_0x474d7f){_0x474d7f['MailAccountId']=_0x20d997['params']['id'];return _0x474d7f;});return db[_0x8dbf('0x9a')][_0x8dbf('0x9b')](_0x2882fe,{'transaction':_0x3ce9c0});});})[_0x8dbf('0x22')](function(){return db[_0x8dbf('0x9a')][_0x8dbf('0x9c')]({'where':{'MailAccountId':_0x20d997[_0x8dbf('0x60')]['id']},'order':_0x8dbf('0x9d')});});}})[_0x8dbf('0x22')](respondWithResult(_0x55f65a,null))[_0x8dbf('0x5a')](handleError(_0x55f65a,null));};exports[_0x8dbf('0x9e')]=function(_0x32f701,_0x4e0789,_0x2e6b25){var _0x2e9240={};var _0x317caa={};var _0x39e143;var _0x1870ce;return db[_0x8dbf('0x42')][_0x8dbf('0x66')]({'where':{'id':_0x32f701[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x4e0789,null))[_0x8dbf('0x22')](function(_0x57e1eb){if(_0x57e1eb){_0x39e143=_0x57e1eb;_0x317caa[_0x8dbf('0x45')]=_['keys'](db['MailApplication'][_0x8dbf('0x5d')]);_0x317caa[_0x8dbf('0x48')]=_[_0x8dbf('0x46')](_0x32f701[_0x8dbf('0x48')]);_0x317caa[_0x8dbf('0x47')]=_['intersection'](_0x317caa[_0x8dbf('0x45')],_0x317caa[_0x8dbf('0x48')]);_0x2e9240['attributes']=_['intersection'](_0x317caa[_0x8dbf('0x45')],qs[_0x8dbf('0x4b')](_0x32f701[_0x8dbf('0x48')][_0x8dbf('0x4b')]));_0x2e9240[_0x8dbf('0x49')]=_0x2e9240[_0x8dbf('0x49')]['length']?_0x2e9240[_0x8dbf('0x49')]:_0x317caa[_0x8dbf('0x45')];_0x2e9240['order']=qs[_0x8dbf('0x4f')](_0x32f701[_0x8dbf('0x48')][_0x8dbf('0x4f')]);_0x2e9240['where']=qs[_0x8dbf('0x47')](_['pick'](_0x32f701[_0x8dbf('0x48')],_0x317caa[_0x8dbf('0x47')]));if(_0x32f701[_0x8dbf('0x48')]['filter']){_0x2e9240[_0x8dbf('0x50')]=_[_0x8dbf('0x53')](_0x2e9240[_0x8dbf('0x50')],{'$or':_[_0x8dbf('0x41')](_0x2e9240[_0x8dbf('0x49')],function(_0x2ab22e){var _0x5ba011={};_0x5ba011[_0x2ab22e]={'$like':'%'+_0x32f701[_0x8dbf('0x48')][_0x8dbf('0x52')]+'%'};return _0x5ba011;})});}_0x2e9240=_[_0x8dbf('0x53')]({},_0x2e9240,_0x32f701['options']);return _0x39e143['getApplications'](_0x2e9240);}})[_0x8dbf('0x22')](function(_0x410842){if(_0x410842){_0x1870ce=_0x410842['length'];if(!_0x32f701[_0x8dbf('0x48')][_0x8dbf('0x4d')](_0x8dbf('0x68'))){_0x2e9240[_0x8dbf('0x2e')]=qs[_0x8dbf('0x2e')](_0x32f701[_0x8dbf('0x48')][_0x8dbf('0x2e')]);_0x2e9240[_0x8dbf('0x2d')]=qs[_0x8dbf('0x2d')](_0x32f701[_0x8dbf('0x48')]['offset']);}return _0x39e143[_0x8dbf('0x9e')](_0x2e9240);}})[_0x8dbf('0x22')](function(_0x643f4b){if(_0x643f4b){return _0x643f4b?{'count':_0x1870ce,'rows':_0x643f4b}:null;}})[_0x8dbf('0x22')](respondWithResult(_0x4e0789,null))[_0x8dbf('0x5a')](handleError(_0x4e0789,null));};exports['getMessages']=function(_0x4903b0,_0x41e778,_0x537dd3){var _0x1510ea={'raw':!![],'where':{}};var _0x1807e5={};var _0x5b61e4={'count':0x0,'rows':[]};return db['MailAccount'][_0x8dbf('0x66')]({'where':{'id':_0x4903b0[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x41e778,null))[_0x8dbf('0x22')](function(_0x4ed145){if(_0x4ed145){_0x1807e5['model']=_['keys'](db[_0x8dbf('0x9f')][_0x8dbf('0x5d')]);_0x1807e5['query']=_[_0x8dbf('0x46')](_0x4903b0[_0x8dbf('0x48')]);_0x1807e5[_0x8dbf('0x47')]=_[_0x8dbf('0x4a')](_0x1807e5[_0x8dbf('0x45')],_0x1807e5[_0x8dbf('0x48')]);_0x1510ea[_0x8dbf('0x49')]=_[_0x8dbf('0x4a')](_0x1807e5['model'],qs[_0x8dbf('0x4b')](_0x4903b0[_0x8dbf('0x48')][_0x8dbf('0x4b')]));_0x1510ea[_0x8dbf('0x49')]=_0x1510ea[_0x8dbf('0x49')]['length']?_0x1510ea[_0x8dbf('0x49')]:_0x1807e5[_0x8dbf('0x45')];if(!_0x4903b0[_0x8dbf('0x48')][_0x8dbf('0x4d')](_0x8dbf('0x68'))){_0x1510ea['limit']=qs[_0x8dbf('0x2e')](_0x4903b0[_0x8dbf('0x48')][_0x8dbf('0x2e')]);_0x1510ea[_0x8dbf('0x2d')]=qs[_0x8dbf('0x2d')](_0x4903b0['query'][_0x8dbf('0x2d')]);}_0x1510ea['order']=qs[_0x8dbf('0x4f')](_0x4903b0[_0x8dbf('0x48')]['sort']);_0x1510ea['where']=qs[_0x8dbf('0x47')](_[_0x8dbf('0x51')](_0x4903b0[_0x8dbf('0x48')],_0x1807e5[_0x8dbf('0x47')]));_0x1510ea[_0x8dbf('0x50')][_0x8dbf('0x63')]=_0x4ed145['id'];if(_0x4903b0[_0x8dbf('0x48')]['filter']){_0x1510ea['where']=_[_0x8dbf('0x53')](_0x1510ea[_0x8dbf('0x50')],{'$or':_[_0x8dbf('0x41')](_0x1510ea[_0x8dbf('0x49')],function(_0x4bb446){var _0x5c3152={};_0x5c3152[_0x4bb446]={'$like':'%'+_0x4903b0[_0x8dbf('0x48')][_0x8dbf('0x52')]+'%'};return _0x5c3152;})});}if(_0x4903b0[_0x8dbf('0x48')][_0x8dbf('0xa0')]){var _0x49baff=_0x4903b0[_0x8dbf('0x48')]['$gte'][_0x8dbf('0xa1')](',');var _0xbcf3c3={};_0xbcf3c3[_0x49baff[0x0]]={'$gte':moment(_0x49baff[0x1])[_0x8dbf('0xa2')](_0x8dbf('0xa3'))};_0x1510ea[_0x8dbf('0x50')]=_['merge'](_0x1510ea[_0x8dbf('0x50')],_0xbcf3c3);}_0x1510ea=_[_0x8dbf('0x53')]({},_0x1510ea,_0x4903b0['options']);return db[_0x8dbf('0x9f')][_0x8dbf('0x30')]({'where':_0x1510ea[_0x8dbf('0x50')]})['then'](function(_0x3bbdad){_0x5b61e4['count']=_0x3bbdad;if(_0x4903b0['query'][_0x8dbf('0x56')]){_0x1510ea[_0x8dbf('0x57')]=[{'all':!![]}];}return db[_0x8dbf('0x9f')][_0x8dbf('0x58')](_0x1510ea);})['then'](function(_0x30b627){if(_0x4903b0['query'][_0x8dbf('0xa4')]==='true'){for(var _0x156295=0x0;_0x156295<_0x30b627[_0x8dbf('0x4c')];_0x156295++){_0x30b627[_0x156295]['body']=juice(_0x30b627[_0x156295][_0x8dbf('0x5f')]);}}_0x5b61e4[_0x8dbf('0x59')]=_0x30b627;return _0x5b61e4;});}})[_0x8dbf('0x22')](respondWithFilteredResult(_0x41e778,_0x1510ea))[_0x8dbf('0x5a')](handleError(_0x41e778,null));};exports[_0x8dbf('0x3b')]=function(_0x31c3d9,_0x2b8c95,_0x5e63bd){var _0x3276e4,_0x24a227={},_0x27f64f;if(_0x31c3d9['body']['to']){_0x27f64f=_0x31c3d9[_0x8dbf('0x5f')]['to'][_0x8dbf('0xa1')](',')[0x0];}return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x31c3d9[_0x8dbf('0x60')]['id']},'include':[{'model':db[_0x8dbf('0xa5')],'as':_0x8dbf('0xa6'),'include':[{'model':db[_0x8dbf('0x8e')],'as':'Contacts','where':{'email':_0x27f64f},'limit':0x1,'order':[[_0x8dbf('0xa7'),_0x8dbf('0xa8')]]}]},{'model':db[_0x8dbf('0x61')],'as':_0x8dbf('0x3f'),'raw':!![]}]})[_0x8dbf('0x22')](handleEntityNotFound(_0x2b8c95,null))['then'](function(_0x48e1d7){if(_0x48e1d7){_0x3276e4=_0x48e1d7;if(_0x48e1d7[_0x8dbf('0x3f')]){if(_[_0x8dbf('0x72')](_0x31c3d9[_0x8dbf('0x5f')][_0x8dbf('0xa9')])){_0x31c3d9[_0x8dbf('0x5f')]['from']=util[_0x8dbf('0xa2')](_0x8dbf('0xaa'),_0x48e1d7[_0x8dbf('0x3a')],_0x48e1d7[_0x8dbf('0x70')]||_0x48e1d7[_0x8dbf('0x3f')][_0x8dbf('0x77')]);}if(_0x31c3d9[_0x8dbf('0x5f')]['attachments']&&_0x31c3d9['body'][_0x8dbf('0xab')][_0x8dbf('0x4c')]){for(var _0x167343=0x0;_0x167343<_0x31c3d9[_0x8dbf('0x5f')]['attachments'][_0x8dbf('0x4c')];_0x167343+=0x1){_0x31c3d9['body'][_0x8dbf('0xab')][_0x167343]={'filename':_0x31c3d9[_0x8dbf('0x5f')][_0x8dbf('0xab')][_0x167343]['name'],'path':path['join'](config['root'],_0x8dbf('0xac'),_0x31c3d9['body'][_0x8dbf('0xab')][_0x167343][_0x8dbf('0xad')])};}}var _0x257972={'tls':{'rejectUnauthorized':![]}};if(_[_0x8dbf('0x72')](_0x48e1d7[_0x8dbf('0x3f')][_0x8dbf('0x7e')])){if(_0x48e1d7[_0x8dbf('0x3f')]['authentication']){_0x257972[_0x8dbf('0xae')]={'user':_0x48e1d7['Smtp'][_0x8dbf('0x77')],'pass':_0x48e1d7['Smtp']['pass']};}_0x257972['host']=_0x48e1d7[_0x8dbf('0x3f')][_0x8dbf('0x7d')];_0x257972[_0x8dbf('0x7c')]=_0x48e1d7['Smtp']['port'];_0x257972['secure']=_0x48e1d7['Smtp'][_0x8dbf('0xaf')];}else{_0x257972[_0x8dbf('0x7e')]=_0x48e1d7[_0x8dbf('0x3f')]['service'];_0x257972[_0x8dbf('0xae')]={'user':_0x48e1d7[_0x8dbf('0x3f')]['user'],'pass':_0x48e1d7['Smtp'][_0x8dbf('0x79')]};}return respondWithRpcPromise(_0x8dbf('0xb0'),_0x8dbf('0xb1'),{'account':_0x257972,'message':_0x31c3d9['body']});}else{throw new Error(_0x8dbf('0xb2'));}}})[_0x8dbf('0x22')](function(_0x359da0){if(_0x359da0){_0x24a227=_0x359da0;if(_0x3276e4[_0x8dbf('0xa6')]){if(_0x3276e4[_0x8dbf('0xa6')][_0x8dbf('0xb3')]['length']){return _0x3276e4[_0x8dbf('0xa6')][_0x8dbf('0xb3')][0x0];}else{return db['CmContact'][_0x8dbf('0x64')](_[_0x8dbf('0x1a')](_0x31c3d9['body'],{'firstName':_0x31c3d9[_0x8dbf('0x5f')]['to'],'email':_0x31c3d9[_0x8dbf('0x5f')]['to'],'phone':_0x31c3d9[_0x8dbf('0x5f')]['to'],'ListId':_0x3276e4[_0x8dbf('0x71')]}));}}else{throw new Error(_0x8dbf('0xb2'));}}})[_0x8dbf('0x22')](function(_0x377d71){if(_0x377d71){var _0x5f51ac={'UserId':_0x31c3d9[_0x8dbf('0x77')]['id'],'ContactId':_0x377d71['id'],'MailAccountId':_0x3276e4['id'],'inReplyTo':_0x24a227[_0x8dbf('0xb4')],'to':_0x31c3d9[_0x8dbf('0x5f')][_0x8dbf('0xa9')],'cc':_0x31c3d9[_0x8dbf('0x5f')]['cc'],'subject':_0x31c3d9[_0x8dbf('0x5f')][_0x8dbf('0xb5')],'attach':_0x31c3d9['body']['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x8dbf('0xa2')](_0x8dbf('0xa3')),'lastMsgDirection':'out','Messages':[_[_0x8dbf('0x53')](_0x31c3d9['body'],{'messageId':_0x24a227[_0x8dbf('0xb4')],'sentAt':moment()[_0x8dbf('0xa2')](_0x8dbf('0xa3')),'read':!![],'MailAccountId':_0x3276e4['id'],'UserId':_0x31c3d9[_0x8dbf('0x77')]['id'],'ContactId':_0x377d71['id']})]};if(_0x31c3d9['body']['Interaction']){_0x5f51ac=_[_0x8dbf('0x53')](_0x5f51ac,_0x31c3d9[_0x8dbf('0x5f')][_0x8dbf('0xb6')]);}return db[_0x8dbf('0x8d')][_0x8dbf('0x64')](_0x5f51ac,{'include':[{'model':db[_0x8dbf('0x9f')],'as':_0x8dbf('0xb7')}]});}})[_0x8dbf('0x22')](respondWithResult(_0x2b8c95,null))[_0x8dbf('0x5a')](handleError(_0x2b8c95,null));};exports[_0x8dbf('0xb8')]=function(_0x56cdd7,_0x332234,_0x1beb0c){return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x56cdd7[_0x8dbf('0x60')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x8dbf('0x3f'),'raw':!![]}]})['then'](handleEntityNotFound(_0x332234,null))[_0x8dbf('0x22')](function(_0x238f9a){if(_0x238f9a&&_0x238f9a['Smtp']){var _0x40373c={'id':_0x238f9a['id'],'tls':{'rejectUnauthorized':![]}};if(_0x238f9a[_0x8dbf('0x3f')][_0x8dbf('0x7e')]){_0x40373c[_0x8dbf('0x7e')]=_0x238f9a['Smtp'][_0x8dbf('0x7e')];}else{_0x40373c[_0x8dbf('0x7d')]=_0x238f9a['Smtp'][_0x8dbf('0x7d')];_0x40373c[_0x8dbf('0x7c')]=_0x238f9a[_0x8dbf('0x3f')][_0x8dbf('0x7c')];_0x40373c[_0x8dbf('0xaf')]=_0x238f9a['Smtp'][_0x8dbf('0xaf')];}if(_0x238f9a['Smtp']['authentication']){_0x40373c['auth']={'user':_0x238f9a['Smtp'][_0x8dbf('0x77')],'pass':_0x238f9a[_0x8dbf('0x3f')][_0x8dbf('0x79')]};}return respondWithRpcPromise(_0x8dbf('0xb9'),'verifySmtp',{'account':_0x40373c});}})[_0x8dbf('0x22')](respondWithResult(_0x332234,null))[_0x8dbf('0x5a')](handleError(_0x332234,null));};exports[_0x8dbf('0x36')]=function(_0x3e7c7f,_0x24c767){return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0x3e7c7f[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x24c767,null))[_0x8dbf('0x22')](function(_0x12a62f){if(_0x12a62f&&_0x12a62f[_0x8dbf('0x7e')]){throw new db['Sequelize']['ValidationError'](_0x8dbf('0xba'));}return _0x12a62f;})[_0x8dbf('0x22')](removeEntity(_0x24c767,null))[_0x8dbf('0x5a')](handleError(_0x24c767,null));};exports['addAgents']=function(_0x4c3aa7,_0x511f6d,_0x15c5a4){return db[_0x8dbf('0x42')]['find']({'where':{'id':_0x4c3aa7['params']['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x511f6d,null))['then'](function(_0x1f78b1){if(_0x1f78b1){return _0x1f78b1[_0x8dbf('0xbb')](_0x4c3aa7[_0x8dbf('0x5f')][_0x8dbf('0x6a')],_[_0x8dbf('0x8b')](_0x4c3aa7[_0x8dbf('0x5f')],[_0x8dbf('0x6a'),'id'])||{})['spread'](function(_0x1a0c66){for(var _0x823bc5=0x0;_0x823bc5<_0x4c3aa7[_0x8dbf('0x5f')]['ids'][_0x8dbf('0x4c')];_0x823bc5+=0x1){socket[_0x8dbf('0xbc')]('userMailAccount:save',{'UserId':Number(_0x4c3aa7['body'][_0x8dbf('0x6a')][_0x823bc5]),'MailAccountId':Number(_0x4c3aa7[_0x8dbf('0x60')]['id'])});}return _0x1a0c66;});}})[_0x8dbf('0x22')](respondWithResult(_0x511f6d,null))[_0x8dbf('0x5a')](handleError(_0x511f6d,null));};exports['removeAgents']=function(_0xd1e77a,_0x4f832f,_0x45dbb6){return db[_0x8dbf('0x42')][_0x8dbf('0x5e')]({'where':{'id':_0xd1e77a[_0x8dbf('0x60')]['id']}})[_0x8dbf('0x22')](handleEntityNotFound(_0x4f832f,null))['then'](function(_0x223e39){if(_0x223e39){return _0x223e39['removeAgents'](_0xd1e77a[_0x8dbf('0x48')][_0x8dbf('0x6a')])['then'](function(){if(_[_0x8dbf('0xbd')](_0xd1e77a[_0x8dbf('0x48')][_0x8dbf('0x6a')])){for(var _0x57cf65=0x0;_0x57cf65<_0xd1e77a[_0x8dbf('0x48')]['ids'][_0x8dbf('0x4c')];_0x57cf65+=0x1){socket[_0x8dbf('0xbc')]('userMailAccount:remove',{'UserId':Number(_0xd1e77a[_0x8dbf('0x48')]['ids'][_0x57cf65]),'MailAccountId':Number(_0xd1e77a[_0x8dbf('0x60')]['id'])});}}else{socket[_0x8dbf('0xbc')](_0x8dbf('0xbe'),{'UserId':Number(_0xd1e77a[_0x8dbf('0x48')][_0x8dbf('0x6a')]),'MailAccountId':Number(_0xd1e77a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x4f832f,null))[_0x8dbf('0x5a')](handleError(_0x4f832f,null));};exports[_0x8dbf('0xbf')]=function(_0x186987,_0x42feeb,_0x462047){var _0x202315={};var _0x5da68a={};var _0x10548e;var _0x3862a2;return db['MailAccount'][_0x8dbf('0x66')]({'where':{'id':_0x186987[_0x8dbf('0x60')]['id']}})['then'](handleEntityNotFound(_0x42feeb,null))['then'](function(_0x1affbb){if(_0x1affbb){_0x10548e=_0x1affbb;_0x5da68a[_0x8dbf('0x45')]=_['keys'](db[_0x8dbf('0x90')][_0x8dbf('0x5d')]);_0x5da68a[_0x8dbf('0x48')]=_[_0x8dbf('0x46')](_0x186987['query']);_0x5da68a[_0x8dbf('0x47')]=_[_0x8dbf('0x4a')](_0x5da68a['model'],_0x5da68a['query']);_0x202315[_0x8dbf('0x49')]=_[_0x8dbf('0x4a')](_0x5da68a['model'],qs[_0x8dbf('0x4b')](_0x186987['query'][_0x8dbf('0x4b')]));_0x202315['attributes']=_0x202315['attributes']['length']?_0x202315['attributes']:_0x5da68a['model'];_0x202315['order']=qs[_0x8dbf('0x4f')](_0x186987[_0x8dbf('0x48')]['sort']);_0x202315[_0x8dbf('0x50')]=qs['filters'](_[_0x8dbf('0x51')](_0x186987['query'],_0x5da68a[_0x8dbf('0x47')]));if(_0x186987[_0x8dbf('0x48')][_0x8dbf('0x52')]){_0x202315[_0x8dbf('0x50')]=_['merge'](_0x202315[_0x8dbf('0x50')],{'$or':_['map'](_0x202315[_0x8dbf('0x49')],function(_0x588fb2){var _0x35670b={};_0x35670b[_0x588fb2]={'$like':'%'+_0x186987[_0x8dbf('0x48')]['filter']+'%'};return _0x35670b;})});}_0x202315=_['merge']({},_0x202315,_0x186987[_0x8dbf('0x55')]);return _0x10548e[_0x8dbf('0xbf')](_0x202315);}})[_0x8dbf('0x22')](function(_0x557f44){if(_0x557f44){_0x3862a2=_0x557f44[_0x8dbf('0x4c')];if(!_0x186987['query']['hasOwnProperty'](_0x8dbf('0x68'))){_0x202315[_0x8dbf('0x2e')]=qs[_0x8dbf('0x2e')](_0x186987[_0x8dbf('0x48')][_0x8dbf('0x2e')]);_0x202315[_0x8dbf('0x2d')]=qs[_0x8dbf('0x2d')](_0x186987['query'][_0x8dbf('0x2d')]);}return _0x10548e[_0x8dbf('0xbf')](_0x202315);}})[_0x8dbf('0x22')](function(_0x6f04f9){if(_0x6f04f9){return _0x6f04f9?{'count':_0x3862a2,'rows':_0x6f04f9}:null;}})['then'](respondWithResult(_0x42feeb,null))[_0x8dbf('0x5a')](handleError(_0x42feeb,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index ef769e9..f608d93 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 _0x4baf=['events','MailAccount','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x1fef22,_0x398a0a){var _0x546f71=function(_0x3a1803){while(--_0x3a1803){_0x1fef22['push'](_0x1fef22['shift']());}};_0x546f71(++_0x398a0a);}(_0x4baf,0xb4));var _0xf4ba=function(_0x6bf808,_0xaeb44f){_0x6bf808=_0x6bf808-0x0;var _0x12d209=_0x4baf[_0x6bf808];return _0x12d209;};'use strict';var EventEmitter=require(_0xf4ba('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xf4ba('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xf4ba('0x2')](0x0);var events={'afterCreate':_0xf4ba('0x3'),'afterUpdate':_0xf4ba('0x4'),'afterDestroy':_0xf4ba('0x5')};function emitEvent(_0x99dfe0){return function(_0x1e16aa,_0x1bac1a,_0x23e730){MailAccountEvents['emit'](_0x99dfe0+':'+_0x1e16aa['id'],_0x1e16aa);MailAccountEvents[_0xf4ba('0x6')](_0x99dfe0,_0x1e16aa);_0x23e730(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xf4ba('0x7')](e,emitEvent(event));}}module[_0xf4ba('0x8')]=MailAccountEvents; \ No newline at end of file +var _0xb782=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x1c0b28,_0x2eff70){var _0xa037eb=function(_0x2c225a){while(--_0x2c225a){_0x1c0b28['push'](_0x1c0b28['shift']());}};_0xa037eb(++_0x2eff70);}(_0xb782,0xd1));var _0x2b78=function(_0x4d4a16,_0xf66787){_0x4d4a16=_0x4d4a16-0x0;var _0xe14beb=_0xb782[_0x4d4a16];return _0xe14beb;};'use strict';var EventEmitter=require(_0x2b78('0x0'));var MailAccount=require(_0x2b78('0x1'))['db'][_0x2b78('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x2b78('0x3')](0x0);var events={'afterCreate':_0x2b78('0x4'),'afterUpdate':_0x2b78('0x5'),'afterDestroy':_0x2b78('0x6')};function emitEvent(_0x1b836c){return function(_0x336844,_0x369375,_0x3f86a1){MailAccountEvents[_0x2b78('0x7')](_0x1b836c+':'+_0x336844['id'],_0x336844);MailAccountEvents['emit'](_0x1b836c,_0x336844);_0x3f86a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x2b78('0x8')](e,emitEvent(event));}}module[_0x2b78('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 751c234..f0a9c60 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 _0x86ac=['request-promise','path','rimraf','../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','api','moment'];(function(_0x317dcf,_0x4148f9){var _0x28cce4=function(_0x4085db){while(--_0x4085db){_0x317dcf['push'](_0x317dcf['shift']());}};_0x28cce4(++_0x4148f9);}(_0x86ac,0x189));var _0xc86a=function(_0xdd2a62,_0x512710){_0xdd2a62=_0xdd2a62-0x0;var _0xef6843=_0x86ac[_0xdd2a62];return _0xef6843;};'use strict';var _=require(_0xc86a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc86a('0x1'));var moment=require(_0xc86a('0x2'));var BPromise=require('bluebird');var rp=require(_0xc86a('0x3'));var fs=require('fs');var path=require(_0xc86a('0x4'));var rimraf=require(_0xc86a('0x5'));var config=require(_0xc86a('0x6'));var attributes=require(_0xc86a('0x7'));module[_0xc86a('0x8')]=function(_0x1bcd1f,_0x50763d){return _0x1bcd1f[_0xc86a('0x9')](_0xc86a('0xa'),attributes,{'tableName':_0xc86a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4302=['util','api','moment','path','rimraf','../../config/environment','./mailAccount.attributes','exports','lodash'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0x4302,0x86));var _0x2430=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4302[_0x4154a6];return _0x3b2786;};'use strict';var _=require(_0x2430('0x0'));var util=require(_0x2430('0x1'));var logger=require('../../config/logger')(_0x2430('0x2'));var moment=require(_0x2430('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2430('0x4'));var rimraf=require(_0x2430('0x5'));var config=require(_0x2430('0x6'));var attributes=require(_0x2430('0x7'));module[_0x2430('0x8')]=function(_0x3da57f,_0x22f28f){return _0x3da57f['define']('MailAccount',attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 67d1918..bb95858 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 _0xe3b5=['isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','MailServerOut','Smtp','get','account','omit','applications','priority','asc','autoclose','push','length','close','*,*,*,*','create','contact','messageId','generate','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','inReplyTo','Contact\x20not\x20found','spread','update','subject','attach','interaction','created','MailMessage','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetMailAccount','MailAccount','options','raw','where','attributes','limit','include','model','map','stringify','ShowMailAccount','find','then','NotifyMailAccount','body','mail','difference','keys','CmContact','createdAt','ListId'];(function(_0x420c1e,_0x56699b){var _0x45dea2=function(_0x15c976){while(--_0x15c976){_0x420c1e['push'](_0x420c1e['shift']());}};_0x45dea2(++_0x56699b);}(_0xe3b5,0x174));var _0x5e3b=function(_0x3aba40,_0x57a115){_0x3aba40=_0x3aba40-0x0;var _0x2983a9=_0xe3b5[_0x3aba40];return _0x2983a9;};'use strict';var _=require('lodash');var util=require(_0x5e3b('0x0'));var moment=require(_0x5e3b('0x1'));var BPromise=require(_0x5e3b('0x2'));var rs=require(_0x5e3b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e3b('0x4'))['db'];var utils=require(_0x5e3b('0x5'));var logger=require(_0x5e3b('0x6'))(_0x5e3b('0x7'));var config=require(_0x5e3b('0x8'));var jayson=require(_0x5e3b('0x9'));var client=jayson[_0x5e3b('0xa')]['http']({'port':0x232c});config[_0x5e3b('0xb')]=_[_0x5e3b('0xc')](config[_0x5e3b('0xb')],{'host':_0x5e3b('0xd'),'port':0x18eb});var socket=require(_0x5e3b('0xe'))(new Redis(config[_0x5e3b('0xb')]));require(_0x5e3b('0xf'))['register'](socket);function respondWithRpcPromise(_0x10bd1e,_0x40c0d0,_0x3bbe44){return new BPromise(function(_0x39f89b,_0x5ec30d){return client['request'](_0x10bd1e,_0x3bbe44)['then'](function(_0x46e227){logger['info'](_0x5e3b('0x10'),_0x40c0d0,_0x5e3b('0x11'));logger[_0x5e3b('0x12')](_0x5e3b('0x13'),_0x40c0d0,_0x5e3b('0x11'),JSON['stringify'](_0x46e227));if(_0x46e227[_0x5e3b('0x14')]){if(_0x46e227[_0x5e3b('0x14')][_0x5e3b('0x15')]===0x1f4){logger[_0x5e3b('0x14')](_0x5e3b('0x10'),_0x40c0d0,_0x46e227['error'][_0x5e3b('0x16')]);return _0x5ec30d(_0x46e227[_0x5e3b('0x14')][_0x5e3b('0x16')]);}logger[_0x5e3b('0x14')](_0x5e3b('0x10'),_0x40c0d0,_0x46e227[_0x5e3b('0x14')][_0x5e3b('0x16')]);return _0x39f89b(_0x46e227[_0x5e3b('0x14')][_0x5e3b('0x16')]);}else{logger[_0x5e3b('0x17')](_0x5e3b('0x10'),_0x40c0d0,_0x5e3b('0x11'));_0x39f89b(_0x46e227[_0x5e3b('0x18')][_0x5e3b('0x16')]);}})[_0x5e3b('0x19')](function(_0xda144e){logger[_0x5e3b('0x14')]('MailAccount,\x20%s,\x20%s',_0x40c0d0,_0xda144e);_0x5ec30d(_0xda144e);});});}exports[_0x5e3b('0x1a')]=function(_0x3a5202){var _0x4a84c7=this;return new Promise(function(_0x3cdbf2,_0x5d71e4){return db[_0x5e3b('0x1b')]['findAll']({'raw':_0x3a5202[_0x5e3b('0x1c')]?_0x3a5202[_0x5e3b('0x1c')][_0x5e3b('0x1d')]===undefined?!![]:![]:!![],'where':_0x3a5202['options']?_0x3a5202[_0x5e3b('0x1c')][_0x5e3b('0x1e')]||null:null,'attributes':_0x3a5202[_0x5e3b('0x1c')]?_0x3a5202[_0x5e3b('0x1c')][_0x5e3b('0x1f')]||null:null,'limit':_0x3a5202[_0x5e3b('0x1c')]?_0x3a5202[_0x5e3b('0x1c')][_0x5e3b('0x20')]||null:null,'include':_0x3a5202[_0x5e3b('0x1c')]?_0x3a5202[_0x5e3b('0x1c')][_0x5e3b('0x21')]?_['map'](_0x3a5202[_0x5e3b('0x1c')][_0x5e3b('0x21')],function(_0x2793dc){return{'model':db[_0x2793dc[_0x5e3b('0x22')]],'as':_0x2793dc['as'],'attributes':_0x2793dc['attributes'],'include':_0x2793dc[_0x5e3b('0x21')]?_[_0x5e3b('0x23')](_0x2793dc[_0x5e3b('0x21')],function(_0x320ae6){return{'model':db[_0x320ae6[_0x5e3b('0x22')]],'as':_0x320ae6['as'],'attributes':_0x320ae6[_0x5e3b('0x1f')],'include':_0x320ae6['include']?_[_0x5e3b('0x23')](_0x320ae6[_0x5e3b('0x21')],function(_0x3cf498){return{'model':db[_0x3cf498[_0x5e3b('0x22')]],'as':_0x3cf498['as'],'attributes':_0x3cf498[_0x5e3b('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5904eb){logger['info']('GetMailAccount',_0x3a5202);logger[_0x5e3b('0x12')]('GetMailAccount',_0x3a5202,JSON[_0x5e3b('0x24')](_0x5904eb));_0x3cdbf2(_0x5904eb);})['catch'](function(_0x48f7bb){logger[_0x5e3b('0x14')](_0x5e3b('0x1a'),_0x48f7bb['message'],_0x3a5202);_0x5d71e4(_0x4a84c7[_0x5e3b('0x14')](0x1f4,_0x48f7bb[_0x5e3b('0x16')]));});});};exports[_0x5e3b('0x25')]=function(_0x5ac95a){var _0x24a0f1=this;return new Promise(function(_0x2291a8,_0x41445d){return db[_0x5e3b('0x1b')][_0x5e3b('0x26')]({'raw':_0x5ac95a[_0x5e3b('0x1c')]?_0x5ac95a[_0x5e3b('0x1c')][_0x5e3b('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ac95a[_0x5e3b('0x1c')]?_0x5ac95a[_0x5e3b('0x1c')][_0x5e3b('0x1e')]||null:null,'attributes':_0x5ac95a['options']?_0x5ac95a[_0x5e3b('0x1c')][_0x5e3b('0x1f')]||null:null,'include':_0x5ac95a[_0x5e3b('0x1c')]?_0x5ac95a[_0x5e3b('0x1c')][_0x5e3b('0x21')]?_[_0x5e3b('0x23')](_0x5ac95a[_0x5e3b('0x1c')][_0x5e3b('0x21')],function(_0x3b9a31){return{'model':db[_0x3b9a31['model']],'as':_0x3b9a31['as'],'attributes':_0x3b9a31[_0x5e3b('0x1f')],'include':_0x3b9a31[_0x5e3b('0x21')]?_['map'](_0x3b9a31[_0x5e3b('0x21')],function(_0x1c3424){return{'model':db[_0x1c3424['model']],'as':_0x1c3424['as'],'attributes':_0x1c3424['attributes'],'include':_0x1c3424[_0x5e3b('0x21')]?_[_0x5e3b('0x23')](_0x1c3424[_0x5e3b('0x21')],function(_0x3b511c){return{'model':db[_0x3b511c[_0x5e3b('0x22')]],'as':_0x3b511c['as'],'attributes':_0x3b511c['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e3b('0x27')](function(_0x47e125){logger[_0x5e3b('0x17')](_0x5e3b('0x25'),_0x5ac95a);logger[_0x5e3b('0x12')](_0x5e3b('0x25'),_0x5ac95a,JSON[_0x5e3b('0x24')](_0x47e125));_0x2291a8(_0x47e125);})[_0x5e3b('0x19')](function(_0x354150){logger[_0x5e3b('0x14')]('ShowMailAccount',_0x354150['message'],_0x5ac95a);_0x41445d(_0x24a0f1[_0x5e3b('0x14')](0x1f4,_0x354150[_0x5e3b('0x16')]));});});};exports[_0x5e3b('0x28')]=function(_0x8510b9){var _0x26fcdd=this;return new Promise(function(_0x86c8e1,_0x458051){var _0xb5e7ca={'body':_0x8510b9[_0x5e3b('0x29')],'channel':_0x5e3b('0x2a')};var _0x11a73b=_[_0x5e3b('0x2b')](_[_0x5e3b('0x2c')](db[_0x5e3b('0x2d')]['rawAttributes']),[_0x5e3b('0x2e'),'updatedAt','CompanyId',_0x5e3b('0x2f')]);var _0x39240a=![];if(_0x8510b9['body']['id']){delete _0x8510b9[_0x5e3b('0x29')]['id'];}if(_[_0x5e3b('0x30')](_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x31')])){return _0x458051(_0x26fcdd[_0x5e3b('0x14')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x5e3b('0x30')](_0x8510b9[_0x5e3b('0x29')]['body'])||_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x29')]===''){return _0x458051(_0x26fcdd[_0x5e3b('0x14')](0x1f4,_0x5e3b('0x32')));}if(_['isNil'](_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x33')])){return _0x458051(_0x26fcdd['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11a73b));}if(!_['includes'](_0x11a73b,_0x8510b9['body'][_0x5e3b('0x33')])){return _0x458051(_0x26fcdd[_0x5e3b('0x14')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x11a73b));}var _0x35eb30={};_0x35eb30[_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x33')]]=_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x31')];return db[_0x5e3b('0x1b')][_0x5e3b('0x26')]({'where':{'id':_0x8510b9['account']['id']},'include':[{'model':db[_0x5e3b('0x34')],'as':_0x5e3b('0x35'),'include':[{'model':db[_0x5e3b('0x2d')],'as':_0x5e3b('0x36'),'where':_0x35eb30,'limit':0x1,'order':[[_0x5e3b('0x37'),_0x5e3b('0x38')]]}]},{'model':db[_0x5e3b('0x39')],'as':_0x5e3b('0x3a')},{'model':db[_0x5e3b('0x3b')],'as':_0x5e3b('0x3c')}]})[_0x5e3b('0x27')](function(_0x339653){if(_0x339653&&_0x339653[_0x5e3b('0x35')]){var _0x16167b=_0x339653[_0x5e3b('0x3d')]({'plain':!![]});_0xb5e7ca[_0x5e3b('0x3e')]=_[_0x5e3b('0x3f')](_0x16167b,['Applications',_0x5e3b('0x35')]);_0xb5e7ca[_0x5e3b('0x40')]=_0x16167b[_0x5e3b('0x3a')];_0xb5e7ca['list']=_0x16167b[_0x5e3b('0x35')];_0xb5e7ca[_0x5e3b('0x40')]=_['orderBy'](_0xb5e7ca[_0x5e3b('0x40')],[_0x5e3b('0x41')],[_0x5e3b('0x42')]);if(_0xb5e7ca[_0x5e3b('0x3e')]&&_0xb5e7ca['account'][_0x5e3b('0x43')]){_0xb5e7ca[_0x5e3b('0x40')][_0x5e3b('0x44')]({'id':0x0,'priority':_0xb5e7ca[_0x5e3b('0x40')][_0x5e3b('0x45')]+0x1,'app':_0x5e3b('0x46'),'appdata':_0x5e3b('0x43'),'interval':_0x5e3b('0x47')});}if(_0xb5e7ca[_0x5e3b('0x3e')]['Applications']){delete _0xb5e7ca[_0x5e3b('0x3e')][_0x5e3b('0x3a')];}if(_0xb5e7ca[_0x5e3b('0x3e')]['List']){delete _0xb5e7ca[_0x5e3b('0x3e')][_0x5e3b('0x35')];}if(_0x16167b[_0x5e3b('0x35')][_0x5e3b('0x36')][_0x5e3b('0x45')]){return _0x16167b[_0x5e3b('0x35')][_0x5e3b('0x36')][0x0];}var _0x10a09e=_[_0x5e3b('0xc')](_0x8510b9['body'],{'firstName':_0x8510b9['body'][_0x5e3b('0x31')],'ListId':_0x16167b[_0x5e3b('0x2f')]});_0x10a09e[_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x33')]]=_0x8510b9['body'][_0x5e3b('0x31')];return db[_0x5e3b('0x2d')][_0x5e3b('0x48')](_0x10a09e);}else{throw new Error('List\x20not\x20found');}})['then'](function(_0x14553b){_0xb5e7ca[_0x5e3b('0x49')]=_0x14553b;if(_0x14553b){if(!_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x4a')]){_0x8510b9['body'][_0x5e3b('0x16')][_0x5e3b('0x4a')]=rs[_0x5e3b('0x4b')]()+'\x20'+_0x8510b9['body'][_0x5e3b('0x16')][_0x5e3b('0x31')];}var _0x5cc6f4={'ContactId':_0x14553b['id'],'MailAccountId':_0x8510b9[_0x5e3b('0x3e')]['id'],'inReplyTo':_0x8510b9[_0x5e3b('0x29')]['message'][_0x5e3b('0x4a')],'to':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x31')],'cc':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')]['cc'],'subject':_0x8510b9[_0x5e3b('0x29')]['message']['subject'],'attach':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')]['attach'],'lastMsgAt':moment()[_0x5e3b('0x4c')](_0x5e3b('0x4d')),'lastMsgDirection':'in'};return db[_0x5e3b('0x4e')][_0x5e3b('0x26')]({'where':{'closed':![],'MailAccountId':_0x8510b9[_0x5e3b('0x3e')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x5e3b('0x4a')],'where':{'messageId':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x4f')]}}]})['then'](function(_0x1d6561){if(_0x1d6561){return[_0x1d6561,![]];}return db['MailInteraction'][_0x5e3b('0x48')](_0x5cc6f4)['then'](function(_0x1dafc2){return[_0x1dafc2,!![]];});});}else{throw new Error(_0x5e3b('0x50'));}})[_0x5e3b('0x51')](function(_0x48389b,_0x4a93f9){if(_0x48389b){_0x39240a=_0x4a93f9;if(!_0x4a93f9){return _0x48389b[_0x5e3b('0x52')]({'inReplyTo':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x4a')],'to':_0x8510b9['body'][_0x5e3b('0x16')]['from'],'cc':_0x8510b9[_0x5e3b('0x29')]['message']['cc'],'subject':_0x8510b9[_0x5e3b('0x29')]['message'][_0x5e3b('0x53')],'attach':_0x48389b['attach']?_0x48389b[_0x5e3b('0x54')]:_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x54')],'substatus':null,'substatusAt':moment()['format'](_0x5e3b('0x4d')),'lastMsgAt':moment()[_0x5e3b('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x48389b;}}})[_0x5e3b('0x27')](function(_0x389528){_0xb5e7ca[_0x5e3b('0x55')]=_0x389528[_0x5e3b('0x3d')]({'plain':!![]});_0xb5e7ca['interaction'][_0x5e3b('0x56')]=_0x39240a;return db[_0x5e3b('0x57')][_0x5e3b('0x48')]({'body':_0x8510b9[_0x5e3b('0x29')]['body'],'MailAccountId':_0x8510b9[_0x5e3b('0x3e')]['id'],'MailInteractionId':_0x389528['id'],'direction':'in','ContactId':_0xb5e7ca[_0x5e3b('0x49')]['id'],'messageId':_0x8510b9['body'][_0x5e3b('0x16')]['messageId'],'from':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')]['from'],'to':_0x8510b9[_0x5e3b('0x29')]['message']['to'],'cc':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')]['cc'],'subject':_0x8510b9['body'][_0x5e3b('0x16')][_0x5e3b('0x53')],'attach':_0x8510b9['body'][_0x5e3b('0x16')][_0x5e3b('0x54')],'Attachments':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x58')],'originTo':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x59')],'originCc':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x5a')],'bcc':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x5b')],'ChatWebsiteId':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x5c')]||null,'originChannel':_0x8510b9[_0x5e3b('0x29')]['message'][_0x5e3b('0x5d')]||_0x5e3b('0x5e'),'ChatOfflineMessageId':_0x8510b9[_0x5e3b('0x29')][_0x5e3b('0x16')][_0x5e3b('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':_0x5e3b('0x60')}]});})['then'](function(_0x4bd5f0){_0xb5e7ca[_0x5e3b('0x16')]=_0x4bd5f0;if(_0xb5e7ca[_0x5e3b('0x55')][_0x5e3b('0x61')]){return db[_0x5e3b('0x62')][_0x5e3b('0x26')]({'attributes':['id',_0x5e3b('0x63')],'where':{'id':_0xb5e7ca[_0x5e3b('0x55')][_0x5e3b('0x61')]}})['then'](function(_0x21d5a0){if(_0x21d5a0){_0xb5e7ca[_0x5e3b('0x40')][_0x5e3b('0x64')]({'id':0x0,'priority':0x0,'app':_0x5e3b('0x65'),'appdata':_0x21d5a0[_0x5e3b('0x63')]+','+(_0xb5e7ca[_0x5e3b('0x3e')][_0x5e3b('0x66')]||0xa),'interval':_0x5e3b('0x47')});}return respondWithRpcPromise(_0x5e3b('0x67'),_0x5e3b('0x68'),_0xb5e7ca);});}return respondWithRpcPromise('Start','startRouting',_0xb5e7ca);})['then'](function(_0xec47eb){_0x86c8e1(_0xec47eb);})[_0x5e3b('0x19')](function(_0x1d712d){_0x458051(_0x26fcdd[_0x5e3b('0x14')](0x1f4,_0x1d712d[_0x5e3b('0x16')]));});});}; \ No newline at end of file +var _0xfcc8=['omit','Applications','applications','list','orderBy','asc','push','length','close','autoclose','*,*,*,*','Contacts','create','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','spread','interaction','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','User','name','UserId','waitForTheAssignedAgent','startRouting','Start','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','./mailAccount.socket','request','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','include','map','model','then','debug','catch','ShowMailAccount','where','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList','List','DESC','MailApplication','Smtp','get'];(function(_0x23343a,_0x4a2aee){var _0x15ea1e=function(_0x4f7a0b){while(--_0x4f7a0b){_0x23343a['push'](_0x23343a['shift']());}};_0x15ea1e(++_0x4a2aee);}(_0xfcc8,0xf3));var _0x8fcc=function(_0x1f21ee,_0x1c76bc){_0x1f21ee=_0x1f21ee-0x0;var _0x4309b1=_0xfcc8[_0x1f21ee];return _0x4309b1;};'use strict';var _=require('lodash');var util=require(_0x8fcc('0x0'));var moment=require(_0x8fcc('0x1'));var BPromise=require(_0x8fcc('0x2'));var rs=require(_0x8fcc('0x3'));var fs=require('fs');var Redis=require(_0x8fcc('0x4'));var db=require(_0x8fcc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8fcc('0x6'))('rpc');var config=require(_0x8fcc('0x7'));var jayson=require(_0x8fcc('0x8'));var client=jayson[_0x8fcc('0x9')]['http']({'port':0x232c});config['redis']=_[_0x8fcc('0xa')](config[_0x8fcc('0xb')],{'host':_0x8fcc('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8fcc('0xd'))['register'](socket);function respondWithRpcPromise(_0x618b0f,_0x1195ca,_0x2d81d7){return new BPromise(function(_0x2ad9c5,_0x531392){return client[_0x8fcc('0xe')](_0x618b0f,_0x2d81d7)['then'](function(_0x3ec6e1){logger[_0x8fcc('0xf')]('MailAccount,\x20%s,\x20%s',_0x1195ca,_0x8fcc('0x10'));logger['debug'](_0x8fcc('0x11'),_0x1195ca,_0x8fcc('0x10'),JSON[_0x8fcc('0x12')](_0x3ec6e1));if(_0x3ec6e1[_0x8fcc('0x13')]){if(_0x3ec6e1[_0x8fcc('0x13')][_0x8fcc('0x14')]===0x1f4){logger[_0x8fcc('0x13')](_0x8fcc('0x15'),_0x1195ca,_0x3ec6e1[_0x8fcc('0x13')][_0x8fcc('0x16')]);return _0x531392(_0x3ec6e1['error']['message']);}logger[_0x8fcc('0x13')](_0x8fcc('0x15'),_0x1195ca,_0x3ec6e1['error'][_0x8fcc('0x16')]);return _0x2ad9c5(_0x3ec6e1[_0x8fcc('0x13')][_0x8fcc('0x16')]);}else{logger[_0x8fcc('0xf')](_0x8fcc('0x15'),_0x1195ca,'request\x20sent');_0x2ad9c5(_0x3ec6e1[_0x8fcc('0x17')][_0x8fcc('0x16')]);}})['catch'](function(_0x393045){logger[_0x8fcc('0x13')](_0x8fcc('0x15'),_0x1195ca,_0x393045);_0x531392(_0x393045);});});}exports[_0x8fcc('0x18')]=function(_0x472281){var _0x1f8c2a=this;return new Promise(function(_0xf59b90,_0x647de2){return db[_0x8fcc('0x19')][_0x8fcc('0x1a')]({'raw':_0x472281[_0x8fcc('0x1b')]?_0x472281[_0x8fcc('0x1b')][_0x8fcc('0x1c')]===undefined?!![]:![]:!![],'where':_0x472281[_0x8fcc('0x1b')]?_0x472281[_0x8fcc('0x1b')]['where']||null:null,'attributes':_0x472281[_0x8fcc('0x1b')]?_0x472281[_0x8fcc('0x1b')][_0x8fcc('0x1d')]||null:null,'limit':_0x472281[_0x8fcc('0x1b')]?_0x472281['options'][_0x8fcc('0x1e')]||null:null,'include':_0x472281[_0x8fcc('0x1b')]?_0x472281['options'][_0x8fcc('0x1f')]?_[_0x8fcc('0x20')](_0x472281['options'][_0x8fcc('0x1f')],function(_0x4eaeea){return{'model':db[_0x4eaeea[_0x8fcc('0x21')]],'as':_0x4eaeea['as'],'attributes':_0x4eaeea[_0x8fcc('0x1d')],'include':_0x4eaeea['include']?_[_0x8fcc('0x20')](_0x4eaeea[_0x8fcc('0x1f')],function(_0x286345){return{'model':db[_0x286345[_0x8fcc('0x21')]],'as':_0x286345['as'],'attributes':_0x286345[_0x8fcc('0x1d')],'include':_0x286345[_0x8fcc('0x1f')]?_[_0x8fcc('0x20')](_0x286345['include'],function(_0x5e44b9){return{'model':db[_0x5e44b9[_0x8fcc('0x21')]],'as':_0x5e44b9['as'],'attributes':_0x5e44b9[_0x8fcc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8fcc('0x22')](function(_0x531c72){logger[_0x8fcc('0xf')](_0x8fcc('0x18'),_0x472281);logger[_0x8fcc('0x23')]('GetMailAccount',_0x472281,JSON[_0x8fcc('0x12')](_0x531c72));_0xf59b90(_0x531c72);})[_0x8fcc('0x24')](function(_0x4dbaa2){logger[_0x8fcc('0x13')](_0x8fcc('0x18'),_0x4dbaa2['message'],_0x472281);_0x647de2(_0x1f8c2a['error'](0x1f4,_0x4dbaa2[_0x8fcc('0x16')]));});});};exports[_0x8fcc('0x25')]=function(_0xb8a5b5){var _0x1bf11c=this;return new Promise(function(_0x2085b7,_0x47585e){return db[_0x8fcc('0x19')]['find']({'raw':_0xb8a5b5[_0x8fcc('0x1b')]?_0xb8a5b5[_0x8fcc('0x1b')][_0x8fcc('0x1c')]===undefined?!![]:![]:!![],'where':_0xb8a5b5[_0x8fcc('0x1b')]?_0xb8a5b5[_0x8fcc('0x1b')][_0x8fcc('0x26')]||null:null,'attributes':_0xb8a5b5[_0x8fcc('0x1b')]?_0xb8a5b5[_0x8fcc('0x1b')][_0x8fcc('0x1d')]||null:null,'include':_0xb8a5b5['options']?_0xb8a5b5[_0x8fcc('0x1b')][_0x8fcc('0x1f')]?_[_0x8fcc('0x20')](_0xb8a5b5[_0x8fcc('0x1b')]['include'],function(_0x2f185c){return{'model':db[_0x2f185c[_0x8fcc('0x21')]],'as':_0x2f185c['as'],'attributes':_0x2f185c['attributes'],'include':_0x2f185c[_0x8fcc('0x1f')]?_[_0x8fcc('0x20')](_0x2f185c[_0x8fcc('0x1f')],function(_0x2c80a6){return{'model':db[_0x2c80a6['model']],'as':_0x2c80a6['as'],'attributes':_0x2c80a6[_0x8fcc('0x1d')],'include':_0x2c80a6[_0x8fcc('0x1f')]?_[_0x8fcc('0x20')](_0x2c80a6[_0x8fcc('0x1f')],function(_0x25a37f){return{'model':db[_0x25a37f['model']],'as':_0x25a37f['as'],'attributes':_0x25a37f['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fcc('0x22')](function(_0x14bd72){logger[_0x8fcc('0xf')]('ShowMailAccount',_0xb8a5b5);logger[_0x8fcc('0x23')](_0x8fcc('0x25'),_0xb8a5b5,JSON[_0x8fcc('0x12')](_0x14bd72));_0x2085b7(_0x14bd72);})[_0x8fcc('0x24')](function(_0x39bbc6){logger['error'](_0x8fcc('0x25'),_0x39bbc6[_0x8fcc('0x16')],_0xb8a5b5);_0x47585e(_0x1bf11c[_0x8fcc('0x13')](0x1f4,_0x39bbc6[_0x8fcc('0x16')]));});});};exports[_0x8fcc('0x27')]=function(_0xc41f50){var _0x50966e=this;return new Promise(function(_0x22c6dd,_0x418cfc){var _0x5aa883={'body':_0xc41f50[_0x8fcc('0x28')],'channel':_0x8fcc('0x29')};var _0x2460f1=_[_0x8fcc('0x2a')](_[_0x8fcc('0x2b')](db[_0x8fcc('0x2c')][_0x8fcc('0x2d')]),['createdAt',_0x8fcc('0x2e'),_0x8fcc('0x2f'),'ListId']);var _0x429c89=![];if(_0xc41f50[_0x8fcc('0x28')]['id']){delete _0xc41f50['body']['id'];}if(_[_0x8fcc('0x30')](_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x31')])){return _0x418cfc(_0x50966e[_0x8fcc('0x13')](0x1f4,_0x8fcc('0x32')));}if(_[_0x8fcc('0x30')](_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x28')])||_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x28')]===''){return _0x418cfc(_0x50966e[_0x8fcc('0x13')](0x1f4,_0x8fcc('0x33')));}if(_[_0x8fcc('0x30')](_0xc41f50[_0x8fcc('0x28')]['mapKey'])){return _0x418cfc(_0x50966e[_0x8fcc('0x13')](0x1f4,_0x8fcc('0x34')+_0x2460f1));}if(!_[_0x8fcc('0x35')](_0x2460f1,_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x36')])){return _0x418cfc(_0x50966e[_0x8fcc('0x13')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2460f1));}var _0x387a35={};_0x387a35[_0xc41f50['body']['mapKey']]=_0xc41f50['body'][_0x8fcc('0x31')];return db['MailAccount'][_0x8fcc('0x37')]({'where':{'id':_0xc41f50[_0x8fcc('0x38')]['id']},'include':[{'model':db[_0x8fcc('0x39')],'as':_0x8fcc('0x3a'),'include':[{'model':db[_0x8fcc('0x2c')],'as':'Contacts','where':_0x387a35,'limit':0x1,'order':[[_0x8fcc('0x2e'),_0x8fcc('0x3b')]]}]},{'model':db[_0x8fcc('0x3c')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x8fcc('0x3d')}]})[_0x8fcc('0x22')](function(_0x4cdec4){if(_0x4cdec4&&_0x4cdec4[_0x8fcc('0x3a')]){var _0x3fe1b9=_0x4cdec4[_0x8fcc('0x3e')]({'plain':!![]});_0x5aa883[_0x8fcc('0x38')]=_[_0x8fcc('0x3f')](_0x3fe1b9,[_0x8fcc('0x40'),'List']);_0x5aa883[_0x8fcc('0x41')]=_0x3fe1b9[_0x8fcc('0x40')];_0x5aa883[_0x8fcc('0x42')]=_0x3fe1b9[_0x8fcc('0x3a')];_0x5aa883[_0x8fcc('0x41')]=_[_0x8fcc('0x43')](_0x5aa883[_0x8fcc('0x41')],['priority'],[_0x8fcc('0x44')]);if(_0x5aa883[_0x8fcc('0x38')]&&_0x5aa883[_0x8fcc('0x38')]['autoclose']){_0x5aa883[_0x8fcc('0x41')][_0x8fcc('0x45')]({'id':0x0,'priority':_0x5aa883[_0x8fcc('0x41')][_0x8fcc('0x46')]+0x1,'app':_0x8fcc('0x47'),'appdata':_0x8fcc('0x48'),'interval':_0x8fcc('0x49')});}if(_0x5aa883['account']['Applications']){delete _0x5aa883['account'][_0x8fcc('0x40')];}if(_0x5aa883[_0x8fcc('0x38')][_0x8fcc('0x3a')]){delete _0x5aa883[_0x8fcc('0x38')]['List'];}if(_0x3fe1b9[_0x8fcc('0x3a')][_0x8fcc('0x4a')][_0x8fcc('0x46')]){return _0x3fe1b9['List'][_0x8fcc('0x4a')][0x0];}var _0x52d383=_[_0x8fcc('0xa')](_0xc41f50[_0x8fcc('0x28')],{'firstName':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x31')],'ListId':_0x3fe1b9['ListId']});_0x52d383[_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x36')]]=_0xc41f50['body'][_0x8fcc('0x31')];return db[_0x8fcc('0x2c')][_0x8fcc('0x4b')](_0x52d383);}else{throw new Error('List\x20not\x20found');}})[_0x8fcc('0x22')](function(_0x207210){_0x5aa883[_0x8fcc('0x4c')]=_0x207210;if(_0x207210){if(!_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x4d')]){_0xc41f50[_0x8fcc('0x28')]['message'][_0x8fcc('0x4d')]=rs[_0x8fcc('0x4e')]()+'\x20'+_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x31')];}var _0x1ec231={'ContactId':_0x207210['id'],'MailAccountId':_0xc41f50[_0x8fcc('0x38')]['id'],'inReplyTo':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')]['messageId'],'to':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x31')],'cc':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')]['cc'],'subject':_0xc41f50['body'][_0x8fcc('0x16')][_0x8fcc('0x4f')],'attach':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x50')],'lastMsgAt':moment()[_0x8fcc('0x51')](_0x8fcc('0x52')),'lastMsgDirection':'in'};return db[_0x8fcc('0x53')][_0x8fcc('0x37')]({'where':{'closed':![],'MailAccountId':_0xc41f50[_0x8fcc('0x38')]['id']},'include':[{'model':db[_0x8fcc('0x54')],'as':_0x8fcc('0x55'),'attributes':[_0x8fcc('0x4d')],'where':{'messageId':_0xc41f50['body']['message'][_0x8fcc('0x56')]}}]})[_0x8fcc('0x22')](function(_0x6cbf87){if(_0x6cbf87){return[_0x6cbf87,![]];}return db[_0x8fcc('0x53')][_0x8fcc('0x4b')](_0x1ec231)[_0x8fcc('0x22')](function(_0xa5ab58){return[_0xa5ab58,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x8fcc('0x57')](function(_0x1d36e8,_0x5613f7){if(_0x1d36e8){_0x429c89=_0x5613f7;if(!_0x5613f7){return _0x1d36e8['update']({'inReplyTo':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x4d')],'to':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x31')],'cc':_0xc41f50['body'][_0x8fcc('0x16')]['cc'],'subject':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')]['subject'],'attach':_0x1d36e8[_0x8fcc('0x50')]?_0x1d36e8[_0x8fcc('0x50')]:_0xc41f50[_0x8fcc('0x28')]['message']['attach'],'substatus':null,'substatusAt':moment()[_0x8fcc('0x51')](_0x8fcc('0x52')),'lastMsgAt':moment()[_0x8fcc('0x51')](_0x8fcc('0x52')),'lastMsgDirection':'in'});}else{return _0x1d36e8;}}})[_0x8fcc('0x22')](function(_0x330b67){_0x5aa883[_0x8fcc('0x58')]=_0x330b67['get']({'plain':!![]});_0x5aa883[_0x8fcc('0x58')]['created']=_0x429c89;return db[_0x8fcc('0x54')][_0x8fcc('0x4b')]({'body':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x28')],'MailAccountId':_0xc41f50[_0x8fcc('0x38')]['id'],'MailInteractionId':_0x330b67['id'],'direction':'in','ContactId':_0x5aa883['contact']['id'],'messageId':_0xc41f50['body'][_0x8fcc('0x16')][_0x8fcc('0x4d')],'from':_0xc41f50['body'][_0x8fcc('0x16')]['from'],'to':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')]['to'],'cc':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')]['cc'],'subject':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x4f')],'attach':_0xc41f50['body'][_0x8fcc('0x16')][_0x8fcc('0x50')],'Attachments':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')]['attachments'],'originTo':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')]['originTo'],'originCc':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x59')],'bcc':_0xc41f50['body'][_0x8fcc('0x16')]['bcc'],'ChatWebsiteId':_0xc41f50[_0x8fcc('0x28')]['message'][_0x8fcc('0x5a')]||null,'originChannel':_0xc41f50[_0x8fcc('0x28')]['message'][_0x8fcc('0x5b')]||_0x8fcc('0x5c'),'ChatOfflineMessageId':_0xc41f50[_0x8fcc('0x28')][_0x8fcc('0x16')][_0x8fcc('0x5d')]||null},{'include':[{'model':db[_0x8fcc('0x5e')],'as':_0x8fcc('0x5f')}]});})[_0x8fcc('0x22')](function(_0x1c3d1f){_0x5aa883['message']=_0x1c3d1f;if(_0x5aa883[_0x8fcc('0x58')]['UserId']){return db[_0x8fcc('0x60')][_0x8fcc('0x37')]({'attributes':['id',_0x8fcc('0x61')],'where':{'id':_0x5aa883[_0x8fcc('0x58')][_0x8fcc('0x62')]}})['then'](function(_0x2e40ec){if(_0x2e40ec){_0x5aa883[_0x8fcc('0x41')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2e40ec[_0x8fcc('0x61')]+','+(_0x5aa883[_0x8fcc('0x38')][_0x8fcc('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x8fcc('0x64'),_0x5aa883);});}return respondWithRpcPromise(_0x8fcc('0x65'),_0x8fcc('0x64'),_0x5aa883);})['then'](function(_0x392957){_0x22c6dd(_0x392957);})[_0x8fcc('0x24')](function(_0xa705b){_0x418cfc(_0x50966e[_0x8fcc('0x13')](0x1f4,_0xa705b[_0x8fcc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 446e1d9..0cc718a 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 _0x7932=['./mailAccount.events','save','update','emit','register','length'];(function(_0x33c3d3,_0x51eed3){var _0xf3a17f=function(_0x22c578){while(--_0x22c578){_0x33c3d3['push'](_0x33c3d3['shift']());}};_0xf3a17f(++_0x51eed3);}(_0x7932,0xf0));var _0x2793=function(_0x1bf153,_0x3fe992){_0x1bf153=_0x1bf153-0x0;var _0x5266c5=_0x7932[_0x1bf153];return _0x5266c5;};'use strict';var MailAccountEvents=require(_0x2793('0x0'));var events=[_0x2793('0x1'),'remove',_0x2793('0x2')];function createListener(_0x426484,_0x295d48){return function(_0x13f93d){_0x295d48[_0x2793('0x3')](_0x426484,_0x13f93d);};}function removeListener(_0x47387d,_0x29539d){return function(){MailAccountEvents['removeListener'](_0x47387d,_0x29539d);};}exports[_0x2793('0x4')]=function(_0xacd552){for(var _0x45a3d2=0x0,_0x35659f=events[_0x2793('0x5')];_0x45a3d2<_0x35659f;_0x45a3d2++){var _0x36285c=events[_0x45a3d2];var _0x5c1b63=createListener('mailAccount:'+_0x36285c,_0xacd552);MailAccountEvents['on'](_0x36285c,_0x5c1b63);}}; \ No newline at end of file +var _0x7ace=['remove','update','removeListener','register','length','mailAccount:','./mailAccount.events','save'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7ace,0xd6));var _0xe7ac=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x7ace[_0x413feb];return _0x40ee88;};'use strict';var MailAccountEvents=require(_0xe7ac('0x0'));var events=[_0xe7ac('0x1'),_0xe7ac('0x2'),_0xe7ac('0x3')];function createListener(_0x1bbd3c,_0x31ec55){return function(_0x1264a8){_0x31ec55['emit'](_0x1bbd3c,_0x1264a8);};}function removeListener(_0x53d981,_0x49125d){return function(){MailAccountEvents[_0xe7ac('0x4')](_0x53d981,_0x49125d);};}exports[_0xe7ac('0x5')]=function(_0x86e9d3){for(var _0x13b7cb=0x0,_0x31f22a=events[_0xe7ac('0x6')];_0x13b7cb<_0x31f22a;_0x13b7cb++){var _0x29a04f=events[_0x13b7cb];var _0x110917=createListener(_0xe7ac('0x7')+_0x29a04f,_0x86e9d3);MailAccountEvents['on'](_0x29a04f,_0x110917);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 5fb07be..b292bda 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 _0x30c0=['../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3a2123,_0x4c26b8){var _0x4304b8=function(_0x553bd1){while(--_0x553bd1){_0x3a2123['push'](_0x3a2123['shift']());}};_0x4304b8(++_0x4c26b8);}(_0x30c0,0x12a));var _0x030c=function(_0x88dc24,_0x342523){_0x88dc24=_0x88dc24-0x0;var _0x33bd76=_0x30c0[_0x88dc24];return _0x33bd76;};'use strict';var multer=require(_0x030c('0x0'));var util=require('util');var path=require(_0x030c('0x1'));var timeout=require('connect-timeout');var express=require(_0x030c('0x2'));var router=express['Router']();var fs_extra=require(_0x030c('0x3'));var auth=require(_0x030c('0x4'));var interaction=require(_0x030c('0x5'));var config=require(_0x030c('0x6'));var controller=require(_0x030c('0x7'));router[_0x030c('0x8')](_0x030c('0x9'),auth[_0x030c('0xa')](),controller[_0x030c('0xb')]);router[_0x030c('0xc')]('/:id',auth[_0x030c('0xa')](),controller['update']);router[_0x030c('0xd')](_0x030c('0x9'),auth[_0x030c('0xa')](),controller[_0x030c('0xe')]);module[_0x030c('0xf')]=router; \ No newline at end of file +var _0x2a2f=['../../components/interaction/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x17759d,_0x4b58e1){var _0x5522a3=function(_0x4c2a4c){while(--_0x4c2a4c){_0x17759d['push'](_0x17759d['shift']());}};_0x5522a3(++_0x4b58e1);}(_0x2a2f,0x1e5));var _0xf2a2=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x2a2f[_0x465a0c];return _0x1e202e;};'use strict';var multer=require(_0xf2a2('0x0'));var util=require(_0xf2a2('0x1'));var path=require(_0xf2a2('0x2'));var timeout=require(_0xf2a2('0x3'));var express=require(_0xf2a2('0x4'));var router=express[_0xf2a2('0x5')]();var fs_extra=require(_0xf2a2('0x6'));var auth=require(_0xf2a2('0x7'));var interaction=require(_0xf2a2('0x8'));var config=require(_0xf2a2('0x9'));var controller=require(_0xf2a2('0xa'));router[_0xf2a2('0xb')]('/:id',auth[_0xf2a2('0xc')](),controller['show']);router['put'](_0xf2a2('0xd'),auth[_0xf2a2('0xc')](),controller[_0xf2a2('0xe')]);router[_0xf2a2('0xf')](_0xf2a2('0xd'),auth[_0xf2a2('0xc')](),controller[_0xf2a2('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 4c64c7a..ce0db2b 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 _0x8688=['*,*,*,*','STRING','noop','TEXT'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x8688,0xa5));var _0x8868=function(_0x34eaf8,_0x126eb9){_0x34eaf8=_0x34eaf8-0x0;var _0x23b0fc=_0x8688[_0x34eaf8];return _0x23b0fc;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8868('0x0')],'allowNull':![],'defaultValue':_0x8868('0x1')},'appdata':{'type':Sequelize[_0x8868('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8868('0x0')],'defaultValue':_0x8868('0x3')}}; \ No newline at end of file +var _0x3403=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x542ffd,_0x5da2dd){var _0x131cb5=function(_0x35898b){while(--_0x35898b){_0x542ffd['push'](_0x542ffd['shift']());}};_0x131cb5(++_0x5da2dd);}(_0x3403,0x99));var _0x3340=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x3403[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0x3340('0x0'));module[_0x3340('0x1')]={'priority':{'type':Sequelize[_0x3340('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3340('0x3')],'allowNull':![],'defaultValue':_0x3340('0x4')},'appdata':{'type':Sequelize[_0x3340('0x5')]()},'description':{'type':Sequelize[_0x3340('0x3')]},'interval':{'type':Sequelize[_0x3340('0x3')],'defaultValue':_0x3340('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 748f5d8..52c65dd 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 _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(_0x48229a,_0x2dac65){var _0x5342e5=function(_0x3ccffe){while(--_0x3ccffe){_0x48229a['push'](_0x48229a['shift']());}};_0x5342e5(++_0x2dac65);}(_0x70e0,0x17b));var _0x070e=function(_0x13b2a6,_0x422285){_0x13b2a6=_0x13b2a6-0x0;var _0x5baf77=_0x70e0[_0x13b2a6];return _0x5baf77;};'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 +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(_0x41cd34,_0x32cd0c){var _0x1273e8=function(_0x34f4f6){while(--_0x34f4f6){_0x41cd34['push'](_0x41cd34['shift']());}};_0x1273e8(++_0x32cd0c);}(_0x70e0,0x17b));var _0x070e=function(_0x5f477b,_0x288161){_0x5f477b=_0x5f477b-0x0;var _0x30946c=_0x70e0[_0x5f477b];return _0x30946c;};'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 8768aec..9caa126 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 _0xaa5f=['api','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports','define','mail_applications','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x1db313,_0x459644){var _0x2c1895=function(_0x58b0e0){while(--_0x58b0e0){_0x1db313['push'](_0x1db313['shift']());}};_0x2c1895(++_0x459644);}(_0xaa5f,0xb4));var _0xfaa5=function(_0x2d2aad,_0x260a95){_0x2d2aad=_0x2d2aad-0x0;var _0x32e93a=_0xaa5f[_0x2d2aad];return _0x32e93a;};'use strict';var _=require(_0xfaa5('0x0'));var util=require('util');var logger=require(_0xfaa5('0x1'))(_0xfaa5('0x2'));var moment=require(_0xfaa5('0x3'));var BPromise=require(_0xfaa5('0x4'));var rp=require(_0xfaa5('0x5'));var fs=require('fs');var path=require(_0xfaa5('0x6'));var rimraf=require(_0xfaa5('0x7'));var config=require('../../config/environment');var attributes=require(_0xfaa5('0x8'));module[_0xfaa5('0x9')]=function(_0x2c131b,_0x499584){return _0x2c131b[_0xfaa5('0xa')]('MailApplication',attributes,{'tableName':_0xfaa5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfaa5('0xc')});}; \ No newline at end of file +var _0x49cb=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x3b45bb,_0x12c57c){var _0x1757dc=function(_0x139be3){while(--_0x139be3){_0x3b45bb['push'](_0x3b45bb['shift']());}};_0x1757dc(++_0x12c57c);}(_0x49cb,0xb0));var _0xb49c=function(_0x207410,_0x45e49a){_0x207410=_0x207410-0x0;var _0xa8a72e=_0x49cb[_0x207410];return _0xa8a72e;};'use strict';var _=require('lodash');var util=require(_0xb49c('0x0'));var logger=require(_0xb49c('0x1'))('api');var moment=require(_0xb49c('0x2'));var BPromise=require(_0xb49c('0x3'));var rp=require(_0xb49c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb49c('0x5'));var config=require(_0xb49c('0x6'));var attributes=require(_0xb49c('0x7'));module[_0xb49c('0x8')]=function(_0x5f232b,_0x205b1){return _0x5f232b[_0xb49c('0x9')](_0xb49c('0xa'),attributes,{'tableName':_0xb49c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb49c('0xc'),'collate':_0xb49c('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index bd46636..dfa7a5e 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 _0xf41d=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailApplication','MailApplication','body','options','where','attributes','lodash','util','moment','randomstring'];(function(_0x44ef14,_0xc512e9){var _0x3ac3a0=function(_0x80e99c){while(--_0x80e99c){_0x44ef14['push'](_0x44ef14['shift']());}};_0x3ac3a0(++_0xc512e9);}(_0xf41d,0x78));var _0xdf41=function(_0x50517d,_0x3df383){_0x50517d=_0x50517d-0x0;var _0x35d3b4=_0xf41d[_0x50517d];return _0x35d3b4;};'use strict';var _=require(_0xdf41('0x0'));var util=require(_0xdf41('0x1'));var moment=require(_0xdf41('0x2'));var BPromise=require('bluebird');var rs=require(_0xdf41('0x3'));var fs=require('fs');var Redis=require(_0xdf41('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf41('0x5'));var logger=require(_0xdf41('0x6'))(_0xdf41('0x7'));var config=require(_0xdf41('0x8'));var jayson=require(_0xdf41('0x9'));var client=jayson[_0xdf41('0xa')][_0xdf41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a1672,_0x5d4848,_0x75a948){return new BPromise(function(_0x10f010,_0x345f7a){return client[_0xdf41('0xc')](_0x1a1672,_0x75a948)[_0xdf41('0xd')](function(_0x4abb3f){logger[_0xdf41('0xe')](_0xdf41('0xf'),_0x5d4848,_0xdf41('0x10'));logger[_0xdf41('0x11')](_0xdf41('0x12'),_0x5d4848,_0xdf41('0x10'),JSON[_0xdf41('0x13')](_0x4abb3f));if(_0x4abb3f[_0xdf41('0x14')]){if(_0x4abb3f[_0xdf41('0x14')][_0xdf41('0x15')]===0x1f4){logger[_0xdf41('0x14')]('MailApplication,\x20%s,\x20%s',_0x5d4848,_0x4abb3f[_0xdf41('0x14')][_0xdf41('0x16')]);return _0x345f7a(_0x4abb3f[_0xdf41('0x14')]['message']);}logger[_0xdf41('0x14')](_0xdf41('0xf'),_0x5d4848,_0x4abb3f[_0xdf41('0x14')]['message']);return _0x10f010(_0x4abb3f[_0xdf41('0x14')][_0xdf41('0x16')]);}else{logger['info'](_0xdf41('0xf'),_0x5d4848,'request\x20sent');_0x10f010(_0x4abb3f[_0xdf41('0x17')][_0xdf41('0x16')]);}})[_0xdf41('0x18')](function(_0x2274b8){logger[_0xdf41('0x14')](_0xdf41('0xf'),_0x5d4848,_0x2274b8);_0x345f7a(_0x2274b8);});});}exports[_0xdf41('0x19')]=function(_0x569e28){var _0x9eea67=this;return new Promise(function(_0x28d2df,_0x8c9493){return db[_0xdf41('0x1a')]['update'](_0x569e28[_0xdf41('0x1b')],{'raw':_0x569e28[_0xdf41('0x1c')]?_0x569e28[_0xdf41('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x569e28[_0xdf41('0x1c')]?_0x569e28[_0xdf41('0x1c')][_0xdf41('0x1d')]||null:null,'attributes':_0x569e28[_0xdf41('0x1c')]?_0x569e28[_0xdf41('0x1c')][_0xdf41('0x1e')]||null:null,'limit':_0x569e28[_0xdf41('0x1c')]?_0x569e28[_0xdf41('0x1c')]['limit']||null:null})[_0xdf41('0xd')](function(_0x1b7751){logger[_0xdf41('0xe')](_0xdf41('0x19'),_0x569e28);logger[_0xdf41('0x11')]('UpdateMailApplication',_0x569e28,JSON['stringify'](_0x1b7751));_0x28d2df(_0x1b7751);})[_0xdf41('0x18')](function(_0x4be8b4){logger['error'](_0xdf41('0x19'),_0x4be8b4[_0xdf41('0x16')],_0x569e28);_0x8c9493(_0x9eea67[_0xdf41('0x14')](0x1f4,_0x4be8b4['message']));});});}; \ No newline at end of file +var _0x29ce=['rpc','../../config/environment','client','request','info','debug','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','message','error','result','catch','UpdateMailApplication','update','options','where','attributes','limit','then','stringify','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x516536,_0x27f68b){var _0x457651=function(_0x360361){while(--_0x360361){_0x516536['push'](_0x516536['shift']());}};_0x457651(++_0x27f68b);}(_0x29ce,0x96));var _0xe29c=function(_0x27df37,_0x369c69){_0x27df37=_0x27df37-0x0;var _0x123809=_0x29ce[_0x27df37];return _0x123809;};'use strict';var _=require('lodash');var util=require(_0xe29c('0x0'));var moment=require(_0xe29c('0x1'));var BPromise=require(_0xe29c('0x2'));var rs=require(_0xe29c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe29c('0x4'));var logger=require(_0xe29c('0x5'))(_0xe29c('0x6'));var config=require(_0xe29c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe29c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184a1b,_0x1a38e5,_0x5a5c3a){return new BPromise(function(_0x1ab05f,_0x184534){return client[_0xe29c('0x9')](_0x184a1b,_0x5a5c3a)['then'](function(_0x10e071){logger[_0xe29c('0xa')]('MailApplication,\x20%s,\x20%s',_0x1a38e5,'request\x20sent');logger[_0xe29c('0xb')](_0xe29c('0xc'),_0x1a38e5,_0xe29c('0xd'),JSON['stringify'](_0x10e071));if(_0x10e071['error']){if(_0x10e071['error']['code']===0x1f4){logger['error']('MailApplication,\x20%s,\x20%s',_0x1a38e5,_0x10e071['error'][_0xe29c('0xe')]);return _0x184534(_0x10e071[_0xe29c('0xf')]['message']);}logger[_0xe29c('0xf')]('MailApplication,\x20%s,\x20%s',_0x1a38e5,_0x10e071[_0xe29c('0xf')][_0xe29c('0xe')]);return _0x1ab05f(_0x10e071['error'][_0xe29c('0xe')]);}else{logger[_0xe29c('0xa')]('MailApplication,\x20%s,\x20%s',_0x1a38e5,_0xe29c('0xd'));_0x1ab05f(_0x10e071[_0xe29c('0x10')][_0xe29c('0xe')]);}})[_0xe29c('0x11')](function(_0x32f547){logger[_0xe29c('0xf')]('MailApplication,\x20%s,\x20%s',_0x1a38e5,_0x32f547);_0x184534(_0x32f547);});});}exports[_0xe29c('0x12')]=function(_0x308bc1){var _0x105d79=this;return new Promise(function(_0x56235f,_0x4dfa38){return db['MailApplication'][_0xe29c('0x13')](_0x308bc1['body'],{'raw':_0x308bc1[_0xe29c('0x14')]?_0x308bc1[_0xe29c('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x308bc1[_0xe29c('0x14')]?_0x308bc1[_0xe29c('0x14')][_0xe29c('0x15')]||null:null,'attributes':_0x308bc1[_0xe29c('0x14')]?_0x308bc1[_0xe29c('0x14')][_0xe29c('0x16')]||null:null,'limit':_0x308bc1[_0xe29c('0x14')]?_0x308bc1[_0xe29c('0x14')][_0xe29c('0x17')]||null:null})[_0xe29c('0x18')](function(_0x3d72f1){logger['info'](_0xe29c('0x12'),_0x308bc1);logger[_0xe29c('0xb')](_0xe29c('0x12'),_0x308bc1,JSON[_0xe29c('0x19')](_0x3d72f1));_0x56235f(_0x3d72f1);})[_0xe29c('0x11')](function(_0x245bc8){logger[_0xe29c('0xf')]('UpdateMailApplication',_0x245bc8[_0xe29c('0xe')],_0x308bc1);_0x4dfa38(_0x105d79[_0xe29c('0xf')](0x1f4,_0x245bc8[_0xe29c('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e0d0ced..43a9ef4 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 _0x2183=['/:id/download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','mail','mailinteraction:update','delete','mailinteraction:destroy','destroy','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','isAuthenticated','describe','/:id','show','getMessages'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2183,0x1d5));var _0x3218=function(_0x34768d,_0x467806){_0x34768d=_0x34768d-0x0;var _0x2edbed=_0x2183[_0x34768d];return _0x2edbed;};'use strict';var express=require(_0x3218('0x0'));var router=express['Router']();var auth=require(_0x3218('0x1'));var interaction=require(_0x3218('0x2'));var controller=require(_0x3218('0x3'));router[_0x3218('0x4')]('/',auth['isAuthenticated'](),controller[_0x3218('0x5')]);router[_0x3218('0x4')]('/describe',auth[_0x3218('0x6')](),controller[_0x3218('0x7')]);router[_0x3218('0x4')](_0x3218('0x8'),auth['isAuthenticated'](),controller[_0x3218('0x9')]);router['get']('/:id/messages',auth[_0x3218('0x6')](),controller[_0x3218('0xa')]);router[_0x3218('0x4')](_0x3218('0xb'),auth[_0x3218('0x6')](),controller['download']);router[_0x3218('0xc')]('/',auth['isAuthenticated'](),controller[_0x3218('0xd')]);router[_0x3218('0xc')]('/:id/messages',auth[_0x3218('0x6')](),controller[_0x3218('0xe')]);router[_0x3218('0xc')](_0x3218('0xf'),auth[_0x3218('0x6')](),interaction[_0x3218('0x10')]('mail',_0x3218('0x11')),controller[_0x3218('0x12')]);router['put'](_0x3218('0x8'),auth['isAuthenticated'](),interaction['tracked'](_0x3218('0x13'),_0x3218('0x14')),controller['update']);router[_0x3218('0x15')](_0x3218('0x8'),auth[_0x3218('0x6')](),interaction[_0x3218('0x10')](_0x3218('0x13'),_0x3218('0x16')),controller[_0x3218('0x17')]);router[_0x3218('0x15')]('/:id/tags',auth[_0x3218('0x6')](),controller['removeTags']);module['exports']=router; \ No newline at end of file +var _0xc29a=['addTags','put','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/:id','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags'];(function(_0xdbb6cb,_0x3b8fda){var _0x476b50=function(_0x470ebb){while(--_0x470ebb){_0xdbb6cb['push'](_0xdbb6cb['shift']());}};_0x476b50(++_0x3b8fda);}(_0xc29a,0x90));var _0xac29=function(_0x583e1f,_0x41148f){_0x583e1f=_0x583e1f-0x0;var _0x5313a5=_0xc29a[_0x583e1f];return _0x5313a5;};'use strict';var express=require(_0xac29('0x0'));var router=express[_0xac29('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xac29('0x2'));var controller=require(_0xac29('0x3'));router[_0xac29('0x4')]('/',auth[_0xac29('0x5')](),controller[_0xac29('0x6')]);router['get']('/describe',auth[_0xac29('0x5')](),controller['describe']);router[_0xac29('0x4')](_0xac29('0x7'),auth['isAuthenticated'](),controller['show']);router[_0xac29('0x4')](_0xac29('0x8'),auth['isAuthenticated'](),controller[_0xac29('0x9')]);router['get'](_0xac29('0xa'),auth[_0xac29('0x5')](),controller['download']);router[_0xac29('0xb')]('/',auth[_0xac29('0x5')](),controller[_0xac29('0xc')]);router[_0xac29('0xb')]('/:id/messages',auth[_0xac29('0x5')](),controller[_0xac29('0xd')]);router[_0xac29('0xb')](_0xac29('0xe'),auth[_0xac29('0x5')](),interaction[_0xac29('0xf')](_0xac29('0x10'),_0xac29('0x11')),controller[_0xac29('0x12')]);router[_0xac29('0x13')](_0xac29('0x7'),auth[_0xac29('0x5')](),interaction['tracked']('mail',_0xac29('0x14')),controller[_0xac29('0x15')]);router['delete'](_0xac29('0x7'),auth[_0xac29('0x5')](),interaction[_0xac29('0xf')]('mail',_0xac29('0x16')),controller[_0xac29('0x17')]);router[_0xac29('0x18')](_0xac29('0xe'),auth[_0xac29('0x5')](),controller[_0xac29('0x19')]);module[_0xac29('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3504ea7..adff9e7 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 _0xdc30=['exports','BOOLEAN','DATE','STRING','TEXT','ENUM','out','sequelize','iconv'];(function(_0xc96dcd,_0x3384fe){var _0x348bbc=function(_0x25d609){while(--_0x25d609){_0xc96dcd['push'](_0xc96dcd['shift']());}};_0x348bbc(++_0x3384fe);}(_0xdc30,0xd6));var _0x0dc3=function(_0x16af15,_0x55bc76){_0x16af15=_0x16af15-0x0;var _0xfeda8a=_0xdc30[_0x16af15];return _0xfeda8a;};'use strict';var Sequelize=require(_0x0dc3('0x0'));var iconv=require(_0x0dc3('0x1'));module[_0x0dc3('0x2')]={'closed':{'type':Sequelize[_0x0dc3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0dc3('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0dc3('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0dc3('0x5')]},'inReplyTo':{'type':Sequelize[_0x0dc3('0x5')](0x1fe)},'to':{'type':Sequelize[_0x0dc3('0x5')]},'cc':{'type':Sequelize[_0x0dc3('0x6')]('long')},'subject':{'type':Sequelize[_0x0dc3('0x6')]()},'attach':{'type':Sequelize[_0x0dc3('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0dc3('0x4')]},'substatus':{'type':Sequelize[_0x0dc3('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x0dc3('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0dc3('0x7')]('in',_0x0dc3('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0dc3('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x0dc3('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0dc3('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x84e1=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','BOOLEAN'];(function(_0xe77e4c,_0x5265c8){var _0x6d476d=function(_0x57c683){while(--_0x57c683){_0xe77e4c['push'](_0xe77e4c['shift']());}};_0x6d476d(++_0x5265c8);}(_0x84e1,0x9f));var _0x184e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x84e1[_0x51020b];return _0x371e47;};'use strict';var Sequelize=require(_0x184e('0x0'));var iconv=require(_0x184e('0x1'));module['exports']={'closed':{'type':Sequelize[_0x184e('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x184e('0x3')]},'disposition':{'type':Sequelize[_0x184e('0x4')]},'secondDisposition':{'type':Sequelize[_0x184e('0x4')]},'thirdDisposition':{'type':Sequelize[_0x184e('0x4')]},'note':{'type':Sequelize[_0x184e('0x4')]},'inReplyTo':{'type':Sequelize[_0x184e('0x4')](0x1fe)},'to':{'type':Sequelize[_0x184e('0x4')]},'cc':{'type':Sequelize[_0x184e('0x5')](_0x184e('0x6'))},'subject':{'type':Sequelize[_0x184e('0x5')]()},'attach':{'type':Sequelize[_0x184e('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x184e('0x3')]},'substatus':{'type':Sequelize[_0x184e('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x184e('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x184e('0x7')]('in',_0x184e('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x184e('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x184e('0x7')]('in',_0x184e('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index c82f4b2..3c9595a 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 _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a2a75,_0xe3a29e){_0x5a2a75=_0x5a2a75-0x0;var _0x4109c3=_0xb10b[_0x5a2a75];return _0x4109c3;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file +var _0xb10b=['Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','show','params','rawAttributes','includeAll','include','merge','options','create','body','describe','addMessage','ids','omit','getMessages','nolimit','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','existsSync','build','message%d.eml','unlinkSync','eml-format','zip-dir','moment','bluebird','path','lodash','squel','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','stack','name','send','fullname','TagIds','Tags','split','forEach','push','MailMessage','out','-id','trimStart','plainBody','catch','index','map','MailInteraction','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','field','color','tools_tags','u.id','ui.MailInteractionId','from','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','select','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','some','compact','isEmpty','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','isEmail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','MailAccountId','i.MailAccountId\x20IS\x20NOT\x20NULL','role','getMailAccounts','i.MailAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','a.key','Account.key','Account.mandatoryDisposition','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20(\x27%\x27\x20+\x20a.email\x20+\x20\x27%\x27)\x20THEN\x20SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201)\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.secondDisposition','i.thirdDisposition','i.ContactId','i.MailAccountId','Contact.firstName','c.email'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb10b,0x12a));var _0xbb10=function(_0x673ea4,_0x449076){_0x673ea4=_0x673ea4-0x0;var _0x3e5938=_0xb10b[_0x673ea4];return _0x3e5938;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var BPromise=require(_0xbb10('0x3'));var util=require('util');var path=require(_0xbb10('0x4'));var fs=require('fs');var _=require(_0xbb10('0x5'));var squel=require(_0xbb10('0x6'));var juice=require(_0xbb10('0x7'));var Redis=require(_0xbb10('0x8'));var qs=require(_0xbb10('0x9'));var as=require('../../components/parsers/advancedSearch');var logger=require(_0xbb10('0xa'))(_0xbb10('0xb'));var config=require('../../config/environment');var db=require(_0xbb10('0xc'))['db'];config[_0xbb10('0xd')]=_[_0xbb10('0xe')](config[_0xbb10('0xd')],{'host':_0xbb10('0xf'),'port':0x18eb});var socket=require(_0xbb10('0x10'))(new Redis(config[_0xbb10('0xd')]));require(_0xbb10('0x11'))['register'](socket);function respondWithStatusCode(_0x4e47f8,_0x20bd61){_0x20bd61=_0x20bd61||0xcc;return function(_0x118a74){if(_0x118a74){return _0x4e47f8[_0xbb10('0x12')](_0x20bd61);}return _0x4e47f8['status'](_0x20bd61)[_0xbb10('0x13')]();};}function respondWithResult(_0x5be7e0,_0x44fb19){_0x44fb19=_0x44fb19||0xc8;return function(_0x916a32){if(_0x916a32){return _0x5be7e0[_0xbb10('0x14')](_0x44fb19)[_0xbb10('0x15')](_0x916a32);}};}function respondWithFilteredResult(_0x442548,_0x147230){return function(_0x58a612){if(_0x58a612){var _0x26e021=typeof _0x147230[_0xbb10('0x16')]===_0xbb10('0x17')&&typeof _0x147230[_0xbb10('0x18')]===_0xbb10('0x17');var _0x2f2ebf=_0x58a612[_0xbb10('0x19')];var _0x36b5e8=_0x26e021?0x0:_0x147230[_0xbb10('0x16')];var _0x2b184e=_0x26e021?_0x58a612['count']:_0x147230[_0xbb10('0x16')]+_0x147230[_0xbb10('0x18')];var _0x133ac2;if(_0x2b184e>=_0x2f2ebf){_0x2b184e=_0x2f2ebf;_0x133ac2=0xc8;}else{_0x133ac2=0xce;}_0x442548[_0xbb10('0x14')](_0x133ac2);return _0x442548[_0xbb10('0x1a')](_0xbb10('0x1b'),_0x36b5e8+'-'+_0x2b184e+'/'+_0x2f2ebf)[_0xbb10('0x15')](_0x58a612);}return null;};}function saveUpdates(_0x30efc6){return function(_0xbf2906){if(_0xbf2906){return _0xbf2906[_0xbb10('0x1c')](_0x30efc6)['then'](function(_0x5ff0cf){return _0x5ff0cf;});}return null;};}function removeEntity(_0x19f48d){return function(_0x388fab){if(_0x388fab){return _0x388fab[_0xbb10('0x1d')]()[_0xbb10('0x1e')](function(){_0x19f48d[_0xbb10('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12f888){return function(_0x12ef77){if(!_0x12ef77){_0x12f888['sendStatus'](0x194);}return _0x12ef77;};}function handleError(_0x4c4b0d,_0x8e2b97){_0x8e2b97=_0x8e2b97||0x1f4;return function(_0x311abe){logger[_0xbb10('0x1f')](_0x311abe[_0xbb10('0x20')]);if(_0x311abe[_0xbb10('0x21')]){delete _0x311abe[_0xbb10('0x21')];}_0x4c4b0d[_0xbb10('0x14')](_0x8e2b97)[_0xbb10('0x22')](_0x311abe);};}function getInteractionUsers(_0x7f2377,_0x395404){return new BPromise(function(_0x3ba6cd,_0x26ad93){try{if(_0x395404[_0x7f2377['id']]){_0x7f2377['Users']=_['map'](_0x395404[_0x7f2377['id']],function(_0x4fb5e0){return{'id':_0x4fb5e0['id'],'fullname':_0x4fb5e0[_0xbb10('0x23')]};});}}catch(_0x3c5ae7){_0x26ad93(_0x3c5ae7);}_0x3ba6cd(_0x7f2377);});}function getInteractionTags(_0x2c89b9,_0x4e25ff){return new BPromise(function(_0x2fdde9,_0x24d586){try{if(_0x2c89b9[_0xbb10('0x24')]){_0x2c89b9[_0xbb10('0x25')]=[];_0x2c89b9[_0xbb10('0x24')][_0xbb10('0x26')](',')[_0xbb10('0x27')](function(_0x4aabb9){_0x2c89b9[_0xbb10('0x25')][_0xbb10('0x28')](_0x4e25ff[_0x4aabb9]);});}delete _0x2c89b9[_0xbb10('0x24')];}catch(_0x2e0249){_0x24d586(_0x2e0249);}_0x2fdde9(_0x2c89b9);});}function getLastMessageText(_0x1d30aa){return new BPromise(function(_0x2ff4c1,_0x5d5c80){return db[_0xbb10('0x29')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x1d30aa['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbb10('0x2a')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xbb10('0x2b'),'raw':!![]})[_0xbb10('0x1e')](function(_0x1b59f9){if(_0x1b59f9&&_0x1b59f9['plainBody']){_0x1d30aa['lastMsgText']=_[_0xbb10('0x2c')](_0x1b59f9[_0xbb10('0x2d')]);}_0x2ff4c1(_0x1d30aa);})['catch'](function(_0x359ad4){_0x5d5c80(_0x359ad4);});});}function updateMailInteraction(_0x37dde7,_0x2f653f,_0x1c0b57,_0x37a83f){return new BPromise(function(_0x138bc6,_0xf85197){return getInteractionUsers(_0x37dde7,_0x1c0b57)['then'](function(_0x25acb3){return getInteractionTags(_0x25acb3,_0x2f653f);})[_0xbb10('0x1e')](function(_0x441d15){if(_0x37a83f){_0x138bc6(getLastMessageText(_0x441d15));}else{_0x138bc6(_0x441d15);}})[_0xbb10('0x2e')](function(_0xfb2c5e){_0xf85197(_0xfb2c5e);});});}exports[_0xbb10('0x2f')]=function(_0x188cbd,_0x10202c){var _0x3c8d7d={},_0x56943c={},_0x2b5352={'count':0x0,'rows':[]};var _0x150107=_[_0xbb10('0x30')](db[_0xbb10('0x31')]['rawAttributes'],function(_0x111762){return{'name':_0x111762['fieldName'],'type':_0x111762['type'][_0xbb10('0x32')]};});_0x56943c[_0xbb10('0x33')]=_[_0xbb10('0x30')](_0x150107,_0xbb10('0x21'));_0x56943c[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x188cbd['query']);_0x56943c[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x56943c['model'],_0x56943c['query']);_0x3c8d7d['attributes']=_[_0xbb10('0x37')](_0x56943c[_0xbb10('0x33')],qs[_0xbb10('0x38')](_0x188cbd['query'][_0xbb10('0x38')]));_0x3c8d7d[_0xbb10('0x39')]=_0x3c8d7d[_0xbb10('0x39')]['length']?_0x3c8d7d[_0xbb10('0x39')]:_0x56943c[_0xbb10('0x33')];if(!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3a')]('nolimit')){_0x3c8d7d[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0x188cbd['query'][_0xbb10('0x18')]);_0x3c8d7d[_0xbb10('0x16')]=qs[_0xbb10('0x16')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x16')]);}_0x3c8d7d[_0xbb10('0x3b')]=qs['sort'](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x3c8d7d[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_['pick'](_0x188cbd[_0xbb10('0x34')],_0x56943c[_0xbb10('0x36')]),_0x150107);var _0x23dc18=[];var _0x403beb=squel['select']()[_0xbb10('0x3e')]('id')[_0xbb10('0x3e')]('name')['field'](_0xbb10('0x3f'))['from'](_0xbb10('0x40'));var _0x180933=squel['select']()[_0xbb10('0x3e')](_0xbb10('0x41'))[_0xbb10('0x3e')]('u.fullname')[_0xbb10('0x3e')](_0xbb10('0x42'))[_0xbb10('0x43')](_0xbb10('0x44'),'ui')[_0xbb10('0x45')](_0xbb10('0x46'),'u',_0xbb10('0x47'));var _0x3efa96=squel[_0xbb10('0x48')]()[_0xbb10('0x43')](_0xbb10('0x49'),'i')[_0xbb10('0x45')]('cm_contacts','c',_0xbb10('0x4a'))[_0xbb10('0x45')]('users','o',_0xbb10('0x4b'))[_0xbb10('0x45')](_0xbb10('0x4c'),'a',_0xbb10('0x4d'))[_0xbb10('0x45')](_0xbb10('0x4e'),'me',_0xbb10('0x4f'))['left_join']('mail_interaction_has_tags','it',_0xbb10('0x50'))[_0xbb10('0x45')](_0xbb10('0x40'),'t','t.id\x20=\x20it.TagId');var _0x5f0c12=squel[_0xbb10('0x51')]();var _0x34cf4e=[];var _0x1bd054=squel[_0xbb10('0x51')]();var _0x10159b;if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]){_0x10159b=as[_0xbb10('0x53')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x52')]);var _0x550111=_0x10159b['sqlOperator'];for(var _0x412e13=0x0;_0x412e13<_0x10159b[_0xbb10('0x54')][_0xbb10('0x55')];_0x412e13++){var _0xb014b0=_0x10159b[_0xbb10('0x54')][_0x412e13];var _0x440f9e='i';var _0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),_0xb014b0[_0xbb10('0x3e')]]);if(!_0x358e7e){switch(_0xb014b0[_0xbb10('0x3e')]){case _0xbb10('0x57'):if(_0xb014b0[_0xbb10('0x58')]==0x1){_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0[_0xbb10('0x3e')]+'`\x20=\x200');}else{_0x3efa96[_0xbb10('0x59')]('`'+_0xb014b0['field']+_0xbb10('0x5a'));}break;case _0xbb10('0x5b'):if(_0xb014b0[_0xbb10('0x5c')]===_0xbb10('0x5d')){if(_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')]('\x20')[_0xbb10('0x55')]>0x1){_0x5f0c12[_0x550111](_0xbb10('0x5e'),qs[_0xbb10('0x5f')](_0xb014b0[_0xbb10('0x58')]),null);}else{var _0x44a056='%'+_0xb014b0[_0xbb10('0x58')]+'%';_0x5f0c12[_0x550111](_0xbb10('0x60'),_0x44a056,_0x44a056,_0x44a056);}}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'ContactId']);_0xb014b0[_0xbb10('0x3e')]=_0xbb10('0x61');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')]['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);}break;case _0xbb10('0x65'):var _0x14fed3=_0xb014b0[_0xbb10('0x58')][_0xbb10('0x26')](',')[_0xbb10('0x30')](function(_0x12ec18){return Number(_0x12ec18);});_0x14fed3[_0xbb10('0x27')](function(_0x40c4fb){_0x1bd054['or'](_0xbb10('0x66'),'%,'+_0x40c4fb+',%');});_0x34cf4e=_[_0xbb10('0x67')](_0x34cf4e,_0x14fed3);break;case _0xbb10('0x68'):if(_0xb014b0['operator']==='$substring'){_0x5f0c12[_0x550111](_0xbb10('0x69'),'%'+_0xb014b0[_0xbb10('0x58')]+'%',null);}else{_0x358e7e=_[_0xbb10('0x56')](_0x150107,[_0xbb10('0x21'),'UserId']);_0xb014b0['field']=_0xbb10('0x6a');_0x155dc5=as[_0xbb10('0x62')](_0x440f9e,_0x358e7e[_0xbb10('0x63')],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5[_0xbb10('0x64')],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}break;case _0xbb10('0x2d'):_0x155dc5=as[_0xbb10('0x62')]('me',null,_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5['value']['start'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x13')]);break;}}else{var _0x155dc5=as['buildExpression'](_0x440f9e,_0x358e7e['type'],_0xb014b0);_0x5f0c12[_0x550111](_0x155dc5['text'],_0x155dc5[_0xbb10('0x58')][_0xbb10('0x6b')],_0x155dc5[_0xbb10('0x58')]['end']);}}}else{var _0xa1bbd9=_(_0x188cbd[_0xbb10('0x34')])['keys']()['map'](function(_0x27d7b9){return _[_0xbb10('0x6c')](_0x150107,[_0xbb10('0x21'),_0x27d7b9])?_0x27d7b9:undefined;})[_0xbb10('0x6d')]()['value']();if(!_[_0xbb10('0x6e')](_0xa1bbd9)){_0xa1bbd9[_0xbb10('0x27')](function(_0xa7179d){if(_0xa7179d==='MailAccountId'){_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),[][_0xbb10('0x70')](_0x188cbd['query'][_0xa7179d]));}else if(_0xa7179d===_0xbb10('0x71')){var _0x31e85e=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])['$gte'];var _0x251417=JSON[_0xbb10('0x72')](_0x188cbd[_0xbb10('0x34')][_0xa7179d])[_0xbb10('0x73')];_0x3efa96['where'](_0xbb10('0x74'),_0x31e85e,_0x251417);}else{if(_0x188cbd[_0xbb10('0x34')][_0xa7179d]===_0xbb10('0x75')){_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x76'));}else{_0x3efa96[_0xbb10('0x3d')]('i.'+_0xa7179d+_0xbb10('0x77'),_0x188cbd['query'][_0xa7179d]);}}});}if(_0x188cbd['query']['read']){if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x78')]==0x1){_0x3efa96[_0xbb10('0x59')]('`unreadMessages`\x20=\x200');}else{_0x3efa96['having'](_0xbb10('0x79'));}}if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]){_0x34cf4e=_[_0xbb10('0x7b')](_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')])?_0x188cbd['query'][_0xbb10('0x7a')]:new Array(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7a')]);_0x34cf4e[_0xbb10('0x27')](function(_0x2aaaa6){_0x1bd054['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2aaaa6+',%');});}if(_0x188cbd['query']['filter']){var _0x329da7=_0x188cbd[_0xbb10('0x34')][_0xbb10('0x7c')][_0xbb10('0x7d')]('\x5c','\x5c\x5c')[_0xbb10('0x7d')](/'/g,'\x27\x27');if(qs[_0xbb10('0x7e')](_0x329da7)){_0x5f0c12['or']('i.id\x20LIKE\x20?',_0x329da7+'%');}else if(qs[_0xbb10('0x7f')](_0x329da7)){_0x5f0c12['or']('c.email\x20LIKE\x20?',_0x329da7+'%');}else{_0x5f0c12['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x329da7))['or'](_0xbb10('0x80'),qs[_0xbb10('0x5f')](_0x329da7));}}}_0x3efa96[_0xbb10('0x3d')](_0x5f0c12);_0x3efa96[_0xbb10('0x81')]('i.id');var _0x122d38={'type':db['Sequelize']['QueryTypes'][_0xbb10('0x82')],'raw':!![]};var _0xfe3db0=_0x3efa96[_0xbb10('0x83')]();_0xfe3db0[_0xbb10('0x3e')](_0xbb10('0x84'));_0xfe3db0['field'](_0xbb10('0x85'),_0xbb10('0x57'));if(_0x3c8d7d[_0xbb10('0x3b')]){_0x3c8d7d[_0xbb10('0x3b')][_0xbb10('0x27')](function(_0x27f42f){var _0x174395=_0x27f42f[0x0]==='contactName'?_0x27f42f[0x0]:'i.'+_0x27f42f[0x0];_0x3efa96[_0xbb10('0x3b')](_0x174395,_0x27f42f[0x1]===_0xbb10('0x86')?![]:!![]);});}if(!_[_0xbb10('0x6e')](_0x34cf4e)){_0x3efa96[_0xbb10('0x59')](_0x1bd054);_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x87'),_0x34cf4e);}BPromise[_0xbb10('0x88')]()[_0xbb10('0x1e')](function(){if(!_0x10159b){if(_0x188cbd['query'][_0xbb10('0x89')])return;_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8a'));_0x3efa96['where']('i.MailAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x188cbd['user'][_0xbb10('0x8b')]!=='agent')return;return _0x188cbd['user'][_0xbb10('0x8c')]({'attributes':['id'],'raw':!![]})[_0xbb10('0x1e')](function(_0x33ff06){if(_[_0xbb10('0x6e')](_0x33ff06)){_0xfe3db0[_0xbb10('0x3d')](_0xbb10('0x8d'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x8d'));}else{_0xfe3db0[_0xbb10('0x3d')]('i.MailAccountId\x20IN\x20?',_[_0xbb10('0x30')](_0x33ff06,'id'));_0x3efa96[_0xbb10('0x3d')](_0xbb10('0x6f'),_[_0xbb10('0x30')](_0x33ff06,'id'));}});})['then'](function(){if(_0x188cbd['user'][_0xbb10('0x8b')]===_0xbb10('0x8e')&&!_0x10159b&&!_0x188cbd[_0xbb10('0x34')][_0xbb10('0x89')])return[];return db['sequelize'][_0xbb10('0x34')](_0xfe3db0[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0xf7b3e1){_0x2b5352[_0xbb10('0x19')]=_0xf7b3e1['length'];if(_0x2b5352['count']===0x0)return[];return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x403beb[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x256b35){_0x23dc18=_[_0xbb10('0x91')](_0x256b35,'id');_0x122d38=_['merge'](_0x122d38,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x188cbd[_0xbb10('0x34')][_0xbb10('0x38')]){_0x3c8d7d[_0xbb10('0x39')]['forEach'](function(_0x32d5a5){_0x3efa96[_0xbb10('0x3e')]('i.'+_0x32d5a5);});}else{_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x85'),_0xbb10('0x57'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x92'),_0xbb10('0x93'));_0x3efa96[_0xbb10('0x3e')]('a.mandatoryDisposition',_0xbb10('0x94'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x95'),_0xbb10('0x96'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x84'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x97'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x98'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x99'));_0x3efa96['field']('i.closedAt');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9a'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9b'));_0x3efa96[_0xbb10('0x3e')]('i.lastMsgDirection');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9c'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9d'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0x9e'));_0x3efa96['field'](_0xbb10('0x9f'));_0x3efa96[_0xbb10('0x3e')]('i.substatus');_0x3efa96[_0xbb10('0x3e')]('i.to');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa0'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa1'));_0x3efa96[_0xbb10('0x3e')]('i.UserId');_0x3efa96[_0xbb10('0x3e')]('c.firstName',_0xbb10('0xa2'));_0x3efa96[_0xbb10('0x3e')]('c.lastName','Contact.lastName');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa3'),_0xbb10('0xa4'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa5'),_0xbb10('0xa6'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa7'),_0xbb10('0xa8'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xa9'),'Contact.fax');_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xaa'),_0xbb10('0xab'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xac'),_0xbb10('0xad'));_0x3efa96[_0xbb10('0x3e')](_0xbb10('0xae'),_0xbb10('0x24'));}if(_0x3c8d7d[_0xbb10('0x18')])_0x3efa96[_0xbb10('0x18')](_0x3c8d7d[_0xbb10('0x18')]);if(_0x3c8d7d['offset'])_0x3efa96[_0xbb10('0x16')](_0x3c8d7d['offset']);return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x3efa96[_0xbb10('0x8f')](),_0x122d38);})[_0xbb10('0x1e')](function(_0x38d369){if(_0x38d369['length']>0x0)_0x180933[_0xbb10('0x3d')](_0xbb10('0xaf'),_[_0xbb10('0x30')](_0x38d369,'id'));return db[_0xbb10('0x90')][_0xbb10('0x34')](_0x180933[_0xbb10('0x8f')](),_0x122d38)['then'](function(_0x4bd470){var _0x5cc9d7=_[_0xbb10('0xb0')](_0x4bd470,_0xbb10('0xb1'));var _0x57d5a1=[];return db[_0xbb10('0xb2')][_0xbb10('0xb3')]({'attributes':['enableEmailPreview'],'raw':!![]})[_0xbb10('0x1e')](function(_0xaede56){var _0x5642c3=_0xaede56[_0xbb10('0xb4')];_0x38d369['forEach'](function(_0x34cec7){_0x57d5a1[_0xbb10('0x28')](updateMailInteraction(_0x34cec7,_0x23dc18,_0x5cc9d7,_0x5642c3));});return BPromise['all'](_0x57d5a1);});});});})[_0xbb10('0x1e')](function(_0x28cc74){_0x2b5352['rows']=_0x28cc74;return _0x2b5352;})['then'](respondWithFilteredResult(_0x10202c,_0x3c8d7d))[_0xbb10('0x2e')](handleError(_0x10202c,null));};exports[_0xbb10('0xb5')]=function(_0x3e0e34,_0x3299bc){var _0x3ceb77={'raw':![],'where':{'id':_0x3e0e34[_0xbb10('0xb6')]['id']}},_0x4c3bdc={};_0x4c3bdc[_0xbb10('0x33')]=_[_0xbb10('0x35')](db['MailInteraction'][_0xbb10('0xb7')]);_0x4c3bdc[_0xbb10('0x34')]=_[_0xbb10('0x35')](_0x3e0e34[_0xbb10('0x34')]);_0x4c3bdc[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x4c3bdc[_0xbb10('0x33')],_0x4c3bdc[_0xbb10('0x34')]);_0x3ceb77[_0xbb10('0x39')]=_['intersection'](_0x4c3bdc['model'],qs[_0xbb10('0x38')](_0x3e0e34[_0xbb10('0x34')][_0xbb10('0x38')]));_0x3ceb77[_0xbb10('0x39')]=_0x3ceb77[_0xbb10('0x39')][_0xbb10('0x55')]?_0x3ceb77[_0xbb10('0x39')]:_0x4c3bdc[_0xbb10('0x33')];if(_0x3e0e34[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x3ceb77[_0xbb10('0xb9')]=[{'all':!![]}];}_0x3ceb77=_[_0xbb10('0xba')]({},_0x3ceb77,_0x3e0e34[_0xbb10('0xbb')]);return db['MailInteraction'][_0xbb10('0x56')](_0x3ceb77)[_0xbb10('0x1e')](handleEntityNotFound(_0x3299bc,null))[_0xbb10('0x1e')](respondWithResult(_0x3299bc,null))[_0xbb10('0x2e')](handleError(_0x3299bc,null));};exports[_0xbb10('0xbc')]=function(_0xd9284e,_0x4258fc){return db[_0xbb10('0x31')][_0xbb10('0xbc')](_0xd9284e[_0xbb10('0xbd')],{})[_0xbb10('0x1e')](respondWithResult(_0x4258fc,0xc9))['catch'](handleError(_0x4258fc,null));};exports[_0xbb10('0x1c')]=function(_0x5e1ac5,_0x3faaca){if(_0x5e1ac5[_0xbb10('0xbd')]['id']){delete _0x5e1ac5[_0xbb10('0xbd')]['id'];}return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x5e1ac5[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x3faaca,null))[_0xbb10('0x1e')](saveUpdates(_0x5e1ac5['body'],null))[_0xbb10('0x1e')](respondWithResult(_0x3faaca,null))[_0xbb10('0x2e')](handleError(_0x3faaca,null));};exports[_0xbb10('0x1d')]=function(_0x576bb6,_0x2b652c){return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x576bb6[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x2b652c,null))[_0xbb10('0x1e')](removeEntity(_0x2b652c,null))[_0xbb10('0x2e')](handleError(_0x2b652c,null));};exports[_0xbb10('0xbe')]=function(_0x589565,_0x3696b3){return db['MailInteraction'][_0xbb10('0xbe')]()[_0xbb10('0x1e')](respondWithResult(_0x3696b3,null))[_0xbb10('0x2e')](handleError(_0x3696b3,null));};exports[_0xbb10('0xbf')]=function(_0x44c229,_0x40271f){return db[_0xbb10('0x29')]['find']({'where':{'id':_0x44c229[_0xbb10('0xb6')]['id']}})['then'](handleEntityNotFound(_0x40271f,null))['then'](function(_0x1513e0){if(_0x1513e0){return _0x1513e0[_0xbb10('0xbf')](_0x44c229[_0xbb10('0xbd')][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x44c229[_0xbb10('0xbd')],['ids','id'])||{});}})[_0xbb10('0x1e')](respondWithResult(_0x40271f,null))[_0xbb10('0x2e')](handleError(_0x40271f,null));};exports[_0xbb10('0xc2')]=function(_0xb1b7c8,_0x136520){var _0x28127c={'raw':![],'where':{}};var _0x528aff={};var _0xdfdc42={'count':0x0,'rows':[]};return db[_0xbb10('0x31')][_0xbb10('0xb3')]({'where':{'id':_0xb1b7c8[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x136520,null))[_0xbb10('0x1e')](function(_0x2764e1){if(_0x2764e1){_0x528aff['model']=_[_0xbb10('0x35')](db['MailMessage'][_0xbb10('0xb7')]);_0x528aff['query']=_['keys'](_0xb1b7c8[_0xbb10('0x34')]);_0x528aff[_0xbb10('0x36')]=_[_0xbb10('0x37')](_0x528aff[_0xbb10('0x33')],_0x528aff[_0xbb10('0x34')]);_0x28127c['attributes']=_[_0xbb10('0x37')](_0x528aff['model'],qs['fields'](_0xb1b7c8['query'][_0xbb10('0x38')]));_0x28127c[_0xbb10('0x39')]=_0x28127c[_0xbb10('0x39')][_0xbb10('0x55')]?_0x28127c[_0xbb10('0x39')]:_0x528aff['model'];if(!_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3a')](_0xbb10('0xc3'))){_0x28127c[_0xbb10('0x18')]=qs[_0xbb10('0x18')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x18')]);_0x28127c['offset']=qs['offset'](_0xb1b7c8['query'][_0xbb10('0x16')]);}_0x28127c[_0xbb10('0x3b')]=qs[_0xbb10('0x3c')](_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x3c')]);_0x28127c[_0xbb10('0x3d')]=qs[_0xbb10('0x36')](_[_0xbb10('0xc4')](_0xb1b7c8[_0xbb10('0x34')],_0x528aff[_0xbb10('0x36')]));_0x28127c['where']['MailInteractionId']=_0x2764e1['id'];if(_0xb1b7c8['query'][_0xbb10('0x7c')]){_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c['where'],{'$or':_[_0xbb10('0x30')](_0x28127c[_0xbb10('0x39')],function(_0x2c638d){var _0x290280={};_0x290280[_0x2c638d]={'$like':'%'+_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0x7c')]+'%'};return _0x290280;})});}if(_0xb1b7c8['query']['$gte']){var _0x356660=_0xb1b7c8['query'][_0xbb10('0xc5')][_0xbb10('0x26')](',');var _0x152ca9={};_0x152ca9[_0x356660[0x0]]={'$gte':moment(_0x356660[0x1])[_0xbb10('0xc6')](_0xbb10('0xc7'))};_0x28127c[_0xbb10('0x3d')]=_[_0xbb10('0xba')](_0x28127c[_0xbb10('0x3d')],_0x152ca9);}_0x28127c=_[_0xbb10('0xba')]({},_0x28127c,_0xb1b7c8[_0xbb10('0xbb')]);return db['MailMessage'][_0xbb10('0x19')]({'where':_0x28127c['where']})[_0xbb10('0x1e')](function(_0x5547fa){_0xdfdc42[_0xbb10('0x19')]=_0x5547fa;if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xb8')]){_0x28127c[_0xbb10('0xb9')]=[{'all':!![]}];}return db['MailMessage'][_0xbb10('0xc8')](_0x28127c);})['then'](function(_0xfe1154){if(_0xb1b7c8[_0xbb10('0x34')][_0xbb10('0xc9')]==='true'){for(var _0x298167=0x0;_0x298167<_0xfe1154[_0xbb10('0x55')];_0x298167++){_0xfe1154[_0x298167][_0xbb10('0xbd')]=juice(_0xfe1154[_0x298167][_0xbb10('0xbd')]);}}_0xdfdc42[_0xbb10('0xca')]=_0xfe1154;return _0xdfdc42;});}})[_0xbb10('0x1e')](respondWithFilteredResult(_0x136520,_0x28127c))['catch'](handleError(_0x136520,null));};exports['addTags']=function(_0x522a88,_0x26a752){return db['MailInteraction'][_0xbb10('0x56')]({'where':{'id':_0x522a88['params']['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x26a752,null))[_0xbb10('0x1e')](function(_0x385ad3){if(_0x385ad3){return _0x385ad3['setTags'](_0x522a88['body'][_0xbb10('0xc0')],_[_0xbb10('0xc1')](_0x522a88[_0xbb10('0xbd')],['ids','id'])||{})[_0xbb10('0xcb')](function(){return db[_0xbb10('0x65')][_0xbb10('0xc8')]({'attributes':['id','name','color'],'where':{'id':_0x522a88['body'][_0xbb10('0xc0')]}});})['then'](function(_0x3dfbcd){socket[_0xbb10('0xcc')](_0xbb10('0xcd'),{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]});return{'id':Number(_0x522a88[_0xbb10('0xb6')]['id']),'tags':_0x3dfbcd||[]};});}})[_0xbb10('0x1e')](respondWithResult(_0x26a752,null))[_0xbb10('0x2e')](handleError(_0x26a752,null));};exports[_0xbb10('0xce')]=function(_0x2746eb,_0x431792){return db[_0xbb10('0x31')]['find']({'where':{'id':_0x2746eb[_0xbb10('0xb6')]['id']}})[_0xbb10('0x1e')](handleEntityNotFound(_0x431792,null))['then'](function(_0x14ef50){if(_0x14ef50){return _0x14ef50['removeTags'](_0x2746eb['query'][_0xbb10('0xc0')]);}})[_0xbb10('0x1e')](respondWithStatusCode(_0x431792,null))[_0xbb10('0x2e')](handleError(_0x431792,null));};exports[_0xbb10('0xcf')]=function(_0x99c4,_0x4ca4ce){var _0x161171=moment()[_0xbb10('0xd0')]()['toString']();var _0xa45726=path[_0xbb10('0xd1')](config['root'],_0xbb10('0xd2'),'files',_0xbb10('0xd3'));var _0x8e8049=path[_0xbb10('0xd1')](config[_0xbb10('0xd4')],_0xbb10('0xd2'),_0xbb10('0xd5'),_0xbb10('0xd6'));var _0x56f902=path[_0xbb10('0xd1')](_0xa45726,_0x161171);var _0x4720a1=util[_0xbb10('0xc6')](_0xbb10('0xd7'),_0x99c4[_0xbb10('0xb6')]['id'],_0x161171);var _0x1301e3=path['join'](_0xa45726,_0x4720a1);var _0x550301=[];if(_0x99c4['query'][_0xbb10('0xd6')]){_0x550301[_0xbb10('0x28')]({'model':db[_0xbb10('0xd8')],'as':_0xbb10('0xd9'),'raw':!![]});}var _0x57700b=[{'model':db[_0xbb10('0x29')],'as':_0xbb10('0xda'),'attributes':['id',_0xbb10('0xbd'),'from','to','cc','bcc',_0xbb10('0xdb'),'createdAt'],'where':{'secret':![]},'order':qs[_0xbb10('0x3c')]('id'),'include':_0x550301}];return db[_0xbb10('0x31')][_0xbb10('0x56')]({'where':{'id':_0x99c4[_0xbb10('0xb6')]['id']},'include':_0x57700b})[_0xbb10('0x1e')](handleEntityNotFound(_0x4ca4ce,null))[_0xbb10('0x1e')](function(_0x1fe250){if(_0x1fe250&&_0x1fe250['Messages']){var _0x424371=_0x1fe250[_0xbb10('0xdc')]({'plain':!![]});fs['mkdirSync'](_0x56f902);return BPromise[_0xbb10('0xdd')](_0x424371[_0xbb10('0xda')],function(_0x32f261,_0x5b11a2){var _0x4b490a={'from':_0x32f261['from'],'to':_0x32f261['to'],'subject':_0x32f261[_0xbb10('0xdb')],'html':_0x32f261[_0xbb10('0xbd')],'headers':{'Date':moment(_0x32f261['createdAt'])[_0xbb10('0xc6')](_0xbb10('0xde'))},'attachments':[]};if(_0x32f261['cc']){_0x4b490a[_0xbb10('0xdf')]['Cc']=_0x32f261['cc'];}if(_0x32f261[_0xbb10('0xe0')]){_0x4b490a[_0xbb10('0xdf')][_0xbb10('0xe1')]=_0x32f261[_0xbb10('0xe0')];}return new BPromise(function(_0x48f0eb,_0x304603){if(_0x32f261['Attachments']){for(var _0x5a7c4e=0x0;_0x5a7c4e<_0x32f261['Attachments'][_0xbb10('0x55')];_0x5a7c4e++){var _0x572d73=_0x32f261['Attachments'][_0x5a7c4e];var _0x1f09f1=path['join'](_0x8e8049,_0x572d73[_0xbb10('0xe2')]);if(fs[_0xbb10('0xe3')](_0x1f09f1)){_0x4b490a[_0xbb10('0xd6')]['push']({'name':_0x572d73['name'],'contentType':_0x572d73[_0xbb10('0x63')],'data':fs['readFileSync'](_0x1f09f1)});}}}emlformat[_0xbb10('0xe4')](_0x4b490a,function(_0x211172,_0x589ecb){if(_0x211172)return _0x304603(_0x211172);fs['writeFileSync'](path[_0xbb10('0xd1')](_0x56f902,util[_0xbb10('0xc6')](_0xbb10('0xe5'),_0x5b11a2)),_0x589ecb);return _0x48f0eb(_0x589ecb);});});})['then'](function(){return new BPromise(function(_0x4f4aa8,_0x426a4f){zipdir(_0x56f902,{'saveTo':_0x1301e3},function(_0x22f153,_0x4d47cc){if(_0x22f153)return _0x426a4f(_0x22f153);return _0x4f4aa8(_0x4d47cc);});})[_0xbb10('0x1e')](function(){return new BPromise(function(_0x203e5a,_0xe88e90){rimraf(_0x56f902,function(_0x4845b5){if(_0x4845b5)_0xe88e90(_0x4845b5);return _0x203e5a();});});})[_0xbb10('0x1e')](function(){return _0x4ca4ce[_0xbb10('0xcf')](_0x1301e3,_0x4720a1,function(_0x166f4f){if(!_0x166f4f)fs[_0xbb10('0xe6')](_0x1301e3);});});});}else{return _0x4ca4ce[_0xbb10('0x12')](0xc8);}})[_0xbb10('0x2e')](handleError(_0x4ca4ce,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index deaa23e..da40b6f 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 _0x25c0=['update','remove','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','MailInteraction','setMaxListeners','save'];(function(_0x269287,_0x5c04da){var _0x5f2c7e=function(_0x1a9f71){while(--_0x1a9f71){_0x269287['push'](_0x269287['shift']());}};_0x5f2c7e(++_0x5c04da);}(_0x25c0,0x93));var _0x025c=function(_0x154a07,_0x17af2f){_0x154a07=_0x154a07-0x0;var _0xe7d99c=_0x25c0[_0x154a07];return _0xe7d99c;};'use strict';var EventEmitter=require(_0x025c('0x0'));var MailInteraction=require(_0x025c('0x1'))['db'][_0x025c('0x2')];var MailMessage=require(_0x025c('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x025c('0x3')](0x0);var events={'afterCreate':_0x025c('0x4'),'afterUpdate':_0x025c('0x5'),'afterDestroy':_0x025c('0x6')};function emitEvent(_0x5f2eea){return function(_0x5cc381,_0x566fa9,_0x52980b){_0x5cc381['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x1be0fe){_0x5cc381[_0x025c('0x7')](_0x025c('0x8'),_0x1be0fe[_0x025c('0x9')](function(_0xcf3f3e){return{'id':_0xcf3f3e['id']};}));return MailMessage[_0x025c('0xa')]({'where':{'MailInteractionId':_0x5cc381['id'],'direction':'in','read':![]},'raw':!![]});})[_0x025c('0xb')](function(_0x395beb){_0x5cc381[_0x025c('0x7')](_0x025c('0xc'),_0x395beb[_0x025c('0xd')]);MailInteractionEvents[_0x025c('0xe')](_0x5f2eea+':'+_0x5cc381['id'],_0x5cc381);MailInteractionEvents[_0x025c('0xe')](_0x5f2eea,_0x5cc381);_0x52980b(null);})[_0x025c('0xf')](_0x52980b(null));};}for(var e in events){if(events[_0x025c('0x10')](e)){var event=events[e];MailInteraction[_0x025c('0x11')](e,emitEvent(event));}}module[_0x025c('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0xaa54=['getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x4ec69a,_0x2826de){var _0x280921=function(_0x57a021){while(--_0x57a021){_0x4ec69a['push'](_0x4ec69a['shift']());}};_0x280921(++_0x2826de);}(_0xaa54,0xb5));var _0x4aa5=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xaa54[_0x39e84d];return _0x1991bc;};'use strict';var EventEmitter=require(_0x4aa5('0x0'));var MailInteraction=require(_0x4aa5('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x4aa5('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4aa5('0x2')](0x0);var events={'afterCreate':_0x4aa5('0x3'),'afterUpdate':_0x4aa5('0x4'),'afterDestroy':_0x4aa5('0x5')};function emitEvent(_0x2da734){return function(_0x20349b,_0x5254e3,_0x253522){_0x20349b[_0x4aa5('0x6')]({'attributes':['id'],'raw':!![]})[_0x4aa5('0x7')](function(_0x5894ff){_0x20349b['setDataValue'](_0x4aa5('0x8'),_0x5894ff[_0x4aa5('0x9')](function(_0x14c89f){return{'id':_0x14c89f['id']};}));return MailMessage[_0x4aa5('0xa')]({'where':{'MailInteractionId':_0x20349b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4aa5('0x7')](function(_0x28ff5e){_0x20349b[_0x4aa5('0xb')](_0x4aa5('0xc'),_0x28ff5e['length']);MailInteractionEvents[_0x4aa5('0xd')](_0x2da734+':'+_0x20349b['id'],_0x20349b);MailInteractionEvents[_0x4aa5('0xd')](_0x2da734,_0x20349b);_0x253522(null);})['catch'](_0x253522(null));};}for(var e in events){if(events[_0x4aa5('0xe')](e)){var event=events[e];MailInteraction[_0x4aa5('0xf')](e,emitEvent(event));}}module[_0x4aa5('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 44f8254..8f66579 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 _0x2d7a=['moment','bluebird','path','rimraf','../../config/environment','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','substatusAt','models','get','MailMessage','update','then','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x32c3a4,_0x1ddcd7){var _0x3e692c=function(_0x1853d1){while(--_0x1853d1){_0x32c3a4['push'](_0x32c3a4['shift']());}};_0x3e692c(++_0x1ddcd7);}(_0x2d7a,0x11e));var _0xa2d7=function(_0x54d457,_0x550b68){_0x54d457=_0x54d457-0x0;var _0x2ce921=_0x2d7a[_0x54d457];return _0x2ce921;};'use strict';var _=require(_0xa2d7('0x0'));var util=require(_0xa2d7('0x1'));var logger=require(_0xa2d7('0x2'))(_0xa2d7('0x3'));var moment=require(_0xa2d7('0x4'));var BPromise=require(_0xa2d7('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2d7('0x6'));var rimraf=require(_0xa2d7('0x7'));var config=require(_0xa2d7('0x8'));var attributes=require('./mailInteraction.attributes');module['exports']=function(_0x3b6694,_0x1ca58d){return _0x3b6694[_0xa2d7('0x9')](_0xa2d7('0xa'),attributes,{'tableName':_0xa2d7('0xb'),'paranoid':![],'indexes':[{'name':_0xa2d7('0xc'),'fields':[_0xa2d7('0xd'),'to'],'type':_0xa2d7('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2a4dd6,_0x213870,_0x27cda0){if(_0x2a4dd6[_0xa2d7('0xf')]){_0x2a4dd6['substatusAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2a4dd6[_0xa2d7('0x10')]){_0x2a4dd6[_0xa2d7('0x11')]=moment()[_0xa2d7('0x12')](_0xa2d7('0x13'));}_0x27cda0(null,_0x213870);},'beforeUpdate':function(_0x31deba,_0x2939be,_0x40a6c5){if(_0x31deba[_0xa2d7('0x14')](_0xa2d7('0xf'))){_0x31deba[_0xa2d7('0x15')]=_0x31deba[_0xa2d7('0xf')]?moment()['format'](_0xa2d7('0x13')):null;}if(_0x31deba['changed'](_0xa2d7('0x10'))){_0x31deba['closedAt']=moment()[_0xa2d7('0x12')](_0xa2d7('0x13'));_0x31deba['substatus']=null;_0x31deba[_0xa2d7('0x15')]=null;}_0x40a6c5(null,_0x31deba);},'afterUpdate':function(_0x446ae1,_0x1d319a,_0x2bb977){var _0x5ef3e5=_0x3b6694[_0xa2d7('0x16')];var _0x54e09f=_0x446ae1[_0xa2d7('0x17')]({'plain':!![]});if(_0x54e09f[_0xa2d7('0x10')]){return _0x5ef3e5[_0xa2d7('0x18')][_0xa2d7('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x54e09f['id']}})[_0xa2d7('0x1a')](function(){_0x2bb977();})[_0xa2d7('0x1b')](function(_0x492369){_0x2bb977(_0x492369);});}else{_0x2bb977();}}},'charset':'utf8mb4','collate':_0xa2d7('0x1c')});}; \ No newline at end of file +var _0xe714=['MailMessage','update','then','catch','utf8mb4','lodash','util','../../config/logger','api','bluebird','rimraf','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe714,0xd5));var _0x4e71=function(_0x20d015,_0xfb5a8a){_0x20d015=_0x20d015-0x0;var _0x50c43f=_0xe714[_0x20d015];return _0x50c43f;};'use strict';var _=require(_0x4e71('0x0'));var util=require(_0x4e71('0x1'));var logger=require(_0x4e71('0x2'))(_0x4e71('0x3'));var moment=require('moment');var BPromise=require(_0x4e71('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4e71('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e71('0x6'));module[_0x4e71('0x7')]=function(_0x380a82,_0x3c6a24){return _0x380a82[_0x4e71('0x8')]('MailInteraction',attributes,{'tableName':_0x4e71('0x9'),'paranoid':![],'indexes':[{'name':_0x4e71('0xa'),'fields':[_0x4e71('0xb'),'to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1ada55,_0x79890,_0x5ccacc){if(_0x1ada55[_0x4e71('0xc')]){_0x1ada55[_0x4e71('0xd')]=moment()[_0x4e71('0xe')](_0x4e71('0xf'));}if(_0x1ada55[_0x4e71('0x10')]){_0x1ada55[_0x4e71('0x11')]=moment()[_0x4e71('0xe')](_0x4e71('0xf'));}_0x5ccacc(null,_0x79890);},'beforeUpdate':function(_0xc9018a,_0x3fd845,_0x397ae8){if(_0xc9018a['changed'](_0x4e71('0xc'))){_0xc9018a[_0x4e71('0xd')]=_0xc9018a[_0x4e71('0xc')]?moment()[_0x4e71('0xe')](_0x4e71('0xf')):null;}if(_0xc9018a[_0x4e71('0x12')](_0x4e71('0x10'))){_0xc9018a[_0x4e71('0x11')]=moment()[_0x4e71('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0xc9018a[_0x4e71('0xc')]=null;_0xc9018a['substatusAt']=null;}_0x397ae8(null,_0xc9018a);},'afterUpdate':function(_0x4c7f76,_0x2c88df,_0xe48c0a){var _0x2416d3=_0x380a82[_0x4e71('0x13')];var _0x5c9106=_0x4c7f76[_0x4e71('0x14')]({'plain':!![]});if(_0x5c9106[_0x4e71('0x10')]){return _0x2416d3[_0x4e71('0x15')][_0x4e71('0x16')]({'read':!![]},{'where':{'MailInteractionId':_0x5c9106['id']}})[_0x4e71('0x17')](function(){_0xe48c0a();})[_0x4e71('0x18')](function(_0x162ea8){_0xe48c0a(_0x162ea8);});}else{_0xe48c0a();}}},'charset':_0x4e71('0x19'),'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 0c4e624..13436f9 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 _0x6033=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateMailInteraction','MailInteraction','body','options','raw','where','attributes','limit','AddTagsToMailInteraction','find','ids','omit','spread','AddTags','util','bluebird','randomstring'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x6033,0x177));var _0x3603=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6033[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x3603('0x0'));var moment=require('moment');var BPromise=require(_0x3603('0x1'));var rs=require(_0x3603('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3603('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3603('0x4'))(_0x3603('0x5'));var config=require(_0x3603('0x6'));var jayson=require(_0x3603('0x7'));var client=jayson[_0x3603('0x8')][_0x3603('0x9')]({'port':0x232a});config['redis']=_[_0x3603('0xa')](config[_0x3603('0xb')],{'host':_0x3603('0xc'),'port':0x18eb});var socket=require(_0x3603('0xd'))(new Redis(config[_0x3603('0xb')]));require(_0x3603('0xe'))[_0x3603('0xf')](socket);function respondWithRpcPromise(_0x369e3a,_0x5e567e,_0x29edec){return new BPromise(function(_0x469c8e,_0x5bc177){return client[_0x3603('0x10')](_0x369e3a,_0x29edec)[_0x3603('0x11')](function(_0xc1d601){logger[_0x3603('0x12')](_0x3603('0x13'),_0x5e567e,'request\x20sent');logger[_0x3603('0x14')](_0x3603('0x15'),_0x5e567e,_0x3603('0x16'),JSON[_0x3603('0x17')](_0xc1d601));if(_0xc1d601[_0x3603('0x18')]){if(_0xc1d601[_0x3603('0x18')]['code']===0x1f4){logger[_0x3603('0x18')](_0x3603('0x13'),_0x5e567e,_0xc1d601[_0x3603('0x18')][_0x3603('0x19')]);return _0x5bc177(_0xc1d601[_0x3603('0x18')]['message']);}logger[_0x3603('0x18')](_0x3603('0x13'),_0x5e567e,_0xc1d601[_0x3603('0x18')][_0x3603('0x19')]);return _0x469c8e(_0xc1d601[_0x3603('0x18')]['message']);}else{logger[_0x3603('0x12')](_0x3603('0x13'),_0x5e567e,'request\x20sent');_0x469c8e(_0xc1d601[_0x3603('0x1a')][_0x3603('0x19')]);}})[_0x3603('0x1b')](function(_0x2b53fb){logger[_0x3603('0x18')]('MailInteraction,\x20%s,\x20%s',_0x5e567e,_0x2b53fb);_0x5bc177(_0x2b53fb);});});}exports[_0x3603('0x1c')]=function(_0x32345e){var _0x1ba8f4=this;return new Promise(function(_0x1771c2,_0x13fe1a){return db[_0x3603('0x1d')]['update'](_0x32345e[_0x3603('0x1e')],{'raw':_0x32345e[_0x3603('0x1f')]?_0x32345e[_0x3603('0x1f')][_0x3603('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32345e[_0x3603('0x1f')]?_0x32345e['options'][_0x3603('0x21')]||null:null,'attributes':_0x32345e[_0x3603('0x1f')]?_0x32345e[_0x3603('0x1f')][_0x3603('0x22')]||null:null,'limit':_0x32345e[_0x3603('0x1f')]?_0x32345e[_0x3603('0x1f')][_0x3603('0x23')]||null:null})[_0x3603('0x11')](function(_0x5e8e13){logger['info'](_0x3603('0x1c'),_0x32345e);logger['debug']('UpdateMailInteraction',_0x32345e,JSON['stringify'](_0x5e8e13));_0x1771c2(_0x5e8e13);})['catch'](function(_0x11b1d2){logger[_0x3603('0x18')](_0x3603('0x1c'),_0x11b1d2['message'],_0x32345e);_0x13fe1a(_0x1ba8f4[_0x3603('0x18')](0x1f4,_0x11b1d2[_0x3603('0x19')]));});});};exports[_0x3603('0x24')]=function(_0x2eb4cb){return new Promise(function(_0x3d778f,_0x17f62d){return db[_0x3603('0x1d')][_0x3603('0x25')]({'where':_0x2eb4cb[_0x3603('0x1f')]?_0x2eb4cb['options']['where']||null:null})['then'](function(_0x593dd2){if(_0x593dd2){return _0x593dd2['addTags'](_0x2eb4cb[_0x3603('0x1e')][_0x3603('0x26')],_[_0x3603('0x27')](_0x2eb4cb[_0x3603('0x1e')],['ids','id'])||{});}})[_0x3603('0x28')](function(_0x4172d4){logger['info'](_0x3603('0x29'),_0x2eb4cb);logger[_0x3603('0x14')](_0x3603('0x29'),_0x2eb4cb,JSON[_0x3603('0x17')](_0x4172d4));_0x3d778f(_0x4172d4);})[_0x3603('0x1b')](function(_0x19487e){logger['error'](_0x3603('0x29'),_0x19487e[_0x3603('0x19')],_0x2eb4cb);_0x17f62d(_this[_0x3603('0x18')](0x1f4,_0x19487e[_0x3603('0x19')]));});});}; \ No newline at end of file +var _0xb934=['info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateMailInteraction','MailInteraction','options','where','attributes','limit','AddTagsToMailInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then'];(function(_0x504367,_0xa38ecf){var _0x3703a8=function(_0x2d21e3){while(--_0x2d21e3){_0x504367['push'](_0x504367['shift']());}};_0x3703a8(++_0xa38ecf);}(_0xb934,0x92));var _0x4b93=function(_0x189d12,_0x17aafc){_0x189d12=_0x189d12-0x0;var _0x39b0ad=_0xb934[_0x189d12];return _0x39b0ad;};'use strict';var _=require(_0x4b93('0x0'));var util=require(_0x4b93('0x1'));var moment=require(_0x4b93('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b93('0x3'));var fs=require('fs');var Redis=require(_0x4b93('0x4'));var db=require(_0x4b93('0x5'))['db'];var utils=require(_0x4b93('0x6'));var logger=require(_0x4b93('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4b93('0x8'));var client=jayson[_0x4b93('0x9')][_0x4b93('0xa')]({'port':0x232a});config[_0x4b93('0xb')]=_['defaults'](config[_0x4b93('0xb')],{'host':_0x4b93('0xc'),'port':0x18eb});var socket=require(_0x4b93('0xd'))(new Redis(config[_0x4b93('0xb')]));require(_0x4b93('0xe'))[_0x4b93('0xf')](socket);function respondWithRpcPromise(_0x10a47b,_0x15ad72,_0x254572){return new BPromise(function(_0x50a74d,_0x2c33cc){return client[_0x4b93('0x10')](_0x10a47b,_0x254572)[_0x4b93('0x11')](function(_0xfb8b42){logger[_0x4b93('0x12')](_0x4b93('0x13'),_0x15ad72,_0x4b93('0x14'));logger[_0x4b93('0x15')](_0x4b93('0x16'),_0x15ad72,_0x4b93('0x14'),JSON[_0x4b93('0x17')](_0xfb8b42));if(_0xfb8b42[_0x4b93('0x18')]){if(_0xfb8b42[_0x4b93('0x18')][_0x4b93('0x19')]===0x1f4){logger[_0x4b93('0x18')]('MailInteraction,\x20%s,\x20%s',_0x15ad72,_0xfb8b42[_0x4b93('0x18')][_0x4b93('0x1a')]);return _0x2c33cc(_0xfb8b42[_0x4b93('0x18')]['message']);}logger[_0x4b93('0x18')](_0x4b93('0x13'),_0x15ad72,_0xfb8b42[_0x4b93('0x18')][_0x4b93('0x1a')]);return _0x50a74d(_0xfb8b42[_0x4b93('0x18')]['message']);}else{logger[_0x4b93('0x12')](_0x4b93('0x13'),_0x15ad72,'request\x20sent');_0x50a74d(_0xfb8b42['result'][_0x4b93('0x1a')]);}})[_0x4b93('0x1b')](function(_0x12f944){logger[_0x4b93('0x18')](_0x4b93('0x13'),_0x15ad72,_0x12f944);_0x2c33cc(_0x12f944);});});}exports[_0x4b93('0x1c')]=function(_0xe26eb8){var _0x21b019=this;return new Promise(function(_0x3b5d15,_0x36bf8a){return db[_0x4b93('0x1d')]['update'](_0xe26eb8['body'],{'raw':_0xe26eb8['options']?_0xe26eb8['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe26eb8[_0x4b93('0x1e')]?_0xe26eb8['options'][_0x4b93('0x1f')]||null:null,'attributes':_0xe26eb8[_0x4b93('0x1e')]?_0xe26eb8[_0x4b93('0x1e')][_0x4b93('0x20')]||null:null,'limit':_0xe26eb8[_0x4b93('0x1e')]?_0xe26eb8[_0x4b93('0x1e')][_0x4b93('0x21')]||null:null})[_0x4b93('0x11')](function(_0x4b6b29){logger['info'](_0x4b93('0x1c'),_0xe26eb8);logger['debug'](_0x4b93('0x1c'),_0xe26eb8,JSON['stringify'](_0x4b6b29));_0x3b5d15(_0x4b6b29);})[_0x4b93('0x1b')](function(_0x5a0a76){logger['error'](_0x4b93('0x1c'),_0x5a0a76[_0x4b93('0x1a')],_0xe26eb8);_0x36bf8a(_0x21b019[_0x4b93('0x18')](0x1f4,_0x5a0a76[_0x4b93('0x1a')]));});});};exports[_0x4b93('0x22')]=function(_0x287c07){return new Promise(function(_0x3d892c,_0x43b5b7){return db['MailInteraction'][_0x4b93('0x23')]({'where':_0x287c07[_0x4b93('0x1e')]?_0x287c07[_0x4b93('0x1e')]['where']||null:null})[_0x4b93('0x11')](function(_0x5f3ab3){if(_0x5f3ab3){return _0x5f3ab3['addTags'](_0x287c07[_0x4b93('0x24')][_0x4b93('0x25')],_[_0x4b93('0x26')](_0x287c07[_0x4b93('0x24')],[_0x4b93('0x25'),'id'])||{});}})[_0x4b93('0x27')](function(_0x258170){logger[_0x4b93('0x12')](_0x4b93('0x28'),_0x287c07);logger[_0x4b93('0x15')]('AddTags',_0x287c07,JSON[_0x4b93('0x17')](_0x258170));_0x3d892c(_0x258170);})['catch'](function(_0x551d21){logger[_0x4b93('0x18')](_0x4b93('0x28'),_0x551d21[_0x4b93('0x1a')],_0x287c07);_0x43b5b7(_this[_0x4b93('0x18')](0x1f4,_0x551d21[_0x4b93('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 6367abb..46257cd 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 _0x3149=['removeListener','register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0x10547e,_0x995a56){var _0x591c4b=function(_0x2f3e15){while(--_0x2f3e15){_0x10547e['push'](_0x10547e['shift']());}};_0x591c4b(++_0x995a56);}(_0x3149,0x1a2));var _0x9314=function(_0x5d7149,_0xaa0ab5){_0x5d7149=_0x5d7149-0x0;var _0x340ade=_0x3149[_0x5d7149];return _0x340ade;};'use strict';var MailInteractionEvents=require(_0x9314('0x0'));var events=[_0x9314('0x1'),_0x9314('0x2'),_0x9314('0x3')];function createListener(_0x5169cb,_0x2c6897){return function(_0x1eed1f){_0x2c6897[_0x9314('0x4')](_0x5169cb,_0x1eed1f);};}function removeListener(_0x502b2c,_0x5622b0){return function(){MailInteractionEvents[_0x9314('0x5')](_0x502b2c,_0x5622b0);};}exports[_0x9314('0x6')]=function(_0x13ebc7){for(var _0xdae17b=0x0,_0x543359=events[_0x9314('0x7')];_0xdae17b<_0x543359;_0xdae17b++){var _0x46ffd7=events[_0xdae17b];var _0x591e60=createListener(_0x9314('0x8')+_0x46ffd7,_0x13ebc7);MailInteractionEvents['on'](_0x46ffd7,_0x591e60);}}; \ No newline at end of file +var _0x10e4=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x28aa4f,_0x5a4247){var _0x10900c=function(_0x3bd155){while(--_0x3bd155){_0x28aa4f['push'](_0x28aa4f['shift']());}};_0x10900c(++_0x5a4247);}(_0x10e4,0xb1));var _0x410e=function(_0x45909f,_0x970414){_0x45909f=_0x45909f-0x0;var _0x1d0c73=_0x10e4[_0x45909f];return _0x1d0c73;};'use strict';var MailInteractionEvents=require(_0x410e('0x0'));var events=[_0x410e('0x1'),_0x410e('0x2'),_0x410e('0x3')];function createListener(_0x22bb1a,_0x3c3807){return function(_0x2a218d){_0x3c3807[_0x410e('0x4')](_0x22bb1a,_0x2a218d);};}function removeListener(_0x53b575,_0x13d6af){return function(){MailInteractionEvents[_0x410e('0x5')](_0x53b575,_0x13d6af);};}exports[_0x410e('0x6')]=function(_0x30eb7a){for(var _0x2c4b92=0x0,_0x5f1d9a=events['length'];_0x2c4b92<_0x5f1d9a;_0x2c4b92++){var _0x19e2de=events[_0x2c4b92];var _0xa728fc=createListener(_0x410e('0x7')+_0x19e2de,_0x30eb7a);MailInteractionEvents['on'](_0x19e2de,_0xa728fc);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 93b132e..c3bfeea 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 _0x8f37=['create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','/:id','show','/:id/download','download','tracked','mailmessage:create'];(function(_0x4b4fe8,_0x2a8d0a){var _0x1cae3f=function(_0x502836){while(--_0x502836){_0x4b4fe8['push'](_0x4b4fe8['shift']());}};_0x1cae3f(++_0x2a8d0a);}(_0x8f37,0x190));var _0x78f3=function(_0x3b18a6,_0x456214){_0x3b18a6=_0x3b18a6-0x0;var _0x5a06b8=_0x8f37[_0x3b18a6];return _0x5a06b8;};'use strict';var multer=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var path=require(_0x78f3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78f3('0x3')]();var fs_extra=require(_0x78f3('0x4'));var auth=require(_0x78f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x78f3('0x6'));var controller=require('./mailMessage.controller');router[_0x78f3('0x7')]('/',auth['isAuthenticated'](),controller[_0x78f3('0x8')]);router[_0x78f3('0x7')]('/describe',auth[_0x78f3('0x9')](),controller['describe']);router[_0x78f3('0x7')](_0x78f3('0xa'),auth['isAuthenticated'](),controller[_0x78f3('0xb')]);router[_0x78f3('0x7')](_0x78f3('0xc'),auth[_0x78f3('0x9')](),controller[_0x78f3('0xd')]);router['post']('/',auth[_0x78f3('0x9')](),interaction[_0x78f3('0xe')]('mail',_0x78f3('0xf')),controller[_0x78f3('0x10')]);router[_0x78f3('0x11')]('/:id',auth[_0x78f3('0x9')](),controller[_0x78f3('0x12')]);router[_0x78f3('0x11')](_0x78f3('0x13'),auth[_0x78f3('0x9')](),controller[_0x78f3('0x14')]);router[_0x78f3('0x11')](_0x78f3('0x15'),auth[_0x78f3('0x9')](),controller[_0x78f3('0x16')]);router[_0x78f3('0x17')](_0x78f3('0xa'),auth[_0x78f3('0x9')](),controller[_0x78f3('0x18')]);module[_0x78f3('0x19')]=router; \ No newline at end of file +var _0x71d3=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','index','describe','get','/:id','show','download','post','tracked','mailmessage:create','create','put','update','accept','/:id/reject','reject','destroy','multer','util','path','express','Router'];(function(_0xcb4a5e,_0x4d529d){var _0x404cd8=function(_0x1a0b7b){while(--_0x1a0b7b){_0xcb4a5e['push'](_0xcb4a5e['shift']());}};_0x404cd8(++_0x4d529d);}(_0x71d3,0x67));var _0x371d=function(_0x4484fe,_0x4c6a86){_0x4484fe=_0x4484fe-0x0;var _0x3dcb31=_0x71d3[_0x4484fe];return _0x3dcb31;};'use strict';var multer=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var path=require(_0x371d('0x2'));var timeout=require('connect-timeout');var express=require(_0x371d('0x3'));var router=express[_0x371d('0x4')]();var fs_extra=require(_0x371d('0x5'));var auth=require(_0x371d('0x6'));var interaction=require(_0x371d('0x7'));var config=require(_0x371d('0x8'));var controller=require(_0x371d('0x9'));router['get']('/',auth[_0x371d('0xa')](),controller[_0x371d('0xb')]);router['get']('/describe',auth[_0x371d('0xa')](),controller[_0x371d('0xc')]);router[_0x371d('0xd')](_0x371d('0xe'),auth[_0x371d('0xa')](),controller[_0x371d('0xf')]);router[_0x371d('0xd')]('/:id/download',auth[_0x371d('0xa')](),controller[_0x371d('0x10')]);router[_0x371d('0x11')]('/',auth[_0x371d('0xa')](),interaction[_0x371d('0x12')]('mail',_0x371d('0x13')),controller[_0x371d('0x14')]);router[_0x371d('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x371d('0x16')]);router[_0x371d('0x15')]('/:id/accept',auth[_0x371d('0xa')](),controller[_0x371d('0x17')]);router['put'](_0x371d('0x18'),auth[_0x371d('0xa')](),controller[_0x371d('0x19')]);router['delete']('/:id',auth[_0x371d('0xa')](),controller[_0x371d('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d6c897d..ca8b2da 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 _0x997c=['sequelize','lodash','TEXT','medium','BOOLEAN','out','STRING','long','DATE','INTEGER','ENUM','Email','Chat'];(function(_0x115807,_0x39ff0a){var _0x36b576=function(_0x541081){while(--_0x541081){_0x115807['push'](_0x115807['shift']());}};_0x36b576(++_0x39ff0a);}(_0x997c,0x12b));var _0xc997=function(_0x1c1d03,_0x151ee1){_0x1c1d03=_0x1c1d03-0x0;var _0x28ec90=_0x997c[_0x1c1d03];return _0x28ec90;};'use strict';var Sequelize=require(_0xc997('0x0'));var _=require(_0xc997('0x1'));module['exports']={'body':{'type':Sequelize[_0xc997('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc997('0x2')](_0xc997('0x3'))},'read':{'type':Sequelize[_0xc997('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc997('0x5')),'defaultValue':_0xc997('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc997('0x6')](0x1fe)},'from':{'type':Sequelize[_0xc997('0x6')]},'to':{'type':Sequelize[_0xc997('0x2')](_0xc997('0x7'))},'cc':{'type':Sequelize[_0xc997('0x2')](_0xc997('0x7'))},'bcc':{'type':Sequelize[_0xc997('0x2')](_0xc997('0x7'))},'subject':{'type':Sequelize[_0xc997('0x2')]},'sentAt':{'type':Sequelize[_0xc997('0x8')]},'attach':{'type':Sequelize[_0xc997('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc997('0x8')]},'originTo':{'type':Sequelize['TEXT']('long')},'originCc':{'type':Sequelize[_0xc997('0x2')](_0xc997('0x7'))},'originChannel':{'type':Sequelize[_0xc997('0xa')](_0xc997('0xb'),_0xc997('0xc')),'defaultValue':_0xc997('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xe119=['sequelize','exports','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','Chat'];(function(_0x47e747,_0x3c8898){var _0x21eda5=function(_0x57e0d3){while(--_0x57e0d3){_0x47e747['push'](_0x47e747['shift']());}};_0x21eda5(++_0x3c8898);}(_0xe119,0x1b8));var _0x9e11=function(_0x16278c,_0x1def38){_0x16278c=_0x16278c-0x0;var _0x45c928=_0xe119[_0x16278c];return _0x45c928;};'use strict';var Sequelize=require(_0x9e11('0x0'));var _=require('lodash');module[_0x9e11('0x1')]={'body':{'type':Sequelize[_0x9e11('0x2')](_0x9e11('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x9e11('0x2')](_0x9e11('0x4'))},'read':{'type':Sequelize[_0x9e11('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e11('0x6')]('in',_0x9e11('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x9e11('0x8')](0x1fe)},'from':{'type':Sequelize[_0x9e11('0x8')]},'to':{'type':Sequelize['TEXT'](_0x9e11('0x3'))},'cc':{'type':Sequelize[_0x9e11('0x2')](_0x9e11('0x3'))},'bcc':{'type':Sequelize[_0x9e11('0x2')]('long')},'subject':{'type':Sequelize[_0x9e11('0x2')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9e11('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x9e11('0x2')](_0x9e11('0x3'))},'originCc':{'type':Sequelize[_0x9e11('0x2')](_0x9e11('0x3'))},'originChannel':{'type':Sequelize[_0x9e11('0x6')]('Email',_0x9e11('0x9')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 34bace8..f07baea 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 _0x9c44=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','email','internal','manual','SIP/%s','channel','event','EventManager','acceptmessage','MailInteractionId','RejectMessage','rejectMessage','Sequelize','User','fullname','interface','reject','fromString','rejectmessage','unix','toString','join','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','Attachments','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','download','bluebird','util','path','lodash','ioredis','html-to-text','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','client','http','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','offset','undefined','count','set','Content-Range','json','update','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','body','find','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','DESC','Smtp','isNil','service','host','port','secure','user','pass','auth','attachments','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','messageId','accept','mail','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','MailInteraction','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage'];(function(_0x2056d4,_0x5760c0){var _0x3aa22c=function(_0x284085){while(--_0x284085){_0x2056d4['push'](_0x2056d4['shift']());}};_0x3aa22c(++_0x5760c0);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require('eml-format');var moment=require('moment');var BPromise=require(_0x49c4('0x0'));var util=require(_0x49c4('0x1'));var path=require(_0x49c4('0x2'));var fs=require('fs');var _=require(_0x49c4('0x3'));var Redis=require(_0x49c4('0x4'));var htmlToText=require(_0x49c4('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x49c4('0x6'));var interaction_log=require('../../config/logger')(_0x49c4('0x7'));var config=require(_0x49c4('0x8'));var db=require(_0x49c4('0x9'))['db'];config[_0x49c4('0xa')]=_[_0x49c4('0xb')](config['redis'],{'host':_0x49c4('0xc'),'port':0x18eb});var socket=require(_0x49c4('0xd'))(new Redis(config[_0x49c4('0xa')]));require(_0x49c4('0xe'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x49c4('0xf')][_0x49c4('0x10')]({'port':0x232c});var client9003=jayson['client'][_0x49c4('0x10')]({'port':0x232b});var client9002=jayson[_0x49c4('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x536d42,_0x1d19bf,_0x6d1b08,_0x5487cd){return new BPromise(function(_0x7df3a9,_0x403bfb){var _0x5f2fd9=_0x5487cd||client;return _0x5f2fd9[_0x49c4('0x11')](_0x536d42,_0x6d1b08)[_0x49c4('0x12')](function(_0x21f15a){logger[_0x49c4('0x13')](_0x49c4('0x14'),_0x1d19bf,_0x49c4('0x15'));logger[_0x49c4('0x16')](_0x49c4('0x17'),_0x1d19bf,'request\x20sent',JSON[_0x49c4('0x18')](_0x21f15a));if(_0x21f15a[_0x49c4('0x19')]){if(_0x21f15a[_0x49c4('0x19')][_0x49c4('0x1a')]===0x1f4){logger[_0x49c4('0x19')]('MailMessage,\x20%s,\x20%s',_0x1d19bf,_0x21f15a[_0x49c4('0x19')][_0x49c4('0x1b')]);return _0x403bfb(_0x21f15a['error']['message']);}logger[_0x49c4('0x19')](_0x49c4('0x14'),_0x1d19bf,_0x21f15a[_0x49c4('0x19')]['message']);return _0x7df3a9(_0x21f15a[_0x49c4('0x19')]['message']);}else{logger[_0x49c4('0x13')](_0x49c4('0x14'),_0x1d19bf,_0x49c4('0x15'));_0x7df3a9(_0x21f15a[_0x49c4('0x1c')][_0x49c4('0x1b')]);}})[_0x49c4('0x1d')](function(_0x280893){logger[_0x49c4('0x19')](_0x49c4('0x14'),_0x1d19bf,_0x280893);_0x403bfb(_0x280893);});});}function respondWithResult(_0x578447,_0x527126){_0x527126=_0x527126||0xc8;return function(_0x57f502){if(_0x57f502){return _0x578447[_0x49c4('0x1e')](_0x527126)['json'](_0x57f502);}};}function respondWithFilteredResult(_0x592bb8,_0x2263ae){return function(_0x15581b){if(_0x15581b){var _0x26c640=typeof _0x2263ae[_0x49c4('0x1f')]==='undefined'&&typeof _0x2263ae['limit']===_0x49c4('0x20');var _0x9cb797=_0x15581b['count'];var _0x207358=_0x26c640?0x0:_0x2263ae[_0x49c4('0x1f')];var _0x210159=_0x26c640?_0x15581b[_0x49c4('0x21')]:_0x2263ae['offset']+_0x2263ae['limit'];var _0x449960;if(_0x210159>=_0x9cb797){_0x210159=_0x9cb797;_0x449960=0xc8;}else{_0x449960=0xce;}_0x592bb8['status'](_0x449960);return _0x592bb8[_0x49c4('0x22')](_0x49c4('0x23'),_0x207358+'-'+_0x210159+'/'+_0x9cb797)[_0x49c4('0x24')](_0x15581b);}return null;};}function saveUpdates(_0x372a47){return function(_0x5987ae){if(_0x5987ae){return _0x5987ae[_0x49c4('0x25')](_0x372a47)[_0x49c4('0x12')](function(_0x46e04d){return _0x46e04d;});}return null;};}function removeEntity(_0x4f28a2){return function(_0x6329b3){if(_0x6329b3){return _0x6329b3[_0x49c4('0x26')]()[_0x49c4('0x12')](function(){_0x4f28a2[_0x49c4('0x1e')](0xcc)[_0x49c4('0x27')]();});}};}function handleEntityNotFound(_0x2cbd88){return function(_0x46f7ea){if(!_0x46f7ea){_0x2cbd88['sendStatus'](0x194);}return _0x46f7ea;};}function handleError(_0x4f4495,_0x59eb84){_0x59eb84=_0x59eb84||0x1f4;return function(_0x134928){logger[_0x49c4('0x19')](_0x134928[_0x49c4('0x28')]);if(_0x134928[_0x49c4('0x29')]){delete _0x134928[_0x49c4('0x29')];}_0x4f4495['status'](_0x59eb84)[_0x49c4('0x2a')](_0x134928);};}exports[_0x49c4('0x2b')]=function(_0x2e7a69,_0x24bba9){var _0x58e252={},_0x57a29c={},_0xce57ef={'count':0x0,'rows':[]};var _0x9a1bed=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x4a0c7a){return{'name':_0x4a0c7a[_0x49c4('0x2f')],'type':_0x4a0c7a[_0x49c4('0x30')][_0x49c4('0x31')]};});_0x57a29c['model']=_['map'](_0x9a1bed,_0x49c4('0x29'));_0x57a29c[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x2e7a69[_0x49c4('0x32')]);_0x57a29c[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x57a29c[_0x49c4('0x36')],_0x57a29c[_0x49c4('0x32')]);_0x58e252[_0x49c4('0x37')]=_['intersection'](_0x57a29c[_0x49c4('0x36')],qs['fields'](_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x38')]));_0x58e252[_0x49c4('0x37')]=_0x58e252[_0x49c4('0x37')]['length']?_0x58e252[_0x49c4('0x37')]:_0x57a29c[_0x49c4('0x36')];if(!_0x2e7a69[_0x49c4('0x32')]['hasOwnProperty'](_0x49c4('0x39'))){_0x58e252[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x58e252[_0x49c4('0x1f')]=qs[_0x49c4('0x1f')](_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x1f')]);}_0x58e252[_0x49c4('0x3b')]=qs[_0x49c4('0x3c')](_0x2e7a69['query'][_0x49c4('0x3c')]);_0x58e252[_0x49c4('0x3d')]=qs[_0x49c4('0x34')](_[_0x49c4('0x3e')](_0x2e7a69[_0x49c4('0x32')],_0x57a29c[_0x49c4('0x34')]),_0x9a1bed);if(_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x3f')]){_0x58e252[_0x49c4('0x3d')]=_[_0x49c4('0x40')](_0x58e252[_0x49c4('0x3d')],{'$or':_[_0x49c4('0x2c')](_0x9a1bed,function(_0x326142){if(_0x326142['type']!==_0x49c4('0x41')){var _0x49829e={};_0x49829e[_0x326142[_0x49c4('0x29')]]={'$like':'%'+_0x2e7a69[_0x49c4('0x32')][_0x49c4('0x3f')]+'%'};return _0x49829e;}})});}_0x58e252=_[_0x49c4('0x40')]({},_0x58e252,_0x2e7a69[_0x49c4('0x42')]);var _0x281b83={'where':_0x58e252['where']};return db['MailMessage'][_0x49c4('0x21')](_0x281b83)[_0x49c4('0x12')](function(_0x38349b){_0xce57ef[_0x49c4('0x21')]=_0x38349b;if(_0x2e7a69['query'][_0x49c4('0x43')]){_0x58e252[_0x49c4('0x44')]=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x45')](_0x58e252);})[_0x49c4('0x12')](function(_0x3bde49){_0xce57ef[_0x49c4('0x46')]=_0x3bde49;return _0xce57ef;})[_0x49c4('0x12')](respondWithFilteredResult(_0x24bba9,_0x58e252))[_0x49c4('0x1d')](handleError(_0x24bba9,null));};exports['show']=function(_0x2ad771,_0x4d27d0){var _0x33696e={'raw':!![],'where':{'id':_0x2ad771[_0x49c4('0x47')]['id']}},_0x628423={};_0x628423[_0x49c4('0x36')]=_[_0x49c4('0x33')](db['MailMessage'][_0x49c4('0x2e')]);_0x628423[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x2ad771[_0x49c4('0x32')]);_0x628423[_0x49c4('0x34')]=_[_0x49c4('0x35')](_0x628423[_0x49c4('0x36')],_0x628423['query']);_0x33696e[_0x49c4('0x37')]=_['intersection'](_0x628423[_0x49c4('0x36')],qs[_0x49c4('0x38')](_0x2ad771[_0x49c4('0x32')][_0x49c4('0x38')]));_0x33696e[_0x49c4('0x37')]=_0x33696e[_0x49c4('0x37')][_0x49c4('0x48')]?_0x33696e['attributes']:_0x628423[_0x49c4('0x36')];if(_0x2ad771[_0x49c4('0x32')]['includeAll']){_0x33696e[_0x49c4('0x44')]=[{'all':!![]}];}_0x33696e=_[_0x49c4('0x40')]({},_0x33696e,_0x2ad771[_0x49c4('0x42')]);return db[_0x49c4('0x2d')]['find'](_0x33696e)['then'](handleEntityNotFound(_0x4d27d0,null))[_0x49c4('0x12')](respondWithResult(_0x4d27d0,null))['catch'](handleError(_0x4d27d0,null));};exports[_0x49c4('0x25')]=function(_0x1f941f,_0x3811b2){if(_0x1f941f[_0x49c4('0x49')]['id']){delete _0x1f941f[_0x49c4('0x49')]['id'];}return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x1f941f['params']['id']}})[_0x49c4('0x12')](handleEntityNotFound(_0x3811b2,null))[_0x49c4('0x12')](saveUpdates(_0x1f941f[_0x49c4('0x49')],null))[_0x49c4('0x12')](respondWithResult(_0x3811b2,null))[_0x49c4('0x1d')](handleError(_0x3811b2,null));};exports[_0x49c4('0x26')]=function(_0x156748,_0x25d174){return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x156748['params']['id']}})['then'](handleEntityNotFound(_0x25d174,null))[_0x49c4('0x12')](removeEntity(_0x25d174,null))[_0x49c4('0x1d')](handleError(_0x25d174,null));};exports['describe']=function(_0x59a8bc,_0x77163d){return db['MailMessage']['describe']()[_0x49c4('0x12')](respondWithResult(_0x77163d,null))[_0x49c4('0x1d')](handleError(_0x77163d,null));};exports[_0x49c4('0x4b')]=function(_0x38c480,_0x2884ca){return db[_0x49c4('0x2d')][_0x49c4('0x4b')](_0x38c480['body'])[_0x49c4('0x12')](function(_0xcc6a2b){if(_0xcc6a2b){if(_0xcc6a2b[_0x49c4('0x4c')]===_0x49c4('0x4d')&&!_0xcc6a2b[_0x49c4('0x4e')]){var _0xa431d,_0x5d24f3,_0x5c7ddd;if(_0x38c480[_0x49c4('0x49')]['to']){_0x5d24f3=_0x38c480[_0x49c4('0x49')]['to'][_0x49c4('0x4f')](',')[0x0];}return db[_0x49c4('0x50')][_0x49c4('0x51')]({'where':{'id':_0xcc6a2b[_0x49c4('0x52')]},'include':[{'model':db[_0x49c4('0x53')],'as':'List','include':[{'model':db[_0x49c4('0x54')],'as':_0x49c4('0x55'),'where':{'email':_0x5d24f3},'limit':0x1,'order':[['updatedAt',_0x49c4('0x56')]]}]},{'model':db['MailServerOut'],'as':_0x49c4('0x57'),'raw':!![]}]})[_0x49c4('0x12')](function(_0x9eaa84){_0xa431d=_0x9eaa84;if(_0xa431d&&_0xa431d[_0x49c4('0x57')]){var _0x845f7e={'tls':{'rejectUnauthorized':![]}};if(_[_0x49c4('0x58')](_0xa431d[_0x49c4('0x57')][_0x49c4('0x59')])){_0x845f7e['host']=_0xa431d[_0x49c4('0x57')][_0x49c4('0x5a')];_0x845f7e['port']=_0xa431d[_0x49c4('0x57')][_0x49c4('0x5b')];_0x845f7e['secure']=_0xa431d[_0x49c4('0x57')][_0x49c4('0x5c')];if(_0xa431d['Smtp']['authentication']){_0x845f7e['auth']={'user':_0xa431d['Smtp'][_0x49c4('0x5d')],'pass':_0xa431d['Smtp'][_0x49c4('0x5e')]};}}else{_0x845f7e[_0x49c4('0x59')]=_0xa431d['Smtp'][_0x49c4('0x59')];_0x845f7e[_0x49c4('0x5f')]={'user':_0xa431d['Smtp'][_0x49c4('0x5d')],'pass':_0xa431d[_0x49c4('0x57')][_0x49c4('0x5e')]};_0x845f7e[_0x49c4('0x5c')]=_0xa431d['Smtp'][_0x49c4('0x5c')];}if(_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')]&&_0x38c480[_0x49c4('0x49')]['attachments'][_0x49c4('0x48')]){for(var _0x4a93bc=0x0;_0x4a93bc<_0x38c480['body']['attachments']['length'];_0x4a93bc+=0x1){_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')][_0x4a93bc]={'filename':_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')][_0x4a93bc]['name'],'path':path['join'](config[_0x49c4('0x61')],_0x49c4('0x62'),_0x38c480[_0x49c4('0x49')][_0x49c4('0x60')][_0x4a93bc][_0x49c4('0x63')])};}}_0x5c7ddd={'account':_0x845f7e,'message':_0x38c480[_0x49c4('0x49')]};return;}})[_0x49c4('0x12')](function(){if(_0xa431d[_0x49c4('0x64')]){if(_0xa431d['List'][_0x49c4('0x55')]['length']){return _0xa431d[_0x49c4('0x64')][_0x49c4('0x55')][0x0];}else{return db[_0x49c4('0x54')][_0x49c4('0x4b')](_[_0x49c4('0xb')](_0x38c480[_0x49c4('0x49')],{'firstName':_0x38c480[_0x49c4('0x49')]['to'],'email':_0x38c480[_0x49c4('0x49')]['to'],'phone':_0x38c480[_0x49c4('0x49')]['to'],'ListId':_0xa431d[_0x49c4('0x65')]}));}}else{throw new Error(_0x49c4('0x66'));}})[_0x49c4('0x12')](function(){if(_0x5c7ddd){return respondWithRpcPromise(_0x49c4('0x67'),_0x49c4('0x68'),_0x5c7ddd,client9003)[_0x49c4('0x12')](function(_0x453cf2){return _0xcc6a2b[_0x49c4('0x25')]({'read':!![],'messageId':_0x453cf2[_0x49c4('0x69')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x49c4('0x1d')](function(_0x16b3e8){logger['error']('%s',JSON[_0x49c4('0x18')](_0x16b3e8));return _0xcc6a2b;});}return _0xcc6a2b;});}return _0xcc6a2b;}})[_0x49c4('0x12')](respondWithResult(_0x2884ca,0xc9))[_0x49c4('0x1d')](handleError(_0x2884ca,null));};exports[_0x49c4('0x6a')]=function(_0x4d6aaa,_0x5a14a5){var _0x4a85d4={'agent':{},'channel':_0x49c4('0x6b')};if(_0x4d6aaa[_0x49c4('0x49')]['id']){delete _0x4d6aaa[_0x49c4('0x49')]['id'];}_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x6c')]=!![];_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x6d')]=moment()[_0x49c4('0x6e')](_0x49c4('0x6f'));_0x4d6aaa['body'][_0x49c4('0x70')]=_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')]||_0x4d6aaa['user']['id'];_0x4a85d4[_0x49c4('0x71')]['id']=_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')];return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x4d6aaa[_0x49c4('0x47')]['id'],'UserId':null}})[_0x49c4('0x12')](handleEntityNotFound(_0x5a14a5,null))[_0x49c4('0x12')](saveUpdates(_0x4d6aaa['body'],null))[_0x49c4('0x12')](function(_0x20e2d5){if(_0x20e2d5){_0x4a85d4[_0x49c4('0x1b')]=_0x20e2d5[_0x49c4('0x72')]({'plain':!![]});return db[_0x49c4('0x73')]['find']({'where':{'id':_0x20e2d5['MailInteractionId']}});}return null;})[_0x49c4('0x12')](handleEntityNotFound(_0x5a14a5,null))['then'](function(_0x34cf49){if(_0x34cf49){return _0x34cf49['update']({'UserId':_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')],'read1stAt':_[_0x49c4('0x58')](_0x34cf49[_0x49c4('0x74')])?moment()['format'](_0x49c4('0x6f')):undefined});}return null;})[_0x49c4('0x12')](function(_0x2ceada){if(_0x2ceada){_0x4a85d4[_0x49c4('0x75')]=_0x2ceada[_0x49c4('0x72')]({'plain':!![]});interaction_log[_0x49c4('0x13')](_0x49c4('0x76'),_0x4d6aaa[_0x49c4('0x5d')]['id'],_0x4d6aaa[_0x49c4('0x5d')][_0x49c4('0x29')],_0x4d6aaa['user'][_0x49c4('0x77')],_0x4a85d4[_0x49c4('0x75')]['id'],_0x4d6aaa['body']?JSON[_0x49c4('0x18')](_0x4d6aaa['body']):_0x49c4('0x78'));return respondWithRpcPromise(_0x49c4('0x79'),_0x49c4('0x7a'),_0x4a85d4);}return null;})[_0x49c4('0x12')](function(_0x2c32c0){var _0x58b90c=_0x49c4('0x7b')+_0x2c32c0[_0x49c4('0x1b')]['ContactId'];return db[_0x49c4('0x7c')][_0x49c4('0x32')](_0x58b90c,{'type':db['Sequelize'][_0x49c4('0x7d')][_0x49c4('0x7e')],'raw':!![]})['then'](function(_0x37fef1){return _0x37fef1;});})[_0x49c4('0x12')](function(_0x25989a){if(_0x25989a){_0x4a85d4[_0x49c4('0x1b')]['contact']=_0x25989a[0x0];if(!_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x70')])return;return db['User'][_0x49c4('0x4a')]({'where':{'id':_0x4d6aaa['body']['UserId'],'role':_0x49c4('0x71')},'attributes':['id','name','fullname',_0x49c4('0x7f'),_0x49c4('0x80')],'raw':!![]});}return null;})['then'](function(_0x23e684){if(!_0x23e684)return null;_0x4a85d4['message']['agent']=_0x23e684;return _0x4a85d4;})['then'](function(_0x10d107){if(_0x10d107){if(_0x4d6aaa[_0x49c4('0x49')][_0x49c4('0x81')]){_0x4a85d4[_0x49c4('0x1b')]['interface']=util['format'](_0x49c4('0x82'),_0x4d6aaa['user'][_0x49c4('0x29')]);_0x4a85d4['message'][_0x49c4('0x83')]=_0x4a85d4[_0x49c4('0x83')];_0x4a85d4[_0x49c4('0x1b')][_0x49c4('0x84')]=_0x49c4('0x6a');_0x4a85d4[_0x49c4('0x1b')][_0x49c4('0x49')]=htmlToText['fromString'](_0x4a85d4[_0x49c4('0x1b')][_0x49c4('0x49')]);return respondWithRpcPromise(_0x49c4('0x85'),_0x49c4('0x85'),{'event':_0x49c4('0x86'),'message':_0x4a85d4['message']},client9002)[_0x49c4('0x12')](function(){return _0x4a85d4;});}return _0x4a85d4;}return null;})[_0x49c4('0x12')](respondWithResult(_0x5a14a5,null))[_0x49c4('0x1d')](handleError(_0x5a14a5,null));};exports['reject']=function(_0x530ff2,_0xbfff7){var _0x27b31d={'agent':{},'channel':_0x49c4('0x6b')};if(_0x530ff2[_0x49c4('0x49')]['id']){delete _0x530ff2[_0x49c4('0x49')]['id'];}_0x530ff2['body'][_0x49c4('0x70')]=_0x530ff2[_0x49c4('0x49')][_0x49c4('0x70')]||_0x530ff2[_0x49c4('0x5d')]['id'];_0x27b31d['agent']['id']=_0x530ff2['body'][_0x49c4('0x70')];return db[_0x49c4('0x2d')][_0x49c4('0x4a')]({'where':{'id':_0x530ff2[_0x49c4('0x47')]['id'],'UserId':null}})[_0x49c4('0x12')](handleEntityNotFound(_0xbfff7,null))['then'](function(_0x389edb){if(_0x389edb){_0x27b31d[_0x49c4('0x1b')]=_0x389edb[_0x49c4('0x72')]({'plain':!![]});return db[_0x49c4('0x73')][_0x49c4('0x4a')]({'where':{'id':_0x389edb[_0x49c4('0x87')]}});}return null;})['then'](handleEntityNotFound(_0xbfff7,null))[_0x49c4('0x12')](function(_0x1c90ba){if(_0x1c90ba){_0x27b31d[_0x49c4('0x75')]=_0x1c90ba[_0x49c4('0x72')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x530ff2[_0x49c4('0x5d')]['id'],_0x530ff2['user'][_0x49c4('0x29')],_0x530ff2['user'][_0x49c4('0x77')],_0x27b31d[_0x49c4('0x75')]['id'],_0x530ff2[_0x49c4('0x49')]?JSON[_0x49c4('0x18')](_0x530ff2['body']):'null');return respondWithRpcPromise(_0x49c4('0x88'),_0x49c4('0x89'),_0x27b31d);}return null;})[_0x49c4('0x12')](function(_0x5f0116){var _0x4c0e9c=_0x49c4('0x7b')+_0x5f0116['message']['ContactId'];return db[_0x49c4('0x7c')]['query'](_0x4c0e9c,{'type':db[_0x49c4('0x8a')][_0x49c4('0x7d')]['SELECT'],'raw':!![]})[_0x49c4('0x12')](function(_0x45474e){return _0x45474e;});})['then'](function(_0x5428a9){if(_0x5428a9){_0x27b31d[_0x49c4('0x1b')]['contact']=_0x5428a9[0x0];if(!_0x530ff2[_0x49c4('0x49')][_0x49c4('0x70')])return;return db[_0x49c4('0x8b')][_0x49c4('0x4a')]({'where':{'id':_0x530ff2[_0x49c4('0x49')][_0x49c4('0x70')],'role':_0x49c4('0x71')},'attributes':['id','name',_0x49c4('0x8c'),_0x49c4('0x7f'),_0x49c4('0x80')],'raw':!![]});}return null;})[_0x49c4('0x12')](function(_0x3107c9){if(!_0x3107c9)return null;_0x27b31d['message'][_0x49c4('0x71')]=_0x3107c9;return _0x27b31d;})['then'](function(_0xb66e67){if(_0xb66e67){_0xb66e67[_0x49c4('0x1b')][_0x49c4('0x8d')]=util[_0x49c4('0x6e')]('SIP/%s',_0x530ff2[_0x49c4('0x5d')][_0x49c4('0x29')]);_0xb66e67[_0x49c4('0x1b')][_0x49c4('0x83')]=_0x27b31d[_0x49c4('0x83')];_0xb66e67[_0x49c4('0x1b')]['event']=_0x49c4('0x8e');_0xb66e67['message'][_0x49c4('0x49')]=htmlToText[_0x49c4('0x8f')](_0x27b31d[_0x49c4('0x1b')][_0x49c4('0x49')]);respondWithRpcPromise('EventManager',_0x49c4('0x85'),{'event':_0x49c4('0x90'),'message':_0xb66e67['message']},client9002);return _0x27b31d;}return null;})[_0x49c4('0x12')](respondWithResult(_0xbfff7,null))[_0x49c4('0x1d')](handleError(_0xbfff7,null));};exports['download']=function(_0x562f47,_0x25f1c7){var _0x3e5915=moment()[_0x49c4('0x91')]()[_0x49c4('0x92')]();var _0x32afd4=path[_0x49c4('0x93')](config[_0x49c4('0x61')],_0x49c4('0x94'),_0x49c4('0x95'),_0x49c4('0x96'));var _0x269613=path['join'](config['root'],_0x49c4('0x94'),_0x49c4('0x95'),_0x49c4('0x60'));var _0x5be042=util[_0x49c4('0x6e')](_0x49c4('0x97'),_0x3e5915);return db['MailMessage'][_0x49c4('0x4a')]({'where':{'id':_0x562f47['params']['id']},'attributes':['id',_0x49c4('0x49'),_0x49c4('0x98'),'to','cc',_0x49c4('0x99'),_0x49c4('0x9a'),'createdAt'],'include':_0x562f47[_0x49c4('0x32')][_0x49c4('0x60')]?[{'model':db[_0x49c4('0x9b')],'as':_0x49c4('0x9c')}]:undefined})[_0x49c4('0x12')](handleEntityNotFound(_0x25f1c7,null))['then'](function(_0x5a4e00){if(_0x5a4e00){var _0x5f4d82=_0x5a4e00;var _0x1856c7={'from':_0x5f4d82[_0x49c4('0x98')],'to':_0x5f4d82['to'],'subject':_0x5f4d82[_0x49c4('0x9a')],'html':_0x5f4d82[_0x49c4('0x49')],'headers':{'Date':moment(_0x5f4d82[_0x49c4('0x9d')])['format'](_0x49c4('0x9e'))},'attachments':[]};if(_0x5a4e00['cc']){_0x1856c7[_0x49c4('0x9f')]['Cc']=_0x5a4e00['cc'];}if(_0x5a4e00[_0x49c4('0x99')]){_0x1856c7[_0x49c4('0x9f')]['Bcc']=_0x5a4e00[_0x49c4('0x99')];}return new BPromise(function(_0x5bfccd,_0x10fa42){if(_0x5a4e00[_0x49c4('0x9c')]){for(var _0x2fda4f=0x0;_0x2fda4f<_0x5a4e00['Attachments'][_0x49c4('0x48')];_0x2fda4f++){var _0x9b622d=_0x5a4e00[_0x49c4('0x9c')][_0x2fda4f];var _0x494c7f=path[_0x49c4('0x93')](_0x269613,_0x9b622d[_0x49c4('0x63')]);if(fs[_0x49c4('0xa0')](_0x494c7f)){_0x1856c7['attachments'][_0x49c4('0xa1')]({'name':_0x9b622d['name'],'contentType':_0x9b622d['type'],'data':fs[_0x49c4('0xa2')](_0x494c7f)});}}}emlformat[_0x49c4('0xa3')](_0x1856c7,function(_0x4ef4aa,_0x815b34){if(_0x4ef4aa)return _0x10fa42(_0x4ef4aa);fs[_0x49c4('0xa4')](path[_0x49c4('0x93')](_0x32afd4,_0x5be042),_0x815b34);return _0x5bfccd(_0x815b34);});});}})[_0x49c4('0x12')](function(_0x10f5fc){if(_0x10f5fc){return _0x25f1c7[_0x49c4('0xa5')](path[_0x49c4('0x93')](_0x32afd4,_0x5be042),_0x5be042,function(_0x219133){if(!_0x219133)fs['unlinkSync'](path['join'](_0x32afd4,_0x5be042));});}})[_0x49c4('0x1d')](handleError(_0x25f1c7,null));}; \ No newline at end of file +var _0x34e8=['message','info','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','name','send','index','map','MailMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','length','include','find','body','create','direction','out','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','DESC','MailServerOut','Smtp','isNil','service','host','port','secure','authentication','auth','user','pass','attachments','join','root','server/files/attachments','basename','ListId','sendMail','update','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','readAt','UserId','agent','get','MailInteraction','MailInteractionId','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','mail','RejectMessage','rejectMessage','email','interface','event','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0x34e8,0x12c));var _0x834e=function(_0x2ddc53,_0x417612){_0x2ddc53=_0x2ddc53-0x0;var _0x51dd5d=_0x34e8[_0x2ddc53];return _0x51dd5d;};'use strict';var emlformat=require(_0x834e('0x0'));var moment=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var util=require(_0x834e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x834e('0x4'));var Redis=require(_0x834e('0x5'));var htmlToText=require(_0x834e('0x6'));var qs=require(_0x834e('0x7'));var logger=require(_0x834e('0x8'))(_0x834e('0x9'));var interaction_log=require(_0x834e('0x8'))('mail-interactions');var config=require(_0x834e('0xa'));var db=require('../../mysqldb')['db'];config[_0x834e('0xb')]=_[_0x834e('0xc')](config[_0x834e('0xb')],{'host':_0x834e('0xd'),'port':0x18eb});var socket=require(_0x834e('0xe'))(new Redis(config[_0x834e('0xb')]));require(_0x834e('0xf'))[_0x834e('0x10')](socket);var jayson=require(_0x834e('0x11'));var client=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232c});var client9003=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232b});var client9002=jayson[_0x834e('0x12')][_0x834e('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x1e00de,_0x2fd95c,_0x538bb3,_0x5e5b6d){return new BPromise(function(_0x6cd9b9,_0x58a27e){var _0x23848e=_0x5e5b6d||client;return _0x23848e[_0x834e('0x14')](_0x1e00de,_0x538bb3)[_0x834e('0x15')](function(_0x21cc0a){logger['info'](_0x834e('0x16'),_0x2fd95c,_0x834e('0x17'));logger['debug'](_0x834e('0x18'),_0x2fd95c,'request\x20sent',JSON[_0x834e('0x19')](_0x21cc0a));if(_0x21cc0a[_0x834e('0x1a')]){if(_0x21cc0a['error'][_0x834e('0x1b')]===0x1f4){logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x21cc0a['error'][_0x834e('0x1c')]);return _0x58a27e(_0x21cc0a[_0x834e('0x1a')][_0x834e('0x1c')]);}logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x21cc0a[_0x834e('0x1a')][_0x834e('0x1c')]);return _0x6cd9b9(_0x21cc0a['error'][_0x834e('0x1c')]);}else{logger[_0x834e('0x1d')](_0x834e('0x16'),_0x2fd95c,_0x834e('0x17'));_0x6cd9b9(_0x21cc0a['result'][_0x834e('0x1c')]);}})[_0x834e('0x1e')](function(_0x5a05c0){logger[_0x834e('0x1a')](_0x834e('0x16'),_0x2fd95c,_0x5a05c0);_0x58a27e(_0x5a05c0);});});}function respondWithResult(_0x8d406e,_0x5c55ca){_0x5c55ca=_0x5c55ca||0xc8;return function(_0x4e3f48){if(_0x4e3f48){return _0x8d406e[_0x834e('0x1f')](_0x5c55ca)[_0x834e('0x20')](_0x4e3f48);}};}function respondWithFilteredResult(_0x589dde,_0x25ee1d){return function(_0x1dc1e0){if(_0x1dc1e0){var _0x58f4fd=typeof _0x25ee1d[_0x834e('0x21')]===_0x834e('0x22')&&typeof _0x25ee1d[_0x834e('0x23')]==='undefined';var _0x24fcf7=_0x1dc1e0[_0x834e('0x24')];var _0x5e1cc5=_0x58f4fd?0x0:_0x25ee1d['offset'];var _0x1e713a=_0x58f4fd?_0x1dc1e0['count']:_0x25ee1d[_0x834e('0x21')]+_0x25ee1d[_0x834e('0x23')];var _0x3db026;if(_0x1e713a>=_0x24fcf7){_0x1e713a=_0x24fcf7;_0x3db026=0xc8;}else{_0x3db026=0xce;}_0x589dde[_0x834e('0x1f')](_0x3db026);return _0x589dde[_0x834e('0x25')](_0x834e('0x26'),_0x5e1cc5+'-'+_0x1e713a+'/'+_0x24fcf7)['json'](_0x1dc1e0);}return null;};}function saveUpdates(_0x510780){return function(_0x4dc64a){if(_0x4dc64a){return _0x4dc64a['update'](_0x510780)[_0x834e('0x15')](function(_0x567cea){return _0x567cea;});}return null;};}function removeEntity(_0x106d6a){return function(_0x5dacc1){if(_0x5dacc1){return _0x5dacc1[_0x834e('0x27')]()[_0x834e('0x15')](function(){_0x106d6a[_0x834e('0x1f')](0xcc)[_0x834e('0x28')]();});}};}function handleEntityNotFound(_0x4551f5){return function(_0x390119){if(!_0x390119){_0x4551f5[_0x834e('0x29')](0x194);}return _0x390119;};}function handleError(_0xfaf716,_0x278db3){_0x278db3=_0x278db3||0x1f4;return function(_0x493289){logger[_0x834e('0x1a')](_0x493289['stack']);if(_0x493289[_0x834e('0x2a')]){delete _0x493289[_0x834e('0x2a')];}_0xfaf716[_0x834e('0x1f')](_0x278db3)[_0x834e('0x2b')](_0x493289);};}exports[_0x834e('0x2c')]=function(_0x4689c2,_0x4696a1){var _0x38cd29={},_0x358c31={},_0x12b2bc={'count':0x0,'rows':[]};var _0x5bd232=_[_0x834e('0x2d')](db[_0x834e('0x2e')][_0x834e('0x2f')],function(_0xaf01f4){return{'name':_0xaf01f4['fieldName'],'type':_0xaf01f4[_0x834e('0x30')][_0x834e('0x31')]};});_0x358c31['model']=_['map'](_0x5bd232,'name');_0x358c31[_0x834e('0x32')]=_[_0x834e('0x33')](_0x4689c2[_0x834e('0x32')]);_0x358c31[_0x834e('0x34')]=_[_0x834e('0x35')](_0x358c31[_0x834e('0x36')],_0x358c31['query']);_0x38cd29[_0x834e('0x37')]=_['intersection'](_0x358c31[_0x834e('0x36')],qs[_0x834e('0x38')](_0x4689c2['query'][_0x834e('0x38')]));_0x38cd29[_0x834e('0x37')]=_0x38cd29['attributes']['length']?_0x38cd29[_0x834e('0x37')]:_0x358c31[_0x834e('0x36')];if(!_0x4689c2[_0x834e('0x32')][_0x834e('0x39')](_0x834e('0x3a'))){_0x38cd29['limit']=qs[_0x834e('0x23')](_0x4689c2['query']['limit']);_0x38cd29[_0x834e('0x21')]=qs['offset'](_0x4689c2[_0x834e('0x32')][_0x834e('0x21')]);}_0x38cd29[_0x834e('0x3b')]=qs[_0x834e('0x3c')](_0x4689c2[_0x834e('0x32')]['sort']);_0x38cd29[_0x834e('0x3d')]=qs[_0x834e('0x34')](_[_0x834e('0x3e')](_0x4689c2['query'],_0x358c31[_0x834e('0x34')]),_0x5bd232);if(_0x4689c2[_0x834e('0x32')]['filter']){_0x38cd29[_0x834e('0x3d')]=_['merge'](_0x38cd29[_0x834e('0x3d')],{'$or':_[_0x834e('0x2d')](_0x5bd232,function(_0x4a18bb){if(_0x4a18bb['type']!==_0x834e('0x3f')){var _0x16969b={};_0x16969b[_0x4a18bb[_0x834e('0x2a')]]={'$like':'%'+_0x4689c2[_0x834e('0x32')][_0x834e('0x40')]+'%'};return _0x16969b;}})});}_0x38cd29=_[_0x834e('0x41')]({},_0x38cd29,_0x4689c2[_0x834e('0x42')]);var _0x4a3381={'where':_0x38cd29[_0x834e('0x3d')]};return db['MailMessage'][_0x834e('0x24')](_0x4a3381)['then'](function(_0x1df5b0){_0x12b2bc['count']=_0x1df5b0;if(_0x4689c2[_0x834e('0x32')][_0x834e('0x43')]){_0x38cd29['include']=[{'all':!![]}];}return db[_0x834e('0x2e')][_0x834e('0x44')](_0x38cd29);})[_0x834e('0x15')](function(_0xd55cc3){_0x12b2bc[_0x834e('0x45')]=_0xd55cc3;return _0x12b2bc;})[_0x834e('0x15')](respondWithFilteredResult(_0x4696a1,_0x38cd29))[_0x834e('0x1e')](handleError(_0x4696a1,null));};exports[_0x834e('0x46')]=function(_0x5dc63b,_0x279ea1){var _0x5f3943={'raw':!![],'where':{'id':_0x5dc63b[_0x834e('0x47')]['id']}},_0x3124be={};_0x3124be['model']=_[_0x834e('0x33')](db[_0x834e('0x2e')][_0x834e('0x2f')]);_0x3124be[_0x834e('0x32')]=_[_0x834e('0x33')](_0x5dc63b[_0x834e('0x32')]);_0x3124be['filters']=_['intersection'](_0x3124be[_0x834e('0x36')],_0x3124be[_0x834e('0x32')]);_0x5f3943[_0x834e('0x37')]=_[_0x834e('0x35')](_0x3124be[_0x834e('0x36')],qs[_0x834e('0x38')](_0x5dc63b[_0x834e('0x32')][_0x834e('0x38')]));_0x5f3943[_0x834e('0x37')]=_0x5f3943[_0x834e('0x37')][_0x834e('0x48')]?_0x5f3943[_0x834e('0x37')]:_0x3124be[_0x834e('0x36')];if(_0x5dc63b[_0x834e('0x32')][_0x834e('0x43')]){_0x5f3943[_0x834e('0x49')]=[{'all':!![]}];}_0x5f3943=_[_0x834e('0x41')]({},_0x5f3943,_0x5dc63b[_0x834e('0x42')]);return db[_0x834e('0x2e')][_0x834e('0x4a')](_0x5f3943)['then'](handleEntityNotFound(_0x279ea1,null))[_0x834e('0x15')](respondWithResult(_0x279ea1,null))[_0x834e('0x1e')](handleError(_0x279ea1,null));};exports['update']=function(_0x3c00a3,_0x3b0988){if(_0x3c00a3['body']['id']){delete _0x3c00a3[_0x834e('0x4b')]['id'];}return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x3c00a3[_0x834e('0x47')]['id']}})[_0x834e('0x15')](handleEntityNotFound(_0x3b0988,null))[_0x834e('0x15')](saveUpdates(_0x3c00a3[_0x834e('0x4b')],null))['then'](respondWithResult(_0x3b0988,null))[_0x834e('0x1e')](handleError(_0x3b0988,null));};exports[_0x834e('0x27')]=function(_0x3e0550,_0x363675){return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x3e0550[_0x834e('0x47')]['id']}})[_0x834e('0x15')](handleEntityNotFound(_0x363675,null))['then'](removeEntity(_0x363675,null))[_0x834e('0x1e')](handleError(_0x363675,null));};exports['describe']=function(_0x2f4bde,_0x53a9ee){return db[_0x834e('0x2e')]['describe']()['then'](respondWithResult(_0x53a9ee,null))[_0x834e('0x1e')](handleError(_0x53a9ee,null));};exports[_0x834e('0x4c')]=function(_0x5291ae,_0x5be43d){return db[_0x834e('0x2e')][_0x834e('0x4c')](_0x5291ae[_0x834e('0x4b')])[_0x834e('0x15')](function(_0x21c417){if(_0x21c417){if(_0x21c417[_0x834e('0x4d')]===_0x834e('0x4e')&&!_0x21c417[_0x834e('0x4f')]){var _0x528e66,_0x142334,_0x3c70bf;if(_0x5291ae['body']['to']){_0x142334=_0x5291ae[_0x834e('0x4b')]['to']['split'](',')[0x0];}return db[_0x834e('0x50')][_0x834e('0x51')]({'where':{'id':_0x21c417['MailAccountId']},'include':[{'model':db[_0x834e('0x52')],'as':_0x834e('0x53'),'include':[{'model':db[_0x834e('0x54')],'as':_0x834e('0x55'),'where':{'email':_0x142334},'limit':0x1,'order':[['updatedAt',_0x834e('0x56')]]}]},{'model':db[_0x834e('0x57')],'as':_0x834e('0x58'),'raw':!![]}]})['then'](function(_0x246b8e){_0x528e66=_0x246b8e;if(_0x528e66&&_0x528e66[_0x834e('0x58')]){var _0x3a7683={'tls':{'rejectUnauthorized':![]}};if(_[_0x834e('0x59')](_0x528e66[_0x834e('0x58')][_0x834e('0x5a')])){_0x3a7683[_0x834e('0x5b')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5b')];_0x3a7683[_0x834e('0x5c')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5c')];_0x3a7683[_0x834e('0x5d')]=_0x528e66[_0x834e('0x58')][_0x834e('0x5d')];if(_0x528e66[_0x834e('0x58')][_0x834e('0x5e')]){_0x3a7683[_0x834e('0x5f')]={'user':_0x528e66[_0x834e('0x58')][_0x834e('0x60')],'pass':_0x528e66[_0x834e('0x58')][_0x834e('0x61')]};}}else{_0x3a7683['service']=_0x528e66[_0x834e('0x58')][_0x834e('0x5a')];_0x3a7683[_0x834e('0x5f')]={'user':_0x528e66[_0x834e('0x58')]['user'],'pass':_0x528e66[_0x834e('0x58')]['pass']};_0x3a7683['secure']=_0x528e66[_0x834e('0x58')][_0x834e('0x5d')];}if(_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')]&&_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')][_0x834e('0x48')]){for(var _0xe5c8f6=0x0;_0xe5c8f6<_0x5291ae['body'][_0x834e('0x62')]['length'];_0xe5c8f6+=0x1){_0x5291ae[_0x834e('0x4b')][_0x834e('0x62')][_0xe5c8f6]={'filename':_0x5291ae['body']['attachments'][_0xe5c8f6][_0x834e('0x2a')],'path':path[_0x834e('0x63')](config[_0x834e('0x64')],_0x834e('0x65'),_0x5291ae[_0x834e('0x4b')]['attachments'][_0xe5c8f6][_0x834e('0x66')])};}}_0x3c70bf={'account':_0x3a7683,'message':_0x5291ae[_0x834e('0x4b')]};return;}})[_0x834e('0x15')](function(){if(_0x528e66[_0x834e('0x53')]){if(_0x528e66[_0x834e('0x53')][_0x834e('0x55')][_0x834e('0x48')]){return _0x528e66[_0x834e('0x53')][_0x834e('0x55')][0x0];}else{return db[_0x834e('0x54')]['create'](_[_0x834e('0xc')](_0x5291ae[_0x834e('0x4b')],{'firstName':_0x5291ae[_0x834e('0x4b')]['to'],'email':_0x5291ae[_0x834e('0x4b')]['to'],'phone':_0x5291ae['body']['to'],'ListId':_0x528e66[_0x834e('0x67')]}));}}else{throw new Error('List\x20not\x20found');}})['then'](function(){if(_0x3c70bf){return respondWithRpcPromise('SendMail',_0x834e('0x68'),_0x3c70bf,client9003)[_0x834e('0x15')](function(_0x514aac){return _0x21c417[_0x834e('0x69')]({'read':!![],'messageId':_0x514aac[_0x834e('0x6a')],'sentAt':moment()['format'](_0x834e('0x6b'))});})[_0x834e('0x1e')](function(_0x4b88e7){logger['error']('%s',JSON[_0x834e('0x19')](_0x4b88e7));return _0x21c417;});}return _0x21c417;});}return _0x21c417;}})[_0x834e('0x15')](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x1e')](handleError(_0x5be43d,null));};exports[_0x834e('0x6c')]=function(_0x1d8e7,_0x493239){var _0x264a6f={'agent':{},'channel':'mail'};if(_0x1d8e7[_0x834e('0x4b')]['id']){delete _0x1d8e7[_0x834e('0x4b')]['id'];}_0x1d8e7[_0x834e('0x4b')]['read']=!![];_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6d')]=moment()['format'](_0x834e('0x6b'));_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')]=_0x1d8e7['body'][_0x834e('0x6e')]||_0x1d8e7[_0x834e('0x60')]['id'];_0x264a6f[_0x834e('0x6f')]['id']=_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')];return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x1d8e7[_0x834e('0x47')]['id'],'UserId':null}})[_0x834e('0x15')](handleEntityNotFound(_0x493239,null))[_0x834e('0x15')](saveUpdates(_0x1d8e7['body'],null))['then'](function(_0x4e466e){if(_0x4e466e){_0x264a6f[_0x834e('0x1c')]=_0x4e466e[_0x834e('0x70')]({'plain':!![]});return db[_0x834e('0x71')][_0x834e('0x4a')]({'where':{'id':_0x4e466e[_0x834e('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x493239,null))['then'](function(_0x4520fc){if(_0x4520fc){return _0x4520fc[_0x834e('0x69')]({'UserId':_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')],'read1stAt':_[_0x834e('0x59')](_0x4520fc['read1stAt'])?moment()[_0x834e('0x73')](_0x834e('0x6b')):undefined});}return null;})[_0x834e('0x15')](function(_0x4e1735){if(_0x4e1735){_0x264a6f[_0x834e('0x74')]=_0x4e1735[_0x834e('0x70')]({'plain':!![]});interaction_log[_0x834e('0x1d')](_0x834e('0x75'),_0x1d8e7[_0x834e('0x60')]['id'],_0x1d8e7['user']['name'],_0x1d8e7[_0x834e('0x60')][_0x834e('0x76')],_0x264a6f['interaction']['id'],_0x1d8e7[_0x834e('0x4b')]?JSON['stringify'](_0x1d8e7[_0x834e('0x4b')]):_0x834e('0x77'));return respondWithRpcPromise(_0x834e('0x78'),'acceptMessage',_0x264a6f);}return null;})[_0x834e('0x15')](function(_0x49e721){var _0x5b2621='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49e721[_0x834e('0x1c')][_0x834e('0x79')];return db[_0x834e('0x7a')][_0x834e('0x32')](_0x5b2621,{'type':db[_0x834e('0x7b')][_0x834e('0x7c')][_0x834e('0x7d')],'raw':!![]})[_0x834e('0x15')](function(_0x17e61a){return _0x17e61a;});})['then'](function(_0x2f775a){if(_0x2f775a){_0x264a6f['message'][_0x834e('0x7e')]=_0x2f775a[0x0];if(!_0x1d8e7[_0x834e('0x4b')][_0x834e('0x6e')])return;return db[_0x834e('0x7f')][_0x834e('0x4a')]({'where':{'id':_0x1d8e7[_0x834e('0x4b')]['UserId'],'role':'agent'},'attributes':['id',_0x834e('0x2a'),_0x834e('0x80'),'email',_0x834e('0x81')],'raw':!![]});}return null;})[_0x834e('0x15')](function(_0x1bc5d1){if(!_0x1bc5d1)return null;_0x264a6f[_0x834e('0x1c')][_0x834e('0x6f')]=_0x1bc5d1;return _0x264a6f;})['then'](function(_0x29839d){if(_0x29839d){if(_0x1d8e7[_0x834e('0x4b')]['manual']){_0x264a6f['message']['interface']=util[_0x834e('0x73')](_0x834e('0x82'),_0x1d8e7['user'][_0x834e('0x2a')]);_0x264a6f[_0x834e('0x1c')]['channel']=_0x264a6f[_0x834e('0x83')];_0x264a6f['message']['event']=_0x834e('0x6c');_0x264a6f[_0x834e('0x1c')][_0x834e('0x4b')]=htmlToText[_0x834e('0x84')](_0x264a6f['message'][_0x834e('0x4b')]);return respondWithRpcPromise(_0x834e('0x85'),_0x834e('0x85'),{'event':_0x834e('0x86'),'message':_0x264a6f[_0x834e('0x1c')]},client9002)[_0x834e('0x15')](function(){return _0x264a6f;});}return _0x264a6f;}return null;})[_0x834e('0x15')](respondWithResult(_0x493239,null))[_0x834e('0x1e')](handleError(_0x493239,null));};exports[_0x834e('0x87')]=function(_0x2821fe,_0x2fa64c){var _0x261e3d={'agent':{},'channel':_0x834e('0x88')};if(_0x2821fe[_0x834e('0x4b')]['id']){delete _0x2821fe[_0x834e('0x4b')]['id'];}_0x2821fe[_0x834e('0x4b')][_0x834e('0x6e')]=_0x2821fe[_0x834e('0x4b')][_0x834e('0x6e')]||_0x2821fe[_0x834e('0x60')]['id'];_0x261e3d[_0x834e('0x6f')]['id']=_0x2821fe[_0x834e('0x4b')]['UserId'];return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x2821fe[_0x834e('0x47')]['id'],'UserId':null}})[_0x834e('0x15')](handleEntityNotFound(_0x2fa64c,null))[_0x834e('0x15')](function(_0x3bcdcd){if(_0x3bcdcd){_0x261e3d[_0x834e('0x1c')]=_0x3bcdcd[_0x834e('0x70')]({'plain':!![]});return db[_0x834e('0x71')]['find']({'where':{'id':_0x3bcdcd['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2fa64c,null))[_0x834e('0x15')](function(_0x493e1f){if(_0x493e1f){_0x261e3d[_0x834e('0x74')]=_0x493e1f[_0x834e('0x70')]({'plain':!![]});interaction_log[_0x834e('0x1d')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2821fe[_0x834e('0x60')]['id'],_0x2821fe[_0x834e('0x60')][_0x834e('0x2a')],_0x2821fe[_0x834e('0x60')][_0x834e('0x76')],_0x261e3d[_0x834e('0x74')]['id'],_0x2821fe['body']?JSON[_0x834e('0x19')](_0x2821fe[_0x834e('0x4b')]):_0x834e('0x77'));return respondWithRpcPromise(_0x834e('0x89'),_0x834e('0x8a'),_0x261e3d);}return null;})['then'](function(_0x4ebeba){var _0x508b3e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4ebeba[_0x834e('0x1c')][_0x834e('0x79')];return db['sequelize'][_0x834e('0x32')](_0x508b3e,{'type':db[_0x834e('0x7b')]['QueryTypes'][_0x834e('0x7d')],'raw':!![]})[_0x834e('0x15')](function(_0xbf7693){return _0xbf7693;});})[_0x834e('0x15')](function(_0x1d1075){if(_0x1d1075){_0x261e3d[_0x834e('0x1c')]['contact']=_0x1d1075[0x0];if(!_0x2821fe['body'][_0x834e('0x6e')])return;return db[_0x834e('0x7f')][_0x834e('0x4a')]({'where':{'id':_0x2821fe['body'][_0x834e('0x6e')],'role':_0x834e('0x6f')},'attributes':['id','name',_0x834e('0x80'),_0x834e('0x8b'),_0x834e('0x81')],'raw':!![]});}return null;})[_0x834e('0x15')](function(_0x4cb802){if(!_0x4cb802)return null;_0x261e3d[_0x834e('0x1c')]['agent']=_0x4cb802;return _0x261e3d;})['then'](function(_0xc64958){if(_0xc64958){_0xc64958[_0x834e('0x1c')][_0x834e('0x8c')]=util[_0x834e('0x73')](_0x834e('0x82'),_0x2821fe[_0x834e('0x60')]['name']);_0xc64958['message'][_0x834e('0x83')]=_0x261e3d[_0x834e('0x83')];_0xc64958[_0x834e('0x1c')][_0x834e('0x8d')]=_0x834e('0x87');_0xc64958[_0x834e('0x1c')][_0x834e('0x4b')]=htmlToText['fromString'](_0x261e3d[_0x834e('0x1c')][_0x834e('0x4b')]);respondWithRpcPromise('EventManager',_0x834e('0x85'),{'event':_0x834e('0x8e'),'message':_0xc64958[_0x834e('0x1c')]},client9002);return _0x261e3d;}return null;})[_0x834e('0x15')](respondWithResult(_0x2fa64c,null))[_0x834e('0x1e')](handleError(_0x2fa64c,null));};exports[_0x834e('0x8f')]=function(_0x231f0b,_0x3b44f3){var _0x14e794=moment()[_0x834e('0x90')]()[_0x834e('0x91')]();var _0x152372=path[_0x834e('0x63')](config[_0x834e('0x64')],'server',_0x834e('0x92'),_0x834e('0x93'));var _0x522eab=path[_0x834e('0x63')](config['root'],_0x834e('0x94'),'files',_0x834e('0x62'));var _0x560d10=util[_0x834e('0x73')](_0x834e('0x95'),_0x14e794);return db[_0x834e('0x2e')][_0x834e('0x4a')]({'where':{'id':_0x231f0b['params']['id']},'attributes':['id',_0x834e('0x4b'),_0x834e('0x96'),'to','cc',_0x834e('0x97'),_0x834e('0x98'),_0x834e('0x99')],'include':_0x231f0b[_0x834e('0x32')][_0x834e('0x62')]?[{'model':db[_0x834e('0x9a')],'as':_0x834e('0x9b')}]:undefined})[_0x834e('0x15')](handleEntityNotFound(_0x3b44f3,null))[_0x834e('0x15')](function(_0x1cb4d0){if(_0x1cb4d0){var _0x3a6546=_0x1cb4d0;var _0x246f01={'from':_0x3a6546[_0x834e('0x96')],'to':_0x3a6546['to'],'subject':_0x3a6546[_0x834e('0x98')],'html':_0x3a6546[_0x834e('0x4b')],'headers':{'Date':moment(_0x3a6546['createdAt'])['format'](_0x834e('0x9c'))},'attachments':[]};if(_0x1cb4d0['cc']){_0x246f01[_0x834e('0x9d')]['Cc']=_0x1cb4d0['cc'];}if(_0x1cb4d0[_0x834e('0x97')]){_0x246f01[_0x834e('0x9d')][_0x834e('0x9e')]=_0x1cb4d0[_0x834e('0x97')];}return new BPromise(function(_0x22f90d,_0x40fd40){if(_0x1cb4d0[_0x834e('0x9b')]){for(var _0x58cd3b=0x0;_0x58cd3b<_0x1cb4d0[_0x834e('0x9b')][_0x834e('0x48')];_0x58cd3b++){var _0x513d9e=_0x1cb4d0[_0x834e('0x9b')][_0x58cd3b];var _0x54c129=path[_0x834e('0x63')](_0x522eab,_0x513d9e[_0x834e('0x66')]);if(fs[_0x834e('0x9f')](_0x54c129)){_0x246f01['attachments'][_0x834e('0xa0')]({'name':_0x513d9e[_0x834e('0x2a')],'contentType':_0x513d9e['type'],'data':fs['readFileSync'](_0x54c129)});}}}emlformat[_0x834e('0xa1')](_0x246f01,function(_0x3b7b1a,_0x4e0f4d){if(_0x3b7b1a)return _0x40fd40(_0x3b7b1a);fs[_0x834e('0xa2')](path[_0x834e('0x63')](_0x152372,_0x560d10),_0x4e0f4d);return _0x22f90d(_0x4e0f4d);});});}})[_0x834e('0x15')](function(_0x135219){if(_0x135219){return _0x3b44f3[_0x834e('0x8f')](path['join'](_0x152372,_0x560d10),_0x560d10,function(_0x4e7545){if(!_0x4e7545)fs[_0x834e('0xa3')](path['join'](_0x152372,_0x560d10));});}})['catch'](handleError(_0x3b44f3,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f1393a6..0163a3d 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 _0x8212=['setMaxListeners','save','emit','hasOwnProperty','hook','events'];(function(_0x39990c,_0xbcfc2c){var _0x599521=function(_0x16ed9a){while(--_0x16ed9a){_0x39990c['push'](_0x39990c['shift']());}};_0x599521(++_0xbcfc2c);}(_0x8212,0x185));var _0x2821=function(_0x41df99,_0x39599f){_0x41df99=_0x41df99-0x0;var _0x5923e0=_0x8212[_0x41df99];return _0x5923e0;};'use strict';var EventEmitter=require(_0x2821('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2821('0x1')](0x0);var events={'afterCreate':_0x2821('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb184f0){return function(_0x5b6234,_0x17bf53,_0x42aa9d){MailMessageEvents[_0x2821('0x3')](_0xb184f0+':'+_0x5b6234['id'],_0x5b6234);MailMessageEvents[_0x2821('0x3')](_0xb184f0,_0x5b6234);_0x42aa9d(null);};}for(var e in events){if(events[_0x2821('0x4')](e)){var event=events[e];MailMessage[_0x2821('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xfd3e=['MailMessage','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x215566,_0xc86b){var _0x4fd5b6=function(_0x46f4fb){while(--_0x46f4fb){_0x215566['push'](_0x215566['shift']());}};_0x4fd5b6(++_0xc86b);}(_0xfd3e,0x86));var _0xefd3=function(_0x3f9dc7,_0x159635){_0x3f9dc7=_0x3f9dc7-0x0;var _0x154f3f=_0xfd3e[_0x3f9dc7];return _0x154f3f;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xefd3('0x0'))['db'][_0xefd3('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xefd3('0x2')](0x0);var events={'afterCreate':_0xefd3('0x3'),'afterUpdate':_0xefd3('0x4'),'afterDestroy':_0xefd3('0x5')};function emitEvent(_0x215224){return function(_0x32b78e,_0x28d637,_0x2bf202){MailMessageEvents['emit'](_0x215224+':'+_0x32b78e['id'],_0x32b78e);MailMessageEvents['emit'](_0x215224,_0x32b78e);_0x2bf202(null);};}for(var e in events){if(events[_0xefd3('0x6')](e)){var event=events[e];MailMessage[_0xefd3('0x7')](e,emitEvent(event));}}module[_0xefd3('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f7074d0..2137e77 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 _0xcab3=['UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','models','get','direction','toLowerCase','secret','isNil'];(function(_0x46f66a,_0x26d8ba){var _0x18a214=function(_0x35a07d){while(--_0x35a07d){_0x46f66a['push'](_0x46f66a['shift']());}};_0x18a214(++_0x26d8ba);}(_0xcab3,0x13b));var _0x3cab=function(_0x49623,_0x2dfdfd){_0x49623=_0x49623-0x0;var _0x2941c4=_0xcab3[_0x49623];return _0x2941c4;};'use strict';var _=require(_0x3cab('0x0'));var util=require(_0x3cab('0x1'));var logger=require(_0x3cab('0x2'))(_0x3cab('0x3'));var moment=require(_0x3cab('0x4'));var BPromise=require(_0x3cab('0x5'));var rp=require(_0x3cab('0x6'));var htmlToText=require(_0x3cab('0x7'));var fs=require('fs');var path=require(_0x3cab('0x8'));var rimraf=require('rimraf');var config=require(_0x3cab('0x9'));var attributes=require(_0x3cab('0xa'));module[_0x3cab('0xb')]=function(_0x191c60,_0x902acb){return _0x191c60[_0x3cab('0xc')](_0x3cab('0xd'),attributes,{'tableName':_0x3cab('0xe'),'paranoid':![],'indexes':[{'name':_0x3cab('0xf'),'fields':['messageId']},{'name':_0x3cab('0x10'),'fields':[_0x3cab('0x11'),_0x3cab('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2911fd,_0x11ac79,_0x11b7aa){if(_0x2911fd['body']){_0x2911fd['plainBody']=htmlToText['fromString'](_0x2911fd['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x11b7aa(null,_0x11ac79);},'afterCreate':function(_0x30c1e2,_0x48c8fe,_0x4ae328){var _0x4803b2=_0x191c60[_0x3cab('0x13')];var _0x504572=_0x30c1e2[_0x3cab('0x14')]({'plain':!![]});if(_0x504572[_0x3cab('0x15')][_0x3cab('0x16')]()==='in'||_0x504572[_0x3cab('0x15')][_0x3cab('0x16')]()==='out'&&!_0x504572[_0x3cab('0x17')]&&!_[_0x3cab('0x18')](_0x504572[_0x3cab('0x19')])){_0x4803b2[_0x3cab('0x1a')][_0x3cab('0x1b')]({'where':{'id':_0x504572[_0x3cab('0x1c')]}})[_0x3cab('0x1d')](function(_0x369cee){if(_0x369cee){_0x369cee[_0x3cab('0x1e')]({'lastMsgAt':_0x504572[_0x3cab('0x1f')],'lastMsgDirection':_0x504572[_0x3cab('0x15')][_0x3cab('0x16')]()});}})[_0x3cab('0x20')](function(_0x178cc3){console[_0x3cab('0x21')](_0x178cc3);});}_0x4ae328();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9e0a=['toLowerCase','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','direction','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get'];(function(_0x29e3ec,_0x138a18){var _0x25727e=function(_0x2bea0d){while(--_0x2bea0d){_0x29e3ec['push'](_0x29e3ec['shift']());}};_0x25727e(++_0x138a18);}(_0x9e0a,0x154));var _0xa9e0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9e0a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa9e0('0x0'));var util=require(_0xa9e0('0x1'));var logger=require(_0xa9e0('0x2'))(_0xa9e0('0x3'));var moment=require(_0xa9e0('0x4'));var BPromise=require(_0xa9e0('0x5'));var rp=require(_0xa9e0('0x6'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa9e0('0x7'));module[_0xa9e0('0x8')]=function(_0x581265,_0x20e04a){return _0x581265[_0xa9e0('0x9')](_0xa9e0('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa9e0('0xb')]},{'name':_0xa9e0('0xc'),'fields':[_0xa9e0('0xd'),_0xa9e0('0xe')],'type':_0xa9e0('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a8f1a,_0x2f682d,_0x5c0485){if(_0x5a8f1a[_0xa9e0('0x10')]){_0x5a8f1a['plainBody']=htmlToText[_0xa9e0('0x11')](_0x5a8f1a[_0xa9e0('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x5c0485(null,_0x2f682d);},'afterCreate':function(_0x4069ef,_0x11f3e2,_0x41a510){var _0x30cee7=_0x581265[_0xa9e0('0x12')];var _0x2c2a8d=_0x4069ef[_0xa9e0('0x13')]({'plain':!![]});if(_0x2c2a8d['direction']['toLowerCase']()==='in'||_0x2c2a8d['direction'][_0xa9e0('0x14')]()===_0xa9e0('0x15')&&!_0x2c2a8d[_0xa9e0('0x16')]&&!_[_0xa9e0('0x17')](_0x2c2a8d[_0xa9e0('0x18')])){_0x30cee7[_0xa9e0('0x19')][_0xa9e0('0x1a')]({'where':{'id':_0x2c2a8d[_0xa9e0('0x1b')]}})[_0xa9e0('0x1c')](function(_0x2dbcc6){if(_0x2dbcc6){_0x2dbcc6[_0xa9e0('0x1d')]({'lastMsgAt':_0x2c2a8d[_0xa9e0('0x1e')],'lastMsgDirection':_0x2c2a8d[_0xa9e0('0x1f')][_0xa9e0('0x14')]()});}})[_0xa9e0('0x20')](function(_0x3d5a0c){console[_0xa9e0('0x21')](_0x3d5a0c);});}_0x41a510();}},'charset':_0xa9e0('0x22'),'collate':_0xa9e0('0x23')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index de18fa1..9d1ea34 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 _0x6cb4=['result','catch','CreateMailMessage','MailMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6cb4,0xff));var _0x46cb=function(_0x437141,_0x33adf7){_0x437141=_0x437141-0x0;var _0x2a5c91=_0x6cb4[_0x437141];return _0x2a5c91;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./mailMessage.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')](_0x32e9fe[_0x46cb('0x1e')],{'raw':_0x32e9fe[_0x46cb('0x1f')]?_0x32e9fe[_0x46cb('0x1f')][_0x46cb('0x20')]===undefined?!![]:![]:!![]})[_0x46cb('0x11')](function(_0x41ecd2){logger[_0x46cb('0x21')](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')](_0x46cb('0x1b'),_0x32e9fe,JSON[_0x46cb('0x22')](_0x41ecd2));_0xfc9064(_0x41ecd2);})[_0x46cb('0x1a')](function(_0x5a1338){logger['error'](_0x46cb('0x1b'),_0x5a1338[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5a1338[_0x46cb('0x18')]));});});}; \ No newline at end of file +var _0x6343=['jayson/promise','client','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','MailMessage','create','options','raw','moment','bluebird','../../config/logger','rpc'];(function(_0x1ca2a7,_0x9c0b84){var _0x270f44=function(_0x2dc5c2){while(--_0x2dc5c2){_0x1ca2a7['push'](_0x1ca2a7['shift']());}};_0x270f44(++_0x9c0b84);}(_0x6343,0x168));var _0x3634=function(_0x48fb8c,_0x4ff8e6){_0x48fb8c=_0x48fb8c-0x0;var _0xdff757=_0x6343[_0x48fb8c];return _0xdff757;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3634('0x0'));var BPromise=require(_0x3634('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3634('0x2'))(_0x3634('0x3'));var config=require('../../config/environment');var jayson=require(_0x3634('0x4'));var client=jayson[_0x3634('0x5')]['http']({'port':0x232a});config[_0x3634('0x6')]=_[_0x3634('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3634('0x8'))(new Redis(config[_0x3634('0x6')]));require(_0x3634('0x9'))[_0x3634('0xa')](socket);function respondWithRpcPromise(_0x2e8e8b,_0x43f681,_0x5e907a){return new BPromise(function(_0x4b965a,_0x31bcfc){return client[_0x3634('0xb')](_0x2e8e8b,_0x5e907a)['then'](function(_0x2bb4db){logger[_0x3634('0xc')](_0x3634('0xd'),_0x43f681,_0x3634('0xe'));logger[_0x3634('0xf')](_0x3634('0x10'),_0x43f681,_0x3634('0xe'),JSON[_0x3634('0x11')](_0x2bb4db));if(_0x2bb4db[_0x3634('0x12')]){if(_0x2bb4db[_0x3634('0x12')][_0x3634('0x13')]===0x1f4){logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')]['message']);return _0x31bcfc(_0x2bb4db[_0x3634('0x12')]['message']);}logger[_0x3634('0x12')](_0x3634('0xd'),_0x43f681,_0x2bb4db[_0x3634('0x12')][_0x3634('0x14')]);return _0x4b965a(_0x2bb4db[_0x3634('0x12')]['message']);}else{logger[_0x3634('0xc')]('MailMessage,\x20%s,\x20%s',_0x43f681,'request\x20sent');_0x4b965a(_0x2bb4db[_0x3634('0x15')]['message']);}})[_0x3634('0x16')](function(_0x32e3c6){logger[_0x3634('0x12')]('MailMessage,\x20%s,\x20%s',_0x43f681,_0x32e3c6);_0x31bcfc(_0x32e3c6);});});}exports[_0x3634('0x17')]=function(_0x4366bc){var _0x577a6c=this;return new Promise(function(_0xeb9231,_0x506281){return db[_0x3634('0x18')][_0x3634('0x19')](_0x4366bc['body'],{'raw':_0x4366bc[_0x3634('0x1a')]?_0x4366bc[_0x3634('0x1a')][_0x3634('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x22b7ef){logger[_0x3634('0xc')]('CreateMailMessage',_0x4366bc);logger[_0x3634('0xf')]('CreateMailMessage',_0x4366bc,JSON['stringify'](_0x22b7ef));_0xeb9231(_0x22b7ef);})[_0x3634('0x16')](function(_0x862ab5){logger['error'](_0x3634('0x17'),_0x862ab5[_0x3634('0x14')],_0x4366bc);_0x506281(_0x577a6c[_0x3634('0x12')](0x1f4,_0x862ab5[_0x3634('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 57de66f..bf70ebb 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 _0x0a2a=['register','length','save','remove','emit','removeListener'];(function(_0x34a72f,_0x1c2689){var _0x469f10=function(_0x5279e9){while(--_0x5279e9){_0x34a72f['push'](_0x34a72f['shift']());}};_0x469f10(++_0x1c2689);}(_0x0a2a,0x1e8));var _0xa0a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a2a[_0x3dd15e];return _0x231fd0;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0xa0a2('0x0'),_0xa0a2('0x1'),'update'];function createListener(_0x5cc516,_0x15c6f5){return function(_0x2ccf3f){_0x15c6f5[_0xa0a2('0x2')](_0x5cc516,_0x2ccf3f);};}function removeListener(_0x6fce85,_0x39e36d){return function(){MailMessageEvents[_0xa0a2('0x3')](_0x6fce85,_0x39e36d);};}exports[_0xa0a2('0x4')]=function(_0x16e502){for(var _0x49460a=0x0,_0x3a211c=events[_0xa0a2('0x5')];_0x49460a<_0x3a211c;_0x49460a++){var _0x1a7e8c=events[_0x49460a];var _0x2c81c9=createListener('mailMessage:'+_0x1a7e8c,_0x16e502);MailMessageEvents['on'](_0x1a7e8c,_0x2c81c9);}}; \ No newline at end of file +var _0xc694=['remove','emit','removeListener','register','length','mailMessage:','./mailMessage.events','save'];(function(_0x28a0f5,_0xc8764c){var _0xb6482b=function(_0x2e03e4){while(--_0x2e03e4){_0x28a0f5['push'](_0x28a0f5['shift']());}};_0xb6482b(++_0xc8764c);}(_0xc694,0x11e));var _0x4c69=function(_0x2657c1,_0x50043d){_0x2657c1=_0x2657c1-0x0;var _0x2a94c3=_0xc694[_0x2657c1];return _0x2a94c3;};'use strict';var MailMessageEvents=require(_0x4c69('0x0'));var events=[_0x4c69('0x1'),_0x4c69('0x2'),'update'];function createListener(_0x556c0e,_0x35fd24){return function(_0x52cb1e){_0x35fd24[_0x4c69('0x3')](_0x556c0e,_0x52cb1e);};}function removeListener(_0x32ea21,_0x479bf8){return function(){MailMessageEvents[_0x4c69('0x4')](_0x32ea21,_0x479bf8);};}exports[_0x4c69('0x5')]=function(_0x26e8d7){for(var _0x43131b=0x0,_0x2e902d=events[_0x4c69('0x6')];_0x43131b<_0x2e902d;_0x43131b++){var _0x4416f9=events[_0x43131b];var _0x3c2fa4=createListener(_0x4c69('0x7')+_0x4416f9,_0x26e8d7);MailMessageEvents['on'](_0x4416f9,_0x3c2fa4);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index e4ecb4d..66433c2 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 _0x121d=['/describe','describe','/:id','show','getMembers','create','post','/:id/teams','addTeams','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index'];(function(_0x1f530d,_0x18a19e){var _0x22103f=function(_0x2664c5){while(--_0x2664c5){_0x1f530d['push'](_0x1f530d['shift']());}};_0x22103f(++_0x18a19e);}(_0x121d,0x1d2));var _0xd121=function(_0x3f2fb9,_0x14ba17){_0x3f2fb9=_0x3f2fb9-0x0;var _0x1a90f4=_0x121d[_0x3f2fb9];return _0x1a90f4;};'use strict';var multer=require('multer');var util=require(_0xd121('0x0'));var path=require(_0xd121('0x1'));var timeout=require(_0xd121('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd121('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xd121('0x4'));var config=require(_0xd121('0x5'));var controller=require(_0xd121('0x6'));router[_0xd121('0x7')]('/',auth[_0xd121('0x8')](),controller[_0xd121('0x9')]);router['get'](_0xd121('0xa'),auth[_0xd121('0x8')](),controller[_0xd121('0xb')]);router[_0xd121('0x7')](_0xd121('0xc'),auth[_0xd121('0x8')](),controller[_0xd121('0xd')]);router[_0xd121('0x7')]('/:id/members',auth['isAuthenticated'](),controller[_0xd121('0xe')]);router[_0xd121('0x7')]('/:id/teams',auth[_0xd121('0x8')](),controller['getTeams']);router[_0xd121('0x7')]('/:id/users',auth[_0xd121('0x8')](),controller['getAgents']);router['post']('/',auth[_0xd121('0x8')](),controller[_0xd121('0xf')]);router[_0xd121('0x10')](_0xd121('0x11'),auth[_0xd121('0x8')](),controller[_0xd121('0x12')]);router['post'](_0xd121('0x13'),auth[_0xd121('0x8')](),controller[_0xd121('0x14')]);router[_0xd121('0x15')](_0xd121('0xc'),auth['isAuthenticated'](),controller[_0xd121('0x16')]);router[_0xd121('0x17')](_0xd121('0xc'),auth[_0xd121('0x8')](),controller[_0xd121('0x18')]);router[_0xd121('0x17')](_0xd121('0x11'),auth[_0xd121('0x8')](),controller[_0xd121('0x19')]);router[_0xd121('0x17')](_0xd121('0x13'),auth['isAuthenticated'](),controller[_0xd121('0x1a')]);module[_0xd121('0x1b')]=router; \ No newline at end of file +var _0x3469=['removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','get','/:id/users','getAgents','create','addTeams','post','addAgents','put','update','delete','destroy','/:id/teams','removeTeams'];(function(_0x40c402,_0x42ee7d){var _0x4e7680=function(_0x52b150){while(--_0x52b150){_0x40c402['push'](_0x40c402['shift']());}};_0x4e7680(++_0x42ee7d);}(_0x3469,0x12e));var _0x9346=function(_0x2e2786,_0x2b5dba){_0x2e2786=_0x2e2786-0x0;var _0x382c4e=_0x3469[_0x2e2786];return _0x382c4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9346('0x0'));var timeout=require(_0x9346('0x1'));var express=require('express');var router=express[_0x9346('0x2')]();var fs_extra=require(_0x9346('0x3'));var auth=require(_0x9346('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x9346('0x5'));var controller=require(_0x9346('0x6'));router['get']('/',auth[_0x9346('0x7')](),controller[_0x9346('0x8')]);router['get'](_0x9346('0x9'),auth[_0x9346('0x7')](),controller[_0x9346('0xa')]);router['get'](_0x9346('0xb'),auth[_0x9346('0x7')](),controller[_0x9346('0xc')]);router['get'](_0x9346('0xd'),auth[_0x9346('0x7')](),controller[_0x9346('0xe')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x9346('0xf')](_0x9346('0x10'),auth[_0x9346('0x7')](),controller[_0x9346('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x9346('0x12')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x9346('0x13')]);router[_0x9346('0x14')](_0x9346('0x10'),auth[_0x9346('0x7')](),controller[_0x9346('0x15')]);router[_0x9346('0x16')](_0x9346('0xb'),auth['isAuthenticated'](),controller[_0x9346('0x17')]);router[_0x9346('0x18')](_0x9346('0xb'),auth[_0x9346('0x7')](),controller[_0x9346('0x19')]);router[_0x9346('0x18')](_0x9346('0x1a'),auth[_0x9346('0x7')](),controller[_0x9346('0x1b')]);router[_0x9346('0x18')]('/:id/users',auth[_0x9346('0x7')](),controller[_0x9346('0x1c')]);module[_0x9346('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 25b92c9..45af3f1 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 _0x62ca=['sequelize','exports','STRING','INTEGER','beepall','roundrobin'];(function(_0x8b4a7f,_0x494673){var _0x25820c=function(_0x58022e){while(--_0x58022e){_0x8b4a7f['push'](_0x8b4a7f['shift']());}};_0x25820c(++_0x494673);}(_0x62ca,0x108));var _0xa62c=function(_0x5ac4c5,_0x39d803){_0x5ac4c5=_0x5ac4c5-0x0;var _0x1a42ae=_0x62ca[_0x5ac4c5];return _0x1a42ae;};'use strict';var Sequelize=require(_0xa62c('0x0'));module[_0xa62c('0x1')]={'name':{'type':Sequelize[_0xa62c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xa62c('0x2')]},'timeout':{'type':Sequelize[_0xa62c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0xa62c('0x4'),_0xa62c('0x5'))}}; \ No newline at end of file +var _0x57d4=['STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','exports'];(function(_0x5dd0bf,_0x106b6d){var _0x69ec73=function(_0x5401c8){while(--_0x5401c8){_0x5dd0bf['push'](_0x5dd0bf['shift']());}};_0x69ec73(++_0x106b6d);}(_0x57d4,0xdf));var _0x457d=function(_0x3bb64e,_0x3d6afe){_0x3bb64e=_0x3bb64e-0x0;var _0x3ffdde=_0x57d4[_0x3bb64e];return _0x3ffdde;};'use strict';var Sequelize=require('sequelize');module[_0x457d('0x0')]={'name':{'type':Sequelize[_0x457d('0x1')],'unique':_0x457d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x457d('0x1')]},'timeout':{'type':Sequelize[_0x457d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x457d('0x4')](_0x457d('0x5'),_0x457d('0x6'),_0x457d('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 27302cb..29d9fe6 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 _0xb04a=['show','params','catch','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','update','getMembers','findOne','length','MailQueueId','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','createdAt','%s/%s','SIP','updatedAt','getTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','removeTeams','select','field','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','addAgents','omit','spread','userMailQueue:save','removeAgents','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./mailQueue.socket','sendStatus','status','json','offset','undefined','count','set','apply','save','then','destroy','get','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','where','filter','merge','options','includeAll','include','MailQueue','findAll','rows'];(function(_0x12f2a1,_0x2f9c7b){var _0x1fcbee=function(_0x3d2923){while(--_0x3d2923){_0x12f2a1['push'](_0x12f2a1['shift']());}};_0x1fcbee(++_0x2f9c7b);}(_0xb04a,0xcf));var _0xab04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb04a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xab04('0x0'));var rimraf=require(_0xab04('0x1'));var zipdir=require(_0xab04('0x2'));var jsonpatch=require(_0xab04('0x3'));var rp=require('request-promise');var moment=require(_0xab04('0x4'));var BPromise=require(_0xab04('0x5'));var Mustache=require(_0xab04('0x6'));var util=require('util');var path=require(_0xab04('0x7'));var sox=require(_0xab04('0x8'));var csv=require(_0xab04('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab04('0xa'));var _=require(_0xab04('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab04('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab04('0xd'));var authService=require(_0xab04('0xe'));var qs=require(_0xab04('0xf'));var as=require(_0xab04('0x10'));var hardwareService=require(_0xab04('0x11'));var logger=require(_0xab04('0x12'))(_0xab04('0x13'));var utils=require(_0xab04('0x14'));var config=require(_0xab04('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xab04('0x16')]=_[_0xab04('0x17')](config[_0xab04('0x16')],{'host':_0xab04('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab04('0x16')]));require(_0xab04('0x19'))['register'](socket);function respondWithStatusCode(_0x233a8d,_0x178595){_0x178595=_0x178595||0xcc;return function(_0x1acc57){if(_0x1acc57){return _0x233a8d[_0xab04('0x1a')](_0x178595);}return _0x233a8d[_0xab04('0x1b')](_0x178595)['end']();};}function respondWithResult(_0x3371ed,_0x1cc965){_0x1cc965=_0x1cc965||0xc8;return function(_0x3965d6){if(_0x3965d6){return _0x3371ed[_0xab04('0x1b')](_0x1cc965)[_0xab04('0x1c')](_0x3965d6);}};}function respondWithFilteredResult(_0x5d10f7,_0x47da0e){return function(_0x371c30){if(_0x371c30){var _0x278c93=typeof _0x47da0e[_0xab04('0x1d')]==='undefined'&&typeof _0x47da0e['limit']===_0xab04('0x1e');var _0x287011=_0x371c30[_0xab04('0x1f')];var _0x538056=_0x278c93?0x0:_0x47da0e[_0xab04('0x1d')];var _0x553ed5=_0x278c93?_0x371c30[_0xab04('0x1f')]:_0x47da0e[_0xab04('0x1d')]+_0x47da0e['limit'];var _0x4808ba;if(_0x553ed5>=_0x287011){_0x553ed5=_0x287011;_0x4808ba=0xc8;}else{_0x4808ba=0xce;}_0x5d10f7[_0xab04('0x1b')](_0x4808ba);return _0x5d10f7[_0xab04('0x20')]('Content-Range',_0x538056+'-'+_0x553ed5+'/'+_0x287011)[_0xab04('0x1c')](_0x371c30);}return null;};}function patchUpdates(_0x19d9cb){return function(_0x359c63){try{jsonpatch[_0xab04('0x21')](_0x359c63,_0x19d9cb,!![]);}catch(_0x3667fd){return BPromise['reject'](_0x3667fd);}return _0x359c63[_0xab04('0x22')]();};}function saveUpdates(_0x4df287,_0x1fced6){return function(_0x11a7d1){if(_0x11a7d1){return _0x11a7d1['update'](_0x4df287)[_0xab04('0x23')](function(_0x49b9bf){return _0x49b9bf;});}return null;};}function removeEntity(_0x59f287,_0x587620){return function(_0x75912d){if(_0x75912d){return _0x75912d[_0xab04('0x24')]()[_0xab04('0x23')](function(){var _0x9a1b1=_0x75912d[_0xab04('0x25')]({'plain':!![]});var _0x4a5124='MailQueues';return db[_0xab04('0x26')]['destroy']({'where':{'type':_0x4a5124,'resourceId':_0x9a1b1['id']}})[_0xab04('0x23')](function(){return _0x75912d;});})[_0xab04('0x23')](function(){_0x59f287[_0xab04('0x1b')](0xcc)[_0xab04('0x27')]();});}};}function handleEntityNotFound(_0x331aa9,_0x3c61bd){return function(_0x5d2d94){if(!_0x5d2d94){_0x331aa9[_0xab04('0x1a')](0x194);}return _0x5d2d94;};}function handleError(_0x36afb6,_0x5c8696){_0x5c8696=_0x5c8696||0x1f4;return function(_0x33ce1e){logger[_0xab04('0x28')](_0x33ce1e[_0xab04('0x29')]);if(_0x33ce1e[_0xab04('0x2a')]){delete _0x33ce1e[_0xab04('0x2a')];}_0x36afb6[_0xab04('0x1b')](_0x5c8696)['send'](_0x33ce1e);};}exports[_0xab04('0x2b')]=function(_0x4bff29,_0x1243f0){var _0xeab7c8={},_0x2324a3={},_0xc9819={'count':0x0,'rows':[]};var _0x543ebc=_[_0xab04('0x2c')](db['MailQueue'][_0xab04('0x2d')],function(_0x40e1b3){return{'name':_0x40e1b3[_0xab04('0x2e')],'type':_0x40e1b3[_0xab04('0x2f')][_0xab04('0x30')]};});_0x2324a3[_0xab04('0x31')]=_[_0xab04('0x2c')](_0x543ebc,'name');_0x2324a3['query']=_[_0xab04('0x32')](_0x4bff29[_0xab04('0x33')]);_0x2324a3[_0xab04('0x34')]=_['intersection'](_0x2324a3[_0xab04('0x31')],_0x2324a3[_0xab04('0x33')]);_0xeab7c8['attributes']=_[_0xab04('0x35')](_0x2324a3[_0xab04('0x31')],qs[_0xab04('0x36')](_0x4bff29[_0xab04('0x33')][_0xab04('0x36')]));_0xeab7c8['attributes']=_0xeab7c8[_0xab04('0x37')]['length']?_0xeab7c8['attributes']:_0x2324a3[_0xab04('0x31')];if(!_0x4bff29[_0xab04('0x33')][_0xab04('0x38')](_0xab04('0x39'))){_0xeab7c8['limit']=qs[_0xab04('0x3a')](_0x4bff29[_0xab04('0x33')]['limit']);_0xeab7c8[_0xab04('0x1d')]=qs[_0xab04('0x1d')](_0x4bff29['query'][_0xab04('0x1d')]);}_0xeab7c8[_0xab04('0x3b')]=qs[_0xab04('0x3c')](_0x4bff29['query'][_0xab04('0x3c')]);_0xeab7c8['where']=qs[_0xab04('0x34')](_[_0xab04('0x3d')](_0x4bff29[_0xab04('0x33')],_0x2324a3[_0xab04('0x34')]),_0x543ebc);if(_0x4bff29[_0xab04('0x33')]['filter']){_0xeab7c8[_0xab04('0x3e')]=_['merge'](_0xeab7c8[_0xab04('0x3e')],{'$or':_[_0xab04('0x2c')](_0x543ebc,function(_0x46ea60){if(_0x46ea60[_0xab04('0x2f')]!=='VIRTUAL'){var _0x154354={};_0x154354[_0x46ea60[_0xab04('0x2a')]]={'$like':'%'+_0x4bff29[_0xab04('0x33')][_0xab04('0x3f')]+'%'};return _0x154354;}})});}_0xeab7c8=_[_0xab04('0x40')]({},_0xeab7c8,_0x4bff29[_0xab04('0x41')]);var _0x298e14={'where':_0xeab7c8[_0xab04('0x3e')]};return db['MailQueue']['count'](_0x298e14)['then'](function(_0xa72dd2){_0xc9819[_0xab04('0x1f')]=_0xa72dd2;if(_0x4bff29[_0xab04('0x33')][_0xab04('0x42')]){_0xeab7c8[_0xab04('0x43')]=[{'all':!![]}];}return db[_0xab04('0x44')][_0xab04('0x45')](_0xeab7c8);})['then'](function(_0x1aad7c){_0xc9819[_0xab04('0x46')]=_0x1aad7c;return _0xc9819;})[_0xab04('0x23')](respondWithFilteredResult(_0x1243f0,_0xeab7c8))['catch'](handleError(_0x1243f0,null));};exports[_0xab04('0x47')]=function(_0x4d19d7,_0x1157f0){var _0x577f13={'raw':!![],'where':{'id':_0x4d19d7[_0xab04('0x48')]['id']}},_0x4fdb5a={};_0x4fdb5a[_0xab04('0x31')]=_[_0xab04('0x32')](db[_0xab04('0x44')][_0xab04('0x2d')]);_0x4fdb5a['query']=_[_0xab04('0x32')](_0x4d19d7[_0xab04('0x33')]);_0x4fdb5a[_0xab04('0x34')]=_[_0xab04('0x35')](_0x4fdb5a[_0xab04('0x31')],_0x4fdb5a['query']);_0x577f13[_0xab04('0x37')]=_[_0xab04('0x35')](_0x4fdb5a[_0xab04('0x31')],qs[_0xab04('0x36')](_0x4d19d7[_0xab04('0x33')][_0xab04('0x36')]));_0x577f13[_0xab04('0x37')]=_0x577f13[_0xab04('0x37')]['length']?_0x577f13['attributes']:_0x4fdb5a['model'];if(_0x4d19d7['query'][_0xab04('0x42')]){_0x577f13['include']=[{'all':!![]}];}_0x577f13=_['merge']({},_0x577f13,_0x4d19d7[_0xab04('0x41')]);return db[_0xab04('0x44')]['find'](_0x577f13)['then'](handleEntityNotFound(_0x1157f0,null))[_0xab04('0x23')](respondWithResult(_0x1157f0,null))[_0xab04('0x49')](handleError(_0x1157f0,null));};exports[_0xab04('0x4a')]=function(_0x43f4ee,_0x17bdc0){return db[_0xab04('0x44')]['create'](_0x43f4ee[_0xab04('0x4b')],{})[_0xab04('0x23')](function(_0x16c81e){var _0x2f18f0=_0x43f4ee['user'][_0xab04('0x25')]({'plain':!![]});if(!_0x2f18f0)throw new Error(_0xab04('0x4c'));if(_0x2f18f0[_0xab04('0x4d')]===_0xab04('0x4e')){var _0x5d6340=_0x16c81e[_0xab04('0x25')]({'plain':!![]});var _0x580ceb='MailQueues';return db[_0xab04('0x4f')][_0xab04('0x50')]({'where':{'name':_0x580ceb,'userProfileId':_0x2f18f0[_0xab04('0x51')]},'raw':!![]})[_0xab04('0x23')](function(_0x1aa5a0){if(_0x1aa5a0&&_0x1aa5a0[_0xab04('0x52')]===0x0){return db['UserProfileResource'][_0xab04('0x4a')]({'name':_0x5d6340['name'],'resourceId':_0x5d6340['id'],'type':_0x1aa5a0['name'],'sectionId':_0x1aa5a0['id']},{})['then'](function(){return _0x16c81e;});}else{return _0x16c81e;}})[_0xab04('0x49')](function(_0x16e6aa){logger[_0xab04('0x28')](_0xab04('0x53'),_0x16e6aa);throw _0x16e6aa;});}return _0x16c81e;})[_0xab04('0x23')](respondWithResult(_0x17bdc0,0xc9))[_0xab04('0x49')](handleError(_0x17bdc0,null));};exports[_0xab04('0x54')]=function(_0x55fdbf,_0x2385a7){if(_0x55fdbf[_0xab04('0x4b')]['id']){delete _0x55fdbf['body']['id'];}return db[_0xab04('0x44')][_0xab04('0x50')]({'where':{'id':_0x55fdbf[_0xab04('0x48')]['id']}})[_0xab04('0x23')](handleEntityNotFound(_0x2385a7,null))['then'](saveUpdates(_0x55fdbf[_0xab04('0x4b')],null))['then'](respondWithResult(_0x2385a7,null))['catch'](handleError(_0x2385a7,null));};exports['destroy']=function(_0x434bc5,_0x5d656a){return db[_0xab04('0x44')]['find']({'where':{'id':_0x434bc5[_0xab04('0x48')]['id']}})[_0xab04('0x23')](handleEntityNotFound(_0x5d656a,null))['then'](removeEntity(_0x5d656a,null))[_0xab04('0x49')](handleError(_0x5d656a,null));};exports['describe']=function(_0x4fdb4b,_0x2185c8){return db[_0xab04('0x44')]['describe']()[_0xab04('0x23')](respondWithResult(_0x2185c8,null))[_0xab04('0x49')](handleError(_0x2185c8,null));};exports[_0xab04('0x55')]=function(_0x49e041,_0x3baa10,_0x155b4d){var _0x165d6f={'raw':!![],'where':{}},_0x3517c5={},_0x2f344b;return db[_0xab04('0x44')][_0xab04('0x56')]({'where':{'id':_0x49e041[_0xab04('0x48')]['id']}})[_0xab04('0x23')](handleEntityNotFound(_0x3baa10,null))[_0xab04('0x23')](function(_0x54383c){if(_0x54383c){_0x2f344b=_0x54383c[_0xab04('0x25')]({'plain':!![]});_0x3517c5[_0xab04('0x31')]=_[_0xab04('0x32')](db['UserMailQueue'][_0xab04('0x2d')]);_0x3517c5[_0xab04('0x33')]=_[_0xab04('0x32')](_0x49e041['query']);_0x3517c5[_0xab04('0x34')]=_[_0xab04('0x35')](_0x3517c5[_0xab04('0x31')],_0x3517c5[_0xab04('0x33')]);_0x165d6f[_0xab04('0x37')]=_[_0xab04('0x35')](_0x3517c5[_0xab04('0x31')],qs[_0xab04('0x36')](_0x49e041[_0xab04('0x33')][_0xab04('0x36')]));_0x165d6f['attributes']=_0x165d6f['attributes'][_0xab04('0x57')]?_0x165d6f[_0xab04('0x37')]:_0x3517c5[_0xab04('0x31')];if(!_0x49e041[_0xab04('0x33')]['hasOwnProperty']('nolimit')){_0x165d6f[_0xab04('0x3a')]=qs[_0xab04('0x3a')](_0x49e041['query'][_0xab04('0x3a')]);_0x165d6f[_0xab04('0x1d')]=qs[_0xab04('0x1d')](_0x49e041[_0xab04('0x33')][_0xab04('0x1d')]);}_0x165d6f[_0xab04('0x3b')]=qs[_0xab04('0x3c')](_0x49e041['query'][_0xab04('0x3c')]);_0x165d6f[_0xab04('0x3e')]=qs[_0xab04('0x34')](_[_0xab04('0x3d')](_0x49e041['query'],_0x3517c5[_0xab04('0x34')]));_0x165d6f['where'][_0xab04('0x58')]=_0x54383c['id'];if(_0x49e041[_0xab04('0x33')][_0xab04('0x3f')]){_0x165d6f['where']=_[_0xab04('0x40')](_0x165d6f['where'],{'$or':_[_0xab04('0x2c')](_0x165d6f[_0xab04('0x37')],function(_0x3d9101){var _0x4a86c0={};_0x4a86c0[_0x3d9101]={'$like':'%'+_0x49e041[_0xab04('0x33')][_0xab04('0x3f')]+'%'};return _0x4a86c0;})});}_0x165d6f=_[_0xab04('0x40')]({},_0x165d6f,_0x49e041[_0xab04('0x41')]);return db[_0xab04('0x59')][_0xab04('0x45')](_0x165d6f);}})[_0xab04('0x23')](function(_0x12286d){if(_0x12286d){return db[_0xab04('0x5a')][_0xab04('0x5b')]({'where':{'id':_[_0xab04('0x2c')](_0x12286d,_0xab04('0x5c')),'role':_0xab04('0x5d')},'attributes':['id',_0xab04('0x2a'),_0xab04('0x5e'),'updatedAt',_0xab04('0x5f')]});}})['then'](function(_0x393098){if(_0x393098){return{'count':_0x393098[_0xab04('0x1f')],'rows':_[_0xab04('0x2c')](_0x393098[_0xab04('0x46')],function(_0x332194){return{'membername':_0x332194[_0xab04('0x2a')],'UserId':_0x332194['id'],'queue_name':_0x2f344b['name'],'MailQueueId':_0x2f344b['id'],'interface':util['format'](_0xab04('0x60'),_0xab04('0x61'),_0x332194[_0xab04('0x2a')]),'penalty':0x0,'paused':_0x332194[_0xab04('0x5e')],'createdAt':_0x332194[_0xab04('0x5f')],'updatedAt':_0x332194[_0xab04('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xab04('0x23')](respondWithFilteredResult(_0x3baa10,_0x165d6f))[_0xab04('0x49')](handleError(_0x3baa10,null));};exports[_0xab04('0x63')]=function(_0x2edfa7,_0x413c20,_0x20d0be){var _0x28e6ea={};var _0x4297dc={};var _0xa67762;var _0x5264d9;return db['MailQueue'][_0xab04('0x56')]({'where':{'id':_0x2edfa7[_0xab04('0x48')]['id']}})['then'](handleEntityNotFound(_0x413c20,null))[_0xab04('0x23')](function(_0x2ef918){if(_0x2ef918){_0xa67762=_0x2ef918;_0x4297dc[_0xab04('0x31')]=_[_0xab04('0x32')](db['Team']['rawAttributes']);_0x4297dc[_0xab04('0x33')]=_['keys'](_0x2edfa7[_0xab04('0x33')]);_0x4297dc[_0xab04('0x34')]=_[_0xab04('0x35')](_0x4297dc[_0xab04('0x31')],_0x4297dc[_0xab04('0x33')]);_0x28e6ea[_0xab04('0x37')]=_[_0xab04('0x35')](_0x4297dc[_0xab04('0x31')],qs['fields'](_0x2edfa7[_0xab04('0x33')][_0xab04('0x36')]));_0x28e6ea[_0xab04('0x37')]=_0x28e6ea['attributes'][_0xab04('0x57')]?_0x28e6ea[_0xab04('0x37')]:_0x4297dc[_0xab04('0x31')];_0x28e6ea[_0xab04('0x3b')]=qs['sort'](_0x2edfa7[_0xab04('0x33')][_0xab04('0x3c')]);_0x28e6ea[_0xab04('0x3e')]=qs[_0xab04('0x34')](_[_0xab04('0x3d')](_0x2edfa7[_0xab04('0x33')],_0x4297dc[_0xab04('0x34')]));if(_0x2edfa7[_0xab04('0x33')][_0xab04('0x3f')]){_0x28e6ea[_0xab04('0x3e')]=_[_0xab04('0x40')](_0x28e6ea[_0xab04('0x3e')],{'$or':_[_0xab04('0x2c')](_0x28e6ea['attributes'],function(_0x36528c){var _0x3b938f={};_0x3b938f[_0x36528c]={'$like':'%'+_0x2edfa7[_0xab04('0x33')][_0xab04('0x3f')]+'%'};return _0x3b938f;})});}_0x28e6ea=_['merge']({},_0x28e6ea,_0x2edfa7[_0xab04('0x41')]);return _0xa67762[_0xab04('0x63')](_0x28e6ea);}})[_0xab04('0x23')](function(_0x7a7f9a){if(_0x7a7f9a){_0x5264d9=_0x7a7f9a[_0xab04('0x57')];if(!_0x2edfa7[_0xab04('0x33')]['hasOwnProperty'](_0xab04('0x39'))){_0x28e6ea[_0xab04('0x3a')]=qs[_0xab04('0x3a')](_0x2edfa7['query'][_0xab04('0x3a')]);_0x28e6ea[_0xab04('0x1d')]=qs[_0xab04('0x1d')](_0x2edfa7['query'][_0xab04('0x1d')]);}return _0xa67762['getTeams'](_0x28e6ea);}})[_0xab04('0x23')](function(_0x3bbe07){if(_0x3bbe07){return _0x3bbe07?{'count':_0x5264d9,'rows':_0x3bbe07}:null;}})[_0xab04('0x23')](respondWithResult(_0x413c20,null))[_0xab04('0x49')](handleError(_0x413c20,null));};exports['addTeams']=function(_0x306d8c,_0x2a43e7,_0xf6d823){var _0x2737ff=_0x306d8c[_0xab04('0x4b')][_0xab04('0x64')];return db[_0xab04('0x65')]['findAll']({'where':{'id':_0x2737ff},'attributes':['id'],'include':[{'model':db['User'],'as':_0xab04('0x66'),'attributes':['id',_0xab04('0x2a'),'online',_0xab04('0x67'),_0xab04('0x68')],'raw':!![]}]})[_0xab04('0x23')](function(_0x21ce2a){if(_0x21ce2a){var _0x30936a=_[_0xab04('0x69')](_0x21ce2a,function(_0x2c5833){var _0x2f4d5d=_0x2c5833[_0xab04('0x25')]({'plain':!![]});return _0x2f4d5d[_0xab04('0x66')];});return db[_0xab04('0x44')][_0xab04('0x50')]({'where':{'id':_0x306d8c[_0xab04('0x48')]['id']}})[_0xab04('0x23')](function(_0x1dab95){return db[_0xab04('0x6a')][_0xab04('0x6b')](function(_0xaf467b){return _0x1dab95[_0xab04('0x6c')](_0x2737ff,{'transaction':_0xaf467b})['then'](function(){return BPromise[_0xab04('0x6d')](_0x30936a,function(_0x36076f){return db[_0xab04('0x59')][_0xab04('0x6e')]({'where':{'UserId':_0x36076f['id'],'MailQueueId':_0x306d8c[_0xab04('0x48')]['id']},'transaction':_0xaf467b});});})[_0xab04('0x23')](function(){_0x30936a[_0xab04('0x6f')](function(_0x168090){socket[_0xab04('0x70')]('userMailQueue:save',{'UserId':_0x168090['id'],'MailQueueId':_0x1dab95['id']});});});});});}})[_0xab04('0x23')](respondWithStatusCode(_0x2a43e7,null))[_0xab04('0x49')](handleError(_0x2a43e7,null));};exports[_0xab04('0x71')]=function(_0xea68a3,_0x106eff,_0x19e359){return db['Team'][_0xab04('0x45')]({'where':{'id':_0xea68a3[_0xab04('0x33')][_0xab04('0x64')]},'attributes':['id'],'include':[{'model':db[_0xab04('0x5a')],'as':_0xab04('0x66'),'attributes':['id'],'raw':!![]}]})[_0xab04('0x23')](handleEntityNotFound(_0x106eff,null))[_0xab04('0x23')](function(_0x1b6888){var _0x46fa8c=_[_0xab04('0x2c')](_0x1b6888,'id');var _0x45b06e=[];var _0x21956a=[];var _0x4fa02f=squel[_0xab04('0x72')]();_0x4fa02f[_0xab04('0x73')](_0xab04('0x74'))[_0xab04('0x75')]('team_has_mail_queues','tq')[_0xab04('0x76')]('user_has_teams','ut',_0xab04('0x77'))[_0xab04('0x3e')]('MailQueueId\x20=\x20?',_0xea68a3[_0xab04('0x48')]['id']);for(var _0xd9899d=0x0;_0xd9899d<_0x1b6888[_0xab04('0x57')];_0xd9899d+=0x1){let _0x4e0760=_0x1b6888[_0xd9899d];for(var _0x411bf4=0x0;_0x411bf4<_0x4e0760[_0xab04('0x66')][_0xab04('0x57')];_0x411bf4+=0x1){let _0x1c124a=_0x4e0760['Agents'][_0x411bf4];var _0x4ff7af=_0x4fa02f[_0xab04('0x78')]();_0x4ff7af['where'](_0xab04('0x79'),_0x1c124a['id']);_0x21956a['push'](db['sequelize']['query'](_0x4ff7af[_0xab04('0x7a')](),{'type':db['sequelize']['QueryTypes'][_0xab04('0x7b')]})[_0xab04('0x23')](function(_0x3b118b){if(_0x3b118b['length']===0x1){return _0x1c124a['id'];}else{var _0x5a5703=_[_0xab04('0x7c')](_[_0xab04('0x2c')](_0x3b118b,_0xab04('0x7d')),function(_0x4b6322){return _['includes'](_0x46fa8c,_0x4b6322);});if(_0x5a5703){return _0x1c124a['id'];}}}));}}return BPromise[_0xab04('0x7e')](_0x21956a)[_0xab04('0x23')](function(_0x406069){_0x45b06e=_(_0x45b06e)[_0xab04('0x7f')](_0x406069)[_0xab04('0x80')]()[_0xab04('0x81')]();return db[_0xab04('0x44')][_0xab04('0x50')]({'where':{'id':_0xea68a3[_0xab04('0x48')]['id']}})[_0xab04('0x23')](function(_0x5747cf){return db[_0xab04('0x6a')][_0xab04('0x6b')](function(_0x1a673a){return _0x5747cf[_0xab04('0x71')](_0xea68a3['query'][_0xab04('0x64')],{'transaction':_0x1a673a})[_0xab04('0x23')](function(){if(!_[_0xab04('0x82')](_0x45b06e)){return _0x5747cf['removeAgents'](_0x45b06e,{'transaction':_0x1a673a});}})[_0xab04('0x23')](function(){_0x45b06e[_0xab04('0x6f')](function(_0x57664a){socket[_0xab04('0x70')]('userMailQueue:remove',{'UserId':_0x57664a,'MailQueueId':_0x5747cf['id']});});});});});});})[_0xab04('0x23')](respondWithStatusCode(_0x106eff,null))[_0xab04('0x49')](handleError(_0x106eff,null));};exports[_0xab04('0x83')]=function(_0x967752,_0x4ea158,_0x48a4c0){return db[_0xab04('0x44')][_0xab04('0x50')]({'where':{'id':_0x967752['params']['id']}})[_0xab04('0x23')](handleEntityNotFound(_0x4ea158,null))['then'](function(_0x263d32){if(_0x263d32){return _0x263d32[_0xab04('0x83')](_0x967752[_0xab04('0x4b')]['ids'],_[_0xab04('0x84')](_0x967752[_0xab04('0x4b')],[_0xab04('0x64'),'id'])||{})[_0xab04('0x85')](function(_0x524144){for(var _0x3bd8a6=0x0;_0x3bd8a6<_0x967752['body'][_0xab04('0x64')][_0xab04('0x57')];_0x3bd8a6+=0x1){socket[_0xab04('0x70')](_0xab04('0x86'),{'UserId':Number(_0x967752[_0xab04('0x4b')][_0xab04('0x64')][_0x3bd8a6]),'MailQueueId':Number(_0x967752[_0xab04('0x48')]['id'])});}return _0x524144;});}})[_0xab04('0x23')](respondWithResult(_0x4ea158,null))[_0xab04('0x49')](handleError(_0x4ea158,null));};exports['removeAgents']=function(_0x49308c,_0x1b195d,_0x581be1){return db[_0xab04('0x44')][_0xab04('0x50')]({'where':{'id':_0x49308c['params']['id']}})[_0xab04('0x23')](handleEntityNotFound(_0x1b195d,null))[_0xab04('0x23')](function(_0x4c2267){if(_0x4c2267){return _0x4c2267[_0xab04('0x87')](_0x49308c[_0xab04('0x33')][_0xab04('0x64')])[_0xab04('0x23')](function(){if(_[_0xab04('0x88')](_0x49308c[_0xab04('0x33')][_0xab04('0x64')])){for(var _0x62ed4b=0x0;_0x62ed4b<_0x49308c['query'][_0xab04('0x64')][_0xab04('0x57')];_0x62ed4b+=0x1){socket[_0xab04('0x70')](_0xab04('0x89'),{'UserId':Number(_0x49308c[_0xab04('0x33')][_0xab04('0x64')][_0x62ed4b]),'MailQueueId':Number(_0x49308c[_0xab04('0x48')]['id'])});}}else{socket[_0xab04('0x70')](_0xab04('0x89'),{'UserId':Number(_0x49308c[_0xab04('0x33')][_0xab04('0x64')]),'MailQueueId':Number(_0x49308c[_0xab04('0x48')]['id'])});}});}})[_0xab04('0x23')](respondWithStatusCode(_0x1b195d,null))[_0xab04('0x49')](handleError(_0x1b195d,null));};exports[_0xab04('0x8a')]=function(_0x60a7cc,_0x286396,_0x303c63){var _0x49b29e={};var _0x42f330={};var _0x41f9ba;var _0x2257b9;return db['MailQueue'][_0xab04('0x56')]({'where':{'id':_0x60a7cc[_0xab04('0x48')]['id']}})[_0xab04('0x23')](handleEntityNotFound(_0x286396,null))[_0xab04('0x23')](function(_0x219bd2){if(_0x219bd2){_0x41f9ba=_0x219bd2;_0x42f330[_0xab04('0x31')]=_[_0xab04('0x32')](db[_0xab04('0x5a')][_0xab04('0x2d')]);_0x42f330[_0xab04('0x33')]=_[_0xab04('0x32')](_0x60a7cc[_0xab04('0x33')]);_0x42f330[_0xab04('0x34')]=_[_0xab04('0x35')](_0x42f330['model'],_0x42f330[_0xab04('0x33')]);_0x49b29e[_0xab04('0x37')]=_[_0xab04('0x35')](_0x42f330[_0xab04('0x31')],qs[_0xab04('0x36')](_0x60a7cc[_0xab04('0x33')]['fields']));_0x49b29e[_0xab04('0x37')]=_0x49b29e[_0xab04('0x37')][_0xab04('0x57')]?_0x49b29e[_0xab04('0x37')]:_0x42f330[_0xab04('0x31')];_0x49b29e[_0xab04('0x3b')]=qs['sort'](_0x60a7cc[_0xab04('0x33')][_0xab04('0x3c')]);_0x49b29e['where']=qs[_0xab04('0x34')](_[_0xab04('0x3d')](_0x60a7cc[_0xab04('0x33')],_0x42f330[_0xab04('0x34')]));if(_0x60a7cc['query'][_0xab04('0x3f')]){_0x49b29e['where']=_[_0xab04('0x40')](_0x49b29e[_0xab04('0x3e')],{'$or':_['map'](_0x49b29e[_0xab04('0x37')],function(_0x5783fd){var _0x5d370e={};_0x5d370e[_0x5783fd]={'$like':'%'+_0x60a7cc['query'][_0xab04('0x3f')]+'%'};return _0x5d370e;})});}_0x49b29e=_['merge']({},_0x49b29e,_0x60a7cc[_0xab04('0x41')]);return _0x41f9ba[_0xab04('0x8a')](_0x49b29e);}})[_0xab04('0x23')](function(_0x38328e){if(_0x38328e){_0x2257b9=_0x38328e[_0xab04('0x57')];if(!_0x60a7cc[_0xab04('0x33')][_0xab04('0x38')](_0xab04('0x39'))){_0x49b29e[_0xab04('0x3a')]=qs[_0xab04('0x3a')](_0x60a7cc[_0xab04('0x33')][_0xab04('0x3a')]);_0x49b29e[_0xab04('0x1d')]=qs['offset'](_0x60a7cc['query'][_0xab04('0x1d')]);}return _0x41f9ba[_0xab04('0x8a')](_0x49b29e);}})[_0xab04('0x23')](function(_0x4fda59){if(_0x4fda59){return _0x4fda59?{'count':_0x2257b9,'rows':_0x4fda59}:null;}})[_0xab04('0x23')](respondWithResult(_0x286396,null))['catch'](handleError(_0x286396,null));}; \ No newline at end of file +var _0x5c88=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','destroy','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','options','findAll','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','flatMap','transaction','addTeams','each','forEach','emit','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','userMailQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','socket.io-emitter','register','sendStatus','status','json','offset','limit','count','apply','reject','save','update','then','get','MailQueues','UserProfileResource','end','error','stack','name','index','MailQueue','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','rows','catch','show','params','rawAttributes','create','body'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x5c88,0x158));var _0x85c8=function(_0xb3021,_0x322e35){_0xb3021=_0xb3021-0x0;var _0x523049=_0x5c88[_0xb3021];return _0x523049;};'use strict';var emlformat=require(_0x85c8('0x0'));var rimraf=require(_0x85c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x85c8('0x2'));var rp=require(_0x85c8('0x3'));var moment=require(_0x85c8('0x4'));var BPromise=require(_0x85c8('0x5'));var Mustache=require(_0x85c8('0x6'));var util=require(_0x85c8('0x7'));var path=require(_0x85c8('0x8'));var sox=require('sox');var csv=require(_0x85c8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x85c8('0xa'));var _=require(_0x85c8('0xb'));var squel=require(_0x85c8('0xc'));var crypto=require(_0x85c8('0xd'));var jsforce=require(_0x85c8('0xe'));var deskjs=require(_0x85c8('0xf'));var toCsv=require(_0x85c8('0x9'));var querystring=require('querystring');var Papa=require(_0x85c8('0x10'));var Redis=require(_0x85c8('0x11'));var authService=require(_0x85c8('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x85c8('0x13'));var logger=require(_0x85c8('0x14'))(_0x85c8('0x15'));var utils=require(_0x85c8('0x16'));var config=require(_0x85c8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x85c8('0x18')]=_['defaults'](config[_0x85c8('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x85c8('0x19'))(new Redis(config[_0x85c8('0x18')]));require('./mailQueue.socket')[_0x85c8('0x1a')](socket);function respondWithStatusCode(_0x2cc2c5,_0x837683){_0x837683=_0x837683||0xcc;return function(_0xd6d268){if(_0xd6d268){return _0x2cc2c5[_0x85c8('0x1b')](_0x837683);}return _0x2cc2c5[_0x85c8('0x1c')](_0x837683)['end']();};}function respondWithResult(_0x5589e3,_0xf4f52){_0xf4f52=_0xf4f52||0xc8;return function(_0x3274c9){if(_0x3274c9){return _0x5589e3[_0x85c8('0x1c')](_0xf4f52)[_0x85c8('0x1d')](_0x3274c9);}};}function respondWithFilteredResult(_0x4fd785,_0x21b21d){return function(_0x1b310f){if(_0x1b310f){var _0x400dc0=typeof _0x21b21d[_0x85c8('0x1e')]==='undefined'&&typeof _0x21b21d[_0x85c8('0x1f')]==='undefined';var _0x309844=_0x1b310f[_0x85c8('0x20')];var _0x174490=_0x400dc0?0x0:_0x21b21d[_0x85c8('0x1e')];var _0x13cdc9=_0x400dc0?_0x1b310f[_0x85c8('0x20')]:_0x21b21d[_0x85c8('0x1e')]+_0x21b21d[_0x85c8('0x1f')];var _0x1ed835;if(_0x13cdc9>=_0x309844){_0x13cdc9=_0x309844;_0x1ed835=0xc8;}else{_0x1ed835=0xce;}_0x4fd785[_0x85c8('0x1c')](_0x1ed835);return _0x4fd785['set']('Content-Range',_0x174490+'-'+_0x13cdc9+'/'+_0x309844)[_0x85c8('0x1d')](_0x1b310f);}return null;};}function patchUpdates(_0x57c869){return function(_0x44049b){try{jsonpatch[_0x85c8('0x21')](_0x44049b,_0x57c869,!![]);}catch(_0x59fe7e){return BPromise[_0x85c8('0x22')](_0x59fe7e);}return _0x44049b[_0x85c8('0x23')]();};}function saveUpdates(_0x39c28c,_0x4964df){return function(_0x4a9a59){if(_0x4a9a59){return _0x4a9a59[_0x85c8('0x24')](_0x39c28c)['then'](function(_0x4a4cef){return _0x4a4cef;});}return null;};}function removeEntity(_0x230daf,_0x1af388){return function(_0x33a16f){if(_0x33a16f){return _0x33a16f['destroy']()[_0x85c8('0x25')](function(){var _0x1bec22=_0x33a16f[_0x85c8('0x26')]({'plain':!![]});var _0x29a615=_0x85c8('0x27');return db[_0x85c8('0x28')]['destroy']({'where':{'type':_0x29a615,'resourceId':_0x1bec22['id']}})[_0x85c8('0x25')](function(){return _0x33a16f;});})[_0x85c8('0x25')](function(){_0x230daf[_0x85c8('0x1c')](0xcc)[_0x85c8('0x29')]();});}};}function handleEntityNotFound(_0x420168,_0x1b91e3){return function(_0x2646e2){if(!_0x2646e2){_0x420168[_0x85c8('0x1b')](0x194);}return _0x2646e2;};}function handleError(_0x5e7ace,_0x3f56b3){_0x3f56b3=_0x3f56b3||0x1f4;return function(_0x3865fd){logger[_0x85c8('0x2a')](_0x3865fd[_0x85c8('0x2b')]);if(_0x3865fd['name']){delete _0x3865fd[_0x85c8('0x2c')];}_0x5e7ace[_0x85c8('0x1c')](_0x3f56b3)['send'](_0x3865fd);};}exports[_0x85c8('0x2d')]=function(_0x13aa83,_0x569730){var _0x33a19e={},_0x2ea875={},_0x539838={'count':0x0,'rows':[]};var _0x497997=_['map'](db[_0x85c8('0x2e')]['rawAttributes'],function(_0x14ae7d){return{'name':_0x14ae7d[_0x85c8('0x2f')],'type':_0x14ae7d[_0x85c8('0x30')][_0x85c8('0x31')]};});_0x2ea875['model']=_['map'](_0x497997,_0x85c8('0x2c'));_0x2ea875[_0x85c8('0x32')]=_[_0x85c8('0x33')](_0x13aa83[_0x85c8('0x32')]);_0x2ea875[_0x85c8('0x34')]=_[_0x85c8('0x35')](_0x2ea875['model'],_0x2ea875[_0x85c8('0x32')]);_0x33a19e[_0x85c8('0x36')]=_['intersection'](_0x2ea875[_0x85c8('0x37')],qs[_0x85c8('0x38')](_0x13aa83[_0x85c8('0x32')][_0x85c8('0x38')]));_0x33a19e[_0x85c8('0x36')]=_0x33a19e[_0x85c8('0x36')][_0x85c8('0x39')]?_0x33a19e[_0x85c8('0x36')]:_0x2ea875[_0x85c8('0x37')];if(!_0x13aa83[_0x85c8('0x32')]['hasOwnProperty'](_0x85c8('0x3a'))){_0x33a19e['limit']=qs[_0x85c8('0x1f')](_0x13aa83[_0x85c8('0x32')][_0x85c8('0x1f')]);_0x33a19e[_0x85c8('0x1e')]=qs['offset'](_0x13aa83['query'][_0x85c8('0x1e')]);}_0x33a19e[_0x85c8('0x3b')]=qs[_0x85c8('0x3c')](_0x13aa83[_0x85c8('0x32')][_0x85c8('0x3c')]);_0x33a19e[_0x85c8('0x3d')]=qs[_0x85c8('0x34')](_[_0x85c8('0x3e')](_0x13aa83[_0x85c8('0x32')],_0x2ea875['filters']),_0x497997);if(_0x13aa83[_0x85c8('0x32')][_0x85c8('0x3f')]){_0x33a19e[_0x85c8('0x3d')]=_['merge'](_0x33a19e['where'],{'$or':_[_0x85c8('0x40')](_0x497997,function(_0x28a3a1){if(_0x28a3a1[_0x85c8('0x30')]!==_0x85c8('0x41')){var _0x1a8359={};_0x1a8359[_0x28a3a1[_0x85c8('0x2c')]]={'$like':'%'+_0x13aa83[_0x85c8('0x32')]['filter']+'%'};return _0x1a8359;}})});}_0x33a19e=_[_0x85c8('0x42')]({},_0x33a19e,_0x13aa83['options']);var _0x153306={'where':_0x33a19e[_0x85c8('0x3d')]};return db[_0x85c8('0x2e')][_0x85c8('0x20')](_0x153306)[_0x85c8('0x25')](function(_0x36aad2){_0x539838[_0x85c8('0x20')]=_0x36aad2;if(_0x13aa83[_0x85c8('0x32')][_0x85c8('0x43')]){_0x33a19e[_0x85c8('0x44')]=[{'all':!![]}];}return db[_0x85c8('0x2e')]['findAll'](_0x33a19e);})[_0x85c8('0x25')](function(_0x58e762){_0x539838[_0x85c8('0x45')]=_0x58e762;return _0x539838;})[_0x85c8('0x25')](respondWithFilteredResult(_0x569730,_0x33a19e))[_0x85c8('0x46')](handleError(_0x569730,null));};exports[_0x85c8('0x47')]=function(_0x387ea8,_0x4aad33){var _0x1d929e={'raw':!![],'where':{'id':_0x387ea8[_0x85c8('0x48')]['id']}},_0x39ee4d={};_0x39ee4d[_0x85c8('0x37')]=_[_0x85c8('0x33')](db[_0x85c8('0x2e')][_0x85c8('0x49')]);_0x39ee4d['query']=_['keys'](_0x387ea8[_0x85c8('0x32')]);_0x39ee4d[_0x85c8('0x34')]=_[_0x85c8('0x35')](_0x39ee4d['model'],_0x39ee4d[_0x85c8('0x32')]);_0x1d929e[_0x85c8('0x36')]=_['intersection'](_0x39ee4d[_0x85c8('0x37')],qs[_0x85c8('0x38')](_0x387ea8[_0x85c8('0x32')]['fields']));_0x1d929e[_0x85c8('0x36')]=_0x1d929e[_0x85c8('0x36')][_0x85c8('0x39')]?_0x1d929e[_0x85c8('0x36')]:_0x39ee4d[_0x85c8('0x37')];if(_0x387ea8[_0x85c8('0x32')]['includeAll']){_0x1d929e[_0x85c8('0x44')]=[{'all':!![]}];}_0x1d929e=_[_0x85c8('0x42')]({},_0x1d929e,_0x387ea8['options']);return db[_0x85c8('0x2e')]['find'](_0x1d929e)['then'](handleEntityNotFound(_0x4aad33,null))[_0x85c8('0x25')](respondWithResult(_0x4aad33,null))['catch'](handleError(_0x4aad33,null));};exports[_0x85c8('0x4a')]=function(_0x1065ed,_0x10fd83){return db[_0x85c8('0x2e')][_0x85c8('0x4a')](_0x1065ed[_0x85c8('0x4b')],{})[_0x85c8('0x25')](function(_0x119a7b){var _0x47f96f=_0x1065ed[_0x85c8('0x4c')][_0x85c8('0x26')]({'plain':!![]});if(!_0x47f96f)throw new Error(_0x85c8('0x4d'));if(_0x47f96f[_0x85c8('0x4e')]==='user'){var _0x10d552=_0x119a7b[_0x85c8('0x26')]({'plain':!![]});var _0x3d11e9=_0x85c8('0x27');return db['UserProfileSection'][_0x85c8('0x4f')]({'where':{'name':_0x3d11e9,'userProfileId':_0x47f96f[_0x85c8('0x50')]},'raw':!![]})[_0x85c8('0x25')](function(_0x2d4c06){if(_0x2d4c06&&_0x2d4c06[_0x85c8('0x51')]===0x0){return db[_0x85c8('0x28')][_0x85c8('0x4a')]({'name':_0x10d552[_0x85c8('0x2c')],'resourceId':_0x10d552['id'],'type':_0x2d4c06['name'],'sectionId':_0x2d4c06['id']},{})['then'](function(){return _0x119a7b;});}else{return _0x119a7b;}})[_0x85c8('0x46')](function(_0x3788c9){logger[_0x85c8('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3788c9);throw _0x3788c9;});}return _0x119a7b;})[_0x85c8('0x25')](respondWithResult(_0x10fd83,0xc9))[_0x85c8('0x46')](handleError(_0x10fd83,null));};exports['update']=function(_0x2c19eb,_0x503247){if(_0x2c19eb[_0x85c8('0x4b')]['id']){delete _0x2c19eb[_0x85c8('0x4b')]['id'];}return db[_0x85c8('0x2e')][_0x85c8('0x4f')]({'where':{'id':_0x2c19eb[_0x85c8('0x48')]['id']}})[_0x85c8('0x25')](handleEntityNotFound(_0x503247,null))[_0x85c8('0x25')](saveUpdates(_0x2c19eb['body'],null))[_0x85c8('0x25')](respondWithResult(_0x503247,null))[_0x85c8('0x46')](handleError(_0x503247,null));};exports[_0x85c8('0x52')]=function(_0x2cdf30,_0x3e7f43){return db['MailQueue'][_0x85c8('0x4f')]({'where':{'id':_0x2cdf30['params']['id']}})[_0x85c8('0x25')](handleEntityNotFound(_0x3e7f43,null))[_0x85c8('0x25')](removeEntity(_0x3e7f43,null))[_0x85c8('0x46')](handleError(_0x3e7f43,null));};exports[_0x85c8('0x53')]=function(_0xc10da2,_0xf7eaa4){return db[_0x85c8('0x2e')][_0x85c8('0x53')]()[_0x85c8('0x25')](respondWithResult(_0xf7eaa4,null))['catch'](handleError(_0xf7eaa4,null));};exports[_0x85c8('0x54')]=function(_0x4a0050,_0x2b7218,_0x28a50d){var _0x2875c9={'raw':!![],'where':{}},_0x4eb8da={},_0x307932;return db['MailQueue'][_0x85c8('0x55')]({'where':{'id':_0x4a0050[_0x85c8('0x48')]['id']}})['then'](handleEntityNotFound(_0x2b7218,null))[_0x85c8('0x25')](function(_0x5aba26){if(_0x5aba26){_0x307932=_0x5aba26[_0x85c8('0x26')]({'plain':!![]});_0x4eb8da['model']=_[_0x85c8('0x33')](db[_0x85c8('0x56')][_0x85c8('0x49')]);_0x4eb8da[_0x85c8('0x32')]=_[_0x85c8('0x33')](_0x4a0050[_0x85c8('0x32')]);_0x4eb8da[_0x85c8('0x34')]=_[_0x85c8('0x35')](_0x4eb8da[_0x85c8('0x37')],_0x4eb8da[_0x85c8('0x32')]);_0x2875c9[_0x85c8('0x36')]=_[_0x85c8('0x35')](_0x4eb8da[_0x85c8('0x37')],qs[_0x85c8('0x38')](_0x4a0050[_0x85c8('0x32')]['fields']));_0x2875c9['attributes']=_0x2875c9[_0x85c8('0x36')][_0x85c8('0x39')]?_0x2875c9['attributes']:_0x4eb8da[_0x85c8('0x37')];if(!_0x4a0050['query'][_0x85c8('0x57')](_0x85c8('0x3a'))){_0x2875c9[_0x85c8('0x1f')]=qs['limit'](_0x4a0050[_0x85c8('0x32')]['limit']);_0x2875c9[_0x85c8('0x1e')]=qs[_0x85c8('0x1e')](_0x4a0050[_0x85c8('0x32')][_0x85c8('0x1e')]);}_0x2875c9[_0x85c8('0x3b')]=qs['sort'](_0x4a0050[_0x85c8('0x32')][_0x85c8('0x3c')]);_0x2875c9[_0x85c8('0x3d')]=qs['filters'](_['pick'](_0x4a0050[_0x85c8('0x32')],_0x4eb8da[_0x85c8('0x34')]));_0x2875c9[_0x85c8('0x3d')]['MailQueueId']=_0x5aba26['id'];if(_0x4a0050[_0x85c8('0x32')][_0x85c8('0x3f')]){_0x2875c9[_0x85c8('0x3d')]=_[_0x85c8('0x42')](_0x2875c9[_0x85c8('0x3d')],{'$or':_[_0x85c8('0x40')](_0x2875c9['attributes'],function(_0x4727b3){var _0xdef809={};_0xdef809[_0x4727b3]={'$like':'%'+_0x4a0050[_0x85c8('0x32')][_0x85c8('0x3f')]+'%'};return _0xdef809;})});}_0x2875c9=_['merge']({},_0x2875c9,_0x4a0050[_0x85c8('0x58')]);return db['UserMailQueue'][_0x85c8('0x59')](_0x2875c9);}})[_0x85c8('0x25')](function(_0x4f766d){if(_0x4f766d){return db[_0x85c8('0x5a')][_0x85c8('0x5b')]({'where':{'id':_[_0x85c8('0x40')](_0x4f766d,'UserId'),'role':_0x85c8('0x5c')},'attributes':['id',_0x85c8('0x2c'),_0x85c8('0x5d'),_0x85c8('0x5e'),_0x85c8('0x5f')]});}})[_0x85c8('0x25')](function(_0x5caa36){if(_0x5caa36){return{'count':_0x5caa36['count'],'rows':_[_0x85c8('0x40')](_0x5caa36['rows'],function(_0x285592){return{'membername':_0x285592[_0x85c8('0x2c')],'UserId':_0x285592['id'],'queue_name':_0x307932[_0x85c8('0x2c')],'MailQueueId':_0x307932['id'],'interface':util['format'](_0x85c8('0x60'),_0x85c8('0x61'),_0x285592[_0x85c8('0x2c')]),'penalty':0x0,'paused':_0x285592['mailPause'],'createdAt':_0x285592[_0x85c8('0x5f')],'updatedAt':_0x285592[_0x85c8('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x85c8('0x25')](respondWithFilteredResult(_0x2b7218,_0x2875c9))[_0x85c8('0x46')](handleError(_0x2b7218,null));};exports[_0x85c8('0x62')]=function(_0xddeaab,_0x40f64f,_0x3931d0){var _0x4e569d={};var _0x387449={};var _0x459a1b;var _0x237b7d;return db[_0x85c8('0x2e')][_0x85c8('0x55')]({'where':{'id':_0xddeaab[_0x85c8('0x48')]['id']}})[_0x85c8('0x25')](handleEntityNotFound(_0x40f64f,null))[_0x85c8('0x25')](function(_0x54677a){if(_0x54677a){_0x459a1b=_0x54677a;_0x387449[_0x85c8('0x37')]=_[_0x85c8('0x33')](db[_0x85c8('0x63')]['rawAttributes']);_0x387449[_0x85c8('0x32')]=_[_0x85c8('0x33')](_0xddeaab['query']);_0x387449[_0x85c8('0x34')]=_['intersection'](_0x387449['model'],_0x387449[_0x85c8('0x32')]);_0x4e569d[_0x85c8('0x36')]=_[_0x85c8('0x35')](_0x387449[_0x85c8('0x37')],qs['fields'](_0xddeaab['query']['fields']));_0x4e569d[_0x85c8('0x36')]=_0x4e569d[_0x85c8('0x36')][_0x85c8('0x39')]?_0x4e569d[_0x85c8('0x36')]:_0x387449['model'];_0x4e569d[_0x85c8('0x3b')]=qs[_0x85c8('0x3c')](_0xddeaab[_0x85c8('0x32')][_0x85c8('0x3c')]);_0x4e569d[_0x85c8('0x3d')]=qs[_0x85c8('0x34')](_[_0x85c8('0x3e')](_0xddeaab['query'],_0x387449['filters']));if(_0xddeaab[_0x85c8('0x32')][_0x85c8('0x3f')]){_0x4e569d[_0x85c8('0x3d')]=_['merge'](_0x4e569d[_0x85c8('0x3d')],{'$or':_[_0x85c8('0x40')](_0x4e569d[_0x85c8('0x36')],function(_0x58a36d){var _0x546c0e={};_0x546c0e[_0x58a36d]={'$like':'%'+_0xddeaab[_0x85c8('0x32')][_0x85c8('0x3f')]+'%'};return _0x546c0e;})});}_0x4e569d=_[_0x85c8('0x42')]({},_0x4e569d,_0xddeaab[_0x85c8('0x58')]);return _0x459a1b[_0x85c8('0x62')](_0x4e569d);}})[_0x85c8('0x25')](function(_0x5ed564){if(_0x5ed564){_0x237b7d=_0x5ed564[_0x85c8('0x39')];if(!_0xddeaab[_0x85c8('0x32')][_0x85c8('0x57')]('nolimit')){_0x4e569d['limit']=qs[_0x85c8('0x1f')](_0xddeaab[_0x85c8('0x32')][_0x85c8('0x1f')]);_0x4e569d[_0x85c8('0x1e')]=qs['offset'](_0xddeaab['query'][_0x85c8('0x1e')]);}return _0x459a1b['getTeams'](_0x4e569d);}})[_0x85c8('0x25')](function(_0x1377d9){if(_0x1377d9){return _0x1377d9?{'count':_0x237b7d,'rows':_0x1377d9}:null;}})[_0x85c8('0x25')](respondWithResult(_0x40f64f,null))['catch'](handleError(_0x40f64f,null));};exports['addTeams']=function(_0x37adad,_0x2e80ad,_0x259446){var _0x9dc275=_0x37adad['body'][_0x85c8('0x64')];return db[_0x85c8('0x63')][_0x85c8('0x59')]({'where':{'id':_0x9dc275},'attributes':['id'],'include':[{'model':db[_0x85c8('0x5a')],'as':_0x85c8('0x65'),'attributes':['id',_0x85c8('0x2c'),_0x85c8('0x66'),_0x85c8('0x67'),'interface'],'raw':!![]}]})[_0x85c8('0x25')](function(_0x526dc8){if(_0x526dc8){var _0x1ff8a9=_[_0x85c8('0x68')](_0x526dc8,function(_0x22e4a9){var _0x34c9ba=_0x22e4a9['get']({'plain':!![]});return _0x34c9ba['Agents'];});return db[_0x85c8('0x2e')]['find']({'where':{'id':_0x37adad['params']['id']}})[_0x85c8('0x25')](function(_0x32eeea){return db['sequelize'][_0x85c8('0x69')](function(_0x526296){return _0x32eeea[_0x85c8('0x6a')](_0x9dc275,{'transaction':_0x526296})[_0x85c8('0x25')](function(){return BPromise[_0x85c8('0x6b')](_0x1ff8a9,function(_0x11b539){return db[_0x85c8('0x56')]['findOrCreate']({'where':{'UserId':_0x11b539['id'],'MailQueueId':_0x37adad[_0x85c8('0x48')]['id']},'transaction':_0x526296});});})[_0x85c8('0x25')](function(){_0x1ff8a9[_0x85c8('0x6c')](function(_0x3a2c15){socket[_0x85c8('0x6d')]('userMailQueue:save',{'UserId':_0x3a2c15['id'],'MailQueueId':_0x32eeea['id']});});});});});}})['then'](respondWithStatusCode(_0x2e80ad,null))[_0x85c8('0x46')](handleError(_0x2e80ad,null));};exports[_0x85c8('0x6e')]=function(_0xfd16f0,_0x39f4a1,_0x1b369d){return db[_0x85c8('0x63')]['findAll']({'where':{'id':_0xfd16f0[_0x85c8('0x32')][_0x85c8('0x64')]},'attributes':['id'],'include':[{'model':db[_0x85c8('0x5a')],'as':_0x85c8('0x65'),'attributes':['id'],'raw':!![]}]})[_0x85c8('0x25')](handleEntityNotFound(_0x39f4a1,null))[_0x85c8('0x25')](function(_0x3a28ba){var _0x540f27=_[_0x85c8('0x40')](_0x3a28ba,'id');var _0x261e7a=[];var _0x4740b1=[];var _0x506eb2=squel[_0x85c8('0x6f')]();_0x506eb2[_0x85c8('0x70')]('tq.TeamId')[_0x85c8('0x71')](_0x85c8('0x72'),'tq')[_0x85c8('0x73')](_0x85c8('0x74'),'ut',_0x85c8('0x75'))[_0x85c8('0x3d')](_0x85c8('0x76'),_0xfd16f0['params']['id']);for(var _0x1329fd=0x0;_0x1329fd<_0x3a28ba[_0x85c8('0x39')];_0x1329fd+=0x1){let _0x407628=_0x3a28ba[_0x1329fd];for(var _0x2485d5=0x0;_0x2485d5<_0x407628['Agents'][_0x85c8('0x39')];_0x2485d5+=0x1){let _0x1b3c4f=_0x407628['Agents'][_0x2485d5];var _0x4cf147=_0x506eb2[_0x85c8('0x77')]();_0x4cf147[_0x85c8('0x3d')](_0x85c8('0x78'),_0x1b3c4f['id']);_0x4740b1[_0x85c8('0x79')](db[_0x85c8('0x7a')][_0x85c8('0x32')](_0x4cf147[_0x85c8('0x7b')](),{'type':db['sequelize']['QueryTypes'][_0x85c8('0x7c')]})[_0x85c8('0x25')](function(_0x27c382){if(_0x27c382[_0x85c8('0x39')]===0x1){return _0x1b3c4f['id'];}else{var _0x2d9fe0=_[_0x85c8('0x7d')](_[_0x85c8('0x40')](_0x27c382,_0x85c8('0x7e')),function(_0x3ceafe){return _[_0x85c8('0x7f')](_0x540f27,_0x3ceafe);});if(_0x2d9fe0){return _0x1b3c4f['id'];}}}));}}return BPromise['all'](_0x4740b1)[_0x85c8('0x25')](function(_0xec84f0){_0x261e7a=_(_0x261e7a)[_0x85c8('0x80')](_0xec84f0)[_0x85c8('0x81')]()[_0x85c8('0x82')]();return db[_0x85c8('0x2e')][_0x85c8('0x4f')]({'where':{'id':_0xfd16f0[_0x85c8('0x48')]['id']}})['then'](function(_0x5e688c){return db[_0x85c8('0x7a')][_0x85c8('0x69')](function(_0x2ce035){return _0x5e688c[_0x85c8('0x6e')](_0xfd16f0[_0x85c8('0x32')][_0x85c8('0x64')],{'transaction':_0x2ce035})[_0x85c8('0x25')](function(){if(!_[_0x85c8('0x83')](_0x261e7a)){return _0x5e688c[_0x85c8('0x84')](_0x261e7a,{'transaction':_0x2ce035});}})['then'](function(){_0x261e7a[_0x85c8('0x6c')](function(_0x3f03f2){socket[_0x85c8('0x6d')](_0x85c8('0x85'),{'UserId':_0x3f03f2,'MailQueueId':_0x5e688c['id']});});});});});});})[_0x85c8('0x25')](respondWithStatusCode(_0x39f4a1,null))[_0x85c8('0x46')](handleError(_0x39f4a1,null));};exports[_0x85c8('0x86')]=function(_0x1f4ae1,_0x53c37c,_0x11e45b){return db['MailQueue'][_0x85c8('0x4f')]({'where':{'id':_0x1f4ae1[_0x85c8('0x48')]['id']}})[_0x85c8('0x25')](handleEntityNotFound(_0x53c37c,null))[_0x85c8('0x25')](function(_0x50173e){if(_0x50173e){return _0x50173e[_0x85c8('0x86')](_0x1f4ae1[_0x85c8('0x4b')]['ids'],_[_0x85c8('0x87')](_0x1f4ae1[_0x85c8('0x4b')],[_0x85c8('0x64'),'id'])||{})[_0x85c8('0x88')](function(_0x808c34){for(var _0x4b792b=0x0;_0x4b792b<_0x1f4ae1['body']['ids'][_0x85c8('0x39')];_0x4b792b+=0x1){socket[_0x85c8('0x6d')](_0x85c8('0x89'),{'UserId':Number(_0x1f4ae1['body'][_0x85c8('0x64')][_0x4b792b]),'MailQueueId':Number(_0x1f4ae1[_0x85c8('0x48')]['id'])});}return _0x808c34;});}})[_0x85c8('0x25')](respondWithResult(_0x53c37c,null))[_0x85c8('0x46')](handleError(_0x53c37c,null));};exports[_0x85c8('0x84')]=function(_0x156ed1,_0xf4dd11,_0x15dbc3){return db[_0x85c8('0x2e')][_0x85c8('0x4f')]({'where':{'id':_0x156ed1[_0x85c8('0x48')]['id']}})[_0x85c8('0x25')](handleEntityNotFound(_0xf4dd11,null))['then'](function(_0x3a15f8){if(_0x3a15f8){return _0x3a15f8[_0x85c8('0x84')](_0x156ed1[_0x85c8('0x32')][_0x85c8('0x64')])[_0x85c8('0x25')](function(){if(_[_0x85c8('0x8a')](_0x156ed1[_0x85c8('0x32')][_0x85c8('0x64')])){for(var _0x9d7b1=0x0;_0x9d7b1<_0x156ed1['query'][_0x85c8('0x64')][_0x85c8('0x39')];_0x9d7b1+=0x1){socket[_0x85c8('0x6d')](_0x85c8('0x85'),{'UserId':Number(_0x156ed1['query'][_0x85c8('0x64')][_0x9d7b1]),'MailQueueId':Number(_0x156ed1[_0x85c8('0x48')]['id'])});}}else{socket['emit'](_0x85c8('0x85'),{'UserId':Number(_0x156ed1['query'][_0x85c8('0x64')]),'MailQueueId':Number(_0x156ed1['params']['id'])});}});}})[_0x85c8('0x25')](respondWithStatusCode(_0xf4dd11,null))[_0x85c8('0x46')](handleError(_0xf4dd11,null));};exports['getAgents']=function(_0x3d7c22,_0xd9152f,_0x554e0a){var _0x13ec04={};var _0x121c09={};var _0x405e1f;var _0x183b96;return db['MailQueue'][_0x85c8('0x55')]({'where':{'id':_0x3d7c22['params']['id']}})[_0x85c8('0x25')](handleEntityNotFound(_0xd9152f,null))[_0x85c8('0x25')](function(_0x250687){if(_0x250687){_0x405e1f=_0x250687;_0x121c09[_0x85c8('0x37')]=_[_0x85c8('0x33')](db['User'][_0x85c8('0x49')]);_0x121c09[_0x85c8('0x32')]=_[_0x85c8('0x33')](_0x3d7c22['query']);_0x121c09[_0x85c8('0x34')]=_[_0x85c8('0x35')](_0x121c09[_0x85c8('0x37')],_0x121c09[_0x85c8('0x32')]);_0x13ec04['attributes']=_['intersection'](_0x121c09[_0x85c8('0x37')],qs[_0x85c8('0x38')](_0x3d7c22[_0x85c8('0x32')][_0x85c8('0x38')]));_0x13ec04[_0x85c8('0x36')]=_0x13ec04[_0x85c8('0x36')][_0x85c8('0x39')]?_0x13ec04[_0x85c8('0x36')]:_0x121c09['model'];_0x13ec04[_0x85c8('0x3b')]=qs[_0x85c8('0x3c')](_0x3d7c22[_0x85c8('0x32')][_0x85c8('0x3c')]);_0x13ec04[_0x85c8('0x3d')]=qs[_0x85c8('0x34')](_[_0x85c8('0x3e')](_0x3d7c22[_0x85c8('0x32')],_0x121c09[_0x85c8('0x34')]));if(_0x3d7c22[_0x85c8('0x32')][_0x85c8('0x3f')]){_0x13ec04[_0x85c8('0x3d')]=_[_0x85c8('0x42')](_0x13ec04[_0x85c8('0x3d')],{'$or':_[_0x85c8('0x40')](_0x13ec04[_0x85c8('0x36')],function(_0x32c6e7){var _0x209c2d={};_0x209c2d[_0x32c6e7]={'$like':'%'+_0x3d7c22[_0x85c8('0x32')][_0x85c8('0x3f')]+'%'};return _0x209c2d;})});}_0x13ec04=_['merge']({},_0x13ec04,_0x3d7c22['options']);return _0x405e1f[_0x85c8('0x8b')](_0x13ec04);}})[_0x85c8('0x25')](function(_0x182ceb){if(_0x182ceb){_0x183b96=_0x182ceb[_0x85c8('0x39')];if(!_0x3d7c22[_0x85c8('0x32')][_0x85c8('0x57')](_0x85c8('0x3a'))){_0x13ec04[_0x85c8('0x1f')]=qs[_0x85c8('0x1f')](_0x3d7c22[_0x85c8('0x32')][_0x85c8('0x1f')]);_0x13ec04[_0x85c8('0x1e')]=qs['offset'](_0x3d7c22['query']['offset']);}return _0x405e1f['getAgents'](_0x13ec04);}})[_0x85c8('0x25')](function(_0xd09525){if(_0xd09525){return _0xd09525?{'count':_0x183b96,'rows':_0xd09525}:null;}})[_0x85c8('0x25')](respondWithResult(_0xd9152f,null))[_0x85c8('0x46')](handleError(_0xd9152f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 5b4ec33..a991029 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 _0x0cec=['remove','emit','hasOwnProperty','hook','exports','events','MailQueue','setMaxListeners','save','update'];(function(_0x483d8b,_0x526c52){var _0x6500f1=function(_0x372797){while(--_0x372797){_0x483d8b['push'](_0x483d8b['shift']());}};_0x6500f1(++_0x526c52);}(_0x0cec,0x1ef));var _0xc0ce=function(_0x5b2f39,_0x5286e2){_0x5b2f39=_0x5b2f39-0x0;var _0x3c271b=_0x0cec[_0x5b2f39];return _0x3c271b;};'use strict';var EventEmitter=require(_0xc0ce('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xc0ce('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xc0ce('0x2')](0x0);var events={'afterCreate':_0xc0ce('0x3'),'afterUpdate':_0xc0ce('0x4'),'afterDestroy':_0xc0ce('0x5')};function emitEvent(_0x3f6546){return function(_0x77c078,_0x5c36b5,_0xb50cf9){MailQueueEvents[_0xc0ce('0x6')](_0x3f6546+':'+_0x77c078['id'],_0x77c078);MailQueueEvents['emit'](_0x3f6546,_0x77c078);_0xb50cf9(null);};}for(var e in events){if(events[_0xc0ce('0x7')](e)){var event=events[e];MailQueue[_0xc0ce('0x8')](e,emitEvent(event));}}module[_0xc0ce('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x7d8e=['hasOwnProperty','hook','exports','events','save','remove','emit'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x7d8e,0x106));var _0xe7d8=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0x7d8e[_0xb66df];return _0x42a702;};'use strict';var EventEmitter=require(_0xe7d8('0x0'));var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe7d8('0x1'),'afterUpdate':'update','afterDestroy':_0xe7d8('0x2')};function emitEvent(_0x1982c7){return function(_0x57f89b,_0x128449,_0x30468c){MailQueueEvents[_0xe7d8('0x3')](_0x1982c7+':'+_0x57f89b['id'],_0x57f89b);MailQueueEvents[_0xe7d8('0x3')](_0x1982c7,_0x57f89b);_0x30468c(null);};}for(var e in events){if(events[_0xe7d8('0x4')](e)){var event=events[e];MailQueue[_0xe7d8('0x5')](e,emitEvent(event));}}module[_0xe7d8('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 7ad7684..a171956 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 _0x09c3=['moment','request-promise','rimraf','exports','define','mail_queues','lodash','util','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x09c3,0xd5));var _0x309c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x09c3[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x309c('0x0'));var util=require(_0x309c('0x1'));var logger=require('../../config/logger')(_0x309c('0x2'));var moment=require(_0x309c('0x3'));var BPromise=require('bluebird');var rp=require(_0x309c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x309c('0x5'));var config=require('../../config/environment');var attributes=require('./mailQueue.attributes');module[_0x309c('0x6')]=function(_0xd3b301,_0x399ae3){return _0xd3b301[_0x309c('0x7')]('MailQueue',attributes,{'tableName':_0x309c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8890=['../../config/environment','exports','define','mail_queues','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x29fa0d,_0x2c8e17){var _0x599e40=function(_0x4edbf3){while(--_0x4edbf3){_0x29fa0d['push'](_0x29fa0d['shift']());}};_0x599e40(++_0x2c8e17);}(_0x8890,0x7c));var _0x0889=function(_0x2d596b,_0x318f2d){_0x2d596b=_0x2d596b-0x0;var _0x24c554=_0x8890[_0x2d596b];return _0x24c554;};'use strict';var _=require('lodash');var util=require(_0x0889('0x0'));var logger=require(_0x0889('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0889('0x2'));var rp=require(_0x0889('0x3'));var fs=require('fs');var path=require(_0x0889('0x4'));var rimraf=require(_0x0889('0x5'));var config=require(_0x0889('0x6'));var attributes=require('./mailQueue.attributes');module[_0x0889('0x7')]=function(_0x59bcb6,_0x187fbd){return _0x59bcb6[_0x0889('0x8')]('MailQueue',attributes,{'tableName':_0x0889('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 92b7b63..e6995b6 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 _0x98e4=['message','GetMailQueue','findAll','options','raw','attributes','limit','include','map','model','stringify','catch','ShowMailQueue','MailQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x98e4,0x160));var _0x498e=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x98e4[_0x1f9f37];return _0x21c080;};'use strict';var _=require(_0x498e('0x0'));var util=require(_0x498e('0x1'));var moment=require(_0x498e('0x2'));var BPromise=require(_0x498e('0x3'));var rs=require(_0x498e('0x4'));var fs=require('fs');var Redis=require(_0x498e('0x5'));var db=require(_0x498e('0x6'))['db'];var utils=require(_0x498e('0x7'));var logger=require(_0x498e('0x8'))(_0x498e('0x9'));var config=require('../../config/environment');var jayson=require(_0x498e('0xa'));var client=jayson['client'][_0x498e('0xb')]({'port':0x232a});config[_0x498e('0xc')]=_['defaults'](config['redis'],{'host':_0x498e('0xd'),'port':0x18eb});var socket=require(_0x498e('0xe'))(new Redis(config['redis']));require(_0x498e('0xf'))[_0x498e('0x10')](socket);function respondWithRpcPromise(_0x520f07,_0x4851a4,_0x3ca808){return new BPromise(function(_0x3bd17d,_0x56320e){return client[_0x498e('0x11')](_0x520f07,_0x3ca808)[_0x498e('0x12')](function(_0x2ebd05){logger[_0x498e('0x13')](_0x498e('0x14'),_0x4851a4,_0x498e('0x15'));logger[_0x498e('0x16')](_0x498e('0x17'),_0x4851a4,_0x498e('0x15'),JSON['stringify'](_0x2ebd05));if(_0x2ebd05[_0x498e('0x18')]){if(_0x2ebd05[_0x498e('0x18')][_0x498e('0x19')]===0x1f4){logger[_0x498e('0x18')](_0x498e('0x14'),_0x4851a4,_0x2ebd05['error']['message']);return _0x56320e(_0x2ebd05['error'][_0x498e('0x1a')]);}logger[_0x498e('0x18')](_0x498e('0x14'),_0x4851a4,_0x2ebd05['error'][_0x498e('0x1a')]);return _0x3bd17d(_0x2ebd05['error'][_0x498e('0x1a')]);}else{logger[_0x498e('0x13')](_0x498e('0x14'),_0x4851a4,'request\x20sent');_0x3bd17d(_0x2ebd05['result'][_0x498e('0x1a')]);}})['catch'](function(_0x234f4f){logger[_0x498e('0x18')](_0x498e('0x14'),_0x4851a4,_0x234f4f);_0x56320e(_0x234f4f);});});}exports[_0x498e('0x1b')]=function(_0x148d5b){var _0xe6bd07=this;return new Promise(function(_0x4886eb,_0x58ae83){return db['MailQueue'][_0x498e('0x1c')]({'raw':_0x148d5b['options']?_0x148d5b[_0x498e('0x1d')][_0x498e('0x1e')]===undefined?!![]:![]:!![],'where':_0x148d5b[_0x498e('0x1d')]?_0x148d5b[_0x498e('0x1d')]['where']||null:null,'attributes':_0x148d5b[_0x498e('0x1d')]?_0x148d5b[_0x498e('0x1d')][_0x498e('0x1f')]||null:null,'limit':_0x148d5b[_0x498e('0x1d')]?_0x148d5b['options'][_0x498e('0x20')]||null:null,'include':_0x148d5b['options']?_0x148d5b['options'][_0x498e('0x21')]?_['map'](_0x148d5b[_0x498e('0x1d')][_0x498e('0x21')],function(_0x414aeb){return{'model':db[_0x414aeb['model']],'as':_0x414aeb['as'],'attributes':_0x414aeb[_0x498e('0x1f')],'include':_0x414aeb[_0x498e('0x21')]?_[_0x498e('0x22')](_0x414aeb[_0x498e('0x21')],function(_0x21dd29){return{'model':db[_0x21dd29[_0x498e('0x23')]],'as':_0x21dd29['as'],'attributes':_0x21dd29[_0x498e('0x1f')],'include':_0x21dd29[_0x498e('0x21')]?_[_0x498e('0x22')](_0x21dd29[_0x498e('0x21')],function(_0x5b47f9){return{'model':db[_0x5b47f9['model']],'as':_0x5b47f9['as'],'attributes':_0x5b47f9[_0x498e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x498e('0x12')](function(_0x3c3d30){logger[_0x498e('0x13')](_0x498e('0x1b'),_0x148d5b);logger[_0x498e('0x16')](_0x498e('0x1b'),_0x148d5b,JSON[_0x498e('0x24')](_0x3c3d30));_0x4886eb(_0x3c3d30);})[_0x498e('0x25')](function(_0x537250){logger[_0x498e('0x18')]('GetMailQueue',_0x537250['message'],_0x148d5b);_0x58ae83(_0xe6bd07[_0x498e('0x18')](0x1f4,_0x537250[_0x498e('0x1a')]));});});};exports[_0x498e('0x26')]=function(_0x4573ff){var _0xde6c89=this;return new Promise(function(_0x2fb12e,_0x11f611){return db[_0x498e('0x27')][_0x498e('0x28')]({'raw':_0x4573ff[_0x498e('0x1d')]?_0x4573ff['options'][_0x498e('0x1e')]===undefined?!![]:![]:!![],'where':_0x4573ff[_0x498e('0x1d')]?_0x4573ff[_0x498e('0x1d')][_0x498e('0x29')]||null:null,'attributes':_0x4573ff[_0x498e('0x1d')]?_0x4573ff[_0x498e('0x1d')][_0x498e('0x1f')]||null:null,'include':_0x4573ff['options']?_0x4573ff[_0x498e('0x1d')][_0x498e('0x21')]?_[_0x498e('0x22')](_0x4573ff[_0x498e('0x1d')][_0x498e('0x21')],function(_0x31d95b){return{'model':db[_0x31d95b[_0x498e('0x23')]],'as':_0x31d95b['as'],'attributes':_0x31d95b['attributes'],'include':_0x31d95b['include']?_[_0x498e('0x22')](_0x31d95b[_0x498e('0x21')],function(_0x3c2b6f){return{'model':db[_0x3c2b6f[_0x498e('0x23')]],'as':_0x3c2b6f['as'],'attributes':_0x3c2b6f[_0x498e('0x1f')],'include':_0x3c2b6f[_0x498e('0x21')]?_[_0x498e('0x22')](_0x3c2b6f[_0x498e('0x21')],function(_0x12911b){return{'model':db[_0x12911b['model']],'as':_0x12911b['as'],'attributes':_0x12911b['attributes']};}):[]};}):[]};}):[]:[]})[_0x498e('0x12')](function(_0x312bd6){logger['info'](_0x498e('0x26'),_0x4573ff);logger['debug'](_0x498e('0x26'),_0x4573ff,JSON[_0x498e('0x24')](_0x312bd6));_0x2fb12e(_0x312bd6);})['catch'](function(_0x36ba98){logger[_0x498e('0x18')](_0x498e('0x26'),_0x36ba98[_0x498e('0x1a')],_0x4573ff);_0x11f611(_0xde6c89[_0x498e('0x18')](0x1f4,_0x36ba98[_0x498e('0x1a')]));});});}; \ No newline at end of file +var _0xe239=['ShowMailQueue','raw','where','then','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','defaults','redis','socket.io-emitter','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','attributes','limit','include','map','model','info'];(function(_0x142894,_0xf2f3d2){var _0x336ad6=function(_0x553ebb){while(--_0x553ebb){_0x142894['push'](_0x142894['shift']());}};_0x336ad6(++_0xf2f3d2);}(_0xe239,0x151));var _0x9e23=function(_0x492c31,_0x44ddc1){_0x492c31=_0x492c31-0x0;var _0x193fff=_0xe239[_0x492c31];return _0x193fff;};'use strict';var _=require(_0x9e23('0x0'));var util=require(_0x9e23('0x1'));var moment=require('moment');var BPromise=require(_0x9e23('0x2'));var rs=require(_0x9e23('0x3'));var fs=require('fs');var Redis=require(_0x9e23('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9e23('0x5'));var logger=require(_0x9e23('0x6'))('rpc');var config=require(_0x9e23('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x9e23('0x8')](config[_0x9e23('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e23('0xa'))(new Redis(config['redis']));require(_0x9e23('0xb'))[_0x9e23('0xc')](socket);function respondWithRpcPromise(_0x4f87bf,_0x42370f,_0x4915b8){return new BPromise(function(_0x1ebdbf,_0x2479dc){return client[_0x9e23('0xd')](_0x4f87bf,_0x4915b8)['then'](function(_0xf8e086){logger['info'](_0x9e23('0xe'),_0x42370f,_0x9e23('0xf'));logger[_0x9e23('0x10')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x42370f,_0x9e23('0xf'),JSON[_0x9e23('0x11')](_0xf8e086));if(_0xf8e086['error']){if(_0xf8e086[_0x9e23('0x12')][_0x9e23('0x13')]===0x1f4){logger[_0x9e23('0x12')]('MailQueue,\x20%s,\x20%s',_0x42370f,_0xf8e086['error'][_0x9e23('0x14')]);return _0x2479dc(_0xf8e086[_0x9e23('0x12')]['message']);}logger[_0x9e23('0x12')](_0x9e23('0xe'),_0x42370f,_0xf8e086['error'][_0x9e23('0x14')]);return _0x1ebdbf(_0xf8e086[_0x9e23('0x12')][_0x9e23('0x14')]);}else{logger['info'](_0x9e23('0xe'),_0x42370f,_0x9e23('0xf'));_0x1ebdbf(_0xf8e086[_0x9e23('0x15')][_0x9e23('0x14')]);}})[_0x9e23('0x16')](function(_0x44c217){logger[_0x9e23('0x12')](_0x9e23('0xe'),_0x42370f,_0x44c217);_0x2479dc(_0x44c217);});});}exports[_0x9e23('0x17')]=function(_0x200e02){var _0x6a9275=this;return new Promise(function(_0x7c8240,_0x4086ba){return db[_0x9e23('0x18')][_0x9e23('0x19')]({'raw':_0x200e02['options']?_0x200e02[_0x9e23('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x200e02[_0x9e23('0x1a')]?_0x200e02[_0x9e23('0x1a')]['where']||null:null,'attributes':_0x200e02[_0x9e23('0x1a')]?_0x200e02[_0x9e23('0x1a')][_0x9e23('0x1b')]||null:null,'limit':_0x200e02[_0x9e23('0x1a')]?_0x200e02[_0x9e23('0x1a')][_0x9e23('0x1c')]||null:null,'include':_0x200e02[_0x9e23('0x1a')]?_0x200e02[_0x9e23('0x1a')][_0x9e23('0x1d')]?_[_0x9e23('0x1e')](_0x200e02[_0x9e23('0x1a')]['include'],function(_0x4ec479){return{'model':db[_0x4ec479[_0x9e23('0x1f')]],'as':_0x4ec479['as'],'attributes':_0x4ec479[_0x9e23('0x1b')],'include':_0x4ec479['include']?_[_0x9e23('0x1e')](_0x4ec479[_0x9e23('0x1d')],function(_0x1bd180){return{'model':db[_0x1bd180['model']],'as':_0x1bd180['as'],'attributes':_0x1bd180[_0x9e23('0x1b')],'include':_0x1bd180[_0x9e23('0x1d')]?_[_0x9e23('0x1e')](_0x1bd180[_0x9e23('0x1d')],function(_0x3b9e55){return{'model':db[_0x3b9e55[_0x9e23('0x1f')]],'as':_0x3b9e55['as'],'attributes':_0x3b9e55[_0x9e23('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f1570){logger[_0x9e23('0x20')](_0x9e23('0x17'),_0x200e02);logger['debug']('GetMailQueue',_0x200e02,JSON[_0x9e23('0x11')](_0x3f1570));_0x7c8240(_0x3f1570);})[_0x9e23('0x16')](function(_0x288ba7){logger[_0x9e23('0x12')](_0x9e23('0x17'),_0x288ba7[_0x9e23('0x14')],_0x200e02);_0x4086ba(_0x6a9275[_0x9e23('0x12')](0x1f4,_0x288ba7['message']));});});};exports[_0x9e23('0x21')]=function(_0x4a1ff7){var _0x12b921=this;return new Promise(function(_0x55a0e1,_0x404de0){return db[_0x9e23('0x18')]['find']({'raw':_0x4a1ff7[_0x9e23('0x1a')]?_0x4a1ff7[_0x9e23('0x1a')][_0x9e23('0x22')]===undefined?!![]:![]:!![],'where':_0x4a1ff7[_0x9e23('0x1a')]?_0x4a1ff7[_0x9e23('0x1a')][_0x9e23('0x23')]||null:null,'attributes':_0x4a1ff7[_0x9e23('0x1a')]?_0x4a1ff7[_0x9e23('0x1a')][_0x9e23('0x1b')]||null:null,'include':_0x4a1ff7['options']?_0x4a1ff7[_0x9e23('0x1a')]['include']?_['map'](_0x4a1ff7[_0x9e23('0x1a')][_0x9e23('0x1d')],function(_0x11883e){return{'model':db[_0x11883e[_0x9e23('0x1f')]],'as':_0x11883e['as'],'attributes':_0x11883e[_0x9e23('0x1b')],'include':_0x11883e[_0x9e23('0x1d')]?_[_0x9e23('0x1e')](_0x11883e[_0x9e23('0x1d')],function(_0x20618e){return{'model':db[_0x20618e[_0x9e23('0x1f')]],'as':_0x20618e['as'],'attributes':_0x20618e[_0x9e23('0x1b')],'include':_0x20618e[_0x9e23('0x1d')]?_[_0x9e23('0x1e')](_0x20618e[_0x9e23('0x1d')],function(_0x9945b5){return{'model':db[_0x9945b5[_0x9e23('0x1f')]],'as':_0x9945b5['as'],'attributes':_0x9945b5[_0x9e23('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9e23('0x24')](function(_0x1b4831){logger[_0x9e23('0x20')]('ShowMailQueue',_0x4a1ff7);logger[_0x9e23('0x10')](_0x9e23('0x21'),_0x4a1ff7,JSON[_0x9e23('0x11')](_0x1b4831));_0x55a0e1(_0x1b4831);})[_0x9e23('0x16')](function(_0x298e11){logger['error']('ShowMailQueue',_0x298e11[_0x9e23('0x14')],_0x4a1ff7);_0x404de0(_0x12b921[_0x9e23('0x12')](0x1f4,_0x298e11[_0x9e23('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 1115eb9..669707f 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 _0x48cb=['save','remove','update','emit','removeListener','register','length','./mailQueue.events'];(function(_0x5e3178,_0x25b974){var _0x31d12c=function(_0x5ed8e2){while(--_0x5ed8e2){_0x5e3178['push'](_0x5e3178['shift']());}};_0x31d12c(++_0x25b974);}(_0x48cb,0x16f));var _0xb48c=function(_0x6fb6e7,_0x14919e){_0x6fb6e7=_0x6fb6e7-0x0;var _0x176db3=_0x48cb[_0x6fb6e7];return _0x176db3;};'use strict';var MailQueueEvents=require(_0xb48c('0x0'));var events=[_0xb48c('0x1'),_0xb48c('0x2'),_0xb48c('0x3')];function createListener(_0x53306f,_0x269cb5){return function(_0x5e27eb){_0x269cb5[_0xb48c('0x4')](_0x53306f,_0x5e27eb);};}function removeListener(_0x447481,_0x852166){return function(){MailQueueEvents[_0xb48c('0x5')](_0x447481,_0x852166);};}exports[_0xb48c('0x6')]=function(_0x46ed6b){for(var _0x512041=0x0,_0x51cec9=events[_0xb48c('0x7')];_0x512041<_0x51cec9;_0x512041++){var _0x6f840e=events[_0x512041];var _0x346c74=createListener('mailQueue:'+_0x6f840e,_0x46ed6b);MailQueueEvents['on'](_0x6f840e,_0x346c74);}}; \ No newline at end of file +var _0x6554=['remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x31e71e,_0x4598b5){var _0x5962c7=function(_0x12471d){while(--_0x12471d){_0x31e71e['push'](_0x31e71e['shift']());}};_0x5962c7(++_0x4598b5);}(_0x6554,0x181));var _0x4655=function(_0x54efa8,_0x3bedbe){_0x54efa8=_0x54efa8-0x0;var _0x5eafc1=_0x6554[_0x54efa8];return _0x5eafc1;};'use strict';var MailQueueEvents=require(_0x4655('0x0'));var events=[_0x4655('0x1'),_0x4655('0x2'),_0x4655('0x3')];function createListener(_0x175a7a,_0x2247d8){return function(_0x44d586){_0x2247d8[_0x4655('0x4')](_0x175a7a,_0x44d586);};}function removeListener(_0xc4c095,_0x20085a){return function(){MailQueueEvents[_0x4655('0x5')](_0xc4c095,_0x20085a);};}exports[_0x4655('0x6')]=function(_0x48ba0c){for(var _0x23df55=0x0,_0x6de5f=events[_0x4655('0x7')];_0x23df55<_0x6de5f;_0x23df55++){var _0x46567d=events[_0x23df55];var _0x44cc86=createListener(_0x4655('0x8')+_0x46567d,_0x48ba0c);MailQueueEvents['on'](_0x46567d,_0x44cc86);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 324a593..fb2ec52 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 _0x3cf7=['post','create','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x3cf7,0xb0));var _0x73cf=function(_0x2bddf9,_0x22c873){_0x2bddf9=_0x2bddf9-0x0;var _0x3f3ae9=_0x3cf7[_0x2bddf9];return _0x3f3ae9;};'use strict';var multer=require(_0x73cf('0x0'));var util=require(_0x73cf('0x1'));var path=require('path');var timeout=require(_0x73cf('0x2'));var express=require(_0x73cf('0x3'));var router=express['Router']();var fs_extra=require(_0x73cf('0x4'));var auth=require(_0x73cf('0x5'));var interaction=require(_0x73cf('0x6'));var config=require(_0x73cf('0x7'));var controller=require('./mailQueueReport.controller');router[_0x73cf('0x8')]('/',auth['isAuthenticated'](),controller[_0x73cf('0x9')]);router['get']('/describe',auth[_0x73cf('0xa')](),controller[_0x73cf('0xb')]);router[_0x73cf('0x8')](_0x73cf('0xc'),auth[_0x73cf('0xa')](),controller[_0x73cf('0xd')]);router[_0x73cf('0xe')]('/',auth[_0x73cf('0xa')](),controller[_0x73cf('0xf')]);router['put'](_0x73cf('0xc'),auth['isAuthenticated'](),controller[_0x73cf('0x10')]);router[_0x73cf('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x73cf('0x12')]);module['exports']=router; \ No newline at end of file +var _0xef81=['express','../../components/auth/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','/:id','delete','destroy','multer','util','path','connect-timeout'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xef81,0x1d0));var _0x1ef8=function(_0x5d97c6,_0x45136c){_0x5d97c6=_0x5d97c6-0x0;var _0x5e1e2d=_0xef81[_0x5d97c6];return _0x5e1e2d;};'use strict';var multer=require(_0x1ef8('0x0'));var util=require(_0x1ef8('0x1'));var path=require(_0x1ef8('0x2'));var timeout=require(_0x1ef8('0x3'));var express=require(_0x1ef8('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1ef8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1ef8('0x6'));var controller=require(_0x1ef8('0x7'));router[_0x1ef8('0x8')]('/',auth[_0x1ef8('0x9')](),controller[_0x1ef8('0xa')]);router[_0x1ef8('0x8')](_0x1ef8('0xb'),auth[_0x1ef8('0x9')](),controller['describe']);router[_0x1ef8('0x8')]('/:id',auth[_0x1ef8('0x9')](),controller[_0x1ef8('0xc')]);router[_0x1ef8('0xd')]('/',auth[_0x1ef8('0x9')](),controller[_0x1ef8('0xe')]);router['put'](_0x1ef8('0xf'),auth[_0x1ef8('0x9')](),controller['update']);router[_0x1ef8('0x10')](_0x1ef8('0xf'),auth[_0x1ef8('0x9')](),controller[_0x1ef8('0x11')]);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 c7e9ad0..34bb814 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 _0xae6c=['DATE','sequelize','exports','STRING'];(function(_0x5de44e,_0x1395d9){var _0x26c84f=function(_0x413fdd){while(--_0x413fdd){_0x5de44e['push'](_0x5de44e['shift']());}};_0x26c84f(++_0x1395d9);}(_0xae6c,0x95));var _0xcae6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae6c[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require('moment');var Sequelize=require(_0xcae6('0x0'));module[_0xcae6('0x1')]={'uniqueid':{'type':Sequelize[_0xcae6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcae6('0x2')]},'joinAt':{'type':Sequelize[_0xcae6('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xcae6('0x3')]},'exitAt':{'type':Sequelize[_0xcae6('0x3')]},'reason':{'type':Sequelize[_0xcae6('0x2')]}}; \ No newline at end of file +var _0x3e38=['moment','sequelize','exports','STRING','DATE'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3e38,0x78));var _0x83e3=function(_0x214e79,_0x3c9de4){_0x214e79=_0x214e79-0x0;var _0x5a0f59=_0x3e38[_0x214e79];return _0x5a0f59;};'use strict';var moment=require(_0x83e3('0x0'));var Sequelize=require(_0x83e3('0x1'));module[_0x83e3('0x2')]={'uniqueid':{'type':Sequelize[_0x83e3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x83e3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x83e3('0x4')]},'acceptAt':{'type':Sequelize[_0x83e3('0x4')]},'exitAt':{'type':Sequelize[_0x83e3('0x4')]},'reason':{'type':Sequelize[_0x83e3('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index f7d194f..5146778 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 _0x7708=['map','MailQueueReport','rawAttributes','key','model','keys','intersection','query','attributes','fields','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','apply','save','update','then','destroy','error','stack','name','send','index'];(function(_0x518de7,_0x5e853e){var _0x31dd0f=function(_0x2188d3){while(--_0x2188d3){_0x518de7['push'](_0x518de7['shift']());}};_0x31dd0f(++_0x5e853e);}(_0x7708,0x188));var _0x8770=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0x7708[_0x5b78e8];return _0xf2c321;};'use strict';var emlformat=require(_0x8770('0x0'));var rimraf=require(_0x8770('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8770('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8770('0x3'));var path=require(_0x8770('0x4'));var sox=require('sox');var csv=require(_0x8770('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8770('0x6'));var _=require(_0x8770('0x7'));var squel=require(_0x8770('0x8'));var crypto=require(_0x8770('0x9'));var jsforce=require(_0x8770('0xa'));var deskjs=require(_0x8770('0xb'));var toCsv=require(_0x8770('0x5'));var querystring=require('querystring');var Papa=require(_0x8770('0xc'));var Redis=require(_0x8770('0xd'));var authService=require(_0x8770('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x8770('0xf'));var hardwareService=require(_0x8770('0x10'));var logger=require(_0x8770('0x11'))(_0x8770('0x12'));var utils=require('../../config/utils');var config=require(_0x8770('0x13'));var licenseUtil=require(_0x8770('0x14'));var db=require(_0x8770('0x15'))['db'];function respondWithStatusCode(_0x51efbc,_0xb52d60){_0xb52d60=_0xb52d60||0xcc;return function(_0x455a65){if(_0x455a65){return _0x51efbc[_0x8770('0x16')](_0xb52d60);}return _0x51efbc[_0x8770('0x17')](_0xb52d60)[_0x8770('0x18')]();};}function respondWithResult(_0x12a06f,_0x1ce41d){_0x1ce41d=_0x1ce41d||0xc8;return function(_0x12439f){if(_0x12439f){return _0x12a06f['status'](_0x1ce41d)[_0x8770('0x19')](_0x12439f);}};}function respondWithFilteredResult(_0x106a20,_0x5dd4e7){return function(_0x2f7918){if(_0x2f7918){var _0x52254f=typeof _0x5dd4e7[_0x8770('0x1a')]==='undefined'&&typeof _0x5dd4e7['limit']==='undefined';var _0x155e83=_0x2f7918[_0x8770('0x1b')];var _0x17b634=_0x52254f?0x0:_0x5dd4e7[_0x8770('0x1a')];var _0x4b0691=_0x52254f?_0x2f7918['count']:_0x5dd4e7[_0x8770('0x1a')]+_0x5dd4e7[_0x8770('0x1c')];var _0x26cbcd;if(_0x4b0691>=_0x155e83){_0x4b0691=_0x155e83;_0x26cbcd=0xc8;}else{_0x26cbcd=0xce;}_0x106a20[_0x8770('0x17')](_0x26cbcd);return _0x106a20[_0x8770('0x1d')]('Content-Range',_0x17b634+'-'+_0x4b0691+'/'+_0x155e83)[_0x8770('0x19')](_0x2f7918);}return null;};}function patchUpdates(_0x1234dd){return function(_0x384b1e){try{jsonpatch[_0x8770('0x1e')](_0x384b1e,_0x1234dd,!![]);}catch(_0x582048){return BPromise['reject'](_0x582048);}return _0x384b1e[_0x8770('0x1f')]();};}function saveUpdates(_0x348e2f,_0x443716){return function(_0x2918a7){if(_0x2918a7){return _0x2918a7[_0x8770('0x20')](_0x348e2f)[_0x8770('0x21')](function(_0x5819dc){return _0x5819dc;});}return null;};}function removeEntity(_0x468fc0,_0x23ad66){return function(_0x4274dd){if(_0x4274dd){return _0x4274dd[_0x8770('0x22')]()['then'](function(){_0x468fc0[_0x8770('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b4755,_0x453804){return function(_0x473d31){if(!_0x473d31){_0x7b4755[_0x8770('0x16')](0x194);}return _0x473d31;};}function handleError(_0x1538b2,_0x2cd084){_0x2cd084=_0x2cd084||0x1f4;return function(_0x293f53){logger[_0x8770('0x23')](_0x293f53[_0x8770('0x24')]);if(_0x293f53[_0x8770('0x25')]){delete _0x293f53['name'];}_0x1538b2[_0x8770('0x17')](_0x2cd084)[_0x8770('0x26')](_0x293f53);};}exports[_0x8770('0x27')]=function(_0x5c7bd,_0x246128){var _0x200a82={},_0x5ae7b8={},_0x4b284b={'count':0x0,'rows':[]};var _0x37974d=_[_0x8770('0x28')](db[_0x8770('0x29')][_0x8770('0x2a')],function(_0x23f4b0){return{'name':_0x23f4b0['fieldName'],'type':_0x23f4b0['type'][_0x8770('0x2b')]};});_0x5ae7b8[_0x8770('0x2c')]=_[_0x8770('0x28')](_0x37974d,_0x8770('0x25'));_0x5ae7b8['query']=_[_0x8770('0x2d')](_0x5c7bd['query']);_0x5ae7b8['filters']=_[_0x8770('0x2e')](_0x5ae7b8['model'],_0x5ae7b8[_0x8770('0x2f')]);_0x200a82[_0x8770('0x30')]=_[_0x8770('0x2e')](_0x5ae7b8[_0x8770('0x2c')],qs[_0x8770('0x31')](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x31')]));_0x200a82[_0x8770('0x30')]=_0x200a82[_0x8770('0x30')]['length']?_0x200a82[_0x8770('0x30')]:_0x5ae7b8[_0x8770('0x2c')];if(!_0x5c7bd[_0x8770('0x2f')]['hasOwnProperty']('nolimit')){_0x200a82[_0x8770('0x1c')]=qs[_0x8770('0x1c')](_0x5c7bd[_0x8770('0x2f')]['limit']);_0x200a82[_0x8770('0x1a')]=qs['offset'](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x1a')]);}_0x200a82[_0x8770('0x32')]=qs[_0x8770('0x33')](_0x5c7bd[_0x8770('0x2f')][_0x8770('0x33')]);_0x200a82[_0x8770('0x34')]=qs[_0x8770('0x35')](_[_0x8770('0x36')](_0x5c7bd[_0x8770('0x2f')],_0x5ae7b8['filters']),_0x37974d);if(_0x5c7bd[_0x8770('0x2f')][_0x8770('0x37')]){_0x200a82[_0x8770('0x34')]=_['merge'](_0x200a82[_0x8770('0x34')],{'$or':_[_0x8770('0x28')](_0x37974d,function(_0x27f91c){if(_0x27f91c[_0x8770('0x38')]!==_0x8770('0x39')){var _0x3a50db={};_0x3a50db[_0x27f91c['name']]={'$like':'%'+_0x5c7bd[_0x8770('0x2f')]['filter']+'%'};return _0x3a50db;}})});}_0x200a82=_[_0x8770('0x3a')]({},_0x200a82,_0x5c7bd['options']);var _0x41134a={'where':_0x200a82[_0x8770('0x34')]};return db[_0x8770('0x29')]['count'](_0x41134a)[_0x8770('0x21')](function(_0x3f35ac){_0x4b284b[_0x8770('0x1b')]=_0x3f35ac;if(_0x5c7bd[_0x8770('0x2f')][_0x8770('0x3b')]){_0x200a82[_0x8770('0x3c')]=[{'all':!![]}];}return db['MailQueueReport'][_0x8770('0x3d')](_0x200a82);})['then'](function(_0x4bcfc7){_0x4b284b[_0x8770('0x3e')]=_0x4bcfc7;return _0x4b284b;})[_0x8770('0x21')](respondWithFilteredResult(_0x246128,_0x200a82))[_0x8770('0x3f')](handleError(_0x246128,null));};exports[_0x8770('0x40')]=function(_0x3a51b5,_0x4b4477){var _0x35b182={'raw':!![],'where':{'id':_0x3a51b5['params']['id']}},_0x26ae1b={};_0x26ae1b[_0x8770('0x2c')]=_['keys'](db[_0x8770('0x29')][_0x8770('0x2a')]);_0x26ae1b[_0x8770('0x2f')]=_[_0x8770('0x2d')](_0x3a51b5[_0x8770('0x2f')]);_0x26ae1b[_0x8770('0x35')]=_[_0x8770('0x2e')](_0x26ae1b[_0x8770('0x2c')],_0x26ae1b[_0x8770('0x2f')]);_0x35b182[_0x8770('0x30')]=_[_0x8770('0x2e')](_0x26ae1b['model'],qs[_0x8770('0x31')](_0x3a51b5[_0x8770('0x2f')][_0x8770('0x31')]));_0x35b182[_0x8770('0x30')]=_0x35b182[_0x8770('0x30')][_0x8770('0x41')]?_0x35b182['attributes']:_0x26ae1b[_0x8770('0x2c')];if(_0x3a51b5[_0x8770('0x2f')][_0x8770('0x3b')]){_0x35b182[_0x8770('0x3c')]=[{'all':!![]}];}_0x35b182=_[_0x8770('0x3a')]({},_0x35b182,_0x3a51b5[_0x8770('0x42')]);return db[_0x8770('0x29')][_0x8770('0x43')](_0x35b182)['then'](handleEntityNotFound(_0x4b4477,null))[_0x8770('0x21')](respondWithResult(_0x4b4477,null))[_0x8770('0x3f')](handleError(_0x4b4477,null));};exports[_0x8770('0x44')]=function(_0xaeaf3b,_0x454496){return db['MailQueueReport']['create'](_0xaeaf3b[_0x8770('0x45')],{})['then'](respondWithResult(_0x454496,0xc9))[_0x8770('0x3f')](handleError(_0x454496,null));};exports['update']=function(_0x4f9e0b,_0x3805d8){if(_0x4f9e0b[_0x8770('0x45')]['id']){delete _0x4f9e0b[_0x8770('0x45')]['id'];}return db[_0x8770('0x29')]['find']({'where':{'id':_0x4f9e0b[_0x8770('0x46')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x3805d8,null))['then'](saveUpdates(_0x4f9e0b['body'],null))[_0x8770('0x21')](respondWithResult(_0x3805d8,null))[_0x8770('0x3f')](handleError(_0x3805d8,null));};exports[_0x8770('0x22')]=function(_0x4f5cb8,_0x1584dc){return db['MailQueueReport'][_0x8770('0x43')]({'where':{'id':_0x4f5cb8[_0x8770('0x46')]['id']}})[_0x8770('0x21')](handleEntityNotFound(_0x1584dc,null))['then'](removeEntity(_0x1584dc,null))[_0x8770('0x3f')](handleError(_0x1584dc,null));};exports['describe']=function(_0x5aae53,_0x4cfacb){return db[_0x8770('0x29')][_0x8770('0x47')]()[_0x8770('0x21')](respondWithResult(_0x4cfacb,null))[_0x8770('0x3f')](handleError(_0x4cfacb,null));}; \ No newline at end of file +var _0x323f=['model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','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','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key'];(function(_0xa9ce4,_0x4597ba){var _0x138b99=function(_0x2123d9){while(--_0x2123d9){_0xa9ce4['push'](_0xa9ce4['shift']());}};_0x138b99(++_0x4597ba);}(_0x323f,0x1ee));var _0xf323=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x323f[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf323('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf323('0x1'));var rp=require(_0xf323('0x2'));var moment=require(_0xf323('0x3'));var BPromise=require(_0xf323('0x4'));var Mustache=require(_0xf323('0x5'));var util=require(_0xf323('0x6'));var path=require(_0xf323('0x7'));var sox=require(_0xf323('0x8'));var csv=require(_0xf323('0x9'));var ejs=require(_0xf323('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf323('0xb'));var squel=require(_0xf323('0xc'));var crypto=require(_0xf323('0xd'));var jsforce=require(_0xf323('0xe'));var deskjs=require(_0xf323('0xf'));var toCsv=require(_0xf323('0x9'));var querystring=require(_0xf323('0x10'));var Papa=require(_0xf323('0x11'));var Redis=require(_0xf323('0x12'));var authService=require(_0xf323('0x13'));var qs=require(_0xf323('0x14'));var as=require(_0xf323('0x15'));var hardwareService=require(_0xf323('0x16'));var logger=require(_0xf323('0x17'))(_0xf323('0x18'));var utils=require(_0xf323('0x19'));var config=require(_0xf323('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf323('0x1b'))['db'];function respondWithStatusCode(_0x7dbd26,_0x26eddb){_0x26eddb=_0x26eddb||0xcc;return function(_0x56b916){if(_0x56b916){return _0x7dbd26[_0xf323('0x1c')](_0x26eddb);}return _0x7dbd26[_0xf323('0x1d')](_0x26eddb)[_0xf323('0x1e')]();};}function respondWithResult(_0x3a829f,_0x22672e){_0x22672e=_0x22672e||0xc8;return function(_0x144db9){if(_0x144db9){return _0x3a829f['status'](_0x22672e)['json'](_0x144db9);}};}function respondWithFilteredResult(_0x874219,_0x447517){return function(_0x38fd4c){if(_0x38fd4c){var _0x3858ee=typeof _0x447517[_0xf323('0x1f')]==='undefined'&&typeof _0x447517[_0xf323('0x20')]===_0xf323('0x21');var _0xb9859f=_0x38fd4c[_0xf323('0x22')];var _0x49b115=_0x3858ee?0x0:_0x447517[_0xf323('0x1f')];var _0x272aec=_0x3858ee?_0x38fd4c[_0xf323('0x22')]:_0x447517[_0xf323('0x1f')]+_0x447517['limit'];var _0x409b16;if(_0x272aec>=_0xb9859f){_0x272aec=_0xb9859f;_0x409b16=0xc8;}else{_0x409b16=0xce;}_0x874219[_0xf323('0x1d')](_0x409b16);return _0x874219['set'](_0xf323('0x23'),_0x49b115+'-'+_0x272aec+'/'+_0xb9859f)[_0xf323('0x24')](_0x38fd4c);}return null;};}function patchUpdates(_0x32a942){return function(_0x183ce0){try{jsonpatch['apply'](_0x183ce0,_0x32a942,!![]);}catch(_0xdc7891){return BPromise[_0xf323('0x25')](_0xdc7891);}return _0x183ce0[_0xf323('0x26')]();};}function saveUpdates(_0x52305d,_0x43e467){return function(_0x375473){if(_0x375473){return _0x375473[_0xf323('0x27')](_0x52305d)[_0xf323('0x28')](function(_0x13ec1f){return _0x13ec1f;});}return null;};}function removeEntity(_0xa3362c,_0x189b23){return function(_0x43bc05){if(_0x43bc05){return _0x43bc05[_0xf323('0x29')]()['then'](function(){_0xa3362c[_0xf323('0x1d')](0xcc)[_0xf323('0x1e')]();});}};}function handleEntityNotFound(_0x33dc52,_0x292ce0){return function(_0x87ec45){if(!_0x87ec45){_0x33dc52[_0xf323('0x1c')](0x194);}return _0x87ec45;};}function handleError(_0x4d737d,_0x30ed93){_0x30ed93=_0x30ed93||0x1f4;return function(_0x56ce33){logger[_0xf323('0x2a')](_0x56ce33[_0xf323('0x2b')]);if(_0x56ce33['name']){delete _0x56ce33[_0xf323('0x2c')];}_0x4d737d[_0xf323('0x1d')](_0x30ed93)[_0xf323('0x2d')](_0x56ce33);};}exports[_0xf323('0x2e')]=function(_0x46e3b1,_0x5b8b60){var _0x44c944={},_0x34b536={},_0x12c7d5={'count':0x0,'rows':[]};var _0x30a5d7=_[_0xf323('0x2f')](db[_0xf323('0x30')][_0xf323('0x31')],function(_0x1723b7){return{'name':_0x1723b7[_0xf323('0x32')],'type':_0x1723b7['type'][_0xf323('0x33')]};});_0x34b536[_0xf323('0x34')]=_[_0xf323('0x2f')](_0x30a5d7,_0xf323('0x2c'));_0x34b536[_0xf323('0x35')]=_['keys'](_0x46e3b1[_0xf323('0x35')]);_0x34b536[_0xf323('0x36')]=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],_0x34b536[_0xf323('0x35')]);_0x44c944['attributes']=_[_0xf323('0x37')](_0x34b536[_0xf323('0x34')],qs[_0xf323('0x38')](_0x46e3b1[_0xf323('0x35')]['fields']));_0x44c944[_0xf323('0x39')]=_0x44c944['attributes'][_0xf323('0x3a')]?_0x44c944[_0xf323('0x39')]:_0x34b536['model'];if(!_0x46e3b1[_0xf323('0x35')]['hasOwnProperty'](_0xf323('0x3b'))){_0x44c944['limit']=qs[_0xf323('0x20')](_0x46e3b1['query'][_0xf323('0x20')]);_0x44c944[_0xf323('0x1f')]=qs['offset'](_0x46e3b1['query']['offset']);}_0x44c944[_0xf323('0x3c')]=qs[_0xf323('0x3d')](_0x46e3b1[_0xf323('0x35')][_0xf323('0x3d')]);_0x44c944[_0xf323('0x3e')]=qs['filters'](_['pick'](_0x46e3b1['query'],_0x34b536[_0xf323('0x36')]),_0x30a5d7);if(_0x46e3b1['query'][_0xf323('0x3f')]){_0x44c944['where']=_[_0xf323('0x40')](_0x44c944[_0xf323('0x3e')],{'$or':_[_0xf323('0x2f')](_0x30a5d7,function(_0x325fa9){if(_0x325fa9[_0xf323('0x41')]!=='VIRTUAL'){var _0x3d8ddb={};_0x3d8ddb[_0x325fa9[_0xf323('0x2c')]]={'$like':'%'+_0x46e3b1[_0xf323('0x35')][_0xf323('0x3f')]+'%'};return _0x3d8ddb;}})});}_0x44c944=_[_0xf323('0x40')]({},_0x44c944,_0x46e3b1[_0xf323('0x42')]);var _0x288428={'where':_0x44c944[_0xf323('0x3e')]};return db[_0xf323('0x30')][_0xf323('0x22')](_0x288428)[_0xf323('0x28')](function(_0x45287b){_0x12c7d5[_0xf323('0x22')]=_0x45287b;if(_0x46e3b1[_0xf323('0x35')][_0xf323('0x43')]){_0x44c944[_0xf323('0x44')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x44c944);})[_0xf323('0x28')](function(_0x16ac6d){_0x12c7d5[_0xf323('0x45')]=_0x16ac6d;return _0x12c7d5;})[_0xf323('0x28')](respondWithFilteredResult(_0x5b8b60,_0x44c944))[_0xf323('0x46')](handleError(_0x5b8b60,null));};exports[_0xf323('0x47')]=function(_0x2746e3,_0x125047){var _0x1c0136={'raw':!![],'where':{'id':_0x2746e3[_0xf323('0x48')]['id']}},_0x320592={};_0x320592[_0xf323('0x34')]=_[_0xf323('0x49')](db['MailQueueReport'][_0xf323('0x31')]);_0x320592['query']=_['keys'](_0x2746e3[_0xf323('0x35')]);_0x320592['filters']=_['intersection'](_0x320592[_0xf323('0x34')],_0x320592[_0xf323('0x35')]);_0x1c0136[_0xf323('0x39')]=_[_0xf323('0x37')](_0x320592[_0xf323('0x34')],qs[_0xf323('0x38')](_0x2746e3[_0xf323('0x35')][_0xf323('0x38')]));_0x1c0136[_0xf323('0x39')]=_0x1c0136[_0xf323('0x39')][_0xf323('0x3a')]?_0x1c0136['attributes']:_0x320592[_0xf323('0x34')];if(_0x2746e3['query'][_0xf323('0x43')]){_0x1c0136[_0xf323('0x44')]=[{'all':!![]}];}_0x1c0136=_[_0xf323('0x40')]({},_0x1c0136,_0x2746e3[_0xf323('0x42')]);return db['MailQueueReport']['find'](_0x1c0136)[_0xf323('0x28')](handleEntityNotFound(_0x125047,null))['then'](respondWithResult(_0x125047,null))[_0xf323('0x46')](handleError(_0x125047,null));};exports['create']=function(_0x2204f5,_0x8980f){return db['MailQueueReport'][_0xf323('0x4a')](_0x2204f5[_0xf323('0x4b')],{})[_0xf323('0x28')](respondWithResult(_0x8980f,0xc9))[_0xf323('0x46')](handleError(_0x8980f,null));};exports[_0xf323('0x27')]=function(_0x950009,_0x34268e){if(_0x950009[_0xf323('0x4b')]['id']){delete _0x950009[_0xf323('0x4b')]['id'];}return db[_0xf323('0x30')][_0xf323('0x4c')]({'where':{'id':_0x950009[_0xf323('0x48')]['id']}})[_0xf323('0x28')](handleEntityNotFound(_0x34268e,null))['then'](saveUpdates(_0x950009[_0xf323('0x4b')],null))[_0xf323('0x28')](respondWithResult(_0x34268e,null))[_0xf323('0x46')](handleError(_0x34268e,null));};exports[_0xf323('0x29')]=function(_0x190e85,_0x1288b3){return db['MailQueueReport'][_0xf323('0x4c')]({'where':{'id':_0x190e85[_0xf323('0x48')]['id']}})['then'](handleEntityNotFound(_0x1288b3,null))[_0xf323('0x28')](removeEntity(_0x1288b3,null))[_0xf323('0x46')](handleError(_0x1288b3,null));};exports['describe']=function(_0x55754e,_0x46d8fc){return db[_0xf323('0x30')][_0xf323('0x4d')]()[_0xf323('0x28')](respondWithResult(_0x46d8fc,null))[_0xf323('0x46')](handleError(_0x46d8fc,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 5f9266a..4abc335 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 _0xf3d2=['uniqueid','moment','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define'];(function(_0x57abf2,_0x5b20db){var _0x321481=function(_0x222bdc){while(--_0x222bdc){_0x57abf2['push'](_0x57abf2['shift']());}};_0x321481(++_0x5b20db);}(_0xf3d2,0x76));var _0x2f3d=function(_0x4dde94,_0x52b903){_0x4dde94=_0x4dde94-0x0;var _0x30acf7=_0xf3d2[_0x4dde94];return _0x30acf7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x2f3d('0x0'));var BPromise=require('bluebird');var rp=require(_0x2f3d('0x1'));var fs=require('fs');var path=require(_0x2f3d('0x2'));var rimraf=require(_0x2f3d('0x3'));var config=require(_0x2f3d('0x4'));var attributes=require(_0x2f3d('0x5'));module[_0x2f3d('0x6')]=function(_0x509ac3,_0x356050){return _0x509ac3[_0x2f3d('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x2f3d('0x8'),'fields':[_0x2f3d('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4347=['path','../../config/environment','exports','define','MailQueueReport','uniqueid','lodash','util','api','moment','bluebird','request-promise'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x4347,0xea));var _0x7434=function(_0x7e3d0a,_0xcfbfd){_0x7e3d0a=_0x7e3d0a-0x0;var _0x4dbe1f=_0x4347[_0x7e3d0a];return _0x4dbe1f;};'use strict';var _=require(_0x7434('0x0'));var util=require(_0x7434('0x1'));var logger=require('../../config/logger')(_0x7434('0x2'));var moment=require(_0x7434('0x3'));var BPromise=require(_0x7434('0x4'));var rp=require(_0x7434('0x5'));var fs=require('fs');var path=require(_0x7434('0x6'));var rimraf=require('rimraf');var config=require(_0x7434('0x7'));var attributes=require('./mailQueueReport.attributes');module[_0x7434('0x8')]=function(_0x17c603,_0x440696){return _0x17c603[_0x7434('0x9')](_0x7434('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x7434('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 4509792..f74a445 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2d9ac7,_0x559d81){var _0x51c792=function(_0x589096){while(--_0x589096){_0x2d9ac7['push'](_0x2d9ac7['shift']());}};_0x51c792(++_0x559d81);}(_0x1261,0x144));var _0x1126=function(_0x16d24f,_0x4686a5){_0x16d24f=_0x16d24f-0x0;var _0x3beec6=_0x1261[_0x16d24f];return _0x3beec6;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2972d0,_0x1578fd){var _0x2e4c35=function(_0xc0fb7){while(--_0xc0fb7){_0x2972d0['push'](_0x2972d0['shift']());}};_0x2e4c35(++_0x1578fd);}(_0xadb5,0xad));var _0x5adb=function(_0x47c541,_0x14583c){_0x47c541=_0x47c541-0x0;var _0x3b4d27=_0xadb5[_0x47c541];return _0x3b4d27;};'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']('MailQueueReport,\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);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 5a50236..e4300ed 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x42353c,_0x2d7881){var _0x5e9c69=function(_0x1d7ba6){while(--_0x1d7ba6){_0x42353c['push'](_0x42353c['shift']());}};_0x5e9c69(++_0x2d7881);}(_0x70e0,0x17b));var _0x070e=function(_0x39e826,_0x2065ce){_0x39e826=_0x39e826-0x0;var _0x4404a0=_0x70e0[_0x39e826];return _0x4404a0;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2685ca,_0x20355a){var _0x3fdad4=function(_0x27a38e){while(--_0x27a38e){_0x2685ca['push'](_0x2685ca['shift']());}};_0x3fdad4(++_0x20355a);}(_0xe706,0xa3));var _0x6e70=function(_0x134448,_0x591d7b){_0x134448=_0x134448-0x0;var _0x2d52a1=_0xe706[_0x134448];return _0x2d52a1;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index bcb2d89..f7b969d 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 _0x93e6=['INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x93e6,0x11e));var _0x693e=function(_0x43f853,_0x7d78b){_0x43f853=_0x43f853-0x0;var _0x438270=_0x93e6[_0x43f853];return _0x438270;};'use strict';var Sequelize=require(_0x693e('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x693e('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x693e('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x693e('0x2')]},'tls':{'type':Sequelize[_0x693e('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x693e('0x1')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x693e('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x693e('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x693e('0x1')]}}; \ No newline at end of file +var _0x0bb5=['BOOLEAN','STRING','INTEGER','INBOX','sequelize','exports'];(function(_0xd77f8b,_0x40b00a){var _0x27e110=function(_0x300c46){while(--_0x300c46){_0xd77f8b['push'](_0xd77f8b['shift']());}};_0x27e110(++_0x40b00a);}(_0x0bb5,0x148));var _0x50bb=function(_0x2096ab,_0x5326df){_0x2096ab=_0x2096ab-0x0;var _0x168b1f=_0x0bb5[_0x2096ab];return _0x168b1f;};'use strict';var Sequelize=require(_0x50bb('0x0'));module[_0x50bb('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x50bb('0x3')]},'password':{'type':Sequelize[_0x50bb('0x3')]},'port':{'type':Sequelize[_0x50bb('0x4')]},'tls':{'type':Sequelize[_0x50bb('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x50bb('0x3')],'defaultValue':_0x50bb('0x5')},'connTimeout':{'type':Sequelize[_0x50bb('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index b9b940d..5f5f2fb 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 _0x0a0a=['request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','moment','bluebird'];(function(_0x3be753,_0x204d47){var _0x4e6f36=function(_0xb6d3e8){while(--_0xb6d3e8){_0x3be753['push'](_0x3be753['shift']());}};_0x4e6f36(++_0x204d47);}(_0x0a0a,0x170));var _0xa0a0=function(_0x5d0ff5,_0x146a9a){_0x5d0ff5=_0x5d0ff5-0x0;var _0x3b6bc7=_0x0a0a[_0x5d0ff5];return _0x3b6bc7;};'use strict';var _=require(_0xa0a0('0x0'));var util=require(_0xa0a0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0a0('0x2'));var BPromise=require(_0xa0a0('0x3'));var rp=require(_0xa0a0('0x4'));var fs=require('fs');var path=require(_0xa0a0('0x5'));var rimraf=require(_0xa0a0('0x6'));var config=require('../../config/environment');var attributes=require(_0xa0a0('0x7'));module[_0xa0a0('0x8')]=function(_0x4e8ab1,_0x45aba5){return _0x4e8ab1[_0xa0a0('0x9')](_0xa0a0('0xa'),attributes,{'tableName':_0xa0a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f2a=['exports','define','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2d9a44,_0xee55c){var _0x3108e1=function(_0xa8c517){while(--_0xa8c517){_0x2d9a44['push'](_0x2d9a44['shift']());}};_0x3108e1(++_0xee55c);}(_0x8f2a,0x13b));var _0xa8f2=function(_0x5192de,_0x4e91cd){_0x5192de=_0x5192de-0x0;var _0x4e287e=_0x8f2a[_0x5192de];return _0x4e287e;};'use strict';var _=require(_0xa8f2('0x0'));var util=require(_0xa8f2('0x1'));var logger=require(_0xa8f2('0x2'))(_0xa8f2('0x3'));var moment=require(_0xa8f2('0x4'));var BPromise=require(_0xa8f2('0x5'));var rp=require(_0xa8f2('0x6'));var fs=require('fs');var path=require(_0xa8f2('0x7'));var rimraf=require(_0xa8f2('0x8'));var config=require(_0xa8f2('0x9'));var attributes=require('./mailServerIn.attributes');module[_0xa8f2('0xa')]=function(_0x1d18f4,_0x69ceb2){return _0x1d18f4[_0xa8f2('0xb')]('MailServerIn',attributes,{'tableName':_0xa8f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.rpc.js b/server/api/mailServerIn/mailServerIn.rpc.js index 06be4da..fa6b512 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 _0x0e24=['result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5e5e72,_0x3447b1){var _0x331ca5=function(_0x526cd0){while(--_0x526cd0){_0x5e5e72['push'](_0x5e5e72['shift']());}};_0x331ca5(++_0x3447b1);}(_0x0e24,0x1da));var _0x40e2=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x0e24[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x40e2('0x0'));var BPromise=require(_0x40e2('0x1'));var rs=require(_0x40e2('0x2'));var fs=require('fs');var Redis=require(_0x40e2('0x3'));var db=require(_0x40e2('0x4'))['db'];var utils=require(_0x40e2('0x5'));var logger=require(_0x40e2('0x6'))(_0x40e2('0x7'));var config=require(_0x40e2('0x8'));var jayson=require(_0x40e2('0x9'));var client=jayson[_0x40e2('0xa')][_0x40e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17db32,_0x1436cf,_0x49709e){return new BPromise(function(_0x1c764e,_0x18a426){return client['request'](_0x17db32,_0x49709e)[_0x40e2('0xc')](function(_0x5458b6){logger[_0x40e2('0xd')](_0x40e2('0xe'),_0x1436cf,_0x40e2('0xf'));logger[_0x40e2('0x10')](_0x40e2('0x11'),_0x1436cf,_0x40e2('0xf'),JSON['stringify'](_0x5458b6));if(_0x5458b6[_0x40e2('0x12')]){if(_0x5458b6[_0x40e2('0x12')][_0x40e2('0x13')]===0x1f4){logger[_0x40e2('0x12')](_0x40e2('0xe'),_0x1436cf,_0x5458b6[_0x40e2('0x12')][_0x40e2('0x14')]);return _0x18a426(_0x5458b6[_0x40e2('0x12')][_0x40e2('0x14')]);}logger[_0x40e2('0x12')](_0x40e2('0xe'),_0x1436cf,_0x5458b6[_0x40e2('0x12')][_0x40e2('0x14')]);return _0x1c764e(_0x5458b6[_0x40e2('0x12')][_0x40e2('0x14')]);}else{logger[_0x40e2('0xd')]('MailServerIn,\x20%s,\x20%s',_0x1436cf,_0x40e2('0xf'));_0x1c764e(_0x5458b6[_0x40e2('0x15')][_0x40e2('0x14')]);}})[_0x40e2('0x16')](function(_0x2e5fdd){logger[_0x40e2('0x12')](_0x40e2('0xe'),_0x1436cf,_0x2e5fdd);_0x18a426(_0x2e5fdd);});});}exports[_0x40e2('0x17')]=function(_0x25b0c6){var _0x18ba3f=this;return new Promise(function(_0x422109,_0x2c505a){return db[_0x40e2('0x18')][_0x40e2('0x19')]({'raw':_0x25b0c6[_0x40e2('0x1a')]?_0x25b0c6[_0x40e2('0x1a')][_0x40e2('0x1b')]===undefined?!![]:![]:!![],'where':_0x25b0c6[_0x40e2('0x1a')]?_0x25b0c6['options']['where']||null:null,'attributes':_0x25b0c6[_0x40e2('0x1a')]?_0x25b0c6[_0x40e2('0x1a')][_0x40e2('0x1c')]||null:null,'limit':_0x25b0c6['options']?_0x25b0c6['options'][_0x40e2('0x1d')]||null:null,'include':_0x25b0c6['options']?_0x25b0c6[_0x40e2('0x1a')][_0x40e2('0x1e')]?_[_0x40e2('0x1f')](_0x25b0c6[_0x40e2('0x1a')]['include'],function(_0x45b4f7){return{'model':db[_0x45b4f7[_0x40e2('0x20')]],'as':_0x45b4f7['as'],'attributes':_0x45b4f7[_0x40e2('0x1c')],'include':_0x45b4f7[_0x40e2('0x1e')]?_[_0x40e2('0x1f')](_0x45b4f7[_0x40e2('0x1e')],function(_0x577a0c){return{'model':db[_0x577a0c[_0x40e2('0x20')]],'as':_0x577a0c['as'],'attributes':_0x577a0c[_0x40e2('0x1c')],'include':_0x577a0c[_0x40e2('0x1e')]?_[_0x40e2('0x1f')](_0x577a0c[_0x40e2('0x1e')],function(_0x508b0a){return{'model':db[_0x508b0a[_0x40e2('0x20')]],'as':_0x508b0a['as'],'attributes':_0x508b0a['attributes']};}):[]};}):[]};}):[]:[]})[_0x40e2('0xc')](function(_0xba7b78){logger['info'](_0x40e2('0x17'),_0x25b0c6);logger['debug']('GetMailServerIn',_0x25b0c6,JSON['stringify'](_0xba7b78));_0x422109(_0xba7b78);})['catch'](function(_0x713635){logger[_0x40e2('0x12')]('GetMailServerIn',_0x713635['message'],_0x25b0c6);_0x2c505a(_0x18ba3f['error'](0x1f4,_0x713635[_0x40e2('0x14')]));});});}; \ No newline at end of file +var _0x422f=['findAll','options','where','include','model','attributes','map','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','result','catch','GetMailServerIn'];(function(_0x5de687,_0x484594){var _0x227d18=function(_0x44c5bb){while(--_0x44c5bb){_0x5de687['push'](_0x5de687['shift']());}};_0x227d18(++_0x484594);}(_0x422f,0x1c7));var _0xf422=function(_0xe9bbaa,_0x2c4410){_0xe9bbaa=_0xe9bbaa-0x0;var _0x556272=_0x422f[_0xe9bbaa];return _0x556272;};'use strict';var _=require('lodash');var util=require(_0xf422('0x0'));var moment=require('moment');var BPromise=require(_0xf422('0x1'));var rs=require(_0xf422('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf422('0x3'))['db'];var utils=require(_0xf422('0x4'));var logger=require(_0xf422('0x5'))(_0xf422('0x6'));var config=require(_0xf422('0x7'));var jayson=require(_0xf422('0x8'));var client=jayson[_0xf422('0x9')][_0xf422('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x350b2d,_0x583283,_0x3f4801){return new BPromise(function(_0x1037fa,_0xc2c9f5){return client[_0xf422('0xb')](_0x350b2d,_0x3f4801)[_0xf422('0xc')](function(_0x5f02da){logger[_0xf422('0xd')]('MailServerIn,\x20%s,\x20%s',_0x583283,'request\x20sent');logger[_0xf422('0xe')](_0xf422('0xf'),_0x583283,_0xf422('0x10'),JSON[_0xf422('0x11')](_0x5f02da));if(_0x5f02da[_0xf422('0x12')]){if(_0x5f02da['error'][_0xf422('0x13')]===0x1f4){logger[_0xf422('0x12')]('MailServerIn,\x20%s,\x20%s',_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0xc2c9f5(_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);}logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f02da[_0xf422('0x12')][_0xf422('0x14')]);return _0x1037fa(_0x5f02da[_0xf422('0x12')]['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x583283,_0xf422('0x10'));_0x1037fa(_0x5f02da[_0xf422('0x16')][_0xf422('0x14')]);}})[_0xf422('0x17')](function(_0x5f3de5){logger[_0xf422('0x12')](_0xf422('0x15'),_0x583283,_0x5f3de5);_0xc2c9f5(_0x5f3de5);});});}exports[_0xf422('0x18')]=function(_0x2ae133){var _0x43de64=this;return new Promise(function(_0x29b0b1,_0x4fefd0){return db['MailServerIn'][_0xf422('0x19')]({'raw':_0x2ae133[_0xf422('0x1a')]?_0x2ae133[_0xf422('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2ae133[_0xf422('0x1a')]?_0x2ae133['options'][_0xf422('0x1b')]||null:null,'attributes':_0x2ae133[_0xf422('0x1a')]?_0x2ae133[_0xf422('0x1a')]['attributes']||null:null,'limit':_0x2ae133[_0xf422('0x1a')]?_0x2ae133[_0xf422('0x1a')]['limit']||null:null,'include':_0x2ae133['options']?_0x2ae133[_0xf422('0x1a')][_0xf422('0x1c')]?_['map'](_0x2ae133[_0xf422('0x1a')]['include'],function(_0x3b21a5){return{'model':db[_0x3b21a5[_0xf422('0x1d')]],'as':_0x3b21a5['as'],'attributes':_0x3b21a5[_0xf422('0x1e')],'include':_0x3b21a5[_0xf422('0x1c')]?_[_0xf422('0x1f')](_0x3b21a5[_0xf422('0x1c')],function(_0xd8d70f){return{'model':db[_0xd8d70f[_0xf422('0x1d')]],'as':_0xd8d70f['as'],'attributes':_0xd8d70f['attributes'],'include':_0xd8d70f[_0xf422('0x1c')]?_['map'](_0xd8d70f[_0xf422('0x1c')],function(_0x7d36e7){return{'model':db[_0x7d36e7[_0xf422('0x1d')]],'as':_0x7d36e7['as'],'attributes':_0x7d36e7[_0xf422('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf422('0xc')](function(_0x31f439){logger[_0xf422('0xd')]('GetMailServerIn',_0x2ae133);logger['debug'](_0xf422('0x18'),_0x2ae133,JSON[_0xf422('0x11')](_0x31f439));_0x29b0b1(_0x31f439);})[_0xf422('0x17')](function(_0x33ef63){logger[_0xf422('0x12')]('GetMailServerIn',_0x33ef63[_0xf422('0x14')],_0x2ae133);_0x4fefd0(_0x43de64[_0xf422('0x12')](0x1f4,_0x33ef63['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index d38c148..3659f2d 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x7a54,0x106));var _0x47a5=function(_0x526b0a,_0x246fb8){_0x526b0a=_0x526b0a-0x0;var _0x505071=_0x7a54[_0x526b0a];return _0x505071;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x7a54,0x106));var _0x47a5=function(_0x27e455,_0x4f05b8){_0x27e455=_0x27e455-0x0;var _0x3bd477=_0x7a54[_0x27e455];return _0x3bd477;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index f4824cb..52dc13b 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 _0xb9ec=['INTEGER','BOOLEAN','exports','STRING'];(function(_0x1c3816,_0x37a0d0){var _0x1e31dd=function(_0x5b4608){while(--_0x5b4608){_0x1c3816['push'](_0x1c3816['shift']());}};_0x1e31dd(++_0x37a0d0);}(_0xb9ec,0x82));var _0xcb9e=function(_0x5aad37,_0x318525){_0x5aad37=_0x5aad37-0x0;var _0x3b381f=_0xb9ec[_0x5aad37];return _0x3b381f;};'use strict';var Sequelize=require('sequelize');module[_0xcb9e('0x0')]={'description':{'type':Sequelize[_0xcb9e('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0xcb9e('0x1')]},'pass':{'type':Sequelize[_0xcb9e('0x1')]},'port':{'type':Sequelize[_0xcb9e('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xcb9e('0x1')]},'authentication':{'type':Sequelize[_0xcb9e('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf644=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x4d973c,_0x36153f){var _0x33d408=function(_0x4e1fc3){while(--_0x4e1fc3){_0x4d973c['push'](_0x4d973c['shift']());}};_0x33d408(++_0x36153f);}(_0xf644,0x1eb));var _0x4f64=function(_0x35ff7d,_0x1311b4){_0x35ff7d=_0x35ff7d-0x0;var _0x23385c=_0xf644[_0x35ff7d];return _0x23385c;};'use strict';var Sequelize=require(_0x4f64('0x0'));module[_0x4f64('0x1')]={'description':{'type':Sequelize[_0x4f64('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x4f64('0x2')]},'pass':{'type':Sequelize[_0x4f64('0x2')]},'port':{'type':Sequelize[_0x4f64('0x3')]},'secure':{'type':Sequelize[_0x4f64('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x4f64('0x2')]},'authentication':{'type':Sequelize[_0x4f64('0x4')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index d17103e..d3e2b09 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 _0xf152=['../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','MailServerOut','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis'];(function(_0x3da788,_0x3efb8e){var _0x3c6ccf=function(_0xbeac08){while(--_0xbeac08){_0x3da788['push'](_0x3da788['shift']());}};_0x3c6ccf(++_0x3efb8e);}(_0xf152,0x19c));var _0x2f15=function(_0x6386f,_0x49eba4){_0x6386f=_0x6386f-0x0;var _0x1102dc=_0xf152[_0x6386f];return _0x1102dc;};'use strict';var emlformat=require(_0x2f15('0x0'));var rimraf=require(_0x2f15('0x1'));var zipdir=require(_0x2f15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f15('0x3'));var moment=require(_0x2f15('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2f15('0x5'));var util=require(_0x2f15('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2f15('0x7'));var ejs=require(_0x2f15('0x8'));var fs=require('fs');var fs_extra=require(_0x2f15('0x9'));var _=require('lodash');var squel=require(_0x2f15('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f15('0xb'));var toCsv=require(_0x2f15('0x7'));var querystring=require('querystring');var Papa=require(_0x2f15('0xc'));var Redis=require(_0x2f15('0xd'));var authService=require(_0x2f15('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f15('0xf'));var logger=require('../../config/logger')(_0x2f15('0x10'));var utils=require(_0x2f15('0x11'));var config=require(_0x2f15('0x12'));var licenseUtil=require(_0x2f15('0x13'));var db=require(_0x2f15('0x14'))['db'];function respondWithStatusCode(_0x44f10d,_0x38bdf1){_0x38bdf1=_0x38bdf1||0xcc;return function(_0x56450b){if(_0x56450b){return _0x44f10d['sendStatus'](_0x38bdf1);}return _0x44f10d[_0x2f15('0x15')](_0x38bdf1)[_0x2f15('0x16')]();};}function respondWithResult(_0xeba1bc,_0x580b2c){_0x580b2c=_0x580b2c||0xc8;return function(_0x52f517){if(_0x52f517){return _0xeba1bc[_0x2f15('0x15')](_0x580b2c)[_0x2f15('0x17')](_0x52f517);}};}function respondWithFilteredResult(_0x318c16,_0x39e87b){return function(_0xa16582){if(_0xa16582){var _0x10eb9b=typeof _0x39e87b[_0x2f15('0x18')]==='undefined'&&typeof _0x39e87b['limit']===_0x2f15('0x19');var _0x3d535f=_0xa16582['count'];var _0x3e60a8=_0x10eb9b?0x0:_0x39e87b['offset'];var _0x5edf7b=_0x10eb9b?_0xa16582[_0x2f15('0x1a')]:_0x39e87b['offset']+_0x39e87b[_0x2f15('0x1b')];var _0x4155dd;if(_0x5edf7b>=_0x3d535f){_0x5edf7b=_0x3d535f;_0x4155dd=0xc8;}else{_0x4155dd=0xce;}_0x318c16[_0x2f15('0x15')](_0x4155dd);return _0x318c16[_0x2f15('0x1c')](_0x2f15('0x1d'),_0x3e60a8+'-'+_0x5edf7b+'/'+_0x3d535f)[_0x2f15('0x17')](_0xa16582);}return null;};}function patchUpdates(_0x366337){return function(_0x379621){try{jsonpatch[_0x2f15('0x1e')](_0x379621,_0x366337,!![]);}catch(_0xe99fc3){return BPromise[_0x2f15('0x1f')](_0xe99fc3);}return _0x379621[_0x2f15('0x20')]();};}function saveUpdates(_0x552de7,_0x40b1ce){return function(_0xc7446f){if(_0xc7446f){return _0xc7446f[_0x2f15('0x21')](_0x552de7)[_0x2f15('0x22')](function(_0x13c68b){return _0x13c68b;});}return null;};}function removeEntity(_0x4e1ad5,_0x10fc8a){return function(_0x45b25b){if(_0x45b25b){return _0x45b25b['destroy']()['then'](function(){_0x4e1ad5['status'](0xcc)[_0x2f15('0x16')]();});}};}function handleEntityNotFound(_0x1dc67c,_0x2a762d){return function(_0x19e209){if(!_0x19e209){_0x1dc67c[_0x2f15('0x23')](0x194);}return _0x19e209;};}function handleError(_0x206f34,_0x4e668e){_0x4e668e=_0x4e668e||0x1f4;return function(_0x9953d2){logger[_0x2f15('0x24')](_0x9953d2[_0x2f15('0x25')]);if(_0x9953d2[_0x2f15('0x26')]){delete _0x9953d2[_0x2f15('0x26')];}_0x206f34[_0x2f15('0x15')](_0x4e668e)['send'](_0x9953d2);};}exports[_0x2f15('0x27')]=function(_0x24c17d,_0x38ca96){var _0x116a2e={},_0x3b0d68={},_0x50f094={'count':0x0,'rows':[]};var _0x42055c=_['map'](db['MailServerOut']['rawAttributes'],function(_0x222be0){return{'name':_0x222be0[_0x2f15('0x28')],'type':_0x222be0[_0x2f15('0x29')][_0x2f15('0x2a')]};});_0x3b0d68[_0x2f15('0x2b')]=_['map'](_0x42055c,_0x2f15('0x26'));_0x3b0d68[_0x2f15('0x2c')]=_[_0x2f15('0x2d')](_0x24c17d[_0x2f15('0x2c')]);_0x3b0d68['filters']=_[_0x2f15('0x2e')](_0x3b0d68[_0x2f15('0x2b')],_0x3b0d68[_0x2f15('0x2c')]);_0x116a2e[_0x2f15('0x2f')]=_['intersection'](_0x3b0d68[_0x2f15('0x2b')],qs[_0x2f15('0x30')](_0x24c17d[_0x2f15('0x2c')][_0x2f15('0x30')]));_0x116a2e['attributes']=_0x116a2e[_0x2f15('0x2f')][_0x2f15('0x31')]?_0x116a2e['attributes']:_0x3b0d68[_0x2f15('0x2b')];if(!_0x24c17d[_0x2f15('0x2c')]['hasOwnProperty'](_0x2f15('0x32'))){_0x116a2e['limit']=qs[_0x2f15('0x1b')](_0x24c17d[_0x2f15('0x2c')][_0x2f15('0x1b')]);_0x116a2e[_0x2f15('0x18')]=qs['offset'](_0x24c17d[_0x2f15('0x2c')][_0x2f15('0x18')]);}_0x116a2e[_0x2f15('0x33')]=qs[_0x2f15('0x34')](_0x24c17d[_0x2f15('0x2c')]['sort']);_0x116a2e[_0x2f15('0x35')]=qs[_0x2f15('0x36')](_[_0x2f15('0x37')](_0x24c17d[_0x2f15('0x2c')],_0x3b0d68[_0x2f15('0x36')]),_0x42055c);if(_0x24c17d[_0x2f15('0x2c')]['filter']){_0x116a2e['where']=_['merge'](_0x116a2e[_0x2f15('0x35')],{'$or':_['map'](_0x42055c,function(_0x15b6a4){if(_0x15b6a4['type']!=='VIRTUAL'){var _0x1acc71={};_0x1acc71[_0x15b6a4['name']]={'$like':'%'+_0x24c17d[_0x2f15('0x2c')][_0x2f15('0x38')]+'%'};return _0x1acc71;}})});}_0x116a2e=_[_0x2f15('0x39')]({},_0x116a2e,_0x24c17d[_0x2f15('0x3a')]);var _0x17cb59={'where':_0x116a2e['where']};return db[_0x2f15('0x3b')][_0x2f15('0x1a')](_0x17cb59)['then'](function(_0x483398){_0x50f094['count']=_0x483398;if(_0x24c17d[_0x2f15('0x2c')][_0x2f15('0x3c')]){_0x116a2e[_0x2f15('0x3d')]=[{'all':!![]}];}return db[_0x2f15('0x3b')][_0x2f15('0x3e')](_0x116a2e);})[_0x2f15('0x22')](function(_0x3e2f27){_0x50f094['rows']=_0x3e2f27;return _0x50f094;})[_0x2f15('0x22')](respondWithFilteredResult(_0x38ca96,_0x116a2e))[_0x2f15('0x3f')](handleError(_0x38ca96,null));};exports[_0x2f15('0x40')]=function(_0xeb9a1c,_0x3502b5){var _0x1ece81={'raw':!![],'where':{'id':_0xeb9a1c[_0x2f15('0x41')]['id']}},_0x4ec26a={};_0x4ec26a[_0x2f15('0x2b')]=_[_0x2f15('0x2d')](db[_0x2f15('0x3b')][_0x2f15('0x42')]);_0x4ec26a['query']=_[_0x2f15('0x2d')](_0xeb9a1c[_0x2f15('0x2c')]);_0x4ec26a[_0x2f15('0x36')]=_[_0x2f15('0x2e')](_0x4ec26a['model'],_0x4ec26a[_0x2f15('0x2c')]);_0x1ece81[_0x2f15('0x2f')]=_[_0x2f15('0x2e')](_0x4ec26a['model'],qs[_0x2f15('0x30')](_0xeb9a1c[_0x2f15('0x2c')][_0x2f15('0x30')]));_0x1ece81[_0x2f15('0x2f')]=_0x1ece81[_0x2f15('0x2f')][_0x2f15('0x31')]?_0x1ece81[_0x2f15('0x2f')]:_0x4ec26a[_0x2f15('0x2b')];if(_0xeb9a1c[_0x2f15('0x2c')]['includeAll']){_0x1ece81[_0x2f15('0x3d')]=[{'all':!![]}];}_0x1ece81=_['merge']({},_0x1ece81,_0xeb9a1c['options']);return db[_0x2f15('0x3b')]['find'](_0x1ece81)[_0x2f15('0x22')](handleEntityNotFound(_0x3502b5,null))[_0x2f15('0x22')](respondWithResult(_0x3502b5,null))['catch'](handleError(_0x3502b5,null));};exports[_0x2f15('0x43')]=function(_0x4c6e57,_0x1ea7f6){return db[_0x2f15('0x3b')][_0x2f15('0x43')](_0x4c6e57[_0x2f15('0x44')],{})[_0x2f15('0x22')](respondWithResult(_0x1ea7f6,0xc9))[_0x2f15('0x3f')](handleError(_0x1ea7f6,null));};exports['update']=function(_0x10abc2,_0x14dca5){if(_0x10abc2[_0x2f15('0x44')]['id']){delete _0x10abc2[_0x2f15('0x44')]['id'];}return db[_0x2f15('0x3b')][_0x2f15('0x45')]({'where':{'id':_0x10abc2[_0x2f15('0x41')]['id']}})[_0x2f15('0x22')](handleEntityNotFound(_0x14dca5,null))[_0x2f15('0x22')](saveUpdates(_0x10abc2[_0x2f15('0x44')],null))[_0x2f15('0x22')](respondWithResult(_0x14dca5,null))[_0x2f15('0x3f')](handleError(_0x14dca5,null));};exports[_0x2f15('0x46')]=function(_0x5e3e0b,_0x2eafe7){return db[_0x2f15('0x3b')][_0x2f15('0x45')]({'where':{'id':_0x5e3e0b['params']['id']}})[_0x2f15('0x22')](handleEntityNotFound(_0x2eafe7,null))[_0x2f15('0x22')](removeEntity(_0x2eafe7,null))['catch'](handleError(_0x2eafe7,null));}; \ No newline at end of file +var _0xedda=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','options','MailServerOut','includeAll','include','rows','params','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service'];(function(_0x279d96,_0x46e655){var _0x5c3441=function(_0x387443){while(--_0x387443){_0x279d96['push'](_0x279d96['shift']());}};_0x5c3441(++_0x46e655);}(_0xedda,0x10b));var _0xaedd=function(_0x20502c,_0x10f474){_0x20502c=_0x20502c-0x0;var _0x4719b2=_0xedda[_0x20502c];return _0x4719b2;};'use strict';var emlformat=require(_0xaedd('0x0'));var rimraf=require(_0xaedd('0x1'));var zipdir=require(_0xaedd('0x2'));var jsonpatch=require(_0xaedd('0x3'));var rp=require('request-promise');var moment=require(_0xaedd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaedd('0x5'));var util=require(_0xaedd('0x6'));var path=require('path');var sox=require(_0xaedd('0x7'));var csv=require('to-csv');var ejs=require(_0xaedd('0x8'));var fs=require('fs');var fs_extra=require(_0xaedd('0x9'));var _=require(_0xaedd('0xa'));var squel=require(_0xaedd('0xb'));var crypto=require(_0xaedd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaedd('0xd'));var toCsv=require(_0xaedd('0xe'));var querystring=require(_0xaedd('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaedd('0x10'));var qs=require(_0xaedd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaedd('0x12'));var logger=require('../../config/logger')(_0xaedd('0x13'));var utils=require(_0xaedd('0x14'));var config=require(_0xaedd('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaedd('0x16'))['db'];function respondWithStatusCode(_0x2c3a59,_0x2e345f){_0x2e345f=_0x2e345f||0xcc;return function(_0x5ce54d){if(_0x5ce54d){return _0x2c3a59[_0xaedd('0x17')](_0x2e345f);}return _0x2c3a59[_0xaedd('0x18')](_0x2e345f)[_0xaedd('0x19')]();};}function respondWithResult(_0xcd7c34,_0x560503){_0x560503=_0x560503||0xc8;return function(_0x2c492e){if(_0x2c492e){return _0xcd7c34[_0xaedd('0x18')](_0x560503)['json'](_0x2c492e);}};}function respondWithFilteredResult(_0x20f131,_0xbb8e55){return function(_0x14dd8f){if(_0x14dd8f){var _0xc61cd4=typeof _0xbb8e55['offset']===_0xaedd('0x1a')&&typeof _0xbb8e55['limit']==='undefined';var _0x11c2d2=_0x14dd8f[_0xaedd('0x1b')];var _0xa12cb9=_0xc61cd4?0x0:_0xbb8e55[_0xaedd('0x1c')];var _0x2fe547=_0xc61cd4?_0x14dd8f[_0xaedd('0x1b')]:_0xbb8e55[_0xaedd('0x1c')]+_0xbb8e55[_0xaedd('0x1d')];var _0x51a419;if(_0x2fe547>=_0x11c2d2){_0x2fe547=_0x11c2d2;_0x51a419=0xc8;}else{_0x51a419=0xce;}_0x20f131[_0xaedd('0x18')](_0x51a419);return _0x20f131[_0xaedd('0x1e')](_0xaedd('0x1f'),_0xa12cb9+'-'+_0x2fe547+'/'+_0x11c2d2)[_0xaedd('0x20')](_0x14dd8f);}return null;};}function patchUpdates(_0x52022f){return function(_0x34c972){try{jsonpatch['apply'](_0x34c972,_0x52022f,!![]);}catch(_0x23d646){return BPromise[_0xaedd('0x21')](_0x23d646);}return _0x34c972[_0xaedd('0x22')]();};}function saveUpdates(_0x16c3fc,_0x46b7f9){return function(_0x5806bb){if(_0x5806bb){return _0x5806bb[_0xaedd('0x23')](_0x16c3fc)[_0xaedd('0x24')](function(_0x1fee8a){return _0x1fee8a;});}return null;};}function removeEntity(_0x5bc180,_0x3a6c46){return function(_0xf63a51){if(_0xf63a51){return _0xf63a51[_0xaedd('0x25')]()[_0xaedd('0x24')](function(){_0x5bc180['status'](0xcc)[_0xaedd('0x19')]();});}};}function handleEntityNotFound(_0x1be00d,_0x1c199c){return function(_0x37d08c){if(!_0x37d08c){_0x1be00d[_0xaedd('0x17')](0x194);}return _0x37d08c;};}function handleError(_0x40314e,_0x5ac1c3){_0x5ac1c3=_0x5ac1c3||0x1f4;return function(_0x200132){logger[_0xaedd('0x26')](_0x200132[_0xaedd('0x27')]);if(_0x200132[_0xaedd('0x28')]){delete _0x200132[_0xaedd('0x28')];}_0x40314e['status'](_0x5ac1c3)[_0xaedd('0x29')](_0x200132);};}exports['index']=function(_0x2895da,_0xad8844){var _0x1c8583={},_0x2beae6={},_0x1811ed={'count':0x0,'rows':[]};var _0x1037fb=_[_0xaedd('0x2a')](db['MailServerOut']['rawAttributes'],function(_0x798669){return{'name':_0x798669[_0xaedd('0x2b')],'type':_0x798669['type'][_0xaedd('0x2c')]};});_0x2beae6[_0xaedd('0x2d')]=_['map'](_0x1037fb,_0xaedd('0x28'));_0x2beae6[_0xaedd('0x2e')]=_[_0xaedd('0x2f')](_0x2895da[_0xaedd('0x2e')]);_0x2beae6[_0xaedd('0x30')]=_[_0xaedd('0x31')](_0x2beae6[_0xaedd('0x2d')],_0x2beae6[_0xaedd('0x2e')]);_0x1c8583[_0xaedd('0x32')]=_['intersection'](_0x2beae6['model'],qs[_0xaedd('0x33')](_0x2895da[_0xaedd('0x2e')][_0xaedd('0x33')]));_0x1c8583[_0xaedd('0x32')]=_0x1c8583[_0xaedd('0x32')][_0xaedd('0x34')]?_0x1c8583[_0xaedd('0x32')]:_0x2beae6[_0xaedd('0x2d')];if(!_0x2895da['query'][_0xaedd('0x35')]('nolimit')){_0x1c8583[_0xaedd('0x1d')]=qs['limit'](_0x2895da[_0xaedd('0x2e')][_0xaedd('0x1d')]);_0x1c8583[_0xaedd('0x1c')]=qs[_0xaedd('0x1c')](_0x2895da[_0xaedd('0x2e')][_0xaedd('0x1c')]);}_0x1c8583['order']=qs['sort'](_0x2895da[_0xaedd('0x2e')][_0xaedd('0x36')]);_0x1c8583[_0xaedd('0x37')]=qs[_0xaedd('0x30')](_[_0xaedd('0x38')](_0x2895da[_0xaedd('0x2e')],_0x2beae6[_0xaedd('0x30')]),_0x1037fb);if(_0x2895da[_0xaedd('0x2e')][_0xaedd('0x39')]){_0x1c8583[_0xaedd('0x37')]=_[_0xaedd('0x3a')](_0x1c8583['where'],{'$or':_[_0xaedd('0x2a')](_0x1037fb,function(_0x52cc3f){if(_0x52cc3f[_0xaedd('0x3b')]!=='VIRTUAL'){var _0x456fa0={};_0x456fa0[_0x52cc3f[_0xaedd('0x28')]]={'$like':'%'+_0x2895da[_0xaedd('0x2e')][_0xaedd('0x39')]+'%'};return _0x456fa0;}})});}_0x1c8583=_[_0xaedd('0x3a')]({},_0x1c8583,_0x2895da[_0xaedd('0x3c')]);var _0x53b480={'where':_0x1c8583[_0xaedd('0x37')]};return db[_0xaedd('0x3d')][_0xaedd('0x1b')](_0x53b480)['then'](function(_0x273ef6){_0x1811ed[_0xaedd('0x1b')]=_0x273ef6;if(_0x2895da[_0xaedd('0x2e')][_0xaedd('0x3e')]){_0x1c8583[_0xaedd('0x3f')]=[{'all':!![]}];}return db['MailServerOut']['findAll'](_0x1c8583);})[_0xaedd('0x24')](function(_0x41bb6b){_0x1811ed[_0xaedd('0x40')]=_0x41bb6b;return _0x1811ed;})[_0xaedd('0x24')](respondWithFilteredResult(_0xad8844,_0x1c8583))['catch'](handleError(_0xad8844,null));};exports['show']=function(_0x517425,_0x470093){var _0x4e651f={'raw':!![],'where':{'id':_0x517425[_0xaedd('0x41')]['id']}},_0x466a2a={};_0x466a2a[_0xaedd('0x2d')]=_[_0xaedd('0x2f')](db['MailServerOut'][_0xaedd('0x42')]);_0x466a2a[_0xaedd('0x2e')]=_[_0xaedd('0x2f')](_0x517425[_0xaedd('0x2e')]);_0x466a2a[_0xaedd('0x30')]=_[_0xaedd('0x31')](_0x466a2a[_0xaedd('0x2d')],_0x466a2a[_0xaedd('0x2e')]);_0x4e651f[_0xaedd('0x32')]=_[_0xaedd('0x31')](_0x466a2a[_0xaedd('0x2d')],qs[_0xaedd('0x33')](_0x517425[_0xaedd('0x2e')][_0xaedd('0x33')]));_0x4e651f[_0xaedd('0x32')]=_0x4e651f[_0xaedd('0x32')][_0xaedd('0x34')]?_0x4e651f[_0xaedd('0x32')]:_0x466a2a[_0xaedd('0x2d')];if(_0x517425[_0xaedd('0x2e')][_0xaedd('0x3e')]){_0x4e651f[_0xaedd('0x3f')]=[{'all':!![]}];}_0x4e651f=_['merge']({},_0x4e651f,_0x517425[_0xaedd('0x3c')]);return db[_0xaedd('0x3d')][_0xaedd('0x43')](_0x4e651f)[_0xaedd('0x24')](handleEntityNotFound(_0x470093,null))[_0xaedd('0x24')](respondWithResult(_0x470093,null))[_0xaedd('0x44')](handleError(_0x470093,null));};exports[_0xaedd('0x45')]=function(_0x3a1619,_0x309e47){return db[_0xaedd('0x3d')]['create'](_0x3a1619[_0xaedd('0x46')],{})[_0xaedd('0x24')](respondWithResult(_0x309e47,0xc9))[_0xaedd('0x44')](handleError(_0x309e47,null));};exports[_0xaedd('0x23')]=function(_0x22413d,_0x4effa5){if(_0x22413d[_0xaedd('0x46')]['id']){delete _0x22413d['body']['id'];}return db[_0xaedd('0x3d')][_0xaedd('0x43')]({'where':{'id':_0x22413d['params']['id']}})[_0xaedd('0x24')](handleEntityNotFound(_0x4effa5,null))[_0xaedd('0x24')](saveUpdates(_0x22413d[_0xaedd('0x46')],null))[_0xaedd('0x24')](respondWithResult(_0x4effa5,null))[_0xaedd('0x44')](handleError(_0x4effa5,null));};exports[_0xaedd('0x25')]=function(_0x4c0f98,_0x183051){return db[_0xaedd('0x3d')][_0xaedd('0x43')]({'where':{'id':_0x4c0f98['params']['id']}})[_0xaedd('0x24')](handleEntityNotFound(_0x183051,null))[_0xaedd('0x24')](removeEntity(_0x183051,null))[_0xaedd('0x44')](handleError(_0x183051,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 84f79ad..f7dfaa3 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 _0x7612=['api','moment','bluebird','../../config/environment','./mailServerOut.attributes','MailServerOut','mail_servers_out','lodash','../../config/logger'];(function(_0x23b8ba,_0x2a577a){var _0x55e2eb=function(_0x3e103b){while(--_0x3e103b){_0x23b8ba['push'](_0x23b8ba['shift']());}};_0x55e2eb(++_0x2a577a);}(_0x7612,0xdf));var _0x2761=function(_0x486f4a,_0x478dc7){_0x486f4a=_0x486f4a-0x0;var _0x135d99=_0x7612[_0x486f4a];return _0x135d99;};'use strict';var _=require(_0x2761('0x0'));var util=require('util');var logger=require(_0x2761('0x1'))(_0x2761('0x2'));var moment=require(_0x2761('0x3'));var BPromise=require(_0x2761('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2761('0x5'));var attributes=require(_0x2761('0x6'));module['exports']=function(_0x59b934,_0x591049){return _0x59b934['define'](_0x2761('0x7'),attributes,{'tableName':_0x2761('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22ba=['MailServerOut','mail_servers_out','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./mailServerOut.attributes','exports'];(function(_0x1d766d,_0x16bc37){var _0x5ab990=function(_0x2987f3){while(--_0x2987f3){_0x1d766d['push'](_0x1d766d['shift']());}};_0x5ab990(++_0x16bc37);}(_0x22ba,0x178));var _0xa22b=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x22ba[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0xa22b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa22b('0x1'));var moment=require(_0xa22b('0x2'));var BPromise=require(_0xa22b('0x3'));var rp=require(_0xa22b('0x4'));var fs=require('fs');var path=require(_0xa22b('0x5'));var rimraf=require('rimraf');var config=require(_0xa22b('0x6'));var attributes=require(_0xa22b('0x7'));module[_0xa22b('0x8')]=function(_0xe20bf6,_0xe42749){return _0xe20bf6['define'](_0xa22b('0x9'),attributes,{'tableName':_0xa22b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index a90977e..23b355a 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x17487e,_0x36edc3){_0x17487e=_0x17487e-0x0;var _0x2f3760=_0x7a54[_0x17487e];return _0x2f3760;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x280a89,_0x32070f){var _0x2bfa47=function(_0x20ed9a){while(--_0x20ed9a){_0x280a89['push'](_0x280a89['shift']());}};_0x2bfa47(++_0x32070f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xc4aa[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index c29606c..47eefd6 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 _0x8907=['describe','/:id','show','post','create','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x54ec42,_0x20239a){var _0x4d5db3=function(_0x290f6e){while(--_0x290f6e){_0x54ec42['push'](_0x54ec42['shift']());}};_0x4d5db3(++_0x20239a);}(_0x8907,0x125));var _0x7890=function(_0x253476,_0x16b31a){_0x253476=_0x253476-0x0;var _0x134271=_0x8907[_0x253476];return _0x134271;};'use strict';var multer=require(_0x7890('0x0'));var util=require(_0x7890('0x1'));var path=require(_0x7890('0x2'));var timeout=require(_0x7890('0x3'));var express=require('express');var router=express[_0x7890('0x4')]();var fs_extra=require(_0x7890('0x5'));var auth=require(_0x7890('0x6'));var interaction=require(_0x7890('0x7'));var config=require(_0x7890('0x8'));var controller=require('./mailSubstatus.controller');router[_0x7890('0x9')]('/',auth[_0x7890('0xa')](),controller['index']);router['get']('/describe',auth[_0x7890('0xa')](),controller[_0x7890('0xb')]);router[_0x7890('0x9')](_0x7890('0xc'),auth[_0x7890('0xa')](),controller[_0x7890('0xd')]);router[_0x7890('0xe')]('/',auth[_0x7890('0xa')](),controller[_0x7890('0xf')]);router['put'](_0x7890('0xc'),auth[_0x7890('0xa')](),controller[_0x7890('0x10')]);router['delete'](_0x7890('0xc'),auth[_0x7890('0xa')](),controller[_0x7890('0x11')]);module[_0x7890('0x12')]=router; \ No newline at end of file +var _0xfdd5=['get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller'];(function(_0x5630ba,_0xf23bab){var _0x2f4ab3=function(_0x211c04){while(--_0x211c04){_0x5630ba['push'](_0x5630ba['shift']());}};_0x2f4ab3(++_0xf23bab);}(_0xfdd5,0x138));var _0x5fdd=function(_0x5f4a1d,_0xba888c){_0x5f4a1d=_0x5f4a1d-0x0;var _0x3d5230=_0xfdd5[_0x5f4a1d];return _0x3d5230;};'use strict';var multer=require(_0x5fdd('0x0'));var util=require('util');var path=require(_0x5fdd('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fdd('0x2'));var router=express[_0x5fdd('0x3')]();var fs_extra=require(_0x5fdd('0x4'));var auth=require(_0x5fdd('0x5'));var interaction=require(_0x5fdd('0x6'));var config=require('../../config/environment');var controller=require(_0x5fdd('0x7'));router[_0x5fdd('0x8')]('/',auth[_0x5fdd('0x9')](),controller[_0x5fdd('0xa')]);router[_0x5fdd('0x8')](_0x5fdd('0xb'),auth['isAuthenticated'](),controller[_0x5fdd('0xc')]);router[_0x5fdd('0x8')](_0x5fdd('0xd'),auth[_0x5fdd('0x9')](),controller['show']);router[_0x5fdd('0xe')]('/',auth[_0x5fdd('0x9')](),controller[_0x5fdd('0xf')]);router['put'](_0x5fdd('0xd'),auth['isAuthenticated'](),controller[_0x5fdd('0x10')]);router[_0x5fdd('0x11')](_0x5fdd('0xd'),auth['isAuthenticated'](),controller[_0x5fdd('0x12')]);module[_0x5fdd('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 2358fdf..12b3fb2 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 _0x0a6b=['sequelize','STRING'];(function(_0x2b5678,_0x415f0d){var _0x59f696=function(_0x5cae93){while(--_0x5cae93){_0x2b5678['push'](_0x2b5678['shift']());}};_0x59f696(++_0x415f0d);}(_0x0a6b,0x18e));var _0xb0a6=function(_0x4bc4db,_0x43e85e){_0x4bc4db=_0x4bc4db-0x0;var _0x34277f=_0x0a6b[_0x4bc4db];return _0x34277f;};'use strict';var Sequelize=require(_0xb0a6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb0a6('0x1')]}}; \ No newline at end of file +var _0x6657=['STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6657,0x17f));var _0x7665=function(_0xd5905,_0x15e17d){_0xd5905=_0xd5905-0x0;var _0x4ebd5a=_0x6657[_0xd5905];return _0x4ebd5a;};'use strict';var Sequelize=require(_0x7665('0x0'));module['exports']={'name':{'type':Sequelize[_0x7665('0x1')],'unique':_0x7665('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7665('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 667aab9..e27eb19 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 _0xba0b=['offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','MailSubstatus','includeAll','include','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x58967b,_0x50fe35){var _0x33039e=function(_0xec1cd){while(--_0xec1cd){_0x58967b['push'](_0x58967b['shift']());}};_0x33039e(++_0x50fe35);}(_0xba0b,0x162));var _0xbba0=function(_0x3f94fb,_0x3f3a32){_0x3f94fb=_0x3f94fb-0x0;var _0x57d200=_0xba0b[_0x3f94fb];return _0x57d200;};'use strict';var emlformat=require(_0xbba0('0x0'));var rimraf=require(_0xbba0('0x1'));var zipdir=require(_0xbba0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbba0('0x3'));var moment=require(_0xbba0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbba0('0x5'));var util=require('util');var path=require(_0xbba0('0x6'));var sox=require(_0xbba0('0x7'));var csv=require(_0xbba0('0x8'));var ejs=require(_0xbba0('0x9'));var fs=require('fs');var fs_extra=require(_0xbba0('0xa'));var _=require(_0xbba0('0xb'));var squel=require(_0xbba0('0xc'));var crypto=require(_0xbba0('0xd'));var jsforce=require(_0xbba0('0xe'));var deskjs=require(_0xbba0('0xf'));var toCsv=require(_0xbba0('0x8'));var querystring=require(_0xbba0('0x10'));var Papa=require('papaparse');var Redis=require(_0xbba0('0x11'));var authService=require(_0xbba0('0x12'));var qs=require(_0xbba0('0x13'));var as=require(_0xbba0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbba0('0x15'))(_0xbba0('0x16'));var utils=require(_0xbba0('0x17'));var config=require(_0xbba0('0x18'));var licenseUtil=require(_0xbba0('0x19'));var db=require(_0xbba0('0x1a'))['db'];function respondWithStatusCode(_0xfeb701,_0x3e29c3){_0x3e29c3=_0x3e29c3||0xcc;return function(_0x59a98d){if(_0x59a98d){return _0xfeb701[_0xbba0('0x1b')](_0x3e29c3);}return _0xfeb701['status'](_0x3e29c3)[_0xbba0('0x1c')]();};}function respondWithResult(_0x3be172,_0x19bcf2){_0x19bcf2=_0x19bcf2||0xc8;return function(_0x32676f){if(_0x32676f){return _0x3be172[_0xbba0('0x1d')](_0x19bcf2)[_0xbba0('0x1e')](_0x32676f);}};}function respondWithFilteredResult(_0x2097c0,_0x33a348){return function(_0x2e2621){if(_0x2e2621){var _0x186c0c=typeof _0x33a348[_0xbba0('0x1f')]===_0xbba0('0x20')&&typeof _0x33a348[_0xbba0('0x21')]===_0xbba0('0x20');var _0x41f452=_0x2e2621[_0xbba0('0x22')];var _0x5dbdc2=_0x186c0c?0x0:_0x33a348[_0xbba0('0x1f')];var _0x214c20=_0x186c0c?_0x2e2621[_0xbba0('0x22')]:_0x33a348[_0xbba0('0x1f')]+_0x33a348[_0xbba0('0x21')];var _0x482ba3;if(_0x214c20>=_0x41f452){_0x214c20=_0x41f452;_0x482ba3=0xc8;}else{_0x482ba3=0xce;}_0x2097c0[_0xbba0('0x1d')](_0x482ba3);return _0x2097c0[_0xbba0('0x23')](_0xbba0('0x24'),_0x5dbdc2+'-'+_0x214c20+'/'+_0x41f452)[_0xbba0('0x1e')](_0x2e2621);}return null;};}function patchUpdates(_0x56c314){return function(_0x4e0bf2){try{jsonpatch['apply'](_0x4e0bf2,_0x56c314,!![]);}catch(_0x9a32ea){return BPromise[_0xbba0('0x25')](_0x9a32ea);}return _0x4e0bf2[_0xbba0('0x26')]();};}function saveUpdates(_0x3af80d,_0x5565f7){return function(_0x343d57){if(_0x343d57){return _0x343d57['update'](_0x3af80d)['then'](function(_0x683788){return _0x683788;});}return null;};}function removeEntity(_0x39bcb5,_0x5cf94a){return function(_0x108b26){if(_0x108b26){return _0x108b26[_0xbba0('0x27')]()[_0xbba0('0x28')](function(){_0x39bcb5[_0xbba0('0x1d')](0xcc)[_0xbba0('0x1c')]();});}};}function handleEntityNotFound(_0x326701,_0x1e9008){return function(_0x310259){if(!_0x310259){_0x326701[_0xbba0('0x1b')](0x194);}return _0x310259;};}function handleError(_0x527461,_0x188888){_0x188888=_0x188888||0x1f4;return function(_0x4ae73c){logger[_0xbba0('0x29')](_0x4ae73c['stack']);if(_0x4ae73c[_0xbba0('0x2a')]){delete _0x4ae73c['name'];}_0x527461[_0xbba0('0x1d')](_0x188888)[_0xbba0('0x2b')](_0x4ae73c);};}exports[_0xbba0('0x2c')]=function(_0x5a0f2d,_0x4e9d41){var _0x151d3c={},_0xfb04a1={},_0x5a051f={'count':0x0,'rows':[]};var _0xe18dc7=_[_0xbba0('0x2d')](db['MailSubstatus'][_0xbba0('0x2e')],function(_0x8ec11d){return{'name':_0x8ec11d[_0xbba0('0x2f')],'type':_0x8ec11d[_0xbba0('0x30')][_0xbba0('0x31')]};});_0xfb04a1[_0xbba0('0x32')]=_[_0xbba0('0x2d')](_0xe18dc7,'name');_0xfb04a1[_0xbba0('0x33')]=_[_0xbba0('0x34')](_0x5a0f2d[_0xbba0('0x33')]);_0xfb04a1[_0xbba0('0x35')]=_['intersection'](_0xfb04a1[_0xbba0('0x32')],_0xfb04a1[_0xbba0('0x33')]);_0x151d3c[_0xbba0('0x36')]=_[_0xbba0('0x37')](_0xfb04a1['model'],qs['fields'](_0x5a0f2d[_0xbba0('0x33')][_0xbba0('0x38')]));_0x151d3c[_0xbba0('0x36')]=_0x151d3c['attributes'][_0xbba0('0x39')]?_0x151d3c[_0xbba0('0x36')]:_0xfb04a1['model'];if(!_0x5a0f2d[_0xbba0('0x33')][_0xbba0('0x3a')](_0xbba0('0x3b'))){_0x151d3c[_0xbba0('0x21')]=qs[_0xbba0('0x21')](_0x5a0f2d[_0xbba0('0x33')][_0xbba0('0x21')]);_0x151d3c[_0xbba0('0x1f')]=qs[_0xbba0('0x1f')](_0x5a0f2d['query'][_0xbba0('0x1f')]);}_0x151d3c[_0xbba0('0x3c')]=qs['sort'](_0x5a0f2d[_0xbba0('0x33')][_0xbba0('0x3d')]);_0x151d3c[_0xbba0('0x3e')]=qs[_0xbba0('0x35')](_[_0xbba0('0x3f')](_0x5a0f2d[_0xbba0('0x33')],_0xfb04a1[_0xbba0('0x35')]),_0xe18dc7);if(_0x5a0f2d[_0xbba0('0x33')][_0xbba0('0x40')]){_0x151d3c[_0xbba0('0x3e')]=_['merge'](_0x151d3c[_0xbba0('0x3e')],{'$or':_[_0xbba0('0x2d')](_0xe18dc7,function(_0x5b90c2){if(_0x5b90c2[_0xbba0('0x30')]!==_0xbba0('0x41')){var _0x5df842={};_0x5df842[_0x5b90c2[_0xbba0('0x2a')]]={'$like':'%'+_0x5a0f2d[_0xbba0('0x33')][_0xbba0('0x40')]+'%'};return _0x5df842;}})});}_0x151d3c=_[_0xbba0('0x42')]({},_0x151d3c,_0x5a0f2d[_0xbba0('0x43')]);var _0x319b3c={'where':_0x151d3c[_0xbba0('0x3e')]};return db[_0xbba0('0x44')][_0xbba0('0x22')](_0x319b3c)[_0xbba0('0x28')](function(_0x7a9c28){_0x5a051f[_0xbba0('0x22')]=_0x7a9c28;if(_0x5a0f2d[_0xbba0('0x33')][_0xbba0('0x45')]){_0x151d3c[_0xbba0('0x46')]=[{'all':!![]}];}return db[_0xbba0('0x44')]['findAll'](_0x151d3c);})[_0xbba0('0x28')](function(_0x18b9cc){_0x5a051f['rows']=_0x18b9cc;return _0x5a051f;})[_0xbba0('0x28')](respondWithFilteredResult(_0x4e9d41,_0x151d3c))[_0xbba0('0x47')](handleError(_0x4e9d41,null));};exports['show']=function(_0x3a24e7,_0x3e2313){var _0x103aca={'raw':!![],'where':{'id':_0x3a24e7[_0xbba0('0x48')]['id']}},_0xbeca44={};_0xbeca44[_0xbba0('0x32')]=_['keys'](db[_0xbba0('0x44')][_0xbba0('0x2e')]);_0xbeca44[_0xbba0('0x33')]=_['keys'](_0x3a24e7[_0xbba0('0x33')]);_0xbeca44['filters']=_[_0xbba0('0x37')](_0xbeca44[_0xbba0('0x32')],_0xbeca44[_0xbba0('0x33')]);_0x103aca['attributes']=_[_0xbba0('0x37')](_0xbeca44[_0xbba0('0x32')],qs[_0xbba0('0x38')](_0x3a24e7[_0xbba0('0x33')][_0xbba0('0x38')]));_0x103aca[_0xbba0('0x36')]=_0x103aca['attributes'][_0xbba0('0x39')]?_0x103aca[_0xbba0('0x36')]:_0xbeca44['model'];if(_0x3a24e7['query'][_0xbba0('0x45')]){_0x103aca['include']=[{'all':!![]}];}_0x103aca=_[_0xbba0('0x42')]({},_0x103aca,_0x3a24e7[_0xbba0('0x43')]);return db['MailSubstatus'][_0xbba0('0x49')](_0x103aca)['then'](handleEntityNotFound(_0x3e2313,null))[_0xbba0('0x28')](respondWithResult(_0x3e2313,null))[_0xbba0('0x47')](handleError(_0x3e2313,null));};exports[_0xbba0('0x4a')]=function(_0x13309f,_0x5241d4){return db['MailSubstatus'][_0xbba0('0x4a')](_0x13309f[_0xbba0('0x4b')],{})[_0xbba0('0x28')](respondWithResult(_0x5241d4,0xc9))[_0xbba0('0x47')](handleError(_0x5241d4,null));};exports['update']=function(_0x15c2f0,_0xea829a){if(_0x15c2f0['body']['id']){delete _0x15c2f0['body']['id'];}return db['MailSubstatus'][_0xbba0('0x49')]({'where':{'id':_0x15c2f0[_0xbba0('0x48')]['id']}})[_0xbba0('0x28')](handleEntityNotFound(_0xea829a,null))[_0xbba0('0x28')](saveUpdates(_0x15c2f0['body'],null))['then'](respondWithResult(_0xea829a,null))[_0xbba0('0x47')](handleError(_0xea829a,null));};exports['destroy']=function(_0x1083cb,_0x1c9ac3){return db[_0xbba0('0x44')]['find']({'where':{'id':_0x1083cb[_0xbba0('0x48')]['id']}})[_0xbba0('0x28')](handleEntityNotFound(_0x1c9ac3,null))[_0xbba0('0x28')](removeEntity(_0x1c9ac3,null))[_0xbba0('0x47')](handleError(_0x1c9ac3,null));};exports[_0xbba0('0x4c')]=function(_0x23391e,_0x2b9b22){return db[_0xbba0('0x44')]['describe']()[_0xbba0('0x28')](respondWithResult(_0x2b9b22,null))['catch'](handleError(_0x2b9b22,null));}; \ No newline at end of file +var _0xebcc=['key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','limit','order','sort','where','pick','merge','filter','options','include','MailSubstatus','findAll','rows','show','params','includeAll','find','create','body','catch','update','describe','eml-format','rimraf','zip-dir','moment','bluebird','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0xebcc,0xf7));var _0xcebc=function(_0x33da91,_0xfa12b2){_0x33da91=_0x33da91-0x0;var _0x10c04f=_0xebcc[_0x33da91];return _0x10c04f;};'use strict';var emlformat=require(_0xcebc('0x0'));var rimraf=require(_0xcebc('0x1'));var zipdir=require(_0xcebc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcebc('0x3'));var BPromise=require(_0xcebc('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcebc('0x5'));var sox=require('sox');var csv=require(_0xcebc('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcebc('0x7'));var squel=require('squel');var crypto=require(_0xcebc('0x8'));var jsforce=require(_0xcebc('0x9'));var deskjs=require(_0xcebc('0xa'));var toCsv=require(_0xcebc('0x6'));var querystring=require(_0xcebc('0xb'));var Papa=require('papaparse');var Redis=require(_0xcebc('0xc'));var authService=require(_0xcebc('0xd'));var qs=require(_0xcebc('0xe'));var as=require(_0xcebc('0xf'));var hardwareService=require(_0xcebc('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xcebc('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcebc('0x12'))['db'];function respondWithStatusCode(_0x29c9f3,_0x131a12){_0x131a12=_0x131a12||0xcc;return function(_0x374a6b){if(_0x374a6b){return _0x29c9f3[_0xcebc('0x13')](_0x131a12);}return _0x29c9f3[_0xcebc('0x14')](_0x131a12)['end']();};}function respondWithResult(_0x1e8903,_0x14a96d){_0x14a96d=_0x14a96d||0xc8;return function(_0x5af720){if(_0x5af720){return _0x1e8903['status'](_0x14a96d)['json'](_0x5af720);}};}function respondWithFilteredResult(_0x227618,_0x325a99){return function(_0x57ab39){if(_0x57ab39){var _0x30f651=typeof _0x325a99['offset']==='undefined'&&typeof _0x325a99['limit']===_0xcebc('0x15');var _0x47acd9=_0x57ab39[_0xcebc('0x16')];var _0x428ce6=_0x30f651?0x0:_0x325a99[_0xcebc('0x17')];var _0x5cc073=_0x30f651?_0x57ab39[_0xcebc('0x16')]:_0x325a99[_0xcebc('0x17')]+_0x325a99['limit'];var _0x4227d7;if(_0x5cc073>=_0x47acd9){_0x5cc073=_0x47acd9;_0x4227d7=0xc8;}else{_0x4227d7=0xce;}_0x227618[_0xcebc('0x14')](_0x4227d7);return _0x227618[_0xcebc('0x18')](_0xcebc('0x19'),_0x428ce6+'-'+_0x5cc073+'/'+_0x47acd9)[_0xcebc('0x1a')](_0x57ab39);}return null;};}function patchUpdates(_0x2af9bc){return function(_0x2d180f){try{jsonpatch[_0xcebc('0x1b')](_0x2d180f,_0x2af9bc,!![]);}catch(_0x408ecc){return BPromise[_0xcebc('0x1c')](_0x408ecc);}return _0x2d180f[_0xcebc('0x1d')]();};}function saveUpdates(_0x7f1c1b,_0x1f3f4b){return function(_0x1a1524){if(_0x1a1524){return _0x1a1524['update'](_0x7f1c1b)[_0xcebc('0x1e')](function(_0x454de3){return _0x454de3;});}return null;};}function removeEntity(_0xa6ceb1,_0x5cb6c){return function(_0x1ee7db){if(_0x1ee7db){return _0x1ee7db[_0xcebc('0x1f')]()[_0xcebc('0x1e')](function(){_0xa6ceb1[_0xcebc('0x14')](0xcc)[_0xcebc('0x20')]();});}};}function handleEntityNotFound(_0x507ed4,_0xd67350){return function(_0x535ee5){if(!_0x535ee5){_0x507ed4[_0xcebc('0x13')](0x194);}return _0x535ee5;};}function handleError(_0x216723,_0x48a3f0){_0x48a3f0=_0x48a3f0||0x1f4;return function(_0x4766ad){logger['error'](_0x4766ad[_0xcebc('0x21')]);if(_0x4766ad['name']){delete _0x4766ad[_0xcebc('0x22')];}_0x216723['status'](_0x48a3f0)[_0xcebc('0x23')](_0x4766ad);};}exports[_0xcebc('0x24')]=function(_0x19537a,_0x6cf25f){var _0x32f281={},_0x431833={},_0x5edcf0={'count':0x0,'rows':[]};var _0x33df81=_[_0xcebc('0x25')](db['MailSubstatus'][_0xcebc('0x26')],function(_0xb982dd){return{'name':_0xb982dd[_0xcebc('0x27')],'type':_0xb982dd[_0xcebc('0x28')][_0xcebc('0x29')]};});_0x431833['model']=_[_0xcebc('0x25')](_0x33df81,_0xcebc('0x22'));_0x431833[_0xcebc('0x2a')]=_[_0xcebc('0x2b')](_0x19537a[_0xcebc('0x2a')]);_0x431833[_0xcebc('0x2c')]=_[_0xcebc('0x2d')](_0x431833['model'],_0x431833[_0xcebc('0x2a')]);_0x32f281[_0xcebc('0x2e')]=_[_0xcebc('0x2d')](_0x431833['model'],qs[_0xcebc('0x2f')](_0x19537a['query'][_0xcebc('0x2f')]));_0x32f281[_0xcebc('0x2e')]=_0x32f281[_0xcebc('0x2e')][_0xcebc('0x30')]?_0x32f281[_0xcebc('0x2e')]:_0x431833[_0xcebc('0x31')];if(!_0x19537a[_0xcebc('0x2a')][_0xcebc('0x32')]('nolimit')){_0x32f281['limit']=qs['limit'](_0x19537a['query'][_0xcebc('0x33')]);_0x32f281[_0xcebc('0x17')]=qs[_0xcebc('0x17')](_0x19537a[_0xcebc('0x2a')]['offset']);}_0x32f281[_0xcebc('0x34')]=qs['sort'](_0x19537a[_0xcebc('0x2a')][_0xcebc('0x35')]);_0x32f281[_0xcebc('0x36')]=qs['filters'](_[_0xcebc('0x37')](_0x19537a[_0xcebc('0x2a')],_0x431833[_0xcebc('0x2c')]),_0x33df81);if(_0x19537a[_0xcebc('0x2a')]['filter']){_0x32f281[_0xcebc('0x36')]=_[_0xcebc('0x38')](_0x32f281[_0xcebc('0x36')],{'$or':_['map'](_0x33df81,function(_0x35b24a){if(_0x35b24a[_0xcebc('0x28')]!=='VIRTUAL'){var _0x46e4fd={};_0x46e4fd[_0x35b24a[_0xcebc('0x22')]]={'$like':'%'+_0x19537a['query'][_0xcebc('0x39')]+'%'};return _0x46e4fd;}})});}_0x32f281=_[_0xcebc('0x38')]({},_0x32f281,_0x19537a[_0xcebc('0x3a')]);var _0xa61c9a={'where':_0x32f281['where']};return db['MailSubstatus'][_0xcebc('0x16')](_0xa61c9a)['then'](function(_0x2b1dd8){_0x5edcf0[_0xcebc('0x16')]=_0x2b1dd8;if(_0x19537a[_0xcebc('0x2a')]['includeAll']){_0x32f281[_0xcebc('0x3b')]=[{'all':!![]}];}return db[_0xcebc('0x3c')][_0xcebc('0x3d')](_0x32f281);})['then'](function(_0x2ed4f0){_0x5edcf0[_0xcebc('0x3e')]=_0x2ed4f0;return _0x5edcf0;})['then'](respondWithFilteredResult(_0x6cf25f,_0x32f281))['catch'](handleError(_0x6cf25f,null));};exports[_0xcebc('0x3f')]=function(_0x28986c,_0x51c1f8){var _0x1565fa={'raw':!![],'where':{'id':_0x28986c[_0xcebc('0x40')]['id']}},_0xe771a2={};_0xe771a2[_0xcebc('0x31')]=_[_0xcebc('0x2b')](db[_0xcebc('0x3c')][_0xcebc('0x26')]);_0xe771a2['query']=_[_0xcebc('0x2b')](_0x28986c[_0xcebc('0x2a')]);_0xe771a2[_0xcebc('0x2c')]=_[_0xcebc('0x2d')](_0xe771a2['model'],_0xe771a2[_0xcebc('0x2a')]);_0x1565fa['attributes']=_[_0xcebc('0x2d')](_0xe771a2[_0xcebc('0x31')],qs[_0xcebc('0x2f')](_0x28986c[_0xcebc('0x2a')][_0xcebc('0x2f')]));_0x1565fa[_0xcebc('0x2e')]=_0x1565fa[_0xcebc('0x2e')]['length']?_0x1565fa['attributes']:_0xe771a2[_0xcebc('0x31')];if(_0x28986c[_0xcebc('0x2a')][_0xcebc('0x41')]){_0x1565fa[_0xcebc('0x3b')]=[{'all':!![]}];}_0x1565fa=_[_0xcebc('0x38')]({},_0x1565fa,_0x28986c[_0xcebc('0x3a')]);return db['MailSubstatus'][_0xcebc('0x42')](_0x1565fa)[_0xcebc('0x1e')](handleEntityNotFound(_0x51c1f8,null))[_0xcebc('0x1e')](respondWithResult(_0x51c1f8,null))['catch'](handleError(_0x51c1f8,null));};exports['create']=function(_0x230345,_0x325e2d){return db[_0xcebc('0x3c')][_0xcebc('0x43')](_0x230345[_0xcebc('0x44')],{})['then'](respondWithResult(_0x325e2d,0xc9))[_0xcebc('0x45')](handleError(_0x325e2d,null));};exports[_0xcebc('0x46')]=function(_0x36d01b,_0x18061b){if(_0x36d01b['body']['id']){delete _0x36d01b[_0xcebc('0x44')]['id'];}return db[_0xcebc('0x3c')]['find']({'where':{'id':_0x36d01b[_0xcebc('0x40')]['id']}})[_0xcebc('0x1e')](handleEntityNotFound(_0x18061b,null))[_0xcebc('0x1e')](saveUpdates(_0x36d01b[_0xcebc('0x44')],null))['then'](respondWithResult(_0x18061b,null))['catch'](handleError(_0x18061b,null));};exports['destroy']=function(_0x49a9c7,_0x4e02a3){return db[_0xcebc('0x3c')][_0xcebc('0x42')]({'where':{'id':_0x49a9c7[_0xcebc('0x40')]['id']}})['then'](handleEntityNotFound(_0x4e02a3,null))[_0xcebc('0x1e')](removeEntity(_0x4e02a3,null))[_0xcebc('0x45')](handleError(_0x4e02a3,null));};exports[_0xcebc('0x47')]=function(_0x1ffe3c,_0x415781){return db['MailSubstatus'][_0xcebc('0x47')]()[_0xcebc('0x1e')](respondWithResult(_0x415781,null))[_0xcebc('0x45')](handleError(_0x415781,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index d06e2e2..c1578fa 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 _0x18ae=['path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','lodash','util','../../config/logger','moment','bluebird'];(function(_0x2ec4ce,_0x4a526c){var _0x4f84f3=function(_0x385c9c){while(--_0x385c9c){_0x2ec4ce['push'](_0x2ec4ce['shift']());}};_0x4f84f3(++_0x4a526c);}(_0x18ae,0xa3));var _0xe18a=function(_0x9307ea,_0x38968a){_0x9307ea=_0x9307ea-0x0;var _0x295554=_0x18ae[_0x9307ea];return _0x295554;};'use strict';var _=require(_0xe18a('0x0'));var util=require(_0xe18a('0x1'));var logger=require(_0xe18a('0x2'))('api');var moment=require(_0xe18a('0x3'));var BPromise=require(_0xe18a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe18a('0x5'));var rimraf=require(_0xe18a('0x6'));var config=require(_0xe18a('0x7'));var attributes=require(_0xe18a('0x8'));module[_0xe18a('0x9')]=function(_0x14b091,_0x4a2b1d){return _0x14b091[_0xe18a('0xa')](_0xe18a('0xb'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb73=['bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','util','../../config/logger','api','moment'];(function(_0x714456,_0x351ab8){var _0x33687f=function(_0x555fe3){while(--_0x555fe3){_0x714456['push'](_0x714456['shift']());}};_0x33687f(++_0x351ab8);}(_0xdb73,0x100));var _0x3db7=function(_0x2de616,_0x508fc3){_0x2de616=_0x2de616-0x0;var _0x5efc8b=_0xdb73[_0x2de616];return _0x5efc8b;};'use strict';var _=require('lodash');var util=require(_0x3db7('0x0'));var logger=require(_0x3db7('0x1'))(_0x3db7('0x2'));var moment=require(_0x3db7('0x3'));var BPromise=require(_0x3db7('0x4'));var rp=require(_0x3db7('0x5'));var fs=require('fs');var path=require(_0x3db7('0x6'));var rimraf=require(_0x3db7('0x7'));var config=require(_0x3db7('0x8'));var attributes=require(_0x3db7('0x9'));module[_0x3db7('0xa')]=function(_0x3592d5,_0x1eeefa){return _0x3592d5['define'](_0x3db7('0xb'),attributes,{'tableName':_0x3db7('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index f55bd28..c34a539 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 _0x62cd=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x62cd,0x95));var _0xd62c=function(_0x3d7224,_0x23ddd8){_0x3d7224=_0x3d7224-0x0;var _0x56058f=_0x62cd[_0x3d7224];return _0x56058f;};'use strict';var _=require('lodash');var util=require(_0xd62c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd62c('0x1'));var fs=require('fs');var Redis=require(_0xd62c('0x2'));var db=require(_0xd62c('0x3'))['db'];var utils=require(_0xd62c('0x4'));var logger=require(_0xd62c('0x5'))(_0xd62c('0x6'));var config=require(_0xd62c('0x7'));var jayson=require(_0xd62c('0x8'));var client=jayson[_0xd62c('0x9')][_0xd62c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x165418,_0x33983b,_0x4a98a8){return new BPromise(function(_0x3a60d0,_0x4566cf){return client[_0xd62c('0xb')](_0x165418,_0x4a98a8)[_0xd62c('0xc')](function(_0x131355){logger[_0xd62c('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x33983b,'request\x20sent');logger[_0xd62c('0xe')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x33983b,_0xd62c('0xf'),JSON['stringify'](_0x131355));if(_0x131355[_0xd62c('0x10')]){if(_0x131355[_0xd62c('0x10')][_0xd62c('0x11')]===0x1f4){logger[_0xd62c('0x10')](_0xd62c('0x12'),_0x33983b,_0x131355['error'][_0xd62c('0x13')]);return _0x4566cf(_0x131355[_0xd62c('0x10')]['message']);}logger['error'](_0xd62c('0x12'),_0x33983b,_0x131355[_0xd62c('0x10')][_0xd62c('0x13')]);return _0x3a60d0(_0x131355[_0xd62c('0x10')][_0xd62c('0x13')]);}else{logger[_0xd62c('0xd')](_0xd62c('0x12'),_0x33983b,_0xd62c('0xf'));_0x3a60d0(_0x131355[_0xd62c('0x14')][_0xd62c('0x13')]);}})[_0xd62c('0x15')](function(_0xe4469a){logger[_0xd62c('0x10')](_0xd62c('0x12'),_0x33983b,_0xe4469a);_0x4566cf(_0xe4469a);});});} \ No newline at end of file +var _0xa356=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','MailSubstatus,\x20%s,\x20%s','message','result','catch'];(function(_0x4e9fe4,_0x3c9f38){var _0x531c77=function(_0x4ccfd2){while(--_0x4ccfd2){_0x4e9fe4['push'](_0x4e9fe4['shift']());}};_0x531c77(++_0x3c9f38);}(_0xa356,0xb0));var _0x6a35=function(_0x13db53,_0x1e6213){_0x13db53=_0x13db53-0x0;var _0x167bea=_0xa356[_0x13db53];return _0x167bea;};'use strict';var _=require(_0x6a35('0x0'));var util=require(_0x6a35('0x1'));var moment=require(_0x6a35('0x2'));var BPromise=require(_0x6a35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a35('0x4'))['db'];var utils=require(_0x6a35('0x5'));var logger=require(_0x6a35('0x6'))(_0x6a35('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6a35('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd72d9,_0x302f22,_0x27c093){return new BPromise(function(_0x39dc69,_0x25b95b){return client[_0x6a35('0x9')](_0xd72d9,_0x27c093)[_0x6a35('0xa')](function(_0x25271e){logger[_0x6a35('0xb')]('MailSubstatus,\x20%s,\x20%s',_0x302f22,_0x6a35('0xc'));logger[_0x6a35('0xd')](_0x6a35('0xe'),_0x302f22,_0x6a35('0xc'),JSON[_0x6a35('0xf')](_0x25271e));if(_0x25271e['error']){if(_0x25271e[_0x6a35('0x10')][_0x6a35('0x11')]===0x1f4){logger[_0x6a35('0x10')](_0x6a35('0x12'),_0x302f22,_0x25271e[_0x6a35('0x10')]['message']);return _0x25b95b(_0x25271e[_0x6a35('0x10')]['message']);}logger[_0x6a35('0x10')](_0x6a35('0x12'),_0x302f22,_0x25271e[_0x6a35('0x10')][_0x6a35('0x13')]);return _0x39dc69(_0x25271e[_0x6a35('0x10')]['message']);}else{logger[_0x6a35('0xb')](_0x6a35('0x12'),_0x302f22,_0x6a35('0xc'));_0x39dc69(_0x25271e[_0x6a35('0x14')][_0x6a35('0x13')]);}})[_0x6a35('0x15')](function(_0x477fcb){logger[_0x6a35('0x10')](_0x6a35('0x12'),_0x302f22,_0x477fcb);_0x25b95b(_0x477fcb);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index a558b37..a02f581 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 _0x07d5=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x368f32,_0x3e50c9){var _0x10fd44=function(_0x246fd3){while(--_0x246fd3){_0x368f32['push'](_0x368f32['shift']());}};_0x10fd44(++_0x3e50c9);}(_0x07d5,0xf3));var _0x507d=function(_0x410d27,_0x4be5d9){_0x410d27=_0x410d27-0x0;var _0x35716e=_0x07d5[_0x410d27];return _0x35716e;};'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[_0x507d('0x0')]();var fs_extra=require(_0x507d('0x1'));var auth=require(_0x507d('0x2'));var interaction=require(_0x507d('0x3'));var config=require(_0x507d('0x4'));var controller=require('./mailTransferReport.controller');router[_0x507d('0x5')]('/',auth[_0x507d('0x6')](),controller[_0x507d('0x7')]);router[_0x507d('0x5')](_0x507d('0x8'),auth[_0x507d('0x6')](),controller[_0x507d('0x9')]);router[_0x507d('0x5')](_0x507d('0xa'),auth[_0x507d('0x6')](),controller[_0x507d('0xb')]);router[_0x507d('0xc')]('/',auth[_0x507d('0x6')](),controller[_0x507d('0xd')]);router[_0x507d('0xe')](_0x507d('0xa'),auth[_0x507d('0x6')](),controller[_0x507d('0xf')]);router[_0x507d('0x10')](_0x507d('0xa'),auth[_0x507d('0x6')](),controller[_0x507d('0x11')]);module[_0x507d('0x12')]=router; \ No newline at end of file +var _0x9559=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x170941,_0x38d105){var _0x50e48d=function(_0x1eb49a){while(--_0x1eb49a){_0x170941['push'](_0x170941['shift']());}};_0x50e48d(++_0x38d105);}(_0x9559,0x92));var _0x9955=function(_0x1559a5,_0x41924e){_0x1559a5=_0x1559a5-0x0;var _0x17a783=_0x9559[_0x1559a5];return _0x17a783;};'use strict';var multer=require(_0x9955('0x0'));var util=require(_0x9955('0x1'));var path=require(_0x9955('0x2'));var timeout=require(_0x9955('0x3'));var express=require(_0x9955('0x4'));var router=express[_0x9955('0x5')]();var fs_extra=require(_0x9955('0x6'));var auth=require(_0x9955('0x7'));var interaction=require(_0x9955('0x8'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router[_0x9955('0x9')]('/',auth[_0x9955('0xa')](),controller[_0x9955('0xb')]);router[_0x9955('0x9')](_0x9955('0xc'),auth[_0x9955('0xa')](),controller[_0x9955('0xd')]);router[_0x9955('0x9')](_0x9955('0xe'),auth[_0x9955('0xa')](),controller[_0x9955('0xf')]);router[_0x9955('0x10')]('/',auth[_0x9955('0xa')](),controller[_0x9955('0x11')]);router['put'](_0x9955('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9955('0x12')]('/:id',auth[_0x9955('0xa')](),controller[_0x9955('0x13')]);module[_0x9955('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 85e833e..58d23af 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x34e8,0x12c));var _0x834e=function(_0x170c0f,_0x29930b){_0x170c0f=_0x170c0f-0x0;var _0x9a7040=_0x34e8[_0x170c0f];return _0x9a7040;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4a9ad0,_0x32283e){var _0x17a67f=function(_0x4d5344){while(--_0x4d5344){_0x4a9ad0['push'](_0x4a9ad0['shift']());}};_0x17a67f(++_0x32283e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x00bb[_0x411add];return _0x238242;};'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 799b4c6..6a097bc 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 _0x49ed=['filter','merge','type','VIRTUAL','options','count','findAll','rows','catch','show','params','find','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','Content-Range','apply','save','update','then','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x49ed,0x12e));var _0xd49e=function(_0x4c89eb,_0x762741){_0x4c89eb=_0x4c89eb-0x0;var _0x3f16cc=_0x49ed[_0x4c89eb];return _0x3f16cc;};'use strict';var emlformat=require(_0xd49e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd49e('0x1'));var jsonpatch=require(_0xd49e('0x2'));var rp=require('request-promise');var moment=require(_0xd49e('0x3'));var BPromise=require(_0xd49e('0x4'));var Mustache=require(_0xd49e('0x5'));var util=require('util');var path=require(_0xd49e('0x6'));var sox=require('sox');var csv=require(_0xd49e('0x7'));var ejs=require(_0xd49e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd49e('0x9'));var squel=require(_0xd49e('0xa'));var crypto=require('crypto');var jsforce=require(_0xd49e('0xb'));var deskjs=require(_0xd49e('0xc'));var toCsv=require(_0xd49e('0x7'));var querystring=require(_0xd49e('0xd'));var Papa=require(_0xd49e('0xe'));var Redis=require(_0xd49e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xd49e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd49e('0x11'));var logger=require(_0xd49e('0x12'))(_0xd49e('0x13'));var utils=require(_0xd49e('0x14'));var config=require(_0xd49e('0x15'));var licenseUtil=require(_0xd49e('0x16'));var db=require(_0xd49e('0x17'))['db'];function respondWithStatusCode(_0x2e78f6,_0x25a291){_0x25a291=_0x25a291||0xcc;return function(_0x27aa31){if(_0x27aa31){return _0x2e78f6[_0xd49e('0x18')](_0x25a291);}return _0x2e78f6[_0xd49e('0x19')](_0x25a291)[_0xd49e('0x1a')]();};}function respondWithResult(_0x426384,_0x30fd21){_0x30fd21=_0x30fd21||0xc8;return function(_0x322d2e){if(_0x322d2e){return _0x426384['status'](_0x30fd21)[_0xd49e('0x1b')](_0x322d2e);}};}function respondWithFilteredResult(_0x4f9806,_0x20f024){return function(_0x47f4eb){if(_0x47f4eb){var _0x9f7847=typeof _0x20f024['offset']==='undefined'&&typeof _0x20f024['limit']===_0xd49e('0x1c');var _0x4fbe7b=_0x47f4eb['count'];var _0x1710d0=_0x9f7847?0x0:_0x20f024[_0xd49e('0x1d')];var _0x167d05=_0x9f7847?_0x47f4eb['count']:_0x20f024[_0xd49e('0x1d')]+_0x20f024['limit'];var _0x44671e;if(_0x167d05>=_0x4fbe7b){_0x167d05=_0x4fbe7b;_0x44671e=0xc8;}else{_0x44671e=0xce;}_0x4f9806[_0xd49e('0x19')](_0x44671e);return _0x4f9806['set'](_0xd49e('0x1e'),_0x1710d0+'-'+_0x167d05+'/'+_0x4fbe7b)['json'](_0x47f4eb);}return null;};}function patchUpdates(_0x5c59c3){return function(_0x4aeafd){try{jsonpatch[_0xd49e('0x1f')](_0x4aeafd,_0x5c59c3,!![]);}catch(_0x5b14bc){return BPromise['reject'](_0x5b14bc);}return _0x4aeafd[_0xd49e('0x20')]();};}function saveUpdates(_0x2ca193,_0x261fd6){return function(_0x5bc7b3){if(_0x5bc7b3){return _0x5bc7b3[_0xd49e('0x21')](_0x2ca193)[_0xd49e('0x22')](function(_0x80e434){return _0x80e434;});}return null;};}function removeEntity(_0x23ec8b,_0x1319a0){return function(_0x284813){if(_0x284813){return _0x284813['destroy']()[_0xd49e('0x22')](function(){_0x23ec8b[_0xd49e('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2987e2,_0x53005){return function(_0x149287){if(!_0x149287){_0x2987e2['sendStatus'](0x194);}return _0x149287;};}function handleError(_0xbac44f,_0x28fbd7){_0x28fbd7=_0x28fbd7||0x1f4;return function(_0x990909){logger['error'](_0x990909[_0xd49e('0x23')]);if(_0x990909['name']){delete _0x990909[_0xd49e('0x24')];}_0xbac44f[_0xd49e('0x19')](_0x28fbd7)['send'](_0x990909);};}exports[_0xd49e('0x25')]=function(_0x5a5209,_0x3f1b10){var _0x756647={},_0x5b3515={},_0x92da93={'count':0x0,'rows':[]};var _0x565daa=_[_0xd49e('0x26')](db[_0xd49e('0x27')][_0xd49e('0x28')],function(_0x3dc4b0){return{'name':_0x3dc4b0[_0xd49e('0x29')],'type':_0x3dc4b0['type'][_0xd49e('0x2a')]};});_0x5b3515['model']=_[_0xd49e('0x26')](_0x565daa,'name');_0x5b3515['query']=_[_0xd49e('0x2b')](_0x5a5209[_0xd49e('0x2c')]);_0x5b3515[_0xd49e('0x2d')]=_[_0xd49e('0x2e')](_0x5b3515[_0xd49e('0x2f')],_0x5b3515[_0xd49e('0x2c')]);_0x756647[_0xd49e('0x30')]=_[_0xd49e('0x2e')](_0x5b3515[_0xd49e('0x2f')],qs['fields'](_0x5a5209['query'][_0xd49e('0x31')]));_0x756647[_0xd49e('0x30')]=_0x756647[_0xd49e('0x30')][_0xd49e('0x32')]?_0x756647[_0xd49e('0x30')]:_0x5b3515[_0xd49e('0x2f')];if(!_0x5a5209['query'][_0xd49e('0x33')](_0xd49e('0x34'))){_0x756647[_0xd49e('0x35')]=qs[_0xd49e('0x35')](_0x5a5209['query'][_0xd49e('0x35')]);_0x756647[_0xd49e('0x1d')]=qs[_0xd49e('0x1d')](_0x5a5209[_0xd49e('0x2c')][_0xd49e('0x1d')]);}_0x756647[_0xd49e('0x36')]=qs['sort'](_0x5a5209[_0xd49e('0x2c')][_0xd49e('0x37')]);_0x756647[_0xd49e('0x38')]=qs[_0xd49e('0x2d')](_[_0xd49e('0x39')](_0x5a5209['query'],_0x5b3515[_0xd49e('0x2d')]),_0x565daa);if(_0x5a5209[_0xd49e('0x2c')][_0xd49e('0x3a')]){_0x756647['where']=_[_0xd49e('0x3b')](_0x756647[_0xd49e('0x38')],{'$or':_[_0xd49e('0x26')](_0x565daa,function(_0x5de370){if(_0x5de370[_0xd49e('0x3c')]!==_0xd49e('0x3d')){var _0x373dc2={};_0x373dc2[_0x5de370[_0xd49e('0x24')]]={'$like':'%'+_0x5a5209[_0xd49e('0x2c')][_0xd49e('0x3a')]+'%'};return _0x373dc2;}})});}_0x756647=_['merge']({},_0x756647,_0x5a5209[_0xd49e('0x3e')]);var _0x4572b2={'where':_0x756647[_0xd49e('0x38')]};return db[_0xd49e('0x27')]['count'](_0x4572b2)[_0xd49e('0x22')](function(_0x368622){_0x92da93[_0xd49e('0x3f')]=_0x368622;if(_0x5a5209[_0xd49e('0x2c')]['includeAll']){_0x756647['include']=[{'all':!![]}];}return db[_0xd49e('0x27')][_0xd49e('0x40')](_0x756647);})['then'](function(_0x22f5f3){_0x92da93[_0xd49e('0x41')]=_0x22f5f3;return _0x92da93;})[_0xd49e('0x22')](respondWithFilteredResult(_0x3f1b10,_0x756647))[_0xd49e('0x42')](handleError(_0x3f1b10,null));};exports[_0xd49e('0x43')]=function(_0x3ed5c0,_0x2721ed){var _0x35127f={'raw':!![],'where':{'id':_0x3ed5c0[_0xd49e('0x44')]['id']}},_0x53d067={};_0x53d067[_0xd49e('0x2f')]=_[_0xd49e('0x2b')](db[_0xd49e('0x27')][_0xd49e('0x28')]);_0x53d067[_0xd49e('0x2c')]=_[_0xd49e('0x2b')](_0x3ed5c0['query']);_0x53d067[_0xd49e('0x2d')]=_[_0xd49e('0x2e')](_0x53d067[_0xd49e('0x2f')],_0x53d067[_0xd49e('0x2c')]);_0x35127f[_0xd49e('0x30')]=_[_0xd49e('0x2e')](_0x53d067['model'],qs[_0xd49e('0x31')](_0x3ed5c0[_0xd49e('0x2c')][_0xd49e('0x31')]));_0x35127f[_0xd49e('0x30')]=_0x35127f['attributes']['length']?_0x35127f[_0xd49e('0x30')]:_0x53d067[_0xd49e('0x2f')];if(_0x3ed5c0['query']['includeAll']){_0x35127f['include']=[{'all':!![]}];}_0x35127f=_[_0xd49e('0x3b')]({},_0x35127f,_0x3ed5c0['options']);return db[_0xd49e('0x27')][_0xd49e('0x45')](_0x35127f)['then'](handleEntityNotFound(_0x2721ed,null))['then'](respondWithResult(_0x2721ed,null))['catch'](handleError(_0x2721ed,null));};exports['create']=function(_0x129618,_0x22aa3f){return db[_0xd49e('0x27')]['create'](_0x129618[_0xd49e('0x46')],{})[_0xd49e('0x22')](respondWithResult(_0x22aa3f,0xc9))[_0xd49e('0x42')](handleError(_0x22aa3f,null));};exports[_0xd49e('0x21')]=function(_0x2bf7b5,_0x5258c3){if(_0x2bf7b5[_0xd49e('0x46')]['id']){delete _0x2bf7b5[_0xd49e('0x46')]['id'];}return db[_0xd49e('0x27')][_0xd49e('0x45')]({'where':{'id':_0x2bf7b5[_0xd49e('0x44')]['id']}})[_0xd49e('0x22')](handleEntityNotFound(_0x5258c3,null))['then'](saveUpdates(_0x2bf7b5[_0xd49e('0x46')],null))['then'](respondWithResult(_0x5258c3,null))[_0xd49e('0x42')](handleError(_0x5258c3,null));};exports['destroy']=function(_0x3358d1,_0x46d402){return db['MailTransferReport']['find']({'where':{'id':_0x3358d1[_0xd49e('0x44')]['id']}})[_0xd49e('0x22')](handleEntityNotFound(_0x46d402,null))[_0xd49e('0x22')](removeEntity(_0x46d402,null))['catch'](handleError(_0x46d402,null));};exports[_0xd49e('0x47')]=function(_0x2cdeb7,_0x19eb42){return db[_0xd49e('0x27')][_0xd49e('0x47')]()[_0xd49e('0x22')](respondWithResult(_0x19eb42,null))['catch'](handleError(_0x19eb42,null));}; \ No newline at end of file +var _0xbda5=['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/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','then','destroy','name','send','index','MailTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','rows','find','catch','create','body','update','describe'];(function(_0x547add,_0x387042){var _0x2ed1f3=function(_0x3bbb4d){while(--_0x3bbb4d){_0x547add['push'](_0x547add['shift']());}};_0x2ed1f3(++_0x387042);}(_0xbda5,0x168));var _0x5bda=function(_0x522f50,_0x460c5c){_0x522f50=_0x522f50-0x0;var _0x3a1dd9=_0xbda5[_0x522f50];return _0x3a1dd9;};'use strict';var emlformat=require(_0x5bda('0x0'));var rimraf=require(_0x5bda('0x1'));var zipdir=require(_0x5bda('0x2'));var jsonpatch=require(_0x5bda('0x3'));var rp=require(_0x5bda('0x4'));var moment=require(_0x5bda('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5bda('0x6'));var util=require(_0x5bda('0x7'));var path=require(_0x5bda('0x8'));var sox=require(_0x5bda('0x9'));var csv=require(_0x5bda('0xa'));var ejs=require(_0x5bda('0xb'));var fs=require('fs');var fs_extra=require(_0x5bda('0xc'));var _=require('lodash');var squel=require(_0x5bda('0xd'));var crypto=require(_0x5bda('0xe'));var jsforce=require(_0x5bda('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5bda('0xa'));var querystring=require(_0x5bda('0x10'));var Papa=require(_0x5bda('0x11'));var Redis=require(_0x5bda('0x12'));var authService=require(_0x5bda('0x13'));var qs=require(_0x5bda('0x14'));var as=require(_0x5bda('0x15'));var hardwareService=require(_0x5bda('0x16'));var logger=require(_0x5bda('0x17'))(_0x5bda('0x18'));var utils=require('../../config/utils');var config=require(_0x5bda('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13cd76,_0x2d023f){_0x2d023f=_0x2d023f||0xcc;return function(_0x13d128){if(_0x13d128){return _0x13cd76[_0x5bda('0x1a')](_0x2d023f);}return _0x13cd76[_0x5bda('0x1b')](_0x2d023f)[_0x5bda('0x1c')]();};}function respondWithResult(_0x4d3f0f,_0x415774){_0x415774=_0x415774||0xc8;return function(_0x3ac217){if(_0x3ac217){return _0x4d3f0f['status'](_0x415774)[_0x5bda('0x1d')](_0x3ac217);}};}function respondWithFilteredResult(_0x45241,_0x7de545){return function(_0x805948){if(_0x805948){var _0xa50af9=typeof _0x7de545['offset']==='undefined'&&typeof _0x7de545[_0x5bda('0x1e')]===_0x5bda('0x1f');var _0x58277b=_0x805948['count'];var _0x37ed13=_0xa50af9?0x0:_0x7de545['offset'];var _0x270889=_0xa50af9?_0x805948[_0x5bda('0x20')]:_0x7de545[_0x5bda('0x21')]+_0x7de545['limit'];var _0x42566a;if(_0x270889>=_0x58277b){_0x270889=_0x58277b;_0x42566a=0xc8;}else{_0x42566a=0xce;}_0x45241['status'](_0x42566a);return _0x45241['set'](_0x5bda('0x22'),_0x37ed13+'-'+_0x270889+'/'+_0x58277b)[_0x5bda('0x1d')](_0x805948);}return null;};}function patchUpdates(_0x22fa8d){return function(_0x164a59){try{jsonpatch['apply'](_0x164a59,_0x22fa8d,!![]);}catch(_0x43553a){return BPromise[_0x5bda('0x23')](_0x43553a);}return _0x164a59['save']();};}function saveUpdates(_0x4089dd,_0x19a5df){return function(_0x20e4f8){if(_0x20e4f8){return _0x20e4f8['update'](_0x4089dd)[_0x5bda('0x24')](function(_0x45cc97){return _0x45cc97;});}return null;};}function removeEntity(_0x2f21c4,_0x149eb8){return function(_0x33c993){if(_0x33c993){return _0x33c993[_0x5bda('0x25')]()[_0x5bda('0x24')](function(){_0x2f21c4[_0x5bda('0x1b')](0xcc)[_0x5bda('0x1c')]();});}};}function handleEntityNotFound(_0x5f47dc,_0x33c681){return function(_0x53efba){if(!_0x53efba){_0x5f47dc[_0x5bda('0x1a')](0x194);}return _0x53efba;};}function handleError(_0x947928,_0x31977d){_0x31977d=_0x31977d||0x1f4;return function(_0xe78210){logger['error'](_0xe78210['stack']);if(_0xe78210['name']){delete _0xe78210[_0x5bda('0x26')];}_0x947928[_0x5bda('0x1b')](_0x31977d)[_0x5bda('0x27')](_0xe78210);};}exports[_0x5bda('0x28')]=function(_0x229c1e,_0x59b805){var _0x541f25={},_0x26227c={},_0x46c82d={'count':0x0,'rows':[]};var _0xeed30f=_['map'](db[_0x5bda('0x29')][_0x5bda('0x2a')],function(_0xebb4cc){return{'name':_0xebb4cc[_0x5bda('0x2b')],'type':_0xebb4cc[_0x5bda('0x2c')]['key']};});_0x26227c[_0x5bda('0x2d')]=_['map'](_0xeed30f,_0x5bda('0x26'));_0x26227c['query']=_[_0x5bda('0x2e')](_0x229c1e[_0x5bda('0x2f')]);_0x26227c[_0x5bda('0x30')]=_[_0x5bda('0x31')](_0x26227c['model'],_0x26227c[_0x5bda('0x2f')]);_0x541f25[_0x5bda('0x32')]=_['intersection'](_0x26227c['model'],qs['fields'](_0x229c1e[_0x5bda('0x2f')][_0x5bda('0x33')]));_0x541f25['attributes']=_0x541f25[_0x5bda('0x32')][_0x5bda('0x34')]?_0x541f25[_0x5bda('0x32')]:_0x26227c[_0x5bda('0x2d')];if(!_0x229c1e[_0x5bda('0x2f')][_0x5bda('0x35')](_0x5bda('0x36'))){_0x541f25[_0x5bda('0x1e')]=qs[_0x5bda('0x1e')](_0x229c1e[_0x5bda('0x2f')][_0x5bda('0x1e')]);_0x541f25['offset']=qs[_0x5bda('0x21')](_0x229c1e[_0x5bda('0x2f')]['offset']);}_0x541f25[_0x5bda('0x37')]=qs[_0x5bda('0x38')](_0x229c1e['query']['sort']);_0x541f25[_0x5bda('0x39')]=qs[_0x5bda('0x30')](_[_0x5bda('0x3a')](_0x229c1e[_0x5bda('0x2f')],_0x26227c[_0x5bda('0x30')]),_0xeed30f);if(_0x229c1e[_0x5bda('0x2f')][_0x5bda('0x3b')]){_0x541f25[_0x5bda('0x39')]=_['merge'](_0x541f25[_0x5bda('0x39')],{'$or':_[_0x5bda('0x3c')](_0xeed30f,function(_0x35e52e){if(_0x35e52e[_0x5bda('0x2c')]!==_0x5bda('0x3d')){var _0xecfe94={};_0xecfe94[_0x35e52e[_0x5bda('0x26')]]={'$like':'%'+_0x229c1e[_0x5bda('0x2f')][_0x5bda('0x3b')]+'%'};return _0xecfe94;}})});}_0x541f25=_['merge']({},_0x541f25,_0x229c1e[_0x5bda('0x3e')]);var _0x2589f8={'where':_0x541f25[_0x5bda('0x39')]};return db['MailTransferReport'][_0x5bda('0x20')](_0x2589f8)[_0x5bda('0x24')](function(_0x334f99){_0x46c82d[_0x5bda('0x20')]=_0x334f99;if(_0x229c1e[_0x5bda('0x2f')][_0x5bda('0x3f')]){_0x541f25[_0x5bda('0x40')]=[{'all':!![]}];}return db[_0x5bda('0x29')]['findAll'](_0x541f25);})[_0x5bda('0x24')](function(_0x88e00f){_0x46c82d[_0x5bda('0x41')]=_0x88e00f;return _0x46c82d;})['then'](respondWithFilteredResult(_0x59b805,_0x541f25))['catch'](handleError(_0x59b805,null));};exports['show']=function(_0x57f973,_0x1805d){var _0x302d94={'raw':!![],'where':{'id':_0x57f973['params']['id']}},_0x1c37ea={};_0x1c37ea[_0x5bda('0x2d')]=_[_0x5bda('0x2e')](db['MailTransferReport']['rawAttributes']);_0x1c37ea[_0x5bda('0x2f')]=_['keys'](_0x57f973[_0x5bda('0x2f')]);_0x1c37ea[_0x5bda('0x30')]=_[_0x5bda('0x31')](_0x1c37ea[_0x5bda('0x2d')],_0x1c37ea[_0x5bda('0x2f')]);_0x302d94[_0x5bda('0x32')]=_['intersection'](_0x1c37ea[_0x5bda('0x2d')],qs[_0x5bda('0x33')](_0x57f973[_0x5bda('0x2f')][_0x5bda('0x33')]));_0x302d94[_0x5bda('0x32')]=_0x302d94[_0x5bda('0x32')][_0x5bda('0x34')]?_0x302d94[_0x5bda('0x32')]:_0x1c37ea[_0x5bda('0x2d')];if(_0x57f973['query'][_0x5bda('0x3f')]){_0x302d94[_0x5bda('0x40')]=[{'all':!![]}];}_0x302d94=_['merge']({},_0x302d94,_0x57f973[_0x5bda('0x3e')]);return db['MailTransferReport'][_0x5bda('0x42')](_0x302d94)[_0x5bda('0x24')](handleEntityNotFound(_0x1805d,null))[_0x5bda('0x24')](respondWithResult(_0x1805d,null))[_0x5bda('0x43')](handleError(_0x1805d,null));};exports[_0x5bda('0x44')]=function(_0x1379f2,_0x5d1141){return db['MailTransferReport'][_0x5bda('0x44')](_0x1379f2[_0x5bda('0x45')],{})['then'](respondWithResult(_0x5d1141,0xc9))[_0x5bda('0x43')](handleError(_0x5d1141,null));};exports[_0x5bda('0x46')]=function(_0x182026,_0x4a7f93){if(_0x182026[_0x5bda('0x45')]['id']){delete _0x182026[_0x5bda('0x45')]['id'];}return db[_0x5bda('0x29')][_0x5bda('0x42')]({'where':{'id':_0x182026['params']['id']}})[_0x5bda('0x24')](handleEntityNotFound(_0x4a7f93,null))[_0x5bda('0x24')](saveUpdates(_0x182026['body'],null))[_0x5bda('0x24')](respondWithResult(_0x4a7f93,null))['catch'](handleError(_0x4a7f93,null));};exports[_0x5bda('0x25')]=function(_0x1c283f,_0x46238e){return db['MailTransferReport']['find']({'where':{'id':_0x1c283f['params']['id']}})[_0x5bda('0x24')](handleEntityNotFound(_0x46238e,null))[_0x5bda('0x24')](removeEntity(_0x46238e,null))[_0x5bda('0x43')](handleError(_0x46238e,null));};exports[_0x5bda('0x47')]=function(_0x58528b,_0x2d2b6b){return db[_0x5bda('0x29')][_0x5bda('0x47')]()['then'](respondWithResult(_0x2d2b6b,null))[_0x5bda('0x43')](handleError(_0x2d2b6b,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 9a4c613..8e39003 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 _0x4aa3=['lodash','util','api','moment','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid'];(function(_0x7d62cb,_0x7622c){var _0x3a6266=function(_0x1cc5fa){while(--_0x1cc5fa){_0x7d62cb['push'](_0x7d62cb['shift']());}};_0x3a6266(++_0x7622c);}(_0x4aa3,0x174));var _0x34aa=function(_0x2a8f8e,_0x1ddbf6){_0x2a8f8e=_0x2a8f8e-0x0;var _0x13253c=_0x4aa3[_0x2a8f8e];return _0x13253c;};'use strict';var _=require(_0x34aa('0x0'));var util=require(_0x34aa('0x1'));var logger=require('../../config/logger')(_0x34aa('0x2'));var moment=require(_0x34aa('0x3'));var BPromise=require('bluebird');var rp=require(_0x34aa('0x4'));var fs=require('fs');var path=require(_0x34aa('0x5'));var rimraf=require('rimraf');var config=require(_0x34aa('0x6'));var attributes=require(_0x34aa('0x7'));module[_0x34aa('0x8')]=function(_0x5a717c,_0x201f69){return _0x5a717c[_0x34aa('0x9')]('MailTransferReport',attributes,{'tableName':_0x34aa('0xa'),'paranoid':![],'indexes':[{'name':_0x34aa('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x82a7=['define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x597484,_0x199340){var _0x218e64=function(_0x390d55){while(--_0x390d55){_0x597484['push'](_0x597484['shift']());}};_0x218e64(++_0x199340);}(_0x82a7,0x1c4));var _0x782a=function(_0x3daf4b,_0x1a729){_0x3daf4b=_0x3daf4b-0x0;var _0x41c986=_0x82a7[_0x3daf4b];return _0x41c986;};'use strict';var _=require('lodash');var util=require(_0x782a('0x0'));var logger=require(_0x782a('0x1'))(_0x782a('0x2'));var moment=require(_0x782a('0x3'));var BPromise=require(_0x782a('0x4'));var rp=require(_0x782a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x782a('0x6'));var config=require(_0x782a('0x7'));var attributes=require(_0x782a('0x8'));module[_0x782a('0x9')]=function(_0x2fc0df,_0x2c5ea1){return _0x2fc0df[_0x782a('0xa')](_0x782a('0xb'),attributes,{'tableName':_0x782a('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x782a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 7f33fe0..f8d78e2 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 _0xa575=['MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xa575,0x93));var _0x5a57=function(_0xf0a57f,_0x48597b){_0xf0a57f=_0xf0a57f-0x0;var _0x4a5a03=_0xa575[_0xf0a57f];return _0x4a5a03;};'use strict';var _=require(_0x5a57('0x0'));var util=require('util');var moment=require(_0x5a57('0x1'));var BPromise=require(_0x5a57('0x2'));var rs=require(_0x5a57('0x3'));var fs=require('fs');var Redis=require(_0x5a57('0x4'));var db=require(_0x5a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a57('0x6'))(_0x5a57('0x7'));var config=require(_0x5a57('0x8'));var jayson=require(_0x5a57('0x9'));var client=jayson['client'][_0x5a57('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xeafed2,_0xa04158,_0x234aef){return new BPromise(function(_0x290472,_0xe6925e){return client['request'](_0xeafed2,_0x234aef)['then'](function(_0x523e4e){logger[_0x5a57('0xb')](_0x5a57('0xc'),_0xa04158,'request\x20sent');logger['debug'](_0x5a57('0xd'),_0xa04158,_0x5a57('0xe'),JSON[_0x5a57('0xf')](_0x523e4e));if(_0x523e4e[_0x5a57('0x10')]){if(_0x523e4e[_0x5a57('0x10')][_0x5a57('0x11')]===0x1f4){logger[_0x5a57('0x10')]('MailTransferReport,\x20%s,\x20%s',_0xa04158,_0x523e4e[_0x5a57('0x10')][_0x5a57('0x12')]);return _0xe6925e(_0x523e4e[_0x5a57('0x10')][_0x5a57('0x12')]);}logger[_0x5a57('0x10')](_0x5a57('0xc'),_0xa04158,_0x523e4e['error'][_0x5a57('0x12')]);return _0x290472(_0x523e4e[_0x5a57('0x10')]['message']);}else{logger[_0x5a57('0xb')]('MailTransferReport,\x20%s,\x20%s',_0xa04158,_0x5a57('0xe'));_0x290472(_0x523e4e[_0x5a57('0x13')][_0x5a57('0x12')]);}})['catch'](function(_0x20449e){logger[_0x5a57('0x10')]('MailTransferReport,\x20%s,\x20%s',_0xa04158,_0x20449e);_0xe6925e(_0x20449e);});});} \ No newline at end of file +var _0x1c1a=['moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util'];(function(_0x4952b2,_0xd05047){var _0x54d20c=function(_0xdf4a7){while(--_0xdf4a7){_0x4952b2['push'](_0x4952b2['shift']());}};_0x54d20c(++_0xd05047);}(_0x1c1a,0x6a));var _0xa1c1=function(_0x2e7a5a,_0x4814ed){_0x2e7a5a=_0x2e7a5a-0x0;var _0x558495=_0x1c1a[_0x2e7a5a];return _0x558495;};'use strict';var _=require(_0xa1c1('0x0'));var util=require(_0xa1c1('0x1'));var moment=require(_0xa1c1('0x2'));var BPromise=require(_0xa1c1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa1c1('0x4'));var logger=require('../../config/logger')(_0xa1c1('0x5'));var config=require(_0xa1c1('0x6'));var jayson=require(_0xa1c1('0x7'));var client=jayson[_0xa1c1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183ea5,_0xbddb41,_0x2dc822){return new BPromise(function(_0x5122d4,_0x13f651){return client[_0xa1c1('0x9')](_0x183ea5,_0x2dc822)[_0xa1c1('0xa')](function(_0x437f25){logger['info'](_0xa1c1('0xb'),_0xbddb41,_0xa1c1('0xc'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0xbddb41,'request\x20sent',JSON['stringify'](_0x437f25));if(_0x437f25[_0xa1c1('0xd')]){if(_0x437f25[_0xa1c1('0xd')]['code']===0x1f4){logger[_0xa1c1('0xd')](_0xa1c1('0xb'),_0xbddb41,_0x437f25[_0xa1c1('0xd')][_0xa1c1('0xe')]);return _0x13f651(_0x437f25[_0xa1c1('0xd')][_0xa1c1('0xe')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0xbddb41,_0x437f25[_0xa1c1('0xd')][_0xa1c1('0xe')]);return _0x5122d4(_0x437f25[_0xa1c1('0xd')][_0xa1c1('0xe')]);}else{logger[_0xa1c1('0xf')](_0xa1c1('0xb'),_0xbddb41,_0xa1c1('0xc'));_0x5122d4(_0x437f25[_0xa1c1('0x10')]['message']);}})[_0xa1c1('0x11')](function(_0x382a4c){logger[_0xa1c1('0xd')](_0xa1c1('0xb'),_0xbddb41,_0x382a4c);_0x13f651(_0x382a4c);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index ae8d4f1..900f05d 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 _0xc0ae=['destroy','util','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x531e7c,_0x51f86e){var _0x3dba7c=function(_0x274528){while(--_0x274528){_0x531e7c['push'](_0x531e7c['shift']());}};_0x3dba7c(++_0x51f86e);}(_0xc0ae,0x191));var _0xec0a=function(_0x4d6713,_0x36fa2b){_0x4d6713=_0x4d6713-0x0;var _0x15a024=_0xc0ae[_0x4d6713];return _0x15a024;};'use strict';var multer=require('multer');var util=require(_0xec0a('0x0'));var path=require(_0xec0a('0x1'));var timeout=require('connect-timeout');var express=require(_0xec0a('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xec0a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xec0a('0x4'));var controller=require('./memberReport.controller');router[_0xec0a('0x5')]('/',auth[_0xec0a('0x6')](),controller[_0xec0a('0x7')]);router[_0xec0a('0x5')](_0xec0a('0x8'),auth[_0xec0a('0x6')](),controller[_0xec0a('0x9')]);router[_0xec0a('0x5')](_0xec0a('0xa'),auth[_0xec0a('0x6')](),controller[_0xec0a('0xb')]);router['post']('/',auth[_0xec0a('0x6')](),controller['create']);router[_0xec0a('0xc')]('/:id',auth[_0xec0a('0x6')](),controller[_0xec0a('0xd')]);router[_0xec0a('0xe')](_0xec0a('0xa'),auth[_0xec0a('0x6')](),controller[_0xec0a('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdf15=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra'];(function(_0x141582,_0x1e8c1d){var _0x4e3b29=function(_0x457984){while(--_0x457984){_0x141582['push'](_0x141582['shift']());}};_0x4e3b29(++_0x1e8c1d);}(_0xdf15,0x1d0));var _0x5df1=function(_0x341f0e,_0x334b11){_0x341f0e=_0x341f0e-0x0;var _0x5130cc=_0xdf15[_0x341f0e];return _0x5130cc;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5df1('0x0'));var timeout=require(_0x5df1('0x1'));var express=require('express');var router=express[_0x5df1('0x2')]();var fs_extra=require(_0x5df1('0x3'));var auth=require(_0x5df1('0x4'));var interaction=require(_0x5df1('0x5'));var config=require(_0x5df1('0x6'));var controller=require('./memberReport.controller');router[_0x5df1('0x7')]('/',auth[_0x5df1('0x8')](),controller[_0x5df1('0x9')]);router[_0x5df1('0x7')]('/describe',auth[_0x5df1('0x8')](),controller[_0x5df1('0xa')]);router[_0x5df1('0x7')](_0x5df1('0xb'),auth[_0x5df1('0x8')](),controller[_0x5df1('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5df1('0xd')]('/:id',auth[_0x5df1('0x8')](),controller[_0x5df1('0xe')]);router[_0x5df1('0xf')](_0x5df1('0xb'),auth[_0x5df1('0x8')](),controller[_0x5df1('0x10')]);module[_0x5df1('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 3e3058c..711f00b 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 _0x4584=['INTEGER','DATE','getDataValue','diff','seconds','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING'];(function(_0xe6f4ef,_0x4e34cc){var _0x4f3447=function(_0x1538ff){while(--_0x1538ff){_0xe6f4ef['push'](_0xe6f4ef['shift']());}};_0x4f3447(++_0x4e34cc);}(_0x4584,0x1cf));var _0x4458=function(_0x91964a,_0x2dc2f6){_0x91964a=_0x91964a-0x0;var _0x4490b1=_0x4584[_0x91964a];return _0x4490b1;};'use strict';var Sequelize=require(_0x4458('0x0'));var moment=require('moment');module[_0x4458('0x1')]={'channel':{'type':Sequelize[_0x4458('0x2')]},'membername':{'type':Sequelize[_0x4458('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':_0x4458('0x3'),'comment':_0x4458('0x4')},'duration':{'type':Sequelize[_0x4458('0x5')]},'enterAt':{'type':Sequelize[_0x4458('0x6')]},'exitAt':{'type':Sequelize[_0x4458('0x6')],'set':function(_0xbf85ca){var _0x175c2d=moment(_0xbf85ca);var _0x215b2d=moment(this[_0x4458('0x7')]('enterAt'));var _0x14bb0f=_0x175c2d[_0x4458('0x8')](_0x215b2d,_0x4458('0x9'));this[_0x4458('0xa')](_0x4458('0xb'),_0xbf85ca);this[_0x4458('0xa')](_0x4458('0xc'),_0x14bb0f||null);}},'data1':{'type':Sequelize[_0x4458('0x2')],'comment':_0x4458('0xd')},'data2':{'type':Sequelize['STRING'],'comment':_0x4458('0xe')},'data3':{'type':Sequelize[_0x4458('0x2')],'comment':_0x4458('0xf')},'data4':{'type':Sequelize[_0x4458('0x2')],'comment':_0x4458('0x10')},'data5':{'type':Sequelize['STRING'],'comment':_0x4458('0x11')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x4458('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6364=['diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue'];(function(_0x15482e,_0x25b23c){var _0x4a0651=function(_0x5afab4){while(--_0x5afab4){_0x15482e['push'](_0x15482e['shift']());}};_0x4a0651(++_0x25b23c);}(_0x6364,0x8f));var _0x4636=function(_0x36817b,_0x2b3388){_0x36817b=_0x36817b-0x0;var _0x5bf1ac=_0x6364[_0x36817b];return _0x5bf1ac;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x4636('0x0')]={'channel':{'type':Sequelize[_0x4636('0x1')]},'membername':{'type':Sequelize[_0x4636('0x1')]},'interface':{'type':Sequelize[_0x4636('0x1')]},'type':{'type':Sequelize[_0x4636('0x1')],'defaultValue':_0x4636('0x2'),'comment':_0x4636('0x3')},'duration':{'type':Sequelize[_0x4636('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4636('0x5')],'set':function(_0x30201f){var _0x3e0ed6=moment(_0x30201f);var _0x185ea0=moment(this[_0x4636('0x6')]('enterAt'));var _0xd364dc=_0x3e0ed6[_0x4636('0x7')](_0x185ea0,_0x4636('0x8'));this[_0x4636('0x9')]('exitAt',_0x30201f);this[_0x4636('0x9')](_0x4636('0xa'),_0xd364dc||null);}},'data1':{'type':Sequelize[_0x4636('0x1')],'comment':_0x4636('0xb')},'data2':{'type':Sequelize[_0x4636('0x1')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x4636('0x1')],'comment':_0x4636('0xc')},'data4':{'type':Sequelize[_0x4636('0x1')],'comment':_0x4636('0xd')},'data5':{'type':Sequelize['STRING'],'comment':_0x4636('0xe')},'role':{'type':Sequelize[_0x4636('0x1')]},'internal':{'type':Sequelize[_0x4636('0x4')]},'uniqueid':{'type':Sequelize[_0x4636('0x1')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 3d250ef..8ab50f3 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55ca,0x126));var _0xa55c=function(_0x58c86a,_0x602654){_0x58c86a=_0x58c86a-0x0;var _0x2bb374=_0x55ca[_0x58c86a];return _0x2bb374;};'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 _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x84114b,_0x5b092b){var _0x352dd4=function(_0x25191e){while(--_0x25191e){_0x84114b['push'](_0x84114b['shift']());}};_0x352dd4(++_0x5b092b);}(_0x9c44,0x178));var _0x49c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9c44[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 114f2c5..c627f98 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 _0x79a3=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','MemberReport','membername_interface','membername','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x79a3,0x113));var _0x379a=function(_0x443614,_0x31248e){_0x443614=_0x443614-0x0;var _0xfdfbb6=_0x79a3[_0x443614];return _0xfdfbb6;};'use strict';var _=require(_0x379a('0x0'));var util=require(_0x379a('0x1'));var logger=require(_0x379a('0x2'))('api');var moment=require(_0x379a('0x3'));var BPromise=require('bluebird');var rp=require(_0x379a('0x4'));var fs=require('fs');var path=require(_0x379a('0x5'));var rimraf=require(_0x379a('0x6'));var config=require(_0x379a('0x7'));var attributes=require('./memberReport.attributes');module[_0x379a('0x8')]=function(_0x323d14,_0x530734){return _0x323d14['define'](_0x379a('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x379a('0xa'),'fields':[_0x379a('0xb'),'interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfc06=['request-promise','path','rimraf','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc06,0x6a));var _0x6fc0=function(_0x27a6e8,_0x279fa2){_0x27a6e8=_0x27a6e8-0x0;var _0x4a9f98=_0xfc06[_0x27a6e8];return _0x4a9f98;};'use strict';var _=require(_0x6fc0('0x0'));var util=require(_0x6fc0('0x1'));var logger=require(_0x6fc0('0x2'))(_0x6fc0('0x3'));var moment=require(_0x6fc0('0x4'));var BPromise=require(_0x6fc0('0x5'));var rp=require(_0x6fc0('0x6'));var fs=require('fs');var path=require(_0x6fc0('0x7'));var rimraf=require(_0x6fc0('0x8'));var config=require(_0x6fc0('0x9'));var attributes=require(_0x6fc0('0xa'));module[_0x6fc0('0xb')]=function(_0x9dc4bd,_0x462896){return _0x9dc4bd[_0x6fc0('0xc')](_0x6fc0('0xd'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x6fc0('0xe'),'fields':[_0x6fc0('0xf'),'interface']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 925ad6f..16c1dcd 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 _0x84e7=['GetMemberReport','MemberReport','findAll','options','raw','include','map','attributes','model','CreateMemberReport','create','body','catch','UpdateMemberReport','update','where','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result'];(function(_0x2e86f1,_0x2a937c){var _0x571881=function(_0x14ae6c){while(--_0x14ae6c){_0x2e86f1['push'](_0x2e86f1['shift']());}};_0x571881(++_0x2a937c);}(_0x84e7,0x122));var _0x784e=function(_0x2fbe08,_0x208614){_0x2fbe08=_0x2fbe08-0x0;var _0x106750=_0x84e7[_0x2fbe08];return _0x106750;};'use strict';var _=require('lodash');var util=require(_0x784e('0x0'));var moment=require(_0x784e('0x1'));var BPromise=require('bluebird');var rs=require(_0x784e('0x2'));var fs=require('fs');var Redis=require(_0x784e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x784e('0x4'));var logger=require(_0x784e('0x5'))(_0x784e('0x6'));var config=require(_0x784e('0x7'));var jayson=require(_0x784e('0x8'));var client=jayson[_0x784e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cbdd1,_0x5d5595,_0xfaa170){return new BPromise(function(_0x24654d,_0x59a97d){return client[_0x784e('0xa')](_0x3cbdd1,_0xfaa170)[_0x784e('0xb')](function(_0x237b5e){logger[_0x784e('0xc')]('MemberReport,\x20%s,\x20%s',_0x5d5595,'request\x20sent');logger[_0x784e('0xd')](_0x784e('0xe'),_0x5d5595,_0x784e('0xf'),JSON[_0x784e('0x10')](_0x237b5e));if(_0x237b5e['error']){if(_0x237b5e[_0x784e('0x11')][_0x784e('0x12')]===0x1f4){logger[_0x784e('0x11')](_0x784e('0x13'),_0x5d5595,_0x237b5e[_0x784e('0x11')][_0x784e('0x14')]);return _0x59a97d(_0x237b5e['error'][_0x784e('0x14')]);}logger['error'](_0x784e('0x13'),_0x5d5595,_0x237b5e[_0x784e('0x11')][_0x784e('0x14')]);return _0x24654d(_0x237b5e[_0x784e('0x11')][_0x784e('0x14')]);}else{logger[_0x784e('0xc')](_0x784e('0x13'),_0x5d5595,_0x784e('0xf'));_0x24654d(_0x237b5e[_0x784e('0x15')]['message']);}})['catch'](function(_0x112ba1){logger[_0x784e('0x11')](_0x784e('0x13'),_0x5d5595,_0x112ba1);_0x59a97d(_0x112ba1);});});}exports[_0x784e('0x16')]=function(_0x3ac83){var _0x19072b=this;return new Promise(function(_0x1dc568,_0x504ebf){return db[_0x784e('0x17')][_0x784e('0x18')]({'raw':_0x3ac83[_0x784e('0x19')]?_0x3ac83[_0x784e('0x19')][_0x784e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3ac83[_0x784e('0x19')]?_0x3ac83[_0x784e('0x19')]['where']||null:null,'attributes':_0x3ac83['options']?_0x3ac83[_0x784e('0x19')]['attributes']||null:null,'limit':_0x3ac83[_0x784e('0x19')]?_0x3ac83[_0x784e('0x19')]['limit']||null:null,'include':_0x3ac83['options']?_0x3ac83[_0x784e('0x19')][_0x784e('0x1b')]?_[_0x784e('0x1c')](_0x3ac83[_0x784e('0x19')]['include'],function(_0x4fab06){return{'model':db[_0x4fab06['model']],'as':_0x4fab06['as'],'attributes':_0x4fab06[_0x784e('0x1d')],'include':_0x4fab06[_0x784e('0x1b')]?_['map'](_0x4fab06[_0x784e('0x1b')],function(_0x5e809a){return{'model':db[_0x5e809a[_0x784e('0x1e')]],'as':_0x5e809a['as'],'attributes':_0x5e809a['attributes'],'include':_0x5e809a[_0x784e('0x1b')]?_[_0x784e('0x1c')](_0x5e809a[_0x784e('0x1b')],function(_0x7de85b){return{'model':db[_0x7de85b['model']],'as':_0x7de85b['as'],'attributes':_0x7de85b[_0x784e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x784e('0xb')](function(_0x12a246){logger[_0x784e('0xc')]('GetMemberReport',_0x3ac83);logger[_0x784e('0xd')](_0x784e('0x16'),_0x3ac83,JSON['stringify'](_0x12a246));_0x1dc568(_0x12a246);})['catch'](function(_0x3c30b7){logger[_0x784e('0x11')](_0x784e('0x16'),_0x3c30b7[_0x784e('0x14')],_0x3ac83);_0x504ebf(_0x19072b[_0x784e('0x11')](0x1f4,_0x3c30b7[_0x784e('0x14')]));});});};exports[_0x784e('0x1f')]=function(_0x14768f){var _0x42bdfb=this;return new Promise(function(_0x2e18d6,_0x328b70){return db[_0x784e('0x17')][_0x784e('0x20')](_0x14768f[_0x784e('0x21')],{'raw':_0x14768f[_0x784e('0x19')]?_0x14768f['options'][_0x784e('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xc66635){logger[_0x784e('0xc')](_0x784e('0x1f'),_0x14768f);logger['debug'](_0x784e('0x1f'),_0x14768f,JSON['stringify'](_0xc66635));_0x2e18d6(_0xc66635);})[_0x784e('0x22')](function(_0x3525d6){logger['error'](_0x784e('0x1f'),_0x3525d6[_0x784e('0x14')],_0x14768f);_0x328b70(_0x42bdfb['error'](0x1f4,_0x3525d6['message']));});});};exports[_0x784e('0x23')]=function(_0x360e5f){var _0x425722=this;return new Promise(function(_0x4724af,_0x33b2a6){return db['MemberReport'][_0x784e('0x24')](_0x360e5f[_0x784e('0x21')],{'raw':_0x360e5f['options']?_0x360e5f[_0x784e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360e5f['options']?_0x360e5f['options'][_0x784e('0x25')]||null:null,'attributes':_0x360e5f[_0x784e('0x19')]?_0x360e5f['options'][_0x784e('0x1d')]||null:null,'limit':_0x360e5f[_0x784e('0x19')]?_0x360e5f[_0x784e('0x19')][_0x784e('0x26')]||null:null})[_0x784e('0xb')](function(_0x244727){logger['info']('UpdateMemberReport',_0x360e5f);logger[_0x784e('0xd')](_0x784e('0x23'),_0x360e5f,JSON['stringify'](_0x244727));_0x4724af(_0x244727);})['catch'](function(_0x48afec){logger[_0x784e('0x11')](_0x784e('0x23'),_0x48afec['message'],_0x360e5f);_0x33b2a6(_0x425722[_0x784e('0x11')](0x1f4,_0x48afec[_0x784e('0x14')]));});});}; \ No newline at end of file +var _0x9b2c=['MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetMemberReport','MemberReport','findAll','options','where','attributes','limit','include','map','model','catch','create','raw','CreateMemberReport','body','UpdateMemberReport','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x26592f,_0x1ce8bf){var _0x3125da=function(_0x4b1054){while(--_0x4b1054){_0x26592f['push'](_0x26592f['shift']());}};_0x3125da(++_0x1ce8bf);}(_0x9b2c,0x189));var _0xc9b2=function(_0x292911,_0x279a2e){_0x292911=_0x292911-0x0;var _0x18dee9=_0x9b2c[_0x292911];return _0x18dee9;};'use strict';var _=require('lodash');var util=require(_0xc9b2('0x0'));var moment=require(_0xc9b2('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9b2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc9b2('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xc9b2('0x4'))(_0xc9b2('0x5'));var config=require(_0xc9b2('0x6'));var jayson=require(_0xc9b2('0x7'));var client=jayson[_0xc9b2('0x8')][_0xc9b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ab6d0,_0x2c755f,_0x440a3f){return new BPromise(function(_0x224ce6,_0xffd429){return client['request'](_0x3ab6d0,_0x440a3f)[_0xc9b2('0xa')](function(_0x49b2fb){logger['info'](_0xc9b2('0xb'),_0x2c755f,_0xc9b2('0xc'));logger[_0xc9b2('0xd')](_0xc9b2('0xe'),_0x2c755f,_0xc9b2('0xc'),JSON[_0xc9b2('0xf')](_0x49b2fb));if(_0x49b2fb[_0xc9b2('0x10')]){if(_0x49b2fb[_0xc9b2('0x10')][_0xc9b2('0x11')]===0x1f4){logger[_0xc9b2('0x10')](_0xc9b2('0xb'),_0x2c755f,_0x49b2fb[_0xc9b2('0x10')]['message']);return _0xffd429(_0x49b2fb[_0xc9b2('0x10')][_0xc9b2('0x12')]);}logger[_0xc9b2('0x10')](_0xc9b2('0xb'),_0x2c755f,_0x49b2fb['error'][_0xc9b2('0x12')]);return _0x224ce6(_0x49b2fb[_0xc9b2('0x10')][_0xc9b2('0x12')]);}else{logger[_0xc9b2('0x13')](_0xc9b2('0xb'),_0x2c755f,_0xc9b2('0xc'));_0x224ce6(_0x49b2fb[_0xc9b2('0x14')][_0xc9b2('0x12')]);}})['catch'](function(_0x351c79){logger[_0xc9b2('0x10')](_0xc9b2('0xb'),_0x2c755f,_0x351c79);_0xffd429(_0x351c79);});});}exports[_0xc9b2('0x15')]=function(_0x49d95a){var _0x10aca7=this;return new Promise(function(_0xde5092,_0x414df9){return db[_0xc9b2('0x16')][_0xc9b2('0x17')]({'raw':_0x49d95a[_0xc9b2('0x18')]?_0x49d95a[_0xc9b2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49d95a[_0xc9b2('0x18')]?_0x49d95a['options'][_0xc9b2('0x19')]||null:null,'attributes':_0x49d95a[_0xc9b2('0x18')]?_0x49d95a['options'][_0xc9b2('0x1a')]||null:null,'limit':_0x49d95a[_0xc9b2('0x18')]?_0x49d95a['options'][_0xc9b2('0x1b')]||null:null,'include':_0x49d95a['options']?_0x49d95a[_0xc9b2('0x18')][_0xc9b2('0x1c')]?_[_0xc9b2('0x1d')](_0x49d95a[_0xc9b2('0x18')][_0xc9b2('0x1c')],function(_0x16e0e6){return{'model':db[_0x16e0e6[_0xc9b2('0x1e')]],'as':_0x16e0e6['as'],'attributes':_0x16e0e6[_0xc9b2('0x1a')],'include':_0x16e0e6[_0xc9b2('0x1c')]?_[_0xc9b2('0x1d')](_0x16e0e6['include'],function(_0x15dc60){return{'model':db[_0x15dc60[_0xc9b2('0x1e')]],'as':_0x15dc60['as'],'attributes':_0x15dc60[_0xc9b2('0x1a')],'include':_0x15dc60[_0xc9b2('0x1c')]?_['map'](_0x15dc60[_0xc9b2('0x1c')],function(_0x5bdfe8){return{'model':db[_0x5bdfe8[_0xc9b2('0x1e')]],'as':_0x5bdfe8['as'],'attributes':_0x5bdfe8[_0xc9b2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xc9b2('0xa')](function(_0x245385){logger[_0xc9b2('0x13')](_0xc9b2('0x15'),_0x49d95a);logger[_0xc9b2('0xd')](_0xc9b2('0x15'),_0x49d95a,JSON[_0xc9b2('0xf')](_0x245385));_0xde5092(_0x245385);})[_0xc9b2('0x1f')](function(_0x16936f){logger[_0xc9b2('0x10')](_0xc9b2('0x15'),_0x16936f[_0xc9b2('0x12')],_0x49d95a);_0x414df9(_0x10aca7[_0xc9b2('0x10')](0x1f4,_0x16936f[_0xc9b2('0x12')]));});});};exports['CreateMemberReport']=function(_0x5c2277){var _0x3df56f=this;return new Promise(function(_0x34533a,_0x18c55e){return db['MemberReport'][_0xc9b2('0x20')](_0x5c2277['body'],{'raw':_0x5c2277[_0xc9b2('0x18')]?_0x5c2277[_0xc9b2('0x18')][_0xc9b2('0x21')]===undefined?!![]:![]:!![]})[_0xc9b2('0xa')](function(_0x3f7e5d){logger[_0xc9b2('0x13')](_0xc9b2('0x22'),_0x5c2277);logger[_0xc9b2('0xd')]('CreateMemberReport',_0x5c2277,JSON[_0xc9b2('0xf')](_0x3f7e5d));_0x34533a(_0x3f7e5d);})[_0xc9b2('0x1f')](function(_0x1eb98d){logger[_0xc9b2('0x10')]('CreateMemberReport',_0x1eb98d['message'],_0x5c2277);_0x18c55e(_0x3df56f[_0xc9b2('0x10')](0x1f4,_0x1eb98d[_0xc9b2('0x12')]));});});};exports['UpdateMemberReport']=function(_0x5c894d){var _0x3ca922=this;return new Promise(function(_0x5d75b0,_0x3e7da1){return db[_0xc9b2('0x16')]['update'](_0x5c894d[_0xc9b2('0x23')],{'raw':_0x5c894d[_0xc9b2('0x18')]?_0x5c894d[_0xc9b2('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c894d[_0xc9b2('0x18')]?_0x5c894d[_0xc9b2('0x18')][_0xc9b2('0x19')]||null:null,'attributes':_0x5c894d['options']?_0x5c894d['options'][_0xc9b2('0x1a')]||null:null,'limit':_0x5c894d['options']?_0x5c894d[_0xc9b2('0x18')][_0xc9b2('0x1b')]||null:null})['then'](function(_0x2503ce){logger[_0xc9b2('0x13')](_0xc9b2('0x24'),_0x5c894d);logger['debug'](_0xc9b2('0x24'),_0x5c894d,JSON[_0xc9b2('0xf')](_0x2503ce));_0x5d75b0(_0x2503ce);})[_0xc9b2('0x1f')](function(_0x5654a0){logger[_0xc9b2('0x10')]('UpdateMemberReport',_0x5654a0[_0xc9b2('0x12')],_0x5c894d);_0x3e7da1(_0x3ca922[_0xc9b2('0x10')](0x1f4,_0x5654a0[_0xc9b2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 8e61422..95a893f 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 _0x93eb=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','multer','util'];(function(_0x341299,_0x1fa889){var _0x239b88=function(_0x37bb9b){while(--_0x37bb9b){_0x341299['push'](_0x341299['shift']());}};_0x239b88(++_0x1fa889);}(_0x93eb,0x10c));var _0xb93e=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x93eb[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xb93e('0x0'));var util=require(_0xb93e('0x1'));var path=require(_0xb93e('0x2'));var timeout=require(_0xb93e('0x3'));var express=require(_0xb93e('0x4'));var router=express[_0xb93e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb93e('0x6'));var interaction=require(_0xb93e('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xb93e('0x8')]('/',controller[_0xb93e('0x9')]);module['exports']=router; \ No newline at end of file +var _0x2bc5=['Router','fs-extra','../../components/interaction/service','../../config/environment','./migration.controller','get','index','multer','util','path'];(function(_0x56dbc3,_0x41c87a){var _0x58cf7f=function(_0x5a06e7){while(--_0x5a06e7){_0x56dbc3['push'](_0x56dbc3['shift']());}};_0x58cf7f(++_0x41c87a);}(_0x2bc5,0x1ab));var _0x52bc=function(_0x1a286f,_0x374d52){_0x1a286f=_0x1a286f-0x0;var _0x33e8b0=_0x2bc5[_0x1a286f];return _0x33e8b0;};'use strict';var multer=require(_0x52bc('0x0'));var util=require(_0x52bc('0x1'));var path=require(_0x52bc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x52bc('0x3')]();var fs_extra=require(_0x52bc('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x52bc('0x5'));var config=require(_0x52bc('0x6'));var controller=require(_0x52bc('0x7'));router[_0x52bc('0x8')]('/',controller[_0x52bc('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0a562a7..0235494 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 _0x9e01=['STRING','version','exports'];(function(_0x152121,_0x120c53){var _0x592a85=function(_0x241cab){while(--_0x241cab){_0x152121['push'](_0x152121['shift']());}};_0x592a85(++_0x120c53);}(_0x9e01,0xb0));var _0x19e0=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9e01[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0x19e0('0x0')]={'version':{'type':Sequelize[_0x19e0('0x1')],'unique':_0x19e0('0x2')}}; \ No newline at end of file +var _0xc426=['sequelize','exports','STRING','version'];(function(_0x47e2a7,_0x4629b1){var _0x49b9bd=function(_0x5cb99a){while(--_0x5cb99a){_0x47e2a7['push'](_0x47e2a7['shift']());}};_0x49b9bd(++_0x4629b1);}(_0xc426,0x1b8));var _0x6c42=function(_0x8530e0,_0x31d8eb){_0x8530e0=_0x8530e0-0x0;var _0x4d8836=_0xc426[_0x8530e0];return _0x4d8836;};'use strict';var Sequelize=require(_0x6c42('0x0'));module[_0x6c42('0x1')]={'version':{'type':Sequelize[_0x6c42('0x2')],'unique':_0x6c42('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ab008e0..9c2343f 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 _0xd761=['merge','count','includeAll','include','findAll','rows','catch','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','apply','reject','update','then','destroy','error','stack','name','send','index','Migration','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','nolimit','order','sort','pick','filter','where'];(function(_0x5f0dbd,_0x3d801a){var _0x521591=function(_0xbb17ad){while(--_0xbb17ad){_0x5f0dbd['push'](_0x5f0dbd['shift']());}};_0x521591(++_0x3d801a);}(_0xd761,0x1ea));var _0x1d76=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0xd761[_0x494d1f];return _0x457b6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1d76('0x0'));var zipdir=require(_0x1d76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d76('0x2'));var moment=require('moment');var BPromise=require(_0x1d76('0x3'));var Mustache=require(_0x1d76('0x4'));var util=require(_0x1d76('0x5'));var path=require(_0x1d76('0x6'));var sox=require(_0x1d76('0x7'));var csv=require(_0x1d76('0x8'));var ejs=require(_0x1d76('0x9'));var fs=require('fs');var fs_extra=require(_0x1d76('0xa'));var _=require(_0x1d76('0xb'));var squel=require(_0x1d76('0xc'));var crypto=require(_0x1d76('0xd'));var jsforce=require(_0x1d76('0xe'));var deskjs=require(_0x1d76('0xf'));var toCsv=require(_0x1d76('0x8'));var querystring=require('querystring');var Papa=require(_0x1d76('0x10'));var Redis=require(_0x1d76('0x11'));var authService=require(_0x1d76('0x12'));var qs=require(_0x1d76('0x13'));var as=require(_0x1d76('0x14'));var hardwareService=require(_0x1d76('0x15'));var logger=require(_0x1d76('0x16'))(_0x1d76('0x17'));var utils=require(_0x1d76('0x18'));var config=require(_0x1d76('0x19'));var licenseUtil=require(_0x1d76('0x1a'));var db=require(_0x1d76('0x1b'))['db'];function respondWithStatusCode(_0x41f28e,_0x1aa494){_0x1aa494=_0x1aa494||0xcc;return function(_0x1518c7){if(_0x1518c7){return _0x41f28e[_0x1d76('0x1c')](_0x1aa494);}return _0x41f28e[_0x1d76('0x1d')](_0x1aa494)[_0x1d76('0x1e')]();};}function respondWithResult(_0x405991,_0x570495){_0x570495=_0x570495||0xc8;return function(_0x398adc){if(_0x398adc){return _0x405991[_0x1d76('0x1d')](_0x570495)[_0x1d76('0x1f')](_0x398adc);}};}function respondWithFilteredResult(_0x43ac16,_0x3dcea6){return function(_0x6f0de){if(_0x6f0de){var _0x37aaa6=typeof _0x3dcea6['offset']===_0x1d76('0x20')&&typeof _0x3dcea6[_0x1d76('0x21')]===_0x1d76('0x20');var _0x32c175=_0x6f0de['count'];var _0x171ebe=_0x37aaa6?0x0:_0x3dcea6['offset'];var _0x574230=_0x37aaa6?_0x6f0de['count']:_0x3dcea6[_0x1d76('0x22')]+_0x3dcea6[_0x1d76('0x21')];var _0x207f36;if(_0x574230>=_0x32c175){_0x574230=_0x32c175;_0x207f36=0xc8;}else{_0x207f36=0xce;}_0x43ac16[_0x1d76('0x1d')](_0x207f36);return _0x43ac16['set']('Content-Range',_0x171ebe+'-'+_0x574230+'/'+_0x32c175)[_0x1d76('0x1f')](_0x6f0de);}return null;};}function patchUpdates(_0x7939c3){return function(_0x53c859){try{jsonpatch[_0x1d76('0x23')](_0x53c859,_0x7939c3,!![]);}catch(_0xa1feb4){return BPromise[_0x1d76('0x24')](_0xa1feb4);}return _0x53c859['save']();};}function saveUpdates(_0x2b22d4,_0x38f0ef){return function(_0x3a20ed){if(_0x3a20ed){return _0x3a20ed[_0x1d76('0x25')](_0x2b22d4)[_0x1d76('0x26')](function(_0x4358bb){return _0x4358bb;});}return null;};}function removeEntity(_0x57d773,_0x101e53){return function(_0x2e8fe7){if(_0x2e8fe7){return _0x2e8fe7[_0x1d76('0x27')]()[_0x1d76('0x26')](function(){_0x57d773[_0x1d76('0x1d')](0xcc)[_0x1d76('0x1e')]();});}};}function handleEntityNotFound(_0x2c4f66,_0x53b3a6){return function(_0x5801c9){if(!_0x5801c9){_0x2c4f66['sendStatus'](0x194);}return _0x5801c9;};}function handleError(_0x102d37,_0x30c1a8){_0x30c1a8=_0x30c1a8||0x1f4;return function(_0x55ff21){logger[_0x1d76('0x28')](_0x55ff21[_0x1d76('0x29')]);if(_0x55ff21[_0x1d76('0x2a')]){delete _0x55ff21[_0x1d76('0x2a')];}_0x102d37[_0x1d76('0x1d')](_0x30c1a8)[_0x1d76('0x2b')](_0x55ff21);};}exports[_0x1d76('0x2c')]=function(_0x18f980,_0x5f0be6){var _0x3998a0={},_0x2fc93c={},_0x51342a={'count':0x0,'rows':[]};var _0x50d513=_['map'](db[_0x1d76('0x2d')][_0x1d76('0x2e')],function(_0x50af26){return{'name':_0x50af26['fieldName'],'type':_0x50af26[_0x1d76('0x2f')][_0x1d76('0x30')]};});_0x2fc93c[_0x1d76('0x31')]=_[_0x1d76('0x32')](_0x50d513,_0x1d76('0x2a'));_0x2fc93c[_0x1d76('0x33')]=_[_0x1d76('0x34')](_0x18f980[_0x1d76('0x33')]);_0x2fc93c['filters']=_[_0x1d76('0x35')](_0x2fc93c[_0x1d76('0x31')],_0x2fc93c[_0x1d76('0x33')]);_0x3998a0[_0x1d76('0x36')]=_[_0x1d76('0x35')](_0x2fc93c[_0x1d76('0x31')],qs[_0x1d76('0x37')](_0x18f980['query'][_0x1d76('0x37')]));_0x3998a0['attributes']=_0x3998a0[_0x1d76('0x36')]['length']?_0x3998a0[_0x1d76('0x36')]:_0x2fc93c[_0x1d76('0x31')];if(!_0x18f980[_0x1d76('0x33')]['hasOwnProperty'](_0x1d76('0x38'))){_0x3998a0['limit']=qs['limit'](_0x18f980[_0x1d76('0x33')][_0x1d76('0x21')]);_0x3998a0[_0x1d76('0x22')]=qs[_0x1d76('0x22')](_0x18f980['query'][_0x1d76('0x22')]);}_0x3998a0[_0x1d76('0x39')]=qs[_0x1d76('0x3a')](_0x18f980['query'][_0x1d76('0x3a')]);_0x3998a0['where']=qs['filters'](_[_0x1d76('0x3b')](_0x18f980[_0x1d76('0x33')],_0x2fc93c['filters']),_0x50d513);if(_0x18f980[_0x1d76('0x33')][_0x1d76('0x3c')]){_0x3998a0[_0x1d76('0x3d')]=_[_0x1d76('0x3e')](_0x3998a0[_0x1d76('0x3d')],{'$or':_['map'](_0x50d513,function(_0x1f14ad){if(_0x1f14ad[_0x1d76('0x2f')]!=='VIRTUAL'){var _0x3459ec={};_0x3459ec[_0x1f14ad[_0x1d76('0x2a')]]={'$like':'%'+_0x18f980[_0x1d76('0x33')][_0x1d76('0x3c')]+'%'};return _0x3459ec;}})});}_0x3998a0=_[_0x1d76('0x3e')]({},_0x3998a0,_0x18f980['options']);var _0x136809={'where':_0x3998a0[_0x1d76('0x3d')]};return db[_0x1d76('0x2d')][_0x1d76('0x3f')](_0x136809)['then'](function(_0x57dc66){_0x51342a[_0x1d76('0x3f')]=_0x57dc66;if(_0x18f980[_0x1d76('0x33')][_0x1d76('0x40')]){_0x3998a0[_0x1d76('0x41')]=[{'all':!![]}];}return db[_0x1d76('0x2d')][_0x1d76('0x42')](_0x3998a0);})[_0x1d76('0x26')](function(_0x93fb73){_0x51342a[_0x1d76('0x43')]=_0x93fb73;return _0x51342a;})[_0x1d76('0x26')](respondWithFilteredResult(_0x5f0be6,_0x3998a0))[_0x1d76('0x44')](handleError(_0x5f0be6,null));}; \ No newline at end of file +var _0x8b70=['type','key','model','name','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','Migration','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','send','index','map','rawAttributes','fieldName'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8b70,0x1c2));var _0x08b7=function(_0x43e885,_0x5700f1){_0x43e885=_0x43e885-0x0;var _0x18df65=_0x8b70[_0x43e885];return _0x18df65;};'use strict';var emlformat=require(_0x08b7('0x0'));var rimraf=require(_0x08b7('0x1'));var zipdir=require(_0x08b7('0x2'));var jsonpatch=require(_0x08b7('0x3'));var rp=require(_0x08b7('0x4'));var moment=require(_0x08b7('0x5'));var BPromise=require(_0x08b7('0x6'));var Mustache=require(_0x08b7('0x7'));var util=require('util');var path=require('path');var sox=require(_0x08b7('0x8'));var csv=require('to-csv');var ejs=require(_0x08b7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x08b7('0xa'));var squel=require(_0x08b7('0xb'));var crypto=require(_0x08b7('0xc'));var jsforce=require(_0x08b7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x08b7('0xe'));var querystring=require(_0x08b7('0xf'));var Papa=require(_0x08b7('0x10'));var Redis=require(_0x08b7('0x11'));var authService=require(_0x08b7('0x12'));var qs=require(_0x08b7('0x13'));var as=require(_0x08b7('0x14'));var hardwareService=require(_0x08b7('0x15'));var logger=require('../../config/logger')(_0x08b7('0x16'));var utils=require(_0x08b7('0x17'));var config=require(_0x08b7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x08b7('0x19'))['db'];function respondWithStatusCode(_0x4d9461,_0x5077e4){_0x5077e4=_0x5077e4||0xcc;return function(_0x11dbe4){if(_0x11dbe4){return _0x4d9461[_0x08b7('0x1a')](_0x5077e4);}return _0x4d9461[_0x08b7('0x1b')](_0x5077e4)[_0x08b7('0x1c')]();};}function respondWithResult(_0x471f49,_0x1e47ad){_0x1e47ad=_0x1e47ad||0xc8;return function(_0x16d489){if(_0x16d489){return _0x471f49[_0x08b7('0x1b')](_0x1e47ad)[_0x08b7('0x1d')](_0x16d489);}};}function respondWithFilteredResult(_0x2fe984,_0x3143d8){return function(_0x2aca98){if(_0x2aca98){var _0x7742bb=typeof _0x3143d8[_0x08b7('0x1e')]===_0x08b7('0x1f')&&typeof _0x3143d8[_0x08b7('0x20')]==='undefined';var _0x1876b6=_0x2aca98[_0x08b7('0x21')];var _0x7b2d84=_0x7742bb?0x0:_0x3143d8[_0x08b7('0x1e')];var _0x2e1eff=_0x7742bb?_0x2aca98[_0x08b7('0x21')]:_0x3143d8['offset']+_0x3143d8[_0x08b7('0x20')];var _0x1b115b;if(_0x2e1eff>=_0x1876b6){_0x2e1eff=_0x1876b6;_0x1b115b=0xc8;}else{_0x1b115b=0xce;}_0x2fe984[_0x08b7('0x1b')](_0x1b115b);return _0x2fe984[_0x08b7('0x22')](_0x08b7('0x23'),_0x7b2d84+'-'+_0x2e1eff+'/'+_0x1876b6)['json'](_0x2aca98);}return null;};}function patchUpdates(_0x1dd31a){return function(_0x523e37){try{jsonpatch[_0x08b7('0x24')](_0x523e37,_0x1dd31a,!![]);}catch(_0x10ad92){return BPromise[_0x08b7('0x25')](_0x10ad92);}return _0x523e37[_0x08b7('0x26')]();};}function saveUpdates(_0x2862f4,_0x434930){return function(_0x26c43e){if(_0x26c43e){return _0x26c43e['update'](_0x2862f4)[_0x08b7('0x27')](function(_0x31d3c6){return _0x31d3c6;});}return null;};}function removeEntity(_0x54f5b4,_0x446b4f){return function(_0x5bfa84){if(_0x5bfa84){return _0x5bfa84[_0x08b7('0x28')]()[_0x08b7('0x27')](function(){_0x54f5b4[_0x08b7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x166fd9,_0x4dc676){return function(_0x20eff3){if(!_0x20eff3){_0x166fd9['sendStatus'](0x194);}return _0x20eff3;};}function handleError(_0x4790c1,_0x306290){_0x306290=_0x306290||0x1f4;return function(_0xc8700b){logger[_0x08b7('0x29')](_0xc8700b['stack']);if(_0xc8700b['name']){delete _0xc8700b['name'];}_0x4790c1[_0x08b7('0x1b')](_0x306290)[_0x08b7('0x2a')](_0xc8700b);};}exports[_0x08b7('0x2b')]=function(_0x2c25d5,_0x38abdc){var _0x1d80b9={},_0x591736={},_0x4e138e={'count':0x0,'rows':[]};var _0x37757f=_[_0x08b7('0x2c')](db['Migration'][_0x08b7('0x2d')],function(_0x18c95f){return{'name':_0x18c95f[_0x08b7('0x2e')],'type':_0x18c95f[_0x08b7('0x2f')][_0x08b7('0x30')]};});_0x591736[_0x08b7('0x31')]=_[_0x08b7('0x2c')](_0x37757f,_0x08b7('0x32'));_0x591736[_0x08b7('0x33')]=_[_0x08b7('0x34')](_0x2c25d5[_0x08b7('0x33')]);_0x591736[_0x08b7('0x35')]=_['intersection'](_0x591736[_0x08b7('0x31')],_0x591736['query']);_0x1d80b9['attributes']=_['intersection'](_0x591736[_0x08b7('0x31')],qs['fields'](_0x2c25d5['query']['fields']));_0x1d80b9[_0x08b7('0x36')]=_0x1d80b9[_0x08b7('0x36')][_0x08b7('0x37')]?_0x1d80b9[_0x08b7('0x36')]:_0x591736[_0x08b7('0x31')];if(!_0x2c25d5['query'][_0x08b7('0x38')](_0x08b7('0x39'))){_0x1d80b9[_0x08b7('0x20')]=qs['limit'](_0x2c25d5['query'][_0x08b7('0x20')]);_0x1d80b9[_0x08b7('0x1e')]=qs[_0x08b7('0x1e')](_0x2c25d5[_0x08b7('0x33')]['offset']);}_0x1d80b9[_0x08b7('0x3a')]=qs[_0x08b7('0x3b')](_0x2c25d5['query'][_0x08b7('0x3b')]);_0x1d80b9[_0x08b7('0x3c')]=qs[_0x08b7('0x35')](_[_0x08b7('0x3d')](_0x2c25d5[_0x08b7('0x33')],_0x591736['filters']),_0x37757f);if(_0x2c25d5[_0x08b7('0x33')][_0x08b7('0x3e')]){_0x1d80b9[_0x08b7('0x3c')]=_['merge'](_0x1d80b9[_0x08b7('0x3c')],{'$or':_['map'](_0x37757f,function(_0x1d0c2b){if(_0x1d0c2b[_0x08b7('0x2f')]!==_0x08b7('0x3f')){var _0x5747fc={};_0x5747fc[_0x1d0c2b[_0x08b7('0x32')]]={'$like':'%'+_0x2c25d5[_0x08b7('0x33')][_0x08b7('0x3e')]+'%'};return _0x5747fc;}})});}_0x1d80b9=_['merge']({},_0x1d80b9,_0x2c25d5[_0x08b7('0x40')]);var _0x364f14={'where':_0x1d80b9[_0x08b7('0x3c')]};return db['Migration']['count'](_0x364f14)[_0x08b7('0x27')](function(_0x4fc7b2){_0x4e138e[_0x08b7('0x21')]=_0x4fc7b2;if(_0x2c25d5['query'][_0x08b7('0x41')]){_0x1d80b9[_0x08b7('0x42')]=[{'all':!![]}];}return db[_0x08b7('0x43')][_0x08b7('0x44')](_0x1d80b9);})['then'](function(_0x1e9687){_0x4e138e[_0x08b7('0x45')]=_0x1e9687;return _0x4e138e;})[_0x08b7('0x27')](respondWithFilteredResult(_0x38abdc,_0x1d80b9))[_0x08b7('0x46')](handleError(_0x38abdc,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 23849ae..45cbcbb 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 _0x3661=['Migration','migrations','lodash','util','../../config/logger','api','bluebird','request-promise','path','./migration.attributes','define'];(function(_0x1aaf25,_0x268f63){var _0x1e12b5=function(_0x17f320){while(--_0x17f320){_0x1aaf25['push'](_0x1aaf25['shift']());}};_0x1e12b5(++_0x268f63);}(_0x3661,0x12b));var _0x1366=function(_0x45347e,_0x306cdf){_0x45347e=_0x45347e-0x0;var _0x2a11f4=_0x3661[_0x45347e];return _0x2a11f4;};'use strict';var _=require(_0x1366('0x0'));var util=require(_0x1366('0x1'));var logger=require(_0x1366('0x2'))(_0x1366('0x3'));var moment=require('moment');var BPromise=require(_0x1366('0x4'));var rp=require(_0x1366('0x5'));var fs=require('fs');var path=require(_0x1366('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1366('0x7'));module['exports']=function(_0x18090b,_0x5cf3a5){return _0x18090b[_0x1366('0x8')](_0x1366('0x9'),attributes,{'tableName':_0x1366('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73d2=['util','api','moment','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','migrations'];(function(_0x367d36,_0xee2a72){var _0x35c6eb=function(_0x2a0c6a){while(--_0x2a0c6a){_0x367d36['push'](_0x367d36['shift']());}};_0x35c6eb(++_0xee2a72);}(_0x73d2,0x1a4));var _0x273d=function(_0x3fd52c,_0x576501){_0x3fd52c=_0x3fd52c-0x0;var _0x39a15d=_0x73d2[_0x3fd52c];return _0x39a15d;};'use strict';var _=require('lodash');var util=require(_0x273d('0x0'));var logger=require('../../config/logger')(_0x273d('0x1'));var moment=require(_0x273d('0x2'));var BPromise=require('bluebird');var rp=require(_0x273d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x273d('0x4'));var config=require(_0x273d('0x5'));var attributes=require(_0x273d('0x6'));module[_0x273d('0x7')]=function(_0x3656db,_0x5d7397){return _0x3656db[_0x273d('0x8')]('Migration',attributes,{'tableName':_0x273d('0x9'),'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 a0ac97e..18bda90 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 _0xefe3=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring'];(function(_0x1bebb0,_0x1253ba){var _0x1cfd40=function(_0x1183b7){while(--_0x1183b7){_0x1bebb0['push'](_0x1bebb0['shift']());}};_0x1cfd40(++_0x1253ba);}(_0xefe3,0xf5));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3efe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3efe('0x1'));var fs=require('fs');var Redis=require(_0x3efe('0x2'));var db=require(_0x3efe('0x3'))['db'];var utils=require(_0x3efe('0x4'));var logger=require('../../config/logger')(_0x3efe('0x5'));var config=require('../../config/environment');var jayson=require(_0x3efe('0x6'));var client=jayson['client'][_0x3efe('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x60487e,_0x1f697b,_0x195d5d){return new BPromise(function(_0x30d2e8,_0x474c9a){return client['request'](_0x60487e,_0x195d5d)[_0x3efe('0x8')](function(_0x54fec1){logger[_0x3efe('0x9')](_0x3efe('0xa'),_0x1f697b,_0x3efe('0xb'));logger[_0x3efe('0xc')](_0x3efe('0xd'),_0x1f697b,_0x3efe('0xb'),JSON['stringify'](_0x54fec1));if(_0x54fec1['error']){if(_0x54fec1[_0x3efe('0xe')][_0x3efe('0xf')]===0x1f4){logger[_0x3efe('0xe')](_0x3efe('0xa'),_0x1f697b,_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);return _0x474c9a(_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);}logger[_0x3efe('0xe')](_0x3efe('0xa'),_0x1f697b,_0x54fec1[_0x3efe('0xe')]['message']);return _0x30d2e8(_0x54fec1[_0x3efe('0xe')][_0x3efe('0x10')]);}else{logger[_0x3efe('0x9')](_0x3efe('0xa'),_0x1f697b,'request\x20sent');_0x30d2e8(_0x54fec1[_0x3efe('0x11')][_0x3efe('0x10')]);}})[_0x3efe('0x12')](function(_0x515e1b){logger['error'](_0x3efe('0xa'),_0x1f697b,_0x515e1b);_0x474c9a(_0x515e1b);});});} \ No newline at end of file +var _0x5825=['then','info','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x163304,_0x46c423){var _0x3ca324=function(_0x35f4c1){while(--_0x35f4c1){_0x163304['push'](_0x163304['shift']());}};_0x3ca324(++_0x46c423);}(_0x5825,0x78));var _0x5582=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5825[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x5582('0x0'));var util=require(_0x5582('0x1'));var moment=require(_0x5582('0x2'));var BPromise=require(_0x5582('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5582('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5582('0x5'));var logger=require(_0x5582('0x6'))(_0x5582('0x7'));var config=require(_0x5582('0x8'));var jayson=require(_0x5582('0x9'));var client=jayson[_0x5582('0xa')][_0x5582('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d618a,_0x17ade9,_0x588f5f){return new BPromise(function(_0x39b66,_0x5fa603){return client['request'](_0x5d618a,_0x588f5f)[_0x5582('0xc')](function(_0x3aa455){logger[_0x5582('0xd')]('Migration,\x20%s,\x20%s',_0x17ade9,_0x5582('0xe'));logger[_0x5582('0xf')](_0x5582('0x10'),_0x17ade9,'request\x20sent',JSON[_0x5582('0x11')](_0x3aa455));if(_0x3aa455[_0x5582('0x12')]){if(_0x3aa455['error'][_0x5582('0x13')]===0x1f4){logger[_0x5582('0x12')]('Migration,\x20%s,\x20%s',_0x17ade9,_0x3aa455['error'][_0x5582('0x14')]);return _0x5fa603(_0x3aa455['error']['message']);}logger[_0x5582('0x12')](_0x5582('0x15'),_0x17ade9,_0x3aa455['error'][_0x5582('0x14')]);return _0x39b66(_0x3aa455[_0x5582('0x12')]['message']);}else{logger[_0x5582('0xd')](_0x5582('0x15'),_0x17ade9,'request\x20sent');_0x39b66(_0x3aa455['result'][_0x5582('0x14')]);}})['catch'](function(_0x378fa8){logger[_0x5582('0x12')](_0x5582('0x15'),_0x17ade9,_0x378fa8);_0x5fa603(_0x378fa8);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 877e39b..37ee156 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 _0x78f4=['isAuthenticated','index','/:id','post','create','put','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./network.controller'];(function(_0x19b2d2,_0x2485b2){var _0x183e8e=function(_0x47b88b){while(--_0x47b88b){_0x19b2d2['push'](_0x19b2d2['shift']());}};_0x183e8e(++_0x2485b2);}(_0x78f4,0x1c8));var _0x478f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x78f4[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x478f('0x0'));var path=require(_0x478f('0x1'));var timeout=require(_0x478f('0x2'));var express=require(_0x478f('0x3'));var router=express['Router']();var fs_extra=require(_0x478f('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x478f('0x5'));var config=require(_0x478f('0x6'));var controller=require(_0x478f('0x7'));router['get']('/',auth[_0x478f('0x8')](),controller[_0x478f('0x9')]);router['get'](_0x478f('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x478f('0xb')]('/',auth['isAuthenticated'](),controller[_0x478f('0xc')]);router[_0x478f('0xd')](_0x478f('0xa'),auth[_0x478f('0x8')](),controller['update']);router['delete'](_0x478f('0xa'),auth[_0x478f('0x8')](),controller[_0x478f('0xe')]);module[_0x478f('0xf')]=router; \ No newline at end of file +var _0x85de=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','index','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4542ac,_0x1eead3){var _0x4dd0e5=function(_0x32dffd){while(--_0x32dffd){_0x4542ac['push'](_0x4542ac['shift']());}};_0x4dd0e5(++_0x1eead3);}(_0x85de,0x65));var _0xe85d=function(_0x4e318c,_0x2e802c){_0x4e318c=_0x4e318c-0x0;var _0x10bd03=_0x85de[_0x4e318c];return _0x10bd03;};'use strict';var multer=require(_0xe85d('0x0'));var util=require(_0xe85d('0x1'));var path=require(_0xe85d('0x2'));var timeout=require(_0xe85d('0x3'));var express=require(_0xe85d('0x4'));var router=express[_0xe85d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe85d('0x6'));var interaction=require(_0xe85d('0x7'));var config=require(_0xe85d('0x8'));var controller=require(_0xe85d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xe85d('0xa')]);router[_0xe85d('0xb')](_0xe85d('0xc'),auth[_0xe85d('0xd')](),controller['show']);router[_0xe85d('0xe')]('/',auth[_0xe85d('0xd')](),controller[_0xe85d('0xf')]);router[_0xe85d('0x10')](_0xe85d('0xc'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x11')]);router[_0xe85d('0x12')](_0xe85d('0xc'),auth[_0xe85d('0xd')](),controller[_0xe85d('0x13')]);module[_0xe85d('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index c961aba..88577e6 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 _0xb703=['externip','stun','turn','STRING','sequelize','exports','ENUM','localnet'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xb703,0x7c));var _0x3b70=function(_0x3cfc44,_0x11d90c){_0x3cfc44=_0x3cfc44-0x0;var _0x3c02c0=_0xb703[_0x3cfc44];return _0x3c02c0;};'use strict';var Sequelize=require(_0x3b70('0x0'));module[_0x3b70('0x1')]={'type':{'type':Sequelize[_0x3b70('0x2')](_0x3b70('0x3'),_0x3b70('0x4'),_0x3b70('0x5'),_0x3b70('0x6'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3b70('0x7')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x51e8=['ENUM','localnet','externip','STRING','sequelize','exports'];(function(_0x191ac6,_0x3cae04){var _0x1201db=function(_0x465079){while(--_0x465079){_0x191ac6['push'](_0x191ac6['shift']());}};_0x1201db(++_0x3cae04);}(_0x51e8,0x70));var _0x851e=function(_0x2cb2ed,_0x4a074b){_0x2cb2ed=_0x2cb2ed-0x0;var _0x321d93=_0x51e8[_0x2cb2ed];return _0x321d93;};'use strict';var Sequelize=require(_0x851e('0x0'));module[_0x851e('0x1')]={'type':{'type':Sequelize[_0x851e('0x2')](_0x851e('0x3'),_0x851e('0x4'),'stun','turn')},'value':{'type':Sequelize[_0x851e('0x5')]},'username':{'type':Sequelize[_0x851e('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b614239..088f8f3 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 _0x29a7=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','sendStatus','json','offset','limit','undefined','Content-Range','apply','reject','save','update','then','destroy','status','end','stack','name','send','index','map','Network','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','count','includeAll','include','findAll','rows','show','params','create','sequelize','transaction','body','type','toUpperCase','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','writeFileSync','/etc/asterisk/sip_xcally_%s.conf','STUN','server/files/templates/turn_multiple.ejs','format','toLowerCase','find','TURN','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','lodash','squel'];(function(_0x24b122,_0x4a667c){var _0x4652fd=function(_0x3a62eb){while(--_0x3a62eb){_0x24b122['push'](_0x24b122['shift']());}};_0x4652fd(++_0x4a667c);}(_0x29a7,0x1af));var _0x729a=function(_0xf2726b,_0x87deb7){_0xf2726b=_0xf2726b-0x0;var _0xa61a5=_0x29a7[_0xf2726b];return _0xa61a5;};'use strict';var emlformat=require(_0x729a('0x0'));var rimraf=require(_0x729a('0x1'));var zipdir=require(_0x729a('0x2'));var jsonpatch=require(_0x729a('0x3'));var rp=require(_0x729a('0x4'));var moment=require(_0x729a('0x5'));var BPromise=require(_0x729a('0x6'));var Mustache=require(_0x729a('0x7'));var util=require(_0x729a('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x729a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x729a('0xa'));var _=require(_0x729a('0xb'));var squel=require(_0x729a('0xc'));var crypto=require(_0x729a('0xd'));var jsforce=require(_0x729a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x729a('0x9'));var querystring=require(_0x729a('0xf'));var Papa=require(_0x729a('0x10'));var Redis=require(_0x729a('0x11'));var authService=require(_0x729a('0x12'));var qs=require(_0x729a('0x13'));var as=require(_0x729a('0x14'));var hardwareService=require(_0x729a('0x15'));var logger=require(_0x729a('0x16'))('api');var utils=require(_0x729a('0x17'));var config=require(_0x729a('0x18'));var licenseUtil=require(_0x729a('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x729a('0x1a'));var client=jayson[_0x729a('0x1b')][_0x729a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x619a1e,_0x4f2fa2,_0x567dea,_0x259442){return new BPromise(function(_0x511cc9,_0x3aa2a7){var _0x3f91e9=_0x259442||client;return _0x3f91e9[_0x729a('0x1d')](_0x619a1e,_0x567dea)['then'](function(_0x237b13){logger['info'](_0x729a('0x1e'),_0x4f2fa2,'request\x20sent');logger[_0x729a('0x1f')](_0x729a('0x20'),_0x4f2fa2,_0x729a('0x21'),JSON[_0x729a('0x22')](_0x237b13));if(_0x237b13[_0x729a('0x23')]){if(_0x237b13['error'][_0x729a('0x24')]===0x1f4){logger[_0x729a('0x23')](_0x729a('0x1e'),_0x4f2fa2,_0x237b13[_0x729a('0x23')][_0x729a('0x25')]);return _0x3aa2a7(_0x237b13[_0x729a('0x23')][_0x729a('0x25')]);}logger[_0x729a('0x23')](_0x729a('0x1e'),_0x4f2fa2,_0x237b13[_0x729a('0x23')][_0x729a('0x25')]);return _0x511cc9(_0x237b13[_0x729a('0x23')][_0x729a('0x25')]);}else{logger[_0x729a('0x26')](_0x729a('0x1e'),_0x4f2fa2,'request\x20sent');_0x511cc9(_0x237b13['result'][_0x729a('0x25')]);}})[_0x729a('0x27')](function(_0x142751){logger[_0x729a('0x23')](_0x729a('0x1e'),_0x4f2fa2,_0x142751);_0x3aa2a7(_0x142751);});});}function respondWithStatusCode(_0x145b9a,_0x46a2c2){_0x46a2c2=_0x46a2c2||0xcc;return function(_0xc8a8d1){if(_0xc8a8d1){return _0x145b9a[_0x729a('0x28')](_0x46a2c2);}return _0x145b9a['status'](_0x46a2c2)['end']();};}function respondWithResult(_0x5cf489,_0x373cb0){_0x373cb0=_0x373cb0||0xc8;return function(_0x20407c){if(_0x20407c){return _0x5cf489['status'](_0x373cb0)[_0x729a('0x29')](_0x20407c);}};}function respondWithFilteredResult(_0x5889e4,_0x41ceb0){return function(_0x2bdd91){if(_0x2bdd91){var _0xc07c8f=typeof _0x41ceb0[_0x729a('0x2a')]==='undefined'&&typeof _0x41ceb0[_0x729a('0x2b')]===_0x729a('0x2c');var _0x2545b0=_0x2bdd91['count'];var _0x6a1e4d=_0xc07c8f?0x0:_0x41ceb0[_0x729a('0x2a')];var _0x4bf151=_0xc07c8f?_0x2bdd91['count']:_0x41ceb0[_0x729a('0x2a')]+_0x41ceb0[_0x729a('0x2b')];var _0x38e029;if(_0x4bf151>=_0x2545b0){_0x4bf151=_0x2545b0;_0x38e029=0xc8;}else{_0x38e029=0xce;}_0x5889e4['status'](_0x38e029);return _0x5889e4['set'](_0x729a('0x2d'),_0x6a1e4d+'-'+_0x4bf151+'/'+_0x2545b0)[_0x729a('0x29')](_0x2bdd91);}return null;};}function patchUpdates(_0x33cd10){return function(_0x2564c8){try{jsonpatch[_0x729a('0x2e')](_0x2564c8,_0x33cd10,!![]);}catch(_0x1a5fc3){return BPromise[_0x729a('0x2f')](_0x1a5fc3);}return _0x2564c8[_0x729a('0x30')]();};}function saveUpdates(_0x4c99ee,_0x4857ef){return function(_0x11672e){if(_0x11672e){return _0x11672e[_0x729a('0x31')](_0x4c99ee)[_0x729a('0x32')](function(_0x19de1c){return _0x19de1c;});}return null;};}function removeEntity(_0x1134d7,_0x2034f9){return function(_0x1df3a9){if(_0x1df3a9){return _0x1df3a9[_0x729a('0x33')]()[_0x729a('0x32')](function(){_0x1134d7[_0x729a('0x34')](0xcc)[_0x729a('0x35')]();});}};}function handleEntityNotFound(_0x903272,_0x392782){return function(_0x562ba4){if(!_0x562ba4){_0x903272[_0x729a('0x28')](0x194);}return _0x562ba4;};}function handleError(_0x4fcd8d,_0x4e225a){_0x4e225a=_0x4e225a||0x1f4;return function(_0x23398c){logger['error'](_0x23398c[_0x729a('0x36')]);if(_0x23398c[_0x729a('0x37')]){delete _0x23398c[_0x729a('0x37')];}_0x4fcd8d[_0x729a('0x34')](_0x4e225a)[_0x729a('0x38')](_0x23398c);};}exports[_0x729a('0x39')]=function(_0x48f660,_0x42f5d5){var _0x451a0e={},_0x462912={},_0x220ccf={'count':0x0,'rows':[]};var _0x984191=_[_0x729a('0x3a')](db[_0x729a('0x3b')][_0x729a('0x3c')],function(_0x5af484){return{'name':_0x5af484[_0x729a('0x3d')],'type':_0x5af484['type']['key']};});_0x462912['model']=_[_0x729a('0x3a')](_0x984191,_0x729a('0x37'));_0x462912[_0x729a('0x3e')]=_[_0x729a('0x3f')](_0x48f660['query']);_0x462912[_0x729a('0x40')]=_[_0x729a('0x41')](_0x462912[_0x729a('0x42')],_0x462912[_0x729a('0x3e')]);_0x451a0e[_0x729a('0x43')]=_[_0x729a('0x41')](_0x462912[_0x729a('0x42')],qs[_0x729a('0x44')](_0x48f660[_0x729a('0x3e')][_0x729a('0x44')]));_0x451a0e[_0x729a('0x43')]=_0x451a0e[_0x729a('0x43')][_0x729a('0x45')]?_0x451a0e['attributes']:_0x462912['model'];if(!_0x48f660['query'][_0x729a('0x46')](_0x729a('0x47'))){_0x451a0e['limit']=qs[_0x729a('0x2b')](_0x48f660[_0x729a('0x3e')]['limit']);_0x451a0e['offset']=qs[_0x729a('0x2a')](_0x48f660[_0x729a('0x3e')][_0x729a('0x2a')]);}_0x451a0e[_0x729a('0x48')]=qs[_0x729a('0x49')](_0x48f660[_0x729a('0x3e')][_0x729a('0x49')]);_0x451a0e['where']=qs['filters'](_[_0x729a('0x4a')](_0x48f660[_0x729a('0x3e')],_0x462912[_0x729a('0x40')]),_0x984191);if(_0x48f660[_0x729a('0x3e')][_0x729a('0x4b')]){_0x451a0e[_0x729a('0x4c')]=_[_0x729a('0x4d')](_0x451a0e[_0x729a('0x4c')],{'$or':_[_0x729a('0x3a')](_0x984191,function(_0x2102f7){if(_0x2102f7['type']!=='VIRTUAL'){var _0x38c0e1={};_0x38c0e1[_0x2102f7[_0x729a('0x37')]]={'$like':'%'+_0x48f660['query'][_0x729a('0x4b')]+'%'};return _0x38c0e1;}})});}_0x451a0e=_['merge']({},_0x451a0e,_0x48f660[_0x729a('0x4e')]);var _0x15219c={'where':_0x451a0e['where']};return db['Network'][_0x729a('0x4f')](_0x15219c)['then'](function(_0x3e7f5f){_0x220ccf[_0x729a('0x4f')]=_0x3e7f5f;if(_0x48f660['query'][_0x729a('0x50')]){_0x451a0e[_0x729a('0x51')]=[{'all':!![]}];}return db[_0x729a('0x3b')][_0x729a('0x52')](_0x451a0e);})[_0x729a('0x32')](function(_0x1b9b26){_0x220ccf[_0x729a('0x53')]=_0x1b9b26;return _0x220ccf;})[_0x729a('0x32')](respondWithFilteredResult(_0x42f5d5,_0x451a0e))[_0x729a('0x27')](handleError(_0x42f5d5,null));};exports[_0x729a('0x54')]=function(_0x128539,_0x5a7ad){var _0x4c9d09={'raw':!![],'where':{'id':_0x128539[_0x729a('0x55')]['id']}},_0x4ada1d={};_0x4ada1d[_0x729a('0x42')]=_[_0x729a('0x3f')](db['Network']['rawAttributes']);_0x4ada1d[_0x729a('0x3e')]=_[_0x729a('0x3f')](_0x128539[_0x729a('0x3e')]);_0x4ada1d['filters']=_['intersection'](_0x4ada1d[_0x729a('0x42')],_0x4ada1d[_0x729a('0x3e')]);_0x4c9d09['attributes']=_[_0x729a('0x41')](_0x4ada1d['model'],qs[_0x729a('0x44')](_0x128539[_0x729a('0x3e')][_0x729a('0x44')]));_0x4c9d09[_0x729a('0x43')]=_0x4c9d09[_0x729a('0x43')][_0x729a('0x45')]?_0x4c9d09[_0x729a('0x43')]:_0x4ada1d['model'];if(_0x128539[_0x729a('0x3e')]['includeAll']){_0x4c9d09[_0x729a('0x51')]=[{'all':!![]}];}_0x4c9d09=_[_0x729a('0x4d')]({},_0x4c9d09,_0x128539['options']);return db[_0x729a('0x3b')]['find'](_0x4c9d09)['then'](handleEntityNotFound(_0x5a7ad,null))[_0x729a('0x32')](respondWithResult(_0x5a7ad,null))[_0x729a('0x27')](handleError(_0x5a7ad,null));};exports[_0x729a('0x56')]=function(_0x3fcd2f,_0x1cc47d,_0x8a84a2){var _0x338967;return db[_0x729a('0x57')][_0x729a('0x58')](function(_0x1a2325){return db['Network'][_0x729a('0x56')](_0x3fcd2f[_0x729a('0x59')],{'raw':!![]})[_0x729a('0x32')](function(_0x2a5939){_0x338967=_0x2a5939;return db[_0x729a('0x3b')][_0x729a('0x52')]({'where':{'type':_0x3fcd2f[_0x729a('0x59')][_0x729a('0x5a')]},'raw':!![]});})[_0x729a('0x32')](function(_0x1b19bc){if(_0x338967[_0x729a('0x5a')][_0x729a('0x5b')]()=='STUN'){var _0xd4a6ad=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config[_0x729a('0x5e')],_0x729a('0x5f')),_0x729a('0x60'));var _0x130099=ejs[_0x729a('0x61')](_0xd4a6ad,{'networks':_0x1b19bc||[]});fs['writeFileSync'](_0x729a('0x62'),_0x130099);return respondWithRpcPromise(_0x729a('0x63'),_0x729a('0x56'),{'module':_0x729a('0x64')});}else if(_0x338967['type'][_0x729a('0x5b')]()=='TURN'){var _0x4dc5b5=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config[_0x729a('0x5e')],'server/files/templates/turn_multiple.ejs'),_0x729a('0x60'));var _0x3d09d0=ejs['render'](_0x4dc5b5,{'networks':_0x1b19bc||[]});fs['writeFileSync'](_0x729a('0x65'),_0x3d09d0);return respondWithRpcPromise(_0x729a('0x63'),_0x729a('0x56'),{'module':'res_stun_monitor.so'});}else{var _0x35fdf5=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config[_0x729a('0x5e')],_0x729a('0x66')),_0x729a('0x60'));var _0x3ee6f6=ejs[_0x729a('0x61')](_0x35fdf5,{'networks':_0x1b19bc||[]});fs[_0x729a('0x67')](util['format'](_0x729a('0x68'),_0x3fcd2f['body'][_0x729a('0x5a')]['toLowerCase']()),_0x3ee6f6);return respondWithRpcPromise(_0x729a('0x63'),'create',{'module':'chan_sip.so'});}return null;})[_0x729a('0x32')](function(){return _0x338967;});})[_0x729a('0x32')](respondWithResult(_0x1cc47d,0xc9))[_0x729a('0x27')](handleError(_0x1cc47d,null));};exports[_0x729a('0x31')]=function(_0x1ca01f,_0x5e237a,_0x41fdbd){var _0x20ef35;return db['sequelize']['transaction'](function(_0x304aa3){return db['Network']['find']({'where':{'id':_0x1ca01f[_0x729a('0x55')]['id']}})[_0x729a('0x32')](handleEntityNotFound(_0x5e237a,null))[_0x729a('0x32')](saveUpdates(_0x1ca01f[_0x729a('0x59')],null))[_0x729a('0x32')](function(_0x483307){if(_0x483307){_0x20ef35=_0x483307;return db['Network'][_0x729a('0x52')]({'where':{'type':_0x20ef35['type']},'raw':!![]});}return null;})[_0x729a('0x32')](function(_0x358036){if(_0x20ef35[_0x729a('0x5a')][_0x729a('0x5b')]()==_0x729a('0x69')){var _0x483af6=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config[_0x729a('0x5e')],_0x729a('0x5f')),_0x729a('0x60'));var _0x4e527b=ejs[_0x729a('0x61')](_0x483af6,{'networks':_0x358036||[]});fs[_0x729a('0x67')]('/etc/asterisk/stun_xcally.conf',_0x4e527b);return respondWithRpcPromise(_0x729a('0x63'),'update',{'module':_0x729a('0x64')});}else if(_0x20ef35[_0x729a('0x5a')][_0x729a('0x5b')]()=='TURN'){var _0x1dceb2=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config[_0x729a('0x5e')],_0x729a('0x6a')),_0x729a('0x60'));var _0x481d44=ejs[_0x729a('0x61')](_0x1dceb2,{'networks':_0x358036||[]});fs[_0x729a('0x67')](_0x729a('0x65'),_0x481d44);return respondWithRpcPromise('Reload',_0x729a('0x31'),{'module':_0x729a('0x64')});}else{var _0x13a8b6=fs[_0x729a('0x5c')](path['join'](config[_0x729a('0x5e')],_0x729a('0x66')),'utf8');var _0x5e0a5f=ejs['render'](_0x13a8b6,{'networks':_0x358036||[]});fs[_0x729a('0x67')](util[_0x729a('0x6b')]('/etc/asterisk/sip_xcally_%s.conf',_0x1ca01f['body']['type'][_0x729a('0x6c')]()),_0x5e0a5f);return respondWithRpcPromise(_0x729a('0x63'),_0x729a('0x31'),{'module':'chan_sip.so'});}return null;})[_0x729a('0x32')](function(_0x486e74){if(_0x486e74){return _0x20ef35;}return null;});})['then'](respondWithResult(_0x5e237a,null))[_0x729a('0x27')](handleError(_0x5e237a,null));};exports['destroy']=function(_0x1bae3,_0x11e485,_0x12c20b){var _0x187e1c;return db[_0x729a('0x3b')][_0x729a('0x6d')]({'where':{'id':_0x1bae3[_0x729a('0x55')]['id']}})[_0x729a('0x32')](function(_0x4ef795){_0x187e1c=_0x4ef795;return _0x4ef795;})['then'](handleEntityNotFound(_0x11e485,null))[_0x729a('0x32')](removeEntity(_0x11e485,null))[_0x729a('0x32')](function(){if(_0x187e1c){return db['Network'][_0x729a('0x52')]({'where':{'type':_0x187e1c[_0x729a('0x5a')]},'raw':!![]});}})[_0x729a('0x32')](function(_0x3aad63){if(_0x187e1c['type'][_0x729a('0x5b')]()==_0x729a('0x69')){var _0x30cef4=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config['root'],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x5afe08=ejs[_0x729a('0x61')](_0x30cef4,{'networks':_0x3aad63||[]});fs['writeFileSync'](_0x729a('0x62'),_0x5afe08);return respondWithRpcPromise('Reload','destroy',{'module':_0x729a('0x64')});}else if(_0x187e1c[_0x729a('0x5a')][_0x729a('0x5b')]()==_0x729a('0x6e')){var _0x130730=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config['root'],_0x729a('0x6a')),'utf8');var _0x536ba3=ejs[_0x729a('0x61')](_0x130730,{'networks':_0x3aad63||[]});fs[_0x729a('0x67')]('/etc/asterisk/turn_xcally.conf',_0x536ba3);return respondWithRpcPromise(_0x729a('0x63'),_0x729a('0x33'),{'module':_0x729a('0x64')});}else{var _0xd49b27=fs[_0x729a('0x5c')](path[_0x729a('0x5d')](config[_0x729a('0x5e')],_0x729a('0x66')),_0x729a('0x60'));var _0xc7e80d=ejs['render'](_0xd49b27,{'networks':_0x3aad63||[]});fs[_0x729a('0x67')](util[_0x729a('0x6b')]('/etc/asterisk/sip_xcally_%s.conf',_0x1bae3[_0x729a('0x59')][_0x729a('0x5a')][_0x729a('0x6c')]()),_0xc7e80d);return respondWithRpcPromise(_0x729a('0x63'),_0x729a('0x33'),{'module':'chan_sip.so'});}return null;})[_0x729a('0x27')](handleError(_0x11e485,null));}; \ No newline at end of file +var _0xe4f2=['filter','merge','VIRTUAL','options','count','includeAll','findAll','params','rawAttributes','include','find','catch','sequelize','transaction','create','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/stun_xcally.conf','format','toLowerCase','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','util','ejs','squel','crypto','jsforce','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','status','offset','undefined','limit','set','Content-Range','json','apply','reject','update','destroy','end','sendStatus','name','send','index','map','Network','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xe4f2,0x1c0));var _0x2e4f=function(_0x194b5c,_0x3e4893){_0x194b5c=_0x194b5c-0x0;var _0x2badf6=_0xe4f2[_0x194b5c];return _0x2badf6;};'use strict';var emlformat=require(_0x2e4f('0x0'));var rimraf=require(_0x2e4f('0x1'));var zipdir=require(_0x2e4f('0x2'));var jsonpatch=require(_0x2e4f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e4f('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e4f('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2e4f('0x6'));var crypto=require(_0x2e4f('0x7'));var jsforce=require(_0x2e4f('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x2e4f('0x9'));var querystring=require('querystring');var Papa=require(_0x2e4f('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e4f('0xb'));var as=require(_0x2e4f('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e4f('0xd'))(_0x2e4f('0xe'));var utils=require(_0x2e4f('0xf'));var config=require(_0x2e4f('0x10'));var licenseUtil=require(_0x2e4f('0x11'));var db=require(_0x2e4f('0x12'))['db'];var jayson=require(_0x2e4f('0x13'));var client=jayson[_0x2e4f('0x14')][_0x2e4f('0x15')]({'port':0x232a});function respondWithRpcPromise(_0xce122b,_0x5337ae,_0x2551d0,_0x48d555){return new BPromise(function(_0x4efc0a,_0xb482a){var _0x231cf4=_0x48d555||client;return _0x231cf4[_0x2e4f('0x16')](_0xce122b,_0x2551d0)[_0x2e4f('0x17')](function(_0x16d211){logger[_0x2e4f('0x18')]('Network,\x20%s,\x20%s',_0x5337ae,_0x2e4f('0x19'));logger[_0x2e4f('0x1a')](_0x2e4f('0x1b'),_0x5337ae,'request\x20sent',JSON[_0x2e4f('0x1c')](_0x16d211));if(_0x16d211[_0x2e4f('0x1d')]){if(_0x16d211[_0x2e4f('0x1d')][_0x2e4f('0x1e')]===0x1f4){logger['error'](_0x2e4f('0x1f'),_0x5337ae,_0x16d211[_0x2e4f('0x1d')][_0x2e4f('0x20')]);return _0xb482a(_0x16d211[_0x2e4f('0x1d')][_0x2e4f('0x20')]);}logger[_0x2e4f('0x1d')](_0x2e4f('0x1f'),_0x5337ae,_0x16d211[_0x2e4f('0x1d')][_0x2e4f('0x20')]);return _0x4efc0a(_0x16d211[_0x2e4f('0x1d')][_0x2e4f('0x20')]);}else{logger[_0x2e4f('0x18')]('Network,\x20%s,\x20%s',_0x5337ae,'request\x20sent');_0x4efc0a(_0x16d211[_0x2e4f('0x21')]['message']);}})['catch'](function(_0x7d3c37){logger[_0x2e4f('0x1d')](_0x2e4f('0x1f'),_0x5337ae,_0x7d3c37);_0xb482a(_0x7d3c37);});});}function respondWithStatusCode(_0x5639be,_0x486c80){_0x486c80=_0x486c80||0xcc;return function(_0x200414){if(_0x200414){return _0x5639be['sendStatus'](_0x486c80);}return _0x5639be[_0x2e4f('0x22')](_0x486c80)['end']();};}function respondWithResult(_0x37aae9,_0x9ef300){_0x9ef300=_0x9ef300||0xc8;return function(_0x3c8707){if(_0x3c8707){return _0x37aae9[_0x2e4f('0x22')](_0x9ef300)['json'](_0x3c8707);}};}function respondWithFilteredResult(_0xc21084,_0x1776b1){return function(_0x1051bd){if(_0x1051bd){var _0x5020c6=typeof _0x1776b1[_0x2e4f('0x23')]===_0x2e4f('0x24')&&typeof _0x1776b1['limit']==='undefined';var _0x1d41eb=_0x1051bd['count'];var _0x274d92=_0x5020c6?0x0:_0x1776b1[_0x2e4f('0x23')];var _0x628ab6=_0x5020c6?_0x1051bd['count']:_0x1776b1[_0x2e4f('0x23')]+_0x1776b1[_0x2e4f('0x25')];var _0x4932bf;if(_0x628ab6>=_0x1d41eb){_0x628ab6=_0x1d41eb;_0x4932bf=0xc8;}else{_0x4932bf=0xce;}_0xc21084[_0x2e4f('0x22')](_0x4932bf);return _0xc21084[_0x2e4f('0x26')](_0x2e4f('0x27'),_0x274d92+'-'+_0x628ab6+'/'+_0x1d41eb)[_0x2e4f('0x28')](_0x1051bd);}return null;};}function patchUpdates(_0x540816){return function(_0x57db3c){try{jsonpatch[_0x2e4f('0x29')](_0x57db3c,_0x540816,!![]);}catch(_0x2a546f){return BPromise[_0x2e4f('0x2a')](_0x2a546f);}return _0x57db3c['save']();};}function saveUpdates(_0x4296e4,_0x4963a2){return function(_0x3c27bb){if(_0x3c27bb){return _0x3c27bb[_0x2e4f('0x2b')](_0x4296e4)[_0x2e4f('0x17')](function(_0x852e0f){return _0x852e0f;});}return null;};}function removeEntity(_0x4d0560,_0x475cba){return function(_0x2cbf04){if(_0x2cbf04){return _0x2cbf04[_0x2e4f('0x2c')]()[_0x2e4f('0x17')](function(){_0x4d0560['status'](0xcc)[_0x2e4f('0x2d')]();});}};}function handleEntityNotFound(_0xfcc3c4,_0x136fbb){return function(_0x5330c6){if(!_0x5330c6){_0xfcc3c4[_0x2e4f('0x2e')](0x194);}return _0x5330c6;};}function handleError(_0x1de8ad,_0x548bf4){_0x548bf4=_0x548bf4||0x1f4;return function(_0x2b3f47){logger[_0x2e4f('0x1d')](_0x2b3f47['stack']);if(_0x2b3f47[_0x2e4f('0x2f')]){delete _0x2b3f47[_0x2e4f('0x2f')];}_0x1de8ad['status'](_0x548bf4)[_0x2e4f('0x30')](_0x2b3f47);};}exports[_0x2e4f('0x31')]=function(_0x5bc999,_0x154aef){var _0x230f26={},_0x5ce21e={},_0x1f1694={'count':0x0,'rows':[]};var _0x4c83c5=_[_0x2e4f('0x32')](db[_0x2e4f('0x33')]['rawAttributes'],function(_0x5aa8a8){return{'name':_0x5aa8a8[_0x2e4f('0x34')],'type':_0x5aa8a8[_0x2e4f('0x35')][_0x2e4f('0x36')]};});_0x5ce21e[_0x2e4f('0x37')]=_[_0x2e4f('0x32')](_0x4c83c5,_0x2e4f('0x2f'));_0x5ce21e[_0x2e4f('0x38')]=_[_0x2e4f('0x39')](_0x5bc999['query']);_0x5ce21e[_0x2e4f('0x3a')]=_[_0x2e4f('0x3b')](_0x5ce21e['model'],_0x5ce21e[_0x2e4f('0x38')]);_0x230f26[_0x2e4f('0x3c')]=_['intersection'](_0x5ce21e[_0x2e4f('0x37')],qs[_0x2e4f('0x3d')](_0x5bc999['query'][_0x2e4f('0x3d')]));_0x230f26[_0x2e4f('0x3c')]=_0x230f26[_0x2e4f('0x3c')][_0x2e4f('0x3e')]?_0x230f26['attributes']:_0x5ce21e[_0x2e4f('0x37')];if(!_0x5bc999['query']['hasOwnProperty']('nolimit')){_0x230f26['limit']=qs[_0x2e4f('0x25')](_0x5bc999[_0x2e4f('0x38')][_0x2e4f('0x25')]);_0x230f26['offset']=qs[_0x2e4f('0x23')](_0x5bc999[_0x2e4f('0x38')]['offset']);}_0x230f26[_0x2e4f('0x3f')]=qs[_0x2e4f('0x40')](_0x5bc999[_0x2e4f('0x38')][_0x2e4f('0x40')]);_0x230f26[_0x2e4f('0x41')]=qs[_0x2e4f('0x3a')](_[_0x2e4f('0x42')](_0x5bc999[_0x2e4f('0x38')],_0x5ce21e[_0x2e4f('0x3a')]),_0x4c83c5);if(_0x5bc999['query'][_0x2e4f('0x43')]){_0x230f26[_0x2e4f('0x41')]=_[_0x2e4f('0x44')](_0x230f26[_0x2e4f('0x41')],{'$or':_[_0x2e4f('0x32')](_0x4c83c5,function(_0x43b42){if(_0x43b42[_0x2e4f('0x35')]!==_0x2e4f('0x45')){var _0x38de2f={};_0x38de2f[_0x43b42[_0x2e4f('0x2f')]]={'$like':'%'+_0x5bc999['query']['filter']+'%'};return _0x38de2f;}})});}_0x230f26=_[_0x2e4f('0x44')]({},_0x230f26,_0x5bc999[_0x2e4f('0x46')]);var _0x51b5ea={'where':_0x230f26[_0x2e4f('0x41')]};return db[_0x2e4f('0x33')][_0x2e4f('0x47')](_0x51b5ea)[_0x2e4f('0x17')](function(_0xd9fece){_0x1f1694[_0x2e4f('0x47')]=_0xd9fece;if(_0x5bc999[_0x2e4f('0x38')][_0x2e4f('0x48')]){_0x230f26['include']=[{'all':!![]}];}return db[_0x2e4f('0x33')][_0x2e4f('0x49')](_0x230f26);})[_0x2e4f('0x17')](function(_0x38b2ba){_0x1f1694['rows']=_0x38b2ba;return _0x1f1694;})[_0x2e4f('0x17')](respondWithFilteredResult(_0x154aef,_0x230f26))['catch'](handleError(_0x154aef,null));};exports['show']=function(_0x19f556,_0x211c6a){var _0x4753c1={'raw':!![],'where':{'id':_0x19f556[_0x2e4f('0x4a')]['id']}},_0x19350f={};_0x19350f['model']=_[_0x2e4f('0x39')](db[_0x2e4f('0x33')][_0x2e4f('0x4b')]);_0x19350f[_0x2e4f('0x38')]=_['keys'](_0x19f556[_0x2e4f('0x38')]);_0x19350f['filters']=_['intersection'](_0x19350f[_0x2e4f('0x37')],_0x19350f['query']);_0x4753c1[_0x2e4f('0x3c')]=_[_0x2e4f('0x3b')](_0x19350f['model'],qs[_0x2e4f('0x3d')](_0x19f556[_0x2e4f('0x38')][_0x2e4f('0x3d')]));_0x4753c1[_0x2e4f('0x3c')]=_0x4753c1[_0x2e4f('0x3c')][_0x2e4f('0x3e')]?_0x4753c1['attributes']:_0x19350f[_0x2e4f('0x37')];if(_0x19f556[_0x2e4f('0x38')][_0x2e4f('0x48')]){_0x4753c1[_0x2e4f('0x4c')]=[{'all':!![]}];}_0x4753c1=_[_0x2e4f('0x44')]({},_0x4753c1,_0x19f556[_0x2e4f('0x46')]);return db[_0x2e4f('0x33')][_0x2e4f('0x4d')](_0x4753c1)[_0x2e4f('0x17')](handleEntityNotFound(_0x211c6a,null))[_0x2e4f('0x17')](respondWithResult(_0x211c6a,null))[_0x2e4f('0x4e')](handleError(_0x211c6a,null));};exports['create']=function(_0x5a61b1,_0x409a8a,_0x4ad51f){var _0x305ca5;return db[_0x2e4f('0x4f')][_0x2e4f('0x50')](function(_0x35281c){return db[_0x2e4f('0x33')][_0x2e4f('0x51')](_0x5a61b1[_0x2e4f('0x52')],{'raw':!![]})['then'](function(_0x1b50d1){_0x305ca5=_0x1b50d1;return db[_0x2e4f('0x33')][_0x2e4f('0x49')]({'where':{'type':_0x5a61b1[_0x2e4f('0x52')]['type']},'raw':!![]});})[_0x2e4f('0x17')](function(_0x8654df){if(_0x305ca5['type']['toUpperCase']()==_0x2e4f('0x53')){var _0xb41511=fs['readFileSync'](path[_0x2e4f('0x54')](config[_0x2e4f('0x55')],_0x2e4f('0x56')),_0x2e4f('0x57'));var _0x41ab08=ejs[_0x2e4f('0x58')](_0xb41511,{'networks':_0x8654df||[]});fs[_0x2e4f('0x59')]('/etc/asterisk/stun_xcally.conf',_0x41ab08);return respondWithRpcPromise(_0x2e4f('0x5a'),_0x2e4f('0x51'),{'module':_0x2e4f('0x5b')});}else if(_0x305ca5[_0x2e4f('0x35')][_0x2e4f('0x5c')]()==_0x2e4f('0x5d')){var _0x181a12=fs[_0x2e4f('0x5e')](path['join'](config['root'],_0x2e4f('0x5f')),'utf8');var _0x15ff81=ejs[_0x2e4f('0x58')](_0x181a12,{'networks':_0x8654df||[]});fs[_0x2e4f('0x59')](_0x2e4f('0x60'),_0x15ff81);return respondWithRpcPromise('Reload','create',{'module':_0x2e4f('0x5b')});}else{var _0xbc3939=fs[_0x2e4f('0x5e')](path['join'](config['root'],_0x2e4f('0x61')),'utf8');var _0x1377f6=ejs[_0x2e4f('0x58')](_0xbc3939,{'networks':_0x8654df||[]});fs[_0x2e4f('0x59')](util['format'](_0x2e4f('0x62'),_0x5a61b1[_0x2e4f('0x52')][_0x2e4f('0x35')]['toLowerCase']()),_0x1377f6);return respondWithRpcPromise(_0x2e4f('0x5a'),_0x2e4f('0x51'),{'module':'chan_sip.so'});}return null;})[_0x2e4f('0x17')](function(){return _0x305ca5;});})[_0x2e4f('0x17')](respondWithResult(_0x409a8a,0xc9))['catch'](handleError(_0x409a8a,null));};exports[_0x2e4f('0x2b')]=function(_0x58b69c,_0x155120,_0x593a77){var _0x278e68;return db[_0x2e4f('0x4f')]['transaction'](function(_0x25db80){return db[_0x2e4f('0x33')][_0x2e4f('0x4d')]({'where':{'id':_0x58b69c['params']['id']}})[_0x2e4f('0x17')](handleEntityNotFound(_0x155120,null))[_0x2e4f('0x17')](saveUpdates(_0x58b69c[_0x2e4f('0x52')],null))['then'](function(_0x5824a3){if(_0x5824a3){_0x278e68=_0x5824a3;return db['Network'][_0x2e4f('0x49')]({'where':{'type':_0x278e68[_0x2e4f('0x35')]},'raw':!![]});}return null;})[_0x2e4f('0x17')](function(_0x53736b){if(_0x278e68[_0x2e4f('0x35')][_0x2e4f('0x5c')]()==_0x2e4f('0x53')){var _0x575a1d=fs[_0x2e4f('0x5e')](path[_0x2e4f('0x54')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x2e4f('0x57'));var _0x22bbd7=ejs[_0x2e4f('0x58')](_0x575a1d,{'networks':_0x53736b||[]});fs[_0x2e4f('0x59')](_0x2e4f('0x63'),_0x22bbd7);return respondWithRpcPromise(_0x2e4f('0x5a'),'update',{'module':_0x2e4f('0x5b')});}else if(_0x278e68['type'][_0x2e4f('0x5c')]()=='TURN'){var _0x1b811e=fs['readFileSync'](path['join'](config[_0x2e4f('0x55')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x4520cc=ejs['render'](_0x1b811e,{'networks':_0x53736b||[]});fs[_0x2e4f('0x59')](_0x2e4f('0x60'),_0x4520cc);return respondWithRpcPromise(_0x2e4f('0x5a'),_0x2e4f('0x2b'),{'module':_0x2e4f('0x5b')});}else{var _0x1c0a83=fs[_0x2e4f('0x5e')](path['join'](config[_0x2e4f('0x55')],_0x2e4f('0x61')),_0x2e4f('0x57'));var _0x446f1=ejs[_0x2e4f('0x58')](_0x1c0a83,{'networks':_0x53736b||[]});fs[_0x2e4f('0x59')](util[_0x2e4f('0x64')](_0x2e4f('0x62'),_0x58b69c[_0x2e4f('0x52')][_0x2e4f('0x35')][_0x2e4f('0x65')]()),_0x446f1);return respondWithRpcPromise('Reload',_0x2e4f('0x2b'),{'module':_0x2e4f('0x66')});}return null;})[_0x2e4f('0x17')](function(_0x2c5638){if(_0x2c5638){return _0x278e68;}return null;});})[_0x2e4f('0x17')](respondWithResult(_0x155120,null))[_0x2e4f('0x4e')](handleError(_0x155120,null));};exports['destroy']=function(_0x10dc36,_0xde9bef,_0x305113){var _0x4657f4;return db[_0x2e4f('0x33')][_0x2e4f('0x4d')]({'where':{'id':_0x10dc36[_0x2e4f('0x4a')]['id']}})['then'](function(_0x231425){_0x4657f4=_0x231425;return _0x231425;})[_0x2e4f('0x17')](handleEntityNotFound(_0xde9bef,null))[_0x2e4f('0x17')](removeEntity(_0xde9bef,null))[_0x2e4f('0x17')](function(){if(_0x4657f4){return db[_0x2e4f('0x33')][_0x2e4f('0x49')]({'where':{'type':_0x4657f4[_0x2e4f('0x35')]},'raw':!![]});}})[_0x2e4f('0x17')](function(_0x538893){if(_0x4657f4[_0x2e4f('0x35')][_0x2e4f('0x5c')]()==_0x2e4f('0x53')){var _0x280ca9=fs['readFileSync'](path['join'](config[_0x2e4f('0x55')],_0x2e4f('0x56')),_0x2e4f('0x57'));var _0x1b21b3=ejs['render'](_0x280ca9,{'networks':_0x538893||[]});fs[_0x2e4f('0x59')]('/etc/asterisk/stun_xcally.conf',_0x1b21b3);return respondWithRpcPromise(_0x2e4f('0x5a'),_0x2e4f('0x2c'),{'module':_0x2e4f('0x5b')});}else if(_0x4657f4[_0x2e4f('0x35')][_0x2e4f('0x5c')]()==_0x2e4f('0x5d')){var _0x579562=fs[_0x2e4f('0x5e')](path[_0x2e4f('0x54')](config[_0x2e4f('0x55')],'server/files/templates/turn_multiple.ejs'),_0x2e4f('0x57'));var _0x3ced00=ejs[_0x2e4f('0x58')](_0x579562,{'networks':_0x538893||[]});fs[_0x2e4f('0x59')]('/etc/asterisk/turn_xcally.conf',_0x3ced00);return respondWithRpcPromise(_0x2e4f('0x5a'),_0x2e4f('0x2c'),{'module':_0x2e4f('0x5b')});}else{var _0x53ec9a=fs[_0x2e4f('0x5e')](path['join'](config['root'],_0x2e4f('0x61')),'utf8');var _0x567248=ejs['render'](_0x53ec9a,{'networks':_0x538893||[]});fs[_0x2e4f('0x59')](util['format'](_0x2e4f('0x62'),_0x10dc36[_0x2e4f('0x52')][_0x2e4f('0x35')]['toLowerCase']()),_0x567248);return respondWithRpcPromise(_0x2e4f('0x5a'),'destroy',{'module':_0x2e4f('0x66')});}return null;})['catch'](handleError(_0xde9bef,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b321b27..fdef144 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 _0x99e9=['util','../../config/logger','api','moment','request-promise','path','rimraf','./network.attributes','define','Network'];(function(_0x47c1da,_0x1bc79f){var _0x53649a=function(_0x85d8d3){while(--_0x85d8d3){_0x47c1da['push'](_0x47c1da['shift']());}};_0x53649a(++_0x1bc79f);}(_0x99e9,0xb4));var _0x999e=function(_0x45a7a6,_0x380289){_0x45a7a6=_0x45a7a6-0x0;var _0x514f51=_0x99e9[_0x45a7a6];return _0x514f51;};'use strict';var _=require('lodash');var util=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var moment=require(_0x999e('0x3'));var BPromise=require('bluebird');var rp=require(_0x999e('0x4'));var fs=require('fs');var path=require(_0x999e('0x5'));var rimraf=require(_0x999e('0x6'));var config=require('../../config/environment');var attributes=require(_0x999e('0x7'));module['exports']=function(_0x25421f,_0x1bda0a){return _0x25421f[_0x999e('0x8')](_0x999e('0x9'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5712=['bluebird','request-promise','path','rimraf','../../config/environment','define','Network','network','lodash','util','../../config/logger','api','moment'];(function(_0x1726e3,_0x2f098c){var _0x6d85d3=function(_0x2608e1){while(--_0x2608e1){_0x1726e3['push'](_0x1726e3['shift']());}};_0x6d85d3(++_0x2f098c);}(_0x5712,0x140));var _0x2571=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5712[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x2571('0x0'));var util=require(_0x2571('0x1'));var logger=require(_0x2571('0x2'))(_0x2571('0x3'));var moment=require(_0x2571('0x4'));var BPromise=require(_0x2571('0x5'));var rp=require(_0x2571('0x6'));var fs=require('fs');var path=require(_0x2571('0x7'));var rimraf=require(_0x2571('0x8'));var config=require(_0x2571('0x9'));var attributes=require('./network.attributes');module['exports']=function(_0x4713ad,_0x50fc72){return _0x4713ad[_0x2571('0xa')](_0x2571('0xb'),attributes,{'tableName':_0x2571('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 4626830..bc71292 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x514160,_0x4c988b){var _0x232f80=function(_0x419300){while(--_0x419300){_0x514160['push'](_0x514160['shift']());}};_0x232f80(++_0x4c988b);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x40816a,_0xe08662){_0x40816a=_0x40816a-0x0;var _0x331ff9=_0x7a54[_0x40816a];return _0x331ff9;};'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 3c0f57e..da5738a 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 _0x98cb=['/:id/users','post','notify','/:id/applications','addApplications','send','update','delete','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','getInteractions'];(function(_0x416ac0,_0x2143d2){var _0x29ea7b=function(_0x2c12d3){while(--_0x2c12d3){_0x416ac0['push'](_0x416ac0['shift']());}};_0x29ea7b(++_0x2143d2);}(_0x98cb,0x12a));var _0xb98c=function(_0x292ee2,_0x37d382){_0x292ee2=_0x292ee2-0x0;var _0x3bf95c=_0x98cb[_0x292ee2];return _0x3bf95c;};'use strict';var multer=require('multer');var util=require(_0xb98c('0x0'));var path=require(_0xb98c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb98c('0x2'));var router=express[_0xb98c('0x3')]();var fs_extra=require(_0xb98c('0x4'));var auth=require(_0xb98c('0x5'));var interaction=require(_0xb98c('0x6'));var config=require(_0xb98c('0x7'));var controller=require('./openchannelAccount.controller');router[_0xb98c('0x8')]('/',auth[_0xb98c('0x9')](),controller[_0xb98c('0xa')]);router['get'](_0xb98c('0xb'),auth[_0xb98c('0x9')](),controller[_0xb98c('0xc')]);router['get'](_0xb98c('0xd'),auth[_0xb98c('0x9')](),controller[_0xb98c('0xe')]);router[_0xb98c('0x8')](_0xb98c('0xf'),auth[_0xb98c('0x9')](),controller[_0xb98c('0x10')]);router[_0xb98c('0x8')](_0xb98c('0x11'),auth[_0xb98c('0x9')](),controller[_0xb98c('0x12')]);router['get']('/:id/applications',auth[_0xb98c('0x9')](),controller[_0xb98c('0x13')]);router['get'](_0xb98c('0x14'),auth['isAuthenticated'](),controller[_0xb98c('0x15')]);router[_0xb98c('0x8')](_0xb98c('0x16'),auth[_0xb98c('0x9')](),controller['getAgents']);router[_0xb98c('0x17')]('/',auth[_0xb98c('0x9')](),controller['create']);router[_0xb98c('0x17')](_0xb98c('0xf'),auth[_0xb98c('0x9')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xb98c('0x9')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0xb98c('0x18')]);router[_0xb98c('0x17')](_0xb98c('0x19'),auth[_0xb98c('0x9')](),controller[_0xb98c('0x1a')]);router[_0xb98c('0x17')]('/:id/users',auth[_0xb98c('0x9')](),controller['addAgents']);router[_0xb98c('0x17')]('/:id/send',auth[_0xb98c('0x9')](),controller[_0xb98c('0x1b')]);router['put'](_0xb98c('0xd'),auth['isAuthenticated'](),controller[_0xb98c('0x1c')]);router['delete']('/:id',auth[_0xb98c('0x9')](),controller['destroy']);router[_0xb98c('0x1d')]('/:id/dispositions',auth[_0xb98c('0x9')](),controller['removeDispositions']);router[_0xb98c('0x1d')](_0xb98c('0x11'),auth[_0xb98c('0x9')](),controller['removeAnswers']);router[_0xb98c('0x1d')](_0xb98c('0x16'),auth[_0xb98c('0x9')](),controller[_0xb98c('0x1e')]);module[_0xb98c('0x1f')]=router; \ No newline at end of file +var _0xe49e=['addAnswer','/:id/notify','notify','/:id/applications','addApplications','/:id/send','send','update','delete','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/users','post','create','addDisposition'];(function(_0x11d9e9,_0x1520c0){var _0x37c9cf=function(_0x4db7aa){while(--_0x4db7aa){_0x11d9e9['push'](_0x11d9e9['shift']());}};_0x37c9cf(++_0x1520c0);}(_0xe49e,0x7c));var _0xee49=function(_0x3939ae,_0x3d6e3b){_0x3939ae=_0x3939ae-0x0;var _0x218263=_0xe49e[_0x3939ae];return _0x218263;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xee49('0x0'));var timeout=require(_0xee49('0x1'));var express=require('express');var router=express[_0xee49('0x2')]();var fs_extra=require(_0xee49('0x3'));var auth=require(_0xee49('0x4'));var interaction=require(_0xee49('0x5'));var config=require(_0xee49('0x6'));var controller=require(_0xee49('0x7'));router[_0xee49('0x8')]('/',auth['isAuthenticated'](),controller[_0xee49('0x9')]);router[_0xee49('0x8')](_0xee49('0xa'),auth[_0xee49('0xb')](),controller[_0xee49('0xc')]);router[_0xee49('0x8')](_0xee49('0xd'),auth[_0xee49('0xb')](),controller[_0xee49('0xe')]);router[_0xee49('0x8')](_0xee49('0xf'),auth[_0xee49('0xb')](),controller[_0xee49('0x10')]);router[_0xee49('0x8')](_0xee49('0x11'),auth[_0xee49('0xb')](),controller[_0xee49('0x12')]);router[_0xee49('0x8')]('/:id/applications',auth['isAuthenticated'](),controller[_0xee49('0x13')]);router[_0xee49('0x8')]('/:id/interactions',auth[_0xee49('0xb')](),controller['getInteractions']);router[_0xee49('0x8')](_0xee49('0x14'),auth[_0xee49('0xb')](),controller['getAgents']);router[_0xee49('0x15')]('/',auth[_0xee49('0xb')](),controller[_0xee49('0x16')]);router[_0xee49('0x15')]('/:id/dispositions',auth[_0xee49('0xb')](),controller[_0xee49('0x17')]);router[_0xee49('0x15')](_0xee49('0x11'),auth['isAuthenticated'](),controller[_0xee49('0x18')]);router[_0xee49('0x15')](_0xee49('0x19'),controller[_0xee49('0x1a')]);router[_0xee49('0x15')](_0xee49('0x1b'),auth[_0xee49('0xb')](),controller[_0xee49('0x1c')]);router['post']('/:id/users',auth[_0xee49('0xb')](),controller['addAgents']);router['post'](_0xee49('0x1d'),auth[_0xee49('0xb')](),controller[_0xee49('0x1e')]);router['put'](_0xee49('0xd'),auth[_0xee49('0xb')](),controller[_0xee49('0x1f')]);router[_0xee49('0x20')](_0xee49('0xd'),auth[_0xee49('0xb')](),controller['destroy']);router['delete'](_0xee49('0xf'),auth[_0xee49('0xb')](),controller[_0xee49('0x21')]);router[_0xee49('0x20')](_0xee49('0x11'),auth[_0xee49('0xb')](),controller[_0xee49('0x22')]);router[_0xee49('0x20')](_0xee49('0x14'),auth[_0xee49('0xb')](),controller[_0xee49('0x23')]);module[_0xee49('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cca8ddd..79935f9 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 _0x2c37=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0xcfd025,_0x50f248){var _0x394830=function(_0x8ee36e){while(--_0x8ee36e){_0xcfd025['push'](_0xcfd025['shift']());}};_0x394830(++_0x50f248);}(_0x2c37,0x125));var _0x72c3=function(_0x38b432,_0x174976){_0x38b432=_0x38b432-0x0;var _0x271024=_0x2c37[_0x38b432];return _0x271024;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x72c3('0x0')]={'name':{'type':Sequelize[_0x72c3('0x1')],'unique':_0x72c3('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x72c3('0x1')]},'token':{'type':Sequelize[_0x72c3('0x1')],'defaultValue':function(){return rs[_0x72c3('0x3')]();}},'replyUri':{'type':Sequelize[_0x72c3('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x72c3('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x72c3('0x4')],'defaultValue':function(){return _0x72c3('0x5');}},'notificationSound':{'type':Sequelize[_0x72c3('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x72c3('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x72c3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x72c3('0x1')]},'queueTransfer':{'type':Sequelize[_0x72c3('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x72c3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x72c3('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x72c3('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x72c3('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x72c3('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x72c3('0x9'),'set':function(_0x4af05b){if(!_0x4af05b)this[_0x72c3('0xa')](_0x72c3('0xb'),null);this['setDataValue'](_0x72c3('0xc'),_0x4af05b);}}}; \ No newline at end of file +var _0x74af=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x31f420,_0x2ea4fe){var _0x90f962=function(_0x253b45){while(--_0x253b45){_0x31f420['push'](_0x31f420['shift']());}};_0x90f962(++_0x2ea4fe);}(_0x74af,0x85));var _0xf74a=function(_0x57195b,_0x4f0a5e){_0x57195b=_0x57195b-0x0;var _0x196754=_0x74af[_0x57195b];return _0x196754;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf74a('0x0'));module['exports']={'name':{'type':Sequelize[_0xf74a('0x1')],'unique':_0xf74a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xf74a('0x1')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf74a('0x3')]();}},'replyUri':{'type':Sequelize[_0xf74a('0x1')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf74a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf74a('0x4')],'defaultValue':function(){return _0xf74a('0x5');}},'notificationSound':{'type':Sequelize[_0xf74a('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf74a('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf74a('0x1')]},'queueTransfer':{'type':Sequelize[_0xf74a('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf74a('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf74a('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf74a('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xf74a('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xf74a('0x9'),'set':function(_0x48c528){if(!_0x48c528)this[_0xf74a('0xa')](_0xf74a('0xb'),null);this[_0xf74a('0xa')](_0xf74a('0xc'),_0x48c528);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 5d928f2..a0ab4ec 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 _0xc327=['show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','findOne','hasOwnProperty','removeAnswers','openchannel','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','List','applications','Applications','list','priority','asc','account','contact','firstName','lastName','OpenchannelInteraction','threadId','externalUrl','ContactId','messageId','interaction','created','autoclose','close','*,*,*,*','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','notify','sequelize','transaction','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','getInteractions','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','OpenchannelAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','OpenchannelAccount','fieldName','type','map','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0xc327,0x1d9));var _0x7c32=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0xc327[_0x484e36];return _0xafc85d;};'use strict';var emlformat=require(_0x7c32('0x0'));var rimraf=require(_0x7c32('0x1'));var zipdir=require(_0x7c32('0x2'));var jsonpatch=require(_0x7c32('0x3'));var rp=require(_0x7c32('0x4'));var moment=require(_0x7c32('0x5'));var BPromise=require(_0x7c32('0x6'));var Mustache=require(_0x7c32('0x7'));var util=require(_0x7c32('0x8'));var path=require(_0x7c32('0x9'));var sox=require(_0x7c32('0xa'));var csv=require(_0x7c32('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c32('0xc'));var _=require(_0x7c32('0xd'));var squel=require(_0x7c32('0xe'));var crypto=require('crypto');var jsforce=require(_0x7c32('0xf'));var deskjs=require(_0x7c32('0x10'));var toCsv=require(_0x7c32('0xb'));var querystring=require(_0x7c32('0x11'));var Papa=require(_0x7c32('0x12'));var Redis=require(_0x7c32('0x13'));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')('api');var utils=require(_0x7c32('0x14'));var config=require(_0x7c32('0x15'));var licenseUtil=require(_0x7c32('0x16'));var db=require(_0x7c32('0x17'))['db'];config[_0x7c32('0x18')]=_[_0x7c32('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7c32('0x1a'))(new Redis(config[_0x7c32('0x18')]));require(_0x7c32('0x1b'))[_0x7c32('0x1c')](socket);var jayson=require(_0x7c32('0x1d'));var client=jayson[_0x7c32('0x1e')][_0x7c32('0x1f')]({'port':0x232c});var client9002=jayson[_0x7c32('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a84d1,_0x2be6bb,_0x41eb47,_0x1a7458){return new BPromise(function(_0x50c644,_0x3b1382){var _0x1c0992=_0x1a7458||client;return _0x1c0992[_0x7c32('0x20')](_0x2a84d1,_0x41eb47)['then'](function(_0x4ab872){logger['info'](_0x7c32('0x21'),_0x2be6bb,_0x7c32('0x22'));logger[_0x7c32('0x23')](_0x7c32('0x24'),_0x2be6bb,_0x7c32('0x22'),JSON[_0x7c32('0x25')](_0x4ab872));if(_0x4ab872['error']){if(_0x4ab872[_0x7c32('0x26')][_0x7c32('0x27')]===0x1f4){logger[_0x7c32('0x26')](_0x7c32('0x21'),_0x2be6bb,_0x4ab872[_0x7c32('0x26')]['message']);return _0x3b1382(_0x4ab872[_0x7c32('0x26')]['message']);}logger[_0x7c32('0x26')](_0x7c32('0x21'),_0x2be6bb,_0x4ab872[_0x7c32('0x26')][_0x7c32('0x28')]);return _0x50c644(_0x4ab872[_0x7c32('0x26')][_0x7c32('0x28')]);}else{logger[_0x7c32('0x29')](_0x7c32('0x21'),_0x2be6bb,_0x7c32('0x22'));_0x50c644(_0x4ab872[_0x7c32('0x2a')][_0x7c32('0x28')]);}})[_0x7c32('0x2b')](function(_0x154f16){logger[_0x7c32('0x26')](_0x7c32('0x21'),_0x2be6bb,_0x154f16);_0x3b1382(_0x154f16);});});}function respondWithStatusCode(_0x1a91f1,_0x356a67){_0x356a67=_0x356a67||0xcc;return function(_0x37139f){if(_0x37139f){return _0x1a91f1[_0x7c32('0x2c')](_0x356a67);}return _0x1a91f1[_0x7c32('0x2d')](_0x356a67)[_0x7c32('0x2e')]();};}function respondWithResult(_0x103dea,_0x2f2cfc){_0x2f2cfc=_0x2f2cfc||0xc8;return function(_0x48bab3){if(_0x48bab3){return _0x103dea[_0x7c32('0x2d')](_0x2f2cfc)[_0x7c32('0x2f')](_0x48bab3);}};}function respondWithFilteredResult(_0x39eab8,_0x19c7d3){return function(_0x4980fd){if(_0x4980fd){var _0x54c4eb=typeof _0x19c7d3[_0x7c32('0x30')]===_0x7c32('0x31')&&typeof _0x19c7d3[_0x7c32('0x32')]===_0x7c32('0x31');var _0x4e9196=_0x4980fd[_0x7c32('0x33')];var _0x16120d=_0x54c4eb?0x0:_0x19c7d3[_0x7c32('0x30')];var _0x480cb2=_0x54c4eb?_0x4980fd[_0x7c32('0x33')]:_0x19c7d3[_0x7c32('0x30')]+_0x19c7d3[_0x7c32('0x32')];var _0xb00c12;if(_0x480cb2>=_0x4e9196){_0x480cb2=_0x4e9196;_0xb00c12=0xc8;}else{_0xb00c12=0xce;}_0x39eab8[_0x7c32('0x2d')](_0xb00c12);return _0x39eab8['set'](_0x7c32('0x34'),_0x16120d+'-'+_0x480cb2+'/'+_0x4e9196)[_0x7c32('0x2f')](_0x4980fd);}return null;};}function patchUpdates(_0x167707){return function(_0x419e54){try{jsonpatch[_0x7c32('0x35')](_0x419e54,_0x167707,!![]);}catch(_0x3285dc){return BPromise['reject'](_0x3285dc);}return _0x419e54[_0x7c32('0x36')]();};}function saveUpdates(_0x23fdf8,_0x36a9ff){return function(_0x83a1b6){if(_0x83a1b6){return _0x83a1b6[_0x7c32('0x37')](_0x23fdf8)[_0x7c32('0x38')](function(_0x9ff27d){return _0x9ff27d;});}return null;};}function removeEntity(_0x1706d9,_0x1bc77d){return function(_0x28990c){if(_0x28990c){return _0x28990c[_0x7c32('0x39')]()[_0x7c32('0x38')](function(){var _0x38b9a8=_0x28990c['get']({'plain':!![]});var _0x5db116=_0x7c32('0x3a');return db[_0x7c32('0x3b')][_0x7c32('0x39')]({'where':{'type':_0x5db116,'resourceId':_0x38b9a8['id']}})[_0x7c32('0x38')](function(){return _0x28990c;});})[_0x7c32('0x38')](function(){_0x1706d9[_0x7c32('0x2d')](0xcc)[_0x7c32('0x2e')]();});}};}function handleEntityNotFound(_0x3b5169,_0xd3405e){return function(_0x55c749){if(!_0x55c749){_0x3b5169['sendStatus'](0x194);}return _0x55c749;};}function handleError(_0x58ce38,_0x3a7674){_0x3a7674=_0x3a7674||0x1f4;return function(_0x5c1a72){logger[_0x7c32('0x26')](_0x5c1a72[_0x7c32('0x3c')]);if(_0x5c1a72[_0x7c32('0x3d')]){delete _0x5c1a72[_0x7c32('0x3d')];}_0x58ce38[_0x7c32('0x2d')](_0x3a7674)[_0x7c32('0x3e')](_0x5c1a72);};}exports['index']=function(_0x31dd60,_0x5aabe4){var _0x2bd455={'include':[{'model':db[_0x7c32('0x3f')],'as':_0x7c32('0x40')}]},_0x50982f={},_0x570439={'count':0x0,'rows':[]};var _0x1a1a39=_['map'](db[_0x7c32('0x41')]['rawAttributes'],function(_0x1c8091){return{'name':_0x1c8091[_0x7c32('0x42')],'type':_0x1c8091[_0x7c32('0x43')]['key']};});_0x50982f['model']=_[_0x7c32('0x44')](_0x1a1a39,_0x7c32('0x3d'));_0x50982f[_0x7c32('0x45')]=_[_0x7c32('0x46')](_0x31dd60['query']);_0x50982f[_0x7c32('0x47')]=_[_0x7c32('0x48')](_0x50982f[_0x7c32('0x49')],_0x50982f[_0x7c32('0x45')]);_0x2bd455['attributes']=_[_0x7c32('0x48')](_0x50982f[_0x7c32('0x49')],qs[_0x7c32('0x4a')](_0x31dd60[_0x7c32('0x45')][_0x7c32('0x4a')]));_0x2bd455['attributes']=_0x2bd455[_0x7c32('0x4b')][_0x7c32('0x4c')]?_0x2bd455[_0x7c32('0x4b')]:_0x50982f['model'];if(!_0x31dd60['query']['hasOwnProperty'](_0x7c32('0x4d'))){_0x2bd455[_0x7c32('0x32')]=qs[_0x7c32('0x32')](_0x31dd60[_0x7c32('0x45')][_0x7c32('0x32')]);_0x2bd455[_0x7c32('0x30')]=qs[_0x7c32('0x30')](_0x31dd60[_0x7c32('0x45')][_0x7c32('0x30')]);}_0x2bd455[_0x7c32('0x4e')]=qs['sort'](_0x31dd60[_0x7c32('0x45')][_0x7c32('0x4f')]);_0x2bd455[_0x7c32('0x50')]=qs[_0x7c32('0x47')](_[_0x7c32('0x51')](_0x31dd60[_0x7c32('0x45')],_0x50982f[_0x7c32('0x47')]),_0x1a1a39);if(_0x31dd60[_0x7c32('0x45')]['filter']){_0x2bd455['where']=_[_0x7c32('0x52')](_0x2bd455[_0x7c32('0x50')],{'$or':_[_0x7c32('0x44')](_0x1a1a39,function(_0x187735){if(_0x187735['type']!=='VIRTUAL'){var _0x5e9594={};_0x5e9594[_0x187735[_0x7c32('0x3d')]]={'$like':'%'+_0x31dd60[_0x7c32('0x45')][_0x7c32('0x53')]+'%'};return _0x5e9594;}})});}_0x2bd455=_[_0x7c32('0x52')]({},_0x2bd455,_0x31dd60['options']);var _0x37bce8={'where':_0x2bd455[_0x7c32('0x50')]};return db[_0x7c32('0x41')][_0x7c32('0x33')](_0x37bce8)[_0x7c32('0x38')](function(_0x1b57b9){_0x570439[_0x7c32('0x33')]=_0x1b57b9;if(_0x31dd60[_0x7c32('0x45')][_0x7c32('0x54')]){_0x2bd455[_0x7c32('0x55')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x7c32('0x56')](_0x2bd455);})[_0x7c32('0x38')](function(_0x32715f){_0x570439[_0x7c32('0x57')]=_0x32715f;return _0x570439;})[_0x7c32('0x38')](respondWithFilteredResult(_0x5aabe4,_0x2bd455))['catch'](handleError(_0x5aabe4,null));};exports[_0x7c32('0x58')]=function(_0x4563a7,_0x3af7cd){var _0x4732d7={'raw':![],'where':{'id':_0x4563a7[_0x7c32('0x59')]['id']},'include':[{'model':db[_0x7c32('0x3f')],'as':_0x7c32('0x40')}]},_0x8391cd={};_0x8391cd['model']=_[_0x7c32('0x46')](db['OpenchannelAccount'][_0x7c32('0x5a')]);_0x8391cd[_0x7c32('0x45')]=_[_0x7c32('0x46')](_0x4563a7[_0x7c32('0x45')]);_0x8391cd[_0x7c32('0x47')]=_[_0x7c32('0x48')](_0x8391cd[_0x7c32('0x49')],_0x8391cd[_0x7c32('0x45')]);_0x4732d7[_0x7c32('0x4b')]=_[_0x7c32('0x48')](_0x8391cd[_0x7c32('0x49')],qs[_0x7c32('0x4a')](_0x4563a7[_0x7c32('0x45')][_0x7c32('0x4a')]));_0x4732d7[_0x7c32('0x4b')]=_0x4732d7['attributes'][_0x7c32('0x4c')]?_0x4732d7[_0x7c32('0x4b')]:_0x8391cd[_0x7c32('0x49')];if(_0x4563a7[_0x7c32('0x45')][_0x7c32('0x54')]){_0x4732d7['include']=[{'all':!![]}];}_0x4732d7=_[_0x7c32('0x52')]({},_0x4732d7,_0x4563a7[_0x7c32('0x5b')]);return db[_0x7c32('0x41')][_0x7c32('0x5c')](_0x4732d7)[_0x7c32('0x38')](handleEntityNotFound(_0x3af7cd,null))[_0x7c32('0x38')](respondWithResult(_0x3af7cd,null))[_0x7c32('0x2b')](handleError(_0x3af7cd,null));};exports['create']=function(_0x48a62d,_0x273ed1){return db[_0x7c32('0x41')][_0x7c32('0x5d')](_0x48a62d[_0x7c32('0x5e')],{})['then'](function(_0x3b9a73){var _0xdf0188=_0x48a62d[_0x7c32('0x5f')]['get']({'plain':!![]});if(!_0xdf0188)throw new Error(_0x7c32('0x60'));if(_0xdf0188['role']===_0x7c32('0x5f')){var _0x5bbb0c=_0x3b9a73[_0x7c32('0x61')]({'plain':!![]});var _0x3368e4=_0x7c32('0x3a');return db[_0x7c32('0x62')][_0x7c32('0x5c')]({'where':{'name':_0x3368e4,'userProfileId':_0xdf0188[_0x7c32('0x63')]},'raw':!![]})[_0x7c32('0x38')](function(_0xc317a3){if(_0xc317a3&&_0xc317a3['autoAssociation']===0x0){return db[_0x7c32('0x3b')]['create']({'name':_0x5bbb0c[_0x7c32('0x3d')],'resourceId':_0x5bbb0c['id'],'type':_0xc317a3[_0x7c32('0x3d')],'sectionId':_0xc317a3['id']},{})[_0x7c32('0x38')](function(){return _0x3b9a73;});}else{return _0x3b9a73;}})[_0x7c32('0x2b')](function(_0x214877){logger[_0x7c32('0x26')](_0x7c32('0x64'),_0x214877);throw _0x214877;});}return _0x3b9a73;})[_0x7c32('0x38')](respondWithResult(_0x273ed1,0xc9))[_0x7c32('0x2b')](handleError(_0x273ed1,null));};exports[_0x7c32('0x37')]=function(_0x484ce9,_0x2b8734){if(_0x484ce9[_0x7c32('0x5e')]['id']){delete _0x484ce9[_0x7c32('0x5e')]['id'];}return db[_0x7c32('0x41')]['find']({'where':{'id':_0x484ce9[_0x7c32('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0x7c32('0x40')}]})[_0x7c32('0x38')](handleEntityNotFound(_0x2b8734,null))['then'](saveUpdates(_0x484ce9[_0x7c32('0x5e')],null))[_0x7c32('0x38')](respondWithResult(_0x2b8734,null))[_0x7c32('0x2b')](handleError(_0x2b8734,null));};exports['destroy']=function(_0x415232,_0x324f14){return db[_0x7c32('0x41')][_0x7c32('0x5c')]({'where':{'id':_0x415232[_0x7c32('0x59')]['id']}})['then'](handleEntityNotFound(_0x324f14,null))[_0x7c32('0x38')](removeEntity(_0x324f14,null))[_0x7c32('0x2b')](handleError(_0x324f14,null));};exports[_0x7c32('0x65')]=function(_0x4aca57,_0x5959de){return db[_0x7c32('0x41')][_0x7c32('0x65')]()[_0x7c32('0x38')](respondWithResult(_0x5959de,null))['catch'](handleError(_0x5959de,null));};exports['addDisposition']=function(_0x5f0df6,_0x522d7f,_0x406ded){if(_0x5f0df6[_0x7c32('0x5e')]['id']){delete _0x5f0df6[_0x7c32('0x5e')]['id'];}return db[_0x7c32('0x41')][_0x7c32('0x5c')]({'where':{'id':_0x5f0df6[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x522d7f,null))[_0x7c32('0x38')](function(_0x24e52d){if(_0x24e52d){_0x5f0df6[_0x7c32('0x5e')][_0x7c32('0x66')]=_0x24e52d['id'];return db['Disposition'][_0x7c32('0x5d')](_0x5f0df6[_0x7c32('0x5e')]);}})[_0x7c32('0x38')](respondWithResult(_0x522d7f,null))[_0x7c32('0x2b')](handleError(_0x522d7f,null));};exports['getDispositions']=function(_0x24f8ac,_0x5c985c,_0x43e5be){var _0x3de066={'raw':![],'where':{}};var _0x306ba6={};var _0x1f5d63={'count':0x0,'rows':[]};return db[_0x7c32('0x41')]['findOne']({'where':{'id':_0x24f8ac[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x5c985c,null))['then'](function(_0x570c78){if(_0x570c78){_0x306ba6['model']=_[_0x7c32('0x46')](db[_0x7c32('0x67')][_0x7c32('0x5a')]);_0x306ba6['query']=_[_0x7c32('0x46')](_0x24f8ac[_0x7c32('0x45')]);_0x306ba6[_0x7c32('0x47')]=_[_0x7c32('0x48')](_0x306ba6['model'],_0x306ba6[_0x7c32('0x45')]);_0x3de066[_0x7c32('0x4b')]=_[_0x7c32('0x48')](_0x306ba6[_0x7c32('0x49')],qs[_0x7c32('0x4a')](_0x24f8ac[_0x7c32('0x45')][_0x7c32('0x4a')]));_0x3de066['attributes']=_0x3de066[_0x7c32('0x4b')]['length']?_0x3de066[_0x7c32('0x4b')]:_0x306ba6[_0x7c32('0x49')];if(!_0x24f8ac[_0x7c32('0x45')]['hasOwnProperty']('nolimit')){_0x3de066[_0x7c32('0x32')]=qs['limit'](_0x24f8ac[_0x7c32('0x45')][_0x7c32('0x32')]);_0x3de066[_0x7c32('0x30')]=qs[_0x7c32('0x30')](_0x24f8ac['query'][_0x7c32('0x30')]);}_0x3de066[_0x7c32('0x4e')]=qs['sort'](_0x24f8ac[_0x7c32('0x45')][_0x7c32('0x4f')]);_0x3de066[_0x7c32('0x50')]=qs['filters'](_[_0x7c32('0x51')](_0x24f8ac['query'],_0x306ba6[_0x7c32('0x47')]));_0x3de066[_0x7c32('0x50')][_0x7c32('0x66')]=_0x570c78['id'];if(_0x24f8ac[_0x7c32('0x45')]['filter']){_0x3de066['where']=_[_0x7c32('0x52')](_0x3de066[_0x7c32('0x50')],{'$or':_[_0x7c32('0x44')](_0x3de066['attributes'],function(_0x3e9e69){var _0x439d6c={};_0x439d6c[_0x3e9e69]={'$like':'%'+_0x24f8ac['query'][_0x7c32('0x53')]+'%'};return _0x439d6c;})});}_0x3de066=_[_0x7c32('0x52')]({},_0x3de066,_0x24f8ac[_0x7c32('0x5b')]);return db[_0x7c32('0x67')][_0x7c32('0x33')]({'where':_0x3de066['where']})['then'](function(_0xefdd5a){_0x1f5d63[_0x7c32('0x33')]=_0xefdd5a;if(_0x24f8ac[_0x7c32('0x45')]['includeAll']){_0x3de066[_0x7c32('0x55')]=[{'all':!![]}];}return db[_0x7c32('0x67')]['findAll'](_0x3de066);})[_0x7c32('0x38')](function(_0x1fab83){_0x1f5d63[_0x7c32('0x57')]=_0x1fab83;return _0x1f5d63;});}})['then'](respondWithFilteredResult(_0x5c985c,_0x3de066))[_0x7c32('0x2b')](handleError(_0x5c985c,null));};exports[_0x7c32('0x68')]=function(_0x32ef62,_0x1592c0,_0x1f7d80){return db[_0x7c32('0x41')][_0x7c32('0x5c')]({'where':{'id':_0x32ef62[_0x7c32('0x59')]['id']}})['then'](handleEntityNotFound(_0x1592c0,null))['then'](function(_0x471656){if(_0x471656){return _0x471656[_0x7c32('0x68')](_0x32ef62['query'][_0x7c32('0x69')]);}})[_0x7c32('0x38')](respondWithStatusCode(_0x1592c0,null))[_0x7c32('0x2b')](handleError(_0x1592c0,null));};exports['addAnswer']=function(_0x4e18dc,_0x24a3d8,_0x38923a){if(_0x4e18dc[_0x7c32('0x5e')]['id']){delete _0x4e18dc[_0x7c32('0x5e')]['id'];}return db['OpenchannelAccount'][_0x7c32('0x5c')]({'where':{'id':_0x4e18dc[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x24a3d8,null))['then'](function(_0xea449a){if(_0xea449a){_0x4e18dc[_0x7c32('0x5e')][_0x7c32('0x66')]=_0xea449a['id'];return db[_0x7c32('0x6a')][_0x7c32('0x5d')](_0x4e18dc[_0x7c32('0x5e')]);}})[_0x7c32('0x38')](respondWithResult(_0x24a3d8,null))['catch'](handleError(_0x24a3d8,null));};exports[_0x7c32('0x6b')]=function(_0x37975d,_0x18d099,_0x5848a4){var _0xf004f7={'raw':![],'where':{}};var _0x26a389={};var _0x40b952={'count':0x0,'rows':[]};return db[_0x7c32('0x41')][_0x7c32('0x6c')]({'where':{'id':_0x37975d[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x18d099,null))[_0x7c32('0x38')](function(_0x50b0cf){if(_0x50b0cf){_0x26a389[_0x7c32('0x49')]=_[_0x7c32('0x46')](db[_0x7c32('0x6a')]['rawAttributes']);_0x26a389['query']=_[_0x7c32('0x46')](_0x37975d['query']);_0x26a389[_0x7c32('0x47')]=_[_0x7c32('0x48')](_0x26a389['model'],_0x26a389['query']);_0xf004f7[_0x7c32('0x4b')]=_[_0x7c32('0x48')](_0x26a389[_0x7c32('0x49')],qs[_0x7c32('0x4a')](_0x37975d['query'][_0x7c32('0x4a')]));_0xf004f7['attributes']=_0xf004f7[_0x7c32('0x4b')][_0x7c32('0x4c')]?_0xf004f7[_0x7c32('0x4b')]:_0x26a389[_0x7c32('0x49')];if(!_0x37975d[_0x7c32('0x45')][_0x7c32('0x6d')](_0x7c32('0x4d'))){_0xf004f7['limit']=qs[_0x7c32('0x32')](_0x37975d[_0x7c32('0x45')]['limit']);_0xf004f7['offset']=qs[_0x7c32('0x30')](_0x37975d[_0x7c32('0x45')][_0x7c32('0x30')]);}_0xf004f7[_0x7c32('0x4e')]=qs[_0x7c32('0x4f')](_0x37975d[_0x7c32('0x45')][_0x7c32('0x4f')]);_0xf004f7[_0x7c32('0x50')]=qs[_0x7c32('0x47')](_[_0x7c32('0x51')](_0x37975d[_0x7c32('0x45')],_0x26a389[_0x7c32('0x47')]));_0xf004f7[_0x7c32('0x50')]['OpenchannelAccountId']=_0x50b0cf['id'];if(_0x37975d[_0x7c32('0x45')]['filter']){_0xf004f7[_0x7c32('0x50')]=_[_0x7c32('0x52')](_0xf004f7[_0x7c32('0x50')],{'$or':_['map'](_0xf004f7['attributes'],function(_0x1299aa){var _0x43f472={};_0x43f472[_0x1299aa]={'$like':'%'+_0x37975d[_0x7c32('0x45')][_0x7c32('0x53')]+'%'};return _0x43f472;})});}_0xf004f7=_[_0x7c32('0x52')]({},_0xf004f7,_0x37975d[_0x7c32('0x5b')]);return db[_0x7c32('0x6a')][_0x7c32('0x33')]({'where':_0xf004f7['where']})[_0x7c32('0x38')](function(_0x3ba489){_0x40b952[_0x7c32('0x33')]=_0x3ba489;if(_0x37975d[_0x7c32('0x45')][_0x7c32('0x54')]){_0xf004f7['include']=[{'all':!![]}];}return db[_0x7c32('0x6a')]['findAll'](_0xf004f7);})[_0x7c32('0x38')](function(_0x5f3983){_0x40b952[_0x7c32('0x57')]=_0x5f3983;return _0x40b952;});}})[_0x7c32('0x38')](respondWithFilteredResult(_0x18d099,_0xf004f7))[_0x7c32('0x2b')](handleError(_0x18d099,null));};exports['removeAnswers']=function(_0x2d7535,_0x21857d,_0x14ea1c){return db['OpenchannelAccount'][_0x7c32('0x5c')]({'where':{'id':_0x2d7535[_0x7c32('0x59')]['id']}})['then'](handleEntityNotFound(_0x21857d,null))[_0x7c32('0x38')](function(_0x4d2990){if(_0x4d2990){return _0x4d2990[_0x7c32('0x6e')](_0x2d7535[_0x7c32('0x45')][_0x7c32('0x69')]);}})['then'](respondWithStatusCode(_0x21857d,null))[_0x7c32('0x2b')](handleError(_0x21857d,null));};exports['notify']=function(_0x46a7cb,_0x17bc8b,_0xad830e){var _0x236255={'body':_0x46a7cb[_0x7c32('0x5e')],'channel':_0x7c32('0x6f')};var _0x40037c=[];var _0x1517a5=[];var _0x760c05={};var _0x423b08=![];return db[_0x7c32('0x70')][_0x7c32('0x65')]()[_0x7c32('0x38')](function(_0x3c67b4){if(!_0x3c67b4){throw new db[(_0x7c32('0x71'))]['ValidationError']('no\x20available\x20attributes');}_0x40037c=_[_0x7c32('0x72')](_[_0x7c32('0x46')](_0x3c67b4),[_0x7c32('0x73'),'updatedAt']);_0x1517a5=_[_0x7c32('0x72')](_[_0x7c32('0x46')](_0x3c67b4),['createdAt',_0x7c32('0x74'),_0x7c32('0x75'),_0x7c32('0x76')]);if(_0x46a7cb[_0x7c32('0x5e')]['id']){delete _0x46a7cb[_0x7c32('0x5e')]['id'];}if(_[_0x7c32('0x77')](_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x78')])){throw new db['Sequelize']['ValidationError'](_0x7c32('0x79'));}if(_[_0x7c32('0x77')](_0x46a7cb['body'][_0x7c32('0x5e')])||_0x46a7cb[_0x7c32('0x5e')]['body']===''){throw new db[(_0x7c32('0x71'))][(_0x7c32('0x7a'))](_0x7c32('0x7b'));}if(_['isNil'](_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x7c')])){throw new db['Sequelize'][(_0x7c32('0x7a'))](_0x7c32('0x7d')+_0x1517a5);}if(!_['includes'](_0x1517a5,_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x7c')])){throw new db['Sequelize'][(_0x7c32('0x7a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1517a5);}_0x760c05[_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x7c')]]=_0x46a7cb[_0x7c32('0x5e')]['from'];})[_0x7c32('0x38')](function(){return db[_0x7c32('0x41')][_0x7c32('0x5c')]({'where':{'id':_0x46a7cb[_0x7c32('0x59')]['id']},'include':[{'model':db[_0x7c32('0x7e')],'as':'List','include':[{'model':db[_0x7c32('0x70')],'as':_0x7c32('0x7f'),'where':_0x760c05,'limit':0x1,'order':[[_0x7c32('0x74'),_0x7c32('0x80')]]}]},{'model':db['OpenchannelApplication'],'as':'Applications'}]});})[_0x7c32('0x38')](handleEntityNotFound(_0x17bc8b,null))[_0x7c32('0x38')](function(_0x33ba80){if(_0x33ba80&&_0x33ba80[_0x7c32('0x81')]){_0x236255['account']=_0x33ba80;_0x236255[_0x7c32('0x82')]=_0x33ba80[_0x7c32('0x83')];_0x236255[_0x7c32('0x84')]=_0x33ba80[_0x7c32('0x81')];_0x236255[_0x7c32('0x82')]=_['orderBy'](_0x236255[_0x7c32('0x82')],[_0x7c32('0x85')],[_0x7c32('0x86')]);if(_0x236255[_0x7c32('0x87')][_0x7c32('0x83')]){delete _0x236255[_0x7c32('0x87')]['Applications'];}if(_0x236255['account'][_0x7c32('0x81')]&&_0x236255[_0x7c32('0x87')][_0x7c32('0x81')][_0x7c32('0x7f')][_0x7c32('0x4c')]){return _0x236255[_0x7c32('0x87')][_0x7c32('0x81')]['Contacts'][0x0];}var _0xdfe5a=_[_0x7c32('0x19')](_0x46a7cb[_0x7c32('0x5e')],{'firstName':_0x46a7cb[_0x7c32('0x5e')]['from'],'ListId':_0x33ba80[_0x7c32('0x76')]});_0xdfe5a[_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x7c')]]=_0x46a7cb['body']['from'];return db[_0x7c32('0x70')]['create'](_0xdfe5a,{'fields':_0x40037c,'raw':!![]});}})[_0x7c32('0x38')](handleEntityNotFound(_0x17bc8b,null))[_0x7c32('0x38')](function(_0x18de35){_0x236255[_0x7c32('0x88')]=_0x18de35;if(_0x18de35){var _0x33502f={'ContactId':_0x18de35['id'],'OpenchannelAccountId':_0x46a7cb[_0x7c32('0x59')]['id'],'from':(_0x18de35[_0x7c32('0x89')]||'')+'\x20'+(_0x18de35[_0x7c32('0x8a')]||'')};var _0x266b7c={'OpenchannelAccountId':_0x46a7cb[_0x7c32('0x59')]['id'],'closed':![]};if(_0x46a7cb[_0x7c32('0x5e')]['threadId']){_0x266b7c['threadId']=_0x46a7cb['body']['threadId'];return db[_0x7c32('0x8b')]['find']({'where':_0x266b7c})['then'](function(_0x52811d){if(_0x52811d){return[_0x52811d,![]];}_0x33502f[_0x7c32('0x8c')]=_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x8c')];_0x33502f[_0x7c32('0x8d')]=_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x8d')];return db[_0x7c32('0x8b')][_0x7c32('0x5d')](_0x33502f)[_0x7c32('0x38')](function(_0x5f1229){return[_0x5f1229,!![]];});});}else{_0x266b7c[_0x7c32('0x8c')]=null;}_0x266b7c[_0x7c32('0x8e')]=_0x18de35['id'];return db[_0x7c32('0x8b')]['find']({'where':_0x266b7c})[_0x7c32('0x38')](function(_0x344549){if(_0x344549){return[_0x344549,![]];}return db[_0x7c32('0x8b')][_0x7c32('0x5d')](_0x33502f)[_0x7c32('0x38')](function(_0x53afa9){return[_0x53afa9,!![]];});});}})['spread'](function(_0x1d4e67,_0x1ada35){if(_0x1d4e67){_0x423b08=_0x1ada35;if(!_0x1ada35){var _0x58d5b3={'from':(_0x236255[_0x7c32('0x88')][_0x7c32('0x89')]||'')+'\x20'+(_0x236255[_0x7c32('0x88')][_0x7c32('0x8a')]||'')};if(_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x8c')]&&_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x8f')]&&_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x8c')]!=_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x8f')]){_0x58d5b3[_0x7c32('0x8c')]=_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x8f')];}return _0x1d4e67[_0x7c32('0x37')](_0x58d5b3);}else{return _0x1d4e67;}}})[_0x7c32('0x38')](function(_0x2d0843){_0x236255[_0x7c32('0x90')]=_0x2d0843[_0x7c32('0x61')]({'plain':!![]});_0x236255[_0x7c32('0x90')][_0x7c32('0x91')]=_0x423b08;if(_0x236255[_0x7c32('0x90')][_0x7c32('0x91')]){if(_0x236255[_0x7c32('0x87')][_0x7c32('0x92')]){_0x236255['applications']['push']({'id':0x0,'priority':_0x236255[_0x7c32('0x82')][_0x7c32('0x4c')]+0x1,'app':_0x7c32('0x93'),'appdata':'unmanaged','interval':_0x7c32('0x94')});}}return db['OpenchannelMessage'][_0x7c32('0x5d')]({'body':_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x5e')],'OpenchannelAccountId':_0x46a7cb[_0x7c32('0x59')]['id'],'OpenchannelInteractionId':_0x2d0843['id'],'direction':'in','ContactId':_0x236255[_0x7c32('0x88')]['id'],'AttachmentId':_0x46a7cb[_0x7c32('0x5e')][_0x7c32('0x95')]});})[_0x7c32('0x38')](function(_0x45e092){_0x236255[_0x7c32('0x28')]=_0x45e092;if(_0x236255['interaction'][_0x7c32('0x96')]){return db[_0x7c32('0x97')][_0x7c32('0x5c')]({'attributes':['id',_0x7c32('0x3d')],'where':{'id':_0x236255['interaction'][_0x7c32('0x96')]}})[_0x7c32('0x38')](function(_0x28c99d){if(_0x28c99d){_0x236255[_0x7c32('0x82')][_0x7c32('0x98')]({'id':0x0,'priority':0x0,'app':_0x7c32('0x99'),'appdata':_0x28c99d[_0x7c32('0x3d')]+','+(_0x236255[_0x7c32('0x87')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x236255[_0x7c32('0x9a')]=![];}return respondWithRpcPromise(_0x7c32('0x9b'),'startRouting',_0x236255);});}return respondWithRpcPromise('Start',_0x7c32('0x9c'),_0x236255);})[_0x7c32('0x38')](function(_0x45d829){respondWithRpcPromise(_0x7c32('0x9d'),_0x7c32('0x9d'),{'event':_0x7c32('0x9e'),'message':_0x45d829},client9002);return _0x45d829;})[_0x7c32('0x38')](respondWithResult(_0x17bc8b,null))[_0x7c32('0x2b')](handleError(_0x17bc8b,null));};exports['addApplications']=function(_0x258646,_0x35a317,_0x3f7047){return db[_0x7c32('0x41')][_0x7c32('0x6c')]({'where':{'id':_0x258646[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x35a317,null))['then'](function(_0x1ca2ac){if(_0x1ca2ac){return db[_0x7c32('0x9f')][_0x7c32('0xa0')](function(_0x44eeb3){return db[_0x7c32('0xa1')]['destroy']({'where':{'OpenchannelAccountId':_0x258646[_0x7c32('0x59')]['id']},'transaction':_0x44eeb3})[_0x7c32('0x38')](function(_0x384bf5){var _0x2cdf6f=_[_0x7c32('0x44')](_0x258646['body'],function(_0xb84ef8){_0xb84ef8['OpenchannelAccountId']=_0x258646[_0x7c32('0x59')]['id'];return _0xb84ef8;});return db[_0x7c32('0xa1')][_0x7c32('0xa2')](_0x2cdf6f,{'transaction':_0x44eeb3});});})['then'](function(){return db[_0x7c32('0xa1')][_0x7c32('0xa3')]({'where':{'OpenchannelAccountId':_0x258646[_0x7c32('0x59')]['id']},'order':_0x7c32('0x85')});});}})[_0x7c32('0x38')](respondWithResult(_0x35a317,null))[_0x7c32('0x2b')](handleError(_0x35a317,null));};exports[_0x7c32('0xa4')]=function(_0x2ba15b,_0x1b4089,_0x1636ff){var _0x4ab637={};var _0xaae45d={};var _0x13d514;var _0x520647;return db[_0x7c32('0x41')][_0x7c32('0x6c')]({'where':{'id':_0x2ba15b['params']['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x1b4089,null))[_0x7c32('0x38')](function(_0x971d8f){if(_0x971d8f){_0x13d514=_0x971d8f;_0xaae45d['model']=_[_0x7c32('0x46')](db[_0x7c32('0xa1')]['rawAttributes']);_0xaae45d['query']=_[_0x7c32('0x46')](_0x2ba15b[_0x7c32('0x45')]);_0xaae45d[_0x7c32('0x47')]=_[_0x7c32('0x48')](_0xaae45d[_0x7c32('0x49')],_0xaae45d[_0x7c32('0x45')]);_0x4ab637['attributes']=_[_0x7c32('0x48')](_0xaae45d['model'],qs[_0x7c32('0x4a')](_0x2ba15b[_0x7c32('0x45')][_0x7c32('0x4a')]));_0x4ab637['attributes']=_0x4ab637[_0x7c32('0x4b')][_0x7c32('0x4c')]?_0x4ab637[_0x7c32('0x4b')]:_0xaae45d[_0x7c32('0x49')];_0x4ab637['order']=qs[_0x7c32('0x4f')](_0x2ba15b[_0x7c32('0x45')]['sort']);_0x4ab637[_0x7c32('0x50')]=qs[_0x7c32('0x47')](_['pick'](_0x2ba15b[_0x7c32('0x45')],_0xaae45d[_0x7c32('0x47')]));if(_0x2ba15b[_0x7c32('0x45')][_0x7c32('0x53')]){_0x4ab637[_0x7c32('0x50')]=_[_0x7c32('0x52')](_0x4ab637['where'],{'$or':_[_0x7c32('0x44')](_0x4ab637[_0x7c32('0x4b')],function(_0x2692fe){var _0xbad002={};_0xbad002[_0x2692fe]={'$like':'%'+_0x2ba15b[_0x7c32('0x45')]['filter']+'%'};return _0xbad002;})});}_0x4ab637=_[_0x7c32('0x52')]({},_0x4ab637,_0x2ba15b[_0x7c32('0x5b')]);return _0x13d514['getApplications'](_0x4ab637);}})[_0x7c32('0x38')](function(_0x41d0cb){if(_0x41d0cb){_0x520647=_0x41d0cb[_0x7c32('0x4c')];if(!_0x2ba15b[_0x7c32('0x45')][_0x7c32('0x6d')](_0x7c32('0x4d'))){_0x4ab637[_0x7c32('0x32')]=qs[_0x7c32('0x32')](_0x2ba15b[_0x7c32('0x45')][_0x7c32('0x32')]);_0x4ab637[_0x7c32('0x30')]=qs[_0x7c32('0x30')](_0x2ba15b[_0x7c32('0x45')][_0x7c32('0x30')]);}return _0x13d514['getApplications'](_0x4ab637);}})[_0x7c32('0x38')](function(_0x1c69ce){if(_0x1c69ce){return _0x1c69ce?{'count':_0x520647,'rows':_0x1c69ce}:null;}})[_0x7c32('0x38')](respondWithResult(_0x1b4089,null))[_0x7c32('0x2b')](handleError(_0x1b4089,null));};exports[_0x7c32('0xa5')]=function(_0x3fc2c0,_0x4586a8,_0x53baca){var _0x542c0e={'raw':![],'where':{}};var _0x55e7c6={};var _0x156c6c={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x3fc2c0[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x4586a8,null))['then'](function(_0x3a83a5){if(_0x3a83a5){_0x55e7c6['model']=_[_0x7c32('0x46')](db[_0x7c32('0x8b')]['rawAttributes']);_0x55e7c6['query']=_[_0x7c32('0x46')](_0x3fc2c0[_0x7c32('0x45')]);_0x55e7c6[_0x7c32('0x47')]=_['intersection'](_0x55e7c6[_0x7c32('0x49')],_0x55e7c6['query']);_0x542c0e[_0x7c32('0x4b')]=_[_0x7c32('0x48')](_0x55e7c6['model'],qs[_0x7c32('0x4a')](_0x3fc2c0[_0x7c32('0x45')]['fields']));_0x542c0e[_0x7c32('0x4b')]=_0x542c0e['attributes'][_0x7c32('0x4c')]?_0x542c0e[_0x7c32('0x4b')]:_0x55e7c6['model'];if(!_0x3fc2c0[_0x7c32('0x45')][_0x7c32('0x6d')](_0x7c32('0x4d'))){_0x542c0e[_0x7c32('0x32')]=qs['limit'](_0x3fc2c0['query']['limit']);_0x542c0e['offset']=qs[_0x7c32('0x30')](_0x3fc2c0[_0x7c32('0x45')][_0x7c32('0x30')]);}_0x542c0e[_0x7c32('0x4e')]=qs[_0x7c32('0x4f')](_0x3fc2c0[_0x7c32('0x45')][_0x7c32('0x4f')]);_0x542c0e['where']=qs['filters'](_[_0x7c32('0x51')](_0x3fc2c0['query'],_0x55e7c6[_0x7c32('0x47')]));_0x542c0e[_0x7c32('0x50')][_0x7c32('0x66')]=_0x3a83a5['id'];if(_0x3fc2c0[_0x7c32('0x45')]['filter']){_0x542c0e[_0x7c32('0x50')]=_[_0x7c32('0x52')](_0x542c0e[_0x7c32('0x50')],{'$or':_[_0x7c32('0x44')](_0x542c0e[_0x7c32('0x4b')],function(_0x5b085b){var _0x260d04={};_0x260d04[_0x5b085b]={'$like':'%'+_0x3fc2c0[_0x7c32('0x45')][_0x7c32('0x53')]+'%'};return _0x260d04;})});}_0x542c0e=_['merge']({},_0x542c0e,_0x3fc2c0['options']);return db[_0x7c32('0x8b')][_0x7c32('0x33')]({'where':_0x542c0e['where']})[_0x7c32('0x38')](function(_0x1174dd){_0x156c6c[_0x7c32('0x33')]=_0x1174dd;if(_0x3fc2c0[_0x7c32('0x45')][_0x7c32('0x54')]){_0x542c0e[_0x7c32('0x55')]=[{'model':db[_0x7c32('0x70')],'as':'Contact','required':![]},{'model':db[_0x7c32('0x97')],'as':_0x7c32('0xa6'),'attributes':['name',_0x7c32('0xa7'),_0x7c32('0xa8')],'required':![]},{'model':db[_0x7c32('0xa9')],'as':_0x7c32('0xaa'),'attributes':['id','name',_0x7c32('0xab')],'where':_0x3fc2c0['query'][_0x7c32('0xac')]?{'id':_0x3fc2c0[_0x7c32('0x45')][_0x7c32('0xac')]}:undefined,'required':_0x3fc2c0[_0x7c32('0x45')][_0x7c32('0xac')]?!![]:![]}];}return db[_0x7c32('0x8b')]['findAll'](_0x542c0e);})[_0x7c32('0x38')](function(_0xed9ecf){_0x156c6c[_0x7c32('0x57')]=_0xed9ecf;return _0x156c6c;});}})[_0x7c32('0x38')](respondWithFilteredResult(_0x4586a8,_0x542c0e))['catch'](handleError(_0x4586a8,null));};exports[_0x7c32('0xad')]=function(_0x45f91e,_0x85e9ee,_0x3e255b){return db[_0x7c32('0x41')][_0x7c32('0x5c')]({'where':{'id':_0x45f91e[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x85e9ee,null))[_0x7c32('0x38')](function(_0x576660){if(_0x576660){return _0x576660[_0x7c32('0xad')](_0x45f91e[_0x7c32('0x5e')][_0x7c32('0x69')],_[_0x7c32('0xae')](_0x45f91e['body'],['ids','id'])||{})[_0x7c32('0xaf')](function(_0x272ac6){for(var _0x30016b=0x0;_0x30016b<_0x45f91e[_0x7c32('0x5e')][_0x7c32('0x69')][_0x7c32('0x4c')];_0x30016b+=0x1){socket[_0x7c32('0xb0')](_0x7c32('0xb1'),{'UserId':Number(_0x45f91e[_0x7c32('0x5e')][_0x7c32('0x69')][_0x30016b]),'OpenchannelAccountId':Number(_0x45f91e[_0x7c32('0x59')]['id'])});}return _0x272ac6;});}})['then'](respondWithResult(_0x85e9ee,null))[_0x7c32('0x2b')](handleError(_0x85e9ee,null));};exports[_0x7c32('0xb2')]=function(_0x52294b,_0x273e5e,_0x42aa11){return db[_0x7c32('0x41')]['find']({'where':{'id':_0x52294b[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x273e5e,null))[_0x7c32('0x38')](function(_0x20d0c1){if(_0x20d0c1){return _0x20d0c1[_0x7c32('0xb2')](_0x52294b[_0x7c32('0x45')]['ids'])['then'](function(){if(_[_0x7c32('0xb3')](_0x52294b[_0x7c32('0x45')]['ids'])){for(var _0x203d98=0x0;_0x203d98<_0x52294b[_0x7c32('0x45')]['ids']['length'];_0x203d98+=0x1){socket[_0x7c32('0xb0')](_0x7c32('0xb4'),{'UserId':Number(_0x52294b[_0x7c32('0x45')][_0x7c32('0x69')][_0x203d98]),'OpenchannelAccountId':Number(_0x52294b['params']['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x52294b[_0x7c32('0x45')][_0x7c32('0x69')]),'OpenchannelAccountId':Number(_0x52294b[_0x7c32('0x59')]['id'])});}});}})[_0x7c32('0x38')](respondWithStatusCode(_0x273e5e,null))[_0x7c32('0x2b')](handleError(_0x273e5e,null));};exports[_0x7c32('0xb5')]=function(_0x461502,_0x4d745e,_0x2af66f){var _0x1c2d05={};var _0x24fa0c={};var _0x4e17fd;var _0x54942c;return db[_0x7c32('0x41')][_0x7c32('0x6c')]({'where':{'id':_0x461502[_0x7c32('0x59')]['id']}})['then'](handleEntityNotFound(_0x4d745e,null))['then'](function(_0xbf0027){if(_0xbf0027){_0x4e17fd=_0xbf0027;_0x24fa0c['model']=_[_0x7c32('0x46')](db['User'][_0x7c32('0x5a')]);_0x24fa0c[_0x7c32('0x45')]=_[_0x7c32('0x46')](_0x461502['query']);_0x24fa0c['filters']=_[_0x7c32('0x48')](_0x24fa0c[_0x7c32('0x49')],_0x24fa0c[_0x7c32('0x45')]);_0x1c2d05[_0x7c32('0x4b')]=_[_0x7c32('0x48')](_0x24fa0c[_0x7c32('0x49')],qs[_0x7c32('0x4a')](_0x461502['query'][_0x7c32('0x4a')]));_0x1c2d05[_0x7c32('0x4b')]=_0x1c2d05[_0x7c32('0x4b')]['length']?_0x1c2d05['attributes']:_0x24fa0c[_0x7c32('0x49')];_0x1c2d05[_0x7c32('0x4e')]=qs[_0x7c32('0x4f')](_0x461502[_0x7c32('0x45')][_0x7c32('0x4f')]);_0x1c2d05[_0x7c32('0x50')]=qs[_0x7c32('0x47')](_[_0x7c32('0x51')](_0x461502['query'],_0x24fa0c['filters']));if(_0x461502['query']['filter']){_0x1c2d05['where']=_['merge'](_0x1c2d05['where'],{'$or':_[_0x7c32('0x44')](_0x1c2d05['attributes'],function(_0x23e5b2){var _0xf6b71f={};_0xf6b71f[_0x23e5b2]={'$like':'%'+_0x461502[_0x7c32('0x45')][_0x7c32('0x53')]+'%'};return _0xf6b71f;})});}_0x1c2d05=_[_0x7c32('0x52')]({},_0x1c2d05,_0x461502['options']);return _0x4e17fd[_0x7c32('0xb5')](_0x1c2d05);}})['then'](function(_0x2e5ec1){if(_0x2e5ec1){_0x54942c=_0x2e5ec1[_0x7c32('0x4c')];if(!_0x461502[_0x7c32('0x45')][_0x7c32('0x6d')](_0x7c32('0x4d'))){_0x1c2d05[_0x7c32('0x32')]=qs[_0x7c32('0x32')](_0x461502[_0x7c32('0x45')]['limit']);_0x1c2d05[_0x7c32('0x30')]=qs[_0x7c32('0x30')](_0x461502['query'][_0x7c32('0x30')]);}return _0x4e17fd[_0x7c32('0xb5')](_0x1c2d05);}})[_0x7c32('0x38')](function(_0x5a455a){if(_0x5a455a){return _0x5a455a?{'count':_0x54942c,'rows':_0x5a455a}:null;}})[_0x7c32('0x38')](respondWithResult(_0x4d745e,null))[_0x7c32('0x2b')](handleError(_0x4d745e,null));};exports[_0x7c32('0x3e')]=function(_0x4d1f92,_0x57b2fe,_0x23d987){var _0x459c9d,_0x81f056,_0x5d4dc2;if(_[_0x7c32('0x77')](_0x4d1f92[_0x7c32('0x5e')][_0x7c32('0x5e')])||_0x4d1f92[_0x7c32('0x5e')][_0x7c32('0x5e')]===''){throw new db[(_0x7c32('0x71'))][(_0x7c32('0x7a'))](_0x7c32('0x7b'));}if(_[_0x7c32('0x77')](_0x4d1f92[_0x7c32('0x5e')]['to'])){}_0x459c9d=_0x4d1f92[_0x7c32('0x5e')]['to'];return db[_0x7c32('0x41')][_0x7c32('0x6c')]({'where':{'id':_0x4d1f92[_0x7c32('0x59')]['id']}})[_0x7c32('0x38')](handleEntityNotFound(_0x57b2fe,null))[_0x7c32('0x38')](function(_0x4b3b38){if(_0x4b3b38){return db['OpenchannelAccount'][_0x7c32('0x5c')]({'where':{'id':_0x4b3b38['id']},'include':[{'model':db[_0x7c32('0x7e')],'as':_0x7c32('0x81'),'include':[{'model':db[_0x7c32('0x70')],'as':'Contacts','where':{[_0x4b3b38['mapKey']]:_0x459c9d},'limit':0x1,'order':[[_0x7c32('0x74'),'DESC']]}]}]})[_0x7c32('0x38')](handleEntityNotFound(_0x57b2fe,null))['then'](function(_0x18d3ff){if(_0x18d3ff&&_0x18d3ff['List']){_0x81f056=_0x18d3ff[_0x7c32('0x61')]({'plain':!![]});if(_0x81f056['List']&&_0x81f056[_0x7c32('0x81')][_0x7c32('0x7f')][_0x7c32('0x4c')]){return _0x81f056[_0x7c32('0x81')][_0x7c32('0x7f')][0x0];}return db[_0x7c32('0x70')][_0x7c32('0x5d')](_[_0x7c32('0x19')](_0x4d1f92[_0x7c32('0x5e')],{'firstName':_0x459c9d,[_0x18d3ff['mapKey']]:_0x459c9d,'phone':_0x459c9d,'ListId':_0x81f056[_0x7c32('0x76')]}));}})[_0x7c32('0x38')](handleEntityNotFound(_0x57b2fe,null))[_0x7c32('0x38')](function(_0x4bfc75){if(_0x4bfc75){_0x5d4dc2=_0x4bfc75;return db[_0x7c32('0x8b')][_0x7c32('0x5c')]({'where':{'ContactId':_0x5d4dc2['id'],'closed':![],'OpenchannelAccountId':_0x81f056['id']}})['then'](function(_0x2e7f0b){if(_0x2e7f0b){return[_0x2e7f0b,![]];}return db['OpenchannelInteraction'][_0x7c32('0x5d')]({'UserId':_0x4d1f92[_0x7c32('0x5f')]['id'],'ContactId':_0x5d4dc2['id'],'OpenchannelAccountId':_0x81f056['id'],'lastMsgDirection':_0x7c32('0xb6'),'Messages':[_[_0x7c32('0x52')](_0x4d1f92['body'],{'read':![],'body':_0x4d1f92['body']['body'],'OpenchannelAccountId':_0x81f056['id'],'UserId':_0x4d1f92[_0x7c32('0x5f')]['id'],'ContactId':_0x5d4dc2['id']})]},{'include':[{'model':db[_0x7c32('0xb7')],'as':'Messages'}]})[_0x7c32('0x38')](function(_0xa614e0){return[_0xa614e0,!![]];});});}})['spread'](function(_0x1245a5,_0x44a470){if(_0x44a470){return _0x1245a5;}return db['OpenchannelMessage'][_0x7c32('0x5d')](_['merge'](_0x4d1f92[_0x7c32('0x5e')],{'read':![],'body':_0x4d1f92['body'][_0x7c32('0x5e')],'OpenchannelAccountId':_0x81f056['id'],'OpenchannelInteractionId':_0x1245a5['id'],'UserId':_0x4d1f92[_0x7c32('0x5f')]['id'],'ContactId':_0x5d4dc2['id']}))['then'](function(_0x2d3744){_0x1245a5[_0x7c32('0xb8')][_0x7c32('0xb9')]=[];_0x1245a5['dataValues'][_0x7c32('0xb9')][_0x7c32('0xba')](_0x2d3744['dataValues']);return _0x1245a5;});});}})[_0x7c32('0x38')](respondWithResult(_0x57b2fe,null))['catch'](handleError(_0x57b2fe,null));}; \ No newline at end of file +var _0x5922=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','find','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','findAll','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey','CmList','List','DESC','Applications','account','applications','list','orderBy','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','close','*,*,*,*','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','bulkCreate','OpenchannelApplication','findAndCountAll','priority','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','limit','offset','count','set','Content-Range','apply','save','update','destroy','OpenchannelAccounts','end','stack','name','send','index','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource'];(function(_0x2af053,_0x4f6d28){var _0x4b4001=function(_0x9200c1){while(--_0x9200c1){_0x2af053['push'](_0x2af053['shift']());}};_0x4b4001(++_0x4f6d28);}(_0x5922,0x114));var _0x2592=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x5922[_0x373dee];return _0x46798f;};'use strict';var emlformat=require(_0x2592('0x0'));var rimraf=require(_0x2592('0x1'));var zipdir=require(_0x2592('0x2'));var jsonpatch=require(_0x2592('0x3'));var rp=require(_0x2592('0x4'));var moment=require(_0x2592('0x5'));var BPromise=require(_0x2592('0x6'));var Mustache=require(_0x2592('0x7'));var util=require(_0x2592('0x8'));var path=require('path');var sox=require(_0x2592('0x9'));var csv=require('to-csv');var ejs=require(_0x2592('0xa'));var fs=require('fs');var fs_extra=require(_0x2592('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2592('0xc'));var deskjs=require(_0x2592('0xd'));var toCsv=require(_0x2592('0xe'));var querystring=require(_0x2592('0xf'));var Papa=require(_0x2592('0x10'));var Redis=require(_0x2592('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2592('0x12'));var as=require(_0x2592('0x13'));var hardwareService=require(_0x2592('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x2592('0x15'));var licenseUtil=require(_0x2592('0x16'));var db=require(_0x2592('0x17'))['db'];config[_0x2592('0x18')]=_[_0x2592('0x19')](config[_0x2592('0x18')],{'host':_0x2592('0x1a'),'port':0x18eb});var socket=require(_0x2592('0x1b'))(new Redis(config[_0x2592('0x18')]));require(_0x2592('0x1c'))['register'](socket);var jayson=require(_0x2592('0x1d'));var client=jayson[_0x2592('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x2592('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1299c1,_0xd68706,_0x24aeec,_0x5aabd0){return new BPromise(function(_0x335c63,_0x2042d5){var _0x3a1a51=_0x5aabd0||client;return _0x3a1a51[_0x2592('0x1f')](_0x1299c1,_0x24aeec)[_0x2592('0x20')](function(_0x35911f){logger['info'](_0x2592('0x21'),_0xd68706,_0x2592('0x22'));logger[_0x2592('0x23')](_0x2592('0x24'),_0xd68706,_0x2592('0x22'),JSON[_0x2592('0x25')](_0x35911f));if(_0x35911f['error']){if(_0x35911f['error'][_0x2592('0x26')]===0x1f4){logger['error'](_0x2592('0x21'),_0xd68706,_0x35911f[_0x2592('0x27')][_0x2592('0x28')]);return _0x2042d5(_0x35911f['error']['message']);}logger['error'](_0x2592('0x21'),_0xd68706,_0x35911f[_0x2592('0x27')]['message']);return _0x335c63(_0x35911f[_0x2592('0x27')][_0x2592('0x28')]);}else{logger[_0x2592('0x29')](_0x2592('0x21'),_0xd68706,'request\x20sent');_0x335c63(_0x35911f[_0x2592('0x2a')][_0x2592('0x28')]);}})[_0x2592('0x2b')](function(_0x22ff71){logger[_0x2592('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0xd68706,_0x22ff71);_0x2042d5(_0x22ff71);});});}function respondWithStatusCode(_0xe98607,_0x22f355){_0x22f355=_0x22f355||0xcc;return function(_0x1ae4bb){if(_0x1ae4bb){return _0xe98607[_0x2592('0x2c')](_0x22f355);}return _0xe98607[_0x2592('0x2d')](_0x22f355)['end']();};}function respondWithResult(_0x305cbf,_0x1e6064){_0x1e6064=_0x1e6064||0xc8;return function(_0x95c043){if(_0x95c043){return _0x305cbf[_0x2592('0x2d')](_0x1e6064)['json'](_0x95c043);}};}function respondWithFilteredResult(_0x36995b,_0x32cf22){return function(_0x3ce2fa){if(_0x3ce2fa){var _0x2a0009=typeof _0x32cf22['offset']==='undefined'&&typeof _0x32cf22[_0x2592('0x2e')]==='undefined';var _0x5ee607=_0x3ce2fa['count'];var _0x54287f=_0x2a0009?0x0:_0x32cf22[_0x2592('0x2f')];var _0x2b8f1f=_0x2a0009?_0x3ce2fa[_0x2592('0x30')]:_0x32cf22[_0x2592('0x2f')]+_0x32cf22[_0x2592('0x2e')];var _0x1a08ee;if(_0x2b8f1f>=_0x5ee607){_0x2b8f1f=_0x5ee607;_0x1a08ee=0xc8;}else{_0x1a08ee=0xce;}_0x36995b[_0x2592('0x2d')](_0x1a08ee);return _0x36995b[_0x2592('0x31')](_0x2592('0x32'),_0x54287f+'-'+_0x2b8f1f+'/'+_0x5ee607)['json'](_0x3ce2fa);}return null;};}function patchUpdates(_0x339e2b){return function(_0x157a2a){try{jsonpatch[_0x2592('0x33')](_0x157a2a,_0x339e2b,!![]);}catch(_0x4a7088){return BPromise['reject'](_0x4a7088);}return _0x157a2a[_0x2592('0x34')]();};}function saveUpdates(_0x199122,_0x4d68fa){return function(_0x57ddf7){if(_0x57ddf7){return _0x57ddf7[_0x2592('0x35')](_0x199122)[_0x2592('0x20')](function(_0xdd8820){return _0xdd8820;});}return null;};}function removeEntity(_0x272778,_0x2fbcd2){return function(_0x593c35){if(_0x593c35){return _0x593c35[_0x2592('0x36')]()[_0x2592('0x20')](function(){var _0x22cbb2=_0x593c35['get']({'plain':!![]});var _0x57c889=_0x2592('0x37');return db['UserProfileResource'][_0x2592('0x36')]({'where':{'type':_0x57c889,'resourceId':_0x22cbb2['id']}})[_0x2592('0x20')](function(){return _0x593c35;});})[_0x2592('0x20')](function(){_0x272778['status'](0xcc)[_0x2592('0x38')]();});}};}function handleEntityNotFound(_0x500ff6,_0x4875fa){return function(_0x27f90e){if(!_0x27f90e){_0x500ff6[_0x2592('0x2c')](0x194);}return _0x27f90e;};}function handleError(_0x5d6f64,_0x3043e4){_0x3043e4=_0x3043e4||0x1f4;return function(_0x42548c){logger[_0x2592('0x27')](_0x42548c[_0x2592('0x39')]);if(_0x42548c[_0x2592('0x3a')]){delete _0x42548c['name'];}_0x5d6f64['status'](_0x3043e4)[_0x2592('0x3b')](_0x42548c);};}exports[_0x2592('0x3c')]=function(_0xcbba82,_0x1c61e3){var _0x4b0991={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x51b7a3={},_0x49463d={'count':0x0,'rows':[]};var _0x4e3413=_[_0x2592('0x3d')](db[_0x2592('0x3e')][_0x2592('0x3f')],function(_0x532819){return{'name':_0x532819[_0x2592('0x40')],'type':_0x532819[_0x2592('0x41')][_0x2592('0x42')]};});_0x51b7a3[_0x2592('0x43')]=_[_0x2592('0x3d')](_0x4e3413,_0x2592('0x3a'));_0x51b7a3['query']=_['keys'](_0xcbba82[_0x2592('0x44')]);_0x51b7a3[_0x2592('0x45')]=_[_0x2592('0x46')](_0x51b7a3['model'],_0x51b7a3['query']);_0x4b0991[_0x2592('0x47')]=_['intersection'](_0x51b7a3['model'],qs['fields'](_0xcbba82[_0x2592('0x44')][_0x2592('0x48')]));_0x4b0991[_0x2592('0x47')]=_0x4b0991[_0x2592('0x47')][_0x2592('0x49')]?_0x4b0991[_0x2592('0x47')]:_0x51b7a3[_0x2592('0x43')];if(!_0xcbba82['query'][_0x2592('0x4a')]('nolimit')){_0x4b0991[_0x2592('0x2e')]=qs[_0x2592('0x2e')](_0xcbba82['query'][_0x2592('0x2e')]);_0x4b0991['offset']=qs[_0x2592('0x2f')](_0xcbba82[_0x2592('0x44')][_0x2592('0x2f')]);}_0x4b0991[_0x2592('0x4b')]=qs['sort'](_0xcbba82[_0x2592('0x44')][_0x2592('0x4c')]);_0x4b0991[_0x2592('0x4d')]=qs[_0x2592('0x45')](_[_0x2592('0x4e')](_0xcbba82['query'],_0x51b7a3['filters']),_0x4e3413);if(_0xcbba82[_0x2592('0x44')][_0x2592('0x4f')]){_0x4b0991[_0x2592('0x4d')]=_['merge'](_0x4b0991[_0x2592('0x4d')],{'$or':_[_0x2592('0x3d')](_0x4e3413,function(_0x5f21ae){if(_0x5f21ae[_0x2592('0x41')]!==_0x2592('0x50')){var _0x55c5d6={};_0x55c5d6[_0x5f21ae[_0x2592('0x3a')]]={'$like':'%'+_0xcbba82[_0x2592('0x44')][_0x2592('0x4f')]+'%'};return _0x55c5d6;}})});}_0x4b0991=_[_0x2592('0x51')]({},_0x4b0991,_0xcbba82[_0x2592('0x52')]);var _0xe38e63={'where':_0x4b0991[_0x2592('0x4d')]};return db[_0x2592('0x3e')][_0x2592('0x30')](_0xe38e63)[_0x2592('0x20')](function(_0x3689d0){_0x49463d['count']=_0x3689d0;if(_0xcbba82['query'][_0x2592('0x53')]){_0x4b0991[_0x2592('0x54')]=[{'all':!![]}];}return db[_0x2592('0x3e')]['findAll'](_0x4b0991);})[_0x2592('0x20')](function(_0x10f987){_0x49463d[_0x2592('0x55')]=_0x10f987;return _0x49463d;})['then'](respondWithFilteredResult(_0x1c61e3,_0x4b0991))['catch'](handleError(_0x1c61e3,null));};exports[_0x2592('0x56')]=function(_0xd59f40,_0x2cd12a){var _0x6d677a={'raw':![],'where':{'id':_0xd59f40[_0x2592('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x384ca9={};_0x384ca9['model']=_['keys'](db[_0x2592('0x3e')][_0x2592('0x3f')]);_0x384ca9[_0x2592('0x44')]=_[_0x2592('0x58')](_0xd59f40['query']);_0x384ca9['filters']=_[_0x2592('0x46')](_0x384ca9[_0x2592('0x43')],_0x384ca9[_0x2592('0x44')]);_0x6d677a[_0x2592('0x47')]=_[_0x2592('0x46')](_0x384ca9[_0x2592('0x43')],qs[_0x2592('0x48')](_0xd59f40[_0x2592('0x44')][_0x2592('0x48')]));_0x6d677a[_0x2592('0x47')]=_0x6d677a[_0x2592('0x47')][_0x2592('0x49')]?_0x6d677a[_0x2592('0x47')]:_0x384ca9['model'];if(_0xd59f40['query'][_0x2592('0x53')]){_0x6d677a['include']=[{'all':!![]}];}_0x6d677a=_[_0x2592('0x51')]({},_0x6d677a,_0xd59f40['options']);return db[_0x2592('0x3e')]['find'](_0x6d677a)[_0x2592('0x20')](handleEntityNotFound(_0x2cd12a,null))['then'](respondWithResult(_0x2cd12a,null))[_0x2592('0x2b')](handleError(_0x2cd12a,null));};exports[_0x2592('0x59')]=function(_0x2a4d86,_0xd73bff){return db[_0x2592('0x3e')][_0x2592('0x59')](_0x2a4d86[_0x2592('0x5a')],{})[_0x2592('0x20')](function(_0x526f39){var _0x59b381=_0x2a4d86[_0x2592('0x5b')][_0x2592('0x5c')]({'plain':!![]});if(!_0x59b381)throw new Error(_0x2592('0x5d'));if(_0x59b381[_0x2592('0x5e')]===_0x2592('0x5b')){var _0x220825=_0x526f39[_0x2592('0x5c')]({'plain':!![]});var _0x5f1311=_0x2592('0x37');return db[_0x2592('0x5f')]['find']({'where':{'name':_0x5f1311,'userProfileId':_0x59b381[_0x2592('0x60')]},'raw':!![]})[_0x2592('0x20')](function(_0x53ddd5){if(_0x53ddd5&&_0x53ddd5['autoAssociation']===0x0){return db[_0x2592('0x61')]['create']({'name':_0x220825[_0x2592('0x3a')],'resourceId':_0x220825['id'],'type':_0x53ddd5['name'],'sectionId':_0x53ddd5['id']},{})[_0x2592('0x20')](function(){return _0x526f39;});}else{return _0x526f39;}})[_0x2592('0x2b')](function(_0x3aa5ba){logger[_0x2592('0x27')](_0x2592('0x62'),_0x3aa5ba);throw _0x3aa5ba;});}return _0x526f39;})['then'](respondWithResult(_0xd73bff,0xc9))[_0x2592('0x2b')](handleError(_0xd73bff,null));};exports[_0x2592('0x35')]=function(_0x1d5ac8,_0x20ecba){if(_0x1d5ac8['body']['id']){delete _0x1d5ac8['body']['id'];}return db[_0x2592('0x3e')]['find']({'where':{'id':_0x1d5ac8[_0x2592('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x2592('0x63')}]})[_0x2592('0x20')](handleEntityNotFound(_0x20ecba,null))[_0x2592('0x20')](saveUpdates(_0x1d5ac8[_0x2592('0x5a')],null))[_0x2592('0x20')](respondWithResult(_0x20ecba,null))['catch'](handleError(_0x20ecba,null));};exports['destroy']=function(_0x55d8ae,_0x3be872){return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x55d8ae['params']['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x3be872,null))[_0x2592('0x20')](removeEntity(_0x3be872,null))[_0x2592('0x2b')](handleError(_0x3be872,null));};exports[_0x2592('0x65')]=function(_0x44492d,_0x56945a){return db[_0x2592('0x3e')]['describe']()[_0x2592('0x20')](respondWithResult(_0x56945a,null))['catch'](handleError(_0x56945a,null));};exports['addDisposition']=function(_0x393ca1,_0x42b25d,_0x4851ed){if(_0x393ca1['body']['id']){delete _0x393ca1[_0x2592('0x5a')]['id'];}return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x393ca1[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x42b25d,null))[_0x2592('0x20')](function(_0x3b77b1){if(_0x3b77b1){_0x393ca1[_0x2592('0x5a')][_0x2592('0x66')]=_0x3b77b1['id'];return db[_0x2592('0x67')]['create'](_0x393ca1[_0x2592('0x5a')]);}})[_0x2592('0x20')](respondWithResult(_0x42b25d,null))[_0x2592('0x2b')](handleError(_0x42b25d,null));};exports[_0x2592('0x68')]=function(_0x4ac148,_0x298133,_0x200f55){var _0x9d30b2={'raw':![],'where':{}};var _0x4f4ddf={};var _0x216e32={'count':0x0,'rows':[]};return db[_0x2592('0x3e')][_0x2592('0x69')]({'where':{'id':_0x4ac148[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x298133,null))[_0x2592('0x20')](function(_0x2171cd){if(_0x2171cd){_0x4f4ddf[_0x2592('0x43')]=_[_0x2592('0x58')](db[_0x2592('0x67')][_0x2592('0x3f')]);_0x4f4ddf['query']=_[_0x2592('0x58')](_0x4ac148[_0x2592('0x44')]);_0x4f4ddf['filters']=_['intersection'](_0x4f4ddf[_0x2592('0x43')],_0x4f4ddf['query']);_0x9d30b2[_0x2592('0x47')]=_[_0x2592('0x46')](_0x4f4ddf[_0x2592('0x43')],qs[_0x2592('0x48')](_0x4ac148[_0x2592('0x44')][_0x2592('0x48')]));_0x9d30b2[_0x2592('0x47')]=_0x9d30b2[_0x2592('0x47')][_0x2592('0x49')]?_0x9d30b2[_0x2592('0x47')]:_0x4f4ddf['model'];if(!_0x4ac148[_0x2592('0x44')][_0x2592('0x4a')](_0x2592('0x6a'))){_0x9d30b2[_0x2592('0x2e')]=qs[_0x2592('0x2e')](_0x4ac148[_0x2592('0x44')][_0x2592('0x2e')]);_0x9d30b2[_0x2592('0x2f')]=qs[_0x2592('0x2f')](_0x4ac148[_0x2592('0x44')][_0x2592('0x2f')]);}_0x9d30b2['order']=qs[_0x2592('0x4c')](_0x4ac148[_0x2592('0x44')]['sort']);_0x9d30b2[_0x2592('0x4d')]=qs['filters'](_[_0x2592('0x4e')](_0x4ac148[_0x2592('0x44')],_0x4f4ddf['filters']));_0x9d30b2[_0x2592('0x4d')][_0x2592('0x66')]=_0x2171cd['id'];if(_0x4ac148[_0x2592('0x44')][_0x2592('0x4f')]){_0x9d30b2[_0x2592('0x4d')]=_[_0x2592('0x51')](_0x9d30b2[_0x2592('0x4d')],{'$or':_[_0x2592('0x3d')](_0x9d30b2[_0x2592('0x47')],function(_0x16996c){var _0x240fd5={};_0x240fd5[_0x16996c]={'$like':'%'+_0x4ac148[_0x2592('0x44')]['filter']+'%'};return _0x240fd5;})});}_0x9d30b2=_[_0x2592('0x51')]({},_0x9d30b2,_0x4ac148[_0x2592('0x52')]);return db[_0x2592('0x67')]['count']({'where':_0x9d30b2[_0x2592('0x4d')]})['then'](function(_0x1ba33f){_0x216e32['count']=_0x1ba33f;if(_0x4ac148['query'][_0x2592('0x53')]){_0x9d30b2['include']=[{'all':!![]}];}return db[_0x2592('0x67')]['findAll'](_0x9d30b2);})['then'](function(_0x1b42f3){_0x216e32[_0x2592('0x55')]=_0x1b42f3;return _0x216e32;});}})[_0x2592('0x20')](respondWithFilteredResult(_0x298133,_0x9d30b2))[_0x2592('0x2b')](handleError(_0x298133,null));};exports[_0x2592('0x6b')]=function(_0x55f077,_0x42c7c7,_0x2151b9){return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x55f077[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x42c7c7,null))[_0x2592('0x20')](function(_0xa98e3f){if(_0xa98e3f){return _0xa98e3f[_0x2592('0x6b')](_0x55f077[_0x2592('0x44')]['ids']);}})[_0x2592('0x20')](respondWithStatusCode(_0x42c7c7,null))[_0x2592('0x2b')](handleError(_0x42c7c7,null));};exports[_0x2592('0x6c')]=function(_0x254c02,_0x42701a,_0x213f5d){if(_0x254c02['body']['id']){delete _0x254c02[_0x2592('0x5a')]['id'];}return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x254c02[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x42701a,null))[_0x2592('0x20')](function(_0x4c786c){if(_0x4c786c){_0x254c02[_0x2592('0x5a')][_0x2592('0x66')]=_0x4c786c['id'];return db[_0x2592('0x6d')][_0x2592('0x59')](_0x254c02['body']);}})['then'](respondWithResult(_0x42701a,null))[_0x2592('0x2b')](handleError(_0x42701a,null));};exports[_0x2592('0x6e')]=function(_0x643c9f,_0x17f520,_0x4ac5c7){var _0x9a086f={'raw':![],'where':{}};var _0x1d6936={};var _0x38aa48={'count':0x0,'rows':[]};return db[_0x2592('0x3e')][_0x2592('0x69')]({'where':{'id':_0x643c9f['params']['id']}})['then'](handleEntityNotFound(_0x17f520,null))[_0x2592('0x20')](function(_0xb1789e){if(_0xb1789e){_0x1d6936[_0x2592('0x43')]=_[_0x2592('0x58')](db[_0x2592('0x6d')][_0x2592('0x3f')]);_0x1d6936[_0x2592('0x44')]=_['keys'](_0x643c9f[_0x2592('0x44')]);_0x1d6936['filters']=_[_0x2592('0x46')](_0x1d6936[_0x2592('0x43')],_0x1d6936['query']);_0x9a086f[_0x2592('0x47')]=_[_0x2592('0x46')](_0x1d6936[_0x2592('0x43')],qs['fields'](_0x643c9f['query'][_0x2592('0x48')]));_0x9a086f['attributes']=_0x9a086f[_0x2592('0x47')][_0x2592('0x49')]?_0x9a086f[_0x2592('0x47')]:_0x1d6936['model'];if(!_0x643c9f[_0x2592('0x44')][_0x2592('0x4a')]('nolimit')){_0x9a086f[_0x2592('0x2e')]=qs[_0x2592('0x2e')](_0x643c9f['query'][_0x2592('0x2e')]);_0x9a086f['offset']=qs[_0x2592('0x2f')](_0x643c9f[_0x2592('0x44')][_0x2592('0x2f')]);}_0x9a086f['order']=qs[_0x2592('0x4c')](_0x643c9f[_0x2592('0x44')][_0x2592('0x4c')]);_0x9a086f['where']=qs['filters'](_[_0x2592('0x4e')](_0x643c9f[_0x2592('0x44')],_0x1d6936[_0x2592('0x45')]));_0x9a086f[_0x2592('0x4d')][_0x2592('0x66')]=_0xb1789e['id'];if(_0x643c9f[_0x2592('0x44')]['filter']){_0x9a086f[_0x2592('0x4d')]=_['merge'](_0x9a086f[_0x2592('0x4d')],{'$or':_[_0x2592('0x3d')](_0x9a086f['attributes'],function(_0x22d488){var _0x5bca45={};_0x5bca45[_0x22d488]={'$like':'%'+_0x643c9f['query'][_0x2592('0x4f')]+'%'};return _0x5bca45;})});}_0x9a086f=_[_0x2592('0x51')]({},_0x9a086f,_0x643c9f[_0x2592('0x52')]);return db[_0x2592('0x6d')][_0x2592('0x30')]({'where':_0x9a086f[_0x2592('0x4d')]})[_0x2592('0x20')](function(_0x314005){_0x38aa48[_0x2592('0x30')]=_0x314005;if(_0x643c9f[_0x2592('0x44')]['includeAll']){_0x9a086f[_0x2592('0x54')]=[{'all':!![]}];}return db[_0x2592('0x6d')][_0x2592('0x6f')](_0x9a086f);})[_0x2592('0x20')](function(_0x4eba7e){_0x38aa48['rows']=_0x4eba7e;return _0x38aa48;});}})['then'](respondWithFilteredResult(_0x17f520,_0x9a086f))[_0x2592('0x2b')](handleError(_0x17f520,null));};exports[_0x2592('0x70')]=function(_0x16e2db,_0x3eb447,_0x6e40dc){return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x16e2db[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x3eb447,null))['then'](function(_0x3d070f){if(_0x3d070f){return _0x3d070f['removeAnswers'](_0x16e2db[_0x2592('0x44')][_0x2592('0x71')]);}})[_0x2592('0x20')](respondWithStatusCode(_0x3eb447,null))[_0x2592('0x2b')](handleError(_0x3eb447,null));};exports[_0x2592('0x72')]=function(_0x30edc6,_0x50c0cb,_0x383ff1){var _0x495b04={'body':_0x30edc6[_0x2592('0x5a')],'channel':_0x2592('0x73')};var _0x262dd2=[];var _0x17d6e2=[];var _0x76db0b={};var _0x3bcd0d=![];return db[_0x2592('0x74')][_0x2592('0x65')]()[_0x2592('0x20')](function(_0x1c9bbc){if(!_0x1c9bbc){throw new db[(_0x2592('0x75'))][(_0x2592('0x76'))](_0x2592('0x77'));}_0x262dd2=_[_0x2592('0x78')](_[_0x2592('0x58')](_0x1c9bbc),['createdAt',_0x2592('0x79')]);_0x17d6e2=_[_0x2592('0x78')](_[_0x2592('0x58')](_0x1c9bbc),[_0x2592('0x7a'),_0x2592('0x79'),'CompanyId',_0x2592('0x7b')]);if(_0x30edc6[_0x2592('0x5a')]['id']){delete _0x30edc6[_0x2592('0x5a')]['id'];}if(_['isNil'](_0x30edc6[_0x2592('0x5a')][_0x2592('0x7c')])){throw new db[(_0x2592('0x75'))]['ValidationError'](_0x2592('0x7d'));}if(_[_0x2592('0x7e')](_0x30edc6[_0x2592('0x5a')][_0x2592('0x5a')])||_0x30edc6['body'][_0x2592('0x5a')]===''){throw new db[(_0x2592('0x75'))][(_0x2592('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x30edc6[_0x2592('0x5a')][_0x2592('0x7f')])){throw new db[(_0x2592('0x75'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17d6e2);}if(!_['includes'](_0x17d6e2,_0x30edc6['body']['mapKey'])){throw new db['Sequelize'][(_0x2592('0x76'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x17d6e2);}_0x76db0b[_0x30edc6['body']['mapKey']]=_0x30edc6[_0x2592('0x5a')][_0x2592('0x7c')];})[_0x2592('0x20')](function(){return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x30edc6[_0x2592('0x57')]['id']},'include':[{'model':db[_0x2592('0x80')],'as':_0x2592('0x81'),'include':[{'model':db[_0x2592('0x74')],'as':'Contacts','where':_0x76db0b,'limit':0x1,'order':[[_0x2592('0x79'),_0x2592('0x82')]]}]},{'model':db['OpenchannelApplication'],'as':_0x2592('0x83')}]});})['then'](handleEntityNotFound(_0x50c0cb,null))['then'](function(_0x4bd898){if(_0x4bd898&&_0x4bd898[_0x2592('0x81')]){_0x495b04[_0x2592('0x84')]=_0x4bd898;_0x495b04[_0x2592('0x85')]=_0x4bd898['Applications'];_0x495b04[_0x2592('0x86')]=_0x4bd898[_0x2592('0x81')];_0x495b04['applications']=_[_0x2592('0x87')](_0x495b04[_0x2592('0x85')],['priority'],[_0x2592('0x88')]);if(_0x495b04[_0x2592('0x84')][_0x2592('0x83')]){delete _0x495b04['account'][_0x2592('0x83')];}if(_0x495b04[_0x2592('0x84')][_0x2592('0x81')]&&_0x495b04['account'][_0x2592('0x81')]['Contacts'][_0x2592('0x49')]){return _0x495b04['account'][_0x2592('0x81')][_0x2592('0x89')][0x0];}var _0x312e43=_[_0x2592('0x19')](_0x30edc6['body'],{'firstName':_0x30edc6[_0x2592('0x5a')]['from'],'ListId':_0x4bd898['ListId']});_0x312e43[_0x30edc6['body']['mapKey']]=_0x30edc6[_0x2592('0x5a')][_0x2592('0x7c')];return db[_0x2592('0x74')]['create'](_0x312e43,{'fields':_0x262dd2,'raw':!![]});}})[_0x2592('0x20')](handleEntityNotFound(_0x50c0cb,null))[_0x2592('0x20')](function(_0x1b7840){_0x495b04[_0x2592('0x8a')]=_0x1b7840;if(_0x1b7840){var _0x8416f2={'ContactId':_0x1b7840['id'],'OpenchannelAccountId':_0x30edc6[_0x2592('0x57')]['id'],'from':(_0x1b7840[_0x2592('0x8b')]||'')+'\x20'+(_0x1b7840[_0x2592('0x8c')]||'')};var _0x25f02a={'OpenchannelAccountId':_0x30edc6[_0x2592('0x57')]['id'],'closed':![]};if(_0x30edc6[_0x2592('0x5a')][_0x2592('0x8d')]){_0x25f02a['threadId']=_0x30edc6[_0x2592('0x5a')][_0x2592('0x8d')];return db[_0x2592('0x8e')]['find']({'where':_0x25f02a})[_0x2592('0x20')](function(_0x143697){if(_0x143697){return[_0x143697,![]];}_0x8416f2[_0x2592('0x8d')]=_0x30edc6[_0x2592('0x5a')][_0x2592('0x8d')];_0x8416f2[_0x2592('0x8f')]=_0x30edc6[_0x2592('0x5a')]['externalUrl'];return db['OpenchannelInteraction'][_0x2592('0x59')](_0x8416f2)[_0x2592('0x20')](function(_0x232adf){return[_0x232adf,!![]];});});}else{_0x25f02a[_0x2592('0x8d')]=null;}_0x25f02a['ContactId']=_0x1b7840['id'];return db['OpenchannelInteraction'][_0x2592('0x64')]({'where':_0x25f02a})[_0x2592('0x20')](function(_0x3af7ec){if(_0x3af7ec){return[_0x3af7ec,![]];}return db[_0x2592('0x8e')][_0x2592('0x59')](_0x8416f2)['then'](function(_0x56f2a8){return[_0x56f2a8,!![]];});});}})[_0x2592('0x90')](function(_0x128dd7,_0x5bc260){if(_0x128dd7){_0x3bcd0d=_0x5bc260;if(!_0x5bc260){var _0x521ebf={'from':(_0x495b04['contact'][_0x2592('0x8b')]||'')+'\x20'+(_0x495b04[_0x2592('0x8a')]['lastName']||'')};if(_0x30edc6[_0x2592('0x5a')][_0x2592('0x8d')]&&_0x30edc6[_0x2592('0x5a')][_0x2592('0x91')]&&_0x30edc6[_0x2592('0x5a')][_0x2592('0x8d')]!=_0x30edc6[_0x2592('0x5a')]['messageId']){_0x521ebf[_0x2592('0x8d')]=_0x30edc6[_0x2592('0x5a')][_0x2592('0x91')];}return _0x128dd7[_0x2592('0x35')](_0x521ebf);}else{return _0x128dd7;}}})[_0x2592('0x20')](function(_0x3a4187){_0x495b04[_0x2592('0x92')]=_0x3a4187[_0x2592('0x5c')]({'plain':!![]});_0x495b04[_0x2592('0x92')][_0x2592('0x93')]=_0x3bcd0d;if(_0x495b04[_0x2592('0x92')][_0x2592('0x93')]){if(_0x495b04[_0x2592('0x84')]['autoclose']){_0x495b04[_0x2592('0x85')]['push']({'id':0x0,'priority':_0x495b04[_0x2592('0x85')][_0x2592('0x49')]+0x1,'app':_0x2592('0x94'),'appdata':'unmanaged','interval':_0x2592('0x95')});}}return db['OpenchannelMessage'][_0x2592('0x59')]({'body':_0x30edc6[_0x2592('0x5a')][_0x2592('0x5a')],'OpenchannelAccountId':_0x30edc6[_0x2592('0x57')]['id'],'OpenchannelInteractionId':_0x3a4187['id'],'direction':'in','ContactId':_0x495b04[_0x2592('0x8a')]['id'],'AttachmentId':_0x30edc6[_0x2592('0x5a')][_0x2592('0x96')]});})[_0x2592('0x20')](function(_0x302a2f){_0x495b04[_0x2592('0x28')]=_0x302a2f;if(_0x495b04['interaction']['UserId']){return db[_0x2592('0x97')][_0x2592('0x64')]({'attributes':['id',_0x2592('0x3a')],'where':{'id':_0x495b04[_0x2592('0x92')]['UserId']}})[_0x2592('0x20')](function(_0x46ea8c){if(_0x46ea8c){_0x495b04[_0x2592('0x85')][_0x2592('0x98')]({'id':0x0,'priority':0x0,'app':_0x2592('0x99'),'appdata':_0x46ea8c['name']+','+(_0x495b04[_0x2592('0x84')][_0x2592('0x9a')]||0xa),'interval':'*,*,*,*'});_0x495b04[_0x2592('0x9b')]=![];}return respondWithRpcPromise(_0x2592('0x9c'),_0x2592('0x9d'),_0x495b04);});}return respondWithRpcPromise(_0x2592('0x9c'),_0x2592('0x9d'),_0x495b04);})[_0x2592('0x20')](function(_0x2a0318){respondWithRpcPromise(_0x2592('0x9e'),_0x2592('0x9e'),{'event':_0x2592('0x72'),'message':_0x2a0318},client9002);return _0x2a0318;})[_0x2592('0x20')](respondWithResult(_0x50c0cb,null))['catch'](handleError(_0x50c0cb,null));};exports[_0x2592('0x9f')]=function(_0x8a4e81,_0x390f4d,_0x46c05b){return db[_0x2592('0x3e')][_0x2592('0x69')]({'where':{'id':_0x8a4e81[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x390f4d,null))[_0x2592('0x20')](function(_0x36e253){if(_0x36e253){return db[_0x2592('0xa0')][_0x2592('0xa1')](function(_0x5a78eb){return db['OpenchannelApplication'][_0x2592('0x36')]({'where':{'OpenchannelAccountId':_0x8a4e81[_0x2592('0x57')]['id']},'transaction':_0x5a78eb})[_0x2592('0x20')](function(_0x3b1e41){var _0x17a6fc=_['map'](_0x8a4e81[_0x2592('0x5a')],function(_0x51c1ae){_0x51c1ae[_0x2592('0x66')]=_0x8a4e81['params']['id'];return _0x51c1ae;});return db['OpenchannelApplication'][_0x2592('0xa2')](_0x17a6fc,{'transaction':_0x5a78eb});});})[_0x2592('0x20')](function(){return db[_0x2592('0xa3')][_0x2592('0xa4')]({'where':{'OpenchannelAccountId':_0x8a4e81[_0x2592('0x57')]['id']},'order':_0x2592('0xa5')});});}})[_0x2592('0x20')](respondWithResult(_0x390f4d,null))[_0x2592('0x2b')](handleError(_0x390f4d,null));};exports[_0x2592('0xa6')]=function(_0x3806a9,_0x236ce8,_0x24c6c2){var _0x9f6ec7={};var _0xfa0052={};var _0x460451;var _0x515bf0;return db[_0x2592('0x3e')][_0x2592('0x69')]({'where':{'id':_0x3806a9[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x236ce8,null))[_0x2592('0x20')](function(_0x3a2f09){if(_0x3a2f09){_0x460451=_0x3a2f09;_0xfa0052['model']=_[_0x2592('0x58')](db[_0x2592('0xa3')]['rawAttributes']);_0xfa0052['query']=_[_0x2592('0x58')](_0x3806a9['query']);_0xfa0052[_0x2592('0x45')]=_[_0x2592('0x46')](_0xfa0052['model'],_0xfa0052['query']);_0x9f6ec7[_0x2592('0x47')]=_[_0x2592('0x46')](_0xfa0052[_0x2592('0x43')],qs[_0x2592('0x48')](_0x3806a9[_0x2592('0x44')][_0x2592('0x48')]));_0x9f6ec7[_0x2592('0x47')]=_0x9f6ec7[_0x2592('0x47')][_0x2592('0x49')]?_0x9f6ec7[_0x2592('0x47')]:_0xfa0052['model'];_0x9f6ec7[_0x2592('0x4b')]=qs[_0x2592('0x4c')](_0x3806a9[_0x2592('0x44')][_0x2592('0x4c')]);_0x9f6ec7[_0x2592('0x4d')]=qs[_0x2592('0x45')](_[_0x2592('0x4e')](_0x3806a9[_0x2592('0x44')],_0xfa0052['filters']));if(_0x3806a9['query']['filter']){_0x9f6ec7[_0x2592('0x4d')]=_[_0x2592('0x51')](_0x9f6ec7['where'],{'$or':_['map'](_0x9f6ec7['attributes'],function(_0x42e3df){var _0x15ee35={};_0x15ee35[_0x42e3df]={'$like':'%'+_0x3806a9[_0x2592('0x44')][_0x2592('0x4f')]+'%'};return _0x15ee35;})});}_0x9f6ec7=_[_0x2592('0x51')]({},_0x9f6ec7,_0x3806a9[_0x2592('0x52')]);return _0x460451[_0x2592('0xa6')](_0x9f6ec7);}})['then'](function(_0x12d4cd){if(_0x12d4cd){_0x515bf0=_0x12d4cd[_0x2592('0x49')];if(!_0x3806a9['query']['hasOwnProperty'](_0x2592('0x6a'))){_0x9f6ec7['limit']=qs['limit'](_0x3806a9[_0x2592('0x44')][_0x2592('0x2e')]);_0x9f6ec7['offset']=qs['offset'](_0x3806a9[_0x2592('0x44')][_0x2592('0x2f')]);}return _0x460451[_0x2592('0xa6')](_0x9f6ec7);}})[_0x2592('0x20')](function(_0x306d7f){if(_0x306d7f){return _0x306d7f?{'count':_0x515bf0,'rows':_0x306d7f}:null;}})[_0x2592('0x20')](respondWithResult(_0x236ce8,null))[_0x2592('0x2b')](handleError(_0x236ce8,null));};exports[_0x2592('0xa7')]=function(_0x59068f,_0x1d0b6a,_0x37d50a){var _0x5983b5={'raw':![],'where':{}};var _0x195d00={};var _0x32e8e1={'count':0x0,'rows':[]};return db[_0x2592('0x3e')][_0x2592('0x69')]({'where':{'id':_0x59068f[_0x2592('0x57')]['id']}})['then'](handleEntityNotFound(_0x1d0b6a,null))[_0x2592('0x20')](function(_0x497363){if(_0x497363){_0x195d00[_0x2592('0x43')]=_[_0x2592('0x58')](db[_0x2592('0x8e')][_0x2592('0x3f')]);_0x195d00[_0x2592('0x44')]=_['keys'](_0x59068f[_0x2592('0x44')]);_0x195d00['filters']=_[_0x2592('0x46')](_0x195d00[_0x2592('0x43')],_0x195d00[_0x2592('0x44')]);_0x5983b5['attributes']=_[_0x2592('0x46')](_0x195d00[_0x2592('0x43')],qs['fields'](_0x59068f[_0x2592('0x44')][_0x2592('0x48')]));_0x5983b5['attributes']=_0x5983b5['attributes'][_0x2592('0x49')]?_0x5983b5[_0x2592('0x47')]:_0x195d00[_0x2592('0x43')];if(!_0x59068f[_0x2592('0x44')][_0x2592('0x4a')](_0x2592('0x6a'))){_0x5983b5['limit']=qs[_0x2592('0x2e')](_0x59068f[_0x2592('0x44')]['limit']);_0x5983b5['offset']=qs['offset'](_0x59068f[_0x2592('0x44')][_0x2592('0x2f')]);}_0x5983b5[_0x2592('0x4b')]=qs['sort'](_0x59068f['query'][_0x2592('0x4c')]);_0x5983b5[_0x2592('0x4d')]=qs['filters'](_[_0x2592('0x4e')](_0x59068f['query'],_0x195d00[_0x2592('0x45')]));_0x5983b5[_0x2592('0x4d')][_0x2592('0x66')]=_0x497363['id'];if(_0x59068f[_0x2592('0x44')][_0x2592('0x4f')]){_0x5983b5[_0x2592('0x4d')]=_[_0x2592('0x51')](_0x5983b5[_0x2592('0x4d')],{'$or':_[_0x2592('0x3d')](_0x5983b5[_0x2592('0x47')],function(_0x45a846){var _0x2e98a2={};_0x2e98a2[_0x45a846]={'$like':'%'+_0x59068f['query'][_0x2592('0x4f')]+'%'};return _0x2e98a2;})});}_0x5983b5=_[_0x2592('0x51')]({},_0x5983b5,_0x59068f['options']);return db[_0x2592('0x8e')][_0x2592('0x30')]({'where':_0x5983b5['where']})[_0x2592('0x20')](function(_0x4c8b0c){_0x32e8e1[_0x2592('0x30')]=_0x4c8b0c;if(_0x59068f[_0x2592('0x44')][_0x2592('0x53')]){_0x5983b5['include']=[{'model':db[_0x2592('0x74')],'as':_0x2592('0xa8'),'required':![]},{'model':db[_0x2592('0x97')],'as':'Owner','attributes':['name',_0x2592('0xa9'),_0x2592('0xaa')],'required':![]},{'model':db[_0x2592('0xab')],'as':_0x2592('0xac'),'attributes':['id',_0x2592('0x3a'),'color'],'where':_0x59068f['query'][_0x2592('0xad')]?{'id':_0x59068f[_0x2592('0x44')]['tag']}:undefined,'required':_0x59068f[_0x2592('0x44')][_0x2592('0xad')]?!![]:![]}];}return db[_0x2592('0x8e')]['findAll'](_0x5983b5);})['then'](function(_0x336876){_0x32e8e1[_0x2592('0x55')]=_0x336876;return _0x32e8e1;});}})[_0x2592('0x20')](respondWithFilteredResult(_0x1d0b6a,_0x5983b5))['catch'](handleError(_0x1d0b6a,null));};exports[_0x2592('0xae')]=function(_0x40247a,_0x17fc6b,_0x29a941){return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x40247a[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x17fc6b,null))[_0x2592('0x20')](function(_0x5e3267){if(_0x5e3267){return _0x5e3267[_0x2592('0xae')](_0x40247a['body']['ids'],_[_0x2592('0xaf')](_0x40247a[_0x2592('0x5a')],[_0x2592('0x71'),'id'])||{})[_0x2592('0x90')](function(_0x40b605){for(var _0x2a6639=0x0;_0x2a6639<_0x40247a[_0x2592('0x5a')][_0x2592('0x71')]['length'];_0x2a6639+=0x1){socket[_0x2592('0xb0')](_0x2592('0xb1'),{'UserId':Number(_0x40247a['body'][_0x2592('0x71')][_0x2a6639]),'OpenchannelAccountId':Number(_0x40247a[_0x2592('0x57')]['id'])});}return _0x40b605;});}})[_0x2592('0x20')](respondWithResult(_0x17fc6b,null))[_0x2592('0x2b')](handleError(_0x17fc6b,null));};exports[_0x2592('0xb2')]=function(_0x53e78b,_0x214456,_0x36d8f9){return db[_0x2592('0x3e')][_0x2592('0x64')]({'where':{'id':_0x53e78b[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x214456,null))[_0x2592('0x20')](function(_0xd68425){if(_0xd68425){return _0xd68425['removeAgents'](_0x53e78b['query'][_0x2592('0x71')])[_0x2592('0x20')](function(){if(_[_0x2592('0xb3')](_0x53e78b[_0x2592('0x44')]['ids'])){for(var _0x58e401=0x0;_0x58e401<_0x53e78b[_0x2592('0x44')][_0x2592('0x71')][_0x2592('0x49')];_0x58e401+=0x1){socket[_0x2592('0xb0')]('userOpenchannelAccount:remove',{'UserId':Number(_0x53e78b[_0x2592('0x44')]['ids'][_0x58e401]),'OpenchannelAccountId':Number(_0x53e78b[_0x2592('0x57')]['id'])});}}else{socket[_0x2592('0xb0')](_0x2592('0xb4'),{'UserId':Number(_0x53e78b[_0x2592('0x44')][_0x2592('0x71')]),'OpenchannelAccountId':Number(_0x53e78b[_0x2592('0x57')]['id'])});}});}})[_0x2592('0x20')](respondWithStatusCode(_0x214456,null))[_0x2592('0x2b')](handleError(_0x214456,null));};exports[_0x2592('0xb5')]=function(_0x5e9e78,_0x53ad6f,_0xdb1f0b){var _0x597f1e={};var _0x4ee4b5={};var _0x468a50;var _0x495b61;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x5e9e78[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x53ad6f,null))[_0x2592('0x20')](function(_0x48a1d2){if(_0x48a1d2){_0x468a50=_0x48a1d2;_0x4ee4b5[_0x2592('0x43')]=_['keys'](db[_0x2592('0x97')]['rawAttributes']);_0x4ee4b5[_0x2592('0x44')]=_[_0x2592('0x58')](_0x5e9e78['query']);_0x4ee4b5[_0x2592('0x45')]=_['intersection'](_0x4ee4b5[_0x2592('0x43')],_0x4ee4b5[_0x2592('0x44')]);_0x597f1e['attributes']=_['intersection'](_0x4ee4b5['model'],qs['fields'](_0x5e9e78['query'][_0x2592('0x48')]));_0x597f1e[_0x2592('0x47')]=_0x597f1e['attributes'][_0x2592('0x49')]?_0x597f1e[_0x2592('0x47')]:_0x4ee4b5[_0x2592('0x43')];_0x597f1e[_0x2592('0x4b')]=qs[_0x2592('0x4c')](_0x5e9e78[_0x2592('0x44')][_0x2592('0x4c')]);_0x597f1e[_0x2592('0x4d')]=qs[_0x2592('0x45')](_[_0x2592('0x4e')](_0x5e9e78['query'],_0x4ee4b5[_0x2592('0x45')]));if(_0x5e9e78[_0x2592('0x44')][_0x2592('0x4f')]){_0x597f1e['where']=_[_0x2592('0x51')](_0x597f1e[_0x2592('0x4d')],{'$or':_[_0x2592('0x3d')](_0x597f1e['attributes'],function(_0xc0b9c5){var _0x2519e4={};_0x2519e4[_0xc0b9c5]={'$like':'%'+_0x5e9e78[_0x2592('0x44')]['filter']+'%'};return _0x2519e4;})});}_0x597f1e=_[_0x2592('0x51')]({},_0x597f1e,_0x5e9e78[_0x2592('0x52')]);return _0x468a50[_0x2592('0xb5')](_0x597f1e);}})[_0x2592('0x20')](function(_0x50ef34){if(_0x50ef34){_0x495b61=_0x50ef34[_0x2592('0x49')];if(!_0x5e9e78[_0x2592('0x44')][_0x2592('0x4a')](_0x2592('0x6a'))){_0x597f1e['limit']=qs[_0x2592('0x2e')](_0x5e9e78['query'][_0x2592('0x2e')]);_0x597f1e[_0x2592('0x2f')]=qs[_0x2592('0x2f')](_0x5e9e78[_0x2592('0x44')][_0x2592('0x2f')]);}return _0x468a50[_0x2592('0xb5')](_0x597f1e);}})['then'](function(_0x3c485f){if(_0x3c485f){return _0x3c485f?{'count':_0x495b61,'rows':_0x3c485f}:null;}})[_0x2592('0x20')](respondWithResult(_0x53ad6f,null))['catch'](handleError(_0x53ad6f,null));};exports['send']=function(_0x46c1d7,_0x3a7254,_0x3474f3){var _0x13e608,_0x345c35,_0x5ce677;if(_[_0x2592('0x7e')](_0x46c1d7[_0x2592('0x5a')][_0x2592('0x5a')])||_0x46c1d7['body'][_0x2592('0x5a')]===''){throw new db['Sequelize'][(_0x2592('0x76'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x46c1d7['body']['to'])){}_0x13e608=_0x46c1d7[_0x2592('0x5a')]['to'];return db[_0x2592('0x3e')][_0x2592('0x69')]({'where':{'id':_0x46c1d7[_0x2592('0x57')]['id']}})[_0x2592('0x20')](handleEntityNotFound(_0x3a7254,null))[_0x2592('0x20')](function(_0x47d9c6){if(_0x47d9c6){return db['OpenchannelAccount'][_0x2592('0x64')]({'where':{'id':_0x47d9c6['id']},'include':[{'model':db[_0x2592('0x80')],'as':'List','include':[{'model':db[_0x2592('0x74')],'as':'Contacts','where':{[_0x47d9c6[_0x2592('0x7f')]]:_0x13e608},'limit':0x1,'order':[[_0x2592('0x79'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x3a7254,null))['then'](function(_0x4f44f7){if(_0x4f44f7&&_0x4f44f7['List']){_0x345c35=_0x4f44f7[_0x2592('0x5c')]({'plain':!![]});if(_0x345c35['List']&&_0x345c35[_0x2592('0x81')][_0x2592('0x89')][_0x2592('0x49')]){return _0x345c35[_0x2592('0x81')][_0x2592('0x89')][0x0];}return db[_0x2592('0x74')]['create'](_['defaults'](_0x46c1d7[_0x2592('0x5a')],{'firstName':_0x13e608,[_0x4f44f7[_0x2592('0x7f')]]:_0x13e608,'phone':_0x13e608,'ListId':_0x345c35[_0x2592('0x7b')]}));}})[_0x2592('0x20')](handleEntityNotFound(_0x3a7254,null))[_0x2592('0x20')](function(_0x315a69){if(_0x315a69){_0x5ce677=_0x315a69;return db[_0x2592('0x8e')][_0x2592('0x64')]({'where':{'ContactId':_0x5ce677['id'],'closed':![],'OpenchannelAccountId':_0x345c35['id']}})[_0x2592('0x20')](function(_0xb10b0d){if(_0xb10b0d){return[_0xb10b0d,![]];}return db[_0x2592('0x8e')][_0x2592('0x59')]({'UserId':_0x46c1d7[_0x2592('0x5b')]['id'],'ContactId':_0x5ce677['id'],'OpenchannelAccountId':_0x345c35['id'],'lastMsgDirection':_0x2592('0xb6'),'Messages':[_[_0x2592('0x51')](_0x46c1d7['body'],{'read':![],'body':_0x46c1d7['body']['body'],'OpenchannelAccountId':_0x345c35['id'],'UserId':_0x46c1d7[_0x2592('0x5b')]['id'],'ContactId':_0x5ce677['id']})]},{'include':[{'model':db[_0x2592('0xb7')],'as':_0x2592('0xb8')}]})[_0x2592('0x20')](function(_0x48717c){return[_0x48717c,!![]];});});}})['spread'](function(_0x2b8534,_0x5acfec){if(_0x5acfec){return _0x2b8534;}return db[_0x2592('0xb7')][_0x2592('0x59')](_[_0x2592('0x51')](_0x46c1d7[_0x2592('0x5a')],{'read':![],'body':_0x46c1d7[_0x2592('0x5a')][_0x2592('0x5a')],'OpenchannelAccountId':_0x345c35['id'],'OpenchannelInteractionId':_0x2b8534['id'],'UserId':_0x46c1d7[_0x2592('0x5b')]['id'],'ContactId':_0x5ce677['id']}))['then'](function(_0x59e72c){_0x2b8534['dataValues'][_0x2592('0xb8')]=[];_0x2b8534[_0x2592('0xb9')][_0x2592('0xb8')][_0x2592('0xba')](_0x59e72c[_0x2592('0xb9')]);return _0x2b8534;});});}})[_0x2592('0x20')](respondWithResult(_0x3a7254,null))[_0x2592('0x2b')](handleError(_0x3a7254,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 251d273..f6abdf7 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 _0x96cc=['remove','emit','hook','exports','events','OpenchannelAccount','save','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96cc,0x16c));var _0xc96c=function(_0x5a8981,_0x12fe84){_0x5a8981=_0x5a8981-0x0;var _0x4a3592=_0x96cc[_0x5a8981];return _0x4a3592;};'use strict';var EventEmitter=require(_0xc96c('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xc96c('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc96c('0x2'),'afterUpdate':_0xc96c('0x3'),'afterDestroy':_0xc96c('0x4')};function emitEvent(_0x421701){return function(_0x71140d,_0x29b6f1,_0x377e6c){OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701+':'+_0x71140d['id'],_0x71140d);OpenchannelAccountEvents[_0xc96c('0x5')](_0x421701,_0x71140d);_0x377e6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xc96c('0x6')](e,emitEvent(event));}}module[_0xc96c('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x153f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelAccount'];(function(_0xe598ca,_0x1a6d6b){var _0x147e1f=function(_0x11e2fe){while(--_0x11e2fe){_0xe598ca['push'](_0xe598ca['shift']());}};_0x147e1f(++_0x1a6d6b);}(_0x153f,0x15b));var _0xf153=function(_0x5bd724,_0x363f27){_0x5bd724=_0x5bd724-0x0;var _0x1ed085=_0x153f[_0x5bd724];return _0x1ed085;};'use strict';var EventEmitter=require(_0xf153('0x0'));var OpenchannelAccount=require(_0xf153('0x1'))['db'][_0xf153('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf153('0x3')](0x0);var events={'afterCreate':_0xf153('0x4'),'afterUpdate':_0xf153('0x5'),'afterDestroy':_0xf153('0x6')};function emitEvent(_0x59757c){return function(_0x364e65,_0x5c49c7,_0x1f9ead){OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c+':'+_0x364e65['id'],_0x364e65);OpenchannelAccountEvents[_0xf153('0x7')](_0x59757c,_0x364e65);_0x1f9ead(null);};}for(var e in events){if(events[_0xf153('0x8')](e)){var event=events[e];OpenchannelAccount[_0xf153('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index d5730fe..981c5b1 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(_0x2bd29f,_0x5e20d3){var _0x277c9e=function(_0x2d4b47){while(--_0x2d4b47){_0x2bd29f['push'](_0x2bd29f['shift']());}};_0x277c9e(++_0x5e20d3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x18954e,_0x2b26ea){var _0x11248a=function(_0x5ac80b){while(--_0x5ac80b){_0x18954e['push'](_0x18954e['shift']());}};_0x11248a(++_0x2b26ea);}(_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 ead896c..fa25549 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 _0x065e=['socket.io-emitter','./openchannelAccount.socket','register','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis'];(function(_0x289a67,_0x1e5a3c){var _0x572b49=function(_0x22e036){while(--_0x22e036){_0x289a67['push'](_0x289a67['shift']());}};_0x572b49(++_0x1e5a3c);}(_0x065e,0x1a7));var _0xe065=function(_0x2d42b7,_0x391076){_0x2d42b7=_0x2d42b7-0x0;var _0x3ac15a=_0x065e[_0x2d42b7];return _0x3ac15a;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe065('0x1'));var fs=require('fs');var Redis=require(_0xe065('0x2'));var db=require(_0xe065('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe065('0x4'));var config=require(_0xe065('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xe065('0x6')][_0xe065('0x7')]({'port':0x232a});config[_0xe065('0x8')]=_['defaults'](config[_0xe065('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xe065('0x9'))(new Redis(config[_0xe065('0x8')]));require(_0xe065('0xa'))[_0xe065('0xb')](socket);function respondWithRpcPromise(_0x85001e,_0x531ebd,_0x43827c){return new BPromise(function(_0x6c9117,_0x3f59d3){return client[_0xe065('0xc')](_0x85001e,_0x43827c)[_0xe065('0xd')](function(_0x2a6a6e){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0xe065('0xe'));logger[_0xe065('0xf')](_0xe065('0x10'),_0x531ebd,'request\x20sent',JSON[_0xe065('0x11')](_0x2a6a6e));if(_0x2a6a6e[_0xe065('0x12')]){if(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x13')]===0x1f4){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);return _0x3f59d3(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}logger[_0xe065('0x12')](_0xe065('0x15'),_0x531ebd,_0x2a6a6e[_0xe065('0x12')]['message']);return _0x6c9117(_0x2a6a6e[_0xe065('0x12')][_0xe065('0x14')]);}else{logger['info'](_0xe065('0x15'),_0x531ebd,_0xe065('0xe'));_0x6c9117(_0x2a6a6e[_0xe065('0x16')][_0xe065('0x14')]);}})[_0xe065('0x17')](function(_0x302adf){logger[_0xe065('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x531ebd,_0x302adf);_0x3f59d3(_0x302adf);});});} \ No newline at end of file +var _0x4024=['randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','bluebird'];(function(_0x42f9f9,_0x2fbb84){var _0x2d3c68=function(_0x708b86){while(--_0x708b86){_0x42f9f9['push'](_0x42f9f9['shift']());}};_0x2d3c68(++_0x2fbb84);}(_0x4024,0x89));var _0x4402=function(_0xe2726e,_0x51aa9c){_0xe2726e=_0xe2726e-0x0;var _0x3d5235=_0x4024[_0xe2726e];return _0x3d5235;};'use strict';var _=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var moment=require('moment');var BPromise=require(_0x4402('0x2'));var rs=require(_0x4402('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4402('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4402('0x5'))(_0x4402('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4402('0x7')][_0x4402('0x8')]({'port':0x232a});config[_0x4402('0x9')]=_['defaults'](config[_0x4402('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4402('0x9')]));require('./openchannelAccount.socket')['register'](socket);function respondWithRpcPromise(_0x30fd34,_0x4f56aa,_0x1a4a47){return new BPromise(function(_0x4e1a7e,_0x34b4a6){return client['request'](_0x30fd34,_0x1a4a47)[_0x4402('0xa')](function(_0x251286){logger['info'](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));logger[_0x4402('0xd')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4f56aa,_0x4402('0xc'),JSON[_0x4402('0xe')](_0x251286));if(_0x251286[_0x4402('0xf')]){if(_0x251286[_0x4402('0xf')][_0x4402('0x10')]===0x1f4){logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x34b4a6(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}logger[_0x4402('0xf')](_0x4402('0xb'),_0x4f56aa,_0x251286[_0x4402('0xf')][_0x4402('0x11')]);return _0x4e1a7e(_0x251286[_0x4402('0xf')][_0x4402('0x11')]);}else{logger[_0x4402('0x12')](_0x4402('0xb'),_0x4f56aa,_0x4402('0xc'));_0x4e1a7e(_0x251286['result']['message']);}})[_0x4402('0x13')](function(_0x2a7afc){logger['error'](_0x4402('0xb'),_0x4f56aa,_0x2a7afc);_0x34b4a6(_0x2a7afc);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 0bc122a..fa11363 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 _0x2621=['register','length','./openchannelAccount.events','save','remove','update','emit','removeListener'];(function(_0x12532c,_0x5580e7){var _0x3d6ecf=function(_0x53a6f2){while(--_0x53a6f2){_0x12532c['push'](_0x12532c['shift']());}};_0x3d6ecf(++_0x5580e7);}(_0x2621,0x1d2));var _0x1262=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2621[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelAccountEvents=require(_0x1262('0x0'));var events=[_0x1262('0x1'),_0x1262('0x2'),_0x1262('0x3')];function createListener(_0x1e5b47,_0x44878a){return function(_0x2dfe65){_0x44878a[_0x1262('0x4')](_0x1e5b47,_0x2dfe65);};}function removeListener(_0x192339,_0x3a6d7f){return function(){OpenchannelAccountEvents[_0x1262('0x5')](_0x192339,_0x3a6d7f);};}exports[_0x1262('0x6')]=function(_0x421716){for(var _0x16075c=0x0,_0x4d4535=events[_0x1262('0x7')];_0x16075c<_0x4d4535;_0x16075c++){var _0x52af34=events[_0x16075c];var _0xaa3c86=createListener('openchannelAccount:'+_0x52af34,_0x421716);OpenchannelAccountEvents['on'](_0x52af34,_0xaa3c86);}}; \ No newline at end of file +var _0x43c8=['openchannelAccount:','save','update','emit','register','length'];(function(_0x15822c,_0x2d908c){var _0x3c6945=function(_0x8fccd7){while(--_0x8fccd7){_0x15822c['push'](_0x15822c['shift']());}};_0x3c6945(++_0x2d908c);}(_0x43c8,0xaf));var _0x843c=function(_0x2edbb6,_0xc749f0){_0x2edbb6=_0x2edbb6-0x0;var _0x347b46=_0x43c8[_0x2edbb6];return _0x347b46;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x843c('0x0'),'remove',_0x843c('0x1')];function createListener(_0x1eaada,_0x254ff3){return function(_0x302fdb){_0x254ff3[_0x843c('0x2')](_0x1eaada,_0x302fdb);};}function removeListener(_0x199998,_0x3ca11e){return function(){OpenchannelAccountEvents['removeListener'](_0x199998,_0x3ca11e);};}exports[_0x843c('0x3')]=function(_0x3fc72f){for(var _0xc5913e=0x0,_0x15bb1f=events[_0x843c('0x4')];_0xc5913e<_0x15bb1f;_0xc5913e++){var _0x49aee7=events[_0xc5913e];var _0x327327=createListener(_0x843c('0x5')+_0x49aee7,_0x3fc72f);OpenchannelAccountEvents['on'](_0x49aee7,_0x327327);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 49629b5..c99fdbe 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 _0xad22=['/:id','show','post','create','delete','destroy','exports','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index'];(function(_0x281acc,_0xfc81ad){var _0x5b508b=function(_0x3b4788){while(--_0x3b4788){_0x281acc['push'](_0x281acc['shift']());}};_0x5b508b(++_0xfc81ad);}(_0xad22,0xac));var _0x2ad2=function(_0x13342f,_0x3d6303){_0x13342f=_0x13342f-0x0;var _0x2fc1fc=_0xad22[_0x13342f];return _0x2fc1fc;};'use strict';var multer=require('multer');var util=require(_0x2ad2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ad2('0x1')]();var fs_extra=require(_0x2ad2('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x2ad2('0x3'));var config=require(_0x2ad2('0x4'));var controller=require(_0x2ad2('0x5'));router['get']('/',auth[_0x2ad2('0x6')](),controller[_0x2ad2('0x7')]);router['get'](_0x2ad2('0x8'),auth[_0x2ad2('0x6')](),controller[_0x2ad2('0x9')]);router[_0x2ad2('0xa')]('/',auth[_0x2ad2('0x6')](),controller[_0x2ad2('0xb')]);router['put'](_0x2ad2('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x2ad2('0xc')](_0x2ad2('0x8'),auth[_0x2ad2('0x6')](),controller[_0x2ad2('0xd')]);module[_0x2ad2('0xe')]=router; \ No newline at end of file +var _0x7690=['destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','index','/:id','isAuthenticated','show','post','update','delete'];(function(_0x2177b4,_0x1d8db7){var _0x1bcc0e=function(_0x2af7d5){while(--_0x2af7d5){_0x2177b4['push'](_0x2177b4['shift']());}};_0x1bcc0e(++_0x1d8db7);}(_0x7690,0x101));var _0x0769=function(_0x37b937,_0x15d276){_0x37b937=_0x37b937-0x0;var _0x35c013=_0x7690[_0x37b937];return _0x35c013;};'use strict';var multer=require(_0x0769('0x0'));var util=require(_0x0769('0x1'));var path=require(_0x0769('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0769('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0769('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0769('0x5'));var controller=require(_0x0769('0x6'));router[_0x0769('0x7')]('/',auth['isAuthenticated'](),controller[_0x0769('0x8')]);router[_0x0769('0x7')](_0x0769('0x9'),auth[_0x0769('0xa')](),controller[_0x0769('0xb')]);router[_0x0769('0xc')]('/',auth[_0x0769('0xa')](),controller['create']);router['put'](_0x0769('0x9'),auth['isAuthenticated'](),controller[_0x0769('0xd')]);router[_0x0769('0xe')](_0x0769('0x9'),auth['isAuthenticated'](),controller[_0x0769('0xf')]);module[_0x0769('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index e61938c..32500d2 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 _0x495d=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x5a5848,_0x3b8fb2){var _0x9fe6d7=function(_0x5aac17){while(--_0x5aac17){_0x5a5848['push'](_0x5a5848['shift']());}};_0x9fe6d7(++_0x3b8fb2);}(_0x495d,0x13c));var _0xd495=function(_0x6ddb71,_0x2f1ebf){_0x6ddb71=_0x6ddb71-0x0;var _0x20f8b8=_0x495d[_0x6ddb71];return _0x20f8b8;};'use strict';var Sequelize=require('sequelize');module[_0xd495('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd495('0x1')],'allowNull':![],'defaultValue':_0xd495('0x2')},'appdata':{'type':Sequelize[_0xd495('0x3')]()},'description':{'type':Sequelize[_0xd495('0x1')]},'interval':{'type':Sequelize[_0xd495('0x1')],'defaultValue':_0xd495('0x4')}}; \ No newline at end of file +var _0xebb1=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x56daff,_0xadca9a){var _0x132c82=function(_0x19e0d7){while(--_0x19e0d7){_0x56daff['push'](_0x56daff['shift']());}};_0x132c82(++_0xadca9a);}(_0xebb1,0x13e));var _0x1ebb=function(_0x112eea,_0x238f96){_0x112eea=_0x112eea-0x0;var _0x27982c=_0xebb1[_0x112eea];return _0x27982c;};'use strict';var Sequelize=require(_0x1ebb('0x0'));module[_0x1ebb('0x1')]={'priority':{'type':Sequelize[_0x1ebb('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1ebb('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1ebb('0x4')]()},'description':{'type':Sequelize[_0x1ebb('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1ebb('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 29dd139..1e9d3f5 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 _0x86c3=['Content-Range','apply','reject','save','destroy','name','index','OpenchannelApplication','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','then','include','findAll','catch','params','keys','includeAll','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set'];(function(_0x5bf834,_0x360ac4){var _0x1c1aaa=function(_0x2cb0d6){while(--_0x2cb0d6){_0x5bf834['push'](_0x5bf834['shift']());}};_0x1c1aaa(++_0x360ac4);}(_0x86c3,0x14b));var _0x386c=function(_0xe32be3,_0x328dd7){_0xe32be3=_0xe32be3-0x0;var _0x3764d1=_0x86c3[_0xe32be3];return _0x3764d1;};'use strict';var emlformat=require(_0x386c('0x0'));var rimraf=require(_0x386c('0x1'));var zipdir=require(_0x386c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x386c('0x3'));var moment=require(_0x386c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x386c('0x5'));var path=require('path');var sox=require(_0x386c('0x6'));var csv=require(_0x386c('0x7'));var ejs=require(_0x386c('0x8'));var fs=require('fs');var fs_extra=require(_0x386c('0x9'));var _=require(_0x386c('0xa'));var squel=require(_0x386c('0xb'));var crypto=require(_0x386c('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x386c('0xd'));var toCsv=require(_0x386c('0x7'));var querystring=require(_0x386c('0xe'));var Papa=require(_0x386c('0xf'));var Redis=require(_0x386c('0x10'));var authService=require(_0x386c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x386c('0x12'));var logger=require(_0x386c('0x13'))(_0x386c('0x14'));var utils=require(_0x386c('0x15'));var config=require(_0x386c('0x16'));var licenseUtil=require(_0x386c('0x17'));var db=require(_0x386c('0x18'))['db'];function respondWithStatusCode(_0x5214b8,_0x182967){_0x182967=_0x182967||0xcc;return function(_0x19ca78){if(_0x19ca78){return _0x5214b8[_0x386c('0x19')](_0x182967);}return _0x5214b8[_0x386c('0x1a')](_0x182967)[_0x386c('0x1b')]();};}function respondWithResult(_0x44b28c,_0x48a2f9){_0x48a2f9=_0x48a2f9||0xc8;return function(_0xa1df2f){if(_0xa1df2f){return _0x44b28c[_0x386c('0x1a')](_0x48a2f9)[_0x386c('0x1c')](_0xa1df2f);}};}function respondWithFilteredResult(_0x3c0c13,_0x38121d){return function(_0x1caaa1){if(_0x1caaa1){var _0x648afe=typeof _0x38121d['offset']===_0x386c('0x1d')&&typeof _0x38121d['limit']===_0x386c('0x1d');var _0x15ab19=_0x1caaa1[_0x386c('0x1e')];var _0x1814f8=_0x648afe?0x0:_0x38121d['offset'];var _0x13e60c=_0x648afe?_0x1caaa1[_0x386c('0x1e')]:_0x38121d[_0x386c('0x1f')]+_0x38121d[_0x386c('0x20')];var _0x390041;if(_0x13e60c>=_0x15ab19){_0x13e60c=_0x15ab19;_0x390041=0xc8;}else{_0x390041=0xce;}_0x3c0c13[_0x386c('0x1a')](_0x390041);return _0x3c0c13[_0x386c('0x21')](_0x386c('0x22'),_0x1814f8+'-'+_0x13e60c+'/'+_0x15ab19)[_0x386c('0x1c')](_0x1caaa1);}return null;};}function patchUpdates(_0x4378cf){return function(_0x546487){try{jsonpatch[_0x386c('0x23')](_0x546487,_0x4378cf,!![]);}catch(_0x3da8fd){return BPromise[_0x386c('0x24')](_0x3da8fd);}return _0x546487[_0x386c('0x25')]();};}function saveUpdates(_0x2e7282,_0x13ec44){return function(_0x576f6f){if(_0x576f6f){return _0x576f6f['update'](_0x2e7282)['then'](function(_0x2bf2ad){return _0x2bf2ad;});}return null;};}function removeEntity(_0x1d9c55,_0xb8fc4f){return function(_0x117913){if(_0x117913){return _0x117913[_0x386c('0x26')]()['then'](function(){_0x1d9c55[_0x386c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8d15a1,_0x3f4743){return function(_0x3a843a){if(!_0x3a843a){_0x8d15a1[_0x386c('0x19')](0x194);}return _0x3a843a;};}function handleError(_0x16dcb2,_0x332955){_0x332955=_0x332955||0x1f4;return function(_0x36c0ee){logger['error'](_0x36c0ee['stack']);if(_0x36c0ee['name']){delete _0x36c0ee[_0x386c('0x27')];}_0x16dcb2[_0x386c('0x1a')](_0x332955)['send'](_0x36c0ee);};}exports[_0x386c('0x28')]=function(_0x3556a3,_0x47ee1c){var _0x571939={},_0x683288={},_0x42f179={'count':0x0,'rows':[]};var _0x3ca39c=_['map'](db[_0x386c('0x29')][_0x386c('0x2a')],function(_0x518029){return{'name':_0x518029[_0x386c('0x2b')],'type':_0x518029[_0x386c('0x2c')][_0x386c('0x2d')]};});_0x683288['model']=_[_0x386c('0x2e')](_0x3ca39c,_0x386c('0x27'));_0x683288[_0x386c('0x2f')]=_['keys'](_0x3556a3[_0x386c('0x2f')]);_0x683288[_0x386c('0x30')]=_[_0x386c('0x31')](_0x683288[_0x386c('0x32')],_0x683288['query']);_0x571939['attributes']=_[_0x386c('0x31')](_0x683288[_0x386c('0x32')],qs[_0x386c('0x33')](_0x3556a3[_0x386c('0x2f')][_0x386c('0x33')]));_0x571939[_0x386c('0x34')]=_0x571939[_0x386c('0x34')][_0x386c('0x35')]?_0x571939[_0x386c('0x34')]:_0x683288[_0x386c('0x32')];if(!_0x3556a3[_0x386c('0x2f')][_0x386c('0x36')](_0x386c('0x37'))){_0x571939['limit']=qs['limit'](_0x3556a3['query'][_0x386c('0x20')]);_0x571939[_0x386c('0x1f')]=qs[_0x386c('0x1f')](_0x3556a3[_0x386c('0x2f')][_0x386c('0x1f')]);}_0x571939[_0x386c('0x38')]=qs[_0x386c('0x39')](_0x3556a3[_0x386c('0x2f')]['sort']);_0x571939[_0x386c('0x3a')]=qs[_0x386c('0x30')](_[_0x386c('0x3b')](_0x3556a3[_0x386c('0x2f')],_0x683288['filters']),_0x3ca39c);if(_0x3556a3['query'][_0x386c('0x3c')]){_0x571939[_0x386c('0x3a')]=_[_0x386c('0x3d')](_0x571939[_0x386c('0x3a')],{'$or':_[_0x386c('0x2e')](_0x3ca39c,function(_0x4ae8d6){if(_0x4ae8d6[_0x386c('0x2c')]!=='VIRTUAL'){var _0x2cc020={};_0x2cc020[_0x4ae8d6[_0x386c('0x27')]]={'$like':'%'+_0x3556a3['query']['filter']+'%'};return _0x2cc020;}})});}_0x571939=_['merge']({},_0x571939,_0x3556a3[_0x386c('0x3e')]);var _0x453da9={'where':_0x571939[_0x386c('0x3a')]};return db[_0x386c('0x29')][_0x386c('0x1e')](_0x453da9)[_0x386c('0x3f')](function(_0x55bdfb){_0x42f179[_0x386c('0x1e')]=_0x55bdfb;if(_0x3556a3['query']['includeAll']){_0x571939[_0x386c('0x40')]=[{'all':!![]}];}return db[_0x386c('0x29')][_0x386c('0x41')](_0x571939);})[_0x386c('0x3f')](function(_0x18f86e){_0x42f179['rows']=_0x18f86e;return _0x42f179;})['then'](respondWithFilteredResult(_0x47ee1c,_0x571939))[_0x386c('0x42')](handleError(_0x47ee1c,null));};exports['show']=function(_0xd26e8e,_0xd4a5f4){var _0x2730b1={'raw':!![],'where':{'id':_0xd26e8e[_0x386c('0x43')]['id']}},_0x1f3c4={};_0x1f3c4[_0x386c('0x32')]=_[_0x386c('0x44')](db[_0x386c('0x29')][_0x386c('0x2a')]);_0x1f3c4[_0x386c('0x2f')]=_['keys'](_0xd26e8e[_0x386c('0x2f')]);_0x1f3c4[_0x386c('0x30')]=_[_0x386c('0x31')](_0x1f3c4[_0x386c('0x32')],_0x1f3c4['query']);_0x2730b1[_0x386c('0x34')]=_[_0x386c('0x31')](_0x1f3c4[_0x386c('0x32')],qs[_0x386c('0x33')](_0xd26e8e[_0x386c('0x2f')][_0x386c('0x33')]));_0x2730b1['attributes']=_0x2730b1['attributes']['length']?_0x2730b1[_0x386c('0x34')]:_0x1f3c4[_0x386c('0x32')];if(_0xd26e8e['query'][_0x386c('0x45')]){_0x2730b1['include']=[{'all':!![]}];}_0x2730b1=_['merge']({},_0x2730b1,_0xd26e8e[_0x386c('0x3e')]);return db['OpenchannelApplication'][_0x386c('0x46')](_0x2730b1)[_0x386c('0x3f')](handleEntityNotFound(_0xd4a5f4,null))[_0x386c('0x3f')](respondWithResult(_0xd4a5f4,null))[_0x386c('0x42')](handleError(_0xd4a5f4,null));};exports['create']=function(_0x510a9c,_0x1e03c7){return db[_0x386c('0x29')][_0x386c('0x47')](_0x510a9c[_0x386c('0x48')],{})[_0x386c('0x3f')](respondWithResult(_0x1e03c7,0xc9))['catch'](handleError(_0x1e03c7,null));};exports['update']=function(_0x33987a,_0x25fb1c){if(_0x33987a[_0x386c('0x48')]['id']){delete _0x33987a[_0x386c('0x48')]['id'];}return db[_0x386c('0x29')][_0x386c('0x46')]({'where':{'id':_0x33987a[_0x386c('0x43')]['id']}})['then'](handleEntityNotFound(_0x25fb1c,null))[_0x386c('0x3f')](saveUpdates(_0x33987a[_0x386c('0x48')],null))[_0x386c('0x3f')](respondWithResult(_0x25fb1c,null))[_0x386c('0x42')](handleError(_0x25fb1c,null));};exports[_0x386c('0x26')]=function(_0x2df0ee,_0x2af716){return db[_0x386c('0x29')][_0x386c('0x46')]({'where':{'id':_0x2df0ee[_0x386c('0x43')]['id']}})[_0x386c('0x3f')](handleEntityNotFound(_0x2af716,null))[_0x386c('0x3f')](removeEntity(_0x2af716,null))['catch'](handleError(_0x2af716,null));}; \ No newline at end of file +var _0x3f26=['apply','save','then','destroy','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','where','options','include','findAll','catch','params','fields','includeAll','create','update','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x35eb76,_0x16abfc){var _0x5ea5d2=function(_0x59d820){while(--_0x59d820){_0x35eb76['push'](_0x35eb76['shift']());}};_0x5ea5d2(++_0x16abfc);}(_0x3f26,0xae));var _0x63f2=function(_0x56e2c7,_0x3e39ce){_0x56e2c7=_0x56e2c7-0x0;var _0x290a21=_0x3f26[_0x56e2c7];return _0x290a21;};'use strict';var emlformat=require(_0x63f2('0x0'));var rimraf=require(_0x63f2('0x1'));var zipdir=require(_0x63f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63f2('0x3'));var moment=require('moment');var BPromise=require(_0x63f2('0x4'));var Mustache=require('mustache');var util=require(_0x63f2('0x5'));var path=require(_0x63f2('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x63f2('0x7'));var fs=require('fs');var fs_extra=require(_0x63f2('0x8'));var _=require(_0x63f2('0x9'));var squel=require('squel');var crypto=require(_0x63f2('0xa'));var jsforce=require(_0x63f2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x63f2('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x63f2('0xd'));var qs=require(_0x63f2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f2('0xf'));var logger=require('../../config/logger')(_0x63f2('0x10'));var utils=require(_0x63f2('0x11'));var config=require(_0x63f2('0x12'));var licenseUtil=require(_0x63f2('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x172acc,_0x1c4546){_0x1c4546=_0x1c4546||0xcc;return function(_0x467201){if(_0x467201){return _0x172acc[_0x63f2('0x14')](_0x1c4546);}return _0x172acc[_0x63f2('0x15')](_0x1c4546)[_0x63f2('0x16')]();};}function respondWithResult(_0x307b85,_0x56c3f8){_0x56c3f8=_0x56c3f8||0xc8;return function(_0x20ba4a){if(_0x20ba4a){return _0x307b85[_0x63f2('0x15')](_0x56c3f8)[_0x63f2('0x17')](_0x20ba4a);}};}function respondWithFilteredResult(_0x478693,_0x529738){return function(_0x275c4e){if(_0x275c4e){var _0x20aa57=typeof _0x529738[_0x63f2('0x18')]==='undefined'&&typeof _0x529738[_0x63f2('0x19')]===_0x63f2('0x1a');var _0x39eeeb=_0x275c4e[_0x63f2('0x1b')];var _0x565827=_0x20aa57?0x0:_0x529738['offset'];var _0x5b78d7=_0x20aa57?_0x275c4e[_0x63f2('0x1b')]:_0x529738[_0x63f2('0x18')]+_0x529738[_0x63f2('0x19')];var _0x388ced;if(_0x5b78d7>=_0x39eeeb){_0x5b78d7=_0x39eeeb;_0x388ced=0xc8;}else{_0x388ced=0xce;}_0x478693[_0x63f2('0x15')](_0x388ced);return _0x478693[_0x63f2('0x1c')](_0x63f2('0x1d'),_0x565827+'-'+_0x5b78d7+'/'+_0x39eeeb)[_0x63f2('0x17')](_0x275c4e);}return null;};}function patchUpdates(_0x426858){return function(_0x5a84f){try{jsonpatch[_0x63f2('0x1e')](_0x5a84f,_0x426858,!![]);}catch(_0x351570){return BPromise['reject'](_0x351570);}return _0x5a84f[_0x63f2('0x1f')]();};}function saveUpdates(_0x27a12e,_0x433873){return function(_0x4a739c){if(_0x4a739c){return _0x4a739c['update'](_0x27a12e)[_0x63f2('0x20')](function(_0x41506b){return _0x41506b;});}return null;};}function removeEntity(_0x25efa4,_0x35829d){return function(_0xb2a8d){if(_0xb2a8d){return _0xb2a8d[_0x63f2('0x21')]()[_0x63f2('0x20')](function(){_0x25efa4[_0x63f2('0x15')](0xcc)[_0x63f2('0x16')]();});}};}function handleEntityNotFound(_0x2a3e29,_0x2cbcdc){return function(_0x5c0506){if(!_0x5c0506){_0x2a3e29[_0x63f2('0x14')](0x194);}return _0x5c0506;};}function handleError(_0x4d7b0a,_0x45db77){_0x45db77=_0x45db77||0x1f4;return function(_0x2cf21b){logger[_0x63f2('0x22')](_0x2cf21b[_0x63f2('0x23')]);if(_0x2cf21b[_0x63f2('0x24')]){delete _0x2cf21b[_0x63f2('0x24')];}_0x4d7b0a[_0x63f2('0x15')](_0x45db77)[_0x63f2('0x25')](_0x2cf21b);};}exports[_0x63f2('0x26')]=function(_0x135338,_0x14b2df){var _0x37973b={},_0x125fc3={},_0x2a9bda={'count':0x0,'rows':[]};var _0xbb057a=_[_0x63f2('0x27')](db[_0x63f2('0x28')][_0x63f2('0x29')],function(_0x224327){return{'name':_0x224327['fieldName'],'type':_0x224327[_0x63f2('0x2a')]['key']};});_0x125fc3[_0x63f2('0x2b')]=_[_0x63f2('0x27')](_0xbb057a,_0x63f2('0x24'));_0x125fc3[_0x63f2('0x2c')]=_[_0x63f2('0x2d')](_0x135338[_0x63f2('0x2c')]);_0x125fc3[_0x63f2('0x2e')]=_[_0x63f2('0x2f')](_0x125fc3[_0x63f2('0x2b')],_0x125fc3[_0x63f2('0x2c')]);_0x37973b['attributes']=_[_0x63f2('0x2f')](_0x125fc3[_0x63f2('0x2b')],qs['fields'](_0x135338[_0x63f2('0x2c')]['fields']));_0x37973b[_0x63f2('0x30')]=_0x37973b[_0x63f2('0x30')][_0x63f2('0x31')]?_0x37973b[_0x63f2('0x30')]:_0x125fc3[_0x63f2('0x2b')];if(!_0x135338[_0x63f2('0x2c')][_0x63f2('0x32')](_0x63f2('0x33'))){_0x37973b['limit']=qs[_0x63f2('0x19')](_0x135338[_0x63f2('0x2c')][_0x63f2('0x19')]);_0x37973b['offset']=qs[_0x63f2('0x18')](_0x135338['query'][_0x63f2('0x18')]);}_0x37973b[_0x63f2('0x34')]=qs[_0x63f2('0x35')](_0x135338[_0x63f2('0x2c')][_0x63f2('0x35')]);_0x37973b['where']=qs[_0x63f2('0x2e')](_['pick'](_0x135338[_0x63f2('0x2c')],_0x125fc3[_0x63f2('0x2e')]),_0xbb057a);if(_0x135338['query'][_0x63f2('0x36')]){_0x37973b['where']=_[_0x63f2('0x37')](_0x37973b[_0x63f2('0x38')],{'$or':_['map'](_0xbb057a,function(_0x13ca4a){if(_0x13ca4a[_0x63f2('0x2a')]!=='VIRTUAL'){var _0x5427f8={};_0x5427f8[_0x13ca4a['name']]={'$like':'%'+_0x135338[_0x63f2('0x2c')][_0x63f2('0x36')]+'%'};return _0x5427f8;}})});}_0x37973b=_[_0x63f2('0x37')]({},_0x37973b,_0x135338[_0x63f2('0x39')]);var _0x489f0e={'where':_0x37973b['where']};return db[_0x63f2('0x28')]['count'](_0x489f0e)[_0x63f2('0x20')](function(_0x14f54d){_0x2a9bda['count']=_0x14f54d;if(_0x135338['query']['includeAll']){_0x37973b[_0x63f2('0x3a')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0x63f2('0x3b')](_0x37973b);})[_0x63f2('0x20')](function(_0x4095f9){_0x2a9bda['rows']=_0x4095f9;return _0x2a9bda;})[_0x63f2('0x20')](respondWithFilteredResult(_0x14b2df,_0x37973b))[_0x63f2('0x3c')](handleError(_0x14b2df,null));};exports['show']=function(_0x2c5b67,_0x603514){var _0xb8bea3={'raw':!![],'where':{'id':_0x2c5b67[_0x63f2('0x3d')]['id']}},_0x46e1ac={};_0x46e1ac[_0x63f2('0x2b')]=_[_0x63f2('0x2d')](db[_0x63f2('0x28')][_0x63f2('0x29')]);_0x46e1ac[_0x63f2('0x2c')]=_[_0x63f2('0x2d')](_0x2c5b67[_0x63f2('0x2c')]);_0x46e1ac[_0x63f2('0x2e')]=_[_0x63f2('0x2f')](_0x46e1ac['model'],_0x46e1ac[_0x63f2('0x2c')]);_0xb8bea3[_0x63f2('0x30')]=_[_0x63f2('0x2f')](_0x46e1ac[_0x63f2('0x2b')],qs[_0x63f2('0x3e')](_0x2c5b67['query']['fields']));_0xb8bea3[_0x63f2('0x30')]=_0xb8bea3[_0x63f2('0x30')][_0x63f2('0x31')]?_0xb8bea3['attributes']:_0x46e1ac['model'];if(_0x2c5b67[_0x63f2('0x2c')][_0x63f2('0x3f')]){_0xb8bea3['include']=[{'all':!![]}];}_0xb8bea3=_[_0x63f2('0x37')]({},_0xb8bea3,_0x2c5b67[_0x63f2('0x39')]);return db[_0x63f2('0x28')]['find'](_0xb8bea3)[_0x63f2('0x20')](handleEntityNotFound(_0x603514,null))[_0x63f2('0x20')](respondWithResult(_0x603514,null))['catch'](handleError(_0x603514,null));};exports[_0x63f2('0x40')]=function(_0x59eb1f,_0x64e239){return db['OpenchannelApplication'][_0x63f2('0x40')](_0x59eb1f['body'],{})['then'](respondWithResult(_0x64e239,0xc9))[_0x63f2('0x3c')](handleError(_0x64e239,null));};exports[_0x63f2('0x41')]=function(_0x390ba7,_0x39d5b9){if(_0x390ba7[_0x63f2('0x42')]['id']){delete _0x390ba7[_0x63f2('0x42')]['id'];}return db[_0x63f2('0x28')]['find']({'where':{'id':_0x390ba7[_0x63f2('0x3d')]['id']}})[_0x63f2('0x20')](handleEntityNotFound(_0x39d5b9,null))[_0x63f2('0x20')](saveUpdates(_0x390ba7['body'],null))[_0x63f2('0x20')](respondWithResult(_0x39d5b9,null))['catch'](handleError(_0x39d5b9,null));};exports[_0x63f2('0x21')]=function(_0x48c3d7,_0x1a5707){return db[_0x63f2('0x28')][_0x63f2('0x43')]({'where':{'id':_0x48c3d7[_0x63f2('0x3d')]['id']}})[_0x63f2('0x20')](handleEntityNotFound(_0x1a5707,null))[_0x63f2('0x20')](removeEntity(_0x1a5707,null))[_0x63f2('0x3c')](handleError(_0x1a5707,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 759d6a2..dc6bbdb 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 _0x0578=['define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports'];(function(_0x4d351b,_0x52741c){var _0x3d2422=function(_0x332260){while(--_0x332260){_0x4d351b['push'](_0x4d351b['shift']());}};_0x3d2422(++_0x52741c);}(_0x0578,0x155));var _0x8057=function(_0x2d5d3a,_0x4a6338){_0x2d5d3a=_0x2d5d3a-0x0;var _0x19ecab=_0x0578[_0x2d5d3a];return _0x19ecab;};'use strict';var _=require(_0x8057('0x0'));var util=require(_0x8057('0x1'));var logger=require(_0x8057('0x2'))('api');var moment=require(_0x8057('0x3'));var BPromise=require(_0x8057('0x4'));var rp=require(_0x8057('0x5'));var fs=require('fs');var path=require(_0x8057('0x6'));var rimraf=require(_0x8057('0x7'));var config=require(_0x8057('0x8'));var attributes=require(_0x8057('0x9'));module[_0x8057('0xa')]=function(_0x406962,_0x1d0e4b){return _0x406962[_0x8057('0xb')](_0x8057('0xc'),attributes,{'tableName':_0x8057('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8057('0xe'),'collate':_0x8057('0xf')});}; \ No newline at end of file +var _0x5cbf=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5cbf,0x186));var _0xf5cb=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0x5cbf[_0xa6cc5c];return _0x44803d;};'use strict';var _=require(_0xf5cb('0x0'));var util=require(_0xf5cb('0x1'));var logger=require(_0xf5cb('0x2'))('api');var moment=require(_0xf5cb('0x3'));var BPromise=require(_0xf5cb('0x4'));var rp=require(_0xf5cb('0x5'));var fs=require('fs');var path=require(_0xf5cb('0x6'));var rimraf=require(_0xf5cb('0x7'));var config=require(_0xf5cb('0x8'));var attributes=require(_0xf5cb('0x9'));module[_0xf5cb('0xa')]=function(_0x2417e8,_0x5f4d18){return _0x2417e8[_0xf5cb('0xb')](_0xf5cb('0xc'),attributes,{'tableName':_0xf5cb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf5cb('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 4fee3db..e6dbf5d 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 _0xaf86=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','catch','UpdateOpenchannelApplication','body','options','raw','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaf86,0xa1));var _0x6af8=function(_0x230e39,_0x5341){_0x230e39=_0x230e39-0x0;var _0xa804e=_0xaf86[_0x230e39];return _0xa804e;};'use strict';var _=require(_0x6af8('0x0'));var util=require(_0x6af8('0x1'));var moment=require(_0x6af8('0x2'));var BPromise=require('bluebird');var rs=require(_0x6af8('0x3'));var fs=require('fs');var Redis=require(_0x6af8('0x4'));var db=require(_0x6af8('0x5'))['db'];var utils=require(_0x6af8('0x6'));var logger=require(_0x6af8('0x7'))(_0x6af8('0x8'));var config=require(_0x6af8('0x9'));var jayson=require(_0x6af8('0xa'));var client=jayson[_0x6af8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32418f,_0x960f8c,_0x21f550){return new BPromise(function(_0x27c4e5,_0x30c67e){return client[_0x6af8('0xc')](_0x32418f,_0x21f550)[_0x6af8('0xd')](function(_0x5db0cb){logger[_0x6af8('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x960f8c,'request\x20sent');logger[_0x6af8('0xf')](_0x6af8('0x10'),_0x960f8c,_0x6af8('0x11'),JSON[_0x6af8('0x12')](_0x5db0cb));if(_0x5db0cb[_0x6af8('0x13')]){if(_0x5db0cb[_0x6af8('0x13')]['code']===0x1f4){logger['error'](_0x6af8('0x14'),_0x960f8c,_0x5db0cb[_0x6af8('0x13')][_0x6af8('0x15')]);return _0x30c67e(_0x5db0cb['error'][_0x6af8('0x15')]);}logger[_0x6af8('0x13')](_0x6af8('0x14'),_0x960f8c,_0x5db0cb['error']['message']);return _0x27c4e5(_0x5db0cb[_0x6af8('0x13')][_0x6af8('0x15')]);}else{logger[_0x6af8('0xe')]('OpenchannelApplication,\x20%s,\x20%s',_0x960f8c,_0x6af8('0x11'));_0x27c4e5(_0x5db0cb['result']['message']);}})[_0x6af8('0x16')](function(_0x1c1c31){logger[_0x6af8('0x13')](_0x6af8('0x14'),_0x960f8c,_0x1c1c31);_0x30c67e(_0x1c1c31);});});}exports[_0x6af8('0x17')]=function(_0x366aa4){var _0x38fc14=this;return new Promise(function(_0x4579c3,_0x4d79f6){return db['OpenchannelApplication']['update'](_0x366aa4[_0x6af8('0x18')],{'raw':_0x366aa4[_0x6af8('0x19')]?_0x366aa4['options'][_0x6af8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x366aa4[_0x6af8('0x19')]?_0x366aa4['options']['where']||null:null,'attributes':_0x366aa4[_0x6af8('0x19')]?_0x366aa4[_0x6af8('0x19')]['attributes']||null:null,'limit':_0x366aa4[_0x6af8('0x19')]?_0x366aa4[_0x6af8('0x19')][_0x6af8('0x1b')]||null:null})[_0x6af8('0xd')](function(_0x5e2afe){logger['info'](_0x6af8('0x17'),_0x366aa4);logger['debug'](_0x6af8('0x17'),_0x366aa4,JSON['stringify'](_0x5e2afe));_0x4579c3(_0x5e2afe);})[_0x6af8('0x16')](function(_0x49de49){logger['error']('UpdateOpenchannelApplication',_0x49de49[_0x6af8('0x15')],_0x366aa4);_0x4d79f6(_0x38fc14[_0x6af8('0x13')](0x1f4,_0x49de49[_0x6af8('0x15')]));});});}; \ No newline at end of file +var _0x8e8b=['jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','debug','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x370732,_0x304cac){var _0x3226d8=function(_0xafef58){while(--_0xafef58){_0x370732['push'](_0x370732['shift']());}};_0x3226d8(++_0x304cac);}(_0x8e8b,0x161));var _0xb8e8=function(_0x3b9c6e,_0x3d7e9a){_0x3b9c6e=_0x3b9c6e-0x0;var _0x3db00b=_0x8e8b[_0x3b9c6e];return _0x3db00b;};'use strict';var _=require('lodash');var util=require(_0xb8e8('0x0'));var moment=require(_0xb8e8('0x1'));var BPromise=require(_0xb8e8('0x2'));var rs=require(_0xb8e8('0x3'));var fs=require('fs');var Redis=require(_0xb8e8('0x4'));var db=require(_0xb8e8('0x5'))['db'];var utils=require(_0xb8e8('0x6'));var logger=require(_0xb8e8('0x7'))(_0xb8e8('0x8'));var config=require(_0xb8e8('0x9'));var jayson=require(_0xb8e8('0xa'));var client=jayson[_0xb8e8('0xb')][_0xb8e8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9a9ab7,_0x3465da,_0x538954){return new BPromise(function(_0x3b830f,_0x179ae3){return client[_0xb8e8('0xd')](_0x9a9ab7,_0x538954)[_0xb8e8('0xe')](function(_0x977e99){logger[_0xb8e8('0xf')](_0xb8e8('0x10'),_0x3465da,_0xb8e8('0x11'));logger['debug'](_0xb8e8('0x12'),_0x3465da,_0xb8e8('0x11'),JSON['stringify'](_0x977e99));if(_0x977e99[_0xb8e8('0x13')]){if(_0x977e99[_0xb8e8('0x13')]['code']===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x3465da,_0x977e99['error']['message']);return _0x179ae3(_0x977e99[_0xb8e8('0x13')]['message']);}logger[_0xb8e8('0x13')](_0xb8e8('0x10'),_0x3465da,_0x977e99['error']['message']);return _0x3b830f(_0x977e99[_0xb8e8('0x13')][_0xb8e8('0x14')]);}else{logger['info'](_0xb8e8('0x10'),_0x3465da,_0xb8e8('0x11'));_0x3b830f(_0x977e99[_0xb8e8('0x15')]['message']);}})[_0xb8e8('0x16')](function(_0x594af4){logger[_0xb8e8('0x13')](_0xb8e8('0x10'),_0x3465da,_0x594af4);_0x179ae3(_0x594af4);});});}exports[_0xb8e8('0x17')]=function(_0x2e9deb){var _0x5a2804=this;return new Promise(function(_0x5cf63e,_0x42c865){return db[_0xb8e8('0x18')][_0xb8e8('0x19')](_0x2e9deb[_0xb8e8('0x1a')],{'raw':_0x2e9deb[_0xb8e8('0x1b')]?_0x2e9deb[_0xb8e8('0x1b')][_0xb8e8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e9deb[_0xb8e8('0x1b')]?_0x2e9deb[_0xb8e8('0x1b')]['where']||null:null,'attributes':_0x2e9deb[_0xb8e8('0x1b')]?_0x2e9deb[_0xb8e8('0x1b')][_0xb8e8('0x1d')]||null:null,'limit':_0x2e9deb['options']?_0x2e9deb[_0xb8e8('0x1b')][_0xb8e8('0x1e')]||null:null})[_0xb8e8('0xe')](function(_0x14d9a7){logger[_0xb8e8('0xf')]('UpdateOpenchannelApplication',_0x2e9deb);logger[_0xb8e8('0x1f')]('UpdateOpenchannelApplication',_0x2e9deb,JSON[_0xb8e8('0x20')](_0x14d9a7));_0x5cf63e(_0x14d9a7);})[_0xb8e8('0x16')](function(_0x153ae7){logger[_0xb8e8('0x13')]('UpdateOpenchannelApplication',_0x153ae7[_0xb8e8('0x14')],_0x2e9deb);_0x42c865(_0x5a2804['error'](0x1f4,_0x153ae7['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index c31a2c7..8110af1 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 _0x9b67=['update','delete','openchannelinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','describe','show','/:id/download','download','post','/:id/messages','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','/:id'];(function(_0x32ca7a,_0x4a069d){var _0xab41b9=function(_0x346bfc){while(--_0x346bfc){_0x32ca7a['push'](_0x32ca7a['shift']());}};_0xab41b9(++_0x4a069d);}(_0x9b67,0x199));var _0x79b6=function(_0x3fcdea,_0x3809f2){_0x3fcdea=_0x3fcdea-0x0;var _0x487790=_0x9b67[_0x3fcdea];return _0x487790;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express[_0x79b6('0x5')]();var fs_extra=require(_0x79b6('0x6'));var auth=require(_0x79b6('0x7'));var interaction=require(_0x79b6('0x8'));var config=require('../../config/environment');var controller=require(_0x79b6('0x9'));router[_0x79b6('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x79b6('0xa')]('/describe',auth[_0x79b6('0xb')](),controller[_0x79b6('0xc')]);router[_0x79b6('0xa')]('/:id',auth[_0x79b6('0xb')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x79b6('0xa')](_0x79b6('0xe'),auth[_0x79b6('0xb')](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x79b6('0x10')](_0x79b6('0x11'),auth[_0x79b6('0xb')](),controller[_0x79b6('0x12')]);router[_0x79b6('0x10')]('/:id/tags',auth[_0x79b6('0xb')](),interaction[_0x79b6('0x13')](_0x79b6('0x14'),_0x79b6('0x15')),controller[_0x79b6('0x16')]);router[_0x79b6('0x17')](_0x79b6('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x79b6('0x14'),'openchannelinteraction:update'),controller[_0x79b6('0x19')]);router[_0x79b6('0x1a')](_0x79b6('0x18'),auth[_0x79b6('0xb')](),interaction[_0x79b6('0x13')](_0x79b6('0x14'),_0x79b6('0x1b')),controller['destroy']);router[_0x79b6('0x1a')](_0x79b6('0x1c'),auth['isAuthenticated'](),controller[_0x79b6('0x1d')]);module[_0x79b6('0x1e')]=router; \ No newline at end of file +var _0x6503=['isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get'];(function(_0x423567,_0x1b732f){var _0x25eefc=function(_0x261248){while(--_0x261248){_0x423567['push'](_0x423567['shift']());}};_0x25eefc(++_0x1b732f);}(_0x6503,0x9b));var _0x3650=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x6503[_0x3e32a8];return _0x2997b0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3650('0x0'));var timeout=require(_0x3650('0x1'));var express=require(_0x3650('0x2'));var router=express[_0x3650('0x3')]();var fs_extra=require(_0x3650('0x4'));var auth=require(_0x3650('0x5'));var interaction=require(_0x3650('0x6'));var config=require(_0x3650('0x7'));var controller=require(_0x3650('0x8'));router[_0x3650('0x9')]('/',auth[_0x3650('0xa')](),controller[_0x3650('0xb')]);router[_0x3650('0x9')](_0x3650('0xc'),auth['isAuthenticated'](),controller[_0x3650('0xd')]);router[_0x3650('0x9')](_0x3650('0xe'),auth[_0x3650('0xa')](),controller[_0x3650('0xf')]);router[_0x3650('0x9')](_0x3650('0x10'),auth[_0x3650('0xa')](),controller[_0x3650('0x11')]);router[_0x3650('0x9')](_0x3650('0x12'),auth['isAuthenticated'](),controller[_0x3650('0x13')]);router[_0x3650('0x14')]('/',auth['isAuthenticated'](),controller[_0x3650('0x15')]);router[_0x3650('0x14')](_0x3650('0x10'),auth[_0x3650('0xa')](),controller[_0x3650('0x16')]);router['post'](_0x3650('0x17'),auth[_0x3650('0xa')](),interaction[_0x3650('0x18')](_0x3650('0x19'),'openchannelinteraction:addtags'),controller['addTags']);router[_0x3650('0x1a')](_0x3650('0xe'),auth[_0x3650('0xa')](),interaction[_0x3650('0x18')](_0x3650('0x19'),_0x3650('0x1b')),controller[_0x3650('0x1c')]);router[_0x3650('0x1d')]('/:id',auth['isAuthenticated'](),interaction[_0x3650('0x18')](_0x3650('0x19'),_0x3650('0x1e')),controller[_0x3650('0x1f')]);router[_0x3650('0x1d')](_0x3650('0x17'),auth[_0x3650('0xa')](),controller[_0x3650('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 42ba62c..8a63dbf 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 _0x9417=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x90f39,_0x17382e){var _0x220c6a=function(_0x588f12){while(--_0x588f12){_0x90f39['push'](_0x90f39['shift']());}};_0x220c6a(++_0x17382e);}(_0x9417,0xb4));var _0x7941=function(_0x3452eb,_0x44035e){_0x3452eb=_0x3452eb-0x0;var _0x4244fd=_0x9417[_0x3452eb];return _0x4244fd;};'use strict';var Sequelize=require(_0x7941('0x0'));module[_0x7941('0x1')]={'closed':{'type':Sequelize[_0x7941('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7941('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7941('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7941('0x4')]},'note':{'type':Sequelize[_0x7941('0x4')]},'read1stAt':{'type':Sequelize[_0x7941('0x3')]},'threadId':{'type':Sequelize[_0x7941('0x4')]},'externalUrl':{'type':Sequelize[_0x7941('0x4')]},'lastMsgAt':{'type':Sequelize[_0x7941('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7941('0x5')]('in',_0x7941('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7941('0x4')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x946e=['BOOLEAN','STRING','DATE','out','sequelize'];(function(_0x5da9e3,_0x3d80cd){var _0x5a68cd=function(_0x1e48a4){while(--_0x1e48a4){_0x5da9e3['push'](_0x5da9e3['shift']());}};_0x5a68cd(++_0x3d80cd);}(_0x946e,0x1d0));var _0xe946=function(_0x50470f,_0x1e0719){_0x50470f=_0x50470f-0x0;var _0x45e97c=_0x946e[_0x50470f];return _0x45e97c;};'use strict';var Sequelize=require(_0xe946('0x0'));module['exports']={'closed':{'type':Sequelize[_0xe946('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe946('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xe946('0x2')]},'read1stAt':{'type':Sequelize[_0xe946('0x3')]},'threadId':{'type':Sequelize[_0xe946('0x2')]},'externalUrl':{'type':Sequelize[_0xe946('0x2')]},'lastMsgAt':{'type':Sequelize[_0xe946('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe946('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe946('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xe946('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index cb0d648..549407c 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 _0x6a7f=['./openchannelInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','OpenchannelInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','sort','where','pick','select','field','color','from','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','users','left_join','cm_contacts','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','compact','OpenchannelAccountId','concat','createdAt','parse','$gte','$lte','null','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','isEmpty','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','agent','user','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','includeAll','include','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','YYYY-MM-DD\x20HH:mm:ss','options','addTags','spread','findAll','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','tmp','files','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','Account','Owner','mkdirSync','N.A.','format','closed','closedAt','disposition','threadId','Public','Private','basename','existsSync','createWriteStream','out','renderFile','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','log','err','unlinkSync','eml-format','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x6a7f,0xd7));var _0xf6a7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a7f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf6a7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6a7('0x1'));var BPromise=require(_0xf6a7('0x2'));var Mustache=require(_0xf6a7('0x3'));var util=require(_0xf6a7('0x4'));var path=require(_0xf6a7('0x5'));var sox=require('sox');var csv=require(_0xf6a7('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf6a7('0x7'));var squel=require(_0xf6a7('0x8'));var crypto=require('crypto');var jsforce=require(_0xf6a7('0x9'));var deskjs=require(_0xf6a7('0xa'));var toCsv=require(_0xf6a7('0x6'));var querystring=require(_0xf6a7('0xb'));var Papa=require(_0xf6a7('0xc'));var Redis=require(_0xf6a7('0xd'));var authService=require(_0xf6a7('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xf6a7('0xf'));var pdf=require(_0xf6a7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6a7('0x11'))(_0xf6a7('0x12'));var utils=require(_0xf6a7('0x13'));var config=require(_0xf6a7('0x14'));var licenseUtil=require(_0xf6a7('0x15'));var db=require(_0xf6a7('0x16'))['db'];config[_0xf6a7('0x17')]=_[_0xf6a7('0x18')](config[_0xf6a7('0x17')],{'host':_0xf6a7('0x19'),'port':0x18eb});var socket=require(_0xf6a7('0x1a'))(new Redis(config[_0xf6a7('0x17')]));require(_0xf6a7('0x1b'))[_0xf6a7('0x1c')](socket);function respondWithStatusCode(_0x11a7ec,_0x5dbaa3){_0x5dbaa3=_0x5dbaa3||0xcc;return function(_0x33ebc8){if(_0x33ebc8){return _0x11a7ec[_0xf6a7('0x1d')](_0x5dbaa3);}return _0x11a7ec[_0xf6a7('0x1e')](_0x5dbaa3)['end']();};}function respondWithResult(_0x13ffa2,_0x577712){_0x577712=_0x577712||0xc8;return function(_0x45f848){if(_0x45f848){return _0x13ffa2[_0xf6a7('0x1e')](_0x577712)[_0xf6a7('0x1f')](_0x45f848);}};}function respondWithFilteredResult(_0x232e2c,_0x3e3f8b){return function(_0x54a7dc){if(_0x54a7dc){var _0x37ea4f=typeof _0x3e3f8b['offset']===_0xf6a7('0x20')&&typeof _0x3e3f8b[_0xf6a7('0x21')]===_0xf6a7('0x20');var _0x1f30d3=_0x54a7dc[_0xf6a7('0x22')];var _0x4872d7=_0x37ea4f?0x0:_0x3e3f8b[_0xf6a7('0x23')];var _0x11eda9=_0x37ea4f?_0x54a7dc[_0xf6a7('0x22')]:_0x3e3f8b[_0xf6a7('0x23')]+_0x3e3f8b[_0xf6a7('0x21')];var _0x269e3c;if(_0x11eda9>=_0x1f30d3){_0x11eda9=_0x1f30d3;_0x269e3c=0xc8;}else{_0x269e3c=0xce;}_0x232e2c['status'](_0x269e3c);return _0x232e2c[_0xf6a7('0x24')](_0xf6a7('0x25'),_0x4872d7+'-'+_0x11eda9+'/'+_0x1f30d3)[_0xf6a7('0x1f')](_0x54a7dc);}return null;};}function patchUpdates(_0x548a00){return function(_0x104fd2){try{jsonpatch[_0xf6a7('0x26')](_0x104fd2,_0x548a00,!![]);}catch(_0x1a81b6){return BPromise[_0xf6a7('0x27')](_0x1a81b6);}return _0x104fd2[_0xf6a7('0x28')]();};}function saveUpdates(_0x434345,_0x3a083a){return function(_0x99aa73){if(_0x99aa73){return _0x99aa73[_0xf6a7('0x29')](_0x434345)[_0xf6a7('0x2a')](function(_0x46f584){return _0x46f584;});}return null;};}function removeEntity(_0x1d4ab6,_0x5f14cb){return function(_0x6a8fa7){if(_0x6a8fa7){return _0x6a8fa7[_0xf6a7('0x2b')]()[_0xf6a7('0x2a')](function(){_0x1d4ab6[_0xf6a7('0x1e')](0xcc)[_0xf6a7('0x2c')]();});}};}function handleEntityNotFound(_0xe10279,_0x43d95d){return function(_0xb432cc){if(!_0xb432cc){_0xe10279[_0xf6a7('0x1d')](0x194);}return _0xb432cc;};}function handleError(_0x1b32b6,_0x6875cd){_0x6875cd=_0x6875cd||0x1f4;return function(_0xdcb4a5){logger['error'](_0xdcb4a5[_0xf6a7('0x2d')]);if(_0xdcb4a5[_0xf6a7('0x2e')]){delete _0xdcb4a5[_0xf6a7('0x2e')];}_0x1b32b6[_0xf6a7('0x1e')](_0x6875cd)[_0xf6a7('0x2f')](_0xdcb4a5);};}function getInteractionUsers(_0x58aca5,_0x250fcc){return new BPromise(function(_0x3439e5,_0x1ae4af){try{if(_0x250fcc[_0x58aca5['id']]){_0x58aca5[_0xf6a7('0x30')]=_[_0xf6a7('0x31')](_0x250fcc[_0x58aca5['id']],function(_0x1e4d10){return{'id':_0x1e4d10['id'],'fullname':_0x1e4d10[_0xf6a7('0x32')]};});}}catch(_0x3d9df0){_0x1ae4af(_0x3d9df0);}_0x3439e5(_0x58aca5);});}function getInteractionTags(_0x121c5a,_0x231646){return new BPromise(function(_0xdcf104,_0x3df430){try{if(_0x121c5a[_0xf6a7('0x33')]){_0x121c5a[_0xf6a7('0x34')]=[];_0x121c5a['TagIds'][_0xf6a7('0x35')](',')[_0xf6a7('0x36')](function(_0x6c0e65){_0x121c5a[_0xf6a7('0x34')][_0xf6a7('0x37')](_0x231646[_0x6c0e65]);});}delete _0x121c5a['TagIds'];}catch(_0x2498e6){_0x3df430(_0x2498e6);}_0xdcf104(_0x121c5a);});}function updateOpenchannelInteraction(_0x524dc1,_0x1de64f,_0x21a62d){return new BPromise(function(_0x11d348,_0x2684ed){return getInteractionUsers(_0x524dc1,_0x21a62d)[_0xf6a7('0x2a')](function(_0x5a6f2a){return getInteractionTags(_0x5a6f2a,_0x1de64f);})[_0xf6a7('0x2a')](function(_0x44d130){_0x11d348(_0x44d130);})[_0xf6a7('0x38')](function(_0x3e49c9){_0x2684ed(_0x3e49c9);});});}exports[_0xf6a7('0x39')]=function(_0x67dd94,_0x46332b){var _0x5ba3b0={},_0x1494f3={},_0x110475={'count':0x0,'rows':[]};var _0x1dbf89=_[_0xf6a7('0x31')](db[_0xf6a7('0x3a')][_0xf6a7('0x3b')],function(_0x4ee095){return{'name':_0x4ee095['fieldName'],'type':_0x4ee095[_0xf6a7('0x3c')][_0xf6a7('0x3d')]};});_0x1494f3['model']=_[_0xf6a7('0x31')](_0x1dbf89,_0xf6a7('0x2e'));_0x1494f3[_0xf6a7('0x3e')]=_[_0xf6a7('0x3f')](_0x67dd94['query']);_0x1494f3[_0xf6a7('0x40')]=_[_0xf6a7('0x41')](_0x1494f3[_0xf6a7('0x42')],_0x1494f3[_0xf6a7('0x3e')]);_0x5ba3b0['attributes']=_[_0xf6a7('0x41')](_0x1494f3['model'],qs[_0xf6a7('0x43')](_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x43')]));_0x5ba3b0[_0xf6a7('0x44')]=_0x5ba3b0[_0xf6a7('0x44')][_0xf6a7('0x45')]?_0x5ba3b0[_0xf6a7('0x44')]:_0x1494f3[_0xf6a7('0x42')];if(!_0x67dd94['query']['hasOwnProperty']('nolimit')){_0x5ba3b0[_0xf6a7('0x21')]=qs['limit'](_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x21')]);_0x5ba3b0['offset']=qs[_0xf6a7('0x23')](_0x67dd94[_0xf6a7('0x3e')]['offset']);}_0x5ba3b0[_0xf6a7('0x46')]=qs[_0xf6a7('0x47')](_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x47')]);_0x5ba3b0[_0xf6a7('0x48')]=qs[_0xf6a7('0x40')](_[_0xf6a7('0x49')](_0x67dd94[_0xf6a7('0x3e')],_0x1494f3['filters']),_0x1dbf89);var _0x1f8a85=[];var _0x3d965a=squel[_0xf6a7('0x4a')]()[_0xf6a7('0x4b')]('id')['field']('name')['field'](_0xf6a7('0x4c'))[_0xf6a7('0x4d')](_0xf6a7('0x4e'));var _0x4801a2=squel[_0xf6a7('0x4a')]()[_0xf6a7('0x4b')]('u.id')[_0xf6a7('0x4b')](_0xf6a7('0x4f'))['field'](_0xf6a7('0x50'))[_0xf6a7('0x4d')](_0xf6a7('0x51'),'ui')['left_join'](_0xf6a7('0x52'),'u','u.id\x20=\x20ui.UserId');var _0x51a805=squel[_0xf6a7('0x4a')]()[_0xf6a7('0x4d')]('openchannel_interactions','i')[_0xf6a7('0x53')](_0xf6a7('0x54'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xf6a7('0x53')](_0xf6a7('0x52'),'o',_0xf6a7('0x55'))[_0xf6a7('0x53')](_0xf6a7('0x56'),'a',_0xf6a7('0x57'))[_0xf6a7('0x53')](_0xf6a7('0x58'),'me',_0xf6a7('0x59'))['left_join']('openchannel_interaction_has_tags','it','it.OpenchannelInteractionId\x20=\x20i.id')[_0xf6a7('0x53')](_0xf6a7('0x4e'),'t',_0xf6a7('0x5a'));var _0x271fbe=squel['expr']();var _0x2e91af=[];var _0x37d98e=squel[_0xf6a7('0x5b')]();var _0x259f81;if(_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x5c')]){_0x259f81=as['parseSearch'](_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x5c')]);var _0x3874ef=_0x259f81[_0xf6a7('0x5d')];for(var _0x2d5e81=0x0;_0x2d5e81<_0x259f81[_0xf6a7('0x5e')]['length'];_0x2d5e81++){var _0x25db7a=_0x259f81['conditions'][_0x2d5e81];var _0x23bcc9='i';var _0x5adf5b=_[_0xf6a7('0x5f')](_0x1dbf89,['name',_0x25db7a[_0xf6a7('0x4b')]]);if(!_0x5adf5b){switch(_0x25db7a['field']){case _0xf6a7('0x60'):if(_0x25db7a[_0xf6a7('0x61')]==0x1){_0x51a805[_0xf6a7('0x62')]('`'+_0x25db7a['field']+_0xf6a7('0x63'));}else{_0x51a805[_0xf6a7('0x62')]('`'+_0x25db7a['field']+_0xf6a7('0x64'));}break;case _0xf6a7('0x65'):if(_0x25db7a[_0xf6a7('0x66')]===_0xf6a7('0x67')){if(_0x25db7a[_0xf6a7('0x61')][_0xf6a7('0x35')]('\x20')[_0xf6a7('0x45')]>0x1){_0x271fbe[_0x3874ef](_0xf6a7('0x68'),qs[_0xf6a7('0x69')](_0x25db7a[_0xf6a7('0x61')]),null);}else{var _0x2160a5='%'+_0x25db7a[_0xf6a7('0x61')]+'%';_0x271fbe[_0x3874ef](_0xf6a7('0x6a'),_0x2160a5,_0x2160a5,_0x2160a5);}}else{_0x5adf5b=_[_0xf6a7('0x5f')](_0x1dbf89,[_0xf6a7('0x2e'),_0xf6a7('0x6b')]);_0x25db7a[_0xf6a7('0x4b')]=_0xf6a7('0x6b');_0x28ba74=as[_0xf6a7('0x6c')](_0x23bcc9,_0x5adf5b['type'],_0x25db7a);_0x271fbe[_0x3874ef](_0x28ba74['text'],_0x28ba74[_0xf6a7('0x61')][_0xf6a7('0x6d')],_0x28ba74['value'][_0xf6a7('0x2c')]);}break;case _0xf6a7('0x6e'):var _0xe6b58=_0x25db7a[_0xf6a7('0x61')]['split'](',')[_0xf6a7('0x31')](function(_0x57b8fc){return Number(_0x57b8fc);});_0xe6b58['forEach'](function(_0x453d6d){_0x37d98e['or'](_0xf6a7('0x6f'),'%,'+_0x453d6d+',%');});_0x2e91af=_[_0xf6a7('0x70')](_0x2e91af,_0xe6b58);break;case _0xf6a7('0x71'):if(_0x25db7a[_0xf6a7('0x66')]===_0xf6a7('0x67')){_0x271fbe[_0x3874ef](_0xf6a7('0x72'),'%'+_0x25db7a['value']+'%',null);}else{_0x5adf5b=_[_0xf6a7('0x5f')](_0x1dbf89,['name',_0xf6a7('0x73')]);_0x25db7a[_0xf6a7('0x4b')]=_0xf6a7('0x73');_0x28ba74=as[_0xf6a7('0x6c')](_0x23bcc9,_0x5adf5b[_0xf6a7('0x3c')],_0x25db7a);_0x271fbe[_0x3874ef](_0x28ba74['text'],_0x28ba74[_0xf6a7('0x61')][_0xf6a7('0x6d')],_0x28ba74[_0xf6a7('0x61')][_0xf6a7('0x2c')]);}break;case'body':_0x28ba74=as['buildExpression']('me',null,_0x25db7a);_0x271fbe[_0x3874ef](_0x28ba74[_0xf6a7('0x74')],_0x28ba74[_0xf6a7('0x61')]['start'],_0x28ba74[_0xf6a7('0x61')][_0xf6a7('0x2c')]);break;}}else{var _0x28ba74=as[_0xf6a7('0x6c')](_0x23bcc9,_0x5adf5b['type'],_0x25db7a);_0x271fbe[_0x3874ef](_0x28ba74[_0xf6a7('0x74')],_0x28ba74[_0xf6a7('0x61')][_0xf6a7('0x6d')],_0x28ba74[_0xf6a7('0x61')][_0xf6a7('0x2c')]);}}}else{var _0x562f5e=_(_0x67dd94[_0xf6a7('0x3e')])[_0xf6a7('0x3f')]()[_0xf6a7('0x31')](function(_0x3199ef){return _['some'](_0x1dbf89,[_0xf6a7('0x2e'),_0x3199ef])?_0x3199ef:undefined;})[_0xf6a7('0x75')]()['value']();if(!_['isEmpty'](_0x562f5e)){_0x562f5e[_0xf6a7('0x36')](function(_0x32fa5a){if(_0x32fa5a===_0xf6a7('0x76')){_0x51a805['where']('i.OpenchannelAccountId\x20IN\x20?',[][_0xf6a7('0x77')](_0x67dd94['query'][_0x32fa5a]));}else if(_0x32fa5a===_0xf6a7('0x78')){var _0x27a085=JSON[_0xf6a7('0x79')](_0x67dd94['query'][_0x32fa5a])[_0xf6a7('0x7a')];var _0x471892=JSON[_0xf6a7('0x79')](_0x67dd94[_0xf6a7('0x3e')][_0x32fa5a])[_0xf6a7('0x7b')];_0x51a805[_0xf6a7('0x48')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x27a085,_0x471892);}else{if(_0x67dd94[_0xf6a7('0x3e')][_0x32fa5a]===_0xf6a7('0x7c')){_0x51a805[_0xf6a7('0x48')]('i.'+_0x32fa5a+'\x20IS\x20NULL');}else{_0x51a805[_0xf6a7('0x48')]('i.'+_0x32fa5a+_0xf6a7('0x7d'),_0x67dd94[_0xf6a7('0x3e')][_0x32fa5a]);}}});}if(_0x67dd94[_0xf6a7('0x3e')]['read']){if(_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x7e')]==0x1){_0x51a805[_0xf6a7('0x62')]('`unreadMessages`\x20=\x200');}else{_0x51a805[_0xf6a7('0x62')](_0xf6a7('0x7f'));}}if(_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x80')]){_0x2e91af=_[_0xf6a7('0x81')](_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x80')])?_0x67dd94['query']['tag']:new Array(_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x80')]);_0x2e91af[_0xf6a7('0x36')](function(_0x377301){_0x37d98e['or'](_0xf6a7('0x6f'),'%,'+_0x377301+',%');});}if(_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x82')]){var _0x458eb9=_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x82')][_0xf6a7('0x83')]('\x5c','\x5c\x5c')[_0xf6a7('0x83')](/'/g,'\x27\x27');if(qs[_0xf6a7('0x84')](_0x458eb9)){_0x271fbe['or'](_0xf6a7('0x85'),_0x458eb9+'%');}else{_0x271fbe['or'](_0xf6a7('0x86'),qs['getFullTextValue'](_0x458eb9))['or'](_0xf6a7('0x87'),_0x458eb9+'%')['or'](_0xf6a7('0x88'),_0x458eb9+'%');}}}_0x51a805[_0xf6a7('0x48')](_0x271fbe);_0x51a805[_0xf6a7('0x89')]('i.id');var _0x3dfc70={'type':db['Sequelize'][_0xf6a7('0x8a')][_0xf6a7('0x8b')],'raw':!![]};var _0x39bb61=_0x51a805[_0xf6a7('0x8c')]();_0x39bb61[_0xf6a7('0x4b')](_0xf6a7('0x8d'));_0x39bb61[_0xf6a7('0x4b')](_0xf6a7('0x8e'),_0xf6a7('0x60'));if(_0x5ba3b0[_0xf6a7('0x46')]){_0x5ba3b0[_0xf6a7('0x46')]['forEach'](function(_0x2f2d07){var _0x4d08fd=_0x2f2d07[0x0]==='contactName'?_0x2f2d07[0x0]:'i.'+_0x2f2d07[0x0];_0x51a805[_0xf6a7('0x46')](_0x4d08fd,_0x2f2d07[0x1]===_0xf6a7('0x8f')?![]:!![]);});}if(!_[_0xf6a7('0x90')](_0x2e91af)){_0x51a805['having'](_0x37d98e);_0x39bb61[_0xf6a7('0x48')](_0xf6a7('0x91'),_0x2e91af);}BPromise['resolve']()['then'](function(){if(!_0x259f81){if(_0x67dd94['query'][_0xf6a7('0x76')])return;_0x39bb61[_0xf6a7('0x48')](_0xf6a7('0x92'));_0x51a805[_0xf6a7('0x48')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x67dd94['user']['role']!==_0xf6a7('0x93'))return;return _0x67dd94[_0xf6a7('0x94')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x3cf81d){if(_[_0xf6a7('0x90')](_0x3cf81d)){_0x39bb61[_0xf6a7('0x48')](_0xf6a7('0x95'));_0x51a805[_0xf6a7('0x48')](_0xf6a7('0x95'));}else{_0x39bb61[_0xf6a7('0x48')](_0xf6a7('0x96'),_['map'](_0x3cf81d,'id'));_0x51a805['where'](_0xf6a7('0x96'),_['map'](_0x3cf81d,'id'));}});})[_0xf6a7('0x2a')](function(){if(_0x67dd94['user'][_0xf6a7('0x97')]===_0xf6a7('0x93')&&!_0x259f81&&!_0x67dd94['query'][_0xf6a7('0x76')])return[];return db[_0xf6a7('0x98')][_0xf6a7('0x3e')](_0x39bb61[_0xf6a7('0x99')](),_0x3dfc70);})[_0xf6a7('0x2a')](function(_0x57c6fc){_0x110475[_0xf6a7('0x22')]=_0x57c6fc[_0xf6a7('0x45')];if(_0x110475[_0xf6a7('0x22')]===0x0)return[];return db[_0xf6a7('0x98')][_0xf6a7('0x3e')](_0x3d965a['toString'](),_0x3dfc70)[_0xf6a7('0x2a')](function(_0x300901){_0x1f8a85=_[_0xf6a7('0x9a')](_0x300901,'id');_0x3dfc70=_[_0xf6a7('0x9b')](_0x3dfc70,{'model':db[_0xf6a7('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x67dd94[_0xf6a7('0x3e')][_0xf6a7('0x43')]){_0x5ba3b0[_0xf6a7('0x44')]['forEach'](function(_0x2f4745){_0x51a805['field']('i.'+_0x2f4745);});}else{_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0x8e'),_0xf6a7('0x60'));_0x51a805['field'](_0xf6a7('0x9c'),_0xf6a7('0x9d'));_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0x9e'),'Account.mandatoryDisposition');_0x51a805['field'](_0xf6a7('0x9f'),_0xf6a7('0xa0'));_0x51a805['field']('i.*');_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xa1'),_0xf6a7('0xa2'));_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xa3'),_0xf6a7('0xa4'));_0x51a805['field']('c.email',_0xf6a7('0xa5'));_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xa6'),_0xf6a7('0xa7'));_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xa8'),'Contact.mobile');_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xa9'),_0xf6a7('0xaa'));_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xab'),_0xf6a7('0xac'));_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xad'),_0xf6a7('0xae'));_0x51a805[_0xf6a7('0x4b')](_0xf6a7('0xaf'),'TagIds');}if(_0x5ba3b0[_0xf6a7('0x21')])_0x51a805[_0xf6a7('0x21')](_0x5ba3b0['limit']);if(_0x5ba3b0[_0xf6a7('0x23')])_0x51a805[_0xf6a7('0x23')](_0x5ba3b0['offset']);return db[_0xf6a7('0x98')][_0xf6a7('0x3e')](_0x51a805[_0xf6a7('0x99')](),_0x3dfc70);})[_0xf6a7('0x2a')](function(_0x5c24c7){if(_0x5c24c7[_0xf6a7('0x45')]>0x0)_0x4801a2['where'](_0xf6a7('0xb0'),_[_0xf6a7('0x31')](_0x5c24c7,'id'));return db[_0xf6a7('0x98')]['query'](_0x4801a2[_0xf6a7('0x99')](),_0x3dfc70)['then'](function(_0x5a3508){var _0x2ed53b=_[_0xf6a7('0xb1')](_0x5a3508,_0xf6a7('0xb2'));var _0x239ee1=[];_0x5c24c7[_0xf6a7('0x36')](function(_0x2e4e38){_0x239ee1['push'](updateOpenchannelInteraction(_0x2e4e38,_0x1f8a85,_0x2ed53b));});return BPromise[_0xf6a7('0xb3')](_0x239ee1);});});})[_0xf6a7('0x2a')](function(_0x4c4cac){_0x110475[_0xf6a7('0xb4')]=_0x4c4cac;return _0x110475;})['then'](respondWithFilteredResult(_0x46332b,_0x5ba3b0))[_0xf6a7('0x38')](handleError(_0x46332b,null));};exports[_0xf6a7('0xb5')]=function(_0x38a49a,_0x5050ae){var _0xf00bca={};if(_0x38a49a[_0xf6a7('0x3e')][_0xf6a7('0x3c')]&&_0x38a49a[_0xf6a7('0x3e')][_0xf6a7('0x3c')]===_0xf6a7('0x4d')){_0xf00bca[_0xf6a7('0x4d')]=_0x38a49a[_0xf6a7('0xb6')]['id'];}else{_0xf00bca['id']=_0x38a49a['params']['id'];}var _0x185aa0={'raw':![],'where':_0xf00bca},_0x3d52ac={};_0x3d52ac[_0xf6a7('0x42')]=_[_0xf6a7('0x3f')](db[_0xf6a7('0x3a')][_0xf6a7('0x3b')]);_0x3d52ac[_0xf6a7('0x3e')]=_['keys'](_0x38a49a['query']);_0x3d52ac[_0xf6a7('0x40')]=_[_0xf6a7('0x41')](_0x3d52ac[_0xf6a7('0x42')],_0x3d52ac[_0xf6a7('0x3e')]);_0x185aa0[_0xf6a7('0x44')]=_[_0xf6a7('0x41')](_0x3d52ac[_0xf6a7('0x42')],qs['fields'](_0x38a49a[_0xf6a7('0x3e')]['fields']));_0x185aa0[_0xf6a7('0x44')]=_0x185aa0[_0xf6a7('0x44')]['length']?_0x185aa0[_0xf6a7('0x44')]:_0x3d52ac['model'];if(_0x38a49a[_0xf6a7('0x3e')][_0xf6a7('0xb7')]){_0x185aa0[_0xf6a7('0xb8')]=[{'all':!![]}];}_0x185aa0=_['merge']({},_0x185aa0,_0x38a49a['options']);return db['OpenchannelInteraction'][_0xf6a7('0x5f')](_0x185aa0)[_0xf6a7('0x2a')](handleEntityNotFound(_0x5050ae,null))[_0xf6a7('0x2a')](respondWithResult(_0x5050ae,null))[_0xf6a7('0x38')](handleError(_0x5050ae,null));};exports[_0xf6a7('0xb9')]=function(_0x9a28c1,_0x56c741){return db['OpenchannelInteraction'][_0xf6a7('0xb9')](_0x9a28c1[_0xf6a7('0xba')],{})[_0xf6a7('0x2a')](respondWithResult(_0x56c741,0xc9))[_0xf6a7('0x38')](handleError(_0x56c741,null));};exports[_0xf6a7('0x29')]=function(_0x11abc6,_0x17ffc6){if(_0x11abc6['body']['id']){delete _0x11abc6[_0xf6a7('0xba')]['id'];}return db[_0xf6a7('0x3a')][_0xf6a7('0x5f')]({'where':{'id':_0x11abc6[_0xf6a7('0xb6')]['id']}})[_0xf6a7('0x2a')](handleEntityNotFound(_0x17ffc6,null))[_0xf6a7('0x2a')](saveUpdates(_0x11abc6[_0xf6a7('0xba')],null))['then'](respondWithResult(_0x17ffc6,null))[_0xf6a7('0x38')](handleError(_0x17ffc6,null));};exports[_0xf6a7('0x2b')]=function(_0x411cb0,_0xac3a5a){return db[_0xf6a7('0x3a')]['find']({'where':{'id':_0x411cb0[_0xf6a7('0xb6')]['id']}})[_0xf6a7('0x2a')](handleEntityNotFound(_0xac3a5a,null))['then'](removeEntity(_0xac3a5a,null))[_0xf6a7('0x38')](handleError(_0xac3a5a,null));};exports[_0xf6a7('0xbb')]=function(_0x5052e3,_0x494395){return db[_0xf6a7('0x3a')][_0xf6a7('0xbb')]()[_0xf6a7('0x2a')](respondWithResult(_0x494395,null))[_0xf6a7('0x38')](handleError(_0x494395,null));};exports[_0xf6a7('0xbc')]=function(_0x23fe6c,_0x283ee9,_0x2994e6){return db[_0xf6a7('0xbd')][_0xf6a7('0x5f')]({'where':{'id':_0x23fe6c['params']['id']}})[_0xf6a7('0x2a')](handleEntityNotFound(_0x283ee9,null))[_0xf6a7('0x2a')](function(_0x34202f){if(_0x34202f){return _0x34202f[_0xf6a7('0xbc')](_0x23fe6c[_0xf6a7('0xba')][_0xf6a7('0xbe')],_[_0xf6a7('0xbf')](_0x23fe6c[_0xf6a7('0xba')],[_0xf6a7('0xbe'),'id'])||{});}})[_0xf6a7('0x2a')](respondWithResult(_0x283ee9,null))['catch'](handleError(_0x283ee9,null));};exports[_0xf6a7('0xc0')]=function(_0x1a9a44,_0x480886,_0x19dfc6){var _0x20242c={'raw':![],'where':{}};var _0x16615b={};var _0x50233c={'count':0x0,'rows':[]};return db[_0xf6a7('0x3a')][_0xf6a7('0xc1')]({'where':{'id':_0x1a9a44[_0xf6a7('0xb6')]['id']}})[_0xf6a7('0x2a')](handleEntityNotFound(_0x480886,null))['then'](function(_0x16b2f3){if(_0x16b2f3){_0x16615b[_0xf6a7('0x42')]=_[_0xf6a7('0x3f')](db[_0xf6a7('0xbd')][_0xf6a7('0x3b')]);_0x16615b[_0xf6a7('0x3e')]=_['keys'](_0x1a9a44[_0xf6a7('0x3e')]);_0x16615b[_0xf6a7('0x40')]=_[_0xf6a7('0x41')](_0x16615b[_0xf6a7('0x42')],_0x16615b[_0xf6a7('0x3e')]);_0x20242c[_0xf6a7('0x44')]=_[_0xf6a7('0x41')](_0x16615b[_0xf6a7('0x42')],qs[_0xf6a7('0x43')](_0x1a9a44[_0xf6a7('0x3e')][_0xf6a7('0x43')]));_0x20242c['attributes']=_0x20242c[_0xf6a7('0x44')][_0xf6a7('0x45')]?_0x20242c[_0xf6a7('0x44')]:_0x16615b['model'];if(!_0x1a9a44[_0xf6a7('0x3e')][_0xf6a7('0xc2')](_0xf6a7('0xc3'))){_0x20242c[_0xf6a7('0x21')]=qs[_0xf6a7('0x21')](_0x1a9a44[_0xf6a7('0x3e')]['limit']);_0x20242c[_0xf6a7('0x23')]=qs['offset'](_0x1a9a44[_0xf6a7('0x3e')]['offset']);}_0x20242c['order']=qs[_0xf6a7('0x47')](_0x1a9a44[_0xf6a7('0x3e')][_0xf6a7('0x47')]);_0x20242c[_0xf6a7('0x48')]=qs['filters'](_[_0xf6a7('0x49')](_0x1a9a44[_0xf6a7('0x3e')],_0x16615b['filters']));_0x20242c[_0xf6a7('0x48')]['OpenchannelInteractionId']=_0x16b2f3['id'];if(_0x1a9a44['query'][_0xf6a7('0x82')]){_0x20242c['where']=_[_0xf6a7('0x9b')](_0x20242c[_0xf6a7('0x48')],{'$or':_[_0xf6a7('0x31')](_0x20242c[_0xf6a7('0x44')],function(_0x42fdef){var _0xb04220={};_0xb04220[_0x42fdef]={'$like':'%'+_0x1a9a44[_0xf6a7('0x3e')]['filter']+'%'};return _0xb04220;})});}if(_0x1a9a44['query'][_0xf6a7('0x7a')]){var _0x1480c9=_0x1a9a44[_0xf6a7('0x3e')]['$gte'][_0xf6a7('0x35')](',');var _0x3265de={};_0x3265de[_0x1480c9[0x0]]={'$gte':moment(_0x1480c9[0x1])['format'](_0xf6a7('0xc4'))};_0x20242c['where']=_[_0xf6a7('0x9b')](_0x20242c['where'],_0x3265de);}_0x20242c=_[_0xf6a7('0x9b')]({},_0x20242c,_0x1a9a44[_0xf6a7('0xc5')]);return db[_0xf6a7('0xbd')][_0xf6a7('0x22')]({'where':_0x20242c[_0xf6a7('0x48')]})['then'](function(_0x35cd75){_0x50233c['count']=_0x35cd75;if(_0x1a9a44[_0xf6a7('0x3e')][_0xf6a7('0xb7')]){_0x20242c[_0xf6a7('0xb8')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x20242c);})['then'](function(_0x25059e){_0x50233c[_0xf6a7('0xb4')]=_0x25059e;return _0x50233c;});}})[_0xf6a7('0x2a')](respondWithFilteredResult(_0x480886,_0x20242c))['catch'](handleError(_0x480886,null));};exports[_0xf6a7('0xc6')]=function(_0x195917,_0xdd9462,_0x8e66c1){return db[_0xf6a7('0x3a')]['find']({'where':{'id':_0x195917['params']['id']}})[_0xf6a7('0x2a')](handleEntityNotFound(_0xdd9462,null))[_0xf6a7('0x2a')](function(_0x3e6553){if(_0x3e6553){return _0x3e6553['setTags'](_0x195917[_0xf6a7('0xba')][_0xf6a7('0xbe')],_['omit'](_0x195917['body'],['ids','id'])||{})[_0xf6a7('0xc7')](function(){return db[_0xf6a7('0x6e')][_0xf6a7('0xc8')]({'attributes':['id',_0xf6a7('0x2e'),_0xf6a7('0x4c')],'where':{'id':_0x195917[_0xf6a7('0xba')][_0xf6a7('0xbe')]}});})['then'](function(_0x6e8da){socket[_0xf6a7('0xc9')](_0xf6a7('0xca'),{'id':Number(_0x195917[_0xf6a7('0xb6')]['id']),'tags':_0x6e8da||[]});return{'id':Number(_0x195917[_0xf6a7('0xb6')]['id']),'tags':_0x6e8da||[]};});}})[_0xf6a7('0x2a')](respondWithResult(_0xdd9462,null))[_0xf6a7('0x38')](handleError(_0xdd9462,null));};exports[_0xf6a7('0xcb')]=function(_0x37b492,_0x3e317a,_0xe732db){return db[_0xf6a7('0x3a')][_0xf6a7('0x5f')]({'where':{'id':_0x37b492[_0xf6a7('0xb6')]['id']}})[_0xf6a7('0x2a')](handleEntityNotFound(_0x3e317a,null))[_0xf6a7('0x2a')](function(_0x1d9787){if(_0x1d9787){return _0x1d9787[_0xf6a7('0xcb')](_0x37b492[_0xf6a7('0x3e')][_0xf6a7('0xbe')]);}})[_0xf6a7('0x2a')](respondWithStatusCode(_0x3e317a,null))[_0xf6a7('0x38')](handleError(_0x3e317a,null));};exports[_0xf6a7('0xcc')]=function(_0x47c0a3,_0x5c42e3){var _0x4416c7=moment()['unix']()[_0xf6a7('0x99')]();var _0x444c67=path[_0xf6a7('0xcd')](config[_0xf6a7('0xce')],_0xf6a7('0xcf'),'files',_0xf6a7('0xd0'));var _0x56c7ac=path[_0xf6a7('0xcd')](config[_0xf6a7('0xce')],_0xf6a7('0xcf'),_0xf6a7('0xd1'),_0xf6a7('0xd2'));var _0x234f4f=path[_0xf6a7('0xcd')](_0x444c67,_0x4416c7);var _0x5bd9c5=util['format']('transcript-%d-%s.zip',_0x47c0a3[_0xf6a7('0xb6')]['id'],_0x4416c7);var _0x536c04=path[_0xf6a7('0xcd')](_0x444c67,_0x5bd9c5);var _0x25fafe=[];_0x25fafe['push']({'model':db['User'],'as':_0xf6a7('0x71'),'attributes':['id',_0xf6a7('0x32')],'raw':!![]});_0x25fafe[_0xf6a7('0x37')]({'model':db[_0xf6a7('0xd3')],'as':_0xf6a7('0x65'),'attributes':['id',_0xf6a7('0xd4'),_0xf6a7('0xd5')],'raw':!![]});if(_0x47c0a3[_0xf6a7('0x3e')][_0xf6a7('0xd2')]){_0x25fafe['push']({'model':db[_0xf6a7('0xd6')],'as':'Attachment','raw':!![]});}var _0x31905a=[{'model':db['OpenchannelMessage'],'as':_0xf6a7('0xd7'),'attributes':['id',_0xf6a7('0xba'),_0xf6a7('0x78'),_0xf6a7('0xd8'),_0xf6a7('0xd9'),_0xf6a7('0x7e')],'include':_0x25fafe}];_0x31905a['push']({'model':db['OpenchannelAccount'],'as':_0xf6a7('0xda'),'attributes':['id',_0xf6a7('0x2e')]});_0x31905a[_0xf6a7('0x37')]({'model':db[_0xf6a7('0x71')],'as':_0xf6a7('0xdb'),'attributes':['id',_0xf6a7('0x32')]});return db[_0xf6a7('0x3a')][_0xf6a7('0x5f')]({'where':{'id':_0x47c0a3[_0xf6a7('0xb6')]['id']},'include':_0x31905a})[_0xf6a7('0x2a')](handleEntityNotFound(_0x5c42e3,null))[_0xf6a7('0x2a')](function(_0x463fb6){if(_0x463fb6){var _0x4d7e61=_0x463fb6['get']({'plain':!![]});fs[_0xf6a7('0xdc')](_0x234f4f);var _0x3fdc36={'channel':'Openchannel','account':_0x4d7e61[_0xf6a7('0xda')][_0xf6a7('0x2e')],'agent':_0x4d7e61[_0xf6a7('0xdb')]?_0x4d7e61['Owner'][_0xf6a7('0x32')]:_0xf6a7('0xdd'),'createdAt':moment(_0x4d7e61[_0xf6a7('0x78')])[_0xf6a7('0xde')](_0xf6a7('0xc4'))[_0xf6a7('0x99')](),'closedAt':_0x4d7e61[_0xf6a7('0xdf')]?moment(_0x4d7e61[_0xf6a7('0xe0')])['format'](_0xf6a7('0xc4'))[_0xf6a7('0x99')]():'','disposition':_0x4d7e61[_0xf6a7('0xe1')],'visibility':_0x4d7e61[_0xf6a7('0xe2')]?_0xf6a7('0xe3'):_0xf6a7('0xe4'),'messages':_(_0x4d7e61[_0xf6a7('0xd7')])[_0xf6a7('0x82')]({'secret':![]})[_0xf6a7('0x31')](function(_0x557f8e){if(_0x557f8e[_0xf6a7('0xd6')]){var _0x5a4c00=path['join'](_0x56c7ac,_0x557f8e['Attachment'][_0xf6a7('0xe5')]);if(fs[_0xf6a7('0xe6')](_0x5a4c00)){fs['createReadStream'](_0x5a4c00)['pipe'](fs[_0xf6a7('0xe7')](path[_0xf6a7('0xcd')](_0x234f4f,_0x557f8e[_0xf6a7('0xd6')][_0xf6a7('0xe5')])));}}return{'date':moment(_0x557f8e[_0xf6a7('0x78')])[_0xf6a7('0xde')](_0xf6a7('0xc4'))[_0xf6a7('0x99')](),'sender':_0x557f8e[_0xf6a7('0xd8')]==='out'?_0x557f8e['User']?_0x557f8e['User'][_0xf6a7('0x32')]:'System':_0x557f8e[_0xf6a7('0x65')][_0xf6a7('0xd4')]+(_0x557f8e[_0xf6a7('0x65')]['lastName']?'\x20'+_0x557f8e['Contact'][_0xf6a7('0xd5')]:''),'body':_0x557f8e[_0xf6a7('0xd6')]?_0x557f8e['Attachment'][_0xf6a7('0xe5')]:_0x557f8e['body'],'direction':_0x557f8e[_0xf6a7('0xd8')]===_0xf6a7('0xe8')?'A':'C','secret':_0x557f8e[_0xf6a7('0xd9')],'read':_0x557f8e[_0xf6a7('0x7e')],'attachment':_0x557f8e['Attachment']};})[_0xf6a7('0x61')]()};return ejs[_0xf6a7('0xe9')](path[_0xf6a7('0xcd')](config['root'],_0xf6a7('0xcf'),'views',_0xf6a7('0xea')),{'interaction':_0x3fdc36})['then'](function(_0x5a4769){var _0x3d75bf=path['join'](_0x234f4f,_0xf6a7('0xeb')+_0x4d7e61['id']+'-'+_0x4416c7+_0xf6a7('0xec'));var _0x582fb7={'path':_0x3d75bf,'channel':_0xf6a7('0xed'),'interactionId':_0x4d7e61['id']};return pdf[_0xf6a7('0xee')](_0x5a4769,_0x582fb7);})[_0xf6a7('0x2a')](function(){return new BPromise(function(_0x46e8de,_0x4a376d){zipdir(_0x234f4f,{'saveTo':_0x536c04},function(_0x115cdc,_0x5091d7){if(_0x115cdc)return _0x4a376d(_0x115cdc);return _0x46e8de(_0x5091d7);});})['then'](function(){return new BPromise(function(_0x258665,_0x472fb3){rimraf(_0x234f4f,function(_0x525d14){if(_0x525d14)_0x472fb3(_0x525d14);return _0x258665();});});})[_0xf6a7('0x2a')](function(){return _0x5c42e3['download'](_0x536c04,_0x5bd9c5,function(_0x5a2c2d){if(_0x5a2c2d){console[_0xf6a7('0xef')](_0xf6a7('0xf0'),_0x5a2c2d);}else{fs[_0xf6a7('0xf1')](_0x536c04);}});});});}else{return _0x5c42e3['sendStatus'](0xc8);}})[_0xf6a7('0x38')](handleError(_0x5c42e3,null));}; \ No newline at end of file +var _0xee56=['it.OpenchannelInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','where','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.from\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','Sequelize','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','resolve','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','agent','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','keyBy','OpenchannelInteraction','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','show','from','includeAll','include','merge','options','catch','create','body','describe','OpenchannelMessage','params','addMessage','ids','omit','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','emit','openchannelInteractionTags:save','removeTags','unix','join','server','root','files','attachments','transcript-%d-%s.zip','User','CmContact','firstName','Attachment','Messages','direction','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','closed','closedAt','disposition','threadId','Public','Private','pipe','createWriteStream','out','System','lastName','basename','transcript-','.pdf','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','index','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','tools_tags','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','u.id\x20=\x20ui.UserId','openchannel_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','openchannel_accounts','openchannel_interaction_has_tags'];(function(_0x39b9b3,_0x3e9a66){var _0x4977c8=function(_0x2610c9){while(--_0x2610c9){_0x39b9b3['push'](_0x39b9b3['shift']());}};_0x4977c8(++_0x3e9a66);}(_0xee56,0x17b));var _0x6ee5=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0xee56[_0xd1c39b];return _0x58f5bc;};'use strict';var emlformat=require(_0x6ee5('0x0'));var rimraf=require(_0x6ee5('0x1'));var zipdir=require(_0x6ee5('0x2'));var jsonpatch=require(_0x6ee5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6ee5('0x4'));var Mustache=require(_0x6ee5('0x5'));var util=require('util');var path=require(_0x6ee5('0x6'));var sox=require('sox');var csv=require(_0x6ee5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6ee5('0x8'));var crypto=require(_0x6ee5('0x9'));var jsforce=require(_0x6ee5('0xa'));var deskjs=require(_0x6ee5('0xb'));var toCsv=require(_0x6ee5('0x7'));var querystring=require(_0x6ee5('0xc'));var Papa=require(_0x6ee5('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ee5('0xe'));var as=require(_0x6ee5('0xf'));var pdf=require(_0x6ee5('0x10'));var hardwareService=require(_0x6ee5('0x11'));var logger=require(_0x6ee5('0x12'))(_0x6ee5('0x13'));var utils=require('../../config/utils');var config=require(_0x6ee5('0x14'));var licenseUtil=require(_0x6ee5('0x15'));var db=require(_0x6ee5('0x16'))['db'];config[_0x6ee5('0x17')]=_[_0x6ee5('0x18')](config['redis'],{'host':_0x6ee5('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6ee5('0x17')]));require(_0x6ee5('0x1a'))[_0x6ee5('0x1b')](socket);function respondWithStatusCode(_0x1803ba,_0x208445){_0x208445=_0x208445||0xcc;return function(_0xf55d28){if(_0xf55d28){return _0x1803ba[_0x6ee5('0x1c')](_0x208445);}return _0x1803ba[_0x6ee5('0x1d')](_0x208445)['end']();};}function respondWithResult(_0x350dcc,_0x34d24c){_0x34d24c=_0x34d24c||0xc8;return function(_0x3c7c86){if(_0x3c7c86){return _0x350dcc[_0x6ee5('0x1d')](_0x34d24c)[_0x6ee5('0x1e')](_0x3c7c86);}};}function respondWithFilteredResult(_0xe92497,_0x44c8b2){return function(_0x556d21){if(_0x556d21){var _0x5bfbfc=typeof _0x44c8b2[_0x6ee5('0x1f')]===_0x6ee5('0x20')&&typeof _0x44c8b2[_0x6ee5('0x21')]===_0x6ee5('0x20');var _0x40e716=_0x556d21['count'];var _0x290c75=_0x5bfbfc?0x0:_0x44c8b2[_0x6ee5('0x1f')];var _0x1c773d=_0x5bfbfc?_0x556d21[_0x6ee5('0x22')]:_0x44c8b2[_0x6ee5('0x1f')]+_0x44c8b2['limit'];var _0x16dd70;if(_0x1c773d>=_0x40e716){_0x1c773d=_0x40e716;_0x16dd70=0xc8;}else{_0x16dd70=0xce;}_0xe92497[_0x6ee5('0x1d')](_0x16dd70);return _0xe92497['set'](_0x6ee5('0x23'),_0x290c75+'-'+_0x1c773d+'/'+_0x40e716)['json'](_0x556d21);}return null;};}function patchUpdates(_0x22a50f){return function(_0x12b799){try{jsonpatch[_0x6ee5('0x24')](_0x12b799,_0x22a50f,!![]);}catch(_0x218b0a){return BPromise[_0x6ee5('0x25')](_0x218b0a);}return _0x12b799[_0x6ee5('0x26')]();};}function saveUpdates(_0x37b4d3,_0x1289d5){return function(_0x45bb74){if(_0x45bb74){return _0x45bb74[_0x6ee5('0x27')](_0x37b4d3)[_0x6ee5('0x28')](function(_0x52805d){return _0x52805d;});}return null;};}function removeEntity(_0x4fa1e5,_0x2ea7a1){return function(_0x483b5e){if(_0x483b5e){return _0x483b5e[_0x6ee5('0x29')]()[_0x6ee5('0x28')](function(){_0x4fa1e5[_0x6ee5('0x1d')](0xcc)[_0x6ee5('0x2a')]();});}};}function handleEntityNotFound(_0x45e47c,_0x12d7a3){return function(_0x5293b9){if(!_0x5293b9){_0x45e47c['sendStatus'](0x194);}return _0x5293b9;};}function handleError(_0x1aa610,_0x4b617c){_0x4b617c=_0x4b617c||0x1f4;return function(_0x55ad83){logger[_0x6ee5('0x2b')](_0x55ad83[_0x6ee5('0x2c')]);if(_0x55ad83[_0x6ee5('0x2d')]){delete _0x55ad83[_0x6ee5('0x2d')];}_0x1aa610['status'](_0x4b617c)[_0x6ee5('0x2e')](_0x55ad83);};}function getInteractionUsers(_0xefaa29,_0x1fdeef){return new BPromise(function(_0x492283,_0x25b2d6){try{if(_0x1fdeef[_0xefaa29['id']]){_0xefaa29[_0x6ee5('0x2f')]=_[_0x6ee5('0x30')](_0x1fdeef[_0xefaa29['id']],function(_0x3d72de){return{'id':_0x3d72de['id'],'fullname':_0x3d72de[_0x6ee5('0x31')]};});}}catch(_0x4b2283){_0x25b2d6(_0x4b2283);}_0x492283(_0xefaa29);});}function getInteractionTags(_0x29cb61,_0xdab481){return new BPromise(function(_0x5ae9b4,_0x5cf5a8){try{if(_0x29cb61[_0x6ee5('0x32')]){_0x29cb61[_0x6ee5('0x33')]=[];_0x29cb61['TagIds'][_0x6ee5('0x34')](',')[_0x6ee5('0x35')](function(_0x2a76af){_0x29cb61[_0x6ee5('0x33')]['push'](_0xdab481[_0x2a76af]);});}delete _0x29cb61[_0x6ee5('0x32')];}catch(_0x310f57){_0x5cf5a8(_0x310f57);}_0x5ae9b4(_0x29cb61);});}function updateOpenchannelInteraction(_0x4f4ac7,_0xe0688a,_0x8f137e){return new BPromise(function(_0x315a96,_0x1ac2e9){return getInteractionUsers(_0x4f4ac7,_0x8f137e)['then'](function(_0x1f430f){return getInteractionTags(_0x1f430f,_0xe0688a);})['then'](function(_0x159871){_0x315a96(_0x159871);})['catch'](function(_0x540b55){_0x1ac2e9(_0x540b55);});});}exports[_0x6ee5('0x36')]=function(_0x56d17c,_0x8db6e1){var _0x7945c4={},_0x53f034={},_0x108ab7={'count':0x0,'rows':[]};var _0x55c9f7=_[_0x6ee5('0x30')](db['OpenchannelInteraction'][_0x6ee5('0x37')],function(_0x55810c){return{'name':_0x55810c[_0x6ee5('0x38')],'type':_0x55810c[_0x6ee5('0x39')][_0x6ee5('0x3a')]};});_0x53f034['model']=_[_0x6ee5('0x30')](_0x55c9f7,_0x6ee5('0x2d'));_0x53f034[_0x6ee5('0x3b')]=_[_0x6ee5('0x3c')](_0x56d17c[_0x6ee5('0x3b')]);_0x53f034[_0x6ee5('0x3d')]=_[_0x6ee5('0x3e')](_0x53f034[_0x6ee5('0x3f')],_0x53f034[_0x6ee5('0x3b')]);_0x7945c4[_0x6ee5('0x40')]=_['intersection'](_0x53f034[_0x6ee5('0x3f')],qs[_0x6ee5('0x41')](_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x41')]));_0x7945c4[_0x6ee5('0x40')]=_0x7945c4[_0x6ee5('0x40')][_0x6ee5('0x42')]?_0x7945c4[_0x6ee5('0x40')]:_0x53f034['model'];if(!_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x43')](_0x6ee5('0x44'))){_0x7945c4[_0x6ee5('0x21')]=qs[_0x6ee5('0x21')](_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x21')]);_0x7945c4[_0x6ee5('0x1f')]=qs[_0x6ee5('0x1f')](_0x56d17c['query'][_0x6ee5('0x1f')]);}_0x7945c4[_0x6ee5('0x45')]=qs['sort'](_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x46')]);_0x7945c4['where']=qs[_0x6ee5('0x3d')](_[_0x6ee5('0x47')](_0x56d17c[_0x6ee5('0x3b')],_0x53f034[_0x6ee5('0x3d')]),_0x55c9f7);var _0x2376f9=[];var _0x3dd909=squel[_0x6ee5('0x48')]()[_0x6ee5('0x49')]('id')[_0x6ee5('0x49')](_0x6ee5('0x2d'))['field'](_0x6ee5('0x4a'))['from'](_0x6ee5('0x4b'));var _0x385edd=squel['select']()[_0x6ee5('0x49')]('u.id')[_0x6ee5('0x49')](_0x6ee5('0x4c'))[_0x6ee5('0x49')](_0x6ee5('0x4d'))['from'](_0x6ee5('0x4e'),'ui')['left_join']('users','u',_0x6ee5('0x4f'));var _0x519590=squel[_0x6ee5('0x48')]()['from'](_0x6ee5('0x50'),'i')[_0x6ee5('0x51')](_0x6ee5('0x52'),'c',_0x6ee5('0x53'))[_0x6ee5('0x51')](_0x6ee5('0x54'),'o','o.id\x20=\x20i.UserId')[_0x6ee5('0x51')](_0x6ee5('0x55'),'a','a.id\x20=\x20i.OpenchannelAccountId')[_0x6ee5('0x51')]('openchannel_messages','me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x6ee5('0x51')](_0x6ee5('0x56'),'it',_0x6ee5('0x57'))[_0x6ee5('0x51')](_0x6ee5('0x4b'),'t',_0x6ee5('0x58'));var _0x1e243d=squel[_0x6ee5('0x59')]();var _0x1eb7de=[];var _0x14704a=squel[_0x6ee5('0x59')]();var _0x377f79;if(_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x5a')]){_0x377f79=as[_0x6ee5('0x5b')](_0x56d17c[_0x6ee5('0x3b')]['search']);var _0x1023eb=_0x377f79[_0x6ee5('0x5c')];for(var _0x467da1=0x0;_0x467da1<_0x377f79[_0x6ee5('0x5d')][_0x6ee5('0x42')];_0x467da1++){var _0x5aef10=_0x377f79[_0x6ee5('0x5d')][_0x467da1];var _0x5d2784='i';var _0x32a3d1=_['find'](_0x55c9f7,[_0x6ee5('0x2d'),_0x5aef10[_0x6ee5('0x49')]]);if(!_0x32a3d1){switch(_0x5aef10[_0x6ee5('0x49')]){case _0x6ee5('0x5e'):if(_0x5aef10[_0x6ee5('0x5f')]==0x1){_0x519590[_0x6ee5('0x60')]('`'+_0x5aef10[_0x6ee5('0x49')]+_0x6ee5('0x61'));}else{_0x519590[_0x6ee5('0x60')]('`'+_0x5aef10[_0x6ee5('0x49')]+_0x6ee5('0x62'));}break;case _0x6ee5('0x63'):if(_0x5aef10[_0x6ee5('0x64')]===_0x6ee5('0x65')){if(_0x5aef10[_0x6ee5('0x5f')][_0x6ee5('0x34')]('\x20')[_0x6ee5('0x42')]>0x1){_0x1e243d[_0x1023eb](_0x6ee5('0x66'),qs[_0x6ee5('0x67')](_0x5aef10[_0x6ee5('0x5f')]),null);}else{var _0x214b23='%'+_0x5aef10[_0x6ee5('0x5f')]+'%';_0x1e243d[_0x1023eb]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x214b23,_0x214b23,_0x214b23);}}else{_0x32a3d1=_[_0x6ee5('0x68')](_0x55c9f7,[_0x6ee5('0x2d'),_0x6ee5('0x69')]);_0x5aef10[_0x6ee5('0x49')]='ContactId';_0x50706b=as[_0x6ee5('0x6a')](_0x5d2784,_0x32a3d1[_0x6ee5('0x39')],_0x5aef10);_0x1e243d[_0x1023eb](_0x50706b[_0x6ee5('0x6b')],_0x50706b['value'][_0x6ee5('0x6c')],_0x50706b[_0x6ee5('0x5f')][_0x6ee5('0x2a')]);}break;case _0x6ee5('0x6d'):var _0x1c70fa=_0x5aef10['value']['split'](',')[_0x6ee5('0x30')](function(_0x2f637e){return Number(_0x2f637e);});_0x1c70fa[_0x6ee5('0x35')](function(_0x1bbf98){_0x14704a['or'](_0x6ee5('0x6e'),'%,'+_0x1bbf98+',%');});_0x1eb7de=_[_0x6ee5('0x6f')](_0x1eb7de,_0x1c70fa);break;case'User':if(_0x5aef10['operator']===_0x6ee5('0x65')){_0x1e243d[_0x1023eb](_0x6ee5('0x70'),'%'+_0x5aef10['value']+'%',null);}else{_0x32a3d1=_[_0x6ee5('0x68')](_0x55c9f7,[_0x6ee5('0x2d'),_0x6ee5('0x71')]);_0x5aef10[_0x6ee5('0x49')]=_0x6ee5('0x71');_0x50706b=as['buildExpression'](_0x5d2784,_0x32a3d1[_0x6ee5('0x39')],_0x5aef10);_0x1e243d[_0x1023eb](_0x50706b[_0x6ee5('0x6b')],_0x50706b[_0x6ee5('0x5f')][_0x6ee5('0x6c')],_0x50706b[_0x6ee5('0x5f')][_0x6ee5('0x2a')]);}break;case'body':_0x50706b=as['buildExpression']('me',null,_0x5aef10);_0x1e243d[_0x1023eb](_0x50706b['text'],_0x50706b[_0x6ee5('0x5f')][_0x6ee5('0x6c')],_0x50706b['value'][_0x6ee5('0x2a')]);break;}}else{var _0x50706b=as[_0x6ee5('0x6a')](_0x5d2784,_0x32a3d1[_0x6ee5('0x39')],_0x5aef10);_0x1e243d[_0x1023eb](_0x50706b[_0x6ee5('0x6b')],_0x50706b['value'][_0x6ee5('0x6c')],_0x50706b['value'][_0x6ee5('0x2a')]);}}}else{var _0x420064=_(_0x56d17c[_0x6ee5('0x3b')])[_0x6ee5('0x3c')]()[_0x6ee5('0x30')](function(_0x4bb286){return _[_0x6ee5('0x72')](_0x55c9f7,[_0x6ee5('0x2d'),_0x4bb286])?_0x4bb286:undefined;})['compact']()[_0x6ee5('0x5f')]();if(!_[_0x6ee5('0x73')](_0x420064)){_0x420064[_0x6ee5('0x35')](function(_0x4dba25){if(_0x4dba25===_0x6ee5('0x74')){_0x519590['where'](_0x6ee5('0x75'),[][_0x6ee5('0x76')](_0x56d17c[_0x6ee5('0x3b')][_0x4dba25]));}else if(_0x4dba25===_0x6ee5('0x77')){var _0x4500f1=JSON[_0x6ee5('0x78')](_0x56d17c['query'][_0x4dba25])['$gte'];var _0x272b1c=JSON[_0x6ee5('0x78')](_0x56d17c[_0x6ee5('0x3b')][_0x4dba25])[_0x6ee5('0x79')];_0x519590['where'](_0x6ee5('0x7a'),_0x4500f1,_0x272b1c);}else{if(_0x56d17c[_0x6ee5('0x3b')][_0x4dba25]==='null'){_0x519590[_0x6ee5('0x7b')]('i.'+_0x4dba25+'\x20IS\x20NULL');}else{_0x519590[_0x6ee5('0x7b')]('i.'+_0x4dba25+_0x6ee5('0x7c'),_0x56d17c[_0x6ee5('0x3b')][_0x4dba25]);}}});}if(_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x7d')]){if(_0x56d17c['query'][_0x6ee5('0x7d')]==0x1){_0x519590[_0x6ee5('0x60')]('`unreadMessages`\x20=\x200');}else{_0x519590[_0x6ee5('0x60')](_0x6ee5('0x7e'));}}if(_0x56d17c['query'][_0x6ee5('0x7f')]){_0x1eb7de=_['isArray'](_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x7f')])?_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x7f')]:new Array(_0x56d17c['query']['tag']);_0x1eb7de[_0x6ee5('0x35')](function(_0x17f20b){_0x14704a['or'](_0x6ee5('0x6e'),'%,'+_0x17f20b+',%');});}if(_0x56d17c['query'][_0x6ee5('0x80')]){var _0x3a8d9a=_0x56d17c[_0x6ee5('0x3b')]['filter'][_0x6ee5('0x81')]('\x5c','\x5c\x5c')[_0x6ee5('0x81')](/'/g,'\x27\x27');if(qs[_0x6ee5('0x82')](_0x3a8d9a)){_0x1e243d['or']('i.id\x20LIKE\x20?',_0x3a8d9a+'%');}else{_0x1e243d['or'](_0x6ee5('0x83'),qs[_0x6ee5('0x67')](_0x3a8d9a))['or'](_0x6ee5('0x84'),_0x3a8d9a+'%')['or'](_0x6ee5('0x85'),_0x3a8d9a+'%');}}}_0x519590[_0x6ee5('0x7b')](_0x1e243d);_0x519590['group'](_0x6ee5('0x86'));var _0x495c4b={'type':db[_0x6ee5('0x87')]['QueryTypes']['SELECT'],'raw':!![]};var _0x53185=_0x519590['clone']();_0x53185[_0x6ee5('0x49')](_0x6ee5('0x86'));_0x53185[_0x6ee5('0x49')](_0x6ee5('0x88'),'unreadMessages');if(_0x7945c4[_0x6ee5('0x45')]){_0x7945c4[_0x6ee5('0x45')][_0x6ee5('0x35')](function(_0x306d15){var _0xc172d8=_0x306d15[0x0]===_0x6ee5('0x89')?_0x306d15[0x0]:'i.'+_0x306d15[0x0];_0x519590[_0x6ee5('0x45')](_0xc172d8,_0x306d15[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x1eb7de)){_0x519590['having'](_0x14704a);_0x53185[_0x6ee5('0x7b')]('t.id\x20IN\x20?',_0x1eb7de);}BPromise[_0x6ee5('0x8a')]()[_0x6ee5('0x28')](function(){if(!_0x377f79){if(_0x56d17c[_0x6ee5('0x3b')]['OpenchannelAccountId'])return;_0x53185[_0x6ee5('0x7b')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x519590[_0x6ee5('0x7b')](_0x6ee5('0x8b'));return;}if(_0x56d17c[_0x6ee5('0x8c')][_0x6ee5('0x8d')]!==_0x6ee5('0x8e'))return;return _0x56d17c[_0x6ee5('0x8c')]['getOpenchannelAccounts']({'attributes':['id'],'raw':!![]})['then'](function(_0x138f93){if(_[_0x6ee5('0x73')](_0x138f93)){_0x53185['where'](_0x6ee5('0x8f'));_0x519590[_0x6ee5('0x7b')](_0x6ee5('0x8f'));}else{_0x53185[_0x6ee5('0x7b')](_0x6ee5('0x75'),_['map'](_0x138f93,'id'));_0x519590[_0x6ee5('0x7b')](_0x6ee5('0x75'),_[_0x6ee5('0x30')](_0x138f93,'id'));}});})[_0x6ee5('0x28')](function(){if(_0x56d17c[_0x6ee5('0x8c')]['role']==='agent'&&!_0x377f79&&!_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x74')])return[];return db[_0x6ee5('0x90')][_0x6ee5('0x3b')](_0x53185[_0x6ee5('0x91')](),_0x495c4b);})[_0x6ee5('0x28')](function(_0x3c3c0c){_0x108ab7[_0x6ee5('0x22')]=_0x3c3c0c['length'];if(_0x108ab7[_0x6ee5('0x22')]===0x0)return[];return db[_0x6ee5('0x90')][_0x6ee5('0x3b')](_0x3dd909[_0x6ee5('0x91')](),_0x495c4b)[_0x6ee5('0x28')](function(_0x3a7313){_0x2376f9=_[_0x6ee5('0x92')](_0x3a7313,'id');_0x495c4b=_['merge'](_0x495c4b,{'model':db[_0x6ee5('0x93')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56d17c[_0x6ee5('0x3b')][_0x6ee5('0x41')]){_0x7945c4[_0x6ee5('0x40')]['forEach'](function(_0x31cfaf){_0x519590[_0x6ee5('0x49')]('i.'+_0x31cfaf);});}else{_0x519590[_0x6ee5('0x49')](_0x6ee5('0x88'),_0x6ee5('0x5e'));_0x519590[_0x6ee5('0x49')](_0x6ee5('0x94'),_0x6ee5('0x95'));_0x519590[_0x6ee5('0x49')](_0x6ee5('0x96'),_0x6ee5('0x97'));_0x519590[_0x6ee5('0x49')]('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',_0x6ee5('0x89'));_0x519590[_0x6ee5('0x49')](_0x6ee5('0x98'));_0x519590[_0x6ee5('0x49')]('c.firstName','Contact.firstName');_0x519590[_0x6ee5('0x49')](_0x6ee5('0x99'),'Contact.lastName');_0x519590[_0x6ee5('0x49')](_0x6ee5('0x9a'),_0x6ee5('0x9b'));_0x519590['field'](_0x6ee5('0x9c'),'Contact.phone');_0x519590[_0x6ee5('0x49')](_0x6ee5('0x9d'),_0x6ee5('0x9e'));_0x519590[_0x6ee5('0x49')](_0x6ee5('0x9f'),_0x6ee5('0xa0'));_0x519590[_0x6ee5('0x49')](_0x6ee5('0xa1'),'Owner.fullname');_0x519590[_0x6ee5('0x49')](_0x6ee5('0xa2'),_0x6ee5('0xa3'));_0x519590[_0x6ee5('0x49')](_0x6ee5('0xa4'),'TagIds');}if(_0x7945c4[_0x6ee5('0x21')])_0x519590[_0x6ee5('0x21')](_0x7945c4['limit']);if(_0x7945c4[_0x6ee5('0x1f')])_0x519590[_0x6ee5('0x1f')](_0x7945c4['offset']);return db[_0x6ee5('0x90')][_0x6ee5('0x3b')](_0x519590[_0x6ee5('0x91')](),_0x495c4b);})[_0x6ee5('0x28')](function(_0x38e302){if(_0x38e302[_0x6ee5('0x42')]>0x0)_0x385edd[_0x6ee5('0x7b')](_0x6ee5('0xa5'),_[_0x6ee5('0x30')](_0x38e302,'id'));return db[_0x6ee5('0x90')][_0x6ee5('0x3b')](_0x385edd[_0x6ee5('0x91')](),_0x495c4b)[_0x6ee5('0x28')](function(_0x286f96){var _0xd8ea04=_[_0x6ee5('0xa6')](_0x286f96,_0x6ee5('0xa7'));var _0x44e841=[];_0x38e302[_0x6ee5('0x35')](function(_0x3d0d59){_0x44e841[_0x6ee5('0xa8')](updateOpenchannelInteraction(_0x3d0d59,_0x2376f9,_0xd8ea04));});return BPromise[_0x6ee5('0xa9')](_0x44e841);});});})[_0x6ee5('0x28')](function(_0x2f8861){_0x108ab7['rows']=_0x2f8861;return _0x108ab7;})['then'](respondWithFilteredResult(_0x8db6e1,_0x7945c4))['catch'](handleError(_0x8db6e1,null));};exports[_0x6ee5('0xaa')]=function(_0x43bb24,_0x3c0724){var _0x41ea91={};if(_0x43bb24[_0x6ee5('0x3b')][_0x6ee5('0x39')]&&_0x43bb24['query'][_0x6ee5('0x39')]===_0x6ee5('0xab')){_0x41ea91[_0x6ee5('0xab')]=_0x43bb24['params']['id'];}else{_0x41ea91['id']=_0x43bb24['params']['id'];}var _0x1b2567={'raw':![],'where':_0x41ea91},_0x436f80={};_0x436f80[_0x6ee5('0x3f')]=_[_0x6ee5('0x3c')](db[_0x6ee5('0x93')][_0x6ee5('0x37')]);_0x436f80[_0x6ee5('0x3b')]=_[_0x6ee5('0x3c')](_0x43bb24['query']);_0x436f80['filters']=_[_0x6ee5('0x3e')](_0x436f80['model'],_0x436f80['query']);_0x1b2567[_0x6ee5('0x40')]=_[_0x6ee5('0x3e')](_0x436f80[_0x6ee5('0x3f')],qs[_0x6ee5('0x41')](_0x43bb24[_0x6ee5('0x3b')][_0x6ee5('0x41')]));_0x1b2567[_0x6ee5('0x40')]=_0x1b2567[_0x6ee5('0x40')][_0x6ee5('0x42')]?_0x1b2567['attributes']:_0x436f80['model'];if(_0x43bb24[_0x6ee5('0x3b')][_0x6ee5('0xac')]){_0x1b2567[_0x6ee5('0xad')]=[{'all':!![]}];}_0x1b2567=_[_0x6ee5('0xae')]({},_0x1b2567,_0x43bb24[_0x6ee5('0xaf')]);return db[_0x6ee5('0x93')]['find'](_0x1b2567)[_0x6ee5('0x28')](handleEntityNotFound(_0x3c0724,null))['then'](respondWithResult(_0x3c0724,null))[_0x6ee5('0xb0')](handleError(_0x3c0724,null));};exports['create']=function(_0x184089,_0x211b90){return db['OpenchannelInteraction'][_0x6ee5('0xb1')](_0x184089[_0x6ee5('0xb2')],{})['then'](respondWithResult(_0x211b90,0xc9))[_0x6ee5('0xb0')](handleError(_0x211b90,null));};exports[_0x6ee5('0x27')]=function(_0x13cf58,_0x2cbebc){if(_0x13cf58[_0x6ee5('0xb2')]['id']){delete _0x13cf58[_0x6ee5('0xb2')]['id'];}return db[_0x6ee5('0x93')][_0x6ee5('0x68')]({'where':{'id':_0x13cf58['params']['id']}})[_0x6ee5('0x28')](handleEntityNotFound(_0x2cbebc,null))[_0x6ee5('0x28')](saveUpdates(_0x13cf58[_0x6ee5('0xb2')],null))[_0x6ee5('0x28')](respondWithResult(_0x2cbebc,null))[_0x6ee5('0xb0')](handleError(_0x2cbebc,null));};exports[_0x6ee5('0x29')]=function(_0x7e3642,_0x24f328){return db[_0x6ee5('0x93')][_0x6ee5('0x68')]({'where':{'id':_0x7e3642['params']['id']}})[_0x6ee5('0x28')](handleEntityNotFound(_0x24f328,null))[_0x6ee5('0x28')](removeEntity(_0x24f328,null))['catch'](handleError(_0x24f328,null));};exports['describe']=function(_0x32474b,_0x109bac){return db['OpenchannelInteraction'][_0x6ee5('0xb3')]()['then'](respondWithResult(_0x109bac,null))[_0x6ee5('0xb0')](handleError(_0x109bac,null));};exports['addMessage']=function(_0x44e68f,_0x3ca748,_0xb13bb8){return db[_0x6ee5('0xb4')]['find']({'where':{'id':_0x44e68f[_0x6ee5('0xb5')]['id']}})[_0x6ee5('0x28')](handleEntityNotFound(_0x3ca748,null))[_0x6ee5('0x28')](function(_0x5afb47){if(_0x5afb47){return _0x5afb47[_0x6ee5('0xb6')](_0x44e68f[_0x6ee5('0xb2')][_0x6ee5('0xb7')],_[_0x6ee5('0xb8')](_0x44e68f[_0x6ee5('0xb2')],[_0x6ee5('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x3ca748,null))[_0x6ee5('0xb0')](handleError(_0x3ca748,null));};exports[_0x6ee5('0xb9')]=function(_0x5befa8,_0x21e85c,_0x2aaef8){var _0x3c48da={'raw':![],'where':{}};var _0x251607={};var _0x991fc8={'count':0x0,'rows':[]};return db[_0x6ee5('0x93')][_0x6ee5('0xba')]({'where':{'id':_0x5befa8['params']['id']}})[_0x6ee5('0x28')](handleEntityNotFound(_0x21e85c,null))[_0x6ee5('0x28')](function(_0x111370){if(_0x111370){_0x251607[_0x6ee5('0x3f')]=_[_0x6ee5('0x3c')](db[_0x6ee5('0xb4')][_0x6ee5('0x37')]);_0x251607['query']=_['keys'](_0x5befa8[_0x6ee5('0x3b')]);_0x251607[_0x6ee5('0x3d')]=_[_0x6ee5('0x3e')](_0x251607[_0x6ee5('0x3f')],_0x251607[_0x6ee5('0x3b')]);_0x3c48da['attributes']=_['intersection'](_0x251607[_0x6ee5('0x3f')],qs[_0x6ee5('0x41')](_0x5befa8['query'][_0x6ee5('0x41')]));_0x3c48da[_0x6ee5('0x40')]=_0x3c48da['attributes']['length']?_0x3c48da['attributes']:_0x251607[_0x6ee5('0x3f')];if(!_0x5befa8['query'][_0x6ee5('0x43')](_0x6ee5('0x44'))){_0x3c48da[_0x6ee5('0x21')]=qs[_0x6ee5('0x21')](_0x5befa8[_0x6ee5('0x3b')][_0x6ee5('0x21')]);_0x3c48da['offset']=qs[_0x6ee5('0x1f')](_0x5befa8[_0x6ee5('0x3b')][_0x6ee5('0x1f')]);}_0x3c48da['order']=qs[_0x6ee5('0x46')](_0x5befa8[_0x6ee5('0x3b')][_0x6ee5('0x46')]);_0x3c48da[_0x6ee5('0x7b')]=qs[_0x6ee5('0x3d')](_[_0x6ee5('0x47')](_0x5befa8['query'],_0x251607[_0x6ee5('0x3d')]));_0x3c48da[_0x6ee5('0x7b')][_0x6ee5('0xa7')]=_0x111370['id'];if(_0x5befa8[_0x6ee5('0x3b')][_0x6ee5('0x80')]){_0x3c48da['where']=_[_0x6ee5('0xae')](_0x3c48da[_0x6ee5('0x7b')],{'$or':_[_0x6ee5('0x30')](_0x3c48da['attributes'],function(_0x35bfbd){var _0x2c48e7={};_0x2c48e7[_0x35bfbd]={'$like':'%'+_0x5befa8[_0x6ee5('0x3b')][_0x6ee5('0x80')]+'%'};return _0x2c48e7;})});}if(_0x5befa8[_0x6ee5('0x3b')]['$gte']){var _0x3b9ead=_0x5befa8[_0x6ee5('0x3b')][_0x6ee5('0xbb')]['split'](',');var _0x2d5aff={};_0x2d5aff[_0x3b9ead[0x0]]={'$gte':moment(_0x3b9ead[0x1])[_0x6ee5('0xbc')](_0x6ee5('0xbd'))};_0x3c48da['where']=_[_0x6ee5('0xae')](_0x3c48da[_0x6ee5('0x7b')],_0x2d5aff);}_0x3c48da=_['merge']({},_0x3c48da,_0x5befa8[_0x6ee5('0xaf')]);return db[_0x6ee5('0xb4')]['count']({'where':_0x3c48da['where']})['then'](function(_0x428277){_0x991fc8[_0x6ee5('0x22')]=_0x428277;if(_0x5befa8[_0x6ee5('0x3b')][_0x6ee5('0xac')]){_0x3c48da[_0x6ee5('0xad')]=[{'all':!![]}];}return db[_0x6ee5('0xb4')][_0x6ee5('0xbe')](_0x3c48da);})[_0x6ee5('0x28')](function(_0x25ffc5){_0x991fc8[_0x6ee5('0xbf')]=_0x25ffc5;return _0x991fc8;});}})[_0x6ee5('0x28')](respondWithFilteredResult(_0x21e85c,_0x3c48da))['catch'](handleError(_0x21e85c,null));};exports[_0x6ee5('0xc0')]=function(_0x383514,_0x221c08,_0x6149f7){return db[_0x6ee5('0x93')]['find']({'where':{'id':_0x383514[_0x6ee5('0xb5')]['id']}})[_0x6ee5('0x28')](handleEntityNotFound(_0x221c08,null))['then'](function(_0x2145f5){if(_0x2145f5){return _0x2145f5['setTags'](_0x383514[_0x6ee5('0xb2')][_0x6ee5('0xb7')],_[_0x6ee5('0xb8')](_0x383514[_0x6ee5('0xb2')],['ids','id'])||{})['spread'](function(){return db[_0x6ee5('0x6d')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x383514[_0x6ee5('0xb2')][_0x6ee5('0xb7')]}});})[_0x6ee5('0x28')](function(_0x24c0bd){socket[_0x6ee5('0xc1')](_0x6ee5('0xc2'),{'id':Number(_0x383514[_0x6ee5('0xb5')]['id']),'tags':_0x24c0bd||[]});return{'id':Number(_0x383514[_0x6ee5('0xb5')]['id']),'tags':_0x24c0bd||[]};});}})[_0x6ee5('0x28')](respondWithResult(_0x221c08,null))['catch'](handleError(_0x221c08,null));};exports['removeTags']=function(_0x38b793,_0x593b49,_0x5e6693){return db[_0x6ee5('0x93')][_0x6ee5('0x68')]({'where':{'id':_0x38b793[_0x6ee5('0xb5')]['id']}})[_0x6ee5('0x28')](handleEntityNotFound(_0x593b49,null))[_0x6ee5('0x28')](function(_0x22f604){if(_0x22f604){return _0x22f604[_0x6ee5('0xc3')](_0x38b793[_0x6ee5('0x3b')][_0x6ee5('0xb7')]);}})[_0x6ee5('0x28')](respondWithStatusCode(_0x593b49,null))[_0x6ee5('0xb0')](handleError(_0x593b49,null));};exports['download']=function(_0x3d33e6,_0x362174){var _0x3ecddb=moment()[_0x6ee5('0xc4')]()[_0x6ee5('0x91')]();var _0x1edef5=path[_0x6ee5('0xc5')](config['root'],_0x6ee5('0xc6'),'files','tmp');var _0x4ad1c7=path[_0x6ee5('0xc5')](config[_0x6ee5('0xc7')],_0x6ee5('0xc6'),_0x6ee5('0xc8'),_0x6ee5('0xc9'));var _0x46a032=path[_0x6ee5('0xc5')](_0x1edef5,_0x3ecddb);var _0x206d01=util['format'](_0x6ee5('0xca'),_0x3d33e6[_0x6ee5('0xb5')]['id'],_0x3ecddb);var _0x526c08=path['join'](_0x1edef5,_0x206d01);var _0x420aa6=[];_0x420aa6['push']({'model':db[_0x6ee5('0xcb')],'as':_0x6ee5('0xcb'),'attributes':['id',_0x6ee5('0x31')],'raw':!![]});_0x420aa6['push']({'model':db[_0x6ee5('0xcc')],'as':_0x6ee5('0x63'),'attributes':['id',_0x6ee5('0xcd'),'lastName'],'raw':!![]});if(_0x3d33e6['query']['attachments']){_0x420aa6[_0x6ee5('0xa8')]({'model':db[_0x6ee5('0xce')],'as':_0x6ee5('0xce'),'raw':!![]});}var _0x183a96=[{'model':db[_0x6ee5('0xb4')],'as':_0x6ee5('0xcf'),'attributes':['id',_0x6ee5('0xb2'),'createdAt',_0x6ee5('0xd0'),'secret','read'],'include':_0x420aa6}];_0x183a96[_0x6ee5('0xa8')]({'model':db[_0x6ee5('0xd1')],'as':_0x6ee5('0xd2'),'attributes':['id','name']});_0x183a96['push']({'model':db[_0x6ee5('0xcb')],'as':'Owner','attributes':['id',_0x6ee5('0x31')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x3d33e6[_0x6ee5('0xb5')]['id']},'include':_0x183a96})[_0x6ee5('0x28')](handleEntityNotFound(_0x362174,null))[_0x6ee5('0x28')](function(_0x1b6b12){if(_0x1b6b12){var _0x189f01=_0x1b6b12['get']({'plain':!![]});fs[_0x6ee5('0xd3')](_0x46a032);var _0x12b4c3={'channel':_0x6ee5('0xd4'),'account':_0x189f01[_0x6ee5('0xd2')][_0x6ee5('0x2d')],'agent':_0x189f01['Owner']?_0x189f01[_0x6ee5('0xd5')]['fullname']:_0x6ee5('0xd6'),'createdAt':moment(_0x189f01[_0x6ee5('0x77')])[_0x6ee5('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x189f01[_0x6ee5('0xd7')]?moment(_0x189f01[_0x6ee5('0xd8')])[_0x6ee5('0xbc')](_0x6ee5('0xbd'))[_0x6ee5('0x91')]():'','disposition':_0x189f01[_0x6ee5('0xd9')],'visibility':_0x189f01[_0x6ee5('0xda')]?_0x6ee5('0xdb'):_0x6ee5('0xdc'),'messages':_(_0x189f01[_0x6ee5('0xcf')])[_0x6ee5('0x80')]({'secret':![]})['map'](function(_0xeaa0c8){if(_0xeaa0c8[_0x6ee5('0xce')]){var _0x56c2a0=path[_0x6ee5('0xc5')](_0x4ad1c7,_0xeaa0c8[_0x6ee5('0xce')]['basename']);if(fs['existsSync'](_0x56c2a0)){fs['createReadStream'](_0x56c2a0)[_0x6ee5('0xdd')](fs[_0x6ee5('0xde')](path['join'](_0x46a032,_0xeaa0c8[_0x6ee5('0xce')]['basename'])));}}return{'date':moment(_0xeaa0c8[_0x6ee5('0x77')])[_0x6ee5('0xbc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x6ee5('0x91')](),'sender':_0xeaa0c8['direction']===_0x6ee5('0xdf')?_0xeaa0c8[_0x6ee5('0xcb')]?_0xeaa0c8[_0x6ee5('0xcb')]['fullname']:_0x6ee5('0xe0'):_0xeaa0c8[_0x6ee5('0x63')][_0x6ee5('0xcd')]+(_0xeaa0c8[_0x6ee5('0x63')][_0x6ee5('0xe1')]?'\x20'+_0xeaa0c8[_0x6ee5('0x63')][_0x6ee5('0xe1')]:''),'body':_0xeaa0c8[_0x6ee5('0xce')]?_0xeaa0c8[_0x6ee5('0xce')][_0x6ee5('0xe2')]:_0xeaa0c8['body'],'direction':_0xeaa0c8[_0x6ee5('0xd0')]===_0x6ee5('0xdf')?'A':'C','secret':_0xeaa0c8['secret'],'read':_0xeaa0c8['read'],'attachment':_0xeaa0c8[_0x6ee5('0xce')]};})['value']()};return ejs['renderFile'](path['join'](config[_0x6ee5('0xc7')],_0x6ee5('0xc6'),'views','downloadInteraction.ejs'),{'interaction':_0x12b4c3})['then'](function(_0x3e6b2e){var _0x329bcc=path[_0x6ee5('0xc5')](_0x46a032,_0x6ee5('0xe3')+_0x189f01['id']+'-'+_0x3ecddb+_0x6ee5('0xe4'));var _0xae0281={'path':_0x329bcc,'channel':_0x6ee5('0xd4'),'interactionId':_0x189f01['id']};return pdf['createPdfFromHTML'](_0x3e6b2e,_0xae0281);})[_0x6ee5('0x28')](function(){return new BPromise(function(_0x251823,_0x1575da){zipdir(_0x46a032,{'saveTo':_0x526c08},function(_0x471adb,_0x53b018){if(_0x471adb)return _0x1575da(_0x471adb);return _0x251823(_0x53b018);});})[_0x6ee5('0x28')](function(){return new BPromise(function(_0x374db1,_0xb7703f){rimraf(_0x46a032,function(_0x552ad8){if(_0x552ad8)_0xb7703f(_0x552ad8);return _0x374db1();});});})[_0x6ee5('0x28')](function(){return _0x362174[_0x6ee5('0xe5')](_0x526c08,_0x206d01,function(_0xbcb566){if(_0xbcb566){console[_0x6ee5('0xe6')](_0x6ee5('0xe7'),_0xbcb566);}else{fs[_0x6ee5('0xe8')](_0x526c08);}});});});}else{return _0x362174['sendStatus'](0xc8);}})[_0x6ee5('0xb0')](handleError(_0x362174,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 9ee5b02..1211d98 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 _0xb1b4=['then','Users','findAll','setDataValue','length','emit','hasOwnProperty','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','update','remove','getUsers'];(function(_0xde8a36,_0x41fc00){var _0x368b00=function(_0x1def55){while(--_0x1def55){_0xde8a36['push'](_0xde8a36['shift']());}};_0x368b00(++_0x41fc00);}(_0xb1b4,0x190));var _0x4b1b=function(_0x4848cd,_0x3d9895){_0x4848cd=_0x4848cd-0x0;var _0x261a1d=_0xb1b4[_0x4848cd];return _0x261a1d;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x4b1b('0x0'))['db'][_0x4b1b('0x1')];var OpenchannelMessage=require(_0x4b1b('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4b1b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4b1b('0x3'),'afterDestroy':_0x4b1b('0x4')};function emitEvent(_0x1d5131){return function(_0x11991a,_0x2c73af,_0x4e7f0b){_0x11991a[_0x4b1b('0x5')]({'attributes':['id'],'raw':!![]})[_0x4b1b('0x6')](function(_0x809cfd){_0x11991a['setDataValue'](_0x4b1b('0x7'),_0x809cfd['map'](function(_0x29df71){return{'id':_0x29df71['id']};}));return OpenchannelMessage[_0x4b1b('0x8')]({'where':{'OpenchannelInteractionId':_0x11991a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4b1b('0x6')](function(_0x24ece5){_0x11991a[_0x4b1b('0x9')]('unreadMessages',_0x24ece5[_0x4b1b('0xa')]);OpenchannelInteractionEvents[_0x4b1b('0xb')](_0x1d5131+':'+_0x11991a['id'],_0x11991a);OpenchannelInteractionEvents['emit'](_0x1d5131,_0x11991a);_0x4e7f0b(null);})['catch'](_0x4e7f0b(null));};}for(var e in events){if(events[_0x4b1b('0xc')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x4b1b('0xd')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe1a5=['save','update','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x2e4a84,_0x3de6e1){var _0x16ffe8=function(_0x43382f){while(--_0x43382f){_0x2e4a84['push'](_0x2e4a84['shift']());}};_0x16ffe8(++_0x3de6e1);}(_0xe1a5,0x67));var _0x5e1a=function(_0x3289ae,_0x341236){_0x3289ae=_0x3289ae-0x0;var _0xc9317=_0xe1a5[_0x3289ae];return _0xc9317;};'use strict';var EventEmitter=require(_0x5e1a('0x0'));var OpenchannelInteraction=require(_0x5e1a('0x1'))['db'][_0x5e1a('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0x5e1a('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x5e1a('0x4')](0x0);var events={'afterCreate':_0x5e1a('0x5'),'afterUpdate':_0x5e1a('0x6'),'afterDestroy':_0x5e1a('0x7')};function emitEvent(_0x50dd07){return function(_0x25a09a,_0x5a5a15,_0x4902a7){_0x25a09a[_0x5e1a('0x8')]({'attributes':['id'],'raw':!![]})[_0x5e1a('0x9')](function(_0x582cd7){_0x25a09a[_0x5e1a('0xa')](_0x5e1a('0xb'),_0x582cd7[_0x5e1a('0xc')](function(_0x5f4c27){return{'id':_0x5f4c27['id']};}));return OpenchannelMessage[_0x5e1a('0xd')]({'where':{'OpenchannelInteractionId':_0x25a09a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x56eb71){_0x25a09a[_0x5e1a('0xa')]('unreadMessages',_0x56eb71[_0x5e1a('0xe')]);OpenchannelInteractionEvents[_0x5e1a('0xf')](_0x50dd07+':'+_0x25a09a['id'],_0x25a09a);OpenchannelInteractionEvents['emit'](_0x50dd07,_0x25a09a);_0x4902a7(null);})['catch'](_0x4902a7(null));};}for(var e in events){if(events[_0x5e1a('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x5e1a('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c079b36..6cb2513 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 _0x3fc6=['exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2688d5,_0x45db72){var _0x372637=function(_0x51c20d){while(--_0x51c20d){_0x2688d5['push'](_0x2688d5['shift']());}};_0x372637(++_0x45db72);}(_0x3fc6,0x115));var _0x63fc=function(_0x418879,_0x5788dc){_0x418879=_0x418879-0x0;var _0x1071e3=_0x3fc6[_0x418879];return _0x1071e3;};'use strict';var _=require(_0x63fc('0x0'));var util=require('util');var logger=require(_0x63fc('0x1'))(_0x63fc('0x2'));var moment=require(_0x63fc('0x3'));var BPromise=require(_0x63fc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x63fc('0x5'));var rimraf=require(_0x63fc('0x6'));var config=require(_0x63fc('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0x63fc('0x8')]=function(_0x4ed9a1,_0x2c9b0b){return _0x4ed9a1[_0x63fc('0x9')](_0x63fc('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x63fc('0xb'),'collate':_0x63fc('0xc'),'hooks':{'beforeUpdate':function(_0x144c55,_0x31e20c,_0x32749b){if(_0x144c55['changed'](_0x63fc('0xd'))){_0x144c55['closedAt']=moment()['format'](_0x63fc('0xe'));}_0x32749b(null,_0x144c55);}}});}; \ No newline at end of file +var _0xbfd2=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closed','format'];(function(_0x30be46,_0x4c635e){var _0x3bc011=function(_0x219f89){while(--_0x219f89){_0x30be46['push'](_0x30be46['shift']());}};_0x3bc011(++_0x4c635e);}(_0xbfd2,0x1d4));var _0x2bfd=function(_0x543b02,_0x2994c5){_0x543b02=_0x543b02-0x0;var _0x5748c4=_0xbfd2[_0x543b02];return _0x5748c4;};'use strict';var _=require(_0x2bfd('0x0'));var util=require(_0x2bfd('0x1'));var logger=require(_0x2bfd('0x2'))(_0x2bfd('0x3'));var moment=require(_0x2bfd('0x4'));var BPromise=require(_0x2bfd('0x5'));var rp=require(_0x2bfd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x4c396f,_0x343987){return _0x4c396f['define'](_0x2bfd('0x7'),attributes,{'tableName':_0x2bfd('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2bfd('0x9'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x5b3cc2,_0x33ec37,_0x40cdc4){if(_0x5b3cc2[_0x2bfd('0xa')](_0x2bfd('0xb'))){_0x5b3cc2['closedAt']=moment()[_0x2bfd('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x40cdc4(null,_0x5b3cc2);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 7673ce5..5d28ea3 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 _0x5651=['../../config/logger','rpc','../../config/environment','client','http','defaults','redis','socket.io-emitter','request','then','request\x20sent','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','info','result','catch','OpenchannelInteraction','body','options','raw','where','attributes','limit','debug','UpdateOpenchannelInteraction','stringify','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','bluebird','ioredis'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x5651,0x12c));var _0x1565=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x5651[_0x3ccdf8];return _0x243dab;};'use strict';var _=require(_0x1565('0x0'));var util=require(_0x1565('0x1'));var moment=require('moment');var BPromise=require(_0x1565('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1565('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1565('0x4'))(_0x1565('0x5'));var config=require(_0x1565('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1565('0x7')][_0x1565('0x8')]({'port':0x232a});config['redis']=_[_0x1565('0x9')](config[_0x1565('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1565('0xb'))(new Redis(config[_0x1565('0xa')]));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x1ae8a2,_0x493794,_0x5a1dd8){return new BPromise(function(_0x324766,_0xa872fd){return client[_0x1565('0xc')](_0x1ae8a2,_0x5a1dd8)[_0x1565('0xd')](function(_0x2db0ad){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x493794,_0x1565('0xe'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x493794,_0x1565('0xe'),JSON['stringify'](_0x2db0ad));if(_0x2db0ad[_0x1565('0xf')]){if(_0x2db0ad[_0x1565('0xf')][_0x1565('0x10')]===0x1f4){logger[_0x1565('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x493794,_0x2db0ad['error']['message']);return _0xa872fd(_0x2db0ad[_0x1565('0xf')][_0x1565('0x11')]);}logger[_0x1565('0xf')](_0x1565('0x12'),_0x493794,_0x2db0ad[_0x1565('0xf')][_0x1565('0x11')]);return _0x324766(_0x2db0ad[_0x1565('0xf')][_0x1565('0x11')]);}else{logger[_0x1565('0x13')](_0x1565('0x12'),_0x493794,'request\x20sent');_0x324766(_0x2db0ad[_0x1565('0x14')][_0x1565('0x11')]);}})[_0x1565('0x15')](function(_0x513cd5){logger[_0x1565('0xf')](_0x1565('0x12'),_0x493794,_0x513cd5);_0xa872fd(_0x513cd5);});});}exports['UpdateOpenchannelInteraction']=function(_0xd62402){var _0x588918=this;return new Promise(function(_0x40c613,_0x44017d){return db[_0x1565('0x16')]['update'](_0xd62402[_0x1565('0x17')],{'raw':_0xd62402[_0x1565('0x18')]?_0xd62402[_0x1565('0x18')][_0x1565('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd62402[_0x1565('0x18')]?_0xd62402['options'][_0x1565('0x1a')]||null:null,'attributes':_0xd62402[_0x1565('0x18')]?_0xd62402[_0x1565('0x18')][_0x1565('0x1b')]||null:null,'limit':_0xd62402['options']?_0xd62402['options'][_0x1565('0x1c')]||null:null})[_0x1565('0xd')](function(_0x2456f2){logger[_0x1565('0x13')]('UpdateOpenchannelInteraction',_0xd62402);logger[_0x1565('0x1d')](_0x1565('0x1e'),_0xd62402,JSON[_0x1565('0x1f')](_0x2456f2));_0x40c613(_0x2456f2);})[_0x1565('0x15')](function(_0x164620){logger['error']('UpdateOpenchannelInteraction',_0x164620['message'],_0xd62402);_0x44017d(_0x588918[_0x1565('0xf')](0x1f4,_0x164620[_0x1565('0x11')]));});});};exports[_0x1565('0x20')]=function(_0x10c8ec){return new Promise(function(_0x1b6eb2,_0x4f2ec2){return db[_0x1565('0x16')][_0x1565('0x21')]({'where':_0x10c8ec[_0x1565('0x18')]?_0x10c8ec[_0x1565('0x18')]['where']||null:null})[_0x1565('0xd')](function(_0x425919){if(_0x425919){return _0x425919[_0x1565('0x22')](_0x10c8ec['body'][_0x1565('0x23')],_[_0x1565('0x24')](_0x10c8ec[_0x1565('0x17')],[_0x1565('0x23'),'id'])||{});}})['spread'](function(_0x2be5b5){logger['info']('AddTags',_0x10c8ec);logger[_0x1565('0x1d')](_0x1565('0x25'),_0x10c8ec,JSON[_0x1565('0x1f')](_0x2be5b5));_0x1b6eb2(_0x2be5b5);})[_0x1565('0x15')](function(_0xb961f0){logger[_0x1565('0xf')](_0x1565('0x25'),_0xb961f0[_0x1565('0x11')],_0x10c8ec);_0x4f2ec2(_this[_0x1565('0xf')](0x1f4,_0xb961f0['message']));});});}; \ No newline at end of file +var _0x4d69=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','update','body','options','raw','attributes','limit','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','where','addTags','omit','ids','AddTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4d69,0xcd));var _0x94d6=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x4d69[_0x44946b];return _0x249bc4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x94d6('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94d6('0x1'));var db=require(_0x94d6('0x2'))['db'];var utils=require(_0x94d6('0x3'));var logger=require(_0x94d6('0x4'))(_0x94d6('0x5'));var config=require(_0x94d6('0x6'));var jayson=require(_0x94d6('0x7'));var client=jayson[_0x94d6('0x8')][_0x94d6('0x9')]({'port':0x232a});config[_0x94d6('0xa')]=_[_0x94d6('0xb')](config[_0x94d6('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x94d6('0xc'))(new Redis(config[_0x94d6('0xa')]));require(_0x94d6('0xd'))['register'](socket);function respondWithRpcPromise(_0x156d6a,_0x18d65b,_0x541b85){return new BPromise(function(_0x1f0895,_0xb0352c){return client[_0x94d6('0xe')](_0x156d6a,_0x541b85)[_0x94d6('0xf')](function(_0xf1e946){logger['info'](_0x94d6('0x10'),_0x18d65b,'request\x20sent');logger[_0x94d6('0x11')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x18d65b,_0x94d6('0x12'),JSON[_0x94d6('0x13')](_0xf1e946));if(_0xf1e946['error']){if(_0xf1e946[_0x94d6('0x14')][_0x94d6('0x15')]===0x1f4){logger['error'](_0x94d6('0x10'),_0x18d65b,_0xf1e946[_0x94d6('0x14')][_0x94d6('0x16')]);return _0xb0352c(_0xf1e946[_0x94d6('0x14')][_0x94d6('0x16')]);}logger[_0x94d6('0x14')](_0x94d6('0x10'),_0x18d65b,_0xf1e946[_0x94d6('0x14')][_0x94d6('0x16')]);return _0x1f0895(_0xf1e946[_0x94d6('0x14')]['message']);}else{logger[_0x94d6('0x17')](_0x94d6('0x10'),_0x18d65b,'request\x20sent');_0x1f0895(_0xf1e946[_0x94d6('0x18')][_0x94d6('0x16')]);}})['catch'](function(_0xcef187){logger[_0x94d6('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x18d65b,_0xcef187);_0xb0352c(_0xcef187);});});}exports['UpdateOpenchannelInteraction']=function(_0x3466aa){var _0x12256e=this;return new Promise(function(_0x1ff71f,_0x2e9789){return db['OpenchannelInteraction'][_0x94d6('0x19')](_0x3466aa[_0x94d6('0x1a')],{'raw':_0x3466aa[_0x94d6('0x1b')]?_0x3466aa[_0x94d6('0x1b')][_0x94d6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3466aa['options']?_0x3466aa[_0x94d6('0x1b')]['where']||null:null,'attributes':_0x3466aa['options']?_0x3466aa['options'][_0x94d6('0x1d')]||null:null,'limit':_0x3466aa['options']?_0x3466aa['options'][_0x94d6('0x1e')]||null:null})[_0x94d6('0xf')](function(_0x5acf9c){logger[_0x94d6('0x17')](_0x94d6('0x1f'),_0x3466aa);logger[_0x94d6('0x11')]('UpdateOpenchannelInteraction',_0x3466aa,JSON['stringify'](_0x5acf9c));_0x1ff71f(_0x5acf9c);})[_0x94d6('0x20')](function(_0x24698d){logger[_0x94d6('0x14')](_0x94d6('0x1f'),_0x24698d[_0x94d6('0x16')],_0x3466aa);_0x2e9789(_0x12256e[_0x94d6('0x14')](0x1f4,_0x24698d[_0x94d6('0x16')]));});});};exports[_0x94d6('0x21')]=function(_0x1bc317){return new Promise(function(_0x247a1b,_0x415a57){return db[_0x94d6('0x22')][_0x94d6('0x23')]({'where':_0x1bc317[_0x94d6('0x1b')]?_0x1bc317[_0x94d6('0x1b')][_0x94d6('0x24')]||null:null})[_0x94d6('0xf')](function(_0x1d0015){if(_0x1d0015){return _0x1d0015[_0x94d6('0x25')](_0x1bc317['body']['ids'],_[_0x94d6('0x26')](_0x1bc317[_0x94d6('0x1a')],[_0x94d6('0x27'),'id'])||{});}})['spread'](function(_0x3b1da1){logger[_0x94d6('0x17')](_0x94d6('0x28'),_0x1bc317);logger['debug']('AddTags',_0x1bc317,JSON[_0x94d6('0x13')](_0x3b1da1));_0x247a1b(_0x3b1da1);})['catch'](function(_0x446e61){logger[_0x94d6('0x14')](_0x94d6('0x28'),_0x446e61[_0x94d6('0x16')],_0x1bc317);_0x415a57(_this[_0x94d6('0x14')](0x1f4,_0x446e61[_0x94d6('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 3c705db..478f1f4 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 _0xc37c=['register','openchannelInteraction:','./openchannelInteraction.events','remove','update','emit'];(function(_0x3ad617,_0x2083a9){var _0x1e4914=function(_0x26a74b){while(--_0x26a74b){_0x3ad617['push'](_0x3ad617['shift']());}};_0x1e4914(++_0x2083a9);}(_0xc37c,0x1b2));var _0xcc37=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xc37c[_0x29b609];return _0x54c952;};'use strict';var OpenchannelInteractionEvents=require(_0xcc37('0x0'));var events=['save',_0xcc37('0x1'),_0xcc37('0x2')];function createListener(_0x51f389,_0x38d0f2){return function(_0x1d1a2f){_0x38d0f2[_0xcc37('0x3')](_0x51f389,_0x1d1a2f);};}function removeListener(_0x3b5ef3,_0x195eb8){return function(){OpenchannelInteractionEvents['removeListener'](_0x3b5ef3,_0x195eb8);};}exports[_0xcc37('0x4')]=function(_0x2ca1b1){for(var _0xd8aaf5=0x0,_0x363b9f=events['length'];_0xd8aaf5<_0x363b9f;_0xd8aaf5++){var _0x138bcf=events[_0xd8aaf5];var _0x40b26f=createListener(_0xcc37('0x5')+_0x138bcf,_0x2ca1b1);OpenchannelInteractionEvents['on'](_0x138bcf,_0x40b26f);}}; \ No newline at end of file +var _0xa5c5=['emit','removeListener','register','length','openchannelInteraction:','save','remove','update'];(function(_0x3c21c7,_0x44c3be){var _0xbcfd0d=function(_0x33e407){while(--_0x33e407){_0x3c21c7['push'](_0x3c21c7['shift']());}};_0xbcfd0d(++_0x44c3be);}(_0xa5c5,0x1cd));var _0x5a5c=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa5c5[_0x502c7d];return _0x30b7ed;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x5a5c('0x0'),_0x5a5c('0x1'),_0x5a5c('0x2')];function createListener(_0x41865e,_0x4f4dc0){return function(_0x1ff9b7){_0x4f4dc0[_0x5a5c('0x3')](_0x41865e,_0x1ff9b7);};}function removeListener(_0x597654,_0x1bb10b){return function(){OpenchannelInteractionEvents[_0x5a5c('0x4')](_0x597654,_0x1bb10b);};}exports[_0x5a5c('0x5')]=function(_0x577fe8){for(var _0x53955e=0x0,_0x492207=events[_0x5a5c('0x6')];_0x53955e<_0x492207;_0x53955e++){var _0x5d0ce8=events[_0x53955e];var _0x15ff1f=createListener(_0x5a5c('0x7')+_0x5d0ce8,_0x577fe8);OpenchannelInteractionEvents['on'](_0x5d0ce8,_0x15ff1f);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8edcb9d..3efebb3 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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x4d14dd,_0x376031){_0x4d14dd=_0x4d14dd-0x0;var _0x502a00=_0x70e0[_0x4d14dd];return _0x502a00;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x244dc0,_0x251af7){var _0xfc4ad=function(_0x4b9163){while(--_0x4b9163){_0x244dc0['push'](_0x244dc0['shift']());}};_0xfc4ad(++_0x251af7);}(_0x9c44,0x178));var _0x49c4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x9c44[_0x4b369d];return _0x571a98;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 2e4dfc3..0ceda54 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 _0xcf66=['exports','TEXT','BOOLEAN','out','DATE','sequelize'];(function(_0x5b082b,_0x2b4233){var _0x11b7eb=function(_0x5b487a){while(--_0x5b487a){_0x5b082b['push'](_0x5b082b['shift']());}};_0x11b7eb(++_0x2b4233);}(_0xcf66,0x71));var _0x6cf6=function(_0x369d2d,_0x38dfca){_0x369d2d=_0x369d2d-0x0;var _0x4d9400=_0xcf66[_0x369d2d];return _0x4d9400;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'body':{'type':Sequelize[_0x6cf6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x6cf6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x6cf6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x6cf6('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x6cf6('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x6cf6('0x2')]}}; \ No newline at end of file +var _0x4b6c=['TEXT','sequelize','exports','medium','BOOLEAN','out','DATE'];(function(_0x1b36ef,_0x229735){var _0x13899e=function(_0x1ae5f5){while(--_0x1ae5f5){_0x1b36ef['push'](_0x1b36ef['shift']());}};_0x13899e(++_0x229735);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b6('0x0'));module[_0xc4b6('0x1')]={'body':{'type':Sequelize['TEXT'](_0xc4b6('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc4b6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc4b6('0x4')),'defaultValue':_0xc4b6('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc4b6('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xc4b6('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index e89fabf..ad40955 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 _0xd717=['body','describe','../../config/logger','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','manual','interface','channel','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','SIP/%s','event','rejectmessage','eml-format','rimraf','fast-json-patch','bluebird','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','name','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','create'];(function(_0x4b5b86,_0x23c37a){var _0xd965ac=function(_0x51f2cb){while(--_0x51f2cb){_0x4b5b86['push'](_0x4b5b86['shift']());}};_0xd965ac(++_0x23c37a);}(_0xd717,0x1b1));var _0x7d71=function(_0x5d1c61,_0x1d4425){_0x5d1c61=_0x5d1c61-0x0;var _0x584a20=_0xd717[_0x5d1c61];return _0x584a20;};'use strict';var emlformat=require(_0x7d71('0x0'));var rimraf=require(_0x7d71('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7d71('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7d71('0x3'));var Mustache=require('mustache');var util=require(_0x7d71('0x4'));var path=require(_0x7d71('0x5'));var sox=require('sox');var csv=require(_0x7d71('0x6'));var ejs=require(_0x7d71('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d71('0x8'));var squel=require(_0x7d71('0x9'));var crypto=require('crypto');var jsforce=require(_0x7d71('0xa'));var deskjs=require(_0x7d71('0xb'));var toCsv=require(_0x7d71('0x6'));var querystring=require(_0x7d71('0xc'));var Papa=require(_0x7d71('0xd'));var Redis=require('ioredis');var authService=require(_0x7d71('0xe'));var qs=require(_0x7d71('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7d71('0x10'));var logger=require('../../config/logger')(_0x7d71('0x11'));var utils=require(_0x7d71('0x12'));var config=require(_0x7d71('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x7d71('0x14')]=_[_0x7d71('0x15')](config[_0x7d71('0x14')],{'host':_0x7d71('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d71('0x14')]));require('./openchannelMessage.socket')[_0x7d71('0x17')](socket);var jayson=require(_0x7d71('0x18'));var client=jayson[_0x7d71('0x19')][_0x7d71('0x1a')]({'port':0x232c});var client9002=jayson[_0x7d71('0x19')][_0x7d71('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x591dd1,_0x55029c,_0xb56c15,_0x3ae197){return new BPromise(function(_0x491e61,_0x17fc48){var _0x54b076=_0x3ae197||client;return _0x54b076[_0x7d71('0x1b')](_0x591dd1,_0xb56c15)[_0x7d71('0x1c')](function(_0x5759a8){logger[_0x7d71('0x1d')](_0x7d71('0x1e'),_0x55029c,_0x7d71('0x1f'));logger[_0x7d71('0x20')](_0x7d71('0x21'),_0x55029c,_0x7d71('0x1f'),JSON[_0x7d71('0x22')](_0x5759a8));if(_0x5759a8[_0x7d71('0x23')]){if(_0x5759a8[_0x7d71('0x23')][_0x7d71('0x24')]===0x1f4){logger[_0x7d71('0x23')](_0x7d71('0x1e'),_0x55029c,_0x5759a8['error']['message']);return _0x17fc48(_0x5759a8[_0x7d71('0x23')][_0x7d71('0x25')]);}logger[_0x7d71('0x23')]('OpenchannelMessage,\x20%s,\x20%s',_0x55029c,_0x5759a8[_0x7d71('0x23')][_0x7d71('0x25')]);return _0x491e61(_0x5759a8[_0x7d71('0x23')][_0x7d71('0x25')]);}else{logger[_0x7d71('0x1d')]('OpenchannelMessage,\x20%s,\x20%s',_0x55029c,_0x7d71('0x1f'));_0x491e61(_0x5759a8[_0x7d71('0x26')][_0x7d71('0x25')]);}})[_0x7d71('0x27')](function(_0x26bc65){logger[_0x7d71('0x23')](_0x7d71('0x1e'),_0x55029c,_0x26bc65);_0x17fc48(_0x26bc65);});});}function respondWithStatusCode(_0xb82db3,_0x897fa2){_0x897fa2=_0x897fa2||0xcc;return function(_0x494ca7){if(_0x494ca7){return _0xb82db3[_0x7d71('0x28')](_0x897fa2);}return _0xb82db3[_0x7d71('0x29')](_0x897fa2)['end']();};}function respondWithResult(_0x50a87a,_0x75b455){_0x75b455=_0x75b455||0xc8;return function(_0x3f4d8a){if(_0x3f4d8a){return _0x50a87a[_0x7d71('0x29')](_0x75b455)['json'](_0x3f4d8a);}};}function respondWithFilteredResult(_0x39607f,_0x3a9442){return function(_0x43e38f){if(_0x43e38f){var _0x31c88f=typeof _0x3a9442[_0x7d71('0x2a')]===_0x7d71('0x2b')&&typeof _0x3a9442[_0x7d71('0x2c')]===_0x7d71('0x2b');var _0x56eecb=_0x43e38f[_0x7d71('0x2d')];var _0xc8bbec=_0x31c88f?0x0:_0x3a9442[_0x7d71('0x2a')];var _0x1ec6e0=_0x31c88f?_0x43e38f[_0x7d71('0x2d')]:_0x3a9442[_0x7d71('0x2a')]+_0x3a9442['limit'];var _0x1a436b;if(_0x1ec6e0>=_0x56eecb){_0x1ec6e0=_0x56eecb;_0x1a436b=0xc8;}else{_0x1a436b=0xce;}_0x39607f['status'](_0x1a436b);return _0x39607f[_0x7d71('0x2e')](_0x7d71('0x2f'),_0xc8bbec+'-'+_0x1ec6e0+'/'+_0x56eecb)[_0x7d71('0x30')](_0x43e38f);}return null;};}function patchUpdates(_0x464a4e){return function(_0x54463a){try{jsonpatch[_0x7d71('0x31')](_0x54463a,_0x464a4e,!![]);}catch(_0x20bef3){return BPromise[_0x7d71('0x32')](_0x20bef3);}return _0x54463a[_0x7d71('0x33')]();};}function saveUpdates(_0x30ddfc,_0x150892){return function(_0x1685bc){if(_0x1685bc){return _0x1685bc[_0x7d71('0x34')](_0x30ddfc)[_0x7d71('0x1c')](function(_0x4677d0){return _0x4677d0;});}return null;};}function removeEntity(_0x3eed0c,_0x4cd1f9){return function(_0x4b09a1){if(_0x4b09a1){return _0x4b09a1[_0x7d71('0x35')]()[_0x7d71('0x1c')](function(){_0x3eed0c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x55004c,_0x39528e){return function(_0x6479a8){if(!_0x6479a8){_0x55004c[_0x7d71('0x28')](0x194);}return _0x6479a8;};}function handleError(_0x26ae8c,_0x4b38ce){_0x4b38ce=_0x4b38ce||0x1f4;return function(_0xb5f1aa){logger[_0x7d71('0x23')](_0xb5f1aa['stack']);if(_0xb5f1aa[_0x7d71('0x36')]){delete _0xb5f1aa[_0x7d71('0x36')];}_0x26ae8c['status'](_0x4b38ce)['send'](_0xb5f1aa);};}exports[_0x7d71('0x37')]=function(_0x12bf3f,_0x3b7550){var _0x3b613a={},_0x31ddb7={},_0x51364c={'count':0x0,'rows':[]};var _0x210a29=_[_0x7d71('0x38')](db[_0x7d71('0x39')][_0x7d71('0x3a')],function(_0x4bc323){return{'name':_0x4bc323[_0x7d71('0x3b')],'type':_0x4bc323['type'][_0x7d71('0x3c')]};});_0x31ddb7[_0x7d71('0x3d')]=_[_0x7d71('0x38')](_0x210a29,_0x7d71('0x36'));_0x31ddb7[_0x7d71('0x3e')]=_[_0x7d71('0x3f')](_0x12bf3f[_0x7d71('0x3e')]);_0x31ddb7[_0x7d71('0x40')]=_[_0x7d71('0x41')](_0x31ddb7[_0x7d71('0x3d')],_0x31ddb7['query']);_0x3b613a[_0x7d71('0x42')]=_['intersection'](_0x31ddb7[_0x7d71('0x3d')],qs[_0x7d71('0x43')](_0x12bf3f[_0x7d71('0x3e')][_0x7d71('0x43')]));_0x3b613a[_0x7d71('0x42')]=_0x3b613a[_0x7d71('0x42')][_0x7d71('0x44')]?_0x3b613a[_0x7d71('0x42')]:_0x31ddb7[_0x7d71('0x3d')];if(!_0x12bf3f[_0x7d71('0x3e')][_0x7d71('0x45')](_0x7d71('0x46'))){_0x3b613a[_0x7d71('0x2c')]=qs[_0x7d71('0x2c')](_0x12bf3f[_0x7d71('0x3e')][_0x7d71('0x2c')]);_0x3b613a[_0x7d71('0x2a')]=qs['offset'](_0x12bf3f[_0x7d71('0x3e')][_0x7d71('0x2a')]);}_0x3b613a['order']=qs[_0x7d71('0x47')](_0x12bf3f[_0x7d71('0x3e')]['sort']);_0x3b613a[_0x7d71('0x48')]=qs[_0x7d71('0x40')](_[_0x7d71('0x49')](_0x12bf3f[_0x7d71('0x3e')],_0x31ddb7['filters']),_0x210a29);if(_0x12bf3f[_0x7d71('0x3e')][_0x7d71('0x4a')]){_0x3b613a['where']=_[_0x7d71('0x4b')](_0x3b613a['where'],{'$or':_[_0x7d71('0x38')](_0x210a29,function(_0x4ce24b){if(_0x4ce24b[_0x7d71('0x4c')]!==_0x7d71('0x4d')){var _0x9b77e={};_0x9b77e[_0x4ce24b[_0x7d71('0x36')]]={'$like':'%'+_0x12bf3f[_0x7d71('0x3e')]['filter']+'%'};return _0x9b77e;}})});}_0x3b613a=_[_0x7d71('0x4b')]({},_0x3b613a,_0x12bf3f[_0x7d71('0x4e')]);var _0x301190={'where':_0x3b613a[_0x7d71('0x48')]};return db[_0x7d71('0x39')][_0x7d71('0x2d')](_0x301190)[_0x7d71('0x1c')](function(_0xb5359d){_0x51364c[_0x7d71('0x2d')]=_0xb5359d;if(_0x12bf3f['query']['includeAll']){_0x3b613a[_0x7d71('0x4f')]=[{'all':!![]}];}return db[_0x7d71('0x39')][_0x7d71('0x50')](_0x3b613a);})['then'](function(_0x4ea613){_0x51364c[_0x7d71('0x51')]=_0x4ea613;return _0x51364c;})[_0x7d71('0x1c')](respondWithFilteredResult(_0x3b7550,_0x3b613a))[_0x7d71('0x27')](handleError(_0x3b7550,null));};exports[_0x7d71('0x52')]=function(_0x1e54dc,_0x29ed52){var _0x2b63a0={'raw':!![],'where':{'id':_0x1e54dc[_0x7d71('0x53')]['id']}},_0x311e4c={};_0x311e4c[_0x7d71('0x3d')]=_[_0x7d71('0x3f')](db['OpenchannelMessage']['rawAttributes']);_0x311e4c[_0x7d71('0x3e')]=_[_0x7d71('0x3f')](_0x1e54dc[_0x7d71('0x3e')]);_0x311e4c['filters']=_[_0x7d71('0x41')](_0x311e4c[_0x7d71('0x3d')],_0x311e4c[_0x7d71('0x3e')]);_0x2b63a0[_0x7d71('0x42')]=_['intersection'](_0x311e4c[_0x7d71('0x3d')],qs['fields'](_0x1e54dc[_0x7d71('0x3e')][_0x7d71('0x43')]));_0x2b63a0['attributes']=_0x2b63a0[_0x7d71('0x42')][_0x7d71('0x44')]?_0x2b63a0['attributes']:_0x311e4c['model'];if(_0x1e54dc['query'][_0x7d71('0x54')]){_0x2b63a0[_0x7d71('0x4f')]=[{'all':!![]}];}_0x2b63a0=_[_0x7d71('0x4b')]({},_0x2b63a0,_0x1e54dc[_0x7d71('0x4e')]);return db[_0x7d71('0x39')][_0x7d71('0x55')](_0x2b63a0)['then'](handleEntityNotFound(_0x29ed52,null))[_0x7d71('0x1c')](respondWithResult(_0x29ed52,null))[_0x7d71('0x27')](handleError(_0x29ed52,null));};exports[_0x7d71('0x56')]=function(_0x355ec1,_0x211c9c){return db[_0x7d71('0x39')][_0x7d71('0x56')](_0x355ec1['body'],{})['then'](respondWithResult(_0x211c9c,0xc9))['catch'](handleError(_0x211c9c,null));};exports[_0x7d71('0x34')]=function(_0x280f7e,_0x2213c0){if(_0x280f7e[_0x7d71('0x57')]['id']){delete _0x280f7e[_0x7d71('0x57')]['id'];}return db[_0x7d71('0x39')][_0x7d71('0x55')]({'where':{'id':_0x280f7e[_0x7d71('0x53')]['id']}})[_0x7d71('0x1c')](handleEntityNotFound(_0x2213c0,null))[_0x7d71('0x1c')](saveUpdates(_0x280f7e[_0x7d71('0x57')],null))[_0x7d71('0x1c')](respondWithResult(_0x2213c0,null))[_0x7d71('0x27')](handleError(_0x2213c0,null));};exports[_0x7d71('0x35')]=function(_0x3a0a55,_0x5988f5){return db[_0x7d71('0x39')][_0x7d71('0x55')]({'where':{'id':_0x3a0a55[_0x7d71('0x53')]['id']}})['then'](handleEntityNotFound(_0x5988f5,null))['then'](removeEntity(_0x5988f5,null))['catch'](handleError(_0x5988f5,null));};exports[_0x7d71('0x58')]=function(_0x545480,_0x4418ee){return db['OpenchannelMessage']['describe']()[_0x7d71('0x1c')](respondWithResult(_0x4418ee,null))[_0x7d71('0x27')](handleError(_0x4418ee,null));};var interaction_log=require(_0x7d71('0x59'))(_0x7d71('0x5a'));exports[_0x7d71('0x5b')]=function(_0x2d85c2,_0xd570e2,_0x5a4cbc){var _0xc3a924={'agent':{},'channel':_0x7d71('0x5c')};if(_0x2d85c2[_0x7d71('0x57')]['id']){delete _0x2d85c2[_0x7d71('0x57')]['id'];}_0x2d85c2[_0x7d71('0x57')][_0x7d71('0x5d')]=!![];_0x2d85c2['body'][_0x7d71('0x5e')]=moment()[_0x7d71('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d85c2[_0x7d71('0x57')][_0x7d71('0x60')]=_0x2d85c2[_0x7d71('0x57')][_0x7d71('0x60')]||_0x2d85c2[_0x7d71('0x61')]['id'];_0xc3a924[_0x7d71('0x62')]['id']=_0x2d85c2[_0x7d71('0x57')][_0x7d71('0x60')];return db['OpenchannelMessage'][_0x7d71('0x55')]({'where':{'id':_0x2d85c2[_0x7d71('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xd570e2,null))[_0x7d71('0x1c')](saveUpdates(_0x2d85c2[_0x7d71('0x57')],null))[_0x7d71('0x1c')](function(_0x16b449){if(_0x16b449){_0xc3a924[_0x7d71('0x25')]=_0x16b449[_0x7d71('0x63')]({'plain':!![]});return db[_0x7d71('0x64')]['find']({'where':{'id':_0x16b449[_0x7d71('0x65')]}});}return null;})[_0x7d71('0x1c')](handleEntityNotFound(_0xd570e2,null))[_0x7d71('0x1c')](function(_0x3d6e6c){if(_0x3d6e6c){return _0x3d6e6c[_0x7d71('0x34')]({'UserId':_0x2d85c2[_0x7d71('0x57')][_0x7d71('0x60')],'read1stAt':_[_0x7d71('0x66')](_0x3d6e6c[_0x7d71('0x67')])?moment()[_0x7d71('0x5f')](_0x7d71('0x68')):undefined});}return null;})['then'](function(_0xeb4223){if(_0xeb4223){_0xc3a924[_0x7d71('0x69')]=_0xeb4223[_0x7d71('0x63')]({'plain':!![]});interaction_log[_0x7d71('0x1d')](_0x7d71('0x6a'),_0x2d85c2[_0x7d71('0x61')]['id'],_0x2d85c2[_0x7d71('0x61')]['name'],_0x2d85c2['user'][_0x7d71('0x6b')],_0xc3a924[_0x7d71('0x69')]['id'],_0x2d85c2['body']?JSON[_0x7d71('0x22')](_0x2d85c2[_0x7d71('0x57')]):_0x7d71('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x7d71('0x6d'),_0xc3a924);}return null;})[_0x7d71('0x1c')](function(_0x320cdb){var _0x3762e8=_0x7d71('0x6e')+_0x320cdb[_0x7d71('0x25')]['ContactId'];return db[_0x7d71('0x6f')]['query'](_0x3762e8,{'type':db[_0x7d71('0x70')][_0x7d71('0x71')][_0x7d71('0x72')],'raw':!![]})[_0x7d71('0x1c')](function(_0xbf4529){return _0xbf4529;});})[_0x7d71('0x1c')](function(_0x5e1cd9){if(_0x5e1cd9){_0xc3a924[_0x7d71('0x25')]['contact']=_0x5e1cd9[0x0];if(!_0x2d85c2[_0x7d71('0x57')]['UserId'])return;return db[_0x7d71('0x73')][_0x7d71('0x55')]({'where':{'id':_0x2d85c2[_0x7d71('0x57')][_0x7d71('0x60')],'role':_0x7d71('0x62')},'attributes':['id',_0x7d71('0x36'),_0x7d71('0x74'),_0x7d71('0x75'),'internal'],'raw':!![]});}return null;})[_0x7d71('0x1c')](function(_0x4430e1){if(!_0x4430e1)return null;_0xc3a924['message'][_0x7d71('0x62')]=_0x4430e1;return _0xc3a924;})[_0x7d71('0x1c')](function(_0x1f9ef4){if(_0x1f9ef4){if(_0x2d85c2['body'][_0x7d71('0x76')]){_0xc3a924[_0x7d71('0x25')][_0x7d71('0x77')]=util[_0x7d71('0x5f')]('SIP/%s',_0x2d85c2[_0x7d71('0x61')][_0x7d71('0x36')]);_0xc3a924[_0x7d71('0x25')][_0x7d71('0x78')]=_0xc3a924['channel'];_0xc3a924[_0x7d71('0x25')]['event']='accept';return respondWithRpcPromise(_0x7d71('0x79'),_0x7d71('0x79'),{'event':_0x7d71('0x7a'),'message':_0xc3a924[_0x7d71('0x25')]},client9002)['then'](function(){return _0xc3a924;});}return _0xc3a924;}return null;})[_0x7d71('0x1c')](respondWithResult(_0xd570e2,null))[_0x7d71('0x27')](handleError(_0xd570e2,null));};var interaction_log=require('../../config/logger')(_0x7d71('0x5a'));exports[_0x7d71('0x32')]=function(_0x19bb27,_0x50a99b,_0x5cc35d){var _0x59a7a1={'agent':{},'channel':'openchannel'};if(_0x19bb27['body']['id']){delete _0x19bb27[_0x7d71('0x57')]['id'];}_0x19bb27[_0x7d71('0x57')][_0x7d71('0x60')]=_0x19bb27[_0x7d71('0x57')][_0x7d71('0x60')]||_0x19bb27[_0x7d71('0x61')]['id'];_0x59a7a1[_0x7d71('0x62')]['id']=_0x19bb27[_0x7d71('0x57')]['UserId'];return db[_0x7d71('0x39')][_0x7d71('0x55')]({'where':{'id':_0x19bb27['params']['id'],'UserId':null}})[_0x7d71('0x1c')](handleEntityNotFound(_0x50a99b,null))[_0x7d71('0x1c')](function(_0x435e78){if(_0x435e78){_0x59a7a1[_0x7d71('0x25')]=_0x435e78[_0x7d71('0x63')]({'plain':!![]});return db[_0x7d71('0x64')][_0x7d71('0x55')]({'where':{'id':_0x435e78[_0x7d71('0x65')]}});}return null;})[_0x7d71('0x1c')](handleEntityNotFound(_0x50a99b,null))[_0x7d71('0x1c')](function(_0x3cf4ee){if(_0x3cf4ee){_0x59a7a1[_0x7d71('0x69')]=_0x3cf4ee[_0x7d71('0x63')]({'plain':!![]});interaction_log[_0x7d71('0x1d')](_0x7d71('0x7b'),_0x19bb27['user']['id'],_0x19bb27[_0x7d71('0x61')]['name'],_0x19bb27[_0x7d71('0x61')][_0x7d71('0x6b')],_0x59a7a1[_0x7d71('0x69')]['id'],_0x19bb27[_0x7d71('0x57')]?JSON[_0x7d71('0x22')](_0x19bb27['body']):_0x7d71('0x6c'));return respondWithRpcPromise(_0x7d71('0x7c'),_0x7d71('0x7d'),_0x59a7a1);}return null;})[_0x7d71('0x1c')](function(_0x824851){var _0xfcb8c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x824851[_0x7d71('0x25')]['ContactId'];return db[_0x7d71('0x6f')]['query'](_0xfcb8c,{'type':db[_0x7d71('0x70')][_0x7d71('0x71')][_0x7d71('0x72')],'raw':!![]})[_0x7d71('0x1c')](function(_0x4e0894){return _0x4e0894;});})[_0x7d71('0x1c')](function(_0x3b44ca){if(_0x3b44ca){_0x59a7a1[_0x7d71('0x25')][_0x7d71('0x7e')]=_0x3b44ca[0x0];if(!_0x19bb27[_0x7d71('0x57')][_0x7d71('0x60')])return;return db[_0x7d71('0x73')][_0x7d71('0x55')]({'where':{'id':_0x19bb27[_0x7d71('0x57')][_0x7d71('0x60')],'role':_0x7d71('0x62')},'attributes':['id',_0x7d71('0x36'),_0x7d71('0x74'),_0x7d71('0x75'),'internal'],'raw':!![]});}return null;})[_0x7d71('0x1c')](function(_0x479d97){if(!_0x479d97)return null;_0x59a7a1[_0x7d71('0x25')][_0x7d71('0x62')]=_0x479d97;return _0x59a7a1;})[_0x7d71('0x1c')](function(_0x3847b9){if(_0x3847b9){_0x3847b9[_0x7d71('0x25')][_0x7d71('0x77')]=util[_0x7d71('0x5f')](_0x7d71('0x7f'),_0x19bb27['user'][_0x7d71('0x36')]);_0x3847b9[_0x7d71('0x25')][_0x7d71('0x78')]=_0x59a7a1[_0x7d71('0x78')];_0x3847b9[_0x7d71('0x25')][_0x7d71('0x80')]=_0x7d71('0x32');respondWithRpcPromise(_0x7d71('0x79'),_0x7d71('0x79'),{'event':_0x7d71('0x81'),'message':_0x3847b9[_0x7d71('0x25')]},client9002);return _0x59a7a1;}return null;})['then'](respondWithResult(_0x50a99b,null))['catch'](handleError(_0x50a99b,null));}; \ No newline at end of file +var _0xfd58=['findAll','rows','show','rawAttributes','length','include','create','body','find','params','describe','openchannel','read','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','format','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','register','jayson/promise','client','http','request','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','OpenchannelMessage','includeAll'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfd58,0xb3));var _0x8fd5=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfd58[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x8fd5('0x0'));var rimraf=require(_0x8fd5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8fd5('0x2'));var rp=require(_0x8fd5('0x3'));var moment=require('moment');var BPromise=require(_0x8fd5('0x4'));var Mustache=require(_0x8fd5('0x5'));var util=require(_0x8fd5('0x6'));var path=require(_0x8fd5('0x7'));var sox=require('sox');var csv=require(_0x8fd5('0x8'));var ejs=require(_0x8fd5('0x9'));var fs=require('fs');var fs_extra=require(_0x8fd5('0xa'));var _=require('lodash');var squel=require(_0x8fd5('0xb'));var crypto=require(_0x8fd5('0xc'));var jsforce=require(_0x8fd5('0xd'));var deskjs=require(_0x8fd5('0xe'));var toCsv=require(_0x8fd5('0x8'));var querystring=require('querystring');var Papa=require(_0x8fd5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8fd5('0x10'));var as=require(_0x8fd5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8fd5('0x12'))(_0x8fd5('0x13'));var utils=require('../../config/utils');var config=require(_0x8fd5('0x14'));var licenseUtil=require(_0x8fd5('0x15'));var db=require('../../mysqldb')['db'];config[_0x8fd5('0x16')]=_[_0x8fd5('0x17')](config[_0x8fd5('0x16')],{'host':_0x8fd5('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x8fd5('0x19')](socket);var jayson=require(_0x8fd5('0x1a'));var client=jayson[_0x8fd5('0x1b')][_0x8fd5('0x1c')]({'port':0x232c});var client9002=jayson[_0x8fd5('0x1b')][_0x8fd5('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x92ae7c,_0x3aa9e6,_0x2f18df,_0x10ec68){return new BPromise(function(_0x53b2dd,_0x418037){var _0x11b081=_0x10ec68||client;return _0x11b081[_0x8fd5('0x1d')](_0x92ae7c,_0x2f18df)['then'](function(_0x4e8e9d){logger['info'](_0x8fd5('0x1e'),_0x3aa9e6,_0x8fd5('0x1f'));logger[_0x8fd5('0x20')](_0x8fd5('0x21'),_0x3aa9e6,_0x8fd5('0x1f'),JSON['stringify'](_0x4e8e9d));if(_0x4e8e9d['error']){if(_0x4e8e9d[_0x8fd5('0x22')]['code']===0x1f4){logger[_0x8fd5('0x22')](_0x8fd5('0x1e'),_0x3aa9e6,_0x4e8e9d[_0x8fd5('0x22')][_0x8fd5('0x23')]);return _0x418037(_0x4e8e9d['error']['message']);}logger['error'](_0x8fd5('0x1e'),_0x3aa9e6,_0x4e8e9d['error'][_0x8fd5('0x23')]);return _0x53b2dd(_0x4e8e9d[_0x8fd5('0x22')][_0x8fd5('0x23')]);}else{logger[_0x8fd5('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x3aa9e6,_0x8fd5('0x1f'));_0x53b2dd(_0x4e8e9d[_0x8fd5('0x25')][_0x8fd5('0x23')]);}})[_0x8fd5('0x26')](function(_0xef4623){logger['error'](_0x8fd5('0x1e'),_0x3aa9e6,_0xef4623);_0x418037(_0xef4623);});});}function respondWithStatusCode(_0x34bf0c,_0x1f496d){_0x1f496d=_0x1f496d||0xcc;return function(_0x5b7d8c){if(_0x5b7d8c){return _0x34bf0c[_0x8fd5('0x27')](_0x1f496d);}return _0x34bf0c[_0x8fd5('0x28')](_0x1f496d)[_0x8fd5('0x29')]();};}function respondWithResult(_0x4ddd3b,_0x17928e){_0x17928e=_0x17928e||0xc8;return function(_0x370165){if(_0x370165){return _0x4ddd3b[_0x8fd5('0x28')](_0x17928e)[_0x8fd5('0x2a')](_0x370165);}};}function respondWithFilteredResult(_0x4cf930,_0x4676a3){return function(_0xf68ef5){if(_0xf68ef5){var _0x4906f1=typeof _0x4676a3[_0x8fd5('0x2b')]===_0x8fd5('0x2c')&&typeof _0x4676a3[_0x8fd5('0x2d')]===_0x8fd5('0x2c');var _0x14e816=_0xf68ef5[_0x8fd5('0x2e')];var _0x56fe65=_0x4906f1?0x0:_0x4676a3[_0x8fd5('0x2b')];var _0x2ce9c9=_0x4906f1?_0xf68ef5[_0x8fd5('0x2e')]:_0x4676a3['offset']+_0x4676a3[_0x8fd5('0x2d')];var _0x386b5c;if(_0x2ce9c9>=_0x14e816){_0x2ce9c9=_0x14e816;_0x386b5c=0xc8;}else{_0x386b5c=0xce;}_0x4cf930[_0x8fd5('0x28')](_0x386b5c);return _0x4cf930[_0x8fd5('0x2f')]('Content-Range',_0x56fe65+'-'+_0x2ce9c9+'/'+_0x14e816)['json'](_0xf68ef5);}return null;};}function patchUpdates(_0x48b3ca){return function(_0x484f76){try{jsonpatch[_0x8fd5('0x30')](_0x484f76,_0x48b3ca,!![]);}catch(_0x43fb14){return BPromise[_0x8fd5('0x31')](_0x43fb14);}return _0x484f76[_0x8fd5('0x32')]();};}function saveUpdates(_0x4b50cc,_0x147b35){return function(_0xd4d995){if(_0xd4d995){return _0xd4d995[_0x8fd5('0x33')](_0x4b50cc)[_0x8fd5('0x34')](function(_0x3e4d43){return _0x3e4d43;});}return null;};}function removeEntity(_0x479589,_0x2111e9){return function(_0x95eb7d){if(_0x95eb7d){return _0x95eb7d[_0x8fd5('0x35')]()[_0x8fd5('0x34')](function(){_0x479589[_0x8fd5('0x28')](0xcc)[_0x8fd5('0x29')]();});}};}function handleEntityNotFound(_0x22041f,_0x3653aa){return function(_0x3ef44d){if(!_0x3ef44d){_0x22041f[_0x8fd5('0x27')](0x194);}return _0x3ef44d;};}function handleError(_0x544b4b,_0x23203a){_0x23203a=_0x23203a||0x1f4;return function(_0x5502ee){logger[_0x8fd5('0x22')](_0x5502ee[_0x8fd5('0x36')]);if(_0x5502ee[_0x8fd5('0x37')]){delete _0x5502ee[_0x8fd5('0x37')];}_0x544b4b[_0x8fd5('0x28')](_0x23203a)[_0x8fd5('0x38')](_0x5502ee);};}exports['index']=function(_0x357ef7,_0x1ecd7d){var _0x58a9df={},_0x582967={},_0x4b8988={'count':0x0,'rows':[]};var _0xb5f3d1=_['map'](db['OpenchannelMessage']['rawAttributes'],function(_0x10b925){return{'name':_0x10b925[_0x8fd5('0x39')],'type':_0x10b925['type'][_0x8fd5('0x3a')]};});_0x582967[_0x8fd5('0x3b')]=_[_0x8fd5('0x3c')](_0xb5f3d1,_0x8fd5('0x37'));_0x582967[_0x8fd5('0x3d')]=_[_0x8fd5('0x3e')](_0x357ef7[_0x8fd5('0x3d')]);_0x582967[_0x8fd5('0x3f')]=_[_0x8fd5('0x40')](_0x582967[_0x8fd5('0x3b')],_0x582967[_0x8fd5('0x3d')]);_0x58a9df[_0x8fd5('0x41')]=_[_0x8fd5('0x40')](_0x582967[_0x8fd5('0x3b')],qs['fields'](_0x357ef7[_0x8fd5('0x3d')][_0x8fd5('0x42')]));_0x58a9df[_0x8fd5('0x41')]=_0x58a9df['attributes']['length']?_0x58a9df[_0x8fd5('0x41')]:_0x582967[_0x8fd5('0x3b')];if(!_0x357ef7[_0x8fd5('0x3d')][_0x8fd5('0x43')]('nolimit')){_0x58a9df[_0x8fd5('0x2d')]=qs['limit'](_0x357ef7[_0x8fd5('0x3d')][_0x8fd5('0x2d')]);_0x58a9df['offset']=qs[_0x8fd5('0x2b')](_0x357ef7[_0x8fd5('0x3d')][_0x8fd5('0x2b')]);}_0x58a9df['order']=qs[_0x8fd5('0x44')](_0x357ef7[_0x8fd5('0x3d')]['sort']);_0x58a9df[_0x8fd5('0x45')]=qs[_0x8fd5('0x3f')](_['pick'](_0x357ef7['query'],_0x582967[_0x8fd5('0x3f')]),_0xb5f3d1);if(_0x357ef7[_0x8fd5('0x3d')][_0x8fd5('0x46')]){_0x58a9df['where']=_[_0x8fd5('0x47')](_0x58a9df[_0x8fd5('0x45')],{'$or':_['map'](_0xb5f3d1,function(_0x4cc4a1){if(_0x4cc4a1[_0x8fd5('0x48')]!==_0x8fd5('0x49')){var _0x2c2c14={};_0x2c2c14[_0x4cc4a1[_0x8fd5('0x37')]]={'$like':'%'+_0x357ef7[_0x8fd5('0x3d')]['filter']+'%'};return _0x2c2c14;}})});}_0x58a9df=_['merge']({},_0x58a9df,_0x357ef7[_0x8fd5('0x4a')]);var _0x13c5c1={'where':_0x58a9df[_0x8fd5('0x45')]};return db[_0x8fd5('0x4b')][_0x8fd5('0x2e')](_0x13c5c1)[_0x8fd5('0x34')](function(_0x3d2329){_0x4b8988['count']=_0x3d2329;if(_0x357ef7[_0x8fd5('0x3d')][_0x8fd5('0x4c')]){_0x58a9df['include']=[{'all':!![]}];}return db[_0x8fd5('0x4b')][_0x8fd5('0x4d')](_0x58a9df);})['then'](function(_0x7d4a64){_0x4b8988[_0x8fd5('0x4e')]=_0x7d4a64;return _0x4b8988;})[_0x8fd5('0x34')](respondWithFilteredResult(_0x1ecd7d,_0x58a9df))[_0x8fd5('0x26')](handleError(_0x1ecd7d,null));};exports[_0x8fd5('0x4f')]=function(_0x1c26af,_0x22299b){var _0x4fd7dd={'raw':!![],'where':{'id':_0x1c26af['params']['id']}},_0x19a761={};_0x19a761[_0x8fd5('0x3b')]=_[_0x8fd5('0x3e')](db[_0x8fd5('0x4b')][_0x8fd5('0x50')]);_0x19a761['query']=_[_0x8fd5('0x3e')](_0x1c26af['query']);_0x19a761[_0x8fd5('0x3f')]=_[_0x8fd5('0x40')](_0x19a761[_0x8fd5('0x3b')],_0x19a761['query']);_0x4fd7dd[_0x8fd5('0x41')]=_[_0x8fd5('0x40')](_0x19a761[_0x8fd5('0x3b')],qs[_0x8fd5('0x42')](_0x1c26af[_0x8fd5('0x3d')][_0x8fd5('0x42')]));_0x4fd7dd[_0x8fd5('0x41')]=_0x4fd7dd[_0x8fd5('0x41')][_0x8fd5('0x51')]?_0x4fd7dd['attributes']:_0x19a761[_0x8fd5('0x3b')];if(_0x1c26af['query'][_0x8fd5('0x4c')]){_0x4fd7dd[_0x8fd5('0x52')]=[{'all':!![]}];}_0x4fd7dd=_[_0x8fd5('0x47')]({},_0x4fd7dd,_0x1c26af[_0x8fd5('0x4a')]);return db[_0x8fd5('0x4b')]['find'](_0x4fd7dd)['then'](handleEntityNotFound(_0x22299b,null))['then'](respondWithResult(_0x22299b,null))['catch'](handleError(_0x22299b,null));};exports['create']=function(_0x585f4b,_0x3d84eb){return db[_0x8fd5('0x4b')][_0x8fd5('0x53')](_0x585f4b['body'],{})[_0x8fd5('0x34')](respondWithResult(_0x3d84eb,0xc9))['catch'](handleError(_0x3d84eb,null));};exports[_0x8fd5('0x33')]=function(_0x3259d3,_0x34aa93){if(_0x3259d3['body']['id']){delete _0x3259d3[_0x8fd5('0x54')]['id'];}return db[_0x8fd5('0x4b')][_0x8fd5('0x55')]({'where':{'id':_0x3259d3[_0x8fd5('0x56')]['id']}})[_0x8fd5('0x34')](handleEntityNotFound(_0x34aa93,null))[_0x8fd5('0x34')](saveUpdates(_0x3259d3[_0x8fd5('0x54')],null))[_0x8fd5('0x34')](respondWithResult(_0x34aa93,null))[_0x8fd5('0x26')](handleError(_0x34aa93,null));};exports[_0x8fd5('0x35')]=function(_0x2bfc05,_0x144f13){return db[_0x8fd5('0x4b')][_0x8fd5('0x55')]({'where':{'id':_0x2bfc05[_0x8fd5('0x56')]['id']}})['then'](handleEntityNotFound(_0x144f13,null))[_0x8fd5('0x34')](removeEntity(_0x144f13,null))[_0x8fd5('0x26')](handleError(_0x144f13,null));};exports[_0x8fd5('0x57')]=function(_0x5293eb,_0x4dd1df){return db[_0x8fd5('0x4b')][_0x8fd5('0x57')]()['then'](respondWithResult(_0x4dd1df,null))['catch'](handleError(_0x4dd1df,null));};var interaction_log=require(_0x8fd5('0x12'))('openchannel-interactions');exports['accept']=function(_0x3f7915,_0x56a18c,_0x1d36a4){var _0x4f45e6={'agent':{},'channel':_0x8fd5('0x58')};if(_0x3f7915[_0x8fd5('0x54')]['id']){delete _0x3f7915[_0x8fd5('0x54')]['id'];}_0x3f7915[_0x8fd5('0x54')][_0x8fd5('0x59')]=!![];_0x3f7915['body']['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x3f7915[_0x8fd5('0x54')][_0x8fd5('0x5a')]=_0x3f7915[_0x8fd5('0x54')][_0x8fd5('0x5a')]||_0x3f7915[_0x8fd5('0x5b')]['id'];_0x4f45e6[_0x8fd5('0x5c')]['id']=_0x3f7915[_0x8fd5('0x54')][_0x8fd5('0x5a')];return db[_0x8fd5('0x4b')][_0x8fd5('0x55')]({'where':{'id':_0x3f7915[_0x8fd5('0x56')]['id'],'UserId':null}})[_0x8fd5('0x34')](handleEntityNotFound(_0x56a18c,null))['then'](saveUpdates(_0x3f7915[_0x8fd5('0x54')],null))['then'](function(_0x22f2d9){if(_0x22f2d9){_0x4f45e6[_0x8fd5('0x23')]=_0x22f2d9[_0x8fd5('0x5d')]({'plain':!![]});return db[_0x8fd5('0x5e')][_0x8fd5('0x55')]({'where':{'id':_0x22f2d9[_0x8fd5('0x5f')]}});}return null;})['then'](handleEntityNotFound(_0x56a18c,null))[_0x8fd5('0x34')](function(_0x4968b8){if(_0x4968b8){return _0x4968b8[_0x8fd5('0x33')]({'UserId':_0x3f7915[_0x8fd5('0x54')][_0x8fd5('0x5a')],'read1stAt':_[_0x8fd5('0x60')](_0x4968b8['read1stAt'])?moment()[_0x8fd5('0x61')](_0x8fd5('0x62')):undefined});}return null;})[_0x8fd5('0x34')](function(_0x3bd4e2){if(_0x3bd4e2){_0x4f45e6['interaction']=_0x3bd4e2[_0x8fd5('0x5d')]({'plain':!![]});interaction_log[_0x8fd5('0x24')](_0x8fd5('0x63'),_0x3f7915[_0x8fd5('0x5b')]['id'],_0x3f7915[_0x8fd5('0x5b')][_0x8fd5('0x37')],_0x3f7915[_0x8fd5('0x5b')]['role'],_0x4f45e6[_0x8fd5('0x64')]['id'],_0x3f7915[_0x8fd5('0x54')]?JSON[_0x8fd5('0x65')](_0x3f7915[_0x8fd5('0x54')]):_0x8fd5('0x66'));return respondWithRpcPromise(_0x8fd5('0x67'),_0x8fd5('0x68'),_0x4f45e6);}return null;})[_0x8fd5('0x34')](function(_0x208e58){var _0x4bf770=_0x8fd5('0x69')+_0x208e58['message'][_0x8fd5('0x6a')];return db[_0x8fd5('0x6b')]['query'](_0x4bf770,{'type':db[_0x8fd5('0x6c')][_0x8fd5('0x6d')][_0x8fd5('0x6e')],'raw':!![]})[_0x8fd5('0x34')](function(_0x10bb8c){return _0x10bb8c;});})[_0x8fd5('0x34')](function(_0x2435c8){if(_0x2435c8){_0x4f45e6[_0x8fd5('0x23')][_0x8fd5('0x6f')]=_0x2435c8[0x0];if(!_0x3f7915[_0x8fd5('0x54')][_0x8fd5('0x5a')])return;return db[_0x8fd5('0x70')]['find']({'where':{'id':_0x3f7915[_0x8fd5('0x54')][_0x8fd5('0x5a')],'role':_0x8fd5('0x5c')},'attributes':['id','name',_0x8fd5('0x71'),_0x8fd5('0x72'),_0x8fd5('0x73')],'raw':!![]});}return null;})[_0x8fd5('0x34')](function(_0x739115){if(!_0x739115)return null;_0x4f45e6[_0x8fd5('0x23')][_0x8fd5('0x5c')]=_0x739115;return _0x4f45e6;})[_0x8fd5('0x34')](function(_0x49b1fc){if(_0x49b1fc){if(_0x3f7915['body'][_0x8fd5('0x74')]){_0x4f45e6[_0x8fd5('0x23')][_0x8fd5('0x75')]=util[_0x8fd5('0x61')](_0x8fd5('0x76'),_0x3f7915['user'][_0x8fd5('0x37')]);_0x4f45e6[_0x8fd5('0x23')][_0x8fd5('0x77')]=_0x4f45e6[_0x8fd5('0x77')];_0x4f45e6[_0x8fd5('0x23')]['event']=_0x8fd5('0x78');return respondWithRpcPromise(_0x8fd5('0x79'),_0x8fd5('0x79'),{'event':_0x8fd5('0x7a'),'message':_0x4f45e6[_0x8fd5('0x23')]},client9002)[_0x8fd5('0x34')](function(){return _0x4f45e6;});}return _0x4f45e6;}return null;})['then'](respondWithResult(_0x56a18c,null))[_0x8fd5('0x26')](handleError(_0x56a18c,null));};var interaction_log=require(_0x8fd5('0x12'))('openchannel-interactions');exports[_0x8fd5('0x31')]=function(_0x381c46,_0x19900a,_0x129829){var _0x11948e={'agent':{},'channel':_0x8fd5('0x58')};if(_0x381c46[_0x8fd5('0x54')]['id']){delete _0x381c46[_0x8fd5('0x54')]['id'];}_0x381c46[_0x8fd5('0x54')][_0x8fd5('0x5a')]=_0x381c46[_0x8fd5('0x54')][_0x8fd5('0x5a')]||_0x381c46[_0x8fd5('0x5b')]['id'];_0x11948e[_0x8fd5('0x5c')]['id']=_0x381c46[_0x8fd5('0x54')][_0x8fd5('0x5a')];return db[_0x8fd5('0x4b')][_0x8fd5('0x55')]({'where':{'id':_0x381c46[_0x8fd5('0x56')]['id'],'UserId':null}})[_0x8fd5('0x34')](handleEntityNotFound(_0x19900a,null))[_0x8fd5('0x34')](function(_0x5651bc){if(_0x5651bc){_0x11948e['message']=_0x5651bc[_0x8fd5('0x5d')]({'plain':!![]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x5651bc[_0x8fd5('0x5f')]}});}return null;})[_0x8fd5('0x34')](handleEntityNotFound(_0x19900a,null))[_0x8fd5('0x34')](function(_0x1a1861){if(_0x1a1861){_0x11948e['interaction']=_0x1a1861[_0x8fd5('0x5d')]({'plain':!![]});interaction_log[_0x8fd5('0x24')](_0x8fd5('0x7b'),_0x381c46[_0x8fd5('0x5b')]['id'],_0x381c46[_0x8fd5('0x5b')][_0x8fd5('0x37')],_0x381c46['user']['role'],_0x11948e[_0x8fd5('0x64')]['id'],_0x381c46[_0x8fd5('0x54')]?JSON[_0x8fd5('0x65')](_0x381c46[_0x8fd5('0x54')]):_0x8fd5('0x66'));return respondWithRpcPromise(_0x8fd5('0x7c'),_0x8fd5('0x7d'),_0x11948e);}return null;})[_0x8fd5('0x34')](function(_0x5c4749){var _0x5ba626=_0x8fd5('0x69')+_0x5c4749[_0x8fd5('0x23')][_0x8fd5('0x6a')];return db['sequelize'][_0x8fd5('0x3d')](_0x5ba626,{'type':db[_0x8fd5('0x6c')][_0x8fd5('0x6d')][_0x8fd5('0x6e')],'raw':!![]})['then'](function(_0x11f152){return _0x11f152;});})['then'](function(_0x26165e){if(_0x26165e){_0x11948e[_0x8fd5('0x23')][_0x8fd5('0x6f')]=_0x26165e[0x0];if(!_0x381c46[_0x8fd5('0x54')]['UserId'])return;return db[_0x8fd5('0x70')][_0x8fd5('0x55')]({'where':{'id':_0x381c46[_0x8fd5('0x54')][_0x8fd5('0x5a')],'role':'agent'},'attributes':['id',_0x8fd5('0x37'),_0x8fd5('0x71'),_0x8fd5('0x72'),_0x8fd5('0x73')],'raw':!![]});}return null;})[_0x8fd5('0x34')](function(_0x30bdcf){if(!_0x30bdcf)return null;_0x11948e[_0x8fd5('0x23')][_0x8fd5('0x5c')]=_0x30bdcf;return _0x11948e;})[_0x8fd5('0x34')](function(_0x1344b6){if(_0x1344b6){_0x1344b6[_0x8fd5('0x23')][_0x8fd5('0x75')]=util[_0x8fd5('0x61')](_0x8fd5('0x76'),_0x381c46[_0x8fd5('0x5b')][_0x8fd5('0x37')]);_0x1344b6[_0x8fd5('0x23')][_0x8fd5('0x77')]=_0x11948e[_0x8fd5('0x77')];_0x1344b6['message'][_0x8fd5('0x7e')]=_0x8fd5('0x31');respondWithRpcPromise('EventManager','EventManager',{'event':_0x8fd5('0x7f'),'message':_0x1344b6['message']},client9002);return _0x11948e;}return null;})[_0x8fd5('0x34')](respondWithResult(_0x19900a,null))[_0x8fd5('0x26')](handleError(_0x19900a,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index decc91e..35a7d4c 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 _0x4209=['update','remove','emit','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x9f8883,_0x27a8ce){var _0x50ce51=function(_0x2ff45a){while(--_0x2ff45a){_0x9f8883['push'](_0x9f8883['shift']());}};_0x50ce51(++_0x27a8ce);}(_0x4209,0x190));var _0x9420=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x4209[_0x4d21ff];return _0x22b554;};'use strict';var EventEmitter=require(_0x9420('0x0'));var OpenchannelMessage=require(_0x9420('0x1'))['db'][_0x9420('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9420('0x3')](0x0);var events={'afterCreate':_0x9420('0x4'),'afterUpdate':_0x9420('0x5'),'afterDestroy':_0x9420('0x6')};function emitEvent(_0x44f09f){return function(_0x45d83f,_0x3314d2,_0x20b419){OpenchannelMessageEvents[_0x9420('0x7')](_0x44f09f+':'+_0x45d83f['id'],_0x45d83f);OpenchannelMessageEvents['emit'](_0x44f09f,_0x45d83f);_0x20b419(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x9420('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xc2b6=['hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','emit'];(function(_0x2a8b21,_0x5cd96b){var _0x114314=function(_0xd17a7){while(--_0xd17a7){_0x2a8b21['push'](_0x2a8b21['shift']());}};_0x114314(++_0x5cd96b);}(_0xc2b6,0xe2));var _0x6c2b=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0xc2b6[_0x2dd390];return _0x3afe47;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x6c2b('0x0'))['db'][_0x6c2b('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x6c2b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6c2b('0x3'),'afterDestroy':_0x6c2b('0x4')};function emitEvent(_0x2369fd){return function(_0x3c0d9f,_0x17e218,_0x2e2824){OpenchannelMessageEvents[_0x6c2b('0x5')](_0x2369fd+':'+_0x3c0d9f['id'],_0x3c0d9f);OpenchannelMessageEvents[_0x6c2b('0x5')](_0x2369fd,_0x3c0d9f);_0x2e2824(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x6c2b('0x6')](e,emitEvent(event));}}module[_0x6c2b('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 39b9507..3a7c3f2 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 _0xda3f=['body','FULLTEXT','models','get','toLowerCase','direction','out','secret','UserId','findOne','OpenchannelInteractionId','createdAt','error','CmContact','describe','then','OpenchannelAccount','OpenchannelAccountId','OpenchannelInteraction','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','afterCreate','threadId','update','catch','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','request-promise','rimraf','../../config/environment','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xda3f,0xec));var _0xfda3=function(_0x587dd2,_0x40a49f){_0x587dd2=_0x587dd2-0x0;var _0xf4a527=_0xda3f[_0x587dd2];return _0xf4a527;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var logger=require(_0xfda3('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfda3('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var attributes=require('./openchannelMessage.attributes');module[_0xfda3('0x5')]=function(_0x43a010,_0x47e7e2){return _0x43a010['define'](_0xfda3('0x6'),attributes,{'tableName':_0xfda3('0x7'),'paranoid':![],'indexes':[{'name':_0xfda3('0x8'),'fields':[_0xfda3('0x9')],'type':_0xfda3('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x20e790,_0x46655c,_0x1b1ea6){var _0xdc5b45=_0x43a010[_0xfda3('0xb')];var _0x102643=_0x20e790[_0xfda3('0xc')]({'plain':!![]});if(_0x102643['direction'][_0xfda3('0xd')]()==='in'||_0x102643[_0xfda3('0xe')][_0xfda3('0xd')]()===_0xfda3('0xf')&&!_0x102643[_0xfda3('0x10')]&&!_['isNil'](_0x102643[_0xfda3('0x11')])){_0xdc5b45['OpenchannelInteraction'][_0xfda3('0x12')]({'where':{'id':_0x102643[_0xfda3('0x13')]}})['then'](function(_0x501588){if(_0x501588){_0x501588['update']({'lastMsgAt':_0x102643[_0xfda3('0x14')],'lastMsgDirection':_0x102643[_0xfda3('0xe')]['toLowerCase']()});}})['catch'](function(_0x533365){console[_0xfda3('0x15')](_0x533365);});}if(_0x102643[_0xfda3('0xe')]===_0xfda3('0xf')&&!_0x102643[_0xfda3('0x10')]){var _0x34900d;_0xdc5b45[_0xfda3('0x16')][_0xfda3('0x17')]()[_0xfda3('0x18')](function(_0x4680bf){return _0xdc5b45[_0xfda3('0x19')]['find']({'where':{'id':_0x102643[_0xfda3('0x1a')]},'include':[{'model':_0xdc5b45[_0xfda3('0x1b')],'as':_0xfda3('0x1c'),'where':{'id':_0x102643[_0xfda3('0x13')]},'limit':0x1,'include':[{'model':_0xdc5b45['CmContact'],'as':_0xfda3('0x1d'),'attributes':_[_0xfda3('0x1e')](_0x4680bf)}]}]});})[_0xfda3('0x18')](function(_0x51e731){_0x34900d=_0x51e731['get']({'plain':!![]});if(_0x34900d&&_0x34900d[_0xfda3('0x1f')]){logger[_0xfda3('0x20')](_0xfda3('0x21'),'afterCreate',util[_0xfda3('0x22')](_0xfda3('0x23'),_0x102643['id'],_0x34900d[_0xfda3('0x1f')]));if(_0x34900d[_0xfda3('0x1c')]&&_0x34900d[_0xfda3('0x1c')][_0xfda3('0x24')]){_0x102643[_0xfda3('0x25')]=_[_0xfda3('0x26')](_0x34900d[_0xfda3('0x1c')][0x0],'Contact');_0x102643[_0xfda3('0x1d')]=_0x34900d[_0xfda3('0x1c')][0x0][_0xfda3('0x1d')];}var _0x46655c={'method':_0xfda3('0x27'),'uri':encodeURI(_0x34900d[_0xfda3('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x46655c[_0xfda3('0x28')]){case _0xfda3('0x29'):_0x46655c['qs']=_0x102643;break;case _0xfda3('0x27'):_0x46655c[_0xfda3('0x9')]=_0x102643;break;}return rp(_0x46655c)['then'](function(_0x3c6d7d){logger[_0xfda3('0x20')](_0xfda3('0x21'),_0xfda3('0x2a'),util[_0xfda3('0x22')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x102643['id'],_0x34900d[_0xfda3('0x1f')]));if(_0x3c6d7d[_0xfda3('0x9')][_0xfda3('0x2b')]&&_0x3c6d7d[_0xfda3('0x9')][_0xfda3('0x2b')]!=_0x102643[_0xfda3('0x25')][_0xfda3('0x2b')]){return _0xdc5b45['OpenchannelInteraction']['update']({'threadId':_0x3c6d7d[_0xfda3('0x9')]['threadId']},{'logging':!![],'where':{'id':_0x102643['Interaction']['id']}});}else{return;}})[_0xfda3('0x18')](function(){return _0x20e790[_0xfda3('0x2c')]({'read':!![]});})[_0xfda3('0x2d')](function(_0xd7e1d6){logger[_0xfda3('0x15')](_0xfda3('0x21'),_0xfda3('0x2a'),util[_0xfda3('0x2e')](_0xd7e1d6,{'showHidden':![],'depth':null}));_0x1b1ea6();});}else{_0x1b1ea6();}})[_0xfda3('0x2f')](function(){_0x1b1ea6();});}else{_0x1b1ea6();}}},'charset':'utf8mb4','collate':_0xfda3('0x30')});}; \ No newline at end of file +var _0x5c00=['afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','GET','info','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','OpenchannelInteraction','catch','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define','openchannel_messages','fti_openchannel_messages','body','models','toLowerCase','out','secret','UserId','findOne','OpenchannelInteractionId','then','update','createdAt','direction','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get'];(function(_0x1351a2,_0x1cdd3e){var _0x13d6f6=function(_0x3142a9){while(--_0x3142a9){_0x1351a2['push'](_0x1351a2['shift']());}};_0x13d6f6(++_0x1cdd3e);}(_0x5c00,0x17e));var _0x05c0=function(_0x559364,_0x223995){_0x559364=_0x559364-0x0;var _0x3b4555=_0x5c00[_0x559364];return _0x3b4555;};'use strict';var _=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var logger=require(_0x05c0('0x2'))('api');var moment=require(_0x05c0('0x3'));var BPromise=require('bluebird');var rp=require(_0x05c0('0x4'));var fs=require('fs');var path=require(_0x05c0('0x5'));var rimraf=require(_0x05c0('0x6'));var config=require(_0x05c0('0x7'));var attributes=require('./openchannelMessage.attributes');module[_0x05c0('0x8')]=function(_0x3521fe,_0x261624){return _0x3521fe[_0x05c0('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x05c0('0xa'),'paranoid':![],'indexes':[{'name':_0x05c0('0xb'),'fields':[_0x05c0('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32a795,_0x32cdfa,_0x996d6b){var _0x321c09=_0x3521fe[_0x05c0('0xd')];var _0x1edbb=_0x32a795['get']({'plain':!![]});if(_0x1edbb['direction'][_0x05c0('0xe')]()==='in'||_0x1edbb['direction'][_0x05c0('0xe')]()===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]&&!_['isNil'](_0x1edbb[_0x05c0('0x11')])){_0x321c09['OpenchannelInteraction'][_0x05c0('0x12')]({'where':{'id':_0x1edbb[_0x05c0('0x13')]}})[_0x05c0('0x14')](function(_0x12deeb){if(_0x12deeb){_0x12deeb[_0x05c0('0x15')]({'lastMsgAt':_0x1edbb[_0x05c0('0x16')],'lastMsgDirection':_0x1edbb[_0x05c0('0x17')][_0x05c0('0xe')]()});}})['catch'](function(_0x238e25){console[_0x05c0('0x18')](_0x238e25);});}if(_0x1edbb[_0x05c0('0x17')]===_0x05c0('0xf')&&!_0x1edbb[_0x05c0('0x10')]){var _0x40153e;_0x321c09[_0x05c0('0x19')][_0x05c0('0x1a')]()[_0x05c0('0x14')](function(_0x521cbd){return _0x321c09[_0x05c0('0x1b')][_0x05c0('0x1c')]({'where':{'id':_0x1edbb[_0x05c0('0x1d')]},'include':[{'model':_0x321c09['OpenchannelInteraction'],'as':_0x05c0('0x1e'),'where':{'id':_0x1edbb[_0x05c0('0x13')]},'limit':0x1,'include':[{'model':_0x321c09[_0x05c0('0x19')],'as':_0x05c0('0x1f'),'attributes':_[_0x05c0('0x20')](_0x521cbd)}]}]});})['then'](function(_0x407c1f){_0x40153e=_0x407c1f[_0x05c0('0x21')]({'plain':!![]});if(_0x40153e&&_0x40153e['replyUri']){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x24'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x40153e[_0x05c0('0x1e')]&&_0x40153e[_0x05c0('0x1e')][_0x05c0('0x26')]){_0x1edbb['Interaction']=_[_0x05c0('0x27')](_0x40153e[_0x05c0('0x1e')][0x0],'Contact');_0x1edbb['Contact']=_0x40153e['Interactions'][0x0]['Contact'];}var _0x32cdfa={'method':_0x05c0('0x28'),'uri':encodeURI(_0x40153e[_0x05c0('0x25')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x32cdfa['method']){case _0x05c0('0x29'):_0x32cdfa['qs']=_0x1edbb;break;case _0x05c0('0x28'):_0x32cdfa[_0x05c0('0xc')]=_0x1edbb;break;}return rp(_0x32cdfa)[_0x05c0('0x14')](function(_0x58769a){logger[_0x05c0('0x2a')](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x23')](_0x05c0('0x2c'),_0x1edbb['id'],_0x40153e[_0x05c0('0x25')]));if(_0x58769a['body']['threadId']&&_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]!=_0x1edbb[_0x05c0('0x2e')][_0x05c0('0x2d')]){return _0x321c09[_0x05c0('0x2f')][_0x05c0('0x15')]({'threadId':_0x58769a[_0x05c0('0xc')][_0x05c0('0x2d')]},{'logging':!![],'where':{'id':_0x1edbb[_0x05c0('0x2e')]['id']}});}else{return;}})[_0x05c0('0x14')](function(){return _0x32a795[_0x05c0('0x15')]({'read':!![]});})[_0x05c0('0x30')](function(_0x50f03d){logger['error'](_0x05c0('0x2b'),_0x05c0('0x22'),util[_0x05c0('0x31')](_0x50f03d,{'showHidden':![],'depth':null}));_0x996d6b();});}else{_0x996d6b();}})['finally'](function(){_0x996d6b();});}else{_0x996d6b();}}},'charset':_0x05c0('0x32'),'collate':_0x05c0('0x33')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8c264ed..55121a1 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x478d55,_0x35d9ec){var _0x58b53f=function(_0xb74631){while(--_0xb74631){_0x478d55['push'](_0x478d55['shift']());}};_0x58b53f(++_0x35d9ec);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x0b0e[_0x3ce2c4];return _0x4047c1;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0x5f2f=['OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','OpenchannelMessage','create','options','raw','CreateOpenchannelMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c123f,_0x13c8dc){var _0x145492=function(_0x5995da){while(--_0x5995da){_0x2c123f['push'](_0x2c123f['shift']());}};_0x145492(++_0x13c8dc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x22468b,_0x3871e6){_0x22468b=_0x22468b-0x0;var _0x18ba7f=_0x5f2f[_0x22468b];return _0x18ba7f;};'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});config[_0xf5f2('0xc')]=_[_0xf5f2('0xd')](config['redis'],{'host':_0xf5f2('0xe'),'port':0x18eb});var socket=require(_0xf5f2('0xf'))(new Redis(config[_0xf5f2('0xc')]));require('./openchannelMessage.socket')[_0xf5f2('0x10')](socket);function respondWithRpcPromise(_0x15dd7c,_0x218ae3,_0x4e0e6b){return new BPromise(function(_0x977a59,_0x4ebbbe){return client['request'](_0x15dd7c,_0x4e0e6b)[_0xf5f2('0x11')](function(_0x151aba){logger['info'](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));logger[_0xf5f2('0x14')](_0xf5f2('0x15'),_0x218ae3,_0xf5f2('0x13'),JSON[_0xf5f2('0x16')](_0x151aba));if(_0x151aba['error']){if(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x18')]===0x1f4){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')]['message']);return _0x4ebbbe(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);return _0x977a59(_0x151aba[_0xf5f2('0x17')][_0xf5f2('0x19')]);}else{logger[_0xf5f2('0x1a')](_0xf5f2('0x12'),_0x218ae3,_0xf5f2('0x13'));_0x977a59(_0x151aba[_0xf5f2('0x1b')][_0xf5f2('0x19')]);}})[_0xf5f2('0x1c')](function(_0x3cf5ea){logger[_0xf5f2('0x17')](_0xf5f2('0x12'),_0x218ae3,_0x3cf5ea);_0x4ebbbe(_0x3cf5ea);});});}exports['CreateOpenchannelMessage']=function(_0x34706d){var _0x47101e=this;return new Promise(function(_0x49dac2,_0x47acfc){return db[_0xf5f2('0x1d')][_0xf5f2('0x1e')](_0x34706d['body'],{'raw':_0x34706d[_0xf5f2('0x1f')]?_0x34706d[_0xf5f2('0x1f')][_0xf5f2('0x20')]===undefined?!![]:![]:!![]})[_0xf5f2('0x11')](function(_0x36f1cb){logger['info'](_0xf5f2('0x21'),_0x34706d);logger[_0xf5f2('0x14')](_0xf5f2('0x21'),_0x34706d,JSON[_0xf5f2('0x16')](_0x36f1cb));_0x49dac2(_0x36f1cb);})[_0xf5f2('0x1c')](function(_0x5bdf4a){logger['error'](_0xf5f2('0x21'),_0x5bdf4a[_0xf5f2('0x19')],_0x34706d);_0x47acfc(_0x47101e[_0xf5f2('0x17')](0x1f4,_0x5bdf4a[_0xf5f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 435c032..252caec 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 _0xe451=['remove','emit','register','length'];(function(_0x5b67cc,_0x2e0a3d){var _0x555eeb=function(_0x2fec09){while(--_0x2fec09){_0x5b67cc['push'](_0x5b67cc['shift']());}};_0x555eeb(++_0x2e0a3d);}(_0xe451,0xec));var _0x1e45=function(_0x19acdb,_0x545136){_0x19acdb=_0x19acdb-0x0;var _0x1b4b4d=_0xe451[_0x19acdb];return _0x1b4b4d;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0x1e45('0x0'),'update'];function createListener(_0x5b59e9,_0x59807e){return function(_0x88df84){_0x59807e[_0x1e45('0x1')](_0x5b59e9,_0x88df84);};}function removeListener(_0x1f9061,_0x197c03){return function(){OpenchannelMessageEvents['removeListener'](_0x1f9061,_0x197c03);};}exports[_0x1e45('0x2')]=function(_0x1a163c){for(var _0x115f88=0x0,_0x563405=events[_0x1e45('0x3')];_0x115f88<_0x563405;_0x115f88++){var _0x31c118=events[_0x115f88];var _0x4dd77f=createListener('openchannelMessage:'+_0x31c118,_0x1a163c);OpenchannelMessageEvents['on'](_0x31c118,_0x4dd77f);}}; \ No newline at end of file +var _0x2202=['emit','removeListener','length','./openchannelMessage.events','save','remove','update'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x2202,0xab));var _0x2220=function(_0xcf4e21,_0x3ad5c8){_0xcf4e21=_0xcf4e21-0x0;var _0x41cd7f=_0x2202[_0xcf4e21];return _0x41cd7f;};'use strict';var OpenchannelMessageEvents=require(_0x2220('0x0'));var events=[_0x2220('0x1'),_0x2220('0x2'),_0x2220('0x3')];function createListener(_0x3a334c,_0x21b074){return function(_0x1768e8){_0x21b074[_0x2220('0x4')](_0x3a334c,_0x1768e8);};}function removeListener(_0x4e5df2,_0x5944fc){return function(){OpenchannelMessageEvents[_0x2220('0x5')](_0x4e5df2,_0x5944fc);};}exports['register']=function(_0x147d2e){for(var _0x4822e0=0x0,_0x5a521e=events[_0x2220('0x6')];_0x4822e0<_0x5a521e;_0x4822e0++){var _0x5b8fa5=events[_0x4822e0];var _0xf93cc6=createListener('openchannelMessage:'+_0x5b8fa5,_0x147d2e);OpenchannelMessageEvents['on'](_0x5b8fa5,_0xf93cc6);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 5559934..452dc46 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 _0x7ff4=['addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getAgents','post','create'];(function(_0x6497cf,_0x3d9712){var _0x242996=function(_0xcb46d8){while(--_0xcb46d8){_0x6497cf['push'](_0x6497cf['shift']());}};_0x242996(++_0x3d9712);}(_0x7ff4,0x74));var _0x47ff=function(_0x2ef4a2,_0x183ad0){_0x2ef4a2=_0x2ef4a2-0x0;var _0x11773a=_0x7ff4[_0x2ef4a2];return _0x11773a;};'use strict';var multer=require(_0x47ff('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x47ff('0x1'));var express=require('express');var router=express[_0x47ff('0x2')]();var fs_extra=require(_0x47ff('0x3'));var auth=require(_0x47ff('0x4'));var interaction=require(_0x47ff('0x5'));var config=require(_0x47ff('0x6'));var controller=require(_0x47ff('0x7'));router[_0x47ff('0x8')]('/',auth[_0x47ff('0x9')](),controller[_0x47ff('0xa')]);router[_0x47ff('0x8')](_0x47ff('0xb'),auth[_0x47ff('0x9')](),controller['describe']);router['get'](_0x47ff('0xc'),auth['isAuthenticated'](),controller[_0x47ff('0xd')]);router[_0x47ff('0x8')]('/:id/members',auth[_0x47ff('0x9')](),controller[_0x47ff('0xe')]);router[_0x47ff('0x8')](_0x47ff('0xf'),auth[_0x47ff('0x9')](),controller['getTeams']);router[_0x47ff('0x8')]('/:id/users',auth[_0x47ff('0x9')](),controller[_0x47ff('0x10')]);router[_0x47ff('0x11')]('/',auth[_0x47ff('0x9')](),controller[_0x47ff('0x12')]);router[_0x47ff('0x11')](_0x47ff('0xf'),auth[_0x47ff('0x9')](),controller[_0x47ff('0x13')]);router[_0x47ff('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x47ff('0x14')]);router[_0x47ff('0x15')](_0x47ff('0xc'),auth[_0x47ff('0x9')](),controller['update']);router[_0x47ff('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x47ff('0x16')](_0x47ff('0xf'),auth['isAuthenticated'](),controller[_0x47ff('0x17')]);router['delete'](_0x47ff('0x18'),auth[_0x47ff('0x9')](),controller[_0x47ff('0x19')]);module[_0x47ff('0x1a')]=router; \ No newline at end of file +var _0xcfbf=['./openchannelQueue.controller','isAuthenticated','get','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','put','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3c0daf,_0x56d61a){var _0x138234=function(_0x3e9b7a){while(--_0x3e9b7a){_0x3c0daf['push'](_0x3c0daf['shift']());}};_0x138234(++_0x56d61a);}(_0xcfbf,0x1c7));var _0xfcfb=function(_0x4b4a32,_0x310930){_0x4b4a32=_0x4b4a32-0x0;var _0xb9d2b=_0xcfbf[_0x4b4a32];return _0xb9d2b;};'use strict';var multer=require(_0xfcfb('0x0'));var util=require(_0xfcfb('0x1'));var path=require(_0xfcfb('0x2'));var timeout=require(_0xfcfb('0x3'));var express=require(_0xfcfb('0x4'));var router=express['Router']();var fs_extra=require(_0xfcfb('0x5'));var auth=require(_0xfcfb('0x6'));var interaction=require(_0xfcfb('0x7'));var config=require(_0xfcfb('0x8'));var controller=require(_0xfcfb('0x9'));router['get']('/',auth[_0xfcfb('0xa')](),controller['index']);router[_0xfcfb('0xb')](_0xfcfb('0xc'),auth[_0xfcfb('0xa')](),controller[_0xfcfb('0xd')]);router[_0xfcfb('0xb')](_0xfcfb('0xe'),auth[_0xfcfb('0xa')](),controller['show']);router['get'](_0xfcfb('0xf'),auth['isAuthenticated'](),controller[_0xfcfb('0x10')]);router[_0xfcfb('0xb')]('/:id/teams',auth[_0xfcfb('0xa')](),controller[_0xfcfb('0x11')]);router['get'](_0xfcfb('0x12'),auth[_0xfcfb('0xa')](),controller[_0xfcfb('0x13')]);router[_0xfcfb('0x14')]('/',auth[_0xfcfb('0xa')](),controller[_0xfcfb('0x15')]);router[_0xfcfb('0x14')](_0xfcfb('0x16'),auth[_0xfcfb('0xa')](),controller['addTeams']);router['post']('/:id/users',auth[_0xfcfb('0xa')](),controller['addAgents']);router[_0xfcfb('0x17')](_0xfcfb('0xe'),auth[_0xfcfb('0xa')](),controller[_0xfcfb('0x18')]);router['delete']('/:id',auth[_0xfcfb('0xa')](),controller[_0xfcfb('0x19')]);router[_0xfcfb('0x1a')](_0xfcfb('0x16'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xfcfb('0x1a')]('/:id/users',auth[_0xfcfb('0xa')](),controller[_0xfcfb('0x1b')]);module[_0xfcfb('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 9ee643e..5c40a74 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 _0x546e=['name','INTEGER','rrmemory','beepall','sequelize','exports','STRING'];(function(_0x3a5266,_0x3646d8){var _0x324b5d=function(_0x9fb993){while(--_0x9fb993){_0x3a5266['push'](_0x3a5266['shift']());}};_0x324b5d(++_0x3646d8);}(_0x546e,0x12a));var _0xe546=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x546e[_0x16d10f];return _0x50c823;};'use strict';var Sequelize=require(_0xe546('0x0'));module[_0xe546('0x1')]={'name':{'type':Sequelize[_0xe546('0x2')],'unique':_0xe546('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe546('0x2')]},'timeout':{'type':Sequelize[_0xe546('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe546('0x5'),_0xe546('0x6'),'roundrobin')}}; \ No newline at end of file +var _0xfe35=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x43dd06,_0x2b2592){var _0x416968=function(_0x4a8bc8){while(--_0x4a8bc8){_0x43dd06['push'](_0x43dd06['shift']());}};_0x416968(++_0x2b2592);}(_0xfe35,0x135));var _0x5fe3=function(_0x34ad69,_0x3355b6){_0x34ad69=_0x34ad69-0x0;var _0x106688=_0xfe35[_0x34ad69];return _0x106688;};'use strict';var Sequelize=require(_0x5fe3('0x0'));module[_0x5fe3('0x1')]={'name':{'type':Sequelize[_0x5fe3('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5fe3('0x2')]},'timeout':{'type':Sequelize[_0x5fe3('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5fe3('0x4')](_0x5fe3('0x5'),_0x5fe3('0x6'),_0x5fe3('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index d8de299..158e2d3 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 _0x78d8=['util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','stack','send','index','map','OpenchannelQueue','rawAttributes','fieldName','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','find','params','describe','getMembers','UserOpenchannelQueue','order','OpenchannelQueueId','User','findAndCountAll','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','addTeams','ids','Team','Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','userOpenchannelQueue:save','select','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment'];(function(_0x254761,_0x550307){var _0x4236de=function(_0x13968e){while(--_0x13968e){_0x254761['push'](_0x254761['shift']());}};_0x4236de(++_0x550307);}(_0x78d8,0x197));var _0x878d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x78d8[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x878d('0x0'));var rimraf=require(_0x878d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x878d('0x2'));var rp=require('request-promise');var moment=require(_0x878d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x878d('0x4'));var path=require(_0x878d('0x5'));var sox=require('sox');var csv=require(_0x878d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x878d('0x7'));var _=require(_0x878d('0x8'));var squel=require(_0x878d('0x9'));var crypto=require(_0x878d('0xa'));var jsforce=require(_0x878d('0xb'));var deskjs=require(_0x878d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x878d('0xd'));var Redis=require('ioredis');var authService=require(_0x878d('0xe'));var qs=require(_0x878d('0xf'));var as=require(_0x878d('0x10'));var hardwareService=require(_0x878d('0x11'));var logger=require(_0x878d('0x12'))(_0x878d('0x13'));var utils=require(_0x878d('0x14'));var config=require(_0x878d('0x15'));var licenseUtil=require(_0x878d('0x16'));var db=require(_0x878d('0x17'))['db'];config[_0x878d('0x18')]=_[_0x878d('0x19')](config[_0x878d('0x18')],{'host':_0x878d('0x1a'),'port':0x18eb});var socket=require(_0x878d('0x1b'))(new Redis(config[_0x878d('0x18')]));require('./openchannelQueue.socket')[_0x878d('0x1c')](socket);function respondWithStatusCode(_0x556f4b,_0x4e39cf){_0x4e39cf=_0x4e39cf||0xcc;return function(_0x370e3a){if(_0x370e3a){return _0x556f4b[_0x878d('0x1d')](_0x4e39cf);}return _0x556f4b[_0x878d('0x1e')](_0x4e39cf)['end']();};}function respondWithResult(_0x5d8e67,_0x4d522d){_0x4d522d=_0x4d522d||0xc8;return function(_0x56d3a7){if(_0x56d3a7){return _0x5d8e67[_0x878d('0x1e')](_0x4d522d)[_0x878d('0x1f')](_0x56d3a7);}};}function respondWithFilteredResult(_0x3fa857,_0x23c898){return function(_0x65d64c){if(_0x65d64c){var _0xc6da1c=typeof _0x23c898[_0x878d('0x20')]===_0x878d('0x21')&&typeof _0x23c898[_0x878d('0x22')]==='undefined';var _0x74fd0=_0x65d64c['count'];var _0x423f2b=_0xc6da1c?0x0:_0x23c898[_0x878d('0x20')];var _0x495d63=_0xc6da1c?_0x65d64c[_0x878d('0x23')]:_0x23c898[_0x878d('0x20')]+_0x23c898[_0x878d('0x22')];var _0x21ed58;if(_0x495d63>=_0x74fd0){_0x495d63=_0x74fd0;_0x21ed58=0xc8;}else{_0x21ed58=0xce;}_0x3fa857[_0x878d('0x1e')](_0x21ed58);return _0x3fa857[_0x878d('0x24')](_0x878d('0x25'),_0x423f2b+'-'+_0x495d63+'/'+_0x74fd0)[_0x878d('0x1f')](_0x65d64c);}return null;};}function patchUpdates(_0x2a2f39){return function(_0x2c13c1){try{jsonpatch[_0x878d('0x26')](_0x2c13c1,_0x2a2f39,!![]);}catch(_0x3401ea){return BPromise[_0x878d('0x27')](_0x3401ea);}return _0x2c13c1[_0x878d('0x28')]();};}function saveUpdates(_0x2502c4,_0x4c8e6d){return function(_0x34890e){if(_0x34890e){return _0x34890e[_0x878d('0x29')](_0x2502c4)[_0x878d('0x2a')](function(_0x3bb78d){return _0x3bb78d;});}return null;};}function removeEntity(_0x164273,_0x45ce69){return function(_0x407175){if(_0x407175){return _0x407175[_0x878d('0x2b')]()[_0x878d('0x2a')](function(){var _0x2ee516=_0x407175[_0x878d('0x2c')]({'plain':!![]});var _0x2bddc4=_0x878d('0x2d');return db[_0x878d('0x2e')]['destroy']({'where':{'type':_0x2bddc4,'resourceId':_0x2ee516['id']}})[_0x878d('0x2a')](function(){return _0x407175;});})[_0x878d('0x2a')](function(){_0x164273[_0x878d('0x1e')](0xcc)[_0x878d('0x2f')]();});}};}function handleEntityNotFound(_0x39c8f1,_0x1d57d3){return function(_0x177db0){if(!_0x177db0){_0x39c8f1[_0x878d('0x1d')](0x194);}return _0x177db0;};}function handleError(_0x3c0e04,_0x18a05e){_0x18a05e=_0x18a05e||0x1f4;return function(_0x4d5eba){logger['error'](_0x4d5eba[_0x878d('0x30')]);if(_0x4d5eba['name']){delete _0x4d5eba['name'];}_0x3c0e04['status'](_0x18a05e)[_0x878d('0x31')](_0x4d5eba);};}exports[_0x878d('0x32')]=function(_0x561c0b,_0x2e62fc){var _0x348bf2={},_0x4c4b7a={},_0x11bd63={'count':0x0,'rows':[]};var _0x53481b=_[_0x878d('0x33')](db[_0x878d('0x34')][_0x878d('0x35')],function(_0x262f44){return{'name':_0x262f44[_0x878d('0x36')],'type':_0x262f44['type'][_0x878d('0x37')]};});_0x4c4b7a[_0x878d('0x38')]=_[_0x878d('0x33')](_0x53481b,_0x878d('0x39'));_0x4c4b7a[_0x878d('0x3a')]=_[_0x878d('0x3b')](_0x561c0b['query']);_0x4c4b7a[_0x878d('0x3c')]=_[_0x878d('0x3d')](_0x4c4b7a[_0x878d('0x38')],_0x4c4b7a[_0x878d('0x3a')]);_0x348bf2[_0x878d('0x3e')]=_[_0x878d('0x3d')](_0x4c4b7a['model'],qs['fields'](_0x561c0b[_0x878d('0x3a')][_0x878d('0x3f')]));_0x348bf2[_0x878d('0x3e')]=_0x348bf2[_0x878d('0x3e')][_0x878d('0x40')]?_0x348bf2[_0x878d('0x3e')]:_0x4c4b7a[_0x878d('0x38')];if(!_0x561c0b[_0x878d('0x3a')][_0x878d('0x41')](_0x878d('0x42'))){_0x348bf2['limit']=qs['limit'](_0x561c0b['query'][_0x878d('0x22')]);_0x348bf2[_0x878d('0x20')]=qs[_0x878d('0x20')](_0x561c0b['query'][_0x878d('0x20')]);}_0x348bf2['order']=qs[_0x878d('0x43')](_0x561c0b[_0x878d('0x3a')][_0x878d('0x43')]);_0x348bf2['where']=qs[_0x878d('0x3c')](_[_0x878d('0x44')](_0x561c0b[_0x878d('0x3a')],_0x4c4b7a['filters']),_0x53481b);if(_0x561c0b[_0x878d('0x3a')][_0x878d('0x45')]){_0x348bf2[_0x878d('0x46')]=_[_0x878d('0x47')](_0x348bf2[_0x878d('0x46')],{'$or':_[_0x878d('0x33')](_0x53481b,function(_0x46b9e8){if(_0x46b9e8['type']!==_0x878d('0x48')){var _0x658ba={};_0x658ba[_0x46b9e8[_0x878d('0x39')]]={'$like':'%'+_0x561c0b[_0x878d('0x3a')][_0x878d('0x45')]+'%'};return _0x658ba;}})});}_0x348bf2=_[_0x878d('0x47')]({},_0x348bf2,_0x561c0b[_0x878d('0x49')]);var _0x51ec17={'where':_0x348bf2[_0x878d('0x46')]};return db[_0x878d('0x34')][_0x878d('0x23')](_0x51ec17)[_0x878d('0x2a')](function(_0x17ad96){_0x11bd63[_0x878d('0x23')]=_0x17ad96;if(_0x561c0b[_0x878d('0x3a')][_0x878d('0x4a')]){_0x348bf2[_0x878d('0x4b')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x878d('0x4c')](_0x348bf2);})['then'](function(_0xeedc91){_0x11bd63['rows']=_0xeedc91;return _0x11bd63;})[_0x878d('0x2a')](respondWithFilteredResult(_0x2e62fc,_0x348bf2))[_0x878d('0x4d')](handleError(_0x2e62fc,null));};exports[_0x878d('0x4e')]=function(_0x10c8f0,_0x30ffb9){var _0x40cefd={'raw':!![],'where':{'id':_0x10c8f0['params']['id']}},_0x1e979b={};_0x1e979b[_0x878d('0x38')]=_[_0x878d('0x3b')](db[_0x878d('0x34')][_0x878d('0x35')]);_0x1e979b['query']=_[_0x878d('0x3b')](_0x10c8f0['query']);_0x1e979b['filters']=_[_0x878d('0x3d')](_0x1e979b[_0x878d('0x38')],_0x1e979b[_0x878d('0x3a')]);_0x40cefd[_0x878d('0x3e')]=_[_0x878d('0x3d')](_0x1e979b[_0x878d('0x38')],qs[_0x878d('0x3f')](_0x10c8f0[_0x878d('0x3a')][_0x878d('0x3f')]));_0x40cefd[_0x878d('0x3e')]=_0x40cefd[_0x878d('0x3e')][_0x878d('0x40')]?_0x40cefd[_0x878d('0x3e')]:_0x1e979b[_0x878d('0x38')];if(_0x10c8f0[_0x878d('0x3a')][_0x878d('0x4a')]){_0x40cefd[_0x878d('0x4b')]=[{'all':!![]}];}_0x40cefd=_['merge']({},_0x40cefd,_0x10c8f0[_0x878d('0x49')]);return db[_0x878d('0x34')]['find'](_0x40cefd)[_0x878d('0x2a')](handleEntityNotFound(_0x30ffb9,null))[_0x878d('0x2a')](respondWithResult(_0x30ffb9,null))[_0x878d('0x4d')](handleError(_0x30ffb9,null));};exports[_0x878d('0x4f')]=function(_0x20b6d9,_0x130d83){return db['OpenchannelQueue'][_0x878d('0x4f')](_0x20b6d9[_0x878d('0x50')],{})['then'](function(_0x5ea7c7){var _0x1ce847=_0x20b6d9['user'][_0x878d('0x2c')]({'plain':!![]});if(!_0x1ce847)throw new Error(_0x878d('0x51'));if(_0x1ce847[_0x878d('0x52')]==='user'){var _0x15729c=_0x5ea7c7[_0x878d('0x2c')]({'plain':!![]});var _0x28e848=_0x878d('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x28e848,'userProfileId':_0x1ce847['userProfileId']},'raw':!![]})[_0x878d('0x2a')](function(_0x23e28e){if(_0x23e28e&&_0x23e28e[_0x878d('0x53')]===0x0){return db['UserProfileResource'][_0x878d('0x4f')]({'name':_0x15729c[_0x878d('0x39')],'resourceId':_0x15729c['id'],'type':_0x23e28e[_0x878d('0x39')],'sectionId':_0x23e28e['id']},{})['then'](function(){return _0x5ea7c7;});}else{return _0x5ea7c7;}})['catch'](function(_0x18914a){logger[_0x878d('0x54')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18914a);throw _0x18914a;});}return _0x5ea7c7;})['then'](respondWithResult(_0x130d83,0xc9))[_0x878d('0x4d')](handleError(_0x130d83,null));};exports[_0x878d('0x29')]=function(_0x2bf95f,_0x371f28){if(_0x2bf95f[_0x878d('0x50')]['id']){delete _0x2bf95f[_0x878d('0x50')]['id'];}return db[_0x878d('0x34')][_0x878d('0x55')]({'where':{'id':_0x2bf95f[_0x878d('0x56')]['id']}})['then'](handleEntityNotFound(_0x371f28,null))[_0x878d('0x2a')](saveUpdates(_0x2bf95f['body'],null))[_0x878d('0x2a')](respondWithResult(_0x371f28,null))[_0x878d('0x4d')](handleError(_0x371f28,null));};exports['destroy']=function(_0x4476a7,_0x40efff){return db['OpenchannelQueue'][_0x878d('0x55')]({'where':{'id':_0x4476a7[_0x878d('0x56')]['id']}})['then'](handleEntityNotFound(_0x40efff,null))['then'](removeEntity(_0x40efff,null))[_0x878d('0x4d')](handleError(_0x40efff,null));};exports[_0x878d('0x57')]=function(_0x1badff,_0x2d0e74){return db[_0x878d('0x34')][_0x878d('0x57')]()['then'](respondWithResult(_0x2d0e74,null))[_0x878d('0x4d')](handleError(_0x2d0e74,null));};exports[_0x878d('0x58')]=function(_0x3a20ac,_0xbcecb8,_0x53528a){var _0x2a52ab={'raw':!![],'where':{}},_0x59cbb7={},_0x48623b;return db[_0x878d('0x34')]['findOne']({'where':{'id':_0x3a20ac['params']['id']}})['then'](handleEntityNotFound(_0xbcecb8,null))[_0x878d('0x2a')](function(_0x368949){if(_0x368949){_0x48623b=_0x368949['get']({'plain':!![]});_0x59cbb7[_0x878d('0x38')]=_[_0x878d('0x3b')](db[_0x878d('0x59')][_0x878d('0x35')]);_0x59cbb7[_0x878d('0x3a')]=_[_0x878d('0x3b')](_0x3a20ac[_0x878d('0x3a')]);_0x59cbb7[_0x878d('0x3c')]=_[_0x878d('0x3d')](_0x59cbb7[_0x878d('0x38')],_0x59cbb7[_0x878d('0x3a')]);_0x2a52ab[_0x878d('0x3e')]=_[_0x878d('0x3d')](_0x59cbb7[_0x878d('0x38')],qs[_0x878d('0x3f')](_0x3a20ac[_0x878d('0x3a')][_0x878d('0x3f')]));_0x2a52ab[_0x878d('0x3e')]=_0x2a52ab[_0x878d('0x3e')][_0x878d('0x40')]?_0x2a52ab[_0x878d('0x3e')]:_0x59cbb7[_0x878d('0x38')];if(!_0x3a20ac[_0x878d('0x3a')]['hasOwnProperty'](_0x878d('0x42'))){_0x2a52ab[_0x878d('0x22')]=qs[_0x878d('0x22')](_0x3a20ac['query'][_0x878d('0x22')]);_0x2a52ab[_0x878d('0x20')]=qs[_0x878d('0x20')](_0x3a20ac[_0x878d('0x3a')][_0x878d('0x20')]);}_0x2a52ab[_0x878d('0x5a')]=qs[_0x878d('0x43')](_0x3a20ac['query'][_0x878d('0x43')]);_0x2a52ab['where']=qs[_0x878d('0x3c')](_[_0x878d('0x44')](_0x3a20ac[_0x878d('0x3a')],_0x59cbb7[_0x878d('0x3c')]));_0x2a52ab[_0x878d('0x46')][_0x878d('0x5b')]=_0x368949['id'];if(_0x3a20ac[_0x878d('0x3a')][_0x878d('0x45')]){_0x2a52ab[_0x878d('0x46')]=_[_0x878d('0x47')](_0x2a52ab['where'],{'$or':_[_0x878d('0x33')](_0x2a52ab[_0x878d('0x3e')],function(_0xad25c3){var _0x5a2ae2={};_0x5a2ae2[_0xad25c3]={'$like':'%'+_0x3a20ac[_0x878d('0x3a')]['filter']+'%'};return _0x5a2ae2;})});}_0x2a52ab=_[_0x878d('0x47')]({},_0x2a52ab,_0x3a20ac['options']);return db[_0x878d('0x59')][_0x878d('0x4c')](_0x2a52ab);}})[_0x878d('0x2a')](function(_0x29cd4f){if(_0x29cd4f){return db[_0x878d('0x5c')][_0x878d('0x5d')]({'where':{'id':_[_0x878d('0x33')](_0x29cd4f,'UserId'),'role':'agent'},'attributes':['id',_0x878d('0x39'),_0x878d('0x5e'),_0x878d('0x5f'),_0x878d('0x60')]});}})[_0x878d('0x2a')](function(_0xa232fe){if(_0xa232fe){return{'count':_0xa232fe[_0x878d('0x23')],'rows':_['map'](_0xa232fe[_0x878d('0x61')],function(_0x40db4a){return{'membername':_0x40db4a['name'],'UserId':_0x40db4a['id'],'queue_name':_0x48623b[_0x878d('0x39')],'OpenchannelQueueId':_0x48623b['id'],'interface':util[_0x878d('0x62')](_0x878d('0x63'),_0x878d('0x64'),_0x40db4a['name']),'penalty':0x0,'paused':_0x40db4a[_0x878d('0x5e')],'createdAt':_0x40db4a[_0x878d('0x60')],'updatedAt':_0x40db4a[_0x878d('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x878d('0x2a')](respondWithFilteredResult(_0xbcecb8,_0x2a52ab))['catch'](handleError(_0xbcecb8,null));};exports[_0x878d('0x65')]=function(_0x48415c,_0x33e4ed,_0x2b7cac){var _0x35516d={};var _0x572265={};var _0x4c377b;var _0x5a2cc4;return db[_0x878d('0x34')][_0x878d('0x66')]({'where':{'id':_0x48415c[_0x878d('0x56')]['id']}})[_0x878d('0x2a')](handleEntityNotFound(_0x33e4ed,null))['then'](function(_0x299be7){if(_0x299be7){_0x4c377b=_0x299be7;_0x572265['model']=_['keys'](db['Team']['rawAttributes']);_0x572265[_0x878d('0x3a')]=_['keys'](_0x48415c[_0x878d('0x3a')]);_0x572265['filters']=_[_0x878d('0x3d')](_0x572265[_0x878d('0x38')],_0x572265['query']);_0x35516d['attributes']=_['intersection'](_0x572265[_0x878d('0x38')],qs['fields'](_0x48415c['query']['fields']));_0x35516d[_0x878d('0x3e')]=_0x35516d[_0x878d('0x3e')][_0x878d('0x40')]?_0x35516d['attributes']:_0x572265[_0x878d('0x38')];_0x35516d[_0x878d('0x5a')]=qs['sort'](_0x48415c[_0x878d('0x3a')]['sort']);_0x35516d['where']=qs[_0x878d('0x3c')](_[_0x878d('0x44')](_0x48415c['query'],_0x572265[_0x878d('0x3c')]));if(_0x48415c['query'][_0x878d('0x45')]){_0x35516d[_0x878d('0x46')]=_[_0x878d('0x47')](_0x35516d[_0x878d('0x46')],{'$or':_['map'](_0x35516d[_0x878d('0x3e')],function(_0x570bea){var _0x312fcc={};_0x312fcc[_0x570bea]={'$like':'%'+_0x48415c[_0x878d('0x3a')][_0x878d('0x45')]+'%'};return _0x312fcc;})});}_0x35516d=_['merge']({},_0x35516d,_0x48415c[_0x878d('0x49')]);return _0x4c377b[_0x878d('0x65')](_0x35516d);}})[_0x878d('0x2a')](function(_0x182af7){if(_0x182af7){_0x5a2cc4=_0x182af7[_0x878d('0x40')];if(!_0x48415c[_0x878d('0x3a')][_0x878d('0x41')]('nolimit')){_0x35516d[_0x878d('0x22')]=qs[_0x878d('0x22')](_0x48415c[_0x878d('0x3a')]['limit']);_0x35516d[_0x878d('0x20')]=qs['offset'](_0x48415c[_0x878d('0x3a')][_0x878d('0x20')]);}return _0x4c377b[_0x878d('0x65')](_0x35516d);}})[_0x878d('0x2a')](function(_0x416299){if(_0x416299){return _0x416299?{'count':_0x5a2cc4,'rows':_0x416299}:null;}})[_0x878d('0x2a')](respondWithResult(_0x33e4ed,null))[_0x878d('0x4d')](handleError(_0x33e4ed,null));};exports[_0x878d('0x67')]=function(_0x2e14ea,_0xfd46b,_0x177594){var _0x59ca1b=_0x2e14ea[_0x878d('0x50')][_0x878d('0x68')];return db[_0x878d('0x69')][_0x878d('0x4c')]({'where':{'id':_0x59ca1b},'attributes':['id'],'include':[{'model':db[_0x878d('0x5c')],'as':_0x878d('0x6a'),'attributes':['id','name','online',_0x878d('0x6b'),'interface'],'raw':!![]}]})[_0x878d('0x2a')](function(_0x3db013){if(_0x3db013){var _0x28c8c4=_[_0x878d('0x6c')](_0x3db013,function(_0x485f36){var _0x3c9ef5=_0x485f36['get']({'plain':!![]});return _0x3c9ef5[_0x878d('0x6a')];});return db[_0x878d('0x34')][_0x878d('0x55')]({'where':{'id':_0x2e14ea[_0x878d('0x56')]['id']}})[_0x878d('0x2a')](function(_0x4fd718){return db[_0x878d('0x6d')][_0x878d('0x6e')](function(_0x3c5a9f){return _0x4fd718['addTeams'](_0x59ca1b,{'transaction':_0x3c5a9f})[_0x878d('0x2a')](function(){return BPromise[_0x878d('0x6f')](_0x28c8c4,function(_0x38d8dc){return db['UserOpenchannelQueue'][_0x878d('0x70')]({'where':{'UserId':_0x38d8dc['id'],'OpenchannelQueueId':_0x2e14ea[_0x878d('0x56')]['id']},'transaction':_0x3c5a9f});});})[_0x878d('0x2a')](function(){_0x28c8c4['forEach'](function(_0x268898){socket[_0x878d('0x71')](_0x878d('0x72'),{'UserId':_0x268898['id'],'OpenchannelQueueId':_0x4fd718['id']});});});});});}})['then'](respondWithStatusCode(_0xfd46b,null))[_0x878d('0x4d')](handleError(_0xfd46b,null));};exports['removeTeams']=function(_0x140603,_0x3ac710,_0x1dad0d){return db[_0x878d('0x69')][_0x878d('0x4c')]({'where':{'id':_0x140603['query'][_0x878d('0x68')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x878d('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x878d('0x2a')](handleEntityNotFound(_0x3ac710,null))[_0x878d('0x2a')](function(_0xbda1d0){var _0x428645=_[_0x878d('0x33')](_0xbda1d0,'id');var _0x577e57=[];var _0x404262=[];var _0x5abf81=squel[_0x878d('0x73')]();_0x5abf81['field'](_0x878d('0x74'))[_0x878d('0x75')](_0x878d('0x76'),'tq')[_0x878d('0x77')]('user_has_teams','ut',_0x878d('0x78'))['where']('OpenchannelQueueId\x20=\x20?',_0x140603[_0x878d('0x56')]['id']);for(var _0x62924b=0x0;_0x62924b<_0xbda1d0[_0x878d('0x40')];_0x62924b+=0x1){let _0x109818=_0xbda1d0[_0x62924b];for(var _0x17ec47=0x0;_0x17ec47<_0x109818[_0x878d('0x6a')][_0x878d('0x40')];_0x17ec47+=0x1){let _0x59564d=_0x109818['Agents'][_0x17ec47];var _0x35e22f=_0x5abf81[_0x878d('0x79')]();_0x35e22f[_0x878d('0x46')](_0x878d('0x7a'),_0x59564d['id']);_0x404262[_0x878d('0x7b')](db[_0x878d('0x6d')][_0x878d('0x3a')](_0x35e22f['toString'](),{'type':db[_0x878d('0x6d')][_0x878d('0x7c')]['SELECT']})[_0x878d('0x2a')](function(_0x4d99b3){if(_0x4d99b3['length']===0x1){return _0x59564d['id'];}else{var _0x4de7e5=_[_0x878d('0x7d')](_[_0x878d('0x33')](_0x4d99b3,_0x878d('0x7e')),function(_0x13cb06){return _['includes'](_0x428645,_0x13cb06);});if(_0x4de7e5){return _0x59564d['id'];}}}));}}return BPromise['all'](_0x404262)[_0x878d('0x2a')](function(_0x62aa5e){_0x577e57=_(_0x577e57)['union'](_0x62aa5e)['compact']()['value']();return db[_0x878d('0x34')][_0x878d('0x55')]({'where':{'id':_0x140603['params']['id']}})[_0x878d('0x2a')](function(_0x36b32b){return db[_0x878d('0x6d')]['transaction'](function(_0x4ebf38){return _0x36b32b[_0x878d('0x7f')](_0x140603[_0x878d('0x3a')][_0x878d('0x68')],{'transaction':_0x4ebf38})[_0x878d('0x2a')](function(){if(!_[_0x878d('0x80')](_0x577e57)){return _0x36b32b[_0x878d('0x81')](_0x577e57,{'transaction':_0x4ebf38});}})[_0x878d('0x2a')](function(){_0x577e57[_0x878d('0x82')](function(_0x296fa7){socket[_0x878d('0x71')]('userOpenchannelQueue:remove',{'UserId':_0x296fa7,'OpenchannelQueueId':_0x36b32b['id']});});});});});});})[_0x878d('0x2a')](respondWithStatusCode(_0x3ac710,null))[_0x878d('0x4d')](handleError(_0x3ac710,null));};exports[_0x878d('0x83')]=function(_0x17d89a,_0x5f1c9c,_0x51cbac){return db[_0x878d('0x34')][_0x878d('0x55')]({'where':{'id':_0x17d89a[_0x878d('0x56')]['id']}})[_0x878d('0x2a')](handleEntityNotFound(_0x5f1c9c,null))[_0x878d('0x2a')](function(_0x4cec45){if(_0x4cec45){return _0x4cec45[_0x878d('0x83')](_0x17d89a[_0x878d('0x50')][_0x878d('0x68')],_[_0x878d('0x84')](_0x17d89a[_0x878d('0x50')],[_0x878d('0x68'),'id'])||{})[_0x878d('0x85')](function(_0x57f9ba){for(var _0x5b501d=0x0;_0x5b501d<_0x17d89a[_0x878d('0x50')]['ids'][_0x878d('0x40')];_0x5b501d+=0x1){socket[_0x878d('0x71')]('userOpenchannelQueue:save',{'UserId':Number(_0x17d89a[_0x878d('0x50')][_0x878d('0x68')][_0x5b501d]),'OpenchannelQueueId':Number(_0x17d89a[_0x878d('0x56')]['id'])});}return _0x57f9ba;});}})[_0x878d('0x2a')](respondWithResult(_0x5f1c9c,null))[_0x878d('0x4d')](handleError(_0x5f1c9c,null));};exports[_0x878d('0x81')]=function(_0x44259c,_0x1e9cd3,_0x4e3c08){return db['OpenchannelQueue']['find']({'where':{'id':_0x44259c[_0x878d('0x56')]['id']}})[_0x878d('0x2a')](handleEntityNotFound(_0x1e9cd3,null))[_0x878d('0x2a')](function(_0x3532fe){if(_0x3532fe){return _0x3532fe['removeAgents'](_0x44259c[_0x878d('0x3a')][_0x878d('0x68')])[_0x878d('0x2a')](function(){if(_[_0x878d('0x86')](_0x44259c['query'][_0x878d('0x68')])){for(var _0x1757f8=0x0;_0x1757f8<_0x44259c[_0x878d('0x3a')]['ids'][_0x878d('0x40')];_0x1757f8+=0x1){socket['emit'](_0x878d('0x87'),{'UserId':Number(_0x44259c[_0x878d('0x3a')]['ids'][_0x1757f8]),'OpenchannelQueueId':Number(_0x44259c['params']['id'])});}}else{socket[_0x878d('0x71')]('userOpenchannelQueue:remove',{'UserId':Number(_0x44259c[_0x878d('0x3a')][_0x878d('0x68')]),'OpenchannelQueueId':Number(_0x44259c[_0x878d('0x56')]['id'])});}});}})[_0x878d('0x2a')](respondWithStatusCode(_0x1e9cd3,null))[_0x878d('0x4d')](handleError(_0x1e9cd3,null));};exports['getAgents']=function(_0x11c582,_0x4dedf9,_0x42b01c){var _0x560eba={};var _0x44ac74={};var _0x341895;var _0x149933;return db['OpenchannelQueue'][_0x878d('0x66')]({'where':{'id':_0x11c582[_0x878d('0x56')]['id']}})[_0x878d('0x2a')](handleEntityNotFound(_0x4dedf9,null))[_0x878d('0x2a')](function(_0x167d71){if(_0x167d71){_0x341895=_0x167d71;_0x44ac74['model']=_[_0x878d('0x3b')](db['User'][_0x878d('0x35')]);_0x44ac74[_0x878d('0x3a')]=_['keys'](_0x11c582[_0x878d('0x3a')]);_0x44ac74[_0x878d('0x3c')]=_[_0x878d('0x3d')](_0x44ac74[_0x878d('0x38')],_0x44ac74['query']);_0x560eba[_0x878d('0x3e')]=_[_0x878d('0x3d')](_0x44ac74[_0x878d('0x38')],qs[_0x878d('0x3f')](_0x11c582['query'][_0x878d('0x3f')]));_0x560eba[_0x878d('0x3e')]=_0x560eba[_0x878d('0x3e')][_0x878d('0x40')]?_0x560eba[_0x878d('0x3e')]:_0x44ac74[_0x878d('0x38')];_0x560eba['order']=qs[_0x878d('0x43')](_0x11c582[_0x878d('0x3a')][_0x878d('0x43')]);_0x560eba[_0x878d('0x46')]=qs[_0x878d('0x3c')](_[_0x878d('0x44')](_0x11c582[_0x878d('0x3a')],_0x44ac74[_0x878d('0x3c')]));if(_0x11c582[_0x878d('0x3a')][_0x878d('0x45')]){_0x560eba[_0x878d('0x46')]=_[_0x878d('0x47')](_0x560eba[_0x878d('0x46')],{'$or':_[_0x878d('0x33')](_0x560eba[_0x878d('0x3e')],function(_0x25f750){var _0x4048f8={};_0x4048f8[_0x25f750]={'$like':'%'+_0x11c582[_0x878d('0x3a')][_0x878d('0x45')]+'%'};return _0x4048f8;})});}_0x560eba=_[_0x878d('0x47')]({},_0x560eba,_0x11c582['options']);return _0x341895['getAgents'](_0x560eba);}})[_0x878d('0x2a')](function(_0x5080e5){if(_0x5080e5){_0x149933=_0x5080e5[_0x878d('0x40')];if(!_0x11c582[_0x878d('0x3a')][_0x878d('0x41')](_0x878d('0x42'))){_0x560eba[_0x878d('0x22')]=qs['limit'](_0x11c582[_0x878d('0x3a')]['limit']);_0x560eba['offset']=qs[_0x878d('0x20')](_0x11c582[_0x878d('0x3a')][_0x878d('0x20')]);}return _0x341895[_0x878d('0x88')](_0x560eba);}})[_0x878d('0x2a')](function(_0x231da8){if(_0x231da8){return _0x231da8?{'count':_0x149933,'rows':_0x231da8}:null;}})[_0x878d('0x2a')](respondWithResult(_0x4dedf9,null))[_0x878d('0x4d')](handleError(_0x4dedf9,null));}; \ No newline at end of file +var _0x9320=['end','json','offset','undefined','count','set','apply','reject','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','sort','OpenchannelQueueId','UserId','agent','createdAt','format','SIP','openchannelPause','updatedAt','getTeams','Team','ids','User','online','voicePause','interface','flatMap','Agents','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','tq.TeamId','from','team_has_openchannel_queues','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','all','union','compact','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status'];(function(_0x3931db,_0x411f01){var _0x531143=function(_0x175ca2){while(--_0x175ca2){_0x3931db['push'](_0x3931db['shift']());}};_0x531143(++_0x411f01);}(_0x9320,0x182));var _0x0932=function(_0x27348f,_0x201b74){_0x27348f=_0x27348f-0x0;var _0x4be4c3=_0x9320[_0x27348f];return _0x4be4c3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0932('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0932('0x1'));var moment=require(_0x0932('0x2'));var BPromise=require(_0x0932('0x3'));var Mustache=require(_0x0932('0x4'));var util=require(_0x0932('0x5'));var path=require(_0x0932('0x6'));var sox=require(_0x0932('0x7'));var csv=require(_0x0932('0x8'));var ejs=require(_0x0932('0x9'));var fs=require('fs');var fs_extra=require(_0x0932('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0932('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0932('0xc'));var toCsv=require(_0x0932('0x8'));var querystring=require(_0x0932('0xd'));var Papa=require(_0x0932('0xe'));var Redis=require(_0x0932('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0932('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0932('0x11'));var logger=require(_0x0932('0x12'))(_0x0932('0x13'));var utils=require('../../config/utils');var config=require(_0x0932('0x14'));var licenseUtil=require(_0x0932('0x15'));var db=require(_0x0932('0x16'))['db'];config[_0x0932('0x17')]=_[_0x0932('0x18')](config[_0x0932('0x17')],{'host':_0x0932('0x19'),'port':0x18eb});var socket=require(_0x0932('0x1a'))(new Redis(config[_0x0932('0x17')]));require(_0x0932('0x1b'))[_0x0932('0x1c')](socket);function respondWithStatusCode(_0x3a0c57,_0x188fc8){_0x188fc8=_0x188fc8||0xcc;return function(_0x425eea){if(_0x425eea){return _0x3a0c57[_0x0932('0x1d')](_0x188fc8);}return _0x3a0c57[_0x0932('0x1e')](_0x188fc8)[_0x0932('0x1f')]();};}function respondWithResult(_0x4dc8e2,_0x4de261){_0x4de261=_0x4de261||0xc8;return function(_0x448ad3){if(_0x448ad3){return _0x4dc8e2[_0x0932('0x1e')](_0x4de261)[_0x0932('0x20')](_0x448ad3);}};}function respondWithFilteredResult(_0x41f12e,_0x1aaf52){return function(_0x1a3c4d){if(_0x1a3c4d){var _0x245548=typeof _0x1aaf52[_0x0932('0x21')]===_0x0932('0x22')&&typeof _0x1aaf52['limit']===_0x0932('0x22');var _0xc71b29=_0x1a3c4d['count'];var _0x168b2e=_0x245548?0x0:_0x1aaf52[_0x0932('0x21')];var _0x42efbc=_0x245548?_0x1a3c4d[_0x0932('0x23')]:_0x1aaf52[_0x0932('0x21')]+_0x1aaf52['limit'];var _0x26f731;if(_0x42efbc>=_0xc71b29){_0x42efbc=_0xc71b29;_0x26f731=0xc8;}else{_0x26f731=0xce;}_0x41f12e[_0x0932('0x1e')](_0x26f731);return _0x41f12e[_0x0932('0x24')]('Content-Range',_0x168b2e+'-'+_0x42efbc+'/'+_0xc71b29)['json'](_0x1a3c4d);}return null;};}function patchUpdates(_0xe2ecb9){return function(_0x1d2b77){try{jsonpatch[_0x0932('0x25')](_0x1d2b77,_0xe2ecb9,!![]);}catch(_0x18d948){return BPromise[_0x0932('0x26')](_0x18d948);}return _0x1d2b77['save']();};}function saveUpdates(_0x5ad628,_0x30ae53){return function(_0x4a9091){if(_0x4a9091){return _0x4a9091[_0x0932('0x27')](_0x5ad628)[_0x0932('0x28')](function(_0x578d2a){return _0x578d2a;});}return null;};}function removeEntity(_0x12c297,_0x5868a3){return function(_0x521203){if(_0x521203){return _0x521203[_0x0932('0x29')]()[_0x0932('0x28')](function(){var _0x31b6d9=_0x521203[_0x0932('0x2a')]({'plain':!![]});var _0x300235='OpenchannelQueues';return db[_0x0932('0x2b')][_0x0932('0x29')]({'where':{'type':_0x300235,'resourceId':_0x31b6d9['id']}})[_0x0932('0x28')](function(){return _0x521203;});})[_0x0932('0x28')](function(){_0x12c297[_0x0932('0x1e')](0xcc)[_0x0932('0x1f')]();});}};}function handleEntityNotFound(_0x46d1e9,_0x575ebd){return function(_0x20cb15){if(!_0x20cb15){_0x46d1e9[_0x0932('0x1d')](0x194);}return _0x20cb15;};}function handleError(_0x1c6b15,_0x5d83a2){_0x5d83a2=_0x5d83a2||0x1f4;return function(_0x57513a){logger[_0x0932('0x2c')](_0x57513a[_0x0932('0x2d')]);if(_0x57513a['name']){delete _0x57513a[_0x0932('0x2e')];}_0x1c6b15['status'](_0x5d83a2)[_0x0932('0x2f')](_0x57513a);};}exports[_0x0932('0x30')]=function(_0x3c8826,_0x4d6682){var _0x1bd92a={},_0x584df1={},_0x32a2f6={'count':0x0,'rows':[]};var _0x5c2dca=_[_0x0932('0x31')](db[_0x0932('0x32')][_0x0932('0x33')],function(_0x3eeb40){return{'name':_0x3eeb40[_0x0932('0x34')],'type':_0x3eeb40[_0x0932('0x35')]['key']};});_0x584df1[_0x0932('0x36')]=_[_0x0932('0x31')](_0x5c2dca,_0x0932('0x2e'));_0x584df1[_0x0932('0x37')]=_[_0x0932('0x38')](_0x3c8826[_0x0932('0x37')]);_0x584df1[_0x0932('0x39')]=_[_0x0932('0x3a')](_0x584df1['model'],_0x584df1['query']);_0x1bd92a[_0x0932('0x3b')]=_[_0x0932('0x3a')](_0x584df1[_0x0932('0x36')],qs['fields'](_0x3c8826[_0x0932('0x37')]['fields']));_0x1bd92a[_0x0932('0x3b')]=_0x1bd92a[_0x0932('0x3b')][_0x0932('0x3c')]?_0x1bd92a['attributes']:_0x584df1[_0x0932('0x36')];if(!_0x3c8826[_0x0932('0x37')][_0x0932('0x3d')](_0x0932('0x3e'))){_0x1bd92a['limit']=qs[_0x0932('0x3f')](_0x3c8826[_0x0932('0x37')]['limit']);_0x1bd92a[_0x0932('0x21')]=qs[_0x0932('0x21')](_0x3c8826[_0x0932('0x37')][_0x0932('0x21')]);}_0x1bd92a[_0x0932('0x40')]=qs['sort'](_0x3c8826[_0x0932('0x37')]['sort']);_0x1bd92a[_0x0932('0x41')]=qs['filters'](_[_0x0932('0x42')](_0x3c8826[_0x0932('0x37')],_0x584df1[_0x0932('0x39')]),_0x5c2dca);if(_0x3c8826['query'][_0x0932('0x43')]){_0x1bd92a[_0x0932('0x41')]=_[_0x0932('0x44')](_0x1bd92a['where'],{'$or':_[_0x0932('0x31')](_0x5c2dca,function(_0x460de0){if(_0x460de0[_0x0932('0x35')]!==_0x0932('0x45')){var _0xb808d4={};_0xb808d4[_0x460de0[_0x0932('0x2e')]]={'$like':'%'+_0x3c8826[_0x0932('0x37')]['filter']+'%'};return _0xb808d4;}})});}_0x1bd92a=_['merge']({},_0x1bd92a,_0x3c8826[_0x0932('0x46')]);var _0x1d15e4={'where':_0x1bd92a['where']};return db[_0x0932('0x32')][_0x0932('0x23')](_0x1d15e4)[_0x0932('0x28')](function(_0xaeae13){_0x32a2f6[_0x0932('0x23')]=_0xaeae13;if(_0x3c8826[_0x0932('0x37')][_0x0932('0x47')]){_0x1bd92a[_0x0932('0x48')]=[{'all':!![]}];}return db['OpenchannelQueue'][_0x0932('0x49')](_0x1bd92a);})[_0x0932('0x28')](function(_0x56d457){_0x32a2f6[_0x0932('0x4a')]=_0x56d457;return _0x32a2f6;})['then'](respondWithFilteredResult(_0x4d6682,_0x1bd92a))[_0x0932('0x4b')](handleError(_0x4d6682,null));};exports[_0x0932('0x4c')]=function(_0x293a13,_0x1611c4){var _0x3b1a43={'raw':!![],'where':{'id':_0x293a13[_0x0932('0x4d')]['id']}},_0xbeae68={};_0xbeae68[_0x0932('0x36')]=_[_0x0932('0x38')](db[_0x0932('0x32')][_0x0932('0x33')]);_0xbeae68[_0x0932('0x37')]=_[_0x0932('0x38')](_0x293a13[_0x0932('0x37')]);_0xbeae68[_0x0932('0x39')]=_[_0x0932('0x3a')](_0xbeae68[_0x0932('0x36')],_0xbeae68[_0x0932('0x37')]);_0x3b1a43[_0x0932('0x3b')]=_[_0x0932('0x3a')](_0xbeae68[_0x0932('0x36')],qs[_0x0932('0x4e')](_0x293a13[_0x0932('0x37')][_0x0932('0x4e')]));_0x3b1a43['attributes']=_0x3b1a43[_0x0932('0x3b')][_0x0932('0x3c')]?_0x3b1a43[_0x0932('0x3b')]:_0xbeae68[_0x0932('0x36')];if(_0x293a13[_0x0932('0x37')][_0x0932('0x47')]){_0x3b1a43[_0x0932('0x48')]=[{'all':!![]}];}_0x3b1a43=_[_0x0932('0x44')]({},_0x3b1a43,_0x293a13[_0x0932('0x46')]);return db[_0x0932('0x32')][_0x0932('0x4f')](_0x3b1a43)['then'](handleEntityNotFound(_0x1611c4,null))[_0x0932('0x28')](respondWithResult(_0x1611c4,null))[_0x0932('0x4b')](handleError(_0x1611c4,null));};exports[_0x0932('0x50')]=function(_0x58fd39,_0x173651){return db[_0x0932('0x32')][_0x0932('0x50')](_0x58fd39[_0x0932('0x51')],{})[_0x0932('0x28')](function(_0x3b95d2){var _0x7ad978=_0x58fd39['user'][_0x0932('0x2a')]({'plain':!![]});if(!_0x7ad978)throw new Error(_0x0932('0x52'));if(_0x7ad978[_0x0932('0x53')]===_0x0932('0x54')){var _0x1813bd=_0x3b95d2[_0x0932('0x2a')]({'plain':!![]});var _0x152166=_0x0932('0x55');return db['UserProfileSection'][_0x0932('0x4f')]({'where':{'name':_0x152166,'userProfileId':_0x7ad978['userProfileId']},'raw':!![]})[_0x0932('0x28')](function(_0x2cc8f6){if(_0x2cc8f6&&_0x2cc8f6['autoAssociation']===0x0){return db[_0x0932('0x2b')][_0x0932('0x50')]({'name':_0x1813bd['name'],'resourceId':_0x1813bd['id'],'type':_0x2cc8f6[_0x0932('0x2e')],'sectionId':_0x2cc8f6['id']},{})['then'](function(){return _0x3b95d2;});}else{return _0x3b95d2;}})[_0x0932('0x4b')](function(_0x224369){logger[_0x0932('0x2c')](_0x0932('0x56'),_0x224369);throw _0x224369;});}return _0x3b95d2;})[_0x0932('0x28')](respondWithResult(_0x173651,0xc9))[_0x0932('0x4b')](handleError(_0x173651,null));};exports['update']=function(_0x463703,_0x489ca3){if(_0x463703[_0x0932('0x51')]['id']){delete _0x463703['body']['id'];}return db[_0x0932('0x32')][_0x0932('0x4f')]({'where':{'id':_0x463703['params']['id']}})[_0x0932('0x28')](handleEntityNotFound(_0x489ca3,null))[_0x0932('0x28')](saveUpdates(_0x463703[_0x0932('0x51')],null))[_0x0932('0x28')](respondWithResult(_0x489ca3,null))[_0x0932('0x4b')](handleError(_0x489ca3,null));};exports[_0x0932('0x29')]=function(_0x202c79,_0x3b7a39){return db['OpenchannelQueue'][_0x0932('0x4f')]({'where':{'id':_0x202c79[_0x0932('0x4d')]['id']}})[_0x0932('0x28')](handleEntityNotFound(_0x3b7a39,null))[_0x0932('0x28')](removeEntity(_0x3b7a39,null))[_0x0932('0x4b')](handleError(_0x3b7a39,null));};exports[_0x0932('0x57')]=function(_0x1920b4,_0x3d75db){return db['OpenchannelQueue']['describe']()['then'](respondWithResult(_0x3d75db,null))[_0x0932('0x4b')](handleError(_0x3d75db,null));};exports[_0x0932('0x58')]=function(_0x10b143,_0x156673,_0x282b70){var _0x2122f6={'raw':!![],'where':{}},_0x41141a={},_0x2c8e5c;return db['OpenchannelQueue'][_0x0932('0x59')]({'where':{'id':_0x10b143['params']['id']}})[_0x0932('0x28')](handleEntityNotFound(_0x156673,null))[_0x0932('0x28')](function(_0x231cd5){if(_0x231cd5){_0x2c8e5c=_0x231cd5['get']({'plain':!![]});_0x41141a['model']=_[_0x0932('0x38')](db[_0x0932('0x5a')][_0x0932('0x33')]);_0x41141a[_0x0932('0x37')]=_[_0x0932('0x38')](_0x10b143[_0x0932('0x37')]);_0x41141a[_0x0932('0x39')]=_['intersection'](_0x41141a[_0x0932('0x36')],_0x41141a[_0x0932('0x37')]);_0x2122f6[_0x0932('0x3b')]=_[_0x0932('0x3a')](_0x41141a[_0x0932('0x36')],qs[_0x0932('0x4e')](_0x10b143[_0x0932('0x37')][_0x0932('0x4e')]));_0x2122f6[_0x0932('0x3b')]=_0x2122f6[_0x0932('0x3b')]['length']?_0x2122f6['attributes']:_0x41141a['model'];if(!_0x10b143[_0x0932('0x37')][_0x0932('0x3d')](_0x0932('0x3e'))){_0x2122f6[_0x0932('0x3f')]=qs[_0x0932('0x3f')](_0x10b143[_0x0932('0x37')]['limit']);_0x2122f6[_0x0932('0x21')]=qs[_0x0932('0x21')](_0x10b143[_0x0932('0x37')]['offset']);}_0x2122f6[_0x0932('0x40')]=qs[_0x0932('0x5b')](_0x10b143[_0x0932('0x37')]['sort']);_0x2122f6[_0x0932('0x41')]=qs[_0x0932('0x39')](_['pick'](_0x10b143[_0x0932('0x37')],_0x41141a[_0x0932('0x39')]));_0x2122f6[_0x0932('0x41')][_0x0932('0x5c')]=_0x231cd5['id'];if(_0x10b143[_0x0932('0x37')][_0x0932('0x43')]){_0x2122f6[_0x0932('0x41')]=_[_0x0932('0x44')](_0x2122f6[_0x0932('0x41')],{'$or':_[_0x0932('0x31')](_0x2122f6[_0x0932('0x3b')],function(_0xb20d35){var _0xde9940={};_0xde9940[_0xb20d35]={'$like':'%'+_0x10b143[_0x0932('0x37')][_0x0932('0x43')]+'%'};return _0xde9940;})});}_0x2122f6=_['merge']({},_0x2122f6,_0x10b143[_0x0932('0x46')]);return db[_0x0932('0x5a')][_0x0932('0x49')](_0x2122f6);}})[_0x0932('0x28')](function(_0x979b38){if(_0x979b38){return db['User']['findAndCountAll']({'where':{'id':_[_0x0932('0x31')](_0x979b38,_0x0932('0x5d')),'role':_0x0932('0x5e')},'attributes':['id',_0x0932('0x2e'),'openchannelPause','updatedAt',_0x0932('0x5f')]});}})[_0x0932('0x28')](function(_0xb83b35){if(_0xb83b35){return{'count':_0xb83b35[_0x0932('0x23')],'rows':_[_0x0932('0x31')](_0xb83b35[_0x0932('0x4a')],function(_0x2303e9){return{'membername':_0x2303e9[_0x0932('0x2e')],'UserId':_0x2303e9['id'],'queue_name':_0x2c8e5c[_0x0932('0x2e')],'OpenchannelQueueId':_0x2c8e5c['id'],'interface':util[_0x0932('0x60')]('%s/%s',_0x0932('0x61'),_0x2303e9[_0x0932('0x2e')]),'penalty':0x0,'paused':_0x2303e9[_0x0932('0x62')],'createdAt':_0x2303e9['createdAt'],'updatedAt':_0x2303e9[_0x0932('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0932('0x28')](respondWithFilteredResult(_0x156673,_0x2122f6))[_0x0932('0x4b')](handleError(_0x156673,null));};exports[_0x0932('0x64')]=function(_0x100b25,_0x7389a4,_0x5b1fd7){var _0x44dfb1={};var _0x1b191c={};var _0x3b480d;var _0x2809d4;return db[_0x0932('0x32')][_0x0932('0x59')]({'where':{'id':_0x100b25[_0x0932('0x4d')]['id']}})[_0x0932('0x28')](handleEntityNotFound(_0x7389a4,null))['then'](function(_0x5e19e7){if(_0x5e19e7){_0x3b480d=_0x5e19e7;_0x1b191c[_0x0932('0x36')]=_['keys'](db[_0x0932('0x65')][_0x0932('0x33')]);_0x1b191c['query']=_[_0x0932('0x38')](_0x100b25[_0x0932('0x37')]);_0x1b191c[_0x0932('0x39')]=_['intersection'](_0x1b191c[_0x0932('0x36')],_0x1b191c[_0x0932('0x37')]);_0x44dfb1['attributes']=_[_0x0932('0x3a')](_0x1b191c[_0x0932('0x36')],qs[_0x0932('0x4e')](_0x100b25[_0x0932('0x37')][_0x0932('0x4e')]));_0x44dfb1['attributes']=_0x44dfb1[_0x0932('0x3b')][_0x0932('0x3c')]?_0x44dfb1[_0x0932('0x3b')]:_0x1b191c['model'];_0x44dfb1[_0x0932('0x40')]=qs[_0x0932('0x5b')](_0x100b25[_0x0932('0x37')][_0x0932('0x5b')]);_0x44dfb1[_0x0932('0x41')]=qs[_0x0932('0x39')](_[_0x0932('0x42')](_0x100b25['query'],_0x1b191c[_0x0932('0x39')]));if(_0x100b25[_0x0932('0x37')]['filter']){_0x44dfb1['where']=_['merge'](_0x44dfb1['where'],{'$or':_['map'](_0x44dfb1[_0x0932('0x3b')],function(_0x1a21b5){var _0x58864b={};_0x58864b[_0x1a21b5]={'$like':'%'+_0x100b25[_0x0932('0x37')][_0x0932('0x43')]+'%'};return _0x58864b;})});}_0x44dfb1=_[_0x0932('0x44')]({},_0x44dfb1,_0x100b25[_0x0932('0x46')]);return _0x3b480d[_0x0932('0x64')](_0x44dfb1);}})[_0x0932('0x28')](function(_0x3227b7){if(_0x3227b7){_0x2809d4=_0x3227b7['length'];if(!_0x100b25['query'][_0x0932('0x3d')](_0x0932('0x3e'))){_0x44dfb1['limit']=qs['limit'](_0x100b25[_0x0932('0x37')][_0x0932('0x3f')]);_0x44dfb1['offset']=qs['offset'](_0x100b25[_0x0932('0x37')][_0x0932('0x21')]);}return _0x3b480d[_0x0932('0x64')](_0x44dfb1);}})[_0x0932('0x28')](function(_0x4de31f){if(_0x4de31f){return _0x4de31f?{'count':_0x2809d4,'rows':_0x4de31f}:null;}})[_0x0932('0x28')](respondWithResult(_0x7389a4,null))['catch'](handleError(_0x7389a4,null));};exports['addTeams']=function(_0x39295c,_0x4132d4,_0x433565){var _0x2fa556=_0x39295c['body'][_0x0932('0x66')];return db[_0x0932('0x65')][_0x0932('0x49')]({'where':{'id':_0x2fa556},'attributes':['id'],'include':[{'model':db[_0x0932('0x67')],'as':'Agents','attributes':['id',_0x0932('0x2e'),_0x0932('0x68'),_0x0932('0x69'),_0x0932('0x6a')],'raw':!![]}]})[_0x0932('0x28')](function(_0xd6d4d2){if(_0xd6d4d2){var _0x44efb3=_[_0x0932('0x6b')](_0xd6d4d2,function(_0x114cb7){var _0x3f088e=_0x114cb7[_0x0932('0x2a')]({'plain':!![]});return _0x3f088e[_0x0932('0x6c')];});return db[_0x0932('0x32')][_0x0932('0x4f')]({'where':{'id':_0x39295c[_0x0932('0x4d')]['id']}})['then'](function(_0x2a5e7a){return db[_0x0932('0x6d')][_0x0932('0x6e')](function(_0x19d761){return _0x2a5e7a[_0x0932('0x6f')](_0x2fa556,{'transaction':_0x19d761})['then'](function(){return BPromise['each'](_0x44efb3,function(_0x300bfb){return db[_0x0932('0x5a')][_0x0932('0x70')]({'where':{'UserId':_0x300bfb['id'],'OpenchannelQueueId':_0x39295c[_0x0932('0x4d')]['id']},'transaction':_0x19d761});});})[_0x0932('0x28')](function(){_0x44efb3[_0x0932('0x71')](function(_0x2a44e2){socket[_0x0932('0x72')](_0x0932('0x73'),{'UserId':_0x2a44e2['id'],'OpenchannelQueueId':_0x2a5e7a['id']});});});});});}})[_0x0932('0x28')](respondWithStatusCode(_0x4132d4,null))[_0x0932('0x4b')](handleError(_0x4132d4,null));};exports['removeTeams']=function(_0x2cbf88,_0x113319,_0x3e11f3){return db[_0x0932('0x65')][_0x0932('0x49')]({'where':{'id':_0x2cbf88[_0x0932('0x37')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0932('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x113319,null))[_0x0932('0x28')](function(_0x34e44f){var _0x1dc158=_['map'](_0x34e44f,'id');var _0x14eb07=[];var _0x4755bc=[];var _0x4b6450=squel['select']();_0x4b6450[_0x0932('0x74')](_0x0932('0x75'))[_0x0932('0x76')](_0x0932('0x77'),'tq')['join'](_0x0932('0x78'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0932('0x41')](_0x0932('0x79'),_0x2cbf88[_0x0932('0x4d')]['id']);for(var _0x5143ca=0x0;_0x5143ca<_0x34e44f[_0x0932('0x3c')];_0x5143ca+=0x1){let _0x1a71e0=_0x34e44f[_0x5143ca];for(var _0x57c937=0x0;_0x57c937<_0x1a71e0['Agents'][_0x0932('0x3c')];_0x57c937+=0x1){let _0xdfe0bf=_0x1a71e0[_0x0932('0x6c')][_0x57c937];var _0x2cfbd1=_0x4b6450[_0x0932('0x7a')]();_0x2cfbd1[_0x0932('0x41')](_0x0932('0x7b'),_0xdfe0bf['id']);_0x4755bc[_0x0932('0x7c')](db[_0x0932('0x6d')]['query'](_0x2cfbd1[_0x0932('0x7d')](),{'type':db[_0x0932('0x6d')][_0x0932('0x7e')]['SELECT']})[_0x0932('0x28')](function(_0x579d61){if(_0x579d61['length']===0x1){return _0xdfe0bf['id'];}else{var _0x28391d=_['every'](_[_0x0932('0x31')](_0x579d61,_0x0932('0x7f')),function(_0x1310e9){return _['includes'](_0x1dc158,_0x1310e9);});if(_0x28391d){return _0xdfe0bf['id'];}}}));}}return BPromise[_0x0932('0x80')](_0x4755bc)[_0x0932('0x28')](function(_0x178d1d){_0x14eb07=_(_0x14eb07)[_0x0932('0x81')](_0x178d1d)[_0x0932('0x82')]()['value']();return db[_0x0932('0x32')][_0x0932('0x4f')]({'where':{'id':_0x2cbf88[_0x0932('0x4d')]['id']}})['then'](function(_0x16e971){return db[_0x0932('0x6d')][_0x0932('0x6e')](function(_0x228c18){return _0x16e971[_0x0932('0x83')](_0x2cbf88['query']['ids'],{'transaction':_0x228c18})[_0x0932('0x28')](function(){if(!_['isEmpty'](_0x14eb07)){return _0x16e971[_0x0932('0x84')](_0x14eb07,{'transaction':_0x228c18});}})[_0x0932('0x28')](function(){_0x14eb07['forEach'](function(_0x683f3e){socket[_0x0932('0x72')](_0x0932('0x85'),{'UserId':_0x683f3e,'OpenchannelQueueId':_0x16e971['id']});});});});});});})[_0x0932('0x28')](respondWithStatusCode(_0x113319,null))[_0x0932('0x4b')](handleError(_0x113319,null));};exports[_0x0932('0x86')]=function(_0x5bfce2,_0x585ad5,_0x48204c){return db[_0x0932('0x32')]['find']({'where':{'id':_0x5bfce2[_0x0932('0x4d')]['id']}})[_0x0932('0x28')](handleEntityNotFound(_0x585ad5,null))[_0x0932('0x28')](function(_0x4e7ba8){if(_0x4e7ba8){return _0x4e7ba8[_0x0932('0x86')](_0x5bfce2[_0x0932('0x51')][_0x0932('0x66')],_[_0x0932('0x87')](_0x5bfce2['body'],[_0x0932('0x66'),'id'])||{})[_0x0932('0x88')](function(_0xddffb5){for(var _0x170b67=0x0;_0x170b67<_0x5bfce2[_0x0932('0x51')][_0x0932('0x66')][_0x0932('0x3c')];_0x170b67+=0x1){socket['emit']('userOpenchannelQueue:save',{'UserId':Number(_0x5bfce2['body'][_0x0932('0x66')][_0x170b67]),'OpenchannelQueueId':Number(_0x5bfce2[_0x0932('0x4d')]['id'])});}return _0xddffb5;});}})[_0x0932('0x28')](respondWithResult(_0x585ad5,null))['catch'](handleError(_0x585ad5,null));};exports['removeAgents']=function(_0x25108d,_0x1da7e6,_0xeb3855){return db['OpenchannelQueue'][_0x0932('0x4f')]({'where':{'id':_0x25108d[_0x0932('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1da7e6,null))['then'](function(_0x2e9f6b){if(_0x2e9f6b){return _0x2e9f6b[_0x0932('0x84')](_0x25108d['query'][_0x0932('0x66')])['then'](function(){if(_[_0x0932('0x89')](_0x25108d[_0x0932('0x37')]['ids'])){for(var _0x54ba9a=0x0;_0x54ba9a<_0x25108d['query'][_0x0932('0x66')][_0x0932('0x3c')];_0x54ba9a+=0x1){socket[_0x0932('0x72')](_0x0932('0x85'),{'UserId':Number(_0x25108d[_0x0932('0x37')][_0x0932('0x66')][_0x54ba9a]),'OpenchannelQueueId':Number(_0x25108d[_0x0932('0x4d')]['id'])});}}else{socket[_0x0932('0x72')]('userOpenchannelQueue:remove',{'UserId':Number(_0x25108d[_0x0932('0x37')]['ids']),'OpenchannelQueueId':Number(_0x25108d[_0x0932('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x1da7e6,null))[_0x0932('0x4b')](handleError(_0x1da7e6,null));};exports[_0x0932('0x8a')]=function(_0x294f58,_0x3aaca4,_0x3bdeb5){var _0x1224f3={};var _0x37a7bc={};var _0x211232;var _0x29a663;return db['OpenchannelQueue'][_0x0932('0x59')]({'where':{'id':_0x294f58['params']['id']}})['then'](handleEntityNotFound(_0x3aaca4,null))['then'](function(_0x2a8bb8){if(_0x2a8bb8){_0x211232=_0x2a8bb8;_0x37a7bc['model']=_[_0x0932('0x38')](db[_0x0932('0x67')][_0x0932('0x33')]);_0x37a7bc[_0x0932('0x37')]=_['keys'](_0x294f58[_0x0932('0x37')]);_0x37a7bc[_0x0932('0x39')]=_[_0x0932('0x3a')](_0x37a7bc[_0x0932('0x36')],_0x37a7bc[_0x0932('0x37')]);_0x1224f3['attributes']=_[_0x0932('0x3a')](_0x37a7bc[_0x0932('0x36')],qs[_0x0932('0x4e')](_0x294f58[_0x0932('0x37')][_0x0932('0x4e')]));_0x1224f3[_0x0932('0x3b')]=_0x1224f3[_0x0932('0x3b')]['length']?_0x1224f3[_0x0932('0x3b')]:_0x37a7bc[_0x0932('0x36')];_0x1224f3[_0x0932('0x40')]=qs[_0x0932('0x5b')](_0x294f58['query'][_0x0932('0x5b')]);_0x1224f3[_0x0932('0x41')]=qs['filters'](_['pick'](_0x294f58[_0x0932('0x37')],_0x37a7bc['filters']));if(_0x294f58['query'][_0x0932('0x43')]){_0x1224f3[_0x0932('0x41')]=_['merge'](_0x1224f3[_0x0932('0x41')],{'$or':_[_0x0932('0x31')](_0x1224f3[_0x0932('0x3b')],function(_0x513230){var _0x24d99f={};_0x24d99f[_0x513230]={'$like':'%'+_0x294f58[_0x0932('0x37')]['filter']+'%'};return _0x24d99f;})});}_0x1224f3=_[_0x0932('0x44')]({},_0x1224f3,_0x294f58['options']);return _0x211232[_0x0932('0x8a')](_0x1224f3);}})[_0x0932('0x28')](function(_0x1cc82a){if(_0x1cc82a){_0x29a663=_0x1cc82a[_0x0932('0x3c')];if(!_0x294f58['query']['hasOwnProperty']('nolimit')){_0x1224f3[_0x0932('0x3f')]=qs[_0x0932('0x3f')](_0x294f58[_0x0932('0x37')][_0x0932('0x3f')]);_0x1224f3[_0x0932('0x21')]=qs[_0x0932('0x21')](_0x294f58[_0x0932('0x37')]['offset']);}return _0x211232[_0x0932('0x8a')](_0x1224f3);}})[_0x0932('0x28')](function(_0x294504){if(_0x294504){return _0x294504?{'count':_0x29a663,'rows':_0x294504}:null;}})[_0x0932('0x28')](respondWithResult(_0x3aaca4,null))['catch'](handleError(_0x3aaca4,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 4ef5757..1cdcc84 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 _0x9047=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0xa90789,_0x5246c9){var _0x4f63e6=function(_0x1000bd){while(--_0x1000bd){_0xa90789['push'](_0xa90789['shift']());}};_0x4f63e6(++_0x5246c9);}(_0x9047,0x1cb));var _0x7904=function(_0x227831,_0x1036ab){_0x227831=_0x227831-0x0;var _0x58dc93=_0x9047[_0x227831];return _0x58dc93;};'use strict';var EventEmitter=require(_0x7904('0x0'));var OpenchannelQueue=require(_0x7904('0x1'))['db'][_0x7904('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x7904('0x3')](0x0);var events={'afterCreate':_0x7904('0x4'),'afterUpdate':_0x7904('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a009d){return function(_0x103c1a,_0x1cee97,_0x24f3cc){OpenchannelQueueEvents[_0x7904('0x6')](_0x1a009d+':'+_0x103c1a['id'],_0x103c1a);OpenchannelQueueEvents[_0x7904('0x6')](_0x1a009d,_0x103c1a);_0x24f3cc(null);};}for(var e in events){if(events[_0x7904('0x7')](e)){var event=events[e];OpenchannelQueue[_0x7904('0x8')](e,emitEvent(event));}}module[_0x7904('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xf2c1=['update','remove','emit','hasOwnProperty','exports','OpenchannelQueue','setMaxListeners'];(function(_0x510606,_0x417971){var _0x382235=function(_0x4eaa76){while(--_0x4eaa76){_0x510606['push'](_0x510606['shift']());}};_0x382235(++_0x417971);}(_0xf2c1,0x19b));var _0x1f2c=function(_0x4c5d68,_0x482d04){_0x4c5d68=_0x4c5d68-0x0;var _0x148235=_0xf2c1[_0x4c5d68];return _0x148235;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require('../../mysqldb')['db'][_0x1f2c('0x0')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x1f2c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f2c('0x2'),'afterDestroy':_0x1f2c('0x3')};function emitEvent(_0xc2790){return function(_0x46e8b2,_0x5f0d64,_0x3b89b3){OpenchannelQueueEvents['emit'](_0xc2790+':'+_0x46e8b2['id'],_0x46e8b2);OpenchannelQueueEvents[_0x1f2c('0x4')](_0xc2790,_0x46e8b2);_0x3b89b3(null);};}for(var e in events){if(events[_0x1f2c('0x5')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x1f2c('0x6')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index c8f6ac3..51c58f8 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 _0x4472=['util','../../config/logger','request-promise','path','rimraf','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues'];(function(_0x315d54,_0x333bec){var _0x21c13e=function(_0x320f9c){while(--_0x320f9c){_0x315d54['push'](_0x315d54['shift']());}};_0x21c13e(++_0x333bec);}(_0x4472,0x1b0));var _0x2447=function(_0x557322,_0x54acd7){_0x557322=_0x557322-0x0;var _0x102a31=_0x4472[_0x557322];return _0x102a31;};'use strict';var _=require('lodash');var util=require(_0x2447('0x0'));var logger=require(_0x2447('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2447('0x2'));var fs=require('fs');var path=require(_0x2447('0x3'));var rimraf=require(_0x2447('0x4'));var config=require('../../config/environment');var attributes=require(_0x2447('0x5'));module['exports']=function(_0x47891a,_0x2ef756){return _0x47891a[_0x2447('0x6')](_0x2447('0x7'),attributes,{'tableName':_0x2447('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf05b=['rimraf','../../config/environment','exports','define','OpenchannelQueue','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5182a6,_0x1b971a){var _0x3896a6=function(_0x88421f){while(--_0x88421f){_0x5182a6['push'](_0x5182a6['shift']());}};_0x3896a6(++_0x1b971a);}(_0xf05b,0x71));var _0xbf05=function(_0x4d0fe6,_0x5367e4){_0x4d0fe6=_0x4d0fe6-0x0;var _0x104846=_0xf05b[_0x4d0fe6];return _0x104846;};'use strict';var _=require(_0xbf05('0x0'));var util=require(_0xbf05('0x1'));var logger=require(_0xbf05('0x2'))(_0xbf05('0x3'));var moment=require(_0xbf05('0x4'));var BPromise=require(_0xbf05('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf05('0x6'));var rimraf=require(_0xbf05('0x7'));var config=require(_0xbf05('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0xbf05('0x9')]=function(_0x123ed,_0x276f9e){return _0x123ed[_0xbf05('0xa')](_0xbf05('0xb'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 08b5be4..2a3c664 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 _0x872d=['../../config/environment','jayson/promise','client','http','defaults','socket.io-emitter','redis','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','find','ShowOpenchannelQueue','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5ad0d7,_0x2645f8){var _0xd83bd=function(_0x33d3bd){while(--_0x33d3bd){_0x5ad0d7['push'](_0x5ad0d7['shift']());}};_0xd83bd(++_0x2645f8);}(_0x872d,0xe8));var _0xd872=function(_0x2ede75,_0x22b2db){_0x2ede75=_0x2ede75-0x0;var _0x1c0a44=_0x872d[_0x2ede75];return _0x1c0a44;};'use strict';var _=require(_0xd872('0x0'));var util=require(_0xd872('0x1'));var moment=require(_0xd872('0x2'));var BPromise=require('bluebird');var rs=require(_0xd872('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd872('0x4'))['db'];var utils=require(_0xd872('0x5'));var logger=require(_0xd872('0x6'))(_0xd872('0x7'));var config=require(_0xd872('0x8'));var jayson=require(_0xd872('0x9'));var client=jayson[_0xd872('0xa')][_0xd872('0xb')]({'port':0x232a});config['redis']=_[_0xd872('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd872('0xd'))(new Redis(config[_0xd872('0xe')]));require('./openchannelQueue.socket')[_0xd872('0xf')](socket);function respondWithRpcPromise(_0x1b7a33,_0x23bc8e,_0x59d2a6){return new BPromise(function(_0x54ba6f,_0x22e506){return client[_0xd872('0x10')](_0x1b7a33,_0x59d2a6)[_0xd872('0x11')](function(_0x59a1a1){logger[_0xd872('0x12')](_0xd872('0x13'),_0x23bc8e,_0xd872('0x14'));logger[_0xd872('0x15')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x23bc8e,_0xd872('0x14'),JSON[_0xd872('0x16')](_0x59a1a1));if(_0x59a1a1['error']){if(_0x59a1a1[_0xd872('0x17')][_0xd872('0x18')]===0x1f4){logger[_0xd872('0x17')](_0xd872('0x13'),_0x23bc8e,_0x59a1a1[_0xd872('0x17')]['message']);return _0x22e506(_0x59a1a1[_0xd872('0x17')][_0xd872('0x19')]);}logger[_0xd872('0x17')](_0xd872('0x13'),_0x23bc8e,_0x59a1a1[_0xd872('0x17')][_0xd872('0x19')]);return _0x54ba6f(_0x59a1a1[_0xd872('0x17')][_0xd872('0x19')]);}else{logger[_0xd872('0x12')](_0xd872('0x13'),_0x23bc8e,_0xd872('0x14'));_0x54ba6f(_0x59a1a1[_0xd872('0x1a')][_0xd872('0x19')]);}})[_0xd872('0x1b')](function(_0x2cef25){logger[_0xd872('0x17')](_0xd872('0x13'),_0x23bc8e,_0x2cef25);_0x22e506(_0x2cef25);});});}exports['GetOpenchannelQueue']=function(_0x5caf21){var _0x469e40=this;return new Promise(function(_0x2bb4a0,_0x30c708){return db['OpenchannelQueue'][_0xd872('0x1c')]({'raw':_0x5caf21[_0xd872('0x1d')]?_0x5caf21['options'][_0xd872('0x1e')]===undefined?!![]:![]:!![],'where':_0x5caf21[_0xd872('0x1d')]?_0x5caf21['options'][_0xd872('0x1f')]||null:null,'attributes':_0x5caf21[_0xd872('0x1d')]?_0x5caf21[_0xd872('0x1d')][_0xd872('0x20')]||null:null,'limit':_0x5caf21[_0xd872('0x1d')]?_0x5caf21[_0xd872('0x1d')][_0xd872('0x21')]||null:null,'include':_0x5caf21['options']?_0x5caf21['options'][_0xd872('0x22')]?_[_0xd872('0x23')](_0x5caf21['options'][_0xd872('0x22')],function(_0x427ca3){return{'model':db[_0x427ca3[_0xd872('0x24')]],'as':_0x427ca3['as'],'attributes':_0x427ca3[_0xd872('0x20')],'include':_0x427ca3['include']?_[_0xd872('0x23')](_0x427ca3['include'],function(_0x568744){return{'model':db[_0x568744[_0xd872('0x24')]],'as':_0x568744['as'],'attributes':_0x568744[_0xd872('0x20')],'include':_0x568744[_0xd872('0x22')]?_['map'](_0x568744[_0xd872('0x22')],function(_0x5c522a){return{'model':db[_0x5c522a['model']],'as':_0x5c522a['as'],'attributes':_0x5c522a[_0xd872('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f73cd){logger[_0xd872('0x12')]('GetOpenchannelQueue',_0x5caf21);logger['debug'](_0xd872('0x25'),_0x5caf21,JSON[_0xd872('0x16')](_0x4f73cd));_0x2bb4a0(_0x4f73cd);})[_0xd872('0x1b')](function(_0xc194ed){logger[_0xd872('0x17')](_0xd872('0x25'),_0xc194ed[_0xd872('0x19')],_0x5caf21);_0x30c708(_0x469e40[_0xd872('0x17')](0x1f4,_0xc194ed[_0xd872('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x544db9){var _0x5808ee=this;return new Promise(function(_0x5e36d9,_0x11ee5f){return db['OpenchannelQueue'][_0xd872('0x26')]({'raw':_0x544db9[_0xd872('0x1d')]?_0x544db9[_0xd872('0x1d')][_0xd872('0x1e')]===undefined?!![]:![]:!![],'where':_0x544db9[_0xd872('0x1d')]?_0x544db9['options'][_0xd872('0x1f')]||null:null,'attributes':_0x544db9[_0xd872('0x1d')]?_0x544db9[_0xd872('0x1d')][_0xd872('0x20')]||null:null,'include':_0x544db9[_0xd872('0x1d')]?_0x544db9[_0xd872('0x1d')][_0xd872('0x22')]?_[_0xd872('0x23')](_0x544db9[_0xd872('0x1d')][_0xd872('0x22')],function(_0x5ac7e3){return{'model':db[_0x5ac7e3[_0xd872('0x24')]],'as':_0x5ac7e3['as'],'attributes':_0x5ac7e3['attributes'],'include':_0x5ac7e3[_0xd872('0x22')]?_[_0xd872('0x23')](_0x5ac7e3[_0xd872('0x22')],function(_0x375a08){return{'model':db[_0x375a08['model']],'as':_0x375a08['as'],'attributes':_0x375a08['attributes'],'include':_0x375a08[_0xd872('0x22')]?_[_0xd872('0x23')](_0x375a08[_0xd872('0x22')],function(_0x1e7e1e){return{'model':db[_0x1e7e1e[_0xd872('0x24')]],'as':_0x1e7e1e['as'],'attributes':_0x1e7e1e[_0xd872('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x446a38){logger[_0xd872('0x12')](_0xd872('0x27'),_0x544db9);logger['debug'](_0xd872('0x27'),_0x544db9,JSON[_0xd872('0x16')](_0x446a38));_0x5e36d9(_0x446a38);})[_0xd872('0x1b')](function(_0x15637c){logger[_0xd872('0x17')](_0xd872('0x27'),_0x15637c[_0xd872('0x19')],_0x544db9);_0x11ee5f(_0x5808ee[_0xd872('0x17')](0x1f4,_0x15637c[_0xd872('0x19')]));});});}; \ No newline at end of file +var _0xe4dc=['request','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','ShowOpenchannelQueue','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./openchannelQueue.socket'];(function(_0x5e5204,_0x489462){var _0x1dc90f=function(_0x3c067a){while(--_0x3c067a){_0x5e5204['push'](_0x5e5204['shift']());}};_0x1dc90f(++_0x489462);}(_0xe4dc,0x8f));var _0xce4d=function(_0x4942ff,_0x251f9b){_0x4942ff=_0x4942ff-0x0;var _0x41d222=_0xe4dc[_0x4942ff];return _0x41d222;};'use strict';var _=require('lodash');var util=require(_0xce4d('0x0'));var moment=require(_0xce4d('0x1'));var BPromise=require(_0xce4d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce4d('0x3'));var db=require(_0xce4d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xce4d('0x5'));var jayson=require(_0xce4d('0x6'));var client=jayson[_0xce4d('0x7')][_0xce4d('0x8')]({'port':0x232a});config[_0xce4d('0x9')]=_[_0xce4d('0xa')](config[_0xce4d('0x9')],{'host':_0xce4d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xce4d('0xc'))['register'](socket);function respondWithRpcPromise(_0x29960a,_0x2f9d35,_0x36f4f3){return new BPromise(function(_0x599bbf,_0x4e99a9){return client[_0xce4d('0xd')](_0x29960a,_0x36f4f3)['then'](function(_0x303f9d){logger[_0xce4d('0xe')](_0xce4d('0xf'),_0x2f9d35,'request\x20sent');logger[_0xce4d('0x10')](_0xce4d('0x11'),_0x2f9d35,'request\x20sent',JSON['stringify'](_0x303f9d));if(_0x303f9d[_0xce4d('0x12')]){if(_0x303f9d[_0xce4d('0x12')][_0xce4d('0x13')]===0x1f4){logger[_0xce4d('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x2f9d35,_0x303f9d[_0xce4d('0x12')][_0xce4d('0x14')]);return _0x4e99a9(_0x303f9d[_0xce4d('0x12')]['message']);}logger['error'](_0xce4d('0xf'),_0x2f9d35,_0x303f9d[_0xce4d('0x12')]['message']);return _0x599bbf(_0x303f9d[_0xce4d('0x12')][_0xce4d('0x14')]);}else{logger[_0xce4d('0xe')](_0xce4d('0xf'),_0x2f9d35,_0xce4d('0x15'));_0x599bbf(_0x303f9d[_0xce4d('0x16')][_0xce4d('0x14')]);}})[_0xce4d('0x17')](function(_0x42891b){logger[_0xce4d('0x12')](_0xce4d('0xf'),_0x2f9d35,_0x42891b);_0x4e99a9(_0x42891b);});});}exports[_0xce4d('0x18')]=function(_0x767b00){var _0x27483f=this;return new Promise(function(_0x2ad8b4,_0x32350e){return db[_0xce4d('0x19')][_0xce4d('0x1a')]({'raw':_0x767b00[_0xce4d('0x1b')]?_0x767b00['options'][_0xce4d('0x1c')]===undefined?!![]:![]:!![],'where':_0x767b00['options']?_0x767b00[_0xce4d('0x1b')][_0xce4d('0x1d')]||null:null,'attributes':_0x767b00[_0xce4d('0x1b')]?_0x767b00[_0xce4d('0x1b')][_0xce4d('0x1e')]||null:null,'limit':_0x767b00[_0xce4d('0x1b')]?_0x767b00[_0xce4d('0x1b')][_0xce4d('0x1f')]||null:null,'include':_0x767b00[_0xce4d('0x1b')]?_0x767b00['options']['include']?_[_0xce4d('0x20')](_0x767b00['options'][_0xce4d('0x21')],function(_0x2b6c4c){return{'model':db[_0x2b6c4c[_0xce4d('0x22')]],'as':_0x2b6c4c['as'],'attributes':_0x2b6c4c[_0xce4d('0x1e')],'include':_0x2b6c4c[_0xce4d('0x21')]?_[_0xce4d('0x20')](_0x2b6c4c['include'],function(_0x74e3){return{'model':db[_0x74e3[_0xce4d('0x22')]],'as':_0x74e3['as'],'attributes':_0x74e3[_0xce4d('0x1e')],'include':_0x74e3[_0xce4d('0x21')]?_[_0xce4d('0x20')](_0x74e3[_0xce4d('0x21')],function(_0x3c694c){return{'model':db[_0x3c694c[_0xce4d('0x22')]],'as':_0x3c694c['as'],'attributes':_0x3c694c[_0xce4d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xce4d('0x23')](function(_0x3e7a8d){logger[_0xce4d('0xe')](_0xce4d('0x18'),_0x767b00);logger[_0xce4d('0x10')](_0xce4d('0x18'),_0x767b00,JSON[_0xce4d('0x24')](_0x3e7a8d));_0x2ad8b4(_0x3e7a8d);})[_0xce4d('0x17')](function(_0x595f5b){logger[_0xce4d('0x12')](_0xce4d('0x18'),_0x595f5b[_0xce4d('0x14')],_0x767b00);_0x32350e(_0x27483f['error'](0x1f4,_0x595f5b[_0xce4d('0x14')]));});});};exports[_0xce4d('0x25')]=function(_0x3317e6){var _0x866dde=this;return new Promise(function(_0x32f043,_0x1e3a85){return db['OpenchannelQueue'][_0xce4d('0x26')]({'raw':_0x3317e6[_0xce4d('0x1b')]?_0x3317e6[_0xce4d('0x1b')][_0xce4d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3317e6[_0xce4d('0x1b')]?_0x3317e6[_0xce4d('0x1b')]['where']||null:null,'attributes':_0x3317e6[_0xce4d('0x1b')]?_0x3317e6[_0xce4d('0x1b')]['attributes']||null:null,'include':_0x3317e6[_0xce4d('0x1b')]?_0x3317e6[_0xce4d('0x1b')][_0xce4d('0x21')]?_[_0xce4d('0x20')](_0x3317e6[_0xce4d('0x1b')][_0xce4d('0x21')],function(_0x384641){return{'model':db[_0x384641['model']],'as':_0x384641['as'],'attributes':_0x384641[_0xce4d('0x1e')],'include':_0x384641[_0xce4d('0x21')]?_[_0xce4d('0x20')](_0x384641[_0xce4d('0x21')],function(_0x4baa1c){return{'model':db[_0x4baa1c[_0xce4d('0x22')]],'as':_0x4baa1c['as'],'attributes':_0x4baa1c['attributes'],'include':_0x4baa1c['include']?_[_0xce4d('0x20')](_0x4baa1c['include'],function(_0x1ac984){return{'model':db[_0x1ac984['model']],'as':_0x1ac984['as'],'attributes':_0x1ac984[_0xce4d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xce4d('0x23')](function(_0x5bb976){logger[_0xce4d('0xe')](_0xce4d('0x25'),_0x3317e6);logger[_0xce4d('0x10')](_0xce4d('0x25'),_0x3317e6,JSON[_0xce4d('0x24')](_0x5bb976));_0x32f043(_0x5bb976);})['catch'](function(_0x5e73cf){logger[_0xce4d('0x12')]('ShowOpenchannelQueue',_0x5e73cf['message'],_0x3317e6);_0x1e3a85(_0x866dde[_0xce4d('0x12')](0x1f4,_0x5e73cf[_0xce4d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 9ecbb06..3cc8b33 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 _0x66d6=['./openchannelQueue.events','save','remove','removeListener','register','length','openchannelQueue:'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x66d6,0xf5));var _0x666d=function(_0x327c12,_0x2874c9){_0x327c12=_0x327c12-0x0;var _0x4cd602=_0x66d6[_0x327c12];return _0x4cd602;};'use strict';var OpenchannelQueueEvents=require(_0x666d('0x0'));var events=[_0x666d('0x1'),_0x666d('0x2'),'update'];function createListener(_0x48e49d,_0x441fb8){return function(_0x4377c){_0x441fb8['emit'](_0x48e49d,_0x4377c);};}function removeListener(_0x45dafb,_0x104a09){return function(){OpenchannelQueueEvents[_0x666d('0x3')](_0x45dafb,_0x104a09);};}exports[_0x666d('0x4')]=function(_0x324c9a){for(var _0x1764c2=0x0,_0x5b5454=events[_0x666d('0x5')];_0x1764c2<_0x5b5454;_0x1764c2++){var _0x37194c=events[_0x1764c2];var _0x37ee1f=createListener(_0x666d('0x6')+_0x37194c,_0x324c9a);OpenchannelQueueEvents['on'](_0x37194c,_0x37ee1f);}}; \ No newline at end of file +var _0x646b=['openchannelQueue:','save','remove','removeListener','register','length'];(function(_0x5765f0,_0x168449){var _0x2e01a7=function(_0x8e3684){while(--_0x8e3684){_0x5765f0['push'](_0x5765f0['shift']());}};_0x2e01a7(++_0x168449);}(_0x646b,0x8b));var _0xb646=function(_0x4186fa,_0x26a01c){_0x4186fa=_0x4186fa-0x0;var _0x136990=_0x646b[_0x4186fa];return _0x136990;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xb646('0x0'),_0xb646('0x1'),'update'];function createListener(_0xd2f3a6,_0xf338d){return function(_0x13e65f){_0xf338d['emit'](_0xd2f3a6,_0x13e65f);};}function removeListener(_0x586fe2,_0x39cdc0){return function(){OpenchannelQueueEvents[_0xb646('0x2')](_0x586fe2,_0x39cdc0);};}exports[_0xb646('0x3')]=function(_0x5e1fe1){for(var _0x5c3087=0x0,_0x169d56=events[_0xb646('0x4')];_0x5c3087<_0x169d56;_0x5c3087++){var _0x39736b=events[_0x5c3087];var _0x5ab641=createListener(_0xb646('0x5')+_0x39736b,_0x5e1fe1);OpenchannelQueueEvents['on'](_0x39736b,_0x5ab641);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index b608612..b5e3c90 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 _0x6d45=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','show','post','create','put','update','delete','/:id','destroy'];(function(_0x585d81,_0xf6d74f){var _0x1aca0d=function(_0x3782d3){while(--_0x3782d3){_0x585d81['push'](_0x585d81['shift']());}};_0x1aca0d(++_0xf6d74f);}(_0x6d45,0x119));var _0x56d4=function(_0x2bf476,_0x31a87c){_0x2bf476=_0x2bf476-0x0;var _0x3badff=_0x6d45[_0x2bf476];return _0x3badff;};'use strict';var multer=require(_0x56d4('0x0'));var util=require(_0x56d4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x56d4('0x2'));var router=express[_0x56d4('0x3')]();var fs_extra=require(_0x56d4('0x4'));var auth=require(_0x56d4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x56d4('0x6'));router[_0x56d4('0x7')]('/',auth[_0x56d4('0x8')](),controller[_0x56d4('0x9')]);router[_0x56d4('0x7')](_0x56d4('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x56d4('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x56d4('0xb')]);router[_0x56d4('0xc')]('/',auth[_0x56d4('0x8')](),controller[_0x56d4('0xd')]);router[_0x56d4('0xe')]('/:id',auth[_0x56d4('0x8')](),controller[_0x56d4('0xf')]);router[_0x56d4('0x10')](_0x56d4('0x11'),auth[_0x56d4('0x8')](),controller[_0x56d4('0x12')]);module[_0x56d4('0x13')]=router; \ No newline at end of file +var _0x7a54=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util'];(function(_0x32cf1c,_0x46514e){var _0x5c14dd=function(_0xe229de){while(--_0xe229de){_0x32cf1c['push'](_0x32cf1c['shift']());}};_0x5c14dd(++_0x46514e);}(_0x7a54,0x1b6));var _0x47a5=function(_0x1cc964,_0x25e4da){_0x1cc964=_0x1cc964-0x0;var _0x5ad30c=_0x7a54[_0x1cc964];return _0x5ad30c;};'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(_0x47a5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth[_0x47a5('0xa')](),controller[_0x47a5('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x47a5('0x9')](_0x47a5('0xc'),auth[_0x47a5('0xa')](),controller[_0x47a5('0xd')]);router[_0x47a5('0xe')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xc'),auth[_0x47a5('0xa')](),controller['update']);router[_0x47a5('0x11')](_0x47a5('0xc'),auth[_0x47a5('0xa')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 6343b75..658d879 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 _0x1d63=['exports','STRING','DATE'];(function(_0x35c972,_0x1f478b){var _0x4bdbcc=function(_0x308535){while(--_0x308535){_0x35c972['push'](_0x35c972['shift']());}};_0x4bdbcc(++_0x1f478b);}(_0x1d63,0x144));var _0x31d6=function(_0x4cb191,_0x283092){_0x4cb191=_0x4cb191-0x0;var _0x421714=_0x1d63[_0x4cb191];return _0x421714;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x31d6('0x0')]={'uniqueid':{'type':Sequelize[_0x31d6('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x31d6('0x1')]},'joinAt':{'type':Sequelize[_0x31d6('0x2')]},'leaveAt':{'type':Sequelize[_0x31d6('0x2')]},'acceptAt':{'type':Sequelize[_0x31d6('0x2')]},'exitAt':{'type':Sequelize[_0x31d6('0x2')]},'reason':{'type':Sequelize[_0x31d6('0x1')]}}; \ No newline at end of file +var _0xef40=['sequelize','exports','STRING','DATE','moment'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xef40,0x18f));var _0x0ef4=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xef40[_0x2dafbe];return _0x58a45a;};'use strict';var moment=require(_0x0ef4('0x0'));var Sequelize=require(_0x0ef4('0x1'));module[_0x0ef4('0x2')]={'uniqueid':{'type':Sequelize[_0x0ef4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x0ef4('0x3')]},'joinAt':{'type':Sequelize[_0x0ef4('0x4')]},'leaveAt':{'type':Sequelize[_0x0ef4('0x4')]},'acceptAt':{'type':Sequelize[_0x0ef4('0x4')]},'exitAt':{'type':Sequelize[_0x0ef4('0x4')]},'reason':{'type':Sequelize[_0x0ef4('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 819a487..336899f 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 _0x9bcd=['nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','query','fields','attributes','hasOwnProperty'];(function(_0x175823,_0x5a4293){var _0x2c68fd=function(_0x16c9d3){while(--_0x16c9d3){_0x175823['push'](_0x175823['shift']());}};_0x2c68fd(++_0x5a4293);}(_0x9bcd,0x100));var _0xd9bc=function(_0x566d3d,_0x50f318){_0x566d3d=_0x566d3d-0x0;var _0x698d3c=_0x9bcd[_0x566d3d];return _0x698d3c;};'use strict';var emlformat=require(_0xd9bc('0x0'));var rimraf=require(_0xd9bc('0x1'));var zipdir=require(_0xd9bc('0x2'));var jsonpatch=require(_0xd9bc('0x3'));var rp=require(_0xd9bc('0x4'));var moment=require('moment');var BPromise=require(_0xd9bc('0x5'));var Mustache=require(_0xd9bc('0x6'));var util=require(_0xd9bc('0x7'));var path=require(_0xd9bc('0x8'));var sox=require(_0xd9bc('0x9'));var csv=require(_0xd9bc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd9bc('0xb'));var toCsv=require(_0xd9bc('0xa'));var querystring=require(_0xd9bc('0xc'));var Papa=require(_0xd9bc('0xd'));var Redis=require(_0xd9bc('0xe'));var authService=require(_0xd9bc('0xf'));var qs=require(_0xd9bc('0x10'));var as=require(_0xd9bc('0x11'));var hardwareService=require(_0xd9bc('0x12'));var logger=require('../../config/logger')(_0xd9bc('0x13'));var utils=require(_0xd9bc('0x14'));var config=require(_0xd9bc('0x15'));var licenseUtil=require(_0xd9bc('0x16'));var db=require(_0xd9bc('0x17'))['db'];function respondWithStatusCode(_0x42208b,_0x2431f7){_0x2431f7=_0x2431f7||0xcc;return function(_0x3bf777){if(_0x3bf777){return _0x42208b[_0xd9bc('0x18')](_0x2431f7);}return _0x42208b[_0xd9bc('0x19')](_0x2431f7)[_0xd9bc('0x1a')]();};}function respondWithResult(_0x48ef43,_0x51fdc3){_0x51fdc3=_0x51fdc3||0xc8;return function(_0x37f11b){if(_0x37f11b){return _0x48ef43[_0xd9bc('0x19')](_0x51fdc3)[_0xd9bc('0x1b')](_0x37f11b);}};}function respondWithFilteredResult(_0x44fdce,_0x5d012f){return function(_0x7b9750){if(_0x7b9750){var _0x307aaf=typeof _0x5d012f['offset']===_0xd9bc('0x1c')&&typeof _0x5d012f[_0xd9bc('0x1d')]==='undefined';var _0x3c7c3d=_0x7b9750[_0xd9bc('0x1e')];var _0x2f1988=_0x307aaf?0x0:_0x5d012f[_0xd9bc('0x1f')];var _0x1f7d82=_0x307aaf?_0x7b9750[_0xd9bc('0x1e')]:_0x5d012f[_0xd9bc('0x1f')]+_0x5d012f[_0xd9bc('0x1d')];var _0x5e0197;if(_0x1f7d82>=_0x3c7c3d){_0x1f7d82=_0x3c7c3d;_0x5e0197=0xc8;}else{_0x5e0197=0xce;}_0x44fdce[_0xd9bc('0x19')](_0x5e0197);return _0x44fdce[_0xd9bc('0x20')](_0xd9bc('0x21'),_0x2f1988+'-'+_0x1f7d82+'/'+_0x3c7c3d)[_0xd9bc('0x1b')](_0x7b9750);}return null;};}function patchUpdates(_0x286223){return function(_0x5e1db4){try{jsonpatch['apply'](_0x5e1db4,_0x286223,!![]);}catch(_0x1a4580){return BPromise[_0xd9bc('0x22')](_0x1a4580);}return _0x5e1db4['save']();};}function saveUpdates(_0x23cec7,_0x29a80f){return function(_0x24b63c){if(_0x24b63c){return _0x24b63c[_0xd9bc('0x23')](_0x23cec7)[_0xd9bc('0x24')](function(_0x5b0ef9){return _0x5b0ef9;});}return null;};}function removeEntity(_0x5b903c,_0x2bf6fb){return function(_0x4ac93e){if(_0x4ac93e){return _0x4ac93e['destroy']()[_0xd9bc('0x24')](function(){_0x5b903c[_0xd9bc('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x501234,_0x1ec944){return function(_0x3e7cde){if(!_0x3e7cde){_0x501234[_0xd9bc('0x18')](0x194);}return _0x3e7cde;};}function handleError(_0x52af52,_0x2fb2e6){_0x2fb2e6=_0x2fb2e6||0x1f4;return function(_0x4ae288){logger[_0xd9bc('0x25')](_0x4ae288[_0xd9bc('0x26')]);if(_0x4ae288[_0xd9bc('0x27')]){delete _0x4ae288[_0xd9bc('0x27')];}_0x52af52[_0xd9bc('0x19')](_0x2fb2e6)[_0xd9bc('0x28')](_0x4ae288);};}exports[_0xd9bc('0x29')]=function(_0x5133f7,_0x37228f){var _0x5178bc={},_0x313069={},_0x2505a6={'count':0x0,'rows':[]};var _0x53bab4=_['map'](db[_0xd9bc('0x2a')][_0xd9bc('0x2b')],function(_0x2a8274){return{'name':_0x2a8274[_0xd9bc('0x2c')],'type':_0x2a8274[_0xd9bc('0x2d')][_0xd9bc('0x2e')]};});_0x313069[_0xd9bc('0x2f')]=_[_0xd9bc('0x30')](_0x53bab4,_0xd9bc('0x27'));_0x313069['query']=_[_0xd9bc('0x31')](_0x5133f7['query']);_0x313069[_0xd9bc('0x32')]=_[_0xd9bc('0x33')](_0x313069[_0xd9bc('0x2f')],_0x313069[_0xd9bc('0x34')]);_0x5178bc['attributes']=_[_0xd9bc('0x33')](_0x313069[_0xd9bc('0x2f')],qs[_0xd9bc('0x35')](_0x5133f7[_0xd9bc('0x34')]['fields']));_0x5178bc['attributes']=_0x5178bc[_0xd9bc('0x36')]['length']?_0x5178bc[_0xd9bc('0x36')]:_0x313069['model'];if(!_0x5133f7['query'][_0xd9bc('0x37')](_0xd9bc('0x38'))){_0x5178bc[_0xd9bc('0x1d')]=qs[_0xd9bc('0x1d')](_0x5133f7[_0xd9bc('0x34')][_0xd9bc('0x1d')]);_0x5178bc['offset']=qs['offset'](_0x5133f7[_0xd9bc('0x34')][_0xd9bc('0x1f')]);}_0x5178bc[_0xd9bc('0x39')]=qs[_0xd9bc('0x3a')](_0x5133f7[_0xd9bc('0x34')][_0xd9bc('0x3a')]);_0x5178bc[_0xd9bc('0x3b')]=qs['filters'](_[_0xd9bc('0x3c')](_0x5133f7[_0xd9bc('0x34')],_0x313069[_0xd9bc('0x32')]),_0x53bab4);if(_0x5133f7[_0xd9bc('0x34')]['filter']){_0x5178bc['where']=_[_0xd9bc('0x3d')](_0x5178bc['where'],{'$or':_[_0xd9bc('0x30')](_0x53bab4,function(_0x371ad5){if(_0x371ad5['type']!==_0xd9bc('0x3e')){var _0x5f547d={};_0x5f547d[_0x371ad5[_0xd9bc('0x27')]]={'$like':'%'+_0x5133f7[_0xd9bc('0x34')][_0xd9bc('0x3f')]+'%'};return _0x5f547d;}})});}_0x5178bc=_[_0xd9bc('0x3d')]({},_0x5178bc,_0x5133f7[_0xd9bc('0x40')]);var _0x1a8345={'where':_0x5178bc[_0xd9bc('0x3b')]};return db[_0xd9bc('0x2a')][_0xd9bc('0x1e')](_0x1a8345)[_0xd9bc('0x24')](function(_0x5ad470){_0x2505a6[_0xd9bc('0x1e')]=_0x5ad470;if(_0x5133f7['query'][_0xd9bc('0x41')]){_0x5178bc[_0xd9bc('0x42')]=[{'all':!![]}];}return db[_0xd9bc('0x2a')][_0xd9bc('0x43')](_0x5178bc);})[_0xd9bc('0x24')](function(_0x160675){_0x2505a6[_0xd9bc('0x44')]=_0x160675;return _0x2505a6;})['then'](respondWithFilteredResult(_0x37228f,_0x5178bc))[_0xd9bc('0x45')](handleError(_0x37228f,null));};exports[_0xd9bc('0x46')]=function(_0x415817,_0x2ead3d){var _0x45dda1={'raw':!![],'where':{'id':_0x415817[_0xd9bc('0x47')]['id']}},_0x394e6a={};_0x394e6a[_0xd9bc('0x2f')]=_[_0xd9bc('0x31')](db['OpenchannelQueueReport']['rawAttributes']);_0x394e6a['query']=_[_0xd9bc('0x31')](_0x415817[_0xd9bc('0x34')]);_0x394e6a[_0xd9bc('0x32')]=_[_0xd9bc('0x33')](_0x394e6a[_0xd9bc('0x2f')],_0x394e6a[_0xd9bc('0x34')]);_0x45dda1[_0xd9bc('0x36')]=_[_0xd9bc('0x33')](_0x394e6a[_0xd9bc('0x2f')],qs[_0xd9bc('0x35')](_0x415817[_0xd9bc('0x34')][_0xd9bc('0x35')]));_0x45dda1[_0xd9bc('0x36')]=_0x45dda1[_0xd9bc('0x36')][_0xd9bc('0x48')]?_0x45dda1[_0xd9bc('0x36')]:_0x394e6a[_0xd9bc('0x2f')];if(_0x415817[_0xd9bc('0x34')][_0xd9bc('0x41')]){_0x45dda1['include']=[{'all':!![]}];}_0x45dda1=_[_0xd9bc('0x3d')]({},_0x45dda1,_0x415817[_0xd9bc('0x40')]);return db[_0xd9bc('0x2a')][_0xd9bc('0x49')](_0x45dda1)[_0xd9bc('0x24')](handleEntityNotFound(_0x2ead3d,null))[_0xd9bc('0x24')](respondWithResult(_0x2ead3d,null))[_0xd9bc('0x45')](handleError(_0x2ead3d,null));};exports[_0xd9bc('0x4a')]=function(_0x4bbe38,_0x2dc6d7){return db[_0xd9bc('0x2a')][_0xd9bc('0x4a')](_0x4bbe38[_0xd9bc('0x4b')],{})[_0xd9bc('0x24')](respondWithResult(_0x2dc6d7,0xc9))[_0xd9bc('0x45')](handleError(_0x2dc6d7,null));};exports[_0xd9bc('0x23')]=function(_0x23d723,_0x54c1d9){if(_0x23d723[_0xd9bc('0x4b')]['id']){delete _0x23d723[_0xd9bc('0x4b')]['id'];}return db[_0xd9bc('0x2a')][_0xd9bc('0x49')]({'where':{'id':_0x23d723[_0xd9bc('0x47')]['id']}})[_0xd9bc('0x24')](handleEntityNotFound(_0x54c1d9,null))['then'](saveUpdates(_0x23d723[_0xd9bc('0x4b')],null))['then'](respondWithResult(_0x54c1d9,null))[_0xd9bc('0x45')](handleError(_0x54c1d9,null));};exports[_0xd9bc('0x4c')]=function(_0xdc3b9,_0x58a871){return db[_0xd9bc('0x2a')][_0xd9bc('0x49')]({'where':{'id':_0xdc3b9[_0xd9bc('0x47')]['id']}})[_0xd9bc('0x24')](handleEntityNotFound(_0x58a871,null))['then'](removeEntity(_0x58a871,null))[_0xd9bc('0x45')](handleError(_0x58a871,null));};exports[_0xd9bc('0x4d')]=function(_0x116731,_0xd901dc){return db[_0xd9bc('0x2a')][_0xd9bc('0x4d')]()[_0xd9bc('0x24')](respondWithResult(_0xd901dc,null))[_0xd9bc('0x45')](handleError(_0xd901dc,null));}; \ No newline at end of file +var _0x5377=['merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','sendStatus','status','end','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x5377,0x9b));var _0x7537=function(_0x1e7083,_0x2fd4aa){_0x1e7083=_0x1e7083-0x0;var _0x1cb91c=_0x5377[_0x1e7083];return _0x1cb91c;};'use strict';var emlformat=require(_0x7537('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7537('0x1'));var jsonpatch=require(_0x7537('0x2'));var rp=require(_0x7537('0x3'));var moment=require('moment');var BPromise=require(_0x7537('0x4'));var Mustache=require('mustache');var util=require(_0x7537('0x5'));var path=require(_0x7537('0x6'));var sox=require('sox');var csv=require(_0x7537('0x7'));var ejs=require(_0x7537('0x8'));var fs=require('fs');var fs_extra=require(_0x7537('0x9'));var _=require('lodash');var squel=require(_0x7537('0xa'));var crypto=require(_0x7537('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7537('0x7'));var querystring=require(_0x7537('0xc'));var Papa=require(_0x7537('0xd'));var Redis=require(_0x7537('0xe'));var authService=require(_0x7537('0xf'));var qs=require(_0x7537('0x10'));var as=require(_0x7537('0x11'));var hardwareService=require(_0x7537('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7537('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ce54a,_0x4a901b){_0x4a901b=_0x4a901b||0xcc;return function(_0x30b030){if(_0x30b030){return _0x5ce54a[_0x7537('0x14')](_0x4a901b);}return _0x5ce54a[_0x7537('0x15')](_0x4a901b)[_0x7537('0x16')]();};}function respondWithResult(_0xe7f790,_0x77024d){_0x77024d=_0x77024d||0xc8;return function(_0x568998){if(_0x568998){return _0xe7f790[_0x7537('0x15')](_0x77024d)['json'](_0x568998);}};}function respondWithFilteredResult(_0x24fac1,_0x47dde8){return function(_0x5176a5){if(_0x5176a5){var _0xa43556=typeof _0x47dde8['offset']==='undefined'&&typeof _0x47dde8[_0x7537('0x17')]==='undefined';var _0x186e11=_0x5176a5[_0x7537('0x18')];var _0x59e876=_0xa43556?0x0:_0x47dde8[_0x7537('0x19')];var _0x1d1106=_0xa43556?_0x5176a5['count']:_0x47dde8[_0x7537('0x19')]+_0x47dde8[_0x7537('0x17')];var _0x21b4de;if(_0x1d1106>=_0x186e11){_0x1d1106=_0x186e11;_0x21b4de=0xc8;}else{_0x21b4de=0xce;}_0x24fac1[_0x7537('0x15')](_0x21b4de);return _0x24fac1[_0x7537('0x1a')]('Content-Range',_0x59e876+'-'+_0x1d1106+'/'+_0x186e11)['json'](_0x5176a5);}return null;};}function patchUpdates(_0x308749){return function(_0x38639d){try{jsonpatch['apply'](_0x38639d,_0x308749,!![]);}catch(_0x479933){return BPromise[_0x7537('0x1b')](_0x479933);}return _0x38639d[_0x7537('0x1c')]();};}function saveUpdates(_0x5c7bd0,_0x53f4ed){return function(_0x2daf70){if(_0x2daf70){return _0x2daf70[_0x7537('0x1d')](_0x5c7bd0)[_0x7537('0x1e')](function(_0x2a46ad){return _0x2a46ad;});}return null;};}function removeEntity(_0x7ee512,_0x5103c9){return function(_0x24f228){if(_0x24f228){return _0x24f228[_0x7537('0x1f')]()[_0x7537('0x1e')](function(){_0x7ee512[_0x7537('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x37b07f,_0x57e72d){return function(_0x5ab342){if(!_0x5ab342){_0x37b07f[_0x7537('0x14')](0x194);}return _0x5ab342;};}function handleError(_0x2435e5,_0x917c02){_0x917c02=_0x917c02||0x1f4;return function(_0x2cba35){logger[_0x7537('0x20')](_0x2cba35[_0x7537('0x21')]);if(_0x2cba35[_0x7537('0x22')]){delete _0x2cba35[_0x7537('0x22')];}_0x2435e5['status'](_0x917c02)[_0x7537('0x23')](_0x2cba35);};}exports[_0x7537('0x24')]=function(_0x2a7da9,_0x5686b0){var _0x517703={},_0x534b63={},_0x3f2a94={'count':0x0,'rows':[]};var _0x23cce4=_[_0x7537('0x25')](db[_0x7537('0x26')][_0x7537('0x27')],function(_0x33404c){return{'name':_0x33404c['fieldName'],'type':_0x33404c[_0x7537('0x28')]['key']};});_0x534b63[_0x7537('0x29')]=_[_0x7537('0x25')](_0x23cce4,'name');_0x534b63[_0x7537('0x2a')]=_['keys'](_0x2a7da9['query']);_0x534b63[_0x7537('0x2b')]=_['intersection'](_0x534b63[_0x7537('0x29')],_0x534b63[_0x7537('0x2a')]);_0x517703['attributes']=_[_0x7537('0x2c')](_0x534b63[_0x7537('0x29')],qs[_0x7537('0x2d')](_0x2a7da9[_0x7537('0x2a')][_0x7537('0x2d')]));_0x517703[_0x7537('0x2e')]=_0x517703[_0x7537('0x2e')][_0x7537('0x2f')]?_0x517703[_0x7537('0x2e')]:_0x534b63['model'];if(!_0x2a7da9[_0x7537('0x2a')][_0x7537('0x30')](_0x7537('0x31'))){_0x517703[_0x7537('0x17')]=qs['limit'](_0x2a7da9[_0x7537('0x2a')][_0x7537('0x17')]);_0x517703[_0x7537('0x19')]=qs[_0x7537('0x19')](_0x2a7da9[_0x7537('0x2a')][_0x7537('0x19')]);}_0x517703[_0x7537('0x32')]=qs['sort'](_0x2a7da9[_0x7537('0x2a')][_0x7537('0x33')]);_0x517703[_0x7537('0x34')]=qs[_0x7537('0x2b')](_[_0x7537('0x35')](_0x2a7da9[_0x7537('0x2a')],_0x534b63[_0x7537('0x2b')]),_0x23cce4);if(_0x2a7da9[_0x7537('0x2a')][_0x7537('0x36')]){_0x517703[_0x7537('0x34')]=_[_0x7537('0x37')](_0x517703[_0x7537('0x34')],{'$or':_[_0x7537('0x25')](_0x23cce4,function(_0x5b73f3){if(_0x5b73f3[_0x7537('0x28')]!==_0x7537('0x38')){var _0x12143e={};_0x12143e[_0x5b73f3[_0x7537('0x22')]]={'$like':'%'+_0x2a7da9[_0x7537('0x2a')][_0x7537('0x36')]+'%'};return _0x12143e;}})});}_0x517703=_[_0x7537('0x37')]({},_0x517703,_0x2a7da9[_0x7537('0x39')]);var _0x46d630={'where':_0x517703[_0x7537('0x34')]};return db[_0x7537('0x26')][_0x7537('0x18')](_0x46d630)['then'](function(_0xafb0a1){_0x3f2a94['count']=_0xafb0a1;if(_0x2a7da9[_0x7537('0x2a')][_0x7537('0x3a')]){_0x517703[_0x7537('0x3b')]=[{'all':!![]}];}return db[_0x7537('0x26')][_0x7537('0x3c')](_0x517703);})['then'](function(_0x59b8e1){_0x3f2a94[_0x7537('0x3d')]=_0x59b8e1;return _0x3f2a94;})[_0x7537('0x1e')](respondWithFilteredResult(_0x5686b0,_0x517703))['catch'](handleError(_0x5686b0,null));};exports[_0x7537('0x3e')]=function(_0x356f8f,_0x379c8e){var _0x49ffa5={'raw':!![],'where':{'id':_0x356f8f[_0x7537('0x3f')]['id']}},_0x43f1bc={};_0x43f1bc[_0x7537('0x29')]=_[_0x7537('0x40')](db[_0x7537('0x26')]['rawAttributes']);_0x43f1bc[_0x7537('0x2a')]=_[_0x7537('0x40')](_0x356f8f['query']);_0x43f1bc[_0x7537('0x2b')]=_[_0x7537('0x2c')](_0x43f1bc['model'],_0x43f1bc[_0x7537('0x2a')]);_0x49ffa5[_0x7537('0x2e')]=_[_0x7537('0x2c')](_0x43f1bc[_0x7537('0x29')],qs['fields'](_0x356f8f[_0x7537('0x2a')][_0x7537('0x2d')]));_0x49ffa5[_0x7537('0x2e')]=_0x49ffa5['attributes'][_0x7537('0x2f')]?_0x49ffa5[_0x7537('0x2e')]:_0x43f1bc[_0x7537('0x29')];if(_0x356f8f[_0x7537('0x2a')]['includeAll']){_0x49ffa5['include']=[{'all':!![]}];}_0x49ffa5=_[_0x7537('0x37')]({},_0x49ffa5,_0x356f8f[_0x7537('0x39')]);return db[_0x7537('0x26')]['find'](_0x49ffa5)[_0x7537('0x1e')](handleEntityNotFound(_0x379c8e,null))['then'](respondWithResult(_0x379c8e,null))[_0x7537('0x41')](handleError(_0x379c8e,null));};exports[_0x7537('0x42')]=function(_0x245592,_0x40a370){return db[_0x7537('0x26')][_0x7537('0x42')](_0x245592[_0x7537('0x43')],{})[_0x7537('0x1e')](respondWithResult(_0x40a370,0xc9))[_0x7537('0x41')](handleError(_0x40a370,null));};exports[_0x7537('0x1d')]=function(_0x13cb3b,_0x55dbbf){if(_0x13cb3b[_0x7537('0x43')]['id']){delete _0x13cb3b[_0x7537('0x43')]['id'];}return db[_0x7537('0x26')][_0x7537('0x44')]({'where':{'id':_0x13cb3b[_0x7537('0x3f')]['id']}})[_0x7537('0x1e')](handleEntityNotFound(_0x55dbbf,null))[_0x7537('0x1e')](saveUpdates(_0x13cb3b['body'],null))[_0x7537('0x1e')](respondWithResult(_0x55dbbf,null))['catch'](handleError(_0x55dbbf,null));};exports[_0x7537('0x1f')]=function(_0x4985c8,_0x4be3a8){return db[_0x7537('0x26')]['find']({'where':{'id':_0x4985c8['params']['id']}})[_0x7537('0x1e')](handleEntityNotFound(_0x4be3a8,null))[_0x7537('0x1e')](removeEntity(_0x4be3a8,null))['catch'](handleError(_0x4be3a8,null));};exports[_0x7537('0x45')]=function(_0x2eae4a,_0x541f73){return db[_0x7537('0x26')][_0x7537('0x45')]()[_0x7537('0x1e')](respondWithResult(_0x541f73,null))['catch'](handleError(_0x541f73,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 05e3742..a05eba6 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x59ee41,_0xaf7db8){var _0x3ecd3e=function(_0x2f9291){while(--_0x2f9291){_0x59ee41['push'](_0x59ee41['shift']());}};_0x3ecd3e(++_0xaf7db8);}(_0x814b,0x1a2));var _0xb814=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0x814b[_0x1fdb40];return _0x281f93;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x64ba6b,_0x29fb8b){var _0x287d66=function(_0x572142){while(--_0x572142){_0x64ba6b['push'](_0x64ba6b['shift']());}};_0x287d66(++_0x29fb8b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xc4aa[_0x2070da];return _0x4f9fe1;};'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/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 46b631e..9a3c846 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 _0x7382=['error','code','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','util','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3020c2,_0x45456d){var _0x34898d=function(_0x5edc79){while(--_0x5edc79){_0x3020c2['push'](_0x3020c2['shift']());}};_0x34898d(++_0x45456d);}(_0x7382,0x111));var _0x2738=function(_0x1e4381,_0x1f67b3){_0x1e4381=_0x1e4381-0x0;var _0x1b43e2=_0x7382[_0x1e4381];return _0x1b43e2;};'use strict';var _=require('lodash');var util=require(_0x2738('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2738('0x1'));var logger=require(_0x2738('0x2'))(_0x2738('0x3'));var config=require(_0x2738('0x4'));var jayson=require(_0x2738('0x5'));var client=jayson['client'][_0x2738('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2bc38a,_0xd74b07,_0x523aef){return new BPromise(function(_0x4235e7,_0x487d14){return client[_0x2738('0x7')](_0x2bc38a,_0x523aef)['then'](function(_0x476864){logger[_0x2738('0x8')](_0x2738('0x9'),_0xd74b07,'request\x20sent');logger[_0x2738('0xa')](_0x2738('0xb'),_0xd74b07,_0x2738('0xc'),JSON['stringify'](_0x476864));if(_0x476864['error']){if(_0x476864[_0x2738('0xd')][_0x2738('0xe')]===0x1f4){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')][_0x2738('0xf')]);return _0x487d14(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x476864[_0x2738('0xd')]['message']);return _0x4235e7(_0x476864[_0x2738('0xd')][_0x2738('0xf')]);}else{logger['info'](_0x2738('0x9'),_0xd74b07,'request\x20sent');_0x4235e7(_0x476864[_0x2738('0x10')]['message']);}})[_0x2738('0x11')](function(_0x568065){logger[_0x2738('0xd')](_0x2738('0x9'),_0xd74b07,_0x568065);_0x487d14(_0x568065);});});}exports[_0x2738('0x12')]=function(_0x3c6810){var _0x1d0aca=this;return new Promise(function(_0x1e0f57,_0x42685a){return db[_0x2738('0x13')]['create'](_0x3c6810[_0x2738('0x14')],{'raw':_0x3c6810['options']?_0x3c6810[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x5a1d61){logger[_0x2738('0x8')](_0x2738('0x12'),_0x3c6810);logger[_0x2738('0xa')](_0x2738('0x12'),_0x3c6810,JSON[_0x2738('0x17')](_0x5a1d61));_0x1e0f57(_0x5a1d61);})[_0x2738('0x11')](function(_0x18e1d8){logger[_0x2738('0xd')](_0x2738('0x12'),_0x18e1d8[_0x2738('0xf')],_0x3c6810);_0x42685a(_0x1d0aca[_0x2738('0xd')](0x1f4,_0x18e1d8['message']));});});};exports[_0x2738('0x18')]=function(_0x537c5f){var _0x51ee19=this;return new Promise(function(_0x3e3b2d,_0x2d8c5b){return db[_0x2738('0x13')][_0x2738('0x19')](_0x537c5f[_0x2738('0x14')],{'raw':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')][_0x2738('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x537c5f['options']?_0x537c5f[_0x2738('0x15')]['where']||null:null,'attributes':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['attributes']||null:null,'limit':_0x537c5f[_0x2738('0x15')]?_0x537c5f[_0x2738('0x15')]['limit']||null:null})['then'](function(_0x4fad4c){logger['info'](_0x2738('0x18'),_0x537c5f);logger[_0x2738('0xa')](_0x2738('0x18'),_0x537c5f,JSON[_0x2738('0x17')](_0x4fad4c));_0x3e3b2d(_0x4fad4c);})[_0x2738('0x11')](function(_0x2b317c){logger['error'](_0x2738('0x18'),_0x2b317c[_0x2738('0xf')],_0x537c5f);_0x2d8c5b(_0x51ee19[_0x2738('0xd')](0x1f4,_0x2b317c[_0x2738('0xf')]));});});}; \ No newline at end of file +var _0x7894=['request\x20sent','stringify','error','message','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','then','catch','update','where','attributes','limit','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x5b73a2,_0x1bffb8){var _0x2b1f87=function(_0x527113){while(--_0x527113){_0x5b73a2['push'](_0x5b73a2['shift']());}};_0x2b1f87(++_0x1bffb8);}(_0x7894,0x170));var _0x4789=function(_0x5797c9,_0x34f681){_0x5797c9=_0x5797c9-0x0;var _0x4c6863=_0x7894[_0x5797c9];return _0x4c6863;};'use strict';var _=require(_0x4789('0x0'));var util=require(_0x4789('0x1'));var moment=require(_0x4789('0x2'));var BPromise=require(_0x4789('0x3'));var rs=require(_0x4789('0x4'));var fs=require('fs');var Redis=require(_0x4789('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4789('0x6'));var logger=require(_0x4789('0x7'))('rpc');var config=require(_0x4789('0x8'));var jayson=require(_0x4789('0x9'));var client=jayson[_0x4789('0xa')][_0x4789('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x114a90,_0x298902,_0x13b7f6){return new BPromise(function(_0x5a45ae,_0x49d256){return client[_0x4789('0xc')](_0x114a90,_0x13b7f6)['then'](function(_0x2e8038){logger[_0x4789('0xd')](_0x4789('0xe'),_0x298902,'request\x20sent');logger[_0x4789('0xf')]('OpenchannelQueueReport,\x20%s,\x20%s,\x20%s',_0x298902,_0x4789('0x10'),JSON[_0x4789('0x11')](_0x2e8038));if(_0x2e8038[_0x4789('0x12')]){if(_0x2e8038['error']['code']===0x1f4){logger[_0x4789('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x298902,_0x2e8038[_0x4789('0x12')]['message']);return _0x49d256(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}logger['error'](_0x4789('0xe'),_0x298902,_0x2e8038['error'][_0x4789('0x13')]);return _0x5a45ae(_0x2e8038[_0x4789('0x12')][_0x4789('0x13')]);}else{logger['info'](_0x4789('0xe'),_0x298902,_0x4789('0x10'));_0x5a45ae(_0x2e8038['result'][_0x4789('0x13')]);}})['catch'](function(_0x118f97){logger[_0x4789('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x298902,_0x118f97);_0x49d256(_0x118f97);});});}exports[_0x4789('0x14')]=function(_0x5af7b3){var _0x2f1511=this;return new Promise(function(_0x56d799,_0x19dc59){return db[_0x4789('0x15')]['create'](_0x5af7b3[_0x4789('0x16')],{'raw':_0x5af7b3[_0x4789('0x17')]?_0x5af7b3[_0x4789('0x17')][_0x4789('0x18')]===undefined?!![]:![]:!![]})[_0x4789('0x19')](function(_0x3a707d){logger[_0x4789('0xd')](_0x4789('0x14'),_0x5af7b3);logger[_0x4789('0xf')](_0x4789('0x14'),_0x5af7b3,JSON[_0x4789('0x11')](_0x3a707d));_0x56d799(_0x3a707d);})[_0x4789('0x1a')](function(_0x4f7ceb){logger[_0x4789('0x12')](_0x4789('0x14'),_0x4f7ceb['message'],_0x5af7b3);_0x19dc59(_0x2f1511[_0x4789('0x12')](0x1f4,_0x4f7ceb[_0x4789('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0xff56dd){var _0x1ca6ca=this;return new Promise(function(_0x54d9c1,_0xd8601e){return db['OpenchannelQueueReport'][_0x4789('0x1b')](_0xff56dd[_0x4789('0x16')],{'raw':_0xff56dd[_0x4789('0x17')]?_0xff56dd[_0x4789('0x17')][_0x4789('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xff56dd[_0x4789('0x17')]?_0xff56dd[_0x4789('0x17')][_0x4789('0x1c')]||null:null,'attributes':_0xff56dd[_0x4789('0x17')]?_0xff56dd[_0x4789('0x17')][_0x4789('0x1d')]||null:null,'limit':_0xff56dd[_0x4789('0x17')]?_0xff56dd[_0x4789('0x17')][_0x4789('0x1e')]||null:null})[_0x4789('0x19')](function(_0x3095a1){logger[_0x4789('0xd')](_0x4789('0x1f'),_0xff56dd);logger['debug']('UpdateOpenchannelQueueReport',_0xff56dd,JSON[_0x4789('0x11')](_0x3095a1));_0x54d9c1(_0x3095a1);})['catch'](function(_0x490ea3){logger['error'](_0x4789('0x1f'),_0x490ea3[_0x4789('0x13')],_0xff56dd);_0xd8601e(_0x1ca6ca[_0x4789('0x12')](0x1f4,_0x490ea3[_0x4789('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a37b265..2d14bf1 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 _0x899f=['get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xfe5a23,_0x4f5c5d){var _0x54aec0=function(_0x18d37b){while(--_0x18d37b){_0xfe5a23['push'](_0xfe5a23['shift']());}};_0x54aec0(++_0x4f5c5d);}(_0x899f,0xfc));var _0xf899=function(_0x33d982,_0x49c670){_0x33d982=_0x33d982-0x0;var _0x1c599e=_0x899f[_0x33d982];return _0x1c599e;};'use strict';var multer=require('multer');var util=require(_0xf899('0x0'));var path=require(_0xf899('0x1'));var timeout=require(_0xf899('0x2'));var express=require(_0xf899('0x3'));var router=express[_0xf899('0x4')]();var fs_extra=require(_0xf899('0x5'));var auth=require(_0xf899('0x6'));var interaction=require(_0xf899('0x7'));var config=require('../../config/environment');var controller=require('./openchannelTransferReport.controller');router[_0xf899('0x8')]('/',auth[_0xf899('0x9')](),controller[_0xf899('0xa')]);router[_0xf899('0x8')](_0xf899('0xb'),auth[_0xf899('0x9')](),controller[_0xf899('0xc')]);router['get'](_0xf899('0xd'),auth[_0xf899('0x9')](),controller[_0xf899('0xe')]);router[_0xf899('0xf')]('/',auth[_0xf899('0x9')](),controller['create']);router[_0xf899('0x10')](_0xf899('0xd'),auth['isAuthenticated'](),controller[_0xf899('0x11')]);router['delete']('/:id',auth[_0xf899('0x9')](),controller[_0xf899('0x12')]);module[_0xf899('0x13')]=router; \ No newline at end of file +var _0x645d=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy'];(function(_0x59108f,_0x3976d2){var _0x220ec6=function(_0x229b42){while(--_0x229b42){_0x59108f['push'](_0x59108f['shift']());}};_0x220ec6(++_0x3976d2);}(_0x645d,0xa2));var _0xd645=function(_0x319d77,_0x445f72){_0x319d77=_0x319d77-0x0;var _0x1dd41c=_0x645d[_0x319d77];return _0x1dd41c;};'use strict';var multer=require(_0xd645('0x0'));var util=require(_0xd645('0x1'));var path=require(_0xd645('0x2'));var timeout=require(_0xd645('0x3'));var express=require(_0xd645('0x4'));var router=express[_0xd645('0x5')]();var fs_extra=require(_0xd645('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd645('0x7'));var config=require(_0xd645('0x8'));var controller=require(_0xd645('0x9'));router[_0xd645('0xa')]('/',auth[_0xd645('0xb')](),controller[_0xd645('0xc')]);router['get'](_0xd645('0xd'),auth[_0xd645('0xb')](),controller[_0xd645('0xe')]);router[_0xd645('0xa')](_0xd645('0xf'),auth[_0xd645('0xb')](),controller[_0xd645('0x10')]);router[_0xd645('0x11')]('/',auth['isAuthenticated'](),controller[_0xd645('0x12')]);router['put'](_0xd645('0xf'),auth[_0xd645('0xb')](),controller[_0xd645('0x13')]);router[_0xd645('0x14')](_0xd645('0xf'),auth[_0xd645('0xb')](),controller[_0xd645('0x15')]);module[_0xd645('0x16')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 22c41e2..8fffbf4 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x4fa291,_0x56e289){var _0x506d9b=function(_0x24c31f){while(--_0x24c31f){_0x4fa291['push'](_0x4fa291['shift']());}};_0x506d9b(++_0x56e289);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x12194c,_0x436d7d){var _0x1b930a=function(_0xc9edf3){while(--_0xc9edf3){_0x12194c['push'](_0x12194c['shift']());}};_0x1b930a(++_0x436d7d);}(_0xaa88,0x137));var _0x8aa8=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xaa88[_0x349148];return _0x2f2b0f;};'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/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 6453c8f..b4f3ba5 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 _0x186e=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','stack','name','map','OpenchannelTransferReport','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','querystring'];(function(_0x207c3c,_0x1d8653){var _0x8e346=function(_0x5ee04d){while(--_0x5ee04d){_0x207c3c['push'](_0x207c3c['shift']());}};_0x8e346(++_0x1d8653);}(_0x186e,0x16f));var _0xe186=function(_0xbdef0a,_0x4f047b){_0xbdef0a=_0xbdef0a-0x0;var _0x337d38=_0x186e[_0xbdef0a];return _0x337d38;};'use strict';var emlformat=require(_0xe186('0x0'));var rimraf=require(_0xe186('0x1'));var zipdir=require(_0xe186('0x2'));var jsonpatch=require(_0xe186('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe186('0x4'));var Mustache=require(_0xe186('0x5'));var util=require(_0xe186('0x6'));var path=require('path');var sox=require(_0xe186('0x7'));var csv=require(_0xe186('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe186('0x9'));var _=require(_0xe186('0xa'));var squel=require(_0xe186('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe186('0x8'));var querystring=require(_0xe186('0xc'));var Papa=require(_0xe186('0xd'));var Redis=require(_0xe186('0xe'));var authService=require(_0xe186('0xf'));var qs=require(_0xe186('0x10'));var as=require(_0xe186('0x11'));var hardwareService=require(_0xe186('0x12'));var logger=require(_0xe186('0x13'))(_0xe186('0x14'));var utils=require(_0xe186('0x15'));var config=require(_0xe186('0x16'));var licenseUtil=require(_0xe186('0x17'));var db=require(_0xe186('0x18'))['db'];function respondWithStatusCode(_0x1b63d1,_0x215cf4){_0x215cf4=_0x215cf4||0xcc;return function(_0x3905fb){if(_0x3905fb){return _0x1b63d1[_0xe186('0x19')](_0x215cf4);}return _0x1b63d1[_0xe186('0x1a')](_0x215cf4)[_0xe186('0x1b')]();};}function respondWithResult(_0x2fbc8b,_0x24128f){_0x24128f=_0x24128f||0xc8;return function(_0x2253cb){if(_0x2253cb){return _0x2fbc8b[_0xe186('0x1a')](_0x24128f)[_0xe186('0x1c')](_0x2253cb);}};}function respondWithFilteredResult(_0x2cdac9,_0x229e69){return function(_0x1cfcb0){if(_0x1cfcb0){var _0x532ecd=typeof _0x229e69[_0xe186('0x1d')]==='undefined'&&typeof _0x229e69[_0xe186('0x1e')]===_0xe186('0x1f');var _0x40f986=_0x1cfcb0[_0xe186('0x20')];var _0x2ca25c=_0x532ecd?0x0:_0x229e69[_0xe186('0x1d')];var _0x37c8c1=_0x532ecd?_0x1cfcb0['count']:_0x229e69[_0xe186('0x1d')]+_0x229e69[_0xe186('0x1e')];var _0xcdf58a;if(_0x37c8c1>=_0x40f986){_0x37c8c1=_0x40f986;_0xcdf58a=0xc8;}else{_0xcdf58a=0xce;}_0x2cdac9[_0xe186('0x1a')](_0xcdf58a);return _0x2cdac9[_0xe186('0x21')](_0xe186('0x22'),_0x2ca25c+'-'+_0x37c8c1+'/'+_0x40f986)['json'](_0x1cfcb0);}return null;};}function patchUpdates(_0x36f109){return function(_0x4466c6){try{jsonpatch[_0xe186('0x23')](_0x4466c6,_0x36f109,!![]);}catch(_0x52443f){return BPromise['reject'](_0x52443f);}return _0x4466c6[_0xe186('0x24')]();};}function saveUpdates(_0x2e853c,_0x1ff2a1){return function(_0x4ac132){if(_0x4ac132){return _0x4ac132[_0xe186('0x25')](_0x2e853c)['then'](function(_0x56ba2c){return _0x56ba2c;});}return null;};}function removeEntity(_0x3e552c,_0xf9836){return function(_0x54d0e1){if(_0x54d0e1){return _0x54d0e1[_0xe186('0x26')]()[_0xe186('0x27')](function(){_0x3e552c[_0xe186('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56c21c,_0x3c7f6e){return function(_0x5e2656){if(!_0x5e2656){_0x56c21c['sendStatus'](0x194);}return _0x5e2656;};}function handleError(_0x28f144,_0x53e537){_0x53e537=_0x53e537||0x1f4;return function(_0x404f5a){logger['error'](_0x404f5a[_0xe186('0x28')]);if(_0x404f5a[_0xe186('0x29')]){delete _0x404f5a[_0xe186('0x29')];}_0x28f144[_0xe186('0x1a')](_0x53e537)['send'](_0x404f5a);};}exports['index']=function(_0x4f6447,_0x12e3f9){var _0x57cb83={},_0x427cc6={},_0x542b0e={'count':0x0,'rows':[]};var _0x4d96fc=_[_0xe186('0x2a')](db[_0xe186('0x2b')]['rawAttributes'],function(_0x292a47){return{'name':_0x292a47['fieldName'],'type':_0x292a47[_0xe186('0x2c')][_0xe186('0x2d')]};});_0x427cc6[_0xe186('0x2e')]=_[_0xe186('0x2a')](_0x4d96fc,_0xe186('0x29'));_0x427cc6['query']=_[_0xe186('0x2f')](_0x4f6447['query']);_0x427cc6[_0xe186('0x30')]=_[_0xe186('0x31')](_0x427cc6['model'],_0x427cc6[_0xe186('0x32')]);_0x57cb83[_0xe186('0x33')]=_[_0xe186('0x31')](_0x427cc6['model'],qs[_0xe186('0x34')](_0x4f6447[_0xe186('0x32')][_0xe186('0x34')]));_0x57cb83['attributes']=_0x57cb83[_0xe186('0x33')][_0xe186('0x35')]?_0x57cb83[_0xe186('0x33')]:_0x427cc6[_0xe186('0x2e')];if(!_0x4f6447[_0xe186('0x32')][_0xe186('0x36')](_0xe186('0x37'))){_0x57cb83['limit']=qs[_0xe186('0x1e')](_0x4f6447[_0xe186('0x32')][_0xe186('0x1e')]);_0x57cb83[_0xe186('0x1d')]=qs[_0xe186('0x1d')](_0x4f6447[_0xe186('0x32')][_0xe186('0x1d')]);}_0x57cb83[_0xe186('0x38')]=qs[_0xe186('0x39')](_0x4f6447['query'][_0xe186('0x39')]);_0x57cb83[_0xe186('0x3a')]=qs[_0xe186('0x30')](_[_0xe186('0x3b')](_0x4f6447['query'],_0x427cc6['filters']),_0x4d96fc);if(_0x4f6447['query'][_0xe186('0x3c')]){_0x57cb83[_0xe186('0x3a')]=_['merge'](_0x57cb83[_0xe186('0x3a')],{'$or':_['map'](_0x4d96fc,function(_0x137c4f){if(_0x137c4f[_0xe186('0x2c')]!==_0xe186('0x3d')){var _0xcc7206={};_0xcc7206[_0x137c4f[_0xe186('0x29')]]={'$like':'%'+_0x4f6447[_0xe186('0x32')][_0xe186('0x3c')]+'%'};return _0xcc7206;}})});}_0x57cb83=_[_0xe186('0x3e')]({},_0x57cb83,_0x4f6447[_0xe186('0x3f')]);var _0x5eaad4={'where':_0x57cb83[_0xe186('0x3a')]};return db[_0xe186('0x2b')][_0xe186('0x20')](_0x5eaad4)['then'](function(_0x39fd77){_0x542b0e[_0xe186('0x20')]=_0x39fd77;if(_0x4f6447[_0xe186('0x32')][_0xe186('0x40')]){_0x57cb83['include']=[{'all':!![]}];}return db[_0xe186('0x2b')][_0xe186('0x41')](_0x57cb83);})['then'](function(_0x2baf5c){_0x542b0e[_0xe186('0x42')]=_0x2baf5c;return _0x542b0e;})[_0xe186('0x27')](respondWithFilteredResult(_0x12e3f9,_0x57cb83))[_0xe186('0x43')](handleError(_0x12e3f9,null));};exports[_0xe186('0x44')]=function(_0x3c3773,_0x2b13dd){var _0x157995={'raw':!![],'where':{'id':_0x3c3773[_0xe186('0x45')]['id']}},_0x34ee82={};_0x34ee82[_0xe186('0x2e')]=_['keys'](db[_0xe186('0x2b')][_0xe186('0x46')]);_0x34ee82[_0xe186('0x32')]=_[_0xe186('0x2f')](_0x3c3773['query']);_0x34ee82[_0xe186('0x30')]=_[_0xe186('0x31')](_0x34ee82[_0xe186('0x2e')],_0x34ee82[_0xe186('0x32')]);_0x157995[_0xe186('0x33')]=_['intersection'](_0x34ee82['model'],qs['fields'](_0x3c3773[_0xe186('0x32')][_0xe186('0x34')]));_0x157995[_0xe186('0x33')]=_0x157995[_0xe186('0x33')][_0xe186('0x35')]?_0x157995[_0xe186('0x33')]:_0x34ee82[_0xe186('0x2e')];if(_0x3c3773[_0xe186('0x32')]['includeAll']){_0x157995[_0xe186('0x47')]=[{'all':!![]}];}_0x157995=_[_0xe186('0x3e')]({},_0x157995,_0x3c3773[_0xe186('0x3f')]);return db[_0xe186('0x2b')]['find'](_0x157995)[_0xe186('0x27')](handleEntityNotFound(_0x2b13dd,null))[_0xe186('0x27')](respondWithResult(_0x2b13dd,null))[_0xe186('0x43')](handleError(_0x2b13dd,null));};exports[_0xe186('0x48')]=function(_0x47f2c0,_0x32e0d1){return db['OpenchannelTransferReport']['create'](_0x47f2c0[_0xe186('0x49')],{})[_0xe186('0x27')](respondWithResult(_0x32e0d1,0xc9))[_0xe186('0x43')](handleError(_0x32e0d1,null));};exports[_0xe186('0x25')]=function(_0x1158ba,_0x163088){if(_0x1158ba[_0xe186('0x49')]['id']){delete _0x1158ba[_0xe186('0x49')]['id'];}return db['OpenchannelTransferReport'][_0xe186('0x4a')]({'where':{'id':_0x1158ba[_0xe186('0x45')]['id']}})[_0xe186('0x27')](handleEntityNotFound(_0x163088,null))['then'](saveUpdates(_0x1158ba[_0xe186('0x49')],null))[_0xe186('0x27')](respondWithResult(_0x163088,null))[_0xe186('0x43')](handleError(_0x163088,null));};exports['destroy']=function(_0x5744f5,_0x2cf801){return db[_0xe186('0x2b')][_0xe186('0x4a')]({'where':{'id':_0x5744f5['params']['id']}})[_0xe186('0x27')](handleEntityNotFound(_0x2cf801,null))[_0xe186('0x27')](removeEntity(_0x2cf801,null))[_0xe186('0x43')](handleError(_0x2cf801,null));};exports[_0xe186('0x4b')]=function(_0x17d561,_0xc7b4a9){return db[_0xe186('0x2b')][_0xe186('0x4b')]()[_0xe186('0x27')](respondWithResult(_0xc7b4a9,null))[_0xe186('0x43')](handleError(_0xc7b4a9,null));}; \ No newline at end of file +var _0x04af=['bluebird','mustache','util','sox','to-csv','lodash','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','send','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','where','filters','filter','merge','map','VIRTUAL','options','include','findAll','show','params','length','includeAll','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch'];(function(_0x1211e1,_0x26e532){var _0x44342e=function(_0x3e1756){while(--_0x3e1756){_0x1211e1['push'](_0x1211e1['shift']());}};_0x44342e(++_0x26e532);}(_0x04af,0xd2));var _0xf04a=function(_0x510816,_0x1342bf){_0x510816=_0x510816-0x0;var _0x4bbb6b=_0x04af[_0x510816];return _0x4bbb6b;};'use strict';var emlformat=require(_0xf04a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf04a('0x1'));var jsonpatch=require(_0xf04a('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf04a('0x3'));var Mustache=require(_0xf04a('0x4'));var util=require(_0xf04a('0x5'));var path=require('path');var sox=require(_0xf04a('0x6'));var csv=require(_0xf04a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf04a('0x8'));var squel=require(_0xf04a('0x9'));var crypto=require(_0xf04a('0xa'));var jsforce=require(_0xf04a('0xb'));var deskjs=require(_0xf04a('0xc'));var toCsv=require(_0xf04a('0x7'));var querystring=require(_0xf04a('0xd'));var Papa=require('papaparse');var Redis=require(_0xf04a('0xe'));var authService=require(_0xf04a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf04a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf04a('0x11'))(_0xf04a('0x12'));var utils=require(_0xf04a('0x13'));var config=require(_0xf04a('0x14'));var licenseUtil=require(_0xf04a('0x15'));var db=require(_0xf04a('0x16'))['db'];function respondWithStatusCode(_0x5e8b7c,_0x1a63cc){_0x1a63cc=_0x1a63cc||0xcc;return function(_0x1971cc){if(_0x1971cc){return _0x5e8b7c[_0xf04a('0x17')](_0x1a63cc);}return _0x5e8b7c[_0xf04a('0x18')](_0x1a63cc)[_0xf04a('0x19')]();};}function respondWithResult(_0x4f532f,_0x4d51bc){_0x4d51bc=_0x4d51bc||0xc8;return function(_0x3b30a7){if(_0x3b30a7){return _0x4f532f[_0xf04a('0x18')](_0x4d51bc)[_0xf04a('0x1a')](_0x3b30a7);}};}function respondWithFilteredResult(_0x4fd948,_0x1fddb2){return function(_0x12f6f3){if(_0x12f6f3){var _0x22062a=typeof _0x1fddb2[_0xf04a('0x1b')]==='undefined'&&typeof _0x1fddb2[_0xf04a('0x1c')]===_0xf04a('0x1d');var _0x5dc45d=_0x12f6f3[_0xf04a('0x1e')];var _0x56b174=_0x22062a?0x0:_0x1fddb2[_0xf04a('0x1b')];var _0xe84082=_0x22062a?_0x12f6f3[_0xf04a('0x1e')]:_0x1fddb2[_0xf04a('0x1b')]+_0x1fddb2[_0xf04a('0x1c')];var _0x20240f;if(_0xe84082>=_0x5dc45d){_0xe84082=_0x5dc45d;_0x20240f=0xc8;}else{_0x20240f=0xce;}_0x4fd948[_0xf04a('0x18')](_0x20240f);return _0x4fd948[_0xf04a('0x1f')](_0xf04a('0x20'),_0x56b174+'-'+_0xe84082+'/'+_0x5dc45d)[_0xf04a('0x1a')](_0x12f6f3);}return null;};}function patchUpdates(_0x4e9723){return function(_0x554ce1){try{jsonpatch[_0xf04a('0x21')](_0x554ce1,_0x4e9723,!![]);}catch(_0x50210d){return BPromise['reject'](_0x50210d);}return _0x554ce1['save']();};}function saveUpdates(_0x351fdf,_0x464571){return function(_0x43c9eb){if(_0x43c9eb){return _0x43c9eb[_0xf04a('0x22')](_0x351fdf)[_0xf04a('0x23')](function(_0x41c06d){return _0x41c06d;});}return null;};}function removeEntity(_0x16c981,_0x34c00a){return function(_0x162114){if(_0x162114){return _0x162114['destroy']()['then'](function(){_0x16c981[_0xf04a('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x551264,_0x52409c){return function(_0x218f1b){if(!_0x218f1b){_0x551264['sendStatus'](0x194);}return _0x218f1b;};}function handleError(_0x455ffb,_0x1c724a){_0x1c724a=_0x1c724a||0x1f4;return function(_0x34305c){logger[_0xf04a('0x24')](_0x34305c[_0xf04a('0x25')]);if(_0x34305c[_0xf04a('0x26')]){delete _0x34305c['name'];}_0x455ffb['status'](_0x1c724a)[_0xf04a('0x27')](_0x34305c);};}exports['index']=function(_0x4a425e,_0x3ef2a3){var _0x202a6c={},_0x453647={},_0x33faab={'count':0x0,'rows':[]};var _0x3a97b2=_['map'](db[_0xf04a('0x28')][_0xf04a('0x29')],function(_0x222286){return{'name':_0x222286['fieldName'],'type':_0x222286[_0xf04a('0x2a')][_0xf04a('0x2b')]};});_0x453647[_0xf04a('0x2c')]=_['map'](_0x3a97b2,'name');_0x453647[_0xf04a('0x2d')]=_[_0xf04a('0x2e')](_0x4a425e[_0xf04a('0x2d')]);_0x453647['filters']=_[_0xf04a('0x2f')](_0x453647[_0xf04a('0x2c')],_0x453647[_0xf04a('0x2d')]);_0x202a6c['attributes']=_[_0xf04a('0x2f')](_0x453647[_0xf04a('0x2c')],qs[_0xf04a('0x30')](_0x4a425e[_0xf04a('0x2d')][_0xf04a('0x30')]));_0x202a6c[_0xf04a('0x31')]=_0x202a6c['attributes']['length']?_0x202a6c[_0xf04a('0x31')]:_0x453647[_0xf04a('0x2c')];if(!_0x4a425e[_0xf04a('0x2d')][_0xf04a('0x32')](_0xf04a('0x33'))){_0x202a6c[_0xf04a('0x1c')]=qs[_0xf04a('0x1c')](_0x4a425e[_0xf04a('0x2d')][_0xf04a('0x1c')]);_0x202a6c[_0xf04a('0x1b')]=qs['offset'](_0x4a425e[_0xf04a('0x2d')]['offset']);}_0x202a6c['order']=qs['sort'](_0x4a425e['query']['sort']);_0x202a6c[_0xf04a('0x34')]=qs[_0xf04a('0x35')](_['pick'](_0x4a425e[_0xf04a('0x2d')],_0x453647[_0xf04a('0x35')]),_0x3a97b2);if(_0x4a425e[_0xf04a('0x2d')][_0xf04a('0x36')]){_0x202a6c['where']=_[_0xf04a('0x37')](_0x202a6c[_0xf04a('0x34')],{'$or':_[_0xf04a('0x38')](_0x3a97b2,function(_0x1c9617){if(_0x1c9617[_0xf04a('0x2a')]!==_0xf04a('0x39')){var _0x42854f={};_0x42854f[_0x1c9617['name']]={'$like':'%'+_0x4a425e[_0xf04a('0x2d')]['filter']+'%'};return _0x42854f;}})});}_0x202a6c=_[_0xf04a('0x37')]({},_0x202a6c,_0x4a425e[_0xf04a('0x3a')]);var _0x386649={'where':_0x202a6c[_0xf04a('0x34')]};return db['OpenchannelTransferReport'][_0xf04a('0x1e')](_0x386649)['then'](function(_0x15b01e){_0x33faab[_0xf04a('0x1e')]=_0x15b01e;if(_0x4a425e[_0xf04a('0x2d')]['includeAll']){_0x202a6c[_0xf04a('0x3b')]=[{'all':!![]}];}return db[_0xf04a('0x28')][_0xf04a('0x3c')](_0x202a6c);})[_0xf04a('0x23')](function(_0x396431){_0x33faab['rows']=_0x396431;return _0x33faab;})[_0xf04a('0x23')](respondWithFilteredResult(_0x3ef2a3,_0x202a6c))['catch'](handleError(_0x3ef2a3,null));};exports[_0xf04a('0x3d')]=function(_0x2fd6c0,_0x568510){var _0x477b62={'raw':!![],'where':{'id':_0x2fd6c0[_0xf04a('0x3e')]['id']}},_0x53a5e0={};_0x53a5e0['model']=_['keys'](db[_0xf04a('0x28')][_0xf04a('0x29')]);_0x53a5e0['query']=_['keys'](_0x2fd6c0[_0xf04a('0x2d')]);_0x53a5e0[_0xf04a('0x35')]=_[_0xf04a('0x2f')](_0x53a5e0[_0xf04a('0x2c')],_0x53a5e0[_0xf04a('0x2d')]);_0x477b62['attributes']=_['intersection'](_0x53a5e0[_0xf04a('0x2c')],qs[_0xf04a('0x30')](_0x2fd6c0[_0xf04a('0x2d')][_0xf04a('0x30')]));_0x477b62[_0xf04a('0x31')]=_0x477b62['attributes'][_0xf04a('0x3f')]?_0x477b62[_0xf04a('0x31')]:_0x53a5e0['model'];if(_0x2fd6c0[_0xf04a('0x2d')][_0xf04a('0x40')]){_0x477b62['include']=[{'all':!![]}];}_0x477b62=_[_0xf04a('0x37')]({},_0x477b62,_0x2fd6c0[_0xf04a('0x3a')]);return db['OpenchannelTransferReport'][_0xf04a('0x41')](_0x477b62)[_0xf04a('0x23')](handleEntityNotFound(_0x568510,null))[_0xf04a('0x23')](respondWithResult(_0x568510,null))[_0xf04a('0x42')](handleError(_0x568510,null));};exports['create']=function(_0x233b44,_0xc5f499){return db[_0xf04a('0x28')][_0xf04a('0x43')](_0x233b44[_0xf04a('0x44')],{})[_0xf04a('0x23')](respondWithResult(_0xc5f499,0xc9))[_0xf04a('0x42')](handleError(_0xc5f499,null));};exports[_0xf04a('0x22')]=function(_0x30f394,_0x121cf6){if(_0x30f394[_0xf04a('0x44')]['id']){delete _0x30f394[_0xf04a('0x44')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x30f394[_0xf04a('0x3e')]['id']}})[_0xf04a('0x23')](handleEntityNotFound(_0x121cf6,null))[_0xf04a('0x23')](saveUpdates(_0x30f394[_0xf04a('0x44')],null))[_0xf04a('0x23')](respondWithResult(_0x121cf6,null))[_0xf04a('0x42')](handleError(_0x121cf6,null));};exports[_0xf04a('0x45')]=function(_0x2d32ab,_0x55d928){return db[_0xf04a('0x28')][_0xf04a('0x41')]({'where':{'id':_0x2d32ab['params']['id']}})['then'](handleEntityNotFound(_0x55d928,null))['then'](removeEntity(_0x55d928,null))['catch'](handleError(_0x55d928,null));};exports[_0xf04a('0x46')]=function(_0xb1a651,_0x449f70){return db[_0xf04a('0x28')][_0xf04a('0x46')]()['then'](respondWithResult(_0x449f70,null))['catch'](handleError(_0x449f70,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d7607b8..c06ad53 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 _0x15d4=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x15d4,0x10d));var _0x415d=function(_0x3aa2ba,_0x575249){_0x3aa2ba=_0x3aa2ba-0x0;var _0x4e0f14=_0x15d4[_0x3aa2ba];return _0x4e0f14;};'use strict';var _=require(_0x415d('0x0'));var util=require(_0x415d('0x1'));var logger=require('../../config/logger')(_0x415d('0x2'));var moment=require(_0x415d('0x3'));var BPromise=require(_0x415d('0x4'));var rp=require(_0x415d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x415d('0x6'));var config=require(_0x415d('0x7'));var attributes=require(_0x415d('0x8'));module[_0x415d('0x9')]=function(_0xd48ab3,_0x427811){return _0xd48ab3[_0x415d('0xa')](_0x415d('0xb'),attributes,{'tableName':_0x415d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x415d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a3d=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util'];(function(_0x5fa75f,_0x5b1be6){var _0x1122bb=function(_0x409481){while(--_0x409481){_0x5fa75f['push'](_0x5fa75f['shift']());}};_0x1122bb(++_0x5b1be6);}(_0x1a3d,0x94));var _0xd1a3=function(_0x1143e4,_0x7790ad){_0x1143e4=_0x1143e4-0x0;var _0x1b5db2=_0x1a3d[_0x1143e4];return _0x1b5db2;};'use strict';var _=require(_0xd1a3('0x0'));var util=require(_0xd1a3('0x1'));var logger=require(_0xd1a3('0x2'))(_0xd1a3('0x3'));var moment=require(_0xd1a3('0x4'));var BPromise=require(_0xd1a3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd1a3('0x6'));var rimraf=require(_0xd1a3('0x7'));var config=require(_0xd1a3('0x8'));var attributes=require(_0xd1a3('0x9'));module[_0xd1a3('0xa')]=function(_0x1f228c,_0xfb1d35){return _0x1f228c[_0xd1a3('0xb')](_0xd1a3('0xc'),attributes,{'tableName':_0xd1a3('0xd'),'paranoid':![],'indexes':[{'name':_0xd1a3('0xe'),'fields':[_0xd1a3('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 471ae62..1ea1704 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 _0x9206=['randomstring','ioredis','../../config/logger','rpc','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9206,0x176));var _0x6920=function(_0x5904c7,_0x52abdb){_0x5904c7=_0x5904c7-0x0;var _0x5cf3ce=_0x9206[_0x5904c7];return _0x5cf3ce;};'use strict';var _=require(_0x6920('0x0'));var util=require(_0x6920('0x1'));var moment=require(_0x6920('0x2'));var BPromise=require(_0x6920('0x3'));var rs=require(_0x6920('0x4'));var fs=require('fs');var Redis=require(_0x6920('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6920('0x6'))(_0x6920('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6920('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fb21,_0x31966d,_0x2aad51){return new BPromise(function(_0xef5d38,_0x56bb75){return client['request'](_0x21fb21,_0x2aad51)[_0x6920('0x9')](function(_0xc578c6){logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));logger[_0x6920('0xd')](_0x6920('0xe'),_0x31966d,_0x6920('0xc'),JSON[_0x6920('0xf')](_0xc578c6));if(_0xc578c6[_0x6920('0x10')]){if(_0xc578c6[_0x6920('0x10')][_0x6920('0x11')]===0x1f4){logger[_0x6920('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x31966d,_0xc578c6['error'][_0x6920('0x12')]);return _0x56bb75(_0xc578c6[_0x6920('0x10')]['message']);}logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0xc578c6[_0x6920('0x10')][_0x6920('0x12')]);return _0xef5d38(_0xc578c6[_0x6920('0x10')]['message']);}else{logger[_0x6920('0xa')](_0x6920('0xb'),_0x31966d,_0x6920('0xc'));_0xef5d38(_0xc578c6[_0x6920('0x13')][_0x6920('0x12')]);}})[_0x6920('0x14')](function(_0x3452a4){logger[_0x6920('0x10')](_0x6920('0xb'),_0x31966d,_0x3452a4);_0x56bb75(_0x3452a4);});});} \ No newline at end of file +var _0x0f4d=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x5a36cf,_0x1c6a14){var _0x32a036=function(_0x15baa7){while(--_0x15baa7){_0x5a36cf['push'](_0x5a36cf['shift']());}};_0x32a036(++_0x1c6a14);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x5379c9,_0x2381de){_0x5379c9=_0x5379c9-0x0;var _0x1103ca=_0x0f4d[_0x5379c9];return _0x1103ca;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xd0f4('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd0f4('0x1'));var db=require(_0xd0f4('0x2'))['db'];var utils=require(_0xd0f4('0x3'));var logger=require(_0xd0f4('0x4'))(_0xd0f4('0x5'));var config=require(_0xd0f4('0x6'));var jayson=require(_0xd0f4('0x7'));var client=jayson[_0xd0f4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1164da,_0x27acb8,_0x4d0ab0){return new BPromise(function(_0x3992be,_0x2a0057){return client['request'](_0x1164da,_0x4d0ab0)[_0xd0f4('0x9')](function(_0x2570f0){logger['info'](_0xd0f4('0xa'),_0x27acb8,_0xd0f4('0xb'));logger[_0xd0f4('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x27acb8,'request\x20sent',JSON[_0xd0f4('0xd')](_0x2570f0));if(_0x2570f0[_0xd0f4('0xe')]){if(_0x2570f0[_0xd0f4('0xe')][_0xd0f4('0xf')]===0x1f4){logger[_0xd0f4('0xe')](_0xd0f4('0xa'),_0x27acb8,_0x2570f0[_0xd0f4('0xe')]['message']);return _0x2a0057(_0x2570f0[_0xd0f4('0xe')][_0xd0f4('0x10')]);}logger['error'](_0xd0f4('0xa'),_0x27acb8,_0x2570f0['error'][_0xd0f4('0x10')]);return _0x3992be(_0x2570f0['error'][_0xd0f4('0x10')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x27acb8,'request\x20sent');_0x3992be(_0x2570f0[_0xd0f4('0x11')][_0xd0f4('0x10')]);}})[_0xd0f4('0x12')](function(_0x46c005){logger[_0xd0f4('0xe')](_0xd0f4('0xa'),_0x27acb8,_0x46c005);_0x2a0057(_0x46c005);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1c4a57c..29efaf2 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 _0x7540=['../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post','create','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x391f06,_0x2443de){var _0x2064ec=function(_0x53aa1d){while(--_0x53aa1d){_0x391f06['push'](_0x391f06['shift']());}};_0x2064ec(++_0x2443de);}(_0x7540,0x1d3));var _0x0754=function(_0x57e212,_0xb2da96){_0x57e212=_0x57e212-0x0;var _0x1e9cf7=_0x7540[_0x57e212];return _0x1e9cf7;};'use strict';var multer=require(_0x0754('0x0'));var util=require(_0x0754('0x1'));var path=require(_0x0754('0x2'));var timeout=require(_0x0754('0x3'));var express=require(_0x0754('0x4'));var router=express[_0x0754('0x5')]();var fs_extra=require(_0x0754('0x6'));var auth=require(_0x0754('0x7'));var interaction=require(_0x0754('0x8'));var config=require(_0x0754('0x9'));var controller=require(_0x0754('0xa'));router['get']('/',auth[_0x0754('0xb')](),controller[_0x0754('0xc')]);router[_0x0754('0xd')](_0x0754('0xe'),auth[_0x0754('0xb')](),controller[_0x0754('0xf')]);router[_0x0754('0x10')]('/',auth[_0x0754('0xb')](),controller[_0x0754('0x11')]);router['put'](_0x0754('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0754('0xe'),auth[_0x0754('0xb')](),controller[_0x0754('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe02a=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller'];(function(_0xe3c1e2,_0x4ecf7b){var _0x228fcf=function(_0x391651){while(--_0x391651){_0xe3c1e2['push'](_0xe3c1e2['shift']());}};_0x228fcf(++_0x4ecf7b);}(_0xe02a,0x1ae));var _0xae02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe02a[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xae02('0x0'));var util=require(_0xae02('0x1'));var path=require(_0xae02('0x2'));var timeout=require(_0xae02('0x3'));var express=require(_0xae02('0x4'));var router=express[_0xae02('0x5')]();var fs_extra=require(_0xae02('0x6'));var auth=require(_0xae02('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xae02('0x8'));var controller=require(_0xae02('0x9'));router[_0xae02('0xa')]('/',auth[_0xae02('0xb')](),controller[_0xae02('0xc')]);router[_0xae02('0xa')](_0xae02('0xd'),auth['isAuthenticated'](),controller[_0xae02('0xe')]);router[_0xae02('0xf')]('/',auth[_0xae02('0xb')](),controller[_0xae02('0x10')]);router[_0xae02('0x11')](_0xae02('0xd'),auth[_0xae02('0xb')](),controller[_0xae02('0x12')]);router[_0xae02('0x13')]('/:id',auth[_0xae02('0xb')](),controller[_0xae02('0x14')]);module[_0xae02('0x15')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 403f484..62897ee 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 _0xf999=['STRING','name','exports'];(function(_0x2ea26d,_0x5cb2ad){var _0xb80337=function(_0x2f2acd){while(--_0x2f2acd){_0x2ea26d['push'](_0x2ea26d['shift']());}};_0xb80337(++_0x5cb2ad);}(_0xf999,0x7d));var _0x9f99=function(_0x395b4e,_0x2554a1){_0x395b4e=_0x395b4e-0x0;var _0x52b98b=_0xf999[_0x395b4e];return _0x52b98b;};'use strict';var Sequelize=require('sequelize');module[_0x9f99('0x0')]={'name':{'type':Sequelize[_0x9f99('0x1')],'unique':_0x9f99('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9f99('0x1')]}}; \ No newline at end of file +var _0x0b13=['exports','STRING','name','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0b13,0x1d3));var _0x30b1=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0b13[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x30b1('0x0'));module[_0x30b1('0x1')]={'name':{'type':Sequelize[_0x30b1('0x2')],'unique':_0x30b1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x30b1('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a68c0e6..c2807d6 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 _0x8679=['../../config/environment','sendStatus','status','end','json','offset','undefined','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','map','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','Pause','count','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x4370c1,_0x26ed00){var _0x265ab1=function(_0x9e0b8a){while(--_0x9e0b8a){_0x4370c1['push'](_0x4370c1['shift']());}};_0x265ab1(++_0x26ed00);}(_0x8679,0x138));var _0x9867=function(_0x31b379,_0x2b55ef){_0x31b379=_0x31b379-0x0;var _0x3c1147=_0x8679[_0x31b379];return _0x3c1147;};'use strict';var emlformat=require(_0x9867('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9867('0x1'));var jsonpatch=require(_0x9867('0x2'));var rp=require(_0x9867('0x3'));var moment=require(_0x9867('0x4'));var BPromise=require(_0x9867('0x5'));var Mustache=require(_0x9867('0x6'));var util=require(_0x9867('0x7'));var path=require(_0x9867('0x8'));var sox=require(_0x9867('0x9'));var csv=require(_0x9867('0xa'));var ejs=require(_0x9867('0xb'));var fs=require('fs');var fs_extra=require(_0x9867('0xc'));var _=require(_0x9867('0xd'));var squel=require(_0x9867('0xe'));var crypto=require(_0x9867('0xf'));var jsforce=require(_0x9867('0x10'));var deskjs=require(_0x9867('0x11'));var toCsv=require(_0x9867('0xa'));var querystring=require('querystring');var Papa=require(_0x9867('0x12'));var Redis=require(_0x9867('0x13'));var authService=require(_0x9867('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9867('0x15'));var logger=require(_0x9867('0x16'))(_0x9867('0x17'));var utils=require('../../config/utils');var config=require(_0x9867('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f834,_0x404836){_0x404836=_0x404836||0xcc;return function(_0x1924a0){if(_0x1924a0){return _0x17f834[_0x9867('0x19')](_0x404836);}return _0x17f834[_0x9867('0x1a')](_0x404836)[_0x9867('0x1b')]();};}function respondWithResult(_0x3d1c2c,_0x1a6a00){_0x1a6a00=_0x1a6a00||0xc8;return function(_0x5ebd23){if(_0x5ebd23){return _0x3d1c2c[_0x9867('0x1a')](_0x1a6a00)[_0x9867('0x1c')](_0x5ebd23);}};}function respondWithFilteredResult(_0x5c6c17,_0x3805f5){return function(_0x5b5620){if(_0x5b5620){var _0x2b7426=typeof _0x3805f5[_0x9867('0x1d')]===_0x9867('0x1e')&&typeof _0x3805f5['limit']===_0x9867('0x1e');var _0x1be8d7=_0x5b5620['count'];var _0x2f40d8=_0x2b7426?0x0:_0x3805f5[_0x9867('0x1d')];var _0x42898f=_0x2b7426?_0x5b5620['count']:_0x3805f5[_0x9867('0x1d')]+_0x3805f5['limit'];var _0x26ccbe;if(_0x42898f>=_0x1be8d7){_0x42898f=_0x1be8d7;_0x26ccbe=0xc8;}else{_0x26ccbe=0xce;}_0x5c6c17['status'](_0x26ccbe);return _0x5c6c17[_0x9867('0x1f')](_0x9867('0x20'),_0x2f40d8+'-'+_0x42898f+'/'+_0x1be8d7)[_0x9867('0x1c')](_0x5b5620);}return null;};}function patchUpdates(_0x3bbfb8){return function(_0x2e1506){try{jsonpatch[_0x9867('0x21')](_0x2e1506,_0x3bbfb8,!![]);}catch(_0x1a4e91){return BPromise['reject'](_0x1a4e91);}return _0x2e1506[_0x9867('0x22')]();};}function saveUpdates(_0x334134,_0x552161){return function(_0x4c4f6c){if(_0x4c4f6c){return _0x4c4f6c[_0x9867('0x23')](_0x334134)[_0x9867('0x24')](function(_0x15090c){return _0x15090c;});}return null;};}function removeEntity(_0x58e5ec,_0x12da8d){return function(_0x3316c8){if(_0x3316c8){return _0x3316c8[_0x9867('0x25')]()[_0x9867('0x24')](function(){var _0x525c32=_0x3316c8[_0x9867('0x26')]({'plain':!![]});var _0x7c089e=_0x9867('0x27');return db[_0x9867('0x28')][_0x9867('0x25')]({'where':{'type':_0x7c089e,'resourceId':_0x525c32['id']}})[_0x9867('0x24')](function(){return _0x3316c8;});})[_0x9867('0x24')](function(){_0x58e5ec[_0x9867('0x1a')](0xcc)[_0x9867('0x1b')]();});}};}function handleEntityNotFound(_0x26505b,_0x32b4cd){return function(_0x263c04){if(!_0x263c04){_0x26505b['sendStatus'](0x194);}return _0x263c04;};}function handleError(_0x1c3060,_0x1b4d6a){_0x1b4d6a=_0x1b4d6a||0x1f4;return function(_0x1a11f6){logger[_0x9867('0x29')](_0x1a11f6[_0x9867('0x2a')]);if(_0x1a11f6[_0x9867('0x2b')]){delete _0x1a11f6['name'];}_0x1c3060['status'](_0x1b4d6a)[_0x9867('0x2c')](_0x1a11f6);};}exports[_0x9867('0x2d')]=function(_0x5d1ceb,_0x4f532c){var _0x26935d={},_0x5287a8={},_0x2cf436={'count':0x0,'rows':[]};var _0x25f03b=_[_0x9867('0x2e')](db['Pause']['rawAttributes'],function(_0x3e21b5){return{'name':_0x3e21b5[_0x9867('0x2f')],'type':_0x3e21b5[_0x9867('0x30')][_0x9867('0x31')]};});_0x5287a8['model']=_[_0x9867('0x2e')](_0x25f03b,_0x9867('0x2b'));_0x5287a8[_0x9867('0x32')]=_['keys'](_0x5d1ceb[_0x9867('0x32')]);_0x5287a8[_0x9867('0x33')]=_['intersection'](_0x5287a8[_0x9867('0x34')],_0x5287a8[_0x9867('0x32')]);_0x26935d[_0x9867('0x35')]=_[_0x9867('0x36')](_0x5287a8[_0x9867('0x34')],qs[_0x9867('0x37')](_0x5d1ceb[_0x9867('0x32')]['fields']));_0x26935d[_0x9867('0x35')]=_0x26935d['attributes'][_0x9867('0x38')]?_0x26935d[_0x9867('0x35')]:_0x5287a8[_0x9867('0x34')];if(!_0x5d1ceb[_0x9867('0x32')][_0x9867('0x39')](_0x9867('0x3a'))){_0x26935d[_0x9867('0x3b')]=qs[_0x9867('0x3b')](_0x5d1ceb[_0x9867('0x32')][_0x9867('0x3b')]);_0x26935d[_0x9867('0x1d')]=qs[_0x9867('0x1d')](_0x5d1ceb['query']['offset']);}_0x26935d['order']=qs['sort'](_0x5d1ceb[_0x9867('0x32')][_0x9867('0x3c')]);_0x26935d['where']=qs[_0x9867('0x33')](_[_0x9867('0x3d')](_0x5d1ceb['query'],_0x5287a8[_0x9867('0x33')]),_0x25f03b);if(_0x5d1ceb['query'][_0x9867('0x3e')]){_0x26935d[_0x9867('0x3f')]=_[_0x9867('0x40')](_0x26935d[_0x9867('0x3f')],{'$or':_[_0x9867('0x2e')](_0x25f03b,function(_0x203f7d){if(_0x203f7d[_0x9867('0x30')]!==_0x9867('0x41')){var _0x1ea8af={};_0x1ea8af[_0x203f7d[_0x9867('0x2b')]]={'$like':'%'+_0x5d1ceb[_0x9867('0x32')]['filter']+'%'};return _0x1ea8af;}})});}_0x26935d=_[_0x9867('0x40')]({},_0x26935d,_0x5d1ceb[_0x9867('0x42')]);var _0x3e3326={'where':_0x26935d[_0x9867('0x3f')]};return db[_0x9867('0x43')][_0x9867('0x44')](_0x3e3326)[_0x9867('0x24')](function(_0x4c7cc6){_0x2cf436['count']=_0x4c7cc6;if(_0x5d1ceb['query']['includeAll']){_0x26935d['include']=[{'all':!![]}];}return db[_0x9867('0x43')][_0x9867('0x45')](_0x26935d);})['then'](function(_0x56b64e){_0x2cf436[_0x9867('0x46')]=_0x56b64e;return _0x2cf436;})[_0x9867('0x24')](respondWithFilteredResult(_0x4f532c,_0x26935d))[_0x9867('0x47')](handleError(_0x4f532c,null));};exports[_0x9867('0x48')]=function(_0x108710,_0x129dc0){var _0x52a6be={'raw':!![],'where':{'id':_0x108710[_0x9867('0x49')]['id']}},_0x219357={};_0x219357[_0x9867('0x34')]=_[_0x9867('0x4a')](db['Pause'][_0x9867('0x4b')]);_0x219357[_0x9867('0x32')]=_[_0x9867('0x4a')](_0x108710[_0x9867('0x32')]);_0x219357['filters']=_[_0x9867('0x36')](_0x219357[_0x9867('0x34')],_0x219357[_0x9867('0x32')]);_0x52a6be['attributes']=_[_0x9867('0x36')](_0x219357[_0x9867('0x34')],qs[_0x9867('0x37')](_0x108710[_0x9867('0x32')]['fields']));_0x52a6be['attributes']=_0x52a6be['attributes']['length']?_0x52a6be[_0x9867('0x35')]:_0x219357[_0x9867('0x34')];if(_0x108710['query'][_0x9867('0x4c')]){_0x52a6be[_0x9867('0x4d')]=[{'all':!![]}];}_0x52a6be=_[_0x9867('0x40')]({},_0x52a6be,_0x108710[_0x9867('0x42')]);return db[_0x9867('0x43')][_0x9867('0x4e')](_0x52a6be)['then'](handleEntityNotFound(_0x129dc0,null))['then'](respondWithResult(_0x129dc0,null))[_0x9867('0x47')](handleError(_0x129dc0,null));};exports[_0x9867('0x4f')]=function(_0x4f74f4,_0x5d0246){return db[_0x9867('0x43')][_0x9867('0x4f')](_0x4f74f4[_0x9867('0x50')],{})[_0x9867('0x24')](function(_0x5ef25d){var _0x4e714a=_0x4f74f4[_0x9867('0x51')][_0x9867('0x26')]({'plain':!![]});if(!_0x4e714a)throw new Error(_0x9867('0x52'));if(_0x4e714a['role']===_0x9867('0x51')){var _0x728e92=_0x5ef25d[_0x9867('0x26')]({'plain':!![]});var _0x47b5d0='Pauses';return db['UserProfileSection'][_0x9867('0x4e')]({'where':{'name':_0x47b5d0,'userProfileId':_0x4e714a['userProfileId']},'raw':!![]})['then'](function(_0x3ee9d5){if(_0x3ee9d5&&_0x3ee9d5['autoAssociation']===0x0){return db[_0x9867('0x28')][_0x9867('0x4f')]({'name':_0x728e92[_0x9867('0x2b')],'resourceId':_0x728e92['id'],'type':_0x3ee9d5[_0x9867('0x2b')],'sectionId':_0x3ee9d5['id']},{})[_0x9867('0x24')](function(){return _0x5ef25d;});}else{return _0x5ef25d;}})[_0x9867('0x47')](function(_0x54a2d3){logger[_0x9867('0x29')](_0x9867('0x53'),_0x54a2d3);throw _0x54a2d3;});}return _0x5ef25d;})[_0x9867('0x24')](respondWithResult(_0x5d0246,0xc9))[_0x9867('0x47')](handleError(_0x5d0246,null));};exports['update']=function(_0x56e1f4,_0x4c35e3){if(_0x56e1f4[_0x9867('0x50')]['id']){delete _0x56e1f4['body']['id'];}return db[_0x9867('0x43')][_0x9867('0x4e')]({'where':{'id':_0x56e1f4[_0x9867('0x49')]['id']}})[_0x9867('0x24')](handleEntityNotFound(_0x4c35e3,null))[_0x9867('0x24')](saveUpdates(_0x56e1f4[_0x9867('0x50')],null))[_0x9867('0x24')](respondWithResult(_0x4c35e3,null))[_0x9867('0x47')](handleError(_0x4c35e3,null));};exports[_0x9867('0x25')]=function(_0x30fd7e,_0x316bf4){return db[_0x9867('0x43')][_0x9867('0x4e')]({'where':{'id':_0x30fd7e[_0x9867('0x49')]['id']}})['then'](handleEntityNotFound(_0x316bf4,null))[_0x9867('0x24')](removeEntity(_0x316bf4,null))['catch'](handleError(_0x316bf4,null));}; \ No newline at end of file +var _0x9846=['where','filter','includeAll','findAll','rows','catch','show','params','options','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','count','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','merge'];(function(_0x44b55f,_0xa6d92d){var _0x56b26d=function(_0x1ab091){while(--_0x1ab091){_0x44b55f['push'](_0x44b55f['shift']());}};_0x56b26d(++_0xa6d92d);}(_0x9846,0xf5));var _0x6984=function(_0x3b5f24,_0x49bfd5){_0x3b5f24=_0x3b5f24-0x0;var _0x2c5f2f=_0x9846[_0x3b5f24];return _0x2c5f2f;};'use strict';var emlformat=require(_0x6984('0x0'));var rimraf=require(_0x6984('0x1'));var zipdir=require(_0x6984('0x2'));var jsonpatch=require(_0x6984('0x3'));var rp=require(_0x6984('0x4'));var moment=require(_0x6984('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6984('0x6'));var util=require(_0x6984('0x7'));var path=require(_0x6984('0x8'));var sox=require(_0x6984('0x9'));var csv=require(_0x6984('0xa'));var ejs=require(_0x6984('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6984('0xc'));var crypto=require('crypto');var jsforce=require(_0x6984('0xd'));var deskjs=require(_0x6984('0xe'));var toCsv=require(_0x6984('0xa'));var querystring=require(_0x6984('0xf'));var Papa=require(_0x6984('0x10'));var Redis=require(_0x6984('0x11'));var authService=require(_0x6984('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6984('0x13'));var utils=require('../../config/utils');var config=require(_0x6984('0x14'));var licenseUtil=require(_0x6984('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fd9e3,_0x1b2081){_0x1b2081=_0x1b2081||0xcc;return function(_0x249a40){if(_0x249a40){return _0x3fd9e3[_0x6984('0x16')](_0x1b2081);}return _0x3fd9e3[_0x6984('0x17')](_0x1b2081)['end']();};}function respondWithResult(_0x44e47d,_0xe7202b){_0xe7202b=_0xe7202b||0xc8;return function(_0x4f51b7){if(_0x4f51b7){return _0x44e47d['status'](_0xe7202b)['json'](_0x4f51b7);}};}function respondWithFilteredResult(_0x2ede1e,_0x52b9c9){return function(_0x5213b0){if(_0x5213b0){var _0x3d5ac1=typeof _0x52b9c9[_0x6984('0x18')]==='undefined'&&typeof _0x52b9c9[_0x6984('0x19')]===_0x6984('0x1a');var _0xfff815=_0x5213b0[_0x6984('0x1b')];var _0x3ae894=_0x3d5ac1?0x0:_0x52b9c9[_0x6984('0x18')];var _0x145fa5=_0x3d5ac1?_0x5213b0[_0x6984('0x1b')]:_0x52b9c9[_0x6984('0x18')]+_0x52b9c9[_0x6984('0x19')];var _0x366577;if(_0x145fa5>=_0xfff815){_0x145fa5=_0xfff815;_0x366577=0xc8;}else{_0x366577=0xce;}_0x2ede1e[_0x6984('0x17')](_0x366577);return _0x2ede1e['set']('Content-Range',_0x3ae894+'-'+_0x145fa5+'/'+_0xfff815)[_0x6984('0x1c')](_0x5213b0);}return null;};}function patchUpdates(_0x534b36){return function(_0x5cc4d9){try{jsonpatch[_0x6984('0x1d')](_0x5cc4d9,_0x534b36,!![]);}catch(_0x30ef12){return BPromise[_0x6984('0x1e')](_0x30ef12);}return _0x5cc4d9[_0x6984('0x1f')]();};}function saveUpdates(_0x29d936,_0x44f1ce){return function(_0x4bcb39){if(_0x4bcb39){return _0x4bcb39[_0x6984('0x20')](_0x29d936)[_0x6984('0x21')](function(_0x5c09ed){return _0x5c09ed;});}return null;};}function removeEntity(_0x12343c,_0xe89f62){return function(_0x2f29ce){if(_0x2f29ce){return _0x2f29ce[_0x6984('0x22')]()[_0x6984('0x21')](function(){var _0x4c1b91=_0x2f29ce[_0x6984('0x23')]({'plain':!![]});var _0x47b92d='Pauses';return db[_0x6984('0x24')]['destroy']({'where':{'type':_0x47b92d,'resourceId':_0x4c1b91['id']}})[_0x6984('0x21')](function(){return _0x2f29ce;});})['then'](function(){_0x12343c[_0x6984('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b0e18,_0x2691b5){return function(_0x545b00){if(!_0x545b00){_0x5b0e18[_0x6984('0x16')](0x194);}return _0x545b00;};}function handleError(_0x53826c,_0x58ebd7){_0x58ebd7=_0x58ebd7||0x1f4;return function(_0x3251b7){logger[_0x6984('0x25')](_0x3251b7['stack']);if(_0x3251b7[_0x6984('0x26')]){delete _0x3251b7[_0x6984('0x26')];}_0x53826c[_0x6984('0x17')](_0x58ebd7)[_0x6984('0x27')](_0x3251b7);};}exports[_0x6984('0x28')]=function(_0x19a33e,_0x2e3b26){var _0x2e906b={},_0x43ee25={},_0x3e879d={'count':0x0,'rows':[]};var _0x4b90c8=_[_0x6984('0x29')](db[_0x6984('0x2a')][_0x6984('0x2b')],function(_0x1ea14b){return{'name':_0x1ea14b[_0x6984('0x2c')],'type':_0x1ea14b[_0x6984('0x2d')][_0x6984('0x2e')]};});_0x43ee25['model']=_[_0x6984('0x29')](_0x4b90c8,'name');_0x43ee25['query']=_[_0x6984('0x2f')](_0x19a33e[_0x6984('0x30')]);_0x43ee25[_0x6984('0x31')]=_[_0x6984('0x32')](_0x43ee25[_0x6984('0x33')],_0x43ee25[_0x6984('0x30')]);_0x2e906b[_0x6984('0x34')]=_[_0x6984('0x32')](_0x43ee25[_0x6984('0x33')],qs['fields'](_0x19a33e[_0x6984('0x30')][_0x6984('0x35')]));_0x2e906b[_0x6984('0x34')]=_0x2e906b['attributes'][_0x6984('0x36')]?_0x2e906b[_0x6984('0x34')]:_0x43ee25['model'];if(!_0x19a33e['query'][_0x6984('0x37')]('nolimit')){_0x2e906b['limit']=qs['limit'](_0x19a33e[_0x6984('0x30')][_0x6984('0x19')]);_0x2e906b[_0x6984('0x18')]=qs['offset'](_0x19a33e[_0x6984('0x30')][_0x6984('0x18')]);}_0x2e906b['order']=qs[_0x6984('0x38')](_0x19a33e[_0x6984('0x30')][_0x6984('0x38')]);_0x2e906b['where']=qs[_0x6984('0x31')](_[_0x6984('0x39')](_0x19a33e[_0x6984('0x30')],_0x43ee25[_0x6984('0x31')]),_0x4b90c8);if(_0x19a33e[_0x6984('0x30')]['filter']){_0x2e906b['where']=_[_0x6984('0x3a')](_0x2e906b[_0x6984('0x3b')],{'$or':_['map'](_0x4b90c8,function(_0x54fae8){if(_0x54fae8[_0x6984('0x2d')]!=='VIRTUAL'){var _0x505c65={};_0x505c65[_0x54fae8['name']]={'$like':'%'+_0x19a33e[_0x6984('0x30')][_0x6984('0x3c')]+'%'};return _0x505c65;}})});}_0x2e906b=_['merge']({},_0x2e906b,_0x19a33e['options']);var _0x3b4cf1={'where':_0x2e906b[_0x6984('0x3b')]};return db[_0x6984('0x2a')][_0x6984('0x1b')](_0x3b4cf1)[_0x6984('0x21')](function(_0x57bd45){_0x3e879d[_0x6984('0x1b')]=_0x57bd45;if(_0x19a33e['query'][_0x6984('0x3d')]){_0x2e906b['include']=[{'all':!![]}];}return db[_0x6984('0x2a')][_0x6984('0x3e')](_0x2e906b);})[_0x6984('0x21')](function(_0x231bf4){_0x3e879d[_0x6984('0x3f')]=_0x231bf4;return _0x3e879d;})[_0x6984('0x21')](respondWithFilteredResult(_0x2e3b26,_0x2e906b))[_0x6984('0x40')](handleError(_0x2e3b26,null));};exports[_0x6984('0x41')]=function(_0x2977e0,_0x42af1d){var _0x18da09={'raw':!![],'where':{'id':_0x2977e0[_0x6984('0x42')]['id']}},_0xd92aa5={};_0xd92aa5[_0x6984('0x33')]=_[_0x6984('0x2f')](db['Pause'][_0x6984('0x2b')]);_0xd92aa5[_0x6984('0x30')]=_[_0x6984('0x2f')](_0x2977e0['query']);_0xd92aa5[_0x6984('0x31')]=_[_0x6984('0x32')](_0xd92aa5['model'],_0xd92aa5[_0x6984('0x30')]);_0x18da09[_0x6984('0x34')]=_[_0x6984('0x32')](_0xd92aa5[_0x6984('0x33')],qs[_0x6984('0x35')](_0x2977e0['query'][_0x6984('0x35')]));_0x18da09[_0x6984('0x34')]=_0x18da09[_0x6984('0x34')][_0x6984('0x36')]?_0x18da09[_0x6984('0x34')]:_0xd92aa5[_0x6984('0x33')];if(_0x2977e0['query']['includeAll']){_0x18da09['include']=[{'all':!![]}];}_0x18da09=_['merge']({},_0x18da09,_0x2977e0[_0x6984('0x43')]);return db[_0x6984('0x2a')]['find'](_0x18da09)['then'](handleEntityNotFound(_0x42af1d,null))[_0x6984('0x21')](respondWithResult(_0x42af1d,null))[_0x6984('0x40')](handleError(_0x42af1d,null));};exports['create']=function(_0x477efa,_0xe6b958){return db[_0x6984('0x2a')]['create'](_0x477efa['body'],{})[_0x6984('0x21')](function(_0x398692){var _0x32df47=_0x477efa[_0x6984('0x44')]['get']({'plain':!![]});if(!_0x32df47)throw new Error(_0x6984('0x45'));if(_0x32df47['role']===_0x6984('0x44')){var _0x2406c5=_0x398692['get']({'plain':!![]});var _0x2aebb3='Pauses';return db[_0x6984('0x46')][_0x6984('0x47')]({'where':{'name':_0x2aebb3,'userProfileId':_0x32df47['userProfileId']},'raw':!![]})['then'](function(_0x175e02){if(_0x175e02&&_0x175e02[_0x6984('0x48')]===0x0){return db['UserProfileResource'][_0x6984('0x49')]({'name':_0x2406c5['name'],'resourceId':_0x2406c5['id'],'type':_0x175e02[_0x6984('0x26')],'sectionId':_0x175e02['id']},{})[_0x6984('0x21')](function(){return _0x398692;});}else{return _0x398692;}})['catch'](function(_0x38c143){logger[_0x6984('0x25')](_0x6984('0x4a'),_0x38c143);throw _0x38c143;});}return _0x398692;})[_0x6984('0x21')](respondWithResult(_0xe6b958,0xc9))[_0x6984('0x40')](handleError(_0xe6b958,null));};exports[_0x6984('0x20')]=function(_0x231e70,_0xb2e28d){if(_0x231e70[_0x6984('0x4b')]['id']){delete _0x231e70[_0x6984('0x4b')]['id'];}return db[_0x6984('0x2a')][_0x6984('0x47')]({'where':{'id':_0x231e70[_0x6984('0x42')]['id']}})[_0x6984('0x21')](handleEntityNotFound(_0xb2e28d,null))[_0x6984('0x21')](saveUpdates(_0x231e70['body'],null))['then'](respondWithResult(_0xb2e28d,null))['catch'](handleError(_0xb2e28d,null));};exports[_0x6984('0x22')]=function(_0x5c808b,_0x1618f3){return db[_0x6984('0x2a')][_0x6984('0x47')]({'where':{'id':_0x5c808b['params']['id']}})[_0x6984('0x21')](handleEntityNotFound(_0x1618f3,null))['then'](removeEntity(_0x1618f3,null))[_0x6984('0x40')](handleError(_0x1618f3,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 6d98674..7a48aaa 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 _0x7217=['../../config/environment','./pause.attributes','exports','define','Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x31df6f,_0x380e73){var _0x31e353=function(_0x3a434b){while(--_0x3a434b){_0x31df6f['push'](_0x31df6f['shift']());}};_0x31e353(++_0x380e73);}(_0x7217,0x19e));var _0x7721=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x7217[_0x1cfa0d];return _0xe33279;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x57f99b,_0x48313a){var _0x4b4c15=function(_0x2c9a5b){while(--_0x2c9a5b){_0x57f99b['push'](_0x57f99b['shift']());}};_0x4b4c15(++_0x48313a);}(_0xf494,0x1c6));var _0x4f49=function(_0x438b99,_0x526e6f){_0x438b99=_0x438b99-0x0;var _0x670e2e=_0xf494[_0x438b99];return _0x670e2e;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index bedd10c..eb09b83 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(_0x4a1c54,_0x3a3deb){var _0x3176cd=function(_0x5d2a50){while(--_0x5d2a50){_0x4a1c54['push'](_0x4a1c54['shift']());}};_0x3176cd(++_0x3a3deb);}(_0xb10b,0x12a));var _0xbb10=function(_0x8cb31b,_0x509016){_0x8cb31b=_0x8cb31b-0x0;var _0x2ce32e=_0xb10b[_0x8cb31b];return _0x2ce32e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x27cf7,_0x554eff){var _0x2e332a=function(_0x4ccd48){while(--_0x4ccd48){_0x27cf7['push'](_0x27cf7['shift']());}};_0x2e332a(++_0x554eff);}(_0xb10b,0x12a));var _0xbb10=function(_0x284d8f,_0x1afc9e){_0x284d8f=_0x284d8f-0x0;var _0x6acf64=_0xb10b[_0x284d8f];return _0x6acf64;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index ccd9f53..236918b 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 _0xf72b=['./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','download','join','root','server/files/plugins','originalname','replace','%s-%s%s','now','extname','post','single','upload','webhookPost','put','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xf72b,0x1d9));var _0xbf72=function(_0x43d1ed,_0x1a276a){_0x43d1ed=_0x43d1ed-0x0;var _0x31d32b=_0xf72b[_0x43d1ed];return _0x31d32b;};'use strict';var multer=require(_0xbf72('0x0'));var util=require('util');var path=require(_0xbf72('0x1'));var timeout=require('connect-timeout');var express=require(_0xbf72('0x2'));var router=express[_0xbf72('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbf72('0x4'));var interaction=require(_0xbf72('0x5'));var config=require(_0xbf72('0x6'));var controller=require(_0xbf72('0x7'));router[_0xbf72('0x8')]('/',auth[_0xbf72('0x9')](),controller['index']);router[_0xbf72('0x8')](_0xbf72('0xa'),controller[_0xbf72('0xb')]);router[_0xbf72('0x8')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller['show']);router[_0xbf72('0x8')]('/:id/download',auth[_0xbf72('0x9')](),controller[_0xbf72('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xaec095,_0x1c3453,_0x1853eb){_0x1853eb(null,path[_0xbf72('0xe')](config[_0xbf72('0xf')],_0xbf72('0x10')));},'filename':function(_0x14f6e6,_0x5eb4cc,_0x5967f5){_0x5eb4cc[_0xbf72('0x11')]=_0x5eb4cc[_0xbf72('0x11')][_0xbf72('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5967f5(null,util['format'](_0xbf72('0x13'),path['basename'](_0x5eb4cc['originalname'],path['extname'](_0x5eb4cc[_0xbf72('0x11')])),Date[_0xbf72('0x14')](),path[_0xbf72('0x15')](_0x5eb4cc[_0xbf72('0x11')])));}})});router[_0xbf72('0x16')]('/',upload[_0xbf72('0x17')]('file'),controller[_0xbf72('0x18')]);router[_0xbf72('0x16')](_0xbf72('0xa'),controller[_0xbf72('0x19')]);router[_0xbf72('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0xbf72('0x1b')]);router[_0xbf72('0x1c')](_0xbf72('0xc'),auth[_0xbf72('0x9')](),controller[_0xbf72('0x1c')]);module[_0xbf72('0x1d')]=router; \ No newline at end of file +var _0x5db8=['basename','extname','now','single','file','upload','post','webhookPost','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./plugin.controller','get','isAuthenticated','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','format','%s-%s%s'];(function(_0x2f83ac,_0x31a4a8){var _0x580b10=function(_0x3dddd2){while(--_0x3dddd2){_0x2f83ac['push'](_0x2f83ac['shift']());}};_0x580b10(++_0x31a4a8);}(_0x5db8,0xbb));var _0x85db=function(_0x211bc3,_0x5860c8){_0x211bc3=_0x211bc3-0x0;var _0x34c9a2=_0x5db8[_0x211bc3];return _0x34c9a2;};'use strict';var multer=require(_0x85db('0x0'));var util=require(_0x85db('0x1'));var path=require(_0x85db('0x2'));var timeout=require('connect-timeout');var express=require(_0x85db('0x3'));var router=express[_0x85db('0x4')]();var fs_extra=require(_0x85db('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x85db('0x6'));var controller=require(_0x85db('0x7'));router[_0x85db('0x8')]('/',auth[_0x85db('0x9')](),controller['index']);router['get'](_0x85db('0xa'),controller[_0x85db('0xb')]);router[_0x85db('0x8')](_0x85db('0xc'),auth['isAuthenticated'](),controller[_0x85db('0xd')]);router['get'](_0x85db('0xe'),auth[_0x85db('0x9')](),controller[_0x85db('0xf')]);var upload=multer({'storage':multer[_0x85db('0x10')]({'destination':function(_0x5491fa,_0x54feb2,_0x51fd42){_0x51fd42(null,path[_0x85db('0x11')](config[_0x85db('0x12')],'server/files/plugins'));},'filename':function(_0x11ac68,_0x541f2f,_0x437f7a){_0x541f2f[_0x85db('0x13')]=_0x541f2f[_0x85db('0x13')][_0x85db('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x437f7a(null,util[_0x85db('0x15')](_0x85db('0x16'),path[_0x85db('0x17')](_0x541f2f[_0x85db('0x13')],path[_0x85db('0x18')](_0x541f2f[_0x85db('0x13')])),Date[_0x85db('0x19')](),path[_0x85db('0x18')](_0x541f2f[_0x85db('0x13')])));}})});router['post']('/',upload[_0x85db('0x1a')](_0x85db('0x1b')),controller[_0x85db('0x1c')]);router[_0x85db('0x1d')](_0x85db('0xa'),controller[_0x85db('0x1e')]);router[_0x85db('0x1f')]('/:id',auth[_0x85db('0x9')](),controller[_0x85db('0x20')]);router[_0x85db('0x21')](_0x85db('0xc'),auth[_0x85db('0x9')](),controller[_0x85db('0x21')]);module[_0x85db('0x22')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index d709df7..a56683b 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 _0xcbb6=['ENUM','html','TEXT','BOOLEAN','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING'];(function(_0x18bd48,_0x4d603d){var _0x38ab0e=function(_0x1aa19f){while(--_0x1aa19f){_0x18bd48['push'](_0x18bd48['shift']());}};_0x38ab0e(++_0x4d603d);}(_0xcbb6,0x1de));var _0x6cbb=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xcbb6[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x6cbb('0x0'));module['exports']={'name':{'type':Sequelize[_0x6cbb('0x1')]},'type':{'type':Sequelize[_0x6cbb('0x2')](_0x6cbb('0x3'),'script')},'description':{'type':Sequelize[_0x6cbb('0x4')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x6cbb('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x6cbb('0x5')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x6cbb('0x2')](_0x6cbb('0x6'),'agentOnly',_0x6cbb('0x7'),_0x6cbb('0x8')),'defaultValue':_0x6cbb('0x7'),'comment':_0x6cbb('0x9')},'icon':{'type':Sequelize[_0x6cbb('0x1')]},'adminUrl':{'type':Sequelize[_0x6cbb('0x1')]},'agentUrl':{'type':Sequelize[_0x6cbb('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x6cbb('0x1')]}}; \ No newline at end of file +var _0xf04f=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x36c304,_0x26cebe){var _0x24e86e=function(_0x4c677f){while(--_0x4c677f){_0x36c304['push'](_0x36c304['shift']());}};_0x24e86e(++_0x26cebe);}(_0xf04f,0x119));var _0xff04=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xf04f[_0x455c6c];return _0x488242;};'use strict';var Sequelize=require('sequelize');module[_0xff04('0x0')]={'name':{'type':Sequelize[_0xff04('0x1')]},'type':{'type':Sequelize[_0xff04('0x2')]('html',_0xff04('0x3'))},'description':{'type':Sequelize[_0xff04('0x4')]},'version':{'type':Sequelize[_0xff04('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xff04('0x5')},'active':{'type':Sequelize[_0xff04('0x6')],'defaultValue':0x0,'comment':_0xff04('0x7')},'sidebar':{'type':Sequelize[_0xff04('0x2')](_0xff04('0x8'),_0xff04('0x9'),'always',_0xff04('0xa')),'defaultValue':'always','comment':_0xff04('0xb')},'icon':{'type':Sequelize[_0xff04('0x1')]},'adminUrl':{'type':Sequelize[_0xff04('0x1')]},'agentUrl':{'type':Sequelize[_0xff04('0x1')]},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0xff04('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index cea0bd9..e0c50f2 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 _0x071a=['file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','sidebar','icon','icon-apps','version','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','endsWith','statusCode','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','to-csv','querystring','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','server/files/plugins','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','glob','**/*','join','root','dirname','basename','node_modules/**/*','finalize','close','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload'];(function(_0x586cc7,_0x567e74){var _0x858554=function(_0xc89341){while(--_0xc89341){_0x586cc7['push'](_0x586cc7['shift']());}};_0x858554(++_0x567e74);}(_0x071a,0xe4));var _0xa071=function(_0x5640ff,_0x398f96){_0x5640ff=_0x5640ff-0x0;var _0x3e6b92=_0x071a[_0x5640ff];return _0x3e6b92;};'use strict';var emlformat=require(_0xa071('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa071('0x1'));var jsonpatch=require(_0xa071('0x2'));var rp=require('request-promise');var moment=require(_0xa071('0x3'));var BPromise=require(_0xa071('0x4'));var Mustache=require(_0xa071('0x5'));var util=require(_0xa071('0x6'));var path=require(_0xa071('0x7'));var sox=require(_0xa071('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(_0xa071('0x9'));var crypto=require(_0xa071('0xa'));var jsforce=require(_0xa071('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa071('0xc'));var querystring=require(_0xa071('0xd'));var Papa=require('papaparse');var extract=require(_0xa071('0xe'));var rimraf=require(_0xa071('0xf'));var archiver=require(_0xa071('0x10'));var Redis=require(_0xa071('0x11'));var authService=require(_0xa071('0x12'));var qs=require(_0xa071('0x13'));var as=require(_0xa071('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa071('0x15'))(_0xa071('0x16'));var utils=require(_0xa071('0x17'));var config=require(_0xa071('0x18'));var licenseUtil=require(_0xa071('0x19'));var db=require(_0xa071('0x1a'))['db'];config['redis']=_[_0xa071('0x1b')](config[_0xa071('0x1c')],{'host':_0xa071('0x1d'),'port':0x18eb});var socket=require(_0xa071('0x1e'))(new Redis(config[_0xa071('0x1c')]));require(_0xa071('0x1f'))[_0xa071('0x20')](socket);function respondWithStatusCode(_0x3c5233,_0x5361ef){_0x5361ef=_0x5361ef||0xcc;return function(_0x28e803){if(_0x28e803){return _0x3c5233[_0xa071('0x21')](_0x5361ef);}return _0x3c5233[_0xa071('0x22')](_0x5361ef)[_0xa071('0x23')]();};}function respondWithResult(_0x4d0a15,_0xc85520){_0xc85520=_0xc85520||0xc8;return function(_0x81ff9e){if(_0x81ff9e){return _0x4d0a15[_0xa071('0x22')](_0xc85520)[_0xa071('0x24')](_0x81ff9e);}};}function respondWithFilteredResult(_0x8eb2d0,_0x15954f){return function(_0x42b2e7){if(_0x42b2e7){var _0x1f27fc=typeof _0x15954f[_0xa071('0x25')]===_0xa071('0x26')&&typeof _0x15954f[_0xa071('0x27')]===_0xa071('0x26');var _0x58e247=_0x42b2e7[_0xa071('0x28')];var _0x11387c=_0x1f27fc?0x0:_0x15954f[_0xa071('0x25')];var _0x577414=_0x1f27fc?_0x42b2e7['count']:_0x15954f[_0xa071('0x25')]+_0x15954f['limit'];var _0x4538e9;if(_0x577414>=_0x58e247){_0x577414=_0x58e247;_0x4538e9=0xc8;}else{_0x4538e9=0xce;}_0x8eb2d0[_0xa071('0x22')](_0x4538e9);return _0x8eb2d0[_0xa071('0x29')](_0xa071('0x2a'),_0x11387c+'-'+_0x577414+'/'+_0x58e247)[_0xa071('0x24')](_0x42b2e7);}return null;};}function patchUpdates(_0x2b38a1){return function(_0x182a56){try{jsonpatch[_0xa071('0x2b')](_0x182a56,_0x2b38a1,!![]);}catch(_0x1909a7){return BPromise[_0xa071('0x2c')](_0x1909a7);}return _0x182a56[_0xa071('0x2d')]();};}function saveUpdates(_0x1ca3a5,_0x46ee0e){return function(_0x3f39a1){if(_0x3f39a1){return _0x3f39a1[_0xa071('0x2e')](_0x1ca3a5)['then'](function(_0x54dd4e){return _0x54dd4e;});}return null;};}function removeEntity(_0x3743a6,_0x1a8866){return function(_0x436573){if(_0x436573){return _0x436573[_0xa071('0x2f')]()[_0xa071('0x30')](function(){var _0xecc884=_0x436573['get']({'plain':!![]});var _0x32139f=_0xa071('0x31');return db[_0xa071('0x32')][_0xa071('0x2f')]({'where':{'type':_0x32139f,'resourceId':_0xecc884['id']}})[_0xa071('0x30')](function(){return _0x436573;});})['then'](function(){_0x3743a6[_0xa071('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b9f2a,_0x5f5baa){return function(_0x3b34ea){if(!_0x3b34ea){_0x5b9f2a[_0xa071('0x21')](0x194);}return _0x3b34ea;};}function handleError(_0x1192f2,_0x17bd0c){_0x17bd0c=_0x17bd0c||0x1f4;return function(_0x16de57){logger[_0xa071('0x33')](_0x16de57[_0xa071('0x34')]);if(_0x16de57[_0xa071('0x35')]){delete _0x16de57[_0xa071('0x35')];}_0x1192f2[_0xa071('0x22')](_0x17bd0c)[_0xa071('0x36')](_0x16de57);};}exports[_0xa071('0x37')]=function(_0x2339fd,_0xc27546){var _0xc106f={},_0x32bd85={},_0x3c8035={'count':0x0,'rows':[]};var _0x44967e=_[_0xa071('0x38')](db[_0xa071('0x39')][_0xa071('0x3a')],function(_0x3f96d8){return{'name':_0x3f96d8[_0xa071('0x3b')],'type':_0x3f96d8[_0xa071('0x3c')][_0xa071('0x3d')]};});_0x32bd85[_0xa071('0x3e')]=_['map'](_0x44967e,_0xa071('0x35'));_0x32bd85['query']=_[_0xa071('0x3f')](_0x2339fd[_0xa071('0x40')]);_0x32bd85['filters']=_['intersection'](_0x32bd85['model'],_0x32bd85[_0xa071('0x40')]);_0xc106f['attributes']=_[_0xa071('0x41')](_0x32bd85[_0xa071('0x3e')],qs[_0xa071('0x42')](_0x2339fd[_0xa071('0x40')][_0xa071('0x42')]));_0xc106f[_0xa071('0x43')]=_0xc106f[_0xa071('0x43')][_0xa071('0x44')]?_0xc106f[_0xa071('0x43')]:_0x32bd85['model'];if(!_0x2339fd[_0xa071('0x40')][_0xa071('0x45')](_0xa071('0x46'))){_0xc106f[_0xa071('0x27')]=qs[_0xa071('0x27')](_0x2339fd[_0xa071('0x40')]['limit']);_0xc106f[_0xa071('0x25')]=qs[_0xa071('0x25')](_0x2339fd[_0xa071('0x40')]['offset']);}_0xc106f[_0xa071('0x47')]=qs[_0xa071('0x48')](_0x2339fd['query'][_0xa071('0x48')]);_0xc106f[_0xa071('0x49')]=qs[_0xa071('0x4a')](_[_0xa071('0x4b')](_0x2339fd[_0xa071('0x40')],_0x32bd85[_0xa071('0x4a')]),_0x44967e);if(_0x2339fd[_0xa071('0x40')]['filter']){_0xc106f[_0xa071('0x49')]=_[_0xa071('0x4c')](_0xc106f['where'],{'$or':_[_0xa071('0x38')](_0x44967e,function(_0x585794){if(_0x585794[_0xa071('0x3c')]!==_0xa071('0x4d')){var _0x4c3630={};_0x4c3630[_0x585794['name']]={'$like':'%'+_0x2339fd['query'][_0xa071('0x4e')]+'%'};return _0x4c3630;}})});}_0xc106f=_[_0xa071('0x4c')]({},_0xc106f,_0x2339fd[_0xa071('0x4f')]);var _0x463574={'where':_0xc106f[_0xa071('0x49')]};return db[_0xa071('0x39')][_0xa071('0x28')](_0x463574)[_0xa071('0x30')](function(_0x7c387a){_0x3c8035[_0xa071('0x28')]=_0x7c387a;if(_0x2339fd[_0xa071('0x40')][_0xa071('0x50')]){_0xc106f[_0xa071('0x51')]=[{'all':!![]}];}return db[_0xa071('0x39')][_0xa071('0x52')](_0xc106f);})[_0xa071('0x30')](function(_0x445fbe){_0x3c8035['rows']=_0x445fbe;return _0x3c8035;})[_0xa071('0x30')](respondWithFilteredResult(_0xc27546,_0xc106f))[_0xa071('0x53')](handleError(_0xc27546,null));};exports[_0xa071('0x54')]=function(_0x129a71,_0x3026ca){var _0x267f2f={'raw':!![],'where':{'id':_0x129a71[_0xa071('0x55')]['id']}},_0x2e1e73={};_0x2e1e73[_0xa071('0x3e')]=_[_0xa071('0x3f')](db['Plugin'][_0xa071('0x3a')]);_0x2e1e73[_0xa071('0x40')]=_['keys'](_0x129a71[_0xa071('0x40')]);_0x2e1e73[_0xa071('0x4a')]=_['intersection'](_0x2e1e73[_0xa071('0x3e')],_0x2e1e73[_0xa071('0x40')]);_0x267f2f[_0xa071('0x43')]=_[_0xa071('0x41')](_0x2e1e73[_0xa071('0x3e')],qs[_0xa071('0x42')](_0x129a71[_0xa071('0x40')]['fields']));_0x267f2f[_0xa071('0x43')]=_0x267f2f[_0xa071('0x43')][_0xa071('0x44')]?_0x267f2f[_0xa071('0x43')]:_0x2e1e73['model'];if(_0x129a71['query'][_0xa071('0x50')]){_0x267f2f['include']=[{'all':!![]}];}_0x267f2f=_[_0xa071('0x4c')]({},_0x267f2f,_0x129a71[_0xa071('0x4f')]);return db['Plugin'][_0xa071('0x56')](_0x267f2f)['then'](handleEntityNotFound(_0x3026ca,null))[_0xa071('0x30')](respondWithResult(_0x3026ca,null))[_0xa071('0x53')](handleError(_0x3026ca,null));};exports['download']=function(_0x577e3a,_0x173cf3,_0x14303a){return db['Plugin'][_0xa071('0x56')]({'where':{'id':_0x577e3a[_0xa071('0x55')]['id']},'attributes':[_0xa071('0x35'),'path'],'raw':!![]})[_0xa071('0x30')](handleEntityNotFound(_0x173cf3,null))['then'](function(_0x2c0eb6){if(_0x2c0eb6){var _0x552841=path['join'](config['root'],_0xa071('0x57'),util[_0xa071('0x58')](_0xa071('0x59'),path['basename'](_0x2c0eb6['path'])));var _0x5535c2=fs[_0xa071('0x5a')](_0x552841);var _0x409983=archiver(_0xa071('0x5b'),{'zlib':{'level':0x9}});_0x409983['on'](_0xa071('0x5c'),function(_0x54c2de){if(_0x54c2de[_0xa071('0x5d')]===_0xa071('0x5e')){logger[_0xa071('0x33')](_0x54c2de);}else{throw new db[(_0xa071('0x5f'))][(_0xa071('0x60'))](_0xa071('0x61'));}});_0x409983['on'](_0xa071('0x33'),function(_0x35bcdf){throw new db[(_0xa071('0x5f'))][(_0xa071('0x60'))](_0xa071('0x61'));});_0x409983['pipe'](_0x5535c2);_0x409983[_0xa071('0x62')](_0xa071('0x63'),{'cwd':path[_0xa071('0x64')](config[_0xa071('0x65')],'server/files/plugins',path[_0xa071('0x66')](_0x2c0eb6['path'])),'ignore':[path[_0xa071('0x64')](path[_0xa071('0x67')](_0x2c0eb6[_0xa071('0x7')]),_0xa071('0x68')),path[_0xa071('0x64')](path[_0xa071('0x67')](_0x2c0eb6[_0xa071('0x7')]),'attachments/**/*')],'nodir':!![]})[_0xa071('0x69')]();_0x5535c2['on'](_0xa071('0x6a'),function(){if(!fs[_0xa071('0x6b')](_0x552841)){throw new db[(_0xa071('0x5f'))]['Error'](_0xa071('0x6c'));}return _0x173cf3[_0xa071('0x6d')](_0x552841,util['format'](_0xa071('0x59'),path[_0xa071('0x67')](_0x2c0eb6[_0xa071('0x7')])),function(_0x5d6d08){if(_0x5d6d08){throw new db[(_0xa071('0x5f'))][(_0xa071('0x60'))](_0xa071('0x6e'));}fs[_0xa071('0x6f')](_0x552841);logger[_0xa071('0x70')](_0xa071('0x71'));logger[_0xa071('0x70')](_0xa071('0x72'));});});}return null;})['catch'](handleError(_0x173cf3,null));};exports[_0xa071('0x73')]=function(_0x1ab78b,_0x21eba9,_0x50017a){var _0x5f2645=path[_0xa071('0x67')](_0x1ab78b[_0xa071('0x74')][_0xa071('0x75')],path[_0xa071('0x76')](_0x1ab78b[_0xa071('0x74')]['filename']));var _0x5acb05=path[_0xa071('0x64')](config[_0xa071('0x65')],'server/files/plugins',_0x1ab78b['file']['filename']);var _0x409dac=path[_0xa071('0x64')](config['root'],_0xa071('0x57'),_0x5f2645);logger['info']('Plugin\x20upload\x20filepath:\x20%s',_0x5acb05);logger[_0xa071('0x70')](_0xa071('0x77'),_0x409dac);try{fs['chmodSync'](_0x5acb05,parseInt(_0xa071('0x78'),0x8));extract(_0x5acb05,{'dir':_0x409dac},function(_0x14a65f){if(_0x14a65f){logger['error'](_0x14a65f);handleError(_0x14a65f,!![]);};var _0x25cd16=fs[_0xa071('0x79')](_0x409dac);if(_0x25cd16['length']>0x1){removeReferences(_0x5acb05,_0x409dac);logger[_0xa071('0x33')](_0xa071('0x7a'));return _0x50017a(new Error(_0xa071('0x7a')));}var _0x4ec4eb=fs['lstatSync'](path['join'](_0x409dac,_0x25cd16[0x0]));if(_0x4ec4eb[_0xa071('0x7b')]()){removeReferences(_0x5acb05,_0x409dac);logger[_0xa071('0x33')](_0xa071('0x7a'));return _0x50017a(new Error('Invalid\x20plugin\x20structure'));}if(_0x4ec4eb[_0xa071('0x7c')]()){var _0x131c47=fs[_0xa071('0x79')](path[_0xa071('0x64')](_0x409dac,_0x25cd16[0x0]));if(_0x131c47[_0xa071('0x44')]===0x0){removeReferences(_0x5acb05,_0x409dac);logger['error']('Invalid\x20plugin\x20structure');return _0x50017a(new Error(_0xa071('0x7a')));}var _0x1f5c52=_0x131c47['some'](function(_0x4190e7){return _0x4190e7==='manifest.json';});if(!_0x1f5c52){return _0x50017a(new Error(_0xa071('0x7d')));}var _0x8ba1d6=fs[_0xa071('0x7e')](path['join'](_0x409dac,_0x25cd16[0x0],'manifest.json'));var _0x36fe6e=JSON[_0xa071('0x7f')](_0x8ba1d6);if('undefined'==typeof _0x36fe6e[_0xa071('0x35')]){return _0x50017a(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xa071('0x26')==typeof _0x36fe6e[_0xa071('0x3c')]){return _0x50017a(new Error(_0xa071('0x80')));}if(_0xa071('0x26')==typeof _0x36fe6e['version']){return _0x50017a(new Error(_0xa071('0x81')));}if(_0xa071('0x26')==typeof _0x36fe6e[_0xa071('0x82')]){return _0x50017a(new Error(_0xa071('0x83')));}if(_0x36fe6e[_0xa071('0x3c')]===_0xa071('0x84')){if('undefined'==typeof _0x36fe6e['parameters'][_0xa071('0x85')]){return _0x50017a(new Error(_0xa071('0x86')));}if(_0xa071('0x26')==typeof _0x36fe6e[_0xa071('0x82')]['views'][_0xa071('0x87')]&&_0xa071('0x26')==typeof _0x36fe6e[_0xa071('0x82')][_0xa071('0x85')][_0xa071('0x88')]){return _0x50017a(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x36fe6e[_0xa071('0x3c')]==='script'){if('undefined'==typeof _0x36fe6e[_0xa071('0x82')][_0xa071('0x89')]){return _0x50017a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xa071('0x26')==typeof _0x36fe6e[_0xa071('0x82')][_0xa071('0x8a')]){return _0x50017a(new Error(_0xa071('0x8b')));}}else{return _0x50017a(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0xd95660=_0x36fe6e[_0xa071('0x35')];var _0x1da09c=_0x36fe6e['description'];var _0x839988=_0x36fe6e[_0xa071('0x3c')];var _0x1fdc4e=_0x36fe6e[_0xa071('0x8c')]?_0x36fe6e[_0xa071('0x8c')]:'always';var _0x3e6aef=_0x36fe6e[_0xa071('0x8d')]?_0x36fe6e[_0xa071('0x8d')]:_0xa071('0x8e');var _0x27a00f='';var _0x396f87='';var _0x5e9766='';var _0x23714d='';var _0x326219=_0x36fe6e[_0xa071('0x8f')];if(_0x839988===_0xa071('0x84')){if(_0xa071('0x26')!=typeof _0x36fe6e[_0xa071('0x82')][_0xa071('0x85')][_0xa071('0x87')]){var _0xa23e09=_0x36fe6e[_0xa071('0x82')][_0xa071('0x85')][_0xa071('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0xa23e09)){_0x27a00f=path[_0xa071('0x64')](_0xa071('0x90'),_0x5f2645,_0x25cd16[0x0],_0xa23e09);}else{_0x27a00f=_0xa23e09;}}else{logger[_0xa071('0x70')](_0xa071('0x91'));}if(_0xa071('0x26')!=typeof _0x36fe6e[_0xa071('0x82')][_0xa071('0x85')]['agent']){var _0x486e51=_0x36fe6e[_0xa071('0x82')][_0xa071('0x85')][_0xa071('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xa071('0x92')](_0x486e51)){_0x396f87=path[_0xa071('0x64')](_0xa071('0x90'),_0x5f2645,_0x25cd16[0x0],_0x486e51);}else{_0x396f87=_0x486e51;}}else{logger['info']('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x839988==='script'){_0x5e9766=_0x36fe6e[_0xa071('0x82')][_0xa071('0x89')];_0x23714d=_0x36fe6e[_0xa071('0x82')]['scriptPath'];if(_0xa071('0x26')!=typeof _0x36fe6e['parameters'][_0xa071('0x85')]){if(_0xa071('0x26')!=typeof _0x36fe6e[_0xa071('0x82')][_0xa071('0x85')][_0xa071('0x87')]){var _0xa23e09=_0x36fe6e[_0xa071('0x82')][_0xa071('0x85')][_0xa071('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xa071('0x92')](_0xa23e09)){_0x27a00f=path[_0xa071('0x64')]('plugins',_0x5f2645,_0x25cd16[0x0],_0xa23e09);}else{_0x27a00f=_0xa23e09;}}if(_0xa071('0x26')!=typeof _0x36fe6e[_0xa071('0x82')]['views'][_0xa071('0x88')]){var _0x486e51=_0x36fe6e[_0xa071('0x82')][_0xa071('0x85')][_0xa071('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xa071('0x92')](_0x486e51)){_0x396f87=path[_0xa071('0x64')](_0xa071('0x90'),_0x5f2645,_0x25cd16[0x0],_0x486e51);}else{_0x396f87=_0x486e51;}}}}var _0x2eede6={'name':_0xd95660,'description':_0x1da09c,'path':path[_0xa071('0x64')](_0x5f2645,_0x25cd16[0x0]),'type':_0x839988,'sidebar':_0x1fdc4e,'icon':_0x3e6aef,'adminUrl':_0x27a00f,'agentUrl':_0x396f87,'scriptName':_0x5e9766,'scriptPath':_0x23714d,'version':_0x326219};removeReferences(_0x5acb05,null);return db[_0xa071('0x39')][_0xa071('0x93')](_0x2eede6)[_0xa071('0x30')](function(_0x46dddd){var _0x3e8366={'role':_0x1ab78b['body'][_0xa071('0x94')],'userProfileId':_0x1ab78b[_0xa071('0x95')][_0xa071('0x96')]};if(!_0x3e8366)throw new Error(_0xa071('0x97'));if(_0x3e8366[_0xa071('0x94')]===_0xa071('0x98')){var _0x1a8ec0=_0x46dddd['get']({'plain':!![]});return db[_0xa071('0x99')][_0xa071('0x56')]({'where':{'name':_0xa071('0x31'),'userProfileId':_0x3e8366['userProfileId']},'raw':!![]})[_0xa071('0x30')](function(_0x3eaf62){if(_0x3eaf62&&_0x3eaf62[_0xa071('0x9a')]===0x0){return db['UserProfileResource'][_0xa071('0x93')]({'name':_0x1a8ec0[_0xa071('0x35')],'resourceId':_0x1a8ec0['id'],'type':_0x3eaf62['name'],'sectionId':_0x3eaf62['id']},{})[_0xa071('0x30')](function(){return _0x46dddd;});}else{return _0x46dddd;}})['catch'](function(_0xb1c179){logger['error'](_0xa071('0x9b'),_0xb1c179);throw _0xb1c179;});}return _0x46dddd;})[_0xa071('0x30')](respondWithResult(_0x21eba9,null))[_0xa071('0x53')](handleError(_0x21eba9,null));}});}catch(_0x23f138){_0x21eba9[_0xa071('0x22')](0x1f4)[_0xa071('0x36')](_0x23f138);}};function removeReferences(_0x2583f7,_0x379187){try{if(_0x2583f7){fs[_0xa071('0x6f')](_0x2583f7);logger[_0xa071('0x70')](_0xa071('0x9c'));}if(_0x379187){rimraf(_0x379187,function(){});logger[_0xa071('0x70')](_0xa071('0x9d'));}}catch(_0x115b36){logger[_0xa071('0x33')](_0x115b36);}}exports[_0xa071('0x2e')]=function(_0x71b614,_0x435c8c,_0x36c0fc){return db[_0xa071('0x39')][_0xa071('0x56')]({'where':{'id':_0x71b614[_0xa071('0x55')]['id']}})[_0xa071('0x30')](handleEntityNotFound(_0x435c8c,null))[_0xa071('0x30')](saveUpdates(_0x71b614[_0xa071('0x95')],null))[_0xa071('0x30')](respondWithResult(_0x435c8c,null))['catch'](handleError(_0x435c8c,null));};exports[_0xa071('0x9e')]=function(_0x8a1f2c,_0x121bec,_0x56c4d9){return db[_0xa071('0x39')]['find']({'where':{'id':_0x8a1f2c[_0xa071('0x55')]['id']}})[_0xa071('0x30')](function(_0x1b1e69){if(_0x1b1e69){return _0x1b1e69['destroy']();}})['then'](function(_0x1ddfe9){rimraf(path[_0xa071('0x64')](config[_0xa071('0x65')],_0xa071('0x57'),path[_0xa071('0x66')](_0x1ddfe9[_0xa071('0x7')])),function(){});return _0x1ddfe9;})[_0xa071('0x30')](handleEntityNotFound(_0x121bec,null))[_0xa071('0x30')](respondWithStatusCode(_0x121bec,null))[_0xa071('0x53')](handleError(_0x121bec,null));};exports[_0xa071('0x9f')]=function(_0x23541c,_0x58ae03,_0x13ff80){return BPromise[_0xa071('0xa0')]()[_0xa071('0x30')](function(){if(!_0x23541c[_0xa071('0x40')][_0xa071('0x7')]){throw new Error(_0xa071('0xa1'));}if(!_0x23541c['query'][_0xa071('0xa2')]){throw new Error(_0xa071('0xa3'));}var _0x2ba907=_0x23541c['query'][_0xa071('0xa4')]?_0x23541c['query']['hostname']+':'+_0x23541c[_0xa071('0x40')][_0xa071('0xa2')]:_0xa071('0xa5')+_0x23541c[_0xa071('0x40')][_0xa071('0xa2')];var _0x53caf7=_0x23541c[_0xa071('0x40')][_0xa071('0x24')]?_0x23541c[_0xa071('0x40')][_0xa071('0x24')]:!![];var _0x5d13f1=_0x23541c[_0xa071('0x40')][_0xa071('0xa6')]?_0x23541c[_0xa071('0x40')][_0xa071('0xa6')]:null;var _0xce8458={'method':_0x23541c['method'],'uri':util[_0xa071('0x58')]('%s%s',_0x2ba907,_0x23541c[_0xa071('0x40')][_0xa071('0x7')]),'json':_0x53caf7,'resolveWithFullResponse':!![],'encoding':_0x5d13f1,'qs':_0x23541c[_0xa071('0x40')]};if(_0x23541c[_0xa071('0xa7')]){_0xce8458['headers']=_0x23541c[_0xa071('0xa7')];if(_0xce8458['headers'][_0xa071('0xa8')]){delete _0xce8458[_0xa071('0xa7')][_0xa071('0xa8')];}}if(_0xce8458[_0xa071('0xa7')][_0xa071('0xa9')]){delete _0xce8458['headers'][_0xa071('0xa9')];}return rp(_0xce8458);})['then'](function(_0x36a43e){if(_0x36a43e){_0x58ae03['set'](_0x36a43e[_0xa071('0xa7')]);logger[_0xa071('0x70')](_0x36a43e[_0xa071('0x95')]);if(_[_0xa071('0xaa')](_0x23541c[_0xa071('0x40')]['path'],_0xa071('0x6d'))&&_0x36a43e[_0xa071('0xab')]==0x1f4){return _0x58ae03[_0xa071('0x21')](_0x36a43e[_0xa071('0xab')]);}else{return _0x58ae03[_0xa071('0x22')](_0x36a43e[_0xa071('0xab')])[_0xa071('0x36')](_0x36a43e[_0xa071('0x95')]);}}else{return _0x58ae03[_0xa071('0x21')](0xc8);}})[_0xa071('0x53')](handleError(_0x58ae03,null));};exports['webhookPost']=function(_0x101dcc,_0x579b3c,_0x173862){return BPromise[_0xa071('0xa0')]()['then'](function(){if(!_0x101dcc[_0xa071('0x40')][_0xa071('0x7')]){throw new Error(_0xa071('0xa1'));}if(!_0x101dcc[_0xa071('0x40')]['port']){throw new Error(_0xa071('0xa3'));}var _0x12b346=_0x101dcc[_0xa071('0x40')]['hostname']?_0x101dcc[_0xa071('0x40')][_0xa071('0xa4')]+':'+_0x101dcc[_0xa071('0x40')]['port']:_0xa071('0xa5')+_0x101dcc['query'][_0xa071('0xa2')];var _0x614af2=_0x101dcc[_0xa071('0x40')][_0xa071('0x24')]?_0x101dcc['query'][_0xa071('0x24')]:!![];var _0x117eb8=_0x101dcc[_0xa071('0x40')]['encoding']?_0x101dcc['query'][_0xa071('0xa6')]:null;var _0x5ec5d5={'method':_0x101dcc['method'],'uri':util[_0xa071('0x58')]('%s%s',_0x12b346,_0x101dcc[_0xa071('0x40')][_0xa071('0x7')]),'json':_0x614af2,'resolveWithFullResponse':!![],'encoding':_0x117eb8,'body':_0x101dcc[_0xa071('0x95')]};if(_0x101dcc['headers']){_0x5ec5d5[_0xa071('0xa7')]=_0x101dcc[_0xa071('0xa7')];if(_0x5ec5d5['headers'][_0xa071('0xa8')]){delete _0x5ec5d5['headers'][_0xa071('0xa8')];}}if(_0x5ec5d5[_0xa071('0xa7')][_0xa071('0xa9')]){delete _0x5ec5d5[_0xa071('0xa7')][_0xa071('0xa9')];}return rp(_0x5ec5d5);})[_0xa071('0x30')](function(_0x474489){if(_0x474489){_0x579b3c[_0xa071('0x29')](_0x474489[_0xa071('0xa7')]);logger[_0xa071('0x70')](_0x474489[_0xa071('0x95')]);return _0x579b3c[_0xa071('0x22')](_0x474489[_0xa071('0xab')])['send'](_0x474489[_0xa071('0x95')]);}else{return _0x579b3c['sendStatus'](0xc8);}})[_0xa071('0x53')](handleError(_0x579b3c,null));}; \ No newline at end of file +var _0x815d=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','map','Plugin','rawAttributes','fieldName','type','model','query','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','keys','intersection','find','download','root','server/files/plugins','format','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','join','node_modules/**/*','finalize','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','Plugin\x20manifest\x20missing','readFileSync','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','scriptName','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Extracted\x20folder\x20removed','update','delete','dirname','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','json','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','rimraf','archiver'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x815d,0x142));var _0xd815=function(_0x304936,_0x260419){_0x304936=_0x304936-0x0;var _0x10349b=_0x815d[_0x304936];return _0x10349b;};'use strict';var emlformat=require(_0xd815('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd815('0x1'));var rp=require(_0xd815('0x2'));var moment=require(_0xd815('0x3'));var BPromise=require(_0xd815('0x4'));var Mustache=require(_0xd815('0x5'));var util=require('util');var path=require(_0xd815('0x6'));var sox=require('sox');var csv=require(_0xd815('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd815('0x8'));var _=require(_0xd815('0x9'));var squel=require(_0xd815('0xa'));var crypto=require('crypto');var jsforce=require(_0xd815('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd815('0x7'));var querystring=require(_0xd815('0xc'));var Papa=require(_0xd815('0xd'));var extract=require('extract-zip');var rimraf=require(_0xd815('0xe'));var archiver=require(_0xd815('0xf'));var Redis=require('ioredis');var authService=require(_0xd815('0x10'));var qs=require(_0xd815('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd815('0x12'));var logger=require(_0xd815('0x13'))(_0xd815('0x14'));var utils=require(_0xd815('0x15'));var config=require(_0xd815('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd815('0x17'))['db'];config[_0xd815('0x18')]=_[_0xd815('0x19')](config[_0xd815('0x18')],{'host':_0xd815('0x1a'),'port':0x18eb});var socket=require(_0xd815('0x1b'))(new Redis(config[_0xd815('0x18')]));require(_0xd815('0x1c'))[_0xd815('0x1d')](socket);function respondWithStatusCode(_0x152ecc,_0x46be57){_0x46be57=_0x46be57||0xcc;return function(_0x2aec5b){if(_0x2aec5b){return _0x152ecc[_0xd815('0x1e')](_0x46be57);}return _0x152ecc[_0xd815('0x1f')](_0x46be57)[_0xd815('0x20')]();};}function respondWithResult(_0x25b1fb,_0xf83143){_0xf83143=_0xf83143||0xc8;return function(_0x1bfe3e){if(_0x1bfe3e){return _0x25b1fb[_0xd815('0x1f')](_0xf83143)['json'](_0x1bfe3e);}};}function respondWithFilteredResult(_0x45652f,_0x1d613a){return function(_0x463f6f){if(_0x463f6f){var _0x5a99da=typeof _0x1d613a[_0xd815('0x21')]==='undefined'&&typeof _0x1d613a['limit']===_0xd815('0x22');var _0x94f603=_0x463f6f[_0xd815('0x23')];var _0x4c5e34=_0x5a99da?0x0:_0x1d613a[_0xd815('0x21')];var _0x3b477f=_0x5a99da?_0x463f6f[_0xd815('0x23')]:_0x1d613a['offset']+_0x1d613a[_0xd815('0x24')];var _0x1c771e;if(_0x3b477f>=_0x94f603){_0x3b477f=_0x94f603;_0x1c771e=0xc8;}else{_0x1c771e=0xce;}_0x45652f[_0xd815('0x1f')](_0x1c771e);return _0x45652f[_0xd815('0x25')](_0xd815('0x26'),_0x4c5e34+'-'+_0x3b477f+'/'+_0x94f603)['json'](_0x463f6f);}return null;};}function patchUpdates(_0x157e25){return function(_0x2ba9b9){try{jsonpatch[_0xd815('0x27')](_0x2ba9b9,_0x157e25,!![]);}catch(_0x2701aa){return BPromise['reject'](_0x2701aa);}return _0x2ba9b9[_0xd815('0x28')]();};}function saveUpdates(_0x2bbe4b,_0xb6fed6){return function(_0x2584cb){if(_0x2584cb){return _0x2584cb['update'](_0x2bbe4b)[_0xd815('0x29')](function(_0xe224d1){return _0xe224d1;});}return null;};}function removeEntity(_0x22fefd,_0x2aecb8){return function(_0x281cff){if(_0x281cff){return _0x281cff[_0xd815('0x2a')]()[_0xd815('0x29')](function(){var _0x42810d=_0x281cff[_0xd815('0x2b')]({'plain':!![]});var _0x271f95=_0xd815('0x2c');return db[_0xd815('0x2d')]['destroy']({'where':{'type':_0x271f95,'resourceId':_0x42810d['id']}})[_0xd815('0x29')](function(){return _0x281cff;});})[_0xd815('0x29')](function(){_0x22fefd[_0xd815('0x1f')](0xcc)[_0xd815('0x20')]();});}};}function handleEntityNotFound(_0x10af6a,_0x256384){return function(_0x1e2129){if(!_0x1e2129){_0x10af6a['sendStatus'](0x194);}return _0x1e2129;};}function handleError(_0xeb07b2,_0x3d59d9){_0x3d59d9=_0x3d59d9||0x1f4;return function(_0x389402){logger[_0xd815('0x2e')](_0x389402[_0xd815('0x2f')]);if(_0x389402[_0xd815('0x30')]){delete _0x389402[_0xd815('0x30')];}_0xeb07b2[_0xd815('0x1f')](_0x3d59d9)[_0xd815('0x31')](_0x389402);};}exports['index']=function(_0x5d44b1,_0x42d9bc){var _0x3ccd72={},_0x4d46b3={},_0x4c453d={'count':0x0,'rows':[]};var _0x52884e=_[_0xd815('0x32')](db[_0xd815('0x33')][_0xd815('0x34')],function(_0x533d40){return{'name':_0x533d40[_0xd815('0x35')],'type':_0x533d40[_0xd815('0x36')]['key']};});_0x4d46b3[_0xd815('0x37')]=_[_0xd815('0x32')](_0x52884e,_0xd815('0x30'));_0x4d46b3[_0xd815('0x38')]=_['keys'](_0x5d44b1[_0xd815('0x38')]);_0x4d46b3['filters']=_['intersection'](_0x4d46b3[_0xd815('0x37')],_0x4d46b3[_0xd815('0x38')]);_0x3ccd72['attributes']=_['intersection'](_0x4d46b3['model'],qs['fields'](_0x5d44b1[_0xd815('0x38')][_0xd815('0x39')]));_0x3ccd72[_0xd815('0x3a')]=_0x3ccd72[_0xd815('0x3a')][_0xd815('0x3b')]?_0x3ccd72[_0xd815('0x3a')]:_0x4d46b3['model'];if(!_0x5d44b1['query'][_0xd815('0x3c')](_0xd815('0x3d'))){_0x3ccd72[_0xd815('0x24')]=qs['limit'](_0x5d44b1[_0xd815('0x38')][_0xd815('0x24')]);_0x3ccd72[_0xd815('0x21')]=qs[_0xd815('0x21')](_0x5d44b1[_0xd815('0x38')][_0xd815('0x21')]);}_0x3ccd72['order']=qs['sort'](_0x5d44b1[_0xd815('0x38')][_0xd815('0x3e')]);_0x3ccd72[_0xd815('0x3f')]=qs['filters'](_[_0xd815('0x40')](_0x5d44b1['query'],_0x4d46b3[_0xd815('0x41')]),_0x52884e);if(_0x5d44b1[_0xd815('0x38')]['filter']){_0x3ccd72[_0xd815('0x3f')]=_[_0xd815('0x42')](_0x3ccd72['where'],{'$or':_[_0xd815('0x32')](_0x52884e,function(_0x3f2f1c){if(_0x3f2f1c[_0xd815('0x36')]!==_0xd815('0x43')){var _0x5436f3={};_0x5436f3[_0x3f2f1c[_0xd815('0x30')]]={'$like':'%'+_0x5d44b1[_0xd815('0x38')][_0xd815('0x44')]+'%'};return _0x5436f3;}})});}_0x3ccd72=_['merge']({},_0x3ccd72,_0x5d44b1['options']);var _0x223fb5={'where':_0x3ccd72['where']};return db[_0xd815('0x33')]['count'](_0x223fb5)['then'](function(_0x4f7028){_0x4c453d['count']=_0x4f7028;if(_0x5d44b1[_0xd815('0x38')][_0xd815('0x45')]){_0x3ccd72[_0xd815('0x46')]=[{'all':!![]}];}return db['Plugin'][_0xd815('0x47')](_0x3ccd72);})['then'](function(_0x32aa98){_0x4c453d[_0xd815('0x48')]=_0x32aa98;return _0x4c453d;})[_0xd815('0x29')](respondWithFilteredResult(_0x42d9bc,_0x3ccd72))[_0xd815('0x49')](handleError(_0x42d9bc,null));};exports['show']=function(_0x39d7c8,_0x1887f6){var _0x203c19={'raw':!![],'where':{'id':_0x39d7c8[_0xd815('0x4a')]['id']}},_0x23354c={};_0x23354c[_0xd815('0x37')]=_[_0xd815('0x4b')](db[_0xd815('0x33')][_0xd815('0x34')]);_0x23354c[_0xd815('0x38')]=_['keys'](_0x39d7c8[_0xd815('0x38')]);_0x23354c[_0xd815('0x41')]=_[_0xd815('0x4c')](_0x23354c[_0xd815('0x37')],_0x23354c[_0xd815('0x38')]);_0x203c19[_0xd815('0x3a')]=_['intersection'](_0x23354c['model'],qs[_0xd815('0x39')](_0x39d7c8[_0xd815('0x38')][_0xd815('0x39')]));_0x203c19['attributes']=_0x203c19[_0xd815('0x3a')][_0xd815('0x3b')]?_0x203c19[_0xd815('0x3a')]:_0x23354c['model'];if(_0x39d7c8['query'][_0xd815('0x45')]){_0x203c19[_0xd815('0x46')]=[{'all':!![]}];}_0x203c19=_['merge']({},_0x203c19,_0x39d7c8['options']);return db['Plugin'][_0xd815('0x4d')](_0x203c19)[_0xd815('0x29')](handleEntityNotFound(_0x1887f6,null))['then'](respondWithResult(_0x1887f6,null))[_0xd815('0x49')](handleError(_0x1887f6,null));};exports[_0xd815('0x4e')]=function(_0x33fdb9,_0xbc779,_0x36d68b){return db[_0xd815('0x33')][_0xd815('0x4d')]({'where':{'id':_0x33fdb9[_0xd815('0x4a')]['id']},'attributes':[_0xd815('0x30'),_0xd815('0x6')],'raw':!![]})[_0xd815('0x29')](handleEntityNotFound(_0xbc779,null))[_0xd815('0x29')](function(_0x35ed7c){if(_0x35ed7c){var _0x29d117=path['join'](config[_0xd815('0x4f')],_0xd815('0x50'),util[_0xd815('0x51')](_0xd815('0x52'),path[_0xd815('0x53')](_0x35ed7c[_0xd815('0x6')])));var _0x3711bb=fs['createWriteStream'](_0x29d117);var _0x34d4bd=archiver(_0xd815('0x54'),{'zlib':{'level':0x9}});_0x34d4bd['on'](_0xd815('0x55'),function(_0x454ed0){if(_0x454ed0[_0xd815('0x56')]===_0xd815('0x57')){logger[_0xd815('0x2e')](_0x454ed0);}else{throw new db[(_0xd815('0x58'))][(_0xd815('0x59'))](_0xd815('0x5a'));}});_0x34d4bd['on'](_0xd815('0x2e'),function(_0x56ed43){throw new db[(_0xd815('0x58'))]['Error'](_0xd815('0x5a'));});_0x34d4bd[_0xd815('0x5b')](_0x3711bb);_0x34d4bd[_0xd815('0x5c')](_0xd815('0x5d'),{'cwd':path[_0xd815('0x5e')](config[_0xd815('0x4f')],_0xd815('0x50'),path['dirname'](_0x35ed7c[_0xd815('0x6')])),'ignore':[path[_0xd815('0x5e')](path['basename'](_0x35ed7c[_0xd815('0x6')]),_0xd815('0x5f')),path[_0xd815('0x5e')](path[_0xd815('0x53')](_0x35ed7c[_0xd815('0x6')]),'attachments/**/*')],'nodir':!![]})[_0xd815('0x60')]();_0x3711bb['on']('close',function(){if(!fs[_0xd815('0x61')](_0x29d117)){throw new db[(_0xd815('0x58'))][(_0xd815('0x59'))](_0xd815('0x62'));}return _0xbc779[_0xd815('0x4e')](_0x29d117,util[_0xd815('0x51')](_0xd815('0x52'),path[_0xd815('0x53')](_0x35ed7c['path'])),function(_0x80550a){if(_0x80550a){throw new db[(_0xd815('0x58'))][(_0xd815('0x59'))](_0xd815('0x63'));}fs['unlinkSync'](_0x29d117);logger[_0xd815('0x64')](_0xd815('0x65'));logger[_0xd815('0x64')](_0xd815('0x66'));});});}return null;})[_0xd815('0x49')](handleError(_0xbc779,null));};exports['upload']=function(_0x3058d4,_0x115cb5,_0x4edade){var _0x28ee3a=path[_0xd815('0x53')](_0x3058d4['file'][_0xd815('0x67')],path[_0xd815('0x68')](_0x3058d4[_0xd815('0x69')][_0xd815('0x67')]));var _0x763eda=path['join'](config[_0xd815('0x4f')],_0xd815('0x50'),_0x3058d4[_0xd815('0x69')]['filename']);var _0x1fe41c=path[_0xd815('0x5e')](config[_0xd815('0x4f')],_0xd815('0x50'),_0x28ee3a);logger[_0xd815('0x64')]('Plugin\x20upload\x20filepath:\x20%s',_0x763eda);logger['info'](_0xd815('0x6a'),_0x1fe41c);try{fs[_0xd815('0x6b')](_0x763eda,parseInt('0777',0x8));extract(_0x763eda,{'dir':_0x1fe41c},function(_0x28388b){if(_0x28388b){logger[_0xd815('0x2e')](_0x28388b);handleError(_0x28388b,!![]);};var _0x32b6e1=fs[_0xd815('0x6c')](_0x1fe41c);if(_0x32b6e1[_0xd815('0x3b')]>0x1){removeReferences(_0x763eda,_0x1fe41c);logger[_0xd815('0x2e')](_0xd815('0x6d'));return _0x4edade(new Error(_0xd815('0x6d')));}var _0x1018d3=fs['lstatSync'](path[_0xd815('0x5e')](_0x1fe41c,_0x32b6e1[0x0]));if(_0x1018d3[_0xd815('0x6e')]()){removeReferences(_0x763eda,_0x1fe41c);logger[_0xd815('0x2e')](_0xd815('0x6d'));return _0x4edade(new Error('Invalid\x20plugin\x20structure'));}if(_0x1018d3[_0xd815('0x6f')]()){var _0x59b09b=fs[_0xd815('0x6c')](path[_0xd815('0x5e')](_0x1fe41c,_0x32b6e1[0x0]));if(_0x59b09b[_0xd815('0x3b')]===0x0){removeReferences(_0x763eda,_0x1fe41c);logger[_0xd815('0x2e')](_0xd815('0x6d'));return _0x4edade(new Error(_0xd815('0x6d')));}var _0x3fb964=_0x59b09b[_0xd815('0x70')](function(_0x3e302d){return _0x3e302d==='manifest.json';});if(!_0x3fb964){return _0x4edade(new Error(_0xd815('0x71')));}var _0x536950=fs[_0xd815('0x72')](path[_0xd815('0x5e')](_0x1fe41c,_0x32b6e1[0x0],_0xd815('0x73')));var _0x424550=JSON[_0xd815('0x74')](_0x536950);if(_0xd815('0x22')==typeof _0x424550['name']){return _0x4edade(new Error(_0xd815('0x75')));}if(_0xd815('0x22')==typeof _0x424550[_0xd815('0x36')]){return _0x4edade(new Error(_0xd815('0x76')));}if(_0xd815('0x22')==typeof _0x424550[_0xd815('0x77')]){return _0x4edade(new Error(_0xd815('0x78')));}if(_0xd815('0x22')==typeof _0x424550[_0xd815('0x79')]){return _0x4edade(new Error(_0xd815('0x7a')));}if(_0x424550[_0xd815('0x36')]===_0xd815('0x7b')){if('undefined'==typeof _0x424550[_0xd815('0x79')][_0xd815('0x7c')]){return _0x4edade(new Error(_0xd815('0x7d')));}if(_0xd815('0x22')==typeof _0x424550['parameters'][_0xd815('0x7c')][_0xd815('0x7e')]&&'undefined'==typeof _0x424550['parameters'][_0xd815('0x7c')]['agent']){return _0x4edade(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x424550[_0xd815('0x36')]===_0xd815('0x7f')){if(_0xd815('0x22')==typeof _0x424550[_0xd815('0x79')]['scriptName']){return _0x4edade(new Error(_0xd815('0x80')));}if(_0xd815('0x22')==typeof _0x424550[_0xd815('0x79')][_0xd815('0x81')]){return _0x4edade(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x4edade(new Error(_0xd815('0x82')));}var _0x230a43=_0x424550[_0xd815('0x30')];var _0x4bddc6=_0x424550[_0xd815('0x83')];var _0x2a2766=_0x424550[_0xd815('0x36')];var _0x579da1=_0x424550[_0xd815('0x84')]?_0x424550[_0xd815('0x84')]:_0xd815('0x85');var _0x18bef6=_0x424550[_0xd815('0x86')]?_0x424550[_0xd815('0x86')]:'icon-apps';var _0xe68556='';var _0x4324e='';var _0x5a7820='';var _0x55c08e='';var _0x3a0400=_0x424550[_0xd815('0x77')];if(_0x2a2766===_0xd815('0x7b')){if(_0xd815('0x22')!=typeof _0x424550['parameters']['views'][_0xd815('0x7e')]){var _0x2003b8=_0x424550[_0xd815('0x79')][_0xd815('0x7c')][_0xd815('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd815('0x87')](_0x2003b8)){_0xe68556=path['join']('plugins',_0x28ee3a,_0x32b6e1[0x0],_0x2003b8);}else{_0xe68556=_0x2003b8;}}else{logger['info'](_0xd815('0x88'));}if('undefined'!=typeof _0x424550[_0xd815('0x79')][_0xd815('0x7c')][_0xd815('0x89')]){var _0x53a437=_0x424550[_0xd815('0x79')][_0xd815('0x7c')][_0xd815('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x53a437)){_0x4324e=path[_0xd815('0x5e')](_0xd815('0x8a'),_0x28ee3a,_0x32b6e1[0x0],_0x53a437);}else{_0x4324e=_0x53a437;}}else{logger[_0xd815('0x64')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x2a2766===_0xd815('0x7f')){_0x5a7820=_0x424550['parameters'][_0xd815('0x8b')];_0x55c08e=_0x424550['parameters'][_0xd815('0x81')];if(_0xd815('0x22')!=typeof _0x424550[_0xd815('0x79')][_0xd815('0x7c')]){if(_0xd815('0x22')!=typeof _0x424550[_0xd815('0x79')][_0xd815('0x7c')][_0xd815('0x7e')]){var _0x2003b8=_0x424550['parameters']['views'][_0xd815('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xd815('0x87')](_0x2003b8)){_0xe68556=path[_0xd815('0x5e')](_0xd815('0x8a'),_0x28ee3a,_0x32b6e1[0x0],_0x2003b8);}else{_0xe68556=_0x2003b8;}}if(_0xd815('0x22')!=typeof _0x424550[_0xd815('0x79')]['views'][_0xd815('0x89')]){var _0x53a437=_0x424550[_0xd815('0x79')]['views'][_0xd815('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x53a437)){_0x4324e=path['join'](_0xd815('0x8a'),_0x28ee3a,_0x32b6e1[0x0],_0x53a437);}else{_0x4324e=_0x53a437;}}}}var _0x2d2eed={'name':_0x230a43,'description':_0x4bddc6,'path':path[_0xd815('0x5e')](_0x28ee3a,_0x32b6e1[0x0]),'type':_0x2a2766,'sidebar':_0x579da1,'icon':_0x18bef6,'adminUrl':_0xe68556,'agentUrl':_0x4324e,'scriptName':_0x5a7820,'scriptPath':_0x55c08e,'version':_0x3a0400};removeReferences(_0x763eda,null);return db[_0xd815('0x33')][_0xd815('0x8c')](_0x2d2eed)['then'](function(_0x2279e7){var _0x3fb87a={'role':_0x3058d4['body'][_0xd815('0x8d')],'userProfileId':_0x3058d4[_0xd815('0x8e')][_0xd815('0x8f')]};if(!_0x3fb87a)throw new Error(_0xd815('0x90'));if(_0x3fb87a[_0xd815('0x8d')]==='user'){var _0x20fb1c=_0x2279e7['get']({'plain':!![]});return db[_0xd815('0x91')][_0xd815('0x4d')]({'where':{'name':_0xd815('0x2c'),'userProfileId':_0x3fb87a[_0xd815('0x8f')]},'raw':!![]})['then'](function(_0x1a87d9){if(_0x1a87d9&&_0x1a87d9[_0xd815('0x92')]===0x0){return db['UserProfileResource'][_0xd815('0x8c')]({'name':_0x20fb1c['name'],'resourceId':_0x20fb1c['id'],'type':_0x1a87d9[_0xd815('0x30')],'sectionId':_0x1a87d9['id']},{})[_0xd815('0x29')](function(){return _0x2279e7;});}else{return _0x2279e7;}})[_0xd815('0x49')](function(_0x12d2f5){logger['error'](_0xd815('0x93'),_0x12d2f5);throw _0x12d2f5;});}return _0x2279e7;})['then'](respondWithResult(_0x115cb5,null))['catch'](handleError(_0x115cb5,null));}});}catch(_0x294a06){_0x115cb5[_0xd815('0x1f')](0x1f4)['send'](_0x294a06);}};function removeReferences(_0xa54526,_0x2e85f3){try{if(_0xa54526){fs[_0xd815('0x94')](_0xa54526);logger[_0xd815('0x64')]('Zip\x20archive\x20removed');}if(_0x2e85f3){rimraf(_0x2e85f3,function(){});logger[_0xd815('0x64')](_0xd815('0x95'));}}catch(_0x2139a9){logger['error'](_0x2139a9);}}exports[_0xd815('0x96')]=function(_0x1773f9,_0x46d3b8,_0x116cbe){return db[_0xd815('0x33')][_0xd815('0x4d')]({'where':{'id':_0x1773f9['params']['id']}})['then'](handleEntityNotFound(_0x46d3b8,null))[_0xd815('0x29')](saveUpdates(_0x1773f9[_0xd815('0x8e')],null))[_0xd815('0x29')](respondWithResult(_0x46d3b8,null))['catch'](handleError(_0x46d3b8,null));};exports[_0xd815('0x97')]=function(_0x35f37f,_0x5b7910,_0x4f7480){return db[_0xd815('0x33')]['find']({'where':{'id':_0x35f37f['params']['id']}})[_0xd815('0x29')](function(_0x12fca2){if(_0x12fca2){return _0x12fca2[_0xd815('0x2a')]();}})[_0xd815('0x29')](function(_0x56302c){rimraf(path[_0xd815('0x5e')](config[_0xd815('0x4f')],_0xd815('0x50'),path[_0xd815('0x98')](_0x56302c['path'])),function(){});return _0x56302c;})[_0xd815('0x29')](handleEntityNotFound(_0x5b7910,null))[_0xd815('0x29')](respondWithStatusCode(_0x5b7910,null))['catch'](handleError(_0x5b7910,null));};exports[_0xd815('0x99')]=function(_0x448ce5,_0x46d32b,_0x3a91f5){return BPromise[_0xd815('0x9a')]()['then'](function(){if(!_0x448ce5[_0xd815('0x38')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x448ce5[_0xd815('0x38')][_0xd815('0x9b')]){throw new Error(_0xd815('0x9c'));}var _0x423e59=_0x448ce5['query'][_0xd815('0x9d')]?_0x448ce5[_0xd815('0x38')]['hostname']+':'+_0x448ce5[_0xd815('0x38')]['port']:'http://localhost:'+_0x448ce5['query'][_0xd815('0x9b')];var _0xfee3e9=_0x448ce5[_0xd815('0x38')][_0xd815('0x9e')]?_0x448ce5[_0xd815('0x38')][_0xd815('0x9e')]:!![];var _0x190e9b=_0x448ce5[_0xd815('0x38')][_0xd815('0x9f')]?_0x448ce5[_0xd815('0x38')][_0xd815('0x9f')]:null;var _0x391b3c={'method':_0x448ce5[_0xd815('0xa0')],'uri':util[_0xd815('0x51')](_0xd815('0xa1'),_0x423e59,_0x448ce5[_0xd815('0x38')][_0xd815('0x6')]),'json':_0xfee3e9,'resolveWithFullResponse':!![],'encoding':_0x190e9b,'qs':_0x448ce5['query']};if(_0x448ce5[_0xd815('0xa2')]){_0x391b3c[_0xd815('0xa2')]=_0x448ce5[_0xd815('0xa2')];if(_0x391b3c[_0xd815('0xa2')][_0xd815('0xa3')]){delete _0x391b3c['headers'][_0xd815('0xa3')];}}if(_0x391b3c['headers'][_0xd815('0xa4')]){delete _0x391b3c['headers'][_0xd815('0xa4')];}return rp(_0x391b3c);})['then'](function(_0xb07adc){if(_0xb07adc){_0x46d32b[_0xd815('0x25')](_0xb07adc['headers']);logger[_0xd815('0x64')](_0xb07adc[_0xd815('0x8e')]);if(_[_0xd815('0xa5')](_0x448ce5[_0xd815('0x38')][_0xd815('0x6')],_0xd815('0x4e'))&&_0xb07adc['statusCode']==0x1f4){return _0x46d32b['sendStatus'](_0xb07adc[_0xd815('0xa6')]);}else{return _0x46d32b[_0xd815('0x1f')](_0xb07adc[_0xd815('0xa6')])['send'](_0xb07adc['body']);}}else{return _0x46d32b[_0xd815('0x1e')](0xc8);}})[_0xd815('0x49')](handleError(_0x46d32b,null));};exports[_0xd815('0xa7')]=function(_0x2da456,_0x1f2dd2,_0x514c67){return BPromise['resolve']()[_0xd815('0x29')](function(){if(!_0x2da456['query']['path']){throw new Error(_0xd815('0xa8'));}if(!_0x2da456[_0xd815('0x38')]['port']){throw new Error(_0xd815('0x9c'));}var _0x1a4ef4=_0x2da456[_0xd815('0x38')][_0xd815('0x9d')]?_0x2da456[_0xd815('0x38')][_0xd815('0x9d')]+':'+_0x2da456[_0xd815('0x38')]['port']:'http://localhost:'+_0x2da456[_0xd815('0x38')][_0xd815('0x9b')];var _0x4afa7f=_0x2da456['query'][_0xd815('0x9e')]?_0x2da456[_0xd815('0x38')][_0xd815('0x9e')]:!![];var _0x2e5d37=_0x2da456[_0xd815('0x38')][_0xd815('0x9f')]?_0x2da456[_0xd815('0x38')]['encoding']:null;var _0xa78fcb={'method':_0x2da456[_0xd815('0xa0')],'uri':util['format'](_0xd815('0xa1'),_0x1a4ef4,_0x2da456[_0xd815('0x38')][_0xd815('0x6')]),'json':_0x4afa7f,'resolveWithFullResponse':!![],'encoding':_0x2e5d37,'body':_0x2da456[_0xd815('0x8e')]};if(_0x2da456['headers']){_0xa78fcb['headers']=_0x2da456[_0xd815('0xa2')];if(_0xa78fcb[_0xd815('0xa2')][_0xd815('0xa3')]){delete _0xa78fcb[_0xd815('0xa2')]['content-length'];}}if(_0xa78fcb[_0xd815('0xa2')]['content-type']){delete _0xa78fcb[_0xd815('0xa2')]['content-type'];}return rp(_0xa78fcb);})['then'](function(_0x41d7fb){if(_0x41d7fb){_0x1f2dd2[_0xd815('0x25')](_0x41d7fb[_0xd815('0xa2')]);logger[_0xd815('0x64')](_0x41d7fb[_0xd815('0x8e')]);return _0x1f2dd2[_0xd815('0x1f')](_0x41d7fb[_0xd815('0xa6')])[_0xd815('0x31')](_0x41d7fb[_0xd815('0x8e')]);}else{return _0x1f2dd2['sendStatus'](0xc8);}})[_0xd815('0x49')](handleError(_0x1f2dd2,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1b9fca0..2f4a4fa 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 _0xe1d3=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0xad8f0c,_0x250dbb){var _0x4858af=function(_0x2cbabb){while(--_0x2cbabb){_0xad8f0c['push'](_0xad8f0c['shift']());}};_0x4858af(++_0x250dbb);}(_0xe1d3,0x159));var _0x3e1d=function(_0x5ba472,_0x287244){_0x5ba472=_0x5ba472-0x0;var _0xbef1e8=_0xe1d3[_0x5ba472];return _0xbef1e8;};'use strict';var EventEmitter=require(_0x3e1d('0x0'));var Plugin=require(_0x3e1d('0x1'))['db'][_0x3e1d('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x3e1d('0x3')](0x0);var events={'afterCreate':_0x3e1d('0x4'),'afterUpdate':'update','afterDestroy':_0x3e1d('0x5')};function emitEvent(_0x4a0768){return function(_0x23f59b,_0x38df15,_0x4f6337){PluginEvents['emit'](_0x4a0768+':'+_0x23f59b['id'],_0x23f59b);PluginEvents[_0x3e1d('0x6')](_0x4a0768,_0x23f59b);_0x4f6337(null);};}for(var e in events){if(events[_0x3e1d('0x7')](e)){var event=events[e];Plugin[_0x3e1d('0x8')](e,emitEvent(event));}}module[_0x3e1d('0x9')]=PluginEvents; \ No newline at end of file +var _0xd9fb=['emit','hasOwnProperty','hook','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove'];(function(_0x162404,_0x3903c7){var _0x1d7869=function(_0x430b43){while(--_0x430b43){_0x162404['push'](_0x162404['shift']());}};_0x1d7869(++_0x3903c7);}(_0xd9fb,0x189));var _0xbd9f=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xd9fb[_0x34bf97];return _0x292719;};'use strict';var EventEmitter=require(_0xbd9f('0x0'));var Plugin=require(_0xbd9f('0x1'))['db'][_0xbd9f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xbd9f('0x3')](0x0);var events={'afterCreate':_0xbd9f('0x4'),'afterUpdate':_0xbd9f('0x5'),'afterDestroy':_0xbd9f('0x6')};function emitEvent(_0x56fe1b){return function(_0x2d4213,_0xf146bc,_0x4ce2e2){PluginEvents[_0xbd9f('0x7')](_0x56fe1b+':'+_0x2d4213['id'],_0x2d4213);PluginEvents['emit'](_0x56fe1b,_0x2d4213);_0x4ce2e2(null);};}for(var e in events){if(events[_0xbd9f('0x8')](e)){var event=events[e];Plugin[_0xbd9f('0x9')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index e76e23f..e52083f 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 _0x77ec=['bluebird','request-promise','path','rimraf','../../config/environment','Plugin','plugins','lodash','util','../../config/logger','api','moment'];(function(_0x2a8c21,_0x163576){var _0x5f3061=function(_0x4dc8eb){while(--_0x4dc8eb){_0x2a8c21['push'](_0x2a8c21['shift']());}};_0x5f3061(++_0x163576);}(_0x77ec,0x1cf));var _0xc77e=function(_0xd6ccf0,_0x437a03){_0xd6ccf0=_0xd6ccf0-0x0;var _0x2c6a77=_0x77ec[_0xd6ccf0];return _0x2c6a77;};'use strict';var _=require(_0xc77e('0x0'));var util=require(_0xc77e('0x1'));var logger=require(_0xc77e('0x2'))(_0xc77e('0x3'));var moment=require(_0xc77e('0x4'));var BPromise=require(_0xc77e('0x5'));var rp=require(_0xc77e('0x6'));var fs=require('fs');var path=require(_0xc77e('0x7'));var rimraf=require(_0xc77e('0x8'));var config=require(_0xc77e('0x9'));var attributes=require('./plugin.attributes');module['exports']=function(_0x2e5108,_0x420d94){return _0x2e5108['define'](_0xc77e('0xa'),attributes,{'tableName':_0xc77e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf544=['moment','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','../../config/logger','api'];(function(_0x41a504,_0x3fbd63){var _0x589b80=function(_0x49c60c){while(--_0x49c60c){_0x41a504['push'](_0x41a504['shift']());}};_0x589b80(++_0x3fbd63);}(_0xf544,0x179));var _0x4f54=function(_0x456a4b,_0x51df8){_0x456a4b=_0x456a4b-0x0;var _0x42957c=_0xf544[_0x456a4b];return _0x42957c;};'use strict';var _=require(_0x4f54('0x0'));var util=require('util');var logger=require(_0x4f54('0x1'))(_0x4f54('0x2'));var moment=require(_0x4f54('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(_0x4f54('0x4'));var attributes=require(_0x4f54('0x5'));module[_0x4f54('0x6')]=function(_0x265ab6,_0x17ec93){return _0x265ab6[_0x4f54('0x7')](_0x4f54('0x8'),attributes,{'tableName':_0x4f54('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 45f00ff..44c574e 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 _0xf634=['request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','Plugin','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','then','info','Plugin,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf634,0x93));var _0x4f63=function(_0x5327a4,_0x87e09c){_0x5327a4=_0x5327a4-0x0;var _0x3b57af=_0xf634[_0x5327a4];return _0x3b57af;};'use strict';var _=require(_0x4f63('0x0'));var util=require(_0x4f63('0x1'));var moment=require(_0x4f63('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f63('0x3'));var fs=require('fs');var Redis=require(_0x4f63('0x4'));var db=require(_0x4f63('0x5'))['db'];var utils=require(_0x4f63('0x6'));var logger=require(_0x4f63('0x7'))('rpc');var config=require(_0x4f63('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f63('0x9')][_0x4f63('0xa')]({'port':0x232a});config[_0x4f63('0xb')]=_['defaults'](config['redis'],{'host':_0x4f63('0xc'),'port':0x18eb});var socket=require(_0x4f63('0xd'))(new Redis(config['redis']));require(_0x4f63('0xe'))['register'](socket);function respondWithRpcPromise(_0x1d9534,_0x40ccbe,_0x1a217e){return new BPromise(function(_0x43adf2,_0x31f2e1){return client['request'](_0x1d9534,_0x1a217e)[_0x4f63('0xf')](function(_0x122556){logger[_0x4f63('0x10')](_0x4f63('0x11'),_0x40ccbe,_0x4f63('0x12'));logger['debug'](_0x4f63('0x13'),_0x40ccbe,_0x4f63('0x12'),JSON[_0x4f63('0x14')](_0x122556));if(_0x122556['error']){if(_0x122556[_0x4f63('0x15')][_0x4f63('0x16')]===0x1f4){logger[_0x4f63('0x15')](_0x4f63('0x11'),_0x40ccbe,_0x122556['error'][_0x4f63('0x17')]);return _0x31f2e1(_0x122556[_0x4f63('0x15')][_0x4f63('0x17')]);}logger['error'](_0x4f63('0x11'),_0x40ccbe,_0x122556[_0x4f63('0x15')]['message']);return _0x43adf2(_0x122556[_0x4f63('0x15')][_0x4f63('0x17')]);}else{logger['info'](_0x4f63('0x11'),_0x40ccbe,_0x4f63('0x12'));_0x43adf2(_0x122556[_0x4f63('0x18')][_0x4f63('0x17')]);}})[_0x4f63('0x19')](function(_0x40a3cd){logger[_0x4f63('0x15')](_0x4f63('0x11'),_0x40ccbe,_0x40a3cd);_0x31f2e1(_0x40a3cd);});});}exports[_0x4f63('0x1a')]=function(_0x188175){var _0x54a70c=this;return new Promise(function(_0x182885,_0x22aae8){return db[_0x4f63('0x1b')][_0x4f63('0x1c')](_0x188175[_0x4f63('0x1d')],{'raw':_0x188175[_0x4f63('0x1e')]?_0x188175[_0x4f63('0x1e')][_0x4f63('0x1f')]===undefined?!![]:![]:!![]})[_0x4f63('0xf')](function(_0x13f19b){logger[_0x4f63('0x10')]('CreatePlugin',_0x188175);logger[_0x4f63('0x20')]('CreatePlugin',_0x188175,JSON[_0x4f63('0x14')](_0x13f19b));_0x182885(_0x13f19b);})[_0x4f63('0x19')](function(_0x2d6624){logger[_0x4f63('0x15')](_0x4f63('0x1a'),_0x2d6624['message'],_0x188175);_0x22aae8(_0x54a70c[_0x4f63('0x15')](0x1f4,_0x2d6624[_0x4f63('0x17')]));});});}; \ No newline at end of file +var _0x6609=['info','result','catch','CreatePlugin','Plugin','create','body','options','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x2a4c35,_0x655fa2){var _0x5d29e1=function(_0xeada8f){while(--_0xeada8f){_0x2a4c35['push'](_0x2a4c35['shift']());}};_0x5d29e1(++_0x655fa2);}(_0x6609,0xce));var _0x9660=function(_0x9427f,_0x3a1e09){_0x9427f=_0x9427f-0x0;var _0xfbdae=_0x6609[_0x9427f];return _0xfbdae;};'use strict';var _=require('lodash');var util=require(_0x9660('0x0'));var moment=require(_0x9660('0x1'));var BPromise=require(_0x9660('0x2'));var rs=require(_0x9660('0x3'));var fs=require('fs');var Redis=require(_0x9660('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9660('0x5'));var logger=require(_0x9660('0x6'))('rpc');var config=require(_0x9660('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9660('0x8')][_0x9660('0x9')]({'port':0x232a});config[_0x9660('0xa')]=_['defaults'](config[_0x9660('0xa')],{'host':_0x9660('0xb'),'port':0x18eb});var socket=require(_0x9660('0xc'))(new Redis(config['redis']));require(_0x9660('0xd'))[_0x9660('0xe')](socket);function respondWithRpcPromise(_0x2a0844,_0x1f0a68,_0x4368b5){return new BPromise(function(_0x1b2374,_0x4970f9){return client[_0x9660('0xf')](_0x2a0844,_0x4368b5)[_0x9660('0x10')](function(_0x3b7dbb){logger['info'](_0x9660('0x11'),_0x1f0a68,_0x9660('0x12'));logger[_0x9660('0x13')](_0x9660('0x14'),_0x1f0a68,_0x9660('0x12'),JSON[_0x9660('0x15')](_0x3b7dbb));if(_0x3b7dbb['error']){if(_0x3b7dbb['error'][_0x9660('0x16')]===0x1f4){logger['error'](_0x9660('0x11'),_0x1f0a68,_0x3b7dbb[_0x9660('0x17')]['message']);return _0x4970f9(_0x3b7dbb[_0x9660('0x17')]['message']);}logger[_0x9660('0x17')](_0x9660('0x11'),_0x1f0a68,_0x3b7dbb[_0x9660('0x17')][_0x9660('0x18')]);return _0x1b2374(_0x3b7dbb['error'][_0x9660('0x18')]);}else{logger[_0x9660('0x19')](_0x9660('0x11'),_0x1f0a68,_0x9660('0x12'));_0x1b2374(_0x3b7dbb[_0x9660('0x1a')][_0x9660('0x18')]);}})[_0x9660('0x1b')](function(_0x46acfd){logger['error'](_0x9660('0x11'),_0x1f0a68,_0x46acfd);_0x4970f9(_0x46acfd);});});}exports[_0x9660('0x1c')]=function(_0x124ae3){var _0x2ca6b9=this;return new Promise(function(_0x1748a4,_0x5008a2){return db[_0x9660('0x1d')][_0x9660('0x1e')](_0x124ae3[_0x9660('0x1f')],{'raw':_0x124ae3[_0x9660('0x20')]?_0x124ae3['options']['raw']===undefined?!![]:![]:!![]})[_0x9660('0x10')](function(_0x598f86){logger['info'](_0x9660('0x1c'),_0x124ae3);logger[_0x9660('0x13')](_0x9660('0x1c'),_0x124ae3,JSON[_0x9660('0x15')](_0x598f86));_0x1748a4(_0x598f86);})['catch'](function(_0x3b757c){logger[_0x9660('0x17')](_0x9660('0x1c'),_0x3b757c[_0x9660('0x18')],_0x124ae3);_0x5008a2(_0x2ca6b9[_0x9660('0x17')](0x1f4,_0x3b757c[_0x9660('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5158e6d..7a93b73 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 _0x9480=['emit','removeListener','register','plugin:','./plugin.events','save','remove','update'];(function(_0x4ee881,_0x10ddc8){var _0x305f48=function(_0x5303d5){while(--_0x5303d5){_0x4ee881['push'](_0x4ee881['shift']());}};_0x305f48(++_0x10ddc8);}(_0x9480,0xf4));var _0x0948=function(_0x9a3d47,_0x1953a0){_0x9a3d47=_0x9a3d47-0x0;var _0xf60b78=_0x9480[_0x9a3d47];return _0xf60b78;};'use strict';var PluginEvents=require(_0x0948('0x0'));var events=[_0x0948('0x1'),_0x0948('0x2'),_0x0948('0x3')];function createListener(_0x30cda8,_0x3c6df1){return function(_0x4fc382){_0x3c6df1[_0x0948('0x4')](_0x30cda8,_0x4fc382);};}function removeListener(_0x49db19,_0x514449){return function(){PluginEvents[_0x0948('0x5')](_0x49db19,_0x514449);};}exports[_0x0948('0x6')]=function(_0x31e655){for(var _0x30462f=0x0,_0x156b4a=events['length'];_0x30462f<_0x156b4a;_0x30462f++){var _0x45c126=events[_0x30462f];var _0x1d4489=createListener(_0x0948('0x7')+_0x45c126,_0x31e655);PluginEvents['on'](_0x45c126,_0x1d4489);}}; \ No newline at end of file +var _0x2501=['./plugin.events','save','remove','update','emit','removeListener','register','length','plugin:'];(function(_0x2937ca,_0x4453ea){var _0xe9aa80=function(_0x3457e2){while(--_0x3457e2){_0x2937ca['push'](_0x2937ca['shift']());}};_0xe9aa80(++_0x4453ea);}(_0x2501,0xbd));var _0x1250=function(_0x3bfe12,_0x4db1d5){_0x3bfe12=_0x3bfe12-0x0;var _0x2b1a77=_0x2501[_0x3bfe12];return _0x2b1a77;};'use strict';var PluginEvents=require(_0x1250('0x0'));var events=[_0x1250('0x1'),_0x1250('0x2'),_0x1250('0x3')];function createListener(_0x12f7f7,_0x45a3b4){return function(_0x4a203c){_0x45a3b4[_0x1250('0x4')](_0x12f7f7,_0x4a203c);};}function removeListener(_0x28d9c6,_0x305fc5){return function(){PluginEvents[_0x1250('0x5')](_0x28d9c6,_0x305fc5);};}exports[_0x1250('0x6')]=function(_0x328d5d){for(var _0x9cd3a3=0x0,_0x4f24f6=events[_0x1250('0x7')];_0x9cd3a3<_0x4f24f6;_0x9cd3a3++){var _0x2e05fb=events[_0x9cd3a3];var _0x31e281=createListener(_0x1250('0x8')+_0x2e05fb,_0x328d5d);PluginEvents['on'](_0x2e05fb,_0x31e281);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 205318d..107f212 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(_0x18e530,_0x139dbd){var _0x4c7938=function(_0x548c09){while(--_0x548c09){_0x18e530['push'](_0x18e530['shift']());}};_0x4c7938(++_0x139dbd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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(_0x4acdb3,_0x32a0e7){var _0x319d88=function(_0x148ca4){while(--_0x148ca4){_0x4acdb3['push'](_0x4acdb3['shift']());}};_0x319d88(++_0x32a0e7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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 51b1169..f827346 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 _0xec56=['reject','express','length','then','catch','show','describe','params','create','body','join','../../files/plugins','script','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','npm\x20install','info','index','list'];(function(_0x1162a5,_0x4b0b20){var _0x2939c4=function(_0xfe515e){while(--_0xfe515e){_0x1162a5['push'](_0x1162a5['shift']());}};_0x2939c4(++_0x4b0b20);}(_0xec56,0x1bd));var _0x6ec5=function(_0x3ef320,_0x31896d){_0x3ef320=_0x3ef320-0x0;var _0x3e5e05=_0xec56[_0x3ef320];return _0x3e5e05;};'use strict';var _=require(_0x6ec5('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x6ec5('0x1'));var path=require(_0x6ec5('0x2'));var exec=require(_0x6ec5('0x3'))[_0x6ec5('0x4')];var BPromise=require(_0x6ec5('0x5'));function handleEntityNotFound(_0x399441,_0x469679){return function(_0x173aeb){if(!_0x173aeb){_0x399441[_0x6ec5('0x6')](0x194);;}return _0x173aeb;};}function respondWithResult(_0x28b12b,_0x2d0a93){_0x2d0a93=_0x2d0a93||0xc8;return function(_0x3bb683){if(_0x3bb683){return _0x28b12b[_0x6ec5('0x7')](_0x2d0a93)[_0x6ec5('0x8')](_0x3bb683);}return null;};}function handleError(_0x3dd891,_0x225d2f){_0x225d2f=_0x225d2f||0x1f4;return function(_0x17bcf0){logger[_0x6ec5('0x9')](_0x17bcf0[_0x6ec5('0xa')]);if(_0x17bcf0['name']){delete _0x17bcf0[_0x6ec5('0xb')];}_0x3dd891[_0x6ec5('0x7')](_0x225d2f)[_0x6ec5('0xc')](_0x17bcf0);};}function execChildProcess(){return new BPromise(function(_0x1964ae,_0x143b09){exec(_0x6ec5('0xd'),function(_0x1d5b76,_0x50eb2d,_0x2d4eca){logger[_0x6ec5('0xe')](_0x50eb2d);logger[_0x6ec5('0xe')](_0x2d4eca);if(_0x1d5b76){logger[_0x6ec5('0x9')](_0x1d5b76);return _0x143b09(_0x1d5b76);}return _0x1964ae(_0x50eb2d);});});}exports[_0x6ec5('0xf')]=function(_0x2890fb,_0x2f4c5d){return pm2[_0x6ec5('0x10')]()['then'](function(_0x3ed07a){if(_0x3ed07a){var _0x4d1510=_[_0x6ec5('0x11')](_0x3ed07a,function(_0x287542){return _0x287542[_0x6ec5('0xb')]===_0x6ec5('0x12')||_0x287542[_0x6ec5('0xb')]==='motion2';});return{'rows':_0x4d1510,'count':_0x4d1510[_0x6ec5('0x13')]};}return null;})[_0x6ec5('0x14')](respondWithResult(_0x2f4c5d,null))[_0x6ec5('0x15')](handleError(_0x2f4c5d,null));};exports[_0x6ec5('0x16')]=function(_0x23b3e3,_0x42b690){return pm2[_0x6ec5('0x17')](_0x23b3e3[_0x6ec5('0x18')]['id'])[_0x6ec5('0x14')](respondWithResult(_0x42b690,null))[_0x6ec5('0x14')](handleEntityNotFound(_0x42b690,null))[_0x6ec5('0x15')](handleError(_0x42b690,null));};exports[_0x6ec5('0x19')]=function(_0x437f0f,_0x2228dd){if(_0x437f0f[_0x6ec5('0x1a')][_0x6ec5('0xb')]&&_0x437f0f[_0x6ec5('0x1a')]['script']){var _0x272532=path[_0x6ec5('0x1b')](__dirname,_0x6ec5('0x1c'),_0x437f0f[_0x6ec5('0x1a')][_0x6ec5('0x1d')]);var _0x38a821=process[_0x6ec5('0x1e')]();process['chdir'](path[_0x6ec5('0x1f')](_0x272532));return execChildProcess()[_0x6ec5('0x14')](function(_0x358d18){process[_0x6ec5('0x20')](_0x38a821);return pm2['start']({'name':_0x437f0f[_0x6ec5('0x1a')][_0x6ec5('0xb')],'script':_0x272532});})['then'](function(_0x2dc0a7){pm2[_0x6ec5('0x21')]();return _0x2dc0a7[0x0];})[_0x6ec5('0x14')](respondWithResult(_0x2228dd,0xc9))['catch'](handleError(_0x2228dd,null));}else{return _0x2228dd[_0x6ec5('0x7')](0x1f4)[_0x6ec5('0xc')]({'message':_0x6ec5('0x22')});}};exports[_0x6ec5('0x23')]=function(_0x425fac,_0x484847){if(_0x425fac[_0x6ec5('0x1a')]['id']){delete _0x425fac[_0x6ec5('0x1a')]['id'];}var _0x4a9860={'online':_0x6ec5('0x24'),'stopped':_0x6ec5('0x25')};if(_0x4a9860['hasOwnProperty'](_0x425fac[_0x6ec5('0x1a')][_0x6ec5('0x7')])){return pm2[_0x4a9860[_0x425fac[_0x6ec5('0x1a')][_0x6ec5('0x7')]]](_0x425fac[_0x6ec5('0x18')]['id'])['then'](respondWithResult(_0x484847,0xc8))[_0x6ec5('0x15')](handleError(_0x484847,null));}else{return _0x484847[_0x6ec5('0x7')](0x1f4)[_0x6ec5('0xc')]({'message':_0x6ec5('0x26')});}};exports[_0x6ec5('0x27')]=function(_0x22c3d3,_0x394132){if(_0x22c3d3['body']['id']){delete _0x22c3d3[_0x6ec5('0x1a')]['id'];}if(_0x22c3d3['params']['id']){return pm2[_0x6ec5('0x28')](_0x22c3d3['params']['id'])[_0x6ec5('0x14')](function(_0x3115e3){pm2['dump']();return _0x3115e3[0x0];})['then'](respondWithResult(_0x394132,null))[_0x6ec5('0x15')](handleError(_0x394132,null));}else{return _0x394132[_0x6ec5('0x7')](0x1f4)['send']({'message':_0x6ec5('0x29')});}}; \ No newline at end of file +var _0x99e9=['../../config/pm2','../../config/logger','api','path','exec','bluebird','status','error','stack','name','send','npm\x20install','info','index','list','then','motion2','length','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id'];(function(_0xd896f3,_0x5f500c){var _0x247847=function(_0x204f43){while(--_0x204f43){_0xd896f3['push'](_0xd896f3['shift']());}};_0x247847(++_0x5f500c);}(_0x99e9,0xb4));var _0x999e=function(_0x2f9467,_0x40576f){_0x2f9467=_0x2f9467-0x0;var _0x39894c=_0x99e9[_0x2f9467];return _0x39894c;};'use strict';var _=require('lodash');var pm2=require(_0x999e('0x0'));var logger=require(_0x999e('0x1'))(_0x999e('0x2'));var path=require(_0x999e('0x3'));var exec=require('child_process')[_0x999e('0x4')];var BPromise=require(_0x999e('0x5'));function handleEntityNotFound(_0x3aac27,_0x4e2112){return function(_0x296411){if(!_0x296411){_0x3aac27['sendStatus'](0x194);;}return _0x296411;};}function respondWithResult(_0x25421f,_0x1bda0a){_0x1bda0a=_0x1bda0a||0xc8;return function(_0x100330){if(_0x100330){return _0x25421f[_0x999e('0x6')](_0x1bda0a)['json'](_0x100330);}return null;};}function handleError(_0x46aeae,_0x38a692){_0x38a692=_0x38a692||0x1f4;return function(_0x343a12){logger[_0x999e('0x7')](_0x343a12[_0x999e('0x8')]);if(_0x343a12[_0x999e('0x9')]){delete _0x343a12[_0x999e('0x9')];}_0x46aeae[_0x999e('0x6')](_0x38a692)[_0x999e('0xa')](_0x343a12);};}function execChildProcess(){return new BPromise(function(_0xf40130,_0x9368cf){exec(_0x999e('0xb'),function(_0x4246b1,_0x188d02,_0x3dfe2d){logger[_0x999e('0xc')](_0x188d02);logger[_0x999e('0xc')](_0x3dfe2d);if(_0x4246b1){logger['error'](_0x4246b1);return _0x9368cf(_0x4246b1);}return _0xf40130(_0x188d02);});});}exports[_0x999e('0xd')]=function(_0x54afad,_0x3e6f5a){return pm2[_0x999e('0xe')]()[_0x999e('0xf')](function(_0x538a92){if(_0x538a92){var _0x28bdd1=_['reject'](_0x538a92,function(_0xa44e4c){return _0xa44e4c['name']==='express'||_0xa44e4c[_0x999e('0x9')]===_0x999e('0x10');});return{'rows':_0x28bdd1,'count':_0x28bdd1[_0x999e('0x11')]};}return null;})[_0x999e('0xf')](respondWithResult(_0x3e6f5a,null))[_0x999e('0x12')](handleError(_0x3e6f5a,null));};exports[_0x999e('0x13')]=function(_0x4aac66,_0x5bb27e){return pm2['describe'](_0x4aac66[_0x999e('0x14')]['id'])[_0x999e('0xf')](respondWithResult(_0x5bb27e,null))[_0x999e('0xf')](handleEntityNotFound(_0x5bb27e,null))[_0x999e('0x12')](handleError(_0x5bb27e,null));};exports[_0x999e('0x15')]=function(_0x3ece5e,_0x5af4c3){if(_0x3ece5e['body'][_0x999e('0x9')]&&_0x3ece5e[_0x999e('0x16')][_0x999e('0x17')]){var _0x510fa2=path[_0x999e('0x18')](__dirname,_0x999e('0x19'),_0x3ece5e[_0x999e('0x16')][_0x999e('0x17')]);var _0x373b80=process[_0x999e('0x1a')]();process[_0x999e('0x1b')](path['dirname'](_0x510fa2));return execChildProcess()['then'](function(_0x11a6bf){process[_0x999e('0x1b')](_0x373b80);return pm2['start']({'name':_0x3ece5e[_0x999e('0x16')][_0x999e('0x9')],'script':_0x510fa2});})[_0x999e('0xf')](function(_0x13027c){pm2[_0x999e('0x1c')]();return _0x13027c[0x0];})[_0x999e('0xf')](respondWithResult(_0x5af4c3,0xc9))['catch'](handleError(_0x5af4c3,null));}else{return _0x5af4c3[_0x999e('0x6')](0x1f4)[_0x999e('0xa')]({'message':_0x999e('0x1d')});}};exports[_0x999e('0x1e')]=function(_0x1b7adb,_0x1d2dc6){if(_0x1b7adb[_0x999e('0x16')]['id']){delete _0x1b7adb['body']['id'];}var _0x28f803={'online':'restart','stopped':'stop'};if(_0x28f803[_0x999e('0x1f')](_0x1b7adb[_0x999e('0x16')][_0x999e('0x6')])){return pm2[_0x28f803[_0x1b7adb['body'][_0x999e('0x6')]]](_0x1b7adb[_0x999e('0x14')]['id'])[_0x999e('0xf')](respondWithResult(_0x1d2dc6,0xc8))[_0x999e('0x12')](handleError(_0x1d2dc6,null));}else{return _0x1d2dc6[_0x999e('0x6')](0x1f4)[_0x999e('0xa')]({'message':_0x999e('0x20')});}};exports[_0x999e('0x21')]=function(_0x27102b,_0x3ddacb){if(_0x27102b['body']['id']){delete _0x27102b[_0x999e('0x16')]['id'];}if(_0x27102b[_0x999e('0x14')]['id']){return pm2[_0x999e('0x22')](_0x27102b['params']['id'])[_0x999e('0xf')](function(_0x5af72c){pm2['dump']();return _0x5af72c[0x0];})[_0x999e('0xf')](respondWithResult(_0x3ddacb,null))[_0x999e('0x12')](handleError(_0x3ddacb,null));}else{return _0x3ddacb['status'](0x1f4)['send']({'message':_0x999e('0x23')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 3ec5596..18c7f48 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 _0xb240=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./realtime.controller','get','/queues','isAuthenticated','getQueues'];(function(_0x557158,_0x5a5cba){var _0x59c35b=function(_0x55c6fc){while(--_0x55c6fc){_0x557158['push'](_0x557158['shift']());}};_0x59c35b(++_0x5a5cba);}(_0xb240,0x7e));var _0x0b24=function(_0x31fb33,_0x1c794a){_0x31fb33=_0x31fb33-0x0;var _0x38ffd8=_0xb240[_0x31fb33];return _0x38ffd8;};'use strict';var multer=require(_0x0b24('0x0'));var util=require(_0x0b24('0x1'));var path=require(_0x0b24('0x2'));var timeout=require(_0x0b24('0x3'));var express=require(_0x0b24('0x4'));var router=express[_0x0b24('0x5')]();var fs_extra=require(_0x0b24('0x6'));var auth=require(_0x0b24('0x7'));var interaction=require(_0x0b24('0x8'));var config=require('../../config/environment');var controller=require(_0x0b24('0x9'));router[_0x0b24('0xa')](_0x0b24('0xb'),auth[_0x0b24('0xc')](),controller[_0x0b24('0xd')]);module['exports']=router; \ No newline at end of file +var _0x86e7=['exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','/queues','isAuthenticated'];(function(_0x4be2cc,_0x4fc070){var _0x58f8e2=function(_0x53a0f6){while(--_0x53a0f6){_0x4be2cc['push'](_0x4be2cc['shift']());}};_0x58f8e2(++_0x4fc070);}(_0x86e7,0xf1));var _0x786e=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x86e7[_0x49d41c];return _0xb64c5f;};'use strict';var multer=require(_0x786e('0x0'));var util=require(_0x786e('0x1'));var path=require(_0x786e('0x2'));var timeout=require('connect-timeout');var express=require(_0x786e('0x3'));var router=express[_0x786e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x786e('0x5'));var interaction=require(_0x786e('0x6'));var config=require('../../config/environment');var controller=require('./realtime.controller');router['get'](_0x786e('0x7'),auth[_0x786e('0x8')](),controller['getQueues']);module[_0x786e('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 fa23064..e1453c7 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 _0xea19=['getResources','findAndCountAll','format','loggedIn','waiting','talking','paused','pTalking','originated','dialActive','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','rows','loggedInDb','available','agents','find','merge','getAgents','online','getMembers','length','User','QueueId','Pause','findAll','agent','all','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../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','Realtime,\x20%s,\x20%s','request\x20sent','Realtime,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','name','send','getQueues','mail','chat','sms','openchannel','fax','whatsapp','resolve','query','channel','toLowerCase','Invalid\x20channel','Queue','map','rawAttributes','fieldName','type','key','user','role','userProfileId','voice','outbound','startCase','Queues','filter','UserProfile'];(function(_0x9346d6,_0x24faf1){var _0x3335e2=function(_0xfec42b){while(--_0xfec42b){_0x9346d6['push'](_0x9346d6['shift']());}};_0x3335e2(++_0x24faf1);}(_0xea19,0x193));var _0x9ea1=function(_0x4bb581,_0x6f7037){_0x4bb581=_0x4bb581-0x0;var _0x316bf5=_0xea19[_0x4bb581];return _0x316bf5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ea1('0x0'));var zipdir=require(_0x9ea1('0x1'));var jsonpatch=require(_0x9ea1('0x2'));var rp=require(_0x9ea1('0x3'));var moment=require(_0x9ea1('0x4'));var BPromise=require(_0x9ea1('0x5'));var Mustache=require('mustache');var util=require(_0x9ea1('0x6'));var path=require(_0x9ea1('0x7'));var sox=require(_0x9ea1('0x8'));var csv=require(_0x9ea1('0x9'));var ejs=require(_0x9ea1('0xa'));var fs=require('fs');var fs_extra=require(_0x9ea1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ea1('0xc'));var deskjs=require(_0x9ea1('0xd'));var toCsv=require(_0x9ea1('0x9'));var querystring=require(_0x9ea1('0xe'));var Papa=require(_0x9ea1('0xf'));var Redis=require('ioredis');var authService=require(_0x9ea1('0x10'));var qs=require(_0x9ea1('0x11'));var as=require(_0x9ea1('0x12'));var hardwareService=require(_0x9ea1('0x13'));var logger=require('../../config/logger')(_0x9ea1('0x14'));var utils=require(_0x9ea1('0x15'));var config=require(_0x9ea1('0x16'));var licenseUtil=require(_0x9ea1('0x17'));var db=require(_0x9ea1('0x18'))['db'];var jayson=require(_0x9ea1('0x19'));var client=jayson[_0x9ea1('0x1a')][_0x9ea1('0x1b')]({'port':0x232a});var routingClient=jayson[_0x9ea1('0x1a')][_0x9ea1('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x2e2726,_0x2fcb52,_0x364457,_0x20823c){return new BPromise(function(_0x4da46b,_0x334bbf){var _0xdc9d57=_0x20823c||client;return _0xdc9d57[_0x9ea1('0x1c')](_0x2e2726,_0x364457)[_0x9ea1('0x1d')](function(_0x1d7e21){logger[_0x9ea1('0x1e')](_0x9ea1('0x1f'),_0x2fcb52,_0x9ea1('0x20'));logger['debug'](_0x9ea1('0x21'),_0x2fcb52,'request\x20sent',JSON['stringify'](_0x1d7e21));if(_0x1d7e21['error']){if(_0x1d7e21[_0x9ea1('0x22')]['code']===0x1f4){logger[_0x9ea1('0x22')]('Realtime,\x20%s,\x20%s',_0x2fcb52,_0x1d7e21['error'][_0x9ea1('0x23')]);return _0x334bbf(_0x1d7e21[_0x9ea1('0x22')][_0x9ea1('0x23')]);}logger[_0x9ea1('0x22')](_0x9ea1('0x1f'),_0x2fcb52,_0x1d7e21[_0x9ea1('0x22')]['message']);return _0x4da46b(_0x1d7e21[_0x9ea1('0x22')]['message']);}else{logger[_0x9ea1('0x1e')](_0x9ea1('0x1f'),_0x2fcb52,_0x9ea1('0x20'));_0x4da46b(_0x1d7e21[_0x9ea1('0x24')]['message']);}})[_0x9ea1('0x25')](function(_0x1e556f){logger['error']('Realtime,\x20%s,\x20%s',_0x2fcb52,_0x1e556f);_0x334bbf(_0x1e556f);});});}function respondWithStatusCode(_0x28d569,_0x59a3f8){_0x59a3f8=_0x59a3f8||0xcc;return function(_0x5390e9){if(_0x5390e9){return _0x28d569[_0x9ea1('0x26')](_0x59a3f8);}return _0x28d569[_0x9ea1('0x27')](_0x59a3f8)[_0x9ea1('0x28')]();};}function respondWithResult(_0x2572f6,_0xbdde72){_0xbdde72=_0xbdde72||0xc8;return function(_0x1adad4){if(_0x1adad4){return _0x2572f6[_0x9ea1('0x27')](_0xbdde72)[_0x9ea1('0x29')](_0x1adad4);}};}function respondWithFilteredResult(_0x478f34,_0x1c4c17){return function(_0x4c3f3b){if(_0x4c3f3b){var _0x198e8f=typeof _0x1c4c17[_0x9ea1('0x2a')]===_0x9ea1('0x2b')&&typeof _0x1c4c17[_0x9ea1('0x2c')]===_0x9ea1('0x2b');var _0x1e68ab=_0x4c3f3b[_0x9ea1('0x2d')];var _0x1129df=_0x198e8f?0x0:_0x1c4c17['offset'];var _0x467fb9=_0x198e8f?_0x4c3f3b[_0x9ea1('0x2d')]:_0x1c4c17['offset']+_0x1c4c17[_0x9ea1('0x2c')];var _0x142475;if(_0x467fb9>=_0x1e68ab){_0x467fb9=_0x1e68ab;_0x142475=0xc8;}else{_0x142475=0xce;}_0x478f34[_0x9ea1('0x27')](_0x142475);return _0x478f34[_0x9ea1('0x2e')](_0x9ea1('0x2f'),_0x1129df+'-'+_0x467fb9+'/'+_0x1e68ab)[_0x9ea1('0x29')](_0x4c3f3b);}return null;};}function patchUpdates(_0x226f8f){return function(_0x166929){try{jsonpatch[_0x9ea1('0x30')](_0x166929,_0x226f8f,!![]);}catch(_0x54c531){return BPromise['reject'](_0x54c531);}return _0x166929[_0x9ea1('0x31')]();};}function saveUpdates(_0x47b456,_0x4ce1f3){return function(_0x44a395){if(_0x44a395){return _0x44a395[_0x9ea1('0x32')](_0x47b456)[_0x9ea1('0x1d')](function(_0x5cbf3a){return _0x5cbf3a;});}return null;};}function removeEntity(_0x3f8b11,_0x3c174a){return function(_0x5493af){if(_0x5493af){return _0x5493af[_0x9ea1('0x33')]()[_0x9ea1('0x1d')](function(){_0x3f8b11[_0x9ea1('0x27')](0xcc)[_0x9ea1('0x28')]();});}};}function handleEntityNotFound(_0x594b3f,_0x2cc2ed){return function(_0xf3e0cd){if(!_0xf3e0cd){_0x594b3f[_0x9ea1('0x26')](0x194);}return _0xf3e0cd;};}function handleError(_0x2cca52,_0x598687){_0x598687=_0x598687||0x1f4;return function(_0x43abd3){logger[_0x9ea1('0x22')](_0x43abd3['stack']);if(_0x43abd3[_0x9ea1('0x34')]){delete _0x43abd3[_0x9ea1('0x34')];}_0x2cca52[_0x9ea1('0x27')](_0x598687)[_0x9ea1('0x35')](_0x43abd3);};}exports[_0x9ea1('0x36')]=function(_0x4296b3,_0x45cfc6){var _0x36786f=[_0x9ea1('0x37'),_0x9ea1('0x38'),_0x9ea1('0x39'),_0x9ea1('0x3a'),_0x9ea1('0x3b'),_0x9ea1('0x3c'),'voice'];var _0x699af3={'count':0x0,'rows':[]},_0x527c90={},_0x596e25;Promise[_0x9ea1('0x3d')]()[_0x9ea1('0x1d')](function(){if(_0x4296b3[_0x9ea1('0x3e')][_0x9ea1('0x3f')]){if(!_['includes'](_0x36786f,_0x4296b3[_0x9ea1('0x3e')][_0x9ea1('0x3f')][_0x9ea1('0x40')]()))throw new Error(_0x9ea1('0x41'));_0x596e25=_0x4296b3[_0x9ea1('0x3e')][_0x9ea1('0x3f')]['toLowerCase']();}var _0x274b0f=_['startCase'](_0x596e25)+_0x9ea1('0x42');var _0x51c1e0=_[_0x9ea1('0x43')](db[_0x274b0f][_0x9ea1('0x44')],function(_0x4d5619){return{'name':_0x4d5619[_0x9ea1('0x45')],'type':_0x4d5619[_0x9ea1('0x46')][_0x9ea1('0x47')]};});_0x527c90=qs['getOptions'](_0x51c1e0,_0x4296b3);if(_0x4296b3[_0x9ea1('0x48')][_0x9ea1('0x49')]===_0x9ea1('0x48')){var _0x43926b={'params':{'id':_0x4296b3[_0x9ea1('0x48')][_0x9ea1('0x4a')]},'query':{'section':_0x596e25===_0x9ea1('0x4b')&&_0x4296b3['query']['type']===_0x9ea1('0x4c')?'QueueCampaigns':_[_0x9ea1('0x4d')](_0x596e25)+_0x9ea1('0x4e'),'type':_0x4296b3[_0x9ea1('0x3e')][_0x9ea1('0x46')],'nolimit':!![],'sort':'name','filter':_0x4296b3[_0x9ea1('0x3e')][_0x9ea1('0x4f')]}};return db[_0x9ea1('0x50')][_0x9ea1('0x51')](_0x43926b);}return db[_0x274b0f][_0x9ea1('0x52')](_0x527c90);})[_0x9ea1('0x1d')](function(_0x38e68f){_0x699af3[_0x9ea1('0x2d')]=_0x38e68f['count'];var _0x4fb3cd=_0x596e25===_0x9ea1('0x4b')?client:routingClient;return _0x4fb3cd['request'](_[_0x9ea1('0x4d')](_0x596e25)+_0x9ea1('0x4e'),_0x4296b3)[_0x9ea1('0x1d')](function(_0x345a56){if(_0x345a56[_0x9ea1('0x22')])throw new Error(util[_0x9ea1('0x53')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x596e25));var _0x251fa3=_0x345a56['result'];var _0x472be2=[_0x9ea1('0x54'),'available',_0x9ea1('0x55'),_0x9ea1('0x56'),_0x9ea1('0x57')];if(_0x596e25===_0x9ea1('0x4b')&&_0x4296b3[_0x9ea1('0x3e')][_0x9ea1('0x46')]===_0x9ea1('0x4c')){_0x472be2['push'](_0x9ea1('0x58'),_0x9ea1('0x59'),_0x9ea1('0x23'),_0x9ea1('0x5a'),_0x9ea1('0x5b'),_0x9ea1('0x5c'),'startPredictive',_0x9ea1('0x5d'),_0x9ea1('0x5e'),_0x9ea1('0x5f'),_0x9ea1('0x60'),_0x9ea1('0x61'),'dialPredictiveInterval',_0x9ea1('0x62'),'dialPredictiveIntervalMinThreshold',_0x9ea1('0x63'),_0x9ea1('0x64'),'predictiveIntervalAnsweredCalls',_0x9ea1('0x65'),_0x9ea1('0x66'),_0x9ea1('0x67'),_0x9ea1('0x68'));}var _0x28fb97=_0x38e68f[_0x9ea1('0x69')][_0x9ea1('0x43')](function(_0xf43901){var _0x4c370f=_0xf43901['get']({'plain':!![]});_0x4c370f['paused']=0x0;_0x4c370f[_0x9ea1('0x6a')]=0x0;_0x4c370f[_0x9ea1('0x54')]=0x0;_0x4c370f[_0x9ea1('0x6b')]=0x0;_0x4c370f[_0x9ea1('0x57')]=0x0;_0x4c370f['waiting']=0x0;if(_0x596e25===_0x9ea1('0x4b')){_0x4c370f['talking']=0x0;if(_0x4296b3['query'][_0x9ea1('0x46')]==='outbound'){_0x4c370f['pTalking']=0x0;_0x4c370f['originated']=0x0;}}_0x4c370f[_0x9ea1('0x6c')]=[];var _0x58f22b=_[_0x9ea1('0x6d')](_0x251fa3[_0x9ea1('0x69')],['id',_0x4c370f['id']]);if(_0x58f22b)_[_0x9ea1('0x6e')](_0x4c370f,_['pick'](_0x58f22b,_0x472be2));if(_0x596e25===_0x9ea1('0x4b')){return _0xf43901[_0x9ea1('0x6f')]({'attributes':['id',_0x9ea1('0x34'),_0x9ea1('0x70')],'joinTableAttributes':[],'raw':!![]})[_0x9ea1('0x1d')](function(_0x4369e2){return _0xf43901[_0x9ea1('0x71')]({'raw':!![]})['then'](function(_0x1020af){for(var _0x1b4969=0x0;_0x1b4969<_0x4369e2[_0x9ea1('0x72')];_0x1b4969++){var _0x5b95db=_['find'](_0x1020af,['UserId',_0x4369e2[_0x1b4969]['id']]);var _0x5cad30={'id':_0x4369e2[_0x1b4969]['id'],'name':_0x4369e2[_0x1b4969][_0x9ea1('0x34')],'online':Boolean(_0x4369e2[_0x1b4969][_0x9ea1('0x70')]),'paused':_0x5b95db?Boolean(_0x5b95db[_0x9ea1('0x57')]):![]};if(_0x5cad30[_0x9ea1('0x70')])_0x4c370f[_0x9ea1('0x6a')]++;if(_0x5cad30['paused'])_0x4c370f[_0x9ea1('0x57')]++;_0x4c370f['agents']['push'](_0x5cad30);}return _0x4c370f;});});}else{var _0x722543=_0x9ea1('0x73')+_[_0x9ea1('0x4d')](_0x596e25)+_0x9ea1('0x42');var _0x4bc9d1=_[_0x9ea1('0x4d')](_0x596e25)+_0x9ea1('0x74');var _0x3b07a5=_0x596e25+_0x9ea1('0x75');return db[_0x722543][_0x9ea1('0x76')]({'where':{['userQueueKey']:_0xf43901['id']},'raw':!![]})[_0x9ea1('0x1d')](function(_0x5c0f62){return db['User'][_0x9ea1('0x76')]({'attributes':['id',_0x9ea1('0x34'),_0x9ea1('0x70'),_0x3b07a5],'where':{'id':_[_0x9ea1('0x43')](_0x5c0f62,'UserId'),'role':_0x9ea1('0x77')},'raw':!![]});})[_0x9ea1('0x1d')](function(_0x580e87){for(var _0x3b196b=0x0;_0x3b196b<_0x580e87[_0x9ea1('0x72')];_0x3b196b++){var _0x4b24d1={'id':_0x580e87[_0x3b196b]['id'],'name':_0x580e87[_0x3b196b]['name'],'online':Boolean(_0x580e87[_0x3b196b][_0x9ea1('0x70')]),'paused':Boolean(_0x580e87[_0x3b196b][_0x3b07a5])};if(_0x4b24d1['online'])_0x4c370f['loggedInDb']++;if(_0x4b24d1[_0x9ea1('0x57')])_0x4c370f[_0x9ea1('0x57')]++;_0x4c370f[_0x9ea1('0x6c')]['push'](_0x4b24d1);}return _0x4c370f;});}});return Promise[_0x9ea1('0x78')](_0x28fb97);});})[_0x9ea1('0x1d')](function(_0xf69cc1){_0x699af3[_0x9ea1('0x69')]=_0xf69cc1;return _0x699af3;})[_0x9ea1('0x1d')](respondWithFilteredResult(_0x45cfc6,_0x527c90))[_0x9ea1('0x25')](handleError(_0x45cfc6,null));}; \ No newline at end of file +var _0xbe27=['status','json','offset','limit','count','Content-Range','reject','save','update','stack','name','send','getQueues','mail','chat','sms','voice','resolve','query','channel','toLowerCase','startCase','Queue','rawAttributes','fieldName','type','key','user','outbound','QueueCampaigns','Queues','filter','UserProfile','findAndCountAll','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','available','paused','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','rows','map','loggedInDb','loggedIn','waiting','talking','agents','find','merge','pick','getAgents','online','getMembers','UserId','User','findAll','length','catch','eml-format','rimraf','fast-json-patch','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Realtime,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Realtime,\x20%s,\x20%s','message','result','sendStatus','end'];(function(_0x119705,_0xba9427){var _0x2affc2=function(_0x16f7e2){while(--_0x16f7e2){_0x119705['push'](_0x119705['shift']());}};_0x2affc2(++_0xba9427);}(_0xbe27,0x192));var _0x7be2=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbe27[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x7be2('0x0'));var rimraf=require(_0x7be2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7be2('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7be2('0x3'));var Mustache=require('mustache');var util=require(_0x7be2('0x4'));var path=require('path');var sox=require(_0x7be2('0x5'));var csv=require(_0x7be2('0x6'));var ejs=require(_0x7be2('0x7'));var fs=require('fs');var fs_extra=require(_0x7be2('0x8'));var _=require(_0x7be2('0x9'));var squel=require(_0x7be2('0xa'));var crypto=require(_0x7be2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7be2('0xc'));var toCsv=require('to-csv');var querystring=require(_0x7be2('0xd'));var Papa=require(_0x7be2('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7be2('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7be2('0x10'));var logger=require(_0x7be2('0x11'))(_0x7be2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7be2('0x13'));var db=require(_0x7be2('0x14'))['db'];var jayson=require(_0x7be2('0x15'));var client=jayson[_0x7be2('0x16')]['http']({'port':0x232a});var routingClient=jayson[_0x7be2('0x16')][_0x7be2('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x1f1a82,_0x31ad21,_0x44a1a3,_0x214116){return new BPromise(function(_0x21bba1,_0x23f5e9){var _0x609aa8=_0x214116||client;return _0x609aa8[_0x7be2('0x18')](_0x1f1a82,_0x44a1a3)[_0x7be2('0x19')](function(_0x53d1da){logger[_0x7be2('0x1a')]('Realtime,\x20%s,\x20%s',_0x31ad21,'request\x20sent');logger[_0x7be2('0x1b')](_0x7be2('0x1c'),_0x31ad21,_0x7be2('0x1d'),JSON[_0x7be2('0x1e')](_0x53d1da));if(_0x53d1da[_0x7be2('0x1f')]){if(_0x53d1da[_0x7be2('0x1f')][_0x7be2('0x20')]===0x1f4){logger[_0x7be2('0x1f')](_0x7be2('0x21'),_0x31ad21,_0x53d1da[_0x7be2('0x1f')]['message']);return _0x23f5e9(_0x53d1da[_0x7be2('0x1f')][_0x7be2('0x22')]);}logger[_0x7be2('0x1f')](_0x7be2('0x21'),_0x31ad21,_0x53d1da[_0x7be2('0x1f')][_0x7be2('0x22')]);return _0x21bba1(_0x53d1da[_0x7be2('0x1f')][_0x7be2('0x22')]);}else{logger[_0x7be2('0x1a')](_0x7be2('0x21'),_0x31ad21,_0x7be2('0x1d'));_0x21bba1(_0x53d1da[_0x7be2('0x23')]['message']);}})['catch'](function(_0x5a7476){logger[_0x7be2('0x1f')](_0x7be2('0x21'),_0x31ad21,_0x5a7476);_0x23f5e9(_0x5a7476);});});}function respondWithStatusCode(_0x23ce75,_0x265d3f){_0x265d3f=_0x265d3f||0xcc;return function(_0x514f76){if(_0x514f76){return _0x23ce75[_0x7be2('0x24')](_0x265d3f);}return _0x23ce75['status'](_0x265d3f)[_0x7be2('0x25')]();};}function respondWithResult(_0x37cecc,_0x177023){_0x177023=_0x177023||0xc8;return function(_0x475908){if(_0x475908){return _0x37cecc[_0x7be2('0x26')](_0x177023)[_0x7be2('0x27')](_0x475908);}};}function respondWithFilteredResult(_0x11b1f3,_0x1b9110){return function(_0x19cca0){if(_0x19cca0){var _0x2c1a87=typeof _0x1b9110[_0x7be2('0x28')]==='undefined'&&typeof _0x1b9110[_0x7be2('0x29')]==='undefined';var _0x4c1621=_0x19cca0['count'];var _0x3dac21=_0x2c1a87?0x0:_0x1b9110[_0x7be2('0x28')];var _0x4e023c=_0x2c1a87?_0x19cca0[_0x7be2('0x2a')]:_0x1b9110[_0x7be2('0x28')]+_0x1b9110[_0x7be2('0x29')];var _0x517da0;if(_0x4e023c>=_0x4c1621){_0x4e023c=_0x4c1621;_0x517da0=0xc8;}else{_0x517da0=0xce;}_0x11b1f3['status'](_0x517da0);return _0x11b1f3['set'](_0x7be2('0x2b'),_0x3dac21+'-'+_0x4e023c+'/'+_0x4c1621)[_0x7be2('0x27')](_0x19cca0);}return null;};}function patchUpdates(_0x3ac56e){return function(_0x5966bf){try{jsonpatch['apply'](_0x5966bf,_0x3ac56e,!![]);}catch(_0x2bde1d){return BPromise[_0x7be2('0x2c')](_0x2bde1d);}return _0x5966bf[_0x7be2('0x2d')]();};}function saveUpdates(_0x27be05,_0x52b077){return function(_0x342224){if(_0x342224){return _0x342224[_0x7be2('0x2e')](_0x27be05)[_0x7be2('0x19')](function(_0x3f6a38){return _0x3f6a38;});}return null;};}function removeEntity(_0x34ebaa,_0x45b8a9){return function(_0x462d9f){if(_0x462d9f){return _0x462d9f['destroy']()[_0x7be2('0x19')](function(){_0x34ebaa[_0x7be2('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0xd21604,_0x18814e){return function(_0x57936c){if(!_0x57936c){_0xd21604[_0x7be2('0x24')](0x194);}return _0x57936c;};}function handleError(_0x50cce7,_0x588505){_0x588505=_0x588505||0x1f4;return function(_0x603ee8){logger[_0x7be2('0x1f')](_0x603ee8[_0x7be2('0x2f')]);if(_0x603ee8[_0x7be2('0x30')]){delete _0x603ee8['name'];}_0x50cce7[_0x7be2('0x26')](_0x588505)[_0x7be2('0x31')](_0x603ee8);};}exports[_0x7be2('0x32')]=function(_0x3a1c92,_0x29f9eb){var _0x2d9a67=[_0x7be2('0x33'),_0x7be2('0x34'),_0x7be2('0x35'),'openchannel','fax','whatsapp',_0x7be2('0x36')];var _0x3f6356={'count':0x0,'rows':[]},_0x442183={},_0x3c449b;Promise[_0x7be2('0x37')]()[_0x7be2('0x19')](function(){if(_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x39')]){if(!_['includes'](_0x2d9a67,_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x39')][_0x7be2('0x3a')]()))throw new Error('Invalid\x20channel');_0x3c449b=_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x39')][_0x7be2('0x3a')]();}var _0x8426b0=_[_0x7be2('0x3b')](_0x3c449b)+_0x7be2('0x3c');var _0x5961be=_['map'](db[_0x8426b0][_0x7be2('0x3d')],function(_0x557b54){return{'name':_0x557b54[_0x7be2('0x3e')],'type':_0x557b54[_0x7be2('0x3f')][_0x7be2('0x40')]};});_0x442183=qs['getOptions'](_0x5961be,_0x3a1c92);if(_0x3a1c92[_0x7be2('0x41')]['role']===_0x7be2('0x41')){var _0x59e6fe={'params':{'id':_0x3a1c92[_0x7be2('0x41')]['userProfileId']},'query':{'section':_0x3c449b===_0x7be2('0x36')&&_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x3f')]===_0x7be2('0x42')?_0x7be2('0x43'):_['startCase'](_0x3c449b)+_0x7be2('0x44'),'type':_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x3f')],'nolimit':!![],'sort':_0x7be2('0x30'),'filter':_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x45')]}};return db[_0x7be2('0x46')]['getResources'](_0x59e6fe);}return db[_0x8426b0][_0x7be2('0x47')](_0x442183);})['then'](function(_0x3ff25b){_0x3f6356['count']=_0x3ff25b[_0x7be2('0x2a')];var _0x5061dc=_0x3c449b===_0x7be2('0x36')?client:routingClient;return _0x5061dc['request'](_[_0x7be2('0x3b')](_0x3c449b)+_0x7be2('0x44'),_0x3a1c92)[_0x7be2('0x19')](function(_0x4cc9ce){if(_0x4cc9ce[_0x7be2('0x1f')])throw new Error(util['format'](_0x7be2('0x48'),_0x3c449b));var _0x3d5f0f=_0x4cc9ce[_0x7be2('0x23')];var _0x3beea1=['loggedIn',_0x7be2('0x49'),'waiting','talking',_0x7be2('0x4a')];if(_0x3c449b===_0x7be2('0x36')&&_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x3f')]===_0x7be2('0x42')){_0x3beea1[_0x7be2('0x4b')](_0x7be2('0x4c'),_0x7be2('0x4d'),_0x7be2('0x22'),_0x7be2('0x4e'),_0x7be2('0x4f'),_0x7be2('0x50'),_0x7be2('0x51'),'startProgressive',_0x7be2('0x52'),_0x7be2('0x53'),_0x7be2('0x54'),'erlangBusyFactor',_0x7be2('0x55'),_0x7be2('0x56'),_0x7be2('0x57'),_0x7be2('0x58'),'predictiveIntervalTotalCalls',_0x7be2('0x59'),_0x7be2('0x5a'),'predictiveIntervalDroppedCallsCallersExit',_0x7be2('0x5b'),'predictiveIntervalAvgTalktime');}var _0x27a214=_0x3ff25b[_0x7be2('0x5c')][_0x7be2('0x5d')](function(_0x2f8e52){var _0x26d61e=_0x2f8e52['get']({'plain':!![]});_0x26d61e[_0x7be2('0x4a')]=0x0;_0x26d61e[_0x7be2('0x5e')]=0x0;_0x26d61e[_0x7be2('0x5f')]=0x0;_0x26d61e['available']=0x0;_0x26d61e[_0x7be2('0x4a')]=0x0;_0x26d61e[_0x7be2('0x60')]=0x0;if(_0x3c449b===_0x7be2('0x36')){_0x26d61e[_0x7be2('0x61')]=0x0;if(_0x3a1c92[_0x7be2('0x38')][_0x7be2('0x3f')]==='outbound'){_0x26d61e['pTalking']=0x0;_0x26d61e['originated']=0x0;}}_0x26d61e[_0x7be2('0x62')]=[];var _0x5c555b=_[_0x7be2('0x63')](_0x3d5f0f[_0x7be2('0x5c')],['id',_0x26d61e['id']]);if(_0x5c555b)_[_0x7be2('0x64')](_0x26d61e,_[_0x7be2('0x65')](_0x5c555b,_0x3beea1));if(_0x3c449b===_0x7be2('0x36')){return _0x2f8e52[_0x7be2('0x66')]({'attributes':['id',_0x7be2('0x30'),_0x7be2('0x67')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0xc8fc2b){return _0x2f8e52[_0x7be2('0x68')]({'raw':!![]})['then'](function(_0x577bad){for(var _0x242cec=0x0;_0x242cec<_0xc8fc2b['length'];_0x242cec++){var _0x510ac6=_['find'](_0x577bad,[_0x7be2('0x69'),_0xc8fc2b[_0x242cec]['id']]);var _0x42354c={'id':_0xc8fc2b[_0x242cec]['id'],'name':_0xc8fc2b[_0x242cec]['name'],'online':Boolean(_0xc8fc2b[_0x242cec][_0x7be2('0x67')]),'paused':_0x510ac6?Boolean(_0x510ac6['paused']):![]};if(_0x42354c[_0x7be2('0x67')])_0x26d61e[_0x7be2('0x5e')]++;if(_0x42354c[_0x7be2('0x4a')])_0x26d61e[_0x7be2('0x4a')]++;_0x26d61e['agents'][_0x7be2('0x4b')](_0x42354c);}return _0x26d61e;});});}else{var _0x1dac40=_0x7be2('0x6a')+_[_0x7be2('0x3b')](_0x3c449b)+_0x7be2('0x3c');var _0x5c6e0c=_['startCase'](_0x3c449b)+'QueueId';var _0x1434f8=_0x3c449b+'Pause';return db[_0x1dac40][_0x7be2('0x6b')]({'where':{['userQueueKey']:_0x2f8e52['id']},'raw':!![]})[_0x7be2('0x19')](function(_0x5c8e18){return db[_0x7be2('0x6a')][_0x7be2('0x6b')]({'attributes':['id','name',_0x7be2('0x67'),_0x1434f8],'where':{'id':_['map'](_0x5c8e18,_0x7be2('0x69')),'role':'agent'},'raw':!![]});})['then'](function(_0x1e9f54){for(var _0x55a8b9=0x0;_0x55a8b9<_0x1e9f54[_0x7be2('0x6c')];_0x55a8b9++){var _0x5bd7ff={'id':_0x1e9f54[_0x55a8b9]['id'],'name':_0x1e9f54[_0x55a8b9][_0x7be2('0x30')],'online':Boolean(_0x1e9f54[_0x55a8b9][_0x7be2('0x67')]),'paused':Boolean(_0x1e9f54[_0x55a8b9][_0x1434f8])};if(_0x5bd7ff[_0x7be2('0x67')])_0x26d61e['loggedInDb']++;if(_0x5bd7ff['paused'])_0x26d61e['paused']++;_0x26d61e[_0x7be2('0x62')][_0x7be2('0x4b')](_0x5bd7ff);}return _0x26d61e;});}});return Promise['all'](_0x27a214);});})[_0x7be2('0x19')](function(_0x5c9b84){_0x3f6356[_0x7be2('0x5c')]=_0x5c9b84;return _0x3f6356;})[_0x7be2('0x19')](respondWithFilteredResult(_0x29f9eb,_0x442183))[_0x7be2('0x6d')](handleError(_0x29f9eb,null));}; \ No newline at end of file diff --git a/server/api/realtime/realtime.model.js b/server/api/realtime/realtime.model.js index 2099cd5..8ab3677 100644 --- a/server/api/realtime/realtime.model.js +++ b/server/api/realtime/realtime.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08de=['bluebird','request-promise','path','rimraf','../../config/environment','exports','Realtime','lodash','util','api'];(function(_0x485cd4,_0x506e1b){var _0x528199=function(_0x8472b3){while(--_0x8472b3){_0x485cd4['push'](_0x485cd4['shift']());}};_0x528199(++_0x506e1b);}(_0x08de,0x115));var _0xe08d=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0x08de[_0x10c51f];return _0x56a0cd;};'use strict';var _=require(_0xe08d('0x0'));var util=require(_0xe08d('0x1'));var logger=require('../../config/logger')(_0xe08d('0x2'));var moment=require('moment');var BPromise=require(_0xe08d('0x3'));var rp=require(_0xe08d('0x4'));var fs=require('fs');var path=require(_0xe08d('0x5'));var rimraf=require(_0xe08d('0x6'));var config=require(_0xe08d('0x7'));;module[_0xe08d('0x8')]=function(_0xb600d4,_0xb78b59){return _0xb600d4['define'](_0xe08d('0x9'),[],{});}; \ No newline at end of file +var _0x6c1f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','../../config/logger','api','moment'];(function(_0x328459,_0xc9d025){var _0x3174e1=function(_0xfa5572){while(--_0xfa5572){_0x328459['push'](_0x328459['shift']());}};_0x3174e1(++_0xc9d025);}(_0x6c1f,0x1e7));var _0xf6c1=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x6c1f[_0x56fb33];return _0x435ee4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf6c1('0x0'))(_0xf6c1('0x1'));var moment=require(_0xf6c1('0x2'));var BPromise=require(_0xf6c1('0x3'));var rp=require(_0xf6c1('0x4'));var fs=require('fs');var path=require(_0xf6c1('0x5'));var rimraf=require(_0xf6c1('0x6'));var config=require(_0xf6c1('0x7'));;module[_0xf6c1('0x8')]=function(_0x299f6a,_0x424c5c){return _0x299f6a[_0xf6c1('0x9')]('Realtime',[],{});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 7d1a9ec..cbfedb4 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xdaffc7,_0x453662){var _0x503d65=function(_0x4070fc){while(--_0x4070fc){_0xdaffc7['push'](_0xdaffc7['shift']());}};_0x503d65(++_0x453662);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x433d6a,_0x31fe15){var _0x200f9b=function(_0x239438){while(--_0x239438){_0x433d6a['push'](_0x433d6a['shift']());}};_0x200f9b(++_0x31fe15);}(_0x70e0,0x17b));var _0x070e=function(_0xa09dec,_0x569b3f){_0xa09dec=_0xa09dec-0x0;var _0x2835d5=_0x70e0[_0xa09dec];return _0x2835d5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 52dff07..239ea8d 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 _0x9b2c=['STRING','exports','INTEGER','DATE'];(function(_0x37e96a,_0x233a84){var _0x5887bb=function(_0x3daf36){while(--_0x3daf36){_0x37e96a['push'](_0x37e96a['shift']());}};_0x5887bb(++_0x233a84);}(_0x9b2c,0x189));var _0xc9b2=function(_0x2023e1,_0xeca985){_0x2023e1=_0x2023e1-0x0;var _0x1fe133=_0x9b2c[_0x2023e1];return _0x1fe133;};'use strict';var Sequelize=require('sequelize');module[_0xc9b2('0x0')]={'state':{'type':Sequelize[_0xc9b2('0x1')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xc9b2('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xc9b2('0x2')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xc9b2('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xc9b2('0x3')]},'campaigntype':{'type':Sequelize[_0xc9b2('0x3')]},'membername':{'type':Sequelize[_0xc9b2('0x3')]}}; \ No newline at end of file +var _0xb3f9=['INTEGER','STRING','sequelize','exports','DATE'];(function(_0x44f635,_0x43a4c5){var _0x1922d0=function(_0x14ec3f){while(--_0x14ec3f){_0x44f635['push'](_0x44f635['shift']());}};_0x1922d0(++_0x43a4c5);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x23c47d,_0x9dcd09){_0x23c47d=_0x23c47d-0x0;var _0x357bf6=_0xb3f9[_0x23c47d];return _0x357bf6;};'use strict';var Sequelize=require(_0x9b3f('0x0'));module[_0x9b3f('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x9b3f('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x9b3f('0x2')]},'responsetime':{'type':Sequelize[_0x9b3f('0x2')]},'ringtime':{'type':Sequelize[_0x9b3f('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x9b3f('0x4')]},'campaigntype':{'type':Sequelize[_0x9b3f('0x4')]},'membername':{'type':Sequelize[_0x9b3f('0x4')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2239165..846cd4d 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 _0xc984=['path','rimraf','./reportAgentPreview.attributes','exports','ReportAgentPreview','lodash','util','api','moment','request-promise'];(function(_0x3c8945,_0x50be2f){var _0x4538e5=function(_0x230dac){while(--_0x230dac){_0x3c8945['push'](_0x3c8945['shift']());}};_0x4538e5(++_0x50be2f);}(_0xc984,0x113));var _0x4c98=function(_0x20032e,_0x345134){_0x20032e=_0x20032e-0x0;var _0x6ce5fd=_0xc984[_0x20032e];return _0x6ce5fd;};'use strict';var _=require(_0x4c98('0x0'));var util=require(_0x4c98('0x1'));var logger=require('../../config/logger')(_0x4c98('0x2'));var moment=require(_0x4c98('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c98('0x4'));var fs=require('fs');var path=require(_0x4c98('0x5'));var rimraf=require(_0x4c98('0x6'));var config=require('../../config/environment');var attributes=require(_0x4c98('0x7'));module[_0x4c98('0x8')]=function(_0x4a2281,_0x56b7d9){return _0x4a2281['define'](_0x4c98('0x9'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4341=['report_agent_preview','lodash','util','api','moment','request-promise','path','./reportAgentPreview.attributes','exports','define'];(function(_0x18baf4,_0x33086b){var _0x278ed1=function(_0x3ea0a2){while(--_0x3ea0a2){_0x18baf4['push'](_0x18baf4['shift']());}};_0x278ed1(++_0x33086b);}(_0x4341,0x1eb));var _0x1434=function(_0x428774,_0x383962){_0x428774=_0x428774-0x0;var _0x53a01c=_0x4341[_0x428774];return _0x53a01c;};'use strict';var _=require(_0x1434('0x0'));var util=require(_0x1434('0x1'));var logger=require('../../config/logger')(_0x1434('0x2'));var moment=require(_0x1434('0x3'));var BPromise=require('bluebird');var rp=require(_0x1434('0x4'));var fs=require('fs');var path=require(_0x1434('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1434('0x6'));module[_0x1434('0x7')]=function(_0x14933d,_0x98063a){return _0x14933d[_0x1434('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x1434('0x9'),'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 621fa42..fdf28c6 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 _0xed1c=['ReportAgentPreview','create','body','options','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview'];(function(_0x4de996,_0x504bd0){var _0x257f55=function(_0xfed96){while(--_0xfed96){_0x4de996['push'](_0x4de996['shift']());}};_0x257f55(++_0x504bd0);}(_0xed1c,0xf5));var _0xced1=function(_0x3c2f15,_0x45853f){_0x3c2f15=_0x3c2f15-0x0;var _0x5500ff=_0xed1c[_0x3c2f15];return _0x5500ff;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require(_0xced1('0x2'));var BPromise=require(_0xced1('0x3'));var rs=require(_0xced1('0x4'));var fs=require('fs');var Redis=require(_0xced1('0x5'));var db=require(_0xced1('0x6'))['db'];var utils=require(_0xced1('0x7'));var logger=require(_0xced1('0x8'))(_0xced1('0x9'));var config=require('../../config/environment');var jayson=require(_0xced1('0xa'));var client=jayson[_0xced1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe18fe7,_0x9e5cb5,_0x553816){return new BPromise(function(_0xa1144f,_0x3f7f20){return client[_0xced1('0xc')](_0xe18fe7,_0x553816)['then'](function(_0x502fe1){logger[_0xced1('0xd')](_0xced1('0xe'),_0x9e5cb5,_0xced1('0xf'));logger[_0xced1('0x10')](_0xced1('0x11'),_0x9e5cb5,'request\x20sent',JSON[_0xced1('0x12')](_0x502fe1));if(_0x502fe1[_0xced1('0x13')]){if(_0x502fe1[_0xced1('0x13')][_0xced1('0x14')]===0x1f4){logger['error'](_0xced1('0xe'),_0x9e5cb5,_0x502fe1[_0xced1('0x13')][_0xced1('0x15')]);return _0x3f7f20(_0x502fe1[_0xced1('0x13')][_0xced1('0x15')]);}logger[_0xced1('0x13')](_0xced1('0xe'),_0x9e5cb5,_0x502fe1[_0xced1('0x13')][_0xced1('0x15')]);return _0xa1144f(_0x502fe1[_0xced1('0x13')][_0xced1('0x15')]);}else{logger['info'](_0xced1('0xe'),_0x9e5cb5,_0xced1('0xf'));_0xa1144f(_0x502fe1[_0xced1('0x16')][_0xced1('0x15')]);}})[_0xced1('0x17')](function(_0x53512f){logger[_0xced1('0x13')](_0xced1('0xe'),_0x9e5cb5,_0x53512f);_0x3f7f20(_0x53512f);});});}exports[_0xced1('0x18')]=function(_0x369b58){var _0x1c9dbe=this;return new Promise(function(_0x3c1893,_0x2fa3e4){return db[_0xced1('0x19')][_0xced1('0x1a')](_0x369b58[_0xced1('0x1b')],{'raw':_0x369b58[_0xced1('0x1c')]?_0x369b58['options']['raw']===undefined?!![]:![]:!![]})[_0xced1('0x1d')](function(_0x4256be){logger[_0xced1('0xd')](_0xced1('0x18'),_0x369b58);logger[_0xced1('0x10')](_0xced1('0x18'),_0x369b58,JSON[_0xced1('0x12')](_0x4256be));_0x3c1893(_0x4256be);})[_0xced1('0x17')](function(_0x200849){logger[_0xced1('0x13')](_0xced1('0x18'),_0x200849[_0xced1('0x15')],_0x369b58);_0x2fa3e4(_0x1c9dbe[_0xced1('0x13')](0x1f4,_0x200849[_0xced1('0x15')]));});});}; \ No newline at end of file +var _0x54a7=['debug','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','catch','ReportAgentPreview','create','options','raw','then','CreateReportAgentPreview'];(function(_0x545a9a,_0x401162){var _0x1d88d3=function(_0x1ae6aa){while(--_0x1ae6aa){_0x545a9a['push'](_0x545a9a['shift']());}};_0x1d88d3(++_0x401162);}(_0x54a7,0xe9));var _0x754a=function(_0x4d8b4b,_0x596011){_0x4d8b4b=_0x4d8b4b-0x0;var _0x1b4196=_0x54a7[_0x4d8b4b];return _0x1b4196;};'use strict';var _=require(_0x754a('0x0'));var util=require(_0x754a('0x1'));var moment=require(_0x754a('0x2'));var BPromise=require('bluebird');var rs=require(_0x754a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x754a('0x4'))['db'];var utils=require(_0x754a('0x5'));var logger=require(_0x754a('0x6'))(_0x754a('0x7'));var config=require(_0x754a('0x8'));var jayson=require(_0x754a('0x9'));var client=jayson[_0x754a('0xa')][_0x754a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x232644,_0x3913e7,_0x407ec8){return new BPromise(function(_0xeddcc2,_0x409c66){return client[_0x754a('0xc')](_0x232644,_0x407ec8)['then'](function(_0x3295bc){logger[_0x754a('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x3913e7,_0x754a('0xe'));logger['debug'](_0x754a('0xf'),_0x3913e7,_0x754a('0xe'),JSON[_0x754a('0x10')](_0x3295bc));if(_0x3295bc[_0x754a('0x11')]){if(_0x3295bc[_0x754a('0x11')][_0x754a('0x12')]===0x1f4){logger[_0x754a('0x11')](_0x754a('0x13'),_0x3913e7,_0x3295bc[_0x754a('0x11')][_0x754a('0x14')]);return _0x409c66(_0x3295bc[_0x754a('0x11')][_0x754a('0x14')]);}logger['error'](_0x754a('0x13'),_0x3913e7,_0x3295bc[_0x754a('0x11')][_0x754a('0x14')]);return _0xeddcc2(_0x3295bc[_0x754a('0x11')][_0x754a('0x14')]);}else{logger['info'](_0x754a('0x13'),_0x3913e7,_0x754a('0xe'));_0xeddcc2(_0x3295bc['result']['message']);}})[_0x754a('0x15')](function(_0x20845c){logger['error'](_0x754a('0x13'),_0x3913e7,_0x20845c);_0x409c66(_0x20845c);});});}exports['CreateReportAgentPreview']=function(_0x566c15){var _0x553180=this;return new Promise(function(_0x4fcc33,_0x32e614){return db[_0x754a('0x16')][_0x754a('0x17')](_0x566c15['body'],{'raw':_0x566c15[_0x754a('0x18')]?_0x566c15[_0x754a('0x18')][_0x754a('0x19')]===undefined?!![]:![]:!![]})[_0x754a('0x1a')](function(_0xbf5e81){logger[_0x754a('0xd')](_0x754a('0x1b'),_0x566c15);logger[_0x754a('0x1c')](_0x754a('0x1b'),_0x566c15,JSON[_0x754a('0x10')](_0xbf5e81));_0x4fcc33(_0xbf5e81);})[_0x754a('0x15')](function(_0x38ffa2){logger['error'](_0x754a('0x1b'),_0x38ffa2[_0x754a('0x14')],_0x566c15);_0x32e614(_0x553180[_0x754a('0x11')](0x1f4,_0x38ffa2[_0x754a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 057b6bc..3fc2b68 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 _0x3124=['util','path','express','Router','./rpc.controller','/voice/channels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','campaigns','/fax/accounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports'];(function(_0x9126db,_0x1c65d5){var _0x44b7cd=function(_0x43908c){while(--_0x43908c){_0x9126db['push'](_0x9126db['shift']());}};_0x44b7cd(++_0x1c65d5);}(_0x3124,0xa6));var _0x4312=function(_0x198da7,_0x4d9fca){_0x198da7=_0x198da7-0x0;var _0x1accf1=_0x3124[_0x198da7];return _0x1accf1;};'use strict';var multer=require('multer');var util=require(_0x4312('0x0'));var path=require(_0x4312('0x1'));var express=require(_0x4312('0x2'));var router=express[_0x4312('0x3')]();var auth=require('../../components/auth/service');var controller=require(_0x4312('0x4'));router['get'](_0x4312('0x5'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x4312('0x6')](_0x4312('0x7'),auth[_0x4312('0x8')](),controller[_0x4312('0x9')]);router[_0x4312('0x6')](_0x4312('0xa'),auth['isAuthenticated'](),controller[_0x4312('0xb')]);router[_0x4312('0x6')](_0x4312('0xc'),auth['isAuthenticated'](),controller[_0x4312('0xd')]);router['get'](_0x4312('0xe'),auth[_0x4312('0x8')](),controller[_0x4312('0xf')]);router[_0x4312('0x6')](_0x4312('0x10'),auth[_0x4312('0x8')](),controller[_0x4312('0x11')]);router['get'](_0x4312('0x12'),auth[_0x4312('0x8')](),controller['mailAccounts']);router[_0x4312('0x6')](_0x4312('0x13'),auth[_0x4312('0x8')](),controller[_0x4312('0x14')]);router[_0x4312('0x6')]('/sms/queues',auth[_0x4312('0x8')](),controller[_0x4312('0x15')]);router[_0x4312('0x6')](_0x4312('0x16'),auth[_0x4312('0x8')](),controller[_0x4312('0x17')]);router[_0x4312('0x6')](_0x4312('0x18'),auth[_0x4312('0x8')](),controller['faxQueues']);router[_0x4312('0x6')]('/voice/queues/preview/:id',auth[_0x4312('0x8')](),controller[_0x4312('0x19')]);router[_0x4312('0x6')](_0x4312('0x1a'),auth[_0x4312('0x8')](),controller[_0x4312('0x1b')]);router[_0x4312('0x6')](_0x4312('0x1c'),auth[_0x4312('0x8')](),controller['voiceQueuesChannel']);router['get'](_0x4312('0x1d'),auth[_0x4312('0x8')](),controller[_0x4312('0x1e')]);router[_0x4312('0x6')](_0x4312('0x1f'),auth[_0x4312('0x8')](),controller[_0x4312('0x20')]);router['get'](_0x4312('0x21'),auth[_0x4312('0x8')](),controller[_0x4312('0x22')]);router[_0x4312('0x23')](_0x4312('0x21'),auth[_0x4312('0x8')](),controller[_0x4312('0x24')]);router[_0x4312('0x6')](_0x4312('0x25'),auth[_0x4312('0x8')](),controller[_0x4312('0x26')]);router[_0x4312('0x6')](_0x4312('0x27'),auth[_0x4312('0x8')](),controller['outboundChannels']);router[_0x4312('0x6')](_0x4312('0x28'),auth['isAuthenticated'](),controller[_0x4312('0x29')]);router[_0x4312('0x23')](_0x4312('0x2a'),auth[_0x4312('0x8')](),controller[_0x4312('0x2b')]);router[_0x4312('0x6')]('/telephones',auth[_0x4312('0x8')](),controller[_0x4312('0x2c')]);router['get'](_0x4312('0x2d'),auth[_0x4312('0x8')](),controller['trunks']);router['get']('/campaigns',auth['isAuthenticated'](),controller[_0x4312('0x2e')]);router[_0x4312('0x6')](_0x4312('0x2f'),auth[_0x4312('0x8')](),controller['faxAccounts']);router[_0x4312('0x6')]('/chat/queues/waitinginteractions',auth[_0x4312('0x8')](),controller[_0x4312('0x30')]);router[_0x4312('0x6')](_0x4312('0x31'),auth[_0x4312('0x8')](),controller[_0x4312('0x32')]);router['get'](_0x4312('0x33'),auth[_0x4312('0x8')](),controller[_0x4312('0x34')]);router[_0x4312('0x6')](_0x4312('0x35'),auth['isAuthenticated'](),controller[_0x4312('0x36')]);router[_0x4312('0x6')](_0x4312('0x37'),auth['isAuthenticated'](),controller[_0x4312('0x38')]);router[_0x4312('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0x4312('0x8')](),controller['whatsappQueuesWaitingInteractions']);router[_0x4312('0x6')](_0x4312('0x39'),auth[_0x4312('0x8')](),controller[_0x4312('0x3a')]);router[_0x4312('0x3b')](_0x4312('0x3c'),auth[_0x4312('0x8')](),controller[_0x4312('0x3d')](_0x4312('0x3e')));router[_0x4312('0x6')]('/mail/queues/:id',auth[_0x4312('0x8')](),controller[_0x4312('0x3f')]);router[_0x4312('0x3b')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x4312('0x3d')](_0x4312('0x40')));router[_0x4312('0x6')](_0x4312('0x41'),auth[_0x4312('0x8')](),controller[_0x4312('0x42')]);router['post'](_0x4312('0x43'),auth[_0x4312('0x8')](),controller[_0x4312('0x3d')](_0x4312('0x44')));router[_0x4312('0x6')](_0x4312('0x45'),auth[_0x4312('0x8')](),controller[_0x4312('0x46')]);router['post'](_0x4312('0x47'),auth['isAuthenticated'](),controller['queueNotify'](_0x4312('0x48')));router[_0x4312('0x6')]('/openchannel/queues/:id',auth[_0x4312('0x8')](),controller['showOpenchannelQueues']);router[_0x4312('0x3b')](_0x4312('0x49'),auth[_0x4312('0x8')](),controller['queueNotify'](_0x4312('0x4a')));router[_0x4312('0x3b')](_0x4312('0x4b'),auth[_0x4312('0x8')](),controller['queueNotify']('whatsapp'));router[_0x4312('0x6')](_0x4312('0x4c'),auth[_0x4312('0x8')](),controller[_0x4312('0x4d')]);router['get'](_0x4312('0x4e'),auth[_0x4312('0x8')](),controller[_0x4312('0x4f')]);router[_0x4312('0x3b')](_0x4312('0x50'),auth['isAuthenticated'](),controller[_0x4312('0x51')]);module[_0x4312('0x52')]=router; \ No newline at end of file +var _0x1c19=['/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','get','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/agents','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels'];(function(_0x2f8911,_0x4a44e2){var _0x282e5a=function(_0x5871f3){while(--_0x5871f3){_0x2f8911['push'](_0x2f8911['shift']());}};_0x282e5a(++_0x4a44e2);}(_0x1c19,0x134));var _0x91c1=function(_0x4de9e8,_0x565ffa){_0x4de9e8=_0x4de9e8-0x0;var _0x4db0de=_0x1c19[_0x4de9e8];return _0x4db0de;};'use strict';var multer=require('multer');var util=require(_0x91c1('0x0'));var path=require(_0x91c1('0x1'));var express=require(_0x91c1('0x2'));var router=express[_0x91c1('0x3')]();var auth=require(_0x91c1('0x4'));var controller=require(_0x91c1('0x5'));router['get']('/voice/channels',auth[_0x91c1('0x6')](),controller[_0x91c1('0x7')]);router['get'](_0x91c1('0x8'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x9')]);router[_0x91c1('0xa')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x91c1('0xb')]);router[_0x91c1('0xa')](_0x91c1('0xc'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0x91c1('0xd'),auth['isAuthenticated'](),controller[_0x91c1('0xe')]);router['get']('/mail/queues',auth[_0x91c1('0x6')](),controller[_0x91c1('0xf')]);router[_0x91c1('0xa')](_0x91c1('0x10'),auth['isAuthenticated'](),controller[_0x91c1('0x11')]);router[_0x91c1('0xa')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x91c1('0x12')]);router[_0x91c1('0xa')](_0x91c1('0x13'),auth[_0x91c1('0x6')](),controller['smsQueues']);router[_0x91c1('0xa')](_0x91c1('0x14'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x15')]);router['get'](_0x91c1('0x16'),auth[_0x91c1('0x6')](),controller['faxQueues']);router[_0x91c1('0xa')](_0x91c1('0x17'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x18')]);router[_0x91c1('0xa')](_0x91c1('0x19'),auth[_0x91c1('0x6')](),controller['voiceQueuesChannels']);router[_0x91c1('0xa')]('/voice/queues/channels/:uniqueid',auth[_0x91c1('0x6')](),controller[_0x91c1('0x1a')]);router[_0x91c1('0xa')](_0x91c1('0x1b'),auth[_0x91c1('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x91c1('0xa')](_0x91c1('0x1c'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x1d')]);router['get']('/voice/queues/:id',auth[_0x91c1('0x6')](),controller[_0x91c1('0x1e')]);router['put'](_0x91c1('0x1f'),auth['isAuthenticated'](),controller[_0x91c1('0x20')]);router[_0x91c1('0xa')](_0x91c1('0x21'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x22')]);router[_0x91c1('0xa')]('/outbound/channels',auth[_0x91c1('0x6')](),controller['outboundChannels']);router[_0x91c1('0xa')](_0x91c1('0x23'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x24')]);router[_0x91c1('0x25')](_0x91c1('0x26'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x27')]);router['get']('/telephones',auth[_0x91c1('0x6')](),controller[_0x91c1('0x28')]);router[_0x91c1('0xa')](_0x91c1('0x29'),auth[_0x91c1('0x6')](),controller['trunks']);router[_0x91c1('0xa')](_0x91c1('0x2a'),auth['isAuthenticated'](),controller['campaigns']);router['get'](_0x91c1('0x2b'),auth['isAuthenticated'](),controller[_0x91c1('0x2c')]);router[_0x91c1('0xa')](_0x91c1('0x2d'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x2e')]);router[_0x91c1('0xa')]('/mail/queues/waitinginteractions',auth[_0x91c1('0x6')](),controller['mailQueuesWaitingInteractions']);router['get'](_0x91c1('0x2f'),auth[_0x91c1('0x6')](),controller['openchannelQueuesWaitingInteractions']);router['get']('/openchannel/queues/:id/waitinginteractions',auth[_0x91c1('0x6')](),controller[_0x91c1('0x30')]);router[_0x91c1('0xa')](_0x91c1('0x31'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x32')]);router[_0x91c1('0xa')](_0x91c1('0x33'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x34')]);router[_0x91c1('0xa')](_0x91c1('0x35'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x36')]);router[_0x91c1('0x37')](_0x91c1('0x38'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x39')](_0x91c1('0x3a')));router[_0x91c1('0xa')](_0x91c1('0x3b'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x3c')]);router[_0x91c1('0x37')]('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x91c1('0x39')]('chat'));router[_0x91c1('0xa')](_0x91c1('0x3d'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x3e')]);router['post'](_0x91c1('0x3f'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x39')](_0x91c1('0x40')));router['get']('/fax/queues/:id',auth[_0x91c1('0x6')](),controller[_0x91c1('0x41')]);router[_0x91c1('0x37')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x91c1('0x39')](_0x91c1('0x42')));router[_0x91c1('0xa')](_0x91c1('0x43'),auth['isAuthenticated'](),controller[_0x91c1('0x44')]);router[_0x91c1('0x37')](_0x91c1('0x45'),auth[_0x91c1('0x6')](),controller['queueNotify'](_0x91c1('0x46')));router[_0x91c1('0x37')](_0x91c1('0x47'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x39')](_0x91c1('0x48')));router[_0x91c1('0xa')](_0x91c1('0x49'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x4a')]);router[_0x91c1('0xa')](_0x91c1('0x4b'),auth[_0x91c1('0x6')](),controller[_0x91c1('0x4c')]);router[_0x91c1('0x37')](_0x91c1('0x4d'),auth[_0x91c1('0x6')](),controller['agentNotify']);module[_0x91c1('0x4e')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index d5c0b5c..260441c 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 _0xeff8=['error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','findAll','INTERACTION','format','length','updateAttributes','interface','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','Interaction','\x20Message\x20not\x20found','MessageId','From','QueueId','TransferReport','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','messageId','update','InteractionId','create','agentTransferTimeout','bluebird','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xeff8,0x186));var _0x8eff=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xeff8[_0x1b828b];return _0x98da1a;};'use strict';var BPromise=require(_0x8eff('0x0'));var moment=require(_0x8eff('0x1'));var _=require('lodash');var util=require(_0x8eff('0x2'));var db=require(_0x8eff('0x3'))['db'];var logger=require(_0x8eff('0x4'))('api');var jayson=require(_0x8eff('0x5'));var amiClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232a});var mailClient=jayson[_0x8eff('0x6')]['http']({'port':0x232b});var routingClient=jayson[_0x8eff('0x6')][_0x8eff('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x3409bc,_0x323b2,_0x491f01){return new BPromise(function(_0x3fb9ee,_0x19557f){var _0x17f22b=_0x491f01?_0x491f01:amiClient;return _0x17f22b[_0x8eff('0x8')](_0x3409bc,_0x323b2)['then'](function(_0x56f120){if(_0x56f120[_0x8eff('0x9')]){if(_0x56f120[_0x8eff('0x9')][_0x8eff('0xa')]===0x1f4){return _0x19557f(_0x56f120['error'][_0x8eff('0xb')]);}return _0x3fb9ee(_0x56f120[_0x8eff('0x9')]['message']);}else{_0x3fb9ee(_0x56f120[_0x8eff('0xc')]);}})[_0x8eff('0xd')](function(_0x559143){_0x19557f(_0x559143);});});}function respondWithResult(_0x4a399e,_0x45f280){_0x45f280=_0x45f280||0xc8;return function(_0x43c914){if(_0x43c914){return _0x4a399e[_0x8eff('0xe')](_0x45f280)[_0x8eff('0xf')](_0x43c914);}return _0x4a399e[_0x8eff('0x10')](0x194);};}function handleError(_0x56efdf,_0x3e7c01){_0x3e7c01=_0x3e7c01||0x1f4;return function(_0x212a2e){logger[_0x8eff('0x9')](_0x212a2e[_0x8eff('0x11')]);if(_0x212a2e[_0x8eff('0x12')]){delete _0x212a2e[_0x8eff('0x12')];}_0x56efdf[_0x8eff('0xe')](_0x3e7c01)[_0x8eff('0x13')](_0x212a2e);};}function findById(_0x16a4eb){return function(_0x427902){if(!_[_0x8eff('0x14')](_0x16a4eb)&&!_['isNil'](_0x427902)&&!_[_0x8eff('0x14')](_0x427902[_0x8eff('0x15')])){return _[_0x8eff('0x16')](_0x427902[_0x8eff('0x15')],function(_0x2cd7c5){return _0x2cd7c5['id']==_0x16a4eb;});}return null;};}exports[_0x8eff('0x17')]=function(_0x38f5ee,_0x399d96){return respondWithRpcPromise(_0x8eff('0x18'),_0x38f5ee[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x399d96,null))[_0x8eff('0xd')](handleError(_0x399d96,null));};exports[_0x8eff('0x1b')]=function(_0x2a7337,_0xdbb7b5){return respondWithRpcPromise(_0x8eff('0x1c'),_['merge'](_0x2a7337[_0x8eff('0x19')],_0x2a7337[_0x8eff('0x1d')]))['then'](respondWithResult(_0xdbb7b5,null))[_0x8eff('0xd')](handleError(_0xdbb7b5,null));};exports['voiceChannelStopMixMonitor']=function(_0x2fe360,_0x23c030){return respondWithRpcPromise(_0x8eff('0x1e'),_[_0x8eff('0x1f')](_0x2fe360[_0x8eff('0x19')],_0x2fe360['params']))[_0x8eff('0x1a')](respondWithResult(_0x23c030,null))[_0x8eff('0xd')](handleError(_0x23c030,null));};exports['voiceQueues']=function(_0x15b66f,_0x5ec3d7){return respondWithRpcPromise(_0x8eff('0x20'),_0x15b66f[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x5ec3d7,null))[_0x8eff('0xd')](handleError(_0x5ec3d7,null));};exports[_0x8eff('0x21')]=function(_0x2e8067,_0x516173){return respondWithRpcPromise(_0x8eff('0x20'),_0x2e8067[_0x8eff('0x19')])[_0x8eff('0x1a')](findById(_0x2e8067[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x516173,null))[_0x8eff('0xd')](handleError(_0x516173,null));};exports['updateVoiceQueue']=function(_0x4ed3b8,_0x44dcdb){return respondWithRpcPromise(_0x8eff('0x22'),_[_0x8eff('0x1f')](_0x4ed3b8['body'],_0x4ed3b8[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x44dcdb,null))[_0x8eff('0xd')](handleError(_0x44dcdb,null));};exports[_0x8eff('0x23')]=function(_0x25b98e,_0x2c5727){return respondWithRpcPromise(_0x8eff('0x24'),_[_0x8eff('0x1f')](_0x25b98e[_0x8eff('0x19')],_0x25b98e[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x2c5727,null))[_0x8eff('0xd')](handleError(_0x2c5727,null));};exports['voiceQueuesChannels']=function(_0x2ad4b7,_0x165f8e){return respondWithRpcPromise(_0x8eff('0x25'),_0x2ad4b7[_0x8eff('0x19')])['then'](respondWithResult(_0x165f8e,null))[_0x8eff('0xd')](handleError(_0x165f8e,null));};exports[_0x8eff('0x26')]=function(_0x4c4220,_0x4e1256){return respondWithRpcPromise(_0x8eff('0x27'),_[_0x8eff('0x1f')](_0x4c4220['query'],_0x4c4220['params']))['then'](respondWithResult(_0x4e1256,null))[_0x8eff('0xd')](handleError(_0x4e1256,null));};exports['voiceQueuesChannelHangup']=function(_0x45d9d4,_0x59c9cc){return respondWithRpcPromise(_0x8eff('0x28'),_[_0x8eff('0x1f')](_0x45d9d4[_0x8eff('0x19')],_0x45d9d4[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x59c9cc,null))[_0x8eff('0xd')](handleError(_0x59c9cc,null));};exports['voiceQueuesChannelRedirect']=function(_0xd95908,_0x5907e0){return respondWithRpcPromise(_0x8eff('0x29'),_['merge'](_0xd95908[_0x8eff('0x19')],_0xd95908[_0x8eff('0x1d')]))[_0x8eff('0x1a')](respondWithResult(_0x5907e0,null))[_0x8eff('0xd')](handleError(_0x5907e0,null));};exports['outbound']=function(_0x2eb4bb,_0x170a33){return respondWithRpcPromise(_0x8eff('0x2a'),_0x2eb4bb['query'])[_0x8eff('0x1a')](respondWithResult(_0x170a33,null))[_0x8eff('0xd')](handleError(_0x170a33,null));};exports[_0x8eff('0x2b')]=function(_0x345bc7,_0x721c71){return respondWithRpcPromise(_0x8eff('0x2c'),_0x345bc7[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x721c71,null))[_0x8eff('0xd')](handleError(_0x721c71,null));};exports['agents']=function(_0x54a2d9,_0xf67cf3){var _0x114f8e;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9[_0x8eff('0x19')])[_0x8eff('0x1a')](function(_0x1ba78a){_0x114f8e=_0x1ba78a;return respondWithRpcPromise(_0x8eff('0x2d'),_0x54a2d9['query'],routingClient);})[_0x8eff('0x1a')](function(_0x1c7332){return _['merge']({},_0x1c7332,_0x114f8e);})[_0x8eff('0x1a')](respondWithResult(_0xf67cf3,null))[_0x8eff('0xd')](handleError(_0xf67cf3,null));};exports[_0x8eff('0x2e')]=function(_0x18309b,_0xdc5e2f){if(_0x18309b[_0x8eff('0x2f')]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]&&_0x18309b[_0x8eff('0x31')]&&_0x18309b['user'][_0x8eff('0x12')]){for(var _0x27a8c9 in _0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')]){if(_0x18309b[_0x8eff('0x2f')]['interaction'][_0x8eff('0x32')](_0x27a8c9)){db['MemberReport'][_0x8eff('0x33')]({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'exitAt':null,'uniqueid':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]&&_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9]['length']?{'$notIn':_0x18309b['body'][_0x8eff('0x30')][_0x27a8c9]}:{'$ne':null}}})[_0x8eff('0x1a')](function(_0x3bf913){var _0x22f173=moment()[_0x8eff('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x28cb8e=0x0,_0x51aa5d=_0x3bf913[_0x8eff('0x36')];_0x28cb8e<_0x51aa5d;_0x28cb8e+=0x1){_0x3bf913[_0x28cb8e][_0x8eff('0x37')]({'exitAt':_0x22f173});}});for(var _0x577a2b=0x0;_0x577a2b<_0x18309b['body']['interaction'][_0x27a8c9]['length'];_0x577a2b+=0x1){db['MemberReport']['findOrCreate']({'where':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'type':_0x8eff('0x34'),'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b],'exitAt':null},'defaults':{'channel':_0x27a8c9,'membername':_0x18309b[_0x8eff('0x31')][_0x8eff('0x12')],'interface':_[_0x8eff('0x14')](_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')])?util['format'](_0x8eff('0x39'),_0x18309b['user'][_0x8eff('0x12')]):_0x18309b[_0x8eff('0x31')][_0x8eff('0x38')],'type':_0x8eff('0x34'),'enterAt':moment()[_0x8eff('0x35')](_0x8eff('0x3a')),'role':_0x8eff('0x3b'),'internal':_0x18309b[_0x8eff('0x31')][_0x8eff('0x3c')],'uniqueid':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x30')][_0x27a8c9][_0x577a2b]}});}}}}return respondWithRpcPromise(_0x8eff('0x3d'),{'id':_0x18309b['params']['id'],'capacity':_0x18309b[_0x8eff('0x2f')][_0x8eff('0x3e')]},routingClient)[_0x8eff('0x1a')](respondWithResult(_0xdc5e2f,null))[_0x8eff('0xd')](handleError(_0xdc5e2f,null));};exports[_0x8eff('0x3f')]=function(_0x2de7fd,_0x16473d){return respondWithRpcPromise(_0x8eff('0x40'),_0x2de7fd[_0x8eff('0x19')])['then'](respondWithResult(_0x16473d,null))['catch'](handleError(_0x16473d,null));};exports[_0x8eff('0x41')]=function(_0x36e2fd,_0x430f5e){return respondWithRpcPromise(_0x8eff('0x42'),_0x36e2fd[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x430f5e,null))['catch'](handleError(_0x430f5e,null));};exports[_0x8eff('0x43')]=function(_0x1ca203,_0x1d0a8e){return respondWithRpcPromise('Campaigns',_0x1ca203[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x1d0a8e,null))[_0x8eff('0xd')](handleError(_0x1d0a8e,null));};exports[_0x8eff('0x44')]=function(_0x549e88,_0x40de1d){return respondWithRpcPromise(_0x8eff('0x45'),_0x549e88[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x40de1d,null))[_0x8eff('0xd')](handleError(_0x40de1d,null));};exports[_0x8eff('0x46')]=function(_0x3f646d,_0x575b0e){return respondWithRpcPromise(_0x8eff('0x45'),_0x3f646d[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x3f646d[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x575b0e,null))['catch'](handleError(_0x575b0e,null));};exports[_0x8eff('0x47')]=function(_0x16b968,_0x5d79b){return respondWithRpcPromise('MailQueues',_0x16b968[_0x8eff('0x19')],routingClient)['then'](respondWithResult(_0x5d79b,null))[_0x8eff('0xd')](handleError(_0x5d79b,null));};exports[_0x8eff('0x48')]=function(_0x23ed92,_0xfecdd8){return respondWithRpcPromise(_0x8eff('0x49'),_0x23ed92[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x23ed92['params']['id']))['then'](respondWithResult(_0xfecdd8,null))[_0x8eff('0xd')](handleError(_0xfecdd8,null));};exports['mailAccounts']=function(_0x3bfeac,_0x375ed3){return respondWithRpcPromise(_0x8eff('0x4a'),_0x3bfeac[_0x8eff('0x19')],mailClient)[_0x8eff('0x1a')](respondWithResult(_0x375ed3,null))['catch'](handleError(_0x375ed3,null));};exports[_0x8eff('0x4b')]=function(_0x36afc3,_0x1813df){return respondWithRpcPromise(_0x8eff('0x4c'),_0x36afc3[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1813df,null))['catch'](handleError(_0x1813df,null));};exports[_0x8eff('0x4d')]=function(_0x5c0ea3,_0x2e45c2){return respondWithRpcPromise(_0x8eff('0x4c'),_0x5c0ea3['query'],routingClient)[_0x8eff('0x1a')](findById(_0x5c0ea3[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x2e45c2,null))[_0x8eff('0xd')](handleError(_0x2e45c2,null));};exports[_0x8eff('0x4e')]=function(_0x35467c,_0xabdd84){return respondWithRpcPromise(_0x8eff('0x4f'),_0x35467c['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xabdd84,null))['catch'](handleError(_0xabdd84,null));};exports['showSmsQueues']=function(_0x1a748f,_0x47626e){return respondWithRpcPromise('SmsQueues',_0x1a748f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x1a748f['params']['id']))[_0x8eff('0x1a')](respondWithResult(_0x47626e,null))[_0x8eff('0xd')](handleError(_0x47626e,null));};exports['whatsappQueues']=function(_0xc70ecc,_0x1c6ee1){return respondWithRpcPromise(_0x8eff('0x50'),_0xc70ecc[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1c6ee1,null))[_0x8eff('0xd')](handleError(_0x1c6ee1,null));};exports[_0x8eff('0x51')]=function(_0x58c9e6,_0x479a4b){return respondWithRpcPromise(_0x8eff('0x50'),_0x58c9e6[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x58c9e6[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x479a4b,null))[_0x8eff('0xd')](handleError(_0x479a4b,null));};exports[_0x8eff('0x52')]=function(_0x4f1c54,_0x593a18){return respondWithRpcPromise(_0x8eff('0x53'),_0x4f1c54['query'],routingClient)['then'](respondWithResult(_0x593a18,null))['catch'](handleError(_0x593a18,null));};exports[_0x8eff('0x54')]=function(_0x436db2,_0x461026){return respondWithRpcPromise(_0x8eff('0x53'),_0x436db2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](findById(_0x436db2[_0x8eff('0x1d')]['id']))[_0x8eff('0x1a')](respondWithResult(_0x461026,null))['catch'](handleError(_0x461026,null));};exports[_0x8eff('0x55')]=function(_0x5492df,_0x42efc6){return respondWithRpcPromise(_0x8eff('0x56'),_0x5492df[_0x8eff('0x19')])[_0x8eff('0x1a')](respondWithResult(_0x42efc6,null))[_0x8eff('0xd')](handleError(_0x42efc6,null));};exports[_0x8eff('0x57')]=function(_0x570728,_0x3db0d8){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x570728[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x3db0d8,null))[_0x8eff('0xd')](handleError(_0x3db0d8,null));};exports[_0x8eff('0x58')]=function(_0x41d7e2,_0x2f30cb){return respondWithRpcPromise(_0x8eff('0x59'),_0x41d7e2[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x2f30cb,null))['catch'](handleError(_0x2f30cb,null));};exports[_0x8eff('0x5a')]=function(_0x73b49f,_0x1299b5){return respondWithRpcPromise(_0x8eff('0x5b'),_0x73b49f[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x1299b5,null))[_0x8eff('0xd')](handleError(_0x1299b5,null));};exports[_0x8eff('0x5c')]=function(_0x3350b8,_0x123673){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x3350b8['query'],routingClient)['then'](function(_0x5f3443){if(_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')]!==undefined){var _0x2a15ba=_(_0x5f3443[_0x8eff('0x15')])[_0x8eff('0x5e')]([_0x3350b8[_0x8eff('0x19')][_0x8eff('0x5d')],_0x3350b8['params']['id']])[_0x8eff('0x5f')](_0x8eff('0x60'))[_0x8eff('0x61')]()[_0x8eff('0x62')]();return _0x5f3443['rows'][_0x8eff('0x5e')](function(_0x34ca22){return _0x2a15ba['indexOf'](_0x34ca22[_0x8eff('0x60')])>-0x1;});}else{return _0x5f3443[_0x8eff('0x15')][_0x8eff('0x5e')](function(_0x47e24f){return _0x47e24f['queue_id']===parseInt(_0x3350b8['params']['id']);});}})[_0x8eff('0x1a')](respondWithResult(_0x123673,null))[_0x8eff('0xd')](handleError(_0x123673,null));};exports[_0x8eff('0x63')]=function(_0x168465,_0xaca1b5){return respondWithRpcPromise(_0x8eff('0x64'),_0x168465[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0xaca1b5,null))[_0x8eff('0xd')](handleError(_0xaca1b5,null));};exports[_0x8eff('0x65')]=function(_0x4272e8,_0x5c8a83){return respondWithRpcPromise(_0x8eff('0x66'),_0x4272e8['query'],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x5c8a83,null))[_0x8eff('0xd')](handleError(_0x5c8a83,null));};exports['faxQueuesWaitingInteractions']=function(_0x9c448b,_0x536b6f){return respondWithRpcPromise(_0x8eff('0x67'),_0x9c448b[_0x8eff('0x19')],routingClient)[_0x8eff('0x1a')](respondWithResult(_0x536b6f,null))[_0x8eff('0xd')](handleError(_0x536b6f,null));};exports[_0x8eff('0x68')]=function(_0x4a4603){return function(_0x842ad7,_0x56fd7d){var _0xd5edc5,_0x19768b;var _0x30c321=_[_0x8eff('0x69')](_0x4a4603);var _0x52be06=_0x4a4603===_0x8eff('0x6a')?_0x8eff('0x6b'):_0x8eff('0x6c');return db[_0x30c321+_0x8eff('0x6d')]['findOne']({'raw':!![],'where':{'id':_0x842ad7[_0x8eff('0x1d')]['id']}})[_0x8eff('0x1a')](function(_0x10e26f){if(_[_0x8eff('0x14')](_0x10e26f)){throw new Error(_0x30c321+_0x8eff('0x6e'));}_0xd5edc5=_0x10e26f;return db[_0x30c321+'Message'][_0x8eff('0x6f')]({'where':{'id':_0x842ad7[_0x8eff('0x2f')]['messageId']},'include':[{'model':db[_0x30c321+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x30c321+_0x52be06],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0xe31924){if(_[_0x8eff('0x14')](_0xe31924)){throw new Error(_0x30c321+_0x8eff('0x71'));}_0x19768b=_0xe31924;return _0xe31924['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x522e5f={'uniqueid':_0x4a4603+'.'+_0x19768b['id']+'.'+_0x19768b[_0x8eff('0x70')]['id'],'FromUserId':_0x842ad7[_0x8eff('0x31')]['id'],'type':'queue'};_0x522e5f[_0x30c321+_0x8eff('0x72')]=_0x19768b['id'];_0x522e5f[_0x30c321+'InteractionId']=_0x19768b['Interaction']['id'];_0x522e5f[_0x8eff('0x73')+_0x30c321+_0x52be06+'Id']=_0x19768b['Account']['id'];_0x522e5f['To'+_0x30c321+_0x8eff('0x74')]=_0xd5edc5['id'];return db[_0x30c321+_0x8eff('0x75')]['create'](_0x522e5f);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x4a4603,'interaction':_0x19768b['Interaction'],'message':_0x19768b,'account':_0x19768b[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x77'),'appdata':_0xd5edc5[_0x8eff('0x12')]+','+(_0x19768b[_0x8eff('0x6c')][_0x8eff('0x78')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x56fd7d,null))[_0x8eff('0xd')](handleError(_0x56fd7d,null));};};exports[_0x8eff('0x7a')]=function(_0x4aa16e,_0x4f7209){var _0x4c9436,_0x338269;if(_[_0x8eff('0x14')](_0x4aa16e[_0x8eff('0x2f')]['channel'])){throw new Error(_0x8eff('0x7b'));}var _0x35cf4c=_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x7c')];var _0x2c9646=_[_0x8eff('0x69')](_0x35cf4c);var _0x5ee248=_0x35cf4c===_0x8eff('0x6a')?'Website':_0x8eff('0x6c');return db[_0x8eff('0x7d')][_0x8eff('0x6f')]({'raw':!![],'where':{'id':_0x4aa16e[_0x8eff('0x1d')]['id'],'role':_0x8eff('0x3b')}})[_0x8eff('0x1a')](function(_0x476701){if(_['isNil'](_0x476701)){throw new Error(_0x8eff('0x7e'));}_0x4c9436=_0x476701;return db[_0x2c9646+_0x8eff('0x7f')][_0x8eff('0x6f')]({'where':{'id':_0x4aa16e[_0x8eff('0x2f')][_0x8eff('0x80')]},'include':[{'model':db[_0x2c9646+'Interaction'],'as':_0x8eff('0x70')},{'model':db[_0x2c9646+_0x5ee248],'as':_0x8eff('0x6c')}]});})[_0x8eff('0x1a')](function(_0x488a69){if(_['isNil'](_0x488a69)){throw new Error(_0x2c9646+_0x8eff('0x71'));}_0x338269=_0x488a69;return _0x488a69[_0x8eff('0x81')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8eff('0x1a')](function(){var _0x58db46={'uniqueid':_0x35cf4c+'.'+_0x338269['id']+'.'+_0x338269[_0x8eff('0x70')]['id'],'FromUserId':_0x4aa16e['user']['id'],'type':'queue','ToUserId':_0x4c9436['id']};_0x58db46[_0x2c9646+_0x8eff('0x72')]=_0x338269['id'];_0x58db46[_0x2c9646+_0x8eff('0x82')]=_0x338269[_0x8eff('0x70')]['id'];_0x58db46[_0x8eff('0x73')+_0x2c9646+_0x5ee248+'Id']=_0x338269[_0x8eff('0x6c')]['id'];return db[_0x2c9646+_0x8eff('0x75')][_0x8eff('0x83')](_0x58db46);})[_0x8eff('0x1a')](function(){return respondWithRpcPromise(_0x8eff('0x76'),{'channel':_0x35cf4c,'interaction':_0x338269[_0x8eff('0x70')],'message':_0x338269,'account':_0x338269[_0x8eff('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8eff('0x3b'),'appdata':_0x4c9436['name']+','+(_0x338269[_0x8eff('0x6c')][_0x8eff('0x84')]||0x12c),'interval':_0x8eff('0x79')}]},routingClient);})[_0x8eff('0x1a')](respondWithResult(_0x4f7209,null))[_0x8eff('0xd')](handleError(_0x4f7209,null));}; \ No newline at end of file +var _0x2d17=['jayson/promise','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','params','voiceQueues','VoiceQueues','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','user','body','MemberReport','findAll','length','findOrCreate','INTERACTION','interface','SIP/%s','format','YYYY-MM-DD\x20HH:mm:ss','internal','capacity','telephones','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','capitalize','chat','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','InteractionId','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Website','User','agent','Agent\x20not\x20found','Message','agentTransferTimeout','bluebird','moment','util','../../mysqldb','api'];(function(_0x17bf10,_0xb82faf){var _0x1fb748=function(_0x1c0a9c){while(--_0x1c0a9c){_0x17bf10['push'](_0x17bf10['shift']());}};_0x1fb748(++_0xb82faf);}(_0x2d17,0x17e));var _0x72d1=function(_0x906350,_0x257720){_0x906350=_0x906350-0x0;var _0x146288=_0x2d17[_0x906350];return _0x146288;};'use strict';var BPromise=require(_0x72d1('0x0'));var moment=require(_0x72d1('0x1'));var _=require('lodash');var util=require(_0x72d1('0x2'));var db=require(_0x72d1('0x3'))['db'];var logger=require('../../config/logger')(_0x72d1('0x4'));var jayson=require(_0x72d1('0x5'));var amiClient=jayson['client'][_0x72d1('0x6')]({'port':0x232a});var mailClient=jayson['client'][_0x72d1('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x72d1('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x239d1f,_0x5b40a9,_0x477264){return new BPromise(function(_0x422f5a,_0x19e248){var _0x4e7f3e=_0x477264?_0x477264:amiClient;return _0x4e7f3e[_0x72d1('0x7')](_0x239d1f,_0x5b40a9)[_0x72d1('0x8')](function(_0x283775){if(_0x283775['error']){if(_0x283775[_0x72d1('0x9')][_0x72d1('0xa')]===0x1f4){return _0x19e248(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}return _0x422f5a(_0x283775[_0x72d1('0x9')][_0x72d1('0xb')]);}else{_0x422f5a(_0x283775[_0x72d1('0xc')]);}})[_0x72d1('0xd')](function(_0x273ccf){_0x19e248(_0x273ccf);});});}function respondWithResult(_0x2f5a78,_0x5ad4df){_0x5ad4df=_0x5ad4df||0xc8;return function(_0x3cd1ae){if(_0x3cd1ae){return _0x2f5a78[_0x72d1('0xe')](_0x5ad4df)[_0x72d1('0xf')](_0x3cd1ae);}return _0x2f5a78[_0x72d1('0x10')](0x194);};}function handleError(_0x22ac6f,_0x685a27){_0x685a27=_0x685a27||0x1f4;return function(_0x143718){logger[_0x72d1('0x9')](_0x143718[_0x72d1('0x11')]);if(_0x143718[_0x72d1('0x12')]){delete _0x143718[_0x72d1('0x12')];}_0x22ac6f[_0x72d1('0xe')](_0x685a27)[_0x72d1('0x13')](_0x143718);};}function findById(_0x491af4){return function(_0x46fa3d){if(!_['isNil'](_0x491af4)&&!_[_0x72d1('0x14')](_0x46fa3d)&&!_[_0x72d1('0x14')](_0x46fa3d['rows'])){return _[_0x72d1('0x15')](_0x46fa3d[_0x72d1('0x16')],function(_0x1ca18d){return _0x1ca18d['id']==_0x491af4;});}return null;};}exports['voiceChannels']=function(_0x4925f6,_0x313d7b){return respondWithRpcPromise(_0x72d1('0x17'),_0x4925f6[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x313d7b,null))[_0x72d1('0xd')](handleError(_0x313d7b,null));};exports[_0x72d1('0x19')]=function(_0x1e2411,_0x5c7982){return respondWithRpcPromise(_0x72d1('0x1a'),_['merge'](_0x1e2411['query'],_0x1e2411['params']))['then'](respondWithResult(_0x5c7982,null))[_0x72d1('0xd')](handleError(_0x5c7982,null));};exports[_0x72d1('0x1b')]=function(_0x573c98,_0x2a421a){return respondWithRpcPromise(_0x72d1('0x1c'),_[_0x72d1('0x1d')](_0x573c98[_0x72d1('0x18')],_0x573c98[_0x72d1('0x1e')]))['then'](respondWithResult(_0x2a421a,null))['catch'](handleError(_0x2a421a,null));};exports[_0x72d1('0x1f')]=function(_0x36bc65,_0x2f661){return respondWithRpcPromise(_0x72d1('0x20'),_0x36bc65[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x2f661,null))[_0x72d1('0xd')](handleError(_0x2f661,null));};exports['showVoiceQueues']=function(_0x57ec9e,_0x1ba258){return respondWithRpcPromise('VoiceQueues',_0x57ec9e[_0x72d1('0x18')])[_0x72d1('0x8')](findById(_0x57ec9e[_0x72d1('0x1e')]['id']))['then'](respondWithResult(_0x1ba258,null))[_0x72d1('0xd')](handleError(_0x1ba258,null));};exports['updateVoiceQueue']=function(_0x707cd0,_0x20055f){return respondWithRpcPromise(_0x72d1('0x21'),_[_0x72d1('0x1d')](_0x707cd0['body'],_0x707cd0[_0x72d1('0x1e')]))['then'](respondWithResult(_0x20055f,null))[_0x72d1('0xd')](handleError(_0x20055f,null));};exports[_0x72d1('0x22')]=function(_0x5cec3f,_0x14d653){return respondWithRpcPromise(_0x72d1('0x23'),_[_0x72d1('0x1d')](_0x5cec3f[_0x72d1('0x18')],_0x5cec3f[_0x72d1('0x1e')]))['then'](respondWithResult(_0x14d653,null))[_0x72d1('0xd')](handleError(_0x14d653,null));};exports[_0x72d1('0x24')]=function(_0x9efc2f,_0x482033){return respondWithRpcPromise(_0x72d1('0x25'),_0x9efc2f[_0x72d1('0x18')])['then'](respondWithResult(_0x482033,null))[_0x72d1('0xd')](handleError(_0x482033,null));};exports[_0x72d1('0x26')]=function(_0x437d79,_0x5a63d9){return respondWithRpcPromise(_0x72d1('0x27'),_['merge'](_0x437d79[_0x72d1('0x18')],_0x437d79[_0x72d1('0x1e')]))[_0x72d1('0x8')](respondWithResult(_0x5a63d9,null))[_0x72d1('0xd')](handleError(_0x5a63d9,null));};exports[_0x72d1('0x28')]=function(_0xc9798a,_0x3ed5de){return respondWithRpcPromise(_0x72d1('0x29'),_[_0x72d1('0x1d')](_0xc9798a[_0x72d1('0x18')],_0xc9798a[_0x72d1('0x1e')]))['then'](respondWithResult(_0x3ed5de,null))[_0x72d1('0xd')](handleError(_0x3ed5de,null));};exports[_0x72d1('0x2a')]=function(_0x4acab,_0x325209){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_[_0x72d1('0x1d')](_0x4acab[_0x72d1('0x18')],_0x4acab[_0x72d1('0x1e')]))['then'](respondWithResult(_0x325209,null))[_0x72d1('0xd')](handleError(_0x325209,null));};exports[_0x72d1('0x2b')]=function(_0x163538,_0x5b897f){return respondWithRpcPromise(_0x72d1('0x2c'),_0x163538[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x5b897f,null))['catch'](handleError(_0x5b897f,null));};exports[_0x72d1('0x2d')]=function(_0x40cdbd,_0x1e083e){return respondWithRpcPromise(_0x72d1('0x2e'),_0x40cdbd[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x1e083e,null))[_0x72d1('0xd')](handleError(_0x1e083e,null));};exports['agents']=function(_0x12646c,_0x3ae4b5){var _0x440ac5;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c[_0x72d1('0x18')])[_0x72d1('0x8')](function(_0x2f3080){_0x440ac5=_0x2f3080;return respondWithRpcPromise(_0x72d1('0x2f'),_0x12646c['query'],routingClient);})[_0x72d1('0x8')](function(_0x1a6dd4){return _[_0x72d1('0x1d')]({},_0x1a6dd4,_0x440ac5);})[_0x72d1('0x8')](respondWithResult(_0x3ae4b5,null))[_0x72d1('0xd')](handleError(_0x3ae4b5,null));};exports[_0x72d1('0x30')]=function(_0xb911fa,_0x3620df){if(_0xb911fa['body']&&_0xb911fa['body'][_0x72d1('0x31')]&&_0xb911fa[_0x72d1('0x32')]&&_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]){for(var _0x5a6bc4 in _0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')]){if(_0xb911fa['body'][_0x72d1('0x31')]['hasOwnProperty'](_0x5a6bc4)){db[_0x72d1('0x34')][_0x72d1('0x35')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa['user'][_0x72d1('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0xb911fa['body']['interaction'][_0x5a6bc4]&&_0xb911fa[_0x72d1('0x33')]['interaction'][_0x5a6bc4][_0x72d1('0x36')]?{'$notIn':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4]}:{'$ne':null}}})['then'](function(_0x4a5c1c){var _0x263fcb=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x2cb03d=0x0,_0x397f31=_0x4a5c1c[_0x72d1('0x36')];_0x2cb03d<_0x397f31;_0x2cb03d+=0x1){_0x4a5c1c[_0x2cb03d]['updateAttributes']({'exitAt':_0x263fcb});}});for(var _0x4f772d=0x0;_0x4f772d<_0xb911fa['body']['interaction'][_0x5a6bc4][_0x72d1('0x36')];_0x4f772d+=0x1){db[_0x72d1('0x34')][_0x72d1('0x37')]({'where':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')],'type':_0x72d1('0x38'),'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d],'exitAt':null},'defaults':{'channel':_0x5a6bc4,'membername':_0xb911fa[_0x72d1('0x32')]['name'],'interface':_[_0x72d1('0x14')](_0xb911fa[_0x72d1('0x32')][_0x72d1('0x39')])?util['format'](_0x72d1('0x3a'),_0xb911fa[_0x72d1('0x32')][_0x72d1('0x12')]):_0xb911fa['user'][_0x72d1('0x39')],'type':_0x72d1('0x38'),'enterAt':moment()[_0x72d1('0x3b')](_0x72d1('0x3c')),'role':'agent','internal':_0xb911fa['user'][_0x72d1('0x3d')],'uniqueid':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x31')][_0x5a6bc4][_0x4f772d]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0xb911fa[_0x72d1('0x1e')]['id'],'capacity':_0xb911fa[_0x72d1('0x33')][_0x72d1('0x3e')]},routingClient)[_0x72d1('0x8')](respondWithResult(_0x3620df,null))[_0x72d1('0xd')](handleError(_0x3620df,null));};exports[_0x72d1('0x3f')]=function(_0x3146cf,_0xebe855){return respondWithRpcPromise(_0x72d1('0x40'),_0x3146cf[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0xebe855,null))['catch'](handleError(_0xebe855,null));};exports[_0x72d1('0x41')]=function(_0x50d4d4,_0x5dd7b0){return respondWithRpcPromise(_0x72d1('0x42'),_0x50d4d4['query'])[_0x72d1('0x8')](respondWithResult(_0x5dd7b0,null))[_0x72d1('0xd')](handleError(_0x5dd7b0,null));};exports[_0x72d1('0x43')]=function(_0x162248,_0x473a7b){return respondWithRpcPromise(_0x72d1('0x44'),_0x162248[_0x72d1('0x18')])[_0x72d1('0x8')](respondWithResult(_0x473a7b,null))[_0x72d1('0xd')](handleError(_0x473a7b,null));};exports[_0x72d1('0x45')]=function(_0x14f9de,_0x52102e){return respondWithRpcPromise(_0x72d1('0x46'),_0x14f9de[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x52102e,null))['catch'](handleError(_0x52102e,null));};exports['showChatQueues']=function(_0x32f1ea,_0x140f0b){return respondWithRpcPromise(_0x72d1('0x46'),_0x32f1ea[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x32f1ea['params']['id']))[_0x72d1('0x8')](respondWithResult(_0x140f0b,null))['catch'](handleError(_0x140f0b,null));};exports[_0x72d1('0x47')]=function(_0x41c6a6,_0x20daf0){return respondWithRpcPromise(_0x72d1('0x48'),_0x41c6a6[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x20daf0,null))[_0x72d1('0xd')](handleError(_0x20daf0,null));};exports[_0x72d1('0x49')]=function(_0x384f0a,_0x3a2dfe){return respondWithRpcPromise(_0x72d1('0x48'),_0x384f0a[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x384f0a[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x3a2dfe,null))[_0x72d1('0xd')](handleError(_0x3a2dfe,null));};exports[_0x72d1('0x4a')]=function(_0x5e63cc,_0x1b40e8){return respondWithRpcPromise(_0x72d1('0x4b'),_0x5e63cc[_0x72d1('0x18')],mailClient)[_0x72d1('0x8')](respondWithResult(_0x1b40e8,null))[_0x72d1('0xd')](handleError(_0x1b40e8,null));};exports[_0x72d1('0x4c')]=function(_0x4e2d85,_0x1aec3d){return respondWithRpcPromise(_0x72d1('0x4d'),_0x4e2d85[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1aec3d,null))['catch'](handleError(_0x1aec3d,null));};exports[_0x72d1('0x4e')]=function(_0x5f4614,_0x28896f){return respondWithRpcPromise(_0x72d1('0x4d'),_0x5f4614[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x5f4614[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x28896f,null))[_0x72d1('0xd')](handleError(_0x28896f,null));};exports[_0x72d1('0x4f')]=function(_0x28e42b,_0x48cd1e){return respondWithRpcPromise('SmsQueues',_0x28e42b[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x48cd1e,null))[_0x72d1('0xd')](handleError(_0x48cd1e,null));};exports['showSmsQueues']=function(_0x31bfda,_0x333671){return respondWithRpcPromise('SmsQueues',_0x31bfda[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x31bfda[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x333671,null))[_0x72d1('0xd')](handleError(_0x333671,null));};exports[_0x72d1('0x50')]=function(_0x102574,_0x7925ec){return respondWithRpcPromise(_0x72d1('0x51'),_0x102574[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x7925ec,null))[_0x72d1('0xd')](handleError(_0x7925ec,null));};exports['showWhatsappQueues']=function(_0x55f49f,_0x15e0e0){return respondWithRpcPromise(_0x72d1('0x51'),_0x55f49f[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0x55f49f[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x15e0e0,null))[_0x72d1('0xd')](handleError(_0x15e0e0,null));};exports[_0x72d1('0x52')]=function(_0x488a14,_0x837b6b){return respondWithRpcPromise('FaxQueues',_0x488a14[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x837b6b,null))['catch'](handleError(_0x837b6b,null));};exports['showFaxQueues']=function(_0xfd39ab,_0x14d59b){return respondWithRpcPromise(_0x72d1('0x53'),_0xfd39ab[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](findById(_0xfd39ab[_0x72d1('0x1e')]['id']))[_0x72d1('0x8')](respondWithResult(_0x14d59b,null))['catch'](handleError(_0x14d59b,null));};exports[_0x72d1('0x54')]=function(_0x24bd82,_0x336ca3){return respondWithRpcPromise('FaxAccounts',_0x24bd82[_0x72d1('0x18')])['then'](respondWithResult(_0x336ca3,null))[_0x72d1('0xd')](handleError(_0x336ca3,null));};exports[_0x72d1('0x55')]=function(_0x5158ff,_0x3c0a7e){return respondWithRpcPromise(_0x72d1('0x56'),_0x5158ff['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3c0a7e,null))[_0x72d1('0xd')](handleError(_0x3c0a7e,null));};exports[_0x72d1('0x57')]=function(_0x132a43,_0x4a52ec){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x132a43['query'],routingClient)[_0x72d1('0x8')](respondWithResult(_0x4a52ec,null))[_0x72d1('0xd')](handleError(_0x4a52ec,null));};exports[_0x72d1('0x58')]=function(_0x240159,_0x146b06){return respondWithRpcPromise(_0x72d1('0x59'),_0x240159['query'],routingClient)['then'](respondWithResult(_0x146b06,null))[_0x72d1('0xd')](handleError(_0x146b06,null));};exports[_0x72d1('0x5a')]=function(_0x36827e,_0x3ef7a3){return respondWithRpcPromise(_0x72d1('0x59'),_0x36827e[_0x72d1('0x18')],routingClient)['then'](function(_0x23f0e3){if(_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')]!==undefined){var _0x53e57b=_(_0x23f0e3[_0x72d1('0x16')])[_0x72d1('0x5c')]([_0x36827e[_0x72d1('0x18')][_0x72d1('0x5b')],_0x36827e[_0x72d1('0x1e')]['id']])[_0x72d1('0x5d')](_0x72d1('0x5e'))[_0x72d1('0x5f')]()['value']();return _0x23f0e3[_0x72d1('0x16')][_0x72d1('0x5c')](function(_0x24f5eb){return _0x53e57b[_0x72d1('0x60')](_0x24f5eb['queue_id'])>-0x1;});}else{return _0x23f0e3['rows'][_0x72d1('0x5c')](function(_0x2932bb){return _0x2932bb['queue_id']===parseInt(_0x36827e[_0x72d1('0x1e')]['id']);});}})[_0x72d1('0x8')](respondWithResult(_0x3ef7a3,null))[_0x72d1('0xd')](handleError(_0x3ef7a3,null));};exports[_0x72d1('0x61')]=function(_0x35b9bb,_0x1d1e22){return respondWithRpcPromise(_0x72d1('0x62'),_0x35b9bb[_0x72d1('0x18')],routingClient)['then'](respondWithResult(_0x1d1e22,null))[_0x72d1('0xd')](handleError(_0x1d1e22,null));};exports[_0x72d1('0x63')]=function(_0x38bfd3,_0x3cbe00){return respondWithRpcPromise(_0x72d1('0x64'),_0x38bfd3[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x3cbe00,null))[_0x72d1('0xd')](handleError(_0x3cbe00,null));};exports['faxQueuesWaitingInteractions']=function(_0x47585e,_0x466634){return respondWithRpcPromise(_0x72d1('0x65'),_0x47585e[_0x72d1('0x18')],routingClient)[_0x72d1('0x8')](respondWithResult(_0x466634,null))[_0x72d1('0xd')](handleError(_0x466634,null));};exports['queueNotify']=function(_0x1c6547){return function(_0x369153,_0x4a6607){var _0x266fbc,_0x4057ec;var _0x239cdb=_[_0x72d1('0x66')](_0x1c6547);var _0x27c651=_0x1c6547===_0x72d1('0x67')?'Website':_0x72d1('0x68');return db[_0x239cdb+_0x72d1('0x69')]['findOne']({'raw':!![],'where':{'id':_0x369153['params']['id']}})[_0x72d1('0x8')](function(_0x291b67){if(_[_0x72d1('0x14')](_0x291b67)){throw new Error(_0x239cdb+_0x72d1('0x6a'));}_0x266fbc=_0x291b67;return db[_0x239cdb+'Message'][_0x72d1('0x6b')]({'where':{'id':_0x369153[_0x72d1('0x33')][_0x72d1('0x6c')]},'include':[{'model':db[_0x239cdb+_0x72d1('0x6d')],'as':_0x72d1('0x6d')},{'model':db[_0x239cdb+_0x27c651],'as':_0x72d1('0x68')}]});})[_0x72d1('0x8')](function(_0x14a215){if(_['isNil'](_0x14a215)){throw new Error(_0x239cdb+_0x72d1('0x6e'));}_0x4057ec=_0x14a215;return _0x14a215[_0x72d1('0x6f')]({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x1b06f3={'uniqueid':_0x1c6547+'.'+_0x4057ec['id']+'.'+_0x4057ec['Interaction']['id'],'FromUserId':_0x369153[_0x72d1('0x32')]['id'],'type':_0x72d1('0x70')};_0x1b06f3[_0x239cdb+'MessageId']=_0x4057ec['id'];_0x1b06f3[_0x239cdb+_0x72d1('0x71')]=_0x4057ec['Interaction']['id'];_0x1b06f3[_0x72d1('0x72')+_0x239cdb+_0x27c651+'Id']=_0x4057ec['Account']['id'];_0x1b06f3['To'+_0x239cdb+_0x72d1('0x73')]=_0x266fbc['id'];return db[_0x239cdb+_0x72d1('0x74')][_0x72d1('0x75')](_0x1b06f3);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x1c6547,'interaction':_0x4057ec['Interaction'],'message':_0x4057ec,'account':_0x4057ec[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x70'),'appdata':_0x266fbc[_0x72d1('0x12')]+','+(_0x4057ec['Account'][_0x72d1('0x77')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x4a6607,null))[_0x72d1('0xd')](handleError(_0x4a6607,null));};};exports[_0x72d1('0x79')]=function(_0x8d4f0d,_0x5c262e){var _0x1d0db0,_0x39d961;if(_[_0x72d1('0x14')](_0x8d4f0d['body'][_0x72d1('0x7a')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x38a32c=_0x8d4f0d['body'][_0x72d1('0x7a')];var _0x2d45c9=_[_0x72d1('0x66')](_0x38a32c);var _0x21ad86=_0x38a32c==='chat'?_0x72d1('0x7b'):_0x72d1('0x68');return db[_0x72d1('0x7c')][_0x72d1('0x6b')]({'raw':!![],'where':{'id':_0x8d4f0d['params']['id'],'role':_0x72d1('0x7d')}})[_0x72d1('0x8')](function(_0x430905){if(_[_0x72d1('0x14')](_0x430905)){throw new Error(_0x72d1('0x7e'));}_0x1d0db0=_0x430905;return db[_0x2d45c9+_0x72d1('0x7f')][_0x72d1('0x6b')]({'where':{'id':_0x8d4f0d['body']['messageId']},'include':[{'model':db[_0x2d45c9+'Interaction'],'as':_0x72d1('0x6d')},{'model':db[_0x2d45c9+_0x21ad86],'as':'Account'}]});})[_0x72d1('0x8')](function(_0x8f4603){if(_['isNil'](_0x8f4603)){throw new Error(_0x2d45c9+_0x72d1('0x6e'));}_0x39d961=_0x8f4603;return _0x8f4603['update']({'read':0x0,'readAt':null,'UserId':null});})[_0x72d1('0x8')](function(){var _0x378cf0={'uniqueid':_0x38a32c+'.'+_0x39d961['id']+'.'+_0x39d961[_0x72d1('0x6d')]['id'],'FromUserId':_0x8d4f0d[_0x72d1('0x32')]['id'],'type':'queue','ToUserId':_0x1d0db0['id']};_0x378cf0[_0x2d45c9+'MessageId']=_0x39d961['id'];_0x378cf0[_0x2d45c9+_0x72d1('0x71')]=_0x39d961['Interaction']['id'];_0x378cf0['From'+_0x2d45c9+_0x21ad86+'Id']=_0x39d961['Account']['id'];return db[_0x2d45c9+_0x72d1('0x74')][_0x72d1('0x75')](_0x378cf0);})[_0x72d1('0x8')](function(){return respondWithRpcPromise(_0x72d1('0x76'),{'channel':_0x38a32c,'interaction':_0x39d961[_0x72d1('0x6d')],'message':_0x39d961,'account':_0x39d961[_0x72d1('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x72d1('0x7d'),'appdata':_0x1d0db0['name']+','+(_0x39d961['Account'][_0x72d1('0x80')]||0x12c),'interval':_0x72d1('0x78')}]},routingClient);})['then'](respondWithResult(_0x5c262e,null))[_0x72d1('0xd')](handleError(_0x5c262e,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 71dd51c..1973a3e 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 _0xa5bf=['create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show','/:id/run','post'];(function(_0x38c3ef,_0x4851a2){var _0x421227=function(_0x1d85dd){while(--_0x1d85dd){_0x38c3ef['push'](_0x38c3ef['shift']());}};_0x421227(++_0x4851a2);}(_0xa5bf,0x1d2));var _0xfa5b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xa5bf[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0xfa5b('0x0'));var util=require(_0xfa5b('0x1'));var path=require(_0xfa5b('0x2'));var timeout=require(_0xfa5b('0x3'));var express=require('express');var router=express[_0xfa5b('0x4')]();var fs_extra=require(_0xfa5b('0x5'));var auth=require(_0xfa5b('0x6'));var interaction=require(_0xfa5b('0x7'));var config=require(_0xfa5b('0x8'));var controller=require(_0xfa5b('0x9'));router[_0xfa5b('0xa')]('/',auth[_0xfa5b('0xb')](),controller[_0xfa5b('0xc')]);router[_0xfa5b('0xa')](_0xfa5b('0xd'),auth[_0xfa5b('0xb')](),controller[_0xfa5b('0xe')]);router[_0xfa5b('0xa')](_0xfa5b('0xf'),auth[_0xfa5b('0xb')](),controller['run']);router[_0xfa5b('0x10')]('/',auth[_0xfa5b('0xb')](),controller[_0xfa5b('0x11')]);router[_0xfa5b('0x12')](_0xfa5b('0xd'),auth[_0xfa5b('0xb')](),controller['update']);router[_0xfa5b('0x13')](_0xfa5b('0xd'),auth[_0xfa5b('0xb')](),controller['destroy']);module[_0xfa5b('0x14')]=router; \ No newline at end of file +var _0x955c=['fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0xf89181,_0x2b1f87){var _0x4803f3=function(_0x59ac01){while(--_0x59ac01){_0xf89181['push'](_0xf89181['shift']());}};_0x4803f3(++_0x2b1f87);}(_0x955c,0x79));var _0xc955=function(_0x202258,_0x167bbb){_0x202258=_0x202258-0x0;var _0x1f2251=_0x955c[_0x202258];return _0x1f2251;};'use strict';var multer=require(_0xc955('0x0'));var util=require(_0xc955('0x1'));var path=require('path');var timeout=require(_0xc955('0x2'));var express=require(_0xc955('0x3'));var router=express[_0xc955('0x4')]();var fs_extra=require(_0xc955('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc955('0x6'));var config=require(_0xc955('0x7'));var controller=require(_0xc955('0x8'));router[_0xc955('0x9')]('/',auth[_0xc955('0xa')](),controller[_0xc955('0xb')]);router[_0xc955('0x9')](_0xc955('0xc'),auth[_0xc955('0xa')](),controller['show']);router[_0xc955('0x9')](_0xc955('0xd'),auth[_0xc955('0xa')](),controller[_0xc955('0xe')]);router[_0xc955('0xf')]('/',auth[_0xc955('0xa')](),controller[_0xc955('0x10')]);router['put'](_0xc955('0xc'),auth['isAuthenticated'](),controller[_0xc955('0x11')]);router[_0xc955('0x12')](_0xc955('0xc'),auth[_0xc955('0xa')](),controller[_0xc955('0x13')]);module[_0xc955('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 54a4301..03a9476 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 _0x12df=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','csv','pdf','xlsx','default','custom','TEXT','sequelize'];(function(_0x4d9cec,_0x5f3d6a){var _0x509a6d=function(_0x51538b){while(--_0x51538b){_0x4d9cec['push'](_0x4d9cec['shift']());}};_0x509a6d(++_0x5f3d6a);}(_0x12df,0x7d));var _0xf12d=function(_0x1d3549,_0x34cab5){_0x1d3549=_0x1d3549-0x0;var _0x43cbff=_0x12df[_0x1d3549];return _0x43cbff;};'use strict';var Sequelize=require(_0xf12d('0x0'));module[_0xf12d('0x1')]={'name':{'type':Sequelize[_0xf12d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf12d('0x2')]},'active':{'type':Sequelize[_0xf12d('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf12d('0x2')],'allowNull':![],'defaultValue':_0xf12d('0x4')},'startAt':{'type':Sequelize[_0xf12d('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf12d('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf12d('0x7')](_0xf12d('0x8'),_0xf12d('0x9'),_0xf12d('0xa'),_0xf12d('0xb'),_0xf12d('0xc'),_0xf12d('0xd'),_0xf12d('0xe')),'allowNull':![],'defaultValue':_0xf12d('0xc')},'output':{'type':Sequelize[_0xf12d('0x7')](_0xf12d('0xf'),_0xf12d('0x10'),_0xf12d('0x11')),'allowNull':![],'defaultValue':_0xf12d('0xf')},'type':{'type':Sequelize[_0xf12d('0x7')]('custom',_0xf12d('0x12')),'allowNull':![],'defaultValue':_0xf12d('0x13')},'sendMail':{'type':Sequelize[_0xf12d('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0xf12d('0x14')]},'sendIfEmpty':{'type':Sequelize[_0xf12d('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0d08=['STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','days','hours','minutes','csv','pdf','xlsx','custom','BOOLEAN','TEXT','exports'];(function(_0x536bb3,_0x1873ec){var _0x1dce50=function(_0x2fced8){while(--_0x2fced8){_0x536bb3['push'](_0x536bb3['shift']());}};_0x1dce50(++_0x1873ec);}(_0x0d08,0xc5));var _0x80d0=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x0d08[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require('sequelize');module[_0x80d0('0x0')]={'name':{'type':Sequelize[_0x80d0('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x80d0('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x80d0('0x1')],'allowNull':![],'defaultValue':_0x80d0('0x2')},'startAt':{'type':Sequelize[_0x80d0('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x80d0('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x80d0('0x5')](_0x80d0('0x6'),_0x80d0('0x7'),_0x80d0('0x8'),'weeks',_0x80d0('0x9'),_0x80d0('0xa'),_0x80d0('0xb')),'allowNull':![],'defaultValue':_0x80d0('0x9')},'output':{'type':Sequelize[_0x80d0('0x5')](_0x80d0('0xc'),_0x80d0('0xd'),_0x80d0('0xe')),'allowNull':![],'defaultValue':_0x80d0('0xc')},'type':{'type':Sequelize['ENUM']('custom','default'),'allowNull':![],'defaultValue':_0x80d0('0xf')},'sendMail':{'type':Sequelize[_0x80d0('0x10')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x80d0('0x11')]},'bcc':{'type':Sequelize[_0x80d0('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x80d0('0x10')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 5f16dc4..107f9c7 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 _0x431d=['UserProfileSection','userProfileId','autoAssociation','update','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','Scheduler','UserProfileResource','destroy','sendStatus','error','index','Schedule','fieldName','type','key','model','name','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filters','filter','merge','where','map','VIRTUAL','include','catch','params','length','options','find','create','body','role','user'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x431d,0x18c));var _0xd431=function(_0x57b38f,_0xc26f33){_0x57b38f=_0x57b38f-0x0;var _0x6aa12c=_0x431d[_0x57b38f];return _0x6aa12c;};'use strict';var emlformat=require(_0xd431('0x0'));var rimraf=require(_0xd431('0x1'));var zipdir=require(_0xd431('0x2'));var jsonpatch=require(_0xd431('0x3'));var rp=require(_0xd431('0x4'));var moment=require('moment');var BPromise=require(_0xd431('0x5'));var Mustache=require(_0xd431('0x6'));var util=require(_0xd431('0x7'));var path=require(_0xd431('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd431('0x9'));var squel=require(_0xd431('0xa'));var crypto=require(_0xd431('0xb'));var jsforce=require(_0xd431('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd431('0xd'));var Papa=require(_0xd431('0xe'));var Redis=require(_0xd431('0xf'));var authService=require(_0xd431('0x10'));var qs=require(_0xd431('0x11'));var as=require(_0xd431('0x12'));var hardwareService=require(_0xd431('0x13'));var logger=require(_0xd431('0x14'))(_0xd431('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd431('0x16'));var db=require(_0xd431('0x17'))['db'];function respondWithStatusCode(_0x553344,_0x6d4d2a){_0x6d4d2a=_0x6d4d2a||0xcc;return function(_0xee07b8){if(_0xee07b8){return _0x553344['sendStatus'](_0x6d4d2a);}return _0x553344['status'](_0x6d4d2a)['end']();};}function respondWithResult(_0x301498,_0x13cdf2){_0x13cdf2=_0x13cdf2||0xc8;return function(_0x3851b6){if(_0x3851b6){return _0x301498[_0xd431('0x18')](_0x13cdf2)['json'](_0x3851b6);}};}function respondWithFilteredResult(_0x4b2669,_0xf0a53c){return function(_0x36c5ff){if(_0x36c5ff){var _0x3fcb0c=typeof _0xf0a53c[_0xd431('0x19')]===_0xd431('0x1a')&&typeof _0xf0a53c[_0xd431('0x1b')]===_0xd431('0x1a');var _0x2edaf8=_0x36c5ff[_0xd431('0x1c')];var _0x49f544=_0x3fcb0c?0x0:_0xf0a53c[_0xd431('0x19')];var _0x2d630d=_0x3fcb0c?_0x36c5ff[_0xd431('0x1c')]:_0xf0a53c[_0xd431('0x19')]+_0xf0a53c[_0xd431('0x1b')];var _0xf97f37;if(_0x2d630d>=_0x2edaf8){_0x2d630d=_0x2edaf8;_0xf97f37=0xc8;}else{_0xf97f37=0xce;}_0x4b2669[_0xd431('0x18')](_0xf97f37);return _0x4b2669['set'](_0xd431('0x1d'),_0x49f544+'-'+_0x2d630d+'/'+_0x2edaf8)[_0xd431('0x1e')](_0x36c5ff);}return null;};}function patchUpdates(_0x5cb06c){return function(_0x3188be){try{jsonpatch[_0xd431('0x1f')](_0x3188be,_0x5cb06c,!![]);}catch(_0x53f2f4){return BPromise[_0xd431('0x20')](_0x53f2f4);}return _0x3188be[_0xd431('0x21')]();};}function saveUpdates(_0x56d819,_0xd4fb3f){return function(_0x2b7f79){if(_0x2b7f79){return _0x2b7f79['update'](_0x56d819)['then'](function(_0xca60e5){return _0xca60e5;});}return null;};}function removeEntity(_0x2da59a,_0x5a1215){return function(_0x444321){if(_0x444321){return _0x444321['destroy']()[_0xd431('0x22')](function(){var _0x2bbab6=_0x444321['get']({'plain':!![]});var _0x281359=_0xd431('0x23');return db[_0xd431('0x24')][_0xd431('0x25')]({'where':{'type':_0x281359,'resourceId':_0x2bbab6['id']}})[_0xd431('0x22')](function(){return _0x444321;});})[_0xd431('0x22')](function(){_0x2da59a[_0xd431('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa923f5,_0x4f80d6){return function(_0x25294f){if(!_0x25294f){_0xa923f5[_0xd431('0x26')](0x194);}return _0x25294f;};}function handleError(_0x1b0405,_0x2c68c7){_0x2c68c7=_0x2c68c7||0x1f4;return function(_0xca29bd){logger[_0xd431('0x27')](_0xca29bd['stack']);if(_0xca29bd['name']){delete _0xca29bd['name'];}_0x1b0405['status'](_0x2c68c7)['send'](_0xca29bd);};}exports[_0xd431('0x28')]=function(_0x1820ce,_0x978715){var _0x52a94c={},_0x3f9e3d={},_0x5c0be5={'count':0x0,'rows':[]};var _0x101232=_['map'](db[_0xd431('0x29')]['rawAttributes'],function(_0x48c1e4){return{'name':_0x48c1e4[_0xd431('0x2a')],'type':_0x48c1e4[_0xd431('0x2b')][_0xd431('0x2c')]};});_0x3f9e3d[_0xd431('0x2d')]=_['map'](_0x101232,_0xd431('0x2e'));_0x3f9e3d[_0xd431('0x2f')]=_[_0xd431('0x30')](_0x1820ce[_0xd431('0x2f')]);_0x3f9e3d['filters']=_[_0xd431('0x31')](_0x3f9e3d['model'],_0x3f9e3d[_0xd431('0x2f')]);_0x52a94c[_0xd431('0x32')]=_['intersection'](_0x3f9e3d[_0xd431('0x2d')],qs[_0xd431('0x33')](_0x1820ce['query'][_0xd431('0x33')]));_0x52a94c['attributes']=_0x52a94c[_0xd431('0x32')]['length']?_0x52a94c[_0xd431('0x32')]:_0x3f9e3d['model'];if(!_0x1820ce['query'][_0xd431('0x34')]('nolimit')){_0x52a94c[_0xd431('0x1b')]=qs[_0xd431('0x1b')](_0x1820ce['query'][_0xd431('0x1b')]);_0x52a94c[_0xd431('0x19')]=qs['offset'](_0x1820ce[_0xd431('0x2f')][_0xd431('0x19')]);}_0x52a94c[_0xd431('0x35')]=qs['sort'](_0x1820ce[_0xd431('0x2f')][_0xd431('0x36')]);_0x52a94c['where']=qs['filters'](_[_0xd431('0x37')](_0x1820ce[_0xd431('0x2f')],_0x3f9e3d[_0xd431('0x38')]),_0x101232);if(_0x1820ce[_0xd431('0x2f')][_0xd431('0x39')]){_0x52a94c['where']=_[_0xd431('0x3a')](_0x52a94c[_0xd431('0x3b')],{'$or':_[_0xd431('0x3c')](_0x101232,function(_0x5624ff){if(_0x5624ff[_0xd431('0x2b')]!==_0xd431('0x3d')){var _0x22b10d={};_0x22b10d[_0x5624ff['name']]={'$like':'%'+_0x1820ce[_0xd431('0x2f')]['filter']+'%'};return _0x22b10d;}})});}_0x52a94c=_[_0xd431('0x3a')]({},_0x52a94c,_0x1820ce['options']);var _0x3d7883={'where':_0x52a94c[_0xd431('0x3b')]};return db[_0xd431('0x29')][_0xd431('0x1c')](_0x3d7883)[_0xd431('0x22')](function(_0x547619){_0x5c0be5[_0xd431('0x1c')]=_0x547619;if(_0x1820ce[_0xd431('0x2f')]['includeAll']){_0x52a94c[_0xd431('0x3e')]=[{'all':!![]}];}return db[_0xd431('0x29')]['findAll'](_0x52a94c);})[_0xd431('0x22')](function(_0x3db1d3){_0x5c0be5['rows']=_0x3db1d3;return _0x5c0be5;})[_0xd431('0x22')](respondWithFilteredResult(_0x978715,_0x52a94c))[_0xd431('0x3f')](handleError(_0x978715,null));};exports['show']=function(_0x1821ed,_0x689296){var _0xbdcba3={'raw':![],'where':{'id':_0x1821ed[_0xd431('0x40')]['id']}},_0x5d1ab5={};_0x5d1ab5[_0xd431('0x2d')]=_[_0xd431('0x30')](db[_0xd431('0x29')]['rawAttributes']);_0x5d1ab5[_0xd431('0x2f')]=_[_0xd431('0x30')](_0x1821ed['query']);_0x5d1ab5[_0xd431('0x38')]=_[_0xd431('0x31')](_0x5d1ab5['model'],_0x5d1ab5['query']);_0xbdcba3['attributes']=_[_0xd431('0x31')](_0x5d1ab5[_0xd431('0x2d')],qs['fields'](_0x1821ed[_0xd431('0x2f')][_0xd431('0x33')]));_0xbdcba3[_0xd431('0x32')]=_0xbdcba3[_0xd431('0x32')][_0xd431('0x41')]?_0xbdcba3[_0xd431('0x32')]:_0x5d1ab5[_0xd431('0x2d')];if(_0x1821ed['query']['includeAll']){_0xbdcba3[_0xd431('0x3e')]=[{'all':!![]}];}_0xbdcba3=_['merge']({},_0xbdcba3,_0x1821ed[_0xd431('0x42')]);return db['Schedule'][_0xd431('0x43')](_0xbdcba3)[_0xd431('0x22')](handleEntityNotFound(_0x689296,null))[_0xd431('0x22')](respondWithResult(_0x689296,null))[_0xd431('0x3f')](handleError(_0x689296,null));};exports[_0xd431('0x44')]=function(_0x5c8e00,_0x5575f5){return db[_0xd431('0x29')][_0xd431('0x44')](_0x5c8e00[_0xd431('0x45')],{})['then'](function(_0x246d49){var _0x5d5715=_0x5c8e00['user']['get']({'plain':!![]});if(!_0x5d5715)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d5715[_0xd431('0x46')]===_0xd431('0x47')){var _0x3f00c7=_0x246d49['get']({'plain':!![]});var _0x2841de=_0xd431('0x23');return db[_0xd431('0x48')][_0xd431('0x43')]({'where':{'name':_0x2841de,'userProfileId':_0x5d5715[_0xd431('0x49')]},'raw':!![]})[_0xd431('0x22')](function(_0x445f60){if(_0x445f60&&_0x445f60[_0xd431('0x4a')]===0x0){return db[_0xd431('0x24')][_0xd431('0x44')]({'name':_0x3f00c7[_0xd431('0x2e')],'resourceId':_0x3f00c7['id'],'type':_0x445f60[_0xd431('0x2e')],'sectionId':_0x445f60['id']},{})['then'](function(){return _0x246d49;});}else{return _0x246d49;}})['catch'](function(_0x12bf4e){logger[_0xd431('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12bf4e);throw _0x12bf4e;});}return _0x246d49;})[_0xd431('0x22')](respondWithResult(_0x5575f5,0xc9))[_0xd431('0x3f')](handleError(_0x5575f5,null));};exports[_0xd431('0x4b')]=function(_0x368e0d,_0x327415){if(_0x368e0d[_0xd431('0x45')]['id']){delete _0x368e0d[_0xd431('0x45')]['id'];}return db['Schedule'][_0xd431('0x43')]({'where':{'id':_0x368e0d['params']['id']}})[_0xd431('0x22')](handleEntityNotFound(_0x327415,null))[_0xd431('0x22')](saveUpdates(_0x368e0d[_0xd431('0x45')],null))[_0xd431('0x22')](respondWithResult(_0x327415,null))[_0xd431('0x3f')](handleError(_0x327415,null));};exports[_0xd431('0x25')]=function(_0x230b40,_0x155ebe){return db[_0xd431('0x29')]['find']({'where':{'id':_0x230b40[_0xd431('0x40')]['id']}})[_0xd431('0x22')](handleEntityNotFound(_0x155ebe,null))['then'](removeEntity(_0x155ebe,null))[_0xd431('0x3f')](handleError(_0x155ebe,null));};exports[_0xd431('0x4c')]=function(_0x18d501,_0x348dce,_0x4c8450){var _0x132309=require(_0xd431('0x4d'));return db[_0xd431('0x29')][_0xd431('0x43')]({'where':{'id':_0x18d501[_0xd431('0x40')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x348dce,null))['then'](function(){_0x132309[_0xd431('0x4c')](_0x18d501[_0xd431('0x40')]['id']);})['then'](respondWithStatusCode(_0x348dce,null))[_0xd431('0x3f')](handleError(_0x348dce,null));}; \ No newline at end of file +var _0x19b7=['rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','Schedule','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Scheduler','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','../../config/schedule','run','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','get','destroy','error','stack','name','send','map'];(function(_0x261832,_0x5a24e6){var _0x186143=function(_0x54e5d8){while(--_0x54e5d8){_0x261832['push'](_0x261832['shift']());}};_0x186143(++_0x5a24e6);}(_0x19b7,0x17f));var _0x719b=function(_0x460ece,_0x3312d3){_0x460ece=_0x460ece-0x0;var _0x29013c=_0x19b7[_0x460ece];return _0x29013c;};'use strict';var emlformat=require(_0x719b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x719b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x719b('0x2'));var moment=require(_0x719b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x719b('0x4'));var util=require(_0x719b('0x5'));var path=require(_0x719b('0x6'));var sox=require(_0x719b('0x7'));var csv=require(_0x719b('0x8'));var ejs=require(_0x719b('0x9'));var fs=require('fs');var fs_extra=require(_0x719b('0xa'));var _=require(_0x719b('0xb'));var squel=require(_0x719b('0xc'));var crypto=require(_0x719b('0xd'));var jsforce=require(_0x719b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x719b('0x8'));var querystring=require(_0x719b('0xf'));var Papa=require(_0x719b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x719b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x719b('0x12'))(_0x719b('0x13'));var utils=require('../../config/utils');var config=require(_0x719b('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b09f8,_0x3dcf72){_0x3dcf72=_0x3dcf72||0xcc;return function(_0x34d0d5){if(_0x34d0d5){return _0x3b09f8[_0x719b('0x15')](_0x3dcf72);}return _0x3b09f8[_0x719b('0x16')](_0x3dcf72)[_0x719b('0x17')]();};}function respondWithResult(_0x24aa9e,_0x15937d){_0x15937d=_0x15937d||0xc8;return function(_0x2abb6e){if(_0x2abb6e){return _0x24aa9e[_0x719b('0x16')](_0x15937d)['json'](_0x2abb6e);}};}function respondWithFilteredResult(_0x5bbdd1,_0x1fd5fe){return function(_0x3e69ef){if(_0x3e69ef){var _0x39a80e=typeof _0x1fd5fe[_0x719b('0x18')]==='undefined'&&typeof _0x1fd5fe[_0x719b('0x19')]===_0x719b('0x1a');var _0x2cd36c=_0x3e69ef[_0x719b('0x1b')];var _0x3de525=_0x39a80e?0x0:_0x1fd5fe[_0x719b('0x18')];var _0x425b8a=_0x39a80e?_0x3e69ef[_0x719b('0x1b')]:_0x1fd5fe[_0x719b('0x18')]+_0x1fd5fe[_0x719b('0x19')];var _0x5c537d;if(_0x425b8a>=_0x2cd36c){_0x425b8a=_0x2cd36c;_0x5c537d=0xc8;}else{_0x5c537d=0xce;}_0x5bbdd1[_0x719b('0x16')](_0x5c537d);return _0x5bbdd1['set'](_0x719b('0x1c'),_0x3de525+'-'+_0x425b8a+'/'+_0x2cd36c)[_0x719b('0x1d')](_0x3e69ef);}return null;};}function patchUpdates(_0x1a6126){return function(_0x25a83c){try{jsonpatch[_0x719b('0x1e')](_0x25a83c,_0x1a6126,!![]);}catch(_0x1021aa){return BPromise[_0x719b('0x1f')](_0x1021aa);}return _0x25a83c[_0x719b('0x20')]();};}function saveUpdates(_0x3d74c4,_0x2c9070){return function(_0x32ec37){if(_0x32ec37){return _0x32ec37[_0x719b('0x21')](_0x3d74c4)['then'](function(_0x49c945){return _0x49c945;});}return null;};}function removeEntity(_0x1b206e,_0x2f0afb){return function(_0x1a879f){if(_0x1a879f){return _0x1a879f['destroy']()[_0x719b('0x22')](function(){var _0x9bf1f1=_0x1a879f[_0x719b('0x23')]({'plain':!![]});var _0x2c11f3='Scheduler';return db['UserProfileResource'][_0x719b('0x24')]({'where':{'type':_0x2c11f3,'resourceId':_0x9bf1f1['id']}})[_0x719b('0x22')](function(){return _0x1a879f;});})['then'](function(){_0x1b206e[_0x719b('0x16')](0xcc)[_0x719b('0x17')]();});}};}function handleEntityNotFound(_0x198567,_0x4fb724){return function(_0x118728){if(!_0x118728){_0x198567[_0x719b('0x15')](0x194);}return _0x118728;};}function handleError(_0x4d1369,_0x2481ed){_0x2481ed=_0x2481ed||0x1f4;return function(_0x3efe9){logger[_0x719b('0x25')](_0x3efe9[_0x719b('0x26')]);if(_0x3efe9['name']){delete _0x3efe9[_0x719b('0x27')];}_0x4d1369[_0x719b('0x16')](_0x2481ed)[_0x719b('0x28')](_0x3efe9);};}exports['index']=function(_0x2ce3b6,_0x10ff2f){var _0x45f369={},_0x5131eb={},_0x26f4af={'count':0x0,'rows':[]};var _0x253cfe=_[_0x719b('0x29')](db['Schedule'][_0x719b('0x2a')],function(_0xc9ad50){return{'name':_0xc9ad50[_0x719b('0x2b')],'type':_0xc9ad50[_0x719b('0x2c')][_0x719b('0x2d')]};});_0x5131eb[_0x719b('0x2e')]=_['map'](_0x253cfe,_0x719b('0x27'));_0x5131eb['query']=_[_0x719b('0x2f')](_0x2ce3b6[_0x719b('0x30')]);_0x5131eb[_0x719b('0x31')]=_['intersection'](_0x5131eb[_0x719b('0x2e')],_0x5131eb[_0x719b('0x30')]);_0x45f369['attributes']=_[_0x719b('0x32')](_0x5131eb['model'],qs[_0x719b('0x33')](_0x2ce3b6[_0x719b('0x30')][_0x719b('0x33')]));_0x45f369[_0x719b('0x34')]=_0x45f369[_0x719b('0x34')][_0x719b('0x35')]?_0x45f369[_0x719b('0x34')]:_0x5131eb[_0x719b('0x2e')];if(!_0x2ce3b6[_0x719b('0x30')][_0x719b('0x36')](_0x719b('0x37'))){_0x45f369[_0x719b('0x19')]=qs[_0x719b('0x19')](_0x2ce3b6[_0x719b('0x30')]['limit']);_0x45f369[_0x719b('0x18')]=qs[_0x719b('0x18')](_0x2ce3b6['query'][_0x719b('0x18')]);}_0x45f369[_0x719b('0x38')]=qs['sort'](_0x2ce3b6[_0x719b('0x30')][_0x719b('0x39')]);_0x45f369['where']=qs[_0x719b('0x31')](_[_0x719b('0x3a')](_0x2ce3b6[_0x719b('0x30')],_0x5131eb[_0x719b('0x31')]),_0x253cfe);if(_0x2ce3b6[_0x719b('0x30')][_0x719b('0x3b')]){_0x45f369[_0x719b('0x3c')]=_[_0x719b('0x3d')](_0x45f369['where'],{'$or':_[_0x719b('0x29')](_0x253cfe,function(_0x3d7d54){if(_0x3d7d54[_0x719b('0x2c')]!==_0x719b('0x3e')){var _0x581923={};_0x581923[_0x3d7d54[_0x719b('0x27')]]={'$like':'%'+_0x2ce3b6[_0x719b('0x30')][_0x719b('0x3b')]+'%'};return _0x581923;}})});}_0x45f369=_[_0x719b('0x3d')]({},_0x45f369,_0x2ce3b6[_0x719b('0x3f')]);var _0x4b5e2f={'where':_0x45f369[_0x719b('0x3c')]};return db[_0x719b('0x40')][_0x719b('0x1b')](_0x4b5e2f)[_0x719b('0x22')](function(_0x284452){_0x26f4af[_0x719b('0x1b')]=_0x284452;if(_0x2ce3b6[_0x719b('0x30')][_0x719b('0x41')]){_0x45f369['include']=[{'all':!![]}];}return db[_0x719b('0x40')][_0x719b('0x42')](_0x45f369);})[_0x719b('0x22')](function(_0x520e3a){_0x26f4af['rows']=_0x520e3a;return _0x26f4af;})['then'](respondWithFilteredResult(_0x10ff2f,_0x45f369))[_0x719b('0x43')](handleError(_0x10ff2f,null));};exports[_0x719b('0x44')]=function(_0x17145a,_0x143722){var _0x539338={'raw':![],'where':{'id':_0x17145a['params']['id']}},_0x438d7b={};_0x438d7b[_0x719b('0x2e')]=_[_0x719b('0x2f')](db[_0x719b('0x40')]['rawAttributes']);_0x438d7b[_0x719b('0x30')]=_['keys'](_0x17145a[_0x719b('0x30')]);_0x438d7b[_0x719b('0x31')]=_[_0x719b('0x32')](_0x438d7b[_0x719b('0x2e')],_0x438d7b[_0x719b('0x30')]);_0x539338[_0x719b('0x34')]=_[_0x719b('0x32')](_0x438d7b['model'],qs[_0x719b('0x33')](_0x17145a[_0x719b('0x30')][_0x719b('0x33')]));_0x539338[_0x719b('0x34')]=_0x539338['attributes'][_0x719b('0x35')]?_0x539338[_0x719b('0x34')]:_0x438d7b[_0x719b('0x2e')];if(_0x17145a[_0x719b('0x30')]['includeAll']){_0x539338[_0x719b('0x45')]=[{'all':!![]}];}_0x539338=_[_0x719b('0x3d')]({},_0x539338,_0x17145a[_0x719b('0x3f')]);return db[_0x719b('0x40')][_0x719b('0x46')](_0x539338)[_0x719b('0x22')](handleEntityNotFound(_0x143722,null))[_0x719b('0x22')](respondWithResult(_0x143722,null))[_0x719b('0x43')](handleError(_0x143722,null));};exports[_0x719b('0x47')]=function(_0x4a53d6,_0x29f60d){return db['Schedule'][_0x719b('0x47')](_0x4a53d6[_0x719b('0x48')],{})[_0x719b('0x22')](function(_0x509b15){var _0x10bcec=_0x4a53d6[_0x719b('0x49')][_0x719b('0x23')]({'plain':!![]});if(!_0x10bcec)throw new Error(_0x719b('0x4a'));if(_0x10bcec[_0x719b('0x4b')]===_0x719b('0x49')){var _0x4674f2=_0x509b15['get']({'plain':!![]});var _0x25d5cd=_0x719b('0x4c');return db[_0x719b('0x4d')][_0x719b('0x46')]({'where':{'name':_0x25d5cd,'userProfileId':_0x10bcec[_0x719b('0x4e')]},'raw':!![]})[_0x719b('0x22')](function(_0x56bb82){if(_0x56bb82&&_0x56bb82[_0x719b('0x4f')]===0x0){return db[_0x719b('0x50')]['create']({'name':_0x4674f2[_0x719b('0x27')],'resourceId':_0x4674f2['id'],'type':_0x56bb82[_0x719b('0x27')],'sectionId':_0x56bb82['id']},{})[_0x719b('0x22')](function(){return _0x509b15;});}else{return _0x509b15;}})['catch'](function(_0x15ef6b){logger[_0x719b('0x25')](_0x719b('0x51'),_0x15ef6b);throw _0x15ef6b;});}return _0x509b15;})[_0x719b('0x22')](respondWithResult(_0x29f60d,0xc9))[_0x719b('0x43')](handleError(_0x29f60d,null));};exports[_0x719b('0x21')]=function(_0x1637ea,_0x527c9e){if(_0x1637ea[_0x719b('0x48')]['id']){delete _0x1637ea[_0x719b('0x48')]['id'];}return db[_0x719b('0x40')][_0x719b('0x46')]({'where':{'id':_0x1637ea['params']['id']}})[_0x719b('0x22')](handleEntityNotFound(_0x527c9e,null))[_0x719b('0x22')](saveUpdates(_0x1637ea['body'],null))[_0x719b('0x22')](respondWithResult(_0x527c9e,null))[_0x719b('0x43')](handleError(_0x527c9e,null));};exports['destroy']=function(_0xab7772,_0x88fed9){return db[_0x719b('0x40')][_0x719b('0x46')]({'where':{'id':_0xab7772[_0x719b('0x52')]['id']}})[_0x719b('0x22')](handleEntityNotFound(_0x88fed9,null))[_0x719b('0x22')](removeEntity(_0x88fed9,null))['catch'](handleError(_0x88fed9,null));};exports['run']=function(_0x2062ed,_0x576eed,_0x1e3ec6){var _0x1bef5e=require(_0x719b('0x53'));return db[_0x719b('0x40')][_0x719b('0x46')]({'where':{'id':_0x2062ed[_0x719b('0x52')]['id']},'raw':!![]})[_0x719b('0x22')](handleEntityNotFound(_0x576eed,null))['then'](function(){_0x1bef5e[_0x719b('0x54')](_0x2062ed[_0x719b('0x52')]['id']);})[_0x719b('0x22')](respondWithStatusCode(_0x576eed,null))[_0x719b('0x43')](handleError(_0x576eed,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4e94458..df54e3b 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 _0xf99a=['exports','define','Schedule','tools_schedules','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./schedule.attributes'];(function(_0x34d5f5,_0x21cc56){var _0x2e5103=function(_0x290825){while(--_0x290825){_0x34d5f5['push'](_0x34d5f5['shift']());}};_0x2e5103(++_0x21cc56);}(_0xf99a,0x170));var _0xaf99=function(_0x10f888,_0x555004){_0x10f888=_0x10f888-0x0;var _0x339098=_0xf99a[_0x10f888];return _0x339098;};'use strict';var _=require(_0xaf99('0x0'));var util=require(_0xaf99('0x1'));var logger=require(_0xaf99('0x2'))(_0xaf99('0x3'));var moment=require(_0xaf99('0x4'));var BPromise=require('bluebird');var rp=require(_0xaf99('0x5'));var fs=require('fs');var path=require(_0xaf99('0x6'));var rimraf=require(_0xaf99('0x7'));var config=require('../../config/environment');var attributes=require(_0xaf99('0x8'));module[_0xaf99('0x9')]=function(_0x33c780,_0x33aa2d){return _0x33c780[_0xaf99('0xa')](_0xaf99('0xb'),attributes,{'tableName':_0xaf99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8afd=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./schedule.attributes','define','Schedule','tools_schedules','lodash'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x8afd,0xcb));var _0xd8af=function(_0x3cc6aa,_0x2270fa){_0x3cc6aa=_0x3cc6aa-0x0;var _0x4d1d00=_0x8afd[_0x3cc6aa];return _0x4d1d00;};'use strict';var _=require(_0xd8af('0x0'));var util=require('util');var logger=require(_0xd8af('0x1'))(_0xd8af('0x2'));var moment=require(_0xd8af('0x3'));var BPromise=require(_0xd8af('0x4'));var rp=require(_0xd8af('0x5'));var fs=require('fs');var path=require(_0xd8af('0x6'));var rimraf=require(_0xd8af('0x7'));var config=require('../../config/environment');var attributes=require(_0xd8af('0x8'));module['exports']=function(_0x444ecf,_0x2c1d44){return _0x444ecf[_0xd8af('0x9')](_0xd8af('0xa'),attributes,{'tableName':_0xd8af('0xb'),'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 23442c7..08ea686 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 _0xf299=['debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x162c67,_0x5486e1){var _0x25e34d=function(_0xc52155){while(--_0xc52155){_0x162c67['push'](_0x162c67['shift']());}};_0x25e34d(++_0x5486e1);}(_0xf299,0x1b2));var _0x9f29=function(_0x1ace08,_0xee47ed){_0x1ace08=_0x1ace08-0x0;var _0x5d9a2e=_0xf299[_0x1ace08];return _0x5d9a2e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9f29('0x0'));var BPromise=require(_0x9f29('0x1'));var rs=require(_0x9f29('0x2'));var fs=require('fs');var Redis=require(_0x9f29('0x3'));var db=require(_0x9f29('0x4'))['db'];var utils=require(_0x9f29('0x5'));var logger=require(_0x9f29('0x6'))(_0x9f29('0x7'));var config=require(_0x9f29('0x8'));var jayson=require(_0x9f29('0x9'));var client=jayson[_0x9f29('0xa')][_0x9f29('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15ce2b,_0x23fce7,_0x515a15){return new BPromise(function(_0x3363cd,_0x4851a5){return client[_0x9f29('0xc')](_0x15ce2b,_0x515a15)[_0x9f29('0xd')](function(_0x4acb90){logger[_0x9f29('0xe')]('Schedule,\x20%s,\x20%s',_0x23fce7,_0x9f29('0xf'));logger[_0x9f29('0x10')](_0x9f29('0x11'),_0x23fce7,_0x9f29('0xf'),JSON[_0x9f29('0x12')](_0x4acb90));if(_0x4acb90['error']){if(_0x4acb90[_0x9f29('0x13')][_0x9f29('0x14')]===0x1f4){logger[_0x9f29('0x13')](_0x9f29('0x15'),_0x23fce7,_0x4acb90[_0x9f29('0x13')][_0x9f29('0x16')]);return _0x4851a5(_0x4acb90[_0x9f29('0x13')][_0x9f29('0x16')]);}logger[_0x9f29('0x13')](_0x9f29('0x15'),_0x23fce7,_0x4acb90[_0x9f29('0x13')]['message']);return _0x3363cd(_0x4acb90[_0x9f29('0x13')][_0x9f29('0x16')]);}else{logger[_0x9f29('0xe')](_0x9f29('0x15'),_0x23fce7,'request\x20sent');_0x3363cd(_0x4acb90[_0x9f29('0x17')][_0x9f29('0x16')]);}})[_0x9f29('0x18')](function(_0xed01f4){logger[_0x9f29('0x13')](_0x9f29('0x15'),_0x23fce7,_0xed01f4);_0x4851a5(_0xed01f4);});});} \ No newline at end of file +var _0xbcb6=['request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s'];(function(_0x12f695,_0x42a3f1){var _0x438420=function(_0x3abefb){while(--_0x3abefb){_0x12f695['push'](_0x12f695['shift']());}};_0x438420(++_0x42a3f1);}(_0xbcb6,0x18e));var _0x6bcb=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0xbcb6[_0x413b4d];return _0x8b810a;};'use strict';var _=require(_0x6bcb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6bcb('0x1'));var rs=require(_0x6bcb('0x2'));var fs=require('fs');var Redis=require(_0x6bcb('0x3'));var db=require(_0x6bcb('0x4'))['db'];var utils=require(_0x6bcb('0x5'));var logger=require(_0x6bcb('0x6'))(_0x6bcb('0x7'));var config=require(_0x6bcb('0x8'));var jayson=require(_0x6bcb('0x9'));var client=jayson[_0x6bcb('0xa')][_0x6bcb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46287d,_0x47de2b,_0x6ca3fd){return new BPromise(function(_0x44a6e3,_0x20786c){return client[_0x6bcb('0xc')](_0x46287d,_0x6ca3fd)[_0x6bcb('0xd')](function(_0x232449){logger[_0x6bcb('0xe')](_0x6bcb('0xf'),_0x47de2b,_0x6bcb('0x10'));logger['debug'](_0x6bcb('0x11'),_0x47de2b,_0x6bcb('0x10'),JSON[_0x6bcb('0x12')](_0x232449));if(_0x232449[_0x6bcb('0x13')]){if(_0x232449['error'][_0x6bcb('0x14')]===0x1f4){logger['error'](_0x6bcb('0xf'),_0x47de2b,_0x232449[_0x6bcb('0x13')][_0x6bcb('0x15')]);return _0x20786c(_0x232449[_0x6bcb('0x13')][_0x6bcb('0x15')]);}logger[_0x6bcb('0x13')](_0x6bcb('0xf'),_0x47de2b,_0x232449[_0x6bcb('0x13')][_0x6bcb('0x15')]);return _0x44a6e3(_0x232449['error'][_0x6bcb('0x15')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x47de2b,_0x6bcb('0x10'));_0x44a6e3(_0x232449['result'][_0x6bcb('0x15')]);}})[_0x6bcb('0x16')](function(_0x7f446f){logger[_0x6bcb('0x13')]('Schedule,\x20%s,\x20%s',_0x47de2b,_0x7f446f);_0x20786c(_0x7f446f);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index b01eeec..e8921fc 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 _0x6519=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6519,0x112));var _0x9651=function(_0x4e1211,_0x1c0e26){_0x4e1211=_0x4e1211-0x0;var _0x4ae887=_0x6519[_0x4e1211];return _0x4ae887;};'use strict';var multer=require(_0x9651('0x0'));var util=require(_0x9651('0x1'));var path=require(_0x9651('0x2'));var timeout=require(_0x9651('0x3'));var express=require(_0x9651('0x4'));var router=express['Router']();var fs_extra=require(_0x9651('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9651('0x6'));var config=require(_0x9651('0x7'));var controller=require('./screenRecording.controller');router[_0x9651('0x8')]('/',auth[_0x9651('0x9')](),controller[_0x9651('0xa')]);router[_0x9651('0x8')](_0x9651('0xb'),auth['isAuthenticated'](),controller[_0x9651('0xc')]);router['get'](_0x9651('0xd'),auth['isAuthenticated'](),controller[_0x9651('0xe')]);router[_0x9651('0x8')](_0x9651('0xf'),auth[_0x9651('0x9')](),controller['download']);router['post']('/',auth[_0x9651('0x9')](),controller[_0x9651('0x10')]);router[_0x9651('0x11')](_0x9651('0xd'),auth['isAuthenticated'](),controller[_0x9651('0x12')]);router[_0x9651('0x13')](_0x9651('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1fa2=['connect-timeout','express','Router','../../components/auth/service','./screenRecording.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','post','update','destroy','exports','multer','util','path'];(function(_0x8ed84b,_0xe47f3d){var _0xc4a42d=function(_0x4a2de5){while(--_0x4a2de5){_0x8ed84b['push'](_0x8ed84b['shift']());}};_0xc4a42d(++_0xe47f3d);}(_0x1fa2,0x6f));var _0x21fa=function(_0x2ec269,_0x46be27){_0x2ec269=_0x2ec269-0x0;var _0x4430e6=_0x1fa2[_0x2ec269];return _0x4430e6;};'use strict';var multer=require(_0x21fa('0x0'));var util=require(_0x21fa('0x1'));var path=require(_0x21fa('0x2'));var timeout=require(_0x21fa('0x3'));var express=require(_0x21fa('0x4'));var router=express[_0x21fa('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x21fa('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x21fa('0x7'));router[_0x21fa('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21fa('0x8')](_0x21fa('0x9'),auth['isAuthenticated'](),controller[_0x21fa('0xa')]);router[_0x21fa('0x8')](_0x21fa('0xb'),auth[_0x21fa('0xc')](),controller[_0x21fa('0xd')]);router[_0x21fa('0x8')](_0x21fa('0xe'),auth[_0x21fa('0xc')](),controller['download']);router[_0x21fa('0xf')]('/',auth[_0x21fa('0xc')](),controller['create']);router['put'](_0x21fa('0xb'),auth[_0x21fa('0xc')](),controller[_0x21fa('0x10')]);router['delete']('/:id',auth[_0x21fa('0xc')](),controller[_0x21fa('0x11')]);module[_0x21fa('0x12')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 36f0270..41aa31f 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 _0x7a12=['setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7a12,0xe8));var _0x27a1=function(_0x25d029,_0xfd3252){_0x25d029=_0x25d029-0x0;var _0x40343f=_0x7a12[_0x25d029];return _0x40343f;};'use strict';var Sequelize=require(_0x27a1('0x0'));var moment=require(_0x27a1('0x1'));var path=require(_0x27a1('0x2'));var config=require(_0x27a1('0x3'));module[_0x27a1('0x4')]={'format':{'type':Sequelize[_0x27a1('0x5')],'get':function(){return this[_0x27a1('0x6')](_0x27a1('0x7'))?path['extname'](this[_0x27a1('0x6')](_0x27a1('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x27a1('0x8')]},'channel':{'type':Sequelize[_0x27a1('0x8')]},'value':{'type':Sequelize[_0x27a1('0x8')],'set':function(_0xed784f){var _0x4a4e2c=_0xed784f[_0x27a1('0x9')](/\\/g,'/');this[_0x27a1('0xa')]('value',_0x4a4e2c);}},'rating':{'type':Sequelize[_0x27a1('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x27a1('0xb')],'set':function(_0x586984){this[_0x27a1('0xa')](_0x27a1('0xc'),moment()[_0x27a1('0xd')](_0x586984,'ms'));this['setDataValue'](_0x27a1('0xe'),moment());this[_0x27a1('0xa')](_0x27a1('0xf'),_0x586984);}},'startedAt':{'type':Sequelize[_0x27a1('0x10')],'get':function(){return moment(this[_0x27a1('0x6')](_0x27a1('0xc')))[_0x27a1('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x27a1('0x12')]();}},'closedAt':{'type':Sequelize[_0x27a1('0x10')],'get':function(){return moment(this[_0x27a1('0x6')](_0x27a1('0xe')))['format'](_0x27a1('0x13'))[_0x27a1('0x12')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x27a1('0x14')))[_0x27a1('0x11')]('MM-DD-YYYY\x20HH:mm')[_0x27a1('0x12')]();}},'updatedAt':{'type':Sequelize[_0x27a1('0x10')],'get':function(){return moment(this['getDataValue'](_0x27a1('0x15')))[_0x27a1('0x11')](_0x27a1('0x13'))[_0x27a1('0x12')]();}}}; \ No newline at end of file +var _0xa057=['INTEGER','startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','getDataValue','createdAt','sequelize','moment','../../config/environment','exports','VIRTUAL','value','extname','STRING','setDataValue'];(function(_0x54ea96,_0x282510){var _0x343652=function(_0x5d6a93){while(--_0x5d6a93){_0x54ea96['push'](_0x54ea96['shift']());}};_0x343652(++_0x282510);}(_0xa057,0x123));var _0x7a05=function(_0x4ee222,_0x1e9b93){_0x4ee222=_0x4ee222-0x0;var _0x54d7ae=_0xa057[_0x4ee222];return _0x54d7ae;};'use strict';var Sequelize=require(_0x7a05('0x0'));var moment=require(_0x7a05('0x1'));var path=require('path');var config=require(_0x7a05('0x2'));module[_0x7a05('0x3')]={'format':{'type':Sequelize[_0x7a05('0x4')],'get':function(){return this['getDataValue'](_0x7a05('0x5'))?path[_0x7a05('0x6')](this['getDataValue'](_0x7a05('0x5'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x7a05('0x7')],'set':function(_0x19e056){var _0x2572af=_0x19e056['replace'](/\\/g,'/');this[_0x7a05('0x8')](_0x7a05('0x5'),_0x2572af);}},'rating':{'type':Sequelize[_0x7a05('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x31841c){this[_0x7a05('0x8')](_0x7a05('0xa'),moment()[_0x7a05('0xb')](_0x31841c,'ms'));this[_0x7a05('0x8')](_0x7a05('0xc'),moment());this['setDataValue'](_0x7a05('0xd'),_0x31841c);}},'startedAt':{'type':Sequelize[_0x7a05('0xe')],'get':function(){return moment(this['getDataValue']('startedAt'))[_0x7a05('0xf')](_0x7a05('0x10'))['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x7a05('0xc')))[_0x7a05('0xf')](_0x7a05('0x10'))[_0x7a05('0x11')]();}},'createdAt':{'type':Sequelize[_0x7a05('0xe')],'get':function(){return moment(this[_0x7a05('0x12')](_0x7a05('0x13')))[_0x7a05('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0x7a05('0xe')],'get':function(){return moment(this[_0x7a05('0x12')]('updatedAt'))[_0x7a05('0xf')](_0x7a05('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 6b8183f..54b7ecf 100644 --- a/server/api/screenRecording/screenRecording.controller.js +++ b/server/api/screenRecording/screenRecording.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x5b7293,_0x1ee5dc){var _0x60fa03=function(_0x228596){while(--_0x228596){_0x5b7293['push'](_0x5b7293['shift']());}};_0x60fa03(++_0x1ee5dc);}(_0xed1f,0x6a));var _0xfed1=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xed1f[_0x3070dc];return _0x431489;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file +var _0xac31=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','ScreenRecording','rawAttributes','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','options','then','includeAll','findAll','rows','catch','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher'];(function(_0x51d129,_0x175d7d){var _0x44c377=function(_0x5ee454){while(--_0x5ee454){_0x51d129['push'](_0x51d129['shift']());}};_0x44c377(++_0x175d7d);}(_0xac31,0xca));var _0x1ac3=function(_0x32d861,_0x475ed1){_0x32d861=_0x32d861-0x0;var _0x4c22fc=_0xac31[_0x32d861];return _0x4c22fc;};'use strict';var emlformat=require(_0x1ac3('0x0'));var rimraf=require(_0x1ac3('0x1'));var zipdir=require(_0x1ac3('0x2'));var jsonpatch=require(_0x1ac3('0x3'));var rp=require(_0x1ac3('0x4'));var moment=require(_0x1ac3('0x5'));var BPromise=require(_0x1ac3('0x6'));var Mustache=require('mustache');var util=require(_0x1ac3('0x7'));var path=require(_0x1ac3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1ac3('0x9'));var fs=require('fs');var fs_extra=require(_0x1ac3('0xa'));var _=require(_0x1ac3('0xb'));var squel=require(_0x1ac3('0xc'));var crypto=require(_0x1ac3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1ac3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1ac3('0xf'));var Papa=require(_0x1ac3('0x10'));var Redis=require(_0x1ac3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1ac3('0x12'));var as=require(_0x1ac3('0x13'));var hardwareService=require(_0x1ac3('0x14'));var logger=require(_0x1ac3('0x15'))(_0x1ac3('0x16'));var utils=require(_0x1ac3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1ac3('0x18'));var db=require(_0x1ac3('0x19'))['db'];function respondWithStatusCode(_0x2eeabf,_0x2338b9){_0x2338b9=_0x2338b9||0xcc;return function(_0x50d3b6){if(_0x50d3b6){return _0x2eeabf[_0x1ac3('0x1a')](_0x2338b9);}return _0x2eeabf[_0x1ac3('0x1b')](_0x2338b9)[_0x1ac3('0x1c')]();};}function respondWithResult(_0x2def9f,_0x53cc35){_0x53cc35=_0x53cc35||0xc8;return function(_0x24bb5e){if(_0x24bb5e){return _0x2def9f[_0x1ac3('0x1b')](_0x53cc35)['json'](_0x24bb5e);}};}function respondWithFilteredResult(_0x29a7b3,_0x1f9641){return function(_0x38b52a){if(_0x38b52a){var _0x51f1e4=typeof _0x1f9641[_0x1ac3('0x1d')]===_0x1ac3('0x1e')&&typeof _0x1f9641[_0x1ac3('0x1f')]==='undefined';var _0x195683=_0x38b52a['count'];var _0x291616=_0x51f1e4?0x0:_0x1f9641[_0x1ac3('0x1d')];var _0x20091d=_0x51f1e4?_0x38b52a[_0x1ac3('0x20')]:_0x1f9641[_0x1ac3('0x1d')]+_0x1f9641['limit'];var _0x136e73;if(_0x20091d>=_0x195683){_0x20091d=_0x195683;_0x136e73=0xc8;}else{_0x136e73=0xce;}_0x29a7b3[_0x1ac3('0x1b')](_0x136e73);return _0x29a7b3[_0x1ac3('0x21')](_0x1ac3('0x22'),_0x291616+'-'+_0x20091d+'/'+_0x195683)['json'](_0x38b52a);}return null;};}function patchUpdates(_0x48d18a){return function(_0x2879d8){try{jsonpatch[_0x1ac3('0x23')](_0x2879d8,_0x48d18a,!![]);}catch(_0x14070b){return BPromise[_0x1ac3('0x24')](_0x14070b);}return _0x2879d8[_0x1ac3('0x25')]();};}function saveUpdates(_0x319988,_0x23b767){return function(_0x10912a){if(_0x10912a){return _0x10912a[_0x1ac3('0x26')](_0x319988)['then'](function(_0x1e277f){return _0x1e277f;});}return null;};}function removeEntity(_0x231b7f,_0x4b19f2){return function(_0x2b5182){if(_0x2b5182){return _0x2b5182[_0x1ac3('0x27')]()['then'](function(){_0x231b7f[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();});}};}function handleEntityNotFound(_0x145486,_0x2dfdb7){return function(_0x10db3d){if(!_0x10db3d){_0x145486['sendStatus'](0x194);}return _0x10db3d;};}function handleError(_0x5a2ab2,_0x503a64){_0x503a64=_0x503a64||0x1f4;return function(_0x528807){logger['error'](_0x528807[_0x1ac3('0x28')]);if(_0x528807['name']){delete _0x528807[_0x1ac3('0x29')];}_0x5a2ab2[_0x1ac3('0x1b')](_0x503a64)[_0x1ac3('0x2a')](_0x528807);};}exports[_0x1ac3('0x2b')]=function(_0x4b3d3c,_0x61441d){var _0x541da0={},_0x2ddd73={},_0x4000b0={'count':0x0,'rows':[]};var _0x440aed=_[_0x1ac3('0x2c')](db[_0x1ac3('0x2d')][_0x1ac3('0x2e')],function(_0x9c17c2){return{'name':_0x9c17c2['fieldName'],'type':_0x9c17c2[_0x1ac3('0x2f')][_0x1ac3('0x30')]};});_0x2ddd73[_0x1ac3('0x31')]=_[_0x1ac3('0x32')](_['map'](_0x440aed,_0x1ac3('0x29')),[_0x1ac3('0x33')]);_0x2ddd73[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4b3d3c[_0x1ac3('0x34')]);_0x2ddd73['filters']=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],_0x2ddd73[_0x1ac3('0x34')]);_0x541da0[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x2ddd73[_0x1ac3('0x31')],qs['fields'](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x541da0[_0x1ac3('0x37')]=_0x541da0[_0x1ac3('0x37')]['length']?_0x541da0[_0x1ac3('0x37')]:_0x2ddd73[_0x1ac3('0x31')];if(!_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x39')](_0x1ac3('0x3a'))){_0x541da0[_0x1ac3('0x1f')]=qs[_0x1ac3('0x1f')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x1f')]);_0x541da0['offset']=qs[_0x1ac3('0x1d')](_0x4b3d3c[_0x1ac3('0x34')]['offset']);}_0x541da0[_0x1ac3('0x3b')]=qs[_0x1ac3('0x3c')](_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x3c')]);_0x541da0[_0x1ac3('0x3d')]=qs[_0x1ac3('0x3e')](_[_0x1ac3('0x3f')](_0x4b3d3c[_0x1ac3('0x34')],_0x2ddd73['filters']),_0x440aed);if(_0x4b3d3c[_0x1ac3('0x34')]['filter']){_0x541da0[_0x1ac3('0x3d')]=_[_0x1ac3('0x40')](_0x541da0[_0x1ac3('0x3d')],{'$or':_[_0x1ac3('0x2c')](_0x440aed,function(_0x3141ae){if(_0x3141ae[_0x1ac3('0x2f')]!=='VIRTUAL'){var _0x3b5c1c={};_0x3b5c1c[_0x3141ae[_0x1ac3('0x29')]]={'$like':'%'+_0x4b3d3c[_0x1ac3('0x34')]['filter']+'%'};return _0x3b5c1c;}})});}_0x541da0=_[_0x1ac3('0x40')]({},_0x541da0,_0x4b3d3c[_0x1ac3('0x41')]);var _0x5cec6b={'where':_0x541da0[_0x1ac3('0x3d')]};return db[_0x1ac3('0x2d')][_0x1ac3('0x20')](_0x5cec6b)[_0x1ac3('0x42')](function(_0x466a45){_0x4000b0[_0x1ac3('0x20')]=_0x466a45;if(_0x4b3d3c[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x541da0['include']=[{'all':!![]}];}return db[_0x1ac3('0x2d')][_0x1ac3('0x44')](_0x541da0);})[_0x1ac3('0x42')](function(_0x254a77){_0x4000b0[_0x1ac3('0x45')]=_0x254a77;return _0x4000b0;})[_0x1ac3('0x42')](respondWithFilteredResult(_0x61441d,_0x541da0))[_0x1ac3('0x46')](handleError(_0x61441d,null));};exports['show']=function(_0x4edc4d,_0x2c2099){var _0x3f60ca={'raw':![],'where':{'id':_0x4edc4d[_0x1ac3('0x47')]['id']}},_0x4972d1={};_0x4972d1[_0x1ac3('0x31')]=_['keys'](db[_0x1ac3('0x2d')]['rawAttributes']);_0x4972d1[_0x1ac3('0x34')]=_[_0x1ac3('0x35')](_0x4edc4d[_0x1ac3('0x34')]);_0x4972d1[_0x1ac3('0x3e')]=_['intersection'](_0x4972d1[_0x1ac3('0x31')],_0x4972d1[_0x1ac3('0x34')]);_0x3f60ca[_0x1ac3('0x37')]=_[_0x1ac3('0x36')](_0x4972d1[_0x1ac3('0x31')],qs['fields'](_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x38')]));_0x3f60ca[_0x1ac3('0x37')]=_0x3f60ca[_0x1ac3('0x37')]['length']?_0x3f60ca[_0x1ac3('0x37')]:_0x4972d1[_0x1ac3('0x31')];if(_0x4edc4d[_0x1ac3('0x34')][_0x1ac3('0x43')]){_0x3f60ca['include']=[{'all':!![]}];}_0x3f60ca=_[_0x1ac3('0x40')]({},_0x3f60ca,_0x4edc4d[_0x1ac3('0x41')]);return db[_0x1ac3('0x2d')][_0x1ac3('0x48')](_0x3f60ca)['then'](handleEntityNotFound(_0x2c2099,null))[_0x1ac3('0x42')](respondWithResult(_0x2c2099,null))['catch'](handleError(_0x2c2099,null));};exports[_0x1ac3('0x49')]=function(_0x10bcaf,_0x2e3347){return db[_0x1ac3('0x2d')][_0x1ac3('0x49')](_0x10bcaf[_0x1ac3('0x4a')],{})[_0x1ac3('0x42')](respondWithResult(_0x2e3347,0xc9))['catch'](handleError(_0x2e3347,null));};exports['update']=function(_0xe8f33c,_0x249c2d){if(_0xe8f33c[_0x1ac3('0x4a')]['id']){delete _0xe8f33c['body']['id'];}delete _0xe8f33c['body']['duration'];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4b')];delete _0xe8f33c['body'][_0x1ac3('0x4c')];delete _0xe8f33c[_0x1ac3('0x4a')][_0x1ac3('0x4d')];return db[_0x1ac3('0x2d')]['find']({'where':{'id':_0xe8f33c['params']['id']}})[_0x1ac3('0x42')](handleEntityNotFound(_0x249c2d,null))[_0x1ac3('0x42')](saveUpdates(_0xe8f33c['body'],null))[_0x1ac3('0x42')](respondWithResult(_0x249c2d,null))['catch'](handleError(_0x249c2d,null));};exports['describe']=function(_0x2d628d,_0x220dd0){return db['ScreenRecording'][_0x1ac3('0x4e')]()['then'](respondWithResult(_0x220dd0,null))[_0x1ac3('0x46')](handleError(_0x220dd0,null));};exports[_0x1ac3('0x4f')]=function(_0x3586b9,_0x3a0320,_0x34ad43){var _0x40e9c7=require(_0x1ac3('0x50'));var _0x331374=![];var _0xeb7e49={};if(_0x3586b9[_0x1ac3('0x34')][_0x1ac3('0x2f')]&&_0x3586b9['query']['type']===_0x1ac3('0x51')){_0xeb7e49[_0x1ac3('0x51')]=_0x3586b9[_0x1ac3('0x47')]['id'];}else{_0xeb7e49['id']=_0x3586b9[_0x1ac3('0x47')]['id'];}return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':_0xeb7e49,'attributes':['id',_0x1ac3('0x4d')],'raw':!![]})[_0x1ac3('0x42')](handleEntityNotFound(_0x3a0320,null))[_0x1ac3('0x42')](function(_0x3149f6){if(_0x3149f6){var _0x541bba=path[_0x1ac3('0x52')](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x3149f6[_0x1ac3('0x4d')]);var _0x20c195=util['format'](_0x1ac3('0x55'),_0x541bba);if(fs[_0x1ac3('0x56')](_0x20c195)){_0x331374=!![];return _0x40e9c7['decryptFile'](_0x20c195,_0x541bba,config['secrets']['recording'])[_0x1ac3('0x42')](function(){return _0x3149f6;});}return _0x3149f6;}})[_0x1ac3('0x42')](function(_0x2a1f66){if(_0x2a1f66){var _0x5ad546=path[_0x1ac3('0x52')](config['root'],'server/files/screen_recordings',_0x2a1f66['value']);if(!fs['existsSync'](_0x5ad546)){throw new db[(_0x1ac3('0x57'))][(_0x1ac3('0x58'))](_0x1ac3('0x59'));}if(_0x2a1f66[_0x1ac3('0x5a')]){return _0x3a0320[_0x1ac3('0x4f')](_0x5ad546,_0x2a1f66['filename']+path[_0x1ac3('0x5b')](_0x5ad546),function(){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}else{return _0x3a0320['download'](_0x5ad546,function(_0x2bcb4b){if(_0x331374){fs[_0x1ac3('0x5c')](_0x5ad546);}});}}})[_0x1ac3('0x46')](function(_0x2e79b2){if(_0x2e79b2[_0x1ac3('0x5d')]==='ScreenRecording\x20not\x20found'){_0x3a0320[_0x1ac3('0x1b')](0x194)[_0x1ac3('0x2a')](_0x1ac3('0x5e'));}else{return handleError(_0x3a0320,null);}});};exports[_0x1ac3('0x27')]=function(_0x4cfa04,_0x19407a){return db[_0x1ac3('0x2d')][_0x1ac3('0x48')]({'where':{'id':_0x4cfa04[_0x1ac3('0x47')]['id']}})[_0x1ac3('0x42')](function(_0x1ac283){if(_['isNil'](_0x1ac283)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1ac283;})['then'](function(_0x582fe2){var _0x3b930b=path['join'](config[_0x1ac3('0x53')],_0x1ac3('0x54'),_0x582fe2[_0x1ac3('0x4d')]);logger[_0x1ac3('0x5f')](_0x1ac3('0x60'),_0x3b930b);if(!_[_0x1ac3('0x61')](_0x582fe2['value'])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')](_0x1ac3('0x62')+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}_0x3b930b=_0x3b930b+_0x1ac3('0x64');if(!_[_0x1ac3('0x61')](_0x582fe2[_0x1ac3('0x4d')])&&fs[_0x1ac3('0x56')](_0x3b930b)){logger[_0x1ac3('0x5f')]('File:\x20\x22'+_0x3b930b+_0x1ac3('0x63'));fs['unlinkSync'](_0x3b930b);}return _0x582fe2;})['then'](function(_0x402507){if(!_0x402507)throw new InternalError();return _0x402507[_0x1ac3('0x27')]();})[_0x1ac3('0x42')](function(){_0x19407a[_0x1ac3('0x1b')](0xcc)[_0x1ac3('0x1c')]();})[_0x1ac3('0x46')](handleError(_0x19407a,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index d509c14..c10bd65 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 _0x85ed=['ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0x85ed,0x1c9));var _0xd85e=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x85ed[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xd85e('0x0'));var util=require(_0xd85e('0x1'));var logger=require(_0xd85e('0x2'))(_0xd85e('0x3'));var moment=require(_0xd85e('0x4'));var BPromise=require(_0xd85e('0x5'));var rp=require(_0xd85e('0x6'));var fs=require('fs');var path=require(_0xd85e('0x7'));var rimraf=require(_0xd85e('0x8'));var config=require(_0xd85e('0x9'));var attributes=require(_0xd85e('0xa'));module['exports']=function(_0x230bd3,_0x4d1341){return _0x230bd3['define'](_0xd85e('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xd85e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd338=['../../config/environment','./screenRecording.attributes','screen_recordings','interactionid','lodash','../../config/logger','api','path','rimraf'];(function(_0x1692ad,_0x29f8b8){var _0x28e8d1=function(_0x54860b){while(--_0x54860b){_0x1692ad['push'](_0x1692ad['shift']());}};_0x28e8d1(++_0x29f8b8);}(_0xd338,0x1e1));var _0x8d33=function(_0x12c280,_0x51dd07){_0x12c280=_0x12c280-0x0;var _0x3638d3=_0xd338[_0x12c280];return _0x3638d3;};'use strict';var _=require(_0x8d33('0x0'));var util=require('util');var logger=require(_0x8d33('0x1'))(_0x8d33('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d33('0x3'));var rimraf=require(_0x8d33('0x4'));var config=require(_0x8d33('0x5'));var attributes=require(_0x8d33('0x6'));module['exports']=function(_0x51a9a3,_0x332f1b){return _0x51a9a3['define']('ScreenRecording',attributes,{'tableName':_0x8d33('0x7'),'paranoid':![],'indexes':[{'name':_0x8d33('0x8'),'fields':[_0x8d33('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 27e9564..1c373a0 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 _0x15e1=['request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x57d234,_0x34ba9c){var _0x46741c=function(_0x441165){while(--_0x441165){_0x57d234['push'](_0x57d234['shift']());}};_0x46741c(++_0x34ba9c);}(_0x15e1,0x144));var _0x115e=function(_0x2187c7,_0x10016e){_0x2187c7=_0x2187c7-0x0;var _0x5281b8=_0x15e1[_0x2187c7];return _0x5281b8;};'use strict';var _=require(_0x115e('0x0'));var util=require(_0x115e('0x1'));var moment=require(_0x115e('0x2'));var BPromise=require(_0x115e('0x3'));var rs=require(_0x115e('0x4'));var fs=require('fs');var Redis=require(_0x115e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x115e('0x6'))(_0x115e('0x7'));var config=require(_0x115e('0x8'));var jayson=require(_0x115e('0x9'));var client=jayson[_0x115e('0xa')][_0x115e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x209e0f,_0x5ea6be,_0x18591d){return new BPromise(function(_0x3e5577,_0x4914ef){return client[_0x115e('0xc')](_0x209e0f,_0x18591d)[_0x115e('0xd')](function(_0x14e053){logger['info'](_0x115e('0xe'),_0x5ea6be,_0x115e('0xf'));logger[_0x115e('0x10')](_0x115e('0x11'),_0x5ea6be,_0x115e('0xf'),JSON['stringify'](_0x14e053));if(_0x14e053[_0x115e('0x12')]){if(_0x14e053['error'][_0x115e('0x13')]===0x1f4){logger[_0x115e('0x12')](_0x115e('0xe'),_0x5ea6be,_0x14e053[_0x115e('0x12')]['message']);return _0x4914ef(_0x14e053[_0x115e('0x12')][_0x115e('0x14')]);}logger['error'](_0x115e('0xe'),_0x5ea6be,_0x14e053[_0x115e('0x12')][_0x115e('0x14')]);return _0x3e5577(_0x14e053[_0x115e('0x12')]['message']);}else{logger[_0x115e('0x15')](_0x115e('0xe'),_0x5ea6be,_0x115e('0xf'));_0x3e5577(_0x14e053[_0x115e('0x16')]['message']);}})[_0x115e('0x17')](function(_0x587a57){logger[_0x115e('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x5ea6be,_0x587a57);_0x4914ef(_0x587a57);});});} \ No newline at end of file +var _0xae4c=['../../config/environment','client','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x129262,_0x59d075){var _0x24ed71=function(_0x58f598){while(--_0x58f598){_0x129262['push'](_0x129262['shift']());}};_0x24ed71(++_0x59d075);}(_0xae4c,0x10b));var _0xcae4=function(_0x33a0bb,_0x5c268b){_0x33a0bb=_0x33a0bb-0x0;var _0x229f56=_0xae4c[_0x33a0bb];return _0x229f56;};'use strict';var _=require(_0xcae4('0x0'));var util=require(_0xcae4('0x1'));var moment=require(_0xcae4('0x2'));var BPromise=require(_0xcae4('0x3'));var rs=require(_0xcae4('0x4'));var fs=require('fs');var Redis=require(_0xcae4('0x5'));var db=require(_0xcae4('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcae4('0x7'))(_0xcae4('0x8'));var config=require(_0xcae4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcae4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dff29,_0x6ca26a,_0x31b3f5){return new BPromise(function(_0x3925b6,_0x5346c8){return client[_0xcae4('0xb')](_0x5dff29,_0x31b3f5)[_0xcae4('0xc')](function(_0x24718e){logger[_0xcae4('0xd')](_0xcae4('0xe'),_0x6ca26a,_0xcae4('0xf'));logger[_0xcae4('0x10')](_0xcae4('0x11'),_0x6ca26a,_0xcae4('0xf'),JSON[_0xcae4('0x12')](_0x24718e));if(_0x24718e[_0xcae4('0x13')]){if(_0x24718e['error'][_0xcae4('0x14')]===0x1f4){logger['error'](_0xcae4('0xe'),_0x6ca26a,_0x24718e['error'][_0xcae4('0x15')]);return _0x5346c8(_0x24718e[_0xcae4('0x13')][_0xcae4('0x15')]);}logger['error'](_0xcae4('0xe'),_0x6ca26a,_0x24718e[_0xcae4('0x13')][_0xcae4('0x15')]);return _0x3925b6(_0x24718e[_0xcae4('0x13')][_0xcae4('0x15')]);}else{logger[_0xcae4('0xd')]('ScreenRecording,\x20%s,\x20%s',_0x6ca26a,_0xcae4('0xf'));_0x3925b6(_0x24718e['result'][_0xcae4('0x15')]);}})[_0xcae4('0x16')](function(_0x2793e3){logger[_0xcae4('0x13')](_0xcae4('0xe'),_0x6ca26a,_0x2793e3);_0x5346c8(_0x2793e3);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6a559e6..5a6476b 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 _0x040b=['addPreferred','put','isAuthenticated','update','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','format','%s%s','logo','post','single','addLogo','server/files/images/logos/','logologin','extname','file','addLogoLogin','originalname'];(function(_0x5a7d5f,_0x5695cb){var _0x5dcded=function(_0x13f053){while(--_0x13f053){_0x5a7d5f['push'](_0x5a7d5f['shift']());}};_0x5dcded(++_0x5695cb);}(_0x040b,0x1c7));var _0xb040=function(_0x4f93df,_0x2946d3){_0x4f93df=_0x4f93df-0x0;var _0x372405=_0x040b[_0x4f93df];return _0x372405;};'use strict';var multer=require(_0xb040('0x0'));var util=require('util');var path=require(_0xb040('0x1'));var timeout=require('connect-timeout');var express=require(_0xb040('0x2'));var router=express[_0xb040('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb040('0x4'));var interaction=require(_0xb040('0x5'));var config=require('../../config/environment');var controller=require(_0xb040('0x6'));router[_0xb040('0x7')]('/',auth['isAuthenticated'](),controller[_0xb040('0x8')]);router['get'](_0xb040('0x9'),controller[_0xb040('0xa')]);router['get'](_0xb040('0xb'),controller[_0xb040('0xc')]);router['get'](_0xb040('0xd'),controller[_0xb040('0xe')]);router[_0xb040('0x7')](_0xb040('0xf'),controller[_0xb040('0x10')]);router[_0xb040('0x7')](_0xb040('0x11'),controller[_0xb040('0x12')]);router[_0xb040('0x7')](_0xb040('0x13'),controller['getPreferred']);router[_0xb040('0x7')](_0xb040('0x14'),controller[_0xb040('0x15')]);var upload=multer({'storage':multer[_0xb040('0x16')]({'destination':function(_0x21b83a,_0xd32dd1,_0x40ef7f){_0x40ef7f(null,path[_0xb040('0x17')](config[_0xb040('0x18')],'server/files/images/logos/'));},'filename':function(_0x43827c,_0x2f8b86,_0x49dd5a){_0x49dd5a(null,util[_0xb040('0x19')](_0xb040('0x1a'),_0xb040('0x1b'),path['extname'](_0x2f8b86['originalname'])));}})});router[_0xb040('0x1c')](_0xb040('0xd'),upload[_0xb040('0x1d')]('file'),controller[_0xb040('0x1e')]);var upload=multer({'storage':multer[_0xb040('0x16')]({'destination':function(_0x5e9d72,_0x49c5f2,_0x250f07){_0x250f07(null,path[_0xb040('0x17')](config[_0xb040('0x18')],_0xb040('0x1f')));},'filename':function(_0xae2c4e,_0x284007,_0x4e1708){_0x4e1708(null,util[_0xb040('0x19')](_0xb040('0x1a'),_0xb040('0x20'),path[_0xb040('0x21')](_0x284007['originalname'])));}})});router[_0xb040('0x1c')](_0xb040('0xf'),upload[_0xb040('0x1d')](_0xb040('0x22')),controller[_0xb040('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3a8409,_0x264486,_0x3c15df){_0x3c15df(null,path[_0xb040('0x17')](config['root'],_0xb040('0x1f')));},'filename':function(_0x659331,_0x279601,_0x30af9){_0x30af9(null,util[_0xb040('0x19')](_0xb040('0x1a'),'preferred',path[_0xb040('0x21')](_0x279601[_0xb040('0x24')])));}})});router[_0xb040('0x1c')](_0xb040('0x13'),upload[_0xb040('0x1d')](_0xb040('0x22')),controller[_0xb040('0x25')]);var upload=multer({'storage':multer[_0xb040('0x16')]({'destination':function(_0x3ef2ce,_0x131efd,_0xe05142){_0xe05142(null,path[_0xb040('0x17')](config[_0xb040('0x18')],'server/files/images/logos/'));},'filename':function(_0x14c45c,_0x1a9b2c,_0x216a05){_0x216a05(null,util[_0xb040('0x19')](_0xb040('0x1a'),'favicon',path['extname'](_0x1a9b2c[_0xb040('0x24')])));}})});router['post'](_0xb040('0x14'),upload[_0xb040('0x1d')](_0xb040('0x22')),controller['addFavicon']);router[_0xb040('0x26')](_0xb040('0xb'),auth[_0xb040('0x27')](),controller[_0xb040('0x28')]);module['exports']=router; \ No newline at end of file +var _0xf8db=['index','/now','getDate','/:id','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','single','file','addLogo','join','logologin','post','addLogoLogin','preferred','favicon','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./setting.controller','get','isAuthenticated'];(function(_0x34450e,_0x350b08){var _0x348049=function(_0x43e6ef){while(--_0x43e6ef){_0x34450e['push'](_0x34450e['shift']());}};_0x348049(++_0x350b08);}(_0xf8db,0x11c));var _0xbf8d=function(_0x504c05,_0x2fe006){_0x504c05=_0x504c05-0x0;var _0x31c04a=_0xf8db[_0x504c05];return _0x31c04a;};'use strict';var multer=require(_0xbf8d('0x0'));var util=require(_0xbf8d('0x1'));var path=require(_0xbf8d('0x2'));var timeout=require(_0xbf8d('0x3'));var express=require(_0xbf8d('0x4'));var router=express[_0xbf8d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbf8d('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbf8d('0x7'));router[_0xbf8d('0x8')]('/',auth[_0xbf8d('0x9')](),controller[_0xbf8d('0xa')]);router[_0xbf8d('0x8')](_0xbf8d('0xb'),controller[_0xbf8d('0xc')]);router[_0xbf8d('0x8')](_0xbf8d('0xd'),controller[_0xbf8d('0xe')]);router[_0xbf8d('0x8')](_0xbf8d('0xf'),controller[_0xbf8d('0x10')]);router[_0xbf8d('0x8')](_0xbf8d('0x11'),controller[_0xbf8d('0x12')]);router[_0xbf8d('0x8')]('/:id/gdpr',controller[_0xbf8d('0x13')]);router['get'](_0xbf8d('0x14'),controller['getPreferred']);router[_0xbf8d('0x8')](_0xbf8d('0x15'),controller[_0xbf8d('0x16')]);var upload=multer({'storage':multer[_0xbf8d('0x17')]({'destination':function(_0x50db40,_0x156eda,_0x5cf7f1){_0x5cf7f1(null,path['join'](config[_0xbf8d('0x18')],_0xbf8d('0x19')));},'filename':function(_0x3efdde,_0x636ca5,_0x356a23){_0x356a23(null,util[_0xbf8d('0x1a')](_0xbf8d('0x1b'),_0xbf8d('0x1c'),path[_0xbf8d('0x1d')](_0x636ca5[_0xbf8d('0x1e')])));}})});router['post'](_0xbf8d('0xf'),upload[_0xbf8d('0x1f')](_0xbf8d('0x20')),controller[_0xbf8d('0x21')]);var upload=multer({'storage':multer[_0xbf8d('0x17')]({'destination':function(_0x594f95,_0x17db90,_0x20a24a){_0x20a24a(null,path[_0xbf8d('0x22')](config[_0xbf8d('0x18')],'server/files/images/logos/'));},'filename':function(_0x1a354a,_0x9be790,_0x41f3e7){_0x41f3e7(null,util[_0xbf8d('0x1a')](_0xbf8d('0x1b'),_0xbf8d('0x23'),path[_0xbf8d('0x1d')](_0x9be790[_0xbf8d('0x1e')])));}})});router[_0xbf8d('0x24')](_0xbf8d('0x11'),upload[_0xbf8d('0x1f')]('file'),controller[_0xbf8d('0x25')]);var upload=multer({'storage':multer[_0xbf8d('0x17')]({'destination':function(_0x139851,_0x5c1c41,_0x4f9cfa){_0x4f9cfa(null,path[_0xbf8d('0x22')](config[_0xbf8d('0x18')],_0xbf8d('0x19')));},'filename':function(_0x1f0a17,_0x36b45d,_0x4d0f77){_0x4d0f77(null,util[_0xbf8d('0x1a')](_0xbf8d('0x1b'),_0xbf8d('0x26'),path[_0xbf8d('0x1d')](_0x36b45d[_0xbf8d('0x1e')])));}})});router[_0xbf8d('0x24')](_0xbf8d('0x14'),upload[_0xbf8d('0x1f')](_0xbf8d('0x20')),controller['addPreferred']);var upload=multer({'storage':multer[_0xbf8d('0x17')]({'destination':function(_0x14ac7f,_0x16d673,_0x38375b){_0x38375b(null,path['join'](config[_0xbf8d('0x18')],_0xbf8d('0x19')));},'filename':function(_0x411a9b,_0x117f3c,_0x30c2f8){_0x30c2f8(null,util[_0xbf8d('0x1a')](_0xbf8d('0x1b'),_0xbf8d('0x27'),path[_0xbf8d('0x1d')](_0x117f3c[_0xbf8d('0x1e')])));}})});router['post'](_0xbf8d('0x15'),upload[_0xbf8d('0x1f')](_0xbf8d('0x20')),controller['addFavicon']);router['put'](_0xbf8d('0xd'),auth[_0xbf8d('0x9')](),controller[_0xbf8d('0x28')]);module[_0xbf8d('0x29')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index adb80c3..6f8dd45 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 _0x1261=['exports','INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED'];(function(_0x5922f7,_0x23885e){var _0x145529=function(_0x34bd66){while(--_0x34bd66){_0x5922f7['push'](_0x5922f7['shift']());}};_0x145529(++_0x23885e);}(_0x1261,0x144));var _0x1126=function(_0x2f0b82,_0xa07e26){_0x2f0b82=_0x2f0b82-0x0;var _0x5d6fb1=_0x1261[_0x2f0b82];return _0x5d6fb1;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'min_internal':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1126('0x1')](0xb),'unique':_0x1126('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x5')},'logo':{'type':Sequelize[_0x1126('0x4')]},'defaultLogo':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1126('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1126('0x4')]},'turnaddr':{'type':Sequelize[_0x1126('0x4')]},'turnusername':{'type':Sequelize[_0x1126('0x4')]},'turnpassword':{'type':Sequelize[_0x1126('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1126('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1126('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x1126('0x4')],'defaultValue':_0x1126('0x7')},'chatTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1126('0x4')]},'defaultPreferred':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1126('0x4')]},'defaultFavicon':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1126('0x1')]},'transcribeRegion':{'type':Sequelize[_0x1126('0x4')]},'sentiment':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1126('0x1')]},'sentimentRegion':{'type':Sequelize[_0x1126('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1126('0x1')](0x2)[_0x1126('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x1126('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1126('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x1126('0x1')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1126('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xdb28=['INTEGER','min_internal','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdb28,0x106));var _0x8db2=function(_0x287341,_0x4cd8df){_0x287341=_0x287341-0x0;var _0x2eb9d0=_0xdb28[_0x287341];return _0x2eb9d0;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'min_internal':{'type':Sequelize[_0x8db2('0x2')](0xb),'unique':_0x8db2('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x8db2('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x6')},'logo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x8db2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnaddr':{'type':Sequelize[_0x8db2('0x5')]},'turnusername':{'type':Sequelize[_0x8db2('0x5')]},'turnpassword':{'type':Sequelize[_0x8db2('0x5')]},'pageTitle':{'type':Sequelize[_0x8db2('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x8db2('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x8db2('0x8')},'enableEmailPreview':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x8db2('0x5')],'defaultValue':_0x8db2('0x9')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x8db2('0x5')]},'defaultPreferred':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x8db2('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x8db2('0x5')]},'defaultFavicon':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x8db2('0x2')]},'transcribeRegion':{'type':Sequelize[_0x8db2('0x5')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x8db2('0x2')]},'sentimentRegion':{'type':Sequelize[_0x8db2('0x5')]},'language':{'type':Sequelize[_0x8db2('0x5')]},'bucket':{'type':Sequelize[_0x8db2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x8db2('0xa')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x8db2('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x8db2('0x2')](0x2)[_0x8db2('0xa')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x8db2('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x8db2('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9029600..7fbdafc 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 _0xa7b4=['ValidationError','\x20not\x20found','getLicense','defaultFavicon','default_loginLogo.svg','Sequelize','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','moment','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','map','Setting','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','params','body','find','catch','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom'];(function(_0x201cde,_0x4c2a3b){var _0x277378=function(_0x2e5804){while(--_0x2e5804){_0x201cde['push'](_0x201cde['shift']());}};_0x277378(++_0x4c2a3b);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x587577,_0x53a237){_0x587577=_0x587577-0x0;var _0x75d167=_0xa7b4[_0x587577];return _0x75d167;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a7b('0x0'));var zipdir=require(_0x4a7b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a7b('0x2'));var moment=require(_0x4a7b('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x4a7b('0x4'));var sox=require(_0x4a7b('0x5'));var csv=require('to-csv');var ejs=require(_0x4a7b('0x6'));var fs=require('fs');var fs_extra=require(_0x4a7b('0x7'));var _=require(_0x4a7b('0x8'));var squel=require(_0x4a7b('0x9'));var crypto=require(_0x4a7b('0xa'));var jsforce=require(_0x4a7b('0xb'));var deskjs=require(_0x4a7b('0xc'));var toCsv=require(_0x4a7b('0xd'));var querystring=require(_0x4a7b('0xe'));var Papa=require(_0x4a7b('0xf'));var Redis=require(_0x4a7b('0x10'));var authService=require(_0x4a7b('0x11'));var qs=require(_0x4a7b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4a7b('0x13'));var logger=require('../../config/logger')(_0x4a7b('0x14'));var utils=require(_0x4a7b('0x15'));var config=require(_0x4a7b('0x16'));var licenseUtil=require(_0x4a7b('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x4a7b('0x18')][_0x4a7b('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x485a4b,_0x5010e4,_0xb8f2ec,_0x2a22c1){return new BPromise(function(_0x304264,_0x3cf97a){var _0x32e1ce=_0x2a22c1||client;return _0x32e1ce[_0x4a7b('0x1a')](_0x485a4b,_0xb8f2ec)[_0x4a7b('0x1b')](function(_0xbb6412){logger[_0x4a7b('0x1c')](_0x4a7b('0x1d'),_0x5010e4,'request\x20sent');logger[_0x4a7b('0x1e')](_0x4a7b('0x1f'),_0x5010e4,_0x4a7b('0x20'),JSON[_0x4a7b('0x21')](_0xbb6412));if(_0xbb6412[_0x4a7b('0x22')]){if(_0xbb6412['error']['code']===0x1f4){logger[_0x4a7b('0x22')]('Setting,\x20%s,\x20%s',_0x5010e4,_0xbb6412['error']['message']);return _0x3cf97a(_0xbb6412[_0x4a7b('0x22')][_0x4a7b('0x23')]);}logger['error']('Setting,\x20%s,\x20%s',_0x5010e4,_0xbb6412[_0x4a7b('0x22')][_0x4a7b('0x23')]);return _0x304264(_0xbb6412['error'][_0x4a7b('0x23')]);}else{logger[_0x4a7b('0x1c')](_0x4a7b('0x1d'),_0x5010e4,'request\x20sent');_0x304264(_0xbb6412[_0x4a7b('0x24')][_0x4a7b('0x23')]);}})['catch'](function(_0x51d283){logger[_0x4a7b('0x22')](_0x4a7b('0x1d'),_0x5010e4,_0x51d283);_0x3cf97a(_0x51d283);});});}function respondWithStatusCode(_0x22b8a1,_0x3d8c99){_0x3d8c99=_0x3d8c99||0xcc;return function(_0x5793f2){if(_0x5793f2){return _0x22b8a1[_0x4a7b('0x25')](_0x3d8c99);}return _0x22b8a1['status'](_0x3d8c99)[_0x4a7b('0x26')]();};}function respondWithResult(_0x40da3f,_0x4e359a){_0x4e359a=_0x4e359a||0xc8;return function(_0x5763e6){if(_0x5763e6){return _0x40da3f[_0x4a7b('0x27')](_0x4e359a)['json'](_0x5763e6);}};}function respondWithFilteredResult(_0x509009,_0x414209){return function(_0x6e8661){if(_0x6e8661){var _0x2c294c=typeof _0x414209[_0x4a7b('0x28')]===_0x4a7b('0x29')&&typeof _0x414209['limit']===_0x4a7b('0x29');var _0x110635=_0x6e8661[_0x4a7b('0x2a')];var _0x2f39d4=_0x2c294c?0x0:_0x414209[_0x4a7b('0x28')];var _0x5fa3c7=_0x2c294c?_0x6e8661[_0x4a7b('0x2a')]:_0x414209[_0x4a7b('0x28')]+_0x414209[_0x4a7b('0x2b')];var _0x2456ba;if(_0x5fa3c7>=_0x110635){_0x5fa3c7=_0x110635;_0x2456ba=0xc8;}else{_0x2456ba=0xce;}_0x509009[_0x4a7b('0x27')](_0x2456ba);return _0x509009[_0x4a7b('0x2c')](_0x4a7b('0x2d'),_0x2f39d4+'-'+_0x5fa3c7+'/'+_0x110635)[_0x4a7b('0x2e')](_0x6e8661);}return null;};}function patchUpdates(_0x48f450){return function(_0x169417){try{jsonpatch[_0x4a7b('0x2f')](_0x169417,_0x48f450,!![]);}catch(_0x388e48){return BPromise[_0x4a7b('0x30')](_0x388e48);}return _0x169417[_0x4a7b('0x31')]();};}function saveUpdates(_0x5a1445,_0x25a426){return function(_0x5d53ec){if(_0x5d53ec){return _0x5d53ec[_0x4a7b('0x32')](_0x5a1445)['then'](function(_0x33b5bb){return _0x33b5bb;});}return null;};}function removeEntity(_0xf134c1,_0x3fd437){return function(_0x58b2aa){if(_0x58b2aa){return _0x58b2aa[_0x4a7b('0x33')]()['then'](function(){_0xf134c1['status'](0xcc)[_0x4a7b('0x26')]();});}};}function handleEntityNotFound(_0x1a60d2,_0x57918c){return function(_0x3e617d){if(!_0x3e617d){_0x1a60d2[_0x4a7b('0x25')](0x194);}return _0x3e617d;};}function handleError(_0x23ba6,_0x5694b9){_0x5694b9=_0x5694b9||0x1f4;return function(_0x318c8c){logger[_0x4a7b('0x22')](_0x318c8c[_0x4a7b('0x34')]);if(_0x318c8c['name']){delete _0x318c8c[_0x4a7b('0x35')];}_0x23ba6[_0x4a7b('0x27')](_0x5694b9)[_0x4a7b('0x36')](_0x318c8c);};}exports['index']=function(_0x3b289c,_0x5507cc){var _0x201acb={},_0x2d1b25={},_0x12cecf={'count':0x0,'rows':[]};var _0x1fb089=_[_0x4a7b('0x37')](db[_0x4a7b('0x38')][_0x4a7b('0x39')],function(_0x474a25){return{'name':_0x474a25['fieldName'],'type':_0x474a25[_0x4a7b('0x3a')][_0x4a7b('0x3b')]};});_0x2d1b25[_0x4a7b('0x3c')]=_['map'](_0x1fb089,_0x4a7b('0x35'));_0x2d1b25[_0x4a7b('0x3d')]=_[_0x4a7b('0x3e')](_0x3b289c['query']);_0x2d1b25[_0x4a7b('0x3f')]=_[_0x4a7b('0x40')](_0x2d1b25['model'],_0x2d1b25[_0x4a7b('0x3d')]);_0x201acb['attributes']=_[_0x4a7b('0x40')](_0x2d1b25[_0x4a7b('0x3c')],qs[_0x4a7b('0x41')](_0x3b289c['query'][_0x4a7b('0x41')]));_0x201acb[_0x4a7b('0x42')]=_0x201acb[_0x4a7b('0x42')][_0x4a7b('0x43')]?_0x201acb[_0x4a7b('0x42')]:_0x2d1b25[_0x4a7b('0x3c')];if(!_0x3b289c[_0x4a7b('0x3d')][_0x4a7b('0x44')](_0x4a7b('0x45'))){_0x201acb[_0x4a7b('0x2b')]=qs[_0x4a7b('0x2b')](_0x3b289c['query'][_0x4a7b('0x2b')]);_0x201acb[_0x4a7b('0x28')]=qs[_0x4a7b('0x28')](_0x3b289c[_0x4a7b('0x3d')]['offset']);}_0x201acb[_0x4a7b('0x46')]=qs[_0x4a7b('0x47')](_0x3b289c[_0x4a7b('0x3d')][_0x4a7b('0x47')]);_0x201acb[_0x4a7b('0x48')]=qs['filters'](_['pick'](_0x3b289c[_0x4a7b('0x3d')],_0x2d1b25[_0x4a7b('0x3f')]),_0x1fb089);if(_0x3b289c[_0x4a7b('0x3d')][_0x4a7b('0x49')]){_0x201acb['where']=_['merge'](_0x201acb['where'],{'$or':_['map'](_0x1fb089,function(_0x20555d){if(_0x20555d[_0x4a7b('0x3a')]!==_0x4a7b('0x4a')){var _0x458cc3={};_0x458cc3[_0x20555d['name']]={'$like':'%'+_0x3b289c[_0x4a7b('0x3d')]['filter']+'%'};return _0x458cc3;}})});}_0x201acb=_[_0x4a7b('0x4b')]({},_0x201acb,_0x3b289c[_0x4a7b('0x4c')]);var _0x181e6c={'where':_0x201acb[_0x4a7b('0x48')]};return db[_0x4a7b('0x38')][_0x4a7b('0x2a')](_0x181e6c)[_0x4a7b('0x1b')](function(_0x91c99e){_0x12cecf[_0x4a7b('0x2a')]=_0x91c99e;if(_0x3b289c['query']['includeAll']){_0x201acb[_0x4a7b('0x4d')]=[{'all':!![]}];}return db[_0x4a7b('0x38')][_0x4a7b('0x4e')](_0x201acb);})['then'](function(_0x2edb85){_0x12cecf[_0x4a7b('0x4f')]=_0x2edb85;return _0x12cecf;})[_0x4a7b('0x1b')](respondWithFilteredResult(_0x5507cc,_0x201acb))['catch'](handleError(_0x5507cc,null));};exports['show']=function(_0x4fac11,_0x36557e){var _0x3b5d72={'raw':![],'where':{'id':_0x4fac11[_0x4a7b('0x50')]['id']}},_0x43e856={};_0x43e856['model']=_['keys'](db[_0x4a7b('0x38')]['rawAttributes']);_0x43e856[_0x4a7b('0x3d')]=_[_0x4a7b('0x3e')](_0x4fac11[_0x4a7b('0x3d')]);_0x43e856[_0x4a7b('0x3f')]=_[_0x4a7b('0x40')](_0x43e856[_0x4a7b('0x3c')],_0x43e856[_0x4a7b('0x3d')]);_0x3b5d72[_0x4a7b('0x42')]=_[_0x4a7b('0x40')](_0x43e856[_0x4a7b('0x3c')],qs[_0x4a7b('0x41')](_0x4fac11[_0x4a7b('0x3d')][_0x4a7b('0x41')]));_0x3b5d72[_0x4a7b('0x42')]=_0x3b5d72[_0x4a7b('0x42')][_0x4a7b('0x43')]?_0x3b5d72[_0x4a7b('0x42')]:_0x43e856[_0x4a7b('0x3c')];if(_0x4fac11[_0x4a7b('0x3d')]['includeAll']){_0x3b5d72[_0x4a7b('0x4d')]=[{'all':!![]}];}_0x3b5d72=_[_0x4a7b('0x4b')]({},_0x3b5d72,_0x4fac11[_0x4a7b('0x4c')]);return db[_0x4a7b('0x38')]['find'](_0x3b5d72)[_0x4a7b('0x1b')](handleEntityNotFound(_0x36557e,null))['then'](respondWithResult(_0x36557e,null))['catch'](handleError(_0x36557e,null));};exports[_0x4a7b('0x32')]=function(_0x18f6b1,_0x314980){if(_0x18f6b1[_0x4a7b('0x51')]['id']){delete _0x18f6b1[_0x4a7b('0x51')]['id'];}return db[_0x4a7b('0x38')][_0x4a7b('0x52')]({'where':{'id':_0x18f6b1[_0x4a7b('0x50')]['id']}})[_0x4a7b('0x1b')](handleEntityNotFound(_0x314980,null))['then'](saveUpdates(_0x18f6b1[_0x4a7b('0x51')],null))[_0x4a7b('0x1b')](respondWithResult(_0x314980,null))[_0x4a7b('0x53')](handleError(_0x314980,null));};exports['addLogo']=function(_0x24cc5d,_0x365c66,_0x5bc09b){if(_0x24cc5d['file']&&_0x24cc5d[_0x4a7b('0x54')][_0x4a7b('0x55')]){_0x24cc5d['body'][_0x4a7b('0x56')]=_0x24cc5d['file'][_0x4a7b('0x55')];}return db['Setting']['find']({'where':{'id':_0x24cc5d[_0x4a7b('0x50')]['id']}})[_0x4a7b('0x1b')](handleEntityNotFound(_0x365c66,null))[_0x4a7b('0x1b')](saveUpdates(_0x24cc5d[_0x4a7b('0x51')],null))['then'](respondWithResult(_0x365c66,null))[_0x4a7b('0x53')](handleError(_0x365c66,null));};exports[_0x4a7b('0x57')]=function(_0x54d0cd,_0x4e2ef9,_0x47db8c){if(_0x54d0cd[_0x4a7b('0x54')]&&_0x54d0cd[_0x4a7b('0x54')][_0x4a7b('0x55')]){_0x54d0cd[_0x4a7b('0x51')][_0x4a7b('0x58')]=_0x54d0cd[_0x4a7b('0x54')][_0x4a7b('0x55')];}return db[_0x4a7b('0x38')][_0x4a7b('0x52')]({'where':{'id':_0x54d0cd[_0x4a7b('0x50')]['id']}})['then'](handleEntityNotFound(_0x4e2ef9,null))[_0x4a7b('0x1b')](saveUpdates(_0x54d0cd[_0x4a7b('0x51')],null))[_0x4a7b('0x1b')](respondWithResult(_0x4e2ef9,null))['catch'](handleError(_0x4e2ef9,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x1ea116,_0x3c4d50,_0x5ef6b2){var _0x23d052=_0x4a7b('0x59');var _0x54b87e={'custom':![]};return utilLicense['getLicense']()[_0x4a7b('0x1b')](function(_0x3a71f0){if(_0x3a71f0){_0x54b87e=_0x3a71f0;}return db[_0x4a7b('0x38')][_0x4a7b('0x52')]({'where':{'id':_0x1ea116[_0x4a7b('0x50')]['id']},'attributes':['logo','loginLogo',_0x4a7b('0x5a'),_0x4a7b('0x5b'),_0x4a7b('0x5c'),_0x4a7b('0x5d'),_0x4a7b('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x3c4d50,null))[_0x4a7b('0x1b')](function(_0x5812fa){if(_0x5812fa){var _0x12b405=_0x5812fa[_0x4a7b('0x56')]&&fs[_0x4a7b('0x5f')](path[_0x4a7b('0x60')](config['root'],_0x23d052,_['toLower'](_0x5812fa[_0x4a7b('0x56')])))?path[_0x4a7b('0x60')](config[_0x4a7b('0x61')],_0x23d052,_[_0x4a7b('0x62')](_0x5812fa['logo'])):path[_0x4a7b('0x60')](config['root'],_0x23d052,_['toLower'](_0x4a7b('0x63')));var _0x434a50=_0x4a7b('0x64')+_[_0x4a7b('0x65')]('logo');if(_0x5812fa[_0x434a50]||!_0x54b87e[_0x4a7b('0x66')]){_0x12b405=path[_0x4a7b('0x60')](config['root'],_0x23d052,_[_0x4a7b('0x62')](_0x4a7b('0x63')));}if(!fs['existsSync'](_0x12b405)){throw new db['Sequelize'][(_0x4a7b('0x67'))](_[_0x4a7b('0x65')]('logo')+_0x4a7b('0x68'));}return _0x3c4d50['download'](_0x12b405);}})[_0x4a7b('0x53')](handleError(_0x3c4d50,null));};var utilLicense=require(_0x4a7b('0x17'));exports['getLogoLogin']=function(_0x393cb8,_0x5422ec,_0x5bb603){var _0x574c65='server/files/images/logos';var _0x376c59={'custom':![]};return utilLicense[_0x4a7b('0x69')]()['then'](function(_0x16edeb){if(_0x16edeb){_0x376c59=_0x16edeb;}return db[_0x4a7b('0x38')]['find']({'where':{'id':_0x393cb8[_0x4a7b('0x50')]['id']},'attributes':['logo',_0x4a7b('0x58'),_0x4a7b('0x5a'),'favicon',_0x4a7b('0x5c'),_0x4a7b('0x5d'),_0x4a7b('0x5e'),_0x4a7b('0x6a')],'raw':!![]});})['then'](handleEntityNotFound(_0x5422ec,null))['then'](function(_0x3ab581){if(_0x3ab581){var _0x338638=_0x3ab581[_0x4a7b('0x58')]&&fs[_0x4a7b('0x5f')](path['join'](config[_0x4a7b('0x61')],_0x574c65,_['toLower'](_0x3ab581[_0x4a7b('0x58')])))?path[_0x4a7b('0x60')](config[_0x4a7b('0x61')],_0x574c65,_[_0x4a7b('0x62')](_0x3ab581[_0x4a7b('0x58')])):path['join'](config[_0x4a7b('0x61')],_0x574c65,_[_0x4a7b('0x62')](_0x4a7b('0x6b')));var _0x1bca0e=_0x4a7b('0x64')+_[_0x4a7b('0x65')](_0x4a7b('0x58'));if(_0x3ab581[_0x1bca0e]||!_0x376c59[_0x4a7b('0x66')]){_0x338638=path[_0x4a7b('0x60')](config[_0x4a7b('0x61')],_0x574c65,_[_0x4a7b('0x62')](_0x4a7b('0x6b')));}if(!fs[_0x4a7b('0x5f')](_0x338638)){throw new db[(_0x4a7b('0x6c'))][(_0x4a7b('0x67'))](_[_0x4a7b('0x65')](_0x4a7b('0x58'))+_0x4a7b('0x68'));}return _0x5422ec[_0x4a7b('0x6d')](_0x338638);}})[_0x4a7b('0x53')](handleError(_0x5422ec,null));};exports[_0x4a7b('0x6e')]=function(_0x33c6d0,_0xe58de1){return db['Setting'][_0x4a7b('0x52')]({'where':{'id':_0x33c6d0[_0x4a7b('0x50')]['id']},'attributes':[_0x4a7b('0x6f')]})['then'](respondWithResult(_0xe58de1,null))[_0x4a7b('0x53')](handleError(_0xe58de1,null));};exports[_0x4a7b('0x70')]=function(_0x2a03e2,_0x1f9d04,_0x56565b){if(_0x2a03e2['file']&&_0x2a03e2[_0x4a7b('0x54')]['filename']){_0x2a03e2[_0x4a7b('0x51')][_0x4a7b('0x5a')]=_0x2a03e2[_0x4a7b('0x54')][_0x4a7b('0x55')];}return db[_0x4a7b('0x38')][_0x4a7b('0x52')]({'where':{'id':_0x2a03e2[_0x4a7b('0x50')]['id']}})[_0x4a7b('0x1b')](handleEntityNotFound(_0x1f9d04,null))[_0x4a7b('0x1b')](saveUpdates(_0x2a03e2[_0x4a7b('0x51')],null))[_0x4a7b('0x1b')](respondWithResult(_0x1f9d04,null))[_0x4a7b('0x53')](handleError(_0x1f9d04,null));};var utilLicense=require(_0x4a7b('0x17'));exports[_0x4a7b('0x71')]=function(_0x5020a5,_0x483f3b,_0x52f706){var _0x3641ed=_0x4a7b('0x59');var _0x2d9755={'custom':![]};return utilLicense[_0x4a7b('0x69')]()['then'](function(_0xd0e4fb){if(_0xd0e4fb){_0x2d9755=_0xd0e4fb;}return db[_0x4a7b('0x38')][_0x4a7b('0x52')]({'where':{'id':_0x5020a5['params']['id']},'attributes':[_0x4a7b('0x56'),'loginLogo',_0x4a7b('0x5a'),_0x4a7b('0x5b'),_0x4a7b('0x5c'),_0x4a7b('0x5d'),_0x4a7b('0x5e'),_0x4a7b('0x6a')],'raw':!![]});})[_0x4a7b('0x1b')](handleEntityNotFound(_0x483f3b,null))[_0x4a7b('0x1b')](function(_0x300e2d){if(_0x300e2d){var _0x4ea00b=_0x300e2d['preferred']&&fs[_0x4a7b('0x5f')](path[_0x4a7b('0x60')](config['root'],_0x3641ed,_[_0x4a7b('0x62')](_0x300e2d[_0x4a7b('0x5a')])))?path['join'](config[_0x4a7b('0x61')],_0x3641ed,_[_0x4a7b('0x62')](_0x300e2d[_0x4a7b('0x5a')])):path[_0x4a7b('0x60')](config[_0x4a7b('0x61')],_0x3641ed,_['toLower'](_0x4a7b('0x72')));var _0x50f43a=_0x4a7b('0x64')+_['upperFirst'](_0x4a7b('0x5a'));if(_0x300e2d[_0x50f43a]||!_0x2d9755['custom']||!_0x2d9755[_0x4a7b('0x5a')]){_0x4ea00b=path['join'](config[_0x4a7b('0x61')],_0x3641ed,_[_0x4a7b('0x62')](_0x4a7b('0x72')));}if(!fs[_0x4a7b('0x5f')](_0x4ea00b)){throw new db['Sequelize']['ValidationError'](_['upperFirst'](_0x4a7b('0x5a'))+_0x4a7b('0x68'));}return _0x483f3b[_0x4a7b('0x6d')](_0x4ea00b);}})[_0x4a7b('0x53')](handleError(_0x483f3b,null));};exports['addFavicon']=function(_0x5f30e3,_0xaa2d35,_0x145b9b){if(_0x5f30e3[_0x4a7b('0x54')]&&_0x5f30e3[_0x4a7b('0x54')][_0x4a7b('0x55')]){_0x5f30e3[_0x4a7b('0x51')][_0x4a7b('0x5b')]=_0x5f30e3[_0x4a7b('0x54')][_0x4a7b('0x55')];}return db[_0x4a7b('0x38')]['find']({'where':{'id':_0x5f30e3[_0x4a7b('0x50')]['id']}})[_0x4a7b('0x1b')](handleEntityNotFound(_0xaa2d35,null))[_0x4a7b('0x1b')](saveUpdates(_0x5f30e3[_0x4a7b('0x51')],null))[_0x4a7b('0x1b')](respondWithResult(_0xaa2d35,null))[_0x4a7b('0x53')](handleError(_0xaa2d35,null));};var utilLicense=require(_0x4a7b('0x17'));exports[_0x4a7b('0x73')]=function(_0xbf0715,_0x3ff1c0,_0x98ed19){var _0x3fe50b=_0x4a7b('0x59');var _0xbd8b21={'custom':![]};return utilLicense['getLicense']()[_0x4a7b('0x1b')](function(_0x4e657b){if(_0x4e657b){_0xbd8b21=_0x4e657b;}return db[_0x4a7b('0x38')][_0x4a7b('0x52')]({'where':{'id':_0xbf0715[_0x4a7b('0x50')]['id']},'attributes':[_0x4a7b('0x56'),_0x4a7b('0x58'),_0x4a7b('0x5a'),'favicon',_0x4a7b('0x5c'),'defaultLoginLogo',_0x4a7b('0x5e'),_0x4a7b('0x6a')],'raw':!![]});})['then'](handleEntityNotFound(_0x3ff1c0,null))[_0x4a7b('0x1b')](function(_0x38aba6){if(_0x38aba6){var _0x1c41e2=_0x38aba6['favicon']&&fs[_0x4a7b('0x5f')](path['join'](config[_0x4a7b('0x61')],_0x3fe50b,_[_0x4a7b('0x62')](_0x38aba6[_0x4a7b('0x5b')])))?path[_0x4a7b('0x60')](config[_0x4a7b('0x61')],_0x3fe50b,_[_0x4a7b('0x62')](_0x38aba6[_0x4a7b('0x5b')])):path[_0x4a7b('0x60')](config[_0x4a7b('0x61')],_0x3fe50b,_[_0x4a7b('0x62')](_0x4a7b('0x74')));var _0x35fb7b=_0x4a7b('0x64')+_['upperFirst']('favicon');if(_0x38aba6[_0x35fb7b]||!_0xbd8b21[_0x4a7b('0x66')]){_0x1c41e2=path[_0x4a7b('0x60')](config['root'],_0x3fe50b,_[_0x4a7b('0x62')](_0x4a7b('0x74')));}if(!fs[_0x4a7b('0x5f')](_0x1c41e2)){throw new db[(_0x4a7b('0x6c'))][(_0x4a7b('0x67'))](_[_0x4a7b('0x65')](_0x4a7b('0x5b'))+_0x4a7b('0x68'));}return _0x3ff1c0[_0x4a7b('0x6d')](_0x1c41e2);}})[_0x4a7b('0x53')](handleError(_0x3ff1c0,null));};exports[_0x4a7b('0x75')]=function(_0x3d7f43,_0x195893){var _0x59f367={'offset':moment()[_0x4a7b('0x76')]()};_0x59f367[_0x4a7b('0x77')]=moment()[_0x4a7b('0x76')](_0x59f367[_0x4a7b('0x28')])[_0x4a7b('0x78')](_0x4a7b('0x79'));return _0x195893[_0x4a7b('0x27')](0xc8)['send'](_0x59f367);}; \ No newline at end of file +var _0x6f3a=['crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','save','update','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','keys','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','getLogo','getLicense','preferred','defaultLogo','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','server/files/images/logos','favicon','defaultLoginLogo','default','upperFirst','custom','default_loginLogo.svg','download','gdpr','securePassword','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x353313,_0x5c3686){var _0x4cb750=function(_0x17ac7e){while(--_0x17ac7e){_0x353313['push'](_0x353313['shift']());}};_0x4cb750(++_0x5c3686);}(_0x6f3a,0xe7));var _0xa6f3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x6f3a[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa6f3('0x0'));var zipdir=require(_0xa6f3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa6f3('0x2'));var moment=require('moment');var BPromise=require(_0xa6f3('0x3'));var Mustache=require('mustache');var util=require(_0xa6f3('0x4'));var path=require(_0xa6f3('0x5'));var sox=require(_0xa6f3('0x6'));var csv=require(_0xa6f3('0x7'));var ejs=require(_0xa6f3('0x8'));var fs=require('fs');var fs_extra=require(_0xa6f3('0x9'));var _=require('lodash');var squel=require(_0xa6f3('0xa'));var crypto=require(_0xa6f3('0xb'));var jsforce=require(_0xa6f3('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa6f3('0xd'));var Redis=require('ioredis');var authService=require(_0xa6f3('0xe'));var qs=require(_0xa6f3('0xf'));var as=require(_0xa6f3('0x10'));var hardwareService=require(_0xa6f3('0x11'));var logger=require(_0xa6f3('0x12'))('api');var utils=require(_0xa6f3('0x13'));var config=require(_0xa6f3('0x14'));var licenseUtil=require(_0xa6f3('0x15'));var db=require(_0xa6f3('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa6f3('0x17')][_0xa6f3('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x390d0e,_0x474850,_0x23d861,_0x2d4571){return new BPromise(function(_0xd8c455,_0xfcc77){var _0x5e7a76=_0x2d4571||client;return _0x5e7a76['request'](_0x390d0e,_0x23d861)[_0xa6f3('0x19')](function(_0x3f1dfe){logger[_0xa6f3('0x1a')](_0xa6f3('0x1b'),_0x474850,_0xa6f3('0x1c'));logger[_0xa6f3('0x1d')](_0xa6f3('0x1e'),_0x474850,_0xa6f3('0x1c'),JSON[_0xa6f3('0x1f')](_0x3f1dfe));if(_0x3f1dfe[_0xa6f3('0x20')]){if(_0x3f1dfe[_0xa6f3('0x20')][_0xa6f3('0x21')]===0x1f4){logger[_0xa6f3('0x20')]('Setting,\x20%s,\x20%s',_0x474850,_0x3f1dfe[_0xa6f3('0x20')][_0xa6f3('0x22')]);return _0xfcc77(_0x3f1dfe[_0xa6f3('0x20')][_0xa6f3('0x22')]);}logger[_0xa6f3('0x20')](_0xa6f3('0x1b'),_0x474850,_0x3f1dfe[_0xa6f3('0x20')][_0xa6f3('0x22')]);return _0xd8c455(_0x3f1dfe[_0xa6f3('0x20')][_0xa6f3('0x22')]);}else{logger[_0xa6f3('0x1a')]('Setting,\x20%s,\x20%s',_0x474850,_0xa6f3('0x1c'));_0xd8c455(_0x3f1dfe[_0xa6f3('0x23')][_0xa6f3('0x22')]);}})[_0xa6f3('0x24')](function(_0x370fab){logger[_0xa6f3('0x20')](_0xa6f3('0x1b'),_0x474850,_0x370fab);_0xfcc77(_0x370fab);});});}function respondWithStatusCode(_0x517f32,_0x51a93c){_0x51a93c=_0x51a93c||0xcc;return function(_0x3628f9){if(_0x3628f9){return _0x517f32[_0xa6f3('0x25')](_0x51a93c);}return _0x517f32[_0xa6f3('0x26')](_0x51a93c)[_0xa6f3('0x27')]();};}function respondWithResult(_0x6526b2,_0x135452){_0x135452=_0x135452||0xc8;return function(_0x2e4814){if(_0x2e4814){return _0x6526b2[_0xa6f3('0x26')](_0x135452)[_0xa6f3('0x28')](_0x2e4814);}};}function respondWithFilteredResult(_0x2fb02f,_0x8632be){return function(_0x4b45b5){if(_0x4b45b5){var _0x4d13a8=typeof _0x8632be['offset']===_0xa6f3('0x29')&&typeof _0x8632be[_0xa6f3('0x2a')]==='undefined';var _0x467c50=_0x4b45b5['count'];var _0x3272fa=_0x4d13a8?0x0:_0x8632be[_0xa6f3('0x2b')];var _0x4273c6=_0x4d13a8?_0x4b45b5['count']:_0x8632be[_0xa6f3('0x2b')]+_0x8632be[_0xa6f3('0x2a')];var _0x4d3a6b;if(_0x4273c6>=_0x467c50){_0x4273c6=_0x467c50;_0x4d3a6b=0xc8;}else{_0x4d3a6b=0xce;}_0x2fb02f[_0xa6f3('0x26')](_0x4d3a6b);return _0x2fb02f[_0xa6f3('0x2c')](_0xa6f3('0x2d'),_0x3272fa+'-'+_0x4273c6+'/'+_0x467c50)['json'](_0x4b45b5);}return null;};}function patchUpdates(_0x282b01){return function(_0x5676ea){try{jsonpatch[_0xa6f3('0x2e')](_0x5676ea,_0x282b01,!![]);}catch(_0x4915fa){return BPromise['reject'](_0x4915fa);}return _0x5676ea[_0xa6f3('0x2f')]();};}function saveUpdates(_0x3b7c5d,_0x135ea5){return function(_0x4d83a3){if(_0x4d83a3){return _0x4d83a3[_0xa6f3('0x30')](_0x3b7c5d)[_0xa6f3('0x19')](function(_0x35aa1a){return _0x35aa1a;});}return null;};}function removeEntity(_0x3a74ef,_0x39bf99){return function(_0x3e0ff6){if(_0x3e0ff6){return _0x3e0ff6[_0xa6f3('0x31')]()['then'](function(){_0x3a74ef['status'](0xcc)[_0xa6f3('0x27')]();});}};}function handleEntityNotFound(_0x30f454,_0x156d54){return function(_0x40b302){if(!_0x40b302){_0x30f454['sendStatus'](0x194);}return _0x40b302;};}function handleError(_0x6ee5bc,_0x1d8598){_0x1d8598=_0x1d8598||0x1f4;return function(_0x47c1f6){logger[_0xa6f3('0x20')](_0x47c1f6[_0xa6f3('0x32')]);if(_0x47c1f6[_0xa6f3('0x33')]){delete _0x47c1f6[_0xa6f3('0x33')];}_0x6ee5bc[_0xa6f3('0x26')](_0x1d8598)['send'](_0x47c1f6);};}exports[_0xa6f3('0x34')]=function(_0x5b8abe,_0x4cc455){var _0x378e62={},_0x128e07={},_0x4f7fa2={'count':0x0,'rows':[]};var _0x24c5f5=_[_0xa6f3('0x35')](db[_0xa6f3('0x36')][_0xa6f3('0x37')],function(_0x46ad23){return{'name':_0x46ad23[_0xa6f3('0x38')],'type':_0x46ad23[_0xa6f3('0x39')][_0xa6f3('0x3a')]};});_0x128e07['model']=_[_0xa6f3('0x35')](_0x24c5f5,_0xa6f3('0x33'));_0x128e07['query']=_['keys'](_0x5b8abe[_0xa6f3('0x3b')]);_0x128e07[_0xa6f3('0x3c')]=_[_0xa6f3('0x3d')](_0x128e07[_0xa6f3('0x3e')],_0x128e07[_0xa6f3('0x3b')]);_0x378e62['attributes']=_[_0xa6f3('0x3d')](_0x128e07['model'],qs[_0xa6f3('0x3f')](_0x5b8abe['query'][_0xa6f3('0x3f')]));_0x378e62[_0xa6f3('0x40')]=_0x378e62[_0xa6f3('0x40')][_0xa6f3('0x41')]?_0x378e62['attributes']:_0x128e07[_0xa6f3('0x3e')];if(!_0x5b8abe['query']['hasOwnProperty'](_0xa6f3('0x42'))){_0x378e62['limit']=qs[_0xa6f3('0x2a')](_0x5b8abe[_0xa6f3('0x3b')][_0xa6f3('0x2a')]);_0x378e62[_0xa6f3('0x2b')]=qs[_0xa6f3('0x2b')](_0x5b8abe[_0xa6f3('0x3b')][_0xa6f3('0x2b')]);}_0x378e62[_0xa6f3('0x43')]=qs[_0xa6f3('0x44')](_0x5b8abe['query'][_0xa6f3('0x44')]);_0x378e62[_0xa6f3('0x45')]=qs['filters'](_[_0xa6f3('0x46')](_0x5b8abe[_0xa6f3('0x3b')],_0x128e07['filters']),_0x24c5f5);if(_0x5b8abe[_0xa6f3('0x3b')]['filter']){_0x378e62[_0xa6f3('0x45')]=_[_0xa6f3('0x47')](_0x378e62[_0xa6f3('0x45')],{'$or':_[_0xa6f3('0x35')](_0x24c5f5,function(_0x5a6ffa){if(_0x5a6ffa['type']!==_0xa6f3('0x48')){var _0x1cc204={};_0x1cc204[_0x5a6ffa[_0xa6f3('0x33')]]={'$like':'%'+_0x5b8abe[_0xa6f3('0x3b')][_0xa6f3('0x49')]+'%'};return _0x1cc204;}})});}_0x378e62=_[_0xa6f3('0x47')]({},_0x378e62,_0x5b8abe[_0xa6f3('0x4a')]);var _0xcf4770={'where':_0x378e62[_0xa6f3('0x45')]};return db['Setting'][_0xa6f3('0x4b')](_0xcf4770)['then'](function(_0x230eef){_0x4f7fa2[_0xa6f3('0x4b')]=_0x230eef;if(_0x5b8abe['query'][_0xa6f3('0x4c')]){_0x378e62[_0xa6f3('0x4d')]=[{'all':!![]}];}return db[_0xa6f3('0x36')][_0xa6f3('0x4e')](_0x378e62);})[_0xa6f3('0x19')](function(_0x5974b9){_0x4f7fa2[_0xa6f3('0x4f')]=_0x5974b9;return _0x4f7fa2;})['then'](respondWithFilteredResult(_0x4cc455,_0x378e62))['catch'](handleError(_0x4cc455,null));};exports['show']=function(_0x132f4c,_0x40a6ad){var _0x3df108={'raw':![],'where':{'id':_0x132f4c[_0xa6f3('0x50')]['id']}},_0x377a97={};_0x377a97[_0xa6f3('0x3e')]=_[_0xa6f3('0x51')](db['Setting']['rawAttributes']);_0x377a97[_0xa6f3('0x3b')]=_[_0xa6f3('0x51')](_0x132f4c[_0xa6f3('0x3b')]);_0x377a97[_0xa6f3('0x3c')]=_['intersection'](_0x377a97[_0xa6f3('0x3e')],_0x377a97[_0xa6f3('0x3b')]);_0x3df108[_0xa6f3('0x40')]=_[_0xa6f3('0x3d')](_0x377a97[_0xa6f3('0x3e')],qs['fields'](_0x132f4c[_0xa6f3('0x3b')][_0xa6f3('0x3f')]));_0x3df108[_0xa6f3('0x40')]=_0x3df108[_0xa6f3('0x40')][_0xa6f3('0x41')]?_0x3df108['attributes']:_0x377a97[_0xa6f3('0x3e')];if(_0x132f4c[_0xa6f3('0x3b')][_0xa6f3('0x4c')]){_0x3df108['include']=[{'all':!![]}];}_0x3df108=_[_0xa6f3('0x47')]({},_0x3df108,_0x132f4c[_0xa6f3('0x4a')]);return db[_0xa6f3('0x36')][_0xa6f3('0x52')](_0x3df108)[_0xa6f3('0x19')](handleEntityNotFound(_0x40a6ad,null))[_0xa6f3('0x19')](respondWithResult(_0x40a6ad,null))['catch'](handleError(_0x40a6ad,null));};exports[_0xa6f3('0x30')]=function(_0x3df4b4,_0x36f15b){if(_0x3df4b4[_0xa6f3('0x53')]['id']){delete _0x3df4b4[_0xa6f3('0x53')]['id'];}return db[_0xa6f3('0x36')][_0xa6f3('0x52')]({'where':{'id':_0x3df4b4[_0xa6f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x36f15b,null))['then'](saveUpdates(_0x3df4b4['body'],null))[_0xa6f3('0x19')](respondWithResult(_0x36f15b,null))['catch'](handleError(_0x36f15b,null));};exports[_0xa6f3('0x54')]=function(_0x2ab1cf,_0x353fdb,_0x10c105){if(_0x2ab1cf['file']&&_0x2ab1cf[_0xa6f3('0x55')][_0xa6f3('0x56')]){_0x2ab1cf[_0xa6f3('0x53')][_0xa6f3('0x57')]=_0x2ab1cf['file']['filename'];}return db[_0xa6f3('0x36')][_0xa6f3('0x52')]({'where':{'id':_0x2ab1cf[_0xa6f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x353fdb,null))[_0xa6f3('0x19')](saveUpdates(_0x2ab1cf[_0xa6f3('0x53')],null))[_0xa6f3('0x19')](respondWithResult(_0x353fdb,null))['catch'](handleError(_0x353fdb,null));};exports[_0xa6f3('0x58')]=function(_0x2fe302,_0x37a94b,_0xf079b1){if(_0x2fe302['file']&&_0x2fe302['file'][_0xa6f3('0x56')]){_0x2fe302['body'][_0xa6f3('0x59')]=_0x2fe302[_0xa6f3('0x55')][_0xa6f3('0x56')];}return db[_0xa6f3('0x36')][_0xa6f3('0x52')]({'where':{'id':_0x2fe302[_0xa6f3('0x50')]['id']}})['then'](handleEntityNotFound(_0x37a94b,null))['then'](saveUpdates(_0x2fe302['body'],null))[_0xa6f3('0x19')](respondWithResult(_0x37a94b,null))[_0xa6f3('0x24')](handleError(_0x37a94b,null));};var utilLicense=require(_0xa6f3('0x15'));exports[_0xa6f3('0x5a')]=function(_0x1bd902,_0x46c0e8,_0x3ac306){var _0x2938b9='server/files/images/logos';var _0xd1d8e9={'custom':![]};return utilLicense[_0xa6f3('0x5b')]()[_0xa6f3('0x19')](function(_0x3caf5e){if(_0x3caf5e){_0xd1d8e9=_0x3caf5e;}return db[_0xa6f3('0x36')]['find']({'where':{'id':_0x1bd902[_0xa6f3('0x50')]['id']},'attributes':[_0xa6f3('0x57'),'loginLogo',_0xa6f3('0x5c'),'favicon',_0xa6f3('0x5d'),'defaultLoginLogo',_0xa6f3('0x5e'),_0xa6f3('0x5f')],'raw':!![]});})[_0xa6f3('0x19')](handleEntityNotFound(_0x46c0e8,null))[_0xa6f3('0x19')](function(_0x5aa870){if(_0x5aa870){var _0x18bfe9=_0x5aa870[_0xa6f3('0x57')]&&fs[_0xa6f3('0x60')](path['join'](config[_0xa6f3('0x61')],_0x2938b9,_[_0xa6f3('0x62')](_0x5aa870[_0xa6f3('0x57')])))?path[_0xa6f3('0x63')](config[_0xa6f3('0x61')],_0x2938b9,_[_0xa6f3('0x62')](_0x5aa870['logo'])):path[_0xa6f3('0x63')](config[_0xa6f3('0x61')],_0x2938b9,_['toLower'](_0xa6f3('0x64')));var _0x5764bc='default'+_['upperFirst'](_0xa6f3('0x57'));if(_0x5aa870[_0x5764bc]||!_0xd1d8e9['custom']){_0x18bfe9=path[_0xa6f3('0x63')](config[_0xa6f3('0x61')],_0x2938b9,_[_0xa6f3('0x62')](_0xa6f3('0x64')));}if(!fs[_0xa6f3('0x60')](_0x18bfe9)){throw new db[(_0xa6f3('0x65'))][(_0xa6f3('0x66'))](_['upperFirst'](_0xa6f3('0x57'))+_0xa6f3('0x67'));}return _0x46c0e8['download'](_0x18bfe9);}})[_0xa6f3('0x24')](handleError(_0x46c0e8,null));};var utilLicense=require(_0xa6f3('0x15'));exports[_0xa6f3('0x68')]=function(_0x5872a8,_0x37fa37,_0x506958){var _0x206e66=_0xa6f3('0x69');var _0x56954e={'custom':![]};return utilLicense[_0xa6f3('0x5b')]()['then'](function(_0x21d566){if(_0x21d566){_0x56954e=_0x21d566;}return db['Setting']['find']({'where':{'id':_0x5872a8[_0xa6f3('0x50')]['id']},'attributes':[_0xa6f3('0x57'),_0xa6f3('0x59'),_0xa6f3('0x5c'),_0xa6f3('0x6a'),_0xa6f3('0x5d'),_0xa6f3('0x6b'),_0xa6f3('0x5e'),_0xa6f3('0x5f')],'raw':!![]});})[_0xa6f3('0x19')](handleEntityNotFound(_0x37fa37,null))[_0xa6f3('0x19')](function(_0x1339a2){if(_0x1339a2){var _0x33d67d=_0x1339a2[_0xa6f3('0x59')]&&fs[_0xa6f3('0x60')](path[_0xa6f3('0x63')](config[_0xa6f3('0x61')],_0x206e66,_[_0xa6f3('0x62')](_0x1339a2[_0xa6f3('0x59')])))?path[_0xa6f3('0x63')](config[_0xa6f3('0x61')],_0x206e66,_[_0xa6f3('0x62')](_0x1339a2['loginLogo'])):path[_0xa6f3('0x63')](config[_0xa6f3('0x61')],_0x206e66,_['toLower']('default_loginLogo.svg'));var _0x338f89=_0xa6f3('0x6c')+_[_0xa6f3('0x6d')](_0xa6f3('0x59'));if(_0x1339a2[_0x338f89]||!_0x56954e[_0xa6f3('0x6e')]){_0x33d67d=path['join'](config[_0xa6f3('0x61')],_0x206e66,_[_0xa6f3('0x62')](_0xa6f3('0x6f')));}if(!fs['existsSync'](_0x33d67d)){throw new db[(_0xa6f3('0x65'))][(_0xa6f3('0x66'))](_[_0xa6f3('0x6d')](_0xa6f3('0x59'))+'\x20not\x20found');}return _0x37fa37[_0xa6f3('0x70')](_0x33d67d);}})[_0xa6f3('0x24')](handleError(_0x37fa37,null));};exports[_0xa6f3('0x71')]=function(_0x58f984,_0x392e61){return db[_0xa6f3('0x36')][_0xa6f3('0x52')]({'where':{'id':_0x58f984[_0xa6f3('0x50')]['id']},'attributes':[_0xa6f3('0x72')]})['then'](respondWithResult(_0x392e61,null))[_0xa6f3('0x24')](handleError(_0x392e61,null));};exports['addPreferred']=function(_0x282887,_0x27466e,_0x986bb9){if(_0x282887[_0xa6f3('0x55')]&&_0x282887[_0xa6f3('0x55')][_0xa6f3('0x56')]){_0x282887[_0xa6f3('0x53')][_0xa6f3('0x5c')]=_0x282887[_0xa6f3('0x55')][_0xa6f3('0x56')];}return db['Setting'][_0xa6f3('0x52')]({'where':{'id':_0x282887['params']['id']}})[_0xa6f3('0x19')](handleEntityNotFound(_0x27466e,null))[_0xa6f3('0x19')](saveUpdates(_0x282887[_0xa6f3('0x53')],null))[_0xa6f3('0x19')](respondWithResult(_0x27466e,null))[_0xa6f3('0x24')](handleError(_0x27466e,null));};var utilLicense=require(_0xa6f3('0x15'));exports['getPreferred']=function(_0xe4da62,_0x189bd9,_0x572133){var _0x3aaf67='server/files/images/logos';var _0x37d7c5={'custom':![]};return utilLicense[_0xa6f3('0x5b')]()['then'](function(_0x3bc855){if(_0x3bc855){_0x37d7c5=_0x3bc855;}return db[_0xa6f3('0x36')][_0xa6f3('0x52')]({'where':{'id':_0xe4da62[_0xa6f3('0x50')]['id']},'attributes':['logo',_0xa6f3('0x59'),_0xa6f3('0x5c'),_0xa6f3('0x6a'),'defaultLogo',_0xa6f3('0x6b'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xa6f3('0x19')](handleEntityNotFound(_0x189bd9,null))[_0xa6f3('0x19')](function(_0xf54eb9){if(_0xf54eb9){var _0x3bcacf=_0xf54eb9[_0xa6f3('0x5c')]&&fs[_0xa6f3('0x60')](path[_0xa6f3('0x63')](config['root'],_0x3aaf67,_[_0xa6f3('0x62')](_0xf54eb9['preferred'])))?path[_0xa6f3('0x63')](config[_0xa6f3('0x61')],_0x3aaf67,_[_0xa6f3('0x62')](_0xf54eb9[_0xa6f3('0x5c')])):path[_0xa6f3('0x63')](config['root'],_0x3aaf67,_[_0xa6f3('0x62')]('default_preferred.png'));var _0x41e5bf=_0xa6f3('0x6c')+_[_0xa6f3('0x6d')](_0xa6f3('0x5c'));if(_0xf54eb9[_0x41e5bf]||!_0x37d7c5['custom']||!_0x37d7c5[_0xa6f3('0x5c')]){_0x3bcacf=path[_0xa6f3('0x63')](config['root'],_0x3aaf67,_[_0xa6f3('0x62')](_0xa6f3('0x73')));}if(!fs[_0xa6f3('0x60')](_0x3bcacf)){throw new db['Sequelize'][(_0xa6f3('0x66'))](_[_0xa6f3('0x6d')](_0xa6f3('0x5c'))+'\x20not\x20found');}return _0x189bd9[_0xa6f3('0x70')](_0x3bcacf);}})[_0xa6f3('0x24')](handleError(_0x189bd9,null));};exports[_0xa6f3('0x74')]=function(_0x28ec2d,_0x371d57,_0x432404){if(_0x28ec2d[_0xa6f3('0x55')]&&_0x28ec2d[_0xa6f3('0x55')][_0xa6f3('0x56')]){_0x28ec2d['body'][_0xa6f3('0x6a')]=_0x28ec2d[_0xa6f3('0x55')]['filename'];}return db[_0xa6f3('0x36')][_0xa6f3('0x52')]({'where':{'id':_0x28ec2d[_0xa6f3('0x50')]['id']}})[_0xa6f3('0x19')](handleEntityNotFound(_0x371d57,null))[_0xa6f3('0x19')](saveUpdates(_0x28ec2d[_0xa6f3('0x53')],null))[_0xa6f3('0x19')](respondWithResult(_0x371d57,null))[_0xa6f3('0x24')](handleError(_0x371d57,null));};var utilLicense=require(_0xa6f3('0x15'));exports[_0xa6f3('0x75')]=function(_0x4279c7,_0x346a3f,_0x59d18d){var _0x35e6c6='server/files/images/logos';var _0xef9877={'custom':![]};return utilLicense[_0xa6f3('0x5b')]()[_0xa6f3('0x19')](function(_0x4e6c11){if(_0x4e6c11){_0xef9877=_0x4e6c11;}return db['Setting'][_0xa6f3('0x52')]({'where':{'id':_0x4279c7[_0xa6f3('0x50')]['id']},'attributes':[_0xa6f3('0x57'),_0xa6f3('0x59'),_0xa6f3('0x5c'),_0xa6f3('0x6a'),_0xa6f3('0x5d'),_0xa6f3('0x6b'),_0xa6f3('0x5e'),_0xa6f3('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x346a3f,null))[_0xa6f3('0x19')](function(_0x4d4564){if(_0x4d4564){var _0x440493=_0x4d4564[_0xa6f3('0x6a')]&&fs[_0xa6f3('0x60')](path['join'](config[_0xa6f3('0x61')],_0x35e6c6,_[_0xa6f3('0x62')](_0x4d4564[_0xa6f3('0x6a')])))?path[_0xa6f3('0x63')](config['root'],_0x35e6c6,_[_0xa6f3('0x62')](_0x4d4564[_0xa6f3('0x6a')])):path['join'](config[_0xa6f3('0x61')],_0x35e6c6,_[_0xa6f3('0x62')](_0xa6f3('0x76')));var _0x5a0f88=_0xa6f3('0x6c')+_[_0xa6f3('0x6d')](_0xa6f3('0x6a'));if(_0x4d4564[_0x5a0f88]||!_0xef9877['custom']){_0x440493=path['join'](config['root'],_0x35e6c6,_['toLower'](_0xa6f3('0x76')));}if(!fs[_0xa6f3('0x60')](_0x440493)){throw new db[(_0xa6f3('0x65'))][(_0xa6f3('0x66'))](_[_0xa6f3('0x6d')](_0xa6f3('0x6a'))+_0xa6f3('0x67'));}return _0x346a3f['download'](_0x440493);}})[_0xa6f3('0x24')](handleError(_0x346a3f,null));};exports[_0xa6f3('0x77')]=function(_0x2e4614,_0x2d9b02){var _0x15b1ad={'offset':moment()['utcOffset']()};_0x15b1ad['now']=moment()['utcOffset'](_0x15b1ad[_0xa6f3('0x2b')])['format'](_0xa6f3('0x78'));return _0x2d9b02['status'](0xc8)['send'](_0x15b1ad);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 421a198..4fbe085 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x4154c4,_0x3c3f21){var _0x2bdec7=function(_0x4a45b9){while(--_0x4a45b9){_0x4154c4['push'](_0x4154c4['shift']());}};_0x2bdec7(++_0x3c3f21);}(_0x34e8,0x12c));var _0x834e=function(_0x27ac85,_0x144701){_0x27ac85=_0x27ac85-0x0;var _0x2eca4e=_0x34e8[_0x27ac85];return _0x2eca4e;};'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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0xbca80b,_0x5cd39f){var _0x484524=function(_0x43e757){while(--_0x43e757){_0xbca80b['push'](_0xbca80b['shift']());}};_0x484524(++_0x5cd39f);}(_0x008c,0x188));var _0xc008=function(_0x4dfd10,_0x3169d5){_0x4dfd10=_0x4dfd10-0x0;var _0x267950=_0x008c[_0x4dfd10];return _0x267950;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 8672608..1945130 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 _0xd4bb=['then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSetting','find','options','raw','attributes','include','map','model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x3bcf18,_0x312c35){var _0x27da96=function(_0x4b55a7){while(--_0x4b55a7){_0x3bcf18['push'](_0x3bcf18['shift']());}};_0x27da96(++_0x312c35);}(_0xd4bb,0x124));var _0xbd4b=function(_0x2ec420,_0x14f4e5){_0x2ec420=_0x2ec420-0x0;var _0x3e777d=_0xd4bb[_0x2ec420];return _0x3e777d;};'use strict';var _=require(_0xbd4b('0x0'));var util=require(_0xbd4b('0x1'));var moment=require(_0xbd4b('0x2'));var BPromise=require(_0xbd4b('0x3'));var rs=require(_0xbd4b('0x4'));var fs=require('fs');var Redis=require(_0xbd4b('0x5'));var db=require(_0xbd4b('0x6'))['db'];var utils=require(_0xbd4b('0x7'));var logger=require(_0xbd4b('0x8'))(_0xbd4b('0x9'));var config=require(_0xbd4b('0xa'));var jayson=require(_0xbd4b('0xb'));var client=jayson[_0xbd4b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40452c,_0x14ce0a,_0x1c114f){return new BPromise(function(_0x550817,_0x502124){return client[_0xbd4b('0xd')](_0x40452c,_0x1c114f)[_0xbd4b('0xe')](function(_0x46f0d1){logger[_0xbd4b('0xf')](_0xbd4b('0x10'),_0x14ce0a,_0xbd4b('0x11'));logger[_0xbd4b('0x12')](_0xbd4b('0x13'),_0x14ce0a,_0xbd4b('0x11'),JSON['stringify'](_0x46f0d1));if(_0x46f0d1[_0xbd4b('0x14')]){if(_0x46f0d1[_0xbd4b('0x14')][_0xbd4b('0x15')]===0x1f4){logger['error']('Setting,\x20%s,\x20%s',_0x14ce0a,_0x46f0d1[_0xbd4b('0x14')][_0xbd4b('0x16')]);return _0x502124(_0x46f0d1[_0xbd4b('0x14')][_0xbd4b('0x16')]);}logger['error'](_0xbd4b('0x10'),_0x14ce0a,_0x46f0d1['error'][_0xbd4b('0x16')]);return _0x550817(_0x46f0d1['error'][_0xbd4b('0x16')]);}else{logger[_0xbd4b('0xf')](_0xbd4b('0x10'),_0x14ce0a,_0xbd4b('0x11'));_0x550817(_0x46f0d1[_0xbd4b('0x17')]['message']);}})[_0xbd4b('0x18')](function(_0x4b3ad5){logger[_0xbd4b('0x14')](_0xbd4b('0x10'),_0x14ce0a,_0x4b3ad5);_0x502124(_0x4b3ad5);});});}exports[_0xbd4b('0x19')]=function(_0x4754db){var _0xf59b12=this;return new Promise(function(_0x5daeec,_0x14934b){return db['Setting'][_0xbd4b('0x1a')]({'raw':_0x4754db[_0xbd4b('0x1b')]?_0x4754db['options'][_0xbd4b('0x1c')]===undefined?!![]:![]:!![],'where':_0x4754db['options']?_0x4754db['options']['where']||null:null,'attributes':_0x4754db[_0xbd4b('0x1b')]?_0x4754db[_0xbd4b('0x1b')][_0xbd4b('0x1d')]||null:null,'include':_0x4754db[_0xbd4b('0x1b')]?_0x4754db[_0xbd4b('0x1b')][_0xbd4b('0x1e')]?_[_0xbd4b('0x1f')](_0x4754db[_0xbd4b('0x1b')][_0xbd4b('0x1e')],function(_0xd2b400){return{'model':db[_0xd2b400['model']],'as':_0xd2b400['as'],'attributes':_0xd2b400[_0xbd4b('0x1d')],'include':_0xd2b400['include']?_[_0xbd4b('0x1f')](_0xd2b400[_0xbd4b('0x1e')],function(_0x331350){return{'model':db[_0x331350[_0xbd4b('0x20')]],'as':_0x331350['as'],'attributes':_0x331350[_0xbd4b('0x1d')],'include':_0x331350[_0xbd4b('0x1e')]?_['map'](_0x331350['include'],function(_0x502f29){return{'model':db[_0x502f29[_0xbd4b('0x20')]],'as':_0x502f29['as'],'attributes':_0x502f29[_0xbd4b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbd4b('0xe')](function(_0x16ee6f){logger['info'](_0xbd4b('0x19'),_0x4754db);logger[_0xbd4b('0x12')]('ShowSetting',_0x4754db,JSON[_0xbd4b('0x21')](_0x16ee6f));_0x5daeec(_0x16ee6f);})['catch'](function(_0x2467e0){logger[_0xbd4b('0x14')](_0xbd4b('0x19'),_0x2467e0['message'],_0x4754db);_0x14934b(_0xf59b12[_0xbd4b('0x14')](0x1f4,_0x2467e0[_0xbd4b('0x16')]));});});}; \ No newline at end of file +var _0x952c=['error','code','message','request\x20sent','result','ShowSetting','Setting','options','raw','where','attributes','include','map','model','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','debug','Setting,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd7cdc6,_0x322844){var _0x5e8060=function(_0x30751a){while(--_0x30751a){_0xd7cdc6['push'](_0xd7cdc6['shift']());}};_0x5e8060(++_0x322844);}(_0x952c,0x11f));var _0xc952=function(_0x2d344f,_0x25fa84){_0x2d344f=_0x2d344f-0x0;var _0x2e796b=_0x952c[_0x2d344f];return _0x2e796b;};'use strict';var _=require(_0xc952('0x0'));var util=require(_0xc952('0x1'));var moment=require(_0xc952('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc952('0x3'));var db=require(_0xc952('0x4'))['db'];var utils=require(_0xc952('0x5'));var logger=require(_0xc952('0x6'))(_0xc952('0x7'));var config=require(_0xc952('0x8'));var jayson=require(_0xc952('0x9'));var client=jayson[_0xc952('0xa')][_0xc952('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42dbfb,_0x5465e2,_0xc60fe1){return new BPromise(function(_0xd88453,_0x3df32c){return client[_0xc952('0xc')](_0x42dbfb,_0xc60fe1)[_0xc952('0xd')](function(_0x43af88){logger[_0xc952('0xe')](_0xc952('0xf'),_0x5465e2,'request\x20sent');logger[_0xc952('0x10')](_0xc952('0x11'),_0x5465e2,'request\x20sent',JSON[_0xc952('0x12')](_0x43af88));if(_0x43af88[_0xc952('0x13')]){if(_0x43af88[_0xc952('0x13')][_0xc952('0x14')]===0x1f4){logger[_0xc952('0x13')](_0xc952('0xf'),_0x5465e2,_0x43af88[_0xc952('0x13')]['message']);return _0x3df32c(_0x43af88[_0xc952('0x13')][_0xc952('0x15')]);}logger[_0xc952('0x13')](_0xc952('0xf'),_0x5465e2,_0x43af88[_0xc952('0x13')][_0xc952('0x15')]);return _0xd88453(_0x43af88[_0xc952('0x13')][_0xc952('0x15')]);}else{logger['info'](_0xc952('0xf'),_0x5465e2,_0xc952('0x16'));_0xd88453(_0x43af88[_0xc952('0x17')][_0xc952('0x15')]);}})['catch'](function(_0x4b157c){logger['error'](_0xc952('0xf'),_0x5465e2,_0x4b157c);_0x3df32c(_0x4b157c);});});}exports[_0xc952('0x18')]=function(_0x48b3e0){var _0x4b88ee=this;return new Promise(function(_0x52c513,_0x41c7ad){return db[_0xc952('0x19')]['find']({'raw':_0x48b3e0[_0xc952('0x1a')]?_0x48b3e0[_0xc952('0x1a')][_0xc952('0x1b')]===undefined?!![]:![]:!![],'where':_0x48b3e0[_0xc952('0x1a')]?_0x48b3e0[_0xc952('0x1a')][_0xc952('0x1c')]||null:null,'attributes':_0x48b3e0[_0xc952('0x1a')]?_0x48b3e0[_0xc952('0x1a')][_0xc952('0x1d')]||null:null,'include':_0x48b3e0[_0xc952('0x1a')]?_0x48b3e0[_0xc952('0x1a')][_0xc952('0x1e')]?_['map'](_0x48b3e0['options'][_0xc952('0x1e')],function(_0x2ed934){return{'model':db[_0x2ed934['model']],'as':_0x2ed934['as'],'attributes':_0x2ed934[_0xc952('0x1d')],'include':_0x2ed934['include']?_[_0xc952('0x1f')](_0x2ed934[_0xc952('0x1e')],function(_0x3cbd58){return{'model':db[_0x3cbd58[_0xc952('0x20')]],'as':_0x3cbd58['as'],'attributes':_0x3cbd58[_0xc952('0x1d')],'include':_0x3cbd58[_0xc952('0x1e')]?_[_0xc952('0x1f')](_0x3cbd58['include'],function(_0x5ae236){return{'model':db[_0x5ae236[_0xc952('0x20')]],'as':_0x5ae236['as'],'attributes':_0x5ae236[_0xc952('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ef4cc){logger[_0xc952('0xe')]('ShowSetting',_0x48b3e0);logger['debug']('ShowSetting',_0x48b3e0,JSON['stringify'](_0x3ef4cc));_0x52c513(_0x3ef4cc);})[_0xc952('0x21')](function(_0x223992){logger[_0xc952('0x13')](_0xc952('0x18'),_0x223992[_0xc952('0x15')],_0x48b3e0);_0x41c7ad(_0x4b88ee[_0xc952('0x13')](0x1f4,_0x223992[_0xc952('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6b19f65..e891286 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','getInteractions','/:id/status','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer'];(function(_0x4b8968,_0x5c9b44){var _0x3a0ab7=function(_0x4dade2){while(--_0x4dade2){_0x4b8968['push'](_0x4b8968['shift']());}};_0x3a0ab7(++_0x5c9b44);}(_0x326f,0xd1));var _0xf326=function(_0x4a65b6,_0x5550ec){_0x4a65b6=_0x4a65b6-0x0;var _0x2bd2f7=_0x326f[_0x4a65b6];return _0x2bd2f7;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0x9')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router['get'](_0xf326('0x10'),auth['isAuthenticated'](),controller[_0xf326('0x11')]);router['get'](_0xf326('0x12'),auth['isAuthenticated'](),controller[_0xf326('0x13')]);router[_0xf326('0x9')]('/:id/interactions',auth[_0xf326('0xa')](),controller[_0xf326('0x14')]);router[_0xf326('0x9')](_0xf326('0x15'),controller['statusGet']);router[_0xf326('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x16')]);router[_0xf326('0x17')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0x18')]);router[_0xf326('0x17')](_0xf326('0xe'),auth[_0xf326('0xa')](),controller[_0xf326('0x19')]);router['post'](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x1a')]);router[_0xf326('0x17')](_0xf326('0x1b'),controller[_0xf326('0x1c')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xf326('0x1d')]);router[_0xf326('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0xf326('0x1e')]);router['post']('/:id/status',controller[_0xf326('0x1f')]);router[_0xf326('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0xf326('0x20')]);router[_0xf326('0x21')]('/:id',auth[_0xf326('0xa')](),controller[_0xf326('0x22')]);router[_0xf326('0x23')](_0xf326('0x24'),auth[_0xf326('0xa')](),controller[_0xf326('0x25')]);router['delete']('/:id/dispositions',auth['isAuthenticated'](),controller[_0xf326('0x26')]);router[_0xf326('0x23')](_0xf326('0x10'),auth[_0xf326('0xa')](),controller[_0xf326('0x27')]);router[_0xf326('0x23')]('/:id/users',auth[_0xf326('0xa')](),controller[_0xf326('0x28')]);module[_0xf326('0x29')]=router; \ No newline at end of file +var _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(_0x2c3e67,_0x44efab){var _0x49b190=function(_0x273837){while(--_0x273837){_0x2c3e67['push'](_0x2c3e67['shift']());}};_0x49b190(++_0x44efab);}(_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('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 d443306..2e9c346 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 _0x15e6=['clicksend','plivo','bandwidth','csc','infobip','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','STRING','generate','ENUM','skebby','connectel'];(function(_0x15f0b0,_0x180cb4){var _0x15e8f8=function(_0x684409){while(--_0x684409){_0x15f0b0['push'](_0x15f0b0['shift']());}};_0x15e8f8(++_0x180cb4);}(_0x15e6,0x1e8));var _0x615e=function(_0x28294a,_0x542642){_0x28294a=_0x28294a-0x0;var _0x3bef7d=_0x15e6[_0x28294a];return _0x3bef7d;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x615e('0x0')]={'name':{'type':Sequelize[_0x615e('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x615e('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x615e('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x615e('0x1')],'defaultValue':function(){return rs[_0x615e('0x2')]();}},'phone':{'type':Sequelize[_0x615e('0x1')]},'type':{'type':Sequelize[_0x615e('0x3')]('twilio',_0x615e('0x4'),_0x615e('0x5'),_0x615e('0x6'),_0x615e('0x7'),'clickatell',_0x615e('0x8'),_0x615e('0x9'),_0x615e('0xa'),'intelepeer')},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x615e('0x1')]},'authToken':{'type':Sequelize[_0x615e('0x1')]},'smsMethod':{'type':Sequelize[_0x615e('0x3')]('SI','TI','GP')},'username':{'type':Sequelize[_0x615e('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x615e('0x1')]},'applicationId':{'type':Sequelize[_0x615e('0x1')]},'accountId':{'type':Sequelize[_0x615e('0x1')]},'senderString':{'type':Sequelize[_0x615e('0x1')]},'deliveryReport':{'type':Sequelize[_0x615e('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x615e('0x1')]},'notificationTemplate':{'type':Sequelize[_0x615e('0xc')],'defaultValue':function(){return _0x615e('0xd');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x615e('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x615e('0xe')],'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[_0x615e('0xb')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x615e('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x615e('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x615e('0xe')],'comment':_0x615e('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x615e('0xb')],'defaultValue':![],'comment':_0x615e('0x10'),'set':function(_0x2588f7){if(!_0x2588f7)this[_0x615e('0x11')]('mandatoryDispositionPauseId',null);this[_0x615e('0x11')](_0x615e('0x12'),_0x2588f7);}}}; \ No newline at end of file +var _0x4ca3=['twilio','skebby','connectel','clicksend','plivo','clickatell','infobip','intelepeer','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','ENUM'];(function(_0x52788d,_0x1edaa0){var _0x1228a2=function(_0xbe44c8){while(--_0xbe44c8){_0x52788d['push'](_0x52788d['shift']());}};_0x1228a2(++_0x1edaa0);}(_0x4ca3,0x64));var _0x34ca=function(_0x5cdd38,_0x2a84cf){_0x5cdd38=_0x5cdd38-0x0;var _0x561dbb=_0x4ca3[_0x5cdd38];return _0x561dbb;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x34ca('0x0'));module[_0x34ca('0x1')]={'name':{'type':Sequelize[_0x34ca('0x2')],'unique':_0x34ca('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x34ca('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x34ca('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x34ca('0x2')]},'type':{'type':Sequelize[_0x34ca('0x4')](_0x34ca('0x5'),_0x34ca('0x6'),_0x34ca('0x7'),_0x34ca('0x8'),_0x34ca('0x9'),_0x34ca('0xa'),'bandwidth','csc',_0x34ca('0xb'),_0x34ca('0xc'))},'accountSid':{'type':Sequelize[_0x34ca('0x2')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x34ca('0x2')]},'smsMethod':{'type':Sequelize[_0x34ca('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x34ca('0x2')]},'password':{'type':Sequelize[_0x34ca('0x2')]},'apiKey':{'type':Sequelize[_0x34ca('0x2')]},'applicationId':{'type':Sequelize[_0x34ca('0x2')]},'accountId':{'type':Sequelize[_0x34ca('0x2')]},'senderString':{'type':Sequelize[_0x34ca('0x2')]},'deliveryReport':{'type':Sequelize[_0x34ca('0xd')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x34ca('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x34ca('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x34ca('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x34ca('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x34ca('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x34ca('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x34ca('0xf')],'comment':_0x34ca('0x10')},'mandatoryDisposition':{'type':Sequelize[_0x34ca('0xd')],'defaultValue':![],'comment':_0x34ca('0x11'),'set':function(_0x3c2447){if(!_0x3c2447)this['setDataValue'](_0x34ca('0x12'),null);this[_0x34ca('0x13')](_0x34ca('0x14'),_0x3c2447);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c7c6d1a..1c1aab3 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 _0x9f94=['close','unmanaged','*,*,*,*','SmsMessage','ContactId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','twilio','set','text/xml','\x0a','addApplications','sequelize','transaction','SmsApplication','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','Messages','spread','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','csc','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','jayson/promise','client','http','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','request\x20sent','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','get','SmsAccounts','UserProfileResource','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','type','key','filters','model','query','attributes','intersection','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','catch','show','keys','rawAttributes','fields','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params','describe','addDisposition','Disposition','getDispositions','findOne','pick','SmsAccountId','include','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','messageId','MessageSid','from','text','clicksend','message_id','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','SmsInteraction','interaction','push'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x9f94,0x11f));var _0x49f9=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9f94[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x49f9('0x0'));var rimraf=require(_0x49f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49f9('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x49f9('0x3'));var Mustache=require(_0x49f9('0x4'));var util=require(_0x49f9('0x5'));var path=require(_0x49f9('0x6'));var sox=require(_0x49f9('0x7'));var csv=require(_0x49f9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49f9('0x9'));var squel=require('squel');var crypto=require(_0x49f9('0xa'));var jsforce=require(_0x49f9('0xb'));var deskjs=require(_0x49f9('0xc'));var toCsv=require(_0x49f9('0x8'));var querystring=require('querystring');var Papa=require(_0x49f9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49f9('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49f9('0xf'))(_0x49f9('0x10'));var utils=require(_0x49f9('0x11'));var config=require(_0x49f9('0x12'));var licenseUtil=require(_0x49f9('0x13'));var db=require(_0x49f9('0x14'))['db'];config[_0x49f9('0x15')]=_[_0x49f9('0x16')](config[_0x49f9('0x15')],{'host':_0x49f9('0x17'),'port':0x18eb});var socket=require(_0x49f9('0x18'))(new Redis(config['redis']));require(_0x49f9('0x19'))['register'](socket);var jayson=require(_0x49f9('0x1a'));var client=jayson[_0x49f9('0x1b')][_0x49f9('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x14f935,_0x206e8c,_0x1430a5,_0xd370d2){return new BPromise(function(_0x314f30,_0x2f4e29){var _0x4ce3bd=_0xd370d2||client;return _0x4ce3bd[_0x49f9('0x1d')](_0x14f935,_0x1430a5)[_0x49f9('0x1e')](function(_0x22f801){logger[_0x49f9('0x1f')]('SmsAccount,\x20%s,\x20%s',_0x206e8c,'request\x20sent');logger[_0x49f9('0x20')](_0x49f9('0x21'),_0x206e8c,'request\x20sent',JSON[_0x49f9('0x22')](_0x22f801));if(_0x22f801[_0x49f9('0x23')]){if(_0x22f801[_0x49f9('0x23')]['code']===0x1f4){logger[_0x49f9('0x23')](_0x49f9('0x24'),_0x206e8c,_0x22f801[_0x49f9('0x23')]['message']);return _0x2f4e29(_0x22f801[_0x49f9('0x23')][_0x49f9('0x25')]);}logger[_0x49f9('0x23')](_0x49f9('0x24'),_0x206e8c,_0x22f801['error'][_0x49f9('0x25')]);return _0x314f30(_0x22f801[_0x49f9('0x23')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x206e8c,_0x49f9('0x26'));_0x314f30(_0x22f801['result'][_0x49f9('0x25')]);}})['catch'](function(_0x42c60a){logger['error'](_0x49f9('0x24'),_0x206e8c,_0x42c60a);_0x2f4e29(_0x42c60a);});});}function respondWithStatusCode(_0x5cb88a,_0x22f9a3){_0x22f9a3=_0x22f9a3||0xcc;return function(_0x3ec739){if(_0x3ec739){return _0x5cb88a['sendStatus'](_0x22f9a3);}return _0x5cb88a[_0x49f9('0x27')](_0x22f9a3)[_0x49f9('0x28')]();};}function respondWithResult(_0xa77761,_0xe36147){_0xe36147=_0xe36147||0xc8;return function(_0x5a55c6){if(_0x5a55c6){return _0xa77761['status'](_0xe36147)['json'](_0x5a55c6);}};}function respondWithFilteredResult(_0x142a6b,_0x18e79a){return function(_0x118c95){if(_0x118c95){var _0x3b17c4=typeof _0x18e79a[_0x49f9('0x29')]===_0x49f9('0x2a')&&typeof _0x18e79a[_0x49f9('0x2b')]===_0x49f9('0x2a');var _0x4b857b=_0x118c95[_0x49f9('0x2c')];var _0x834e18=_0x3b17c4?0x0:_0x18e79a[_0x49f9('0x29')];var _0x49f150=_0x3b17c4?_0x118c95[_0x49f9('0x2c')]:_0x18e79a['offset']+_0x18e79a[_0x49f9('0x2b')];var _0xdfe90;if(_0x49f150>=_0x4b857b){_0x49f150=_0x4b857b;_0xdfe90=0xc8;}else{_0xdfe90=0xce;}_0x142a6b['status'](_0xdfe90);return _0x142a6b['set'](_0x49f9('0x2d'),_0x834e18+'-'+_0x49f150+'/'+_0x4b857b)[_0x49f9('0x2e')](_0x118c95);}return null;};}function patchUpdates(_0x18ad67){return function(_0x11325f){try{jsonpatch[_0x49f9('0x2f')](_0x11325f,_0x18ad67,!![]);}catch(_0x4ee432){return BPromise[_0x49f9('0x30')](_0x4ee432);}return _0x11325f['save']();};}function saveUpdates(_0x3682ea,_0x1b3cb4){return function(_0x9f38f4){if(_0x9f38f4){return _0x9f38f4[_0x49f9('0x31')](_0x3682ea)[_0x49f9('0x1e')](function(_0x306db5){return _0x306db5;});}return null;};}function removeEntity(_0x400166,_0x312c55){return function(_0x505c5e){if(_0x505c5e){return _0x505c5e['destroy']()[_0x49f9('0x1e')](function(){var _0x514b2d=_0x505c5e[_0x49f9('0x32')]({'plain':!![]});var _0x4d52d8=_0x49f9('0x33');return db[_0x49f9('0x34')][_0x49f9('0x35')]({'where':{'type':_0x4d52d8,'resourceId':_0x514b2d['id']}})[_0x49f9('0x1e')](function(){return _0x505c5e;});})[_0x49f9('0x1e')](function(){_0x400166[_0x49f9('0x27')](0xcc)[_0x49f9('0x28')]();});}};}function handleEntityNotFound(_0x45a616,_0x5d3aa0){return function(_0x4bbe9c){if(!_0x4bbe9c){_0x45a616[_0x49f9('0x36')](0x194);}return _0x4bbe9c;};}function handleError(_0x231313,_0x51df2b){_0x51df2b=_0x51df2b||0x1f4;return function(_0x3d7750){logger[_0x49f9('0x23')](_0x3d7750[_0x49f9('0x37')]);if(_0x3d7750[_0x49f9('0x38')]){delete _0x3d7750['name'];}_0x231313[_0x49f9('0x27')](_0x51df2b)[_0x49f9('0x39')](_0x3d7750);};}exports[_0x49f9('0x3a')]=function(_0x6807a8,_0x3c95f2){var _0xc9fa87={'include':[{'model':db[_0x49f9('0x3b')],'as':_0x49f9('0x3c')}]},_0x2afe99={},_0xb2bd78={'count':0x0,'rows':[]};var _0x13bbec=_[_0x49f9('0x3d')](db[_0x49f9('0x3e')]['rawAttributes'],function(_0x481b6a){return{'name':_0x481b6a['fieldName'],'type':_0x481b6a[_0x49f9('0x3f')][_0x49f9('0x40')]};});_0x2afe99['model']=_['map'](_0x13bbec,_0x49f9('0x38'));_0x2afe99['query']=_['keys'](_0x6807a8['query']);_0x2afe99[_0x49f9('0x41')]=_['intersection'](_0x2afe99[_0x49f9('0x42')],_0x2afe99[_0x49f9('0x43')]);_0xc9fa87[_0x49f9('0x44')]=_[_0x49f9('0x45')](_0x2afe99['model'],qs['fields'](_0x6807a8[_0x49f9('0x43')]['fields']));_0xc9fa87[_0x49f9('0x44')]=_0xc9fa87['attributes']['length']?_0xc9fa87[_0x49f9('0x44')]:_0x2afe99[_0x49f9('0x42')];if(!_0x6807a8[_0x49f9('0x43')][_0x49f9('0x46')](_0x49f9('0x47'))){_0xc9fa87[_0x49f9('0x2b')]=qs['limit'](_0x6807a8[_0x49f9('0x43')][_0x49f9('0x2b')]);_0xc9fa87[_0x49f9('0x29')]=qs[_0x49f9('0x29')](_0x6807a8['query'][_0x49f9('0x29')]);}_0xc9fa87[_0x49f9('0x48')]=qs[_0x49f9('0x49')](_0x6807a8[_0x49f9('0x43')][_0x49f9('0x49')]);_0xc9fa87[_0x49f9('0x4a')]=qs[_0x49f9('0x41')](_['pick'](_0x6807a8[_0x49f9('0x43')],_0x2afe99[_0x49f9('0x41')]),_0x13bbec);if(_0x6807a8['query']['filter']){_0xc9fa87[_0x49f9('0x4a')]=_[_0x49f9('0x4b')](_0xc9fa87['where'],{'$or':_[_0x49f9('0x3d')](_0x13bbec,function(_0x5ad024){if(_0x5ad024[_0x49f9('0x3f')]!==_0x49f9('0x4c')){var _0x2e5159={};_0x2e5159[_0x5ad024[_0x49f9('0x38')]]={'$like':'%'+_0x6807a8[_0x49f9('0x43')][_0x49f9('0x4d')]+'%'};return _0x2e5159;}})});}_0xc9fa87=_['merge']({},_0xc9fa87,_0x6807a8[_0x49f9('0x4e')]);var _0x5604ab={'where':_0xc9fa87['where']};return db[_0x49f9('0x3e')][_0x49f9('0x2c')](_0x5604ab)['then'](function(_0xcc65d){_0xb2bd78[_0x49f9('0x2c')]=_0xcc65d;if(_0x6807a8[_0x49f9('0x43')]['includeAll']){_0xc9fa87['include']=[{'all':!![]}];}return db[_0x49f9('0x3e')]['findAll'](_0xc9fa87);})[_0x49f9('0x1e')](function(_0x42620c){_0xb2bd78['rows']=_0x42620c;return _0xb2bd78;})[_0x49f9('0x1e')](respondWithFilteredResult(_0x3c95f2,_0xc9fa87))[_0x49f9('0x4f')](handleError(_0x3c95f2,null));};exports[_0x49f9('0x50')]=function(_0x13e613,_0x2fc282){var _0x1c31f4={'raw':![],'where':{'id':_0x13e613['params']['id']},'include':[{'model':db[_0x49f9('0x3b')],'as':_0x49f9('0x3c')}]},_0x25ef41={};_0x25ef41[_0x49f9('0x42')]=_[_0x49f9('0x51')](db[_0x49f9('0x3e')][_0x49f9('0x52')]);_0x25ef41['query']=_[_0x49f9('0x51')](_0x13e613[_0x49f9('0x43')]);_0x25ef41[_0x49f9('0x41')]=_[_0x49f9('0x45')](_0x25ef41[_0x49f9('0x42')],_0x25ef41['query']);_0x1c31f4[_0x49f9('0x44')]=_[_0x49f9('0x45')](_0x25ef41[_0x49f9('0x42')],qs[_0x49f9('0x53')](_0x13e613[_0x49f9('0x43')][_0x49f9('0x53')]));_0x1c31f4[_0x49f9('0x44')]=_0x1c31f4[_0x49f9('0x44')][_0x49f9('0x54')]?_0x1c31f4[_0x49f9('0x44')]:_0x25ef41[_0x49f9('0x42')];if(_0x13e613[_0x49f9('0x43')][_0x49f9('0x55')]){_0x1c31f4['include']=[{'all':!![]}];}_0x1c31f4=_[_0x49f9('0x4b')]({},_0x1c31f4,_0x13e613[_0x49f9('0x4e')]);return db[_0x49f9('0x3e')][_0x49f9('0x56')](_0x1c31f4)['then'](handleEntityNotFound(_0x2fc282,null))[_0x49f9('0x1e')](respondWithResult(_0x2fc282,null))[_0x49f9('0x4f')](handleError(_0x2fc282,null));};exports[_0x49f9('0x57')]=function(_0x110b5f,_0x1d1777){return db['SmsAccount']['create'](_0x110b5f[_0x49f9('0x58')],{})['then'](function(_0x2efafb){var _0x5e215f=_0x110b5f[_0x49f9('0x59')]['get']({'plain':!![]});if(!_0x5e215f)throw new Error(_0x49f9('0x5a'));if(_0x5e215f[_0x49f9('0x5b')]===_0x49f9('0x59')){var _0x241c90=_0x2efafb[_0x49f9('0x32')]({'plain':!![]});var _0x563855=_0x49f9('0x33');return db[_0x49f9('0x5c')][_0x49f9('0x56')]({'where':{'name':_0x563855,'userProfileId':_0x5e215f['userProfileId']},'raw':!![]})[_0x49f9('0x1e')](function(_0x5defea){if(_0x5defea&&_0x5defea[_0x49f9('0x5d')]===0x0){return db[_0x49f9('0x34')][_0x49f9('0x57')]({'name':_0x241c90[_0x49f9('0x38')],'resourceId':_0x241c90['id'],'type':_0x5defea[_0x49f9('0x38')],'sectionId':_0x5defea['id']},{})['then'](function(){return _0x2efafb;});}else{return _0x2efafb;}})[_0x49f9('0x4f')](function(_0x4a8a1e){logger[_0x49f9('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a8a1e);throw _0x4a8a1e;});}return _0x2efafb;})[_0x49f9('0x1e')](respondWithResult(_0x1d1777,0xc9))[_0x49f9('0x4f')](handleError(_0x1d1777,null));};exports['update']=function(_0x54f274,_0x1510db){if(_0x54f274['body']['id']){delete _0x54f274[_0x49f9('0x58')]['id'];}return db['SmsAccount'][_0x49f9('0x56')]({'where':{'id':_0x54f274[_0x49f9('0x5e')]['id']},'include':[{'model':db[_0x49f9('0x3b')],'as':_0x49f9('0x3c')}]})['then'](handleEntityNotFound(_0x1510db,null))[_0x49f9('0x1e')](saveUpdates(_0x54f274[_0x49f9('0x58')],null))['then'](respondWithResult(_0x1510db,null))['catch'](handleError(_0x1510db,null));};exports[_0x49f9('0x35')]=function(_0x2fe71f,_0x4c9ece){return db[_0x49f9('0x3e')]['find']({'where':{'id':_0x2fe71f['params']['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x4c9ece,null))[_0x49f9('0x1e')](removeEntity(_0x4c9ece,null))[_0x49f9('0x4f')](handleError(_0x4c9ece,null));};exports[_0x49f9('0x5f')]=function(_0x732607,_0x44eb6a){return db[_0x49f9('0x3e')][_0x49f9('0x5f')]()[_0x49f9('0x1e')](respondWithResult(_0x44eb6a,null))[_0x49f9('0x4f')](handleError(_0x44eb6a,null));};exports[_0x49f9('0x60')]=function(_0xdc8820,_0x299058,_0x26a453){if(_0xdc8820[_0x49f9('0x58')]['id']){delete _0xdc8820[_0x49f9('0x58')]['id'];}return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0xdc8820['params']['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x299058,null))[_0x49f9('0x1e')](function(_0x2cd94c){if(_0x2cd94c){_0xdc8820[_0x49f9('0x58')]['SmsAccountId']=_0x2cd94c['id'];return db[_0x49f9('0x61')][_0x49f9('0x57')](_0xdc8820[_0x49f9('0x58')]);}})[_0x49f9('0x1e')](respondWithResult(_0x299058,null))[_0x49f9('0x4f')](handleError(_0x299058,null));};exports[_0x49f9('0x62')]=function(_0x2a8642,_0x2ecf3b,_0x2c8221){var _0x564946={'raw':![],'where':{}};var _0x30a1d3={};var _0x11de78={'count':0x0,'rows':[]};return db[_0x49f9('0x3e')][_0x49f9('0x63')]({'where':{'id':_0x2a8642[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x2ecf3b,null))[_0x49f9('0x1e')](function(_0x1f9242){if(_0x1f9242){_0x30a1d3[_0x49f9('0x42')]=_[_0x49f9('0x51')](db[_0x49f9('0x61')][_0x49f9('0x52')]);_0x30a1d3[_0x49f9('0x43')]=_[_0x49f9('0x51')](_0x2a8642[_0x49f9('0x43')]);_0x30a1d3[_0x49f9('0x41')]=_[_0x49f9('0x45')](_0x30a1d3[_0x49f9('0x42')],_0x30a1d3[_0x49f9('0x43')]);_0x564946[_0x49f9('0x44')]=_[_0x49f9('0x45')](_0x30a1d3[_0x49f9('0x42')],qs[_0x49f9('0x53')](_0x2a8642[_0x49f9('0x43')][_0x49f9('0x53')]));_0x564946[_0x49f9('0x44')]=_0x564946[_0x49f9('0x44')][_0x49f9('0x54')]?_0x564946[_0x49f9('0x44')]:_0x30a1d3[_0x49f9('0x42')];if(!_0x2a8642[_0x49f9('0x43')][_0x49f9('0x46')](_0x49f9('0x47'))){_0x564946[_0x49f9('0x2b')]=qs[_0x49f9('0x2b')](_0x2a8642[_0x49f9('0x43')][_0x49f9('0x2b')]);_0x564946[_0x49f9('0x29')]=qs[_0x49f9('0x29')](_0x2a8642[_0x49f9('0x43')]['offset']);}_0x564946[_0x49f9('0x48')]=qs['sort'](_0x2a8642[_0x49f9('0x43')]['sort']);_0x564946[_0x49f9('0x4a')]=qs[_0x49f9('0x41')](_[_0x49f9('0x64')](_0x2a8642[_0x49f9('0x43')],_0x30a1d3[_0x49f9('0x41')]));_0x564946[_0x49f9('0x4a')][_0x49f9('0x65')]=_0x1f9242['id'];if(_0x2a8642[_0x49f9('0x43')][_0x49f9('0x4d')]){_0x564946[_0x49f9('0x4a')]=_[_0x49f9('0x4b')](_0x564946['where'],{'$or':_['map'](_0x564946[_0x49f9('0x44')],function(_0x25e9ee){var _0x2cbebc={};_0x2cbebc[_0x25e9ee]={'$like':'%'+_0x2a8642[_0x49f9('0x43')]['filter']+'%'};return _0x2cbebc;})});}_0x564946=_['merge']({},_0x564946,_0x2a8642[_0x49f9('0x4e')]);return db[_0x49f9('0x61')][_0x49f9('0x2c')]({'where':_0x564946['where']})[_0x49f9('0x1e')](function(_0x99f29){_0x11de78[_0x49f9('0x2c')]=_0x99f29;if(_0x2a8642[_0x49f9('0x43')][_0x49f9('0x55')]){_0x564946[_0x49f9('0x66')]=[{'all':!![]}];}return db[_0x49f9('0x61')][_0x49f9('0x67')](_0x564946);})[_0x49f9('0x1e')](function(_0x5d22b4){_0x11de78[_0x49f9('0x68')]=_0x5d22b4;return _0x11de78;});}})['then'](respondWithFilteredResult(_0x2ecf3b,_0x564946))[_0x49f9('0x4f')](handleError(_0x2ecf3b,null));};exports[_0x49f9('0x69')]=function(_0x304367,_0xaa3030,_0x388d8a){return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x304367[_0x49f9('0x5e')]['id']}})['then'](handleEntityNotFound(_0xaa3030,null))[_0x49f9('0x1e')](function(_0x12c08c){if(_0x12c08c){return _0x12c08c[_0x49f9('0x69')](_0x304367[_0x49f9('0x43')][_0x49f9('0x6a')]);}})[_0x49f9('0x1e')](respondWithStatusCode(_0xaa3030,null))[_0x49f9('0x4f')](handleError(_0xaa3030,null));};exports[_0x49f9('0x6b')]=function(_0x483116,_0x5b779a,_0x447103){if(_0x483116['body']['id']){delete _0x483116[_0x49f9('0x58')]['id'];}return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x483116[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x5b779a,null))[_0x49f9('0x1e')](function(_0x462c53){if(_0x462c53){_0x483116[_0x49f9('0x58')][_0x49f9('0x65')]=_0x462c53['id'];return db[_0x49f9('0x6c')][_0x49f9('0x57')](_0x483116[_0x49f9('0x58')]);}})[_0x49f9('0x1e')](respondWithResult(_0x5b779a,null))[_0x49f9('0x4f')](handleError(_0x5b779a,null));};exports[_0x49f9('0x6d')]=function(_0x2dcb42,_0x551b82,_0xb91e92){var _0x1dc039={'raw':![],'where':{}};var _0x590845={};var _0x4e87c8={'count':0x0,'rows':[]};return db[_0x49f9('0x3e')]['findOne']({'where':{'id':_0x2dcb42[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x551b82,null))['then'](function(_0x47eba1){if(_0x47eba1){_0x590845[_0x49f9('0x42')]=_[_0x49f9('0x51')](db[_0x49f9('0x6c')]['rawAttributes']);_0x590845['query']=_[_0x49f9('0x51')](_0x2dcb42['query']);_0x590845[_0x49f9('0x41')]=_['intersection'](_0x590845[_0x49f9('0x42')],_0x590845[_0x49f9('0x43')]);_0x1dc039[_0x49f9('0x44')]=_[_0x49f9('0x45')](_0x590845[_0x49f9('0x42')],qs[_0x49f9('0x53')](_0x2dcb42[_0x49f9('0x43')][_0x49f9('0x53')]));_0x1dc039[_0x49f9('0x44')]=_0x1dc039[_0x49f9('0x44')][_0x49f9('0x54')]?_0x1dc039[_0x49f9('0x44')]:_0x590845[_0x49f9('0x42')];if(!_0x2dcb42[_0x49f9('0x43')][_0x49f9('0x46')](_0x49f9('0x47'))){_0x1dc039[_0x49f9('0x2b')]=qs['limit'](_0x2dcb42[_0x49f9('0x43')][_0x49f9('0x2b')]);_0x1dc039[_0x49f9('0x29')]=qs[_0x49f9('0x29')](_0x2dcb42['query'][_0x49f9('0x29')]);}_0x1dc039[_0x49f9('0x48')]=qs[_0x49f9('0x49')](_0x2dcb42[_0x49f9('0x43')][_0x49f9('0x49')]);_0x1dc039[_0x49f9('0x4a')]=qs[_0x49f9('0x41')](_['pick'](_0x2dcb42['query'],_0x590845[_0x49f9('0x41')]));_0x1dc039['where']['SmsAccountId']=_0x47eba1['id'];if(_0x2dcb42['query']['filter']){_0x1dc039['where']=_[_0x49f9('0x4b')](_0x1dc039['where'],{'$or':_['map'](_0x1dc039['attributes'],function(_0x43af36){var _0xd5aef0={};_0xd5aef0[_0x43af36]={'$like':'%'+_0x2dcb42[_0x49f9('0x43')][_0x49f9('0x4d')]+'%'};return _0xd5aef0;})});}_0x1dc039=_[_0x49f9('0x4b')]({},_0x1dc039,_0x2dcb42[_0x49f9('0x4e')]);return db['CannedAnswer'][_0x49f9('0x2c')]({'where':_0x1dc039[_0x49f9('0x4a')]})[_0x49f9('0x1e')](function(_0x4594fe){_0x4e87c8['count']=_0x4594fe;if(_0x2dcb42[_0x49f9('0x43')]['includeAll']){_0x1dc039[_0x49f9('0x66')]=[{'all':!![]}];}return db['CannedAnswer'][_0x49f9('0x67')](_0x1dc039);})[_0x49f9('0x1e')](function(_0x29c207){_0x4e87c8[_0x49f9('0x68')]=_0x29c207;return _0x4e87c8;});}})[_0x49f9('0x1e')](respondWithFilteredResult(_0x551b82,_0x1dc039))[_0x49f9('0x4f')](handleError(_0x551b82,null));};exports[_0x49f9('0x6e')]=function(_0x257eb6,_0x38ab8e,_0x2863d9){return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x257eb6[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x38ab8e,null))[_0x49f9('0x1e')](function(_0x515e26){if(_0x515e26){return _0x515e26[_0x49f9('0x6e')](_0x257eb6[_0x49f9('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x38ab8e,null))[_0x49f9('0x4f')](handleError(_0x38ab8e,null));};exports[_0x49f9('0x6f')]=function(_0x39da30,_0xaade52,_0x39582c){var _0x24a2a5={'channel':_0x49f9('0x70')};var _0x35fa47=[];var _0xe820f=[];var _0x38824e={};return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x39da30[_0x49f9('0x5e')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x49f9('0x71')}]})[_0x49f9('0x1e')](handleEntityNotFound(_0xaade52,null))['then'](function(_0x322d66){_0x24a2a5[_0x49f9('0x72')]=_0x322d66;_0x24a2a5[_0x49f9('0x73')]=_[_0x49f9('0x74')](_0x322d66[_0x49f9('0x71')],[_0x49f9('0x75')],[_0x49f9('0x76')]);if(_0x24a2a5[_0x49f9('0x72')][_0x49f9('0x71')]){delete _0x24a2a5[_0x49f9('0x72')][_0x49f9('0x71')];}return db[_0x49f9('0x77')][_0x49f9('0x5f')]();})[_0x49f9('0x1e')](function(_0x1d8bdd){if(!_0x1d8bdd){throw new db[(_0x49f9('0x78'))][(_0x49f9('0x79'))](_0x49f9('0x7a'));}_0x35fa47=_[_0x49f9('0x7b')](_['keys'](_0x1d8bdd),[_0x49f9('0x7c'),_0x49f9('0x7d')]);_0xe820f=_[_0x49f9('0x7b')](_[_0x49f9('0x51')](_0x1d8bdd),[_0x49f9('0x7c'),_0x49f9('0x7d'),'CompanyId',_0x49f9('0x7e')]);_0x24a2a5[_0x49f9('0x58')]={'mapKey':_0x49f9('0x7f')};if(_0x24a2a5[_0x49f9('0x72')]['type']){switch(_0x24a2a5[_0x49f9('0x72')]['type']){case'twilio':_0x24a2a5['body']['from']=_0x39da30['body']['From'];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')]=_0x39da30['body']['Body'];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x80')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x81')];break;case'skebby':_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')]='+'+_0x39da30[_0x49f9('0x58')]['sender'];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x83')];break;case'connectel':_0x24a2a5[_0x49f9('0x58')]['from']=_0x39da30[_0x49f9('0x58')]['from'];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x25')];break;case _0x49f9('0x84'):_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')]=_0x39da30[_0x49f9('0x58')]['from'];_0x24a2a5['body']['body']=_0x39da30[_0x49f9('0x58')][_0x49f9('0x58')];_0x24a2a5['body'][_0x49f9('0x80')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x85')];break;case _0x49f9('0x86'):_0x24a2a5['body'][_0x49f9('0x82')]=_0x39da30[_0x49f9('0x58')]['From'];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x87')];_0x24a2a5['body'][_0x49f9('0x80')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x88')];break;case _0x49f9('0x89'):_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')]='+'+_0x39da30[_0x49f9('0x58')]['results'][0x0][_0x49f9('0x82')];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')]=_0x39da30['body'][_0x49f9('0x8a')][0x0]['text'];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x80')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x8a')][0x0][_0x49f9('0x80')];break;case'csc':_0x24a2a5[_0x49f9('0x58')]['from']=_0x39da30[_0x49f9('0x58')][_0x49f9('0x8b')];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')]=_0x39da30['body'][_0x49f9('0x8c')][_0x49f9('0x25')];break;case _0x49f9('0x8d'):_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x8e')];_0x24a2a5[_0x49f9('0x58')]['body']=_0x39da30['body'][_0x49f9('0x83')];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x80')]=_0x39da30['body'][_0x49f9('0x8f')];break;case _0x49f9('0x90'):_0x24a2a5[_0x49f9('0x58')]['messageId']=_0x39da30[_0x49f9('0x58')][0x0]['message']['id'];_0x24a2a5['body'][_0x49f9('0x82')]=_0x39da30[_0x49f9('0x58')][0x0][_0x49f9('0x25')][_0x49f9('0x82')];_0x24a2a5[_0x49f9('0x58')]['body']=_0x39da30[_0x49f9('0x58')][0x0][_0x49f9('0x25')]['text'];break;case _0x49f9('0x91'):_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')]=_0x39da30[_0x49f9('0x58')][_0x49f9('0x82')];_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')]=_0x39da30[_0x49f9('0x58')]['message'];_0x24a2a5['body'][_0x49f9('0x80')]=_0x39da30['body'][_0x49f9('0x92')];break;}}if(_0x24a2a5[_0x49f9('0x58')]['id']){delete _0x24a2a5[_0x49f9('0x58')]['id'];}if(_[_0x49f9('0x93')](_0x24a2a5['body']['from'])){throw new db[(_0x49f9('0x78'))][(_0x49f9('0x79'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')])||_0x24a2a5['body'][_0x49f9('0x58')]===''){throw new db[(_0x49f9('0x78'))][(_0x49f9('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x49f9('0x93')](_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x94')])){throw new db[(_0x49f9('0x78'))]['ValidationError'](_0x49f9('0x95')+_0xe820f);}if(!_[_0x49f9('0x96')](_0xe820f,_0x24a2a5['body'][_0x49f9('0x94')])){throw new db['Sequelize'][(_0x49f9('0x79'))](_0x49f9('0x97')+_0xe820f);}_0x38824e[_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x94')]]=_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')];return db['CmList'][_0x49f9('0x56')]({'where':{'id':_0x24a2a5[_0x49f9('0x72')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x49f9('0x98'),'where':_0x38824e,'limit':0x1,'order':[[_0x49f9('0x7d'),_0x49f9('0x99')]]}]});})[_0x49f9('0x1e')](handleEntityNotFound(_0xaade52,null))[_0x49f9('0x1e')](function(_0x5cda3a){if(_0x5cda3a){_0x24a2a5[_0x49f9('0x9a')]=_[_0x49f9('0x9b')](_0x5cda3a,[_0x49f9('0x98')]);if(_0x5cda3a[_0x49f9('0x98')][_0x49f9('0x54')]){return _0x5cda3a[_0x49f9('0x98')][0x0];}var _0x553271=_[_0x49f9('0x16')](_0x24a2a5['body'],{'firstName':_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')],'ListId':_0x5cda3a['id']});_0x553271[_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x94')]]=_0x24a2a5[_0x49f9('0x58')]['from'];return db[_0x49f9('0x77')]['create'](_0x553271,{'fields':_0x35fa47,'raw':!![]});}})['then'](handleEntityNotFound(_0xaade52,null))[_0x49f9('0x1e')](function(_0x598832){if(_0x598832){_0x24a2a5['contact']=_0x598832;var _0x52583f={'ContactId':_0x598832['id'],'phone':_0x24a2a5['body']['from'],'SmsAccountId':_0x39da30[_0x49f9('0x5e')]['id']};var _0x1c9cc8={'ContactId':_0x598832['id'],'SmsAccountId':_0x39da30[_0x49f9('0x5e')]['id'],'closed':![]};return db['SmsInteraction'][_0x49f9('0x56')]({'where':_0x1c9cc8})['then'](function(_0x330359){if(_0x330359){return[_0x330359,![]];}return db[_0x49f9('0x9c')][_0x49f9('0x57')](_0x52583f)[_0x49f9('0x1e')](function(_0x649c96){return[_0x649c96,!![]];});});}})['spread'](function(_0x372219,_0x412031){_0x24a2a5[_0x49f9('0x9d')]=_0x372219[_0x49f9('0x32')]({'plain':!![]});_0x24a2a5[_0x49f9('0x9d')]['created']=![];if(_0x412031){if(_0x24a2a5[_0x49f9('0x72')]['autoclose']){_0x24a2a5[_0x49f9('0x73')][_0x49f9('0x9e')]({'id':0x0,'priority':_0x24a2a5[_0x49f9('0x73')]['length']+0x1,'app':_0x49f9('0x9f'),'appdata':_0x49f9('0xa0'),'interval':_0x49f9('0xa1')});}_0x24a2a5[_0x49f9('0x9d')]['created']=!![];}return db[_0x49f9('0xa2')]['create']({'phone':_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x82')],'messageId':_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x80')],'body':_0x24a2a5[_0x49f9('0x58')][_0x49f9('0x58')],'SmsAccountId':_0x39da30[_0x49f9('0x5e')]['id'],'SmsInteractionId':_0x372219['id'],'direction':'in','ContactId':_0x372219[_0x49f9('0xa3')],'AttachmentId':_0x24a2a5[_0x49f9('0x58')]['AttachmentId']});})['then'](function(_0x204ab3){_0x24a2a5['message']=_0x204ab3;if(_0x24a2a5[_0x49f9('0x9d')][_0x49f9('0xa4')]){return db[_0x49f9('0xa5')]['find']({'attributes':['id','name'],'where':{'id':_0x24a2a5[_0x49f9('0x9d')][_0x49f9('0xa4')]}})[_0x49f9('0x1e')](function(_0x1af40c){if(_0x1af40c){_0x24a2a5[_0x49f9('0x73')]['unshift']({'id':0x0,'priority':0x0,'app':_0x49f9('0xa6'),'appdata':_0x1af40c['name']+','+(_0x24a2a5['account'][_0x49f9('0xa7')]||0xa),'interval':_0x49f9('0xa1')});}return respondWithRpcPromise(_0x49f9('0xa8'),_0x49f9('0xa9'),_0x24a2a5);});}return respondWithRpcPromise('Start',_0x49f9('0xa9'),_0x24a2a5);})['then'](function(_0x3dafe6){if(_0x3dafe6){var _0x5da60c=0xc8;var _0x40c119=_0x49f9('0xaa');logger[_0x49f9('0x1f')](_0x49f9('0x21'),_0x40c119,_0x5da60c,_0x49f9('0xab'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x40c119,_0x5da60c,_0x49f9('0xab'),JSON['stringify'](_0x3dafe6));if(_0x24a2a5[_0x49f9('0x72')][_0x49f9('0x3f')]===_0x49f9('0xac')){return _0xaade52['status'](_0x5da60c)[_0x49f9('0xad')]('Content-Type',_0x49f9('0xae'))[_0x49f9('0x39')](_0x49f9('0xaf'));}else{return _0xaade52[_0x49f9('0x27')](_0x5da60c)[_0x49f9('0x2e')](_0x3dafe6);}}})['catch'](handleError(_0xaade52,null));};exports[_0x49f9('0xb0')]=function(_0x7cc031,_0x27f080,_0x6ddcdd){return db['SmsAccount']['findOne']({'where':{'id':_0x7cc031['params']['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x27f080,null))[_0x49f9('0x1e')](function(_0x3dcbe8){if(_0x3dcbe8){return db[_0x49f9('0xb1')][_0x49f9('0xb2')](function(_0x161af7){return db[_0x49f9('0xb3')][_0x49f9('0x35')]({'where':{'SmsAccountId':_0x7cc031[_0x49f9('0x5e')]['id']},'transaction':_0x161af7})['then'](function(_0x251b96){var _0x4fd101=_[_0x49f9('0x3d')](_0x7cc031[_0x49f9('0x58')],function(_0x19c79a){_0x19c79a['SmsAccountId']=_0x7cc031[_0x49f9('0x5e')]['id'];return _0x19c79a;});return db['SmsApplication']['bulkCreate'](_0x4fd101,{'transaction':_0x161af7});});})[_0x49f9('0x1e')](function(){return db[_0x49f9('0xb3')]['findAndCountAll']({'where':{'SmsAccountId':_0x7cc031[_0x49f9('0x5e')]['id']},'order':_0x49f9('0x75')});});}})[_0x49f9('0x1e')](respondWithResult(_0x27f080,null))[_0x49f9('0x4f')](handleError(_0x27f080,null));};exports['getApplications']=function(_0x4e6a60,_0x227b65,_0x100083){var _0xc36a30={};var _0x307d6f={};var _0xf1f87f;var _0x1a449e;return db[_0x49f9('0x3e')][_0x49f9('0x63')]({'where':{'id':_0x4e6a60[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x227b65,null))['then'](function(_0x4a2d08){if(_0x4a2d08){_0xf1f87f=_0x4a2d08;_0x307d6f['model']=_[_0x49f9('0x51')](db[_0x49f9('0xb3')]['rawAttributes']);_0x307d6f[_0x49f9('0x43')]=_[_0x49f9('0x51')](_0x4e6a60['query']);_0x307d6f['filters']=_[_0x49f9('0x45')](_0x307d6f['model'],_0x307d6f[_0x49f9('0x43')]);_0xc36a30[_0x49f9('0x44')]=_['intersection'](_0x307d6f[_0x49f9('0x42')],qs[_0x49f9('0x53')](_0x4e6a60[_0x49f9('0x43')][_0x49f9('0x53')]));_0xc36a30[_0x49f9('0x44')]=_0xc36a30[_0x49f9('0x44')]['length']?_0xc36a30['attributes']:_0x307d6f[_0x49f9('0x42')];_0xc36a30[_0x49f9('0x48')]=qs[_0x49f9('0x49')](_0x4e6a60[_0x49f9('0x43')][_0x49f9('0x49')]);_0xc36a30[_0x49f9('0x4a')]=qs[_0x49f9('0x41')](_['pick'](_0x4e6a60['query'],_0x307d6f['filters']));if(_0x4e6a60[_0x49f9('0x43')][_0x49f9('0x4d')]){_0xc36a30[_0x49f9('0x4a')]=_[_0x49f9('0x4b')](_0xc36a30['where'],{'$or':_['map'](_0xc36a30[_0x49f9('0x44')],function(_0x43ddc7){var _0x12e465={};_0x12e465[_0x43ddc7]={'$like':'%'+_0x4e6a60[_0x49f9('0x43')][_0x49f9('0x4d')]+'%'};return _0x12e465;})});}_0xc36a30=_[_0x49f9('0x4b')]({},_0xc36a30,_0x4e6a60['options']);return _0xf1f87f[_0x49f9('0xb4')](_0xc36a30);}})[_0x49f9('0x1e')](function(_0x5d008f){if(_0x5d008f){_0x1a449e=_0x5d008f['length'];if(!_0x4e6a60[_0x49f9('0x43')][_0x49f9('0x46')](_0x49f9('0x47'))){_0xc36a30['limit']=qs[_0x49f9('0x2b')](_0x4e6a60['query'][_0x49f9('0x2b')]);_0xc36a30[_0x49f9('0x29')]=qs[_0x49f9('0x29')](_0x4e6a60[_0x49f9('0x43')][_0x49f9('0x29')]);}return _0xf1f87f['getApplications'](_0xc36a30);}})[_0x49f9('0x1e')](function(_0x434ade){if(_0x434ade){return _0x434ade?{'count':_0x1a449e,'rows':_0x434ade}:null;}})['then'](respondWithResult(_0x227b65,null))[_0x49f9('0x4f')](handleError(_0x227b65,null));};exports[_0x49f9('0xb5')]=function(_0x2c6add,_0x2d5d56,_0x3b5e41){var _0x4e7c37={'raw':![],'where':{}};var _0xb4b662={};var _0x33e066={'count':0x0,'rows':[]};return db[_0x49f9('0x3e')]['findOne']({'where':{'id':_0x2c6add[_0x49f9('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2d5d56,null))[_0x49f9('0x1e')](function(_0x109c7e){if(_0x109c7e){_0xb4b662['model']=_[_0x49f9('0x51')](db[_0x49f9('0x9c')][_0x49f9('0x52')]);_0xb4b662[_0x49f9('0x43')]=_[_0x49f9('0x51')](_0x2c6add['query']);_0xb4b662[_0x49f9('0x41')]=_[_0x49f9('0x45')](_0xb4b662[_0x49f9('0x42')],_0xb4b662[_0x49f9('0x43')]);_0x4e7c37['attributes']=_[_0x49f9('0x45')](_0xb4b662[_0x49f9('0x42')],qs[_0x49f9('0x53')](_0x2c6add[_0x49f9('0x43')][_0x49f9('0x53')]));_0x4e7c37[_0x49f9('0x44')]=_0x4e7c37[_0x49f9('0x44')][_0x49f9('0x54')]?_0x4e7c37[_0x49f9('0x44')]:_0xb4b662[_0x49f9('0x42')];if(!_0x2c6add['query']['hasOwnProperty'](_0x49f9('0x47'))){_0x4e7c37[_0x49f9('0x2b')]=qs[_0x49f9('0x2b')](_0x2c6add[_0x49f9('0x43')]['limit']);_0x4e7c37[_0x49f9('0x29')]=qs['offset'](_0x2c6add['query'][_0x49f9('0x29')]);}_0x4e7c37['order']=qs[_0x49f9('0x49')](_0x2c6add[_0x49f9('0x43')][_0x49f9('0x49')]);_0x4e7c37[_0x49f9('0x4a')]=qs[_0x49f9('0x41')](_[_0x49f9('0x64')](_0x2c6add[_0x49f9('0x43')],_0xb4b662[_0x49f9('0x41')]));_0x4e7c37[_0x49f9('0x4a')]['SmsAccountId']=_0x109c7e['id'];if(_0x2c6add[_0x49f9('0x43')][_0x49f9('0x4d')]){_0x4e7c37[_0x49f9('0x4a')]=_[_0x49f9('0x4b')](_0x4e7c37[_0x49f9('0x4a')],{'$or':_[_0x49f9('0x3d')](_0x4e7c37[_0x49f9('0x44')],function(_0x332222){var _0x565cad={};_0x565cad[_0x332222]={'$like':'%'+_0x2c6add['query']['filter']+'%'};return _0x565cad;})});}_0x4e7c37=_[_0x49f9('0x4b')]({},_0x4e7c37,_0x2c6add[_0x49f9('0x4e')]);return db[_0x49f9('0x9c')]['count']({'where':_0x4e7c37[_0x49f9('0x4a')]})[_0x49f9('0x1e')](function(_0x221218){_0x33e066['count']=_0x221218;if(_0x2c6add[_0x49f9('0x43')]['includeAll']){_0x4e7c37['include']=[{'model':db[_0x49f9('0x77')],'as':_0x49f9('0xb6'),'required':![]},{'model':db[_0x49f9('0xa5')],'as':_0x49f9('0xb7'),'attributes':[_0x49f9('0x38'),_0x49f9('0xb8'),_0x49f9('0xb9')],'required':![]},{'model':db[_0x49f9('0xba')],'as':_0x49f9('0xbb'),'attributes':['id','name',_0x49f9('0xbc')],'where':_0x2c6add[_0x49f9('0x43')]['tag']?{'id':_0x2c6add[_0x49f9('0x43')][_0x49f9('0xbd')]}:undefined,'required':_0x2c6add[_0x49f9('0x43')][_0x49f9('0xbd')]?!![]:![]}];}return db[_0x49f9('0x9c')][_0x49f9('0x67')](_0x4e7c37);})[_0x49f9('0x1e')](function(_0x50134a){_0x33e066[_0x49f9('0x68')]=_0x50134a;return _0x33e066;});}})['then'](respondWithFilteredResult(_0x2d5d56,_0x4e7c37))[_0x49f9('0x4f')](handleError(_0x2d5d56,null));};exports[_0x49f9('0x39')]=function(_0x2c7d17,_0x9b9e77,_0xf12049){var _0x43cf5c,_0x358257,_0x6fdcda;if(_[_0x49f9('0x93')](_0x2c7d17[_0x49f9('0x58')][_0x49f9('0x58')])||_0x2c7d17[_0x49f9('0x58')][_0x49f9('0x58')]===''){throw new db[(_0x49f9('0x78'))][(_0x49f9('0x79'))](_0x49f9('0xbe'));}if(_[_0x49f9('0x93')](_0x2c7d17['body']['to'])){throw new db[(_0x49f9('0x78'))]['ValidationError'](_0x49f9('0xbf'));}_0x43cf5c=_0x2c7d17[_0x49f9('0x58')]['to'];return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x2c7d17['params']['id']},'include':[{'model':db[_0x49f9('0xc0')],'as':_0x49f9('0xc1'),'include':[{'model':db[_0x49f9('0x77')],'as':_0x49f9('0x98'),'where':{'mobile':_0x43cf5c},'limit':0x1,'order':[[_0x49f9('0x7d'),_0x49f9('0x99')]]}]}]})[_0x49f9('0x1e')](handleEntityNotFound(_0x9b9e77,null))['then'](function(_0x2ba8b3){if(_0x2ba8b3&&_0x2ba8b3[_0x49f9('0xc1')]){_0x358257=_0x2ba8b3['get']({'plain':!![]});if(_0x358257[_0x49f9('0xc1')]&&_0x358257[_0x49f9('0xc1')][_0x49f9('0x98')]['length']){return _0x358257[_0x49f9('0xc1')][_0x49f9('0x98')][0x0];}return db[_0x49f9('0x77')][_0x49f9('0x57')](_['defaults'](_0x2c7d17['body'],{'firstName':_0x43cf5c,'mobile':_0x43cf5c,'phone':_0x43cf5c,'ListId':_0x358257[_0x49f9('0x7e')]}));}})['then'](handleEntityNotFound(_0x9b9e77,null))['then'](function(_0xbb437b){if(_0xbb437b){_0x6fdcda=_0xbb437b;return db[_0x49f9('0x9c')]['find']({'where':{'ContactId':_0x6fdcda['id'],'closed':![],'SmsAccountId':_0x358257['id']}})[_0x49f9('0x1e')](function(_0x1ef865){if(_0x1ef865){return[_0x1ef865,![]];}return db[_0x49f9('0x9c')][_0x49f9('0x57')]({'UserId':_0x2c7d17[_0x49f9('0x59')]['id'],'ContactId':_0x6fdcda['id'],'SmsAccountId':_0x358257['id'],'phone':_0x43cf5c,'firstMsgDirection':'out','Messages':[_[_0x49f9('0x4b')](_0x2c7d17[_0x49f9('0x58')],{'read':![],'body':_0x2c7d17[_0x49f9('0x58')][_0x49f9('0x58')],'phone':_0x43cf5c,'SmsAccountId':_0x358257['id'],'UserId':_0x2c7d17[_0x49f9('0x59')]['id'],'ContactId':_0x6fdcda['id']})]},{'include':[{'model':db[_0x49f9('0xa2')],'as':_0x49f9('0xc2')}]})[_0x49f9('0x1e')](function(_0x393a00){return[_0x393a00,!![]];});});}})[_0x49f9('0xc3')](function(_0x1da578,_0x2314a3){if(_0x2314a3){return _0x1da578;}return db[_0x49f9('0xa2')][_0x49f9('0x57')](_['merge'](_0x2c7d17[_0x49f9('0x58')],{'read':![],'body':_0x2c7d17[_0x49f9('0x58')][_0x49f9('0x58')],'phone':_0x43cf5c,'SmsAccountId':_0x358257['id'],'SmsInteractionId':_0x1da578['id'],'UserId':_0x2c7d17[_0x49f9('0x59')]['id'],'ContactId':_0x6fdcda['id']}))[_0x49f9('0x1e')](function(_0x456b1f){_0x1da578[_0x49f9('0xc4')][_0x49f9('0xc2')]=[];_0x1da578[_0x49f9('0xc4')][_0x49f9('0xc2')][_0x49f9('0x9e')](_0x456b1f[_0x49f9('0xc4')]);return _0x1da578;});})[_0x49f9('0x1e')](respondWithResult(_0x9b9e77,null))[_0x49f9('0x4f')](handleError(_0x9b9e77,null));};exports[_0x49f9('0x27')]=function(_0x3686a7,_0x12c9b4,_0xa5b39f){if(_0x3686a7[_0x49f9('0x58')]['id']){delete _0x3686a7[_0x49f9('0x58')]['id'];}var _0x97a972,_0x11ed09,_0x30d0ca;return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x3686a7[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x12c9b4,null))[_0x49f9('0x1e')](function(_0x2150c5){if(_0x2150c5){_0x30d0ca=_0x2150c5;logger[_0x49f9('0x20')](_0x49f9('0x21'),_0x49f9('0x27'),_0x49f9('0xc5'),_0x2150c5[_0x49f9('0x3f')],util[_0x49f9('0xc6')](_0x3686a7[_0x49f9('0x58')],{'showHidden':![],'depth':null}));switch(_0x2150c5[_0x49f9('0x3f')]){case _0x49f9('0xc7'):if(_0x3686a7['body']['skebby_dispatch_id']&&_0x3686a7[_0x49f9('0x58')][_0x49f9('0x27')]){_0x11ed09=_0x3686a7[_0x49f9('0x58')][_0x49f9('0x27')];return db[_0x49f9('0xa2')][_0x49f9('0x56')]({'where':{'messageId':_0x3686a7['body'][_0x49f9('0xc8')]}});}break;case _0x49f9('0xc9'):if(_0x3686a7[_0x49f9('0x58')][_0x49f9('0xca')]&&_0x3686a7[_0x49f9('0x58')][_0x49f9('0xcb')]){_0x11ed09=_0x3686a7[_0x49f9('0x58')][_0x49f9('0xcb')];return db[_0x49f9('0xa2')][_0x49f9('0x56')]({'where':{'messageId':_0x3686a7['body'][_0x49f9('0xca')]}});}break;case _0x49f9('0x84'):if(_0x3686a7['body'][_0x49f9('0x85')]&&_0x3686a7[_0x49f9('0x58')][_0x49f9('0xcc')]){_0x11ed09=_0x3686a7[_0x49f9('0x58')][_0x49f9('0xcc')];return db[_0x49f9('0xa2')][_0x49f9('0x56')]({'where':{'messageId':_0x3686a7[_0x49f9('0x58')][_0x49f9('0x85')]}});}break;case _0x49f9('0x89'):var _0x3638a6=_0x3686a7[_0x49f9('0x58')][_0x49f9('0x8a')][0x0];if(_0x3638a6[_0x49f9('0x80')]&&_0x3638a6[_0x49f9('0x27')][_0x49f9('0xcd')]===_0x49f9('0xce')){_0x11ed09=_0x3638a6[_0x49f9('0x27')][_0x49f9('0xcd')];return db[_0x49f9('0xa2')][_0x49f9('0x56')]({'where':{'messageId':_0x3638a6[_0x49f9('0x80')]}});}break;case _0x49f9('0x8d'):if(_0x3686a7[_0x49f9('0x58')]['messageId']&&_0x3686a7[_0x49f9('0x58')][_0x49f9('0x27')]){_0x11ed09=_0x3686a7['body'][_0x49f9('0x27')];return db[_0x49f9('0xa2')][_0x49f9('0x56')]({'where':{'messageId':_0x3686a7[_0x49f9('0x58')][_0x49f9('0x80')]}});}break;case _0x49f9('0x90'):if(_0x3686a7[_0x49f9('0x58')][0x0]['message']['id']){_0x11ed09=_0x3686a7[_0x49f9('0x58')][0x0]['type'];return db[_0x49f9('0xa2')][_0x49f9('0x56')]({'where':{'messageId':_0x3686a7['body'][0x0][_0x49f9('0x25')]['id']}});}break;case'intelepeer':if(_0x3686a7['body']['redif']&&_0x3686a7['body'][_0x49f9('0x27')]){_0x11ed09=_0x3686a7['body']['status'];return db[_0x49f9('0xa2')][_0x49f9('0x56')]({'where':{'messageId':_0x3686a7[_0x49f9('0x58')][_0x49f9('0xcf')]}});}break;}}})['then'](handleEntityNotFound(_0x12c9b4,null))[_0x49f9('0x1e')](function(_0x38764c){if(_0x38764c){_0x97a972=_0x38764c;switch(_0x30d0ca[_0x49f9('0x3f')]){case'skebby':if(_0x11ed09===_0x49f9('0xce')){return _0x97a972[_0x49f9('0x31')]({'read':!![]});}else{logger['error'](_0x49f9('0x21'),'status',_0x49f9('0xc7'),util[_0x49f9('0xc6')](_0x3686a7['body'],{'showHidden':![],'depth':null}));}break;case _0x49f9('0xc9'):if(_0x11ed09==='1'){return _0x97a972[_0x49f9('0x31')]({'read':!![]});}else{logger[_0x49f9('0x23')](_0x49f9('0x21'),_0x49f9('0x27'),'skebby',util[_0x49f9('0xc6')](_0x3686a7['body'],{'showHidden':![],'depth':null}));}break;case _0x49f9('0x84'):if(!_0x3686a7[_0x49f9('0x58')][_0x49f9('0xd0')]&&_0x11ed09>=0xc8&&_0x11ed09<=0xce){return _0x97a972['update']({'read':!![]});}else{logger[_0x49f9('0x23')](_0x49f9('0x21'),_0x49f9('0x27'),'clicksend',util[_0x49f9('0xc6')](_0x3686a7[_0x49f9('0x58')],{'showHidden':![],'depth':null}));}break;case _0x49f9('0x89'):var _0x313115=_0x3686a7[_0x49f9('0x58')][_0x49f9('0x8a')][0x0];if(_0x313115[_0x49f9('0x27')]['groupName']===_0x49f9('0xce')){return _0x97a972[_0x49f9('0x31')]({'read':!![]});}else{logger[_0x49f9('0x23')](_0x49f9('0x21'),_0x49f9('0x27'),_0x49f9('0x89'),util[_0x49f9('0xc6')](_0x3686a7['body'],{'showHidden':![],'depth':null}));}break;case _0x49f9('0x8d'):if(_0x11ed09==_0x49f9('0xd1')||_0x11ed09=='RECEIVED_BY_RECIPIENT'){return _0x97a972['update']({'read':!![]});}else{logger[_0x49f9('0x23')](_0x49f9('0x21'),_0x49f9('0x27'),'clickatell',util[_0x49f9('0xc6')](_0x3686a7['body'],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x11ed09==_0x49f9('0xd2')){return _0x97a972[_0x49f9('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x49f9('0x27'),_0x49f9('0x90'),util[_0x49f9('0xc6')](_0x3686a7[_0x49f9('0x58')],{'showHidden':![],'depth':null}));}break;case _0x49f9('0x91'):if(_0x11ed09===_0x49f9('0xd3')||_0x11ed09===_0x49f9('0xd4')){return _0x97a972[_0x49f9('0x31')]({'read':!![]});}else{logger['error'](_0x49f9('0x21'),_0x49f9('0x27'),'intelepeer',util[_0x49f9('0xc6')](_0x3686a7[_0x49f9('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x97a972;}})[_0x49f9('0x1e')](respondWithResult(_0x12c9b4,null))[_0x49f9('0x4f')](handleError(_0x12c9b4,null));};exports[_0x49f9('0xd5')]=function(_0x277eb0,_0xc491b4,_0x3bf3f8){var _0xa0060b,_0x43df0c,_0x3773b6;return db[_0x49f9('0x3e')]['find']({'where':{'id':_0x277eb0[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0xc491b4,null))[_0x49f9('0x1e')](function(_0x2d1252){if(_0x2d1252){_0x3773b6=_0x2d1252;logger[_0x49f9('0x20')](_0x49f9('0x21'),_0x49f9('0x27'),_0x49f9('0xc5'),_0x2d1252[_0x49f9('0x3f')],util['inspect'](_0x277eb0[_0x49f9('0x43')],{'showHidden':![],'depth':null}));switch(_0x2d1252['type']){case _0x49f9('0xd6'):if(_0x277eb0['query']['message-id']&&_0x277eb0[_0x49f9('0x43')][_0x49f9('0xd7')]){_0x43df0c=_0x277eb0[_0x49f9('0x43')][_0x49f9('0xd7')];return db['SmsMessage'][_0x49f9('0x56')]({'where':{'messageId':_0x277eb0['query'][_0x49f9('0xd8')]}});}break;}}})[_0x49f9('0x1e')](handleEntityNotFound(_0xc491b4,null))[_0x49f9('0x1e')](function(_0x1e29e8){if(_0x1e29e8){_0xa0060b=_0x1e29e8;switch(_0x3773b6[_0x49f9('0x3f')]){case _0x49f9('0xd6'):if(_0x43df0c==='2'||_0x43df0c==='6'){return _0xa0060b[_0x49f9('0x31')]({'read':!![]});}else{logger[_0x49f9('0x23')](_0x49f9('0x21'),'status',_0x49f9('0xd6'),util[_0x49f9('0xc6')](_0x277eb0[_0x49f9('0x43')],{'showHidden':![],'depth':null}));};break;}return _0xa0060b;}})[_0x49f9('0x1e')](respondWithResult(_0xc491b4,null))[_0x49f9('0x4f')](handleError(_0xc491b4,null));};exports[_0x49f9('0xd9')]=function(_0x599a31,_0x275f2d,_0x2cfce3){return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x599a31[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x275f2d,null))['then'](function(_0x496e08){if(_0x496e08){return _0x496e08['addAgents'](_0x599a31['body']['ids'],_[_0x49f9('0x9b')](_0x599a31[_0x49f9('0x58')],[_0x49f9('0x6a'),'id'])||{})[_0x49f9('0xc3')](function(_0x37404c){for(var _0x4b8d05=0x0;_0x4b8d05<_0x599a31[_0x49f9('0x58')][_0x49f9('0x6a')][_0x49f9('0x54')];_0x4b8d05+=0x1){socket[_0x49f9('0xda')](_0x49f9('0xdb'),{'UserId':Number(_0x599a31[_0x49f9('0x58')][_0x49f9('0x6a')][_0x4b8d05]),'SmsAccountId':Number(_0x599a31[_0x49f9('0x5e')]['id'])});}return _0x37404c;});}})['then'](respondWithResult(_0x275f2d,null))[_0x49f9('0x4f')](handleError(_0x275f2d,null));};exports[_0x49f9('0xdc')]=function(_0x44a823,_0x4f8562,_0x2d8242){return db[_0x49f9('0x3e')][_0x49f9('0x56')]({'where':{'id':_0x44a823[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x4f8562,null))[_0x49f9('0x1e')](function(_0x199e49){if(_0x199e49){return _0x199e49['removeAgents'](_0x44a823['query']['ids'])[_0x49f9('0x1e')](function(){if(_['isArray'](_0x44a823[_0x49f9('0x43')][_0x49f9('0x6a')])){for(var _0x1c783f=0x0;_0x1c783f<_0x44a823[_0x49f9('0x43')][_0x49f9('0x6a')][_0x49f9('0x54')];_0x1c783f+=0x1){socket[_0x49f9('0xda')](_0x49f9('0xdd'),{'UserId':Number(_0x44a823[_0x49f9('0x43')][_0x49f9('0x6a')][_0x1c783f]),'SmsAccountId':Number(_0x44a823[_0x49f9('0x5e')]['id'])});}}else{socket[_0x49f9('0xda')]('userSmsAccount:remove',{'UserId':Number(_0x44a823[_0x49f9('0x43')][_0x49f9('0x6a')]),'SmsAccountId':Number(_0x44a823[_0x49f9('0x5e')]['id'])});}});}})[_0x49f9('0x1e')](respondWithStatusCode(_0x4f8562,null))['catch'](handleError(_0x4f8562,null));};exports[_0x49f9('0xde')]=function(_0x244c27,_0x414231,_0x3f7841){var _0x15baec={};var _0x396e11={};var _0x130b3a;var _0x4087fc;return db['SmsAccount'][_0x49f9('0x63')]({'where':{'id':_0x244c27[_0x49f9('0x5e')]['id']}})[_0x49f9('0x1e')](handleEntityNotFound(_0x414231,null))[_0x49f9('0x1e')](function(_0x4a346a){if(_0x4a346a){_0x130b3a=_0x4a346a;_0x396e11[_0x49f9('0x42')]=_[_0x49f9('0x51')](db[_0x49f9('0xa5')]['rawAttributes']);_0x396e11[_0x49f9('0x43')]=_[_0x49f9('0x51')](_0x244c27[_0x49f9('0x43')]);_0x396e11[_0x49f9('0x41')]=_[_0x49f9('0x45')](_0x396e11[_0x49f9('0x42')],_0x396e11[_0x49f9('0x43')]);_0x15baec[_0x49f9('0x44')]=_[_0x49f9('0x45')](_0x396e11[_0x49f9('0x42')],qs[_0x49f9('0x53')](_0x244c27['query'][_0x49f9('0x53')]));_0x15baec['attributes']=_0x15baec['attributes']['length']?_0x15baec['attributes']:_0x396e11[_0x49f9('0x42')];_0x15baec[_0x49f9('0x48')]=qs[_0x49f9('0x49')](_0x244c27[_0x49f9('0x43')]['sort']);_0x15baec[_0x49f9('0x4a')]=qs['filters'](_[_0x49f9('0x64')](_0x244c27[_0x49f9('0x43')],_0x396e11[_0x49f9('0x41')]));if(_0x244c27[_0x49f9('0x43')][_0x49f9('0x4d')]){_0x15baec['where']=_[_0x49f9('0x4b')](_0x15baec[_0x49f9('0x4a')],{'$or':_[_0x49f9('0x3d')](_0x15baec[_0x49f9('0x44')],function(_0x3ef7a3){var _0x5860bf={};_0x5860bf[_0x3ef7a3]={'$like':'%'+_0x244c27[_0x49f9('0x43')]['filter']+'%'};return _0x5860bf;})});}_0x15baec=_[_0x49f9('0x4b')]({},_0x15baec,_0x244c27[_0x49f9('0x4e')]);return _0x130b3a[_0x49f9('0xde')](_0x15baec);}})['then'](function(_0x2d265d){if(_0x2d265d){_0x4087fc=_0x2d265d[_0x49f9('0x54')];if(!_0x244c27[_0x49f9('0x43')]['hasOwnProperty']('nolimit')){_0x15baec[_0x49f9('0x2b')]=qs[_0x49f9('0x2b')](_0x244c27['query']['limit']);_0x15baec[_0x49f9('0x29')]=qs[_0x49f9('0x29')](_0x244c27['query'][_0x49f9('0x29')]);}return _0x130b3a[_0x49f9('0xde')](_0x15baec);}})['then'](function(_0x20b4f7){if(_0x20b4f7){return _0x20b4f7?{'count':_0x4087fc,'rows':_0x20b4f7}:null;}})['then'](respondWithResult(_0x414231,null))['catch'](handleError(_0x414231,null));}; \ No newline at end of file +var _0x71d6=['message','result','catch','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','rawAttributes','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','SmsAccount','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','order','SmsAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','sms','Applications','account','applications','orderBy','priority','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','from','From','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','plivo','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','SmsApplication','bulkCreate','findAndCountAll','getApplications','Contact','User','Owner','fullname','internal','Tags','color','tag','CmList','List','ListId','out','SmsMessage','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','requestid','statusInt','status_code','infobip','groupName','redif','DELIVERED','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','SmsAccount,\x20%s,\x20%s'];(function(_0x393c31,_0xa685ef){var _0x51ad53=function(_0xf2b7d2){while(--_0xf2b7d2){_0x393c31['push'](_0x393c31['shift']());}};_0x51ad53(++_0xa685ef);}(_0x71d6,0xba));var _0x671d=function(_0x42689a,_0x1cd1f8){_0x42689a=_0x42689a-0x0;var _0x7a9a31=_0x71d6[_0x42689a];return _0x7a9a31;};'use strict';var emlformat=require(_0x671d('0x0'));var rimraf=require(_0x671d('0x1'));var zipdir=require(_0x671d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x671d('0x3'));var Mustache=require(_0x671d('0x4'));var util=require('util');var path=require(_0x671d('0x5'));var sox=require(_0x671d('0x6'));var csv=require(_0x671d('0x7'));var ejs=require(_0x671d('0x8'));var fs=require('fs');var fs_extra=require(_0x671d('0x9'));var _=require(_0x671d('0xa'));var squel=require(_0x671d('0xb'));var crypto=require(_0x671d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x671d('0xd'));var toCsv=require(_0x671d('0x7'));var querystring=require(_0x671d('0xe'));var Papa=require(_0x671d('0xf'));var Redis=require(_0x671d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x671d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x671d('0x12'));var logger=require('../../config/logger')(_0x671d('0x13'));var utils=require(_0x671d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x671d('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x671d('0x16')](config[_0x671d('0x17')],{'host':_0x671d('0x18'),'port':0x18eb});var socket=require(_0x671d('0x19'))(new Redis(config['redis']));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x671d('0x1a'));var client=jayson['client'][_0x671d('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x3ab4ae,_0x35af77,_0x1fe468,_0x55bdba){return new BPromise(function(_0x29bf70,_0x35ee65){var _0x3208a1=_0x55bdba||client;return _0x3208a1[_0x671d('0x1c')](_0x3ab4ae,_0x1fe468)[_0x671d('0x1d')](function(_0x5a4eb6){logger['info']('SmsAccount,\x20%s,\x20%s',_0x35af77,_0x671d('0x1e'));logger[_0x671d('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x35af77,_0x671d('0x1e'),JSON[_0x671d('0x20')](_0x5a4eb6));if(_0x5a4eb6[_0x671d('0x21')]){if(_0x5a4eb6[_0x671d('0x21')]['code']===0x1f4){logger['error'](_0x671d('0x22'),_0x35af77,_0x5a4eb6[_0x671d('0x21')]['message']);return _0x35ee65(_0x5a4eb6[_0x671d('0x21')]['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x35af77,_0x5a4eb6[_0x671d('0x21')][_0x671d('0x23')]);return _0x29bf70(_0x5a4eb6[_0x671d('0x21')][_0x671d('0x23')]);}else{logger['info'](_0x671d('0x22'),_0x35af77,_0x671d('0x1e'));_0x29bf70(_0x5a4eb6[_0x671d('0x24')][_0x671d('0x23')]);}})[_0x671d('0x25')](function(_0x424730){logger[_0x671d('0x21')](_0x671d('0x22'),_0x35af77,_0x424730);_0x35ee65(_0x424730);});});}function respondWithStatusCode(_0x34f1eb,_0x17948d){_0x17948d=_0x17948d||0xcc;return function(_0x1bb007){if(_0x1bb007){return _0x34f1eb[_0x671d('0x26')](_0x17948d);}return _0x34f1eb[_0x671d('0x27')](_0x17948d)['end']();};}function respondWithResult(_0x5d15e5,_0x400442){_0x400442=_0x400442||0xc8;return function(_0x535988){if(_0x535988){return _0x5d15e5[_0x671d('0x27')](_0x400442)[_0x671d('0x28')](_0x535988);}};}function respondWithFilteredResult(_0x89e0a1,_0x4cb751){return function(_0x278217){if(_0x278217){var _0x457742=typeof _0x4cb751['offset']===_0x671d('0x29')&&typeof _0x4cb751[_0x671d('0x2a')]===_0x671d('0x29');var _0x396598=_0x278217[_0x671d('0x2b')];var _0x4138ed=_0x457742?0x0:_0x4cb751[_0x671d('0x2c')];var _0x55bbc0=_0x457742?_0x278217['count']:_0x4cb751[_0x671d('0x2c')]+_0x4cb751[_0x671d('0x2a')];var _0x5aebbc;if(_0x55bbc0>=_0x396598){_0x55bbc0=_0x396598;_0x5aebbc=0xc8;}else{_0x5aebbc=0xce;}_0x89e0a1[_0x671d('0x27')](_0x5aebbc);return _0x89e0a1[_0x671d('0x2d')]('Content-Range',_0x4138ed+'-'+_0x55bbc0+'/'+_0x396598)[_0x671d('0x28')](_0x278217);}return null;};}function patchUpdates(_0xc0ea0e){return function(_0x276d1f){try{jsonpatch[_0x671d('0x2e')](_0x276d1f,_0xc0ea0e,!![]);}catch(_0x424937){return BPromise[_0x671d('0x2f')](_0x424937);}return _0x276d1f[_0x671d('0x30')]();};}function saveUpdates(_0x54d2ab,_0x248576){return function(_0x980810){if(_0x980810){return _0x980810[_0x671d('0x31')](_0x54d2ab)[_0x671d('0x1d')](function(_0x3279a4){return _0x3279a4;});}return null;};}function removeEntity(_0x7951cc,_0x1289c8){return function(_0x30fea4){if(_0x30fea4){return _0x30fea4['destroy']()[_0x671d('0x1d')](function(){var _0x5a3ef0=_0x30fea4[_0x671d('0x32')]({'plain':!![]});var _0x174c14=_0x671d('0x33');return db[_0x671d('0x34')][_0x671d('0x35')]({'where':{'type':_0x174c14,'resourceId':_0x5a3ef0['id']}})[_0x671d('0x1d')](function(){return _0x30fea4;});})[_0x671d('0x1d')](function(){_0x7951cc[_0x671d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5097b0,_0x4f79b4){return function(_0x4772bc){if(!_0x4772bc){_0x5097b0[_0x671d('0x26')](0x194);}return _0x4772bc;};}function handleError(_0x486258,_0x2ee1ef){_0x2ee1ef=_0x2ee1ef||0x1f4;return function(_0x19f5ea){logger['error'](_0x19f5ea[_0x671d('0x36')]);if(_0x19f5ea[_0x671d('0x37')]){delete _0x19f5ea[_0x671d('0x37')];}_0x486258['status'](_0x2ee1ef)[_0x671d('0x38')](_0x19f5ea);};}exports[_0x671d('0x39')]=function(_0x29cd31,_0x3d5b2e){var _0x471bb0={'include':[{'model':db[_0x671d('0x3a')],'as':_0x671d('0x3b')}]},_0x1e3a17={},_0x3019ee={'count':0x0,'rows':[]};var _0x3755fa=_['map'](db['SmsAccount'][_0x671d('0x3c')],function(_0x15f9ab){return{'name':_0x15f9ab['fieldName'],'type':_0x15f9ab[_0x671d('0x3d')]['key']};});_0x1e3a17['model']=_[_0x671d('0x3e')](_0x3755fa,_0x671d('0x37'));_0x1e3a17[_0x671d('0x3f')]=_[_0x671d('0x40')](_0x29cd31['query']);_0x1e3a17[_0x671d('0x41')]=_[_0x671d('0x42')](_0x1e3a17[_0x671d('0x43')],_0x1e3a17[_0x671d('0x3f')]);_0x471bb0[_0x671d('0x44')]=_[_0x671d('0x42')](_0x1e3a17['model'],qs[_0x671d('0x45')](_0x29cd31['query'][_0x671d('0x45')]));_0x471bb0['attributes']=_0x471bb0['attributes'][_0x671d('0x46')]?_0x471bb0[_0x671d('0x44')]:_0x1e3a17[_0x671d('0x43')];if(!_0x29cd31['query'][_0x671d('0x47')]('nolimit')){_0x471bb0[_0x671d('0x2a')]=qs[_0x671d('0x2a')](_0x29cd31[_0x671d('0x3f')][_0x671d('0x2a')]);_0x471bb0[_0x671d('0x2c')]=qs[_0x671d('0x2c')](_0x29cd31[_0x671d('0x3f')]['offset']);}_0x471bb0['order']=qs[_0x671d('0x48')](_0x29cd31['query'][_0x671d('0x48')]);_0x471bb0['where']=qs[_0x671d('0x41')](_[_0x671d('0x49')](_0x29cd31[_0x671d('0x3f')],_0x1e3a17[_0x671d('0x41')]),_0x3755fa);if(_0x29cd31[_0x671d('0x3f')][_0x671d('0x4a')]){_0x471bb0[_0x671d('0x4b')]=_['merge'](_0x471bb0[_0x671d('0x4b')],{'$or':_['map'](_0x3755fa,function(_0x2762f3){if(_0x2762f3[_0x671d('0x3d')]!=='VIRTUAL'){var _0x1ce295={};_0x1ce295[_0x2762f3[_0x671d('0x37')]]={'$like':'%'+_0x29cd31[_0x671d('0x3f')][_0x671d('0x4a')]+'%'};return _0x1ce295;}})});}_0x471bb0=_[_0x671d('0x4c')]({},_0x471bb0,_0x29cd31[_0x671d('0x4d')]);var _0x36ced9={'where':_0x471bb0[_0x671d('0x4b')]};return db['SmsAccount']['count'](_0x36ced9)[_0x671d('0x1d')](function(_0x706a26){_0x3019ee[_0x671d('0x2b')]=_0x706a26;if(_0x29cd31[_0x671d('0x3f')][_0x671d('0x4e')]){_0x471bb0[_0x671d('0x4f')]=[{'all':!![]}];}return db['SmsAccount'][_0x671d('0x50')](_0x471bb0);})['then'](function(_0x295965){_0x3019ee[_0x671d('0x51')]=_0x295965;return _0x3019ee;})[_0x671d('0x1d')](respondWithFilteredResult(_0x3d5b2e,_0x471bb0))[_0x671d('0x25')](handleError(_0x3d5b2e,null));};exports[_0x671d('0x52')]=function(_0x142f70,_0x39031a){var _0x4cac01={'raw':![],'where':{'id':_0x142f70[_0x671d('0x53')]['id']},'include':[{'model':db[_0x671d('0x3a')],'as':_0x671d('0x3b')}]},_0x1c7a2d={};_0x1c7a2d[_0x671d('0x43')]=_[_0x671d('0x40')](db['SmsAccount']['rawAttributes']);_0x1c7a2d[_0x671d('0x3f')]=_[_0x671d('0x40')](_0x142f70[_0x671d('0x3f')]);_0x1c7a2d[_0x671d('0x41')]=_[_0x671d('0x42')](_0x1c7a2d[_0x671d('0x43')],_0x1c7a2d[_0x671d('0x3f')]);_0x4cac01['attributes']=_[_0x671d('0x42')](_0x1c7a2d[_0x671d('0x43')],qs['fields'](_0x142f70[_0x671d('0x3f')][_0x671d('0x45')]));_0x4cac01[_0x671d('0x44')]=_0x4cac01[_0x671d('0x44')][_0x671d('0x46')]?_0x4cac01[_0x671d('0x44')]:_0x1c7a2d['model'];if(_0x142f70['query'][_0x671d('0x4e')]){_0x4cac01[_0x671d('0x4f')]=[{'all':!![]}];}_0x4cac01=_[_0x671d('0x4c')]({},_0x4cac01,_0x142f70['options']);return db[_0x671d('0x54')][_0x671d('0x55')](_0x4cac01)[_0x671d('0x1d')](handleEntityNotFound(_0x39031a,null))[_0x671d('0x1d')](respondWithResult(_0x39031a,null))['catch'](handleError(_0x39031a,null));};exports[_0x671d('0x56')]=function(_0x461d06,_0x43df94){return db['SmsAccount'][_0x671d('0x56')](_0x461d06[_0x671d('0x57')],{})[_0x671d('0x1d')](function(_0x14bacd){var _0x3d0e06=_0x461d06[_0x671d('0x58')]['get']({'plain':!![]});if(!_0x3d0e06)throw new Error(_0x671d('0x59'));if(_0x3d0e06[_0x671d('0x5a')]==='user'){var _0x35c567=_0x14bacd['get']({'plain':!![]});var _0x4385e0=_0x671d('0x33');return db[_0x671d('0x5b')][_0x671d('0x55')]({'where':{'name':_0x4385e0,'userProfileId':_0x3d0e06[_0x671d('0x5c')]},'raw':!![]})[_0x671d('0x1d')](function(_0x474243){if(_0x474243&&_0x474243[_0x671d('0x5d')]===0x0){return db[_0x671d('0x34')]['create']({'name':_0x35c567[_0x671d('0x37')],'resourceId':_0x35c567['id'],'type':_0x474243[_0x671d('0x37')],'sectionId':_0x474243['id']},{})[_0x671d('0x1d')](function(){return _0x14bacd;});}else{return _0x14bacd;}})[_0x671d('0x25')](function(_0x81547d){logger[_0x671d('0x21')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x81547d);throw _0x81547d;});}return _0x14bacd;})[_0x671d('0x1d')](respondWithResult(_0x43df94,0xc9))['catch'](handleError(_0x43df94,null));};exports[_0x671d('0x31')]=function(_0x164c72,_0x45bf66){if(_0x164c72[_0x671d('0x57')]['id']){delete _0x164c72['body']['id'];}return db[_0x671d('0x54')]['find']({'where':{'id':_0x164c72[_0x671d('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x671d('0x3b')}]})['then'](handleEntityNotFound(_0x45bf66,null))[_0x671d('0x1d')](saveUpdates(_0x164c72[_0x671d('0x57')],null))[_0x671d('0x1d')](respondWithResult(_0x45bf66,null))[_0x671d('0x25')](handleError(_0x45bf66,null));};exports[_0x671d('0x35')]=function(_0x3a827a,_0x4d0db4){return db[_0x671d('0x54')][_0x671d('0x55')]({'where':{'id':_0x3a827a[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x4d0db4,null))[_0x671d('0x1d')](removeEntity(_0x4d0db4,null))[_0x671d('0x25')](handleError(_0x4d0db4,null));};exports[_0x671d('0x5e')]=function(_0x3b400f,_0x403c8c){return db[_0x671d('0x54')][_0x671d('0x5e')]()[_0x671d('0x1d')](respondWithResult(_0x403c8c,null))[_0x671d('0x25')](handleError(_0x403c8c,null));};exports[_0x671d('0x5f')]=function(_0x497e23,_0x2304fc,_0x218bc7){if(_0x497e23[_0x671d('0x57')]['id']){delete _0x497e23[_0x671d('0x57')]['id'];}return db[_0x671d('0x54')]['find']({'where':{'id':_0x497e23[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x2304fc,null))[_0x671d('0x1d')](function(_0x3b81e3){if(_0x3b81e3){_0x497e23[_0x671d('0x57')]['SmsAccountId']=_0x3b81e3['id'];return db[_0x671d('0x60')][_0x671d('0x56')](_0x497e23[_0x671d('0x57')]);}})[_0x671d('0x1d')](respondWithResult(_0x2304fc,null))[_0x671d('0x25')](handleError(_0x2304fc,null));};exports[_0x671d('0x61')]=function(_0x57eb4d,_0x16f097,_0x5dadf5){var _0x424226={'raw':![],'where':{}};var _0x5d6dd2={};var _0x3493df={'count':0x0,'rows':[]};return db[_0x671d('0x54')][_0x671d('0x62')]({'where':{'id':_0x57eb4d['params']['id']}})['then'](handleEntityNotFound(_0x16f097,null))['then'](function(_0xf74c00){if(_0xf74c00){_0x5d6dd2[_0x671d('0x43')]=_[_0x671d('0x40')](db[_0x671d('0x60')][_0x671d('0x3c')]);_0x5d6dd2[_0x671d('0x3f')]=_[_0x671d('0x40')](_0x57eb4d[_0x671d('0x3f')]);_0x5d6dd2[_0x671d('0x41')]=_[_0x671d('0x42')](_0x5d6dd2[_0x671d('0x43')],_0x5d6dd2[_0x671d('0x3f')]);_0x424226[_0x671d('0x44')]=_[_0x671d('0x42')](_0x5d6dd2[_0x671d('0x43')],qs[_0x671d('0x45')](_0x57eb4d[_0x671d('0x3f')][_0x671d('0x45')]));_0x424226[_0x671d('0x44')]=_0x424226[_0x671d('0x44')]['length']?_0x424226[_0x671d('0x44')]:_0x5d6dd2[_0x671d('0x43')];if(!_0x57eb4d[_0x671d('0x3f')][_0x671d('0x47')](_0x671d('0x63'))){_0x424226[_0x671d('0x2a')]=qs[_0x671d('0x2a')](_0x57eb4d[_0x671d('0x3f')][_0x671d('0x2a')]);_0x424226['offset']=qs[_0x671d('0x2c')](_0x57eb4d[_0x671d('0x3f')]['offset']);}_0x424226[_0x671d('0x64')]=qs[_0x671d('0x48')](_0x57eb4d['query']['sort']);_0x424226[_0x671d('0x4b')]=qs['filters'](_[_0x671d('0x49')](_0x57eb4d['query'],_0x5d6dd2[_0x671d('0x41')]));_0x424226[_0x671d('0x4b')][_0x671d('0x65')]=_0xf74c00['id'];if(_0x57eb4d[_0x671d('0x3f')][_0x671d('0x4a')]){_0x424226[_0x671d('0x4b')]=_[_0x671d('0x4c')](_0x424226['where'],{'$or':_['map'](_0x424226[_0x671d('0x44')],function(_0x44f4f9){var _0x4d523f={};_0x4d523f[_0x44f4f9]={'$like':'%'+_0x57eb4d['query'][_0x671d('0x4a')]+'%'};return _0x4d523f;})});}_0x424226=_[_0x671d('0x4c')]({},_0x424226,_0x57eb4d[_0x671d('0x4d')]);return db['Disposition'][_0x671d('0x2b')]({'where':_0x424226[_0x671d('0x4b')]})['then'](function(_0x3df9e9){_0x3493df[_0x671d('0x2b')]=_0x3df9e9;if(_0x57eb4d[_0x671d('0x3f')][_0x671d('0x4e')]){_0x424226[_0x671d('0x4f')]=[{'all':!![]}];}return db[_0x671d('0x60')][_0x671d('0x50')](_0x424226);})[_0x671d('0x1d')](function(_0x5a12cf){_0x3493df['rows']=_0x5a12cf;return _0x3493df;});}})[_0x671d('0x1d')](respondWithFilteredResult(_0x16f097,_0x424226))[_0x671d('0x25')](handleError(_0x16f097,null));};exports[_0x671d('0x66')]=function(_0x5226ee,_0x572719,_0x255956){return db[_0x671d('0x54')][_0x671d('0x55')]({'where':{'id':_0x5226ee[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x572719,null))[_0x671d('0x1d')](function(_0x448242){if(_0x448242){return _0x448242['removeDispositions'](_0x5226ee['query'][_0x671d('0x67')]);}})[_0x671d('0x1d')](respondWithStatusCode(_0x572719,null))['catch'](handleError(_0x572719,null));};exports[_0x671d('0x68')]=function(_0x35af2a,_0x30fd4e,_0x59c056){if(_0x35af2a['body']['id']){delete _0x35af2a['body']['id'];}return db[_0x671d('0x54')][_0x671d('0x55')]({'where':{'id':_0x35af2a[_0x671d('0x53')]['id']}})['then'](handleEntityNotFound(_0x30fd4e,null))[_0x671d('0x1d')](function(_0x5529cb){if(_0x5529cb){_0x35af2a['body'][_0x671d('0x65')]=_0x5529cb['id'];return db[_0x671d('0x69')][_0x671d('0x56')](_0x35af2a['body']);}})[_0x671d('0x1d')](respondWithResult(_0x30fd4e,null))[_0x671d('0x25')](handleError(_0x30fd4e,null));};exports[_0x671d('0x6a')]=function(_0x51fea6,_0x12471f,_0x51bdf7){var _0x5b5267={'raw':![],'where':{}};var _0x272148={};var _0x24ddfe={'count':0x0,'rows':[]};return db[_0x671d('0x54')]['findOne']({'where':{'id':_0x51fea6['params']['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x12471f,null))[_0x671d('0x1d')](function(_0x5385aa){if(_0x5385aa){_0x272148[_0x671d('0x43')]=_[_0x671d('0x40')](db[_0x671d('0x69')][_0x671d('0x3c')]);_0x272148['query']=_[_0x671d('0x40')](_0x51fea6['query']);_0x272148[_0x671d('0x41')]=_['intersection'](_0x272148['model'],_0x272148[_0x671d('0x3f')]);_0x5b5267[_0x671d('0x44')]=_[_0x671d('0x42')](_0x272148[_0x671d('0x43')],qs['fields'](_0x51fea6['query']['fields']));_0x5b5267[_0x671d('0x44')]=_0x5b5267[_0x671d('0x44')][_0x671d('0x46')]?_0x5b5267[_0x671d('0x44')]:_0x272148[_0x671d('0x43')];if(!_0x51fea6[_0x671d('0x3f')]['hasOwnProperty']('nolimit')){_0x5b5267[_0x671d('0x2a')]=qs['limit'](_0x51fea6[_0x671d('0x3f')][_0x671d('0x2a')]);_0x5b5267[_0x671d('0x2c')]=qs[_0x671d('0x2c')](_0x51fea6['query'][_0x671d('0x2c')]);}_0x5b5267[_0x671d('0x64')]=qs[_0x671d('0x48')](_0x51fea6[_0x671d('0x3f')][_0x671d('0x48')]);_0x5b5267['where']=qs[_0x671d('0x41')](_[_0x671d('0x49')](_0x51fea6['query'],_0x272148['filters']));_0x5b5267['where'][_0x671d('0x65')]=_0x5385aa['id'];if(_0x51fea6[_0x671d('0x3f')][_0x671d('0x4a')]){_0x5b5267[_0x671d('0x4b')]=_[_0x671d('0x4c')](_0x5b5267[_0x671d('0x4b')],{'$or':_['map'](_0x5b5267['attributes'],function(_0xbbaed1){var _0x21ee90={};_0x21ee90[_0xbbaed1]={'$like':'%'+_0x51fea6[_0x671d('0x3f')]['filter']+'%'};return _0x21ee90;})});}_0x5b5267=_[_0x671d('0x4c')]({},_0x5b5267,_0x51fea6['options']);return db[_0x671d('0x69')][_0x671d('0x2b')]({'where':_0x5b5267[_0x671d('0x4b')]})[_0x671d('0x1d')](function(_0x145cf7){_0x24ddfe[_0x671d('0x2b')]=_0x145cf7;if(_0x51fea6[_0x671d('0x3f')]['includeAll']){_0x5b5267[_0x671d('0x4f')]=[{'all':!![]}];}return db[_0x671d('0x69')]['findAll'](_0x5b5267);})['then'](function(_0x2129a5){_0x24ddfe['rows']=_0x2129a5;return _0x24ddfe;});}})[_0x671d('0x1d')](respondWithFilteredResult(_0x12471f,_0x5b5267))[_0x671d('0x25')](handleError(_0x12471f,null));};exports[_0x671d('0x6b')]=function(_0x296733,_0x544e02,_0x4ba7b6){return db[_0x671d('0x54')]['find']({'where':{'id':_0x296733[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x544e02,null))[_0x671d('0x1d')](function(_0x13fab4){if(_0x13fab4){return _0x13fab4[_0x671d('0x6b')](_0x296733[_0x671d('0x3f')][_0x671d('0x67')]);}})[_0x671d('0x1d')](respondWithStatusCode(_0x544e02,null))[_0x671d('0x25')](handleError(_0x544e02,null));};exports['notify']=function(_0x3a477f,_0x1a0a9a,_0x25c238){var _0x2474e6={'channel':_0x671d('0x6c')};var _0x4f94a0=[];var _0x283d1c=[];var _0x2b5a29={};return db[_0x671d('0x54')][_0x671d('0x55')]({'where':{'id':_0x3a477f[_0x671d('0x53')]['id']},'include':[{'model':db['SmsApplication'],'as':_0x671d('0x6d')}]})[_0x671d('0x1d')](handleEntityNotFound(_0x1a0a9a,null))[_0x671d('0x1d')](function(_0x4b6390){_0x2474e6[_0x671d('0x6e')]=_0x4b6390;_0x2474e6[_0x671d('0x6f')]=_[_0x671d('0x70')](_0x4b6390[_0x671d('0x6d')],[_0x671d('0x71')],['asc']);if(_0x2474e6[_0x671d('0x6e')][_0x671d('0x6d')]){delete _0x2474e6[_0x671d('0x6e')][_0x671d('0x6d')];}return db[_0x671d('0x72')][_0x671d('0x5e')]();})[_0x671d('0x1d')](function(_0x4e6fce){if(!_0x4e6fce){throw new db[(_0x671d('0x73'))][(_0x671d('0x74'))](_0x671d('0x75'));}_0x4f94a0=_[_0x671d('0x76')](_[_0x671d('0x40')](_0x4e6fce),[_0x671d('0x77'),_0x671d('0x78')]);_0x283d1c=_[_0x671d('0x76')](_['keys'](_0x4e6fce),['createdAt','updatedAt',_0x671d('0x79'),'ListId']);_0x2474e6[_0x671d('0x57')]={'mapKey':_0x671d('0x7a')};if(_0x2474e6[_0x671d('0x6e')][_0x671d('0x3d')]){switch(_0x2474e6['account'][_0x671d('0x3d')]){case'twilio':_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')]=_0x3a477f['body'][_0x671d('0x7c')];_0x2474e6[_0x671d('0x57')]['body']=_0x3a477f[_0x671d('0x57')][_0x671d('0x7d')];_0x2474e6[_0x671d('0x57')][_0x671d('0x7e')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x7f')];break;case'skebby':_0x2474e6[_0x671d('0x57')]['from']='+'+_0x3a477f[_0x671d('0x57')][_0x671d('0x80')];_0x2474e6[_0x671d('0x57')]['body']=_0x3a477f[_0x671d('0x57')][_0x671d('0x81')];break;case _0x671d('0x82'):_0x2474e6[_0x671d('0x57')]['from']=_0x3a477f[_0x671d('0x57')][_0x671d('0x7b')];_0x2474e6['body']['body']=_0x3a477f[_0x671d('0x57')]['message'];break;case _0x671d('0x83'):_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')]=_0x3a477f['body'][_0x671d('0x7b')];_0x2474e6[_0x671d('0x57')][_0x671d('0x57')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x57')];_0x2474e6['body'][_0x671d('0x7e')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x84')];break;case _0x671d('0x85'):_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x7c')];_0x2474e6['body']['body']=_0x3a477f[_0x671d('0x57')]['Text'];_0x2474e6[_0x671d('0x57')]['messageId']=_0x3a477f['body'][_0x671d('0x86')];break;case'infobip':_0x2474e6['body'][_0x671d('0x7b')]='+'+_0x3a477f[_0x671d('0x57')][_0x671d('0x87')][0x0]['from'];_0x2474e6[_0x671d('0x57')][_0x671d('0x57')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x87')][0x0][_0x671d('0x81')];_0x2474e6['body'][_0x671d('0x7e')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x87')][0x0]['messageId'];break;case _0x671d('0x88'):_0x2474e6[_0x671d('0x57')]['from']=_0x3a477f[_0x671d('0x57')][_0x671d('0x89')];_0x2474e6[_0x671d('0x57')][_0x671d('0x57')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x8a')][_0x671d('0x23')];break;case _0x671d('0x8b'):_0x2474e6[_0x671d('0x57')]['from']=_0x3a477f[_0x671d('0x57')][_0x671d('0x8c')];_0x2474e6[_0x671d('0x57')][_0x671d('0x57')]=_0x3a477f[_0x671d('0x57')][_0x671d('0x81')];_0x2474e6[_0x671d('0x57')][_0x671d('0x7e')]=_0x3a477f[_0x671d('0x57')]['replyMessageId'];break;case _0x671d('0x8d'):_0x2474e6[_0x671d('0x57')][_0x671d('0x7e')]=_0x3a477f[_0x671d('0x57')][0x0]['message']['id'];_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')]=_0x3a477f[_0x671d('0x57')][0x0][_0x671d('0x23')][_0x671d('0x7b')];_0x2474e6[_0x671d('0x57')][_0x671d('0x57')]=_0x3a477f[_0x671d('0x57')][0x0][_0x671d('0x23')][_0x671d('0x81')];break;case _0x671d('0x8e'):_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')]=_0x3a477f[_0x671d('0x57')]['from'];_0x2474e6[_0x671d('0x57')][_0x671d('0x57')]=_0x3a477f['body']['message'];_0x2474e6[_0x671d('0x57')]['messageId']=_0x3a477f[_0x671d('0x57')][_0x671d('0x8f')];break;}}if(_0x2474e6[_0x671d('0x57')]['id']){delete _0x2474e6['body']['id'];}if(_['isNil'](_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')])){throw new db[(_0x671d('0x73'))][(_0x671d('0x74'))](_0x671d('0x90'));}if(_[_0x671d('0x91')](_0x2474e6[_0x671d('0x57')][_0x671d('0x57')])||_0x2474e6['body'][_0x671d('0x57')]===''){throw new db[(_0x671d('0x73'))][(_0x671d('0x74'))](_0x671d('0x92'));}if(_[_0x671d('0x91')](_0x2474e6[_0x671d('0x57')][_0x671d('0x93')])){throw new db[(_0x671d('0x73'))][(_0x671d('0x74'))](_0x671d('0x94')+_0x283d1c);}if(!_[_0x671d('0x95')](_0x283d1c,_0x2474e6[_0x671d('0x57')][_0x671d('0x93')])){throw new db['Sequelize'][(_0x671d('0x74'))](_0x671d('0x96')+_0x283d1c);}_0x2b5a29[_0x2474e6[_0x671d('0x57')][_0x671d('0x93')]]=_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')];return db['CmList']['find']({'where':{'id':_0x2474e6[_0x671d('0x6e')]['ListId']},'include':[{'model':db[_0x671d('0x72')],'as':_0x671d('0x97'),'where':_0x2b5a29,'limit':0x1,'order':[[_0x671d('0x78'),_0x671d('0x98')]]}]});})['then'](handleEntityNotFound(_0x1a0a9a,null))[_0x671d('0x1d')](function(_0x47fcd0){if(_0x47fcd0){_0x2474e6[_0x671d('0x99')]=_['omit'](_0x47fcd0,[_0x671d('0x97')]);if(_0x47fcd0['Contacts'][_0x671d('0x46')]){return _0x47fcd0[_0x671d('0x97')][0x0];}var _0x19beaf=_[_0x671d('0x16')](_0x2474e6[_0x671d('0x57')],{'firstName':_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')],'ListId':_0x47fcd0['id']});_0x19beaf[_0x2474e6['body']['mapKey']]=_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')];return db[_0x671d('0x72')]['create'](_0x19beaf,{'fields':_0x4f94a0,'raw':!![]});}})['then'](handleEntityNotFound(_0x1a0a9a,null))[_0x671d('0x1d')](function(_0x4e0b94){if(_0x4e0b94){_0x2474e6['contact']=_0x4e0b94;var _0x19e66a={'ContactId':_0x4e0b94['id'],'phone':_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')],'SmsAccountId':_0x3a477f[_0x671d('0x53')]['id']};var _0x8d6861={'ContactId':_0x4e0b94['id'],'SmsAccountId':_0x3a477f[_0x671d('0x53')]['id'],'closed':![]};return db['SmsInteraction'][_0x671d('0x55')]({'where':_0x8d6861})[_0x671d('0x1d')](function(_0x234896){if(_0x234896){return[_0x234896,![]];}return db[_0x671d('0x9a')][_0x671d('0x56')](_0x19e66a)[_0x671d('0x1d')](function(_0x58e47a){return[_0x58e47a,!![]];});});}})[_0x671d('0x9b')](function(_0x436219,_0x574936){_0x2474e6[_0x671d('0x9c')]=_0x436219[_0x671d('0x32')]({'plain':!![]});_0x2474e6[_0x671d('0x9c')][_0x671d('0x9d')]=![];if(_0x574936){if(_0x2474e6[_0x671d('0x6e')][_0x671d('0x9e')]){_0x2474e6[_0x671d('0x6f')][_0x671d('0x9f')]({'id':0x0,'priority':_0x2474e6['applications']['length']+0x1,'app':_0x671d('0xa0'),'appdata':_0x671d('0xa1'),'interval':_0x671d('0xa2')});}_0x2474e6[_0x671d('0x9c')][_0x671d('0x9d')]=!![];}return db['SmsMessage'][_0x671d('0x56')]({'phone':_0x2474e6[_0x671d('0x57')][_0x671d('0x7b')],'messageId':_0x2474e6[_0x671d('0x57')][_0x671d('0x7e')],'body':_0x2474e6['body'][_0x671d('0x57')],'SmsAccountId':_0x3a477f[_0x671d('0x53')]['id'],'SmsInteractionId':_0x436219['id'],'direction':'in','ContactId':_0x436219[_0x671d('0xa3')],'AttachmentId':_0x2474e6[_0x671d('0x57')]['AttachmentId']});})[_0x671d('0x1d')](function(_0x4783a7){_0x2474e6[_0x671d('0x23')]=_0x4783a7;if(_0x2474e6[_0x671d('0x9c')][_0x671d('0xa4')]){return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x2474e6[_0x671d('0x9c')][_0x671d('0xa4')]}})[_0x671d('0x1d')](function(_0x4d6112){if(_0x4d6112){_0x2474e6[_0x671d('0x6f')][_0x671d('0xa5')]({'id':0x0,'priority':0x0,'app':_0x671d('0xa6'),'appdata':_0x4d6112[_0x671d('0x37')]+','+(_0x2474e6['account']['waitForTheAssignedAgent']||0xa),'interval':_0x671d('0xa2')});}return respondWithRpcPromise('Start',_0x671d('0xa7'),_0x2474e6);});}return respondWithRpcPromise('Start',_0x671d('0xa7'),_0x2474e6);})[_0x671d('0x1d')](function(_0x1f9d2b){if(_0x1f9d2b){var _0x310bf9=0xc8;var _0x142508=_0x671d('0xa8');logger['info'](_0x671d('0xa9'),_0x142508,_0x310bf9,'entity\x20found');logger[_0x671d('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x142508,_0x310bf9,_0x671d('0xaa'),JSON[_0x671d('0x20')](_0x1f9d2b));if(_0x2474e6['account']['type']===_0x671d('0xab')){return _0x1a0a9a[_0x671d('0x27')](_0x310bf9)[_0x671d('0x2d')](_0x671d('0xac'),_0x671d('0xad'))['send'](_0x671d('0xae'));}else{return _0x1a0a9a[_0x671d('0x27')](_0x310bf9)[_0x671d('0x28')](_0x1f9d2b);}}})[_0x671d('0x25')](handleError(_0x1a0a9a,null));};exports[_0x671d('0xaf')]=function(_0x3057c0,_0x27777e,_0x2cf8d3){return db[_0x671d('0x54')][_0x671d('0x62')]({'where':{'id':_0x3057c0[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x27777e,null))[_0x671d('0x1d')](function(_0x396426){if(_0x396426){return db[_0x671d('0xb0')][_0x671d('0xb1')](function(_0xdc9740){return db[_0x671d('0xb2')][_0x671d('0x35')]({'where':{'SmsAccountId':_0x3057c0['params']['id']},'transaction':_0xdc9740})[_0x671d('0x1d')](function(_0x487433){var _0xf2e8fe=_[_0x671d('0x3e')](_0x3057c0[_0x671d('0x57')],function(_0xbd227c){_0xbd227c[_0x671d('0x65')]=_0x3057c0[_0x671d('0x53')]['id'];return _0xbd227c;});return db[_0x671d('0xb2')][_0x671d('0xb3')](_0xf2e8fe,{'transaction':_0xdc9740});});})[_0x671d('0x1d')](function(){return db[_0x671d('0xb2')][_0x671d('0xb4')]({'where':{'SmsAccountId':_0x3057c0[_0x671d('0x53')]['id']},'order':_0x671d('0x71')});});}})['then'](respondWithResult(_0x27777e,null))[_0x671d('0x25')](handleError(_0x27777e,null));};exports[_0x671d('0xb5')]=function(_0x428dbd,_0x1fb8ea,_0x3c2c21){var _0x4822a9={};var _0x1e57e5={};var _0x58e21d;var _0x5578f9;return db[_0x671d('0x54')][_0x671d('0x62')]({'where':{'id':_0x428dbd[_0x671d('0x53')]['id']}})['then'](handleEntityNotFound(_0x1fb8ea,null))[_0x671d('0x1d')](function(_0x30caca){if(_0x30caca){_0x58e21d=_0x30caca;_0x1e57e5['model']=_[_0x671d('0x40')](db[_0x671d('0xb2')][_0x671d('0x3c')]);_0x1e57e5[_0x671d('0x3f')]=_[_0x671d('0x40')](_0x428dbd['query']);_0x1e57e5[_0x671d('0x41')]=_[_0x671d('0x42')](_0x1e57e5[_0x671d('0x43')],_0x1e57e5[_0x671d('0x3f')]);_0x4822a9['attributes']=_['intersection'](_0x1e57e5[_0x671d('0x43')],qs[_0x671d('0x45')](_0x428dbd[_0x671d('0x3f')][_0x671d('0x45')]));_0x4822a9[_0x671d('0x44')]=_0x4822a9[_0x671d('0x44')][_0x671d('0x46')]?_0x4822a9[_0x671d('0x44')]:_0x1e57e5[_0x671d('0x43')];_0x4822a9[_0x671d('0x64')]=qs[_0x671d('0x48')](_0x428dbd[_0x671d('0x3f')][_0x671d('0x48')]);_0x4822a9[_0x671d('0x4b')]=qs[_0x671d('0x41')](_[_0x671d('0x49')](_0x428dbd['query'],_0x1e57e5[_0x671d('0x41')]));if(_0x428dbd[_0x671d('0x3f')][_0x671d('0x4a')]){_0x4822a9[_0x671d('0x4b')]=_[_0x671d('0x4c')](_0x4822a9[_0x671d('0x4b')],{'$or':_[_0x671d('0x3e')](_0x4822a9[_0x671d('0x44')],function(_0x5e6340){var _0x1e3993={};_0x1e3993[_0x5e6340]={'$like':'%'+_0x428dbd['query'][_0x671d('0x4a')]+'%'};return _0x1e3993;})});}_0x4822a9=_[_0x671d('0x4c')]({},_0x4822a9,_0x428dbd[_0x671d('0x4d')]);return _0x58e21d[_0x671d('0xb5')](_0x4822a9);}})[_0x671d('0x1d')](function(_0x5b3700){if(_0x5b3700){_0x5578f9=_0x5b3700[_0x671d('0x46')];if(!_0x428dbd['query'][_0x671d('0x47')](_0x671d('0x63'))){_0x4822a9[_0x671d('0x2a')]=qs['limit'](_0x428dbd[_0x671d('0x3f')][_0x671d('0x2a')]);_0x4822a9[_0x671d('0x2c')]=qs['offset'](_0x428dbd[_0x671d('0x3f')][_0x671d('0x2c')]);}return _0x58e21d[_0x671d('0xb5')](_0x4822a9);}})[_0x671d('0x1d')](function(_0x451325){if(_0x451325){return _0x451325?{'count':_0x5578f9,'rows':_0x451325}:null;}})[_0x671d('0x1d')](respondWithResult(_0x1fb8ea,null))[_0x671d('0x25')](handleError(_0x1fb8ea,null));};exports['getInteractions']=function(_0x2ff000,_0x1d566a,_0x5a3210){var _0xb0f559={'raw':![],'where':{}};var _0x226b02={};var _0x313eee={'count':0x0,'rows':[]};return db[_0x671d('0x54')]['findOne']({'where':{'id':_0x2ff000[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x1d566a,null))[_0x671d('0x1d')](function(_0x57b540){if(_0x57b540){_0x226b02[_0x671d('0x43')]=_[_0x671d('0x40')](db[_0x671d('0x9a')][_0x671d('0x3c')]);_0x226b02['query']=_['keys'](_0x2ff000[_0x671d('0x3f')]);_0x226b02['filters']=_[_0x671d('0x42')](_0x226b02[_0x671d('0x43')],_0x226b02[_0x671d('0x3f')]);_0xb0f559[_0x671d('0x44')]=_[_0x671d('0x42')](_0x226b02[_0x671d('0x43')],qs[_0x671d('0x45')](_0x2ff000[_0x671d('0x3f')]['fields']));_0xb0f559['attributes']=_0xb0f559[_0x671d('0x44')][_0x671d('0x46')]?_0xb0f559[_0x671d('0x44')]:_0x226b02['model'];if(!_0x2ff000[_0x671d('0x3f')][_0x671d('0x47')](_0x671d('0x63'))){_0xb0f559['limit']=qs[_0x671d('0x2a')](_0x2ff000['query'][_0x671d('0x2a')]);_0xb0f559['offset']=qs[_0x671d('0x2c')](_0x2ff000[_0x671d('0x3f')][_0x671d('0x2c')]);}_0xb0f559[_0x671d('0x64')]=qs[_0x671d('0x48')](_0x2ff000[_0x671d('0x3f')][_0x671d('0x48')]);_0xb0f559['where']=qs[_0x671d('0x41')](_[_0x671d('0x49')](_0x2ff000[_0x671d('0x3f')],_0x226b02['filters']));_0xb0f559['where']['SmsAccountId']=_0x57b540['id'];if(_0x2ff000[_0x671d('0x3f')][_0x671d('0x4a')]){_0xb0f559[_0x671d('0x4b')]=_[_0x671d('0x4c')](_0xb0f559['where'],{'$or':_[_0x671d('0x3e')](_0xb0f559[_0x671d('0x44')],function(_0x18938f){var _0x15bb3b={};_0x15bb3b[_0x18938f]={'$like':'%'+_0x2ff000[_0x671d('0x3f')][_0x671d('0x4a')]+'%'};return _0x15bb3b;})});}_0xb0f559=_[_0x671d('0x4c')]({},_0xb0f559,_0x2ff000[_0x671d('0x4d')]);return db['SmsInteraction'][_0x671d('0x2b')]({'where':_0xb0f559[_0x671d('0x4b')]})['then'](function(_0x2497cb){_0x313eee[_0x671d('0x2b')]=_0x2497cb;if(_0x2ff000[_0x671d('0x3f')][_0x671d('0x4e')]){_0xb0f559[_0x671d('0x4f')]=[{'model':db[_0x671d('0x72')],'as':_0x671d('0xb6'),'required':![]},{'model':db[_0x671d('0xb7')],'as':_0x671d('0xb8'),'attributes':['name',_0x671d('0xb9'),_0x671d('0xba')],'required':![]},{'model':db['Tag'],'as':_0x671d('0xbb'),'attributes':['id',_0x671d('0x37'),_0x671d('0xbc')],'where':_0x2ff000[_0x671d('0x3f')][_0x671d('0xbd')]?{'id':_0x2ff000[_0x671d('0x3f')]['tag']}:undefined,'required':_0x2ff000['query'][_0x671d('0xbd')]?!![]:![]}];}return db[_0x671d('0x9a')][_0x671d('0x50')](_0xb0f559);})[_0x671d('0x1d')](function(_0x4000c3){_0x313eee['rows']=_0x4000c3;return _0x313eee;});}})['then'](respondWithFilteredResult(_0x1d566a,_0xb0f559))[_0x671d('0x25')](handleError(_0x1d566a,null));};exports[_0x671d('0x38')]=function(_0xe77e40,_0x12247b,_0x505d52){var _0x3d38ef,_0x1eab12,_0x3fd849;if(_['isNil'](_0xe77e40['body'][_0x671d('0x57')])||_0xe77e40[_0x671d('0x57')][_0x671d('0x57')]===''){throw new db['Sequelize']['ValidationError'](_0x671d('0x92'));}if(_['isNil'](_0xe77e40[_0x671d('0x57')]['to'])){throw new db[(_0x671d('0x73'))][(_0x671d('0x74'))]('to\x20is\x20mandatory');}_0x3d38ef=_0xe77e40[_0x671d('0x57')]['to'];return db[_0x671d('0x54')][_0x671d('0x55')]({'where':{'id':_0xe77e40[_0x671d('0x53')]['id']},'include':[{'model':db[_0x671d('0xbe')],'as':'List','include':[{'model':db[_0x671d('0x72')],'as':_0x671d('0x97'),'where':{'mobile':_0x3d38ef},'limit':0x1,'order':[[_0x671d('0x78'),_0x671d('0x98')]]}]}]})[_0x671d('0x1d')](handleEntityNotFound(_0x12247b,null))[_0x671d('0x1d')](function(_0x514434){if(_0x514434&&_0x514434[_0x671d('0xbf')]){_0x1eab12=_0x514434[_0x671d('0x32')]({'plain':!![]});if(_0x1eab12[_0x671d('0xbf')]&&_0x1eab12[_0x671d('0xbf')][_0x671d('0x97')][_0x671d('0x46')]){return _0x1eab12[_0x671d('0xbf')][_0x671d('0x97')][0x0];}return db[_0x671d('0x72')][_0x671d('0x56')](_[_0x671d('0x16')](_0xe77e40[_0x671d('0x57')],{'firstName':_0x3d38ef,'mobile':_0x3d38ef,'phone':_0x3d38ef,'ListId':_0x1eab12[_0x671d('0xc0')]}));}})[_0x671d('0x1d')](handleEntityNotFound(_0x12247b,null))['then'](function(_0x31b8ca){if(_0x31b8ca){_0x3fd849=_0x31b8ca;return db[_0x671d('0x9a')][_0x671d('0x55')]({'where':{'ContactId':_0x3fd849['id'],'closed':![],'SmsAccountId':_0x1eab12['id']}})[_0x671d('0x1d')](function(_0x3a106b){if(_0x3a106b){return[_0x3a106b,![]];}return db[_0x671d('0x9a')][_0x671d('0x56')]({'UserId':_0xe77e40[_0x671d('0x58')]['id'],'ContactId':_0x3fd849['id'],'SmsAccountId':_0x1eab12['id'],'phone':_0x3d38ef,'firstMsgDirection':_0x671d('0xc1'),'Messages':[_[_0x671d('0x4c')](_0xe77e40[_0x671d('0x57')],{'read':![],'body':_0xe77e40[_0x671d('0x57')]['body'],'phone':_0x3d38ef,'SmsAccountId':_0x1eab12['id'],'UserId':_0xe77e40['user']['id'],'ContactId':_0x3fd849['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x671d('0x1d')](function(_0x47894f){return[_0x47894f,!![]];});});}})['spread'](function(_0x18df6e,_0x496717){if(_0x496717){return _0x18df6e;}return db[_0x671d('0xc2')]['create'](_['merge'](_0xe77e40[_0x671d('0x57')],{'read':![],'body':_0xe77e40[_0x671d('0x57')][_0x671d('0x57')],'phone':_0x3d38ef,'SmsAccountId':_0x1eab12['id'],'SmsInteractionId':_0x18df6e['id'],'UserId':_0xe77e40[_0x671d('0x58')]['id'],'ContactId':_0x3fd849['id']}))[_0x671d('0x1d')](function(_0x53fa79){_0x18df6e[_0x671d('0xc3')][_0x671d('0xc4')]=[];_0x18df6e['dataValues'][_0x671d('0xc4')][_0x671d('0x9f')](_0x53fa79[_0x671d('0xc3')]);return _0x18df6e;});})[_0x671d('0x1d')](respondWithResult(_0x12247b,null))[_0x671d('0x25')](handleError(_0x12247b,null));};exports['status']=function(_0x5c2662,_0x5e5292,_0x4025c2){if(_0x5c2662[_0x671d('0x57')]['id']){delete _0x5c2662['body']['id'];}var _0x442df9,_0x5a9318,_0x427dce;return db[_0x671d('0x54')][_0x671d('0x55')]({'where':{'id':_0x5c2662[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x5e5292,null))[_0x671d('0x1d')](function(_0x12d06d){if(_0x12d06d){_0x427dce=_0x12d06d;logger[_0x671d('0x1f')](_0x671d('0xa9'),_0x671d('0x27'),_0x671d('0xc5'),_0x12d06d[_0x671d('0x3d')],util[_0x671d('0xc6')](_0x5c2662[_0x671d('0x57')],{'showHidden':![],'depth':null}));switch(_0x12d06d['type']){case _0x671d('0xc7'):if(_0x5c2662[_0x671d('0x57')][_0x671d('0xc8')]&&_0x5c2662[_0x671d('0x57')][_0x671d('0x27')]){_0x5a9318=_0x5c2662['body'][_0x671d('0x27')];return db['SmsMessage']['find']({'where':{'messageId':_0x5c2662[_0x671d('0x57')][_0x671d('0xc8')]}});}break;case _0x671d('0x82'):if(_0x5c2662['body'][_0x671d('0xc9')]&&_0x5c2662[_0x671d('0x57')][_0x671d('0xca')]){_0x5a9318=_0x5c2662[_0x671d('0x57')][_0x671d('0xca')];return db['SmsMessage'][_0x671d('0x55')]({'where':{'messageId':_0x5c2662[_0x671d('0x57')][_0x671d('0xc9')]}});}break;case _0x671d('0x83'):if(_0x5c2662[_0x671d('0x57')][_0x671d('0x84')]&&_0x5c2662[_0x671d('0x57')][_0x671d('0xcb')]){_0x5a9318=_0x5c2662['body'][_0x671d('0xcb')];return db[_0x671d('0xc2')][_0x671d('0x55')]({'where':{'messageId':_0x5c2662['body'][_0x671d('0x84')]}});}break;case _0x671d('0xcc'):var _0x5b0684=_0x5c2662['body'][_0x671d('0x87')][0x0];if(_0x5b0684[_0x671d('0x7e')]&&_0x5b0684[_0x671d('0x27')][_0x671d('0xcd')]==='DELIVERED'){_0x5a9318=_0x5b0684[_0x671d('0x27')][_0x671d('0xcd')];return db[_0x671d('0xc2')][_0x671d('0x55')]({'where':{'messageId':_0x5b0684['messageId']}});}break;case _0x671d('0x8b'):if(_0x5c2662[_0x671d('0x57')]['messageId']&&_0x5c2662[_0x671d('0x57')][_0x671d('0x27')]){_0x5a9318=_0x5c2662[_0x671d('0x57')][_0x671d('0x27')];return db[_0x671d('0xc2')][_0x671d('0x55')]({'where':{'messageId':_0x5c2662[_0x671d('0x57')][_0x671d('0x7e')]}});}break;case _0x671d('0x8d'):if(_0x5c2662[_0x671d('0x57')][0x0][_0x671d('0x23')]['id']){_0x5a9318=_0x5c2662[_0x671d('0x57')][0x0][_0x671d('0x3d')];return db[_0x671d('0xc2')][_0x671d('0x55')]({'where':{'messageId':_0x5c2662[_0x671d('0x57')][0x0][_0x671d('0x23')]['id']}});}break;case _0x671d('0x8e'):if(_0x5c2662[_0x671d('0x57')][_0x671d('0xce')]&&_0x5c2662[_0x671d('0x57')][_0x671d('0x27')]){_0x5a9318=_0x5c2662[_0x671d('0x57')][_0x671d('0x27')];return db['SmsMessage'][_0x671d('0x55')]({'where':{'messageId':_0x5c2662[_0x671d('0x57')][_0x671d('0xce')]}});}break;}}})[_0x671d('0x1d')](handleEntityNotFound(_0x5e5292,null))[_0x671d('0x1d')](function(_0x362f86){if(_0x362f86){_0x442df9=_0x362f86;switch(_0x427dce[_0x671d('0x3d')]){case _0x671d('0xc7'):if(_0x5a9318==='DELIVERED'){return _0x442df9['update']({'read':!![]});}else{logger[_0x671d('0x21')](_0x671d('0xa9'),_0x671d('0x27'),_0x671d('0xc7'),util['inspect'](_0x5c2662[_0x671d('0x57')],{'showHidden':![],'depth':null}));}break;case _0x671d('0x82'):if(_0x5a9318==='1'){return _0x442df9[_0x671d('0x31')]({'read':!![]});}else{logger[_0x671d('0x21')](_0x671d('0xa9'),_0x671d('0x27'),_0x671d('0xc7'),util[_0x671d('0xc6')](_0x5c2662[_0x671d('0x57')],{'showHidden':![],'depth':null}));}break;case _0x671d('0x83'):if(!_0x5c2662[_0x671d('0x57')]['error_code']&&_0x5a9318>=0xc8&&_0x5a9318<=0xce){return _0x442df9[_0x671d('0x31')]({'read':!![]});}else{logger[_0x671d('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x671d('0x83'),util[_0x671d('0xc6')](_0x5c2662[_0x671d('0x57')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x140449=_0x5c2662['body'][_0x671d('0x87')][0x0];if(_0x140449[_0x671d('0x27')][_0x671d('0xcd')]===_0x671d('0xcf')){return _0x442df9[_0x671d('0x31')]({'read':!![]});}else{logger[_0x671d('0x21')](_0x671d('0xa9'),_0x671d('0x27'),'infobip',util[_0x671d('0xc6')](_0x5c2662['body'],{'showHidden':![],'depth':null}));}break;case _0x671d('0x8b'):if(_0x5a9318==_0x671d('0xd0')||_0x5a9318==_0x671d('0xd1')){return _0x442df9['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x671d('0x27'),_0x671d('0x8b'),util[_0x671d('0xc6')](_0x5c2662[_0x671d('0x57')],{'showHidden':![],'depth':null}));}break;case _0x671d('0x8d'):if(_0x5a9318=='message-delivered'){return _0x442df9['update']({'read':!![]});}else{logger[_0x671d('0x21')](_0x671d('0xa9'),'status',_0x671d('0x8d'),util[_0x671d('0xc6')](_0x5c2662[_0x671d('0x57')],{'showHidden':![],'depth':null}));}break;case _0x671d('0x8e'):if(_0x5a9318===_0x671d('0xd2')||_0x5a9318===_0x671d('0xd3')){return _0x442df9[_0x671d('0x31')]({'read':!![]});}else{logger[_0x671d('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x671d('0x27'),_0x671d('0x8e'),util[_0x671d('0xc6')](_0x5c2662[_0x671d('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x442df9;}})['then'](respondWithResult(_0x5e5292,null))[_0x671d('0x25')](handleError(_0x5e5292,null));};exports['statusGet']=function(_0x1f116b,_0x4a98ff,_0x1545e5){var _0x2293cd,_0xac4ed3,_0x1431ea;return db[_0x671d('0x54')]['find']({'where':{'id':_0x1f116b[_0x671d('0x53')]['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x4a98ff,null))['then'](function(_0x2906e2){if(_0x2906e2){_0x1431ea=_0x2906e2;logger[_0x671d('0x1f')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x671d('0x27'),_0x671d('0xc5'),_0x2906e2[_0x671d('0x3d')],util[_0x671d('0xc6')](_0x1f116b['query'],{'showHidden':![],'depth':null}));switch(_0x2906e2[_0x671d('0x3d')]){case _0x671d('0x88'):if(_0x1f116b['query'][_0x671d('0xd4')]&&_0x1f116b[_0x671d('0x3f')]['state']){_0xac4ed3=_0x1f116b['query'][_0x671d('0xd5')];return db[_0x671d('0xc2')][_0x671d('0x55')]({'where':{'messageId':_0x1f116b[_0x671d('0x3f')][_0x671d('0xd4')]}});}break;}}})[_0x671d('0x1d')](handleEntityNotFound(_0x4a98ff,null))[_0x671d('0x1d')](function(_0x2a5e48){if(_0x2a5e48){_0x2293cd=_0x2a5e48;switch(_0x1431ea[_0x671d('0x3d')]){case _0x671d('0x88'):if(_0xac4ed3==='2'||_0xac4ed3==='6'){return _0x2293cd['update']({'read':!![]});}else{logger[_0x671d('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x671d('0x27'),'csc',util['inspect'](_0x1f116b['query'],{'showHidden':![],'depth':null}));};break;}return _0x2293cd;}})[_0x671d('0x1d')](respondWithResult(_0x4a98ff,null))['catch'](handleError(_0x4a98ff,null));};exports[_0x671d('0xd6')]=function(_0x1a89ed,_0x58e767,_0x20e038){return db[_0x671d('0x54')]['find']({'where':{'id':_0x1a89ed[_0x671d('0x53')]['id']}})['then'](handleEntityNotFound(_0x58e767,null))['then'](function(_0x5f14e4){if(_0x5f14e4){return _0x5f14e4['addAgents'](_0x1a89ed[_0x671d('0x57')][_0x671d('0x67')],_['omit'](_0x1a89ed[_0x671d('0x57')],['ids','id'])||{})[_0x671d('0x9b')](function(_0x5df47d){for(var _0x1c53b0=0x0;_0x1c53b0<_0x1a89ed[_0x671d('0x57')]['ids']['length'];_0x1c53b0+=0x1){socket[_0x671d('0xd7')](_0x671d('0xd8'),{'UserId':Number(_0x1a89ed[_0x671d('0x57')][_0x671d('0x67')][_0x1c53b0]),'SmsAccountId':Number(_0x1a89ed[_0x671d('0x53')]['id'])});}return _0x5df47d;});}})['then'](respondWithResult(_0x58e767,null))['catch'](handleError(_0x58e767,null));};exports[_0x671d('0xd9')]=function(_0x125da7,_0x13e8a8,_0x26ee95){return db[_0x671d('0x54')]['find']({'where':{'id':_0x125da7['params']['id']}})[_0x671d('0x1d')](handleEntityNotFound(_0x13e8a8,null))[_0x671d('0x1d')](function(_0x4290bb){if(_0x4290bb){return _0x4290bb['removeAgents'](_0x125da7[_0x671d('0x3f')][_0x671d('0x67')])[_0x671d('0x1d')](function(){if(_[_0x671d('0xda')](_0x125da7[_0x671d('0x3f')]['ids'])){for(var _0x267007=0x0;_0x267007<_0x125da7[_0x671d('0x3f')]['ids']['length'];_0x267007+=0x1){socket['emit'](_0x671d('0xdb'),{'UserId':Number(_0x125da7[_0x671d('0x3f')][_0x671d('0x67')][_0x267007]),'SmsAccountId':Number(_0x125da7[_0x671d('0x53')]['id'])});}}else{socket[_0x671d('0xd7')](_0x671d('0xdb'),{'UserId':Number(_0x125da7[_0x671d('0x3f')][_0x671d('0x67')]),'SmsAccountId':Number(_0x125da7['params']['id'])});}});}})[_0x671d('0x1d')](respondWithStatusCode(_0x13e8a8,null))['catch'](handleError(_0x13e8a8,null));};exports[_0x671d('0xdc')]=function(_0x165602,_0x33642d,_0x47c804){var _0x16d652={};var _0x40c347={};var _0x26de48;var _0x54b831;return db[_0x671d('0x54')][_0x671d('0x62')]({'where':{'id':_0x165602[_0x671d('0x53')]['id']}})['then'](handleEntityNotFound(_0x33642d,null))[_0x671d('0x1d')](function(_0x3031e4){if(_0x3031e4){_0x26de48=_0x3031e4;_0x40c347['model']=_['keys'](db[_0x671d('0xb7')]['rawAttributes']);_0x40c347['query']=_[_0x671d('0x40')](_0x165602['query']);_0x40c347['filters']=_['intersection'](_0x40c347[_0x671d('0x43')],_0x40c347[_0x671d('0x3f')]);_0x16d652[_0x671d('0x44')]=_[_0x671d('0x42')](_0x40c347[_0x671d('0x43')],qs[_0x671d('0x45')](_0x165602['query']['fields']));_0x16d652[_0x671d('0x44')]=_0x16d652[_0x671d('0x44')][_0x671d('0x46')]?_0x16d652[_0x671d('0x44')]:_0x40c347[_0x671d('0x43')];_0x16d652[_0x671d('0x64')]=qs[_0x671d('0x48')](_0x165602[_0x671d('0x3f')]['sort']);_0x16d652[_0x671d('0x4b')]=qs[_0x671d('0x41')](_[_0x671d('0x49')](_0x165602['query'],_0x40c347[_0x671d('0x41')]));if(_0x165602['query'][_0x671d('0x4a')]){_0x16d652[_0x671d('0x4b')]=_['merge'](_0x16d652[_0x671d('0x4b')],{'$or':_[_0x671d('0x3e')](_0x16d652['attributes'],function(_0x4a9137){var _0xd46ad0={};_0xd46ad0[_0x4a9137]={'$like':'%'+_0x165602['query'][_0x671d('0x4a')]+'%'};return _0xd46ad0;})});}_0x16d652=_[_0x671d('0x4c')]({},_0x16d652,_0x165602[_0x671d('0x4d')]);return _0x26de48[_0x671d('0xdc')](_0x16d652);}})[_0x671d('0x1d')](function(_0x5b25a8){if(_0x5b25a8){_0x54b831=_0x5b25a8[_0x671d('0x46')];if(!_0x165602['query'][_0x671d('0x47')](_0x671d('0x63'))){_0x16d652[_0x671d('0x2a')]=qs['limit'](_0x165602[_0x671d('0x3f')]['limit']);_0x16d652[_0x671d('0x2c')]=qs[_0x671d('0x2c')](_0x165602['query'][_0x671d('0x2c')]);}return _0x26de48[_0x671d('0xdc')](_0x16d652);}})['then'](function(_0x5446b6){if(_0x5446b6){return _0x5446b6?{'count':_0x54b831,'rows':_0x5446b6}:null;}})[_0x671d('0x1d')](respondWithResult(_0x33642d,null))['catch'](handleError(_0x33642d,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3116a28..1cf7a6f 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 _0xca68=['remove','hook','setMaxListeners','save','update'];(function(_0x2b89fd,_0x253f78){var _0x4ee549=function(_0x4ace7c){while(--_0x4ace7c){_0x2b89fd['push'](_0x2b89fd['shift']());}};_0x4ee549(++_0x253f78);}(_0xca68,0x179));var _0x8ca6=function(_0xe2be7a,_0x4da195){_0xe2be7a=_0xe2be7a-0x0;var _0x110165=_0xca68[_0xe2be7a];return _0x110165;};'use strict';var EventEmitter=require('events');var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8ca6('0x0')](0x0);var events={'afterCreate':_0x8ca6('0x1'),'afterUpdate':_0x8ca6('0x2'),'afterDestroy':_0x8ca6('0x3')};function emitEvent(_0x1cc952){return function(_0x356e3b,_0x37eb66,_0x3e9e52){SmsAccountEvents['emit'](_0x1cc952+':'+_0x356e3b['id'],_0x356e3b);SmsAccountEvents['emit'](_0x1cc952,_0x356e3b);_0x3e9e52(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x8ca6('0x4')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x6ac1=['events','SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x6ac1,0x12c));var _0x16ac=function(_0x35b4c6,_0x5e57a2){_0x35b4c6=_0x35b4c6-0x0;var _0xa45f4c=_0x6ac1[_0x35b4c6];return _0xa45f4c;};'use strict';var EventEmitter=require(_0x16ac('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x16ac('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x16ac('0x2')](0x0);var events={'afterCreate':_0x16ac('0x3'),'afterUpdate':_0x16ac('0x4'),'afterDestroy':_0x16ac('0x5')};function emitEvent(_0x52647){return function(_0x47faaa,_0x314e9a,_0x651645){SmsAccountEvents[_0x16ac('0x6')](_0x52647+':'+_0x47faaa['id'],_0x47faaa);SmsAccountEvents[_0x16ac('0x6')](_0x52647,_0x47faaa);_0x651645(null);};}for(var e in events){if(events[_0x16ac('0x7')](e)){var event=events[e];SmsAccount[_0x16ac('0x8')](e,emitEvent(event));}}module[_0x16ac('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 46c5142..9a8f14a 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 _0x4142=['rimraf','define','SmsAccount','sms_accounts','../../config/logger','api','moment','request-promise'];(function(_0x286b49,_0x26d282){var _0x51735d=function(_0x5575e5){while(--_0x5575e5){_0x286b49['push'](_0x286b49['shift']());}};_0x51735d(++_0x26d282);}(_0x4142,0x154));var _0x2414=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4142[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2414('0x0'))(_0x2414('0x1'));var moment=require(_0x2414('0x2'));var BPromise=require('bluebird');var rp=require(_0x2414('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2414('0x4'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module['exports']=function(_0x4dc93d,_0x261ad2){return _0x4dc93d[_0x2414('0x5')](_0x2414('0x6'),attributes,{'tableName':_0x2414('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4db=['bluebird','request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','lodash','util','../../config/logger'];(function(_0xf2628e,_0x521bf7){var _0x13863a=function(_0x2b04ab){while(--_0x2b04ab){_0xf2628e['push'](_0xf2628e['shift']());}};_0x13863a(++_0x521bf7);}(_0xe4db,0x173));var _0xbe4d=function(_0x5364c2,_0x97ca86){_0x5364c2=_0x5364c2-0x0;var _0xb28eb0=_0xe4db[_0x5364c2];return _0xb28eb0;};'use strict';var _=require(_0xbe4d('0x0'));var util=require(_0xbe4d('0x1'));var logger=require(_0xbe4d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbe4d('0x3'));var rp=require(_0xbe4d('0x4'));var fs=require('fs');var path=require(_0xbe4d('0x5'));var rimraf=require(_0xbe4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xbe4d('0x7'));module[_0xbe4d('0x8')]=function(_0x1421d9,_0x315cc6){return _0x1421d9[_0xbe4d('0x9')](_0xbe4d('0xa'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index f7a083a..1ddbcdf 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 _0xde44=['jayson/promise','client','http','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','ShowSmsAccount','SmsAccount','options','where','attributes','map','include','model','then','debug','lodash','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x627b1b,_0x462114){var _0x2fd022=function(_0x2059c5){while(--_0x2059c5){_0x627b1b['push'](_0x627b1b['shift']());}};_0x2fd022(++_0x462114);}(_0xde44,0x7e));var _0x4de4=function(_0x27ea20,_0x1d2ca0){_0x27ea20=_0x27ea20-0x0;var _0x37f8ee=_0xde44[_0x27ea20];return _0x37f8ee;};'use strict';var _=require(_0x4de4('0x0'));var util=require('util');var moment=require(_0x4de4('0x1'));var BPromise=require(_0x4de4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4de4('0x3'));var db=require(_0x4de4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4de4('0x5'));var config=require('../../config/environment');var jayson=require(_0x4de4('0x6'));var client=jayson[_0x4de4('0x7')][_0x4de4('0x8')]({'port':0x232a});config['redis']=_[_0x4de4('0x9')](config['redis'],{'host':_0x4de4('0xa'),'port':0x18eb});var socket=require(_0x4de4('0xb'))(new Redis(config['redis']));require(_0x4de4('0xc'))[_0x4de4('0xd')](socket);function respondWithRpcPromise(_0x13ad95,_0x4afe35,_0xe4baea){return new BPromise(function(_0x1a47f9,_0x312ad1){return client['request'](_0x13ad95,_0xe4baea)['then'](function(_0x376a11){logger['info'](_0x4de4('0xe'),_0x4afe35,_0x4de4('0xf'));logger['debug'](_0x4de4('0x10'),_0x4afe35,_0x4de4('0xf'),JSON[_0x4de4('0x11')](_0x376a11));if(_0x376a11[_0x4de4('0x12')]){if(_0x376a11[_0x4de4('0x12')][_0x4de4('0x13')]===0x1f4){logger['error'](_0x4de4('0xe'),_0x4afe35,_0x376a11[_0x4de4('0x12')][_0x4de4('0x14')]);return _0x312ad1(_0x376a11['error'][_0x4de4('0x14')]);}logger[_0x4de4('0x12')](_0x4de4('0xe'),_0x4afe35,_0x376a11[_0x4de4('0x12')][_0x4de4('0x14')]);return _0x1a47f9(_0x376a11['error'][_0x4de4('0x14')]);}else{logger[_0x4de4('0x15')]('SmsAccount,\x20%s,\x20%s',_0x4afe35,_0x4de4('0xf'));_0x1a47f9(_0x376a11['result'][_0x4de4('0x14')]);}})[_0x4de4('0x16')](function(_0x5875da){logger['error'](_0x4de4('0xe'),_0x4afe35,_0x5875da);_0x312ad1(_0x5875da);});});}exports[_0x4de4('0x17')]=function(_0x2de9db){var _0x5a991e=this;return new Promise(function(_0x5dec52,_0x2251ae){return db[_0x4de4('0x18')]['find']({'raw':_0x2de9db['options']?_0x2de9db[_0x4de4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2de9db[_0x4de4('0x19')]?_0x2de9db[_0x4de4('0x19')][_0x4de4('0x1a')]||null:null,'attributes':_0x2de9db['options']?_0x2de9db['options'][_0x4de4('0x1b')]||null:null,'include':_0x2de9db[_0x4de4('0x19')]?_0x2de9db[_0x4de4('0x19')]['include']?_[_0x4de4('0x1c')](_0x2de9db[_0x4de4('0x19')][_0x4de4('0x1d')],function(_0x468b54){return{'model':db[_0x468b54[_0x4de4('0x1e')]],'as':_0x468b54['as'],'attributes':_0x468b54['attributes'],'include':_0x468b54[_0x4de4('0x1d')]?_[_0x4de4('0x1c')](_0x468b54['include'],function(_0x51011a){return{'model':db[_0x51011a[_0x4de4('0x1e')]],'as':_0x51011a['as'],'attributes':_0x51011a[_0x4de4('0x1b')],'include':_0x51011a[_0x4de4('0x1d')]?_[_0x4de4('0x1c')](_0x51011a['include'],function(_0x206954){return{'model':db[_0x206954[_0x4de4('0x1e')]],'as':_0x206954['as'],'attributes':_0x206954[_0x4de4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4de4('0x1f')](function(_0x352176){logger[_0x4de4('0x15')](_0x4de4('0x17'),_0x2de9db);logger[_0x4de4('0x20')]('ShowSmsAccount',_0x2de9db,JSON[_0x4de4('0x11')](_0x352176));_0x5dec52(_0x352176);})[_0x4de4('0x16')](function(_0x6520c2){logger[_0x4de4('0x12')](_0x4de4('0x17'),_0x6520c2['message'],_0x2de9db);_0x2251ae(_0x5a991e['error'](0x1f4,_0x6520c2['message']));});});}; \ No newline at end of file +var _0x91dd=['include','model','stringify','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','request','then','info','request\x20sent','debug','error','code','SmsAccount,\x20%s,\x20%s','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x91dd,0x189));var _0xd91d=function(_0x551144,_0x4117ea){_0x551144=_0x551144-0x0;var _0x308e9a=_0x91dd[_0x551144];return _0x308e9a;};'use strict';var _=require(_0xd91d('0x0'));var util=require(_0xd91d('0x1'));var moment=require(_0xd91d('0x2'));var BPromise=require(_0xd91d('0x3'));var rs=require(_0xd91d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd91d('0x5'));var logger=require(_0xd91d('0x6'))(_0xd91d('0x7'));var config=require(_0xd91d('0x8'));var jayson=require(_0xd91d('0x9'));var client=jayson[_0xd91d('0xa')][_0xd91d('0xb')]({'port':0x232a});config['redis']=_[_0xd91d('0xc')](config[_0xd91d('0xd')],{'host':_0xd91d('0xe'),'port':0x18eb});var socket=require(_0xd91d('0xf'))(new Redis(config['redis']));require(_0xd91d('0x10'))[_0xd91d('0x11')](socket);function respondWithRpcPromise(_0x318ec8,_0x14cfe5,_0x405032){return new BPromise(function(_0x188de5,_0x4f52f4){return client[_0xd91d('0x12')](_0x318ec8,_0x405032)[_0xd91d('0x13')](function(_0x9f0889){logger[_0xd91d('0x14')]('SmsAccount,\x20%s,\x20%s',_0x14cfe5,_0xd91d('0x15'));logger[_0xd91d('0x16')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x14cfe5,_0xd91d('0x15'),JSON['stringify'](_0x9f0889));if(_0x9f0889[_0xd91d('0x17')]){if(_0x9f0889[_0xd91d('0x17')][_0xd91d('0x18')]===0x1f4){logger[_0xd91d('0x17')](_0xd91d('0x19'),_0x14cfe5,_0x9f0889[_0xd91d('0x17')][_0xd91d('0x1a')]);return _0x4f52f4(_0x9f0889[_0xd91d('0x17')][_0xd91d('0x1a')]);}logger['error'](_0xd91d('0x19'),_0x14cfe5,_0x9f0889[_0xd91d('0x17')]['message']);return _0x188de5(_0x9f0889[_0xd91d('0x17')][_0xd91d('0x1a')]);}else{logger[_0xd91d('0x14')](_0xd91d('0x19'),_0x14cfe5,_0xd91d('0x15'));_0x188de5(_0x9f0889['result']['message']);}})[_0xd91d('0x1b')](function(_0x1823ab){logger['error'](_0xd91d('0x19'),_0x14cfe5,_0x1823ab);_0x4f52f4(_0x1823ab);});});}exports[_0xd91d('0x1c')]=function(_0x3613e6){var _0x33d701=this;return new Promise(function(_0x4294b8,_0x7ea2bb){return db[_0xd91d('0x1d')][_0xd91d('0x1e')]({'raw':_0x3613e6[_0xd91d('0x1f')]?_0x3613e6[_0xd91d('0x1f')][_0xd91d('0x20')]===undefined?!![]:![]:!![],'where':_0x3613e6['options']?_0x3613e6[_0xd91d('0x1f')][_0xd91d('0x21')]||null:null,'attributes':_0x3613e6[_0xd91d('0x1f')]?_0x3613e6[_0xd91d('0x1f')][_0xd91d('0x22')]||null:null,'include':_0x3613e6[_0xd91d('0x1f')]?_0x3613e6[_0xd91d('0x1f')]['include']?_[_0xd91d('0x23')](_0x3613e6[_0xd91d('0x1f')][_0xd91d('0x24')],function(_0x107083){return{'model':db[_0x107083[_0xd91d('0x25')]],'as':_0x107083['as'],'attributes':_0x107083[_0xd91d('0x22')],'include':_0x107083[_0xd91d('0x24')]?_[_0xd91d('0x23')](_0x107083['include'],function(_0x3bd965){return{'model':db[_0x3bd965[_0xd91d('0x25')]],'as':_0x3bd965['as'],'attributes':_0x3bd965[_0xd91d('0x22')],'include':_0x3bd965[_0xd91d('0x24')]?_[_0xd91d('0x23')](_0x3bd965[_0xd91d('0x24')],function(_0x5d065c){return{'model':db[_0x5d065c['model']],'as':_0x5d065c['as'],'attributes':_0x5d065c[_0xd91d('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd91d('0x13')](function(_0x5620a0){logger[_0xd91d('0x14')](_0xd91d('0x1c'),_0x3613e6);logger['debug'](_0xd91d('0x1c'),_0x3613e6,JSON[_0xd91d('0x26')](_0x5620a0));_0x4294b8(_0x5620a0);})[_0xd91d('0x1b')](function(_0x3ade38){logger[_0xd91d('0x17')]('ShowSmsAccount',_0x3ade38[_0xd91d('0x1a')],_0x3613e6);_0x7ea2bb(_0x33d701[_0xd91d('0x17')](0x1f4,_0x3ade38[_0xd91d('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index cbaa36b..4e4e786 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 38f7c6d..35ab57d 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x42a244,_0x1e5797){var _0x5979ce=function(_0x337d29){while(--_0x337d29){_0x42a244['push'](_0x42a244['shift']());}};_0x5979ce(++_0x1e5797);}(_0x008c,0x188));var _0xc008=function(_0x3e6478,_0x58d025){_0x3e6478=_0x3e6478-0x0;var _0x3f821a=_0x008c[_0x3e6478];return _0x3f821a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index d915083..a43d7c4 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 _0x2148=['*,*,*,*','exports','INTEGER','noop','TEXT','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2148,0x1d5));var _0x8214=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x2148[_0x75f869];return _0x10af8b;};'use strict';var Sequelize=require('sequelize');module[_0x8214('0x0')]={'priority':{'type':Sequelize[_0x8214('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x8214('0x2')},'appdata':{'type':Sequelize[_0x8214('0x3')]()},'description':{'type':Sequelize[_0x8214('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x8214('0x5')}}; \ No newline at end of file +var _0x9f4e=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x5baddd,_0x5da48f){var _0x18832f=function(_0x537043){while(--_0x537043){_0x5baddd['push'](_0x5baddd['shift']());}};_0x18832f(++_0x5da48f);}(_0x9f4e,0x1e5));var _0xe9f4=function(_0x3b0912,_0x39d739){_0x3b0912=_0x3b0912-0x0;var _0xa8f339=_0x9f4e[_0x3b0912];return _0xa8f339;};'use strict';var Sequelize=require(_0xe9f4('0x0'));module[_0xe9f4('0x1')]={'priority':{'type':Sequelize[_0xe9f4('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xe9f4('0x3')],'allowNull':![],'defaultValue':_0xe9f4('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xe9f4('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index c91d84b..73b179d 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 _0x82f9=['update','then','error','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','destroy','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save'];(function(_0xdf6233,_0x5e2ca6){var _0xe389a=function(_0x33c5e0){while(--_0x33c5e0){_0xdf6233['push'](_0xdf6233['shift']());}};_0xe389a(++_0x5e2ca6);}(_0x82f9,0x73));var _0x982f=function(_0x4e5552,_0x19ec4e){_0x4e5552=_0x4e5552-0x0;var _0x60a338=_0x82f9[_0x4e5552];return _0x60a338;};'use strict';var emlformat=require(_0x982f('0x0'));var rimraf=require(_0x982f('0x1'));var zipdir=require(_0x982f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x982f('0x3'));var Mustache=require(_0x982f('0x4'));var util=require(_0x982f('0x5'));var path=require(_0x982f('0x6'));var sox=require(_0x982f('0x7'));var csv=require(_0x982f('0x8'));var ejs=require(_0x982f('0x9'));var fs=require('fs');var fs_extra=require(_0x982f('0xa'));var _=require(_0x982f('0xb'));var squel=require(_0x982f('0xc'));var crypto=require(_0x982f('0xd'));var jsforce=require(_0x982f('0xe'));var deskjs=require(_0x982f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x982f('0x10'));var Papa=require(_0x982f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x982f('0x12'));var as=require(_0x982f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x982f('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x982f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x982f('0x16'))['db'];function respondWithStatusCode(_0x5c8718,_0x335280){_0x335280=_0x335280||0xcc;return function(_0x5b6f8e){if(_0x5b6f8e){return _0x5c8718[_0x982f('0x17')](_0x335280);}return _0x5c8718[_0x982f('0x18')](_0x335280)[_0x982f('0x19')]();};}function respondWithResult(_0x4bb029,_0x46ae29){_0x46ae29=_0x46ae29||0xc8;return function(_0x509ef0){if(_0x509ef0){return _0x4bb029[_0x982f('0x18')](_0x46ae29)[_0x982f('0x1a')](_0x509ef0);}};}function respondWithFilteredResult(_0x4a7e86,_0x4ce834){return function(_0x5513d2){if(_0x5513d2){var _0x4fbb87=typeof _0x4ce834['offset']===_0x982f('0x1b')&&typeof _0x4ce834[_0x982f('0x1c')]==='undefined';var _0x5bcd2a=_0x5513d2['count'];var _0x55f90b=_0x4fbb87?0x0:_0x4ce834['offset'];var _0x69e765=_0x4fbb87?_0x5513d2[_0x982f('0x1d')]:_0x4ce834[_0x982f('0x1e')]+_0x4ce834['limit'];var _0x327b0d;if(_0x69e765>=_0x5bcd2a){_0x69e765=_0x5bcd2a;_0x327b0d=0xc8;}else{_0x327b0d=0xce;}_0x4a7e86[_0x982f('0x18')](_0x327b0d);return _0x4a7e86[_0x982f('0x1f')]('Content-Range',_0x55f90b+'-'+_0x69e765+'/'+_0x5bcd2a)['json'](_0x5513d2);}return null;};}function patchUpdates(_0x304688){return function(_0x3affb1){try{jsonpatch[_0x982f('0x20')](_0x3affb1,_0x304688,!![]);}catch(_0x289b0c){return BPromise[_0x982f('0x21')](_0x289b0c);}return _0x3affb1[_0x982f('0x22')]();};}function saveUpdates(_0x514ae6,_0x31b2fb){return function(_0x3615cc){if(_0x3615cc){return _0x3615cc[_0x982f('0x23')](_0x514ae6)[_0x982f('0x24')](function(_0x3bbdf5){return _0x3bbdf5;});}return null;};}function removeEntity(_0x5e05b0,_0x4652f2){return function(_0x28762b){if(_0x28762b){return _0x28762b['destroy']()[_0x982f('0x24')](function(){_0x5e05b0[_0x982f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x273525,_0x21073c){return function(_0x3090ca){if(!_0x3090ca){_0x273525['sendStatus'](0x194);}return _0x3090ca;};}function handleError(_0x56a72f,_0xb0839d){_0xb0839d=_0xb0839d||0x1f4;return function(_0x19602f){logger[_0x982f('0x25')](_0x19602f['stack']);if(_0x19602f[_0x982f('0x26')]){delete _0x19602f[_0x982f('0x26')];}_0x56a72f[_0x982f('0x18')](_0xb0839d)[_0x982f('0x27')](_0x19602f);};}exports[_0x982f('0x28')]=function(_0x58237e,_0x16b9f2){var _0x1bf9c3={},_0x2ebe14={},_0x399e8e={'count':0x0,'rows':[]};var _0x3c1e9a=_[_0x982f('0x29')](db[_0x982f('0x2a')][_0x982f('0x2b')],function(_0xdff953){return{'name':_0xdff953[_0x982f('0x2c')],'type':_0xdff953[_0x982f('0x2d')][_0x982f('0x2e')]};});_0x2ebe14[_0x982f('0x2f')]=_[_0x982f('0x29')](_0x3c1e9a,_0x982f('0x26'));_0x2ebe14[_0x982f('0x30')]=_[_0x982f('0x31')](_0x58237e['query']);_0x2ebe14[_0x982f('0x32')]=_['intersection'](_0x2ebe14['model'],_0x2ebe14['query']);_0x1bf9c3[_0x982f('0x33')]=_['intersection'](_0x2ebe14[_0x982f('0x2f')],qs['fields'](_0x58237e['query'][_0x982f('0x34')]));_0x1bf9c3[_0x982f('0x33')]=_0x1bf9c3[_0x982f('0x33')][_0x982f('0x35')]?_0x1bf9c3['attributes']:_0x2ebe14[_0x982f('0x2f')];if(!_0x58237e['query'][_0x982f('0x36')](_0x982f('0x37'))){_0x1bf9c3[_0x982f('0x1c')]=qs['limit'](_0x58237e[_0x982f('0x30')][_0x982f('0x1c')]);_0x1bf9c3['offset']=qs[_0x982f('0x1e')](_0x58237e['query'][_0x982f('0x1e')]);}_0x1bf9c3[_0x982f('0x38')]=qs[_0x982f('0x39')](_0x58237e[_0x982f('0x30')][_0x982f('0x39')]);_0x1bf9c3['where']=qs['filters'](_[_0x982f('0x3a')](_0x58237e['query'],_0x2ebe14[_0x982f('0x32')]),_0x3c1e9a);if(_0x58237e[_0x982f('0x30')][_0x982f('0x3b')]){_0x1bf9c3[_0x982f('0x3c')]=_[_0x982f('0x3d')](_0x1bf9c3[_0x982f('0x3c')],{'$or':_[_0x982f('0x29')](_0x3c1e9a,function(_0x46d8a8){if(_0x46d8a8['type']!==_0x982f('0x3e')){var _0x311ff1={};_0x311ff1[_0x46d8a8[_0x982f('0x26')]]={'$like':'%'+_0x58237e[_0x982f('0x30')][_0x982f('0x3b')]+'%'};return _0x311ff1;}})});}_0x1bf9c3=_['merge']({},_0x1bf9c3,_0x58237e[_0x982f('0x3f')]);var _0x10e94b={'where':_0x1bf9c3[_0x982f('0x3c')]};return db[_0x982f('0x2a')]['count'](_0x10e94b)[_0x982f('0x24')](function(_0x21eb57){_0x399e8e[_0x982f('0x1d')]=_0x21eb57;if(_0x58237e['query'][_0x982f('0x40')]){_0x1bf9c3[_0x982f('0x41')]=[{'all':!![]}];}return db[_0x982f('0x2a')][_0x982f('0x42')](_0x1bf9c3);})['then'](function(_0x4c6eb1){_0x399e8e[_0x982f('0x43')]=_0x4c6eb1;return _0x399e8e;})[_0x982f('0x24')](respondWithFilteredResult(_0x16b9f2,_0x1bf9c3))[_0x982f('0x44')](handleError(_0x16b9f2,null));};exports['show']=function(_0x3b7967,_0x40a70a){var _0xea364={'raw':!![],'where':{'id':_0x3b7967[_0x982f('0x45')]['id']}},_0x3c21e0={};_0x3c21e0[_0x982f('0x2f')]=_[_0x982f('0x31')](db[_0x982f('0x2a')][_0x982f('0x2b')]);_0x3c21e0[_0x982f('0x30')]=_['keys'](_0x3b7967['query']);_0x3c21e0['filters']=_[_0x982f('0x46')](_0x3c21e0[_0x982f('0x2f')],_0x3c21e0['query']);_0xea364['attributes']=_['intersection'](_0x3c21e0[_0x982f('0x2f')],qs['fields'](_0x3b7967[_0x982f('0x30')][_0x982f('0x34')]));_0xea364[_0x982f('0x33')]=_0xea364[_0x982f('0x33')]['length']?_0xea364[_0x982f('0x33')]:_0x3c21e0['model'];if(_0x3b7967['query']['includeAll']){_0xea364[_0x982f('0x41')]=[{'all':!![]}];}_0xea364=_['merge']({},_0xea364,_0x3b7967[_0x982f('0x3f')]);return db['SmsApplication'][_0x982f('0x47')](_0xea364)[_0x982f('0x24')](handleEntityNotFound(_0x40a70a,null))[_0x982f('0x24')](respondWithResult(_0x40a70a,null))[_0x982f('0x44')](handleError(_0x40a70a,null));};exports[_0x982f('0x48')]=function(_0x2a12ab,_0xee6ee2){return db['SmsApplication'][_0x982f('0x48')](_0x2a12ab['body'],{})[_0x982f('0x24')](respondWithResult(_0xee6ee2,0xc9))[_0x982f('0x44')](handleError(_0xee6ee2,null));};exports['update']=function(_0x57b881,_0x5dddec){if(_0x57b881[_0x982f('0x49')]['id']){delete _0x57b881[_0x982f('0x49')]['id'];}return db[_0x982f('0x2a')][_0x982f('0x47')]({'where':{'id':_0x57b881[_0x982f('0x45')]['id']}})['then'](handleEntityNotFound(_0x5dddec,null))[_0x982f('0x24')](saveUpdates(_0x57b881['body'],null))[_0x982f('0x24')](respondWithResult(_0x5dddec,null))[_0x982f('0x44')](handleError(_0x5dddec,null));};exports[_0x982f('0x4a')]=function(_0xf8534a,_0x4caea2){return db[_0x982f('0x2a')][_0x982f('0x47')]({'where':{'id':_0xf8534a['params']['id']}})['then'](handleEntityNotFound(_0x4caea2,null))['then'](removeEntity(_0x4caea2,null))['catch'](handleError(_0x4caea2,null));}; \ No newline at end of file +var _0xd931=['offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','rows','catch','params','keys','find','create','body','eml-format','zip-dir','request-promise','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0x39ea42,_0x3c1f50){var _0x33f5b7=function(_0x5d8e73){while(--_0x5d8e73){_0x39ea42['push'](_0x39ea42['shift']());}};_0x33f5b7(++_0x3c1f50);}(_0xd931,0x191));var _0x1d93=function(_0xb6e2ea,_0x3b26e9){_0xb6e2ea=_0xb6e2ea-0x0;var _0x2a57bb=_0xd931[_0xb6e2ea];return _0x2a57bb;};'use strict';var emlformat=require(_0x1d93('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d93('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1d93('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1d93('0x3'));var path=require('path');var sox=require(_0x1d93('0x4'));var csv=require(_0x1d93('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d93('0x6'));var _=require(_0x1d93('0x7'));var squel=require(_0x1d93('0x8'));var crypto=require(_0x1d93('0x9'));var jsforce=require(_0x1d93('0xa'));var deskjs=require(_0x1d93('0xb'));var toCsv=require(_0x1d93('0x5'));var querystring=require(_0x1d93('0xc'));var Papa=require('papaparse');var Redis=require(_0x1d93('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x1d93('0xe'));var as=require(_0x1d93('0xf'));var hardwareService=require(_0x1d93('0x10'));var logger=require(_0x1d93('0x11'))(_0x1d93('0x12'));var utils=require('../../config/utils');var config=require(_0x1d93('0x13'));var licenseUtil=require(_0x1d93('0x14'));var db=require(_0x1d93('0x15'))['db'];function respondWithStatusCode(_0x1a6a6d,_0x35a1c8){_0x35a1c8=_0x35a1c8||0xcc;return function(_0x37148d){if(_0x37148d){return _0x1a6a6d[_0x1d93('0x16')](_0x35a1c8);}return _0x1a6a6d['status'](_0x35a1c8)['end']();};}function respondWithResult(_0x356c3e,_0x117d40){_0x117d40=_0x117d40||0xc8;return function(_0xdf3296){if(_0xdf3296){return _0x356c3e[_0x1d93('0x17')](_0x117d40)[_0x1d93('0x18')](_0xdf3296);}};}function respondWithFilteredResult(_0x1701b3,_0x31dd59){return function(_0x13e07d){if(_0x13e07d){var _0x3b9cea=typeof _0x31dd59[_0x1d93('0x19')]===_0x1d93('0x1a')&&typeof _0x31dd59['limit']==='undefined';var _0x8cbccf=_0x13e07d[_0x1d93('0x1b')];var _0x3251d8=_0x3b9cea?0x0:_0x31dd59[_0x1d93('0x19')];var _0x2a317a=_0x3b9cea?_0x13e07d[_0x1d93('0x1b')]:_0x31dd59[_0x1d93('0x19')]+_0x31dd59[_0x1d93('0x1c')];var _0x8b8453;if(_0x2a317a>=_0x8cbccf){_0x2a317a=_0x8cbccf;_0x8b8453=0xc8;}else{_0x8b8453=0xce;}_0x1701b3['status'](_0x8b8453);return _0x1701b3[_0x1d93('0x1d')](_0x1d93('0x1e'),_0x3251d8+'-'+_0x2a317a+'/'+_0x8cbccf)[_0x1d93('0x18')](_0x13e07d);}return null;};}function patchUpdates(_0x402345){return function(_0x349dbf){try{jsonpatch[_0x1d93('0x1f')](_0x349dbf,_0x402345,!![]);}catch(_0x5e10ef){return BPromise[_0x1d93('0x20')](_0x5e10ef);}return _0x349dbf[_0x1d93('0x21')]();};}function saveUpdates(_0x1e10a2,_0x50e62e){return function(_0x5cdc08){if(_0x5cdc08){return _0x5cdc08[_0x1d93('0x22')](_0x1e10a2)['then'](function(_0x14bcef){return _0x14bcef;});}return null;};}function removeEntity(_0xf59967,_0x70c6dd){return function(_0x1a1ef1){if(_0x1a1ef1){return _0x1a1ef1[_0x1d93('0x23')]()['then'](function(){_0xf59967['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10250d,_0x3681f4){return function(_0x160a62){if(!_0x160a62){_0x10250d[_0x1d93('0x16')](0x194);}return _0x160a62;};}function handleError(_0x565a99,_0x1e4cd7){_0x1e4cd7=_0x1e4cd7||0x1f4;return function(_0x4b224f){logger[_0x1d93('0x24')](_0x4b224f[_0x1d93('0x25')]);if(_0x4b224f[_0x1d93('0x26')]){delete _0x4b224f[_0x1d93('0x26')];}_0x565a99['status'](_0x1e4cd7)['send'](_0x4b224f);};}exports[_0x1d93('0x27')]=function(_0x2b3310,_0xf49810){var _0x46928a={},_0x463161={},_0x2bcc33={'count':0x0,'rows':[]};var _0x55d484=_[_0x1d93('0x28')](db[_0x1d93('0x29')][_0x1d93('0x2a')],function(_0x49069e){return{'name':_0x49069e[_0x1d93('0x2b')],'type':_0x49069e[_0x1d93('0x2c')][_0x1d93('0x2d')]};});_0x463161[_0x1d93('0x2e')]=_['map'](_0x55d484,_0x1d93('0x26'));_0x463161[_0x1d93('0x2f')]=_['keys'](_0x2b3310[_0x1d93('0x2f')]);_0x463161[_0x1d93('0x30')]=_[_0x1d93('0x31')](_0x463161[_0x1d93('0x2e')],_0x463161['query']);_0x46928a[_0x1d93('0x32')]=_['intersection'](_0x463161[_0x1d93('0x2e')],qs[_0x1d93('0x33')](_0x2b3310[_0x1d93('0x2f')]['fields']));_0x46928a[_0x1d93('0x32')]=_0x46928a[_0x1d93('0x32')]['length']?_0x46928a['attributes']:_0x463161[_0x1d93('0x2e')];if(!_0x2b3310[_0x1d93('0x2f')]['hasOwnProperty'](_0x1d93('0x34'))){_0x46928a[_0x1d93('0x1c')]=qs[_0x1d93('0x1c')](_0x2b3310['query'][_0x1d93('0x1c')]);_0x46928a[_0x1d93('0x19')]=qs['offset'](_0x2b3310[_0x1d93('0x2f')][_0x1d93('0x19')]);}_0x46928a[_0x1d93('0x35')]=qs['sort'](_0x2b3310[_0x1d93('0x2f')][_0x1d93('0x36')]);_0x46928a[_0x1d93('0x37')]=qs[_0x1d93('0x30')](_[_0x1d93('0x38')](_0x2b3310['query'],_0x463161[_0x1d93('0x30')]),_0x55d484);if(_0x2b3310[_0x1d93('0x2f')][_0x1d93('0x39')]){_0x46928a[_0x1d93('0x37')]=_['merge'](_0x46928a[_0x1d93('0x37')],{'$or':_[_0x1d93('0x28')](_0x55d484,function(_0x107796){if(_0x107796[_0x1d93('0x2c')]!==_0x1d93('0x3a')){var _0x50d60d={};_0x50d60d[_0x107796['name']]={'$like':'%'+_0x2b3310[_0x1d93('0x2f')][_0x1d93('0x39')]+'%'};return _0x50d60d;}})});}_0x46928a=_[_0x1d93('0x3b')]({},_0x46928a,_0x2b3310[_0x1d93('0x3c')]);var _0x626642={'where':_0x46928a[_0x1d93('0x37')]};return db[_0x1d93('0x29')][_0x1d93('0x1b')](_0x626642)[_0x1d93('0x3d')](function(_0x228829){_0x2bcc33[_0x1d93('0x1b')]=_0x228829;if(_0x2b3310[_0x1d93('0x2f')][_0x1d93('0x3e')]){_0x46928a[_0x1d93('0x3f')]=[{'all':!![]}];}return db[_0x1d93('0x29')]['findAll'](_0x46928a);})[_0x1d93('0x3d')](function(_0xa59e63){_0x2bcc33[_0x1d93('0x40')]=_0xa59e63;return _0x2bcc33;})['then'](respondWithFilteredResult(_0xf49810,_0x46928a))[_0x1d93('0x41')](handleError(_0xf49810,null));};exports['show']=function(_0x237e4e,_0x5d1154){var _0x340b2b={'raw':!![],'where':{'id':_0x237e4e[_0x1d93('0x42')]['id']}},_0x22e180={};_0x22e180['model']=_[_0x1d93('0x43')](db[_0x1d93('0x29')][_0x1d93('0x2a')]);_0x22e180[_0x1d93('0x2f')]=_['keys'](_0x237e4e['query']);_0x22e180[_0x1d93('0x30')]=_[_0x1d93('0x31')](_0x22e180[_0x1d93('0x2e')],_0x22e180[_0x1d93('0x2f')]);_0x340b2b[_0x1d93('0x32')]=_['intersection'](_0x22e180[_0x1d93('0x2e')],qs[_0x1d93('0x33')](_0x237e4e[_0x1d93('0x2f')]['fields']));_0x340b2b[_0x1d93('0x32')]=_0x340b2b[_0x1d93('0x32')]['length']?_0x340b2b['attributes']:_0x22e180[_0x1d93('0x2e')];if(_0x237e4e['query'][_0x1d93('0x3e')]){_0x340b2b['include']=[{'all':!![]}];}_0x340b2b=_[_0x1d93('0x3b')]({},_0x340b2b,_0x237e4e['options']);return db[_0x1d93('0x29')][_0x1d93('0x44')](_0x340b2b)[_0x1d93('0x3d')](handleEntityNotFound(_0x5d1154,null))[_0x1d93('0x3d')](respondWithResult(_0x5d1154,null))[_0x1d93('0x41')](handleError(_0x5d1154,null));};exports[_0x1d93('0x45')]=function(_0x1f2496,_0x7f8af5){return db[_0x1d93('0x29')][_0x1d93('0x45')](_0x1f2496[_0x1d93('0x46')],{})[_0x1d93('0x3d')](respondWithResult(_0x7f8af5,0xc9))['catch'](handleError(_0x7f8af5,null));};exports['update']=function(_0x12065d,_0x4f4be6){if(_0x12065d[_0x1d93('0x46')]['id']){delete _0x12065d[_0x1d93('0x46')]['id'];}return db[_0x1d93('0x29')][_0x1d93('0x44')]({'where':{'id':_0x12065d['params']['id']}})[_0x1d93('0x3d')](handleEntityNotFound(_0x4f4be6,null))['then'](saveUpdates(_0x12065d[_0x1d93('0x46')],null))['then'](respondWithResult(_0x4f4be6,null))['catch'](handleError(_0x4f4be6,null));};exports[_0x1d93('0x23')]=function(_0x43b5df,_0xc0673){return db[_0x1d93('0x29')][_0x1d93('0x44')]({'where':{'id':_0x43b5df[_0x1d93('0x42')]['id']}})[_0x1d93('0x3d')](handleEntityNotFound(_0xc0673,null))[_0x1d93('0x3d')](removeEntity(_0xc0673,null))['catch'](handleError(_0xc0673,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f3d80f0..3c21a5a 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 _0x4f8e=['../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x2ea26a,_0x3adaed){var _0x5d620c=function(_0x5d2d7d){while(--_0x5d2d7d){_0x2ea26a['push'](_0x2ea26a['shift']());}};_0x5d620c(++_0x3adaed);}(_0x4f8e,0x19d));var _0xe4f8=function(_0x106487,_0x23de58){_0x106487=_0x106487-0x0;var _0xc1da08=_0x4f8e[_0x106487];return _0xc1da08;};'use strict';var _=require(_0xe4f8('0x0'));var util=require(_0xe4f8('0x1'));var logger=require(_0xe4f8('0x2'))(_0xe4f8('0x3'));var moment=require('moment');var BPromise=require(_0xe4f8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe4f8('0x5'));var rimraf=require(_0xe4f8('0x6'));var config=require(_0xe4f8('0x7'));var attributes=require(_0xe4f8('0x8'));module[_0xe4f8('0x9')]=function(_0x266443,_0x56faf4){return _0x266443[_0xe4f8('0xa')](_0xe4f8('0xb'),attributes,{'tableName':_0xe4f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe4f8('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa1fb=['../../config/environment','exports','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','request-promise','rimraf'];(function(_0x5d8048,_0x445203){var _0x3affba=function(_0x5e65c4){while(--_0x5e65c4){_0x5d8048['push'](_0x5d8048['shift']());}};_0x3affba(++_0x445203);}(_0xa1fb,0x199));var _0xba1f=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0xa1fb[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0xba1f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xba1f('0x1'));var moment=require(_0xba1f('0x2'));var BPromise=require('bluebird');var rp=require(_0xba1f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xba1f('0x4'));var config=require(_0xba1f('0x5'));var attributes=require('./smsApplication.attributes');module[_0xba1f('0x6')]=function(_0x4b70f3,_0x7da947){return _0x4b70f3['define']('SmsApplication',attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xba1f('0x7'),'collate':_0xba1f('0x8')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index cc91ce2..e948627 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 _0xeaab=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xeaab,0xd9));var _0xbeaa=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xeaab[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xbeaa('0x0'));var util=require('util');var moment=require(_0xbeaa('0x1'));var BPromise=require(_0xbeaa('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbeaa('0x3'))['db'];var utils=require(_0xbeaa('0x4'));var logger=require(_0xbeaa('0x5'))(_0xbeaa('0x6'));var config=require(_0xbeaa('0x7'));var jayson=require(_0xbeaa('0x8'));var client=jayson[_0xbeaa('0x9')][_0xbeaa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f015b,_0x42a779,_0x346043){return new BPromise(function(_0x2da505,_0x15a826){return client[_0xbeaa('0xb')](_0x2f015b,_0x346043)['then'](function(_0x389c0b){logger[_0xbeaa('0xc')](_0xbeaa('0xd'),_0x42a779,_0xbeaa('0xe'));logger[_0xbeaa('0xf')](_0xbeaa('0x10'),_0x42a779,_0xbeaa('0xe'),JSON['stringify'](_0x389c0b));if(_0x389c0b[_0xbeaa('0x11')]){if(_0x389c0b['error'][_0xbeaa('0x12')]===0x1f4){logger[_0xbeaa('0x11')]('SmsApplication,\x20%s,\x20%s',_0x42a779,_0x389c0b[_0xbeaa('0x11')]['message']);return _0x15a826(_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);}logger['error'](_0xbeaa('0xd'),_0x42a779,_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);return _0x2da505(_0x389c0b[_0xbeaa('0x11')][_0xbeaa('0x13')]);}else{logger[_0xbeaa('0xc')](_0xbeaa('0xd'),_0x42a779,_0xbeaa('0xe'));_0x2da505(_0x389c0b[_0xbeaa('0x14')][_0xbeaa('0x13')]);}})[_0xbeaa('0x15')](function(_0x1cc387){logger[_0xbeaa('0x11')](_0xbeaa('0xd'),_0x42a779,_0x1cc387);_0x15a826(_0x1cc387);});});} \ No newline at end of file +var _0x4744=['error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s'];(function(_0x29c0fb,_0x13f1c3){var _0x2facf9=function(_0x4da11f){while(--_0x4da11f){_0x29c0fb['push'](_0x29c0fb['shift']());}};_0x2facf9(++_0x13f1c3);}(_0x4744,0x107));var _0x4474=function(_0x3612eb,_0x3807c8){_0x3612eb=_0x3612eb-0x0;var _0xac2443=_0x4744[_0x3612eb];return _0xac2443;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))(_0x4474('0x8'));var config=require(_0x4474('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4474('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc08a4c,_0x3024cd,_0x1dcdf0){return new BPromise(function(_0x387297,_0x247b66){return client[_0x4474('0xb')](_0xc08a4c,_0x1dcdf0)['then'](function(_0x17c4f7){logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,_0x4474('0xe'));logger[_0x4474('0xf')](_0x4474('0x10'),_0x3024cd,_0x4474('0xe'),JSON['stringify'](_0x17c4f7));if(_0x17c4f7['error']){if(_0x17c4f7['error']['code']===0x1f4){logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7['error'][_0x4474('0x12')]);return _0x247b66(_0x17c4f7['error'][_0x4474('0x12')]);}logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);return _0x387297(_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);}else{logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,'request\x20sent');_0x387297(_0x17c4f7[_0x4474('0x13')]['message']);}})['catch'](function(_0x46b79d){logger[_0x4474('0x11')]('SmsApplication,\x20%s,\x20%s',_0x3024cd,_0x46b79d);_0x247b66(_0x46b79d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3944f68..5f8a802 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 _0x7916=['smsinteraction:update','update','sms','destroy','delete','/:id/tags','removeTags','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','smsinteraction:addtags','put','/:id'];(function(_0x286855,_0x2747ad){var _0x3644c9=function(_0x306d18){while(--_0x306d18){_0x286855['push'](_0x286855['shift']());}};_0x3644c9(++_0x2747ad);}(_0x7916,0x128));var _0x6791=function(_0x18f074,_0x41b2c0){_0x18f074=_0x18f074-0x0;var _0x24832a=_0x7916[_0x18f074];return _0x24832a;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['get'](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router['get'](_0x6791('0xf'),auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);router[_0x6791('0x11')]('/',auth[_0x6791('0x8')](),controller[_0x6791('0x12')]);router[_0x6791('0x11')](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0x13')]);router[_0x6791('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x6791('0x14')]('sms',_0x6791('0x15')),controller['addTags']);router[_0x6791('0x16')](_0x6791('0x17'),auth['isAuthenticated'](),interaction[_0x6791('0x14')]('sms',_0x6791('0x18')),controller[_0x6791('0x19')]);router['delete'](_0x6791('0x17'),auth[_0x6791('0x8')](),interaction['tracked'](_0x6791('0x1a'),'smsinteraction:destroy'),controller[_0x6791('0x1b')]);router[_0x6791('0x1c')](_0x6791('0x1d'),auth[_0x6791('0x8')](),controller[_0x6791('0x1e')]);module[_0x6791('0x1f')]=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(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x4024,0x89));var _0x4402=function(_0x137629,_0x5d475c){_0x137629=_0x137629-0x0;var _0x433b41=_0x4024[_0x137629];return _0x433b41;};'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 339c218..6f382c7 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 _0xce1a=['DATE','STRING','out','ENUM','BOOLEAN','sequelize'];(function(_0x3d407c,_0x8127b5){var _0x7d17dc=function(_0xe3f088){while(--_0xe3f088){_0x3d407c['push'](_0x3d407c['shift']());}};_0x7d17dc(++_0x8127b5);}(_0xce1a,0xbf));var _0xace1=function(_0xcf0de2,_0x3e619d){_0xcf0de2=_0xcf0de2-0x0;var _0x53230e=_0xce1a[_0xcf0de2];return _0x53230e;};'use strict';var Sequelize=require(_0xace1('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xace1('0x1')]},'disposition':{'type':Sequelize[_0xace1('0x2')]},'secondDisposition':{'type':Sequelize[_0xace1('0x2')]},'thirdDisposition':{'type':Sequelize[_0xace1('0x2')]},'note':{'type':Sequelize[_0xace1('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xace1('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xace1('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xace1('0x4')]('in',_0xace1('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xace1('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x6808=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x36b937,_0x20ee27){var _0x4a846c=function(_0x2c0f86){while(--_0x2c0f86){_0x36b937['push'](_0x36b937['shift']());}};_0x4a846c(++_0x20ee27);}(_0x6808,0xd1));var _0x8680=function(_0x2c25e6,_0x2d1bc8){_0x2c25e6=_0x2c25e6-0x0;var _0x567d83=_0x6808[_0x2c25e6];return _0x567d83;};'use strict';var Sequelize=require(_0x8680('0x0'));var moment=require(_0x8680('0x1'));module[_0x8680('0x2')]={'closed':{'type':Sequelize[_0x8680('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8680('0x4')]},'disposition':{'type':Sequelize[_0x8680('0x5')]},'secondDisposition':{'type':Sequelize[_0x8680('0x5')]},'thirdDisposition':{'type':Sequelize[_0x8680('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8680('0x5')]},'read1stAt':{'type':Sequelize[_0x8680('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8680('0x6')]('in',_0x8680('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8680('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8680('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8680('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 964dc0a..2cfa098 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 _0x989b=['ui.SmsInteractionId','user_has_sms_interactions','u.id\x20=\x20ui.UserId','sms_interactions','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','sms_interaction_has_tags','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','Tag','split','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','resolve','user','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','role','sequelize','toString','keyBy','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','rawAttributes','includeAll','merge','options','create','describe','addMessage','SmsMessage','omit','ids','findOne','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','emit','removeTags','download','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','firstName','direction','SmsAccount','Account','Owner','mkdirSync','N.A.','closed','disposition','Messages','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','fullname','TagIds','Tags','push','catch','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','color','from','select','u.fullname'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x989b,0x187));var _0xb989=function(_0x17b3e0,_0x2b372c){_0x17b3e0=_0x17b3e0-0x0;var _0x46ff4a=_0x989b[_0x17b3e0];return _0x46ff4a;};'use strict';var emlformat=require(_0xb989('0x0'));var rimraf=require(_0xb989('0x1'));var zipdir=require(_0xb989('0x2'));var jsonpatch=require(_0xb989('0x3'));var rp=require(_0xb989('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb989('0x5'));var util=require(_0xb989('0x6'));var path=require(_0xb989('0x7'));var sox=require(_0xb989('0x8'));var csv=require(_0xb989('0x9'));var ejs=require(_0xb989('0xa'));var fs=require('fs');var fs_extra=require(_0xb989('0xb'));var _=require(_0xb989('0xc'));var squel=require(_0xb989('0xd'));var crypto=require(_0xb989('0xe'));var jsforce=require(_0xb989('0xf'));var deskjs=require(_0xb989('0x10'));var toCsv=require(_0xb989('0x9'));var querystring=require('querystring');var Papa=require(_0xb989('0x11'));var Redis=require(_0xb989('0x12'));var authService=require(_0xb989('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb989('0x14'));var pdf=require(_0xb989('0x15'));var hardwareService=require(_0xb989('0x16'));var logger=require(_0xb989('0x17'))(_0xb989('0x18'));var utils=require(_0xb989('0x19'));var config=require(_0xb989('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xb989('0x1b'))['db'];config[_0xb989('0x1c')]=_[_0xb989('0x1d')](config[_0xb989('0x1c')],{'host':_0xb989('0x1e'),'port':0x18eb});var socket=require(_0xb989('0x1f'))(new Redis(config[_0xb989('0x1c')]));require(_0xb989('0x20'))['register'](socket);function respondWithStatusCode(_0x1d77e4,_0x473ba9){_0x473ba9=_0x473ba9||0xcc;return function(_0x369cbc){if(_0x369cbc){return _0x1d77e4[_0xb989('0x21')](_0x473ba9);}return _0x1d77e4[_0xb989('0x22')](_0x473ba9)['end']();};}function respondWithResult(_0x291b86,_0xcd8157){_0xcd8157=_0xcd8157||0xc8;return function(_0x4ade95){if(_0x4ade95){return _0x291b86[_0xb989('0x22')](_0xcd8157)[_0xb989('0x23')](_0x4ade95);}};}function respondWithFilteredResult(_0x24a135,_0x1ed880){return function(_0x5bf307){if(_0x5bf307){var _0xdaeff=typeof _0x1ed880[_0xb989('0x24')]===_0xb989('0x25')&&typeof _0x1ed880[_0xb989('0x26')]===_0xb989('0x25');var _0x4ca5db=_0x5bf307[_0xb989('0x27')];var _0x498b54=_0xdaeff?0x0:_0x1ed880[_0xb989('0x24')];var _0x450c49=_0xdaeff?_0x5bf307[_0xb989('0x27')]:_0x1ed880[_0xb989('0x24')]+_0x1ed880[_0xb989('0x26')];var _0x233985;if(_0x450c49>=_0x4ca5db){_0x450c49=_0x4ca5db;_0x233985=0xc8;}else{_0x233985=0xce;}_0x24a135[_0xb989('0x22')](_0x233985);return _0x24a135['set'](_0xb989('0x28'),_0x498b54+'-'+_0x450c49+'/'+_0x4ca5db)['json'](_0x5bf307);}return null;};}function patchUpdates(_0x216e11){return function(_0x1bc4bf){try{jsonpatch[_0xb989('0x29')](_0x1bc4bf,_0x216e11,!![]);}catch(_0x525321){return BPromise[_0xb989('0x2a')](_0x525321);}return _0x1bc4bf[_0xb989('0x2b')]();};}function saveUpdates(_0x32410e,_0x3d7348){return function(_0x4f392a){if(_0x4f392a){return _0x4f392a[_0xb989('0x2c')](_0x32410e)[_0xb989('0x2d')](function(_0x5029ef){return _0x5029ef;});}return null;};}function removeEntity(_0xd0f6d9,_0x50a983){return function(_0x291667){if(_0x291667){return _0x291667[_0xb989('0x2e')]()['then'](function(){_0xd0f6d9[_0xb989('0x22')](0xcc)[_0xb989('0x2f')]();});}};}function handleEntityNotFound(_0x58460a,_0x25533d){return function(_0x2a73f5){if(!_0x2a73f5){_0x58460a[_0xb989('0x21')](0x194);}return _0x2a73f5;};}function handleError(_0x2b19d2,_0x1b390a){_0x1b390a=_0x1b390a||0x1f4;return function(_0x5539b5){logger['error'](_0x5539b5[_0xb989('0x30')]);if(_0x5539b5[_0xb989('0x31')]){delete _0x5539b5[_0xb989('0x31')];}_0x2b19d2['status'](_0x1b390a)[_0xb989('0x32')](_0x5539b5);};}function getInteractionUsers(_0x1aac3e,_0x2aa3da){return new BPromise(function(_0x457579,_0x5952d3){try{if(_0x2aa3da[_0x1aac3e['id']]){_0x1aac3e['Users']=_['map'](_0x2aa3da[_0x1aac3e['id']],function(_0x4621c4){return{'id':_0x4621c4['id'],'fullname':_0x4621c4[_0xb989('0x33')]};});}}catch(_0xe8e104){_0x5952d3(_0xe8e104);}_0x457579(_0x1aac3e);});}function getInteractionTags(_0x3b2327,_0x256bb6){return new BPromise(function(_0x40ee80,_0x39eb42){try{if(_0x3b2327[_0xb989('0x34')]){_0x3b2327['Tags']=[];_0x3b2327[_0xb989('0x34')]['split'](',')['forEach'](function(_0x5eba30){_0x3b2327[_0xb989('0x35')][_0xb989('0x36')](_0x256bb6[_0x5eba30]);});}delete _0x3b2327['TagIds'];}catch(_0x309cc7){_0x39eb42(_0x309cc7);}_0x40ee80(_0x3b2327);});}function updateSmsInteraction(_0x37e304,_0x46748e,_0x56a328){return new BPromise(function(_0x50e200,_0x2b41b8){return getInteractionUsers(_0x37e304,_0x56a328)[_0xb989('0x2d')](function(_0x4a7637){return getInteractionTags(_0x4a7637,_0x46748e);})[_0xb989('0x2d')](function(_0x813d45){_0x50e200(_0x813d45);})[_0xb989('0x37')](function(_0x532f3e){_0x2b41b8(_0x532f3e);});});}exports[_0xb989('0x38')]=function(_0x5d5e5d,_0x456d19){var _0x443c4f={},_0x5486ed={},_0x3881e0={'count':0x0,'rows':[]};var _0x88dfdc=_[_0xb989('0x39')](db['SmsInteraction']['rawAttributes'],function(_0x4a2a39){return{'name':_0x4a2a39[_0xb989('0x3a')],'type':_0x4a2a39['type'][_0xb989('0x3b')]};});_0x5486ed[_0xb989('0x3c')]=_['map'](_0x88dfdc,'name');_0x5486ed['query']=_['keys'](_0x5d5e5d[_0xb989('0x3d')]);_0x5486ed[_0xb989('0x3e')]=_[_0xb989('0x3f')](_0x5486ed[_0xb989('0x3c')],_0x5486ed[_0xb989('0x3d')]);_0x443c4f[_0xb989('0x40')]=_[_0xb989('0x3f')](_0x5486ed[_0xb989('0x3c')],qs[_0xb989('0x41')](_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x41')]));_0x443c4f[_0xb989('0x40')]=_0x443c4f[_0xb989('0x40')][_0xb989('0x42')]?_0x443c4f['attributes']:_0x5486ed['model'];if(!_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x43')](_0xb989('0x44'))){_0x443c4f[_0xb989('0x26')]=qs['limit'](_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x26')]);_0x443c4f[_0xb989('0x24')]=qs[_0xb989('0x24')](_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x24')]);}_0x443c4f[_0xb989('0x45')]=qs[_0xb989('0x46')](_0x5d5e5d[_0xb989('0x3d')]['sort']);_0x443c4f['where']=qs[_0xb989('0x3e')](_[_0xb989('0x47')](_0x5d5e5d[_0xb989('0x3d')],_0x5486ed[_0xb989('0x3e')]),_0x88dfdc);var _0x5358bb=[];var _0x50698b=squel['select']()['field']('id')[_0xb989('0x48')](_0xb989('0x31'))[_0xb989('0x48')](_0xb989('0x49'))[_0xb989('0x4a')]('tools_tags');var _0xa65675=squel[_0xb989('0x4b')]()['field']('u.id')[_0xb989('0x48')](_0xb989('0x4c'))['field'](_0xb989('0x4d'))[_0xb989('0x4a')](_0xb989('0x4e'),'ui')['left_join']('users','u',_0xb989('0x4f'));var _0x2ccce2=squel['select']()[_0xb989('0x4a')](_0xb989('0x50'),'i')[_0xb989('0x51')](_0xb989('0x52'),'c',_0xb989('0x53'))['left_join']('users','o',_0xb989('0x54'))[_0xb989('0x51')](_0xb989('0x55'),'a','a.id\x20=\x20i.SmsAccountId')[_0xb989('0x51')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0xb989('0x51')](_0xb989('0x56'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xb989('0x51')](_0xb989('0x57'),'t',_0xb989('0x58'));var _0x471911=squel[_0xb989('0x59')]();var _0x2b9e10=[];var _0x5c0f18=squel[_0xb989('0x59')]();var _0x1a3bd9;if(_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x5a')]){_0x1a3bd9=as[_0xb989('0x5b')](_0x5d5e5d[_0xb989('0x3d')]['search']);var _0x122581=_0x1a3bd9[_0xb989('0x5c')];for(var _0x1a0846=0x0;_0x1a0846<_0x1a3bd9[_0xb989('0x5d')][_0xb989('0x42')];_0x1a0846++){var _0x25d7f4=_0x1a3bd9['conditions'][_0x1a0846];var _0x40c2cb='i';var _0x7e8ebd=_[_0xb989('0x5e')](_0x88dfdc,[_0xb989('0x31'),_0x25d7f4[_0xb989('0x48')]]);if(!_0x7e8ebd){switch(_0x25d7f4[_0xb989('0x48')]){case _0xb989('0x5f'):if(_0x25d7f4[_0xb989('0x60')]==0x1){_0x2ccce2[_0xb989('0x61')]('`'+_0x25d7f4[_0xb989('0x48')]+_0xb989('0x62'));}else{_0x2ccce2[_0xb989('0x61')]('`'+_0x25d7f4[_0xb989('0x48')]+_0xb989('0x63'));}break;case _0xb989('0x64'):if(_0x25d7f4[_0xb989('0x65')]===_0xb989('0x66')){if(_0x25d7f4[_0xb989('0x60')]['split']('\x20')['length']>0x1){_0x471911[_0x122581](_0xb989('0x67'),qs[_0xb989('0x68')](_0x25d7f4[_0xb989('0x60')]),null);}else{var _0x49aa39='%'+_0x25d7f4[_0xb989('0x60')]+'%';_0x471911[_0x122581](_0xb989('0x69'),_0x49aa39,_0x49aa39,_0x49aa39);}}else{_0x7e8ebd=_[_0xb989('0x5e')](_0x88dfdc,['name',_0xb989('0x6a')]);_0x25d7f4[_0xb989('0x48')]=_0xb989('0x6a');_0x3b7191=as[_0xb989('0x6b')](_0x40c2cb,_0x7e8ebd[_0xb989('0x6c')],_0x25d7f4);_0x471911[_0x122581](_0x3b7191[_0xb989('0x6d')],_0x3b7191['value'][_0xb989('0x6e')],_0x3b7191[_0xb989('0x60')][_0xb989('0x2f')]);}break;case _0xb989('0x6f'):var _0x21809d=_0x25d7f4[_0xb989('0x60')][_0xb989('0x70')](',')['map'](function(_0x1f2d27){return Number(_0x1f2d27);});_0x21809d[_0xb989('0x71')](function(_0x4b2ecf){_0x5c0f18['or'](_0xb989('0x72'),'%,'+_0x4b2ecf+',%');});_0x2b9e10=_[_0xb989('0x73')](_0x2b9e10,_0x21809d);break;case _0xb989('0x74'):if(_0x25d7f4[_0xb989('0x65')]===_0xb989('0x66')){_0x471911[_0x122581](_0xb989('0x75'),'%'+_0x25d7f4[_0xb989('0x60')]+'%',null);}else{_0x7e8ebd=_['find'](_0x88dfdc,[_0xb989('0x31'),_0xb989('0x76')]);_0x25d7f4[_0xb989('0x48')]=_0xb989('0x76');_0x3b7191=as[_0xb989('0x6b')](_0x40c2cb,_0x7e8ebd[_0xb989('0x6c')],_0x25d7f4);_0x471911[_0x122581](_0x3b7191[_0xb989('0x6d')],_0x3b7191['value'][_0xb989('0x6e')],_0x3b7191['value'][_0xb989('0x2f')]);}break;case _0xb989('0x77'):_0x3b7191=as[_0xb989('0x6b')]('me',null,_0x25d7f4);_0x471911[_0x122581](_0x3b7191['text'],_0x3b7191[_0xb989('0x60')][_0xb989('0x6e')],_0x3b7191[_0xb989('0x60')][_0xb989('0x2f')]);break;}}else{var _0x3b7191=as[_0xb989('0x6b')](_0x40c2cb,_0x7e8ebd[_0xb989('0x6c')],_0x25d7f4);_0x471911[_0x122581](_0x3b7191[_0xb989('0x6d')],_0x3b7191[_0xb989('0x60')][_0xb989('0x6e')],_0x3b7191[_0xb989('0x60')][_0xb989('0x2f')]);}}}else{var _0x277842=_(_0x5d5e5d[_0xb989('0x3d')])[_0xb989('0x78')]()[_0xb989('0x39')](function(_0x39b32d){return _[_0xb989('0x79')](_0x88dfdc,[_0xb989('0x31'),_0x39b32d])?_0x39b32d:undefined;})[_0xb989('0x7a')]()[_0xb989('0x60')]();if(!_[_0xb989('0x7b')](_0x277842)){_0x277842[_0xb989('0x71')](function(_0x340080){if(_0x340080===_0xb989('0x7c')){_0x2ccce2[_0xb989('0x7d')](_0xb989('0x7e'),[][_0xb989('0x7f')](_0x5d5e5d['query'][_0x340080]));}else if(_0x340080===_0xb989('0x80')){var _0x4c3462=JSON[_0xb989('0x81')](_0x5d5e5d[_0xb989('0x3d')][_0x340080])[_0xb989('0x82')];var _0x3a75d4=JSON[_0xb989('0x81')](_0x5d5e5d[_0xb989('0x3d')][_0x340080])[_0xb989('0x83')];_0x2ccce2[_0xb989('0x7d')](_0xb989('0x84'),_0x4c3462,_0x3a75d4);}else{if(_0x5d5e5d[_0xb989('0x3d')][_0x340080]===_0xb989('0x85')){_0x2ccce2['where']('i.'+_0x340080+_0xb989('0x86'));}else{_0x2ccce2['where']('i.'+_0x340080+'\x20=\x20?',_0x5d5e5d[_0xb989('0x3d')][_0x340080]);}}});}if(_0x5d5e5d['query']['read']){if(_0x5d5e5d['query'][_0xb989('0x87')]==0x1){_0x2ccce2[_0xb989('0x61')](_0xb989('0x88'));}else{_0x2ccce2[_0xb989('0x61')](_0xb989('0x89'));}}if(_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x8a')]){_0x2b9e10=_[_0xb989('0x8b')](_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x8a')])?_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x8a')]:new Array(_0x5d5e5d['query'][_0xb989('0x8a')]);_0x2b9e10['forEach'](function(_0x910a53){_0x5c0f18['or'](_0xb989('0x72'),'%,'+_0x910a53+',%');});}if(_0x5d5e5d[_0xb989('0x3d')][_0xb989('0x8c')]){var _0x56eff1=_0x5d5e5d['query'][_0xb989('0x8c')][_0xb989('0x8d')]('\x5c','\x5c\x5c')[_0xb989('0x8d')](/'/g,'\x27\x27');if(qs[_0xb989('0x8e')](_0x56eff1)){_0x471911['or'](_0xb989('0x8f'),_0x56eff1+'%')['or']('i.phone\x20LIKE\x20?',_0x56eff1+'%');}else{_0x471911['or'](_0xb989('0x90'),qs[_0xb989('0x68')](_0x56eff1))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x56eff1+'%');}}}_0x2ccce2['where'](_0x471911);_0x2ccce2['group'](_0xb989('0x91'));var _0x38d01d={'type':db[_0xb989('0x92')][_0xb989('0x93')][_0xb989('0x94')],'raw':!![]};var _0x48a50a=_0x2ccce2[_0xb989('0x95')]();_0x48a50a[_0xb989('0x48')](_0xb989('0x91'));_0x48a50a[_0xb989('0x48')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xb989('0x5f'));if(_0x443c4f[_0xb989('0x45')]){_0x443c4f[_0xb989('0x45')]['forEach'](function(_0x74108c){var _0x1908ac=_0x74108c[0x0]===_0xb989('0x96')?_0x74108c[0x0]:'i.'+_0x74108c[0x0];_0x2ccce2[_0xb989('0x45')](_0x1908ac,_0x74108c[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x2b9e10)){_0x2ccce2['having'](_0x5c0f18);_0x48a50a[_0xb989('0x7d')](_0xb989('0x97'),_0x2b9e10);}BPromise[_0xb989('0x98')]()[_0xb989('0x2d')](function(){if(!_0x1a3bd9){if(_0x5d5e5d[_0xb989('0x3d')]['SmsAccountId'])return;_0x48a50a[_0xb989('0x7d')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x2ccce2['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5d5e5d[_0xb989('0x99')]['role']!==_0xb989('0x9a'))return;return _0x5d5e5d[_0xb989('0x99')][_0xb989('0x9b')]({'attributes':['id'],'raw':!![]})[_0xb989('0x2d')](function(_0x251fd6){if(_['isEmpty'](_0x251fd6)){_0x48a50a['where'](_0xb989('0x9c'));_0x2ccce2[_0xb989('0x7d')](_0xb989('0x9c'));}else{_0x48a50a[_0xb989('0x7d')](_0xb989('0x7e'),_[_0xb989('0x39')](_0x251fd6,'id'));_0x2ccce2['where'](_0xb989('0x7e'),_['map'](_0x251fd6,'id'));}});})[_0xb989('0x2d')](function(){if(_0x5d5e5d['user'][_0xb989('0x9d')]===_0xb989('0x9a')&&!_0x1a3bd9&&!_0x5d5e5d['query'][_0xb989('0x7c')])return[];return db[_0xb989('0x9e')][_0xb989('0x3d')](_0x48a50a[_0xb989('0x9f')](),_0x38d01d);})[_0xb989('0x2d')](function(_0x4d955c){_0x3881e0[_0xb989('0x27')]=_0x4d955c[_0xb989('0x42')];if(_0x3881e0['count']===0x0)return[];return db[_0xb989('0x9e')][_0xb989('0x3d')](_0x50698b[_0xb989('0x9f')](),_0x38d01d)['then'](function(_0x5cebcb){_0x5358bb=_[_0xb989('0xa0')](_0x5cebcb,'id');_0x38d01d=_['merge'](_0x38d01d,{'model':db[_0xb989('0xa1')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d5e5d['query'][_0xb989('0x41')]){_0x443c4f[_0xb989('0x40')][_0xb989('0x71')](function(_0x46b3d5){_0x2ccce2['field']('i.'+_0x46b3d5);});}else{_0x2ccce2['field'](_0xb989('0xa2'),_0xb989('0x5f'));_0x2ccce2[_0xb989('0x48')](_0xb989('0xa3'),'Account.key');_0x2ccce2[_0xb989('0x48')]('a.mandatoryDisposition','Account.mandatoryDisposition');_0x2ccce2[_0xb989('0x48')](_0xb989('0xa4'),_0xb989('0x96'));_0x2ccce2[_0xb989('0x48')]('i.*');_0x2ccce2[_0xb989('0x48')](_0xb989('0xa5'),_0xb989('0xa6'));_0x2ccce2[_0xb989('0x48')](_0xb989('0xa7'),_0xb989('0xa8'));_0x2ccce2['field']('c.email','Contact.email');_0x2ccce2[_0xb989('0x48')]('c.phone',_0xb989('0xa9'));_0x2ccce2['field'](_0xb989('0xaa'),_0xb989('0xab'));_0x2ccce2['field'](_0xb989('0xac'),_0xb989('0xad'));_0x2ccce2['field'](_0xb989('0xae'),_0xb989('0xaf'));_0x2ccce2[_0xb989('0x48')](_0xb989('0xb0'),_0xb989('0xb1'));_0x2ccce2['field'](_0xb989('0xb2'),'TagIds');}if(_0x443c4f[_0xb989('0x26')])_0x2ccce2[_0xb989('0x26')](_0x443c4f[_0xb989('0x26')]);if(_0x443c4f[_0xb989('0x24')])_0x2ccce2[_0xb989('0x24')](_0x443c4f[_0xb989('0x24')]);return db[_0xb989('0x9e')][_0xb989('0x3d')](_0x2ccce2[_0xb989('0x9f')](),_0x38d01d);})[_0xb989('0x2d')](function(_0x45cf77){if(_0x45cf77[_0xb989('0x42')]>0x0)_0xa65675[_0xb989('0x7d')](_0xb989('0xb3'),_[_0xb989('0x39')](_0x45cf77,'id'));return db[_0xb989('0x9e')][_0xb989('0x3d')](_0xa65675[_0xb989('0x9f')](),_0x38d01d)[_0xb989('0x2d')](function(_0x2365b9){var _0x191e00=_[_0xb989('0xb4')](_0x2365b9,_0xb989('0xb5'));var _0x1054d0=[];_0x45cf77[_0xb989('0x71')](function(_0x2e4973){_0x1054d0[_0xb989('0x36')](updateSmsInteraction(_0x2e4973,_0x5358bb,_0x191e00));});return BPromise[_0xb989('0xb6')](_0x1054d0);});});})[_0xb989('0x2d')](function(_0x48d6a2){_0x3881e0[_0xb989('0xb7')]=_0x48d6a2;return _0x3881e0;})[_0xb989('0x2d')](respondWithFilteredResult(_0x456d19,_0x443c4f))[_0xb989('0x37')](handleError(_0x456d19,null));};exports[_0xb989('0xb8')]=function(_0x708814,_0x2de1b6){var _0x1cdb3d={'raw':![],'where':{'id':_0x708814[_0xb989('0xb9')]['id']}},_0x10d6bb={};_0x10d6bb['model']=_[_0xb989('0x78')](db[_0xb989('0xa1')][_0xb989('0xba')]);_0x10d6bb[_0xb989('0x3d')]=_[_0xb989('0x78')](_0x708814[_0xb989('0x3d')]);_0x10d6bb['filters']=_[_0xb989('0x3f')](_0x10d6bb[_0xb989('0x3c')],_0x10d6bb[_0xb989('0x3d')]);_0x1cdb3d[_0xb989('0x40')]=_[_0xb989('0x3f')](_0x10d6bb['model'],qs[_0xb989('0x41')](_0x708814[_0xb989('0x3d')][_0xb989('0x41')]));_0x1cdb3d[_0xb989('0x40')]=_0x1cdb3d['attributes']['length']?_0x1cdb3d['attributes']:_0x10d6bb[_0xb989('0x3c')];if(_0x708814[_0xb989('0x3d')][_0xb989('0xbb')]){_0x1cdb3d['include']=[{'all':!![]}];}_0x1cdb3d=_[_0xb989('0xbc')]({},_0x1cdb3d,_0x708814[_0xb989('0xbd')]);return db[_0xb989('0xa1')][_0xb989('0x5e')](_0x1cdb3d)[_0xb989('0x2d')](handleEntityNotFound(_0x2de1b6,null))[_0xb989('0x2d')](respondWithResult(_0x2de1b6,null))[_0xb989('0x37')](handleError(_0x2de1b6,null));};exports[_0xb989('0xbe')]=function(_0x3e900c,_0x2dba8e){return db['SmsInteraction'][_0xb989('0xbe')](_0x3e900c[_0xb989('0x77')],{})[_0xb989('0x2d')](respondWithResult(_0x2dba8e,0xc9))['catch'](handleError(_0x2dba8e,null));};exports['update']=function(_0x5cea94,_0x4ca773){if(_0x5cea94[_0xb989('0x77')]['id']){delete _0x5cea94['body']['id'];}return db[_0xb989('0xa1')]['find']({'where':{'id':_0x5cea94[_0xb989('0xb9')]['id']}})[_0xb989('0x2d')](handleEntityNotFound(_0x4ca773,null))[_0xb989('0x2d')](saveUpdates(_0x5cea94[_0xb989('0x77')],null))[_0xb989('0x2d')](respondWithResult(_0x4ca773,null))['catch'](handleError(_0x4ca773,null));};exports['destroy']=function(_0x2cbcd5,_0x5605ed){return db[_0xb989('0xa1')][_0xb989('0x5e')]({'where':{'id':_0x2cbcd5[_0xb989('0xb9')]['id']}})[_0xb989('0x2d')](handleEntityNotFound(_0x5605ed,null))[_0xb989('0x2d')](removeEntity(_0x5605ed,null))[_0xb989('0x37')](handleError(_0x5605ed,null));};exports['describe']=function(_0x20c651,_0x50f506){return db[_0xb989('0xa1')][_0xb989('0xbf')]()[_0xb989('0x2d')](respondWithResult(_0x50f506,null))['catch'](handleError(_0x50f506,null));};exports[_0xb989('0xc0')]=function(_0x5541ec,_0x5bffba,_0x3d5f1c){return db[_0xb989('0xc1')]['find']({'where':{'id':_0x5541ec[_0xb989('0xb9')]['id']}})['then'](handleEntityNotFound(_0x5bffba,null))['then'](function(_0x23a1bf){if(_0x23a1bf){return _0x23a1bf['addMessage'](_0x5541ec['body']['ids'],_[_0xb989('0xc2')](_0x5541ec[_0xb989('0x77')],[_0xb989('0xc3'),'id'])||{});}})[_0xb989('0x2d')](respondWithResult(_0x5bffba,null))[_0xb989('0x37')](handleError(_0x5bffba,null));};exports['getMessages']=function(_0x345604,_0x17362d,_0x72172a){var _0x5eca05={'raw':![],'where':{}};var _0x12ce7c={};var _0xb93f68={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xb989('0xc4')]({'where':{'id':_0x345604[_0xb989('0xb9')]['id']}})['then'](handleEntityNotFound(_0x17362d,null))[_0xb989('0x2d')](function(_0x3ebeef){if(_0x3ebeef){_0x12ce7c[_0xb989('0x3c')]=_[_0xb989('0x78')](db[_0xb989('0xc1')][_0xb989('0xba')]);_0x12ce7c[_0xb989('0x3d')]=_[_0xb989('0x78')](_0x345604[_0xb989('0x3d')]);_0x12ce7c['filters']=_[_0xb989('0x3f')](_0x12ce7c[_0xb989('0x3c')],_0x12ce7c[_0xb989('0x3d')]);_0x5eca05[_0xb989('0x40')]=_[_0xb989('0x3f')](_0x12ce7c[_0xb989('0x3c')],qs[_0xb989('0x41')](_0x345604[_0xb989('0x3d')][_0xb989('0x41')]));_0x5eca05[_0xb989('0x40')]=_0x5eca05[_0xb989('0x40')]['length']?_0x5eca05['attributes']:_0x12ce7c['model'];if(!_0x345604[_0xb989('0x3d')][_0xb989('0x43')](_0xb989('0x44'))){_0x5eca05[_0xb989('0x26')]=qs['limit'](_0x345604[_0xb989('0x3d')]['limit']);_0x5eca05[_0xb989('0x24')]=qs[_0xb989('0x24')](_0x345604[_0xb989('0x3d')][_0xb989('0x24')]);}_0x5eca05[_0xb989('0x45')]=qs[_0xb989('0x46')](_0x345604['query']['sort']);_0x5eca05[_0xb989('0x7d')]=qs[_0xb989('0x3e')](_['pick'](_0x345604['query'],_0x12ce7c[_0xb989('0x3e')]));_0x5eca05['where'][_0xb989('0xb5')]=_0x3ebeef['id'];if(_0x345604[_0xb989('0x3d')][_0xb989('0x8c')]){_0x5eca05['where']=_[_0xb989('0xbc')](_0x5eca05[_0xb989('0x7d')],{'$or':_[_0xb989('0x39')](_0x5eca05[_0xb989('0x40')],function(_0x491432){var _0x2c8d92={};_0x2c8d92[_0x491432]={'$like':'%'+_0x345604['query'][_0xb989('0x8c')]+'%'};return _0x2c8d92;})});}if(_0x345604[_0xb989('0x3d')][_0xb989('0x82')]){var _0x147758=_0x345604[_0xb989('0x3d')][_0xb989('0x82')][_0xb989('0x70')](',');var _0x22014c={};_0x22014c[_0x147758[0x0]]={'$gte':moment(_0x147758[0x1])['format'](_0xb989('0xc5'))};_0x5eca05[_0xb989('0x7d')]=_[_0xb989('0xbc')](_0x5eca05['where'],_0x22014c);}_0x5eca05=_[_0xb989('0xbc')]({},_0x5eca05,_0x345604[_0xb989('0xbd')]);return db[_0xb989('0xc1')][_0xb989('0x27')]({'where':_0x5eca05['where']})['then'](function(_0x169075){_0xb93f68[_0xb989('0x27')]=_0x169075;if(_0x345604[_0xb989('0x3d')][_0xb989('0xbb')]){_0x5eca05[_0xb989('0xc6')]=[{'all':!![]}];}return db[_0xb989('0xc1')][_0xb989('0xc7')](_0x5eca05);})[_0xb989('0x2d')](function(_0x1ace06){_0xb93f68[_0xb989('0xb7')]=_0x1ace06;return _0xb93f68;});}})[_0xb989('0x2d')](respondWithFilteredResult(_0x17362d,_0x5eca05))['catch'](handleError(_0x17362d,null));};exports[_0xb989('0xc8')]=function(_0x598227,_0x136309,_0x25ffd9){return db[_0xb989('0xa1')][_0xb989('0x5e')]({'where':{'id':_0x598227[_0xb989('0xb9')]['id']}})[_0xb989('0x2d')](handleEntityNotFound(_0x136309,null))[_0xb989('0x2d')](function(_0x402f22){if(_0x402f22){return _0x402f22[_0xb989('0xc9')](_0x598227[_0xb989('0x77')][_0xb989('0xc3')],_[_0xb989('0xc2')](_0x598227[_0xb989('0x77')],[_0xb989('0xc3'),'id'])||{})['spread'](function(){return db[_0xb989('0x6f')]['findAll']({'attributes':['id',_0xb989('0x31'),_0xb989('0x49')],'where':{'id':_0x598227[_0xb989('0x77')]['ids']}});})[_0xb989('0x2d')](function(_0x4ce12c){socket[_0xb989('0xca')]('smsInteractionTags:save',{'id':Number(_0x598227['params']['id']),'tags':_0x4ce12c||[]});return{'id':Number(_0x598227['params']['id']),'tags':_0x4ce12c||[]};});}})[_0xb989('0x2d')](respondWithResult(_0x136309,null))['catch'](handleError(_0x136309,null));};exports[_0xb989('0xcb')]=function(_0xa871be,_0x322ae9,_0x285fed){return db[_0xb989('0xa1')][_0xb989('0x5e')]({'where':{'id':_0xa871be[_0xb989('0xb9')]['id']}})['then'](handleEntityNotFound(_0x322ae9,null))[_0xb989('0x2d')](function(_0x12e750){if(_0x12e750){return _0x12e750[_0xb989('0xcb')](_0xa871be['query'][_0xb989('0xc3')]);}})[_0xb989('0x2d')](respondWithStatusCode(_0x322ae9,null))[_0xb989('0x37')](handleError(_0x322ae9,null));};exports[_0xb989('0xcc')]=function(_0x468a97,_0x54a876){var _0x4e61f3=moment()['unix']()[_0xb989('0x9f')]();var _0xea4220=path[_0xb989('0xcd')](config[_0xb989('0xce')],_0xb989('0xcf'),_0xb989('0xd0'),_0xb989('0xd1'));var _0x6eeb4c=path[_0xb989('0xcd')](config[_0xb989('0xce')],_0xb989('0xcf'),_0xb989('0xd0'),_0xb989('0xd2'));var _0xb30c7=path[_0xb989('0xcd')](_0xea4220,_0x4e61f3);var _0x2d7c2e=util[_0xb989('0xd3')](_0xb989('0xd4'),_0x468a97['params']['id'],_0x4e61f3);var _0x28ebb4=path[_0xb989('0xcd')](_0xea4220,_0x2d7c2e);var _0x25d6b6=[];_0x25d6b6['push']({'model':db[_0xb989('0x74')],'as':'User','attributes':['id',_0xb989('0x33')],'raw':!![]});_0x25d6b6['push']({'model':db['CmContact'],'as':_0xb989('0x64'),'attributes':['id',_0xb989('0xd5'),'lastName'],'raw':!![]});var _0x18f23d=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xb989('0x77'),_0xb989('0x80'),_0xb989('0xd6'),'secret',_0xb989('0x87')],'include':_0x25d6b6}];_0x18f23d[_0xb989('0x36')]({'model':db[_0xb989('0xd7')],'as':_0xb989('0xd8'),'attributes':['id',_0xb989('0x31')]});_0x18f23d[_0xb989('0x36')]({'model':db['User'],'as':_0xb989('0xd9'),'attributes':['id',_0xb989('0x33')]});return db['SmsInteraction'][_0xb989('0x5e')]({'where':{'id':_0x468a97['params']['id']},'include':_0x18f23d})[_0xb989('0x2d')](handleEntityNotFound(_0x54a876,null))[_0xb989('0x2d')](function(_0xcce96f){if(_0xcce96f){var _0x3c87b2=_0xcce96f['get']({'plain':!![]});fs[_0xb989('0xda')](_0xb30c7);var _0x331e8a={'channel':'Sms','account':_0x3c87b2[_0xb989('0xd8')][_0xb989('0x31')],'agent':_0x3c87b2[_0xb989('0xd9')]?_0x3c87b2[_0xb989('0xd9')][_0xb989('0x33')]:_0xb989('0xdb'),'createdAt':moment(_0x3c87b2[_0xb989('0x80')])[_0xb989('0xd3')](_0xb989('0xc5'))[_0xb989('0x9f')](),'closedAt':_0x3c87b2[_0xb989('0xdc')]?moment(_0x3c87b2['closedAt'])[_0xb989('0xd3')](_0xb989('0xc5'))[_0xb989('0x9f')]():'','disposition':_0x3c87b2[_0xb989('0xdd')],'messages':_(_0x3c87b2[_0xb989('0xde')])[_0xb989('0x8c')]({'secret':![]})[_0xb989('0x39')](function(_0x4c08a2){return{'date':moment(_0x4c08a2['createdAt'])[_0xb989('0xd3')](_0xb989('0xc5'))['toString'](),'sender':_0x4c08a2['direction']===_0xb989('0xdf')?_0x4c08a2['User']?_0x4c08a2['User'][_0xb989('0x33')]:_0xb989('0xe0'):_0x4c08a2['Contact'][_0xb989('0xd5')]+(_0x4c08a2[_0xb989('0x64')][_0xb989('0xe1')]?'\x20'+_0x4c08a2[_0xb989('0x64')][_0xb989('0xe1')]:''),'body':_0x4c08a2['body'],'direction':_0x4c08a2[_0xb989('0xd6')]===_0xb989('0xdf')?'A':'C','secret':_0x4c08a2['secret'],'read':_0x4c08a2[_0xb989('0x87')]};})[_0xb989('0x60')]()};return ejs[_0xb989('0xe2')](path['join'](config['root'],_0xb989('0xcf'),_0xb989('0xe3'),_0xb989('0xe4')),{'interaction':_0x331e8a})['then'](function(_0x313373){var _0x45f7e2=path[_0xb989('0xcd')](_0xb30c7,_0xb989('0xe5')+_0x3c87b2['id']+'-'+_0x4e61f3+'.pdf');var _0x1555b0={'path':_0x45f7e2,'channel':'Sms','interactionId':_0x3c87b2['id']};return pdf[_0xb989('0xe6')](_0x313373,_0x1555b0);})[_0xb989('0x2d')](function(){return new BPromise(function(_0x9cb87,_0x831c42){zipdir(_0xb30c7,{'saveTo':_0x28ebb4},function(_0x168691,_0x5b78ea){if(_0x168691)return _0x831c42(_0x168691);return _0x9cb87(_0x5b78ea);});})[_0xb989('0x2d')](function(){return new BPromise(function(_0x578ac2,_0xbe6bb1){rimraf(_0xb30c7,function(_0x5a02e1){if(_0x5a02e1)_0xbe6bb1(_0x5a02e1);return _0x578ac2();});});})[_0xb989('0x2d')](function(){return _0x54a876['download'](_0x28ebb4,_0x2d7c2e,function(_0xed2386){if(_0xed2386){console[_0xb989('0xe7')](_0xb989('0xe8'),_0xed2386);}else{fs[_0xb989('0xe9')](_0x28ebb4);}});});});}else{return _0x54a876[_0xb989('0x21')](0xc8);}})[_0xb989('0x37')](handleError(_0x54a876,null));}; \ No newline at end of file +var _0xddc5=['unix','join','root','files','attachments','format','transcript-%d-%s.zip','CmContact','Messages','direction','secret','read','SmsAccount','Account','get','Owner','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','out','Contact','firstName','lastName','renderFile','server','downloadInteraction.ejs','.pdf','Sms','log','err','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','register','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','name','send','Users','map','fullname','TagIds','Tags','forEach','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','tools_tags','u.fullname','user_has_sms_interactions','left_join','users','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','value','having','`\x20=\x200','`\x20>\x200','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','t.id\x20IN\x20?','resolve','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','toString','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','push','params','includeAll','merge','options','create','destroy','describe','SmsMessage','ids','omit','getMessages','findOne','$gte','findAll','rows','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download'];(function(_0x352342,_0x174889){var _0x1609a7=function(_0x4114ab){while(--_0x4114ab){_0x352342['push'](_0x352342['shift']());}};_0x1609a7(++_0x174889);}(_0xddc5,0x101));var _0x5ddc=function(_0x12511e,_0x23bf7a){_0x12511e=_0x12511e-0x0;var _0x4c06cf=_0xddc5[_0x12511e];return _0x4c06cf;};'use strict';var emlformat=require(_0x5ddc('0x0'));var rimraf=require(_0x5ddc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ddc('0x2'));var rp=require(_0x5ddc('0x3'));var moment=require(_0x5ddc('0x4'));var BPromise=require(_0x5ddc('0x5'));var Mustache=require(_0x5ddc('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5ddc('0x7'));var csv=require(_0x5ddc('0x8'));var ejs=require(_0x5ddc('0x9'));var fs=require('fs');var fs_extra=require(_0x5ddc('0xa'));var _=require(_0x5ddc('0xb'));var squel=require(_0x5ddc('0xc'));var crypto=require(_0x5ddc('0xd'));var jsforce=require(_0x5ddc('0xe'));var deskjs=require(_0x5ddc('0xf'));var toCsv=require(_0x5ddc('0x8'));var querystring=require(_0x5ddc('0x10'));var Papa=require(_0x5ddc('0x11'));var Redis=require(_0x5ddc('0x12'));var authService=require(_0x5ddc('0x13'));var qs=require(_0x5ddc('0x14'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x5ddc('0x15'));var hardwareService=require(_0x5ddc('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x5ddc('0x17'));var config=require(_0x5ddc('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x5ddc('0x19')]=_['defaults'](config['redis'],{'host':_0x5ddc('0x1a'),'port':0x18eb});var socket=require(_0x5ddc('0x1b'))(new Redis(config[_0x5ddc('0x19')]));require('./smsInteraction.socket')[_0x5ddc('0x1c')](socket);function respondWithStatusCode(_0x32a7b9,_0x1cd02f){_0x1cd02f=_0x1cd02f||0xcc;return function(_0x1fe09e){if(_0x1fe09e){return _0x32a7b9['sendStatus'](_0x1cd02f);}return _0x32a7b9[_0x5ddc('0x1d')](_0x1cd02f)[_0x5ddc('0x1e')]();};}function respondWithResult(_0x3e5751,_0x3df0bb){_0x3df0bb=_0x3df0bb||0xc8;return function(_0x45a45c){if(_0x45a45c){return _0x3e5751[_0x5ddc('0x1d')](_0x3df0bb)[_0x5ddc('0x1f')](_0x45a45c);}};}function respondWithFilteredResult(_0x1658d8,_0x4a77e4){return function(_0x3d3fc6){if(_0x3d3fc6){var _0x48459d=typeof _0x4a77e4[_0x5ddc('0x20')]==='undefined'&&typeof _0x4a77e4[_0x5ddc('0x21')]===_0x5ddc('0x22');var _0x37220a=_0x3d3fc6[_0x5ddc('0x23')];var _0x5b5e07=_0x48459d?0x0:_0x4a77e4[_0x5ddc('0x20')];var _0x4d4e3b=_0x48459d?_0x3d3fc6[_0x5ddc('0x23')]:_0x4a77e4['offset']+_0x4a77e4[_0x5ddc('0x21')];var _0x4ff5bd;if(_0x4d4e3b>=_0x37220a){_0x4d4e3b=_0x37220a;_0x4ff5bd=0xc8;}else{_0x4ff5bd=0xce;}_0x1658d8[_0x5ddc('0x1d')](_0x4ff5bd);return _0x1658d8[_0x5ddc('0x24')]('Content-Range',_0x5b5e07+'-'+_0x4d4e3b+'/'+_0x37220a)[_0x5ddc('0x1f')](_0x3d3fc6);}return null;};}function patchUpdates(_0x233d74){return function(_0x2d92b3){try{jsonpatch[_0x5ddc('0x25')](_0x2d92b3,_0x233d74,!![]);}catch(_0x5ae015){return BPromise[_0x5ddc('0x26')](_0x5ae015);}return _0x2d92b3[_0x5ddc('0x27')]();};}function saveUpdates(_0x3b94c5,_0x2bd435){return function(_0x1fd1a5){if(_0x1fd1a5){return _0x1fd1a5[_0x5ddc('0x28')](_0x3b94c5)['then'](function(_0x281a74){return _0x281a74;});}return null;};}function removeEntity(_0x58e962,_0x4c6974){return function(_0x1f7838){if(_0x1f7838){return _0x1f7838['destroy']()[_0x5ddc('0x29')](function(){_0x58e962['status'](0xcc)[_0x5ddc('0x1e')]();});}};}function handleEntityNotFound(_0x3f88a9,_0x5827f0){return function(_0x38d8cf){if(!_0x38d8cf){_0x3f88a9[_0x5ddc('0x2a')](0x194);}return _0x38d8cf;};}function handleError(_0x20c22d,_0x3eeca0){_0x3eeca0=_0x3eeca0||0x1f4;return function(_0x38dff9){logger['error'](_0x38dff9['stack']);if(_0x38dff9[_0x5ddc('0x2b')]){delete _0x38dff9[_0x5ddc('0x2b')];}_0x20c22d[_0x5ddc('0x1d')](_0x3eeca0)[_0x5ddc('0x2c')](_0x38dff9);};}function getInteractionUsers(_0x37f5ec,_0x1e1976){return new BPromise(function(_0x163d3e,_0x508caa){try{if(_0x1e1976[_0x37f5ec['id']]){_0x37f5ec[_0x5ddc('0x2d')]=_[_0x5ddc('0x2e')](_0x1e1976[_0x37f5ec['id']],function(_0x1678c7){return{'id':_0x1678c7['id'],'fullname':_0x1678c7[_0x5ddc('0x2f')]};});}}catch(_0xed1c8c){_0x508caa(_0xed1c8c);}_0x163d3e(_0x37f5ec);});}function getInteractionTags(_0x1fb344,_0x2bcbaf){return new BPromise(function(_0xdfbaf1,_0xb4704){try{if(_0x1fb344[_0x5ddc('0x30')]){_0x1fb344[_0x5ddc('0x31')]=[];_0x1fb344['TagIds']['split'](',')[_0x5ddc('0x32')](function(_0xca7aa5){_0x1fb344[_0x5ddc('0x31')]['push'](_0x2bcbaf[_0xca7aa5]);});}delete _0x1fb344[_0x5ddc('0x30')];}catch(_0x289da7){_0xb4704(_0x289da7);}_0xdfbaf1(_0x1fb344);});}function updateSmsInteraction(_0x3608dc,_0x243785,_0x5afcfd){return new BPromise(function(_0x2471a0,_0x11dd2e){return getInteractionUsers(_0x3608dc,_0x5afcfd)['then'](function(_0x4a5054){return getInteractionTags(_0x4a5054,_0x243785);})[_0x5ddc('0x29')](function(_0x4a0efd){_0x2471a0(_0x4a0efd);})[_0x5ddc('0x33')](function(_0x125365){_0x11dd2e(_0x125365);});});}exports[_0x5ddc('0x34')]=function(_0x4259d4,_0x5e3e0a){var _0x3b309d={},_0x33468c={},_0x23dc86={'count':0x0,'rows':[]};var _0x5730e3=_[_0x5ddc('0x2e')](db[_0x5ddc('0x35')][_0x5ddc('0x36')],function(_0x5bc474){return{'name':_0x5bc474[_0x5ddc('0x37')],'type':_0x5bc474[_0x5ddc('0x38')][_0x5ddc('0x39')]};});_0x33468c['model']=_['map'](_0x5730e3,_0x5ddc('0x2b'));_0x33468c[_0x5ddc('0x3a')]=_[_0x5ddc('0x3b')](_0x4259d4[_0x5ddc('0x3a')]);_0x33468c[_0x5ddc('0x3c')]=_['intersection'](_0x33468c[_0x5ddc('0x3d')],_0x33468c['query']);_0x3b309d[_0x5ddc('0x3e')]=_[_0x5ddc('0x3f')](_0x33468c[_0x5ddc('0x3d')],qs[_0x5ddc('0x40')](_0x4259d4['query']['fields']));_0x3b309d['attributes']=_0x3b309d[_0x5ddc('0x3e')][_0x5ddc('0x41')]?_0x3b309d[_0x5ddc('0x3e')]:_0x33468c[_0x5ddc('0x3d')];if(!_0x4259d4[_0x5ddc('0x3a')][_0x5ddc('0x42')](_0x5ddc('0x43'))){_0x3b309d[_0x5ddc('0x21')]=qs[_0x5ddc('0x21')](_0x4259d4[_0x5ddc('0x3a')]['limit']);_0x3b309d['offset']=qs['offset'](_0x4259d4[_0x5ddc('0x3a')]['offset']);}_0x3b309d[_0x5ddc('0x44')]=qs['sort'](_0x4259d4[_0x5ddc('0x3a')][_0x5ddc('0x45')]);_0x3b309d['where']=qs[_0x5ddc('0x3c')](_[_0x5ddc('0x46')](_0x4259d4[_0x5ddc('0x3a')],_0x33468c[_0x5ddc('0x3c')]),_0x5730e3);var _0x394e71=[];var _0x494006=squel[_0x5ddc('0x47')]()[_0x5ddc('0x48')]('id')[_0x5ddc('0x48')](_0x5ddc('0x2b'))['field'](_0x5ddc('0x49'))[_0x5ddc('0x4a')](_0x5ddc('0x4b'));var _0x365096=squel[_0x5ddc('0x47')]()[_0x5ddc('0x48')]('u.id')[_0x5ddc('0x48')](_0x5ddc('0x4c'))[_0x5ddc('0x48')]('ui.SmsInteractionId')[_0x5ddc('0x4a')](_0x5ddc('0x4d'),'ui')[_0x5ddc('0x4e')](_0x5ddc('0x4f'),'u','u.id\x20=\x20ui.UserId');var _0x239b53=squel[_0x5ddc('0x47')]()[_0x5ddc('0x4a')]('sms_interactions','i')[_0x5ddc('0x4e')](_0x5ddc('0x50'),'c',_0x5ddc('0x51'))['left_join'](_0x5ddc('0x4f'),'o',_0x5ddc('0x52'))[_0x5ddc('0x4e')](_0x5ddc('0x53'),'a',_0x5ddc('0x54'))['left_join']('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0x5ddc('0x4e')](_0x5ddc('0x55'),'it','it.SmsInteractionId\x20=\x20i.id')[_0x5ddc('0x4e')](_0x5ddc('0x4b'),'t',_0x5ddc('0x56'));var _0x20cc55=squel['expr']();var _0x2b56b9=[];var _0x3b6025=squel[_0x5ddc('0x57')]();var _0x2ce91c;if(_0x4259d4[_0x5ddc('0x3a')]['search']){_0x2ce91c=as[_0x5ddc('0x58')](_0x4259d4[_0x5ddc('0x3a')][_0x5ddc('0x59')]);var _0xd3db7=_0x2ce91c[_0x5ddc('0x5a')];for(var _0x18dce2=0x0;_0x18dce2<_0x2ce91c[_0x5ddc('0x5b')]['length'];_0x18dce2++){var _0x2d4d49=_0x2ce91c[_0x5ddc('0x5b')][_0x18dce2];var _0x204c4f='i';var _0x2e30e5=_[_0x5ddc('0x5c')](_0x5730e3,[_0x5ddc('0x2b'),_0x2d4d49['field']]);if(!_0x2e30e5){switch(_0x2d4d49['field']){case'unreadMessages':if(_0x2d4d49[_0x5ddc('0x5d')]==0x1){_0x239b53[_0x5ddc('0x5e')]('`'+_0x2d4d49[_0x5ddc('0x48')]+_0x5ddc('0x5f'));}else{_0x239b53[_0x5ddc('0x5e')]('`'+_0x2d4d49[_0x5ddc('0x48')]+_0x5ddc('0x60'));}break;case'Contact':if(_0x2d4d49['operator']===_0x5ddc('0x61')){if(_0x2d4d49[_0x5ddc('0x5d')][_0x5ddc('0x62')]('\x20')[_0x5ddc('0x41')]>0x1){_0x20cc55[_0xd3db7](_0x5ddc('0x63'),qs[_0x5ddc('0x64')](_0x2d4d49['value']),null);}else{var _0x195529='%'+_0x2d4d49['value']+'%';_0x20cc55[_0xd3db7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x195529,_0x195529,_0x195529);}}else{_0x2e30e5=_[_0x5ddc('0x5c')](_0x5730e3,[_0x5ddc('0x2b'),_0x5ddc('0x65')]);_0x2d4d49[_0x5ddc('0x48')]=_0x5ddc('0x65');_0x4b96de=as[_0x5ddc('0x66')](_0x204c4f,_0x2e30e5[_0x5ddc('0x38')],_0x2d4d49);_0x20cc55[_0xd3db7](_0x4b96de[_0x5ddc('0x67')],_0x4b96de['value'][_0x5ddc('0x68')],_0x4b96de[_0x5ddc('0x5d')]['end']);}break;case _0x5ddc('0x69'):var _0xf39f9c=_0x2d4d49[_0x5ddc('0x5d')][_0x5ddc('0x62')](',')[_0x5ddc('0x2e')](function(_0x33df18){return Number(_0x33df18);});_0xf39f9c[_0x5ddc('0x32')](function(_0x1c3ee2){_0x3b6025['or'](_0x5ddc('0x6a'),'%,'+_0x1c3ee2+',%');});_0x2b56b9=_[_0x5ddc('0x6b')](_0x2b56b9,_0xf39f9c);break;case _0x5ddc('0x6c'):if(_0x2d4d49[_0x5ddc('0x6d')]===_0x5ddc('0x61')){_0x20cc55[_0xd3db7](_0x5ddc('0x6e'),'%'+_0x2d4d49['value']+'%',null);}else{_0x2e30e5=_[_0x5ddc('0x5c')](_0x5730e3,[_0x5ddc('0x2b'),_0x5ddc('0x6f')]);_0x2d4d49[_0x5ddc('0x48')]=_0x5ddc('0x6f');_0x4b96de=as[_0x5ddc('0x66')](_0x204c4f,_0x2e30e5[_0x5ddc('0x38')],_0x2d4d49);_0x20cc55[_0xd3db7](_0x4b96de[_0x5ddc('0x67')],_0x4b96de[_0x5ddc('0x5d')][_0x5ddc('0x68')],_0x4b96de[_0x5ddc('0x5d')][_0x5ddc('0x1e')]);}break;case _0x5ddc('0x70'):_0x4b96de=as[_0x5ddc('0x66')]('me',null,_0x2d4d49);_0x20cc55[_0xd3db7](_0x4b96de[_0x5ddc('0x67')],_0x4b96de[_0x5ddc('0x5d')][_0x5ddc('0x68')],_0x4b96de['value'][_0x5ddc('0x1e')]);break;}}else{var _0x4b96de=as[_0x5ddc('0x66')](_0x204c4f,_0x2e30e5[_0x5ddc('0x38')],_0x2d4d49);_0x20cc55[_0xd3db7](_0x4b96de[_0x5ddc('0x67')],_0x4b96de['value'][_0x5ddc('0x68')],_0x4b96de[_0x5ddc('0x5d')][_0x5ddc('0x1e')]);}}}else{var _0x1dfa43=_(_0x4259d4[_0x5ddc('0x3a')])[_0x5ddc('0x3b')]()['map'](function(_0x4d47e0){return _[_0x5ddc('0x71')](_0x5730e3,[_0x5ddc('0x2b'),_0x4d47e0])?_0x4d47e0:undefined;})['compact']()[_0x5ddc('0x5d')]();if(!_[_0x5ddc('0x72')](_0x1dfa43)){_0x1dfa43['forEach'](function(_0x3885c5){if(_0x3885c5===_0x5ddc('0x73')){_0x239b53[_0x5ddc('0x74')](_0x5ddc('0x75'),[][_0x5ddc('0x76')](_0x4259d4[_0x5ddc('0x3a')][_0x3885c5]));}else if(_0x3885c5===_0x5ddc('0x77')){var _0x25f593=JSON[_0x5ddc('0x78')](_0x4259d4[_0x5ddc('0x3a')][_0x3885c5])['$gte'];var _0x2d3bbc=JSON['parse'](_0x4259d4['query'][_0x3885c5])['$lte'];_0x239b53[_0x5ddc('0x74')](_0x5ddc('0x79'),_0x25f593,_0x2d3bbc);}else{if(_0x4259d4[_0x5ddc('0x3a')][_0x3885c5]===_0x5ddc('0x7a')){_0x239b53[_0x5ddc('0x74')]('i.'+_0x3885c5+_0x5ddc('0x7b'));}else{_0x239b53[_0x5ddc('0x74')]('i.'+_0x3885c5+'\x20=\x20?',_0x4259d4[_0x5ddc('0x3a')][_0x3885c5]);}}});}if(_0x4259d4[_0x5ddc('0x3a')]['read']){if(_0x4259d4[_0x5ddc('0x3a')]['read']==0x1){_0x239b53[_0x5ddc('0x5e')](_0x5ddc('0x7c'));}else{_0x239b53[_0x5ddc('0x5e')](_0x5ddc('0x7d'));}}if(_0x4259d4['query'][_0x5ddc('0x7e')]){_0x2b56b9=_['isArray'](_0x4259d4[_0x5ddc('0x3a')]['tag'])?_0x4259d4['query'][_0x5ddc('0x7e')]:new Array(_0x4259d4['query'][_0x5ddc('0x7e')]);_0x2b56b9[_0x5ddc('0x32')](function(_0x36ff93){_0x3b6025['or'](_0x5ddc('0x6a'),'%,'+_0x36ff93+',%');});}if(_0x4259d4[_0x5ddc('0x3a')]['filter']){var _0x1af0b3=_0x4259d4['query'][_0x5ddc('0x7f')]['replace']('\x5c','\x5c\x5c')[_0x5ddc('0x80')](/'/g,'\x27\x27');if(qs[_0x5ddc('0x81')](_0x1af0b3)){_0x20cc55['or'](_0x5ddc('0x82'),_0x1af0b3+'%')['or'](_0x5ddc('0x83'),_0x1af0b3+'%');}else{_0x20cc55['or'](_0x5ddc('0x84'),qs[_0x5ddc('0x64')](_0x1af0b3))['or'](_0x5ddc('0x85'),_0x1af0b3+'%');}}}_0x239b53[_0x5ddc('0x74')](_0x20cc55);_0x239b53[_0x5ddc('0x86')]('i.id');var _0x27294f={'type':db[_0x5ddc('0x87')][_0x5ddc('0x88')][_0x5ddc('0x89')],'raw':!![]};var _0x112068=_0x239b53['clone']();_0x112068[_0x5ddc('0x48')](_0x5ddc('0x8a'));_0x112068[_0x5ddc('0x48')](_0x5ddc('0x8b'),_0x5ddc('0x8c'));if(_0x3b309d['order']){_0x3b309d['order']['forEach'](function(_0x2ec349){var _0x374401=_0x2ec349[0x0]===_0x5ddc('0x8d')?_0x2ec349[0x0]:'i.'+_0x2ec349[0x0];_0x239b53[_0x5ddc('0x44')](_0x374401,_0x2ec349[0x1]==='DESC'?![]:!![]);});}if(!_[_0x5ddc('0x72')](_0x2b56b9)){_0x239b53[_0x5ddc('0x5e')](_0x3b6025);_0x112068[_0x5ddc('0x74')](_0x5ddc('0x8e'),_0x2b56b9);}BPromise[_0x5ddc('0x8f')]()[_0x5ddc('0x29')](function(){if(!_0x2ce91c){if(_0x4259d4[_0x5ddc('0x3a')][_0x5ddc('0x73')])return;_0x112068[_0x5ddc('0x74')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x239b53['where'](_0x5ddc('0x90'));return;}if(_0x4259d4[_0x5ddc('0x91')][_0x5ddc('0x92')]!==_0x5ddc('0x93'))return;return _0x4259d4[_0x5ddc('0x91')][_0x5ddc('0x94')]({'attributes':['id'],'raw':!![]})[_0x5ddc('0x29')](function(_0x25887f){if(_['isEmpty'](_0x25887f)){_0x112068[_0x5ddc('0x74')](_0x5ddc('0x95'));_0x239b53[_0x5ddc('0x74')](_0x5ddc('0x95'));}else{_0x112068[_0x5ddc('0x74')](_0x5ddc('0x75'),_[_0x5ddc('0x2e')](_0x25887f,'id'));_0x239b53['where'](_0x5ddc('0x75'),_['map'](_0x25887f,'id'));}});})[_0x5ddc('0x29')](function(){if(_0x4259d4['user'][_0x5ddc('0x92')]===_0x5ddc('0x93')&&!_0x2ce91c&&!_0x4259d4[_0x5ddc('0x3a')][_0x5ddc('0x73')])return[];return db[_0x5ddc('0x96')][_0x5ddc('0x3a')](_0x112068[_0x5ddc('0x97')](),_0x27294f);})[_0x5ddc('0x29')](function(_0x113b7d){_0x23dc86[_0x5ddc('0x23')]=_0x113b7d[_0x5ddc('0x41')];if(_0x23dc86['count']===0x0)return[];return db[_0x5ddc('0x96')]['query'](_0x494006['toString'](),_0x27294f)[_0x5ddc('0x29')](function(_0x8c0ddb){_0x394e71=_['keyBy'](_0x8c0ddb,'id');_0x27294f=_['merge'](_0x27294f,{'model':db[_0x5ddc('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4259d4[_0x5ddc('0x3a')][_0x5ddc('0x40')]){_0x3b309d[_0x5ddc('0x3e')]['forEach'](function(_0x273037){_0x239b53[_0x5ddc('0x48')]('i.'+_0x273037);});}else{_0x239b53[_0x5ddc('0x48')](_0x5ddc('0x8b'),_0x5ddc('0x8c'));_0x239b53[_0x5ddc('0x48')](_0x5ddc('0x98'),'Account.key');_0x239b53[_0x5ddc('0x48')](_0x5ddc('0x99'),_0x5ddc('0x9a'));_0x239b53[_0x5ddc('0x48')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END',_0x5ddc('0x8d'));_0x239b53[_0x5ddc('0x48')]('i.*');_0x239b53['field'](_0x5ddc('0x9b'),_0x5ddc('0x9c'));_0x239b53['field']('c.lastName',_0x5ddc('0x9d'));_0x239b53[_0x5ddc('0x48')](_0x5ddc('0x9e'),_0x5ddc('0x9f'));_0x239b53['field'](_0x5ddc('0xa0'),'Contact.phone');_0x239b53[_0x5ddc('0x48')](_0x5ddc('0xa1'),_0x5ddc('0xa2'));_0x239b53[_0x5ddc('0x48')](_0x5ddc('0xa3'),_0x5ddc('0xa4'));_0x239b53[_0x5ddc('0x48')](_0x5ddc('0xa5'),'Owner.fullname');_0x239b53[_0x5ddc('0x48')](_0x5ddc('0xa6'),_0x5ddc('0xa7'));_0x239b53['field'](_0x5ddc('0xa8'),'TagIds');}if(_0x3b309d[_0x5ddc('0x21')])_0x239b53[_0x5ddc('0x21')](_0x3b309d[_0x5ddc('0x21')]);if(_0x3b309d[_0x5ddc('0x20')])_0x239b53[_0x5ddc('0x20')](_0x3b309d[_0x5ddc('0x20')]);return db['sequelize'][_0x5ddc('0x3a')](_0x239b53[_0x5ddc('0x97')](),_0x27294f);})[_0x5ddc('0x29')](function(_0x4a6452){if(_0x4a6452['length']>0x0)_0x365096[_0x5ddc('0x74')](_0x5ddc('0xa9'),_[_0x5ddc('0x2e')](_0x4a6452,'id'));return db[_0x5ddc('0x96')]['query'](_0x365096['toString'](),_0x27294f)[_0x5ddc('0x29')](function(_0x3ac537){var _0x3b302c=_[_0x5ddc('0xaa')](_0x3ac537,_0x5ddc('0xab'));var _0x1a40bc=[];_0x4a6452[_0x5ddc('0x32')](function(_0x2ca5dd){_0x1a40bc[_0x5ddc('0xac')](updateSmsInteraction(_0x2ca5dd,_0x394e71,_0x3b302c));});return BPromise['all'](_0x1a40bc);});});})[_0x5ddc('0x29')](function(_0x5e3bcf){_0x23dc86['rows']=_0x5e3bcf;return _0x23dc86;})[_0x5ddc('0x29')](respondWithFilteredResult(_0x5e3e0a,_0x3b309d))[_0x5ddc('0x33')](handleError(_0x5e3e0a,null));};exports['show']=function(_0x338311,_0xd8094b){var _0x2c26b2={'raw':![],'where':{'id':_0x338311[_0x5ddc('0xad')]['id']}},_0x3cee44={};_0x3cee44[_0x5ddc('0x3d')]=_['keys'](db[_0x5ddc('0x35')][_0x5ddc('0x36')]);_0x3cee44['query']=_[_0x5ddc('0x3b')](_0x338311['query']);_0x3cee44[_0x5ddc('0x3c')]=_[_0x5ddc('0x3f')](_0x3cee44[_0x5ddc('0x3d')],_0x3cee44[_0x5ddc('0x3a')]);_0x2c26b2[_0x5ddc('0x3e')]=_['intersection'](_0x3cee44['model'],qs[_0x5ddc('0x40')](_0x338311['query']['fields']));_0x2c26b2['attributes']=_0x2c26b2[_0x5ddc('0x3e')][_0x5ddc('0x41')]?_0x2c26b2[_0x5ddc('0x3e')]:_0x3cee44[_0x5ddc('0x3d')];if(_0x338311['query'][_0x5ddc('0xae')]){_0x2c26b2['include']=[{'all':!![]}];}_0x2c26b2=_[_0x5ddc('0xaf')]({},_0x2c26b2,_0x338311[_0x5ddc('0xb0')]);return db[_0x5ddc('0x35')][_0x5ddc('0x5c')](_0x2c26b2)['then'](handleEntityNotFound(_0xd8094b,null))['then'](respondWithResult(_0xd8094b,null))[_0x5ddc('0x33')](handleError(_0xd8094b,null));};exports[_0x5ddc('0xb1')]=function(_0x338f56,_0x280fd5){return db[_0x5ddc('0x35')]['create'](_0x338f56[_0x5ddc('0x70')],{})[_0x5ddc('0x29')](respondWithResult(_0x280fd5,0xc9))[_0x5ddc('0x33')](handleError(_0x280fd5,null));};exports[_0x5ddc('0x28')]=function(_0x3e19c8,_0x41ecd7){if(_0x3e19c8[_0x5ddc('0x70')]['id']){delete _0x3e19c8['body']['id'];}return db[_0x5ddc('0x35')][_0x5ddc('0x5c')]({'where':{'id':_0x3e19c8[_0x5ddc('0xad')]['id']}})['then'](handleEntityNotFound(_0x41ecd7,null))[_0x5ddc('0x29')](saveUpdates(_0x3e19c8[_0x5ddc('0x70')],null))[_0x5ddc('0x29')](respondWithResult(_0x41ecd7,null))[_0x5ddc('0x33')](handleError(_0x41ecd7,null));};exports[_0x5ddc('0xb2')]=function(_0x34c0ff,_0x4bb099){return db[_0x5ddc('0x35')][_0x5ddc('0x5c')]({'where':{'id':_0x34c0ff[_0x5ddc('0xad')]['id']}})['then'](handleEntityNotFound(_0x4bb099,null))[_0x5ddc('0x29')](removeEntity(_0x4bb099,null))[_0x5ddc('0x33')](handleError(_0x4bb099,null));};exports[_0x5ddc('0xb3')]=function(_0x59180f,_0x14c069){return db['SmsInteraction'][_0x5ddc('0xb3')]()[_0x5ddc('0x29')](respondWithResult(_0x14c069,null))['catch'](handleError(_0x14c069,null));};exports['addMessage']=function(_0x48b3a8,_0x2abbd0,_0x274352){return db[_0x5ddc('0xb4')][_0x5ddc('0x5c')]({'where':{'id':_0x48b3a8[_0x5ddc('0xad')]['id']}})[_0x5ddc('0x29')](handleEntityNotFound(_0x2abbd0,null))['then'](function(_0x58cefa){if(_0x58cefa){return _0x58cefa['addMessage'](_0x48b3a8[_0x5ddc('0x70')][_0x5ddc('0xb5')],_[_0x5ddc('0xb6')](_0x48b3a8[_0x5ddc('0x70')],[_0x5ddc('0xb5'),'id'])||{});}})[_0x5ddc('0x29')](respondWithResult(_0x2abbd0,null))[_0x5ddc('0x33')](handleError(_0x2abbd0,null));};exports[_0x5ddc('0xb7')]=function(_0x3a9c64,_0xd3ddf4,_0x2b48db){var _0x225657={'raw':![],'where':{}};var _0x5032a0={};var _0x34ce73={'count':0x0,'rows':[]};return db[_0x5ddc('0x35')][_0x5ddc('0xb8')]({'where':{'id':_0x3a9c64[_0x5ddc('0xad')]['id']}})[_0x5ddc('0x29')](handleEntityNotFound(_0xd3ddf4,null))['then'](function(_0x5237be){if(_0x5237be){_0x5032a0[_0x5ddc('0x3d')]=_[_0x5ddc('0x3b')](db[_0x5ddc('0xb4')]['rawAttributes']);_0x5032a0[_0x5ddc('0x3a')]=_[_0x5ddc('0x3b')](_0x3a9c64[_0x5ddc('0x3a')]);_0x5032a0[_0x5ddc('0x3c')]=_[_0x5ddc('0x3f')](_0x5032a0[_0x5ddc('0x3d')],_0x5032a0[_0x5ddc('0x3a')]);_0x225657[_0x5ddc('0x3e')]=_[_0x5ddc('0x3f')](_0x5032a0[_0x5ddc('0x3d')],qs[_0x5ddc('0x40')](_0x3a9c64[_0x5ddc('0x3a')][_0x5ddc('0x40')]));_0x225657['attributes']=_0x225657[_0x5ddc('0x3e')][_0x5ddc('0x41')]?_0x225657['attributes']:_0x5032a0[_0x5ddc('0x3d')];if(!_0x3a9c64[_0x5ddc('0x3a')][_0x5ddc('0x42')]('nolimit')){_0x225657[_0x5ddc('0x21')]=qs[_0x5ddc('0x21')](_0x3a9c64[_0x5ddc('0x3a')]['limit']);_0x225657['offset']=qs['offset'](_0x3a9c64['query'][_0x5ddc('0x20')]);}_0x225657['order']=qs['sort'](_0x3a9c64['query']['sort']);_0x225657[_0x5ddc('0x74')]=qs[_0x5ddc('0x3c')](_[_0x5ddc('0x46')](_0x3a9c64['query'],_0x5032a0[_0x5ddc('0x3c')]));_0x225657[_0x5ddc('0x74')]['SmsInteractionId']=_0x5237be['id'];if(_0x3a9c64['query'][_0x5ddc('0x7f')]){_0x225657[_0x5ddc('0x74')]=_[_0x5ddc('0xaf')](_0x225657[_0x5ddc('0x74')],{'$or':_[_0x5ddc('0x2e')](_0x225657['attributes'],function(_0xf008d8){var _0x11714d={};_0x11714d[_0xf008d8]={'$like':'%'+_0x3a9c64[_0x5ddc('0x3a')][_0x5ddc('0x7f')]+'%'};return _0x11714d;})});}if(_0x3a9c64[_0x5ddc('0x3a')][_0x5ddc('0xb9')]){var _0x816cd6=_0x3a9c64[_0x5ddc('0x3a')][_0x5ddc('0xb9')][_0x5ddc('0x62')](',');var _0x3905af={};_0x3905af[_0x816cd6[0x0]]={'$gte':moment(_0x816cd6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x225657['where']=_['merge'](_0x225657[_0x5ddc('0x74')],_0x3905af);}_0x225657=_[_0x5ddc('0xaf')]({},_0x225657,_0x3a9c64[_0x5ddc('0xb0')]);return db[_0x5ddc('0xb4')][_0x5ddc('0x23')]({'where':_0x225657[_0x5ddc('0x74')]})[_0x5ddc('0x29')](function(_0x4ea763){_0x34ce73[_0x5ddc('0x23')]=_0x4ea763;if(_0x3a9c64['query'][_0x5ddc('0xae')]){_0x225657['include']=[{'all':!![]}];}return db[_0x5ddc('0xb4')][_0x5ddc('0xba')](_0x225657);})['then'](function(_0x2f3fef){_0x34ce73[_0x5ddc('0xbb')]=_0x2f3fef;return _0x34ce73;});}})[_0x5ddc('0x29')](respondWithFilteredResult(_0xd3ddf4,_0x225657))[_0x5ddc('0x33')](handleError(_0xd3ddf4,null));};exports[_0x5ddc('0xbc')]=function(_0x40c037,_0xe1706c,_0x26aef8){return db[_0x5ddc('0x35')]['find']({'where':{'id':_0x40c037[_0x5ddc('0xad')]['id']}})[_0x5ddc('0x29')](handleEntityNotFound(_0xe1706c,null))[_0x5ddc('0x29')](function(_0x4e1527){if(_0x4e1527){return _0x4e1527[_0x5ddc('0xbd')](_0x40c037[_0x5ddc('0x70')][_0x5ddc('0xb5')],_[_0x5ddc('0xb6')](_0x40c037['body'],[_0x5ddc('0xb5'),'id'])||{})[_0x5ddc('0xbe')](function(){return db[_0x5ddc('0x69')][_0x5ddc('0xba')]({'attributes':['id',_0x5ddc('0x2b'),_0x5ddc('0x49')],'where':{'id':_0x40c037['body'][_0x5ddc('0xb5')]}});})['then'](function(_0x1669ef){socket[_0x5ddc('0xbf')](_0x5ddc('0xc0'),{'id':Number(_0x40c037[_0x5ddc('0xad')]['id']),'tags':_0x1669ef||[]});return{'id':Number(_0x40c037[_0x5ddc('0xad')]['id']),'tags':_0x1669ef||[]};});}})['then'](respondWithResult(_0xe1706c,null))[_0x5ddc('0x33')](handleError(_0xe1706c,null));};exports[_0x5ddc('0xc1')]=function(_0x45587c,_0x310f4e,_0x35b636){return db[_0x5ddc('0x35')][_0x5ddc('0x5c')]({'where':{'id':_0x45587c[_0x5ddc('0xad')]['id']}})[_0x5ddc('0x29')](handleEntityNotFound(_0x310f4e,null))['then'](function(_0x150ccd){if(_0x150ccd){return _0x150ccd['removeTags'](_0x45587c['query'][_0x5ddc('0xb5')]);}})[_0x5ddc('0x29')](respondWithStatusCode(_0x310f4e,null))[_0x5ddc('0x33')](handleError(_0x310f4e,null));};exports[_0x5ddc('0xc2')]=function(_0x460303,_0x49e714){var _0x259c7d=moment()[_0x5ddc('0xc3')]()[_0x5ddc('0x97')]();var _0x57bd0a=path[_0x5ddc('0xc4')](config[_0x5ddc('0xc5')],'server','files','tmp');var _0x46abae=path[_0x5ddc('0xc4')](config[_0x5ddc('0xc5')],'server',_0x5ddc('0xc6'),_0x5ddc('0xc7'));var _0x71f81a=path[_0x5ddc('0xc4')](_0x57bd0a,_0x259c7d);var _0x575ee8=util[_0x5ddc('0xc8')](_0x5ddc('0xc9'),_0x460303[_0x5ddc('0xad')]['id'],_0x259c7d);var _0x3155fd=path[_0x5ddc('0xc4')](_0x57bd0a,_0x575ee8);var _0x34cbf8=[];_0x34cbf8[_0x5ddc('0xac')]({'model':db['User'],'as':_0x5ddc('0x6c'),'attributes':['id',_0x5ddc('0x2f')],'raw':!![]});_0x34cbf8[_0x5ddc('0xac')]({'model':db[_0x5ddc('0xca')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});var _0x11083f=[{'model':db[_0x5ddc('0xb4')],'as':_0x5ddc('0xcb'),'attributes':['id',_0x5ddc('0x70'),'createdAt',_0x5ddc('0xcc'),_0x5ddc('0xcd'),_0x5ddc('0xce')],'include':_0x34cbf8}];_0x11083f['push']({'model':db[_0x5ddc('0xcf')],'as':_0x5ddc('0xd0'),'attributes':['id',_0x5ddc('0x2b')]});_0x11083f[_0x5ddc('0xac')]({'model':db[_0x5ddc('0x6c')],'as':'Owner','attributes':['id',_0x5ddc('0x2f')]});return db[_0x5ddc('0x35')]['find']({'where':{'id':_0x460303[_0x5ddc('0xad')]['id']},'include':_0x11083f})[_0x5ddc('0x29')](handleEntityNotFound(_0x49e714,null))[_0x5ddc('0x29')](function(_0x5cefc8){if(_0x5cefc8){var _0x301bf8=_0x5cefc8[_0x5ddc('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x71f81a);var _0x1f4cc8={'channel':'Sms','account':_0x301bf8[_0x5ddc('0xd0')]['name'],'agent':_0x301bf8[_0x5ddc('0xd2')]?_0x301bf8[_0x5ddc('0xd2')][_0x5ddc('0x2f')]:_0x5ddc('0xd3'),'createdAt':moment(_0x301bf8['createdAt'])['format'](_0x5ddc('0xd4'))[_0x5ddc('0x97')](),'closedAt':_0x301bf8[_0x5ddc('0xd5')]?moment(_0x301bf8[_0x5ddc('0xd6')])[_0x5ddc('0xc8')](_0x5ddc('0xd4'))[_0x5ddc('0x97')]():'','disposition':_0x301bf8['disposition'],'messages':_(_0x301bf8[_0x5ddc('0xcb')])[_0x5ddc('0x7f')]({'secret':![]})[_0x5ddc('0x2e')](function(_0x5919cf){return{'date':moment(_0x5919cf[_0x5ddc('0x77')])[_0x5ddc('0xc8')](_0x5ddc('0xd4'))[_0x5ddc('0x97')](),'sender':_0x5919cf['direction']===_0x5ddc('0xd7')?_0x5919cf[_0x5ddc('0x6c')]?_0x5919cf[_0x5ddc('0x6c')][_0x5ddc('0x2f')]:'System':_0x5919cf[_0x5ddc('0xd8')][_0x5ddc('0xd9')]+(_0x5919cf[_0x5ddc('0xd8')][_0x5ddc('0xda')]?'\x20'+_0x5919cf[_0x5ddc('0xd8')][_0x5ddc('0xda')]:''),'body':_0x5919cf[_0x5ddc('0x70')],'direction':_0x5919cf[_0x5ddc('0xcc')]===_0x5ddc('0xd7')?'A':'C','secret':_0x5919cf[_0x5ddc('0xcd')],'read':_0x5919cf[_0x5ddc('0xce')]};})['value']()};return ejs[_0x5ddc('0xdb')](path[_0x5ddc('0xc4')](config[_0x5ddc('0xc5')],_0x5ddc('0xdc'),'views',_0x5ddc('0xdd')),{'interaction':_0x1f4cc8})[_0x5ddc('0x29')](function(_0x2c0fc7){var _0x26e363=path[_0x5ddc('0xc4')](_0x71f81a,'transcript-'+_0x301bf8['id']+'-'+_0x259c7d+_0x5ddc('0xde'));var _0x39b3ce={'path':_0x26e363,'channel':_0x5ddc('0xdf'),'interactionId':_0x301bf8['id']};return pdf['createPdfFromHTML'](_0x2c0fc7,_0x39b3ce);})['then'](function(){return new BPromise(function(_0x186642,_0x2f348f){zipdir(_0x71f81a,{'saveTo':_0x3155fd},function(_0x2fdd56,_0x593846){if(_0x2fdd56)return _0x2f348f(_0x2fdd56);return _0x186642(_0x593846);});})[_0x5ddc('0x29')](function(){return new BPromise(function(_0x23354e,_0x379b21){rimraf(_0x71f81a,function(_0x31ccc6){if(_0x31ccc6)_0x379b21(_0x31ccc6);return _0x23354e();});});})['then'](function(){return _0x49e714[_0x5ddc('0xc2')](_0x3155fd,_0x575ee8,function(_0x395a89){if(_0x395a89){console[_0x5ddc('0xe0')](_0x5ddc('0xe1'),_0x395a89);}else{fs['unlinkSync'](_0x3155fd);}});});});}else{return _0x49e714[_0x5ddc('0x2a')](0xc8);}})[_0x5ddc('0x33')](handleError(_0x49e714,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 11b6bb7..e040bb9 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 _0x0b0e=['update','remove','getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','events','SmsInteraction','SmsMessage','setMaxListeners','save'];(function(_0x1c400c,_0x503939){var _0x316e3e=function(_0x4c5414){while(--_0x4c5414){_0x1c400c['push'](_0x1c400c['shift']());}};_0x316e3e(++_0x503939);}(_0x0b0e,0x187));var _0xe0b0=function(_0xd5709b,_0x101823){_0xd5709b=_0xd5709b-0x0;var _0x3dc484=_0x0b0e[_0xd5709b];return _0x3dc484;};'use strict';var EventEmitter=require(_0xe0b0('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xe0b0('0x1')];var SmsMessage=require('../../mysqldb')['db'][_0xe0b0('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xe0b0('0x3')](0x0);var events={'afterCreate':_0xe0b0('0x4'),'afterUpdate':_0xe0b0('0x5'),'afterDestroy':_0xe0b0('0x6')};function emitEvent(_0x38a058){return function(_0x399e67,_0x185efa,_0x30e20d){_0x399e67[_0xe0b0('0x7')]({'attributes':['id'],'raw':!![]})[_0xe0b0('0x8')](function(_0x5cf9cc){_0x399e67['setDataValue'](_0xe0b0('0x9'),_0x5cf9cc[_0xe0b0('0xa')](function(_0xc4a085){return{'id':_0xc4a085['id']};}));return SmsMessage[_0xe0b0('0xb')]({'where':{'SmsInteractionId':_0x399e67['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x338e7c){_0x399e67[_0xe0b0('0xc')]('unreadMessages',_0x338e7c[_0xe0b0('0xd')]);SmsInteractionEvents[_0xe0b0('0xe')](_0x38a058+':'+_0x399e67['id'],_0x399e67);SmsInteractionEvents['emit'](_0x38a058,_0x399e67);_0x30e20d(null);})[_0xe0b0('0xf')](_0x30e20d(null));};}for(var e in events){if(events[_0xe0b0('0x10')](e)){var event=events[e];SmsInteraction[_0xe0b0('0x11')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xadb5=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners'];(function(_0x5c9de6,_0x2ee623){var _0x2795c4=function(_0x482e39){while(--_0x482e39){_0x5c9de6['push'](_0x5c9de6['shift']());}};_0x2795c4(++_0x2ee623);}(_0xadb5,0xad));var _0x5adb=function(_0x2dbae2,_0x2594f2){_0x2dbae2=_0x2dbae2-0x0;var _0xf8125=_0xadb5[_0x2dbae2];return _0xf8125;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x5adb('0x0'))['db']['SmsInteraction'];var SmsMessage=require(_0x5adb('0x0'))['db'][_0x5adb('0x1')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x5adb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5adb('0x3'),'afterDestroy':_0x5adb('0x4')};function emitEvent(_0x2e3ef4){return function(_0x4cb1d1,_0x35a5d3,_0x168d89){_0x4cb1d1[_0x5adb('0x5')]({'attributes':['id'],'raw':!![]})[_0x5adb('0x6')](function(_0xdf3776){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0x8'),_0xdf3776[_0x5adb('0x9')](function(_0x41261c){return{'id':_0x41261c['id']};}));return SmsMessage[_0x5adb('0xa')]({'where':{'SmsInteractionId':_0x4cb1d1['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5adb('0x6')](function(_0x336bad){_0x4cb1d1[_0x5adb('0x7')](_0x5adb('0xb'),_0x336bad['length']);SmsInteractionEvents['emit'](_0x2e3ef4+':'+_0x4cb1d1['id'],_0x4cb1d1);SmsInteractionEvents[_0x5adb('0xc')](_0x2e3ef4,_0x4cb1d1);_0x168d89(null);})[_0x5adb('0xd')](_0x168d89(null));};}for(var e in events){if(events[_0x5adb('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x5adb('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 45c3d4f..23ee4e4 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 _0x0329=['exports','SmsInteraction','sms_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x5e547a,_0x2b7ee2){var _0x5c0e57=function(_0x12d00d){while(--_0x12d00d){_0x5e547a['push'](_0x5e547a['shift']());}};_0x5c0e57(++_0x2b7ee2);}(_0x0329,0x1e3));var _0x9032=function(_0x34efa6,_0x343fe2){_0x34efa6=_0x34efa6-0x0;var _0x469490=_0x0329[_0x34efa6];return _0x469490;};'use strict';var _=require(_0x9032('0x0'));var util=require(_0x9032('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9032('0x2'));var BPromise=require(_0x9032('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9032('0x4'));var config=require(_0x9032('0x5'));var attributes=require(_0x9032('0x6'));module[_0x9032('0x7')]=function(_0x7e48ad,_0x3ca4bf){return _0x7e48ad['define'](_0x9032('0x8'),attributes,{'tableName':_0x9032('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5df651,_0x217cc9,_0x40ffc3){if(_0x5df651['changed'](_0x9032('0xa'))){_0x5df651[_0x9032('0xb')]=moment()[_0x9032('0xc')](_0x9032('0xd'));}_0x40ffc3(null,_0x5df651);}}});}; \ No newline at end of file +var _0xb24e=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closedAt'];(function(_0x4695e2,_0x3d5f15){var _0x160563=function(_0x5df0a2){while(--_0x5df0a2){_0x4695e2['push'](_0x4695e2['shift']());}};_0x160563(++_0x3d5f15);}(_0xb24e,0x136));var _0xeb24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb24e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xeb24('0x0'));var util=require('util');var logger=require(_0xeb24('0x1'))(_0xeb24('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb24('0x3'));var rimraf=require(_0xeb24('0x4'));var config=require(_0xeb24('0x5'));var attributes=require(_0xeb24('0x6'));module[_0xeb24('0x7')]=function(_0x5169a2,_0x483c14){return _0x5169a2[_0xeb24('0x8')](_0xeb24('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40fc3d,_0x42b67e,_0x76c6ff){if(_0x40fc3d[_0xeb24('0xa')]('closed')){_0x40fc3d[_0xeb24('0xb')]=moment()[_0xeb24('0xc')](_0xeb24('0xd'));}_0x76c6ff(null,_0x40fc3d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d4ccdef..c9a2d4d 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 _0xb9ef=['request\x20sent','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','catch','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','register','request','then','SmsInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','info'];(function(_0x4a8cb7,_0x1cab4b){var _0x442e3f=function(_0x8f91e4){while(--_0x8f91e4){_0x4a8cb7['push'](_0x4a8cb7['shift']());}};_0x442e3f(++_0x1cab4b);}(_0xb9ef,0x1ac));var _0xfb9e=function(_0x5d1602,_0x3b9496){_0x5d1602=_0x5d1602-0x0;var _0xaa027e=_0xb9ef[_0x5d1602];return _0xaa027e;};'use strict';var _=require(_0xfb9e('0x0'));var util=require(_0xfb9e('0x1'));var moment=require(_0xfb9e('0x2'));var BPromise=require(_0xfb9e('0x3'));var rs=require(_0xfb9e('0x4'));var fs=require('fs');var Redis=require(_0xfb9e('0x5'));var db=require(_0xfb9e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb9e('0x7'))(_0xfb9e('0x8'));var config=require(_0xfb9e('0x9'));var jayson=require(_0xfb9e('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xfb9e('0xb')]=_[_0xfb9e('0xc')](config[_0xfb9e('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb9e('0xb')]));require('./smsInteraction.socket')[_0xfb9e('0xd')](socket);function respondWithRpcPromise(_0x2e1549,_0x48889e,_0x59c293){return new BPromise(function(_0x59a978,_0x3ac817){return client[_0xfb9e('0xe')](_0x2e1549,_0x59c293)[_0xfb9e('0xf')](function(_0x3f5103){logger['info'](_0xfb9e('0x10'),_0x48889e,'request\x20sent');logger[_0xfb9e('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x48889e,'request\x20sent',JSON[_0xfb9e('0x12')](_0x3f5103));if(_0x3f5103['error']){if(_0x3f5103[_0xfb9e('0x13')][_0xfb9e('0x14')]===0x1f4){logger[_0xfb9e('0x13')](_0xfb9e('0x10'),_0x48889e,_0x3f5103[_0xfb9e('0x13')][_0xfb9e('0x15')]);return _0x3ac817(_0x3f5103[_0xfb9e('0x13')][_0xfb9e('0x15')]);}logger['error'](_0xfb9e('0x10'),_0x48889e,_0x3f5103['error'][_0xfb9e('0x15')]);return _0x59a978(_0x3f5103[_0xfb9e('0x13')][_0xfb9e('0x15')]);}else{logger[_0xfb9e('0x16')](_0xfb9e('0x10'),_0x48889e,_0xfb9e('0x17'));_0x59a978(_0x3f5103[_0xfb9e('0x18')][_0xfb9e('0x15')]);}})['catch'](function(_0x2d9b33){logger[_0xfb9e('0x13')](_0xfb9e('0x10'),_0x48889e,_0x2d9b33);_0x3ac817(_0x2d9b33);});});}exports[_0xfb9e('0x19')]=function(_0x2b0891){var _0x3f8070=this;return new Promise(function(_0x24bb05,_0x57d78){return db[_0xfb9e('0x1a')][_0xfb9e('0x1b')](_0x2b0891[_0xfb9e('0x1c')],{'raw':_0x2b0891[_0xfb9e('0x1d')]?_0x2b0891[_0xfb9e('0x1d')][_0xfb9e('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b0891[_0xfb9e('0x1d')]?_0x2b0891[_0xfb9e('0x1d')][_0xfb9e('0x1f')]||null:null,'attributes':_0x2b0891[_0xfb9e('0x1d')]?_0x2b0891[_0xfb9e('0x1d')][_0xfb9e('0x20')]||null:null,'limit':_0x2b0891['options']?_0x2b0891['options'][_0xfb9e('0x21')]||null:null})[_0xfb9e('0xf')](function(_0x56dd94){logger[_0xfb9e('0x16')](_0xfb9e('0x19'),_0x2b0891);logger[_0xfb9e('0x11')](_0xfb9e('0x19'),_0x2b0891,JSON[_0xfb9e('0x12')](_0x56dd94));_0x24bb05(_0x56dd94);})[_0xfb9e('0x22')](function(_0x2944bc){logger[_0xfb9e('0x13')]('UpdateSmsInteraction',_0x2944bc['message'],_0x2b0891);_0x57d78(_0x3f8070[_0xfb9e('0x13')](0x1f4,_0x2944bc[_0xfb9e('0x15')]));});});};exports['AddTagsToSmsInteraction']=function(_0x98130e){return new Promise(function(_0x1cdd0e,_0x46e9f2){return db[_0xfb9e('0x1a')][_0xfb9e('0x23')]({'where':_0x98130e[_0xfb9e('0x1d')]?_0x98130e['options'][_0xfb9e('0x1f')]||null:null})['then'](function(_0x210fae){if(_0x210fae){return _0x210fae[_0xfb9e('0x24')](_0x98130e['body'][_0xfb9e('0x25')],_[_0xfb9e('0x26')](_0x98130e[_0xfb9e('0x1c')],[_0xfb9e('0x25'),'id'])||{});}})[_0xfb9e('0x27')](function(_0x48a2f3){logger[_0xfb9e('0x16')](_0xfb9e('0x28'),_0x98130e);logger[_0xfb9e('0x11')](_0xfb9e('0x28'),_0x98130e,JSON[_0xfb9e('0x12')](_0x48a2f3));_0x1cdd0e(_0x48a2f3);})['catch'](function(_0x51b940){logger['error'](_0xfb9e('0x28'),_0x51b940[_0xfb9e('0x15')],_0x98130e);_0x46e9f2(_this[_0xfb9e('0x13')](0x1f4,_0x51b940[_0xfb9e('0x15')]));});});}; \ No newline at end of file +var _0x9e3f=['socket.io-emitter','./smsInteraction.socket','register','then','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsInteraction,\x20%s,\x20%s','message','info','result','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','limit','catch','AddTagsToSmsInteraction','addTags','ids','omit','body','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults'];(function(_0x3d4d53,_0x411775){var _0x1e1938=function(_0x32f09a){while(--_0x32f09a){_0x3d4d53['push'](_0x3d4d53['shift']());}};_0x1e1938(++_0x411775);}(_0x9e3f,0xc1));var _0xf9e3=function(_0x4a0d1d,_0x23ebaa){_0x4a0d1d=_0x4a0d1d-0x0;var _0xf40397=_0x9e3f[_0x4a0d1d];return _0xf40397;};'use strict';var _=require(_0xf9e3('0x0'));var util=require(_0xf9e3('0x1'));var moment=require('moment');var BPromise=require(_0xf9e3('0x2'));var rs=require(_0xf9e3('0x3'));var fs=require('fs');var Redis=require(_0xf9e3('0x4'));var db=require(_0xf9e3('0x5'))['db'];var utils=require(_0xf9e3('0x6'));var logger=require('../../config/logger')(_0xf9e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf9e3('0x8'));var client=jayson[_0xf9e3('0x9')]['http']({'port':0x232a});config[_0xf9e3('0xa')]=_[_0xf9e3('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xf9e3('0xc'))(new Redis(config['redis']));require(_0xf9e3('0xd'))[_0xf9e3('0xe')](socket);function respondWithRpcPromise(_0x3d8ce0,_0x87d05a,_0x9686e7){return new BPromise(function(_0x53c474,_0x322a1c){return client['request'](_0x3d8ce0,_0x9686e7)[_0xf9e3('0xf')](function(_0x450a51){logger['info']('SmsInteraction,\x20%s,\x20%s',_0x87d05a,_0xf9e3('0x10'));logger[_0xf9e3('0x11')](_0xf9e3('0x12'),_0x87d05a,_0xf9e3('0x10'),JSON[_0xf9e3('0x13')](_0x450a51));if(_0x450a51[_0xf9e3('0x14')]){if(_0x450a51[_0xf9e3('0x14')][_0xf9e3('0x15')]===0x1f4){logger[_0xf9e3('0x14')](_0xf9e3('0x16'),_0x87d05a,_0x450a51['error'][_0xf9e3('0x17')]);return _0x322a1c(_0x450a51[_0xf9e3('0x14')][_0xf9e3('0x17')]);}logger[_0xf9e3('0x14')](_0xf9e3('0x16'),_0x87d05a,_0x450a51[_0xf9e3('0x14')][_0xf9e3('0x17')]);return _0x53c474(_0x450a51['error']['message']);}else{logger[_0xf9e3('0x18')](_0xf9e3('0x16'),_0x87d05a,_0xf9e3('0x10'));_0x53c474(_0x450a51[_0xf9e3('0x19')][_0xf9e3('0x17')]);}})['catch'](function(_0x3808c){logger[_0xf9e3('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x87d05a,_0x3808c);_0x322a1c(_0x3808c);});});}exports[_0xf9e3('0x1a')]=function(_0x8787bd){var _0x4559ac=this;return new Promise(function(_0x598ff6,_0xa72905){return db[_0xf9e3('0x1b')][_0xf9e3('0x1c')](_0x8787bd['body'],{'raw':_0x8787bd[_0xf9e3('0x1d')]?_0x8787bd[_0xf9e3('0x1d')][_0xf9e3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x8787bd[_0xf9e3('0x1d')]?_0x8787bd[_0xf9e3('0x1d')][_0xf9e3('0x1f')]||null:null,'attributes':_0x8787bd[_0xf9e3('0x1d')]?_0x8787bd[_0xf9e3('0x1d')]['attributes']||null:null,'limit':_0x8787bd[_0xf9e3('0x1d')]?_0x8787bd[_0xf9e3('0x1d')][_0xf9e3('0x20')]||null:null})['then'](function(_0x165bae){logger[_0xf9e3('0x18')](_0xf9e3('0x1a'),_0x8787bd);logger[_0xf9e3('0x11')](_0xf9e3('0x1a'),_0x8787bd,JSON[_0xf9e3('0x13')](_0x165bae));_0x598ff6(_0x165bae);})[_0xf9e3('0x21')](function(_0x54dbfe){logger[_0xf9e3('0x14')]('UpdateSmsInteraction',_0x54dbfe[_0xf9e3('0x17')],_0x8787bd);_0xa72905(_0x4559ac[_0xf9e3('0x14')](0x1f4,_0x54dbfe[_0xf9e3('0x17')]));});});};exports[_0xf9e3('0x22')]=function(_0x36b00e){return new Promise(function(_0x5b7d16,_0x1b49d0){return db[_0xf9e3('0x1b')]['find']({'where':_0x36b00e['options']?_0x36b00e[_0xf9e3('0x1d')]['where']||null:null})[_0xf9e3('0xf')](function(_0xc6eae5){if(_0xc6eae5){return _0xc6eae5[_0xf9e3('0x23')](_0x36b00e['body'][_0xf9e3('0x24')],_[_0xf9e3('0x25')](_0x36b00e[_0xf9e3('0x26')],['ids','id'])||{});}})[_0xf9e3('0x27')](function(_0x39f9fc){logger['info'](_0xf9e3('0x28'),_0x36b00e);logger['debug'](_0xf9e3('0x28'),_0x36b00e,JSON['stringify'](_0x39f9fc));_0x5b7d16(_0x39f9fc);})[_0xf9e3('0x21')](function(_0xc1f6bb){logger[_0xf9e3('0x14')](_0xf9e3('0x28'),_0xc1f6bb['message'],_0x36b00e);_0x1b49d0(_this[_0xf9e3('0x14')](0x1f4,_0xc1f6bb[_0xf9e3('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 7cad0fc..12d0282 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 _0xaec9=['length','./smsInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xaec9,0x1b1));var _0x9aec=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xaec9[_0x210718];return _0x541bfc;};'use strict';var SmsInteractionEvents=require(_0x9aec('0x0'));var events=[_0x9aec('0x1'),_0x9aec('0x2'),_0x9aec('0x3')];function createListener(_0x5d9056,_0x232bd7){return function(_0x2e4d50){_0x232bd7[_0x9aec('0x4')](_0x5d9056,_0x2e4d50);};}function removeListener(_0x323491,_0x5b5d36){return function(){SmsInteractionEvents[_0x9aec('0x5')](_0x323491,_0x5b5d36);};}exports[_0x9aec('0x6')]=function(_0x31aa56){for(var _0x1bc122=0x0,_0x3e3ba2=events[_0x9aec('0x7')];_0x1bc122<_0x3e3ba2;_0x1bc122++){var _0x168c0b=events[_0x1bc122];var _0x58aabb=createListener('smsInteraction:'+_0x168c0b,_0x31aa56);SmsInteractionEvents['on'](_0x168c0b,_0x58aabb);}}; \ No newline at end of file +var _0x1907=['removeListener','length','smsInteraction:','./smsInteraction.events','emit'];(function(_0x31f994,_0x491d06){var _0x68f1e5=function(_0x5a44ea){while(--_0x5a44ea){_0x31f994['push'](_0x31f994['shift']());}};_0x68f1e5(++_0x491d06);}(_0x1907,0x152));var _0x7190=function(_0x52da06,_0x2d44c1){_0x52da06=_0x52da06-0x0;var _0x7b874c=_0x1907[_0x52da06];return _0x7b874c;};'use strict';var SmsInteractionEvents=require(_0x7190('0x0'));var events=['save','remove','update'];function createListener(_0x355d95,_0x2ee5d5){return function(_0x78e100){_0x2ee5d5[_0x7190('0x1')](_0x355d95,_0x78e100);};}function removeListener(_0x3265df,_0x406cd2){return function(){SmsInteractionEvents[_0x7190('0x2')](_0x3265df,_0x406cd2);};}exports['register']=function(_0x476298){for(var _0x58473f=0x0,_0x3b089a=events[_0x7190('0x3')];_0x58473f<_0x3b089a;_0x58473f++){var _0x11d332=events[_0x58473f];var _0xdcd34c=createListener(_0x7190('0x4')+_0x11d332,_0x476298);SmsInteractionEvents['on'](_0x11d332,_0xdcd34c);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 3a5aee0..7d5cecf 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 _0xa6ac=['accept','reject','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept'];(function(_0x1e10cd,_0x43b876){var _0x11769b=function(_0x2bfeb7){while(--_0x2bfeb7){_0x1e10cd['push'](_0x1e10cd['shift']());}};_0x11769b(++_0x43b876);}(_0xa6ac,0x1c5));var _0xca6a=function(_0xc700b5,_0x14d937){_0xc700b5=_0xc700b5-0x0;var _0x35ac84=_0xa6ac[_0xc700b5];return _0x35ac84;};'use strict';var multer=require('multer');var util=require(_0xca6a('0x0'));var path=require('path');var timeout=require(_0xca6a('0x1'));var express=require(_0xca6a('0x2'));var router=express[_0xca6a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xca6a('0x4'));var interaction=require(_0xca6a('0x5'));var config=require('../../config/environment');var controller=require(_0xca6a('0x6'));router[_0xca6a('0x7')]('/',auth[_0xca6a('0x8')](),controller[_0xca6a('0x9')]);router[_0xca6a('0x7')]('/describe',auth[_0xca6a('0x8')](),controller[_0xca6a('0xa')]);router[_0xca6a('0x7')](_0xca6a('0xb'),auth['isAuthenticated'](),controller[_0xca6a('0xc')]);router[_0xca6a('0xd')]('/',auth[_0xca6a('0x8')](),interaction[_0xca6a('0xe')](_0xca6a('0xf'),_0xca6a('0x10')),controller[_0xca6a('0x11')]);router['post'](_0xca6a('0x12'),controller[_0xca6a('0x13')]);router[_0xca6a('0x14')](_0xca6a('0xb'),auth['isAuthenticated'](),controller[_0xca6a('0x15')]);router[_0xca6a('0x14')](_0xca6a('0x16'),auth[_0xca6a('0x8')](),controller[_0xca6a('0x17')]);router[_0xca6a('0x14')]('/:id/reject',auth[_0xca6a('0x8')](),controller[_0xca6a('0x18')]);router[_0xca6a('0x19')](_0xca6a('0xb'),auth[_0xca6a('0x8')](),controller[_0xca6a('0x1a')]);module[_0xca6a('0x1b')]=router; \ No newline at end of file +var _0x710d=['exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','describe','/:id','isAuthenticated','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','destroy'];(function(_0x29abfb,_0x4e8a99){var _0x333c49=function(_0x51c0d9){while(--_0x51c0d9){_0x29abfb['push'](_0x29abfb['shift']());}};_0x333c49(++_0x4e8a99);}(_0x710d,0x91));var _0xd710=function(_0x26d6d9,_0x431cb8){_0x26d6d9=_0x26d6d9-0x0;var _0x1b4875=_0x710d[_0x26d6d9];return _0x1b4875;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd710('0x0'));var timeout=require(_0xd710('0x1'));var express=require('express');var router=express[_0xd710('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd710('0x3'));var config=require(_0xd710('0x4'));var controller=require(_0xd710('0x5'));router[_0xd710('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd710('0x6')]('/describe',auth['isAuthenticated'](),controller[_0xd710('0x7')]);router[_0xd710('0x6')](_0xd710('0x8'),auth[_0xd710('0x9')](),controller['show']);router[_0xd710('0xa')]('/',auth[_0xd710('0x9')](),interaction[_0xd710('0xb')](_0xd710('0xc'),_0xd710('0xd')),controller[_0xd710('0xe')]);router[_0xd710('0xa')](_0xd710('0xf'),controller[_0xd710('0x10')]);router['put'](_0xd710('0x8'),auth[_0xd710('0x9')](),controller['update']);router[_0xd710('0x11')](_0xd710('0x12'),auth[_0xd710('0x9')](),controller[_0xd710('0x13')]);router['put'](_0xd710('0x14'),auth[_0xd710('0x9')](),controller[_0xd710('0x15')]);router['delete']('/:id',auth[_0xd710('0x9')](),controller[_0xd710('0x16')]);module[_0xd710('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 9161fda..bb412a2 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 _0xae30=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x793465,_0x182d3a){var _0x54aaec=function(_0x2fd823){while(--_0x2fd823){_0x793465['push'](_0x793465['shift']());}};_0x54aaec(++_0x182d3a);}(_0xae30,0x10a));var _0x0ae3=function(_0x431344,_0x1840f8){_0x431344=_0x431344-0x0;var _0x3a6bf6=_0xae30[_0x431344];return _0x3a6bf6;};'use strict';var Sequelize=require(_0x0ae3('0x0'));module[_0x0ae3('0x1')]={'body':{'type':Sequelize[_0x0ae3('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0ae3('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ae3('0x4')]('in',_0x0ae3('0x5')),'defaultValue':_0x0ae3('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x0ae3('0x6')]},'readAt':{'type':Sequelize[_0x0ae3('0x7')]},'secret':{'type':Sequelize[_0x0ae3('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x0ae3('0x6')]},'providerResponse':{'type':Sequelize[_0x0ae3('0x2')]}}; \ No newline at end of file +var _0x7a43=['medium','BOOLEAN','ENUM','out','STRING','DATE','exports','TEXT'];(function(_0x1fd0b1,_0x32c965){var _0x400a14=function(_0x432153){while(--_0x432153){_0x1fd0b1['push'](_0x1fd0b1['shift']());}};_0x400a14(++_0x32c965);}(_0x7a43,0x13e));var _0x37a4=function(_0x50e35c,_0x42d788){_0x50e35c=_0x50e35c-0x0;var _0xc2e474=_0x7a43[_0x50e35c];return _0xc2e474;};'use strict';var Sequelize=require('sequelize');module[_0x37a4('0x0')]={'body':{'type':Sequelize[_0x37a4('0x1')](_0x37a4('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x37a4('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x37a4('0x4')]('in',_0x37a4('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x37a4('0x6')](0xbe)},'phone':{'type':Sequelize[_0x37a4('0x6')]},'readAt':{'type':Sequelize[_0x37a4('0x7')]},'secret':{'type':Sequelize[_0x37a4('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x37a4('0x6')]},'providerResponse':{'type':Sequelize[_0x37a4('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index c271031..568198d 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 _0x797f=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','./smsMessage.socket','register','client','http','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','SmsMessage','rawAttributes','fieldName','model','keys','query','intersection','fields','attributes','nolimit','order','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','params','length','find','create','body','describe','sms-interactions','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','contact','User','fullname','email','internal','manual','interface','channel','EventManager','acceptmessage','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','ContactId','SELECT','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','update','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x4200ab,_0x4ba61c){var _0x293f95=function(_0x5a737b){while(--_0x5a737b){_0x4200ab['push'](_0x4200ab['shift']());}};_0x293f95(++_0x4ba61c);}(_0x797f,0x7e));var _0xf797=function(_0x4f560a,_0x4fa8ec){_0x4f560a=_0x4f560a-0x0;var _0x449bba=_0x797f[_0x4f560a];return _0x449bba;};'use strict';var emlformat=require(_0xf797('0x0'));var rimraf=require(_0xf797('0x1'));var zipdir=require(_0xf797('0x2'));var jsonpatch=require(_0xf797('0x3'));var rp=require(_0xf797('0x4'));var moment=require(_0xf797('0x5'));var BPromise=require(_0xf797('0x6'));var Mustache=require(_0xf797('0x7'));var util=require(_0xf797('0x8'));var path=require(_0xf797('0x9'));var sox=require(_0xf797('0xa'));var csv=require(_0xf797('0xb'));var ejs=require(_0xf797('0xc'));var fs=require('fs');var fs_extra=require(_0xf797('0xd'));var _=require(_0xf797('0xe'));var squel=require(_0xf797('0xf'));var crypto=require(_0xf797('0x10'));var jsforce=require(_0xf797('0x11'));var deskjs=require(_0xf797('0x12'));var toCsv=require(_0xf797('0xb'));var querystring=require(_0xf797('0x13'));var Papa=require(_0xf797('0x14'));var Redis=require(_0xf797('0x15'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf797('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf797('0x17'))(_0xf797('0x18'));var utils=require('../../config/utils');var config=require(_0xf797('0x19'));var licenseUtil=require(_0xf797('0x1a'));var db=require('../../mysqldb')['db'];config[_0xf797('0x1b')]=_[_0xf797('0x1c')](config[_0xf797('0x1b')],{'host':_0xf797('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf797('0x1b')]));require(_0xf797('0x1e'))[_0xf797('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0xf797('0x20')][_0xf797('0x21')]({'port':0x232c});var client9002=jayson[_0xf797('0x20')][_0xf797('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x1be1b,_0x483136,_0x14cce0,_0x4fdb61){return new BPromise(function(_0x47bef0,_0x316d9c){var _0x3c7a3e=_0x4fdb61||client;return _0x3c7a3e['request'](_0x1be1b,_0x14cce0)['then'](function(_0x2a7f54){logger[_0xf797('0x22')]('SmsMessage,\x20%s,\x20%s',_0x483136,_0xf797('0x23'));logger[_0xf797('0x24')](_0xf797('0x25'),_0x483136,_0xf797('0x23'),JSON[_0xf797('0x26')](_0x2a7f54));if(_0x2a7f54[_0xf797('0x27')]){if(_0x2a7f54[_0xf797('0x27')]['code']===0x1f4){logger['error'](_0xf797('0x28'),_0x483136,_0x2a7f54['error'][_0xf797('0x29')]);return _0x316d9c(_0x2a7f54[_0xf797('0x27')][_0xf797('0x29')]);}logger[_0xf797('0x27')](_0xf797('0x28'),_0x483136,_0x2a7f54['error'][_0xf797('0x29')]);return _0x47bef0(_0x2a7f54[_0xf797('0x27')][_0xf797('0x29')]);}else{logger[_0xf797('0x22')](_0xf797('0x28'),_0x483136,_0xf797('0x23'));_0x47bef0(_0x2a7f54[_0xf797('0x2a')][_0xf797('0x29')]);}})[_0xf797('0x2b')](function(_0x184626){logger[_0xf797('0x27')](_0xf797('0x28'),_0x483136,_0x184626);_0x316d9c(_0x184626);});});}function respondWithStatusCode(_0x50e9af,_0x1064ab){_0x1064ab=_0x1064ab||0xcc;return function(_0x29df1c){if(_0x29df1c){return _0x50e9af[_0xf797('0x2c')](_0x1064ab);}return _0x50e9af[_0xf797('0x2d')](_0x1064ab)['end']();};}function respondWithResult(_0x418572,_0x2d9191){_0x2d9191=_0x2d9191||0xc8;return function(_0x4aa62c){if(_0x4aa62c){return _0x418572['status'](_0x2d9191)['json'](_0x4aa62c);}};}function respondWithFilteredResult(_0x1c1bc8,_0x50c4df){return function(_0x5c1d11){if(_0x5c1d11){var _0x454434=typeof _0x50c4df[_0xf797('0x2e')]===_0xf797('0x2f')&&typeof _0x50c4df[_0xf797('0x30')]===_0xf797('0x2f');var _0x2419a1=_0x5c1d11[_0xf797('0x31')];var _0xe62948=_0x454434?0x0:_0x50c4df[_0xf797('0x2e')];var _0x21a782=_0x454434?_0x5c1d11[_0xf797('0x31')]:_0x50c4df['offset']+_0x50c4df['limit'];var _0x2dfdba;if(_0x21a782>=_0x2419a1){_0x21a782=_0x2419a1;_0x2dfdba=0xc8;}else{_0x2dfdba=0xce;}_0x1c1bc8[_0xf797('0x2d')](_0x2dfdba);return _0x1c1bc8[_0xf797('0x32')](_0xf797('0x33'),_0xe62948+'-'+_0x21a782+'/'+_0x2419a1)['json'](_0x5c1d11);}return null;};}function patchUpdates(_0x44105f){return function(_0x505bb1){try{jsonpatch[_0xf797('0x34')](_0x505bb1,_0x44105f,!![]);}catch(_0x502641){return BPromise[_0xf797('0x35')](_0x502641);}return _0x505bb1[_0xf797('0x36')]();};}function saveUpdates(_0xc3f478,_0x5bfa52){return function(_0x450181){if(_0x450181){return _0x450181['update'](_0xc3f478)[_0xf797('0x37')](function(_0x2198d9){return _0x2198d9;});}return null;};}function removeEntity(_0x278aa6,_0x2c5415){return function(_0x1bc8ec){if(_0x1bc8ec){return _0x1bc8ec[_0xf797('0x38')]()['then'](function(){_0x278aa6[_0xf797('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5660ad,_0x4c349f){return function(_0x163e2a){if(!_0x163e2a){_0x5660ad[_0xf797('0x2c')](0x194);}return _0x163e2a;};}function handleError(_0x480bb7,_0x49294a){_0x49294a=_0x49294a||0x1f4;return function(_0x127180){logger[_0xf797('0x27')](_0x127180['stack']);if(_0x127180[_0xf797('0x39')]){delete _0x127180[_0xf797('0x39')];}_0x480bb7[_0xf797('0x2d')](_0x49294a)['send'](_0x127180);};}exports[_0xf797('0x3a')]=function(_0x2c74d1,_0x27766d){var _0x1b7a56={},_0x531302={},_0x57ee33={'count':0x0,'rows':[]};var _0x2ebb61=_[_0xf797('0x3b')](db[_0xf797('0x3c')][_0xf797('0x3d')],function(_0x57aa8d){return{'name':_0x57aa8d[_0xf797('0x3e')],'type':_0x57aa8d['type']['key']};});_0x531302[_0xf797('0x3f')]=_['map'](_0x2ebb61,_0xf797('0x39'));_0x531302['query']=_[_0xf797('0x40')](_0x2c74d1[_0xf797('0x41')]);_0x531302['filters']=_['intersection'](_0x531302['model'],_0x531302[_0xf797('0x41')]);_0x1b7a56['attributes']=_[_0xf797('0x42')](_0x531302[_0xf797('0x3f')],qs[_0xf797('0x43')](_0x2c74d1[_0xf797('0x41')][_0xf797('0x43')]));_0x1b7a56[_0xf797('0x44')]=_0x1b7a56[_0xf797('0x44')]['length']?_0x1b7a56[_0xf797('0x44')]:_0x531302[_0xf797('0x3f')];if(!_0x2c74d1[_0xf797('0x41')]['hasOwnProperty'](_0xf797('0x45'))){_0x1b7a56['limit']=qs[_0xf797('0x30')](_0x2c74d1[_0xf797('0x41')][_0xf797('0x30')]);_0x1b7a56['offset']=qs[_0xf797('0x2e')](_0x2c74d1[_0xf797('0x41')][_0xf797('0x2e')]);}_0x1b7a56[_0xf797('0x46')]=qs[_0xf797('0x47')](_0x2c74d1['query']['sort']);_0x1b7a56[_0xf797('0x48')]=qs[_0xf797('0x49')](_['pick'](_0x2c74d1[_0xf797('0x41')],_0x531302['filters']),_0x2ebb61);if(_0x2c74d1[_0xf797('0x41')][_0xf797('0x4a')]){_0x1b7a56[_0xf797('0x48')]=_[_0xf797('0x4b')](_0x1b7a56['where'],{'$or':_[_0xf797('0x3b')](_0x2ebb61,function(_0x1d9168){if(_0x1d9168[_0xf797('0x4c')]!=='VIRTUAL'){var _0x36cf06={};_0x36cf06[_0x1d9168['name']]={'$like':'%'+_0x2c74d1[_0xf797('0x41')][_0xf797('0x4a')]+'%'};return _0x36cf06;}})});}_0x1b7a56=_[_0xf797('0x4b')]({},_0x1b7a56,_0x2c74d1[_0xf797('0x4d')]);var _0x58aa07={'where':_0x1b7a56[_0xf797('0x48')]};return db[_0xf797('0x3c')]['count'](_0x58aa07)[_0xf797('0x37')](function(_0x30990d){_0x57ee33[_0xf797('0x31')]=_0x30990d;if(_0x2c74d1[_0xf797('0x41')][_0xf797('0x4e')]){_0x1b7a56[_0xf797('0x4f')]=[{'all':!![]}];}return db[_0xf797('0x3c')][_0xf797('0x50')](_0x1b7a56);})[_0xf797('0x37')](function(_0x36e0c9){_0x57ee33[_0xf797('0x51')]=_0x36e0c9;return _0x57ee33;})[_0xf797('0x37')](respondWithFilteredResult(_0x27766d,_0x1b7a56))[_0xf797('0x2b')](handleError(_0x27766d,null));};exports['show']=function(_0x54c1c4,_0x407a46){var _0x1c7b54={'raw':!![],'where':{'id':_0x54c1c4[_0xf797('0x52')]['id']}},_0x4955ed={};_0x4955ed[_0xf797('0x3f')]=_[_0xf797('0x40')](db['SmsMessage'][_0xf797('0x3d')]);_0x4955ed['query']=_[_0xf797('0x40')](_0x54c1c4[_0xf797('0x41')]);_0x4955ed['filters']=_[_0xf797('0x42')](_0x4955ed['model'],_0x4955ed[_0xf797('0x41')]);_0x1c7b54['attributes']=_[_0xf797('0x42')](_0x4955ed['model'],qs[_0xf797('0x43')](_0x54c1c4['query'][_0xf797('0x43')]));_0x1c7b54['attributes']=_0x1c7b54['attributes'][_0xf797('0x53')]?_0x1c7b54['attributes']:_0x4955ed['model'];if(_0x54c1c4[_0xf797('0x41')]['includeAll']){_0x1c7b54[_0xf797('0x4f')]=[{'all':!![]}];}_0x1c7b54=_['merge']({},_0x1c7b54,_0x54c1c4['options']);return db['SmsMessage'][_0xf797('0x54')](_0x1c7b54)['then'](handleEntityNotFound(_0x407a46,null))['then'](respondWithResult(_0x407a46,null))[_0xf797('0x2b')](handleError(_0x407a46,null));};exports[_0xf797('0x55')]=function(_0x101907,_0x5a9d48){return db[_0xf797('0x3c')][_0xf797('0x55')](_0x101907[_0xf797('0x56')],{})[_0xf797('0x37')](respondWithResult(_0x5a9d48,0xc9))['catch'](handleError(_0x5a9d48,null));};exports['update']=function(_0x478312,_0x1a6558){if(_0x478312[_0xf797('0x56')]['id']){delete _0x478312[_0xf797('0x56')]['id'];}return db['SmsMessage']['find']({'where':{'id':_0x478312['params']['id']}})[_0xf797('0x37')](handleEntityNotFound(_0x1a6558,null))[_0xf797('0x37')](saveUpdates(_0x478312['body'],null))[_0xf797('0x37')](respondWithResult(_0x1a6558,null))['catch'](handleError(_0x1a6558,null));};exports[_0xf797('0x38')]=function(_0x556565,_0xea32e4){return db[_0xf797('0x3c')]['find']({'where':{'id':_0x556565[_0xf797('0x52')]['id']}})[_0xf797('0x37')](handleEntityNotFound(_0xea32e4,null))[_0xf797('0x37')](removeEntity(_0xea32e4,null))[_0xf797('0x2b')](handleError(_0xea32e4,null));};exports[_0xf797('0x57')]=function(_0x940232,_0x43d8ac){return db[_0xf797('0x3c')][_0xf797('0x57')]()['then'](respondWithResult(_0x43d8ac,null))['catch'](handleError(_0x43d8ac,null));};var interaction_log=require(_0xf797('0x17'))(_0xf797('0x58'));exports['accept']=function(_0x4d29de,_0x453b0b,_0x2caf79){var _0x44668d={'agent':{},'channel':_0xf797('0x59')};if(_0x4d29de[_0xf797('0x56')]['id']){delete _0x4d29de[_0xf797('0x56')]['id'];}_0x4d29de[_0xf797('0x56')][_0xf797('0x5a')]=!![];_0x4d29de[_0xf797('0x56')][_0xf797('0x5b')]=moment()['format'](_0xf797('0x5c'));_0x4d29de['body'][_0xf797('0x5d')]=_0x4d29de['body'][_0xf797('0x5d')]||_0x4d29de[_0xf797('0x5e')]['id'];_0x44668d[_0xf797('0x5f')]['id']=_0x4d29de[_0xf797('0x56')][_0xf797('0x5d')];return db[_0xf797('0x3c')][_0xf797('0x54')]({'where':{'id':_0x4d29de['params']['id'],'UserId':null}})[_0xf797('0x37')](handleEntityNotFound(_0x453b0b,null))['then'](saveUpdates(_0x4d29de['body'],null))[_0xf797('0x37')](function(_0x3a5025){if(_0x3a5025){_0x44668d[_0xf797('0x29')]=_0x3a5025[_0xf797('0x60')]({'plain':!![]});return db['SmsInteraction'][_0xf797('0x54')]({'where':{'id':_0x3a5025[_0xf797('0x61')]}});}return null;})[_0xf797('0x37')](handleEntityNotFound(_0x453b0b,null))[_0xf797('0x37')](function(_0x339fdb){if(_0x339fdb){return _0x339fdb['update']({'UserId':_0x4d29de[_0xf797('0x56')][_0xf797('0x5d')],'read1stAt':_[_0xf797('0x62')](_0x339fdb[_0xf797('0x63')])?moment()[_0xf797('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x75a9f0){if(_0x75a9f0){_0x44668d[_0xf797('0x65')]=_0x75a9f0['get']({'plain':!![]});interaction_log['info'](_0xf797('0x66'),_0x4d29de['user']['id'],_0x4d29de[_0xf797('0x5e')][_0xf797('0x39')],_0x4d29de[_0xf797('0x5e')]['role'],_0x44668d[_0xf797('0x65')]['id'],_0x4d29de['body']?JSON[_0xf797('0x26')](_0x4d29de[_0xf797('0x56')]):_0xf797('0x67'));return respondWithRpcPromise(_0xf797('0x68'),_0xf797('0x69'),_0x44668d);}return null;})[_0xf797('0x37')](function(_0x1bb7ff){var _0xb681cf=_0xf797('0x6a')+_0x1bb7ff[_0xf797('0x29')]['ContactId'];return db[_0xf797('0x6b')]['query'](_0xb681cf,{'type':db[_0xf797('0x6c')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x2d4153){return _0x2d4153;});})[_0xf797('0x37')](function(_0xb6ca37){if(_0xb6ca37){_0x44668d[_0xf797('0x29')][_0xf797('0x6d')]=_0xb6ca37[0x0];if(!_0x4d29de[_0xf797('0x56')][_0xf797('0x5d')])return;return db[_0xf797('0x6e')]['find']({'where':{'id':_0x4d29de['body'][_0xf797('0x5d')],'role':_0xf797('0x5f')},'attributes':['id',_0xf797('0x39'),_0xf797('0x6f'),_0xf797('0x70'),_0xf797('0x71')],'raw':!![]});}return null;})['then'](function(_0xdf7837){if(!_0xdf7837)return null;_0x44668d[_0xf797('0x29')][_0xf797('0x5f')]=_0xdf7837;return _0x44668d;})[_0xf797('0x37')](function(_0x49470d){if(_0x49470d){if(_0x4d29de[_0xf797('0x56')][_0xf797('0x72')]){_0x44668d[_0xf797('0x29')][_0xf797('0x73')]=util[_0xf797('0x64')]('SIP/%s',_0x4d29de[_0xf797('0x5e')][_0xf797('0x39')]);_0x44668d[_0xf797('0x29')][_0xf797('0x74')]=_0x44668d[_0xf797('0x74')];_0x44668d[_0xf797('0x29')]['event']='accept';return respondWithRpcPromise(_0xf797('0x75'),_0xf797('0x75'),{'event':_0xf797('0x76'),'message':_0x44668d[_0xf797('0x29')]},client9002)[_0xf797('0x37')](function(){return _0x44668d;});}return _0x44668d;}return null;})[_0xf797('0x37')](respondWithResult(_0x453b0b,null))[_0xf797('0x2b')](handleError(_0x453b0b,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0xf797('0x35')]=function(_0x193346,_0x816c38,_0x16424b){var _0x47d122={'agent':{},'channel':_0xf797('0x59')};if(_0x193346[_0xf797('0x56')]['id']){delete _0x193346[_0xf797('0x56')]['id'];}_0x193346[_0xf797('0x56')][_0xf797('0x5d')]=_0x193346['body'][_0xf797('0x5d')]||_0x193346['user']['id'];_0x47d122[_0xf797('0x5f')]['id']=_0x193346[_0xf797('0x56')][_0xf797('0x5d')];return db[_0xf797('0x3c')][_0xf797('0x54')]({'where':{'id':_0x193346[_0xf797('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x816c38,null))[_0xf797('0x37')](function(_0x101690){if(_0x101690){_0x47d122[_0xf797('0x29')]=_0x101690[_0xf797('0x60')]({'plain':!![]});return db[_0xf797('0x77')][_0xf797('0x54')]({'where':{'id':_0x101690[_0xf797('0x61')]}});}return null;})[_0xf797('0x37')](handleEntityNotFound(_0x816c38,null))[_0xf797('0x37')](function(_0x52d0b9){if(_0x52d0b9){_0x47d122[_0xf797('0x65')]=_0x52d0b9[_0xf797('0x60')]({'plain':!![]});interaction_log[_0xf797('0x22')](_0xf797('0x78'),_0x193346[_0xf797('0x5e')]['id'],_0x193346[_0xf797('0x5e')]['name'],_0x193346[_0xf797('0x5e')][_0xf797('0x79')],_0x47d122[_0xf797('0x65')]['id'],_0x193346[_0xf797('0x56')]?JSON['stringify'](_0x193346['body']):'null');return respondWithRpcPromise('RejectMessage',_0xf797('0x7a'),_0x47d122);}return null;})[_0xf797('0x37')](function(_0x39ff55){var _0x2e3e96='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x39ff55[_0xf797('0x29')][_0xf797('0x7b')];return db[_0xf797('0x6b')][_0xf797('0x41')](_0x2e3e96,{'type':db[_0xf797('0x6c')]['QueryTypes'][_0xf797('0x7c')],'raw':!![]})[_0xf797('0x37')](function(_0xf37862){return _0xf37862;});})['then'](function(_0x38f654){if(_0x38f654){_0x47d122[_0xf797('0x29')][_0xf797('0x6d')]=_0x38f654[0x0];if(!_0x193346[_0xf797('0x56')][_0xf797('0x5d')])return;return db[_0xf797('0x6e')]['find']({'where':{'id':_0x193346[_0xf797('0x56')][_0xf797('0x5d')],'role':_0xf797('0x5f')},'attributes':['id',_0xf797('0x39'),_0xf797('0x6f'),_0xf797('0x70'),_0xf797('0x71')],'raw':!![]});}return null;})[_0xf797('0x37')](function(_0xec490e){if(!_0xec490e)return null;_0x47d122[_0xf797('0x29')][_0xf797('0x5f')]=_0xec490e;return _0x47d122;})[_0xf797('0x37')](function(_0x163ded){if(_0x163ded){_0x163ded[_0xf797('0x29')][_0xf797('0x73')]=util['format'](_0xf797('0x7d'),_0x193346[_0xf797('0x5e')][_0xf797('0x39')]);_0x163ded[_0xf797('0x29')][_0xf797('0x74')]=_0x47d122[_0xf797('0x74')];_0x163ded['message']['event']=_0xf797('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':_0xf797('0x7e'),'message':_0x163ded['message']},client9002);return _0x47d122;}return null;})[_0xf797('0x37')](respondWithResult(_0x816c38,null))[_0xf797('0x2b')](handleError(_0x816c38,null));};exports[_0xf797('0x2d')]=function(_0x19797a,_0x1a3b81,_0x36b606){if(_0x19797a['body']['id']){delete _0x19797a['body']['id'];}var _0x148104;return db['SmsMessage'][_0xf797('0x54')]({'where':{'id':_0x19797a[_0xf797('0x52')]['id']}})[_0xf797('0x37')](handleEntityNotFound(_0x1a3b81,null))[_0xf797('0x37')](function(_0x1720a7){if(_0x1720a7){_0x148104=_0x1720a7;return db[_0xf797('0x7f')][_0xf797('0x54')]({'where':{'id':_0x1720a7[_0xf797('0x80')]}});}})[_0xf797('0x37')](handleEntityNotFound(_0x1a3b81,null))[_0xf797('0x37')](function(_0x39fdff){if(_0x39fdff){logger['debug'](_0xf797('0x25'),_0xf797('0x2d'),_0xf797('0x81'),_0x39fdff[_0xf797('0x4c')],util[_0xf797('0x82')](_0x19797a['body'],{'showHidden':![],'depth':null}));switch(_0x39fdff['type']){case _0xf797('0x83'):if(_0x19797a[_0xf797('0x56')]['MessageSid']&&_0x19797a[_0xf797('0x56')][_0xf797('0x84')]===_0x148104[_0xf797('0x85')]){return _0x148104[_0xf797('0x86')]({'read':!![]});}else{logger[_0xf797('0x27')](_0xf797('0x87'),_0xf797('0x2d'),_0xf797('0x83'),util[_0xf797('0x82')](_0x19797a[_0xf797('0x56')],{'showHidden':![],'depth':null}));}break;case _0xf797('0x88'):if(_0x19797a[_0xf797('0x56')][_0xf797('0x89')]&&_0x19797a['body'][_0xf797('0x89')]===_0x148104['messageId']&&_[_0xf797('0x8a')]([_0xf797('0x8b'),_0xf797('0x8c')],_0x19797a[_0xf797('0x56')]['Status'])>=0x0){return _0x148104[_0xf797('0x86')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf797('0x2d'),_0xf797('0x8d'),util['inspect'](_0x19797a[_0xf797('0x56')],{'showHidden':![],'depth':null}));}break;case _0xf797('0x8e'):var _0x573f49=_0x19797a[_0xf797('0x56')][_0xf797('0x8f')][0x0];if(_0x573f49['status'][_0xf797('0x90')]===_0xf797('0x91')){return _0x148104[_0xf797('0x86')]({'read':!![]});}else{logger[_0xf797('0x27')](_0xf797('0x87'),'status',_0xf797('0x8e'),util[_0xf797('0x82')](_0x19797a['body'],{'showHidden':![],'depth':null}));}break;}return _0x148104;}})[_0xf797('0x37')](respondWithResult(_0x1a3b81,null))[_0xf797('0x2b')](handleError(_0x1a3b81,null));}; \ No newline at end of file +var _0x46b5=['mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','stack','name','index','map','SmsMessage','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','show','params','rawAttributes','includeAll','find','create','body','describe','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','agent','UserId','get','SmsInteraction','isNil','read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','email','internal','interface','SIP/%s','channel','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','QueryTypes','event','rejectmessage','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x3a088f,_0x22dcdb){var _0x3a6d55=function(_0x563ca9){while(--_0x563ca9){_0x3a088f['push'](_0x3a088f['shift']());}};_0x3a6d55(++_0x22dcdb);}(_0x46b5,0x121));var _0x546b=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x46b5[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x546b('0x0'));var zipdir=require(_0x546b('0x1'));var jsonpatch=require(_0x546b('0x2'));var rp=require(_0x546b('0x3'));var moment=require(_0x546b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x546b('0x5'));var util=require(_0x546b('0x6'));var path=require(_0x546b('0x7'));var sox=require('sox');var csv=require(_0x546b('0x8'));var ejs=require(_0x546b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x546b('0xa'));var squel=require('squel');var crypto=require(_0x546b('0xb'));var jsforce=require(_0x546b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x546b('0x8'));var querystring=require(_0x546b('0xd'));var Papa=require(_0x546b('0xe'));var Redis=require(_0x546b('0xf'));var authService=require(_0x546b('0x10'));var qs=require(_0x546b('0x11'));var as=require(_0x546b('0x12'));var hardwareService=require(_0x546b('0x13'));var logger=require(_0x546b('0x14'))(_0x546b('0x15'));var utils=require(_0x546b('0x16'));var config=require(_0x546b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x546b('0x18'))['db'];config[_0x546b('0x19')]=_[_0x546b('0x1a')](config[_0x546b('0x19')],{'host':_0x546b('0x1b'),'port':0x18eb});var socket=require(_0x546b('0x1c'))(new Redis(config[_0x546b('0x19')]));require('./smsMessage.socket')[_0x546b('0x1d')](socket);var jayson=require(_0x546b('0x1e'));var client=jayson['client'][_0x546b('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x546b('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x550cdf,_0x3d0a3e,_0x30e137,_0x15747d){return new BPromise(function(_0x2e72d5,_0x184905){var _0x3e7bcf=_0x15747d||client;return _0x3e7bcf[_0x546b('0x20')](_0x550cdf,_0x30e137)[_0x546b('0x21')](function(_0xd3a405){logger[_0x546b('0x22')]('SmsMessage,\x20%s,\x20%s',_0x3d0a3e,_0x546b('0x23'));logger[_0x546b('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x3d0a3e,'request\x20sent',JSON[_0x546b('0x25')](_0xd3a405));if(_0xd3a405[_0x546b('0x26')]){if(_0xd3a405[_0x546b('0x26')][_0x546b('0x27')]===0x1f4){logger[_0x546b('0x26')](_0x546b('0x28'),_0x3d0a3e,_0xd3a405[_0x546b('0x26')]['message']);return _0x184905(_0xd3a405[_0x546b('0x26')][_0x546b('0x29')]);}logger[_0x546b('0x26')](_0x546b('0x28'),_0x3d0a3e,_0xd3a405['error'][_0x546b('0x29')]);return _0x2e72d5(_0xd3a405[_0x546b('0x26')][_0x546b('0x29')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x3d0a3e,_0x546b('0x23'));_0x2e72d5(_0xd3a405['result']['message']);}})[_0x546b('0x2a')](function(_0x1e245c){logger['error'](_0x546b('0x28'),_0x3d0a3e,_0x1e245c);_0x184905(_0x1e245c);});});}function respondWithStatusCode(_0x43b4d3,_0x52f750){_0x52f750=_0x52f750||0xcc;return function(_0x909c0c){if(_0x909c0c){return _0x43b4d3[_0x546b('0x2b')](_0x52f750);}return _0x43b4d3[_0x546b('0x2c')](_0x52f750)[_0x546b('0x2d')]();};}function respondWithResult(_0x1bfdb1,_0x441cd7){_0x441cd7=_0x441cd7||0xc8;return function(_0x3e6515){if(_0x3e6515){return _0x1bfdb1[_0x546b('0x2c')](_0x441cd7)['json'](_0x3e6515);}};}function respondWithFilteredResult(_0x2f6c32,_0x1db169){return function(_0x28629c){if(_0x28629c){var _0x2f0019=typeof _0x1db169['offset']===_0x546b('0x2e')&&typeof _0x1db169[_0x546b('0x2f')]===_0x546b('0x2e');var _0x4e23dd=_0x28629c[_0x546b('0x30')];var _0x140979=_0x2f0019?0x0:_0x1db169[_0x546b('0x31')];var _0x5db30e=_0x2f0019?_0x28629c['count']:_0x1db169[_0x546b('0x31')]+_0x1db169[_0x546b('0x2f')];var _0x228309;if(_0x5db30e>=_0x4e23dd){_0x5db30e=_0x4e23dd;_0x228309=0xc8;}else{_0x228309=0xce;}_0x2f6c32[_0x546b('0x2c')](_0x228309);return _0x2f6c32['set'](_0x546b('0x32'),_0x140979+'-'+_0x5db30e+'/'+_0x4e23dd)[_0x546b('0x33')](_0x28629c);}return null;};}function patchUpdates(_0x1468a){return function(_0x496567){try{jsonpatch[_0x546b('0x34')](_0x496567,_0x1468a,!![]);}catch(_0x44f991){return BPromise[_0x546b('0x35')](_0x44f991);}return _0x496567[_0x546b('0x36')]();};}function saveUpdates(_0x1a36dd,_0x384cf4){return function(_0x11454b){if(_0x11454b){return _0x11454b[_0x546b('0x37')](_0x1a36dd)[_0x546b('0x21')](function(_0x4b3ec6){return _0x4b3ec6;});}return null;};}function removeEntity(_0x3cbe77,_0x5b1527){return function(_0x2c9c39){if(_0x2c9c39){return _0x2c9c39[_0x546b('0x38')]()[_0x546b('0x21')](function(){_0x3cbe77[_0x546b('0x2c')](0xcc)[_0x546b('0x2d')]();});}};}function handleEntityNotFound(_0x36815e,_0x44ae83){return function(_0x544f1e){if(!_0x544f1e){_0x36815e[_0x546b('0x2b')](0x194);}return _0x544f1e;};}function handleError(_0x5cbb29,_0x321e30){_0x321e30=_0x321e30||0x1f4;return function(_0x442b85){logger[_0x546b('0x26')](_0x442b85[_0x546b('0x39')]);if(_0x442b85[_0x546b('0x3a')]){delete _0x442b85[_0x546b('0x3a')];}_0x5cbb29[_0x546b('0x2c')](_0x321e30)['send'](_0x442b85);};}exports[_0x546b('0x3b')]=function(_0x3d338c,_0x5a70b9){var _0x77b365={},_0x237731={},_0x26738e={'count':0x0,'rows':[]};var _0x2f6b5b=_[_0x546b('0x3c')](db[_0x546b('0x3d')]['rawAttributes'],function(_0x14ccfd){return{'name':_0x14ccfd[_0x546b('0x3e')],'type':_0x14ccfd[_0x546b('0x3f')][_0x546b('0x40')]};});_0x237731[_0x546b('0x41')]=_['map'](_0x2f6b5b,_0x546b('0x3a'));_0x237731[_0x546b('0x42')]=_[_0x546b('0x43')](_0x3d338c[_0x546b('0x42')]);_0x237731[_0x546b('0x44')]=_['intersection'](_0x237731['model'],_0x237731[_0x546b('0x42')]);_0x77b365['attributes']=_[_0x546b('0x45')](_0x237731[_0x546b('0x41')],qs[_0x546b('0x46')](_0x3d338c[_0x546b('0x42')][_0x546b('0x46')]));_0x77b365[_0x546b('0x47')]=_0x77b365['attributes'][_0x546b('0x48')]?_0x77b365[_0x546b('0x47')]:_0x237731['model'];if(!_0x3d338c[_0x546b('0x42')]['hasOwnProperty']('nolimit')){_0x77b365[_0x546b('0x2f')]=qs[_0x546b('0x2f')](_0x3d338c[_0x546b('0x42')]['limit']);_0x77b365[_0x546b('0x31')]=qs[_0x546b('0x31')](_0x3d338c['query'][_0x546b('0x31')]);}_0x77b365[_0x546b('0x49')]=qs[_0x546b('0x4a')](_0x3d338c[_0x546b('0x42')][_0x546b('0x4a')]);_0x77b365[_0x546b('0x4b')]=qs[_0x546b('0x44')](_[_0x546b('0x4c')](_0x3d338c['query'],_0x237731[_0x546b('0x44')]),_0x2f6b5b);if(_0x3d338c[_0x546b('0x42')]['filter']){_0x77b365[_0x546b('0x4b')]=_[_0x546b('0x4d')](_0x77b365['where'],{'$or':_['map'](_0x2f6b5b,function(_0x4de5a5){if(_0x4de5a5['type']!==_0x546b('0x4e')){var _0x448272={};_0x448272[_0x4de5a5['name']]={'$like':'%'+_0x3d338c[_0x546b('0x42')][_0x546b('0x4f')]+'%'};return _0x448272;}})});}_0x77b365=_[_0x546b('0x4d')]({},_0x77b365,_0x3d338c[_0x546b('0x50')]);var _0xa0200a={'where':_0x77b365[_0x546b('0x4b')]};return db['SmsMessage']['count'](_0xa0200a)[_0x546b('0x21')](function(_0x430230){_0x26738e[_0x546b('0x30')]=_0x430230;if(_0x3d338c[_0x546b('0x42')]['includeAll']){_0x77b365[_0x546b('0x51')]=[{'all':!![]}];}return db[_0x546b('0x3d')]['findAll'](_0x77b365);})[_0x546b('0x21')](function(_0x2c0c7e){_0x26738e[_0x546b('0x52')]=_0x2c0c7e;return _0x26738e;})[_0x546b('0x21')](respondWithFilteredResult(_0x5a70b9,_0x77b365))[_0x546b('0x2a')](handleError(_0x5a70b9,null));};exports[_0x546b('0x53')]=function(_0x1b009b,_0x184b9a){var _0x555db6={'raw':!![],'where':{'id':_0x1b009b[_0x546b('0x54')]['id']}},_0x37056e={};_0x37056e[_0x546b('0x41')]=_[_0x546b('0x43')](db['SmsMessage'][_0x546b('0x55')]);_0x37056e['query']=_[_0x546b('0x43')](_0x1b009b[_0x546b('0x42')]);_0x37056e[_0x546b('0x44')]=_[_0x546b('0x45')](_0x37056e[_0x546b('0x41')],_0x37056e['query']);_0x555db6[_0x546b('0x47')]=_['intersection'](_0x37056e[_0x546b('0x41')],qs[_0x546b('0x46')](_0x1b009b[_0x546b('0x42')][_0x546b('0x46')]));_0x555db6['attributes']=_0x555db6[_0x546b('0x47')][_0x546b('0x48')]?_0x555db6[_0x546b('0x47')]:_0x37056e[_0x546b('0x41')];if(_0x1b009b[_0x546b('0x42')][_0x546b('0x56')]){_0x555db6[_0x546b('0x51')]=[{'all':!![]}];}_0x555db6=_[_0x546b('0x4d')]({},_0x555db6,_0x1b009b['options']);return db['SmsMessage'][_0x546b('0x57')](_0x555db6)[_0x546b('0x21')](handleEntityNotFound(_0x184b9a,null))[_0x546b('0x21')](respondWithResult(_0x184b9a,null))[_0x546b('0x2a')](handleError(_0x184b9a,null));};exports[_0x546b('0x58')]=function(_0x3b2a3d,_0x4942ae){return db['SmsMessage']['create'](_0x3b2a3d[_0x546b('0x59')],{})[_0x546b('0x21')](respondWithResult(_0x4942ae,0xc9))[_0x546b('0x2a')](handleError(_0x4942ae,null));};exports[_0x546b('0x37')]=function(_0x283bd1,_0x1dce1f){if(_0x283bd1['body']['id']){delete _0x283bd1[_0x546b('0x59')]['id'];}return db[_0x546b('0x3d')][_0x546b('0x57')]({'where':{'id':_0x283bd1['params']['id']}})[_0x546b('0x21')](handleEntityNotFound(_0x1dce1f,null))[_0x546b('0x21')](saveUpdates(_0x283bd1[_0x546b('0x59')],null))[_0x546b('0x21')](respondWithResult(_0x1dce1f,null))[_0x546b('0x2a')](handleError(_0x1dce1f,null));};exports[_0x546b('0x38')]=function(_0x52508f,_0x3f7864){return db[_0x546b('0x3d')]['find']({'where':{'id':_0x52508f[_0x546b('0x54')]['id']}})[_0x546b('0x21')](handleEntityNotFound(_0x3f7864,null))[_0x546b('0x21')](removeEntity(_0x3f7864,null))[_0x546b('0x2a')](handleError(_0x3f7864,null));};exports[_0x546b('0x5a')]=function(_0x1dfd16,_0x215c9e){return db['SmsMessage'][_0x546b('0x5a')]()[_0x546b('0x21')](respondWithResult(_0x215c9e,null))[_0x546b('0x2a')](handleError(_0x215c9e,null));};var interaction_log=require('../../config/logger')(_0x546b('0x5b'));exports[_0x546b('0x5c')]=function(_0x2e39b5,_0x5b3df8,_0xa1cd24){var _0x1f56a3={'agent':{},'channel':_0x546b('0x5d')};if(_0x2e39b5[_0x546b('0x59')]['id']){delete _0x2e39b5['body']['id'];}_0x2e39b5[_0x546b('0x59')]['read']=!![];_0x2e39b5[_0x546b('0x59')][_0x546b('0x5e')]=moment()[_0x546b('0x5f')](_0x546b('0x60'));_0x2e39b5['body']['UserId']=_0x2e39b5[_0x546b('0x59')]['UserId']||_0x2e39b5[_0x546b('0x61')]['id'];_0x1f56a3[_0x546b('0x62')]['id']=_0x2e39b5[_0x546b('0x59')][_0x546b('0x63')];return db['SmsMessage'][_0x546b('0x57')]({'where':{'id':_0x2e39b5[_0x546b('0x54')]['id'],'UserId':null}})[_0x546b('0x21')](handleEntityNotFound(_0x5b3df8,null))['then'](saveUpdates(_0x2e39b5[_0x546b('0x59')],null))['then'](function(_0x2b2d04){if(_0x2b2d04){_0x1f56a3[_0x546b('0x29')]=_0x2b2d04[_0x546b('0x64')]({'plain':!![]});return db[_0x546b('0x65')][_0x546b('0x57')]({'where':{'id':_0x2b2d04['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x5b3df8,null))[_0x546b('0x21')](function(_0x33e34a){if(_0x33e34a){return _0x33e34a[_0x546b('0x37')]({'UserId':_0x2e39b5[_0x546b('0x59')][_0x546b('0x63')],'read1stAt':_[_0x546b('0x66')](_0x33e34a[_0x546b('0x67')])?moment()[_0x546b('0x5f')](_0x546b('0x60')):undefined});}return null;})[_0x546b('0x21')](function(_0x172068){if(_0x172068){_0x1f56a3['interaction']=_0x172068[_0x546b('0x64')]({'plain':!![]});interaction_log[_0x546b('0x22')](_0x546b('0x68'),_0x2e39b5[_0x546b('0x61')]['id'],_0x2e39b5[_0x546b('0x61')][_0x546b('0x3a')],_0x2e39b5[_0x546b('0x61')][_0x546b('0x69')],_0x1f56a3[_0x546b('0x6a')]['id'],_0x2e39b5[_0x546b('0x59')]?JSON[_0x546b('0x25')](_0x2e39b5[_0x546b('0x59')]):_0x546b('0x6b'));return respondWithRpcPromise(_0x546b('0x6c'),_0x546b('0x6d'),_0x1f56a3);}return null;})[_0x546b('0x21')](function(_0xfd43e9){var _0x18c677=_0x546b('0x6e')+_0xfd43e9[_0x546b('0x29')][_0x546b('0x6f')];return db[_0x546b('0x70')][_0x546b('0x42')](_0x18c677,{'type':db[_0x546b('0x71')]['QueryTypes'][_0x546b('0x72')],'raw':!![]})[_0x546b('0x21')](function(_0x495d37){return _0x495d37;});})[_0x546b('0x21')](function(_0x1b7b53){if(_0x1b7b53){_0x1f56a3[_0x546b('0x29')][_0x546b('0x73')]=_0x1b7b53[0x0];if(!_0x2e39b5[_0x546b('0x59')]['UserId'])return;return db[_0x546b('0x74')]['find']({'where':{'id':_0x2e39b5[_0x546b('0x59')][_0x546b('0x63')],'role':_0x546b('0x62')},'attributes':['id','name','fullname',_0x546b('0x75'),_0x546b('0x76')],'raw':!![]});}return null;})[_0x546b('0x21')](function(_0x78957e){if(!_0x78957e)return null;_0x1f56a3[_0x546b('0x29')][_0x546b('0x62')]=_0x78957e;return _0x1f56a3;})[_0x546b('0x21')](function(_0x4df2d4){if(_0x4df2d4){if(_0x2e39b5[_0x546b('0x59')]['manual']){_0x1f56a3['message'][_0x546b('0x77')]=util[_0x546b('0x5f')](_0x546b('0x78'),_0x2e39b5['user'][_0x546b('0x3a')]);_0x1f56a3[_0x546b('0x29')][_0x546b('0x79')]=_0x1f56a3[_0x546b('0x79')];_0x1f56a3[_0x546b('0x29')]['event']=_0x546b('0x5c');return respondWithRpcPromise(_0x546b('0x7a'),_0x546b('0x7a'),{'event':_0x546b('0x7b'),'message':_0x1f56a3['message']},client9002)[_0x546b('0x21')](function(){return _0x1f56a3;});}return _0x1f56a3;}return null;})[_0x546b('0x21')](respondWithResult(_0x5b3df8,null))[_0x546b('0x2a')](handleError(_0x5b3df8,null));};var interaction_log=require(_0x546b('0x14'))(_0x546b('0x5b'));exports[_0x546b('0x35')]=function(_0x37d83f,_0x1dd348,_0x2d3e4c){var _0x52787d={'agent':{},'channel':'sms'};if(_0x37d83f[_0x546b('0x59')]['id']){delete _0x37d83f[_0x546b('0x59')]['id'];}_0x37d83f['body'][_0x546b('0x63')]=_0x37d83f[_0x546b('0x59')]['UserId']||_0x37d83f[_0x546b('0x61')]['id'];_0x52787d[_0x546b('0x62')]['id']=_0x37d83f['body']['UserId'];return db[_0x546b('0x3d')][_0x546b('0x57')]({'where':{'id':_0x37d83f['params']['id'],'UserId':null}})[_0x546b('0x21')](handleEntityNotFound(_0x1dd348,null))[_0x546b('0x21')](function(_0x54de52){if(_0x54de52){_0x52787d[_0x546b('0x29')]=_0x54de52[_0x546b('0x64')]({'plain':!![]});return db[_0x546b('0x65')][_0x546b('0x57')]({'where':{'id':_0x54de52['SmsInteractionId']}});}return null;})[_0x546b('0x21')](handleEntityNotFound(_0x1dd348,null))[_0x546b('0x21')](function(_0x566f53){if(_0x566f53){_0x52787d[_0x546b('0x6a')]=_0x566f53[_0x546b('0x64')]({'plain':!![]});interaction_log[_0x546b('0x22')](_0x546b('0x7c'),_0x37d83f['user']['id'],_0x37d83f[_0x546b('0x61')][_0x546b('0x3a')],_0x37d83f[_0x546b('0x61')]['role'],_0x52787d[_0x546b('0x6a')]['id'],_0x37d83f['body']?JSON[_0x546b('0x25')](_0x37d83f['body']):_0x546b('0x6b'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x52787d);}return null;})[_0x546b('0x21')](function(_0x30d405){var _0x1d4711=_0x546b('0x6e')+_0x30d405[_0x546b('0x29')][_0x546b('0x6f')];return db[_0x546b('0x70')][_0x546b('0x42')](_0x1d4711,{'type':db['Sequelize'][_0x546b('0x7d')][_0x546b('0x72')],'raw':!![]})['then'](function(_0x150565){return _0x150565;});})[_0x546b('0x21')](function(_0x496b37){if(_0x496b37){_0x52787d[_0x546b('0x29')]['contact']=_0x496b37[0x0];if(!_0x37d83f[_0x546b('0x59')][_0x546b('0x63')])return;return db[_0x546b('0x74')]['find']({'where':{'id':_0x37d83f['body'][_0x546b('0x63')],'role':_0x546b('0x62')},'attributes':['id',_0x546b('0x3a'),'fullname',_0x546b('0x75'),_0x546b('0x76')],'raw':!![]});}return null;})[_0x546b('0x21')](function(_0x687a2a){if(!_0x687a2a)return null;_0x52787d[_0x546b('0x29')]['agent']=_0x687a2a;return _0x52787d;})[_0x546b('0x21')](function(_0x533889){if(_0x533889){_0x533889[_0x546b('0x29')]['interface']=util['format'](_0x546b('0x78'),_0x37d83f[_0x546b('0x61')][_0x546b('0x3a')]);_0x533889[_0x546b('0x29')][_0x546b('0x79')]=_0x52787d['channel'];_0x533889[_0x546b('0x29')][_0x546b('0x7e')]=_0x546b('0x35');respondWithRpcPromise('EventManager',_0x546b('0x7a'),{'event':_0x546b('0x7f'),'message':_0x533889[_0x546b('0x29')]},client9002);return _0x52787d;}return null;})['then'](respondWithResult(_0x1dd348,null))['catch'](handleError(_0x1dd348,null));};exports[_0x546b('0x2c')]=function(_0x3a1f42,_0x201165,_0x422580){if(_0x3a1f42['body']['id']){delete _0x3a1f42[_0x546b('0x59')]['id'];}var _0x24cdbd;return db[_0x546b('0x3d')][_0x546b('0x57')]({'where':{'id':_0x3a1f42[_0x546b('0x54')]['id']}})['then'](handleEntityNotFound(_0x201165,null))['then'](function(_0x2096b4){if(_0x2096b4){_0x24cdbd=_0x2096b4;return db['SmsAccount'][_0x546b('0x57')]({'where':{'id':_0x2096b4[_0x546b('0x80')]}});}})[_0x546b('0x21')](handleEntityNotFound(_0x201165,null))[_0x546b('0x21')](function(_0x5833ea){if(_0x5833ea){logger['debug'](_0x546b('0x81'),_0x546b('0x2c'),_0x546b('0x82'),_0x5833ea[_0x546b('0x3f')],util[_0x546b('0x83')](_0x3a1f42[_0x546b('0x59')],{'showHidden':![],'depth':null}));switch(_0x5833ea[_0x546b('0x3f')]){case'twilio':if(_0x3a1f42[_0x546b('0x59')][_0x546b('0x84')]&&_0x3a1f42[_0x546b('0x59')][_0x546b('0x84')]===_0x24cdbd['messageId']){return _0x24cdbd[_0x546b('0x37')]({'read':!![]});}else{logger[_0x546b('0x26')](_0x546b('0x85'),_0x546b('0x2c'),_0x546b('0x86'),util['inspect'](_0x3a1f42[_0x546b('0x59')],{'showHidden':![],'depth':null}));}break;case _0x546b('0x87'):if(_0x3a1f42[_0x546b('0x59')]['MessageUUID']&&_0x3a1f42['body'][_0x546b('0x88')]===_0x24cdbd[_0x546b('0x89')]&&_[_0x546b('0x8a')]([_0x546b('0x8b'),_0x546b('0x8c')],_0x3a1f42[_0x546b('0x59')][_0x546b('0x8d')])>=0x0){return _0x24cdbd[_0x546b('0x37')]({'read':!![]});}else{logger['error'](_0x546b('0x85'),_0x546b('0x2c'),_0x546b('0x8e'),util[_0x546b('0x83')](_0x3a1f42[_0x546b('0x59')],{'showHidden':![],'depth':null}));}break;case _0x546b('0x8f'):var _0x4b816d=_0x3a1f42[_0x546b('0x59')][_0x546b('0x90')][0x0];if(_0x4b816d[_0x546b('0x2c')][_0x546b('0x91')]===_0x546b('0x92')){return _0x24cdbd[_0x546b('0x37')]({'read':!![]});}else{logger[_0x546b('0x26')](_0x546b('0x85'),_0x546b('0x2c'),_0x546b('0x8f'),util[_0x546b('0x83')](_0x3a1f42[_0x546b('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x24cdbd;}})['then'](respondWithResult(_0x201165,null))['catch'](handleError(_0x201165,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 2288ac2..6dd13c3 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 _0x23b5=['save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','setMaxListeners'];(function(_0xf48244,_0x115cad){var _0x37d890=function(_0x19a886){while(--_0x19a886){_0xf48244['push'](_0xf48244['shift']());}};_0x37d890(++_0x115cad);}(_0x23b5,0xf0));var _0x523b=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0x23b5[_0x1cfa0d];return _0xe33279;};'use strict';var EventEmitter=require(_0x523b('0x0'));var SmsMessage=require(_0x523b('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x523b('0x2')](0x0);var events={'afterCreate':_0x523b('0x3'),'afterUpdate':_0x523b('0x4'),'afterDestroy':_0x523b('0x5')};function emitEvent(_0x295017){return function(_0x9a062b,_0x3d3bf7,_0x1cdecc){SmsMessageEvents[_0x523b('0x6')](_0x295017+':'+_0x9a062b['id'],_0x9a062b);SmsMessageEvents[_0x523b('0x6')](_0x295017,_0x9a062b);_0x1cdecc(null);};}for(var e in events){if(events[_0x523b('0x7')](e)){var event=events[e];SmsMessage[_0x523b('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xcbc2=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xcbc2,0x19b));var _0x2cbc=function(_0x3527be,_0x113fdb){_0x3527be=_0x3527be-0x0;var _0x5c61b8=_0xcbc2[_0x3527be];return _0x5c61b8;};'use strict';var EventEmitter=require(_0x2cbc('0x0'));var SmsMessage=require(_0x2cbc('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x2cbc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2cbc('0x3'),'afterDestroy':_0x2cbc('0x4')};function emitEvent(_0x2235f5){return function(_0x1c2760,_0x5ce510,_0x4ecd8a){SmsMessageEvents[_0x2cbc('0x5')](_0x2235f5+':'+_0x1c2760['id'],_0x1c2760);SmsMessageEvents['emit'](_0x2235f5,_0x1c2760);_0x4ecd8a(null);};}for(var e in events){if(events[_0x2cbc('0x6')](e)){var event=events[e];SmsMessage[_0x2cbc('0x7')](e,emitEvent(event));}}module[_0x2cbc('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 741dd90..f8a319d 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 _0x2c6a=['clickSend','plivo','authId','token','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','baseUrl','/auth/1/session','/sms/2/text/advanced','/api/sms/messages/','application/json','infobip','Missing\x20parameters:\x20base_url','crypto','login','text','keys','sort','length','apiKey','createHash','md5','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','accountId','/messages','applicationId','toString','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','status','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','direction','toLowerCase','secret','isNil','UserId','findOne','SmsInteractionId','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','login?username=','username','GET','split','sms','POST','session_key','internal_order_id','read','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','message_id'];(function(_0x5bf0bf,_0x52f6ff){var _0x4f8587=function(_0x1e9c59){while(--_0x1e9c59){_0x5bf0bf['push'](_0x5bf0bf['shift']());}};_0x4f8587(++_0x52f6ff);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa2c6('0x0'));var util=require(_0xa2c6('0x1'));var logger=require(_0xa2c6('0x2'))(_0xa2c6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa2c6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa2c6('0x5'));var config=require(_0xa2c6('0x6'));var attributes=require(_0xa2c6('0x7'));module[_0xa2c6('0x8')]=function(_0x569610,_0x5b71b2){return _0x569610[_0xa2c6('0x9')](_0xa2c6('0xa'),attributes,{'tableName':_0xa2c6('0xb'),'paranoid':![],'indexes':[{'name':_0xa2c6('0xc'),'fields':[_0xa2c6('0xc')]},{'name':_0xa2c6('0xd'),'fields':[_0xa2c6('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2b1e75,_0x14100c,_0x2637b4){var _0x30269d=_0x569610['models'];var _0x965bb0=_0x2b1e75['get']({'plain':!![]});if(_0x965bb0[_0xa2c6('0xf')][_0xa2c6('0x10')]()==='in'||_0x965bb0[_0xa2c6('0xf')][_0xa2c6('0x10')]()==='out'&&!_0x965bb0[_0xa2c6('0x11')]&&!_[_0xa2c6('0x12')](_0x965bb0[_0xa2c6('0x13')])){_0x30269d['SmsInteraction'][_0xa2c6('0x14')]({'where':{'id':_0x965bb0[_0xa2c6('0x15')]}})[_0xa2c6('0x16')](function(_0x1bc1dc){if(_0x1bc1dc){_0x1bc1dc[_0xa2c6('0x17')]({'lastMsgAt':_0x965bb0['createdAt'],'lastMsgDirection':_0x965bb0[_0xa2c6('0xf')][_0xa2c6('0x10')]()});}})[_0xa2c6('0x18')](function(_0x354dff){console[_0xa2c6('0x19')](_0x354dff);});}if(_0x965bb0[_0xa2c6('0xf')]==='out'&&!_0x965bb0[_0xa2c6('0x11')]){var _0x4d49f8;_0x30269d[_0xa2c6('0x1a')][_0xa2c6('0x1b')]({'where':{'id':_0x965bb0[_0xa2c6('0x1c')]},'raw':!![]})[_0xa2c6('0x16')](function(_0x372ce3){_0x4d49f8=_0x372ce3;if(_0x4d49f8&&_0x4d49f8[_0xa2c6('0x1d')]){switch(_0x4d49f8[_0xa2c6('0x1d')]){case _0xa2c6('0x1e'):var _0x4c02cc=require(_0xa2c6('0x1e'));if(_0x4d49f8[_0xa2c6('0x1f')]&&_0x4d49f8[_0xa2c6('0x20')]&&_0x4d49f8[_0xa2c6('0x21')]){var _0x2a2fc9=new _0x4c02cc(_0x4d49f8['accountSid'],_0x4d49f8[_0xa2c6('0x20')]);_0x2a2fc9[_0xa2c6('0x22')]['create']({'body':_0x965bb0[_0xa2c6('0xe')],'to':_0x965bb0['phone'],'from':_0x4d49f8[_0xa2c6('0x21')],'statusCallback':_0x4d49f8[_0xa2c6('0x23')]+'/api/sms/messages/'+_0x965bb0['id']+_0xa2c6('0x24')+_0x4d49f8['token']})[_0xa2c6('0x16')](function(_0x168de7){if(_0x168de7[_0xa2c6('0x25')]){return _0x2b1e75[_0xa2c6('0x17')]({'messageId':_0x168de7[_0xa2c6('0x25')]});}})['catch'](function(_0x2ed646){logger['error'](_0xa2c6('0x26'),_0xa2c6('0x27'),'twilio',util[_0xa2c6('0x28')](_0x2ed646,{'showHidden':![],'depth':null}));});}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x1e'),_0xa2c6('0x29'));}break;case _0xa2c6('0x2a'):var _0x3892ca=_0xa2c6('0x2b');if(_0x4d49f8['username']&&_0x4d49f8[_0xa2c6('0x2c')]){var _0x46b082={'recipient':[_0x965bb0[_0xa2c6('0x21')]],'message':_0x965bb0[_0xa2c6('0xe')],'message_type':_0x4d49f8['smsMethod']};if(_0x4d49f8['smsMethod']&&_0x4d49f8['smsMethod']!=='SI'){_0x46b082['sender']=_0x4d49f8[_0xa2c6('0x21')];}var _0x323e04={'url':_0x3892ca+_0xa2c6('0x2d')+_0x4d49f8[_0xa2c6('0x2e')]+'&password='+_0x4d49f8[_0xa2c6('0x2c')],'method':_0xa2c6('0x2f')};rp(_0x323e04)[_0xa2c6('0x16')](function(_0x10e1d6){var _0x2c4996=_0x10e1d6[_0xa2c6('0x30')](';');var _0xea9d2d={'user_key':_0x2c4996[0x0],'session_key':_0x2c4996[0x1]};_0x323e04={'url':_0x3892ca+_0xa2c6('0x31'),'method':_0xa2c6('0x32'),'headers':{'user_key':_0xea9d2d['user_key'],'Session_key':_0xea9d2d[_0xa2c6('0x33')]},'json':!![],'body':_0x46b082};return rp(_0x323e04);})[_0xa2c6('0x16')](function(_0x1b8f5b){if(_0x1b8f5b['total_sent']>=0x1){var _0x3f8bd3={'messageId':_0x1b8f5b[_0xa2c6('0x34')]};if(_0x4d49f8['smsMethod']!=='GP'||!_0x4d49f8['deliveryReport']){_0x3f8bd3[_0xa2c6('0x35')]=!![];}return _0x2b1e75[_0xa2c6('0x17')](_0x3f8bd3);}else{return logger[_0xa2c6('0x19')](_0xa2c6('0x26'),'afterCreate',_0xa2c6('0x2a'),util[_0xa2c6('0x28')](_0x1b8f5b,{'showHidden':![],'depth':null}));}})[_0xa2c6('0x18')](function(_0x1bcabf){return logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'skebby',util[_0xa2c6('0x28')](_0x1bcabf,{'showHidden':![],'depth':null}));});}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x2a'),_0xa2c6('0x36'));}break;case _0xa2c6('0x37'):if(_0x4d49f8['authToken']){var _0x56a94b={'recipient':_0x965bb0[_0xa2c6('0x21')],'message':_0x965bb0['body'],'sender':_0x4d49f8[_0xa2c6('0x38')]||_0x4d49f8['phone'],'authorization':_0x4d49f8[_0xa2c6('0x20')]};var _0x14100c={'method':'POST','uri':_0xa2c6('0x39'),'body':_0x56a94b,'json':!![]};rp(_0x14100c)[_0xa2c6('0x16')](function(_0x5a7db0){var _0x228fbd={'messageId':_0x5a7db0[_0xa2c6('0x3a')]};if(!_0x4d49f8[_0xa2c6('0x3b')]){_0x228fbd['read']=!![];}return _0x2b1e75[_0xa2c6('0x17')](_0x228fbd);})['catch'](function(_0x5b0720){logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x37'),util[_0xa2c6('0x28')](_0x5b0720,{'showHidden':![],'depth':null}));});}else{logger[_0xa2c6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa2c6('0x37'),_0xa2c6('0x3c'));}break;case'clicksend':if(_0x4d49f8[_0xa2c6('0x2e')]&&_0x4d49f8['password']){var _0x56a94b={'messages':[{'source':'xCALLY\x20Motion','to':_0x965bb0[_0xa2c6('0x21')],'body':_0x965bb0[_0xa2c6('0xe')],'from':_0x4d49f8['senderString']||_0x4d49f8[_0xa2c6('0x21')]}]};var _0x35ceef=util[_0xa2c6('0x3d')](_0xa2c6('0x3e'),_0x4d49f8['username'],_0x4d49f8[_0xa2c6('0x2c')]);var _0x14100c={'method':_0xa2c6('0x32'),'uri':_0xa2c6('0x3f'),'body':_0x56a94b,'headers':{'Authorization':util[_0xa2c6('0x3d')]('Basic\x20%s',new Buffer(_0x35ceef)['toString'](_0xa2c6('0x40')))},'json':!![]};rp(_0x14100c)[_0xa2c6('0x16')](function(_0x28da23){if(_0x28da23[_0xa2c6('0x41')]>=0xc8&&_0x28da23[_0xa2c6('0x41')]<=0xce){if(_0x28da23[_0xa2c6('0x42')]&&_0x28da23[_0xa2c6('0x42')][_0xa2c6('0x43')]>0x0){var _0x413c2c=_['head'](_0x28da23['data'][_0xa2c6('0x22')]);var _0x4b5fc5={'messageId':_0x413c2c[_0xa2c6('0x44')]};if(!_0x4d49f8['deliveryReport']){_0x4b5fc5[_0xa2c6('0x35')]=!![];}return _0x2b1e75[_0xa2c6('0x17')](_0x4b5fc5);}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x45'),util['inspect'](_0x28da23,{'showHidden':![],'depth':null}));}}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),'afterCreate','clickSend',util[_0xa2c6('0x28')](_0x28da23,{'showHidden':![],'depth':null}));}})['catch'](function(_0x723a25){logger[_0xa2c6('0x19')](_0xa2c6('0x26'),'afterCreate',_0xa2c6('0x45'),util[_0xa2c6('0x28')](_0x723a25,{'showHidden':![],'depth':null}));});}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'clickSend','Missing\x20parameters:\x20username,\x20password');}break;case _0xa2c6('0x46'):if(_0x4d49f8[_0xa2c6('0x47')]&&_0x4d49f8['authToken']){var _0x56a94b={'dst':_0x965bb0['phone'],'text':_0x965bb0[_0xa2c6('0xe')],'src':_0x4d49f8[_0xa2c6('0x38')]||_0x4d49f8['phone'],'url':_0x4d49f8[_0xa2c6('0x23')]+'/api/sms/messages/'+_0x965bb0['id']+_0xa2c6('0x24')+_0x4d49f8[_0xa2c6('0x48')]};var _0x35ceef=util[_0xa2c6('0x3d')](_0xa2c6('0x3e'),_0x4d49f8[_0xa2c6('0x47')],_0x4d49f8[_0xa2c6('0x20')]);var _0x14100c={'method':_0xa2c6('0x32'),'uri':util[_0xa2c6('0x3d')](_0xa2c6('0x49'),_0x4d49f8[_0xa2c6('0x47')]),'body':_0x56a94b,'headers':{'Authorization':util['format'](_0xa2c6('0x4a'),new Buffer(_0x35ceef)['toString'](_0xa2c6('0x40')))},'json':!![]};rp(_0x14100c)[_0xa2c6('0x16')](function(_0x30bf20){var _0x37d9ef={'messageId':_0x30bf20[_0xa2c6('0x4b')][0x0]};return _0x2b1e75['update'](_0x37d9ef);})['catch'](function(_0x9926e8){logger[_0xa2c6('0x19')](_0xa2c6('0x26'),'afterCreate',_0xa2c6('0x46'),util[_0xa2c6('0x28')](_0x9926e8,{'showHidden':![],'depth':null}));});}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x46'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case'infobip':if(_0x4d49f8[_0xa2c6('0x2e')]&&_0x4d49f8[_0xa2c6('0x2c')]){if(_0x4d49f8['baseUrl']){var _0xbce978={'method':'POST','uri':_0x4d49f8[_0xa2c6('0x4c')]+_0xa2c6('0x4d'),'body':{'username':_0x4d49f8[_0xa2c6('0x2e')],'password':_0x4d49f8[_0xa2c6('0x2c')]},'json':!![]};return rp(_0xbce978)[_0xa2c6('0x16')](function(_0x2bd566){var _0x5d2cf1={'method':'POST','uri':_0x4d49f8[_0xa2c6('0x4c')]+_0xa2c6('0x4e'),'body':{'messages':[{'from':_0x4d49f8[_0xa2c6('0x21')],'destinations':[{'to':_0x965bb0[_0xa2c6('0x21')]}],'text':_0x965bb0['body'],'notifyUrl':_0x4d49f8[_0xa2c6('0x23')]+_0xa2c6('0x4f')+_0x965bb0['id']+_0xa2c6('0x24')+_0x4d49f8['token'],'notifyContentType':_0xa2c6('0x50'),'callbackData':_0x4d49f8[_0xa2c6('0x21')]+';'+_0x965bb0[_0xa2c6('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x2bd566['token']},'json':!![]};return rp(_0x5d2cf1)[_0xa2c6('0x16')](function(_0x48d99d){if(_0x48d99d[_0xa2c6('0x22')]){var _0x52852d={'messageId':_0x48d99d[_0xa2c6('0x22')][0x0][_0xa2c6('0xc')]};if(!_0x4d49f8[_0xa2c6('0x3b')]){_0x52852d[_0xa2c6('0x35')]=!![];}return _0x2b1e75[_0xa2c6('0x17')](_0x52852d);}else{return logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'infobip',util[_0xa2c6('0x28')](_0x48d99d,{'showHidden':![],'depth':null}));}});})[_0xa2c6('0x18')](function(_0x53bc4b){return logger[_0xa2c6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa2c6('0x27'),_0xa2c6('0x51'),util[_0xa2c6('0x28')](_0x53bc4b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa2c6('0x26'),'afterCreate',_0xa2c6('0x51'),_0xa2c6('0x52'));}}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case'csc':var _0x5d1efe=require(_0xa2c6('0x53'));if(_0x4d49f8['apiKey']){var _0x24ce9c={};_0x24ce9c[_0xa2c6('0x54')]=_0x4d49f8[_0xa2c6('0x2e')];_0x24ce9c[_0xa2c6('0x21')]=_0x965bb0['phone'];_0x24ce9c['sender']=_0x4d49f8[_0xa2c6('0x21')];_0x24ce9c[_0xa2c6('0x55')]=_0x965bb0['body'];_0x24ce9c['timestamp']=+new Date();var _0x573c92='';var _0x4cd091='';var _0x3f838a=Object[_0xa2c6('0x56')](_0x24ce9c);_0x3f838a[_0xa2c6('0x57')]();for(var _0x4f426a=0x0;_0x4f426a<_0x3f838a[_0xa2c6('0x58')];_0x4f426a++){if(_0x573c92!=''){_0x573c92+='&';}_0x573c92+=_0x3f838a[_0x4f426a]+'='+encodeURIComponent(_0x24ce9c[_0x3f838a[_0x4f426a]]);_0x4cd091+=_0x24ce9c[_0x3f838a[_0x4f426a]];}_0x4cd091+=_0x4d49f8[_0xa2c6('0x59')];_0x4cd091=_0x5d1efe[_0xa2c6('0x5a')](_0xa2c6('0x5b'))[_0xa2c6('0x17')](_0x4cd091)['digest'](_0xa2c6('0x5c'));if(_0x573c92!==''){_0x573c92+='&';}_0x573c92+=_0xa2c6('0x5d')+_0x4cd091;var _0x323e04={'method':_0xa2c6('0x2f'),'uri':_0x4d49f8[_0xa2c6('0x4c')]+_0xa2c6('0x5e')+_0x573c92,'json':!![]};return rp(_0x323e04)[_0xa2c6('0x16')](function(_0x24c631){var _0x8c138b=Object[_0xa2c6('0x56')](_0x24c631);if(_0x24c631[_0x8c138b[0x0]][_0xa2c6('0x19')]&&parseInt(_0x24c631[_0x8c138b[0x0]][_0xa2c6('0x19')])===0x0){var _0x1a5f61={'messageId':_0x24c631[_0x8c138b[0x0]][_0xa2c6('0x5f')]};if(!_0x4d49f8[_0xa2c6('0x3b')]){_0x1a5f61[_0xa2c6('0x35')]=!![];}return _0x2b1e75[_0xa2c6('0x17')](_0x1a5f61);}else{return logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'csc',util[_0xa2c6('0x28')](_0x24c631[_0xa2c6('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0xea5a47){return logger[_0xa2c6('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa2c6('0x60'),util['inspect'](_0xea5a47,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x60'),_0xa2c6('0x61'));}break;case _0xa2c6('0x62'):if(_0x4d49f8[_0xa2c6('0x59')]){var _0x21232b={'method':_0xa2c6('0x32'),'uri':_0xa2c6('0x63'),'headers':{'Authorization':_0x4d49f8[_0xa2c6('0x59')]},'body':{'content':_0x965bb0[_0xa2c6('0xe')],'to':[_0x965bb0[_0xa2c6('0x21')]],'from':_0x4d49f8[_0xa2c6('0x21')],'binary':![],'clientMessageId':_0xa2c6('0x64'),'charset':_0xa2c6('0x65')},'json':!![]};rp(_0x21232b)[_0xa2c6('0x16')](function(_0x1e59ae){if(!_0x1e59ae[_0xa2c6('0x19')]){var _0xd58ad6={'messageId':_0x1e59ae[_0xa2c6('0x22')][0x0][_0xa2c6('0x66')]};if(!_0x4d49f8[_0xa2c6('0x3b')]){_0xd58ad6[_0xa2c6('0x35')]=!![];}return _0x2b1e75[_0xa2c6('0x17')](_0xd58ad6);}else{return logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'clickatell',util[_0xa2c6('0x28')](_0x1e59ae[_0xa2c6('0x19')],{'showHidden':![],'depth':null}));}})[_0xa2c6('0x18')](function(_0x731b26){return logger['error'](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x62'),util[_0xa2c6('0x28')](_0x731b26,{'showHidden':![],'depth':null}));});}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'clickatell',_0xa2c6('0x61'));}break;case'bandwidth':if(_0x4d49f8[_0xa2c6('0x2e')]&&_0x4d49f8[_0xa2c6('0x2c')]){var _0x35ceef=util[_0xa2c6('0x3d')](_0xa2c6('0x3e'),_0x4d49f8[_0xa2c6('0x2e')],_0x4d49f8[_0xa2c6('0x2c')]);var _0x14100c={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x4d49f8[_0xa2c6('0x67')]+_0xa2c6('0x68'),'body':{'to':[_0x965bb0[_0xa2c6('0x21')]],'text':_0x965bb0[_0xa2c6('0xe')],'from':_0x4d49f8[_0xa2c6('0x21')],'applicationId':_0x4d49f8[_0xa2c6('0x69')]},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x35ceef)[_0xa2c6('0x6a')](_0xa2c6('0x40')))},'json':!![]};rp(_0x14100c)[_0xa2c6('0x16')](function(_0x4f278b){if(_0x4f278b['id']){var _0x197772={'messageId':_0x4f278b['id']};return _0x2b1e75[_0xa2c6('0x17')](_0x197772);}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),_0xa2c6('0x6b'),util[_0xa2c6('0x28')](_0x4f278b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e82d5){logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'bandwidth',util[_0xa2c6('0x28')](_0x1e82d5,{'showHidden':![],'depth':null}));});}else{logger[_0xa2c6('0x19')](_0xa2c6('0x26'),'afterCreate',_0xa2c6('0x6b'),'Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x4d49f8[_0xa2c6('0x59')]){var _0x3e06ca={};var _0x323e04={'method':'POST','uri':_0xa2c6('0x6c'),'headers':{'Authorization':_0xa2c6('0x6d')+_0x4d49f8[_0xa2c6('0x59')],'Content-Type':'application/json'},'body':{'from':_0x4d49f8[_0xa2c6('0x21')],'to':_0x965bb0[_0xa2c6('0x21')],'text':_0x965bb0[_0xa2c6('0xe')]},'json':!![]};return rp(_0x323e04)[_0xa2c6('0x16')](function(_0x592dc9){if(_0x592dc9[_0xa2c6('0x6e')]==0xca){_0x3e06ca['message']=_0x592dc9;var _0x1b184e={'method':_0xa2c6('0x32'),'uri':_0xa2c6('0x6f'),'headers':{'Authorization':_0xa2c6('0x6d')+_0x4d49f8[_0xa2c6('0x59')],'Content-Type':_0xa2c6('0x50')},'body':{'refid':_0x3e06ca[_0xa2c6('0x70')][_0xa2c6('0x71')]},'json':!![]};return rp(_0x1b184e)[_0xa2c6('0x16')](function(_0x10ea19){_0x3e06ca[_0xa2c6('0x72')]=_0x10ea19;var _0x1515be={'messageId':_0x3e06ca[_0xa2c6('0x70')][_0xa2c6('0x71')],'read':!![]};return _0x2b1e75[_0xa2c6('0x17')](_0x1515be);});}else{return logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'intelepeer',util[_0xa2c6('0x28')](_0x592dc9,{'showHidden':![],'depth':null}));}})[_0xa2c6('0x18')](function(_0x4c5ec8){return logger[_0xa2c6('0x19')](_0xa2c6('0x26'),_0xa2c6('0x27'),'intelepeer',util[_0xa2c6('0x28')](_0x4c5ec8,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer','Token\x20not\x20received');}break;}}})[_0xa2c6('0x73')](function(){_0x2637b4();});}else{_0x2637b4();}}},'charset':_0xa2c6('0x74'),'collate':_0xa2c6('0x75')});}; \ No newline at end of file +var _0x0531=['update','createdAt','error','SmsAccount','find','then','type','twilio','phone','accountSid','create','/api/sms/messages/','token','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','login?username=','&password=','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','skebby','catch','Missing\x20parameters:\x20username,\x20password','connectel','authToken','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','remote','/status?token=','authId','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','infobip','csc','crypto','text','timestamp','keys','sort','length','apiKey','md5','hex','signature=','GET','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','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','refid','status','finally','utf8mb4','lodash','util','moment','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x0531,0xde));var _0x1053=function(_0x4a0f16,_0x21ba18){_0x4a0f16=_0x4a0f16-0x0;var _0x45d653=_0x0531[_0x4a0f16];return _0x45d653;};'use strict';var _=require(_0x1053('0x0'));var util=require(_0x1053('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1053('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1053('0x3'));var rimraf=require(_0x1053('0x4'));var config=require(_0x1053('0x5'));var attributes=require(_0x1053('0x6'));module[_0x1053('0x7')]=function(_0x5d8ce2,_0x29e7cd){return _0x5d8ce2[_0x1053('0x8')](_0x1053('0x9'),attributes,{'tableName':_0x1053('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1053('0xb')]},{'name':_0x1053('0xc'),'fields':[_0x1053('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x984d73,_0x3ac452,_0x456de8){var _0x4ffd33=_0x5d8ce2['models'];var _0x430887=_0x984d73[_0x1053('0xe')]({'plain':!![]});if(_0x430887['direction'][_0x1053('0xf')]()==='in'||_0x430887[_0x1053('0x10')][_0x1053('0xf')]()===_0x1053('0x11')&&!_0x430887[_0x1053('0x12')]&&!_[_0x1053('0x13')](_0x430887[_0x1053('0x14')])){_0x4ffd33[_0x1053('0x15')][_0x1053('0x16')]({'where':{'id':_0x430887[_0x1053('0x17')]}})['then'](function(_0x4d6aa1){if(_0x4d6aa1){_0x4d6aa1[_0x1053('0x18')]({'lastMsgAt':_0x430887[_0x1053('0x19')],'lastMsgDirection':_0x430887[_0x1053('0x10')]['toLowerCase']()});}})['catch'](function(_0x1f9067){console[_0x1053('0x1a')](_0x1f9067);});}if(_0x430887['direction']==='out'&&!_0x430887[_0x1053('0x12')]){var _0x3c60a4;_0x4ffd33[_0x1053('0x1b')][_0x1053('0x1c')]({'where':{'id':_0x430887['SmsAccountId']},'raw':!![]})[_0x1053('0x1d')](function(_0x30e687){_0x3c60a4=_0x30e687;if(_0x3c60a4&&_0x3c60a4[_0x1053('0x1e')]){switch(_0x3c60a4['type']){case _0x1053('0x1f'):var _0x54be7a=require(_0x1053('0x1f'));if(_0x3c60a4['accountSid']&&_0x3c60a4['authToken']&&_0x3c60a4[_0x1053('0x20')]){var _0x448651=new _0x54be7a(_0x3c60a4[_0x1053('0x21')],_0x3c60a4['authToken']);_0x448651['messages'][_0x1053('0x22')]({'body':_0x430887[_0x1053('0xd')],'to':_0x430887[_0x1053('0x20')],'from':_0x3c60a4[_0x1053('0x20')],'statusCallback':_0x3c60a4['remote']+_0x1053('0x23')+_0x430887['id']+'/status?token='+_0x3c60a4[_0x1053('0x24')]})['then'](function(_0x901db2){if(_0x901db2['sid']){return _0x984d73['update']({'messageId':_0x901db2['sid']});}})['catch'](function(_0x3dc2c0){logger['error'](_0x1053('0x25'),_0x1053('0x26'),_0x1053('0x1f'),util[_0x1053('0x27')](_0x3dc2c0,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),'twilio',_0x1053('0x28'));}break;case'skebby':var _0x32c909=_0x1053('0x29');if(_0x3c60a4[_0x1053('0x2a')]&&_0x3c60a4[_0x1053('0x2b')]){var _0x178545={'recipient':[_0x430887[_0x1053('0x20')]],'message':_0x430887[_0x1053('0xd')],'message_type':_0x3c60a4[_0x1053('0x2c')]};if(_0x3c60a4[_0x1053('0x2c')]&&_0x3c60a4[_0x1053('0x2c')]!=='SI'){_0x178545[_0x1053('0x2d')]=_0x3c60a4[_0x1053('0x20')];}var _0x3e1cfa={'url':_0x32c909+_0x1053('0x2e')+_0x3c60a4['username']+_0x1053('0x2f')+_0x3c60a4[_0x1053('0x2b')],'method':'GET'};rp(_0x3e1cfa)[_0x1053('0x1d')](function(_0x3d75ca){var _0x3fb439=_0x3d75ca[_0x1053('0x30')](';');var _0x3aa146={'user_key':_0x3fb439[0x0],'session_key':_0x3fb439[0x1]};_0x3e1cfa={'url':_0x32c909+_0x1053('0x31'),'method':_0x1053('0x32'),'headers':{'user_key':_0x3aa146[_0x1053('0x33')],'Session_key':_0x3aa146[_0x1053('0x34')]},'json':!![],'body':_0x178545};return rp(_0x3e1cfa);})[_0x1053('0x1d')](function(_0xe18aaa){if(_0xe18aaa['total_sent']>=0x1){var _0x471d93={'messageId':_0xe18aaa[_0x1053('0x35')]};if(_0x3c60a4[_0x1053('0x2c')]!=='GP'||!_0x3c60a4[_0x1053('0x36')]){_0x471d93['read']=!![];}return _0x984d73[_0x1053('0x18')](_0x471d93);}else{return logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),_0x1053('0x37'),util[_0x1053('0x27')](_0xe18aaa,{'showHidden':![],'depth':null}));}})[_0x1053('0x38')](function(_0x2c1e97){return logger['error'](_0x1053('0x25'),_0x1053('0x26'),'skebby',util[_0x1053('0x27')](_0x2c1e97,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1053('0x37'),_0x1053('0x39'));}break;case _0x1053('0x3a'):if(_0x3c60a4[_0x1053('0x3b')]){var _0x4a199d={'recipient':_0x430887[_0x1053('0x20')],'message':_0x430887['body'],'sender':_0x3c60a4[_0x1053('0x3c')]||_0x3c60a4[_0x1053('0x20')],'authorization':_0x3c60a4[_0x1053('0x3b')]};var _0x3ac452={'method':_0x1053('0x32'),'uri':_0x1053('0x3d'),'body':_0x4a199d,'json':!![]};rp(_0x3ac452)[_0x1053('0x1d')](function(_0x4532eb){var _0x1cef75={'messageId':_0x4532eb[_0x1053('0x3e')]};if(!_0x3c60a4[_0x1053('0x36')]){_0x1cef75[_0x1053('0x3f')]=!![];}return _0x984d73['update'](_0x1cef75);})[_0x1053('0x38')](function(_0x295bdb){logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),'connectel',util[_0x1053('0x27')](_0x295bdb,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x3a'),_0x1053('0x40'));}break;case _0x1053('0x41'):if(_0x3c60a4[_0x1053('0x2a')]&&_0x3c60a4[_0x1053('0x2b')]){var _0x4a199d={'messages':[{'source':_0x1053('0x42'),'to':_0x430887[_0x1053('0x20')],'body':_0x430887[_0x1053('0xd')],'from':_0x3c60a4[_0x1053('0x3c')]||_0x3c60a4[_0x1053('0x20')]}]};var _0x1b91de=util[_0x1053('0x43')](_0x1053('0x44'),_0x3c60a4[_0x1053('0x2a')],_0x3c60a4[_0x1053('0x2b')]);var _0x3ac452={'method':'POST','uri':_0x1053('0x45'),'body':_0x4a199d,'headers':{'Authorization':util['format'](_0x1053('0x46'),new Buffer(_0x1b91de)[_0x1053('0x47')](_0x1053('0x48')))},'json':!![]};rp(_0x3ac452)[_0x1053('0x1d')](function(_0xd31690){if(_0xd31690[_0x1053('0x49')]>=0xc8&&_0xd31690[_0x1053('0x49')]<=0xce){if(_0xd31690[_0x1053('0x4a')]&&_0xd31690[_0x1053('0x4a')][_0x1053('0x4b')]>0x0){var _0x55612c=_[_0x1053('0x4c')](_0xd31690[_0x1053('0x4a')]['messages']);var _0x441c5c={'messageId':_0x55612c[_0x1053('0x4d')]};if(!_0x3c60a4[_0x1053('0x36')]){_0x441c5c['read']=!![];}return _0x984d73[_0x1053('0x18')](_0x441c5c);}else{logger[_0x1053('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1053('0x26'),_0x1053('0x4e'),util[_0x1053('0x27')](_0xd31690,{'showHidden':![],'depth':null}));}}else{logger[_0x1053('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1053('0x26'),_0x1053('0x4e'),util[_0x1053('0x27')](_0xd31690,{'showHidden':![],'depth':null}));}})[_0x1053('0x38')](function(_0x45c0e0){logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x4e'),util[_0x1053('0x27')](_0x45c0e0,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),_0x1053('0x4e'),_0x1053('0x39'));}break;case _0x1053('0x4f'):if(_0x3c60a4['authId']&&_0x3c60a4['authToken']){var _0x4a199d={'dst':_0x430887[_0x1053('0x20')],'text':_0x430887['body'],'src':_0x3c60a4[_0x1053('0x3c')]||_0x3c60a4[_0x1053('0x20')],'url':_0x3c60a4[_0x1053('0x50')]+_0x1053('0x23')+_0x430887['id']+_0x1053('0x51')+_0x3c60a4['token']};var _0x1b91de=util[_0x1053('0x43')](_0x1053('0x44'),_0x3c60a4[_0x1053('0x52')],_0x3c60a4[_0x1053('0x3b')]);var _0x3ac452={'method':_0x1053('0x32'),'uri':util[_0x1053('0x43')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3c60a4[_0x1053('0x52')]),'body':_0x4a199d,'headers':{'Authorization':util[_0x1053('0x43')](_0x1053('0x46'),new Buffer(_0x1b91de)['toString'](_0x1053('0x48')))},'json':!![]};rp(_0x3ac452)['then'](function(_0x4e322a){var _0x358424={'messageId':_0x4e322a[_0x1053('0x53')][0x0]};return _0x984d73[_0x1053('0x18')](_0x358424);})['catch'](function(_0x2df716){logger['error'](_0x1053('0x25'),'afterCreate','plivo',util[_0x1053('0x27')](_0x2df716,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x4f'),_0x1053('0x54'));}break;case'infobip':if(_0x3c60a4[_0x1053('0x2a')]&&_0x3c60a4[_0x1053('0x2b')]){if(_0x3c60a4[_0x1053('0x55')]){var _0x2a9d39={'method':'POST','uri':_0x3c60a4[_0x1053('0x55')]+_0x1053('0x56'),'body':{'username':_0x3c60a4[_0x1053('0x2a')],'password':_0x3c60a4['password']},'json':!![]};return rp(_0x2a9d39)['then'](function(_0x4626d4){var _0x5900a6={'method':_0x1053('0x32'),'uri':_0x3c60a4[_0x1053('0x55')]+_0x1053('0x57'),'body':{'messages':[{'from':_0x3c60a4[_0x1053('0x20')],'destinations':[{'to':_0x430887[_0x1053('0x20')]}],'text':_0x430887[_0x1053('0xd')],'notifyUrl':_0x3c60a4[_0x1053('0x50')]+_0x1053('0x23')+_0x430887['id']+'/status?token='+_0x3c60a4[_0x1053('0x24')],'notifyContentType':_0x1053('0x58'),'callbackData':_0x3c60a4[_0x1053('0x20')]+';'+_0x430887['body']}]},'headers':{'Authorization':_0x1053('0x59')+_0x4626d4[_0x1053('0x24')]},'json':!![]};return rp(_0x5900a6)['then'](function(_0x1ea9d8){if(_0x1ea9d8['messages']){var _0x512aab={'messageId':_0x1ea9d8[_0x1053('0x5a')][0x0][_0x1053('0xb')]};if(!_0x3c60a4['deliveryReport']){_0x512aab[_0x1053('0x3f')]=!![];}return _0x984d73[_0x1053('0x18')](_0x512aab);}else{return logger[_0x1053('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0x1053('0x27')](_0x1ea9d8,{'showHidden':![],'depth':null}));}});})[_0x1053('0x38')](function(_0x45f596){return logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),_0x1053('0x5b'),util[_0x1053('0x27')](_0x45f596,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x5b'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x5b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x1053('0x5c'):var _0x412bf8=require(_0x1053('0x5d'));if(_0x3c60a4['apiKey']){var _0x2aada9={};_0x2aada9['login']=_0x3c60a4[_0x1053('0x2a')];_0x2aada9[_0x1053('0x20')]=_0x430887[_0x1053('0x20')];_0x2aada9[_0x1053('0x2d')]=_0x3c60a4[_0x1053('0x20')];_0x2aada9[_0x1053('0x5e')]=_0x430887[_0x1053('0xd')];_0x2aada9[_0x1053('0x5f')]=+new Date();var _0x1ec867='';var _0x2d002b='';var _0x2767df=Object[_0x1053('0x60')](_0x2aada9);_0x2767df[_0x1053('0x61')]();for(var _0x12881b=0x0;_0x12881b<_0x2767df[_0x1053('0x62')];_0x12881b++){if(_0x1ec867!=''){_0x1ec867+='&';}_0x1ec867+=_0x2767df[_0x12881b]+'='+encodeURIComponent(_0x2aada9[_0x2767df[_0x12881b]]);_0x2d002b+=_0x2aada9[_0x2767df[_0x12881b]];}_0x2d002b+=_0x3c60a4[_0x1053('0x63')];_0x2d002b=_0x412bf8['createHash'](_0x1053('0x64'))[_0x1053('0x18')](_0x2d002b)['digest'](_0x1053('0x65'));if(_0x1ec867!==''){_0x1ec867+='&';}_0x1ec867+=_0x1053('0x66')+_0x2d002b;var _0x3e1cfa={'method':_0x1053('0x67'),'uri':_0x3c60a4['baseUrl']+_0x1053('0x68')+_0x1ec867,'json':!![]};return rp(_0x3e1cfa)[_0x1053('0x1d')](function(_0x34974d){var _0x380a06=Object[_0x1053('0x60')](_0x34974d);if(_0x34974d[_0x380a06[0x0]][_0x1053('0x1a')]&&parseInt(_0x34974d[_0x380a06[0x0]][_0x1053('0x1a')])===0x0){var _0xfe6950={'messageId':_0x34974d[_0x380a06[0x0]][_0x1053('0x69')]};if(!_0x3c60a4[_0x1053('0x36')]){_0xfe6950['read']=!![];}return _0x984d73['update'](_0xfe6950);}else{return logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x5c'),util[_0x1053('0x27')](_0x34974d[_0x1053('0x1a')],{'showHidden':![],'depth':null}));}})[_0x1053('0x38')](function(_0xb0ebd7){return logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),'csc',util[_0x1053('0x27')](_0xb0ebd7,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate','csc',_0x1053('0x6a'));}break;case _0x1053('0x6b'):if(_0x3c60a4[_0x1053('0x63')]){var _0x41cad8={'method':_0x1053('0x32'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3c60a4[_0x1053('0x63')]},'body':{'content':_0x430887[_0x1053('0xd')],'to':[_0x430887['phone']],'from':_0x3c60a4[_0x1053('0x20')],'binary':![],'clientMessageId':_0x1053('0x6c'),'charset':'UTF-8'},'json':!![]};rp(_0x41cad8)[_0x1053('0x1d')](function(_0x580b50){if(!_0x580b50['error']){var _0x438347={'messageId':_0x580b50[_0x1053('0x5a')][0x0]['apiMessageId']};if(!_0x3c60a4[_0x1053('0x36')]){_0x438347['read']=!![];}return _0x984d73['update'](_0x438347);}else{return logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),'clickatell',util['inspect'](_0x580b50[_0x1053('0x1a')],{'showHidden':![],'depth':null}));}})[_0x1053('0x38')](function(_0x2e4be5){return logger['error'](_0x1053('0x25'),_0x1053('0x26'),_0x1053('0x6b'),util[_0x1053('0x27')](_0x2e4be5,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),'clickatell',_0x1053('0x6a'));}break;case _0x1053('0x6d'):if(_0x3c60a4[_0x1053('0x2a')]&&_0x3c60a4['password']){var _0x1b91de=util[_0x1053('0x43')](_0x1053('0x44'),_0x3c60a4['username'],_0x3c60a4[_0x1053('0x2b')]);var _0x3ac452={'method':_0x1053('0x32'),'uri':_0x1053('0x6e')+_0x3c60a4[_0x1053('0x6f')]+_0x1053('0x70'),'body':{'to':[_0x430887['phone']],'text':_0x430887['body'],'from':_0x3c60a4['phone'],'applicationId':_0x3c60a4[_0x1053('0x71')]},'headers':{'Authorization':util[_0x1053('0x43')](_0x1053('0x46'),new Buffer(_0x1b91de)[_0x1053('0x47')]('base64'))},'json':!![]};rp(_0x3ac452)[_0x1053('0x1d')](function(_0x268ee5){if(_0x268ee5['id']){var _0x46fbdf={'messageId':_0x268ee5['id']};return _0x984d73[_0x1053('0x18')](_0x46fbdf);}else{logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x6d'),util[_0x1053('0x27')](_0x268ee5,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2642bf){logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate','bandwidth',util[_0x1053('0x27')](_0x2642bf,{'showHidden':![],'depth':null}));});}else{logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x6d'),_0x1053('0x39'));}break;case _0x1053('0x72'):if(_0x3c60a4[_0x1053('0x63')]){var _0xa7ed59={};var _0x3e1cfa={'method':_0x1053('0x32'),'uri':_0x1053('0x73'),'headers':{'Authorization':_0x1053('0x74')+_0x3c60a4['apiKey'],'Content-Type':'application/json'},'body':{'from':_0x3c60a4[_0x1053('0x20')],'to':_0x430887['phone'],'text':_0x430887[_0x1053('0xd')]},'json':!![]};return rp(_0x3e1cfa)[_0x1053('0x1d')](function(_0xee340a){if(_0xee340a[_0x1053('0x75')]==0xca){_0xa7ed59[_0x1053('0x76')]=_0xee340a;var _0x2d2162={'method':_0x1053('0x32'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x1053('0x74')+_0x3c60a4[_0x1053('0x63')],'Content-Type':'application/json'},'body':{'refid':_0xa7ed59['message'][_0x1053('0x77')]},'json':!![]};return rp(_0x2d2162)[_0x1053('0x1d')](function(_0xe566c1){_0xa7ed59[_0x1053('0x78')]=_0xe566c1;var _0x2129c7={'messageId':_0xa7ed59[_0x1053('0x76')][_0x1053('0x77')],'read':!![]};return _0x984d73[_0x1053('0x18')](_0x2129c7);});}else{return logger[_0x1053('0x1a')](_0x1053('0x25'),'afterCreate',_0x1053('0x72'),util[_0x1053('0x27')](_0xee340a,{'showHidden':![],'depth':null}));}})[_0x1053('0x38')](function(_0x1a6797){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1053('0x72'),util['inspect'](_0x1a6797,{'showHidden':![],'depth':null}));});}else{return logger[_0x1053('0x1a')](_0x1053('0x25'),_0x1053('0x26'),_0x1053('0x72'),'Token\x20not\x20received');}break;}}})[_0x1053('0x79')](function(){_0x456de8();});}else{_0x456de8();}}},'charset':_0x1053('0x7a'),'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 629db11..90af3ee 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 _0x44b2=['register','request','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x2a579b,_0x585746){var _0x570cb5=function(_0x2a143c){while(--_0x2a143c){_0x2a579b['push'](_0x2a579b['shift']());}};_0x570cb5(++_0x585746);}(_0x44b2,0x9f));var _0x244b=function(_0x891b81,_0xfbb107){_0x891b81=_0x891b81-0x0;var _0x585932=_0x44b2[_0x891b81];return _0x585932;};'use strict';var _=require(_0x244b('0x0'));var util=require(_0x244b('0x1'));var moment=require(_0x244b('0x2'));var BPromise=require(_0x244b('0x3'));var rs=require(_0x244b('0x4'));var fs=require('fs');var Redis=require(_0x244b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x244b('0x6'));var logger=require(_0x244b('0x7'))('rpc');var config=require(_0x244b('0x8'));var jayson=require(_0x244b('0x9'));var client=jayson[_0x244b('0xa')]['http']({'port':0x232a});config['redis']=_[_0x244b('0xb')](config[_0x244b('0xc')],{'host':_0x244b('0xd'),'port':0x18eb});var socket=require(_0x244b('0xe'))(new Redis(config[_0x244b('0xc')]));require(_0x244b('0xf'))[_0x244b('0x10')](socket);function respondWithRpcPromise(_0x20f6b9,_0x29c49f,_0x4aea43){return new BPromise(function(_0x161569,_0x3287c9){return client[_0x244b('0x11')](_0x20f6b9,_0x4aea43)[_0x244b('0x12')](function(_0x528d9e){logger['info'](_0x244b('0x13'),_0x29c49f,'request\x20sent');logger[_0x244b('0x14')](_0x244b('0x15'),_0x29c49f,_0x244b('0x16'),JSON['stringify'](_0x528d9e));if(_0x528d9e['error']){if(_0x528d9e[_0x244b('0x17')][_0x244b('0x18')]===0x1f4){logger[_0x244b('0x17')](_0x244b('0x13'),_0x29c49f,_0x528d9e[_0x244b('0x17')][_0x244b('0x19')]);return _0x3287c9(_0x528d9e[_0x244b('0x17')][_0x244b('0x19')]);}logger[_0x244b('0x17')](_0x244b('0x13'),_0x29c49f,_0x528d9e[_0x244b('0x17')][_0x244b('0x19')]);return _0x161569(_0x528d9e[_0x244b('0x17')][_0x244b('0x19')]);}else{logger['info'](_0x244b('0x13'),_0x29c49f,_0x244b('0x16'));_0x161569(_0x528d9e[_0x244b('0x1a')][_0x244b('0x19')]);}})[_0x244b('0x1b')](function(_0x1e6371){logger['error'](_0x244b('0x13'),_0x29c49f,_0x1e6371);_0x3287c9(_0x1e6371);});});}exports[_0x244b('0x1c')]=function(_0x188a33){var _0x17695e=this;return new Promise(function(_0x471162,_0x251a4d){return db[_0x244b('0x1d')][_0x244b('0x1e')](_0x188a33[_0x244b('0x1f')],{'raw':_0x188a33[_0x244b('0x20')]?_0x188a33[_0x244b('0x20')]['raw']===undefined?!![]:![]:!![]})[_0x244b('0x12')](function(_0x355bb8){logger[_0x244b('0x21')](_0x244b('0x1c'),_0x188a33);logger[_0x244b('0x14')](_0x244b('0x1c'),_0x188a33,JSON[_0x244b('0x22')](_0x355bb8));_0x471162(_0x355bb8);})[_0x244b('0x1b')](function(_0x218441){logger['error']('CreateSmsMessage',_0x218441['message'],_0x188a33);_0x251a4d(_0x17695e['error'](0x1f4,_0x218441[_0x244b('0x19')]));});});}; \ No newline at end of file +var _0x5ed0=['lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','SmsMessage,\x20%s,\x20%s','info','result','CreateSmsMessage','SmsMessage','create','body','options','raw','catch'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5ed0,0x136));var _0x05ed=function(_0x19118c,_0x5f5426){_0x19118c=_0x19118c-0x0;var _0xf84ee9=_0x5ed0[_0x19118c];return _0xf84ee9;};'use strict';var _=require(_0x05ed('0x0'));var util=require(_0x05ed('0x1'));var moment=require(_0x05ed('0x2'));var BPromise=require(_0x05ed('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05ed('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x05ed('0x5'));var config=require('../../config/environment');var jayson=require(_0x05ed('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x05ed('0x7')](config[_0x05ed('0x8')],{'host':_0x05ed('0x9'),'port':0x18eb});var socket=require(_0x05ed('0xa'))(new Redis(config[_0x05ed('0x8')]));require(_0x05ed('0xb'))[_0x05ed('0xc')](socket);function respondWithRpcPromise(_0x45ff5f,_0x350c8d,_0x55498b){return new BPromise(function(_0x72e46f,_0x5356f7){return client[_0x05ed('0xd')](_0x45ff5f,_0x55498b)[_0x05ed('0xe')](function(_0x4d71b2){logger['info']('SmsMessage,\x20%s,\x20%s',_0x350c8d,'request\x20sent');logger[_0x05ed('0xf')](_0x05ed('0x10'),_0x350c8d,_0x05ed('0x11'),JSON[_0x05ed('0x12')](_0x4d71b2));if(_0x4d71b2[_0x05ed('0x13')]){if(_0x4d71b2[_0x05ed('0x13')]['code']===0x1f4){logger[_0x05ed('0x13')]('SmsMessage,\x20%s,\x20%s',_0x350c8d,_0x4d71b2['error'][_0x05ed('0x14')]);return _0x5356f7(_0x4d71b2[_0x05ed('0x13')]['message']);}logger[_0x05ed('0x13')](_0x05ed('0x15'),_0x350c8d,_0x4d71b2[_0x05ed('0x13')]['message']);return _0x72e46f(_0x4d71b2[_0x05ed('0x13')]['message']);}else{logger[_0x05ed('0x16')]('SmsMessage,\x20%s,\x20%s',_0x350c8d,_0x05ed('0x11'));_0x72e46f(_0x4d71b2[_0x05ed('0x17')][_0x05ed('0x14')]);}})['catch'](function(_0x43c265){logger[_0x05ed('0x13')](_0x05ed('0x15'),_0x350c8d,_0x43c265);_0x5356f7(_0x43c265);});});}exports[_0x05ed('0x18')]=function(_0x494615){var _0x4262bd=this;return new Promise(function(_0x3f3d65,_0x4c48ec){return db[_0x05ed('0x19')][_0x05ed('0x1a')](_0x494615[_0x05ed('0x1b')],{'raw':_0x494615['options']?_0x494615[_0x05ed('0x1c')][_0x05ed('0x1d')]===undefined?!![]:![]:!![]})[_0x05ed('0xe')](function(_0x5904b6){logger[_0x05ed('0x16')](_0x05ed('0x18'),_0x494615);logger[_0x05ed('0xf')]('CreateSmsMessage',_0x494615,JSON[_0x05ed('0x12')](_0x5904b6));_0x3f3d65(_0x5904b6);})[_0x05ed('0x1e')](function(_0x4c7182){logger[_0x05ed('0x13')](_0x05ed('0x18'),_0x4c7182[_0x05ed('0x14')],_0x494615);_0x4c48ec(_0x4262bd[_0x05ed('0x13')](0x1f4,_0x4c7182[_0x05ed('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 725854a..286057f 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 _0x511e=['length','smsMessage:','./smsMessage.events','save','remove','update','removeListener'];(function(_0x5a49c5,_0x39a350){var _0x29b69b=function(_0x44ed94){while(--_0x44ed94){_0x5a49c5['push'](_0x5a49c5['shift']());}};_0x29b69b(++_0x39a350);}(_0x511e,0x160));var _0xe511=function(_0x1ab313,_0x12bccc){_0x1ab313=_0x1ab313-0x0;var _0x2d73f4=_0x511e[_0x1ab313];return _0x2d73f4;};'use strict';var SmsMessageEvents=require(_0xe511('0x0'));var events=[_0xe511('0x1'),_0xe511('0x2'),_0xe511('0x3')];function createListener(_0x114411,_0x2c404e){return function(_0x40673a){_0x2c404e['emit'](_0x114411,_0x40673a);};}function removeListener(_0x5b0c58,_0x27ef3e){return function(){SmsMessageEvents[_0xe511('0x4')](_0x5b0c58,_0x27ef3e);};}exports['register']=function(_0x170dd3){for(var _0xeefe55=0x0,_0x22a108=events[_0xe511('0x5')];_0xeefe55<_0x22a108;_0xeefe55++){var _0x403946=events[_0xeefe55];var _0x4ea1cb=createListener(_0xe511('0x6')+_0x403946,_0x170dd3);SmsMessageEvents['on'](_0x403946,_0x4ea1cb);}}; \ No newline at end of file +var _0x82d2=['save','remove','update','emit','register','length','smsMessage:','./smsMessage.events'];(function(_0x35fabd,_0x825452){var _0x61a8ee=function(_0x218f4c){while(--_0x218f4c){_0x35fabd['push'](_0x35fabd['shift']());}};_0x61a8ee(++_0x825452);}(_0x82d2,0x18f));var _0x282d=function(_0x14ef5d,_0x381788){_0x14ef5d=_0x14ef5d-0x0;var _0x527774=_0x82d2[_0x14ef5d];return _0x527774;};'use strict';var SmsMessageEvents=require(_0x282d('0x0'));var events=[_0x282d('0x1'),_0x282d('0x2'),_0x282d('0x3')];function createListener(_0x31ecc9,_0x298f1a){return function(_0x541a80){_0x298f1a[_0x282d('0x4')](_0x31ecc9,_0x541a80);};}function removeListener(_0x54cfd9,_0x5447f0){return function(){SmsMessageEvents['removeListener'](_0x54cfd9,_0x5447f0);};}exports[_0x282d('0x5')]=function(_0x5e472e){for(var _0x1fb842=0x0,_0x525b8d=events[_0x282d('0x6')];_0x1fb842<_0x525b8d;_0x1fb842++){var _0x544768=events[_0x1fb842];var _0x509316=createListener(_0x282d('0x7')+_0x544768,_0x5e472e);SmsMessageEvents['on'](_0x544768,_0x509316);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 8224da2..faef86b 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 _0xac3c=['removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams'];(function(_0x1cb1bc,_0x503873){var _0x57f363=function(_0x4a201b){while(--_0x4a201b){_0x1cb1bc['push'](_0x1cb1bc['shift']());}};_0x57f363(++_0x503873);}(_0xac3c,0x195));var _0xcac3=function(_0x4e3370,_0x1d87c8){_0x4e3370=_0x4e3370-0x0;var _0x13d926=_0xac3c[_0x4e3370];return _0x13d926;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcac3('0x0'));var timeout=require(_0xcac3('0x1'));var express=require(_0xcac3('0x2'));var router=express[_0xcac3('0x3')]();var fs_extra=require(_0xcac3('0x4'));var auth=require(_0xcac3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcac3('0x6'));var controller=require(_0xcac3('0x7'));router[_0xcac3('0x8')]('/',auth[_0xcac3('0x9')](),controller[_0xcac3('0xa')]);router[_0xcac3('0x8')]('/describe',auth[_0xcac3('0x9')](),controller[_0xcac3('0xb')]);router[_0xcac3('0x8')](_0xcac3('0xc'),auth[_0xcac3('0x9')](),controller[_0xcac3('0xd')]);router['get'](_0xcac3('0xe'),auth[_0xcac3('0x9')](),controller[_0xcac3('0xf')]);router[_0xcac3('0x8')](_0xcac3('0x10'),auth[_0xcac3('0x9')](),controller[_0xcac3('0x11')]);router['get'](_0xcac3('0x12'),auth[_0xcac3('0x9')](),controller[_0xcac3('0x13')]);router[_0xcac3('0x14')]('/',auth[_0xcac3('0x9')](),controller[_0xcac3('0x15')]);router['post']('/:id/teams',auth[_0xcac3('0x9')](),controller[_0xcac3('0x16')]);router['post'](_0xcac3('0x12'),auth[_0xcac3('0x9')](),controller[_0xcac3('0x17')]);router[_0xcac3('0x18')](_0xcac3('0xc'),auth[_0xcac3('0x9')](),controller[_0xcac3('0x19')]);router['delete'](_0xcac3('0xc'),auth['isAuthenticated'](),controller[_0xcac3('0x1a')]);router[_0xcac3('0x1b')](_0xcac3('0x10'),auth['isAuthenticated'](),controller[_0xcac3('0x1c')]);router[_0xcac3('0x1b')](_0xcac3('0x12'),auth[_0xcac3('0x9')](),controller[_0xcac3('0x1d')]);module[_0xcac3('0x1e')]=router; \ No newline at end of file +var _0xc02f=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsQueue.controller','index','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','addAgents','put','update','delete','/:id/users','removeAgents','exports','multer','util'];(function(_0x1d39f8,_0x182897){var _0x411e54=function(_0x1bd1c6){while(--_0x1bd1c6){_0x1d39f8['push'](_0x1d39f8['shift']());}};_0x411e54(++_0x182897);}(_0xc02f,0x6e));var _0xfc02=function(_0x124ec3,_0x689d4){_0x124ec3=_0x124ec3-0x0;var _0x5c2b74=_0xc02f[_0x124ec3];return _0x5c2b74;};'use strict';var multer=require(_0xfc02('0x0'));var util=require(_0xfc02('0x1'));var path=require(_0xfc02('0x2'));var timeout=require(_0xfc02('0x3'));var express=require(_0xfc02('0x4'));var router=express[_0xfc02('0x5')]();var fs_extra=require(_0xfc02('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfc02('0x7'));var config=require('../../config/environment');var controller=require(_0xfc02('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfc02('0x9')]);router[_0xfc02('0xa')]('/describe',auth[_0xfc02('0xb')](),controller[_0xfc02('0xc')]);router['get'](_0xfc02('0xd'),auth[_0xfc02('0xb')](),controller[_0xfc02('0xe')]);router[_0xfc02('0xa')](_0xfc02('0xf'),auth[_0xfc02('0xb')](),controller[_0xfc02('0x10')]);router[_0xfc02('0xa')](_0xfc02('0x11'),auth[_0xfc02('0xb')](),controller['getTeams']);router['get']('/:id/users',auth[_0xfc02('0xb')](),controller[_0xfc02('0x12')]);router[_0xfc02('0x13')]('/',auth[_0xfc02('0xb')](),controller[_0xfc02('0x14')]);router[_0xfc02('0x13')](_0xfc02('0x11'),auth[_0xfc02('0xb')](),controller['addTeams']);router[_0xfc02('0x13')]('/:id/users',auth[_0xfc02('0xb')](),controller[_0xfc02('0x15')]);router[_0xfc02('0x16')](_0xfc02('0xd'),auth[_0xfc02('0xb')](),controller[_0xfc02('0x17')]);router['delete'](_0xfc02('0xd'),auth[_0xfc02('0xb')](),controller['destroy']);router[_0xfc02('0x18')]('/:id/teams',auth[_0xfc02('0xb')](),controller['removeTeams']);router[_0xfc02('0x18')](_0xfc02('0x19'),auth['isAuthenticated'](),controller[_0xfc02('0x1a')]);module[_0xfc02('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 63e25b7..6ec7598 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 _0xbef7=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x468147,_0x52533e){var _0x13de08=function(_0x429fbd){while(--_0x429fbd){_0x468147['push'](_0x468147['shift']());}};_0x13de08(++_0x52533e);}(_0xbef7,0x169));var _0x7bef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbef7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7bef('0x0'));module[_0x7bef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7bef('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x7bef('0x3')]},'timeout':{'type':Sequelize[_0x7bef('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x7bef('0x5')](_0x7bef('0x6'),_0x7bef('0x7'),_0x7bef('0x8'))}}; \ No newline at end of file +var _0x7846=['exports','STRING','name','roundrobin','sequelize'];(function(_0x183b56,_0x4c8b87){var _0x5b54fc=function(_0x46fff4){while(--_0x46fff4){_0x183b56['push'](_0x183b56['shift']());}};_0x5b54fc(++_0x4c8b87);}(_0x7846,0x1a3));var _0x6784=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x7846[_0x1646fa];return _0x5a47a5;};'use strict';var Sequelize=require(_0x6784('0x0'));module[_0x6784('0x1')]={'name':{'type':Sequelize[_0x6784('0x2')],'unique':_0x6784('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6784('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory','beepall',_0x6784('0x4'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 558be69..beb32ca 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 _0x10df=['SmsQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','include','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','findOne','UserSmsQueue','order','SmsQueueId','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','select','field','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','all','union','compact','value','removeAgents','addAgents','omit','spread','userSmsQueue:save','userSmsQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsQueue.socket','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','send','index','map'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x10df,0x178));var _0xf10d=function(_0x44029c,_0x426690){_0x44029c=_0x44029c-0x0;var _0x547fa1=_0x10df[_0x44029c];return _0x547fa1;};'use strict';var emlformat=require(_0xf10d('0x0'));var rimraf=require(_0xf10d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf10d('0x2'));var rp=require('request-promise');var moment=require(_0xf10d('0x3'));var BPromise=require(_0xf10d('0x4'));var Mustache=require('mustache');var util=require(_0xf10d('0x5'));var path=require(_0xf10d('0x6'));var sox=require(_0xf10d('0x7'));var csv=require(_0xf10d('0x8'));var ejs=require(_0xf10d('0x9'));var fs=require('fs');var fs_extra=require(_0xf10d('0xa'));var _=require(_0xf10d('0xb'));var squel=require(_0xf10d('0xc'));var crypto=require(_0xf10d('0xd'));var jsforce=require(_0xf10d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf10d('0x8'));var querystring=require(_0xf10d('0xf'));var Papa=require(_0xf10d('0x10'));var Redis=require(_0xf10d('0x11'));var authService=require(_0xf10d('0x12'));var qs=require(_0xf10d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf10d('0x14'));var logger=require(_0xf10d('0x15'))(_0xf10d('0x16'));var utils=require('../../config/utils');var config=require(_0xf10d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf10d('0x18'))['db'];config['redis']=_[_0xf10d('0x19')](config[_0xf10d('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xf10d('0x1b'))(new Redis(config[_0xf10d('0x1a')]));require(_0xf10d('0x1c'))['register'](socket);function respondWithStatusCode(_0x440a3d,_0xc4c829){_0xc4c829=_0xc4c829||0xcc;return function(_0x546371){if(_0x546371){return _0x440a3d[_0xf10d('0x1d')](_0xc4c829);}return _0x440a3d['status'](_0xc4c829)[_0xf10d('0x1e')]();};}function respondWithResult(_0x5590c3,_0x5c2356){_0x5c2356=_0x5c2356||0xc8;return function(_0x4d9ba1){if(_0x4d9ba1){return _0x5590c3[_0xf10d('0x1f')](_0x5c2356)['json'](_0x4d9ba1);}};}function respondWithFilteredResult(_0x9a539f,_0x369464){return function(_0x1e235a){if(_0x1e235a){var _0x43a8a7=typeof _0x369464[_0xf10d('0x20')]===_0xf10d('0x21')&&typeof _0x369464[_0xf10d('0x22')]==='undefined';var _0x459edc=_0x1e235a[_0xf10d('0x23')];var _0x2ceefc=_0x43a8a7?0x0:_0x369464[_0xf10d('0x20')];var _0x1dee10=_0x43a8a7?_0x1e235a['count']:_0x369464[_0xf10d('0x20')]+_0x369464[_0xf10d('0x22')];var _0x1b15ba;if(_0x1dee10>=_0x459edc){_0x1dee10=_0x459edc;_0x1b15ba=0xc8;}else{_0x1b15ba=0xce;}_0x9a539f['status'](_0x1b15ba);return _0x9a539f[_0xf10d('0x24')](_0xf10d('0x25'),_0x2ceefc+'-'+_0x1dee10+'/'+_0x459edc)[_0xf10d('0x26')](_0x1e235a);}return null;};}function patchUpdates(_0x3c6637){return function(_0x458f4f){try{jsonpatch[_0xf10d('0x27')](_0x458f4f,_0x3c6637,!![]);}catch(_0x4a4319){return BPromise[_0xf10d('0x28')](_0x4a4319);}return _0x458f4f['save']();};}function saveUpdates(_0x1ad6a6,_0x3f8e3e){return function(_0x22b40c){if(_0x22b40c){return _0x22b40c[_0xf10d('0x29')](_0x1ad6a6)[_0xf10d('0x2a')](function(_0x10c163){return _0x10c163;});}return null;};}function removeEntity(_0x1bc244,_0x52dcb8){return function(_0x20b1a8){if(_0x20b1a8){return _0x20b1a8[_0xf10d('0x2b')]()[_0xf10d('0x2a')](function(){var _0x490fec=_0x20b1a8[_0xf10d('0x2c')]({'plain':!![]});var _0x508d05=_0xf10d('0x2d');return db[_0xf10d('0x2e')][_0xf10d('0x2b')]({'where':{'type':_0x508d05,'resourceId':_0x490fec['id']}})[_0xf10d('0x2a')](function(){return _0x20b1a8;});})['then'](function(){_0x1bc244['status'](0xcc)[_0xf10d('0x1e')]();});}};}function handleEntityNotFound(_0x32b133,_0x24efdf){return function(_0x23ca47){if(!_0x23ca47){_0x32b133[_0xf10d('0x1d')](0x194);}return _0x23ca47;};}function handleError(_0x2c375a,_0x29719f){_0x29719f=_0x29719f||0x1f4;return function(_0x3c6ac3){logger[_0xf10d('0x2f')](_0x3c6ac3[_0xf10d('0x30')]);if(_0x3c6ac3[_0xf10d('0x31')]){delete _0x3c6ac3[_0xf10d('0x31')];}_0x2c375a['status'](_0x29719f)[_0xf10d('0x32')](_0x3c6ac3);};}exports[_0xf10d('0x33')]=function(_0x6e6b7f,_0x5a3287){var _0x1cb9ef={},_0x402168={},_0x30747b={'count':0x0,'rows':[]};var _0x35ac75=_[_0xf10d('0x34')](db[_0xf10d('0x35')][_0xf10d('0x36')],function(_0xb479e2){return{'name':_0xb479e2[_0xf10d('0x37')],'type':_0xb479e2[_0xf10d('0x38')][_0xf10d('0x39')]};});_0x402168[_0xf10d('0x3a')]=_[_0xf10d('0x34')](_0x35ac75,_0xf10d('0x31'));_0x402168[_0xf10d('0x3b')]=_['keys'](_0x6e6b7f['query']);_0x402168[_0xf10d('0x3c')]=_[_0xf10d('0x3d')](_0x402168['model'],_0x402168[_0xf10d('0x3b')]);_0x1cb9ef[_0xf10d('0x3e')]=_[_0xf10d('0x3d')](_0x402168[_0xf10d('0x3a')],qs[_0xf10d('0x3f')](_0x6e6b7f['query'][_0xf10d('0x3f')]));_0x1cb9ef[_0xf10d('0x3e')]=_0x1cb9ef[_0xf10d('0x3e')][_0xf10d('0x40')]?_0x1cb9ef[_0xf10d('0x3e')]:_0x402168[_0xf10d('0x3a')];if(!_0x6e6b7f[_0xf10d('0x3b')][_0xf10d('0x41')](_0xf10d('0x42'))){_0x1cb9ef['limit']=qs[_0xf10d('0x22')](_0x6e6b7f[_0xf10d('0x3b')]['limit']);_0x1cb9ef[_0xf10d('0x20')]=qs[_0xf10d('0x20')](_0x6e6b7f[_0xf10d('0x3b')][_0xf10d('0x20')]);}_0x1cb9ef['order']=qs[_0xf10d('0x43')](_0x6e6b7f['query'][_0xf10d('0x43')]);_0x1cb9ef[_0xf10d('0x44')]=qs['filters'](_[_0xf10d('0x45')](_0x6e6b7f[_0xf10d('0x3b')],_0x402168[_0xf10d('0x3c')]),_0x35ac75);if(_0x6e6b7f[_0xf10d('0x3b')][_0xf10d('0x46')]){_0x1cb9ef['where']=_[_0xf10d('0x47')](_0x1cb9ef['where'],{'$or':_[_0xf10d('0x34')](_0x35ac75,function(_0x3c0b36){if(_0x3c0b36['type']!==_0xf10d('0x48')){var _0x45af91={};_0x45af91[_0x3c0b36[_0xf10d('0x31')]]={'$like':'%'+_0x6e6b7f[_0xf10d('0x3b')]['filter']+'%'};return _0x45af91;}})});}_0x1cb9ef=_[_0xf10d('0x47')]({},_0x1cb9ef,_0x6e6b7f['options']);var _0x5401f1={'where':_0x1cb9ef[_0xf10d('0x44')]};return db[_0xf10d('0x35')]['count'](_0x5401f1)[_0xf10d('0x2a')](function(_0x2d7987){_0x30747b[_0xf10d('0x23')]=_0x2d7987;if(_0x6e6b7f['query'][_0xf10d('0x49')]){_0x1cb9ef['include']=[{'all':!![]}];}return db[_0xf10d('0x35')][_0xf10d('0x4a')](_0x1cb9ef);})[_0xf10d('0x2a')](function(_0x5c3299){_0x30747b[_0xf10d('0x4b')]=_0x5c3299;return _0x30747b;})['then'](respondWithFilteredResult(_0x5a3287,_0x1cb9ef))[_0xf10d('0x4c')](handleError(_0x5a3287,null));};exports[_0xf10d('0x4d')]=function(_0x41f611,_0x547ce7){var _0x3fce11={'raw':!![],'where':{'id':_0x41f611[_0xf10d('0x4e')]['id']}},_0x50be36={};_0x50be36['model']=_['keys'](db['SmsQueue'][_0xf10d('0x36')]);_0x50be36[_0xf10d('0x3b')]=_[_0xf10d('0x4f')](_0x41f611['query']);_0x50be36[_0xf10d('0x3c')]=_[_0xf10d('0x3d')](_0x50be36[_0xf10d('0x3a')],_0x50be36[_0xf10d('0x3b')]);_0x3fce11[_0xf10d('0x3e')]=_[_0xf10d('0x3d')](_0x50be36['model'],qs['fields'](_0x41f611[_0xf10d('0x3b')][_0xf10d('0x3f')]));_0x3fce11[_0xf10d('0x3e')]=_0x3fce11[_0xf10d('0x3e')]['length']?_0x3fce11['attributes']:_0x50be36[_0xf10d('0x3a')];if(_0x41f611[_0xf10d('0x3b')]['includeAll']){_0x3fce11[_0xf10d('0x50')]=[{'all':!![]}];}_0x3fce11=_[_0xf10d('0x47')]({},_0x3fce11,_0x41f611[_0xf10d('0x51')]);return db[_0xf10d('0x35')][_0xf10d('0x52')](_0x3fce11)['then'](handleEntityNotFound(_0x547ce7,null))['then'](respondWithResult(_0x547ce7,null))[_0xf10d('0x4c')](handleError(_0x547ce7,null));};exports[_0xf10d('0x53')]=function(_0x5bea7a,_0x292a39){return db[_0xf10d('0x35')][_0xf10d('0x53')](_0x5bea7a[_0xf10d('0x54')],{})[_0xf10d('0x2a')](function(_0x55f3fe){var _0x2c3df4=_0x5bea7a[_0xf10d('0x55')][_0xf10d('0x2c')]({'plain':!![]});if(!_0x2c3df4)throw new Error(_0xf10d('0x56'));if(_0x2c3df4[_0xf10d('0x57')]===_0xf10d('0x55')){var _0x37d772=_0x55f3fe['get']({'plain':!![]});var _0x45435b=_0xf10d('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x45435b,'userProfileId':_0x2c3df4['userProfileId']},'raw':!![]})['then'](function(_0x4f1b3c){if(_0x4f1b3c&&_0x4f1b3c[_0xf10d('0x58')]===0x0){return db[_0xf10d('0x2e')][_0xf10d('0x53')]({'name':_0x37d772[_0xf10d('0x31')],'resourceId':_0x37d772['id'],'type':_0x4f1b3c[_0xf10d('0x31')],'sectionId':_0x4f1b3c['id']},{})[_0xf10d('0x2a')](function(){return _0x55f3fe;});}else{return _0x55f3fe;}})[_0xf10d('0x4c')](function(_0x114b2e){logger[_0xf10d('0x2f')](_0xf10d('0x59'),_0x114b2e);throw _0x114b2e;});}return _0x55f3fe;})[_0xf10d('0x2a')](respondWithResult(_0x292a39,0xc9))[_0xf10d('0x4c')](handleError(_0x292a39,null));};exports['update']=function(_0x30d5fa,_0x144977){if(_0x30d5fa[_0xf10d('0x54')]['id']){delete _0x30d5fa[_0xf10d('0x54')]['id'];}return db[_0xf10d('0x35')][_0xf10d('0x52')]({'where':{'id':_0x30d5fa[_0xf10d('0x4e')]['id']}})[_0xf10d('0x2a')](handleEntityNotFound(_0x144977,null))[_0xf10d('0x2a')](saveUpdates(_0x30d5fa[_0xf10d('0x54')],null))[_0xf10d('0x2a')](respondWithResult(_0x144977,null))[_0xf10d('0x4c')](handleError(_0x144977,null));};exports['destroy']=function(_0x4d0ee0,_0x5aa64d){return db[_0xf10d('0x35')][_0xf10d('0x52')]({'where':{'id':_0x4d0ee0['params']['id']}})[_0xf10d('0x2a')](handleEntityNotFound(_0x5aa64d,null))[_0xf10d('0x2a')](removeEntity(_0x5aa64d,null))[_0xf10d('0x4c')](handleError(_0x5aa64d,null));};exports['describe']=function(_0x231545,_0x5215eb){return db[_0xf10d('0x35')][_0xf10d('0x5a')]()[_0xf10d('0x2a')](respondWithResult(_0x5215eb,null))['catch'](handleError(_0x5215eb,null));};exports['getMembers']=function(_0x40c8d9,_0x12d3f2,_0x4f49c6){var _0x255292={'raw':!![],'where':{}},_0x30655d={},_0x2335b6;return db[_0xf10d('0x35')][_0xf10d('0x5b')]({'where':{'id':_0x40c8d9[_0xf10d('0x4e')]['id']}})[_0xf10d('0x2a')](handleEntityNotFound(_0x12d3f2,null))[_0xf10d('0x2a')](function(_0x3c75b7){if(_0x3c75b7){_0x2335b6=_0x3c75b7[_0xf10d('0x2c')]({'plain':!![]});_0x30655d[_0xf10d('0x3a')]=_[_0xf10d('0x4f')](db[_0xf10d('0x5c')][_0xf10d('0x36')]);_0x30655d['query']=_[_0xf10d('0x4f')](_0x40c8d9[_0xf10d('0x3b')]);_0x30655d['filters']=_['intersection'](_0x30655d[_0xf10d('0x3a')],_0x30655d[_0xf10d('0x3b')]);_0x255292[_0xf10d('0x3e')]=_[_0xf10d('0x3d')](_0x30655d[_0xf10d('0x3a')],qs['fields'](_0x40c8d9[_0xf10d('0x3b')]['fields']));_0x255292[_0xf10d('0x3e')]=_0x255292[_0xf10d('0x3e')][_0xf10d('0x40')]?_0x255292[_0xf10d('0x3e')]:_0x30655d[_0xf10d('0x3a')];if(!_0x40c8d9['query'][_0xf10d('0x41')](_0xf10d('0x42'))){_0x255292[_0xf10d('0x22')]=qs[_0xf10d('0x22')](_0x40c8d9[_0xf10d('0x3b')][_0xf10d('0x22')]);_0x255292['offset']=qs[_0xf10d('0x20')](_0x40c8d9[_0xf10d('0x3b')]['offset']);}_0x255292[_0xf10d('0x5d')]=qs[_0xf10d('0x43')](_0x40c8d9['query'][_0xf10d('0x43')]);_0x255292[_0xf10d('0x44')]=qs[_0xf10d('0x3c')](_[_0xf10d('0x45')](_0x40c8d9[_0xf10d('0x3b')],_0x30655d[_0xf10d('0x3c')]));_0x255292[_0xf10d('0x44')][_0xf10d('0x5e')]=_0x3c75b7['id'];if(_0x40c8d9[_0xf10d('0x3b')]['filter']){_0x255292[_0xf10d('0x44')]=_[_0xf10d('0x47')](_0x255292[_0xf10d('0x44')],{'$or':_[_0xf10d('0x34')](_0x255292[_0xf10d('0x3e')],function(_0x3df1a7){var _0x311d41={};_0x311d41[_0x3df1a7]={'$like':'%'+_0x40c8d9['query'][_0xf10d('0x46')]+'%'};return _0x311d41;})});}_0x255292=_[_0xf10d('0x47')]({},_0x255292,_0x40c8d9[_0xf10d('0x51')]);return db[_0xf10d('0x5c')]['findAll'](_0x255292);}})[_0xf10d('0x2a')](function(_0x457a4c){if(_0x457a4c){return db[_0xf10d('0x5f')][_0xf10d('0x60')]({'where':{'id':_[_0xf10d('0x34')](_0x457a4c,_0xf10d('0x61')),'role':_0xf10d('0x62')},'attributes':['id',_0xf10d('0x31'),_0xf10d('0x63'),_0xf10d('0x64'),_0xf10d('0x65')]});}})[_0xf10d('0x2a')](function(_0x160dc0){if(_0x160dc0){return{'count':_0x160dc0[_0xf10d('0x23')],'rows':_[_0xf10d('0x34')](_0x160dc0[_0xf10d('0x4b')],function(_0x188c5f){return{'membername':_0x188c5f[_0xf10d('0x31')],'UserId':_0x188c5f['id'],'queue_name':_0x2335b6['name'],'SmsQueueId':_0x2335b6['id'],'interface':util[_0xf10d('0x66')]('%s/%s',_0xf10d('0x67'),_0x188c5f[_0xf10d('0x31')]),'penalty':0x0,'paused':_0x188c5f[_0xf10d('0x63')],'createdAt':_0x188c5f['createdAt'],'updatedAt':_0x188c5f[_0xf10d('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf10d('0x2a')](respondWithFilteredResult(_0x12d3f2,_0x255292))[_0xf10d('0x4c')](handleError(_0x12d3f2,null));};exports[_0xf10d('0x68')]=function(_0x1dc7d1,_0xa6e9b3,_0x569010){var _0x1a82c5={};var _0x383185={};var _0x1a888e;var _0x3cd103;return db['SmsQueue'][_0xf10d('0x5b')]({'where':{'id':_0x1dc7d1[_0xf10d('0x4e')]['id']}})[_0xf10d('0x2a')](handleEntityNotFound(_0xa6e9b3,null))[_0xf10d('0x2a')](function(_0x378c62){if(_0x378c62){_0x1a888e=_0x378c62;_0x383185['model']=_['keys'](db[_0xf10d('0x69')][_0xf10d('0x36')]);_0x383185[_0xf10d('0x3b')]=_[_0xf10d('0x4f')](_0x1dc7d1[_0xf10d('0x3b')]);_0x383185['filters']=_[_0xf10d('0x3d')](_0x383185['model'],_0x383185[_0xf10d('0x3b')]);_0x1a82c5[_0xf10d('0x3e')]=_[_0xf10d('0x3d')](_0x383185[_0xf10d('0x3a')],qs[_0xf10d('0x3f')](_0x1dc7d1[_0xf10d('0x3b')][_0xf10d('0x3f')]));_0x1a82c5[_0xf10d('0x3e')]=_0x1a82c5[_0xf10d('0x3e')][_0xf10d('0x40')]?_0x1a82c5[_0xf10d('0x3e')]:_0x383185[_0xf10d('0x3a')];_0x1a82c5[_0xf10d('0x5d')]=qs[_0xf10d('0x43')](_0x1dc7d1[_0xf10d('0x3b')][_0xf10d('0x43')]);_0x1a82c5['where']=qs[_0xf10d('0x3c')](_[_0xf10d('0x45')](_0x1dc7d1[_0xf10d('0x3b')],_0x383185['filters']));if(_0x1dc7d1['query'][_0xf10d('0x46')]){_0x1a82c5[_0xf10d('0x44')]=_[_0xf10d('0x47')](_0x1a82c5[_0xf10d('0x44')],{'$or':_[_0xf10d('0x34')](_0x1a82c5['attributes'],function(_0x2d9925){var _0x11239f={};_0x11239f[_0x2d9925]={'$like':'%'+_0x1dc7d1['query'][_0xf10d('0x46')]+'%'};return _0x11239f;})});}_0x1a82c5=_[_0xf10d('0x47')]({},_0x1a82c5,_0x1dc7d1[_0xf10d('0x51')]);return _0x1a888e[_0xf10d('0x68')](_0x1a82c5);}})[_0xf10d('0x2a')](function(_0x4580c9){if(_0x4580c9){_0x3cd103=_0x4580c9[_0xf10d('0x40')];if(!_0x1dc7d1['query'][_0xf10d('0x41')](_0xf10d('0x42'))){_0x1a82c5[_0xf10d('0x22')]=qs[_0xf10d('0x22')](_0x1dc7d1[_0xf10d('0x3b')][_0xf10d('0x22')]);_0x1a82c5[_0xf10d('0x20')]=qs[_0xf10d('0x20')](_0x1dc7d1[_0xf10d('0x3b')][_0xf10d('0x20')]);}return _0x1a888e[_0xf10d('0x68')](_0x1a82c5);}})[_0xf10d('0x2a')](function(_0x5d68c0){if(_0x5d68c0){return _0x5d68c0?{'count':_0x3cd103,'rows':_0x5d68c0}:null;}})[_0xf10d('0x2a')](respondWithResult(_0xa6e9b3,null))[_0xf10d('0x4c')](handleError(_0xa6e9b3,null));};exports[_0xf10d('0x6a')]=function(_0x9749dd,_0x4e68a3,_0x1b7a2b){var _0x5e8939=_0x9749dd[_0xf10d('0x54')][_0xf10d('0x6b')];return db[_0xf10d('0x69')][_0xf10d('0x4a')]({'where':{'id':_0x5e8939},'attributes':['id'],'include':[{'model':db[_0xf10d('0x5f')],'as':_0xf10d('0x6c'),'attributes':['id',_0xf10d('0x31'),'online',_0xf10d('0x6d'),_0xf10d('0x6e')],'raw':!![]}]})[_0xf10d('0x2a')](function(_0x16f11b){if(_0x16f11b){var _0x3ab852=_[_0xf10d('0x6f')](_0x16f11b,function(_0x3f4c9c){var _0x1f161b=_0x3f4c9c[_0xf10d('0x2c')]({'plain':!![]});return _0x1f161b['Agents'];});return db[_0xf10d('0x35')][_0xf10d('0x52')]({'where':{'id':_0x9749dd['params']['id']}})['then'](function(_0x1959dc){return db['sequelize'][_0xf10d('0x70')](function(_0x26e7ab){return _0x1959dc[_0xf10d('0x6a')](_0x5e8939,{'transaction':_0x26e7ab})[_0xf10d('0x2a')](function(){return BPromise[_0xf10d('0x71')](_0x3ab852,function(_0x273a0f){return db[_0xf10d('0x5c')][_0xf10d('0x72')]({'where':{'UserId':_0x273a0f['id'],'SmsQueueId':_0x9749dd['params']['id']},'transaction':_0x26e7ab});});})[_0xf10d('0x2a')](function(){_0x3ab852[_0xf10d('0x73')](function(_0x327475){socket[_0xf10d('0x74')]('userSmsQueue:save',{'UserId':_0x327475['id'],'SmsQueueId':_0x1959dc['id']});});});});});}})[_0xf10d('0x2a')](respondWithStatusCode(_0x4e68a3,null))['catch'](handleError(_0x4e68a3,null));};exports[_0xf10d('0x75')]=function(_0xc35138,_0x559c66,_0x1d5674){return db['Team'][_0xf10d('0x4a')]({'where':{'id':_0xc35138[_0xf10d('0x3b')][_0xf10d('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xf10d('0x5f')],'as':_0xf10d('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x559c66,null))['then'](function(_0x1589b7){var _0x4a488e=_[_0xf10d('0x34')](_0x1589b7,'id');var _0x28e471=[];var _0x2745cd=[];var _0x38c9f2=squel[_0xf10d('0x76')]();_0x38c9f2[_0xf10d('0x77')]('tq.TeamId')[_0xf10d('0x78')](_0xf10d('0x79'),'tq')['join'](_0xf10d('0x7a'),'ut',_0xf10d('0x7b'))[_0xf10d('0x44')](_0xf10d('0x7c'),_0xc35138['params']['id']);for(var _0xe9216c=0x0;_0xe9216c<_0x1589b7['length'];_0xe9216c+=0x1){let _0x386f7b=_0x1589b7[_0xe9216c];for(var _0x24e231=0x0;_0x24e231<_0x386f7b[_0xf10d('0x6c')][_0xf10d('0x40')];_0x24e231+=0x1){let _0x58bf7e=_0x386f7b['Agents'][_0x24e231];var _0x28522f=_0x38c9f2[_0xf10d('0x7d')]();_0x28522f[_0xf10d('0x44')](_0xf10d('0x7e'),_0x58bf7e['id']);_0x2745cd[_0xf10d('0x7f')](db[_0xf10d('0x80')][_0xf10d('0x3b')](_0x28522f['toString'](),{'type':db['sequelize'][_0xf10d('0x81')][_0xf10d('0x82')]})[_0xf10d('0x2a')](function(_0x55d34d){if(_0x55d34d[_0xf10d('0x40')]===0x1){return _0x58bf7e['id'];}else{var _0x5765a9=_[_0xf10d('0x83')](_[_0xf10d('0x34')](_0x55d34d,'TeamId'),function(_0x4c69f8){return _['includes'](_0x4a488e,_0x4c69f8);});if(_0x5765a9){return _0x58bf7e['id'];}}}));}}return BPromise[_0xf10d('0x84')](_0x2745cd)[_0xf10d('0x2a')](function(_0x47496b){_0x28e471=_(_0x28e471)[_0xf10d('0x85')](_0x47496b)[_0xf10d('0x86')]()[_0xf10d('0x87')]();return db[_0xf10d('0x35')][_0xf10d('0x52')]({'where':{'id':_0xc35138[_0xf10d('0x4e')]['id']}})[_0xf10d('0x2a')](function(_0x56d61f){return db[_0xf10d('0x80')][_0xf10d('0x70')](function(_0x2a3cca){return _0x56d61f['removeTeams'](_0xc35138['query'][_0xf10d('0x6b')],{'transaction':_0x2a3cca})[_0xf10d('0x2a')](function(){if(!_['isEmpty'](_0x28e471)){return _0x56d61f[_0xf10d('0x88')](_0x28e471,{'transaction':_0x2a3cca});}})[_0xf10d('0x2a')](function(){_0x28e471[_0xf10d('0x73')](function(_0xdb4894){socket[_0xf10d('0x74')]('userSmsQueue:remove',{'UserId':_0xdb4894,'SmsQueueId':_0x56d61f['id']});});});});});});})[_0xf10d('0x2a')](respondWithStatusCode(_0x559c66,null))[_0xf10d('0x4c')](handleError(_0x559c66,null));};exports[_0xf10d('0x89')]=function(_0x202741,_0x5d9dea,_0xfd03b0){return db[_0xf10d('0x35')][_0xf10d('0x52')]({'where':{'id':_0x202741[_0xf10d('0x4e')]['id']}})[_0xf10d('0x2a')](handleEntityNotFound(_0x5d9dea,null))[_0xf10d('0x2a')](function(_0x421ecc){if(_0x421ecc){return _0x421ecc[_0xf10d('0x89')](_0x202741[_0xf10d('0x54')][_0xf10d('0x6b')],_[_0xf10d('0x8a')](_0x202741[_0xf10d('0x54')],[_0xf10d('0x6b'),'id'])||{})[_0xf10d('0x8b')](function(_0x28e473){for(var _0x2e1238=0x0;_0x2e1238<_0x202741[_0xf10d('0x54')][_0xf10d('0x6b')][_0xf10d('0x40')];_0x2e1238+=0x1){socket[_0xf10d('0x74')](_0xf10d('0x8c'),{'UserId':Number(_0x202741[_0xf10d('0x54')][_0xf10d('0x6b')][_0x2e1238]),'SmsQueueId':Number(_0x202741[_0xf10d('0x4e')]['id'])});}return _0x28e473;});}})[_0xf10d('0x2a')](respondWithResult(_0x5d9dea,null))[_0xf10d('0x4c')](handleError(_0x5d9dea,null));};exports[_0xf10d('0x88')]=function(_0x3e460d,_0x3c99bb,_0x4f0f28){return db[_0xf10d('0x35')][_0xf10d('0x52')]({'where':{'id':_0x3e460d[_0xf10d('0x4e')]['id']}})[_0xf10d('0x2a')](handleEntityNotFound(_0x3c99bb,null))[_0xf10d('0x2a')](function(_0x1641c1){if(_0x1641c1){return _0x1641c1[_0xf10d('0x88')](_0x3e460d[_0xf10d('0x3b')]['ids'])[_0xf10d('0x2a')](function(){if(_['isArray'](_0x3e460d[_0xf10d('0x3b')]['ids'])){for(var _0x96e673=0x0;_0x96e673<_0x3e460d[_0xf10d('0x3b')][_0xf10d('0x6b')]['length'];_0x96e673+=0x1){socket[_0xf10d('0x74')](_0xf10d('0x8d'),{'UserId':Number(_0x3e460d[_0xf10d('0x3b')][_0xf10d('0x6b')][_0x96e673]),'SmsQueueId':Number(_0x3e460d[_0xf10d('0x4e')]['id'])});}}else{socket[_0xf10d('0x74')](_0xf10d('0x8d'),{'UserId':Number(_0x3e460d[_0xf10d('0x3b')][_0xf10d('0x6b')]),'SmsQueueId':Number(_0x3e460d['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3c99bb,null))[_0xf10d('0x4c')](handleError(_0x3c99bb,null));};exports[_0xf10d('0x8e')]=function(_0x46a6b1,_0x4d295a,_0x3409e4){var _0x433d55={};var _0x3f6115={};var _0x1f6172;var _0xe403ff;return db['SmsQueue'][_0xf10d('0x5b')]({'where':{'id':_0x46a6b1[_0xf10d('0x4e')]['id']}})[_0xf10d('0x2a')](handleEntityNotFound(_0x4d295a,null))[_0xf10d('0x2a')](function(_0x2dfe85){if(_0x2dfe85){_0x1f6172=_0x2dfe85;_0x3f6115[_0xf10d('0x3a')]=_[_0xf10d('0x4f')](db[_0xf10d('0x5f')][_0xf10d('0x36')]);_0x3f6115[_0xf10d('0x3b')]=_['keys'](_0x46a6b1[_0xf10d('0x3b')]);_0x3f6115[_0xf10d('0x3c')]=_['intersection'](_0x3f6115[_0xf10d('0x3a')],_0x3f6115[_0xf10d('0x3b')]);_0x433d55[_0xf10d('0x3e')]=_['intersection'](_0x3f6115[_0xf10d('0x3a')],qs['fields'](_0x46a6b1[_0xf10d('0x3b')]['fields']));_0x433d55[_0xf10d('0x3e')]=_0x433d55[_0xf10d('0x3e')][_0xf10d('0x40')]?_0x433d55[_0xf10d('0x3e')]:_0x3f6115[_0xf10d('0x3a')];_0x433d55[_0xf10d('0x5d')]=qs[_0xf10d('0x43')](_0x46a6b1[_0xf10d('0x3b')][_0xf10d('0x43')]);_0x433d55[_0xf10d('0x44')]=qs[_0xf10d('0x3c')](_[_0xf10d('0x45')](_0x46a6b1[_0xf10d('0x3b')],_0x3f6115[_0xf10d('0x3c')]));if(_0x46a6b1[_0xf10d('0x3b')][_0xf10d('0x46')]){_0x433d55[_0xf10d('0x44')]=_['merge'](_0x433d55[_0xf10d('0x44')],{'$or':_['map'](_0x433d55[_0xf10d('0x3e')],function(_0x232293){var _0x1796fa={};_0x1796fa[_0x232293]={'$like':'%'+_0x46a6b1[_0xf10d('0x3b')]['filter']+'%'};return _0x1796fa;})});}_0x433d55=_[_0xf10d('0x47')]({},_0x433d55,_0x46a6b1[_0xf10d('0x51')]);return _0x1f6172[_0xf10d('0x8e')](_0x433d55);}})[_0xf10d('0x2a')](function(_0x1fdde0){if(_0x1fdde0){_0xe403ff=_0x1fdde0[_0xf10d('0x40')];if(!_0x46a6b1[_0xf10d('0x3b')]['hasOwnProperty'](_0xf10d('0x42'))){_0x433d55[_0xf10d('0x22')]=qs[_0xf10d('0x22')](_0x46a6b1['query'][_0xf10d('0x22')]);_0x433d55[_0xf10d('0x20')]=qs[_0xf10d('0x20')](_0x46a6b1['query'][_0xf10d('0x20')]);}return _0x1f6172['getAgents'](_0x433d55);}})[_0xf10d('0x2a')](function(_0x1cde4e){if(_0x1cde4e){return _0x1cde4e?{'count':_0xe403ff,'rows':_0x1cde4e}:null;}})['then'](respondWithResult(_0x4d295a,null))[_0xf10d('0x4c')](handleError(_0x4d295a,null));}; \ No newline at end of file +var _0x17a7=['params','keys','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','catch','update','findOne','get','UserSmsQueue','hasOwnProperty','nolimit','map','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','emit','userSmsQueue:save','removeTeams','ids','User','select','tq.TeamId','from','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','getAgents','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','register','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','SmsQueues','UserProfileResource','error','name','send','SmsQueue','fieldName','type','key','query','filters','intersection','model','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x21d1d1,_0x5c80d8){var _0x2af9d0=function(_0x480645){while(--_0x480645){_0x21d1d1['push'](_0x21d1d1['shift']());}};_0x2af9d0(++_0x5c80d8);}(_0x17a7,0xc2));var _0x717a=function(_0x39fb3c,_0x32cf2a){_0x39fb3c=_0x39fb3c-0x0;var _0xce3d60=_0x17a7[_0x39fb3c];return _0xce3d60;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x717a('0x0'));var rp=require(_0x717a('0x1'));var moment=require(_0x717a('0x2'));var BPromise=require(_0x717a('0x3'));var Mustache=require('mustache');var util=require(_0x717a('0x4'));var path=require('path');var sox=require(_0x717a('0x5'));var csv=require(_0x717a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x717a('0x7'));var _=require(_0x717a('0x8'));var squel=require(_0x717a('0x9'));var crypto=require(_0x717a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x717a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x717a('0xc'));var Papa=require('papaparse');var Redis=require(_0x717a('0xd'));var authService=require(_0x717a('0xe'));var qs=require(_0x717a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x717a('0x10'))(_0x717a('0x11'));var utils=require(_0x717a('0x12'));var config=require(_0x717a('0x13'));var licenseUtil=require(_0x717a('0x14'));var db=require('../../mysqldb')['db'];config[_0x717a('0x15')]=_['defaults'](config[_0x717a('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./smsQueue.socket')[_0x717a('0x16')](socket);function respondWithStatusCode(_0x546495,_0x34689b){_0x34689b=_0x34689b||0xcc;return function(_0x4ea5fd){if(_0x4ea5fd){return _0x546495[_0x717a('0x17')](_0x34689b);}return _0x546495['status'](_0x34689b)[_0x717a('0x18')]();};}function respondWithResult(_0x6ae1be,_0x11c7fa){_0x11c7fa=_0x11c7fa||0xc8;return function(_0x5c396d){if(_0x5c396d){return _0x6ae1be[_0x717a('0x19')](_0x11c7fa)['json'](_0x5c396d);}};}function respondWithFilteredResult(_0x130cb2,_0x351c3e){return function(_0x152e10){if(_0x152e10){var _0x8b295=typeof _0x351c3e[_0x717a('0x1a')]===_0x717a('0x1b')&&typeof _0x351c3e[_0x717a('0x1c')]===_0x717a('0x1b');var _0x1e798f=_0x152e10[_0x717a('0x1d')];var _0x5e60f7=_0x8b295?0x0:_0x351c3e['offset'];var _0x2e89f8=_0x8b295?_0x152e10[_0x717a('0x1d')]:_0x351c3e[_0x717a('0x1a')]+_0x351c3e[_0x717a('0x1c')];var _0x2ef0e9;if(_0x2e89f8>=_0x1e798f){_0x2e89f8=_0x1e798f;_0x2ef0e9=0xc8;}else{_0x2ef0e9=0xce;}_0x130cb2[_0x717a('0x19')](_0x2ef0e9);return _0x130cb2[_0x717a('0x1e')](_0x717a('0x1f'),_0x5e60f7+'-'+_0x2e89f8+'/'+_0x1e798f)['json'](_0x152e10);}return null;};}function patchUpdates(_0x3fc2be){return function(_0x1deb63){try{jsonpatch[_0x717a('0x20')](_0x1deb63,_0x3fc2be,!![]);}catch(_0x33947c){return BPromise[_0x717a('0x21')](_0x33947c);}return _0x1deb63['save']();};}function saveUpdates(_0x345d54,_0x630617){return function(_0x3bae98){if(_0x3bae98){return _0x3bae98['update'](_0x345d54)[_0x717a('0x22')](function(_0x36a145){return _0x36a145;});}return null;};}function removeEntity(_0x5e394f,_0x3f443a){return function(_0x329999){if(_0x329999){return _0x329999[_0x717a('0x23')]()[_0x717a('0x22')](function(){var _0x2c0cb3=_0x329999['get']({'plain':!![]});var _0x1654dd=_0x717a('0x24');return db[_0x717a('0x25')][_0x717a('0x23')]({'where':{'type':_0x1654dd,'resourceId':_0x2c0cb3['id']}})[_0x717a('0x22')](function(){return _0x329999;});})[_0x717a('0x22')](function(){_0x5e394f[_0x717a('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3621dc,_0x292cfe){return function(_0xc189b){if(!_0xc189b){_0x3621dc['sendStatus'](0x194);}return _0xc189b;};}function handleError(_0x5b8c01,_0x2b8b19){_0x2b8b19=_0x2b8b19||0x1f4;return function(_0x45847a){logger[_0x717a('0x26')](_0x45847a['stack']);if(_0x45847a[_0x717a('0x27')]){delete _0x45847a[_0x717a('0x27')];}_0x5b8c01['status'](_0x2b8b19)[_0x717a('0x28')](_0x45847a);};}exports['index']=function(_0x23dab2,_0x13481e){var _0x2a03e5={},_0x2cc13e={},_0x4b1452={'count':0x0,'rows':[]};var _0x4c1458=_['map'](db[_0x717a('0x29')]['rawAttributes'],function(_0x2c1e4a){return{'name':_0x2c1e4a[_0x717a('0x2a')],'type':_0x2c1e4a[_0x717a('0x2b')][_0x717a('0x2c')]};});_0x2cc13e['model']=_['map'](_0x4c1458,_0x717a('0x27'));_0x2cc13e[_0x717a('0x2d')]=_['keys'](_0x23dab2[_0x717a('0x2d')]);_0x2cc13e[_0x717a('0x2e')]=_[_0x717a('0x2f')](_0x2cc13e[_0x717a('0x30')],_0x2cc13e['query']);_0x2a03e5[_0x717a('0x31')]=_[_0x717a('0x2f')](_0x2cc13e[_0x717a('0x30')],qs[_0x717a('0x32')](_0x23dab2['query'][_0x717a('0x32')]));_0x2a03e5['attributes']=_0x2a03e5['attributes']['length']?_0x2a03e5['attributes']:_0x2cc13e[_0x717a('0x30')];if(!_0x23dab2[_0x717a('0x2d')]['hasOwnProperty']('nolimit')){_0x2a03e5['limit']=qs[_0x717a('0x1c')](_0x23dab2[_0x717a('0x2d')][_0x717a('0x1c')]);_0x2a03e5['offset']=qs[_0x717a('0x1a')](_0x23dab2['query']['offset']);}_0x2a03e5[_0x717a('0x33')]=qs[_0x717a('0x34')](_0x23dab2[_0x717a('0x2d')][_0x717a('0x34')]);_0x2a03e5[_0x717a('0x35')]=qs[_0x717a('0x2e')](_[_0x717a('0x36')](_0x23dab2[_0x717a('0x2d')],_0x2cc13e[_0x717a('0x2e')]),_0x4c1458);if(_0x23dab2['query'][_0x717a('0x37')]){_0x2a03e5[_0x717a('0x35')]=_[_0x717a('0x38')](_0x2a03e5[_0x717a('0x35')],{'$or':_['map'](_0x4c1458,function(_0x5cd8d3){if(_0x5cd8d3[_0x717a('0x2b')]!==_0x717a('0x39')){var _0x41a608={};_0x41a608[_0x5cd8d3[_0x717a('0x27')]]={'$like':'%'+_0x23dab2[_0x717a('0x2d')]['filter']+'%'};return _0x41a608;}})});}_0x2a03e5=_[_0x717a('0x38')]({},_0x2a03e5,_0x23dab2['options']);var _0x1710fd={'where':_0x2a03e5[_0x717a('0x35')]};return db['SmsQueue'][_0x717a('0x1d')](_0x1710fd)[_0x717a('0x22')](function(_0x684c41){_0x4b1452[_0x717a('0x1d')]=_0x684c41;if(_0x23dab2[_0x717a('0x2d')][_0x717a('0x3a')]){_0x2a03e5[_0x717a('0x3b')]=[{'all':!![]}];}return db[_0x717a('0x29')][_0x717a('0x3c')](_0x2a03e5);})[_0x717a('0x22')](function(_0x44cf53){_0x4b1452[_0x717a('0x3d')]=_0x44cf53;return _0x4b1452;})[_0x717a('0x22')](respondWithFilteredResult(_0x13481e,_0x2a03e5))['catch'](handleError(_0x13481e,null));};exports['show']=function(_0x162ce5,_0x4329b5){var _0x17c9cf={'raw':!![],'where':{'id':_0x162ce5[_0x717a('0x3e')]['id']}},_0xc6c39f={};_0xc6c39f[_0x717a('0x30')]=_[_0x717a('0x3f')](db[_0x717a('0x29')][_0x717a('0x40')]);_0xc6c39f[_0x717a('0x2d')]=_[_0x717a('0x3f')](_0x162ce5[_0x717a('0x2d')]);_0xc6c39f[_0x717a('0x2e')]=_[_0x717a('0x2f')](_0xc6c39f[_0x717a('0x30')],_0xc6c39f['query']);_0x17c9cf[_0x717a('0x31')]=_['intersection'](_0xc6c39f[_0x717a('0x30')],qs['fields'](_0x162ce5[_0x717a('0x2d')][_0x717a('0x32')]));_0x17c9cf[_0x717a('0x31')]=_0x17c9cf[_0x717a('0x31')][_0x717a('0x41')]?_0x17c9cf[_0x717a('0x31')]:_0xc6c39f[_0x717a('0x30')];if(_0x162ce5[_0x717a('0x2d')][_0x717a('0x3a')]){_0x17c9cf[_0x717a('0x3b')]=[{'all':!![]}];}_0x17c9cf=_[_0x717a('0x38')]({},_0x17c9cf,_0x162ce5[_0x717a('0x42')]);return db[_0x717a('0x29')][_0x717a('0x43')](_0x17c9cf)['then'](handleEntityNotFound(_0x4329b5,null))[_0x717a('0x22')](respondWithResult(_0x4329b5,null))['catch'](handleError(_0x4329b5,null));};exports[_0x717a('0x44')]=function(_0xa942d2,_0x4426e7){return db[_0x717a('0x29')][_0x717a('0x44')](_0xa942d2[_0x717a('0x45')],{})[_0x717a('0x22')](function(_0x1910ff){var _0x2c8751=_0xa942d2[_0x717a('0x46')]['get']({'plain':!![]});if(!_0x2c8751)throw new Error(_0x717a('0x47'));if(_0x2c8751[_0x717a('0x48')]===_0x717a('0x46')){var _0x4ba556=_0x1910ff['get']({'plain':!![]});var _0x312445=_0x717a('0x24');return db[_0x717a('0x49')][_0x717a('0x43')]({'where':{'name':_0x312445,'userProfileId':_0x2c8751['userProfileId']},'raw':!![]})[_0x717a('0x22')](function(_0x43a320){if(_0x43a320&&_0x43a320['autoAssociation']===0x0){return db[_0x717a('0x25')][_0x717a('0x44')]({'name':_0x4ba556[_0x717a('0x27')],'resourceId':_0x4ba556['id'],'type':_0x43a320[_0x717a('0x27')],'sectionId':_0x43a320['id']},{})[_0x717a('0x22')](function(){return _0x1910ff;});}else{return _0x1910ff;}})[_0x717a('0x4a')](function(_0x430084){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x430084);throw _0x430084;});}return _0x1910ff;})[_0x717a('0x22')](respondWithResult(_0x4426e7,0xc9))[_0x717a('0x4a')](handleError(_0x4426e7,null));};exports[_0x717a('0x4b')]=function(_0x4ae13e,_0x524bc0){if(_0x4ae13e[_0x717a('0x45')]['id']){delete _0x4ae13e[_0x717a('0x45')]['id'];}return db[_0x717a('0x29')][_0x717a('0x43')]({'where':{'id':_0x4ae13e[_0x717a('0x3e')]['id']}})[_0x717a('0x22')](handleEntityNotFound(_0x524bc0,null))[_0x717a('0x22')](saveUpdates(_0x4ae13e[_0x717a('0x45')],null))[_0x717a('0x22')](respondWithResult(_0x524bc0,null))[_0x717a('0x4a')](handleError(_0x524bc0,null));};exports[_0x717a('0x23')]=function(_0x1f5903,_0x3565e9){return db['SmsQueue'][_0x717a('0x43')]({'where':{'id':_0x1f5903['params']['id']}})['then'](handleEntityNotFound(_0x3565e9,null))[_0x717a('0x22')](removeEntity(_0x3565e9,null))[_0x717a('0x4a')](handleError(_0x3565e9,null));};exports['describe']=function(_0x5887d1,_0x1a0979){return db['SmsQueue']['describe']()[_0x717a('0x22')](respondWithResult(_0x1a0979,null))['catch'](handleError(_0x1a0979,null));};exports['getMembers']=function(_0x40c6ca,_0x28e4b1,_0xec3951){var _0x4b4671={'raw':!![],'where':{}},_0x3d7f2e={},_0x58d4c3;return db[_0x717a('0x29')][_0x717a('0x4c')]({'where':{'id':_0x40c6ca['params']['id']}})[_0x717a('0x22')](handleEntityNotFound(_0x28e4b1,null))[_0x717a('0x22')](function(_0x2d85a2){if(_0x2d85a2){_0x58d4c3=_0x2d85a2[_0x717a('0x4d')]({'plain':!![]});_0x3d7f2e['model']=_[_0x717a('0x3f')](db[_0x717a('0x4e')]['rawAttributes']);_0x3d7f2e[_0x717a('0x2d')]=_[_0x717a('0x3f')](_0x40c6ca[_0x717a('0x2d')]);_0x3d7f2e[_0x717a('0x2e')]=_[_0x717a('0x2f')](_0x3d7f2e[_0x717a('0x30')],_0x3d7f2e[_0x717a('0x2d')]);_0x4b4671[_0x717a('0x31')]=_[_0x717a('0x2f')](_0x3d7f2e['model'],qs[_0x717a('0x32')](_0x40c6ca[_0x717a('0x2d')][_0x717a('0x32')]));_0x4b4671[_0x717a('0x31')]=_0x4b4671[_0x717a('0x31')]['length']?_0x4b4671['attributes']:_0x3d7f2e[_0x717a('0x30')];if(!_0x40c6ca[_0x717a('0x2d')][_0x717a('0x4f')](_0x717a('0x50'))){_0x4b4671[_0x717a('0x1c')]=qs['limit'](_0x40c6ca[_0x717a('0x2d')][_0x717a('0x1c')]);_0x4b4671[_0x717a('0x1a')]=qs[_0x717a('0x1a')](_0x40c6ca[_0x717a('0x2d')]['offset']);}_0x4b4671[_0x717a('0x33')]=qs[_0x717a('0x34')](_0x40c6ca[_0x717a('0x2d')][_0x717a('0x34')]);_0x4b4671[_0x717a('0x35')]=qs[_0x717a('0x2e')](_[_0x717a('0x36')](_0x40c6ca[_0x717a('0x2d')],_0x3d7f2e['filters']));_0x4b4671[_0x717a('0x35')]['SmsQueueId']=_0x2d85a2['id'];if(_0x40c6ca[_0x717a('0x2d')][_0x717a('0x37')]){_0x4b4671[_0x717a('0x35')]=_[_0x717a('0x38')](_0x4b4671[_0x717a('0x35')],{'$or':_[_0x717a('0x51')](_0x4b4671[_0x717a('0x31')],function(_0x420afa){var _0x5ad8d6={};_0x5ad8d6[_0x420afa]={'$like':'%'+_0x40c6ca[_0x717a('0x2d')][_0x717a('0x37')]+'%'};return _0x5ad8d6;})});}_0x4b4671=_[_0x717a('0x38')]({},_0x4b4671,_0x40c6ca[_0x717a('0x42')]);return db['UserSmsQueue'][_0x717a('0x3c')](_0x4b4671);}})[_0x717a('0x22')](function(_0x1107db){if(_0x1107db){return db['User'][_0x717a('0x52')]({'where':{'id':_[_0x717a('0x51')](_0x1107db,_0x717a('0x53')),'role':_0x717a('0x54')},'attributes':['id','name',_0x717a('0x55'),_0x717a('0x56'),_0x717a('0x57')]});}})['then'](function(_0x2e5d21){if(_0x2e5d21){return{'count':_0x2e5d21[_0x717a('0x1d')],'rows':_['map'](_0x2e5d21[_0x717a('0x3d')],function(_0x573ee6){return{'membername':_0x573ee6[_0x717a('0x27')],'UserId':_0x573ee6['id'],'queue_name':_0x58d4c3['name'],'SmsQueueId':_0x58d4c3['id'],'interface':util['format'](_0x717a('0x58'),_0x717a('0x59'),_0x573ee6[_0x717a('0x27')]),'penalty':0x0,'paused':_0x573ee6[_0x717a('0x55')],'createdAt':_0x573ee6[_0x717a('0x57')],'updatedAt':_0x573ee6[_0x717a('0x56')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x717a('0x22')](respondWithFilteredResult(_0x28e4b1,_0x4b4671))[_0x717a('0x4a')](handleError(_0x28e4b1,null));};exports[_0x717a('0x5a')]=function(_0x55bda8,_0x2f32cf,_0x132e75){var _0x5c1b1c={};var _0x11050e={};var _0xee2ba7;var _0x2ccb76;return db['SmsQueue']['findOne']({'where':{'id':_0x55bda8[_0x717a('0x3e')]['id']}})[_0x717a('0x22')](handleEntityNotFound(_0x2f32cf,null))[_0x717a('0x22')](function(_0x501d60){if(_0x501d60){_0xee2ba7=_0x501d60;_0x11050e[_0x717a('0x30')]=_['keys'](db[_0x717a('0x5b')][_0x717a('0x40')]);_0x11050e[_0x717a('0x2d')]=_[_0x717a('0x3f')](_0x55bda8['query']);_0x11050e[_0x717a('0x2e')]=_[_0x717a('0x2f')](_0x11050e[_0x717a('0x30')],_0x11050e['query']);_0x5c1b1c[_0x717a('0x31')]=_[_0x717a('0x2f')](_0x11050e['model'],qs[_0x717a('0x32')](_0x55bda8[_0x717a('0x2d')][_0x717a('0x32')]));_0x5c1b1c[_0x717a('0x31')]=_0x5c1b1c['attributes'][_0x717a('0x41')]?_0x5c1b1c[_0x717a('0x31')]:_0x11050e[_0x717a('0x30')];_0x5c1b1c[_0x717a('0x33')]=qs[_0x717a('0x34')](_0x55bda8[_0x717a('0x2d')][_0x717a('0x34')]);_0x5c1b1c[_0x717a('0x35')]=qs[_0x717a('0x2e')](_['pick'](_0x55bda8[_0x717a('0x2d')],_0x11050e[_0x717a('0x2e')]));if(_0x55bda8[_0x717a('0x2d')]['filter']){_0x5c1b1c[_0x717a('0x35')]=_[_0x717a('0x38')](_0x5c1b1c[_0x717a('0x35')],{'$or':_[_0x717a('0x51')](_0x5c1b1c['attributes'],function(_0x40b95e){var _0x239c6b={};_0x239c6b[_0x40b95e]={'$like':'%'+_0x55bda8['query'][_0x717a('0x37')]+'%'};return _0x239c6b;})});}_0x5c1b1c=_[_0x717a('0x38')]({},_0x5c1b1c,_0x55bda8['options']);return _0xee2ba7[_0x717a('0x5a')](_0x5c1b1c);}})[_0x717a('0x22')](function(_0x2cc0bd){if(_0x2cc0bd){_0x2ccb76=_0x2cc0bd[_0x717a('0x41')];if(!_0x55bda8[_0x717a('0x2d')][_0x717a('0x4f')](_0x717a('0x50'))){_0x5c1b1c[_0x717a('0x1c')]=qs['limit'](_0x55bda8[_0x717a('0x2d')]['limit']);_0x5c1b1c[_0x717a('0x1a')]=qs[_0x717a('0x1a')](_0x55bda8['query'][_0x717a('0x1a')]);}return _0xee2ba7[_0x717a('0x5a')](_0x5c1b1c);}})[_0x717a('0x22')](function(_0x378df4){if(_0x378df4){return _0x378df4?{'count':_0x2ccb76,'rows':_0x378df4}:null;}})[_0x717a('0x22')](respondWithResult(_0x2f32cf,null))['catch'](handleError(_0x2f32cf,null));};exports[_0x717a('0x5c')]=function(_0x22d44b,_0x5ac6d4,_0x19cd53){var _0x31ae74=_0x22d44b[_0x717a('0x45')]['ids'];return db[_0x717a('0x5b')][_0x717a('0x3c')]({'where':{'id':_0x31ae74},'attributes':['id'],'include':[{'model':db['User'],'as':_0x717a('0x5d'),'attributes':['id',_0x717a('0x27'),_0x717a('0x5e'),'voicePause',_0x717a('0x5f')],'raw':!![]}]})[_0x717a('0x22')](function(_0x71e31f){if(_0x71e31f){var _0x2534b3=_[_0x717a('0x60')](_0x71e31f,function(_0xddad2){var _0x1ecd99=_0xddad2[_0x717a('0x4d')]({'plain':!![]});return _0x1ecd99[_0x717a('0x5d')];});return db[_0x717a('0x29')][_0x717a('0x43')]({'where':{'id':_0x22d44b[_0x717a('0x3e')]['id']}})[_0x717a('0x22')](function(_0x18652){return db[_0x717a('0x61')][_0x717a('0x62')](function(_0x368bb4){return _0x18652[_0x717a('0x5c')](_0x31ae74,{'transaction':_0x368bb4})['then'](function(){return BPromise[_0x717a('0x63')](_0x2534b3,function(_0x346329){return db[_0x717a('0x4e')]['findOrCreate']({'where':{'UserId':_0x346329['id'],'SmsQueueId':_0x22d44b[_0x717a('0x3e')]['id']},'transaction':_0x368bb4});});})[_0x717a('0x22')](function(){_0x2534b3[_0x717a('0x64')](function(_0x2b7937){socket[_0x717a('0x65')](_0x717a('0x66'),{'UserId':_0x2b7937['id'],'SmsQueueId':_0x18652['id']});});});});});}})[_0x717a('0x22')](respondWithStatusCode(_0x5ac6d4,null))[_0x717a('0x4a')](handleError(_0x5ac6d4,null));};exports[_0x717a('0x67')]=function(_0x207151,_0x515298,_0x2b107a){return db['Team'][_0x717a('0x3c')]({'where':{'id':_0x207151[_0x717a('0x2d')][_0x717a('0x68')]},'attributes':['id'],'include':[{'model':db[_0x717a('0x69')],'as':_0x717a('0x5d'),'attributes':['id'],'raw':!![]}]})[_0x717a('0x22')](handleEntityNotFound(_0x515298,null))[_0x717a('0x22')](function(_0x39ee59){var _0x5a7743=_[_0x717a('0x51')](_0x39ee59,'id');var _0x2e60ce=[];var _0x407464=[];var _0x100a2a=squel[_0x717a('0x6a')]();_0x100a2a['field'](_0x717a('0x6b'))[_0x717a('0x6c')]('team_has_sms_queues','tq')[_0x717a('0x6d')]('user_has_teams','ut',_0x717a('0x6e'))[_0x717a('0x35')](_0x717a('0x6f'),_0x207151[_0x717a('0x3e')]['id']);for(var _0xa3697d=0x0;_0xa3697d<_0x39ee59[_0x717a('0x41')];_0xa3697d+=0x1){let _0x44816a=_0x39ee59[_0xa3697d];for(var _0x2821cb=0x0;_0x2821cb<_0x44816a[_0x717a('0x5d')][_0x717a('0x41')];_0x2821cb+=0x1){let _0x4ae22c=_0x44816a[_0x717a('0x5d')][_0x2821cb];var _0x4ec645=_0x100a2a['clone']();_0x4ec645['where'](_0x717a('0x70'),_0x4ae22c['id']);_0x407464['push'](db[_0x717a('0x61')]['query'](_0x4ec645[_0x717a('0x71')](),{'type':db[_0x717a('0x61')][_0x717a('0x72')][_0x717a('0x73')]})['then'](function(_0x4c68dc){if(_0x4c68dc[_0x717a('0x41')]===0x1){return _0x4ae22c['id'];}else{var _0x1a5b6b=_[_0x717a('0x74')](_[_0x717a('0x51')](_0x4c68dc,'TeamId'),function(_0x5229f7){return _[_0x717a('0x75')](_0x5a7743,_0x5229f7);});if(_0x1a5b6b){return _0x4ae22c['id'];}}}));}}return BPromise[_0x717a('0x76')](_0x407464)[_0x717a('0x22')](function(_0x3b75ee){_0x2e60ce=_(_0x2e60ce)[_0x717a('0x77')](_0x3b75ee)[_0x717a('0x78')]()[_0x717a('0x79')]();return db['SmsQueue'][_0x717a('0x43')]({'where':{'id':_0x207151[_0x717a('0x3e')]['id']}})[_0x717a('0x22')](function(_0x53fc09){return db[_0x717a('0x61')][_0x717a('0x62')](function(_0x1fb8a6){return _0x53fc09[_0x717a('0x67')](_0x207151[_0x717a('0x2d')]['ids'],{'transaction':_0x1fb8a6})[_0x717a('0x22')](function(){if(!_[_0x717a('0x7a')](_0x2e60ce)){return _0x53fc09[_0x717a('0x7b')](_0x2e60ce,{'transaction':_0x1fb8a6});}})[_0x717a('0x22')](function(){_0x2e60ce['forEach'](function(_0x2ab0bf){socket[_0x717a('0x65')](_0x717a('0x7c'),{'UserId':_0x2ab0bf,'SmsQueueId':_0x53fc09['id']});});});});});});})[_0x717a('0x22')](respondWithStatusCode(_0x515298,null))[_0x717a('0x4a')](handleError(_0x515298,null));};exports[_0x717a('0x7d')]=function(_0x2a17e6,_0xfd6846,_0x468877){return db['SmsQueue'][_0x717a('0x43')]({'where':{'id':_0x2a17e6[_0x717a('0x3e')]['id']}})[_0x717a('0x22')](handleEntityNotFound(_0xfd6846,null))[_0x717a('0x22')](function(_0x6bdee){if(_0x6bdee){return _0x6bdee['addAgents'](_0x2a17e6[_0x717a('0x45')][_0x717a('0x68')],_[_0x717a('0x7e')](_0x2a17e6[_0x717a('0x45')],[_0x717a('0x68'),'id'])||{})['spread'](function(_0x4b6deb){for(var _0x41b9ab=0x0;_0x41b9ab<_0x2a17e6[_0x717a('0x45')][_0x717a('0x68')]['length'];_0x41b9ab+=0x1){socket['emit'](_0x717a('0x66'),{'UserId':Number(_0x2a17e6[_0x717a('0x45')][_0x717a('0x68')][_0x41b9ab]),'SmsQueueId':Number(_0x2a17e6['params']['id'])});}return _0x4b6deb;});}})[_0x717a('0x22')](respondWithResult(_0xfd6846,null))['catch'](handleError(_0xfd6846,null));};exports['removeAgents']=function(_0x324588,_0x3ed6d5,_0x5d704d){return db['SmsQueue']['find']({'where':{'id':_0x324588[_0x717a('0x3e')]['id']}})[_0x717a('0x22')](handleEntityNotFound(_0x3ed6d5,null))['then'](function(_0x2fb682){if(_0x2fb682){return _0x2fb682[_0x717a('0x7b')](_0x324588['query'][_0x717a('0x68')])['then'](function(){if(_['isArray'](_0x324588[_0x717a('0x2d')]['ids'])){for(var _0x35e580=0x0;_0x35e580<_0x324588['query'][_0x717a('0x68')][_0x717a('0x41')];_0x35e580+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x324588['query']['ids'][_0x35e580]),'SmsQueueId':Number(_0x324588[_0x717a('0x3e')]['id'])});}}else{socket[_0x717a('0x65')](_0x717a('0x7c'),{'UserId':Number(_0x324588['query'][_0x717a('0x68')]),'SmsQueueId':Number(_0x324588['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3ed6d5,null))[_0x717a('0x4a')](handleError(_0x3ed6d5,null));};exports['getAgents']=function(_0x3afa9d,_0x14e941,_0xba0d75){var _0x43a80f={};var _0x4b4134={};var _0x7d98c5;var _0x59ad85;return db[_0x717a('0x29')][_0x717a('0x4c')]({'where':{'id':_0x3afa9d[_0x717a('0x3e')]['id']}})[_0x717a('0x22')](handleEntityNotFound(_0x14e941,null))['then'](function(_0x517597){if(_0x517597){_0x7d98c5=_0x517597;_0x4b4134[_0x717a('0x30')]=_[_0x717a('0x3f')](db[_0x717a('0x69')][_0x717a('0x40')]);_0x4b4134['query']=_[_0x717a('0x3f')](_0x3afa9d['query']);_0x4b4134[_0x717a('0x2e')]=_[_0x717a('0x2f')](_0x4b4134[_0x717a('0x30')],_0x4b4134[_0x717a('0x2d')]);_0x43a80f[_0x717a('0x31')]=_[_0x717a('0x2f')](_0x4b4134[_0x717a('0x30')],qs[_0x717a('0x32')](_0x3afa9d[_0x717a('0x2d')][_0x717a('0x32')]));_0x43a80f[_0x717a('0x31')]=_0x43a80f[_0x717a('0x31')][_0x717a('0x41')]?_0x43a80f['attributes']:_0x4b4134[_0x717a('0x30')];_0x43a80f[_0x717a('0x33')]=qs[_0x717a('0x34')](_0x3afa9d[_0x717a('0x2d')]['sort']);_0x43a80f['where']=qs['filters'](_[_0x717a('0x36')](_0x3afa9d['query'],_0x4b4134['filters']));if(_0x3afa9d['query'][_0x717a('0x37')]){_0x43a80f[_0x717a('0x35')]=_[_0x717a('0x38')](_0x43a80f[_0x717a('0x35')],{'$or':_['map'](_0x43a80f[_0x717a('0x31')],function(_0x21d962){var _0x160317={};_0x160317[_0x21d962]={'$like':'%'+_0x3afa9d['query']['filter']+'%'};return _0x160317;})});}_0x43a80f=_['merge']({},_0x43a80f,_0x3afa9d[_0x717a('0x42')]);return _0x7d98c5[_0x717a('0x7f')](_0x43a80f);}})[_0x717a('0x22')](function(_0x4f0687){if(_0x4f0687){_0x59ad85=_0x4f0687[_0x717a('0x41')];if(!_0x3afa9d[_0x717a('0x2d')][_0x717a('0x4f')](_0x717a('0x50'))){_0x43a80f[_0x717a('0x1c')]=qs['limit'](_0x3afa9d['query'][_0x717a('0x1c')]);_0x43a80f['offset']=qs[_0x717a('0x1a')](_0x3afa9d['query'][_0x717a('0x1a')]);}return _0x7d98c5[_0x717a('0x7f')](_0x43a80f);}})['then'](function(_0x70b047){if(_0x70b047){return _0x70b047?{'count':_0x59ad85,'rows':_0x70b047}:null;}})[_0x717a('0x22')](respondWithResult(_0x14e941,null))[_0x717a('0x4a')](handleError(_0x14e941,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 47a0f64..57647da 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 _0x5d5f=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','SmsQueue'];(function(_0x477456,_0x560773){var _0x50e783=function(_0x3ace4f){while(--_0x3ace4f){_0x477456['push'](_0x477456['shift']());}};_0x50e783(++_0x560773);}(_0x5d5f,0x127));var _0xf5d5=function(_0x2833ce,_0x4f60b){_0x2833ce=_0x2833ce-0x0;var _0x529051=_0x5d5f[_0x2833ce];return _0x529051;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xf5d5('0x0'))['db'][_0xf5d5('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xf5d5('0x2')](0x0);var events={'afterCreate':_0xf5d5('0x3'),'afterUpdate':_0xf5d5('0x4'),'afterDestroy':_0xf5d5('0x5')};function emitEvent(_0x33fbdf){return function(_0xe3cefb,_0x5416cc,_0x382363){SmsQueueEvents['emit'](_0x33fbdf+':'+_0xe3cefb['id'],_0xe3cefb);SmsQueueEvents[_0xf5d5('0x6')](_0x33fbdf,_0xe3cefb);_0x382363(null);};}for(var e in events){if(events[_0xf5d5('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xf5d5('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x5a69=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x427d3a,_0x23724c){var _0xe5c521=function(_0x77b277){while(--_0x77b277){_0x427d3a['push'](_0x427d3a['shift']());}};_0xe5c521(++_0x23724c);}(_0x5a69,0x1de));var _0x95a6=function(_0x210c03,_0x362093){_0x210c03=_0x210c03-0x0;var _0x2ce432=_0x5a69[_0x210c03];return _0x2ce432;};'use strict';var EventEmitter=require(_0x95a6('0x0'));var SmsQueue=require(_0x95a6('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x95a6('0x2')](0x0);var events={'afterCreate':_0x95a6('0x3'),'afterUpdate':_0x95a6('0x4'),'afterDestroy':_0x95a6('0x5')};function emitEvent(_0x545479){return function(_0x52dec8,_0x26acf4,_0x42ae5f){SmsQueueEvents[_0x95a6('0x6')](_0x545479+':'+_0x52dec8['id'],_0x52dec8);SmsQueueEvents[_0x95a6('0x6')](_0x545479,_0x52dec8);_0x42ae5f(null);};}for(var e in events){if(events[_0x95a6('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x95a6('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 865f2e3..63cce90 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 _0xfd5b=['request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','api','moment','bluebird'];(function(_0x4732a9,_0x2c5556){var _0x3c3fdd=function(_0x419984){while(--_0x419984){_0x4732a9['push'](_0x4732a9['shift']());}};_0x3c3fdd(++_0x2c5556);}(_0xfd5b,0x15a));var _0xbfd5=function(_0x51cc34,_0xfecf43){_0x51cc34=_0x51cc34-0x0;var _0x3cde20=_0xfd5b[_0x51cc34];return _0x3cde20;};'use strict';var _=require(_0xbfd5('0x0'));var util=require(_0xbfd5('0x1'));var logger=require('../../config/logger')(_0xbfd5('0x2'));var moment=require(_0xbfd5('0x3'));var BPromise=require(_0xbfd5('0x4'));var rp=require(_0xbfd5('0x5'));var fs=require('fs');var path=require(_0xbfd5('0x6'));var rimraf=require(_0xbfd5('0x7'));var config=require(_0xbfd5('0x8'));var attributes=require(_0xbfd5('0x9'));module[_0xbfd5('0xa')]=function(_0x3ee2e1,_0x2914f2){return _0x3ee2e1[_0xbfd5('0xb')]('SmsQueue',attributes,{'tableName':_0xbfd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd78e=['../../config/environment','./smsQueue.attributes','exports','define','sms_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x474b1b,_0x8c6a7a){var _0x235ab6=function(_0x33d774){while(--_0x33d774){_0x474b1b['push'](_0x474b1b['shift']());}};_0x235ab6(++_0x8c6a7a);}(_0xd78e,0xf5));var _0xed78=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xd78e[_0x26f1b2];return _0x1624a4;};'use strict';var _=require('lodash');var util=require(_0xed78('0x0'));var logger=require(_0xed78('0x1'))(_0xed78('0x2'));var moment=require(_0xed78('0x3'));var BPromise=require(_0xed78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xed78('0x5'));var attributes=require(_0xed78('0x6'));module[_0xed78('0x7')]=function(_0x55b2de,_0x5690ed){return _0x55b2de[_0xed78('0x8')]('SmsQueue',attributes,{'tableName':_0xed78('0x9'),'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 f157588..8ed43d0 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 _0x093f=['code','message','SmsQueue','raw','options','where','attributes','model','include','map','then','GetSmsQueue','stringify','catch','ShowSmsQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','redis','defaults','localhost','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error'];(function(_0xa789da,_0x236b33){var _0x4fad4a=function(_0x116b58){while(--_0x116b58){_0xa789da['push'](_0xa789da['shift']());}};_0x4fad4a(++_0x236b33);}(_0x093f,0x7b));var _0xf093=function(_0x4a6917,_0x5afbc8){_0x4a6917=_0x4a6917-0x0;var _0x403d6c=_0x093f[_0x4a6917];return _0x403d6c;};'use strict';var _=require(_0xf093('0x0'));var util=require('util');var moment=require(_0xf093('0x1'));var BPromise=require(_0xf093('0x2'));var rs=require(_0xf093('0x3'));var fs=require('fs');var Redis=require(_0xf093('0x4'));var db=require(_0xf093('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf093('0x6'));var config=require('../../config/environment');var jayson=require(_0xf093('0x7'));var client=jayson['client'][_0xf093('0x8')]({'port':0x232a});config[_0xf093('0x9')]=_[_0xf093('0xa')](config[_0xf093('0x9')],{'host':_0xf093('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf093('0x9')]));require(_0xf093('0xc'))[_0xf093('0xd')](socket);function respondWithRpcPromise(_0x420d91,_0x26f1dd,_0xebbf1e){return new BPromise(function(_0x3c869b,_0x4e70c7){return client[_0xf093('0xe')](_0x420d91,_0xebbf1e)['then'](function(_0x3d042f){logger[_0xf093('0xf')](_0xf093('0x10'),_0x26f1dd,_0xf093('0x11'));logger[_0xf093('0x12')](_0xf093('0x13'),_0x26f1dd,_0xf093('0x11'),JSON['stringify'](_0x3d042f));if(_0x3d042f['error']){if(_0x3d042f[_0xf093('0x14')][_0xf093('0x15')]===0x1f4){logger[_0xf093('0x14')](_0xf093('0x10'),_0x26f1dd,_0x3d042f[_0xf093('0x14')][_0xf093('0x16')]);return _0x4e70c7(_0x3d042f[_0xf093('0x14')][_0xf093('0x16')]);}logger[_0xf093('0x14')](_0xf093('0x10'),_0x26f1dd,_0x3d042f[_0xf093('0x14')]['message']);return _0x3c869b(_0x3d042f['error'][_0xf093('0x16')]);}else{logger[_0xf093('0xf')](_0xf093('0x10'),_0x26f1dd,_0xf093('0x11'));_0x3c869b(_0x3d042f['result']['message']);}})['catch'](function(_0x17ac74){logger['error']('SmsQueue,\x20%s,\x20%s',_0x26f1dd,_0x17ac74);_0x4e70c7(_0x17ac74);});});}exports['GetSmsQueue']=function(_0x2b6a57){var _0x346c72=this;return new Promise(function(_0x5194a8,_0x5d13ed){return db[_0xf093('0x17')]['findAll']({'raw':_0x2b6a57['options']?_0x2b6a57['options'][_0xf093('0x18')]===undefined?!![]:![]:!![],'where':_0x2b6a57[_0xf093('0x19')]?_0x2b6a57[_0xf093('0x19')][_0xf093('0x1a')]||null:null,'attributes':_0x2b6a57[_0xf093('0x19')]?_0x2b6a57[_0xf093('0x19')][_0xf093('0x1b')]||null:null,'limit':_0x2b6a57[_0xf093('0x19')]?_0x2b6a57[_0xf093('0x19')]['limit']||null:null,'include':_0x2b6a57['options']?_0x2b6a57[_0xf093('0x19')]['include']?_['map'](_0x2b6a57[_0xf093('0x19')]['include'],function(_0x4427d4){return{'model':db[_0x4427d4[_0xf093('0x1c')]],'as':_0x4427d4['as'],'attributes':_0x4427d4[_0xf093('0x1b')],'include':_0x4427d4[_0xf093('0x1d')]?_[_0xf093('0x1e')](_0x4427d4[_0xf093('0x1d')],function(_0x4c777c){return{'model':db[_0x4c777c[_0xf093('0x1c')]],'as':_0x4c777c['as'],'attributes':_0x4c777c['attributes'],'include':_0x4c777c[_0xf093('0x1d')]?_['map'](_0x4c777c['include'],function(_0x43401a){return{'model':db[_0x43401a[_0xf093('0x1c')]],'as':_0x43401a['as'],'attributes':_0x43401a['attributes']};}):[]};}):[]};}):[]:[]})[_0xf093('0x1f')](function(_0x1e08d9){logger[_0xf093('0xf')]('GetSmsQueue',_0x2b6a57);logger[_0xf093('0x12')](_0xf093('0x20'),_0x2b6a57,JSON[_0xf093('0x21')](_0x1e08d9));_0x5194a8(_0x1e08d9);})[_0xf093('0x22')](function(_0x53dd4b){logger[_0xf093('0x14')]('GetSmsQueue',_0x53dd4b[_0xf093('0x16')],_0x2b6a57);_0x5d13ed(_0x346c72['error'](0x1f4,_0x53dd4b[_0xf093('0x16')]));});});};exports[_0xf093('0x23')]=function(_0x441848){var _0x5f1fdb=this;return new Promise(function(_0x31e769,_0x5bc182){return db[_0xf093('0x17')]['find']({'raw':_0x441848[_0xf093('0x19')]?_0x441848['options']['raw']===undefined?!![]:![]:!![],'where':_0x441848[_0xf093('0x19')]?_0x441848[_0xf093('0x19')][_0xf093('0x1a')]||null:null,'attributes':_0x441848[_0xf093('0x19')]?_0x441848[_0xf093('0x19')]['attributes']||null:null,'include':_0x441848[_0xf093('0x19')]?_0x441848[_0xf093('0x19')]['include']?_['map'](_0x441848['options'][_0xf093('0x1d')],function(_0x32324c){return{'model':db[_0x32324c[_0xf093('0x1c')]],'as':_0x32324c['as'],'attributes':_0x32324c[_0xf093('0x1b')],'include':_0x32324c[_0xf093('0x1d')]?_[_0xf093('0x1e')](_0x32324c[_0xf093('0x1d')],function(_0x8c3350){return{'model':db[_0x8c3350[_0xf093('0x1c')]],'as':_0x8c3350['as'],'attributes':_0x8c3350[_0xf093('0x1b')],'include':_0x8c3350[_0xf093('0x1d')]?_[_0xf093('0x1e')](_0x8c3350[_0xf093('0x1d')],function(_0x38e668){return{'model':db[_0x38e668[_0xf093('0x1c')]],'as':_0x38e668['as'],'attributes':_0x38e668[_0xf093('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c49de){logger[_0xf093('0xf')](_0xf093('0x23'),_0x441848);logger[_0xf093('0x12')](_0xf093('0x23'),_0x441848,JSON['stringify'](_0x4c49de));_0x31e769(_0x4c49de);})[_0xf093('0x22')](function(_0x5d8f0d){logger['error'](_0xf093('0x23'),_0x5d8f0d[_0xf093('0x16')],_0x441848);_0x5bc182(_0x5f1fdb[_0xf093('0x14')](0x1f4,_0x5d8f0d['message']));});});}; \ No newline at end of file +var _0x9358=['ShowSmsQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','redis','defaults','localhost','./smsQueue.socket','register','request','info','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then'];(function(_0xdd2348,_0x5d3232){var _0x2e0a02=function(_0x38e687){while(--_0x38e687){_0xdd2348['push'](_0xdd2348['shift']());}};_0x2e0a02(++_0x5d3232);}(_0x9358,0x11a));var _0x8935=function(_0x192a1a,_0x51fec1){_0x192a1a=_0x192a1a-0x0;var _0x5e4bf6=_0x9358[_0x192a1a];return _0x5e4bf6;};'use strict';var _=require(_0x8935('0x0'));var util=require('util');var moment=require(_0x8935('0x1'));var BPromise=require(_0x8935('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8935('0x3'));var db=require(_0x8935('0x4'))['db'];var utils=require(_0x8935('0x5'));var logger=require('../../config/logger')(_0x8935('0x6'));var config=require(_0x8935('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8935('0x8')]({'port':0x232a});config[_0x8935('0x9')]=_[_0x8935('0xa')](config[_0x8935('0x9')],{'host':_0x8935('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8935('0x9')]));require(_0x8935('0xc'))[_0x8935('0xd')](socket);function respondWithRpcPromise(_0x5a34d1,_0x4a1508,_0x2abf38){return new BPromise(function(_0xa414da,_0x11719b){return client[_0x8935('0xe')](_0x5a34d1,_0x2abf38)['then'](function(_0x24e184){logger[_0x8935('0xf')]('SmsQueue,\x20%s,\x20%s',_0x4a1508,_0x8935('0x10'));logger[_0x8935('0x11')](_0x8935('0x12'),_0x4a1508,_0x8935('0x10'),JSON[_0x8935('0x13')](_0x24e184));if(_0x24e184[_0x8935('0x14')]){if(_0x24e184[_0x8935('0x14')][_0x8935('0x15')]===0x1f4){logger[_0x8935('0x14')](_0x8935('0x16'),_0x4a1508,_0x24e184['error'][_0x8935('0x17')]);return _0x11719b(_0x24e184[_0x8935('0x14')]['message']);}logger[_0x8935('0x14')](_0x8935('0x16'),_0x4a1508,_0x24e184['error'][_0x8935('0x17')]);return _0xa414da(_0x24e184[_0x8935('0x14')][_0x8935('0x17')]);}else{logger[_0x8935('0xf')](_0x8935('0x16'),_0x4a1508,_0x8935('0x10'));_0xa414da(_0x24e184[_0x8935('0x18')][_0x8935('0x17')]);}})[_0x8935('0x19')](function(_0x222e45){logger[_0x8935('0x14')](_0x8935('0x16'),_0x4a1508,_0x222e45);_0x11719b(_0x222e45);});});}exports[_0x8935('0x1a')]=function(_0x8997f){var _0x405551=this;return new Promise(function(_0xb174dd,_0x167a93){return db[_0x8935('0x1b')][_0x8935('0x1c')]({'raw':_0x8997f[_0x8935('0x1d')]?_0x8997f['options'][_0x8935('0x1e')]===undefined?!![]:![]:!![],'where':_0x8997f[_0x8935('0x1d')]?_0x8997f[_0x8935('0x1d')][_0x8935('0x1f')]||null:null,'attributes':_0x8997f[_0x8935('0x1d')]?_0x8997f[_0x8935('0x1d')][_0x8935('0x20')]||null:null,'limit':_0x8997f['options']?_0x8997f[_0x8935('0x1d')][_0x8935('0x21')]||null:null,'include':_0x8997f[_0x8935('0x1d')]?_0x8997f[_0x8935('0x1d')][_0x8935('0x22')]?_[_0x8935('0x23')](_0x8997f[_0x8935('0x1d')][_0x8935('0x22')],function(_0x1a12d1){return{'model':db[_0x1a12d1[_0x8935('0x24')]],'as':_0x1a12d1['as'],'attributes':_0x1a12d1['attributes'],'include':_0x1a12d1[_0x8935('0x22')]?_[_0x8935('0x23')](_0x1a12d1['include'],function(_0x412050){return{'model':db[_0x412050[_0x8935('0x24')]],'as':_0x412050['as'],'attributes':_0x412050['attributes'],'include':_0x412050[_0x8935('0x22')]?_['map'](_0x412050[_0x8935('0x22')],function(_0x4f40fd){return{'model':db[_0x4f40fd['model']],'as':_0x4f40fd['as'],'attributes':_0x4f40fd['attributes']};}):[]};}):[]};}):[]:[]})[_0x8935('0x25')](function(_0x15d79d){logger[_0x8935('0xf')](_0x8935('0x1a'),_0x8997f);logger[_0x8935('0x11')]('GetSmsQueue',_0x8997f,JSON[_0x8935('0x13')](_0x15d79d));_0xb174dd(_0x15d79d);})[_0x8935('0x19')](function(_0x5e9836){logger[_0x8935('0x14')](_0x8935('0x1a'),_0x5e9836[_0x8935('0x17')],_0x8997f);_0x167a93(_0x405551[_0x8935('0x14')](0x1f4,_0x5e9836['message']));});});};exports[_0x8935('0x26')]=function(_0x5c6f88){var _0x5a95ab=this;return new Promise(function(_0x517052,_0x3e5323){return db['SmsQueue'][_0x8935('0x27')]({'raw':_0x5c6f88[_0x8935('0x1d')]?_0x5c6f88[_0x8935('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x5c6f88[_0x8935('0x1d')]?_0x5c6f88[_0x8935('0x1d')]['where']||null:null,'attributes':_0x5c6f88[_0x8935('0x1d')]?_0x5c6f88['options'][_0x8935('0x20')]||null:null,'include':_0x5c6f88[_0x8935('0x1d')]?_0x5c6f88['options'][_0x8935('0x22')]?_[_0x8935('0x23')](_0x5c6f88['options'][_0x8935('0x22')],function(_0xb26e18){return{'model':db[_0xb26e18[_0x8935('0x24')]],'as':_0xb26e18['as'],'attributes':_0xb26e18[_0x8935('0x20')],'include':_0xb26e18['include']?_['map'](_0xb26e18[_0x8935('0x22')],function(_0x1ed686){return{'model':db[_0x1ed686['model']],'as':_0x1ed686['as'],'attributes':_0x1ed686['attributes'],'include':_0x1ed686[_0x8935('0x22')]?_['map'](_0x1ed686[_0x8935('0x22')],function(_0x5c2ff5){return{'model':db[_0x5c2ff5[_0x8935('0x24')]],'as':_0x5c2ff5['as'],'attributes':_0x5c2ff5[_0x8935('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8935('0x25')](function(_0x5aa0d2){logger[_0x8935('0xf')](_0x8935('0x26'),_0x5c6f88);logger[_0x8935('0x11')]('ShowSmsQueue',_0x5c6f88,JSON['stringify'](_0x5aa0d2));_0x517052(_0x5aa0d2);})['catch'](function(_0x1d83aa){logger[_0x8935('0x14')](_0x8935('0x26'),_0x1d83aa[_0x8935('0x17')],_0x5c6f88);_0x3e5323(_0x5a95ab[_0x8935('0x14')](0x1f4,_0x1d83aa[_0x8935('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 2afb5fe..12e9a70 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 _0xf1f8=['removeListener','register','length','smsQueue:','save','remove','update','emit'];(function(_0x161c5d,_0x2fd4e5){var _0x44d263=function(_0x2611a1){while(--_0x2611a1){_0x161c5d['push'](_0x161c5d['shift']());}};_0x44d263(++_0x2fd4e5);}(_0xf1f8,0xe4));var _0x8f1f=function(_0x8924a1,_0xf954c){_0x8924a1=_0x8924a1-0x0;var _0x1e3fba=_0xf1f8[_0x8924a1];return _0x1e3fba;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x8f1f('0x0'),_0x8f1f('0x1'),_0x8f1f('0x2')];function createListener(_0x149838,_0x818af3){return function(_0x13e494){_0x818af3[_0x8f1f('0x3')](_0x149838,_0x13e494);};}function removeListener(_0x3abdc0,_0xd6f308){return function(){SmsQueueEvents[_0x8f1f('0x4')](_0x3abdc0,_0xd6f308);};}exports[_0x8f1f('0x5')]=function(_0x33a7b9){for(var _0x41b08e=0x0,_0x9e380f=events[_0x8f1f('0x6')];_0x41b08e<_0x9e380f;_0x41b08e++){var _0x419be3=events[_0x41b08e];var _0x50a9a7=createListener(_0x8f1f('0x7')+_0x419be3,_0x33a7b9);SmsQueueEvents['on'](_0x419be3,_0x50a9a7);}}; \ No newline at end of file +var _0x20c2=['remove','update','register','length','smsQueue:','./smsQueue.events'];(function(_0x635e28,_0x4eecc1){var _0x5bb9dc=function(_0x4e4486){while(--_0x4e4486){_0x635e28['push'](_0x635e28['shift']());}};_0x5bb9dc(++_0x4eecc1);}(_0x20c2,0x131));var _0x220c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x20c2[_0x14add3];return _0x4a174f;};'use strict';var SmsQueueEvents=require(_0x220c('0x0'));var events=['save',_0x220c('0x1'),_0x220c('0x2')];function createListener(_0x6590f9,_0x2e1b38){return function(_0x51046b){_0x2e1b38['emit'](_0x6590f9,_0x51046b);};}function removeListener(_0x2d12c1,_0x516369){return function(){SmsQueueEvents['removeListener'](_0x2d12c1,_0x516369);};}exports[_0x220c('0x3')]=function(_0x441e4f){for(var _0x5db486=0x0,_0x514089=events[_0x220c('0x4')];_0x5db486<_0x514089;_0x5db486++){var _0x23534e=events[_0x5db486];var _0x327165=createListener(_0x220c('0x5')+_0x23534e,_0x441e4f);SmsQueueEvents['on'](_0x23534e,_0x327165);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 26d02cf..2b61daf 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 _0x5c24=['index','get','/describe','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated'];(function(_0x536e86,_0x2a5f79){var _0x50862e=function(_0x43eb89){while(--_0x43eb89){_0x536e86['push'](_0x536e86['shift']());}};_0x50862e(++_0x2a5f79);}(_0x5c24,0x186));var _0x45c2=function(_0x4d8666,_0x2ff19d){_0x4d8666=_0x4d8666-0x0;var _0x37175b=_0x5c24[_0x4d8666];return _0x37175b;};'use strict';var multer=require('multer');var util=require(_0x45c2('0x0'));var path=require('path');var timeout=require(_0x45c2('0x1'));var express=require(_0x45c2('0x2'));var router=express[_0x45c2('0x3')]();var fs_extra=require(_0x45c2('0x4'));var auth=require(_0x45c2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x45c2('0x6'));var controller=require(_0x45c2('0x7'));router['get']('/',auth[_0x45c2('0x8')](),controller[_0x45c2('0x9')]);router[_0x45c2('0xa')](_0x45c2('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x45c2('0xa')](_0x45c2('0xc'),auth['isAuthenticated'](),controller[_0x45c2('0xd')]);router[_0x45c2('0xe')]('/',auth[_0x45c2('0x8')](),controller[_0x45c2('0xf')]);router[_0x45c2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x45c2('0x11')]);router[_0x45c2('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x45c2('0x13')]);module[_0x45c2('0x14')]=router; \ No newline at end of file +var _0x5334=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id','isAuthenticated','show','post','put','update','destroy','exports','multer'];(function(_0x1621f4,_0x359725){var _0x3946e7=function(_0x2665c7){while(--_0x2665c7){_0x1621f4['push'](_0x1621f4['shift']());}};_0x3946e7(++_0x359725);}(_0x5334,0x84));var _0x4533=function(_0x354447,_0x442bc1){_0x354447=_0x354447-0x0;var _0xc660f4=_0x5334[_0x354447];return _0xc660f4;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./smsQueueReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')]('/',auth[_0x4533('0xc')](),controller['create']);router[_0x4533('0xf')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0x10')]);router['delete'](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0x11')]);module[_0x4533('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 08aafd0..1c65cce 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 _0x5b94=['sequelize','exports','STRING','DATE','moment'];(function(_0x32552a,_0x512d53){var _0x45c93b=function(_0x308440){while(--_0x308440){_0x32552a['push'](_0x32552a['shift']());}};_0x45c93b(++_0x512d53);}(_0x5b94,0x117));var _0x45b9=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x5b94[_0x2080a3];return _0x8d7d17;};'use strict';var moment=require(_0x45b9('0x0'));var Sequelize=require(_0x45b9('0x1'));module[_0x45b9('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x45b9('0x3')]},'joinAt':{'type':Sequelize[_0x45b9('0x4')]},'leaveAt':{'type':Sequelize[_0x45b9('0x4')]},'acceptAt':{'type':Sequelize[_0x45b9('0x4')]},'exitAt':{'type':Sequelize[_0x45b9('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7def=['moment','exports','STRING','DATE'];(function(_0x328379,_0x453160){var _0x3f9100=function(_0x6e03b3){while(--_0x6e03b3){_0x328379['push'](_0x328379['shift']());}};_0x3f9100(++_0x453160);}(_0x7def,0x74));var _0xf7de=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0x7def[_0x474bc0];return _0x4b24cf;};'use strict';var moment=require(_0xf7de('0x0'));var Sequelize=require('sequelize');module[_0xf7de('0x1')]={'uniqueid':{'type':Sequelize[_0xf7de('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf7de('0x3')]},'leaveAt':{'type':Sequelize[_0xf7de('0x3')]},'acceptAt':{'type':Sequelize[_0xf7de('0x3')]},'exitAt':{'type':Sequelize[_0xf7de('0x3')]},'reason':{'type':Sequelize[_0xf7de('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 22d0f84..ea11f8b 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 _0x04dd=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit'];(function(_0x5549eb,_0x351f01){var _0x2b7cdf=function(_0x529911){while(--_0x529911){_0x5549eb['push'](_0x5549eb['shift']());}};_0x2b7cdf(++_0x351f01);}(_0x04dd,0xc2));var _0xd04d=function(_0x5c3d11,_0x589686){_0x5c3d11=_0x5c3d11-0x0;var _0x31e455=_0x04dd[_0x5c3d11];return _0x31e455;};'use strict';var emlformat=require(_0xd04d('0x0'));var rimraf=require(_0xd04d('0x1'));var zipdir=require(_0xd04d('0x2'));var jsonpatch=require(_0xd04d('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(_0xd04d('0x4'));var sox=require(_0xd04d('0x5'));var csv=require(_0xd04d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd04d('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd04d('0x8'));var jsforce=require(_0xd04d('0x9'));var deskjs=require(_0xd04d('0xa'));var toCsv=require(_0xd04d('0x6'));var querystring=require(_0xd04d('0xb'));var Papa=require('papaparse');var Redis=require(_0xd04d('0xc'));var authService=require(_0xd04d('0xd'));var qs=require(_0xd04d('0xe'));var as=require(_0xd04d('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd04d('0x10'))(_0xd04d('0x11'));var utils=require(_0xd04d('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd04d('0x13'))['db'];function respondWithStatusCode(_0x2fcee5,_0x1f34f2){_0x1f34f2=_0x1f34f2||0xcc;return function(_0x5a0d05){if(_0x5a0d05){return _0x2fcee5[_0xd04d('0x14')](_0x1f34f2);}return _0x2fcee5[_0xd04d('0x15')](_0x1f34f2)[_0xd04d('0x16')]();};}function respondWithResult(_0x3e32fe,_0x24410c){_0x24410c=_0x24410c||0xc8;return function(_0x157d3b){if(_0x157d3b){return _0x3e32fe['status'](_0x24410c)[_0xd04d('0x17')](_0x157d3b);}};}function respondWithFilteredResult(_0x28862b,_0x45df54){return function(_0x57c46f){if(_0x57c46f){var _0xe61e48=typeof _0x45df54['offset']===_0xd04d('0x18')&&typeof _0x45df54['limit']===_0xd04d('0x18');var _0x145e5f=_0x57c46f['count'];var _0x16fd86=_0xe61e48?0x0:_0x45df54[_0xd04d('0x19')];var _0x2b9f56=_0xe61e48?_0x57c46f[_0xd04d('0x1a')]:_0x45df54[_0xd04d('0x19')]+_0x45df54[_0xd04d('0x1b')];var _0x19e999;if(_0x2b9f56>=_0x145e5f){_0x2b9f56=_0x145e5f;_0x19e999=0xc8;}else{_0x19e999=0xce;}_0x28862b[_0xd04d('0x15')](_0x19e999);return _0x28862b[_0xd04d('0x1c')](_0xd04d('0x1d'),_0x16fd86+'-'+_0x2b9f56+'/'+_0x145e5f)['json'](_0x57c46f);}return null;};}function patchUpdates(_0x343a25){return function(_0x2b4979){try{jsonpatch[_0xd04d('0x1e')](_0x2b4979,_0x343a25,!![]);}catch(_0x43124c){return BPromise['reject'](_0x43124c);}return _0x2b4979[_0xd04d('0x1f')]();};}function saveUpdates(_0x2347ee,_0x2268c1){return function(_0x127ccd){if(_0x127ccd){return _0x127ccd[_0xd04d('0x20')](_0x2347ee)[_0xd04d('0x21')](function(_0x32ba6a){return _0x32ba6a;});}return null;};}function removeEntity(_0x4c1a11,_0x3c0d16){return function(_0x47e6a1){if(_0x47e6a1){return _0x47e6a1[_0xd04d('0x22')]()[_0xd04d('0x21')](function(){_0x4c1a11[_0xd04d('0x15')](0xcc)[_0xd04d('0x16')]();});}};}function handleEntityNotFound(_0x54b908,_0x1735ae){return function(_0x10a53b){if(!_0x10a53b){_0x54b908[_0xd04d('0x14')](0x194);}return _0x10a53b;};}function handleError(_0x5d4fa9,_0x3a6397){_0x3a6397=_0x3a6397||0x1f4;return function(_0x4bb645){logger[_0xd04d('0x23')](_0x4bb645[_0xd04d('0x24')]);if(_0x4bb645[_0xd04d('0x25')]){delete _0x4bb645[_0xd04d('0x25')];}_0x5d4fa9['status'](_0x3a6397)[_0xd04d('0x26')](_0x4bb645);};}exports[_0xd04d('0x27')]=function(_0x2b1355,_0x3bd4c5){var _0x3eb3c8={},_0x66ccbc={},_0x5bb9f6={'count':0x0,'rows':[]};var _0x1949e4=_[_0xd04d('0x28')](db[_0xd04d('0x29')][_0xd04d('0x2a')],function(_0x576026){return{'name':_0x576026['fieldName'],'type':_0x576026['type'][_0xd04d('0x2b')]};});_0x66ccbc['model']=_[_0xd04d('0x28')](_0x1949e4,_0xd04d('0x25'));_0x66ccbc['query']=_[_0xd04d('0x2c')](_0x2b1355[_0xd04d('0x2d')]);_0x66ccbc[_0xd04d('0x2e')]=_[_0xd04d('0x2f')](_0x66ccbc[_0xd04d('0x30')],_0x66ccbc[_0xd04d('0x2d')]);_0x3eb3c8[_0xd04d('0x31')]=_[_0xd04d('0x2f')](_0x66ccbc[_0xd04d('0x30')],qs[_0xd04d('0x32')](_0x2b1355[_0xd04d('0x2d')]['fields']));_0x3eb3c8['attributes']=_0x3eb3c8['attributes'][_0xd04d('0x33')]?_0x3eb3c8[_0xd04d('0x31')]:_0x66ccbc[_0xd04d('0x30')];if(!_0x2b1355[_0xd04d('0x2d')][_0xd04d('0x34')](_0xd04d('0x35'))){_0x3eb3c8[_0xd04d('0x1b')]=qs[_0xd04d('0x1b')](_0x2b1355['query']['limit']);_0x3eb3c8[_0xd04d('0x19')]=qs[_0xd04d('0x19')](_0x2b1355[_0xd04d('0x2d')]['offset']);}_0x3eb3c8[_0xd04d('0x36')]=qs[_0xd04d('0x37')](_0x2b1355[_0xd04d('0x2d')][_0xd04d('0x37')]);_0x3eb3c8['where']=qs[_0xd04d('0x2e')](_[_0xd04d('0x38')](_0x2b1355[_0xd04d('0x2d')],_0x66ccbc[_0xd04d('0x2e')]),_0x1949e4);if(_0x2b1355['query'][_0xd04d('0x39')]){_0x3eb3c8[_0xd04d('0x3a')]=_[_0xd04d('0x3b')](_0x3eb3c8['where'],{'$or':_[_0xd04d('0x28')](_0x1949e4,function(_0x3949dc){if(_0x3949dc[_0xd04d('0x3c')]!==_0xd04d('0x3d')){var _0xa4b44={};_0xa4b44[_0x3949dc[_0xd04d('0x25')]]={'$like':'%'+_0x2b1355[_0xd04d('0x2d')][_0xd04d('0x39')]+'%'};return _0xa4b44;}})});}_0x3eb3c8=_[_0xd04d('0x3b')]({},_0x3eb3c8,_0x2b1355[_0xd04d('0x3e')]);var _0x36a387={'where':_0x3eb3c8['where']};return db[_0xd04d('0x29')][_0xd04d('0x1a')](_0x36a387)['then'](function(_0x93f114){_0x5bb9f6[_0xd04d('0x1a')]=_0x93f114;if(_0x2b1355[_0xd04d('0x2d')][_0xd04d('0x3f')]){_0x3eb3c8[_0xd04d('0x40')]=[{'all':!![]}];}return db[_0xd04d('0x29')][_0xd04d('0x41')](_0x3eb3c8);})[_0xd04d('0x21')](function(_0x38521a){_0x5bb9f6[_0xd04d('0x42')]=_0x38521a;return _0x5bb9f6;})[_0xd04d('0x21')](respondWithFilteredResult(_0x3bd4c5,_0x3eb3c8))[_0xd04d('0x43')](handleError(_0x3bd4c5,null));};exports[_0xd04d('0x44')]=function(_0x40a96b,_0x1346e0){var _0x28290e={'raw':!![],'where':{'id':_0x40a96b[_0xd04d('0x45')]['id']}},_0x1aa3f2={};_0x1aa3f2['model']=_[_0xd04d('0x2c')](db[_0xd04d('0x29')][_0xd04d('0x2a')]);_0x1aa3f2[_0xd04d('0x2d')]=_[_0xd04d('0x2c')](_0x40a96b[_0xd04d('0x2d')]);_0x1aa3f2['filters']=_[_0xd04d('0x2f')](_0x1aa3f2['model'],_0x1aa3f2[_0xd04d('0x2d')]);_0x28290e[_0xd04d('0x31')]=_[_0xd04d('0x2f')](_0x1aa3f2[_0xd04d('0x30')],qs['fields'](_0x40a96b[_0xd04d('0x2d')][_0xd04d('0x32')]));_0x28290e[_0xd04d('0x31')]=_0x28290e[_0xd04d('0x31')][_0xd04d('0x33')]?_0x28290e[_0xd04d('0x31')]:_0x1aa3f2[_0xd04d('0x30')];if(_0x40a96b[_0xd04d('0x2d')][_0xd04d('0x3f')]){_0x28290e[_0xd04d('0x40')]=[{'all':!![]}];}_0x28290e=_['merge']({},_0x28290e,_0x40a96b[_0xd04d('0x3e')]);return db[_0xd04d('0x29')][_0xd04d('0x46')](_0x28290e)[_0xd04d('0x21')](handleEntityNotFound(_0x1346e0,null))[_0xd04d('0x21')](respondWithResult(_0x1346e0,null))[_0xd04d('0x43')](handleError(_0x1346e0,null));};exports[_0xd04d('0x47')]=function(_0x4213c8,_0xd266d4){return db[_0xd04d('0x29')][_0xd04d('0x47')](_0x4213c8[_0xd04d('0x48')],{})['then'](respondWithResult(_0xd266d4,0xc9))[_0xd04d('0x43')](handleError(_0xd266d4,null));};exports[_0xd04d('0x20')]=function(_0x288fec,_0x312f43){if(_0x288fec['body']['id']){delete _0x288fec[_0xd04d('0x48')]['id'];}return db[_0xd04d('0x29')][_0xd04d('0x46')]({'where':{'id':_0x288fec[_0xd04d('0x45')]['id']}})['then'](handleEntityNotFound(_0x312f43,null))[_0xd04d('0x21')](saveUpdates(_0x288fec[_0xd04d('0x48')],null))['then'](respondWithResult(_0x312f43,null))[_0xd04d('0x43')](handleError(_0x312f43,null));};exports[_0xd04d('0x22')]=function(_0xe165ed,_0x577aec){return db[_0xd04d('0x29')]['find']({'where':{'id':_0xe165ed[_0xd04d('0x45')]['id']}})[_0xd04d('0x21')](handleEntityNotFound(_0x577aec,null))['then'](removeEntity(_0x577aec,null))['catch'](handleError(_0x577aec,null));};exports[_0xd04d('0x49')]=function(_0x487053,_0x55e3f8){return db['SmsQueueReport'][_0xd04d('0x49')]()[_0xd04d('0x21')](respondWithResult(_0x55e3f8,null))['catch'](handleError(_0x55e3f8,null));}; \ No newline at end of file +var _0x2cb2=['findAll','catch','rawAttributes','include','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','stack','name','send','index','map','SmsQueueReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll'];(function(_0x4864c0,_0x18376f){var _0x2f1350=function(_0x37c65a){while(--_0x37c65a){_0x4864c0['push'](_0x4864c0['shift']());}};_0x2f1350(++_0x18376f);}(_0x2cb2,0xe4));var _0x22cb=function(_0x1c17c0,_0x46d909){_0x1c17c0=_0x1c17c0-0x0;var _0x1cade4=_0x2cb2[_0x1c17c0];return _0x1cade4;};'use strict';var emlformat=require(_0x22cb('0x0'));var rimraf=require(_0x22cb('0x1'));var zipdir=require(_0x22cb('0x2'));var jsonpatch=require(_0x22cb('0x3'));var rp=require(_0x22cb('0x4'));var moment=require(_0x22cb('0x5'));var BPromise=require(_0x22cb('0x6'));var Mustache=require(_0x22cb('0x7'));var util=require('util');var path=require(_0x22cb('0x8'));var sox=require(_0x22cb('0x9'));var csv=require(_0x22cb('0xa'));var ejs=require(_0x22cb('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22cb('0xc'));var squel=require(_0x22cb('0xd'));var crypto=require(_0x22cb('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x22cb('0xa'));var querystring=require(_0x22cb('0xf'));var Papa=require('papaparse');var Redis=require(_0x22cb('0x10'));var authService=require(_0x22cb('0x11'));var qs=require(_0x22cb('0x12'));var as=require(_0x22cb('0x13'));var hardwareService=require(_0x22cb('0x14'));var logger=require('../../config/logger')(_0x22cb('0x15'));var utils=require(_0x22cb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x22cb('0x17'));var db=require(_0x22cb('0x18'))['db'];function respondWithStatusCode(_0x1329d1,_0x991061){_0x991061=_0x991061||0xcc;return function(_0x4109de){if(_0x4109de){return _0x1329d1[_0x22cb('0x19')](_0x991061);}return _0x1329d1['status'](_0x991061)[_0x22cb('0x1a')]();};}function respondWithResult(_0x1e26db,_0x64728d){_0x64728d=_0x64728d||0xc8;return function(_0x412f4d){if(_0x412f4d){return _0x1e26db['status'](_0x64728d)[_0x22cb('0x1b')](_0x412f4d);}};}function respondWithFilteredResult(_0x53d087,_0x1ededf){return function(_0x23fffc){if(_0x23fffc){var _0x332fcd=typeof _0x1ededf[_0x22cb('0x1c')]===_0x22cb('0x1d')&&typeof _0x1ededf[_0x22cb('0x1e')]===_0x22cb('0x1d');var _0x440b46=_0x23fffc[_0x22cb('0x1f')];var _0x5a3ed9=_0x332fcd?0x0:_0x1ededf[_0x22cb('0x1c')];var _0x3612bc=_0x332fcd?_0x23fffc[_0x22cb('0x1f')]:_0x1ededf['offset']+_0x1ededf[_0x22cb('0x1e')];var _0x380f37;if(_0x3612bc>=_0x440b46){_0x3612bc=_0x440b46;_0x380f37=0xc8;}else{_0x380f37=0xce;}_0x53d087[_0x22cb('0x20')](_0x380f37);return _0x53d087[_0x22cb('0x21')]('Content-Range',_0x5a3ed9+'-'+_0x3612bc+'/'+_0x440b46)['json'](_0x23fffc);}return null;};}function patchUpdates(_0x3c92c7){return function(_0x5c17fc){try{jsonpatch[_0x22cb('0x22')](_0x5c17fc,_0x3c92c7,!![]);}catch(_0x4dedac){return BPromise['reject'](_0x4dedac);}return _0x5c17fc[_0x22cb('0x23')]();};}function saveUpdates(_0x125fca,_0x27d0c9){return function(_0x539cb8){if(_0x539cb8){return _0x539cb8[_0x22cb('0x24')](_0x125fca)[_0x22cb('0x25')](function(_0x16323c){return _0x16323c;});}return null;};}function removeEntity(_0x2ac244,_0x543a89){return function(_0x459c81){if(_0x459c81){return _0x459c81[_0x22cb('0x26')]()[_0x22cb('0x25')](function(){_0x2ac244[_0x22cb('0x20')](0xcc)[_0x22cb('0x1a')]();});}};}function handleEntityNotFound(_0x88772e,_0x239fc2){return function(_0xaff6e6){if(!_0xaff6e6){_0x88772e[_0x22cb('0x19')](0x194);}return _0xaff6e6;};}function handleError(_0x1227f4,_0x8d6716){_0x8d6716=_0x8d6716||0x1f4;return function(_0x6ad5f5){logger['error'](_0x6ad5f5[_0x22cb('0x27')]);if(_0x6ad5f5[_0x22cb('0x28')]){delete _0x6ad5f5[_0x22cb('0x28')];}_0x1227f4[_0x22cb('0x20')](_0x8d6716)[_0x22cb('0x29')](_0x6ad5f5);};}exports[_0x22cb('0x2a')]=function(_0x417cea,_0x46fe28){var _0x443c3a={},_0x12f28d={},_0x41f9b3={'count':0x0,'rows':[]};var _0x38e42b=_[_0x22cb('0x2b')](db[_0x22cb('0x2c')]['rawAttributes'],function(_0x287215){return{'name':_0x287215[_0x22cb('0x2d')],'type':_0x287215[_0x22cb('0x2e')][_0x22cb('0x2f')]};});_0x12f28d['model']=_[_0x22cb('0x2b')](_0x38e42b,_0x22cb('0x28'));_0x12f28d[_0x22cb('0x30')]=_[_0x22cb('0x31')](_0x417cea[_0x22cb('0x30')]);_0x12f28d[_0x22cb('0x32')]=_[_0x22cb('0x33')](_0x12f28d[_0x22cb('0x34')],_0x12f28d['query']);_0x443c3a[_0x22cb('0x35')]=_[_0x22cb('0x33')](_0x12f28d[_0x22cb('0x34')],qs['fields'](_0x417cea['query'][_0x22cb('0x36')]));_0x443c3a[_0x22cb('0x35')]=_0x443c3a[_0x22cb('0x35')][_0x22cb('0x37')]?_0x443c3a['attributes']:_0x12f28d[_0x22cb('0x34')];if(!_0x417cea[_0x22cb('0x30')][_0x22cb('0x38')](_0x22cb('0x39'))){_0x443c3a[_0x22cb('0x1e')]=qs['limit'](_0x417cea['query'][_0x22cb('0x1e')]);_0x443c3a['offset']=qs[_0x22cb('0x1c')](_0x417cea['query'][_0x22cb('0x1c')]);}_0x443c3a[_0x22cb('0x3a')]=qs[_0x22cb('0x3b')](_0x417cea[_0x22cb('0x30')]['sort']);_0x443c3a[_0x22cb('0x3c')]=qs['filters'](_['pick'](_0x417cea[_0x22cb('0x30')],_0x12f28d['filters']),_0x38e42b);if(_0x417cea[_0x22cb('0x30')][_0x22cb('0x3d')]){_0x443c3a[_0x22cb('0x3c')]=_[_0x22cb('0x3e')](_0x443c3a['where'],{'$or':_['map'](_0x38e42b,function(_0x562331){if(_0x562331[_0x22cb('0x2e')]!=='VIRTUAL'){var _0x37306b={};_0x37306b[_0x562331['name']]={'$like':'%'+_0x417cea[_0x22cb('0x30')][_0x22cb('0x3d')]+'%'};return _0x37306b;}})});}_0x443c3a=_[_0x22cb('0x3e')]({},_0x443c3a,_0x417cea['options']);var _0x5c0fbc={'where':_0x443c3a['where']};return db[_0x22cb('0x2c')][_0x22cb('0x1f')](_0x5c0fbc)[_0x22cb('0x25')](function(_0x144047){_0x41f9b3['count']=_0x144047;if(_0x417cea[_0x22cb('0x30')][_0x22cb('0x3f')]){_0x443c3a['include']=[{'all':!![]}];}return db[_0x22cb('0x2c')][_0x22cb('0x40')](_0x443c3a);})[_0x22cb('0x25')](function(_0x327688){_0x41f9b3['rows']=_0x327688;return _0x41f9b3;})['then'](respondWithFilteredResult(_0x46fe28,_0x443c3a))[_0x22cb('0x41')](handleError(_0x46fe28,null));};exports['show']=function(_0x2ae74e,_0x1ae157){var _0x156c64={'raw':!![],'where':{'id':_0x2ae74e['params']['id']}},_0x58f9f8={};_0x58f9f8[_0x22cb('0x34')]=_[_0x22cb('0x31')](db['SmsQueueReport'][_0x22cb('0x42')]);_0x58f9f8[_0x22cb('0x30')]=_[_0x22cb('0x31')](_0x2ae74e[_0x22cb('0x30')]);_0x58f9f8[_0x22cb('0x32')]=_['intersection'](_0x58f9f8[_0x22cb('0x34')],_0x58f9f8['query']);_0x156c64['attributes']=_['intersection'](_0x58f9f8[_0x22cb('0x34')],qs['fields'](_0x2ae74e['query'][_0x22cb('0x36')]));_0x156c64[_0x22cb('0x35')]=_0x156c64['attributes']['length']?_0x156c64[_0x22cb('0x35')]:_0x58f9f8['model'];if(_0x2ae74e[_0x22cb('0x30')][_0x22cb('0x3f')]){_0x156c64[_0x22cb('0x43')]=[{'all':!![]}];}_0x156c64=_[_0x22cb('0x3e')]({},_0x156c64,_0x2ae74e['options']);return db[_0x22cb('0x2c')][_0x22cb('0x44')](_0x156c64)[_0x22cb('0x25')](handleEntityNotFound(_0x1ae157,null))[_0x22cb('0x25')](respondWithResult(_0x1ae157,null))[_0x22cb('0x41')](handleError(_0x1ae157,null));};exports['create']=function(_0x562c91,_0x456ae1){return db['SmsQueueReport'][_0x22cb('0x45')](_0x562c91[_0x22cb('0x46')],{})[_0x22cb('0x25')](respondWithResult(_0x456ae1,0xc9))['catch'](handleError(_0x456ae1,null));};exports[_0x22cb('0x24')]=function(_0x13773a,_0x1eaef4){if(_0x13773a[_0x22cb('0x46')]['id']){delete _0x13773a[_0x22cb('0x46')]['id'];}return db[_0x22cb('0x2c')][_0x22cb('0x44')]({'where':{'id':_0x13773a['params']['id']}})[_0x22cb('0x25')](handleEntityNotFound(_0x1eaef4,null))[_0x22cb('0x25')](saveUpdates(_0x13773a[_0x22cb('0x46')],null))[_0x22cb('0x25')](respondWithResult(_0x1eaef4,null))['catch'](handleError(_0x1eaef4,null));};exports[_0x22cb('0x26')]=function(_0xa53868,_0x352f2a){return db[_0x22cb('0x2c')][_0x22cb('0x44')]({'where':{'id':_0xa53868[_0x22cb('0x47')]['id']}})[_0x22cb('0x25')](handleEntityNotFound(_0x352f2a,null))[_0x22cb('0x25')](removeEntity(_0x352f2a,null))[_0x22cb('0x41')](handleError(_0x352f2a,null));};exports[_0x22cb('0x48')]=function(_0x123d67,_0x5d53aa){return db[_0x22cb('0x2c')]['describe']()['then'](respondWithResult(_0x5d53aa,null))['catch'](handleError(_0x5d53aa,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index ca7d0d6..a3d8e32 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 _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x60a4d9,_0x4ed49d){var _0xe5366b=function(_0x19215b){while(--_0x19215b){_0x60a4d9['push'](_0x60a4d9['shift']());}};_0xe5366b(++_0x4ed49d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb7e7[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x1f9f07,_0x3b5ae2){var _0x408ec6=function(_0x401ad0){while(--_0x401ad0){_0x1f9f07['push'](_0x1f9f07['shift']());}};_0x408ec6(++_0x3b5ae2);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index bb24246..67bdc8e 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 _0x8380=['SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','SmsQueueReport','raw','CreateSmsQueueReport','update','body','options','where','UpdateSmsQueueReport','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x8380,0xb8));var _0x0838=function(_0x30e130,_0x3cf66e){_0x30e130=_0x30e130-0x0;var _0x3dd42e=_0x8380[_0x30e130];return _0x3dd42e;};'use strict';var _=require('lodash');var util=require(_0x0838('0x0'));var moment=require(_0x0838('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0838('0x2'));var db=require(_0x0838('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0838('0x4'))(_0x0838('0x5'));var config=require(_0x0838('0x6'));var jayson=require(_0x0838('0x7'));var client=jayson['client'][_0x0838('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe07320,_0x527535,_0x2b625a){return new BPromise(function(_0x2bdcc0,_0x580e5b){return client[_0x0838('0x9')](_0xe07320,_0x2b625a)[_0x0838('0xa')](function(_0x3643ff){logger[_0x0838('0xb')](_0x0838('0xc'),_0x527535,_0x0838('0xd'));logger[_0x0838('0xe')](_0x0838('0xf'),_0x527535,_0x0838('0xd'),JSON['stringify'](_0x3643ff));if(_0x3643ff[_0x0838('0x10')]){if(_0x3643ff['error']['code']===0x1f4){logger[_0x0838('0x10')](_0x0838('0xc'),_0x527535,_0x3643ff[_0x0838('0x10')][_0x0838('0x11')]);return _0x580e5b(_0x3643ff['error'][_0x0838('0x11')]);}logger[_0x0838('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x527535,_0x3643ff['error'][_0x0838('0x11')]);return _0x2bdcc0(_0x3643ff['error']['message']);}else{logger['info'](_0x0838('0xc'),_0x527535,_0x0838('0xd'));_0x2bdcc0(_0x3643ff[_0x0838('0x12')][_0x0838('0x11')]);}})[_0x0838('0x13')](function(_0x5490f3){logger['error'](_0x0838('0xc'),_0x527535,_0x5490f3);_0x580e5b(_0x5490f3);});});}exports['CreateSmsQueueReport']=function(_0x53db02){var _0x27bf85=this;return new Promise(function(_0x540303,_0x3e9c8a){return db[_0x0838('0x14')]['create'](_0x53db02['body'],{'raw':_0x53db02['options']?_0x53db02['options'][_0x0838('0x15')]===undefined?!![]:![]:!![]})[_0x0838('0xa')](function(_0x422106){logger[_0x0838('0xb')](_0x0838('0x16'),_0x53db02);logger[_0x0838('0xe')](_0x0838('0x16'),_0x53db02,JSON['stringify'](_0x422106));_0x540303(_0x422106);})[_0x0838('0x13')](function(_0x5344db){logger[_0x0838('0x10')](_0x0838('0x16'),_0x5344db[_0x0838('0x11')],_0x53db02);_0x3e9c8a(_0x27bf85['error'](0x1f4,_0x5344db[_0x0838('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x21ad78){var _0x460de7=this;return new Promise(function(_0x2131f1,_0x1334e7){return db[_0x0838('0x14')][_0x0838('0x17')](_0x21ad78[_0x0838('0x18')],{'raw':_0x21ad78[_0x0838('0x19')]?_0x21ad78[_0x0838('0x19')][_0x0838('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21ad78[_0x0838('0x19')]?_0x21ad78['options'][_0x0838('0x1a')]||null:null,'attributes':_0x21ad78[_0x0838('0x19')]?_0x21ad78[_0x0838('0x19')]['attributes']||null:null,'limit':_0x21ad78[_0x0838('0x19')]?_0x21ad78['options']['limit']||null:null})[_0x0838('0xa')](function(_0x9ed48b){logger[_0x0838('0xb')](_0x0838('0x1b'),_0x21ad78);logger['debug'](_0x0838('0x1b'),_0x21ad78,JSON['stringify'](_0x9ed48b));_0x2131f1(_0x9ed48b);})[_0x0838('0x13')](function(_0x2e8f65){logger[_0x0838('0x10')](_0x0838('0x1b'),_0x2e8f65['message'],_0x21ad78);_0x1334e7(_0x460de7[_0x0838('0x10')](0x1f4,_0x2e8f65[_0x0838('0x11')]));});});}; \ No newline at end of file +var _0xae54=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','UpdateSmsQueueReport','update','raw','where','util','moment','bluebird','randomstring'];(function(_0x3d92c7,_0x8824a8){var _0x53f715=function(_0x337a9c){while(--_0x337a9c){_0x3d92c7['push'](_0x3d92c7['shift']());}};_0x53f715(++_0x8824a8);}(_0xae54,0x132));var _0x4ae5=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0xae54[_0x5534fe];return _0x3d1dc2;};'use strict';var _=require('lodash');var util=require(_0x4ae5('0x0'));var moment=require(_0x4ae5('0x1'));var BPromise=require(_0x4ae5('0x2'));var rs=require(_0x4ae5('0x3'));var fs=require('fs');var Redis=require(_0x4ae5('0x4'));var db=require(_0x4ae5('0x5'))['db'];var utils=require(_0x4ae5('0x6'));var logger=require(_0x4ae5('0x7'))(_0x4ae5('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ae5('0x9')][_0x4ae5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2515fe,_0x1ce1ef,_0x1794f3){return new BPromise(function(_0x316c0f,_0x467e5e){return client[_0x4ae5('0xb')](_0x2515fe,_0x1794f3)['then'](function(_0x54d138){logger[_0x4ae5('0xc')](_0x4ae5('0xd'),_0x1ce1ef,_0x4ae5('0xe'));logger[_0x4ae5('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1ce1ef,'request\x20sent',JSON[_0x4ae5('0x10')](_0x54d138));if(_0x54d138['error']){if(_0x54d138['error'][_0x4ae5('0x11')]===0x1f4){logger[_0x4ae5('0x12')](_0x4ae5('0xd'),_0x1ce1ef,_0x54d138[_0x4ae5('0x12')][_0x4ae5('0x13')]);return _0x467e5e(_0x54d138[_0x4ae5('0x12')][_0x4ae5('0x13')]);}logger[_0x4ae5('0x12')](_0x4ae5('0xd'),_0x1ce1ef,_0x54d138['error'][_0x4ae5('0x13')]);return _0x316c0f(_0x54d138[_0x4ae5('0x12')][_0x4ae5('0x13')]);}else{logger[_0x4ae5('0xc')](_0x4ae5('0xd'),_0x1ce1ef,_0x4ae5('0xe'));_0x316c0f(_0x54d138[_0x4ae5('0x14')]['message']);}})[_0x4ae5('0x15')](function(_0x305941){logger['error'](_0x4ae5('0xd'),_0x1ce1ef,_0x305941);_0x467e5e(_0x305941);});});}exports[_0x4ae5('0x16')]=function(_0x226ea5){var _0x2c4db0=this;return new Promise(function(_0x306fb9,_0x2e7b56){return db[_0x4ae5('0x17')][_0x4ae5('0x18')](_0x226ea5[_0x4ae5('0x19')],{'raw':_0x226ea5[_0x4ae5('0x1a')]?_0x226ea5[_0x4ae5('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4f7eaf){logger['info']('CreateSmsQueueReport',_0x226ea5);logger[_0x4ae5('0xf')](_0x4ae5('0x16'),_0x226ea5,JSON[_0x4ae5('0x10')](_0x4f7eaf));_0x306fb9(_0x4f7eaf);})[_0x4ae5('0x15')](function(_0x570648){logger[_0x4ae5('0x12')](_0x4ae5('0x16'),_0x570648['message'],_0x226ea5);_0x2e7b56(_0x2c4db0[_0x4ae5('0x12')](0x1f4,_0x570648[_0x4ae5('0x13')]));});});};exports[_0x4ae5('0x1b')]=function(_0x3d5d1a){var _0x382d83=this;return new Promise(function(_0x1432be,_0x3ad239){return db['SmsQueueReport'][_0x4ae5('0x1c')](_0x3d5d1a[_0x4ae5('0x19')],{'raw':_0x3d5d1a['options']?_0x3d5d1a['options'][_0x4ae5('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d5d1a[_0x4ae5('0x1a')]?_0x3d5d1a[_0x4ae5('0x1a')][_0x4ae5('0x1e')]||null:null,'attributes':_0x3d5d1a['options']?_0x3d5d1a[_0x4ae5('0x1a')]['attributes']||null:null,'limit':_0x3d5d1a[_0x4ae5('0x1a')]?_0x3d5d1a[_0x4ae5('0x1a')]['limit']||null:null})['then'](function(_0x44da5e){logger[_0x4ae5('0xc')](_0x4ae5('0x1b'),_0x3d5d1a);logger[_0x4ae5('0xf')](_0x4ae5('0x1b'),_0x3d5d1a,JSON[_0x4ae5('0x10')](_0x44da5e));_0x1432be(_0x44da5e);})[_0x4ae5('0x15')](function(_0x8bee73){logger[_0x4ae5('0x12')](_0x4ae5('0x1b'),_0x8bee73[_0x4ae5('0x13')],_0x3d5d1a);_0x3ad239(_0x382d83['error'](0x1f4,_0x8bee73[_0x4ae5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 3afcd6f..9411a4b 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 _0x4006=['path','connect-timeout','express','../../components/auth/service','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4006,0x1c7));var _0x6400=function(_0x54c279,_0x3d379d){_0x54c279=_0x54c279-0x0;var _0xc8ac97=_0x4006[_0x54c279];return _0xc8ac97;};'use strict';var multer=require('multer');var util=require(_0x6400('0x0'));var path=require(_0x6400('0x1'));var timeout=require(_0x6400('0x2'));var express=require(_0x6400('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6400('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6400('0x5'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x6400('0x6')](),controller['index']);router[_0x6400('0x7')](_0x6400('0x8'),auth[_0x6400('0x6')](),controller[_0x6400('0x9')]);router['get'](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xb')]);router[_0x6400('0xc')]('/',auth[_0x6400('0x6')](),controller[_0x6400('0xd')]);router[_0x6400('0xe')](_0x6400('0xa'),auth[_0x6400('0x6')](),controller[_0x6400('0xf')]);router[_0x6400('0x10')]('/:id',auth[_0x6400('0x6')](),controller[_0x6400('0x11')]);module[_0x6400('0x12')]=router; \ No newline at end of file +var _0x6334=['../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2569f1,_0x57bbf5){var _0x3149f0=function(_0x471c8b){while(--_0x471c8b){_0x2569f1['push'](_0x2569f1['shift']());}};_0x3149f0(++_0x57bbf5);}(_0x6334,0x119));var _0x4633=function(_0x2679b0,_0x2a1a6f){_0x2679b0=_0x2679b0-0x0;var _0x192302=_0x6334[_0x2679b0];return _0x192302;};'use strict';var multer=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var path=require(_0x4633('0x2'));var timeout=require(_0x4633('0x3'));var express=require(_0x4633('0x4'));var router=express[_0x4633('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4633('0x6'));var interaction=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var controller=require(_0x4633('0x9'));router[_0x4633('0xa')]('/',auth[_0x4633('0xb')](),controller[_0x4633('0xc')]);router['get'](_0x4633('0xd'),auth['isAuthenticated'](),controller[_0x4633('0xe')]);router[_0x4633('0xa')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0xf')]);router[_0x4633('0x10')]('/',auth['isAuthenticated'](),controller[_0x4633('0x11')]);router[_0x4633('0x12')]('/:id',auth[_0x4633('0xb')](),controller[_0x4633('0x13')]);router[_0x4633('0x14')](_0x4633('0x15'),auth['isAuthenticated'](),controller[_0x4633('0x16')]);module[_0x4633('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 05ed65b..42b6867 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x38aa04,_0x2c8039){var _0x39bb22=function(_0x5b4e9a){while(--_0x5b4e9a){_0x38aa04['push'](_0x38aa04['shift']());}};_0x39bb22(++_0x2c8039);}(_0x54ef,0x112));var _0xf54e=function(_0x479030,_0x5ac406){_0x479030=_0x479030-0x0;var _0xbf9448=_0x54ef[_0x479030];return _0xbf9448;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x518842,_0x504e31){var _0x5d22c6=function(_0x5915e9){while(--_0x5915e9){_0x518842['push'](_0x518842['shift']());}};_0x5d22c6(++_0x504e31);}(_0xaa88,0x137));var _0x8aa8=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0xaa88[_0x11ba83];return _0x3f3925;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index cf08ddc..f88ff30 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 _0x2b6e=['destroy','stack','name','send','index','map','SmsTransferReport','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','rows','catch','keys','intersection','include','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then'];(function(_0x3c0fcc,_0x1eac6c){var _0xcc6700=function(_0x55ed2f){while(--_0x55ed2f){_0x3c0fcc['push'](_0x3c0fcc['shift']());}};_0xcc6700(++_0x1eac6c);}(_0x2b6e,0x179));var _0xe2b6=function(_0x23d306,_0x5ead6f){_0x23d306=_0x23d306-0x0;var _0x2d9180=_0x2b6e[_0x23d306];return _0x2d9180;};'use strict';var emlformat=require(_0xe2b6('0x0'));var rimraf=require(_0xe2b6('0x1'));var zipdir=require(_0xe2b6('0x2'));var jsonpatch=require(_0xe2b6('0x3'));var rp=require(_0xe2b6('0x4'));var moment=require(_0xe2b6('0x5'));var BPromise=require(_0xe2b6('0x6'));var Mustache=require(_0xe2b6('0x7'));var util=require(_0xe2b6('0x8'));var path=require(_0xe2b6('0x9'));var sox=require(_0xe2b6('0xa'));var csv=require('to-csv');var ejs=require(_0xe2b6('0xb'));var fs=require('fs');var fs_extra=require(_0xe2b6('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe2b6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe2b6('0xe'));var querystring=require(_0xe2b6('0xf'));var Papa=require(_0xe2b6('0x10'));var Redis=require(_0xe2b6('0x11'));var authService=require(_0xe2b6('0x12'));var qs=require(_0xe2b6('0x13'));var as=require(_0xe2b6('0x14'));var hardwareService=require(_0xe2b6('0x15'));var logger=require('../../config/logger')(_0xe2b6('0x16'));var utils=require(_0xe2b6('0x17'));var config=require(_0xe2b6('0x18'));var licenseUtil=require(_0xe2b6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x124c28,_0x371c94){_0x371c94=_0x371c94||0xcc;return function(_0xbdf10b){if(_0xbdf10b){return _0x124c28[_0xe2b6('0x1a')](_0x371c94);}return _0x124c28[_0xe2b6('0x1b')](_0x371c94)['end']();};}function respondWithResult(_0x98465b,_0x2e6f76){_0x2e6f76=_0x2e6f76||0xc8;return function(_0x2693f7){if(_0x2693f7){return _0x98465b[_0xe2b6('0x1b')](_0x2e6f76)[_0xe2b6('0x1c')](_0x2693f7);}};}function respondWithFilteredResult(_0x4f2454,_0xc58df2){return function(_0x5927dc){if(_0x5927dc){var _0x529820=typeof _0xc58df2['offset']===_0xe2b6('0x1d')&&typeof _0xc58df2[_0xe2b6('0x1e')]===_0xe2b6('0x1d');var _0xd5679=_0x5927dc[_0xe2b6('0x1f')];var _0xc3468=_0x529820?0x0:_0xc58df2[_0xe2b6('0x20')];var _0xa5a9e0=_0x529820?_0x5927dc[_0xe2b6('0x1f')]:_0xc58df2[_0xe2b6('0x20')]+_0xc58df2['limit'];var _0x393fd1;if(_0xa5a9e0>=_0xd5679){_0xa5a9e0=_0xd5679;_0x393fd1=0xc8;}else{_0x393fd1=0xce;}_0x4f2454['status'](_0x393fd1);return _0x4f2454[_0xe2b6('0x21')](_0xe2b6('0x22'),_0xc3468+'-'+_0xa5a9e0+'/'+_0xd5679)[_0xe2b6('0x1c')](_0x5927dc);}return null;};}function patchUpdates(_0xa2f4b){return function(_0x35152b){try{jsonpatch['apply'](_0x35152b,_0xa2f4b,!![]);}catch(_0x255822){return BPromise['reject'](_0x255822);}return _0x35152b['save']();};}function saveUpdates(_0xd516bc,_0x5f30c9){return function(_0x507fcb){if(_0x507fcb){return _0x507fcb[_0xe2b6('0x23')](_0xd516bc)[_0xe2b6('0x24')](function(_0x1aa6f0){return _0x1aa6f0;});}return null;};}function removeEntity(_0x308895,_0x5cf71e){return function(_0x55c557){if(_0x55c557){return _0x55c557[_0xe2b6('0x25')]()[_0xe2b6('0x24')](function(){_0x308895[_0xe2b6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44d088,_0x497747){return function(_0x18f0ef){if(!_0x18f0ef){_0x44d088['sendStatus'](0x194);}return _0x18f0ef;};}function handleError(_0x22e9cd,_0x28fa24){_0x28fa24=_0x28fa24||0x1f4;return function(_0x34e5a5){logger['error'](_0x34e5a5[_0xe2b6('0x26')]);if(_0x34e5a5[_0xe2b6('0x27')]){delete _0x34e5a5[_0xe2b6('0x27')];}_0x22e9cd['status'](_0x28fa24)[_0xe2b6('0x28')](_0x34e5a5);};}exports[_0xe2b6('0x29')]=function(_0x132a2b,_0x2e3be0){var _0x19aa1f={},_0x3fe7f7={},_0x4de99f={'count':0x0,'rows':[]};var _0x22236b=_[_0xe2b6('0x2a')](db[_0xe2b6('0x2b')][_0xe2b6('0x2c')],function(_0x3da53e){return{'name':_0x3da53e[_0xe2b6('0x2d')],'type':_0x3da53e['type'][_0xe2b6('0x2e')]};});_0x3fe7f7[_0xe2b6('0x2f')]=_['map'](_0x22236b,'name');_0x3fe7f7[_0xe2b6('0x30')]=_['keys'](_0x132a2b[_0xe2b6('0x30')]);_0x3fe7f7[_0xe2b6('0x31')]=_['intersection'](_0x3fe7f7[_0xe2b6('0x2f')],_0x3fe7f7[_0xe2b6('0x30')]);_0x19aa1f[_0xe2b6('0x32')]=_['intersection'](_0x3fe7f7[_0xe2b6('0x2f')],qs[_0xe2b6('0x33')](_0x132a2b[_0xe2b6('0x30')][_0xe2b6('0x33')]));_0x19aa1f[_0xe2b6('0x32')]=_0x19aa1f[_0xe2b6('0x32')][_0xe2b6('0x34')]?_0x19aa1f[_0xe2b6('0x32')]:_0x3fe7f7[_0xe2b6('0x2f')];if(!_0x132a2b[_0xe2b6('0x30')][_0xe2b6('0x35')](_0xe2b6('0x36'))){_0x19aa1f[_0xe2b6('0x1e')]=qs[_0xe2b6('0x1e')](_0x132a2b[_0xe2b6('0x30')][_0xe2b6('0x1e')]);_0x19aa1f[_0xe2b6('0x20')]=qs[_0xe2b6('0x20')](_0x132a2b[_0xe2b6('0x30')][_0xe2b6('0x20')]);}_0x19aa1f['order']=qs['sort'](_0x132a2b[_0xe2b6('0x30')][_0xe2b6('0x37')]);_0x19aa1f[_0xe2b6('0x38')]=qs[_0xe2b6('0x31')](_['pick'](_0x132a2b[_0xe2b6('0x30')],_0x3fe7f7['filters']),_0x22236b);if(_0x132a2b[_0xe2b6('0x30')][_0xe2b6('0x39')]){_0x19aa1f[_0xe2b6('0x38')]=_[_0xe2b6('0x3a')](_0x19aa1f['where'],{'$or':_[_0xe2b6('0x2a')](_0x22236b,function(_0x3d5fd7){if(_0x3d5fd7['type']!==_0xe2b6('0x3b')){var _0x3ee6cc={};_0x3ee6cc[_0x3d5fd7[_0xe2b6('0x27')]]={'$like':'%'+_0x132a2b[_0xe2b6('0x30')]['filter']+'%'};return _0x3ee6cc;}})});}_0x19aa1f=_[_0xe2b6('0x3a')]({},_0x19aa1f,_0x132a2b['options']);var _0x2ac235={'where':_0x19aa1f[_0xe2b6('0x38')]};return db['SmsTransferReport'][_0xe2b6('0x1f')](_0x2ac235)[_0xe2b6('0x24')](function(_0x5d904d){_0x4de99f[_0xe2b6('0x1f')]=_0x5d904d;if(_0x132a2b[_0xe2b6('0x30')]['includeAll']){_0x19aa1f['include']=[{'all':!![]}];}return db[_0xe2b6('0x2b')]['findAll'](_0x19aa1f);})[_0xe2b6('0x24')](function(_0x50f181){_0x4de99f[_0xe2b6('0x3c')]=_0x50f181;return _0x4de99f;})['then'](respondWithFilteredResult(_0x2e3be0,_0x19aa1f))[_0xe2b6('0x3d')](handleError(_0x2e3be0,null));};exports['show']=function(_0x557acb,_0x4059fb){var _0x4cafae={'raw':!![],'where':{'id':_0x557acb['params']['id']}},_0x108763={};_0x108763[_0xe2b6('0x2f')]=_[_0xe2b6('0x3e')](db[_0xe2b6('0x2b')][_0xe2b6('0x2c')]);_0x108763[_0xe2b6('0x30')]=_['keys'](_0x557acb[_0xe2b6('0x30')]);_0x108763[_0xe2b6('0x31')]=_['intersection'](_0x108763[_0xe2b6('0x2f')],_0x108763[_0xe2b6('0x30')]);_0x4cafae['attributes']=_[_0xe2b6('0x3f')](_0x108763[_0xe2b6('0x2f')],qs[_0xe2b6('0x33')](_0x557acb['query']['fields']));_0x4cafae[_0xe2b6('0x32')]=_0x4cafae['attributes'][_0xe2b6('0x34')]?_0x4cafae[_0xe2b6('0x32')]:_0x108763[_0xe2b6('0x2f')];if(_0x557acb[_0xe2b6('0x30')]['includeAll']){_0x4cafae[_0xe2b6('0x40')]=[{'all':!![]}];}_0x4cafae=_[_0xe2b6('0x3a')]({},_0x4cafae,_0x557acb['options']);return db[_0xe2b6('0x2b')][_0xe2b6('0x41')](_0x4cafae)[_0xe2b6('0x24')](handleEntityNotFound(_0x4059fb,null))['then'](respondWithResult(_0x4059fb,null))['catch'](handleError(_0x4059fb,null));};exports['create']=function(_0x51f777,_0x44c00c){return db[_0xe2b6('0x2b')]['create'](_0x51f777['body'],{})[_0xe2b6('0x24')](respondWithResult(_0x44c00c,0xc9))[_0xe2b6('0x3d')](handleError(_0x44c00c,null));};exports['update']=function(_0x135f20,_0xd80cf9){if(_0x135f20['body']['id']){delete _0x135f20[_0xe2b6('0x42')]['id'];}return db[_0xe2b6('0x2b')][_0xe2b6('0x41')]({'where':{'id':_0x135f20[_0xe2b6('0x43')]['id']}})[_0xe2b6('0x24')](handleEntityNotFound(_0xd80cf9,null))[_0xe2b6('0x24')](saveUpdates(_0x135f20['body'],null))[_0xe2b6('0x24')](respondWithResult(_0xd80cf9,null))[_0xe2b6('0x3d')](handleError(_0xd80cf9,null));};exports[_0xe2b6('0x25')]=function(_0x387206,_0x570818){return db[_0xe2b6('0x2b')]['find']({'where':{'id':_0x387206['params']['id']}})['then'](handleEntityNotFound(_0x570818,null))['then'](removeEntity(_0x570818,null))[_0xe2b6('0x3d')](handleError(_0x570818,null));};exports[_0xe2b6('0x44')]=function(_0x291ed7,_0x445a37){return db[_0xe2b6('0x2b')][_0xe2b6('0x44')]()['then'](respondWithResult(_0x445a37,null))[_0xe2b6('0x3d')](handleError(_0x445a37,null));}; \ No newline at end of file +var _0xa257=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','merge','filter','options','SmsTransferReport','catch','show','includeAll','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query'];(function(_0xd6314a,_0x683bf1){var _0xc76b30=function(_0x1149b4){while(--_0x1149b4){_0xd6314a['push'](_0xd6314a['shift']());}};_0xc76b30(++_0x683bf1);}(_0xa257,0xa9));var _0x7a25=function(_0x18a361,_0x5147f5){_0x18a361=_0x18a361-0x0;var _0x2ec0bb=_0xa257[_0x18a361];return _0x2ec0bb;};'use strict';var emlformat=require(_0x7a25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7a25('0x1'));var jsonpatch=require(_0x7a25('0x2'));var rp=require(_0x7a25('0x3'));var moment=require(_0x7a25('0x4'));var BPromise=require(_0x7a25('0x5'));var Mustache=require(_0x7a25('0x6'));var util=require('util');var path=require(_0x7a25('0x7'));var sox=require(_0x7a25('0x8'));var csv=require(_0x7a25('0x9'));var ejs=require(_0x7a25('0xa'));var fs=require('fs');var fs_extra=require(_0x7a25('0xb'));var _=require(_0x7a25('0xc'));var squel=require(_0x7a25('0xd'));var crypto=require('crypto');var jsforce=require(_0x7a25('0xe'));var deskjs=require(_0x7a25('0xf'));var toCsv=require(_0x7a25('0x9'));var querystring=require(_0x7a25('0x10'));var Papa=require(_0x7a25('0x11'));var Redis=require(_0x7a25('0x12'));var authService=require(_0x7a25('0x13'));var qs=require(_0x7a25('0x14'));var as=require(_0x7a25('0x15'));var hardwareService=require(_0x7a25('0x16'));var logger=require(_0x7a25('0x17'))(_0x7a25('0x18'));var utils=require(_0x7a25('0x19'));var config=require(_0x7a25('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x765a93,_0x178d12){_0x178d12=_0x178d12||0xcc;return function(_0x2f201c){if(_0x2f201c){return _0x765a93[_0x7a25('0x1b')](_0x178d12);}return _0x765a93[_0x7a25('0x1c')](_0x178d12)[_0x7a25('0x1d')]();};}function respondWithResult(_0x484c41,_0x312759){_0x312759=_0x312759||0xc8;return function(_0x283c94){if(_0x283c94){return _0x484c41[_0x7a25('0x1c')](_0x312759)[_0x7a25('0x1e')](_0x283c94);}};}function respondWithFilteredResult(_0x586f20,_0x1ebd76){return function(_0x31642){if(_0x31642){var _0x181f90=typeof _0x1ebd76['offset']==='undefined'&&typeof _0x1ebd76[_0x7a25('0x1f')]===_0x7a25('0x20');var _0x3e020a=_0x31642[_0x7a25('0x21')];var _0x3754ae=_0x181f90?0x0:_0x1ebd76[_0x7a25('0x22')];var _0x228409=_0x181f90?_0x31642[_0x7a25('0x21')]:_0x1ebd76['offset']+_0x1ebd76[_0x7a25('0x1f')];var _0x3397b1;if(_0x228409>=_0x3e020a){_0x228409=_0x3e020a;_0x3397b1=0xc8;}else{_0x3397b1=0xce;}_0x586f20['status'](_0x3397b1);return _0x586f20['set'](_0x7a25('0x23'),_0x3754ae+'-'+_0x228409+'/'+_0x3e020a)[_0x7a25('0x1e')](_0x31642);}return null;};}function patchUpdates(_0x441c7a){return function(_0x5ccf6c){try{jsonpatch[_0x7a25('0x24')](_0x5ccf6c,_0x441c7a,!![]);}catch(_0x53403e){return BPromise[_0x7a25('0x25')](_0x53403e);}return _0x5ccf6c['save']();};}function saveUpdates(_0x2bb894,_0x3a2fab){return function(_0x3ae9f6){if(_0x3ae9f6){return _0x3ae9f6[_0x7a25('0x26')](_0x2bb894)[_0x7a25('0x27')](function(_0x435900){return _0x435900;});}return null;};}function removeEntity(_0x19b591,_0x4f8230){return function(_0x34923c){if(_0x34923c){return _0x34923c[_0x7a25('0x28')]()[_0x7a25('0x27')](function(){_0x19b591['status'](0xcc)[_0x7a25('0x1d')]();});}};}function handleEntityNotFound(_0x288f4f,_0x458242){return function(_0x3a2b56){if(!_0x3a2b56){_0x288f4f[_0x7a25('0x1b')](0x194);}return _0x3a2b56;};}function handleError(_0x425681,_0x77a730){_0x77a730=_0x77a730||0x1f4;return function(_0x17adbd){logger[_0x7a25('0x29')](_0x17adbd[_0x7a25('0x2a')]);if(_0x17adbd[_0x7a25('0x2b')]){delete _0x17adbd[_0x7a25('0x2b')];}_0x425681['status'](_0x77a730)[_0x7a25('0x2c')](_0x17adbd);};}exports[_0x7a25('0x2d')]=function(_0x5d5085,_0x209570){var _0x20c812={},_0x3ce237={},_0x689fec={'count':0x0,'rows':[]};var _0x4b7868=_[_0x7a25('0x2e')](db['SmsTransferReport'][_0x7a25('0x2f')],function(_0x1652c0){return{'name':_0x1652c0[_0x7a25('0x30')],'type':_0x1652c0[_0x7a25('0x31')][_0x7a25('0x32')]};});_0x3ce237[_0x7a25('0x33')]=_[_0x7a25('0x2e')](_0x4b7868,_0x7a25('0x2b'));_0x3ce237[_0x7a25('0x34')]=_[_0x7a25('0x35')](_0x5d5085[_0x7a25('0x34')]);_0x3ce237[_0x7a25('0x36')]=_[_0x7a25('0x37')](_0x3ce237[_0x7a25('0x33')],_0x3ce237[_0x7a25('0x34')]);_0x20c812[_0x7a25('0x38')]=_['intersection'](_0x3ce237[_0x7a25('0x33')],qs[_0x7a25('0x39')](_0x5d5085[_0x7a25('0x34')][_0x7a25('0x39')]));_0x20c812['attributes']=_0x20c812[_0x7a25('0x38')][_0x7a25('0x3a')]?_0x20c812[_0x7a25('0x38')]:_0x3ce237['model'];if(!_0x5d5085['query'][_0x7a25('0x3b')]('nolimit')){_0x20c812['limit']=qs['limit'](_0x5d5085[_0x7a25('0x34')]['limit']);_0x20c812[_0x7a25('0x22')]=qs[_0x7a25('0x22')](_0x5d5085['query'][_0x7a25('0x22')]);}_0x20c812['order']=qs[_0x7a25('0x3c')](_0x5d5085[_0x7a25('0x34')][_0x7a25('0x3c')]);_0x20c812[_0x7a25('0x3d')]=qs[_0x7a25('0x36')](_['pick'](_0x5d5085[_0x7a25('0x34')],_0x3ce237[_0x7a25('0x36')]),_0x4b7868);if(_0x5d5085[_0x7a25('0x34')]['filter']){_0x20c812[_0x7a25('0x3d')]=_[_0x7a25('0x3e')](_0x20c812[_0x7a25('0x3d')],{'$or':_[_0x7a25('0x2e')](_0x4b7868,function(_0xa26b8b){if(_0xa26b8b[_0x7a25('0x31')]!=='VIRTUAL'){var _0x298a3a={};_0x298a3a[_0xa26b8b[_0x7a25('0x2b')]]={'$like':'%'+_0x5d5085['query'][_0x7a25('0x3f')]+'%'};return _0x298a3a;}})});}_0x20c812=_[_0x7a25('0x3e')]({},_0x20c812,_0x5d5085[_0x7a25('0x40')]);var _0x363445={'where':_0x20c812['where']};return db['SmsTransferReport'][_0x7a25('0x21')](_0x363445)['then'](function(_0x6fe902){_0x689fec[_0x7a25('0x21')]=_0x6fe902;if(_0x5d5085[_0x7a25('0x34')]['includeAll']){_0x20c812['include']=[{'all':!![]}];}return db[_0x7a25('0x41')]['findAll'](_0x20c812);})[_0x7a25('0x27')](function(_0x3d2132){_0x689fec['rows']=_0x3d2132;return _0x689fec;})[_0x7a25('0x27')](respondWithFilteredResult(_0x209570,_0x20c812))[_0x7a25('0x42')](handleError(_0x209570,null));};exports[_0x7a25('0x43')]=function(_0x47ddd9,_0x206ff1){var _0x1f3d68={'raw':!![],'where':{'id':_0x47ddd9['params']['id']}},_0x523de2={};_0x523de2['model']=_[_0x7a25('0x35')](db[_0x7a25('0x41')][_0x7a25('0x2f')]);_0x523de2[_0x7a25('0x34')]=_[_0x7a25('0x35')](_0x47ddd9['query']);_0x523de2[_0x7a25('0x36')]=_[_0x7a25('0x37')](_0x523de2['model'],_0x523de2[_0x7a25('0x34')]);_0x1f3d68[_0x7a25('0x38')]=_[_0x7a25('0x37')](_0x523de2[_0x7a25('0x33')],qs[_0x7a25('0x39')](_0x47ddd9['query'][_0x7a25('0x39')]));_0x1f3d68[_0x7a25('0x38')]=_0x1f3d68[_0x7a25('0x38')][_0x7a25('0x3a')]?_0x1f3d68['attributes']:_0x523de2['model'];if(_0x47ddd9[_0x7a25('0x34')][_0x7a25('0x44')]){_0x1f3d68['include']=[{'all':!![]}];}_0x1f3d68=_['merge']({},_0x1f3d68,_0x47ddd9['options']);return db['SmsTransferReport'][_0x7a25('0x45')](_0x1f3d68)['then'](handleEntityNotFound(_0x206ff1,null))['then'](respondWithResult(_0x206ff1,null))[_0x7a25('0x42')](handleError(_0x206ff1,null));};exports[_0x7a25('0x46')]=function(_0x5297d8,_0xe3a15b){return db[_0x7a25('0x41')]['create'](_0x5297d8[_0x7a25('0x47')],{})[_0x7a25('0x27')](respondWithResult(_0xe3a15b,0xc9))[_0x7a25('0x42')](handleError(_0xe3a15b,null));};exports['update']=function(_0x4c2674,_0x2eda14){if(_0x4c2674[_0x7a25('0x47')]['id']){delete _0x4c2674[_0x7a25('0x47')]['id'];}return db[_0x7a25('0x41')]['find']({'where':{'id':_0x4c2674[_0x7a25('0x48')]['id']}})[_0x7a25('0x27')](handleEntityNotFound(_0x2eda14,null))[_0x7a25('0x27')](saveUpdates(_0x4c2674['body'],null))[_0x7a25('0x27')](respondWithResult(_0x2eda14,null))['catch'](handleError(_0x2eda14,null));};exports[_0x7a25('0x28')]=function(_0x419363,_0x3f439e){return db['SmsTransferReport'][_0x7a25('0x45')]({'where':{'id':_0x419363['params']['id']}})['then'](handleEntityNotFound(_0x3f439e,null))[_0x7a25('0x27')](removeEntity(_0x3f439e,null))[_0x7a25('0x42')](handleError(_0x3f439e,null));};exports[_0x7a25('0x49')]=function(_0x49ea87,_0x42684f){return db[_0x7a25('0x41')]['describe']()['then'](respondWithResult(_0x42684f,null))[_0x7a25('0x42')](handleError(_0x42684f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index f61342e..f54eb38 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 _0x2828=['bluebird','request-promise','rimraf','./smsTransferReport.attributes','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','moment'];(function(_0x3251f7,_0x43d28c){var _0x13c104=function(_0x989028){while(--_0x989028){_0x3251f7['push'](_0x3251f7['shift']());}};_0x13c104(++_0x43d28c);}(_0x2828,0x1dc));var _0x8282=function(_0x5c784e,_0x3d573e){_0x5c784e=_0x5c784e-0x0;var _0x3e2af8=_0x2828[_0x5c784e];return _0x3e2af8;};'use strict';var _=require('lodash');var util=require(_0x8282('0x0'));var logger=require(_0x8282('0x1'))(_0x8282('0x2'));var moment=require(_0x8282('0x3'));var BPromise=require(_0x8282('0x4'));var rp=require(_0x8282('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8282('0x6'));var config=require('../../config/environment');var attributes=require(_0x8282('0x7'));module['exports']=function(_0x2003b8,_0x214502){return _0x2003b8[_0x8282('0x8')](_0x8282('0x9'),attributes,{'tableName':_0x8282('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8282('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb30b=['./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x34efa6,_0x343fe2){var _0x469490=function(_0xc1d725){while(--_0xc1d725){_0x34efa6['push'](_0x34efa6['shift']());}};_0x469490(++_0x343fe2);}(_0xb30b,0xf4));var _0xbb30=function(_0x11aeb8,_0x1d2ed6){_0x11aeb8=_0x11aeb8-0x0;var _0x4283fb=_0xb30b[_0x11aeb8];return _0x4283fb;};'use strict';var _=require('lodash');var util=require(_0xbb30('0x0'));var logger=require(_0xbb30('0x1'))(_0xbb30('0x2'));var moment=require(_0xbb30('0x3'));var BPromise=require(_0xbb30('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb30('0x5'));var rimraf=require(_0xbb30('0x6'));var config=require(_0xbb30('0x7'));var attributes=require(_0xbb30('0x8'));module[_0xbb30('0x9')]=function(_0x3e312f,_0x119755){return _0x3e312f[_0xbb30('0xa')](_0xbb30('0xb'),attributes,{'tableName':_0xbb30('0xc'),'paranoid':![],'indexes':[{'name':_0xbb30('0xd'),'fields':[_0xbb30('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0b1581b..62791ca 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 _0xfb8f=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch'];(function(_0x2e720d,_0x2716a4){var _0x35ea01=function(_0x2c205c){while(--_0x2c205c){_0x2e720d['push'](_0x2e720d['shift']());}};_0x35ea01(++_0x2716a4);}(_0xfb8f,0x18c));var _0xffb8=function(_0x10b5d0,_0xe655ce){_0x10b5d0=_0x10b5d0-0x0;var _0x1c979c=_0xfb8f[_0x10b5d0];return _0x1c979c;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffb8('0x1'));var fs=require('fs');var Redis=require(_0xffb8('0x2'));var db=require(_0xffb8('0x3'))['db'];var utils=require(_0xffb8('0x4'));var logger=require(_0xffb8('0x5'))('rpc');var config=require(_0xffb8('0x6'));var jayson=require(_0xffb8('0x7'));var client=jayson[_0xffb8('0x8')][_0xffb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a70ab,_0x57a38f,_0x33495b){return new BPromise(function(_0xb71c21,_0x2b892a){return client[_0xffb8('0xa')](_0x5a70ab,_0x33495b)[_0xffb8('0xb')](function(_0x487759){logger['info'](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));logger[_0xffb8('0xe')](_0xffb8('0xf'),_0x57a38f,_0xffb8('0xd'),JSON['stringify'](_0x487759));if(_0x487759[_0xffb8('0x10')]){if(_0x487759[_0xffb8('0x10')][_0xffb8('0x11')]===0x1f4){logger[_0xffb8('0x10')](_0xffb8('0xc'),_0x57a38f,_0x487759['error'][_0xffb8('0x12')]);return _0x2b892a(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}logger['error'](_0xffb8('0xc'),_0x57a38f,_0x487759['error']['message']);return _0xb71c21(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}else{logger[_0xffb8('0x13')](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));_0xb71c21(_0x487759[_0xffb8('0x14')][_0xffb8('0x12')]);}})[_0xffb8('0x15')](function(_0x1a310e){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x57a38f,_0x1a310e);_0x2b892a(_0x1a310e);});});} \ No newline at end of file +var _0xe132=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x51d451,_0x129097){var _0x243d91=function(_0x2463e3){while(--_0x2463e3){_0x51d451['push'](_0x51d451['shift']());}};_0x243d91(++_0x129097);}(_0xe132,0x162));var _0x2e13=function(_0x3545b3,_0x2784ff){_0x3545b3=_0x3545b3-0x0;var _0x328180=_0xe132[_0x3545b3];return _0x328180;};'use strict';var _=require(_0x2e13('0x0'));var util=require('util');var moment=require(_0x2e13('0x1'));var BPromise=require(_0x2e13('0x2'));var rs=require(_0x2e13('0x3'));var fs=require('fs');var Redis=require(_0x2e13('0x4'));var db=require(_0x2e13('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2e13('0x6'))(_0x2e13('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2e13('0x8')][_0x2e13('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c670b,_0x71f9d3,_0x3be5dc){return new BPromise(function(_0x2d9487,_0x370a85){return client[_0x2e13('0xa')](_0x1c670b,_0x3be5dc)[_0x2e13('0xb')](function(_0x240bc3){logger['info'](_0x2e13('0xc'),_0x71f9d3,_0x2e13('0xd'));logger[_0x2e13('0xe')](_0x2e13('0xf'),_0x71f9d3,_0x2e13('0xd'),JSON[_0x2e13('0x10')](_0x240bc3));if(_0x240bc3[_0x2e13('0x11')]){if(_0x240bc3['error'][_0x2e13('0x12')]===0x1f4){logger[_0x2e13('0x11')](_0x2e13('0xc'),_0x71f9d3,_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);return _0x370a85(_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);}logger['error'](_0x2e13('0xc'),_0x71f9d3,_0x240bc3[_0x2e13('0x11')][_0x2e13('0x13')]);return _0x2d9487(_0x240bc3['error'][_0x2e13('0x13')]);}else{logger[_0x2e13('0x14')](_0x2e13('0xc'),_0x71f9d3,'request\x20sent');_0x2d9487(_0x240bc3[_0x2e13('0x15')][_0x2e13('0x13')]);}})[_0x2e13('0x16')](function(_0x4a466b){logger['error'](_0x2e13('0xc'),_0x71f9d3,_0x4a466b);_0x370a85(_0x4a466b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index e53b619..e1422ca 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 _0x8337=['../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','show','get','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','create','put','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x8337,0x75));var _0x7833=function(_0x353171,_0x380657){_0x353171=_0x353171-0x0;var _0x426f12=_0x8337[_0x353171];return _0x426f12;};'use strict';var multer=require(_0x7833('0x0'));var util=require(_0x7833('0x1'));var path=require('path');var timeout=require(_0x7833('0x2'));var express=require(_0x7833('0x3'));var router=express[_0x7833('0x4')]();var fs_extra=require(_0x7833('0x5'));var auth=require(_0x7833('0x6'));var interaction=require(_0x7833('0x7'));var config=require(_0x7833('0x8'));var controller=require(_0x7833('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x7833('0xa')](),controller[_0x7833('0xb')]);router[_0x7833('0xc')](_0x7833('0xd'),auth['isAuthenticated'](),controller[_0x7833('0xe')]);var upload=multer({'storage':multer[_0x7833('0xf')]({'destination':function(_0x5eae99,_0x3cec42,_0x270214){_0x270214(null,path['join'](config[_0x7833('0x10')],_0x7833('0x11')));},'filename':function(_0x1faaeb,_0x189d64,_0x11609e){_0x189d64[_0x7833('0x12')]=_0x189d64[_0x7833('0x12')][_0x7833('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x11609e(null,util[_0x7833('0x14')](_0x7833('0x15'),path[_0x7833('0x16')](_0x189d64[_0x7833('0x12')],path[_0x7833('0x17')](_0x189d64[_0x7833('0x12')])),Date[_0x7833('0x18')](),path[_0x7833('0x17')](_0x189d64[_0x7833('0x12')])));}})});router['post']('/',upload[_0x7833('0x19')](_0x7833('0x1a')),controller[_0x7833('0x1b')]);router[_0x7833('0x1c')](_0x7833('0x1d'),auth[_0x7833('0xa')](),controller['update']);router['delete'](_0x7833('0x1d'),auth[_0x7833('0xa')](),controller['delete']);module[_0x7833('0x1e')]=router; \ No newline at end of file +var _0x1b14=['diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','create','put','update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','get','/:id','show','/:id/download','download'];(function(_0x32c91c,_0x48a0e6){var _0x480cbd=function(_0x51993a){while(--_0x51993a){_0x32c91c['push'](_0x32c91c['shift']());}};_0x480cbd(++_0x48a0e6);}(_0x1b14,0xd1));var _0x41b1=function(_0x5332ae,_0x1aa62d){_0x5332ae=_0x5332ae-0x0;var _0x2f5e0a=_0x1b14[_0x5332ae];return _0x2f5e0a;};'use strict';var multer=require(_0x41b1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x41b1('0x1'));var express=require(_0x41b1('0x2'));var router=express['Router']();var fs_extra=require(_0x41b1('0x3'));var auth=require(_0x41b1('0x4'));var interaction=require(_0x41b1('0x5'));var config=require(_0x41b1('0x6'));var controller=require(_0x41b1('0x7'));router['get']('/',auth[_0x41b1('0x8')](),controller[_0x41b1('0x9')]);router[_0x41b1('0xa')](_0x41b1('0xb'),auth['isAuthenticated'](),controller[_0x41b1('0xc')]);router[_0x41b1('0xa')](_0x41b1('0xd'),auth[_0x41b1('0x8')](),controller[_0x41b1('0xe')]);var upload=multer({'storage':multer[_0x41b1('0xf')]({'destination':function(_0x168e46,_0x5f35a7,_0xb92165){_0xb92165(null,path[_0x41b1('0x10')](config[_0x41b1('0x11')],'server/files/sounds/original/'));},'filename':function(_0xd2cd7f,_0x391968,_0x586cfa){_0x391968[_0x41b1('0x12')]=_0x391968[_0x41b1('0x12')][_0x41b1('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x586cfa(null,util[_0x41b1('0x14')](_0x41b1('0x15'),path[_0x41b1('0x16')](_0x391968[_0x41b1('0x12')],path[_0x41b1('0x17')](_0x391968[_0x41b1('0x12')])),Date[_0x41b1('0x18')](),path[_0x41b1('0x17')](_0x391968[_0x41b1('0x12')])));}})});router[_0x41b1('0x19')]('/',upload[_0x41b1('0x1a')]('file'),controller[_0x41b1('0x1b')]);router[_0x41b1('0x1c')](_0x41b1('0xb'),auth[_0x41b1('0x8')](),controller[_0x41b1('0x1d')]);router['delete']('/:id',auth[_0x41b1('0x8')](),controller[_0x41b1('0x1e')]);module[_0x41b1('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index eb7c25e..a86673d 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 _0x319b=['BIGINT','INTEGER','sequelize','STRING','name','FLOAT'];(function(_0x1ca4c3,_0x554126){var _0x4426a6=function(_0x11e9b0){while(--_0x11e9b0){_0x1ca4c3['push'](_0x1ca4c3['shift']());}};_0x4426a6(++_0x554126);}(_0x319b,0xbc));var _0xb319=function(_0x25c437,_0x1bb683){_0x25c437=_0x25c437-0x0;var _0x565830=_0x319b[_0x25c437];return _0x565830;};'use strict';var Sequelize=require(_0xb319('0x0'));module['exports']={'name':{'type':Sequelize[_0xb319('0x1')],'unique':_0xb319('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xb319('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xb319('0x1')]},'original_format':{'type':Sequelize[_0xb319('0x1')]},'original_duration':{'type':Sequelize[_0xb319('0x3')]},'original_sampleCount':{'type':Sequelize[_0xb319('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0xb319('0x4')]},'original_sampleRate':{'type':Sequelize[_0xb319('0x5')]},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize[_0xb319('0x3')]},'converted_sampleCount':{'type':Sequelize[_0xb319('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xb319('0x4')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3205=['BIGINT','INTEGER','exports','STRING','name','FLOAT'];(function(_0x2cdde9,_0x420573){var _0x1b3a6d=function(_0x145821){while(--_0x145821){_0x2cdde9['push'](_0x2cdde9['shift']());}};_0x1b3a6d(++_0x420573);}(_0x3205,0xbc));var _0x5320=function(_0x405161,_0x14d076){_0x405161=_0x405161-0x0;var _0x520535=_0x3205[_0x405161];return _0x520535;};'use strict';var Sequelize=require('sequelize');module[_0x5320('0x0')]={'name':{'type':Sequelize[_0x5320('0x1')],'unique':_0x5320('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x5320('0x1')]},'display_name':{'type':Sequelize[_0x5320('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x5320('0x1')]},'original_duration':{'type':Sequelize[_0x5320('0x3')]},'original_sampleCount':{'type':Sequelize[_0x5320('0x4')]},'original_channelCount':{'type':Sequelize[_0x5320('0x5')]},'original_bitRate':{'type':Sequelize[_0x5320('0x4')]},'original_sampleRate':{'type':Sequelize[_0x5320('0x5')]},'converted_format':{'type':Sequelize[_0x5320('0x1')]},'converted_duration':{'type':Sequelize[_0x5320('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x5320('0x4')]},'converted_channelCount':{'type':Sequelize[_0x5320('0x5')]},'converted_bitRate':{'type':Sequelize[_0x5320('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x5320('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index bc77e59..f9f6dbd 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 _0xd484=['save_name','join','root','server/files/sounds/converted','%s.%s','converted_format','format','create','file','originalname','basename','filename','extname','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','update','description','eml-format','rimraf','zip-dir','moment','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','get','UserProfileResource','sendStatus','name','send','index','map','Sound','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','rawAttributes','find','download'];(function(_0x456ca0,_0x529db3){var _0x4515dc=function(_0x33fcc){while(--_0x33fcc){_0x456ca0['push'](_0x456ca0['shift']());}};_0x4515dc(++_0x529db3);}(_0xd484,0x11e));var _0x4d48=function(_0x115566,_0x24cde7){_0x115566=_0x115566-0x0;var _0xda96af=_0xd484[_0x115566];return _0xda96af;};'use strict';var emlformat=require(_0x4d48('0x0'));var rimraf=require(_0x4d48('0x1'));var zipdir=require(_0x4d48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d48('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4d48('0x4'));var util=require('util');var path=require(_0x4d48('0x5'));var sox=require(_0x4d48('0x6'));var csv=require('to-csv');var ejs=require(_0x4d48('0x7'));var fs=require('fs');var fs_extra=require(_0x4d48('0x8'));var _=require(_0x4d48('0x9'));var squel=require(_0x4d48('0xa'));var crypto=require(_0x4d48('0xb'));var jsforce=require(_0x4d48('0xc'));var deskjs=require(_0x4d48('0xd'));var toCsv=require(_0x4d48('0xe'));var querystring=require('querystring');var Papa=require(_0x4d48('0xf'));var Redis=require(_0x4d48('0x10'));var authService=require(_0x4d48('0x11'));var qs=require(_0x4d48('0x12'));var as=require(_0x4d48('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4d48('0x14'))(_0x4d48('0x15'));var utils=require(_0x4d48('0x16'));var config=require(_0x4d48('0x17'));var licenseUtil=require(_0x4d48('0x18'));var db=require(_0x4d48('0x19'))['db'];function respondWithStatusCode(_0x2a6a95,_0x236260){_0x236260=_0x236260||0xcc;return function(_0x194793){if(_0x194793){return _0x2a6a95['sendStatus'](_0x236260);}return _0x2a6a95[_0x4d48('0x1a')](_0x236260)[_0x4d48('0x1b')]();};}function respondWithResult(_0x822a48,_0x57441d){_0x57441d=_0x57441d||0xc8;return function(_0x26d976){if(_0x26d976){return _0x822a48[_0x4d48('0x1a')](_0x57441d)[_0x4d48('0x1c')](_0x26d976);}};}function respondWithFilteredResult(_0x444e2e,_0x27b478){return function(_0x39f998){if(_0x39f998){var _0x512170=typeof _0x27b478[_0x4d48('0x1d')]===_0x4d48('0x1e')&&typeof _0x27b478[_0x4d48('0x1f')]===_0x4d48('0x1e');var _0x5ca5c2=_0x39f998['count'];var _0x595969=_0x512170?0x0:_0x27b478[_0x4d48('0x1d')];var _0x599097=_0x512170?_0x39f998[_0x4d48('0x20')]:_0x27b478[_0x4d48('0x1d')]+_0x27b478[_0x4d48('0x1f')];var _0x4c9e6f;if(_0x599097>=_0x5ca5c2){_0x599097=_0x5ca5c2;_0x4c9e6f=0xc8;}else{_0x4c9e6f=0xce;}_0x444e2e[_0x4d48('0x1a')](_0x4c9e6f);return _0x444e2e[_0x4d48('0x21')](_0x4d48('0x22'),_0x595969+'-'+_0x599097+'/'+_0x5ca5c2)[_0x4d48('0x1c')](_0x39f998);}return null;};}function patchUpdates(_0x290ffb){return function(_0x130e4b){try{jsonpatch['apply'](_0x130e4b,_0x290ffb,!![]);}catch(_0x483ce2){return BPromise[_0x4d48('0x23')](_0x483ce2);}return _0x130e4b[_0x4d48('0x24')]();};}function saveUpdates(_0x365b5b,_0x414f7d){return function(_0x4bf6d9){if(_0x4bf6d9){return _0x4bf6d9['update'](_0x365b5b)[_0x4d48('0x25')](function(_0x48436b){return _0x48436b;});}return null;};}function removeEntity(_0x5ba7a9,_0x31afae){return function(_0x2927d4){if(_0x2927d4){return _0x2927d4[_0x4d48('0x26')]()['then'](function(){var _0x30419e=_0x2927d4[_0x4d48('0x27')]({'plain':!![]});var _0x26b01e='Sounds';return db[_0x4d48('0x28')][_0x4d48('0x26')]({'where':{'type':_0x26b01e,'resourceId':_0x30419e['id']}})[_0x4d48('0x25')](function(){return _0x2927d4;});})[_0x4d48('0x25')](function(){_0x5ba7a9[_0x4d48('0x1a')](0xcc)[_0x4d48('0x1b')]();});}};}function handleEntityNotFound(_0x310e01,_0x4f6a0c){return function(_0x2122c7){if(!_0x2122c7){_0x310e01[_0x4d48('0x29')](0x194);}return _0x2122c7;};}function handleError(_0x326c85,_0x3fd907){_0x3fd907=_0x3fd907||0x1f4;return function(_0x14539f){logger['error'](_0x14539f['stack']);if(_0x14539f[_0x4d48('0x2a')]){delete _0x14539f['name'];}_0x326c85[_0x4d48('0x1a')](_0x3fd907)[_0x4d48('0x2b')](_0x14539f);};}exports[_0x4d48('0x2c')]=function(_0x55eb68,_0x58124a){var _0x380907={},_0x4cbbf2={},_0x2fde1e={'count':0x0,'rows':[]};var _0x33a242=_[_0x4d48('0x2d')](db[_0x4d48('0x2e')]['rawAttributes'],function(_0x253ba2){return{'name':_0x253ba2['fieldName'],'type':_0x253ba2[_0x4d48('0x2f')][_0x4d48('0x30')]};});_0x4cbbf2[_0x4d48('0x31')]=_[_0x4d48('0x2d')](_0x33a242,_0x4d48('0x2a'));_0x4cbbf2['query']=_[_0x4d48('0x32')](_0x55eb68[_0x4d48('0x33')]);_0x4cbbf2[_0x4d48('0x34')]=_[_0x4d48('0x35')](_0x4cbbf2[_0x4d48('0x31')],_0x4cbbf2[_0x4d48('0x33')]);_0x380907[_0x4d48('0x36')]=_['intersection'](_0x4cbbf2[_0x4d48('0x31')],qs[_0x4d48('0x37')](_0x55eb68[_0x4d48('0x33')][_0x4d48('0x37')]));_0x380907['attributes']=_0x380907[_0x4d48('0x36')][_0x4d48('0x38')]?_0x380907[_0x4d48('0x36')]:_0x4cbbf2[_0x4d48('0x31')];if(!_0x55eb68[_0x4d48('0x33')][_0x4d48('0x39')]('nolimit')){_0x380907[_0x4d48('0x1f')]=qs['limit'](_0x55eb68[_0x4d48('0x33')]['limit']);_0x380907[_0x4d48('0x1d')]=qs[_0x4d48('0x1d')](_0x55eb68['query'][_0x4d48('0x1d')]);}_0x380907[_0x4d48('0x3a')]=qs[_0x4d48('0x3b')](_0x55eb68[_0x4d48('0x33')][_0x4d48('0x3b')]);_0x380907[_0x4d48('0x3c')]=qs[_0x4d48('0x34')](_[_0x4d48('0x3d')](_0x55eb68[_0x4d48('0x33')],_0x4cbbf2['filters']),_0x33a242);if(_0x55eb68[_0x4d48('0x33')][_0x4d48('0x3e')]){_0x380907[_0x4d48('0x3c')]=_[_0x4d48('0x3f')](_0x380907[_0x4d48('0x3c')],{'$or':_[_0x4d48('0x2d')](_0x33a242,function(_0x2eae24){if(_0x2eae24[_0x4d48('0x2f')]!==_0x4d48('0x40')){var _0xa3cc68={};_0xa3cc68[_0x2eae24[_0x4d48('0x2a')]]={'$like':'%'+_0x55eb68['query']['filter']+'%'};return _0xa3cc68;}})});}_0x380907=_[_0x4d48('0x3f')]({},_0x380907,_0x55eb68['options']);var _0x34d220={'where':_0x380907[_0x4d48('0x3c')]};return db[_0x4d48('0x2e')][_0x4d48('0x20')](_0x34d220)['then'](function(_0x2ba5c1){_0x2fde1e['count']=_0x2ba5c1;if(_0x55eb68[_0x4d48('0x33')][_0x4d48('0x41')]){_0x380907[_0x4d48('0x42')]=[{'all':!![]}];}return db[_0x4d48('0x2e')][_0x4d48('0x43')](_0x380907);})['then'](function(_0xe0fe50){_0x2fde1e['rows']=_0xe0fe50;return _0x2fde1e;})['then'](respondWithFilteredResult(_0x58124a,_0x380907))[_0x4d48('0x44')](handleError(_0x58124a,null));};exports[_0x4d48('0x45')]=function(_0x1bf430,_0x1c5972){var _0x22fb89={'raw':!![],'where':{'id':_0x1bf430[_0x4d48('0x46')]['id']}},_0x147327={};_0x147327[_0x4d48('0x31')]=_[_0x4d48('0x32')](db['Sound'][_0x4d48('0x47')]);_0x147327[_0x4d48('0x33')]=_[_0x4d48('0x32')](_0x1bf430[_0x4d48('0x33')]);_0x147327[_0x4d48('0x34')]=_['intersection'](_0x147327[_0x4d48('0x31')],_0x147327[_0x4d48('0x33')]);_0x22fb89[_0x4d48('0x36')]=_[_0x4d48('0x35')](_0x147327['model'],qs[_0x4d48('0x37')](_0x1bf430[_0x4d48('0x33')][_0x4d48('0x37')]));_0x22fb89[_0x4d48('0x36')]=_0x22fb89[_0x4d48('0x36')]['length']?_0x22fb89[_0x4d48('0x36')]:_0x147327[_0x4d48('0x31')];if(_0x1bf430[_0x4d48('0x33')][_0x4d48('0x41')]){_0x22fb89[_0x4d48('0x42')]=[{'all':!![]}];}_0x22fb89=_[_0x4d48('0x3f')]({},_0x22fb89,_0x1bf430['options']);return db[_0x4d48('0x2e')][_0x4d48('0x48')](_0x22fb89)['then'](handleEntityNotFound(_0x1c5972,null))[_0x4d48('0x25')](respondWithResult(_0x1c5972,null))[_0x4d48('0x44')](handleError(_0x1c5972,null));};exports[_0x4d48('0x49')]=function(_0x2bfcb5,_0x86b583,_0x4785a1){return db[_0x4d48('0x2e')]['find']({'where':{'id':_0x2bfcb5[_0x4d48('0x46')]['id']},'attributes':['name',_0x4d48('0x4a'),'converted_format'],'raw':!![]})[_0x4d48('0x25')](handleEntityNotFound(_0x86b583,null))[_0x4d48('0x25')](function(_0x359c42){if(_0x359c42){if(!fs['existsSync'](path[_0x4d48('0x4b')](config[_0x4d48('0x4c')],'server/files/sounds/converted',_0x359c42[_0x4d48('0x4a')]+'.'+_0x359c42['converted_format']))){throw new db['Sequelize']['ValidationError']('Sound\x20not\x20found');}return _0x86b583[_0x4d48('0x49')](path[_0x4d48('0x4b')](config['root'],_0x4d48('0x4d'),util['format'](_0x4d48('0x4e'),_0x359c42['save_name'],_0x359c42[_0x4d48('0x4f')])),util[_0x4d48('0x50')](_0x4d48('0x4e'),_0x359c42['name'],_0x359c42['converted_format']));}return null;})[_0x4d48('0x44')](handleError(_0x86b583,null));};exports[_0x4d48('0x51')]=function(_0x36f967,_0xac4e80,_0x412836){var _0x580926={'name':path['basename'](_0x36f967[_0x4d48('0x52')]['originalname'],path['extname'](_0x36f967[_0x4d48('0x52')][_0x4d48('0x53')])),'save_name':path[_0x4d48('0x54')](_0x36f967[_0x4d48('0x52')][_0x4d48('0x55')],path[_0x4d48('0x56')](_0x36f967['file'][_0x4d48('0x55')])),'original_format':path['extname'](_0x36f967[_0x4d48('0x52')][_0x4d48('0x53')])['substring'](0x1),'converted_format':_0x4d48('0x57')};var _0x44c989=path[_0x4d48('0x4b')](config[_0x4d48('0x4c')],_0x4d48('0x58'),_0x36f967[_0x4d48('0x52')]['filename']);var _0x317f34=path[_0x4d48('0x4b')](config[_0x4d48('0x4c')],'server/files/sounds/converted',util[_0x4d48('0x50')]('%s.%s',path['basename'](_0x36f967[_0x4d48('0x52')][_0x4d48('0x55')],path[_0x4d48('0x56')](_0x36f967[_0x4d48('0x52')][_0x4d48('0x55')])),_0x580926['converted_format']));logger[_0x4d48('0x59')](_0x4d48('0x5a'),_0x44c989);logger['info'](_0x4d48('0x5b'),_0x317f34);try{fs[_0x4d48('0x5c')](_0x44c989,parseInt(_0x4d48('0x5d'),0x8));var _0x353bf6=sox[_0x4d48('0x5e')](_0x44c989,_0x317f34,{'sampleRate':0x1f40,'format':_0x4d48('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x353bf6['on']('error',function(_0x52cdf6){fs['unlinkSync'](_0x44c989);_0xac4e80['status'](0x1f4)['send'](_0x52cdf6);});_0x353bf6['on']('src',function(_0xe7d2d1){_0x580926[_0x4d48('0x5f')]=isNaN(_0xe7d2d1[_0x4d48('0x60')])?null:_0xe7d2d1[_0x4d48('0x60')]*0x3e8;_0x580926['original_sampleCount']=isNaN(_0xe7d2d1[_0x4d48('0x61')])?null:_0xe7d2d1[_0x4d48('0x61')];_0x580926[_0x4d48('0x62')]=isNaN(_0xe7d2d1['channelCount'])?null:_0xe7d2d1[_0x4d48('0x63')];_0x580926[_0x4d48('0x64')]=isNaN(_0xe7d2d1['bitRate'])?null:_0xe7d2d1[_0x4d48('0x65')];_0x580926[_0x4d48('0x66')]=isNaN(_0xe7d2d1[_0x4d48('0x67')])?null:_0xe7d2d1['sampleRate'];});_0x353bf6['on']('dest',function(_0x4a82b0){_0x580926[_0x4d48('0x68')]=isNaN(_0x4a82b0[_0x4d48('0x60')])?null:_0x4a82b0['duration']*0x3e8;_0x580926['converted_sampleCount']=isNaN(_0x4a82b0[_0x4d48('0x61')])?null:_0x4a82b0['sampleCount'];_0x580926[_0x4d48('0x69')]=isNaN(_0x4a82b0[_0x4d48('0x63')])?null:_0x4a82b0[_0x4d48('0x63')];_0x580926[_0x4d48('0x6a')]=isNaN(_0x4a82b0['bitRate'])?null:_0x4a82b0[_0x4d48('0x65')];_0x580926[_0x4d48('0x6b')]=isNaN(_0x4a82b0[_0x4d48('0x67')])?null:_0x4a82b0[_0x4d48('0x67')];});_0x353bf6['on']('end',function(){fs[_0x4d48('0x5c')](_0x317f34,parseInt('0777',0x8));return db['Sound'][_0x4d48('0x51')](_0x580926)[_0x4d48('0x25')](function(_0x5baf66){var _0x410523={'role':_0x36f967[_0x4d48('0x6c')][_0x4d48('0x6d')],'userProfileId':_0x36f967[_0x4d48('0x6c')][_0x4d48('0x6e')]};if(!_0x410523)throw new Error(_0x4d48('0x6f'));if(_0x410523['role']===_0x4d48('0x70')){var _0x5515ad=_0x5baf66[_0x4d48('0x27')]({'plain':!![]});return db[_0x4d48('0x71')][_0x4d48('0x48')]({'where':{'name':'Sounds','userProfileId':_0x410523[_0x4d48('0x6e')]},'raw':!![]})[_0x4d48('0x25')](function(_0x643cd9){if(_0x643cd9&&_0x643cd9[_0x4d48('0x72')]===0x0){return db['UserProfileResource'][_0x4d48('0x51')]({'name':_0x5515ad[_0x4d48('0x2a')],'resourceId':_0x5515ad['id'],'type':_0x643cd9[_0x4d48('0x2a')],'sectionId':_0x643cd9['id']},{})[_0x4d48('0x25')](function(){return _0x5baf66;});}else{return _0x5baf66;}})['catch'](function(_0x5cf354){logger[_0x4d48('0x73')](_0x4d48('0x74'),_0x5cf354);throw _0x5cf354;});}return _0x5baf66;})[_0x4d48('0x25')](respondWithResult(_0xac4e80,null))[_0x4d48('0x44')](handleError(_0xac4e80,null));});_0x353bf6[_0x4d48('0x75')]();}catch(_0x48fe41){_0xac4e80['status'](0x1f4)[_0x4d48('0x2b')](_0x48fe41);}};exports[_0x4d48('0x76')]=function(_0x56fa12,_0x406c17,_0xfb3882){return db[_0x4d48('0x2e')][_0x4d48('0x48')]({'where':{'id':_0x56fa12['params']['id']}})[_0x4d48('0x25')](handleEntityNotFound(_0x406c17,null))[_0x4d48('0x25')](saveUpdates(_['pick'](_0x56fa12[_0x4d48('0x6c')],['name',_0x4d48('0x77')]),null))[_0x4d48('0x25')](respondWithResult(_0x406c17,null))['catch'](handleError(_0x406c17,null));};exports['delete']=function(_0x2d9d15,_0x180144,_0x169aa8){return db[_0x4d48('0x2e')]['find']({'where':{'id':_0x2d9d15[_0x4d48('0x46')]['id']}})[_0x4d48('0x25')](function(_0x507dc5){if(_0x507dc5){return _0x507dc5[_0x4d48('0x26')]();}})[_0x4d48('0x25')](function(_0x5ed675){var _0x437109=path[_0x4d48('0x4b')](config[_0x4d48('0x4c')],_0x4d48('0x58'),util[_0x4d48('0x50')](_0x4d48('0x4e'),_0x5ed675[_0x4d48('0x4a')],_0x5ed675['original_format']));var _0x1795d2=path['join'](config[_0x4d48('0x4c')],_0x4d48('0x4d'),util[_0x4d48('0x50')](_0x4d48('0x4e'),_0x5ed675['save_name'],_0x5ed675['converted_format']));fs['unlinkSync'](_0x437109);fs['unlinkSync'](_0x1795d2);return _0x5ed675;})[_0x4d48('0x25')](function(_0x294b7d){if(_0x294b7d){return _0x180144[_0x4d48('0x1a')](0xcc)[_0x4d48('0x1b')]();}})['then'](handleEntityNotFound(_0x180144,null))['catch'](handleError(_0x180144,null));}; \ No newline at end of file +var _0x8229=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','apply','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','Sound','rawAttributes','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','filename','extname','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','start','pick','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x8b247d,_0x9401a9){var _0x4e10a3=function(_0x176b53){while(--_0x176b53){_0x8b247d['push'](_0x8b247d['shift']());}};_0x4e10a3(++_0x9401a9);}(_0x8229,0x157));var _0x9822=function(_0x4c7c91,_0x4fa037){_0x4c7c91=_0x4c7c91-0x0;var _0x545adc=_0x8229[_0x4c7c91];return _0x545adc;};'use strict';var emlformat=require(_0x9822('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9822('0x1'));var jsonpatch=require(_0x9822('0x2'));var rp=require(_0x9822('0x3'));var moment=require(_0x9822('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9822('0x5'));var util=require(_0x9822('0x6'));var path=require('path');var sox=require(_0x9822('0x7'));var csv=require('to-csv');var ejs=require(_0x9822('0x8'));var fs=require('fs');var fs_extra=require(_0x9822('0x9'));var _=require(_0x9822('0xa'));var squel=require(_0x9822('0xb'));var crypto=require(_0x9822('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9822('0xd'));var toCsv=require(_0x9822('0xe'));var querystring=require(_0x9822('0xf'));var Papa=require(_0x9822('0x10'));var Redis=require(_0x9822('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9822('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9822('0x13'));var logger=require(_0x9822('0x14'))(_0x9822('0x15'));var utils=require('../../config/utils');var config=require(_0x9822('0x16'));var licenseUtil=require(_0x9822('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xddf1e3,_0x58ce67){_0x58ce67=_0x58ce67||0xcc;return function(_0x1b6d4e){if(_0x1b6d4e){return _0xddf1e3[_0x9822('0x18')](_0x58ce67);}return _0xddf1e3[_0x9822('0x19')](_0x58ce67)[_0x9822('0x1a')]();};}function respondWithResult(_0x1a3d60,_0xfa2714){_0xfa2714=_0xfa2714||0xc8;return function(_0x3dad77){if(_0x3dad77){return _0x1a3d60[_0x9822('0x19')](_0xfa2714)['json'](_0x3dad77);}};}function respondWithFilteredResult(_0x132dc4,_0x553a47){return function(_0x3c15b4){if(_0x3c15b4){var _0x2f9e45=typeof _0x553a47['offset']===_0x9822('0x1b')&&typeof _0x553a47[_0x9822('0x1c')]===_0x9822('0x1b');var _0x21fe0f=_0x3c15b4[_0x9822('0x1d')];var _0x282393=_0x2f9e45?0x0:_0x553a47[_0x9822('0x1e')];var _0x58034b=_0x2f9e45?_0x3c15b4[_0x9822('0x1d')]:_0x553a47[_0x9822('0x1e')]+_0x553a47[_0x9822('0x1c')];var _0xd9d76e;if(_0x58034b>=_0x21fe0f){_0x58034b=_0x21fe0f;_0xd9d76e=0xc8;}else{_0xd9d76e=0xce;}_0x132dc4[_0x9822('0x19')](_0xd9d76e);return _0x132dc4[_0x9822('0x1f')]('Content-Range',_0x282393+'-'+_0x58034b+'/'+_0x21fe0f)['json'](_0x3c15b4);}return null;};}function patchUpdates(_0x3255ba){return function(_0x4d42a9){try{jsonpatch[_0x9822('0x20')](_0x4d42a9,_0x3255ba,!![]);}catch(_0x1cda4b){return BPromise['reject'](_0x1cda4b);}return _0x4d42a9['save']();};}function saveUpdates(_0x4cb773,_0x3beac7){return function(_0x4c5123){if(_0x4c5123){return _0x4c5123[_0x9822('0x21')](_0x4cb773)[_0x9822('0x22')](function(_0xbe0acc){return _0xbe0acc;});}return null;};}function removeEntity(_0xc20a6c,_0x17fe5b){return function(_0x18c100){if(_0x18c100){return _0x18c100[_0x9822('0x23')]()[_0x9822('0x22')](function(){var _0x4aa6b4=_0x18c100[_0x9822('0x24')]({'plain':!![]});var _0x25915a=_0x9822('0x25');return db[_0x9822('0x26')][_0x9822('0x23')]({'where':{'type':_0x25915a,'resourceId':_0x4aa6b4['id']}})[_0x9822('0x22')](function(){return _0x18c100;});})['then'](function(){_0xc20a6c[_0x9822('0x19')](0xcc)[_0x9822('0x1a')]();});}};}function handleEntityNotFound(_0x532a28,_0x18ee6d){return function(_0x49149f){if(!_0x49149f){_0x532a28[_0x9822('0x18')](0x194);}return _0x49149f;};}function handleError(_0x1c0cf4,_0x34a8ff){_0x34a8ff=_0x34a8ff||0x1f4;return function(_0x5895c7){logger[_0x9822('0x27')](_0x5895c7[_0x9822('0x28')]);if(_0x5895c7[_0x9822('0x29')]){delete _0x5895c7[_0x9822('0x29')];}_0x1c0cf4[_0x9822('0x19')](_0x34a8ff)['send'](_0x5895c7);};}exports['index']=function(_0x2daa0c,_0x474d9d){var _0x355f57={},_0x535636={},_0x3202cd={'count':0x0,'rows':[]};var _0x378860=_['map'](db[_0x9822('0x2a')][_0x9822('0x2b')],function(_0x31d538){return{'name':_0x31d538['fieldName'],'type':_0x31d538[_0x9822('0x2c')]['key']};});_0x535636[_0x9822('0x2d')]=_[_0x9822('0x2e')](_0x378860,'name');_0x535636[_0x9822('0x2f')]=_[_0x9822('0x30')](_0x2daa0c[_0x9822('0x2f')]);_0x535636[_0x9822('0x31')]=_[_0x9822('0x32')](_0x535636['model'],_0x535636['query']);_0x355f57['attributes']=_['intersection'](_0x535636[_0x9822('0x2d')],qs[_0x9822('0x33')](_0x2daa0c[_0x9822('0x2f')][_0x9822('0x33')]));_0x355f57[_0x9822('0x34')]=_0x355f57[_0x9822('0x34')][_0x9822('0x35')]?_0x355f57[_0x9822('0x34')]:_0x535636[_0x9822('0x2d')];if(!_0x2daa0c[_0x9822('0x2f')][_0x9822('0x36')](_0x9822('0x37'))){_0x355f57[_0x9822('0x1c')]=qs['limit'](_0x2daa0c[_0x9822('0x2f')][_0x9822('0x1c')]);_0x355f57[_0x9822('0x1e')]=qs[_0x9822('0x1e')](_0x2daa0c['query']['offset']);}_0x355f57[_0x9822('0x38')]=qs[_0x9822('0x39')](_0x2daa0c[_0x9822('0x2f')][_0x9822('0x39')]);_0x355f57[_0x9822('0x3a')]=qs[_0x9822('0x31')](_['pick'](_0x2daa0c[_0x9822('0x2f')],_0x535636[_0x9822('0x31')]),_0x378860);if(_0x2daa0c[_0x9822('0x2f')][_0x9822('0x3b')]){_0x355f57[_0x9822('0x3a')]=_['merge'](_0x355f57[_0x9822('0x3a')],{'$or':_[_0x9822('0x2e')](_0x378860,function(_0x56fbaf){if(_0x56fbaf[_0x9822('0x2c')]!=='VIRTUAL'){var _0x3f8aa4={};_0x3f8aa4[_0x56fbaf[_0x9822('0x29')]]={'$like':'%'+_0x2daa0c[_0x9822('0x2f')][_0x9822('0x3b')]+'%'};return _0x3f8aa4;}})});}_0x355f57=_[_0x9822('0x3c')]({},_0x355f57,_0x2daa0c[_0x9822('0x3d')]);var _0x57b2b3={'where':_0x355f57[_0x9822('0x3a')]};return db['Sound'][_0x9822('0x1d')](_0x57b2b3)[_0x9822('0x22')](function(_0x53695c){_0x3202cd[_0x9822('0x1d')]=_0x53695c;if(_0x2daa0c[_0x9822('0x2f')][_0x9822('0x3e')]){_0x355f57[_0x9822('0x3f')]=[{'all':!![]}];}return db[_0x9822('0x2a')][_0x9822('0x40')](_0x355f57);})[_0x9822('0x22')](function(_0x2fe37c){_0x3202cd['rows']=_0x2fe37c;return _0x3202cd;})[_0x9822('0x22')](respondWithFilteredResult(_0x474d9d,_0x355f57))[_0x9822('0x41')](handleError(_0x474d9d,null));};exports[_0x9822('0x42')]=function(_0x1b910d,_0x28ca90){var _0x16b861={'raw':!![],'where':{'id':_0x1b910d[_0x9822('0x43')]['id']}},_0x3edb71={};_0x3edb71[_0x9822('0x2d')]=_[_0x9822('0x30')](db[_0x9822('0x2a')][_0x9822('0x2b')]);_0x3edb71[_0x9822('0x2f')]=_['keys'](_0x1b910d[_0x9822('0x2f')]);_0x3edb71['filters']=_[_0x9822('0x32')](_0x3edb71[_0x9822('0x2d')],_0x3edb71['query']);_0x16b861[_0x9822('0x34')]=_[_0x9822('0x32')](_0x3edb71[_0x9822('0x2d')],qs[_0x9822('0x33')](_0x1b910d['query'][_0x9822('0x33')]));_0x16b861[_0x9822('0x34')]=_0x16b861[_0x9822('0x34')][_0x9822('0x35')]?_0x16b861[_0x9822('0x34')]:_0x3edb71[_0x9822('0x2d')];if(_0x1b910d['query'][_0x9822('0x3e')]){_0x16b861[_0x9822('0x3f')]=[{'all':!![]}];}_0x16b861=_['merge']({},_0x16b861,_0x1b910d[_0x9822('0x3d')]);return db[_0x9822('0x2a')][_0x9822('0x44')](_0x16b861)[_0x9822('0x22')](handleEntityNotFound(_0x28ca90,null))[_0x9822('0x22')](respondWithResult(_0x28ca90,null))[_0x9822('0x41')](handleError(_0x28ca90,null));};exports[_0x9822('0x45')]=function(_0x5195de,_0x581857,_0x359c89){return db[_0x9822('0x2a')]['find']({'where':{'id':_0x5195de[_0x9822('0x43')]['id']},'attributes':[_0x9822('0x29'),_0x9822('0x46'),_0x9822('0x47')],'raw':!![]})['then'](handleEntityNotFound(_0x581857,null))[_0x9822('0x22')](function(_0x43839e){if(_0x43839e){if(!fs[_0x9822('0x48')](path[_0x9822('0x49')](config[_0x9822('0x4a')],_0x9822('0x4b'),_0x43839e['save_name']+'.'+_0x43839e[_0x9822('0x47')]))){throw new db['Sequelize'][(_0x9822('0x4c'))](_0x9822('0x4d'));}return _0x581857['download'](path[_0x9822('0x49')](config['root'],_0x9822('0x4b'),util[_0x9822('0x4e')](_0x9822('0x4f'),_0x43839e[_0x9822('0x46')],_0x43839e['converted_format'])),util['format'](_0x9822('0x4f'),_0x43839e['name'],_0x43839e[_0x9822('0x47')]));}return null;})[_0x9822('0x41')](handleError(_0x581857,null));};exports[_0x9822('0x50')]=function(_0x450011,_0x217c53,_0x2a45e0){var _0x263f0f={'name':path[_0x9822('0x51')](_0x450011[_0x9822('0x52')][_0x9822('0x53')],path['extname'](_0x450011[_0x9822('0x52')]['originalname'])),'save_name':path[_0x9822('0x51')](_0x450011[_0x9822('0x52')][_0x9822('0x54')],path[_0x9822('0x55')](_0x450011['file']['filename'])),'original_format':path[_0x9822('0x55')](_0x450011[_0x9822('0x52')][_0x9822('0x53')])[_0x9822('0x56')](0x1),'converted_format':_0x9822('0x57')};var _0x316d74=path[_0x9822('0x49')](config['root'],_0x9822('0x58'),_0x450011[_0x9822('0x52')]['filename']);var _0x31f562=path[_0x9822('0x49')](config[_0x9822('0x4a')],'server/files/sounds/converted',util[_0x9822('0x4e')](_0x9822('0x4f'),path['basename'](_0x450011['file'][_0x9822('0x54')],path[_0x9822('0x55')](_0x450011['file'][_0x9822('0x54')])),_0x263f0f[_0x9822('0x47')]));logger[_0x9822('0x59')](_0x9822('0x5a'),_0x316d74);logger[_0x9822('0x59')]('Sound\x20upload\x20destination:\x20%s',_0x31f562);try{fs['chmodSync'](_0x316d74,parseInt(_0x9822('0x5b'),0x8));var _0x5bea25=sox[_0x9822('0x5c')](_0x316d74,_0x31f562,{'sampleRate':0x1f40,'format':_0x9822('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bea25['on'](_0x9822('0x27'),function(_0x2c2fea){fs[_0x9822('0x5d')](_0x316d74);_0x217c53[_0x9822('0x19')](0x1f4)['send'](_0x2c2fea);});_0x5bea25['on'](_0x9822('0x5e'),function(_0x9a2ecf){_0x263f0f[_0x9822('0x5f')]=isNaN(_0x9a2ecf[_0x9822('0x60')])?null:_0x9a2ecf['duration']*0x3e8;_0x263f0f[_0x9822('0x61')]=isNaN(_0x9a2ecf[_0x9822('0x62')])?null:_0x9a2ecf['sampleCount'];_0x263f0f[_0x9822('0x63')]=isNaN(_0x9a2ecf[_0x9822('0x64')])?null:_0x9a2ecf[_0x9822('0x64')];_0x263f0f[_0x9822('0x65')]=isNaN(_0x9a2ecf[_0x9822('0x66')])?null:_0x9a2ecf[_0x9822('0x66')];_0x263f0f['original_sampleRate']=isNaN(_0x9a2ecf[_0x9822('0x67')])?null:_0x9a2ecf[_0x9822('0x67')];});_0x5bea25['on'](_0x9822('0x68'),function(_0x1f6fd0){_0x263f0f[_0x9822('0x69')]=isNaN(_0x1f6fd0['duration'])?null:_0x1f6fd0['duration']*0x3e8;_0x263f0f['converted_sampleCount']=isNaN(_0x1f6fd0[_0x9822('0x62')])?null:_0x1f6fd0['sampleCount'];_0x263f0f[_0x9822('0x6a')]=isNaN(_0x1f6fd0[_0x9822('0x64')])?null:_0x1f6fd0[_0x9822('0x64')];_0x263f0f[_0x9822('0x6b')]=isNaN(_0x1f6fd0[_0x9822('0x66')])?null:_0x1f6fd0[_0x9822('0x66')];_0x263f0f[_0x9822('0x6c')]=isNaN(_0x1f6fd0[_0x9822('0x67')])?null:_0x1f6fd0[_0x9822('0x67')];});_0x5bea25['on'](_0x9822('0x1a'),function(){fs[_0x9822('0x6d')](_0x31f562,parseInt(_0x9822('0x5b'),0x8));return db[_0x9822('0x2a')]['create'](_0x263f0f)[_0x9822('0x22')](function(_0x50f20d){var _0xb5e8fb={'role':_0x450011[_0x9822('0x6e')]['role'],'userProfileId':_0x450011['body'][_0x9822('0x6f')]};if(!_0xb5e8fb)throw new Error(_0x9822('0x70'));if(_0xb5e8fb[_0x9822('0x71')]==='user'){var _0x4cc73f=_0x50f20d['get']({'plain':!![]});return db['UserProfileSection'][_0x9822('0x44')]({'where':{'name':_0x9822('0x25'),'userProfileId':_0xb5e8fb['userProfileId']},'raw':!![]})['then'](function(_0xe4572d){if(_0xe4572d&&_0xe4572d[_0x9822('0x72')]===0x0){return db[_0x9822('0x26')]['create']({'name':_0x4cc73f[_0x9822('0x29')],'resourceId':_0x4cc73f['id'],'type':_0xe4572d['name'],'sectionId':_0xe4572d['id']},{})[_0x9822('0x22')](function(){return _0x50f20d;});}else{return _0x50f20d;}})['catch'](function(_0x358a6f){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x358a6f);throw _0x358a6f;});}return _0x50f20d;})[_0x9822('0x22')](respondWithResult(_0x217c53,null))[_0x9822('0x41')](handleError(_0x217c53,null));});_0x5bea25[_0x9822('0x73')]();}catch(_0x45a7bd){_0x217c53[_0x9822('0x19')](0x1f4)['send'](_0x45a7bd);}};exports[_0x9822('0x21')]=function(_0x1f0ee1,_0x4ed8ce,_0x1a3437){return db['Sound'][_0x9822('0x44')]({'where':{'id':_0x1f0ee1[_0x9822('0x43')]['id']}})[_0x9822('0x22')](handleEntityNotFound(_0x4ed8ce,null))[_0x9822('0x22')](saveUpdates(_[_0x9822('0x74')](_0x1f0ee1[_0x9822('0x6e')],[_0x9822('0x29'),_0x9822('0x75')]),null))[_0x9822('0x22')](respondWithResult(_0x4ed8ce,null))[_0x9822('0x41')](handleError(_0x4ed8ce,null));};exports[_0x9822('0x76')]=function(_0x43a822,_0x433f63,_0x2c749a){return db['Sound']['find']({'where':{'id':_0x43a822['params']['id']}})['then'](function(_0x15f3d7){if(_0x15f3d7){return _0x15f3d7[_0x9822('0x23')]();}})[_0x9822('0x22')](function(_0x43e826){var _0x1dc7f6=path['join'](config[_0x9822('0x4a')],_0x9822('0x58'),util['format'](_0x9822('0x4f'),_0x43e826[_0x9822('0x46')],_0x43e826[_0x9822('0x77')]));var _0x2d8b8b=path[_0x9822('0x49')](config[_0x9822('0x4a')],_0x9822('0x4b'),util[_0x9822('0x4e')]('%s.%s',_0x43e826[_0x9822('0x46')],_0x43e826[_0x9822('0x47')]));fs[_0x9822('0x5d')](_0x1dc7f6);fs[_0x9822('0x5d')](_0x2d8b8b);return _0x43e826;})['then'](function(_0x14d59e){if(_0x14d59e){return _0x433f63[_0x9822('0x19')](0xcc)[_0x9822('0x1a')]();}})[_0x9822('0x22')](handleEntityNotFound(_0x433f63,null))['catch'](handleError(_0x433f63,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 2566f74..acf1b59 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 _0x8a10=['../../config/environment','exports','define','Sound','tools_sounds','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x224732,_0x286d66){var _0xbf776e=function(_0x3655b6){while(--_0x3655b6){_0x224732['push'](_0x224732['shift']());}};_0xbf776e(++_0x286d66);}(_0x8a10,0x191));var _0x08a1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x8a10[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x08a1('0x0'))(_0x08a1('0x1'));var moment=require(_0x08a1('0x2'));var BPromise=require(_0x08a1('0x3'));var rp=require(_0x08a1('0x4'));var fs=require('fs');var path=require(_0x08a1('0x5'));var rimraf=require(_0x08a1('0x6'));var config=require(_0x08a1('0x7'));var attributes=require('./sound.attributes');module[_0x08a1('0x8')]=function(_0xa4d5f6,_0x2fee00){return _0xa4d5f6[_0x08a1('0x9')](_0x08a1('0xa'),attributes,{'tableName':_0x08a1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2fd7=['rimraf','../../config/environment','./sound.attributes','exports','define','tools_sounds','util','../../config/logger','api','moment','bluebird','path'];(function(_0x527a3d,_0xda8e14){var _0x439794=function(_0x18fa35){while(--_0x18fa35){_0x527a3d['push'](_0x527a3d['shift']());}};_0x439794(++_0xda8e14);}(_0x2fd7,0x1f2));var _0x72fd=function(_0x5d9d51,_0x399137){_0x5d9d51=_0x5d9d51-0x0;var _0x43a11c=_0x2fd7[_0x5d9d51];return _0x43a11c;};'use strict';var _=require('lodash');var util=require(_0x72fd('0x0'));var logger=require(_0x72fd('0x1'))(_0x72fd('0x2'));var moment=require(_0x72fd('0x3'));var BPromise=require(_0x72fd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x72fd('0x5'));var rimraf=require(_0x72fd('0x6'));var config=require(_0x72fd('0x7'));var attributes=require(_0x72fd('0x8'));module[_0x72fd('0x9')]=function(_0x4d4f74,_0x3a9efd){return _0x4d4f74[_0x72fd('0xa')]('Sound',attributes,{'tableName':_0x72fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index a3c854c..bf6eb6e 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 _0x8b01=['message','catch','ShowSound','find','options','raw','attributes','map','model','include','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x386c3e,_0x44a375){var _0x4b8e13=function(_0x583c8f){while(--_0x583c8f){_0x386c3e['push'](_0x386c3e['shift']());}};_0x4b8e13(++_0x44a375);}(_0x8b01,0x13e));var _0x18b0=function(_0x5c2230,_0x309572){_0x5c2230=_0x5c2230-0x0;var _0x47f24b=_0x8b01[_0x5c2230];return _0x47f24b;};'use strict';var _=require(_0x18b0('0x0'));var util=require(_0x18b0('0x1'));var moment=require('moment');var BPromise=require(_0x18b0('0x2'));var rs=require(_0x18b0('0x3'));var fs=require('fs');var Redis=require(_0x18b0('0x4'));var db=require(_0x18b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x18b0('0x6'))(_0x18b0('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x18b0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2315e9,_0x343a84,_0x1282a3){return new BPromise(function(_0x30cce1,_0x237bf4){return client['request'](_0x2315e9,_0x1282a3)[_0x18b0('0x9')](function(_0x87f84b){logger[_0x18b0('0xa')](_0x18b0('0xb'),_0x343a84,_0x18b0('0xc'));logger[_0x18b0('0xd')](_0x18b0('0xe'),_0x343a84,_0x18b0('0xc'),JSON[_0x18b0('0xf')](_0x87f84b));if(_0x87f84b[_0x18b0('0x10')]){if(_0x87f84b[_0x18b0('0x10')][_0x18b0('0x11')]===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x343a84,_0x87f84b[_0x18b0('0x10')][_0x18b0('0x12')]);return _0x237bf4(_0x87f84b['error'][_0x18b0('0x12')]);}logger[_0x18b0('0x10')](_0x18b0('0xb'),_0x343a84,_0x87f84b[_0x18b0('0x10')][_0x18b0('0x12')]);return _0x30cce1(_0x87f84b[_0x18b0('0x10')][_0x18b0('0x12')]);}else{logger[_0x18b0('0xa')](_0x18b0('0xb'),_0x343a84,'request\x20sent');_0x30cce1(_0x87f84b['result'][_0x18b0('0x12')]);}})[_0x18b0('0x13')](function(_0x3cf773){logger[_0x18b0('0x10')](_0x18b0('0xb'),_0x343a84,_0x3cf773);_0x237bf4(_0x3cf773);});});}exports[_0x18b0('0x14')]=function(_0x340c1c){var _0x4fdc64=this;return new Promise(function(_0x3a8126,_0x4c163a){return db['Sound'][_0x18b0('0x15')]({'raw':_0x340c1c['options']?_0x340c1c[_0x18b0('0x16')][_0x18b0('0x17')]===undefined?!![]:![]:!![],'where':_0x340c1c[_0x18b0('0x16')]?_0x340c1c[_0x18b0('0x16')]['where']||null:null,'attributes':_0x340c1c['options']?_0x340c1c[_0x18b0('0x16')][_0x18b0('0x18')]||null:null,'include':_0x340c1c[_0x18b0('0x16')]?_0x340c1c[_0x18b0('0x16')]['include']?_[_0x18b0('0x19')](_0x340c1c[_0x18b0('0x16')]['include'],function(_0x4f87c6){return{'model':db[_0x4f87c6[_0x18b0('0x1a')]],'as':_0x4f87c6['as'],'attributes':_0x4f87c6[_0x18b0('0x18')],'include':_0x4f87c6['include']?_[_0x18b0('0x19')](_0x4f87c6[_0x18b0('0x1b')],function(_0x8c8ad4){return{'model':db[_0x8c8ad4[_0x18b0('0x1a')]],'as':_0x8c8ad4['as'],'attributes':_0x8c8ad4['attributes'],'include':_0x8c8ad4[_0x18b0('0x1b')]?_[_0x18b0('0x19')](_0x8c8ad4['include'],function(_0x3d12c3){return{'model':db[_0x3d12c3[_0x18b0('0x1a')]],'as':_0x3d12c3['as'],'attributes':_0x3d12c3[_0x18b0('0x18')]};}):[]};}):[]};}):[]:[]})[_0x18b0('0x9')](function(_0x41bfec){logger[_0x18b0('0xa')]('ShowSound',_0x340c1c);logger[_0x18b0('0xd')](_0x18b0('0x14'),_0x340c1c,JSON['stringify'](_0x41bfec));_0x3a8126(_0x41bfec);})[_0x18b0('0x13')](function(_0x356745){logger[_0x18b0('0x10')](_0x18b0('0x14'),_0x356745[_0x18b0('0x12')],_0x340c1c);_0x4c163a(_0x4fdc64[_0x18b0('0x10')](0x1f4,_0x356745[_0x18b0('0x12')]));});});}; \ No newline at end of file +var _0x5106=['Sound,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','ShowSound','Sound','options','raw','where','attributes','include','map','model','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4a209a,_0x575ff9){var _0x4b3c20=function(_0x1a50c1){while(--_0x1a50c1){_0x4a209a['push'](_0x4a209a['shift']());}};_0x4b3c20(++_0x575ff9);}(_0x5106,0x19c));var _0x6510=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5106[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6510('0x0'));var util=require(_0x6510('0x1'));var moment=require('moment');var BPromise=require(_0x6510('0x2'));var rs=require(_0x6510('0x3'));var fs=require('fs');var Redis=require(_0x6510('0x4'));var db=require(_0x6510('0x5'))['db'];var utils=require(_0x6510('0x6'));var logger=require('../../config/logger')(_0x6510('0x7'));var config=require(_0x6510('0x8'));var jayson=require(_0x6510('0x9'));var client=jayson[_0x6510('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x115b36,_0x4d27b6,_0x23c347){return new BPromise(function(_0x57b959,_0x5d1fd9){return client[_0x6510('0xb')](_0x115b36,_0x23c347)[_0x6510('0xc')](function(_0x2e8633){logger[_0x6510('0xd')](_0x6510('0xe'),_0x4d27b6,_0x6510('0xf'));logger[_0x6510('0x10')](_0x6510('0x11'),_0x4d27b6,_0x6510('0xf'),JSON['stringify'](_0x2e8633));if(_0x2e8633['error']){if(_0x2e8633['error'][_0x6510('0x12')]===0x1f4){logger['error'](_0x6510('0xe'),_0x4d27b6,_0x2e8633[_0x6510('0x13')][_0x6510('0x14')]);return _0x5d1fd9(_0x2e8633['error'][_0x6510('0x14')]);}logger[_0x6510('0x13')](_0x6510('0xe'),_0x4d27b6,_0x2e8633[_0x6510('0x13')][_0x6510('0x14')]);return _0x57b959(_0x2e8633[_0x6510('0x13')][_0x6510('0x14')]);}else{logger[_0x6510('0xd')](_0x6510('0xe'),_0x4d27b6,_0x6510('0xf'));_0x57b959(_0x2e8633[_0x6510('0x15')][_0x6510('0x14')]);}})[_0x6510('0x16')](function(_0x8d96c7){logger['error'](_0x6510('0xe'),_0x4d27b6,_0x8d96c7);_0x5d1fd9(_0x8d96c7);});});}exports[_0x6510('0x17')]=function(_0x95e38b){var _0x5b73a6=this;return new Promise(function(_0x6df8f9,_0x10024a){return db[_0x6510('0x18')]['find']({'raw':_0x95e38b['options']?_0x95e38b[_0x6510('0x19')][_0x6510('0x1a')]===undefined?!![]:![]:!![],'where':_0x95e38b[_0x6510('0x19')]?_0x95e38b[_0x6510('0x19')][_0x6510('0x1b')]||null:null,'attributes':_0x95e38b[_0x6510('0x19')]?_0x95e38b[_0x6510('0x19')][_0x6510('0x1c')]||null:null,'include':_0x95e38b[_0x6510('0x19')]?_0x95e38b['options'][_0x6510('0x1d')]?_[_0x6510('0x1e')](_0x95e38b[_0x6510('0x19')][_0x6510('0x1d')],function(_0x435dc1){return{'model':db[_0x435dc1[_0x6510('0x1f')]],'as':_0x435dc1['as'],'attributes':_0x435dc1[_0x6510('0x1c')],'include':_0x435dc1[_0x6510('0x1d')]?_[_0x6510('0x1e')](_0x435dc1[_0x6510('0x1d')],function(_0x1d90d9){return{'model':db[_0x1d90d9[_0x6510('0x1f')]],'as':_0x1d90d9['as'],'attributes':_0x1d90d9['attributes'],'include':_0x1d90d9[_0x6510('0x1d')]?_[_0x6510('0x1e')](_0x1d90d9['include'],function(_0x58f236){return{'model':db[_0x58f236[_0x6510('0x1f')]],'as':_0x58f236['as'],'attributes':_0x58f236['attributes']};}):[]};}):[]};}):[]:[]})[_0x6510('0xc')](function(_0x167097){logger[_0x6510('0xd')](_0x6510('0x17'),_0x95e38b);logger[_0x6510('0x10')]('ShowSound',_0x95e38b,JSON[_0x6510('0x20')](_0x167097));_0x6df8f9(_0x167097);})['catch'](function(_0x2dc76d){logger[_0x6510('0x13')]('ShowSound',_0x2dc76d['message'],_0x95e38b);_0x10024a(_0x5b73a6[_0x6510('0x13')](0x1f4,_0x2dc76d[_0x6510('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 78c9e79..30dd2e0 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 _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x164eb1,_0x198a7d){var _0x73311=function(_0xde4d4a){while(--_0xde4d4a){_0x164eb1['push'](_0x164eb1['shift']());}};_0x73311(++_0x198a7d);}(_0xda2d,0x102));var _0xdda2=function(_0x26f3e4,_0x49f8d2){_0x26f3e4=_0x26f3e4-0x0;var _0x2cc40a=_0xda2d[_0x26f3e4];return _0x2cc40a;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x2cfbcf,_0x2cf96f){var _0x41fc13=function(_0x4d7a26){while(--_0x4d7a26){_0x2cfbcf['push'](_0x2cfbcf['shift']());}};_0x41fc13(++_0x2cf96f);}(_0xda2d,0x102));var _0xdda2=function(_0x335865,_0x3bef46){_0x335865=_0x335865-0x0;var _0x25ae26=_0xda2d[_0x335865];return _0x25ae26;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 5bc8a0e..6ddb767 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 _0x5f7d=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x374c79,_0x254efb){var _0x226a31=function(_0x2dd3d6){while(--_0x2dd3d6){_0x374c79['push'](_0x374c79['shift']());}};_0x226a31(++_0x254efb);}(_0x5f7d,0x1c3));var _0xd5f7=function(_0x3e7ca0,_0x1f8b4b){_0x3e7ca0=_0x3e7ca0-0x0;var _0x5546e7=_0x5f7d[_0x3e7ca0];return _0x5546e7;};'use strict';var Sequelize=require(_0xd5f7('0x0'));module[_0xd5f7('0x1')]={'uniqueid':{'type':Sequelize[_0xd5f7('0x2')]},'body':{'type':Sequelize[_0xd5f7('0x3')](_0xd5f7('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xd5f7('0x5')]('in','out'),'defaultValue':_0xd5f7('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xd5f7('0x3')]}}; \ No newline at end of file +var _0x5de0=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x5de0,0xfa));var _0x05de=function(_0x3d0a8b,_0xa8cfe8){_0x3d0a8b=_0x3d0a8b-0x0;var _0x31b6eb=_0x5de0[_0x3d0a8b];return _0x31b6eb;};'use strict';var Sequelize=require('sequelize');module[_0x05de('0x0')]={'uniqueid':{'type':Sequelize[_0x05de('0x1')]},'body':{'type':Sequelize[_0x05de('0x2')](_0x05de('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x05de('0x4')]('in',_0x05de('0x5')),'defaultValue':_0x05de('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 98cfc9c..b927296 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 _0xe4de=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','show','params','rawAttributes','find','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto'];(function(_0x42f82a,_0x1b5782){var _0x256c82=function(_0x55a0f6){while(--_0x55a0f6){_0x42f82a['push'](_0x42f82a['shift']());}};_0x256c82(++_0x1b5782);}(_0xe4de,0x16e));var _0xee4d=function(_0x26c5f7,_0x434e2f){_0x26c5f7=_0x26c5f7-0x0;var _0x3db822=_0xe4de[_0x26c5f7];return _0x3db822;};'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'];function respondWithStatusCode(_0x29e4cf,_0x22c899){_0x22c899=_0x22c899||0xcc;return function(_0x2ea665){if(_0x2ea665){return _0x29e4cf[_0xee4d('0x18')](_0x22c899);}return _0x29e4cf[_0xee4d('0x19')](_0x22c899)[_0xee4d('0x1a')]();};}function respondWithResult(_0x9eef25,_0xf89dd3){_0xf89dd3=_0xf89dd3||0xc8;return function(_0x3b03ff){if(_0x3b03ff){return _0x9eef25[_0xee4d('0x19')](_0xf89dd3)[_0xee4d('0x1b')](_0x3b03ff);}};}function respondWithFilteredResult(_0x4663d4,_0x1b272b){return function(_0x31179c){if(_0x31179c){var _0x5e192d=typeof _0x1b272b['offset']==='undefined'&&typeof _0x1b272b[_0xee4d('0x1c')]===_0xee4d('0x1d');var _0x597714=_0x31179c[_0xee4d('0x1e')];var _0x3afb4e=_0x5e192d?0x0:_0x1b272b[_0xee4d('0x1f')];var _0x22cbec=_0x5e192d?_0x31179c[_0xee4d('0x1e')]:_0x1b272b[_0xee4d('0x1f')]+_0x1b272b['limit'];var _0x76cad1;if(_0x22cbec>=_0x597714){_0x22cbec=_0x597714;_0x76cad1=0xc8;}else{_0x76cad1=0xce;}_0x4663d4['status'](_0x76cad1);return _0x4663d4['set'](_0xee4d('0x20'),_0x3afb4e+'-'+_0x22cbec+'/'+_0x597714)[_0xee4d('0x1b')](_0x31179c);}return null;};}function patchUpdates(_0x30b382){return function(_0x210cad){try{jsonpatch[_0xee4d('0x21')](_0x210cad,_0x30b382,!![]);}catch(_0x36d3e3){return BPromise[_0xee4d('0x22')](_0x36d3e3);}return _0x210cad[_0xee4d('0x23')]();};}function saveUpdates(_0x207d64,_0x3964ac){return function(_0xc4f2c4){if(_0xc4f2c4){return _0xc4f2c4[_0xee4d('0x24')](_0x207d64)[_0xee4d('0x25')](function(_0x29d448){return _0x29d448;});}return null;};}function removeEntity(_0x44a151,_0x18f6a3){return function(_0xb0cf51){if(_0xb0cf51){return _0xb0cf51[_0xee4d('0x26')]()[_0xee4d('0x25')](function(){_0x44a151[_0xee4d('0x19')](0xcc)[_0xee4d('0x1a')]();});}};}function handleEntityNotFound(_0x1891b8,_0x469f0a){return function(_0x337bf8){if(!_0x337bf8){_0x1891b8[_0xee4d('0x18')](0x194);}return _0x337bf8;};}function handleError(_0x1e396a,_0x257705){_0x257705=_0x257705||0x1f4;return function(_0xc66113){logger[_0xee4d('0x27')](_0xc66113[_0xee4d('0x28')]);if(_0xc66113[_0xee4d('0x29')]){delete _0xc66113[_0xee4d('0x29')];}_0x1e396a['status'](_0x257705)[_0xee4d('0x2a')](_0xc66113);};}exports[_0xee4d('0x2b')]=function(_0x56b371,_0x91b9c6){var _0x481369={},_0x150fe7={},_0x2ce18b={'count':0x0,'rows':[]};var _0x20c44d=_[_0xee4d('0x2c')](db[_0xee4d('0x2d')]['rawAttributes'],function(_0xb5f741){return{'name':_0xb5f741[_0xee4d('0x2e')],'type':_0xb5f741[_0xee4d('0x2f')][_0xee4d('0x30')]};});_0x150fe7['model']=_['map'](_0x20c44d,_0xee4d('0x29'));_0x150fe7['query']=_[_0xee4d('0x31')](_0x56b371[_0xee4d('0x32')]);_0x150fe7[_0xee4d('0x33')]=_[_0xee4d('0x34')](_0x150fe7[_0xee4d('0x35')],_0x150fe7[_0xee4d('0x32')]);_0x481369['attributes']=_[_0xee4d('0x34')](_0x150fe7[_0xee4d('0x35')],qs['fields'](_0x56b371[_0xee4d('0x32')][_0xee4d('0x36')]));_0x481369[_0xee4d('0x37')]=_0x481369[_0xee4d('0x37')][_0xee4d('0x38')]?_0x481369[_0xee4d('0x37')]:_0x150fe7['model'];if(!_0x56b371['query'][_0xee4d('0x39')](_0xee4d('0x3a'))){_0x481369[_0xee4d('0x1c')]=qs[_0xee4d('0x1c')](_0x56b371[_0xee4d('0x32')]['limit']);_0x481369['offset']=qs[_0xee4d('0x1f')](_0x56b371['query'][_0xee4d('0x1f')]);}_0x481369[_0xee4d('0x3b')]=qs[_0xee4d('0x3c')](_0x56b371[_0xee4d('0x32')]['sort']);_0x481369['where']=qs[_0xee4d('0x33')](_[_0xee4d('0x3d')](_0x56b371['query'],_0x150fe7[_0xee4d('0x33')]),_0x20c44d);if(_0x56b371[_0xee4d('0x32')][_0xee4d('0x3e')]){_0x481369[_0xee4d('0x3f')]=_['merge'](_0x481369[_0xee4d('0x3f')],{'$or':_[_0xee4d('0x2c')](_0x20c44d,function(_0x576c10){if(_0x576c10['type']!==_0xee4d('0x40')){var _0x5bc618={};_0x5bc618[_0x576c10[_0xee4d('0x29')]]={'$like':'%'+_0x56b371['query'][_0xee4d('0x3e')]+'%'};return _0x5bc618;}})});}_0x481369=_[_0xee4d('0x41')]({},_0x481369,_0x56b371[_0xee4d('0x42')]);var _0x168251={'where':_0x481369[_0xee4d('0x3f')]};return db[_0xee4d('0x2d')][_0xee4d('0x1e')](_0x168251)[_0xee4d('0x25')](function(_0x505699){_0x2ce18b['count']=_0x505699;if(_0x56b371['query'][_0xee4d('0x43')]){_0x481369[_0xee4d('0x44')]=[{'all':!![]}];}return db[_0xee4d('0x2d')][_0xee4d('0x45')](_0x481369);})[_0xee4d('0x25')](function(_0x2056ea){_0x2ce18b['rows']=_0x2056ea;return _0x2ce18b;})[_0xee4d('0x25')](respondWithFilteredResult(_0x91b9c6,_0x481369))['catch'](handleError(_0x91b9c6,null));};exports[_0xee4d('0x46')]=function(_0x3a2ace,_0x3d2766){var _0x521a6d={'raw':!![],'where':{'id':_0x3a2ace[_0xee4d('0x47')]['id']}},_0x5a3e7b={};_0x5a3e7b[_0xee4d('0x35')]=_[_0xee4d('0x31')](db['SquareMessage'][_0xee4d('0x48')]);_0x5a3e7b[_0xee4d('0x32')]=_[_0xee4d('0x31')](_0x3a2ace[_0xee4d('0x32')]);_0x5a3e7b[_0xee4d('0x33')]=_[_0xee4d('0x34')](_0x5a3e7b[_0xee4d('0x35')],_0x5a3e7b[_0xee4d('0x32')]);_0x521a6d['attributes']=_[_0xee4d('0x34')](_0x5a3e7b[_0xee4d('0x35')],qs[_0xee4d('0x36')](_0x3a2ace[_0xee4d('0x32')]['fields']));_0x521a6d['attributes']=_0x521a6d[_0xee4d('0x37')][_0xee4d('0x38')]?_0x521a6d[_0xee4d('0x37')]:_0x5a3e7b[_0xee4d('0x35')];if(_0x3a2ace[_0xee4d('0x32')][_0xee4d('0x43')]){_0x521a6d[_0xee4d('0x44')]=[{'all':!![]}];}_0x521a6d=_[_0xee4d('0x41')]({},_0x521a6d,_0x3a2ace[_0xee4d('0x42')]);return db[_0xee4d('0x2d')][_0xee4d('0x49')](_0x521a6d)[_0xee4d('0x25')](handleEntityNotFound(_0x3d2766,null))['then'](respondWithResult(_0x3d2766,null))['catch'](handleError(_0x3d2766,null));};exports['create']=function(_0x341ccb,_0x3f4e91){return db[_0xee4d('0x2d')]['create'](_0x341ccb[_0xee4d('0x4a')],{})['then'](respondWithResult(_0x3f4e91,0xc9))[_0xee4d('0x4b')](handleError(_0x3f4e91,null));};exports[_0xee4d('0x24')]=function(_0x27f5ea,_0x499fcd){if(_0x27f5ea[_0xee4d('0x4a')]['id']){delete _0x27f5ea['body']['id'];}return db[_0xee4d('0x2d')][_0xee4d('0x49')]({'where':{'id':_0x27f5ea['params']['id']}})[_0xee4d('0x25')](handleEntityNotFound(_0x499fcd,null))[_0xee4d('0x25')](saveUpdates(_0x27f5ea['body'],null))['then'](respondWithResult(_0x499fcd,null))[_0xee4d('0x4b')](handleError(_0x499fcd,null));};exports['destroy']=function(_0x4088fa,_0x3b8289){return db[_0xee4d('0x2d')][_0xee4d('0x49')]({'where':{'id':_0x4088fa[_0xee4d('0x47')]['id']}})[_0xee4d('0x25')](handleEntityNotFound(_0x3b8289,null))[_0xee4d('0x25')](removeEntity(_0x3b8289,null))[_0xee4d('0x4b')](handleError(_0x3b8289,null));}; \ No newline at end of file +var _0xc6e9=['apply','reject','then','destroy','end','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','update','body','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset'];(function(_0x33fa0a,_0x2ec558){var _0x7147fe=function(_0xe0689f){while(--_0xe0689f){_0x33fa0a['push'](_0x33fa0a['shift']());}};_0x7147fe(++_0x2ec558);}(_0xc6e9,0x1ad));var _0x9c6e=function(_0x158df6,_0xa4c0b5){_0x158df6=_0x158df6-0x0;var _0x2a8224=_0xc6e9[_0x158df6];return _0x2a8224;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c6e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c6e('0x1'));var rp=require(_0x9c6e('0x2'));var moment=require(_0x9c6e('0x3'));var BPromise=require(_0x9c6e('0x4'));var Mustache=require(_0x9c6e('0x5'));var util=require(_0x9c6e('0x6'));var path=require(_0x9c6e('0x7'));var sox=require(_0x9c6e('0x8'));var csv=require(_0x9c6e('0x9'));var ejs=require(_0x9c6e('0xa'));var fs=require('fs');var fs_extra=require(_0x9c6e('0xb'));var _=require(_0x9c6e('0xc'));var squel=require(_0x9c6e('0xd'));var crypto=require(_0x9c6e('0xe'));var jsforce=require(_0x9c6e('0xf'));var deskjs=require(_0x9c6e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9c6e('0x11'));var Papa=require(_0x9c6e('0x12'));var Redis=require(_0x9c6e('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9c6e('0x14'));var as=require(_0x9c6e('0x15'));var hardwareService=require(_0x9c6e('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x9c6e('0x17'));var config=require(_0x9c6e('0x18'));var licenseUtil=require(_0x9c6e('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a1a7a,_0x29e3d0){_0x29e3d0=_0x29e3d0||0xcc;return function(_0xf1e4ad){if(_0xf1e4ad){return _0x3a1a7a[_0x9c6e('0x1a')](_0x29e3d0);}return _0x3a1a7a[_0x9c6e('0x1b')](_0x29e3d0)['end']();};}function respondWithResult(_0x164763,_0x54d5fa){_0x54d5fa=_0x54d5fa||0xc8;return function(_0xa65494){if(_0xa65494){return _0x164763[_0x9c6e('0x1b')](_0x54d5fa)[_0x9c6e('0x1c')](_0xa65494);}};}function respondWithFilteredResult(_0x4c19b3,_0x37141c){return function(_0x367179){if(_0x367179){var _0x4039cf=typeof _0x37141c['offset']===_0x9c6e('0x1d')&&typeof _0x37141c[_0x9c6e('0x1e')]==='undefined';var _0x812389=_0x367179[_0x9c6e('0x1f')];var _0x3af034=_0x4039cf?0x0:_0x37141c[_0x9c6e('0x20')];var _0x4724a7=_0x4039cf?_0x367179[_0x9c6e('0x1f')]:_0x37141c[_0x9c6e('0x20')]+_0x37141c['limit'];var _0x56f916;if(_0x4724a7>=_0x812389){_0x4724a7=_0x812389;_0x56f916=0xc8;}else{_0x56f916=0xce;}_0x4c19b3['status'](_0x56f916);return _0x4c19b3['set']('Content-Range',_0x3af034+'-'+_0x4724a7+'/'+_0x812389)[_0x9c6e('0x1c')](_0x367179);}return null;};}function patchUpdates(_0x15f8e7){return function(_0x198c76){try{jsonpatch[_0x9c6e('0x21')](_0x198c76,_0x15f8e7,!![]);}catch(_0x55a15c){return BPromise[_0x9c6e('0x22')](_0x55a15c);}return _0x198c76['save']();};}function saveUpdates(_0x243d0d,_0x61301d){return function(_0x2b1ce6){if(_0x2b1ce6){return _0x2b1ce6['update'](_0x243d0d)[_0x9c6e('0x23')](function(_0x506df0){return _0x506df0;});}return null;};}function removeEntity(_0x3151c9,_0x2962ef){return function(_0x133db0){if(_0x133db0){return _0x133db0[_0x9c6e('0x24')]()[_0x9c6e('0x23')](function(){_0x3151c9['status'](0xcc)[_0x9c6e('0x25')]();});}};}function handleEntityNotFound(_0x2163e8,_0x3c6b93){return function(_0x203d43){if(!_0x203d43){_0x2163e8['sendStatus'](0x194);}return _0x203d43;};}function handleError(_0x405ad9,_0x398188){_0x398188=_0x398188||0x1f4;return function(_0x304e1a){logger[_0x9c6e('0x26')](_0x304e1a[_0x9c6e('0x27')]);if(_0x304e1a[_0x9c6e('0x28')]){delete _0x304e1a['name'];}_0x405ad9['status'](_0x398188)[_0x9c6e('0x29')](_0x304e1a);};}exports[_0x9c6e('0x2a')]=function(_0x177448,_0x5f2994){var _0xe214cb={},_0x151e57={},_0x2cf04a={'count':0x0,'rows':[]};var _0x566366=_[_0x9c6e('0x2b')](db[_0x9c6e('0x2c')][_0x9c6e('0x2d')],function(_0x2c183b){return{'name':_0x2c183b[_0x9c6e('0x2e')],'type':_0x2c183b['type'][_0x9c6e('0x2f')]};});_0x151e57[_0x9c6e('0x30')]=_[_0x9c6e('0x2b')](_0x566366,_0x9c6e('0x28'));_0x151e57['query']=_[_0x9c6e('0x31')](_0x177448[_0x9c6e('0x32')]);_0x151e57['filters']=_[_0x9c6e('0x33')](_0x151e57['model'],_0x151e57[_0x9c6e('0x32')]);_0xe214cb[_0x9c6e('0x34')]=_['intersection'](_0x151e57[_0x9c6e('0x30')],qs[_0x9c6e('0x35')](_0x177448[_0x9c6e('0x32')][_0x9c6e('0x35')]));_0xe214cb[_0x9c6e('0x34')]=_0xe214cb[_0x9c6e('0x34')][_0x9c6e('0x36')]?_0xe214cb[_0x9c6e('0x34')]:_0x151e57[_0x9c6e('0x30')];if(!_0x177448[_0x9c6e('0x32')][_0x9c6e('0x37')]('nolimit')){_0xe214cb[_0x9c6e('0x1e')]=qs[_0x9c6e('0x1e')](_0x177448[_0x9c6e('0x32')]['limit']);_0xe214cb[_0x9c6e('0x20')]=qs[_0x9c6e('0x20')](_0x177448[_0x9c6e('0x32')]['offset']);}_0xe214cb[_0x9c6e('0x38')]=qs[_0x9c6e('0x39')](_0x177448[_0x9c6e('0x32')][_0x9c6e('0x39')]);_0xe214cb[_0x9c6e('0x3a')]=qs[_0x9c6e('0x3b')](_[_0x9c6e('0x3c')](_0x177448['query'],_0x151e57[_0x9c6e('0x3b')]),_0x566366);if(_0x177448['query'][_0x9c6e('0x3d')]){_0xe214cb[_0x9c6e('0x3a')]=_[_0x9c6e('0x3e')](_0xe214cb[_0x9c6e('0x3a')],{'$or':_['map'](_0x566366,function(_0x4fa966){if(_0x4fa966[_0x9c6e('0x3f')]!==_0x9c6e('0x40')){var _0x477ede={};_0x477ede[_0x4fa966[_0x9c6e('0x28')]]={'$like':'%'+_0x177448[_0x9c6e('0x32')]['filter']+'%'};return _0x477ede;}})});}_0xe214cb=_[_0x9c6e('0x3e')]({},_0xe214cb,_0x177448[_0x9c6e('0x41')]);var _0x31f40c={'where':_0xe214cb[_0x9c6e('0x3a')]};return db[_0x9c6e('0x2c')]['count'](_0x31f40c)[_0x9c6e('0x23')](function(_0x49e9ef){_0x2cf04a[_0x9c6e('0x1f')]=_0x49e9ef;if(_0x177448[_0x9c6e('0x32')][_0x9c6e('0x42')]){_0xe214cb['include']=[{'all':!![]}];}return db[_0x9c6e('0x2c')][_0x9c6e('0x43')](_0xe214cb);})[_0x9c6e('0x23')](function(_0x391f5d){_0x2cf04a[_0x9c6e('0x44')]=_0x391f5d;return _0x2cf04a;})[_0x9c6e('0x23')](respondWithFilteredResult(_0x5f2994,_0xe214cb))[_0x9c6e('0x45')](handleError(_0x5f2994,null));};exports[_0x9c6e('0x46')]=function(_0x26ddc9,_0x2ea213){var _0x4a22a4={'raw':!![],'where':{'id':_0x26ddc9[_0x9c6e('0x47')]['id']}},_0x33b61e={};_0x33b61e[_0x9c6e('0x30')]=_[_0x9c6e('0x31')](db[_0x9c6e('0x2c')][_0x9c6e('0x2d')]);_0x33b61e[_0x9c6e('0x32')]=_['keys'](_0x26ddc9[_0x9c6e('0x32')]);_0x33b61e[_0x9c6e('0x3b')]=_['intersection'](_0x33b61e[_0x9c6e('0x30')],_0x33b61e[_0x9c6e('0x32')]);_0x4a22a4[_0x9c6e('0x34')]=_['intersection'](_0x33b61e['model'],qs[_0x9c6e('0x35')](_0x26ddc9['query'][_0x9c6e('0x35')]));_0x4a22a4[_0x9c6e('0x34')]=_0x4a22a4['attributes']['length']?_0x4a22a4['attributes']:_0x33b61e[_0x9c6e('0x30')];if(_0x26ddc9[_0x9c6e('0x32')][_0x9c6e('0x42')]){_0x4a22a4[_0x9c6e('0x48')]=[{'all':!![]}];}_0x4a22a4=_[_0x9c6e('0x3e')]({},_0x4a22a4,_0x26ddc9[_0x9c6e('0x41')]);return db['SquareMessage']['find'](_0x4a22a4)[_0x9c6e('0x23')](handleEntityNotFound(_0x2ea213,null))[_0x9c6e('0x23')](respondWithResult(_0x2ea213,null))['catch'](handleError(_0x2ea213,null));};exports[_0x9c6e('0x49')]=function(_0x374d62,_0x5e06d6){return db[_0x9c6e('0x2c')][_0x9c6e('0x49')](_0x374d62['body'],{})['then'](respondWithResult(_0x5e06d6,0xc9))[_0x9c6e('0x45')](handleError(_0x5e06d6,null));};exports[_0x9c6e('0x4a')]=function(_0x2490c1,_0x41b3d7){if(_0x2490c1[_0x9c6e('0x4b')]['id']){delete _0x2490c1[_0x9c6e('0x4b')]['id'];}return db[_0x9c6e('0x2c')][_0x9c6e('0x4c')]({'where':{'id':_0x2490c1['params']['id']}})[_0x9c6e('0x23')](handleEntityNotFound(_0x41b3d7,null))[_0x9c6e('0x23')](saveUpdates(_0x2490c1['body'],null))['then'](respondWithResult(_0x41b3d7,null))['catch'](handleError(_0x41b3d7,null));};exports['destroy']=function(_0xf83ae9,_0x264ee0){return db[_0x9c6e('0x2c')][_0x9c6e('0x4c')]({'where':{'id':_0xf83ae9[_0x9c6e('0x47')]['id']}})[_0x9c6e('0x23')](handleEntityNotFound(_0x264ee0,null))['then'](removeEntity(_0x264ee0,null))[_0x9c6e('0x45')](handleError(_0x264ee0,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6d2a53b..5a7366b 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 _0xbec6=['rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x503a44,_0x4eb027){var _0x1d9327=function(_0x229617){while(--_0x229617){_0x503a44['push'](_0x503a44['shift']());}};_0x1d9327(++_0x4eb027);}(_0xbec6,0xf6));var _0x6bec=function(_0x4aa662,_0x1cc90c){_0x4aa662=_0x4aa662-0x0;var _0x336478=_0xbec6[_0x4aa662];return _0x336478;};'use strict';var _=require(_0x6bec('0x0'));var util=require(_0x6bec('0x1'));var logger=require(_0x6bec('0x2'))(_0x6bec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6bec('0x4'));var fs=require('fs');var path=require(_0x6bec('0x5'));var rimraf=require(_0x6bec('0x6'));var config=require(_0x6bec('0x7'));var attributes=require(_0x6bec('0x8'));module['exports']=function(_0x272adf,_0x4459be){return _0x272adf[_0x6bec('0x9')](_0x6bec('0xa'),attributes,{'tableName':_0x6bec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12e2=['exports','define','SquareMessage','square_messages','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes'];(function(_0x1be2eb,_0x45cbdc){var _0x1df447=function(_0x5c10cf){while(--_0x5c10cf){_0x1be2eb['push'](_0x1be2eb['shift']());}};_0x1df447(++_0x45cbdc);}(_0x12e2,0x170));var _0x212e=function(_0x2e90af,_0x21e5bf){_0x2e90af=_0x2e90af-0x0;var _0x4cb888=_0x12e2[_0x2e90af];return _0x4cb888;};'use strict';var _=require('lodash');var util=require(_0x212e('0x0'));var logger=require('../../config/logger')(_0x212e('0x1'));var moment=require(_0x212e('0x2'));var BPromise=require(_0x212e('0x3'));var rp=require(_0x212e('0x4'));var fs=require('fs');var path=require(_0x212e('0x5'));var rimraf=require(_0x212e('0x6'));var config=require(_0x212e('0x7'));var attributes=require(_0x212e('0x8'));module[_0x212e('0x9')]=function(_0x52a5ef,_0x2c4d1c){return _0x52a5ef[_0x212e('0xa')](_0x212e('0xb'),attributes,{'tableName':_0x212e('0xc'),'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 acaf0eb..dd2eedb 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 _0x3281=['request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','info','lodash','util','randomstring','ioredis','rpc','jayson/promise'];(function(_0x3fe44d,_0x4bce6c){var _0x17d941=function(_0x1dc861){while(--_0x1dc861){_0x3fe44d['push'](_0x3fe44d['shift']());}};_0x17d941(++_0x4bce6c);}(_0x3281,0xba));var _0x1328=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x3281[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x1328('0x0'));var util=require(_0x1328('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1328('0x2'));var fs=require('fs');var Redis=require(_0x1328('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1328('0x4'));var config=require('../../config/environment');var jayson=require(_0x1328('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x270713,_0x74ccac,_0x2d06e3){return new BPromise(function(_0x45fe1d,_0x334bcf){return client[_0x1328('0x6')](_0x270713,_0x2d06e3)[_0x1328('0x7')](function(_0x29d70b){logger['info'](_0x1328('0x8'),_0x74ccac,_0x1328('0x9'));logger[_0x1328('0xa')](_0x1328('0xb'),_0x74ccac,_0x1328('0x9'),JSON[_0x1328('0xc')](_0x29d70b));if(_0x29d70b[_0x1328('0xd')]){if(_0x29d70b[_0x1328('0xd')][_0x1328('0xe')]===0x1f4){logger[_0x1328('0xd')](_0x1328('0x8'),_0x74ccac,_0x29d70b[_0x1328('0xd')][_0x1328('0xf')]);return _0x334bcf(_0x29d70b[_0x1328('0xd')][_0x1328('0xf')]);}logger[_0x1328('0xd')](_0x1328('0x8'),_0x74ccac,_0x29d70b['error'][_0x1328('0xf')]);return _0x45fe1d(_0x29d70b['error']['message']);}else{logger['info'](_0x1328('0x8'),_0x74ccac,_0x1328('0x9'));_0x45fe1d(_0x29d70b[_0x1328('0x10')][_0x1328('0xf')]);}})[_0x1328('0x11')](function(_0x3fd9b7){logger[_0x1328('0xd')](_0x1328('0x8'),_0x74ccac,_0x3fd9b7);_0x334bcf(_0x3fd9b7);});});}exports[_0x1328('0x12')]=function(_0x30d8be){var _0x257334=this;return new Promise(function(_0x2cde25,_0x293812){return db[_0x1328('0x13')][_0x1328('0x14')](_0x30d8be[_0x1328('0x15')],{'raw':_0x30d8be[_0x1328('0x16')]?_0x30d8be['options']['raw']===undefined?!![]:![]:!![]})[_0x1328('0x7')](function(_0x330881){logger[_0x1328('0x17')](_0x1328('0x12'),_0x30d8be);logger[_0x1328('0xa')](_0x1328('0x12'),_0x30d8be,JSON['stringify'](_0x330881));_0x2cde25(_0x330881);})[_0x1328('0x11')](function(_0xd905ba){logger[_0x1328('0xd')]('CreateSquareMessage',_0xd905ba[_0x1328('0xf')],_0x30d8be);_0x293812(_0x257334[_0x1328('0xd')](0x1f4,_0xd905ba[_0x1328('0xf')]));});});}; \ No newline at end of file +var _0xd5bf=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','raw'];(function(_0x3a9a2a,_0x2b1111){var _0x40a87b=function(_0x130083){while(--_0x130083){_0x3a9a2a['push'](_0x3a9a2a['shift']());}};_0x40a87b(++_0x2b1111);}(_0xd5bf,0x190));var _0xfd5b=function(_0x21f439,_0x3f5fc4){_0x21f439=_0x21f439-0x0;var _0x4e425d=_0xd5bf[_0x21f439];return _0x4e425d;};'use strict';var _=require('lodash');var util=require(_0xfd5b('0x0'));var moment=require(_0xfd5b('0x1'));var BPromise=require(_0xfd5b('0x2'));var rs=require(_0xfd5b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfd5b('0x4'));var logger=require(_0xfd5b('0x5'))('rpc');var config=require(_0xfd5b('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfd5b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b1080,_0x130d4a,_0x7d4a56){return new BPromise(function(_0x4293cf,_0xeaf6bf){return client[_0xfd5b('0x8')](_0x4b1080,_0x7d4a56)[_0xfd5b('0x9')](function(_0x4af6c2){logger[_0xfd5b('0xa')](_0xfd5b('0xb'),_0x130d4a,_0xfd5b('0xc'));logger[_0xfd5b('0xd')](_0xfd5b('0xe'),_0x130d4a,_0xfd5b('0xc'),JSON[_0xfd5b('0xf')](_0x4af6c2));if(_0x4af6c2[_0xfd5b('0x10')]){if(_0x4af6c2[_0xfd5b('0x10')][_0xfd5b('0x11')]===0x1f4){logger[_0xfd5b('0x10')](_0xfd5b('0xb'),_0x130d4a,_0x4af6c2[_0xfd5b('0x10')][_0xfd5b('0x12')]);return _0xeaf6bf(_0x4af6c2[_0xfd5b('0x10')]['message']);}logger[_0xfd5b('0x10')](_0xfd5b('0xb'),_0x130d4a,_0x4af6c2[_0xfd5b('0x10')][_0xfd5b('0x12')]);return _0x4293cf(_0x4af6c2[_0xfd5b('0x10')]['message']);}else{logger['info'](_0xfd5b('0xb'),_0x130d4a,'request\x20sent');_0x4293cf(_0x4af6c2[_0xfd5b('0x13')][_0xfd5b('0x12')]);}})[_0xfd5b('0x14')](function(_0x551205){logger[_0xfd5b('0x10')](_0xfd5b('0xb'),_0x130d4a,_0x551205);_0xeaf6bf(_0x551205);});});}exports[_0xfd5b('0x15')]=function(_0x150216){var _0x431295=this;return new Promise(function(_0x2ca5dc,_0x1a99f0){return db[_0xfd5b('0x16')][_0xfd5b('0x17')](_0x150216['body'],{'raw':_0x150216['options']?_0x150216['options'][_0xfd5b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0xfbc3d8){logger[_0xfd5b('0xa')](_0xfd5b('0x15'),_0x150216);logger[_0xfd5b('0xd')](_0xfd5b('0x15'),_0x150216,JSON['stringify'](_0xfbc3d8));_0x2ca5dc(_0xfbc3d8);})[_0xfd5b('0x14')](function(_0x5a77c1){logger[_0xfd5b('0x10')](_0xfd5b('0x15'),_0x5a77c1['message'],_0x150216);_0x1a99f0(_0x431295[_0xfd5b('0x10')](0x1f4,_0x5a77c1[_0xfd5b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 9d318af..41acea6 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 _0x8272=['delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','post','update'];(function(_0x8d7daa,_0x2dcfa5){var _0x4b69bb=function(_0x5d5b49){while(--_0x5d5b49){_0x8d7daa['push'](_0x8d7daa['shift']());}};_0x4b69bb(++_0x2dcfa5);}(_0x8272,0x67));var _0x2827=function(_0x137898,_0x4a2a37){_0x137898=_0x137898-0x0;var _0x1fe647=_0x8272[_0x137898];return _0x1fe647;};'use strict';var multer=require(_0x2827('0x0'));var util=require(_0x2827('0x1'));var path=require(_0x2827('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2827('0x3')]();var fs_extra=require(_0x2827('0x4'));var auth=require(_0x2827('0x5'));var interaction=require(_0x2827('0x6'));var config=require(_0x2827('0x7'));var controller=require(_0x2827('0x8'));router[_0x2827('0x9')]('/',auth[_0x2827('0xa')](),controller['index']);router[_0x2827('0x9')](_0x2827('0xb'),auth[_0x2827('0xa')](),controller[_0x2827('0xc')]);router['get'](_0x2827('0xd'),auth['isAuthenticated'](),timeout(_0x2827('0xe')),controller['test']);router[_0x2827('0xf')]('/',auth[_0x2827('0xa')](),controller['create']);router['put']('/:id',auth[_0x2827('0xa')](),controller[_0x2827('0x10')]);router[_0x2827('0x11')](_0x2827('0xb'),auth[_0x2827('0xa')](),controller[_0x2827('0x12')]);module[_0x2827('0x13')]=router; \ No newline at end of file +var _0xebe5=['fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','test','post','create','put','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x25017e,_0x374637){var _0x2240aa=function(_0x3db9f4){while(--_0x3db9f4){_0x25017e['push'](_0x25017e['shift']());}};_0x2240aa(++_0x374637);}(_0xebe5,0x1ca));var _0x5ebe=function(_0x283848,_0x28513d){_0x283848=_0x283848-0x0;var _0x56a732=_0xebe5[_0x283848];return _0x56a732;};'use strict';var multer=require(_0x5ebe('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5ebe('0x1'));var express=require(_0x5ebe('0x2'));var router=express[_0x5ebe('0x3')]();var fs_extra=require(_0x5ebe('0x4'));var auth=require(_0x5ebe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5ebe('0x6'));var controller=require(_0x5ebe('0x7'));router[_0x5ebe('0x8')]('/',auth[_0x5ebe('0x9')](),controller[_0x5ebe('0xa')]);router[_0x5ebe('0x8')](_0x5ebe('0xb'),auth[_0x5ebe('0x9')](),controller[_0x5ebe('0xc')]);router[_0x5ebe('0x8')](_0x5ebe('0xd'),auth[_0x5ebe('0x9')](),timeout(_0x5ebe('0xe')),controller[_0x5ebe('0xf')]);router[_0x5ebe('0x10')]('/',auth['isAuthenticated'](),controller[_0x5ebe('0x11')]);router[_0x5ebe('0x12')](_0x5ebe('0xb'),auth[_0x5ebe('0x9')](),controller['update']);router[_0x5ebe('0x13')](_0x5ebe('0xb'),auth[_0x5ebe('0x9')](),controller[_0x5ebe('0x14')]);module[_0x5ebe('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 999dec4..eb69ea8 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 _0xcbc7=['STRING','name','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcbc7,0x186));var _0x7cbc=function(_0x73aef5,_0x5b2293){_0x73aef5=_0x73aef5-0x0;var _0x29be73=_0xcbc7[_0x73aef5];return _0x29be73;};'use strict';var Sequelize=require(_0x7cbc('0x0'));module[_0x7cbc('0x1')]={'name':{'type':Sequelize[_0x7cbc('0x2')],'unique':_0x7cbc('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x7cbc('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc9d2=['name','sequelize','exports','STRING'];(function(_0x3dd972,_0x46dd84){var _0x3800e0=function(_0x4469ac){while(--_0x4469ac){_0x3dd972['push'](_0x3dd972['shift']());}};_0x3800e0(++_0x46dd84);}(_0xc9d2,0x179));var _0x2c9d=function(_0x222760,_0x450633){_0x222760=_0x222760-0x0;var _0x396150=_0xc9d2[_0x222760];return _0x396150;};'use strict';var Sequelize=require(_0x2c9d('0x0'));module[_0x2c9d('0x1')]={'name':{'type':Sequelize[_0x2c9d('0x2')],'unique':_0x2c9d('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x2c9d('0x2')]},'description':{'type':Sequelize[_0x2c9d('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 889111d..e5a595d 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 _0x9a2a=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','UserProfileResource','sendStatus','name','index','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','odbc','openSync','dsn','closeSync','eml-format','fast-json-patch','request-promise'];(function(_0x5bedc0,_0x1b493d){var _0x492d9c=function(_0x23e647){while(--_0x23e647){_0x5bedc0['push'](_0x5bedc0['shift']());}};_0x492d9c(++_0x1b493d);}(_0x9a2a,0x169));var _0xa9a2=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9a2a[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xa9a2('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa9a2('0x1'));var rp=require(_0xa9a2('0x2'));var moment=require(_0xa9a2('0x3'));var BPromise=require(_0xa9a2('0x4'));var Mustache=require(_0xa9a2('0x5'));var util=require(_0xa9a2('0x6'));var path=require(_0xa9a2('0x7'));var sox=require(_0xa9a2('0x8'));var csv=require(_0xa9a2('0x9'));var ejs=require(_0xa9a2('0xa'));var fs=require('fs');var fs_extra=require(_0xa9a2('0xb'));var _=require(_0xa9a2('0xc'));var squel=require(_0xa9a2('0xd'));var crypto=require(_0xa9a2('0xe'));var jsforce=require(_0xa9a2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa9a2('0x9'));var querystring=require(_0xa9a2('0x10'));var Papa=require('papaparse');var Redis=require(_0xa9a2('0x11'));var authService=require(_0xa9a2('0x12'));var qs=require(_0xa9a2('0x13'));var as=require(_0xa9a2('0x14'));var hardwareService=require(_0xa9a2('0x15'));var logger=require('../../config/logger')(_0xa9a2('0x16'));var utils=require(_0xa9a2('0x17'));var config=require(_0xa9a2('0x18'));var licenseUtil=require(_0xa9a2('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56dc55,_0x393034){_0x393034=_0x393034||0xcc;return function(_0x451f94){if(_0x451f94){return _0x56dc55['sendStatus'](_0x393034);}return _0x56dc55[_0xa9a2('0x1a')](_0x393034)[_0xa9a2('0x1b')]();};}function respondWithResult(_0x2b63f9,_0x32d440){_0x32d440=_0x32d440||0xc8;return function(_0x90c283){if(_0x90c283){return _0x2b63f9[_0xa9a2('0x1a')](_0x32d440)[_0xa9a2('0x1c')](_0x90c283);}};}function respondWithFilteredResult(_0x5de46c,_0x2bc644){return function(_0x3953be){if(_0x3953be){var _0x3dc63f=typeof _0x2bc644[_0xa9a2('0x1d')]===_0xa9a2('0x1e')&&typeof _0x2bc644[_0xa9a2('0x1f')]==='undefined';var _0xb425a6=_0x3953be[_0xa9a2('0x20')];var _0x1fa70c=_0x3dc63f?0x0:_0x2bc644[_0xa9a2('0x1d')];var _0x5b2291=_0x3dc63f?_0x3953be[_0xa9a2('0x20')]:_0x2bc644['offset']+_0x2bc644[_0xa9a2('0x1f')];var _0x1e7f7b;if(_0x5b2291>=_0xb425a6){_0x5b2291=_0xb425a6;_0x1e7f7b=0xc8;}else{_0x1e7f7b=0xce;}_0x5de46c[_0xa9a2('0x1a')](_0x1e7f7b);return _0x5de46c[_0xa9a2('0x21')](_0xa9a2('0x22'),_0x1fa70c+'-'+_0x5b2291+'/'+_0xb425a6)['json'](_0x3953be);}return null;};}function patchUpdates(_0x16b09f){return function(_0x5d15e8){try{jsonpatch[_0xa9a2('0x23')](_0x5d15e8,_0x16b09f,!![]);}catch(_0x50aff2){return BPromise[_0xa9a2('0x24')](_0x50aff2);}return _0x5d15e8[_0xa9a2('0x25')]();};}function saveUpdates(_0x29e31d,_0x4749ce){return function(_0x188057){if(_0x188057){return _0x188057[_0xa9a2('0x26')](_0x29e31d)[_0xa9a2('0x27')](function(_0x56c7fd){return _0x56c7fd;});}return null;};}function removeEntity(_0x5414b2,_0x244738){return function(_0x16c23a){if(_0x16c23a){return _0x16c23a[_0xa9a2('0x28')]()[_0xa9a2('0x27')](function(){var _0x4d353b=_0x16c23a[_0xa9a2('0x29')]({'plain':!![]});var _0x1bb16d=_0xa9a2('0x2a');return db[_0xa9a2('0x2b')][_0xa9a2('0x28')]({'where':{'type':_0x1bb16d,'resourceId':_0x4d353b['id']}})[_0xa9a2('0x27')](function(){return _0x16c23a;});})[_0xa9a2('0x27')](function(){_0x5414b2['status'](0xcc)[_0xa9a2('0x1b')]();});}};}function handleEntityNotFound(_0x384d77,_0x17f18e){return function(_0x21371e){if(!_0x21371e){_0x384d77[_0xa9a2('0x2c')](0x194);}return _0x21371e;};}function handleError(_0x31a068,_0x40d533){_0x40d533=_0x40d533||0x1f4;return function(_0x1363a9){logger['error'](_0x1363a9['stack']);if(_0x1363a9[_0xa9a2('0x2d')]){delete _0x1363a9[_0xa9a2('0x2d')];}_0x31a068[_0xa9a2('0x1a')](_0x40d533)['send'](_0x1363a9);};}exports[_0xa9a2('0x2e')]=function(_0x42a122,_0x400b55){var _0x1668a2={},_0x56ca4e={},_0x18e4e5={'count':0x0,'rows':[]};var _0x27ef16=_['map'](db[_0xa9a2('0x2f')][_0xa9a2('0x30')],function(_0x382012){return{'name':_0x382012[_0xa9a2('0x31')],'type':_0x382012[_0xa9a2('0x32')][_0xa9a2('0x33')]};});_0x56ca4e[_0xa9a2('0x34')]=_['map'](_0x27ef16,_0xa9a2('0x2d'));_0x56ca4e[_0xa9a2('0x35')]=_[_0xa9a2('0x36')](_0x42a122[_0xa9a2('0x35')]);_0x56ca4e['filters']=_['intersection'](_0x56ca4e['model'],_0x56ca4e[_0xa9a2('0x35')]);_0x1668a2[_0xa9a2('0x37')]=_['intersection'](_0x56ca4e[_0xa9a2('0x34')],qs[_0xa9a2('0x38')](_0x42a122['query'][_0xa9a2('0x38')]));_0x1668a2['attributes']=_0x1668a2[_0xa9a2('0x37')][_0xa9a2('0x39')]?_0x1668a2[_0xa9a2('0x37')]:_0x56ca4e['model'];if(!_0x42a122[_0xa9a2('0x35')][_0xa9a2('0x3a')](_0xa9a2('0x3b'))){_0x1668a2['limit']=qs[_0xa9a2('0x1f')](_0x42a122['query']['limit']);_0x1668a2[_0xa9a2('0x1d')]=qs['offset'](_0x42a122[_0xa9a2('0x35')][_0xa9a2('0x1d')]);}_0x1668a2[_0xa9a2('0x3c')]=qs[_0xa9a2('0x3d')](_0x42a122['query']['sort']);_0x1668a2[_0xa9a2('0x3e')]=qs[_0xa9a2('0x3f')](_[_0xa9a2('0x40')](_0x42a122[_0xa9a2('0x35')],_0x56ca4e[_0xa9a2('0x3f')]),_0x27ef16);if(_0x42a122[_0xa9a2('0x35')][_0xa9a2('0x41')]){_0x1668a2[_0xa9a2('0x3e')]=_['merge'](_0x1668a2[_0xa9a2('0x3e')],{'$or':_['map'](_0x27ef16,function(_0x4ec74d){if(_0x4ec74d[_0xa9a2('0x32')]!==_0xa9a2('0x42')){var _0x2f0b7f={};_0x2f0b7f[_0x4ec74d[_0xa9a2('0x2d')]]={'$like':'%'+_0x42a122[_0xa9a2('0x35')]['filter']+'%'};return _0x2f0b7f;}})});}_0x1668a2=_[_0xa9a2('0x43')]({},_0x1668a2,_0x42a122[_0xa9a2('0x44')]);var _0x2b9c86={'where':_0x1668a2[_0xa9a2('0x3e')]};return db[_0xa9a2('0x2f')][_0xa9a2('0x20')](_0x2b9c86)[_0xa9a2('0x27')](function(_0x5d8636){_0x18e4e5[_0xa9a2('0x20')]=_0x5d8636;if(_0x42a122[_0xa9a2('0x35')][_0xa9a2('0x45')]){_0x1668a2['include']=[{'all':!![]}];}return db[_0xa9a2('0x2f')][_0xa9a2('0x46')](_0x1668a2);})[_0xa9a2('0x27')](function(_0x2d03e7){_0x18e4e5[_0xa9a2('0x47')]=_0x2d03e7;return _0x18e4e5;})[_0xa9a2('0x27')](respondWithFilteredResult(_0x400b55,_0x1668a2))[_0xa9a2('0x48')](handleError(_0x400b55,null));};exports['show']=function(_0x36571a,_0xaefcf5){var _0x26aa09={'raw':!![],'where':{'id':_0x36571a[_0xa9a2('0x49')]['id']}},_0xd48c21={};_0xd48c21[_0xa9a2('0x34')]=_[_0xa9a2('0x36')](db['SquareOdbc'][_0xa9a2('0x30')]);_0xd48c21[_0xa9a2('0x35')]=_[_0xa9a2('0x36')](_0x36571a['query']);_0xd48c21[_0xa9a2('0x3f')]=_[_0xa9a2('0x4a')](_0xd48c21[_0xa9a2('0x34')],_0xd48c21[_0xa9a2('0x35')]);_0x26aa09[_0xa9a2('0x37')]=_['intersection'](_0xd48c21[_0xa9a2('0x34')],qs['fields'](_0x36571a[_0xa9a2('0x35')][_0xa9a2('0x38')]));_0x26aa09[_0xa9a2('0x37')]=_0x26aa09[_0xa9a2('0x37')][_0xa9a2('0x39')]?_0x26aa09[_0xa9a2('0x37')]:_0xd48c21['model'];if(_0x36571a['query'][_0xa9a2('0x45')]){_0x26aa09['include']=[{'all':!![]}];}_0x26aa09=_[_0xa9a2('0x43')]({},_0x26aa09,_0x36571a['options']);return db[_0xa9a2('0x2f')][_0xa9a2('0x4b')](_0x26aa09)['then'](handleEntityNotFound(_0xaefcf5,null))[_0xa9a2('0x27')](respondWithResult(_0xaefcf5,null))['catch'](handleError(_0xaefcf5,null));};exports[_0xa9a2('0x4c')]=function(_0x2b670f,_0x3696f8){return db['SquareOdbc'][_0xa9a2('0x4c')](_0x2b670f['body'],{})['then'](function(_0x595df0){var _0x36b407=_0x2b670f[_0xa9a2('0x4d')][_0xa9a2('0x29')]({'plain':!![]});if(!_0x36b407)throw new Error(_0xa9a2('0x4e'));if(_0x36b407[_0xa9a2('0x4f')]===_0xa9a2('0x4d')){var _0x57fbf7=_0x595df0[_0xa9a2('0x29')]({'plain':!![]});var _0x526507=_0xa9a2('0x2a');return db[_0xa9a2('0x50')][_0xa9a2('0x4b')]({'where':{'name':_0x526507,'userProfileId':_0x36b407[_0xa9a2('0x51')]},'raw':!![]})[_0xa9a2('0x27')](function(_0x2f6f5b){if(_0x2f6f5b&&_0x2f6f5b[_0xa9a2('0x52')]===0x0){return db[_0xa9a2('0x2b')]['create']({'name':_0x57fbf7[_0xa9a2('0x2d')],'resourceId':_0x57fbf7['id'],'type':_0x2f6f5b[_0xa9a2('0x2d')],'sectionId':_0x2f6f5b['id']},{})[_0xa9a2('0x27')](function(){return _0x595df0;});}else{return _0x595df0;}})[_0xa9a2('0x48')](function(_0x52eee8){logger[_0xa9a2('0x53')](_0xa9a2('0x54'),_0x52eee8);throw _0x52eee8;});}return _0x595df0;})[_0xa9a2('0x27')](respondWithResult(_0x3696f8,0xc9))['catch'](handleError(_0x3696f8,null));};exports[_0xa9a2('0x26')]=function(_0x57d3ac,_0x2ca64a){if(_0x57d3ac[_0xa9a2('0x55')]['id']){delete _0x57d3ac[_0xa9a2('0x55')]['id'];}return db['SquareOdbc'][_0xa9a2('0x4b')]({'where':{'id':_0x57d3ac[_0xa9a2('0x49')]['id']}})[_0xa9a2('0x27')](handleEntityNotFound(_0x2ca64a,null))[_0xa9a2('0x27')](saveUpdates(_0x57d3ac[_0xa9a2('0x55')],null))[_0xa9a2('0x27')](respondWithResult(_0x2ca64a,null))['catch'](handleError(_0x2ca64a,null));};exports[_0xa9a2('0x28')]=function(_0x458530,_0x7e5915){return db[_0xa9a2('0x2f')][_0xa9a2('0x4b')]({'where':{'id':_0x458530['params']['id']}})[_0xa9a2('0x27')](handleEntityNotFound(_0x7e5915,null))[_0xa9a2('0x27')](removeEntity(_0x7e5915,null))[_0xa9a2('0x48')](handleError(_0x7e5915,null));};exports[_0xa9a2('0x56')]=function(_0x5335e3,_0x4aedb,_0x24e71e){var _0x56085f;return db[_0xa9a2('0x2f')][_0xa9a2('0x4b')]({'where':{'id':_0x5335e3['params']['id']},'attributes':['id','dsn']})[_0xa9a2('0x27')](handleEntityNotFound(_0x4aedb,null))[_0xa9a2('0x27')](function(_0x1e4829){if(_0x1e4829){var _0x1df682=require(_0xa9a2('0x57'))();_0x1df682[_0xa9a2('0x58')](_0x1e4829[_0xa9a2('0x59')]);_0x1df682[_0xa9a2('0x5a')]();return _0x1e4829;}})[_0xa9a2('0x27')](respondWithResult(_0x4aedb,null))['catch'](handleError(_0x4aedb,null));}; \ No newline at end of file +var _0x991a=['fields','length','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','SquareOdbc','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x2e52ba,_0x17d180){var _0x3438e1=function(_0x59c4f1){while(--_0x59c4f1){_0x2e52ba['push'](_0x2e52ba['shift']());}};_0x3438e1(++_0x17d180);}(_0x991a,0x17d));var _0xa991=function(_0x5d07a6,_0x3d124c){_0x5d07a6=_0x5d07a6-0x0;var _0x59f267=_0x991a[_0x5d07a6];return _0x59f267;};'use strict';var emlformat=require(_0xa991('0x0'));var rimraf=require(_0xa991('0x1'));var zipdir=require(_0xa991('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa991('0x3'));var Mustache=require(_0xa991('0x4'));var util=require(_0xa991('0x5'));var path=require(_0xa991('0x6'));var sox=require(_0xa991('0x7'));var csv=require(_0xa991('0x8'));var ejs=require(_0xa991('0x9'));var fs=require('fs');var fs_extra=require(_0xa991('0xa'));var _=require(_0xa991('0xb'));var squel=require(_0xa991('0xc'));var crypto=require('crypto');var jsforce=require(_0xa991('0xd'));var deskjs=require(_0xa991('0xe'));var toCsv=require(_0xa991('0x8'));var querystring=require(_0xa991('0xf'));var Papa=require(_0xa991('0x10'));var Redis=require(_0xa991('0x11'));var authService=require(_0xa991('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa991('0x13'))(_0xa991('0x14'));var utils=require(_0xa991('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xa991('0x16'));var db=require(_0xa991('0x17'))['db'];function respondWithStatusCode(_0x314e5e,_0x3f05d3){_0x3f05d3=_0x3f05d3||0xcc;return function(_0x1a4853){if(_0x1a4853){return _0x314e5e[_0xa991('0x18')](_0x3f05d3);}return _0x314e5e[_0xa991('0x19')](_0x3f05d3)[_0xa991('0x1a')]();};}function respondWithResult(_0x41fd54,_0x5834a3){_0x5834a3=_0x5834a3||0xc8;return function(_0x28afaf){if(_0x28afaf){return _0x41fd54['status'](_0x5834a3)[_0xa991('0x1b')](_0x28afaf);}};}function respondWithFilteredResult(_0x110c31,_0xa5ddbc){return function(_0x28cdeb){if(_0x28cdeb){var _0x3bf6ad=typeof _0xa5ddbc[_0xa991('0x1c')]===_0xa991('0x1d')&&typeof _0xa5ddbc[_0xa991('0x1e')]===_0xa991('0x1d');var _0x14258a=_0x28cdeb['count'];var _0x452ed9=_0x3bf6ad?0x0:_0xa5ddbc[_0xa991('0x1c')];var _0x17b2ec=_0x3bf6ad?_0x28cdeb[_0xa991('0x1f')]:_0xa5ddbc[_0xa991('0x1c')]+_0xa5ddbc[_0xa991('0x1e')];var _0x2439b8;if(_0x17b2ec>=_0x14258a){_0x17b2ec=_0x14258a;_0x2439b8=0xc8;}else{_0x2439b8=0xce;}_0x110c31[_0xa991('0x19')](_0x2439b8);return _0x110c31['set'](_0xa991('0x20'),_0x452ed9+'-'+_0x17b2ec+'/'+_0x14258a)[_0xa991('0x1b')](_0x28cdeb);}return null;};}function patchUpdates(_0x50213b){return function(_0x18f6bd){try{jsonpatch[_0xa991('0x21')](_0x18f6bd,_0x50213b,!![]);}catch(_0x1425ec){return BPromise[_0xa991('0x22')](_0x1425ec);}return _0x18f6bd[_0xa991('0x23')]();};}function saveUpdates(_0x6a6f9c,_0x34cb17){return function(_0x18bfd0){if(_0x18bfd0){return _0x18bfd0['update'](_0x6a6f9c)[_0xa991('0x24')](function(_0x4ab955){return _0x4ab955;});}return null;};}function removeEntity(_0x3252c7,_0x2600e0){return function(_0x2e5546){if(_0x2e5546){return _0x2e5546[_0xa991('0x25')]()['then'](function(){var _0x3e8a30=_0x2e5546[_0xa991('0x26')]({'plain':!![]});var _0x430c54='ODBC';return db[_0xa991('0x27')][_0xa991('0x25')]({'where':{'type':_0x430c54,'resourceId':_0x3e8a30['id']}})['then'](function(){return _0x2e5546;});})[_0xa991('0x24')](function(){_0x3252c7[_0xa991('0x19')](0xcc)[_0xa991('0x1a')]();});}};}function handleEntityNotFound(_0x42bee5,_0x487259){return function(_0xc309bc){if(!_0xc309bc){_0x42bee5[_0xa991('0x18')](0x194);}return _0xc309bc;};}function handleError(_0x4bfd4d,_0x4c14f6){_0x4c14f6=_0x4c14f6||0x1f4;return function(_0x560bf1){logger[_0xa991('0x28')](_0x560bf1[_0xa991('0x29')]);if(_0x560bf1[_0xa991('0x2a')]){delete _0x560bf1['name'];}_0x4bfd4d['status'](_0x4c14f6)['send'](_0x560bf1);};}exports[_0xa991('0x2b')]=function(_0x499fee,_0x5873f0){var _0x1fe6da={},_0x7d36ee={},_0x3d6139={'count':0x0,'rows':[]};var _0x3d88fe=_[_0xa991('0x2c')](db[_0xa991('0x2d')]['rawAttributes'],function(_0x258906){return{'name':_0x258906[_0xa991('0x2e')],'type':_0x258906[_0xa991('0x2f')][_0xa991('0x30')]};});_0x7d36ee[_0xa991('0x31')]=_[_0xa991('0x2c')](_0x3d88fe,_0xa991('0x2a'));_0x7d36ee['query']=_['keys'](_0x499fee[_0xa991('0x32')]);_0x7d36ee[_0xa991('0x33')]=_[_0xa991('0x34')](_0x7d36ee['model'],_0x7d36ee[_0xa991('0x32')]);_0x1fe6da[_0xa991('0x35')]=_[_0xa991('0x34')](_0x7d36ee['model'],qs[_0xa991('0x36')](_0x499fee['query'][_0xa991('0x36')]));_0x1fe6da['attributes']=_0x1fe6da[_0xa991('0x35')][_0xa991('0x37')]?_0x1fe6da[_0xa991('0x35')]:_0x7d36ee[_0xa991('0x31')];if(!_0x499fee[_0xa991('0x32')]['hasOwnProperty']('nolimit')){_0x1fe6da[_0xa991('0x1e')]=qs[_0xa991('0x1e')](_0x499fee[_0xa991('0x32')]['limit']);_0x1fe6da[_0xa991('0x1c')]=qs[_0xa991('0x1c')](_0x499fee[_0xa991('0x32')][_0xa991('0x1c')]);}_0x1fe6da[_0xa991('0x38')]=qs['sort'](_0x499fee[_0xa991('0x32')]['sort']);_0x1fe6da[_0xa991('0x39')]=qs[_0xa991('0x33')](_[_0xa991('0x3a')](_0x499fee['query'],_0x7d36ee[_0xa991('0x33')]),_0x3d88fe);if(_0x499fee[_0xa991('0x32')][_0xa991('0x3b')]){_0x1fe6da[_0xa991('0x39')]=_[_0xa991('0x3c')](_0x1fe6da[_0xa991('0x39')],{'$or':_[_0xa991('0x2c')](_0x3d88fe,function(_0x52f62a){if(_0x52f62a[_0xa991('0x2f')]!==_0xa991('0x3d')){var _0x93aae0={};_0x93aae0[_0x52f62a['name']]={'$like':'%'+_0x499fee[_0xa991('0x32')][_0xa991('0x3b')]+'%'};return _0x93aae0;}})});}_0x1fe6da=_[_0xa991('0x3c')]({},_0x1fe6da,_0x499fee[_0xa991('0x3e')]);var _0x1c323b={'where':_0x1fe6da[_0xa991('0x39')]};return db[_0xa991('0x2d')][_0xa991('0x1f')](_0x1c323b)[_0xa991('0x24')](function(_0x706ffe){_0x3d6139[_0xa991('0x1f')]=_0x706ffe;if(_0x499fee[_0xa991('0x32')][_0xa991('0x3f')]){_0x1fe6da[_0xa991('0x40')]=[{'all':!![]}];}return db[_0xa991('0x2d')][_0xa991('0x41')](_0x1fe6da);})['then'](function(_0x414d58){_0x3d6139[_0xa991('0x42')]=_0x414d58;return _0x3d6139;})[_0xa991('0x24')](respondWithFilteredResult(_0x5873f0,_0x1fe6da))[_0xa991('0x43')](handleError(_0x5873f0,null));};exports[_0xa991('0x44')]=function(_0x26cc09,_0x4045de){var _0x5b2ab3={'raw':!![],'where':{'id':_0x26cc09[_0xa991('0x45')]['id']}},_0x25475c={};_0x25475c[_0xa991('0x31')]=_[_0xa991('0x46')](db['SquareOdbc'][_0xa991('0x47')]);_0x25475c['query']=_['keys'](_0x26cc09[_0xa991('0x32')]);_0x25475c[_0xa991('0x33')]=_['intersection'](_0x25475c[_0xa991('0x31')],_0x25475c[_0xa991('0x32')]);_0x5b2ab3[_0xa991('0x35')]=_[_0xa991('0x34')](_0x25475c['model'],qs[_0xa991('0x36')](_0x26cc09['query'][_0xa991('0x36')]));_0x5b2ab3['attributes']=_0x5b2ab3[_0xa991('0x35')][_0xa991('0x37')]?_0x5b2ab3[_0xa991('0x35')]:_0x25475c[_0xa991('0x31')];if(_0x26cc09[_0xa991('0x32')][_0xa991('0x3f')]){_0x5b2ab3[_0xa991('0x40')]=[{'all':!![]}];}_0x5b2ab3=_['merge']({},_0x5b2ab3,_0x26cc09[_0xa991('0x3e')]);return db['SquareOdbc'][_0xa991('0x48')](_0x5b2ab3)['then'](handleEntityNotFound(_0x4045de,null))[_0xa991('0x24')](respondWithResult(_0x4045de,null))['catch'](handleError(_0x4045de,null));};exports[_0xa991('0x49')]=function(_0x2f4579,_0x1cf67c){return db['SquareOdbc'][_0xa991('0x49')](_0x2f4579[_0xa991('0x4a')],{})['then'](function(_0x3880de){var _0x372644=_0x2f4579[_0xa991('0x4b')][_0xa991('0x26')]({'plain':!![]});if(!_0x372644)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x372644[_0xa991('0x4c')]==='user'){var _0x2ccdad=_0x3880de['get']({'plain':!![]});var _0xd55e2='ODBC';return db[_0xa991('0x4d')]['find']({'where':{'name':_0xd55e2,'userProfileId':_0x372644[_0xa991('0x4e')]},'raw':!![]})['then'](function(_0x57a2e4){if(_0x57a2e4&&_0x57a2e4[_0xa991('0x4f')]===0x0){return db['UserProfileResource'][_0xa991('0x49')]({'name':_0x2ccdad[_0xa991('0x2a')],'resourceId':_0x2ccdad['id'],'type':_0x57a2e4['name'],'sectionId':_0x57a2e4['id']},{})[_0xa991('0x24')](function(){return _0x3880de;});}else{return _0x3880de;}})[_0xa991('0x43')](function(_0x47114f){logger['error'](_0xa991('0x50'),_0x47114f);throw _0x47114f;});}return _0x3880de;})[_0xa991('0x24')](respondWithResult(_0x1cf67c,0xc9))['catch'](handleError(_0x1cf67c,null));};exports[_0xa991('0x51')]=function(_0x588535,_0x31c79f){if(_0x588535['body']['id']){delete _0x588535['body']['id'];}return db[_0xa991('0x2d')]['find']({'where':{'id':_0x588535['params']['id']}})[_0xa991('0x24')](handleEntityNotFound(_0x31c79f,null))['then'](saveUpdates(_0x588535[_0xa991('0x4a')],null))[_0xa991('0x24')](respondWithResult(_0x31c79f,null))[_0xa991('0x43')](handleError(_0x31c79f,null));};exports[_0xa991('0x25')]=function(_0x5be76f,_0x56b92b){return db[_0xa991('0x2d')][_0xa991('0x48')]({'where':{'id':_0x5be76f[_0xa991('0x45')]['id']}})[_0xa991('0x24')](handleEntityNotFound(_0x56b92b,null))[_0xa991('0x24')](removeEntity(_0x56b92b,null))[_0xa991('0x43')](handleError(_0x56b92b,null));};exports[_0xa991('0x52')]=function(_0x36e825,_0x23cbc6,_0x518639){var _0x4cb49d;return db[_0xa991('0x2d')][_0xa991('0x48')]({'where':{'id':_0x36e825[_0xa991('0x45')]['id']},'attributes':['id',_0xa991('0x53')]})[_0xa991('0x24')](handleEntityNotFound(_0x23cbc6,null))[_0xa991('0x24')](function(_0x224864){if(_0x224864){var _0x50028e=require(_0xa991('0x54'))();_0x50028e[_0xa991('0x55')](_0x224864['dsn']);_0x50028e[_0xa991('0x56')]();return _0x224864;}})[_0xa991('0x24')](respondWithResult(_0x23cbc6,null))[_0xa991('0x43')](handleError(_0x23cbc6,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index abd233e..51ec7d1 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 _0x525a=['../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x525a,0x110));var _0xa525=function(_0x2cd1fb,_0x291f55){_0x2cd1fb=_0x2cd1fb-0x0;var _0x48fd2b=_0x525a[_0x2cd1fb];return _0x48fd2b;};'use strict';var _=require(_0xa525('0x0'));var util=require(_0xa525('0x1'));var logger=require('../../config/logger')(_0xa525('0x2'));var moment=require(_0xa525('0x3'));var BPromise=require(_0xa525('0x4'));var rp=require(_0xa525('0x5'));var fs=require('fs');var path=require(_0xa525('0x6'));var rimraf=require(_0xa525('0x7'));var config=require(_0xa525('0x8'));var attributes=require(_0xa525('0x9'));module[_0xa525('0xa')]=function(_0x3ba7e2,_0x4bdff2){return _0x3ba7e2[_0xa525('0xb')](_0xa525('0xc'),attributes,{'tableName':_0xa525('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbfc=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','define','SquareOdbc','square_odbc','lodash'];(function(_0xf8f3a0,_0x38bd10){var _0x37ec1f=function(_0x4f73ac){while(--_0x4f73ac){_0xf8f3a0['push'](_0xf8f3a0['shift']());}};_0x37ec1f(++_0x38bd10);}(_0xbbfc,0x17f));var _0xcbbf=function(_0x11ca63,_0xea9f9c){_0x11ca63=_0x11ca63-0x0;var _0x41f1f6=_0xbbfc[_0x11ca63];return _0x41f1f6;};'use strict';var _=require(_0xcbbf('0x0'));var util=require('util');var logger=require(_0xcbbf('0x1'))('api');var moment=require(_0xcbbf('0x2'));var BPromise=require(_0xcbbf('0x3'));var rp=require(_0xcbbf('0x4'));var fs=require('fs');var path=require(_0xcbbf('0x5'));var rimraf=require(_0xcbbf('0x6'));var config=require(_0xcbbf('0x7'));var attributes=require(_0xcbbf('0x8'));module['exports']=function(_0xa01c77,_0x565131){return _0xa01c77[_0xcbbf('0x9')](_0xcbbf('0xa'),attributes,{'tableName':_0xcbbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index b8d0966..38725a1 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 _0xc9ce=['attributes','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','include','model'];(function(_0x20076b,_0x4f218e){var _0x1ae3de=function(_0x545d7a){while(--_0x545d7a){_0x20076b['push'](_0x20076b['shift']());}};_0x1ae3de(++_0x4f218e);}(_0xc9ce,0x9d));var _0xec9c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc9ce[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xec9c('0x0'));var util=require(_0xec9c('0x1'));var moment=require(_0xec9c('0x2'));var BPromise=require(_0xec9c('0x3'));var rs=require(_0xec9c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xec9c('0x5'))['db'];var utils=require(_0xec9c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xec9c('0x7'));var jayson=require(_0xec9c('0x8'));var client=jayson['client'][_0xec9c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1b5733,_0x4f7be4,_0x736f96){return new BPromise(function(_0x23425c,_0x416d9b){return client[_0xec9c('0xa')](_0x1b5733,_0x736f96)[_0xec9c('0xb')](function(_0x51748e){logger[_0xec9c('0xc')](_0xec9c('0xd'),_0x4f7be4,_0xec9c('0xe'));logger[_0xec9c('0xf')](_0xec9c('0x10'),_0x4f7be4,_0xec9c('0xe'),JSON[_0xec9c('0x11')](_0x51748e));if(_0x51748e[_0xec9c('0x12')]){if(_0x51748e[_0xec9c('0x12')]['code']===0x1f4){logger[_0xec9c('0x12')](_0xec9c('0xd'),_0x4f7be4,_0x51748e['error'][_0xec9c('0x13')]);return _0x416d9b(_0x51748e['error'][_0xec9c('0x13')]);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x4f7be4,_0x51748e[_0xec9c('0x12')][_0xec9c('0x13')]);return _0x23425c(_0x51748e['error'][_0xec9c('0x13')]);}else{logger[_0xec9c('0xc')](_0xec9c('0xd'),_0x4f7be4,_0xec9c('0xe'));_0x23425c(_0x51748e['result']['message']);}})[_0xec9c('0x14')](function(_0x499c18){logger['error'](_0xec9c('0xd'),_0x4f7be4,_0x499c18);_0x416d9b(_0x499c18);});});}exports[_0xec9c('0x15')]=function(_0x10a975){var _0xbd6b35=this;return new Promise(function(_0x3731ac,_0x19dea2){return db[_0xec9c('0x16')][_0xec9c('0x17')]({'raw':_0x10a975[_0xec9c('0x18')]?_0x10a975[_0xec9c('0x18')][_0xec9c('0x19')]===undefined?!![]:![]:!![],'where':_0x10a975[_0xec9c('0x18')]?_0x10a975[_0xec9c('0x18')][_0xec9c('0x1a')]||null:null,'attributes':_0x10a975[_0xec9c('0x18')]?_0x10a975[_0xec9c('0x18')]['attributes']||null:null,'include':_0x10a975[_0xec9c('0x18')]?_0x10a975['options'][_0xec9c('0x1b')]?_['map'](_0x10a975[_0xec9c('0x18')][_0xec9c('0x1b')],function(_0x2f12d7){return{'model':db[_0x2f12d7[_0xec9c('0x1c')]],'as':_0x2f12d7['as'],'attributes':_0x2f12d7[_0xec9c('0x1d')],'include':_0x2f12d7[_0xec9c('0x1b')]?_[_0xec9c('0x1e')](_0x2f12d7['include'],function(_0x59c891){return{'model':db[_0x59c891[_0xec9c('0x1c')]],'as':_0x59c891['as'],'attributes':_0x59c891[_0xec9c('0x1d')],'include':_0x59c891[_0xec9c('0x1b')]?_[_0xec9c('0x1e')](_0x59c891[_0xec9c('0x1b')],function(_0x8c2be){return{'model':db[_0x8c2be[_0xec9c('0x1c')]],'as':_0x8c2be['as'],'attributes':_0x8c2be[_0xec9c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xec9c('0xb')](function(_0x55d072){logger[_0xec9c('0xc')](_0xec9c('0x15'),_0x10a975);logger[_0xec9c('0xf')](_0xec9c('0x15'),_0x10a975,JSON[_0xec9c('0x11')](_0x55d072));_0x3731ac(_0x55d072);})[_0xec9c('0x14')](function(_0x179d87){logger[_0xec9c('0x12')](_0xec9c('0x15'),_0x179d87[_0xec9c('0x13')],_0x10a975);_0x19dea2(_0xbd6b35[_0xec9c('0x12')](0x1f4,_0x179d87[_0xec9c('0x13')]));});});}; \ No newline at end of file +var _0x9768=['message','result','catch','ShowSquareOdbc','find','options','raw','where','include','map','attributes','model','then','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SquareOdbc,\x20%s,\x20%s'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x9768,0x178));var _0x8976=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x9768[_0x2e913b];return _0x173899;};'use strict';var _=require(_0x8976('0x0'));var util=require(_0x8976('0x1'));var moment=require(_0x8976('0x2'));var BPromise=require(_0x8976('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8976('0x4'));var db=require(_0x8976('0x5'))['db'];var utils=require(_0x8976('0x6'));var logger=require(_0x8976('0x7'))(_0x8976('0x8'));var config=require(_0x8976('0x9'));var jayson=require(_0x8976('0xa'));var client=jayson['client'][_0x8976('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d103e,_0x3a52ea,_0xa3e88a){return new BPromise(function(_0x5959a0,_0x380c7e){return client[_0x8976('0xc')](_0x2d103e,_0xa3e88a)['then'](function(_0x144097){logger[_0x8976('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x3a52ea,'request\x20sent');logger[_0x8976('0xe')](_0x8976('0xf'),_0x3a52ea,_0x8976('0x10'),JSON[_0x8976('0x11')](_0x144097));if(_0x144097[_0x8976('0x12')]){if(_0x144097[_0x8976('0x12')]['code']===0x1f4){logger[_0x8976('0x12')](_0x8976('0x13'),_0x3a52ea,_0x144097[_0x8976('0x12')]['message']);return _0x380c7e(_0x144097[_0x8976('0x12')][_0x8976('0x14')]);}logger[_0x8976('0x12')](_0x8976('0x13'),_0x3a52ea,_0x144097[_0x8976('0x12')][_0x8976('0x14')]);return _0x5959a0(_0x144097[_0x8976('0x12')][_0x8976('0x14')]);}else{logger['info']('SquareOdbc,\x20%s,\x20%s',_0x3a52ea,_0x8976('0x10'));_0x5959a0(_0x144097[_0x8976('0x15')][_0x8976('0x14')]);}})[_0x8976('0x16')](function(_0x46b52c){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x3a52ea,_0x46b52c);_0x380c7e(_0x46b52c);});});}exports[_0x8976('0x17')]=function(_0x127625){var _0x3864d0=this;return new Promise(function(_0x3ba71a,_0x523d31){return db['SquareOdbc'][_0x8976('0x18')]({'raw':_0x127625[_0x8976('0x19')]?_0x127625[_0x8976('0x19')][_0x8976('0x1a')]===undefined?!![]:![]:!![],'where':_0x127625[_0x8976('0x19')]?_0x127625[_0x8976('0x19')][_0x8976('0x1b')]||null:null,'attributes':_0x127625[_0x8976('0x19')]?_0x127625['options']['attributes']||null:null,'include':_0x127625['options']?_0x127625[_0x8976('0x19')][_0x8976('0x1c')]?_[_0x8976('0x1d')](_0x127625[_0x8976('0x19')][_0x8976('0x1c')],function(_0x1fe1e2){return{'model':db[_0x1fe1e2['model']],'as':_0x1fe1e2['as'],'attributes':_0x1fe1e2[_0x8976('0x1e')],'include':_0x1fe1e2[_0x8976('0x1c')]?_[_0x8976('0x1d')](_0x1fe1e2[_0x8976('0x1c')],function(_0x36d2aa){return{'model':db[_0x36d2aa[_0x8976('0x1f')]],'as':_0x36d2aa['as'],'attributes':_0x36d2aa['attributes'],'include':_0x36d2aa[_0x8976('0x1c')]?_['map'](_0x36d2aa[_0x8976('0x1c')],function(_0x4552c5){return{'model':db[_0x4552c5[_0x8976('0x1f')]],'as':_0x4552c5['as'],'attributes':_0x4552c5['attributes']};}):[]};}):[]};}):[]:[]})[_0x8976('0x20')](function(_0xd2f44c){logger['info'](_0x8976('0x17'),_0x127625);logger[_0x8976('0xe')]('ShowSquareOdbc',_0x127625,JSON['stringify'](_0xd2f44c));_0x3ba71a(_0xd2f44c);})[_0x8976('0x16')](function(_0x4bae9e){logger[_0x8976('0x12')](_0x8976('0x17'),_0x4bae9e[_0x8976('0x14')],_0x127625);_0x523d31(_0x3864d0[_0x8976('0x12')](0x1f4,_0x4bae9e[_0x8976('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 1a757e5..0f13be3 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 _0xe77c=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','index','/:id','isAuthenticated','show','/:id/users','getUsers','post','addUsers','put','destroy','removeUsers','exports'];(function(_0xe9f97c,_0x405ff0){var _0x3f6874=function(_0x325868){while(--_0x325868){_0xe9f97c['push'](_0xe9f97c['shift']());}};_0x3f6874(++_0x405ff0);}(_0xe77c,0x176));var _0xce77=function(_0x541983,_0x4eb28e){_0x541983=_0x541983-0x0;var _0x429a27=_0xe77c[_0x541983];return _0x429a27;};'use strict';var multer=require(_0xce77('0x0'));var util=require(_0xce77('0x1'));var path=require(_0xce77('0x2'));var timeout=require('connect-timeout');var express=require(_0xce77('0x3'));var router=express[_0xce77('0x4')]();var fs_extra=require(_0xce77('0x5'));var auth=require(_0xce77('0x6'));var interaction=require(_0xce77('0x7'));var config=require(_0xce77('0x8'));var controller=require(_0xce77('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xce77('0xa')]);router['get'](_0xce77('0xb'),auth[_0xce77('0xc')](),controller[_0xce77('0xd')]);router['get'](_0xce77('0xe'),auth[_0xce77('0xc')](),controller[_0xce77('0xf')]);router[_0xce77('0x10')]('/',auth[_0xce77('0xc')](),controller['create']);router[_0xce77('0x10')]('/:id/users',auth[_0xce77('0xc')](),controller[_0xce77('0x11')]);router[_0xce77('0x12')]('/:id',auth[_0xce77('0xc')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xce77('0x13')]);router['delete'](_0xce77('0xe'),auth[_0xce77('0xc')](),controller[_0xce77('0x14')]);module[_0xce77('0x15')]=router; \ No newline at end of file +var _0x8ae2=['/:id','destroy','removeUsers','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/users','getUsers','post','create','addUsers','update','delete'];(function(_0x15e485,_0x3f5c19){var _0x6076f7=function(_0x287d0){while(--_0x287d0){_0x15e485['push'](_0x15e485['shift']());}};_0x6076f7(++_0x3f5c19);}(_0x8ae2,0x143));var _0x28ae=function(_0x235e82,_0x88780b){_0x235e82=_0x235e82-0x0;var _0x3dff70=_0x8ae2[_0x235e82];return _0x3dff70;};'use strict';var multer=require(_0x28ae('0x0'));var util=require(_0x28ae('0x1'));var path=require('path');var timeout=require(_0x28ae('0x2'));var express=require('express');var router=express[_0x28ae('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x28ae('0x4'));var interaction=require(_0x28ae('0x5'));var config=require(_0x28ae('0x6'));var controller=require('./squareProject.controller');router['get']('/',auth[_0x28ae('0x7')](),controller[_0x28ae('0x8')]);router[_0x28ae('0x9')]('/:id',auth[_0x28ae('0x7')](),controller['show']);router[_0x28ae('0x9')](_0x28ae('0xa'),auth[_0x28ae('0x7')](),controller[_0x28ae('0xb')]);router[_0x28ae('0xc')]('/',auth[_0x28ae('0x7')](),controller[_0x28ae('0xd')]);router[_0x28ae('0xc')]('/:id/users',auth[_0x28ae('0x7')](),controller[_0x28ae('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x28ae('0xf')]);router[_0x28ae('0x10')](_0x28ae('0x11'),auth['isAuthenticated'](),controller[_0x28ae('0x12')]);router[_0x28ae('0x10')]('/:id/users',auth[_0x28ae('0x7')](),controller[_0x28ae('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index a4170d1..a7137c0 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 _0x0fc9=['exports','STRING','TEXT','long','getDataValue','preproduction','toString','BLOB','utf8','DATE','sequelize'];(function(_0x4b2cc6,_0x29ef43){var _0x3e0b08=function(_0x3b4131){while(--_0x3b4131){_0x4b2cc6['push'](_0x4b2cc6['shift']());}};_0x3e0b08(++_0x29ef43);}(_0x0fc9,0x15f));var _0x90fc=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0fc9[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x90fc('0x0'));module[_0x90fc('0x1')]={'name':{'type':Sequelize[_0x90fc('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x90fc('0x2')]},'notes':{'type':Sequelize[_0x90fc('0x3')]},'preproduction':{'type':Sequelize['BLOB'](_0x90fc('0x4')),'get':function(){if(this[_0x90fc('0x5')](_0x90fc('0x6'))){return this[_0x90fc('0x5')](_0x90fc('0x6'))[_0x90fc('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x90fc('0x8')](_0x90fc('0x4')),'get':function(){if(this[_0x90fc('0x5')]('production')){return this['getDataValue']('production')[_0x90fc('0x7')](_0x90fc('0x9'));}}},'savedAt':{'type':Sequelize[_0x90fc('0xa')]},'publishedAt':{'type':Sequelize[_0x90fc('0xa')]}}; \ No newline at end of file +var _0xd7f6=['exports','TEXT','long','getDataValue','preproduction','utf8','BLOB','production','toString','DATE','sequelize'];(function(_0x351f19,_0x1f599d){var _0x527c82=function(_0x56e002){while(--_0x56e002){_0x351f19['push'](_0x351f19['shift']());}};_0x527c82(++_0x1f599d);}(_0xd7f6,0x154));var _0x6d7f=function(_0x34e4ba,_0x26d912){_0x34e4ba=_0x34e4ba-0x0;var _0x41788a=_0xd7f6[_0x34e4ba];return _0x41788a;};'use strict';var Sequelize=require(_0x6d7f('0x0'));module[_0x6d7f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0x6d7f('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0x6d7f('0x3')),'get':function(){if(this[_0x6d7f('0x4')]('preproduction')){return this['getDataValue'](_0x6d7f('0x5'))['toString'](_0x6d7f('0x6'));}}},'production':{'type':Sequelize[_0x6d7f('0x7')](_0x6d7f('0x3')),'get':function(){if(this[_0x6d7f('0x4')](_0x6d7f('0x8'))){return this['getDataValue'](_0x6d7f('0x8'))[_0x6d7f('0x9')](_0x6d7f('0x6'));}}},'savedAt':{'type':Sequelize[_0x6d7f('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 2537e2e..6b09f55 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 _0xbf36=['./squareProject.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','SquareProjects','UserProfileResource','destroy','sendStatus','stack','name','send','index','SquareProject','rawAttributes','fieldName','type','key','model','map','filters','intersection','query','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','findOne','User','getUsers','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','defaults','redis','socket.io-emitter'];(function(_0x30d9e0,_0x5119a8){var _0x1b5f37=function(_0x3043ff){while(--_0x3043ff){_0x30d9e0['push'](_0x30d9e0['shift']());}};_0x1b5f37(++_0x5119a8);}(_0xbf36,0x173));var _0x6bf3=function(_0x432eb8,_0x533265){_0x432eb8=_0x432eb8-0x0;var _0x344626=_0xbf36[_0x432eb8];return _0x344626;};'use strict';var emlformat=require(_0x6bf3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6bf3('0x1'));var jsonpatch=require(_0x6bf3('0x2'));var rp=require(_0x6bf3('0x3'));var moment=require(_0x6bf3('0x4'));var BPromise=require(_0x6bf3('0x5'));var Mustache=require(_0x6bf3('0x6'));var util=require(_0x6bf3('0x7'));var path=require(_0x6bf3('0x8'));var sox=require(_0x6bf3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6bf3('0xa'));var _=require(_0x6bf3('0xb'));var squel=require(_0x6bf3('0xc'));var crypto=require('crypto');var jsforce=require(_0x6bf3('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x6bf3('0xe'));var querystring=require(_0x6bf3('0xf'));var Papa=require('papaparse');var Redis=require(_0x6bf3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6bf3('0x11'));var as=require(_0x6bf3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6bf3('0x13'))(_0x6bf3('0x14'));var utils=require(_0x6bf3('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6bf3('0x16')](config[_0x6bf3('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6bf3('0x18'))(new Redis(config[_0x6bf3('0x17')]));require(_0x6bf3('0x19'))[_0x6bf3('0x1a')](socket);function respondWithStatusCode(_0x581f9e,_0x467c8d){_0x467c8d=_0x467c8d||0xcc;return function(_0x301eea){if(_0x301eea){return _0x581f9e['sendStatus'](_0x467c8d);}return _0x581f9e[_0x6bf3('0x1b')](_0x467c8d)[_0x6bf3('0x1c')]();};}function respondWithResult(_0x4c02d1,_0x3bd923){_0x3bd923=_0x3bd923||0xc8;return function(_0x547dab){if(_0x547dab){return _0x4c02d1[_0x6bf3('0x1b')](_0x3bd923)[_0x6bf3('0x1d')](_0x547dab);}};}function respondWithFilteredResult(_0x370616,_0x50b739){return function(_0x297fac){if(_0x297fac){var _0x2d3d14=typeof _0x50b739[_0x6bf3('0x1e')]===_0x6bf3('0x1f')&&typeof _0x50b739[_0x6bf3('0x20')]===_0x6bf3('0x1f');var _0x3d3ac1=_0x297fac[_0x6bf3('0x21')];var _0x347c74=_0x2d3d14?0x0:_0x50b739[_0x6bf3('0x1e')];var _0x59cabb=_0x2d3d14?_0x297fac[_0x6bf3('0x21')]:_0x50b739[_0x6bf3('0x1e')]+_0x50b739[_0x6bf3('0x20')];var _0x28d692;if(_0x59cabb>=_0x3d3ac1){_0x59cabb=_0x3d3ac1;_0x28d692=0xc8;}else{_0x28d692=0xce;}_0x370616[_0x6bf3('0x1b')](_0x28d692);return _0x370616[_0x6bf3('0x22')](_0x6bf3('0x23'),_0x347c74+'-'+_0x59cabb+'/'+_0x3d3ac1)['json'](_0x297fac);}return null;};}function patchUpdates(_0xa3d2ce){return function(_0x13ba3b){try{jsonpatch[_0x6bf3('0x24')](_0x13ba3b,_0xa3d2ce,!![]);}catch(_0x4eb65f){return BPromise[_0x6bf3('0x25')](_0x4eb65f);}return _0x13ba3b[_0x6bf3('0x26')]();};}function saveUpdates(_0x2b63fc,_0xf7da44){return function(_0x5102e5){if(_0x5102e5){return _0x5102e5[_0x6bf3('0x27')](_0x2b63fc)[_0x6bf3('0x28')](function(_0xe47b7b){return _0xe47b7b;});}return null;};}function removeEntity(_0x14cd8f,_0x4a092f){return function(_0x1478e7){if(_0x1478e7){return _0x1478e7['destroy']()[_0x6bf3('0x28')](function(){var _0x3fa086=_0x1478e7[_0x6bf3('0x29')]({'plain':!![]});var _0xebb7a1=_0x6bf3('0x2a');return db[_0x6bf3('0x2b')][_0x6bf3('0x2c')]({'where':{'type':_0xebb7a1,'resourceId':_0x3fa086['id']}})['then'](function(){return _0x1478e7;});})['then'](function(){_0x14cd8f['status'](0xcc)[_0x6bf3('0x1c')]();});}};}function handleEntityNotFound(_0xbfe2f0,_0x1fb851){return function(_0x472c77){if(!_0x472c77){_0xbfe2f0[_0x6bf3('0x2d')](0x194);}return _0x472c77;};}function handleError(_0x59ae65,_0x562928){_0x562928=_0x562928||0x1f4;return function(_0x379d15){logger['error'](_0x379d15[_0x6bf3('0x2e')]);if(_0x379d15[_0x6bf3('0x2f')]){delete _0x379d15['name'];}_0x59ae65[_0x6bf3('0x1b')](_0x562928)[_0x6bf3('0x30')](_0x379d15);};}exports[_0x6bf3('0x31')]=function(_0x26ee3d,_0x439ae3){var _0x5826ab={},_0x396f52={},_0x25f40a={'count':0x0,'rows':[]};var _0x44d49b=_['map'](db[_0x6bf3('0x32')][_0x6bf3('0x33')],function(_0x39f83b){return{'name':_0x39f83b[_0x6bf3('0x34')],'type':_0x39f83b[_0x6bf3('0x35')][_0x6bf3('0x36')]};});_0x396f52[_0x6bf3('0x37')]=_[_0x6bf3('0x38')](_0x44d49b,'name');_0x396f52['query']=_['keys'](_0x26ee3d['query']);_0x396f52[_0x6bf3('0x39')]=_[_0x6bf3('0x3a')](_0x396f52[_0x6bf3('0x37')],_0x396f52[_0x6bf3('0x3b')]);_0x5826ab[_0x6bf3('0x3c')]=_[_0x6bf3('0x3a')](_0x396f52[_0x6bf3('0x37')],qs[_0x6bf3('0x3d')](_0x26ee3d[_0x6bf3('0x3b')][_0x6bf3('0x3d')]));_0x5826ab[_0x6bf3('0x3c')]=_0x5826ab[_0x6bf3('0x3c')][_0x6bf3('0x3e')]?_0x5826ab[_0x6bf3('0x3c')]:_0x396f52[_0x6bf3('0x37')];if(!_0x26ee3d[_0x6bf3('0x3b')]['hasOwnProperty'](_0x6bf3('0x3f'))){_0x5826ab[_0x6bf3('0x20')]=qs['limit'](_0x26ee3d[_0x6bf3('0x3b')]['limit']);_0x5826ab[_0x6bf3('0x1e')]=qs[_0x6bf3('0x1e')](_0x26ee3d['query'][_0x6bf3('0x1e')]);}_0x5826ab['order']=qs[_0x6bf3('0x40')](_0x26ee3d['query'][_0x6bf3('0x40')]);_0x5826ab[_0x6bf3('0x41')]=qs[_0x6bf3('0x39')](_[_0x6bf3('0x42')](_0x26ee3d[_0x6bf3('0x3b')],_0x396f52[_0x6bf3('0x39')]),_0x44d49b);if(_0x26ee3d[_0x6bf3('0x3b')][_0x6bf3('0x43')]){_0x5826ab[_0x6bf3('0x41')]=_[_0x6bf3('0x44')](_0x5826ab['where'],{'$or':_[_0x6bf3('0x38')](_0x44d49b,function(_0x362f1a){if(_0x362f1a[_0x6bf3('0x35')]!==_0x6bf3('0x45')){var _0x48ccfc={};_0x48ccfc[_0x362f1a[_0x6bf3('0x2f')]]={'$like':'%'+_0x26ee3d[_0x6bf3('0x3b')][_0x6bf3('0x43')]+'%'};return _0x48ccfc;}})});}_0x5826ab=_[_0x6bf3('0x44')]({},_0x5826ab,_0x26ee3d[_0x6bf3('0x46')]);var _0x16d7d4={'where':_0x5826ab['where']};return db['SquareProject'][_0x6bf3('0x21')](_0x16d7d4)[_0x6bf3('0x28')](function(_0x28d2cd){_0x25f40a[_0x6bf3('0x21')]=_0x28d2cd;if(_0x26ee3d['query'][_0x6bf3('0x47')]){_0x5826ab[_0x6bf3('0x48')]=[{'all':!![]}];}return db[_0x6bf3('0x32')][_0x6bf3('0x49')](_0x5826ab);})['then'](function(_0x5baa8f){_0x25f40a[_0x6bf3('0x4a')]=_0x5baa8f;return _0x25f40a;})[_0x6bf3('0x28')](respondWithFilteredResult(_0x439ae3,_0x5826ab))[_0x6bf3('0x4b')](handleError(_0x439ae3,null));};exports[_0x6bf3('0x4c')]=function(_0x2f2fea,_0xe5002f){var _0x6469e5={'raw':![],'where':{'id':_0x2f2fea['params']['id']}},_0x5354f8={};_0x5354f8[_0x6bf3('0x37')]=_[_0x6bf3('0x4d')](db['SquareProject'][_0x6bf3('0x33')]);_0x5354f8['query']=_[_0x6bf3('0x4d')](_0x2f2fea[_0x6bf3('0x3b')]);_0x5354f8[_0x6bf3('0x39')]=_[_0x6bf3('0x3a')](_0x5354f8[_0x6bf3('0x37')],_0x5354f8[_0x6bf3('0x3b')]);_0x6469e5['attributes']=_[_0x6bf3('0x3a')](_0x5354f8[_0x6bf3('0x37')],qs['fields'](_0x2f2fea[_0x6bf3('0x3b')][_0x6bf3('0x3d')]));_0x6469e5['attributes']=_0x6469e5[_0x6bf3('0x3c')][_0x6bf3('0x3e')]?_0x6469e5['attributes']:_0x5354f8[_0x6bf3('0x37')];if(_0x2f2fea[_0x6bf3('0x3b')]['includeAll']){_0x6469e5[_0x6bf3('0x48')]=[{'all':!![]}];}_0x6469e5=_[_0x6bf3('0x44')]({},_0x6469e5,_0x2f2fea[_0x6bf3('0x46')]);return db[_0x6bf3('0x32')][_0x6bf3('0x4e')](_0x6469e5)['then'](handleEntityNotFound(_0xe5002f,null))[_0x6bf3('0x28')](respondWithResult(_0xe5002f,null))[_0x6bf3('0x4b')](handleError(_0xe5002f,null));};exports['create']=function(_0x2846cd,_0x42fac2){return db[_0x6bf3('0x32')][_0x6bf3('0x4f')](_0x2846cd['body'],{})['then'](function(_0x13611a){var _0x10aa49=_0x2846cd[_0x6bf3('0x50')][_0x6bf3('0x29')]({'plain':!![]});if(!_0x10aa49)throw new Error(_0x6bf3('0x51'));if(_0x10aa49[_0x6bf3('0x52')]===_0x6bf3('0x50')){var _0x59219a=_0x13611a['get']({'plain':!![]});var _0x1eb385=_0x6bf3('0x2a');return db[_0x6bf3('0x53')][_0x6bf3('0x4e')]({'where':{'name':_0x1eb385,'userProfileId':_0x10aa49[_0x6bf3('0x54')]},'raw':!![]})[_0x6bf3('0x28')](function(_0x2451ac){if(_0x2451ac&&_0x2451ac['autoAssociation']===0x0){return db[_0x6bf3('0x2b')][_0x6bf3('0x4f')]({'name':_0x59219a[_0x6bf3('0x2f')],'resourceId':_0x59219a['id'],'type':_0x2451ac[_0x6bf3('0x2f')],'sectionId':_0x2451ac['id']},{})[_0x6bf3('0x28')](function(){return _0x13611a;});}else{return _0x13611a;}})[_0x6bf3('0x4b')](function(_0x529189){logger[_0x6bf3('0x55')](_0x6bf3('0x56'),_0x529189);throw _0x529189;});}return _0x13611a;})[_0x6bf3('0x28')](respondWithResult(_0x42fac2,0xc9))['catch'](handleError(_0x42fac2,null));};exports[_0x6bf3('0x27')]=function(_0x406feb,_0x18397d){if(_0x406feb[_0x6bf3('0x57')]['id']){delete _0x406feb[_0x6bf3('0x57')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x406feb[_0x6bf3('0x58')]['id']}})[_0x6bf3('0x28')](handleEntityNotFound(_0x18397d,null))[_0x6bf3('0x28')](saveUpdates(_0x406feb[_0x6bf3('0x57')],null))[_0x6bf3('0x28')](respondWithResult(_0x18397d,null))[_0x6bf3('0x4b')](handleError(_0x18397d,null));};exports['destroy']=function(_0x251a10,_0x3d8975){return db[_0x6bf3('0x32')][_0x6bf3('0x4e')]({'where':{'id':_0x251a10[_0x6bf3('0x58')]['id']}})[_0x6bf3('0x28')](handleEntityNotFound(_0x3d8975,null))[_0x6bf3('0x28')](removeEntity(_0x3d8975,null))[_0x6bf3('0x4b')](handleError(_0x3d8975,null));};exports[_0x6bf3('0x59')]=function(_0x5284c1,_0xcfd36e,_0x343a61){return db[_0x6bf3('0x32')][_0x6bf3('0x4e')]({'where':{'id':_0x5284c1['params']['id']}})[_0x6bf3('0x28')](handleEntityNotFound(_0xcfd36e,null))[_0x6bf3('0x28')](function(_0x4716a8){if(_0x4716a8){return _0x4716a8[_0x6bf3('0x59')](_0x5284c1['body'][_0x6bf3('0x5a')],_[_0x6bf3('0x5b')](_0x5284c1[_0x6bf3('0x57')],[_0x6bf3('0x5a'),'id'])||{});}})[_0x6bf3('0x28')](respondWithResult(_0xcfd36e,null))[_0x6bf3('0x4b')](handleError(_0xcfd36e,null));};exports[_0x6bf3('0x5c')]=function(_0x436de0,_0x583118,_0x20e11a){return db[_0x6bf3('0x32')][_0x6bf3('0x4e')]({'where':{'id':_0x436de0['params']['id']}})[_0x6bf3('0x28')](handleEntityNotFound(_0x583118,null))['then'](function(_0x12dd50){if(_0x12dd50){return _0x12dd50[_0x6bf3('0x5c')](_0x436de0['query'][_0x6bf3('0x5a')])[_0x6bf3('0x28')](function(){if(_[_0x6bf3('0x5d')](_0x436de0[_0x6bf3('0x3b')][_0x6bf3('0x5a')])){for(var _0x15546a=0x0;_0x15546a<_0x436de0['query'][_0x6bf3('0x5a')][_0x6bf3('0x3e')];_0x15546a+=0x1){socket[_0x6bf3('0x5e')](_0x6bf3('0x5f'),{'UserId':Number(_0x436de0[_0x6bf3('0x3b')][_0x6bf3('0x5a')][_0x15546a]),'SquareProjectId':Number(_0x436de0[_0x6bf3('0x58')]['id'])});}}else{socket[_0x6bf3('0x5e')](_0x6bf3('0x5f'),{'UserId':Number(_0x436de0[_0x6bf3('0x3b')][_0x6bf3('0x5a')]),'SquareProjectId':Number(_0x436de0[_0x6bf3('0x58')]['id'])});}});}})['then'](respondWithStatusCode(_0x583118,null))[_0x6bf3('0x4b')](handleError(_0x583118,null));};exports['getUsers']=function(_0x3c4f36,_0x43787d,_0x4bd72e){var _0x4f4516={};var _0xee5dd7={};var _0xe9f8b8;var _0x2e8c95;return db[_0x6bf3('0x32')][_0x6bf3('0x60')]({'where':{'id':_0x3c4f36['params']['id']}})[_0x6bf3('0x28')](handleEntityNotFound(_0x43787d,null))['then'](function(_0x5bb6c5){if(_0x5bb6c5){_0xe9f8b8=_0x5bb6c5;_0xee5dd7['model']=_[_0x6bf3('0x4d')](db[_0x6bf3('0x61')][_0x6bf3('0x33')]);_0xee5dd7['query']=_[_0x6bf3('0x4d')](_0x3c4f36[_0x6bf3('0x3b')]);_0xee5dd7[_0x6bf3('0x39')]=_[_0x6bf3('0x3a')](_0xee5dd7[_0x6bf3('0x37')],_0xee5dd7[_0x6bf3('0x3b')]);_0x4f4516[_0x6bf3('0x3c')]=_[_0x6bf3('0x3a')](_0xee5dd7['model'],qs[_0x6bf3('0x3d')](_0x3c4f36['query'][_0x6bf3('0x3d')]));_0x4f4516['attributes']=_0x4f4516['attributes'][_0x6bf3('0x3e')]?_0x4f4516[_0x6bf3('0x3c')]:_0xee5dd7['model'];_0x4f4516['order']=qs[_0x6bf3('0x40')](_0x3c4f36['query'][_0x6bf3('0x40')]);_0x4f4516[_0x6bf3('0x41')]=qs[_0x6bf3('0x39')](_[_0x6bf3('0x42')](_0x3c4f36['query'],_0xee5dd7['filters']));if(_0x3c4f36[_0x6bf3('0x3b')][_0x6bf3('0x43')]){_0x4f4516[_0x6bf3('0x41')]=_[_0x6bf3('0x44')](_0x4f4516[_0x6bf3('0x41')],{'$or':_[_0x6bf3('0x38')](_0x4f4516[_0x6bf3('0x3c')],function(_0x45693b){var _0x26f6e0={};_0x26f6e0[_0x45693b]={'$like':'%'+_0x3c4f36[_0x6bf3('0x3b')][_0x6bf3('0x43')]+'%'};return _0x26f6e0;})});}_0x4f4516=_[_0x6bf3('0x44')]({},_0x4f4516,_0x3c4f36[_0x6bf3('0x46')]);return _0xe9f8b8[_0x6bf3('0x62')](_0x4f4516);}})[_0x6bf3('0x28')](function(_0x5d5105){if(_0x5d5105){_0x2e8c95=_0x5d5105['length'];if(!_0x3c4f36['query']['hasOwnProperty']('nolimit')){_0x4f4516[_0x6bf3('0x20')]=qs[_0x6bf3('0x20')](_0x3c4f36['query'][_0x6bf3('0x20')]);_0x4f4516[_0x6bf3('0x1e')]=qs[_0x6bf3('0x1e')](_0x3c4f36[_0x6bf3('0x3b')][_0x6bf3('0x1e')]);}return _0xe9f8b8[_0x6bf3('0x62')](_0x4f4516);}})['then'](function(_0x254151){if(_0x254151){return _0x254151?{'count':_0x2e8c95,'rows':_0x254151}:null;}})[_0x6bf3('0x28')](respondWithResult(_0x43787d,null))[_0x6bf3('0x4b')](handleError(_0x43787d,null));}; \ No newline at end of file +var _0xb153=['request-promise','bluebird','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','./squareProject.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','get','SquareProjects','UserProfileResource','error','stack','name','send','index','map','SquareProject','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','catch','rawAttributes','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','autoAssociation','body','params','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','order','pick','zip-dir','fast-json-patch'];(function(_0x2e333b,_0x37da2b){var _0x36d785=function(_0x37af0b){while(--_0x37af0b){_0x2e333b['push'](_0x2e333b['shift']());}};_0x36d785(++_0x37da2b);}(_0xb153,0x10f));var _0x3b15=function(_0x5d568c,_0x1e50c0){_0x5d568c=_0x5d568c-0x0;var _0x3f49b9=_0xb153[_0x5d568c];return _0x3f49b9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3b15('0x0'));var jsonpatch=require(_0x3b15('0x1'));var rp=require(_0x3b15('0x2'));var moment=require('moment');var BPromise=require(_0x3b15('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b15('0x4'));var _=require(_0x3b15('0x5'));var squel=require(_0x3b15('0x6'));var crypto=require(_0x3b15('0x7'));var jsforce=require(_0x3b15('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x3b15('0x9'));var Papa=require(_0x3b15('0xa'));var Redis=require(_0x3b15('0xb'));var authService=require(_0x3b15('0xc'));var qs=require(_0x3b15('0xd'));var as=require(_0x3b15('0xe'));var hardwareService=require(_0x3b15('0xf'));var logger=require(_0x3b15('0x10'))(_0x3b15('0x11'));var utils=require(_0x3b15('0x12'));var config=require(_0x3b15('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b15('0x14'))['db'];config['redis']=_[_0x3b15('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3b15('0x16'))(new Redis(config[_0x3b15('0x17')]));require(_0x3b15('0x18'))[_0x3b15('0x19')](socket);function respondWithStatusCode(_0x4c0fdc,_0x13d734){_0x13d734=_0x13d734||0xcc;return function(_0xdc1d04){if(_0xdc1d04){return _0x4c0fdc[_0x3b15('0x1a')](_0x13d734);}return _0x4c0fdc[_0x3b15('0x1b')](_0x13d734)[_0x3b15('0x1c')]();};}function respondWithResult(_0x4ea6d6,_0x542582){_0x542582=_0x542582||0xc8;return function(_0x3c06bb){if(_0x3c06bb){return _0x4ea6d6[_0x3b15('0x1b')](_0x542582)[_0x3b15('0x1d')](_0x3c06bb);}};}function respondWithFilteredResult(_0x5df6b4,_0x29433a){return function(_0x20cda9){if(_0x20cda9){var _0x11e495=typeof _0x29433a[_0x3b15('0x1e')]==='undefined'&&typeof _0x29433a[_0x3b15('0x1f')]===_0x3b15('0x20');var _0x90ef80=_0x20cda9[_0x3b15('0x21')];var _0x115ef4=_0x11e495?0x0:_0x29433a['offset'];var _0x462d9d=_0x11e495?_0x20cda9[_0x3b15('0x21')]:_0x29433a[_0x3b15('0x1e')]+_0x29433a[_0x3b15('0x1f')];var _0x15e216;if(_0x462d9d>=_0x90ef80){_0x462d9d=_0x90ef80;_0x15e216=0xc8;}else{_0x15e216=0xce;}_0x5df6b4[_0x3b15('0x1b')](_0x15e216);return _0x5df6b4[_0x3b15('0x22')](_0x3b15('0x23'),_0x115ef4+'-'+_0x462d9d+'/'+_0x90ef80)[_0x3b15('0x1d')](_0x20cda9);}return null;};}function patchUpdates(_0x1a9ae9){return function(_0x16d0aa){try{jsonpatch[_0x3b15('0x24')](_0x16d0aa,_0x1a9ae9,!![]);}catch(_0x4e1b4f){return BPromise['reject'](_0x4e1b4f);}return _0x16d0aa[_0x3b15('0x25')]();};}function saveUpdates(_0x567bd2,_0x17358c){return function(_0x79fe90){if(_0x79fe90){return _0x79fe90[_0x3b15('0x26')](_0x567bd2)[_0x3b15('0x27')](function(_0x41c4db){return _0x41c4db;});}return null;};}function removeEntity(_0x488180,_0x21ab7a){return function(_0x331454){if(_0x331454){return _0x331454[_0x3b15('0x28')]()[_0x3b15('0x27')](function(){var _0x1e3c0f=_0x331454[_0x3b15('0x29')]({'plain':!![]});var _0x123df2=_0x3b15('0x2a');return db[_0x3b15('0x2b')][_0x3b15('0x28')]({'where':{'type':_0x123df2,'resourceId':_0x1e3c0f['id']}})[_0x3b15('0x27')](function(){return _0x331454;});})['then'](function(){_0x488180['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d779e,_0x3d033c){return function(_0x14f354){if(!_0x14f354){_0x3d779e[_0x3b15('0x1a')](0x194);}return _0x14f354;};}function handleError(_0x194edb,_0x590f38){_0x590f38=_0x590f38||0x1f4;return function(_0x354a5d){logger[_0x3b15('0x2c')](_0x354a5d[_0x3b15('0x2d')]);if(_0x354a5d['name']){delete _0x354a5d[_0x3b15('0x2e')];}_0x194edb[_0x3b15('0x1b')](_0x590f38)[_0x3b15('0x2f')](_0x354a5d);};}exports[_0x3b15('0x30')]=function(_0xaacf1e,_0xe04924){var _0x38a7d4={},_0x7b4001={},_0x45eeb4={'count':0x0,'rows':[]};var _0x3b2bcf=_[_0x3b15('0x31')](db[_0x3b15('0x32')]['rawAttributes'],function(_0x1fde9f){return{'name':_0x1fde9f[_0x3b15('0x33')],'type':_0x1fde9f[_0x3b15('0x34')]['key']};});_0x7b4001['model']=_[_0x3b15('0x31')](_0x3b2bcf,_0x3b15('0x2e'));_0x7b4001[_0x3b15('0x35')]=_[_0x3b15('0x36')](_0xaacf1e['query']);_0x7b4001['filters']=_[_0x3b15('0x37')](_0x7b4001[_0x3b15('0x38')],_0x7b4001['query']);_0x38a7d4['attributes']=_[_0x3b15('0x37')](_0x7b4001['model'],qs[_0x3b15('0x39')](_0xaacf1e[_0x3b15('0x35')][_0x3b15('0x39')]));_0x38a7d4[_0x3b15('0x3a')]=_0x38a7d4['attributes'][_0x3b15('0x3b')]?_0x38a7d4[_0x3b15('0x3a')]:_0x7b4001[_0x3b15('0x38')];if(!_0xaacf1e[_0x3b15('0x35')][_0x3b15('0x3c')](_0x3b15('0x3d'))){_0x38a7d4['limit']=qs[_0x3b15('0x1f')](_0xaacf1e['query'][_0x3b15('0x1f')]);_0x38a7d4[_0x3b15('0x1e')]=qs[_0x3b15('0x1e')](_0xaacf1e[_0x3b15('0x35')][_0x3b15('0x1e')]);}_0x38a7d4['order']=qs[_0x3b15('0x3e')](_0xaacf1e[_0x3b15('0x35')][_0x3b15('0x3e')]);_0x38a7d4['where']=qs['filters'](_['pick'](_0xaacf1e[_0x3b15('0x35')],_0x7b4001[_0x3b15('0x3f')]),_0x3b2bcf);if(_0xaacf1e[_0x3b15('0x35')][_0x3b15('0x40')]){_0x38a7d4[_0x3b15('0x41')]=_[_0x3b15('0x42')](_0x38a7d4['where'],{'$or':_[_0x3b15('0x31')](_0x3b2bcf,function(_0x170120){if(_0x170120['type']!==_0x3b15('0x43')){var _0x45a273={};_0x45a273[_0x170120['name']]={'$like':'%'+_0xaacf1e[_0x3b15('0x35')][_0x3b15('0x40')]+'%'};return _0x45a273;}})});}_0x38a7d4=_['merge']({},_0x38a7d4,_0xaacf1e[_0x3b15('0x44')]);var _0x26f519={'where':_0x38a7d4[_0x3b15('0x41')]};return db[_0x3b15('0x32')]['count'](_0x26f519)[_0x3b15('0x27')](function(_0x11b52b){_0x45eeb4[_0x3b15('0x21')]=_0x11b52b;if(_0xaacf1e[_0x3b15('0x35')]['includeAll']){_0x38a7d4['include']=[{'all':!![]}];}return db[_0x3b15('0x32')]['findAll'](_0x38a7d4);})[_0x3b15('0x27')](function(_0x2cfef9){_0x45eeb4['rows']=_0x2cfef9;return _0x45eeb4;})[_0x3b15('0x27')](respondWithFilteredResult(_0xe04924,_0x38a7d4))[_0x3b15('0x45')](handleError(_0xe04924,null));};exports['show']=function(_0x1a890e,_0x232654){var _0x4ef4a1={'raw':![],'where':{'id':_0x1a890e['params']['id']}},_0x101ac8={};_0x101ac8[_0x3b15('0x38')]=_[_0x3b15('0x36')](db['SquareProject'][_0x3b15('0x46')]);_0x101ac8[_0x3b15('0x35')]=_[_0x3b15('0x36')](_0x1a890e['query']);_0x101ac8[_0x3b15('0x3f')]=_[_0x3b15('0x37')](_0x101ac8[_0x3b15('0x38')],_0x101ac8[_0x3b15('0x35')]);_0x4ef4a1['attributes']=_[_0x3b15('0x37')](_0x101ac8[_0x3b15('0x38')],qs[_0x3b15('0x39')](_0x1a890e[_0x3b15('0x35')]['fields']));_0x4ef4a1[_0x3b15('0x3a')]=_0x4ef4a1[_0x3b15('0x3a')]['length']?_0x4ef4a1['attributes']:_0x101ac8['model'];if(_0x1a890e[_0x3b15('0x35')][_0x3b15('0x47')]){_0x4ef4a1[_0x3b15('0x48')]=[{'all':!![]}];}_0x4ef4a1=_[_0x3b15('0x42')]({},_0x4ef4a1,_0x1a890e[_0x3b15('0x44')]);return db['SquareProject']['find'](_0x4ef4a1)[_0x3b15('0x27')](handleEntityNotFound(_0x232654,null))['then'](respondWithResult(_0x232654,null))[_0x3b15('0x45')](handleError(_0x232654,null));};exports['create']=function(_0x344fd3,_0x2ec643){return db[_0x3b15('0x32')][_0x3b15('0x49')](_0x344fd3['body'],{})[_0x3b15('0x27')](function(_0x44b9f8){var _0x47903f=_0x344fd3[_0x3b15('0x4a')][_0x3b15('0x29')]({'plain':!![]});if(!_0x47903f)throw new Error(_0x3b15('0x4b'));if(_0x47903f['role']==='user'){var _0x2b9eb2=_0x44b9f8[_0x3b15('0x29')]({'plain':!![]});var _0x385f2e='SquareProjects';return db['UserProfileSection'][_0x3b15('0x4c')]({'where':{'name':_0x385f2e,'userProfileId':_0x47903f['userProfileId']},'raw':!![]})['then'](function(_0x4616cb){if(_0x4616cb&&_0x4616cb[_0x3b15('0x4d')]===0x0){return db[_0x3b15('0x2b')][_0x3b15('0x49')]({'name':_0x2b9eb2[_0x3b15('0x2e')],'resourceId':_0x2b9eb2['id'],'type':_0x4616cb['name'],'sectionId':_0x4616cb['id']},{})[_0x3b15('0x27')](function(){return _0x44b9f8;});}else{return _0x44b9f8;}})[_0x3b15('0x45')](function(_0x215cd6){logger[_0x3b15('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x215cd6);throw _0x215cd6;});}return _0x44b9f8;})[_0x3b15('0x27')](respondWithResult(_0x2ec643,0xc9))[_0x3b15('0x45')](handleError(_0x2ec643,null));};exports[_0x3b15('0x26')]=function(_0x50a2bd,_0x780491){if(_0x50a2bd[_0x3b15('0x4e')]['id']){delete _0x50a2bd[_0x3b15('0x4e')]['id'];}return db[_0x3b15('0x32')][_0x3b15('0x4c')]({'where':{'id':_0x50a2bd['params']['id']}})['then'](handleEntityNotFound(_0x780491,null))[_0x3b15('0x27')](saveUpdates(_0x50a2bd['body'],null))[_0x3b15('0x27')](respondWithResult(_0x780491,null))['catch'](handleError(_0x780491,null));};exports[_0x3b15('0x28')]=function(_0x538179,_0x33becc){return db[_0x3b15('0x32')][_0x3b15('0x4c')]({'where':{'id':_0x538179[_0x3b15('0x4f')]['id']}})[_0x3b15('0x27')](handleEntityNotFound(_0x33becc,null))[_0x3b15('0x27')](removeEntity(_0x33becc,null))['catch'](handleError(_0x33becc,null));};exports[_0x3b15('0x50')]=function(_0x2ffb50,_0x3541fe,_0x434b6c){return db['SquareProject'][_0x3b15('0x4c')]({'where':{'id':_0x2ffb50[_0x3b15('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3541fe,null))[_0x3b15('0x27')](function(_0x18418c){if(_0x18418c){return _0x18418c[_0x3b15('0x50')](_0x2ffb50['body'][_0x3b15('0x51')],_[_0x3b15('0x52')](_0x2ffb50['body'],[_0x3b15('0x51'),'id'])||{});}})[_0x3b15('0x27')](respondWithResult(_0x3541fe,null))[_0x3b15('0x45')](handleError(_0x3541fe,null));};exports[_0x3b15('0x53')]=function(_0x5702bd,_0x4b9e58,_0x454bcb){return db['SquareProject'][_0x3b15('0x4c')]({'where':{'id':_0x5702bd[_0x3b15('0x4f')]['id']}})[_0x3b15('0x27')](handleEntityNotFound(_0x4b9e58,null))['then'](function(_0x50925c){if(_0x50925c){return _0x50925c['removeUsers'](_0x5702bd[_0x3b15('0x35')]['ids'])[_0x3b15('0x27')](function(){if(_[_0x3b15('0x54')](_0x5702bd['query'][_0x3b15('0x51')])){for(var _0x6f3203=0x0;_0x6f3203<_0x5702bd['query'][_0x3b15('0x51')]['length'];_0x6f3203+=0x1){socket[_0x3b15('0x55')]('userSquareProject:remove',{'UserId':Number(_0x5702bd[_0x3b15('0x35')]['ids'][_0x6f3203]),'SquareProjectId':Number(_0x5702bd[_0x3b15('0x4f')]['id'])});}}else{socket[_0x3b15('0x55')](_0x3b15('0x56'),{'UserId':Number(_0x5702bd[_0x3b15('0x35')][_0x3b15('0x51')]),'SquareProjectId':Number(_0x5702bd[_0x3b15('0x4f')]['id'])});}});}})[_0x3b15('0x27')](respondWithStatusCode(_0x4b9e58,null))[_0x3b15('0x45')](handleError(_0x4b9e58,null));};exports[_0x3b15('0x57')]=function(_0x3874be,_0x35a17e,_0x25ba0a){var _0x37d0c4={};var _0x451ad9={};var _0x35e05b;var _0xa53f;return db['SquareProject'][_0x3b15('0x58')]({'where':{'id':_0x3874be['params']['id']}})['then'](handleEntityNotFound(_0x35a17e,null))[_0x3b15('0x27')](function(_0x163c09){if(_0x163c09){_0x35e05b=_0x163c09;_0x451ad9['model']=_['keys'](db['User'][_0x3b15('0x46')]);_0x451ad9[_0x3b15('0x35')]=_[_0x3b15('0x36')](_0x3874be['query']);_0x451ad9[_0x3b15('0x3f')]=_['intersection'](_0x451ad9[_0x3b15('0x38')],_0x451ad9['query']);_0x37d0c4[_0x3b15('0x3a')]=_[_0x3b15('0x37')](_0x451ad9[_0x3b15('0x38')],qs[_0x3b15('0x39')](_0x3874be[_0x3b15('0x35')]['fields']));_0x37d0c4[_0x3b15('0x3a')]=_0x37d0c4['attributes']['length']?_0x37d0c4[_0x3b15('0x3a')]:_0x451ad9[_0x3b15('0x38')];_0x37d0c4[_0x3b15('0x59')]=qs[_0x3b15('0x3e')](_0x3874be[_0x3b15('0x35')]['sort']);_0x37d0c4['where']=qs[_0x3b15('0x3f')](_[_0x3b15('0x5a')](_0x3874be[_0x3b15('0x35')],_0x451ad9[_0x3b15('0x3f')]));if(_0x3874be[_0x3b15('0x35')][_0x3b15('0x40')]){_0x37d0c4[_0x3b15('0x41')]=_[_0x3b15('0x42')](_0x37d0c4['where'],{'$or':_[_0x3b15('0x31')](_0x37d0c4[_0x3b15('0x3a')],function(_0xb3b270){var _0x6cfbbf={};_0x6cfbbf[_0xb3b270]={'$like':'%'+_0x3874be['query'][_0x3b15('0x40')]+'%'};return _0x6cfbbf;})});}_0x37d0c4=_[_0x3b15('0x42')]({},_0x37d0c4,_0x3874be[_0x3b15('0x44')]);return _0x35e05b[_0x3b15('0x57')](_0x37d0c4);}})[_0x3b15('0x27')](function(_0x1665fe){if(_0x1665fe){_0xa53f=_0x1665fe['length'];if(!_0x3874be['query'][_0x3b15('0x3c')](_0x3b15('0x3d'))){_0x37d0c4[_0x3b15('0x1f')]=qs[_0x3b15('0x1f')](_0x3874be[_0x3b15('0x35')][_0x3b15('0x1f')]);_0x37d0c4[_0x3b15('0x1e')]=qs[_0x3b15('0x1e')](_0x3874be['query']['offset']);}return _0x35e05b[_0x3b15('0x57')](_0x37d0c4);}})[_0x3b15('0x27')](function(_0x152316){if(_0x152316){return _0x152316?{'count':_0xa53f,'rows':_0x152316}:null;}})[_0x3b15('0x27')](respondWithResult(_0x35a17e,null))[_0x3b15('0x45')](handleError(_0x35a17e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index d151844..be5f802 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 _0x38ba=['exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit'];(function(_0x39ea4a,_0x5c4505){var _0x13ac51=function(_0x55352f){while(--_0x55352f){_0x39ea4a['push'](_0x39ea4a['shift']());}};_0x13ac51(++_0x5c4505);}(_0x38ba,0x160));var _0xa38b=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x38ba[_0x4de1b1];return _0x639f27;};'use strict';var EventEmitter=require(_0xa38b('0x0'));var SquareProject=require(_0xa38b('0x1'))['db'][_0xa38b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa38b('0x3')](0x0);var events={'afterCreate':_0xa38b('0x4'),'afterUpdate':_0xa38b('0x5'),'afterDestroy':_0xa38b('0x6')};function emitEvent(_0x10fc53){return function(_0x1b1da8,_0xae0cd2,_0x10f94f){SquareProjectEvents[_0xa38b('0x7')](_0x10fc53+':'+_0x1b1da8['id'],_0x1b1da8);SquareProjectEvents[_0xa38b('0x7')](_0x10fc53,_0x1b1da8);_0x10f94f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xa38b('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xd803=['remove','emit','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x154a48,_0xd8989b){var _0x54ca0b=function(_0xa97a56){while(--_0xa97a56){_0x154a48['push'](_0x154a48['shift']());}};_0x54ca0b(++_0xd8989b);}(_0xd803,0x9c));var _0x3d80=function(_0x4142c4,_0x38c73e){_0x4142c4=_0x4142c4-0x0;var _0x21f32c=_0xd803[_0x4142c4];return _0x21f32c;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x3d80('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x3d80('0x1')](0x0);var events={'afterCreate':_0x3d80('0x2'),'afterUpdate':_0x3d80('0x3'),'afterDestroy':_0x3d80('0x4')};function emitEvent(_0x5a1190){return function(_0x969779,_0x4c4496,_0x1f8cca){SquareProjectEvents[_0x3d80('0x5')](_0x5a1190+':'+_0x969779['id'],_0x969779);SquareProjectEvents[_0x3d80('0x5')](_0x5a1190,_0x969779);_0x1f8cca(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x3d80('0x6')](e,emitEvent(event));}}module[_0x3d80('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 2e5e3eb..1581110 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 _0x5125=['define','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','changed','production','publishedAt','format','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports'];(function(_0x380505,_0x4dea92){var _0x5c9447=function(_0x12e6ad){while(--_0x12e6ad){_0x380505['push'](_0x380505['shift']());}};_0x5c9447(++_0x4dea92);}(_0x5125,0xf2));var _0x5512=function(_0x5a6fee,_0x1de8d1){_0x5a6fee=_0x5a6fee-0x0;var _0x1c8c42=_0x5125[_0x5a6fee];return _0x1c8c42;};'use strict';var _=require('lodash');var util=require(_0x5512('0x0'));var logger=require(_0x5512('0x1'))(_0x5512('0x2'));var moment=require('moment');var BPromise=require(_0x5512('0x3'));var rp=require(_0x5512('0x4'));var fs=require('fs');var path=require(_0x5512('0x5'));var rimraf=require(_0x5512('0x6'));var config=require(_0x5512('0x7'));var attributes=require(_0x5512('0x8'));module[_0x5512('0x9')]=function(_0x4abb26,_0x74ea89){return _0x4abb26[_0x5512('0xa')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a7fa5,_0x8f9498,_0x2f6b3e){if(_0x1a7fa5['changed'](_0x5512('0xb'))){_0x1a7fa5[_0x5512('0xc')]=moment()['format'](_0x5512('0xd'));}if(_0x1a7fa5[_0x5512('0xe')](_0x5512('0xf'))){_0x1a7fa5[_0x5512('0x10')]=moment()[_0x5512('0x11')](_0x5512('0xd'));}_0x2f6b3e(null,_0x1a7fa5);}}});}; \ No newline at end of file +var _0x188d=['YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareProject.attributes','exports','SquareProject','square_projects','changed','publishedAt','format'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x188d,0x171));var _0xd188=function(_0xb301d4,_0x27ed18){_0xb301d4=_0xb301d4-0x0;var _0x3b5bde=_0x188d[_0xb301d4];return _0x3b5bde;};'use strict';var _=require(_0xd188('0x0'));var util=require('util');var logger=require(_0xd188('0x1'))(_0xd188('0x2'));var moment=require(_0xd188('0x3'));var BPromise=require(_0xd188('0x4'));var rp=require(_0xd188('0x5'));var fs=require('fs');var path=require(_0xd188('0x6'));var rimraf=require(_0xd188('0x7'));var config=require('../../config/environment');var attributes=require(_0xd188('0x8'));module[_0xd188('0x9')]=function(_0x28a333,_0x16f465){return _0x28a333['define'](_0xd188('0xa'),attributes,{'tableName':_0xd188('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34db04,_0x1841a1,_0x5a8a3a){if(_0x34db04[_0xd188('0xc')]('preproduction')){_0x34db04['savedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x34db04[_0xd188('0xc')]('production')){_0x34db04[_0xd188('0xd')]=moment()[_0xd188('0xe')](_0xd188('0xf'));}_0x5a8a3a(null,_0x34db04);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 386cc7c..91621c4 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 _0xcd7e=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','options','raw','where','attributes','include','map','model'];(function(_0x34e44b,_0x484ffc){var _0x2420b5=function(_0x18ba7c){while(--_0x18ba7c){_0x34e44b['push'](_0x34e44b['shift']());}};_0x2420b5(++_0x484ffc);}(_0xcd7e,0x118));var _0xecd7=function(_0x2c1e7a,_0x155f86){_0x2c1e7a=_0x2c1e7a-0x0;var _0xcacb4f=_0xcd7e[_0x2c1e7a];return _0xcacb4f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xecd7('0x0'));var BPromise=require(_0xecd7('0x1'));var rs=require(_0xecd7('0x2'));var fs=require('fs');var Redis=require(_0xecd7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecd7('0x4'))(_0xecd7('0x5'));var config=require(_0xecd7('0x6'));var jayson=require(_0xecd7('0x7'));var client=jayson[_0xecd7('0x8')][_0xecd7('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xecd7('0xa'),'port':0x18eb});var socket=require(_0xecd7('0xb'))(new Redis(config[_0xecd7('0xc')]));require('./squareProject.socket')['register'](socket);function respondWithRpcPromise(_0xb76cbf,_0x38cca9,_0x49593c){return new BPromise(function(_0x31e968,_0x187f5c){return client[_0xecd7('0xd')](_0xb76cbf,_0x49593c)[_0xecd7('0xe')](function(_0x9972ac){logger[_0xecd7('0xf')](_0xecd7('0x10'),_0x38cca9,_0xecd7('0x11'));logger[_0xecd7('0x12')](_0xecd7('0x13'),_0x38cca9,_0xecd7('0x11'),JSON[_0xecd7('0x14')](_0x9972ac));if(_0x9972ac['error']){if(_0x9972ac[_0xecd7('0x15')][_0xecd7('0x16')]===0x1f4){logger[_0xecd7('0x15')]('SquareProject,\x20%s,\x20%s',_0x38cca9,_0x9972ac[_0xecd7('0x15')]['message']);return _0x187f5c(_0x9972ac[_0xecd7('0x15')][_0xecd7('0x17')]);}logger[_0xecd7('0x15')](_0xecd7('0x10'),_0x38cca9,_0x9972ac[_0xecd7('0x15')][_0xecd7('0x17')]);return _0x31e968(_0x9972ac[_0xecd7('0x15')][_0xecd7('0x17')]);}else{logger[_0xecd7('0xf')](_0xecd7('0x10'),_0x38cca9,'request\x20sent');_0x31e968(_0x9972ac[_0xecd7('0x18')][_0xecd7('0x17')]);}})[_0xecd7('0x19')](function(_0x2e7fcb){logger[_0xecd7('0x15')](_0xecd7('0x10'),_0x38cca9,_0x2e7fcb);_0x187f5c(_0x2e7fcb);});});}exports[_0xecd7('0x1a')]=function(_0x5178fa){var _0x341716=this;return new Promise(function(_0x26c34c,_0x57816b){return db[_0xecd7('0x1b')]['find']({'raw':_0x5178fa[_0xecd7('0x1c')]?_0x5178fa[_0xecd7('0x1c')][_0xecd7('0x1d')]===undefined?!![]:![]:!![],'where':_0x5178fa[_0xecd7('0x1c')]?_0x5178fa[_0xecd7('0x1c')][_0xecd7('0x1e')]||null:null,'attributes':_0x5178fa[_0xecd7('0x1c')]?_0x5178fa[_0xecd7('0x1c')][_0xecd7('0x1f')]||null:null,'include':_0x5178fa[_0xecd7('0x1c')]?_0x5178fa['options'][_0xecd7('0x20')]?_[_0xecd7('0x21')](_0x5178fa[_0xecd7('0x1c')][_0xecd7('0x20')],function(_0x565c53){return{'model':db[_0x565c53[_0xecd7('0x22')]],'as':_0x565c53['as'],'attributes':_0x565c53['attributes'],'include':_0x565c53[_0xecd7('0x20')]?_[_0xecd7('0x21')](_0x565c53[_0xecd7('0x20')],function(_0xb02571){return{'model':db[_0xb02571[_0xecd7('0x22')]],'as':_0xb02571['as'],'attributes':_0xb02571['attributes'],'include':_0xb02571[_0xecd7('0x20')]?_[_0xecd7('0x21')](_0xb02571[_0xecd7('0x20')],function(_0xf45a6e){return{'model':db[_0xf45a6e[_0xecd7('0x22')]],'as':_0xf45a6e['as'],'attributes':_0xf45a6e['attributes']};}):[]};}):[]};}):[]:[]})[_0xecd7('0xe')](function(_0x3d1f1b){logger[_0xecd7('0xf')](_0xecd7('0x1a'),_0x5178fa);logger['debug']('ShowSquareProject',_0x5178fa,JSON[_0xecd7('0x14')](_0x3d1f1b));_0x26c34c(_0x3d1f1b);})[_0xecd7('0x19')](function(_0x208471){logger['error']('ShowSquareProject',_0x208471[_0xecd7('0x17')],_0x5178fa);_0x57816b(_0x341716[_0xecd7('0x15')](0x1f4,_0x208471[_0xecd7('0x17')]));});});}; \ No newline at end of file +var _0x161f=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./squareProject.socket','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSquareProject','SquareProject','options','raw','where','attributes','map','model','include','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x161f,0x19e));var _0xf161=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x161f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xf161('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf161('0x1'));var rs=require(_0xf161('0x2'));var fs=require('fs');var Redis=require(_0xf161('0x3'));var db=require(_0xf161('0x4'))['db'];var utils=require(_0xf161('0x5'));var logger=require(_0xf161('0x6'))(_0xf161('0x7'));var config=require(_0xf161('0x8'));var jayson=require(_0xf161('0x9'));var client=jayson[_0xf161('0xa')][_0xf161('0xb')]({'port':0x232a});config[_0xf161('0xc')]=_[_0xf161('0xd')](config[_0xf161('0xc')],{'host':_0xf161('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf161('0xc')]));require(_0xf161('0xf'))['register'](socket);function respondWithRpcPromise(_0x2eff4c,_0x28df09,_0x2fbe36){return new BPromise(function(_0x53c928,_0x1bf8ce){return client['request'](_0x2eff4c,_0x2fbe36)[_0xf161('0x10')](function(_0x3217ac){logger[_0xf161('0x11')](_0xf161('0x12'),_0x28df09,_0xf161('0x13'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x28df09,_0xf161('0x13'),JSON[_0xf161('0x14')](_0x3217ac));if(_0x3217ac[_0xf161('0x15')]){if(_0x3217ac[_0xf161('0x15')][_0xf161('0x16')]===0x1f4){logger[_0xf161('0x15')](_0xf161('0x12'),_0x28df09,_0x3217ac['error'][_0xf161('0x17')]);return _0x1bf8ce(_0x3217ac['error'][_0xf161('0x17')]);}logger[_0xf161('0x15')]('SquareProject,\x20%s,\x20%s',_0x28df09,_0x3217ac[_0xf161('0x15')]['message']);return _0x53c928(_0x3217ac[_0xf161('0x15')][_0xf161('0x17')]);}else{logger[_0xf161('0x11')]('SquareProject,\x20%s,\x20%s',_0x28df09,_0xf161('0x13'));_0x53c928(_0x3217ac[_0xf161('0x18')][_0xf161('0x17')]);}})[_0xf161('0x19')](function(_0x8c1259){logger[_0xf161('0x15')](_0xf161('0x12'),_0x28df09,_0x8c1259);_0x1bf8ce(_0x8c1259);});});}exports[_0xf161('0x1a')]=function(_0x281772){var _0x5f15a0=this;return new Promise(function(_0xbe4d95,_0x1ba229){return db[_0xf161('0x1b')]['find']({'raw':_0x281772[_0xf161('0x1c')]?_0x281772[_0xf161('0x1c')][_0xf161('0x1d')]===undefined?!![]:![]:!![],'where':_0x281772[_0xf161('0x1c')]?_0x281772['options'][_0xf161('0x1e')]||null:null,'attributes':_0x281772[_0xf161('0x1c')]?_0x281772[_0xf161('0x1c')][_0xf161('0x1f')]||null:null,'include':_0x281772[_0xf161('0x1c')]?_0x281772[_0xf161('0x1c')]['include']?_[_0xf161('0x20')](_0x281772['options']['include'],function(_0x1f69f6){return{'model':db[_0x1f69f6[_0xf161('0x21')]],'as':_0x1f69f6['as'],'attributes':_0x1f69f6[_0xf161('0x1f')],'include':_0x1f69f6[_0xf161('0x22')]?_[_0xf161('0x20')](_0x1f69f6[_0xf161('0x22')],function(_0x1eb2ab){return{'model':db[_0x1eb2ab[_0xf161('0x21')]],'as':_0x1eb2ab['as'],'attributes':_0x1eb2ab['attributes'],'include':_0x1eb2ab['include']?_[_0xf161('0x20')](_0x1eb2ab[_0xf161('0x22')],function(_0x103d77){return{'model':db[_0x103d77[_0xf161('0x21')]],'as':_0x103d77['as'],'attributes':_0x103d77[_0xf161('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf161('0x10')](function(_0x3f9e67){logger[_0xf161('0x11')](_0xf161('0x1a'),_0x281772);logger['debug']('ShowSquareProject',_0x281772,JSON[_0xf161('0x14')](_0x3f9e67));_0xbe4d95(_0x3f9e67);})['catch'](function(_0x5de841){logger[_0xf161('0x15')]('ShowSquareProject',_0x5de841[_0xf161('0x17')],_0x281772);_0x1ba229(_0x5f15a0[_0xf161('0x15')](0x1f4,_0x5de841['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index c51ecea..0faba5b 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 _0x691e=['update','emit','register','length','squareProject:','save'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x691e,0xb3));var _0xe691=function(_0x32fb61,_0x1a7b01){_0x32fb61=_0x32fb61-0x0;var _0x513b74=_0x691e[_0x32fb61];return _0x513b74;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xe691('0x0'),'remove',_0xe691('0x1')];function createListener(_0x42dea4,_0x5b5b6e){return function(_0x38386b){_0x5b5b6e[_0xe691('0x2')](_0x42dea4,_0x38386b);};}function removeListener(_0x164f2e,_0x4f162c){return function(){SquareProjectEvents['removeListener'](_0x164f2e,_0x4f162c);};}exports[_0xe691('0x3')]=function(_0x4651df){for(var _0x38169c=0x0,_0x3f832f=events[_0xe691('0x4')];_0x38169c<_0x3f832f;_0x38169c++){var _0x325f94=events[_0x38169c];var _0x3bb841=createListener(_0xe691('0x5')+_0x325f94,_0x4651df);SquareProjectEvents['on'](_0x325f94,_0x3bb841);}}; \ No newline at end of file +var _0xca0e=['length','squareProject:','./squareProject.events','save','remove','update','emit','register'];(function(_0xb0ef6,_0x53cd27){var _0x30a8ff=function(_0x1df3c3){while(--_0x1df3c3){_0xb0ef6['push'](_0xb0ef6['shift']());}};_0x30a8ff(++_0x53cd27);}(_0xca0e,0xaa));var _0xeca0=function(_0x5a6199,_0x316a60){_0x5a6199=_0x5a6199-0x0;var _0x5c3f54=_0xca0e[_0x5a6199];return _0x5c3f54;};'use strict';var SquareProjectEvents=require(_0xeca0('0x0'));var events=[_0xeca0('0x1'),_0xeca0('0x2'),_0xeca0('0x3')];function createListener(_0x1cc620,_0x1fa89d){return function(_0x5c3d9e){_0x1fa89d[_0xeca0('0x4')](_0x1cc620,_0x5c3d9e);};}function removeListener(_0x440923,_0x584ddd){return function(){SquareProjectEvents['removeListener'](_0x440923,_0x584ddd);};}exports[_0xeca0('0x5')]=function(_0x504748){for(var _0x1179e9=0x0,_0x41bce0=events[_0xeca0('0x6')];_0x1179e9<_0x41bce0;_0x1179e9++){var _0x5490ac=events[_0x1179e9];var _0x47b13c=createListener(_0xeca0('0x7')+_0x5490ac,_0x504748);SquareProjectEvents['on'](_0x5490ac,_0x47b13c);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f45c1d4..524fa4f 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','exports'];(function(_0x18b65c,_0x1c9a74){var _0x214b04=function(_0x2b9df4){while(--_0x2b9df4){_0x18b65c['push'](_0x18b65c['shift']());}};_0x214b04(++_0x1c9a74);}(_0x814b,0x1a2));var _0xb814=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x814b[_0x190ff6];return _0x5356d2;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')]('/',auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xc'),auth[_0xb814('0xb')](),controller['update']);router[_0xb814('0x13')]('/:id',auth[_0xb814('0xb')](),controller[_0xb814('0x14')]);module[_0xb814('0x15')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0xfa5f20,_0x4fe61a){var _0x41f8ac=function(_0x2f1b8b){while(--_0x2f1b8b){_0xfa5f20['push'](_0xfa5f20['shift']());}};_0x41f8ac(++_0x4fe61a);}(_0x1261,0x144));var _0x1126=function(_0xb011d6,_0x74d4eb){_0xb011d6=_0xb011d6-0x0;var _0x1e30f1=_0x1261[_0xb011d6];return _0x1e30f1;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index fd4ff4d..0f3f0e1 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 _0x9c5a=['getDataValue','savePath','lastIndexOf','sequelize','exports','STRING','VIRTUAL'];(function(_0x2fcd62,_0x57bf42){var _0x2580f5=function(_0x50143b){while(--_0x50143b){_0x2fcd62['push'](_0x2fcd62['shift']());}};_0x2580f5(++_0x57bf42);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1afaf5,_0x44e3bd){_0x1afaf5=_0x1afaf5-0x0;var _0x3ef091=_0x9c5a[_0x1afaf5];return _0x3ef091;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa9c5('0x2')]},'calleridname':{'type':Sequelize[_0xa9c5('0x2')]},'context':{'type':Sequelize[_0xa9c5('0x2')]},'extension':{'type':Sequelize[_0xa9c5('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xa9c5('0x2')]},'dnid':{'type':Sequelize[_0xa9c5('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0xa9c5('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xa9c5('0x2')]},'format':{'type':Sequelize[_0xa9c5('0x3')],'get':function(){var _0x4cb597='';var _0x4b6db6=this[_0xa9c5('0x4')](_0xa9c5('0x5'));if(_0x4b6db6){_0x4cb597=_0x4b6db6['substring'](_0x4b6db6[_0xa9c5('0x6')]('.'));}return _0x4cb597;}}}; \ No newline at end of file +var _0xd8fb=['STRING','getDataValue','savePath','sequelize','exports'];(function(_0x519fa7,_0x3ec4d7){var _0x2744a1=function(_0x11bea3){while(--_0x11bea3){_0x519fa7['push'](_0x519fa7['shift']());}};_0x2744a1(++_0x3ec4d7);}(_0xd8fb,0x99));var _0xbd8f=function(_0x408a54,_0x1b8a56){_0x408a54=_0x408a54-0x0;var _0xe400a=_0xd8fb[_0x408a54];return _0xe400a;};'use strict';var Sequelize=require(_0xbd8f('0x0'));module[_0xbd8f('0x1')]={'uniqueid':{'type':Sequelize[_0xbd8f('0x2')]},'callerid':{'type':Sequelize[_0xbd8f('0x2')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbd8f('0x2')]},'accountcode':{'type':Sequelize[_0xbd8f('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0xbd8f('0x2')]},'saveName':{'type':Sequelize[_0xbd8f('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0xbd8f('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0xf503c4='';var _0x578499=this[_0xbd8f('0x3')](_0xbd8f('0x4'));if(_0x578499){_0xf503c4=_0x578499['substring'](_0x578499['lastIndexOf']('.'));}return _0xf503c4;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 7075626..f75b73c 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 _0x3b40=['info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','destroy','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','../../components/encryptor','type','uniqueid','existsSync','decryptFile','secrets','recording','savePath','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','download','extname','unlink','Not\x20found','isNil'];(function(_0x500946,_0x2c8b40){var _0x11f902=function(_0x4a6ff8){while(--_0x4a6ff8){_0x500946['push'](_0x500946['shift']());}};_0x11f902(++_0x2c8b40);}(_0x3b40,0x119));var _0x03b4=function(_0xae0f82,_0x4fc0c6){_0xae0f82=_0xae0f82-0x0;var _0x54bab8=_0x3b40[_0xae0f82];return _0x54bab8;};'use strict';var emlformat=require(_0x03b4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03b4('0x1'));var jsonpatch=require(_0x03b4('0x2'));var rp=require(_0x03b4('0x3'));var moment=require(_0x03b4('0x4'));var BPromise=require(_0x03b4('0x5'));var Mustache=require(_0x03b4('0x6'));var util=require(_0x03b4('0x7'));var path=require(_0x03b4('0x8'));var sox=require(_0x03b4('0x9'));var csv=require(_0x03b4('0xa'));var ejs=require(_0x03b4('0xb'));var fs=require('fs');var fs_extra=require(_0x03b4('0xc'));var _=require(_0x03b4('0xd'));var squel=require('squel');var crypto=require(_0x03b4('0xe'));var jsforce=require(_0x03b4('0xf'));var deskjs=require(_0x03b4('0x10'));var toCsv=require(_0x03b4('0xa'));var querystring=require(_0x03b4('0x11'));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(_0x03b4('0x12'));var logger=require(_0x03b4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x03b4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x03b4('0x15'))['db'];function respondWithStatusCode(_0x35b0d9,_0x2ab5b9){_0x2ab5b9=_0x2ab5b9||0xcc;return function(_0x2ad811){if(_0x2ad811){return _0x35b0d9['sendStatus'](_0x2ab5b9);}return _0x35b0d9[_0x03b4('0x16')](_0x2ab5b9)[_0x03b4('0x17')]();};}function respondWithResult(_0x2830e3,_0x3d90b8){_0x3d90b8=_0x3d90b8||0xc8;return function(_0x33a4b5){if(_0x33a4b5){return _0x2830e3['status'](_0x3d90b8)['json'](_0x33a4b5);}};}function respondWithFilteredResult(_0x979a00,_0x2ad871){return function(_0x305bfa){if(_0x305bfa){var _0x271762=typeof _0x2ad871[_0x03b4('0x18')]===_0x03b4('0x19')&&typeof _0x2ad871[_0x03b4('0x1a')]===_0x03b4('0x19');var _0x5b812d=_0x305bfa[_0x03b4('0x1b')];var _0x37113d=_0x271762?0x0:_0x2ad871[_0x03b4('0x18')];var _0x390494=_0x271762?_0x305bfa[_0x03b4('0x1b')]:_0x2ad871[_0x03b4('0x18')]+_0x2ad871[_0x03b4('0x1a')];var _0x38e1b6;if(_0x390494>=_0x5b812d){_0x390494=_0x5b812d;_0x38e1b6=0xc8;}else{_0x38e1b6=0xce;}_0x979a00[_0x03b4('0x16')](_0x38e1b6);return _0x979a00['set'](_0x03b4('0x1c'),_0x37113d+'-'+_0x390494+'/'+_0x5b812d)[_0x03b4('0x1d')](_0x305bfa);}return null;};}function patchUpdates(_0x1bd22b){return function(_0x1ae51c){try{jsonpatch[_0x03b4('0x1e')](_0x1ae51c,_0x1bd22b,!![]);}catch(_0x5383b6){return BPromise['reject'](_0x5383b6);}return _0x1ae51c['save']();};}function saveUpdates(_0x5724c9,_0x2f5d1c){return function(_0x297774){if(_0x297774){return _0x297774[_0x03b4('0x1f')](_0x5724c9)['then'](function(_0x58fdb8){return _0x58fdb8;});}return null;};}function removeEntity(_0x13c9da,_0x1692fe){return function(_0x4647ce){if(_0x4647ce){return _0x4647ce[_0x03b4('0x20')]()[_0x03b4('0x21')](function(){_0x13c9da[_0x03b4('0x16')](0xcc)[_0x03b4('0x17')]();});}};}function handleEntityNotFound(_0x40b208,_0x4960ac){return function(_0x1aefc5){if(!_0x1aefc5){_0x40b208[_0x03b4('0x22')](0x194);}return _0x1aefc5;};}function handleError(_0x10e2ff,_0x3534a0){_0x3534a0=_0x3534a0||0x1f4;return function(_0x429530){logger[_0x03b4('0x23')](_0x429530[_0x03b4('0x24')]);if(_0x429530[_0x03b4('0x25')]){delete _0x429530['name'];}_0x10e2ff['status'](_0x3534a0)[_0x03b4('0x26')](_0x429530);};}exports[_0x03b4('0x27')]=function(_0x1c681e,_0x578a8c){var _0x23aae0={},_0x48bfc8={},_0x37d62a={'count':0x0,'rows':[]};var _0x434d8e=_[_0x03b4('0x28')](db[_0x03b4('0x29')][_0x03b4('0x2a')],function(_0x203e2e){return{'name':_0x203e2e[_0x03b4('0x2b')],'type':_0x203e2e['type'][_0x03b4('0x2c')]};});_0x48bfc8['model']=_[_0x03b4('0x28')](_0x434d8e,_0x03b4('0x25'));_0x48bfc8['query']=_[_0x03b4('0x2d')](_0x1c681e[_0x03b4('0x2e')]);_0x48bfc8[_0x03b4('0x2f')]=_[_0x03b4('0x30')](_0x48bfc8[_0x03b4('0x31')],_0x48bfc8[_0x03b4('0x2e')]);_0x23aae0[_0x03b4('0x32')]=_[_0x03b4('0x30')](_0x48bfc8[_0x03b4('0x31')],qs[_0x03b4('0x33')](_0x1c681e['query'][_0x03b4('0x33')]));_0x23aae0[_0x03b4('0x32')]=_0x23aae0[_0x03b4('0x32')][_0x03b4('0x34')]?_0x23aae0[_0x03b4('0x32')]:_0x48bfc8[_0x03b4('0x31')];if(!_0x1c681e[_0x03b4('0x2e')][_0x03b4('0x35')]('nolimit')){_0x23aae0['limit']=qs[_0x03b4('0x1a')](_0x1c681e[_0x03b4('0x2e')][_0x03b4('0x1a')]);_0x23aae0[_0x03b4('0x18')]=qs['offset'](_0x1c681e[_0x03b4('0x2e')][_0x03b4('0x18')]);}_0x23aae0['order']=qs[_0x03b4('0x36')](_0x1c681e[_0x03b4('0x2e')][_0x03b4('0x36')]);_0x23aae0[_0x03b4('0x37')]=qs['filters'](_['pick'](_0x1c681e[_0x03b4('0x2e')],_0x48bfc8[_0x03b4('0x2f')]),_0x434d8e);if(_0x1c681e['query']['filter']){_0x23aae0[_0x03b4('0x37')]=_[_0x03b4('0x38')](_0x23aae0['where'],{'$or':_[_0x03b4('0x28')](_0x434d8e,function(_0x575777){if(_0x575777['type']!==_0x03b4('0x39')){var _0x44d05a={};_0x44d05a[_0x575777[_0x03b4('0x25')]]={'$like':'%'+_0x1c681e['query'][_0x03b4('0x3a')]+'%'};return _0x44d05a;}})});}_0x23aae0=_[_0x03b4('0x38')]({},_0x23aae0,_0x1c681e[_0x03b4('0x3b')]);var _0x1a7377={'where':_0x23aae0[_0x03b4('0x37')]};return db[_0x03b4('0x29')][_0x03b4('0x1b')](_0x1a7377)[_0x03b4('0x21')](function(_0x527bd6){_0x37d62a[_0x03b4('0x1b')]=_0x527bd6;if(_0x1c681e[_0x03b4('0x2e')]['includeAll']){_0x23aae0['include']=[{'all':!![]}];}return db[_0x03b4('0x29')][_0x03b4('0x3c')](_0x23aae0);})[_0x03b4('0x21')](function(_0x71641b){_0x37d62a[_0x03b4('0x3d')]=_0x71641b;return _0x37d62a;})[_0x03b4('0x21')](respondWithFilteredResult(_0x578a8c,_0x23aae0))[_0x03b4('0x3e')](handleError(_0x578a8c,null));};exports[_0x03b4('0x3f')]=function(_0x143c9a,_0x50b273){var _0x25134c={'raw':!![],'where':{'id':_0x143c9a[_0x03b4('0x40')]['id']}},_0x48f710={};_0x48f710[_0x03b4('0x31')]=_[_0x03b4('0x2d')](db['SquareRecording']['rawAttributes']);_0x48f710[_0x03b4('0x2e')]=_[_0x03b4('0x2d')](_0x143c9a[_0x03b4('0x2e')]);_0x48f710[_0x03b4('0x2f')]=_[_0x03b4('0x30')](_0x48f710[_0x03b4('0x31')],_0x48f710[_0x03b4('0x2e')]);_0x25134c[_0x03b4('0x32')]=_[_0x03b4('0x30')](_0x48f710[_0x03b4('0x31')],qs[_0x03b4('0x33')](_0x143c9a[_0x03b4('0x2e')]['fields']));_0x25134c['attributes']=_0x25134c['attributes'][_0x03b4('0x34')]?_0x25134c[_0x03b4('0x32')]:_0x48f710[_0x03b4('0x31')];if(_0x143c9a['query'][_0x03b4('0x41')]){_0x25134c[_0x03b4('0x42')]=[{'all':!![]}];}_0x25134c=_[_0x03b4('0x38')]({},_0x25134c,_0x143c9a['options']);return db[_0x03b4('0x29')]['find'](_0x25134c)[_0x03b4('0x21')](handleEntityNotFound(_0x50b273,null))[_0x03b4('0x21')](respondWithResult(_0x50b273,null))[_0x03b4('0x3e')](handleError(_0x50b273,null));};exports['create']=function(_0xb7c7ca,_0x4daaeb){return db[_0x03b4('0x29')][_0x03b4('0x43')](_0xb7c7ca[_0x03b4('0x44')],{})[_0x03b4('0x21')](respondWithResult(_0x4daaeb,0xc9))[_0x03b4('0x3e')](handleError(_0x4daaeb,null));};exports[_0x03b4('0x1f')]=function(_0x47635c,_0x5e5d7d){if(_0x47635c['body']['id']){delete _0x47635c[_0x03b4('0x44')]['id'];}return db[_0x03b4('0x29')][_0x03b4('0x45')]({'where':{'id':_0x47635c[_0x03b4('0x40')]['id']}})[_0x03b4('0x21')](handleEntityNotFound(_0x5e5d7d,null))['then'](saveUpdates(_0x47635c[_0x03b4('0x44')],null))['then'](respondWithResult(_0x5e5d7d,null))[_0x03b4('0x3e')](handleError(_0x5e5d7d,null));};exports['download']=function(_0x2dca7c,_0x21313f,_0x3a8207){var _0x279330=require(_0x03b4('0x46'));var _0xd68f57=![];var _0x11036f={};if(_0x2dca7c[_0x03b4('0x2e')]['type']&&_0x2dca7c[_0x03b4('0x2e')][_0x03b4('0x47')]===_0x03b4('0x48')){_0x11036f[_0x03b4('0x48')]=_0x2dca7c[_0x03b4('0x40')]['id'];}else{_0x11036f['id']=_0x2dca7c[_0x03b4('0x40')]['id'];}return db[_0x03b4('0x29')][_0x03b4('0x45')]({'where':_0x11036f,'attributes':['id','savePath','filename'],'raw':!![]})['then'](handleEntityNotFound(_0x21313f,null))['then'](function(_0x58253e){if(_0x58253e){var _0x308cf1=_0x58253e['savePath'];var _0x568e4d=util['format']('%s.cypher',_0x308cf1);if(fs[_0x03b4('0x49')](_0x568e4d)){_0xd68f57=!![];return _0x279330[_0x03b4('0x4a')](_0x568e4d,_0x308cf1,config[_0x03b4('0x4b')][_0x03b4('0x4c')])[_0x03b4('0x21')](function(){return _0x58253e;});}return _0x58253e;}})[_0x03b4('0x21')](function(_0xd00614){if(_0xd00614){var _0x5e1005=_0xd00614[_0x03b4('0x4d')];if(!fs['existsSync'](_0x5e1005)){throw new db[(_0x03b4('0x4e'))][(_0x03b4('0x4f'))](_0x03b4('0x50'));}if(_0xd00614[_0x03b4('0x51')]){return _0x21313f[_0x03b4('0x52')](_0x5e1005,_0xd00614['filename']+path[_0x03b4('0x53')](_0x5e1005),function(){if(_0xd68f57){fs[_0x03b4('0x54')](_0x5e1005);}});}else{return _0x21313f[_0x03b4('0x52')](_0x5e1005,function(_0x42e737){if(_0xd68f57){fs['unlink'](_0x5e1005);}});}}})[_0x03b4('0x3e')](function(_0x2de883){if(_0x2de883['message']===_0x03b4('0x50')){_0x21313f[_0x03b4('0x16')](0x194)[_0x03b4('0x26')](_0x03b4('0x55'));}else{return handleError(_0x21313f,null);}});};exports[_0x03b4('0x20')]=function(_0x2c8ac1,_0x40612f){return db[_0x03b4('0x29')]['find']({'where':{'id':_0x2c8ac1[_0x03b4('0x40')]['id']}})[_0x03b4('0x21')](function(_0x578a33){if(_[_0x03b4('0x56')](_0x578a33)){throw new ReferenceError('Entity\x20not\x20found');}return _0x578a33;})['then'](function(_0x2a724e){var _0x31f4a7=_0x2a724e[_0x03b4('0x4d')];logger[_0x03b4('0x57')]('cancellazione\x20fisica\x20documento\x20%s',_0x31f4a7);if(!_[_0x03b4('0x56')](_0x2a724e[_0x03b4('0x4d')])&&fs[_0x03b4('0x49')](_0x31f4a7)){logger[_0x03b4('0x57')](_0x03b4('0x58')+_0x31f4a7+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x03b4('0x59')](_0x31f4a7);}_0x31f4a7=_0x31f4a7+_0x03b4('0x5a');if(!_[_0x03b4('0x56')](_0x2a724e[_0x03b4('0x4d')])&&fs['existsSync'](_0x31f4a7)){logger[_0x03b4('0x57')](_0x03b4('0x58')+_0x31f4a7+_0x03b4('0x5b'));fs['unlinkSync'](_0x31f4a7);}return _0x2a724e;})[_0x03b4('0x21')](function(_0x290e8e){if(!_0x290e8e)throw new InternalError();return _0x290e8e[_0x03b4('0x20')]();})[_0x03b4('0x21')](function(){_0x40612f['status'](0xcc)[_0x03b4('0x17')]();})[_0x03b4('0x3e')](handleError(_0x40612f,null));}; \ No newline at end of file +var _0xbb94=['File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','offset','undefined','count','limit','set','apply','reject','save','update','then','stack','name','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','SquareRecording','includeAll','include','findAll','rows','catch','params','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','secrets','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','unlink','download','message','send','Not\x20found','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','.cypher','info'];(function(_0x24095d,_0x4383af){var _0x5c8ead=function(_0x464573){while(--_0x464573){_0x24095d['push'](_0x24095d['shift']());}};_0x5c8ead(++_0x4383af);}(_0xbb94,0xc7));var _0x4bb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb94[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4bb9('0x0'));var jsonpatch=require(_0x4bb9('0x1'));var rp=require('request-promise');var moment=require(_0x4bb9('0x2'));var BPromise=require(_0x4bb9('0x3'));var Mustache=require(_0x4bb9('0x4'));var util=require(_0x4bb9('0x5'));var path=require(_0x4bb9('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4bb9('0x7'));var fs=require('fs');var fs_extra=require(_0x4bb9('0x8'));var _=require(_0x4bb9('0x9'));var squel=require(_0x4bb9('0xa'));var crypto=require(_0x4bb9('0xb'));var jsforce=require(_0x4bb9('0xc'));var deskjs=require(_0x4bb9('0xd'));var toCsv=require(_0x4bb9('0xe'));var querystring=require(_0x4bb9('0xf'));var Papa=require(_0x4bb9('0x10'));var Redis=require('ioredis');var authService=require(_0x4bb9('0x11'));var qs=require(_0x4bb9('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4bb9('0x13'));var logger=require(_0x4bb9('0x14'))(_0x4bb9('0x15'));var utils=require('../../config/utils');var config=require(_0x4bb9('0x16'));var licenseUtil=require(_0x4bb9('0x17'));var db=require(_0x4bb9('0x18'))['db'];function respondWithStatusCode(_0x3865e8,_0x29454c){_0x29454c=_0x29454c||0xcc;return function(_0x159438){if(_0x159438){return _0x3865e8[_0x4bb9('0x19')](_0x29454c);}return _0x3865e8[_0x4bb9('0x1a')](_0x29454c)[_0x4bb9('0x1b')]();};}function respondWithResult(_0x347b18,_0x1ea9a5){_0x1ea9a5=_0x1ea9a5||0xc8;return function(_0x55d00c){if(_0x55d00c){return _0x347b18[_0x4bb9('0x1a')](_0x1ea9a5)['json'](_0x55d00c);}};}function respondWithFilteredResult(_0x4e720f,_0x5f4c8e){return function(_0x1c3f4a){if(_0x1c3f4a){var _0x451b97=typeof _0x5f4c8e[_0x4bb9('0x1c')]===_0x4bb9('0x1d')&&typeof _0x5f4c8e['limit']==='undefined';var _0x3a0624=_0x1c3f4a[_0x4bb9('0x1e')];var _0x446d1=_0x451b97?0x0:_0x5f4c8e[_0x4bb9('0x1c')];var _0xd3fc20=_0x451b97?_0x1c3f4a['count']:_0x5f4c8e[_0x4bb9('0x1c')]+_0x5f4c8e[_0x4bb9('0x1f')];var _0x1d0259;if(_0xd3fc20>=_0x3a0624){_0xd3fc20=_0x3a0624;_0x1d0259=0xc8;}else{_0x1d0259=0xce;}_0x4e720f[_0x4bb9('0x1a')](_0x1d0259);return _0x4e720f[_0x4bb9('0x20')]('Content-Range',_0x446d1+'-'+_0xd3fc20+'/'+_0x3a0624)['json'](_0x1c3f4a);}return null;};}function patchUpdates(_0x5e5813){return function(_0x40703e){try{jsonpatch[_0x4bb9('0x21')](_0x40703e,_0x5e5813,!![]);}catch(_0x53d5bc){return BPromise[_0x4bb9('0x22')](_0x53d5bc);}return _0x40703e[_0x4bb9('0x23')]();};}function saveUpdates(_0x459cd6,_0x523d4c){return function(_0x13a5fb){if(_0x13a5fb){return _0x13a5fb[_0x4bb9('0x24')](_0x459cd6)[_0x4bb9('0x25')](function(_0xfb95f2){return _0xfb95f2;});}return null;};}function removeEntity(_0x2fdc02,_0xbb4160){return function(_0x4e0b0b){if(_0x4e0b0b){return _0x4e0b0b['destroy']()[_0x4bb9('0x25')](function(){_0x2fdc02['status'](0xcc)[_0x4bb9('0x1b')]();});}};}function handleEntityNotFound(_0x1ddec1,_0x27c5ca){return function(_0x338657){if(!_0x338657){_0x1ddec1[_0x4bb9('0x19')](0x194);}return _0x338657;};}function handleError(_0x5bed2c,_0x131ab5){_0x131ab5=_0x131ab5||0x1f4;return function(_0x23afee){logger['error'](_0x23afee[_0x4bb9('0x26')]);if(_0x23afee['name']){delete _0x23afee[_0x4bb9('0x27')];}_0x5bed2c['status'](_0x131ab5)['send'](_0x23afee);};}exports['index']=function(_0x334387,_0x5ab21d){var _0x10a4a6={},_0x3a72db={},_0x4e79cf={'count':0x0,'rows':[]};var _0x202ac5=_[_0x4bb9('0x28')](db['SquareRecording'][_0x4bb9('0x29')],function(_0x54b5f4){return{'name':_0x54b5f4[_0x4bb9('0x2a')],'type':_0x54b5f4[_0x4bb9('0x2b')][_0x4bb9('0x2c')]};});_0x3a72db['model']=_[_0x4bb9('0x28')](_0x202ac5,_0x4bb9('0x27'));_0x3a72db[_0x4bb9('0x2d')]=_[_0x4bb9('0x2e')](_0x334387[_0x4bb9('0x2d')]);_0x3a72db['filters']=_[_0x4bb9('0x2f')](_0x3a72db['model'],_0x3a72db['query']);_0x10a4a6['attributes']=_[_0x4bb9('0x2f')](_0x3a72db[_0x4bb9('0x30')],qs[_0x4bb9('0x31')](_0x334387[_0x4bb9('0x2d')]['fields']));_0x10a4a6[_0x4bb9('0x32')]=_0x10a4a6[_0x4bb9('0x32')][_0x4bb9('0x33')]?_0x10a4a6[_0x4bb9('0x32')]:_0x3a72db['model'];if(!_0x334387[_0x4bb9('0x2d')][_0x4bb9('0x34')](_0x4bb9('0x35'))){_0x10a4a6[_0x4bb9('0x1f')]=qs['limit'](_0x334387[_0x4bb9('0x2d')][_0x4bb9('0x1f')]);_0x10a4a6[_0x4bb9('0x1c')]=qs[_0x4bb9('0x1c')](_0x334387[_0x4bb9('0x2d')][_0x4bb9('0x1c')]);}_0x10a4a6[_0x4bb9('0x36')]=qs[_0x4bb9('0x37')](_0x334387[_0x4bb9('0x2d')]['sort']);_0x10a4a6[_0x4bb9('0x38')]=qs[_0x4bb9('0x39')](_[_0x4bb9('0x3a')](_0x334387['query'],_0x3a72db[_0x4bb9('0x39')]),_0x202ac5);if(_0x334387[_0x4bb9('0x2d')]['filter']){_0x10a4a6[_0x4bb9('0x38')]=_[_0x4bb9('0x3b')](_0x10a4a6['where'],{'$or':_[_0x4bb9('0x28')](_0x202ac5,function(_0x29f000){if(_0x29f000[_0x4bb9('0x2b')]!==_0x4bb9('0x3c')){var _0x4c6059={};_0x4c6059[_0x29f000[_0x4bb9('0x27')]]={'$like':'%'+_0x334387[_0x4bb9('0x2d')][_0x4bb9('0x3d')]+'%'};return _0x4c6059;}})});}_0x10a4a6=_[_0x4bb9('0x3b')]({},_0x10a4a6,_0x334387[_0x4bb9('0x3e')]);var _0x231ada={'where':_0x10a4a6['where']};return db[_0x4bb9('0x3f')][_0x4bb9('0x1e')](_0x231ada)[_0x4bb9('0x25')](function(_0x362f14){_0x4e79cf[_0x4bb9('0x1e')]=_0x362f14;if(_0x334387[_0x4bb9('0x2d')][_0x4bb9('0x40')]){_0x10a4a6[_0x4bb9('0x41')]=[{'all':!![]}];}return db['SquareRecording'][_0x4bb9('0x42')](_0x10a4a6);})['then'](function(_0x46cede){_0x4e79cf[_0x4bb9('0x43')]=_0x46cede;return _0x4e79cf;})[_0x4bb9('0x25')](respondWithFilteredResult(_0x5ab21d,_0x10a4a6))[_0x4bb9('0x44')](handleError(_0x5ab21d,null));};exports['show']=function(_0xf6f2b0,_0x42da5f){var _0x50d121={'raw':!![],'where':{'id':_0xf6f2b0[_0x4bb9('0x45')]['id']}},_0x599dc6={};_0x599dc6[_0x4bb9('0x30')]=_[_0x4bb9('0x2e')](db[_0x4bb9('0x3f')][_0x4bb9('0x29')]);_0x599dc6[_0x4bb9('0x2d')]=_[_0x4bb9('0x2e')](_0xf6f2b0['query']);_0x599dc6[_0x4bb9('0x39')]=_[_0x4bb9('0x2f')](_0x599dc6[_0x4bb9('0x30')],_0x599dc6[_0x4bb9('0x2d')]);_0x50d121[_0x4bb9('0x32')]=_['intersection'](_0x599dc6[_0x4bb9('0x30')],qs[_0x4bb9('0x31')](_0xf6f2b0['query'][_0x4bb9('0x31')]));_0x50d121[_0x4bb9('0x32')]=_0x50d121[_0x4bb9('0x32')][_0x4bb9('0x33')]?_0x50d121[_0x4bb9('0x32')]:_0x599dc6['model'];if(_0xf6f2b0[_0x4bb9('0x2d')]['includeAll']){_0x50d121['include']=[{'all':!![]}];}_0x50d121=_[_0x4bb9('0x3b')]({},_0x50d121,_0xf6f2b0[_0x4bb9('0x3e')]);return db[_0x4bb9('0x3f')][_0x4bb9('0x46')](_0x50d121)[_0x4bb9('0x25')](handleEntityNotFound(_0x42da5f,null))[_0x4bb9('0x25')](respondWithResult(_0x42da5f,null))[_0x4bb9('0x44')](handleError(_0x42da5f,null));};exports[_0x4bb9('0x47')]=function(_0xd09d6a,_0x403b3c){return db['SquareRecording']['create'](_0xd09d6a[_0x4bb9('0x48')],{})[_0x4bb9('0x25')](respondWithResult(_0x403b3c,0xc9))[_0x4bb9('0x44')](handleError(_0x403b3c,null));};exports[_0x4bb9('0x24')]=function(_0x11e1ed,_0x4c93c2){if(_0x11e1ed['body']['id']){delete _0x11e1ed[_0x4bb9('0x48')]['id'];}return db[_0x4bb9('0x3f')]['find']({'where':{'id':_0x11e1ed[_0x4bb9('0x45')]['id']}})[_0x4bb9('0x25')](handleEntityNotFound(_0x4c93c2,null))['then'](saveUpdates(_0x11e1ed['body'],null))['then'](respondWithResult(_0x4c93c2,null))[_0x4bb9('0x44')](handleError(_0x4c93c2,null));};exports['download']=function(_0x2c180a,_0x59e23c,_0x327b3e){var _0x5d40c9=require(_0x4bb9('0x49'));var _0x44d397=![];var _0x3e4e8a={};if(_0x2c180a[_0x4bb9('0x2d')][_0x4bb9('0x2b')]&&_0x2c180a['query'][_0x4bb9('0x2b')]===_0x4bb9('0x4a')){_0x3e4e8a[_0x4bb9('0x4a')]=_0x2c180a[_0x4bb9('0x45')]['id'];}else{_0x3e4e8a['id']=_0x2c180a['params']['id'];}return db[_0x4bb9('0x3f')][_0x4bb9('0x46')]({'where':_0x3e4e8a,'attributes':['id',_0x4bb9('0x4b'),_0x4bb9('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x59e23c,null))[_0x4bb9('0x25')](function(_0x3b9ded){if(_0x3b9ded){var _0x5f1e22=_0x3b9ded[_0x4bb9('0x4b')];var _0x3abb56=util[_0x4bb9('0x4d')]('%s.cypher',_0x5f1e22);if(fs['existsSync'](_0x3abb56)){_0x44d397=!![];return _0x5d40c9['decryptFile'](_0x3abb56,_0x5f1e22,config[_0x4bb9('0x4e')][_0x4bb9('0x4f')])['then'](function(){return _0x3b9ded;});}return _0x3b9ded;}})['then'](function(_0x2a0f53){if(_0x2a0f53){var _0x254215=_0x2a0f53['savePath'];if(!fs[_0x4bb9('0x50')](_0x254215)){throw new db[(_0x4bb9('0x51'))][(_0x4bb9('0x52'))](_0x4bb9('0x53'));}if(_0x2a0f53[_0x4bb9('0x4c')]){return _0x59e23c['download'](_0x254215,_0x2a0f53[_0x4bb9('0x4c')]+path['extname'](_0x254215),function(){if(_0x44d397){fs[_0x4bb9('0x54')](_0x254215);}});}else{return _0x59e23c[_0x4bb9('0x55')](_0x254215,function(_0x780185){if(_0x44d397){fs[_0x4bb9('0x54')](_0x254215);}});}}})['catch'](function(_0x208e44){if(_0x208e44[_0x4bb9('0x56')]===_0x4bb9('0x53')){_0x59e23c[_0x4bb9('0x1a')](0x194)[_0x4bb9('0x57')](_0x4bb9('0x58'));}else{return handleError(_0x59e23c,null);}});};exports[_0x4bb9('0x59')]=function(_0xe1c4b,_0x1df771){return db[_0x4bb9('0x3f')][_0x4bb9('0x46')]({'where':{'id':_0xe1c4b[_0x4bb9('0x45')]['id']}})[_0x4bb9('0x25')](function(_0x5ed1c8){if(_[_0x4bb9('0x5a')](_0x5ed1c8)){throw new ReferenceError(_0x4bb9('0x5b'));}return _0x5ed1c8;})[_0x4bb9('0x25')](function(_0x5458e8){var _0x472840=_0x5458e8['savePath'];logger['info'](_0x4bb9('0x5c'),_0x472840);if(!_[_0x4bb9('0x5a')](_0x5458e8[_0x4bb9('0x4b')])&&fs['existsSync'](_0x472840)){logger['info']('File:\x20\x22'+_0x472840+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x472840);}_0x472840=_0x472840+_0x4bb9('0x5d');if(!_[_0x4bb9('0x5a')](_0x5458e8['savePath'])&&fs[_0x4bb9('0x50')](_0x472840)){logger[_0x4bb9('0x5e')](_0x4bb9('0x5f')+_0x472840+_0x4bb9('0x60'));fs[_0x4bb9('0x61')](_0x472840);}return _0x5458e8;})[_0x4bb9('0x25')](function(_0x4ad20c){if(!_0x4ad20c)throw new InternalError();return _0x4ad20c['destroy']();})['then'](function(){_0x1df771[_0x4bb9('0x1a')](0xcc)[_0x4bb9('0x1b')]();})[_0x4bb9('0x44')](handleError(_0x1df771,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index ae771cc..caba4bc 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 _0x1d63=['request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','../../config/logger','api','moment'];(function(_0x16d277,_0x3a416c){var _0x1df397=function(_0x581733){while(--_0x581733){_0x16d277['push'](_0x16d277['shift']());}};_0x1df397(++_0x3a416c);}(_0x1d63,0xa4));var _0x31d6=function(_0x595599,_0x2cdf96){_0x595599=_0x595599-0x0;var _0x369b38=_0x1d63[_0x595599];return _0x369b38;};'use strict';var _=require(_0x31d6('0x0'));var util=require(_0x31d6('0x1'));var logger=require(_0x31d6('0x2'))(_0x31d6('0x3'));var moment=require(_0x31d6('0x4'));var BPromise=require('bluebird');var rp=require(_0x31d6('0x5'));var fs=require('fs');var path=require(_0x31d6('0x6'));var rimraf=require(_0x31d6('0x7'));var config=require(_0x31d6('0x8'));var attributes=require(_0x31d6('0x9'));module[_0x31d6('0xa')]=function(_0x45b5ab,_0x510a88){return _0x45b5ab[_0x31d6('0xb')](_0x31d6('0xc'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3646=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording'];(function(_0x780afa,_0x36ef0e){var _0x5851ea=function(_0x1eb129){while(--_0x1eb129){_0x780afa['push'](_0x780afa['shift']());}};_0x5851ea(++_0x36ef0e);}(_0x3646,0x15f));var _0x6364=function(_0x1905b9,_0x3240d8){_0x1905b9=_0x1905b9-0x0;var _0xaf14f9=_0x3646[_0x1905b9];return _0xaf14f9;};'use strict';var _=require(_0x6364('0x0'));var util=require(_0x6364('0x1'));var logger=require(_0x6364('0x2'))(_0x6364('0x3'));var moment=require('moment');var BPromise=require(_0x6364('0x4'));var rp=require(_0x6364('0x5'));var fs=require('fs');var path=require(_0x6364('0x6'));var rimraf=require(_0x6364('0x7'));var config=require(_0x6364('0x8'));var attributes=require(_0x6364('0x9'));module[_0x6364('0xa')]=function(_0x31f514,_0x165164){return _0x31f514[_0x6364('0xb')](_0x6364('0xc'),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 ef1bfac..45274cd 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 _0xd671=['create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSquareRecording','SquareRecording'];(function(_0x58cb21,_0x4737cc){var _0x37e679=function(_0x154326){while(--_0x154326){_0x58cb21['push'](_0x58cb21['shift']());}};_0x37e679(++_0x4737cc);}(_0xd671,0x7c));var _0x1d67=function(_0x4080dd,_0x5b595d){_0x4080dd=_0x4080dd-0x0;var _0x4ecf85=_0xd671[_0x4080dd];return _0x4ecf85;};'use strict';var _=require(_0x1d67('0x0'));var util=require(_0x1d67('0x1'));var moment=require(_0x1d67('0x2'));var BPromise=require(_0x1d67('0x3'));var rs=require(_0x1d67('0x4'));var fs=require('fs');var Redis=require(_0x1d67('0x5'));var db=require(_0x1d67('0x6'))['db'];var utils=require(_0x1d67('0x7'));var logger=require(_0x1d67('0x8'))(_0x1d67('0x9'));var config=require(_0x1d67('0xa'));var jayson=require(_0x1d67('0xb'));var client=jayson[_0x1d67('0xc')][_0x1d67('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x398661,_0x5c7d79,_0x4d7851){return new BPromise(function(_0x2015ad,_0x473d00){return client[_0x1d67('0xe')](_0x398661,_0x4d7851)['then'](function(_0x13a7d3){logger[_0x1d67('0xf')](_0x1d67('0x10'),_0x5c7d79,_0x1d67('0x11'));logger[_0x1d67('0x12')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x5c7d79,'request\x20sent',JSON['stringify'](_0x13a7d3));if(_0x13a7d3[_0x1d67('0x13')]){if(_0x13a7d3[_0x1d67('0x13')][_0x1d67('0x14')]===0x1f4){logger[_0x1d67('0x13')](_0x1d67('0x10'),_0x5c7d79,_0x13a7d3[_0x1d67('0x13')]['message']);return _0x473d00(_0x13a7d3[_0x1d67('0x13')][_0x1d67('0x15')]);}logger[_0x1d67('0x13')](_0x1d67('0x10'),_0x5c7d79,_0x13a7d3['error'][_0x1d67('0x15')]);return _0x2015ad(_0x13a7d3[_0x1d67('0x13')]['message']);}else{logger[_0x1d67('0xf')](_0x1d67('0x10'),_0x5c7d79,_0x1d67('0x11'));_0x2015ad(_0x13a7d3[_0x1d67('0x16')][_0x1d67('0x15')]);}})[_0x1d67('0x17')](function(_0x33a66e){logger['error'](_0x1d67('0x10'),_0x5c7d79,_0x33a66e);_0x473d00(_0x33a66e);});});}exports[_0x1d67('0x18')]=function(_0x10308b){var _0x41b720=this;return new Promise(function(_0x48472b,_0x4ed20d){return db[_0x1d67('0x19')][_0x1d67('0x1a')](_0x10308b[_0x1d67('0x1b')],{'raw':_0x10308b[_0x1d67('0x1c')]?_0x10308b[_0x1d67('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a5531){logger[_0x1d67('0xf')](_0x1d67('0x18'),_0x10308b);logger[_0x1d67('0x12')](_0x1d67('0x18'),_0x10308b,JSON[_0x1d67('0x1d')](_0x1a5531));_0x48472b(_0x1a5531);})[_0x1d67('0x17')](function(_0x529cd5){logger[_0x1d67('0x13')](_0x1d67('0x18'),_0x529cd5[_0x1d67('0x15')],_0x10308b);_0x4ed20d(_0x41b720['error'](0x1f4,_0x529cd5['message']));});});}; \ No newline at end of file +var _0x04c2=['jayson/promise','client','http','then','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','SquareRecording,\x20%s,\x20%s','info','result','catch','CreateSquareRecording','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5913d7,_0x3df32d){var _0xa64bd1=function(_0x436d0c){while(--_0x436d0c){_0x5913d7['push'](_0x5913d7['shift']());}};_0xa64bd1(++_0x3df32d);}(_0x04c2,0xdd));var _0x204c=function(_0x56baac,_0x3de33a){_0x56baac=_0x56baac-0x0;var _0x5b1c1f=_0x04c2[_0x56baac];return _0x5b1c1f;};'use strict';var _=require(_0x204c('0x0'));var util=require(_0x204c('0x1'));var moment=require(_0x204c('0x2'));var BPromise=require(_0x204c('0x3'));var rs=require(_0x204c('0x4'));var fs=require('fs');var Redis=require(_0x204c('0x5'));var db=require(_0x204c('0x6'))['db'];var utils=require(_0x204c('0x7'));var logger=require(_0x204c('0x8'))(_0x204c('0x9'));var config=require(_0x204c('0xa'));var jayson=require(_0x204c('0xb'));var client=jayson[_0x204c('0xc')][_0x204c('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x8f6466,_0x56cb3c,_0x117621){return new BPromise(function(_0x2552bd,_0x440622){return client['request'](_0x8f6466,_0x117621)[_0x204c('0xe')](function(_0x3a56b0){logger['info']('SquareRecording,\x20%s,\x20%s',_0x56cb3c,'request\x20sent');logger[_0x204c('0xf')](_0x204c('0x10'),_0x56cb3c,_0x204c('0x11'),JSON['stringify'](_0x3a56b0));if(_0x3a56b0[_0x204c('0x12')]){if(_0x3a56b0[_0x204c('0x12')]['code']===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x56cb3c,_0x3a56b0[_0x204c('0x12')][_0x204c('0x13')]);return _0x440622(_0x3a56b0[_0x204c('0x12')][_0x204c('0x13')]);}logger['error'](_0x204c('0x14'),_0x56cb3c,_0x3a56b0[_0x204c('0x12')][_0x204c('0x13')]);return _0x2552bd(_0x3a56b0[_0x204c('0x12')][_0x204c('0x13')]);}else{logger[_0x204c('0x15')](_0x204c('0x14'),_0x56cb3c,_0x204c('0x11'));_0x2552bd(_0x3a56b0[_0x204c('0x16')][_0x204c('0x13')]);}})[_0x204c('0x17')](function(_0x1b33c8){logger[_0x204c('0x12')](_0x204c('0x14'),_0x56cb3c,_0x1b33c8);_0x440622(_0x1b33c8);});});}exports[_0x204c('0x18')]=function(_0x79c195){var _0xc818fb=this;return new Promise(function(_0x30b191,_0x49bfe4){return db['SquareRecording']['create'](_0x79c195[_0x204c('0x19')],{'raw':_0x79c195[_0x204c('0x1a')]?_0x79c195[_0x204c('0x1a')][_0x204c('0x1b')]===undefined?!![]:![]:!![]})[_0x204c('0xe')](function(_0x4dc0fd){logger[_0x204c('0x15')](_0x204c('0x18'),_0x79c195);logger[_0x204c('0xf')]('CreateSquareRecording',_0x79c195,JSON[_0x204c('0x1c')](_0x4dc0fd));_0x30b191(_0x4dc0fd);})[_0x204c('0x17')](function(_0x7fd5e2){logger[_0x204c('0x12')](_0x204c('0x18'),_0x7fd5e2['message'],_0x79c195);_0x49bfe4(_0xc818fb[_0x204c('0x12')](0x1f4,_0x7fd5e2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 4d1211c..fcdc8f0 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(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +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(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 399e4b9..2e4720a 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 _0x17f8=['STRING','DATE','BOOLEAN','exports'];(function(_0xfc94b3,_0x1c4543){var _0x5888b4=function(_0x226cd5){while(--_0x226cd5){_0xfc94b3['push'](_0xfc94b3['shift']());}};_0x5888b4(++_0x1c4543);}(_0x17f8,0x11b));var _0x817f=function(_0x395568,_0x3035b5){_0x395568=_0x395568-0x0;var _0x2c2485=_0x17f8[_0x395568];return _0x2c2485;};'use strict';var Sequelize=require('sequelize');module[_0x817f('0x0')]={'network':{'type':Sequelize[_0x817f('0x1')]},'network_script':{'type':Sequelize[_0x817f('0x1')]},'request':{'type':Sequelize[_0x817f('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x817f('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x817f('0x1')]},'version':{'type':Sequelize[_0x817f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x817f('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x817f('0x1')]},'callingtns':{'type':Sequelize[_0x817f('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x817f('0x1')]},'context':{'type':Sequelize[_0x817f('0x1')]},'extension':{'type':Sequelize[_0x817f('0x1')]},'priority':{'type':Sequelize[_0x817f('0x1')]},'enhanced':{'type':Sequelize[_0x817f('0x1')]},'accountcode':{'type':Sequelize[_0x817f('0x1')]},'threadid':{'type':Sequelize[_0x817f('0x1')]},'project_name':{'type':Sequelize[_0x817f('0x1')]},'joinAt':{'type':Sequelize[_0x817f('0x2')]},'leaveAt':{'type':Sequelize[_0x817f('0x2')]},'bot':{'type':Sequelize[_0x817f('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9dec=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0xace5bb,_0x4322f6){var _0x37bd48=function(_0x1d31c7){while(--_0x1d31c7){_0xace5bb['push'](_0xace5bb['shift']());}};_0x37bd48(++_0x4322f6);}(_0x9dec,0x86));var _0xc9de=function(_0x51189c,_0x3e489b){_0x51189c=_0x51189c-0x0;var _0x263558=_0x9dec[_0x51189c];return _0x263558;};'use strict';var Sequelize=require(_0xc9de('0x0'));module[_0xc9de('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0xc9de('0x2')]},'request':{'type':Sequelize[_0xc9de('0x2')]},'channel':{'type':Sequelize[_0xc9de('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc9de('0x2')]},'uniqueid':{'type':Sequelize[_0xc9de('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc9de('0x2')]},'calleridname':{'type':Sequelize[_0xc9de('0x2')]},'callingpres':{'type':Sequelize[_0xc9de('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0xc9de('0x2')]},'callingtns':{'type':Sequelize[_0xc9de('0x2')]},'dnid':{'type':Sequelize[_0xc9de('0x2')]},'rdnis':{'type':Sequelize[_0xc9de('0x2')]},'context':{'type':Sequelize[_0xc9de('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc9de('0x2')]},'enhanced':{'type':Sequelize[_0xc9de('0x2')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xc9de('0x2')]},'joinAt':{'type':Sequelize[_0xc9de('0x3')]},'leaveAt':{'type':Sequelize[_0xc9de('0x3')]},'bot':{'type':Sequelize[_0xc9de('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6a6382e..7ad8516 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 _0x7716=['options','include','findAll','rows','show','params','keys','length','includeAll','catch','create','body','find','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter'];(function(_0x5bab8e,_0x5a9ed6){var _0x3e14ea=function(_0x3d5948){while(--_0x3d5948){_0x5bab8e['push'](_0x5bab8e['shift']());}};_0x3e14ea(++_0x5a9ed6);}(_0x7716,0x1c5));var _0x6771=function(_0x17ebae,_0x7da3){_0x17ebae=_0x17ebae-0x0;var _0x8cbe7d=_0x7716[_0x17ebae];return _0x8cbe7d;};'use strict';var emlformat=require(_0x6771('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6771('0x1'));var jsonpatch=require(_0x6771('0x2'));var rp=require(_0x6771('0x3'));var moment=require(_0x6771('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6771('0x5'));var util=require(_0x6771('0x6'));var path=require(_0x6771('0x7'));var sox=require(_0x6771('0x8'));var csv=require(_0x6771('0x9'));var ejs=require(_0x6771('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6771('0xb'));var squel=require(_0x6771('0xc'));var crypto=require('crypto');var jsforce=require(_0x6771('0xd'));var deskjs=require(_0x6771('0xe'));var toCsv=require(_0x6771('0x9'));var querystring=require(_0x6771('0xf'));var Papa=require('papaparse');var Redis=require(_0x6771('0x10'));var authService=require(_0x6771('0x11'));var qs=require(_0x6771('0x12'));var as=require(_0x6771('0x13'));var hardwareService=require(_0x6771('0x14'));var logger=require(_0x6771('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6771('0x16'))['db'];function respondWithStatusCode(_0x464017,_0x227459){_0x227459=_0x227459||0xcc;return function(_0x3df95b){if(_0x3df95b){return _0x464017['sendStatus'](_0x227459);}return _0x464017['status'](_0x227459)[_0x6771('0x17')]();};}function respondWithResult(_0x12437f,_0x536691){_0x536691=_0x536691||0xc8;return function(_0x32415c){if(_0x32415c){return _0x12437f[_0x6771('0x18')](_0x536691)[_0x6771('0x19')](_0x32415c);}};}function respondWithFilteredResult(_0x32d88b,_0x5d15e0){return function(_0x2f0f94){if(_0x2f0f94){var _0x2d0ef3=typeof _0x5d15e0[_0x6771('0x1a')]===_0x6771('0x1b')&&typeof _0x5d15e0[_0x6771('0x1c')]===_0x6771('0x1b');var _0x1eea9b=_0x2f0f94['count'];var _0x35bdbd=_0x2d0ef3?0x0:_0x5d15e0[_0x6771('0x1a')];var _0x49364c=_0x2d0ef3?_0x2f0f94[_0x6771('0x1d')]:_0x5d15e0[_0x6771('0x1a')]+_0x5d15e0[_0x6771('0x1c')];var _0x4dd05b;if(_0x49364c>=_0x1eea9b){_0x49364c=_0x1eea9b;_0x4dd05b=0xc8;}else{_0x4dd05b=0xce;}_0x32d88b[_0x6771('0x18')](_0x4dd05b);return _0x32d88b[_0x6771('0x1e')]('Content-Range',_0x35bdbd+'-'+_0x49364c+'/'+_0x1eea9b)[_0x6771('0x19')](_0x2f0f94);}return null;};}function patchUpdates(_0x3ab96e){return function(_0x1540c1){try{jsonpatch[_0x6771('0x1f')](_0x1540c1,_0x3ab96e,!![]);}catch(_0x431c33){return BPromise['reject'](_0x431c33);}return _0x1540c1[_0x6771('0x20')]();};}function saveUpdates(_0x1c7c68,_0x19a5e0){return function(_0x308e69){if(_0x308e69){return _0x308e69[_0x6771('0x21')](_0x1c7c68)[_0x6771('0x22')](function(_0x214577){return _0x214577;});}return null;};}function removeEntity(_0x133058,_0x27a3d0){return function(_0x5c95d3){if(_0x5c95d3){return _0x5c95d3['destroy']()[_0x6771('0x22')](function(){_0x133058[_0x6771('0x18')](0xcc)[_0x6771('0x17')]();});}};}function handleEntityNotFound(_0x5b887c,_0x468b1d){return function(_0x5b8d76){if(!_0x5b8d76){_0x5b887c['sendStatus'](0x194);}return _0x5b8d76;};}function handleError(_0x151b14,_0x4d8cf4){_0x4d8cf4=_0x4d8cf4||0x1f4;return function(_0x1a6af8){logger[_0x6771('0x23')](_0x1a6af8[_0x6771('0x24')]);if(_0x1a6af8[_0x6771('0x25')]){delete _0x1a6af8['name'];}_0x151b14[_0x6771('0x18')](_0x4d8cf4)[_0x6771('0x26')](_0x1a6af8);};}exports[_0x6771('0x27')]=function(_0x24c3da,_0x3fe3c2){var _0x5850a9={},_0x3d17a1={},_0x1873bf={'count':0x0,'rows':[]};var _0x2a8f34=_[_0x6771('0x28')](db[_0x6771('0x29')][_0x6771('0x2a')],function(_0xd0c09d){return{'name':_0xd0c09d[_0x6771('0x2b')],'type':_0xd0c09d[_0x6771('0x2c')]['key']};});_0x3d17a1[_0x6771('0x2d')]=_['map'](_0x2a8f34,_0x6771('0x25'));_0x3d17a1[_0x6771('0x2e')]=_['keys'](_0x24c3da[_0x6771('0x2e')]);_0x3d17a1[_0x6771('0x2f')]=_[_0x6771('0x30')](_0x3d17a1[_0x6771('0x2d')],_0x3d17a1[_0x6771('0x2e')]);_0x5850a9[_0x6771('0x31')]=_[_0x6771('0x30')](_0x3d17a1['model'],qs['fields'](_0x24c3da[_0x6771('0x2e')][_0x6771('0x32')]));_0x5850a9[_0x6771('0x31')]=_0x5850a9[_0x6771('0x31')]['length']?_0x5850a9[_0x6771('0x31')]:_0x3d17a1['model'];if(!_0x24c3da['query'][_0x6771('0x33')](_0x6771('0x34'))){_0x5850a9['limit']=qs[_0x6771('0x1c')](_0x24c3da[_0x6771('0x2e')][_0x6771('0x1c')]);_0x5850a9[_0x6771('0x1a')]=qs[_0x6771('0x1a')](_0x24c3da['query'][_0x6771('0x1a')]);}_0x5850a9['order']=qs[_0x6771('0x35')](_0x24c3da[_0x6771('0x2e')]['sort']);_0x5850a9[_0x6771('0x36')]=qs[_0x6771('0x2f')](_[_0x6771('0x37')](_0x24c3da[_0x6771('0x2e')],_0x3d17a1['filters']),_0x2a8f34);if(_0x24c3da[_0x6771('0x2e')]['filter']){_0x5850a9[_0x6771('0x36')]=_[_0x6771('0x38')](_0x5850a9[_0x6771('0x36')],{'$or':_[_0x6771('0x28')](_0x2a8f34,function(_0x1c3e92){if(_0x1c3e92[_0x6771('0x2c')]!=='VIRTUAL'){var _0x4327f1={};_0x4327f1[_0x1c3e92[_0x6771('0x25')]]={'$like':'%'+_0x24c3da['query'][_0x6771('0x39')]+'%'};return _0x4327f1;}})});}_0x5850a9=_[_0x6771('0x38')]({},_0x5850a9,_0x24c3da[_0x6771('0x3a')]);var _0x5f3058={'where':_0x5850a9[_0x6771('0x36')]};return db['SquareReport'][_0x6771('0x1d')](_0x5f3058)['then'](function(_0x2d8408){_0x1873bf['count']=_0x2d8408;if(_0x24c3da[_0x6771('0x2e')]['includeAll']){_0x5850a9[_0x6771('0x3b')]=[{'all':!![]}];}return db[_0x6771('0x29')][_0x6771('0x3c')](_0x5850a9);})[_0x6771('0x22')](function(_0x405936){_0x1873bf[_0x6771('0x3d')]=_0x405936;return _0x1873bf;})['then'](respondWithFilteredResult(_0x3fe3c2,_0x5850a9))['catch'](handleError(_0x3fe3c2,null));};exports[_0x6771('0x3e')]=function(_0x2e78db,_0x2ccd4d){var _0x31f7d5={'raw':!![],'where':{'id':_0x2e78db[_0x6771('0x3f')]['id']}},_0x134062={};_0x134062[_0x6771('0x2d')]=_[_0x6771('0x40')](db[_0x6771('0x29')][_0x6771('0x2a')]);_0x134062[_0x6771('0x2e')]=_[_0x6771('0x40')](_0x2e78db[_0x6771('0x2e')]);_0x134062[_0x6771('0x2f')]=_[_0x6771('0x30')](_0x134062['model'],_0x134062[_0x6771('0x2e')]);_0x31f7d5[_0x6771('0x31')]=_[_0x6771('0x30')](_0x134062[_0x6771('0x2d')],qs['fields'](_0x2e78db[_0x6771('0x2e')]['fields']));_0x31f7d5[_0x6771('0x31')]=_0x31f7d5['attributes'][_0x6771('0x41')]?_0x31f7d5['attributes']:_0x134062[_0x6771('0x2d')];if(_0x2e78db[_0x6771('0x2e')][_0x6771('0x42')]){_0x31f7d5['include']=[{'all':!![]}];}_0x31f7d5=_[_0x6771('0x38')]({},_0x31f7d5,_0x2e78db[_0x6771('0x3a')]);return db['SquareReport']['find'](_0x31f7d5)['then'](handleEntityNotFound(_0x2ccd4d,null))[_0x6771('0x22')](respondWithResult(_0x2ccd4d,null))[_0x6771('0x43')](handleError(_0x2ccd4d,null));};exports[_0x6771('0x44')]=function(_0x38212d,_0x51c1d2){return db[_0x6771('0x29')][_0x6771('0x44')](_0x38212d[_0x6771('0x45')],{})['then'](respondWithResult(_0x51c1d2,0xc9))[_0x6771('0x43')](handleError(_0x51c1d2,null));};exports[_0x6771('0x21')]=function(_0x40eb0f,_0x233ff1){if(_0x40eb0f[_0x6771('0x45')]['id']){delete _0x40eb0f[_0x6771('0x45')]['id'];}return db['SquareReport'][_0x6771('0x46')]({'where':{'id':_0x40eb0f[_0x6771('0x3f')]['id']}})[_0x6771('0x22')](handleEntityNotFound(_0x233ff1,null))['then'](saveUpdates(_0x40eb0f[_0x6771('0x45')],null))[_0x6771('0x22')](respondWithResult(_0x233ff1,null))[_0x6771('0x43')](handleError(_0x233ff1,null));};exports[_0x6771('0x47')]=function(_0x5e4866,_0x1eb467){return db['SquareReport'][_0x6771('0x46')]({'where':{'id':_0x5e4866[_0x6771('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1eb467,null))[_0x6771('0x22')](removeEntity(_0x1eb467,null))['catch'](handleError(_0x1eb467,null));};exports[_0x6771('0x48')]=function(_0x1e8eab,_0x36d64f){return db['SquareReport'][_0x6771('0x48')]()['then'](respondWithResult(_0x36d64f,null))[_0x6771('0x43')](handleError(_0x36d64f,null));}; \ No newline at end of file +var _0x2dfc=['count','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset'];(function(_0x369477,_0x376d03){var _0x43ed3e=function(_0x2e66d4){while(--_0x2e66d4){_0x369477['push'](_0x369477['shift']());}};_0x43ed3e(++_0x376d03);}(_0x2dfc,0x10d));var _0xc2df=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x2dfc[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0xc2df('0x0'));var rimraf=require(_0xc2df('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc2df('0x2'));var rp=require(_0xc2df('0x3'));var moment=require(_0xc2df('0x4'));var BPromise=require(_0xc2df('0x5'));var Mustache=require(_0xc2df('0x6'));var util=require(_0xc2df('0x7'));var path=require('path');var sox=require(_0xc2df('0x8'));var csv=require(_0xc2df('0x9'));var ejs=require(_0xc2df('0xa'));var fs=require('fs');var fs_extra=require(_0xc2df('0xb'));var _=require(_0xc2df('0xc'));var squel=require(_0xc2df('0xd'));var crypto=require(_0xc2df('0xe'));var jsforce=require(_0xc2df('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc2df('0x9'));var querystring=require(_0xc2df('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc2df('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc2df('0x12'));var hardwareService=require(_0xc2df('0x13'));var logger=require(_0xc2df('0x14'))(_0xc2df('0x15'));var utils=require('../../config/utils');var config=require(_0xc2df('0x16'));var licenseUtil=require(_0xc2df('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ace33,_0x2ff3f4){_0x2ff3f4=_0x2ff3f4||0xcc;return function(_0x3630c5){if(_0x3630c5){return _0x3ace33[_0xc2df('0x18')](_0x2ff3f4);}return _0x3ace33[_0xc2df('0x19')](_0x2ff3f4)[_0xc2df('0x1a')]();};}function respondWithResult(_0x5c4b12,_0x56cb92){_0x56cb92=_0x56cb92||0xc8;return function(_0x2fa9f4){if(_0x2fa9f4){return _0x5c4b12[_0xc2df('0x19')](_0x56cb92)[_0xc2df('0x1b')](_0x2fa9f4);}};}function respondWithFilteredResult(_0x318c66,_0x242562){return function(_0x4991db){if(_0x4991db){var _0x1af8ae=typeof _0x242562['offset']==='undefined'&&typeof _0x242562[_0xc2df('0x1c')]===_0xc2df('0x1d');var _0x5b5b9a=_0x4991db['count'];var _0x21a976=_0x1af8ae?0x0:_0x242562[_0xc2df('0x1e')];var _0x3cbef7=_0x1af8ae?_0x4991db[_0xc2df('0x1f')]:_0x242562['offset']+_0x242562[_0xc2df('0x1c')];var _0x246b0f;if(_0x3cbef7>=_0x5b5b9a){_0x3cbef7=_0x5b5b9a;_0x246b0f=0xc8;}else{_0x246b0f=0xce;}_0x318c66[_0xc2df('0x19')](_0x246b0f);return _0x318c66['set']('Content-Range',_0x21a976+'-'+_0x3cbef7+'/'+_0x5b5b9a)[_0xc2df('0x1b')](_0x4991db);}return null;};}function patchUpdates(_0x21abcd){return function(_0x146a80){try{jsonpatch['apply'](_0x146a80,_0x21abcd,!![]);}catch(_0x1a328e){return BPromise[_0xc2df('0x20')](_0x1a328e);}return _0x146a80[_0xc2df('0x21')]();};}function saveUpdates(_0x9eac06,_0x52d17f){return function(_0x53b0ad){if(_0x53b0ad){return _0x53b0ad[_0xc2df('0x22')](_0x9eac06)[_0xc2df('0x23')](function(_0x43a693){return _0x43a693;});}return null;};}function removeEntity(_0x37add9,_0x1a6320){return function(_0x38b44e){if(_0x38b44e){return _0x38b44e[_0xc2df('0x24')]()[_0xc2df('0x23')](function(){_0x37add9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4cf65c,_0x3dc62e){return function(_0x1d3b66){if(!_0x1d3b66){_0x4cf65c[_0xc2df('0x18')](0x194);}return _0x1d3b66;};}function handleError(_0x1cb8f6,_0x1a647f){_0x1a647f=_0x1a647f||0x1f4;return function(_0xa862fb){logger[_0xc2df('0x25')](_0xa862fb[_0xc2df('0x26')]);if(_0xa862fb[_0xc2df('0x27')]){delete _0xa862fb['name'];}_0x1cb8f6['status'](_0x1a647f)[_0xc2df('0x28')](_0xa862fb);};}exports[_0xc2df('0x29')]=function(_0xf85862,_0x52a40e){var _0x528be5={},_0x768b69={},_0x27a14d={'count':0x0,'rows':[]};var _0x225bba=_[_0xc2df('0x2a')](db[_0xc2df('0x2b')][_0xc2df('0x2c')],function(_0x1c34be){return{'name':_0x1c34be[_0xc2df('0x2d')],'type':_0x1c34be[_0xc2df('0x2e')]['key']};});_0x768b69[_0xc2df('0x2f')]=_[_0xc2df('0x2a')](_0x225bba,_0xc2df('0x27'));_0x768b69[_0xc2df('0x30')]=_[_0xc2df('0x31')](_0xf85862[_0xc2df('0x30')]);_0x768b69[_0xc2df('0x32')]=_[_0xc2df('0x33')](_0x768b69[_0xc2df('0x2f')],_0x768b69['query']);_0x528be5['attributes']=_['intersection'](_0x768b69[_0xc2df('0x2f')],qs[_0xc2df('0x34')](_0xf85862['query'][_0xc2df('0x34')]));_0x528be5['attributes']=_0x528be5['attributes'][_0xc2df('0x35')]?_0x528be5[_0xc2df('0x36')]:_0x768b69['model'];if(!_0xf85862[_0xc2df('0x30')][_0xc2df('0x37')](_0xc2df('0x38'))){_0x528be5[_0xc2df('0x1c')]=qs['limit'](_0xf85862['query'][_0xc2df('0x1c')]);_0x528be5[_0xc2df('0x1e')]=qs[_0xc2df('0x1e')](_0xf85862[_0xc2df('0x30')][_0xc2df('0x1e')]);}_0x528be5['order']=qs[_0xc2df('0x39')](_0xf85862[_0xc2df('0x30')][_0xc2df('0x39')]);_0x528be5[_0xc2df('0x3a')]=qs[_0xc2df('0x32')](_[_0xc2df('0x3b')](_0xf85862[_0xc2df('0x30')],_0x768b69[_0xc2df('0x32')]),_0x225bba);if(_0xf85862['query'][_0xc2df('0x3c')]){_0x528be5['where']=_[_0xc2df('0x3d')](_0x528be5[_0xc2df('0x3a')],{'$or':_[_0xc2df('0x2a')](_0x225bba,function(_0x3eb187){if(_0x3eb187[_0xc2df('0x2e')]!==_0xc2df('0x3e')){var _0x293f1a={};_0x293f1a[_0x3eb187['name']]={'$like':'%'+_0xf85862[_0xc2df('0x30')][_0xc2df('0x3c')]+'%'};return _0x293f1a;}})});}_0x528be5=_['merge']({},_0x528be5,_0xf85862[_0xc2df('0x3f')]);var _0x436ce4={'where':_0x528be5[_0xc2df('0x3a')]};return db[_0xc2df('0x2b')][_0xc2df('0x1f')](_0x436ce4)[_0xc2df('0x23')](function(_0x121805){_0x27a14d['count']=_0x121805;if(_0xf85862['query'][_0xc2df('0x40')]){_0x528be5[_0xc2df('0x41')]=[{'all':!![]}];}return db['SquareReport'][_0xc2df('0x42')](_0x528be5);})[_0xc2df('0x23')](function(_0x3f6141){_0x27a14d[_0xc2df('0x43')]=_0x3f6141;return _0x27a14d;})[_0xc2df('0x23')](respondWithFilteredResult(_0x52a40e,_0x528be5))[_0xc2df('0x44')](handleError(_0x52a40e,null));};exports[_0xc2df('0x45')]=function(_0xae5def,_0x4ea8c9){var _0x491a6d={'raw':!![],'where':{'id':_0xae5def[_0xc2df('0x46')]['id']}},_0x100dcd={};_0x100dcd['model']=_[_0xc2df('0x31')](db['SquareReport'][_0xc2df('0x2c')]);_0x100dcd['query']=_[_0xc2df('0x31')](_0xae5def['query']);_0x100dcd[_0xc2df('0x32')]=_[_0xc2df('0x33')](_0x100dcd[_0xc2df('0x2f')],_0x100dcd[_0xc2df('0x30')]);_0x491a6d[_0xc2df('0x36')]=_[_0xc2df('0x33')](_0x100dcd[_0xc2df('0x2f')],qs[_0xc2df('0x34')](_0xae5def[_0xc2df('0x30')][_0xc2df('0x34')]));_0x491a6d[_0xc2df('0x36')]=_0x491a6d[_0xc2df('0x36')][_0xc2df('0x35')]?_0x491a6d[_0xc2df('0x36')]:_0x100dcd[_0xc2df('0x2f')];if(_0xae5def['query'][_0xc2df('0x40')]){_0x491a6d[_0xc2df('0x41')]=[{'all':!![]}];}_0x491a6d=_[_0xc2df('0x3d')]({},_0x491a6d,_0xae5def[_0xc2df('0x3f')]);return db[_0xc2df('0x2b')][_0xc2df('0x47')](_0x491a6d)['then'](handleEntityNotFound(_0x4ea8c9,null))[_0xc2df('0x23')](respondWithResult(_0x4ea8c9,null))[_0xc2df('0x44')](handleError(_0x4ea8c9,null));};exports[_0xc2df('0x48')]=function(_0x268ab0,_0x50456d){return db[_0xc2df('0x2b')][_0xc2df('0x48')](_0x268ab0['body'],{})['then'](respondWithResult(_0x50456d,0xc9))[_0xc2df('0x44')](handleError(_0x50456d,null));};exports[_0xc2df('0x22')]=function(_0x51d15f,_0x1eaa57){if(_0x51d15f[_0xc2df('0x49')]['id']){delete _0x51d15f[_0xc2df('0x49')]['id'];}return db['SquareReport'][_0xc2df('0x47')]({'where':{'id':_0x51d15f[_0xc2df('0x46')]['id']}})[_0xc2df('0x23')](handleEntityNotFound(_0x1eaa57,null))[_0xc2df('0x23')](saveUpdates(_0x51d15f[_0xc2df('0x49')],null))['then'](respondWithResult(_0x1eaa57,null))[_0xc2df('0x44')](handleError(_0x1eaa57,null));};exports[_0xc2df('0x24')]=function(_0x469d87,_0x5e2b87){return db[_0xc2df('0x2b')]['find']({'where':{'id':_0x469d87[_0xc2df('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e2b87,null))[_0xc2df('0x23')](removeEntity(_0x5e2b87,null))[_0xc2df('0x44')](handleError(_0x5e2b87,null));};exports['describe']=function(_0x521782,_0x3479a0){return db[_0xc2df('0x2b')][_0xc2df('0x4a')]()['then'](respondWithResult(_0x3479a0,null))[_0xc2df('0x44')](handleError(_0x3479a0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 15531b0..40a90aa 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 _0x39d7=['SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','exports','define'];(function(_0x1d1219,_0x23fc71){var _0x5b5b89=function(_0x3d85e5){while(--_0x3d85e5){_0x1d1219['push'](_0x1d1219['shift']());}};_0x5b5b89(++_0x23fc71);}(_0x39d7,0x1b6));var _0x739d=function(_0x489a61,_0x583cd5){_0x489a61=_0x489a61-0x0;var _0x2997fd=_0x39d7[_0x489a61];return _0x2997fd;};'use strict';var _=require(_0x739d('0x0'));var util=require(_0x739d('0x1'));var logger=require(_0x739d('0x2'))(_0x739d('0x3'));var moment=require(_0x739d('0x4'));var BPromise=require(_0x739d('0x5'));var rp=require(_0x739d('0x6'));var fs=require('fs');var path=require(_0x739d('0x7'));var rimraf=require('rimraf');var config=require(_0x739d('0x8'));var attributes=require(_0x739d('0x9'));module[_0x739d('0xa')]=function(_0x184031,_0x12c62b){return _0x184031[_0x739d('0xb')](_0x739d('0xc'),attributes,{'tableName':_0x739d('0xd'),'paranoid':![],'indexes':[{'name':_0x739d('0xe'),'fields':[_0x739d('0xf'),_0x739d('0x10')]},{'name':'leaveAt','fields':[_0x739d('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3a8e=['uid_pname','project_name','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./squareReport.attributes','exports','SquareReport'];(function(_0x3e393d,_0x22a6c0){var _0x2ccea4=function(_0x123bc4){while(--_0x123bc4){_0x3e393d['push'](_0x3e393d['shift']());}};_0x2ccea4(++_0x22a6c0);}(_0x3a8e,0x13b));var _0xe3a8=function(_0x19ae7a,_0x5d3b51){_0x19ae7a=_0x19ae7a-0x0;var _0x30d82e=_0x3a8e[_0x19ae7a];return _0x30d82e;};'use strict';var _=require('lodash');var util=require(_0xe3a8('0x0'));var logger=require(_0xe3a8('0x1'))(_0xe3a8('0x2'));var moment=require(_0xe3a8('0x3'));var BPromise=require(_0xe3a8('0x4'));var rp=require(_0xe3a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe3a8('0x6'));var config=require('../../config/environment');var attributes=require(_0xe3a8('0x7'));module[_0xe3a8('0x8')]=function(_0x18d39d,_0x4ee6cc){return _0x18d39d['define'](_0xe3a8('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xe3a8('0xa'),'fields':['uniqueid',_0xe3a8('0xb')]},{'name':_0xe3a8('0xc'),'fields':[_0xe3a8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 584d03e..5e2aaa0 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 _0xc83f=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','lodash','util'];(function(_0x2caf41,_0x5b398e){var _0x5ca4de=function(_0x5ae652){while(--_0x5ae652){_0x2caf41['push'](_0x2caf41['shift']());}};_0x5ca4de(++_0x5b398e);}(_0xc83f,0xf6));var _0xfc83=function(_0x5d04bc,_0x5662aa){_0x5d04bc=_0x5d04bc-0x0;var _0x29c6f1=_0xc83f[_0x5d04bc];return _0x29c6f1;};'use strict';var _=require(_0xfc83('0x0'));var util=require(_0xfc83('0x1'));var moment=require('moment');var BPromise=require(_0xfc83('0x2'));var rs=require(_0xfc83('0x3'));var fs=require('fs');var Redis=require(_0xfc83('0x4'));var db=require(_0xfc83('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc83('0x6'))(_0xfc83('0x7'));var config=require(_0xfc83('0x8'));var jayson=require(_0xfc83('0x9'));var client=jayson[_0xfc83('0xa')][_0xfc83('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29f022,_0x518046,_0xd9862f){return new BPromise(function(_0x2af3d2,_0x4e192a){return client['request'](_0x29f022,_0xd9862f)[_0xfc83('0xc')](function(_0x2322a5){logger['info'](_0xfc83('0xd'),_0x518046,_0xfc83('0xe'));logger[_0xfc83('0xf')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x518046,_0xfc83('0xe'),JSON[_0xfc83('0x10')](_0x2322a5));if(_0x2322a5[_0xfc83('0x11')]){if(_0x2322a5[_0xfc83('0x11')][_0xfc83('0x12')]===0x1f4){logger['error'](_0xfc83('0xd'),_0x518046,_0x2322a5['error'][_0xfc83('0x13')]);return _0x4e192a(_0x2322a5[_0xfc83('0x11')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x518046,_0x2322a5[_0xfc83('0x11')][_0xfc83('0x13')]);return _0x2af3d2(_0x2322a5[_0xfc83('0x11')][_0xfc83('0x13')]);}else{logger[_0xfc83('0x14')]('SquareReport,\x20%s,\x20%s',_0x518046,_0xfc83('0xe'));_0x2af3d2(_0x2322a5['result']['message']);}})[_0xfc83('0x15')](function(_0x335ed1){logger[_0xfc83('0x11')]('SquareReport,\x20%s,\x20%s',_0x518046,_0x335ed1);_0x4e192a(_0x335ed1);});});}exports[_0xfc83('0x16')]=function(_0x1f7eca){var _0x29f0c7=this;return new Promise(function(_0x1aec02,_0x245424){return db[_0xfc83('0x17')][_0xfc83('0x18')](_0x1f7eca[_0xfc83('0x19')],{'raw':_0x1f7eca['options']?_0x1f7eca[_0xfc83('0x1a')][_0xfc83('0x1b')]===undefined?!![]:![]:!![]})[_0xfc83('0xc')](function(_0x54ff9c){logger['info']('CreateSquareReport',_0x1f7eca);logger[_0xfc83('0xf')](_0xfc83('0x16'),_0x1f7eca,JSON['stringify'](_0x54ff9c));_0x1aec02(_0x54ff9c);})[_0xfc83('0x15')](function(_0x2c0780){logger[_0xfc83('0x11')](_0xfc83('0x16'),_0x2c0780[_0xfc83('0x13')],_0x1f7eca);_0x245424(_0x29f0c7[_0xfc83('0x11')](0x1f4,_0x2c0780[_0xfc83('0x13')]));});});};exports[_0xfc83('0x1c')]=function(_0x4cb8ba){var _0x40c5f2=this;return new Promise(function(_0x3af461,_0x3bf0f8){return db[_0xfc83('0x17')][_0xfc83('0x1d')](_0x4cb8ba[_0xfc83('0x19')],{'raw':_0x4cb8ba['options']?_0x4cb8ba[_0xfc83('0x1a')][_0xfc83('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cb8ba[_0xfc83('0x1a')]?_0x4cb8ba[_0xfc83('0x1a')][_0xfc83('0x1e')]||null:null,'attributes':_0x4cb8ba[_0xfc83('0x1a')]?_0x4cb8ba[_0xfc83('0x1a')]['attributes']||null:null,'limit':_0x4cb8ba['options']?_0x4cb8ba[_0xfc83('0x1a')]['limit']||null:null})['then'](function(_0x1eb9ab){logger['info']('UpdateSquareReport',_0x4cb8ba);logger[_0xfc83('0xf')](_0xfc83('0x1c'),_0x4cb8ba,JSON[_0xfc83('0x10')](_0x1eb9ab));_0x3af461(_0x1eb9ab);})[_0xfc83('0x15')](function(_0x296a1e){logger[_0xfc83('0x11')]('UpdateSquareReport',_0x296a1e[_0xfc83('0x13')],_0x4cb8ba);_0x3bf0f8(_0x40c5f2[_0xfc83('0x11')](0x1f4,_0x296a1e[_0xfc83('0x13')]));});});}; \ No newline at end of file +var _0x6240=['SquareReport','create','body','options','then','UpdateSquareReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','http','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','CreateSquareReport'];(function(_0x5a7b76,_0x175234){var _0x29fa09=function(_0x579d7d){while(--_0x579d7d){_0x5a7b76['push'](_0x5a7b76['shift']());}};_0x29fa09(++_0x175234);}(_0x6240,0x19e));var _0x0624=function(_0x2c4901,_0x20adc5){_0x2c4901=_0x2c4901-0x0;var _0x444c6b=_0x6240[_0x2c4901];return _0x444c6b;};'use strict';var _=require(_0x0624('0x0'));var util=require(_0x0624('0x1'));var moment=require(_0x0624('0x2'));var BPromise=require(_0x0624('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0624('0x4'));var db=require(_0x0624('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['client'][_0x0624('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3e4df4,_0x51ee0c,_0x577c0){return new BPromise(function(_0x26912e,_0x4cac0f){return client['request'](_0x3e4df4,_0x577c0)['then'](function(_0x127363){logger[_0x0624('0x7')](_0x0624('0x8'),_0x51ee0c,_0x0624('0x9'));logger[_0x0624('0xa')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x51ee0c,_0x0624('0x9'),JSON[_0x0624('0xb')](_0x127363));if(_0x127363['error']){if(_0x127363['error'][_0x0624('0xc')]===0x1f4){logger[_0x0624('0xd')](_0x0624('0x8'),_0x51ee0c,_0x127363[_0x0624('0xd')][_0x0624('0xe')]);return _0x4cac0f(_0x127363[_0x0624('0xd')][_0x0624('0xe')]);}logger['error'](_0x0624('0x8'),_0x51ee0c,_0x127363['error'][_0x0624('0xe')]);return _0x26912e(_0x127363[_0x0624('0xd')][_0x0624('0xe')]);}else{logger[_0x0624('0x7')](_0x0624('0x8'),_0x51ee0c,_0x0624('0x9'));_0x26912e(_0x127363[_0x0624('0xf')][_0x0624('0xe')]);}})[_0x0624('0x10')](function(_0x542fdc){logger[_0x0624('0xd')]('SquareReport,\x20%s,\x20%s',_0x51ee0c,_0x542fdc);_0x4cac0f(_0x542fdc);});});}exports[_0x0624('0x11')]=function(_0x395f04){var _0x13661d=this;return new Promise(function(_0x14d932,_0x2507d3){return db[_0x0624('0x12')][_0x0624('0x13')](_0x395f04[_0x0624('0x14')],{'raw':_0x395f04[_0x0624('0x15')]?_0x395f04[_0x0624('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x0624('0x16')](function(_0x167d8b){logger[_0x0624('0x7')](_0x0624('0x11'),_0x395f04);logger[_0x0624('0xa')](_0x0624('0x11'),_0x395f04,JSON[_0x0624('0xb')](_0x167d8b));_0x14d932(_0x167d8b);})[_0x0624('0x10')](function(_0x165d6e){logger['error'](_0x0624('0x11'),_0x165d6e[_0x0624('0xe')],_0x395f04);_0x2507d3(_0x13661d[_0x0624('0xd')](0x1f4,_0x165d6e[_0x0624('0xe')]));});});};exports[_0x0624('0x17')]=function(_0x278b14){var _0x11ad9a=this;return new Promise(function(_0x1a6281,_0x4a4f1e){return db[_0x0624('0x12')]['update'](_0x278b14[_0x0624('0x14')],{'raw':_0x278b14[_0x0624('0x15')]?_0x278b14['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x278b14[_0x0624('0x15')]?_0x278b14[_0x0624('0x15')][_0x0624('0x18')]||null:null,'attributes':_0x278b14['options']?_0x278b14[_0x0624('0x15')][_0x0624('0x19')]||null:null,'limit':_0x278b14[_0x0624('0x15')]?_0x278b14['options'][_0x0624('0x1a')]||null:null})[_0x0624('0x16')](function(_0x45f2b9){logger[_0x0624('0x7')](_0x0624('0x17'),_0x278b14);logger[_0x0624('0xa')](_0x0624('0x17'),_0x278b14,JSON['stringify'](_0x45f2b9));_0x1a6281(_0x45f2b9);})[_0x0624('0x10')](function(_0x465719){logger['error'](_0x0624('0x17'),_0x465719['message'],_0x278b14);_0x4a4f1e(_0x11ad9a[_0x0624('0xd')](0x1f4,_0x465719[_0x0624('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 5dca653..a2b127f 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 _0xaa68=['/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','path','express','Router','fs-extra','./squareReportDetail.controller','get','index'];(function(_0x3e4899,_0x4909a1){var _0x5cff33=function(_0x1430b2){while(--_0x1430b2){_0x3e4899['push'](_0x3e4899['shift']());}};_0x5cff33(++_0x4909a1);}(_0xaa68,0x7d));var _0x8aa6=function(_0x4d497f,_0xee4daa){_0x4d497f=_0x4d497f-0x0;var _0x440ba2=_0xaa68[_0x4d497f];return _0x440ba2;};'use strict';var multer=require(_0x8aa6('0x0'));var util=require('util');var path=require(_0x8aa6('0x1'));var timeout=require('connect-timeout');var express=require(_0x8aa6('0x2'));var router=express[_0x8aa6('0x3')]();var fs_extra=require(_0x8aa6('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8aa6('0x5'));router[_0x8aa6('0x6')]('/',auth['isAuthenticated'](),controller[_0x8aa6('0x7')]);router[_0x8aa6('0x6')](_0x8aa6('0x8'),auth[_0x8aa6('0x9')](),controller[_0x8aa6('0xa')]);router['get'](_0x8aa6('0xb'),auth[_0x8aa6('0x9')](),controller[_0x8aa6('0xc')]);router[_0x8aa6('0xd')]('/',auth[_0x8aa6('0x9')](),controller[_0x8aa6('0xe')]);router[_0x8aa6('0xf')](_0x8aa6('0xb'),auth[_0x8aa6('0x9')](),controller['update']);router[_0x8aa6('0x10')](_0x8aa6('0xb'),auth[_0x8aa6('0x9')](),controller[_0x8aa6('0x11')]);module[_0x8aa6('0x12')]=router; \ No newline at end of file +var _0x0306=['isAuthenticated','get','/:id','show','post','create','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller'];(function(_0x5d5f3c,_0x5f4688){var _0x291fd7=function(_0x13a7a2){while(--_0x13a7a2){_0x5d5f3c['push'](_0x5d5f3c['shift']());}};_0x291fd7(++_0x5f4688);}(_0x0306,0x18f));var _0x6030=function(_0x3fa214,_0x212fb9){_0x3fa214=_0x3fa214-0x0;var _0x8a8cbf=_0x0306[_0x3fa214];return _0x8a8cbf;};'use strict';var multer=require('multer');var util=require(_0x6030('0x0'));var path=require(_0x6030('0x1'));var timeout=require(_0x6030('0x2'));var express=require(_0x6030('0x3'));var router=express['Router']();var fs_extra=require(_0x6030('0x4'));var auth=require(_0x6030('0x5'));var interaction=require(_0x6030('0x6'));var config=require(_0x6030('0x7'));var controller=require(_0x6030('0x8'));router['get']('/',auth[_0x6030('0x9')](),controller['index']);router[_0x6030('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x6030('0xb'),auth[_0x6030('0x9')](),controller[_0x6030('0xc')]);router[_0x6030('0xd')]('/',auth[_0x6030('0x9')](),controller[_0x6030('0xe')]);router['put']('/:id',auth[_0x6030('0x9')](),controller['update']);router[_0x6030('0xf')](_0x6030('0xb'),auth[_0x6030('0x9')](),controller[_0x6030('0x10')]);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 01ba6e4..aa2068f 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 _0xf9c3=['TEXT','sequelize','STRING'];(function(_0x495cd2,_0x3b5c5e){var _0x3e9ea9=function(_0x1c7e63){while(--_0x1c7e63){_0x495cd2['push'](_0x495cd2['shift']());}};_0x3e9ea9(++_0x3b5c5e);}(_0xf9c3,0xfa));var _0x3f9c=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xf9c3[_0x1c546c];return _0x2cc384;};'use strict';var Sequelize=require(_0x3f9c('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x3f9c('0x1')]},'application':{'type':Sequelize[_0x3f9c('0x1')]},'data':{'type':Sequelize[_0x3f9c('0x2')]},'project_name':{'type':Sequelize[_0x3f9c('0x1')]},'callerid':{'type':Sequelize[_0x3f9c('0x1')]}}; \ No newline at end of file +var _0x5c38=['sequelize','exports','STRING','TEXT'];(function(_0x44c3c1,_0x33d4cd){var _0x3a78ba=function(_0x1d8cbc){while(--_0x1d8cbc){_0x44c3c1['push'](_0x44c3c1['shift']());}};_0x3a78ba(++_0x33d4cd);}(_0x5c38,0x1f0));var _0x85c3=function(_0xb432dc,_0x23be94){_0xb432dc=_0xb432dc-0x0;var _0x563c67=_0x5c38[_0xb432dc];return _0x563c67;};'use strict';var Sequelize=require(_0x85c3('0x0'));module[_0x85c3('0x1')]={'uniqueid':{'type':Sequelize[_0x85c3('0x2')]},'node':{'type':Sequelize[_0x85c3('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x85c3('0x3')]},'project_name':{'type':Sequelize[_0x85c3('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0776ccb..cd30be2 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 _0xc699=['apply','reject','save','update','then','sendStatus','error','stack','send','map','rawAttributes','fieldName','name','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','SquareDetailsReport','includeAll','findAll','rows','show','params','find','catch','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../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'];(function(_0x52f181,_0x17023f){var _0x2aaca0=function(_0x14e29e){while(--_0x14e29e){_0x52f181['push'](_0x52f181['shift']());}};_0x2aaca0(++_0x17023f);}(_0xc699,0x1ad));var _0x9c69=function(_0x4d05dd,_0x258cdd){_0x4d05dd=_0x4d05dd-0x0;var _0x1c5226=_0xc699[_0x4d05dd];return _0x1c5226;};'use strict';var emlformat=require(_0x9c69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c69('0x1'));var jsonpatch=require(_0x9c69('0x2'));var rp=require('request-promise');var moment=require(_0x9c69('0x3'));var BPromise=require(_0x9c69('0x4'));var Mustache=require(_0x9c69('0x5'));var util=require(_0x9c69('0x6'));var path=require(_0x9c69('0x7'));var sox=require(_0x9c69('0x8'));var csv=require(_0x9c69('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c69('0xa'));var squel=require(_0x9c69('0xb'));var crypto=require(_0x9c69('0xc'));var jsforce=require(_0x9c69('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9c69('0xe'));var Papa=require(_0x9c69('0xf'));var Redis=require(_0x9c69('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9c69('0x11'));var hardwareService=require(_0x9c69('0x12'));var logger=require(_0x9c69('0x13'))(_0x9c69('0x14'));var utils=require(_0x9c69('0x15'));var config=require(_0x9c69('0x16'));var licenseUtil=require(_0x9c69('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6b14dd,_0x4f640e){_0x4f640e=_0x4f640e||0xcc;return function(_0x23ea5c){if(_0x23ea5c){return _0x6b14dd['sendStatus'](_0x4f640e);}return _0x6b14dd[_0x9c69('0x18')](_0x4f640e)[_0x9c69('0x19')]();};}function respondWithResult(_0x1f5822,_0x261752){_0x261752=_0x261752||0xc8;return function(_0x76bae4){if(_0x76bae4){return _0x1f5822[_0x9c69('0x18')](_0x261752)[_0x9c69('0x1a')](_0x76bae4);}};}function respondWithFilteredResult(_0x23c52b,_0x78057f){return function(_0x1bdac4){if(_0x1bdac4){var _0x3a84ed=typeof _0x78057f[_0x9c69('0x1b')]===_0x9c69('0x1c')&&typeof _0x78057f[_0x9c69('0x1d')]===_0x9c69('0x1c');var _0x39c62d=_0x1bdac4[_0x9c69('0x1e')];var _0x5ac0a0=_0x3a84ed?0x0:_0x78057f['offset'];var _0x46b8f2=_0x3a84ed?_0x1bdac4['count']:_0x78057f[_0x9c69('0x1b')]+_0x78057f[_0x9c69('0x1d')];var _0x4f258f;if(_0x46b8f2>=_0x39c62d){_0x46b8f2=_0x39c62d;_0x4f258f=0xc8;}else{_0x4f258f=0xce;}_0x23c52b[_0x9c69('0x18')](_0x4f258f);return _0x23c52b[_0x9c69('0x1f')](_0x9c69('0x20'),_0x5ac0a0+'-'+_0x46b8f2+'/'+_0x39c62d)[_0x9c69('0x1a')](_0x1bdac4);}return null;};}function patchUpdates(_0x4c24d7){return function(_0x211fe0){try{jsonpatch[_0x9c69('0x21')](_0x211fe0,_0x4c24d7,!![]);}catch(_0x22aea8){return BPromise[_0x9c69('0x22')](_0x22aea8);}return _0x211fe0[_0x9c69('0x23')]();};}function saveUpdates(_0x1f4f4c,_0x2812bc){return function(_0x2787fd){if(_0x2787fd){return _0x2787fd[_0x9c69('0x24')](_0x1f4f4c)[_0x9c69('0x25')](function(_0x54249e){return _0x54249e;});}return null;};}function removeEntity(_0x493ea3,_0x4a60a8){return function(_0x29f954){if(_0x29f954){return _0x29f954['destroy']()['then'](function(){_0x493ea3[_0x9c69('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f4b1,_0x2dfcc3){return function(_0x572859){if(!_0x572859){_0x40f4b1[_0x9c69('0x26')](0x194);}return _0x572859;};}function handleError(_0x4f87c8,_0x3ce45e){_0x3ce45e=_0x3ce45e||0x1f4;return function(_0x4beedf){logger[_0x9c69('0x27')](_0x4beedf[_0x9c69('0x28')]);if(_0x4beedf['name']){delete _0x4beedf['name'];}_0x4f87c8[_0x9c69('0x18')](_0x3ce45e)[_0x9c69('0x29')](_0x4beedf);};}exports['index']=function(_0xa0b32f,_0xf0acfd){var _0x5c34d7={},_0xca62bf={},_0x2dbf17={'count':0x0,'rows':[]};var _0x4f7333=_[_0x9c69('0x2a')](db['SquareDetailsReport'][_0x9c69('0x2b')],function(_0x1cb41f){return{'name':_0x1cb41f[_0x9c69('0x2c')],'type':_0x1cb41f['type']['key']};});_0xca62bf['model']=_[_0x9c69('0x2a')](_0x4f7333,_0x9c69('0x2d'));_0xca62bf[_0x9c69('0x2e')]=_[_0x9c69('0x2f')](_0xa0b32f[_0x9c69('0x2e')]);_0xca62bf[_0x9c69('0x30')]=_[_0x9c69('0x31')](_0xca62bf['model'],_0xca62bf[_0x9c69('0x2e')]);_0x5c34d7[_0x9c69('0x32')]=_[_0x9c69('0x31')](_0xca62bf[_0x9c69('0x33')],qs['fields'](_0xa0b32f[_0x9c69('0x2e')][_0x9c69('0x34')]));_0x5c34d7[_0x9c69('0x32')]=_0x5c34d7[_0x9c69('0x32')][_0x9c69('0x35')]?_0x5c34d7[_0x9c69('0x32')]:_0xca62bf[_0x9c69('0x33')];if(!_0xa0b32f[_0x9c69('0x2e')][_0x9c69('0x36')](_0x9c69('0x37'))){_0x5c34d7[_0x9c69('0x1d')]=qs['limit'](_0xa0b32f['query']['limit']);_0x5c34d7[_0x9c69('0x1b')]=qs['offset'](_0xa0b32f['query']['offset']);}_0x5c34d7[_0x9c69('0x38')]=qs[_0x9c69('0x39')](_0xa0b32f[_0x9c69('0x2e')][_0x9c69('0x39')]);_0x5c34d7[_0x9c69('0x3a')]=qs[_0x9c69('0x30')](_[_0x9c69('0x3b')](_0xa0b32f['query'],_0xca62bf[_0x9c69('0x30')]),_0x4f7333);if(_0xa0b32f[_0x9c69('0x2e')][_0x9c69('0x3c')]){_0x5c34d7[_0x9c69('0x3a')]=_[_0x9c69('0x3d')](_0x5c34d7[_0x9c69('0x3a')],{'$or':_[_0x9c69('0x2a')](_0x4f7333,function(_0x695443){if(_0x695443[_0x9c69('0x3e')]!==_0x9c69('0x3f')){var _0xbce143={};_0xbce143[_0x695443[_0x9c69('0x2d')]]={'$like':'%'+_0xa0b32f['query'][_0x9c69('0x3c')]+'%'};return _0xbce143;}})});}_0x5c34d7=_[_0x9c69('0x3d')]({},_0x5c34d7,_0xa0b32f[_0x9c69('0x40')]);var _0x4a8779={'where':_0x5c34d7[_0x9c69('0x3a')]};return db[_0x9c69('0x41')]['count'](_0x4a8779)['then'](function(_0x4c9fde){_0x2dbf17['count']=_0x4c9fde;if(_0xa0b32f['query'][_0x9c69('0x42')]){_0x5c34d7['include']=[{'all':!![]}];}return db[_0x9c69('0x41')][_0x9c69('0x43')](_0x5c34d7);})[_0x9c69('0x25')](function(_0xbcdc23){_0x2dbf17[_0x9c69('0x44')]=_0xbcdc23;return _0x2dbf17;})[_0x9c69('0x25')](respondWithFilteredResult(_0xf0acfd,_0x5c34d7))['catch'](handleError(_0xf0acfd,null));};exports[_0x9c69('0x45')]=function(_0x3438c5,_0x8c3c37){var _0x2bb616={'raw':!![],'where':{'id':_0x3438c5[_0x9c69('0x46')]['id']}},_0x5e3757={};_0x5e3757[_0x9c69('0x33')]=_[_0x9c69('0x2f')](db[_0x9c69('0x41')][_0x9c69('0x2b')]);_0x5e3757[_0x9c69('0x2e')]=_[_0x9c69('0x2f')](_0x3438c5['query']);_0x5e3757[_0x9c69('0x30')]=_[_0x9c69('0x31')](_0x5e3757['model'],_0x5e3757[_0x9c69('0x2e')]);_0x2bb616['attributes']=_[_0x9c69('0x31')](_0x5e3757[_0x9c69('0x33')],qs['fields'](_0x3438c5[_0x9c69('0x2e')]['fields']));_0x2bb616[_0x9c69('0x32')]=_0x2bb616[_0x9c69('0x32')][_0x9c69('0x35')]?_0x2bb616[_0x9c69('0x32')]:_0x5e3757[_0x9c69('0x33')];if(_0x3438c5[_0x9c69('0x2e')][_0x9c69('0x42')]){_0x2bb616['include']=[{'all':!![]}];}_0x2bb616=_[_0x9c69('0x3d')]({},_0x2bb616,_0x3438c5['options']);return db[_0x9c69('0x41')][_0x9c69('0x47')](_0x2bb616)[_0x9c69('0x25')](handleEntityNotFound(_0x8c3c37,null))[_0x9c69('0x25')](respondWithResult(_0x8c3c37,null))[_0x9c69('0x48')](handleError(_0x8c3c37,null));};exports[_0x9c69('0x49')]=function(_0x269a7d,_0x402365){return db[_0x9c69('0x41')]['create'](_0x269a7d[_0x9c69('0x4a')],{})['then'](respondWithResult(_0x402365,0xc9))['catch'](handleError(_0x402365,null));};exports[_0x9c69('0x24')]=function(_0x71ffc3,_0xf9e85e){if(_0x71ffc3['body']['id']){delete _0x71ffc3[_0x9c69('0x4a')]['id'];}return db[_0x9c69('0x41')][_0x9c69('0x47')]({'where':{'id':_0x71ffc3['params']['id']}})[_0x9c69('0x25')](handleEntityNotFound(_0xf9e85e,null))[_0x9c69('0x25')](saveUpdates(_0x71ffc3[_0x9c69('0x4a')],null))[_0x9c69('0x25')](respondWithResult(_0xf9e85e,null))[_0x9c69('0x48')](handleError(_0xf9e85e,null));};exports[_0x9c69('0x4b')]=function(_0x3a9839,_0x240f48){return db['SquareDetailsReport']['find']({'where':{'id':_0x3a9839[_0x9c69('0x46')]['id']}})[_0x9c69('0x25')](handleEntityNotFound(_0x240f48,null))[_0x9c69('0x25')](removeEntity(_0x240f48,null))['catch'](handleError(_0x240f48,null));};exports[_0x9c69('0x4c')]=function(_0x13cf23,_0x3907e3){return db[_0x9c69('0x41')][_0x9c69('0x4c')]()[_0x9c69('0x25')](respondWithResult(_0x3907e3,null))[_0x9c69('0x48')](handleError(_0x3907e3,null));}; \ No newline at end of file +var _0x349b=['crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','apply','reject','update','then','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x3a9e67,_0x119c80){var _0x258be6=function(_0x3bd8ad){while(--_0x3bd8ad){_0x3a9e67['push'](_0x3a9e67['shift']());}};_0x258be6(++_0x119c80);}(_0x349b,0x87));var _0xb349=function(_0x7febc0,_0x58a32c){_0x7febc0=_0x7febc0-0x0;var _0x49aa9b=_0x349b[_0x7febc0];return _0x49aa9b;};'use strict';var emlformat=require(_0xb349('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb349('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb349('0x2'));var moment=require(_0xb349('0x3'));var BPromise=require(_0xb349('0x4'));var Mustache=require(_0xb349('0x5'));var util=require(_0xb349('0x6'));var path=require(_0xb349('0x7'));var sox=require(_0xb349('0x8'));var csv=require(_0xb349('0x9'));var ejs=require(_0xb349('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb349('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb349('0x9'));var querystring=require(_0xb349('0xc'));var Papa=require(_0xb349('0xd'));var Redis=require('ioredis');var authService=require(_0xb349('0xe'));var qs=require(_0xb349('0xf'));var as=require(_0xb349('0x10'));var hardwareService=require(_0xb349('0x11'));var logger=require(_0xb349('0x12'))(_0xb349('0x13'));var utils=require(_0xb349('0x14'));var config=require(_0xb349('0x15'));var licenseUtil=require(_0xb349('0x16'));var db=require(_0xb349('0x17'))['db'];function respondWithStatusCode(_0x5c80c9,_0xcd8b5){_0xcd8b5=_0xcd8b5||0xcc;return function(_0x38540c){if(_0x38540c){return _0x5c80c9[_0xb349('0x18')](_0xcd8b5);}return _0x5c80c9[_0xb349('0x19')](_0xcd8b5)[_0xb349('0x1a')]();};}function respondWithResult(_0x5d639f,_0x145060){_0x145060=_0x145060||0xc8;return function(_0x5e6d4a){if(_0x5e6d4a){return _0x5d639f['status'](_0x145060)['json'](_0x5e6d4a);}};}function respondWithFilteredResult(_0x3e73cf,_0x473246){return function(_0x188664){if(_0x188664){var _0x49d04c=typeof _0x473246['offset']===_0xb349('0x1b')&&typeof _0x473246[_0xb349('0x1c')]===_0xb349('0x1b');var _0x1ec57d=_0x188664[_0xb349('0x1d')];var _0x4825db=_0x49d04c?0x0:_0x473246[_0xb349('0x1e')];var _0x2d5362=_0x49d04c?_0x188664[_0xb349('0x1d')]:_0x473246[_0xb349('0x1e')]+_0x473246[_0xb349('0x1c')];var _0x1384fe;if(_0x2d5362>=_0x1ec57d){_0x2d5362=_0x1ec57d;_0x1384fe=0xc8;}else{_0x1384fe=0xce;}_0x3e73cf[_0xb349('0x19')](_0x1384fe);return _0x3e73cf['set']('Content-Range',_0x4825db+'-'+_0x2d5362+'/'+_0x1ec57d)['json'](_0x188664);}return null;};}function patchUpdates(_0x2d789a){return function(_0x1c95ce){try{jsonpatch[_0xb349('0x1f')](_0x1c95ce,_0x2d789a,!![]);}catch(_0xda7abf){return BPromise[_0xb349('0x20')](_0xda7abf);}return _0x1c95ce['save']();};}function saveUpdates(_0x4f3d69,_0xc93fca){return function(_0x1ec9f1){if(_0x1ec9f1){return _0x1ec9f1[_0xb349('0x21')](_0x4f3d69)['then'](function(_0x403ee7){return _0x403ee7;});}return null;};}function removeEntity(_0x5ac676,_0x2ff538){return function(_0xfbcc30){if(_0xfbcc30){return _0xfbcc30['destroy']()[_0xb349('0x22')](function(){_0x5ac676[_0xb349('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x259931,_0x2f97c6){return function(_0x588dc2){if(!_0x588dc2){_0x259931[_0xb349('0x18')](0x194);}return _0x588dc2;};}function handleError(_0x2cd7ab,_0x3272a7){_0x3272a7=_0x3272a7||0x1f4;return function(_0x1161e1){logger[_0xb349('0x23')](_0x1161e1[_0xb349('0x24')]);if(_0x1161e1[_0xb349('0x25')]){delete _0x1161e1['name'];}_0x2cd7ab[_0xb349('0x19')](_0x3272a7)[_0xb349('0x26')](_0x1161e1);};}exports[_0xb349('0x27')]=function(_0x23e667,_0x5cfdc7){var _0x5d53b4={},_0x4179ac={},_0x13320d={'count':0x0,'rows':[]};var _0x56dd97=_[_0xb349('0x28')](db[_0xb349('0x29')]['rawAttributes'],function(_0x3d1140){return{'name':_0x3d1140[_0xb349('0x2a')],'type':_0x3d1140[_0xb349('0x2b')][_0xb349('0x2c')]};});_0x4179ac[_0xb349('0x2d')]=_['map'](_0x56dd97,_0xb349('0x25'));_0x4179ac['query']=_[_0xb349('0x2e')](_0x23e667[_0xb349('0x2f')]);_0x4179ac[_0xb349('0x30')]=_[_0xb349('0x31')](_0x4179ac[_0xb349('0x2d')],_0x4179ac[_0xb349('0x2f')]);_0x5d53b4['attributes']=_['intersection'](_0x4179ac[_0xb349('0x2d')],qs['fields'](_0x23e667[_0xb349('0x2f')][_0xb349('0x32')]));_0x5d53b4['attributes']=_0x5d53b4[_0xb349('0x33')][_0xb349('0x34')]?_0x5d53b4[_0xb349('0x33')]:_0x4179ac[_0xb349('0x2d')];if(!_0x23e667['query']['hasOwnProperty'](_0xb349('0x35'))){_0x5d53b4['limit']=qs['limit'](_0x23e667[_0xb349('0x2f')][_0xb349('0x1c')]);_0x5d53b4[_0xb349('0x1e')]=qs[_0xb349('0x1e')](_0x23e667[_0xb349('0x2f')][_0xb349('0x1e')]);}_0x5d53b4[_0xb349('0x36')]=qs[_0xb349('0x37')](_0x23e667[_0xb349('0x2f')][_0xb349('0x37')]);_0x5d53b4['where']=qs[_0xb349('0x30')](_[_0xb349('0x38')](_0x23e667[_0xb349('0x2f')],_0x4179ac[_0xb349('0x30')]),_0x56dd97);if(_0x23e667[_0xb349('0x2f')]['filter']){_0x5d53b4['where']=_[_0xb349('0x39')](_0x5d53b4[_0xb349('0x3a')],{'$or':_[_0xb349('0x28')](_0x56dd97,function(_0x169a2e){if(_0x169a2e[_0xb349('0x2b')]!==_0xb349('0x3b')){var _0x437819={};_0x437819[_0x169a2e[_0xb349('0x25')]]={'$like':'%'+_0x23e667[_0xb349('0x2f')]['filter']+'%'};return _0x437819;}})});}_0x5d53b4=_[_0xb349('0x39')]({},_0x5d53b4,_0x23e667[_0xb349('0x3c')]);var _0x2f5128={'where':_0x5d53b4[_0xb349('0x3a')]};return db[_0xb349('0x29')]['count'](_0x2f5128)['then'](function(_0x3873d1){_0x13320d['count']=_0x3873d1;if(_0x23e667[_0xb349('0x2f')][_0xb349('0x3d')]){_0x5d53b4[_0xb349('0x3e')]=[{'all':!![]}];}return db[_0xb349('0x29')]['findAll'](_0x5d53b4);})[_0xb349('0x22')](function(_0x4a1025){_0x13320d[_0xb349('0x3f')]=_0x4a1025;return _0x13320d;})['then'](respondWithFilteredResult(_0x5cfdc7,_0x5d53b4))['catch'](handleError(_0x5cfdc7,null));};exports[_0xb349('0x40')]=function(_0x5f475c,_0x472769){var _0x216c83={'raw':!![],'where':{'id':_0x5f475c[_0xb349('0x41')]['id']}},_0x54663e={};_0x54663e[_0xb349('0x2d')]=_[_0xb349('0x2e')](db[_0xb349('0x29')][_0xb349('0x42')]);_0x54663e[_0xb349('0x2f')]=_[_0xb349('0x2e')](_0x5f475c[_0xb349('0x2f')]);_0x54663e[_0xb349('0x30')]=_[_0xb349('0x31')](_0x54663e['model'],_0x54663e[_0xb349('0x2f')]);_0x216c83[_0xb349('0x33')]=_[_0xb349('0x31')](_0x54663e[_0xb349('0x2d')],qs[_0xb349('0x32')](_0x5f475c['query']['fields']));_0x216c83[_0xb349('0x33')]=_0x216c83[_0xb349('0x33')][_0xb349('0x34')]?_0x216c83[_0xb349('0x33')]:_0x54663e[_0xb349('0x2d')];if(_0x5f475c['query'][_0xb349('0x3d')]){_0x216c83[_0xb349('0x3e')]=[{'all':!![]}];}_0x216c83=_['merge']({},_0x216c83,_0x5f475c[_0xb349('0x3c')]);return db['SquareDetailsReport'][_0xb349('0x43')](_0x216c83)['then'](handleEntityNotFound(_0x472769,null))[_0xb349('0x22')](respondWithResult(_0x472769,null))[_0xb349('0x44')](handleError(_0x472769,null));};exports[_0xb349('0x45')]=function(_0x2b9d0f,_0x3a8009){return db['SquareDetailsReport']['create'](_0x2b9d0f[_0xb349('0x46')],{})[_0xb349('0x22')](respondWithResult(_0x3a8009,0xc9))['catch'](handleError(_0x3a8009,null));};exports[_0xb349('0x21')]=function(_0x551bdc,_0xd9391b){if(_0x551bdc['body']['id']){delete _0x551bdc[_0xb349('0x46')]['id'];}return db[_0xb349('0x29')]['find']({'where':{'id':_0x551bdc['params']['id']}})[_0xb349('0x22')](handleEntityNotFound(_0xd9391b,null))[_0xb349('0x22')](saveUpdates(_0x551bdc[_0xb349('0x46')],null))[_0xb349('0x22')](respondWithResult(_0xd9391b,null))[_0xb349('0x44')](handleError(_0xd9391b,null));};exports[_0xb349('0x47')]=function(_0x190b28,_0x5bd1b1){return db['SquareDetailsReport'][_0xb349('0x43')]({'where':{'id':_0x190b28[_0xb349('0x41')]['id']}})['then'](handleEntityNotFound(_0x5bd1b1,null))[_0xb349('0x22')](removeEntity(_0x5bd1b1,null))[_0xb349('0x44')](handleError(_0x5bd1b1,null));};exports[_0xb349('0x48')]=function(_0x19740c,_0x40e1a8){return db[_0xb349('0x29')][_0xb349('0x48')]()[_0xb349('0x22')](respondWithResult(_0x40e1a8,null))[_0xb349('0x44')](handleError(_0x40e1a8,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 31e0bb1..0f2f913 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 _0xa7be=['define','util','moment','bluebird','path','../../config/environment','./squareReportDetail.attributes','exports'];(function(_0x165fd2,_0x1b4eb2){var _0x12e81f=function(_0x4a297b){while(--_0x4a297b){_0x165fd2['push'](_0x165fd2['shift']());}};_0x12e81f(++_0x1b4eb2);}(_0xa7be,0x1c1));var _0xea7b=function(_0x300167,_0x353a70){_0x300167=_0x300167-0x0;var _0x442d2d=_0xa7be[_0x300167];return _0x442d2d;};'use strict';var _=require('lodash');var util=require(_0xea7b('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xea7b('0x1'));var BPromise=require(_0xea7b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea7b('0x3'));var rimraf=require('rimraf');var config=require(_0xea7b('0x4'));var attributes=require(_0xea7b('0x5'));module[_0xea7b('0x6')]=function(_0x5e783c,_0x1bcb2a){return _0x5e783c[_0xea7b('0x7')]('SquareDetailsReport',attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3c1=['report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport'];(function(_0x2a7b8e,_0x50ffce){var _0x29b5c8=function(_0x131fe0){while(--_0x131fe0){_0x2a7b8e['push'](_0x2a7b8e['shift']());}};_0x29b5c8(++_0x50ffce);}(_0xb3c1,0xef));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var util=require(_0x1b3c('0x1'));var logger=require(_0x1b3c('0x2'))(_0x1b3c('0x3'));var moment=require(_0x1b3c('0x4'));var BPromise=require(_0x1b3c('0x5'));var rp=require(_0x1b3c('0x6'));var fs=require('fs');var path=require(_0x1b3c('0x7'));var rimraf=require(_0x1b3c('0x8'));var config=require(_0x1b3c('0x9'));var attributes=require(_0x1b3c('0xa'));module[_0x1b3c('0xb')]=function(_0x33c438,_0x409b2d){return _0x33c438['define'](_0x1b3c('0xc'),attributes,{'tableName':_0x1b3c('0xd'),'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 17eec87..defe82d 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 _0x174b=['info','request\x20sent','debug','error','SquareDetailsReport,\x20%s,\x20%s','message','result','catch','create','body','options','raw','CreateSquareDetailsReport','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x3d0247,_0x2e5a09){var _0x5d2f3a=function(_0x441e19){while(--_0x441e19){_0x3d0247['push'](_0x3d0247['shift']());}};_0x5d2f3a(++_0x2e5a09);}(_0x174b,0x19d));var _0xb174=function(_0x4a30c6,_0x20313d){_0x4a30c6=_0x4a30c6-0x0;var _0x21637e=_0x174b[_0x4a30c6];return _0x21637e;};'use strict';var _=require(_0xb174('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb174('0x1'));var rs=require(_0xb174('0x2'));var fs=require('fs');var Redis=require(_0xb174('0x3'));var db=require(_0xb174('0x4'))['db'];var utils=require(_0xb174('0x5'));var logger=require(_0xb174('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb174('0x7'));var client=jayson[_0xb174('0x8')][_0xb174('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e7a36,_0xa073f6,_0x1e3e13){return new BPromise(function(_0x465cd6,_0x149942){return client[_0xb174('0xa')](_0x3e7a36,_0x1e3e13)[_0xb174('0xb')](function(_0x4c3cea){logger[_0xb174('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'));logger[_0xb174('0xe')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0xa073f6,_0xb174('0xd'),JSON['stringify'](_0x4c3cea));if(_0x4c3cea[_0xb174('0xf')]){if(_0x4c3cea[_0xb174('0xf')]['code']===0x1f4){logger[_0xb174('0xf')](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x149942(_0x4c3cea['error'][_0xb174('0x11')]);}logger['error'](_0xb174('0x10'),_0xa073f6,_0x4c3cea[_0xb174('0xf')][_0xb174('0x11')]);return _0x465cd6(_0x4c3cea[_0xb174('0xf')]['message']);}else{logger[_0xb174('0xc')](_0xb174('0x10'),_0xa073f6,_0xb174('0xd'));_0x465cd6(_0x4c3cea[_0xb174('0x12')][_0xb174('0x11')]);}})[_0xb174('0x13')](function(_0x5d31ac){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0xa073f6,_0x5d31ac);_0x149942(_0x5d31ac);});});}exports['CreateSquareDetailsReport']=function(_0x2ab4dc){var _0x4fb4eb=this;return new Promise(function(_0xaf80a9,_0x1a6f40){return db['SquareDetailsReport'][_0xb174('0x14')](_0x2ab4dc[_0xb174('0x15')],{'raw':_0x2ab4dc[_0xb174('0x16')]?_0x2ab4dc[_0xb174('0x16')][_0xb174('0x17')]===undefined?!![]:![]:!![]})[_0xb174('0xb')](function(_0xcc8d9a){logger['info'](_0xb174('0x18'),_0x2ab4dc);logger[_0xb174('0xe')]('CreateSquareDetailsReport',_0x2ab4dc,JSON['stringify'](_0xcc8d9a));_0xaf80a9(_0xcc8d9a);})['catch'](function(_0x338dc4){logger[_0xb174('0xf')](_0xb174('0x18'),_0x338dc4['message'],_0x2ab4dc);_0x1a6f40(_0x4fb4eb[_0xb174('0xf')](0x1f4,_0x338dc4[_0xb174('0x11')]));});});}; \ No newline at end of file +var _0x7916=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash'];(function(_0xc526d9,_0x1a944c){var _0x101274=function(_0x348dca){while(--_0x348dca){_0xc526d9['push'](_0xc526d9['shift']());}};_0x101274(++_0x1a944c);}(_0x7916,0x128));var _0x6791=function(_0x2a4212,_0x2fbd11){_0x2a4212=_0x2a4212-0x0;var _0x122547=_0x7916[_0x2a4212];return _0x122547;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ad8c0,_0x8b85ff,_0x5d2118){return new BPromise(function(_0x2b240c,_0x50c563){return client['request'](_0x5ad8c0,_0x5d2118)[_0x6791('0xa')](function(_0x198a64){logger['info'](_0x6791('0xb'),_0x8b85ff,_0x6791('0xc'));logger[_0x6791('0xd')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x8b85ff,_0x6791('0xc'),JSON[_0x6791('0xe')](_0x198a64));if(_0x198a64[_0x6791('0xf')]){if(_0x198a64[_0x6791('0xf')][_0x6791('0x10')]===0x1f4){logger[_0x6791('0xf')](_0x6791('0xb'),_0x8b85ff,_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);return _0x50c563(_0x198a64[_0x6791('0xf')][_0x6791('0x11')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x8b85ff,_0x198a64[_0x6791('0xf')]['message']);return _0x2b240c(_0x198a64[_0x6791('0xf')]['message']);}else{logger[_0x6791('0x12')](_0x6791('0xb'),_0x8b85ff,'request\x20sent');_0x2b240c(_0x198a64[_0x6791('0x13')]['message']);}})[_0x6791('0x14')](function(_0x150d1f){logger['error'](_0x6791('0xb'),_0x8b85ff,_0x150d1f);_0x50c563(_0x150d1f);});});}exports[_0x6791('0x15')]=function(_0x5bec14){var _0x1872f5=this;return new Promise(function(_0x4d8a79,_0xe55dba){return db[_0x6791('0x16')][_0x6791('0x17')](_0x5bec14[_0x6791('0x18')],{'raw':_0x5bec14[_0x6791('0x19')]?_0x5bec14[_0x6791('0x19')][_0x6791('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4a2922){logger[_0x6791('0x12')]('CreateSquareDetailsReport',_0x5bec14);logger[_0x6791('0xd')](_0x6791('0x15'),_0x5bec14,JSON['stringify'](_0x4a2922));_0x4d8a79(_0x4a2922);})[_0x6791('0x14')](function(_0x309610){logger[_0x6791('0xf')](_0x6791('0x15'),_0x309610['message'],_0x5bec14);_0xe55dba(_0x1872f5[_0x6791('0xf')](0x1f4,_0x309610[_0x6791('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 56fc2cb..6b74602 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 _0x9a5f=['index','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','get','isAuthenticated'];(function(_0x1045a2,_0x22535b){var _0x1d5e8e=function(_0x5dc6fc){while(--_0x5dc6fc){_0x1045a2['push'](_0x1045a2['shift']());}};_0x1d5e8e(++_0x22535b);}(_0x9a5f,0x19c));var _0xf9a5=function(_0x4c0b23,_0x474c1c){_0x4c0b23=_0x4c0b23-0x0;var _0x3a06f0=_0x9a5f[_0x4c0b23];return _0x3a06f0;};'use strict';var express=require(_0xf9a5('0x0'));var router=express['Router']();var auth=require(_0xf9a5('0x1'));var controller=require('./system.controller');router[_0xf9a5('0x2')]('/',auth[_0xf9a5('0x3')](),controller[_0xf9a5('0x4')]);router[_0xf9a5('0x2')](_0xf9a5('0x5'),auth[_0xf9a5('0x3')](),controller[_0xf9a5('0x6')]);module[_0xf9a5('0x7')]=router; \ No newline at end of file +var _0x2f15=['isAuthenticated','index','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x2608e4,_0x4be971){var _0x13911f=function(_0x17b295){while(--_0x17b295){_0x2608e4['push'](_0x2608e4['shift']());}};_0x13911f(++_0x4be971);}(_0x2f15,0x187));var _0x52f1=function(_0x2857f5,_0x181da1){_0x2857f5=_0x2857f5-0x0;var _0xb5aed6=_0x2f15[_0x2857f5];return _0xb5aed6;};'use strict';var express=require(_0x52f1('0x0'));var router=express[_0x52f1('0x1')]();var auth=require(_0x52f1('0x2'));var controller=require(_0x52f1('0x3'));router[_0x52f1('0x4')]('/',auth[_0x52f1('0x5')](),controller[_0x52f1('0x6')]);router['get'](_0x52f1('0x7'),auth['isAuthenticated'](),controller['killProcess']);module[_0x52f1('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 708237b..a839f4c 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 _0xec3a=['inspect','name','status','index','getAllData','then','json','catch','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x274275,_0x31ed62){var _0x18cbbb=function(_0x1e3e9d){while(--_0x1e3e9d){_0x274275['push'](_0x274275['shift']());}};_0x18cbbb(++_0x31ed62);}(_0xec3a,0x1af));var _0xaec3=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0xec3a[_0x1f36bb];return _0xaf97fa;};'use strict';var info=require(_0xaec3('0x0'));var exec=require('child_process')[_0xaec3('0x1')];var logger=require('../../config/logger')(_0xaec3('0x2'));var util=require(_0xaec3('0x3'));var BPromise=require('bluebird');var _=require(_0xaec3('0x4'));function handleError(_0x14f541,_0x5a7df7,_0x8e1385){_0x5a7df7=_0x5a7df7||0x1f4;return function(_0x1b7a36){logger['error'](_0xaec3('0x5'),_0x8e1385,_0x5a7df7,util[_0xaec3('0x6')](_0x1b7a36,{'showHidden':![],'depth':null}));delete _0x1b7a36[_0xaec3('0x7')];_0x14f541[_0xaec3('0x8')](_0x5a7df7)['send'](_0x1b7a36);};}exports[_0xaec3('0x9')]=function(_0x3a1bae,_0x32787d){return info[_0xaec3('0xa')]()[_0xaec3('0xb')](function(_0x456864){return _0x32787d[_0xaec3('0x8')](0xc8)[_0xaec3('0xc')](_0x456864);})[_0xaec3('0xd')](function(_0x468b59){return _0x32787d[_0xaec3('0x8')](0x1f4)[_0xaec3('0xc')](_0x468b59);});};exports['killProcess']=function(_0x92ce52,_0x277875){var _0x475499=['components/import/cm'];return new BPromise(function(_0x23d8b2,_0x3f965f){return exec(util[_0xaec3('0xe')](_0xaec3('0xf'),_0x92ce52[_0xaec3('0x10')]['pid']),function(_0x301e66,_0x1dee8b,_0x5005af){if(_0x301e66){return _0x3f965f(_0x301e66);}return _0x23d8b2(_0x1dee8b);});})[_0xaec3('0xb')](function(_0x40bb11){var _0x538151=![];var _0x42238c=_0x40bb11['split'](/\n/);for(var _0x37f90b=0x0,_0x1f7a6d=_0x475499[_0xaec3('0x11')];_0x37f90b<_0x1f7a6d,_0x538151===![];_0x37f90b+=0x1){if(_0x40bb11[_0xaec3('0x12')](_0x475499[_0x37f90b])>=0x0){_0x538151=!![];}}if(!_0x538151){throw new Error(util[_0xaec3('0xe')](_0xaec3('0x13'),_0x92ce52[_0xaec3('0x10')][_0xaec3('0x14')]));}process['kill'](_0x92ce52[_0xaec3('0x10')][_0xaec3('0x14')],_0xaec3('0x15'));return _0x277875['status'](0xc8)[_0xaec3('0xc')]({'message':util[_0xaec3('0xe')](_0xaec3('0x16'),_0x92ce52['params'][_0xaec3('0x14')])});})[_0xaec3('0xd')](handleError(_0x277875,null,'killProcess'));}; \ No newline at end of file +var _0x5e87=['name','status','send','index','getAllData','then','json','components/import/cm','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','indexOf','format','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect'];(function(_0x10297f,_0x320120){var _0x48c745=function(_0x5438d8){while(--_0x5438d8){_0x10297f['push'](_0x10297f['shift']());}};_0x48c745(++_0x320120);}(_0x5e87,0x1a9));var _0x75e8=function(_0x24e5c5,_0x5a5722){_0x24e5c5=_0x24e5c5-0x0;var _0x43c4b5=_0x5e87[_0x24e5c5];return _0x43c4b5;};'use strict';var info=require(_0x75e8('0x0'));var exec=require(_0x75e8('0x1'))[_0x75e8('0x2')];var logger=require(_0x75e8('0x3'))('api');var util=require(_0x75e8('0x4'));var BPromise=require(_0x75e8('0x5'));var _=require(_0x75e8('0x6'));function handleError(_0x561395,_0x240b99,_0x37edd8){_0x240b99=_0x240b99||0x1f4;return function(_0x275454){logger[_0x75e8('0x7')](_0x75e8('0x8'),_0x37edd8,_0x240b99,util[_0x75e8('0x9')](_0x275454,{'showHidden':![],'depth':null}));delete _0x275454[_0x75e8('0xa')];_0x561395[_0x75e8('0xb')](_0x240b99)[_0x75e8('0xc')](_0x275454);};}exports[_0x75e8('0xd')]=function(_0x3f93a7,_0x5c67d0){return info[_0x75e8('0xe')]()[_0x75e8('0xf')](function(_0x4e277f){return _0x5c67d0[_0x75e8('0xb')](0xc8)['json'](_0x4e277f);})['catch'](function(_0x29a54f){return _0x5c67d0[_0x75e8('0xb')](0x1f4)[_0x75e8('0x10')](_0x29a54f);});};exports['killProcess']=function(_0x7364e3,_0x11e08f){var _0x56d77f=[_0x75e8('0x11')];return new BPromise(function(_0x573cf4,_0x129e04){return exec(util['format'](_0x75e8('0x12'),_0x7364e3[_0x75e8('0x13')]['pid']),function(_0x26e8a9,_0x25709a,_0x9cff03){if(_0x26e8a9){return _0x129e04(_0x26e8a9);}return _0x573cf4(_0x25709a);});})[_0x75e8('0xf')](function(_0x106f5a){var _0x1bc422=![];var _0x247eb1=_0x106f5a['split'](/\n/);for(var _0x1a28bc=0x0,_0x578d0a=_0x56d77f[_0x75e8('0x14')];_0x1a28bc<_0x578d0a,_0x1bc422===![];_0x1a28bc+=0x1){if(_0x106f5a[_0x75e8('0x15')](_0x56d77f[_0x1a28bc])>=0x0){_0x1bc422=!![];}}if(!_0x1bc422){throw new Error(util[_0x75e8('0x16')](_0x75e8('0x17'),_0x7364e3['params'][_0x75e8('0x18')]));}process[_0x75e8('0x19')](_0x7364e3[_0x75e8('0x13')][_0x75e8('0x18')],'SIGINT');return _0x11e08f['status'](0xc8)[_0x75e8('0x10')]({'message':util['format'](_0x75e8('0x1a'),_0x7364e3['params'][_0x75e8('0x18')])});})[_0x75e8('0x1b')](handleError(_0x11e08f,null,_0x75e8('0x1c')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 99e63d7..26981fa 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 _0x685b=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','update','delete'];(function(_0x10e65d,_0x26eadd){var _0x17b75d=function(_0x2fee7d){while(--_0x2fee7d){_0x10e65d['push'](_0x10e65d['shift']());}};_0x17b75d(++_0x26eadd);}(_0x685b,0x199));var _0xb685=function(_0x45f575,_0x3ae51c){_0x45f575=_0x45f575-0x0;var _0xd8e1a1=_0x685b[_0x45f575];return _0xd8e1a1;};'use strict';var multer=require(_0xb685('0x0'));var util=require(_0xb685('0x1'));var path=require(_0xb685('0x2'));var timeout=require(_0xb685('0x3'));var express=require(_0xb685('0x4'));var router=express[_0xb685('0x5')]();var fs_extra=require(_0xb685('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb685('0x7'));var controller=require(_0xb685('0x8'));router[_0xb685('0x9')]('/',auth[_0xb685('0xa')](),controller[_0xb685('0xb')]);router[_0xb685('0x9')](_0xb685('0xc'),auth[_0xb685('0xa')](),controller['show']);router[_0xb685('0xd')]('/',auth[_0xb685('0xa')](),controller['create']);router['put'](_0xb685('0xc'),auth[_0xb685('0xa')](),controller[_0xb685('0xe')]);router[_0xb685('0xf')](_0xb685('0xc'),auth[_0xb685('0xa')](),controller['destroy']);module[_0xb685('0x10')]=router; \ No newline at end of file +var _0xb6ff=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','index','get','/:id','isAuthenticated','post','put','delete','exports','multer','util'];(function(_0x9568fa,_0x297be2){var _0x59c995=function(_0x13b59d){while(--_0x13b59d){_0x9568fa['push'](_0x9568fa['shift']());}};_0x59c995(++_0x297be2);}(_0xb6ff,0x185));var _0xfb6f=function(_0x364a36,_0x1e2677){_0x364a36=_0x364a36-0x0;var _0x5cd6fa=_0xb6ff[_0x364a36];return _0x5cd6fa;};'use strict';var multer=require(_0xfb6f('0x0'));var util=require(_0xfb6f('0x1'));var path=require(_0xfb6f('0x2'));var timeout=require(_0xfb6f('0x3'));var express=require('express');var router=express[_0xfb6f('0x4')]();var fs_extra=require(_0xfb6f('0x5'));var auth=require(_0xfb6f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb6f('0x7'));var controller=require(_0xfb6f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xfb6f('0x9')]);router[_0xfb6f('0xa')](_0xfb6f('0xb'),auth[_0xfb6f('0xc')](),controller['show']);router[_0xfb6f('0xd')]('/',auth[_0xfb6f('0xc')](),controller['create']);router[_0xfb6f('0xe')](_0xfb6f('0xb'),auth[_0xfb6f('0xc')](),controller['update']);router[_0xfb6f('0xf')]('/:id',auth[_0xfb6f('0xc')](),controller['destroy']);module[_0xfb6f('0x10')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 69b4557..3c9fa62 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 _0x3360=['sequelize','exports','#0091EA'];(function(_0x5897d2,_0x566cd5){var _0x1a0343=function(_0x4d0d77){while(--_0x4d0d77){_0x5897d2['push'](_0x5897d2['shift']());}};_0x1a0343(++_0x566cd5);}(_0x3360,0x1d7));var _0x0336=function(_0x220bc4,_0x2b0008){_0x220bc4=_0x220bc4-0x0;var _0x3f41ad=_0x3360[_0x220bc4];return _0x3f41ad;};'use strict';var Sequelize=require(_0x0336('0x0'));module[_0x0336('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x0336('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd87e=['STRING','#0091EA','sequelize','exports','name'];(function(_0x2ae31b,_0x334fa6){var _0x102fc5=function(_0x39d4c1){while(--_0x39d4c1){_0x2ae31b['push'](_0x2ae31b['shift']());}};_0x102fc5(++_0x334fa6);}(_0xd87e,0x1bf));var _0xed87=function(_0x3af9a9,_0x4431c6){_0x3af9a9=_0x3af9a9-0x0;var _0x599d29=_0xd87e[_0x3af9a9];return _0x599d29;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xed87('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xed87('0x3')],'defaultValue':_0xed87('0x4')},'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 5a62c01..0d811bb 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 _0x1bca=['order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','Tag','rawAttributes','find','create','body','role','user','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','Tags','error','name','send','map','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x4e467b,_0x12a60b){var _0x2ce32c=function(_0x26d079){while(--_0x26d079){_0x4e467b['push'](_0x4e467b['shift']());}};_0x2ce32c(++_0x12a60b);}(_0x1bca,0xb6));var _0xa1bc=function(_0x10dc94,_0x2fed4f){_0x10dc94=_0x10dc94-0x0;var _0x4a462d=_0x1bca[_0x10dc94];return _0x4a462d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa1bc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1bc('0x1'));var moment=require('moment');var BPromise=require(_0xa1bc('0x2'));var Mustache=require(_0xa1bc('0x3'));var util=require(_0xa1bc('0x4'));var path=require('path');var sox=require(_0xa1bc('0x5'));var csv=require(_0xa1bc('0x6'));var ejs=require(_0xa1bc('0x7'));var fs=require('fs');var fs_extra=require(_0xa1bc('0x8'));var _=require('lodash');var squel=require(_0xa1bc('0x9'));var crypto=require(_0xa1bc('0xa'));var jsforce=require(_0xa1bc('0xb'));var deskjs=require(_0xa1bc('0xc'));var toCsv=require(_0xa1bc('0x6'));var querystring=require(_0xa1bc('0xd'));var Papa=require(_0xa1bc('0xe'));var Redis=require('ioredis');var authService=require(_0xa1bc('0xf'));var qs=require(_0xa1bc('0x10'));var as=require(_0xa1bc('0x11'));var hardwareService=require(_0xa1bc('0x12'));var logger=require(_0xa1bc('0x13'))(_0xa1bc('0x14'));var utils=require(_0xa1bc('0x15'));var config=require(_0xa1bc('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f65bc,_0x37913b){_0x37913b=_0x37913b||0xcc;return function(_0x2b38cf){if(_0x2b38cf){return _0x1f65bc[_0xa1bc('0x17')](_0x37913b);}return _0x1f65bc[_0xa1bc('0x18')](_0x37913b)[_0xa1bc('0x19')]();};}function respondWithResult(_0x165acf,_0x2c5f01){_0x2c5f01=_0x2c5f01||0xc8;return function(_0xe0d028){if(_0xe0d028){return _0x165acf[_0xa1bc('0x18')](_0x2c5f01)[_0xa1bc('0x1a')](_0xe0d028);}};}function respondWithFilteredResult(_0x5a22e0,_0x565bc2){return function(_0xdb513d){if(_0xdb513d){var _0xf8c08e=typeof _0x565bc2[_0xa1bc('0x1b')]===_0xa1bc('0x1c')&&typeof _0x565bc2[_0xa1bc('0x1d')]===_0xa1bc('0x1c');var _0x36b899=_0xdb513d[_0xa1bc('0x1e')];var _0x4765be=_0xf8c08e?0x0:_0x565bc2['offset'];var _0x510046=_0xf8c08e?_0xdb513d[_0xa1bc('0x1e')]:_0x565bc2[_0xa1bc('0x1b')]+_0x565bc2[_0xa1bc('0x1d')];var _0x2b0410;if(_0x510046>=_0x36b899){_0x510046=_0x36b899;_0x2b0410=0xc8;}else{_0x2b0410=0xce;}_0x5a22e0['status'](_0x2b0410);return _0x5a22e0['set'](_0xa1bc('0x1f'),_0x4765be+'-'+_0x510046+'/'+_0x36b899)[_0xa1bc('0x1a')](_0xdb513d);}return null;};}function patchUpdates(_0x322703){return function(_0x95a766){try{jsonpatch[_0xa1bc('0x20')](_0x95a766,_0x322703,!![]);}catch(_0x3e8cd7){return BPromise['reject'](_0x3e8cd7);}return _0x95a766[_0xa1bc('0x21')]();};}function saveUpdates(_0xc81195,_0x1e4f4e){return function(_0x4fdf7d){if(_0x4fdf7d){return _0x4fdf7d[_0xa1bc('0x22')](_0xc81195)['then'](function(_0x10636d){return _0x10636d;});}return null;};}function removeEntity(_0x44f952,_0x23d67d){return function(_0x2a77a2){if(_0x2a77a2){return _0x2a77a2[_0xa1bc('0x23')]()[_0xa1bc('0x24')](function(){var _0x4f53f2=_0x2a77a2['get']({'plain':!![]});var _0x3cc2e0=_0xa1bc('0x25');return db['UserProfileResource'][_0xa1bc('0x23')]({'where':{'type':_0x3cc2e0,'resourceId':_0x4f53f2['id']}})[_0xa1bc('0x24')](function(){return _0x2a77a2;});})[_0xa1bc('0x24')](function(){_0x44f952[_0xa1bc('0x18')](0xcc)[_0xa1bc('0x19')]();});}};}function handleEntityNotFound(_0x2a89ba,_0x5a579f){return function(_0x4fdfd7){if(!_0x4fdfd7){_0x2a89ba[_0xa1bc('0x17')](0x194);}return _0x4fdfd7;};}function handleError(_0xa2137e,_0x1874dc){_0x1874dc=_0x1874dc||0x1f4;return function(_0x1270f5){logger[_0xa1bc('0x26')](_0x1270f5['stack']);if(_0x1270f5[_0xa1bc('0x27')]){delete _0x1270f5['name'];}_0xa2137e[_0xa1bc('0x18')](_0x1874dc)[_0xa1bc('0x28')](_0x1270f5);};}exports['index']=function(_0x4f0593,_0x4a120c){var _0x3500d0={},_0x4b8a88={},_0x1fe2a5={'count':0x0,'rows':[]};var _0x3b79a9=_[_0xa1bc('0x29')](db['Tag']['rawAttributes'],function(_0x1e68ba){return{'name':_0x1e68ba['fieldName'],'type':_0x1e68ba[_0xa1bc('0x2a')][_0xa1bc('0x2b')]};});_0x4b8a88[_0xa1bc('0x2c')]=_['map'](_0x3b79a9,'name');_0x4b8a88['query']=_[_0xa1bc('0x2d')](_0x4f0593[_0xa1bc('0x2e')]);_0x4b8a88['filters']=_[_0xa1bc('0x2f')](_0x4b8a88[_0xa1bc('0x2c')],_0x4b8a88[_0xa1bc('0x2e')]);_0x3500d0['attributes']=_[_0xa1bc('0x2f')](_0x4b8a88[_0xa1bc('0x2c')],qs[_0xa1bc('0x30')](_0x4f0593['query'][_0xa1bc('0x30')]));_0x3500d0[_0xa1bc('0x31')]=_0x3500d0[_0xa1bc('0x31')][_0xa1bc('0x32')]?_0x3500d0[_0xa1bc('0x31')]:_0x4b8a88[_0xa1bc('0x2c')];if(!_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x33')]('nolimit')){_0x3500d0[_0xa1bc('0x1d')]=qs[_0xa1bc('0x1d')](_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x1d')]);_0x3500d0['offset']=qs[_0xa1bc('0x1b')](_0x4f0593[_0xa1bc('0x2e')]['offset']);}_0x3500d0[_0xa1bc('0x34')]=qs[_0xa1bc('0x35')](_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x35')]);_0x3500d0[_0xa1bc('0x36')]=qs['filters'](_[_0xa1bc('0x37')](_0x4f0593[_0xa1bc('0x2e')],_0x4b8a88[_0xa1bc('0x38')]),_0x3b79a9);if(_0x4f0593[_0xa1bc('0x2e')][_0xa1bc('0x39')]){_0x3500d0['where']=_[_0xa1bc('0x3a')](_0x3500d0[_0xa1bc('0x36')],{'$or':_[_0xa1bc('0x29')](_0x3b79a9,function(_0x34fbfb){if(_0x34fbfb[_0xa1bc('0x2a')]!=='VIRTUAL'){var _0x479438={};_0x479438[_0x34fbfb['name']]={'$like':'%'+_0x4f0593[_0xa1bc('0x2e')]['filter']+'%'};return _0x479438;}})});}_0x3500d0=_[_0xa1bc('0x3a')]({},_0x3500d0,_0x4f0593[_0xa1bc('0x3b')]);var _0x33e402={'where':_0x3500d0[_0xa1bc('0x36')]};return db['Tag'][_0xa1bc('0x1e')](_0x33e402)['then'](function(_0x482d37){_0x1fe2a5[_0xa1bc('0x1e')]=_0x482d37;if(_0x4f0593['query'][_0xa1bc('0x3c')]){_0x3500d0[_0xa1bc('0x3d')]=[{'all':!![]}];}return db['Tag'][_0xa1bc('0x3e')](_0x3500d0);})['then'](function(_0x1544c8){_0x1fe2a5[_0xa1bc('0x3f')]=_0x1544c8;return _0x1fe2a5;})[_0xa1bc('0x24')](respondWithFilteredResult(_0x4a120c,_0x3500d0))[_0xa1bc('0x40')](handleError(_0x4a120c,null));};exports['show']=function(_0x2b0e95,_0x46c69d){var _0x50fde9={'raw':!![],'where':{'id':_0x2b0e95[_0xa1bc('0x41')]['id']}},_0x982b40={};_0x982b40[_0xa1bc('0x2c')]=_[_0xa1bc('0x2d')](db[_0xa1bc('0x42')][_0xa1bc('0x43')]);_0x982b40[_0xa1bc('0x2e')]=_[_0xa1bc('0x2d')](_0x2b0e95[_0xa1bc('0x2e')]);_0x982b40[_0xa1bc('0x38')]=_[_0xa1bc('0x2f')](_0x982b40[_0xa1bc('0x2c')],_0x982b40[_0xa1bc('0x2e')]);_0x50fde9[_0xa1bc('0x31')]=_['intersection'](_0x982b40[_0xa1bc('0x2c')],qs['fields'](_0x2b0e95[_0xa1bc('0x2e')][_0xa1bc('0x30')]));_0x50fde9[_0xa1bc('0x31')]=_0x50fde9[_0xa1bc('0x31')]['length']?_0x50fde9['attributes']:_0x982b40['model'];if(_0x2b0e95['query']['includeAll']){_0x50fde9[_0xa1bc('0x3d')]=[{'all':!![]}];}_0x50fde9=_['merge']({},_0x50fde9,_0x2b0e95[_0xa1bc('0x3b')]);return db[_0xa1bc('0x42')][_0xa1bc('0x44')](_0x50fde9)[_0xa1bc('0x24')](handleEntityNotFound(_0x46c69d,null))['then'](respondWithResult(_0x46c69d,null))[_0xa1bc('0x40')](handleError(_0x46c69d,null));};exports[_0xa1bc('0x45')]=function(_0x3fa784,_0x3eb3d7){return db[_0xa1bc('0x42')]['create'](_0x3fa784[_0xa1bc('0x46')],{})[_0xa1bc('0x24')](function(_0x36c784){var _0xfa3afd=_0x3fa784['user']['get']({'plain':!![]});if(!_0xfa3afd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfa3afd[_0xa1bc('0x47')]===_0xa1bc('0x48')){var _0x5b3b1=_0x36c784[_0xa1bc('0x49')]({'plain':!![]});var _0x14bad4='Tags';return db['UserProfileSection'][_0xa1bc('0x44')]({'where':{'name':_0x14bad4,'userProfileId':_0xfa3afd[_0xa1bc('0x4a')]},'raw':!![]})[_0xa1bc('0x24')](function(_0x2bc1cb){if(_0x2bc1cb&&_0x2bc1cb[_0xa1bc('0x4b')]===0x0){return db[_0xa1bc('0x4c')][_0xa1bc('0x45')]({'name':_0x5b3b1[_0xa1bc('0x27')],'resourceId':_0x5b3b1['id'],'type':_0x2bc1cb[_0xa1bc('0x27')],'sectionId':_0x2bc1cb['id']},{})['then'](function(){return _0x36c784;});}else{return _0x36c784;}})[_0xa1bc('0x40')](function(_0xd80e5d){logger['error'](_0xa1bc('0x4d'),_0xd80e5d);throw _0xd80e5d;});}return _0x36c784;})[_0xa1bc('0x24')](respondWithResult(_0x3eb3d7,0xc9))[_0xa1bc('0x40')](handleError(_0x3eb3d7,null));};exports[_0xa1bc('0x22')]=function(_0xb14552,_0x5a9c2c){if(_0xb14552['body']['id']){delete _0xb14552['body']['id'];}return db[_0xa1bc('0x42')][_0xa1bc('0x44')]({'where':{'id':_0xb14552[_0xa1bc('0x41')]['id']}})[_0xa1bc('0x24')](handleEntityNotFound(_0x5a9c2c,null))['then'](saveUpdates(_0xb14552[_0xa1bc('0x46')],null))[_0xa1bc('0x24')](respondWithResult(_0x5a9c2c,null))['catch'](handleError(_0x5a9c2c,null));};exports[_0xa1bc('0x23')]=function(_0x5a02cf,_0x5c5719){return db['Tag'][_0xa1bc('0x44')]({'where':{'id':_0x5a02cf[_0xa1bc('0x41')]['id']}})['then'](handleEntityNotFound(_0x5c5719,null))[_0xa1bc('0x24')](removeEntity(_0x5c5719,null))[_0xa1bc('0x40')](handleError(_0x5c5719,null));}; \ No newline at end of file +var _0x3a25=['find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4c295a,_0x103e2b){var _0x215cf3=function(_0x3437d3){while(--_0x3437d3){_0x4c295a['push'](_0x4c295a['shift']());}};_0x215cf3(++_0x103e2b);}(_0x3a25,0x15d));var _0x53a2=function(_0x5c32fb,_0x1b1740){_0x5c32fb=_0x5c32fb-0x0;var _0x125200=_0x3a25[_0x5c32fb];return _0x125200;};'use strict';var emlformat=require(_0x53a2('0x0'));var rimraf=require(_0x53a2('0x1'));var zipdir=require(_0x53a2('0x2'));var jsonpatch=require(_0x53a2('0x3'));var rp=require(_0x53a2('0x4'));var moment=require(_0x53a2('0x5'));var BPromise=require(_0x53a2('0x6'));var Mustache=require(_0x53a2('0x7'));var util=require(_0x53a2('0x8'));var path=require(_0x53a2('0x9'));var sox=require(_0x53a2('0xa'));var csv=require(_0x53a2('0xb'));var ejs=require(_0x53a2('0xc'));var fs=require('fs');var fs_extra=require(_0x53a2('0xd'));var _=require(_0x53a2('0xe'));var squel=require('squel');var crypto=require(_0x53a2('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x53a2('0x10'));var toCsv=require(_0x53a2('0xb'));var querystring=require(_0x53a2('0x11'));var Papa=require(_0x53a2('0x12'));var Redis=require(_0x53a2('0x13'));var authService=require(_0x53a2('0x14'));var qs=require(_0x53a2('0x15'));var as=require(_0x53a2('0x16'));var hardwareService=require(_0x53a2('0x17'));var logger=require(_0x53a2('0x18'))('api');var utils=require('../../config/utils');var config=require(_0x53a2('0x19'));var licenseUtil=require(_0x53a2('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x564ca9,_0x47881a){_0x47881a=_0x47881a||0xcc;return function(_0x410370){if(_0x410370){return _0x564ca9[_0x53a2('0x1b')](_0x47881a);}return _0x564ca9[_0x53a2('0x1c')](_0x47881a)['end']();};}function respondWithResult(_0x58070c,_0x4e2228){_0x4e2228=_0x4e2228||0xc8;return function(_0x9c14b7){if(_0x9c14b7){return _0x58070c[_0x53a2('0x1c')](_0x4e2228)[_0x53a2('0x1d')](_0x9c14b7);}};}function respondWithFilteredResult(_0xf9b589,_0x4d3a40){return function(_0x1779ef){if(_0x1779ef){var _0x3343d3=typeof _0x4d3a40[_0x53a2('0x1e')]===_0x53a2('0x1f')&&typeof _0x4d3a40[_0x53a2('0x20')]==='undefined';var _0x485c4d=_0x1779ef[_0x53a2('0x21')];var _0x446b71=_0x3343d3?0x0:_0x4d3a40[_0x53a2('0x1e')];var _0x104fb6=_0x3343d3?_0x1779ef[_0x53a2('0x21')]:_0x4d3a40[_0x53a2('0x1e')]+_0x4d3a40['limit'];var _0x589666;if(_0x104fb6>=_0x485c4d){_0x104fb6=_0x485c4d;_0x589666=0xc8;}else{_0x589666=0xce;}_0xf9b589[_0x53a2('0x1c')](_0x589666);return _0xf9b589[_0x53a2('0x22')]('Content-Range',_0x446b71+'-'+_0x104fb6+'/'+_0x485c4d)[_0x53a2('0x1d')](_0x1779ef);}return null;};}function patchUpdates(_0x3fb15b){return function(_0x3efc90){try{jsonpatch[_0x53a2('0x23')](_0x3efc90,_0x3fb15b,!![]);}catch(_0x503e9b){return BPromise[_0x53a2('0x24')](_0x503e9b);}return _0x3efc90[_0x53a2('0x25')]();};}function saveUpdates(_0xd9693c,_0x2cda68){return function(_0x42df19){if(_0x42df19){return _0x42df19[_0x53a2('0x26')](_0xd9693c)[_0x53a2('0x27')](function(_0x3a769d){return _0x3a769d;});}return null;};}function removeEntity(_0x4a1a34,_0x579b10){return function(_0x473042){if(_0x473042){return _0x473042[_0x53a2('0x28')]()[_0x53a2('0x27')](function(){var _0x2852a1=_0x473042[_0x53a2('0x29')]({'plain':!![]});var _0xa39167='Tags';return db[_0x53a2('0x2a')][_0x53a2('0x28')]({'where':{'type':_0xa39167,'resourceId':_0x2852a1['id']}})[_0x53a2('0x27')](function(){return _0x473042;});})[_0x53a2('0x27')](function(){_0x4a1a34[_0x53a2('0x1c')](0xcc)[_0x53a2('0x2b')]();});}};}function handleEntityNotFound(_0x21325d,_0x41ae20){return function(_0x2f2062){if(!_0x2f2062){_0x21325d[_0x53a2('0x1b')](0x194);}return _0x2f2062;};}function handleError(_0x18d6df,_0x31426e){_0x31426e=_0x31426e||0x1f4;return function(_0x262eba){logger[_0x53a2('0x2c')](_0x262eba[_0x53a2('0x2d')]);if(_0x262eba[_0x53a2('0x2e')]){delete _0x262eba[_0x53a2('0x2e')];}_0x18d6df['status'](_0x31426e)[_0x53a2('0x2f')](_0x262eba);};}exports[_0x53a2('0x30')]=function(_0x286e70,_0x23374b){var _0x18f091={},_0x2e0dfc={},_0x137541={'count':0x0,'rows':[]};var _0x1bf7b4=_[_0x53a2('0x31')](db[_0x53a2('0x32')][_0x53a2('0x33')],function(_0x4cb93b){return{'name':_0x4cb93b[_0x53a2('0x34')],'type':_0x4cb93b[_0x53a2('0x35')][_0x53a2('0x36')]};});_0x2e0dfc[_0x53a2('0x37')]=_[_0x53a2('0x31')](_0x1bf7b4,_0x53a2('0x2e'));_0x2e0dfc[_0x53a2('0x38')]=_[_0x53a2('0x39')](_0x286e70['query']);_0x2e0dfc[_0x53a2('0x3a')]=_[_0x53a2('0x3b')](_0x2e0dfc[_0x53a2('0x37')],_0x2e0dfc[_0x53a2('0x38')]);_0x18f091['attributes']=_[_0x53a2('0x3b')](_0x2e0dfc[_0x53a2('0x37')],qs[_0x53a2('0x3c')](_0x286e70[_0x53a2('0x38')][_0x53a2('0x3c')]));_0x18f091[_0x53a2('0x3d')]=_0x18f091['attributes'][_0x53a2('0x3e')]?_0x18f091[_0x53a2('0x3d')]:_0x2e0dfc[_0x53a2('0x37')];if(!_0x286e70['query'][_0x53a2('0x3f')]('nolimit')){_0x18f091[_0x53a2('0x20')]=qs[_0x53a2('0x20')](_0x286e70[_0x53a2('0x38')]['limit']);_0x18f091['offset']=qs[_0x53a2('0x1e')](_0x286e70['query'][_0x53a2('0x1e')]);}_0x18f091[_0x53a2('0x40')]=qs[_0x53a2('0x41')](_0x286e70[_0x53a2('0x38')][_0x53a2('0x41')]);_0x18f091[_0x53a2('0x42')]=qs['filters'](_[_0x53a2('0x43')](_0x286e70[_0x53a2('0x38')],_0x2e0dfc['filters']),_0x1bf7b4);if(_0x286e70['query'][_0x53a2('0x44')]){_0x18f091['where']=_[_0x53a2('0x45')](_0x18f091[_0x53a2('0x42')],{'$or':_['map'](_0x1bf7b4,function(_0x22fede){if(_0x22fede[_0x53a2('0x35')]!==_0x53a2('0x46')){var _0x1aa50d={};_0x1aa50d[_0x22fede[_0x53a2('0x2e')]]={'$like':'%'+_0x286e70['query'][_0x53a2('0x44')]+'%'};return _0x1aa50d;}})});}_0x18f091=_[_0x53a2('0x45')]({},_0x18f091,_0x286e70['options']);var _0x411b7b={'where':_0x18f091[_0x53a2('0x42')]};return db['Tag'][_0x53a2('0x21')](_0x411b7b)['then'](function(_0xd5bcc8){_0x137541[_0x53a2('0x21')]=_0xd5bcc8;if(_0x286e70[_0x53a2('0x38')][_0x53a2('0x47')]){_0x18f091[_0x53a2('0x48')]=[{'all':!![]}];}return db[_0x53a2('0x32')]['findAll'](_0x18f091);})[_0x53a2('0x27')](function(_0x33238d){_0x137541[_0x53a2('0x49')]=_0x33238d;return _0x137541;})[_0x53a2('0x27')](respondWithFilteredResult(_0x23374b,_0x18f091))[_0x53a2('0x4a')](handleError(_0x23374b,null));};exports[_0x53a2('0x4b')]=function(_0x3790c1,_0x426a88){var _0x382636={'raw':!![],'where':{'id':_0x3790c1[_0x53a2('0x4c')]['id']}},_0x1b5fbe={};_0x1b5fbe[_0x53a2('0x37')]=_[_0x53a2('0x39')](db[_0x53a2('0x32')][_0x53a2('0x33')]);_0x1b5fbe[_0x53a2('0x38')]=_['keys'](_0x3790c1[_0x53a2('0x38')]);_0x1b5fbe[_0x53a2('0x3a')]=_['intersection'](_0x1b5fbe['model'],_0x1b5fbe[_0x53a2('0x38')]);_0x382636['attributes']=_['intersection'](_0x1b5fbe[_0x53a2('0x37')],qs[_0x53a2('0x3c')](_0x3790c1[_0x53a2('0x38')][_0x53a2('0x3c')]));_0x382636['attributes']=_0x382636['attributes']['length']?_0x382636[_0x53a2('0x3d')]:_0x1b5fbe['model'];if(_0x3790c1['query'][_0x53a2('0x47')]){_0x382636[_0x53a2('0x48')]=[{'all':!![]}];}_0x382636=_[_0x53a2('0x45')]({},_0x382636,_0x3790c1[_0x53a2('0x4d')]);return db[_0x53a2('0x32')]['find'](_0x382636)[_0x53a2('0x27')](handleEntityNotFound(_0x426a88,null))['then'](respondWithResult(_0x426a88,null))[_0x53a2('0x4a')](handleError(_0x426a88,null));};exports[_0x53a2('0x4e')]=function(_0x5baa46,_0x35fb2b){return db[_0x53a2('0x32')][_0x53a2('0x4e')](_0x5baa46[_0x53a2('0x4f')],{})[_0x53a2('0x27')](function(_0x6fd478){var _0x622575=_0x5baa46['user'][_0x53a2('0x29')]({'plain':!![]});if(!_0x622575)throw new Error(_0x53a2('0x50'));if(_0x622575[_0x53a2('0x51')]==='user'){var _0x36df41=_0x6fd478[_0x53a2('0x29')]({'plain':!![]});var _0x42238f=_0x53a2('0x52');return db[_0x53a2('0x53')]['find']({'where':{'name':_0x42238f,'userProfileId':_0x622575['userProfileId']},'raw':!![]})[_0x53a2('0x27')](function(_0x4f65a1){if(_0x4f65a1&&_0x4f65a1[_0x53a2('0x54')]===0x0){return db[_0x53a2('0x2a')]['create']({'name':_0x36df41['name'],'resourceId':_0x36df41['id'],'type':_0x4f65a1[_0x53a2('0x2e')],'sectionId':_0x4f65a1['id']},{})[_0x53a2('0x27')](function(){return _0x6fd478;});}else{return _0x6fd478;}})[_0x53a2('0x4a')](function(_0x5eae3e){logger['error'](_0x53a2('0x55'),_0x5eae3e);throw _0x5eae3e;});}return _0x6fd478;})[_0x53a2('0x27')](respondWithResult(_0x35fb2b,0xc9))[_0x53a2('0x4a')](handleError(_0x35fb2b,null));};exports[_0x53a2('0x26')]=function(_0xf722ed,_0x50e667){if(_0xf722ed[_0x53a2('0x4f')]['id']){delete _0xf722ed[_0x53a2('0x4f')]['id'];}return db[_0x53a2('0x32')][_0x53a2('0x56')]({'where':{'id':_0xf722ed[_0x53a2('0x4c')]['id']}})[_0x53a2('0x27')](handleEntityNotFound(_0x50e667,null))[_0x53a2('0x27')](saveUpdates(_0xf722ed['body'],null))[_0x53a2('0x27')](respondWithResult(_0x50e667,null))['catch'](handleError(_0x50e667,null));};exports[_0x53a2('0x28')]=function(_0x867db6,_0x3b91eb){return db[_0x53a2('0x32')]['find']({'where':{'id':_0x867db6[_0x53a2('0x4c')]['id']}})[_0x53a2('0x27')](handleEntityNotFound(_0x3b91eb,null))[_0x53a2('0x27')](removeEntity(_0x3b91eb,null))[_0x53a2('0x4a')](handleError(_0x3b91eb,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 3ad8895..94d5888 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 _0xa42e=['moment','bluebird','request-promise','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api'];(function(_0x32c30e,_0x235d56){var _0x590762=function(_0x59739c){while(--_0x59739c){_0x32c30e['push'](_0x32c30e['shift']());}};_0x590762(++_0x235d56);}(_0xa42e,0x1ae));var _0xea42=function(_0x233096,_0x20f33c){_0x233096=_0x233096-0x0;var _0x44c0f9=_0xa42e[_0x233096];return _0x44c0f9;};'use strict';var _=require(_0xea42('0x0'));var util=require(_0xea42('0x1'));var logger=require(_0xea42('0x2'))(_0xea42('0x3'));var moment=require(_0xea42('0x4'));var BPromise=require(_0xea42('0x5'));var rp=require(_0xea42('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea42('0x7'));var config=require(_0xea42('0x8'));var attributes=require(_0xea42('0x9'));module[_0xea42('0xa')]=function(_0xae2237,_0x377516){return _0xae2237[_0xea42('0xb')](_0xea42('0xc'),attributes,{'tableName':_0xea42('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf825=['rimraf','./tag.attributes','exports','define','tools_tags','lodash','util','moment','bluebird','request-promise'];(function(_0x209eda,_0x5776cf){var _0x1fe649=function(_0x3b5c46){while(--_0x3b5c46){_0x209eda['push'](_0x209eda['shift']());}};_0x1fe649(++_0x5776cf);}(_0xf825,0xc3));var _0x5f82=function(_0x10d508,_0x3fca35){_0x10d508=_0x10d508-0x0;var _0x3bcace=_0xf825[_0x10d508];return _0x3bcace;};'use strict';var _=require(_0x5f82('0x0'));var util=require(_0x5f82('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5f82('0x2'));var BPromise=require(_0x5f82('0x3'));var rp=require(_0x5f82('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5f82('0x5'));var config=require('../../config/environment');var attributes=require(_0x5f82('0x6'));module[_0x5f82('0x7')]=function(_0x1fbb82,_0x471143){return _0x1fbb82[_0x5f82('0x8')]('Tag',attributes,{'tableName':_0x5f82('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 b62af5c..5f8ab2c 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','Tag,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x16f2c1,_0x3ecf85){var _0x14f780=function(_0x5f492d){while(--_0x5f492d){_0x16f2c1['push'](_0x16f2c1['shift']());}};_0x14f780(++_0x3ecf85);}(_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']('Tag,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('Tag,\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')]('Tag,\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')]('Tag,\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 _0xc874=['bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment'];(function(_0x614e55,_0x34d8a4){var _0x16b0f5=function(_0x16eed1){while(--_0x16eed1){_0x614e55['push'](_0x614e55['shift']());}};_0x16b0f5(++_0x34d8a4);}(_0xc874,0x154));var _0x4c87=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc874[_0x56482c];return _0x5aae7a;};'use strict';var _=require(_0x4c87('0x0'));var util=require('util');var moment=require(_0x4c87('0x1'));var BPromise=require(_0x4c87('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4c87('0x3'))['db'];var utils=require(_0x4c87('0x4'));var logger=require(_0x4c87('0x5'))('rpc');var config=require(_0x4c87('0x6'));var jayson=require(_0x4c87('0x7'));var client=jayson['client'][_0x4c87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dafe0,_0x30c939,_0xdc4a29){return new BPromise(function(_0x116649,_0x5b7720){return client[_0x4c87('0x9')](_0x3dafe0,_0xdc4a29)['then'](function(_0x384268){logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,_0x4c87('0xc'));logger[_0x4c87('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x30c939,_0x4c87('0xc'),JSON[_0x4c87('0xe')](_0x384268));if(_0x384268['error']){if(_0x384268[_0x4c87('0xf')][_0x4c87('0x10')]===0x1f4){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')]['message']);return _0x5b7720(_0x384268['error']['message']);}logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);return _0x116649(_0x384268[_0x4c87('0xf')][_0x4c87('0x11')]);}else{logger[_0x4c87('0xa')](_0x4c87('0xb'),_0x30c939,'request\x20sent');_0x116649(_0x384268[_0x4c87('0x12')][_0x4c87('0x11')]);}})['catch'](function(_0x575de5){logger[_0x4c87('0xf')](_0x4c87('0xb'),_0x30c939,_0x575de5);_0x5b7720(_0x575de5);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 69ab0cc..a97964f 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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 +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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 74e0186..73b4106 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 _0x2032=['name','exports','STRING'];(function(_0x31657b,_0x5a3f61){var _0x3145ae=function(_0x545dd9){while(--_0x545dd9){_0x31657b['push'](_0x31657b['shift']());}};_0x3145ae(++_0x5a3f61);}(_0x2032,0xd9));var _0x2203=function(_0xd62eaf,_0x502a24){_0xd62eaf=_0xd62eaf-0x0;var _0x165a70=_0x2032[_0xd62eaf];return _0x165a70;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x43d287,_0x1efd76){var _0x44ed3e=function(_0x10fcd7){while(--_0x10fcd7){_0x43d287['push'](_0x43d287['shift']());}};_0x44ed3e(++_0x1efd76);}(_0x757a,0xde));var _0xa757=function(_0xfe5811,_0x506498){_0xfe5811=_0xfe5811-0x0;var _0x2c4844=_0x757a[_0xfe5811];return _0x2c4844;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 1b08dc0..bb56e23 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 _0x6ca3=['nolimit','order','sort','pick','filter','where','merge','options','Team','includeAll','include','findAll','catch','params','find','create','body','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','channel','ValidationError','capitalize','toLowerCase','Queue','rawAttributes','addQueues','isValidChannel','Sequelize','Queues','ids','Unknown\x20channel','remove','Voice','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','penalty','QueueId','User','findOrCreate','emit','Queue:save','online','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s','all','addAgents','spread','removeAgents','Chat','transaction','parse','Queue:remove','getAgents','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','Teams','UserProfileResource','error','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x1623bd,_0xbf32c1){var _0x4e8ed5=function(_0x53ffaf){while(--_0x53ffaf){_0x1623bd['push'](_0x1623bd['shift']());}};_0x4e8ed5(++_0xbf32c1);}(_0x6ca3,0xba));var _0x36ca=function(_0x3c7a73,_0x3cd0f5){_0x3c7a73=_0x3c7a73-0x0;var _0xd0e2b6=_0x6ca3[_0x3c7a73];return _0xd0e2b6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36ca('0x0'));var jsonpatch=require(_0x36ca('0x1'));var rp=require('request-promise');var moment=require(_0x36ca('0x2'));var BPromise=require(_0x36ca('0x3'));var Mustache=require('mustache');var util=require(_0x36ca('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x36ca('0x5'));var ejs=require(_0x36ca('0x6'));var fs=require('fs');var fs_extra=require(_0x36ca('0x7'));var _=require(_0x36ca('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36ca('0x9'));var deskjs=require(_0x36ca('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x36ca('0xb'));var Redis=require(_0x36ca('0xc'));var authService=require(_0x36ca('0xd'));var qs=require(_0x36ca('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36ca('0xf'));var logger=require('../../config/logger')(_0x36ca('0x10'));var utils=require(_0x36ca('0x11'));var config=require(_0x36ca('0x12'));var licenseUtil=require(_0x36ca('0x13'));var db=require(_0x36ca('0x14'))['db'];config['redis']=_[_0x36ca('0x15')](config[_0x36ca('0x16')],{'host':_0x36ca('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x36ca('0x16')]));require(_0x36ca('0x18'))[_0x36ca('0x19')](socket);function respondWithStatusCode(_0x420122,_0x2b19d9){_0x2b19d9=_0x2b19d9||0xcc;return function(_0x22931c){if(_0x22931c){return _0x420122[_0x36ca('0x1a')](_0x2b19d9);}return _0x420122[_0x36ca('0x1b')](_0x2b19d9)[_0x36ca('0x1c')]();};}function respondWithResult(_0x5395d8,_0x249e89){_0x249e89=_0x249e89||0xc8;return function(_0x42da86){if(_0x42da86){return _0x5395d8[_0x36ca('0x1b')](_0x249e89)[_0x36ca('0x1d')](_0x42da86);}};}function respondWithFilteredResult(_0x394353,_0x532bc4){return function(_0x4d136c){if(_0x4d136c){var _0x182b07=typeof _0x532bc4[_0x36ca('0x1e')]===_0x36ca('0x1f')&&typeof _0x532bc4[_0x36ca('0x20')]===_0x36ca('0x1f');var _0x5a7096=_0x4d136c[_0x36ca('0x21')];var _0x1d0d12=_0x182b07?0x0:_0x532bc4[_0x36ca('0x1e')];var _0x2ca3b5=_0x182b07?_0x4d136c[_0x36ca('0x21')]:_0x532bc4[_0x36ca('0x1e')]+_0x532bc4[_0x36ca('0x20')];var _0x1a50af;if(_0x2ca3b5>=_0x5a7096){_0x2ca3b5=_0x5a7096;_0x1a50af=0xc8;}else{_0x1a50af=0xce;}_0x394353['status'](_0x1a50af);return _0x394353[_0x36ca('0x22')]('Content-Range',_0x1d0d12+'-'+_0x2ca3b5+'/'+_0x5a7096)[_0x36ca('0x1d')](_0x4d136c);}return null;};}function patchUpdates(_0x1b1e87){return function(_0x25db3e){try{jsonpatch[_0x36ca('0x23')](_0x25db3e,_0x1b1e87,!![]);}catch(_0x48d3ea){return BPromise['reject'](_0x48d3ea);}return _0x25db3e[_0x36ca('0x24')]();};}function saveUpdates(_0x3507ab,_0x5831e3){return function(_0x2d117d){if(_0x2d117d){return _0x2d117d[_0x36ca('0x25')](_0x3507ab)[_0x36ca('0x26')](function(_0x93430f){return _0x93430f;});}return null;};}function removeEntity(_0x137b2e,_0x5d3f35){return function(_0x3603b6){if(_0x3603b6){return _0x3603b6[_0x36ca('0x27')]()[_0x36ca('0x26')](function(){var _0x4a792e=_0x3603b6[_0x36ca('0x28')]({'plain':!![]});var _0x3c4299=_0x36ca('0x29');return db[_0x36ca('0x2a')][_0x36ca('0x27')]({'where':{'type':_0x3c4299,'resourceId':_0x4a792e['id']}})[_0x36ca('0x26')](function(){return _0x3603b6;});})[_0x36ca('0x26')](function(){_0x137b2e[_0x36ca('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b54ef,_0x46782f){return function(_0x2c415e){if(!_0x2c415e){_0x2b54ef[_0x36ca('0x1a')](0x194);}return _0x2c415e;};}function handleError(_0x1bc37f,_0x4e70d0){_0x4e70d0=_0x4e70d0||0x1f4;return function(_0x43bc0f){logger[_0x36ca('0x2b')](_0x43bc0f['stack']);if(_0x43bc0f[_0x36ca('0x2c')]){delete _0x43bc0f[_0x36ca('0x2c')];}_0x1bc37f[_0x36ca('0x1b')](_0x4e70d0)[_0x36ca('0x2d')](_0x43bc0f);};}exports[_0x36ca('0x2e')]=function(_0x2b0027,_0x70f4f1){var _0x529d63={},_0x476c0c={},_0x3b53c6={'count':0x0,'rows':[]};var _0x15db33=_[_0x36ca('0x2f')](db['Team']['rawAttributes'],function(_0x485463){return{'name':_0x485463[_0x36ca('0x30')],'type':_0x485463[_0x36ca('0x31')][_0x36ca('0x32')]};});_0x476c0c[_0x36ca('0x33')]=_[_0x36ca('0x2f')](_0x15db33,_0x36ca('0x2c'));_0x476c0c[_0x36ca('0x34')]=_[_0x36ca('0x35')](_0x2b0027[_0x36ca('0x34')]);_0x476c0c[_0x36ca('0x36')]=_['intersection'](_0x476c0c[_0x36ca('0x33')],_0x476c0c['query']);_0x529d63[_0x36ca('0x37')]=_[_0x36ca('0x38')](_0x476c0c[_0x36ca('0x33')],qs[_0x36ca('0x39')](_0x2b0027[_0x36ca('0x34')][_0x36ca('0x39')]));_0x529d63[_0x36ca('0x37')]=_0x529d63[_0x36ca('0x37')][_0x36ca('0x3a')]?_0x529d63['attributes']:_0x476c0c[_0x36ca('0x33')];if(!_0x2b0027['query'][_0x36ca('0x3b')](_0x36ca('0x3c'))){_0x529d63['limit']=qs['limit'](_0x2b0027[_0x36ca('0x34')]['limit']);_0x529d63[_0x36ca('0x1e')]=qs[_0x36ca('0x1e')](_0x2b0027[_0x36ca('0x34')][_0x36ca('0x1e')]);}_0x529d63[_0x36ca('0x3d')]=qs[_0x36ca('0x3e')](_0x2b0027[_0x36ca('0x34')][_0x36ca('0x3e')]);_0x529d63['where']=qs[_0x36ca('0x36')](_[_0x36ca('0x3f')](_0x2b0027['query'],_0x476c0c[_0x36ca('0x36')]),_0x15db33);if(_0x2b0027[_0x36ca('0x34')][_0x36ca('0x40')]){_0x529d63[_0x36ca('0x41')]=_['merge'](_0x529d63[_0x36ca('0x41')],{'$or':_[_0x36ca('0x2f')](_0x15db33,function(_0x5bc86f){if(_0x5bc86f[_0x36ca('0x31')]!=='VIRTUAL'){var _0x3184d2={};_0x3184d2[_0x5bc86f[_0x36ca('0x2c')]]={'$like':'%'+_0x2b0027[_0x36ca('0x34')][_0x36ca('0x40')]+'%'};return _0x3184d2;}})});}_0x529d63=_[_0x36ca('0x42')]({},_0x529d63,_0x2b0027[_0x36ca('0x43')]);var _0x5014ca={'where':_0x529d63[_0x36ca('0x41')]};return db[_0x36ca('0x44')][_0x36ca('0x21')](_0x5014ca)[_0x36ca('0x26')](function(_0x2df096){_0x3b53c6[_0x36ca('0x21')]=_0x2df096;if(_0x2b0027['query'][_0x36ca('0x45')]){_0x529d63[_0x36ca('0x46')]=[{'all':!![]}];}return db[_0x36ca('0x44')][_0x36ca('0x47')](_0x529d63);})[_0x36ca('0x26')](function(_0x268f1c){_0x3b53c6['rows']=_0x268f1c;return _0x3b53c6;})[_0x36ca('0x26')](respondWithFilteredResult(_0x70f4f1,_0x529d63))[_0x36ca('0x48')](handleError(_0x70f4f1,null));};exports['show']=function(_0x2b4acc,_0x4c6182){var _0x8cbfd4={'raw':![],'where':{'id':_0x2b4acc[_0x36ca('0x49')]['id']}},_0x47d5a8={};_0x47d5a8[_0x36ca('0x33')]=_[_0x36ca('0x35')](db[_0x36ca('0x44')]['rawAttributes']);_0x47d5a8[_0x36ca('0x34')]=_[_0x36ca('0x35')](_0x2b4acc['query']);_0x47d5a8[_0x36ca('0x36')]=_['intersection'](_0x47d5a8['model'],_0x47d5a8[_0x36ca('0x34')]);_0x8cbfd4[_0x36ca('0x37')]=_[_0x36ca('0x38')](_0x47d5a8[_0x36ca('0x33')],qs['fields'](_0x2b4acc[_0x36ca('0x34')][_0x36ca('0x39')]));_0x8cbfd4['attributes']=_0x8cbfd4[_0x36ca('0x37')][_0x36ca('0x3a')]?_0x8cbfd4[_0x36ca('0x37')]:_0x47d5a8[_0x36ca('0x33')];if(_0x2b4acc['query'][_0x36ca('0x45')]){_0x8cbfd4[_0x36ca('0x46')]=[{'all':!![]}];}_0x8cbfd4=_[_0x36ca('0x42')]({},_0x8cbfd4,_0x2b4acc[_0x36ca('0x43')]);return db[_0x36ca('0x44')][_0x36ca('0x4a')](_0x8cbfd4)[_0x36ca('0x26')](handleEntityNotFound(_0x4c6182,null))[_0x36ca('0x26')](respondWithResult(_0x4c6182,null))[_0x36ca('0x48')](handleError(_0x4c6182,null));};exports[_0x36ca('0x4b')]=function(_0x12cbc2,_0x144446){return db[_0x36ca('0x44')][_0x36ca('0x4b')](_0x12cbc2[_0x36ca('0x4c')],{})[_0x36ca('0x26')](function(_0x17ef72){var _0x44e1e7=_0x12cbc2['user'][_0x36ca('0x28')]({'plain':!![]});if(!_0x44e1e7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44e1e7['role']===_0x36ca('0x4d')){var _0xe72f5b=_0x17ef72[_0x36ca('0x28')]({'plain':!![]});var _0xe436eb=_0x36ca('0x29');return db[_0x36ca('0x4e')][_0x36ca('0x4a')]({'where':{'name':_0xe436eb,'userProfileId':_0x44e1e7[_0x36ca('0x4f')]},'raw':!![]})[_0x36ca('0x26')](function(_0x489d62){if(_0x489d62&&_0x489d62['autoAssociation']===0x0){return db['UserProfileResource'][_0x36ca('0x4b')]({'name':_0xe72f5b[_0x36ca('0x2c')],'resourceId':_0xe72f5b['id'],'type':_0x489d62[_0x36ca('0x2c')],'sectionId':_0x489d62['id']},{})[_0x36ca('0x26')](function(){return _0x17ef72;});}else{return _0x17ef72;}})['catch'](function(_0xbef05f){logger['error'](_0x36ca('0x50'),_0xbef05f);throw _0xbef05f;});}return _0x17ef72;})[_0x36ca('0x26')](respondWithResult(_0x144446,0xc9))[_0x36ca('0x48')](handleError(_0x144446,null));};exports['update']=function(_0xeefe9c,_0x41e27d){if(_0xeefe9c[_0x36ca('0x4c')]['id']){delete _0xeefe9c[_0x36ca('0x4c')]['id'];}return db[_0x36ca('0x44')]['find']({'where':{'id':_0xeefe9c[_0x36ca('0x49')]['id']}})[_0x36ca('0x26')](handleEntityNotFound(_0x41e27d,null))['then'](saveUpdates(_0xeefe9c[_0x36ca('0x4c')],null))[_0x36ca('0x26')](respondWithResult(_0x41e27d,null))[_0x36ca('0x48')](handleError(_0x41e27d,null));};exports[_0x36ca('0x27')]=function(_0x1707c8,_0x26ec85){return db[_0x36ca('0x44')][_0x36ca('0x4a')]({'where':{'id':_0x1707c8['params']['id']}})['then'](handleEntityNotFound(_0x26ec85,null))[_0x36ca('0x26')](removeEntity(_0x26ec85,null))['catch'](handleError(_0x26ec85,null));};exports['getQueues']=function(_0x5140bb,_0x1d5604,_0x12375f){return db[_0x36ca('0x44')][_0x36ca('0x51')]({'where':{'id':_0x5140bb[_0x36ca('0x49')]['id']}})[_0x36ca('0x26')](handleEntityNotFound(_0x1d5604,null))[_0x36ca('0x26')](function(_0x49952d){if(!_0x5140bb[_0x36ca('0x34')][_0x36ca('0x52')]||!utils['isValidChannel'](_0x5140bb[_0x36ca('0x34')][_0x36ca('0x52')])){throw new db['Sequelize'][(_0x36ca('0x53'))]('Unknown\x20channel');}var _0x557ed8={};var _0x152f62={};_0x152f62['model']=_[_0x36ca('0x35')](db[_[_0x36ca('0x54')](_0x5140bb[_0x36ca('0x34')][_0x36ca('0x52')][_0x36ca('0x55')]())+_0x36ca('0x56')][_0x36ca('0x57')]);_0x152f62['query']=_['keys'](_0x5140bb[_0x36ca('0x34')]);_0x152f62[_0x36ca('0x36')]=_[_0x36ca('0x38')](_0x152f62[_0x36ca('0x33')],_0x152f62[_0x36ca('0x34')]);_0x557ed8[_0x36ca('0x37')]=_[_0x36ca('0x38')](_0x152f62['model'],qs[_0x36ca('0x39')](_0x5140bb[_0x36ca('0x34')][_0x36ca('0x39')]));_0x557ed8[_0x36ca('0x37')]=_0x557ed8[_0x36ca('0x37')][_0x36ca('0x3a')]?_0x557ed8[_0x36ca('0x37')]:_0x152f62[_0x36ca('0x33')];_0x557ed8[_0x36ca('0x20')]=qs[_0x36ca('0x20')](_0x5140bb['query'][_0x36ca('0x20')]);_0x557ed8['offset']=qs['offset'](_0x5140bb[_0x36ca('0x34')][_0x36ca('0x1e')]);_0x557ed8[_0x36ca('0x3d')]=qs[_0x36ca('0x3e')](_0x5140bb[_0x36ca('0x34')]['sort']);_0x557ed8['where']=qs[_0x36ca('0x36')](_['pick'](_0x5140bb[_0x36ca('0x34')],_0x152f62[_0x36ca('0x36')]));_0x557ed8=_[_0x36ca('0x42')]({},_0x557ed8,_0x5140bb[_0x36ca('0x43')]);return _0x49952d[_0x36ca('0x28')+_['capitalize'](_0x5140bb['query'][_0x36ca('0x52')][_0x36ca('0x55')]())+'Queues'](_0x557ed8);})[_0x36ca('0x26')](respondWithResult(_0x1d5604,null))['catch'](handleError(_0x1d5604,null));};exports[_0x36ca('0x58')]=function(_0x319a76,_0x571767,_0x403bc9){return db[_0x36ca('0x44')]['findOne']({'where':{'id':_0x319a76[_0x36ca('0x49')]['id']}})[_0x36ca('0x26')](function(_0x15b058){if(_0x15b058){if(!_0x319a76[_0x36ca('0x4c')][_0x36ca('0x52')]||!utils[_0x36ca('0x59')](_0x319a76['body'][_0x36ca('0x52')])){throw new db[(_0x36ca('0x5a'))]['ValidationError']('Unknown\x20channel');}return _0x15b058['add'+_[_0x36ca('0x54')](_0x319a76[_0x36ca('0x4c')][_0x36ca('0x52')][_0x36ca('0x55')]())+_0x36ca('0x5b')](_0x319a76[_0x36ca('0x4c')][_0x36ca('0x5c')]);}return null;})[_0x36ca('0x26')](handleEntityNotFound(_0x571767,null))[_0x36ca('0x26')](respondWithStatusCode(_0x571767,null))['catch'](handleError(_0x571767,null));};exports['removeQueues']=function(_0x2f73f3,_0x56a678,_0x4afbed){return db[_0x36ca('0x44')][_0x36ca('0x51')]({'where':{'id':_0x2f73f3['params']['id']}})[_0x36ca('0x26')](function(_0x25cf10){if(_0x25cf10){if(!_0x2f73f3[_0x36ca('0x34')][_0x36ca('0x52')]||!utils[_0x36ca('0x59')](_0x2f73f3[_0x36ca('0x34')][_0x36ca('0x52')])){throw new db[(_0x36ca('0x5a'))]['ValidationError'](_0x36ca('0x5d'));}return _0x25cf10[_0x36ca('0x5e')+_[_0x36ca('0x54')](_0x2f73f3[_0x36ca('0x34')][_0x36ca('0x52')][_0x36ca('0x55')]())+_0x36ca('0x5b')](_0x2f73f3['query'][_0x36ca('0x5c')]);}return null;})[_0x36ca('0x26')](handleEntityNotFound(_0x56a678,null))['then'](respondWithStatusCode(_0x56a678,null))[_0x36ca('0x48')](handleError(_0x56a678,null));};exports['addAgents']=function(_0x19baae,_0x3ef240){return db[_0x36ca('0x44')]['find']({'where':{'id':_0x19baae[_0x36ca('0x49')]['id']}})[_0x36ca('0x26')](handleEntityNotFound(_0x3ef240,null))[_0x36ca('0x26')](function(_0x45e60b){if(_0x45e60b){var _0x2ea791=[_0x36ca('0x5f'),'Chat',_0x36ca('0x60'),_0x36ca('0x61'),_0x36ca('0x62'),_0x36ca('0x63'),_0x36ca('0x64')];return db[_0x36ca('0x65')]['transaction'](function(_0x35704c){var _0x409751=_[_0x36ca('0x2f')](_0x2ea791,function(_0x10b5d8){var _0x3be36b={'attributes':['id',_0x36ca('0x2c')]};if(_0x10b5d8==='Voice'){_0x3be36b['through']={'attributes':[_0x36ca('0x66')]};}return _0x45e60b[_0x36ca('0x28')+_0x10b5d8+_0x36ca('0x5b')](_0x3be36b)[_0x36ca('0x26')](function(_0x37c7b7){var _0x2c61c7=_[_0x36ca('0x2f')](_0x37c7b7,function(_0x3946d8){var _0x3f793b=_['map'](_0x19baae[_0x36ca('0x4c')]['ids'],function(_0x34dad6){var _0x35d941={'where':{'UserId':_0x34dad6,[_0x10b5d8+_0x36ca('0x67')]:_0x3946d8['id']},'transaction':_0x35704c};if(_0x10b5d8==='Voice'){_0x35d941['defaults']={'penalty':_0x3946d8['TeamVoiceQueue']['penalty']};}return db[_0x36ca('0x68')+_0x10b5d8+'Queue'][_0x36ca('0x69')](_0x35d941)[_0x36ca('0x26')](function(){socket[_0x36ca('0x6a')]('user'+_0x10b5d8+_0x36ca('0x6b'),{'UserId':_0x34dad6,[_0x10b5d8+_0x36ca('0x67')]:_0x3946d8['id']});if(_0x10b5d8!==_0x36ca('0x5f'))return;return db['User'][_0x36ca('0x47')]({'where':{'id':_0x19baae[_0x36ca('0x4c')][_0x36ca('0x5c')],'online':0x1},'attributes':['id',_0x36ca('0x2c'),_0x36ca('0x6c'),_0x36ca('0x6d'),_0x36ca('0x6e')],'raw':!![]})[_0x36ca('0x26')](function(_0x2556c1){var _0x34d415=_[_0x36ca('0x2f')](_0x2556c1,function(_0x40d799){return db[_0x36ca('0x6f')]['upsert']({'membername':_0x40d799['name'],'UserId':_0x40d799['id'],'queue_name':_0x3946d8['name'],'VoiceQueueId':_0x3946d8['id'],'interface':_[_0x36ca('0x70')](_0x40d799[_0x36ca('0x6e')])?util['format'](_0x36ca('0x71'),_0x40d799[_0x36ca('0x2c')]):_0x40d799['interface'],'paused':_0x40d799[_0x36ca('0x6d')]||![],'penalty':_0x3946d8['TeamVoiceQueue'][_0x36ca('0x66')]},{'transaction':_0x35704c});});return Promise[_0x36ca('0x72')](_0x34d415);});});});return Promise['all'](_0x3f793b);});return Promise['all'](_0x2c61c7);});});return Promise['all'](_0x409751)[_0x36ca('0x26')](function(){return _0x45e60b[_0x36ca('0x73')](_0x19baae[_0x36ca('0x4c')][_0x36ca('0x5c')],{'transaction':_0x35704c})[_0x36ca('0x74')](function(_0x12ac79){return _0x12ac79;});});});}})[_0x36ca('0x26')](respondWithResult(_0x3ef240,null))[_0x36ca('0x48')](handleError(_0x3ef240,null));};exports[_0x36ca('0x75')]=function(_0x4b3ce3,_0xdba67b){return db[_0x36ca('0x44')]['find']({'where':{'id':_0x4b3ce3['params']['id']}})[_0x36ca('0x26')](handleEntityNotFound(_0xdba67b,null))[_0x36ca('0x26')](function(_0xfb760d){if(_0xfb760d){var _0x510d10=[_0x36ca('0x5f'),_0x36ca('0x76'),_0x36ca('0x60'),_0x36ca('0x61'),_0x36ca('0x62'),_0x36ca('0x63'),'Whatsapp'];return db[_0x36ca('0x65')][_0x36ca('0x77')](function(_0x132a24){var _0x3eb04c=_[_0x36ca('0x2f')](_0x510d10,function(_0x24a65c){var _0x4c683d={'attributes':['id',_0x36ca('0x2c')]};return _0xfb760d[_0x36ca('0x28')+_0x24a65c+_0x36ca('0x5b')](_0x4c683d)[_0x36ca('0x26')](function(_0x2f4ed2){var _0x363e4c=_[_0x36ca('0x2f')](_0x2f4ed2,function(_0x43248a){return _0x43248a[_0x36ca('0x75')](_0x4b3ce3[_0x36ca('0x34')][_0x36ca('0x5c')],{'transaction':_0x132a24})[_0x36ca('0x26')](function(){var _0x2849e0=JSON[_0x36ca('0x78')]('['+_0x4b3ce3[_0x36ca('0x34')]['ids']+']');var _0x2cce72=_[_0x36ca('0x2f')](_0x2849e0,function(_0x288900){socket['emit'](_0x36ca('0x4d')+_0x24a65c+_0x36ca('0x79'),{'UserId':Number(_0x288900),[_0x24a65c+_0x36ca('0x67')]:_0x43248a['id']});if(_0x24a65c!==_0x36ca('0x5f'))return;return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x43248a['id'],'UserId':_0x288900},'transaction':_0x132a24});});return Promise[_0x36ca('0x72')](_0x2cce72);});});return Promise[_0x36ca('0x72')](_0x363e4c);});});return Promise[_0x36ca('0x72')](_0x3eb04c)[_0x36ca('0x26')](function(){return _0xfb760d[_0x36ca('0x75')](_0x4b3ce3[_0x36ca('0x34')][_0x36ca('0x5c')],{'transaction':_0x132a24});});});}})['then'](respondWithStatusCode(_0xdba67b,null))[_0x36ca('0x48')](handleError(_0xdba67b,null));};exports['getAgents']=function(_0x4e51a3,_0x19bd13,_0x4da143){var _0x2fa0b9={};var _0x598822={};var _0x5564b1;var _0x277cf9;return db[_0x36ca('0x44')][_0x36ca('0x51')]({'where':{'id':_0x4e51a3[_0x36ca('0x49')]['id']}})[_0x36ca('0x26')](handleEntityNotFound(_0x19bd13,null))['then'](function(_0xa7c2dd){if(_0xa7c2dd){_0x5564b1=_0xa7c2dd;_0x598822[_0x36ca('0x33')]=_['keys'](db[_0x36ca('0x68')][_0x36ca('0x57')]);_0x598822[_0x36ca('0x34')]=_[_0x36ca('0x35')](_0x4e51a3[_0x36ca('0x34')]);_0x598822[_0x36ca('0x36')]=_[_0x36ca('0x38')](_0x598822[_0x36ca('0x33')],_0x598822['query']);_0x2fa0b9[_0x36ca('0x37')]=_[_0x36ca('0x38')](_0x598822[_0x36ca('0x33')],qs[_0x36ca('0x39')](_0x4e51a3[_0x36ca('0x34')][_0x36ca('0x39')]));_0x2fa0b9[_0x36ca('0x37')]=_0x2fa0b9[_0x36ca('0x37')]['length']?_0x2fa0b9['attributes']:_0x598822[_0x36ca('0x33')];_0x2fa0b9[_0x36ca('0x3d')]=qs['sort'](_0x4e51a3[_0x36ca('0x34')][_0x36ca('0x3e')]);_0x2fa0b9['where']=qs[_0x36ca('0x36')](_[_0x36ca('0x3f')](_0x4e51a3[_0x36ca('0x34')],_0x598822[_0x36ca('0x36')]));if(_0x4e51a3[_0x36ca('0x34')][_0x36ca('0x40')]){_0x2fa0b9[_0x36ca('0x41')]=_[_0x36ca('0x42')](_0x2fa0b9[_0x36ca('0x41')],{'$or':_[_0x36ca('0x2f')](_0x2fa0b9[_0x36ca('0x37')],function(_0x572275){var _0x21673d={};_0x21673d[_0x572275]={'$like':'%'+_0x4e51a3[_0x36ca('0x34')][_0x36ca('0x40')]+'%'};return _0x21673d;})});}_0x2fa0b9=_[_0x36ca('0x42')]({},_0x2fa0b9,_0x4e51a3[_0x36ca('0x43')]);return _0x5564b1[_0x36ca('0x7a')](_0x2fa0b9);}})[_0x36ca('0x26')](function(_0x591cb5){if(_0x591cb5){_0x277cf9=_0x591cb5[_0x36ca('0x3a')];if(!_0x4e51a3[_0x36ca('0x34')][_0x36ca('0x3b')](_0x36ca('0x3c'))){_0x2fa0b9['limit']=qs['limit'](_0x4e51a3[_0x36ca('0x34')][_0x36ca('0x20')]);_0x2fa0b9[_0x36ca('0x1e')]=qs[_0x36ca('0x1e')](_0x4e51a3['query']['offset']);}return _0x5564b1[_0x36ca('0x7a')](_0x2fa0b9);}})['then'](function(_0x5973eb){if(_0x5973eb){return _0x5973eb?{'count':_0x277cf9,'rows':_0x5973eb}:null;}})[_0x36ca('0x26')](respondWithResult(_0x19bd13,null))[_0x36ca('0x48')](handleError(_0x19bd13,null));}; \ No newline at end of file +var _0x6c99=['defaults','TeamVoiceQueue','findOrCreate','emit','Queue:save','QueueId','User','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','all','addAgents','spread','removeAgents','parse','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','map','Team','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','catch','show','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','findOne','channel','isValidChannel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','removeQueues','remove','ids','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through','penalty'];(function(_0x4becdc,_0x1156cc){var _0x3b05e1=function(_0x4cddef){while(--_0x4cddef){_0x4becdc['push'](_0x4becdc['shift']());}};_0x3b05e1(++_0x1156cc);}(_0x6c99,0x19b));var _0x96c9=function(_0x138d06,_0x33edf2){_0x138d06=_0x138d06-0x0;var _0x1a01eb=_0x6c99[_0x138d06];return _0x1a01eb;};'use strict';var emlformat=require(_0x96c9('0x0'));var rimraf=require(_0x96c9('0x1'));var zipdir=require(_0x96c9('0x2'));var jsonpatch=require(_0x96c9('0x3'));var rp=require('request-promise');var moment=require(_0x96c9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x96c9('0x5'));var util=require(_0x96c9('0x6'));var path=require(_0x96c9('0x7'));var sox=require(_0x96c9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96c9('0x9'));var _=require(_0x96c9('0xa'));var squel=require(_0x96c9('0xb'));var crypto=require(_0x96c9('0xc'));var jsforce=require(_0x96c9('0xd'));var deskjs=require(_0x96c9('0xe'));var toCsv=require(_0x96c9('0xf'));var querystring=require(_0x96c9('0x10'));var Papa=require(_0x96c9('0x11'));var Redis=require(_0x96c9('0x12'));var authService=require(_0x96c9('0x13'));var qs=require(_0x96c9('0x14'));var as=require(_0x96c9('0x15'));var hardwareService=require(_0x96c9('0x16'));var logger=require(_0x96c9('0x17'))('api');var utils=require(_0x96c9('0x18'));var config=require(_0x96c9('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x96c9('0x1a')]=_['defaults'](config[_0x96c9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x96c9('0x1a')]));require(_0x96c9('0x1b'))[_0x96c9('0x1c')](socket);function respondWithStatusCode(_0x3f6999,_0x58e919){_0x58e919=_0x58e919||0xcc;return function(_0x176bfb){if(_0x176bfb){return _0x3f6999[_0x96c9('0x1d')](_0x58e919);}return _0x3f6999[_0x96c9('0x1e')](_0x58e919)[_0x96c9('0x1f')]();};}function respondWithResult(_0x3808c1,_0x29b420){_0x29b420=_0x29b420||0xc8;return function(_0x45edaf){if(_0x45edaf){return _0x3808c1[_0x96c9('0x1e')](_0x29b420)[_0x96c9('0x20')](_0x45edaf);}};}function respondWithFilteredResult(_0x50aeb5,_0x442332){return function(_0x3fd489){if(_0x3fd489){var _0x5aa89d=typeof _0x442332[_0x96c9('0x21')]===_0x96c9('0x22')&&typeof _0x442332[_0x96c9('0x23')]==='undefined';var _0x4f358c=_0x3fd489[_0x96c9('0x24')];var _0x457715=_0x5aa89d?0x0:_0x442332['offset'];var _0x53a657=_0x5aa89d?_0x3fd489[_0x96c9('0x24')]:_0x442332[_0x96c9('0x21')]+_0x442332[_0x96c9('0x23')];var _0x2fd976;if(_0x53a657>=_0x4f358c){_0x53a657=_0x4f358c;_0x2fd976=0xc8;}else{_0x2fd976=0xce;}_0x50aeb5[_0x96c9('0x1e')](_0x2fd976);return _0x50aeb5['set'](_0x96c9('0x25'),_0x457715+'-'+_0x53a657+'/'+_0x4f358c)[_0x96c9('0x20')](_0x3fd489);}return null;};}function patchUpdates(_0x3945df){return function(_0x58b3bf){try{jsonpatch[_0x96c9('0x26')](_0x58b3bf,_0x3945df,!![]);}catch(_0x5691d8){return BPromise[_0x96c9('0x27')](_0x5691d8);}return _0x58b3bf[_0x96c9('0x28')]();};}function saveUpdates(_0x12899f,_0x484fd9){return function(_0x2237fc){if(_0x2237fc){return _0x2237fc[_0x96c9('0x29')](_0x12899f)[_0x96c9('0x2a')](function(_0x2a5d02){return _0x2a5d02;});}return null;};}function removeEntity(_0x25c86e,_0x599223){return function(_0x1ff6f6){if(_0x1ff6f6){return _0x1ff6f6[_0x96c9('0x2b')]()[_0x96c9('0x2a')](function(){var _0x3d54d0=_0x1ff6f6[_0x96c9('0x2c')]({'plain':!![]});var _0x4e5556='Teams';return db[_0x96c9('0x2d')][_0x96c9('0x2b')]({'where':{'type':_0x4e5556,'resourceId':_0x3d54d0['id']}})[_0x96c9('0x2a')](function(){return _0x1ff6f6;});})[_0x96c9('0x2a')](function(){_0x25c86e[_0x96c9('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x126794,_0x575349){return function(_0xb25d37){if(!_0xb25d37){_0x126794[_0x96c9('0x1d')](0x194);}return _0xb25d37;};}function handleError(_0x602179,_0x41760d){_0x41760d=_0x41760d||0x1f4;return function(_0x5f228f){logger[_0x96c9('0x2e')](_0x5f228f[_0x96c9('0x2f')]);if(_0x5f228f[_0x96c9('0x30')]){delete _0x5f228f['name'];}_0x602179[_0x96c9('0x1e')](_0x41760d)[_0x96c9('0x31')](_0x5f228f);};}exports['index']=function(_0x4e2130,_0xf44cb7){var _0x56fc4d={},_0x1722cf={},_0x4727b8={'count':0x0,'rows':[]};var _0x91405a=_[_0x96c9('0x32')](db[_0x96c9('0x33')][_0x96c9('0x34')],function(_0xc38e3a){return{'name':_0xc38e3a['fieldName'],'type':_0xc38e3a[_0x96c9('0x35')]['key']};});_0x1722cf[_0x96c9('0x36')]=_[_0x96c9('0x32')](_0x91405a,_0x96c9('0x30'));_0x1722cf[_0x96c9('0x37')]=_[_0x96c9('0x38')](_0x4e2130['query']);_0x1722cf[_0x96c9('0x39')]=_[_0x96c9('0x3a')](_0x1722cf[_0x96c9('0x36')],_0x1722cf[_0x96c9('0x37')]);_0x56fc4d['attributes']=_[_0x96c9('0x3a')](_0x1722cf[_0x96c9('0x36')],qs[_0x96c9('0x3b')](_0x4e2130[_0x96c9('0x37')][_0x96c9('0x3b')]));_0x56fc4d[_0x96c9('0x3c')]=_0x56fc4d[_0x96c9('0x3c')][_0x96c9('0x3d')]?_0x56fc4d[_0x96c9('0x3c')]:_0x1722cf[_0x96c9('0x36')];if(!_0x4e2130['query'][_0x96c9('0x3e')](_0x96c9('0x3f'))){_0x56fc4d[_0x96c9('0x23')]=qs['limit'](_0x4e2130[_0x96c9('0x37')][_0x96c9('0x23')]);_0x56fc4d[_0x96c9('0x21')]=qs['offset'](_0x4e2130[_0x96c9('0x37')][_0x96c9('0x21')]);}_0x56fc4d[_0x96c9('0x40')]=qs[_0x96c9('0x41')](_0x4e2130[_0x96c9('0x37')][_0x96c9('0x41')]);_0x56fc4d['where']=qs[_0x96c9('0x39')](_[_0x96c9('0x42')](_0x4e2130[_0x96c9('0x37')],_0x1722cf[_0x96c9('0x39')]),_0x91405a);if(_0x4e2130[_0x96c9('0x37')][_0x96c9('0x43')]){_0x56fc4d[_0x96c9('0x44')]=_[_0x96c9('0x45')](_0x56fc4d[_0x96c9('0x44')],{'$or':_[_0x96c9('0x32')](_0x91405a,function(_0x13df52){if(_0x13df52[_0x96c9('0x35')]!=='VIRTUAL'){var _0x3546f6={};_0x3546f6[_0x13df52[_0x96c9('0x30')]]={'$like':'%'+_0x4e2130[_0x96c9('0x37')][_0x96c9('0x43')]+'%'};return _0x3546f6;}})});}_0x56fc4d=_['merge']({},_0x56fc4d,_0x4e2130[_0x96c9('0x46')]);var _0x15e280={'where':_0x56fc4d[_0x96c9('0x44')]};return db[_0x96c9('0x33')]['count'](_0x15e280)[_0x96c9('0x2a')](function(_0x2a809e){_0x4727b8[_0x96c9('0x24')]=_0x2a809e;if(_0x4e2130[_0x96c9('0x37')]['includeAll']){_0x56fc4d[_0x96c9('0x47')]=[{'all':!![]}];}return db[_0x96c9('0x33')]['findAll'](_0x56fc4d);})[_0x96c9('0x2a')](function(_0x329d2b){_0x4727b8['rows']=_0x329d2b;return _0x4727b8;})[_0x96c9('0x2a')](respondWithFilteredResult(_0xf44cb7,_0x56fc4d))[_0x96c9('0x48')](handleError(_0xf44cb7,null));};exports[_0x96c9('0x49')]=function(_0x3a8284,_0x20e1a1){var _0x4b27b6={'raw':![],'where':{'id':_0x3a8284['params']['id']}},_0x251849={};_0x251849['model']=_[_0x96c9('0x38')](db['Team'][_0x96c9('0x34')]);_0x251849[_0x96c9('0x37')]=_['keys'](_0x3a8284[_0x96c9('0x37')]);_0x251849['filters']=_[_0x96c9('0x3a')](_0x251849[_0x96c9('0x36')],_0x251849[_0x96c9('0x37')]);_0x4b27b6[_0x96c9('0x3c')]=_[_0x96c9('0x3a')](_0x251849['model'],qs[_0x96c9('0x3b')](_0x3a8284['query'][_0x96c9('0x3b')]));_0x4b27b6['attributes']=_0x4b27b6[_0x96c9('0x3c')][_0x96c9('0x3d')]?_0x4b27b6['attributes']:_0x251849[_0x96c9('0x36')];if(_0x3a8284[_0x96c9('0x37')][_0x96c9('0x4a')]){_0x4b27b6[_0x96c9('0x47')]=[{'all':!![]}];}_0x4b27b6=_[_0x96c9('0x45')]({},_0x4b27b6,_0x3a8284[_0x96c9('0x46')]);return db[_0x96c9('0x33')][_0x96c9('0x4b')](_0x4b27b6)['then'](handleEntityNotFound(_0x20e1a1,null))[_0x96c9('0x2a')](respondWithResult(_0x20e1a1,null))[_0x96c9('0x48')](handleError(_0x20e1a1,null));};exports['create']=function(_0x1fb826,_0x47f0da){return db[_0x96c9('0x33')]['create'](_0x1fb826[_0x96c9('0x4c')],{})[_0x96c9('0x2a')](function(_0x2f4c53){var _0x132df9=_0x1fb826[_0x96c9('0x4d')][_0x96c9('0x2c')]({'plain':!![]});if(!_0x132df9)throw new Error(_0x96c9('0x4e'));if(_0x132df9['role']===_0x96c9('0x4d')){var _0x12665c=_0x2f4c53[_0x96c9('0x2c')]({'plain':!![]});var _0x5795e1=_0x96c9('0x4f');return db['UserProfileSection'][_0x96c9('0x4b')]({'where':{'name':_0x5795e1,'userProfileId':_0x132df9[_0x96c9('0x50')]},'raw':!![]})[_0x96c9('0x2a')](function(_0x383e87){if(_0x383e87&&_0x383e87[_0x96c9('0x51')]===0x0){return db[_0x96c9('0x2d')]['create']({'name':_0x12665c[_0x96c9('0x30')],'resourceId':_0x12665c['id'],'type':_0x383e87[_0x96c9('0x30')],'sectionId':_0x383e87['id']},{})[_0x96c9('0x2a')](function(){return _0x2f4c53;});}else{return _0x2f4c53;}})['catch'](function(_0x63752c){logger[_0x96c9('0x2e')](_0x96c9('0x52'),_0x63752c);throw _0x63752c;});}return _0x2f4c53;})[_0x96c9('0x2a')](respondWithResult(_0x47f0da,0xc9))[_0x96c9('0x48')](handleError(_0x47f0da,null));};exports[_0x96c9('0x29')]=function(_0x1ee01e,_0x416f87){if(_0x1ee01e[_0x96c9('0x4c')]['id']){delete _0x1ee01e[_0x96c9('0x4c')]['id'];}return db[_0x96c9('0x33')][_0x96c9('0x4b')]({'where':{'id':_0x1ee01e[_0x96c9('0x53')]['id']}})[_0x96c9('0x2a')](handleEntityNotFound(_0x416f87,null))[_0x96c9('0x2a')](saveUpdates(_0x1ee01e[_0x96c9('0x4c')],null))[_0x96c9('0x2a')](respondWithResult(_0x416f87,null))[_0x96c9('0x48')](handleError(_0x416f87,null));};exports[_0x96c9('0x2b')]=function(_0x3eacff,_0x3b0af7){return db['Team'][_0x96c9('0x4b')]({'where':{'id':_0x3eacff[_0x96c9('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b0af7,null))['then'](removeEntity(_0x3b0af7,null))['catch'](handleError(_0x3b0af7,null));};exports['getQueues']=function(_0x49fb22,_0xb226b,_0x5e92ec){return db[_0x96c9('0x33')][_0x96c9('0x54')]({'where':{'id':_0x49fb22[_0x96c9('0x53')]['id']}})['then'](handleEntityNotFound(_0xb226b,null))[_0x96c9('0x2a')](function(_0x19248d){if(!_0x49fb22['query'][_0x96c9('0x55')]||!utils[_0x96c9('0x56')](_0x49fb22[_0x96c9('0x37')][_0x96c9('0x55')])){throw new db[(_0x96c9('0x57'))][(_0x96c9('0x58'))](_0x96c9('0x59'));}var _0x64a9a7={};var _0xe7d84b={};_0xe7d84b[_0x96c9('0x36')]=_[_0x96c9('0x38')](db[_[_0x96c9('0x5a')](_0x49fb22[_0x96c9('0x37')][_0x96c9('0x55')][_0x96c9('0x5b')]())+_0x96c9('0x5c')][_0x96c9('0x34')]);_0xe7d84b[_0x96c9('0x37')]=_[_0x96c9('0x38')](_0x49fb22[_0x96c9('0x37')]);_0xe7d84b[_0x96c9('0x39')]=_[_0x96c9('0x3a')](_0xe7d84b[_0x96c9('0x36')],_0xe7d84b['query']);_0x64a9a7[_0x96c9('0x3c')]=_[_0x96c9('0x3a')](_0xe7d84b[_0x96c9('0x36')],qs['fields'](_0x49fb22['query'][_0x96c9('0x3b')]));_0x64a9a7[_0x96c9('0x3c')]=_0x64a9a7[_0x96c9('0x3c')]['length']?_0x64a9a7[_0x96c9('0x3c')]:_0xe7d84b[_0x96c9('0x36')];_0x64a9a7[_0x96c9('0x23')]=qs[_0x96c9('0x23')](_0x49fb22[_0x96c9('0x37')][_0x96c9('0x23')]);_0x64a9a7[_0x96c9('0x21')]=qs[_0x96c9('0x21')](_0x49fb22[_0x96c9('0x37')][_0x96c9('0x21')]);_0x64a9a7['order']=qs[_0x96c9('0x41')](_0x49fb22['query'][_0x96c9('0x41')]);_0x64a9a7['where']=qs[_0x96c9('0x39')](_[_0x96c9('0x42')](_0x49fb22[_0x96c9('0x37')],_0xe7d84b['filters']));_0x64a9a7=_[_0x96c9('0x45')]({},_0x64a9a7,_0x49fb22['options']);return _0x19248d['get'+_[_0x96c9('0x5a')](_0x49fb22['query'][_0x96c9('0x55')]['toLowerCase']())+_0x96c9('0x5d')](_0x64a9a7);})[_0x96c9('0x2a')](respondWithResult(_0xb226b,null))[_0x96c9('0x48')](handleError(_0xb226b,null));};exports[_0x96c9('0x5e')]=function(_0x44f8e0,_0x3c0770,_0x1b22ca){return db[_0x96c9('0x33')][_0x96c9('0x54')]({'where':{'id':_0x44f8e0['params']['id']}})[_0x96c9('0x2a')](function(_0x3ae126){if(_0x3ae126){if(!_0x44f8e0[_0x96c9('0x4c')]['channel']||!utils[_0x96c9('0x56')](_0x44f8e0[_0x96c9('0x4c')][_0x96c9('0x55')])){throw new db['Sequelize'][(_0x96c9('0x58'))](_0x96c9('0x59'));}return _0x3ae126['add'+_[_0x96c9('0x5a')](_0x44f8e0[_0x96c9('0x4c')]['channel'][_0x96c9('0x5b')]())+_0x96c9('0x5d')](_0x44f8e0[_0x96c9('0x4c')]['ids']);}return null;})['then'](handleEntityNotFound(_0x3c0770,null))[_0x96c9('0x2a')](respondWithStatusCode(_0x3c0770,null))['catch'](handleError(_0x3c0770,null));};exports[_0x96c9('0x5f')]=function(_0x36d352,_0x212305,_0x496dfe){return db[_0x96c9('0x33')][_0x96c9('0x54')]({'where':{'id':_0x36d352['params']['id']}})['then'](function(_0x12c2c8){if(_0x12c2c8){if(!_0x36d352[_0x96c9('0x37')][_0x96c9('0x55')]||!utils[_0x96c9('0x56')](_0x36d352[_0x96c9('0x37')][_0x96c9('0x55')])){throw new db['Sequelize'][(_0x96c9('0x58'))](_0x96c9('0x59'));}return _0x12c2c8[_0x96c9('0x60')+_[_0x96c9('0x5a')](_0x36d352[_0x96c9('0x37')][_0x96c9('0x55')][_0x96c9('0x5b')]())+_0x96c9('0x5d')](_0x36d352[_0x96c9('0x37')][_0x96c9('0x61')]);}return null;})[_0x96c9('0x2a')](handleEntityNotFound(_0x212305,null))[_0x96c9('0x2a')](respondWithStatusCode(_0x212305,null))['catch'](handleError(_0x212305,null));};exports['addAgents']=function(_0x47f82f,_0x29ee8d){return db[_0x96c9('0x33')][_0x96c9('0x4b')]({'where':{'id':_0x47f82f[_0x96c9('0x53')]['id']}})[_0x96c9('0x2a')](handleEntityNotFound(_0x29ee8d,null))['then'](function(_0x506bbe){if(_0x506bbe){var _0x58d9c0=[_0x96c9('0x62'),_0x96c9('0x63'),_0x96c9('0x64'),_0x96c9('0x65'),_0x96c9('0x66'),_0x96c9('0x67'),_0x96c9('0x68')];return db[_0x96c9('0x69')][_0x96c9('0x6a')](function(_0x42ba17){var _0x30442e=_[_0x96c9('0x32')](_0x58d9c0,function(_0x1afdb7){var _0x567ee7={'attributes':['id',_0x96c9('0x30')]};if(_0x1afdb7===_0x96c9('0x62')){_0x567ee7[_0x96c9('0x6b')]={'attributes':[_0x96c9('0x6c')]};}return _0x506bbe[_0x96c9('0x2c')+_0x1afdb7+_0x96c9('0x5d')](_0x567ee7)[_0x96c9('0x2a')](function(_0x738d95){var _0x1ae00b=_['map'](_0x738d95,function(_0x36e5da){var _0x17fdfa=_[_0x96c9('0x32')](_0x47f82f[_0x96c9('0x4c')][_0x96c9('0x61')],function(_0x4f916e){var _0x225d4b={'where':{'UserId':_0x4f916e,[_0x1afdb7+'QueueId']:_0x36e5da['id']},'transaction':_0x42ba17};if(_0x1afdb7===_0x96c9('0x62')){_0x225d4b[_0x96c9('0x6d')]={'penalty':_0x36e5da[_0x96c9('0x6e')][_0x96c9('0x6c')]};}return db['User'+_0x1afdb7+_0x96c9('0x5c')][_0x96c9('0x6f')](_0x225d4b)[_0x96c9('0x2a')](function(){socket[_0x96c9('0x70')]('user'+_0x1afdb7+_0x96c9('0x71'),{'UserId':_0x4f916e,[_0x1afdb7+_0x96c9('0x72')]:_0x36e5da['id']});if(_0x1afdb7!=='Voice')return;return db[_0x96c9('0x73')][_0x96c9('0x74')]({'where':{'id':_0x47f82f[_0x96c9('0x4c')][_0x96c9('0x61')],'online':0x1},'attributes':['id',_0x96c9('0x30'),_0x96c9('0x75'),_0x96c9('0x76'),_0x96c9('0x77')],'raw':!![]})[_0x96c9('0x2a')](function(_0x4c2952){var _0x1a0b86=_[_0x96c9('0x32')](_0x4c2952,function(_0x25e6e6){return db[_0x96c9('0x78')][_0x96c9('0x79')]({'membername':_0x25e6e6[_0x96c9('0x30')],'UserId':_0x25e6e6['id'],'queue_name':_0x36e5da['name'],'VoiceQueueId':_0x36e5da['id'],'interface':_[_0x96c9('0x7a')](_0x25e6e6[_0x96c9('0x77')])?util['format']('SIP/%s',_0x25e6e6[_0x96c9('0x30')]):_0x25e6e6[_0x96c9('0x77')],'paused':_0x25e6e6[_0x96c9('0x76')]||![],'penalty':_0x36e5da[_0x96c9('0x6e')][_0x96c9('0x6c')]},{'transaction':_0x42ba17});});return Promise[_0x96c9('0x7b')](_0x1a0b86);});});});return Promise['all'](_0x17fdfa);});return Promise['all'](_0x1ae00b);});});return Promise[_0x96c9('0x7b')](_0x30442e)[_0x96c9('0x2a')](function(){return _0x506bbe[_0x96c9('0x7c')](_0x47f82f[_0x96c9('0x4c')][_0x96c9('0x61')],{'transaction':_0x42ba17})[_0x96c9('0x7d')](function(_0x1d67ea){return _0x1d67ea;});});});}})['then'](respondWithResult(_0x29ee8d,null))[_0x96c9('0x48')](handleError(_0x29ee8d,null));};exports[_0x96c9('0x7e')]=function(_0x5bd5a1,_0x365229){return db[_0x96c9('0x33')]['find']({'where':{'id':_0x5bd5a1[_0x96c9('0x53')]['id']}})[_0x96c9('0x2a')](handleEntityNotFound(_0x365229,null))['then'](function(_0x1afd1f){if(_0x1afd1f){var _0xb484b3=['Voice','Chat',_0x96c9('0x64'),_0x96c9('0x65'),'Fax',_0x96c9('0x67'),_0x96c9('0x68')];return db[_0x96c9('0x69')][_0x96c9('0x6a')](function(_0xb877d4){var _0x3ed69b=_[_0x96c9('0x32')](_0xb484b3,function(_0x163e5c){var _0x25316c={'attributes':['id',_0x96c9('0x30')]};return _0x1afd1f[_0x96c9('0x2c')+_0x163e5c+_0x96c9('0x5d')](_0x25316c)[_0x96c9('0x2a')](function(_0x218776){var _0x4c8cab=_[_0x96c9('0x32')](_0x218776,function(_0x327ef9){return _0x327ef9[_0x96c9('0x7e')](_0x5bd5a1[_0x96c9('0x37')][_0x96c9('0x61')],{'transaction':_0xb877d4})['then'](function(){var _0x3c1581=JSON[_0x96c9('0x7f')]('['+_0x5bd5a1[_0x96c9('0x37')]['ids']+']');var _0x1083a8=_[_0x96c9('0x32')](_0x3c1581,function(_0x3d4c5d){socket['emit'](_0x96c9('0x4d')+_0x163e5c+_0x96c9('0x80'),{'UserId':Number(_0x3d4c5d),[_0x163e5c+_0x96c9('0x72')]:_0x327ef9['id']});if(_0x163e5c!==_0x96c9('0x62'))return;return db['UserVoiceQueueRt'][_0x96c9('0x2b')]({'where':{'VoiceQueueId':_0x327ef9['id'],'UserId':_0x3d4c5d},'transaction':_0xb877d4});});return Promise[_0x96c9('0x7b')](_0x1083a8);});});return Promise[_0x96c9('0x7b')](_0x4c8cab);});});return Promise[_0x96c9('0x7b')](_0x3ed69b)[_0x96c9('0x2a')](function(){return _0x1afd1f[_0x96c9('0x7e')](_0x5bd5a1[_0x96c9('0x37')][_0x96c9('0x61')],{'transaction':_0xb877d4});});});}})[_0x96c9('0x2a')](respondWithStatusCode(_0x365229,null))[_0x96c9('0x48')](handleError(_0x365229,null));};exports[_0x96c9('0x81')]=function(_0x3a3259,_0x52a6cf,_0x2bbc43){var _0x37f4ee={};var _0x48060d={};var _0xdb6ebf;var _0x5e94f3;return db[_0x96c9('0x33')][_0x96c9('0x54')]({'where':{'id':_0x3a3259['params']['id']}})['then'](handleEntityNotFound(_0x52a6cf,null))[_0x96c9('0x2a')](function(_0xd7688f){if(_0xd7688f){_0xdb6ebf=_0xd7688f;_0x48060d[_0x96c9('0x36')]=_[_0x96c9('0x38')](db[_0x96c9('0x73')][_0x96c9('0x34')]);_0x48060d[_0x96c9('0x37')]=_[_0x96c9('0x38')](_0x3a3259[_0x96c9('0x37')]);_0x48060d[_0x96c9('0x39')]=_[_0x96c9('0x3a')](_0x48060d[_0x96c9('0x36')],_0x48060d[_0x96c9('0x37')]);_0x37f4ee[_0x96c9('0x3c')]=_[_0x96c9('0x3a')](_0x48060d[_0x96c9('0x36')],qs[_0x96c9('0x3b')](_0x3a3259[_0x96c9('0x37')][_0x96c9('0x3b')]));_0x37f4ee[_0x96c9('0x3c')]=_0x37f4ee['attributes']['length']?_0x37f4ee[_0x96c9('0x3c')]:_0x48060d[_0x96c9('0x36')];_0x37f4ee[_0x96c9('0x40')]=qs[_0x96c9('0x41')](_0x3a3259[_0x96c9('0x37')][_0x96c9('0x41')]);_0x37f4ee[_0x96c9('0x44')]=qs[_0x96c9('0x39')](_[_0x96c9('0x42')](_0x3a3259[_0x96c9('0x37')],_0x48060d['filters']));if(_0x3a3259['query'][_0x96c9('0x43')]){_0x37f4ee['where']=_[_0x96c9('0x45')](_0x37f4ee[_0x96c9('0x44')],{'$or':_[_0x96c9('0x32')](_0x37f4ee[_0x96c9('0x3c')],function(_0x558479){var _0x16fb11={};_0x16fb11[_0x558479]={'$like':'%'+_0x3a3259[_0x96c9('0x37')][_0x96c9('0x43')]+'%'};return _0x16fb11;})});}_0x37f4ee=_[_0x96c9('0x45')]({},_0x37f4ee,_0x3a3259['options']);return _0xdb6ebf[_0x96c9('0x81')](_0x37f4ee);}})['then'](function(_0x5a1f39){if(_0x5a1f39){_0x5e94f3=_0x5a1f39[_0x96c9('0x3d')];if(!_0x3a3259[_0x96c9('0x37')][_0x96c9('0x3e')](_0x96c9('0x3f'))){_0x37f4ee[_0x96c9('0x23')]=qs[_0x96c9('0x23')](_0x3a3259[_0x96c9('0x37')][_0x96c9('0x23')]);_0x37f4ee['offset']=qs[_0x96c9('0x21')](_0x3a3259['query'][_0x96c9('0x21')]);}return _0xdb6ebf[_0x96c9('0x81')](_0x37f4ee);}})[_0x96c9('0x2a')](function(_0xda24c1){if(_0xda24c1){return _0xda24c1?{'count':_0x5e94f3,'rows':_0xda24c1}:null;}})['then'](respondWithResult(_0x52a6cf,null))[_0x96c9('0x48')](handleError(_0x52a6cf,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 03822fa..aac3d82 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 _0xcad1=['events','Team','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x4d63cd,_0x55a24f){var _0x2ca6e1=function(_0x3a6416){while(--_0x3a6416){_0x4d63cd['push'](_0x4d63cd['shift']());}};_0x2ca6e1(++_0x55a24f);}(_0xcad1,0x168));var _0x1cad=function(_0x54907a,_0x497dfa){_0x54907a=_0x54907a-0x0;var _0x54bb99=_0xcad1[_0x54907a];return _0x54bb99;};'use strict';var EventEmitter=require(_0x1cad('0x0'));var Team=require('../../mysqldb')['db'][_0x1cad('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x1cad('0x2')](0x0);var events={'afterCreate':_0x1cad('0x3'),'afterUpdate':'update','afterDestroy':_0x1cad('0x4')};function emitEvent(_0x4a7558){return function(_0x2c8b9f,_0x4779a6,_0x2fabac){TeamEvents[_0x1cad('0x5')](_0x4a7558+':'+_0x2c8b9f['id'],_0x2c8b9f);TeamEvents[_0x1cad('0x5')](_0x4a7558,_0x2c8b9f);_0x2fabac(null);};}for(var e in events){if(events[_0x1cad('0x6')](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0x1cad('0x7')]=TeamEvents; \ No newline at end of file +var _0xe029=['save','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x22efa7,_0x16e841){var _0x1448ad=function(_0x37de06){while(--_0x37de06){_0x22efa7['push'](_0x22efa7['shift']());}};_0x1448ad(++_0x16e841);}(_0xe029,0x1e8));var _0x9e02=function(_0x3ea61c,_0x42150f){_0x3ea61c=_0x3ea61c-0x0;var _0x5a9497=_0xe029[_0x3ea61c];return _0x5a9497;};'use strict';var EventEmitter=require('events');var Team=require(_0x9e02('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x9e02('0x1')](0x0);var events={'afterCreate':_0x9e02('0x2'),'afterUpdate':'update','afterDestroy':_0x9e02('0x3')};function emitEvent(_0x33016a){return function(_0x210057,_0x52b246,_0xb597e3){TeamEvents[_0x9e02('0x4')](_0x33016a+':'+_0x210057['id'],_0x210057);TeamEvents[_0x9e02('0x4')](_0x33016a,_0x210057);_0xb597e3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x9e02('0x5')](e,emitEvent(event));}}module[_0x9e02('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c4a6e47..c3fd5ae 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 _0xc04e=['teams','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./team.attributes','exports','define','Team'];(function(_0x1720af,_0x187598){var _0x18ec99=function(_0x1eb46d){while(--_0x1eb46d){_0x1720af['push'](_0x1720af['shift']());}};_0x18ec99(++_0x187598);}(_0xc04e,0x135));var _0xec04=function(_0x2847c9,_0x184d8a){_0x2847c9=_0x2847c9-0x0;var _0x1ea830=_0xc04e[_0x2847c9];return _0x1ea830;};'use strict';var _=require('lodash');var util=require(_0xec04('0x0'));var logger=require(_0xec04('0x1'))(_0xec04('0x2'));var moment=require('moment');var BPromise=require(_0xec04('0x3'));var rp=require(_0xec04('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xec04('0x5'));var attributes=require(_0xec04('0x6'));module[_0xec04('0x7')]=function(_0x32c5bb,_0x4188c5){return _0x32c5bb[_0xec04('0x8')](_0xec04('0x9'),attributes,{'tableName':_0xec04('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0939=['bluebird','request-promise','path','rimraf','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','moment'];(function(_0x591e6e,_0x3f466f){var _0x279e1c=function(_0x23b23b){while(--_0x23b23b){_0x591e6e['push'](_0x591e6e['shift']());}};_0x279e1c(++_0x3f466f);}(_0x0939,0x163));var _0x9093=function(_0x2fd12b,_0x1f7d78){_0x2fd12b=_0x2fd12b-0x0;var _0x1f3a5c=_0x0939[_0x2fd12b];return _0x1f3a5c;};'use strict';var _=require(_0x9093('0x0'));var util=require(_0x9093('0x1'));var logger=require(_0x9093('0x2'))(_0x9093('0x3'));var moment=require(_0x9093('0x4'));var BPromise=require(_0x9093('0x5'));var rp=require(_0x9093('0x6'));var fs=require('fs');var path=require(_0x9093('0x7'));var rimraf=require(_0x9093('0x8'));var config=require(_0x9093('0x9'));var attributes=require(_0x9093('0xa'));module[_0x9093('0xb')]=function(_0x5334e9,_0xa40030){return _0x5334e9[_0x9093('0xc')](_0x9093('0xd'),attributes,{'tableName':_0x9093('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 0364a6f..be9a08d 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 _0xfc7a=['stringify','code','error','message','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0xfc7a,0xbd));var _0xafc7=function(_0x75e866,_0x30b4de){_0x75e866=_0x75e866-0x0;var _0x5e4b64=_0xfc7a[_0x75e866];return _0x5e4b64;};'use strict';var _=require(_0xafc7('0x0'));var util=require(_0xafc7('0x1'));var moment=require('moment');var BPromise=require(_0xafc7('0x2'));var rs=require(_0xafc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xafc7('0x4'))(_0xafc7('0x5'));var config=require('../../config/environment');var jayson=require(_0xafc7('0x6'));var client=jayson['client'][_0xafc7('0x7')]({'port':0x232a});config[_0xafc7('0x8')]=_[_0xafc7('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xafc7('0xa'))(new Redis(config['redis']));require(_0xafc7('0xb'))[_0xafc7('0xc')](socket);function respondWithRpcPromise(_0x22e3d4,_0x527359,_0x5000c7){return new BPromise(function(_0x5dacc3,_0x517f3a){return client['request'](_0x22e3d4,_0x5000c7)[_0xafc7('0xd')](function(_0x14c8e9){logger[_0xafc7('0xe')](_0xafc7('0xf'),_0x527359,_0xafc7('0x10'));logger[_0xafc7('0x11')]('Team,\x20%s,\x20%s,\x20%s',_0x527359,_0xafc7('0x10'),JSON[_0xafc7('0x12')](_0x14c8e9));if(_0x14c8e9['error']){if(_0x14c8e9['error'][_0xafc7('0x13')]===0x1f4){logger[_0xafc7('0x14')](_0xafc7('0xf'),_0x527359,_0x14c8e9[_0xafc7('0x14')][_0xafc7('0x15')]);return _0x517f3a(_0x14c8e9[_0xafc7('0x14')][_0xafc7('0x15')]);}logger['error']('Team,\x20%s,\x20%s',_0x527359,_0x14c8e9[_0xafc7('0x14')][_0xafc7('0x15')]);return _0x5dacc3(_0x14c8e9['error'][_0xafc7('0x15')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x527359,_0xafc7('0x10'));_0x5dacc3(_0x14c8e9['result'][_0xafc7('0x15')]);}})[_0xafc7('0x16')](function(_0x4b70c6){logger[_0xafc7('0x14')](_0xafc7('0xf'),_0x527359,_0x4b70c6);_0x517f3a(_0x4b70c6);});});} \ No newline at end of file +var _0xaeaa=['localhost','./team.socket','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xaeaa,0xa9));var _0xaaea=function(_0x389bff,_0x5afe52){_0x389bff=_0x389bff-0x0;var _0x599632=_0xaeaa[_0x389bff];return _0x599632;};'use strict';var _=require(_0xaaea('0x0'));var util=require(_0xaaea('0x1'));var moment=require('moment');var BPromise=require(_0xaaea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xaaea('0x3'));var db=require(_0xaaea('0x4'))['db'];var utils=require(_0xaaea('0x5'));var logger=require(_0xaaea('0x6'))('rpc');var config=require(_0xaaea('0x7'));var jayson=require(_0xaaea('0x8'));var client=jayson[_0xaaea('0x9')][_0xaaea('0xa')]({'port':0x232a});config[_0xaaea('0xb')]=_[_0xaaea('0xc')](config[_0xaaea('0xb')],{'host':_0xaaea('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaaea('0xb')]));require(_0xaaea('0xe'))['register'](socket);function respondWithRpcPromise(_0x370140,_0x181729,_0x5bd515){return new BPromise(function(_0x53d829,_0x23f564){return client[_0xaaea('0xf')](_0x370140,_0x5bd515)[_0xaaea('0x10')](function(_0x87ea29){logger[_0xaaea('0x11')](_0xaaea('0x12'),_0x181729,_0xaaea('0x13'));logger['debug'](_0xaaea('0x14'),_0x181729,_0xaaea('0x13'),JSON[_0xaaea('0x15')](_0x87ea29));if(_0x87ea29[_0xaaea('0x16')]){if(_0x87ea29[_0xaaea('0x16')]['code']===0x1f4){logger[_0xaaea('0x16')](_0xaaea('0x12'),_0x181729,_0x87ea29[_0xaaea('0x16')][_0xaaea('0x17')]);return _0x23f564(_0x87ea29[_0xaaea('0x16')][_0xaaea('0x17')]);}logger['error']('Team,\x20%s,\x20%s',_0x181729,_0x87ea29[_0xaaea('0x16')][_0xaaea('0x17')]);return _0x53d829(_0x87ea29[_0xaaea('0x16')][_0xaaea('0x17')]);}else{logger[_0xaaea('0x11')]('Team,\x20%s,\x20%s',_0x181729,_0xaaea('0x13'));_0x53d829(_0x87ea29[_0xaaea('0x18')][_0xaaea('0x17')]);}})[_0xaaea('0x19')](function(_0x4b0f13){logger[_0xaaea('0x16')]('Team,\x20%s,\x20%s',_0x181729,_0x4b0f13);_0x23f564(_0x4b0f13);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 47f828a..1b122cb 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 _0x41e7=['length','team:','./team.events','remove','update','removeListener','register'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x41e7,0x1c9));var _0x741e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x41e7[_0x14add3];return _0x4a174f;};'use strict';var TeamEvents=require(_0x741e('0x0'));var events=['save',_0x741e('0x1'),_0x741e('0x2')];function createListener(_0x41e139,_0x33c2d8){return function(_0x351e96){_0x33c2d8['emit'](_0x41e139,_0x351e96);};}function removeListener(_0x361cb2,_0x11d590){return function(){TeamEvents[_0x741e('0x3')](_0x361cb2,_0x11d590);};}exports[_0x741e('0x4')]=function(_0x3d53fc){for(var _0x22fd1d=0x0,_0x33d50f=events[_0x741e('0x5')];_0x22fd1d<_0x33d50f;_0x22fd1d++){var _0x4c1e27=events[_0x22fd1d];var _0xe7a9b7=createListener(_0x741e('0x6')+_0x4c1e27,_0x3d53fc);TeamEvents['on'](_0x4c1e27,_0xe7a9b7);}}; \ No newline at end of file +var _0xa047=['register','length','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x2a0738,_0x3c0bc5){var _0x159679=function(_0x9c9ec7){while(--_0x9c9ec7){_0x2a0738['push'](_0x2a0738['shift']());}};_0x159679(++_0x3c0bc5);}(_0xa047,0x1c5));var _0x7a04=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xa047[_0x1d24eb];return _0x1dc576;};'use strict';var TeamEvents=require(_0x7a04('0x0'));var events=[_0x7a04('0x1'),_0x7a04('0x2'),_0x7a04('0x3')];function createListener(_0x5e8f2e,_0x258f94){return function(_0x491906){_0x258f94[_0x7a04('0x4')](_0x5e8f2e,_0x491906);};}function removeListener(_0x269341,_0x2b3190){return function(){TeamEvents[_0x7a04('0x5')](_0x269341,_0x2b3190);};}exports[_0x7a04('0x6')]=function(_0x4cc23b){for(var _0x12564a=0x0,_0x3166ff=events[_0x7a04('0x7')];_0x12564a<_0x3166ff;_0x12564a++){var _0x5c183c=events[_0x12564a];var _0x10d92f=createListener(_0x7a04('0x8')+_0x5c183c,_0x4cc23b);TeamEvents['on'](_0x5c183c,_0x10d92f);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 6cc285b..003febd 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2250d1,_0x14c84f){var _0x3669b9=function(_0x4b296b){while(--_0x4b296b){_0x2250d1['push'](_0x2250d1['shift']());}};_0x3669b9(++_0x14c84f);}(_0xe706,0xa3));var _0x6e70=function(_0x179b74,_0x5dc97d){_0x179b74=_0x179b74-0x0;var _0x268f76=_0xe706[_0x179b74];return _0x268f76;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x31847f,_0x5ec6f7){var _0x1c6325=function(_0x46eb40){while(--_0x46eb40){_0x31847f['push'](_0x31847f['shift']());}};_0x1c6325(++_0x5ec6f7);}(_0xe706,0xa3));var _0x6e70=function(_0x42bd43,_0x59fb77){_0x42bd43=_0x42bd43-0x0;var _0x421e88=_0xe706[_0x42bd43];return _0x421e88;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 85dade1..c375b82 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 _0x0a4b=['INTEGER','sequelize'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x0a4b,0x6d));var _0xb0a4=function(_0x329e44,_0x2bec9b){_0x329e44=_0x329e44-0x0;var _0xe0eaac=_0x0a4b[_0x329e44];return _0xe0eaac;};'use strict';var Sequelize=require(_0xb0a4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xb0a4('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc6f6=['exports','sequelize'];(function(_0x10f78b,_0x309eff){var _0x43ec95=function(_0x48594e){while(--_0x48594e){_0x10f78b['push'](_0x10f78b['shift']());}};_0x43ec95(++_0x309eff);}(_0xc6f6,0x1cb));var _0x6c6f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc6f6[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x6c6f('0x0'));module[_0x6c6f('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index ca0c61e..16aed6e 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 _0xb43b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','lodash'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0xb43b,0xbf));var _0xbb43=function(_0x5506dd,_0xb0ab22){_0x5506dd=_0x5506dd-0x0;var _0x3b8e1f=_0xb43b[_0x5506dd];return _0x3b8e1f;};'use strict';var _=require(_0xbb43('0x0'));var util=require('util');var logger=require(_0xbb43('0x1'))(_0xbb43('0x2'));var moment=require(_0xbb43('0x3'));var BPromise=require(_0xbb43('0x4'));var rp=require(_0xbb43('0x5'));var fs=require('fs');var path=require(_0xbb43('0x6'));var rimraf=require(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var attributes=require(_0xbb43('0x9'));module[_0xbb43('0xa')]=function(_0x2e55f3,_0x51e44e){return _0x2e55f3[_0xbb43('0xb')]('TeamVoiceQueue',attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44ae=['exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x44ae,0x17d));var _0xe44a=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0x44ae[_0x412342];return _0x3e62cb;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var moment=require('moment');var BPromise=require(_0xe44a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44a('0x5'));var rimraf=require(_0xe44a('0x6'));var config=require(_0xe44a('0x7'));var attributes=require(_0xe44a('0x8'));module[_0xe44a('0x9')]=function(_0x3f9763,_0x5c1c49){return _0x3f9763[_0xe44a('0xa')](_0xe44a('0xb'),attributes,{'tableName':_0xe44a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 9aefa82..9158ba5 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 _0x13ad=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x40eb1d,_0x2b2d11){var _0x5c0c56=function(_0x3b312c){while(--_0x3b312c){_0x40eb1d['push'](_0x40eb1d['shift']());}};_0x5c0c56(++_0x2b2d11);}(_0x13ad,0x142));var _0xd13a=function(_0x294dcf,_0x1c45d3){_0x294dcf=_0x294dcf-0x0;var _0x48b27e=_0x13ad[_0x294dcf];return _0x48b27e;};'use strict';var _=require(_0xd13a('0x0'));var util=require(_0xd13a('0x1'));var moment=require('moment');var BPromise=require(_0xd13a('0x2'));var rs=require(_0xd13a('0x3'));var fs=require('fs');var Redis=require(_0xd13a('0x4'));var db=require(_0xd13a('0x5'))['db'];var utils=require(_0xd13a('0x6'));var logger=require('../../config/logger')(_0xd13a('0x7'));var config=require(_0xd13a('0x8'));var jayson=require(_0xd13a('0x9'));var client=jayson[_0xd13a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5366df,_0x4d6d63,_0x3ee845){return new BPromise(function(_0x59c0d9,_0x33d5aa){return client[_0xd13a('0xb')](_0x5366df,_0x3ee845)['then'](function(_0x3e7fc2){logger['info'](_0xd13a('0xc'),_0x4d6d63,_0xd13a('0xd'));logger[_0xd13a('0xe')](_0xd13a('0xf'),_0x4d6d63,_0xd13a('0xd'),JSON[_0xd13a('0x10')](_0x3e7fc2));if(_0x3e7fc2[_0xd13a('0x11')]){if(_0x3e7fc2[_0xd13a('0x11')][_0xd13a('0x12')]===0x1f4){logger['error'](_0xd13a('0xc'),_0x4d6d63,_0x3e7fc2[_0xd13a('0x11')][_0xd13a('0x13')]);return _0x33d5aa(_0x3e7fc2[_0xd13a('0x11')][_0xd13a('0x13')]);}logger[_0xd13a('0x11')](_0xd13a('0xc'),_0x4d6d63,_0x3e7fc2[_0xd13a('0x11')]['message']);return _0x59c0d9(_0x3e7fc2[_0xd13a('0x11')][_0xd13a('0x13')]);}else{logger[_0xd13a('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4d6d63,_0xd13a('0xd'));_0x59c0d9(_0x3e7fc2[_0xd13a('0x15')][_0xd13a('0x13')]);}})[_0xd13a('0x16')](function(_0x30a650){logger['error'](_0xd13a('0xc'),_0x4d6d63,_0x30a650);_0x33d5aa(_0x30a650);});});} \ No newline at end of file +var _0x57cf=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x277504,_0x41a682){var _0x1ff6a0=function(_0x413c60){while(--_0x413c60){_0x277504['push'](_0x277504['shift']());}};_0x1ff6a0(++_0x41a682);}(_0x57cf,0x11b));var _0xf57c=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x57cf[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0xf57c('0x0'));var util=require(_0xf57c('0x1'));var moment=require(_0xf57c('0x2'));var BPromise=require(_0xf57c('0x3'));var rs=require(_0xf57c('0x4'));var fs=require('fs');var Redis=require(_0xf57c('0x5'));var db=require(_0xf57c('0x6'))['db'];var utils=require(_0xf57c('0x7'));var logger=require(_0xf57c('0x8'))(_0xf57c('0x9'));var config=require('../../config/environment');var jayson=require(_0xf57c('0xa'));var client=jayson['client'][_0xf57c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5816f5,_0x53ed52,_0x21a69d){return new BPromise(function(_0x4867f6,_0x2cbb69){return client[_0xf57c('0xc')](_0x5816f5,_0x21a69d)['then'](function(_0x5b5314){logger[_0xf57c('0xd')](_0xf57c('0xe'),_0x53ed52,_0xf57c('0xf'));logger[_0xf57c('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x53ed52,_0xf57c('0xf'),JSON[_0xf57c('0x11')](_0x5b5314));if(_0x5b5314[_0xf57c('0x12')]){if(_0x5b5314['error'][_0xf57c('0x13')]===0x1f4){logger['error'](_0xf57c('0xe'),_0x53ed52,_0x5b5314[_0xf57c('0x12')]['message']);return _0x2cbb69(_0x5b5314[_0xf57c('0x12')]['message']);}logger[_0xf57c('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x53ed52,_0x5b5314[_0xf57c('0x12')][_0xf57c('0x14')]);return _0x4867f6(_0x5b5314[_0xf57c('0x12')][_0xf57c('0x14')]);}else{logger[_0xf57c('0xd')](_0xf57c('0xe'),_0x53ed52,_0xf57c('0xf'));_0x4867f6(_0x5b5314[_0xf57c('0x15')]['message']);}})[_0xf57c('0x16')](function(_0x524084){logger[_0xf57c('0x12')](_0xf57c('0xe'),_0x53ed52,_0x524084);_0x2cbb69(_0x524084);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2693505..bd0ec49 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 _0xd506=['multer','../../components/interaction/service','isAuthenticated','index','get','show','post','create','/:id','update','delete'];(function(_0x53396d,_0x100863){var _0x236ca0=function(_0x5f5224){while(--_0x5f5224){_0x53396d['push'](_0x53396d['shift']());}};_0x236ca0(++_0x100863);}(_0xd506,0x197));var _0x6d50=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xd506[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x6d50('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d50('0x1'));var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth[_0x6d50('0x2')](),controller[_0x6d50('0x3')]);router[_0x6d50('0x4')]('/:id',auth[_0x6d50('0x2')](),controller[_0x6d50('0x5')]);router[_0x6d50('0x6')]('/',auth['isAuthenticated'](),controller[_0x6d50('0x7')]);router['put'](_0x6d50('0x8'),auth[_0x6d50('0x2')](),controller[_0x6d50('0x9')]);router[_0x6d50('0xa')](_0x6d50('0x8'),auth[_0x6d50('0x2')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf55c=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x59fda5,_0x240b71){var _0x1d110c=function(_0x22235f){while(--_0x22235f){_0x59fda5['push'](_0x59fda5['shift']());}};_0x1d110c(++_0x240b71);}(_0xf55c,0x1e7));var _0xcf55=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xf55c[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0xcf55('0x0'));var util=require('util');var path=require(_0xcf55('0x1'));var timeout=require(_0xcf55('0x2'));var express=require(_0xcf55('0x3'));var router=express[_0xcf55('0x4')]();var fs_extra=require(_0xcf55('0x5'));var auth=require(_0xcf55('0x6'));var interaction=require(_0xcf55('0x7'));var config=require('../../config/environment');var controller=require(_0xcf55('0x8'));router[_0xcf55('0x9')]('/',auth[_0xcf55('0xa')](),controller[_0xcf55('0xb')]);router['get'](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0xd')]);router[_0xcf55('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf55('0xf')]);router[_0xcf55('0x10')](_0xcf55('0xc'),auth[_0xcf55('0xa')](),controller[_0xcf55('0x11')]);router[_0xcf55('0x12')](_0xcf55('0xc'),auth['isAuthenticated'](),controller[_0xcf55('0x13')]);module[_0xcf55('0x14')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 2eb9972..f633952 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 _0xa737=['STRING'];(function(_0x522c00,_0x33237d){var _0x1f4af4=function(_0x339495){while(--_0x339495){_0x522c00['push'](_0x522c00['shift']());}};_0x1f4af4(++_0x33237d);}(_0xa737,0x187));var _0x7a73=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa737[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7a73('0x0')]},'description':{'type':Sequelize[_0x7a73('0x0')]},'html':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9bd4=['exports','STRING','TEXT','sequelize'];(function(_0x4a3554,_0x14f2fd){var _0x12e4cb=function(_0x30dedc){while(--_0x30dedc){_0x4a3554['push'](_0x4a3554['shift']());}};_0x12e4cb(++_0x14f2fd);}(_0x9bd4,0xa3));var _0x49bd=function(_0x40c2f8,_0x2514a3){_0x40c2f8=_0x40c2f8-0x0;var _0x4efecb=_0x9bd4[_0x40c2f8];return _0x4efecb;};'use strict';var Sequelize=require(_0x49bd('0x0'));module[_0x49bd('0x1')]={'name':{'type':Sequelize[_0x49bd('0x2')]},'description':{'type':Sequelize[_0x49bd('0x2')]},'html':{'type':Sequelize[_0x49bd('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c703b3a..f50b7fb 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 _0x4fd0=['role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Templates','UserProfileResource','sendStatus','error','stack','name','Template','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','map','VIRTUAL','merge','include','rows','catch','params','keys','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x257280,_0x2921df){var _0xc4550e=function(_0x35bcfd){while(--_0x35bcfd){_0x257280['push'](_0x257280['shift']());}};_0xc4550e(++_0x2921df);}(_0x4fd0,0x195));var _0x04fd=function(_0x1c4831,_0x3ff74a){_0x1c4831=_0x1c4831-0x0;var _0x1e6a6d=_0x4fd0[_0x1c4831];return _0x1e6a6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x04fd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04fd('0x1'));var rp=require(_0x04fd('0x2'));var moment=require(_0x04fd('0x3'));var BPromise=require(_0x04fd('0x4'));var Mustache=require(_0x04fd('0x5'));var util=require(_0x04fd('0x6'));var path=require(_0x04fd('0x7'));var sox=require(_0x04fd('0x8'));var csv=require(_0x04fd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x04fd('0xa'));var squel=require(_0x04fd('0xb'));var crypto=require(_0x04fd('0xc'));var jsforce=require(_0x04fd('0xd'));var deskjs=require(_0x04fd('0xe'));var toCsv=require(_0x04fd('0x9'));var querystring=require(_0x04fd('0xf'));var Papa=require(_0x04fd('0x10'));var Redis=require(_0x04fd('0x11'));var authService=require(_0x04fd('0x12'));var qs=require(_0x04fd('0x13'));var as=require(_0x04fd('0x14'));var hardwareService=require(_0x04fd('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x04fd('0x16'));var config=require(_0x04fd('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ea9ad,_0x338192){_0x338192=_0x338192||0xcc;return function(_0x192ace){if(_0x192ace){return _0x1ea9ad['sendStatus'](_0x338192);}return _0x1ea9ad[_0x04fd('0x18')](_0x338192)['end']();};}function respondWithResult(_0x572c8c,_0x524a7e){_0x524a7e=_0x524a7e||0xc8;return function(_0x20ef34){if(_0x20ef34){return _0x572c8c[_0x04fd('0x18')](_0x524a7e)[_0x04fd('0x19')](_0x20ef34);}};}function respondWithFilteredResult(_0x32cb98,_0x58f107){return function(_0x3cf7a7){if(_0x3cf7a7){var _0xe7bd42=typeof _0x58f107['offset']==='undefined'&&typeof _0x58f107['limit']===_0x04fd('0x1a');var _0x3a5314=_0x3cf7a7[_0x04fd('0x1b')];var _0x1def57=_0xe7bd42?0x0:_0x58f107['offset'];var _0x1e3f30=_0xe7bd42?_0x3cf7a7[_0x04fd('0x1b')]:_0x58f107[_0x04fd('0x1c')]+_0x58f107[_0x04fd('0x1d')];var _0x10a9fa;if(_0x1e3f30>=_0x3a5314){_0x1e3f30=_0x3a5314;_0x10a9fa=0xc8;}else{_0x10a9fa=0xce;}_0x32cb98[_0x04fd('0x18')](_0x10a9fa);return _0x32cb98[_0x04fd('0x1e')](_0x04fd('0x1f'),_0x1def57+'-'+_0x1e3f30+'/'+_0x3a5314)['json'](_0x3cf7a7);}return null;};}function patchUpdates(_0xefe6f){return function(_0xb5e3bc){try{jsonpatch[_0x04fd('0x20')](_0xb5e3bc,_0xefe6f,!![]);}catch(_0x2fa6bd){return BPromise[_0x04fd('0x21')](_0x2fa6bd);}return _0xb5e3bc[_0x04fd('0x22')]();};}function saveUpdates(_0x308e3e,_0x229ccc){return function(_0x2e591d){if(_0x2e591d){return _0x2e591d[_0x04fd('0x23')](_0x308e3e)[_0x04fd('0x24')](function(_0x4c8d99){return _0x4c8d99;});}return null;};}function removeEntity(_0x5b4657,_0x4f809c){return function(_0x5abc99){if(_0x5abc99){return _0x5abc99[_0x04fd('0x25')]()[_0x04fd('0x24')](function(){var _0x3b5eef=_0x5abc99['get']({'plain':!![]});var _0x4a0147=_0x04fd('0x26');return db[_0x04fd('0x27')]['destroy']({'where':{'type':_0x4a0147,'resourceId':_0x3b5eef['id']}})[_0x04fd('0x24')](function(){return _0x5abc99;});})[_0x04fd('0x24')](function(){_0x5b4657[_0x04fd('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20bcdd,_0x1d09c9){return function(_0x349545){if(!_0x349545){_0x20bcdd[_0x04fd('0x28')](0x194);}return _0x349545;};}function handleError(_0x1c0b9f,_0x8f83e6){_0x8f83e6=_0x8f83e6||0x1f4;return function(_0x3c6592){logger[_0x04fd('0x29')](_0x3c6592[_0x04fd('0x2a')]);if(_0x3c6592[_0x04fd('0x2b')]){delete _0x3c6592[_0x04fd('0x2b')];}_0x1c0b9f[_0x04fd('0x18')](_0x8f83e6)['send'](_0x3c6592);};}exports['index']=function(_0x284df7,_0x1e7ff4){var _0x1c9f78={},_0x2f0452={},_0x1a728={'count':0x0,'rows':[]};var _0x2ac9c8=_['map'](db[_0x04fd('0x2c')]['rawAttributes'],function(_0x41cd50){return{'name':_0x41cd50['fieldName'],'type':_0x41cd50[_0x04fd('0x2d')][_0x04fd('0x2e')]};});_0x2f0452[_0x04fd('0x2f')]=_['map'](_0x2ac9c8,_0x04fd('0x2b'));_0x2f0452[_0x04fd('0x30')]=_['keys'](_0x284df7['query']);_0x2f0452[_0x04fd('0x31')]=_[_0x04fd('0x32')](_0x2f0452[_0x04fd('0x2f')],_0x2f0452[_0x04fd('0x30')]);_0x1c9f78['attributes']=_[_0x04fd('0x32')](_0x2f0452[_0x04fd('0x2f')],qs[_0x04fd('0x33')](_0x284df7[_0x04fd('0x30')][_0x04fd('0x33')]));_0x1c9f78[_0x04fd('0x34')]=_0x1c9f78[_0x04fd('0x34')][_0x04fd('0x35')]?_0x1c9f78[_0x04fd('0x34')]:_0x2f0452[_0x04fd('0x2f')];if(!_0x284df7['query'][_0x04fd('0x36')](_0x04fd('0x37'))){_0x1c9f78['limit']=qs[_0x04fd('0x1d')](_0x284df7['query'][_0x04fd('0x1d')]);_0x1c9f78['offset']=qs['offset'](_0x284df7[_0x04fd('0x30')][_0x04fd('0x1c')]);}_0x1c9f78['order']=qs['sort'](_0x284df7[_0x04fd('0x30')][_0x04fd('0x38')]);_0x1c9f78[_0x04fd('0x39')]=qs['filters'](_['pick'](_0x284df7['query'],_0x2f0452['filters']),_0x2ac9c8);if(_0x284df7[_0x04fd('0x30')][_0x04fd('0x3a')]){_0x1c9f78[_0x04fd('0x39')]=_['merge'](_0x1c9f78[_0x04fd('0x39')],{'$or':_[_0x04fd('0x3b')](_0x2ac9c8,function(_0x494bbe){if(_0x494bbe[_0x04fd('0x2d')]!==_0x04fd('0x3c')){var _0x2cfaf2={};_0x2cfaf2[_0x494bbe[_0x04fd('0x2b')]]={'$like':'%'+_0x284df7[_0x04fd('0x30')]['filter']+'%'};return _0x2cfaf2;}})});}_0x1c9f78=_[_0x04fd('0x3d')]({},_0x1c9f78,_0x284df7['options']);var _0x186622={'where':_0x1c9f78[_0x04fd('0x39')]};return db[_0x04fd('0x2c')]['count'](_0x186622)[_0x04fd('0x24')](function(_0x5a86a1){_0x1a728[_0x04fd('0x1b')]=_0x5a86a1;if(_0x284df7[_0x04fd('0x30')]['includeAll']){_0x1c9f78[_0x04fd('0x3e')]=[{'all':!![]}];}return db['Template']['findAll'](_0x1c9f78);})[_0x04fd('0x24')](function(_0x4ca77b){_0x1a728[_0x04fd('0x3f')]=_0x4ca77b;return _0x1a728;})[_0x04fd('0x24')](respondWithFilteredResult(_0x1e7ff4,_0x1c9f78))[_0x04fd('0x40')](handleError(_0x1e7ff4,null));};exports['show']=function(_0x3738b0,_0x130f4d){var _0x39df35={'raw':!![],'where':{'id':_0x3738b0[_0x04fd('0x41')]['id']}},_0x55a9bf={};_0x55a9bf[_0x04fd('0x2f')]=_[_0x04fd('0x42')](db[_0x04fd('0x2c')][_0x04fd('0x43')]);_0x55a9bf[_0x04fd('0x30')]=_['keys'](_0x3738b0['query']);_0x55a9bf[_0x04fd('0x31')]=_[_0x04fd('0x32')](_0x55a9bf[_0x04fd('0x2f')],_0x55a9bf[_0x04fd('0x30')]);_0x39df35[_0x04fd('0x34')]=_[_0x04fd('0x32')](_0x55a9bf[_0x04fd('0x2f')],qs[_0x04fd('0x33')](_0x3738b0['query']['fields']));_0x39df35[_0x04fd('0x34')]=_0x39df35[_0x04fd('0x34')]['length']?_0x39df35[_0x04fd('0x34')]:_0x55a9bf[_0x04fd('0x2f')];if(_0x3738b0[_0x04fd('0x30')][_0x04fd('0x44')]){_0x39df35[_0x04fd('0x3e')]=[{'all':!![]}];}_0x39df35=_[_0x04fd('0x3d')]({},_0x39df35,_0x3738b0[_0x04fd('0x45')]);return db[_0x04fd('0x2c')][_0x04fd('0x46')](_0x39df35)['then'](handleEntityNotFound(_0x130f4d,null))[_0x04fd('0x24')](respondWithResult(_0x130f4d,null))[_0x04fd('0x40')](handleError(_0x130f4d,null));};exports[_0x04fd('0x47')]=function(_0x24174b,_0x15bf14){return db[_0x04fd('0x2c')][_0x04fd('0x47')](_0x24174b[_0x04fd('0x48')],{})[_0x04fd('0x24')](function(_0x5c71dc){var _0x42ad91=_0x24174b[_0x04fd('0x49')]['get']({'plain':!![]});if(!_0x42ad91)throw new Error(_0x04fd('0x4a'));if(_0x42ad91[_0x04fd('0x4b')]==='user'){var _0x193604=_0x5c71dc[_0x04fd('0x4c')]({'plain':!![]});var _0x17c4d4=_0x04fd('0x26');return db[_0x04fd('0x4d')][_0x04fd('0x46')]({'where':{'name':_0x17c4d4,'userProfileId':_0x42ad91['userProfileId']},'raw':!![]})[_0x04fd('0x24')](function(_0x495b43){if(_0x495b43&&_0x495b43[_0x04fd('0x4e')]===0x0){return db[_0x04fd('0x27')]['create']({'name':_0x193604[_0x04fd('0x2b')],'resourceId':_0x193604['id'],'type':_0x495b43[_0x04fd('0x2b')],'sectionId':_0x495b43['id']},{})[_0x04fd('0x24')](function(){return _0x5c71dc;});}else{return _0x5c71dc;}})[_0x04fd('0x40')](function(_0x2e41aa){logger[_0x04fd('0x29')](_0x04fd('0x4f'),_0x2e41aa);throw _0x2e41aa;});}return _0x5c71dc;})['then'](respondWithResult(_0x15bf14,0xc9))[_0x04fd('0x40')](handleError(_0x15bf14,null));};exports['update']=function(_0x10c9a2,_0x2d381d){if(_0x10c9a2[_0x04fd('0x48')]['id']){delete _0x10c9a2[_0x04fd('0x48')]['id'];}return db['Template'][_0x04fd('0x46')]({'where':{'id':_0x10c9a2['params']['id']}})['then'](handleEntityNotFound(_0x2d381d,null))[_0x04fd('0x24')](saveUpdates(_0x10c9a2[_0x04fd('0x48')],null))['then'](respondWithResult(_0x2d381d,null))[_0x04fd('0x40')](handleError(_0x2d381d,null));};exports[_0x04fd('0x25')]=function(_0x1692ab,_0x573c31){return db[_0x04fd('0x2c')][_0x04fd('0x46')]({'where':{'id':_0x1692ab[_0x04fd('0x41')]['id']}})['then'](handleEntityNotFound(_0x573c31,null))[_0x04fd('0x24')](removeEntity(_0x573c31,null))[_0x04fd('0x40')](handleError(_0x573c31,null));}; \ No newline at end of file +var _0x04c7=['limit','count','set','save','update','then','get','Templates','UserProfileResource','destroy','end','error','name','send','index','map','Template','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','keys','find','catch','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined'];(function(_0x2e3cd2,_0x54ff63){var _0x4b0335=function(_0x347469){while(--_0x347469){_0x2e3cd2['push'](_0x2e3cd2['shift']());}};_0x4b0335(++_0x54ff63);}(_0x04c7,0xd8));var _0x704c=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x04c7[_0x494d1f];return _0x457b6e;};'use strict';var emlformat=require(_0x704c('0x0'));var rimraf=require(_0x704c('0x1'));var zipdir=require(_0x704c('0x2'));var jsonpatch=require(_0x704c('0x3'));var rp=require(_0x704c('0x4'));var moment=require(_0x704c('0x5'));var BPromise=require(_0x704c('0x6'));var Mustache=require(_0x704c('0x7'));var util=require(_0x704c('0x8'));var path=require(_0x704c('0x9'));var sox=require(_0x704c('0xa'));var csv=require(_0x704c('0xb'));var ejs=require(_0x704c('0xc'));var fs=require('fs');var fs_extra=require(_0x704c('0xd'));var _=require(_0x704c('0xe'));var squel=require('squel');var crypto=require(_0x704c('0xf'));var jsforce=require(_0x704c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x704c('0x11'));var Papa=require('papaparse');var Redis=require(_0x704c('0x12'));var authService=require(_0x704c('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x704c('0x14'));var logger=require(_0x704c('0x15'))('api');var utils=require(_0x704c('0x16'));var config=require(_0x704c('0x17'));var licenseUtil=require(_0x704c('0x18'));var db=require(_0x704c('0x19'))['db'];function respondWithStatusCode(_0x563aa7,_0x4c7d00){_0x4c7d00=_0x4c7d00||0xcc;return function(_0x1ca184){if(_0x1ca184){return _0x563aa7['sendStatus'](_0x4c7d00);}return _0x563aa7[_0x704c('0x1a')](_0x4c7d00)['end']();};}function respondWithResult(_0x4a96eb,_0x2e3c03){_0x2e3c03=_0x2e3c03||0xc8;return function(_0x1cc966){if(_0x1cc966){return _0x4a96eb['status'](_0x2e3c03)[_0x704c('0x1b')](_0x1cc966);}};}function respondWithFilteredResult(_0x541d8e,_0x590c4e){return function(_0x2af5c7){if(_0x2af5c7){var _0x429c58=typeof _0x590c4e[_0x704c('0x1c')]===_0x704c('0x1d')&&typeof _0x590c4e[_0x704c('0x1e')]===_0x704c('0x1d');var _0xd4e39d=_0x2af5c7[_0x704c('0x1f')];var _0x16ab4e=_0x429c58?0x0:_0x590c4e[_0x704c('0x1c')];var _0x2ff7e5=_0x429c58?_0x2af5c7[_0x704c('0x1f')]:_0x590c4e[_0x704c('0x1c')]+_0x590c4e[_0x704c('0x1e')];var _0x55bc6e;if(_0x2ff7e5>=_0xd4e39d){_0x2ff7e5=_0xd4e39d;_0x55bc6e=0xc8;}else{_0x55bc6e=0xce;}_0x541d8e['status'](_0x55bc6e);return _0x541d8e[_0x704c('0x20')]('Content-Range',_0x16ab4e+'-'+_0x2ff7e5+'/'+_0xd4e39d)[_0x704c('0x1b')](_0x2af5c7);}return null;};}function patchUpdates(_0x260dc8){return function(_0xd9c484){try{jsonpatch['apply'](_0xd9c484,_0x260dc8,!![]);}catch(_0x10085d){return BPromise['reject'](_0x10085d);}return _0xd9c484[_0x704c('0x21')]();};}function saveUpdates(_0x461ce6,_0x3d1eb6){return function(_0x2edf30){if(_0x2edf30){return _0x2edf30[_0x704c('0x22')](_0x461ce6)[_0x704c('0x23')](function(_0x1d8efc){return _0x1d8efc;});}return null;};}function removeEntity(_0x465e64,_0x56463d){return function(_0x51e7a2){if(_0x51e7a2){return _0x51e7a2['destroy']()[_0x704c('0x23')](function(){var _0x230d6a=_0x51e7a2[_0x704c('0x24')]({'plain':!![]});var _0x5c3056=_0x704c('0x25');return db[_0x704c('0x26')][_0x704c('0x27')]({'where':{'type':_0x5c3056,'resourceId':_0x230d6a['id']}})[_0x704c('0x23')](function(){return _0x51e7a2;});})[_0x704c('0x23')](function(){_0x465e64['status'](0xcc)[_0x704c('0x28')]();});}};}function handleEntityNotFound(_0xff81d7,_0x538925){return function(_0x3d7e15){if(!_0x3d7e15){_0xff81d7['sendStatus'](0x194);}return _0x3d7e15;};}function handleError(_0x2ca25c,_0x59d1c4){_0x59d1c4=_0x59d1c4||0x1f4;return function(_0x3d9217){logger[_0x704c('0x29')](_0x3d9217['stack']);if(_0x3d9217[_0x704c('0x2a')]){delete _0x3d9217[_0x704c('0x2a')];}_0x2ca25c[_0x704c('0x1a')](_0x59d1c4)[_0x704c('0x2b')](_0x3d9217);};}exports[_0x704c('0x2c')]=function(_0x1d02bb,_0x553145){var _0x5cd70b={},_0x3dbd8b={},_0x865a3a={'count':0x0,'rows':[]};var _0x39552f=_[_0x704c('0x2d')](db[_0x704c('0x2e')][_0x704c('0x2f')],function(_0x4ada1b){return{'name':_0x4ada1b[_0x704c('0x30')],'type':_0x4ada1b['type'][_0x704c('0x31')]};});_0x3dbd8b[_0x704c('0x32')]=_[_0x704c('0x2d')](_0x39552f,_0x704c('0x2a'));_0x3dbd8b['query']=_['keys'](_0x1d02bb[_0x704c('0x33')]);_0x3dbd8b['filters']=_[_0x704c('0x34')](_0x3dbd8b['model'],_0x3dbd8b[_0x704c('0x33')]);_0x5cd70b[_0x704c('0x35')]=_[_0x704c('0x34')](_0x3dbd8b[_0x704c('0x32')],qs[_0x704c('0x36')](_0x1d02bb[_0x704c('0x33')]['fields']));_0x5cd70b[_0x704c('0x35')]=_0x5cd70b[_0x704c('0x35')][_0x704c('0x37')]?_0x5cd70b['attributes']:_0x3dbd8b[_0x704c('0x32')];if(!_0x1d02bb[_0x704c('0x33')][_0x704c('0x38')]('nolimit')){_0x5cd70b[_0x704c('0x1e')]=qs[_0x704c('0x1e')](_0x1d02bb[_0x704c('0x33')]['limit']);_0x5cd70b[_0x704c('0x1c')]=qs[_0x704c('0x1c')](_0x1d02bb['query']['offset']);}_0x5cd70b[_0x704c('0x39')]=qs['sort'](_0x1d02bb[_0x704c('0x33')][_0x704c('0x3a')]);_0x5cd70b[_0x704c('0x3b')]=qs[_0x704c('0x3c')](_[_0x704c('0x3d')](_0x1d02bb['query'],_0x3dbd8b[_0x704c('0x3c')]),_0x39552f);if(_0x1d02bb[_0x704c('0x33')][_0x704c('0x3e')]){_0x5cd70b[_0x704c('0x3b')]=_['merge'](_0x5cd70b[_0x704c('0x3b')],{'$or':_[_0x704c('0x2d')](_0x39552f,function(_0x56d503){if(_0x56d503[_0x704c('0x3f')]!==_0x704c('0x40')){var _0x4b8228={};_0x4b8228[_0x56d503[_0x704c('0x2a')]]={'$like':'%'+_0x1d02bb[_0x704c('0x33')][_0x704c('0x3e')]+'%'};return _0x4b8228;}})});}_0x5cd70b=_[_0x704c('0x41')]({},_0x5cd70b,_0x1d02bb[_0x704c('0x42')]);var _0x4b9c73={'where':_0x5cd70b[_0x704c('0x3b')]};return db['Template'][_0x704c('0x1f')](_0x4b9c73)[_0x704c('0x23')](function(_0x1021ad){_0x865a3a[_0x704c('0x1f')]=_0x1021ad;if(_0x1d02bb[_0x704c('0x33')][_0x704c('0x43')]){_0x5cd70b[_0x704c('0x44')]=[{'all':!![]}];}return db[_0x704c('0x2e')][_0x704c('0x45')](_0x5cd70b);})[_0x704c('0x23')](function(_0xdc52f6){_0x865a3a[_0x704c('0x46')]=_0xdc52f6;return _0x865a3a;})[_0x704c('0x23')](respondWithFilteredResult(_0x553145,_0x5cd70b))['catch'](handleError(_0x553145,null));};exports[_0x704c('0x47')]=function(_0x266adf,_0x357763){var _0x3be6f9={'raw':!![],'where':{'id':_0x266adf['params']['id']}},_0x429474={};_0x429474[_0x704c('0x32')]=_[_0x704c('0x48')](db[_0x704c('0x2e')][_0x704c('0x2f')]);_0x429474[_0x704c('0x33')]=_[_0x704c('0x48')](_0x266adf['query']);_0x429474[_0x704c('0x3c')]=_['intersection'](_0x429474[_0x704c('0x32')],_0x429474[_0x704c('0x33')]);_0x3be6f9['attributes']=_[_0x704c('0x34')](_0x429474[_0x704c('0x32')],qs[_0x704c('0x36')](_0x266adf['query'][_0x704c('0x36')]));_0x3be6f9['attributes']=_0x3be6f9[_0x704c('0x35')][_0x704c('0x37')]?_0x3be6f9[_0x704c('0x35')]:_0x429474[_0x704c('0x32')];if(_0x266adf['query'][_0x704c('0x43')]){_0x3be6f9[_0x704c('0x44')]=[{'all':!![]}];}_0x3be6f9=_[_0x704c('0x41')]({},_0x3be6f9,_0x266adf['options']);return db['Template'][_0x704c('0x49')](_0x3be6f9)[_0x704c('0x23')](handleEntityNotFound(_0x357763,null))[_0x704c('0x23')](respondWithResult(_0x357763,null))[_0x704c('0x4a')](handleError(_0x357763,null));};exports[_0x704c('0x4b')]=function(_0x3475d6,_0x23dc37){return db['Template']['create'](_0x3475d6[_0x704c('0x4c')],{})[_0x704c('0x23')](function(_0xed95cb){var _0x1d1188=_0x3475d6[_0x704c('0x4d')][_0x704c('0x24')]({'plain':!![]});if(!_0x1d1188)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d1188['role']===_0x704c('0x4d')){var _0x52e8a4=_0xed95cb[_0x704c('0x24')]({'plain':!![]});var _0x23e9ff=_0x704c('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x23e9ff,'userProfileId':_0x1d1188[_0x704c('0x4e')]},'raw':!![]})[_0x704c('0x23')](function(_0x2e071f){if(_0x2e071f&&_0x2e071f[_0x704c('0x4f')]===0x0){return db['UserProfileResource'][_0x704c('0x4b')]({'name':_0x52e8a4[_0x704c('0x2a')],'resourceId':_0x52e8a4['id'],'type':_0x2e071f['name'],'sectionId':_0x2e071f['id']},{})[_0x704c('0x23')](function(){return _0xed95cb;});}else{return _0xed95cb;}})['catch'](function(_0x35a5dd){logger[_0x704c('0x29')](_0x704c('0x50'),_0x35a5dd);throw _0x35a5dd;});}return _0xed95cb;})[_0x704c('0x23')](respondWithResult(_0x23dc37,0xc9))['catch'](handleError(_0x23dc37,null));};exports[_0x704c('0x22')]=function(_0x146c25,_0x253ef1){if(_0x146c25[_0x704c('0x4c')]['id']){delete _0x146c25[_0x704c('0x4c')]['id'];}return db['Template']['find']({'where':{'id':_0x146c25[_0x704c('0x51')]['id']}})[_0x704c('0x23')](handleEntityNotFound(_0x253ef1,null))['then'](saveUpdates(_0x146c25[_0x704c('0x4c')],null))['then'](respondWithResult(_0x253ef1,null))[_0x704c('0x4a')](handleError(_0x253ef1,null));};exports['destroy']=function(_0x522241,_0x5ce410){return db['Template']['find']({'where':{'id':_0x522241[_0x704c('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ce410,null))[_0x704c('0x23')](removeEntity(_0x5ce410,null))[_0x704c('0x4a')](handleError(_0x5ce410,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 7b4f4ce..a991da1 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 _0xb6f7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Template','tools_templates','lodash','util','../../config/logger','api'];(function(_0x1d46ce,_0x43d67c){var _0x4fece8=function(_0x245d66){while(--_0x245d66){_0x1d46ce['push'](_0x1d46ce['shift']());}};_0x4fece8(++_0x43d67c);}(_0xb6f7,0x176));var _0x7b6f=function(_0x354719,_0x274e71){_0x354719=_0x354719-0x0;var _0x591f63=_0xb6f7[_0x354719];return _0x591f63;};'use strict';var _=require(_0x7b6f('0x0'));var util=require(_0x7b6f('0x1'));var logger=require(_0x7b6f('0x2'))(_0x7b6f('0x3'));var moment=require(_0x7b6f('0x4'));var BPromise=require(_0x7b6f('0x5'));var rp=require(_0x7b6f('0x6'));var fs=require('fs');var path=require(_0x7b6f('0x7'));var rimraf=require(_0x7b6f('0x8'));var config=require(_0x7b6f('0x9'));var attributes=require('./template.attributes');module[_0x7b6f('0xa')]=function(_0x534da0,_0x28b20f){return _0x534da0[_0x7b6f('0xb')](_0x7b6f('0xc'),attributes,{'tableName':_0x7b6f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6eb5=['Template','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4727b7,_0x585a61){var _0xce9394=function(_0x179df4){while(--_0x179df4){_0x4727b7['push'](_0x4727b7['shift']());}};_0xce9394(++_0x585a61);}(_0x6eb5,0xc7));var _0x56eb=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x6eb5[_0x2d61b2];return _0x12df89;};'use strict';var _=require(_0x56eb('0x0'));var util=require(_0x56eb('0x1'));var logger=require(_0x56eb('0x2'))('api');var moment=require(_0x56eb('0x3'));var BPromise=require(_0x56eb('0x4'));var rp=require(_0x56eb('0x5'));var fs=require('fs');var path=require(_0x56eb('0x6'));var rimraf=require(_0x56eb('0x7'));var config=require(_0x56eb('0x8'));var attributes=require('./template.attributes');module[_0x56eb('0x9')]=function(_0x26838b,_0x124db0){return _0x26838b['define'](_0x56eb('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index f9e7330..d0677f4 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 _0xa936=['client','http','request','then','info','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','findAll','options','where','attributes','limit','include','model','map','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xcb4629,_0x54b751){var _0xc5ad47=function(_0x3e90c4){while(--_0x3e90c4){_0xcb4629['push'](_0xcb4629['shift']());}};_0xc5ad47(++_0x54b751);}(_0xa936,0x107));var _0x6a93=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xa936[_0x1928c9];return _0x51b5fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6a93('0x0'));var BPromise=require(_0x6a93('0x1'));var rs=require(_0x6a93('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a93('0x3'))['db'];var utils=require(_0x6a93('0x4'));var logger=require(_0x6a93('0x5'))('rpc');var config=require(_0x6a93('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6a93('0x7')][_0x6a93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11c3c3,_0x125304,_0x22195f){return new BPromise(function(_0x2fc612,_0x5be9ac){return client[_0x6a93('0x9')](_0x11c3c3,_0x22195f)[_0x6a93('0xa')](function(_0x11b82e){logger[_0x6a93('0xb')](_0x6a93('0xc'),_0x125304,'request\x20sent');logger['debug'](_0x6a93('0xd'),_0x125304,_0x6a93('0xe'),JSON[_0x6a93('0xf')](_0x11b82e));if(_0x11b82e[_0x6a93('0x10')]){if(_0x11b82e['error'][_0x6a93('0x11')]===0x1f4){logger['error'](_0x6a93('0xc'),_0x125304,_0x11b82e[_0x6a93('0x10')][_0x6a93('0x12')]);return _0x5be9ac(_0x11b82e['error'][_0x6a93('0x12')]);}logger['error'](_0x6a93('0xc'),_0x125304,_0x11b82e[_0x6a93('0x10')]['message']);return _0x2fc612(_0x11b82e[_0x6a93('0x10')][_0x6a93('0x12')]);}else{logger[_0x6a93('0xb')]('Template,\x20%s,\x20%s',_0x125304,'request\x20sent');_0x2fc612(_0x11b82e[_0x6a93('0x13')][_0x6a93('0x12')]);}})[_0x6a93('0x14')](function(_0x1d0e2c){logger[_0x6a93('0x10')](_0x6a93('0xc'),_0x125304,_0x1d0e2c);_0x5be9ac(_0x1d0e2c);});});}exports[_0x6a93('0x15')]=function(_0x4f2139){var _0x41fcac=this;return new Promise(function(_0x42129f,_0x46909a){return db['Template'][_0x6a93('0x16')]({'raw':_0x4f2139[_0x6a93('0x17')]?_0x4f2139[_0x6a93('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4f2139['options']?_0x4f2139[_0x6a93('0x17')][_0x6a93('0x18')]||null:null,'attributes':_0x4f2139[_0x6a93('0x17')]?_0x4f2139['options'][_0x6a93('0x19')]||null:null,'limit':_0x4f2139[_0x6a93('0x17')]?_0x4f2139[_0x6a93('0x17')][_0x6a93('0x1a')]||null:null,'include':_0x4f2139[_0x6a93('0x17')]?_0x4f2139['options'][_0x6a93('0x1b')]?_['map'](_0x4f2139['options'][_0x6a93('0x1b')],function(_0x3691b4){return{'model':db[_0x3691b4[_0x6a93('0x1c')]],'as':_0x3691b4['as'],'attributes':_0x3691b4[_0x6a93('0x19')],'include':_0x3691b4[_0x6a93('0x1b')]?_[_0x6a93('0x1d')](_0x3691b4['include'],function(_0x5c5cb6){return{'model':db[_0x5c5cb6[_0x6a93('0x1c')]],'as':_0x5c5cb6['as'],'attributes':_0x5c5cb6['attributes'],'include':_0x5c5cb6[_0x6a93('0x1b')]?_[_0x6a93('0x1d')](_0x5c5cb6[_0x6a93('0x1b')],function(_0x97259){return{'model':db[_0x97259[_0x6a93('0x1c')]],'as':_0x97259['as'],'attributes':_0x97259[_0x6a93('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6a93('0xa')](function(_0x2c6619){logger[_0x6a93('0xb')](_0x6a93('0x15'),_0x4f2139);logger['debug'](_0x6a93('0x15'),_0x4f2139,JSON['stringify'](_0x2c6619));_0x42129f(_0x2c6619);})[_0x6a93('0x14')](function(_0x3db08f){logger[_0x6a93('0x10')](_0x6a93('0x15'),_0x3db08f[_0x6a93('0x12')],_0x4f2139);_0x46909a(_0x41fcac[_0x6a93('0x10')](0x1f4,_0x3db08f[_0x6a93('0x12')]));});});}; \ No newline at end of file +var _0x730f=['request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetTemplate','Template','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','Template,\x20%s,\x20%s'];(function(_0x179b53,_0x31f6fe){var _0x38a146=function(_0x33f0c2){while(--_0x33f0c2){_0x179b53['push'](_0x179b53['shift']());}};_0x38a146(++_0x31f6fe);}(_0x730f,0xfb));var _0xf730=function(_0x4ab344,_0x32e2cd){_0x4ab344=_0x4ab344-0x0;var _0xed2f3=_0x730f[_0x4ab344];return _0xed2f3;};'use strict';var _=require(_0xf730('0x0'));var util=require(_0xf730('0x1'));var moment=require(_0xf730('0x2'));var BPromise=require(_0xf730('0x3'));var rs=require(_0xf730('0x4'));var fs=require('fs');var Redis=require(_0xf730('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf730('0x6'));var logger=require(_0xf730('0x7'))(_0xf730('0x8'));var config=require(_0xf730('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf730('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b9d38,_0x39657a,_0x243fa1){return new BPromise(function(_0x469725,_0x584eb3){return client['request'](_0x3b9d38,_0x243fa1)[_0xf730('0xb')](function(_0x3d6fce){logger['info'](_0xf730('0xc'),_0x39657a,_0xf730('0xd'));logger[_0xf730('0xe')](_0xf730('0xf'),_0x39657a,_0xf730('0xd'),JSON[_0xf730('0x10')](_0x3d6fce));if(_0x3d6fce[_0xf730('0x11')]){if(_0x3d6fce[_0xf730('0x11')][_0xf730('0x12')]===0x1f4){logger[_0xf730('0x11')]('Template,\x20%s,\x20%s',_0x39657a,_0x3d6fce[_0xf730('0x11')][_0xf730('0x13')]);return _0x584eb3(_0x3d6fce[_0xf730('0x11')]['message']);}logger[_0xf730('0x11')](_0xf730('0xc'),_0x39657a,_0x3d6fce[_0xf730('0x11')]['message']);return _0x469725(_0x3d6fce['error'][_0xf730('0x13')]);}else{logger[_0xf730('0x14')](_0xf730('0xc'),_0x39657a,'request\x20sent');_0x469725(_0x3d6fce[_0xf730('0x15')][_0xf730('0x13')]);}})[_0xf730('0x16')](function(_0x585171){logger['error'](_0xf730('0xc'),_0x39657a,_0x585171);_0x584eb3(_0x585171);});});}exports[_0xf730('0x17')]=function(_0x258213){var _0x2ba9d7=this;return new Promise(function(_0x1afdc8,_0x51b068){return db[_0xf730('0x18')][_0xf730('0x19')]({'raw':_0x258213[_0xf730('0x1a')]?_0x258213[_0xf730('0x1a')][_0xf730('0x1b')]===undefined?!![]:![]:!![],'where':_0x258213[_0xf730('0x1a')]?_0x258213[_0xf730('0x1a')]['where']||null:null,'attributes':_0x258213[_0xf730('0x1a')]?_0x258213[_0xf730('0x1a')][_0xf730('0x1c')]||null:null,'limit':_0x258213[_0xf730('0x1a')]?_0x258213[_0xf730('0x1a')][_0xf730('0x1d')]||null:null,'include':_0x258213[_0xf730('0x1a')]?_0x258213[_0xf730('0x1a')][_0xf730('0x1e')]?_[_0xf730('0x1f')](_0x258213[_0xf730('0x1a')]['include'],function(_0x1fc925){return{'model':db[_0x1fc925[_0xf730('0x20')]],'as':_0x1fc925['as'],'attributes':_0x1fc925[_0xf730('0x1c')],'include':_0x1fc925['include']?_['map'](_0x1fc925[_0xf730('0x1e')],function(_0x8e492a){return{'model':db[_0x8e492a['model']],'as':_0x8e492a['as'],'attributes':_0x8e492a[_0xf730('0x1c')],'include':_0x8e492a[_0xf730('0x1e')]?_[_0xf730('0x1f')](_0x8e492a['include'],function(_0x12b1a7){return{'model':db[_0x12b1a7[_0xf730('0x20')]],'as':_0x12b1a7['as'],'attributes':_0x12b1a7[_0xf730('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x172d32){logger[_0xf730('0x14')](_0xf730('0x17'),_0x258213);logger[_0xf730('0xe')](_0xf730('0x17'),_0x258213,JSON[_0xf730('0x10')](_0x172d32));_0x1afdc8(_0x172d32);})['catch'](function(_0x4c880b){logger[_0xf730('0x11')](_0xf730('0x17'),_0x4c880b[_0xf730('0x13')],_0x258213);_0x51b068(_0x2ba9d7[_0xf730('0x11')](0x1f4,_0x4c880b['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 29d118f..d1a2be6 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 _0x6acc=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','get','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','/:id/actions','post','create','addAllCondition','addAnyCondition','update','destroy','exports','multer'];(function(_0x13ff34,_0x383a2c){var _0x58abc4=function(_0x47d7aa){while(--_0x47d7aa){_0x13ff34['push'](_0x13ff34['shift']());}};_0x58abc4(++_0x383a2c);}(_0x6acc,0x167));var _0xc6ac=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x6acc[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0xc6ac('0x0'));var util=require(_0xc6ac('0x1'));var path=require(_0xc6ac('0x2'));var timeout=require(_0xc6ac('0x3'));var express=require(_0xc6ac('0x4'));var router=express['Router']();var fs_extra=require(_0xc6ac('0x5'));var auth=require(_0xc6ac('0x6'));var interaction=require(_0xc6ac('0x7'));var config=require(_0xc6ac('0x8'));var controller=require(_0xc6ac('0x9'));router['get']('/',auth[_0xc6ac('0xa')](),controller['index']);router[_0xc6ac('0xb')](_0xc6ac('0xc'),auth[_0xc6ac('0xa')](),controller['show']);router[_0xc6ac('0xb')](_0xc6ac('0xd'),auth[_0xc6ac('0xa')](),controller[_0xc6ac('0xe')]);router[_0xc6ac('0xb')](_0xc6ac('0xf'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0xc6ac('0xb')](_0xc6ac('0x10'),auth[_0xc6ac('0xa')](),controller['getActions']);router[_0xc6ac('0x11')]('/',auth['isAuthenticated'](),controller[_0xc6ac('0x12')]);router[_0xc6ac('0x11')](_0xc6ac('0xd'),auth[_0xc6ac('0xa')](),controller[_0xc6ac('0x13')]);router['post']('/:id/any_conditions',auth[_0xc6ac('0xa')](),controller[_0xc6ac('0x14')]);router[_0xc6ac('0x11')](_0xc6ac('0x10'),auth[_0xc6ac('0xa')](),controller['addAction']);router['put'](_0xc6ac('0xc'),auth[_0xc6ac('0xa')](),controller[_0xc6ac('0x15')]);router['delete'](_0xc6ac('0xc'),auth[_0xc6ac('0xa')](),controller[_0xc6ac('0x16')]);module[_0xc6ac('0x17')]=router; \ No newline at end of file +var _0xb694=['addAllCondition','addAnyCondition','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','getActions','post'];(function(_0x4b9b78,_0x1dc74a){var _0x330388=function(_0x49bcdc){while(--_0x49bcdc){_0x4b9b78['push'](_0x4b9b78['shift']());}};_0x330388(++_0x1dc74a);}(_0xb694,0x1ef));var _0x4b69=function(_0x18a3a3,_0x2e6156){_0x18a3a3=_0x18a3a3-0x0;var _0x5b2616=_0xb694[_0x18a3a3];return _0x5b2616;};'use strict';var multer=require(_0x4b69('0x0'));var util=require(_0x4b69('0x1'));var path=require(_0x4b69('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4b69('0x3')]();var fs_extra=require(_0x4b69('0x4'));var auth=require(_0x4b69('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4b69('0x6'));var controller=require(_0x4b69('0x7'));router[_0x4b69('0x8')]('/',auth['isAuthenticated'](),controller[_0x4b69('0x9')]);router[_0x4b69('0x8')](_0x4b69('0xa'),auth[_0x4b69('0xb')](),controller[_0x4b69('0xc')]);router[_0x4b69('0x8')](_0x4b69('0xd'),auth[_0x4b69('0xb')](),controller['getAllConditions']);router[_0x4b69('0x8')](_0x4b69('0xe'),auth[_0x4b69('0xb')](),controller[_0x4b69('0xf')]);router[_0x4b69('0x8')]('/:id/actions',auth['isAuthenticated'](),controller[_0x4b69('0x10')]);router[_0x4b69('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4b69('0x11')](_0x4b69('0xd'),auth[_0x4b69('0xb')](),controller[_0x4b69('0x12')]);router[_0x4b69('0x11')]('/:id/any_conditions',auth[_0x4b69('0xb')](),controller[_0x4b69('0x13')]);router[_0x4b69('0x11')](_0x4b69('0x14'),auth['isAuthenticated'](),controller[_0x4b69('0x15')]);router[_0x4b69('0x16')](_0x4b69('0xa'),auth[_0x4b69('0xb')](),controller[_0x4b69('0x17')]);router[_0x4b69('0x18')](_0x4b69('0xa'),auth['isAuthenticated'](),controller[_0x4b69('0x19')]);module[_0x4b69('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e8702c6..83eaf23 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 _0xc817=['sequelize','exports','STRING','BOOLEAN'];(function(_0x37b124,_0x3e83fb){var _0x4f3d77=function(_0x5c0ca2){while(--_0x5c0ca2){_0x37b124['push'](_0x37b124['shift']());}};_0x4f3d77(++_0x3e83fb);}(_0xc817,0x7c));var _0x7c81=function(_0x114c7a,_0x5b2c55){_0x114c7a=_0x114c7a-0x0;var _0x213d24=_0xc817[_0x114c7a];return _0x213d24;};'use strict';var Sequelize=require(_0x7c81('0x0'));module[_0x7c81('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7c81('0x2')]},'description':{'type':Sequelize[_0x7c81('0x2')]},'status':{'type':Sequelize[_0x7c81('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3b31=['exports','STRING','BOOLEAN'];(function(_0x40aebf,_0x31078c){var _0x826b7d=function(_0x121934){while(--_0x121934){_0x40aebf['push'](_0x40aebf['shift']());}};_0x826b7d(++_0x31078c);}(_0x3b31,0x9c));var _0x13b3=function(_0x586636,_0x6491c7){_0x586636=_0x586636-0x0;var _0x78b36a=_0x3b31[_0x586636];return _0x78b36a;};'use strict';var Sequelize=require('sequelize');module[_0x13b3('0x0')]={'name':{'type':Sequelize[_0x13b3('0x1')]},'channel':{'type':Sequelize[_0x13b3('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x13b3('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 848db31..f7d2510 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 _0xb3f1=['Content-Range','apply','reject','update','then','destroy','Triggers','error','stack','name','send','index','Trigger','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll','rows','show','params','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','findOne','getAllConditions','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','limit','undefined','count'];(function(_0x24502f,_0x134350){var _0x402fd9=function(_0x5e90b2){while(--_0x5e90b2){_0x24502f['push'](_0x24502f['shift']());}};_0x402fd9(++_0x134350);}(_0xb3f1,0xfd));var _0x1b3f=function(_0x2252d2,_0x458b97){_0x2252d2=_0x2252d2-0x0;var _0x100e5e=_0xb3f1[_0x2252d2];return _0x100e5e;};'use strict';var emlformat=require(_0x1b3f('0x0'));var rimraf=require(_0x1b3f('0x1'));var zipdir=require(_0x1b3f('0x2'));var jsonpatch=require(_0x1b3f('0x3'));var rp=require(_0x1b3f('0x4'));var moment=require('moment');var BPromise=require(_0x1b3f('0x5'));var Mustache=require(_0x1b3f('0x6'));var util=require(_0x1b3f('0x7'));var path=require(_0x1b3f('0x8'));var sox=require(_0x1b3f('0x9'));var csv=require(_0x1b3f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1b3f('0xb'));var _=require(_0x1b3f('0xc'));var squel=require('squel');var crypto=require(_0x1b3f('0xd'));var jsforce=require(_0x1b3f('0xe'));var deskjs=require(_0x1b3f('0xf'));var toCsv=require(_0x1b3f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1b3f('0x10'));var authService=require(_0x1b3f('0x11'));var qs=require(_0x1b3f('0x12'));var as=require(_0x1b3f('0x13'));var hardwareService=require(_0x1b3f('0x14'));var logger=require(_0x1b3f('0x15'))(_0x1b3f('0x16'));var utils=require(_0x1b3f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1b3f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fa5aa,_0x955d6c){_0x955d6c=_0x955d6c||0xcc;return function(_0x3bb17c){if(_0x3bb17c){return _0x3fa5aa[_0x1b3f('0x19')](_0x955d6c);}return _0x3fa5aa[_0x1b3f('0x1a')](_0x955d6c)['end']();};}function respondWithResult(_0x5cd2fa,_0x2e6d91){_0x2e6d91=_0x2e6d91||0xc8;return function(_0x4c11ca){if(_0x4c11ca){return _0x5cd2fa[_0x1b3f('0x1a')](_0x2e6d91)[_0x1b3f('0x1b')](_0x4c11ca);}};}function respondWithFilteredResult(_0x1b275e,_0x4276eb){return function(_0x327e3d){if(_0x327e3d){var _0x10819d=typeof _0x4276eb[_0x1b3f('0x1c')]==='undefined'&&typeof _0x4276eb[_0x1b3f('0x1d')]===_0x1b3f('0x1e');var _0x48da44=_0x327e3d[_0x1b3f('0x1f')];var _0x10fc8b=_0x10819d?0x0:_0x4276eb[_0x1b3f('0x1c')];var _0x256afc=_0x10819d?_0x327e3d[_0x1b3f('0x1f')]:_0x4276eb[_0x1b3f('0x1c')]+_0x4276eb[_0x1b3f('0x1d')];var _0x3720bb;if(_0x256afc>=_0x48da44){_0x256afc=_0x48da44;_0x3720bb=0xc8;}else{_0x3720bb=0xce;}_0x1b275e[_0x1b3f('0x1a')](_0x3720bb);return _0x1b275e['set'](_0x1b3f('0x20'),_0x10fc8b+'-'+_0x256afc+'/'+_0x48da44)[_0x1b3f('0x1b')](_0x327e3d);}return null;};}function patchUpdates(_0x50a584){return function(_0x156cd7){try{jsonpatch[_0x1b3f('0x21')](_0x156cd7,_0x50a584,!![]);}catch(_0x47fe60){return BPromise[_0x1b3f('0x22')](_0x47fe60);}return _0x156cd7['save']();};}function saveUpdates(_0x3b1213,_0x3127f5){return function(_0x3655f3){if(_0x3655f3){return _0x3655f3[_0x1b3f('0x23')](_0x3b1213)[_0x1b3f('0x24')](function(_0x567d4b){return _0x567d4b;});}return null;};}function removeEntity(_0x5e4615,_0x4e950c){return function(_0x4dd5cf){if(_0x4dd5cf){return _0x4dd5cf[_0x1b3f('0x25')]()[_0x1b3f('0x24')](function(){var _0x20a150=_0x4dd5cf['get']({'plain':!![]});var _0x16043e=_0x1b3f('0x26');return db['UserProfileResource'][_0x1b3f('0x25')]({'where':{'type':_0x16043e,'resourceId':_0x20a150['id']}})[_0x1b3f('0x24')](function(){return _0x4dd5cf;});})[_0x1b3f('0x24')](function(){_0x5e4615[_0x1b3f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x504b11,_0x3700ab){return function(_0x1fffbc){if(!_0x1fffbc){_0x504b11[_0x1b3f('0x19')](0x194);}return _0x1fffbc;};}function handleError(_0x393062,_0x4224e8){_0x4224e8=_0x4224e8||0x1f4;return function(_0x2c6cd2){logger[_0x1b3f('0x27')](_0x2c6cd2[_0x1b3f('0x28')]);if(_0x2c6cd2[_0x1b3f('0x29')]){delete _0x2c6cd2['name'];}_0x393062[_0x1b3f('0x1a')](_0x4224e8)[_0x1b3f('0x2a')](_0x2c6cd2);};}exports[_0x1b3f('0x2b')]=function(_0x3c08a9,_0x4a1bc3){var _0x23749f={},_0x5564f9={},_0x196638={'count':0x0,'rows':[]};var _0x2a52f8=_['map'](db[_0x1b3f('0x2c')][_0x1b3f('0x2d')],function(_0x2a1053){return{'name':_0x2a1053[_0x1b3f('0x2e')],'type':_0x2a1053[_0x1b3f('0x2f')]['key']};});_0x5564f9['model']=_[_0x1b3f('0x30')](_0x2a52f8,_0x1b3f('0x29'));_0x5564f9[_0x1b3f('0x31')]=_['keys'](_0x3c08a9['query']);_0x5564f9[_0x1b3f('0x32')]=_[_0x1b3f('0x33')](_0x5564f9[_0x1b3f('0x34')],_0x5564f9['query']);_0x23749f[_0x1b3f('0x35')]=_[_0x1b3f('0x33')](_0x5564f9[_0x1b3f('0x34')],qs[_0x1b3f('0x36')](_0x3c08a9[_0x1b3f('0x31')]['fields']));_0x23749f['attributes']=_0x23749f[_0x1b3f('0x35')][_0x1b3f('0x37')]?_0x23749f[_0x1b3f('0x35')]:_0x5564f9['model'];if(!_0x3c08a9[_0x1b3f('0x31')][_0x1b3f('0x38')](_0x1b3f('0x39'))){_0x23749f[_0x1b3f('0x1d')]=qs['limit'](_0x3c08a9[_0x1b3f('0x31')][_0x1b3f('0x1d')]);_0x23749f['offset']=qs[_0x1b3f('0x1c')](_0x3c08a9[_0x1b3f('0x31')][_0x1b3f('0x1c')]);}_0x23749f[_0x1b3f('0x3a')]=qs['sort'](_0x3c08a9['query'][_0x1b3f('0x3b')]);_0x23749f['where']=qs[_0x1b3f('0x32')](_[_0x1b3f('0x3c')](_0x3c08a9[_0x1b3f('0x31')],_0x5564f9['filters']),_0x2a52f8);if(_0x3c08a9[_0x1b3f('0x31')][_0x1b3f('0x3d')]){_0x23749f[_0x1b3f('0x3e')]=_[_0x1b3f('0x3f')](_0x23749f[_0x1b3f('0x3e')],{'$or':_[_0x1b3f('0x30')](_0x2a52f8,function(_0x1635d8){if(_0x1635d8[_0x1b3f('0x2f')]!=='VIRTUAL'){var _0x4dc399={};_0x4dc399[_0x1635d8[_0x1b3f('0x29')]]={'$like':'%'+_0x3c08a9[_0x1b3f('0x31')][_0x1b3f('0x3d')]+'%'};return _0x4dc399;}})});}_0x23749f=_[_0x1b3f('0x3f')]({},_0x23749f,_0x3c08a9[_0x1b3f('0x40')]);var _0x25f58e={'where':_0x23749f[_0x1b3f('0x3e')]};return db['Trigger'][_0x1b3f('0x1f')](_0x25f58e)['then'](function(_0x4ae677){_0x196638[_0x1b3f('0x1f')]=_0x4ae677;if(_0x3c08a9[_0x1b3f('0x31')][_0x1b3f('0x41')]){_0x23749f['include']=[{'all':!![]}];}return db[_0x1b3f('0x2c')][_0x1b3f('0x42')](_0x23749f);})[_0x1b3f('0x24')](function(_0x54abbd){_0x196638[_0x1b3f('0x43')]=_0x54abbd;return _0x196638;})['then'](respondWithFilteredResult(_0x4a1bc3,_0x23749f))['catch'](handleError(_0x4a1bc3,null));};exports[_0x1b3f('0x44')]=function(_0x319620,_0x3c2bf5){var _0x2f87f8={'raw':![],'where':{'id':_0x319620[_0x1b3f('0x45')]['id']}},_0x1ab09f={};_0x1ab09f[_0x1b3f('0x34')]=_[_0x1b3f('0x46')](db['Trigger'][_0x1b3f('0x2d')]);_0x1ab09f['query']=_['keys'](_0x319620['query']);_0x1ab09f[_0x1b3f('0x32')]=_[_0x1b3f('0x33')](_0x1ab09f['model'],_0x1ab09f['query']);_0x2f87f8[_0x1b3f('0x35')]=_['intersection'](_0x1ab09f[_0x1b3f('0x34')],qs[_0x1b3f('0x36')](_0x319620[_0x1b3f('0x31')][_0x1b3f('0x36')]));_0x2f87f8[_0x1b3f('0x35')]=_0x2f87f8[_0x1b3f('0x35')][_0x1b3f('0x37')]?_0x2f87f8[_0x1b3f('0x35')]:_0x1ab09f[_0x1b3f('0x34')];if(_0x319620[_0x1b3f('0x31')][_0x1b3f('0x41')]){_0x2f87f8[_0x1b3f('0x47')]=[{'all':!![]}];}_0x2f87f8=_['merge']({},_0x2f87f8,_0x319620[_0x1b3f('0x40')]);return db[_0x1b3f('0x2c')][_0x1b3f('0x48')](_0x2f87f8)[_0x1b3f('0x24')](handleEntityNotFound(_0x3c2bf5,null))[_0x1b3f('0x24')](respondWithResult(_0x3c2bf5,null))['catch'](handleError(_0x3c2bf5,null));};exports['create']=function(_0x14f8d9,_0x4bf5fe){return db['Trigger'][_0x1b3f('0x49')](_0x14f8d9[_0x1b3f('0x4a')],{})['then'](function(_0x377cf6){var _0x40edde=_0x14f8d9[_0x1b3f('0x4b')][_0x1b3f('0x4c')]({'plain':!![]});if(!_0x40edde)throw new Error(_0x1b3f('0x4d'));if(_0x40edde['role']===_0x1b3f('0x4b')){var _0x4ed650=_0x377cf6[_0x1b3f('0x4c')]({'plain':!![]});var _0x1d69d8=_0x1b3f('0x26');return db[_0x1b3f('0x4e')][_0x1b3f('0x48')]({'where':{'name':_0x1d69d8,'userProfileId':_0x40edde[_0x1b3f('0x4f')]},'raw':!![]})[_0x1b3f('0x24')](function(_0x183df2){if(_0x183df2&&_0x183df2[_0x1b3f('0x50')]===0x0){return db[_0x1b3f('0x51')][_0x1b3f('0x49')]({'name':_0x4ed650[_0x1b3f('0x29')],'resourceId':_0x4ed650['id'],'type':_0x183df2[_0x1b3f('0x29')],'sectionId':_0x183df2['id']},{})[_0x1b3f('0x24')](function(){return _0x377cf6;});}else{return _0x377cf6;}})[_0x1b3f('0x52')](function(_0x27d678){logger[_0x1b3f('0x27')](_0x1b3f('0x53'),_0x27d678);throw _0x27d678;});}return _0x377cf6;})['then'](respondWithResult(_0x4bf5fe,0xc9))[_0x1b3f('0x52')](handleError(_0x4bf5fe,null));};exports[_0x1b3f('0x23')]=function(_0x58f995,_0x53d292){if(_0x58f995['body']['id']){delete _0x58f995[_0x1b3f('0x4a')]['id'];}return db['Trigger'][_0x1b3f('0x48')]({'where':{'id':_0x58f995[_0x1b3f('0x45')]['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x53d292,null))[_0x1b3f('0x24')](saveUpdates(_0x58f995[_0x1b3f('0x4a')],null))[_0x1b3f('0x24')](respondWithResult(_0x53d292,null))[_0x1b3f('0x52')](handleError(_0x53d292,null));};exports[_0x1b3f('0x25')]=function(_0x238a91,_0x105e68){return db[_0x1b3f('0x2c')][_0x1b3f('0x48')]({'where':{'id':_0x238a91[_0x1b3f('0x45')]['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x105e68,null))['then'](removeEntity(_0x105e68,null))[_0x1b3f('0x52')](handleError(_0x105e68,null));};exports[_0x1b3f('0x54')]=function(_0x272abc,_0x7a5161,_0x35565a){if(_0x272abc[_0x1b3f('0x4a')]['id']){delete _0x272abc[_0x1b3f('0x4a')]['id'];}return db[_0x1b3f('0x2c')][_0x1b3f('0x48')]({'where':{'id':_0x272abc[_0x1b3f('0x45')]['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x7a5161,null))[_0x1b3f('0x24')](function(_0x20a272){if(_0x20a272){_0x272abc[_0x1b3f('0x4a')][_0x1b3f('0x55')]=_0x20a272['id'];return db['Condition'][_0x1b3f('0x49')](_0x272abc[_0x1b3f('0x4a')]);}})['then'](respondWithResult(_0x7a5161,null))[_0x1b3f('0x52')](handleError(_0x7a5161,null));};exports[_0x1b3f('0x56')]=function(_0x34479f,_0x340014,_0x19d796){if(_0x34479f[_0x1b3f('0x4a')]['id']){delete _0x34479f[_0x1b3f('0x4a')]['id'];}return db[_0x1b3f('0x2c')][_0x1b3f('0x48')]({'where':{'id':_0x34479f[_0x1b3f('0x45')]['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x340014,null))['then'](function(_0x53e27c){if(_0x53e27c){_0x34479f[_0x1b3f('0x4a')][_0x1b3f('0x57')]=_0x53e27c['id'];return db[_0x1b3f('0x58')][_0x1b3f('0x49')](_0x34479f[_0x1b3f('0x4a')]);}})[_0x1b3f('0x24')](respondWithResult(_0x340014,null))['catch'](handleError(_0x340014,null));};exports['getAllConditions']=function(_0x52a176,_0x4a1070,_0x7216e1){var _0x2c6559={};var _0x2c7b5f={};var _0x30537a;var _0x22af73;return db[_0x1b3f('0x2c')][_0x1b3f('0x59')]({'where':{'id':_0x52a176[_0x1b3f('0x45')]['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x4a1070,null))[_0x1b3f('0x24')](function(_0xd3dfce){if(_0xd3dfce){_0x30537a=_0xd3dfce;_0x2c7b5f[_0x1b3f('0x34')]=_[_0x1b3f('0x46')](db[_0x1b3f('0x58')][_0x1b3f('0x2d')]);_0x2c7b5f['query']=_[_0x1b3f('0x46')](_0x52a176['query']);_0x2c7b5f[_0x1b3f('0x32')]=_[_0x1b3f('0x33')](_0x2c7b5f['model'],_0x2c7b5f[_0x1b3f('0x31')]);_0x2c6559['attributes']=_[_0x1b3f('0x33')](_0x2c7b5f[_0x1b3f('0x34')],qs[_0x1b3f('0x36')](_0x52a176[_0x1b3f('0x31')][_0x1b3f('0x36')]));_0x2c6559[_0x1b3f('0x35')]=_0x2c6559[_0x1b3f('0x35')][_0x1b3f('0x37')]?_0x2c6559[_0x1b3f('0x35')]:_0x2c7b5f['model'];_0x2c6559[_0x1b3f('0x3a')]=qs[_0x1b3f('0x3b')](_0x52a176[_0x1b3f('0x31')][_0x1b3f('0x3b')]);_0x2c6559['where']=qs[_0x1b3f('0x32')](_[_0x1b3f('0x3c')](_0x52a176[_0x1b3f('0x31')],_0x2c7b5f[_0x1b3f('0x32')]));if(_0x52a176[_0x1b3f('0x31')][_0x1b3f('0x3d')]){_0x2c6559[_0x1b3f('0x3e')]=_[_0x1b3f('0x3f')](_0x2c6559[_0x1b3f('0x3e')],{'$or':_['map'](_0x2c6559[_0x1b3f('0x35')],function(_0x511e7e){var _0x106075={};_0x106075[_0x511e7e]={'$like':'%'+_0x52a176[_0x1b3f('0x31')]['filter']+'%'};return _0x106075;})});}_0x2c6559=_['merge']({},_0x2c6559,_0x52a176['options']);return _0x30537a[_0x1b3f('0x5a')](_0x2c6559);}})[_0x1b3f('0x24')](function(_0x5caf9b){if(_0x5caf9b){_0x22af73=_0x5caf9b[_0x1b3f('0x37')];if(!_0x52a176['query'][_0x1b3f('0x38')]('nolimit')){_0x2c6559[_0x1b3f('0x1d')]=qs['limit'](_0x52a176['query'][_0x1b3f('0x1d')]);_0x2c6559[_0x1b3f('0x1c')]=qs[_0x1b3f('0x1c')](_0x52a176[_0x1b3f('0x31')][_0x1b3f('0x1c')]);}return _0x30537a[_0x1b3f('0x5a')](_0x2c6559);}})[_0x1b3f('0x24')](function(_0x5d7385){if(_0x5d7385){return _0x5d7385?{'count':_0x22af73,'rows':_0x5d7385}:null;}})['then'](respondWithResult(_0x4a1070,null))[_0x1b3f('0x52')](handleError(_0x4a1070,null));};exports[_0x1b3f('0x5b')]=function(_0x1e12e1,_0x265583,_0x11d7b1){var _0x33870c={};var _0x3e4935={};var _0x376394;var _0x51e5d3;return db[_0x1b3f('0x2c')]['findOne']({'where':{'id':_0x1e12e1[_0x1b3f('0x45')]['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x265583,null))[_0x1b3f('0x24')](function(_0x174435){if(_0x174435){_0x376394=_0x174435;_0x3e4935[_0x1b3f('0x34')]=_[_0x1b3f('0x46')](db[_0x1b3f('0x58')][_0x1b3f('0x2d')]);_0x3e4935[_0x1b3f('0x31')]=_[_0x1b3f('0x46')](_0x1e12e1[_0x1b3f('0x31')]);_0x3e4935[_0x1b3f('0x32')]=_[_0x1b3f('0x33')](_0x3e4935['model'],_0x3e4935['query']);_0x33870c[_0x1b3f('0x35')]=_[_0x1b3f('0x33')](_0x3e4935[_0x1b3f('0x34')],qs[_0x1b3f('0x36')](_0x1e12e1[_0x1b3f('0x31')][_0x1b3f('0x36')]));_0x33870c['attributes']=_0x33870c['attributes']['length']?_0x33870c['attributes']:_0x3e4935[_0x1b3f('0x34')];_0x33870c[_0x1b3f('0x3a')]=qs['sort'](_0x1e12e1['query'][_0x1b3f('0x3b')]);_0x33870c[_0x1b3f('0x3e')]=qs[_0x1b3f('0x32')](_[_0x1b3f('0x3c')](_0x1e12e1[_0x1b3f('0x31')],_0x3e4935[_0x1b3f('0x32')]));if(_0x1e12e1[_0x1b3f('0x31')][_0x1b3f('0x3d')]){_0x33870c[_0x1b3f('0x3e')]=_['merge'](_0x33870c[_0x1b3f('0x3e')],{'$or':_['map'](_0x33870c[_0x1b3f('0x35')],function(_0x220bef){var _0x192605={};_0x192605[_0x220bef]={'$like':'%'+_0x1e12e1[_0x1b3f('0x31')]['filter']+'%'};return _0x192605;})});}_0x33870c=_[_0x1b3f('0x3f')]({},_0x33870c,_0x1e12e1[_0x1b3f('0x40')]);return _0x376394[_0x1b3f('0x5b')](_0x33870c);}})['then'](function(_0x4020ef){if(_0x4020ef){_0x51e5d3=_0x4020ef[_0x1b3f('0x37')];if(!_0x1e12e1[_0x1b3f('0x31')][_0x1b3f('0x38')](_0x1b3f('0x39'))){_0x33870c[_0x1b3f('0x1d')]=qs['limit'](_0x1e12e1[_0x1b3f('0x31')][_0x1b3f('0x1d')]);_0x33870c['offset']=qs['offset'](_0x1e12e1[_0x1b3f('0x31')][_0x1b3f('0x1c')]);}return _0x376394[_0x1b3f('0x5b')](_0x33870c);}})[_0x1b3f('0x24')](function(_0x46aebb){if(_0x46aebb){return _0x46aebb?{'count':_0x51e5d3,'rows':_0x46aebb}:null;}})[_0x1b3f('0x24')](respondWithResult(_0x265583,null))['catch'](handleError(_0x265583,null));};exports['addAction']=function(_0x910e17,_0x148575,_0x5ec584){if(_0x910e17[_0x1b3f('0x4a')]['id']){delete _0x910e17['body']['id'];}return db[_0x1b3f('0x2c')][_0x1b3f('0x48')]({'where':{'id':_0x910e17['params']['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x148575,null))[_0x1b3f('0x24')](function(_0x4a5ded){if(_0x4a5ded){_0x910e17[_0x1b3f('0x4a')][_0x1b3f('0x5c')]=_0x4a5ded['id'];return db[_0x1b3f('0x5d')][_0x1b3f('0x49')](_0x910e17[_0x1b3f('0x4a')]);}})[_0x1b3f('0x24')](respondWithResult(_0x148575,null))[_0x1b3f('0x52')](handleError(_0x148575,null));};exports[_0x1b3f('0x5e')]=function(_0x80642a,_0x35ef30,_0x15a46f){var _0x1360b7={};var _0x402903={};var _0x23054a;var _0x4e9d6d;return db[_0x1b3f('0x2c')][_0x1b3f('0x59')]({'where':{'id':_0x80642a['params']['id']}})[_0x1b3f('0x24')](handleEntityNotFound(_0x35ef30,null))[_0x1b3f('0x24')](function(_0x589a81){if(_0x589a81){_0x23054a=_0x589a81;_0x402903[_0x1b3f('0x34')]=_[_0x1b3f('0x46')](db['Action'][_0x1b3f('0x2d')]);_0x402903[_0x1b3f('0x31')]=_[_0x1b3f('0x46')](_0x80642a[_0x1b3f('0x31')]);_0x402903[_0x1b3f('0x32')]=_[_0x1b3f('0x33')](_0x402903[_0x1b3f('0x34')],_0x402903[_0x1b3f('0x31')]);_0x1360b7[_0x1b3f('0x35')]=_[_0x1b3f('0x33')](_0x402903[_0x1b3f('0x34')],qs[_0x1b3f('0x36')](_0x80642a['query'][_0x1b3f('0x36')]));_0x1360b7['attributes']=_0x1360b7[_0x1b3f('0x35')][_0x1b3f('0x37')]?_0x1360b7[_0x1b3f('0x35')]:_0x402903[_0x1b3f('0x34')];_0x1360b7[_0x1b3f('0x3a')]=qs[_0x1b3f('0x3b')](_0x80642a['query'][_0x1b3f('0x3b')]);_0x1360b7[_0x1b3f('0x3e')]=qs['filters'](_['pick'](_0x80642a[_0x1b3f('0x31')],_0x402903[_0x1b3f('0x32')]));if(_0x80642a['query'][_0x1b3f('0x3d')]){_0x1360b7['where']=_[_0x1b3f('0x3f')](_0x1360b7[_0x1b3f('0x3e')],{'$or':_[_0x1b3f('0x30')](_0x1360b7[_0x1b3f('0x35')],function(_0x2c404c){var _0x3b97c1={};_0x3b97c1[_0x2c404c]={'$like':'%'+_0x80642a[_0x1b3f('0x31')]['filter']+'%'};return _0x3b97c1;})});}_0x1360b7=_[_0x1b3f('0x3f')]({},_0x1360b7,_0x80642a[_0x1b3f('0x40')]);return _0x23054a['getActions'](_0x1360b7);}})['then'](function(_0x2704b2){if(_0x2704b2){_0x4e9d6d=_0x2704b2[_0x1b3f('0x37')];if(!_0x80642a['query'][_0x1b3f('0x38')](_0x1b3f('0x39'))){_0x1360b7[_0x1b3f('0x1d')]=qs['limit'](_0x80642a[_0x1b3f('0x31')][_0x1b3f('0x1d')]);_0x1360b7[_0x1b3f('0x1c')]=qs[_0x1b3f('0x1c')](_0x80642a['query'][_0x1b3f('0x1c')]);}return _0x23054a[_0x1b3f('0x5e')](_0x1360b7);}})[_0x1b3f('0x24')](function(_0x1df1b3){if(_0x1df1b3){return _0x1df1b3?{'count':_0x4e9d6d,'rows':_0x1df1b3}:null;}})[_0x1b3f('0x24')](respondWithResult(_0x35ef30,null))[_0x1b3f('0x52')](handleError(_0x35ef30,null));}; \ No newline at end of file +var _0x483f=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Triggers','then','error','send','index','map','Trigger','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','pick','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x1c3425,_0x3f3ee8){var _0x1aee00=function(_0x2ff760){while(--_0x2ff760){_0x1c3425['push'](_0x1c3425['shift']());}};_0x1aee00(++_0x3f3ee8);}(_0x483f,0x10d));var _0xf483=function(_0x2a96c9,_0x3f2bc4){_0x2a96c9=_0x2a96c9-0x0;var _0x27d16a=_0x483f[_0x2a96c9];return _0x27d16a;};'use strict';var emlformat=require(_0xf483('0x0'));var rimraf=require(_0xf483('0x1'));var zipdir=require(_0xf483('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf483('0x3'));var moment=require(_0xf483('0x4'));var BPromise=require(_0xf483('0x5'));var Mustache=require(_0xf483('0x6'));var util=require(_0xf483('0x7'));var path=require(_0xf483('0x8'));var sox=require('sox');var csv=require(_0xf483('0x9'));var ejs=require(_0xf483('0xa'));var fs=require('fs');var fs_extra=require(_0xf483('0xb'));var _=require(_0xf483('0xc'));var squel=require(_0xf483('0xd'));var crypto=require(_0xf483('0xe'));var jsforce=require(_0xf483('0xf'));var deskjs=require(_0xf483('0x10'));var toCsv=require(_0xf483('0x9'));var querystring=require(_0xf483('0x11'));var Papa=require('papaparse');var Redis=require(_0xf483('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf483('0x13'));var as=require(_0xf483('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf483('0x15'))(_0xf483('0x16'));var utils=require(_0xf483('0x17'));var config=require(_0xf483('0x18'));var licenseUtil=require(_0xf483('0x19'));var db=require(_0xf483('0x1a'))['db'];function respondWithStatusCode(_0x36bf1e,_0x32a9b4){_0x32a9b4=_0x32a9b4||0xcc;return function(_0x31f22e){if(_0x31f22e){return _0x36bf1e[_0xf483('0x1b')](_0x32a9b4);}return _0x36bf1e[_0xf483('0x1c')](_0x32a9b4)[_0xf483('0x1d')]();};}function respondWithResult(_0x22123d,_0x48b577){_0x48b577=_0x48b577||0xc8;return function(_0x522994){if(_0x522994){return _0x22123d[_0xf483('0x1c')](_0x48b577)[_0xf483('0x1e')](_0x522994);}};}function respondWithFilteredResult(_0x2fff33,_0x5037d3){return function(_0x4d8742){if(_0x4d8742){var _0x478fa7=typeof _0x5037d3[_0xf483('0x1f')]==='undefined'&&typeof _0x5037d3[_0xf483('0x20')]===_0xf483('0x21');var _0x50d716=_0x4d8742[_0xf483('0x22')];var _0x144ed8=_0x478fa7?0x0:_0x5037d3[_0xf483('0x1f')];var _0xe36d33=_0x478fa7?_0x4d8742[_0xf483('0x22')]:_0x5037d3['offset']+_0x5037d3['limit'];var _0x3432ea;if(_0xe36d33>=_0x50d716){_0xe36d33=_0x50d716;_0x3432ea=0xc8;}else{_0x3432ea=0xce;}_0x2fff33[_0xf483('0x1c')](_0x3432ea);return _0x2fff33[_0xf483('0x23')](_0xf483('0x24'),_0x144ed8+'-'+_0xe36d33+'/'+_0x50d716)[_0xf483('0x1e')](_0x4d8742);}return null;};}function patchUpdates(_0x42781e){return function(_0x15cbc7){try{jsonpatch['apply'](_0x15cbc7,_0x42781e,!![]);}catch(_0x63cfa4){return BPromise[_0xf483('0x25')](_0x63cfa4);}return _0x15cbc7['save']();};}function saveUpdates(_0xc8d42e,_0x58b776){return function(_0x4f1594){if(_0x4f1594){return _0x4f1594[_0xf483('0x26')](_0xc8d42e)['then'](function(_0x35adb0){return _0x35adb0;});}return null;};}function removeEntity(_0x38a538,_0x2ef050){return function(_0x36cf8f){if(_0x36cf8f){return _0x36cf8f[_0xf483('0x27')]()['then'](function(){var _0xad44ac=_0x36cf8f[_0xf483('0x28')]({'plain':!![]});var _0x52f551=_0xf483('0x29');return db['UserProfileResource'][_0xf483('0x27')]({'where':{'type':_0x52f551,'resourceId':_0xad44ac['id']}})[_0xf483('0x2a')](function(){return _0x36cf8f;});})['then'](function(){_0x38a538[_0xf483('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x586165,_0x3de9ca){return function(_0x46f208){if(!_0x46f208){_0x586165[_0xf483('0x1b')](0x194);}return _0x46f208;};}function handleError(_0x57e137,_0x15df3b){_0x15df3b=_0x15df3b||0x1f4;return function(_0x55e0e9){logger[_0xf483('0x2b')](_0x55e0e9['stack']);if(_0x55e0e9['name']){delete _0x55e0e9['name'];}_0x57e137['status'](_0x15df3b)[_0xf483('0x2c')](_0x55e0e9);};}exports[_0xf483('0x2d')]=function(_0xcfa8fd,_0x42cb88){var _0x44e942={},_0x3e96fd={},_0x4c5691={'count':0x0,'rows':[]};var _0xce88b0=_[_0xf483('0x2e')](db[_0xf483('0x2f')][_0xf483('0x30')],function(_0x1b841b){return{'name':_0x1b841b[_0xf483('0x31')],'type':_0x1b841b['type'][_0xf483('0x32')]};});_0x3e96fd[_0xf483('0x33')]=_['map'](_0xce88b0,'name');_0x3e96fd[_0xf483('0x34')]=_[_0xf483('0x35')](_0xcfa8fd['query']);_0x3e96fd[_0xf483('0x36')]=_[_0xf483('0x37')](_0x3e96fd[_0xf483('0x33')],_0x3e96fd[_0xf483('0x34')]);_0x44e942[_0xf483('0x38')]=_[_0xf483('0x37')](_0x3e96fd['model'],qs['fields'](_0xcfa8fd[_0xf483('0x34')][_0xf483('0x39')]));_0x44e942[_0xf483('0x38')]=_0x44e942[_0xf483('0x38')][_0xf483('0x3a')]?_0x44e942[_0xf483('0x38')]:_0x3e96fd[_0xf483('0x33')];if(!_0xcfa8fd['query']['hasOwnProperty'](_0xf483('0x3b'))){_0x44e942[_0xf483('0x20')]=qs['limit'](_0xcfa8fd[_0xf483('0x34')][_0xf483('0x20')]);_0x44e942['offset']=qs[_0xf483('0x1f')](_0xcfa8fd['query'][_0xf483('0x1f')]);}_0x44e942[_0xf483('0x3c')]=qs[_0xf483('0x3d')](_0xcfa8fd[_0xf483('0x34')]['sort']);_0x44e942[_0xf483('0x3e')]=qs[_0xf483('0x36')](_['pick'](_0xcfa8fd[_0xf483('0x34')],_0x3e96fd[_0xf483('0x36')]),_0xce88b0);if(_0xcfa8fd[_0xf483('0x34')]['filter']){_0x44e942[_0xf483('0x3e')]=_[_0xf483('0x3f')](_0x44e942[_0xf483('0x3e')],{'$or':_[_0xf483('0x2e')](_0xce88b0,function(_0xcb6eec){if(_0xcb6eec[_0xf483('0x40')]!==_0xf483('0x41')){var _0x47f44b={};_0x47f44b[_0xcb6eec['name']]={'$like':'%'+_0xcfa8fd[_0xf483('0x34')][_0xf483('0x42')]+'%'};return _0x47f44b;}})});}_0x44e942=_[_0xf483('0x3f')]({},_0x44e942,_0xcfa8fd[_0xf483('0x43')]);var _0xd5034f={'where':_0x44e942[_0xf483('0x3e')]};return db[_0xf483('0x2f')][_0xf483('0x22')](_0xd5034f)[_0xf483('0x2a')](function(_0x4b067c){_0x4c5691[_0xf483('0x22')]=_0x4b067c;if(_0xcfa8fd[_0xf483('0x34')][_0xf483('0x44')]){_0x44e942[_0xf483('0x45')]=[{'all':!![]}];}return db[_0xf483('0x2f')]['findAll'](_0x44e942);})[_0xf483('0x2a')](function(_0x36ce42){_0x4c5691[_0xf483('0x46')]=_0x36ce42;return _0x4c5691;})[_0xf483('0x2a')](respondWithFilteredResult(_0x42cb88,_0x44e942))['catch'](handleError(_0x42cb88,null));};exports[_0xf483('0x47')]=function(_0x25cc88,_0x587929){var _0x51b54e={'raw':![],'where':{'id':_0x25cc88[_0xf483('0x48')]['id']}},_0x2b5ef3={};_0x2b5ef3[_0xf483('0x33')]=_[_0xf483('0x35')](db[_0xf483('0x2f')][_0xf483('0x30')]);_0x2b5ef3[_0xf483('0x34')]=_[_0xf483('0x35')](_0x25cc88[_0xf483('0x34')]);_0x2b5ef3['filters']=_[_0xf483('0x37')](_0x2b5ef3[_0xf483('0x33')],_0x2b5ef3[_0xf483('0x34')]);_0x51b54e[_0xf483('0x38')]=_[_0xf483('0x37')](_0x2b5ef3['model'],qs[_0xf483('0x39')](_0x25cc88[_0xf483('0x34')][_0xf483('0x39')]));_0x51b54e['attributes']=_0x51b54e['attributes'][_0xf483('0x3a')]?_0x51b54e[_0xf483('0x38')]:_0x2b5ef3['model'];if(_0x25cc88[_0xf483('0x34')][_0xf483('0x44')]){_0x51b54e[_0xf483('0x45')]=[{'all':!![]}];}_0x51b54e=_[_0xf483('0x3f')]({},_0x51b54e,_0x25cc88[_0xf483('0x43')]);return db['Trigger'][_0xf483('0x49')](_0x51b54e)[_0xf483('0x2a')](handleEntityNotFound(_0x587929,null))[_0xf483('0x2a')](respondWithResult(_0x587929,null))[_0xf483('0x4a')](handleError(_0x587929,null));};exports[_0xf483('0x4b')]=function(_0x266f97,_0x35540d){return db['Trigger']['create'](_0x266f97[_0xf483('0x4c')],{})[_0xf483('0x2a')](function(_0x420f4c){var _0x11bad0=_0x266f97[_0xf483('0x4d')][_0xf483('0x28')]({'plain':!![]});if(!_0x11bad0)throw new Error(_0xf483('0x4e'));if(_0x11bad0[_0xf483('0x4f')]===_0xf483('0x4d')){var _0x1a42c9=_0x420f4c[_0xf483('0x28')]({'plain':!![]});var _0x33c3fb=_0xf483('0x29');return db['UserProfileSection'][_0xf483('0x49')]({'where':{'name':_0x33c3fb,'userProfileId':_0x11bad0[_0xf483('0x50')]},'raw':!![]})[_0xf483('0x2a')](function(_0x548173){if(_0x548173&&_0x548173['autoAssociation']===0x0){return db[_0xf483('0x51')][_0xf483('0x4b')]({'name':_0x1a42c9[_0xf483('0x52')],'resourceId':_0x1a42c9['id'],'type':_0x548173[_0xf483('0x52')],'sectionId':_0x548173['id']},{})[_0xf483('0x2a')](function(){return _0x420f4c;});}else{return _0x420f4c;}})['catch'](function(_0x55beff){logger[_0xf483('0x2b')](_0xf483('0x53'),_0x55beff);throw _0x55beff;});}return _0x420f4c;})['then'](respondWithResult(_0x35540d,0xc9))[_0xf483('0x4a')](handleError(_0x35540d,null));};exports[_0xf483('0x26')]=function(_0x1b2b5d,_0x4c5968){if(_0x1b2b5d[_0xf483('0x4c')]['id']){delete _0x1b2b5d[_0xf483('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x1b2b5d[_0xf483('0x48')]['id']}})[_0xf483('0x2a')](handleEntityNotFound(_0x4c5968,null))[_0xf483('0x2a')](saveUpdates(_0x1b2b5d[_0xf483('0x4c')],null))[_0xf483('0x2a')](respondWithResult(_0x4c5968,null))['catch'](handleError(_0x4c5968,null));};exports[_0xf483('0x27')]=function(_0x539067,_0x1b3a20){return db[_0xf483('0x2f')][_0xf483('0x49')]({'where':{'id':_0x539067[_0xf483('0x48')]['id']}})[_0xf483('0x2a')](handleEntityNotFound(_0x1b3a20,null))[_0xf483('0x2a')](removeEntity(_0x1b3a20,null))[_0xf483('0x4a')](handleError(_0x1b3a20,null));};exports['addAllCondition']=function(_0x50018c,_0x58b8d8,_0x276373){if(_0x50018c[_0xf483('0x4c')]['id']){delete _0x50018c[_0xf483('0x4c')]['id'];}return db['Trigger']['find']({'where':{'id':_0x50018c[_0xf483('0x48')]['id']}})[_0xf483('0x2a')](handleEntityNotFound(_0x58b8d8,null))[_0xf483('0x2a')](function(_0x37553e){if(_0x37553e){_0x50018c[_0xf483('0x4c')]['TriggerAllId']=_0x37553e['id'];return db['Condition'][_0xf483('0x4b')](_0x50018c['body']);}})[_0xf483('0x2a')](respondWithResult(_0x58b8d8,null))['catch'](handleError(_0x58b8d8,null));};exports[_0xf483('0x54')]=function(_0x2811a4,_0x1fb8a7,_0x56cea4){if(_0x2811a4[_0xf483('0x4c')]['id']){delete _0x2811a4[_0xf483('0x4c')]['id'];}return db[_0xf483('0x2f')]['find']({'where':{'id':_0x2811a4[_0xf483('0x48')]['id']}})[_0xf483('0x2a')](handleEntityNotFound(_0x1fb8a7,null))[_0xf483('0x2a')](function(_0x15870c){if(_0x15870c){_0x2811a4[_0xf483('0x4c')][_0xf483('0x55')]=_0x15870c['id'];return db[_0xf483('0x56')][_0xf483('0x4b')](_0x2811a4['body']);}})[_0xf483('0x2a')](respondWithResult(_0x1fb8a7,null))[_0xf483('0x4a')](handleError(_0x1fb8a7,null));};exports[_0xf483('0x57')]=function(_0x138769,_0xfc24ea,_0x526e86){var _0x194f53={};var _0x55fcf4={};var _0x3e2167;var _0x331875;return db[_0xf483('0x2f')][_0xf483('0x58')]({'where':{'id':_0x138769['params']['id']}})[_0xf483('0x2a')](handleEntityNotFound(_0xfc24ea,null))[_0xf483('0x2a')](function(_0x8efb73){if(_0x8efb73){_0x3e2167=_0x8efb73;_0x55fcf4[_0xf483('0x33')]=_[_0xf483('0x35')](db[_0xf483('0x56')][_0xf483('0x30')]);_0x55fcf4[_0xf483('0x34')]=_[_0xf483('0x35')](_0x138769[_0xf483('0x34')]);_0x55fcf4[_0xf483('0x36')]=_['intersection'](_0x55fcf4[_0xf483('0x33')],_0x55fcf4[_0xf483('0x34')]);_0x194f53[_0xf483('0x38')]=_[_0xf483('0x37')](_0x55fcf4[_0xf483('0x33')],qs[_0xf483('0x39')](_0x138769[_0xf483('0x34')][_0xf483('0x39')]));_0x194f53[_0xf483('0x38')]=_0x194f53[_0xf483('0x38')][_0xf483('0x3a')]?_0x194f53[_0xf483('0x38')]:_0x55fcf4[_0xf483('0x33')];_0x194f53[_0xf483('0x3c')]=qs['sort'](_0x138769[_0xf483('0x34')][_0xf483('0x3d')]);_0x194f53[_0xf483('0x3e')]=qs['filters'](_[_0xf483('0x59')](_0x138769[_0xf483('0x34')],_0x55fcf4[_0xf483('0x36')]));if(_0x138769['query'][_0xf483('0x42')]){_0x194f53['where']=_['merge'](_0x194f53['where'],{'$or':_['map'](_0x194f53[_0xf483('0x38')],function(_0x1b244a){var _0x52322e={};_0x52322e[_0x1b244a]={'$like':'%'+_0x138769['query'][_0xf483('0x42')]+'%'};return _0x52322e;})});}_0x194f53=_['merge']({},_0x194f53,_0x138769[_0xf483('0x43')]);return _0x3e2167[_0xf483('0x57')](_0x194f53);}})[_0xf483('0x2a')](function(_0x4b1102){if(_0x4b1102){_0x331875=_0x4b1102[_0xf483('0x3a')];if(!_0x138769[_0xf483('0x34')][_0xf483('0x5a')](_0xf483('0x3b'))){_0x194f53['limit']=qs[_0xf483('0x20')](_0x138769[_0xf483('0x34')][_0xf483('0x20')]);_0x194f53['offset']=qs[_0xf483('0x1f')](_0x138769[_0xf483('0x34')]['offset']);}return _0x3e2167[_0xf483('0x57')](_0x194f53);}})[_0xf483('0x2a')](function(_0x210bb4){if(_0x210bb4){return _0x210bb4?{'count':_0x331875,'rows':_0x210bb4}:null;}})['then'](respondWithResult(_0xfc24ea,null))[_0xf483('0x4a')](handleError(_0xfc24ea,null));};exports[_0xf483('0x5b')]=function(_0x5cd8f0,_0x2dcba4,_0x5f55ae){var _0x13abd8={};var _0xab8de4={};var _0x5f10d1;var _0x2dc2eb;return db['Trigger'][_0xf483('0x58')]({'where':{'id':_0x5cd8f0[_0xf483('0x48')]['id']}})['then'](handleEntityNotFound(_0x2dcba4,null))[_0xf483('0x2a')](function(_0x4d69e3){if(_0x4d69e3){_0x5f10d1=_0x4d69e3;_0xab8de4[_0xf483('0x33')]=_[_0xf483('0x35')](db['Condition'][_0xf483('0x30')]);_0xab8de4['query']=_['keys'](_0x5cd8f0['query']);_0xab8de4[_0xf483('0x36')]=_[_0xf483('0x37')](_0xab8de4[_0xf483('0x33')],_0xab8de4[_0xf483('0x34')]);_0x13abd8[_0xf483('0x38')]=_[_0xf483('0x37')](_0xab8de4['model'],qs[_0xf483('0x39')](_0x5cd8f0['query'][_0xf483('0x39')]));_0x13abd8['attributes']=_0x13abd8[_0xf483('0x38')][_0xf483('0x3a')]?_0x13abd8[_0xf483('0x38')]:_0xab8de4[_0xf483('0x33')];_0x13abd8[_0xf483('0x3c')]=qs[_0xf483('0x3d')](_0x5cd8f0[_0xf483('0x34')]['sort']);_0x13abd8['where']=qs[_0xf483('0x36')](_['pick'](_0x5cd8f0[_0xf483('0x34')],_0xab8de4['filters']));if(_0x5cd8f0[_0xf483('0x34')]['filter']){_0x13abd8['where']=_['merge'](_0x13abd8[_0xf483('0x3e')],{'$or':_[_0xf483('0x2e')](_0x13abd8[_0xf483('0x38')],function(_0x142b9d){var _0x6b29ee={};_0x6b29ee[_0x142b9d]={'$like':'%'+_0x5cd8f0[_0xf483('0x34')]['filter']+'%'};return _0x6b29ee;})});}_0x13abd8=_['merge']({},_0x13abd8,_0x5cd8f0['options']);return _0x5f10d1[_0xf483('0x5b')](_0x13abd8);}})[_0xf483('0x2a')](function(_0x9698d5){if(_0x9698d5){_0x2dc2eb=_0x9698d5[_0xf483('0x3a')];if(!_0x5cd8f0[_0xf483('0x34')][_0xf483('0x5a')](_0xf483('0x3b'))){_0x13abd8[_0xf483('0x20')]=qs[_0xf483('0x20')](_0x5cd8f0[_0xf483('0x34')]['limit']);_0x13abd8[_0xf483('0x1f')]=qs['offset'](_0x5cd8f0[_0xf483('0x34')]['offset']);}return _0x5f10d1[_0xf483('0x5b')](_0x13abd8);}})[_0xf483('0x2a')](function(_0x21ef18){if(_0x21ef18){return _0x21ef18?{'count':_0x2dc2eb,'rows':_0x21ef18}:null;}})[_0xf483('0x2a')](respondWithResult(_0x2dcba4,null))['catch'](handleError(_0x2dcba4,null));};exports[_0xf483('0x5c')]=function(_0x737efa,_0x2ed432,_0x4811dd){if(_0x737efa[_0xf483('0x4c')]['id']){delete _0x737efa['body']['id'];}return db[_0xf483('0x2f')][_0xf483('0x49')]({'where':{'id':_0x737efa[_0xf483('0x48')]['id']}})[_0xf483('0x2a')](handleEntityNotFound(_0x2ed432,null))[_0xf483('0x2a')](function(_0x541018){if(_0x541018){_0x737efa[_0xf483('0x4c')][_0xf483('0x5d')]=_0x541018['id'];return db[_0xf483('0x5e')][_0xf483('0x4b')](_0x737efa[_0xf483('0x4c')]);}})[_0xf483('0x2a')](respondWithResult(_0x2ed432,null))[_0xf483('0x4a')](handleError(_0x2ed432,null));};exports[_0xf483('0x5f')]=function(_0x366a05,_0x14c6ac,_0x5f2fe8){var _0x347b19={};var _0x49bd2c={};var _0x2d7292;var _0x55991e;return db[_0xf483('0x2f')][_0xf483('0x58')]({'where':{'id':_0x366a05[_0xf483('0x48')]['id']}})[_0xf483('0x2a')](handleEntityNotFound(_0x14c6ac,null))['then'](function(_0xf59e22){if(_0xf59e22){_0x2d7292=_0xf59e22;_0x49bd2c[_0xf483('0x33')]=_[_0xf483('0x35')](db['Action']['rawAttributes']);_0x49bd2c[_0xf483('0x34')]=_['keys'](_0x366a05['query']);_0x49bd2c['filters']=_[_0xf483('0x37')](_0x49bd2c[_0xf483('0x33')],_0x49bd2c[_0xf483('0x34')]);_0x347b19[_0xf483('0x38')]=_['intersection'](_0x49bd2c[_0xf483('0x33')],qs[_0xf483('0x39')](_0x366a05['query'][_0xf483('0x39')]));_0x347b19[_0xf483('0x38')]=_0x347b19[_0xf483('0x38')][_0xf483('0x3a')]?_0x347b19[_0xf483('0x38')]:_0x49bd2c[_0xf483('0x33')];_0x347b19[_0xf483('0x3c')]=qs[_0xf483('0x3d')](_0x366a05[_0xf483('0x34')][_0xf483('0x3d')]);_0x347b19[_0xf483('0x3e')]=qs[_0xf483('0x36')](_[_0xf483('0x59')](_0x366a05[_0xf483('0x34')],_0x49bd2c[_0xf483('0x36')]));if(_0x366a05[_0xf483('0x34')][_0xf483('0x42')]){_0x347b19[_0xf483('0x3e')]=_[_0xf483('0x3f')](_0x347b19['where'],{'$or':_[_0xf483('0x2e')](_0x347b19[_0xf483('0x38')],function(_0xa8db97){var _0x17af9b={};_0x17af9b[_0xa8db97]={'$like':'%'+_0x366a05[_0xf483('0x34')][_0xf483('0x42')]+'%'};return _0x17af9b;})});}_0x347b19=_[_0xf483('0x3f')]({},_0x347b19,_0x366a05[_0xf483('0x43')]);return _0x2d7292[_0xf483('0x5f')](_0x347b19);}})[_0xf483('0x2a')](function(_0x37f421){if(_0x37f421){_0x55991e=_0x37f421[_0xf483('0x3a')];if(!_0x366a05[_0xf483('0x34')][_0xf483('0x5a')](_0xf483('0x3b'))){_0x347b19[_0xf483('0x20')]=qs[_0xf483('0x20')](_0x366a05[_0xf483('0x34')][_0xf483('0x20')]);_0x347b19[_0xf483('0x1f')]=qs[_0xf483('0x1f')](_0x366a05[_0xf483('0x34')][_0xf483('0x1f')]);}return _0x2d7292[_0xf483('0x5f')](_0x347b19);}})[_0xf483('0x2a')](function(_0x24f091){if(_0x24f091){return _0x24f091?{'count':_0x55991e,'rows':_0x24f091}:null;}})[_0xf483('0x2a')](respondWithResult(_0x14c6ac,null))[_0xf483('0x4a')](handleError(_0x14c6ac,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 0003df9..716c7e9 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 _0x165d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define'];(function(_0x4c3053,_0x46f9f3){var _0x578824=function(_0x4d6419){while(--_0x4d6419){_0x4c3053['push'](_0x4c3053['shift']());}};_0x578824(++_0x46f9f3);}(_0x165d,0x14a));var _0xd165=function(_0x31fdec,_0x205763){_0x31fdec=_0x31fdec-0x0;var _0x2cd012=_0x165d[_0x31fdec];return _0x2cd012;};'use strict';var _=require(_0xd165('0x0'));var util=require(_0xd165('0x1'));var logger=require(_0xd165('0x2'))(_0xd165('0x3'));var moment=require(_0xd165('0x4'));var BPromise=require(_0xd165('0x5'));var rp=require(_0xd165('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd165('0x7'));var config=require(_0xd165('0x8'));var attributes=require('./trigger.attributes');module['exports']=function(_0x5435f9,_0x42d256){return _0x5435f9[_0xd165('0x9')]('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x12c9=['Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define'];(function(_0x2aeb4b,_0x29d79d){var _0x16138d=function(_0xab860f){while(--_0xab860f){_0x2aeb4b['push'](_0x2aeb4b['shift']());}};_0x16138d(++_0x29d79d);}(_0x12c9,0x1c9));var _0x912c=function(_0x312899,_0x3b6e1f){_0x312899=_0x312899-0x0;var _0x2841b5=_0x12c9[_0x312899];return _0x2841b5;};'use strict';var _=require(_0x912c('0x0'));var util=require(_0x912c('0x1'));var logger=require(_0x912c('0x2'))(_0x912c('0x3'));var moment=require(_0x912c('0x4'));var BPromise=require('bluebird');var rp=require(_0x912c('0x5'));var fs=require('fs');var path=require(_0x912c('0x6'));var rimraf=require(_0x912c('0x7'));var config=require(_0x912c('0x8'));var attributes=require(_0x912c('0x9'));module['exports']=function(_0x584a27,_0xe29019){return _0x584a27[_0x912c('0xa')](_0x912c('0xb'),attributes,{'tableName':_0x912c('0xc'),'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 d5e8fb3..624aeb1 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 _0x99db=['request','then','info','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','error','code','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','Trigger','findAll','options','raw','where','attributes','include','model','map','debug','stringify','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x58a540,_0x342cef){var _0x162803=function(_0x2af311){while(--_0x2af311){_0x58a540['push'](_0x58a540['shift']());}};_0x162803(++_0x342cef);}(_0x99db,0x11b));var _0xb99d=function(_0x2f4d41,_0x525047){_0x2f4d41=_0x2f4d41-0x0;var _0x3b0bb2=_0x99db[_0x2f4d41];return _0x3b0bb2;};'use strict';var _=require(_0xb99d('0x0'));var util=require('util');var moment=require(_0xb99d('0x1'));var BPromise=require(_0xb99d('0x2'));var rs=require(_0xb99d('0x3'));var fs=require('fs');var Redis=require(_0xb99d('0x4'));var db=require(_0xb99d('0x5'))['db'];var utils=require(_0xb99d('0x6'));var logger=require(_0xb99d('0x7'))(_0xb99d('0x8'));var config=require(_0xb99d('0x9'));var jayson=require(_0xb99d('0xa'));var client=jayson[_0xb99d('0xb')][_0xb99d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c5f21,_0x473c51,_0x3d7edc){return new BPromise(function(_0x5b1fd1,_0x9a33f){return client[_0xb99d('0xd')](_0x5c5f21,_0x3d7edc)[_0xb99d('0xe')](function(_0x2e5d87){logger[_0xb99d('0xf')]('Trigger,\x20%s,\x20%s',_0x473c51,_0xb99d('0x10'));logger['debug'](_0xb99d('0x11'),_0x473c51,_0xb99d('0x10'),JSON['stringify'](_0x2e5d87));if(_0x2e5d87[_0xb99d('0x12')]){if(_0x2e5d87[_0xb99d('0x12')][_0xb99d('0x13')]===0x1f4){logger[_0xb99d('0x12')](_0xb99d('0x14'),_0x473c51,_0x2e5d87[_0xb99d('0x12')][_0xb99d('0x15')]);return _0x9a33f(_0x2e5d87[_0xb99d('0x12')][_0xb99d('0x15')]);}logger[_0xb99d('0x12')](_0xb99d('0x14'),_0x473c51,_0x2e5d87['error'][_0xb99d('0x15')]);return _0x5b1fd1(_0x2e5d87[_0xb99d('0x12')][_0xb99d('0x15')]);}else{logger[_0xb99d('0xf')](_0xb99d('0x14'),_0x473c51,_0xb99d('0x10'));_0x5b1fd1(_0x2e5d87[_0xb99d('0x16')][_0xb99d('0x15')]);}})[_0xb99d('0x17')](function(_0x337f3f){logger[_0xb99d('0x12')](_0xb99d('0x14'),_0x473c51,_0x337f3f);_0x9a33f(_0x337f3f);});});}exports[_0xb99d('0x18')]=function(_0x48f592){var _0x30b78f=this;return new Promise(function(_0x4397a8,_0x56f787){return db[_0xb99d('0x19')][_0xb99d('0x1a')]({'raw':_0x48f592[_0xb99d('0x1b')]?_0x48f592['options'][_0xb99d('0x1c')]===undefined?!![]:![]:!![],'where':_0x48f592[_0xb99d('0x1b')]?_0x48f592['options'][_0xb99d('0x1d')]||null:null,'attributes':_0x48f592[_0xb99d('0x1b')]?_0x48f592[_0xb99d('0x1b')][_0xb99d('0x1e')]||null:null,'limit':_0x48f592[_0xb99d('0x1b')]?_0x48f592[_0xb99d('0x1b')]['limit']||null:null,'include':_0x48f592[_0xb99d('0x1b')]?_0x48f592[_0xb99d('0x1b')][_0xb99d('0x1f')]?_['map'](_0x48f592[_0xb99d('0x1b')][_0xb99d('0x1f')],function(_0x4e1ebb){return{'model':db[_0x4e1ebb[_0xb99d('0x20')]],'as':_0x4e1ebb['as'],'attributes':_0x4e1ebb['attributes'],'include':_0x4e1ebb[_0xb99d('0x1f')]?_[_0xb99d('0x21')](_0x4e1ebb[_0xb99d('0x1f')],function(_0xf0c2fc){return{'model':db[_0xf0c2fc[_0xb99d('0x20')]],'as':_0xf0c2fc['as'],'attributes':_0xf0c2fc[_0xb99d('0x1e')],'include':_0xf0c2fc['include']?_[_0xb99d('0x21')](_0xf0c2fc[_0xb99d('0x1f')],function(_0xefa4f5){return{'model':db[_0xefa4f5[_0xb99d('0x20')]],'as':_0xefa4f5['as'],'attributes':_0xefa4f5['attributes']};}):[]};}):[]};}):[]:[]})[_0xb99d('0xe')](function(_0x1770d1){logger[_0xb99d('0xf')](_0xb99d('0x18'),_0x48f592);logger[_0xb99d('0x22')]('GetTrigger',_0x48f592,JSON[_0xb99d('0x23')](_0x1770d1));_0x4397a8(_0x1770d1);})[_0xb99d('0x17')](function(_0x417211){logger[_0xb99d('0x12')](_0xb99d('0x18'),_0x417211['message'],_0x48f592);_0x56f787(_0x30b78f[_0xb99d('0x12')](0x1f4,_0x417211[_0xb99d('0x15')]));});});};exports['ShowTrigger']=function(_0x417315){var _0x41490e=this;return new Promise(function(_0x4e9797,_0x5e543b){return db[_0xb99d('0x19')]['find']({'raw':_0x417315[_0xb99d('0x1b')]?_0x417315['options'][_0xb99d('0x1c')]===undefined?!![]:![]:!![],'where':_0x417315[_0xb99d('0x1b')]?_0x417315[_0xb99d('0x1b')][_0xb99d('0x1d')]||null:null,'attributes':_0x417315[_0xb99d('0x1b')]?_0x417315[_0xb99d('0x1b')]['attributes']||null:null,'include':_0x417315[_0xb99d('0x1b')]?_0x417315[_0xb99d('0x1b')]['include']?_['map'](_0x417315['options'][_0xb99d('0x1f')],function(_0xb918fb){return{'model':db[_0xb918fb[_0xb99d('0x20')]],'as':_0xb918fb['as'],'attributes':_0xb918fb[_0xb99d('0x1e')],'include':_0xb918fb[_0xb99d('0x1f')]?_[_0xb99d('0x21')](_0xb918fb[_0xb99d('0x1f')],function(_0x287a60){return{'model':db[_0x287a60[_0xb99d('0x20')]],'as':_0x287a60['as'],'attributes':_0x287a60['attributes'],'include':_0x287a60[_0xb99d('0x1f')]?_[_0xb99d('0x21')](_0x287a60['include'],function(_0x13d3ba){return{'model':db[_0x13d3ba[_0xb99d('0x20')]],'as':_0x13d3ba['as'],'attributes':_0x13d3ba[_0xb99d('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xb99d('0xe')](function(_0x3fc5fd){logger[_0xb99d('0xf')](_0xb99d('0x24'),_0x417315);logger[_0xb99d('0x22')](_0xb99d('0x24'),_0x417315,JSON[_0xb99d('0x23')](_0x3fc5fd));_0x4e9797(_0x3fc5fd);})[_0xb99d('0x17')](function(_0x3d8721){logger[_0xb99d('0x12')]('ShowTrigger',_0x3d8721[_0xb99d('0x15')],_0x417315);_0x5e543b(_0x41490e[_0xb99d('0x12')](0x1f4,_0x3d8721[_0xb99d('0x15')]));});});}; \ No newline at end of file +var _0xd2d4=['include','model','debug','catch','ShowTrigger','Trigger','find','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','info','result','GetTrigger','findAll','options','raw','where','attributes','limit','map'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0xd2d4,0x1a0));var _0x4d2d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd2d4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4d2d('0x0'));var util=require('util');var moment=require(_0x4d2d('0x1'));var BPromise=require(_0x4d2d('0x2'));var rs=require(_0x4d2d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d2d('0x4'))['db'];var utils=require(_0x4d2d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d2d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4d2d('0x7')][_0x4d2d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xca2493,_0x248654,_0x5adf61){return new BPromise(function(_0x418f63,_0x2fd20f){return client[_0x4d2d('0x9')](_0xca2493,_0x5adf61)['then'](function(_0x24dec2){logger['info']('Trigger,\x20%s,\x20%s',_0x248654,_0x4d2d('0xa'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x248654,_0x4d2d('0xa'),JSON[_0x4d2d('0xb')](_0x24dec2));if(_0x24dec2[_0x4d2d('0xc')]){if(_0x24dec2[_0x4d2d('0xc')][_0x4d2d('0xd')]===0x1f4){logger[_0x4d2d('0xc')](_0x4d2d('0xe'),_0x248654,_0x24dec2[_0x4d2d('0xc')][_0x4d2d('0xf')]);return _0x2fd20f(_0x24dec2[_0x4d2d('0xc')][_0x4d2d('0xf')]);}logger[_0x4d2d('0xc')](_0x4d2d('0xe'),_0x248654,_0x24dec2[_0x4d2d('0xc')]['message']);return _0x418f63(_0x24dec2['error']['message']);}else{logger[_0x4d2d('0x10')](_0x4d2d('0xe'),_0x248654,'request\x20sent');_0x418f63(_0x24dec2[_0x4d2d('0x11')]['message']);}})['catch'](function(_0x4ee407){logger['error'](_0x4d2d('0xe'),_0x248654,_0x4ee407);_0x2fd20f(_0x4ee407);});});}exports[_0x4d2d('0x12')]=function(_0x1c3572){var _0x23e79d=this;return new Promise(function(_0x522163,_0x43e604){return db['Trigger'][_0x4d2d('0x13')]({'raw':_0x1c3572[_0x4d2d('0x14')]?_0x1c3572[_0x4d2d('0x14')][_0x4d2d('0x15')]===undefined?!![]:![]:!![],'where':_0x1c3572[_0x4d2d('0x14')]?_0x1c3572['options'][_0x4d2d('0x16')]||null:null,'attributes':_0x1c3572[_0x4d2d('0x14')]?_0x1c3572[_0x4d2d('0x14')][_0x4d2d('0x17')]||null:null,'limit':_0x1c3572['options']?_0x1c3572[_0x4d2d('0x14')][_0x4d2d('0x18')]||null:null,'include':_0x1c3572[_0x4d2d('0x14')]?_0x1c3572[_0x4d2d('0x14')]['include']?_[_0x4d2d('0x19')](_0x1c3572['options']['include'],function(_0x552684){return{'model':db[_0x552684['model']],'as':_0x552684['as'],'attributes':_0x552684['attributes'],'include':_0x552684[_0x4d2d('0x1a')]?_['map'](_0x552684[_0x4d2d('0x1a')],function(_0x2dc4d4){return{'model':db[_0x2dc4d4[_0x4d2d('0x1b')]],'as':_0x2dc4d4['as'],'attributes':_0x2dc4d4[_0x4d2d('0x17')],'include':_0x2dc4d4[_0x4d2d('0x1a')]?_[_0x4d2d('0x19')](_0x2dc4d4[_0x4d2d('0x1a')],function(_0x34cdd1){return{'model':db[_0x34cdd1[_0x4d2d('0x1b')]],'as':_0x34cdd1['as'],'attributes':_0x34cdd1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22e8d1){logger[_0x4d2d('0x10')](_0x4d2d('0x12'),_0x1c3572);logger[_0x4d2d('0x1c')](_0x4d2d('0x12'),_0x1c3572,JSON['stringify'](_0x22e8d1));_0x522163(_0x22e8d1);})[_0x4d2d('0x1d')](function(_0x567e8c){logger[_0x4d2d('0xc')](_0x4d2d('0x12'),_0x567e8c[_0x4d2d('0xf')],_0x1c3572);_0x43e604(_0x23e79d[_0x4d2d('0xc')](0x1f4,_0x567e8c['message']));});});};exports[_0x4d2d('0x1e')]=function(_0x280ce7){var _0x4f6fd8=this;return new Promise(function(_0x442e34,_0x594f2e){return db[_0x4d2d('0x1f')][_0x4d2d('0x20')]({'raw':_0x280ce7[_0x4d2d('0x14')]?_0x280ce7[_0x4d2d('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x280ce7[_0x4d2d('0x14')]?_0x280ce7['options'][_0x4d2d('0x16')]||null:null,'attributes':_0x280ce7[_0x4d2d('0x14')]?_0x280ce7[_0x4d2d('0x14')]['attributes']||null:null,'include':_0x280ce7[_0x4d2d('0x14')]?_0x280ce7[_0x4d2d('0x14')][_0x4d2d('0x1a')]?_['map'](_0x280ce7[_0x4d2d('0x14')][_0x4d2d('0x1a')],function(_0xb5c81f){return{'model':db[_0xb5c81f[_0x4d2d('0x1b')]],'as':_0xb5c81f['as'],'attributes':_0xb5c81f[_0x4d2d('0x17')],'include':_0xb5c81f[_0x4d2d('0x1a')]?_[_0x4d2d('0x19')](_0xb5c81f['include'],function(_0xab38a1){return{'model':db[_0xab38a1[_0x4d2d('0x1b')]],'as':_0xab38a1['as'],'attributes':_0xab38a1[_0x4d2d('0x17')],'include':_0xab38a1['include']?_[_0x4d2d('0x19')](_0xab38a1[_0x4d2d('0x1a')],function(_0x51752f){return{'model':db[_0x51752f[_0x4d2d('0x1b')]],'as':_0x51752f['as'],'attributes':_0x51752f[_0x4d2d('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4d2d('0x21')](function(_0x10ac4a){logger[_0x4d2d('0x10')](_0x4d2d('0x1e'),_0x280ce7);logger[_0x4d2d('0x1c')](_0x4d2d('0x1e'),_0x280ce7,JSON[_0x4d2d('0xb')](_0x10ac4a));_0x442e34(_0x10ac4a);})['catch'](function(_0x6ad972){logger[_0x4d2d('0xc')]('ShowTrigger',_0x6ad972[_0x4d2d('0xf')],_0x280ce7);_0x594f2e(_0x4f6fd8[_0x4d2d('0xc')](0x1f4,_0x6ad972[_0x4d2d('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1fbb3c8..4850252 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 _0xffff=['isAuthenticated','index','/:id','show','post','clone','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x31b5a5,_0x44376a){var _0x364cc9=function(_0x4e5f95){while(--_0x4e5f95){_0x31b5a5['push'](_0x31b5a5['shift']());}};_0x364cc9(++_0x44376a);}(_0xffff,0x1e6));var _0xffff=function(_0xf70e86,_0x54af94){_0xf70e86=_0xf70e86-0x0;var _0x42303a=_0xffff[_0xf70e86];return _0x42303a;};'use strict';var multer=require(_0xffff('0x0'));var util=require('util');var path=require(_0xffff('0x1'));var timeout=require(_0xffff('0x2'));var express=require(_0xffff('0x3'));var router=express[_0xffff('0x4')]();var fs_extra=require(_0xffff('0x5'));var auth=require(_0xffff('0x6'));var interaction=require(_0xffff('0x7'));var config=require('../../config/environment');var controller=require('./trunk.controller');router['get']('/',auth[_0xffff('0x8')](),controller[_0xffff('0x9')]);router['get'](_0xffff('0xa'),auth['isAuthenticated'](),controller[_0xffff('0xb')]);router[_0xffff('0xc')]('/:id/clone',auth[_0xffff('0x8')](),controller[_0xffff('0xd')]);router[_0xffff('0xc')]('/',auth['isAuthenticated'](),controller[_0xffff('0xe')]);router['put'](_0xffff('0xa'),auth['isAuthenticated'](),controller[_0xffff('0xf')]);router[_0xffff('0x10')]('/:id',auth[_0xffff('0x8')](),controller[_0xffff('0x11')]);module[_0xffff('0x12')]=router; \ No newline at end of file +var _0x578d=['get','/:id','post','/:id/clone','clone','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','isAuthenticated','index'];(function(_0x286260,_0x1055c4){var _0xe3d8ad=function(_0x1f32c6){while(--_0x1f32c6){_0x286260['push'](_0x286260['shift']());}};_0xe3d8ad(++_0x1055c4);}(_0x578d,0x1ed));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xd578('0x0'));var path=require('path');var timeout=require(_0xd578('0x1'));var express=require(_0xd578('0x2'));var router=express[_0xd578('0x3')]();var fs_extra=require(_0xd578('0x4'));var auth=require(_0xd578('0x5'));var interaction=require(_0xd578('0x6'));var config=require(_0xd578('0x7'));var controller=require(_0xd578('0x8'));router['get']('/',auth[_0xd578('0x9')](),controller[_0xd578('0xa')]);router[_0xd578('0xb')](_0xd578('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xd578('0xd')](_0xd578('0xe'),auth[_0xd578('0x9')](),controller[_0xd578('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd578('0x10')]);router[_0xd578('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xd578('0x12')]);router[_0xd578('0x13')](_0xd578('0xc'),auth[_0xd578('0x9')](),controller[_0xd578('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 7486be0..7cabc9e 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 _0x740c=['refuse','originate','uac','uas','pai','active','passive','actpass','dynamic','update,nonat','BOOLEAN','STRING','name','ENUM','friend','user','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','join','getDataValue','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','always','accept'];(function(_0x341957,_0x46c9fa){var _0x4f10f6=function(_0xfd12f0){while(--_0xfd12f0){_0x341957['push'](_0x341957['shift']());}};_0x4f10f6(++_0x46c9fa);}(_0x740c,0xd3));var _0xc740=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x740c[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xc740('0x0')],'allowNull':![],'unique':_0xc740('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x3'),_0xc740('0x4'),_0xc740('0x5')),'allowNull':![],'defaultValue':_0xc740('0x3')},'context':{'type':Sequelize[_0xc740('0x0')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x6'),_0xc740('0x7'),_0xc740('0x8'),_0xc740('0x9'),_0xc740('0xa'),_0xc740('0xb'),_0xc740('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0xc740('0x0')]},'permit':{'type':Sequelize[_0xc740('0x0')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xc740('0x0')]},'remotesecret':{'type':Sequelize[_0xc740('0x0')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xc740('0xd'),'set':function(_0x3ad852){this[_0xc740('0xe')]('transport',_0x3ad852?_0x3ad852[_0xc740('0xf')](','):null);},'get':function(){return this[_0xc740('0x10')](_0xc740('0x11'))?this[_0xc740('0x10')]('transport')[_0xc740('0x12')](','):null;},'comment':_0xc740('0x13')},'dtmfmode':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x14'),_0xc740('0x15'),_0xc740('0x16'),'inband',_0xc740('0x17')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no',_0xc740('0x19'),_0xc740('0x1a'),_0xc740('0x1b')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc740('0x0')]},'directmediadeny':{'type':Sequelize[_0xc740('0x0')]},'nat':{'type':Sequelize[_0xc740('0x0')],'defaultValue':_0xc740('0x1c'),'set':function(_0x49086d){this[_0xc740('0xe')](_0xc740('0x1d'),_0x49086d?_0x49086d['join'](','):null);},'get':function(){return this[_0xc740('0x10')](_0xc740('0x1d'))?this[_0xc740('0x10')](_0xc740('0x1d'))[_0xc740('0x12')](','):null;},'comment':_0xc740('0x1e')},'callgroup':{'type':Sequelize[_0xc740('0x0')]},'namedcallgroup':{'type':Sequelize[_0xc740('0x0')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc740('0x0')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc740('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xc740('0x0')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xc740('0x0')],'allowNull':![],'defaultValue':_0xc740('0x1f'),'set':function(_0x347265){this['setDataValue'](_0xc740('0x20'),_0x347265?_0x347265[_0xc740('0xf')](';'):_0xc740('0x1f'));},'get':function(){return this['getDataValue']('allow')?this[_0xc740('0x10')](_0xc740('0x20'))[_0xc740('0x12')](';'):null;},'comment':_0xc740('0x21')},'autoframing':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no')},'insecure':{'type':Sequelize[_0xc740('0x0')],'defaultValue':'port,invite','set':function(_0x2f653f){this[_0xc740('0xe')](_0xc740('0x22'),_0x2f653f?_0x2f653f['join'](','):null);},'get':function(){return this[_0xc740('0x10')](_0xc740('0x22'))?this[_0xc740('0x10')](_0xc740('0x22'))[_0xc740('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc740('0x2')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no',_0xc740('0x23'))},'promiscredir':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no')},'useclientcode':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no')},'accountcode':{'type':Sequelize[_0xc740('0x24')](0xb)},'setvar':{'type':Sequelize[_0xc740('0x0')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xc740('0x0')]},'callcounter':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc740('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no')},'allowsubscribe':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xc740('0x18'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc740('0x18'),'no')},'subscribecontext':{'type':Sequelize[_0xc740('0x0')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no',_0xc740('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc740('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc740('0x18'),'no')},'mailbox':{'type':Sequelize[_0xc740('0x0')]},'session_timers':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x26'),_0xc740('0x27'),_0xc740('0x28'))},'session_expires':{'type':Sequelize[_0xc740('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xc740('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x29'),_0xc740('0x2a')),'defaultValue':_0xc740('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xc740('0x0')]},'regexten':{'type':Sequelize[_0xc740('0x0')]},'fromdomain':{'type':Sequelize[_0xc740('0x0')]},'fromuser':{'type':Sequelize[_0xc740('0x0')]},'port':{'type':Sequelize[_0xc740('0x24')](0x5)},'qualify':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no'),'defaultValue':_0xc740('0x18')},'keepalive':{'type':Sequelize[_0xc740('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xc740('0x0')]},'rtptimeout':{'type':Sequelize[_0xc740('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xc740('0x24')](0xb)},'sendrpid':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no',_0xc740('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc740('0x0')]},'callbackextension':{'type':Sequelize[_0xc740('0x0')]},'timert1':{'type':Sequelize[_0xc740('0x24')](0xb)},'timerb':{'type':Sequelize[_0xc740('0x24')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xc740('0x0')]},'contactdeny':{'type':Sequelize[_0xc740('0x0')]},'contactacl':{'type':Sequelize[_0xc740('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0xc740('0x0')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0xc740('0x24')](0xb)},'encryption':{'type':Sequelize[_0xc740('0x2')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xc740('0x18'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xc740('0x18'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xc740('0x18'),'no')},'dtlsenable':{'type':Sequelize[_0xc740('0x2')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0xc740('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0xc740('0x0')]},'dtlsprivatekey':{'type':Sequelize[_0xc740('0x0')]},'dtlscipher':{'type':Sequelize[_0xc740('0x0')]},'dtlscafile':{'type':Sequelize[_0xc740('0x0')]},'dtlscapath':{'type':Sequelize[_0xc740('0x0')]},'dtlssetup':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x2c'),_0xc740('0x2d'),_0xc740('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc740('0x0')]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xc740('0x0')]},'call_limit':{'type':Sequelize[_0xc740('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xc740('0x18'),'no')},'subscribemwi':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no')},'vmexten':{'type':Sequelize[_0xc740('0x0')]},'mohinterpret':{'type':Sequelize[_0xc740('0x0')]},'mohsuggest':{'type':Sequelize[_0xc740('0x0')]},'parkinglot':{'type':Sequelize[_0xc740('0x0')]},'description':{'type':Sequelize[_0xc740('0x0')]},'host':{'type':Sequelize[_0xc740('0x0')],'defaultValue':_0xc740('0x2f')},'canreinvite':{'type':Sequelize[_0xc740('0x2')](_0xc740('0x18'),'no',_0xc740('0x19'),_0xc740('0x1a'),_0xc740('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xc740('0x0')]},'otherFields':{'type':Sequelize[_0xc740('0x0')]},'active':{'type':Sequelize[_0xc740('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xc740('0x0')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7dd3=['allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','INTEGER','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','update','update,nonat','STRING','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','rfc2833','info','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x7dd3,0x1d2));var _0x37dd=function(_0x1bce32,_0x17b4ac){_0x1bce32=_0x1bce32-0x0;var _0x33d708=_0x7dd3[_0x1bce32];return _0x33d708;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x37dd('0x0')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x2'),_0x37dd('0x3'),_0x37dd('0x4')),'allowNull':![],'defaultValue':_0x37dd('0x2')},'context':{'type':Sequelize[_0x37dd('0x0')],'allowNull':![],'defaultValue':_0x37dd('0x5')},'callingpres':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x6'),_0x37dd('0x7'),'ALLOWED_FAILED_SCREEN',_0x37dd('0x8'),_0x37dd('0x9'),_0x37dd('0xa'),_0x37dd('0xb'),'PROHIB')},'deny':{'type':Sequelize[_0x37dd('0x0')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x37dd('0x0')]},'md5secret':{'type':Sequelize[_0x37dd('0x0')]},'remotesecret':{'type':Sequelize[_0x37dd('0x0')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x37af1a){this[_0x37dd('0xc')](_0x37dd('0xd'),_0x37af1a?_0x37af1a[_0x37dd('0xe')](','):null);},'get':function(){return this[_0x37dd('0xf')]('transport')?this[_0x37dd('0xf')](_0x37dd('0xd'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x10'),_0x37dd('0x11'),'shortinfo',_0x37dd('0x12'),_0x37dd('0x13')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no',_0x37dd('0x15'),'update',_0x37dd('0x16')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x37dd('0x0')],'defaultValue':_0x37dd('0x17'),'set':function(_0x540c2c){this[_0x37dd('0xc')](_0x37dd('0x18'),_0x540c2c?_0x540c2c['join'](','):null);},'get':function(){return this['getDataValue'](_0x37dd('0x18'))?this[_0x37dd('0xf')](_0x37dd('0x18'))[_0x37dd('0x19')](','):null;},'comment':_0x37dd('0x1a')},'callgroup':{'type':Sequelize[_0x37dd('0x0')]},'namedcallgroup':{'type':Sequelize[_0x37dd('0x0')]},'pickupgroup':{'type':Sequelize[_0x37dd('0x0')]},'namedpickupgroup':{'type':Sequelize[_0x37dd('0x0')]},'language':{'type':Sequelize[_0x37dd('0x0')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x37dd('0x0')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x37dd('0x1b')},'allow':{'type':Sequelize[_0x37dd('0x0')],'allowNull':![],'defaultValue':_0x37dd('0x1c'),'set':function(_0x3d3284){this[_0x37dd('0xc')]('allow',_0x3d3284?_0x3d3284[_0x37dd('0xe')](';'):_0x37dd('0x1c'));},'get':function(){return this['getDataValue'](_0x37dd('0x1d'))?this[_0x37dd('0xf')](_0x37dd('0x1d'))[_0x37dd('0x19')](';'):null;},'comment':_0x37dd('0x1e')},'autoframing':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no')},'insecure':{'type':Sequelize[_0x37dd('0x0')],'defaultValue':_0x37dd('0x1f'),'set':function(_0x58366c){this[_0x37dd('0xc')](_0x37dd('0x20'),_0x58366c?_0x58366c[_0x37dd('0xe')](','):null);},'get':function(){return this[_0x37dd('0xf')]('insecure')?this[_0x37dd('0xf')](_0x37dd('0x20'))[_0x37dd('0x19')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x37dd('0x1')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no',_0x37dd('0x21'))},'promiscredir':{'type':Sequelize['ENUM']('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x37dd('0x0')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x37dd('0x0')]},'callcounter':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no'),'defaultValue':_0x37dd('0x14')},'busylevel':{'type':Sequelize[_0x37dd('0x22')](0xb)},'allowoverlap':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no')},'subscribecontext':{'type':Sequelize[_0x37dd('0x0')]},'template':{'type':Sequelize[_0x37dd('0x0')]},'videosupport':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x37dd('0x22')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no')},'mailbox':{'type':Sequelize[_0x37dd('0x0')]},'session_timers':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x23'),_0x37dd('0x24'),_0x37dd('0x25'))},'session_expires':{'type':Sequelize[_0x37dd('0x22')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x37dd('0x26')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x37dd('0x0')]},'regexten':{'type':Sequelize[_0x37dd('0x0')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x37dd('0x0')]},'port':{'type':Sequelize[_0x37dd('0x22')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x37dd('0x22')](0xb)},'defaultip':{'type':Sequelize[_0x37dd('0x0')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize[_0x37dd('0x22')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x37dd('0x22')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x37dd('0x22')](0xb)},'sendrpid':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x37dd('0x0')]},'timert1':{'type':Sequelize[_0x37dd('0x22')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x37dd('0x22')](0xb)},'contactpermit':{'type':Sequelize[_0x37dd('0x0')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x37dd('0x0')]},'unsolicited_mailbox':{'type':Sequelize[_0x37dd('0x0')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x37dd('0x22')](0xb)},'encryption':{'type':Sequelize[_0x37dd('0x1')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no')},'force_avp':{'type':Sequelize['ENUM']('yes','no')},'icesupport':{'type':Sequelize['ENUM']('yes','no')},'dtlsenable':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no')},'dtlsverify':{'type':Sequelize[_0x37dd('0x1')]('yes','no',_0x37dd('0x27'),_0x37dd('0x28'))},'dtlsrekey':{'type':Sequelize[_0x37dd('0x22')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x37dd('0x0')]},'dtlscipher':{'type':Sequelize[_0x37dd('0x0')]},'dtlscafile':{'type':Sequelize[_0x37dd('0x0')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0x37dd('0x1')]('active',_0x37dd('0x29'),_0x37dd('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x37dd('0x0')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x37dd('0x22')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x37dd('0x14'),'no')},'vmexten':{'type':Sequelize[_0x37dd('0x0')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x37dd('0x0')]},'parkinglot':{'type':Sequelize[_0x37dd('0x0')]},'description':{'type':Sequelize[_0x37dd('0x0')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x37dd('0x1')](_0x37dd('0x14'),'no',_0x37dd('0x15'),_0x37dd('0x2b'),_0x37dd('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x37dd('0x0')]},'otherFields':{'type':Sequelize[_0x37dd('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 e44781d..3022b9c 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 _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x125890,_0x5a296b){var _0x1c767a=function(_0x5c35c8){while(--_0x5c35c8){_0x125890['push'](_0x125890['shift']());}};_0x1c767a(++_0x5a296b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x00bb[_0x30ae5e];return _0x1f2e93;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,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(_0x3f9aa0,_0x478ec3){var _0x4a82c0=function(_0x279091){while(--_0x279091){_0x3f9aa0['push'](_0x3f9aa0['shift']());}};_0x4a82c0(++_0x478ec3);}(_0x34e8,0x12c));var _0x834e=function(_0x573f9a,_0x2a85d9){_0x573f9a=_0x573f9a-0x0;var _0x4e10dd=_0x34e8[_0x573f9a];return _0x4e10dd;};'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 bee7cb4..0a77b59 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 _0xd841=['request-promise','path','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','../../config/logger','bluebird'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xd841,0x75));var _0x1d84=function(_0x33498c,_0x446b17){_0x33498c=_0x33498c-0x0;var _0x261d51=_0xd841[_0x33498c];return _0x261d51;};'use strict';var _=require(_0x1d84('0x0'));var util=require(_0x1d84('0x1'));var logger=require(_0x1d84('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1d84('0x3'));var rp=require(_0x1d84('0x4'));var fs=require('fs');var path=require(_0x1d84('0x5'));var rimraf=require('rimraf');var config=require(_0x1d84('0x6'));var attributes=require(_0x1d84('0x7'));module[_0x1d84('0x8')]=function(_0x254d71,_0x5ca21a){return _0x254d71[_0x1d84('0x9')]('Trunk',attributes,{'tableName':_0x1d84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4f6b=['../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5f06ec,_0x1974aa){var _0x1d49f6=function(_0x1ac15e){while(--_0x1ac15e){_0x5f06ec['push'](_0x5f06ec['shift']());}};_0x1d49f6(++_0x1974aa);}(_0x4f6b,0x18b));var _0xb4f6=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x4f6b[_0x334841];return _0x5beb4b;};'use strict';var _=require(_0xb4f6('0x0'));var util=require(_0xb4f6('0x1'));var logger=require('../../config/logger')(_0xb4f6('0x2'));var moment=require(_0xb4f6('0x3'));var BPromise=require(_0xb4f6('0x4'));var rp=require(_0xb4f6('0x5'));var fs=require('fs');var path=require(_0xb4f6('0x6'));var rimraf=require(_0xb4f6('0x7'));var config=require(_0xb4f6('0x8'));var attributes=require(_0xb4f6('0x9'));module[_0xb4f6('0xa')]=function(_0x1caa8c,_0xb80a71){return _0x1caa8c[_0xb4f6('0xb')](_0xb4f6('0xc'),attributes,{'tableName':'tools_trunks','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 f22c762..9e36d87 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 _0x71b9=['model','ShowTrunk','find','raw','then','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetTrunk','Trunk','options','where','attributes','limit','include','map'];(function(_0x185334,_0x4630ac){var _0xf2e59a=function(_0x3cc497){while(--_0x3cc497){_0x185334['push'](_0x185334['shift']());}};_0xf2e59a(++_0x4630ac);}(_0x71b9,0x19d));var _0x971b=function(_0x754661,_0x5b4080){_0x754661=_0x754661-0x0;var _0x17cffd=_0x71b9[_0x754661];return _0x17cffd;};'use strict';var _=require(_0x971b('0x0'));var util=require('util');var moment=require(_0x971b('0x1'));var BPromise=require('bluebird');var rs=require(_0x971b('0x2'));var fs=require('fs');var Redis=require(_0x971b('0x3'));var db=require(_0x971b('0x4'))['db'];var utils=require(_0x971b('0x5'));var logger=require(_0x971b('0x6'))(_0x971b('0x7'));var config=require('../../config/environment');var jayson=require(_0x971b('0x8'));var client=jayson[_0x971b('0x9')][_0x971b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x285ae3,_0x6086ae,_0xe35b6b){return new BPromise(function(_0x28e3,_0xf17b97){return client[_0x971b('0xb')](_0x285ae3,_0xe35b6b)['then'](function(_0xb69f48){logger[_0x971b('0xc')](_0x971b('0xd'),_0x6086ae,'request\x20sent');logger[_0x971b('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x6086ae,_0x971b('0xf'),JSON[_0x971b('0x10')](_0xb69f48));if(_0xb69f48[_0x971b('0x11')]){if(_0xb69f48[_0x971b('0x11')]['code']===0x1f4){logger['error'](_0x971b('0xd'),_0x6086ae,_0xb69f48[_0x971b('0x11')][_0x971b('0x12')]);return _0xf17b97(_0xb69f48[_0x971b('0x11')][_0x971b('0x12')]);}logger[_0x971b('0x11')]('Trunk,\x20%s,\x20%s',_0x6086ae,_0xb69f48[_0x971b('0x11')][_0x971b('0x12')]);return _0x28e3(_0xb69f48[_0x971b('0x11')][_0x971b('0x12')]);}else{logger[_0x971b('0xc')]('Trunk,\x20%s,\x20%s',_0x6086ae,_0x971b('0xf'));_0x28e3(_0xb69f48[_0x971b('0x13')][_0x971b('0x12')]);}})[_0x971b('0x14')](function(_0x253f6e){logger['error'](_0x971b('0xd'),_0x6086ae,_0x253f6e);_0xf17b97(_0x253f6e);});});}exports[_0x971b('0x15')]=function(_0x3e5ff4){var _0x454ffe=this;return new Promise(function(_0x594dd4,_0x4b9239){return db[_0x971b('0x16')]['findAll']({'raw':_0x3e5ff4[_0x971b('0x17')]?_0x3e5ff4[_0x971b('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3e5ff4[_0x971b('0x17')]?_0x3e5ff4['options'][_0x971b('0x18')]||null:null,'attributes':_0x3e5ff4[_0x971b('0x17')]?_0x3e5ff4[_0x971b('0x17')][_0x971b('0x19')]||null:null,'limit':_0x3e5ff4[_0x971b('0x17')]?_0x3e5ff4[_0x971b('0x17')][_0x971b('0x1a')]||null:null,'include':_0x3e5ff4['options']?_0x3e5ff4[_0x971b('0x17')][_0x971b('0x1b')]?_[_0x971b('0x1c')](_0x3e5ff4[_0x971b('0x17')][_0x971b('0x1b')],function(_0x1fce0e){return{'model':db[_0x1fce0e[_0x971b('0x1d')]],'as':_0x1fce0e['as'],'attributes':_0x1fce0e['attributes'],'include':_0x1fce0e[_0x971b('0x1b')]?_['map'](_0x1fce0e[_0x971b('0x1b')],function(_0x2295c3){return{'model':db[_0x2295c3[_0x971b('0x1d')]],'as':_0x2295c3['as'],'attributes':_0x2295c3[_0x971b('0x19')],'include':_0x2295c3['include']?_[_0x971b('0x1c')](_0x2295c3['include'],function(_0x19d46a){return{'model':db[_0x19d46a[_0x971b('0x1d')]],'as':_0x19d46a['as'],'attributes':_0x19d46a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c85dc){logger['info'](_0x971b('0x15'),_0x3e5ff4);logger[_0x971b('0xe')](_0x971b('0x15'),_0x3e5ff4,JSON[_0x971b('0x10')](_0x3c85dc));_0x594dd4(_0x3c85dc);})[_0x971b('0x14')](function(_0x3ff5d5){logger[_0x971b('0x11')](_0x971b('0x15'),_0x3ff5d5[_0x971b('0x12')],_0x3e5ff4);_0x4b9239(_0x454ffe[_0x971b('0x11')](0x1f4,_0x3ff5d5['message']));});});};exports[_0x971b('0x1e')]=function(_0x4e3619){var _0x4b1eb3=this;return new Promise(function(_0x5c1a94,_0x38d706){return db[_0x971b('0x16')][_0x971b('0x1f')]({'raw':_0x4e3619['options']?_0x4e3619[_0x971b('0x17')][_0x971b('0x20')]===undefined?!![]:![]:!![],'where':_0x4e3619[_0x971b('0x17')]?_0x4e3619[_0x971b('0x17')]['where']||null:null,'attributes':_0x4e3619[_0x971b('0x17')]?_0x4e3619[_0x971b('0x17')][_0x971b('0x19')]||null:null,'include':_0x4e3619[_0x971b('0x17')]?_0x4e3619[_0x971b('0x17')]['include']?_['map'](_0x4e3619[_0x971b('0x17')][_0x971b('0x1b')],function(_0x231bc6){return{'model':db[_0x231bc6[_0x971b('0x1d')]],'as':_0x231bc6['as'],'attributes':_0x231bc6[_0x971b('0x19')],'include':_0x231bc6[_0x971b('0x1b')]?_[_0x971b('0x1c')](_0x231bc6[_0x971b('0x1b')],function(_0x45dde9){return{'model':db[_0x45dde9[_0x971b('0x1d')]],'as':_0x45dde9['as'],'attributes':_0x45dde9['attributes'],'include':_0x45dde9[_0x971b('0x1b')]?_[_0x971b('0x1c')](_0x45dde9[_0x971b('0x1b')],function(_0x5af44a){return{'model':db[_0x5af44a[_0x971b('0x1d')]],'as':_0x5af44a['as'],'attributes':_0x5af44a['attributes']};}):[]};}):[]};}):[]:[]})[_0x971b('0x21')](function(_0x12be4e){logger[_0x971b('0xc')](_0x971b('0x1e'),_0x4e3619);logger[_0x971b('0xe')]('ShowTrunk',_0x4e3619,JSON['stringify'](_0x12be4e));_0x5c1a94(_0x12be4e);})[_0x971b('0x14')](function(_0x504aec){logger[_0x971b('0x11')]('ShowTrunk',_0x504aec[_0x971b('0x12')],_0x4e3619);_0x38d706(_0x4b1eb3['error'](0x1f4,_0x504aec['message']));});});}; \ No newline at end of file +var _0x86ae=['Trunk','findAll','options','attributes','include','map','model','catch','find','where','then','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetTrunk'];(function(_0x46a89e,_0x3c223c){var _0x50a1e7=function(_0x1c023d){while(--_0x1c023d){_0x46a89e['push'](_0x46a89e['shift']());}};_0x50a1e7(++_0x3c223c);}(_0x86ae,0xfa));var _0xe86a=function(_0x41652c,_0x564b24){_0x41652c=_0x41652c-0x0;var _0x32628c=_0x86ae[_0x41652c];return _0x32628c;};'use strict';var _=require('lodash');var util=require(_0xe86a('0x0'));var moment=require(_0xe86a('0x1'));var BPromise=require(_0xe86a('0x2'));var rs=require(_0xe86a('0x3'));var fs=require('fs');var Redis=require(_0xe86a('0x4'));var db=require(_0xe86a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe86a('0x6'));var config=require(_0xe86a('0x7'));var jayson=require(_0xe86a('0x8'));var client=jayson[_0xe86a('0x9')][_0xe86a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39fe5a,_0x5c2dc0,_0x1003ba){return new BPromise(function(_0x4ef640,_0x380d3d){return client[_0xe86a('0xb')](_0x39fe5a,_0x1003ba)['then'](function(_0xfd542){logger[_0xe86a('0xc')](_0xe86a('0xd'),_0x5c2dc0,_0xe86a('0xe'));logger[_0xe86a('0xf')](_0xe86a('0x10'),_0x5c2dc0,_0xe86a('0xe'),JSON[_0xe86a('0x11')](_0xfd542));if(_0xfd542['error']){if(_0xfd542[_0xe86a('0x12')][_0xe86a('0x13')]===0x1f4){logger[_0xe86a('0x12')](_0xe86a('0xd'),_0x5c2dc0,_0xfd542['error']['message']);return _0x380d3d(_0xfd542[_0xe86a('0x12')][_0xe86a('0x14')]);}logger[_0xe86a('0x12')](_0xe86a('0xd'),_0x5c2dc0,_0xfd542[_0xe86a('0x12')][_0xe86a('0x14')]);return _0x4ef640(_0xfd542[_0xe86a('0x12')][_0xe86a('0x14')]);}else{logger[_0xe86a('0xc')](_0xe86a('0xd'),_0x5c2dc0,_0xe86a('0xe'));_0x4ef640(_0xfd542['result'][_0xe86a('0x14')]);}})['catch'](function(_0x217a47){logger[_0xe86a('0x12')](_0xe86a('0xd'),_0x5c2dc0,_0x217a47);_0x380d3d(_0x217a47);});});}exports[_0xe86a('0x15')]=function(_0x5a315c){var _0x48d4b3=this;return new Promise(function(_0x4dfe22,_0x48a135){return db[_0xe86a('0x16')][_0xe86a('0x17')]({'raw':_0x5a315c['options']?_0x5a315c[_0xe86a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a315c[_0xe86a('0x18')]?_0x5a315c[_0xe86a('0x18')]['where']||null:null,'attributes':_0x5a315c['options']?_0x5a315c[_0xe86a('0x18')][_0xe86a('0x19')]||null:null,'limit':_0x5a315c['options']?_0x5a315c['options']['limit']||null:null,'include':_0x5a315c[_0xe86a('0x18')]?_0x5a315c[_0xe86a('0x18')][_0xe86a('0x1a')]?_[_0xe86a('0x1b')](_0x5a315c[_0xe86a('0x18')][_0xe86a('0x1a')],function(_0x440c48){return{'model':db[_0x440c48['model']],'as':_0x440c48['as'],'attributes':_0x440c48[_0xe86a('0x19')],'include':_0x440c48[_0xe86a('0x1a')]?_[_0xe86a('0x1b')](_0x440c48[_0xe86a('0x1a')],function(_0x2d6bfb){return{'model':db[_0x2d6bfb[_0xe86a('0x1c')]],'as':_0x2d6bfb['as'],'attributes':_0x2d6bfb[_0xe86a('0x19')],'include':_0x2d6bfb[_0xe86a('0x1a')]?_['map'](_0x2d6bfb[_0xe86a('0x1a')],function(_0x26df26){return{'model':db[_0x26df26[_0xe86a('0x1c')]],'as':_0x26df26['as'],'attributes':_0x26df26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5143c4){logger['info'](_0xe86a('0x15'),_0x5a315c);logger['debug'](_0xe86a('0x15'),_0x5a315c,JSON['stringify'](_0x5143c4));_0x4dfe22(_0x5143c4);})[_0xe86a('0x1d')](function(_0x4a937c){logger['error']('GetTrunk',_0x4a937c[_0xe86a('0x14')],_0x5a315c);_0x48a135(_0x48d4b3['error'](0x1f4,_0x4a937c['message']));});});};exports['ShowTrunk']=function(_0x5a541b){var _0xa9f10c=this;return new Promise(function(_0x11bdc3,_0x5d82b6){return db['Trunk'][_0xe86a('0x1e')]({'raw':_0x5a541b['options']?_0x5a541b[_0xe86a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5a541b[_0xe86a('0x18')]?_0x5a541b[_0xe86a('0x18')][_0xe86a('0x1f')]||null:null,'attributes':_0x5a541b[_0xe86a('0x18')]?_0x5a541b[_0xe86a('0x18')][_0xe86a('0x19')]||null:null,'include':_0x5a541b[_0xe86a('0x18')]?_0x5a541b[_0xe86a('0x18')]['include']?_[_0xe86a('0x1b')](_0x5a541b[_0xe86a('0x18')][_0xe86a('0x1a')],function(_0x2d19e7){return{'model':db[_0x2d19e7[_0xe86a('0x1c')]],'as':_0x2d19e7['as'],'attributes':_0x2d19e7[_0xe86a('0x19')],'include':_0x2d19e7[_0xe86a('0x1a')]?_[_0xe86a('0x1b')](_0x2d19e7[_0xe86a('0x1a')],function(_0x3e8b38){return{'model':db[_0x3e8b38['model']],'as':_0x3e8b38['as'],'attributes':_0x3e8b38[_0xe86a('0x19')],'include':_0x3e8b38[_0xe86a('0x1a')]?_[_0xe86a('0x1b')](_0x3e8b38[_0xe86a('0x1a')],function(_0x4f12db){return{'model':db[_0x4f12db[_0xe86a('0x1c')]],'as':_0x4f12db['as'],'attributes':_0x4f12db['attributes']};}):[]};}):[]};}):[]:[]})[_0xe86a('0x20')](function(_0x54a37a){logger['info'](_0xe86a('0x21'),_0x5a541b);logger['debug'](_0xe86a('0x21'),_0x5a541b,JSON[_0xe86a('0x11')](_0x54a37a));_0x11bdc3(_0x54a37a);})[_0xe86a('0x1d')](function(_0x216753){logger['error'](_0xe86a('0x21'),_0x216753['message'],_0x5a541b);_0x5d82b6(_0xa9f10c[_0xe86a('0x12')](0x1f4,_0x216753['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index df63a14..1e0016d 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 _0x6252=['../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/contacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/square_projects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','diskStorage','join','root','server/files/images/','format','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','logout','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','/:id/password','changePassword','removeQueues','delete','removeTeams','destroy','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x44c8cb,_0x2e28c7){var _0x3bf406=function(_0x2dbe74){while(--_0x2dbe74){_0x44c8cb['push'](_0x44c8cb['shift']());}};_0x3bf406(++_0x2e28c7);}(_0x6252,0x6f));var _0x2625=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0x6252[_0x59d89e];return _0x554e93;};'use strict';var multer=require(_0x2625('0x0'));var util=require(_0x2625('0x1'));var path=require(_0x2625('0x2'));var timeout=require(_0x2625('0x3'));var express=require(_0x2625('0x4'));var router=express[_0x2625('0x5')]();var fs_extra=require(_0x2625('0x6'));var auth=require(_0x2625('0x7'));var interaction=require(_0x2625('0x8'));var config=require(_0x2625('0x9'));var controller=require(_0x2625('0xa'));router[_0x2625('0xb')]('/',auth['isAuthenticated'](),controller[_0x2625('0xc')]);router[_0x2625('0xb')](_0x2625('0xd'),auth[_0x2625('0xe')](),controller[_0x2625('0xf')]);router[_0x2625('0xb')](_0x2625('0x10'),auth[_0x2625('0xe')](),controller['whoami']);router[_0x2625('0xb')](_0x2625('0x11'),auth[_0x2625('0xe')](),controller[_0x2625('0x12')]);router[_0x2625('0xb')](_0x2625('0x13'),auth['isAuthenticated'](),controller['show']);router[_0x2625('0xb')](_0x2625('0x14'),controller[_0x2625('0x15')]);router[_0x2625('0xb')]('/:id/open_tabs',auth[_0x2625('0xe')](),controller['getOpenTabs']);router[_0x2625('0xb')](_0x2625('0x16'),auth['isAuthenticated'](),controller['getContacts']);router[_0x2625('0xb')](_0x2625('0x17'),auth[_0x2625('0xe')](),controller[_0x2625('0x18')]);router['get']('/:id/queues_rt',auth[_0x2625('0xe')](),controller[_0x2625('0x19')]);router[_0x2625('0xb')](_0x2625('0x1a'),auth['isAuthenticated'](),controller['getGroups']);router[_0x2625('0xb')]('/:id/recordings',auth[_0x2625('0xe')](),controller[_0x2625('0x1b')]);router[_0x2625('0xb')](_0x2625('0x1c'),auth[_0x2625('0xe')](),controller[_0x2625('0x1d')]);router[_0x2625('0xb')](_0x2625('0x1e'),auth['isAuthenticated'](),controller[_0x2625('0x1f')]);router[_0x2625('0xb')](_0x2625('0x20'),auth[_0x2625('0xe')](),controller[_0x2625('0x21')]);router[_0x2625('0xb')](_0x2625('0x22'),auth[_0x2625('0xe')](),controller[_0x2625('0x23')]);router[_0x2625('0xb')](_0x2625('0x24'),auth[_0x2625('0xe')](),controller['getSmsInteractions']);router[_0x2625('0xb')](_0x2625('0x25'),auth[_0x2625('0xe')](),controller[_0x2625('0x26')]);router[_0x2625('0xb')](_0x2625('0x27'),auth[_0x2625('0xe')](),controller['getWhatsappInteractions']);router[_0x2625('0xb')](_0x2625('0x28'),auth['isAuthenticated'](),controller[_0x2625('0x29')]);router[_0x2625('0xb')](_0x2625('0x2a'),auth['isAuthenticated'](),controller[_0x2625('0x2b')]);router[_0x2625('0xb')](_0x2625('0x2c'),auth[_0x2625('0xe')](),controller[_0x2625('0x2d')]);router[_0x2625('0xb')]('/:id/prefixes',auth['isAuthenticated'](),controller[_0x2625('0x2e')]);router[_0x2625('0xb')](_0x2625('0x2f'),auth[_0x2625('0xe')](),controller['getFaxAccounts']);router[_0x2625('0xb')](_0x2625('0x30'),auth[_0x2625('0xe')](),controller['getMailAccounts']);router[_0x2625('0xb')](_0x2625('0x31'),auth[_0x2625('0xe')](),controller[_0x2625('0x32')]);router[_0x2625('0xb')](_0x2625('0x33'),auth[_0x2625('0xe')](),controller[_0x2625('0x34')]);router[_0x2625('0xb')]('/:id/chat_websites',auth[_0x2625('0xe')](),controller[_0x2625('0x35')]);router['get'](_0x2625('0x36'),auth[_0x2625('0xe')](),controller[_0x2625('0x37')]);router[_0x2625('0xb')](_0x2625('0x38'),auth[_0x2625('0xe')](),controller['getSquareProjects']);router[_0x2625('0xb')](_0x2625('0x39'),auth['isAuthenticated'](),controller[_0x2625('0x3a')]);router[_0x2625('0xb')](_0x2625('0x3b'),auth['isAuthenticated'](),controller[_0x2625('0x3c')]);router[_0x2625('0x3d')](_0x2625('0x16'),auth[_0x2625('0xe')](),controller[_0x2625('0x3e')]);router['post']('/',auth[_0x2625('0xe')](),controller[_0x2625('0x3f')]);router[_0x2625('0x3d')]('/create_many',auth[_0x2625('0xe')](),controller[_0x2625('0x40')]);router[_0x2625('0x3d')](_0x2625('0x17'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x2625('0x41')]({'destination':function(_0x467da2,_0x396c76,_0x4e2dcd){_0x4e2dcd(null,path[_0x2625('0x42')](config[_0x2625('0x43')],_0x2625('0x44')));},'filename':function(_0x571e12,_0x205fce,_0x5cc75d){_0x5cc75d(null,util[_0x2625('0x45')]('%s-%s',Date[_0x2625('0x46')](),_0x205fce[_0x2625('0x47')]));}})});router['post'](_0x2625('0x14'),upload['single'](_0x2625('0x48')),controller[_0x2625('0x49')]);router['post'](_0x2625('0x4a'),auth[_0x2625('0xe')](),controller[_0x2625('0x4b')]);router[_0x2625('0x3d')](_0x2625('0x4c'),auth[_0x2625('0xe')](),controller[_0x2625('0x4d')]);router[_0x2625('0x3d')]('/:id/pause',auth[_0x2625('0xe')](),controller[_0x2625('0x4e')]);router[_0x2625('0x3d')]('/:id/unpause',auth[_0x2625('0xe')](),controller[_0x2625('0x4f')]);router[_0x2625('0x3d')](_0x2625('0x28'),auth['isAuthenticated'](),controller[_0x2625('0x50')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x2625('0x51')]);router[_0x2625('0x3d')](_0x2625('0x52'),auth[_0x2625('0xe')](),controller['addMailInteractions']);router[_0x2625('0x3d')](_0x2625('0x53'),auth[_0x2625('0xe')](),controller['addFaxInteractions']);router[_0x2625('0x3d')]('/:id/sms_interactions',auth[_0x2625('0xe')](),controller[_0x2625('0x54')]);router['post']('/:id/openchannel_interactions',auth[_0x2625('0xe')](),controller[_0x2625('0x55')]);router[_0x2625('0x3d')](_0x2625('0x56'),auth[_0x2625('0xe')](),controller[_0x2625('0x57')]);router[_0x2625('0x3d')](_0x2625('0x2f'),auth[_0x2625('0xe')](),controller[_0x2625('0x58')]);router[_0x2625('0x3d')](_0x2625('0x30'),auth[_0x2625('0xe')](),controller[_0x2625('0x59')]);router[_0x2625('0x3d')](_0x2625('0x31'),auth[_0x2625('0xe')](),controller[_0x2625('0x5a')]);router[_0x2625('0x3d')]('/:id/sms_accounts',auth[_0x2625('0xe')](),controller[_0x2625('0x5b')]);router[_0x2625('0x3d')](_0x2625('0x5c'),auth[_0x2625('0xe')](),controller[_0x2625('0x5d')]);router[_0x2625('0x3d')]('/:id/whatsapp_accounts',auth[_0x2625('0xe')](),controller[_0x2625('0x5e')]);router[_0x2625('0x3d')](_0x2625('0x38'),auth[_0x2625('0xe')](),controller['addSquareProjects']);router[_0x2625('0x3d')](_0x2625('0x3b'),auth[_0x2625('0xe')](),controller[_0x2625('0x5f')]);router[_0x2625('0x60')](_0x2625('0x13'),auth[_0x2625('0xe')](),controller[_0x2625('0x61')]);router['put'](_0x2625('0x62'),auth[_0x2625('0xe')](),controller[_0x2625('0x63')]);router['delete'](_0x2625('0x17'),auth[_0x2625('0xe')](),controller[_0x2625('0x64')]);router[_0x2625('0x65')]('/:id/teams',auth[_0x2625('0xe')](),controller[_0x2625('0x66')]);router[_0x2625('0x65')](_0x2625('0x13'),auth[_0x2625('0xe')](),controller[_0x2625('0x67')]);router['delete']('/:id/chat_interactions',auth[_0x2625('0xe')](),controller['removeChatInteractions']);router[_0x2625('0x65')](_0x2625('0x52'),auth[_0x2625('0xe')](),controller[_0x2625('0x68')]);router[_0x2625('0x65')](_0x2625('0x53'),auth[_0x2625('0xe')](),controller[_0x2625('0x69')]);router[_0x2625('0x65')]('/:id/sms_interactions',auth[_0x2625('0xe')](),controller['removeSmsInteractions']);router['delete'](_0x2625('0x6a'),auth[_0x2625('0xe')](),controller[_0x2625('0x6b')]);router['delete'](_0x2625('0x56'),auth[_0x2625('0xe')](),controller[_0x2625('0x6c')]);router['delete'](_0x2625('0x2f'),auth[_0x2625('0xe')](),controller[_0x2625('0x6d')]);router[_0x2625('0x65')](_0x2625('0x30'),auth[_0x2625('0xe')](),controller[_0x2625('0x6e')]);router[_0x2625('0x65')](_0x2625('0x31'),auth[_0x2625('0xe')](),controller[_0x2625('0x6f')]);router[_0x2625('0x65')](_0x2625('0x33'),auth[_0x2625('0xe')](),controller[_0x2625('0x70')]);router[_0x2625('0x65')]('/:id/chat_websites',auth[_0x2625('0xe')](),controller[_0x2625('0x71')]);router['delete']('/:id/whatsapp_accounts',auth[_0x2625('0xe')](),controller[_0x2625('0x72')]);router[_0x2625('0x65')](_0x2625('0x38'),auth[_0x2625('0xe')](),controller[_0x2625('0x73')]);router[_0x2625('0x65')]('/:id/api_key',auth[_0x2625('0xe')](),controller[_0x2625('0x74')]);module[_0x2625('0x75')]=router; \ No newline at end of file +var _0x2dbb=['/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','post','addContacts','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','/:id/api_key','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams'];(function(_0xcbc9f6,_0x1e24bd){var _0x3c7ef6=function(_0x24c50e){while(--_0x24c50e){_0xcbc9f6['push'](_0xcbc9f6['shift']());}};_0x3c7ef6(++_0x1e24bd);}(_0x2dbb,0xd1));var _0xb2db=function(_0x4923c0,_0x45327b){_0x4923c0=_0x4923c0-0x0;var _0x172299=_0x2dbb[_0x4923c0];return _0x172299;};'use strict';var multer=require(_0xb2db('0x0'));var util=require(_0xb2db('0x1'));var path=require(_0xb2db('0x2'));var timeout=require(_0xb2db('0x3'));var express=require('express');var router=express[_0xb2db('0x4')]();var fs_extra=require(_0xb2db('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb2db('0x6'));var config=require('../../config/environment');var controller=require('./user.controller');router['get']('/',auth[_0xb2db('0x7')](),controller[_0xb2db('0x8')]);router[_0xb2db('0x9')]('/describe',auth[_0xb2db('0x7')](),controller['describe']);router['get'](_0xb2db('0xa'),auth['isAuthenticated'](),controller[_0xb2db('0xb')]);router[_0xb2db('0x9')](_0xb2db('0xc'),auth[_0xb2db('0x7')](),controller[_0xb2db('0xd')]);router[_0xb2db('0x9')](_0xb2db('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xb2db('0x9')](_0xb2db('0xf'),controller[_0xb2db('0x10')]);router[_0xb2db('0x9')](_0xb2db('0x11'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x12')]);router[_0xb2db('0x9')](_0xb2db('0x13'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x14')]);router['get']('/:id/queues',auth['isAuthenticated'](),controller[_0xb2db('0x15')]);router[_0xb2db('0x9')](_0xb2db('0x16'),auth['isAuthenticated'](),controller[_0xb2db('0x17')]);router[_0xb2db('0x9')](_0xb2db('0x18'),auth[_0xb2db('0x7')](),controller['getGroups']);router['get'](_0xb2db('0x19'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x1a')]);router['get'](_0xb2db('0x1b'),auth[_0xb2db('0x7')](),controller['getScreenRecordings']);router[_0xb2db('0x9')](_0xb2db('0x1c'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x1d')]);router[_0xb2db('0x9')](_0xb2db('0x1e'),auth[_0xb2db('0x7')](),controller['getOpenchannelInteractions']);router[_0xb2db('0x9')](_0xb2db('0x1f'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x20')]);router['get']('/:id/sms/interactions',auth[_0xb2db('0x7')](),controller[_0xb2db('0x21')]);router[_0xb2db('0x9')](_0xb2db('0x22'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x23')]);router[_0xb2db('0x9')](_0xb2db('0x24'),auth['isAuthenticated'](),controller['getWhatsappInteractions']);router[_0xb2db('0x9')](_0xb2db('0x25'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x26')]);router[_0xb2db('0x9')](_0xb2db('0x27'),auth['isAuthenticated'](),controller['getLists']);router['get'](_0xb2db('0x28'),auth['isAuthenticated'](),controller[_0xb2db('0x29')]);router['get'](_0xb2db('0x2a'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x2b')]);router[_0xb2db('0x9')](_0xb2db('0x2c'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x2d')]);router[_0xb2db('0x9')](_0xb2db('0x2e'),auth[_0xb2db('0x7')](),controller['getMailAccounts']);router[_0xb2db('0x9')](_0xb2db('0x2f'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x30')]);router['get'](_0xb2db('0x31'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x32')]);router['get'](_0xb2db('0x33'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x34')]);router['get']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xb2db('0x35')]);router[_0xb2db('0x9')]('/:id/square_projects',auth[_0xb2db('0x7')](),controller[_0xb2db('0x36')]);router[_0xb2db('0x9')](_0xb2db('0x37'),auth['isAuthenticated'](),controller[_0xb2db('0x38')]);router[_0xb2db('0x9')]('/:id/api_key',auth[_0xb2db('0x7')](),controller['getApiKey']);router[_0xb2db('0x39')](_0xb2db('0x13'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x3a')]);router[_0xb2db('0x39')]('/',auth[_0xb2db('0x7')](),controller[_0xb2db('0x3b')]);router[_0xb2db('0x39')](_0xb2db('0x3c'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x3d')]);router[_0xb2db('0x39')](_0xb2db('0x3e'),auth['isAuthenticated'](),controller[_0xb2db('0x3f')]);var upload=multer({'storage':multer[_0xb2db('0x40')]({'destination':function(_0x297d84,_0x4f46ca,_0x487c82){_0x487c82(null,path[_0xb2db('0x41')](config[_0xb2db('0x42')],_0xb2db('0x43')));},'filename':function(_0x163439,_0x4a67ab,_0x3e486f){_0x3e486f(null,util[_0xb2db('0x44')]('%s-%s',Date[_0xb2db('0x45')](),_0x4a67ab[_0xb2db('0x46')]));}})});router[_0xb2db('0x39')](_0xb2db('0xf'),upload[_0xb2db('0x47')](_0xb2db('0x48')),controller[_0xb2db('0x49')]);router[_0xb2db('0x39')](_0xb2db('0x4a'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x4b')]);router[_0xb2db('0x39')](_0xb2db('0x4c'),auth['isAuthenticated'](),controller[_0xb2db('0x4d')]);router['post']('/:id/pause',auth[_0xb2db('0x7')](),controller['pause']);router[_0xb2db('0x39')](_0xb2db('0x4e'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x4f')]);router[_0xb2db('0x39')]('/:id/teams',auth[_0xb2db('0x7')](),controller[_0xb2db('0x50')]);router[_0xb2db('0x39')](_0xb2db('0x51'),auth['isAuthenticated'](),controller[_0xb2db('0x52')]);router['post'](_0xb2db('0x53'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x54')]);router[_0xb2db('0x39')](_0xb2db('0x55'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x56')]);router[_0xb2db('0x39')](_0xb2db('0x57'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x58')]);router[_0xb2db('0x39')](_0xb2db('0x59'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x5a')]);router[_0xb2db('0x39')]('/:id/whatsapp_interactions',auth[_0xb2db('0x7')](),controller[_0xb2db('0x5b')]);router[_0xb2db('0x39')](_0xb2db('0x2c'),auth['isAuthenticated'](),controller[_0xb2db('0x5c')]);router['post'](_0xb2db('0x2e'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x5d')]);router[_0xb2db('0x39')](_0xb2db('0x2f'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x5e')]);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0xb2db('0x5f')]);router[_0xb2db('0x39')]('/:id/chat_websites',auth['isAuthenticated'](),controller[_0xb2db('0x60')]);router[_0xb2db('0x39')](_0xb2db('0x61'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x62')]);router[_0xb2db('0x39')](_0xb2db('0x63'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x64')]);router['post'](_0xb2db('0x65'),auth['isAuthenticated'](),controller[_0xb2db('0x66')]);router['put'](_0xb2db('0xe'),auth['isAuthenticated'](),controller[_0xb2db('0x67')]);router[_0xb2db('0x68')](_0xb2db('0x69'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x6a')]);router[_0xb2db('0x6b')](_0xb2db('0x3e'),auth['isAuthenticated'](),controller[_0xb2db('0x6c')]);router[_0xb2db('0x6b')](_0xb2db('0x25'),auth[_0xb2db('0x7')](),controller['removeTeams']);router['delete'](_0xb2db('0xe'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x6d')]);router['delete']('/:id/chat_interactions',auth[_0xb2db('0x7')](),controller[_0xb2db('0x6e')]);router[_0xb2db('0x6b')](_0xb2db('0x53'),auth['isAuthenticated'](),controller[_0xb2db('0x6f')]);router['delete'](_0xb2db('0x55'),auth[_0xb2db('0x7')](),controller['removeFaxInteractions']);router[_0xb2db('0x6b')](_0xb2db('0x57'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x70')]);router[_0xb2db('0x6b')](_0xb2db('0x59'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x71')]);router[_0xb2db('0x6b')]('/:id/whatsapp_interactions',auth[_0xb2db('0x7')](),controller[_0xb2db('0x72')]);router['delete']('/:id/fax_accounts',auth[_0xb2db('0x7')](),controller[_0xb2db('0x73')]);router['delete'](_0xb2db('0x2e'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x74')]);router[_0xb2db('0x6b')](_0xb2db('0x2f'),auth['isAuthenticated'](),controller[_0xb2db('0x75')]);router[_0xb2db('0x6b')](_0xb2db('0x31'),auth['isAuthenticated'](),controller[_0xb2db('0x76')]);router[_0xb2db('0x6b')](_0xb2db('0x33'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x77')]);router[_0xb2db('0x6b')](_0xb2db('0x61'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x78')]);router['delete'](_0xb2db('0x63'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x79')]);router[_0xb2db('0x6b')](_0xb2db('0x65'),auth[_0xb2db('0x7')](),controller[_0xb2db('0x7a')]);module[_0xb2db('0x7b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 7e09842..8cea633 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 _0x446c=['udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','TEXT','showWebBar','get','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','force_avp','actpass','rtcp_mux','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','lodash','STRING','name','The\x20name\x20of\x20the\x20user','fullname','setDataValue','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','accountcode','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','peer','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB'];(function(_0x4e1ec7,_0x8bcdf1){var _0x20a016=function(_0x235c9f){while(--_0x235c9f){_0x4e1ec7['push'](_0x4e1ec7['shift']());}};_0x20a016(++_0x8bcdf1);}(_0x446c,0x156));var _0xc446=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x446c[_0x28fbe3];return _0x45db6a;};'use strict';var Sequelize=require(_0xc446('0x0'));var moment=require(_0xc446('0x1'));var util=require(_0xc446('0x2'));var _=require(_0xc446('0x3'));module['exports']={'name':{'type':Sequelize[_0xc446('0x4')],'allowNull':![],'unique':_0xc446('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xd67fc7){this['setDataValue'](_0xc446('0x5'),_0xd67fc7);this['setDataValue']('defaultuser',_0xd67fc7);},'comment':_0xc446('0x6')},'fullname':{'type':Sequelize[_0xc446('0x4')],'allowNull':![],'set':function(_0x578895){this['setDataValue'](_0xc446('0x7'),_0x578895);this[_0xc446('0x8')](_0xc446('0x9'),util[_0xc446('0xa')](_0xc446('0xb'),_0x578895,this['getDataValue'](_0xc446('0xc'))));}},'alias':{'type':Sequelize[_0xc446('0x4')]},'email':{'type':Sequelize[_0xc446('0x4')],'allowNull':![],'unique':_0xc446('0xd'),'validate':{'isEmail':!![]},'set':function(_0x5e225d){if(_0x5e225d){this[_0xc446('0x8')](_0xc446('0xd'),_0x5e225d[_0xc446('0xe')]());}}},'role':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x10'),_0xc446('0x11'),_0xc446('0x12'),_0xc446('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xc446('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc446('0x4')],'defaultValue':_0xc446('0x14')},'internal':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':![],'unique':_0xc446('0xc'),'set':function(_0x72faac){this[_0xc446('0x8')](_0xc446('0xc'),_0x72faac);this[_0xc446('0x8')](_0xc446('0x16'),_0x72faac);this[_0xc446('0x8')]('callerid',util[_0xc446('0xa')](_0xc446('0xb'),this[_0xc446('0x17')](_0xc446('0x7')),_0x72faac));}},'salt':{'type':Sequelize[_0xc446('0x4')]},'phone':{'type':Sequelize[_0xc446('0x4')]},'mobile':{'type':Sequelize[_0xc446('0x4')]},'address':{'type':Sequelize[_0xc446('0x4')]},'zipcode':{'type':Sequelize[_0xc446('0x4')]},'userpic':{'type':Sequelize[_0xc446('0x4')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc446('0x4')]},'online':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc446('0x4')],'defaultValue':_0xc446('0x19')},'lastPauseAt':{'type':Sequelize[_0xc446('0x1a')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc446('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc446('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc446('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'description':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![],'defaultValue':_0xc446('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0xc446('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xc446('0x11'),_0xc446('0x1c')),'allowNull':!![],'defaultValue':_0xc446('0x1d')},'context':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x1e'),_0xc446('0x1f'),_0xc446('0x20'),_0xc446('0x21'),_0xc446('0x22'),_0xc446('0x23'),_0xc446('0x24'),_0xc446('0x25')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![],'defaultValue':_0xc446('0x26'),'set':function(_0x26c4b0){this[_0xc446('0x8')](_0xc446('0x27'),_0x26c4b0?_0x26c4b0[_0xc446('0x28')](','):null);},'get':function(){return this['getDataValue'](_0xc446('0x27'))?this[_0xc446('0x17')](_0xc446('0x27'))[_0xc446('0x29')](','):null;},'comment':_0xc446('0x2a')},'dtmfmode':{'type':Sequelize['ENUM'](_0xc446('0x2b'),_0xc446('0x2c'),_0xc446('0x2d'),_0xc446('0x2e'),_0xc446('0x2f')),'allowNull':!![],'defaultValue':_0xc446('0x2b')},'directmedia':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no','nonat','update',_0xc446('0x31')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![],'defaultValue':_0xc446('0x32'),'set':function(_0x4d10a0){this['setDataValue']('nat',_0x4d10a0?_0x4d10a0[_0xc446('0x28')](','):null);},'get':function(){return this['getDataValue'](_0xc446('0x33'))?this[_0xc446('0x17')]('nat')[_0xc446('0x29')](','):null;},'comment':_0xc446('0x34')},'callgroup':{'type':Sequelize[_0xc446('0x4')]},'namedcallgroup':{'type':Sequelize[_0xc446('0x4')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc446('0x4')]},'language':{'type':Sequelize[_0xc446('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xc446('0x4')],'allowNull':![],'defaultValue':_0xc446('0x35')},'allow':{'type':Sequelize[_0xc446('0x4')],'allowNull':![],'defaultValue':_0xc446('0x36'),'set':function(_0xf3400e){this['setDataValue'](_0xc446('0x37'),_0xf3400e?_0xf3400e[_0xc446('0x28')](';'):_0xc446('0x36'));},'get':function(){return this[_0xc446('0x17')](_0xc446('0x37'))?this['getDataValue'](_0xc446('0x37'))[_0xc446('0x29')](';'):null;},'comment':_0xc446('0x38')},'autoframing':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3bad65){this['setDataValue'](_0xc446('0x39'),_0x3bad65?_0x3bad65[_0xc446('0x28')](','):null);},'get':function(){return this['getDataValue'](_0xc446('0x39'))?this[_0xc446('0x17')](_0xc446('0x39'))[_0xc446('0x29')](','):null;},'comment':_0xc446('0x3a')},'trustrpid':{'type':Sequelize[_0xc446('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc446('0xf')]('yes','no',_0xc446('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![],'defaultValue':_0xc446('0x3c')},'amaflags':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![],'defaultValue':_0xc446('0x30')},'busylevel':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc446('0xf')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc446('0x30'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc446('0xf')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no',_0xc446('0x3d')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x3e'),'refuse',_0xc446('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xc446('0x40'),'uas'),'allowNull':!![],'defaultValue':_0xc446('0x41')},'t38pt_usertpsource':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xc446('0x30'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc446('0xf')]('yes','no',_0xc446('0x42'),_0xc446('0x43')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x44'),_0xc446('0x45'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc446('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc446('0xf')](_0xc446('0x30'),'no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xc446('0x1a')]},'passwordResetAt':{'type':Sequelize[_0xc446('0x1a')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc446('0x46')]},'showWebBar':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0,'set':function(_0x41eae9){this['setDataValue'](_0xc446('0x47'),_0x41eae9);var _0x5e0872=this[_0xc446('0x48')]({'plain':!![]});switch(_0x41eae9){case 0x0:case 0x1:var _0xdc08a9=_0x5e0872[_0xc446('0x27')]?_['isArray'](_0x5e0872[_0xc446('0x27')])?_0x5e0872['transport'][_0xc446('0x28')]():_0x5e0872[_0xc446('0x27')]:'udp';if(_0xdc08a9===_0xc446('0x49')){_0xdc08a9=_0xc446('0x26');}this[_0xc446('0x8')](_0xc446('0x27'),_0xdc08a9);this['setDataValue'](_0xc446('0x4a'),'no');this[_0xc446('0x8')](_0xc446('0x4b'),null);this[_0xc446('0x8')]('force_avp',null);this['setDataValue'](_0xc446('0x4c'),null);this[_0xc446('0x8')](_0xc446('0x4d'),null);this[_0xc446('0x8')](_0xc446('0x4e'),null);this[_0xc446('0x8')](_0xc446('0x4f'),null);this['setDataValue'](_0xc446('0x50'),null);this[_0xc446('0x8')](_0xc446('0x51'),null);this['setDataValue']('rtcp_mux','no');break;case 0x2:this['setDataValue']('transport','wss');this[_0xc446('0x8')]('encryption',_0xc446('0x30'));this[_0xc446('0x8')](_0xc446('0x4b'),_0xc446('0x30'));this[_0xc446('0x8')](_0xc446('0x52'),_0xc446('0x30'));this[_0xc446('0x8')](_0xc446('0x4c'),_0xc446('0x30'));this['setDataValue'](_0xc446('0x4d'),_0xc446('0x30'));this[_0xc446('0x8')](_0xc446('0x4e'),'no');this['setDataValue'](_0xc446('0x4f'),_0xc446('0x53'));this[_0xc446('0x8')](_0xc446('0x50'),_0x5e0872['dtlscertfile']||'/etc/pki/tls/certs/motion.crt');this[_0xc446('0x8')](_0xc446('0x51'),_0x5e0872[_0xc446('0x51')]||'/etc/pki/tls/private/motion.key');this['setDataValue'](_0xc446('0x54'),_0xc446('0x30'));break;default:}}},'permissions':{'type':Sequelize[_0xc446('0x46')],'set':function(_0x4d0754){this[_0xc446('0x8')]('permissions',_0x4d0754?_0x4d0754[_0xc446('0x28')](','):[]);},'get':function(){return this[_0xc446('0x17')](_0xc446('0x55'))?_[_0xc446('0x56')](this[_0xc446('0x17')](_0xc446('0x55'))[_0xc446('0x29')](','),function(_0x540984){return parseInt(_0x540984,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc446('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc446('0x4')]},'phoneBarBusyNumber':{'type':Sequelize[_0xc446('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc446('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc446('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc446('0xf')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc446('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc446('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc446('0x57')],'get':function(){return this[_0xc446('0x17')](_0xc446('0x58'))?this[_0xc446('0x17')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc446('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![],'set':function(_0x22f890){if(typeof _0x22f890==='string'){var _0x5ae516=_0x22f890==='1'?!![]:_0x22f890==='0'?![]:_0x22f890===_0xc446('0x59')?!![]:_0x22f890===_0xc446('0x5a')?![]:![];this[_0xc446('0x8')](_0xc446('0x5b'),_0x5ae516);}else{this['setDataValue'](_0xc446('0x5b'),_0x22f890);}}},'blocked':{'type':Sequelize[_0xc446('0x18')],'defaultValue':![],'set':function(_0x3c7850){this[_0xc446('0x8')](_0xc446('0x5c'),_0x3c7850);if(_0x3c7850===!![]){this[_0xc446('0x8')](_0xc446('0x5d'),moment());this['setDataValue'](_0xc446('0x5e'),0x0);}else{this[_0xc446('0x8')](_0xc446('0x5d'),null);}}},'blockedAt':{'type':Sequelize[_0xc446('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc446('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc446('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc446('0x18')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc446('0x18')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0c42=['update,nonat','TEXT','showWebBar','get','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlsprivatekey','rtcp_mux','dtlssetup','actpass','dtlscertfile','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','setDataValue','name','defaultuser','STRING','callerid','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','dynamic','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','yes','nonat','update','outgoing','force_rport,comedia','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\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','active','passive'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x0c42,0x191));var _0x20c4=function(_0x495ffa,_0x529aa8){_0x495ffa=_0x495ffa-0x0;var _0x6a561=_0x0c42[_0x495ffa];return _0x6a561;};'use strict';var Sequelize=require(_0x20c4('0x0'));var moment=require(_0x20c4('0x1'));var util=require(_0x20c4('0x2'));var _=require(_0x20c4('0x3'));module[_0x20c4('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x3a3e5b){this[_0x20c4('0x5')](_0x20c4('0x6'),_0x3a3e5b);this[_0x20c4('0x5')](_0x20c4('0x7'),_0x3a3e5b);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x20c4('0x8')],'allowNull':![],'set':function(_0x4c4f94){this[_0x20c4('0x5')]('fullname',_0x4c4f94);this[_0x20c4('0x5')](_0x20c4('0x9'),util[_0x20c4('0xa')]('\x22%s\x22\x20<%s>',_0x4c4f94,this[_0x20c4('0xb')](_0x20c4('0xc'))));}},'alias':{'type':Sequelize[_0x20c4('0x8')]},'email':{'type':Sequelize[_0x20c4('0x8')],'allowNull':![],'unique':_0x20c4('0xd'),'validate':{'isEmail':!![]},'set':function(_0x312ee0){if(_0x312ee0){this[_0x20c4('0x5')](_0x20c4('0xd'),_0x312ee0[_0x20c4('0xe')]());}}},'role':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x10'),_0x20c4('0x11'),_0x20c4('0x12'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x20c4('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x20c4('0x13')},'internal':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1e1327){this['setDataValue'](_0x20c4('0xc'),_0x1e1327);this[_0x20c4('0x5')](_0x20c4('0x15'),_0x1e1327);this['setDataValue'](_0x20c4('0x9'),util[_0x20c4('0xa')](_0x20c4('0x16'),this[_0x20c4('0xb')](_0x20c4('0x17')),_0x1e1327));}},'salt':{'type':Sequelize[_0x20c4('0x8')]},'phone':{'type':Sequelize[_0x20c4('0x8')]},'mobile':{'type':Sequelize[_0x20c4('0x8')]},'address':{'type':Sequelize[_0x20c4('0x8')]},'zipcode':{'type':Sequelize[_0x20c4('0x8')]},'userpic':{'type':Sequelize[_0x20c4('0x8')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x20c4('0x8')],'defaultValue':_0x20c4('0x19')},'lastPauseAt':{'type':Sequelize[_0x20c4('0x1a')]},'chatCapacity':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x20c4('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x20c4('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![],'defaultValue':_0x20c4('0x1b')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x20c4('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x20c4('0xf')]('friend',_0x20c4('0x11'),'peer'),'allowNull':!![],'defaultValue':_0x20c4('0x1c')},'context':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![],'defaultValue':_0x20c4('0x1d')},'callingpres':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x1e'),_0x20c4('0x1f'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x20c4('0x20'),_0x20c4('0x21'),_0x20c4('0x22'),_0x20c4('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'udp','set':function(_0x536565){this['setDataValue'](_0x20c4('0x24'),_0x536565?_0x536565['join'](','):null);},'get':function(){return this[_0x20c4('0xb')](_0x20c4('0x24'))?this[_0x20c4('0xb')]('transport')[_0x20c4('0x25')](','):null;},'comment':_0x20c4('0x26')},'dtmfmode':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x27'),_0x20c4('0x28'),'shortinfo','inband','auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no',_0x20c4('0x2a'),_0x20c4('0x2b'),_0x20c4('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x20c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x20c4('0x2d'),'set':function(_0x2a01a9){this[_0x20c4('0x5')](_0x20c4('0x2e'),_0x2a01a9?_0x2a01a9[_0x20c4('0x2f')](','):null);},'get':function(){return this['getDataValue'](_0x20c4('0x2e'))?this[_0x20c4('0xb')](_0x20c4('0x2e'))[_0x20c4('0x25')](','):null;},'comment':_0x20c4('0x30')},'callgroup':{'type':Sequelize[_0x20c4('0x8')]},'namedcallgroup':{'type':Sequelize[_0x20c4('0x8')]},'pickupgroup':{'type':Sequelize[_0x20c4('0x8')]},'namedpickupgroup':{'type':Sequelize[_0x20c4('0x8')]},'language':{'type':Sequelize[_0x20c4('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x20c4('0x8')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x20c4('0x31')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x20c4('0x32'),'set':function(_0x406a7c){this[_0x20c4('0x5')](_0x20c4('0x33'),_0x406a7c?_0x406a7c[_0x20c4('0x2f')](';'):_0x20c4('0x32'));},'get':function(){return this[_0x20c4('0xb')](_0x20c4('0x33'))?this[_0x20c4('0xb')]('allow')[_0x20c4('0x25')](';'):null;},'comment':_0x20c4('0x34')},'autoframing':{'type':Sequelize['ENUM'](_0x20c4('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x441b69){this['setDataValue'](_0x20c4('0x35'),_0x441b69?_0x441b69['join'](','):null);},'get':function(){return this[_0x20c4('0xb')](_0x20c4('0x35'))?this[_0x20c4('0xb')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no',_0x20c4('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x20c4('0x37')},'amaflags':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x20c4('0x29'),'no'),'allowNull':!![],'defaultValue':_0x20c4('0x29')},'busylevel':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x20c4('0xf')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no',_0x20c4('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x39'),'refuse',_0x20c4('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x3b'),'uas'),'allowNull':!![],'defaultValue':_0x20c4('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x20c4('0xf')]('yes','no'),'allowNull':!![],'defaultValue':_0x20c4('0x29')},'keepalive':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x20c4('0xf')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x20c4('0xf')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x20c4('0x29'),'no',_0x20c4('0x3d'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x3e'),_0x20c4('0x3f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x20c4('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x20c4('0xf')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x20c4('0xf')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no',_0x20c4('0x2a'),'update',_0x20c4('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x20c4('0x1a')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x20c4('0x41')]},'showWebBar':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0,'set':function(_0xf47488){this[_0x20c4('0x5')](_0x20c4('0x42'),_0xf47488);var _0x429765=this[_0x20c4('0x43')]({'plain':!![]});switch(_0xf47488){case 0x0:case 0x1:var _0x35e41d=_0x429765[_0x20c4('0x24')]?_['isArray'](_0x429765[_0x20c4('0x24')])?_0x429765[_0x20c4('0x24')][_0x20c4('0x2f')]():_0x429765[_0x20c4('0x24')]:_0x20c4('0x44');if(_0x35e41d===_0x20c4('0x45')){_0x35e41d='udp';}this[_0x20c4('0x5')](_0x20c4('0x24'),_0x35e41d);this[_0x20c4('0x5')](_0x20c4('0x46'),'no');this[_0x20c4('0x5')](_0x20c4('0x47'),null);this['setDataValue'](_0x20c4('0x48'),null);this[_0x20c4('0x5')](_0x20c4('0x49'),null);this[_0x20c4('0x5')](_0x20c4('0x4a'),null);this[_0x20c4('0x5')](_0x20c4('0x4b'),null);this[_0x20c4('0x5')]('dtlssetup',null);this[_0x20c4('0x5')]('dtlscertfile',null);this[_0x20c4('0x5')](_0x20c4('0x4c'),null);this[_0x20c4('0x5')](_0x20c4('0x4d'),'no');break;case 0x2:this[_0x20c4('0x5')]('transport',_0x20c4('0x45'));this['setDataValue']('encryption','yes');this[_0x20c4('0x5')](_0x20c4('0x47'),_0x20c4('0x29'));this['setDataValue'](_0x20c4('0x48'),_0x20c4('0x29'));this['setDataValue'](_0x20c4('0x49'),_0x20c4('0x29'));this['setDataValue']('dtlsenable',_0x20c4('0x29'));this[_0x20c4('0x5')](_0x20c4('0x4b'),'no');this[_0x20c4('0x5')](_0x20c4('0x4e'),_0x20c4('0x4f'));this[_0x20c4('0x5')](_0x20c4('0x50'),_0x429765[_0x20c4('0x50')]||'/etc/pki/tls/certs/motion.crt');this[_0x20c4('0x5')]('dtlsprivatekey',_0x429765['dtlsprivatekey']||_0x20c4('0x51'));this['setDataValue'](_0x20c4('0x4d'),_0x20c4('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x20c4('0x41')],'set':function(_0x2a6f64){this[_0x20c4('0x5')](_0x20c4('0x52'),_0x2a6f64?_0x2a6f64[_0x20c4('0x2f')](','):[]);},'get':function(){return this[_0x20c4('0xb')]('permissions')?_[_0x20c4('0x53')](this['getDataValue'](_0x20c4('0x52'))[_0x20c4('0x25')](','),function(_0x21e70e){return parseInt(_0x21e70e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x20c4('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x20c4('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x20c4('0xf')](_0x20c4('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x20c4('0x8')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x20c4('0x54')],'get':function(){return this[_0x20c4('0xb')](_0x20c4('0x55'))?this[_0x20c4('0xb')](_0x20c4('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x20c4('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x5b0c15){if(typeof _0x5b0c15==='string'){var _0x4d681c=_0x5b0c15==='1'?!![]:_0x5b0c15==='0'?![]:_0x5b0c15===_0x20c4('0x56')?!![]:_0x5b0c15===_0x20c4('0x57')?![]:![];this[_0x20c4('0x5')](_0x20c4('0x58'),_0x4d681c);}else{this[_0x20c4('0x5')]('screenrecording',_0x5b0c15);}}},'blocked':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':![],'set':function(_0x16df80){this[_0x20c4('0x5')](_0x20c4('0x59'),_0x16df80);if(_0x16df80===!![]){this[_0x20c4('0x5')](_0x20c4('0x5a'),moment());this[_0x20c4('0x5')](_0x20c4('0x5b'),0x0);}else{this['setDataValue'](_0x20c4('0x5a'),null);}}},'blockedAt':{'type':Sequelize[_0x20c4('0x1a')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x20c4('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x20c4('0x14')](0x5)[_0x20c4('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x20c4('0x18')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 0e0fd8a..d624117 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 _0x1c52=['getDataValue','Queue:save','removeTeams','getChatQueues','getSmsQueues','flatten','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$like','$overlap','$contains','$contained','$any','firstName','lastName','Contact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','getPresence','teams','resolve','inbound','queues','lower','toString','asc','desc','substring','uniqBy','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','ui.UserId\x20=\x20?','moment','bluebird','util','path','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','socket.io-emitter','./user.socket','register','redis','defaults','localhost','client','http','then','info','User,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','catch','sendStatus','status','json','offset','undefined','count','set','Content-Range','update','get','role','admin','Users','user','Agents','agent','ignore','map','value','find','name','UserProfileResource','end','stack','send','index','rawAttributes','type','key','filter','includes','salt','getOptions','User','query','includeAll','attributes','findAll','rows','openTabs','true','push','sms','dataValues','fax','mail','openchannel','whatsapp','all','show','differenceBy','keys','password','filters','intersection','model','fields','length','include','merge','options','chat','body','describe','addContacts','omit','internal','Setting','securePassword','max','isNil','min_internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','113','110','104','108','109','100','111','114','115','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','settingsEnabled','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','each','some','Telephones','isEmpty','autoAssociation','telephone','compact','changePassword','params','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','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','Queues','ids','penalty','spread','toLowerCase','QueueId','voice','VoiceQueue','format','SIP/%s','interface','UserVoiceQueueRt','upsert','removeQueues','isArray','emit','Queue:remove','destroy','addAvatar','userpic','file','filename','getAvatar','join','root','download','existsSync','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','createdAt','MailOpenTabs','MAIL','SmsOpenTabs','WhatsappOpenTabs','WHATSAPP','CmContact','sort','where','pick','getContacts','hasOwnProperty','CmList','List','Tag','Tags','color','tag','nolimit','limit','Queue','order','getVoiceQueuesRt','ChatGroup','getGroups','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','MemberReport','concat','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','whatsapppause','pauseType','manual','unpause','getTeams','Team','setDataValue','Voice','getMailQueues','Mail','Sms','getWhatsappQueues','Whatsapp','getFaxQueues','Fax','getOpenchannelQueues','Openchannel','transaction'];(function(_0x432f89,_0x469cfa){var _0x3da4b9=function(_0x47bf7e){while(--_0x47bf7e){_0x432f89['push'](_0x432f89['shift']());}};_0x3da4b9(++_0x469cfa);}(_0x1c52,0x7c));var _0x21c5=function(_0x211aa3,_0x4438f8){_0x211aa3=_0x211aa3-0x0;var _0x382803=_0x1c52[_0x211aa3];return _0x382803;};'use strict';var moment=require(_0x21c5('0x0'));var BPromise=require(_0x21c5('0x1'));var util=require(_0x21c5('0x2'));var path=require(_0x21c5('0x3'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var jayson=require('jayson/promise');var Redis=require(_0x21c5('0x4'));var authService=require(_0x21c5('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x21c5('0x6'))(_0x21c5('0x7'));var utils=require(_0x21c5('0x8'));var config=require(_0x21c5('0x9'));var licenseUtil=require('../../config/license/util');var db=require(_0x21c5('0xa'))['db'];var socket=require(_0x21c5('0xb'))(new Redis(config['redis']));require(_0x21c5('0xc'))[_0x21c5('0xd')](socket);config[_0x21c5('0xe')]=_[_0x21c5('0xf')](config['redis'],{'host':_0x21c5('0x10'),'port':0x18eb});var client=jayson[_0x21c5('0x11')][_0x21c5('0x12')]({'port':0x232a});var values;function respondWithRpcPromise(_0x532b56,_0x378ec7,_0x48ed61,_0xa6781f){return new BPromise(function(_0x247062,_0x377983){var _0x2dc212=_0xa6781f||client;return _0x2dc212['request'](_0x532b56,_0x48ed61)[_0x21c5('0x13')](function(_0x59bfc2){logger[_0x21c5('0x14')](_0x21c5('0x15'),_0x378ec7,'request\x20sent');logger[_0x21c5('0x16')]('User,\x20%s,\x20%s,\x20%s',_0x378ec7,'request\x20sent',JSON[_0x21c5('0x17')](_0x59bfc2));if(_0x59bfc2[_0x21c5('0x18')]){if(_0x59bfc2[_0x21c5('0x18')][_0x21c5('0x19')]===0x1f4){logger[_0x21c5('0x18')](_0x21c5('0x15'),_0x378ec7,_0x59bfc2[_0x21c5('0x18')]['message']);return _0x377983(_0x59bfc2[_0x21c5('0x18')]['message']);}logger['error'](_0x21c5('0x15'),_0x378ec7,_0x59bfc2['error']['message']);return _0x247062(_0x59bfc2[_0x21c5('0x18')]['message']);}else{logger[_0x21c5('0x14')]('User,\x20%s,\x20%s',_0x378ec7,_0x21c5('0x1a'));_0x247062(_0x59bfc2['result']['message']);}})[_0x21c5('0x1b')](function(_0x141ae0){logger[_0x21c5('0x18')](_0x21c5('0x15'),_0x378ec7,_0x141ae0);_0x377983(_0x141ae0);});});}function respondWithStatusCode(_0xd23b55,_0x1fb82d){_0x1fb82d=_0x1fb82d||0xcc;return function(_0x12c49d){if(_0x12c49d){return _0xd23b55[_0x21c5('0x1c')](_0x1fb82d);}return _0xd23b55[_0x21c5('0x1d')](_0x1fb82d)['end']();};}function respondWithResult(_0x8021db,_0x25463f){_0x25463f=_0x25463f||0xc8;return function(_0x377ec7){if(_0x377ec7){return _0x8021db[_0x21c5('0x1d')](_0x25463f)[_0x21c5('0x1e')](_0x377ec7);}};}function respondWithFilteredResult(_0x4bf186,_0x251c9d){return function(_0x63f5fc){if(_0x63f5fc){var _0x45e770=typeof _0x251c9d[_0x21c5('0x1f')]===_0x21c5('0x20')&&typeof _0x251c9d['limit']==='undefined';var _0x4f877c=_0x63f5fc[_0x21c5('0x21')];var _0x200bc4=_0x45e770?0x0:_0x251c9d[_0x21c5('0x1f')];var _0x2ae029=_0x45e770?_0x63f5fc[_0x21c5('0x21')]:_0x251c9d['offset']+_0x251c9d['limit'];var _0x5918df;if(_0x2ae029>=_0x4f877c){_0x2ae029=_0x4f877c;_0x5918df=0xc8;}else{_0x5918df=0xce;}_0x4bf186[_0x21c5('0x1d')](_0x5918df);return _0x4bf186[_0x21c5('0x22')](_0x21c5('0x23'),_0x200bc4+'-'+_0x2ae029+'/'+_0x4f877c)[_0x21c5('0x1e')](_0x63f5fc);}return null;};}function saveUpdates(_0x52d551){return function(_0x887b){if(_0x887b){return _0x887b[_0x21c5('0x24')](_0x52d551)[_0x21c5('0x13')](function(_0x1f3892){return _0x1f3892;});}return null;};}function removeEntity(_0x3b66f9){return function(_0x526174){if(_0x526174){return _0x526174['destroy']()[_0x21c5('0x13')](function(){var _0x29a15b=_0x526174[_0x21c5('0x25')]({'plain':!![]});if(_0x29a15b[_0x21c5('0x26')]===_0x21c5('0x27'))return;var _0x34f34e=[{'name':_0x21c5('0x28'),'value':_0x21c5('0x29'),'ignore':!![]},{'name':_0x21c5('0x2a'),'value':_0x21c5('0x2b'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x164874=_(_0x34f34e)['filter'](_0x21c5('0x2c'))[_0x21c5('0x2d')](_0x21c5('0x2e'))[_0x21c5('0x2e')]();if(_['includes'](_0x164874,_0x29a15b[_0x21c5('0x26')])){return;}var _0x4bf097=_[_0x21c5('0x2f')](_0x34f34e,['value',_0x29a15b[_0x21c5('0x26')]])[_0x21c5('0x30')];return db[_0x21c5('0x31')]['destroy']({'where':{'type':_0x4bf097,'resourceId':_0x29a15b['id']}})[_0x21c5('0x13')](function(){return _0x526174;});})['then'](function(){_0x3b66f9[_0x21c5('0x1d')](0xcc)[_0x21c5('0x32')]();});}};}function handleEntityNotFound(_0x2f2099){return function(_0x5f4aa0){if(!_0x5f4aa0){_0x2f2099[_0x21c5('0x1c')](0x194);}return _0x5f4aa0;};}function handleError(_0x535498,_0x4f74aa){_0x4f74aa=_0x4f74aa||0x1f4;return function(_0x449e7f){logger[_0x21c5('0x18')](_0x449e7f[_0x21c5('0x33')]);if(_0x449e7f[_0x21c5('0x30')]){delete _0x449e7f['name'];}_0x535498[_0x21c5('0x1d')](_0x4f74aa)[_0x21c5('0x34')](_0x449e7f);};}exports[_0x21c5('0x35')]=function(_0x326e1c,_0x20ec3a){var _0x282178={},_0x1d0434={'count':0x0,'rows':[]};var _0x13f7a1=_(db['User'][_0x21c5('0x36')])[_0x21c5('0x2d')](function(_0x1092f9){return{'name':_0x1092f9['fieldName'],'type':_0x1092f9[_0x21c5('0x37')][_0x21c5('0x38')]};})[_0x21c5('0x39')](function(_0x2bf12b){return!_[_0x21c5('0x3a')](['password',_0x21c5('0x3b')],_0x2bf12b[_0x21c5('0x30')]);})[_0x21c5('0x2e')]();_0x282178=qs[_0x21c5('0x3c')](_0x13f7a1,_0x326e1c);var _0x31fd72={'where':_0x282178['where']};return db[_0x21c5('0x3d')][_0x21c5('0x21')](_0x31fd72)[_0x21c5('0x13')](function(_0x54869b){_0x1d0434['count']=_0x54869b;if(_0x326e1c[_0x21c5('0x3e')][_0x21c5('0x3f')]){_0x282178['include']=[{'all':!![]}];}if(!_[_0x21c5('0x3a')](_0x282178[_0x21c5('0x40')],'id')){_0x282178[_0x21c5('0x40')]['push']('id');}return db[_0x21c5('0x3d')][_0x21c5('0x41')](_0x282178);})[_0x21c5('0x13')](function(_0x56547e){_0x1d0434[_0x21c5('0x42')]=_0x56547e;if(_0x326e1c['query'][_0x21c5('0x43')]===_0x21c5('0x44')){var _0x383893=[];for(var _0x3e915a=0x0;_0x3e915a<_0x1d0434[_0x21c5('0x42')]['length'];_0x3e915a++){_0x383893['push'](get_open_tabs('chat',_0x1d0434[_0x21c5('0x42')][_0x3e915a]['dataValues']));_0x383893[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x46'),_0x1d0434[_0x21c5('0x42')][_0x3e915a][_0x21c5('0x47')]));_0x383893['push'](get_open_tabs(_0x21c5('0x48'),_0x1d0434[_0x21c5('0x42')][_0x3e915a][_0x21c5('0x47')]));_0x383893[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x49'),_0x1d0434[_0x21c5('0x42')][_0x3e915a][_0x21c5('0x47')]));_0x383893[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x4a'),_0x1d0434['rows'][_0x3e915a][_0x21c5('0x47')]));_0x383893['push'](get_open_tabs(_0x21c5('0x4b'),_0x1d0434[_0x21c5('0x42')][_0x3e915a][_0x21c5('0x47')]));}return BPromise[_0x21c5('0x4c')](_0x383893)[_0x21c5('0x13')](function(_0x24242a){return _0x1d0434;});}else{return _0x1d0434;}})[_0x21c5('0x13')](respondWithFilteredResult(_0x20ec3a,_0x282178))[_0x21c5('0x1b')](handleError(_0x20ec3a,null));};exports[_0x21c5('0x4d')]=function(_0x1e11b0,_0x33322a){var _0x43639f={'raw':![],'where':{'id':_0x1e11b0['params']['id']}},_0x5f1b3d={};_0x5f1b3d['model']=_[_0x21c5('0x4e')](_[_0x21c5('0x4f')](db[_0x21c5('0x3d')]['rawAttributes']),[_0x21c5('0x50'),_0x21c5('0x3b')]);_0x5f1b3d[_0x21c5('0x3e')]=_['keys'](_0x1e11b0['query']);_0x5f1b3d[_0x21c5('0x51')]=_[_0x21c5('0x52')](_0x5f1b3d[_0x21c5('0x53')],_0x5f1b3d[_0x21c5('0x3e')]);_0x43639f['attributes']=_[_0x21c5('0x52')](_0x5f1b3d[_0x21c5('0x53')],qs[_0x21c5('0x54')](_0x1e11b0[_0x21c5('0x3e')]['fields']));_0x43639f[_0x21c5('0x40')]=_0x43639f[_0x21c5('0x40')][_0x21c5('0x55')]?_0x43639f['attributes']:_0x5f1b3d[_0x21c5('0x53')];if(_0x1e11b0['query']['includeAll']){_0x43639f[_0x21c5('0x56')]=[{'all':!![]}];}_0x43639f=_[_0x21c5('0x57')]({},_0x43639f,_0x1e11b0[_0x21c5('0x58')]);if(!_[_0x21c5('0x3a')](_0x43639f[_0x21c5('0x40')],'id')){_0x43639f['attributes']['push']('id');}return db['User'][_0x21c5('0x2f')](_0x43639f)[_0x21c5('0x13')](handleEntityNotFound(_0x33322a,null))['then'](function(_0x25347e){var _0x35c9f0=[];values=_0x25347e;if(_0x1e11b0[_0x21c5('0x3e')][_0x21c5('0x43')]==='true'){_0x35c9f0[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x59'),_0x25347e[_0x21c5('0x47')]));_0x35c9f0[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x46'),_0x25347e['dataValues']));_0x35c9f0['push'](get_open_tabs(_0x21c5('0x4a'),_0x25347e[_0x21c5('0x47')]));_0x35c9f0[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x4b'),_0x25347e[_0x21c5('0x47')]));_0x35c9f0['push'](get_open_tabs(_0x21c5('0x48'),_0x25347e[_0x21c5('0x47')]));_0x35c9f0['push'](get_open_tabs(_0x21c5('0x49'),_0x25347e[_0x21c5('0x47')]));return BPromise['all'](_0x35c9f0);}else{return values;}})[_0x21c5('0x13')](function(_0x585f97){return values;})[_0x21c5('0x13')](respondWithResult(_0x33322a,null))['catch'](handleError(_0x33322a,null));};exports[_0x21c5('0x24')]=function(_0x400b32,_0xd4c091){if(_0x400b32[_0x21c5('0x5a')]['id']){delete _0x400b32[_0x21c5('0x5a')]['id'];}delete _0x400b32['body'][_0x21c5('0x26')];return db['User'][_0x21c5('0x2f')]({'where':{'id':_0x400b32['params']['id']}})[_0x21c5('0x13')](handleEntityNotFound(_0xd4c091,null))[_0x21c5('0x13')](saveUpdates(_0x400b32[_0x21c5('0x5a')],null))[_0x21c5('0x13')](respondWithResult(_0xd4c091,null))[_0x21c5('0x1b')](handleError(_0xd4c091,null));};exports[_0x21c5('0x5b')]=function(_0x284249,_0x2c3dc5){return db['User'][_0x21c5('0x5b')]()['then'](respondWithResult(_0x2c3dc5,null))[_0x21c5('0x1b')](handleError(_0x2c3dc5,null));};exports[_0x21c5('0x5c')]=function(_0xe01471,_0x36fae4){return db[_0x21c5('0x3d')]['find']({'where':{'id':_0xe01471['params']['id']}})[_0x21c5('0x13')](handleEntityNotFound(_0x36fae4,null))[_0x21c5('0x13')](function(_0x3e128b){if(_0x3e128b){return _0x3e128b[_0x21c5('0x5c')](_0xe01471[_0x21c5('0x5a')]['ids'],_[_0x21c5('0x5d')](_0xe01471[_0x21c5('0x5a')],['ids','id'])||{});}})[_0x21c5('0x13')](respondWithResult(_0x36fae4,null))['catch'](handleError(_0x36fae4,null));};function validateUser(_0x13feb7){return new BPromise(function(_0x2d79e9,_0x39ea02){if(_0x13feb7[_0x21c5('0x5e')])return _0x2d79e9(_0x13feb7);return db[_0x21c5('0x5f')]['findById'](0x1)[_0x21c5('0x13')](function(_0x23a1f0){if(_0x23a1f0[_0x21c5('0x60')])authService['validatePasswordPattern'](_0x13feb7[_0x21c5('0x50')]);db['User'][_0x21c5('0x61')]('internal')[_0x21c5('0x13')](function(_0x401e32){if(_[_0x21c5('0x62')](_0x401e32)){_0x13feb7[_0x21c5('0x5e')]=_0x23a1f0[_0x21c5('0x63')]||0x1;return;}if(_['isNil'](_0x23a1f0[_0x21c5('0x63')])||_0x23a1f0[_0x21c5('0x63')]===_0x401e32){_0x13feb7['internal']=_0x401e32+0x1;return;}if(_0x23a1f0[_0x21c5('0x63')]>_0x401e32){_0x13feb7[_0x21c5('0x5e')]=_0x23a1f0[_0x21c5('0x63')];return;}return db['sequelize'][_0x21c5('0x3e')](_0x21c5('0x64'),{'type':db[_0x21c5('0x65')][_0x21c5('0x66')][_0x21c5('0x67')]})['then'](function(_0x2f85ec){if(_0x2f85ec&&_0x2f85ec[_0x21c5('0x55')]){for(var _0x5c29bf=0x0,_0x302fc2=_0x2f85ec[_0x21c5('0x55')];_0x5c29bf<_0x302fc2&&_[_0x21c5('0x62')](_0x13feb7[_0x21c5('0x5e')]);_0x5c29bf++){if(_0x23a1f0['min_internal']<=_0x2f85ec[_0x5c29bf][_0x21c5('0x68')]){_0x13feb7[_0x21c5('0x5e')]=_0x2f85ec[_0x5c29bf][_0x21c5('0x68')];}else if(_0x23a1f0[_0x21c5('0x63')]>_0x2f85ec[_0x5c29bf]['from']&&_0x23a1f0['min_internal']<=_0x2f85ec[_0x5c29bf]['to']){_0x13feb7[_0x21c5('0x5e')]=_0x23a1f0['min_internal'];}}}if(_['isNil'](_0x13feb7[_0x21c5('0x5e')])){_0x13feb7[_0x21c5('0x5e')]=_0x401e32+0x1;}return _0x2d79e9(_0x13feb7);});});})[_0x21c5('0x1b')](function(_0x3994ae){_0x39ea02(_0x3994ae);});});}function updateUser(_0x5f5381){return new BPromise(function(_0x181636,_0x4fc619){try{if(_0x5f5381[_0x21c5('0x69')]){_0x5f5381[_0x21c5('0x6a')]=_0x5f5381[_0x21c5('0x5e')];_0x5f5381[_0x21c5('0x6b')]={'mailbox':_0x5f5381[_0x21c5('0x5e')],'password':_0x5f5381[_0x21c5('0x50')],'fullname':_0x5f5381[_0x21c5('0x6c')],'email':_0x5f5381[_0x21c5('0x6d')]};}if(_0x5f5381[_0x21c5('0x26')]==='agent'){if(!_0x5f5381['permissions'])_0x5f5381[_0x21c5('0x6e')]=['101',_0x21c5('0x6f'),'103',_0x21c5('0x70'),_0x21c5('0x71'),_0x21c5('0x72'),'105','106','107',_0x21c5('0x73'),_0x21c5('0x74'),_0x21c5('0x75'),_0x21c5('0x76'),_0x21c5('0x77'),_0x21c5('0x78')];}_0x181636(_0x5f5381);}catch(_0x562f42){_0x4fc619(_0x562f42);}});}exports['create']=function(_0x3af28b,_0x5697a1){if(_0x3af28b[_0x21c5('0x29')][_0x21c5('0x26')]==='agent')throw new Error(_0x21c5('0x79'));if(_0x3af28b[_0x21c5('0x5a')]['role']===_0x21c5('0x29')&&_0x3af28b[_0x21c5('0x29')][_0x21c5('0x26')]!==_0x21c5('0x27')){throw new Error(_0x21c5('0x7a'));}if(_0x3af28b[_0x21c5('0x5a')][_0x21c5('0x26')]===_0x21c5('0x27')&&_0x3af28b[_0x21c5('0x29')][_0x21c5('0x26')]!=='admin'){throw new Error(_0x21c5('0x7b'));}return licenseUtil[_0x21c5('0x7c')]([_0x3af28b[_0x21c5('0x5a')]])['then'](function(){return validateUser(_0x3af28b[_0x21c5('0x5a')]);})[_0x21c5('0x13')](function(_0x2180e6){return updateUser(_0x2180e6)[_0x21c5('0x13')](function(_0x6dce8f){if(_0x6dce8f[_0x21c5('0x26')]==='admin'){_0x6dce8f[_0x21c5('0x7d')]=_0x3af28b[_0x21c5('0x29')][_0x21c5('0x7d')];delete _0x6dce8f['userProfileId'];}return _0x6dce8f;});})['then'](function(_0x5f3fef){return db['User']['create'](_0x5f3fef,{'include':[{'model':db[_0x21c5('0x6b')],'as':_0x21c5('0x6b')}]});})['then'](function(_0x25e753){if(_0x3af28b[_0x21c5('0x5a')][_0x21c5('0x26')]===_0x21c5('0x29'))return _0x25e753;if(_0x3af28b['user'][_0x21c5('0x26')]!==_0x21c5('0x29'))return _0x25e753;return db[_0x21c5('0x7e')][_0x21c5('0x2f')]({'where':{'name':_0x25e753['role']===_0x21c5('0x2b')?_0x21c5('0x2a'):'Telephones','userProfileId':_0x3af28b[_0x21c5('0x29')][_0x21c5('0x7f')]},'raw':!![]})['then'](function(_0x4c16a8){if(!_0x4c16a8||_0x4c16a8['autoAssociation']!=0x0)return _0x25e753;return db[_0x21c5('0x31')][_0x21c5('0x80')]({'name':_0x25e753[_0x21c5('0x30')],'resourceId':_0x25e753['id'],'type':_0x4c16a8[_0x21c5('0x30')],'sectionId':_0x4c16a8['id']},{})[_0x21c5('0x13')](function(){return _0x25e753;});})[_0x21c5('0x1b')](function(_0x1f0a5c){logger[_0x21c5('0x18')](_0x21c5('0x81'),_0x1f0a5c);throw _0x1f0a5c;});})[_0x21c5('0x13')](respondWithResult(_0x5697a1,0xc9))[_0x21c5('0x1b')](handleError(_0x5697a1,null));};exports[_0x21c5('0x82')]=function(_0x328141,_0x199286){var _0x2928a5=_0x328141[_0x21c5('0x5a')];var _0x5b547f=[];if(_0x328141[_0x21c5('0x29')][_0x21c5('0x26')]===_0x21c5('0x2b'))throw new Error(_0x21c5('0x79'));if(_['some'](_0x2928a5,['role',_0x21c5('0x29')])&&_0x328141[_0x21c5('0x29')][_0x21c5('0x26')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x2928a5,[_0x21c5('0x26'),_0x21c5('0x27')])&&_0x328141[_0x21c5('0x29')]['role']!==_0x21c5('0x27')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x21c5('0x7c')](_0x2928a5)[_0x21c5('0x13')](function(){return validateUser(_0x2928a5[0x0]);})[_0x21c5('0x13')](function(){for(var _0x1f7a7f=0x1;_0x1f7a7f<_0x2928a5[_0x21c5('0x55')];_0x1f7a7f++){var _0x2f9aba=_0x2928a5[_0x1f7a7f-0x1]['internal'];if(!_0x2928a5[_0x1f7a7f][_0x21c5('0x5e')])_0x2928a5[_0x1f7a7f]['internal']=_0x2f9aba+0x1;_0x5b547f[_0x21c5('0x45')](validateUser(_0x2928a5[_0x1f7a7f]));}return BPromise[_0x21c5('0x4c')](_0x5b547f);})['then'](function(){_0x5b547f=[];for(var _0x52c699=0x0;_0x52c699<_0x2928a5[_0x21c5('0x55')];_0x52c699++){_0x5b547f[_0x21c5('0x45')](updateUser(_0x2928a5[_0x52c699]));}return BPromise[_0x21c5('0x4c')](_0x5b547f);})['then'](function(){return BPromise[_0x21c5('0x83')](_0x2928a5,function(_0x4a8819){return db[_0x21c5('0x3d')][_0x21c5('0x80')](_0x4a8819,{'include':[{'model':db[_0x21c5('0x6b')],'as':_0x21c5('0x6b')}]})['then'](function(_0x3018ec){_0x4a8819['id']=_0x3018ec['id'];return _0x4a8819;});});})['then'](function(_0x30b92c){if(_0x328141[_0x21c5('0x5a')]['role']===_0x21c5('0x29'))return _0x30b92c;if(_0x328141['user'][_0x21c5('0x26')]!==_0x21c5('0x29'))return _0x30b92c;var _0x18e5b1=_[_0x21c5('0x84')](_0x30b92c,function(_0x18e3cd){return _0x18e3cd[_0x21c5('0x26')]==='agent'||_0x18e3cd['role']==='telephone';});if(!_0x18e5b1)return _0x30b92c;return db[_0x21c5('0x7e')][_0x21c5('0x41')]({'where':{'name':{'$or':[_0x21c5('0x2a'),_0x21c5('0x85')]},'userProfileId':_0x328141['user'][_0x21c5('0x7f')]},'raw':!![]})[_0x21c5('0x13')](function(_0x20f665){if(_[_0x21c5('0x86')](_0x20f665)||!_['some'](_0x20f665,[_0x21c5('0x87'),0x0]))return _0x30b92c;_0x5b547f=[];var _0x3717a7=_(_0x20f665)[_0x21c5('0x2d')](function(_0x5abfa4){if(_0x5abfa4['autoAssociation']===0x1)return;return _0x5abfa4[_0x21c5('0x30')]===_0x21c5('0x2a')?_0x21c5('0x2b'):_0x21c5('0x88');})[_0x21c5('0x89')]()[_0x21c5('0x2e')]();for(var _0x438e51=0x0;_0x438e51<_0x30b92c['length'];_0x438e51++){if(!_[_0x21c5('0x3a')](_0x3717a7,_0x30b92c[_0x438e51]['role']))return;var _0x3b654d=_0x30b92c[_0x438e51][_0x21c5('0x26')]===_0x21c5('0x2b')?_0x21c5('0x2a'):_0x21c5('0x85');_0x5b547f[_0x21c5('0x45')](db[_0x21c5('0x31')][_0x21c5('0x80')]({'name':_0x30b92c[_0x438e51][_0x21c5('0x30')],'resourceId':_0x30b92c[_0x438e51]['id'],'type':_0x3b654d,'sectionId':_[_0x21c5('0x2f')](_0x20f665,[_0x21c5('0x30'),_0x3b654d])['id']},{}));}return BPromise[_0x21c5('0x4c')](_0x5b547f);});})[_0x21c5('0x13')](respondWithResult(_0x199286,0xc9))[_0x21c5('0x1b')](handleError(_0x199286,null));};exports[_0x21c5('0x8a')]=function(_0x51f58c,_0x559334){if(_0x51f58c[_0x21c5('0x5a')]['id']){delete _0x51f58c[_0x21c5('0x5a')]['id'];}return db[_0x21c5('0x3d')][_0x21c5('0x2f')]({'where':{'id':_0x51f58c[_0x21c5('0x8b')]['id']}})[_0x21c5('0x13')](function(_0x101162){if(!_0x101162)return null;if(_0x101162['id']===_0x51f58c['user']['id']){if(!_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8c')]||!_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8d')]){throw new db[(_0x21c5('0x8e'))]['ValidationError'](_0x21c5('0x8f'));}if(!_0x101162[_0x21c5('0x90')](_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8c')])){throw new db[(_0x21c5('0x8e'))][(_0x21c5('0x91'))]('Wrong\x20credentials');}if(_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8c')]===_0x51f58c['body'][_0x21c5('0x8d')]){throw new db['Sequelize'][(_0x21c5('0x91'))](_0x21c5('0x92'));}}else if(_0x51f58c[_0x21c5('0x29')]['role']===_0x21c5('0x27')){if(!_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8d')]){throw new db[(_0x21c5('0x8e'))][(_0x21c5('0x91'))](_0x21c5('0x93'));}}else if(_0x51f58c[_0x21c5('0x29')]['role']==='user'){if(!_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8d')]){throw new db[(_0x21c5('0x8e'))][(_0x21c5('0x91'))](_0x21c5('0x93'));}if(_0x101162[_0x21c5('0x26')]!==_0x21c5('0x2b')){throw new db[(_0x21c5('0x8e'))][(_0x21c5('0x91'))](_0x21c5('0x79'));}}else{throw new db[(_0x21c5('0x8e'))]['ValidationError'](_0x21c5('0x79'));}return _0x101162;})[_0x21c5('0x13')](handleEntityNotFound(_0x559334,null))[_0x21c5('0x13')](function(_0x991438){return db[_0x21c5('0x5f')][_0x21c5('0x94')]({'attributes':['id',_0x21c5('0x60'),_0x21c5('0x95'),'passwordHistoryLimit']})[_0x21c5('0x13')](function(_0x56d553){if(_0x56d553[_0x21c5('0x60')])authService[_0x21c5('0x96')](_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8d')]);if(!_0x56d553[_0x21c5('0x95')]||!_0x991438[_0x21c5('0x97')])return _0x991438;authService[_0x21c5('0x98')](_0x51f58c[_0x21c5('0x5a')]['newPassword'],_0x991438[_0x21c5('0x97')],_0x56d553[_0x21c5('0x99')]);return _0x991438;})[_0x21c5('0x13')](saveUpdates({'password':_0x51f58c[_0x21c5('0x5a')]['newPassword'],'passwordResetAt':_0x51f58c['user']['id']==_0x51f58c[_0x21c5('0x8b')]['id']?moment():null,'previousPasswords':authService[_0x21c5('0x9a')](_0x51f58c[_0x21c5('0x5a')][_0x21c5('0x8d')],_0x991438[_0x21c5('0x97')])},null));})[_0x21c5('0x13')](respondWithResult(_0x559334,null))[_0x21c5('0x1b')](handleError(_0x559334,null));};exports['addQueues']=function(_0x223376,_0x3911db){var _0x4ef57d=_0x223376['body'][_0x21c5('0x9b')];return db['User'][_0x21c5('0x2f')]({'where':{'id':_0x223376[_0x21c5('0x8b')]['id']},'attributes':['id',_0x21c5('0x30'),_0x21c5('0x26'),_0x21c5('0x9c'),_0x21c5('0x9d'),_0x21c5('0x9e'),'interface']})['then'](handleEntityNotFound(_0x3911db,null))[_0x21c5('0x13')](function(_0x222d1c){if(_0x222d1c){if(!utils[_0x21c5('0x9f')](_0x4ef57d)){throw new db[(_0x21c5('0x8e'))][(_0x21c5('0x91'))](_0x21c5('0xa0'));}return _0x222d1c[_0x21c5('0xa1')+_[_0x21c5('0xa2')](_0x4ef57d['toLowerCase']())+_0x21c5('0xa3')](_0x223376[_0x21c5('0x5a')][_0x21c5('0xa4')],{'penalty':_0x223376['body'][_0x21c5('0xa5')]||0x0})[_0x21c5('0xa6')](function(_0x192d13){for(var _0x27f311=0x0;_0x27f311<_0x223376['body'][_0x21c5('0xa4')][_0x21c5('0x55')];_0x27f311+=0x1){var _0x2715ec={'UserId':Number(_0x223376[_0x21c5('0x8b')]['id'])};_0x2715ec[_['capitalize'](_0x4ef57d[_0x21c5('0xa7')]())+_0x21c5('0xa8')]=Number(_0x223376[_0x21c5('0x5a')]['ids'][_0x27f311]);socket['emit']('user'+_[_0x21c5('0xa2')](_0x4ef57d[_0x21c5('0xa7')]())+'Queue:save',_0x2715ec);}return _0x192d13;})[_0x21c5('0x13')](function(){if(_0x4ef57d===_0x21c5('0xa9')){return db[_0x21c5('0xaa')]['findAll']({'where':{'id':_0x223376['body'][_0x21c5('0xa4')]||[]},'raw':!![],'attributes':['id',_0x21c5('0x30')]});}})[_0x21c5('0x13')](function(_0x429a46){var _0x593357=_0x222d1c[_0x21c5('0x25')]({'plain':!![]});var _0x3c5694=[];if(_0x4ef57d==='voice'&&_0x593357['role']===_0x21c5('0x2b')&&_0x593357[_0x21c5('0x9c')]){for(var _0xd1e144=0x0;_0xd1e144<_0x429a46[_0x21c5('0x55')];_0xd1e144+=0x1){_0x3c5694[_0x21c5('0x45')]({'membername':_0x593357[_0x21c5('0x30')],'UserId':_0x593357['id'],'queue_name':_0x429a46[_0xd1e144][_0x21c5('0x30')],'VoiceQueueId':_0x429a46[_0xd1e144]['id'],'interface':_['isNil'](_0x593357['interface'])?util[_0x21c5('0xab')](_0x21c5('0xac'),_0x593357['name']):_0x593357[_0x21c5('0xad')],'paused':_0x593357[_0x21c5('0x9e')]||![],'penalty':_0x223376['body'][_0x21c5('0xa5')]||0x0});}return BPromise['each'](_0x3c5694,function(_0x673c2d){return db[_0x21c5('0xae')][_0x21c5('0xaf')](_0x673c2d);});}return _0x222d1c;});}})['then'](respondWithStatusCode(_0x3911db,null))[_0x21c5('0x1b')](handleError(_0x3911db,null));};exports[_0x21c5('0xb0')]=function(_0x32a97d,_0x24b614){var _0x15f099;return db['User'][_0x21c5('0x2f')]({'where':{'id':_0x32a97d[_0x21c5('0x8b')]['id']},'attributes':['id',_0x21c5('0x30'),'role']})[_0x21c5('0x13')](handleEntityNotFound(_0x24b614,null))[_0x21c5('0x13')](function(_0x5a9693){if(_0x5a9693){_0x15f099=_0x5a9693;if(!_0x32a97d[_0x21c5('0x3e')][_0x21c5('0x9b')]||!utils[_0x21c5('0x9f')](_0x32a97d[_0x21c5('0x3e')][_0x21c5('0x9b')])){throw new db[(_0x21c5('0x8e'))][(_0x21c5('0x91'))](_0x21c5('0xa0'));}return _0x5a9693['remove'+_[_0x21c5('0xa2')](_0x32a97d[_0x21c5('0x3e')][_0x21c5('0x9b')][_0x21c5('0xa7')]())+'Queues'](_0x32a97d[_0x21c5('0x3e')][_0x21c5('0xa4')]);}})[_0x21c5('0x13')](function(_0x58d6f6){if(_[_0x21c5('0xb1')](_0x32a97d[_0x21c5('0x3e')][_0x21c5('0xa4')])){for(var _0x1d65ec=0x0;_0x1d65ec<_0x32a97d['query'][_0x21c5('0xa4')][_0x21c5('0x55')];_0x1d65ec+=0x1){var _0x353fb7={'UserId':Number(_0x32a97d['params']['id'])};_0x353fb7[_[_0x21c5('0xa2')](_0x32a97d[_0x21c5('0x3e')][_0x21c5('0x9b')][_0x21c5('0xa7')]())+'QueueId']=Number(_0x32a97d[_0x21c5('0x3e')]['ids'][_0x1d65ec]);socket[_0x21c5('0xb2')]('user'+_[_0x21c5('0xa2')](_0x32a97d[_0x21c5('0x3e')]['channel']['toLowerCase']())+'Queue:remove',_0x353fb7);}}else{var _0x353fb7={'UserId':Number(_0x32a97d['params']['id'])};_0x353fb7[_[_0x21c5('0xa2')](_0x32a97d['query'][_0x21c5('0x9b')][_0x21c5('0xa7')]())+'QueueId']=Number(_0x32a97d['query'][_0x21c5('0xa4')]);socket['emit'](_0x21c5('0x29')+_[_0x21c5('0xa2')](_0x32a97d[_0x21c5('0x3e')][_0x21c5('0x9b')][_0x21c5('0xa7')]())+_0x21c5('0xb3'),_0x353fb7);}return _0x58d6f6;})[_0x21c5('0x13')](function(){if(_0x32a97d[_0x21c5('0x3e')][_0x21c5('0x9b')]===_0x21c5('0xa9')){return db[_0x21c5('0xae')][_0x21c5('0xb4')]({'where':{'UserId':_0x32a97d['params']['id'],'VoiceQueueId':_0x32a97d[_0x21c5('0x3e')][_0x21c5('0xa4')]},'individualHooks':!![]})[_0x21c5('0x13')](function(){return _0x15f099;});}return _0x15f099;})[_0x21c5('0x13')](respondWithStatusCode(_0x24b614,null))['catch'](handleError(_0x24b614,null));};exports[_0x21c5('0xb5')]=function(_0xfd391c,_0x43c4c0){_0xfd391c[_0x21c5('0x5a')][_0x21c5('0xb6')]=_0xfd391c[_0x21c5('0xb7')][_0x21c5('0xb8')];return db[_0x21c5('0x3d')][_0x21c5('0x2f')]({'where':{'id':_0xfd391c['params']['id']}})['then'](handleEntityNotFound(_0x43c4c0,null))['then'](saveUpdates(_0xfd391c[_0x21c5('0x5a')],null))[_0x21c5('0x13')](respondWithResult(_0x43c4c0,null))['catch'](handleError(_0x43c4c0,null));};exports[_0x21c5('0xb9')]=function(_0x24bb03,_0x4e28b9){var _0x2b18d6=path[_0x21c5('0xba')](config[_0x21c5('0xbb')],'server/files/images/logos/default_profile.png');return db[_0x21c5('0x3d')]['find']({'where':{'id':_0x24bb03[_0x21c5('0x8b')]['id']},'attributes':['id','userpic'],'raw':!![]})[_0x21c5('0x13')](handleEntityNotFound(_0x4e28b9,null))[_0x21c5('0x13')](function(_0x967916){if(_0x967916){if(_[_0x21c5('0x62')](_0x967916[_0x21c5('0xb6')])){return _0x4e28b9[_0x21c5('0xbc')](_0x2b18d6);}else{if(!fs[_0x21c5('0xbd')](path[_0x21c5('0xba')](config[_0x21c5('0xbb')],_0x21c5('0xbe'),_0x967916[_0x21c5('0xb6')]))){return _0x4e28b9[_0x21c5('0xbc')](_0x2b18d6);}return _0x4e28b9[_0x21c5('0xbc')](path[_0x21c5('0xba')](config[_0x21c5('0xbb')],_0x21c5('0xbe'),_0x967916[_0x21c5('0xb6')]));}}})[_0x21c5('0x1b')](handleError(_0x4e28b9,null));};exports[_0x21c5('0xbf')]=function(_0x4662d2,_0x55c275){return db[_0x21c5('0x3d')]['find']({'where':{'id':_0x4662d2[_0x21c5('0x8b')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x55c275,null))[_0x21c5('0x13')](function(_0x43015c){var _0x1e6197=[];values=_0x43015c[_0x21c5('0x47')];_0x1e6197[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x59'),_0x43015c[_0x21c5('0x47')]));_0x1e6197[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x46'),_0x43015c[_0x21c5('0x47')]));_0x1e6197[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x4a'),_0x43015c['dataValues']));_0x1e6197[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x4b'),_0x43015c[_0x21c5('0x47')]));_0x1e6197['push'](get_open_tabs(_0x21c5('0x48'),_0x43015c[_0x21c5('0x47')]));_0x1e6197[_0x21c5('0x45')](get_open_tabs(_0x21c5('0x49'),_0x43015c[_0x21c5('0x47')]));return BPromise[_0x21c5('0x4c')](_0x1e6197);})[_0x21c5('0x13')](function(_0x3442fa){var _0x81ab50=[];if(_0x3442fa){for(var _0x54bf9a=0x0;_0x54bf9a=_0x4363b3){_0x995928=_0x4363b3;_0x9bdb11=0xc8;}else{_0x9bdb11=0xce;}_0x456fe1['status'](_0x9bdb11);return _0x456fe1[_0x57d2('0x23')](_0x57d2('0x24'),_0x1d203c+'-'+_0x995928+'/'+_0x4363b3)[_0x57d2('0x1e')](_0x473df2);}return null;};}function saveUpdates(_0x1fe383){return function(_0x1957a6){if(_0x1957a6){return _0x1957a6[_0x57d2('0x25')](_0x1fe383)[_0x57d2('0x11')](function(_0x1d3a3a){return _0x1d3a3a;});}return null;};}function removeEntity(_0x1d2bdb){return function(_0x2cf9d9){if(_0x2cf9d9){return _0x2cf9d9['destroy']()[_0x57d2('0x11')](function(){var _0x3da926=_0x2cf9d9[_0x57d2('0x26')]({'plain':!![]});if(_0x3da926[_0x57d2('0x27')]==='admin')return;var _0x1d7fe7=[{'name':_0x57d2('0x28'),'value':_0x57d2('0x29'),'ignore':!![]},{'name':_0x57d2('0x2a'),'value':_0x57d2('0x2b'),'ignore':![]},{'name':_0x57d2('0x2c'),'value':_0x57d2('0x2d'),'ignore':![]}];var _0x36c0d7=_(_0x1d7fe7)[_0x57d2('0x2e')]('ignore')[_0x57d2('0x2f')](_0x57d2('0x30'))['value']();if(_[_0x57d2('0x31')](_0x36c0d7,_0x3da926[_0x57d2('0x27')])){return;}var _0x47dbfa=_[_0x57d2('0x32')](_0x1d7fe7,[_0x57d2('0x30'),_0x3da926[_0x57d2('0x27')]])[_0x57d2('0x33')];return db[_0x57d2('0x34')]['destroy']({'where':{'type':_0x47dbfa,'resourceId':_0x3da926['id']}})['then'](function(){return _0x2cf9d9;});})['then'](function(){_0x1d2bdb['status'](0xcc)[_0x57d2('0x1d')]();});}};}function handleEntityNotFound(_0x39f54b){return function(_0x39f3b9){if(!_0x39f3b9){_0x39f54b[_0x57d2('0x1b')](0x194);}return _0x39f3b9;};}function handleError(_0x13beac,_0x565ca6){_0x565ca6=_0x565ca6||0x1f4;return function(_0x375a83){logger['error'](_0x375a83[_0x57d2('0x35')]);if(_0x375a83[_0x57d2('0x33')]){delete _0x375a83[_0x57d2('0x33')];}_0x13beac['status'](_0x565ca6)[_0x57d2('0x36')](_0x375a83);};}exports[_0x57d2('0x37')]=function(_0x5d49e9,_0xb33455){var _0x28c52d={},_0x69a1bc={'count':0x0,'rows':[]};var _0x3a713d=_(db[_0x57d2('0x38')][_0x57d2('0x39')])['map'](function(_0x27e4a6){return{'name':_0x27e4a6['fieldName'],'type':_0x27e4a6[_0x57d2('0x3a')][_0x57d2('0x3b')]};})[_0x57d2('0x2e')](function(_0x1b7f08){return!_[_0x57d2('0x31')](['password',_0x57d2('0x3c')],_0x1b7f08[_0x57d2('0x33')]);})['value']();_0x28c52d=qs[_0x57d2('0x3d')](_0x3a713d,_0x5d49e9);var _0x267c8b={'where':_0x28c52d[_0x57d2('0x3e')]};return db['User'][_0x57d2('0x22')](_0x267c8b)[_0x57d2('0x11')](function(_0x25913e){_0x69a1bc[_0x57d2('0x22')]=_0x25913e;if(_0x5d49e9['query']['includeAll']){_0x28c52d[_0x57d2('0x3f')]=[{'all':!![]}];}if(!_[_0x57d2('0x31')](_0x28c52d[_0x57d2('0x40')],'id')){_0x28c52d['attributes']['push']('id');}return db[_0x57d2('0x38')]['findAll'](_0x28c52d);})[_0x57d2('0x11')](function(_0x1bb8ad){_0x69a1bc[_0x57d2('0x41')]=_0x1bb8ad;if(_0x5d49e9[_0x57d2('0x42')][_0x57d2('0x43')]==='true'){var _0x13216b=[];for(var _0x1c069a=0x0;_0x1c069a<_0x69a1bc['rows'][_0x57d2('0x44')];_0x1c069a++){_0x13216b['push'](get_open_tabs(_0x57d2('0x45'),_0x69a1bc[_0x57d2('0x41')][_0x1c069a][_0x57d2('0x46')]));_0x13216b[_0x57d2('0x47')](get_open_tabs('sms',_0x69a1bc['rows'][_0x1c069a][_0x57d2('0x46')]));_0x13216b['push'](get_open_tabs('fax',_0x69a1bc[_0x57d2('0x41')][_0x1c069a]['dataValues']));_0x13216b['push'](get_open_tabs(_0x57d2('0x48'),_0x69a1bc['rows'][_0x1c069a][_0x57d2('0x46')]));_0x13216b['push'](get_open_tabs(_0x57d2('0x49'),_0x69a1bc['rows'][_0x1c069a]['dataValues']));_0x13216b[_0x57d2('0x47')](get_open_tabs(_0x57d2('0x4a'),_0x69a1bc[_0x57d2('0x41')][_0x1c069a][_0x57d2('0x46')]));}return BPromise[_0x57d2('0x4b')](_0x13216b)[_0x57d2('0x11')](function(_0x4c88dd){return _0x69a1bc;});}else{return _0x69a1bc;}})[_0x57d2('0x11')](respondWithFilteredResult(_0xb33455,_0x28c52d))[_0x57d2('0x1a')](handleError(_0xb33455,null));};exports[_0x57d2('0x4c')]=function(_0x27cf60,_0xdeff48){var _0x8efa5={'raw':![],'where':{'id':_0x27cf60[_0x57d2('0x4d')]['id']}},_0x69ebf7={};_0x69ebf7['model']=_[_0x57d2('0x4e')](_[_0x57d2('0x4f')](db['User'][_0x57d2('0x39')]),['password','salt']);_0x69ebf7[_0x57d2('0x42')]=_[_0x57d2('0x4f')](_0x27cf60[_0x57d2('0x42')]);_0x69ebf7[_0x57d2('0x50')]=_['intersection'](_0x69ebf7[_0x57d2('0x51')],_0x69ebf7[_0x57d2('0x42')]);_0x8efa5['attributes']=_['intersection'](_0x69ebf7[_0x57d2('0x51')],qs[_0x57d2('0x52')](_0x27cf60[_0x57d2('0x42')][_0x57d2('0x52')]));_0x8efa5[_0x57d2('0x40')]=_0x8efa5[_0x57d2('0x40')]['length']?_0x8efa5['attributes']:_0x69ebf7['model'];if(_0x27cf60[_0x57d2('0x42')]['includeAll']){_0x8efa5[_0x57d2('0x3f')]=[{'all':!![]}];}_0x8efa5=_[_0x57d2('0x53')]({},_0x8efa5,_0x27cf60['options']);if(!_[_0x57d2('0x31')](_0x8efa5[_0x57d2('0x40')],'id')){_0x8efa5[_0x57d2('0x40')]['push']('id');}return db[_0x57d2('0x38')][_0x57d2('0x32')](_0x8efa5)[_0x57d2('0x11')](handleEntityNotFound(_0xdeff48,null))[_0x57d2('0x11')](function(_0x427f66){var _0x2e90eb=[];values=_0x427f66;if(_0x27cf60[_0x57d2('0x42')][_0x57d2('0x43')]===_0x57d2('0x54')){_0x2e90eb['push'](get_open_tabs(_0x57d2('0x45'),_0x427f66[_0x57d2('0x46')]));_0x2e90eb[_0x57d2('0x47')](get_open_tabs('sms',_0x427f66[_0x57d2('0x46')]));_0x2e90eb[_0x57d2('0x47')](get_open_tabs(_0x57d2('0x49'),_0x427f66['dataValues']));_0x2e90eb['push'](get_open_tabs('whatsapp',_0x427f66[_0x57d2('0x46')]));_0x2e90eb['push'](get_open_tabs(_0x57d2('0x55'),_0x427f66['dataValues']));_0x2e90eb[_0x57d2('0x47')](get_open_tabs('mail',_0x427f66[_0x57d2('0x46')]));return BPromise[_0x57d2('0x4b')](_0x2e90eb);}else{return values;}})[_0x57d2('0x11')](function(_0x54640d){return values;})['then'](respondWithResult(_0xdeff48,null))[_0x57d2('0x1a')](handleError(_0xdeff48,null));};exports[_0x57d2('0x25')]=function(_0x3b57fa,_0x227a02){if(_0x3b57fa[_0x57d2('0x56')]['id']){delete _0x3b57fa[_0x57d2('0x56')]['id'];}delete _0x3b57fa['body']['role'];return db[_0x57d2('0x38')][_0x57d2('0x32')]({'where':{'id':_0x3b57fa[_0x57d2('0x4d')]['id']}})[_0x57d2('0x11')](handleEntityNotFound(_0x227a02,null))['then'](saveUpdates(_0x3b57fa['body'],null))[_0x57d2('0x11')](respondWithResult(_0x227a02,null))[_0x57d2('0x1a')](handleError(_0x227a02,null));};exports['describe']=function(_0xad397,_0x28fcdb){return db[_0x57d2('0x38')][_0x57d2('0x57')]()['then'](respondWithResult(_0x28fcdb,null))['catch'](handleError(_0x28fcdb,null));};exports['addContacts']=function(_0x4b7b27,_0x434cb7){return db[_0x57d2('0x38')][_0x57d2('0x32')]({'where':{'id':_0x4b7b27[_0x57d2('0x4d')]['id']}})[_0x57d2('0x11')](handleEntityNotFound(_0x434cb7,null))[_0x57d2('0x11')](function(_0x2737ab){if(_0x2737ab){return _0x2737ab['addContacts'](_0x4b7b27[_0x57d2('0x56')]['ids'],_[_0x57d2('0x58')](_0x4b7b27['body'],[_0x57d2('0x59'),'id'])||{});}})[_0x57d2('0x11')](respondWithResult(_0x434cb7,null))[_0x57d2('0x1a')](handleError(_0x434cb7,null));};function validateUser(_0x39e4cd){return new BPromise(function(_0xcbe523,_0x145370){if(_0x39e4cd['internal'])return _0xcbe523(_0x39e4cd);return db[_0x57d2('0x5a')][_0x57d2('0x5b')](0x1)[_0x57d2('0x11')](function(_0x6da8c3){if(_0x6da8c3[_0x57d2('0x5c')])authService[_0x57d2('0x5d')](_0x39e4cd[_0x57d2('0x5e')]);db[_0x57d2('0x38')][_0x57d2('0x5f')]('internal')[_0x57d2('0x11')](function(_0x4bddff){if(_['isNil'](_0x4bddff)){_0x39e4cd['internal']=_0x6da8c3[_0x57d2('0x60')]||0x1;return;}if(_['isNil'](_0x6da8c3[_0x57d2('0x60')])||_0x6da8c3[_0x57d2('0x60')]===_0x4bddff){_0x39e4cd['internal']=_0x4bddff+0x1;return;}if(_0x6da8c3[_0x57d2('0x60')]>_0x4bddff){_0x39e4cd[_0x57d2('0x61')]=_0x6da8c3[_0x57d2('0x60')];return;}return db[_0x57d2('0x62')]['query'](_0x57d2('0x63'),{'type':db[_0x57d2('0x62')]['QueryTypes']['SELECT']})[_0x57d2('0x11')](function(_0x45f222){if(_0x45f222&&_0x45f222['length']){for(var _0x46c7de=0x0,_0x5a1283=_0x45f222[_0x57d2('0x44')];_0x46c7de<_0x5a1283&&_[_0x57d2('0x64')](_0x39e4cd[_0x57d2('0x61')]);_0x46c7de++){if(_0x6da8c3[_0x57d2('0x60')]<=_0x45f222[_0x46c7de][_0x57d2('0x65')]){_0x39e4cd[_0x57d2('0x61')]=_0x45f222[_0x46c7de][_0x57d2('0x65')];}else if(_0x6da8c3[_0x57d2('0x60')]>_0x45f222[_0x46c7de][_0x57d2('0x65')]&&_0x6da8c3[_0x57d2('0x60')]<=_0x45f222[_0x46c7de]['to']){_0x39e4cd[_0x57d2('0x61')]=_0x6da8c3['min_internal'];}}}if(_[_0x57d2('0x64')](_0x39e4cd[_0x57d2('0x61')])){_0x39e4cd[_0x57d2('0x61')]=_0x4bddff+0x1;}return _0xcbe523(_0x39e4cd);});});})[_0x57d2('0x1a')](function(_0x46a02b){_0x145370(_0x46a02b);});});}function updateUser(_0x2583d4){return new BPromise(function(_0x42666b,_0x94b8c6){try{if(_0x2583d4[_0x57d2('0x66')]){_0x2583d4[_0x57d2('0x67')]=_0x2583d4[_0x57d2('0x61')];_0x2583d4[_0x57d2('0x68')]={'mailbox':_0x2583d4[_0x57d2('0x61')],'password':_0x2583d4[_0x57d2('0x5e')],'fullname':_0x2583d4[_0x57d2('0x69')],'email':_0x2583d4[_0x57d2('0x6a')]};}if(_0x2583d4['role']===_0x57d2('0x2b')){if(!_0x2583d4[_0x57d2('0x6b')])_0x2583d4['permissions']=[_0x57d2('0x6c'),_0x57d2('0x6d'),_0x57d2('0x6e'),_0x57d2('0x6f'),'110',_0x57d2('0x70'),'105','106',_0x57d2('0x71'),'108',_0x57d2('0x72'),_0x57d2('0x73'),_0x57d2('0x74'),_0x57d2('0x75'),'115'];}_0x42666b(_0x2583d4);}catch(_0xd0191b){_0x94b8c6(_0xd0191b);}});}exports[_0x57d2('0x76')]=function(_0x3e3939,_0x2acc4c){if(_0x3e3939[_0x57d2('0x29')][_0x57d2('0x27')]===_0x57d2('0x2b'))throw new Error(_0x57d2('0x77'));if(_0x3e3939[_0x57d2('0x56')][_0x57d2('0x27')]==='user'&&_0x3e3939[_0x57d2('0x29')][_0x57d2('0x27')]!==_0x57d2('0x78')){throw new Error(_0x57d2('0x79'));}if(_0x3e3939[_0x57d2('0x56')][_0x57d2('0x27')]===_0x57d2('0x78')&&_0x3e3939[_0x57d2('0x29')][_0x57d2('0x27')]!==_0x57d2('0x78')){throw new Error(_0x57d2('0x7a'));}return licenseUtil[_0x57d2('0x7b')]([_0x3e3939['body']])['then'](function(){return validateUser(_0x3e3939[_0x57d2('0x56')]);})[_0x57d2('0x11')](function(_0x1a98d7){return updateUser(_0x1a98d7)[_0x57d2('0x11')](function(_0xe60b2e){if(_0xe60b2e['role']==='admin'){_0xe60b2e[_0x57d2('0x7c')]=_0x3e3939[_0x57d2('0x29')][_0x57d2('0x7c')];delete _0xe60b2e[_0x57d2('0x7d')];}return _0xe60b2e;});})[_0x57d2('0x11')](function(_0x41376b){return db['User'][_0x57d2('0x76')](_0x41376b,{'include':[{'model':db[_0x57d2('0x68')],'as':'VoiceMail'}]});})['then'](function(_0x5ac6ee){if(_0x3e3939['body'][_0x57d2('0x27')]==='user')return _0x5ac6ee;if(_0x3e3939[_0x57d2('0x29')]['role']!==_0x57d2('0x29'))return _0x5ac6ee;return db[_0x57d2('0x7e')][_0x57d2('0x32')]({'where':{'name':_0x5ac6ee[_0x57d2('0x27')]===_0x57d2('0x2b')?'Agents':_0x57d2('0x2c'),'userProfileId':_0x3e3939[_0x57d2('0x29')][_0x57d2('0x7d')]},'raw':!![]})['then'](function(_0x29194f){if(!_0x29194f||_0x29194f[_0x57d2('0x7f')]!=0x0)return _0x5ac6ee;return db[_0x57d2('0x34')][_0x57d2('0x76')]({'name':_0x5ac6ee[_0x57d2('0x33')],'resourceId':_0x5ac6ee['id'],'type':_0x29194f[_0x57d2('0x33')],'sectionId':_0x29194f['id']},{})[_0x57d2('0x11')](function(){return _0x5ac6ee;});})['catch'](function(_0x53c2c1){logger['error'](_0x57d2('0x80'),_0x53c2c1);throw _0x53c2c1;});})[_0x57d2('0x11')](respondWithResult(_0x2acc4c,0xc9))[_0x57d2('0x1a')](handleError(_0x2acc4c,null));};exports['bulkCreate']=function(_0x3bb3a5,_0x2cc262){var _0x446b54=_0x3bb3a5[_0x57d2('0x56')];var _0x30fa19=[];if(_0x3bb3a5[_0x57d2('0x29')][_0x57d2('0x27')]===_0x57d2('0x2b'))throw new Error('Unauthorized');if(_[_0x57d2('0x81')](_0x446b54,[_0x57d2('0x27'),_0x57d2('0x29')])&&_0x3bb3a5[_0x57d2('0x29')]['role']!=='admin'){throw new Error(_0x57d2('0x79'));}if(_['some'](_0x446b54,[_0x57d2('0x27'),'admin'])&&_0x3bb3a5[_0x57d2('0x29')][_0x57d2('0x27')]!==_0x57d2('0x78')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x57d2('0x7b')](_0x446b54)['then'](function(){return validateUser(_0x446b54[0x0]);})[_0x57d2('0x11')](function(){for(var _0xe71357=0x1;_0xe71357<_0x446b54[_0x57d2('0x44')];_0xe71357++){var _0x4458b4=_0x446b54[_0xe71357-0x1][_0x57d2('0x61')];if(!_0x446b54[_0xe71357][_0x57d2('0x61')])_0x446b54[_0xe71357][_0x57d2('0x61')]=_0x4458b4+0x1;_0x30fa19[_0x57d2('0x47')](validateUser(_0x446b54[_0xe71357]));}return BPromise[_0x57d2('0x4b')](_0x30fa19);})[_0x57d2('0x11')](function(){_0x30fa19=[];for(var _0x40af74=0x0;_0x40af74<_0x446b54[_0x57d2('0x44')];_0x40af74++){_0x30fa19[_0x57d2('0x47')](updateUser(_0x446b54[_0x40af74]));}return BPromise[_0x57d2('0x4b')](_0x30fa19);})[_0x57d2('0x11')](function(){return BPromise['each'](_0x446b54,function(_0x3a7d89){return db[_0x57d2('0x38')][_0x57d2('0x76')](_0x3a7d89,{'include':[{'model':db[_0x57d2('0x68')],'as':'VoiceMail'}]})[_0x57d2('0x11')](function(_0x362b77){_0x3a7d89['id']=_0x362b77['id'];return _0x3a7d89;});});})[_0x57d2('0x11')](function(_0x4f6585){if(_0x3bb3a5[_0x57d2('0x56')][_0x57d2('0x27')]===_0x57d2('0x29'))return _0x4f6585;if(_0x3bb3a5[_0x57d2('0x29')][_0x57d2('0x27')]!==_0x57d2('0x29'))return _0x4f6585;var _0xb76480=_[_0x57d2('0x81')](_0x4f6585,function(_0x1c858a){return _0x1c858a[_0x57d2('0x27')]==='agent'||_0x1c858a['role']===_0x57d2('0x2d');});if(!_0xb76480)return _0x4f6585;return db[_0x57d2('0x7e')][_0x57d2('0x82')]({'where':{'name':{'$or':[_0x57d2('0x2a'),'Telephones']},'userProfileId':_0x3bb3a5[_0x57d2('0x29')][_0x57d2('0x7d')]},'raw':!![]})[_0x57d2('0x11')](function(_0x3cf026){if(_[_0x57d2('0x83')](_0x3cf026)||!_['some'](_0x3cf026,['autoAssociation',0x0]))return _0x4f6585;_0x30fa19=[];var _0x577360=_(_0x3cf026)['map'](function(_0x5058e9){if(_0x5058e9[_0x57d2('0x7f')]===0x1)return;return _0x5058e9['name']===_0x57d2('0x2a')?_0x57d2('0x2b'):'telephone';})[_0x57d2('0x84')]()['value']();for(var _0x12fe30=0x0;_0x12fe30<_0x4f6585[_0x57d2('0x44')];_0x12fe30++){if(!_[_0x57d2('0x31')](_0x577360,_0x4f6585[_0x12fe30][_0x57d2('0x27')]))return;var _0x52163e=_0x4f6585[_0x12fe30][_0x57d2('0x27')]==='agent'?'Agents':_0x57d2('0x2c');_0x30fa19[_0x57d2('0x47')](db[_0x57d2('0x34')][_0x57d2('0x76')]({'name':_0x4f6585[_0x12fe30][_0x57d2('0x33')],'resourceId':_0x4f6585[_0x12fe30]['id'],'type':_0x52163e,'sectionId':_['find'](_0x3cf026,[_0x57d2('0x33'),_0x52163e])['id']},{}));}return BPromise[_0x57d2('0x4b')](_0x30fa19);});})[_0x57d2('0x11')](respondWithResult(_0x2cc262,0xc9))[_0x57d2('0x1a')](handleError(_0x2cc262,null));};exports[_0x57d2('0x85')]=function(_0x3cd56b,_0x4773a4){if(_0x3cd56b[_0x57d2('0x56')]['id']){delete _0x3cd56b['body']['id'];}return db['User'][_0x57d2('0x32')]({'where':{'id':_0x3cd56b['params']['id']}})[_0x57d2('0x11')](function(_0x40be0f){if(!_0x40be0f)return null;if(_0x40be0f['id']===_0x3cd56b[_0x57d2('0x29')]['id']){if(!_0x3cd56b[_0x57d2('0x56')][_0x57d2('0x86')]||!_0x3cd56b['body'][_0x57d2('0x87')]){throw new db['Sequelize'][(_0x57d2('0x88'))](_0x57d2('0x89'));}if(!_0x40be0f[_0x57d2('0x8a')](_0x3cd56b[_0x57d2('0x56')][_0x57d2('0x86')])){throw new db[(_0x57d2('0x8b'))][(_0x57d2('0x88'))](_0x57d2('0x8c'));}if(_0x3cd56b[_0x57d2('0x56')][_0x57d2('0x86')]===_0x3cd56b[_0x57d2('0x56')]['newPassword']){throw new db['Sequelize']['ValidationError'](_0x57d2('0x8d'));}}else if(_0x3cd56b[_0x57d2('0x29')][_0x57d2('0x27')]===_0x57d2('0x78')){if(!_0x3cd56b['body'][_0x57d2('0x87')]){throw new db[(_0x57d2('0x8b'))][(_0x57d2('0x88'))](_0x57d2('0x8e'));}}else if(_0x3cd56b['user'][_0x57d2('0x27')]===_0x57d2('0x29')){if(!_0x3cd56b[_0x57d2('0x56')][_0x57d2('0x87')]){throw new db['Sequelize'][(_0x57d2('0x88'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x40be0f['role']!=='agent'){throw new db[(_0x57d2('0x8b'))][(_0x57d2('0x88'))]('Unauthorized');}}else{throw new db['Sequelize'][(_0x57d2('0x88'))](_0x57d2('0x77'));}return _0x40be0f;})[_0x57d2('0x11')](handleEntityNotFound(_0x4773a4,null))['then'](function(_0x28718e){return db[_0x57d2('0x5a')][_0x57d2('0x8f')]({'attributes':['id',_0x57d2('0x5c'),_0x57d2('0x90'),'passwordHistoryLimit']})['then'](function(_0x415d6e){if(_0x415d6e[_0x57d2('0x5c')])authService[_0x57d2('0x5d')](_0x3cd56b[_0x57d2('0x56')]['newPassword']);if(!_0x415d6e[_0x57d2('0x90')]||!_0x28718e[_0x57d2('0x91')])return _0x28718e;authService['validatePasswordHistory'](_0x3cd56b[_0x57d2('0x56')][_0x57d2('0x87')],_0x28718e['previousPasswords'],_0x415d6e[_0x57d2('0x92')]);return _0x28718e;})[_0x57d2('0x11')](saveUpdates({'password':_0x3cd56b[_0x57d2('0x56')][_0x57d2('0x87')],'passwordResetAt':_0x3cd56b[_0x57d2('0x29')]['id']==_0x3cd56b[_0x57d2('0x4d')]['id']?moment():null,'previousPasswords':authService[_0x57d2('0x93')](_0x3cd56b['body'][_0x57d2('0x87')],_0x28718e[_0x57d2('0x91')])},null));})['then'](respondWithResult(_0x4773a4,null))[_0x57d2('0x1a')](handleError(_0x4773a4,null));};exports[_0x57d2('0x94')]=function(_0x2fc3b5,_0x41ba89){var _0x5f2fc4=_0x2fc3b5[_0x57d2('0x56')]['channel'];return db[_0x57d2('0x38')][_0x57d2('0x32')]({'where':{'id':_0x2fc3b5[_0x57d2('0x4d')]['id']},'attributes':['id',_0x57d2('0x33'),_0x57d2('0x27'),_0x57d2('0x95'),_0x57d2('0x96'),_0x57d2('0x97'),_0x57d2('0x98')]})[_0x57d2('0x11')](handleEntityNotFound(_0x41ba89,null))['then'](function(_0x3acffd){if(_0x3acffd){if(!utils[_0x57d2('0x99')](_0x5f2fc4)){throw new db['Sequelize'][(_0x57d2('0x88'))](_0x57d2('0x9a'));}return _0x3acffd['add'+_[_0x57d2('0x9b')](_0x5f2fc4[_0x57d2('0x9c')]())+_0x57d2('0x9d')](_0x2fc3b5[_0x57d2('0x56')]['ids'],{'penalty':_0x2fc3b5[_0x57d2('0x56')][_0x57d2('0x9e')]||0x0})['spread'](function(_0xafcb9c){for(var _0x128a29=0x0;_0x128a29<_0x2fc3b5[_0x57d2('0x56')][_0x57d2('0x59')][_0x57d2('0x44')];_0x128a29+=0x1){var _0x4e3497={'UserId':Number(_0x2fc3b5[_0x57d2('0x4d')]['id'])};_0x4e3497[_[_0x57d2('0x9b')](_0x5f2fc4['toLowerCase']())+_0x57d2('0x9f')]=Number(_0x2fc3b5[_0x57d2('0x56')][_0x57d2('0x59')][_0x128a29]);socket['emit'](_0x57d2('0x29')+_[_0x57d2('0x9b')](_0x5f2fc4['toLowerCase']())+_0x57d2('0xa0'),_0x4e3497);}return _0xafcb9c;})[_0x57d2('0x11')](function(){if(_0x5f2fc4===_0x57d2('0xa1')){return db[_0x57d2('0xa2')][_0x57d2('0x82')]({'where':{'id':_0x2fc3b5[_0x57d2('0x56')]['ids']||[]},'raw':!![],'attributes':['id',_0x57d2('0x33')]});}})[_0x57d2('0x11')](function(_0x2cb592){var _0xc3c295=_0x3acffd[_0x57d2('0x26')]({'plain':!![]});var _0x320735=[];if(_0x5f2fc4===_0x57d2('0xa1')&&_0xc3c295[_0x57d2('0x27')]===_0x57d2('0x2b')&&_0xc3c295['online']){for(var _0x5b7f18=0x0;_0x5b7f18<_0x2cb592[_0x57d2('0x44')];_0x5b7f18+=0x1){_0x320735['push']({'membername':_0xc3c295[_0x57d2('0x33')],'UserId':_0xc3c295['id'],'queue_name':_0x2cb592[_0x5b7f18]['name'],'VoiceQueueId':_0x2cb592[_0x5b7f18]['id'],'interface':_[_0x57d2('0x64')](_0xc3c295[_0x57d2('0x98')])?util[_0x57d2('0xa3')](_0x57d2('0xa4'),_0xc3c295[_0x57d2('0x33')]):_0xc3c295['interface'],'paused':_0xc3c295[_0x57d2('0x97')]||![],'penalty':_0x2fc3b5[_0x57d2('0x56')][_0x57d2('0x9e')]||0x0});}return BPromise[_0x57d2('0xa5')](_0x320735,function(_0xb6a8b){return db[_0x57d2('0xa6')]['upsert'](_0xb6a8b);});}return _0x3acffd;});}})[_0x57d2('0x11')](respondWithStatusCode(_0x41ba89,null))[_0x57d2('0x1a')](handleError(_0x41ba89,null));};exports[_0x57d2('0xa7')]=function(_0x2266b2,_0x1c4466){var _0x3cb0f1;return db[_0x57d2('0x38')][_0x57d2('0x32')]({'where':{'id':_0x2266b2[_0x57d2('0x4d')]['id']},'attributes':['id','name','role']})[_0x57d2('0x11')](handleEntityNotFound(_0x1c4466,null))[_0x57d2('0x11')](function(_0x19e767){if(_0x19e767){_0x3cb0f1=_0x19e767;if(!_0x2266b2[_0x57d2('0x42')][_0x57d2('0xa8')]||!utils[_0x57d2('0x99')](_0x2266b2['query'][_0x57d2('0xa8')])){throw new db[(_0x57d2('0x8b'))]['ValidationError']('Unknown\x20channel');}return _0x19e767[_0x57d2('0xa9')+_[_0x57d2('0x9b')](_0x2266b2[_0x57d2('0x42')]['channel'][_0x57d2('0x9c')]())+'Queues'](_0x2266b2[_0x57d2('0x42')][_0x57d2('0x59')]);}})[_0x57d2('0x11')](function(_0x1ede65){if(_['isArray'](_0x2266b2['query'][_0x57d2('0x59')])){for(var _0x6f81ab=0x0;_0x6f81ab<_0x2266b2[_0x57d2('0x42')]['ids'][_0x57d2('0x44')];_0x6f81ab+=0x1){var _0x214b6a={'UserId':Number(_0x2266b2['params']['id'])};_0x214b6a[_[_0x57d2('0x9b')](_0x2266b2['query'][_0x57d2('0xa8')][_0x57d2('0x9c')]())+_0x57d2('0x9f')]=Number(_0x2266b2['query'][_0x57d2('0x59')][_0x6f81ab]);socket[_0x57d2('0xaa')](_0x57d2('0x29')+_[_0x57d2('0x9b')](_0x2266b2[_0x57d2('0x42')]['channel'][_0x57d2('0x9c')]())+_0x57d2('0xab'),_0x214b6a);}}else{var _0x214b6a={'UserId':Number(_0x2266b2[_0x57d2('0x4d')]['id'])};_0x214b6a[_[_0x57d2('0x9b')](_0x2266b2['query'][_0x57d2('0xa8')]['toLowerCase']())+_0x57d2('0x9f')]=Number(_0x2266b2['query'][_0x57d2('0x59')]);socket[_0x57d2('0xaa')]('user'+_[_0x57d2('0x9b')](_0x2266b2['query'][_0x57d2('0xa8')][_0x57d2('0x9c')]())+_0x57d2('0xab'),_0x214b6a);}return _0x1ede65;})['then'](function(){if(_0x2266b2['query'][_0x57d2('0xa8')]===_0x57d2('0xa1')){return db[_0x57d2('0xa6')]['destroy']({'where':{'UserId':_0x2266b2['params']['id'],'VoiceQueueId':_0x2266b2[_0x57d2('0x42')][_0x57d2('0x59')]},'individualHooks':!![]})[_0x57d2('0x11')](function(){return _0x3cb0f1;});}return _0x3cb0f1;})[_0x57d2('0x11')](respondWithStatusCode(_0x1c4466,null))[_0x57d2('0x1a')](handleError(_0x1c4466,null));};exports[_0x57d2('0xac')]=function(_0x223df7,_0x257a4b){_0x223df7[_0x57d2('0x56')]['userpic']=_0x223df7[_0x57d2('0xad')][_0x57d2('0xae')];return db[_0x57d2('0x38')][_0x57d2('0x32')]({'where':{'id':_0x223df7[_0x57d2('0x4d')]['id']}})[_0x57d2('0x11')](handleEntityNotFound(_0x257a4b,null))[_0x57d2('0x11')](saveUpdates(_0x223df7[_0x57d2('0x56')],null))['then'](respondWithResult(_0x257a4b,null))[_0x57d2('0x1a')](handleError(_0x257a4b,null));};exports[_0x57d2('0xaf')]=function(_0x33ba72,_0x47bc87){var _0xd8348b=path[_0x57d2('0xb0')](config[_0x57d2('0xb1')],_0x57d2('0xb2'));return db[_0x57d2('0x38')]['find']({'where':{'id':_0x33ba72['params']['id']},'attributes':['id','userpic'],'raw':!![]})[_0x57d2('0x11')](handleEntityNotFound(_0x47bc87,null))['then'](function(_0x49a08a){if(_0x49a08a){if(_[_0x57d2('0x64')](_0x49a08a[_0x57d2('0xb3')])){return _0x47bc87[_0x57d2('0xb4')](_0xd8348b);}else{if(!fs['existsSync'](path['join'](config['root'],_0x57d2('0xb5'),_0x49a08a[_0x57d2('0xb3')]))){return _0x47bc87[_0x57d2('0xb4')](_0xd8348b);}return _0x47bc87[_0x57d2('0xb4')](path[_0x57d2('0xb0')](config[_0x57d2('0xb1')],_0x57d2('0xb5'),_0x49a08a[_0x57d2('0xb3')]));}}})[_0x57d2('0x1a')](handleError(_0x47bc87,null));};exports['getOpenTabs']=function(_0x2dde98,_0x4f054b){return db[_0x57d2('0x38')][_0x57d2('0x32')]({'where':{'id':_0x2dde98['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x4f054b,null))['then'](function(_0x19a16e){var _0x54b99f=[];values=_0x19a16e['dataValues'];_0x54b99f['push'](get_open_tabs(_0x57d2('0x45'),_0x19a16e[_0x57d2('0x46')]));_0x54b99f[_0x57d2('0x47')](get_open_tabs('sms',_0x19a16e[_0x57d2('0x46')]));_0x54b99f[_0x57d2('0x47')](get_open_tabs('openchannel',_0x19a16e[_0x57d2('0x46')]));_0x54b99f[_0x57d2('0x47')](get_open_tabs(_0x57d2('0x4a'),_0x19a16e[_0x57d2('0x46')]));_0x54b99f[_0x57d2('0x47')](get_open_tabs(_0x57d2('0x55'),_0x19a16e[_0x57d2('0x46')]));_0x54b99f['push'](get_open_tabs(_0x57d2('0x48'),_0x19a16e[_0x57d2('0x46')]));return BPromise[_0x57d2('0x4b')](_0x54b99f);})[_0x57d2('0x11')](function(_0x567439){var _0x56f505=[];if(_0x567439){for(var _0x5e8565=0x0;_0x5e8565=_0x226715[_0x1d3c('0x50')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})['then'](function(){if(_0x503225){return db[_0x1d3c('0x29')][_0x1d3c('0x49')]({'where':{'membername':_0x503225['name']},'individualHooks':!![]});}})[_0x1d3c('0x25')](function(){if(_0x503225){return _0x503225['getVoiceQueues']({'raw':!![]});}})[_0x1d3c('0x25')](function(_0x209203){if(_0x503225){if(_0x209203){var _0x31c256=[];_0x4b6ad5=_0x209203;if(_0x4b6ad5['length']){for(var _0x255ea2=0x0;_0x255ea2<_0x4b6ad5[_0x1d3c('0x2f')];_0x255ea2++){_0x31c256[_0x1d3c('0x32')](db[_0x1d3c('0x29')][_0x1d3c('0x51')]({'membername':_0x503225[_0x1d3c('0x26')],'UserId':_0x503225['id'],'queue_name':_0x4b6ad5[_0x255ea2][_0x1d3c('0x26')],'VoiceQueueId':_0x4b6ad5[_0x255ea2]['id'],'interface':_0x39ff76,'paused':_0x503225['loginInPause']||![],'penalty':_0x4b6ad5[_0x255ea2][_0x1d3c('0x52')]||0x0}));}return BPromise[_0x1d3c('0x47')](_0x31c256);}}}})[_0x1d3c('0x25')](function(){if(_0x503225){return db['MemberReport'][_0x1d3c('0x1a')]({'where':{'membername':_0x503225[_0x1d3c('0x26')],'exitAt':null}});}})[_0x1d3c('0x25')](function(_0x504d2c){if(_0x503225){if(_0x504d2c&&_0x504d2c[_0x1d3c('0x2f')]){var _0x5068da=[];_0x504d2c[_0x1d3c('0x31')](function(_0x55bf13){_0x5068da['push'](_0x55bf13['update']({'exitAt':moment()[_0x1d3c('0x2d')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x5068da);}}})[_0x1d3c('0x25')](function(_0x5d185d){if(_0x503225){var _0x17fe6a=[];var _0x8cb76b=[];var _0x38f80b=utils[_0x1d3c('0x30')]();var _0x40a5b4={'membername':_0x503225[_0x1d3c('0x26')],'interface':_0x39ff76,'enterAt':moment()[_0x1d3c('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x503225[_0x1d3c('0x27')],'internal':_0x503225[_0x1d3c('0x28')]};_0x38f80b[_0x1d3c('0x31')](function(_0x539eeb){_0x17fe6a[_0x1d3c('0x32')](_['merge']({'channel':_0x539eeb,'type':_0x1d3c('0x53'),'data1':_0x1d3c('0x54'),'data2':_0x39ff76},_0x40a5b4));if(_0x503225[_0x1d3c('0x4b')]){_0x8cb76b['push'](_[_0x1d3c('0x55')]({'channel':_0x539eeb,'type':'PAUSE','data1':_0x1d3c('0x56')},_0x40a5b4));}});return db[_0x1d3c('0x2b')][_0x1d3c('0x38')](_0x17fe6a[_0x1d3c('0x57')](_0x8cb76b),{'individualHooks':!![]});}})[_0x1d3c('0x25')](function(){if(_0x503225){return _0x503225[_0x1d3c('0x2a')]({'online':!![],'lastLoginAt':moment()[_0x1d3c('0x2d')](_0x1d3c('0x2e')),'voicePause':_0x503225[_0x1d3c('0x4b')]||![],'mailPause':_0x503225['loginInPause']||![],'chatPause':_0x503225[_0x1d3c('0x4b')]||![],'faxPause':_0x503225[_0x1d3c('0x4b')]||![],'smsPause':_0x503225['loginInPause']||![],'openchannelPause':_0x503225['loginInPause']||![],'pauseType':_0x503225[_0x1d3c('0x4b')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x1d3c('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x39ff76});}})['then'](function(_0x23d543){_0x54128b(_0x23d543);})[_0x1d3c('0x17')](function(_0x118f0a){_0x56abb3(_0x406ef8[_0x1d3c('0x14')](0x1f4,_0x118f0a[_0x1d3c('0x16')]));});});}; \ No newline at end of file +var _0x1acf=['Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','concat','LOGININPAUSE','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./user.socket','register','request','then','info','User,\x20%s,\x20%s','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetUser','findAll','options','raw','where','attributes','limit','map','include','model','ShowUser','User','find','PauseUser','role','internal','interface','UserVoiceQueueRt','name','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','forEach','push','isNil','format','SIP/%s','body','type','DEFAULT\x20PAUSE','MemberReport','bulkCreate','update','UnpauseUser','findOne','channel','isValidChannel','voice','system','fax','whatsapp','set','%s%s','Pause','all','LoginUser','mobile','phone','loginInPause','count','agent','getLicense','agents'];(function(_0x8739f5,_0x55a924){var _0x403a42=function(_0x37b0be){while(--_0x37b0be){_0x8739f5['push'](_0x8739f5['shift']());}};_0x403a42(++_0x55a924);}(_0x1acf,0x1db));var _0xf1ac=function(_0x83f8c4,_0x450c4b){_0x83f8c4=_0x83f8c4-0x0;var _0x1cf945=_0x1acf[_0x83f8c4];return _0x1cf945;};'use strict';var _=require('lodash');var util=require(_0xf1ac('0x0'));var moment=require(_0xf1ac('0x1'));var BPromise=require(_0xf1ac('0x2'));var rs=require(_0xf1ac('0x3'));var fs=require('fs');var Redis=require(_0xf1ac('0x4'));var db=require(_0xf1ac('0x5'))['db'];var utils=require(_0xf1ac('0x6'));var logger=require(_0xf1ac('0x7'))(_0xf1ac('0x8'));var config=require(_0xf1ac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf1ac('0xa')]['http']({'port':0x232a});config[_0xf1ac('0xb')]=_[_0xf1ac('0xc')](config['redis'],{'host':_0xf1ac('0xd'),'port':0x18eb});var socket=require(_0xf1ac('0xe'))(new Redis(config[_0xf1ac('0xb')]));require(_0xf1ac('0xf'))[_0xf1ac('0x10')](socket);function respondWithRpcPromise(_0x52a585,_0x2f7d1d,_0x151667){return new BPromise(function(_0x87c758,_0x1a13df){return client[_0xf1ac('0x11')](_0x52a585,_0x151667)[_0xf1ac('0x12')](function(_0x4661d4){logger[_0xf1ac('0x13')](_0xf1ac('0x14'),_0x2f7d1d,'request\x20sent');logger[_0xf1ac('0x15')](_0xf1ac('0x16'),_0x2f7d1d,_0xf1ac('0x17'),JSON[_0xf1ac('0x18')](_0x4661d4));if(_0x4661d4[_0xf1ac('0x19')]){if(_0x4661d4[_0xf1ac('0x19')][_0xf1ac('0x1a')]===0x1f4){logger[_0xf1ac('0x19')](_0xf1ac('0x14'),_0x2f7d1d,_0x4661d4[_0xf1ac('0x19')][_0xf1ac('0x1b')]);return _0x1a13df(_0x4661d4['error']['message']);}logger[_0xf1ac('0x19')](_0xf1ac('0x14'),_0x2f7d1d,_0x4661d4['error']['message']);return _0x87c758(_0x4661d4[_0xf1ac('0x19')][_0xf1ac('0x1b')]);}else{logger['info'](_0xf1ac('0x14'),_0x2f7d1d,_0xf1ac('0x17'));_0x87c758(_0x4661d4[_0xf1ac('0x1c')][_0xf1ac('0x1b')]);}})[_0xf1ac('0x1d')](function(_0x25af0f){logger[_0xf1ac('0x19')]('User,\x20%s,\x20%s',_0x2f7d1d,_0x25af0f);_0x1a13df(_0x25af0f);});});}exports[_0xf1ac('0x1e')]=function(_0x1a2a81){var _0x198a6f=this;return new Promise(function(_0x3881c2,_0xcc29f3){return db['User'][_0xf1ac('0x1f')]({'raw':_0x1a2a81[_0xf1ac('0x20')]?_0x1a2a81[_0xf1ac('0x20')][_0xf1ac('0x21')]===undefined?!![]:![]:!![],'where':_0x1a2a81[_0xf1ac('0x20')]?_0x1a2a81[_0xf1ac('0x20')][_0xf1ac('0x22')]||null:null,'attributes':_0x1a2a81[_0xf1ac('0x20')]?_0x1a2a81[_0xf1ac('0x20')][_0xf1ac('0x23')]||null:null,'limit':_0x1a2a81[_0xf1ac('0x20')]?_0x1a2a81[_0xf1ac('0x20')][_0xf1ac('0x24')]||null:null,'include':_0x1a2a81[_0xf1ac('0x20')]?_0x1a2a81['options']['include']?_[_0xf1ac('0x25')](_0x1a2a81[_0xf1ac('0x20')][_0xf1ac('0x26')],function(_0x5c3fa6){return{'model':db[_0x5c3fa6[_0xf1ac('0x27')]],'as':_0x5c3fa6['as'],'attributes':_0x5c3fa6['attributes'],'include':_0x5c3fa6['include']?_[_0xf1ac('0x25')](_0x5c3fa6[_0xf1ac('0x26')],function(_0x3becd1){return{'model':db[_0x3becd1[_0xf1ac('0x27')]],'as':_0x3becd1['as'],'attributes':_0x3becd1[_0xf1ac('0x23')],'include':_0x3becd1[_0xf1ac('0x26')]?_[_0xf1ac('0x25')](_0x3becd1[_0xf1ac('0x26')],function(_0x27a72a){return{'model':db[_0x27a72a[_0xf1ac('0x27')]],'as':_0x27a72a['as'],'attributes':_0x27a72a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4afe20){logger['info'](_0xf1ac('0x1e'),_0x1a2a81);logger[_0xf1ac('0x15')]('GetUser',_0x1a2a81,JSON[_0xf1ac('0x18')](_0x4afe20));_0x3881c2(_0x4afe20);})[_0xf1ac('0x1d')](function(_0x2bcb02){logger['error']('GetUser',_0x2bcb02[_0xf1ac('0x1b')],_0x1a2a81);_0xcc29f3(_0x198a6f[_0xf1ac('0x19')](0x1f4,_0x2bcb02[_0xf1ac('0x1b')]));});});};exports[_0xf1ac('0x28')]=function(_0x448a67){var _0x31e3c9=this;return new Promise(function(_0x7a82cd,_0x2671e2){return db[_0xf1ac('0x29')][_0xf1ac('0x2a')]({'raw':_0x448a67[_0xf1ac('0x20')]?_0x448a67['options'][_0xf1ac('0x21')]===undefined?!![]:![]:!![],'where':_0x448a67[_0xf1ac('0x20')]?_0x448a67['options'][_0xf1ac('0x22')]||null:null,'attributes':_0x448a67[_0xf1ac('0x20')]?_0x448a67['options']['attributes']||null:null,'include':_0x448a67[_0xf1ac('0x20')]?_0x448a67[_0xf1ac('0x20')]['include']?_[_0xf1ac('0x25')](_0x448a67[_0xf1ac('0x20')]['include'],function(_0x253246){return{'model':db[_0x253246[_0xf1ac('0x27')]],'as':_0x253246['as'],'attributes':_0x253246[_0xf1ac('0x23')],'include':_0x253246['include']?_[_0xf1ac('0x25')](_0x253246[_0xf1ac('0x26')],function(_0x30ca7e){return{'model':db[_0x30ca7e[_0xf1ac('0x27')]],'as':_0x30ca7e['as'],'attributes':_0x30ca7e[_0xf1ac('0x23')],'include':_0x30ca7e[_0xf1ac('0x26')]?_['map'](_0x30ca7e[_0xf1ac('0x26')],function(_0x12a283){return{'model':db[_0x12a283['model']],'as':_0x12a283['as'],'attributes':_0x12a283['attributes']};}):[]};}):[]};}):[]:[]})[_0xf1ac('0x12')](function(_0x261dcd){logger['info'](_0xf1ac('0x28'),_0x448a67);logger[_0xf1ac('0x15')]('ShowUser',_0x448a67,JSON[_0xf1ac('0x18')](_0x261dcd));_0x7a82cd(_0x261dcd);})['catch'](function(_0x523938){logger[_0xf1ac('0x19')](_0xf1ac('0x28'),_0x523938['message'],_0x448a67);_0x2671e2(_0x31e3c9['error'](0x1f4,_0x523938['message']));});});};exports[_0xf1ac('0x2b')]=function(_0x3e4c7e){var _0x4d85bc=this;return new Promise(function(_0x17439b,_0x357676){var _0x41e0e0;return db[_0xf1ac('0x29')]['find']({'where':_0x3e4c7e[_0xf1ac('0x20')]['where']||{},'attributes':['id','name',_0xf1ac('0x2c'),_0xf1ac('0x2d'),_0xf1ac('0x2e')]})[_0xf1ac('0x12')](function(_0x3ccf90){if(_0x3ccf90){_0x41e0e0=_0x3ccf90;return db[_0xf1ac('0x2f')]['update']({'paused':0x1},{'where':{'UserId':_0x41e0e0['id']},'individualHooks':!![]});}})['then'](function(){if(_0x41e0e0){return db['MemberReport'][_0xf1ac('0x1f')]({'where':{'membername':_0x41e0e0[_0xf1ac('0x30')],'type':_0xf1ac('0x31'),'exitAt':null}});}})[_0xf1ac('0x12')](function(_0x1c6366){if(_0x41e0e0){if(_0x1c6366&&_0x1c6366[_0xf1ac('0x32')]){var _0x25b37b=moment()['format'](_0xf1ac('0x33'));for(var _0x2f0648=0x0,_0x3d97de=_0x1c6366[_0xf1ac('0x32')];_0x2f0648<_0x3d97de;_0x2f0648++){_0x1c6366[_0x2f0648]['updateAttributes']({'exitAt':_0x25b37b});}}}})[_0xf1ac('0x12')](function(){if(_0x41e0e0){var _0x50252b=[];var _0x30f1dc=utils['getChannels']();_0x30f1dc[_0xf1ac('0x34')](function(_0x49b37a){_0x50252b[_0xf1ac('0x35')]({'channel':_0x49b37a,'membername':_0x41e0e0['name'],'interface':_[_0xf1ac('0x36')](_0x41e0e0[_0xf1ac('0x2e')])?util[_0xf1ac('0x37')](_0xf1ac('0x38'),_0x41e0e0[_0xf1ac('0x30')]):_0x41e0e0['interface'],'type':_0xf1ac('0x31'),'enterAt':moment()['format'](_0xf1ac('0x33')),'data1':_0x3e4c7e[_0xf1ac('0x39')][_0xf1ac('0x3a')]||_0xf1ac('0x3b'),'role':_0x41e0e0[_0xf1ac('0x2c')],'internal':_0x41e0e0['internal'],'uniqueid':_0x3e4c7e['body']['uniqueid']||null});});return db[_0xf1ac('0x3c')][_0xf1ac('0x3d')](_0x50252b,{'individualHooks':!![]});}})['then'](function(){if(_0x41e0e0){return _0x41e0e0[_0xf1ac('0x3e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x3e4c7e[_0xf1ac('0x39')][_0xf1ac('0x3a')]||_0xf1ac('0x3b'),'lastPauseAt':moment()[_0xf1ac('0x37')](_0xf1ac('0x33'))});}})[_0xf1ac('0x12')](function(_0x1bbb33){_0x17439b(_0x1bbb33);})[_0xf1ac('0x1d')](function(_0x1b0545){_0x357676(_0x4d85bc[_0xf1ac('0x19')](0x1f4,_0x1b0545[_0xf1ac('0x1b')]));});});};exports[_0xf1ac('0x3f')]=function(_0x567ffa){var _0x2afdb5=this;return new Promise(function(_0x2bf3c1,_0x587827){var _0x11bceb;return db[_0xf1ac('0x29')][_0xf1ac('0x40')]({'where':_0x567ffa[_0xf1ac('0x20')][_0xf1ac('0x22')]||{},'attributes':['id',_0xf1ac('0x30')]})['then'](function(_0xb450df){if(_0xb450df){_0x11bceb=_0xb450df;if(_0x567ffa[_0xf1ac('0x39')][_0xf1ac('0x41')]&&!utils[_0xf1ac('0x42')](_0x567ffa[_0xf1ac('0x39')]['channel'])){throw new Error('Unknown\x20channel');}switch(_0x567ffa['body'][_0xf1ac('0x41')]){case _0xf1ac('0x43'):return db[_0xf1ac('0x2f')][_0xf1ac('0x3e')]({'paused':0x0},{'where':{'UserId':_0x11bceb['id']}})[_0xf1ac('0x12')](function(){return db['MemberReport'][_0xf1ac('0x2a')]({'where':{'channel':_0x567ffa[_0xf1ac('0x39')][_0xf1ac('0x41')],'membername':_0x11bceb[_0xf1ac('0x30')],'type':_0xf1ac('0x31'),'exitAt':null}});})['then'](function(_0x1d972d){if(_0x1d972d){return _0x1d972d[_0xf1ac('0x3e')]({'exitAt':moment()[_0xf1ac('0x37')](_0xf1ac('0x33')),'data2':_0xf1ac('0x44')},{'individualHooks':!![]});}return null;})[_0xf1ac('0x12')](function(){return _0x11bceb[_0xf1ac('0x3e')]({'voicePause':![]});});case'mail':case'chat':case _0xf1ac('0x45'):case'sms':case'openchannel':case _0xf1ac('0x46'):return db[_0xf1ac('0x3c')][_0xf1ac('0x2a')]({'where':{'channel':_0x567ffa['body'][_0xf1ac('0x41')],'membername':_0x11bceb[_0xf1ac('0x30')],'type':_0xf1ac('0x31'),'exitAt':null}})['then'](function(_0x2f15df){return _0x2f15df[_0xf1ac('0x3e')]({'exitAt':moment()[_0xf1ac('0x37')](_0xf1ac('0x33')),'data2':_0xf1ac('0x44')},{'individualHooks':!![]});})[_0xf1ac('0x12')](function(){var _0xee2d59={};_[_0xf1ac('0x47')](_0xee2d59,util[_0xf1ac('0x37')](_0xf1ac('0x48'),_0x567ffa[_0xf1ac('0x39')][_0xf1ac('0x41')],_0xf1ac('0x49')),![]);return _0x11bceb[_0xf1ac('0x3e')](_0xee2d59);});default:return db[_0xf1ac('0x2f')][_0xf1ac('0x3e')]({'paused':0x0},{'where':{'UserId':_0x11bceb['id']}})[_0xf1ac('0x12')](function(){return db[_0xf1ac('0x3c')]['findAll']({'where':{'membername':_0x11bceb['name'],'type':_0xf1ac('0x31'),'exitAt':null}});})[_0xf1ac('0x12')](function(_0x37da84){var _0x472645=[];_0x37da84['forEach'](function(_0x22739c){_0x472645['push'](_0x22739c[_0xf1ac('0x3e')]({'exitAt':moment()[_0xf1ac('0x37')](_0xf1ac('0x33')),'data2':'system'}));});return BPromise[_0xf1ac('0x4a')](_0x472645);})[_0xf1ac('0x12')](function(){return _0x11bceb[_0xf1ac('0x3e')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})[_0xf1ac('0x12')](function(_0xa4e45f){_0x2bf3c1(_0xa4e45f);})[_0xf1ac('0x1d')](function(_0x2216b2){_0x587827(_0x2afdb5[_0xf1ac('0x19')](0x1f4,_0x2216b2[_0xf1ac('0x1b')]));});});};exports['LogoutUser']=function(_0x3ec07d){var _0x3eae7e=this;return new Promise(function(_0xaea34c,_0x12ec9c){var _0x3b8fbc;return db[_0xf1ac('0x29')][_0xf1ac('0x40')]({'where':_0x3ec07d[_0xf1ac('0x20')][_0xf1ac('0x22')]||{},'attributes':['id',_0xf1ac('0x30')]})[_0xf1ac('0x12')](function(_0x4fd7b6){if(_0x4fd7b6){_0x3b8fbc=_0x4fd7b6;return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x3b8fbc[_0xf1ac('0x30')]},'individualHooks':!![]});}})[_0xf1ac('0x12')](function(){if(_0x3b8fbc){return db[_0xf1ac('0x3c')][_0xf1ac('0x1f')]({'where':{'membername':_0x3b8fbc[_0xf1ac('0x30')],'exitAt':null}});}})[_0xf1ac('0x12')](function(_0x500996){if(_0x3b8fbc){if(_0x500996&&_0x500996['length']){var _0x56385b=[];_0x500996[_0xf1ac('0x34')](function(_0x473bd0){_0x56385b[_0xf1ac('0x35')](_0x473bd0['update']({'exitAt':moment()['format'](_0xf1ac('0x33'))}));});return BPromise[_0xf1ac('0x4a')](_0x56385b);}}})['then'](function(){if(_0x3b8fbc){return _0x3b8fbc[_0xf1ac('0x3e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf1ac('0x12')](function(_0x4146ab){_0xaea34c(_0x4146ab);})[_0xf1ac('0x1d')](function(_0x4f977a){_0x12ec9c(_0x3eae7e[_0xf1ac('0x19')](0x1f4,_0x4f977a[_0xf1ac('0x1b')]));});});};exports[_0xf1ac('0x4b')]=function(_0x397af0){var _0x276283=this;return new Promise(function(_0x5839ae,_0x4a612d){var _0x25046c;var _0x5e3262;var _0x3472a2;var _0x15e015;return db[_0xf1ac('0x29')][_0xf1ac('0x40')]({'where':_0x397af0['options'][_0xf1ac('0x22')]||{},'attributes':['id','name',_0xf1ac('0x2c'),_0xf1ac('0x4c'),_0xf1ac('0x4d'),_0xf1ac('0x2d'),_0xf1ac('0x4e'),_0xf1ac('0x2e')]})[_0xf1ac('0x12')](function(_0x538b6b){if(_0x538b6b){_0x25046c=_0x538b6b;_0x15e015=_0x397af0[_0xf1ac('0x39')][_0xf1ac('0x2e')]?_0x397af0['body']['interface']:util[_0xf1ac('0x37')]('SIP/%s',_0x25046c[_0xf1ac('0x30')]);return db[_0xf1ac('0x29')][_0xf1ac('0x4f')]({'where':{'role':_0xf1ac('0x50'),'online':!![],'id':{'$ne':_0x25046c['id']}}});}})[_0xf1ac('0x12')](function(_0x46ad39){if(_0x46ad39){_0x3472a2=_0x46ad39;return require('../../config/license/util')[_0xf1ac('0x51')]();}})[_0xf1ac('0x12')](function(_0x176991){if(_0x176991&&_0x176991['agents']&&_0x3472a2>=_0x176991[_0xf1ac('0x52')]){throw new Error(_0xf1ac('0x53'));}})[_0xf1ac('0x12')](function(){if(_0x25046c){return db[_0xf1ac('0x2f')][_0xf1ac('0x54')]({'where':{'membername':_0x25046c[_0xf1ac('0x30')]},'individualHooks':!![]});}})[_0xf1ac('0x12')](function(){if(_0x25046c){return _0x25046c[_0xf1ac('0x55')]({'raw':!![]});}})[_0xf1ac('0x12')](function(_0x21e4bf){if(_0x25046c){if(_0x21e4bf){var _0x59748a=[];_0x5e3262=_0x21e4bf;if(_0x5e3262[_0xf1ac('0x32')]){for(var _0x3f783d=0x0;_0x3f783d<_0x5e3262[_0xf1ac('0x32')];_0x3f783d++){_0x59748a[_0xf1ac('0x35')](db[_0xf1ac('0x2f')][_0xf1ac('0x56')]({'membername':_0x25046c[_0xf1ac('0x30')],'UserId':_0x25046c['id'],'queue_name':_0x5e3262[_0x3f783d]['name'],'VoiceQueueId':_0x5e3262[_0x3f783d]['id'],'interface':_0x15e015,'paused':_0x25046c[_0xf1ac('0x4e')]||![],'penalty':_0x5e3262[_0x3f783d][_0xf1ac('0x57')]||0x0}));}return BPromise[_0xf1ac('0x4a')](_0x59748a);}}}})[_0xf1ac('0x12')](function(){if(_0x25046c){return db['MemberReport']['findAll']({'where':{'membername':_0x25046c[_0xf1ac('0x30')],'exitAt':null}});}})['then'](function(_0x1e93bc){if(_0x25046c){if(_0x1e93bc&&_0x1e93bc['length']){var _0x22f6f5=[];_0x1e93bc[_0xf1ac('0x34')](function(_0x2bcfff){_0x22f6f5[_0xf1ac('0x35')](_0x2bcfff[_0xf1ac('0x3e')]({'exitAt':moment()[_0xf1ac('0x37')](_0xf1ac('0x33'))}));});return BPromise[_0xf1ac('0x4a')](_0x22f6f5);}}})[_0xf1ac('0x12')](function(_0x51d683){if(_0x25046c){var _0x17e596=[];var _0x3a2936=[];var _0x1cf409=utils['getChannels']();var _0x4cc370={'membername':_0x25046c['name'],'interface':_0x15e015,'enterAt':moment()['format'](_0xf1ac('0x33')),'role':_0x25046c[_0xf1ac('0x2c')],'internal':_0x25046c['internal']};_0x1cf409[_0xf1ac('0x34')](function(_0x152c34){_0x17e596[_0xf1ac('0x35')](_[_0xf1ac('0x58')]({'channel':_0x152c34,'type':_0xf1ac('0x59'),'data1':_0xf1ac('0x5a'),'data2':_0x15e015},_0x4cc370));if(_0x25046c['loginInPause']){_0x3a2936['push'](_[_0xf1ac('0x58')]({'channel':_0x152c34,'type':_0xf1ac('0x31'),'data1':'LOGININPAUSE'},_0x4cc370));}});return db[_0xf1ac('0x3c')][_0xf1ac('0x3d')](_0x17e596[_0xf1ac('0x5b')](_0x3a2936),{'individualHooks':!![]});}})[_0xf1ac('0x12')](function(){if(_0x25046c){return _0x25046c[_0xf1ac('0x3e')]({'online':!![],'lastLoginAt':moment()['format'](_0xf1ac('0x33')),'voicePause':_0x25046c[_0xf1ac('0x4e')]||![],'mailPause':_0x25046c[_0xf1ac('0x4e')]||![],'chatPause':_0x25046c['loginInPause']||![],'faxPause':_0x25046c['loginInPause']||![],'smsPause':_0x25046c[_0xf1ac('0x4e')]||![],'openchannelPause':_0x25046c['loginInPause']||![],'pauseType':_0x25046c[_0xf1ac('0x4e')]?_0xf1ac('0x5c'):null,'lastPauseAt':moment()[_0xf1ac('0x37')](_0xf1ac('0x33')),'interface':_0x15e015});}})[_0xf1ac('0x12')](function(_0x5c2541){_0x5839ae(_0x5c2541);})[_0xf1ac('0x1d')](function(_0x122eae){_0x4a612d(_0x276283[_0xf1ac('0x19')](0x1f4,_0x122eae[_0xf1ac('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 18d6607..0aac3af 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 _0x9e13=['removeListener','register','./user.events','save','update'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9e13,0x1d3));var _0x39e1=function(_0x85906d,_0x338b7e){_0x85906d=_0x85906d-0x0;var _0x155db4=_0x9e13[_0x85906d];return _0x155db4;};'use strict';var UserEvents=require(_0x39e1('0x0'));var events=[_0x39e1('0x1'),'remove',_0x39e1('0x2')];function createListener(_0x1e517e,_0x3458b9){return function(_0x44fe8a){_0x3458b9['emit'](_0x1e517e,_0x44fe8a);};}function removeListener(_0x53fdb4,_0x340d28){return function(){UserEvents[_0x39e1('0x3')](_0x53fdb4,_0x340d28);};}exports[_0x39e1('0x4')]=function(_0x24e57c){for(var _0x47ede7=0x0,_0x3c9749=events['length'];_0x47ede7<_0x3c9749;_0x47ede7++){var _0x235870=events[_0x47ede7];var _0x40c43a=createListener('user:'+_0x235870,_0x24e57c);UserEvents['on'](_0x235870,_0x40c43a);}}; \ No newline at end of file +var _0x7b8a=['length','user:','./user.events','save','update','emit','removeListener','register'];(function(_0x38a045,_0x402d6b){var _0x45c34c=function(_0x2bde36){while(--_0x2bde36){_0x38a045['push'](_0x38a045['shift']());}};_0x45c34c(++_0x402d6b);}(_0x7b8a,0xfa));var _0xa7b8=function(_0x51df00,_0x4ac573){_0x51df00=_0x51df00-0x0;var _0x198328=_0x7b8a[_0x51df00];return _0x198328;};'use strict';var UserEvents=require(_0xa7b8('0x0'));var events=[_0xa7b8('0x1'),'remove',_0xa7b8('0x2')];function createListener(_0x4eb58d,_0x4b9029){return function(_0x187f2d){_0x4b9029[_0xa7b8('0x3')](_0x4eb58d,_0x187f2d);};}function removeListener(_0x4e1748,_0x84bfe5){return function(){UserEvents[_0xa7b8('0x4')](_0x4e1748,_0x84bfe5);};}exports[_0xa7b8('0x5')]=function(_0x1288f7){for(var _0x2052ee=0x0,_0x3e4f94=events[_0xa7b8('0x6')];_0x2052ee<_0x3e4f94;_0x2052ee++){var _0x260f2b=events[_0x2052ee];var _0x45289e=createListener(_0xa7b8('0x7')+_0x260f2b,_0x1288f7);UserEvents['on'](_0x260f2b,_0x45289e);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 47d52f7..905d0fb 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x32e578,_0x4250f6){var _0x3fc8e2=function(_0x5d626a){while(--_0x5d626a){_0x32e578['push'](_0x32e578['shift']());}};_0x3fc8e2(++_0x4250f6);}(_0xedd9,0xfc));var _0x9edd=function(_0x15252f,_0x80473d){_0x15252f=_0x15252f-0x0;var _0x3bedec=_0xedd9[_0x15252f];return _0x3bedec;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1fe14f,_0x36745d){var _0x4c4904=function(_0x346961){while(--_0x346961){_0x1fe14f['push'](_0x1fe14f['shift']());}};_0x4c4904(++_0x36745d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 34edeaf..15a3af4 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 _0x3893=['INTEGER','sequelize','exports'];(function(_0x23783f,_0x58fad3){var _0x5d78a1=function(_0x5a3321){while(--_0x5a3321){_0x23783f['push'](_0x23783f['shift']());}};_0x5d78a1(++_0x58fad3);}(_0x3893,0x1f0));var _0x3389=function(_0x1ba71b,_0xfa5ab){_0x1ba71b=_0x1ba71b-0x0;var _0x386eed=_0x3893[_0x1ba71b];return _0x386eed;};'use strict';var Sequelize=require(_0x3389('0x0'));module[_0x3389('0x1')]={'penalty':{'type':Sequelize[_0x3389('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb97e=['INTEGER','sequelize'];(function(_0xe23cd0,_0xf3b4a1){var _0x2f5cc2=function(_0x4db5b5){while(--_0x4db5b5){_0xe23cd0['push'](_0xe23cd0['shift']());}};_0x2f5cc2(++_0xf3b4a1);}(_0xb97e,0xef));var _0xeb97=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xb97e[_0x581af1];return _0x54c22e;};'use strict';var Sequelize=require(_0xeb97('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xeb97('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 576d56c..dd801d7 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 _0x7fec=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','UserChatQueue','lodash','util','../../config/logger','api'];(function(_0x2efce0,_0x2e2810){var _0x2da247=function(_0x53cdb8){while(--_0x53cdb8){_0x2efce0['push'](_0x2efce0['shift']());}};_0x2da247(++_0x2e2810);}(_0x7fec,0x8c));var _0xc7fe=function(_0x5df08a,_0x3fd2dd){_0x5df08a=_0x5df08a-0x0;var _0x48844d=_0x7fec[_0x5df08a];return _0x48844d;};'use strict';var _=require(_0xc7fe('0x0'));var util=require(_0xc7fe('0x1'));var logger=require(_0xc7fe('0x2'))(_0xc7fe('0x3'));var moment=require(_0xc7fe('0x4'));var BPromise=require(_0xc7fe('0x5'));var rp=require(_0xc7fe('0x6'));var fs=require('fs');var path=require(_0xc7fe('0x7'));var rimraf=require(_0xc7fe('0x8'));var config=require(_0xc7fe('0x9'));var attributes=require('./userChatQueue.attributes');module[_0xc7fe('0xa')]=function(_0x257c02,_0x54d566){return _0x257c02['define'](_0xc7fe('0xb'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x25ae=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userChatQueue.attributes','exports','UserChatQueue','lodash'];(function(_0x229739,_0x45a7de){var _0x3d2640=function(_0x209caf){while(--_0x209caf){_0x229739['push'](_0x229739['shift']());}};_0x3d2640(++_0x45a7de);}(_0x25ae,0x15f));var _0xe25a=function(_0x52ebe9,_0xb754de){_0x52ebe9=_0x52ebe9-0x0;var _0x3693a9=_0x25ae[_0x52ebe9];return _0x3693a9;};'use strict';var _=require(_0xe25a('0x0'));var util=require(_0xe25a('0x1'));var logger=require(_0xe25a('0x2'))(_0xe25a('0x3'));var moment=require(_0xe25a('0x4'));var BPromise=require(_0xe25a('0x5'));var rp=require(_0xe25a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe25a('0x7'));var config=require('../../config/environment');var attributes=require(_0xe25a('0x8'));module[_0xe25a('0x9')]=function(_0x52b777,_0x11ac36){return _0x52b777['define'](_0xe25a('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 3d70708..5de8381 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 _0x4d35=['error','code','message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x184e24,_0x457876){var _0x420fb7=function(_0x31f0cf){while(--_0x31f0cf){_0x184e24['push'](_0x184e24['shift']());}};_0x420fb7(++_0x457876);}(_0x4d35,0x1e9));var _0x54d3=function(_0x487abd,_0x2e3744){_0x487abd=_0x487abd-0x0;var _0x176afa=_0x4d35[_0x487abd];return _0x176afa;};'use strict';var _=require(_0x54d3('0x0'));var util=require(_0x54d3('0x1'));var moment=require('moment');var BPromise=require(_0x54d3('0x2'));var rs=require(_0x54d3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54d3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x54d3('0x5'))(_0x54d3('0x6'));var config=require('../../config/environment');var jayson=require(_0x54d3('0x7'));var client=jayson[_0x54d3('0x8')][_0x54d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x28234c,_0x372fb3,_0x869fe3){return new BPromise(function(_0x396b1e,_0x36e27e){return client[_0x54d3('0xa')](_0x28234c,_0x869fe3)[_0x54d3('0xb')](function(_0xf656a){logger['info'](_0x54d3('0xc'),_0x372fb3,'request\x20sent');logger[_0x54d3('0xd')](_0x54d3('0xe'),_0x372fb3,_0x54d3('0xf'),JSON[_0x54d3('0x10')](_0xf656a));if(_0xf656a[_0x54d3('0x11')]){if(_0xf656a[_0x54d3('0x11')][_0x54d3('0x12')]===0x1f4){logger[_0x54d3('0x11')](_0x54d3('0xc'),_0x372fb3,_0xf656a[_0x54d3('0x11')][_0x54d3('0x13')]);return _0x36e27e(_0xf656a[_0x54d3('0x11')]['message']);}logger[_0x54d3('0x11')](_0x54d3('0xc'),_0x372fb3,_0xf656a[_0x54d3('0x11')][_0x54d3('0x13')]);return _0x396b1e(_0xf656a['error'][_0x54d3('0x13')]);}else{logger[_0x54d3('0x14')](_0x54d3('0xc'),_0x372fb3,'request\x20sent');_0x396b1e(_0xf656a[_0x54d3('0x15')][_0x54d3('0x13')]);}})[_0x54d3('0x16')](function(_0x2f5bc2){logger[_0x54d3('0x11')](_0x54d3('0xc'),_0x372fb3,_0x2f5bc2);_0x36e27e(_0x2f5bc2);});});} \ No newline at end of file +var _0xcd93=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x6c75da,_0x1b96d6){var _0x5f5d21=function(_0x5ef793){while(--_0x5ef793){_0x6c75da['push'](_0x6c75da['shift']());}};_0x5f5d21(++_0x1b96d6);}(_0xcd93,0x73));var _0x3cd9=function(_0x44ada7,_0x18ffdc){_0x44ada7=_0x44ada7-0x0;var _0x41f4a5=_0xcd93[_0x44ada7];return _0x41f4a5;};'use strict';var _=require(_0x3cd9('0x0'));var util=require(_0x3cd9('0x1'));var moment=require(_0x3cd9('0x2'));var BPromise=require(_0x3cd9('0x3'));var rs=require(_0x3cd9('0x4'));var fs=require('fs');var Redis=require(_0x3cd9('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3cd9('0x6'))(_0x3cd9('0x7'));var config=require(_0x3cd9('0x8'));var jayson=require(_0x3cd9('0x9'));var client=jayson['client'][_0x3cd9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55f83b,_0x1c1cb5,_0x5ce9a7){return new BPromise(function(_0x130bba,_0x2cac99){return client[_0x3cd9('0xb')](_0x55f83b,_0x5ce9a7)[_0x3cd9('0xc')](function(_0x8af26c){logger[_0x3cd9('0xd')](_0x3cd9('0xe'),_0x1c1cb5,'request\x20sent');logger[_0x3cd9('0xf')](_0x3cd9('0x10'),_0x1c1cb5,_0x3cd9('0x11'),JSON[_0x3cd9('0x12')](_0x8af26c));if(_0x8af26c[_0x3cd9('0x13')]){if(_0x8af26c[_0x3cd9('0x13')][_0x3cd9('0x14')]===0x1f4){logger[_0x3cd9('0x13')](_0x3cd9('0xe'),_0x1c1cb5,_0x8af26c[_0x3cd9('0x13')][_0x3cd9('0x15')]);return _0x2cac99(_0x8af26c['error'][_0x3cd9('0x15')]);}logger[_0x3cd9('0x13')](_0x3cd9('0xe'),_0x1c1cb5,_0x8af26c['error']['message']);return _0x130bba(_0x8af26c[_0x3cd9('0x13')]['message']);}else{logger[_0x3cd9('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1c1cb5,_0x3cd9('0x11'));_0x130bba(_0x8af26c[_0x3cd9('0x16')][_0x3cd9('0x15')]);}})[_0x3cd9('0x17')](function(_0x416760){logger['error'](_0x3cd9('0xe'),_0x1c1cb5,_0x416760);_0x2cac99(_0x416760);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index b5d5b5d..a222123 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x19d745,_0x20c9d3){var _0x2d5133=function(_0x3d18db){while(--_0x3d18db){_0x19d745['push'](_0x19d745['shift']());}};_0x2d5133(++_0x20c9d3);}(_0x70e0,0x17b));var _0x070e=function(_0x198fea,_0x44b082){_0x198fea=_0x198fea-0x0;var _0x3ddf59=_0x70e0[_0x198fea];return _0x3ddf59;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0xa81310,_0x1656b0){var _0x59c8ee=function(_0xef257f){while(--_0xef257f){_0xa81310['push'](_0xa81310['shift']());}};_0x59c8ee(++_0x1656b0);}(_0xedd9,0xfc));var _0x9edd=function(_0x40454b,_0x18d61f){_0x40454b=_0x40454b-0x0;var _0x22da9a=_0xedd9[_0x40454b];return _0x22da9a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index cc23dff..93e51fc 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 _0x2d12=['sequelize','INTEGER'];(function(_0x1111fb,_0x55211f){var _0x51832d=function(_0x1e3fb8){while(--_0x1e3fb8){_0x1111fb['push'](_0x1111fb['shift']());}};_0x51832d(++_0x55211f);}(_0x2d12,0x1c0));var _0x22d1=function(_0x36a44e,_0x107389){_0x36a44e=_0x36a44e-0x0;var _0x28fb8a=_0x2d12[_0x36a44e];return _0x28fb8a;};'use strict';var Sequelize=require(_0x22d1('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x22d1('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe920=['STRING','exports','INTEGER'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0xe920,0xe8));var _0x0e92=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xe920[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module[_0x0e92('0x0')]={'penalty':{'type':Sequelize[_0x0e92('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x0e92('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x0e92('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8a5a4e2..93f3e2a 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 _0x443f=['path','./userFaxQueue.attributes','exports','UserFaxQueue','lodash','../../config/logger','api','moment','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x443f,0x17e));var _0xf443=function(_0x1fb013,_0x4599cd){_0x1fb013=_0x1fb013-0x0;var _0x2aceda=_0x443f[_0x1fb013];return _0x2aceda;};'use strict';var _=require(_0xf443('0x0'));var util=require('util');var logger=require(_0xf443('0x1'))(_0xf443('0x2'));var moment=require(_0xf443('0x3'));var BPromise=require('bluebird');var rp=require(_0xf443('0x4'));var fs=require('fs');var path=require(_0xf443('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf443('0x6'));module[_0xf443('0x7')]=function(_0x33f069,_0x31b15f){return _0x33f069['define'](_0xf443('0x8'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2832=['./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x34ecd6,_0x38b503){var _0x246cc5=function(_0x371100){while(--_0x371100){_0x34ecd6['push'](_0x34ecd6['shift']());}};_0x246cc5(++_0x38b503);}(_0x2832,0x163));var _0x2283=function(_0x381b6d,_0x3c563f){_0x381b6d=_0x381b6d-0x0;var _0x589bfa=_0x2832[_0x381b6d];return _0x589bfa;};'use strict';var _=require('lodash');var util=require(_0x2283('0x0'));var logger=require(_0x2283('0x1'))(_0x2283('0x2'));var moment=require(_0x2283('0x3'));var BPromise=require(_0x2283('0x4'));var rp=require(_0x2283('0x5'));var fs=require('fs');var path=require(_0x2283('0x6'));var rimraf=require(_0x2283('0x7'));var config=require(_0x2283('0x8'));var attributes=require(_0x2283('0x9'));module[_0x2283('0xa')]=function(_0x2ac33e,_0x3f1d78){return _0x2ac33e['define'](_0x2283('0xb'),attributes,{'tableName':_0x2283('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 cdf0d69..729c822 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 _0x4deb=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0xe8ffa9,_0xd77fe0){var _0x136035=function(_0x156dae){while(--_0x156dae){_0xe8ffa9['push'](_0xe8ffa9['shift']());}};_0x136035(++_0xd77fe0);}(_0x4deb,0x6f));var _0xb4de=function(_0x1781de,_0x5c4b38){_0x1781de=_0x1781de-0x0;var _0x48d7fc=_0x4deb[_0x1781de];return _0x48d7fc;};'use strict';var _=require(_0xb4de('0x0'));var util=require(_0xb4de('0x1'));var moment=require(_0xb4de('0x2'));var BPromise=require(_0xb4de('0x3'));var rs=require(_0xb4de('0x4'));var fs=require('fs');var Redis=require(_0xb4de('0x5'));var db=require(_0xb4de('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4de('0x7'))(_0xb4de('0x8'));var config=require(_0xb4de('0x9'));var jayson=require(_0xb4de('0xa'));var client=jayson[_0xb4de('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b4ee5,_0x283562,_0x1403ba){return new BPromise(function(_0x1e4cf8,_0x1d4ca8){return client[_0xb4de('0xc')](_0x5b4ee5,_0x1403ba)[_0xb4de('0xd')](function(_0xd86575){logger[_0xb4de('0xe')](_0xb4de('0xf'),_0x283562,_0xb4de('0x10'));logger['debug'](_0xb4de('0x11'),_0x283562,_0xb4de('0x10'),JSON[_0xb4de('0x12')](_0xd86575));if(_0xd86575[_0xb4de('0x13')]){if(_0xd86575[_0xb4de('0x13')][_0xb4de('0x14')]===0x1f4){logger['error'](_0xb4de('0xf'),_0x283562,_0xd86575[_0xb4de('0x13')][_0xb4de('0x15')]);return _0x1d4ca8(_0xd86575[_0xb4de('0x13')]['message']);}logger[_0xb4de('0x13')](_0xb4de('0xf'),_0x283562,_0xd86575[_0xb4de('0x13')][_0xb4de('0x15')]);return _0x1e4cf8(_0xd86575[_0xb4de('0x13')][_0xb4de('0x15')]);}else{logger[_0xb4de('0xe')](_0xb4de('0xf'),_0x283562,_0xb4de('0x10'));_0x1e4cf8(_0xd86575['result'][_0xb4de('0x15')]);}})[_0xb4de('0x16')](function(_0x548e55){logger[_0xb4de('0x13')]('UserFaxQueue,\x20%s,\x20%s',_0x283562,_0x548e55);_0x1d4ca8(_0x548e55);});});} \ No newline at end of file +var _0x8c4e=['info','UserFaxQueue,\x20%s,\x20%s','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x59fd79,_0x31a5de){var _0x1b6bab=function(_0x2eab2f){while(--_0x2eab2f){_0x59fd79['push'](_0x59fd79['shift']());}};_0x1b6bab(++_0x31a5de);}(_0x8c4e,0x143));var _0xe8c4=function(_0x296e85,_0x20e0a0){_0x296e85=_0x296e85-0x0;var _0x12c334=_0x8c4e[_0x296e85];return _0x12c334;};'use strict';var _=require(_0xe8c4('0x0'));var util=require(_0xe8c4('0x1'));var moment=require(_0xe8c4('0x2'));var BPromise=require(_0xe8c4('0x3'));var rs=require(_0xe8c4('0x4'));var fs=require('fs');var Redis=require(_0xe8c4('0x5'));var db=require(_0xe8c4('0x6'))['db'];var utils=require(_0xe8c4('0x7'));var logger=require(_0xe8c4('0x8'))(_0xe8c4('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe8c4('0xa')][_0xe8c4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x56aad8,_0x4e6c97,_0x391b26){return new BPromise(function(_0x2777eb,_0x32dea4){return client[_0xe8c4('0xc')](_0x56aad8,_0x391b26)['then'](function(_0x3fcefa){logger[_0xe8c4('0xd')](_0xe8c4('0xe'),_0x4e6c97,'request\x20sent');logger[_0xe8c4('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x4e6c97,'request\x20sent',JSON[_0xe8c4('0x10')](_0x3fcefa));if(_0x3fcefa['error']){if(_0x3fcefa[_0xe8c4('0x11')][_0xe8c4('0x12')]===0x1f4){logger[_0xe8c4('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x4e6c97,_0x3fcefa['error'][_0xe8c4('0x13')]);return _0x32dea4(_0x3fcefa[_0xe8c4('0x11')][_0xe8c4('0x13')]);}logger[_0xe8c4('0x11')](_0xe8c4('0xe'),_0x4e6c97,_0x3fcefa[_0xe8c4('0x11')][_0xe8c4('0x13')]);return _0x2777eb(_0x3fcefa['error'][_0xe8c4('0x13')]);}else{logger[_0xe8c4('0xd')](_0xe8c4('0xe'),_0x4e6c97,'request\x20sent');_0x2777eb(_0x3fcefa[_0xe8c4('0x14')]['message']);}})['catch'](function(_0x70c9bf){logger['error'](_0xe8c4('0xe'),_0x4e6c97,_0x70c9bf);_0x32dea4(_0x70c9bf);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index dc6916d..26242e0 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x412572,_0x37e9e2){var _0x20881f=function(_0x58e4d2){while(--_0x58e4d2){_0x412572['push'](_0x412572['shift']());}};_0x20881f(++_0x37e9e2);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1ed39d,_0x34b481){var _0x501bab=function(_0x662eaa){while(--_0x662eaa){_0x1ed39d['push'](_0x1ed39d['shift']());}};_0x501bab(++_0x34b481);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6fba635..5905ce0 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 _0x8db9=['sequelize','exports','INTEGER'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8db9,0x1c2));var _0x98db=function(_0x5c25c6,_0x1123ec){_0x5c25c6=_0x5c25c6-0x0;var _0x5c492b=_0x8db9[_0x5c25c6];return _0x5c492b;};'use strict';var Sequelize=require(_0x98db('0x0'));module[_0x98db('0x1')]={'penalty':{'type':Sequelize[_0x98db('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3893=['INTEGER','sequelize','exports'];(function(_0x3e9605,_0x5563ad){var _0x4fa938=function(_0x43f0bc){while(--_0x43f0bc){_0x3e9605['push'](_0x3e9605['shift']());}};_0x4fa938(++_0x5563ad);}(_0x3893,0x1f0));var _0x3389=function(_0x38ae35,_0x16c078){_0x38ae35=_0x38ae35-0x0;var _0x4b3e8f=_0x3893[_0x38ae35];return _0x4b3e8f;};'use strict';var Sequelize=require(_0x3389('0x0'));module[_0x3389('0x1')]={'penalty':{'type':Sequelize[_0x3389('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 6c8aa14..06b73d2 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 _0xa0dc=['user_has_mail_queues','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xa0dc,0x135));var _0xca0d=function(_0x3d4bac,_0x5ab2e2){_0x3d4bac=_0x3d4bac-0x0;var _0x23248b=_0xa0dc[_0x3d4bac];return _0x23248b;};'use strict';var _=require(_0xca0d('0x0'));var util=require(_0xca0d('0x1'));var logger=require(_0xca0d('0x2'))(_0xca0d('0x3'));var moment=require('moment');var BPromise=require(_0xca0d('0x4'));var rp=require(_0xca0d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca0d('0x6'));var config=require(_0xca0d('0x7'));var attributes=require('./userMailQueue.attributes');module[_0xca0d('0x8')]=function(_0x2412e4,_0x5e5c3f){return _0x2412e4[_0xca0d('0x9')]('UserMailQueue',attributes,{'tableName':_0xca0d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4c21=['../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x3ec9a0,_0xc54b3d){var _0x33d21b=function(_0x58e7d0){while(--_0x58e7d0){_0x3ec9a0['push'](_0x3ec9a0['shift']());}};_0x33d21b(++_0xc54b3d);}(_0x4c21,0xe9));var _0x14c2=function(_0x301ea6,_0x202cf3){_0x301ea6=_0x301ea6-0x0;var _0x3bd1ae=_0x4c21[_0x301ea6];return _0x3bd1ae;};'use strict';var _=require(_0x14c2('0x0'));var util=require('util');var logger=require(_0x14c2('0x1'))('api');var moment=require(_0x14c2('0x2'));var BPromise=require(_0x14c2('0x3'));var rp=require(_0x14c2('0x4'));var fs=require('fs');var path=require(_0x14c2('0x5'));var rimraf=require(_0x14c2('0x6'));var config=require(_0x14c2('0x7'));var attributes=require(_0x14c2('0x8'));module[_0x14c2('0x9')]=function(_0x20ad89,_0x29186d){return _0x20ad89[_0x14c2('0xa')](_0x14c2('0xb'),attributes,{'tableName':'user_has_mail_queues','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 830fc35..cdac808 100644 --- a/server/api/userMailQueue/userMailQueue.rpc.js +++ b/server/api/userMailQueue/userMailQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x246bcf,_0x103b2f){var _0x2ee5a0=function(_0x35a5e8){while(--_0x35a5e8){_0x246bcf['push'](_0x246bcf['shift']());}};_0x2ee5a0(++_0x103b2f);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('UserMailQueue,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x4eee22,_0x3482df){var _0x553e43=function(_0x4c1ca5){while(--_0x4c1ca5){_0x4eee22['push'](_0x4eee22['shift']());}};_0x553e43(++_0x3482df);}(_0x8ef6,0xf2));var _0x68ef=function(_0x568344,_0x123f80){_0x568344=_0x568344-0x0;var _0x5ecb09=_0x8ef6[_0x568344];return _0x5ecb09;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 5671072..bed3750 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 _0x163b=['./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5a48f7,_0x1a989b){var _0x1447c7=function(_0x327561){while(--_0x327561){_0x5a48f7['push'](_0x5a48f7['shift']());}};_0x1447c7(++_0x1a989b);}(_0x163b,0xa9));var _0xb163=function(_0x99f50a,_0x4fd49f){_0x99f50a=_0x99f50a-0x0;var _0xd82349=_0x163b[_0x99f50a];return _0xd82349;};'use strict';var multer=require(_0xb163('0x0'));var util=require(_0xb163('0x1'));var path=require('path');var timeout=require(_0xb163('0x2'));var express=require(_0xb163('0x3'));var router=express[_0xb163('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb163('0x5'));var interaction=require(_0xb163('0x6'));var config=require('../../config/environment');var controller=require(_0xb163('0x7'));router['post']('/',auth[_0xb163('0x8')](),controller[_0xb163('0x9')]);module[_0xb163('0xa')]=router; \ No newline at end of file +var _0x093a=['../../config/environment','sendUserNotification','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1fa38f,_0x524a01){var _0x344c9c=function(_0x58e4c7){while(--_0x58e4c7){_0x1fa38f['push'](_0x1fa38f['shift']());}};_0x344c9c(++_0x524a01);}(_0x093a,0x116));var _0xa093=function(_0x289a67,_0x1e5a3c){_0x289a67=_0x289a67-0x0;var _0x572b49=_0x093a[_0x289a67];return _0x572b49;};'use strict';var multer=require(_0xa093('0x0'));var util=require(_0xa093('0x1'));var path=require('path');var timeout=require(_0xa093('0x2'));var express=require(_0xa093('0x3'));var router=express[_0xa093('0x4')]();var fs_extra=require(_0xa093('0x5'));var auth=require(_0xa093('0x6'));var interaction=require(_0xa093('0x7'));var config=require(_0xa093('0x8'));var controller=require('./userNotification.controller');router['post']('/',auth['isAuthenticated'](),controller[_0xa093('0x9')]);module[_0xa093('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 9e2ed4d..a33b8b9 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 _0x9058=['exports','TEXT','STRING'];(function(_0x1e46b6,_0x9ee2b9){var _0x227579=function(_0x167235){while(--_0x167235){_0x1e46b6['push'](_0x1e46b6['shift']());}};_0x227579(++_0x9ee2b9);}(_0x9058,0x9f));var _0x8905=function(_0xd7fb96,_0xd48af3){_0xd7fb96=_0xd7fb96-0x0;var _0x35866c=_0x9058[_0xd7fb96];return _0x35866c;};'use strict';var Sequelize=require('sequelize');module[_0x8905('0x0')]={'body':{'type':Sequelize[_0x8905('0x1')]},'senderName':{'type':Sequelize[_0x8905('0x2')]},'recipientsId':{'type':Sequelize[_0x8905('0x1')]},'recipientsDescription':{'type':Sequelize[_0x8905('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x8635=['STRING','TEXT','BOOLEAN','sequelize'];(function(_0x17926b,_0x4ab842){var _0x1f9c80=function(_0x48db4f){while(--_0x48db4f){_0x17926b['push'](_0x17926b['shift']());}};_0x1f9c80(++_0x4ab842);}(_0x8635,0x103));var _0x5863=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0x8635[_0x373dee];return _0x46798f;};'use strict';var Sequelize=require(_0x5863('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x5863('0x1')]},'recipientsId':{'type':Sequelize[_0x5863('0x2')]},'recipientsDescription':{'type':Sequelize[_0x5863('0x1')]},'beep':{'type':Sequelize[_0x5863('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index d1bca64..ffd72c1 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 _0x064e=['team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','sortBy','join','create','forEach','emit','userNotification:send','catch','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace','flatten','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','Content-Range','apply','save','update','then','destroy','error','name','send','body','hasOwnProperty','text','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x064e,0x13c));var _0xe064=function(_0x1b98a9,_0x4197f3){_0x1b98a9=_0x1b98a9-0x0;var _0x53af62=_0x064e[_0x1b98a9];return _0x53af62;};'use strict';var emlformat=require(_0xe064('0x0'));var rimraf=require(_0xe064('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe064('0x2'));var rp=require(_0xe064('0x3'));var moment=require(_0xe064('0x4'));var BPromise=require(_0xe064('0x5'));var Mustache=require(_0xe064('0x6'));var util=require(_0xe064('0x7'));var path=require(_0xe064('0x8'));var sox=require('sox');var csv=require(_0xe064('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe064('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe064('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe064('0xc'));var Redis=require(_0xe064('0xd'));var authService=require(_0xe064('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xe064('0xf'));var hardwareService=require(_0xe064('0x10'));var logger=require(_0xe064('0x11'))(_0xe064('0x12'));var utils=require(_0xe064('0x13'));var config=require(_0xe064('0x14'));var licenseUtil=require(_0xe064('0x15'));var db=require(_0xe064('0x16'))['db'];config['redis']=_[_0xe064('0x17')](config[_0xe064('0x18')],{'host':_0xe064('0x19'),'port':0x18eb});var socket=require(_0xe064('0x1a'))(new Redis(config[_0xe064('0x18')]));require(_0xe064('0x1b'))[_0xe064('0x1c')](socket);function respondWithStatusCode(_0x2ed9f4,_0x39188c){_0x39188c=_0x39188c||0xcc;return function(_0x2422e6){if(_0x2422e6){return _0x2ed9f4[_0xe064('0x1d')](_0x39188c);}return _0x2ed9f4[_0xe064('0x1e')](_0x39188c)[_0xe064('0x1f')]();};}function respondWithResult(_0x592d26,_0x160941){_0x160941=_0x160941||0xc8;return function(_0x36ef9f){if(_0x36ef9f){return _0x592d26[_0xe064('0x1e')](_0x160941)[_0xe064('0x20')](_0x36ef9f);}};}function respondWithFilteredResult(_0x254ded,_0x4d406c){return function(_0x37f9c8){if(_0x37f9c8){var _0x201e17=typeof _0x4d406c['offset']===_0xe064('0x21')&&typeof _0x4d406c['limit']===_0xe064('0x21');var _0x5c6915=_0x37f9c8[_0xe064('0x22')];var _0x2f601e=_0x201e17?0x0:_0x4d406c[_0xe064('0x23')];var _0x33bb10=_0x201e17?_0x37f9c8[_0xe064('0x22')]:_0x4d406c[_0xe064('0x23')]+_0x4d406c['limit'];var _0x5bbb48;if(_0x33bb10>=_0x5c6915){_0x33bb10=_0x5c6915;_0x5bbb48=0xc8;}else{_0x5bbb48=0xce;}_0x254ded[_0xe064('0x1e')](_0x5bbb48);return _0x254ded['set'](_0xe064('0x24'),_0x2f601e+'-'+_0x33bb10+'/'+_0x5c6915)[_0xe064('0x20')](_0x37f9c8);}return null;};}function patchUpdates(_0x130225){return function(_0x7d520){try{jsonpatch[_0xe064('0x25')](_0x7d520,_0x130225,!![]);}catch(_0x3e0ff3){return BPromise['reject'](_0x3e0ff3);}return _0x7d520[_0xe064('0x26')]();};}function saveUpdates(_0x3940e9,_0x5f3b8c){return function(_0x164ca4){if(_0x164ca4){return _0x164ca4[_0xe064('0x27')](_0x3940e9)[_0xe064('0x28')](function(_0x3297c4){return _0x3297c4;});}return null;};}function removeEntity(_0x4aa7f6,_0x22744a){return function(_0x2d09f6){if(_0x2d09f6){return _0x2d09f6[_0xe064('0x29')]()[_0xe064('0x28')](function(){_0x4aa7f6[_0xe064('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ad49a,_0x263459){return function(_0x4cbe4f){if(!_0x4cbe4f){_0x2ad49a[_0xe064('0x1d')](0x194);}return _0x4cbe4f;};}function handleError(_0x2cad60,_0x949fdf){_0x949fdf=_0x949fdf||0x1f4;return function(_0x59231d){logger[_0xe064('0x2a')](_0x59231d['stack']);if(_0x59231d['name']){delete _0x59231d[_0xe064('0x2b')];}_0x2cad60['status'](_0x949fdf)[_0xe064('0x2c')](_0x59231d);};}exports['sendUserNotification']=function(_0xa75df8,_0x389482,_0x2f5aeb){if(!_0xa75df8[_0xe064('0x2d')][_0xe064('0x2e')](_0xe064('0x2f'))&&!_0xa75df8[_0xe064('0x2d')][_0xe064('0x2e')]('TemplateId')){throw new db[(_0xe064('0x30'))][(_0xe064('0x31'))](_0xe064('0x32'));}else{if(_0xa75df8[_0xe064('0x2d')]['hasOwnProperty'](_0xe064('0x33'))&&!_0xa75df8[_0xe064('0x2d')]['hasOwnProperty'](_0xe064('0x34'))){throw new db[(_0xe064('0x30'))]['ValidationError'](_0xe064('0x35'));}if(!_0xa75df8[_0xe064('0x2d')]['hasOwnProperty'](_0xe064('0x36'))){throw new db[(_0xe064('0x30'))][(_0xe064('0x31'))](_0xe064('0x37'));}else{try{var _0x453130=JSON[_0xe064('0x38')](_0xa75df8[_0xe064('0x2d')]['recipients']);}catch(_0x27e7d7){logger[_0xe064('0x2a')](_0x27e7d7);throw new db[(_0xe064('0x30'))][(_0xe064('0x31'))](_0xe064('0x39'));}var _0x475c1d=[_0xe064('0x3a'),'faxqueue',_0xe064('0x3b'),_0xe064('0x3c'),_0xe064('0x3d'),_0xe064('0x3e'),_0xe064('0x3f'),_0xe064('0x40'),_0xe064('0x41')];if(_[_0xe064('0x42')](_0x453130,function(_0x16107e){return!_[_0xe064('0x43')](_0x475c1d,_0x16107e[_0xe064('0x44')]['toLowerCase']());})){throw new db[(_0xe064('0x30'))]['ValidationError'](_0xe064('0x45'));}}}var _0x442c26={};_0x442c26[_0xe064('0x46')]=_0xa75df8[_0xe064('0x2d')][_0xe064('0x2e')](_0xe064('0x46'))?_0xa75df8[_0xe064('0x2d')]['senderName']:_0xa75df8['user'][_0xe064('0x47')];_0x442c26['recipientsDescription']=_[_0xe064('0x48')](_0xa75df8[_0xe064('0x2d')]['recipientsDescription'])?null:_0xa75df8['body'][_0xe064('0x49')];_0x442c26['beep']=_0xa75df8['body'][_0xe064('0x4a')]||![];_0x442c26[_0xe064('0x4b')]=_0xa75df8[_0xe064('0x41')]['id'];return getContent(_0xa75df8[_0xe064('0x2d')])[_0xe064('0x28')](function(_0xc6a1ba){_0x442c26[_0xe064('0x2d')]=_0xc6a1ba;return getRecipients(_0x453130);})[_0xe064('0x28')](function(_0x17de6e){_0x442c26['recipientsId']=_[_0xe064('0x4c')](_0x17de6e)[_0xe064('0x4d')](',');return db['sequelize']['transaction'](function(_0x339bd1){return db['UserNotification'][_0xe064('0x4e')](_0x442c26,{'raw':!![],'transaction':_0x339bd1})[_0xe064('0x28')](function(_0x2e02d5){var _0xeb1be6={'sender':_0x442c26[_0xe064('0x46')],'description':_0x442c26[_0xe064('0x49')],'content':_0x442c26[_0xe064('0x2d')],'beep':_0x442c26['beep']};_0x17de6e[_0xe064('0x4f')](function(_0x1c365b){_0xeb1be6['recipient']=_0x1c365b;socket[_0xe064('0x50')](_0xe064('0x51'),_0xeb1be6);});return _0x2e02d5;});});})[_0xe064('0x28')](respondWithResult(_0x389482,0xc9))[_0xe064('0x52')](handleError(_0x389482,null));};function getContent(_0x5efd68){return new BPromise(function(_0xcab789,_0x2fd5f7){if(_0x5efd68[_0xe064('0x2f')]){_0xcab789(_0x5efd68[_0xe064('0x2f')]);return;}return db['Template'][_0xe064('0x53')]({'attributes':[_0xe064('0x54')],'where':{'id':_0x5efd68[_0xe064('0x33')]},'raw':!![]})[_0xe064('0x28')](function(_0x1a8cba){if(!_0x1a8cba)throw new db[(_0xe064('0x30'))][(_0xe064('0x31'))](_0xe064('0x55'));var _0x1d9828=Mustache[_0xe064('0x56')](_0x1a8cba[_0xe064('0x54')],_0x5efd68[_0xe064('0x34')]);_0xcab789(_0x1d9828);})['catch'](function(_0x5dbd94){_0x2fd5f7(_0x5dbd94);});});}function getRecipients(_0x1f88a5){return new BPromise(function(_0x1856df,_0x5c30a7){var _0x1c31fa=[];var _0x281b93=[];_0x1f88a5[_0xe064('0x4f')](function(_0x388e19){var _0x46724b=_[_0xe064('0x57')](_0x388e19[_0xe064('0x44')]['toLowerCase']());if(_0x46724b===_0xe064('0x58')){_0x1c31fa=_[_0xe064('0x59')](_0x1c31fa,_0x388e19[_0xe064('0x5a')]);}else{if(_['includes'](_0x46724b,_0xe064('0x5b')))_0x46724b=_0x46724b[_0xe064('0x5c')]('queue','Queue');_0x388e19[_0xe064('0x5a')]['forEach'](function(_0x3047a4){_0x281b93['push'](getAgents(_0x46724b,_0x3047a4));});}});return BPromise['all'](_0x281b93)['then'](function(_0x224bba){_0x1c31fa=_[_0xe064('0x59')](_0x1c31fa,_[_0xe064('0x5d')](_0x224bba));_0x1856df(_0x1c31fa);})[_0xe064('0x52')](function(_0x5411c0){_0x5c30a7(_0x5411c0);});});}function getAgents(_0xa270b8,_0x3be179){return new BPromise(function(_0xf206d0,_0x28506c){return db[_0xa270b8]['findOne']({'where':{'id':_0x3be179}})[_0xe064('0x28')](function(_0x455e61){return _0x455e61[_0xe064('0x5e')]({'attributes':['id'],'raw':!![]})[_0xe064('0x28')](function(_0x32d6f5){var _0x2ee4f7=_['map'](_0x32d6f5,'id');_0xf206d0(_0x2ee4f7);});})[_0xe064('0x52')](function(_0x7383be){_0x28506c(_0x7383be);});});} \ No newline at end of file +var _0xc5a2=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','mailqueue','openchannelqueue','voicequeue','team','user','some','includes','model','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','toLowerCase','User','union','ids','queue','push','all','flatten','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse'];(function(_0x546e5f,_0x17bcc3){var _0x46804c=function(_0x12ad03){while(--_0x12ad03){_0x546e5f['push'](_0x546e5f['shift']());}};_0x46804c(++_0x17bcc3);}(_0xc5a2,0xc1));var _0x2c5a=function(_0x1fbf96,_0x3ee22c){_0x1fbf96=_0x1fbf96-0x0;var _0x307f51=_0xc5a2[_0x1fbf96];return _0x307f51;};'use strict';var emlformat=require(_0x2c5a('0x0'));var rimraf=require(_0x2c5a('0x1'));var zipdir=require(_0x2c5a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c5a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2c5a('0x4'));var util=require(_0x2c5a('0x5'));var path=require(_0x2c5a('0x6'));var sox=require(_0x2c5a('0x7'));var csv=require('to-csv');var ejs=require(_0x2c5a('0x8'));var fs=require('fs');var fs_extra=require(_0x2c5a('0x9'));var _=require('lodash');var squel=require(_0x2c5a('0xa'));var crypto=require(_0x2c5a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2c5a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2c5a('0xd'));var Papa=require(_0x2c5a('0xe'));var Redis=require(_0x2c5a('0xf'));var authService=require(_0x2c5a('0x10'));var qs=require(_0x2c5a('0x11'));var as=require(_0x2c5a('0x12'));var hardwareService=require(_0x2c5a('0x13'));var logger=require(_0x2c5a('0x14'))(_0x2c5a('0x15'));var utils=require(_0x2c5a('0x16'));var config=require(_0x2c5a('0x17'));var licenseUtil=require(_0x2c5a('0x18'));var db=require(_0x2c5a('0x19'))['db'];config['redis']=_[_0x2c5a('0x1a')](config[_0x2c5a('0x1b')],{'host':_0x2c5a('0x1c'),'port':0x18eb});var socket=require(_0x2c5a('0x1d'))(new Redis(config[_0x2c5a('0x1b')]));require(_0x2c5a('0x1e'))[_0x2c5a('0x1f')](socket);function respondWithStatusCode(_0x45d581,_0x17e564){_0x17e564=_0x17e564||0xcc;return function(_0x225d39){if(_0x225d39){return _0x45d581[_0x2c5a('0x20')](_0x17e564);}return _0x45d581[_0x2c5a('0x21')](_0x17e564)['end']();};}function respondWithResult(_0x547b42,_0x2f295c){_0x2f295c=_0x2f295c||0xc8;return function(_0x28498b){if(_0x28498b){return _0x547b42[_0x2c5a('0x21')](_0x2f295c)['json'](_0x28498b);}};}function respondWithFilteredResult(_0x1d9489,_0xc63319){return function(_0x48b593){if(_0x48b593){var _0x71d306=typeof _0xc63319[_0x2c5a('0x22')]===_0x2c5a('0x23')&&typeof _0xc63319[_0x2c5a('0x24')]===_0x2c5a('0x23');var _0x5dca98=_0x48b593[_0x2c5a('0x25')];var _0x3c7094=_0x71d306?0x0:_0xc63319['offset'];var _0x3e49e7=_0x71d306?_0x48b593[_0x2c5a('0x25')]:_0xc63319[_0x2c5a('0x22')]+_0xc63319[_0x2c5a('0x24')];var _0x58437c;if(_0x3e49e7>=_0x5dca98){_0x3e49e7=_0x5dca98;_0x58437c=0xc8;}else{_0x58437c=0xce;}_0x1d9489['status'](_0x58437c);return _0x1d9489[_0x2c5a('0x26')](_0x2c5a('0x27'),_0x3c7094+'-'+_0x3e49e7+'/'+_0x5dca98)['json'](_0x48b593);}return null;};}function patchUpdates(_0x54a1de){return function(_0x1cffa0){try{jsonpatch[_0x2c5a('0x28')](_0x1cffa0,_0x54a1de,!![]);}catch(_0xc2d3e3){return BPromise[_0x2c5a('0x29')](_0xc2d3e3);}return _0x1cffa0[_0x2c5a('0x2a')]();};}function saveUpdates(_0x45448e,_0x34d48f){return function(_0x9b2e01){if(_0x9b2e01){return _0x9b2e01[_0x2c5a('0x2b')](_0x45448e)[_0x2c5a('0x2c')](function(_0x42baca){return _0x42baca;});}return null;};}function removeEntity(_0x141b0d,_0x3b03d3){return function(_0x19d25d){if(_0x19d25d){return _0x19d25d[_0x2c5a('0x2d')]()[_0x2c5a('0x2c')](function(){_0x141b0d[_0x2c5a('0x21')](0xcc)[_0x2c5a('0x2e')]();});}};}function handleEntityNotFound(_0x16c36d,_0x160a6f){return function(_0x4f46e8){if(!_0x4f46e8){_0x16c36d[_0x2c5a('0x20')](0x194);}return _0x4f46e8;};}function handleError(_0x5c36db,_0x43d870){_0x43d870=_0x43d870||0x1f4;return function(_0x50d912){logger[_0x2c5a('0x2f')](_0x50d912[_0x2c5a('0x30')]);if(_0x50d912[_0x2c5a('0x31')]){delete _0x50d912[_0x2c5a('0x31')];}_0x5c36db['status'](_0x43d870)[_0x2c5a('0x32')](_0x50d912);};}exports[_0x2c5a('0x33')]=function(_0x57a99d,_0x20c6a6,_0x5e1797){if(!_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x35')]('text')&&!_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x35')]('TemplateId')){throw new db[(_0x2c5a('0x36'))][(_0x2c5a('0x37'))](_0x2c5a('0x38'));}else{if(_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x35')](_0x2c5a('0x39'))&&!_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x35')](_0x2c5a('0x3a'))){throw new db[(_0x2c5a('0x36'))][(_0x2c5a('0x37'))](_0x2c5a('0x3b'));}if(!_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x35')](_0x2c5a('0x3c'))){throw new db[(_0x2c5a('0x36'))][(_0x2c5a('0x37'))](_0x2c5a('0x3d'));}else{try{var _0x227b7f=JSON[_0x2c5a('0x3e')](_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x3c')]);}catch(_0x59ceb3){logger[_0x2c5a('0x2f')](_0x59ceb3);throw new db[(_0x2c5a('0x36'))][(_0x2c5a('0x37'))](_0x2c5a('0x3f'));}var _0x1aed65=['chatqueue','faxqueue',_0x2c5a('0x40'),_0x2c5a('0x41'),'smsqueue',_0x2c5a('0x42'),'whatsappqueue',_0x2c5a('0x43'),_0x2c5a('0x44')];if(_[_0x2c5a('0x45')](_0x227b7f,function(_0x5009dd){return!_[_0x2c5a('0x46')](_0x1aed65,_0x5009dd[_0x2c5a('0x47')]['toLowerCase']());})){throw new db[(_0x2c5a('0x36'))][(_0x2c5a('0x37'))](_0x2c5a('0x48'));}}}var _0x19effb={};_0x19effb[_0x2c5a('0x49')]=_0x57a99d['body']['hasOwnProperty'](_0x2c5a('0x49'))?_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x49')]:_0x57a99d[_0x2c5a('0x44')][_0x2c5a('0x4a')];_0x19effb[_0x2c5a('0x4b')]=_[_0x2c5a('0x4c')](_0x57a99d[_0x2c5a('0x34')][_0x2c5a('0x4b')])?null:_0x57a99d['body']['recipientsDescription'];_0x19effb[_0x2c5a('0x4d')]=_0x57a99d['body'][_0x2c5a('0x4d')]||![];_0x19effb[_0x2c5a('0x4e')]=_0x57a99d['user']['id'];return getContent(_0x57a99d[_0x2c5a('0x34')])[_0x2c5a('0x2c')](function(_0x8969f2){_0x19effb[_0x2c5a('0x34')]=_0x8969f2;return getRecipients(_0x227b7f);})[_0x2c5a('0x2c')](function(_0x5719dd){_0x19effb['recipientsId']=_[_0x2c5a('0x4f')](_0x5719dd)[_0x2c5a('0x50')](',');return db[_0x2c5a('0x51')][_0x2c5a('0x52')](function(_0x3d1bcf){return db[_0x2c5a('0x53')][_0x2c5a('0x54')](_0x19effb,{'raw':!![],'transaction':_0x3d1bcf})[_0x2c5a('0x2c')](function(_0x4c008d){var _0x1a276c={'sender':_0x19effb[_0x2c5a('0x49')],'description':_0x19effb['recipientsDescription'],'content':_0x19effb[_0x2c5a('0x34')],'beep':_0x19effb[_0x2c5a('0x4d')]};_0x5719dd[_0x2c5a('0x55')](function(_0x468a8e){_0x1a276c[_0x2c5a('0x56')]=_0x468a8e;socket[_0x2c5a('0x57')](_0x2c5a('0x58'),_0x1a276c);});return _0x4c008d;});});})[_0x2c5a('0x2c')](respondWithResult(_0x20c6a6,0xc9))[_0x2c5a('0x59')](handleError(_0x20c6a6,null));};function getContent(_0x17e6a2){return new BPromise(function(_0x25bfd7,_0x54fde7){if(_0x17e6a2[_0x2c5a('0x5a')]){_0x25bfd7(_0x17e6a2[_0x2c5a('0x5a')]);return;}return db[_0x2c5a('0x5b')][_0x2c5a('0x5c')]({'attributes':['html'],'where':{'id':_0x17e6a2[_0x2c5a('0x39')]},'raw':!![]})[_0x2c5a('0x2c')](function(_0x12007f){if(!_0x12007f)throw new db[(_0x2c5a('0x36'))]['ValidationError'](_0x2c5a('0x5d'));var _0x2b4e5f=Mustache['render'](_0x12007f[_0x2c5a('0x5e')],_0x17e6a2[_0x2c5a('0x3a')]);_0x25bfd7(_0x2b4e5f);})['catch'](function(_0x5a696c){_0x54fde7(_0x5a696c);});});}function getRecipients(_0x4303db){return new BPromise(function(_0x4e0586,_0x36c969){var _0x1d5080=[];var _0x3f6c1f=[];_0x4303db[_0x2c5a('0x55')](function(_0x552ab3){var _0x3a87b8=_['startCase'](_0x552ab3[_0x2c5a('0x47')][_0x2c5a('0x5f')]());if(_0x3a87b8===_0x2c5a('0x60')){_0x1d5080=_[_0x2c5a('0x61')](_0x1d5080,_0x552ab3[_0x2c5a('0x62')]);}else{if(_[_0x2c5a('0x46')](_0x3a87b8,_0x2c5a('0x63')))_0x3a87b8=_0x3a87b8['replace'](_0x2c5a('0x63'),'Queue');_0x552ab3[_0x2c5a('0x62')][_0x2c5a('0x55')](function(_0x33535e){_0x3f6c1f[_0x2c5a('0x64')](getAgents(_0x3a87b8,_0x33535e));});}});return BPromise[_0x2c5a('0x65')](_0x3f6c1f)[_0x2c5a('0x2c')](function(_0x5e5d0b){_0x1d5080=_[_0x2c5a('0x61')](_0x1d5080,_[_0x2c5a('0x66')](_0x5e5d0b));_0x4e0586(_0x1d5080);})[_0x2c5a('0x59')](function(_0x289a5a){_0x36c969(_0x289a5a);});});}function getAgents(_0x48e50e,_0x497ec5){return new BPromise(function(_0x202cdd,_0x4db04f){return db[_0x48e50e][_0x2c5a('0x5c')]({'where':{'id':_0x497ec5}})['then'](function(_0x28a509){return _0x28a509[_0x2c5a('0x67')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2c50ad){var _0x429c3a=_['map'](_0x2c50ad,'id');_0x202cdd(_0x429c3a);});})['catch'](function(_0x5f15eb){_0x4db04f(_0x5f15eb);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 703f345..24af851 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 _0x20bf=['update','remove','emit','hook','events','../../mysqldb','UserNotification','setMaxListeners','save'];(function(_0x2f73b4,_0x1e2a80){var _0x43b3c4=function(_0x539d10){while(--_0x539d10){_0x2f73b4['push'](_0x2f73b4['shift']());}};_0x43b3c4(++_0x1e2a80);}(_0x20bf,0x151));var _0xf20b=function(_0x124327,_0x5f0b1b){_0x124327=_0x124327-0x0;var _0x3b3911=_0x20bf[_0x124327];return _0x3b3911;};'use strict';var EventEmitter=require(_0xf20b('0x0'));var UserNotification=require(_0xf20b('0x1'))['db'][_0xf20b('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf20b('0x3')](0x0);var events={'afterCreate':_0xf20b('0x4'),'afterUpdate':_0xf20b('0x5'),'afterDestroy':_0xf20b('0x6')};function emitEvent(_0x41d1b3){return function(_0x1416c5,_0x3172d8,_0x3c0f10){UserNotificationEvents['emit'](_0x41d1b3+':'+_0x1416c5['id'],_0x1416c5);UserNotificationEvents[_0xf20b('0x7')](_0x41d1b3,_0x1416c5);_0x3c0f10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xf20b('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x4741=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification'];(function(_0xb8ef9,_0x391559){var _0x48831a=function(_0x258ed7){while(--_0x258ed7){_0xb8ef9['push'](_0xb8ef9['shift']());}};_0x48831a(++_0x391559);}(_0x4741,0x1b6));var _0x1474=function(_0x1e730e,_0x1bed73){_0x1e730e=_0x1e730e-0x0;var _0x46c191=_0x4741[_0x1e730e];return _0x46c191;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x1474('0x0'))['db'][_0x1474('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1474('0x2'),'afterDestroy':_0x1474('0x3')};function emitEvent(_0x53707f){return function(_0xea07fc,_0x39ae7b,_0x541385){UserNotificationEvents[_0x1474('0x4')](_0x53707f+':'+_0xea07fc['id'],_0xea07fc);UserNotificationEvents[_0x1474('0x4')](_0x53707f,_0xea07fc);_0x541385(null);};}for(var e in events){if(events[_0x1474('0x5')](e)){var event=events[e];UserNotification[_0x1474('0x6')](e,emitEvent(event));}}module[_0x1474('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index dc0c4f9..691e659 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 _0xfa19=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xfa19,0x15c));var _0x9fa1=function(_0x1ce970,_0x3152b3){_0x1ce970=_0x1ce970-0x0;var _0x46f1c7=_0xfa19[_0x1ce970];return _0x46f1c7;};'use strict';var _=require(_0x9fa1('0x0'));var util=require(_0x9fa1('0x1'));var logger=require(_0x9fa1('0x2'))(_0x9fa1('0x3'));var moment=require(_0x9fa1('0x4'));var BPromise=require(_0x9fa1('0x5'));var rp=require(_0x9fa1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9fa1('0x7'));var config=require(_0x9fa1('0x8'));var attributes=require(_0x9fa1('0x9'));module[_0x9fa1('0xa')]=function(_0x20be4c,_0x5435d3){return _0x20be4c['define'](_0x9fa1('0xb'),attributes,{'tableName':_0x9fa1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9fa1('0xd')});}; \ No newline at end of file +var _0x13fb=['lodash','util','moment','request-promise','rimraf','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0x13fb,0xa0));var _0xb13f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x13fb[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb13f('0x0'));var util=require(_0xb13f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb13f('0x2'));var BPromise=require('bluebird');var rp=require(_0xb13f('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb13f('0x4'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x419695,_0x2888de){return _0x419695[_0xb13f('0x5')](_0xb13f('0x6'),attributes,{'tableName':_0xb13f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb13f('0x8'),'collate':_0xb13f('0x9')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9ab7721..833d0cc 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 _0xbdac=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','./userNotification.socket','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','moment'];(function(_0x2b91ac,_0x310741){var _0xe88814=function(_0x59c51b){while(--_0x59c51b){_0x2b91ac['push'](_0x2b91ac['shift']());}};_0xe88814(++_0x310741);}(_0xbdac,0x1d3));var _0xcbda=function(_0xf798de,_0x27e97c){_0xf798de=_0xf798de-0x0;var _0x6b7752=_0xbdac[_0xf798de];return _0x6b7752;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcbda('0x0'));var BPromise=require(_0xcbda('0x1'));var rs=require(_0xcbda('0x2'));var fs=require('fs');var Redis=require(_0xcbda('0x3'));var db=require(_0xcbda('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbda('0x5'))(_0xcbda('0x6'));var config=require(_0xcbda('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcbda('0x8')]({'port':0x232a});config[_0xcbda('0x9')]=_[_0xcbda('0xa')](config[_0xcbda('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xcbda('0xb'))(new Redis(config[_0xcbda('0x9')]));require(_0xcbda('0xc'))[_0xcbda('0xd')](socket);function respondWithRpcPromise(_0x31021d,_0x21c8e1,_0x10f47a){return new BPromise(function(_0x3f9b0c,_0x1b06bc){return client[_0xcbda('0xe')](_0x31021d,_0x10f47a)[_0xcbda('0xf')](function(_0x13809f){logger[_0xcbda('0x10')](_0xcbda('0x11'),_0x21c8e1,'request\x20sent');logger[_0xcbda('0x12')](_0xcbda('0x13'),_0x21c8e1,_0xcbda('0x14'),JSON['stringify'](_0x13809f));if(_0x13809f[_0xcbda('0x15')]){if(_0x13809f['error'][_0xcbda('0x16')]===0x1f4){logger[_0xcbda('0x15')](_0xcbda('0x11'),_0x21c8e1,_0x13809f[_0xcbda('0x15')][_0xcbda('0x17')]);return _0x1b06bc(_0x13809f[_0xcbda('0x15')][_0xcbda('0x17')]);}logger[_0xcbda('0x15')](_0xcbda('0x11'),_0x21c8e1,_0x13809f[_0xcbda('0x15')]['message']);return _0x3f9b0c(_0x13809f['error']['message']);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x21c8e1,'request\x20sent');_0x3f9b0c(_0x13809f[_0xcbda('0x18')]['message']);}})[_0xcbda('0x19')](function(_0x49b0ba){logger[_0xcbda('0x15')](_0xcbda('0x11'),_0x21c8e1,_0x49b0ba);_0x1b06bc(_0x49b0ba);});});} \ No newline at end of file +var _0x2bba=['defaults','localhost','./userNotification.socket','register','request','info','UserNotification,\x20%s,\x20%s','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x3b1aad,_0x10f875){var _0x457e98=function(_0xdd46dd){while(--_0xdd46dd){_0x3b1aad['push'](_0x3b1aad['shift']());}};_0x457e98(++_0x10f875);}(_0x2bba,0x90));var _0xa2bb=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2bba[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xa2bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2bb('0x1'));var rs=require(_0xa2bb('0x2'));var fs=require('fs');var Redis=require(_0xa2bb('0x3'));var db=require(_0xa2bb('0x4'))['db'];var utils=require(_0xa2bb('0x5'));var logger=require('../../config/logger')(_0xa2bb('0x6'));var config=require(_0xa2bb('0x7'));var jayson=require(_0xa2bb('0x8'));var client=jayson[_0xa2bb('0x9')][_0xa2bb('0xa')]({'port':0x232a});config[_0xa2bb('0xb')]=_[_0xa2bb('0xc')](config[_0xa2bb('0xb')],{'host':_0xa2bb('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2bb('0xb')]));require(_0xa2bb('0xe'))[_0xa2bb('0xf')](socket);function respondWithRpcPromise(_0x2eb468,_0x15373d,_0x239314){return new BPromise(function(_0xa258f1,_0x5bc089){return client[_0xa2bb('0x10')](_0x2eb468,_0x239314)['then'](function(_0x38a620){logger[_0xa2bb('0x11')](_0xa2bb('0x12'),_0x15373d,'request\x20sent');logger['debug'](_0xa2bb('0x13'),_0x15373d,'request\x20sent',JSON[_0xa2bb('0x14')](_0x38a620));if(_0x38a620[_0xa2bb('0x15')]){if(_0x38a620[_0xa2bb('0x15')][_0xa2bb('0x16')]===0x1f4){logger[_0xa2bb('0x15')](_0xa2bb('0x12'),_0x15373d,_0x38a620[_0xa2bb('0x15')][_0xa2bb('0x17')]);return _0x5bc089(_0x38a620[_0xa2bb('0x15')][_0xa2bb('0x17')]);}logger[_0xa2bb('0x15')](_0xa2bb('0x12'),_0x15373d,_0x38a620[_0xa2bb('0x15')][_0xa2bb('0x17')]);return _0xa258f1(_0x38a620['error'][_0xa2bb('0x17')]);}else{logger[_0xa2bb('0x11')]('UserNotification,\x20%s,\x20%s',_0x15373d,_0xa2bb('0x18'));_0xa258f1(_0x38a620[_0xa2bb('0x19')][_0xa2bb('0x17')]);}})['catch'](function(_0x36e824){logger[_0xa2bb('0x15')](_0xa2bb('0x12'),_0x15373d,_0x36e824);_0x5bc089(_0x36e824);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index e13efdf..d36ba8d 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 _0xa400=['save','update','emit','removeListener','length','./userNotification.events'];(function(_0x480756,_0x3a0d7c){var _0x583ebf=function(_0x37a798){while(--_0x37a798){_0x480756['push'](_0x480756['shift']());}};_0x583ebf(++_0x3a0d7c);}(_0xa400,0x1b5));var _0x0a40=function(_0x851be,_0x492288){_0x851be=_0x851be-0x0;var _0x101ff5=_0xa400[_0x851be];return _0x101ff5;};'use strict';var UserNotificationEvents=require(_0x0a40('0x0'));var events=[_0x0a40('0x1'),'remove',_0x0a40('0x2')];function createListener(_0x125c4a,_0x5e8c79){return function(_0x2f4a91){_0x5e8c79[_0x0a40('0x3')](_0x125c4a,_0x2f4a91);};}function removeListener(_0xa0b4f2,_0xef4c41){return function(){UserNotificationEvents[_0x0a40('0x4')](_0xa0b4f2,_0xef4c41);};}exports['register']=function(_0x50e78e){for(var _0x25cb60=0x0,_0x15a1eb=events[_0x0a40('0x5')];_0x25cb60<_0x15a1eb;_0x25cb60++){var _0x5b8f04=events[_0x25cb60];var _0x11774f=createListener('userNotification:'+_0x5b8f04,_0x50e78e);UserNotificationEvents['on'](_0x5b8f04,_0x11774f);}}; \ No newline at end of file +var _0x1845=['update','emit','length','./userNotification.events','remove'];(function(_0x12f5a0,_0x3a8662){var _0x3f6a9f=function(_0x2243a6){while(--_0x2243a6){_0x12f5a0['push'](_0x12f5a0['shift']());}};_0x3f6a9f(++_0x3a8662);}(_0x1845,0x148));var _0x5184=function(_0x243847,_0xefbff9){_0x243847=_0x243847-0x0;var _0x699d88=_0x1845[_0x243847];return _0x699d88;};'use strict';var UserNotificationEvents=require(_0x5184('0x0'));var events=['save',_0x5184('0x1'),_0x5184('0x2')];function createListener(_0x318de7,_0x89bd11){return function(_0x2d5abc){_0x89bd11[_0x5184('0x3')](_0x318de7,_0x2d5abc);};}function removeListener(_0x1f7798,_0x1b2aed){return function(){UserNotificationEvents['removeListener'](_0x1f7798,_0x1b2aed);};}exports['register']=function(_0x50d9d3){for(var _0x2c8eb4=0x0,_0x2c729d=events[_0x5184('0x4')];_0x2c8eb4<_0x2c729d;_0x2c8eb4++){var _0x4f50dd=events[_0x2c8eb4];var _0x185434=createListener('userNotification:'+_0x4f50dd,_0x50d9d3);UserNotificationEvents['on'](_0x4f50dd,_0x185434);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index a666cdc..18a830e 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x476fc8,_0x505a78){var _0x22afee=function(_0x4b1b49){while(--_0x4b1b49){_0x476fc8['push'](_0x476fc8['shift']());}};_0x22afee(++_0x505a78);}(_0xedd9,0xfc));var _0x9edd=function(_0x15022c,_0x44daae){_0x15022c=_0x15022c-0x0;var _0x81623a=_0xedd9[_0x15022c];return _0x81623a;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x31da33,_0x5aab94){var _0x7ec2a2=function(_0x5801fb){while(--_0x5801fb){_0x31da33['push'](_0x31da33['shift']());}};_0x7ec2a2(++_0x5aab94);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 74e1fd0..22a4e32 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 _0xcfa6=['sequelize','exports','INTEGER'];(function(_0x321a55,_0x1bf13c){var _0x2ae057=function(_0xc9412c){while(--_0xc9412c){_0x321a55['push'](_0x321a55['shift']());}};_0x2ae057(++_0x1bf13c);}(_0xcfa6,0xcf));var _0x6cfa=function(_0x2a9288,_0x4f2178){_0x2a9288=_0x2a9288-0x0;var _0x404e4b=_0xcfa6[_0x2a9288];return _0x404e4b;};'use strict';var Sequelize=require(_0x6cfa('0x0'));module[_0x6cfa('0x1')]={'penalty':{'type':Sequelize[_0x6cfa('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa1a9=['sequelize'];(function(_0x17e859,_0x52debf){var _0x3178a9=function(_0x3c4249){while(--_0x3c4249){_0x17e859['push'](_0x17e859['shift']());}};_0x3178a9(++_0x52debf);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x1b10ea,_0x397f7b){_0x1b10ea=_0x1b10ea-0x0;var _0x524b9f=_0xa1a9[_0x1b10ea];return _0x524b9f;};'use strict';var Sequelize=require(_0x9a1a('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index b23643f..c935f88 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 _0xa152=['user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue'];(function(_0x5d2a2a,_0x104706){var _0x19a62b=function(_0x3995a4){while(--_0x3995a4){_0x5d2a2a['push'](_0x5d2a2a['shift']());}};_0x19a62b(++_0x104706);}(_0xa152,0x121));var _0x2a15=function(_0x2df4fe,_0x8fd414){_0x2df4fe=_0x2df4fe-0x0;var _0x4154ce=_0xa152[_0x2df4fe];return _0x4154ce;};'use strict';var _=require(_0x2a15('0x0'));var util=require(_0x2a15('0x1'));var logger=require(_0x2a15('0x2'))(_0x2a15('0x3'));var moment=require(_0x2a15('0x4'));var BPromise=require(_0x2a15('0x5'));var rp=require(_0x2a15('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2a15('0x7'));var config=require('../../config/environment');var attributes=require(_0x2a15('0x8'));module['exports']=function(_0x191636,_0x51127b){return _0x191636[_0x2a15('0x9')](_0x2a15('0xa'),attributes,{'tableName':_0x2a15('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x608b=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x590a73,_0x29a484){var _0x169333=function(_0x181b9f){while(--_0x181b9f){_0x590a73['push'](_0x590a73['shift']());}};_0x169333(++_0x29a484);}(_0x608b,0xcc));var _0xb608=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x608b[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0xb608('0x0'));var util=require(_0xb608('0x1'));var logger=require(_0xb608('0x2'))(_0xb608('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb608('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb608('0x5'));var config=require('../../config/environment');var attributes=require(_0xb608('0x6'));module[_0xb608('0x7')]=function(_0x381c75,_0x6c23d6){return _0x381c75[_0xb608('0x8')](_0xb608('0x9'),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 477f607..56ec99b 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 _0x9a16=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x9a16,0x6c));var _0x69a1=function(_0x16d59b,_0x400b91){_0x16d59b=_0x16d59b-0x0;var _0x34bf2f=_0x9a16[_0x16d59b];return _0x34bf2f;};'use strict';var _=require(_0x69a1('0x0'));var util=require(_0x69a1('0x1'));var moment=require('moment');var BPromise=require(_0x69a1('0x2'));var rs=require(_0x69a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x69a1('0x4'))['db'];var utils=require(_0x69a1('0x5'));var logger=require(_0x69a1('0x6'))('rpc');var config=require(_0x69a1('0x7'));var jayson=require(_0x69a1('0x8'));var client=jayson[_0x69a1('0x9')][_0x69a1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5598d1,_0xf7c285,_0x551c49){return new BPromise(function(_0x527f5a,_0x57bf39){return client['request'](_0x5598d1,_0x551c49)[_0x69a1('0xb')](function(_0x4c1bcf){logger['info'](_0x69a1('0xc'),_0xf7c285,_0x69a1('0xd'));logger[_0x69a1('0xe')](_0x69a1('0xf'),_0xf7c285,_0x69a1('0xd'),JSON[_0x69a1('0x10')](_0x4c1bcf));if(_0x4c1bcf['error']){if(_0x4c1bcf['error'][_0x69a1('0x11')]===0x1f4){logger[_0x69a1('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0xf7c285,_0x4c1bcf['error'][_0x69a1('0x13')]);return _0x57bf39(_0x4c1bcf[_0x69a1('0x12')][_0x69a1('0x13')]);}logger['error'](_0x69a1('0xc'),_0xf7c285,_0x4c1bcf['error'][_0x69a1('0x13')]);return _0x527f5a(_0x4c1bcf[_0x69a1('0x12')][_0x69a1('0x13')]);}else{logger[_0x69a1('0x14')](_0x69a1('0xc'),_0xf7c285,_0x69a1('0xd'));_0x527f5a(_0x4c1bcf[_0x69a1('0x15')][_0x69a1('0x13')]);}})['catch'](function(_0x2f6606){logger[_0x69a1('0x12')](_0x69a1('0xc'),_0xf7c285,_0x2f6606);_0x57bf39(_0x2f6606);});});} \ No newline at end of file +var _0x911d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','util','moment'];(function(_0x2655af,_0x5d20cb){var _0x747964=function(_0x39db9e){while(--_0x39db9e){_0x2655af['push'](_0x2655af['shift']());}};_0x747964(++_0x5d20cb);}(_0x911d,0x76));var _0xd911=function(_0x37cb61,_0xa49d0){_0x37cb61=_0x37cb61-0x0;var _0x4ca1c7=_0x911d[_0x37cb61];return _0x4ca1c7;};'use strict';var _=require('lodash');var util=require(_0xd911('0x0'));var moment=require(_0xd911('0x1'));var BPromise=require(_0xd911('0x2'));var rs=require(_0xd911('0x3'));var fs=require('fs');var Redis=require(_0xd911('0x4'));var db=require(_0xd911('0x5'))['db'];var utils=require(_0xd911('0x6'));var logger=require(_0xd911('0x7'))(_0xd911('0x8'));var config=require('../../config/environment');var jayson=require(_0xd911('0x9'));var client=jayson[_0xd911('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42229c,_0x2aba3c,_0x3a942e){return new BPromise(function(_0x29e2dd,_0x17b3ac){return client[_0xd911('0xb')](_0x42229c,_0x3a942e)['then'](function(_0x56c98d){logger[_0xd911('0xc')](_0xd911('0xd'),_0x2aba3c,_0xd911('0xe'));logger[_0xd911('0xf')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x2aba3c,_0xd911('0xe'),JSON[_0xd911('0x10')](_0x56c98d));if(_0x56c98d[_0xd911('0x11')]){if(_0x56c98d[_0xd911('0x11')][_0xd911('0x12')]===0x1f4){logger[_0xd911('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x2aba3c,_0x56c98d[_0xd911('0x11')][_0xd911('0x13')]);return _0x17b3ac(_0x56c98d['error'][_0xd911('0x13')]);}logger['error'](_0xd911('0xd'),_0x2aba3c,_0x56c98d[_0xd911('0x11')][_0xd911('0x13')]);return _0x29e2dd(_0x56c98d[_0xd911('0x11')][_0xd911('0x13')]);}else{logger['info'](_0xd911('0xd'),_0x2aba3c,'request\x20sent');_0x29e2dd(_0x56c98d['result'][_0xd911('0x13')]);}})['catch'](function(_0x4cc9b7){logger[_0xd911('0x11')](_0xd911('0xd'),_0x2aba3c,_0x4cc9b7);_0x17b3ac(_0x4cc9b7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 5cdde11..8570589 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 _0x13fe=['post','create','/:id/clone','clone','/:id/sections','addResources','update','delete','destroy','removeResources','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/resources','getResources'];(function(_0x301453,_0x5f4878){var _0x5a89b2=function(_0x1c9c56){while(--_0x1c9c56){_0x301453['push'](_0x301453['shift']());}};_0x5a89b2(++_0x5f4878);}(_0x13fe,0xcf));var _0xe13f=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x13fe[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0xe13f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe13f('0x1'));var express=require(_0xe13f('0x2'));var router=express[_0xe13f('0x3')]();var fs_extra=require(_0xe13f('0x4'));var auth=require(_0xe13f('0x5'));var interaction=require(_0xe13f('0x6'));var config=require('../../config/environment');var controller=require(_0xe13f('0x7'));router[_0xe13f('0x8')]('/',auth[_0xe13f('0x9')](),controller[_0xe13f('0xa')]);router['get'](_0xe13f('0xb'),auth['isAuthenticated'](),controller[_0xe13f('0xc')]);router['get'](_0xe13f('0xd'),auth[_0xe13f('0x9')](),controller[_0xe13f('0xe')]);router[_0xe13f('0x8')]('/:id/sections',auth[_0xe13f('0x9')](),controller['getSections']);router[_0xe13f('0x8')](_0xe13f('0xf'),auth['isAuthenticated'](),controller[_0xe13f('0x10')]);router[_0xe13f('0x11')]('/',auth[_0xe13f('0x9')](),controller[_0xe13f('0x12')]);router[_0xe13f('0x11')](_0xe13f('0x13'),auth[_0xe13f('0x9')](),controller[_0xe13f('0x14')]);router[_0xe13f('0x11')](_0xe13f('0x15'),auth[_0xe13f('0x9')](),controller['addSections']);router['post'](_0xe13f('0xf'),auth[_0xe13f('0x9')](),controller[_0xe13f('0x16')]);router['put'](_0xe13f('0xd'),auth[_0xe13f('0x9')](),controller[_0xe13f('0x17')]);router[_0xe13f('0x18')](_0xe13f('0xd'),auth[_0xe13f('0x9')](),controller[_0xe13f('0x19')]);router[_0xe13f('0x18')]('/:id/sections',auth[_0xe13f('0x9')](),controller['removeSections']);router['delete'](_0xe13f('0xf'),auth[_0xe13f('0x9')](),controller[_0xe13f('0x1a')]);module[_0xe13f('0x1b')]=router; \ No newline at end of file +var _0xf048=['getResources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/sections','getSections','/:id/resources'];(function(_0x9f6d80,_0x31e650){var _0x5ac1ce=function(_0x537ccd){while(--_0x537ccd){_0x9f6d80['push'](_0x9f6d80['shift']());}};_0x5ac1ce(++_0x31e650);}(_0xf048,0x182));var _0x8f04=function(_0x252bad,_0xcd6c93){_0x252bad=_0x252bad-0x0;var _0x510476=_0xf048[_0x252bad];return _0x510476;};'use strict';var multer=require(_0x8f04('0x0'));var util=require(_0x8f04('0x1'));var path=require(_0x8f04('0x2'));var timeout=require(_0x8f04('0x3'));var express=require('express');var router=express[_0x8f04('0x4')]();var fs_extra=require(_0x8f04('0x5'));var auth=require(_0x8f04('0x6'));var interaction=require(_0x8f04('0x7'));var config=require(_0x8f04('0x8'));var controller=require('./userProfile.controller');router[_0x8f04('0x9')]('/',auth[_0x8f04('0xa')](),controller[_0x8f04('0xb')]);router[_0x8f04('0x9')](_0x8f04('0xc'),auth[_0x8f04('0xa')](),controller['describe']);router[_0x8f04('0x9')](_0x8f04('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x8f04('0x9')](_0x8f04('0xe'),auth[_0x8f04('0xa')](),controller[_0x8f04('0xf')]);router[_0x8f04('0x9')](_0x8f04('0x10'),auth['isAuthenticated'](),controller[_0x8f04('0x11')]);router['post']('/',auth[_0x8f04('0xa')](),controller[_0x8f04('0x12')]);router[_0x8f04('0x13')](_0x8f04('0x14'),auth[_0x8f04('0xa')](),controller[_0x8f04('0x15')]);router[_0x8f04('0x13')](_0x8f04('0xe'),auth[_0x8f04('0xa')](),controller[_0x8f04('0x16')]);router['post'](_0x8f04('0x10'),auth[_0x8f04('0xa')](),controller[_0x8f04('0x17')]);router[_0x8f04('0x18')]('/:id',auth[_0x8f04('0xa')](),controller[_0x8f04('0x19')]);router[_0x8f04('0x1a')]('/:id',auth[_0x8f04('0xa')](),controller[_0x8f04('0x1b')]);router[_0x8f04('0x1a')](_0x8f04('0xe'),auth[_0x8f04('0xa')](),controller[_0x8f04('0x1c')]);router[_0x8f04('0x1a')](_0x8f04('0x10'),auth[_0x8f04('0xa')](),controller[_0x8f04('0x1d')]);module[_0x8f04('0x1e')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 0b9459b..e7f4616 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 _0x1ee0=['getDataValue','split','BOOLEAN','sequelize','name','STRING','setDataValue','crudPermissions','join'];(function(_0x2e766b,_0x51957f){var _0x308db5=function(_0x1ac822){while(--_0x1ac822){_0x2e766b['push'](_0x2e766b['shift']());}};_0x308db5(++_0x51957f);}(_0x1ee0,0xc9));var _0x01ee=function(_0x21b7b4,_0x54ea46){_0x21b7b4=_0x21b7b4-0x0;var _0x4b5efb=_0x1ee0[_0x21b7b4];return _0x4b5efb;};'use strict';var Sequelize=require(_0x01ee('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x01ee('0x1')},'crudPermissions':{'type':Sequelize[_0x01ee('0x2')],'set':function(_0x591310){this[_0x01ee('0x3')](_0x01ee('0x4'),_0x591310?_0x591310[_0x01ee('0x5')](''):[]);},'get':function(){return this[_0x01ee('0x6')](_0x01ee('0x4'))?this[_0x01ee('0x6')](_0x01ee('0x4'))[_0x01ee('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x01ee('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x01ee('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x01ee('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x01ee('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x01ee('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x01ee('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x01ee('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x01ee('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0xb1ca=['STRING','crudPermissions','join','getDataValue','split','BOOLEAN','exports','name'];(function(_0x4faa2c,_0x2d8ecd){var _0x32514d=function(_0x418f7b){while(--_0x418f7b){_0x4faa2c['push'](_0x4faa2c['shift']());}};_0x32514d(++_0x2d8ecd);}(_0xb1ca,0x11e));var _0xab1c=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xb1ca[_0x11005e];return _0x29338f;};'use strict';var Sequelize=require('sequelize');module[_0xab1c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xab1c('0x1')},'crudPermissions':{'type':Sequelize[_0xab1c('0x2')],'set':function(_0x3b906d){this['setDataValue'](_0xab1c('0x3'),_0x3b906d?_0x3b906d[_0xab1c('0x4')](''):[]);},'get':function(){return this[_0xab1c('0x5')]('crudPermissions')?this[_0xab1c('0x5')]('crudPermissions')[_0xab1c('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xab1c('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xab1c('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xab1c('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xab1c('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xab1c('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xab1c('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xab1c('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 5666ec6..2ea85b5 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 _0xb5fa=['getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','fieldName','type','key','model','map','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','options','UserProfile','include','findAll','rows','catch','show','keys','rawAttributes','fields','length','includeAll','merge','find','create','body','clone','get','updatedAt','omit','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','params','describe','addSections','sectionId','each','push'];(function(_0x2e6323,_0x518bf8){var _0x4f7078=function(_0x336849){while(--_0x336849){_0x2e6323['push'](_0x2e6323['shift']());}};_0x4f7078(++_0x518bf8);}(_0xb5fa,0xf8));var _0xab5f=function(_0x17ae56,_0x482b80){_0x17ae56=_0x17ae56-0x0;var _0x8ec34c=_0xb5fa[_0x17ae56];return _0x8ec34c;};'use strict';var emlformat=require(_0xab5f('0x0'));var rimraf=require(_0xab5f('0x1'));var zipdir=require(_0xab5f('0x2'));var jsonpatch=require(_0xab5f('0x3'));var rp=require(_0xab5f('0x4'));var moment=require(_0xab5f('0x5'));var BPromise=require(_0xab5f('0x6'));var Mustache=require(_0xab5f('0x7'));var util=require(_0xab5f('0x8'));var path=require(_0xab5f('0x9'));var sox=require(_0xab5f('0xa'));var csv=require(_0xab5f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xab5f('0xc'));var crypto=require(_0xab5f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab5f('0xe'));var toCsv=require(_0xab5f('0xb'));var querystring=require(_0xab5f('0xf'));var Papa=require(_0xab5f('0x10'));var Redis=require(_0xab5f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xab5f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab5f('0x13'));var logger=require('../../config/logger')(_0xab5f('0x14'));var utils=require(_0xab5f('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xab5f('0x16')]=_[_0xab5f('0x17')](config['redis'],{'host':_0xab5f('0x18'),'port':0x18eb});var socket=require(_0xab5f('0x19'))(new Redis(config[_0xab5f('0x16')]));require(_0xab5f('0x1a'))[_0xab5f('0x1b')](socket);function respondWithStatusCode(_0x4101ee,_0x4319c7){_0x4319c7=_0x4319c7||0xcc;return function(_0x425053){if(_0x425053){return _0x4101ee[_0xab5f('0x1c')](_0x4319c7);}return _0x4101ee[_0xab5f('0x1d')](_0x4319c7)[_0xab5f('0x1e')]();};}function respondWithResult(_0x30089f,_0x177e6d){_0x177e6d=_0x177e6d||0xc8;return function(_0x22588b){if(_0x22588b){return _0x30089f[_0xab5f('0x1d')](_0x177e6d)[_0xab5f('0x1f')](_0x22588b);}};}function respondWithFilteredResult(_0xecd649,_0x340190){return function(_0x4aca7d){if(_0x4aca7d){var _0x2caadb=typeof _0x340190['offset']===_0xab5f('0x20')&&typeof _0x340190[_0xab5f('0x21')]===_0xab5f('0x20');var _0x1d6c2b=_0x4aca7d['count'];var _0xd2df62=_0x2caadb?0x0:_0x340190[_0xab5f('0x22')];var _0x3bca15=_0x2caadb?_0x4aca7d[_0xab5f('0x23')]:_0x340190[_0xab5f('0x22')]+_0x340190[_0xab5f('0x21')];var _0x58cfa4;if(_0x3bca15>=_0x1d6c2b){_0x3bca15=_0x1d6c2b;_0x58cfa4=0xc8;}else{_0x58cfa4=0xce;}_0xecd649[_0xab5f('0x1d')](_0x58cfa4);return _0xecd649[_0xab5f('0x24')](_0xab5f('0x25'),_0xd2df62+'-'+_0x3bca15+'/'+_0x1d6c2b)['json'](_0x4aca7d);}return null;};}function patchUpdates(_0xb47124){return function(_0x134a23){try{jsonpatch[_0xab5f('0x26')](_0x134a23,_0xb47124,!![]);}catch(_0x237704){return BPromise[_0xab5f('0x27')](_0x237704);}return _0x134a23[_0xab5f('0x28')]();};}function saveUpdates(_0x4b3127,_0x55daaf){return function(_0x3c5847){if(_0x3c5847){return _0x3c5847[_0xab5f('0x29')](_0x4b3127)[_0xab5f('0x2a')](function(_0x39bf0f){return _0x39bf0f;});}return null;};}function removeEntity(_0x3fb403,_0x49972a){return function(_0x3db1a6){if(_0x3db1a6){return _0x3db1a6[_0xab5f('0x2b')]()['then'](function(){_0x3fb403[_0xab5f('0x1d')](0xcc)[_0xab5f('0x1e')]();});}};}function handleEntityNotFound(_0x56e074,_0x391fec){return function(_0x4fee82){if(!_0x4fee82){_0x56e074[_0xab5f('0x1c')](0x194);}return _0x4fee82;};}function handleError(_0x2c0a1a,_0x1e1fa9){_0x1e1fa9=_0x1e1fa9||0x1f4;return function(_0x239229){logger['error'](_0x239229[_0xab5f('0x2c')]);if(_0x239229[_0xab5f('0x2d')]){delete _0x239229[_0xab5f('0x2d')];}_0x2c0a1a[_0xab5f('0x1d')](_0x1e1fa9)[_0xab5f('0x2e')](_0x239229);};}exports['index']=function(_0x5c6229,_0x7f5308){var _0x464287={},_0x290df8={},_0x274951={'count':0x0,'rows':[]};var _0x4bd729=_['map'](db['UserProfile']['rawAttributes'],function(_0x494c4b){return{'name':_0x494c4b[_0xab5f('0x2f')],'type':_0x494c4b[_0xab5f('0x30')][_0xab5f('0x31')]};});_0x290df8[_0xab5f('0x32')]=_[_0xab5f('0x33')](_0x4bd729,_0xab5f('0x2d'));_0x290df8[_0xab5f('0x34')]=_['keys'](_0x5c6229[_0xab5f('0x34')]);_0x290df8[_0xab5f('0x35')]=_[_0xab5f('0x36')](_0x290df8[_0xab5f('0x32')],_0x290df8[_0xab5f('0x34')]);_0x464287[_0xab5f('0x37')]=_['intersection'](_0x290df8[_0xab5f('0x32')],qs['fields'](_0x5c6229[_0xab5f('0x34')]['fields']));_0x464287['attributes']=_0x464287['attributes']['length']?_0x464287[_0xab5f('0x37')]:_0x290df8['model'];if(!_0x5c6229[_0xab5f('0x34')][_0xab5f('0x38')](_0xab5f('0x39'))){_0x464287[_0xab5f('0x21')]=qs[_0xab5f('0x21')](_0x5c6229[_0xab5f('0x34')][_0xab5f('0x21')]);_0x464287[_0xab5f('0x22')]=qs[_0xab5f('0x22')](_0x5c6229['query'][_0xab5f('0x22')]);}_0x464287['order']=qs[_0xab5f('0x3a')](_0x5c6229[_0xab5f('0x34')][_0xab5f('0x3a')]);_0x464287['where']=qs[_0xab5f('0x35')](_[_0xab5f('0x3b')](_0x5c6229[_0xab5f('0x34')],_0x290df8[_0xab5f('0x35')]),_0x4bd729);if(_0x5c6229[_0xab5f('0x34')][_0xab5f('0x3c')]){_0x464287[_0xab5f('0x3d')]=_['merge'](_0x464287[_0xab5f('0x3d')],{'$or':_[_0xab5f('0x33')](_0x4bd729,function(_0x6298c4){if(_0x6298c4[_0xab5f('0x30')]!==_0xab5f('0x3e')){var _0x141a34={};_0x141a34[_0x6298c4[_0xab5f('0x2d')]]={'$like':'%'+_0x5c6229[_0xab5f('0x34')]['filter']+'%'};return _0x141a34;}})});}_0x464287=_['merge']({},_0x464287,_0x5c6229[_0xab5f('0x3f')]);var _0x384cbf={'where':_0x464287['where']};return db[_0xab5f('0x40')]['count'](_0x384cbf)[_0xab5f('0x2a')](function(_0x71490a){_0x274951['count']=_0x71490a;if(_0x5c6229[_0xab5f('0x34')]['includeAll']){_0x464287[_0xab5f('0x41')]=[{'all':!![]}];}return db[_0xab5f('0x40')][_0xab5f('0x42')](_0x464287);})[_0xab5f('0x2a')](function(_0x2da96f){_0x274951[_0xab5f('0x43')]=_0x2da96f;return _0x274951;})['then'](respondWithFilteredResult(_0x7f5308,_0x464287))[_0xab5f('0x44')](handleError(_0x7f5308,null));};exports[_0xab5f('0x45')]=function(_0x22249a,_0x2e81c6){var _0x366c5d={'raw':![],'where':{'id':_0x22249a['params']['id']}},_0x358e13={};_0x358e13[_0xab5f('0x32')]=_[_0xab5f('0x46')](db['UserProfile'][_0xab5f('0x47')]);_0x358e13['query']=_[_0xab5f('0x46')](_0x22249a[_0xab5f('0x34')]);_0x358e13['filters']=_[_0xab5f('0x36')](_0x358e13[_0xab5f('0x32')],_0x358e13[_0xab5f('0x34')]);_0x366c5d[_0xab5f('0x37')]=_[_0xab5f('0x36')](_0x358e13[_0xab5f('0x32')],qs[_0xab5f('0x48')](_0x22249a[_0xab5f('0x34')]['fields']));_0x366c5d[_0xab5f('0x37')]=_0x366c5d[_0xab5f('0x37')][_0xab5f('0x49')]?_0x366c5d['attributes']:_0x358e13[_0xab5f('0x32')];if(_0x22249a[_0xab5f('0x34')][_0xab5f('0x4a')]){_0x366c5d[_0xab5f('0x41')]=[{'all':!![]}];}_0x366c5d=_[_0xab5f('0x4b')]({},_0x366c5d,_0x22249a[_0xab5f('0x3f')]);return db[_0xab5f('0x40')][_0xab5f('0x4c')](_0x366c5d)[_0xab5f('0x2a')](handleEntityNotFound(_0x2e81c6,null))[_0xab5f('0x2a')](respondWithResult(_0x2e81c6,null))[_0xab5f('0x44')](handleError(_0x2e81c6,null));};exports[_0xab5f('0x4d')]=function(_0x4502ee,_0x28a126){return db['UserProfile'][_0xab5f('0x4d')](_0x4502ee[_0xab5f('0x4e')],{})[_0xab5f('0x2a')](respondWithResult(_0x28a126,0xc9))[_0xab5f('0x44')](handleError(_0x28a126,null));};exports[_0xab5f('0x4f')]=function(_0x500258,_0x5d1daf){var _0x1cd159={'where':{'id':_0x500258['params']['id']}},_0x20a959={};_0x20a959[_0xab5f('0x32')]=_[_0xab5f('0x46')](db[_0xab5f('0x40')][_0xab5f('0x47')]);_0x1cd159['attributes']=_['intersection'](_0x20a959[_0xab5f('0x32')],qs[_0xab5f('0x48')](_0x500258['query'][_0xab5f('0x48')]));_0x1cd159[_0xab5f('0x37')]=_0x1cd159['attributes']['length']?_0x1cd159[_0xab5f('0x37')]:_0x20a959['model'];if(_0x500258[_0xab5f('0x34')][_0xab5f('0x4a')]){_0x1cd159[_0xab5f('0x41')]=[{'all':!![]}];}_0x1cd159=_[_0xab5f('0x4b')]({},_0x1cd159,_0x500258[_0xab5f('0x3f')]);return db[_0xab5f('0x40')][_0xab5f('0x4c')](_0x1cd159)[_0xab5f('0x2a')](handleEntityNotFound(_0x5d1daf,null))[_0xab5f('0x2a')](function(_0x454932){if(_0x454932){var _0x4c5f73=_0x454932[_0xab5f('0x50')]({'plain':!![]});_0x4c5f73=qs['omit'](_0x4c5f73,['id','createdAt',_0xab5f('0x51'),'crudPermissions']);_0x500258[_0xab5f('0x4e')]=_[_0xab5f('0x52')](_0x500258[_0xab5f('0x4e')],['id',_0xab5f('0x53'),_0xab5f('0x51')]);return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0xd56352){return db[_0xab5f('0x40')]['create'](_[_0xab5f('0x4b')](_0x4c5f73,_0x500258[_0xab5f('0x4e')]),{'include':_0x500258[_0xab5f('0x34')][_0xab5f('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0xd56352})['then'](function(_0x5b8ca3){var _0x438c04=_0x5b8ca3[_0xab5f('0x50')]({'plain':!![]});return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x500258['params']['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x42e5e6){if(_0x42e5e6){return BPromise['each'](_0x42e5e6,function(_0x454822){return new BPromise(function(_0x2a5f34,_0x3ca59d){if(_0x454822[_0xab5f('0x57')]===null||_0x454822[_0xab5f('0x57')]===0x1)_0x2a5f34(null);return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x454822['id']},'raw':!![]})['then'](function(_0x1f2084){var _0x8ea961=_[_0xab5f('0x33')](_0x1f2084,function(_0x2b13f9){return qs[_0xab5f('0x52')](_0x2b13f9,['id',_0xab5f('0x53'),'updatedAt','sectionId']);});_0x2a5f34(_0x8ea961);})[_0xab5f('0x44')](function(_0x3aa745){_0x3ca59d(_0x3aa745);});})['then'](function(_0x449ae7){var _0x183e7a=qs['omit'](_0x454822,['id',_0xab5f('0x53'),_0xab5f('0x51')]);_0x183e7a[_0xab5f('0x59')]=_0x438c04['id'];if(_0x449ae7)_0x183e7a[_0xab5f('0x5a')]=_0x449ae7;return _0x183e7a;})['then'](function(_0x5e6ff2){return db[_0xab5f('0x56')][_0xab5f('0x4d')](_0x5e6ff2,{'include':[{'model':db[_0xab5f('0x58')],'as':'Resources'}],'raw':!![],'transaction':_0xd56352});});})[_0xab5f('0x2a')](function(){return _0x438c04;});}});});});}})[_0xab5f('0x2a')](respondWithResult(_0x5d1daf,0xc9))['catch'](handleError(_0x5d1daf,null));};exports[_0xab5f('0x29')]=function(_0x20cab5,_0x30911c){if(_0x20cab5[_0xab5f('0x4e')]['id']){delete _0x20cab5[_0xab5f('0x4e')]['id'];}return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x20cab5[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x30911c,null))[_0xab5f('0x2a')](saveUpdates(_0x20cab5[_0xab5f('0x4e')],null))['then'](respondWithResult(_0x30911c,null))[_0xab5f('0x44')](handleError(_0x30911c,null));};exports[_0xab5f('0x2b')]=function(_0xf925f4,_0x391b32){return db['UserProfile'][_0xab5f('0x4c')]({'where':{'id':_0xf925f4[_0xab5f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x391b32,null))[_0xab5f('0x2a')](removeEntity(_0x391b32,null))[_0xab5f('0x44')](handleError(_0x391b32,null));};exports['describe']=function(_0x542ca0,_0x15b9b1){return db[_0xab5f('0x40')][_0xab5f('0x5c')]()[_0xab5f('0x2a')](respondWithResult(_0x15b9b1,null))[_0xab5f('0x44')](handleError(_0x15b9b1,null));};exports[_0xab5f('0x5d')]=function(_0x2acbaf,_0x2026da){var _0x58442f=_0x2acbaf[_0xab5f('0x4e')];return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x2acbaf[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x2026da,null))[_0xab5f('0x2a')](function(_0x1bf11e){if(_0x1bf11e){return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0x23298f){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x2acbaf['params']['id'],'sectionId':_[_0xab5f('0x33')](_0x58442f,function(_0x4a6ce5){return _0x4a6ce5[_0xab5f('0x5e')];})},'transaction':_0x23298f})[_0xab5f('0x2a')](function(){var _0x5ec60c=_['map'](_0x58442f,function(_0x1db10e){_0x1db10e[_0xab5f('0x59')]=_0x2acbaf[_0xab5f('0x5b')]['id'];return _0x1db10e;});var _0x515c5c=[];return BPromise[_0xab5f('0x5f')](_0x5ec60c,function(_0x76055e){return db[_0xab5f('0x56')][_0xab5f('0x4d')](_0x76055e,{'include':[{'model':db[_0xab5f('0x58')],'as':_0xab5f('0x5a')}],'raw':!![],'transaction':_0x23298f})[_0xab5f('0x2a')](function(_0xed5baf){_0x515c5c[_0xab5f('0x60')](_0xed5baf[_0xab5f('0x50')]({'plain':!![]}));});})['then'](function(){return _0x515c5c;});});});}})['then'](function(_0x429d50){return _0x429d50;})['then'](respondWithResult(_0x2026da,null))[_0xab5f('0x44')](handleError(_0x2026da,null));};exports['removeSections']=function(_0x66f756,_0x1b0485){var _0x4aaf14;return db['UserProfile'][_0xab5f('0x4c')]({'where':{'id':_0x66f756[_0xab5f('0x5b')]['id']},'attributes':['id',_0xab5f('0x2d')]})[_0xab5f('0x2a')](handleEntityNotFound(_0x1b0485,null))[_0xab5f('0x2a')](function(_0x181470){if(_0x181470){_0x4aaf14=_0x181470;return db[_0xab5f('0x56')]['destroy']({'where':{'userProfileId':_0x66f756['params']['id'],'sectionId':_0x66f756[_0xab5f('0x34')]['ids']}});}})[_0xab5f('0x2a')](function(){return _0x4aaf14;})[_0xab5f('0x2a')](respondWithStatusCode(_0x1b0485,null))['catch'](handleError(_0x1b0485,null));};exports[_0xab5f('0x61')]=function(_0x11fa3d,_0x3667ac){var _0x4ff35f=[];var _0x4f5881=[];return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x11fa3d['params']['id']},'raw':!![]})['then'](function(_0x1cb964){_0x4ff35f=_[_0xab5f('0x3c')](_0x1cb964,function(_0x9857fd){return _0x9857fd[_0xab5f('0x62')]===0x1||_[_0xab5f('0x63')]([0x3eb,0x709],_0x9857fd[_0xab5f('0x5e')]);});if(!_[_0xab5f('0x64')](_0x4ff35f)){return _['map'](_0x4ff35f,function(_0x23acfb){return _0x23acfb['sectionId'];});}else{return;}})[_0xab5f('0x2a')](function(_0x16036a){if(_0x16036a)_0x4f5881=_0x16036a;if(_[_0xab5f('0x63')](_0x4f5881,0x64)){var _0x3ddba3=_[_0xab5f('0x4c')](_0x4ff35f,{'sectionId':0x64});return hasDefaultDashboard(_0x3ddba3)[_0xab5f('0x2a')](function(_0x58bb7e){return _[_0xab5f('0x33')](_0x4ff35f,function(_0x12f94e){if(_0x12f94e[_0xab5f('0x5e')]===0x64){_0x12f94e[_0xab5f('0x65')]=_0x58bb7e;}return _0x12f94e;});});}else{return;}})[_0xab5f('0x2a')](function(_0x13b2e7){if(_0x13b2e7)_0x4ff35f=_0x13b2e7;if(_['includes'](_0x4f5881,0x3eb)){var _0x3e32ee=_[_0xab5f('0x4c')](_0x4ff35f,{'sectionId':0x3eb});return getCustomDashboards(_0x3e32ee)[_0xab5f('0x2a')](function(_0x210f9b){return _['map'](_0x4ff35f,function(_0x4dc8a4){if(_0x3e32ee[_0xab5f('0x62')]){if(_0x4dc8a4[_0xab5f('0x5e')]===0x3eb){_0x4dc8a4[_0xab5f('0x65')]=_0x210f9b;}}else{if(_0x4dc8a4[_0xab5f('0x5e')]===0x64){_0x4dc8a4[_0xab5f('0x65')]=_0x210f9b;}}return _0x4dc8a4;});});}else{return;}})['then'](function(_0x313156){if(_0x313156)_0x4ff35f=_0x313156;if(_['includes'](_0x4f5881,0x709)){var _0x15bee3=_['find'](_0x4ff35f,{'sectionId':0x709});return getPlugins(_0x15bee3)[_0xab5f('0x2a')](function(_0x502538){if(_0x15bee3[_0xab5f('0x62')]){return _[_0xab5f('0x33')](_0x4ff35f,function(_0x3f2735){if(_0x3f2735[_0xab5f('0x5e')]===0x709){_0x3f2735[_0xab5f('0x65')]=_0x502538;}return _0x3f2735;});}else{var _0x323c4f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x502538};var _0x2e08c4=_[_0xab5f('0x33')](_0x4ff35f);_0x2e08c4[_0xab5f('0x60')](_0x323c4f);return _0x2e08c4;}});}else{return;}})[_0xab5f('0x2a')](function(_0x265b37){if(_0x265b37)_0x4ff35f=_0x265b37;return _[_0xab5f('0x3c')](_0x4ff35f,[_0xab5f('0x62'),0x1]);})[_0xab5f('0x2a')](respondWithResult(_0x3667ac,null))[_0xab5f('0x44')](handleError(_0x3667ac,null));};function hasDefaultDashboard(_0x5eb263){var _0x61d75f=[0x65];return new BPromise(function(_0x5c3d83,_0x1faa75){try{if(_0x5eb263['autoAssociation']){_0x5c3d83(_0x61d75f);}else{return db[_0xab5f('0x58')][_0xab5f('0x66')]({'where':{'sectionId':_0x5eb263['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x22cfbf){_0x22cfbf?_0x5c3d83(_0x61d75f):_0x5c3d83();});}}catch(_0x4c1181){_0x1faa75(_0x4c1181);}});}function getCustomDashboards(_0x1bfd18){var _0x513869=[];return new BPromise(function(_0x5327c8,_0x5db8b8){try{if(_0x1bfd18['autoAssociation']){return db[_0xab5f('0x67')][_0xab5f('0x42')]({'raw':!![]})[_0xab5f('0x2a')](function(_0x10a07f){_0x10a07f[_0xab5f('0x68')](function(_0x400d80){_0x513869['push'](_0x400d80['id']+0x1869f);});_0x5327c8(_0x513869);});}else{return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x1bfd18['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x5ae266){_0x5ae266[_0xab5f('0x68')](function(_0x358b00){_0x513869[_0xab5f('0x60')](_0x358b00[_0xab5f('0x69')]+0x1869f);});_0x5327c8(_0x513869);});}}catch(_0xa6014b){_0x5db8b8(_0xa6014b);}});}function getPlugins(_0x5eac9c){var _0x221e99=[];return new BPromise(function(_0x291d86,_0x5e60f1){try{if(_0x5eac9c[_0xab5f('0x57')]){return db[_0xab5f('0x6a')]['findAll']({'raw':!![]})[_0xab5f('0x2a')](function(_0x36e6e2){_0x36e6e2[_0xab5f('0x68')](function(_0x52d479){_0x221e99['push'](_0x52d479['id']+0x15b38);});_0x291d86(_0x221e99);});}else{return db[_0xab5f('0x58')][_0xab5f('0x42')]({'where':{'sectionId':_0x5eac9c['id']},'raw':!![]})[_0xab5f('0x2a')](function(_0x1eecbb){_0x1eecbb['forEach'](function(_0x2a4491){_0x221e99['push'](_0x2a4491[_0xab5f('0x69')]+0x15b38);});_0x291d86(_0x221e99);});}}catch(_0x159113){_0x5e60f1(_0x159113);}});}exports[_0xab5f('0x6b')]=function(_0x1fdae5,_0x19e4e9){return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x1fdae5[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](handleEntityNotFound(_0x19e4e9,null))[_0xab5f('0x2a')](function(_0xf1566f){if(_0xf1566f){return db[_0xab5f('0x54')][_0xab5f('0x55')](function(_0x9d7975){return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x1fdae5[_0xab5f('0x5b')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x28cf22){if(_0x28cf22){return db['UserProfileSection'][_0xab5f('0x2b')]({'where':{'userProfileId':_0x1fdae5[_0xab5f('0x5b')]['id'],'id':_['map'](_0x28cf22,function(_0x38012a){return _0x38012a['id'];})},'transaction':_0x9d7975});}})[_0xab5f('0x2a')](function(_0x22b3d9){var _0x316a2c=_[_0xab5f('0x33')](_0x1fdae5[_0xab5f('0x4e')],function(_0x3a9f61){_0x3a9f61[_0xab5f('0x59')]=_0x1fdae5[_0xab5f('0x5b')]['id'];return _0x3a9f61;});return db[_0xab5f('0x56')][_0xab5f('0x6c')](_0x316a2c,{'raw':!![],'transaction':_0x9d7975});})[_0xab5f('0x2a')](function(_0x323cd8){var _0x1988fc=_[_0xab5f('0x3c')](_[_0xab5f('0x33')](_0x323cd8,function(_0xc39441){return _0xc39441[_0xab5f('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x1988fc){return db[_0xab5f('0x56')][_0xab5f('0x42')]({'where':{'userProfileId':_0x1fdae5['params']['id'],'sectionId':_['map'](_0x1988fc,function(_0x282af9){return _0x282af9[_0xab5f('0x5e')];})},'attributes':['id',_0xab5f('0x5e')],'raw':!![]})['then'](function(_0x24cd3c){var _0x3dab9a=_[_0xab5f('0x33')](_0x1fdae5[_0xab5f('0x4e')],function(_0x6f1db9){_0x6f1db9['userProfileId']=_0x1fdae5['params']['id'];return _0x6f1db9;});return db[_0xab5f('0x58')][_0xab5f('0x6c')](_0x3dab9a,{'raw':!![],'transaction':_0x9d7975});});}})['catch'](handleError(_0x19e4e9,null));});}})['then'](function(_0x282e61){var _0x3a8573=_[_0xab5f('0x33')](_0x282e61,function(_0x436a24){return _0x436a24['get']({'plain':!![]});});})[_0xab5f('0x2a')](respondWithResult(_0x19e4e9,null))['catch'](handleError(_0x19e4e9,null));};exports[_0xab5f('0x6d')]=function(_0x46b37f,_0x21d746,_0x17a648){return db[_0xab5f('0x40')][_0xab5f('0x4c')]({'where':{'id':_0x46b37f[_0xab5f('0x5b')]['id']}})['then'](handleEntityNotFound(_0x21d746,null))[_0xab5f('0x2a')](function(_0x1284d0){if(_0x1284d0){return _0x1284d0[_0xab5f('0x6d')](_0x46b37f['query'][_0xab5f('0x6e')]);}})[_0xab5f('0x2a')](respondWithStatusCode(_0x21d746,null))[_0xab5f('0x44')](handleError(_0x21d746,null));};exports[_0xab5f('0x6f')]=function(_0x41a241,_0x40f320){var _0x1f1cf2={};if(!_0x41a241['query'][_0xab5f('0x70')])throw new Error(_0xab5f('0x71'));if(!_0x41a241[_0xab5f('0x34')][_0xab5f('0x38')](_0xab5f('0x39'))){_0x1f1cf2[_0xab5f('0x21')]=qs['limit'](_0x41a241['query'][_0xab5f('0x21')]);_0x1f1cf2[_0xab5f('0x22')]=qs[_0xab5f('0x22')](_0x41a241[_0xab5f('0x34')]['offset']);}return db[_0xab5f('0x40')]['find']({'where':{'id':_0x41a241[_0xab5f('0x5b')]['id']}})[_0xab5f('0x2a')](function(_0x278900){if(!_0x278900)throw new Error(_0xab5f('0x72')+_0x41a241[_0xab5f('0x5b')]['id']);return db['UserProfile']['getResources'](_0x41a241);})['then'](respondWithFilteredResult(_0x40f320,_0x1f1cf2))['catch'](handleError(_0x40f320,null));}; \ No newline at end of file +var _0x45d8=['merge','filter','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','clone','omit','updatedAt','body','createdAt','sequelize','transaction','get','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','getSections','enabled','includes','isEmpty','subsections','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','ids','getResources','section','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','./userProfile.socket','register','sendStatus','end','status','offset','undefined','count','limit','set','json','reject','save','update','destroy','then','error','name','send','map','UserProfile','rawAttributes','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x2885b9,_0x127864){var _0x142e4f=function(_0x265361){while(--_0x265361){_0x2885b9['push'](_0x2885b9['shift']());}};_0x142e4f(++_0x127864);}(_0x45d8,0x174));var _0x845d=function(_0xc350,_0x2fb0f8){_0xc350=_0xc350-0x0;var _0x126021=_0x45d8[_0xc350];return _0x126021;};'use strict';var emlformat=require(_0x845d('0x0'));var rimraf=require(_0x845d('0x1'));var zipdir=require(_0x845d('0x2'));var jsonpatch=require(_0x845d('0x3'));var rp=require(_0x845d('0x4'));var moment=require(_0x845d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x845d('0x6'));var util=require('util');var path=require(_0x845d('0x7'));var sox=require(_0x845d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x845d('0x9'));var _=require('lodash');var squel=require(_0x845d('0xa'));var crypto=require(_0x845d('0xb'));var jsforce=require(_0x845d('0xc'));var deskjs=require(_0x845d('0xd'));var toCsv=require(_0x845d('0xe'));var querystring=require(_0x845d('0xf'));var Papa=require('papaparse');var Redis=require(_0x845d('0x10'));var authService=require(_0x845d('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x845d('0x12'));var logger=require(_0x845d('0x13'))(_0x845d('0x14'));var utils=require(_0x845d('0x15'));var config=require(_0x845d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x845d('0x17'))['db'];config[_0x845d('0x18')]=_[_0x845d('0x19')](config[_0x845d('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x845d('0x18')]));require(_0x845d('0x1a'))[_0x845d('0x1b')](socket);function respondWithStatusCode(_0x5d70ea,_0x112f9f){_0x112f9f=_0x112f9f||0xcc;return function(_0x4825be){if(_0x4825be){return _0x5d70ea[_0x845d('0x1c')](_0x112f9f);}return _0x5d70ea['status'](_0x112f9f)[_0x845d('0x1d')]();};}function respondWithResult(_0x25df3e,_0xbf78ce){_0xbf78ce=_0xbf78ce||0xc8;return function(_0x2f9425){if(_0x2f9425){return _0x25df3e[_0x845d('0x1e')](_0xbf78ce)['json'](_0x2f9425);}};}function respondWithFilteredResult(_0x4ed4d7,_0x3d4aa9){return function(_0x3b6220){if(_0x3b6220){var _0x3292ab=typeof _0x3d4aa9[_0x845d('0x1f')]===_0x845d('0x20')&&typeof _0x3d4aa9['limit']===_0x845d('0x20');var _0x2c11b8=_0x3b6220[_0x845d('0x21')];var _0x377998=_0x3292ab?0x0:_0x3d4aa9[_0x845d('0x1f')];var _0x4a500a=_0x3292ab?_0x3b6220[_0x845d('0x21')]:_0x3d4aa9[_0x845d('0x1f')]+_0x3d4aa9[_0x845d('0x22')];var _0x2d03b2;if(_0x4a500a>=_0x2c11b8){_0x4a500a=_0x2c11b8;_0x2d03b2=0xc8;}else{_0x2d03b2=0xce;}_0x4ed4d7[_0x845d('0x1e')](_0x2d03b2);return _0x4ed4d7[_0x845d('0x23')]('Content-Range',_0x377998+'-'+_0x4a500a+'/'+_0x2c11b8)[_0x845d('0x24')](_0x3b6220);}return null;};}function patchUpdates(_0x2feec0){return function(_0x3050b3){try{jsonpatch['apply'](_0x3050b3,_0x2feec0,!![]);}catch(_0x2c8ec1){return BPromise[_0x845d('0x25')](_0x2c8ec1);}return _0x3050b3[_0x845d('0x26')]();};}function saveUpdates(_0x332e59,_0x358429){return function(_0x5e894d){if(_0x5e894d){return _0x5e894d[_0x845d('0x27')](_0x332e59)['then'](function(_0x11d0b0){return _0x11d0b0;});}return null;};}function removeEntity(_0x2fb69f,_0x5716cd){return function(_0x5d5e33){if(_0x5d5e33){return _0x5d5e33[_0x845d('0x28')]()[_0x845d('0x29')](function(){_0x2fb69f[_0x845d('0x1e')](0xcc)[_0x845d('0x1d')]();});}};}function handleEntityNotFound(_0x1ea3a2,_0x5a1adb){return function(_0x3573e1){if(!_0x3573e1){_0x1ea3a2[_0x845d('0x1c')](0x194);}return _0x3573e1;};}function handleError(_0x4ca32b,_0x48d4cd){_0x48d4cd=_0x48d4cd||0x1f4;return function(_0x4c60c8){logger[_0x845d('0x2a')](_0x4c60c8['stack']);if(_0x4c60c8['name']){delete _0x4c60c8[_0x845d('0x2b')];}_0x4ca32b[_0x845d('0x1e')](_0x48d4cd)[_0x845d('0x2c')](_0x4c60c8);};}exports['index']=function(_0x28c2b8,_0xa26b89){var _0x385257={},_0x48e7a0={},_0x18de28={'count':0x0,'rows':[]};var _0x4e43fc=_[_0x845d('0x2d')](db[_0x845d('0x2e')][_0x845d('0x2f')],function(_0x14c503){return{'name':_0x14c503[_0x845d('0x30')],'type':_0x14c503['type']['key']};});_0x48e7a0[_0x845d('0x31')]=_[_0x845d('0x2d')](_0x4e43fc,_0x845d('0x2b'));_0x48e7a0[_0x845d('0x32')]=_['keys'](_0x28c2b8['query']);_0x48e7a0[_0x845d('0x33')]=_['intersection'](_0x48e7a0[_0x845d('0x31')],_0x48e7a0['query']);_0x385257[_0x845d('0x34')]=_[_0x845d('0x35')](_0x48e7a0[_0x845d('0x31')],qs['fields'](_0x28c2b8[_0x845d('0x32')][_0x845d('0x36')]));_0x385257['attributes']=_0x385257[_0x845d('0x34')][_0x845d('0x37')]?_0x385257[_0x845d('0x34')]:_0x48e7a0[_0x845d('0x31')];if(!_0x28c2b8[_0x845d('0x32')][_0x845d('0x38')]('nolimit')){_0x385257[_0x845d('0x22')]=qs['limit'](_0x28c2b8[_0x845d('0x32')][_0x845d('0x22')]);_0x385257[_0x845d('0x1f')]=qs[_0x845d('0x1f')](_0x28c2b8['query'][_0x845d('0x1f')]);}_0x385257[_0x845d('0x39')]=qs[_0x845d('0x3a')](_0x28c2b8[_0x845d('0x32')][_0x845d('0x3a')]);_0x385257[_0x845d('0x3b')]=qs[_0x845d('0x33')](_['pick'](_0x28c2b8['query'],_0x48e7a0[_0x845d('0x33')]),_0x4e43fc);if(_0x28c2b8['query']['filter']){_0x385257[_0x845d('0x3b')]=_[_0x845d('0x3c')](_0x385257[_0x845d('0x3b')],{'$or':_[_0x845d('0x2d')](_0x4e43fc,function(_0x4c1a6d){if(_0x4c1a6d['type']!=='VIRTUAL'){var _0x3fb950={};_0x3fb950[_0x4c1a6d[_0x845d('0x2b')]]={'$like':'%'+_0x28c2b8[_0x845d('0x32')][_0x845d('0x3d')]+'%'};return _0x3fb950;}})});}_0x385257=_[_0x845d('0x3c')]({},_0x385257,_0x28c2b8['options']);var _0x5ed31c={'where':_0x385257[_0x845d('0x3b')]};return db[_0x845d('0x2e')][_0x845d('0x21')](_0x5ed31c)[_0x845d('0x29')](function(_0x34213b){_0x18de28[_0x845d('0x21')]=_0x34213b;if(_0x28c2b8[_0x845d('0x32')][_0x845d('0x3e')]){_0x385257[_0x845d('0x3f')]=[{'all':!![]}];}return db[_0x845d('0x2e')][_0x845d('0x40')](_0x385257);})[_0x845d('0x29')](function(_0x55aef4){_0x18de28[_0x845d('0x41')]=_0x55aef4;return _0x18de28;})['then'](respondWithFilteredResult(_0xa26b89,_0x385257))[_0x845d('0x42')](handleError(_0xa26b89,null));};exports[_0x845d('0x43')]=function(_0x3c28d7,_0x3256f2){var _0x25f8e1={'raw':![],'where':{'id':_0x3c28d7[_0x845d('0x44')]['id']}},_0x567c8a={};_0x567c8a[_0x845d('0x31')]=_[_0x845d('0x45')](db['UserProfile']['rawAttributes']);_0x567c8a['query']=_[_0x845d('0x45')](_0x3c28d7[_0x845d('0x32')]);_0x567c8a[_0x845d('0x33')]=_[_0x845d('0x35')](_0x567c8a[_0x845d('0x31')],_0x567c8a['query']);_0x25f8e1[_0x845d('0x34')]=_[_0x845d('0x35')](_0x567c8a[_0x845d('0x31')],qs[_0x845d('0x36')](_0x3c28d7[_0x845d('0x32')]['fields']));_0x25f8e1['attributes']=_0x25f8e1['attributes']['length']?_0x25f8e1[_0x845d('0x34')]:_0x567c8a['model'];if(_0x3c28d7['query'][_0x845d('0x3e')]){_0x25f8e1['include']=[{'all':!![]}];}_0x25f8e1=_[_0x845d('0x3c')]({},_0x25f8e1,_0x3c28d7[_0x845d('0x46')]);return db['UserProfile'][_0x845d('0x47')](_0x25f8e1)[_0x845d('0x29')](handleEntityNotFound(_0x3256f2,null))[_0x845d('0x29')](respondWithResult(_0x3256f2,null))['catch'](handleError(_0x3256f2,null));};exports[_0x845d('0x48')]=function(_0x469579,_0x4b5bd7){return db[_0x845d('0x2e')][_0x845d('0x48')](_0x469579['body'],{})[_0x845d('0x29')](respondWithResult(_0x4b5bd7,0xc9))[_0x845d('0x42')](handleError(_0x4b5bd7,null));};exports[_0x845d('0x49')]=function(_0x4796fd,_0x86454a){var _0x455b6f={'where':{'id':_0x4796fd[_0x845d('0x44')]['id']}},_0x15c7ec={};_0x15c7ec[_0x845d('0x31')]=_['keys'](db['UserProfile'][_0x845d('0x2f')]);_0x455b6f[_0x845d('0x34')]=_[_0x845d('0x35')](_0x15c7ec['model'],qs[_0x845d('0x36')](_0x4796fd[_0x845d('0x32')][_0x845d('0x36')]));_0x455b6f[_0x845d('0x34')]=_0x455b6f[_0x845d('0x34')]['length']?_0x455b6f[_0x845d('0x34')]:_0x15c7ec['model'];if(_0x4796fd[_0x845d('0x32')][_0x845d('0x3e')]){_0x455b6f[_0x845d('0x3f')]=[{'all':!![]}];}_0x455b6f=_[_0x845d('0x3c')]({},_0x455b6f,_0x4796fd[_0x845d('0x46')]);return db[_0x845d('0x2e')][_0x845d('0x47')](_0x455b6f)['then'](handleEntityNotFound(_0x86454a,null))[_0x845d('0x29')](function(_0x2f95ee){if(_0x2f95ee){var _0x5ae159=_0x2f95ee['get']({'plain':!![]});_0x5ae159=qs[_0x845d('0x4a')](_0x5ae159,['id','createdAt',_0x845d('0x4b'),'crudPermissions']);_0x4796fd['body']=_[_0x845d('0x4a')](_0x4796fd[_0x845d('0x4c')],['id',_0x845d('0x4d'),_0x845d('0x4b')]);return db[_0x845d('0x4e')][_0x845d('0x4f')](function(_0x3f1f25){return db[_0x845d('0x2e')][_0x845d('0x48')](_[_0x845d('0x3c')](_0x5ae159,_0x4796fd[_0x845d('0x4c')]),{'include':_0x4796fd[_0x845d('0x32')][_0x845d('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x3f1f25})['then'](function(_0x166062){var _0x3f423f=_0x166062[_0x845d('0x50')]({'plain':!![]});return db[_0x845d('0x51')]['findAll']({'where':{'userProfileId':_0x4796fd[_0x845d('0x44')]['id']},'raw':!![]})['then'](function(_0x59a1ba){if(_0x59a1ba){return BPromise[_0x845d('0x52')](_0x59a1ba,function(_0x150b6e){return new BPromise(function(_0x4178de,_0x10977a){if(_0x150b6e[_0x845d('0x53')]===null||_0x150b6e[_0x845d('0x53')]===0x1)_0x4178de(null);return db[_0x845d('0x54')][_0x845d('0x40')]({'where':{'sectionId':_0x150b6e['id']},'raw':!![]})[_0x845d('0x29')](function(_0x180527){var _0x2a8481=_[_0x845d('0x2d')](_0x180527,function(_0xd765){return qs[_0x845d('0x4a')](_0xd765,['id','createdAt','updatedAt',_0x845d('0x55')]);});_0x4178de(_0x2a8481);})[_0x845d('0x42')](function(_0x33884d){_0x10977a(_0x33884d);});})[_0x845d('0x29')](function(_0x1a6a64){var _0x266d62=qs[_0x845d('0x4a')](_0x150b6e,['id',_0x845d('0x4d'),'updatedAt']);_0x266d62[_0x845d('0x56')]=_0x3f423f['id'];if(_0x1a6a64)_0x266d62[_0x845d('0x57')]=_0x1a6a64;return _0x266d62;})['then'](function(_0x3aa052){return db[_0x845d('0x51')][_0x845d('0x48')](_0x3aa052,{'include':[{'model':db[_0x845d('0x54')],'as':_0x845d('0x57')}],'raw':!![],'transaction':_0x3f1f25});});})[_0x845d('0x29')](function(){return _0x3f423f;});}});});});}})[_0x845d('0x29')](respondWithResult(_0x86454a,0xc9))['catch'](handleError(_0x86454a,null));};exports[_0x845d('0x27')]=function(_0x59cdb7,_0x44ed8d){if(_0x59cdb7[_0x845d('0x4c')]['id']){delete _0x59cdb7[_0x845d('0x4c')]['id'];}return db[_0x845d('0x2e')][_0x845d('0x47')]({'where':{'id':_0x59cdb7['params']['id']}})[_0x845d('0x29')](handleEntityNotFound(_0x44ed8d,null))[_0x845d('0x29')](saveUpdates(_0x59cdb7['body'],null))[_0x845d('0x29')](respondWithResult(_0x44ed8d,null))[_0x845d('0x42')](handleError(_0x44ed8d,null));};exports['destroy']=function(_0x3377de,_0x3fdb1e){return db[_0x845d('0x2e')]['find']({'where':{'id':_0x3377de[_0x845d('0x44')]['id']}})[_0x845d('0x29')](handleEntityNotFound(_0x3fdb1e,null))[_0x845d('0x29')](removeEntity(_0x3fdb1e,null))['catch'](handleError(_0x3fdb1e,null));};exports[_0x845d('0x58')]=function(_0x537206,_0x47b777){return db['UserProfile'][_0x845d('0x58')]()['then'](respondWithResult(_0x47b777,null))[_0x845d('0x42')](handleError(_0x47b777,null));};exports[_0x845d('0x59')]=function(_0x32f0d6,_0x2e8422){var _0x2fa788=_0x32f0d6['body'];return db['UserProfile']['find']({'where':{'id':_0x32f0d6['params']['id']}})['then'](handleEntityNotFound(_0x2e8422,null))[_0x845d('0x29')](function(_0x43bea5){if(_0x43bea5){return db[_0x845d('0x4e')]['transaction'](function(_0x29e998){return db[_0x845d('0x51')][_0x845d('0x28')]({'where':{'userProfileId':_0x32f0d6['params']['id'],'sectionId':_[_0x845d('0x2d')](_0x2fa788,function(_0x37379a){return _0x37379a['sectionId'];})},'transaction':_0x29e998})[_0x845d('0x29')](function(){var _0x22b750=_[_0x845d('0x2d')](_0x2fa788,function(_0x23c0e9){_0x23c0e9['userProfileId']=_0x32f0d6['params']['id'];return _0x23c0e9;});var _0x7b8dc5=[];return BPromise[_0x845d('0x52')](_0x22b750,function(_0x520b48){return db[_0x845d('0x51')][_0x845d('0x48')](_0x520b48,{'include':[{'model':db['UserProfileResource'],'as':_0x845d('0x57')}],'raw':!![],'transaction':_0x29e998})['then'](function(_0x23872e){_0x7b8dc5['push'](_0x23872e[_0x845d('0x50')]({'plain':!![]}));});})[_0x845d('0x29')](function(){return _0x7b8dc5;});});});}})[_0x845d('0x29')](function(_0x201c47){return _0x201c47;})[_0x845d('0x29')](respondWithResult(_0x2e8422,null))['catch'](handleError(_0x2e8422,null));};exports['removeSections']=function(_0x2d276e,_0x1b0233){var _0x4f52a5;return db[_0x845d('0x2e')][_0x845d('0x47')]({'where':{'id':_0x2d276e['params']['id']},'attributes':['id',_0x845d('0x2b')]})[_0x845d('0x29')](handleEntityNotFound(_0x1b0233,null))['then'](function(_0x296cf8){if(_0x296cf8){_0x4f52a5=_0x296cf8;return db[_0x845d('0x51')]['destroy']({'where':{'userProfileId':_0x2d276e[_0x845d('0x44')]['id'],'sectionId':_0x2d276e[_0x845d('0x32')]['ids']}});}})['then'](function(){return _0x4f52a5;})[_0x845d('0x29')](respondWithStatusCode(_0x1b0233,null))['catch'](handleError(_0x1b0233,null));};exports[_0x845d('0x5a')]=function(_0x15f94b,_0x52ddf9){var _0x301aa1=[];var _0x244de8=[];return db[_0x845d('0x51')][_0x845d('0x40')]({'where':{'userProfileId':_0x15f94b['params']['id']},'raw':!![]})['then'](function(_0xac6a5d){_0x301aa1=_[_0x845d('0x3d')](_0xac6a5d,function(_0x42b1a2){return _0x42b1a2[_0x845d('0x5b')]===0x1||_[_0x845d('0x5c')]([0x3eb,0x709],_0x42b1a2[_0x845d('0x55')]);});if(!_[_0x845d('0x5d')](_0x301aa1)){return _[_0x845d('0x2d')](_0x301aa1,function(_0x4eecb5){return _0x4eecb5[_0x845d('0x55')];});}else{return;}})[_0x845d('0x29')](function(_0x49cf2d){if(_0x49cf2d)_0x244de8=_0x49cf2d;if(_[_0x845d('0x5c')](_0x244de8,0x64)){var _0x3538ad=_[_0x845d('0x47')](_0x301aa1,{'sectionId':0x64});return hasDefaultDashboard(_0x3538ad)[_0x845d('0x29')](function(_0x15dbce){return _[_0x845d('0x2d')](_0x301aa1,function(_0x56b04d){if(_0x56b04d[_0x845d('0x55')]===0x64){_0x56b04d['subsections']=_0x15dbce;}return _0x56b04d;});});}else{return;}})[_0x845d('0x29')](function(_0x508f52){if(_0x508f52)_0x301aa1=_0x508f52;if(_[_0x845d('0x5c')](_0x244de8,0x3eb)){var _0x442bb1=_['find'](_0x301aa1,{'sectionId':0x3eb});return getCustomDashboards(_0x442bb1)[_0x845d('0x29')](function(_0x1e38b9){return _['map'](_0x301aa1,function(_0xfcc857){if(_0x442bb1[_0x845d('0x5b')]){if(_0xfcc857[_0x845d('0x55')]===0x3eb){_0xfcc857[_0x845d('0x5e')]=_0x1e38b9;}}else{if(_0xfcc857[_0x845d('0x55')]===0x64){_0xfcc857['subsections']=_0x1e38b9;}}return _0xfcc857;});});}else{return;}})[_0x845d('0x29')](function(_0x4ebdd2){if(_0x4ebdd2)_0x301aa1=_0x4ebdd2;if(_[_0x845d('0x5c')](_0x244de8,0x709)){var _0x2cc2f3=_['find'](_0x301aa1,{'sectionId':0x709});return getPlugins(_0x2cc2f3)[_0x845d('0x29')](function(_0xb82b42){if(_0x2cc2f3[_0x845d('0x5b')]){return _['map'](_0x301aa1,function(_0x148a05){if(_0x148a05[_0x845d('0x55')]===0x709){_0x148a05[_0x845d('0x5e')]=_0xb82b42;}return _0x148a05;});}else{var _0x4b01ae={'sectionId':0x76c,'enabled':0x1,'subsections':_0xb82b42};var _0x4b9234=_[_0x845d('0x2d')](_0x301aa1);_0x4b9234[_0x845d('0x5f')](_0x4b01ae);return _0x4b9234;}});}else{return;}})[_0x845d('0x29')](function(_0x3228e7){if(_0x3228e7)_0x301aa1=_0x3228e7;return _[_0x845d('0x3d')](_0x301aa1,[_0x845d('0x5b'),0x1]);})['then'](respondWithResult(_0x52ddf9,null))[_0x845d('0x42')](handleError(_0x52ddf9,null));};function hasDefaultDashboard(_0x3cf337){var _0x54916d=[0x65];return new BPromise(function(_0x55de5f,_0x3eddbf){try{if(_0x3cf337[_0x845d('0x53')]){_0x55de5f(_0x54916d);}else{return db[_0x845d('0x54')][_0x845d('0x60')]({'where':{'sectionId':_0x3cf337['id']},'raw':!![]})[_0x845d('0x29')](function(_0x576c88){_0x576c88?_0x55de5f(_0x54916d):_0x55de5f();});}}catch(_0x570eac){_0x3eddbf(_0x570eac);}});}function getCustomDashboards(_0x585190){var _0x50580b=[];return new BPromise(function(_0x294705,_0x36de90){try{if(_0x585190[_0x845d('0x53')]){return db[_0x845d('0x61')][_0x845d('0x40')]({'raw':!![]})[_0x845d('0x29')](function(_0x16b271){_0x16b271['forEach'](function(_0x368784){_0x50580b[_0x845d('0x5f')](_0x368784['id']+0x1869f);});_0x294705(_0x50580b);});}else{return db[_0x845d('0x54')][_0x845d('0x40')]({'where':{'sectionId':_0x585190['id']},'raw':!![]})[_0x845d('0x29')](function(_0x34cb1d){_0x34cb1d[_0x845d('0x62')](function(_0x24a1ab){_0x50580b[_0x845d('0x5f')](_0x24a1ab[_0x845d('0x63')]+0x1869f);});_0x294705(_0x50580b);});}}catch(_0x2f082a){_0x36de90(_0x2f082a);}});}function getPlugins(_0x27523a){var _0xcea58a=[];return new BPromise(function(_0xa7cfe5,_0x32dc53){try{if(_0x27523a[_0x845d('0x53')]){return db[_0x845d('0x64')][_0x845d('0x40')]({'raw':!![]})[_0x845d('0x29')](function(_0x3d24c0){_0x3d24c0[_0x845d('0x62')](function(_0x6f6690){_0xcea58a[_0x845d('0x5f')](_0x6f6690['id']+0x15b38);});_0xa7cfe5(_0xcea58a);});}else{return db[_0x845d('0x54')][_0x845d('0x40')]({'where':{'sectionId':_0x27523a['id']},'raw':!![]})['then'](function(_0x5b3813){_0x5b3813[_0x845d('0x62')](function(_0x2fb3c8){_0xcea58a[_0x845d('0x5f')](_0x2fb3c8['resourceId']+0x15b38);});_0xa7cfe5(_0xcea58a);});}}catch(_0x33ba78){_0x32dc53(_0x33ba78);}});}exports[_0x845d('0x65')]=function(_0x5f34a5,_0x3562d3){return db[_0x845d('0x2e')][_0x845d('0x47')]({'where':{'id':_0x5f34a5[_0x845d('0x44')]['id']}})[_0x845d('0x29')](handleEntityNotFound(_0x3562d3,null))['then'](function(_0x178dc0){if(_0x178dc0){return db[_0x845d('0x4e')][_0x845d('0x4f')](function(_0x3468b8){return db[_0x845d('0x51')][_0x845d('0x40')]({'where':{'userProfileId':_0x5f34a5[_0x845d('0x44')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x518b33){if(_0x518b33){return db[_0x845d('0x51')][_0x845d('0x28')]({'where':{'userProfileId':_0x5f34a5[_0x845d('0x44')]['id'],'id':_[_0x845d('0x2d')](_0x518b33,function(_0x4f0e69){return _0x4f0e69['id'];})},'transaction':_0x3468b8});}})[_0x845d('0x29')](function(_0x4948ce){var _0x323690=_[_0x845d('0x2d')](_0x5f34a5[_0x845d('0x4c')],function(_0x57ffc5){_0x57ffc5[_0x845d('0x56')]=_0x5f34a5[_0x845d('0x44')]['id'];return _0x57ffc5;});return db[_0x845d('0x51')]['bulkCreate'](_0x323690,{'raw':!![],'transaction':_0x3468b8});})[_0x845d('0x29')](function(_0x1a2a4b){var _0x3a7352=_['filter'](_[_0x845d('0x2d')](_0x1a2a4b,function(_0x41d527){return _0x41d527[_0x845d('0x50')]({'plain':!![]});}),{'includeAll':![]});if(_0x3a7352){return db['UserProfileSection'][_0x845d('0x40')]({'where':{'userProfileId':_0x5f34a5[_0x845d('0x44')]['id'],'sectionId':_[_0x845d('0x2d')](_0x3a7352,function(_0x4ca737){return _0x4ca737['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})[_0x845d('0x29')](function(_0x27e0d2){var _0x58149b=_[_0x845d('0x2d')](_0x5f34a5[_0x845d('0x4c')],function(_0x36b2ed){_0x36b2ed[_0x845d('0x56')]=_0x5f34a5['params']['id'];return _0x36b2ed;});return db['UserProfileResource'][_0x845d('0x66')](_0x58149b,{'raw':!![],'transaction':_0x3468b8});});}})['catch'](handleError(_0x3562d3,null));});}})['then'](function(_0x589336){var _0x3dae0b=_[_0x845d('0x2d')](_0x589336,function(_0x3fccf8){return _0x3fccf8[_0x845d('0x50')]({'plain':!![]});});})['then'](respondWithResult(_0x3562d3,null))[_0x845d('0x42')](handleError(_0x3562d3,null));};exports[_0x845d('0x67')]=function(_0x206195,_0x4c0531,_0x3e0f17){return db[_0x845d('0x2e')]['find']({'where':{'id':_0x206195[_0x845d('0x44')]['id']}})[_0x845d('0x29')](handleEntityNotFound(_0x4c0531,null))[_0x845d('0x29')](function(_0x3ae6ff){if(_0x3ae6ff){return _0x3ae6ff[_0x845d('0x67')](_0x206195[_0x845d('0x32')][_0x845d('0x68')]);}})[_0x845d('0x29')](respondWithStatusCode(_0x4c0531,null))[_0x845d('0x42')](handleError(_0x4c0531,null));};exports[_0x845d('0x69')]=function(_0x41adf0,_0x4e8816){var _0x492ac3={};if(!_0x41adf0[_0x845d('0x32')][_0x845d('0x6a')])throw new Error('Missing\x20section\x20parameter');if(!_0x41adf0[_0x845d('0x32')][_0x845d('0x38')](_0x845d('0x6b'))){_0x492ac3[_0x845d('0x22')]=qs['limit'](_0x41adf0[_0x845d('0x32')]['limit']);_0x492ac3[_0x845d('0x1f')]=qs[_0x845d('0x1f')](_0x41adf0[_0x845d('0x32')]['offset']);}return db[_0x845d('0x2e')][_0x845d('0x47')]({'where':{'id':_0x41adf0['params']['id']}})[_0x845d('0x29')](function(_0x500d59){if(!_0x500d59)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x41adf0['params']['id']);return db[_0x845d('0x2e')][_0x845d('0x69')](_0x41adf0);})[_0x845d('0x29')](respondWithFilteredResult(_0x4e8816,_0x492ac3))['catch'](handleError(_0x4e8816,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 05bb81c..a652cd0 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 _0x5464=['../../mysqldb','UserProfile','save','remove','emit','exports','events'];(function(_0x437351,_0x709928){var _0x40f093=function(_0x3f8f91){while(--_0x3f8f91){_0x437351['push'](_0x437351['shift']());}};_0x40f093(++_0x709928);}(_0x5464,0x15d));var _0x4546=function(_0x3ce6e3,_0x3a14dc){_0x3ce6e3=_0x3ce6e3-0x0;var _0x3a1b56=_0x5464[_0x3ce6e3];return _0x3a1b56;};'use strict';var EventEmitter=require(_0x4546('0x0'));var UserProfile=require(_0x4546('0x1'))['db'][_0x4546('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4546('0x3'),'afterUpdate':'update','afterDestroy':_0x4546('0x4')};function emitEvent(_0x5a3f9d){return function(_0x320c4d,_0x396a1d,_0xcc9def){UserProfileEvents[_0x4546('0x5')](_0x5a3f9d+':'+_0x320c4d['id'],_0x320c4d);UserProfileEvents['emit'](_0x5a3f9d,_0x320c4d);_0xcc9def(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x4546('0x6')]=UserProfileEvents; \ No newline at end of file +var _0x627e=['events','../../mysqldb','UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x35b18a,_0x6b2fbe){var _0x4db1bd=function(_0x389e62){while(--_0x389e62){_0x35b18a['push'](_0x35b18a['shift']());}};_0x4db1bd(++_0x6b2fbe);}(_0x627e,0x14a));var _0xe627=function(_0x242246,_0x4fbb4b){_0x242246=_0x242246-0x0;var _0xe84abe=_0x627e[_0x242246];return _0xe84abe;};'use strict';var EventEmitter=require(_0xe627('0x0'));var UserProfile=require(_0xe627('0x1'))['db'][_0xe627('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xe627('0x3')](0x0);var events={'afterCreate':_0xe627('0x4'),'afterUpdate':'update','afterDestroy':_0xe627('0x5')};function emitEvent(_0x328881){return function(_0x2abdc7,_0x59a2c8,_0x52923f){UserProfileEvents['emit'](_0x328881+':'+_0x2abdc7['id'],_0x2abdc7);UserProfileEvents[_0xe627('0x6')](_0x328881,_0x2abdc7);_0x52923f(null);};}for(var e in events){if(events[_0xe627('0x7')](e)){var event=events[e];UserProfile[_0xe627('0x8')](e,emitEvent(event));}}module[_0xe627('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 5231cd1..344a7ba 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 _0xa405=['SmsAccount','whatsappqueues','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','VoiceQueues','QueueCampaigns','users','telephones','Agents','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','cannedanswers','CannedAnswer','Disposition','customdashboards','intervals','Interval','pauses','scheduler','tags','Tag','trunks','Trunk','variables','plugins','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','catch','define','UserProfile','section','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','find','all','union','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','sort','pick','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','merge','includeAll','include','reportType','default','reportId','DefaultReports','CustomReports','count','rows','color','tag','ThroughTags','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','models','value','findAll','then','associatedResources','map','filter','field','model','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','CmContact','lists','CmList','companies','CmCompany','chatqueues','ChatQueue','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','voicerecordings','VoiceRecording','membername','User','role','Telephones','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','smsqueues','SmsQueue','smsaccounts'];(function(_0x4efc60,_0x2548ff){var _0x3abe82=function(_0x221764){while(--_0x221764){_0x4efc60['push'](_0x4efc60['shift']());}};_0x3abe82(++_0x2548ff);}(_0xa405,0x1ca));var _0x5a40=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa405[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var attributes=require(_0x5a40('0x0'));var qs=require(_0x5a40('0x1'));module['exports']=function(_0x333546){var _0x27c25c=_0x333546[_0x5a40('0x2')];function _0x47488f(_0x162920,_0x5e2f83){return new Promise(function(_0x12b697,_0x204d78){if(!_0x5e2f83)return _0x12b697(null);var _0x431e85=_0x5e2f83['filter']?{[_0x5e2f83['filter']['field']]:_0x5e2f83['filter'][_0x5a40('0x3')]}:undefined;return _0x27c25c[_0x162920][_0x5a40('0x4')]({'where':_0x431e85,'raw':!![]})[_0x5a40('0x5')](function(_0x5bb80d){_0x5e2f83[_0x5a40('0x6')]=_[_0x5a40('0x7')](_0x5bb80d,'id');_0x12b697(_0x5e2f83);})['catch'](function(_0x4f0de5){_0x204d78(_0x4f0de5);});});}function _0x55e4fd(_0x23a28a,_0x5b617c){return new Promise(function(_0x25c3f3,_0x5a3253){var _0x2a53a8=_0x23a28a['filter']?{[_0x23a28a[_0x5a40('0x8')][_0x5a40('0x9')]]:_0x23a28a['filter'][_0x5a40('0x3')]}:undefined;return _0x27c25c[_0x23a28a[_0x5a40('0xa')]][_0x5a40('0x4')]({'where':_0x2a53a8,'raw':!![]})['then'](function(_0x3c655d){_0x5b617c[_0x5a40('0x6')]=_[_0x5a40('0x7')](_0x3c655d,function(_0x5f3e59){return _0x5f3e59['name'];});_0x25c3f3(_0x5b617c);})['catch'](function(_0x12cc02){_0x5a3253(_0x12cc02);});});}function _0x1181fe(_0x1c0e57,_0x20112f,_0x5a8270){if(!_0x20112f)return resolve(null);return new Promise(function(_0x20e4c0,_0x57c130){return _0x27c25c['UserProfileResource']['findAll']({'where':{'sectionId':_0x20112f['id']},'raw':!![]})[_0x5a40('0x5')](function(_0xadf000){if(_0x1c0e57['field']&&_0x1c0e57[_0x5a40('0x9')]!=='id'){_0x20112f[_0x5a40('0x6')]=_[_0x5a40('0x7')](_0xadf000,function(_0x339b09){return _0x339b09[_0x1c0e57[_0x5a40('0x9')]];});}else{if(_0x5a8270==='AnalyticExtractedReport'){_0x20112f[_0x5a40('0x6')]=_[_0x5a40('0x7')](_0xadf000,function(_0x549ef7){return{'id':_0x549ef7[_0x5a40('0xb')],'type':_0x549ef7[_0x5a40('0xc')]};});}else{_0x20112f[_0x5a40('0x6')]=_[_0x5a40('0x7')](_0xadf000,function(_0x3a44c4){return _0x3a44c4[_0x5a40('0xb')];});}}_0x20e4c0(_0x20112f);})['catch'](function(_0x1b50a9){_0x57c130(_0x1b50a9);});});}function _0x194e9b(_0x2ee0e4,_0xb94c79){var _0x1ddecf={'parentSections':[]};switch(_0x2ee0e4[_0x5a40('0xd')]()){case _0x5a40('0xe'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x10');break;case _0x5a40('0x11'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x12');break;case _0x5a40('0x13'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x14');_0x1ddecf[_0x5a40('0x15')]=[{'name':_0x5a40('0x16'),'field':_0x5a40('0x17'),'foreignKey':_0x5a40('0x18')}];break;case _0x5a40('0x19'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x1a');break;case _0x5a40('0x1b'):_0x1ddecf['childModel']=_0x5a40('0x1c');_0x1ddecf[_0x5a40('0x15')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0x5a40('0x1d'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x1e');break;case _0x5a40('0x1f'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x20');break;case'globalcustomfields':_0x1ddecf['childModel']='CmCustomField';break;case _0x5a40('0x21'):_0x1ddecf['childModel']=_0x5a40('0x22');break;case'chatwebsites':_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x23');break;case _0x5a40('0x24'):_0x1ddecf[_0x5a40('0xf')]='FaxQueue';break;case _0x5a40('0x25'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x26');break;case _0x5a40('0x27'):case _0x5a40('0x28'):case _0x5a40('0x29'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x2a');break;case'contexts':_0x1ddecf[_0x5a40('0xf')]='VoiceContext';break;case'voicemails':_0x1ddecf['childModel']='VoiceMail';break;case _0x5a40('0x2b'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x2c');_0x1ddecf['parentSections']=[{'name':'Agents','field':_0x5a40('0x17'),'foreignKey':_0x5a40('0x2d'),'model':_0x5a40('0x2e'),'filter':{'field':_0x5a40('0x2f'),'value':['agent']}},{'name':_0x5a40('0x30'),'field':_0x5a40('0x17'),'foreignKey':_0x5a40('0x2d'),'model':_0x5a40('0x2e'),'filter':{'field':_0x5a40('0x2f'),'value':['telephone']}},{'name':'VoiceQueues','field':_0x5a40('0x17'),'foreignKey':_0x5a40('0x31'),'model':_0x5a40('0x32'),'filter':{'field':'type','value':[_0x5a40('0x33')]}},{'name':'QueueCampaigns','field':'name','foreignKey':_0x5a40('0x31'),'model':_0x5a40('0x32'),'filter':{'field':'type','value':[_0x5a40('0x34')]}}];break;case _0x5a40('0x35'):_0x1ddecf['childModel']=_0x5a40('0x36');break;case _0x5a40('0x37'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x38');break;case _0x5a40('0x39'):_0x1ddecf['childModel']=_0x5a40('0x3a');break;case'ivrcampaigns':_0x1ddecf['childModel']=_0x5a40('0x3b');break;case'mailqueues':_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x3c');break;case _0x5a40('0x3d'):_0x1ddecf['childModel']=_0x5a40('0x3e');break;case _0x5a40('0x3f'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x40');break;case _0x5a40('0x41'):_0x1ddecf['childModel']='OpenchannelQueue';break;case _0x5a40('0x42'):_0x1ddecf['childModel']='OpenchannelAccount';break;case _0x5a40('0x43'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x44');break;case _0x5a40('0x45'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x46');break;case _0x5a40('0x47'):_0x1ddecf[_0x5a40('0xf')]='WhatsappQueue';break;case _0x5a40('0x48'):_0x1ddecf['childModel']='WhatsappAccount';break;case _0x5a40('0x49'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x4a');break;case _0x5a40('0x4b'):case _0x5a40('0x4c'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x32');if(_0xb94c79){_0x1ddecf[_0x5a40('0x15')]=[{'name':_0x5a40('0x4d')},{'name':_0x5a40('0x4e')}];}break;case _0x5a40('0x4f'):case'agents':case _0x5a40('0x50'):_0x1ddecf['childModel']=_0x5a40('0x2e');if(_0xb94c79){_0x1ddecf[_0x5a40('0x15')]=[{'name':'Users','filter':{'field':_0x5a40('0x2f'),'value':['admin','user']},'ignore':!![]},{'name':_0x5a40('0x51')},{'name':_0x5a40('0x30')}];}break;case _0x5a40('0x52'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x53');break;case'salesforceaccounts':_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x54');break;case _0x5a40('0x55'):_0x1ddecf['childModel']=_0x5a40('0x56');break;case _0x5a40('0x57'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x58');break;case _0x5a40('0x59'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x5a');break;case _0x5a40('0x5b'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x5c');break;case'vtigeraccounts':_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x2e');break;case _0x5a40('0x5d'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x5e');break;case'dispositions':_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x5f');break;case _0x5a40('0x60'):_0x1ddecf['childModel']='Dashboard';break;case _0x5a40('0x61'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x62');break;case _0x5a40('0x63'):_0x1ddecf[_0x5a40('0xf')]='Pause';break;case _0x5a40('0x64'):_0x1ddecf['childModel']='Schedule';break;case'sounds':_0x1ddecf['childModel']='Sound';break;case _0x5a40('0x65'):_0x1ddecf['childModel']=_0x5a40('0x66');break;case'templates':_0x1ddecf[_0x5a40('0xf')]='Template';break;case'triggers':_0x1ddecf[_0x5a40('0xf')]='Trigger';break;case _0x5a40('0x67'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x68');break;case _0x5a40('0x69'):_0x1ddecf[_0x5a40('0xf')]='Variable';break;case _0x5a40('0x6a'):_0x1ddecf[_0x5a40('0xf')]='Plugin';break;case _0x5a40('0x6b'):_0x1ddecf[_0x5a40('0xf')]='AnalyticExtractedReport';_0x1ddecf[_0x5a40('0x15')]=[{'name':_0x5a40('0x6c'),'field':'id','foreignKey':'reportId'}];break;case _0x5a40('0x6d'):_0x1ddecf[_0x5a40('0xf')]=_0x5a40('0x6e');break;case _0x5a40('0x48'):_0x1ddecf['childModel']='WhatsappAccount';break;}return _0x1ddecf;}function _0x5346a0(_0x593e73,_0x2cb374){var _0x29eb84=_0x593e73[_0x5a40('0x6f')](0x0)[_0x5a40('0x70')]()+_0x593e73[_0x5a40('0x71')](0x1);var _0x370bc3={'type':_0x27c25c[_0x5a40('0x72')][_0x5a40('0x73')][_0x5a40('0x74')],'raw':!![]};return new BPromise(function(_0x10f9ab,_0x2ff841){var _0x3cb53b=squel[_0x5a40('0x75')]()[_0x5a40('0x9')](_0x5a40('0x76')+_0x29eb84+'InteractionId','id')[_0x5a40('0x9')]('ui.createdAt')['from'](_0x5a40('0x77')+_0x593e73+_0x5a40('0x78'),'ui')[_0x5a40('0x79')](_0x5a40('0x7a'),_0x2cb374['id']);return _0x27c25c[_0x5a40('0x7b')][_0x5a40('0x7c')](_0x3cb53b['toString'](),_0x370bc3)[_0x5a40('0x5')](function(_0x23a641){_0x2cb374[_0x29eb84+_0x5a40('0x7d')]=_0x23a641;_0x10f9ab(_0x23a641);})[_0x5a40('0x7e')](function(_0x176134){_0x2ff841(_0x176134);});});}return _0x333546[_0x5a40('0x7f')](_0x5a40('0x80'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5c50a4){var _0x57bc91={'raw':![],'where':{}};var _0x5017f5={};var _0x387c88={'count':0x0,'rows':[]};var _0x1a71c1=_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0x81')];var _0x1bdb3e=_0x5c50a4[_0x5a40('0x7c')]['mergeResources']||![];var _0x56a13d=_0x194e9b(_0x1a71c1,_0x1bdb3e);if(!_0x56a13d['childModel'])throw new Error(_0x5a40('0x82')+_0x1a71c1+'\x27');var _0xc8321e=[{'name':_0x1a71c1}];if(!_[_0x5a40('0x83')](_0x56a13d[_0x5a40('0x15')]))_0xc8321e=_0x56a13d[_0x5a40('0x15')];var _0x2fc98a=[];for(var _0x410ca8=0x0;_0x410ca8<_0xc8321e[_0x5a40('0x84')];_0x410ca8++){_0x2fc98a['push'](_0x27c25c[_0x5a40('0x85')][_0x5a40('0x86')]({'where':{'userProfileId':_0x5c50a4['params']['id'],'name':_0xc8321e[_0x410ca8][_0x5a40('0x17')]},'raw':!![]}));}return Promise[_0x5a40('0x87')](_0x2fc98a)[_0x5a40('0x5')](function(_0x28d66b){var _0x4f2e42=_[_0x5a40('0x8')](_0x28d66b,function(_0x329546){return _0x329546?_0x329546:undefined;});var _0xe5d62d=_['filter'](_0xc8321e,['ignore',!![]]);var _0x515499=_['isEmpty'](_0x4f2e42)&&_[_0x5a40('0x83')](_0xe5d62d)?null:_[_0x5a40('0x88')](_0xe5d62d,_0x4f2e42);if(!_0x515499)return null;var _0x7a5594=[];for(var _0x1bfcc7=0x0;_0x1bfcc7<_0x515499[_0x5a40('0x84')];_0x1bfcc7++){var _0x4139ee=_[_0x5a40('0x86')](_0xc8321e,function(_0x57fb95){return _0x515499[_0x1bfcc7]?_0x57fb95['name']===_0x515499[_0x1bfcc7]['name']:null;});if(_0x4139ee){if(_0x515499[_0x1bfcc7]['ignore']){_0x7a5594[_0x5a40('0x89')](_0x47488f(_0x56a13d[_0x5a40('0xf')],_0x515499[_0x1bfcc7]));}else{if(!_0x515499[_0x1bfcc7][_0x5a40('0x8a')]){_0x7a5594[_0x5a40('0x89')](_0x1181fe(_0x4139ee,_0x515499[_0x1bfcc7],_0x56a13d[_0x5a40('0xf')]));}else{if(_0x4139ee[_0x5a40('0xa')]){_0x7a5594[_0x5a40('0x89')](_0x55e4fd(_0x4139ee,_0x515499[_0x1bfcc7]));}}}}}return Promise['all'](_0x7a5594);})[_0x5a40('0x5')](function(_0x261672){var _0x296cea=_0x261672;var _0x30fc5f=null;if(_0x296cea){_0x30fc5f=_0x296cea[_0x5a40('0x84')]===0x1?_0x296cea[0x0]:null;}if(!_0x30fc5f&&!_0x296cea)return _0x387c88;var _0x56491e=_0x27c25c[_0x56a13d[_0x5a40('0xf')]][_0x5a40('0x8b')];_0x5017f5[_0x5a40('0xa')]=_[_0x5a40('0x8c')](_0x56491e);_0x5017f5['query']=_[_0x5a40('0x8c')](_0x5c50a4[_0x5a40('0x7c')]);_0x5017f5[_0x5a40('0x8d')]=_[_0x5a40('0x8e')](_0x5017f5[_0x5a40('0xa')],_0x5017f5[_0x5a40('0x7c')]);_0x57bc91['attributes']=_[_0x5a40('0x8e')](_0x5017f5[_0x5a40('0xa')],qs[_0x5a40('0x8f')](_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0x8f')]));_0x57bc91['attributes']=_0x57bc91[_0x5a40('0x90')][_0x5a40('0x84')]?_0x57bc91['attributes']:_0x5017f5[_0x5a40('0xa')];if(!_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0x91')](_0x5a40('0x92'))){_0x57bc91[_0x5a40('0x93')]=qs['limit'](_0x5c50a4[_0x5a40('0x7c')]['limit']);_0x57bc91[_0x5a40('0x94')]=qs[_0x5a40('0x94')](_0x5c50a4['query'][_0x5a40('0x94')]);}_0x57bc91['order']=qs[_0x5a40('0x95')](_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0x95')]);_0x57bc91[_0x5a40('0x79')]=qs[_0x5a40('0x8d')](_[_0x5a40('0x96')](_0x5c50a4[_0x5a40('0x7c')],_0x5017f5['filters']));if(_0x5c50a4['query'][_0x5a40('0x8')]){_0x57bc91[_0x5a40('0x79')]=_['merge'](_0x57bc91[_0x5a40('0x79')],{'$or':_['map'](_0x56491e,function(_0x49d9ca){if(_0x49d9ca['type']['key']!==_0x5a40('0x97')){var _0x42afdf={};_0x42afdf[_0x49d9ca[_0x5a40('0x9')]]={'$like':'%'+_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0x8')]+'%'};return _0x42afdf;}})});}var _0x301b96=[];if(_0x30fc5f){var _0x49365d=_[_0x5a40('0x86')](_0xc8321e,[_0x5a40('0x17'),_0x30fc5f['name']]);if(_0x49365d['field']){var _0x3c1cc1={};if(_0x56a13d[_0x5a40('0xf')]===_0x5a40('0x98')){_0x3c1cc1[_0x49365d[_0x5a40('0x99')]]=_[_0x5a40('0x7')](_0x30fc5f[_0x5a40('0x6')],'id');}else{_0x3c1cc1[_0x49365d[_0x5a40('0x99')]]=_0x30fc5f[_0x5a40('0x6')];}_0x301b96[_0x5a40('0x89')](_0x3c1cc1);}else{_0x57bc91['where']['id']=_0x30fc5f[_0x5a40('0x6')];}}else{for(var _0x507596=0x0;_0x507596<_0x296cea['length'];_0x507596++){var _0x49365d=_[_0x5a40('0x86')](_0xc8321e,[_0x5a40('0x17'),_0x296cea[_0x507596]['name']]);if(_0x49365d[_0x5a40('0x9')]){var _0x3c1cc1={};_0x3c1cc1[_0x49365d[_0x5a40('0x99')]]=_0x296cea[_0x507596][_0x5a40('0x6')];_0x301b96[_0x5a40('0x89')](_0x3c1cc1);}else{if(!_0x57bc91['where']['id'])_0x57bc91[_0x5a40('0x79')]['id']=[];_0x296cea[_0x507596]['associatedResources'][_0x5a40('0x9a')](function(_0x3e42dd){_0x57bc91[_0x5a40('0x79')]['id'][_0x5a40('0x89')](_0x3e42dd);});}}}if(!_[_0x5a40('0x83')](_0x301b96)){_0x57bc91[_0x5a40('0x79')]=_['merge'](_0x57bc91['where'],{'$and':{'$or':_0x301b96}});}_0x57bc91=_[_0x5a40('0x9b')]({},_0x57bc91,_0x5c50a4['options']);if(_0x30fc5f&&!_0x30fc5f[_0x5a40('0x8a')]&&_0x56a13d[_0x5a40('0xf')]==='AnalyticExtractedReport'){if(_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0x9c')]){_0x57bc91[_0x5a40('0x9d')]=[{'all':!![]}];}return _0x27c25c[_0x56a13d[_0x5a40('0xf')]][_0x5a40('0x4')](_0x57bc91)[_0x5a40('0x5')](function(_0x5de49f){var _0xc4550b=[];_0x5de49f['forEach'](function(_0x360f75){var _0x5ab32b;switch(_0x360f75[_0x5a40('0x9e')]){case _0x5a40('0x9f'):_0x5ab32b=_[_0x5a40('0x86')](_0x30fc5f[_0x5a40('0x6')],function(_0xd1528){return _0xd1528['id']===_0x360f75[_0x5a40('0xa0')]&&_0xd1528[_0x5a40('0xc')]===_0x5a40('0xa1');});break;case'custom':_0x5ab32b=_['find'](_0x30fc5f[_0x5a40('0x6')],function(_0x288877){return _0x288877['id']===_0x360f75['reportId']&&_0x288877['type']===_0x5a40('0xa2');});break;}if(_0x5ab32b)_0xc4550b['push'](_0x360f75);});_0x387c88[_0x5a40('0xa3')]=_0xc4550b[_0x5a40('0x84')];_0x387c88[_0x5a40('0xa4')]=_0xc4550b;return _0x387c88;});}else{return _0x27c25c[_0x56a13d['childModel']][_0x5a40('0xa3')]({'where':_0x57bc91[_0x5a40('0x79')]})['then'](function(_0x4893ce){_0x387c88[_0x5a40('0xa3')]=_0x4893ce;if(_0x5c50a4[_0x5a40('0x7c')]['includeAll']){if(_0x56a13d[_0x5a40('0xf')]===_0x5a40('0x1c')){_0x57bc91[_0x5a40('0x9d')]=[{'model':_0x27c25c[_0x5a40('0x66')],'as':'Tags','attributes':['id',_0x5a40('0x17'),_0x5a40('0xa5')],'required':_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0xa6')]?!![]:![]},{'model':_0x27c25c[_0x5a40('0x66')],'as':_0x5a40('0xa7'),'attributes':['id',_0x5a40('0x17'),_0x5a40('0xa5')],'through':_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0xa6')]?{'attributes':[],'where':{'TagId':_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0xa6')]||undefined}}:{},'required':_0x5c50a4[_0x5a40('0x7c')][_0x5a40('0xa6')]?!![]:![]}];}else{_0x57bc91['include']=[{'all':!![]}];}}return _0x27c25c[_0x56a13d[_0x5a40('0xf')]][_0x5a40('0x4')](_0x57bc91);})[_0x5a40('0x5')](function(_0x13a07c){_0x387c88[_0x5a40('0xa4')]=_0x13a07c;if(_0x1a71c1===_0x5a40('0x51')&&_0x5c50a4['query'][_0x5a40('0xa8')]==='true'){var _0x923a8a=[];for(var _0x3d2f93=0x0;_0x3d2f93<_0x387c88[_0x5a40('0xa4')][_0x5a40('0x84')];_0x3d2f93++){_0x923a8a[_0x5a40('0x89')](_0x5346a0(_0x5a40('0xa9'),_0x387c88[_0x5a40('0xa4')][_0x3d2f93][_0x5a40('0xaa')]));_0x923a8a[_0x5a40('0x89')](_0x5346a0(_0x5a40('0xab'),_0x387c88[_0x5a40('0xa4')][_0x3d2f93]['dataValues']));_0x923a8a['push'](_0x5346a0(_0x5a40('0xac'),_0x387c88[_0x5a40('0xa4')][_0x3d2f93][_0x5a40('0xaa')]));_0x923a8a[_0x5a40('0x89')](_0x5346a0(_0x5a40('0xad'),_0x387c88[_0x5a40('0xa4')][_0x3d2f93][_0x5a40('0xaa')]));_0x923a8a[_0x5a40('0x89')](_0x5346a0(_0x5a40('0xae'),_0x387c88[_0x5a40('0xa4')][_0x3d2f93]['dataValues']));_0x923a8a['push'](_0x5346a0(_0x5a40('0xaf'),_0x387c88[_0x5a40('0xa4')][_0x3d2f93][_0x5a40('0xaa')]));}return Promise[_0x5a40('0x87')](_0x923a8a)[_0x5a40('0x5')](function(){return _0x387c88;});}return _0x387c88;});}});}}});}; \ No newline at end of file +var _0xabad=['VoiceContext','voicemails','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','telephones','admin','user','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','Reports','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','union','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','merge','VIRTUAL','foreignKey','forEach','options','autoAssociation','includeAll','include','default','reportId','CustomReports','count','rows','CmContact','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','openchannel','whatsapp','lodash','../../components/parsers/qs','exports','models','filter','field','findAll','then','associatedResources','catch','value','model','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','parentSections','ListId','lists','CmList','CmCompany','globalcustomfields','chatqueues','ChatQueue','ChatWebsite','faxqueues','FaxQueue','internalroutes','outboundroutes','VoiceExtension'];(function(_0x4839d0,_0x1f5c36){var _0xefa7c4=function(_0x37c902){while(--_0x37c902){_0x4839d0['push'](_0x4839d0['shift']());}};_0xefa7c4(++_0x1f5c36);}(_0xabad,0x150));var _0xdaba=function(_0x48b5f9,_0x585cfb){_0x48b5f9=_0x48b5f9-0x0;var _0x55ae7a=_0xabad[_0x48b5f9];return _0x55ae7a;};'use strict';var _=require(_0xdaba('0x0'));var attributes=require('./userProfile.attributes');var qs=require(_0xdaba('0x1'));module[_0xdaba('0x2')]=function(_0x434276){var _0x58ca1f=_0x434276[_0xdaba('0x3')];function _0x6b1c78(_0x4ce3ba,_0x2f84cc){return new Promise(function(_0x17a0a1,_0x15b04d){if(!_0x2f84cc)return _0x17a0a1(null);var _0x387d02=_0x2f84cc[_0xdaba('0x4')]?{[_0x2f84cc[_0xdaba('0x4')][_0xdaba('0x5')]]:_0x2f84cc[_0xdaba('0x4')]['value']}:undefined;return _0x58ca1f[_0x4ce3ba][_0xdaba('0x6')]({'where':_0x387d02,'raw':!![]})[_0xdaba('0x7')](function(_0x2fbd5b){_0x2f84cc[_0xdaba('0x8')]=_['map'](_0x2fbd5b,'id');_0x17a0a1(_0x2f84cc);})[_0xdaba('0x9')](function(_0x2c4ef7){_0x15b04d(_0x2c4ef7);});});}function _0x26d3d0(_0x1bcb11,_0x163723){return new Promise(function(_0x2afffa,_0x3d4407){var _0xf535c5=_0x1bcb11[_0xdaba('0x4')]?{[_0x1bcb11['filter'][_0xdaba('0x5')]]:_0x1bcb11['filter'][_0xdaba('0xa')]}:undefined;return _0x58ca1f[_0x1bcb11[_0xdaba('0xb')]][_0xdaba('0x6')]({'where':_0xf535c5,'raw':!![]})[_0xdaba('0x7')](function(_0x24daca){_0x163723[_0xdaba('0x8')]=_[_0xdaba('0xc')](_0x24daca,function(_0x4e6e33){return _0x4e6e33[_0xdaba('0xd')];});_0x2afffa(_0x163723);})[_0xdaba('0x9')](function(_0x3367a7){_0x3d4407(_0x3367a7);});});}function _0x57679f(_0x342903,_0x1768a3,_0x372b43){if(!_0x1768a3)return resolve(null);return new Promise(function(_0x5c4ec1,_0x77ca57){return _0x58ca1f[_0xdaba('0xe')][_0xdaba('0x6')]({'where':{'sectionId':_0x1768a3['id']},'raw':!![]})[_0xdaba('0x7')](function(_0xbb676){if(_0x342903['field']&&_0x342903[_0xdaba('0x5')]!=='id'){_0x1768a3[_0xdaba('0x8')]=_[_0xdaba('0xc')](_0xbb676,function(_0x512260){return _0x512260[_0x342903['field']];});}else{if(_0x372b43===_0xdaba('0xf')){_0x1768a3['associatedResources']=_['map'](_0xbb676,function(_0x13322c){return{'id':_0x13322c[_0xdaba('0x10')],'type':_0x13322c[_0xdaba('0x11')]};});}else{_0x1768a3[_0xdaba('0x8')]=_['map'](_0xbb676,function(_0x4f2359){return _0x4f2359[_0xdaba('0x10')];});}}_0x5c4ec1(_0x1768a3);})[_0xdaba('0x9')](function(_0x537ac3){_0x77ca57(_0x537ac3);});});}function _0x1beb8b(_0x522258,_0x16520){var _0x3cd92d={'parentSections':[]};switch(_0x522258[_0xdaba('0x12')]()){case'squareprojects':_0x3cd92d['childModel']=_0xdaba('0x13');break;case _0xdaba('0x14'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x16');break;case _0xdaba('0x17'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x18');_0x3cd92d['parentSections']=[{'name':_0xdaba('0x19'),'field':_0xdaba('0xd'),'foreignKey':_0xdaba('0x1a')}];break;case _0xdaba('0x1b'):_0x3cd92d['childModel']=_0xdaba('0x1c');break;case _0xdaba('0x1d'):_0x3cd92d[_0xdaba('0x15')]='CmContact';_0x3cd92d[_0xdaba('0x1e')]=[{'name':'Lists','field':'id','foreignKey':_0xdaba('0x1f')}];break;case _0xdaba('0x20'):_0x3cd92d['childModel']=_0xdaba('0x21');break;case'companies':_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x22');break;case _0xdaba('0x23'):_0x3cd92d[_0xdaba('0x15')]='CmCustomField';break;case _0xdaba('0x24'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x25');break;case'chatwebsites':_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x26');break;case _0xdaba('0x27'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x28');break;case'faxaccounts':_0x3cd92d['childModel']='FaxAccount';break;case'inboundroutes':case _0xdaba('0x29'):case _0xdaba('0x2a'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x2b');break;case'contexts':_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x2c');break;case _0xdaba('0x2d'):_0x3cd92d[_0xdaba('0x15')]='VoiceMail';break;case _0xdaba('0x2e'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x2f');_0x3cd92d[_0xdaba('0x1e')]=[{'name':_0xdaba('0x30'),'field':'name','foreignKey':_0xdaba('0x31'),'model':_0xdaba('0x32'),'filter':{'field':_0xdaba('0x33'),'value':['agent']}},{'name':_0xdaba('0x34'),'field':'name','foreignKey':_0xdaba('0x31'),'model':_0xdaba('0x32'),'filter':{'field':'role','value':[_0xdaba('0x35')]}},{'name':_0xdaba('0x36'),'field':_0xdaba('0xd'),'foreignKey':_0xdaba('0x37'),'model':_0xdaba('0x38'),'filter':{'field':_0xdaba('0x11'),'value':[_0xdaba('0x39')]}},{'name':_0xdaba('0x3a'),'field':_0xdaba('0xd'),'foreignKey':_0xdaba('0x37'),'model':_0xdaba('0x38'),'filter':{'field':_0xdaba('0x11'),'value':[_0xdaba('0x3b')]}}];break;case _0xdaba('0x3c'):_0x3cd92d['childModel']=_0xdaba('0x3d');break;case _0xdaba('0x3e'):_0x3cd92d[_0xdaba('0x15')]='VoiceChanSpy';break;case _0xdaba('0x3f'):_0x3cd92d[_0xdaba('0x15')]='VoicePrefix';break;case _0xdaba('0x40'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x41');break;case _0xdaba('0x42'):_0x3cd92d[_0xdaba('0x15')]='MailQueue';break;case _0xdaba('0x43'):_0x3cd92d['childModel']=_0xdaba('0x44');break;case'mailsubstatuses':_0x3cd92d[_0xdaba('0x15')]='MailSubstatus';break;case _0xdaba('0x45'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x46');break;case _0xdaba('0x47'):_0x3cd92d['childModel']='OpenchannelAccount';break;case'smsqueues':_0x3cd92d[_0xdaba('0x15')]='SmsQueue';break;case _0xdaba('0x48'):_0x3cd92d[_0xdaba('0x15')]='SmsAccount';break;case _0xdaba('0x49'):_0x3cd92d['childModel']=_0xdaba('0x4a');break;case _0xdaba('0x4b'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x4c');break;case'teams':_0x3cd92d['childModel']=_0xdaba('0x4d');break;case _0xdaba('0x4e'):case _0xdaba('0x4f'):_0x3cd92d['childModel']=_0xdaba('0x38');if(_0x16520){_0x3cd92d[_0xdaba('0x1e')]=[{'name':_0xdaba('0x36')},{'name':_0xdaba('0x3a')}];}break;case _0xdaba('0x50'):case _0xdaba('0x51'):case _0xdaba('0x52'):_0x3cd92d[_0xdaba('0x15')]='User';if(_0x16520){_0x3cd92d[_0xdaba('0x1e')]=[{'name':'Users','filter':{'field':_0xdaba('0x33'),'value':[_0xdaba('0x53'),_0xdaba('0x54')]},'ignore':!![]},{'name':_0xdaba('0x30')},{'name':_0xdaba('0x34')}];}break;case'zendeskaccounts':_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x55');break;case'salesforceaccounts':_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x56');break;case _0xdaba('0x57'):_0x3cd92d[_0xdaba('0x15')]='FreshdeskAccount';break;case _0xdaba('0x58'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x59');break;case _0xdaba('0x5a'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x5b');break;case _0xdaba('0x5c'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x5d');break;case _0xdaba('0x5e'):_0x3cd92d[_0xdaba('0x15')]='User';break;case _0xdaba('0x5f'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x60');break;case _0xdaba('0x61'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x62');break;case _0xdaba('0x63'):_0x3cd92d['childModel']=_0xdaba('0x64');break;case _0xdaba('0x65'):_0x3cd92d['childModel']=_0xdaba('0x66');break;case _0xdaba('0x67'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x68');break;case'scheduler':_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x69');break;case _0xdaba('0x6a'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x6b');break;case _0xdaba('0x6c'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x6d');break;case _0xdaba('0x6e'):_0x3cd92d['childModel']=_0xdaba('0x6f');break;case'triggers':_0x3cd92d['childModel']='Trigger';break;case _0xdaba('0x70'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x71');break;case _0xdaba('0x72'):_0x3cd92d['childModel']=_0xdaba('0x73');break;case _0xdaba('0x74'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x75');break;case _0xdaba('0x76'):_0x3cd92d['childModel']='AnalyticExtractedReport';_0x3cd92d[_0xdaba('0x1e')]=[{'name':_0xdaba('0x77'),'field':'id','foreignKey':'reportId'}];break;case _0xdaba('0x78'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x79');break;case _0xdaba('0x4b'):_0x3cd92d[_0xdaba('0x15')]=_0xdaba('0x4c');break;}return _0x3cd92d;}function _0x9d189(_0x295aef,_0x21cf03){var _0x19c06a=_0x295aef[_0xdaba('0x7a')](0x0)[_0xdaba('0x7b')]()+_0x295aef[_0xdaba('0x7c')](0x1);var _0x5e2daf={'type':_0x58ca1f['Sequelize'][_0xdaba('0x7d')][_0xdaba('0x7e')],'raw':!![]};return new BPromise(function(_0x5e1c80,_0x35c4eb){var _0x511607=squel['select']()['field'](_0xdaba('0x7f')+_0x19c06a+_0xdaba('0x80'),'id')[_0xdaba('0x5')](_0xdaba('0x81'))[_0xdaba('0x82')]('user_has_'+_0x295aef+_0xdaba('0x83'),'ui')[_0xdaba('0x84')](_0xdaba('0x85'),_0x21cf03['id']);return _0x58ca1f[_0xdaba('0x86')][_0xdaba('0x87')](_0x511607[_0xdaba('0x88')](),_0x5e2daf)[_0xdaba('0x7')](function(_0x51331d){_0x21cf03[_0x19c06a+'OpenTabs']=_0x51331d;_0x5e1c80(_0x51331d);})[_0xdaba('0x9')](function(_0x31f35){_0x35c4eb(_0x31f35);});});}return _0x434276[_0xdaba('0x89')](_0xdaba('0x8a'),attributes,{'tableName':_0xdaba('0x8b'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x26758c){var _0x274363={'raw':![],'where':{}};var _0x474fe2={};var _0x3b25fe={'count':0x0,'rows':[]};var _0x5eb1f9=_0x26758c[_0xdaba('0x87')][_0xdaba('0x8c')];var _0x293e02=_0x26758c[_0xdaba('0x87')][_0xdaba('0x8d')]||![];var _0x3b696b=_0x1beb8b(_0x5eb1f9,_0x293e02);if(!_0x3b696b['childModel'])throw new Error(_0xdaba('0x8e')+_0x5eb1f9+'\x27');var _0x4f5421=[{'name':_0x5eb1f9}];if(!_[_0xdaba('0x8f')](_0x3b696b[_0xdaba('0x1e')]))_0x4f5421=_0x3b696b[_0xdaba('0x1e')];var _0x24a1d9=[];for(var _0x2b92b6=0x0;_0x2b92b6<_0x4f5421[_0xdaba('0x90')];_0x2b92b6++){_0x24a1d9[_0xdaba('0x91')](_0x58ca1f[_0xdaba('0x92')][_0xdaba('0x93')]({'where':{'userProfileId':_0x26758c[_0xdaba('0x94')]['id'],'name':_0x4f5421[_0x2b92b6][_0xdaba('0xd')]},'raw':!![]}));}return Promise[_0xdaba('0x95')](_0x24a1d9)[_0xdaba('0x7')](function(_0x57cc98){var _0x3eb85b=_[_0xdaba('0x4')](_0x57cc98,function(_0x182b9e){return _0x182b9e?_0x182b9e:undefined;});var _0x21b8bb=_[_0xdaba('0x4')](_0x4f5421,[_0xdaba('0x96'),!![]]);var _0x4774c2=_[_0xdaba('0x8f')](_0x3eb85b)&&_['isEmpty'](_0x21b8bb)?null:_[_0xdaba('0x97')](_0x21b8bb,_0x3eb85b);if(!_0x4774c2)return null;var _0xa34f99=[];for(var _0x561cf2=0x0;_0x561cf2<_0x4774c2[_0xdaba('0x90')];_0x561cf2++){var _0xaa1b95=_[_0xdaba('0x93')](_0x4f5421,function(_0x56aeaa){return _0x4774c2[_0x561cf2]?_0x56aeaa[_0xdaba('0xd')]===_0x4774c2[_0x561cf2][_0xdaba('0xd')]:null;});if(_0xaa1b95){if(_0x4774c2[_0x561cf2][_0xdaba('0x96')]){_0xa34f99[_0xdaba('0x91')](_0x6b1c78(_0x3b696b[_0xdaba('0x15')],_0x4774c2[_0x561cf2]));}else{if(!_0x4774c2[_0x561cf2]['autoAssociation']){_0xa34f99[_0xdaba('0x91')](_0x57679f(_0xaa1b95,_0x4774c2[_0x561cf2],_0x3b696b[_0xdaba('0x15')]));}else{if(_0xaa1b95[_0xdaba('0xb')]){_0xa34f99[_0xdaba('0x91')](_0x26d3d0(_0xaa1b95,_0x4774c2[_0x561cf2]));}}}}}return Promise['all'](_0xa34f99);})[_0xdaba('0x7')](function(_0x515bef){var _0x5c28a2=_0x515bef;var _0x236f94=null;if(_0x5c28a2){_0x236f94=_0x5c28a2['length']===0x1?_0x5c28a2[0x0]:null;}if(!_0x236f94&&!_0x5c28a2)return _0x3b25fe;var _0x5c4748=_0x58ca1f[_0x3b696b[_0xdaba('0x15')]][_0xdaba('0x98')];_0x474fe2[_0xdaba('0xb')]=_['keys'](_0x5c4748);_0x474fe2[_0xdaba('0x87')]=_[_0xdaba('0x99')](_0x26758c[_0xdaba('0x87')]);_0x474fe2['filters']=_[_0xdaba('0x9a')](_0x474fe2[_0xdaba('0xb')],_0x474fe2[_0xdaba('0x87')]);_0x274363[_0xdaba('0x9b')]=_[_0xdaba('0x9a')](_0x474fe2[_0xdaba('0xb')],qs[_0xdaba('0x9c')](_0x26758c[_0xdaba('0x87')][_0xdaba('0x9c')]));_0x274363[_0xdaba('0x9b')]=_0x274363[_0xdaba('0x9b')][_0xdaba('0x90')]?_0x274363[_0xdaba('0x9b')]:_0x474fe2['model'];if(!_0x26758c[_0xdaba('0x87')][_0xdaba('0x9d')](_0xdaba('0x9e'))){_0x274363[_0xdaba('0x9f')]=qs['limit'](_0x26758c[_0xdaba('0x87')][_0xdaba('0x9f')]);_0x274363[_0xdaba('0xa0')]=qs['offset'](_0x26758c['query'][_0xdaba('0xa0')]);}_0x274363[_0xdaba('0xa1')]=qs['sort'](_0x26758c[_0xdaba('0x87')][_0xdaba('0xa2')]);_0x274363[_0xdaba('0x84')]=qs[_0xdaba('0xa3')](_[_0xdaba('0xa4')](_0x26758c[_0xdaba('0x87')],_0x474fe2[_0xdaba('0xa3')]));if(_0x26758c[_0xdaba('0x87')]['filter']){_0x274363[_0xdaba('0x84')]=_[_0xdaba('0xa5')](_0x274363[_0xdaba('0x84')],{'$or':_[_0xdaba('0xc')](_0x5c4748,function(_0x546312){if(_0x546312[_0xdaba('0x11')]['key']!==_0xdaba('0xa6')){var _0x1f2256={};_0x1f2256[_0x546312['field']]={'$like':'%'+_0x26758c['query'][_0xdaba('0x4')]+'%'};return _0x1f2256;}})});}var _0x621997=[];if(_0x236f94){var _0x49185e=_[_0xdaba('0x93')](_0x4f5421,[_0xdaba('0xd'),_0x236f94[_0xdaba('0xd')]]);if(_0x49185e[_0xdaba('0x5')]){var _0x454d04={};if(_0x3b696b['childModel']===_0xdaba('0xf')){_0x454d04[_0x49185e[_0xdaba('0xa7')]]=_[_0xdaba('0xc')](_0x236f94['associatedResources'],'id');}else{_0x454d04[_0x49185e[_0xdaba('0xa7')]]=_0x236f94[_0xdaba('0x8')];}_0x621997[_0xdaba('0x91')](_0x454d04);}else{_0x274363[_0xdaba('0x84')]['id']=_0x236f94[_0xdaba('0x8')];}}else{for(var _0x420e7c=0x0;_0x420e7c<_0x5c28a2[_0xdaba('0x90')];_0x420e7c++){var _0x49185e=_[_0xdaba('0x93')](_0x4f5421,[_0xdaba('0xd'),_0x5c28a2[_0x420e7c][_0xdaba('0xd')]]);if(_0x49185e[_0xdaba('0x5')]){var _0x454d04={};_0x454d04[_0x49185e[_0xdaba('0xa7')]]=_0x5c28a2[_0x420e7c][_0xdaba('0x8')];_0x621997[_0xdaba('0x91')](_0x454d04);}else{if(!_0x274363['where']['id'])_0x274363['where']['id']=[];_0x5c28a2[_0x420e7c][_0xdaba('0x8')][_0xdaba('0xa8')](function(_0x5d08fa){_0x274363[_0xdaba('0x84')]['id']['push'](_0x5d08fa);});}}}if(!_[_0xdaba('0x8f')](_0x621997)){_0x274363[_0xdaba('0x84')]=_[_0xdaba('0xa5')](_0x274363[_0xdaba('0x84')],{'$and':{'$or':_0x621997}});}_0x274363=_['merge']({},_0x274363,_0x26758c[_0xdaba('0xa9')]);if(_0x236f94&&!_0x236f94[_0xdaba('0xaa')]&&_0x3b696b[_0xdaba('0x15')]===_0xdaba('0xf')){if(_0x26758c[_0xdaba('0x87')][_0xdaba('0xab')]){_0x274363[_0xdaba('0xac')]=[{'all':!![]}];}return _0x58ca1f[_0x3b696b['childModel']][_0xdaba('0x6')](_0x274363)[_0xdaba('0x7')](function(_0x3a4f49){var _0x57abca=[];_0x3a4f49['forEach'](function(_0x49b10b){var _0x3ef1d4;switch(_0x49b10b['reportType']){case _0xdaba('0xad'):_0x3ef1d4=_[_0xdaba('0x93')](_0x236f94[_0xdaba('0x8')],function(_0x28a79b){return _0x28a79b['id']===_0x49b10b['reportId']&&_0x28a79b[_0xdaba('0x11')]==='DefaultReports';});break;case'custom':_0x3ef1d4=_[_0xdaba('0x93')](_0x236f94['associatedResources'],function(_0x45da0e){return _0x45da0e['id']===_0x49b10b[_0xdaba('0xae')]&&_0x45da0e[_0xdaba('0x11')]===_0xdaba('0xaf');});break;}if(_0x3ef1d4)_0x57abca['push'](_0x49b10b);});_0x3b25fe[_0xdaba('0xb0')]=_0x57abca['length'];_0x3b25fe[_0xdaba('0xb1')]=_0x57abca;return _0x3b25fe;});}else{return _0x58ca1f[_0x3b696b[_0xdaba('0x15')]][_0xdaba('0xb0')]({'where':_0x274363[_0xdaba('0x84')]})[_0xdaba('0x7')](function(_0x4bb241){_0x3b25fe[_0xdaba('0xb0')]=_0x4bb241;if(_0x26758c[_0xdaba('0x87')][_0xdaba('0xab')]){if(_0x3b696b[_0xdaba('0x15')]===_0xdaba('0xb2')){_0x274363[_0xdaba('0xac')]=[{'model':_0x58ca1f[_0xdaba('0x6d')],'as':_0xdaba('0xb3'),'attributes':['id','name',_0xdaba('0xb4')],'required':_0x26758c[_0xdaba('0x87')][_0xdaba('0xb5')]?!![]:![]},{'model':_0x58ca1f[_0xdaba('0x6d')],'as':_0xdaba('0xb6'),'attributes':['id',_0xdaba('0xd'),'color'],'through':_0x26758c['query']['tag']?{'attributes':[],'where':{'TagId':_0x26758c['query'][_0xdaba('0xb5')]||undefined}}:{},'required':_0x26758c[_0xdaba('0x87')][_0xdaba('0xb5')]?!![]:![]}];}else{_0x274363['include']=[{'all':!![]}];}}return _0x58ca1f[_0x3b696b[_0xdaba('0x15')]][_0xdaba('0x6')](_0x274363);})['then'](function(_0x484ee5){_0x3b25fe[_0xdaba('0xb1')]=_0x484ee5;if(_0x5eb1f9==='Agents'&&_0x26758c['query'][_0xdaba('0xb7')]===_0xdaba('0xb8')){var _0x5f14bd=[];for(var _0x521eb9=0x0;_0x521eb9<_0x3b25fe[_0xdaba('0xb1')]['length'];_0x521eb9++){_0x5f14bd['push'](_0x9d189('chat',_0x3b25fe[_0xdaba('0xb1')][_0x521eb9][_0xdaba('0xb9')]));_0x5f14bd[_0xdaba('0x91')](_0x9d189(_0xdaba('0xba'),_0x3b25fe[_0xdaba('0xb1')][_0x521eb9]['dataValues']));_0x5f14bd[_0xdaba('0x91')](_0x9d189(_0xdaba('0xbb'),_0x3b25fe[_0xdaba('0xb1')][_0x521eb9][_0xdaba('0xb9')]));_0x5f14bd[_0xdaba('0x91')](_0x9d189('mail',_0x3b25fe[_0xdaba('0xb1')][_0x521eb9][_0xdaba('0xb9')]));_0x5f14bd[_0xdaba('0x91')](_0x9d189(_0xdaba('0xbc'),_0x3b25fe[_0xdaba('0xb1')][_0x521eb9]['dataValues']));_0x5f14bd[_0xdaba('0x91')](_0x9d189(_0xdaba('0xbd'),_0x3b25fe[_0xdaba('0xb1')][_0x521eb9][_0xdaba('0xb9')]));}return Promise[_0xdaba('0x95')](_0x5f14bd)['then'](function(){return _0x3b25fe;});}return _0x3b25fe;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 35a89fa..8c36079 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 _0x33ac=['code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','UserProfile,\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);}(_0x33ac,0x1f2));var _0xc33a=function(_0x42fc25,_0x19246c){_0x42fc25=_0x42fc25-0x0;var _0x58fee3=_0x33ac[_0x42fc25];return _0x58fee3;};'use strict';var _=require('lodash');var util=require(_0xc33a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc33a('0x1'));var fs=require('fs');var Redis=require(_0xc33a('0x2'));var db=require(_0xc33a('0x3'))['db'];var utils=require(_0xc33a('0x4'));var logger=require(_0xc33a('0x5'))(_0xc33a('0x6'));var config=require(_0xc33a('0x7'));var jayson=require(_0xc33a('0x8'));var client=jayson[_0xc33a('0x9')]['http']({'port':0x232a});config['redis']=_[_0xc33a('0xa')](config[_0xc33a('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xc33a('0xc'))(new Redis(config['redis']));require(_0xc33a('0xd'))[_0xc33a('0xe')](socket);function respondWithRpcPromise(_0x288e87,_0x6ec731,_0x1abc99){return new BPromise(function(_0x36ad93,_0x2a6228){return client[_0xc33a('0xf')](_0x288e87,_0x1abc99)[_0xc33a('0x10')](function(_0x4eef76){logger['info'](_0xc33a('0x11'),_0x6ec731,'request\x20sent');logger['debug'](_0xc33a('0x12'),_0x6ec731,_0xc33a('0x13'),JSON[_0xc33a('0x14')](_0x4eef76));if(_0x4eef76[_0xc33a('0x15')]){if(_0x4eef76[_0xc33a('0x15')][_0xc33a('0x16')]===0x1f4){logger['error'](_0xc33a('0x11'),_0x6ec731,_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);return _0x2a6228(_0x4eef76['error'][_0xc33a('0x17')]);}logger['error'](_0xc33a('0x11'),_0x6ec731,_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);return _0x36ad93(_0x4eef76[_0xc33a('0x15')][_0xc33a('0x17')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x6ec731,_0xc33a('0x13'));_0x36ad93(_0x4eef76[_0xc33a('0x18')][_0xc33a('0x17')]);}})[_0xc33a('0x19')](function(_0x2f6095){logger[_0xc33a('0x15')](_0xc33a('0x11'),_0x6ec731,_0x2f6095);_0x2a6228(_0x2f6095);});});} \ No newline at end of file +var _0x9af6=['then','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request'];(function(_0x467e20,_0x5b6f1d){var _0x339bf2=function(_0x4abb85){while(--_0x4abb85){_0x467e20['push'](_0x467e20['shift']());}};_0x339bf2(++_0x5b6f1d);}(_0x9af6,0x1d7));var _0x69af=function(_0x3ee2cb,_0x1abce9){_0x3ee2cb=_0x3ee2cb-0x0;var _0x182c6b=_0x9af6[_0x3ee2cb];return _0x182c6b;};'use strict';var _=require(_0x69af('0x0'));var util=require(_0x69af('0x1'));var moment=require(_0x69af('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x69af('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x69af('0x4'))(_0x69af('0x5'));var config=require(_0x69af('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x69af('0x7')]['http']({'port':0x232a});config[_0x69af('0x8')]=_[_0x69af('0x9')](config[_0x69af('0x8')],{'host':_0x69af('0xa'),'port':0x18eb});var socket=require(_0x69af('0xb'))(new Redis(config[_0x69af('0x8')]));require(_0x69af('0xc'))[_0x69af('0xd')](socket);function respondWithRpcPromise(_0x59bc56,_0x5e42ea,_0x1dd1c2){return new BPromise(function(_0x19f2f7,_0x742a9c){return client[_0x69af('0xe')](_0x59bc56,_0x1dd1c2)[_0x69af('0xf')](function(_0x351143){logger[_0x69af('0x10')](_0x69af('0x11'),_0x5e42ea,'request\x20sent');logger[_0x69af('0x12')](_0x69af('0x13'),_0x5e42ea,_0x69af('0x14'),JSON[_0x69af('0x15')](_0x351143));if(_0x351143['error']){if(_0x351143[_0x69af('0x16')][_0x69af('0x17')]===0x1f4){logger[_0x69af('0x16')](_0x69af('0x11'),_0x5e42ea,_0x351143[_0x69af('0x16')][_0x69af('0x18')]);return _0x742a9c(_0x351143[_0x69af('0x16')][_0x69af('0x18')]);}logger['error'](_0x69af('0x11'),_0x5e42ea,_0x351143[_0x69af('0x16')][_0x69af('0x18')]);return _0x19f2f7(_0x351143[_0x69af('0x16')][_0x69af('0x18')]);}else{logger[_0x69af('0x10')]('UserProfile,\x20%s,\x20%s',_0x5e42ea,_0x69af('0x14'));_0x19f2f7(_0x351143[_0x69af('0x19')][_0x69af('0x18')]);}})[_0x69af('0x1a')](function(_0x244594){logger[_0x69af('0x16')](_0x69af('0x11'),_0x5e42ea,_0x244594);_0x742a9c(_0x244594);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index f2b27ef..458ca3f 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 _0x3c3a=['userProfile:','./userProfile.events','save','remove','update','emit','removeListener','register','length'];(function(_0x384182,_0x4b9b3d){var _0x5461c8=function(_0x24d021){while(--_0x24d021){_0x384182['push'](_0x384182['shift']());}};_0x5461c8(++_0x4b9b3d);}(_0x3c3a,0x184));var _0xa3c3=function(_0x384cf4,_0x36d5f4){_0x384cf4=_0x384cf4-0x0;var _0x2918c7=_0x3c3a[_0x384cf4];return _0x2918c7;};'use strict';var UserProfileEvents=require(_0xa3c3('0x0'));var events=[_0xa3c3('0x1'),_0xa3c3('0x2'),_0xa3c3('0x3')];function createListener(_0x334440,_0x129bfe){return function(_0x280b33){_0x129bfe[_0xa3c3('0x4')](_0x334440,_0x280b33);};}function removeListener(_0x297ab0,_0x59471a){return function(){UserProfileEvents[_0xa3c3('0x5')](_0x297ab0,_0x59471a);};}exports[_0xa3c3('0x6')]=function(_0x42aa96){for(var _0x540574=0x0,_0x3e7b12=events[_0xa3c3('0x7')];_0x540574<_0x3e7b12;_0x540574++){var _0x3cdb3f=events[_0x540574];var _0x394c1b=createListener(_0xa3c3('0x8')+_0x3cdb3f,_0x42aa96);UserProfileEvents['on'](_0x3cdb3f,_0x394c1b);}}; \ No newline at end of file +var _0x4aba=['./userProfile.events','remove','update','length','userProfile:'];(function(_0x340780,_0x3c275a){var _0xdfa026=function(_0x6b5446){while(--_0x6b5446){_0x340780['push'](_0x340780['shift']());}};_0xdfa026(++_0x3c275a);}(_0x4aba,0x145));var _0xa4ab=function(_0x262b3f,_0x3f990f){_0x262b3f=_0x262b3f-0x0;var _0x5b98af=_0x4aba[_0x262b3f];return _0x5b98af;};'use strict';var UserProfileEvents=require(_0xa4ab('0x0'));var events=['save',_0xa4ab('0x1'),_0xa4ab('0x2')];function createListener(_0x4660ee,_0x4cc40f){return function(_0x5e0c81){_0x4cc40f['emit'](_0x4660ee,_0x5e0c81);};}function removeListener(_0x1a528e,_0x4d40c5){return function(){UserProfileEvents['removeListener'](_0x1a528e,_0x4d40c5);};}exports['register']=function(_0x25f069){for(var _0xf7bb89=0x0,_0x4f874d=events[_0xa4ab('0x3')];_0xf7bb89<_0x4f874d;_0xf7bb89++){var _0x1aaca4=events[_0xf7bb89];var _0x4eb81c=createListener(_0xa4ab('0x4')+_0x1aaca4,_0x25f069);UserProfileEvents['on'](_0x1aaca4,_0x4eb81c);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index fdb9365..3bf51bd 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 _0xdf5d=['isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','Router','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get'];(function(_0x1c4da3,_0x4d3970){var _0x365b1c=function(_0x51733b){while(--_0x51733b){_0x1c4da3['push'](_0x1c4da3['shift']());}};_0x365b1c(++_0x4d3970);}(_0xdf5d,0x7d));var _0xddf5=function(_0x34c3c6,_0x324e29){_0x34c3c6=_0x34c3c6-0x0;var _0x491d1c=_0xdf5d[_0x34c3c6];return _0x491d1c;};'use strict';var multer=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xddf5('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xddf5('0x4'));var config=require(_0xddf5('0x5'));var controller=require(_0xddf5('0x6'));router[_0xddf5('0x7')]('/',auth[_0xddf5('0x8')](),controller[_0xddf5('0x9')]);router[_0xddf5('0x7')]('/describe',auth[_0xddf5('0x8')](),controller[_0xddf5('0xa')]);router[_0xddf5('0x7')](_0xddf5('0xb'),auth[_0xddf5('0x8')](),controller[_0xddf5('0xc')]);router[_0xddf5('0xd')]('/',auth[_0xddf5('0x8')](),controller[_0xddf5('0xe')]);router[_0xddf5('0xf')](_0xddf5('0xb'),auth[_0xddf5('0x8')](),controller[_0xddf5('0x10')]);router[_0xddf5('0x11')](_0xddf5('0xb'),auth[_0xddf5('0x8')](),controller[_0xddf5('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0224=['connect-timeout','Router','fs-extra','./userProfileResource.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','destroy','exports','multer','util'];(function(_0x2a37d8,_0x2c0dcb){var _0x154219=function(_0x12742d){while(--_0x12742d){_0x2a37d8['push'](_0x2a37d8['shift']());}};_0x154219(++_0x2c0dcb);}(_0x0224,0x11e));var _0x4022=function(_0x11f0a6,_0x1ce59d){_0x11f0a6=_0x11f0a6-0x0;var _0xa5ab4b=_0x0224[_0x11f0a6];return _0xa5ab4b;};'use strict';var multer=require(_0x4022('0x0'));var util=require(_0x4022('0x1'));var path=require('path');var timeout=require(_0x4022('0x2'));var express=require('express');var router=express[_0x4022('0x3')]();var fs_extra=require(_0x4022('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4022('0x5'));router[_0x4022('0x6')]('/',auth[_0x4022('0x7')](),controller[_0x4022('0x8')]);router[_0x4022('0x6')](_0x4022('0x9'),auth['isAuthenticated'](),controller[_0x4022('0xa')]);router['get'](_0x4022('0xb'),auth[_0x4022('0x7')](),controller[_0x4022('0xc')]);router[_0x4022('0xd')]('/',auth[_0x4022('0x7')](),controller['create']);router[_0x4022('0xe')](_0x4022('0xb'),auth[_0x4022('0x7')](),controller['update']);router[_0x4022('0xf')](_0x4022('0xb'),auth[_0x4022('0x7')](),controller[_0x4022('0x10')]);module[_0x4022('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 60ca00f..03d265a 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 _0x3290=['INTEGER','STRING','sequelize','exports'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x3290,0x1c2));var _0x0329=function(_0x49bd6b,_0x7d7ff6){_0x49bd6b=_0x49bd6b-0x0;var _0x34539d=_0x3290[_0x49bd6b];return _0x34539d;};'use strict';var Sequelize=require(_0x0329('0x0'));module[_0x0329('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x0329('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0329('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xc32b=['INTEGER','sequelize','exports'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xc32b,0x139));var _0xbc32=function(_0x135344,_0x19cee1){_0x135344=_0x135344-0x0;var _0xf236b3=_0xc32b[_0x135344];return _0xf236b3;};'use strict';var Sequelize=require(_0xbc32('0x0'));module[_0xbc32('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xbc32('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 04427da..6787f9c 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 _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','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/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x56119b,_0x11f773){var _0x4df62f=function(_0x463cca){while(--_0x463cca){_0x56119b['push'](_0x56119b['shift']());}};_0x4df62f(++_0x11f773);}(_0x2542,0x169));var _0x2254=function(_0x9b3f1,_0xa9c7c6){_0x9b3f1=_0x9b3f1-0x0;var _0x37bd6f=_0x2542[_0x9b3f1];return _0x37bd6f;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['UserProfileResource'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file +var _0x1a37=['index','map','UserProfileResource','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','describe','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','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a37,0xb4));var _0x71a3=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x1a37[_0x550d12];return _0x12103d;};'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));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0c8602f..f2d6a1a 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 _0xe82b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId'];(function(_0x435ce7,_0x5bf1ef){var _0x47edc0=function(_0x3510a8){while(--_0x3510a8){_0x435ce7['push'](_0x435ce7['shift']());}};_0x47edc0(++_0x5bf1ef);}(_0xe82b,0x156));var _0xbe82=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xe82b[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0xbe82('0x0'));var util=require(_0xbe82('0x1'));var logger=require(_0xbe82('0x2'))(_0xbe82('0x3'));var moment=require(_0xbe82('0x4'));var BPromise=require(_0xbe82('0x5'));var rp=require(_0xbe82('0x6'));var fs=require('fs');var path=require(_0xbe82('0x7'));var rimraf=require(_0xbe82('0x8'));var config=require(_0xbe82('0x9'));var attributes=require(_0xbe82('0xa'));module[_0xbe82('0xb')]=function(_0x2f8c9f,_0x3fcd54){return _0x2f8c9f[_0xbe82('0xc')](_0xbe82('0xd'),attributes,{'tableName':_0xbe82('0xe'),'paranoid':![],'indexes':[{'name':_0xbe82('0xf'),'fields':[_0xbe82('0x10'),_0xbe82('0x11')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f1b=['api','moment','bluebird','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','user_profile_has_resources','compositeIndex','sectionId','lodash','util'];(function(_0x20af1f,_0x1e8eb4){var _0x32b72=function(_0x5911f7){while(--_0x5911f7){_0x20af1f['push'](_0x20af1f['shift']());}};_0x32b72(++_0x1e8eb4);}(_0x2f1b,0x15d));var _0xb2f1=function(_0x2e52c5,_0x2cbde1){_0x2e52c5=_0x2e52c5-0x0;var _0x3ae965=_0x2f1b[_0x2e52c5];return _0x3ae965;};'use strict';var _=require(_0xb2f1('0x0'));var util=require(_0xb2f1('0x1'));var logger=require('../../config/logger')(_0xb2f1('0x2'));var moment=require(_0xb2f1('0x3'));var BPromise=require(_0xb2f1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2f1('0x5'));var rimraf=require(_0xb2f1('0x6'));var config=require(_0xb2f1('0x7'));var attributes=require(_0xb2f1('0x8'));module[_0xb2f1('0x9')]=function(_0x54d3ab,_0x34c3ac){return _0x54d3ab['define']('UserProfileResource',attributes,{'tableName':_0xb2f1('0xa'),'paranoid':![],'indexes':[{'name':_0xb2f1('0xb'),'fields':['resourceId',_0xb2f1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b25bc16..02af4cb 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 _0x5f8c=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x106384,_0xf2bd46){var _0x2a438d=function(_0x56e61c){while(--_0x56e61c){_0x106384['push'](_0x106384['shift']());}};_0x2a438d(++_0xf2bd46);}(_0x5f8c,0x1b8));var _0xc5f8=function(_0x563129,_0x26d5f9){_0x563129=_0x563129-0x0;var _0x28d1a3=_0x5f8c[_0x563129];return _0x28d1a3;};'use strict';var _=require(_0xc5f8('0x0'));var util=require(_0xc5f8('0x1'));var moment=require(_0xc5f8('0x2'));var BPromise=require(_0xc5f8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc5f8('0x4'))['db'];var utils=require(_0xc5f8('0x5'));var logger=require('../../config/logger')(_0xc5f8('0x6'));var config=require(_0xc5f8('0x7'));var jayson=require(_0xc5f8('0x8'));var client=jayson[_0xc5f8('0x9')][_0xc5f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c8765,_0x4e7f9d,_0x1c5860){return new BPromise(function(_0x574a73,_0x24d06b){return client[_0xc5f8('0xb')](_0x1c8765,_0x1c5860)[_0xc5f8('0xc')](function(_0x1f7f60){logger['info'](_0xc5f8('0xd'),_0x4e7f9d,_0xc5f8('0xe'));logger[_0xc5f8('0xf')](_0xc5f8('0x10'),_0x4e7f9d,'request\x20sent',JSON[_0xc5f8('0x11')](_0x1f7f60));if(_0x1f7f60['error']){if(_0x1f7f60['error'][_0xc5f8('0x12')]===0x1f4){logger[_0xc5f8('0x13')](_0xc5f8('0xd'),_0x4e7f9d,_0x1f7f60[_0xc5f8('0x13')][_0xc5f8('0x14')]);return _0x24d06b(_0x1f7f60[_0xc5f8('0x13')][_0xc5f8('0x14')]);}logger[_0xc5f8('0x13')](_0xc5f8('0xd'),_0x4e7f9d,_0x1f7f60['error'][_0xc5f8('0x14')]);return _0x574a73(_0x1f7f60[_0xc5f8('0x13')][_0xc5f8('0x14')]);}else{logger[_0xc5f8('0x15')]('UserProfileResource,\x20%s,\x20%s',_0x4e7f9d,_0xc5f8('0xe'));_0x574a73(_0x1f7f60[_0xc5f8('0x16')][_0xc5f8('0x14')]);}})[_0xc5f8('0x17')](function(_0x5f2e2f){logger['error'](_0xc5f8('0xd'),_0x4e7f9d,_0x5f2e2f);_0x24d06b(_0x5f2e2f);});});} \ No newline at end of file +var _0x807a=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','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','lodash'];(function(_0x24b8ec,_0x3c8c5b){var _0x1d1b63=function(_0x316c98){while(--_0x316c98){_0x24b8ec['push'](_0x24b8ec['shift']());}};_0x1d1b63(++_0x3c8c5b);}(_0x807a,0x158));var _0xa807=function(_0x13d012,_0x26155d){_0x13d012=_0x13d012-0x0;var _0x43356c=_0x807a[_0x13d012];return _0x43356c;};'use strict';var _=require(_0xa807('0x0'));var util=require(_0xa807('0x1'));var moment=require('moment');var BPromise=require(_0xa807('0x2'));var rs=require(_0xa807('0x3'));var fs=require('fs');var Redis=require(_0xa807('0x4'));var db=require(_0xa807('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa807('0x6'))(_0xa807('0x7'));var config=require(_0xa807('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa807('0x9')][_0xa807('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8a98b7,_0x18924d,_0x591983){return new BPromise(function(_0x2c205d,_0x2fede4){return client[_0xa807('0xb')](_0x8a98b7,_0x591983)[_0xa807('0xc')](function(_0x2d42a2){logger[_0xa807('0xd')](_0xa807('0xe'),_0x18924d,'request\x20sent');logger[_0xa807('0xf')](_0xa807('0x10'),_0x18924d,_0xa807('0x11'),JSON[_0xa807('0x12')](_0x2d42a2));if(_0x2d42a2[_0xa807('0x13')]){if(_0x2d42a2[_0xa807('0x13')][_0xa807('0x14')]===0x1f4){logger[_0xa807('0x13')](_0xa807('0xe'),_0x18924d,_0x2d42a2['error'][_0xa807('0x15')]);return _0x2fede4(_0x2d42a2[_0xa807('0x13')][_0xa807('0x15')]);}logger[_0xa807('0x13')](_0xa807('0xe'),_0x18924d,_0x2d42a2[_0xa807('0x13')][_0xa807('0x15')]);return _0x2c205d(_0x2d42a2[_0xa807('0x13')][_0xa807('0x15')]);}else{logger[_0xa807('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x18924d,'request\x20sent');_0x2c205d(_0x2d42a2['result'][_0xa807('0x15')]);}})[_0xa807('0x16')](function(_0x569749){logger[_0xa807('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x18924d,_0x569749);_0x2fede4(_0x569749);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 64c8c4d..e1ff090 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 _0x8dda=['delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','/describe','describe','show','post','create','put','/:id','isAuthenticated','update'];(function(_0x265da9,_0x4f6817){var _0x152796=function(_0xaa6de6){while(--_0xaa6de6){_0x265da9['push'](_0x265da9['shift']());}};_0x152796(++_0x4f6817);}(_0x8dda,0xde));var _0xa8dd=function(_0x49588a,_0x5c8e94){_0x49588a=_0x49588a-0x0;var _0xea8733=_0x8dda[_0x49588a];return _0xea8733;};'use strict';var multer=require('multer');var util=require(_0xa8dd('0x0'));var path=require('path');var timeout=require(_0xa8dd('0x1'));var express=require(_0xa8dd('0x2'));var router=express[_0xa8dd('0x3')]();var fs_extra=require(_0xa8dd('0x4'));var auth=require(_0xa8dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa8dd('0x6'));var controller=require(_0xa8dd('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa8dd('0x8')](_0xa8dd('0x9'),auth['isAuthenticated'](),controller[_0xa8dd('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xa8dd('0xb')]);router[_0xa8dd('0xc')]('/',auth['isAuthenticated'](),controller[_0xa8dd('0xd')]);router[_0xa8dd('0xe')](_0xa8dd('0xf'),auth[_0xa8dd('0x10')](),controller[_0xa8dd('0x11')]);router[_0xa8dd('0x12')](_0xa8dd('0xf'),auth[_0xa8dd('0x10')](),controller[_0xa8dd('0x13')]);module['exports']=router; \ No newline at end of file +var _0x926b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','post','create','update','/:id','exports','multer','connect-timeout'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x926b,0x1c0));var _0xb926=function(_0x325799,_0x515816){_0x325799=_0x325799-0x0;var _0x55b5c6=_0x926b[_0x325799];return _0x55b5c6;};'use strict';var multer=require(_0xb926('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb926('0x1'));var express=require(_0xb926('0x2'));var router=express[_0xb926('0x3')]();var fs_extra=require(_0xb926('0x4'));var auth=require(_0xb926('0x5'));var interaction=require(_0xb926('0x6'));var config=require('../../config/environment');var controller=require('./userProfileSection.controller');router[_0xb926('0x7')]('/',auth['isAuthenticated'](),controller[_0xb926('0x8')]);router[_0xb926('0x7')](_0xb926('0x9'),auth[_0xb926('0xa')](),controller[_0xb926('0xb')]);router[_0xb926('0x7')]('/:id',auth[_0xb926('0xa')](),controller[_0xb926('0xc')]);router[_0xb926('0xd')]('/',auth[_0xb926('0xa')](),controller[_0xb926('0xe')]);router['put']('/:id',auth[_0xb926('0xa')](),controller[_0xb926('0xf')]);router['delete'](_0xb926('0x10'),auth[_0xb926('0xa')](),controller['destroy']);module[_0xb926('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 92914f6..327701b 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(_0x59b2a1,_0x1f631f){var _0x4908d1=function(_0x14c9b8){while(--_0x14c9b8){_0x59b2a1['push'](_0x59b2a1['shift']());}};_0x4908d1(++_0x1f631f);}(_0x4fc2,0x111));var _0x24fc=function(_0x29f964,_0x68179f){_0x29f964=_0x29f964-0x0;var _0x38dcc1=_0x4fc2[_0x29f964];return _0x38dcc1;};'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 _0x6cb4=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','getDataValue','split','sequelize'];(function(_0x2028d5,_0x3ec794){var _0x13ebfa=function(_0x3f5a7f){while(--_0x3f5a7f){_0x2028d5['push'](_0x2028d5['shift']());}};_0x13ebfa(++_0x3ec794);}(_0x6cb4,0xff));var _0x46cb=function(_0x4fd2b9,_0x42edc6){_0x4fd2b9=_0x4fd2b9-0x0;var _0x479e5f=_0x6cb4[_0x4fd2b9];return _0x479e5f;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'name':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x46cb('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x46cb('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x46cb('0x2')],'set':function(_0x2efd19){this['setDataValue'](_0x46cb('0x5'),_0x2efd19?_0x2efd19['join'](''):[]);},'get':function(){return this[_0x46cb('0x6')]('crudPermissions')?this[_0x46cb('0x6')](_0x46cb('0x5'))[_0x46cb('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 8b38e9c..260e25e 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 _0xb0e2=['error','stack','send','index','UserProfileSection','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','name','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','update','then','destroy'];(function(_0x237cca,_0x3904ff){var _0x3e5921=function(_0x5dafc9){while(--_0x5dafc9){_0x237cca['push'](_0x237cca['shift']());}};_0x3e5921(++_0x3904ff);}(_0xb0e2,0x196));var _0x2b0e=function(_0x333679,_0x2f1f76){_0x333679=_0x333679-0x0;var _0x5529be=_0xb0e2[_0x333679];return _0x5529be;};'use strict';var emlformat=require(_0x2b0e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2b0e('0x1'));var rp=require(_0x2b0e('0x2'));var moment=require(_0x2b0e('0x3'));var BPromise=require(_0x2b0e('0x4'));var Mustache=require(_0x2b0e('0x5'));var util=require('util');var path=require(_0x2b0e('0x6'));var sox=require('sox');var csv=require(_0x2b0e('0x7'));var ejs=require(_0x2b0e('0x8'));var fs=require('fs');var fs_extra=require(_0x2b0e('0x9'));var _=require(_0x2b0e('0xa'));var squel=require(_0x2b0e('0xb'));var crypto=require(_0x2b0e('0xc'));var jsforce=require(_0x2b0e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2b0e('0x7'));var querystring=require(_0x2b0e('0xe'));var Papa=require('papaparse');var Redis=require(_0x2b0e('0xf'));var authService=require(_0x2b0e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2b0e('0x11'));var hardwareService=require(_0x2b0e('0x12'));var logger=require(_0x2b0e('0x13'))(_0x2b0e('0x14'));var utils=require(_0x2b0e('0x15'));var config=require(_0x2b0e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2b0e('0x17'))['db'];function respondWithStatusCode(_0x426a89,_0xe9623b){_0xe9623b=_0xe9623b||0xcc;return function(_0x118234){if(_0x118234){return _0x426a89[_0x2b0e('0x18')](_0xe9623b);}return _0x426a89[_0x2b0e('0x19')](_0xe9623b)[_0x2b0e('0x1a')]();};}function respondWithResult(_0x5a2355,_0xac1069){_0xac1069=_0xac1069||0xc8;return function(_0x3430b7){if(_0x3430b7){return _0x5a2355[_0x2b0e('0x19')](_0xac1069)['json'](_0x3430b7);}};}function respondWithFilteredResult(_0x24d73d,_0x40be94){return function(_0x3b4ca2){if(_0x3b4ca2){var _0x5ecde0=typeof _0x40be94[_0x2b0e('0x1b')]===_0x2b0e('0x1c')&&typeof _0x40be94[_0x2b0e('0x1d')]===_0x2b0e('0x1c');var _0x42391b=_0x3b4ca2['count'];var _0x58bd5a=_0x5ecde0?0x0:_0x40be94[_0x2b0e('0x1b')];var _0x409b28=_0x5ecde0?_0x3b4ca2['count']:_0x40be94[_0x2b0e('0x1b')]+_0x40be94[_0x2b0e('0x1d')];var _0x242a8c;if(_0x409b28>=_0x42391b){_0x409b28=_0x42391b;_0x242a8c=0xc8;}else{_0x242a8c=0xce;}_0x24d73d[_0x2b0e('0x19')](_0x242a8c);return _0x24d73d[_0x2b0e('0x1e')](_0x2b0e('0x1f'),_0x58bd5a+'-'+_0x409b28+'/'+_0x42391b)[_0x2b0e('0x20')](_0x3b4ca2);}return null;};}function patchUpdates(_0x3c2388){return function(_0x2c4005){try{jsonpatch[_0x2b0e('0x21')](_0x2c4005,_0x3c2388,!![]);}catch(_0x379dd4){return BPromise[_0x2b0e('0x22')](_0x379dd4);}return _0x2c4005['save']();};}function saveUpdates(_0x544119,_0x4d5991){return function(_0x251b60){if(_0x251b60){return _0x251b60[_0x2b0e('0x23')](_0x544119)[_0x2b0e('0x24')](function(_0x3d6fb5){return _0x3d6fb5;});}return null;};}function removeEntity(_0x195cc8,_0x1eae53){return function(_0x382ac6){if(_0x382ac6){return _0x382ac6[_0x2b0e('0x25')]()['then'](function(){_0x195cc8[_0x2b0e('0x19')](0xcc)[_0x2b0e('0x1a')]();});}};}function handleEntityNotFound(_0x53d6c3,_0xa77fec){return function(_0x66778e){if(!_0x66778e){_0x53d6c3[_0x2b0e('0x18')](0x194);}return _0x66778e;};}function handleError(_0x2b4d95,_0x44b7bf){_0x44b7bf=_0x44b7bf||0x1f4;return function(_0x582bbe){logger[_0x2b0e('0x26')](_0x582bbe[_0x2b0e('0x27')]);if(_0x582bbe['name']){delete _0x582bbe['name'];}_0x2b4d95['status'](_0x44b7bf)[_0x2b0e('0x28')](_0x582bbe);};}exports[_0x2b0e('0x29')]=function(_0x426ca4,_0x4a86a0){var _0x3df90d={},_0x596cda={},_0x53f48b={'count':0x0,'rows':[]};var _0x482d80=_['map'](db[_0x2b0e('0x2a')][_0x2b0e('0x2b')],function(_0x1b1b47){return{'name':_0x1b1b47['fieldName'],'type':_0x1b1b47[_0x2b0e('0x2c')][_0x2b0e('0x2d')]};});_0x596cda['model']=_['map'](_0x482d80,'name');_0x596cda['query']=_[_0x2b0e('0x2e')](_0x426ca4[_0x2b0e('0x2f')]);_0x596cda['filters']=_[_0x2b0e('0x30')](_0x596cda[_0x2b0e('0x31')],_0x596cda['query']);_0x3df90d[_0x2b0e('0x32')]=_['intersection'](_0x596cda[_0x2b0e('0x31')],qs[_0x2b0e('0x33')](_0x426ca4[_0x2b0e('0x2f')][_0x2b0e('0x33')]));_0x3df90d[_0x2b0e('0x32')]=_0x3df90d['attributes'][_0x2b0e('0x34')]?_0x3df90d[_0x2b0e('0x32')]:_0x596cda['model'];if(!_0x426ca4[_0x2b0e('0x2f')]['hasOwnProperty']('nolimit')){_0x3df90d['limit']=qs[_0x2b0e('0x1d')](_0x426ca4[_0x2b0e('0x2f')][_0x2b0e('0x1d')]);_0x3df90d[_0x2b0e('0x1b')]=qs[_0x2b0e('0x1b')](_0x426ca4[_0x2b0e('0x2f')]['offset']);}_0x3df90d[_0x2b0e('0x35')]=qs['sort'](_0x426ca4['query'][_0x2b0e('0x36')]);_0x3df90d[_0x2b0e('0x37')]=qs[_0x2b0e('0x38')](_[_0x2b0e('0x39')](_0x426ca4[_0x2b0e('0x2f')],_0x596cda['filters']),_0x482d80);if(_0x426ca4[_0x2b0e('0x2f')][_0x2b0e('0x3a')]){_0x3df90d[_0x2b0e('0x37')]=_[_0x2b0e('0x3b')](_0x3df90d[_0x2b0e('0x37')],{'$or':_['map'](_0x482d80,function(_0x84d248){if(_0x84d248['type']!=='VIRTUAL'){var _0x524e0f={};_0x524e0f[_0x84d248[_0x2b0e('0x3c')]]={'$like':'%'+_0x426ca4[_0x2b0e('0x2f')][_0x2b0e('0x3a')]+'%'};return _0x524e0f;}})});}_0x3df90d=_['merge']({},_0x3df90d,_0x426ca4[_0x2b0e('0x3d')]);var _0x4a2a41={'where':_0x3df90d[_0x2b0e('0x37')]};return db[_0x2b0e('0x2a')][_0x2b0e('0x3e')](_0x4a2a41)[_0x2b0e('0x24')](function(_0x338ba9){_0x53f48b['count']=_0x338ba9;if(_0x426ca4[_0x2b0e('0x2f')][_0x2b0e('0x3f')]){_0x3df90d[_0x2b0e('0x40')]=[{'all':!![]}];}return db[_0x2b0e('0x2a')][_0x2b0e('0x41')](_0x3df90d);})[_0x2b0e('0x24')](function(_0x36c5db){_0x53f48b[_0x2b0e('0x42')]=_0x36c5db;return _0x53f48b;})[_0x2b0e('0x24')](respondWithFilteredResult(_0x4a86a0,_0x3df90d))[_0x2b0e('0x43')](handleError(_0x4a86a0,null));};exports[_0x2b0e('0x44')]=function(_0x56f279,_0x2ef328){var _0x6501f8={'raw':![],'where':{'id':_0x56f279[_0x2b0e('0x45')]['id']}},_0x45b691={};_0x45b691[_0x2b0e('0x31')]=_['keys'](db[_0x2b0e('0x2a')]['rawAttributes']);_0x45b691[_0x2b0e('0x2f')]=_['keys'](_0x56f279['query']);_0x45b691[_0x2b0e('0x38')]=_[_0x2b0e('0x30')](_0x45b691[_0x2b0e('0x31')],_0x45b691[_0x2b0e('0x2f')]);_0x6501f8[_0x2b0e('0x32')]=_[_0x2b0e('0x30')](_0x45b691['model'],qs[_0x2b0e('0x33')](_0x56f279[_0x2b0e('0x2f')][_0x2b0e('0x33')]));_0x6501f8['attributes']=_0x6501f8[_0x2b0e('0x32')][_0x2b0e('0x34')]?_0x6501f8[_0x2b0e('0x32')]:_0x45b691['model'];if(_0x56f279['query'][_0x2b0e('0x3f')]){_0x6501f8[_0x2b0e('0x40')]=[{'all':!![]}];}_0x6501f8=_[_0x2b0e('0x3b')]({},_0x6501f8,_0x56f279[_0x2b0e('0x3d')]);return db[_0x2b0e('0x2a')][_0x2b0e('0x46')](_0x6501f8)[_0x2b0e('0x24')](handleEntityNotFound(_0x2ef328,null))[_0x2b0e('0x24')](respondWithResult(_0x2ef328,null))['catch'](handleError(_0x2ef328,null));};exports[_0x2b0e('0x47')]=function(_0x43a84a,_0x288261){return db[_0x2b0e('0x2a')][_0x2b0e('0x47')](_0x43a84a[_0x2b0e('0x48')],{})[_0x2b0e('0x24')](respondWithResult(_0x288261,0xc9))[_0x2b0e('0x43')](handleError(_0x288261,null));};exports[_0x2b0e('0x23')]=function(_0x52a2ab,_0x14d3c6){if(_0x52a2ab[_0x2b0e('0x48')]['id']){delete _0x52a2ab[_0x2b0e('0x48')]['id'];}return db[_0x2b0e('0x2a')]['find']({'where':{'id':_0x52a2ab['params']['id']}})[_0x2b0e('0x24')](handleEntityNotFound(_0x14d3c6,null))[_0x2b0e('0x24')](saveUpdates(_0x52a2ab[_0x2b0e('0x48')],null))[_0x2b0e('0x24')](respondWithResult(_0x14d3c6,null))[_0x2b0e('0x43')](handleError(_0x14d3c6,null));};exports[_0x2b0e('0x25')]=function(_0x15f730,_0x3135f4){return db['UserProfileSection'][_0x2b0e('0x46')]({'where':{'id':_0x15f730[_0x2b0e('0x45')]['id']}})[_0x2b0e('0x24')](handleEntityNotFound(_0x3135f4,null))[_0x2b0e('0x24')](removeEntity(_0x3135f4,null))[_0x2b0e('0x43')](handleError(_0x3135f4,null));};exports[_0x2b0e('0x49')]=function(_0x3d8379,_0x3828fd){return db[_0x2b0e('0x2a')][_0x2b0e('0x49')]()[_0x2b0e('0x24')](respondWithResult(_0x3828fd,null))[_0x2b0e('0x43')](handleError(_0x3828fd,null));}; \ No newline at end of file +var _0xcc31=['../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','create','body','catch','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcc31,0x15e));var _0x1cc3=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xcc31[_0x934425];return _0x31d596;};'use strict';var emlformat=require(_0x1cc3('0x0'));var rimraf=require(_0x1cc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cc3('0x2'));var rp=require(_0x1cc3('0x3'));var moment=require(_0x1cc3('0x4'));var BPromise=require(_0x1cc3('0x5'));var Mustache=require(_0x1cc3('0x6'));var util=require(_0x1cc3('0x7'));var path=require(_0x1cc3('0x8'));var sox=require(_0x1cc3('0x9'));var csv=require(_0x1cc3('0xa'));var ejs=require(_0x1cc3('0xb'));var fs=require('fs');var fs_extra=require(_0x1cc3('0xc'));var _=require('lodash');var squel=require(_0x1cc3('0xd'));var crypto=require(_0x1cc3('0xe'));var jsforce=require(_0x1cc3('0xf'));var deskjs=require(_0x1cc3('0x10'));var toCsv=require(_0x1cc3('0xa'));var querystring=require(_0x1cc3('0x11'));var Papa=require(_0x1cc3('0x12'));var Redis=require('ioredis');var authService=require(_0x1cc3('0x13'));var qs=require(_0x1cc3('0x14'));var as=require(_0x1cc3('0x15'));var hardwareService=require(_0x1cc3('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x1cc3('0x17'));var config=require(_0x1cc3('0x18'));var licenseUtil=require(_0x1cc3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x396c1c,_0x816331){_0x816331=_0x816331||0xcc;return function(_0x436288){if(_0x436288){return _0x396c1c[_0x1cc3('0x1a')](_0x816331);}return _0x396c1c['status'](_0x816331)[_0x1cc3('0x1b')]();};}function respondWithResult(_0xd78b54,_0x34ea5f){_0x34ea5f=_0x34ea5f||0xc8;return function(_0x40a938){if(_0x40a938){return _0xd78b54[_0x1cc3('0x1c')](_0x34ea5f)[_0x1cc3('0x1d')](_0x40a938);}};}function respondWithFilteredResult(_0x38b6ae,_0x39cf65){return function(_0x3fe935){if(_0x3fe935){var _0x3334e5=typeof _0x39cf65[_0x1cc3('0x1e')]===_0x1cc3('0x1f')&&typeof _0x39cf65[_0x1cc3('0x20')]===_0x1cc3('0x1f');var _0xe09395=_0x3fe935['count'];var _0x46a162=_0x3334e5?0x0:_0x39cf65[_0x1cc3('0x1e')];var _0xce1e2f=_0x3334e5?_0x3fe935[_0x1cc3('0x21')]:_0x39cf65[_0x1cc3('0x1e')]+_0x39cf65[_0x1cc3('0x20')];var _0x11c12f;if(_0xce1e2f>=_0xe09395){_0xce1e2f=_0xe09395;_0x11c12f=0xc8;}else{_0x11c12f=0xce;}_0x38b6ae[_0x1cc3('0x1c')](_0x11c12f);return _0x38b6ae[_0x1cc3('0x22')]('Content-Range',_0x46a162+'-'+_0xce1e2f+'/'+_0xe09395)[_0x1cc3('0x1d')](_0x3fe935);}return null;};}function patchUpdates(_0x26a4d4){return function(_0x3fd094){try{jsonpatch[_0x1cc3('0x23')](_0x3fd094,_0x26a4d4,!![]);}catch(_0x5517b7){return BPromise[_0x1cc3('0x24')](_0x5517b7);}return _0x3fd094[_0x1cc3('0x25')]();};}function saveUpdates(_0x3e0243,_0x32098f){return function(_0x28dc98){if(_0x28dc98){return _0x28dc98[_0x1cc3('0x26')](_0x3e0243)[_0x1cc3('0x27')](function(_0x130aab){return _0x130aab;});}return null;};}function removeEntity(_0x2db34b,_0x2c8bb2){return function(_0x5927ed){if(_0x5927ed){return _0x5927ed['destroy']()['then'](function(){_0x2db34b[_0x1cc3('0x1c')](0xcc)[_0x1cc3('0x1b')]();});}};}function handleEntityNotFound(_0x5e6e90,_0x3b4d27){return function(_0x177be1){if(!_0x177be1){_0x5e6e90[_0x1cc3('0x1a')](0x194);}return _0x177be1;};}function handleError(_0x4c2755,_0x28402a){_0x28402a=_0x28402a||0x1f4;return function(_0x23bf1f){logger[_0x1cc3('0x28')](_0x23bf1f[_0x1cc3('0x29')]);if(_0x23bf1f['name']){delete _0x23bf1f[_0x1cc3('0x2a')];}_0x4c2755[_0x1cc3('0x1c')](_0x28402a)['send'](_0x23bf1f);};}exports[_0x1cc3('0x2b')]=function(_0x121cb7,_0x35569d){var _0x4dd640={},_0x1aa75a={},_0x536b76={'count':0x0,'rows':[]};var _0x129d68=_[_0x1cc3('0x2c')](db[_0x1cc3('0x2d')][_0x1cc3('0x2e')],function(_0x3cca27){return{'name':_0x3cca27[_0x1cc3('0x2f')],'type':_0x3cca27[_0x1cc3('0x30')][_0x1cc3('0x31')]};});_0x1aa75a[_0x1cc3('0x32')]=_[_0x1cc3('0x2c')](_0x129d68,_0x1cc3('0x2a'));_0x1aa75a['query']=_['keys'](_0x121cb7['query']);_0x1aa75a['filters']=_[_0x1cc3('0x33')](_0x1aa75a[_0x1cc3('0x32')],_0x1aa75a['query']);_0x4dd640[_0x1cc3('0x34')]=_[_0x1cc3('0x33')](_0x1aa75a[_0x1cc3('0x32')],qs[_0x1cc3('0x35')](_0x121cb7[_0x1cc3('0x36')]['fields']));_0x4dd640['attributes']=_0x4dd640['attributes'][_0x1cc3('0x37')]?_0x4dd640['attributes']:_0x1aa75a[_0x1cc3('0x32')];if(!_0x121cb7[_0x1cc3('0x36')][_0x1cc3('0x38')](_0x1cc3('0x39'))){_0x4dd640[_0x1cc3('0x20')]=qs['limit'](_0x121cb7[_0x1cc3('0x36')]['limit']);_0x4dd640[_0x1cc3('0x1e')]=qs[_0x1cc3('0x1e')](_0x121cb7[_0x1cc3('0x36')][_0x1cc3('0x1e')]);}_0x4dd640['order']=qs[_0x1cc3('0x3a')](_0x121cb7['query'][_0x1cc3('0x3a')]);_0x4dd640[_0x1cc3('0x3b')]=qs['filters'](_['pick'](_0x121cb7[_0x1cc3('0x36')],_0x1aa75a[_0x1cc3('0x3c')]),_0x129d68);if(_0x121cb7['query']['filter']){_0x4dd640[_0x1cc3('0x3b')]=_[_0x1cc3('0x3d')](_0x4dd640['where'],{'$or':_[_0x1cc3('0x2c')](_0x129d68,function(_0x2d9142){if(_0x2d9142[_0x1cc3('0x30')]!==_0x1cc3('0x3e')){var _0x1f754c={};_0x1f754c[_0x2d9142[_0x1cc3('0x2a')]]={'$like':'%'+_0x121cb7[_0x1cc3('0x36')]['filter']+'%'};return _0x1f754c;}})});}_0x4dd640=_['merge']({},_0x4dd640,_0x121cb7[_0x1cc3('0x3f')]);var _0x1d0268={'where':_0x4dd640[_0x1cc3('0x3b')]};return db[_0x1cc3('0x2d')][_0x1cc3('0x21')](_0x1d0268)[_0x1cc3('0x27')](function(_0x154237){_0x536b76[_0x1cc3('0x21')]=_0x154237;if(_0x121cb7['query'][_0x1cc3('0x40')]){_0x4dd640[_0x1cc3('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0x1cc3('0x42')](_0x4dd640);})['then'](function(_0x1d4db9){_0x536b76[_0x1cc3('0x43')]=_0x1d4db9;return _0x536b76;})['then'](respondWithFilteredResult(_0x35569d,_0x4dd640))['catch'](handleError(_0x35569d,null));};exports['show']=function(_0x141321,_0x1e4a22){var _0x3f7876={'raw':![],'where':{'id':_0x141321[_0x1cc3('0x44')]['id']}},_0x140ab7={};_0x140ab7[_0x1cc3('0x32')]=_['keys'](db[_0x1cc3('0x2d')][_0x1cc3('0x2e')]);_0x140ab7[_0x1cc3('0x36')]=_['keys'](_0x141321[_0x1cc3('0x36')]);_0x140ab7[_0x1cc3('0x3c')]=_[_0x1cc3('0x33')](_0x140ab7[_0x1cc3('0x32')],_0x140ab7[_0x1cc3('0x36')]);_0x3f7876[_0x1cc3('0x34')]=_[_0x1cc3('0x33')](_0x140ab7[_0x1cc3('0x32')],qs[_0x1cc3('0x35')](_0x141321[_0x1cc3('0x36')]['fields']));_0x3f7876[_0x1cc3('0x34')]=_0x3f7876['attributes']['length']?_0x3f7876['attributes']:_0x140ab7[_0x1cc3('0x32')];if(_0x141321['query'][_0x1cc3('0x40')]){_0x3f7876[_0x1cc3('0x41')]=[{'all':!![]}];}_0x3f7876=_[_0x1cc3('0x3d')]({},_0x3f7876,_0x141321['options']);return db[_0x1cc3('0x2d')][_0x1cc3('0x45')](_0x3f7876)[_0x1cc3('0x27')](handleEntityNotFound(_0x1e4a22,null))[_0x1cc3('0x27')](respondWithResult(_0x1e4a22,null))['catch'](handleError(_0x1e4a22,null));};exports[_0x1cc3('0x46')]=function(_0x7a671,_0x4e005e){return db[_0x1cc3('0x2d')][_0x1cc3('0x46')](_0x7a671[_0x1cc3('0x47')],{})[_0x1cc3('0x27')](respondWithResult(_0x4e005e,0xc9))['catch'](handleError(_0x4e005e,null));};exports[_0x1cc3('0x26')]=function(_0x2b2047,_0x1c60be){if(_0x2b2047[_0x1cc3('0x47')]['id']){delete _0x2b2047[_0x1cc3('0x47')]['id'];}return db[_0x1cc3('0x2d')][_0x1cc3('0x45')]({'where':{'id':_0x2b2047[_0x1cc3('0x44')]['id']}})[_0x1cc3('0x27')](handleEntityNotFound(_0x1c60be,null))[_0x1cc3('0x27')](saveUpdates(_0x2b2047[_0x1cc3('0x47')],null))['then'](respondWithResult(_0x1c60be,null))[_0x1cc3('0x48')](handleError(_0x1c60be,null));};exports[_0x1cc3('0x49')]=function(_0x483ee3,_0x47a25b){return db[_0x1cc3('0x2d')][_0x1cc3('0x45')]({'where':{'id':_0x483ee3[_0x1cc3('0x44')]['id']}})[_0x1cc3('0x27')](handleEntityNotFound(_0x47a25b,null))[_0x1cc3('0x27')](removeEntity(_0x47a25b,null))[_0x1cc3('0x48')](handleError(_0x47a25b,null));};exports['describe']=function(_0x45ebed,_0x196174){return db[_0x1cc3('0x2d')][_0x1cc3('0x4a')]()[_0x1cc3('0x27')](respondWithResult(_0x196174,null))[_0x1cc3('0x48')](handleError(_0x196174,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index a6b7434..02bda7a 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 _0xa208=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','compositeIndex','sectionId','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x28d391,_0x1357b3){var _0x3c8bf0=function(_0x55bac9){while(--_0x55bac9){_0x28d391['push'](_0x28d391['shift']());}};_0x3c8bf0(++_0x1357b3);}(_0xa208,0x18f));var _0x8a20=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xa208[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x8a20('0x0'));var util=require(_0x8a20('0x1'));var logger=require(_0x8a20('0x2'))('api');var moment=require(_0x8a20('0x3'));var BPromise=require(_0x8a20('0x4'));var rp=require(_0x8a20('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a20('0x6'));var config=require(_0x8a20('0x7'));var attributes=require(_0x8a20('0x8'));module[_0x8a20('0x9')]=function(_0x8d68b7,_0x44cf67){return _0x8d68b7[_0x8a20('0xa')](_0x8a20('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x8a20('0xc'),'fields':[_0x8a20('0xd'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1b2a=['request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','user_profile_has_sections','compositeIndex','sectionId','util','api','moment','bluebird'];(function(_0x1e06f1,_0x59d7e1){var _0x34f77e=function(_0x4f9f26){while(--_0x4f9f26){_0x1e06f1['push'](_0x1e06f1['shift']());}};_0x34f77e(++_0x59d7e1);}(_0x1b2a,0x18f));var _0xa1b2=function(_0x444b87,_0xe8b82a){_0x444b87=_0x444b87-0x0;var _0x2d3000=_0x1b2a[_0x444b87];return _0x2d3000;};'use strict';var _=require('lodash');var util=require(_0xa1b2('0x0'));var logger=require('../../config/logger')(_0xa1b2('0x1'));var moment=require(_0xa1b2('0x2'));var BPromise=require(_0xa1b2('0x3'));var rp=require(_0xa1b2('0x4'));var fs=require('fs');var path=require(_0xa1b2('0x5'));var rimraf=require(_0xa1b2('0x6'));var config=require(_0xa1b2('0x7'));var attributes=require(_0xa1b2('0x8'));module['exports']=function(_0x33d909,_0x2abb7c){return _0x33d909[_0xa1b2('0x9')]('UserProfileSection',attributes,{'tableName':_0xa1b2('0xa'),'paranoid':![],'indexes':[{'name':_0xa1b2('0xb'),'fields':[_0xa1b2('0xc'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b0da273..c1abcdc 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 _0x58d0=['request\x20sent','stringify','error','code','message','result','lodash','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','then','UserProfileSection,\x20%s,\x20%s','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x58d0,0x1a4));var _0x058d=function(_0x560b33,_0x54a69c){_0x560b33=_0x560b33-0x0;var _0x15c35e=_0x58d0[_0x560b33];return _0x15c35e;};'use strict';var _=require(_0x058d('0x0'));var util=require(_0x058d('0x1'));var moment=require(_0x058d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x058d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x058d('0x4'))(_0x058d('0x5'));var config=require('../../config/environment');var jayson=require(_0x058d('0x6'));var client=jayson[_0x058d('0x7')][_0x058d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x43a984,_0x18bc41,_0xcf0d6d){return new BPromise(function(_0x3dd787,_0x1f84fa){return client['request'](_0x43a984,_0xcf0d6d)[_0x058d('0x9')](function(_0x51656c){logger['info'](_0x058d('0xa'),_0x18bc41,'request\x20sent');logger['debug'](_0x058d('0xb'),_0x18bc41,_0x058d('0xc'),JSON[_0x058d('0xd')](_0x51656c));if(_0x51656c['error']){if(_0x51656c[_0x058d('0xe')][_0x058d('0xf')]===0x1f4){logger[_0x058d('0xe')](_0x058d('0xa'),_0x18bc41,_0x51656c[_0x058d('0xe')][_0x058d('0x10')]);return _0x1f84fa(_0x51656c[_0x058d('0xe')][_0x058d('0x10')]);}logger[_0x058d('0xe')](_0x058d('0xa'),_0x18bc41,_0x51656c[_0x058d('0xe')][_0x058d('0x10')]);return _0x3dd787(_0x51656c[_0x058d('0xe')][_0x058d('0x10')]);}else{logger['info'](_0x058d('0xa'),_0x18bc41,_0x058d('0xc'));_0x3dd787(_0x51656c[_0x058d('0x11')]['message']);}})['catch'](function(_0x3bceb1){logger[_0x058d('0xe')](_0x058d('0xa'),_0x18bc41,_0x3bceb1);_0x1f84fa(_0x3bceb1);});});} \ No newline at end of file +var _0x38c7=['code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x42e2ff,_0x5f4fb5){var _0x29967a=function(_0x46f131){while(--_0x46f131){_0x42e2ff['push'](_0x42e2ff['shift']());}};_0x29967a(++_0x5f4fb5);}(_0x38c7,0x68));var _0x738c=function(_0x2f486e,_0x5aa831){_0x2f486e=_0x2f486e-0x0;var _0x2c077d=_0x38c7[_0x2f486e];return _0x2c077d;};'use strict';var _=require(_0x738c('0x0'));var util=require('util');var moment=require(_0x738c('0x1'));var BPromise=require(_0x738c('0x2'));var rs=require(_0x738c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x738c('0x4'))['db'];var utils=require(_0x738c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x738c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18dcf7,_0x2fe80f,_0x21d32a){return new BPromise(function(_0x1e441b,_0x834c54){return client[_0x738c('0x7')](_0x18dcf7,_0x21d32a)[_0x738c('0x8')](function(_0x33825a){logger[_0x738c('0x9')](_0x738c('0xa'),_0x2fe80f,_0x738c('0xb'));logger[_0x738c('0xc')](_0x738c('0xd'),_0x2fe80f,_0x738c('0xb'),JSON[_0x738c('0xe')](_0x33825a));if(_0x33825a[_0x738c('0xf')]){if(_0x33825a[_0x738c('0xf')][_0x738c('0x10')]===0x1f4){logger[_0x738c('0xf')](_0x738c('0xa'),_0x2fe80f,_0x33825a['error']['message']);return _0x834c54(_0x33825a['error'][_0x738c('0x11')]);}logger[_0x738c('0xf')](_0x738c('0xa'),_0x2fe80f,_0x33825a[_0x738c('0xf')]['message']);return _0x1e441b(_0x33825a[_0x738c('0xf')][_0x738c('0x11')]);}else{logger[_0x738c('0x9')](_0x738c('0xa'),_0x2fe80f,_0x738c('0xb'));_0x1e441b(_0x33825a[_0x738c('0x12')]['message']);}})[_0x738c('0x13')](function(_0x1a2ace){logger[_0x738c('0xf')](_0x738c('0xa'),_0x2fe80f,_0x1a2ace);_0x834c54(_0x1a2ace);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index d5c7360..03ce6c6 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x12f231,_0x43613d){var _0x4bb11d=function(_0x3e5481){while(--_0x3e5481){_0x12f231['push'](_0x12f231['shift']());}};_0x4bb11d(++_0x43613d);}(_0xe706,0xa3));var _0x6e70=function(_0x2fab67,_0x510e24){_0x2fab67=_0x2fab67-0x0;var _0x3b0237=_0xe706[_0x2fab67];return _0x3b0237;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x38706d,_0x1b548d){var _0x3ec590=function(_0x573430){while(--_0x573430){_0x38706d['push'](_0x38706d['shift']());}};_0x3ec590(++_0x1b548d);}(_0xe706,0xa3));var _0x6e70=function(_0x3d7fa1,_0x340c0e){_0x3d7fa1=_0x3d7fa1-0x0;var _0x4f5e46=_0xe706[_0x3d7fa1];return _0x4f5e46;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b3fe6f7..e9601aa 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 _0x8a90=['sequelize','exports','INTEGER'];(function(_0x3042d5,_0x349534){var _0x1acfef=function(_0x5a920f){while(--_0x5a920f){_0x3042d5['push'](_0x3042d5['shift']());}};_0x1acfef(++_0x349534);}(_0x8a90,0x138));var _0x08a9=function(_0x5239f6,_0x3bc30a){_0x5239f6=_0x5239f6-0x0;var _0xb66a8b=_0x8a90[_0x5239f6];return _0xb66a8b;};'use strict';var Sequelize=require(_0x08a9('0x0'));module[_0x08a9('0x1')]={'penalty':{'type':Sequelize[_0x08a9('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7385=['INTEGER','exports'];(function(_0x4923fd,_0x155fe0){var _0xf78de1=function(_0x28f9aa){while(--_0x28f9aa){_0x4923fd['push'](_0x4923fd['shift']());}};_0xf78de1(++_0x155fe0);}(_0x7385,0x195));var _0x5738=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7385[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require('sequelize');module[_0x5738('0x0')]={'penalty':{'type':Sequelize[_0x5738('0x1')],'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 a5e8e38..098564f 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 _0x6657=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','user_has_sms_queues','lodash'];(function(_0x5bf578,_0x52abff){var _0x2ac394=function(_0x27c2b6){while(--_0x27c2b6){_0x5bf578['push'](_0x5bf578['shift']());}};_0x2ac394(++_0x52abff);}(_0x6657,0x17f));var _0x7665=function(_0x2c5fe4,_0x2ae8e5){_0x2c5fe4=_0x2c5fe4-0x0;var _0x20a6cf=_0x6657[_0x2c5fe4];return _0x20a6cf;};'use strict';var _=require(_0x7665('0x0'));var util=require('util');var logger=require(_0x7665('0x1'))(_0x7665('0x2'));var moment=require(_0x7665('0x3'));var BPromise=require(_0x7665('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7665('0x5'));var rimraf=require(_0x7665('0x6'));var config=require(_0x7665('0x7'));var attributes=require(_0x7665('0x8'));module[_0x7665('0x9')]=function(_0x28b410,_0x1a6f2f){return _0x28b410[_0x7665('0xa')]('UserSmsQueue',attributes,{'tableName':_0x7665('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadb5=['bluebird','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','util','api','moment'];(function(_0x1903e1,_0x44456f){var _0x40e6e5=function(_0x2df2b5){while(--_0x2df2b5){_0x1903e1['push'](_0x1903e1['shift']());}};_0x40e6e5(++_0x44456f);}(_0xadb5,0xad));var _0x5adb=function(_0x350888,_0xf25597){_0x350888=_0x350888-0x0;var _0x231da9=_0xadb5[_0x350888];return _0x231da9;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./userSmsQueue.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'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 d785cfd..97adb3c 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 _0x6119=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x29560f,_0x1621cc){var _0x49606e=function(_0x44649b){while(--_0x44649b){_0x29560f['push'](_0x29560f['shift']());}};_0x49606e(++_0x1621cc);}(_0x6119,0xe5));var _0x9611=function(_0x52091d,_0x3ca0ef){_0x52091d=_0x52091d-0x0;var _0x15712d=_0x6119[_0x52091d];return _0x15712d;};'use strict';var _=require(_0x9611('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9611('0x1'));var fs=require('fs');var Redis=require(_0x9611('0x2'));var db=require(_0x9611('0x3'))['db'];var utils=require(_0x9611('0x4'));var logger=require(_0x9611('0x5'))(_0x9611('0x6'));var config=require(_0x9611('0x7'));var jayson=require(_0x9611('0x8'));var client=jayson[_0x9611('0x9')][_0x9611('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x289a47,_0x18cebd,_0x50a578){return new BPromise(function(_0x4d9613,_0x4a1a7b){return client[_0x9611('0xb')](_0x289a47,_0x50a578)[_0x9611('0xc')](function(_0x4471d0){logger[_0x9611('0xd')](_0x9611('0xe'),_0x18cebd,_0x9611('0xf'));logger['debug'](_0x9611('0x10'),_0x18cebd,'request\x20sent',JSON[_0x9611('0x11')](_0x4471d0));if(_0x4471d0[_0x9611('0x12')]){if(_0x4471d0[_0x9611('0x12')][_0x9611('0x13')]===0x1f4){logger[_0x9611('0x12')](_0x9611('0xe'),_0x18cebd,_0x4471d0[_0x9611('0x12')][_0x9611('0x14')]);return _0x4a1a7b(_0x4471d0['error'][_0x9611('0x14')]);}logger[_0x9611('0x12')](_0x9611('0xe'),_0x18cebd,_0x4471d0[_0x9611('0x12')][_0x9611('0x14')]);return _0x4d9613(_0x4471d0[_0x9611('0x12')][_0x9611('0x14')]);}else{logger['info'](_0x9611('0xe'),_0x18cebd,_0x9611('0xf'));_0x4d9613(_0x4471d0[_0x9611('0x15')][_0x9611('0x14')]);}})[_0x9611('0x16')](function(_0x72c2c4){logger[_0x9611('0x12')](_0x9611('0xe'),_0x18cebd,_0x72c2c4);_0x4a1a7b(_0x72c2c4);});});} \ No newline at end of file +var _0xd5bf=['../../config/environment','jayson/promise','client','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x32a561,_0x98a4d8){var _0x4e9fd6=function(_0x30c6da){while(--_0x30c6da){_0x32a561['push'](_0x32a561['shift']());}};_0x4e9fd6(++_0x98a4d8);}(_0xd5bf,0x150));var _0xfd5b=function(_0xc731d5,_0x12de1b){_0xc731d5=_0xc731d5-0x0;var _0x15a7a5=_0xd5bf[_0xc731d5];return _0x15a7a5;};'use strict';var _=require(_0xfd5b('0x0'));var util=require(_0xfd5b('0x1'));var moment=require(_0xfd5b('0x2'));var BPromise=require(_0xfd5b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfd5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfd5b('0x5'))('rpc');var config=require(_0xfd5b('0x6'));var jayson=require(_0xfd5b('0x7'));var client=jayson[_0xfd5b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4df96b,_0x50b56a,_0x33da22){return new BPromise(function(_0x2ebecc,_0x357ddf){return client['request'](_0x4df96b,_0x33da22)[_0xfd5b('0x9')](function(_0x12a93a){logger[_0xfd5b('0xa')](_0xfd5b('0xb'),_0x50b56a,_0xfd5b('0xc'));logger['debug']('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x50b56a,'request\x20sent',JSON[_0xfd5b('0xd')](_0x12a93a));if(_0x12a93a[_0xfd5b('0xe')]){if(_0x12a93a['error'][_0xfd5b('0xf')]===0x1f4){logger[_0xfd5b('0xe')](_0xfd5b('0xb'),_0x50b56a,_0x12a93a[_0xfd5b('0xe')]['message']);return _0x357ddf(_0x12a93a['error'][_0xfd5b('0x10')]);}logger[_0xfd5b('0xe')](_0xfd5b('0xb'),_0x50b56a,_0x12a93a['error'][_0xfd5b('0x10')]);return _0x2ebecc(_0x12a93a[_0xfd5b('0xe')]['message']);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x50b56a,_0xfd5b('0xc'));_0x2ebecc(_0x12a93a[_0xfd5b('0x11')][_0xfd5b('0x10')]);}})[_0xfd5b('0x12')](function(_0x4ce6c1){logger[_0xfd5b('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x50b56a,_0x4ce6c1);_0x357ddf(_0x4ce6c1);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 8273540..dd70633 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x2cd630,_0x123a6f){var _0x433adb=function(_0x225ed4){while(--_0x225ed4){_0x2cd630['push'](_0x2cd630['shift']());}};_0x433adb(++_0x123a6f);}(_0xedd9,0xfc));var _0x9edd=function(_0x188b79,_0x2c6ff3){_0x188b79=_0x188b79-0x0;var _0x323a9e=_0xedd9[_0x188b79];return _0x323a9e;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x38c652,_0x1ea1b7){var _0x218a37=function(_0x5dcb2a){while(--_0x5dcb2a){_0x38c652['push'](_0x38c652['shift']());}};_0x218a37(++_0x1ea1b7);}(_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 4e7990a..19bd9f1 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 _0x059d=['sequelize','exports','INTEGER'];(function(_0x34aa28,_0x303fcf){var _0xe2b554=function(_0x1bd68c){while(--_0x1bd68c){_0x34aa28['push'](_0x34aa28['shift']());}};_0xe2b554(++_0x303fcf);}(_0x059d,0x1b9));var _0xd059=function(_0xe1bf34,_0x11c268){_0xe1bf34=_0xe1bf34-0x0;var _0x1d45e6=_0x059d[_0xe1bf34];return _0x1d45e6;};'use strict';var Sequelize=require(_0xd059('0x0'));module[_0xd059('0x1')]={'penalty':{'type':Sequelize[_0xd059('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6a5a=['sequelize','exports'];(function(_0x3ad9aa,_0x95bcc8){var _0x3bb2ee=function(_0x1a4038){while(--_0x1a4038){_0x3ad9aa['push'](_0x3ad9aa['shift']());}};_0x3bb2ee(++_0x95bcc8);}(_0x6a5a,0xaa));var _0xa6a5=function(_0x295ec3,_0x2d0c88){_0x295ec3=_0x295ec3-0x0;var _0x28c940=_0x6a5a[_0x295ec3];return _0x28c940;};'use strict';var Sequelize=require(_0xa6a5('0x0'));module[_0xa6a5('0x1')]={'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 2ad7050..2870f0a 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 _0x5b61=['moment','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger'];(function(_0x3e6457,_0x4f5715){var _0x16aa5a=function(_0x188768){while(--_0x188768){_0x3e6457['push'](_0x3e6457['shift']());}};_0x16aa5a(++_0x4f5715);}(_0x5b61,0x1dc));var _0x15b6=function(_0x3bab09,_0x217c29){_0x3bab09=_0x3bab09-0x0;var _0x164376=_0x5b61[_0x3bab09];return _0x164376;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x15b6('0x0'))('api');var moment=require(_0x15b6('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15b6('0x2'));var config=require(_0x15b6('0x3'));var attributes=require(_0x15b6('0x4'));module[_0x15b6('0x5')]=function(_0x3ee62c,_0x36d126){return _0x3ee62c[_0x15b6('0x6')](_0x15b6('0x7'),attributes,{'tableName':_0x15b6('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b51=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','util','../../config/logger'];(function(_0x3ab5bd,_0x56fbcf){var _0xe4109d=function(_0x36418b){while(--_0x36418b){_0x3ab5bd['push'](_0x3ab5bd['shift']());}};_0xe4109d(++_0x56fbcf);}(_0x9b51,0x1ce));var _0x19b5=function(_0x3272a2,_0x44b4dc){_0x3272a2=_0x3272a2-0x0;var _0x2b390c=_0x9b51[_0x3272a2];return _0x2b390c;};'use strict';var _=require(_0x19b5('0x0'));var util=require(_0x19b5('0x1'));var logger=require(_0x19b5('0x2'))(_0x19b5('0x3'));var moment=require(_0x19b5('0x4'));var BPromise=require(_0x19b5('0x5'));var rp=require(_0x19b5('0x6'));var fs=require('fs');var path=require(_0x19b5('0x7'));var rimraf=require(_0x19b5('0x8'));var config=require(_0x19b5('0x9'));var attributes=require(_0x19b5('0xa'));module[_0x19b5('0xb')]=function(_0x25f54f,_0x3f020b){return _0x25f54f[_0x19b5('0xc')](_0x19b5('0xd'),attributes,{'tableName':_0x19b5('0xe'),'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 5ca6ee6..89705c4 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 _0xb1c8=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x1e633e,_0x6f47e1){var _0x4c6d74=function(_0x3a6a2d){while(--_0x3a6a2d){_0x1e633e['push'](_0x1e633e['shift']());}};_0x4c6d74(++_0x6f47e1);}(_0xb1c8,0x89));var _0x8b1c=function(_0x265aa2,_0x220072){_0x265aa2=_0x265aa2-0x0;var _0x447a3a=_0xb1c8[_0x265aa2];return _0x447a3a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8b1c('0x0'));var rs=require(_0x8b1c('0x1'));var fs=require('fs');var Redis=require(_0x8b1c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x8b1c('0x3'));var logger=require(_0x8b1c('0x4'))('rpc');var config=require(_0x8b1c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x8b1c('0x6')][_0x8b1c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x60faa,_0x85d2c0,_0x3be8c4){return new BPromise(function(_0x1de8a2,_0x16e22a){return client[_0x8b1c('0x8')](_0x60faa,_0x3be8c4)[_0x8b1c('0x9')](function(_0x18eb1e){logger[_0x8b1c('0xa')](_0x8b1c('0xb'),_0x85d2c0,_0x8b1c('0xc'));logger[_0x8b1c('0xd')](_0x8b1c('0xe'),_0x85d2c0,_0x8b1c('0xc'),JSON[_0x8b1c('0xf')](_0x18eb1e));if(_0x18eb1e[_0x8b1c('0x10')]){if(_0x18eb1e[_0x8b1c('0x10')][_0x8b1c('0x11')]===0x1f4){logger['error'](_0x8b1c('0xb'),_0x85d2c0,_0x18eb1e[_0x8b1c('0x10')][_0x8b1c('0x12')]);return _0x16e22a(_0x18eb1e['error'][_0x8b1c('0x12')]);}logger[_0x8b1c('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x85d2c0,_0x18eb1e[_0x8b1c('0x10')][_0x8b1c('0x12')]);return _0x1de8a2(_0x18eb1e[_0x8b1c('0x10')][_0x8b1c('0x12')]);}else{logger[_0x8b1c('0xa')](_0x8b1c('0xb'),_0x85d2c0,_0x8b1c('0xc'));_0x1de8a2(_0x18eb1e[_0x8b1c('0x13')][_0x8b1c('0x12')]);}})[_0x8b1c('0x14')](function(_0x3e7527){logger[_0x8b1c('0x10')](_0x8b1c('0xb'),_0x85d2c0,_0x3e7527);_0x16e22a(_0x3e7527);});});} \ No newline at end of file +var _0x85d5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x85d5,0xf1));var _0x585d=function(_0xd28fc0,_0x570b78){_0xd28fc0=_0xd28fc0-0x0;var _0x651ab6=_0x85d5[_0xd28fc0];return _0x651ab6;};'use strict';var _=require(_0x585d('0x0'));var util=require(_0x585d('0x1'));var moment=require(_0x585d('0x2'));var BPromise=require(_0x585d('0x3'));var rs=require(_0x585d('0x4'));var fs=require('fs');var Redis=require(_0x585d('0x5'));var db=require(_0x585d('0x6'))['db'];var utils=require(_0x585d('0x7'));var logger=require(_0x585d('0x8'))('rpc');var config=require(_0x585d('0x9'));var jayson=require(_0x585d('0xa'));var client=jayson['client'][_0x585d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c3718,_0x1383be,_0x49f76b){return new BPromise(function(_0x2ce6f2,_0x5126de){return client[_0x585d('0xc')](_0x4c3718,_0x49f76b)[_0x585d('0xd')](function(_0x396f23){logger['info'](_0x585d('0xe'),_0x1383be,_0x585d('0xf'));logger['debug'](_0x585d('0x10'),_0x1383be,_0x585d('0xf'),JSON[_0x585d('0x11')](_0x396f23));if(_0x396f23['error']){if(_0x396f23[_0x585d('0x12')]['code']===0x1f4){logger[_0x585d('0x12')](_0x585d('0xe'),_0x1383be,_0x396f23[_0x585d('0x12')]['message']);return _0x5126de(_0x396f23[_0x585d('0x12')][_0x585d('0x13')]);}logger[_0x585d('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x1383be,_0x396f23['error']['message']);return _0x2ce6f2(_0x396f23[_0x585d('0x12')][_0x585d('0x13')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x1383be,_0x585d('0xf'));_0x2ce6f2(_0x396f23[_0x585d('0x14')]['message']);}})[_0x585d('0x15')](function(_0x58c232){logger[_0x585d('0x12')](_0x585d('0xe'),_0x1383be,_0x58c232);_0x5126de(_0x58c232);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 4270f46..799b100 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x667ff8,_0x59e7df){var _0x2ddfc7=function(_0x5a4a46){while(--_0x5a4a46){_0x667ff8['push'](_0x667ff8['shift']());}};_0x2ddfc7(++_0x59e7df);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5d27e2,_0x5a6581){var _0x2b0951=function(_0x463b83){while(--_0x463b83){_0x5d27e2['push'](_0x5d27e2['shift']());}};_0x2b0951(++_0x5a6581);}(_0x70e0,0x17b));var _0x070e=function(_0x3d2e5b,_0x2ac0b3){_0x3d2e5b=_0x3d2e5b-0x0;var _0x5f56c0=_0x70e0[_0x3d2e5b];return _0x5f56c0;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index d379c6e..6290f37 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 _0xa014=['queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xa014,0x16f));var _0x4a01=function(_0x3cf501,_0x49b1a4){_0x3cf501=_0x3cf501-0x0;var _0x38ae81=_0xa014[_0x3cf501];return _0x38ae81;};'use strict';var Sequelize=require(_0x4a01('0x0'));module[_0x4a01('0x1')]={'uniqueid':{'type':Sequelize[_0x4a01('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x4a01('0x3')},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x4a01('0x3')},'UserId':{'type':Sequelize[_0x4a01('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x4a01('0x4')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x4a01('0x4')],'allowNull':![],'unique':_0x4a01('0x5'),'comment':_0x4a01('0x3')},'penalty':{'type':Sequelize[_0x4a01('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x4a01('0x3')}}; \ No newline at end of file +var _0xf078=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','INTEGER'];(function(_0x271894,_0x2c0b96){var _0x39dd2a=function(_0x26653c){while(--_0x26653c){_0x271894['push'](_0x271894['shift']());}};_0x39dd2a(++_0x2c0b96);}(_0xf078,0xda));var _0x8f07=function(_0x5095ba,_0x1396c1){_0x5095ba=_0x5095ba-0x0;var _0x5dc1ce=_0xf078[_0x5095ba];return _0x5dc1ce;};'use strict';var Sequelize=require(_0x8f07('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8f07('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8f07('0x2')},'membername':{'type':Sequelize[_0x8f07('0x3')],'allowNull':![],'comment':_0x8f07('0x2')},'UserId':{'type':Sequelize[_0x8f07('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8f07('0x3')],'allowNull':![],'unique':_0x8f07('0x4'),'comment':_0x8f07('0x2')},'VoiceQueueId':{'type':Sequelize[_0x8f07('0x1')],'allowNull':![]},'interface':{'type':Sequelize[_0x8f07('0x3')],'allowNull':![],'unique':_0x8f07('0x4'),'comment':_0x8f07('0x2')},'penalty':{'type':Sequelize[_0x8f07('0x1')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x8f07('0x1')](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 23beb08..3e94c7b 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 _0x6ea9=['exports','../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty'];(function(_0x38f83b,_0xa62801){var _0x1a72be=function(_0x49a173){while(--_0x49a173){_0x38f83b['push'](_0x38f83b['shift']());}};_0x1a72be(++_0xa62801);}(_0x6ea9,0x8d));var _0x96ea=function(_0x5ed770,_0x32213b){_0x5ed770=_0x5ed770-0x0;var _0xd68181=_0x6ea9[_0x5ed770];return _0xd68181;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x96ea('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x96ea('0x1')](0x0);var events={'afterCreate':_0x96ea('0x2'),'afterUpdate':_0x96ea('0x3'),'afterDestroy':_0x96ea('0x4')};function emitEvent(_0x3321cd){return function(_0x23ff5e,_0x1bee92,_0x3ff623){UserVoiceQueueRtEvents['emit'](_0x3321cd+':'+_0x23ff5e['id'],_0x23ff5e);UserVoiceQueueRtEvents['emit'](_0x3321cd,_0x23ff5e);_0x3ff623(null);};}for(var e in events){if(events[_0x96ea('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x96ea('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x263e=['../../mysqldb','UserVoiceQueueRt','update','emit','exports','events'];(function(_0x5b8be1,_0x442e94){var _0x3a6397=function(_0x22d202){while(--_0x22d202){_0x5b8be1['push'](_0x5b8be1['shift']());}};_0x3a6397(++_0x442e94);}(_0x263e,0x1c1));var _0xe263=function(_0x53ad58,_0x3fb489){_0x53ad58=_0x53ad58-0x0;var _0x554b03=_0x263e[_0x53ad58];return _0x554b03;};'use strict';var EventEmitter=require(_0xe263('0x0'));var UserVoiceQueueRt=require(_0xe263('0x1'))['db'][_0xe263('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe263('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1ef9a1){return function(_0x2dc02b,_0x122b5d,_0x29a3ad){UserVoiceQueueRtEvents[_0xe263('0x4')](_0x1ef9a1+':'+_0x2dc02b['id'],_0x2dc02b);UserVoiceQueueRtEvents[_0xe263('0x4')](_0x1ef9a1,_0x2dc02b);_0x29a3ad(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xe263('0x5')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 7dfe721..32c15ad 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 _0x0294=['moment','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','util','api'];(function(_0x1eb3f6,_0x3f8dc7){var _0x511f68=function(_0x33d351){while(--_0x33d351){_0x1eb3f6['push'](_0x1eb3f6['shift']());}};_0x511f68(++_0x3f8dc7);}(_0x0294,0x112));var _0x4029=function(_0x5769ca,_0x3e892a){_0x5769ca=_0x5769ca-0x0;var _0x483b01=_0x0294[_0x5769ca];return _0x483b01;};'use strict';var _=require('lodash');var util=require(_0x4029('0x0'));var logger=require('../../config/logger')(_0x4029('0x1'));var moment=require(_0x4029('0x2'));var BPromise=require('bluebird');var rp=require(_0x4029('0x3'));var fs=require('fs');var path=require(_0x4029('0x4'));var rimraf=require(_0x4029('0x5'));var config=require(_0x4029('0x6'));var attributes=require(_0x4029('0x7'));module[_0x4029('0x8')]=function(_0x15af4f,_0x3f1dd1){return _0x15af4f[_0x4029('0x9')](_0x4029('0xa'),attributes,{'tableName':_0x4029('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd96a=['./userVoiceQueueRt.attributes','define','user_has_voice_queues_rt','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xd96a,0x99));var _0xad96=function(_0x306e7b,_0xa412fe){_0x306e7b=_0x306e7b-0x0;var _0x15bd57=_0xd96a[_0x306e7b];return _0x15bd57;};'use strict';var _=require(_0xad96('0x0'));var util=require(_0xad96('0x1'));var logger=require(_0xad96('0x2'))(_0xad96('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad96('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad96('0x5'));var config=require(_0xad96('0x6'));var attributes=require(_0xad96('0x7'));module['exports']=function(_0x27e1c4,_0x3bfad9){return _0x27e1c4[_0xad96('0x8')]('UserVoiceQueueRt',attributes,{'tableName':_0xad96('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1256a9d..c1a425a 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 _0x5dbc=['result','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','literal','outboundQueuePauses','then','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./userVoiceQueueRt.socket','register','request','info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5dbc,0x16a));var _0xc5db=function(_0x331725,_0x190f44){_0x331725=_0x331725-0x0;var _0x140cd6=_0x5dbc[_0x331725];return _0x140cd6;};'use strict';var _=require(_0xc5db('0x0'));var util=require('util');var moment=require(_0xc5db('0x1'));var BPromise=require(_0xc5db('0x2'));var rs=require(_0xc5db('0x3'));var fs=require('fs');var Redis=require(_0xc5db('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc5db('0x5'))(_0xc5db('0x6'));var config=require(_0xc5db('0x7'));var jayson=require(_0xc5db('0x8'));var client=jayson[_0xc5db('0x9')][_0xc5db('0xa')]({'port':0x232a});config['redis']=_[_0xc5db('0xb')](config[_0xc5db('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5db('0xc')]));require(_0xc5db('0xd'))[_0xc5db('0xe')](socket);function respondWithRpcPromise(_0x24bfe0,_0x419029,_0x3e49c3){return new BPromise(function(_0x3fbc0c,_0x2300a9){return client[_0xc5db('0xf')](_0x24bfe0,_0x3e49c3)['then'](function(_0x46b00b){logger[_0xc5db('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x419029,_0xc5db('0x11'));logger[_0xc5db('0x12')](_0xc5db('0x13'),_0x419029,'request\x20sent',JSON[_0xc5db('0x14')](_0x46b00b));if(_0x46b00b['error']){if(_0x46b00b[_0xc5db('0x15')]['code']===0x1f4){logger['error'](_0xc5db('0x16'),_0x419029,_0x46b00b[_0xc5db('0x15')]['message']);return _0x2300a9(_0x46b00b[_0xc5db('0x15')]['message']);}logger[_0xc5db('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x419029,_0x46b00b[_0xc5db('0x15')]['message']);return _0x3fbc0c(_0x46b00b[_0xc5db('0x15')]['message']);}else{logger['info'](_0xc5db('0x16'),_0x419029,_0xc5db('0x11'));_0x3fbc0c(_0x46b00b[_0xc5db('0x17')][_0xc5db('0x18')]);}})[_0xc5db('0x19')](function(_0x521f58){logger[_0xc5db('0x15')](_0xc5db('0x16'),_0x419029,_0x521f58);_0x2300a9(_0x521f58);});});}exports[_0xc5db('0x1a')]=function(_0x5f11d9){var _0x2c68b2=this;return new Promise(function(_0x46e87a,_0x3e1355){return db[_0xc5db('0x1b')][_0xc5db('0x1c')]({'raw':_0x5f11d9[_0xc5db('0x1d')]?_0x5f11d9[_0xc5db('0x1d')][_0xc5db('0x1e')]===undefined?!![]:![]:!![],'where':_0x5f11d9[_0xc5db('0x1d')]?_0x5f11d9[_0xc5db('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc5db('0x1f')][_0xc5db('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0xc5db('0x21')]]})[_0xc5db('0x22')](function(_0x26b508){logger[_0xc5db('0x10')](_0xc5db('0x1a'),_0x5f11d9);logger[_0xc5db('0x12')]('GetVoiceQueueRtPauses',_0x5f11d9,JSON[_0xc5db('0x14')](_0x26b508));_0x46e87a(_0x26b508);})['catch'](function(_0x31bd3d){logger[_0xc5db('0x15')](_0xc5db('0x1a'),_0x31bd3d[_0xc5db('0x18')],_0x5f11d9);_0x3e1355(_0x2c68b2[_0xc5db('0x15')](0x1f4,_0x31bd3d[_0xc5db('0x18')]));});});}; \ No newline at end of file +var _0x02c4=['register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','where','sequelize','literal','outboundQueuePauses','then','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x279b21,_0x3f63a7){var _0x286ab9=function(_0x4258cc){while(--_0x4258cc){_0x279b21['push'](_0x279b21['shift']());}};_0x286ab9(++_0x3f63a7);}(_0x02c4,0xd3));var _0x402c=function(_0x3d1548,_0x4f1fcd){_0x3d1548=_0x3d1548-0x0;var _0x3f7ea9=_0x02c4[_0x3d1548];return _0x3f7ea9;};'use strict';var _=require(_0x402c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x402c('0x1'));var fs=require('fs');var Redis=require(_0x402c('0x2'));var db=require(_0x402c('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x402c('0x4'));var config=require(_0x402c('0x5'));var jayson=require(_0x402c('0x6'));var client=jayson[_0x402c('0x7')][_0x402c('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0x402c('0x9')],{'host':_0x402c('0xa'),'port':0x18eb});var socket=require(_0x402c('0xb'))(new Redis(config[_0x402c('0x9')]));require(_0x402c('0xc'))[_0x402c('0xd')](socket);function respondWithRpcPromise(_0x7b6a9f,_0x4df180,_0x228cf0){return new BPromise(function(_0x177184,_0x4d4944){return client['request'](_0x7b6a9f,_0x228cf0)['then'](function(_0x2161ea){logger[_0x402c('0xe')](_0x402c('0xf'),_0x4df180,_0x402c('0x10'));logger[_0x402c('0x11')](_0x402c('0x12'),_0x4df180,'request\x20sent',JSON[_0x402c('0x13')](_0x2161ea));if(_0x2161ea[_0x402c('0x14')]){if(_0x2161ea[_0x402c('0x14')][_0x402c('0x15')]===0x1f4){logger['error'](_0x402c('0xf'),_0x4df180,_0x2161ea['error'][_0x402c('0x16')]);return _0x4d4944(_0x2161ea[_0x402c('0x14')][_0x402c('0x16')]);}logger['error'](_0x402c('0xf'),_0x4df180,_0x2161ea[_0x402c('0x14')]['message']);return _0x177184(_0x2161ea[_0x402c('0x14')][_0x402c('0x16')]);}else{logger['info'](_0x402c('0xf'),_0x4df180,'request\x20sent');_0x177184(_0x2161ea[_0x402c('0x17')]['message']);}})['catch'](function(_0x23a657){logger[_0x402c('0x14')](_0x402c('0xf'),_0x4df180,_0x23a657);_0x4d4944(_0x23a657);});});}exports[_0x402c('0x18')]=function(_0x257326){var _0x441b06=this;return new Promise(function(_0x307015,_0x29d555){return db[_0x402c('0x19')]['findAll']({'raw':_0x257326['options']?_0x257326['options']['raw']===undefined?!![]:![]:!![],'where':_0x257326['options']?_0x257326['options'][_0x402c('0x1a')]||null:null,'attributes':[[db[_0x402c('0x1b')]['fn']('COUNT',db[_0x402c('0x1b')]['fn']('IF',db[_0x402c('0x1b')][_0x402c('0x1c')]('`paused`\x20=\x201,\x201,\x20null'))),_0x402c('0x1d')]]})[_0x402c('0x1e')](function(_0x2d4314){logger['info'](_0x402c('0x18'),_0x257326);logger[_0x402c('0x11')]('GetVoiceQueueRtPauses',_0x257326,JSON[_0x402c('0x13')](_0x2d4314));_0x307015(_0x2d4314);})[_0x402c('0x1f')](function(_0x2ee162){logger['error'](_0x402c('0x18'),_0x2ee162[_0x402c('0x16')],_0x257326);_0x29d555(_0x441b06[_0x402c('0x14')](0x1f4,_0x2ee162[_0x402c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 265505e..5cd1284 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 _0x8585=['remove','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x25e97a,_0x2dd6cb){var _0x40ef58=function(_0x55e8d9){while(--_0x55e8d9){_0x25e97a['push'](_0x25e97a['shift']());}};_0x40ef58(++_0x2dd6cb);}(_0x8585,0x64));var _0x5858=function(_0x4161c2,_0x1daec7){_0x4161c2=_0x4161c2-0x0;var _0x5bf9df=_0x8585[_0x4161c2];return _0x5bf9df;};'use strict';var UserVoiceQueueRtEvents=require(_0x5858('0x0'));var events=[_0x5858('0x1'),_0x5858('0x2'),'update'];function createListener(_0x2864b0,_0x294e8e){return function(_0x5739bc){_0x294e8e['emit'](_0x2864b0,_0x5739bc);};}function removeListener(_0x5c548b,_0x307ed3){return function(){UserVoiceQueueRtEvents[_0x5858('0x3')](_0x5c548b,_0x307ed3);};}exports['register']=function(_0x5807a2){for(var _0x35b37a=0x0,_0x1d26d1=events[_0x5858('0x4')];_0x35b37a<_0x1d26d1;_0x35b37a++){var _0x5c8e94=events[_0x35b37a];var _0x4d5efe=createListener(_0x5858('0x5')+_0x5c8e94,_0x5807a2);UserVoiceQueueRtEvents['on'](_0x5c8e94,_0x4d5efe);}}; \ No newline at end of file +var _0x72a2=['update','emit','length','save','remove'];(function(_0x78ca7e,_0x350bd6){var _0x4a03b9=function(_0x14ffeb){while(--_0x14ffeb){_0x78ca7e['push'](_0x78ca7e['shift']());}};_0x4a03b9(++_0x350bd6);}(_0x72a2,0x161));var _0x272a=function(_0x513e89,_0x18cc61){_0x513e89=_0x513e89-0x0;var _0x32b0d1=_0x72a2[_0x513e89];return _0x32b0d1;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x272a('0x0'),_0x272a('0x1'),_0x272a('0x2')];function createListener(_0x3fcb66,_0xdd3cbb){return function(_0x4c36b2){_0xdd3cbb[_0x272a('0x3')](_0x3fcb66,_0x4c36b2);};}function removeListener(_0x52287e,_0x1d154d){return function(){UserVoiceQueueRtEvents['removeListener'](_0x52287e,_0x1d154d);};}exports['register']=function(_0x4f628a){for(var _0x2ba5db=0x0,_0x43d188=events[_0x272a('0x4')];_0x2ba5db<_0x43d188;_0x2ba5db++){var _0x283070=events[_0x2ba5db];var _0x54dbfb=createListener('userVoiceQueueRt:'+_0x283070,_0x4f628a);UserVoiceQueueRtEvents['on'](_0x283070,_0x54dbfb);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1b96ff9..74c83e3 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5938b3,_0x4d977b){var _0x5a077d=function(_0x4a0e4c){while(--_0x4a0e4c){_0x5938b3['push'](_0x5938b3['shift']());}};_0x5a077d(++_0x4d977b);}(_0x70e0,0x17b));var _0x070e=function(_0x24b355,_0x35cdde){_0x24b355=_0x24b355-0x0;var _0x3825d5=_0x70e0[_0x24b355];return _0x3825d5;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x90866f,_0x2c0e8b){var _0x5d1b17=function(_0x1ae64b){while(--_0x1ae64b){_0x90866f['push'](_0x90866f['shift']());}};_0x5d1b17(++_0x2c0e8b);}(_0xe706,0xa3));var _0x6e70=function(_0x15ee41,_0x9275d8){_0x15ee41=_0x15ee41-0x0;var _0x2b2846=_0xe706[_0x15ee41];return _0x2b2846;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index c5e4a03..4b66878 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 _0x862f=['exports','INTEGER'];(function(_0x2f71f6,_0x3a1f4d){var _0x2b23ea=function(_0x285980){while(--_0x285980){_0x2f71f6['push'](_0x2f71f6['shift']());}};_0x2b23ea(++_0x3a1f4d);}(_0x862f,0xba));var _0xf862=function(_0x3ef031,_0x3d8cbf){_0x3ef031=_0x3ef031-0x0;var _0x49e70d=_0x862f[_0x3ef031];return _0x49e70d;};'use strict';var Sequelize=require('sequelize');module[_0xf862('0x0')]={'penalty':{'type':Sequelize[_0xf862('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0ae1=['exports','INTEGER','sequelize'];(function(_0x35ec3b,_0x10cb75){var _0x295bdb=function(_0x4e5abe){while(--_0x4e5abe){_0x35ec3b['push'](_0x35ec3b['shift']());}};_0x295bdb(++_0x10cb75);}(_0x0ae1,0x167));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x10ae('0x0'));module[_0x10ae('0x1')]={'penalty':{'type':Sequelize[_0x10ae('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 beb5b1a..d9c3e98 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 _0x4000=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x278ebc,_0x31b63a){var _0x1a9ae7=function(_0x10e8c5){while(--_0x10e8c5){_0x278ebc['push'](_0x278ebc['shift']());}};_0x1a9ae7(++_0x31b63a);}(_0x4000,0x173));var _0x0400=function(_0x10e24b,_0x488d89){_0x10e24b=_0x10e24b-0x0;var _0x1302be=_0x4000[_0x10e24b];return _0x1302be;};'use strict';var _=require(_0x0400('0x0'));var util=require(_0x0400('0x1'));var logger=require(_0x0400('0x2'))(_0x0400('0x3'));var moment=require(_0x0400('0x4'));var BPromise=require(_0x0400('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0400('0x6'));var rimraf=require(_0x0400('0x7'));var config=require(_0x0400('0x8'));var attributes=require(_0x0400('0x9'));module[_0x0400('0xa')]=function(_0x5c8482,_0x450430){return _0x5c8482[_0x0400('0xb')](_0x0400('0xc'),attributes,{'tableName':_0x0400('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01c6=['exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x2d460c,_0x4f08c0){var _0xf6fc4c=function(_0x4fb81c){while(--_0x4fb81c){_0x2d460c['push'](_0x2d460c['shift']());}};_0xf6fc4c(++_0x4f08c0);}(_0x01c6,0x79));var _0x601c=function(_0x44a0e9,_0x959f63){_0x44a0e9=_0x44a0e9-0x0;var _0x3b8e8c=_0x01c6[_0x44a0e9];return _0x3b8e8c;};'use strict';var _=require(_0x601c('0x0'));var util=require(_0x601c('0x1'));var logger=require(_0x601c('0x2'))('api');var moment=require(_0x601c('0x3'));var BPromise=require(_0x601c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x601c('0x5'));var rimraf=require(_0x601c('0x6'));var config=require(_0x601c('0x7'));var attributes=require(_0x601c('0x8'));module[_0x601c('0x9')]=function(_0xa9f9b7,_0x43259d){return _0xa9f9b7[_0x601c('0xa')](_0x601c('0xb'),attributes,{'tableName':_0x601c('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 f6f12a3..738e287 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 _0xe520=['http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2c9e29,_0x1f9351){var _0x272a84=function(_0xbd4e78){while(--_0xbd4e78){_0x2c9e29['push'](_0x2c9e29['shift']());}};_0x272a84(++_0x1f9351);}(_0xe520,0x137));var _0x0e52=function(_0x1beebd,_0x562961){_0x1beebd=_0x1beebd-0x0;var _0x3ac271=_0xe520[_0x1beebd];return _0x3ac271;};'use strict';var _=require(_0x0e52('0x0'));var util=require('util');var moment=require(_0x0e52('0x1'));var BPromise=require(_0x0e52('0x2'));var rs=require(_0x0e52('0x3'));var fs=require('fs');var Redis=require(_0x0e52('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0e52('0x5'));var logger=require(_0x0e52('0x6'))(_0x0e52('0x7'));var config=require(_0x0e52('0x8'));var jayson=require(_0x0e52('0x9'));var client=jayson[_0x0e52('0xa')][_0x0e52('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x43058e,_0x339242,_0x1f2751){return new BPromise(function(_0x573f3d,_0x234279){return client[_0x0e52('0xc')](_0x43058e,_0x1f2751)[_0x0e52('0xd')](function(_0x9ea1f9){logger[_0x0e52('0xe')](_0x0e52('0xf'),_0x339242,'request\x20sent');logger[_0x0e52('0x10')](_0x0e52('0x11'),_0x339242,_0x0e52('0x12'),JSON[_0x0e52('0x13')](_0x9ea1f9));if(_0x9ea1f9[_0x0e52('0x14')]){if(_0x9ea1f9['error']['code']===0x1f4){logger[_0x0e52('0x14')](_0x0e52('0xf'),_0x339242,_0x9ea1f9[_0x0e52('0x14')][_0x0e52('0x15')]);return _0x234279(_0x9ea1f9[_0x0e52('0x14')][_0x0e52('0x15')]);}logger[_0x0e52('0x14')](_0x0e52('0xf'),_0x339242,_0x9ea1f9[_0x0e52('0x14')]['message']);return _0x573f3d(_0x9ea1f9[_0x0e52('0x14')][_0x0e52('0x15')]);}else{logger[_0x0e52('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x339242,_0x0e52('0x12'));_0x573f3d(_0x9ea1f9['result'][_0x0e52('0x15')]);}})[_0x0e52('0x16')](function(_0x10c67b){logger[_0x0e52('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x339242,_0x10c67b);_0x234279(_0x10c67b);});});} \ No newline at end of file +var _0xda64=['UserWhatsappQueue,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xda64,0x15a));var _0x4da6=function(_0x4c89d9,_0x25803d){_0x4c89d9=_0x4c89d9-0x0;var _0x22ddc5=_0xda64[_0x4c89d9];return _0x22ddc5;};'use strict';var _=require('lodash');var util=require(_0x4da6('0x0'));var moment=require(_0x4da6('0x1'));var BPromise=require('bluebird');var rs=require(_0x4da6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4da6('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4da6('0x4'))(_0x4da6('0x5'));var config=require(_0x4da6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x4da6('0x7')][_0x4da6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d6220,_0x572b97,_0x5a8155){return new BPromise(function(_0xaea273,_0x202f30){return client['request'](_0x3d6220,_0x5a8155)['then'](function(_0x48e1ab){logger[_0x4da6('0x9')]('UserWhatsappQueue,\x20%s,\x20%s',_0x572b97,_0x4da6('0xa'));logger['debug'](_0x4da6('0xb'),_0x572b97,_0x4da6('0xa'),JSON[_0x4da6('0xc')](_0x48e1ab));if(_0x48e1ab[_0x4da6('0xd')]){if(_0x48e1ab[_0x4da6('0xd')][_0x4da6('0xe')]===0x1f4){logger[_0x4da6('0xd')](_0x4da6('0xf'),_0x572b97,_0x48e1ab[_0x4da6('0xd')][_0x4da6('0x10')]);return _0x202f30(_0x48e1ab[_0x4da6('0xd')][_0x4da6('0x10')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x572b97,_0x48e1ab['error'][_0x4da6('0x10')]);return _0xaea273(_0x48e1ab[_0x4da6('0xd')][_0x4da6('0x10')]);}else{logger[_0x4da6('0x9')](_0x4da6('0xf'),_0x572b97,_0x4da6('0xa'));_0xaea273(_0x48e1ab[_0x4da6('0x11')]['message']);}})[_0x4da6('0x12')](function(_0x2bfb18){logger[_0x4da6('0xd')](_0x4da6('0xf'),_0x572b97,_0x2bfb18);_0x202f30(_0x2bfb18);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 708e4b4..3ab4b81 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 _0x9b67=['isAuthenticated','index','/:id','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./variable.controller','get'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x9b67,0xf6));var _0x79b6=function(_0x38d325,_0x5daccb){_0x38d325=_0x38d325-0x0;var _0x2fa29c=_0x9b67[_0x38d325];return _0x2fa29c;};'use strict';var multer=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var path=require(_0x79b6('0x2'));var timeout=require(_0x79b6('0x3'));var express=require(_0x79b6('0x4'));var router=express['Router']();var fs_extra=require(_0x79b6('0x5'));var auth=require(_0x79b6('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x79b6('0x7'));router[_0x79b6('0x8')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xa')]);router[_0x79b6('0x8')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['show']);router[_0x79b6('0xc')]('/',auth[_0x79b6('0x9')](),controller[_0x79b6('0xd')]);router[_0x79b6('0xe')](_0x79b6('0xb'),auth['isAuthenticated'](),controller[_0x79b6('0xf')]);router[_0x79b6('0x10')](_0x79b6('0xb'),auth[_0x79b6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8d9b=['put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./variable.controller','get','post','isAuthenticated','create'];(function(_0xc7bca5,_0x1973b9){var _0x53c21d=function(_0xa33a87){while(--_0xa33a87){_0xc7bca5['push'](_0xc7bca5['shift']());}};_0x53c21d(++_0x1973b9);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb8d9('0x0'));var util=require(_0xb8d9('0x1'));var path=require(_0xb8d9('0x2'));var timeout=require(_0xb8d9('0x3'));var express=require(_0xb8d9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb8d9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb8d9('0x6'));var controller=require(_0xb8d9('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb8d9('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xb8d9('0x9')]('/',auth[_0xb8d9('0xa')](),controller[_0xb8d9('0xb')]);router[_0xb8d9('0xc')](_0xb8d9('0xd'),auth[_0xb8d9('0xa')](),controller[_0xb8d9('0xe')]);router['delete'](_0xb8d9('0xd'),auth['isAuthenticated'](),controller[_0xb8d9('0xf')]);module[_0xb8d9('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 695048f..b485e84 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 _0x7877=['name','exports','STRING'];(function(_0x32459b,_0x408672){var _0x2de135=function(_0x4a8569){while(--_0x4a8569){_0x32459b['push'](_0x32459b['shift']());}};_0x2de135(++_0x408672);}(_0x7877,0xb2));var _0x7787=function(_0x3d161d,_0xf646c2){_0x3d161d=_0x3d161d-0x0;var _0x3dc575=_0x7877[_0x3d161d];return _0x3dc575;};'use strict';var Sequelize=require('sequelize');module[_0x7787('0x0')]={'name':{'type':Sequelize[_0x7787('0x1')],'unique':_0x7787('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7787('0x1')]}}; \ No newline at end of file +var _0x89b9=['sequelize'];(function(_0x436964,_0x405bfd){var _0x32c43f=function(_0x4b073a){while(--_0x4b073a){_0x436964['push'](_0x436964['shift']());}};_0x32c43f(++_0x405bfd);}(_0x89b9,0x17a));var _0x989b=function(_0x551ca5,_0x34b1b6){_0x551ca5=_0x551ca5-0x0;var _0x404422=_0x89b9[_0x551ca5];return _0x404422;};'use strict';var Sequelize=require(_0x989b('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 7924bd9..48fed45 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 _0x95c3=['UserProfileResource','error','stack','name','index','map','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','Variable','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','Variables'];(function(_0x27986e,_0x5491c5){var _0x43b4ef=function(_0x41d7c5){while(--_0x41d7c5){_0x27986e['push'](_0x27986e['shift']());}};_0x43b4ef(++_0x5491c5);}(_0x95c3,0x7c));var _0x395c=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x95c3[_0x1db251];return _0x56685a;};'use strict';var emlformat=require(_0x395c('0x0'));var rimraf=require(_0x395c('0x1'));var zipdir=require(_0x395c('0x2'));var jsonpatch=require(_0x395c('0x3'));var rp=require('request-promise');var moment=require(_0x395c('0x4'));var BPromise=require(_0x395c('0x5'));var Mustache=require(_0x395c('0x6'));var util=require(_0x395c('0x7'));var path=require(_0x395c('0x8'));var sox=require(_0x395c('0x9'));var csv=require(_0x395c('0xa'));var ejs=require(_0x395c('0xb'));var fs=require('fs');var fs_extra=require(_0x395c('0xc'));var _=require('lodash');var squel=require(_0x395c('0xd'));var crypto=require('crypto');var jsforce=require(_0x395c('0xe'));var deskjs=require(_0x395c('0xf'));var toCsv=require(_0x395c('0xa'));var querystring=require(_0x395c('0x10'));var Papa=require(_0x395c('0x11'));var Redis=require(_0x395c('0x12'));var authService=require(_0x395c('0x13'));var qs=require(_0x395c('0x14'));var as=require(_0x395c('0x15'));var hardwareService=require(_0x395c('0x16'));var logger=require(_0x395c('0x17'))(_0x395c('0x18'));var utils=require(_0x395c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x395c('0x1a'));var db=require(_0x395c('0x1b'))['db'];function respondWithStatusCode(_0x2e4879,_0x4a4150){_0x4a4150=_0x4a4150||0xcc;return function(_0x4c53c5){if(_0x4c53c5){return _0x2e4879[_0x395c('0x1c')](_0x4a4150);}return _0x2e4879[_0x395c('0x1d')](_0x4a4150)[_0x395c('0x1e')]();};}function respondWithResult(_0x59ad20,_0x1d7869){_0x1d7869=_0x1d7869||0xc8;return function(_0x321af2){if(_0x321af2){return _0x59ad20[_0x395c('0x1d')](_0x1d7869)[_0x395c('0x1f')](_0x321af2);}};}function respondWithFilteredResult(_0x241edd,_0x18c6c7){return function(_0x3910d9){if(_0x3910d9){var _0x8c863a=typeof _0x18c6c7['offset']===_0x395c('0x20')&&typeof _0x18c6c7[_0x395c('0x21')]===_0x395c('0x20');var _0x19d124=_0x3910d9[_0x395c('0x22')];var _0x469fe8=_0x8c863a?0x0:_0x18c6c7['offset'];var _0x352260=_0x8c863a?_0x3910d9[_0x395c('0x22')]:_0x18c6c7[_0x395c('0x23')]+_0x18c6c7['limit'];var _0x273a67;if(_0x352260>=_0x19d124){_0x352260=_0x19d124;_0x273a67=0xc8;}else{_0x273a67=0xce;}_0x241edd[_0x395c('0x1d')](_0x273a67);return _0x241edd[_0x395c('0x24')]('Content-Range',_0x469fe8+'-'+_0x352260+'/'+_0x19d124)[_0x395c('0x1f')](_0x3910d9);}return null;};}function patchUpdates(_0x254d94){return function(_0x4cd247){try{jsonpatch[_0x395c('0x25')](_0x4cd247,_0x254d94,!![]);}catch(_0x2a7c01){return BPromise[_0x395c('0x26')](_0x2a7c01);}return _0x4cd247['save']();};}function saveUpdates(_0x2278c0,_0x22b8d9){return function(_0x1dde80){if(_0x1dde80){return _0x1dde80[_0x395c('0x27')](_0x2278c0)[_0x395c('0x28')](function(_0x48aeef){return _0x48aeef;});}return null;};}function removeEntity(_0xb832fe,_0x32d546){return function(_0x5ec305){if(_0x5ec305){return _0x5ec305[_0x395c('0x29')]()[_0x395c('0x28')](function(){var _0xd7dbf8=_0x5ec305[_0x395c('0x2a')]({'plain':!![]});var _0x4348b5=_0x395c('0x2b');return db[_0x395c('0x2c')][_0x395c('0x29')]({'where':{'type':_0x4348b5,'resourceId':_0xd7dbf8['id']}})[_0x395c('0x28')](function(){return _0x5ec305;});})[_0x395c('0x28')](function(){_0xb832fe[_0x395c('0x1d')](0xcc)[_0x395c('0x1e')]();});}};}function handleEntityNotFound(_0xd37674,_0x37ccb9){return function(_0x526fe0){if(!_0x526fe0){_0xd37674[_0x395c('0x1c')](0x194);}return _0x526fe0;};}function handleError(_0x1913c9,_0x53e6cd){_0x53e6cd=_0x53e6cd||0x1f4;return function(_0x3a13db){logger[_0x395c('0x2d')](_0x3a13db[_0x395c('0x2e')]);if(_0x3a13db[_0x395c('0x2f')]){delete _0x3a13db['name'];}_0x1913c9[_0x395c('0x1d')](_0x53e6cd)['send'](_0x3a13db);};}exports[_0x395c('0x30')]=function(_0x441fe6,_0x47029a){var _0x59e6db={},_0x3685cc={},_0x109a32={'count':0x0,'rows':[]};var _0x202bb2=_[_0x395c('0x31')](db['Variable']['rawAttributes'],function(_0x261098){return{'name':_0x261098['fieldName'],'type':_0x261098[_0x395c('0x32')]['key']};});_0x3685cc[_0x395c('0x33')]=_[_0x395c('0x31')](_0x202bb2,_0x395c('0x2f'));_0x3685cc['query']=_[_0x395c('0x34')](_0x441fe6[_0x395c('0x35')]);_0x3685cc[_0x395c('0x36')]=_[_0x395c('0x37')](_0x3685cc[_0x395c('0x33')],_0x3685cc[_0x395c('0x35')]);_0x59e6db[_0x395c('0x38')]=_[_0x395c('0x37')](_0x3685cc[_0x395c('0x33')],qs[_0x395c('0x39')](_0x441fe6[_0x395c('0x35')]['fields']));_0x59e6db[_0x395c('0x38')]=_0x59e6db[_0x395c('0x38')][_0x395c('0x3a')]?_0x59e6db[_0x395c('0x38')]:_0x3685cc[_0x395c('0x33')];if(!_0x441fe6[_0x395c('0x35')][_0x395c('0x3b')](_0x395c('0x3c'))){_0x59e6db[_0x395c('0x21')]=qs[_0x395c('0x21')](_0x441fe6[_0x395c('0x35')][_0x395c('0x21')]);_0x59e6db[_0x395c('0x23')]=qs['offset'](_0x441fe6[_0x395c('0x35')][_0x395c('0x23')]);}_0x59e6db[_0x395c('0x3d')]=qs[_0x395c('0x3e')](_0x441fe6[_0x395c('0x35')][_0x395c('0x3e')]);_0x59e6db['where']=qs[_0x395c('0x36')](_[_0x395c('0x3f')](_0x441fe6['query'],_0x3685cc[_0x395c('0x36')]),_0x202bb2);if(_0x441fe6['query'][_0x395c('0x40')]){_0x59e6db[_0x395c('0x41')]=_[_0x395c('0x42')](_0x59e6db[_0x395c('0x41')],{'$or':_['map'](_0x202bb2,function(_0x1cef16){if(_0x1cef16['type']!==_0x395c('0x43')){var _0x38449f={};_0x38449f[_0x1cef16['name']]={'$like':'%'+_0x441fe6[_0x395c('0x35')][_0x395c('0x40')]+'%'};return _0x38449f;}})});}_0x59e6db=_[_0x395c('0x42')]({},_0x59e6db,_0x441fe6['options']);var _0x434bcc={'where':_0x59e6db[_0x395c('0x41')]};return db['Variable'][_0x395c('0x22')](_0x434bcc)['then'](function(_0x549c98){_0x109a32[_0x395c('0x22')]=_0x549c98;if(_0x441fe6[_0x395c('0x35')]['includeAll']){_0x59e6db[_0x395c('0x44')]=[{'all':!![]}];}return db['Variable'][_0x395c('0x45')](_0x59e6db);})[_0x395c('0x28')](function(_0x3ca1ec){_0x109a32[_0x395c('0x46')]=_0x3ca1ec;return _0x109a32;})[_0x395c('0x28')](respondWithFilteredResult(_0x47029a,_0x59e6db))[_0x395c('0x47')](handleError(_0x47029a,null));};exports[_0x395c('0x48')]=function(_0x3f753a,_0x5265b7){var _0xd5440d={'raw':!![],'where':{'id':_0x3f753a['params']['id']}},_0x224207={};_0x224207[_0x395c('0x33')]=_[_0x395c('0x34')](db[_0x395c('0x49')][_0x395c('0x4a')]);_0x224207[_0x395c('0x35')]=_['keys'](_0x3f753a[_0x395c('0x35')]);_0x224207['filters']=_[_0x395c('0x37')](_0x224207['model'],_0x224207[_0x395c('0x35')]);_0xd5440d[_0x395c('0x38')]=_[_0x395c('0x37')](_0x224207[_0x395c('0x33')],qs[_0x395c('0x39')](_0x3f753a[_0x395c('0x35')][_0x395c('0x39')]));_0xd5440d[_0x395c('0x38')]=_0xd5440d[_0x395c('0x38')][_0x395c('0x3a')]?_0xd5440d['attributes']:_0x224207[_0x395c('0x33')];if(_0x3f753a[_0x395c('0x35')]['includeAll']){_0xd5440d[_0x395c('0x44')]=[{'all':!![]}];}_0xd5440d=_[_0x395c('0x42')]({},_0xd5440d,_0x3f753a[_0x395c('0x4b')]);return db[_0x395c('0x49')][_0x395c('0x4c')](_0xd5440d)[_0x395c('0x28')](handleEntityNotFound(_0x5265b7,null))[_0x395c('0x28')](respondWithResult(_0x5265b7,null))[_0x395c('0x47')](handleError(_0x5265b7,null));};exports[_0x395c('0x4d')]=function(_0x285ecb,_0x15aed8){return db[_0x395c('0x49')]['create'](_0x285ecb[_0x395c('0x4e')],{})['then'](function(_0x5ddf84){var _0x31c767=_0x285ecb['user']['get']({'plain':!![]});if(!_0x31c767)throw new Error(_0x395c('0x4f'));if(_0x31c767['role']==='user'){var _0x427311=_0x5ddf84[_0x395c('0x2a')]({'plain':!![]});var _0x207210=_0x395c('0x2b');return db[_0x395c('0x50')][_0x395c('0x4c')]({'where':{'name':_0x207210,'userProfileId':_0x31c767[_0x395c('0x51')]},'raw':!![]})['then'](function(_0x5f28a4){if(_0x5f28a4&&_0x5f28a4[_0x395c('0x52')]===0x0){return db[_0x395c('0x2c')][_0x395c('0x4d')]({'name':_0x427311[_0x395c('0x2f')],'resourceId':_0x427311['id'],'type':_0x5f28a4['name'],'sectionId':_0x5f28a4['id']},{})['then'](function(){return _0x5ddf84;});}else{return _0x5ddf84;}})[_0x395c('0x47')](function(_0x2184e9){logger[_0x395c('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2184e9);throw _0x2184e9;});}return _0x5ddf84;})[_0x395c('0x28')](respondWithResult(_0x15aed8,0xc9))[_0x395c('0x47')](handleError(_0x15aed8,null));};exports[_0x395c('0x27')]=function(_0xb38a0e,_0x51f478){if(_0xb38a0e['body']['id']){delete _0xb38a0e[_0x395c('0x4e')]['id'];}return db['Variable'][_0x395c('0x4c')]({'where':{'id':_0xb38a0e[_0x395c('0x53')]['id']}})[_0x395c('0x28')](handleEntityNotFound(_0x51f478,null))[_0x395c('0x28')](saveUpdates(_0xb38a0e[_0x395c('0x4e')],null))['then'](respondWithResult(_0x51f478,null))[_0x395c('0x47')](handleError(_0x51f478,null));};exports[_0x395c('0x29')]=function(_0x191a78,_0x4d31f1){return db[_0x395c('0x49')][_0x395c('0x4c')]({'where':{'id':_0x191a78['params']['id']}})[_0x395c('0x28')](handleEntityNotFound(_0x4d31f1,null))[_0x395c('0x28')](removeEntity(_0x4d31f1,null))[_0x395c('0x47')](handleError(_0x4d31f1,null));}; \ No newline at end of file +var _0x5de6=['role','Variables','UserProfileSection','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','to-csv','ejs','fs-extra','lodash','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','include','findAll','rows','catch','show','fields','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5de6,0x107));var _0x65de=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5de6[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x65de('0x0'));var rimraf=require(_0x65de('0x1'));var zipdir=require(_0x65de('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65de('0x3'));var moment=require(_0x65de('0x4'));var BPromise=require(_0x65de('0x5'));var Mustache=require(_0x65de('0x6'));var util=require(_0x65de('0x7'));var path=require(_0x65de('0x8'));var sox=require(_0x65de('0x9'));var csv=require(_0x65de('0xa'));var ejs=require(_0x65de('0xb'));var fs=require('fs');var fs_extra=require(_0x65de('0xc'));var _=require(_0x65de('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x65de('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x65de('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65de('0xf'));var qs=require(_0x65de('0x10'));var as=require(_0x65de('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x65de('0x12'))(_0x65de('0x13'));var utils=require(_0x65de('0x14'));var config=require(_0x65de('0x15'));var licenseUtil=require(_0x65de('0x16'));var db=require(_0x65de('0x17'))['db'];function respondWithStatusCode(_0x2dc6e3,_0x23939f){_0x23939f=_0x23939f||0xcc;return function(_0x51bab7){if(_0x51bab7){return _0x2dc6e3[_0x65de('0x18')](_0x23939f);}return _0x2dc6e3[_0x65de('0x19')](_0x23939f)[_0x65de('0x1a')]();};}function respondWithResult(_0x4469e3,_0x83d5c0){_0x83d5c0=_0x83d5c0||0xc8;return function(_0x587d18){if(_0x587d18){return _0x4469e3[_0x65de('0x19')](_0x83d5c0)['json'](_0x587d18);}};}function respondWithFilteredResult(_0x4c8beb,_0x28138d){return function(_0x4e4daf){if(_0x4e4daf){var _0x5b4059=typeof _0x28138d[_0x65de('0x1b')]===_0x65de('0x1c')&&typeof _0x28138d[_0x65de('0x1d')]===_0x65de('0x1c');var _0x1e3903=_0x4e4daf[_0x65de('0x1e')];var _0x259fab=_0x5b4059?0x0:_0x28138d[_0x65de('0x1b')];var _0x477af2=_0x5b4059?_0x4e4daf[_0x65de('0x1e')]:_0x28138d[_0x65de('0x1b')]+_0x28138d[_0x65de('0x1d')];var _0x4c3527;if(_0x477af2>=_0x1e3903){_0x477af2=_0x1e3903;_0x4c3527=0xc8;}else{_0x4c3527=0xce;}_0x4c8beb[_0x65de('0x19')](_0x4c3527);return _0x4c8beb[_0x65de('0x1f')](_0x65de('0x20'),_0x259fab+'-'+_0x477af2+'/'+_0x1e3903)[_0x65de('0x21')](_0x4e4daf);}return null;};}function patchUpdates(_0x16e302){return function(_0xc6422b){try{jsonpatch[_0x65de('0x22')](_0xc6422b,_0x16e302,!![]);}catch(_0x1a769a){return BPromise[_0x65de('0x23')](_0x1a769a);}return _0xc6422b[_0x65de('0x24')]();};}function saveUpdates(_0xdac03d,_0x4da5f4){return function(_0x51d8da){if(_0x51d8da){return _0x51d8da[_0x65de('0x25')](_0xdac03d)[_0x65de('0x26')](function(_0x5008dd){return _0x5008dd;});}return null;};}function removeEntity(_0xf6c008,_0x3a393f){return function(_0x1633e6){if(_0x1633e6){return _0x1633e6[_0x65de('0x27')]()[_0x65de('0x26')](function(){var _0x4d8a4b=_0x1633e6[_0x65de('0x28')]({'plain':!![]});var _0x1f2acc='Variables';return db[_0x65de('0x29')]['destroy']({'where':{'type':_0x1f2acc,'resourceId':_0x4d8a4b['id']}})[_0x65de('0x26')](function(){return _0x1633e6;});})[_0x65de('0x26')](function(){_0xf6c008[_0x65de('0x19')](0xcc)[_0x65de('0x1a')]();});}};}function handleEntityNotFound(_0x48188b,_0x276386){return function(_0x392eba){if(!_0x392eba){_0x48188b[_0x65de('0x18')](0x194);}return _0x392eba;};}function handleError(_0x362d79,_0x8067a2){_0x8067a2=_0x8067a2||0x1f4;return function(_0xe5d7b2){logger[_0x65de('0x2a')](_0xe5d7b2[_0x65de('0x2b')]);if(_0xe5d7b2[_0x65de('0x2c')]){delete _0xe5d7b2[_0x65de('0x2c')];}_0x362d79[_0x65de('0x19')](_0x8067a2)[_0x65de('0x2d')](_0xe5d7b2);};}exports[_0x65de('0x2e')]=function(_0x517e70,_0x1e7e30){var _0x89d7fa={},_0x4e0092={},_0x3ca4b5={'count':0x0,'rows':[]};var _0x5aa55e=_['map'](db[_0x65de('0x2f')][_0x65de('0x30')],function(_0x576990){return{'name':_0x576990[_0x65de('0x31')],'type':_0x576990[_0x65de('0x32')][_0x65de('0x33')]};});_0x4e0092[_0x65de('0x34')]=_['map'](_0x5aa55e,_0x65de('0x2c'));_0x4e0092[_0x65de('0x35')]=_[_0x65de('0x36')](_0x517e70[_0x65de('0x35')]);_0x4e0092['filters']=_[_0x65de('0x37')](_0x4e0092['model'],_0x4e0092[_0x65de('0x35')]);_0x89d7fa[_0x65de('0x38')]=_[_0x65de('0x37')](_0x4e0092[_0x65de('0x34')],qs['fields'](_0x517e70[_0x65de('0x35')]['fields']));_0x89d7fa['attributes']=_0x89d7fa['attributes']['length']?_0x89d7fa[_0x65de('0x38')]:_0x4e0092[_0x65de('0x34')];if(!_0x517e70[_0x65de('0x35')][_0x65de('0x39')](_0x65de('0x3a'))){_0x89d7fa[_0x65de('0x1d')]=qs['limit'](_0x517e70[_0x65de('0x35')][_0x65de('0x1d')]);_0x89d7fa['offset']=qs[_0x65de('0x1b')](_0x517e70[_0x65de('0x35')][_0x65de('0x1b')]);}_0x89d7fa[_0x65de('0x3b')]=qs['sort'](_0x517e70[_0x65de('0x35')][_0x65de('0x3c')]);_0x89d7fa[_0x65de('0x3d')]=qs[_0x65de('0x3e')](_[_0x65de('0x3f')](_0x517e70['query'],_0x4e0092['filters']),_0x5aa55e);if(_0x517e70[_0x65de('0x35')]['filter']){_0x89d7fa[_0x65de('0x3d')]=_[_0x65de('0x40')](_0x89d7fa[_0x65de('0x3d')],{'$or':_[_0x65de('0x41')](_0x5aa55e,function(_0x211783){if(_0x211783[_0x65de('0x32')]!==_0x65de('0x42')){var _0x345d11={};_0x345d11[_0x211783[_0x65de('0x2c')]]={'$like':'%'+_0x517e70[_0x65de('0x35')][_0x65de('0x43')]+'%'};return _0x345d11;}})});}_0x89d7fa=_[_0x65de('0x40')]({},_0x89d7fa,_0x517e70[_0x65de('0x44')]);var _0x1ac7b2={'where':_0x89d7fa[_0x65de('0x3d')]};return db[_0x65de('0x2f')][_0x65de('0x1e')](_0x1ac7b2)[_0x65de('0x26')](function(_0x2c0ddc){_0x3ca4b5['count']=_0x2c0ddc;if(_0x517e70[_0x65de('0x35')]['includeAll']){_0x89d7fa[_0x65de('0x45')]=[{'all':!![]}];}return db[_0x65de('0x2f')][_0x65de('0x46')](_0x89d7fa);})[_0x65de('0x26')](function(_0x1a2eb2){_0x3ca4b5[_0x65de('0x47')]=_0x1a2eb2;return _0x3ca4b5;})['then'](respondWithFilteredResult(_0x1e7e30,_0x89d7fa))[_0x65de('0x48')](handleError(_0x1e7e30,null));};exports[_0x65de('0x49')]=function(_0x1e77d6,_0x90e230){var _0x2d4675={'raw':!![],'where':{'id':_0x1e77d6['params']['id']}},_0x332a1e={};_0x332a1e[_0x65de('0x34')]=_[_0x65de('0x36')](db[_0x65de('0x2f')][_0x65de('0x30')]);_0x332a1e[_0x65de('0x35')]=_[_0x65de('0x36')](_0x1e77d6['query']);_0x332a1e[_0x65de('0x3e')]=_[_0x65de('0x37')](_0x332a1e[_0x65de('0x34')],_0x332a1e[_0x65de('0x35')]);_0x2d4675[_0x65de('0x38')]=_[_0x65de('0x37')](_0x332a1e[_0x65de('0x34')],qs[_0x65de('0x4a')](_0x1e77d6[_0x65de('0x35')][_0x65de('0x4a')]));_0x2d4675[_0x65de('0x38')]=_0x2d4675[_0x65de('0x38')]['length']?_0x2d4675[_0x65de('0x38')]:_0x332a1e[_0x65de('0x34')];if(_0x1e77d6[_0x65de('0x35')][_0x65de('0x4b')]){_0x2d4675[_0x65de('0x45')]=[{'all':!![]}];}_0x2d4675=_[_0x65de('0x40')]({},_0x2d4675,_0x1e77d6['options']);return db['Variable'][_0x65de('0x4c')](_0x2d4675)[_0x65de('0x26')](handleEntityNotFound(_0x90e230,null))[_0x65de('0x26')](respondWithResult(_0x90e230,null))[_0x65de('0x48')](handleError(_0x90e230,null));};exports[_0x65de('0x4d')]=function(_0x40f0c7,_0x3a2372){return db[_0x65de('0x2f')][_0x65de('0x4d')](_0x40f0c7[_0x65de('0x4e')],{})[_0x65de('0x26')](function(_0x3f89e8){var _0x4f1050=_0x40f0c7[_0x65de('0x4f')]['get']({'plain':!![]});if(!_0x4f1050)throw new Error(_0x65de('0x50'));if(_0x4f1050[_0x65de('0x51')]===_0x65de('0x4f')){var _0xbf73c6=_0x3f89e8['get']({'plain':!![]});var _0x3d5265=_0x65de('0x52');return db[_0x65de('0x53')][_0x65de('0x4c')]({'where':{'name':_0x3d5265,'userProfileId':_0x4f1050['userProfileId']},'raw':!![]})['then'](function(_0x51fea3){if(_0x51fea3&&_0x51fea3[_0x65de('0x54')]===0x0){return db[_0x65de('0x29')][_0x65de('0x4d')]({'name':_0xbf73c6[_0x65de('0x2c')],'resourceId':_0xbf73c6['id'],'type':_0x51fea3[_0x65de('0x2c')],'sectionId':_0x51fea3['id']},{})[_0x65de('0x26')](function(){return _0x3f89e8;});}else{return _0x3f89e8;}})[_0x65de('0x48')](function(_0x18c806){logger[_0x65de('0x2a')](_0x65de('0x55'),_0x18c806);throw _0x18c806;});}return _0x3f89e8;})[_0x65de('0x26')](respondWithResult(_0x3a2372,0xc9))[_0x65de('0x48')](handleError(_0x3a2372,null));};exports[_0x65de('0x25')]=function(_0x5e0930,_0x1fd97f){if(_0x5e0930[_0x65de('0x4e')]['id']){delete _0x5e0930[_0x65de('0x4e')]['id'];}return db[_0x65de('0x2f')][_0x65de('0x4c')]({'where':{'id':_0x5e0930['params']['id']}})[_0x65de('0x26')](handleEntityNotFound(_0x1fd97f,null))[_0x65de('0x26')](saveUpdates(_0x5e0930[_0x65de('0x4e')],null))['then'](respondWithResult(_0x1fd97f,null))['catch'](handleError(_0x1fd97f,null));};exports[_0x65de('0x27')]=function(_0x21ac0d,_0x4ba792){return db[_0x65de('0x2f')]['find']({'where':{'id':_0x21ac0d['params']['id']}})[_0x65de('0x26')](handleEntityNotFound(_0x4ba792,null))[_0x65de('0x26')](removeEntity(_0x4ba792,null))[_0x65de('0x48')](handleError(_0x4ba792,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index ce9cb24..60d9a88 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 _0xaca0=['exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2339df,_0x4d9c1b){var _0x8a031=function(_0x5ebf1f){while(--_0x5ebf1f){_0x2339df['push'](_0x2339df['shift']());}};_0x8a031(++_0x4d9c1b);}(_0xaca0,0xee));var _0x0aca=function(_0x125b77,_0x43853d){_0x125b77=_0x125b77-0x0;var _0x5319f7=_0xaca0[_0x125b77];return _0x5319f7;};'use strict';var _=require(_0x0aca('0x0'));var util=require(_0x0aca('0x1'));var logger=require(_0x0aca('0x2'))(_0x0aca('0x3'));var moment=require(_0x0aca('0x4'));var BPromise=require(_0x0aca('0x5'));var rp=require(_0x0aca('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0aca('0x7'));var config=require(_0x0aca('0x8'));var attributes=require('./variable.attributes');module[_0x0aca('0x9')]=function(_0x31aabc,_0x23952e){return _0x31aabc[_0x0aca('0xa')](_0x0aca('0xb'),attributes,{'tableName':_0x0aca('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab3f=['tools_variables','lodash','util','../../config/logger','api','moment','bluebird','./variable.attributes','define','Variable'];(function(_0x7f49d2,_0x43f538){var _0x2fcd02=function(_0x2e786b){while(--_0x2e786b){_0x7f49d2['push'](_0x7f49d2['shift']());}};_0x2fcd02(++_0x43f538);}(_0xab3f,0x1af));var _0xfab3=function(_0x25b292,_0x59430e){_0x25b292=_0x25b292-0x0;var _0x2fd7d9=_0xab3f[_0x25b292];return _0x2fd7d9;};'use strict';var _=require(_0xfab3('0x0'));var util=require(_0xfab3('0x1'));var logger=require(_0xfab3('0x2'))(_0xfab3('0x3'));var moment=require(_0xfab3('0x4'));var BPromise=require(_0xfab3('0x5'));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(_0xfab3('0x6'));module['exports']=function(_0x496d35,_0x5a3018){return _0x496d35[_0xfab3('0x7')](_0xfab3('0x8'),attributes,{'tableName':_0xfab3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 0a2969d..9e6eacb 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x134557,_0x19ea33){var _0x1ab4eb=function(_0x39231d){while(--_0x39231d){_0x134557['push'](_0x134557['shift']());}};_0x1ab4eb(++_0x19ea33);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4f8e2b,_0x3d8629){_0x4f8e2b=_0x4f8e2b-0x0;var _0x32128f=_0x1cb9[_0x4f8e2b];return _0x32128f;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0xa41a=['debug','Variable,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowVariable','options','raw','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0xa41a,0x6b));var _0xaa41=function(_0x81f4d5,_0x7a4440){_0x81f4d5=_0x81f4d5-0x0;var _0x30eec2=_0xa41a[_0x81f4d5];return _0x30eec2;};'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);});});}exports[_0xaa41('0x17')]=function(_0xd20ddf){var _0x29efe5=this;return new Promise(function(_0x46e6d3,_0x150ddf){return db['Variable']['find']({'raw':_0xd20ddf[_0xaa41('0x18')]?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x19')]===undefined?!![]:![]:!![],'where':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1a')]||null:null,'attributes':_0xd20ddf['options']?_0xd20ddf['options'][_0xaa41('0x1b')]||null:null,'include':_0xd20ddf['options']?_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0xd20ddf[_0xaa41('0x18')][_0xaa41('0x1c')],function(_0x4eb01f){return{'model':db[_0x4eb01f[_0xaa41('0x1e')]],'as':_0x4eb01f['as'],'attributes':_0x4eb01f[_0xaa41('0x1b')],'include':_0x4eb01f[_0xaa41('0x1c')]?_[_0xaa41('0x1d')](_0x4eb01f[_0xaa41('0x1c')],function(_0xa1f024){return{'model':db[_0xa1f024['model']],'as':_0xa1f024['as'],'attributes':_0xa1f024['attributes'],'include':_0xa1f024[_0xaa41('0x1c')]?_['map'](_0xa1f024['include'],function(_0x12e362){return{'model':db[_0x12e362['model']],'as':_0x12e362['as'],'attributes':_0x12e362['attributes']};}):[]};}):[]};}):[]:[]})[_0xaa41('0xd')](function(_0x9c8c21){logger[_0xaa41('0xe')](_0xaa41('0x17'),_0xd20ddf);logger[_0xaa41('0x11')](_0xaa41('0x17'),_0xd20ddf,JSON['stringify'](_0x9c8c21));_0x46e6d3(_0x9c8c21);})[_0xaa41('0x16')](function(_0x1f0275){logger[_0xaa41('0x13')](_0xaa41('0x17'),_0x1f0275[_0xaa41('0x14')],_0xd20ddf);_0x150ddf(_0x29efe5[_0xaa41('0x13')](0x1f4,_0x1f0275[_0xaa41('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index a6e3346..19b74a6 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 _0x5681=['reset','/pull','pull','restart','migrations','exports','express','Router','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch'];(function(_0x1bea62,_0x1319db){var _0x15c79e=function(_0x10ec58){while(--_0x10ec58){_0x1bea62['push'](_0x1bea62['shift']());}};_0x15c79e(++_0x1319db);}(_0x5681,0x12c));var _0x1568=function(_0x2e6f7e,_0x54af59){_0x2e6f7e=_0x2e6f7e-0x0;var _0x445b77=_0x5681[_0x2e6f7e];return _0x445b77;};'use strict';var express=require(_0x1568('0x0'));var router=express[_0x1568('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x1568('0x2'));router[_0x1568('0x3')]('/',controller['index']);router[_0x1568('0x3')](_0x1568('0x4'),auth[_0x1568('0x5')](),auth[_0x1568('0x6')](),controller[_0x1568('0x7')]);router['get']('/reset',auth['isAuthenticated'](),auth[_0x1568('0x6')](),controller[_0x1568('0x8')]);router[_0x1568('0x3')](_0x1568('0x9'),auth[_0x1568('0x5')](),auth[_0x1568('0x6')](),controller[_0x1568('0xa')]);router['get']('/restart',auth[_0x1568('0x5')](),controller[_0x1568('0xb')]);router[_0x1568('0x3')]('/migrations',controller[_0x1568('0xc')]);module[_0x1568('0xd')]=router; \ No newline at end of file +var _0x239e=['isAuthenticated','fetch','/reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x1e79b9,_0x223ef3){var _0x2c2d29=function(_0x4573aa){while(--_0x4573aa){_0x1e79b9['push'](_0x1e79b9['shift']());}};_0x2c2d29(++_0x223ef3);}(_0x239e,0x191));var _0xe239=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x239e[_0xfb0281];return _0x408dd3;};'use strict';var express=require(_0xe239('0x0'));var router=express[_0xe239('0x1')]();var auth=require(_0xe239('0x2'));var controller=require(_0xe239('0x3'));router[_0xe239('0x4')]('/',controller[_0xe239('0x5')]);router['get'](_0xe239('0x6'),auth[_0xe239('0x7')](),auth['canUpdate'](),controller[_0xe239('0x8')]);router[_0xe239('0x4')](_0xe239('0x9'),auth[_0xe239('0x7')](),auth['canUpdate'](),controller['reset']);router[_0xe239('0x4')](_0xe239('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xe239('0xb')]);router[_0xe239('0x4')](_0xe239('0xc'),auth[_0xe239('0x7')](),controller[_0xe239('0xd')]);router[_0xe239('0x4')](_0xe239('0xe'),controller[_0xe239('0xf')]);module[_0xe239('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 f116e0a..c79b824 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 _0xb1cb=['status','origin','error','info','json','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','migrations','replace','.js','push','length','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','pkginfo','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','exports','version','query','latest','fetch','tags','2.0.0'];(function(_0x525864,_0x1bb3ea){var _0x4f9964=function(_0x5e2c0c){while(--_0x5e2c0c){_0x525864['push'](_0x525864['shift']());}};_0x4f9964(++_0x1bb3ea);}(_0xb1cb,0x154));var _0xbb1c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb1cb[_0x1d1779];return _0x2377e9;};'use strict';var Umzug=require(_0xbb1c('0x0'));var path=require('path');var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xbb1c('0x1'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0xbb1c('0x2'))['exec'];var db=require(_0xbb1c('0x3'))['db'];var config=require(_0xbb1c('0x4'));var pm2=require(_0xbb1c('0x5'));var logger=require(_0xbb1c('0x6'))(_0xbb1c('0x7'));var git=require(_0xbb1c('0x8'))(config[_0xbb1c('0x9')]);exports['index']=function(_0x321d1f,_0x4093ce){var _0x2cda4c={'current':module[_0xbb1c('0xa')][_0xbb1c('0xb')],'phonebar':0x2};if(_0x321d1f[_0xbb1c('0xc')]&&_0x321d1f[_0xbb1c('0xc')][_0xbb1c('0xd')]){return git[_0xbb1c('0xe')]()[_0xbb1c('0xf')](function(_0x3e7006,_0x2fdb1e){_0x2cda4c[_0xbb1c('0xd')]=(_0x3e7006?module[_0xbb1c('0xa')]['version']:_0x2fdb1e[_0xbb1c('0xd')])||_0xbb1c('0x10');return _0x4093ce[_0xbb1c('0x11')](0xc8)['json'](_0x2cda4c);});}else{return _0x4093ce['status'](0xc8)['json'](_0x2cda4c);}};exports[_0xbb1c('0xe')]=function(_0x5b7d9f,_0xcc2a17){return git[_0xbb1c('0xe')]([_0xbb1c('0x12'),'master'],function(_0x41946b){if(_0x41946b){logger[_0xbb1c('0x13')](_0x41946b);return _0xcc2a17['status'](0x1f4)['json'](_0x41946b);}logger[_0xbb1c('0x14')]('git\x20fetch');return _0xcc2a17['status'](0xc8)[_0xbb1c('0x15')]({'output':_0xbb1c('0x16')});});};exports['reset']=function(_0x50eb19,_0x59e895){return git[_0xbb1c('0x17')]([_0xbb1c('0x18'),_0xbb1c('0x19')],function(_0x2197de){if(_0x2197de){logger[_0xbb1c('0x13')](_0x2197de);return _0x59e895[_0xbb1c('0x11')](0x1f4)[_0xbb1c('0x15')](_0x2197de);}logger[_0xbb1c('0x14')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x59e895[_0xbb1c('0x11')](0xc8)[_0xbb1c('0x15')]({'output':_0xbb1c('0x1a')});});};exports['pull']=function(_0x11b84e,_0x5b498e){exec(_0xbb1c('0x1b'),function(_0xbb9dd1,_0x30e8f8,_0x414c7c){logger[_0xbb1c('0x14')](_0x30e8f8);logger[_0xbb1c('0x14')](_0x414c7c);if(_0xbb9dd1){logger[_0xbb1c('0x13')](_0xbb9dd1);return _0x5b498e[_0xbb1c('0x11')](0x1f4)[_0xbb1c('0x15')](_0xbb9dd1);}return _0x5b498e['status'](0xc8)['json']({'output':_0x30e8f8});});};exports['restart']=function(_0x4003cb,_0x3b4b37){return pm2['restart']('motion2')[_0xbb1c('0x1c')](function(_0x4d8dd6){logger[_0xbb1c('0x14')](_0xbb1c('0x1d'),_0x4d8dd6);return _0x3b4b37[_0xbb1c('0x11')](0xc8)[_0xbb1c('0x15')]({'output':_0xbb1c('0x1e')});})[_0xbb1c('0x1f')](function(_0x4f403f){logger[_0xbb1c('0x13')](_0x4f403f);return _0x3b4b37[_0xbb1c('0x11')](0x1f4)[_0xbb1c('0x15')](_0x4f403f);});};exports['migrations']=function(_0x55541f,_0x5c4b15){var _0x2ca672=fs[_0xbb1c('0x20')](path[_0xbb1c('0x21')](config[_0xbb1c('0x9')],_0xbb1c('0x22'),_0xbb1c('0x23')));var _0x3218df=[];for(var _0x32fe33=0x0;_0x32fe33<_0x2ca672['length'];_0x32fe33++){var _0x40c627=_0x2ca672[_0x32fe33][_0xbb1c('0x24')](_0xbb1c('0x25'),'');if(compareVersions(module['exports'][_0xbb1c('0xb')],_0x40c627)===-0x1){_0x3218df[_0xbb1c('0x26')](_0x40c627);}}if(_0x3218df[_0xbb1c('0x27')]){var _0xb83f7=_0x3218df[_0xbb1c('0x28')](compareVersions);var _0x16db09=new Umzug({'storage':_0xbb1c('0x29'),'storageOptions':{'model':db[_0xbb1c('0x2a')],'modelName':_0xbb1c('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0xbb1c('0x29')][_0xbb1c('0x2b')](),db['sequelize']['constructor'],function(){throw new Error(_0xbb1c('0x2c'));}],'path':path['join'](config[_0xbb1c('0x9')],_0xbb1c('0x22'),_0xbb1c('0x23')),'pattern':/\.js$/}});_0x16db09['up']({'migrations':_[_0xbb1c('0x2d')](_0xb83f7,function(_0x2ef10b){return _0x2ef10b+'.js';})})[_0xbb1c('0x1c')](function(){return _0x5c4b15[_0xbb1c('0x11')](0xc8)[_0xbb1c('0x15')]({'output':_0xbb1c('0x2e')+module[_0xbb1c('0xa')][_0xbb1c('0xb')]+_0xbb1c('0x2f')+_[_0xbb1c('0x30')](_0xb83f7),'migrations':_['join'](_0xb83f7)});})[_0xbb1c('0x1f')](function(_0x34629b){if(_0x34629b instanceof db[_0xbb1c('0x29')][_0xbb1c('0x31')]){return _0x5c4b15[_0xbb1c('0x11')](0xc8)['json']({'output':_0xbb1c('0x32')});}else{return _0x5c4b15[_0xbb1c('0x11')](0x1f4)['json'](_0x34629b);}});}else{return _0x5c4b15[_0xbb1c('0x11')](0xc8)[_0xbb1c('0x15')]({'output':_0xbb1c('0x32')});}}; \ No newline at end of file +var _0xb131=['update','simple-git','root','exports','query','fetch','latest','2.0.0','json','master','error','status','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','migrations','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/environment','../../config/logger'];(function(_0x59d32c,_0x306b7a){var _0x26e818=function(_0x4c3ed4){while(--_0x4c3ed4){_0x59d32c['push'](_0x59d32c['shift']());}};_0x26e818(++_0x306b7a);}(_0xb131,0x1ca));var _0x1b13=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xb131[_0x29d2d2];return _0x3f6476;};'use strict';var Umzug=require(_0x1b13('0x0'));var path=require(_0x1b13('0x1'));var fs=require('fs');var _=require(_0x1b13('0x2'));var pkginfo=require(_0x1b13('0x3'))(module,_0x1b13('0x4'));var compareVersions=require(_0x1b13('0x5'));var exec=require(_0x1b13('0x6'))[_0x1b13('0x7')];var db=require('../../mysqldb')['db'];var config=require(_0x1b13('0x8'));var pm2=require('../../config/pm2');var logger=require(_0x1b13('0x9'))(_0x1b13('0xa'));var git=require(_0x1b13('0xb'))(config[_0x1b13('0xc')]);exports['index']=function(_0x576d6a,_0x40a3b4){var _0x596a32={'current':module[_0x1b13('0xd')]['version'],'phonebar':0x2};if(_0x576d6a[_0x1b13('0xe')]&&_0x576d6a[_0x1b13('0xe')]['latest']){return git[_0x1b13('0xf')]()['tags'](function(_0x53e31c,_0x19cd5a){_0x596a32['latest']=(_0x53e31c?module[_0x1b13('0xd')]['version']:_0x19cd5a[_0x1b13('0x10')])||_0x1b13('0x11');return _0x40a3b4['status'](0xc8)[_0x1b13('0x12')](_0x596a32);});}else{return _0x40a3b4['status'](0xc8)['json'](_0x596a32);}};exports[_0x1b13('0xf')]=function(_0xb1e40c,_0x5d5a58){return git['fetch'](['origin',_0x1b13('0x13')],function(_0x489541){if(_0x489541){logger[_0x1b13('0x14')](_0x489541);return _0x5d5a58[_0x1b13('0x15')](0x1f4)[_0x1b13('0x12')](_0x489541);}logger[_0x1b13('0x16')](_0x1b13('0x17'));return _0x5d5a58[_0x1b13('0x15')](0xc8)[_0x1b13('0x12')]({'output':_0x1b13('0x18')});});};exports[_0x1b13('0x19')]=function(_0x26afa0,_0x1b4583){return git['reset']([_0x1b13('0x1a'),_0x1b13('0x1b')],function(_0x2e3101){if(_0x2e3101){logger['error'](_0x2e3101);return _0x1b4583[_0x1b13('0x15')](0x1f4)[_0x1b13('0x12')](_0x2e3101);}logger[_0x1b13('0x16')](_0x1b13('0x1c'));return _0x1b4583[_0x1b13('0x15')](0xc8)['json']({'output':_0x1b13('0x1d')});});};exports[_0x1b13('0x1e')]=function(_0x44d1a0,_0x56a2d2){exec('npm\x20install\x20--production',function(_0x440aa3,_0x497742,_0x43f551){logger[_0x1b13('0x16')](_0x497742);logger[_0x1b13('0x16')](_0x43f551);if(_0x440aa3){logger[_0x1b13('0x14')](_0x440aa3);return _0x56a2d2['status'](0x1f4)[_0x1b13('0x12')](_0x440aa3);}return _0x56a2d2[_0x1b13('0x15')](0xc8)['json']({'output':_0x497742});});};exports[_0x1b13('0x1f')]=function(_0x30a594,_0x53c7ea){return pm2['restart'](_0x1b13('0x20'))[_0x1b13('0x21')](function(_0x241272){logger[_0x1b13('0x16')](_0x1b13('0x22'),_0x241272);return _0x53c7ea[_0x1b13('0x15')](0xc8)[_0x1b13('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x1b13('0x23')](function(_0x1d7bee){logger[_0x1b13('0x14')](_0x1d7bee);return _0x53c7ea['status'](0x1f4)['json'](_0x1d7bee);});};exports['migrations']=function(_0x4359a4,_0x246d7b){var _0x2383d5=fs[_0x1b13('0x24')](path[_0x1b13('0x25')](config['root'],'server',_0x1b13('0x26')));var _0x2e6948=[];for(var _0x516ba2=0x0;_0x516ba2<_0x2383d5[_0x1b13('0x27')];_0x516ba2++){var _0xc52dfe=_0x2383d5[_0x516ba2][_0x1b13('0x28')](_0x1b13('0x29'),'');if(compareVersions(module['exports']['version'],_0xc52dfe)===-0x1){_0x2e6948[_0x1b13('0x2a')](_0xc52dfe);}}if(_0x2e6948[_0x1b13('0x27')]){var _0x3c980a=_0x2e6948[_0x1b13('0x2b')](compareVersions);var _0xfe5527=new Umzug({'storage':_0x1b13('0x2c'),'storageOptions':{'model':db[_0x1b13('0x2d')],'modelName':'Migration','columnName':_0x1b13('0x4')},'migrations':{'params':[db['sequelize'][_0x1b13('0x2e')](),db[_0x1b13('0x2c')][_0x1b13('0x2f')],function(){throw new Error(_0x1b13('0x30'));}],'path':path[_0x1b13('0x25')](config[_0x1b13('0xc')],'server',_0x1b13('0x26')),'pattern':/\.js$/}});_0xfe5527['up']({'migrations':_[_0x1b13('0x31')](_0x3c980a,function(_0xca87d8){return _0xca87d8+_0x1b13('0x29');})})['then'](function(){return _0x246d7b[_0x1b13('0x15')](0xc8)[_0x1b13('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x1b13('0xd')][_0x1b13('0x4')]+'\x20to\x20'+_['last'](_0x3c980a),'migrations':_[_0x1b13('0x25')](_0x3c980a)});})[_0x1b13('0x23')](function(_0x25db02){if(_0x25db02 instanceof db[_0x1b13('0x2c')][_0x1b13('0x32')]){return _0x246d7b[_0x1b13('0x15')](0xc8)[_0x1b13('0x12')]({'output':_0x1b13('0x33')});}else{return _0x246d7b[_0x1b13('0x15')](0x1f4)[_0x1b13('0x12')](_0x25db02);}});}else{return _0x246d7b[_0x1b13('0x15')](0xc8)[_0x1b13('0x12')]({'output':_0x1b13('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 54a2c51..c88f165 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 _0xcdf3=['/describe','describe','show','post','create','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated'];(function(_0xdd1792,_0x222488){var _0x40361c=function(_0x28326b){while(--_0x28326b){_0xdd1792['push'](_0xdd1792['shift']());}};_0x40361c(++_0x222488);}(_0xcdf3,0x8f));var _0x3cdf=function(_0x119d5b,_0x42ac61){_0x119d5b=_0x119d5b-0x0;var _0x3bcdf0=_0xcdf3[_0x119d5b];return _0x3bcdf0;};'use strict';var multer=require('multer');var util=require(_0x3cdf('0x0'));var path=require(_0x3cdf('0x1'));var timeout=require(_0x3cdf('0x2'));var express=require(_0x3cdf('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3cdf('0x4'));var interaction=require(_0x3cdf('0x5'));var config=require(_0x3cdf('0x6'));var controller=require(_0x3cdf('0x7'));router[_0x3cdf('0x8')]('/',auth[_0x3cdf('0x9')](),controller['index']);router[_0x3cdf('0x8')](_0x3cdf('0xa'),auth[_0x3cdf('0x9')](),controller[_0x3cdf('0xb')]);router['get']('/:id',auth[_0x3cdf('0x9')](),controller[_0x3cdf('0xc')]);router[_0x3cdf('0xd')]('/',auth[_0x3cdf('0x9')](),controller[_0x3cdf('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3cdf('0xf')]('/:id',auth[_0x3cdf('0x9')](),controller[_0x3cdf('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4567=['path','express','Router','../../config/environment','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','destroy','exports','multer','util'];(function(_0x5e238b,_0x17ae49){var _0x389bea=function(_0x3cc1c1){while(--_0x3cc1c1){_0x5e238b['push'](_0x5e238b['shift']());}};_0x389bea(++_0x17ae49);}(_0x4567,0x130));var _0x7456=function(_0x50c420,_0x4437e7){_0x50c420=_0x50c420-0x0;var _0x4c1cc3=_0x4567[_0x50c420];return _0x4c1cc3;};'use strict';var multer=require(_0x7456('0x0'));var util=require(_0x7456('0x1'));var path=require(_0x7456('0x2'));var timeout=require('connect-timeout');var express=require(_0x7456('0x3'));var router=express[_0x7456('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7456('0x5'));var controller=require(_0x7456('0x6'));router['get']('/',auth[_0x7456('0x7')](),controller['index']);router[_0x7456('0x8')](_0x7456('0x9'),auth[_0x7456('0x7')](),controller[_0x7456('0xa')]);router[_0x7456('0x8')](_0x7456('0xb'),auth['isAuthenticated'](),controller[_0x7456('0xc')]);router[_0x7456('0xd')]('/',auth[_0x7456('0x7')](),controller[_0x7456('0xe')]);router['put'](_0x7456('0xb'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7456('0xb'),auth[_0x7456('0x7')](),controller[_0x7456('0xf')]);module[_0x7456('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index f7cbe1c..f139762 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 _0x6cb4=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x8a6009,_0x46164e){var _0x2303bf=function(_0x4b6c77){while(--_0x4b6c77){_0x8a6009['push'](_0x8a6009['shift']());}};_0x2303bf(++_0x46164e);}(_0x6cb4,0xff));var _0x46cb=function(_0x3e2a4c,_0x915019){_0x3e2a4c=_0x3e2a4c-0x0;var _0x3a540b=_0x6cb4[_0x3e2a4c];return _0x3a540b;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'type':{'type':Sequelize[_0x46cb('0x2')]},'uniqueid':{'type':Sequelize[_0x46cb('0x2')]},'calleridnum':{'type':Sequelize[_0x46cb('0x2')]},'calleridname':{'type':Sequelize[_0x46cb('0x2')]},'queue':{'type':Sequelize[_0x46cb('0x2')]},'interface':{'type':Sequelize[_0x46cb('0x2')]},'membername':{'type':Sequelize[_0x46cb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x46cb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x46cb('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x46cb('0x4')]},'agentcomplete':{'type':Sequelize[_0x46cb('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x46cb('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x46cb('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x46cb('0x4')]},'agentacw':{'type':Sequelize[_0x46cb('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x46cb('0x2')]},'lastevent':{'type':Sequelize[_0x46cb('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x46cb('0x4')]},'channelstatedesc':{'type':Sequelize[_0x46cb('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x46cb('0x2')]},'language':{'type':Sequelize[_0x46cb('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x46cb('0x2')]},'destchannel':{'type':Sequelize[_0x46cb('0x2')]},'destchannelstate':{'type':Sequelize[_0x46cb('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x46cb('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x46cb('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x46cb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x46cb('0x2')]},'destlanguage':{'type':Sequelize[_0x46cb('0x2')]},'destaccountcode':{'type':Sequelize[_0x46cb('0x2')]},'destcontext':{'type':Sequelize[_0x46cb('0x2')]},'destexten':{'type':Sequelize[_0x46cb('0x2')]},'destpriority':{'type':Sequelize[_0x46cb('0x2')]},'destuniqueid':{'type':Sequelize[_0x46cb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x46cb('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x46cb('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x46cb('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x46cb('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x33d2=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x4fef48,_0x1adb86){var _0x241879=function(_0x51a60d){while(--_0x51a60d){_0x4fef48['push'](_0x4fef48['shift']());}};_0x241879(++_0x1adb86);}(_0x33d2,0x7f));var _0x233d=function(_0x1071d6,_0x293323){_0x1071d6=_0x1071d6-0x0;var _0x4c6be4=_0x33d2[_0x1071d6];return _0x4c6be4;};'use strict';var Sequelize=require(_0x233d('0x0'));module[_0x233d('0x1')]={'type':{'type':Sequelize[_0x233d('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x233d('0x2')]},'calleridname':{'type':Sequelize[_0x233d('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x233d('0x2')]},'membername':{'type':Sequelize[_0x233d('0x2')]},'agentcalledAt':{'type':Sequelize[_0x233d('0x3')]},'agentconnectAt':{'type':Sequelize[_0x233d('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x233d('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x233d('0x3')]},'agentdumpAt':{'type':Sequelize[_0x233d('0x3')]},'holdtime':{'type':Sequelize[_0x233d('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x233d('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x233d('0x4')]},'agentacw':{'type':Sequelize[_0x233d('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x233d('0x4')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x233d('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x233d('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x233d('0x2')]},'connectedlinename':{'type':Sequelize[_0x233d('0x2')]},'language':{'type':Sequelize[_0x233d('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x233d('0x2')]},'exten':{'type':Sequelize[_0x233d('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x233d('0x2')]},'destchannelstate':{'type':Sequelize[_0x233d('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x233d('0x2')]},'destcalleridnum':{'type':Sequelize[_0x233d('0x2')]},'destcalleridname':{'type':Sequelize[_0x233d('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x233d('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x233d('0x2')]},'destaccountcode':{'type':Sequelize[_0x233d('0x2')]},'destcontext':{'type':Sequelize[_0x233d('0x2')]},'destexten':{'type':Sequelize[_0x233d('0x2')]},'destpriority':{'type':Sequelize[_0x233d('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x233d('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x233d('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x233d('0x2')],'comment':_0x233d('0x6')},'transferexten':{'type':Sequelize[_0x233d('0x2')]},'transferuniqueid':{'type':Sequelize[_0x233d('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index ff26af6..0b93958 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(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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 f021835..feda05c 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 _0xea89=['destuniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent'];(function(_0x51a022,_0x31f20e){var _0x2667f2=function(_0x47f193){while(--_0x47f193){_0x51a022['push'](_0x51a022['shift']());}};_0x2667f2(++_0x31f20e);}(_0xea89,0x1e2));var _0x9ea8=function(_0x271089,_0x38fc51){_0x271089=_0x271089-0x0;var _0x5eeb64=_0xea89[_0x271089];return _0x5eeb64;};'use strict';var _=require(_0x9ea8('0x0'));var util=require(_0x9ea8('0x1'));var logger=require(_0x9ea8('0x2'))(_0x9ea8('0x3'));var moment=require(_0x9ea8('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ea8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ea8('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ea8('0x7'));module[_0x9ea8('0x8')]=function(_0x2c6e50,_0x184f38){return _0x2c6e50[_0x9ea8('0x9')](_0x9ea8('0xa'),attributes,{'tableName':_0x9ea8('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid',_0x9ea8('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa4dc=['moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','report_agent','uniqueid','destuniqueid','lodash','util'];(function(_0x421b4f,_0x363b8e){var _0xb6e65b=function(_0x269b0a){while(--_0x269b0a){_0x421b4f['push'](_0x421b4f['shift']());}};_0xb6e65b(++_0x363b8e);}(_0xa4dc,0x16a));var _0xca4d=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xa4dc[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0xca4d('0x0'));var util=require(_0xca4d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca4d('0x2'));var BPromise=require(_0xca4d('0x3'));var rp=require(_0xca4d('0x4'));var fs=require('fs');var path=require(_0xca4d('0x5'));var rimraf=require(_0xca4d('0x6'));var config=require('../../config/environment');var attributes=require(_0xca4d('0x7'));module[_0xca4d('0x8')]=function(_0x1b60f4,_0x51470b){return _0x1b60f4[_0xca4d('0x9')]('VoiceAgentReport',attributes,{'tableName':_0xca4d('0xa'),'paranoid':![],'indexes':[{'fields':[_0xca4d('0xb'),_0xca4d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 28f7ff3..56f09e8 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 _0x8b69=['CreateVoiceAgentReport','create','options','raw','catch','body','where','limit','then','UpdateVoiceAgentReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8b69,0x140));var _0x98b6=function(_0x163ccf,_0x349447){_0x163ccf=_0x163ccf-0x0;var _0xa40b91=_0x8b69[_0x163ccf];return _0xa40b91;};'use strict';var _=require(_0x98b6('0x0'));var util=require('util');var moment=require(_0x98b6('0x1'));var BPromise=require(_0x98b6('0x2'));var rs=require(_0x98b6('0x3'));var fs=require('fs');var Redis=require(_0x98b6('0x4'));var db=require(_0x98b6('0x5'))['db'];var utils=require(_0x98b6('0x6'));var logger=require(_0x98b6('0x7'))(_0x98b6('0x8'));var config=require('../../config/environment');var jayson=require(_0x98b6('0x9'));var client=jayson[_0x98b6('0xa')][_0x98b6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28c83d,_0x4374a8,_0x48512e){return new BPromise(function(_0x5f0359,_0x5e5fe3){return client[_0x98b6('0xc')](_0x28c83d,_0x48512e)['then'](function(_0x2f0448){logger[_0x98b6('0xd')](_0x98b6('0xe'),_0x4374a8,_0x98b6('0xf'));logger[_0x98b6('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4374a8,_0x98b6('0xf'),JSON[_0x98b6('0x11')](_0x2f0448));if(_0x2f0448[_0x98b6('0x12')]){if(_0x2f0448['error'][_0x98b6('0x13')]===0x1f4){logger[_0x98b6('0x12')](_0x98b6('0xe'),_0x4374a8,_0x2f0448[_0x98b6('0x12')]['message']);return _0x5e5fe3(_0x2f0448[_0x98b6('0x12')][_0x98b6('0x14')]);}logger[_0x98b6('0x12')](_0x98b6('0xe'),_0x4374a8,_0x2f0448[_0x98b6('0x12')]['message']);return _0x5f0359(_0x2f0448[_0x98b6('0x12')][_0x98b6('0x14')]);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x4374a8,_0x98b6('0xf'));_0x5f0359(_0x2f0448['result'][_0x98b6('0x14')]);}})['catch'](function(_0x74e75d){logger[_0x98b6('0x12')](_0x98b6('0xe'),_0x4374a8,_0x74e75d);_0x5e5fe3(_0x74e75d);});});}exports[_0x98b6('0x15')]=function(_0x510fda){var _0x2d2f53=this;return new Promise(function(_0x5173e5,_0x18eda8){return db['VoiceAgentReport'][_0x98b6('0x16')](_0x510fda['body'],{'raw':_0x510fda[_0x98b6('0x17')]?_0x510fda[_0x98b6('0x17')][_0x98b6('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x7aa1fa){logger['info'](_0x98b6('0x15'),_0x510fda);logger[_0x98b6('0x10')](_0x98b6('0x15'),_0x510fda,JSON['stringify'](_0x7aa1fa));_0x5173e5(_0x7aa1fa);})[_0x98b6('0x19')](function(_0x33a6ef){logger[_0x98b6('0x12')](_0x98b6('0x15'),_0x33a6ef['message'],_0x510fda);_0x18eda8(_0x2d2f53['error'](0x1f4,_0x33a6ef[_0x98b6('0x14')]));});});};exports['UpdateVoiceAgentReport']=function(_0x3e3c84){var _0x3d110a=this;return new Promise(function(_0x4266f2,_0x27784a){return db['VoiceAgentReport']['update'](_0x3e3c84[_0x98b6('0x1a')],{'raw':_0x3e3c84[_0x98b6('0x17')]?_0x3e3c84[_0x98b6('0x17')][_0x98b6('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e3c84['options']?_0x3e3c84[_0x98b6('0x17')][_0x98b6('0x1b')]||null:null,'attributes':_0x3e3c84[_0x98b6('0x17')]?_0x3e3c84[_0x98b6('0x17')]['attributes']||null:null,'limit':_0x3e3c84[_0x98b6('0x17')]?_0x3e3c84[_0x98b6('0x17')][_0x98b6('0x1c')]||null:null})[_0x98b6('0x1d')](function(_0xf0079a){logger[_0x98b6('0xd')](_0x98b6('0x1e'),_0x3e3c84);logger[_0x98b6('0x10')]('UpdateVoiceAgentReport',_0x3e3c84,JSON[_0x98b6('0x11')](_0xf0079a));_0x4266f2(_0xf0079a);})[_0x98b6('0x19')](function(_0x10231e){logger[_0x98b6('0x12')](_0x98b6('0x1e'),_0x10231e[_0x98b6('0x14')],_0x3e3c84);_0x27784a(_0x3d110a[_0x98b6('0x12')](0x1f4,_0x10231e[_0x98b6('0x14')]));});});}; \ No newline at end of file +var _0x47c7=['stringify','error','code','message','catch','create','body','options','then','CreateVoiceAgentReport','VoiceAgentReport','update','limit','UpdateVoiceAgentReport','lodash','util','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x47c7,0x10a));var _0x747c=function(_0xd0a847,_0x72562b){_0xd0a847=_0xd0a847-0x0;var _0x2536ec=_0x47c7[_0xd0a847];return _0x2536ec;};'use strict';var _=require(_0x747c('0x0'));var util=require(_0x747c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x747c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x747c('0x3'));var logger=require(_0x747c('0x4'))('rpc');var config=require(_0x747c('0x5'));var jayson=require(_0x747c('0x6'));var client=jayson[_0x747c('0x7')][_0x747c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f0307,_0x472e01,_0x52f88e){return new BPromise(function(_0x4fb25e,_0x505ebc){return client['request'](_0x5f0307,_0x52f88e)['then'](function(_0x48de82){logger[_0x747c('0x9')](_0x747c('0xa'),_0x472e01,_0x747c('0xb'));logger[_0x747c('0xc')](_0x747c('0xd'),_0x472e01,_0x747c('0xb'),JSON[_0x747c('0xe')](_0x48de82));if(_0x48de82[_0x747c('0xf')]){if(_0x48de82[_0x747c('0xf')][_0x747c('0x10')]===0x1f4){logger[_0x747c('0xf')](_0x747c('0xa'),_0x472e01,_0x48de82['error'][_0x747c('0x11')]);return _0x505ebc(_0x48de82['error']['message']);}logger['error'](_0x747c('0xa'),_0x472e01,_0x48de82[_0x747c('0xf')][_0x747c('0x11')]);return _0x4fb25e(_0x48de82[_0x747c('0xf')][_0x747c('0x11')]);}else{logger[_0x747c('0x9')](_0x747c('0xa'),_0x472e01,_0x747c('0xb'));_0x4fb25e(_0x48de82['result'][_0x747c('0x11')]);}})[_0x747c('0x12')](function(_0x264913){logger['error'](_0x747c('0xa'),_0x472e01,_0x264913);_0x505ebc(_0x264913);});});}exports['CreateVoiceAgentReport']=function(_0x35cc9b){var _0x461f36=this;return new Promise(function(_0x1a19a1,_0x30ba51){return db['VoiceAgentReport'][_0x747c('0x13')](_0x35cc9b[_0x747c('0x14')],{'raw':_0x35cc9b['options']?_0x35cc9b[_0x747c('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x747c('0x16')](function(_0x312b36){logger[_0x747c('0x9')](_0x747c('0x17'),_0x35cc9b);logger[_0x747c('0xc')](_0x747c('0x17'),_0x35cc9b,JSON[_0x747c('0xe')](_0x312b36));_0x1a19a1(_0x312b36);})[_0x747c('0x12')](function(_0x2d9fd6){logger['error'](_0x747c('0x17'),_0x2d9fd6[_0x747c('0x11')],_0x35cc9b);_0x30ba51(_0x461f36[_0x747c('0xf')](0x1f4,_0x2d9fd6[_0x747c('0x11')]));});});};exports['UpdateVoiceAgentReport']=function(_0x567fa2){var _0x4560fd=this;return new Promise(function(_0xe976ae,_0x45b2e1){return db[_0x747c('0x18')][_0x747c('0x19')](_0x567fa2[_0x747c('0x14')],{'raw':_0x567fa2[_0x747c('0x15')]?_0x567fa2[_0x747c('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x567fa2[_0x747c('0x15')]?_0x567fa2[_0x747c('0x15')]['where']||null:null,'attributes':_0x567fa2[_0x747c('0x15')]?_0x567fa2[_0x747c('0x15')]['attributes']||null:null,'limit':_0x567fa2[_0x747c('0x15')]?_0x567fa2['options'][_0x747c('0x1a')]||null:null})[_0x747c('0x16')](function(_0x5c018c){logger[_0x747c('0x9')]('UpdateVoiceAgentReport',_0x567fa2);logger['debug'](_0x747c('0x1b'),_0x567fa2,JSON[_0x747c('0xe')](_0x5c018c));_0xe976ae(_0x5c018c);})[_0x747c('0x12')](function(_0x10d7bc){logger[_0x747c('0xf')]('UpdateVoiceAgentReport',_0x10d7bc[_0x747c('0x11')],_0x567fa2);_0x45b2e1(_0x4560fd[_0x747c('0xf')](0x1f4,_0x10d7bc[_0x747c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 254316c..3bf4e70 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 _0x0faf=['./voiceCallReport.controller','isAuthenticated','index','get','/describe','/:id','post','create','put','update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x43d9b8,_0x460851){var _0xa3355a=function(_0x1f6797){while(--_0x1f6797){_0x43d9b8['push'](_0x43d9b8['shift']());}};_0xa3355a(++_0x460851);}(_0x0faf,0x132));var _0xf0fa=function(_0x5a6de2,_0x5c8b10){_0x5a6de2=_0x5a6de2-0x0;var _0x2c0525=_0x0faf[_0x5a6de2];return _0x2c0525;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),auth[_0xf0fa('0xa')](),controller['describe']);router[_0xf0fa('0xc')](_0xf0fa('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xf0fa('0xf')]('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x10')]);router[_0xf0fa('0x11')](_0xf0fa('0xe'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x12')]);router[_0xf0fa('0x13')]('/:id',auth[_0xf0fa('0xa')](),controller['destroy']);module[_0xf0fa('0x14')]=router; \ No newline at end of file +var _0xa630=['describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','/describe'];(function(_0xa56dca,_0x44cccf){var _0x4f3737=function(_0x3d0206){while(--_0x3d0206){_0xa56dca['push'](_0xa56dca['shift']());}};_0x4f3737(++_0x44cccf);}(_0xa630,0xbe));var _0x0a63=function(_0x242182,_0x28e6fc){_0x242182=_0x242182-0x0;var _0x2d3da8=_0xa630[_0x242182];return _0x2d3da8;};'use strict';var multer=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0a63('0x2'));var router=express['Router']();var fs_extra=require(_0x0a63('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var controller=require(_0x0a63('0x6'));router[_0x0a63('0x7')]('/',auth[_0x0a63('0x8')](),controller['index']);router[_0x0a63('0x7')](_0x0a63('0x9'),auth[_0x0a63('0x8')](),controller[_0x0a63('0xa')]);router[_0x0a63('0x7')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0xc')]);router[_0x0a63('0xd')]('/',auth[_0x0a63('0x8')](),controller[_0x0a63('0xe')]);router[_0x0a63('0xf')](_0x0a63('0xb'),auth[_0x0a63('0x8')](),controller[_0x0a63('0x10')]);router[_0x0a63('0x11')](_0x0a63('0xb'),auth['isAuthenticated'](),controller[_0x0a63('0x12')]);module[_0x0a63('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 7bdb8d0..4b352a8 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 _0xefe2=['inbound','outbound','outbound-fax','dialer','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM'];(function(_0x2e14e3,_0x1ed432){var _0x173c9b=function(_0x4caeb6){while(--_0x4caeb6){_0x2e14e3['push'](_0x2e14e3['shift']());}};_0x173c9b(++_0x1ed432);}(_0xefe2,0xd9));var _0x2efe=function(_0x2097e9,_0x18a66e){_0x2097e9=_0x2097e9-0x0;var _0x358943=_0xefe2[_0x2097e9];return _0x358943;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2efe('0x2')](_0x2efe('0x3'),'internal',_0x2efe('0x4'),'inbound-fax',_0x2efe('0x5'),_0x2efe('0x6'))},'tag':{'type':Sequelize[_0x2efe('0x7')]},'accountcode':{'type':Sequelize[_0x2efe('0x7')]},'source':{'type':Sequelize[_0x2efe('0x7')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x2efe('0x7')]},'callerid':{'type':Sequelize[_0x2efe('0x7')]},'channel':{'type':Sequelize[_0x2efe('0x7')]},'destinationchannel':{'type':Sequelize[_0x2efe('0x7')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x2efe('0x8')]},'starttime':{'type':Sequelize[_0x2efe('0x9')]},'systemanswertime':{'type':Sequelize[_0x2efe('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x2efe('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2efe('0x7')]},'amaflags':{'type':Sequelize[_0x2efe('0x7')]},'userfield':{'type':Sequelize[_0x2efe('0x7')]},'userDisposition':{'type':Sequelize[_0x2efe('0x7')]},'userSecondDisposition':{'type':Sequelize[_0x2efe('0x7')]},'userThirdDisposition':{'type':Sequelize[_0x2efe('0x7')]},'note':{'type':Sequelize[_0x2efe('0x7')]},'prefix':{'type':Sequelize[_0x2efe('0x7')]},'routeid':{'type':Sequelize[_0x2efe('0xa')]},'sipcallid':{'type':Sequelize[_0x2efe('0x7')]}}; \ No newline at end of file +var _0xb62e=['STRING','ENUM','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb62e,0x1de));var _0xeb62=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xb62e[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xeb62('0x0'));module[_0xeb62('0x1')]={'uniqueid':{'type':Sequelize[_0xeb62('0x2')]},'type':{'type':Sequelize[_0xeb62('0x3')]('inbound',_0xeb62('0x4'),_0xeb62('0x5'),_0xeb62('0x6'),_0xeb62('0x7'),_0xeb62('0x8'))},'tag':{'type':Sequelize[_0xeb62('0x2')]},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize[_0xeb62('0x2')]},'destination':{'type':Sequelize[_0xeb62('0x2')]},'destinationcontext':{'type':Sequelize[_0xeb62('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xeb62('0x2')]},'destinationchannel':{'type':Sequelize[_0xeb62('0x2')]},'lastapplication':{'type':Sequelize[_0xeb62('0x2')]},'lastdata':{'type':Sequelize[_0xeb62('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xeb62('0xa')]},'endtime':{'type':Sequelize[_0xeb62('0xa')]},'duration':{'type':Sequelize[_0xeb62('0xb')]},'billableseconds':{'type':Sequelize[_0xeb62('0xb')]},'mohtime':{'type':Sequelize[_0xeb62('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xeb62('0x2')]},'amaflags':{'type':Sequelize[_0xeb62('0x2')]},'userfield':{'type':Sequelize[_0xeb62('0x2')]},'userDisposition':{'type':Sequelize[_0xeb62('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xeb62('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xeb62('0x2')]},'prefix':{'type':Sequelize[_0xeb62('0x2')]},'routeid':{'type':Sequelize[_0xeb62('0xb')]},'sipcallid':{'type':Sequelize[_0xeb62('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 51af3df..fb988a2 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x1f4709,_0x2d7cd7){var _0x563f06=function(_0x3550c1){while(--_0x3550c1){_0x1f4709['push'](_0x1f4709['shift']());}};_0x563f06(++_0x2d7cd7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x10c16d,_0x2b3e14){_0x10c16d=_0x10c16d-0x0;var _0x5896f4=_0x0b0e[_0x10c16d];return _0x5896f4;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));}; \ No newline at end of file +var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x28a924,_0x15b8c1){_0x28a924=_0x28a924-0x0;var _0x192f70=_0x2032[_0x28a924];return _0x192f70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 7f04296..06f4302 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 _0x27a2=['uniqueid','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x25555f,_0xa8cb43){var _0x4a7ffa=function(_0x5ac548){while(--_0x5ac548){_0x25555f['push'](_0x25555f['shift']());}};_0x4a7ffa(++_0xa8cb43);}(_0x27a2,0x17a));var _0x227a=function(_0x4eb782,_0xec7f80){_0x4eb782=_0x4eb782-0x0;var _0x47a93f=_0x27a2[_0x4eb782];return _0x47a93f;};'use strict';var _=require(_0x227a('0x0'));var util=require(_0x227a('0x1'));var logger=require('../../config/logger')(_0x227a('0x2'));var moment=require(_0x227a('0x3'));var BPromise=require(_0x227a('0x4'));var rp=require(_0x227a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x227a('0x6'));var config=require(_0x227a('0x7'));var attributes=require(_0x227a('0x8'));module[_0x227a('0x9')]=function(_0x2cd790,_0x16fc9b){return _0x2cd790[_0x227a('0xa')](_0x227a('0xb'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x227a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8796=['VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x59ee0d,_0x51fa74){var _0x310320=function(_0x321556){while(--_0x321556){_0x59ee0d['push'](_0x59ee0d['shift']());}};_0x310320(++_0x51fa74);}(_0x8796,0x11b));var _0x6879=function(_0x2ef291,_0x11d6f5){_0x2ef291=_0x2ef291-0x0;var _0x2c374b=_0x8796[_0x2ef291];return _0x2c374b;};'use strict';var _=require(_0x6879('0x0'));var util=require(_0x6879('0x1'));var logger=require(_0x6879('0x2'))(_0x6879('0x3'));var moment=require(_0x6879('0x4'));var BPromise=require(_0x6879('0x5'));var rp=require(_0x6879('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6879('0x7'));var config=require(_0x6879('0x8'));var attributes=require(_0x6879('0x9'));module[_0x6879('0xa')]=function(_0xdd8277,_0x1dcf5a){return _0xdd8277['define'](_0x6879('0xb'),attributes,{'tableName':_0x6879('0xc'),'paranoid':![],'indexes':[{'fields':[_0x6879('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c188ecf..0e8176a 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 _0x7fa1=['result','catch','GetVoiceCallReport','options','raw','where','attributes','limit','include','map','model','CreateVoiceCallReport','create','body','VoiceCallReport','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x42d1c8,_0xc13c44){var _0x22f990=function(_0x3ce85f){while(--_0x3ce85f){_0x42d1c8['push'](_0x42d1c8['shift']());}};_0x22f990(++_0xc13c44);}(_0x7fa1,0xfb));var _0x17fa=function(_0x1802cc,_0x12875f){_0x1802cc=_0x1802cc-0x0;var _0x866ae2=_0x7fa1[_0x1802cc];return _0x866ae2;};'use strict';var _=require(_0x17fa('0x0'));var util=require(_0x17fa('0x1'));var moment=require(_0x17fa('0x2'));var BPromise=require(_0x17fa('0x3'));var rs=require(_0x17fa('0x4'));var fs=require('fs');var Redis=require(_0x17fa('0x5'));var db=require(_0x17fa('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x17fa('0x7'))('rpc');var config=require(_0x17fa('0x8'));var jayson=require(_0x17fa('0x9'));var client=jayson[_0x17fa('0xa')][_0x17fa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbd1722,_0xa24f97,_0xdbd1de){return new BPromise(function(_0x12b68f,_0x3e536d){return client[_0x17fa('0xc')](_0xbd1722,_0xdbd1de)[_0x17fa('0xd')](function(_0x496e12){logger[_0x17fa('0xe')](_0x17fa('0xf'),_0xa24f97,'request\x20sent');logger['debug'](_0x17fa('0x10'),_0xa24f97,_0x17fa('0x11'),JSON[_0x17fa('0x12')](_0x496e12));if(_0x496e12['error']){if(_0x496e12[_0x17fa('0x13')][_0x17fa('0x14')]===0x1f4){logger[_0x17fa('0x13')](_0x17fa('0xf'),_0xa24f97,_0x496e12[_0x17fa('0x13')][_0x17fa('0x15')]);return _0x3e536d(_0x496e12[_0x17fa('0x13')][_0x17fa('0x15')]);}logger[_0x17fa('0x13')](_0x17fa('0xf'),_0xa24f97,_0x496e12[_0x17fa('0x13')][_0x17fa('0x15')]);return _0x12b68f(_0x496e12[_0x17fa('0x13')]['message']);}else{logger['info'](_0x17fa('0xf'),_0xa24f97,_0x17fa('0x11'));_0x12b68f(_0x496e12[_0x17fa('0x16')]['message']);}})[_0x17fa('0x17')](function(_0x134438){logger[_0x17fa('0x13')](_0x17fa('0xf'),_0xa24f97,_0x134438);_0x3e536d(_0x134438);});});}exports[_0x17fa('0x18')]=function(_0x363dea){var _0x5d257d=this;return new Promise(function(_0x4c7290,_0x40c961){return db['VoiceCallReport']['findAll']({'raw':_0x363dea[_0x17fa('0x19')]?_0x363dea[_0x17fa('0x19')][_0x17fa('0x1a')]===undefined?!![]:![]:!![],'where':_0x363dea['options']?_0x363dea[_0x17fa('0x19')][_0x17fa('0x1b')]||null:null,'attributes':_0x363dea[_0x17fa('0x19')]?_0x363dea[_0x17fa('0x19')][_0x17fa('0x1c')]||null:null,'limit':_0x363dea['options']?_0x363dea['options'][_0x17fa('0x1d')]||null:null,'include':_0x363dea[_0x17fa('0x19')]?_0x363dea[_0x17fa('0x19')][_0x17fa('0x1e')]?_[_0x17fa('0x1f')](_0x363dea[_0x17fa('0x19')][_0x17fa('0x1e')],function(_0x1960a1){return{'model':db[_0x1960a1['model']],'as':_0x1960a1['as'],'attributes':_0x1960a1['attributes'],'include':_0x1960a1[_0x17fa('0x1e')]?_['map'](_0x1960a1[_0x17fa('0x1e')],function(_0x112d96){return{'model':db[_0x112d96['model']],'as':_0x112d96['as'],'attributes':_0x112d96[_0x17fa('0x1c')],'include':_0x112d96[_0x17fa('0x1e')]?_['map'](_0x112d96[_0x17fa('0x1e')],function(_0x30f436){return{'model':db[_0x30f436[_0x17fa('0x20')]],'as':_0x30f436['as'],'attributes':_0x30f436[_0x17fa('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc3e0d){logger[_0x17fa('0xe')](_0x17fa('0x18'),_0x363dea);logger['debug'](_0x17fa('0x18'),_0x363dea,JSON[_0x17fa('0x12')](_0xc3e0d));_0x4c7290(_0xc3e0d);})[_0x17fa('0x17')](function(_0x15b59b){logger[_0x17fa('0x13')](_0x17fa('0x18'),_0x15b59b[_0x17fa('0x15')],_0x363dea);_0x40c961(_0x5d257d[_0x17fa('0x13')](0x1f4,_0x15b59b[_0x17fa('0x15')]));});});};exports[_0x17fa('0x21')]=function(_0xa5a5b6){var _0x2312a4=this;return new Promise(function(_0x2699a2,_0x1e54b6){return db['VoiceCallReport'][_0x17fa('0x22')](_0xa5a5b6[_0x17fa('0x23')],{'raw':_0xa5a5b6[_0x17fa('0x19')]?_0xa5a5b6[_0x17fa('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x17fa('0xd')](function(_0x58a455){logger['info'](_0x17fa('0x21'),_0xa5a5b6);logger['debug'](_0x17fa('0x21'),_0xa5a5b6,JSON['stringify'](_0x58a455));_0x2699a2(_0x58a455);})[_0x17fa('0x17')](function(_0x4f5d5a){logger[_0x17fa('0x13')](_0x17fa('0x21'),_0x4f5d5a[_0x17fa('0x15')],_0xa5a5b6);_0x1e54b6(_0x2312a4[_0x17fa('0x13')](0x1f4,_0x4f5d5a[_0x17fa('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x5aa161){var _0x157cf0=this;return new Promise(function(_0x5b8ba6,_0x2ff3f8){return db[_0x17fa('0x24')][_0x17fa('0x25')](_0x5aa161[_0x17fa('0x23')],{'raw':_0x5aa161[_0x17fa('0x19')]?_0x5aa161[_0x17fa('0x19')][_0x17fa('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5aa161[_0x17fa('0x19')]?_0x5aa161[_0x17fa('0x19')][_0x17fa('0x1b')]||null:null,'attributes':_0x5aa161['options']?_0x5aa161[_0x17fa('0x19')]['attributes']||null:null,'limit':_0x5aa161[_0x17fa('0x19')]?_0x5aa161[_0x17fa('0x19')]['limit']||null:null})[_0x17fa('0xd')](function(_0x37babf){logger[_0x17fa('0xe')](_0x17fa('0x26'),_0x5aa161);logger['debug'](_0x17fa('0x26'),_0x5aa161,JSON['stringify'](_0x37babf));_0x5b8ba6(_0x37babf);})[_0x17fa('0x17')](function(_0x1e2e00){logger[_0x17fa('0x13')]('UpdateVoiceCallReport',_0x1e2e00[_0x17fa('0x15')],_0x5aa161);_0x2ff3f8(_0x157cf0['error'](0x1f4,_0x1e2e00[_0x17fa('0x15')]));});});}; \ No newline at end of file +var _0xf6d8=['client','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','stringify','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x28274b,_0x1a8a94){var _0x48cb67=function(_0x4bd537){while(--_0x4bd537){_0x28274b['push'](_0x28274b['shift']());}};_0x48cb67(++_0x1a8a94);}(_0xf6d8,0xb4));var _0x8f6d=function(_0x2a9687,_0x10a66c){_0x2a9687=_0x2a9687-0x0;var _0x362da1=_0xf6d8[_0x2a9687];return _0x362da1;};'use strict';var _=require(_0x8f6d('0x0'));var util=require(_0x8f6d('0x1'));var moment=require(_0x8f6d('0x2'));var BPromise=require(_0x8f6d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f6d('0x4'));var db=require(_0x8f6d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f6d('0x6'))(_0x8f6d('0x7'));var config=require(_0x8f6d('0x8'));var jayson=require(_0x8f6d('0x9'));var client=jayson[_0x8f6d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f635d,_0x437bea,_0x5d348a){return new BPromise(function(_0x30c295,_0x12fc07){return client[_0x8f6d('0xb')](_0x4f635d,_0x5d348a)[_0x8f6d('0xc')](function(_0x116e9c){logger['info'](_0x8f6d('0xd'),_0x437bea,_0x8f6d('0xe'));logger[_0x8f6d('0xf')](_0x8f6d('0x10'),_0x437bea,_0x8f6d('0xe'),JSON['stringify'](_0x116e9c));if(_0x116e9c['error']){if(_0x116e9c[_0x8f6d('0x11')]['code']===0x1f4){logger[_0x8f6d('0x11')](_0x8f6d('0xd'),_0x437bea,_0x116e9c[_0x8f6d('0x11')]['message']);return _0x12fc07(_0x116e9c[_0x8f6d('0x11')]['message']);}logger['error'](_0x8f6d('0xd'),_0x437bea,_0x116e9c['error'][_0x8f6d('0x12')]);return _0x30c295(_0x116e9c['error'][_0x8f6d('0x12')]);}else{logger[_0x8f6d('0x13')](_0x8f6d('0xd'),_0x437bea,_0x8f6d('0xe'));_0x30c295(_0x116e9c[_0x8f6d('0x14')]['message']);}})[_0x8f6d('0x15')](function(_0x37b7a7){logger[_0x8f6d('0x11')](_0x8f6d('0xd'),_0x437bea,_0x37b7a7);_0x12fc07(_0x37b7a7);});});}exports[_0x8f6d('0x16')]=function(_0x4ad235){var _0x881919=this;return new Promise(function(_0x169315,_0x1bdae2){return db[_0x8f6d('0x17')][_0x8f6d('0x18')]({'raw':_0x4ad235['options']?_0x4ad235[_0x8f6d('0x19')][_0x8f6d('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ad235[_0x8f6d('0x19')]?_0x4ad235['options'][_0x8f6d('0x1b')]||null:null,'attributes':_0x4ad235[_0x8f6d('0x19')]?_0x4ad235[_0x8f6d('0x19')][_0x8f6d('0x1c')]||null:null,'limit':_0x4ad235[_0x8f6d('0x19')]?_0x4ad235[_0x8f6d('0x19')][_0x8f6d('0x1d')]||null:null,'include':_0x4ad235[_0x8f6d('0x19')]?_0x4ad235[_0x8f6d('0x19')][_0x8f6d('0x1e')]?_[_0x8f6d('0x1f')](_0x4ad235['options'][_0x8f6d('0x1e')],function(_0x4e7505){return{'model':db[_0x4e7505[_0x8f6d('0x20')]],'as':_0x4e7505['as'],'attributes':_0x4e7505['attributes'],'include':_0x4e7505[_0x8f6d('0x1e')]?_['map'](_0x4e7505['include'],function(_0x38abd9){return{'model':db[_0x38abd9[_0x8f6d('0x20')]],'as':_0x38abd9['as'],'attributes':_0x38abd9['attributes'],'include':_0x38abd9[_0x8f6d('0x1e')]?_['map'](_0x38abd9[_0x8f6d('0x1e')],function(_0x5692f9){return{'model':db[_0x5692f9[_0x8f6d('0x20')]],'as':_0x5692f9['as'],'attributes':_0x5692f9[_0x8f6d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8f6d('0xc')](function(_0x3b8ebf){logger[_0x8f6d('0x13')](_0x8f6d('0x16'),_0x4ad235);logger[_0x8f6d('0xf')](_0x8f6d('0x16'),_0x4ad235,JSON[_0x8f6d('0x21')](_0x3b8ebf));_0x169315(_0x3b8ebf);})['catch'](function(_0x1e3429){logger[_0x8f6d('0x11')](_0x8f6d('0x16'),_0x1e3429[_0x8f6d('0x12')],_0x4ad235);_0x1bdae2(_0x881919['error'](0x1f4,_0x1e3429['message']));});});};exports[_0x8f6d('0x22')]=function(_0x17c0f2){var _0xba5595=this;return new Promise(function(_0x1d5c92,_0x346dfa){return db[_0x8f6d('0x17')][_0x8f6d('0x23')](_0x17c0f2[_0x8f6d('0x24')],{'raw':_0x17c0f2[_0x8f6d('0x19')]?_0x17c0f2[_0x8f6d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8f6d('0xc')](function(_0x153458){logger[_0x8f6d('0x13')](_0x8f6d('0x22'),_0x17c0f2);logger[_0x8f6d('0xf')](_0x8f6d('0x22'),_0x17c0f2,JSON['stringify'](_0x153458));_0x1d5c92(_0x153458);})[_0x8f6d('0x15')](function(_0x24cd35){logger['error'](_0x8f6d('0x22'),_0x24cd35['message'],_0x17c0f2);_0x346dfa(_0xba5595[_0x8f6d('0x11')](0x1f4,_0x24cd35[_0x8f6d('0x12')]));});});};exports[_0x8f6d('0x25')]=function(_0x42b77d){var _0x15dae9=this;return new Promise(function(_0x3149bb,_0xe92604){return db[_0x8f6d('0x17')]['update'](_0x42b77d[_0x8f6d('0x24')],{'raw':_0x42b77d[_0x8f6d('0x19')]?_0x42b77d[_0x8f6d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42b77d[_0x8f6d('0x19')]?_0x42b77d['options'][_0x8f6d('0x1b')]||null:null,'attributes':_0x42b77d[_0x8f6d('0x19')]?_0x42b77d[_0x8f6d('0x19')]['attributes']||null:null,'limit':_0x42b77d['options']?_0x42b77d['options']['limit']||null:null})[_0x8f6d('0xc')](function(_0x705d36){logger['info'](_0x8f6d('0x25'),_0x42b77d);logger[_0x8f6d('0xf')](_0x8f6d('0x25'),_0x42b77d,JSON[_0x8f6d('0x21')](_0x705d36));_0x3149bb(_0x705d36);})[_0x8f6d('0x15')](function(_0xd9702e){logger[_0x8f6d('0x11')](_0x8f6d('0x25'),_0xd9702e[_0x8f6d('0x12')],_0x42b77d);_0xe92604(_0x15dae9['error'](0x1f4,_0xd9702e[_0x8f6d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index dcf0aca..9a8682b 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 _0x9c1f=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x15d1ba,_0x7c198c){var _0x3f116d=function(_0x2ef1aa){while(--_0x2ef1aa){_0x15d1ba['push'](_0x15d1ba['shift']());}};_0x3f116d(++_0x7c198c);}(_0x9c1f,0x71));var _0xf9c1=function(_0x965026,_0x34073d){_0x965026=_0x965026-0x0;var _0x43e47a=_0x9c1f[_0x965026];return _0x43e47a;};'use strict';var multer=require(_0xf9c1('0x0'));var util=require(_0xf9c1('0x1'));var path=require('path');var timeout=require(_0xf9c1('0x2'));var express=require(_0xf9c1('0x3'));var router=express[_0xf9c1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf9c1('0x5'));var interaction=require(_0xf9c1('0x6'));var config=require(_0xf9c1('0x7'));var controller=require(_0xf9c1('0x8'));router['get']('/',auth[_0xf9c1('0x9')](),controller['index']);router['get'](_0xf9c1('0xa'),auth['isAuthenticated'](),controller[_0xf9c1('0xb')]);router[_0xf9c1('0xc')]('/',auth[_0xf9c1('0x9')](),controller[_0xf9c1('0xd')]);router[_0xf9c1('0xe')](_0xf9c1('0xa'),auth['isAuthenticated'](),controller[_0xf9c1('0xf')]);router[_0xf9c1('0x10')](_0xf9c1('0xa'),auth[_0xf9c1('0x9')](),controller[_0xf9c1('0x11')]);module[_0xf9c1('0x12')]=router; \ No newline at end of file +var _0xe474=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x50e6f7,_0x3c97fe){var _0x523b56=function(_0x45643b){while(--_0x45643b){_0x50e6f7['push'](_0x50e6f7['shift']());}};_0x523b56(++_0x3c97fe);}(_0xe474,0xb5));var _0x4e47=function(_0x2700eb,_0x2a933f){_0x2700eb=_0x2700eb-0x0;var _0x407bc9=_0xe474[_0x2700eb];return _0x407bc9;};'use strict';var multer=require(_0x4e47('0x0'));var util=require('util');var path=require(_0x4e47('0x1'));var timeout=require(_0x4e47('0x2'));var express=require(_0x4e47('0x3'));var router=express[_0x4e47('0x4')]();var fs_extra=require(_0x4e47('0x5'));var auth=require(_0x4e47('0x6'));var interaction=require(_0x4e47('0x7'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x4e47('0x8')]('/',auth[_0x4e47('0x9')](),controller[_0x4e47('0xa')]);router[_0x4e47('0x8')]('/:id',auth[_0x4e47('0x9')](),controller[_0x4e47('0xb')]);router['post']('/',auth[_0x4e47('0x9')](),controller['create']);router[_0x4e47('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x4e47('0xd')]);router[_0x4e47('0xe')]('/:id',auth[_0x4e47('0x9')](),controller[_0x4e47('0xf')]);module[_0x4e47('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 3126530..16c40f9 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 _0x9436=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0x2ab3c5,_0x35a3ef){var _0x2733aa=function(_0x338802){while(--_0x338802){_0x2ab3c5['push'](_0x2ab3c5['shift']());}};_0x2733aa(++_0x35a3ef);}(_0x9436,0x120));var _0x6943=function(_0x36fd5f,_0x4e3a26){_0x36fd5f=_0x36fd5f-0x0;var _0x591bb0=_0x9436[_0x36fd5f];return _0x591bb0;};'use strict';var Sequelize=require('sequelize');module[_0x6943('0x0')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6943('0x1')],'unique':_0x6943('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x6943('0x1')],'set':function(_0x31b7f9){this[_0x6943('0x3')](_0x6943('0x4'),_0x31b7f9?_0x31b7f9[_0x6943('0x5')](''):[]);},'get':function(){return this[_0x6943('0x6')](_0x6943('0x4'))?this[_0x6943('0x6')]('options')[_0x6943('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6943('0x8')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd98c=['setDataValue','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING','name'];(function(_0xe949b0,_0x49e1cb){var _0xaa809c=function(_0x5f1888){while(--_0x5f1888){_0xe949b0['push'](_0xe949b0['shift']());}};_0xaa809c(++_0x49e1cb);}(_0xd98c,0x7a));var _0xcd98=function(_0x147ee3,_0x55276e){_0x147ee3=_0x147ee3-0x0;var _0x113538=_0xd98c[_0x147ee3];return _0x113538;};'use strict';var Sequelize=require(_0xcd98('0x0'));module[_0xcd98('0x1')]={'name':{'type':Sequelize[_0xcd98('0x2')]},'prefix':{'type':Sequelize[_0xcd98('0x2')],'unique':_0xcd98('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xcd98('0x2')],'set':function(_0x119a1e){this[_0xcd98('0x4')]('options',_0x119a1e?_0x119a1e['join'](''):[]);},'get':function(){return this[_0xcd98('0x5')](_0xcd98('0x6'))?this['getDataValue'](_0xcd98('0x6'))[_0xcd98('0x7')](''):[];}},'auth':{'type':Sequelize[_0xcd98('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0xcd98('0x2')]},'record':{'type':Sequelize[_0xcd98('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xcd98('0x2')]},'description':{'type':Sequelize[_0xcd98('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 78e30bb..a6268e3 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 _0x2948=['name','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','include','rows','catch','params','includeAll','VoiceChanSpy','find','create','body','user','get','role','ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','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','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','update','then','destroy','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','model'];(function(_0x55819b,_0x160d9a){var _0x3854da=function(_0x3a8eb4){while(--_0x3a8eb4){_0x55819b['push'](_0x55819b['shift']());}};_0x3854da(++_0x160d9a);}(_0x2948,0xcb));var _0x8294=function(_0x91a499,_0x1f6be3){_0x91a499=_0x91a499-0x0;var _0x54bc2c=_0x2948[_0x91a499];return _0x54bc2c;};'use strict';var emlformat=require(_0x8294('0x0'));var rimraf=require(_0x8294('0x1'));var zipdir=require(_0x8294('0x2'));var jsonpatch=require(_0x8294('0x3'));var rp=require(_0x8294('0x4'));var moment=require(_0x8294('0x5'));var BPromise=require(_0x8294('0x6'));var Mustache=require(_0x8294('0x7'));var util=require(_0x8294('0x8'));var path=require('path');var sox=require(_0x8294('0x9'));var csv=require('to-csv');var ejs=require(_0x8294('0xa'));var fs=require('fs');var fs_extra=require(_0x8294('0xb'));var _=require(_0x8294('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8294('0xd'));var querystring=require(_0x8294('0xe'));var Papa=require('papaparse');var Redis=require(_0x8294('0xf'));var authService=require(_0x8294('0x10'));var qs=require(_0x8294('0x11'));var as=require(_0x8294('0x12'));var hardwareService=require(_0x8294('0x13'));var logger=require(_0x8294('0x14'))('api');var utils=require(_0x8294('0x15'));var config=require(_0x8294('0x16'));var licenseUtil=require(_0x8294('0x17'));var db=require(_0x8294('0x18'))['db'];function respondWithStatusCode(_0x3a13f4,_0x29f1c6){_0x29f1c6=_0x29f1c6||0xcc;return function(_0x71e347){if(_0x71e347){return _0x3a13f4[_0x8294('0x19')](_0x29f1c6);}return _0x3a13f4['status'](_0x29f1c6)[_0x8294('0x1a')]();};}function respondWithResult(_0xde307c,_0x3041ce){_0x3041ce=_0x3041ce||0xc8;return function(_0x552a87){if(_0x552a87){return _0xde307c['status'](_0x3041ce)['json'](_0x552a87);}};}function respondWithFilteredResult(_0x19295d,_0x1bccf6){return function(_0x25c9ae){if(_0x25c9ae){var _0x2ca14b=typeof _0x1bccf6[_0x8294('0x1b')]===_0x8294('0x1c')&&typeof _0x1bccf6[_0x8294('0x1d')]===_0x8294('0x1c');var _0xf93bde=_0x25c9ae[_0x8294('0x1e')];var _0x3d194a=_0x2ca14b?0x0:_0x1bccf6['offset'];var _0x40175a=_0x2ca14b?_0x25c9ae['count']:_0x1bccf6[_0x8294('0x1b')]+_0x1bccf6[_0x8294('0x1d')];var _0x256be3;if(_0x40175a>=_0xf93bde){_0x40175a=_0xf93bde;_0x256be3=0xc8;}else{_0x256be3=0xce;}_0x19295d[_0x8294('0x1f')](_0x256be3);return _0x19295d[_0x8294('0x20')](_0x8294('0x21'),_0x3d194a+'-'+_0x40175a+'/'+_0xf93bde)[_0x8294('0x22')](_0x25c9ae);}return null;};}function patchUpdates(_0x27273d){return function(_0x318fd3){try{jsonpatch['apply'](_0x318fd3,_0x27273d,!![]);}catch(_0x24ea70){return BPromise[_0x8294('0x23')](_0x24ea70);}return _0x318fd3['save']();};}function saveUpdates(_0x1e5d1e,_0x140666){return function(_0xc0eed4){if(_0xc0eed4){return _0xc0eed4[_0x8294('0x24')](_0x1e5d1e)[_0x8294('0x25')](function(_0x3a36af){return _0x3a36af;});}return null;};}function removeEntity(_0x2b6935,_0xff5d69){return function(_0x3aa9f6){if(_0x3aa9f6){return _0x3aa9f6[_0x8294('0x26')]()[_0x8294('0x25')](function(){var _0x54fbf3=_0x3aa9f6['get']({'plain':!![]});var _0x2d2b6a='ChanSpies';return db[_0x8294('0x27')]['destroy']({'where':{'type':_0x2d2b6a,'resourceId':_0x54fbf3['id']}})['then'](function(){return _0x3aa9f6;});})[_0x8294('0x25')](function(){_0x2b6935[_0x8294('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x373fe7,_0x3d0452){return function(_0x257c75){if(!_0x257c75){_0x373fe7[_0x8294('0x19')](0x194);}return _0x257c75;};}function handleError(_0x58c4d2,_0x4ce49e){_0x4ce49e=_0x4ce49e||0x1f4;return function(_0x311e6b){logger[_0x8294('0x28')](_0x311e6b[_0x8294('0x29')]);if(_0x311e6b['name']){delete _0x311e6b['name'];}_0x58c4d2[_0x8294('0x1f')](_0x4ce49e)[_0x8294('0x2a')](_0x311e6b);};}exports[_0x8294('0x2b')]=function(_0x4925e0,_0x5d0973){var _0x221519={},_0x340b72={},_0x4f9ed9={'count':0x0,'rows':[]};var _0xb2bb87=_[_0x8294('0x2c')](db['VoiceChanSpy'][_0x8294('0x2d')],function(_0x518b56){return{'name':_0x518b56[_0x8294('0x2e')],'type':_0x518b56['type'][_0x8294('0x2f')]};});_0x340b72[_0x8294('0x30')]=_[_0x8294('0x2c')](_0xb2bb87,_0x8294('0x31'));_0x340b72[_0x8294('0x32')]=_[_0x8294('0x33')](_0x4925e0[_0x8294('0x32')]);_0x340b72['filters']=_[_0x8294('0x34')](_0x340b72[_0x8294('0x30')],_0x340b72[_0x8294('0x32')]);_0x221519['attributes']=_[_0x8294('0x34')](_0x340b72[_0x8294('0x30')],qs[_0x8294('0x35')](_0x4925e0['query']['fields']));_0x221519[_0x8294('0x36')]=_0x221519[_0x8294('0x36')][_0x8294('0x37')]?_0x221519[_0x8294('0x36')]:_0x340b72[_0x8294('0x30')];if(!_0x4925e0[_0x8294('0x32')][_0x8294('0x38')](_0x8294('0x39'))){_0x221519[_0x8294('0x1d')]=qs['limit'](_0x4925e0[_0x8294('0x32')][_0x8294('0x1d')]);_0x221519['offset']=qs[_0x8294('0x1b')](_0x4925e0[_0x8294('0x32')][_0x8294('0x1b')]);}_0x221519[_0x8294('0x3a')]=qs['sort'](_0x4925e0[_0x8294('0x32')][_0x8294('0x3b')]);_0x221519[_0x8294('0x3c')]=qs[_0x8294('0x3d')](_[_0x8294('0x3e')](_0x4925e0[_0x8294('0x32')],_0x340b72['filters']),_0xb2bb87);if(_0x4925e0['query'][_0x8294('0x3f')]){_0x221519['where']=_[_0x8294('0x40')](_0x221519[_0x8294('0x3c')],{'$or':_['map'](_0xb2bb87,function(_0xb08c58){if(_0xb08c58[_0x8294('0x41')]!==_0x8294('0x42')){var _0xe800ac={};_0xe800ac[_0xb08c58[_0x8294('0x31')]]={'$like':'%'+_0x4925e0[_0x8294('0x32')][_0x8294('0x3f')]+'%'};return _0xe800ac;}})});}_0x221519=_[_0x8294('0x40')]({},_0x221519,_0x4925e0[_0x8294('0x43')]);var _0x3d162b={'where':_0x221519[_0x8294('0x3c')]};return db['VoiceChanSpy'][_0x8294('0x1e')](_0x3d162b)[_0x8294('0x25')](function(_0x207c9c){_0x4f9ed9['count']=_0x207c9c;if(_0x4925e0[_0x8294('0x32')]['includeAll']){_0x221519[_0x8294('0x44')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x221519);})[_0x8294('0x25')](function(_0x4c63f1){_0x4f9ed9[_0x8294('0x45')]=_0x4c63f1;return _0x4f9ed9;})['then'](respondWithFilteredResult(_0x5d0973,_0x221519))[_0x8294('0x46')](handleError(_0x5d0973,null));};exports['show']=function(_0x1ba573,_0xe58094){var _0x10dc17={'raw':![],'where':{'id':_0x1ba573[_0x8294('0x47')]['id']}},_0x58ef21={};_0x58ef21[_0x8294('0x30')]=_[_0x8294('0x33')](db['VoiceChanSpy'][_0x8294('0x2d')]);_0x58ef21[_0x8294('0x32')]=_['keys'](_0x1ba573[_0x8294('0x32')]);_0x58ef21[_0x8294('0x3d')]=_[_0x8294('0x34')](_0x58ef21[_0x8294('0x30')],_0x58ef21[_0x8294('0x32')]);_0x10dc17[_0x8294('0x36')]=_['intersection'](_0x58ef21[_0x8294('0x30')],qs['fields'](_0x1ba573[_0x8294('0x32')]['fields']));_0x10dc17[_0x8294('0x36')]=_0x10dc17[_0x8294('0x36')]['length']?_0x10dc17['attributes']:_0x58ef21['model'];if(_0x1ba573['query'][_0x8294('0x48')]){_0x10dc17[_0x8294('0x44')]=[{'all':!![]}];}_0x10dc17=_[_0x8294('0x40')]({},_0x10dc17,_0x1ba573['options']);return db[_0x8294('0x49')][_0x8294('0x4a')](_0x10dc17)[_0x8294('0x25')](handleEntityNotFound(_0xe58094,null))['then'](respondWithResult(_0xe58094,null))['catch'](handleError(_0xe58094,null));};exports[_0x8294('0x4b')]=function(_0x3a2101,_0x35285b){return db[_0x8294('0x49')]['create'](_0x3a2101[_0x8294('0x4c')],{})[_0x8294('0x25')](function(_0x25dea3){var _0x396505=_0x3a2101[_0x8294('0x4d')][_0x8294('0x4e')]({'plain':!![]});if(!_0x396505)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x396505[_0x8294('0x4f')]==='user'){var _0x15bbf7=_0x25dea3[_0x8294('0x4e')]({'plain':!![]});var _0x304301=_0x8294('0x50');return db[_0x8294('0x51')]['find']({'where':{'name':_0x304301,'userProfileId':_0x396505[_0x8294('0x52')]},'raw':!![]})[_0x8294('0x25')](function(_0x4e9d80){if(_0x4e9d80&&_0x4e9d80['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x15bbf7['name'],'resourceId':_0x15bbf7['id'],'type':_0x4e9d80[_0x8294('0x31')],'sectionId':_0x4e9d80['id']},{})[_0x8294('0x25')](function(){return _0x25dea3;});}else{return _0x25dea3;}})['catch'](function(_0x1bcdfd){logger['error'](_0x8294('0x53'),_0x1bcdfd);throw _0x1bcdfd;});}return _0x25dea3;})['then'](respondWithResult(_0x35285b,0xc9))['catch'](handleError(_0x35285b,null));};exports[_0x8294('0x24')]=function(_0x36c2f2,_0x255b9a){if(_0x36c2f2[_0x8294('0x4c')]['id']){delete _0x36c2f2['body']['id'];}return db['VoiceChanSpy'][_0x8294('0x4a')]({'where':{'id':_0x36c2f2[_0x8294('0x47')]['id']}})[_0x8294('0x25')](handleEntityNotFound(_0x255b9a,null))['then'](saveUpdates(_0x36c2f2['body'],null))[_0x8294('0x25')](respondWithResult(_0x255b9a,null))[_0x8294('0x46')](handleError(_0x255b9a,null));};exports[_0x8294('0x26')]=function(_0x367850,_0x31c5a1){return db[_0x8294('0x49')][_0x8294('0x4a')]({'where':{'id':_0x367850[_0x8294('0x47')]['id']}})[_0x8294('0x25')](handleEntityNotFound(_0x31c5a1,null))[_0x8294('0x25')](removeEntity(_0x31c5a1,null))[_0x8294('0x46')](handleError(_0x31c5a1,null));}; \ No newline at end of file +var _0x0eec=['Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','json','apply','reject','update','destroy','then','get','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','includeAll','include','findAll','rows','catch','show','params','merge','find','body','user'];(function(_0x467f6e,_0x6faa38){var _0x259ad6=function(_0x2c98b5){while(--_0x2c98b5){_0x467f6e['push'](_0x467f6e['shift']());}};_0x259ad6(++_0x6faa38);}(_0x0eec,0xac));var _0xc0ee=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0eec[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xc0ee('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc0ee('0x1'));var rp=require(_0xc0ee('0x2'));var moment=require(_0xc0ee('0x3'));var BPromise=require(_0xc0ee('0x4'));var Mustache=require(_0xc0ee('0x5'));var util=require(_0xc0ee('0x6'));var path=require(_0xc0ee('0x7'));var sox=require('sox');var csv=require(_0xc0ee('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0ee('0x9'));var _=require(_0xc0ee('0xa'));var squel=require(_0xc0ee('0xb'));var crypto=require(_0xc0ee('0xc'));var jsforce=require(_0xc0ee('0xd'));var deskjs=require(_0xc0ee('0xe'));var toCsv=require(_0xc0ee('0x8'));var querystring=require('querystring');var Papa=require(_0xc0ee('0xf'));var Redis=require(_0xc0ee('0x10'));var authService=require(_0xc0ee('0x11'));var qs=require(_0xc0ee('0x12'));var as=require(_0xc0ee('0x13'));var hardwareService=require(_0xc0ee('0x14'));var logger=require(_0xc0ee('0x15'))('api');var utils=require(_0xc0ee('0x16'));var config=require(_0xc0ee('0x17'));var licenseUtil=require(_0xc0ee('0x18'));var db=require(_0xc0ee('0x19'))['db'];function respondWithStatusCode(_0x22d46b,_0x2d4e3c){_0x2d4e3c=_0x2d4e3c||0xcc;return function(_0x454f5d){if(_0x454f5d){return _0x22d46b[_0xc0ee('0x1a')](_0x2d4e3c);}return _0x22d46b[_0xc0ee('0x1b')](_0x2d4e3c)['end']();};}function respondWithResult(_0x51ae2e,_0x1f3ad9){_0x1f3ad9=_0x1f3ad9||0xc8;return function(_0x325193){if(_0x325193){return _0x51ae2e[_0xc0ee('0x1b')](_0x1f3ad9)['json'](_0x325193);}};}function respondWithFilteredResult(_0x170bf9,_0x30c324){return function(_0x448448){if(_0x448448){var _0x58e1f0=typeof _0x30c324['offset']===_0xc0ee('0x1c')&&typeof _0x30c324['limit']===_0xc0ee('0x1c');var _0x20195b=_0x448448[_0xc0ee('0x1d')];var _0x59aad9=_0x58e1f0?0x0:_0x30c324['offset'];var _0x16d050=_0x58e1f0?_0x448448[_0xc0ee('0x1d')]:_0x30c324[_0xc0ee('0x1e')]+_0x30c324['limit'];var _0x390ee4;if(_0x16d050>=_0x20195b){_0x16d050=_0x20195b;_0x390ee4=0xc8;}else{_0x390ee4=0xce;}_0x170bf9[_0xc0ee('0x1b')](_0x390ee4);return _0x170bf9['set']('Content-Range',_0x59aad9+'-'+_0x16d050+'/'+_0x20195b)[_0xc0ee('0x1f')](_0x448448);}return null;};}function patchUpdates(_0x233333){return function(_0x4dd8c9){try{jsonpatch[_0xc0ee('0x20')](_0x4dd8c9,_0x233333,!![]);}catch(_0x30a00c){return BPromise[_0xc0ee('0x21')](_0x30a00c);}return _0x4dd8c9['save']();};}function saveUpdates(_0x49be2a,_0x5af925){return function(_0x7ec74){if(_0x7ec74){return _0x7ec74[_0xc0ee('0x22')](_0x49be2a)['then'](function(_0x2c3d95){return _0x2c3d95;});}return null;};}function removeEntity(_0x453490,_0x20b657){return function(_0x11b6a4){if(_0x11b6a4){return _0x11b6a4[_0xc0ee('0x23')]()[_0xc0ee('0x24')](function(){var _0x9863d1=_0x11b6a4[_0xc0ee('0x25')]({'plain':!![]});var _0x38abc9=_0xc0ee('0x26');return db[_0xc0ee('0x27')][_0xc0ee('0x23')]({'where':{'type':_0x38abc9,'resourceId':_0x9863d1['id']}})[_0xc0ee('0x24')](function(){return _0x11b6a4;});})[_0xc0ee('0x24')](function(){_0x453490[_0xc0ee('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc984,_0xe2e075){return function(_0x4c1b5c){if(!_0x4c1b5c){_0x1cc984[_0xc0ee('0x1a')](0x194);}return _0x4c1b5c;};}function handleError(_0x4d913c,_0x1c08cb){_0x1c08cb=_0x1c08cb||0x1f4;return function(_0x410fb2){logger[_0xc0ee('0x28')](_0x410fb2[_0xc0ee('0x29')]);if(_0x410fb2[_0xc0ee('0x2a')]){delete _0x410fb2[_0xc0ee('0x2a')];}_0x4d913c[_0xc0ee('0x1b')](_0x1c08cb)[_0xc0ee('0x2b')](_0x410fb2);};}exports[_0xc0ee('0x2c')]=function(_0x5a20d1,_0x394777){var _0x3d4d82={},_0x31ea56={},_0x5cfe16={'count':0x0,'rows':[]};var _0x4a81d8=_['map'](db[_0xc0ee('0x2d')][_0xc0ee('0x2e')],function(_0x252ce9){return{'name':_0x252ce9[_0xc0ee('0x2f')],'type':_0x252ce9[_0xc0ee('0x30')][_0xc0ee('0x31')]};});_0x31ea56[_0xc0ee('0x32')]=_[_0xc0ee('0x33')](_0x4a81d8,_0xc0ee('0x2a'));_0x31ea56[_0xc0ee('0x34')]=_[_0xc0ee('0x35')](_0x5a20d1['query']);_0x31ea56[_0xc0ee('0x36')]=_[_0xc0ee('0x37')](_0x31ea56[_0xc0ee('0x32')],_0x31ea56[_0xc0ee('0x34')]);_0x3d4d82[_0xc0ee('0x38')]=_['intersection'](_0x31ea56[_0xc0ee('0x32')],qs[_0xc0ee('0x39')](_0x5a20d1[_0xc0ee('0x34')]['fields']));_0x3d4d82[_0xc0ee('0x38')]=_0x3d4d82[_0xc0ee('0x38')][_0xc0ee('0x3a')]?_0x3d4d82[_0xc0ee('0x38')]:_0x31ea56['model'];if(!_0x5a20d1[_0xc0ee('0x34')]['hasOwnProperty'](_0xc0ee('0x3b'))){_0x3d4d82[_0xc0ee('0x3c')]=qs[_0xc0ee('0x3c')](_0x5a20d1[_0xc0ee('0x34')][_0xc0ee('0x3c')]);_0x3d4d82[_0xc0ee('0x1e')]=qs[_0xc0ee('0x1e')](_0x5a20d1[_0xc0ee('0x34')][_0xc0ee('0x1e')]);}_0x3d4d82[_0xc0ee('0x3d')]=qs[_0xc0ee('0x3e')](_0x5a20d1['query'][_0xc0ee('0x3e')]);_0x3d4d82[_0xc0ee('0x3f')]=qs[_0xc0ee('0x36')](_[_0xc0ee('0x40')](_0x5a20d1[_0xc0ee('0x34')],_0x31ea56[_0xc0ee('0x36')]),_0x4a81d8);if(_0x5a20d1[_0xc0ee('0x34')][_0xc0ee('0x41')]){_0x3d4d82['where']=_['merge'](_0x3d4d82[_0xc0ee('0x3f')],{'$or':_['map'](_0x4a81d8,function(_0x2eeb84){if(_0x2eeb84[_0xc0ee('0x30')]!=='VIRTUAL'){var _0x2f41dd={};_0x2f41dd[_0x2eeb84['name']]={'$like':'%'+_0x5a20d1[_0xc0ee('0x34')]['filter']+'%'};return _0x2f41dd;}})});}_0x3d4d82=_['merge']({},_0x3d4d82,_0x5a20d1['options']);var _0x33ed38={'where':_0x3d4d82[_0xc0ee('0x3f')]};return db[_0xc0ee('0x2d')][_0xc0ee('0x1d')](_0x33ed38)['then'](function(_0x3c0c7b){_0x5cfe16[_0xc0ee('0x1d')]=_0x3c0c7b;if(_0x5a20d1[_0xc0ee('0x34')][_0xc0ee('0x42')]){_0x3d4d82[_0xc0ee('0x43')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0xc0ee('0x44')](_0x3d4d82);})[_0xc0ee('0x24')](function(_0x5577aa){_0x5cfe16[_0xc0ee('0x45')]=_0x5577aa;return _0x5cfe16;})['then'](respondWithFilteredResult(_0x394777,_0x3d4d82))[_0xc0ee('0x46')](handleError(_0x394777,null));};exports[_0xc0ee('0x47')]=function(_0x517937,_0x98602e){var _0x3a1bd5={'raw':![],'where':{'id':_0x517937[_0xc0ee('0x48')]['id']}},_0x5f2b29={};_0x5f2b29[_0xc0ee('0x32')]=_['keys'](db[_0xc0ee('0x2d')][_0xc0ee('0x2e')]);_0x5f2b29[_0xc0ee('0x34')]=_[_0xc0ee('0x35')](_0x517937[_0xc0ee('0x34')]);_0x5f2b29['filters']=_['intersection'](_0x5f2b29[_0xc0ee('0x32')],_0x5f2b29[_0xc0ee('0x34')]);_0x3a1bd5[_0xc0ee('0x38')]=_[_0xc0ee('0x37')](_0x5f2b29['model'],qs['fields'](_0x517937[_0xc0ee('0x34')][_0xc0ee('0x39')]));_0x3a1bd5[_0xc0ee('0x38')]=_0x3a1bd5['attributes']['length']?_0x3a1bd5[_0xc0ee('0x38')]:_0x5f2b29[_0xc0ee('0x32')];if(_0x517937[_0xc0ee('0x34')]['includeAll']){_0x3a1bd5[_0xc0ee('0x43')]=[{'all':!![]}];}_0x3a1bd5=_[_0xc0ee('0x49')]({},_0x3a1bd5,_0x517937['options']);return db[_0xc0ee('0x2d')][_0xc0ee('0x4a')](_0x3a1bd5)[_0xc0ee('0x24')](handleEntityNotFound(_0x98602e,null))[_0xc0ee('0x24')](respondWithResult(_0x98602e,null))['catch'](handleError(_0x98602e,null));};exports['create']=function(_0x22c742,_0x5ca93b){return db['VoiceChanSpy']['create'](_0x22c742[_0xc0ee('0x4b')],{})['then'](function(_0x16f468){var _0x202f65=_0x22c742[_0xc0ee('0x4c')]['get']({'plain':!![]});if(!_0x202f65)throw new Error(_0xc0ee('0x4d'));if(_0x202f65['role']===_0xc0ee('0x4c')){var _0x4b2fcc=_0x16f468[_0xc0ee('0x25')]({'plain':!![]});var _0x3d48a2=_0xc0ee('0x26');return db[_0xc0ee('0x4e')][_0xc0ee('0x4a')]({'where':{'name':_0x3d48a2,'userProfileId':_0x202f65[_0xc0ee('0x4f')]},'raw':!![]})['then'](function(_0x494fa4){if(_0x494fa4&&_0x494fa4[_0xc0ee('0x50')]===0x0){return db['UserProfileResource'][_0xc0ee('0x51')]({'name':_0x4b2fcc[_0xc0ee('0x2a')],'resourceId':_0x4b2fcc['id'],'type':_0x494fa4[_0xc0ee('0x2a')],'sectionId':_0x494fa4['id']},{})[_0xc0ee('0x24')](function(){return _0x16f468;});}else{return _0x16f468;}})[_0xc0ee('0x46')](function(_0x1915c2){logger[_0xc0ee('0x28')](_0xc0ee('0x52'),_0x1915c2);throw _0x1915c2;});}return _0x16f468;})['then'](respondWithResult(_0x5ca93b,0xc9))[_0xc0ee('0x46')](handleError(_0x5ca93b,null));};exports[_0xc0ee('0x22')]=function(_0x55e1e4,_0x44f7d8){if(_0x55e1e4[_0xc0ee('0x4b')]['id']){delete _0x55e1e4[_0xc0ee('0x4b')]['id'];}return db[_0xc0ee('0x2d')][_0xc0ee('0x4a')]({'where':{'id':_0x55e1e4[_0xc0ee('0x48')]['id']}})['then'](handleEntityNotFound(_0x44f7d8,null))[_0xc0ee('0x24')](saveUpdates(_0x55e1e4[_0xc0ee('0x4b')],null))['then'](respondWithResult(_0x44f7d8,null))['catch'](handleError(_0x44f7d8,null));};exports[_0xc0ee('0x23')]=function(_0x535552,_0x26de4d){return db[_0xc0ee('0x2d')][_0xc0ee('0x4a')]({'where':{'id':_0x535552[_0xc0ee('0x48')]['id']}})[_0xc0ee('0x24')](handleEntityNotFound(_0x26de4d,null))[_0xc0ee('0x24')](removeEntity(_0x26de4d,null))[_0xc0ee('0x46')](handleError(_0x26de4d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 306e6b4..ab00c0d 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 _0x5f6e=['lodash','util','bluebird','context','from-sip','format','prefix','merge','CDR(type)=%s','chanspy','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','push','Authenticate','password','SIP/%s,%s','name','record','StopMixMonitor','length','concat','internal','User','agent','catch','exports','models','define','then','VoiceExtension','bulkCreate','destroy'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x5f6e,0x18c));var _0xe5f6=function(_0x55c1f0,_0x4f574f){_0x55c1f0=_0x55c1f0-0x0;var _0x1530fa=_0x5f6e[_0x55c1f0];return _0x1530fa;};'use strict';var _=require(_0xe5f6('0x0'));var util=require(_0xe5f6('0x1'));var BPromise=require(_0xe5f6('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x16386e,_0x3607e2,_0x34a15e){var _0x1feb9a=0x1;var _0x319ed7=[];var _0x59026d={'context':_0x3607e2[_0xe5f6('0x3')]||_0xe5f6('0x4'),'exten':util[_0xe5f6('0x5')]('%s%s',_0x16386e[_0xe5f6('0x6')],_0x34a15e),'type':'system','isApp':![],'ChanSpyId':_0x16386e['id'],'UserId':_0x3607e2['id']};_0x319ed7['push'](_[_0xe5f6('0x7')]({'app':'Set','appdata':util[_0xe5f6('0x5')](_0xe5f6('0x8'),_0xe5f6('0x9')),'priority':_0x1feb9a++},_0x59026d));if(_0x16386e['record']){_0x319ed7['push'](_[_0xe5f6('0x7')]({'app':_0xe5f6('0xa'),'appdata':util['format'](_0xe5f6('0xb'),_0x16386e[_0xe5f6('0xc')]),'priority':_0x1feb9a++},_0x59026d));}if(_0x16386e['auth']){_0x319ed7[_0xe5f6('0xd')](_[_0xe5f6('0x7')]({'app':_0xe5f6('0xe'),'appdata':_0x16386e[_0xe5f6('0xf')],'priority':_0x1feb9a++},_0x59026d));}_0x319ed7['push'](_[_0xe5f6('0x7')]({'app':'ChanSpy','appdata':util[_0xe5f6('0x5')](_0xe5f6('0x10'),_0x3607e2[_0xe5f6('0x11')],_0x16386e['options']?_0x16386e['options']['join'](''):''),'priority':_0x1feb9a++},_0x59026d));if(_0x16386e[_0xe5f6('0x12')]){_0x319ed7['push'](_[_0xe5f6('0x7')]({'app':_0xe5f6('0x13'),'priority':_0x1feb9a++},_0x59026d));}return _0x319ed7;};var getChanSpyApplications=function(_0x1cb5f4,_0x5e9c47){var _0x59a3ab=[];for(var _0x599aa6=0x0,_0x3e523d=0x1;_0x599aa6<_0x5e9c47[_0xe5f6('0x14')];_0x599aa6++,_0x3e523d=0x1){_0x59a3ab=_0x59a3ab[_0xe5f6('0x15')](getUserApplications(_0x1cb5f4,_0x5e9c47[_0x599aa6],_0x5e9c47[_0x599aa6][_0xe5f6('0x16')]));if(_0x5e9c47[_0x599aa6][_0xe5f6('0x16')]!=_0x5e9c47[_0x599aa6][_0xe5f6('0x11')]){_0x59a3ab=_0x59a3ab[_0xe5f6('0x15')](getUserApplications(_0x1cb5f4,_0x5e9c47[_0x599aa6],_0x5e9c47[_0x599aa6][_0xe5f6('0x11')]));}}return _0x59a3ab;};var getChanSpyPromise=function(_0x595b14,_0x4a5b5f){return new BPromise(function(_0x5e0d3e,_0x5487f1){return _0x595b14[_0xe5f6('0x17')]['findAll']({'attributes':['id',_0xe5f6('0x11'),'internal'],'where':{'role':_0xe5f6('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x510c3d){if(_0x510c3d){return _0x5e0d3e(getChanSpyApplications(_0x4a5b5f,_0x510c3d));}return _0x5e0d3e([]);})[_0xe5f6('0x19')](function(_0x11f9e1){_0x5487f1(_0x11f9e1);});});};module[_0xe5f6('0x1a')]=function(_0x6bc164,_0x523398){var _0x3b44b9=_0x6bc164[_0xe5f6('0x1b')];return _0x6bc164[_0xe5f6('0x1c')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b2b8c,_0x5bd931,_0x2af413){return getChanSpyPromise(_0x3b44b9,_0x4b2b8c)[_0xe5f6('0x1d')](function(_0x16751d){if(_0x16751d&&_0x16751d[_0xe5f6('0x14')]){return _0x3b44b9[_0xe5f6('0x1e')][_0xe5f6('0x1f')](_0x16751d);}})[_0xe5f6('0x1d')](function(){_0x2af413();})['catch'](function(_0xec6c5a){_0x2af413(_0xec6c5a);});},'afterUpdate':function(_0x57f7d7,_0x33bb6d,_0x27faf7){return _0x3b44b9['VoiceExtension'][_0xe5f6('0x20')]({'where':{'ChanSpyId':_0x57f7d7['id']}})[_0xe5f6('0x1d')](function(){return getChanSpyPromise(_0x3b44b9,_0x57f7d7);})[_0xe5f6('0x1d')](function(_0x28949b){if(_0x28949b&&_0x28949b[_0xe5f6('0x14')]){return _0x3b44b9['VoiceExtension'][_0xe5f6('0x1f')](_0x28949b);}})[_0xe5f6('0x1d')](function(){_0x27faf7();})[_0xe5f6('0x19')](function(_0x29a488){_0x27faf7(_0x29a488);});},'afterDestroy':function(_0x33f0e8,_0x26521e,_0x3d0ccd){return _0x3b44b9['VoiceExtension'][_0xe5f6('0x20')]({'where':{'ChanSpyId':_0x33f0e8['id']}})[_0xe5f6('0x1d')](function(){_0x3d0ccd();})[_0xe5f6('0x19')](function(_0x336c76){_0x3d0ccd(_0x336c76);});}}});}; \ No newline at end of file +var _0x8f00=['record','StopMixMonitor','internal','concat','User','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','bulkCreate','destroy','VoiceExtension','lodash','util','./voiceChanSpy.attributes','context','format','system','push','merge','CDR(type)=%s','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','password','ChanSpy','SIP/%s,%s','name','options','join'];(function(_0x5c015a,_0x33ed4a){var _0x49827c=function(_0x3191bc){while(--_0x3191bc){_0x5c015a['push'](_0x5c015a['shift']());}};_0x49827c(++_0x33ed4a);}(_0x8f00,0x76));var _0x08f0=function(_0x4919a7,_0x2da5d2){_0x4919a7=_0x4919a7-0x0;var _0x5a3ca2=_0x8f00[_0x4919a7];return _0x5a3ca2;};'use strict';var _=require(_0x08f0('0x0'));var util=require(_0x08f0('0x1'));var BPromise=require('bluebird');var attributes=require(_0x08f0('0x2'));var getUserApplications=function(_0x20224a,_0x5d084a,_0x2ed3ce){var _0x1849d7=0x1;var _0x25f93b=[];var _0x38d1ff={'context':_0x5d084a[_0x08f0('0x3')]||'from-sip','exten':util[_0x08f0('0x4')]('%s%s',_0x20224a['prefix'],_0x2ed3ce),'type':_0x08f0('0x5'),'isApp':![],'ChanSpyId':_0x20224a['id'],'UserId':_0x5d084a['id']};_0x25f93b[_0x08f0('0x6')](_[_0x08f0('0x7')]({'app':'Set','appdata':util[_0x08f0('0x4')](_0x08f0('0x8'),'chanspy'),'priority':_0x1849d7++},_0x38d1ff));if(_0x20224a['record']){_0x25f93b['push'](_[_0x08f0('0x7')]({'app':_0x08f0('0x9'),'appdata':util['format'](_0x08f0('0xa'),_0x20224a[_0x08f0('0xb')]),'priority':_0x1849d7++},_0x38d1ff));}if(_0x20224a['auth']){_0x25f93b[_0x08f0('0x6')](_[_0x08f0('0x7')]({'app':'Authenticate','appdata':_0x20224a[_0x08f0('0xc')],'priority':_0x1849d7++},_0x38d1ff));}_0x25f93b[_0x08f0('0x6')](_['merge']({'app':_0x08f0('0xd'),'appdata':util[_0x08f0('0x4')](_0x08f0('0xe'),_0x5d084a[_0x08f0('0xf')],_0x20224a[_0x08f0('0x10')]?_0x20224a[_0x08f0('0x10')][_0x08f0('0x11')](''):''),'priority':_0x1849d7++},_0x38d1ff));if(_0x20224a[_0x08f0('0x12')]){_0x25f93b[_0x08f0('0x6')](_[_0x08f0('0x7')]({'app':_0x08f0('0x13'),'priority':_0x1849d7++},_0x38d1ff));}return _0x25f93b;};var getChanSpyApplications=function(_0x229a44,_0x568e4d){var _0x1eafaa=[];for(var _0xc4493c=0x0,_0x4e182b=0x1;_0xc4493c<_0x568e4d['length'];_0xc4493c++,_0x4e182b=0x1){_0x1eafaa=_0x1eafaa['concat'](getUserApplications(_0x229a44,_0x568e4d[_0xc4493c],_0x568e4d[_0xc4493c]['internal']));if(_0x568e4d[_0xc4493c][_0x08f0('0x14')]!=_0x568e4d[_0xc4493c][_0x08f0('0xf')]){_0x1eafaa=_0x1eafaa[_0x08f0('0x15')](getUserApplications(_0x229a44,_0x568e4d[_0xc4493c],_0x568e4d[_0xc4493c][_0x08f0('0xf')]));}}return _0x1eafaa;};var getChanSpyPromise=function(_0x580ce5,_0x4fc569){return new BPromise(function(_0x2ff3cc,_0x178549){return _0x580ce5[_0x08f0('0x16')]['findAll']({'attributes':['id','name',_0x08f0('0x14')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x08f0('0x17')](function(_0x25e357){if(_0x25e357){return _0x2ff3cc(getChanSpyApplications(_0x4fc569,_0x25e357));}return _0x2ff3cc([]);})[_0x08f0('0x18')](function(_0x232920){_0x178549(_0x232920);});});};module[_0x08f0('0x19')]=function(_0x131379,_0x32f647){var _0x510aed=_0x131379[_0x08f0('0x1a')];return _0x131379[_0x08f0('0x1b')](_0x08f0('0x1c'),attributes,{'tableName':_0x08f0('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x482595,_0x3f3eca,_0x39e1c1){return getChanSpyPromise(_0x510aed,_0x482595)[_0x08f0('0x17')](function(_0xf646f2){if(_0xf646f2&&_0xf646f2[_0x08f0('0x1e')]){return _0x510aed['VoiceExtension'][_0x08f0('0x1f')](_0xf646f2);}})[_0x08f0('0x17')](function(){_0x39e1c1();})['catch'](function(_0x2980b1){_0x39e1c1(_0x2980b1);});},'afterUpdate':function(_0x2b8668,_0x1c9cbd,_0x356079){return _0x510aed['VoiceExtension'][_0x08f0('0x20')]({'where':{'ChanSpyId':_0x2b8668['id']}})[_0x08f0('0x17')](function(){return getChanSpyPromise(_0x510aed,_0x2b8668);})[_0x08f0('0x17')](function(_0x11513d){if(_0x11513d&&_0x11513d[_0x08f0('0x1e')]){return _0x510aed[_0x08f0('0x21')][_0x08f0('0x1f')](_0x11513d);}})[_0x08f0('0x17')](function(){_0x356079();})['catch'](function(_0x7a0e9f){_0x356079(_0x7a0e9f);});},'afterDestroy':function(_0x3192f4,_0x2c5b3f,_0x146c82){return _0x510aed[_0x08f0('0x21')]['destroy']({'where':{'ChanSpyId':_0x3192f4['id']}})[_0x08f0('0x17')](function(){_0x146c82();})[_0x08f0('0x18')](function(_0xcdc90){_0x146c82(_0xcdc90);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 2830754..f0befdc 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 _0x593e=['then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1778db,_0x2f7e77){var _0x322c6c=function(_0x121c9c){while(--_0x121c9c){_0x1778db['push'](_0x1778db['shift']());}};_0x322c6c(++_0x2f7e77);}(_0x593e,0xcb));var _0xe593=function(_0x166b4b,_0x491aab){_0x166b4b=_0x166b4b-0x0;var _0x2d4939=_0x593e[_0x166b4b];return _0x2d4939;};'use strict';var _=require(_0xe593('0x0'));var util=require(_0xe593('0x1'));var moment=require(_0xe593('0x2'));var BPromise=require(_0xe593('0x3'));var rs=require(_0xe593('0x4'));var fs=require('fs');var Redis=require(_0xe593('0x5'));var db=require(_0xe593('0x6'))['db'];var utils=require(_0xe593('0x7'));var logger=require('../../config/logger')(_0xe593('0x8'));var config=require(_0xe593('0x9'));var jayson=require(_0xe593('0xa'));var client=jayson[_0xe593('0xb')][_0xe593('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14cff3,_0x1cda29,_0x307dad){return new BPromise(function(_0x169c08,_0x265099){return client['request'](_0x14cff3,_0x307dad)[_0xe593('0xd')](function(_0x4091db){logger[_0xe593('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,'request\x20sent');logger[_0xe593('0xf')](_0xe593('0x10'),_0x1cda29,_0xe593('0x11'),JSON['stringify'](_0x4091db));if(_0x4091db[_0xe593('0x12')]){if(_0x4091db[_0xe593('0x12')][_0xe593('0x13')]===0x1f4){logger[_0xe593('0x12')](_0xe593('0x14'),_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x265099(_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);}logger[_0xe593('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,_0x4091db[_0xe593('0x12')][_0xe593('0x15')]);return _0x169c08(_0x4091db['error'][_0xe593('0x15')]);}else{logger[_0xe593('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,_0xe593('0x11'));_0x169c08(_0x4091db[_0xe593('0x16')][_0xe593('0x15')]);}})[_0xe593('0x17')](function(_0x3408ec){logger[_0xe593('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x1cda29,_0x3408ec);_0x265099(_0x3408ec);});});} \ No newline at end of file +var _0x0db9=['code','message','catch','lodash','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x253403,_0x80390f){var _0x282a47=function(_0x4207eb){while(--_0x4207eb){_0x253403['push'](_0x253403['shift']());}};_0x282a47(++_0x80390f);}(_0x0db9,0xa3));var _0x90db=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0x0db9[_0x4327fe];return _0x138651;};'use strict';var _=require(_0x90db('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x90db('0x1'));var fs=require('fs');var Redis=require(_0x90db('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x90db('0x3'));var logger=require('../../config/logger')(_0x90db('0x4'));var config=require(_0x90db('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x90db('0x6')][_0x90db('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x476491,_0xee21f8,_0x915ca){return new BPromise(function(_0x9b6d0d,_0x4b0c1d){return client[_0x90db('0x8')](_0x476491,_0x915ca)[_0x90db('0x9')](function(_0x39512e){logger[_0x90db('0xa')](_0x90db('0xb'),_0xee21f8,_0x90db('0xc'));logger[_0x90db('0xd')](_0x90db('0xe'),_0xee21f8,_0x90db('0xc'),JSON[_0x90db('0xf')](_0x39512e));if(_0x39512e[_0x90db('0x10')]){if(_0x39512e['error'][_0x90db('0x11')]===0x1f4){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x4b0c1d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);return _0x9b6d0d(_0x39512e[_0x90db('0x10')][_0x90db('0x12')]);}else{logger[_0x90db('0xa')]('VoiceChanSpy,\x20%s,\x20%s',_0xee21f8,_0x90db('0xc'));_0x9b6d0d(_0x39512e['result'][_0x90db('0x12')]);}})[_0x90db('0x13')](function(_0x3de860){logger[_0x90db('0x10')](_0x90db('0xb'),_0xee21f8,_0x3de860);_0x4b0c1d(_0x3de860);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index dc592c2..5e3e30f 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 _0x97a3=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','delete','exports'];(function(_0x4fb993,_0x4fd8ef){var _0x348c09=function(_0x38c9da){while(--_0x38c9da){_0x4fb993['push'](_0x4fb993['shift']());}};_0x348c09(++_0x4fd8ef);}(_0x97a3,0x1c0));var _0x397a=function(_0xf8400e,_0x29699b){_0xf8400e=_0xf8400e-0x0;var _0x22c96b=_0x97a3[_0xf8400e];return _0x22c96b;};'use strict';var multer=require('multer');var util=require(_0x397a('0x0'));var path=require('path');var timeout=require(_0x397a('0x1'));var express=require(_0x397a('0x2'));var router=express[_0x397a('0x3')]();var fs_extra=require(_0x397a('0x4'));var auth=require(_0x397a('0x5'));var interaction=require(_0x397a('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x397a('0x7')]('/',auth[_0x397a('0x8')](),controller[_0x397a('0x9')]);router[_0x397a('0x7')](_0x397a('0xa'),auth['isAuthenticated'](),controller[_0x397a('0xb')]);router[_0x397a('0xc')]('/',auth[_0x397a('0x8')](),controller['create']);router[_0x397a('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x397a('0xe')](_0x397a('0xa'),auth[_0x397a('0x8')](),controller['destroy']);module[_0x397a('0xf')]=router; \ No newline at end of file +var _0x8058=['show','post','put','update','/:id','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get'];(function(_0x5b9837,_0x17e000){var _0x316fe1=function(_0x884bb6){while(--_0x884bb6){_0x5b9837['push'](_0x5b9837['shift']());}};_0x316fe1(++_0x17e000);}(_0x8058,0xb0));var _0x8805=function(_0x4148e0,_0x1e9ceb){_0x4148e0=_0x4148e0-0x0;var _0x26af68=_0x8058[_0x4148e0];return _0x26af68;};'use strict';var multer=require(_0x8805('0x0'));var util=require(_0x8805('0x1'));var path=require(_0x8805('0x2'));var timeout=require(_0x8805('0x3'));var express=require(_0x8805('0x4'));var router=express[_0x8805('0x5')]();var fs_extra=require(_0x8805('0x6'));var auth=require(_0x8805('0x7'));var interaction=require(_0x8805('0x8'));var config=require(_0x8805('0x9'));var controller=require(_0x8805('0xa'));router['get']('/',auth[_0x8805('0xb')](),controller[_0x8805('0xc')]);router[_0x8805('0xd')]('/:id',auth[_0x8805('0xb')](),controller[_0x8805('0xe')]);router[_0x8805('0xf')]('/',auth[_0x8805('0xb')](),controller['create']);router[_0x8805('0x10')]('/:id',auth[_0x8805('0xb')](),controller[_0x8805('0x11')]);router['delete'](_0x8805('0x12'),auth[_0x8805('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 029b515..231e433 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 _0xca10=['name','BOOLEAN','exports','STRING'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xca10,0x76));var _0x0ca1=function(_0x2f5943,_0xba490b){_0x2f5943=_0x2f5943-0x0;var _0x465b7b=_0xca10[_0x2f5943];return _0x465b7b;};'use strict';var Sequelize=require('sequelize');module[_0x0ca1('0x0')]={'name':{'type':Sequelize[_0x0ca1('0x1')],'unique':_0x0ca1('0x2')},'description':{'type':Sequelize[_0x0ca1('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0ca1('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa704=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x3f4bad,_0x40853c){var _0x58da22=function(_0x51308f){while(--_0x51308f){_0x3f4bad['push'](_0x3f4bad['shift']());}};_0x58da22(++_0x40853c);}(_0xa704,0x8c));var _0x4a70=function(_0x38a50e,_0x3abb25){_0x38a50e=_0x38a50e-0x0;var _0x2db726=_0xa704[_0x38a50e];return _0x2db726;};'use strict';var Sequelize=require(_0x4a70('0x0'));module[_0x4a70('0x1')]={'name':{'type':Sequelize[_0x4a70('0x2')],'unique':_0x4a70('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4a70('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 33b8054..fb7e288 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 _0x24f5=['join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb','jayson/promise','client','request','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','sendStatus','end','status','json','offset','undefined','count','apply','reject','update','destroy','then','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','keys','catch','create','body'];(function(_0x37e5b9,_0x5c3323){var _0x1d893d=function(_0xbfdd66){while(--_0xbfdd66){_0x37e5b9['push'](_0x37e5b9['shift']());}};_0x1d893d(++_0x5c3323);}(_0x24f5,0xd0));var _0x524f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x24f5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x524f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x524f('0x1'));var moment=require(_0x524f('0x2'));var BPromise=require(_0x524f('0x3'));var Mustache=require('mustache');var util=require(_0x524f('0x4'));var path=require(_0x524f('0x5'));var sox=require(_0x524f('0x6'));var csv=require(_0x524f('0x7'));var ejs=require(_0x524f('0x8'));var fs=require('fs');var fs_extra=require(_0x524f('0x9'));var _=require('lodash');var squel=require(_0x524f('0xa'));var crypto=require(_0x524f('0xb'));var jsforce=require(_0x524f('0xc'));var deskjs=require(_0x524f('0xd'));var toCsv=require(_0x524f('0x7'));var querystring=require(_0x524f('0xe'));var Papa=require('papaparse');var Redis=require(_0x524f('0xf'));var authService=require(_0x524f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x524f('0x11'));var hardwareService=require(_0x524f('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x524f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x524f('0x14'))['db'];var jayson=require(_0x524f('0x15'));var client=jayson[_0x524f('0x16')]['http']({'port':0x232a});function respondWithRpcPromise(_0x301c19,_0x17cc5b,_0x1dde5a,_0x5b2b0e){return new BPromise(function(_0x3e1b06,_0x4f802c){var _0x3ed155=_0x5b2b0e||client;return _0x3ed155[_0x524f('0x17')](_0x301c19,_0x1dde5a)['then'](function(_0x57588d){logger['info'](_0x524f('0x18'),_0x17cc5b,'request\x20sent');logger[_0x524f('0x19')](_0x524f('0x1a'),_0x17cc5b,_0x524f('0x1b'),JSON[_0x524f('0x1c')](_0x57588d));if(_0x57588d['error']){if(_0x57588d['error']['code']===0x1f4){logger[_0x524f('0x1d')](_0x524f('0x18'),_0x17cc5b,_0x57588d[_0x524f('0x1d')][_0x524f('0x1e')]);return _0x4f802c(_0x57588d[_0x524f('0x1d')][_0x524f('0x1e')]);}logger[_0x524f('0x1d')](_0x524f('0x18'),_0x17cc5b,_0x57588d[_0x524f('0x1d')][_0x524f('0x1e')]);return _0x3e1b06(_0x57588d[_0x524f('0x1d')][_0x524f('0x1e')]);}else{logger[_0x524f('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x17cc5b,_0x524f('0x1b'));_0x3e1b06(_0x57588d['result']['message']);}})['catch'](function(_0x2454cd){logger[_0x524f('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x17cc5b,_0x2454cd);_0x4f802c(_0x2454cd);});});}function respondWithStatusCode(_0x55d034,_0x59056b){_0x59056b=_0x59056b||0xcc;return function(_0x294516){if(_0x294516){return _0x55d034[_0x524f('0x20')](_0x59056b);}return _0x55d034['status'](_0x59056b)[_0x524f('0x21')]();};}function respondWithResult(_0x5cb275,_0x3d25cb){_0x3d25cb=_0x3d25cb||0xc8;return function(_0x13b7fa){if(_0x13b7fa){return _0x5cb275[_0x524f('0x22')](_0x3d25cb)[_0x524f('0x23')](_0x13b7fa);}};}function respondWithFilteredResult(_0x552256,_0x4b11eb){return function(_0x2f992e){if(_0x2f992e){var _0x44f991=typeof _0x4b11eb[_0x524f('0x24')]===_0x524f('0x25')&&typeof _0x4b11eb['limit']===_0x524f('0x25');var _0x5452dd=_0x2f992e[_0x524f('0x26')];var _0x4db313=_0x44f991?0x0:_0x4b11eb[_0x524f('0x24')];var _0xb929bf=_0x44f991?_0x2f992e[_0x524f('0x26')]:_0x4b11eb['offset']+_0x4b11eb['limit'];var _0x5a4fe6;if(_0xb929bf>=_0x5452dd){_0xb929bf=_0x5452dd;_0x5a4fe6=0xc8;}else{_0x5a4fe6=0xce;}_0x552256[_0x524f('0x22')](_0x5a4fe6);return _0x552256['set']('Content-Range',_0x4db313+'-'+_0xb929bf+'/'+_0x5452dd)[_0x524f('0x23')](_0x2f992e);}return null;};}function patchUpdates(_0x7dc615){return function(_0x5aaed3){try{jsonpatch[_0x524f('0x27')](_0x5aaed3,_0x7dc615,!![]);}catch(_0x8b209a){return BPromise[_0x524f('0x28')](_0x8b209a);}return _0x5aaed3['save']();};}function saveUpdates(_0x51b174,_0x58aa2f){return function(_0x47be2c){if(_0x47be2c){return _0x47be2c[_0x524f('0x29')](_0x51b174)['then'](function(_0x370372){return _0x370372;});}return null;};}function removeEntity(_0x4215bf,_0x58cc17){return function(_0x42d585){if(_0x42d585){return _0x42d585[_0x524f('0x2a')]()[_0x524f('0x2b')](function(){var _0x124819=_0x42d585['get']({'plain':!![]});var _0x270b7f=_0x524f('0x2c');return db['UserProfileResource'][_0x524f('0x2a')]({'where':{'type':_0x270b7f,'resourceId':_0x124819['id']}})[_0x524f('0x2b')](function(){return _0x42d585;});})[_0x524f('0x2b')](function(){_0x4215bf[_0x524f('0x22')](0xcc)[_0x524f('0x21')]();});}};}function handleEntityNotFound(_0x4b5340,_0x41e697){return function(_0x3a39c9){if(!_0x3a39c9){_0x4b5340[_0x524f('0x20')](0x194);}return _0x3a39c9;};}function handleError(_0x57d536,_0x5b3ba0){_0x5b3ba0=_0x5b3ba0||0x1f4;return function(_0x2f431e){logger[_0x524f('0x1d')](_0x2f431e[_0x524f('0x2d')]);if(_0x2f431e[_0x524f('0x2e')]){delete _0x2f431e[_0x524f('0x2e')];}_0x57d536[_0x524f('0x22')](_0x5b3ba0)[_0x524f('0x2f')](_0x2f431e);};}exports[_0x524f('0x30')]=function(_0x3a9096,_0x2d1c77){var _0x5097b0={},_0x4caf62={},_0x19fd64={'count':0x0,'rows':[]};var _0x4a2e31=_[_0x524f('0x31')](db[_0x524f('0x32')][_0x524f('0x33')],function(_0x1dc2cd){return{'name':_0x1dc2cd[_0x524f('0x34')],'type':_0x1dc2cd[_0x524f('0x35')][_0x524f('0x36')]};});_0x4caf62[_0x524f('0x37')]=_[_0x524f('0x31')](_0x4a2e31,_0x524f('0x2e'));_0x4caf62['query']=_['keys'](_0x3a9096[_0x524f('0x38')]);_0x4caf62[_0x524f('0x39')]=_[_0x524f('0x3a')](_0x4caf62[_0x524f('0x37')],_0x4caf62[_0x524f('0x38')]);_0x5097b0['attributes']=_[_0x524f('0x3a')](_0x4caf62[_0x524f('0x37')],qs[_0x524f('0x3b')](_0x3a9096[_0x524f('0x38')]['fields']));_0x5097b0[_0x524f('0x3c')]=_0x5097b0['attributes'][_0x524f('0x3d')]?_0x5097b0[_0x524f('0x3c')]:_0x4caf62[_0x524f('0x37')];if(!_0x3a9096[_0x524f('0x38')][_0x524f('0x3e')](_0x524f('0x3f'))){_0x5097b0[_0x524f('0x40')]=qs['limit'](_0x3a9096[_0x524f('0x38')]['limit']);_0x5097b0['offset']=qs['offset'](_0x3a9096[_0x524f('0x38')]['offset']);}_0x5097b0['order']=qs[_0x524f('0x41')](_0x3a9096[_0x524f('0x38')]['sort']);_0x5097b0['where']=qs['filters'](_[_0x524f('0x42')](_0x3a9096[_0x524f('0x38')],_0x4caf62[_0x524f('0x39')]),_0x4a2e31);if(_0x3a9096[_0x524f('0x38')]['filter']){_0x5097b0[_0x524f('0x43')]=_[_0x524f('0x44')](_0x5097b0['where'],{'$or':_[_0x524f('0x31')](_0x4a2e31,function(_0x389026){if(_0x389026[_0x524f('0x35')]!==_0x524f('0x45')){var _0x1674b2={};_0x1674b2[_0x389026['name']]={'$like':'%'+_0x3a9096['query'][_0x524f('0x46')]+'%'};return _0x1674b2;}})});}_0x5097b0=_['merge']({},_0x5097b0,_0x3a9096['options']);var _0x27b95f={'where':_0x5097b0[_0x524f('0x43')]};return db['VoiceContext']['count'](_0x27b95f)['then'](function(_0x1fd643){_0x19fd64[_0x524f('0x26')]=_0x1fd643;if(_0x3a9096['query'][_0x524f('0x47')]){_0x5097b0[_0x524f('0x48')]=[{'all':!![]}];}return db[_0x524f('0x32')][_0x524f('0x49')](_0x5097b0);})['then'](function(_0x537b05){_0x19fd64[_0x524f('0x4a')]=_0x537b05;return _0x19fd64;})[_0x524f('0x2b')](respondWithFilteredResult(_0x2d1c77,_0x5097b0))['catch'](handleError(_0x2d1c77,null));};exports['show']=function(_0x353d6b,_0xbc0e84){var _0x46ef59={'raw':![],'where':{'id':_0x353d6b[_0x524f('0x4b')]['id']}},_0x517ff5={};_0x517ff5[_0x524f('0x37')]=_[_0x524f('0x4c')](db[_0x524f('0x32')][_0x524f('0x33')]);_0x517ff5[_0x524f('0x38')]=_[_0x524f('0x4c')](_0x353d6b[_0x524f('0x38')]);_0x517ff5['filters']=_[_0x524f('0x3a')](_0x517ff5[_0x524f('0x37')],_0x517ff5['query']);_0x46ef59[_0x524f('0x3c')]=_[_0x524f('0x3a')](_0x517ff5[_0x524f('0x37')],qs['fields'](_0x353d6b[_0x524f('0x38')]['fields']));_0x46ef59[_0x524f('0x3c')]=_0x46ef59[_0x524f('0x3c')]['length']?_0x46ef59[_0x524f('0x3c')]:_0x517ff5[_0x524f('0x37')];if(_0x353d6b[_0x524f('0x38')][_0x524f('0x47')]){_0x46ef59[_0x524f('0x48')]=[{'all':!![]}];}_0x46ef59=_[_0x524f('0x44')]({},_0x46ef59,_0x353d6b['options']);return db[_0x524f('0x32')]['find'](_0x46ef59)[_0x524f('0x2b')](handleEntityNotFound(_0xbc0e84,null))['then'](respondWithResult(_0xbc0e84,null))[_0x524f('0x4d')](handleError(_0xbc0e84,null));};exports[_0x524f('0x4e')]=function(_0x323ab0,_0x4cb855,_0x5aff02){var _0x2058fb;return db[_0x524f('0x32')]['create'](_0x323ab0[_0x524f('0x4f')],{'raw':!![]})[_0x524f('0x2b')](function(_0xd3c739){_0x2058fb=_0xd3c739;return db[_0x524f('0x32')][_0x524f('0x49')]({'raw':!![]});})[_0x524f('0x2b')](function(_0x4ac503){var _0xe9b15f=fs['readFileSync'](path[_0x524f('0x50')](config[_0x524f('0x51')],_0x524f('0x52')),_0x524f('0x53'));var _0x31468c=ejs[_0x524f('0x54')](_0xe9b15f,{'contexts':_0x4ac503||[]});fs[_0x524f('0x55')](_0x524f('0x56'),_0x31468c);})[_0x524f('0x2b')](function(){return respondWithRpcPromise(_0x524f('0x57'),_0x524f('0x4e'),{'module':_0x524f('0x58')});})[_0x524f('0x2b')](function(){var _0x5e68c4=_0x323ab0[_0x524f('0x59')][_0x524f('0x5a')]({'plain':!![]});if(!_0x5e68c4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e68c4[_0x524f('0x5b')]===_0x524f('0x59')){var _0x52356e=_0x2058fb[_0x524f('0x5a')]({'plain':!![]});return db['UserProfileSection'][_0x524f('0x5c')]({'where':{'name':_0x524f('0x2c'),'userProfileId':_0x5e68c4[_0x524f('0x5d')]},'raw':!![]})['then'](function(_0x31d623){if(_0x31d623&&_0x31d623['autoAssociation']===0x0){return db['UserProfileResource'][_0x524f('0x4e')]({'name':_0x52356e[_0x524f('0x2e')],'resourceId':_0x52356e['id'],'type':_0x31d623[_0x524f('0x2e')],'sectionId':_0x31d623['id']},{})[_0x524f('0x2b')](function(){return _0x2058fb;});}else{return _0x2058fb;}})['catch'](function(_0x5d623b){logger[_0x524f('0x1d')](_0x524f('0x5e'),_0x5d623b);throw _0x5d623b;});}return _0x2058fb;})['then'](respondWithResult(_0x4cb855,0xc9))[_0x524f('0x4d')](handleError(_0x4cb855,null));};exports[_0x524f('0x29')]=function(_0x4da745,_0x25aee9,_0x44e799){var _0x4aa31d;return db[_0x524f('0x32')][_0x524f('0x5c')]({'where':{'id':_0x4da745[_0x524f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x25aee9,null))['then'](saveUpdates(_0x4da745[_0x524f('0x4f')],null))[_0x524f('0x2b')](function(_0x2e95f5){if(_0x2e95f5){_0x4aa31d=_0x2e95f5;return db['VoiceContext'][_0x524f('0x49')]({'raw':!![]});}})[_0x524f('0x2b')](function(_0x9ba393){var _0x4600c4=fs[_0x524f('0x5f')](path[_0x524f('0x50')](config[_0x524f('0x51')],_0x524f('0x52')),_0x524f('0x53'));var _0x3f387f=ejs[_0x524f('0x54')](_0x4600c4,{'contexts':_0x9ba393||[]});fs[_0x524f('0x55')](_0x524f('0x56'),_0x3f387f);})[_0x524f('0x2b')](function(){return respondWithRpcPromise(_0x524f('0x57'),_0x524f('0x29'),{'module':_0x524f('0x58')});})[_0x524f('0x2b')](function(){return _0x4aa31d;})[_0x524f('0x2b')](respondWithResult(_0x25aee9,null))[_0x524f('0x4d')](handleError(_0x25aee9,null));};exports[_0x524f('0x2a')]=function(_0x58fb90,_0x1a1f3e,_0x264264){var _0x58fae2;return db[_0x524f('0x32')][_0x524f('0x5c')]({'where':{'id':_0x58fb90[_0x524f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1a1f3e,null))[_0x524f('0x2b')](removeEntity(_0x1a1f3e,null))[_0x524f('0x2b')](function(){return db[_0x524f('0x32')][_0x524f('0x49')]({'raw':!![]});})[_0x524f('0x2b')](function(_0x55d712){var _0x5f2fcb=fs[_0x524f('0x5f')](path[_0x524f('0x50')](config['root'],_0x524f('0x52')),_0x524f('0x53'));var _0x359e7a=ejs['render'](_0x5f2fcb,{'contexts':_0x55d712});fs[_0x524f('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x359e7a);return respondWithRpcPromise(_0x524f('0x57'),_0x524f('0x2a'),{'module':'chan_sip.so'});})[_0x524f('0x4d')](handleError(_0x1a1f3e,null));}; \ No newline at end of file +var _0x5234=['index','map','VoiceContext','rawAttributes','fieldName','key','intersection','model','query','attributes','fields','length','order','where','filters','type','VIRTUAL','filter','merge','options','includeAll','include','rows','show','keys','find','create','body','findAll','readFileSync','root','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','params','join','server/files/templates/context.ejs','update','destroy','chan_sip.so','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','undefined','count','offset','limit','status','set','apply','reject','save','get','Contexts','UserProfileResource','stack','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5234,0x92));var _0x4523=function(_0xcd635,_0x404a90){_0xcd635=_0xcd635-0x0;var _0x4401ca=_0x5234[_0xcd635];return _0x4401ca;};'use strict';var emlformat=require(_0x4523('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4523('0x1'));var jsonpatch=require(_0x4523('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4523('0x3'));var Mustache=require(_0x4523('0x4'));var util=require(_0x4523('0x5'));var path=require('path');var sox=require(_0x4523('0x6'));var csv=require(_0x4523('0x7'));var ejs=require(_0x4523('0x8'));var fs=require('fs');var fs_extra=require(_0x4523('0x9'));var _=require(_0x4523('0xa'));var squel=require('squel');var crypto=require(_0x4523('0xb'));var jsforce=require(_0x4523('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4523('0x7'));var querystring=require(_0x4523('0xd'));var Papa=require(_0x4523('0xe'));var Redis=require('ioredis');var authService=require(_0x4523('0xf'));var qs=require(_0x4523('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4523('0x11'));var utils=require(_0x4523('0x12'));var config=require(_0x4523('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4523('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e8108,_0x4bd0f7,_0x2a6f30,_0x3a8da3){return new BPromise(function(_0x119ff8,_0xc820be){var _0x30750a=_0x3a8da3||client;return _0x30750a[_0x4523('0x15')](_0x4e8108,_0x2a6f30)[_0x4523('0x16')](function(_0x1416c4){logger[_0x4523('0x17')](_0x4523('0x18'),_0x4bd0f7,_0x4523('0x19'));logger[_0x4523('0x1a')](_0x4523('0x1b'),_0x4bd0f7,_0x4523('0x19'),JSON[_0x4523('0x1c')](_0x1416c4));if(_0x1416c4[_0x4523('0x1d')]){if(_0x1416c4[_0x4523('0x1d')][_0x4523('0x1e')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x4bd0f7,_0x1416c4[_0x4523('0x1d')][_0x4523('0x1f')]);return _0xc820be(_0x1416c4[_0x4523('0x1d')]['message']);}logger[_0x4523('0x1d')](_0x4523('0x18'),_0x4bd0f7,_0x1416c4[_0x4523('0x1d')][_0x4523('0x1f')]);return _0x119ff8(_0x1416c4[_0x4523('0x1d')][_0x4523('0x1f')]);}else{logger[_0x4523('0x17')](_0x4523('0x18'),_0x4bd0f7,_0x4523('0x19'));_0x119ff8(_0x1416c4[_0x4523('0x20')][_0x4523('0x1f')]);}})[_0x4523('0x21')](function(_0x238da6){logger[_0x4523('0x1d')](_0x4523('0x18'),_0x4bd0f7,_0x238da6);_0xc820be(_0x238da6);});});}function respondWithStatusCode(_0x223cb0,_0x5c2ecb){_0x5c2ecb=_0x5c2ecb||0xcc;return function(_0x295432){if(_0x295432){return _0x223cb0[_0x4523('0x22')](_0x5c2ecb);}return _0x223cb0['status'](_0x5c2ecb)[_0x4523('0x23')]();};}function respondWithResult(_0x1af9ab,_0x42075b){_0x42075b=_0x42075b||0xc8;return function(_0x4653bc){if(_0x4653bc){return _0x1af9ab['status'](_0x42075b)[_0x4523('0x24')](_0x4653bc);}};}function respondWithFilteredResult(_0x301e,_0x41677e){return function(_0x5902e9){if(_0x5902e9){var _0x2e6f61=typeof _0x41677e['offset']===_0x4523('0x25')&&typeof _0x41677e['limit']==='undefined';var _0x28f826=_0x5902e9[_0x4523('0x26')];var _0x4d7101=_0x2e6f61?0x0:_0x41677e[_0x4523('0x27')];var _0x26a45d=_0x2e6f61?_0x5902e9['count']:_0x41677e[_0x4523('0x27')]+_0x41677e[_0x4523('0x28')];var _0x5a2267;if(_0x26a45d>=_0x28f826){_0x26a45d=_0x28f826;_0x5a2267=0xc8;}else{_0x5a2267=0xce;}_0x301e[_0x4523('0x29')](_0x5a2267);return _0x301e[_0x4523('0x2a')]('Content-Range',_0x4d7101+'-'+_0x26a45d+'/'+_0x28f826)[_0x4523('0x24')](_0x5902e9);}return null;};}function patchUpdates(_0x5bd8f4){return function(_0x4689b4){try{jsonpatch[_0x4523('0x2b')](_0x4689b4,_0x5bd8f4,!![]);}catch(_0x51bc05){return BPromise[_0x4523('0x2c')](_0x51bc05);}return _0x4689b4[_0x4523('0x2d')]();};}function saveUpdates(_0x39956b,_0x5a77bd){return function(_0x4dba5c){if(_0x4dba5c){return _0x4dba5c['update'](_0x39956b)[_0x4523('0x16')](function(_0x32433e){return _0x32433e;});}return null;};}function removeEntity(_0x11a998,_0x41f7db){return function(_0x14c1ed){if(_0x14c1ed){return _0x14c1ed['destroy']()[_0x4523('0x16')](function(){var _0x46fbd7=_0x14c1ed[_0x4523('0x2e')]({'plain':!![]});var _0x51c967=_0x4523('0x2f');return db[_0x4523('0x30')]['destroy']({'where':{'type':_0x51c967,'resourceId':_0x46fbd7['id']}})[_0x4523('0x16')](function(){return _0x14c1ed;});})[_0x4523('0x16')](function(){_0x11a998[_0x4523('0x29')](0xcc)[_0x4523('0x23')]();});}};}function handleEntityNotFound(_0x274add,_0x556d11){return function(_0x55b9ac){if(!_0x55b9ac){_0x274add[_0x4523('0x22')](0x194);}return _0x55b9ac;};}function handleError(_0x5696d3,_0x2caab8){_0x2caab8=_0x2caab8||0x1f4;return function(_0x4fee71){logger['error'](_0x4fee71[_0x4523('0x31')]);if(_0x4fee71[_0x4523('0x32')]){delete _0x4fee71[_0x4523('0x32')];}_0x5696d3[_0x4523('0x29')](_0x2caab8)[_0x4523('0x33')](_0x4fee71);};}exports[_0x4523('0x34')]=function(_0xd50b18,_0x3b957a){var _0xde2706={},_0x2f2690={},_0x3fa73d={'count':0x0,'rows':[]};var _0x193d65=_[_0x4523('0x35')](db[_0x4523('0x36')][_0x4523('0x37')],function(_0x5a09fe){return{'name':_0x5a09fe[_0x4523('0x38')],'type':_0x5a09fe['type'][_0x4523('0x39')]};});_0x2f2690['model']=_['map'](_0x193d65,'name');_0x2f2690['query']=_['keys'](_0xd50b18['query']);_0x2f2690['filters']=_[_0x4523('0x3a')](_0x2f2690[_0x4523('0x3b')],_0x2f2690[_0x4523('0x3c')]);_0xde2706[_0x4523('0x3d')]=_['intersection'](_0x2f2690[_0x4523('0x3b')],qs[_0x4523('0x3e')](_0xd50b18[_0x4523('0x3c')][_0x4523('0x3e')]));_0xde2706[_0x4523('0x3d')]=_0xde2706['attributes'][_0x4523('0x3f')]?_0xde2706[_0x4523('0x3d')]:_0x2f2690[_0x4523('0x3b')];if(!_0xd50b18[_0x4523('0x3c')]['hasOwnProperty']('nolimit')){_0xde2706[_0x4523('0x28')]=qs[_0x4523('0x28')](_0xd50b18[_0x4523('0x3c')][_0x4523('0x28')]);_0xde2706[_0x4523('0x27')]=qs[_0x4523('0x27')](_0xd50b18['query'][_0x4523('0x27')]);}_0xde2706[_0x4523('0x40')]=qs['sort'](_0xd50b18[_0x4523('0x3c')]['sort']);_0xde2706[_0x4523('0x41')]=qs[_0x4523('0x42')](_['pick'](_0xd50b18['query'],_0x2f2690[_0x4523('0x42')]),_0x193d65);if(_0xd50b18[_0x4523('0x3c')]['filter']){_0xde2706['where']=_['merge'](_0xde2706['where'],{'$or':_[_0x4523('0x35')](_0x193d65,function(_0x122f9a){if(_0x122f9a[_0x4523('0x43')]!==_0x4523('0x44')){var _0x30770b={};_0x30770b[_0x122f9a[_0x4523('0x32')]]={'$like':'%'+_0xd50b18[_0x4523('0x3c')][_0x4523('0x45')]+'%'};return _0x30770b;}})});}_0xde2706=_[_0x4523('0x46')]({},_0xde2706,_0xd50b18[_0x4523('0x47')]);var _0x23e486={'where':_0xde2706['where']};return db['VoiceContext'][_0x4523('0x26')](_0x23e486)[_0x4523('0x16')](function(_0x552ce6){_0x3fa73d['count']=_0x552ce6;if(_0xd50b18[_0x4523('0x3c')][_0x4523('0x48')]){_0xde2706[_0x4523('0x49')]=[{'all':!![]}];}return db[_0x4523('0x36')]['findAll'](_0xde2706);})[_0x4523('0x16')](function(_0x5f01e9){_0x3fa73d[_0x4523('0x4a')]=_0x5f01e9;return _0x3fa73d;})[_0x4523('0x16')](respondWithFilteredResult(_0x3b957a,_0xde2706))[_0x4523('0x21')](handleError(_0x3b957a,null));};exports[_0x4523('0x4b')]=function(_0x700451,_0x5e7194){var _0x4f1c8f={'raw':![],'where':{'id':_0x700451['params']['id']}},_0x495313={};_0x495313[_0x4523('0x3b')]=_['keys'](db[_0x4523('0x36')]['rawAttributes']);_0x495313[_0x4523('0x3c')]=_[_0x4523('0x4c')](_0x700451[_0x4523('0x3c')]);_0x495313[_0x4523('0x42')]=_['intersection'](_0x495313[_0x4523('0x3b')],_0x495313['query']);_0x4f1c8f['attributes']=_[_0x4523('0x3a')](_0x495313[_0x4523('0x3b')],qs[_0x4523('0x3e')](_0x700451[_0x4523('0x3c')][_0x4523('0x3e')]));_0x4f1c8f[_0x4523('0x3d')]=_0x4f1c8f[_0x4523('0x3d')][_0x4523('0x3f')]?_0x4f1c8f['attributes']:_0x495313[_0x4523('0x3b')];if(_0x700451[_0x4523('0x3c')]['includeAll']){_0x4f1c8f[_0x4523('0x49')]=[{'all':!![]}];}_0x4f1c8f=_[_0x4523('0x46')]({},_0x4f1c8f,_0x700451[_0x4523('0x47')]);return db['VoiceContext'][_0x4523('0x4d')](_0x4f1c8f)[_0x4523('0x16')](handleEntityNotFound(_0x5e7194,null))[_0x4523('0x16')](respondWithResult(_0x5e7194,null))[_0x4523('0x21')](handleError(_0x5e7194,null));};exports[_0x4523('0x4e')]=function(_0x58fe42,_0x28e18e,_0x1171ba){var _0x27ea6;return db[_0x4523('0x36')][_0x4523('0x4e')](_0x58fe42[_0x4523('0x4f')],{'raw':!![]})[_0x4523('0x16')](function(_0x540f0d){_0x27ea6=_0x540f0d;return db[_0x4523('0x36')][_0x4523('0x50')]({'raw':!![]});})[_0x4523('0x16')](function(_0x2a5e14){var _0x325367=fs[_0x4523('0x51')](path['join'](config[_0x4523('0x52')],'server/files/templates/context.ejs'),_0x4523('0x53'));var _0x23a2ad=ejs[_0x4523('0x54')](_0x325367,{'contexts':_0x2a5e14||[]});fs[_0x4523('0x55')](_0x4523('0x56'),_0x23a2ad);})['then'](function(){return respondWithRpcPromise(_0x4523('0x57'),'create',{'module':'chan_sip.so'});})[_0x4523('0x16')](function(){var _0xbc3ef3=_0x58fe42[_0x4523('0x58')]['get']({'plain':!![]});if(!_0xbc3ef3)throw new Error(_0x4523('0x59'));if(_0xbc3ef3['role']==='user'){var _0xe08dba=_0x27ea6['get']({'plain':!![]});return db[_0x4523('0x5a')][_0x4523('0x4d')]({'where':{'name':_0x4523('0x2f'),'userProfileId':_0xbc3ef3[_0x4523('0x5b')]},'raw':!![]})['then'](function(_0x364009){if(_0x364009&&_0x364009[_0x4523('0x5c')]===0x0){return db[_0x4523('0x30')][_0x4523('0x4e')]({'name':_0xe08dba[_0x4523('0x32')],'resourceId':_0xe08dba['id'],'type':_0x364009['name'],'sectionId':_0x364009['id']},{})['then'](function(){return _0x27ea6;});}else{return _0x27ea6;}})[_0x4523('0x21')](function(_0x109fcb){logger[_0x4523('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x109fcb);throw _0x109fcb;});}return _0x27ea6;})[_0x4523('0x16')](respondWithResult(_0x28e18e,0xc9))[_0x4523('0x21')](handleError(_0x28e18e,null));};exports['update']=function(_0x470de4,_0x552e06,_0x54d632){var _0x46ccf7;return db[_0x4523('0x36')][_0x4523('0x4d')]({'where':{'id':_0x470de4[_0x4523('0x5d')]['id']}})['then'](handleEntityNotFound(_0x552e06,null))[_0x4523('0x16')](saveUpdates(_0x470de4[_0x4523('0x4f')],null))[_0x4523('0x16')](function(_0x50fa37){if(_0x50fa37){_0x46ccf7=_0x50fa37;return db[_0x4523('0x36')][_0x4523('0x50')]({'raw':!![]});}})[_0x4523('0x16')](function(_0x42d29c){var _0x247504=fs[_0x4523('0x51')](path[_0x4523('0x5e')](config[_0x4523('0x52')],_0x4523('0x5f')),_0x4523('0x53'));var _0x2bbe10=ejs['render'](_0x247504,{'contexts':_0x42d29c||[]});fs[_0x4523('0x55')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2bbe10);})[_0x4523('0x16')](function(){return respondWithRpcPromise('Reload',_0x4523('0x60'),{'module':'chan_sip.so'});})[_0x4523('0x16')](function(){return _0x46ccf7;})[_0x4523('0x16')](respondWithResult(_0x552e06,null))[_0x4523('0x21')](handleError(_0x552e06,null));};exports[_0x4523('0x61')]=function(_0x905429,_0x5e25a8,_0x18060e){var _0x210b8b;return db[_0x4523('0x36')][_0x4523('0x4d')]({'where':{'id':_0x905429[_0x4523('0x5d')]['id']}})[_0x4523('0x16')](handleEntityNotFound(_0x5e25a8,null))[_0x4523('0x16')](removeEntity(_0x5e25a8,null))['then'](function(){return db[_0x4523('0x36')][_0x4523('0x50')]({'raw':!![]});})[_0x4523('0x16')](function(_0x3810e6){var _0x28365d=fs['readFileSync'](path[_0x4523('0x5e')](config[_0x4523('0x52')],_0x4523('0x5f')),'utf8');var _0x84e69=ejs[_0x4523('0x54')](_0x28365d,{'contexts':_0x3810e6});fs[_0x4523('0x55')](_0x4523('0x56'),_0x84e69);return respondWithRpcPromise('Reload',_0x4523('0x61'),{'module':_0x4523('0x62')});})[_0x4523('0x21')](handleError(_0x5e25a8,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 283b056..14b8916 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 _0x3e82=['exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes'];(function(_0x28177a,_0x37ca97){var _0x11f6bc=function(_0x42715d){while(--_0x42715d){_0x28177a['push'](_0x28177a['shift']());}};_0x11f6bc(++_0x37ca97);}(_0x3e82,0x18a));var _0x23e8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3e82[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x23e8('0x0'));var util=require(_0x23e8('0x1'));var logger=require(_0x23e8('0x2'))(_0x23e8('0x3'));var moment=require(_0x23e8('0x4'));var BPromise=require(_0x23e8('0x5'));var rp=require(_0x23e8('0x6'));var fs=require('fs');var path=require(_0x23e8('0x7'));var rimraf=require(_0x23e8('0x8'));var config=require(_0x23e8('0x9'));var attributes=require(_0x23e8('0xa'));module[_0x23e8('0xb')]=function(_0x2da65f,_0x5742ac){return _0x2da65f[_0x23e8('0xc')](_0x23e8('0xd'),attributes,{'tableName':_0x23e8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7e6=['request-promise','rimraf','VoiceContext','lodash','util','../../config/logger','api'];(function(_0x15dc6d,_0x4c87a0){var _0x1b39b6=function(_0x4be7ae){while(--_0x4be7ae){_0x15dc6d['push'](_0x15dc6d['shift']());}};_0x1b39b6(++_0x4c87a0);}(_0xe7e6,0x6c));var _0x6e7e=function(_0x4f5186,_0x83d725){_0x4f5186=_0x4f5186-0x0;var _0x111ad9=_0xe7e6[_0x4f5186];return _0x111ad9;};'use strict';var _=require(_0x6e7e('0x0'));var util=require(_0x6e7e('0x1'));var logger=require(_0x6e7e('0x2'))(_0x6e7e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6e7e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6e7e('0x5'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x40aed8,_0x1e38fa){return _0x40aed8['define'](_0x6e7e('0x6'),attributes,{'tableName':'voice_contexts','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 d7ae78d..844909d 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 _0xd732=['message','result','lodash','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x7f4de8,_0x3da2a4){var _0x1f2914=function(_0x35ee7f){while(--_0x35ee7f){_0x7f4de8['push'](_0x7f4de8['shift']());}};_0x1f2914(++_0x3da2a4);}(_0xd732,0x18e));var _0x2d73=function(_0x490f63,_0x64d98c){_0x490f63=_0x490f63-0x0;var _0x139bdf=_0xd732[_0x490f63];return _0x139bdf;};'use strict';var _=require(_0x2d73('0x0'));var util=require('util');var moment=require(_0x2d73('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d73('0x2'));var db=require(_0x2d73('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2d73('0x4'));var config=require('../../config/environment');var jayson=require(_0x2d73('0x5'));var client=jayson[_0x2d73('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5be94f,_0x44c742,_0x541112){return new BPromise(function(_0x26be01,_0x301b50){return client[_0x2d73('0x7')](_0x5be94f,_0x541112)[_0x2d73('0x8')](function(_0x56f52d){logger[_0x2d73('0x9')](_0x2d73('0xa'),_0x44c742,_0x2d73('0xb'));logger[_0x2d73('0xc')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x44c742,_0x2d73('0xb'),JSON[_0x2d73('0xd')](_0x56f52d));if(_0x56f52d[_0x2d73('0xe')]){if(_0x56f52d[_0x2d73('0xe')][_0x2d73('0xf')]===0x1f4){logger[_0x2d73('0xe')](_0x2d73('0xa'),_0x44c742,_0x56f52d[_0x2d73('0xe')][_0x2d73('0x10')]);return _0x301b50(_0x56f52d[_0x2d73('0xe')][_0x2d73('0x10')]);}logger[_0x2d73('0xe')]('VoiceContext,\x20%s,\x20%s',_0x44c742,_0x56f52d[_0x2d73('0xe')]['message']);return _0x26be01(_0x56f52d[_0x2d73('0xe')]['message']);}else{logger[_0x2d73('0x9')](_0x2d73('0xa'),_0x44c742,_0x2d73('0xb'));_0x26be01(_0x56f52d[_0x2d73('0x11')][_0x2d73('0x10')]);}})['catch'](function(_0x57721e){logger['error'](_0x2d73('0xa'),_0x44c742,_0x57721e);_0x301b50(_0x57721e);});});} \ No newline at end of file +var _0x8ae9=['../../mysqldb','../../config/utils','../../config/environment','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','lodash','util','ioredis'];(function(_0x497797,_0x5690d0){var _0x4b3b5c=function(_0x37adad){while(--_0x37adad){_0x497797['push'](_0x497797['shift']());}};_0x4b3b5c(++_0x5690d0);}(_0x8ae9,0x179));var _0x98ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8ae9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x98ae('0x0'));var util=require(_0x98ae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98ae('0x2'));var db=require(_0x98ae('0x3'))['db'];var utils=require(_0x98ae('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x98ae('0x5'));var jayson=require(_0x98ae('0x6'));var client=jayson[_0x98ae('0x7')][_0x98ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x58301b,_0xebc6ca,_0x303580){return new BPromise(function(_0x4477e,_0x1ffea2){return client['request'](_0x58301b,_0x303580)[_0x98ae('0x9')](function(_0x1c4d97){logger[_0x98ae('0xa')](_0x98ae('0xb'),_0xebc6ca,_0x98ae('0xc'));logger[_0x98ae('0xd')](_0x98ae('0xe'),_0xebc6ca,_0x98ae('0xc'),JSON[_0x98ae('0xf')](_0x1c4d97));if(_0x1c4d97['error']){if(_0x1c4d97[_0x98ae('0x10')][_0x98ae('0x11')]===0x1f4){logger['error'](_0x98ae('0xb'),_0xebc6ca,_0x1c4d97[_0x98ae('0x10')][_0x98ae('0x12')]);return _0x1ffea2(_0x1c4d97[_0x98ae('0x10')]['message']);}logger[_0x98ae('0x10')](_0x98ae('0xb'),_0xebc6ca,_0x1c4d97['error'][_0x98ae('0x12')]);return _0x4477e(_0x1c4d97[_0x98ae('0x10')][_0x98ae('0x12')]);}else{logger['info'](_0x98ae('0xb'),_0xebc6ca,'request\x20sent');_0x4477e(_0x1c4d97[_0x98ae('0x13')]['message']);}})['catch'](function(_0x2b2cf6){logger[_0x98ae('0x10')](_0x98ae('0xb'),_0xebc6ca,_0x2b2cf6);_0x1ffea2(_0x2b2cf6);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 8eecce6..286aa96 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 _0x0ce2=['connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','exports','multer','path'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x0ce2,0xfd));var _0x20ce=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0ce2[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x20ce('0x0'));var util=require('util');var path=require(_0x20ce('0x1'));var timeout=require(_0x20ce('0x2'));var express=require(_0x20ce('0x3'));var router=express[_0x20ce('0x4')]();var fs_extra=require(_0x20ce('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x20ce('0x6'));var controller=require('./voiceDialReport.controller');router[_0x20ce('0x7')]('/',auth[_0x20ce('0x8')](),controller['index']);router['get'](_0x20ce('0x9'),auth[_0x20ce('0x8')](),controller[_0x20ce('0xa')]);router['get'](_0x20ce('0xb'),auth[_0x20ce('0x8')](),controller[_0x20ce('0xc')]);router[_0x20ce('0xd')]('/',auth['isAuthenticated'](),controller[_0x20ce('0xe')]);router['put'](_0x20ce('0xb'),auth[_0x20ce('0x8')](),controller['update']);router[_0x20ce('0xf')]('/:id',auth[_0x20ce('0x8')](),controller['destroy']);module[_0x20ce('0x10')]=router; \ No newline at end of file +var _0xaa3f=['show','create','update','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','get','/describe','/:id'];(function(_0x170a28,_0x50e357){var _0x3a7b37=function(_0x8ecd50){while(--_0x8ecd50){_0x170a28['push'](_0x170a28['shift']());}};_0x3a7b37(++_0x50e357);}(_0xaa3f,0x95));var _0xfaa3=function(_0x41393c,_0x415a8f){_0x41393c=_0x41393c-0x0;var _0x37d12a=_0xaa3f[_0x41393c];return _0x37d12a;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require('path');var timeout=require(_0xfaa3('0x2'));var express=require(_0xfaa3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfaa3('0x4'));var interaction=require(_0xfaa3('0x5'));var config=require('../../config/environment');var controller=require(_0xfaa3('0x6'));router['get']('/',auth[_0xfaa3('0x7')](),controller['index']);router[_0xfaa3('0x8')](_0xfaa3('0x9'),auth[_0xfaa3('0x7')](),controller['describe']);router['get'](_0xfaa3('0xa'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xb')]);router['post']('/',auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xc')]);router['put'](_0xfaa3('0xa'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xd')]);router['delete'](_0xfaa3('0xa'),auth[_0xfaa3('0x7')](),controller[_0xfaa3('0xe')]);module[_0xfaa3('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 036a568..317b272 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 _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x51b1a5,_0x285a4f){var _0x15c738=function(_0x5c94d7){while(--_0x5c94d7){_0x51b1a5['push'](_0x51b1a5['shift']());}};_0x15c738(++_0x285a4f);}(_0xb821,0xa7));var _0x1b82=function(_0x311578,_0x192a07){_0x311578=_0x311578-0x0;var _0x4dc6cc=_0xb821[_0x311578];return _0x4dc6cc;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6f0d=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x117f35,_0x4be38b){var _0xaeeba3=function(_0x3b762e){while(--_0x3b762e){_0x117f35['push'](_0x117f35['shift']());}};_0xaeeba3(++_0x4be38b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1d278c,_0x3fcee1){_0x1d278c=_0x1d278c-0x0;var _0x35964b=_0x6f0d[_0x1d278c];return _0x35964b;};'use strict';var Sequelize=require('sequelize');module[_0xd6f0('0x0')]={'privilege':{'type':Sequelize[_0xd6f0('0x1')]},'channel':{'type':Sequelize[_0xd6f0('0x1')]},'channelstate':{'type':Sequelize[_0xd6f0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'calleridname':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'connectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'language':{'type':Sequelize[_0xd6f0('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd6f0('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xd6f0('0x2')]},'uniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'linkedid':{'type':Sequelize[_0xd6f0('0x1')]},'destchannel':{'type':Sequelize[_0xd6f0('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xd6f0('0x1')]},'destcalleridname':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xd6f0('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd6f0('0x1')]},'destlanguage':{'type':Sequelize[_0xd6f0('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xd6f0('0x1')]},'destexten':{'type':Sequelize[_0xd6f0('0x1')]},'destpriority':{'type':Sequelize[_0xd6f0('0x2')]},'destuniqueid':{'type':Sequelize[_0xd6f0('0x1')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0xd6f0('0x1')]},'dialstatus':{'type':Sequelize[_0xd6f0('0x1')]},'starttime':{'type':Sequelize[_0xd6f0('0x3')]},'answertime':{'type':Sequelize[_0xd6f0('0x3')]},'endtime':{'type':Sequelize[_0xd6f0('0x3')]},'lastevent':{'type':Sequelize[_0xd6f0('0x1')],'comment':_0xd6f0('0x4')},'routeId':{'type':Sequelize[_0xd6f0('0x2')]},'duration':{'type':Sequelize[_0xd6f0('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xd6f0('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 3bfed10..0c8aaf5 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 _0x18ab=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','reject','save','update','then','destroy','stack','name','send','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','catch','create','body','describe','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service'];(function(_0xbdf8cf,_0x9bce69){var _0x1300d1=function(_0x2e917f){while(--_0x2e917f){_0xbdf8cf['push'](_0xbdf8cf['shift']());}};_0x1300d1(++_0x9bce69);}(_0x18ab,0x171));var _0xb18a=function(_0x4d9bfe,_0x4e6bd4){_0x4d9bfe=_0x4d9bfe-0x0;var _0x2f3ec6=_0x18ab[_0x4d9bfe];return _0x2f3ec6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb18a('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb18a('0x1'));var BPromise=require(_0xb18a('0x2'));var Mustache=require(_0xb18a('0x3'));var util=require(_0xb18a('0x4'));var path=require(_0xb18a('0x5'));var sox=require(_0xb18a('0x6'));var csv=require(_0xb18a('0x7'));var ejs=require(_0xb18a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb18a('0x9'));var squel=require(_0xb18a('0xa'));var crypto=require(_0xb18a('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb18a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb18a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb18a('0xe'));var authService=require(_0xb18a('0xf'));var qs=require(_0xb18a('0x10'));var as=require(_0xb18a('0x11'));var hardwareService=require(_0xb18a('0x12'));var logger=require(_0xb18a('0x13'))(_0xb18a('0x14'));var utils=require(_0xb18a('0x15'));var config=require(_0xb18a('0x16'));var licenseUtil=require(_0xb18a('0x17'));var db=require(_0xb18a('0x18'))['db'];function respondWithStatusCode(_0x5a99ae,_0x3d55fd){_0x3d55fd=_0x3d55fd||0xcc;return function(_0x47fec0){if(_0x47fec0){return _0x5a99ae[_0xb18a('0x19')](_0x3d55fd);}return _0x5a99ae['status'](_0x3d55fd)[_0xb18a('0x1a')]();};}function respondWithResult(_0x3c0638,_0x55359e){_0x55359e=_0x55359e||0xc8;return function(_0x4f1b10){if(_0x4f1b10){return _0x3c0638['status'](_0x55359e)[_0xb18a('0x1b')](_0x4f1b10);}};}function respondWithFilteredResult(_0x389061,_0x2b5653){return function(_0x4b0864){if(_0x4b0864){var _0x1f1210=typeof _0x2b5653[_0xb18a('0x1c')]===_0xb18a('0x1d')&&typeof _0x2b5653['limit']===_0xb18a('0x1d');var _0x4dc57e=_0x4b0864[_0xb18a('0x1e')];var _0x1ea84b=_0x1f1210?0x0:_0x2b5653[_0xb18a('0x1c')];var _0x37dcc5=_0x1f1210?_0x4b0864['count']:_0x2b5653[_0xb18a('0x1c')]+_0x2b5653[_0xb18a('0x1f')];var _0x434049;if(_0x37dcc5>=_0x4dc57e){_0x37dcc5=_0x4dc57e;_0x434049=0xc8;}else{_0x434049=0xce;}_0x389061[_0xb18a('0x20')](_0x434049);return _0x389061[_0xb18a('0x21')](_0xb18a('0x22'),_0x1ea84b+'-'+_0x37dcc5+'/'+_0x4dc57e)[_0xb18a('0x1b')](_0x4b0864);}return null;};}function patchUpdates(_0x2b64ce){return function(_0x5b0957){try{jsonpatch['apply'](_0x5b0957,_0x2b64ce,!![]);}catch(_0x3e19ee){return BPromise[_0xb18a('0x23')](_0x3e19ee);}return _0x5b0957[_0xb18a('0x24')]();};}function saveUpdates(_0x231a9d,_0x21dea6){return function(_0x1a316d){if(_0x1a316d){return _0x1a316d[_0xb18a('0x25')](_0x231a9d)[_0xb18a('0x26')](function(_0x436334){return _0x436334;});}return null;};}function removeEntity(_0x2029c9,_0x14e623){return function(_0x3b7e4e){if(_0x3b7e4e){return _0x3b7e4e[_0xb18a('0x27')]()[_0xb18a('0x26')](function(){_0x2029c9[_0xb18a('0x20')](0xcc)[_0xb18a('0x1a')]();});}};}function handleEntityNotFound(_0x6142fa,_0x3cb9d0){return function(_0x39f633){if(!_0x39f633){_0x6142fa[_0xb18a('0x19')](0x194);}return _0x39f633;};}function handleError(_0x326261,_0x6f3820){_0x6f3820=_0x6f3820||0x1f4;return function(_0x6e17fc){logger['error'](_0x6e17fc[_0xb18a('0x28')]);if(_0x6e17fc['name']){delete _0x6e17fc[_0xb18a('0x29')];}_0x326261['status'](_0x6f3820)[_0xb18a('0x2a')](_0x6e17fc);};}exports['index']=function(_0x5672c0,_0x55f790){var _0x267881={},_0x2cb8c0={},_0x45a1e9={'count':0x0,'rows':[]};var _0x135d42=_[_0xb18a('0x2b')](db[_0xb18a('0x2c')][_0xb18a('0x2d')],function(_0x1b7396){return{'name':_0x1b7396[_0xb18a('0x2e')],'type':_0x1b7396[_0xb18a('0x2f')][_0xb18a('0x30')]};});_0x2cb8c0[_0xb18a('0x31')]=_[_0xb18a('0x2b')](_0x135d42,_0xb18a('0x29'));_0x2cb8c0[_0xb18a('0x32')]=_[_0xb18a('0x33')](_0x5672c0[_0xb18a('0x32')]);_0x2cb8c0[_0xb18a('0x34')]=_[_0xb18a('0x35')](_0x2cb8c0[_0xb18a('0x31')],_0x2cb8c0[_0xb18a('0x32')]);_0x267881['attributes']=_[_0xb18a('0x35')](_0x2cb8c0[_0xb18a('0x31')],qs['fields'](_0x5672c0[_0xb18a('0x32')][_0xb18a('0x36')]));_0x267881[_0xb18a('0x37')]=_0x267881[_0xb18a('0x37')][_0xb18a('0x38')]?_0x267881['attributes']:_0x2cb8c0[_0xb18a('0x31')];if(!_0x5672c0[_0xb18a('0x32')][_0xb18a('0x39')](_0xb18a('0x3a'))){_0x267881[_0xb18a('0x1f')]=qs[_0xb18a('0x1f')](_0x5672c0[_0xb18a('0x32')][_0xb18a('0x1f')]);_0x267881['offset']=qs[_0xb18a('0x1c')](_0x5672c0[_0xb18a('0x32')][_0xb18a('0x1c')]);}_0x267881[_0xb18a('0x3b')]=qs['sort'](_0x5672c0[_0xb18a('0x32')][_0xb18a('0x3c')]);_0x267881[_0xb18a('0x3d')]=qs[_0xb18a('0x34')](_[_0xb18a('0x3e')](_0x5672c0[_0xb18a('0x32')],_0x2cb8c0['filters']),_0x135d42);if(_0x5672c0[_0xb18a('0x32')][_0xb18a('0x3f')]){_0x267881['where']=_[_0xb18a('0x40')](_0x267881['where'],{'$or':_['map'](_0x135d42,function(_0x327f1f){if(_0x327f1f[_0xb18a('0x2f')]!==_0xb18a('0x41')){var _0x2cf4d3={};_0x2cf4d3[_0x327f1f[_0xb18a('0x29')]]={'$like':'%'+_0x5672c0[_0xb18a('0x32')][_0xb18a('0x3f')]+'%'};return _0x2cf4d3;}})});}_0x267881=_[_0xb18a('0x40')]({},_0x267881,_0x5672c0['options']);var _0x3ac0c3={'where':_0x267881[_0xb18a('0x3d')]};return db['VoiceDialReport'][_0xb18a('0x1e')](_0x3ac0c3)[_0xb18a('0x26')](function(_0x1277d4){_0x45a1e9['count']=_0x1277d4;if(_0x5672c0[_0xb18a('0x32')][_0xb18a('0x42')]){_0x267881[_0xb18a('0x43')]=[{'all':!![]}];}return db[_0xb18a('0x2c')][_0xb18a('0x44')](_0x267881);})[_0xb18a('0x26')](function(_0x3390b5){_0x45a1e9[_0xb18a('0x45')]=_0x3390b5;return _0x45a1e9;})[_0xb18a('0x26')](respondWithFilteredResult(_0x55f790,_0x267881))['catch'](handleError(_0x55f790,null));};exports['show']=function(_0x168a3f,_0x32afaa){var _0x54b718={'raw':!![],'where':{'id':_0x168a3f[_0xb18a('0x46')]['id']}},_0x4dbbdc={};_0x4dbbdc[_0xb18a('0x31')]=_[_0xb18a('0x33')](db['VoiceDialReport'][_0xb18a('0x2d')]);_0x4dbbdc[_0xb18a('0x32')]=_[_0xb18a('0x33')](_0x168a3f[_0xb18a('0x32')]);_0x4dbbdc[_0xb18a('0x34')]=_[_0xb18a('0x35')](_0x4dbbdc[_0xb18a('0x31')],_0x4dbbdc['query']);_0x54b718[_0xb18a('0x37')]=_[_0xb18a('0x35')](_0x4dbbdc[_0xb18a('0x31')],qs[_0xb18a('0x36')](_0x168a3f[_0xb18a('0x32')][_0xb18a('0x36')]));_0x54b718['attributes']=_0x54b718[_0xb18a('0x37')][_0xb18a('0x38')]?_0x54b718[_0xb18a('0x37')]:_0x4dbbdc['model'];if(_0x168a3f['query'][_0xb18a('0x42')]){_0x54b718['include']=[{'all':!![]}];}_0x54b718=_[_0xb18a('0x40')]({},_0x54b718,_0x168a3f[_0xb18a('0x47')]);return db['VoiceDialReport'][_0xb18a('0x48')](_0x54b718)['then'](handleEntityNotFound(_0x32afaa,null))[_0xb18a('0x26')](respondWithResult(_0x32afaa,null))[_0xb18a('0x49')](handleError(_0x32afaa,null));};exports[_0xb18a('0x4a')]=function(_0x45154e,_0x1aa6b2){return db[_0xb18a('0x2c')][_0xb18a('0x4a')](_0x45154e['body'],{})['then'](respondWithResult(_0x1aa6b2,0xc9))['catch'](handleError(_0x1aa6b2,null));};exports[_0xb18a('0x25')]=function(_0x45972f,_0x11cc42){if(_0x45972f[_0xb18a('0x4b')]['id']){delete _0x45972f[_0xb18a('0x4b')]['id'];}return db[_0xb18a('0x2c')][_0xb18a('0x48')]({'where':{'id':_0x45972f['params']['id']}})[_0xb18a('0x26')](handleEntityNotFound(_0x11cc42,null))['then'](saveUpdates(_0x45972f[_0xb18a('0x4b')],null))['then'](respondWithResult(_0x11cc42,null))[_0xb18a('0x49')](handleError(_0x11cc42,null));};exports[_0xb18a('0x27')]=function(_0x2a729d,_0x5df634){return db[_0xb18a('0x2c')][_0xb18a('0x48')]({'where':{'id':_0x2a729d['params']['id']}})[_0xb18a('0x26')](handleEntityNotFound(_0x5df634,null))['then'](removeEntity(_0x5df634,null))['catch'](handleError(_0x5df634,null));};exports[_0xb18a('0x4c')]=function(_0x3cd19e,_0x179366){return db['VoiceDialReport']['describe']()[_0xb18a('0x26')](respondWithResult(_0x179366,null))[_0xb18a('0x49')](handleError(_0x179366,null));}; \ No newline at end of file +var _0x6155=['attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','Content-Range','reject','save','then','destroy','end','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','model','map','keys','filters','intersection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6155,0x1f3));var _0x5615=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x6155[_0x17406a];return _0x1501ff;};'use strict';var emlformat=require(_0x5615('0x0'));var rimraf=require(_0x5615('0x1'));var zipdir=require(_0x5615('0x2'));var jsonpatch=require(_0x5615('0x3'));var rp=require(_0x5615('0x4'));var moment=require(_0x5615('0x5'));var BPromise=require(_0x5615('0x6'));var Mustache=require(_0x5615('0x7'));var util=require(_0x5615('0x8'));var path=require('path');var sox=require(_0x5615('0x9'));var csv=require(_0x5615('0xa'));var ejs=require(_0x5615('0xb'));var fs=require('fs');var fs_extra=require(_0x5615('0xc'));var _=require(_0x5615('0xd'));var squel=require(_0x5615('0xe'));var crypto=require(_0x5615('0xf'));var jsforce=require(_0x5615('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x5615('0xa'));var querystring=require(_0x5615('0x11'));var Papa=require(_0x5615('0x12'));var Redis=require(_0x5615('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5615('0x14'));var as=require(_0x5615('0x15'));var hardwareService=require(_0x5615('0x16'));var logger=require(_0x5615('0x17'))('api');var utils=require(_0x5615('0x18'));var config=require(_0x5615('0x19'));var licenseUtil=require(_0x5615('0x1a'));var db=require(_0x5615('0x1b'))['db'];function respondWithStatusCode(_0x2cb1e6,_0x1254ca){_0x1254ca=_0x1254ca||0xcc;return function(_0x49ab3e){if(_0x49ab3e){return _0x2cb1e6[_0x5615('0x1c')](_0x1254ca);}return _0x2cb1e6[_0x5615('0x1d')](_0x1254ca)['end']();};}function respondWithResult(_0x20a80a,_0x4387a9){_0x4387a9=_0x4387a9||0xc8;return function(_0x29ad2e){if(_0x29ad2e){return _0x20a80a['status'](_0x4387a9)[_0x5615('0x1e')](_0x29ad2e);}};}function respondWithFilteredResult(_0x55bbe7,_0x54fac6){return function(_0xd16c8a){if(_0xd16c8a){var _0x5886fa=typeof _0x54fac6['offset']===_0x5615('0x1f')&&typeof _0x54fac6['limit']===_0x5615('0x1f');var _0x15c5e9=_0xd16c8a[_0x5615('0x20')];var _0x38f9d1=_0x5886fa?0x0:_0x54fac6[_0x5615('0x21')];var _0x59c0dd=_0x5886fa?_0xd16c8a[_0x5615('0x20')]:_0x54fac6[_0x5615('0x21')]+_0x54fac6[_0x5615('0x22')];var _0x723f41;if(_0x59c0dd>=_0x15c5e9){_0x59c0dd=_0x15c5e9;_0x723f41=0xc8;}else{_0x723f41=0xce;}_0x55bbe7[_0x5615('0x1d')](_0x723f41);return _0x55bbe7['set'](_0x5615('0x23'),_0x38f9d1+'-'+_0x59c0dd+'/'+_0x15c5e9)[_0x5615('0x1e')](_0xd16c8a);}return null;};}function patchUpdates(_0x4bc24d){return function(_0x33910b){try{jsonpatch['apply'](_0x33910b,_0x4bc24d,!![]);}catch(_0x409bde){return BPromise[_0x5615('0x24')](_0x409bde);}return _0x33910b[_0x5615('0x25')]();};}function saveUpdates(_0x155174,_0x229d4a){return function(_0x504a6d){if(_0x504a6d){return _0x504a6d['update'](_0x155174)[_0x5615('0x26')](function(_0x171c0a){return _0x171c0a;});}return null;};}function removeEntity(_0x5c7927,_0x55eef3){return function(_0x1416b9){if(_0x1416b9){return _0x1416b9[_0x5615('0x27')]()['then'](function(){_0x5c7927[_0x5615('0x1d')](0xcc)[_0x5615('0x28')]();});}};}function handleEntityNotFound(_0x75e39d,_0x363b65){return function(_0x99fc99){if(!_0x99fc99){_0x75e39d[_0x5615('0x1c')](0x194);}return _0x99fc99;};}function handleError(_0x84c2fe,_0x32f31e){_0x32f31e=_0x32f31e||0x1f4;return function(_0x1f75f9){logger['error'](_0x1f75f9[_0x5615('0x29')]);if(_0x1f75f9[_0x5615('0x2a')]){delete _0x1f75f9[_0x5615('0x2a')];}_0x84c2fe[_0x5615('0x1d')](_0x32f31e)[_0x5615('0x2b')](_0x1f75f9);};}exports[_0x5615('0x2c')]=function(_0x409401,_0x4ed131){var _0x35e245={},_0x5110bf={},_0x711a68={'count':0x0,'rows':[]};var _0x4d36b7=_['map'](db[_0x5615('0x2d')][_0x5615('0x2e')],function(_0x465312){return{'name':_0x465312[_0x5615('0x2f')],'type':_0x465312['type'][_0x5615('0x30')]};});_0x5110bf[_0x5615('0x31')]=_[_0x5615('0x32')](_0x4d36b7,_0x5615('0x2a'));_0x5110bf['query']=_[_0x5615('0x33')](_0x409401['query']);_0x5110bf[_0x5615('0x34')]=_[_0x5615('0x35')](_0x5110bf[_0x5615('0x31')],_0x5110bf['query']);_0x35e245[_0x5615('0x36')]=_[_0x5615('0x35')](_0x5110bf['model'],qs[_0x5615('0x37')](_0x409401['query'][_0x5615('0x37')]));_0x35e245[_0x5615('0x36')]=_0x35e245[_0x5615('0x36')][_0x5615('0x38')]?_0x35e245[_0x5615('0x36')]:_0x5110bf[_0x5615('0x31')];if(!_0x409401[_0x5615('0x39')][_0x5615('0x3a')](_0x5615('0x3b'))){_0x35e245['limit']=qs[_0x5615('0x22')](_0x409401[_0x5615('0x39')][_0x5615('0x22')]);_0x35e245[_0x5615('0x21')]=qs[_0x5615('0x21')](_0x409401[_0x5615('0x39')][_0x5615('0x21')]);}_0x35e245[_0x5615('0x3c')]=qs['sort'](_0x409401[_0x5615('0x39')][_0x5615('0x3d')]);_0x35e245[_0x5615('0x3e')]=qs['filters'](_[_0x5615('0x3f')](_0x409401[_0x5615('0x39')],_0x5110bf[_0x5615('0x34')]),_0x4d36b7);if(_0x409401[_0x5615('0x39')][_0x5615('0x40')]){_0x35e245['where']=_['merge'](_0x35e245[_0x5615('0x3e')],{'$or':_[_0x5615('0x32')](_0x4d36b7,function(_0x498e17){if(_0x498e17[_0x5615('0x41')]!=='VIRTUAL'){var _0x4fdc77={};_0x4fdc77[_0x498e17[_0x5615('0x2a')]]={'$like':'%'+_0x409401[_0x5615('0x39')][_0x5615('0x40')]+'%'};return _0x4fdc77;}})});}_0x35e245=_[_0x5615('0x42')]({},_0x35e245,_0x409401[_0x5615('0x43')]);var _0x225050={'where':_0x35e245[_0x5615('0x3e')]};return db[_0x5615('0x2d')][_0x5615('0x20')](_0x225050)[_0x5615('0x26')](function(_0x2ea247){_0x711a68['count']=_0x2ea247;if(_0x409401[_0x5615('0x39')][_0x5615('0x44')]){_0x35e245[_0x5615('0x45')]=[{'all':!![]}];}return db[_0x5615('0x2d')][_0x5615('0x46')](_0x35e245);})[_0x5615('0x26')](function(_0x5d057b){_0x711a68[_0x5615('0x47')]=_0x5d057b;return _0x711a68;})['then'](respondWithFilteredResult(_0x4ed131,_0x35e245))['catch'](handleError(_0x4ed131,null));};exports[_0x5615('0x48')]=function(_0x102455,_0x205486){var _0x903560={'raw':!![],'where':{'id':_0x102455[_0x5615('0x49')]['id']}},_0x12e224={};_0x12e224[_0x5615('0x31')]=_[_0x5615('0x33')](db['VoiceDialReport'][_0x5615('0x2e')]);_0x12e224['query']=_[_0x5615('0x33')](_0x102455[_0x5615('0x39')]);_0x12e224[_0x5615('0x34')]=_[_0x5615('0x35')](_0x12e224['model'],_0x12e224[_0x5615('0x39')]);_0x903560[_0x5615('0x36')]=_[_0x5615('0x35')](_0x12e224[_0x5615('0x31')],qs[_0x5615('0x37')](_0x102455[_0x5615('0x39')][_0x5615('0x37')]));_0x903560[_0x5615('0x36')]=_0x903560[_0x5615('0x36')][_0x5615('0x38')]?_0x903560[_0x5615('0x36')]:_0x12e224[_0x5615('0x31')];if(_0x102455[_0x5615('0x39')][_0x5615('0x44')]){_0x903560[_0x5615('0x45')]=[{'all':!![]}];}_0x903560=_[_0x5615('0x42')]({},_0x903560,_0x102455[_0x5615('0x43')]);return db[_0x5615('0x2d')]['find'](_0x903560)[_0x5615('0x26')](handleEntityNotFound(_0x205486,null))['then'](respondWithResult(_0x205486,null))[_0x5615('0x4a')](handleError(_0x205486,null));};exports['create']=function(_0x29d189,_0x32d02e){return db[_0x5615('0x2d')][_0x5615('0x4b')](_0x29d189['body'],{})[_0x5615('0x26')](respondWithResult(_0x32d02e,0xc9))['catch'](handleError(_0x32d02e,null));};exports['update']=function(_0x20b263,_0x55269a){if(_0x20b263[_0x5615('0x4c')]['id']){delete _0x20b263['body']['id'];}return db['VoiceDialReport'][_0x5615('0x4d')]({'where':{'id':_0x20b263['params']['id']}})[_0x5615('0x26')](handleEntityNotFound(_0x55269a,null))[_0x5615('0x26')](saveUpdates(_0x20b263[_0x5615('0x4c')],null))[_0x5615('0x26')](respondWithResult(_0x55269a,null))[_0x5615('0x4a')](handleError(_0x55269a,null));};exports[_0x5615('0x27')]=function(_0x322167,_0xf3032c){return db[_0x5615('0x2d')]['find']({'where':{'id':_0x322167[_0x5615('0x49')]['id']}})['then'](handleEntityNotFound(_0xf3032c,null))['then'](removeEntity(_0xf3032c,null))[_0x5615('0x4a')](handleError(_0xf3032c,null));};exports[_0x5615('0x4e')]=function(_0x18f80b,_0x6d9494){return db[_0x5615('0x2d')][_0x5615('0x4e')]()[_0x5615('0x26')](respondWithResult(_0x6d9494,null))[_0x5615('0x4a')](handleError(_0x6d9494,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 791f31d..4b9930a 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 _0xe50f=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','lodash','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe50f,0x1b9));var _0xfe50=function(_0x1a1755,_0x2edaea){_0x1a1755=_0x1a1755-0x0;var _0x4b84e3=_0xe50f[_0x1a1755];return _0x4b84e3;};'use strict';var _=require(_0xfe50('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xfe50('0x1'));var moment=require(_0xfe50('0x2'));var BPromise=require(_0xfe50('0x3'));var rp=require(_0xfe50('0x4'));var fs=require('fs');var path=require(_0xfe50('0x5'));var rimraf=require(_0xfe50('0x6'));var config=require(_0xfe50('0x7'));var attributes=require(_0xfe50('0x8'));module[_0xfe50('0x9')]=function(_0xa1f3c4,_0x5219e7){return _0xa1f3c4[_0xfe50('0xa')]('VoiceDialReport',attributes,{'tableName':_0xfe50('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4074=['rimraf','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xdaec27,_0x4ab161){var _0x382901=function(_0x2ea4b7){while(--_0x2ea4b7){_0xdaec27['push'](_0xdaec27['shift']());}};_0x382901(++_0x4ab161);}(_0x4074,0xf0));var _0x4407=function(_0x2161d0,_0x2f32d5){_0x2161d0=_0x2161d0-0x0;var _0x5a9104=_0x4074[_0x2161d0];return _0x5a9104;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var logger=require(_0x4407('0x2'))('api');var moment=require(_0x4407('0x3'));var BPromise=require(_0x4407('0x4'));var rp=require(_0x4407('0x5'));var fs=require('fs');var path=require(_0x4407('0x6'));var rimraf=require(_0x4407('0x7'));var config=require(_0x4407('0x8'));var attributes=require(_0x4407('0x9'));module[_0x4407('0xa')]=function(_0x3f085d,_0x35899d){return _0x3f085d['define'](_0x4407('0xb'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0x4407('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index dc0e7ff..2989113 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 _0xca6a=['raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceDialReport,\x20%s,\x20%s','message','catch','CreateVoiceDialReport','create','body','options','info','update'];(function(_0x3218c4,_0x221779){var _0x571c3a=function(_0x596e38){while(--_0x596e38){_0x3218c4['push'](_0x3218c4['shift']());}};_0x571c3a(++_0x221779);}(_0xca6a,0x124));var _0xaca6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xca6a[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xaca6('0x0'));var util=require(_0xaca6('0x1'));var moment=require(_0xaca6('0x2'));var BPromise=require(_0xaca6('0x3'));var rs=require(_0xaca6('0x4'));var fs=require('fs');var Redis=require(_0xaca6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xaca6('0x6'));var logger=require(_0xaca6('0x7'))(_0xaca6('0x8'));var config=require(_0xaca6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaca6('0xa')][_0xaca6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e7544,_0x5b71fa,_0x3cd6cb){return new BPromise(function(_0x4ab2c9,_0x439aef){return client[_0xaca6('0xc')](_0x1e7544,_0x3cd6cb)[_0xaca6('0xd')](function(_0x25b825){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x5b71fa,_0xaca6('0xe'));logger[_0xaca6('0xf')](_0xaca6('0x10'),_0x5b71fa,_0xaca6('0xe'),JSON[_0xaca6('0x11')](_0x25b825));if(_0x25b825[_0xaca6('0x12')]){if(_0x25b825['error']['code']===0x1f4){logger['error'](_0xaca6('0x13'),_0x5b71fa,_0x25b825[_0xaca6('0x12')][_0xaca6('0x14')]);return _0x439aef(_0x25b825[_0xaca6('0x12')][_0xaca6('0x14')]);}logger[_0xaca6('0x12')](_0xaca6('0x13'),_0x5b71fa,_0x25b825['error'][_0xaca6('0x14')]);return _0x4ab2c9(_0x25b825[_0xaca6('0x12')]['message']);}else{logger['info'](_0xaca6('0x13'),_0x5b71fa,_0xaca6('0xe'));_0x4ab2c9(_0x25b825['result'][_0xaca6('0x14')]);}})[_0xaca6('0x15')](function(_0x25fd42){logger['error'](_0xaca6('0x13'),_0x5b71fa,_0x25fd42);_0x439aef(_0x25fd42);});});}exports[_0xaca6('0x16')]=function(_0x21f919){var _0x38f312=this;return new Promise(function(_0x26d923,_0x4fbe07){return db['VoiceDialReport'][_0xaca6('0x17')](_0x21f919[_0xaca6('0x18')],{'raw':_0x21f919[_0xaca6('0x19')]?_0x21f919[_0xaca6('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xaca6('0xd')](function(_0x459dcd){logger[_0xaca6('0x1a')](_0xaca6('0x16'),_0x21f919);logger[_0xaca6('0xf')]('CreateVoiceDialReport',_0x21f919,JSON[_0xaca6('0x11')](_0x459dcd));_0x26d923(_0x459dcd);})[_0xaca6('0x15')](function(_0x24b46f){logger[_0xaca6('0x12')](_0xaca6('0x16'),_0x24b46f[_0xaca6('0x14')],_0x21f919);_0x4fbe07(_0x38f312[_0xaca6('0x12')](0x1f4,_0x24b46f['message']));});});};exports['UpdateVoiceDialReport']=function(_0x503db0){var _0x297a66=this;return new Promise(function(_0x590f27,_0x2bc440){return db['VoiceDialReport'][_0xaca6('0x1b')](_0x503db0[_0xaca6('0x18')],{'raw':_0x503db0[_0xaca6('0x19')]?_0x503db0[_0xaca6('0x19')][_0xaca6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x503db0[_0xaca6('0x19')]?_0x503db0[_0xaca6('0x19')][_0xaca6('0x1d')]||null:null,'attributes':_0x503db0['options']?_0x503db0[_0xaca6('0x19')][_0xaca6('0x1e')]||null:null,'limit':_0x503db0['options']?_0x503db0[_0xaca6('0x19')][_0xaca6('0x1f')]||null:null})['then'](function(_0x1e3fad){logger['info']('UpdateVoiceDialReport',_0x503db0);logger['debug']('UpdateVoiceDialReport',_0x503db0,JSON[_0xaca6('0x11')](_0x1e3fad));_0x590f27(_0x1e3fad);})[_0xaca6('0x15')](function(_0x1afd8e){logger[_0xaca6('0x12')]('UpdateVoiceDialReport',_0x1afd8e[_0xaca6('0x14')],_0x503db0);_0x2bc440(_0x297a66['error'](0x1f4,_0x1afd8e[_0xaca6('0x14')]));});});}; \ No newline at end of file +var _0x19a9=['ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','UpdateVoiceDialReport','where','limit','lodash','util','moment','bluebird'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x19a9,0x1ae));var _0x919a=function(_0x5e5d35,_0x5bab81){_0x5e5d35=_0x5e5d35-0x0;var _0x5b0581=_0x19a9[_0x5e5d35];return _0x5b0581;};'use strict';var _=require(_0x919a('0x0'));var util=require(_0x919a('0x1'));var moment=require(_0x919a('0x2'));var BPromise=require(_0x919a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x919a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x919a('0x5'))('rpc');var config=require(_0x919a('0x6'));var jayson=require(_0x919a('0x7'));var client=jayson['client'][_0x919a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cfd13,_0x1ffb7e,_0x1566c5){return new BPromise(function(_0x1bda26,_0x8177be){return client[_0x919a('0x9')](_0x5cfd13,_0x1566c5)[_0x919a('0xa')](function(_0x55a6fe){logger[_0x919a('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x1ffb7e,'request\x20sent');logger[_0x919a('0xc')](_0x919a('0xd'),_0x1ffb7e,_0x919a('0xe'),JSON['stringify'](_0x55a6fe));if(_0x55a6fe[_0x919a('0xf')]){if(_0x55a6fe['error'][_0x919a('0x10')]===0x1f4){logger[_0x919a('0xf')](_0x919a('0x11'),_0x1ffb7e,_0x55a6fe[_0x919a('0xf')][_0x919a('0x12')]);return _0x8177be(_0x55a6fe[_0x919a('0xf')][_0x919a('0x12')]);}logger[_0x919a('0xf')](_0x919a('0x11'),_0x1ffb7e,_0x55a6fe[_0x919a('0xf')][_0x919a('0x12')]);return _0x1bda26(_0x55a6fe[_0x919a('0xf')][_0x919a('0x12')]);}else{logger['info'](_0x919a('0x11'),_0x1ffb7e,_0x919a('0xe'));_0x1bda26(_0x55a6fe[_0x919a('0x13')][_0x919a('0x12')]);}})[_0x919a('0x14')](function(_0x17d870){logger[_0x919a('0xf')](_0x919a('0x11'),_0x1ffb7e,_0x17d870);_0x8177be(_0x17d870);});});}exports['CreateVoiceDialReport']=function(_0x2c5fe5){var _0x554ae2=this;return new Promise(function(_0x4700e2,_0x3c5dca){return db[_0x919a('0x15')][_0x919a('0x16')](_0x2c5fe5[_0x919a('0x17')],{'raw':_0x2c5fe5[_0x919a('0x18')]?_0x2c5fe5[_0x919a('0x18')][_0x919a('0x19')]===undefined?!![]:![]:!![]})[_0x919a('0xa')](function(_0xd2c0e1){logger[_0x919a('0xb')](_0x919a('0x1a'),_0x2c5fe5);logger[_0x919a('0xc')](_0x919a('0x1a'),_0x2c5fe5,JSON[_0x919a('0x1b')](_0xd2c0e1));_0x4700e2(_0xd2c0e1);})[_0x919a('0x14')](function(_0x2a7f90){logger[_0x919a('0xf')](_0x919a('0x1a'),_0x2a7f90['message'],_0x2c5fe5);_0x3c5dca(_0x554ae2['error'](0x1f4,_0x2a7f90[_0x919a('0x12')]));});});};exports[_0x919a('0x1c')]=function(_0x22287c){var _0x3630c4=this;return new Promise(function(_0x52bfa4,_0xa3852a){return db['VoiceDialReport']['update'](_0x22287c[_0x919a('0x17')],{'raw':_0x22287c[_0x919a('0x18')]?_0x22287c['options'][_0x919a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22287c[_0x919a('0x18')]?_0x22287c[_0x919a('0x18')][_0x919a('0x1d')]||null:null,'attributes':_0x22287c['options']?_0x22287c[_0x919a('0x18')]['attributes']||null:null,'limit':_0x22287c['options']?_0x22287c['options'][_0x919a('0x1e')]||null:null})['then'](function(_0x2670e3){logger[_0x919a('0xb')]('UpdateVoiceDialReport',_0x22287c);logger[_0x919a('0xc')](_0x919a('0x1c'),_0x22287c,JSON[_0x919a('0x1b')](_0x2670e3));_0x52bfa4(_0x2670e3);})[_0x919a('0x14')](function(_0x2c8dc8){logger[_0x919a('0xf')]('UpdateVoiceDialReport',_0x2c8dc8[_0x919a('0x12')],_0x22287c);_0xa3852a(_0x3630c4['error'](0x1f4,_0x2c8dc8[_0x919a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 8642ac1..6ea5a6c 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 _0x4ec2=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','put','update','delete'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x4ec2,0x80));var _0x24ec=function(_0x133254,_0x172f72){_0x133254=_0x133254-0x0;var _0x45c03a=_0x4ec2[_0x133254];return _0x45c03a;};'use strict';var multer=require('multer');var util=require(_0x24ec('0x0'));var path=require(_0x24ec('0x1'));var timeout=require(_0x24ec('0x2'));var express=require(_0x24ec('0x3'));var router=express[_0x24ec('0x4')]();var fs_extra=require(_0x24ec('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x24ec('0x6'));var config=require('../../config/environment');var controller=require(_0x24ec('0x7'));router[_0x24ec('0x8')]('/',auth[_0x24ec('0x9')](),controller[_0x24ec('0xa')]);router['get'](_0x24ec('0xb'),auth['isAuthenticated'](),controller[_0x24ec('0xc')]);router[_0x24ec('0xd')]('/',auth[_0x24ec('0x9')](),controller[_0x24ec('0xe')]);router[_0x24ec('0xd')](_0x24ec('0xf'),auth[_0x24ec('0x9')](),controller['addApplications']);router[_0x24ec('0x10')](_0x24ec('0xb'),auth[_0x24ec('0x9')](),controller[_0x24ec('0x11')]);router[_0x24ec('0x12')](_0x24ec('0xb'),auth[_0x24ec('0x9')](),controller[_0x24ec('0x13')]);module[_0x24ec('0x14')]=router; \ No newline at end of file +var _0x8af1=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x8af1,0x183));var _0x18af=function(_0x263a2f,_0x1e81e3){_0x263a2f=_0x263a2f-0x0;var _0x8020e8=_0x8af1[_0x263a2f];return _0x8020e8;};'use strict';var multer=require(_0x18af('0x0'));var util=require(_0x18af('0x1'));var path=require(_0x18af('0x2'));var timeout=require('connect-timeout');var express=require(_0x18af('0x3'));var router=express[_0x18af('0x4')]();var fs_extra=require(_0x18af('0x5'));var auth=require(_0x18af('0x6'));var interaction=require(_0x18af('0x7'));var config=require(_0x18af('0x8'));var controller=require(_0x18af('0x9'));router[_0x18af('0xa')]('/',auth[_0x18af('0xb')](),controller[_0x18af('0xc')]);router['get']('/:id',auth[_0x18af('0xb')](),controller[_0x18af('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x18af('0xe')](_0x18af('0xf'),auth[_0x18af('0xb')](),controller[_0x18af('0x10')]);router[_0x18af('0x11')](_0x18af('0x12'),auth[_0x18af('0xb')](),controller[_0x18af('0x13')]);router[_0x18af('0x14')](_0x18af('0x12'),auth[_0x18af('0xb')](),controller[_0x18af('0x15')]);module[_0x18af('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index c1d5c29..658fe04 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 _0x3254=['sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x3254,0xa0));var _0x4325=function(_0xf61760,_0x425eaa){_0xf61760=_0xf61760-0x0;var _0x1be711=_0x3254[_0xf61760];return _0x1be711;};'use strict';var Sequelize=require(_0x4325('0x0'));module[_0x4325('0x1')]={'context':{'type':Sequelize[_0x4325('0x2')],'allowNull':![],'unique':_0x4325('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4325('0x2')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0x4325('0x3')},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4325('0x2')],'allowNull':![],'defaultValue':_0x4325('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4325('0x5')](_0x4325('0x6'),_0x4325('0x7'),_0x4325('0x8'),_0x4325('0x9'),_0x4325('0xa'),_0x4325('0xb'),_0x4325('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x4325('0x2')]},'interval':{'type':Sequelize[_0x4325('0x2')],'allowNull':![],'defaultValue':_0x4325('0xd')},'IntervalId':{'type':Sequelize[_0x4325('0xe')]},'isApp':{'type':Sequelize[_0x4325('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize[_0x4325('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4325('0xe')]},'recordingFormat':{'type':Sequelize[_0x4325('0x2')],'defaultValue':_0x4325('0x10')},'answer':{'type':Sequelize[_0x4325('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4325('0x11')],'get':function(_0x2e4758){return this[_0x4325('0x12')](_0x4325('0x13'));}},'alias':{'type':Sequelize[_0x4325('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xff34=['getDataValue','exten','sequelize','exports','STRING','compositeIndex','inbound','internal','inbound-fax','outbound-fax','system','*,*,*,*','wav','BOOLEAN','VIRTUAL'];(function(_0x58e4ae,_0x3668c0){var _0x153b65=function(_0x32ad5c){while(--_0x32ad5c){_0x58e4ae['push'](_0x58e4ae['shift']());}};_0x153b65(++_0x3668c0);}(_0xff34,0xf2));var _0x4ff3=function(_0xe80bf6,_0xa7508){_0xe80bf6=_0xe80bf6-0x0;var _0x5e7f89=_0xff34[_0xe80bf6];return _0x5e7f89;};'use strict';var Sequelize=require(_0x4ff3('0x0'));module[_0x4ff3('0x1')]={'context':{'type':Sequelize[_0x4ff3('0x2')],'allowNull':![],'unique':_0x4ff3('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x4ff3('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x4ff3('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x4ff3('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x4ff3('0x4'),'outbound',_0x4ff3('0x5'),_0x4ff3('0x6'),_0x4ff3('0x7'),_0x4ff3('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x4ff3('0x2')]},'interval':{'type':Sequelize[_0x4ff3('0x2')],'allowNull':![],'defaultValue':_0x4ff3('0x9')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x4ff3('0x2')],'defaultValue':_0x4ff3('0xa')},'answer':{'type':Sequelize[_0x4ff3('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4ff3('0xc')],'get':function(_0x4fd702){return this[_0x4ff3('0xd')](_0x4ff3('0xe'));}},'alias':{'type':Sequelize[_0x4ff3('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index ddfce25..0007209 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 _0xa814=['util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./voiceExtension.socket','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','type','find','UserProfileResource','error','stack','name','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','create','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','cutdigits','mandatoryDisposition','alias','addApplications','findOne','sequelize','transaction','VoiceExtensionId','isApp','rewriteDial','true','createRouting','bulkCreate','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x177d1f,_0x4bbaf2){var _0x38d059=function(_0x20f24d){while(--_0x20f24d){_0x177d1f['push'](_0x177d1f['shift']());}};_0x38d059(++_0x4bbaf2);}(_0xa814,0x14d));var _0x4a81=function(_0x563157,_0x45bf40){_0x563157=_0x563157-0x0;var _0x3d6395=_0xa814[_0x563157];return _0x3d6395;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4a81('0x0'));var zipdir=require(_0x4a81('0x1'));var jsonpatch=require(_0x4a81('0x2'));var rp=require(_0x4a81('0x3'));var moment=require(_0x4a81('0x4'));var BPromise=require(_0x4a81('0x5'));var Mustache=require('mustache');var util=require(_0x4a81('0x6'));var path=require('path');var sox=require(_0x4a81('0x7'));var csv=require(_0x4a81('0x8'));var ejs=require(_0x4a81('0x9'));var fs=require('fs');var fs_extra=require(_0x4a81('0xa'));var _=require(_0x4a81('0xb'));var squel=require('squel');var crypto=require(_0x4a81('0xc'));var jsforce=require(_0x4a81('0xd'));var deskjs=require(_0x4a81('0xe'));var toCsv=require(_0x4a81('0x8'));var querystring=require('querystring');var Papa=require(_0x4a81('0xf'));var Redis=require(_0x4a81('0x10'));var authService=require(_0x4a81('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4a81('0x12'));var hardwareService=require(_0x4a81('0x13'));var logger=require(_0x4a81('0x14'))(_0x4a81('0x15'));var utils=require(_0x4a81('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4a81('0x17'));var db=require(_0x4a81('0x18'))['db'];config[_0x4a81('0x19')]=_[_0x4a81('0x1a')](config[_0x4a81('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4a81('0x19')]));require(_0x4a81('0x1b'))['register'](socket);function respondWithStatusCode(_0x464ff0,_0x2d033b){_0x2d033b=_0x2d033b||0xcc;return function(_0x1807f9){if(_0x1807f9){return _0x464ff0[_0x4a81('0x1c')](_0x2d033b);}return _0x464ff0[_0x4a81('0x1d')](_0x2d033b)[_0x4a81('0x1e')]();};}function respondWithResult(_0xe8399a,_0x14bfdd){_0x14bfdd=_0x14bfdd||0xc8;return function(_0x3a37b3){if(_0x3a37b3){return _0xe8399a[_0x4a81('0x1d')](_0x14bfdd)['json'](_0x3a37b3);}};}function respondWithFilteredResult(_0x1007d3,_0x3086ed){return function(_0x15c677){if(_0x15c677){var _0x378527=typeof _0x3086ed[_0x4a81('0x1f')]==='undefined'&&typeof _0x3086ed['limit']===_0x4a81('0x20');var _0x1fe91f=_0x15c677[_0x4a81('0x21')];var _0x36f856=_0x378527?0x0:_0x3086ed[_0x4a81('0x1f')];var _0x2a107a=_0x378527?_0x15c677[_0x4a81('0x21')]:_0x3086ed['offset']+_0x3086ed[_0x4a81('0x22')];var _0x5daca3;if(_0x2a107a>=_0x1fe91f){_0x2a107a=_0x1fe91f;_0x5daca3=0xc8;}else{_0x5daca3=0xce;}_0x1007d3[_0x4a81('0x1d')](_0x5daca3);return _0x1007d3[_0x4a81('0x23')](_0x4a81('0x24'),_0x36f856+'-'+_0x2a107a+'/'+_0x1fe91f)[_0x4a81('0x25')](_0x15c677);}return null;};}function patchUpdates(_0x222660){return function(_0x4b4a04){try{jsonpatch['apply'](_0x4b4a04,_0x222660,!![]);}catch(_0x310c09){return BPromise[_0x4a81('0x26')](_0x310c09);}return _0x4b4a04[_0x4a81('0x27')]();};}function saveUpdates(_0x5c4dda,_0x2cdb6b){return function(_0x34c8c0){if(_0x34c8c0){return _0x34c8c0[_0x4a81('0x28')](_0x5c4dda)[_0x4a81('0x29')](function(_0x5351a5){return _0x5351a5;});}return null;};}function removeEntity(_0x4d9751,_0x1b4be5){return function(_0x9db1b){if(_0x9db1b){return _0x9db1b[_0x4a81('0x2a')]()[_0x4a81('0x29')](function(){var _0x470948=_0x9db1b[_0x4a81('0x2b')]({'plain':!![]});var _0x493281=[{'name':_0x4a81('0x2c'),'value':_0x4a81('0x2d'),'ignore':![]},{'name':_0x4a81('0x2e'),'value':_0x4a81('0x2f'),'ignore':![]},{'name':_0x4a81('0x30'),'value':_0x4a81('0x31'),'ignore':![]}];var _0x38ce2d=_(_0x493281)[_0x4a81('0x32')](_0x4a81('0x33'))[_0x4a81('0x34')]('value')[_0x4a81('0x35')]();if(_['includes'](_0x38ce2d,_0x470948[_0x4a81('0x36')])){return;}var _0x1e18b7=_[_0x4a81('0x37')](_0x493281,[_0x4a81('0x35'),_0x470948[_0x4a81('0x36')]])['name'];return db[_0x4a81('0x38')]['destroy']({'where':{'type':_0x1e18b7,'resourceId':_0x470948['id']}})[_0x4a81('0x29')](function(){return _0x9db1b;});})[_0x4a81('0x29')](function(){_0x4d9751[_0x4a81('0x1d')](0xcc)[_0x4a81('0x1e')]();});}};}function handleEntityNotFound(_0x5df7d1,_0x30cfd1){return function(_0x4f77d6){if(!_0x4f77d6){_0x5df7d1[_0x4a81('0x1c')](0x194);}return _0x4f77d6;};}function handleError(_0x121163,_0x4ab262){_0x4ab262=_0x4ab262||0x1f4;return function(_0x24ce85){logger[_0x4a81('0x39')](_0x24ce85[_0x4a81('0x3a')]);if(_0x24ce85[_0x4a81('0x3b')]){delete _0x24ce85[_0x4a81('0x3b')];}_0x121163[_0x4a81('0x1d')](_0x4ab262)['send'](_0x24ce85);};}exports[_0x4a81('0x3c')]=function(_0x8b6b56,_0x25cd63){var _0x41bcc6={},_0x260594={},_0x38b5f7={'count':0x0,'rows':[]};var _0x1a6662=_[_0x4a81('0x34')](db[_0x4a81('0x3d')][_0x4a81('0x3e')],function(_0x5ac262){return{'name':_0x5ac262[_0x4a81('0x3f')],'type':_0x5ac262[_0x4a81('0x36')][_0x4a81('0x40')]};});_0x260594[_0x4a81('0x41')]=_[_0x4a81('0x34')](_0x1a6662,_0x4a81('0x3b'));_0x260594[_0x4a81('0x42')]=_[_0x4a81('0x43')](_0x8b6b56[_0x4a81('0x42')]);_0x260594[_0x4a81('0x44')]=_[_0x4a81('0x45')](_0x260594[_0x4a81('0x41')],_0x260594['query']);_0x41bcc6[_0x4a81('0x46')]=_[_0x4a81('0x45')](_0x260594[_0x4a81('0x41')],qs[_0x4a81('0x47')](_0x8b6b56['query'][_0x4a81('0x47')]));_0x41bcc6['attributes']=_0x41bcc6[_0x4a81('0x46')][_0x4a81('0x48')]?_0x41bcc6[_0x4a81('0x46')]:_0x260594[_0x4a81('0x41')];if(!_0x8b6b56[_0x4a81('0x42')][_0x4a81('0x49')](_0x4a81('0x4a'))){_0x41bcc6[_0x4a81('0x22')]=qs['limit'](_0x8b6b56['query'][_0x4a81('0x22')]);_0x41bcc6[_0x4a81('0x1f')]=qs[_0x4a81('0x1f')](_0x8b6b56[_0x4a81('0x42')][_0x4a81('0x1f')]);}_0x41bcc6['order']=qs[_0x4a81('0x4b')](_0x8b6b56[_0x4a81('0x42')][_0x4a81('0x4b')]);_0x41bcc6[_0x4a81('0x4c')]=qs[_0x4a81('0x44')](_[_0x4a81('0x4d')](_0x8b6b56[_0x4a81('0x42')],_0x260594[_0x4a81('0x44')]),_0x1a6662);if(_0x8b6b56['query'][_0x4a81('0x32')]){_0x41bcc6[_0x4a81('0x4c')]=_[_0x4a81('0x4e')](_0x41bcc6[_0x4a81('0x4c')],{'$or':_[_0x4a81('0x34')](_0x1a6662,function(_0x45a49a){if(_0x45a49a['type']!==_0x4a81('0x4f')){var _0x3a7e7f={};_0x3a7e7f[_0x45a49a[_0x4a81('0x3b')]]={'$like':'%'+_0x8b6b56[_0x4a81('0x42')][_0x4a81('0x32')]+'%'};return _0x3a7e7f;}})});}_0x41bcc6=_[_0x4a81('0x4e')]({},_0x41bcc6,_0x8b6b56[_0x4a81('0x50')]);var _0x39b722={'where':_0x41bcc6[_0x4a81('0x4c')]};return db['VoiceExtension']['count'](_0x39b722)[_0x4a81('0x29')](function(_0x5399c6){_0x38b5f7[_0x4a81('0x21')]=_0x5399c6;if(_0x8b6b56['query'][_0x4a81('0x51')]){_0x41bcc6[_0x4a81('0x52')]=[{'all':!![]}];}return db[_0x4a81('0x3d')][_0x4a81('0x53')](_0x41bcc6);})[_0x4a81('0x29')](function(_0x3df42a){_0x38b5f7['rows']=_0x3df42a;return _0x38b5f7;})[_0x4a81('0x29')](respondWithFilteredResult(_0x25cd63,_0x41bcc6))['catch'](handleError(_0x25cd63,null));};exports[_0x4a81('0x54')]=function(_0x528726,_0x31a214){var _0x3f9d42={'raw':![],'where':{'id':_0x528726[_0x4a81('0x55')]['id']}},_0x2b7490={};_0x2b7490[_0x4a81('0x41')]=_[_0x4a81('0x43')](db[_0x4a81('0x3d')][_0x4a81('0x3e')]);_0x2b7490[_0x4a81('0x42')]=_[_0x4a81('0x43')](_0x528726[_0x4a81('0x42')]);_0x2b7490[_0x4a81('0x44')]=_[_0x4a81('0x45')](_0x2b7490[_0x4a81('0x41')],_0x2b7490[_0x4a81('0x42')]);_0x3f9d42[_0x4a81('0x46')]=_['intersection'](_0x2b7490[_0x4a81('0x41')],qs[_0x4a81('0x47')](_0x528726[_0x4a81('0x42')][_0x4a81('0x47')]));_0x3f9d42[_0x4a81('0x46')]=_0x3f9d42[_0x4a81('0x46')]['length']?_0x3f9d42[_0x4a81('0x46')]:_0x2b7490[_0x4a81('0x41')];if(_0x528726[_0x4a81('0x42')][_0x4a81('0x51')]){_0x3f9d42[_0x4a81('0x52')]=[{'all':!![]}];}_0x3f9d42=_['merge']({},_0x3f9d42,_0x528726[_0x4a81('0x50')]);return db[_0x4a81('0x3d')][_0x4a81('0x37')](_0x3f9d42)['then'](handleEntityNotFound(_0x31a214,null))[_0x4a81('0x29')](respondWithResult(_0x31a214,null))[_0x4a81('0x56')](handleError(_0x31a214,null));};exports[_0x4a81('0x2a')]=function(_0x29cbd4,_0x17d147){return db[_0x4a81('0x3d')][_0x4a81('0x37')]({'where':{'id':_0x29cbd4[_0x4a81('0x55')]['id']}})[_0x4a81('0x29')](handleEntityNotFound(_0x17d147,null))[_0x4a81('0x29')](removeEntity(_0x17d147,null))['catch'](handleError(_0x17d147,null));};exports[_0x4a81('0x57')]=function(_0x23a524,_0x3b986a){if(_0x23a524[_0x4a81('0x58')][_0x4a81('0x36')]===_0x4a81('0x2f')&&!_['startsWith'](_0x23a524[_0x4a81('0x58')][_0x4a81('0x59')],'_')){_0x23a524[_0x4a81('0x58')][_0x4a81('0x59')]='_'[_0x4a81('0x5a')](_0x23a524[_0x4a81('0x58')][_0x4a81('0x59')]);}return db['VoiceExtension'][_0x4a81('0x57')](_0x23a524[_0x4a81('0x58')],{'raw':![]})['then'](function(_0x392621){var _0x3fd3c1=_0x23a524['user'][_0x4a81('0x2b')]({'plain':!![]});if(!_0x3fd3c1)throw new Error(_0x4a81('0x5b'));if(_0x3fd3c1[_0x4a81('0x5c')]===_0x4a81('0x5d')){var _0xea431f=_0x392621[_0x4a81('0x2b')]({'plain':!![]});var _0x5d477e=[{'name':_0x4a81('0x2c'),'value':'inbound'},{'name':_0x4a81('0x2e'),'value':_0x4a81('0x2f')},{'name':_0x4a81('0x30'),'value':_0x4a81('0x31')}];var _0x2206ff=_[_0x4a81('0x37')](_0x5d477e,['value',_0xea431f[_0x4a81('0x36')]])[_0x4a81('0x3b')];return db[_0x4a81('0x5e')]['find']({'where':{'name':_0x2206ff,'userProfileId':_0x3fd3c1[_0x4a81('0x5f')]},'raw':!![]})[_0x4a81('0x29')](function(_0x4a5052){if(_0x4a5052&&_0x4a5052['autoAssociation']===0x0){return db[_0x4a81('0x38')][_0x4a81('0x57')]({'name':_0xea431f[_0x4a81('0x3b')],'resourceId':_0xea431f['id'],'type':_0x4a5052['name'],'sectionId':_0x4a5052['id']},{})[_0x4a81('0x29')](function(){return _0x392621;});}else{return _0x392621;}})[_0x4a81('0x56')](function(_0x406260){logger[_0x4a81('0x39')](_0x4a81('0x60'),_0x406260);throw _0x406260;});}return _0x392621;})[_0x4a81('0x29')](respondWithResult(_0x3b986a,0xc9))[_0x4a81('0x56')](handleError(_0x3b986a,null));};exports[_0x4a81('0x28')]=function(_0x16954,_0x5318cf){if(_0x16954[_0x4a81('0x58')]['id']){delete _0x16954[_0x4a81('0x58')]['id'];}return db[_0x4a81('0x3d')][_0x4a81('0x37')]({'where':{'id':_0x16954[_0x4a81('0x55')]['id']}})['then'](handleEntityNotFound(_0x5318cf,null))[_0x4a81('0x29')](function(_0x168cd9){if(_0x168cd9){return db['VoiceExtension']['update'](_[_0x4a81('0x4d')](_0x16954[_0x4a81('0x58')],[_0x4a81('0x59'),_0x4a81('0x61'),_0x4a81('0x62'),'recordingFormat',_0x4a81('0x63'),_0x4a81('0x64'),_0x4a81('0x65')]),{'where':{'context':_0x168cd9['context'],'exten':_0x168cd9['exten']},'individualHooks':!![]})[_0x4a81('0x29')](function(_0x23a39b){return _0x23a39b;});}return null;})[_0x4a81('0x29')](respondWithStatusCode(_0x5318cf,null))[_0x4a81('0x56')](handleError(_0x5318cf,null));};exports[_0x4a81('0x66')]=function(_0x388b64,_0x3cf2e9){return db[_0x4a81('0x3d')][_0x4a81('0x67')]({'where':{'id':_0x388b64['params']['id']}})[_0x4a81('0x29')](function(_0x39bd08){if(_0x39bd08){return db[_0x4a81('0x68')][_0x4a81('0x69')](function(_0x12646c){return db[_0x4a81('0x3d')][_0x4a81('0x2a')]({'where':{'VoiceExtensionId':_0x388b64[_0x4a81('0x55')]['id']},'transaction':_0x12646c})['then'](function(){var _0x4d9967=_[_0x4a81('0x34')](_0x388b64[_0x4a81('0x58')],function(_0xd5f757){_0xd5f757[_0x4a81('0x6a')]=_0x388b64[_0x4a81('0x55')]['id'];_0xd5f757[_0x4a81('0x6b')]=!![];return _0xd5f757;});var _0xcd382d=_0x388b64[_0x4a81('0x42')][_0x4a81('0x6c')]&&_0x388b64['query'][_0x4a81('0x6c')]['toLowerCase']()===_0x4a81('0x6d')?!![]:![];return _0x39bd08[_0x4a81('0x6e')](_0x4d9967,_0xcd382d);})[_0x4a81('0x29')](function(_0x2af1ef){return db['VoiceExtension'][_0x4a81('0x6f')](_0x2af1ef,{'transaction':_0x12646c});});})[_0x4a81('0x29')](function(){return db[_0x4a81('0x3d')][_0x4a81('0x70')]({'where':{'isApp':!![],'VoiceExtensionId':_0x388b64[_0x4a81('0x55')]['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})['then'](respondWithResult(_0x3cf2e9,null))[_0x4a81('0x56')](handleError(_0x3cf2e9,null));}; \ No newline at end of file +var _0x3aa1=['key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','merge','options','includeAll','include','VoiceExtension','findAll','rows','catch','show','params','create','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','UserProfileSection','userProfileId','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','findOne','VoiceExtensionId','isApp','rewriteDial','toLowerCase','createRouting','findAndCountAll','cast(priority\x20as\x20unsigned)','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','get','InboundRoutes','outbound','InternalRoutes','filter','ignore','value','includes','type','find','UserProfileResource','destroy','error','stack','name','send','index','rawAttributes','fieldName'];(function(_0x1a5a78,_0x4ea50e){var _0x3461c0=function(_0x129a0b){while(--_0x129a0b){_0x1a5a78['push'](_0x1a5a78['shift']());}};_0x3461c0(++_0x4ea50e);}(_0x3aa1,0x9e));var _0x13aa=function(_0x2678e0,_0x2c895a){_0x2678e0=_0x2678e0-0x0;var _0x1995b0=_0x3aa1[_0x2678e0];return _0x1995b0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x13aa('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13aa('0x1'));var moment=require(_0x13aa('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x13aa('0x3'));var util=require(_0x13aa('0x4'));var path=require(_0x13aa('0x5'));var sox=require(_0x13aa('0x6'));var csv=require(_0x13aa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13aa('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13aa('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x13aa('0xa'));var toCsv=require(_0x13aa('0x7'));var querystring=require(_0x13aa('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x13aa('0xc'));var as=require(_0x13aa('0xd'));var hardwareService=require(_0x13aa('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0x13aa('0xf'));var config=require(_0x13aa('0x10'));var licenseUtil=require(_0x13aa('0x11'));var db=require(_0x13aa('0x12'))['db'];config[_0x13aa('0x13')]=_[_0x13aa('0x14')](config[_0x13aa('0x13')],{'host':_0x13aa('0x15'),'port':0x18eb});var socket=require(_0x13aa('0x16'))(new Redis(config[_0x13aa('0x13')]));require(_0x13aa('0x17'))['register'](socket);function respondWithStatusCode(_0x51093d,_0x4f761b){_0x4f761b=_0x4f761b||0xcc;return function(_0x3e5fee){if(_0x3e5fee){return _0x51093d[_0x13aa('0x18')](_0x4f761b);}return _0x51093d['status'](_0x4f761b)[_0x13aa('0x19')]();};}function respondWithResult(_0x5385f4,_0x3f39e7){_0x3f39e7=_0x3f39e7||0xc8;return function(_0x35b132){if(_0x35b132){return _0x5385f4[_0x13aa('0x1a')](_0x3f39e7)[_0x13aa('0x1b')](_0x35b132);}};}function respondWithFilteredResult(_0x5ba297,_0x563c61){return function(_0x5c31e1){if(_0x5c31e1){var _0xc4b0fc=typeof _0x563c61[_0x13aa('0x1c')]===_0x13aa('0x1d')&&typeof _0x563c61[_0x13aa('0x1e')]==='undefined';var _0xd3cd13=_0x5c31e1[_0x13aa('0x1f')];var _0x184350=_0xc4b0fc?0x0:_0x563c61[_0x13aa('0x1c')];var _0x391577=_0xc4b0fc?_0x5c31e1['count']:_0x563c61[_0x13aa('0x1c')]+_0x563c61[_0x13aa('0x1e')];var _0x289c6a;if(_0x391577>=_0xd3cd13){_0x391577=_0xd3cd13;_0x289c6a=0xc8;}else{_0x289c6a=0xce;}_0x5ba297[_0x13aa('0x1a')](_0x289c6a);return _0x5ba297[_0x13aa('0x20')](_0x13aa('0x21'),_0x184350+'-'+_0x391577+'/'+_0xd3cd13)[_0x13aa('0x1b')](_0x5c31e1);}return null;};}function patchUpdates(_0x40f3f2){return function(_0x3e333e){try{jsonpatch[_0x13aa('0x22')](_0x3e333e,_0x40f3f2,!![]);}catch(_0x5e067c){return BPromise['reject'](_0x5e067c);}return _0x3e333e[_0x13aa('0x23')]();};}function saveUpdates(_0x434ac7,_0x2def94){return function(_0x350a38){if(_0x350a38){return _0x350a38['update'](_0x434ac7)[_0x13aa('0x24')](function(_0x2421a9){return _0x2421a9;});}return null;};}function removeEntity(_0x432178,_0xf5fa98){return function(_0x4827ff){if(_0x4827ff){return _0x4827ff['destroy']()[_0x13aa('0x24')](function(){var _0x342190=_0x4827ff[_0x13aa('0x25')]({'plain':!![]});var _0x5f4354=[{'name':_0x13aa('0x26'),'value':'inbound','ignore':![]},{'name':'OutboundRoutes','value':_0x13aa('0x27'),'ignore':![]},{'name':_0x13aa('0x28'),'value':'internal','ignore':![]}];var _0x14a2d7=_(_0x5f4354)[_0x13aa('0x29')](_0x13aa('0x2a'))['map'](_0x13aa('0x2b'))[_0x13aa('0x2b')]();if(_[_0x13aa('0x2c')](_0x14a2d7,_0x342190[_0x13aa('0x2d')])){return;}var _0x4dd22d=_[_0x13aa('0x2e')](_0x5f4354,[_0x13aa('0x2b'),_0x342190['type']])['name'];return db[_0x13aa('0x2f')][_0x13aa('0x30')]({'where':{'type':_0x4dd22d,'resourceId':_0x342190['id']}})[_0x13aa('0x24')](function(){return _0x4827ff;});})[_0x13aa('0x24')](function(){_0x432178['status'](0xcc)[_0x13aa('0x19')]();});}};}function handleEntityNotFound(_0x45cf31,_0xe42feb){return function(_0x39c458){if(!_0x39c458){_0x45cf31[_0x13aa('0x18')](0x194);}return _0x39c458;};}function handleError(_0xa309ee,_0x443a67){_0x443a67=_0x443a67||0x1f4;return function(_0x248af4){logger[_0x13aa('0x31')](_0x248af4[_0x13aa('0x32')]);if(_0x248af4[_0x13aa('0x33')]){delete _0x248af4['name'];}_0xa309ee[_0x13aa('0x1a')](_0x443a67)[_0x13aa('0x34')](_0x248af4);};}exports[_0x13aa('0x35')]=function(_0x6bddd5,_0x32bf20){var _0x13b0cf={},_0x113556={},_0x422004={'count':0x0,'rows':[]};var _0x5e5fb4=_['map'](db['VoiceExtension'][_0x13aa('0x36')],function(_0x71d6ad){return{'name':_0x71d6ad[_0x13aa('0x37')],'type':_0x71d6ad[_0x13aa('0x2d')][_0x13aa('0x38')]};});_0x113556[_0x13aa('0x39')]=_[_0x13aa('0x3a')](_0x5e5fb4,_0x13aa('0x33'));_0x113556[_0x13aa('0x3b')]=_[_0x13aa('0x3c')](_0x6bddd5[_0x13aa('0x3b')]);_0x113556['filters']=_[_0x13aa('0x3d')](_0x113556['model'],_0x113556['query']);_0x13b0cf[_0x13aa('0x3e')]=_[_0x13aa('0x3d')](_0x113556['model'],qs[_0x13aa('0x3f')](_0x6bddd5[_0x13aa('0x3b')][_0x13aa('0x3f')]));_0x13b0cf[_0x13aa('0x3e')]=_0x13b0cf[_0x13aa('0x3e')][_0x13aa('0x40')]?_0x13b0cf[_0x13aa('0x3e')]:_0x113556[_0x13aa('0x39')];if(!_0x6bddd5[_0x13aa('0x3b')][_0x13aa('0x41')]('nolimit')){_0x13b0cf[_0x13aa('0x1e')]=qs[_0x13aa('0x1e')](_0x6bddd5[_0x13aa('0x3b')][_0x13aa('0x1e')]);_0x13b0cf[_0x13aa('0x1c')]=qs[_0x13aa('0x1c')](_0x6bddd5['query'][_0x13aa('0x1c')]);}_0x13b0cf['order']=qs[_0x13aa('0x42')](_0x6bddd5['query'][_0x13aa('0x42')]);_0x13b0cf[_0x13aa('0x43')]=qs[_0x13aa('0x44')](_[_0x13aa('0x45')](_0x6bddd5[_0x13aa('0x3b')],_0x113556['filters']),_0x5e5fb4);if(_0x6bddd5[_0x13aa('0x3b')][_0x13aa('0x29')]){_0x13b0cf[_0x13aa('0x43')]=_[_0x13aa('0x46')](_0x13b0cf['where'],{'$or':_['map'](_0x5e5fb4,function(_0x4677a9){if(_0x4677a9[_0x13aa('0x2d')]!=='VIRTUAL'){var _0x1c4511={};_0x1c4511[_0x4677a9[_0x13aa('0x33')]]={'$like':'%'+_0x6bddd5[_0x13aa('0x3b')][_0x13aa('0x29')]+'%'};return _0x1c4511;}})});}_0x13b0cf=_[_0x13aa('0x46')]({},_0x13b0cf,_0x6bddd5[_0x13aa('0x47')]);var _0x21c8be={'where':_0x13b0cf[_0x13aa('0x43')]};return db['VoiceExtension'][_0x13aa('0x1f')](_0x21c8be)['then'](function(_0x515bf1){_0x422004[_0x13aa('0x1f')]=_0x515bf1;if(_0x6bddd5[_0x13aa('0x3b')][_0x13aa('0x48')]){_0x13b0cf[_0x13aa('0x49')]=[{'all':!![]}];}return db[_0x13aa('0x4a')][_0x13aa('0x4b')](_0x13b0cf);})['then'](function(_0x3f8726){_0x422004[_0x13aa('0x4c')]=_0x3f8726;return _0x422004;})[_0x13aa('0x24')](respondWithFilteredResult(_0x32bf20,_0x13b0cf))[_0x13aa('0x4d')](handleError(_0x32bf20,null));};exports[_0x13aa('0x4e')]=function(_0x212b1e,_0x4b3b3e){var _0x20af82={'raw':![],'where':{'id':_0x212b1e[_0x13aa('0x4f')]['id']}},_0xd9b280={};_0xd9b280['model']=_[_0x13aa('0x3c')](db['VoiceExtension']['rawAttributes']);_0xd9b280[_0x13aa('0x3b')]=_[_0x13aa('0x3c')](_0x212b1e[_0x13aa('0x3b')]);_0xd9b280[_0x13aa('0x44')]=_[_0x13aa('0x3d')](_0xd9b280['model'],_0xd9b280[_0x13aa('0x3b')]);_0x20af82[_0x13aa('0x3e')]=_[_0x13aa('0x3d')](_0xd9b280['model'],qs[_0x13aa('0x3f')](_0x212b1e[_0x13aa('0x3b')][_0x13aa('0x3f')]));_0x20af82[_0x13aa('0x3e')]=_0x20af82[_0x13aa('0x3e')][_0x13aa('0x40')]?_0x20af82['attributes']:_0xd9b280[_0x13aa('0x39')];if(_0x212b1e[_0x13aa('0x3b')][_0x13aa('0x48')]){_0x20af82[_0x13aa('0x49')]=[{'all':!![]}];}_0x20af82=_[_0x13aa('0x46')]({},_0x20af82,_0x212b1e[_0x13aa('0x47')]);return db[_0x13aa('0x4a')][_0x13aa('0x2e')](_0x20af82)['then'](handleEntityNotFound(_0x4b3b3e,null))[_0x13aa('0x24')](respondWithResult(_0x4b3b3e,null))[_0x13aa('0x4d')](handleError(_0x4b3b3e,null));};exports[_0x13aa('0x30')]=function(_0x1734ab,_0x30311d){return db[_0x13aa('0x4a')][_0x13aa('0x2e')]({'where':{'id':_0x1734ab[_0x13aa('0x4f')]['id']}})[_0x13aa('0x24')](handleEntityNotFound(_0x30311d,null))[_0x13aa('0x24')](removeEntity(_0x30311d,null))['catch'](handleError(_0x30311d,null));};exports[_0x13aa('0x50')]=function(_0x403664,_0x151a38){if(_0x403664['body'][_0x13aa('0x2d')]===_0x13aa('0x27')&&!_['startsWith'](_0x403664[_0x13aa('0x51')][_0x13aa('0x52')],'_')){_0x403664[_0x13aa('0x51')][_0x13aa('0x52')]='_'[_0x13aa('0x53')](_0x403664[_0x13aa('0x51')][_0x13aa('0x52')]);}return db[_0x13aa('0x4a')][_0x13aa('0x50')](_0x403664['body'],{'raw':![]})[_0x13aa('0x24')](function(_0x80cb47){var _0x319853=_0x403664[_0x13aa('0x54')][_0x13aa('0x25')]({'plain':!![]});if(!_0x319853)throw new Error(_0x13aa('0x55'));if(_0x319853[_0x13aa('0x56')]==='user'){var _0x2fa844=_0x80cb47[_0x13aa('0x25')]({'plain':!![]});var _0x9a8221=[{'name':_0x13aa('0x26'),'value':_0x13aa('0x57')},{'name':'OutboundRoutes','value':_0x13aa('0x27')},{'name':'InternalRoutes','value':_0x13aa('0x58')}];var _0x4fc359=_[_0x13aa('0x2e')](_0x9a8221,[_0x13aa('0x2b'),_0x2fa844['type']])['name'];return db[_0x13aa('0x59')]['find']({'where':{'name':_0x4fc359,'userProfileId':_0x319853[_0x13aa('0x5a')]},'raw':!![]})[_0x13aa('0x24')](function(_0x247714){if(_0x247714&&_0x247714['autoAssociation']===0x0){return db[_0x13aa('0x2f')][_0x13aa('0x50')]({'name':_0x2fa844[_0x13aa('0x33')],'resourceId':_0x2fa844['id'],'type':_0x247714[_0x13aa('0x33')],'sectionId':_0x247714['id']},{})[_0x13aa('0x24')](function(){return _0x80cb47;});}else{return _0x80cb47;}})['catch'](function(_0x2bb9b8){logger[_0x13aa('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bb9b8);throw _0x2bb9b8;});}return _0x80cb47;})[_0x13aa('0x24')](respondWithResult(_0x151a38,0xc9))[_0x13aa('0x4d')](handleError(_0x151a38,null));};exports[_0x13aa('0x5b')]=function(_0x50985f,_0x3a59c5){if(_0x50985f[_0x13aa('0x51')]['id']){delete _0x50985f['body']['id'];}return db[_0x13aa('0x4a')]['find']({'where':{'id':_0x50985f['params']['id']}})[_0x13aa('0x24')](handleEntityNotFound(_0x3a59c5,null))[_0x13aa('0x24')](function(_0x4a67b7){if(_0x4a67b7){return db['VoiceExtension'][_0x13aa('0x5b')](_[_0x13aa('0x45')](_0x50985f[_0x13aa('0x51')],[_0x13aa('0x52'),'context',_0x13aa('0x5c'),_0x13aa('0x5d'),_0x13aa('0x5e'),_0x13aa('0x5f'),_0x13aa('0x60')]),{'where':{'context':_0x4a67b7[_0x13aa('0x61')],'exten':_0x4a67b7[_0x13aa('0x52')]},'individualHooks':!![]})['then'](function(_0x167619){return _0x167619;});}return null;})[_0x13aa('0x24')](respondWithStatusCode(_0x3a59c5,null))[_0x13aa('0x4d')](handleError(_0x3a59c5,null));};exports[_0x13aa('0x62')]=function(_0x4421ad,_0x36af76){return db[_0x13aa('0x4a')][_0x13aa('0x63')]({'where':{'id':_0x4421ad[_0x13aa('0x4f')]['id']}})[_0x13aa('0x24')](function(_0x158009){if(_0x158009){return db['sequelize']['transaction'](function(_0x584647){return db['VoiceExtension'][_0x13aa('0x30')]({'where':{'VoiceExtensionId':_0x4421ad[_0x13aa('0x4f')]['id']},'transaction':_0x584647})[_0x13aa('0x24')](function(){var _0x2ea396=_[_0x13aa('0x3a')](_0x4421ad[_0x13aa('0x51')],function(_0xd97f3){_0xd97f3[_0x13aa('0x64')]=_0x4421ad['params']['id'];_0xd97f3[_0x13aa('0x65')]=!![];return _0xd97f3;});var _0x5bcf5e=_0x4421ad[_0x13aa('0x3b')][_0x13aa('0x66')]&&_0x4421ad[_0x13aa('0x3b')][_0x13aa('0x66')][_0x13aa('0x67')]()==='true'?!![]:![];return _0x158009[_0x13aa('0x68')](_0x2ea396,_0x5bcf5e);})[_0x13aa('0x24')](function(_0x5cdd6a){return db['VoiceExtension']['bulkCreate'](_0x5cdd6a,{'transaction':_0x584647});});})[_0x13aa('0x24')](function(){return db['VoiceExtension'][_0x13aa('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4421ad[_0x13aa('0x4f')]['id']},'order':_0x13aa('0x6a')});});}})[_0x13aa('0x24')](respondWithResult(_0x36af76,null))['catch'](handleError(_0x36af76,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b61ceae..a7a7ced 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 _0x5be5=['exports','../../mysqldb','save','update','hasOwnProperty','hook'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5be5,0x73));var _0x55be=function(_0x51244e,_0x24c7e6){_0x51244e=_0x51244e-0x0;var _0x58d71c=_0x5be5[_0x51244e];return _0x58d71c;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x55be('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x55be('0x1'),'afterUpdate':_0x55be('0x2'),'afterDestroy':'remove'};function emitEvent(_0x335698){return function(_0xa7d35b,_0x5f96af,_0x372ce7){VoiceExtensionEvents['emit'](_0x335698+':'+_0xa7d35b['id'],_0xa7d35b);VoiceExtensionEvents['emit'](_0x335698,_0xa7d35b);_0x372ce7(null);};}for(var e in events){if(events[_0x55be('0x3')](e)){var event=events[e];VoiceExtension[_0x55be('0x4')](e,emitEvent(event));}}module[_0x55be('0x5')]=VoiceExtensionEvents; \ No newline at end of file +var _0x3191=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','remove'];(function(_0x3b8d95,_0xa2a85d){var _0x31a04d=function(_0x3b6351){while(--_0x3b6351){_0x3b8d95['push'](_0x3b8d95['shift']());}};_0x31a04d(++_0xa2a85d);}(_0x3191,0xc1));var _0x1319=function(_0x70400f,_0x7af8d6){_0x70400f=_0x70400f-0x0;var _0xcbe827=_0x3191[_0x70400f];return _0xcbe827;};'use strict';var EventEmitter=require(_0x1319('0x0'));var VoiceExtension=require(_0x1319('0x1'))['db'][_0x1319('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x1319('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x1319('0x4')};function emitEvent(_0x3aa540){return function(_0x11a531,_0xb58231,_0x5aba1d){VoiceExtensionEvents[_0x1319('0x5')](_0x3aa540+':'+_0x11a531['id'],_0x11a531);VoiceExtensionEvents[_0x1319('0x5')](_0x3aa540,_0x11a531);_0x5aba1d(null);};}for(var e in events){if(events[_0x1319('0x6')](e)){var event=events[e];VoiceExtension[_0x1319('0x7')](e,emitEvent(event));}}module[_0x1319('0x8')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 4320669..3c9fc65 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 _0xd670=['replace','isEmpty','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','playback','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','outboundDial','appdata','priority','last','concat','catch','define','VoiceExtension','then','Hangup','util','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push','CDR(routeid)=','context','exten','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','url','split','length','param','phone','prefix','SIP','join','U(xcally-mixmonitor-context)'];(function(_0x4d0812,_0x3dd7a8){var _0x505107=function(_0x292490){while(--_0x292490){_0x4d0812['push'](_0x4d0812['shift']());}};_0x505107(++_0x3dd7a8);}(_0xd670,0xc2));var _0x0d67=function(_0x3eeda3,_0x44105c){_0x3eeda3=_0x3eeda3-0x0;var _0x3131d4=_0xd670[_0x3eeda3];return _0x3131d4;};'use strict';var util=require(_0x0d67('0x0'));var _=require(_0x0d67('0x1'));var attributes=require(_0x0d67('0x2'));module[_0x0d67('0x3')]=function(_0x124f12){var _0x9475b5=_0x124f12[_0x0d67('0x4')];function _0x500d86(_0x3db57b){var _0x8d50da=0x2;var _0x2d12f0=[{'type':_0x3db57b[_0x0d67('0x5')],'app':_0x0d67('0x6'),'appdata':_0x0d67('0x7')+_0x3db57b['type'],'context':_0x3db57b['context'],'exten':_0x3db57b['exten'],'priority':_0x8d50da++,'VoiceExtensionId':_0x3db57b['id']},{'type':_0x3db57b[_0x0d67('0x5')],'app':_0x3db57b[_0x0d67('0x8')]?_0x0d67('0x6'):_0x0d67('0x9'),'appdata':_0x3db57b[_0x0d67('0x8')]?_0x0d67('0xa')+_0x3db57b['alias']:_0x0d67('0xb'),'context':_0x3db57b['context'],'exten':_0x3db57b['exten'],'priority':_0x8d50da++,'VoiceExtensionId':_0x3db57b['id']}];if(_0x3db57b[_0x0d67('0x5')]===_0x0d67('0xc')){_0x2d12f0[_0x0d67('0xd')]({'type':_0x0d67('0xc'),'app':_0x0d67('0x6'),'appdata':_0x0d67('0xe')+_0x3db57b['id'],'context':_0x3db57b[_0x0d67('0xf')],'exten':_0x3db57b[_0x0d67('0x10')],'priority':_0x8d50da++,'VoiceExtensionId':_0x3db57b['id']});}_0x2d12f0[_0x0d67('0xd')]({'type':_0x3db57b['type'],'app':'Set','appdata':_0x0d67('0x11'),'context':_0x3db57b[_0x0d67('0xf')],'exten':_0x3db57b[_0x0d67('0x10')],'priority':_0x8d50da++,'VoiceExtensionId':_0x3db57b['id']},{'type':_0x3db57b[_0x0d67('0x5')],'app':_0x0d67('0x6'),'appdata':_0x0d67('0x12'),'context':_0x3db57b[_0x0d67('0xf')],'exten':_0x3db57b[_0x0d67('0x10')],'priority':_0x8d50da++,'VoiceExtensionId':_0x3db57b['id']},{'type':_0x3db57b[_0x0d67('0x5')],'app':_0x0d67('0x6'),'appdata':'MONITOR_OPTIONS=ab','context':_0x3db57b[_0x0d67('0xf')],'exten':_0x3db57b[_0x0d67('0x10')],'priority':_0x8d50da++,'VoiceExtensionId':_0x3db57b['id']});return _0x2d12f0;}function _0x4fd82a(_0x37ce04){var _0xb32672=0x2;var _0x1764ac=[{'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':_0x0d67('0x14'),'context':_0x37ce04['context'],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x37ce04[_0x0d67('0x8')]?'Set':_0x0d67('0x9'),'appdata':_0x37ce04[_0x0d67('0x8')]?_0x0d67('0xa')+_0x37ce04['alias']:_0x0d67('0xb'),'context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':_0x0d67('0x15')+(_0x37ce04['cutdigits']?_0x0d67('0x16')+_0x37ce04[_0x0d67('0x17')]+'}':_0x0d67('0x18')),'context':_0x37ce04['context'],'exten':_0x37ce04['exten'],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':'CDR(routeid)='+_0x37ce04['id'],'context':_0x37ce04['context'],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x0d67('0x19'),'appdata':_0x0d67('0x1a')+(_0xb32672+0x2)+_0x0d67('0x1b')+(_0xb32672+0x1)+')','context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':'Set','appdata':_0x37ce04['cutdigits']?_0x0d67('0x1c')+_0x37ce04[_0x0d67('0x17')]+'}':_0x0d67('0x1d'),'context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':'outbound','app':_0x0d67('0x6'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':_0x0d67('0x12'),'context':_0x37ce04['context'],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':_0x0d67('0x1e'),'context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':'outboundrouteid='+_0x37ce04['id'],'context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04[_0x0d67('0x10')],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']}];if(_0x37ce04[_0x0d67('0x1f')](_0x0d67('0x20'))&&_0x37ce04[_0x0d67('0x20')]!==_0x0d67('0x21')){_0x1764ac[_0x0d67('0xd')]({'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':_0x0d67('0x22'),'context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04['exten'],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']},{'type':_0x0d67('0x13'),'app':_0x0d67('0x6'),'appdata':_0x0d67('0x23')+_0x37ce04['recordingFormat']||_0x0d67('0x24'),'context':_0x37ce04[_0x0d67('0xf')],'exten':_0x37ce04['exten'],'priority':_0xb32672++,'VoiceExtensionId':_0x37ce04['id']});}return _0x1764ac;}function _0x1f42a6(_0x73323c){var _0x4f66ef=[{'name':_0x0d67('0x25'),'param':0x0},{'name':_0x0d67('0x26'),'param':0x1},{'name':_0x0d67('0x27'),'param':0x2},{'name':_0x0d67('0x28'),'param':0x3}];var _0x3d1f38={};var _0x27e71a=_0x73323c[_0x0d67('0x29')](',');var _0x517f52=[];for(var _0x37888b=0x0;_0x37888b<_0x4f66ef[_0x0d67('0x2a')];_0x37888b++){switch(_0x4f66ef[_0x37888b]['name']){case _0x0d67('0x25'):_0x3d1f38['trunk']=_0x27e71a[_0x4f66ef[_0x37888b][_0x0d67('0x2b')]][_0x0d67('0x29')]('/')[0x1];_0x3d1f38[_0x0d67('0x2c')]=_0x27e71a[_0x4f66ef[_0x37888b]['param']]['split']('/')[0x2];_0x3d1f38[_0x0d67('0x2d')]=_0x3d1f38['phone']?_0x3d1f38['phone'][_0x0d67('0x29')]('$')[0x0]:undefined;_0x3d1f38[_0x0d67('0x2c')]=route[_0x0d67('0x17')]?(_0x3d1f38[_0x0d67('0x2d')]||'')+_0x0d67('0x16')+route['cutdigits']+'}':(_0x3d1f38[_0x0d67('0x2d')]||'')+'${EXTEN}';_0x517f52[_0x4f66ef[_0x37888b][_0x0d67('0x2b')]]=[_0x0d67('0x2e'),_0x3d1f38[_0x0d67('0x25')],_0x3d1f38[_0x0d67('0x2c')]][_0x0d67('0x2f')]('/');break;case _0x0d67('0x27'):_0x3d1f38[_0x0d67('0x27')]=_0x27e71a[_0x4f66ef[_0x37888b][_0x0d67('0x2b')]];if(route[_0x0d67('0x20')]!==_0x0d67('0x21')){if(_0x3d1f38[_0x0d67('0x27')]['indexOf'](_0x0d67('0x30'))<0x0){_0x3d1f38[_0x0d67('0x27')]+=_0x0d67('0x30');}}else{_0x3d1f38[_0x0d67('0x27')]=_0x3d1f38['options'][_0x0d67('0x31')](_0x0d67('0x30'),'');}_0x517f52[_0x4f66ef[_0x37888b][_0x0d67('0x2b')]]=_0x3d1f38[_0x0d67('0x27')];break;default:_0x517f52[_0x4f66ef[_0x37888b][_0x0d67('0x2b')]]=_0x27e71a[_0x4f66ef[_0x37888b]['param']];}}return _0x517f52['join'](',');}function _0x198a8c(_0x4ec527,_0x1aa55d,_0x2ecd96,_0x4fd4ff){return new Promise(function(_0x1db947,_0x56f86e){var _0x16cb3c=[];if(_[_0x0d67('0x32')](_0x1aa55d))return _0x1db947(_0x16cb3c);_0x9475b5['Interval']['findAll']({'attributes':['id',_0x0d67('0x33'),_0x0d67('0x34')],'raw':!![]})['then'](function(_0x4298be){for(var _0x3c247b=0x0,_0x1a8662=0x0;_0x3c247b<_0x1aa55d[_0x0d67('0x2a')];_0x3c247b++,_0x1a8662=0x0){var _0x5592f6=_0x1aa55d[_0x3c247b];var _0x2c4371=[];var _0x1c4fe2=[];if(_0x5592f6[_0x0d67('0x33')]!==_0x0d67('0x35')){_0x5592f6[_0x0d67('0x36')]=[_0x5592f6['interval']];}else{_0x5592f6[_0x0d67('0x36')]=_0x5592f6[_0x0d67('0x34')]?_[_0x0d67('0x37')](_[_0x0d67('0x38')](_0x4298be,{'IntervalId':_0x5592f6[_0x0d67('0x34')]}),_0x0d67('0x33')):[];}_0x5592f6[_0x0d67('0xf')]=_0x4ec527[_0x0d67('0xf')];_0x5592f6['exten']=_0x4ec527[_0x0d67('0x10')];if(_0x5592f6[_0x0d67('0x5')])_0x5592f6[_0x0d67('0x5')]=_0x5592f6['type'][_0x0d67('0x39')]();if(_0x4ec527['type']==='outbound'){if(_0x5592f6['hasOwnProperty'](_0x0d67('0x3a'))&&_0x5592f6['tag']&&_0x5592f6[_0x0d67('0x3a')]!=='--'){_0x2c4371[_0x0d67('0xd')]({'type':_0x5592f6[_0x0d67('0x5')][_0x0d67('0x39')](),'app':_0x0d67('0x6'),'appdata':_0x0d67('0x3b')+_0x5592f6[_0x0d67('0x3a')],'context':_0x4ec527['context'],'exten':_0x4ec527[_0x0d67('0x10')],'priority':_0x5592f6['intervals'][_0x0d67('0x2a')]+_0x2ecd96+_0x1a8662++,'VoiceExtensionId':_0x4ec527['id']});}_0x2c4371[_0x0d67('0xd')]({'type':_0x5592f6[_0x0d67('0x5')][_0x0d67('0x39')](),'app':_0x0d67('0x19'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x5592f6[_0x0d67('0x3c')]?'Set(CALLERID(all)='+_0x5592f6[_0x0d67('0x3c')]+')':_0x0d67('0x3d')),'context':_0x4ec527[_0x0d67('0xf')],'exten':_0x4ec527[_0x0d67('0x10')],'priority':_0x5592f6['intervals']['length']+_0x2ecd96+_0x1a8662++,'VoiceExtensionId':_0x4ec527['id']});}else{if(_0x5592f6[_0x0d67('0x1f')](_0x0d67('0x3e'))){if(['queue',_0x0d67('0x3f')]['includes'](_0x5592f6[_0x0d67('0x40')]['toLowerCase']())&&_0x5592f6[_0x0d67('0x41')]!==_0x0d67('0x42')){if(_0x5592f6[_0x0d67('0x3e')]){_0x2c4371[_0x0d67('0xd')]({'type':_0x5592f6[_0x0d67('0x5')][_0x0d67('0x39')](),'app':_0x0d67('0x19'),'appdata':_0x0d67('0x43'),'context':_0x4ec527['context'],'exten':_0x4ec527[_0x0d67('0x10')],'priority':_0x5592f6['intervals'][_0x0d67('0x2a')]+_0x2ecd96+_0x1a8662++,'VoiceExtensionId':_0x4ec527['id']});_0x2c4371['push']({'type':_0x5592f6[_0x0d67('0x5')]['toLowerCase'](),'app':_0x0d67('0x6'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4ec527['context'],'exten':_0x4ec527['exten'],'priority':_0x5592f6[_0x0d67('0x36')][_0x0d67('0x2a')]+_0x2ecd96+_0x1a8662++,'VoiceExtensionId':_0x4ec527['id']});}else{_0x2c4371[_0x0d67('0xd')]({'type':_0x5592f6[_0x0d67('0x5')][_0x0d67('0x39')](),'app':_0x0d67('0x19'),'appdata':_0x0d67('0x44'),'context':_0x4ec527[_0x0d67('0xf')],'exten':_0x4ec527[_0x0d67('0x10')],'priority':_0x5592f6['intervals']['length']+_0x2ecd96+_0x1a8662++,'VoiceExtensionId':_0x4ec527['id']});_0x2c4371[_0x0d67('0xd')]({'type':_0x5592f6[_0x0d67('0x5')][_0x0d67('0x39')](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4ec527['context'],'exten':_0x4ec527['exten'],'priority':_0x5592f6[_0x0d67('0x36')][_0x0d67('0x2a')]+_0x2ecd96+_0x1a8662++,'VoiceExtensionId':_0x4ec527['id']});}}}}for(var _0x30c058=0x0;_0x30c058<_0x5592f6['intervals'][_0x0d67('0x2a')];_0x30c058++){var _0x5b3d82=_0x2ecd96+_0x5592f6[_0x0d67('0x36')][_0x0d67('0x2a')];var _0x4739e8=_0x30c058===_0x5592f6[_0x0d67('0x36')]['length']-0x1?_0x2ecd96+_0x2c4371[_0x0d67('0x2a')]+_0x1c4fe2[_0x0d67('0x2a')]+0x2:_0x2ecd96+_0x30c058+0x1;_0x2c4371[_0x0d67('0x45')](_0x30c058,0x0,{'type':_0x4ec527[_0x0d67('0x5')],'app':'GotoIfTime','appdata':_0x5592f6[_0x0d67('0x36')][_0x30c058]+'?'+_0x4ec527['context']+',${EXTEN},'+_0x5b3d82+':'+_0x4ec527['context']+_0x0d67('0x46')+_0x4739e8,'exten':_0x4ec527[_0x0d67('0x10')],'context':_0x4ec527[_0x0d67('0xf')],'priority':_0x2ecd96+_0x30c058,'VoiceExtensionId':_0x4ec527['id']});}if(_0x4fd4ff&&_0x5592f6['appType']===_0x0d67('0x47'))_0x5592f6[_0x0d67('0x48')]=_0x1f42a6(_0x5592f6[_0x0d67('0x48')]);_0x5592f6[_0x0d67('0x49')]=_0x2c4371[_0x0d67('0x2a')]?_[_0x0d67('0x4a')](_0x2c4371)[_0x0d67('0x49')]+0x1:_0x2ecd96;_0x16cb3c=_[_0x0d67('0x4b')](_0x16cb3c,_0x2c4371,[_0x5592f6],_0x1c4fe2);_0x2ecd96=_[_0x0d67('0x4a')](_0x16cb3c)[_0x0d67('0x49')]+0x1;}return _0x1db947(_0x16cb3c);})[_0x0d67('0x4c')](function(_0xb38b18){_0x56f86e(_0xb38b18);});});}return _0x124f12[_0x0d67('0x4d')](_0x0d67('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x110122,_0x8bbcfa){var _0x518334=this;var _0x3294c5=_0x518334[_0x0d67('0x5')]==='outbound'?_0x4fd82a(_0x518334):_0x500d86(_0x518334);return _0x198a8c(_0x518334,_0x110122,_[_0x0d67('0x4a')](_0x3294c5)[_0x0d67('0x49')]+0x1,_0x8bbcfa)[_0x0d67('0x4f')](function(_0x234e05){var _0x34249f=_['concat'](_0x3294c5,_0x234e05);_0x34249f['push']({'type':_0x518334[_0x0d67('0x5')],'app':_0x0d67('0x50'),'exten':_0x518334['exten'],'context':_0x518334[_0x0d67('0xf')],'priority':_[_0x0d67('0x4a')](_0x34249f)['priority']+0x1,'VoiceExtensionId':_0x518334['id']});return _0x34249f;});}}});}; \ No newline at end of file +var _0xa200=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','appType','outboundDial','appdata','priority','concat','last','catch','define','VoiceExtension','Hangup','util','lodash','./voiceExtension.attributes','exports','models','Set','CDR(type)=','type','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','options','url','split','length','name','trunk','param','prefix','phone','none','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','intervals','filter','toLowerCase','tag','CDR(tag)='];(function(_0x7d779e,_0x11aa44){var _0x5d643e=function(_0x33ea12){while(--_0x33ea12){_0x7d779e['push'](_0x7d779e['shift']());}};_0x5d643e(++_0x11aa44);}(_0xa200,0x111));var _0x0a20=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xa200[_0x40a045];return _0x1a687c;};'use strict';var util=require(_0x0a20('0x0'));var _=require(_0x0a20('0x1'));var attributes=require(_0x0a20('0x2'));module[_0x0a20('0x3')]=function(_0x2a2ada){var _0x15fc78=_0x2a2ada[_0x0a20('0x4')];function _0x229983(_0xfd1cdc){var _0x373c60=0x2;var _0x5d8ec0=[{'type':_0xfd1cdc['type'],'app':_0x0a20('0x5'),'appdata':_0x0a20('0x6')+_0xfd1cdc[_0x0a20('0x7')],'context':_0xfd1cdc['context'],'exten':_0xfd1cdc['exten'],'priority':_0x373c60++,'VoiceExtensionId':_0xfd1cdc['id']},{'type':_0xfd1cdc['type'],'app':_0xfd1cdc[_0x0a20('0x8')]?'Set':_0x0a20('0x9'),'appdata':_0xfd1cdc[_0x0a20('0x8')]?_0x0a20('0xa')+_0xfd1cdc['alias']:_0x0a20('0xb'),'context':_0xfd1cdc[_0x0a20('0xc')],'exten':_0xfd1cdc[_0x0a20('0xd')],'priority':_0x373c60++,'VoiceExtensionId':_0xfd1cdc['id']}];if(_0xfd1cdc[_0x0a20('0x7')]===_0x0a20('0xe')){_0x5d8ec0[_0x0a20('0xf')]({'type':'inbound','app':'Set','appdata':_0x0a20('0x10')+_0xfd1cdc['id'],'context':_0xfd1cdc[_0x0a20('0xc')],'exten':_0xfd1cdc[_0x0a20('0xd')],'priority':_0x373c60++,'VoiceExtensionId':_0xfd1cdc['id']});}_0x5d8ec0['push']({'type':_0xfd1cdc['type'],'app':_0x0a20('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xfd1cdc[_0x0a20('0xc')],'exten':_0xfd1cdc[_0x0a20('0xd')],'priority':_0x373c60++,'VoiceExtensionId':_0xfd1cdc['id']},{'type':_0xfd1cdc[_0x0a20('0x7')],'app':_0x0a20('0x5'),'appdata':_0x0a20('0x11'),'context':_0xfd1cdc[_0x0a20('0xc')],'exten':_0xfd1cdc[_0x0a20('0xd')],'priority':_0x373c60++,'VoiceExtensionId':_0xfd1cdc['id']},{'type':_0xfd1cdc[_0x0a20('0x7')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0xfd1cdc[_0x0a20('0xc')],'exten':_0xfd1cdc['exten'],'priority':_0x373c60++,'VoiceExtensionId':_0xfd1cdc['id']});return _0x5d8ec0;}function _0x2df52e(_0x58cffa){var _0x26df70=0x2;var _0x3b152f=[{'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':_0x0a20('0x13'),'context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':'outbound','app':_0x58cffa[_0x0a20('0x8')]?'Set':_0x0a20('0x9'),'appdata':_0x58cffa[_0x0a20('0x8')]?_0x0a20('0xa')+_0x58cffa['alias']:_0x0a20('0xb'),'context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':_0x0a20('0x14')+(_0x58cffa[_0x0a20('0x15')]?_0x0a20('0x16')+_0x58cffa[_0x0a20('0x15')]+'}':_0x0a20('0x17')),'context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':'outbound','app':_0x0a20('0x5'),'appdata':_0x0a20('0x10')+_0x58cffa['id'],'context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':_0x0a20('0x12'),'app':_0x0a20('0x18'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x26df70+0x2)+_0x0a20('0x19')+(_0x26df70+0x1)+')','context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa['exten'],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':_0x58cffa[_0x0a20('0x15')]?_0x0a20('0x1a')+_0x58cffa[_0x0a20('0x15')]+'}':_0x0a20('0x1b'),'context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':'outbound','app':'Set','appdata':_0x0a20('0x1c'),'context':_0x58cffa['context'],'exten':_0x58cffa['exten'],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa['exten'],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':_0x0a20('0x1d'),'context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':_0x0a20('0x1e')+_0x58cffa['id'],'context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa['exten'],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']}];if(_0x58cffa[_0x0a20('0x1f')]('recordingFormat')&&_0x58cffa[_0x0a20('0x20')]!=='none'){_0x3b152f[_0x0a20('0xf')]({'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']},{'type':_0x0a20('0x12'),'app':_0x0a20('0x5'),'appdata':_0x0a20('0x21')+_0x58cffa[_0x0a20('0x20')]||'wav','context':_0x58cffa[_0x0a20('0xc')],'exten':_0x58cffa[_0x0a20('0xd')],'priority':_0x26df70++,'VoiceExtensionId':_0x58cffa['id']});}return _0x3b152f;}function _0x19ef6e(_0x568033){var _0x3ac397=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x0a20('0x22'),'param':0x2},{'name':_0x0a20('0x23'),'param':0x3}];var _0x16097b={};var _0x146bac=_0x568033[_0x0a20('0x24')](',');var _0x582baa=[];for(var _0x137550=0x0;_0x137550<_0x3ac397[_0x0a20('0x25')];_0x137550++){switch(_0x3ac397[_0x137550][_0x0a20('0x26')]){case _0x0a20('0x27'):_0x16097b[_0x0a20('0x27')]=_0x146bac[_0x3ac397[_0x137550][_0x0a20('0x28')]][_0x0a20('0x24')]('/')[0x1];_0x16097b['phone']=_0x146bac[_0x3ac397[_0x137550][_0x0a20('0x28')]][_0x0a20('0x24')]('/')[0x2];_0x16097b[_0x0a20('0x29')]=_0x16097b['phone']?_0x16097b[_0x0a20('0x2a')][_0x0a20('0x24')]('$')[0x0]:undefined;_0x16097b[_0x0a20('0x2a')]=route[_0x0a20('0x15')]?(_0x16097b['prefix']||'')+_0x0a20('0x16')+route[_0x0a20('0x15')]+'}':(_0x16097b[_0x0a20('0x29')]||'')+_0x0a20('0x17');_0x582baa[_0x3ac397[_0x137550][_0x0a20('0x28')]]=['SIP',_0x16097b[_0x0a20('0x27')],_0x16097b[_0x0a20('0x2a')]]['join']('/');break;case'options':_0x16097b[_0x0a20('0x22')]=_0x146bac[_0x3ac397[_0x137550][_0x0a20('0x28')]];if(route[_0x0a20('0x20')]!==_0x0a20('0x2b')){if(_0x16097b[_0x0a20('0x22')][_0x0a20('0x2c')]('U(xcally-mixmonitor-context)')<0x0){_0x16097b['options']+=_0x0a20('0x2d');}}else{_0x16097b['options']=_0x16097b['options'][_0x0a20('0x2e')](_0x0a20('0x2d'),'');}_0x582baa[_0x3ac397[_0x137550][_0x0a20('0x28')]]=_0x16097b[_0x0a20('0x22')];break;default:_0x582baa[_0x3ac397[_0x137550][_0x0a20('0x28')]]=_0x146bac[_0x3ac397[_0x137550]['param']];}}return _0x582baa[_0x0a20('0x2f')](',');}function _0x55f021(_0x4bb1d2,_0x31d95c,_0x2690e7,_0x35f4e2){return new Promise(function(_0x35c696,_0x11a4dd){var _0x27334b=[];if(_[_0x0a20('0x30')](_0x31d95c))return _0x35c696(_0x27334b);_0x15fc78[_0x0a20('0x31')][_0x0a20('0x32')]({'attributes':['id',_0x0a20('0x33'),_0x0a20('0x34')],'raw':!![]})[_0x0a20('0x35')](function(_0x23dd51){for(var _0x3840d9=0x0,_0x2f1372=0x0;_0x3840d9<_0x31d95c[_0x0a20('0x25')];_0x3840d9++,_0x2f1372=0x0){var _0xe50ba9=_0x31d95c[_0x3840d9];var _0x51269c=[];var _0x9453f2=[];if(_0xe50ba9[_0x0a20('0x33')]!=='*,*,*,*'){_0xe50ba9['intervals']=[_0xe50ba9['interval']];}else{_0xe50ba9[_0x0a20('0x36')]=_0xe50ba9[_0x0a20('0x34')]?_['map'](_[_0x0a20('0x37')](_0x23dd51,{'IntervalId':_0xe50ba9[_0x0a20('0x34')]}),_0x0a20('0x33')):[];}_0xe50ba9[_0x0a20('0xc')]=_0x4bb1d2[_0x0a20('0xc')];_0xe50ba9[_0x0a20('0xd')]=_0x4bb1d2['exten'];if(_0xe50ba9[_0x0a20('0x7')])_0xe50ba9['type']=_0xe50ba9[_0x0a20('0x7')][_0x0a20('0x38')]();if(_0x4bb1d2[_0x0a20('0x7')]===_0x0a20('0x12')){if(_0xe50ba9[_0x0a20('0x1f')](_0x0a20('0x39'))&&_0xe50ba9[_0x0a20('0x39')]&&_0xe50ba9[_0x0a20('0x39')]!=='--'){_0x51269c[_0x0a20('0xf')]({'type':_0xe50ba9[_0x0a20('0x7')][_0x0a20('0x38')](),'app':_0x0a20('0x5'),'appdata':_0x0a20('0x3a')+_0xe50ba9['tag'],'context':_0x4bb1d2[_0x0a20('0xc')],'exten':_0x4bb1d2['exten'],'priority':_0xe50ba9[_0x0a20('0x36')]['length']+_0x2690e7+_0x2f1372++,'VoiceExtensionId':_0x4bb1d2['id']});}_0x51269c[_0x0a20('0xf')]({'type':_0xe50ba9[_0x0a20('0x7')][_0x0a20('0x38')](),'app':_0x0a20('0x18'),'appdata':_0x0a20('0x3b')+(_0xe50ba9[_0x0a20('0x3c')]?_0x0a20('0x3d')+_0xe50ba9[_0x0a20('0x3c')]+')':_0x0a20('0x3e')),'context':_0x4bb1d2[_0x0a20('0xc')],'exten':_0x4bb1d2[_0x0a20('0xd')],'priority':_0xe50ba9[_0x0a20('0x36')]['length']+_0x2690e7+_0x2f1372++,'VoiceExtensionId':_0x4bb1d2['id']});}else{if(_0xe50ba9['hasOwnProperty']('answer')){if(['queue',_0x0a20('0x3f')][_0x0a20('0x40')](_0xe50ba9[_0x0a20('0x41')]['toLowerCase']())&&_0xe50ba9['appType']!==_0x0a20('0x42')){if(_0xe50ba9[_0x0a20('0x43')]){_0x51269c['push']({'type':_0xe50ba9[_0x0a20('0x7')][_0x0a20('0x38')](),'app':_0x0a20('0x18'),'appdata':_0x0a20('0x44'),'context':_0x4bb1d2[_0x0a20('0xc')],'exten':_0x4bb1d2[_0x0a20('0xd')],'priority':_0xe50ba9['intervals']['length']+_0x2690e7+_0x2f1372++,'VoiceExtensionId':_0x4bb1d2['id']});_0x51269c[_0x0a20('0xf')]({'type':_0xe50ba9[_0x0a20('0x7')][_0x0a20('0x38')](),'app':_0x0a20('0x5'),'appdata':_0x0a20('0x45'),'context':_0x4bb1d2[_0x0a20('0xc')],'exten':_0x4bb1d2[_0x0a20('0xd')],'priority':_0xe50ba9[_0x0a20('0x36')]['length']+_0x2690e7+_0x2f1372++,'VoiceExtensionId':_0x4bb1d2['id']});}else{_0x51269c['push']({'type':_0xe50ba9['type'][_0x0a20('0x38')](),'app':_0x0a20('0x18'),'appdata':_0x0a20('0x46'),'context':_0x4bb1d2[_0x0a20('0xc')],'exten':_0x4bb1d2[_0x0a20('0xd')],'priority':_0xe50ba9[_0x0a20('0x36')][_0x0a20('0x25')]+_0x2690e7+_0x2f1372++,'VoiceExtensionId':_0x4bb1d2['id']});_0x51269c[_0x0a20('0xf')]({'type':_0xe50ba9[_0x0a20('0x7')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x4bb1d2[_0x0a20('0xc')],'exten':_0x4bb1d2['exten'],'priority':_0xe50ba9[_0x0a20('0x36')][_0x0a20('0x25')]+_0x2690e7+_0x2f1372++,'VoiceExtensionId':_0x4bb1d2['id']});}}}}for(var _0x3b2ddb=0x0;_0x3b2ddb<_0xe50ba9[_0x0a20('0x36')]['length'];_0x3b2ddb++){var _0x1f50d6=_0x2690e7+_0xe50ba9[_0x0a20('0x36')][_0x0a20('0x25')];var _0xa93645=_0x3b2ddb===_0xe50ba9[_0x0a20('0x36')][_0x0a20('0x25')]-0x1?_0x2690e7+_0x51269c[_0x0a20('0x25')]+_0x9453f2[_0x0a20('0x25')]+0x2:_0x2690e7+_0x3b2ddb+0x1;_0x51269c[_0x0a20('0x47')](_0x3b2ddb,0x0,{'type':_0x4bb1d2[_0x0a20('0x7')],'app':'GotoIfTime','appdata':_0xe50ba9[_0x0a20('0x36')][_0x3b2ddb]+'?'+_0x4bb1d2[_0x0a20('0xc')]+_0x0a20('0x48')+_0x1f50d6+':'+_0x4bb1d2[_0x0a20('0xc')]+_0x0a20('0x48')+_0xa93645,'exten':_0x4bb1d2[_0x0a20('0xd')],'context':_0x4bb1d2[_0x0a20('0xc')],'priority':_0x2690e7+_0x3b2ddb,'VoiceExtensionId':_0x4bb1d2['id']});}if(_0x35f4e2&&_0xe50ba9[_0x0a20('0x49')]===_0x0a20('0x4a'))_0xe50ba9[_0x0a20('0x4b')]=_0x19ef6e(_0xe50ba9[_0x0a20('0x4b')]);_0xe50ba9[_0x0a20('0x4c')]=_0x51269c[_0x0a20('0x25')]?_['last'](_0x51269c)[_0x0a20('0x4c')]+0x1:_0x2690e7;_0x27334b=_[_0x0a20('0x4d')](_0x27334b,_0x51269c,[_0xe50ba9],_0x9453f2);_0x2690e7=_[_0x0a20('0x4e')](_0x27334b)[_0x0a20('0x4c')]+0x1;}return _0x35c696(_0x27334b);})[_0x0a20('0x4f')](function(_0x51cdd8){_0x11a4dd(_0x51cdd8);});});}return _0x2a2ada[_0x0a20('0x50')](_0x0a20('0x51'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x3d76cc,_0x2b4584){var _0x5d112b=this;var _0x2b68c1=_0x5d112b['type']==='outbound'?_0x2df52e(_0x5d112b):_0x229983(_0x5d112b);return _0x55f021(_0x5d112b,_0x3d76cc,_[_0x0a20('0x4e')](_0x2b68c1)[_0x0a20('0x4c')]+0x1,_0x2b4584)[_0x0a20('0x35')](function(_0x583d8f){var _0x35deeb=_[_0x0a20('0x4d')](_0x2b68c1,_0x583d8f);_0x35deeb[_0x0a20('0xf')]({'type':_0x5d112b[_0x0a20('0x7')],'app':_0x0a20('0x52'),'exten':_0x5d112b[_0x0a20('0xd')],'context':_0x5d112b[_0x0a20('0xc')],'priority':_[_0x0a20('0x4e')](_0x35deeb)[_0x0a20('0x4c')]+0x1,'VoiceExtensionId':_0x5d112b['id']});return _0x35deeb;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 5a14732..239c1c8 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 _0x7409=['model','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','then','info','error','VoiceExtension,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','where','attributes','limit','include','map'];(function(_0x595665,_0xeef749){var _0xfe2a65=function(_0x5216d6){while(--_0x5216d6){_0x595665['push'](_0x595665['shift']());}};_0xfe2a65(++_0xeef749);}(_0x7409,0x6e));var _0x9740=function(_0x31bf4a,_0x51eb5f){_0x31bf4a=_0x31bf4a-0x0;var _0x2265ec=_0x7409[_0x31bf4a];return _0x2265ec;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var moment=require('moment');var BPromise=require(_0x9740('0x2'));var rs=require(_0x9740('0x3'));var fs=require('fs');var Redis=require(_0x9740('0x4'));var db=require(_0x9740('0x5'))['db'];var utils=require(_0x9740('0x6'));var logger=require(_0x9740('0x7'))(_0x9740('0x8'));var config=require(_0x9740('0x9'));var jayson=require(_0x9740('0xa'));var client=jayson['client'][_0x9740('0xb')]({'port':0x232a});config[_0x9740('0xc')]=_[_0x9740('0xd')](config['redis'],{'host':_0x9740('0xe'),'port':0x18eb});var socket=require(_0x9740('0xf'))(new Redis(config[_0x9740('0xc')]));require('./voiceExtension.socket')[_0x9740('0x10')](socket);function respondWithRpcPromise(_0x548bf8,_0x1a6ff9,_0xc27c18){return new BPromise(function(_0x4e39f9,_0x59dd44){return client['request'](_0x548bf8,_0xc27c18)[_0x9740('0x11')](function(_0x3bc357){logger[_0x9740('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent');logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent',JSON['stringify'](_0x3bc357));if(_0x3bc357['error']){if(_0x3bc357[_0x9740('0x13')]['code']===0x1f4){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x3bc357['error'][_0x9740('0x15')]);return _0x59dd44(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}logger[_0x9740('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x1a6ff9,_0x3bc357[_0x9740('0x13')]['message']);return _0x4e39f9(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}else{logger[_0x9740('0x12')](_0x9740('0x14'),_0x1a6ff9,_0x9740('0x16'));_0x4e39f9(_0x3bc357[_0x9740('0x17')][_0x9740('0x15')]);}})[_0x9740('0x18')](function(_0x206c4d){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x206c4d);_0x59dd44(_0x206c4d);});});}exports[_0x9740('0x19')]=function(_0x3fb57c){var _0x31d4f7=this;return new Promise(function(_0x3f9e9d,_0xdf62fc){return db[_0x9740('0x1a')][_0x9740('0x1b')]({'raw':_0x3fb57c['options']?_0x3fb57c[_0x9740('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb57c[_0x9740('0x1c')]?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x1d')]||null:null,'attributes':_0x3fb57c[_0x9740('0x1c')]?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x1e')]||null:null,'limit':_0x3fb57c['options']?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x1f')]||null:null,'include':_0x3fb57c[_0x9740('0x1c')]?_0x3fb57c[_0x9740('0x1c')][_0x9740('0x20')]?_[_0x9740('0x21')](_0x3fb57c[_0x9740('0x1c')][_0x9740('0x20')],function(_0x11ee90){return{'model':db[_0x11ee90['model']],'as':_0x11ee90['as'],'attributes':_0x11ee90[_0x9740('0x1e')],'include':_0x11ee90['include']?_['map'](_0x11ee90['include'],function(_0x4d2e0d){return{'model':db[_0x4d2e0d[_0x9740('0x22')]],'as':_0x4d2e0d['as'],'attributes':_0x4d2e0d[_0x9740('0x1e')],'include':_0x4d2e0d[_0x9740('0x20')]?_['map'](_0x4d2e0d[_0x9740('0x20')],function(_0x353630){return{'model':db[_0x353630[_0x9740('0x22')]],'as':_0x353630['as'],'attributes':_0x353630[_0x9740('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bfa1f){logger[_0x9740('0x12')](_0x9740('0x19'),_0x3fb57c);logger['debug'](_0x9740('0x19'),_0x3fb57c,JSON[_0x9740('0x23')](_0x3bfa1f));_0x3f9e9d(_0x3bfa1f);})[_0x9740('0x18')](function(_0x2bba86){logger[_0x9740('0x13')](_0x9740('0x19'),_0x2bba86[_0x9740('0x15')],_0x3fb57c);_0xdf62fc(_0x31d4f7[_0x9740('0x13')](0x1f4,_0x2bba86[_0x9740('0x15')]));});});}; \ No newline at end of file +var _0x00f0=['request\x20sent','result','catch','GetVoiceExtension','findAll','options','where','limit','include','map','model','attributes','then','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','VoiceExtension,\x20%s,\x20%s'];(function(_0x461f2d,_0x5eb2e4){var _0x10abc8=function(_0x48670c){while(--_0x48670c){_0x461f2d['push'](_0x461f2d['shift']());}};_0x10abc8(++_0x5eb2e4);}(_0x00f0,0xec));var _0x000f=function(_0xcc4e53,_0x2a24c5){_0xcc4e53=_0xcc4e53-0x0;var _0x20587d=_0x00f0[_0xcc4e53];return _0x20587d;};'use strict';var _=require(_0x000f('0x0'));var util=require(_0x000f('0x1'));var moment=require(_0x000f('0x2'));var BPromise=require(_0x000f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x000f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x000f('0x5'))('rpc');var config=require(_0x000f('0x6'));var jayson=require(_0x000f('0x7'));var client=jayson['client'][_0x000f('0x8')]({'port':0x232a});config[_0x000f('0x9')]=_[_0x000f('0xa')](config[_0x000f('0x9')],{'host':_0x000f('0xb'),'port':0x18eb});var socket=require(_0x000f('0xc'))(new Redis(config[_0x000f('0x9')]));require(_0x000f('0xd'))[_0x000f('0xe')](socket);function respondWithRpcPromise(_0x278cd8,_0x190417,_0x504f65){return new BPromise(function(_0x59749b,_0x1a8ebf){return client[_0x000f('0xf')](_0x278cd8,_0x504f65)['then'](function(_0x2bac47){logger[_0x000f('0x10')]('VoiceExtension,\x20%s,\x20%s',_0x190417,'request\x20sent');logger[_0x000f('0x11')](_0x000f('0x12'),_0x190417,'request\x20sent',JSON['stringify'](_0x2bac47));if(_0x2bac47[_0x000f('0x13')]){if(_0x2bac47[_0x000f('0x13')][_0x000f('0x14')]===0x1f4){logger[_0x000f('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x190417,_0x2bac47[_0x000f('0x13')]['message']);return _0x1a8ebf(_0x2bac47['error'][_0x000f('0x15')]);}logger['error'](_0x000f('0x16'),_0x190417,_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);return _0x59749b(_0x2bac47[_0x000f('0x13')][_0x000f('0x15')]);}else{logger[_0x000f('0x10')](_0x000f('0x16'),_0x190417,_0x000f('0x17'));_0x59749b(_0x2bac47[_0x000f('0x18')][_0x000f('0x15')]);}})[_0x000f('0x19')](function(_0x156342){logger[_0x000f('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x190417,_0x156342);_0x1a8ebf(_0x156342);});});}exports[_0x000f('0x1a')]=function(_0x26aad4){var _0x53f06f=this;return new Promise(function(_0x2cdb5c,_0x51e8c7){return db['VoiceExtension'][_0x000f('0x1b')]({'raw':_0x26aad4[_0x000f('0x1c')]?_0x26aad4[_0x000f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x26aad4['options']?_0x26aad4[_0x000f('0x1c')][_0x000f('0x1d')]||null:null,'attributes':_0x26aad4['options']?_0x26aad4[_0x000f('0x1c')]['attributes']||null:null,'limit':_0x26aad4[_0x000f('0x1c')]?_0x26aad4['options'][_0x000f('0x1e')]||null:null,'include':_0x26aad4[_0x000f('0x1c')]?_0x26aad4[_0x000f('0x1c')][_0x000f('0x1f')]?_[_0x000f('0x20')](_0x26aad4[_0x000f('0x1c')]['include'],function(_0x461d33){return{'model':db[_0x461d33[_0x000f('0x21')]],'as':_0x461d33['as'],'attributes':_0x461d33[_0x000f('0x22')],'include':_0x461d33['include']?_[_0x000f('0x20')](_0x461d33[_0x000f('0x1f')],function(_0x1d541b){return{'model':db[_0x1d541b[_0x000f('0x21')]],'as':_0x1d541b['as'],'attributes':_0x1d541b[_0x000f('0x22')],'include':_0x1d541b[_0x000f('0x1f')]?_[_0x000f('0x20')](_0x1d541b['include'],function(_0x11c2a2){return{'model':db[_0x11c2a2[_0x000f('0x21')]],'as':_0x11c2a2['as'],'attributes':_0x11c2a2[_0x000f('0x22')]};}):[]};}):[]};}):[]:[]})[_0x000f('0x23')](function(_0x49ac76){logger[_0x000f('0x10')]('GetVoiceExtension',_0x26aad4);logger[_0x000f('0x11')](_0x000f('0x1a'),_0x26aad4,JSON[_0x000f('0x24')](_0x49ac76));_0x2cdb5c(_0x49ac76);})[_0x000f('0x19')](function(_0x1532c8){logger['error'](_0x000f('0x1a'),_0x1532c8[_0x000f('0x15')],_0x26aad4);_0x51e8c7(_0x53f06f['error'](0x1f4,_0x1532c8[_0x000f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index a11e0cb..6fc87e5 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 _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x41a04f,_0x51e497){var _0x211f50=function(_0x28aa67){while(--_0x28aa67){_0x41a04f['push'](_0x41a04f['shift']());}};_0x211f50(++_0x51e497);}(_0x5fc3,0xa8));var _0x35fc=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x5fc3[_0x24061a];return _0x82054e;};'use strict';var VoiceExtensionEvents=require(_0x35fc('0x0'));var events=[_0x35fc('0x1'),'remove',_0x35fc('0x2')];function createListener(_0x2ac6da,_0x196bc2){return function(_0x91d024){_0x196bc2[_0x35fc('0x3')](_0x2ac6da,_0x91d024);};}function removeListener(_0x5e75e6,_0x2d1404){return function(){VoiceExtensionEvents[_0x35fc('0x4')](_0x5e75e6,_0x2d1404);};}exports[_0x35fc('0x5')]=function(_0x5b85ad){for(var _0x5754be=0x0,_0x19a0d1=events['length'];_0x5754be<_0x19a0d1;_0x5754be++){var _0x16e153=events[_0x5754be];var _0x27524f=createListener(_0x35fc('0x6')+_0x16e153,_0x5b85ad);VoiceExtensionEvents['on'](_0x16e153,_0x27524f);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x5ca5dc,_0x5a45dc){var _0x40050f=function(_0x9e8211){while(--_0x9e8211){_0x5ca5dc['push'](_0x5ca5dc['shift']());}};_0x40050f(++_0x5a45dc);}(_0x0295,0x1f0));var _0x5029=function(_0x3731a7,_0x19e8ab){_0x3731a7=_0x3731a7-0x0;var _0x71cae6=_0x0295[_0x3731a7];return _0x71cae6;};'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 e0e5518..374361c 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 _0x9a5a=['post','create','put','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','show','getMessages'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x9a5a,0x194));var _0xa9a5=function(_0xf96b9d,_0x2a925f){_0xf96b9d=_0xf96b9d-0x0;var _0x4db12b=_0x9a5a[_0xf96b9d];return _0x4db12b;};'use strict';var multer=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var path=require(_0xa9a5('0x2'));var timeout=require(_0xa9a5('0x3'));var express=require(_0xa9a5('0x4'));var router=express['Router']();var fs_extra=require(_0xa9a5('0x5'));var auth=require(_0xa9a5('0x6'));var interaction=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var controller=require(_0xa9a5('0x9'));router[_0xa9a5('0xa')]('/',auth['isAuthenticated'](),controller[_0xa9a5('0xb')]);router[_0xa9a5('0xa')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller[_0xa9a5('0xe')]);router['get']('/:id/messages',auth['isAuthenticated'](),controller[_0xa9a5('0xf')]);router[_0xa9a5('0x10')]('/',auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x11')]);router[_0xa9a5('0x12')](_0xa9a5('0xc'),auth[_0xa9a5('0xd')](),controller['update']);router['delete']('/:id',auth[_0xa9a5('0xd')](),controller[_0xa9a5('0x13')]);module[_0xa9a5('0x14')]=router; \ No newline at end of file +var _0x430c=['isAuthenticated','show','/:id/messages','getMessages','post','put','update','destroy','exports','multer','connect-timeout','express','Router','./voiceMail.controller','get','index','/:id'];(function(_0x19d69a,_0x4f1914){var _0x5c9edb=function(_0x5ec29f){while(--_0x5ec29f){_0x19d69a['push'](_0x19d69a['shift']());}};_0x5c9edb(++_0x4f1914);}(_0x430c,0x1a1));var _0xc430=function(_0x4a8bad,_0x4bfb2f){_0x4a8bad=_0x4a8bad-0x0;var _0x30cf32=_0x430c[_0x4a8bad];return _0x30cf32;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();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(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0xc')]('/',auth[_0xc430('0x8')](),controller['create']);router[_0xc430('0xd')](_0xc430('0x7'),auth['isAuthenticated'](),controller[_0xc430('0xe')]);router['delete'](_0xc430('0x7'),auth['isAuthenticated'](),controller[_0xc430('0xf')]);module[_0xc430('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e288b72..709c448 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 _0xb519=['VIRTUAL','fullname','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','ENUM','yes','TIMESTAMP','INTEGER'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xb519,0x17b));var _0x9b51=function(_0x5e6c30,_0x12c75f){_0x5e6c30=_0x5e6c30-0x0;var _0xbc0834=_0xb519[_0x5e6c30];return _0xbc0834;};'use strict';var Sequelize=require('sequelize');module[_0x9b51('0x0')]={'customer_id':{'type':Sequelize[_0x9b51('0x1')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x9b51('0x2'),'unique':_0x9b51('0x3')},'mailbox':{'type':Sequelize[_0x9b51('0x1')],'defaultValue':'','allowNull':![],'unique':_0x9b51('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x9b51('0x1')]},'email':{'type':Sequelize[_0x9b51('0x1')],'validate':{'isEmail':!![]},'set':function(_0x5263c9){this[_0x9b51('0x4')](_0x9b51('0x5'),typeof _0x5263c9==='string'&&_0x5263c9[_0x9b51('0x6')]()?_0x5263c9[_0x9b51('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize[_0x9b51('0x7')](_0x9b51('0x8'),'no'),'defaultValue':_0x9b51('0x8'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x9b51('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x9b51('0x1')]},'callback':{'type':Sequelize[_0x9b51('0x1')]},'review':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x9b51('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x9b51('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x9b51('0x7')](_0x9b51('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x9b51('0x7')](_0x9b51('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x9b51('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x9b51('0x7')](_0x9b51('0x8'),'no'),'defaultValue':_0x9b51('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x9b51('0x7')](_0x9b51('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x9b51('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x9b51('0x7')]('yes','no'),'defaultValue':_0x9b51('0x8'),'allowNull':![]},'stamp':{'type':_0x9b51('0x9')},'emailsubject':{'type':Sequelize[_0x9b51('0x1')]},'emailbody':{'type':Sequelize[_0x9b51('0x1')]},'maxsecs':{'type':Sequelize[_0x9b51('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x9b51('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x9b51('0xb')],'get':function(){return this['getDataValue'](_0x9b51('0xc'))+_0x9b51('0xd')+this['getDataValue'](_0x9b51('0xe'));}}}; \ No newline at end of file +var _0x0d5a=['TIMESTAMP','INTEGER','VIRTUAL','getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','trim','ENUM','yes'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0x0d5a,0xd5));var _0xa0d5=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x0d5a[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0xa0d5('0x0'));module[_0xa0d5('0x1')]={'customer_id':{'type':Sequelize[_0xa0d5('0x2')]},'context':{'type':Sequelize[_0xa0d5('0x2')],'defaultValue':_0xa0d5('0x3'),'unique':_0xa0d5('0x4')},'mailbox':{'type':Sequelize[_0xa0d5('0x2')],'defaultValue':'','allowNull':![],'unique':_0xa0d5('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xa0d5('0x2')]},'email':{'type':Sequelize[_0xa0d5('0x2')],'validate':{'isEmail':!![]},'set':function(_0x2348c6){this['setDataValue']('email',typeof _0x2348c6==='string'&&_0x2348c6[_0xa0d5('0x5')]()?_0x2348c6['trim']():null);}},'pager':{'type':Sequelize[_0xa0d5('0x2')]},'tz':{'type':Sequelize[_0xa0d5('0x2')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xa0d5('0x6')](_0xa0d5('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xa0d5('0x6')](_0xa0d5('0x7'),'no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0xa0d5('0x2')]},'callback':{'type':Sequelize[_0xa0d5('0x2')]},'review':{'type':Sequelize[_0xa0d5('0x6')](_0xa0d5('0x7'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa0d5('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xa0d5('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa0d5('0x6')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xa0d5('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0xa0d5('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa0d5('0x6')](_0xa0d5('0x7'),'no'),'defaultValue':_0xa0d5('0x7'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xa0d5('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa0d5('0x6')](_0xa0d5('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa0d5('0x6')](_0xa0d5('0x7'),'no'),'defaultValue':_0xa0d5('0x7'),'allowNull':![]},'stamp':{'type':_0xa0d5('0x8')},'emailsubject':{'type':Sequelize[_0xa0d5('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xa0d5('0x9')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa0d5('0xa')],'get':function(){return this[_0xa0d5('0xb')]('fullname')+'\x20-\x20'+this[_0xa0d5('0xb')](_0xa0d5('0xc'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 21ecc70..d7ac278 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 _0x1339=['../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VoiceMail','count','includeAll','include','findAll','catch','show','params','keys','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','pick','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1339,0x1ed));var _0x9133=function(_0x48bdc5,_0x185400){_0x48bdc5=_0x48bdc5-0x0;var _0x2ef0c0=_0x1339[_0x48bdc5];return _0x2ef0c0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){var _0x187e32=_0x4f26e8[_0x9133('0x22')]({'plain':!![]});var _0x3f278d=_0x9133('0x23');return db[_0x9133('0x24')][_0x9133('0x21')]({'where':{'type':_0x3f278d,'resourceId':_0x187e32['id']}})[_0x9133('0x20')](function(){return _0x4f26e8;});})[_0x9133('0x20')](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x25')]();});}};}function handleEntityNotFound(_0x51de62,_0x517e7b){return function(_0x477bf1){if(!_0x477bf1){_0x51de62[_0x9133('0x26')](0x194);}return _0x477bf1;};}function handleError(_0x428e18,_0x348486){_0x348486=_0x348486||0x1f4;return function(_0x4de894){logger['error'](_0x4de894[_0x9133('0x27')]);if(_0x4de894[_0x9133('0x28')]){delete _0x4de894[_0x9133('0x28')];}_0x428e18[_0x9133('0x1a')](_0x348486)[_0x9133('0x29')](_0x4de894);};}exports[_0x9133('0x2a')]=function(_0x48c713,_0x58afe0){var _0x5a27c1={},_0x1ad222={},_0x4a4a8e={'count':0x0,'rows':[]};var _0x43b5f3=_[_0x9133('0x2b')](db['VoiceMail'][_0x9133('0x2c')],function(_0x5dd90b){return{'name':_0x5dd90b[_0x9133('0x2d')],'type':_0x5dd90b[_0x9133('0x2e')][_0x9133('0x2f')]};});_0x1ad222['model']=_[_0x9133('0x2b')](_0x43b5f3,_0x9133('0x28'));_0x1ad222[_0x9133('0x30')]=_['keys'](_0x48c713[_0x9133('0x30')]);_0x1ad222[_0x9133('0x31')]=_[_0x9133('0x32')](_0x1ad222['model'],_0x1ad222[_0x9133('0x30')]);_0x5a27c1[_0x9133('0x33')]=_[_0x9133('0x32')](_0x1ad222[_0x9133('0x34')],qs['fields'](_0x48c713[_0x9133('0x30')][_0x9133('0x35')]));_0x5a27c1['attributes']=_0x5a27c1[_0x9133('0x33')][_0x9133('0x36')]?_0x5a27c1[_0x9133('0x33')]:_0x1ad222[_0x9133('0x34')];if(!_0x48c713[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x5a27c1[_0x9133('0x1d')]=qs[_0x9133('0x1d')](_0x48c713[_0x9133('0x30')][_0x9133('0x1d')]);_0x5a27c1['offset']=qs[_0x9133('0x1e')](_0x48c713[_0x9133('0x30')]['offset']);}_0x5a27c1[_0x9133('0x39')]=qs[_0x9133('0x3a')](_0x48c713[_0x9133('0x30')][_0x9133('0x3a')]);_0x5a27c1[_0x9133('0x3b')]=qs[_0x9133('0x31')](_['pick'](_0x48c713['query'],_0x1ad222[_0x9133('0x31')]),_0x43b5f3);if(_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]){_0x5a27c1[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x5a27c1[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x43b5f3,function(_0x2ee83e){if(_0x2ee83e[_0x9133('0x2e')]!=='VIRTUAL'){var _0xafd8f9={};_0xafd8f9[_0x2ee83e[_0x9133('0x28')]]={'$like':'%'+_0x48c713[_0x9133('0x30')][_0x9133('0x3c')]+'%'};return _0xafd8f9;}})});}_0x5a27c1=_[_0x9133('0x3d')]({},_0x5a27c1,_0x48c713['options']);var _0x3c691e={'where':_0x5a27c1[_0x9133('0x3b')]};return db[_0x9133('0x3e')][_0x9133('0x3f')](_0x3c691e)['then'](function(_0x146734){_0x4a4a8e[_0x9133('0x3f')]=_0x146734;if(_0x48c713[_0x9133('0x30')][_0x9133('0x40')]){_0x5a27c1[_0x9133('0x41')]=[{'all':!![]}];}return db[_0x9133('0x3e')][_0x9133('0x42')](_0x5a27c1);})['then'](function(_0x7f6cd9){_0x4a4a8e['rows']=_0x7f6cd9;return _0x4a4a8e;})['then'](respondWithFilteredResult(_0x58afe0,_0x5a27c1))[_0x9133('0x43')](handleError(_0x58afe0,null));};exports[_0x9133('0x44')]=function(_0x46156d,_0x264df4){var _0xdd485f={'raw':!![],'where':{'id':_0x46156d[_0x9133('0x45')]['id']}},_0x2d2bf7={};_0x2d2bf7[_0x9133('0x34')]=_[_0x9133('0x46')](db['VoiceMail'][_0x9133('0x2c')]);_0x2d2bf7[_0x9133('0x30')]=_[_0x9133('0x46')](_0x46156d['query']);_0x2d2bf7['filters']=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],_0x2d2bf7['query']);_0xdd485f[_0x9133('0x33')]=_[_0x9133('0x32')](_0x2d2bf7[_0x9133('0x34')],qs[_0x9133('0x35')](_0x46156d[_0x9133('0x30')]['fields']));_0xdd485f[_0x9133('0x33')]=_0xdd485f[_0x9133('0x33')][_0x9133('0x36')]?_0xdd485f['attributes']:_0x2d2bf7[_0x9133('0x34')];if(_0x46156d[_0x9133('0x30')]['includeAll']){_0xdd485f['include']=[{'all':!![]}];}_0xdd485f=_[_0x9133('0x3d')]({},_0xdd485f,_0x46156d[_0x9133('0x47')]);return db[_0x9133('0x3e')][_0x9133('0x48')](_0xdd485f)[_0x9133('0x20')](handleEntityNotFound(_0x264df4,null))[_0x9133('0x20')](respondWithResult(_0x264df4,null))[_0x9133('0x43')](handleError(_0x264df4,null));};exports[_0x9133('0x49')]=function(_0x23f134,_0xf07fbb){return db[_0x9133('0x3e')][_0x9133('0x49')](_0x23f134['body'],{})['then'](function(_0xf2e098){var _0x4dc2f3=_0x23f134[_0x9133('0x4a')][_0x9133('0x22')]({'plain':!![]});if(!_0x4dc2f3)throw new Error(_0x9133('0x4b'));if(_0x4dc2f3[_0x9133('0x4c')]==='user'){var _0x2a3848=_0xf2e098[_0x9133('0x22')]({'plain':!![]});var _0x799772='Voicemails';return db[_0x9133('0x4d')][_0x9133('0x48')]({'where':{'name':_0x799772,'userProfileId':_0x4dc2f3[_0x9133('0x4e')]},'raw':!![]})['then'](function(_0x14c825){if(_0x14c825&&_0x14c825['autoAssociation']===0x0){return db[_0x9133('0x24')][_0x9133('0x49')]({'name':_0x2a3848[_0x9133('0x28')],'resourceId':_0x2a3848['id'],'type':_0x14c825[_0x9133('0x28')],'sectionId':_0x14c825['id']},{})['then'](function(){return _0xf2e098;});}else{return _0xf2e098;}})['catch'](function(_0x2f09f6){logger[_0x9133('0x4f')](_0x9133('0x50'),_0x2f09f6);throw _0x2f09f6;});}return _0xf2e098;})[_0x9133('0x20')](respondWithResult(_0xf07fbb,0xc9))[_0x9133('0x43')](handleError(_0xf07fbb,null));};exports['update']=function(_0x554bb9,_0x33599b){if(_0x554bb9[_0x9133('0x51')]['id']){delete _0x554bb9['body']['id'];}return db[_0x9133('0x3e')][_0x9133('0x48')]({'where':{'id':_0x554bb9['params']['id']}})['then'](handleEntityNotFound(_0x33599b,null))['then'](saveUpdates(_0x554bb9[_0x9133('0x51')],null))['then'](respondWithResult(_0x33599b,null))[_0x9133('0x43')](handleError(_0x33599b,null));};exports[_0x9133('0x21')]=function(_0x439258,_0x3d6daa){return db['VoiceMail'][_0x9133('0x48')]({'where':{'id':_0x439258['params']['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3d6daa,null))[_0x9133('0x20')](removeEntity(_0x3d6daa,null))[_0x9133('0x43')](handleError(_0x3d6daa,null));};exports[_0x9133('0x52')]=function(_0x3b9927,_0x3534bf,_0x56861c){return db['VoiceMail']['findOne']({'where':{'id':_0x3b9927[_0x9133('0x45')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x3534bf,null))[_0x9133('0x20')](function(_0x54a330){var _0x3f4cd7;var _0x1f6684={},_0x415d55={};_0x415d55[_0x9133('0x34')]=_[_0x9133('0x46')](db[_0x9133('0x53')][_0x9133('0x2c')]);_0x415d55[_0x9133('0x30')]=_['keys'](_0x3b9927[_0x9133('0x30')]);_0x415d55['filters']=_[_0x9133('0x32')](_0x415d55['model'],_0x415d55[_0x9133('0x30')]);_0x1f6684[_0x9133('0x33')]=_['intersection'](_0x415d55['model'],qs[_0x9133('0x35')](_0x3b9927[_0x9133('0x30')][_0x9133('0x35')]));_0x1f6684[_0x9133('0x33')]=_0x1f6684[_0x9133('0x33')][_0x9133('0x36')]?_0x1f6684[_0x9133('0x33')]:_0x415d55[_0x9133('0x34')];if(!_0x3b9927[_0x9133('0x30')][_0x9133('0x37')](_0x9133('0x38'))){_0x1f6684['limit']=qs[_0x9133('0x1d')](_0x3b9927['query'][_0x9133('0x1d')]);_0x1f6684[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x3b9927[_0x9133('0x30')][_0x9133('0x1e')]);}_0x1f6684['order']=qs[_0x9133('0x3a')](_0x3b9927[_0x9133('0x30')][_0x9133('0x3a')]);_0x1f6684[_0x9133('0x3b')]=qs['filters'](_[_0x9133('0x54')](_0x3b9927[_0x9133('0x30')],_0x415d55[_0x9133('0x31')]));if(_0x3b9927[_0x9133('0x30')]['filter']){_0x1f6684['where']=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'$or':_[_0x9133('0x2b')](_0x1f6684[_0x9133('0x33')],function(_0x28cc46){var _0x2cfaf8={};_0x2cfaf8[_0x28cc46]={'$like':'%'+_0x3b9927['query'][_0x9133('0x3c')]+'%'};return _0x2cfaf8;})});}_0x1f6684[_0x9133('0x3b')]=_[_0x9133('0x3d')](_0x1f6684[_0x9133('0x3b')],{'mailboxuser':_0x54a330['mailbox']});_0x1f6684=_[_0x9133('0x3d')]({},_0x1f6684,_0x3b9927['options']);return db[_0x9133('0x53')][_0x9133('0x55')](_0x1f6684)[_0x9133('0x20')](respondWithFilteredResult(_0x3534bf,_0x1f6684));})[_0x9133('0x43')](handleError(_0x3534bf,null));}; \ No newline at end of file +var _0x5c00=['filter','VIRTUAL','merge','options','VoiceMail','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','include','find','create','body','get','role','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','getMessages','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','Voicemails','UserProfileResource','name','send','index','map','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x1f9f5f,_0x509fb7){var _0x51d649=function(_0x4a5285){while(--_0x4a5285){_0x1f9f5f['push'](_0x1f9f5f['shift']());}};_0x51d649(++_0x509fb7);}(_0x5c00,0x17e));var _0x05c0=function(_0x2cd068,_0x7a0a83){_0x2cd068=_0x2cd068-0x0;var _0x1f2d00=_0x5c00[_0x2cd068];return _0x1f2d00;};'use strict';var emlformat=require(_0x05c0('0x0'));var rimraf=require(_0x05c0('0x1'));var zipdir=require(_0x05c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x05c0('0x3'));var moment=require('moment');var BPromise=require(_0x05c0('0x4'));var Mustache=require(_0x05c0('0x5'));var util=require(_0x05c0('0x6'));var path=require(_0x05c0('0x7'));var sox=require('sox');var csv=require(_0x05c0('0x8'));var ejs=require(_0x05c0('0x9'));var fs=require('fs');var fs_extra=require(_0x05c0('0xa'));var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var licenseUtil=require(_0x05c0('0x17'));var db=require(_0x05c0('0x18'))['db'];function respondWithStatusCode(_0x5a3e65,_0x4e39d4){_0x4e39d4=_0x4e39d4||0xcc;return function(_0x5eec41){if(_0x5eec41){return _0x5a3e65[_0x05c0('0x19')](_0x4e39d4);}return _0x5a3e65[_0x05c0('0x1a')](_0x4e39d4)[_0x05c0('0x1b')]();};}function respondWithResult(_0x12deeb,_0x25764b){_0x25764b=_0x25764b||0xc8;return function(_0xe57ed0){if(_0xe57ed0){return _0x12deeb[_0x05c0('0x1a')](_0x25764b)[_0x05c0('0x1c')](_0xe57ed0);}};}function respondWithFilteredResult(_0x4c3e54,_0x238e25){return function(_0x161a5f){if(_0x161a5f){var _0x4bb164=typeof _0x238e25[_0x05c0('0x1d')]===_0x05c0('0x1e')&&typeof _0x238e25[_0x05c0('0x1f')]===_0x05c0('0x1e');var _0xd07ad1=_0x161a5f[_0x05c0('0x20')];var _0x521cbd=_0x4bb164?0x0:_0x238e25[_0x05c0('0x1d')];var _0x1230e5=_0x4bb164?_0x161a5f[_0x05c0('0x20')]:_0x238e25['offset']+_0x238e25[_0x05c0('0x1f')];var _0x2023d6;if(_0x1230e5>=_0xd07ad1){_0x1230e5=_0xd07ad1;_0x2023d6=0xc8;}else{_0x2023d6=0xce;}_0x4c3e54[_0x05c0('0x1a')](_0x2023d6);return _0x4c3e54[_0x05c0('0x21')](_0x05c0('0x22'),_0x521cbd+'-'+_0x1230e5+'/'+_0xd07ad1)['json'](_0x161a5f);}return null;};}function patchUpdates(_0x407c1f){return function(_0x1014ef){try{jsonpatch['apply'](_0x1014ef,_0x407c1f,!![]);}catch(_0x548a0c){return BPromise['reject'](_0x548a0c);}return _0x1014ef[_0x05c0('0x23')]();};}function saveUpdates(_0x2055a3,_0x83f29){return function(_0x8e2d4){if(_0x8e2d4){return _0x8e2d4[_0x05c0('0x24')](_0x2055a3)[_0x05c0('0x25')](function(_0x14224f){return _0x14224f;});}return null;};}function removeEntity(_0x5b4eef,_0x9b4930){return function(_0x1abbf3){if(_0x1abbf3){return _0x1abbf3['destroy']()['then'](function(){var _0x4da6d6=_0x1abbf3['get']({'plain':!![]});var _0x56aa78=_0x05c0('0x26');return db[_0x05c0('0x27')]['destroy']({'where':{'type':_0x56aa78,'resourceId':_0x4da6d6['id']}})[_0x05c0('0x25')](function(){return _0x1abbf3;});})[_0x05c0('0x25')](function(){_0x5b4eef[_0x05c0('0x1a')](0xcc)[_0x05c0('0x1b')]();});}};}function handleEntityNotFound(_0x58769a,_0x7d5ccd){return function(_0x1c14b1){if(!_0x1c14b1){_0x58769a[_0x05c0('0x19')](0x194);}return _0x1c14b1;};}function handleError(_0x200e80,_0x216a5c){_0x216a5c=_0x216a5c||0x1f4;return function(_0x5d12e0){logger['error'](_0x5d12e0['stack']);if(_0x5d12e0[_0x05c0('0x28')]){delete _0x5d12e0[_0x05c0('0x28')];}_0x200e80[_0x05c0('0x1a')](_0x216a5c)[_0x05c0('0x29')](_0x5d12e0);};}exports[_0x05c0('0x2a')]=function(_0x1e00c5,_0x1c4c8f){var _0x3c9eb1={},_0x33eff3={},_0x87b07c={'count':0x0,'rows':[]};var _0x3e38f0=_[_0x05c0('0x2b')](db['VoiceMail']['rawAttributes'],function(_0x2bfe05){return{'name':_0x2bfe05[_0x05c0('0x2c')],'type':_0x2bfe05[_0x05c0('0x2d')]['key']};});_0x33eff3[_0x05c0('0x2e')]=_[_0x05c0('0x2b')](_0x3e38f0,'name');_0x33eff3[_0x05c0('0x2f')]=_['keys'](_0x1e00c5[_0x05c0('0x2f')]);_0x33eff3[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x33eff3[_0x05c0('0x2e')],_0x33eff3[_0x05c0('0x2f')]);_0x3c9eb1[_0x05c0('0x32')]=_[_0x05c0('0x31')](_0x33eff3[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x1e00c5[_0x05c0('0x2f')][_0x05c0('0x33')]));_0x3c9eb1[_0x05c0('0x32')]=_0x3c9eb1[_0x05c0('0x32')][_0x05c0('0x34')]?_0x3c9eb1[_0x05c0('0x32')]:_0x33eff3[_0x05c0('0x2e')];if(!_0x1e00c5[_0x05c0('0x2f')][_0x05c0('0x35')](_0x05c0('0x36'))){_0x3c9eb1[_0x05c0('0x1f')]=qs[_0x05c0('0x1f')](_0x1e00c5[_0x05c0('0x2f')][_0x05c0('0x1f')]);_0x3c9eb1[_0x05c0('0x1d')]=qs[_0x05c0('0x1d')](_0x1e00c5[_0x05c0('0x2f')][_0x05c0('0x1d')]);}_0x3c9eb1[_0x05c0('0x37')]=qs[_0x05c0('0x38')](_0x1e00c5[_0x05c0('0x2f')][_0x05c0('0x38')]);_0x3c9eb1[_0x05c0('0x39')]=qs[_0x05c0('0x30')](_['pick'](_0x1e00c5[_0x05c0('0x2f')],_0x33eff3[_0x05c0('0x30')]),_0x3e38f0);if(_0x1e00c5[_0x05c0('0x2f')][_0x05c0('0x3a')]){_0x3c9eb1['where']=_['merge'](_0x3c9eb1[_0x05c0('0x39')],{'$or':_[_0x05c0('0x2b')](_0x3e38f0,function(_0x3c5620){if(_0x3c5620['type']!==_0x05c0('0x3b')){var _0x9bd669={};_0x9bd669[_0x3c5620[_0x05c0('0x28')]]={'$like':'%'+_0x1e00c5[_0x05c0('0x2f')]['filter']+'%'};return _0x9bd669;}})});}_0x3c9eb1=_[_0x05c0('0x3c')]({},_0x3c9eb1,_0x1e00c5[_0x05c0('0x3d')]);var _0x4de9c2={'where':_0x3c9eb1[_0x05c0('0x39')]};return db[_0x05c0('0x3e')][_0x05c0('0x20')](_0x4de9c2)[_0x05c0('0x25')](function(_0x164e3a){_0x87b07c[_0x05c0('0x20')]=_0x164e3a;if(_0x1e00c5[_0x05c0('0x2f')]['includeAll']){_0x3c9eb1['include']=[{'all':!![]}];}return db[_0x05c0('0x3e')][_0x05c0('0x3f')](_0x3c9eb1);})[_0x05c0('0x25')](function(_0x11f079){_0x87b07c[_0x05c0('0x40')]=_0x11f079;return _0x87b07c;})['then'](respondWithFilteredResult(_0x1c4c8f,_0x3c9eb1))[_0x05c0('0x41')](handleError(_0x1c4c8f,null));};exports[_0x05c0('0x42')]=function(_0x2fdfe8,_0x1c937c){var _0x24ecbb={'raw':!![],'where':{'id':_0x2fdfe8[_0x05c0('0x43')]['id']}},_0x71ceb7={};_0x71ceb7['model']=_[_0x05c0('0x44')](db[_0x05c0('0x3e')][_0x05c0('0x45')]);_0x71ceb7[_0x05c0('0x2f')]=_[_0x05c0('0x44')](_0x2fdfe8[_0x05c0('0x2f')]);_0x71ceb7[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x71ceb7[_0x05c0('0x2e')],_0x71ceb7[_0x05c0('0x2f')]);_0x24ecbb[_0x05c0('0x32')]=_['intersection'](_0x71ceb7['model'],qs[_0x05c0('0x33')](_0x2fdfe8[_0x05c0('0x2f')][_0x05c0('0x33')]));_0x24ecbb[_0x05c0('0x32')]=_0x24ecbb[_0x05c0('0x32')][_0x05c0('0x34')]?_0x24ecbb['attributes']:_0x71ceb7[_0x05c0('0x2e')];if(_0x2fdfe8[_0x05c0('0x2f')][_0x05c0('0x46')]){_0x24ecbb[_0x05c0('0x47')]=[{'all':!![]}];}_0x24ecbb=_['merge']({},_0x24ecbb,_0x2fdfe8[_0x05c0('0x3d')]);return db[_0x05c0('0x3e')][_0x05c0('0x48')](_0x24ecbb)[_0x05c0('0x25')](handleEntityNotFound(_0x1c937c,null))['then'](respondWithResult(_0x1c937c,null))[_0x05c0('0x41')](handleError(_0x1c937c,null));};exports[_0x05c0('0x49')]=function(_0x2e5660,_0x9b521b){return db['VoiceMail'][_0x05c0('0x49')](_0x2e5660[_0x05c0('0x4a')],{})['then'](function(_0x27f69e){var _0x57f979=_0x2e5660['user'][_0x05c0('0x4b')]({'plain':!![]});if(!_0x57f979)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57f979[_0x05c0('0x4c')]===_0x05c0('0x4d')){var _0x2fedc0=_0x27f69e[_0x05c0('0x4b')]({'plain':!![]});var _0x3ccae9=_0x05c0('0x26');return db['UserProfileSection'][_0x05c0('0x48')]({'where':{'name':_0x3ccae9,'userProfileId':_0x57f979['userProfileId']},'raw':!![]})[_0x05c0('0x25')](function(_0x389fc7){if(_0x389fc7&&_0x389fc7[_0x05c0('0x4e')]===0x0){return db[_0x05c0('0x27')][_0x05c0('0x49')]({'name':_0x2fedc0[_0x05c0('0x28')],'resourceId':_0x2fedc0['id'],'type':_0x389fc7[_0x05c0('0x28')],'sectionId':_0x389fc7['id']},{})['then'](function(){return _0x27f69e;});}else{return _0x27f69e;}})['catch'](function(_0x523153){logger[_0x05c0('0x4f')](_0x05c0('0x50'),_0x523153);throw _0x523153;});}return _0x27f69e;})['then'](respondWithResult(_0x9b521b,0xc9))['catch'](handleError(_0x9b521b,null));};exports[_0x05c0('0x24')]=function(_0x1a72d6,_0x476e16){if(_0x1a72d6[_0x05c0('0x4a')]['id']){delete _0x1a72d6[_0x05c0('0x4a')]['id'];}return db[_0x05c0('0x3e')][_0x05c0('0x48')]({'where':{'id':_0x1a72d6['params']['id']}})[_0x05c0('0x25')](handleEntityNotFound(_0x476e16,null))[_0x05c0('0x25')](saveUpdates(_0x1a72d6[_0x05c0('0x4a')],null))[_0x05c0('0x25')](respondWithResult(_0x476e16,null))['catch'](handleError(_0x476e16,null));};exports[_0x05c0('0x51')]=function(_0x4c47e5,_0x1edf4f){return db[_0x05c0('0x3e')]['find']({'where':{'id':_0x4c47e5[_0x05c0('0x43')]['id']}})['then'](handleEntityNotFound(_0x1edf4f,null))[_0x05c0('0x25')](removeEntity(_0x1edf4f,null))[_0x05c0('0x41')](handleError(_0x1edf4f,null));};exports[_0x05c0('0x52')]=function(_0x2e0574,_0x371ba8,_0x2226e3){return db['VoiceMail'][_0x05c0('0x53')]({'where':{'id':_0x2e0574[_0x05c0('0x43')]['id']}})[_0x05c0('0x25')](handleEntityNotFound(_0x371ba8,null))[_0x05c0('0x25')](function(_0x49cfc5){var _0x38c154;var _0x58c7bc={},_0x284650={};_0x284650[_0x05c0('0x2e')]=_[_0x05c0('0x44')](db[_0x05c0('0x54')][_0x05c0('0x45')]);_0x284650[_0x05c0('0x2f')]=_[_0x05c0('0x44')](_0x2e0574[_0x05c0('0x2f')]);_0x284650[_0x05c0('0x30')]=_[_0x05c0('0x31')](_0x284650[_0x05c0('0x2e')],_0x284650[_0x05c0('0x2f')]);_0x58c7bc['attributes']=_['intersection'](_0x284650['model'],qs[_0x05c0('0x33')](_0x2e0574[_0x05c0('0x2f')][_0x05c0('0x33')]));_0x58c7bc['attributes']=_0x58c7bc[_0x05c0('0x32')][_0x05c0('0x34')]?_0x58c7bc[_0x05c0('0x32')]:_0x284650[_0x05c0('0x2e')];if(!_0x2e0574[_0x05c0('0x2f')][_0x05c0('0x35')](_0x05c0('0x36'))){_0x58c7bc['limit']=qs[_0x05c0('0x1f')](_0x2e0574[_0x05c0('0x2f')][_0x05c0('0x1f')]);_0x58c7bc[_0x05c0('0x1d')]=qs['offset'](_0x2e0574['query']['offset']);}_0x58c7bc[_0x05c0('0x37')]=qs[_0x05c0('0x38')](_0x2e0574[_0x05c0('0x2f')][_0x05c0('0x38')]);_0x58c7bc[_0x05c0('0x39')]=qs[_0x05c0('0x30')](_[_0x05c0('0x55')](_0x2e0574['query'],_0x284650[_0x05c0('0x30')]));if(_0x2e0574[_0x05c0('0x2f')][_0x05c0('0x3a')]){_0x58c7bc[_0x05c0('0x39')]=_[_0x05c0('0x3c')](_0x58c7bc['where'],{'$or':_['map'](_0x58c7bc[_0x05c0('0x32')],function(_0x204706){var _0x50bcf1={};_0x50bcf1[_0x204706]={'$like':'%'+_0x2e0574[_0x05c0('0x2f')]['filter']+'%'};return _0x50bcf1;})});}_0x58c7bc['where']=_[_0x05c0('0x3c')](_0x58c7bc[_0x05c0('0x39')],{'mailboxuser':_0x49cfc5[_0x05c0('0x56')]});_0x58c7bc=_['merge']({},_0x58c7bc,_0x2e0574['options']);return db[_0x05c0('0x54')][_0x05c0('0x57')](_0x58c7bc)[_0x05c0('0x25')](respondWithFilteredResult(_0x371ba8,_0x58c7bc));})['catch'](handleError(_0x371ba8,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 00da7d9..3adf3b1 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 _0x129a=['lodash','util','../../config/logger','moment','bluebird','path','define','VoiceMail','mailbox_context','mailbox','context'];(function(_0x1b558b,_0x317519){var _0x1ef3dd=function(_0x2a1b66){while(--_0x2a1b66){_0x1b558b['push'](_0x1b558b['shift']());}};_0x1ef3dd(++_0x317519);}(_0x129a,0x108));var _0xa129=function(_0x419a5a,_0x2a5280){_0x419a5a=_0x419a5a-0x0;var _0x197ce9=_0x129a[_0x419a5a];return _0x197ce9;};'use strict';var _=require(_0xa129('0x0'));var util=require(_0xa129('0x1'));var logger=require(_0xa129('0x2'))('api');var moment=require(_0xa129('0x3'));var BPromise=require(_0xa129('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa129('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module['exports']=function(_0x3b1141,_0x52989a){return _0x3b1141[_0xa129('0x6')](_0xa129('0x7'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xa129('0x8'),'fields':[_0xa129('0x9'),_0xa129('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x123e=['mailbox','context','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./voiceMail.attributes','VoiceMail','voice_voicemail','mailbox_context'];(function(_0x3250a1,_0x5957bf){var _0x5cfbac=function(_0x4828ca){while(--_0x4828ca){_0x3250a1['push'](_0x3250a1['shift']());}};_0x5cfbac(++_0x5957bf);}(_0x123e,0x1a2));var _0xe123=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x123e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xe123('0x0'));var logger=require(_0xe123('0x1'))(_0xe123('0x2'));var moment=require('moment');var BPromise=require(_0xe123('0x3'));var rp=require(_0xe123('0x4'));var fs=require('fs');var path=require(_0xe123('0x5'));var rimraf=require(_0xe123('0x6'));var config=require('../../config/environment');var attributes=require(_0xe123('0x7'));module['exports']=function(_0x27c52c,_0x5189ad){return _0x27c52c['define'](_0xe123('0x8'),attributes,{'tableName':_0xe123('0x9'),'paranoid':![],'indexes':[{'name':_0xe123('0xa'),'fields':[_0xe123('0xb'),_0xe123('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 9b0582d..234c09c 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 _0x0cb6=['request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x54b8e9,_0x55a1e3){var _0x26fbbf=function(_0x15a75d){while(--_0x15a75d){_0x54b8e9['push'](_0x54b8e9['shift']());}};_0x26fbbf(++_0x55a1e3);}(_0x0cb6,0xbb));var _0x60cb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0cb6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x60cb('0x0'));var util=require(_0x60cb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x60cb('0x2'));var fs=require('fs');var Redis=require(_0x60cb('0x3'));var db=require(_0x60cb('0x4'))['db'];var utils=require(_0x60cb('0x5'));var logger=require(_0x60cb('0x6'))(_0x60cb('0x7'));var config=require('../../config/environment');var jayson=require(_0x60cb('0x8'));var client=jayson[_0x60cb('0x9')][_0x60cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11f610,_0x32df50,_0x86d27c){return new BPromise(function(_0x36690b,_0x3aed57){return client[_0x60cb('0xb')](_0x11f610,_0x86d27c)['then'](function(_0xd2ebfe){logger[_0x60cb('0xc')](_0x60cb('0xd'),_0x32df50,_0x60cb('0xe'));logger[_0x60cb('0xf')](_0x60cb('0x10'),_0x32df50,_0x60cb('0xe'),JSON[_0x60cb('0x11')](_0xd2ebfe));if(_0xd2ebfe[_0x60cb('0x12')]){if(_0xd2ebfe[_0x60cb('0x12')][_0x60cb('0x13')]===0x1f4){logger['error'](_0x60cb('0xd'),_0x32df50,_0xd2ebfe['error'][_0x60cb('0x14')]);return _0x3aed57(_0xd2ebfe[_0x60cb('0x12')][_0x60cb('0x14')]);}logger[_0x60cb('0x12')]('VoiceMail,\x20%s,\x20%s',_0x32df50,_0xd2ebfe[_0x60cb('0x12')]['message']);return _0x36690b(_0xd2ebfe['error'][_0x60cb('0x14')]);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x32df50,'request\x20sent');_0x36690b(_0xd2ebfe['result']['message']);}})[_0x60cb('0x15')](function(_0x207e4b){logger[_0x60cb('0x12')]('VoiceMail,\x20%s,\x20%s',_0x32df50,_0x207e4b);_0x3aed57(_0x207e4b);});});} \ No newline at end of file +var _0x6466=['debug','stringify','error','VoiceMail,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','request\x20sent'];(function(_0x20e859,_0x1222ad){var _0x2dd738=function(_0x55752e){while(--_0x55752e){_0x20e859['push'](_0x20e859['shift']());}};_0x2dd738(++_0x1222ad);}(_0x6466,0xc4));var _0x6646=function(_0x32d44f,_0x4cbcc2){_0x32d44f=_0x32d44f-0x0;var _0x4334fa=_0x6466[_0x32d44f];return _0x4334fa;};'use strict';var _=require(_0x6646('0x0'));var util=require('util');var moment=require(_0x6646('0x1'));var BPromise=require(_0x6646('0x2'));var rs=require(_0x6646('0x3'));var fs=require('fs');var Redis=require(_0x6646('0x4'));var db=require(_0x6646('0x5'))['db'];var utils=require(_0x6646('0x6'));var logger=require('../../config/logger')(_0x6646('0x7'));var config=require(_0x6646('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6646('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25290d,_0x12e935,_0x62016f){return new BPromise(function(_0x2aaea4,_0x27d24b){return client[_0x6646('0xa')](_0x25290d,_0x62016f)[_0x6646('0xb')](function(_0x340f70){logger[_0x6646('0xc')]('VoiceMail,\x20%s,\x20%s',_0x12e935,_0x6646('0xd'));logger[_0x6646('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x12e935,_0x6646('0xd'),JSON[_0x6646('0xf')](_0x340f70));if(_0x340f70[_0x6646('0x10')]){if(_0x340f70[_0x6646('0x10')]['code']===0x1f4){logger[_0x6646('0x10')](_0x6646('0x11'),_0x12e935,_0x340f70['error'][_0x6646('0x12')]);return _0x27d24b(_0x340f70[_0x6646('0x10')][_0x6646('0x12')]);}logger[_0x6646('0x10')](_0x6646('0x11'),_0x12e935,_0x340f70[_0x6646('0x10')][_0x6646('0x12')]);return _0x2aaea4(_0x340f70['error']['message']);}else{logger[_0x6646('0xc')](_0x6646('0x11'),_0x12e935,_0x6646('0xd'));_0x2aaea4(_0x340f70[_0x6646('0x13')]['message']);}})[_0x6646('0x14')](function(_0x1970aa){logger['error'](_0x6646('0x11'),_0x12e935,_0x1970aa);_0x27d24b(_0x1970aa);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 60553dc..13c572e 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 _0x84db=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','index','get','/:id','isAuthenticated','show','/:id/download','create','put','update','delete','exports','multer','util','path','express'];(function(_0x1921cb,_0x301b7b){var _0x1489b8=function(_0x11bd87){while(--_0x11bd87){_0x1921cb['push'](_0x1921cb['shift']());}};_0x1489b8(++_0x301b7b);}(_0x84db,0x164));var _0xb84d=function(_0x4fd75d,_0x10ebd7){_0x4fd75d=_0x4fd75d-0x0;var _0x566b8a=_0x84db[_0x4fd75d];return _0x566b8a;};'use strict';var multer=require(_0xb84d('0x0'));var util=require(_0xb84d('0x1'));var path=require(_0xb84d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb84d('0x3'));var router=express[_0xb84d('0x4')]();var fs_extra=require(_0xb84d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb84d('0x6'));var config=require(_0xb84d('0x7'));var controller=require(_0xb84d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb84d('0x9')]);router[_0xb84d('0xa')](_0xb84d('0xb'),auth[_0xb84d('0xc')](),controller[_0xb84d('0xd')]);router[_0xb84d('0xa')](_0xb84d('0xe'),auth[_0xb84d('0xc')](),controller['download']);router['post']('/',auth[_0xb84d('0xc')](),controller[_0xb84d('0xf')]);router[_0xb84d('0x10')](_0xb84d('0xb'),auth[_0xb84d('0xc')](),controller[_0xb84d('0x11')]);router[_0xb84d('0x12')](_0xb84d('0xb'),auth[_0xb84d('0xc')](),controller['destroy']);module[_0xb84d('0x13')]=router; \ No newline at end of file +var _0xbde9=['create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x50cb91,_0x2fdea0){var _0x487806=function(_0x2200b6){while(--_0x2200b6){_0x50cb91['push'](_0x50cb91['shift']());}};_0x487806(++_0x2fdea0);}(_0xbde9,0xd7));var _0x9bde=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0xbde9[_0x5f3905];return _0x2923b1;};'use strict';var multer=require('multer');var util=require(_0x9bde('0x0'));var path=require(_0x9bde('0x1'));var timeout=require(_0x9bde('0x2'));var express=require(_0x9bde('0x3'));var router=express[_0x9bde('0x4')]();var fs_extra=require(_0x9bde('0x5'));var auth=require(_0x9bde('0x6'));var interaction=require(_0x9bde('0x7'));var config=require(_0x9bde('0x8'));var controller=require(_0x9bde('0x9'));router[_0x9bde('0xa')]('/',auth[_0x9bde('0xb')](),controller[_0x9bde('0xc')]);router[_0x9bde('0xa')](_0x9bde('0xd'),auth[_0x9bde('0xb')](),controller[_0x9bde('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x9bde('0xf')]('/',auth['isAuthenticated'](),controller[_0x9bde('0x10')]);router[_0x9bde('0x11')]('/:id',auth[_0x9bde('0xb')](),controller['update']);router[_0x9bde('0x12')](_0x9bde('0xd'),auth[_0x9bde('0xb')](),controller[_0x9bde('0x13')]);module[_0x9bde('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 c416430..d046298 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 _0x0de4=['STRING','BLOB','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x2703a0,_0x37aa46){var _0x5dbcc4=function(_0x13ee50){while(--_0x13ee50){_0x2703a0['push'](_0x2703a0['shift']());}};_0x5dbcc4(++_0x37aa46);}(_0x0de4,0x1d4));var _0x40de=function(_0x49c6c9,_0x3882f9){_0x49c6c9=_0x49c6c9-0x0;var _0x9f552c=_0x0de4[_0x49c6c9];return _0x9f552c;};'use strict';var Sequelize=require(_0x40de('0x0'));module[_0x40de('0x1')]={'name':{'type':Sequelize[_0x40de('0x2')],'get':function(_0x182f74){return this[_0x40de('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x40de('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x40de('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x40de('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x40de('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x40de('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x40de('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x40de('0x5')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x40de('0x4')],'defaultValue':''},'stamp':{'type':_0x40de('0x6'),'defaultValue':Sequelize['literal'](_0x40de('0x7'))}}; \ No newline at end of file +var _0x194c=['TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','VIRTUAL','getDataValue','INTEGER','STRING'];(function(_0x8a570b,_0x73059){var _0x45f680=function(_0x37ba19){while(--_0x37ba19){_0x8a570b['push'](_0x8a570b['shift']());}};_0x45f680(++_0x73059);}(_0x194c,0xeb));var _0xc194=function(_0x365a32,_0x4a2272){_0x365a32=_0x365a32-0x0;var _0xa598b9=_0x194c[_0x365a32];return _0xa598b9;};'use strict';var Sequelize=require(_0xc194('0x0'));module['exports']={'name':{'type':Sequelize[_0xc194('0x1')],'get':function(_0x47d129){return this[_0xc194('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xc194('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xc194('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xc194('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xc194('0x4')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xc194('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0xc194('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xc194('0x4')],'defaultValue':''},'stamp':{'type':_0xc194('0x5'),'defaultValue':Sequelize[_0xc194('0x6')](_0xc194('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d474a2b..93b6441 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 _0xc7ee=['apply','update','then','destroy','sendStatus','error','stack','name','map','VoiceMailMessage','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','where','includeAll','findAll','rows','params','include','options','catch','create','body','find','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x363d98,_0x9382e9){var _0x516d08=function(_0x3a4dc1){while(--_0x3a4dc1){_0x363d98['push'](_0x363d98['shift']());}};_0x516d08(++_0x9382e9);}(_0xc7ee,0x122));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xec7e('0x0'));var zipdir=require(_0xec7e('0x1'));var jsonpatch=require(_0xec7e('0x2'));var rp=require(_0xec7e('0x3'));var moment=require('moment');var BPromise=require(_0xec7e('0x4'));var Mustache=require('mustache');var util=require(_0xec7e('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xec7e('0x6'));var fs=require('fs');var fs_extra=require(_0xec7e('0x7'));var _=require(_0xec7e('0x8'));var squel=require('squel');var crypto=require(_0xec7e('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xec7e('0xa'));var toCsv=require(_0xec7e('0xb'));var querystring=require(_0xec7e('0xc'));var Papa=require('papaparse');var Redis=require(_0xec7e('0xd'));var authService=require(_0xec7e('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec7e('0xf'));var logger=require('../../config/logger')(_0xec7e('0x10'));var utils=require(_0xec7e('0x11'));var config=require(_0xec7e('0x12'));var licenseUtil=require(_0xec7e('0x13'));var db=require(_0xec7e('0x14'))['db'];function respondWithStatusCode(_0x7a4816,_0x3abe39){_0x3abe39=_0x3abe39||0xcc;return function(_0x5a757a){if(_0x5a757a){return _0x7a4816['sendStatus'](_0x3abe39);}return _0x7a4816[_0xec7e('0x15')](_0x3abe39)[_0xec7e('0x16')]();};}function respondWithResult(_0x46d85b,_0x2944b8){_0x2944b8=_0x2944b8||0xc8;return function(_0x622e42){if(_0x622e42){return _0x46d85b[_0xec7e('0x15')](_0x2944b8)[_0xec7e('0x17')](_0x622e42);}};}function respondWithFilteredResult(_0x170d65,_0x2dc002){return function(_0xefa2dd){if(_0xefa2dd){var _0x4a5c9a=typeof _0x2dc002[_0xec7e('0x18')]===_0xec7e('0x19')&&typeof _0x2dc002['limit']===_0xec7e('0x19');var _0x41e730=_0xefa2dd[_0xec7e('0x1a')];var _0x1db1d5=_0x4a5c9a?0x0:_0x2dc002['offset'];var _0x46acd5=_0x4a5c9a?_0xefa2dd[_0xec7e('0x1a')]:_0x2dc002[_0xec7e('0x18')]+_0x2dc002[_0xec7e('0x1b')];var _0x25664d;if(_0x46acd5>=_0x41e730){_0x46acd5=_0x41e730;_0x25664d=0xc8;}else{_0x25664d=0xce;}_0x170d65[_0xec7e('0x15')](_0x25664d);return _0x170d65[_0xec7e('0x1c')](_0xec7e('0x1d'),_0x1db1d5+'-'+_0x46acd5+'/'+_0x41e730)[_0xec7e('0x17')](_0xefa2dd);}return null;};}function patchUpdates(_0x5ab77c){return function(_0x596b78){try{jsonpatch[_0xec7e('0x1e')](_0x596b78,_0x5ab77c,!![]);}catch(_0x549673){return BPromise['reject'](_0x549673);}return _0x596b78['save']();};}function saveUpdates(_0x545e60,_0x40b107){return function(_0x17e48e){if(_0x17e48e){return _0x17e48e[_0xec7e('0x1f')](_0x545e60)[_0xec7e('0x20')](function(_0x3c0c29){return _0x3c0c29;});}return null;};}function removeEntity(_0x17826b,_0x5d240c){return function(_0x4fb087){if(_0x4fb087){return _0x4fb087[_0xec7e('0x21')]()['then'](function(){_0x17826b[_0xec7e('0x15')](0xcc)[_0xec7e('0x16')]();});}};}function handleEntityNotFound(_0x4389f4,_0x5908cb){return function(_0x5103f2){if(!_0x5103f2){_0x4389f4[_0xec7e('0x22')](0x194);}return _0x5103f2;};}function handleError(_0x783199,_0x45c7b1){_0x45c7b1=_0x45c7b1||0x1f4;return function(_0x5e97f3){logger[_0xec7e('0x23')](_0x5e97f3[_0xec7e('0x24')]);if(_0x5e97f3[_0xec7e('0x25')]){delete _0x5e97f3[_0xec7e('0x25')];}_0x783199[_0xec7e('0x15')](_0x45c7b1)['send'](_0x5e97f3);};}exports['index']=function(_0x54c01c,_0x375370){var _0x1882d3={},_0x2a407d={},_0x954610={'count':0x0,'rows':[]};var _0x5dcf2a=_[_0xec7e('0x26')](db[_0xec7e('0x27')][_0xec7e('0x28')],function(_0x3e051a){return{'name':_0x3e051a[_0xec7e('0x29')],'type':_0x3e051a['type'][_0xec7e('0x2a')]};});_0x2a407d[_0xec7e('0x2b')]=_[_0xec7e('0x2c')](_[_0xec7e('0x26')](_0x5dcf2a,_0xec7e('0x25')),[_0xec7e('0x25')]);_0x2a407d[_0xec7e('0x2d')]=_[_0xec7e('0x2e')](_0x54c01c[_0xec7e('0x2d')]);_0x2a407d[_0xec7e('0x2f')]=_[_0xec7e('0x30')](_0x2a407d[_0xec7e('0x2b')],_0x2a407d[_0xec7e('0x2d')]);_0x1882d3[_0xec7e('0x31')]=_[_0xec7e('0x30')](_0x2a407d[_0xec7e('0x2b')],qs['fields'](_0x54c01c['query'][_0xec7e('0x32')]));_0x1882d3[_0xec7e('0x31')]=_0x1882d3[_0xec7e('0x31')][_0xec7e('0x33')]?_0x1882d3[_0xec7e('0x31')]:_0x2a407d['model'];if(!_0x54c01c[_0xec7e('0x2d')][_0xec7e('0x34')](_0xec7e('0x35'))){_0x1882d3[_0xec7e('0x1b')]=qs[_0xec7e('0x1b')](_0x54c01c[_0xec7e('0x2d')][_0xec7e('0x1b')]);_0x1882d3[_0xec7e('0x18')]=qs[_0xec7e('0x18')](_0x54c01c[_0xec7e('0x2d')][_0xec7e('0x18')]);}_0x1882d3[_0xec7e('0x36')]=qs[_0xec7e('0x37')](_0x54c01c[_0xec7e('0x2d')][_0xec7e('0x37')]);_0x1882d3['where']=qs['filters'](_[_0xec7e('0x38')](_0x54c01c[_0xec7e('0x2d')],_0x2a407d['filters']),_0x5dcf2a);if(_0x54c01c[_0xec7e('0x2d')][_0xec7e('0x39')]){_0x1882d3['where']=_[_0xec7e('0x3a')](_0x1882d3['where'],{'$or':_[_0xec7e('0x26')](_0x5dcf2a,function(_0x2b5af3){if(_0x2b5af3[_0xec7e('0x3b')]!==_0xec7e('0x3c')){var _0xa6a093={};_0xa6a093[_0x2b5af3['name']]={'$like':'%'+_0x54c01c[_0xec7e('0x2d')][_0xec7e('0x39')]+'%'};return _0xa6a093;}})});}_0x1882d3=_[_0xec7e('0x3a')]({},_0x1882d3,_0x54c01c['options']);var _0x554f3f={'where':_0x1882d3[_0xec7e('0x3d')]};return db[_0xec7e('0x27')][_0xec7e('0x1a')](_0x554f3f)[_0xec7e('0x20')](function(_0xb0f0d1){_0x954610[_0xec7e('0x1a')]=_0xb0f0d1;if(_0x54c01c[_0xec7e('0x2d')][_0xec7e('0x3e')]){_0x1882d3['include']=[{'all':!![]}];}return db[_0xec7e('0x27')][_0xec7e('0x3f')](_0x1882d3);})['then'](function(_0x470a04){_0x954610[_0xec7e('0x40')]=_0x470a04;return _0x954610;})['then'](respondWithFilteredResult(_0x375370,_0x1882d3))['catch'](handleError(_0x375370,null));};exports['show']=function(_0x3dc2b1,_0x362141){var _0x535ad0={'raw':!![],'where':{'id':_0x3dc2b1[_0xec7e('0x41')]['id']}},_0x5176ef={};_0x5176ef[_0xec7e('0x2b')]=_['keys'](db[_0xec7e('0x27')][_0xec7e('0x28')]);_0x5176ef['query']=_['keys'](_0x3dc2b1[_0xec7e('0x2d')]);_0x5176ef[_0xec7e('0x2f')]=_[_0xec7e('0x30')](_0x5176ef[_0xec7e('0x2b')],_0x5176ef['query']);_0x535ad0[_0xec7e('0x31')]=_[_0xec7e('0x30')](_0x5176ef['model'],qs['fields'](_0x3dc2b1[_0xec7e('0x2d')][_0xec7e('0x32')]));_0x535ad0[_0xec7e('0x31')]=_0x535ad0[_0xec7e('0x31')]['length']?_0x535ad0[_0xec7e('0x31')]:_0x5176ef[_0xec7e('0x2b')];if(_0x3dc2b1['query'][_0xec7e('0x3e')]){_0x535ad0[_0xec7e('0x42')]=[{'all':!![]}];}_0x535ad0=_['merge']({},_0x535ad0,_0x3dc2b1[_0xec7e('0x43')]);return db[_0xec7e('0x27')]['find'](_0x535ad0)[_0xec7e('0x20')](handleEntityNotFound(_0x362141,null))[_0xec7e('0x20')](respondWithResult(_0x362141,null))[_0xec7e('0x44')](handleError(_0x362141,null));};exports[_0xec7e('0x45')]=function(_0x5a852e,_0x156816){return db[_0xec7e('0x27')][_0xec7e('0x45')](_0x5a852e[_0xec7e('0x46')],{})[_0xec7e('0x20')](respondWithResult(_0x156816,0xc9))[_0xec7e('0x44')](handleError(_0x156816,null));};exports[_0xec7e('0x1f')]=function(_0x51de77,_0x1bffc6){if(_0x51de77['body']['id']){delete _0x51de77[_0xec7e('0x46')]['id'];}return db[_0xec7e('0x27')]['find']({'where':{'id':_0x51de77[_0xec7e('0x41')]['id']}})[_0xec7e('0x20')](handleEntityNotFound(_0x1bffc6,null))[_0xec7e('0x20')](saveUpdates(_0x51de77[_0xec7e('0x46')],null))[_0xec7e('0x20')](respondWithResult(_0x1bffc6,null))[_0xec7e('0x44')](handleError(_0x1bffc6,null));};exports['destroy']=function(_0x1400e1,_0x35cb34){return db[_0xec7e('0x27')][_0xec7e('0x47')]({'where':{'id':_0x1400e1['params']['id']}})[_0xec7e('0x20')](handleEntityNotFound(_0x35cb34,null))[_0xec7e('0x20')](removeEntity(_0x35cb34,null))['catch'](handleError(_0x35cb34,null));};exports[_0xec7e('0x48')]=function(_0x13e3c4,_0x3dda6b,_0xe9933e){return db['VoiceMailMessage'][_0xec7e('0x47')]({'where':{'id':_0x13e3c4[_0xec7e('0x41')]['id']},'attributes':['id',_0xec7e('0x49'),_0xec7e('0x4a')]})[_0xec7e('0x20')](handleEntityNotFound(_0x3dda6b,null))[_0xec7e('0x20')](function(_0x152ebc){if(_0x152ebc){if(!_0x152ebc[_0xec7e('0x49')]){throw new db[(_0xec7e('0x4b'))][(_0xec7e('0x4c'))](_0xec7e('0x4d'));}var _0x5318ed={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x152ebc['msg_id']){_0x5318ed[_0xec7e('0x4e')]='attachment;\x20filename=\x22'+_0x152ebc['msg_id']+_0xec7e('0x4f');}_0x3dda6b[_0xec7e('0x1c')](_0x5318ed);return _0x3dda6b['send'](new Buffer(_0x152ebc[_0xec7e('0x49')]));}})[_0xec7e('0x44')](handleError(_0x3dda6b,null));}; \ No newline at end of file +var _0x8cc1=['hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','VoiceMailMessage','includeAll','include','findAll','params','find','catch','body','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','msg_id','.wav\x22','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','apply','reject','update','then','destroy','end','error','name','index','map','rawAttributes','model','keys','filters','attributes','intersection','fields','query'];(function(_0x22ea66,_0x30123a){var _0x529757=function(_0x2340e){while(--_0x2340e){_0x22ea66['push'](_0x22ea66['shift']());}};_0x529757(++_0x30123a);}(_0x8cc1,0x6f));var _0x18cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8cc1[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x18cc('0x0'));var rimraf=require(_0x18cc('0x1'));var zipdir=require(_0x18cc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x18cc('0x3'));var moment=require(_0x18cc('0x4'));var BPromise=require(_0x18cc('0x5'));var Mustache=require('mustache');var util=require(_0x18cc('0x6'));var path=require(_0x18cc('0x7'));var sox=require(_0x18cc('0x8'));var csv=require(_0x18cc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x18cc('0xa'));var _=require('lodash');var squel=require(_0x18cc('0xb'));var crypto=require(_0x18cc('0xc'));var jsforce=require(_0x18cc('0xd'));var deskjs=require(_0x18cc('0xe'));var toCsv=require('to-csv');var querystring=require(_0x18cc('0xf'));var Papa=require(_0x18cc('0x10'));var Redis=require(_0x18cc('0x11'));var authService=require(_0x18cc('0x12'));var qs=require(_0x18cc('0x13'));var as=require(_0x18cc('0x14'));var hardwareService=require(_0x18cc('0x15'));var logger=require(_0x18cc('0x16'))(_0x18cc('0x17'));var utils=require(_0x18cc('0x18'));var config=require(_0x18cc('0x19'));var licenseUtil=require(_0x18cc('0x1a'));var db=require(_0x18cc('0x1b'))['db'];function respondWithStatusCode(_0x333dcd,_0x197bed){_0x197bed=_0x197bed||0xcc;return function(_0x978765){if(_0x978765){return _0x333dcd[_0x18cc('0x1c')](_0x197bed);}return _0x333dcd[_0x18cc('0x1d')](_0x197bed)['end']();};}function respondWithResult(_0x106316,_0x31d76a){_0x31d76a=_0x31d76a||0xc8;return function(_0x1c07b1){if(_0x1c07b1){return _0x106316[_0x18cc('0x1d')](_0x31d76a)[_0x18cc('0x1e')](_0x1c07b1);}};}function respondWithFilteredResult(_0x4d0390,_0x3c9cce){return function(_0x197c29){if(_0x197c29){var _0x5b01e4=typeof _0x3c9cce[_0x18cc('0x1f')]===_0x18cc('0x20')&&typeof _0x3c9cce[_0x18cc('0x21')]==='undefined';var _0x626532=_0x197c29[_0x18cc('0x22')];var _0x36487a=_0x5b01e4?0x0:_0x3c9cce[_0x18cc('0x1f')];var _0x1da3d0=_0x5b01e4?_0x197c29['count']:_0x3c9cce[_0x18cc('0x1f')]+_0x3c9cce[_0x18cc('0x21')];var _0xc3d589;if(_0x1da3d0>=_0x626532){_0x1da3d0=_0x626532;_0xc3d589=0xc8;}else{_0xc3d589=0xce;}_0x4d0390[_0x18cc('0x1d')](_0xc3d589);return _0x4d0390[_0x18cc('0x23')](_0x18cc('0x24'),_0x36487a+'-'+_0x1da3d0+'/'+_0x626532)['json'](_0x197c29);}return null;};}function patchUpdates(_0x3f8744){return function(_0x33b2ed){try{jsonpatch[_0x18cc('0x25')](_0x33b2ed,_0x3f8744,!![]);}catch(_0x2fe0d6){return BPromise[_0x18cc('0x26')](_0x2fe0d6);}return _0x33b2ed['save']();};}function saveUpdates(_0x3146d9,_0x2ceb97){return function(_0x44f465){if(_0x44f465){return _0x44f465[_0x18cc('0x27')](_0x3146d9)[_0x18cc('0x28')](function(_0x23eb60){return _0x23eb60;});}return null;};}function removeEntity(_0x585925,_0x1d3667){return function(_0x2c4401){if(_0x2c4401){return _0x2c4401[_0x18cc('0x29')]()[_0x18cc('0x28')](function(){_0x585925['status'](0xcc)[_0x18cc('0x2a')]();});}};}function handleEntityNotFound(_0x248a3f,_0x53204d){return function(_0x219510){if(!_0x219510){_0x248a3f[_0x18cc('0x1c')](0x194);}return _0x219510;};}function handleError(_0x1b6643,_0x56265d){_0x56265d=_0x56265d||0x1f4;return function(_0x4be03b){logger[_0x18cc('0x2b')](_0x4be03b['stack']);if(_0x4be03b[_0x18cc('0x2c')]){delete _0x4be03b[_0x18cc('0x2c')];}_0x1b6643['status'](_0x56265d)['send'](_0x4be03b);};}exports[_0x18cc('0x2d')]=function(_0xb7df4d,_0x3e05f2){var _0x591070={},_0x145a15={},_0x5e5f0d={'count':0x0,'rows':[]};var _0x59a404=_[_0x18cc('0x2e')](db['VoiceMailMessage'][_0x18cc('0x2f')],function(_0x85d7d1){return{'name':_0x85d7d1['fieldName'],'type':_0x85d7d1['type']['key']};});_0x145a15[_0x18cc('0x30')]=_['differenceBy'](_[_0x18cc('0x2e')](_0x59a404,_0x18cc('0x2c')),[_0x18cc('0x2c')]);_0x145a15['query']=_[_0x18cc('0x31')](_0xb7df4d['query']);_0x145a15[_0x18cc('0x32')]=_['intersection'](_0x145a15[_0x18cc('0x30')],_0x145a15['query']);_0x591070[_0x18cc('0x33')]=_[_0x18cc('0x34')](_0x145a15[_0x18cc('0x30')],qs[_0x18cc('0x35')](_0xb7df4d[_0x18cc('0x36')][_0x18cc('0x35')]));_0x591070['attributes']=_0x591070[_0x18cc('0x33')]['length']?_0x591070['attributes']:_0x145a15[_0x18cc('0x30')];if(!_0xb7df4d[_0x18cc('0x36')][_0x18cc('0x37')](_0x18cc('0x38'))){_0x591070[_0x18cc('0x21')]=qs[_0x18cc('0x21')](_0xb7df4d[_0x18cc('0x36')]['limit']);_0x591070[_0x18cc('0x1f')]=qs[_0x18cc('0x1f')](_0xb7df4d[_0x18cc('0x36')][_0x18cc('0x1f')]);}_0x591070[_0x18cc('0x39')]=qs[_0x18cc('0x3a')](_0xb7df4d[_0x18cc('0x36')]['sort']);_0x591070[_0x18cc('0x3b')]=qs[_0x18cc('0x32')](_[_0x18cc('0x3c')](_0xb7df4d[_0x18cc('0x36')],_0x145a15['filters']),_0x59a404);if(_0xb7df4d['query']['filter']){_0x591070['where']=_[_0x18cc('0x3d')](_0x591070['where'],{'$or':_['map'](_0x59a404,function(_0x5612e2){if(_0x5612e2[_0x18cc('0x3e')]!==_0x18cc('0x3f')){var _0x26423e={};_0x26423e[_0x5612e2[_0x18cc('0x2c')]]={'$like':'%'+_0xb7df4d['query'][_0x18cc('0x40')]+'%'};return _0x26423e;}})});}_0x591070=_[_0x18cc('0x3d')]({},_0x591070,_0xb7df4d[_0x18cc('0x41')]);var _0x1ef2ec={'where':_0x591070[_0x18cc('0x3b')]};return db[_0x18cc('0x42')][_0x18cc('0x22')](_0x1ef2ec)[_0x18cc('0x28')](function(_0x55e968){_0x5e5f0d[_0x18cc('0x22')]=_0x55e968;if(_0xb7df4d['query'][_0x18cc('0x43')]){_0x591070[_0x18cc('0x44')]=[{'all':!![]}];}return db[_0x18cc('0x42')][_0x18cc('0x45')](_0x591070);})[_0x18cc('0x28')](function(_0x405135){_0x5e5f0d['rows']=_0x405135;return _0x5e5f0d;})['then'](respondWithFilteredResult(_0x3e05f2,_0x591070))['catch'](handleError(_0x3e05f2,null));};exports['show']=function(_0x534ea3,_0x5e0c8e){var _0x329d91={'raw':!![],'where':{'id':_0x534ea3[_0x18cc('0x46')]['id']}},_0x3ad64e={};_0x3ad64e[_0x18cc('0x30')]=_[_0x18cc('0x31')](db[_0x18cc('0x42')][_0x18cc('0x2f')]);_0x3ad64e['query']=_[_0x18cc('0x31')](_0x534ea3[_0x18cc('0x36')]);_0x3ad64e[_0x18cc('0x32')]=_[_0x18cc('0x34')](_0x3ad64e[_0x18cc('0x30')],_0x3ad64e['query']);_0x329d91[_0x18cc('0x33')]=_['intersection'](_0x3ad64e['model'],qs[_0x18cc('0x35')](_0x534ea3[_0x18cc('0x36')][_0x18cc('0x35')]));_0x329d91[_0x18cc('0x33')]=_0x329d91[_0x18cc('0x33')]['length']?_0x329d91[_0x18cc('0x33')]:_0x3ad64e['model'];if(_0x534ea3[_0x18cc('0x36')][_0x18cc('0x43')]){_0x329d91['include']=[{'all':!![]}];}_0x329d91=_[_0x18cc('0x3d')]({},_0x329d91,_0x534ea3['options']);return db[_0x18cc('0x42')][_0x18cc('0x47')](_0x329d91)[_0x18cc('0x28')](handleEntityNotFound(_0x5e0c8e,null))[_0x18cc('0x28')](respondWithResult(_0x5e0c8e,null))[_0x18cc('0x48')](handleError(_0x5e0c8e,null));};exports['create']=function(_0xf4b84c,_0x769a2d){return db[_0x18cc('0x42')]['create'](_0xf4b84c[_0x18cc('0x49')],{})[_0x18cc('0x28')](respondWithResult(_0x769a2d,0xc9))[_0x18cc('0x48')](handleError(_0x769a2d,null));};exports[_0x18cc('0x27')]=function(_0x22fb83,_0xfb5a18){if(_0x22fb83['body']['id']){delete _0x22fb83[_0x18cc('0x49')]['id'];}return db['VoiceMailMessage'][_0x18cc('0x47')]({'where':{'id':_0x22fb83[_0x18cc('0x46')]['id']}})[_0x18cc('0x28')](handleEntityNotFound(_0xfb5a18,null))[_0x18cc('0x28')](saveUpdates(_0x22fb83[_0x18cc('0x49')],null))[_0x18cc('0x28')](respondWithResult(_0xfb5a18,null))[_0x18cc('0x48')](handleError(_0xfb5a18,null));};exports[_0x18cc('0x29')]=function(_0x2e1fa2,_0x4ac40d){return db[_0x18cc('0x42')]['find']({'where':{'id':_0x2e1fa2[_0x18cc('0x46')]['id']}})[_0x18cc('0x28')](handleEntityNotFound(_0x4ac40d,null))['then'](removeEntity(_0x4ac40d,null))[_0x18cc('0x48')](handleError(_0x4ac40d,null));};exports['download']=function(_0x92ca28,_0x578db8,_0x2b6dfb){return db['VoiceMailMessage'][_0x18cc('0x47')]({'where':{'id':_0x92ca28[_0x18cc('0x46')]['id']},'attributes':['id',_0x18cc('0x4a'),'msg_id']})[_0x18cc('0x28')](handleEntityNotFound(_0x578db8,null))[_0x18cc('0x28')](function(_0x4a1f06){if(_0x4a1f06){if(!_0x4a1f06[_0x18cc('0x4a')]){throw new db[(_0x18cc('0x4b'))][(_0x18cc('0x4c'))](_0x18cc('0x4d'));}var _0x4089a3={'Content-Type':_0x18cc('0x4e'),'Content-Disposition':_0x18cc('0x4f')};if(_0x4a1f06['msg_id']){_0x4089a3[_0x18cc('0x50')]='attachment;\x20filename=\x22'+_0x4a1f06[_0x18cc('0x51')]+_0x18cc('0x52');}_0x578db8[_0x18cc('0x23')](_0x4089a3);return _0x578db8['send'](new Buffer(_0x4a1f06['recording']));}})[_0x18cc('0x48')](handleError(_0x578db8,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 6501764..904dd24 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 _0x3bc9=['define','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x3bc9,0x129));var _0x93bc=function(_0x3f996f,_0x2049e8){_0x3f996f=_0x3f996f-0x0;var _0x55c53e=_0x3bc9[_0x3f996f];return _0x55c53e;};'use strict';var _=require(_0x93bc('0x0'));var util=require(_0x93bc('0x1'));var logger=require('../../config/logger')(_0x93bc('0x2'));var moment=require(_0x93bc('0x3'));var BPromise=require(_0x93bc('0x4'));var rp=require(_0x93bc('0x5'));var fs=require('fs');var path=require(_0x93bc('0x6'));var rimraf=require(_0x93bc('0x7'));var config=require(_0x93bc('0x8'));var attributes=require(_0x93bc('0x9'));module[_0x93bc('0xa')]=function(_0x1cfb5d,_0x68ac05){return _0x1cfb5d[_0x93bc('0xb')]('VoiceMailMessage',attributes,{'tableName':_0x93bc('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x93bc('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xfe35=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x40865e,_0x322c17){var _0x28b8b=function(_0x2f5927){while(--_0x2f5927){_0x40865e['push'](_0x40865e['shift']());}};_0x28b8b(++_0x322c17);}(_0xfe35,0x1c8));var _0x5fe3=function(_0x2b636b,_0x16cf7d){_0x2b636b=_0x2b636b-0x0;var _0x14750f=_0xfe35[_0x2b636b];return _0x14750f;};'use strict';var _=require('lodash');var util=require(_0x5fe3('0x0'));var logger=require(_0x5fe3('0x1'))(_0x5fe3('0x2'));var moment=require('moment');var BPromise=require(_0x5fe3('0x3'));var rp=require(_0x5fe3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5fe3('0x5'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x5fe3('0x6')]=function(_0x502076,_0x5d1f20){return _0x502076[_0x5fe3('0x7')](_0x5fe3('0x8'),attributes,{'tableName':_0x5fe3('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x5fe3('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d53f6ac..fb3df96 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 _0xd10c=['moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x10df96,_0x1f62a1){var _0x238069=function(_0x35480d){while(--_0x35480d){_0x10df96['push'](_0x10df96['shift']());}};_0x238069(++_0x1f62a1);}(_0xd10c,0xdb));var _0xcd10=function(_0x5f3f3a,_0x27d2a8){_0x5f3f3a=_0x5f3f3a-0x0;var _0x4f9760=_0xd10c[_0x5f3f3a];return _0x4f9760;};'use strict';var _=require(_0xcd10('0x0'));var util=require('util');var moment=require(_0xcd10('0x1'));var BPromise=require(_0xcd10('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd10('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcd10('0x4'));var logger=require('../../config/logger')(_0xcd10('0x5'));var config=require(_0xcd10('0x6'));var jayson=require(_0xcd10('0x7'));var client=jayson[_0xcd10('0x8')][_0xcd10('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4923d1,_0x6a5b10,_0x45a4fd){return new BPromise(function(_0x25d80b,_0x2ad741){return client['request'](_0x4923d1,_0x45a4fd)[_0xcd10('0xa')](function(_0x69a74){logger[_0xcd10('0xb')](_0xcd10('0xc'),_0x6a5b10,'request\x20sent');logger[_0xcd10('0xd')](_0xcd10('0xe'),_0x6a5b10,_0xcd10('0xf'),JSON[_0xcd10('0x10')](_0x69a74));if(_0x69a74[_0xcd10('0x11')]){if(_0x69a74[_0xcd10('0x11')][_0xcd10('0x12')]===0x1f4){logger['error'](_0xcd10('0xc'),_0x6a5b10,_0x69a74[_0xcd10('0x11')][_0xcd10('0x13')]);return _0x2ad741(_0x69a74[_0xcd10('0x11')]['message']);}logger[_0xcd10('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x6a5b10,_0x69a74['error'][_0xcd10('0x13')]);return _0x25d80b(_0x69a74['error']['message']);}else{logger[_0xcd10('0xb')]('VoiceMailMessage,\x20%s,\x20%s',_0x6a5b10,'request\x20sent');_0x25d80b(_0x69a74[_0xcd10('0x14')][_0xcd10('0x13')]);}})[_0xcd10('0x15')](function(_0x132d7a){logger[_0xcd10('0x11')](_0xcd10('0xc'),_0x6a5b10,_0x132d7a);_0x2ad741(_0x132d7a);});});} \ No newline at end of file +var _0xdfa5=['bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfa5,0xf0));var _0x5dfa=function(_0x4850b1,_0x18aba5){_0x4850b1=_0x4850b1-0x0;var _0x201f09=_0xdfa5[_0x4850b1];return _0x201f09;};'use strict';var _=require('lodash');var util=require(_0x5dfa('0x0'));var moment=require(_0x5dfa('0x1'));var BPromise=require(_0x5dfa('0x2'));var rs=require(_0x5dfa('0x3'));var fs=require('fs');var Redis=require(_0x5dfa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5dfa('0x5'));var logger=require('../../config/logger')(_0x5dfa('0x6'));var config=require(_0x5dfa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5dfa('0x8')][_0x5dfa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ea272,_0x24929b,_0x1eded1){return new BPromise(function(_0x1bb925,_0x3db6b8){return client[_0x5dfa('0xa')](_0x5ea272,_0x1eded1)[_0x5dfa('0xb')](function(_0x4f1225){logger[_0x5dfa('0xc')](_0x5dfa('0xd'),_0x24929b,_0x5dfa('0xe'));logger[_0x5dfa('0xf')](_0x5dfa('0x10'),_0x24929b,'request\x20sent',JSON['stringify'](_0x4f1225));if(_0x4f1225[_0x5dfa('0x11')]){if(_0x4f1225[_0x5dfa('0x11')][_0x5dfa('0x12')]===0x1f4){logger[_0x5dfa('0x11')](_0x5dfa('0xd'),_0x24929b,_0x4f1225[_0x5dfa('0x11')][_0x5dfa('0x13')]);return _0x3db6b8(_0x4f1225[_0x5dfa('0x11')][_0x5dfa('0x13')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x24929b,_0x4f1225[_0x5dfa('0x11')][_0x5dfa('0x13')]);return _0x1bb925(_0x4f1225['error'][_0x5dfa('0x13')]);}else{logger[_0x5dfa('0xc')](_0x5dfa('0xd'),_0x24929b,_0x5dfa('0xe'));_0x1bb925(_0x4f1225[_0x5dfa('0x14')][_0x5dfa('0x13')]);}})[_0x5dfa('0x15')](function(_0x563e7b){logger[_0x5dfa('0x11')](_0x5dfa('0xd'),_0x24929b,_0x563e7b);_0x3db6b8(_0x563e7b);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 414da79..be5cd6f 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 _0x3f5f=['getSounds','post','create','addSound','put','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds'];(function(_0x3e2aec,_0xe82cef){var _0x5c1a2a=function(_0x51a60c){while(--_0x51a60c){_0x3e2aec['push'](_0x3e2aec['shift']());}};_0x5c1a2a(++_0xe82cef);}(_0x3f5f,0x1a3));var _0xf3f5=function(_0x28d6b9,_0xbe9964){_0x28d6b9=_0x28d6b9-0x0;var _0x1e2bee=_0x3f5f[_0x28d6b9];return _0x1e2bee;};'use strict';var multer=require(_0xf3f5('0x0'));var util=require('util');var path=require(_0xf3f5('0x1'));var timeout=require('connect-timeout');var express=require(_0xf3f5('0x2'));var router=express[_0xf3f5('0x3')]();var fs_extra=require(_0xf3f5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf3f5('0x5'));var config=require('../../config/environment');var controller=require(_0xf3f5('0x6'));router[_0xf3f5('0x7')]('/',auth[_0xf3f5('0x8')](),controller[_0xf3f5('0x9')]);router[_0xf3f5('0x7')](_0xf3f5('0xa'),auth[_0xf3f5('0x8')](),controller[_0xf3f5('0xb')]);router['get'](_0xf3f5('0xc'),auth['isAuthenticated'](),controller[_0xf3f5('0xd')]);router[_0xf3f5('0xe')]('/',auth[_0xf3f5('0x8')](),controller[_0xf3f5('0xf')]);router[_0xf3f5('0xe')](_0xf3f5('0xc'),auth[_0xf3f5('0x8')](),controller[_0xf3f5('0x10')]);router[_0xf3f5('0x11')]('/:id',auth[_0xf3f5('0x8')](),controller[_0xf3f5('0x12')]);router[_0xf3f5('0x13')](_0xf3f5('0xa'),auth['isAuthenticated'](),controller[_0xf3f5('0x14')]);router[_0xf3f5('0x13')](_0xf3f5('0x15'),auth[_0xf3f5('0x8')](),controller[_0xf3f5('0x16')]);module[_0xf3f5('0x17')]=router; \ No newline at end of file +var _0xaa61=['Router','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','create','post','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express'];(function(_0x11ccae,_0x3b60ce){var _0x1658ed=function(_0x2a5d7f){while(--_0x2a5d7f){_0x11ccae['push'](_0x11ccae['shift']());}};_0x1658ed(++_0x3b60ce);}(_0xaa61,0xcb));var _0x1aa6=function(_0x41cf8d,_0x8be49){_0x41cf8d=_0x41cf8d-0x0;var _0x5111c1=_0xaa61[_0x41cf8d];return _0x5111c1;};'use strict';var multer=require('multer');var util=require(_0x1aa6('0x0'));var path=require(_0x1aa6('0x1'));var timeout=require(_0x1aa6('0x2'));var express=require(_0x1aa6('0x3'));var router=express[_0x1aa6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1aa6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1aa6('0x6'));var controller=require(_0x1aa6('0x7'));router[_0x1aa6('0x8')]('/',auth['isAuthenticated'](),controller[_0x1aa6('0x9')]);router[_0x1aa6('0x8')](_0x1aa6('0xa'),auth[_0x1aa6('0xb')](),controller[_0x1aa6('0xc')]);router[_0x1aa6('0x8')](_0x1aa6('0xd'),auth['isAuthenticated'](),controller[_0x1aa6('0xe')]);router['post']('/',auth[_0x1aa6('0xb')](),controller[_0x1aa6('0xf')]);router[_0x1aa6('0x10')](_0x1aa6('0xd'),auth[_0x1aa6('0xb')](),controller['addSound']);router['put'](_0x1aa6('0xa'),auth['isAuthenticated'](),controller[_0x1aa6('0x11')]);router[_0x1aa6('0x12')](_0x1aa6('0xa'),auth[_0x1aa6('0xb')](),controller[_0x1aa6('0x13')]);router['delete'](_0x1aa6('0x14'),auth[_0x1aa6('0xb')](),controller[_0x1aa6('0x15')]);module[_0x1aa6('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 bc53406..44af3e3 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 _0x0ad8=['quietmp3nb','quietmp3','mp3','BOOLEAN','sequelize','exports','STRING','ENUM','custom','files'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x0ad8,0x1b2));var _0x80ad=function(_0x401557,_0x3311af){_0x401557=_0x401557-0x0;var _0x46106f=_0x0ad8[_0x401557];return _0x46106f;};'use strict';var Sequelize=require(_0x80ad('0x0'));module[_0x80ad('0x1')]={'name':{'type':Sequelize[_0x80ad('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x80ad('0x3')](_0x80ad('0x4'),_0x80ad('0x5'),'mp3nb',_0x80ad('0x6'),_0x80ad('0x7'),_0x80ad('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x80ad('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x80ad('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x80ad('0x2')],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x80ad('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2bac=['exports','STRING','name','ENUM','custom','mp3nb','quietmp3','mp3','files','TIMESTAMP','sequelize'];(function(_0x14e981,_0x49b95d){var _0x30e254=function(_0x2a3164){while(--_0x2a3164){_0x14e981['push'](_0x14e981['shift']());}};_0x30e254(++_0x49b95d);}(_0x2bac,0x133));var _0xc2ba=function(_0x378a1c,_0x4851a4){_0x378a1c=_0x378a1c-0x0;var _0x53c7c0=_0x2bac[_0x378a1c];return _0x53c7c0;};'use strict';var Sequelize=require(_0xc2ba('0x0'));module[_0xc2ba('0x1')]={'name':{'type':Sequelize[_0xc2ba('0x2')],'allowNull':![],'unique':_0xc2ba('0x3')},'mode':{'type':Sequelize[_0xc2ba('0x4')](_0xc2ba('0x5'),'files',_0xc2ba('0x6'),'quietmp3nb',_0xc2ba('0x7'),_0xc2ba('0x8')),'allowNull':!![],'defaultValue':_0xc2ba('0x9')},'directory':{'type':Sequelize[_0xc2ba('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xc2ba('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc2ba('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xc2ba('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0xc2ba('0xa')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 01ac2ef..71a593b 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 _0x5254=['map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','include','rows','catch','includeAll','find','body','params','sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','id2','getSounds','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5254,0x117));var _0x4525=function(_0x3dc929,_0x1d6514){_0x3dc929=_0x3dc929-0x0;var _0xf94c74=_0x5254[_0x3dc929];return _0xf94c74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4525('0x0'));var zipdir=require(_0x4525('0x1'));var jsonpatch=require(_0x4525('0x2'));var rp=require(_0x4525('0x3'));var moment=require(_0x4525('0x4'));var BPromise=require(_0x4525('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4525('0x6'));var sox=require('sox');var csv=require(_0x4525('0x7'));var ejs=require(_0x4525('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4525('0x9'));var squel=require(_0x4525('0xa'));var crypto=require(_0x4525('0xb'));var jsforce=require(_0x4525('0xc'));var deskjs=require(_0x4525('0xd'));var toCsv=require(_0x4525('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4525('0xe'));var qs=require(_0x4525('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4525('0x10'));var logger=require(_0x4525('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4525('0x12'));var db=require(_0x4525('0x13'))['db'];function respondWithStatusCode(_0x1a16a1,_0x119e31){_0x119e31=_0x119e31||0xcc;return function(_0x17ea31){if(_0x17ea31){return _0x1a16a1[_0x4525('0x14')](_0x119e31);}return _0x1a16a1[_0x4525('0x15')](_0x119e31)['end']();};}function respondWithResult(_0x4e0f25,_0x1e39e6){_0x1e39e6=_0x1e39e6||0xc8;return function(_0x3991aa){if(_0x3991aa){return _0x4e0f25[_0x4525('0x15')](_0x1e39e6)[_0x4525('0x16')](_0x3991aa);}};}function respondWithFilteredResult(_0x4279c2,_0x2575cb){return function(_0x4f088d){if(_0x4f088d){var _0x3eb107=typeof _0x2575cb[_0x4525('0x17')]===_0x4525('0x18')&&typeof _0x2575cb[_0x4525('0x19')]===_0x4525('0x18');var _0x1e0cca=_0x4f088d['count'];var _0x4cf553=_0x3eb107?0x0:_0x2575cb[_0x4525('0x17')];var _0x4505a6=_0x3eb107?_0x4f088d[_0x4525('0x1a')]:_0x2575cb[_0x4525('0x17')]+_0x2575cb[_0x4525('0x19')];var _0x22e3e0;if(_0x4505a6>=_0x1e0cca){_0x4505a6=_0x1e0cca;_0x22e3e0=0xc8;}else{_0x22e3e0=0xce;}_0x4279c2[_0x4525('0x15')](_0x22e3e0);return _0x4279c2[_0x4525('0x1b')](_0x4525('0x1c'),_0x4cf553+'-'+_0x4505a6+'/'+_0x1e0cca)[_0x4525('0x16')](_0x4f088d);}return null;};}function patchUpdates(_0x1e5969){return function(_0x7f18a8){try{jsonpatch[_0x4525('0x1d')](_0x7f18a8,_0x1e5969,!![]);}catch(_0x249dfa){return BPromise['reject'](_0x249dfa);}return _0x7f18a8['save']();};}function saveUpdates(_0x5efef0,_0x198e1a){return function(_0x4c973b){if(_0x4c973b){return _0x4c973b[_0x4525('0x1e')](_0x5efef0)[_0x4525('0x1f')](function(_0x4f13a0){return _0x4f13a0;});}return null;};}function removeEntity(_0xd47c8e,_0x402b8a){return function(_0x2f8082){if(_0x2f8082){return _0x2f8082[_0x4525('0x20')]()[_0x4525('0x1f')](function(){var _0xfff84b=_0x2f8082[_0x4525('0x21')]({'plain':!![]});var _0x12f722=_0x4525('0x22');return db[_0x4525('0x23')]['destroy']({'where':{'type':_0x12f722,'resourceId':_0xfff84b['id']}})[_0x4525('0x1f')](function(){return _0x2f8082;});})[_0x4525('0x1f')](function(){_0xd47c8e[_0x4525('0x15')](0xcc)[_0x4525('0x24')]();});}};}function handleEntityNotFound(_0x2561f2,_0x3ee553){return function(_0x520fb0){if(!_0x520fb0){_0x2561f2[_0x4525('0x14')](0x194);}return _0x520fb0;};}function handleError(_0x4b4503,_0x44314f){_0x44314f=_0x44314f||0x1f4;return function(_0x1c6518){logger[_0x4525('0x25')](_0x1c6518[_0x4525('0x26')]);if(_0x1c6518[_0x4525('0x27')]){delete _0x1c6518[_0x4525('0x27')];}_0x4b4503[_0x4525('0x15')](_0x44314f)[_0x4525('0x28')](_0x1c6518);};}exports[_0x4525('0x29')]=function(_0x58cd0b,_0x19b030){var _0xe669b8={},_0x432e88={},_0x1b6339={'count':0x0,'rows':[]};var _0x440e15=_[_0x4525('0x2a')](db[_0x4525('0x2b')][_0x4525('0x2c')],function(_0x163c4b){return{'name':_0x163c4b[_0x4525('0x2d')],'type':_0x163c4b[_0x4525('0x2e')][_0x4525('0x2f')]};});_0x432e88[_0x4525('0x30')]=_[_0x4525('0x2a')](_0x440e15,_0x4525('0x27'));_0x432e88[_0x4525('0x31')]=_[_0x4525('0x32')](_0x58cd0b['query']);_0x432e88['filters']=_[_0x4525('0x33')](_0x432e88['model'],_0x432e88['query']);_0xe669b8[_0x4525('0x34')]=_[_0x4525('0x33')](_0x432e88[_0x4525('0x30')],qs['fields'](_0x58cd0b[_0x4525('0x31')][_0x4525('0x35')]));_0xe669b8[_0x4525('0x34')]=_0xe669b8['attributes'][_0x4525('0x36')]?_0xe669b8[_0x4525('0x34')]:_0x432e88[_0x4525('0x30')];if(!_0x58cd0b['query'][_0x4525('0x37')](_0x4525('0x38'))){_0xe669b8[_0x4525('0x19')]=qs[_0x4525('0x19')](_0x58cd0b['query'][_0x4525('0x19')]);_0xe669b8[_0x4525('0x17')]=qs['offset'](_0x58cd0b[_0x4525('0x31')]['offset']);}_0xe669b8['order']=qs[_0x4525('0x39')](_0x58cd0b[_0x4525('0x31')][_0x4525('0x39')]);delete _0x58cd0b[_0x4525('0x31')][_0x4525('0x39')];_0xe669b8[_0x4525('0x3a')]=qs[_0x4525('0x3b')](_[_0x4525('0x3c')](_0x58cd0b[_0x4525('0x31')],_0x432e88['filters']),_0x440e15);if(_0x58cd0b['query']['filter']){_0xe669b8[_0x4525('0x3a')]=_[_0x4525('0x3d')](_0xe669b8[_0x4525('0x3a')],{'$or':_['map'](_0x440e15,function(_0xd12ac4){if(_0xd12ac4[_0x4525('0x2e')]!==_0x4525('0x3e')){var _0x294033={};_0x294033[_0xd12ac4[_0x4525('0x27')]]={'$like':'%'+_0x58cd0b[_0x4525('0x31')][_0x4525('0x3f')]+'%'};return _0x294033;}})});}_0xe669b8=_[_0x4525('0x3d')]({},_0xe669b8,_0x58cd0b[_0x4525('0x40')]);var _0xfea2b={'where':_0xe669b8['where']};return db['VoiceMusicOnHold'][_0x4525('0x1a')](_0xfea2b)[_0x4525('0x1f')](function(_0x2a438a){_0x1b6339[_0x4525('0x1a')]=_0x2a438a;if(_0x58cd0b['query']['includeAll']){_0xe669b8[_0x4525('0x41')]=[{'all':!![]}];}return db[_0x4525('0x2b')]['findAll'](_0xe669b8);})[_0x4525('0x1f')](function(_0x208034){_0x1b6339[_0x4525('0x42')]=_0x208034;return _0x1b6339;})[_0x4525('0x1f')](respondWithFilteredResult(_0x19b030,_0xe669b8))[_0x4525('0x43')](handleError(_0x19b030,null));};exports['show']=function(_0x50369b,_0x47f0cc){var _0x5c835e={'raw':![],'where':{'id':_0x50369b['params']['id']}},_0x4d06c4={};_0x4d06c4['model']=_['keys'](db[_0x4525('0x2b')][_0x4525('0x2c')]);_0x4d06c4[_0x4525('0x31')]=_[_0x4525('0x32')](_0x50369b[_0x4525('0x31')]);_0x4d06c4[_0x4525('0x3b')]=_[_0x4525('0x33')](_0x4d06c4[_0x4525('0x30')],_0x4d06c4[_0x4525('0x31')]);_0x5c835e[_0x4525('0x34')]=_['intersection'](_0x4d06c4[_0x4525('0x30')],qs['fields'](_0x50369b[_0x4525('0x31')][_0x4525('0x35')]));_0x5c835e[_0x4525('0x34')]=_0x5c835e['attributes'][_0x4525('0x36')]?_0x5c835e['attributes']:_0x4d06c4['model'];if(_0x50369b[_0x4525('0x31')][_0x4525('0x44')]){_0x5c835e[_0x4525('0x41')]=[{'all':!![]}];}_0x5c835e=_['merge']({},_0x5c835e,_0x50369b['options']);return db[_0x4525('0x2b')][_0x4525('0x45')](_0x5c835e)[_0x4525('0x1f')](handleEntityNotFound(_0x47f0cc,null))[_0x4525('0x1f')](respondWithResult(_0x47f0cc,null))[_0x4525('0x43')](handleError(_0x47f0cc,null));};exports[_0x4525('0x1e')]=function(_0x191fd9,_0x4b8e5f){if(_0x191fd9[_0x4525('0x46')]['id']){delete _0x191fd9[_0x4525('0x46')]['id'];}return db[_0x4525('0x2b')][_0x4525('0x45')]({'where':{'id':_0x191fd9[_0x4525('0x47')]['id']}})['then'](handleEntityNotFound(_0x4b8e5f,null))['then'](saveUpdates(_0x191fd9['body'],null))[_0x4525('0x1f')](respondWithResult(_0x4b8e5f,null))[_0x4525('0x43')](handleError(_0x4b8e5f,null));};exports['create']=function(_0x26fa33,_0x62e2e1,_0x3823ad){return db[_0x4525('0x48')][_0x4525('0x49')](function(_0x5a784f){if(_0x26fa33[_0x4525('0x46')][_0x4525('0x4a')]===_0x4525('0x4b')){_0x26fa33[_0x4525('0x46')][_0x4525('0x4c')]=path[_0x4525('0x4d')](config[_0x4525('0x4e')],_0x4525('0x4f'),_0x26fa33[_0x4525('0x46')][_0x4525('0x27')]);}return db[_0x4525('0x2b')][_0x4525('0x50')](_0x26fa33[_0x4525('0x46')],{'transaction':_0x5a784f})[_0x4525('0x1f')](function(_0x528037){if(_0x26fa33[_0x4525('0x46')][_0x4525('0x4a')]===_0x4525('0x4b')){fs['mkdirSync'](_0x528037[_0x4525('0x4c')],parseInt('0777',0x8));}var _0x58dedf=_0x26fa33[_0x4525('0x51')]['get']({'plain':!![]});if(!_0x58dedf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58dedf['role']==='user'){var _0x5c4a81=_0x528037[_0x4525('0x21')]({'plain':!![]});return db[_0x4525('0x52')][_0x4525('0x45')]({'where':{'name':_0x4525('0x22'),'userProfileId':_0x58dedf[_0x4525('0x53')]},'raw':!![]})[_0x4525('0x1f')](function(_0x2e01c8){if(_0x2e01c8&&_0x2e01c8['autoAssociation']===0x0){return db[_0x4525('0x23')]['create']({'name':_0x5c4a81[_0x4525('0x27')],'resourceId':_0x5c4a81['id'],'type':_0x2e01c8['name'],'sectionId':_0x2e01c8['id']},{})[_0x4525('0x1f')](function(){return _0x528037;});}else{return _0x528037;}})['catch'](function(_0x1921af){logger[_0x4525('0x25')](_0x4525('0x54'),_0x1921af);});}return _0x528037;});})['then'](respondWithResult(_0x62e2e1,0xc9))[_0x4525('0x43')](handleError(_0x62e2e1,null));};exports[_0x4525('0x20')]=function(_0x2ce604,_0x220d25,_0x3be4fe){var _0x7b83f0;return db[_0x4525('0x2b')][_0x4525('0x45')]({'where':{'id':_0x2ce604[_0x4525('0x47')]['id']}})[_0x4525('0x1f')](function(_0x4367ef){if(_0x4367ef){return db[_0x4525('0x48')]['transaction'](function(_0x1870f1){return _0x4367ef[_0x4525('0x20')]({'transaction':_0x1870f1,'raw':!![]})[_0x4525('0x1f')](function(_0x13a269){if(_0x13a269[_0x4525('0x4c')]){fs[_0x4525('0x55')](_0x13a269[_0x4525('0x4c')])[_0x4525('0x56')](function(_0xbd3051){fs[_0x4525('0x57')](path['join'](_0x13a269[_0x4525('0x4c')],_0xbd3051));});fs['rmdirSync'](_0x13a269[_0x4525('0x4c')]);}return _0x13a269;});})['catch'](function(_0x21613b){throw new db[(_0x4525('0x58'))][(_0x4525('0x59'))](_0x21613b[_0x4525('0x5a')]);});}})[_0x4525('0x1f')](handleEntityNotFound(_0x220d25,null))[_0x4525('0x1f')](removeEntity(_0x220d25,null))[_0x4525('0x43')](handleError(_0x220d25,null));};exports[_0x4525('0x5b')]=function(_0x21c751,_0x2923d9,_0x304a14){return db[_0x4525('0x48')][_0x4525('0x49')](function(_0x559af4){var _0x5f53fa;return db[_0x4525('0x2b')][_0x4525('0x45')]({'where':{'id':_0x21c751[_0x4525('0x47')]['id']}})[_0x4525('0x1f')](function(_0x46d7d3){if(_0x46d7d3){_0x5f53fa=_0x46d7d3;return _0x46d7d3['addSound'](_0x21c751[_0x4525('0x46')]['id'],{'transaction':_0x559af4});}})[_0x4525('0x1f')](function(_0x13f48f){if(_0x13f48f){return db[_0x4525('0x5c')][_0x4525('0x5d')]({'where':{'id':_0x21c751[_0x4525('0x46')]['id']},'attributes':['id',_0x4525('0x27'),'save_name',_0x4525('0x5e'),_0x4525('0x5f')],'raw':!![]});}})[_0x4525('0x1f')](function(_0x5bd0bb){if(_0x5bd0bb){var _0x51f5a5=path['join'](config['root'],_0x4525('0x60'),util[_0x4525('0x61')](_0x4525('0x62'),path[_0x4525('0x63')](_0x5bd0bb[_0x4525('0x64')],path[_0x4525('0x65')](_0x5bd0bb[_0x4525('0x64')])),_0x5bd0bb[_0x4525('0x5e')]));var _0x83d043=path[_0x4525('0x4d')](config[_0x4525('0x4e')],_0x4525('0x4f'),_0x5f53fa['name'],util['format'](_0x4525('0x62'),_0x5bd0bb[_0x4525('0x27')],_0x5bd0bb[_0x4525('0x5e')]));fs[_0x4525('0x66')](_0x51f5a5,_0x83d043);return _0x5bd0bb;}})['catch'](function(_0x1fa3be){throw new db[(_0x4525('0x58'))][(_0x4525('0x59'))](_0x1fa3be['message']);});})[_0x4525('0x1f')](handleEntityNotFound(_0x2923d9,null))['then'](respondWithResult(_0x2923d9,0xc9))['catch'](handleError(_0x2923d9,null));};exports[_0x4525('0x67')]=function(_0x2a378a,_0x2e85b5,_0x23f88a){return db[_0x4525('0x48')][_0x4525('0x49')](function(_0x218e30){var _0x2e8eaf;return db[_0x4525('0x2b')][_0x4525('0x5d')]({'where':{'id':_0x2a378a['params']['id']}})[_0x4525('0x1f')](handleEntityNotFound(_0x2e85b5,null))[_0x4525('0x1f')](function(_0x36f581){if(_0x36f581){_0x2e8eaf=_0x36f581;return _0x36f581[_0x4525('0x67')](_0x2a378a[_0x4525('0x47')][_0x4525('0x68')]);}})['then'](function(_0x5cb0c4){if(_0x5cb0c4){return db['Sound'][_0x4525('0x5d')]({'where':{'id':_0x2a378a[_0x4525('0x47')][_0x4525('0x68')]},'attributes':['id',_0x4525('0x27'),_0x4525('0x64'),_0x4525('0x5e'),'createdAt'],'raw':!![]});}})[_0x4525('0x1f')](function(_0x39e19b){if(_0x39e19b){fs[_0x4525('0x57')](path['join'](_0x2e8eaf['directory'],util[_0x4525('0x61')]('%s.%s',_0x39e19b[_0x4525('0x27')],_0x39e19b[_0x4525('0x5e')])));return _0x39e19b;}})[_0x4525('0x43')](function(_0x3e8558){throw new db[(_0x4525('0x58'))]['ValidationError'](_0x3e8558[_0x4525('0x5a')]);});})['then'](handleEntityNotFound(_0x2e85b5,null))['then'](respondWithStatusCode(_0x2e85b5,0xcc))[_0x4525('0x43')](handleError(_0x2e85b5,null));};exports[_0x4525('0x69')]=function(_0x26cdae,_0x58ed3f,_0x163074){var _0x45b219={};var _0x420fb2={};var _0x5d6471;var _0x39f253;return db[_0x4525('0x2b')][_0x4525('0x5d')]({'where':{'id':_0x26cdae['params']['id']}})[_0x4525('0x1f')](handleEntityNotFound(_0x58ed3f,null))[_0x4525('0x1f')](function(_0x407217){if(_0x407217){_0x5d6471=_0x407217;_0x420fb2[_0x4525('0x30')]=_[_0x4525('0x32')](db[_0x4525('0x5c')]['rawAttributes']);_0x420fb2['query']=_[_0x4525('0x32')](_0x26cdae['query']);_0x420fb2[_0x4525('0x3b')]=_[_0x4525('0x33')](_0x420fb2[_0x4525('0x30')],_0x420fb2['query']);_0x45b219[_0x4525('0x34')]=_[_0x4525('0x33')](_0x420fb2[_0x4525('0x30')],qs[_0x4525('0x35')](_0x26cdae[_0x4525('0x31')][_0x4525('0x35')]));_0x45b219[_0x4525('0x34')]=_0x45b219['attributes'][_0x4525('0x36')]?_0x45b219[_0x4525('0x34')]:_0x420fb2[_0x4525('0x30')];_0x45b219[_0x4525('0x6a')]=qs[_0x4525('0x39')](_0x26cdae[_0x4525('0x31')][_0x4525('0x39')]);_0x45b219[_0x4525('0x3a')]=qs['filters'](_[_0x4525('0x3c')](_0x26cdae[_0x4525('0x31')],_0x420fb2[_0x4525('0x3b')]));if(_0x26cdae[_0x4525('0x31')]['filter']){_0x45b219['where']=_['merge'](_0x45b219[_0x4525('0x3a')],{'$or':_[_0x4525('0x2a')](_0x45b219[_0x4525('0x34')],function(_0x23d69b){var _0x3a2c39={};_0x3a2c39[_0x23d69b]={'$like':'%'+_0x26cdae[_0x4525('0x31')][_0x4525('0x3f')]+'%'};return _0x3a2c39;})});}_0x45b219=_['merge']({},_0x45b219,_0x26cdae[_0x4525('0x40')]);return _0x5d6471[_0x4525('0x69')](_0x45b219);}})['then'](function(_0x4c2ca4){if(_0x4c2ca4){_0x39f253=_0x4c2ca4['length'];if(!_0x26cdae[_0x4525('0x31')][_0x4525('0x37')](_0x4525('0x38'))){_0x45b219[_0x4525('0x19')]=qs['limit'](_0x26cdae[_0x4525('0x31')][_0x4525('0x19')]);_0x45b219[_0x4525('0x17')]=qs[_0x4525('0x17')](_0x26cdae[_0x4525('0x31')][_0x4525('0x17')]);}return _0x5d6471[_0x4525('0x69')](_0x45b219);}})[_0x4525('0x1f')](function(_0x54c4ae){if(_0x54c4ae){return _0x54c4ae?{'count':_0x39f253,'rows':_0x54c4ae}:null;}})['then'](respondWithResult(_0x58ed3f,null))[_0x4525('0x43')](handleError(_0x58ed3f,null));}; \ No newline at end of file +var _0xba64=['options','includeAll','include','rows','catch','show','merge','find','body','params','sequelize','files','join','server/files/moh','create','mode','mkdirSync','directory','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','readdirSync','forEach','addSound','findOne','save_name','createdAt','root','server/files/sounds/converted','%s.%s','extname','converted_format','format','symlinkSync','Sequelize','removeSound','id2','unlinkSync','message','Sound','rawAttributes','getSounds','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','reject','update','then','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xba64,0x9e));var _0x4ba6=function(_0xdf7497,_0x1226a7){_0xdf7497=_0xdf7497-0x0;var _0x470986=_0xba64[_0xdf7497];return _0x470986;};'use strict';var emlformat=require(_0x4ba6('0x0'));var rimraf=require(_0x4ba6('0x1'));var zipdir=require(_0x4ba6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4ba6('0x3'));var moment=require(_0x4ba6('0x4'));var BPromise=require(_0x4ba6('0x5'));var Mustache=require(_0x4ba6('0x6'));var util=require(_0x4ba6('0x7'));var path=require(_0x4ba6('0x8'));var sox=require(_0x4ba6('0x9'));var csv=require(_0x4ba6('0xa'));var ejs=require(_0x4ba6('0xb'));var fs=require('fs');var fs_extra=require(_0x4ba6('0xc'));var _=require(_0x4ba6('0xd'));var squel=require(_0x4ba6('0xe'));var crypto=require(_0x4ba6('0xf'));var jsforce=require(_0x4ba6('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4ba6('0x11'));var Papa=require(_0x4ba6('0x12'));var Redis=require(_0x4ba6('0x13'));var authService=require(_0x4ba6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x4ba6('0x15'));var hardwareService=require(_0x4ba6('0x16'));var logger=require(_0x4ba6('0x17'))('api');var utils=require(_0x4ba6('0x18'));var config=require(_0x4ba6('0x19'));var licenseUtil=require(_0x4ba6('0x1a'));var db=require(_0x4ba6('0x1b'))['db'];function respondWithStatusCode(_0xbbc4a3,_0x399b27){_0x399b27=_0x399b27||0xcc;return function(_0x16a88b){if(_0x16a88b){return _0xbbc4a3['sendStatus'](_0x399b27);}return _0xbbc4a3['status'](_0x399b27)[_0x4ba6('0x1c')]();};}function respondWithResult(_0x5bca76,_0x245fe9){_0x245fe9=_0x245fe9||0xc8;return function(_0x3d75f7){if(_0x3d75f7){return _0x5bca76[_0x4ba6('0x1d')](_0x245fe9)['json'](_0x3d75f7);}};}function respondWithFilteredResult(_0x3e228b,_0x3624d9){return function(_0x51875a){if(_0x51875a){var _0x221b33=typeof _0x3624d9[_0x4ba6('0x1e')]==='undefined'&&typeof _0x3624d9['limit']===_0x4ba6('0x1f');var _0x544084=_0x51875a[_0x4ba6('0x20')];var _0x5da283=_0x221b33?0x0:_0x3624d9['offset'];var _0x44d8fb=_0x221b33?_0x51875a['count']:_0x3624d9[_0x4ba6('0x1e')]+_0x3624d9[_0x4ba6('0x21')];var _0x2e53c6;if(_0x44d8fb>=_0x544084){_0x44d8fb=_0x544084;_0x2e53c6=0xc8;}else{_0x2e53c6=0xce;}_0x3e228b[_0x4ba6('0x1d')](_0x2e53c6);return _0x3e228b[_0x4ba6('0x22')]('Content-Range',_0x5da283+'-'+_0x44d8fb+'/'+_0x544084)['json'](_0x51875a);}return null;};}function patchUpdates(_0x3a13aa){return function(_0x3a4bd6){try{jsonpatch['apply'](_0x3a4bd6,_0x3a13aa,!![]);}catch(_0x151abc){return BPromise[_0x4ba6('0x23')](_0x151abc);}return _0x3a4bd6['save']();};}function saveUpdates(_0x32f245,_0x3d2c3c){return function(_0x43f389){if(_0x43f389){return _0x43f389[_0x4ba6('0x24')](_0x32f245)[_0x4ba6('0x25')](function(_0x2e769c){return _0x2e769c;});}return null;};}function removeEntity(_0x3618b6,_0x23c7e6){return function(_0x2c042d){if(_0x2c042d){return _0x2c042d['destroy']()[_0x4ba6('0x25')](function(){var _0x4f61e0=_0x2c042d[_0x4ba6('0x26')]({'plain':!![]});var _0x5eea2b=_0x4ba6('0x27');return db[_0x4ba6('0x28')]['destroy']({'where':{'type':_0x5eea2b,'resourceId':_0x4f61e0['id']}})[_0x4ba6('0x25')](function(){return _0x2c042d;});})['then'](function(){_0x3618b6[_0x4ba6('0x1d')](0xcc)[_0x4ba6('0x1c')]();});}};}function handleEntityNotFound(_0x5e0913,_0x231d3b){return function(_0x310fd9){if(!_0x310fd9){_0x5e0913['sendStatus'](0x194);}return _0x310fd9;};}function handleError(_0x445907,_0x1bbc7c){_0x1bbc7c=_0x1bbc7c||0x1f4;return function(_0x2e896d){logger[_0x4ba6('0x29')](_0x2e896d[_0x4ba6('0x2a')]);if(_0x2e896d[_0x4ba6('0x2b')]){delete _0x2e896d[_0x4ba6('0x2b')];}_0x445907[_0x4ba6('0x1d')](_0x1bbc7c)[_0x4ba6('0x2c')](_0x2e896d);};}exports[_0x4ba6('0x2d')]=function(_0x2b21b2,_0xb19886){var _0x496db9={},_0x35a33a={},_0x2320d2={'count':0x0,'rows':[]};var _0x37e71d=_[_0x4ba6('0x2e')](db[_0x4ba6('0x2f')]['rawAttributes'],function(_0x223edd){return{'name':_0x223edd[_0x4ba6('0x30')],'type':_0x223edd[_0x4ba6('0x31')][_0x4ba6('0x32')]};});_0x35a33a[_0x4ba6('0x33')]=_[_0x4ba6('0x2e')](_0x37e71d,'name');_0x35a33a['query']=_[_0x4ba6('0x34')](_0x2b21b2['query']);_0x35a33a[_0x4ba6('0x35')]=_[_0x4ba6('0x36')](_0x35a33a['model'],_0x35a33a[_0x4ba6('0x37')]);_0x496db9['attributes']=_[_0x4ba6('0x36')](_0x35a33a[_0x4ba6('0x33')],qs['fields'](_0x2b21b2['query'][_0x4ba6('0x38')]));_0x496db9[_0x4ba6('0x39')]=_0x496db9[_0x4ba6('0x39')][_0x4ba6('0x3a')]?_0x496db9['attributes']:_0x35a33a[_0x4ba6('0x33')];if(!_0x2b21b2[_0x4ba6('0x37')][_0x4ba6('0x3b')](_0x4ba6('0x3c'))){_0x496db9['limit']=qs[_0x4ba6('0x21')](_0x2b21b2[_0x4ba6('0x37')]['limit']);_0x496db9[_0x4ba6('0x1e')]=qs[_0x4ba6('0x1e')](_0x2b21b2[_0x4ba6('0x37')]['offset']);}_0x496db9[_0x4ba6('0x3d')]=qs['sort'](_0x2b21b2[_0x4ba6('0x37')][_0x4ba6('0x3e')]);delete _0x2b21b2[_0x4ba6('0x37')][_0x4ba6('0x3e')];_0x496db9[_0x4ba6('0x3f')]=qs['filters'](_[_0x4ba6('0x40')](_0x2b21b2[_0x4ba6('0x37')],_0x35a33a['filters']),_0x37e71d);if(_0x2b21b2['query']['filter']){_0x496db9[_0x4ba6('0x3f')]=_['merge'](_0x496db9['where'],{'$or':_[_0x4ba6('0x2e')](_0x37e71d,function(_0x14e21e){if(_0x14e21e[_0x4ba6('0x31')]!=='VIRTUAL'){var _0x1b4c42={};_0x1b4c42[_0x14e21e[_0x4ba6('0x2b')]]={'$like':'%'+_0x2b21b2[_0x4ba6('0x37')][_0x4ba6('0x41')]+'%'};return _0x1b4c42;}})});}_0x496db9=_['merge']({},_0x496db9,_0x2b21b2[_0x4ba6('0x42')]);var _0x1bfba5={'where':_0x496db9['where']};return db[_0x4ba6('0x2f')][_0x4ba6('0x20')](_0x1bfba5)[_0x4ba6('0x25')](function(_0x2a4c45){_0x2320d2[_0x4ba6('0x20')]=_0x2a4c45;if(_0x2b21b2[_0x4ba6('0x37')][_0x4ba6('0x43')]){_0x496db9[_0x4ba6('0x44')]=[{'all':!![]}];}return db[_0x4ba6('0x2f')]['findAll'](_0x496db9);})['then'](function(_0x881358){_0x2320d2[_0x4ba6('0x45')]=_0x881358;return _0x2320d2;})[_0x4ba6('0x25')](respondWithFilteredResult(_0xb19886,_0x496db9))[_0x4ba6('0x46')](handleError(_0xb19886,null));};exports[_0x4ba6('0x47')]=function(_0x327f50,_0xef3d5b){var _0x351fd3={'raw':![],'where':{'id':_0x327f50['params']['id']}},_0x5c924b={};_0x5c924b[_0x4ba6('0x33')]=_['keys'](db[_0x4ba6('0x2f')]['rawAttributes']);_0x5c924b[_0x4ba6('0x37')]=_[_0x4ba6('0x34')](_0x327f50['query']);_0x5c924b[_0x4ba6('0x35')]=_[_0x4ba6('0x36')](_0x5c924b['model'],_0x5c924b[_0x4ba6('0x37')]);_0x351fd3[_0x4ba6('0x39')]=_[_0x4ba6('0x36')](_0x5c924b['model'],qs[_0x4ba6('0x38')](_0x327f50['query'][_0x4ba6('0x38')]));_0x351fd3[_0x4ba6('0x39')]=_0x351fd3[_0x4ba6('0x39')][_0x4ba6('0x3a')]?_0x351fd3[_0x4ba6('0x39')]:_0x5c924b['model'];if(_0x327f50[_0x4ba6('0x37')][_0x4ba6('0x43')]){_0x351fd3[_0x4ba6('0x44')]=[{'all':!![]}];}_0x351fd3=_[_0x4ba6('0x48')]({},_0x351fd3,_0x327f50[_0x4ba6('0x42')]);return db['VoiceMusicOnHold'][_0x4ba6('0x49')](_0x351fd3)[_0x4ba6('0x25')](handleEntityNotFound(_0xef3d5b,null))[_0x4ba6('0x25')](respondWithResult(_0xef3d5b,null))[_0x4ba6('0x46')](handleError(_0xef3d5b,null));};exports[_0x4ba6('0x24')]=function(_0x41e266,_0x12b916){if(_0x41e266[_0x4ba6('0x4a')]['id']){delete _0x41e266[_0x4ba6('0x4a')]['id'];}return db[_0x4ba6('0x2f')]['find']({'where':{'id':_0x41e266[_0x4ba6('0x4b')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x12b916,null))[_0x4ba6('0x25')](saveUpdates(_0x41e266['body'],null))['then'](respondWithResult(_0x12b916,null))[_0x4ba6('0x46')](handleError(_0x12b916,null));};exports['create']=function(_0x262794,_0x1e4fe9,_0x32c11c){return db[_0x4ba6('0x4c')]['transaction'](function(_0x256268){if(_0x262794[_0x4ba6('0x4a')]['mode']===_0x4ba6('0x4d')){_0x262794[_0x4ba6('0x4a')]['directory']=path[_0x4ba6('0x4e')](config['root'],_0x4ba6('0x4f'),_0x262794[_0x4ba6('0x4a')]['name']);}return db[_0x4ba6('0x2f')][_0x4ba6('0x50')](_0x262794[_0x4ba6('0x4a')],{'transaction':_0x256268})[_0x4ba6('0x25')](function(_0x1d55dc){if(_0x262794['body'][_0x4ba6('0x51')]===_0x4ba6('0x4d')){fs[_0x4ba6('0x52')](_0x1d55dc[_0x4ba6('0x53')],parseInt('0777',0x8));}var _0x57ad9b=_0x262794[_0x4ba6('0x54')][_0x4ba6('0x26')]({'plain':!![]});if(!_0x57ad9b)throw new Error(_0x4ba6('0x55'));if(_0x57ad9b[_0x4ba6('0x56')]===_0x4ba6('0x54')){var _0x17dfac=_0x1d55dc[_0x4ba6('0x26')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x4ba6('0x27'),'userProfileId':_0x57ad9b[_0x4ba6('0x57')]},'raw':!![]})['then'](function(_0xe4f71e){if(_0xe4f71e&&_0xe4f71e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x17dfac[_0x4ba6('0x2b')],'resourceId':_0x17dfac['id'],'type':_0xe4f71e[_0x4ba6('0x2b')],'sectionId':_0xe4f71e['id']},{})[_0x4ba6('0x25')](function(){return _0x1d55dc;});}else{return _0x1d55dc;}})['catch'](function(_0x46a8e9){logger['error'](_0x4ba6('0x58'),_0x46a8e9);});}return _0x1d55dc;});})[_0x4ba6('0x25')](respondWithResult(_0x1e4fe9,0xc9))['catch'](handleError(_0x1e4fe9,null));};exports[_0x4ba6('0x59')]=function(_0x1f957d,_0x3f37ba,_0xe4d40a){var _0x528117;return db[_0x4ba6('0x2f')][_0x4ba6('0x49')]({'where':{'id':_0x1f957d['params']['id']}})[_0x4ba6('0x25')](function(_0x28a4a3){if(_0x28a4a3){return db[_0x4ba6('0x4c')][_0x4ba6('0x5a')](function(_0x4d418d){return _0x28a4a3['destroy']({'transaction':_0x4d418d,'raw':!![]})[_0x4ba6('0x25')](function(_0x12b5bc){if(_0x12b5bc[_0x4ba6('0x53')]){fs[_0x4ba6('0x5b')](_0x12b5bc['directory'])[_0x4ba6('0x5c')](function(_0x3d1f2e){fs['unlinkSync'](path[_0x4ba6('0x4e')](_0x12b5bc[_0x4ba6('0x53')],_0x3d1f2e));});fs['rmdirSync'](_0x12b5bc[_0x4ba6('0x53')]);}return _0x12b5bc;});})[_0x4ba6('0x46')](function(_0x3cd8b3){throw new db['Sequelize']['ValidationError'](_0x3cd8b3['message']);});}})[_0x4ba6('0x25')](handleEntityNotFound(_0x3f37ba,null))[_0x4ba6('0x25')](removeEntity(_0x3f37ba,null))['catch'](handleError(_0x3f37ba,null));};exports[_0x4ba6('0x5d')]=function(_0x2486dc,_0x5e3976,_0x2db3ea){return db[_0x4ba6('0x4c')][_0x4ba6('0x5a')](function(_0x100745){var _0x44b3e4;return db[_0x4ba6('0x2f')][_0x4ba6('0x49')]({'where':{'id':_0x2486dc[_0x4ba6('0x4b')]['id']}})[_0x4ba6('0x25')](function(_0x5168d2){if(_0x5168d2){_0x44b3e4=_0x5168d2;return _0x5168d2[_0x4ba6('0x5d')](_0x2486dc[_0x4ba6('0x4a')]['id'],{'transaction':_0x100745});}})['then'](function(_0x390f82){if(_0x390f82){return db['Sound'][_0x4ba6('0x5e')]({'where':{'id':_0x2486dc[_0x4ba6('0x4a')]['id']},'attributes':['id',_0x4ba6('0x2b'),_0x4ba6('0x5f'),'converted_format',_0x4ba6('0x60')],'raw':!![]});}})[_0x4ba6('0x25')](function(_0x810b7c){if(_0x810b7c){var _0x4713a8=path[_0x4ba6('0x4e')](config[_0x4ba6('0x61')],_0x4ba6('0x62'),util['format'](_0x4ba6('0x63'),path['basename'](_0x810b7c[_0x4ba6('0x5f')],path[_0x4ba6('0x64')](_0x810b7c[_0x4ba6('0x5f')])),_0x810b7c[_0x4ba6('0x65')]));var _0x3a7b74=path[_0x4ba6('0x4e')](config[_0x4ba6('0x61')],'server/files/moh',_0x44b3e4[_0x4ba6('0x2b')],util[_0x4ba6('0x66')](_0x4ba6('0x63'),_0x810b7c[_0x4ba6('0x2b')],_0x810b7c[_0x4ba6('0x65')]));fs[_0x4ba6('0x67')](_0x4713a8,_0x3a7b74);return _0x810b7c;}})[_0x4ba6('0x46')](function(_0x1b8086){throw new db[(_0x4ba6('0x68'))]['ValidationError'](_0x1b8086['message']);});})[_0x4ba6('0x25')](handleEntityNotFound(_0x5e3976,null))[_0x4ba6('0x25')](respondWithResult(_0x5e3976,0xc9))[_0x4ba6('0x46')](handleError(_0x5e3976,null));};exports['removeSound']=function(_0x2c41c9,_0x1ef778,_0x377b67){return db[_0x4ba6('0x4c')][_0x4ba6('0x5a')](function(_0x321b81){var _0x5843ae;return db['VoiceMusicOnHold'][_0x4ba6('0x5e')]({'where':{'id':_0x2c41c9[_0x4ba6('0x4b')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x1ef778,null))[_0x4ba6('0x25')](function(_0x105534){if(_0x105534){_0x5843ae=_0x105534;return _0x105534[_0x4ba6('0x69')](_0x2c41c9[_0x4ba6('0x4b')][_0x4ba6('0x6a')]);}})[_0x4ba6('0x25')](function(_0x273b34){if(_0x273b34){return db['Sound']['findOne']({'where':{'id':_0x2c41c9['params']['id2']},'attributes':['id',_0x4ba6('0x2b'),_0x4ba6('0x5f'),_0x4ba6('0x65'),_0x4ba6('0x60')],'raw':!![]});}})['then'](function(_0x32e0d7){if(_0x32e0d7){fs[_0x4ba6('0x6b')](path[_0x4ba6('0x4e')](_0x5843ae['directory'],util['format']('%s.%s',_0x32e0d7[_0x4ba6('0x2b')],_0x32e0d7[_0x4ba6('0x65')])));return _0x32e0d7;}})['catch'](function(_0x56f919){throw new db[(_0x4ba6('0x68'))]['ValidationError'](_0x56f919[_0x4ba6('0x6c')]);});})[_0x4ba6('0x25')](handleEntityNotFound(_0x1ef778,null))[_0x4ba6('0x25')](respondWithStatusCode(_0x1ef778,0xcc))[_0x4ba6('0x46')](handleError(_0x1ef778,null));};exports['getSounds']=function(_0x47ccd3,_0x27ec62,_0x352d3b){var _0x5d2365={};var _0x459056={};var _0x3f0667;var _0x479622;return db[_0x4ba6('0x2f')][_0x4ba6('0x5e')]({'where':{'id':_0x47ccd3[_0x4ba6('0x4b')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x27ec62,null))['then'](function(_0x387ae6){if(_0x387ae6){_0x3f0667=_0x387ae6;_0x459056[_0x4ba6('0x33')]=_[_0x4ba6('0x34')](db[_0x4ba6('0x6d')][_0x4ba6('0x6e')]);_0x459056['query']=_[_0x4ba6('0x34')](_0x47ccd3[_0x4ba6('0x37')]);_0x459056['filters']=_[_0x4ba6('0x36')](_0x459056[_0x4ba6('0x33')],_0x459056[_0x4ba6('0x37')]);_0x5d2365[_0x4ba6('0x39')]=_[_0x4ba6('0x36')](_0x459056[_0x4ba6('0x33')],qs[_0x4ba6('0x38')](_0x47ccd3[_0x4ba6('0x37')][_0x4ba6('0x38')]));_0x5d2365[_0x4ba6('0x39')]=_0x5d2365['attributes'][_0x4ba6('0x3a')]?_0x5d2365[_0x4ba6('0x39')]:_0x459056['model'];_0x5d2365[_0x4ba6('0x3d')]=qs[_0x4ba6('0x3e')](_0x47ccd3[_0x4ba6('0x37')][_0x4ba6('0x3e')]);_0x5d2365[_0x4ba6('0x3f')]=qs[_0x4ba6('0x35')](_[_0x4ba6('0x40')](_0x47ccd3[_0x4ba6('0x37')],_0x459056[_0x4ba6('0x35')]));if(_0x47ccd3[_0x4ba6('0x37')][_0x4ba6('0x41')]){_0x5d2365['where']=_[_0x4ba6('0x48')](_0x5d2365['where'],{'$or':_[_0x4ba6('0x2e')](_0x5d2365[_0x4ba6('0x39')],function(_0x5d09af){var _0x3a516e={};_0x3a516e[_0x5d09af]={'$like':'%'+_0x47ccd3[_0x4ba6('0x37')]['filter']+'%'};return _0x3a516e;})});}_0x5d2365=_[_0x4ba6('0x48')]({},_0x5d2365,_0x47ccd3[_0x4ba6('0x42')]);return _0x3f0667['getSounds'](_0x5d2365);}})[_0x4ba6('0x25')](function(_0x4193e9){if(_0x4193e9){_0x479622=_0x4193e9[_0x4ba6('0x3a')];if(!_0x47ccd3[_0x4ba6('0x37')][_0x4ba6('0x3b')](_0x4ba6('0x3c'))){_0x5d2365['limit']=qs['limit'](_0x47ccd3[_0x4ba6('0x37')][_0x4ba6('0x21')]);_0x5d2365[_0x4ba6('0x1e')]=qs[_0x4ba6('0x1e')](_0x47ccd3['query'][_0x4ba6('0x1e')]);}return _0x3f0667[_0x4ba6('0x6f')](_0x5d2365);}})[_0x4ba6('0x25')](function(_0x166eb0){if(_0x166eb0){return _0x166eb0?{'count':_0x479622,'rows':_0x166eb0}:null;}})['then'](respondWithResult(_0x27ec62,null))[_0x4ba6('0x46')](handleError(_0x27ec62,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index c9d34f3..999e7a8 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 _0x62b3=['define','voice_musiconhold','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports'];(function(_0x5479e6,_0x5c84b9){var _0x392abe=function(_0x4629e1){while(--_0x4629e1){_0x5479e6['push'](_0x5479e6['shift']());}};_0x392abe(++_0x5c84b9);}(_0x62b3,0x19c));var _0x362b=function(_0x1bc5c4,_0x1b1182){_0x1bc5c4=_0x1bc5c4-0x0;var _0x2ae162=_0x62b3[_0x1bc5c4];return _0x2ae162;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x362b('0x0'));var moment=require(_0x362b('0x1'));var BPromise=require(_0x362b('0x2'));var rp=require(_0x362b('0x3'));var fs=require('fs');var path=require(_0x362b('0x4'));var rimraf=require('rimraf');var config=require(_0x362b('0x5'));var attributes=require(_0x362b('0x6'));module[_0x362b('0x7')]=function(_0x40ad49,_0xd85427){return _0x40ad49[_0x362b('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x362b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa061=['api','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold','lodash','util','../../config/logger'];(function(_0x56d303,_0x4eb93c){var _0x1f9659=function(_0x3b8c66){while(--_0x3b8c66){_0x56d303['push'](_0x56d303['shift']());}};_0x1f9659(++_0x4eb93c);}(_0xa061,0x1aa));var _0x1a06=function(_0x2c826b,_0xadaf9e){_0x2c826b=_0x2c826b-0x0;var _0x22603f=_0xa061[_0x2c826b];return _0x22603f;};'use strict';var _=require(_0x1a06('0x0'));var util=require(_0x1a06('0x1'));var logger=require(_0x1a06('0x2'))(_0x1a06('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1a06('0x4'));var fs=require('fs');var path=require(_0x1a06('0x5'));var rimraf=require(_0x1a06('0x6'));var config=require(_0x1a06('0x7'));var attributes=require(_0x1a06('0x8'));module[_0x1a06('0x9')]=function(_0x3f0994,_0x20c071){return _0x3f0994['define']('VoiceMusicOnHold',attributes,{'tableName':_0x1a06('0xa'),'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 4c1861d..963731a 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 _0xe706=['http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2027e3,_0x5629a8){var _0x5b48b0=function(_0x30a562){while(--_0x30a562){_0x2027e3['push'](_0x2027e3['shift']());}};_0x5b48b0(++_0x5629a8);}(_0xe706,0xa3));var _0x6e70=function(_0x4a92ff,_0x215eea){_0x4a92ff=_0x4a92ff-0x0;var _0x3cd15=_0xe706[_0x4a92ff];return _0x3cd15;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VoiceMusicOnHold,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x4c0b4b,_0x8ceef){var _0x5e56a3=function(_0x3c4820){while(--_0x3c4820){_0x4c0b4b['push'](_0x4c0b4b['shift']());}};_0x5e56a3(++_0x8ceef);}(_0xedd9,0xfc));var _0x9edd=function(_0x5b323e,_0x137407){_0x5b323e=_0x5b323e-0x0;var _0x4fa5df=_0xedd9[_0x5b323e];return _0x4fa5df;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 3eaec05..fa95b33 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 _0x3b35=['get','isAuthenticated','index','/describe','describe','/:id','show','/:id/users','getAgents','post','create','addAgents','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller'];(function(_0x231474,_0x565ab7){var _0x4a74be=function(_0x5d3d40){while(--_0x5d3d40){_0x231474['push'](_0x231474['shift']());}};_0x4a74be(++_0x565ab7);}(_0x3b35,0x129));var _0x53b3=function(_0x5dbfd5,_0x3fcd40){_0x5dbfd5=_0x5dbfd5-0x0;var _0x5d1dfb=_0x3b35[_0x5dbfd5];return _0x5d1dfb;};'use strict';var multer=require(_0x53b3('0x0'));var util=require(_0x53b3('0x1'));var path=require(_0x53b3('0x2'));var timeout=require(_0x53b3('0x3'));var express=require(_0x53b3('0x4'));var router=express[_0x53b3('0x5')]();var fs_extra=require(_0x53b3('0x6'));var auth=require(_0x53b3('0x7'));var interaction=require(_0x53b3('0x8'));var config=require(_0x53b3('0x9'));var controller=require(_0x53b3('0xa'));router[_0x53b3('0xb')]('/',auth[_0x53b3('0xc')](),controller[_0x53b3('0xd')]);router['get'](_0x53b3('0xe'),auth[_0x53b3('0xc')](),controller[_0x53b3('0xf')]);router[_0x53b3('0xb')](_0x53b3('0x10'),auth[_0x53b3('0xc')](),controller[_0x53b3('0x11')]);router['get'](_0x53b3('0x12'),auth[_0x53b3('0xc')](),controller[_0x53b3('0x13')]);router[_0x53b3('0x14')]('/',auth[_0x53b3('0xc')](),controller[_0x53b3('0x15')]);router[_0x53b3('0x14')](_0x53b3('0x12'),auth[_0x53b3('0xc')](),controller[_0x53b3('0x16')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x53b3('0x17')]);router['delete'](_0x53b3('0x10'),auth[_0x53b3('0xc')](),controller[_0x53b3('0x18')]);router[_0x53b3('0x19')](_0x53b3('0x12'),auth[_0x53b3('0xc')](),controller[_0x53b3('0x1a')]);module[_0x53b3('0x1b')]=router; \ No newline at end of file +var _0x51cb=['./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','create','post','/:id/users','addAgents','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x36c2d5,_0x508481){var _0x577a3a=function(_0x385bf2){while(--_0x385bf2){_0x36c2d5['push'](_0x36c2d5['shift']());}};_0x577a3a(++_0x508481);}(_0x51cb,0x7c));var _0xb51c=function(_0x6abcb5,_0x179aa6){_0x6abcb5=_0x6abcb5-0x0;var _0xb38615=_0x51cb[_0x6abcb5];return _0xb38615;};'use strict';var multer=require('multer');var util=require(_0xb51c('0x0'));var path=require(_0xb51c('0x1'));var timeout=require(_0xb51c('0x2'));var express=require(_0xb51c('0x3'));var router=express[_0xb51c('0x4')]();var fs_extra=require(_0xb51c('0x5'));var auth=require(_0xb51c('0x6'));var interaction=require(_0xb51c('0x7'));var config=require('../../config/environment');var controller=require(_0xb51c('0x8'));router[_0xb51c('0x9')]('/',auth[_0xb51c('0xa')](),controller[_0xb51c('0xb')]);router['get'](_0xb51c('0xc'),auth[_0xb51c('0xa')](),controller[_0xb51c('0xd')]);router[_0xb51c('0x9')]('/:id',auth[_0xb51c('0xa')](),controller['show']);router['get']('/:id/users',auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0xb51c('0xe')]);router[_0xb51c('0xf')](_0xb51c('0x10'),auth[_0xb51c('0xa')](),controller[_0xb51c('0x11')]);router[_0xb51c('0x12')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb51c('0x13')]('/:id',auth[_0xb51c('0xa')](),controller[_0xb51c('0x14')]);router[_0xb51c('0x13')](_0xb51c('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb51c('0x15')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index dd2d32a..fb6e74f 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 _0x41b6=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x1018f5,_0xbb8d18){var _0x865e3d=function(_0x11aa62){while(--_0x11aa62){_0x1018f5['push'](_0x1018f5['shift']());}};_0x865e3d(++_0xbb8d18);}(_0x41b6,0xf1));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x641b('0x0'));module[_0x641b('0x1')]={'name':{'type':Sequelize[_0x641b('0x2')],'allowNull':![],'unique':_0x641b('0x3')},'prefix':{'type':Sequelize[_0x641b('0x4')],'get':function(_0x3d060e){return _0x641b('0x5')+this[_0x641b('0x6')]('name')+'-';}},'description':{'type':Sequelize[_0x641b('0x2')]},'callerIdAll':{'type':Sequelize[_0x641b('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd542=['name','INTEGER','sequelize','exports','STRING','system-'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd542,0x13a));var _0x2d54=function(_0x2faec5,_0x2c21f1){_0x2faec5=_0x2faec5-0x0;var _0x51ff07=_0xd542[_0x2faec5];return _0x51ff07;};'use strict';var Sequelize=require(_0x2d54('0x0'));module[_0x2d54('0x1')]={'name':{'type':Sequelize[_0x2d54('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x14212e){return _0x2d54('0x3')+this['getDataValue'](_0x2d54('0x4'))+'-';}},'description':{'type':Sequelize[_0x2d54('0x2')]},'callerIdAll':{'type':Sequelize[_0x2d54('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x2d54('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 5587706..7d7f90e 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 _0x5f01=['exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','system-','findById','addAgents','omit','spread','emit','userVoicePrefix:save','ids','removeAgents','userVoicePrefix:remove','findOne','User','order','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','VoicePrefixes','UserProfileResource','destroy','name','send','index','map','VoicePrefix','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','describe','create','sequelize','transaction','body','get','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','context'];(function(_0x4cfafc,_0x4c8f9e){var _0x45ee5a=function(_0x1eca3f){while(--_0x1eca3f){_0x4cfafc['push'](_0x4cfafc['shift']());}};_0x45ee5a(++_0x4c8f9e);}(_0x5f01,0x9e));var _0x15f0=function(_0x2838af,_0x39e895){_0x2838af=_0x2838af-0x0;var _0x3497e4=_0x5f01[_0x2838af];return _0x3497e4;};'use strict';var emlformat=require(_0x15f0('0x0'));var rimraf=require(_0x15f0('0x1'));var zipdir=require(_0x15f0('0x2'));var jsonpatch=require(_0x15f0('0x3'));var rp=require('request-promise');var moment=require(_0x15f0('0x4'));var BPromise=require(_0x15f0('0x5'));var Mustache=require(_0x15f0('0x6'));var util=require(_0x15f0('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x15f0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15f0('0x9'));var squel=require(_0x15f0('0xa'));var crypto=require('crypto');var jsforce=require(_0x15f0('0xb'));var deskjs=require(_0x15f0('0xc'));var toCsv=require(_0x15f0('0xd'));var querystring=require(_0x15f0('0xe'));var Papa=require('papaparse');var Redis=require(_0x15f0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x15f0('0x10'));var as=require(_0x15f0('0x11'));var hardwareService=require(_0x15f0('0x12'));var logger=require('../../config/logger')(_0x15f0('0x13'));var utils=require(_0x15f0('0x14'));var config=require(_0x15f0('0x15'));var licenseUtil=require(_0x15f0('0x16'));var db=require(_0x15f0('0x17'))['db'];config[_0x15f0('0x18')]=_[_0x15f0('0x19')](config[_0x15f0('0x18')],{'host':_0x15f0('0x1a'),'port':0x18eb});var socket=require(_0x15f0('0x1b'))(new Redis(config['redis']));require('./voicePrefix.socket')[_0x15f0('0x1c')](socket);function respondWithStatusCode(_0xae8e82,_0x89f495){_0x89f495=_0x89f495||0xcc;return function(_0x59d42e){if(_0x59d42e){return _0xae8e82[_0x15f0('0x1d')](_0x89f495);}return _0xae8e82[_0x15f0('0x1e')](_0x89f495)[_0x15f0('0x1f')]();};}function respondWithResult(_0x35d95d,_0x56b539){_0x56b539=_0x56b539||0xc8;return function(_0x12661f){if(_0x12661f){return _0x35d95d[_0x15f0('0x1e')](_0x56b539)[_0x15f0('0x20')](_0x12661f);}};}function respondWithFilteredResult(_0x9cbe06,_0x37b734){return function(_0x3a7e10){if(_0x3a7e10){var _0x572778=typeof _0x37b734['offset']===_0x15f0('0x21')&&typeof _0x37b734[_0x15f0('0x22')]==='undefined';var _0x58d870=_0x3a7e10[_0x15f0('0x23')];var _0x20b55a=_0x572778?0x0:_0x37b734[_0x15f0('0x24')];var _0x33868f=_0x572778?_0x3a7e10[_0x15f0('0x23')]:_0x37b734['offset']+_0x37b734[_0x15f0('0x22')];var _0x329a68;if(_0x33868f>=_0x58d870){_0x33868f=_0x58d870;_0x329a68=0xc8;}else{_0x329a68=0xce;}_0x9cbe06[_0x15f0('0x1e')](_0x329a68);return _0x9cbe06[_0x15f0('0x25')](_0x15f0('0x26'),_0x20b55a+'-'+_0x33868f+'/'+_0x58d870)[_0x15f0('0x20')](_0x3a7e10);}return null;};}function patchUpdates(_0x64eb08){return function(_0x1b1417){try{jsonpatch[_0x15f0('0x27')](_0x1b1417,_0x64eb08,!![]);}catch(_0xe2ea6c){return BPromise[_0x15f0('0x28')](_0xe2ea6c);}return _0x1b1417['save']();};}function saveUpdates(_0x3482be,_0x37385c){return function(_0x508400){if(_0x508400){return _0x508400[_0x15f0('0x29')](_0x3482be)[_0x15f0('0x2a')](function(_0x183ba0){return _0x183ba0;});}return null;};}function removeEntity(_0x3efc6c,_0x4006a9){return function(_0x250c42){if(_0x250c42){return _0x250c42['destroy']()['then'](function(){var _0x201b9b=_0x250c42['get']({'plain':!![]});var _0x435b24=_0x15f0('0x2b');return db[_0x15f0('0x2c')][_0x15f0('0x2d')]({'where':{'type':_0x435b24,'resourceId':_0x201b9b['id']}})[_0x15f0('0x2a')](function(){return _0x250c42;});})[_0x15f0('0x2a')](function(){_0x3efc6c[_0x15f0('0x1e')](0xcc)[_0x15f0('0x1f')]();});}};}function handleEntityNotFound(_0x31a8d9,_0x5c6e8c){return function(_0x2649c2){if(!_0x2649c2){_0x31a8d9['sendStatus'](0x194);}return _0x2649c2;};}function handleError(_0x303948,_0x582b2c){_0x582b2c=_0x582b2c||0x1f4;return function(_0x211652){logger['error'](_0x211652['stack']);if(_0x211652[_0x15f0('0x2e')]){delete _0x211652[_0x15f0('0x2e')];}_0x303948[_0x15f0('0x1e')](_0x582b2c)[_0x15f0('0x2f')](_0x211652);};}exports[_0x15f0('0x30')]=function(_0x104aa6,_0x17b64f){var _0x11e83f={},_0x55510b={},_0x70f3f={'count':0x0,'rows':[]};var _0x1c88b5=_[_0x15f0('0x31')](db[_0x15f0('0x32')]['rawAttributes'],function(_0x5bfa70){return{'name':_0x5bfa70['fieldName'],'type':_0x5bfa70[_0x15f0('0x33')][_0x15f0('0x34')]};});_0x55510b[_0x15f0('0x35')]=_['map'](_0x1c88b5,_0x15f0('0x2e'));_0x55510b['query']=_[_0x15f0('0x36')](_0x104aa6[_0x15f0('0x37')]);_0x55510b[_0x15f0('0x38')]=_['intersection'](_0x55510b[_0x15f0('0x35')],_0x55510b[_0x15f0('0x37')]);_0x11e83f['attributes']=_[_0x15f0('0x39')](_0x55510b[_0x15f0('0x35')],qs['fields'](_0x104aa6[_0x15f0('0x37')][_0x15f0('0x3a')]));_0x11e83f['attributes']=_0x11e83f[_0x15f0('0x3b')][_0x15f0('0x3c')]?_0x11e83f[_0x15f0('0x3b')]:_0x55510b[_0x15f0('0x35')];if(!_0x104aa6[_0x15f0('0x37')][_0x15f0('0x3d')](_0x15f0('0x3e'))){_0x11e83f[_0x15f0('0x22')]=qs[_0x15f0('0x22')](_0x104aa6['query'][_0x15f0('0x22')]);_0x11e83f[_0x15f0('0x24')]=qs[_0x15f0('0x24')](_0x104aa6['query'][_0x15f0('0x24')]);}_0x11e83f['order']=qs[_0x15f0('0x3f')](_0x104aa6[_0x15f0('0x37')][_0x15f0('0x3f')]);_0x11e83f[_0x15f0('0x40')]=qs[_0x15f0('0x38')](_[_0x15f0('0x41')](_0x104aa6[_0x15f0('0x37')],_0x55510b['filters']),_0x1c88b5);if(_0x104aa6[_0x15f0('0x37')][_0x15f0('0x42')]){_0x11e83f[_0x15f0('0x40')]=_[_0x15f0('0x43')](_0x11e83f[_0x15f0('0x40')],{'$or':_[_0x15f0('0x31')](_0x1c88b5,function(_0x4a0b06){if(_0x4a0b06['type']!=='VIRTUAL'){var _0x2bc4f3={};_0x2bc4f3[_0x4a0b06[_0x15f0('0x2e')]]={'$like':'%'+_0x104aa6[_0x15f0('0x37')][_0x15f0('0x42')]+'%'};return _0x2bc4f3;}})});}_0x11e83f=_['merge']({},_0x11e83f,_0x104aa6[_0x15f0('0x44')]);var _0x4b2e09={'where':_0x11e83f[_0x15f0('0x40')]};return db[_0x15f0('0x32')][_0x15f0('0x23')](_0x4b2e09)['then'](function(_0x294e94){_0x70f3f[_0x15f0('0x23')]=_0x294e94;if(_0x104aa6[_0x15f0('0x37')]['includeAll']){_0x11e83f[_0x15f0('0x45')]=[{'all':!![]}];}return db[_0x15f0('0x32')][_0x15f0('0x46')](_0x11e83f);})[_0x15f0('0x2a')](function(_0x3babe0){_0x70f3f[_0x15f0('0x47')]=_0x3babe0;return _0x70f3f;})[_0x15f0('0x2a')](respondWithFilteredResult(_0x17b64f,_0x11e83f))[_0x15f0('0x48')](handleError(_0x17b64f,null));};exports[_0x15f0('0x49')]=function(_0x4a6bd1,_0x3ded55){var _0x593b6f={'raw':![],'where':{'id':_0x4a6bd1[_0x15f0('0x4a')]['id']}},_0x2a7a9f={};_0x2a7a9f[_0x15f0('0x35')]=_[_0x15f0('0x36')](db[_0x15f0('0x32')][_0x15f0('0x4b')]);_0x2a7a9f[_0x15f0('0x37')]=_[_0x15f0('0x36')](_0x4a6bd1[_0x15f0('0x37')]);_0x2a7a9f[_0x15f0('0x38')]=_[_0x15f0('0x39')](_0x2a7a9f[_0x15f0('0x35')],_0x2a7a9f[_0x15f0('0x37')]);_0x593b6f[_0x15f0('0x3b')]=_['intersection'](_0x2a7a9f[_0x15f0('0x35')],qs[_0x15f0('0x3a')](_0x4a6bd1[_0x15f0('0x37')][_0x15f0('0x3a')]));_0x593b6f[_0x15f0('0x3b')]=_0x593b6f[_0x15f0('0x3b')]['length']?_0x593b6f[_0x15f0('0x3b')]:_0x2a7a9f['model'];if(_0x4a6bd1[_0x15f0('0x37')][_0x15f0('0x4c')]){_0x593b6f[_0x15f0('0x45')]=[{'all':!![]}];}_0x593b6f=_[_0x15f0('0x43')]({},_0x593b6f,_0x4a6bd1[_0x15f0('0x44')]);return db[_0x15f0('0x32')][_0x15f0('0x4d')](_0x593b6f)[_0x15f0('0x2a')](handleEntityNotFound(_0x3ded55,null))[_0x15f0('0x2a')](respondWithResult(_0x3ded55,null))['catch'](handleError(_0x3ded55,null));};exports[_0x15f0('0x2d')]=function(_0x345d51,_0x286a32){return db['VoicePrefix'][_0x15f0('0x4d')]({'where':{'id':_0x345d51['params']['id']}})['then'](handleEntityNotFound(_0x286a32,null))[_0x15f0('0x2a')](removeEntity(_0x286a32,null))['catch'](handleError(_0x286a32,null));};exports[_0x15f0('0x4e')]=function(_0x18a826,_0x112228){return db[_0x15f0('0x32')][_0x15f0('0x4e')]()[_0x15f0('0x2a')](respondWithResult(_0x112228,null))['catch'](handleError(_0x112228,null));};exports[_0x15f0('0x4f')]=function(_0x1cba55,_0x13b50d){var _0x3abab5;return db[_0x15f0('0x50')][_0x15f0('0x51')](function(_0x1fb6a2){return db['VoicePrefix']['create'](_0x1cba55[_0x15f0('0x52')],{'transaction':_0x1fb6a2})[_0x15f0('0x2a')](function(_0x5ac779){_0x3abab5=_0x5ac779[_0x15f0('0x53')]({'plain':!![]});return db['VoiceExtension'][_0x15f0('0x4d')]({'where':{'id':_0x3abab5[_0x15f0('0x54')]},'raw':!![]})['then'](function(_0x4af859){return createVoicePrefixExtensions(_0x3abab5,_0x4af859,_0x1fb6a2);});});})[_0x15f0('0x2a')](function(){var _0x222e70=_0x1cba55[_0x15f0('0x55')][_0x15f0('0x53')]({'plain':!![]});if(!_0x222e70)throw new Error(_0x15f0('0x56'));if(_0x222e70[_0x15f0('0x57')]===_0x15f0('0x55')){var _0x573854=_0x3abab5;return db[_0x15f0('0x58')][_0x15f0('0x4d')]({'where':{'name':_0x15f0('0x2b'),'userProfileId':_0x222e70[_0x15f0('0x59')]},'raw':!![]})[_0x15f0('0x2a')](function(_0x557e5c){if(_0x557e5c&&_0x557e5c[_0x15f0('0x5a')]===0x0){return db[_0x15f0('0x2c')][_0x15f0('0x4f')]({'name':_0x573854[_0x15f0('0x2e')],'resourceId':_0x573854['id'],'type':_0x557e5c[_0x15f0('0x2e')],'sectionId':_0x557e5c['id']},{})[_0x15f0('0x2a')](function(){return _0x3abab5;});}else{return _0x3abab5;}})[_0x15f0('0x48')](function(_0x43c4ea){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43c4ea);throw _0x43c4ea;});}return _0x3abab5;})[_0x15f0('0x2a')](respondWithResult(_0x13b50d,null))[_0x15f0('0x48')](handleError(_0x13b50d,null));};function Extension(_0x1fe407,_0x4d86be,_0x2a6292,_0x36a773){this[_0x15f0('0x5b')]='from-sip';this[_0x15f0('0x5c')]=_0x1fe407;this[_0x15f0('0x5d')]=_0x2a6292;this[_0x15f0('0x33')]=_0x15f0('0x5e');this[_0x15f0('0x5f')]=_0x15f0('0x60');this['priority']=_0x4d86be;this[_0x15f0('0x61')]=_0x36a773;}function createVoicePrefixExtensions(_0x37f024,_0x1119e1,_0xc9d4cb){return new BPromise(function(_0x5653cc,_0x42a972){var _0x1b2987=new Extension(formatPrefixName(_0x37f024[_0x15f0('0x62')]),0x1,_0x15f0('0x63'),_0x15f0('0x64'));_0x1b2987[_0x15f0('0x65')]=_0x37f024['id'];return db[_0x15f0('0x66')][_0x15f0('0x4f')](_0x1b2987,{'transaction':_0xc9d4cb})[_0x15f0('0x2a')](function(_0x432e10){var _0x279c5c=_0x432e10[_0x15f0('0x53')]({'plain':!![]});var _0x100d00=_[_0x15f0('0x31')](addVoicePrefixExtensions(_0x37f024,_0x1119e1),function(_0x91eba5){_0x91eba5['VoiceExtensionId']=_0x279c5c['id'];_0x91eba5['VoicePrefixId']=_0x37f024['id'];return _0x91eba5;});return db[_0x15f0('0x66')][_0x15f0('0x67')](_0x100d00,{'transaction':_0xc9d4cb})[_0x15f0('0x2a')](function(_0x21a79e){if(!_0x21a79e){return _0x42a972(_0x15f0('0x68'));}else{return _0x5653cc(_0x21a79e);}})[_0x15f0('0x48')](function(_0xa3c15f){return _0x42a972(_0xa3c15f);});});;});};function addVoicePrefixExtensions(_0x546c41,_0x57cd72){var _0x193e23=[];var _0x18e30f=formatPrefixName(_0x546c41[_0x15f0('0x62')]);_0x193e23[_0x15f0('0x69')](new Extension(_0x18e30f,0x2,_0x15f0('0x6a'),'CDR(prefix)='+_0x546c41[_0x15f0('0x2e')]));if(_0x546c41['callerIdAll']){_0x193e23['push'](new Extension(_0x18e30f,0x3,_0x15f0('0x6a'),_0x15f0('0x6b')+_0x546c41[_0x15f0('0x6c')]));}else{_0x193e23[_0x15f0('0x69')](new Extension(_0x18e30f,0x3,_0x15f0('0x63'),'No\x20callerid\x20available'));}_0x193e23[_0x15f0('0x69')](new Extension(_0x18e30f,0x4,'goto',_0x57cd72[_0x15f0('0x5b')]+','+_0x15f0('0x6d')+(0x8+_0x546c41['name']['length'])+'}'+','+0x1));return _0x193e23;}function formatPrefixName(_0x4492f1){var _0x50fa7f='_';for(var _0x86936e=0x0;_0x86936e<_0x4492f1['length'];_0x86936e++){if(_0x4492f1['charAt'](_0x86936e)=='-'){_0x50fa7f+=_0x4492f1[_0x15f0('0x6e')](_0x86936e);}else{_0x50fa7f+='['+_0x4492f1[_0x15f0('0x6e')](_0x86936e)+']';}}_0x50fa7f+='.';return _0x50fa7f;}exports[_0x15f0('0x29')]=function(_0x1c2a8c,_0x208c6f,_0x1245b1){var _0x22c31=_0x1c2a8c[_0x15f0('0x52')];_0x22c31['prefix']=_0x15f0('0x6f')+_0x22c31[_0x15f0('0x2e')]+'-';return db[_0x15f0('0x50')][_0x15f0('0x51')](function(_0x39ae44){return db['VoicePrefix'][_0x15f0('0x29')](_0x22c31,{'where':{'id':_0x22c31['id']},'transaction':_0x39ae44})['then'](function(){return db[_0x15f0('0x66')]['destroy']({'where':{'VoicePrefixId':_0x22c31['id']},'transaction':_0x39ae44})[_0x15f0('0x2a')](function(){return db[_0x15f0('0x66')][_0x15f0('0x4d')]({'where':{'id':_0x22c31[_0x15f0('0x54')]},'raw':!![]})[_0x15f0('0x2a')](function(_0x3bdd23){return createVoicePrefixExtensions(_0x22c31,_0x3bdd23,_0x39ae44);});});});})['then'](function(){return db[_0x15f0('0x32')][_0x15f0('0x70')](_0x22c31['id']);})[_0x15f0('0x2a')](respondWithResult(_0x208c6f,null))[_0x15f0('0x48')](handleError(_0x208c6f,null));};exports['addAgents']=function(_0x24ef5,_0xfca207,_0x5b38d5){return db['VoicePrefix'][_0x15f0('0x4d')]({'where':{'id':_0x24ef5['params']['id']}})[_0x15f0('0x2a')](handleEntityNotFound(_0xfca207,null))['then'](function(_0xf7258){if(_0xf7258){return _0xf7258[_0x15f0('0x71')](_0x24ef5[_0x15f0('0x52')]['ids'],_[_0x15f0('0x72')](_0x24ef5[_0x15f0('0x52')],['ids','id'])||{})[_0x15f0('0x73')](function(_0x53cc96){for(var _0x904a05=0x0;_0x904a05<_0x24ef5[_0x15f0('0x52')]['ids'][_0x15f0('0x3c')];_0x904a05+=0x1){socket[_0x15f0('0x74')](_0x15f0('0x75'),{'UserId':Number(_0x24ef5[_0x15f0('0x52')][_0x15f0('0x76')][_0x904a05]),'VoicePrefixId':Number(_0x24ef5[_0x15f0('0x4a')]['id'])});}return _0x53cc96;});}})[_0x15f0('0x2a')](respondWithResult(_0xfca207,null))[_0x15f0('0x48')](handleError(_0xfca207,null));};exports[_0x15f0('0x77')]=function(_0x44774f,_0x15f974,_0x4b868f){return db[_0x15f0('0x32')][_0x15f0('0x4d')]({'where':{'id':_0x44774f['params']['id']}})[_0x15f0('0x2a')](handleEntityNotFound(_0x15f974,null))['then'](function(_0x1089f4){if(_0x1089f4){return _0x1089f4[_0x15f0('0x77')](_0x44774f['query'][_0x15f0('0x76')])[_0x15f0('0x2a')](function(){if(_['isArray'](_0x44774f['query'][_0x15f0('0x76')])){for(var _0x53d7f4=0x0;_0x53d7f4<_0x44774f[_0x15f0('0x37')]['ids'][_0x15f0('0x3c')];_0x53d7f4+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x44774f[_0x15f0('0x37')][_0x15f0('0x76')][_0x53d7f4]),'VoicePrefixId':Number(_0x44774f['params']['id'])});}}else{socket['emit'](_0x15f0('0x78'),{'UserId':Number(_0x44774f['query']['ids']),'VoicePrefixId':Number(_0x44774f[_0x15f0('0x4a')]['id'])});}});}})[_0x15f0('0x2a')](respondWithStatusCode(_0x15f974,null))[_0x15f0('0x48')](handleError(_0x15f974,null));};exports['getAgents']=function(_0x2cf524,_0xf6b362,_0x636af2){var _0x2e5a26={};var _0x1ae28d={};var _0xb7f7aa;var _0x551ca1;return db[_0x15f0('0x32')][_0x15f0('0x79')]({'where':{'id':_0x2cf524['params']['id']}})[_0x15f0('0x2a')](handleEntityNotFound(_0xf6b362,null))[_0x15f0('0x2a')](function(_0x30e4b2){if(_0x30e4b2){_0xb7f7aa=_0x30e4b2;_0x1ae28d[_0x15f0('0x35')]=_['keys'](db[_0x15f0('0x7a')][_0x15f0('0x4b')]);_0x1ae28d[_0x15f0('0x37')]=_[_0x15f0('0x36')](_0x2cf524[_0x15f0('0x37')]);_0x1ae28d[_0x15f0('0x38')]=_['intersection'](_0x1ae28d['model'],_0x1ae28d[_0x15f0('0x37')]);_0x2e5a26['attributes']=_[_0x15f0('0x39')](_0x1ae28d[_0x15f0('0x35')],qs['fields'](_0x2cf524[_0x15f0('0x37')][_0x15f0('0x3a')]));_0x2e5a26[_0x15f0('0x3b')]=_0x2e5a26[_0x15f0('0x3b')][_0x15f0('0x3c')]?_0x2e5a26['attributes']:_0x1ae28d[_0x15f0('0x35')];_0x2e5a26[_0x15f0('0x7b')]=qs['sort'](_0x2cf524[_0x15f0('0x37')][_0x15f0('0x3f')]);_0x2e5a26['where']=qs['filters'](_['pick'](_0x2cf524[_0x15f0('0x37')],_0x1ae28d[_0x15f0('0x38')]));if(_0x2cf524[_0x15f0('0x37')]['filter']){_0x2e5a26['where']=_[_0x15f0('0x43')](_0x2e5a26[_0x15f0('0x40')],{'$or':_[_0x15f0('0x31')](_0x2e5a26[_0x15f0('0x3b')],function(_0x598815){var _0x33e120={};_0x33e120[_0x598815]={'$like':'%'+_0x2cf524['query'][_0x15f0('0x42')]+'%'};return _0x33e120;})});}_0x2e5a26=_[_0x15f0('0x43')]({},_0x2e5a26,_0x2cf524[_0x15f0('0x44')]);return _0xb7f7aa[_0x15f0('0x7c')](_0x2e5a26);}})[_0x15f0('0x2a')](function(_0x5f3a40){if(_0x5f3a40){_0x551ca1=_0x5f3a40[_0x15f0('0x3c')];if(!_0x2cf524['query'][_0x15f0('0x3d')](_0x15f0('0x3e'))){_0x2e5a26['limit']=qs[_0x15f0('0x22')](_0x2cf524[_0x15f0('0x37')][_0x15f0('0x22')]);_0x2e5a26[_0x15f0('0x24')]=qs[_0x15f0('0x24')](_0x2cf524[_0x15f0('0x37')][_0x15f0('0x24')]);}return _0xb7f7aa[_0x15f0('0x7c')](_0x2e5a26);}})[_0x15f0('0x2a')](function(_0x20d194){if(_0x20d194){return _0x20d194?{'count':_0x551ca1,'rows':_0x20d194}:null;}})[_0x15f0('0x2a')](respondWithResult(_0xf6b362,null))[_0x15f0('0x48')](handleError(_0xf6b362,null));}; \ No newline at end of file +var _0x6257=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','VoicePrefix','count','includeAll','include','findAll','rows','catch','show','params','find','describe','create','sequelize','transaction','get','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','${EXTEN:','length','charAt','update','body','system-','findById','addAgents','ids','spread','userVoicePrefix:save','removeAgents','isArray','emit','userVoicePrefix:remove','getAgents','findOne','User','filter','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','destroy','VoicePrefixes','then','sendStatus'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0x6257,0x1d4));var _0x7625=function(_0x919478,_0x308c9d){_0x919478=_0x919478-0x0;var _0x47e5a6=_0x6257[_0x919478];return _0x47e5a6;};'use strict';var emlformat=require(_0x7625('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7625('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7625('0x2'));var BPromise=require(_0x7625('0x3'));var Mustache=require(_0x7625('0x4'));var util=require(_0x7625('0x5'));var path=require(_0x7625('0x6'));var sox=require(_0x7625('0x7'));var csv=require(_0x7625('0x8'));var ejs=require(_0x7625('0x9'));var fs=require('fs');var fs_extra=require(_0x7625('0xa'));var _=require(_0x7625('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7625('0xc'));var deskjs=require(_0x7625('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7625('0xe'));var Papa=require(_0x7625('0xf'));var Redis=require(_0x7625('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x7625('0x11'));var as=require(_0x7625('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7625('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7625('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x7625('0x15')],{'host':_0x7625('0x16'),'port':0x18eb});var socket=require(_0x7625('0x17'))(new Redis(config[_0x7625('0x15')]));require(_0x7625('0x18'))[_0x7625('0x19')](socket);function respondWithStatusCode(_0x53a914,_0x50c5a1){_0x50c5a1=_0x50c5a1||0xcc;return function(_0x42f087){if(_0x42f087){return _0x53a914['sendStatus'](_0x50c5a1);}return _0x53a914[_0x7625('0x1a')](_0x50c5a1)[_0x7625('0x1b')]();};}function respondWithResult(_0x27b598,_0x5a66fd){_0x5a66fd=_0x5a66fd||0xc8;return function(_0x4c58ed){if(_0x4c58ed){return _0x27b598[_0x7625('0x1a')](_0x5a66fd)[_0x7625('0x1c')](_0x4c58ed);}};}function respondWithFilteredResult(_0x125737,_0x36cc19){return function(_0x6ca44e){if(_0x6ca44e){var _0x2c8013=typeof _0x36cc19[_0x7625('0x1d')]==='undefined'&&typeof _0x36cc19[_0x7625('0x1e')]==='undefined';var _0xde024d=_0x6ca44e['count'];var _0x4ba21a=_0x2c8013?0x0:_0x36cc19[_0x7625('0x1d')];var _0x5e9d9e=_0x2c8013?_0x6ca44e['count']:_0x36cc19[_0x7625('0x1d')]+_0x36cc19[_0x7625('0x1e')];var _0x510877;if(_0x5e9d9e>=_0xde024d){_0x5e9d9e=_0xde024d;_0x510877=0xc8;}else{_0x510877=0xce;}_0x125737[_0x7625('0x1a')](_0x510877);return _0x125737[_0x7625('0x1f')](_0x7625('0x20'),_0x4ba21a+'-'+_0x5e9d9e+'/'+_0xde024d)['json'](_0x6ca44e);}return null;};}function patchUpdates(_0x25b19c){return function(_0xfafa34){try{jsonpatch[_0x7625('0x21')](_0xfafa34,_0x25b19c,!![]);}catch(_0x424f8b){return BPromise[_0x7625('0x22')](_0x424f8b);}return _0xfafa34[_0x7625('0x23')]();};}function saveUpdates(_0x1514f7,_0x1832e3){return function(_0x26c976){if(_0x26c976){return _0x26c976['update'](_0x1514f7)['then'](function(_0x562fe1){return _0x562fe1;});}return null;};}function removeEntity(_0x4ceba3,_0x487316){return function(_0x477caf){if(_0x477caf){return _0x477caf[_0x7625('0x24')]()['then'](function(){var _0xdb65a3=_0x477caf['get']({'plain':!![]});var _0x293391=_0x7625('0x25');return db['UserProfileResource'][_0x7625('0x24')]({'where':{'type':_0x293391,'resourceId':_0xdb65a3['id']}})['then'](function(){return _0x477caf;});})[_0x7625('0x26')](function(){_0x4ceba3['status'](0xcc)[_0x7625('0x1b')]();});}};}function handleEntityNotFound(_0xf4feb2,_0x29e7bb){return function(_0xc2ff5b){if(!_0xc2ff5b){_0xf4feb2[_0x7625('0x27')](0x194);}return _0xc2ff5b;};}function handleError(_0x1c005f,_0x7941b1){_0x7941b1=_0x7941b1||0x1f4;return function(_0x3736fb){logger['error'](_0x3736fb['stack']);if(_0x3736fb[_0x7625('0x28')]){delete _0x3736fb[_0x7625('0x28')];}_0x1c005f['status'](_0x7941b1)[_0x7625('0x29')](_0x3736fb);};}exports[_0x7625('0x2a')]=function(_0x180321,_0x37e7ea){var _0x32a69e={},_0xa02928={},_0x176097={'count':0x0,'rows':[]};var _0x5ccb0d=_[_0x7625('0x2b')](db['VoicePrefix'][_0x7625('0x2c')],function(_0x400094){return{'name':_0x400094[_0x7625('0x2d')],'type':_0x400094[_0x7625('0x2e')][_0x7625('0x2f')]};});_0xa02928[_0x7625('0x30')]=_[_0x7625('0x2b')](_0x5ccb0d,_0x7625('0x28'));_0xa02928[_0x7625('0x31')]=_[_0x7625('0x32')](_0x180321[_0x7625('0x31')]);_0xa02928[_0x7625('0x33')]=_[_0x7625('0x34')](_0xa02928[_0x7625('0x30')],_0xa02928[_0x7625('0x31')]);_0x32a69e[_0x7625('0x35')]=_['intersection'](_0xa02928['model'],qs[_0x7625('0x36')](_0x180321['query']['fields']));_0x32a69e[_0x7625('0x35')]=_0x32a69e[_0x7625('0x35')]['length']?_0x32a69e[_0x7625('0x35')]:_0xa02928[_0x7625('0x30')];if(!_0x180321[_0x7625('0x31')][_0x7625('0x37')](_0x7625('0x38'))){_0x32a69e[_0x7625('0x1e')]=qs['limit'](_0x180321['query'][_0x7625('0x1e')]);_0x32a69e['offset']=qs['offset'](_0x180321[_0x7625('0x31')][_0x7625('0x1d')]);}_0x32a69e[_0x7625('0x39')]=qs[_0x7625('0x3a')](_0x180321[_0x7625('0x31')][_0x7625('0x3a')]);_0x32a69e[_0x7625('0x3b')]=qs['filters'](_[_0x7625('0x3c')](_0x180321['query'],_0xa02928[_0x7625('0x33')]),_0x5ccb0d);if(_0x180321[_0x7625('0x31')]['filter']){_0x32a69e['where']=_[_0x7625('0x3d')](_0x32a69e['where'],{'$or':_['map'](_0x5ccb0d,function(_0x523835){if(_0x523835['type']!==_0x7625('0x3e')){var _0x372190={};_0x372190[_0x523835[_0x7625('0x28')]]={'$like':'%'+_0x180321[_0x7625('0x31')]['filter']+'%'};return _0x372190;}})});}_0x32a69e=_[_0x7625('0x3d')]({},_0x32a69e,_0x180321[_0x7625('0x3f')]);var _0x41a10c={'where':_0x32a69e[_0x7625('0x3b')]};return db[_0x7625('0x40')]['count'](_0x41a10c)['then'](function(_0x4eb88f){_0x176097[_0x7625('0x41')]=_0x4eb88f;if(_0x180321[_0x7625('0x31')][_0x7625('0x42')]){_0x32a69e[_0x7625('0x43')]=[{'all':!![]}];}return db['VoicePrefix'][_0x7625('0x44')](_0x32a69e);})['then'](function(_0x220477){_0x176097[_0x7625('0x45')]=_0x220477;return _0x176097;})[_0x7625('0x26')](respondWithFilteredResult(_0x37e7ea,_0x32a69e))[_0x7625('0x46')](handleError(_0x37e7ea,null));};exports[_0x7625('0x47')]=function(_0x4dbe44,_0x522539){var _0x3ec1ea={'raw':![],'where':{'id':_0x4dbe44[_0x7625('0x48')]['id']}},_0x5d4b5e={};_0x5d4b5e[_0x7625('0x30')]=_[_0x7625('0x32')](db[_0x7625('0x40')]['rawAttributes']);_0x5d4b5e[_0x7625('0x31')]=_['keys'](_0x4dbe44[_0x7625('0x31')]);_0x5d4b5e[_0x7625('0x33')]=_[_0x7625('0x34')](_0x5d4b5e[_0x7625('0x30')],_0x5d4b5e['query']);_0x3ec1ea['attributes']=_['intersection'](_0x5d4b5e[_0x7625('0x30')],qs['fields'](_0x4dbe44[_0x7625('0x31')][_0x7625('0x36')]));_0x3ec1ea[_0x7625('0x35')]=_0x3ec1ea['attributes']['length']?_0x3ec1ea[_0x7625('0x35')]:_0x5d4b5e[_0x7625('0x30')];if(_0x4dbe44[_0x7625('0x31')][_0x7625('0x42')]){_0x3ec1ea['include']=[{'all':!![]}];}_0x3ec1ea=_[_0x7625('0x3d')]({},_0x3ec1ea,_0x4dbe44[_0x7625('0x3f')]);return db['VoicePrefix'][_0x7625('0x49')](_0x3ec1ea)[_0x7625('0x26')](handleEntityNotFound(_0x522539,null))[_0x7625('0x26')](respondWithResult(_0x522539,null))[_0x7625('0x46')](handleError(_0x522539,null));};exports[_0x7625('0x24')]=function(_0x48a93a,_0x33f897){return db[_0x7625('0x40')][_0x7625('0x49')]({'where':{'id':_0x48a93a[_0x7625('0x48')]['id']}})[_0x7625('0x26')](handleEntityNotFound(_0x33f897,null))['then'](removeEntity(_0x33f897,null))[_0x7625('0x46')](handleError(_0x33f897,null));};exports[_0x7625('0x4a')]=function(_0x24ea1a,_0x549d56){return db[_0x7625('0x40')][_0x7625('0x4a')]()[_0x7625('0x26')](respondWithResult(_0x549d56,null))['catch'](handleError(_0x549d56,null));};exports[_0x7625('0x4b')]=function(_0x3002dd,_0x4828eb){var _0x2a1f48;return db[_0x7625('0x4c')][_0x7625('0x4d')](function(_0x3d8030){return db[_0x7625('0x40')][_0x7625('0x4b')](_0x3002dd['body'],{'transaction':_0x3d8030})[_0x7625('0x26')](function(_0x3abae2){_0x2a1f48=_0x3abae2[_0x7625('0x4e')]({'plain':!![]});return db[_0x7625('0x4f')][_0x7625('0x49')]({'where':{'id':_0x2a1f48[_0x7625('0x50')]},'raw':!![]})[_0x7625('0x26')](function(_0x27c1ef){return createVoicePrefixExtensions(_0x2a1f48,_0x27c1ef,_0x3d8030);});});})['then'](function(){var _0xf7c904=_0x3002dd['user']['get']({'plain':!![]});if(!_0xf7c904)throw new Error(_0x7625('0x51'));if(_0xf7c904[_0x7625('0x52')]===_0x7625('0x53')){var _0xa1130e=_0x2a1f48;return db[_0x7625('0x54')][_0x7625('0x49')]({'where':{'name':_0x7625('0x25'),'userProfileId':_0xf7c904[_0x7625('0x55')]},'raw':!![]})[_0x7625('0x26')](function(_0x489146){if(_0x489146&&_0x489146[_0x7625('0x56')]===0x0){return db['UserProfileResource']['create']({'name':_0xa1130e[_0x7625('0x28')],'resourceId':_0xa1130e['id'],'type':_0x489146[_0x7625('0x28')],'sectionId':_0x489146['id']},{})[_0x7625('0x26')](function(){return _0x2a1f48;});}else{return _0x2a1f48;}})[_0x7625('0x46')](function(_0x2caec0){logger[_0x7625('0x57')](_0x7625('0x58'),_0x2caec0);throw _0x2caec0;});}return _0x2a1f48;})['then'](respondWithResult(_0x4828eb,null))['catch'](handleError(_0x4828eb,null));};function Extension(_0x41754a,_0x5580a5,_0xf935d0,_0x3b8266){this[_0x7625('0x59')]=_0x7625('0x5a');this[_0x7625('0x5b')]=_0x41754a;this[_0x7625('0x5c')]=_0xf935d0;this[_0x7625('0x2e')]=_0x7625('0x5d');this['description']='Voice\x20Prefix\x20Extension';this[_0x7625('0x5e')]=_0x5580a5;this[_0x7625('0x5f')]=_0x3b8266;}function createVoicePrefixExtensions(_0x23199a,_0xaa6847,_0x5c1b3f){return new BPromise(function(_0xe07c53,_0x3789db){var _0x1abf67=new Extension(formatPrefixName(_0x23199a[_0x7625('0x60')]),0x1,_0x7625('0x61'),_0x7625('0x62'));_0x1abf67['VoicePrefixId']=_0x23199a['id'];return db['VoiceExtension'][_0x7625('0x4b')](_0x1abf67,{'transaction':_0x5c1b3f})[_0x7625('0x26')](function(_0x501b9c){var _0x468080=_0x501b9c[_0x7625('0x4e')]({'plain':!![]});var _0x13982d=_[_0x7625('0x2b')](addVoicePrefixExtensions(_0x23199a,_0xaa6847),function(_0x1999a5){_0x1999a5['VoiceExtensionId']=_0x468080['id'];_0x1999a5[_0x7625('0x63')]=_0x23199a['id'];return _0x1999a5;});return db[_0x7625('0x4f')][_0x7625('0x64')](_0x13982d,{'transaction':_0x5c1b3f})[_0x7625('0x26')](function(_0x3026b9){if(!_0x3026b9){return _0x3789db(_0x7625('0x65'));}else{return _0xe07c53(_0x3026b9);}})[_0x7625('0x46')](function(_0x1de80){return _0x3789db(_0x1de80);});});;});};function addVoicePrefixExtensions(_0x139f70,_0x5f3356){var _0x579ced=[];var _0x3a1460=formatPrefixName(_0x139f70[_0x7625('0x60')]);_0x579ced[_0x7625('0x66')](new Extension(_0x3a1460,0x2,_0x7625('0x67'),_0x7625('0x68')+_0x139f70[_0x7625('0x28')]));if(_0x139f70[_0x7625('0x69')]){_0x579ced['push'](new Extension(_0x3a1460,0x3,_0x7625('0x67'),_0x7625('0x6a')+_0x139f70[_0x7625('0x69')]));}else{_0x579ced['push'](new Extension(_0x3a1460,0x3,_0x7625('0x61'),_0x7625('0x6b')));}_0x579ced['push'](new Extension(_0x3a1460,0x4,'goto',_0x5f3356[_0x7625('0x59')]+','+_0x7625('0x6c')+(0x8+_0x139f70[_0x7625('0x28')][_0x7625('0x6d')])+'}'+','+0x1));return _0x579ced;}function formatPrefixName(_0x16f183){var _0x2f18ef='_';for(var _0x3aeda9=0x0;_0x3aeda9<_0x16f183['length'];_0x3aeda9++){if(_0x16f183[_0x7625('0x6e')](_0x3aeda9)=='-'){_0x2f18ef+=_0x16f183['charAt'](_0x3aeda9);}else{_0x2f18ef+='['+_0x16f183[_0x7625('0x6e')](_0x3aeda9)+']';}}_0x2f18ef+='.';return _0x2f18ef;}exports[_0x7625('0x6f')]=function(_0x3ca065,_0x1f2aaf,_0x3bc2f2){var _0x20eed5=_0x3ca065[_0x7625('0x70')];_0x20eed5[_0x7625('0x60')]=_0x7625('0x71')+_0x20eed5[_0x7625('0x28')]+'-';return db[_0x7625('0x4c')][_0x7625('0x4d')](function(_0x273e15){return db['VoicePrefix'][_0x7625('0x6f')](_0x20eed5,{'where':{'id':_0x20eed5['id']},'transaction':_0x273e15})[_0x7625('0x26')](function(){return db[_0x7625('0x4f')][_0x7625('0x24')]({'where':{'VoicePrefixId':_0x20eed5['id']},'transaction':_0x273e15})[_0x7625('0x26')](function(){return db[_0x7625('0x4f')][_0x7625('0x49')]({'where':{'id':_0x20eed5[_0x7625('0x50')]},'raw':!![]})[_0x7625('0x26')](function(_0xfbc5c1){return createVoicePrefixExtensions(_0x20eed5,_0xfbc5c1,_0x273e15);});});});})[_0x7625('0x26')](function(){return db['VoicePrefix'][_0x7625('0x72')](_0x20eed5['id']);})[_0x7625('0x26')](respondWithResult(_0x1f2aaf,null))[_0x7625('0x46')](handleError(_0x1f2aaf,null));};exports[_0x7625('0x73')]=function(_0x1023a7,_0x2c0c23,_0x2a90ed){return db[_0x7625('0x40')][_0x7625('0x49')]({'where':{'id':_0x1023a7[_0x7625('0x48')]['id']}})[_0x7625('0x26')](handleEntityNotFound(_0x2c0c23,null))[_0x7625('0x26')](function(_0x24e4de){if(_0x24e4de){return _0x24e4de[_0x7625('0x73')](_0x1023a7['body']['ids'],_['omit'](_0x1023a7[_0x7625('0x70')],[_0x7625('0x74'),'id'])||{})[_0x7625('0x75')](function(_0x399f45){for(var _0x2e41e1=0x0;_0x2e41e1<_0x1023a7[_0x7625('0x70')][_0x7625('0x74')][_0x7625('0x6d')];_0x2e41e1+=0x1){socket['emit'](_0x7625('0x76'),{'UserId':Number(_0x1023a7[_0x7625('0x70')]['ids'][_0x2e41e1]),'VoicePrefixId':Number(_0x1023a7['params']['id'])});}return _0x399f45;});}})[_0x7625('0x26')](respondWithResult(_0x2c0c23,null))['catch'](handleError(_0x2c0c23,null));};exports[_0x7625('0x77')]=function(_0x495a6b,_0x527b2a,_0xfaf59){return db[_0x7625('0x40')]['find']({'where':{'id':_0x495a6b['params']['id']}})[_0x7625('0x26')](handleEntityNotFound(_0x527b2a,null))[_0x7625('0x26')](function(_0x1c5b85){if(_0x1c5b85){return _0x1c5b85[_0x7625('0x77')](_0x495a6b[_0x7625('0x31')][_0x7625('0x74')])[_0x7625('0x26')](function(){if(_[_0x7625('0x78')](_0x495a6b['query'][_0x7625('0x74')])){for(var _0x20f5aa=0x0;_0x20f5aa<_0x495a6b[_0x7625('0x31')][_0x7625('0x74')][_0x7625('0x6d')];_0x20f5aa+=0x1){socket[_0x7625('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x495a6b['query'][_0x7625('0x74')][_0x20f5aa]),'VoicePrefixId':Number(_0x495a6b[_0x7625('0x48')]['id'])});}}else{socket['emit'](_0x7625('0x7a'),{'UserId':Number(_0x495a6b[_0x7625('0x31')][_0x7625('0x74')]),'VoicePrefixId':Number(_0x495a6b[_0x7625('0x48')]['id'])});}});}})[_0x7625('0x26')](respondWithStatusCode(_0x527b2a,null))[_0x7625('0x46')](handleError(_0x527b2a,null));};exports[_0x7625('0x7b')]=function(_0x273ba2,_0x4ef3b3,_0x48b440){var _0x232040={};var _0x2a3d62={};var _0x7640db;var _0x2fc5a4;return db['VoicePrefix'][_0x7625('0x7c')]({'where':{'id':_0x273ba2['params']['id']}})[_0x7625('0x26')](handleEntityNotFound(_0x4ef3b3,null))[_0x7625('0x26')](function(_0x543dba){if(_0x543dba){_0x7640db=_0x543dba;_0x2a3d62['model']=_[_0x7625('0x32')](db[_0x7625('0x7d')]['rawAttributes']);_0x2a3d62[_0x7625('0x31')]=_['keys'](_0x273ba2[_0x7625('0x31')]);_0x2a3d62[_0x7625('0x33')]=_[_0x7625('0x34')](_0x2a3d62[_0x7625('0x30')],_0x2a3d62[_0x7625('0x31')]);_0x232040[_0x7625('0x35')]=_[_0x7625('0x34')](_0x2a3d62['model'],qs[_0x7625('0x36')](_0x273ba2['query'][_0x7625('0x36')]));_0x232040[_0x7625('0x35')]=_0x232040[_0x7625('0x35')][_0x7625('0x6d')]?_0x232040[_0x7625('0x35')]:_0x2a3d62['model'];_0x232040['order']=qs[_0x7625('0x3a')](_0x273ba2['query'][_0x7625('0x3a')]);_0x232040[_0x7625('0x3b')]=qs[_0x7625('0x33')](_[_0x7625('0x3c')](_0x273ba2[_0x7625('0x31')],_0x2a3d62[_0x7625('0x33')]));if(_0x273ba2['query'][_0x7625('0x7e')]){_0x232040[_0x7625('0x3b')]=_['merge'](_0x232040['where'],{'$or':_[_0x7625('0x2b')](_0x232040[_0x7625('0x35')],function(_0x40b8bf){var _0x12c108={};_0x12c108[_0x40b8bf]={'$like':'%'+_0x273ba2[_0x7625('0x31')]['filter']+'%'};return _0x12c108;})});}_0x232040=_[_0x7625('0x3d')]({},_0x232040,_0x273ba2[_0x7625('0x3f')]);return _0x7640db[_0x7625('0x7b')](_0x232040);}})[_0x7625('0x26')](function(_0x473f0e){if(_0x473f0e){_0x2fc5a4=_0x473f0e[_0x7625('0x6d')];if(!_0x273ba2[_0x7625('0x31')][_0x7625('0x37')](_0x7625('0x38'))){_0x232040[_0x7625('0x1e')]=qs['limit'](_0x273ba2[_0x7625('0x31')][_0x7625('0x1e')]);_0x232040[_0x7625('0x1d')]=qs['offset'](_0x273ba2[_0x7625('0x31')][_0x7625('0x1d')]);}return _0x7640db['getAgents'](_0x232040);}})['then'](function(_0x2b03c8){if(_0x2b03c8){return _0x2b03c8?{'count':_0x2fc5a4,'rows':_0x2b03c8}:null;}})[_0x7625('0x26')](respondWithResult(_0x4ef3b3,null))[_0x7625('0x46')](handleError(_0x4ef3b3,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index f4b93e5..197c62a 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 _0xbd9b=['emit','exports','events','VoicePrefix','setMaxListeners','save','update','remove'];(function(_0x5a6d6b,_0x151f06){var _0x539fe6=function(_0x57a5bf){while(--_0x57a5bf){_0x5a6d6b['push'](_0x5a6d6b['shift']());}};_0x539fe6(++_0x151f06);}(_0xbd9b,0x6a));var _0xbbd9=function(_0x34331b,_0x22a64c){_0x34331b=_0x34331b-0x0;var _0x1f97c8=_0xbd9b[_0x34331b];return _0x1f97c8;};'use strict';var EventEmitter=require(_0xbbd9('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xbbd9('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xbbd9('0x2')](0x0);var events={'afterCreate':_0xbbd9('0x3'),'afterUpdate':_0xbbd9('0x4'),'afterDestroy':_0xbbd9('0x5')};function emitEvent(_0x30cd55){return function(_0x4a1539,_0x5ae536,_0x37631d){VoicePrefixEvents[_0xbbd9('0x6')](_0x30cd55+':'+_0x4a1539['id'],_0x4a1539);VoicePrefixEvents[_0xbbd9('0x6')](_0x30cd55,_0x4a1539);_0x37631d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xbbd9('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xc134=['VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3b13f4,_0x30f08f){var _0x173097=function(_0x5d8287){while(--_0x5d8287){_0x3b13f4['push'](_0x3b13f4['shift']());}};_0x173097(++_0x30f08f);}(_0xc134,0xd1));var _0x4c13=function(_0x5daddc,_0x381354){_0x5daddc=_0x5daddc-0x0;var _0x5e4041=_0xc134[_0x5daddc];return _0x5e4041;};'use strict';var EventEmitter=require(_0x4c13('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x4c13('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x4c13('0x2')](0x0);var events={'afterCreate':_0x4c13('0x3'),'afterUpdate':_0x4c13('0x4'),'afterDestroy':_0x4c13('0x5')};function emitEvent(_0xcc8c7){return function(_0x2faf74,_0x502119,_0x479a3c){VoicePrefixEvents[_0x4c13('0x6')](_0xcc8c7+':'+_0x2faf74['id'],_0x2faf74);VoicePrefixEvents[_0x4c13('0x6')](_0xcc8c7,_0x2faf74);_0x479a3c(null);};}for(var e in events){if(events[_0x4c13('0x7')](e)){var event=events[e];VoicePrefix[_0x4c13('0x8')](e,emitEvent(event));}}module[_0x4c13('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 229d392..480a9bd 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 _0x38bd=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','../../config/logger','request-promise','path'];(function(_0x47780f,_0x5866b3){var _0x6b82db=function(_0x44840d){while(--_0x44840d){_0x47780f['push'](_0x47780f['shift']());}};_0x6b82db(++_0x5866b3);}(_0x38bd,0xf0));var _0xd38b=function(_0x2b5675,_0x1d198d){_0x2b5675=_0x2b5675-0x0;var _0x2ce40e=_0x38bd[_0x2b5675];return _0x2ce40e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd38b('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd38b('0x1'));var fs=require('fs');var path=require(_0xd38b('0x2'));var rimraf=require('rimraf');var config=require(_0xd38b('0x3'));var attributes=require(_0xd38b('0x4'));module[_0xd38b('0x5')]=function(_0x1efa12,_0x5c0ffa){return _0x1efa12[_0xd38b('0x6')](_0xd38b('0x7'),attributes,{'tableName':_0xd38b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee32=['../../config/environment','exports','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x435150,_0x591cd9){var _0x13b3a4=function(_0x44eb28){while(--_0x44eb28){_0x435150['push'](_0x435150['shift']());}};_0x13b3a4(++_0x591cd9);}(_0xee32,0xd4));var _0x2ee3=function(_0x272ea7,_0x425c34){_0x272ea7=_0x272ea7-0x0;var _0x4cea51=_0xee32[_0x272ea7];return _0x4cea51;};'use strict';var _=require(_0x2ee3('0x0'));var util=require(_0x2ee3('0x1'));var logger=require(_0x2ee3('0x2'))(_0x2ee3('0x3'));var moment=require(_0x2ee3('0x4'));var BPromise=require(_0x2ee3('0x5'));var rp=require(_0x2ee3('0x6'));var fs=require('fs');var path=require(_0x2ee3('0x7'));var rimraf=require(_0x2ee3('0x8'));var config=require(_0x2ee3('0x9'));var attributes=require('./voicePrefix.attributes');module[_0x2ee3('0xa')]=function(_0x1aa66c,_0x22e5ea){return _0x1aa66c['define'](_0x2ee3('0xb'),attributes,{'tableName':_0x2ee3('0xc'),'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 7123747..d56a344 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 _0xce04=['request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','VoicePrefix,\x20%s,\x20%s'];(function(_0x398c6c,_0x1530ef){var _0x36533d=function(_0x2e8e66){while(--_0x2e8e66){_0x398c6c['push'](_0x398c6c['shift']());}};_0x36533d(++_0x1530ef);}(_0xce04,0xc0));var _0x4ce0=function(_0x2b9337,_0x5bc992){_0x2b9337=_0x2b9337-0x0;var _0x159a01=_0xce04[_0x2b9337];return _0x159a01;};'use strict';var _=require(_0x4ce0('0x0'));var util=require('util');var moment=require(_0x4ce0('0x1'));var BPromise=require(_0x4ce0('0x2'));var rs=require(_0x4ce0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ce0('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x4ce0('0x5'));var jayson=require(_0x4ce0('0x6'));var client=jayson['client'][_0x4ce0('0x7')]({'port':0x232a});config[_0x4ce0('0x8')]=_['defaults'](config[_0x4ce0('0x8')],{'host':_0x4ce0('0x9'),'port':0x18eb});var socket=require(_0x4ce0('0xa'))(new Redis(config['redis']));require(_0x4ce0('0xb'))[_0x4ce0('0xc')](socket);function respondWithRpcPromise(_0x16a386,_0x3b803f,_0x140d74){return new BPromise(function(_0x237510,_0x53bc12){return client[_0x4ce0('0xd')](_0x16a386,_0x140d74)['then'](function(_0x5715d8){logger['info'](_0x4ce0('0xe'),_0x3b803f,_0x4ce0('0xf'));logger[_0x4ce0('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x3b803f,_0x4ce0('0xf'),JSON[_0x4ce0('0x11')](_0x5715d8));if(_0x5715d8['error']){if(_0x5715d8[_0x4ce0('0x12')]['code']===0x1f4){logger[_0x4ce0('0x12')](_0x4ce0('0xe'),_0x3b803f,_0x5715d8[_0x4ce0('0x12')]['message']);return _0x53bc12(_0x5715d8[_0x4ce0('0x12')][_0x4ce0('0x13')]);}logger[_0x4ce0('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x3b803f,_0x5715d8[_0x4ce0('0x12')]['message']);return _0x237510(_0x5715d8['error'][_0x4ce0('0x13')]);}else{logger[_0x4ce0('0x14')](_0x4ce0('0xe'),_0x3b803f,_0x4ce0('0xf'));_0x237510(_0x5715d8[_0x4ce0('0x15')][_0x4ce0('0x13')]);}})[_0x4ce0('0x16')](function(_0x5eeb11){logger[_0x4ce0('0x12')](_0x4ce0('0xe'),_0x3b803f,_0x5eeb11);_0x53bc12(_0x5eeb11);});});} \ No newline at end of file +var _0x7409=['socket.io-emitter','register','then','info','error','VoicePrefix,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7409,0x6e));var _0x9740=function(_0x296144,_0x26bbbf){_0x296144=_0x296144-0x0;var _0x5329b1=_0x7409[_0x296144];return _0x5329b1;};'use strict';var _=require(_0x9740('0x0'));var util=require(_0x9740('0x1'));var moment=require('moment');var BPromise=require(_0x9740('0x2'));var rs=require(_0x9740('0x3'));var fs=require('fs');var Redis=require(_0x9740('0x4'));var db=require(_0x9740('0x5'))['db'];var utils=require(_0x9740('0x6'));var logger=require(_0x9740('0x7'))(_0x9740('0x8'));var config=require(_0x9740('0x9'));var jayson=require(_0x9740('0xa'));var client=jayson['client'][_0x9740('0xb')]({'port':0x232a});config[_0x9740('0xc')]=_[_0x9740('0xd')](config['redis'],{'host':_0x9740('0xe'),'port':0x18eb});var socket=require(_0x9740('0xf'))(new Redis(config[_0x9740('0xc')]));require('./voicePrefix.socket')[_0x9740('0x10')](socket);function respondWithRpcPromise(_0x548bf8,_0x1a6ff9,_0xc27c18){return new BPromise(function(_0x4e39f9,_0x59dd44){return client['request'](_0x548bf8,_0xc27c18)[_0x9740('0x11')](function(_0x3bc357){logger[_0x9740('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent');logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x1a6ff9,'request\x20sent',JSON['stringify'](_0x3bc357));if(_0x3bc357['error']){if(_0x3bc357[_0x9740('0x13')]['code']===0x1f4){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x3bc357['error'][_0x9740('0x15')]);return _0x59dd44(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}logger[_0x9740('0x13')]('VoicePrefix,\x20%s,\x20%s',_0x1a6ff9,_0x3bc357[_0x9740('0x13')]['message']);return _0x4e39f9(_0x3bc357[_0x9740('0x13')][_0x9740('0x15')]);}else{logger[_0x9740('0x12')](_0x9740('0x14'),_0x1a6ff9,_0x9740('0x16'));_0x4e39f9(_0x3bc357[_0x9740('0x17')][_0x9740('0x15')]);}})[_0x9740('0x18')](function(_0x206c4d){logger['error'](_0x9740('0x14'),_0x1a6ff9,_0x206c4d);_0x59dd44(_0x206c4d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 39a2186..f83e85a 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 _0x6282=['voicePrefix:','./voicePrefix.events','save','remove','update','emit','removeListener','register','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6282,0x76));var _0x2628=function(_0x3083fa,_0x576208){_0x3083fa=_0x3083fa-0x0;var _0x5f35b2=_0x6282[_0x3083fa];return _0x5f35b2;};'use strict';var VoicePrefixEvents=require(_0x2628('0x0'));var events=[_0x2628('0x1'),_0x2628('0x2'),_0x2628('0x3')];function createListener(_0x58f873,_0x50e40f){return function(_0x126d9a){_0x50e40f[_0x2628('0x4')](_0x58f873,_0x126d9a);};}function removeListener(_0x5eb31b,_0x2d420f){return function(){VoicePrefixEvents[_0x2628('0x5')](_0x5eb31b,_0x2d420f);};}exports[_0x2628('0x6')]=function(_0x47102a){for(var _0x128d3a=0x0,_0x50412a=events[_0x2628('0x7')];_0x128d3a<_0x50412a;_0x128d3a++){var _0x144ae8=events[_0x128d3a];var _0x2170a7=createListener(_0x2628('0x8')+_0x144ae8,_0x47102a);VoicePrefixEvents['on'](_0x144ae8,_0x2170a7);}}; \ No newline at end of file +var _0xd84c=['register','length','./voicePrefix.events','save','remove','update','emit','removeListener'];(function(_0x440afc,_0x2c20df){var _0x523952=function(_0xebb8ee){while(--_0xebb8ee){_0x440afc['push'](_0x440afc['shift']());}};_0x523952(++_0x2c20df);}(_0xd84c,0x102));var _0xcd84=function(_0x551d9a,_0xdcfb9d){_0x551d9a=_0x551d9a-0x0;var _0xd523e7=_0xd84c[_0x551d9a];return _0xd523e7;};'use strict';var VoicePrefixEvents=require(_0xcd84('0x0'));var events=[_0xcd84('0x1'),_0xcd84('0x2'),_0xcd84('0x3')];function createListener(_0x2f3d51,_0x3213d7){return function(_0xbdfd34){_0x3213d7[_0xcd84('0x4')](_0x2f3d51,_0xbdfd34);};}function removeListener(_0x288020,_0x5a8c2e){return function(){VoicePrefixEvents[_0xcd84('0x5')](_0x288020,_0x5a8c2e);};}exports[_0xcd84('0x6')]=function(_0x159209){for(var _0x3df569=0x0,_0x520d49=events[_0xcd84('0x7')];_0x3df569<_0x520d49;_0x3df569++){var _0x22c811=events[_0x3df569];var _0x3f3617=createListener('voicePrefix:'+_0x22c811,_0x159209);VoicePrefixEvents['on'](_0x22c811,_0x3f3617);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index c7c57b7..36cfe54 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 _0x062d=['getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','getMembers','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','isAuthenticated','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories'];(function(_0x23d5da,_0x1dacd6){var _0x598a05=function(_0x3272a6){while(--_0x3272a6){_0x23d5da['push'](_0x23d5da['shift']());}};_0x598a05(++_0x1dacd6);}(_0x062d,0x11f));var _0xd062=function(_0x36115d,_0x4071a1){_0x36115d=_0x36115d-0x0;var _0x58cd1f=_0x062d[_0x36115d];return _0x58cd1f;};'use strict';var multer=require(_0xd062('0x0'));var util=require(_0xd062('0x1'));var path=require(_0xd062('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd062('0x3'));var auth=require(_0xd062('0x4'));var interaction=require(_0xd062('0x5'));var config=require(_0xd062('0x6'));var controller=require(_0xd062('0x7'));router[_0xd062('0x8')]('/',auth[_0xd062('0x9')](),controller['index']);router['get'](_0xd062('0xa'),auth[_0xd062('0x9')](),controller['show']);router['get'](_0xd062('0xb'),auth[_0xd062('0x9')](),controller[_0xd062('0xc')]);router['get'](_0xd062('0xd'),auth[_0xd062('0x9')](),controller[_0xd062('0xe')]);router['get'](_0xd062('0xf'),auth['isAuthenticated'](),controller[_0xd062('0x10')]);router[_0xd062('0x8')](_0xd062('0x11'),auth[_0xd062('0x9')](),controller[_0xd062('0x12')]);router[_0xd062('0x8')](_0xd062('0x13'),auth[_0xd062('0x9')](),controller[_0xd062('0x14')]);router[_0xd062('0x8')](_0xd062('0x15'),auth[_0xd062('0x9')](),controller[_0xd062('0x16')]);router[_0xd062('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xd062('0x17')]);router[_0xd062('0x8')]('/:id/lists',auth[_0xd062('0x9')](),controller[_0xd062('0x18')]);router[_0xd062('0x8')](_0xd062('0x19'),auth['isAuthenticated'](),controller[_0xd062('0x1a')]);router[_0xd062('0x1b')]('/',auth['isAuthenticated'](),controller[_0xd062('0x1c')]);router['post'](_0xd062('0x1d'),auth[_0xd062('0x9')](),controller[_0xd062('0x1e')]);router[_0xd062('0x1b')](_0xd062('0x13'),auth[_0xd062('0x9')](),controller[_0xd062('0x1f')]);router['post'](_0xd062('0x15'),auth[_0xd062('0x9')](),controller[_0xd062('0x20')]);router[_0xd062('0x1b')](_0xd062('0x21'),auth[_0xd062('0x9')](),controller[_0xd062('0x22')]);router[_0xd062('0x1b')](_0xd062('0x19'),auth['isAuthenticated'](),controller[_0xd062('0x23')]);router[_0xd062('0x24')]('/:id',auth[_0xd062('0x9')](),controller[_0xd062('0x25')]);router[_0xd062('0x26')](_0xd062('0xa'),auth[_0xd062('0x9')](),controller[_0xd062('0x27')]);router[_0xd062('0x26')](_0xd062('0x13'),auth[_0xd062('0x9')](),controller[_0xd062('0x28')]);router[_0xd062('0x26')](_0xd062('0x15'),auth[_0xd062('0x9')](),controller[_0xd062('0x29')]);router[_0xd062('0x26')](_0xd062('0x21'),auth[_0xd062('0x9')](),controller['removeLists']);router[_0xd062('0x26')](_0xd062('0x19'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xd062('0x2a')]=router; \ No newline at end of file +var _0x3ef9=['express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueue.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getTeams','getAgents','getMembers','getLists','getBlackLists','post','create','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','update','destroy','delete','removeTeams','/:id/lists','removeLists','/:id/blacklists','removeBlackLists','multer','util','path','connect-timeout'];(function(_0x131dd2,_0xbd7ff1){var _0xc106f7=function(_0x56715d){while(--_0x56715d){_0x131dd2['push'](_0x131dd2['shift']());}};_0xc106f7(++_0xbd7ff1);}(_0x3ef9,0x10a));var _0x93ef=function(_0x134366,_0x32bec4){_0x134366=_0x134366-0x0;var _0x20a19a=_0x3ef9[_0x134366];return _0x20a19a;};'use strict';var multer=require(_0x93ef('0x0'));var util=require(_0x93ef('0x1'));var path=require(_0x93ef('0x2'));var timeout=require(_0x93ef('0x3'));var express=require(_0x93ef('0x4'));var router=express[_0x93ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x93ef('0x6'));var interaction=require(_0x93ef('0x7'));var config=require('../../config/environment');var controller=require(_0x93ef('0x8'));router[_0x93ef('0x9')]('/',auth[_0x93ef('0xa')](),controller[_0x93ef('0xb')]);router['get'](_0x93ef('0xc'),auth[_0x93ef('0xa')](),controller[_0x93ef('0xd')]);router[_0x93ef('0x9')](_0x93ef('0xe'),auth[_0x93ef('0xa')](),controller[_0x93ef('0xf')]);router['get'](_0x93ef('0x10'),auth['isAuthenticated'](),controller[_0x93ef('0x11')]);router[_0x93ef('0x9')](_0x93ef('0x12'),auth[_0x93ef('0xa')](),controller[_0x93ef('0x13')]);router['get'](_0x93ef('0x14'),auth[_0x93ef('0xa')](),controller['getHopperBlacks']);router[_0x93ef('0x9')](_0x93ef('0x15'),auth['isAuthenticated'](),controller[_0x93ef('0x16')]);router['get']('/:id/users',auth[_0x93ef('0xa')](),controller[_0x93ef('0x17')]);router['get']('/:id/members',auth[_0x93ef('0xa')](),controller[_0x93ef('0x18')]);router[_0x93ef('0x9')]('/:id/lists',auth['isAuthenticated'](),controller[_0x93ef('0x19')]);router[_0x93ef('0x9')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x93ef('0x1a')]);router[_0x93ef('0x1b')]('/',auth[_0x93ef('0xa')](),controller[_0x93ef('0x1c')]);router['post'](_0x93ef('0x1d'),auth['isAuthenticated'](),controller[_0x93ef('0x1e')]);router[_0x93ef('0x1b')]('/:id/teams',auth[_0x93ef('0xa')](),controller[_0x93ef('0x1f')]);router[_0x93ef('0x1b')](_0x93ef('0x20'),auth['isAuthenticated'](),controller[_0x93ef('0x21')]);router[_0x93ef('0x1b')]('/:id/lists',auth[_0x93ef('0xa')](),controller[_0x93ef('0x22')]);router[_0x93ef('0x1b')]('/:id/blacklists',auth[_0x93ef('0xa')](),controller[_0x93ef('0x23')]);router[_0x93ef('0x24')](_0x93ef('0xc'),auth[_0x93ef('0xa')](),controller[_0x93ef('0x25')]);router['delete'](_0x93ef('0xc'),auth[_0x93ef('0xa')](),controller[_0x93ef('0x26')]);router[_0x93ef('0x27')](_0x93ef('0x15'),auth[_0x93ef('0xa')](),controller[_0x93ef('0x28')]);router[_0x93ef('0x27')](_0x93ef('0x20'),auth['isAuthenticated'](),controller['removeAgents']);router[_0x93ef('0x27')](_0x93ef('0x29'),auth[_0x93ef('0xa')](),controller[_0x93ef('0x2a')]);router[_0x93ef('0x27')](_0x93ef('0x2b'),auth['isAuthenticated'](),controller[_0x93ef('0x2c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b70d854..20224b5 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 _0x25b4=['mandatoryDispositionPauseId','sequelize','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','setDataValue','strategy','getDataValue','booked','progressive','predictive','power','INTEGER','yes','all','once','TEXT','periodic_announce','joinempty','join','leavewhenempty','split','BOOLEAN','acw','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x25b4,0x1ab));var _0x425b=function(_0x4d79bc,_0x32c905){_0x4d79bc=_0x4d79bc-0x0;var _0x4b4760=_0x25b4[_0x4d79bc];return _0x4b4760;};'use strict';var Sequelize=require(_0x425b('0x0'));module['exports']={'name':{'type':Sequelize[_0x425b('0x1')],'allowNull':![],'unique':_0x425b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x4'),'outbound'),'allowNull':![],'defaultValue':_0x425b('0x4')},'musiconhold':{'type':Sequelize[_0x425b('0x1')],'defaultValue':_0x425b('0x5')},'announce':{'type':Sequelize[_0x425b('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x425b('0x6'),_0x425b('0x7'),_0x425b('0x8'),_0x425b('0x9'),_0x425b('0xa'),'linear',_0x425b('0xb'),'rrordered'),'allowNull':![],'defaultValue':_0x425b('0x6'),'set':function(_0x24ea2e){this[_0x425b('0xc')](_0x425b('0xd'),_0x24ea2e?_0x24ea2e:_0x425b('0xa'));},'get':function(){var _0x588f2b=this['getDataValue']('type');var _0x227138=this[_0x425b('0xe')]('dialMethod');var _0x14cfbc=this[_0x425b('0xe')]('strategy');if(_0x588f2b===_0x425b('0x4')){return _0x14cfbc;}if(_0x227138===_0x425b('0xf')&&_0x14cfbc==='rrmemory'||_0x227138===_0x425b('0xf')&&_0x14cfbc==='roundrobin'){return _0x14cfbc;}if(_0x227138===_0x425b('0x10')||_0x227138===_0x425b('0x11')||_0x227138===_0x425b('0x12')){return _0x14cfbc;}return null;}},'servicelevel':{'type':Sequelize[_0x425b('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x425b('0x13')](0xb)},'timeout':{'type':Sequelize[_0x425b('0x13')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x425b('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x425b('0x1')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x425b('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no',_0x425b('0x15')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x425b('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x425b('0x3')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x425b('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x425b('0x14'),'no'),'defaultValue':_0x425b('0x14')},'announce_holdtime':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no',_0x425b('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x425b('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x425b('0x3')]('yes','no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x425b('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x425b('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x425b('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x425b('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x425b('0x1')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x425b('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x425b('0x1')]},'queue_less_than':{'type':Sequelize[_0x425b('0x1')]},'periodic_announce':{'type':Sequelize[_0x425b('0x17')],'set':function(_0x26290a){this['setDataValue']('periodic_announce',_0x26290a?_0x26290a['join'](','):[]);},'get':function(){return this[_0x425b('0xe')]('periodic_announce')?this[_0x425b('0xe')](_0x425b('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x425b('0x1')],'defaultValue':_0x425b('0x14'),'set':function(_0x5c2611){this[_0x425b('0xc')]('joinempty',_0x5c2611?_0x5c2611['join'](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue'](_0x425b('0x19'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x425b('0x1')],'defaultValue':'no','set':function(_0x5d5e62){this[_0x425b('0xc')]('leavewhenempty',_0x5d5e62?_0x5d5e62[_0x425b('0x1a')](','):undefined);},'get':function(){return this[_0x425b('0xe')](_0x425b('0x1b'))?this['getDataValue'](_0x425b('0x1b'))[_0x425b('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x425b('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x425b('0x1')]},'description':{'type':Sequelize[_0x425b('0x1')]},'acw':{'type':Sequelize[_0x425b('0x1d')],'defaultValue':0x0,'set':function(_0x159430){this['setDataValue'](_0x425b('0x1e'),_0x159430);if(_0x159430){if(this[_0x425b('0xe')]('wrapuptime')<0x2){this['setDataValue']('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x425b('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x425b('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x1f'),_0x425b('0x10'),_0x425b('0x12'),_0x425b('0x11'),'booked'),'defaultValue':_0x425b('0x10'),'comment':_0x425b('0x20')},'dialLimitChannel':{'type':Sequelize[_0x425b('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x425b('0x13')](0x4)[_0x425b('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x425b('0x22')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x425b('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x425b('0x23')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x425b('0x24'),_0x425b('0x25')),'defaultValue':'dropRate','comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x425b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x425b('0x26')},'dialPredictiveInterval':{'type':Sequelize[_0x425b('0x13')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x425b('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x425b('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x425b('0x27')},'dialQueueOptions':{'type':Sequelize[_0x425b('0x1')],'defaultValue':_0x425b('0x28'),'comment':_0x425b('0x29')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x425b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x425b('0x2a')},'dialQueueProject':{'type':Sequelize[_0x425b('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x425b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x425b('0x2b')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x425b('0x13')](0x5)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x425b('0x2c')},'dialBusyMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x425b('0x13')](0x5)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x425b('0x2d')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'defaultValue':0x3,'comment':_0x425b('0x2e')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x425b('0x13')](0x5)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x425b('0x2f')},'dialTimezone':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x425b('0x30')},'dialPrefix':{'type':Sequelize[_0x425b('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x31'),'never',_0x425b('0x32')),'defaultValue':_0x425b('0x31')},'dialAMDActive':{'type':Sequelize[_0x425b('0x1d')],'defaultValue':0x0,'comment':_0x425b('0x33')},'dialAMDInitialSilence':{'type':Sequelize[_0x425b('0x13')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x425b('0x34')},'dialAMDGreeting':{'type':Sequelize[_0x425b('0x13')](0x9)[_0x425b('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x425b('0x13')](0x9)[_0x425b('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x425b('0x35')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x425b('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x425b('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0x425b('0x13')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x425b('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x425b('0x13')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x425b('0x38')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x425b('0x39')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x425b('0x13')](0x5)[_0x425b('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x425b('0x3a')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x425b('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x425b('0x1d')],'defaultValue':0x0,'comment':_0x425b('0x3b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x425b('0x3')](_0x425b('0x3c'),_0x425b('0x3d')),'defaultValue':_0x425b('0x3c')},'dialQueueProject2':{'type':Sequelize[_0x425b('0x1')],'comment':_0x425b('0x3e')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x425b('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x425b('0x13')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x425b('0x3f')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x425b('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x425b('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0x425b('0x13')](0x5)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x425b('0x41')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x425b('0x42')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x425b('0x43')},'dialMachineMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x425b('0x13')](0x5)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x425b('0x44')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x425b('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x425b('0x13')](0x5)[_0x425b('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x425b('0x13')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x425b('0x1d')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x25c42b){if(!_0x25c42b)this['setDataValue'](_0x425b('0x46'),null);this[_0x425b('0xc')]('mandatoryDisposition',_0x25c42b);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x425b('0x13')](0x3)[_0x425b('0x21')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0x8c52=['yes','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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)','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,*,*,*','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','STRING','name','ENUM','inbound','outbound','default','ringall','leastrecent','wrandom','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','rrmemory','booked','roundrobin','progressive','power','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8c52,0x7e));var _0x28c5=function(_0x5447a8,_0x45c8e9){_0x5447a8=_0x5447a8-0x0;var _0x4c586b=_0x8c52[_0x5447a8];return _0x4c586b;};'use strict';var Sequelize=require(_0x28c5('0x0'));module['exports']={'name':{'type':Sequelize[_0x28c5('0x1')],'allowNull':![],'unique':_0x28c5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x4'),_0x28c5('0x5')),'allowNull':![],'defaultValue':_0x28c5('0x4')},'musiconhold':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':_0x28c5('0x6')},'announce':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x28c5('0x3')]('rr',_0x28c5('0x7'),_0x28c5('0x8'),'fewestcalls','random','rrmemory','linear',_0x28c5('0x9'),_0x28c5('0xa')),'allowNull':![],'defaultValue':_0x28c5('0x7'),'set':function(_0x530260){this[_0x28c5('0xb')](_0x28c5('0xc'),_0x530260?_0x530260:'rrmemory');},'get':function(){var _0x3c4bba=this[_0x28c5('0xd')](_0x28c5('0xe'));var _0x95986b=this[_0x28c5('0xd')](_0x28c5('0xf'));var _0x24c459=this[_0x28c5('0xd')](_0x28c5('0xc'));if(_0x3c4bba===_0x28c5('0x4')){return _0x24c459;}if(_0x95986b==='booked'&&_0x24c459===_0x28c5('0x10')||_0x95986b===_0x28c5('0x11')&&_0x24c459===_0x28c5('0x12')){return _0x24c459;}if(_0x95986b===_0x28c5('0x13')||_0x95986b==='predictive'||_0x95986b===_0x28c5('0x14')){return _0x24c459;}return null;}},'servicelevel':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x28c5('0x15')](0xb)},'timeout':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x28c5('0x1')]},'weight':{'type':Sequelize[_0x28c5('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no'),'defaultValue':_0x28c5('0x16')},'autopause':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x28c5('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x28c5('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x28c5('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x28c5('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no'),'defaultValue':_0x28c5('0x16')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x28c5('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x28c5('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x28c5('0x1')]},'queue_youarenext':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x28c5('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x28c5('0x1')]},'queue_quantity2':{'type':Sequelize[_0x28c5('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0x28c5('0x1')]},'queue_less_than':{'type':Sequelize[_0x28c5('0x1')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x352a88){this['setDataValue'](_0x28c5('0x17'),_0x352a88?_0x352a88[_0x28c5('0x18')](','):[]);},'get':function(){return this[_0x28c5('0xd')](_0x28c5('0x17'))?this['getDataValue'](_0x28c5('0x17'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':_0x28c5('0x16'),'set':function(_0x46d6a2){this[_0x28c5('0xb')]('joinempty',_0x46d6a2?_0x46d6a2[_0x28c5('0x18')](','):undefined);},'get':function(){return this[_0x28c5('0xd')]('joinempty')?this[_0x28c5('0xd')](_0x28c5('0x19'))[_0x28c5('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0x8d8b87){this['setDataValue']('leavewhenempty',_0x8d8b87?_0x8d8b87[_0x28c5('0x18')](','):undefined);},'get':function(){return this['getDataValue'](_0x28c5('0x1b'))?this['getDataValue']('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x28c5('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x28c5('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x28c5('0x1')]},'description':{'type':Sequelize[_0x28c5('0x1')]},'acw':{'type':Sequelize[_0x28c5('0x1c')],'defaultValue':0x0,'set':function(_0x51842c){this[_0x28c5('0xb')](_0x28c5('0x1d'),_0x51842c);if(_0x51842c){if(this[_0x28c5('0xd')](_0x28c5('0x1e'))<0x2){this['setDataValue'](_0x28c5('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x28c5('0x15')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x28c5('0x1c')],'defaultValue':0x0,'comment':_0x28c5('0x1f')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x28c5('0x13'),_0x28c5('0x14'),_0x28c5('0x20'),_0x28c5('0x11')),'defaultValue':_0x28c5('0x13'),'comment':_0x28c5('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x28c5('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x28c5('0x15')](0x4)[_0x28c5('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x28c5('0x23')},'dialPowerLevel':{'type':Sequelize[_0x28c5('0x24')](0x2)[_0x28c5('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x28c5('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x28c5('0x3')](_0x28c5('0x26'),'dropRate'),'defaultValue':'dropRate','comment':_0x28c5('0x27')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x28c5('0x24')](0x2)[_0x28c5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x28c5('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x28c5('0x29')},'dialOriginateCallerIdName':{'type':Sequelize[_0x28c5('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x28c5('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x28c5('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28c5('0x2a')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x28c5('0x2b')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x28c5('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28c5('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x28c5('0x15')](0x5)[_0x28c5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28c5('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28c5('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x28c5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28c5('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0x3,'comment':_0x28c5('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x28c5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28c5('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x28c5('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x28c5('0x33')},'dialPrefix':{'type':Sequelize[_0x28c5('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always','never',_0x28c5('0x34')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x28c5('0x1c')],'defaultValue':0x0,'comment':_0x28c5('0x35')},'dialAMDInitialSilence':{'type':Sequelize[_0x28c5('0x15')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x28c5('0x36')},'dialAMDGreeting':{'type':Sequelize[_0x28c5('0x15')](0x9)[_0x28c5('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x28c5('0x15')](0x9)[_0x28c5('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x28c5('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x28c5('0x15')](0x9)[_0x28c5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x28c5('0x38')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x28c5('0x15')](0x9)[_0x28c5('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x28c5('0x39')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x28c5('0x15')](0x9)[_0x28c5('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x28c5('0x15')](0x5)[_0x28c5('0x22')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x28c5('0x3a')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x28c5('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x28c5('0x3b')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x28c5('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x28c5('0x3c')},'dialRecallInQueue':{'type':Sequelize[_0x28c5('0x1c')],'defaultValue':0x0,'comment':_0x28c5('0x3d')},'dialOrderByScheduledAt':{'type':Sequelize[_0x28c5('0x3')]('DESC',_0x28c5('0x3e')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x28c5('0x1')],'comment':_0x28c5('0x2c')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x28c5('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x28c5('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x28c5('0x3f')},'dialCutDigit':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x28c5('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28c5('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28c5('0x41')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x28c5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28c5('0x42')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28c5('0x43')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x28c5('0x15')](0x5)[_0x28c5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28c5('0x44')},'dialMachineRetryFrequency':{'type':Sequelize[_0x28c5('0x15')](0x5)[_0x28c5('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x28c5('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x28c5('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x28c5('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x28c5('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0x28c5('0x47')},'mandatoryDisposition':{'type':Sequelize[_0x28c5('0x1c')],'defaultValue':![],'comment':_0x28c5('0x48'),'set':function(_0x87492f){if(!_0x87492f)this[_0x28c5('0xb')](_0x28c5('0x49'),null);this[_0x28c5('0xb')]('mandatoryDisposition',_0x87492f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x28c5('0x15')](0x3)[_0x28c5('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x28c5('0x15')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 63bcce1..f7d2a2b 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 _0xe670=['getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','into','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','VoiceQueues','inbound','filter','ignore','map','value','find','type','UserProfileResource','end','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body','user','role','QueueCampaigns','outbound','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','findOne','nolimit','order','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','findAll','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','SIP/%s','isArray'];(function(_0x412e7d,_0x4da84e){var _0x4329cd=function(_0x33dc62){while(--_0x33dc62){_0x412e7d['push'](_0x412e7d['shift']());}};_0x4329cd(++_0x4da84e);}(_0xe670,0x19f));var _0x0e67=function(_0x48a96f,_0x530059){_0x48a96f=_0x48a96f-0x0;var _0x3ff3ef=_0xe670[_0x48a96f];return _0x3ff3ef;};'use strict';var emlformat=require(_0x0e67('0x0'));var rimraf=require(_0x0e67('0x1'));var zipdir=require(_0x0e67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e67('0x3'));var moment=require(_0x0e67('0x4'));var BPromise=require(_0x0e67('0x5'));var Mustache=require(_0x0e67('0x6'));var util=require(_0x0e67('0x7'));var path=require(_0x0e67('0x8'));var sox=require(_0x0e67('0x9'));var csv=require(_0x0e67('0xa'));var ejs=require(_0x0e67('0xb'));var fs=require('fs');var fs_extra=require(_0x0e67('0xc'));var _=require(_0x0e67('0xd'));var squel=require(_0x0e67('0xe'));var crypto=require(_0x0e67('0xf'));var jsforce=require(_0x0e67('0x10'));var deskjs=require(_0x0e67('0x11'));var toCsv=require(_0x0e67('0xa'));var querystring=require(_0x0e67('0x12'));var Papa=require(_0x0e67('0x13'));var Redis=require(_0x0e67('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0e67('0x15'));var hardwareService=require(_0x0e67('0x16'));var logger=require(_0x0e67('0x17'))(_0x0e67('0x18'));var utils=require(_0x0e67('0x19'));var config=require(_0x0e67('0x1a'));var licenseUtil=require(_0x0e67('0x1b'));var db=require(_0x0e67('0x1c'))['db'];config[_0x0e67('0x1d')]=_[_0x0e67('0x1e')](config[_0x0e67('0x1d')],{'host':_0x0e67('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0e67('0x20'))[_0x0e67('0x21')](socket);function respondWithStatusCode(_0x4d3875,_0xdb4b4b){_0xdb4b4b=_0xdb4b4b||0xcc;return function(_0x284f35){if(_0x284f35){return _0x4d3875[_0x0e67('0x22')](_0xdb4b4b);}return _0x4d3875[_0x0e67('0x23')](_0xdb4b4b)['end']();};}function respondWithResult(_0xf086df,_0x150a18){_0x150a18=_0x150a18||0xc8;return function(_0x44e99e){if(_0x44e99e){return _0xf086df['status'](_0x150a18)[_0x0e67('0x24')](_0x44e99e);}};}function respondWithFilteredResult(_0x5d67b8,_0x2c8014){return function(_0x47007c){if(_0x47007c){var _0x38ce4c=typeof _0x2c8014[_0x0e67('0x25')]===_0x0e67('0x26')&&typeof _0x2c8014[_0x0e67('0x27')]===_0x0e67('0x26');var _0x48a61d=_0x47007c[_0x0e67('0x28')];var _0x2c0c23=_0x38ce4c?0x0:_0x2c8014[_0x0e67('0x25')];var _0x3d18f4=_0x38ce4c?_0x47007c[_0x0e67('0x28')]:_0x2c8014[_0x0e67('0x25')]+_0x2c8014[_0x0e67('0x27')];var _0x4f3f8c;if(_0x3d18f4>=_0x48a61d){_0x3d18f4=_0x48a61d;_0x4f3f8c=0xc8;}else{_0x4f3f8c=0xce;}_0x5d67b8[_0x0e67('0x23')](_0x4f3f8c);return _0x5d67b8['set'](_0x0e67('0x29'),_0x2c0c23+'-'+_0x3d18f4+'/'+_0x48a61d)['json'](_0x47007c);}return null;};}function patchUpdates(_0x50a59b){return function(_0x302767){try{jsonpatch[_0x0e67('0x2a')](_0x302767,_0x50a59b,!![]);}catch(_0x416648){return BPromise[_0x0e67('0x2b')](_0x416648);}return _0x302767[_0x0e67('0x2c')]();};}function saveUpdates(_0xfcbeb8,_0x108783){return function(_0x55f1f6){if(_0x55f1f6){return _0x55f1f6['update'](_0xfcbeb8)[_0x0e67('0x2d')](function(_0x40a1bb){return _0x40a1bb;});}return null;};}function removeEntity(_0x170e44,_0x3b2296){return function(_0x192068){if(_0x192068){return _0x192068[_0x0e67('0x2e')]()[_0x0e67('0x2d')](function(){var _0x7fdc33=_0x192068[_0x0e67('0x2f')]({'plain':!![]});var _0x36f46b=[{'name':_0x0e67('0x30'),'value':_0x0e67('0x31'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x5140f3=_(_0x36f46b)[_0x0e67('0x32')](_0x0e67('0x33'))[_0x0e67('0x34')]('value')[_0x0e67('0x35')]();if(_['includes'](_0x5140f3,_0x7fdc33['type'])){return;}var _0x523b0b=_[_0x0e67('0x36')](_0x36f46b,[_0x0e67('0x35'),_0x7fdc33[_0x0e67('0x37')]])['name'];return db[_0x0e67('0x38')][_0x0e67('0x2e')]({'where':{'type':_0x523b0b,'resourceId':_0x7fdc33['id']}})['then'](function(){return _0x192068;});})[_0x0e67('0x2d')](function(){_0x170e44[_0x0e67('0x23')](0xcc)[_0x0e67('0x39')]();});}};}function handleEntityNotFound(_0x50ac1e,_0x4dab9d){return function(_0x2c35be){if(!_0x2c35be){_0x50ac1e[_0x0e67('0x22')](0x194);}return _0x2c35be;};}function handleError(_0x36f254,_0x49593b){_0x49593b=_0x49593b||0x1f4;return function(_0x3ce243){logger['error'](_0x3ce243[_0x0e67('0x3a')]);if(_0x3ce243[_0x0e67('0x3b')]){delete _0x3ce243[_0x0e67('0x3b')];}_0x36f254[_0x0e67('0x23')](_0x49593b)[_0x0e67('0x3c')](_0x3ce243);};}exports[_0x0e67('0x3d')]=function(_0x40f86f,_0x596eeb){var _0x5d6a5c={},_0x4b12c7={},_0x213f77={'count':0x0,'rows':[]};var _0x238ec6=_[_0x0e67('0x34')](db[_0x0e67('0x3e')][_0x0e67('0x3f')],function(_0xa752dc){return{'name':_0xa752dc[_0x0e67('0x40')],'type':_0xa752dc['type'][_0x0e67('0x41')]};});_0x4b12c7['model']=_['map'](_0x238ec6,'name');_0x4b12c7[_0x0e67('0x42')]=_[_0x0e67('0x43')](_0x40f86f['query']);_0x4b12c7[_0x0e67('0x44')]=_['intersection'](_0x4b12c7[_0x0e67('0x45')],_0x4b12c7[_0x0e67('0x42')]);_0x5d6a5c[_0x0e67('0x46')]=_[_0x0e67('0x47')](_0x4b12c7[_0x0e67('0x45')],qs[_0x0e67('0x48')](_0x40f86f[_0x0e67('0x42')][_0x0e67('0x48')]));_0x5d6a5c[_0x0e67('0x46')]=_0x5d6a5c['attributes'][_0x0e67('0x49')]?_0x5d6a5c[_0x0e67('0x46')]:_0x4b12c7[_0x0e67('0x45')];if(!_0x40f86f[_0x0e67('0x42')][_0x0e67('0x4a')]('nolimit')){_0x5d6a5c[_0x0e67('0x27')]=qs[_0x0e67('0x27')](_0x40f86f[_0x0e67('0x42')][_0x0e67('0x27')]);_0x5d6a5c['offset']=qs[_0x0e67('0x25')](_0x40f86f[_0x0e67('0x42')][_0x0e67('0x25')]);}_0x5d6a5c['order']=qs['sort'](_0x40f86f[_0x0e67('0x42')][_0x0e67('0x4b')]);_0x5d6a5c[_0x0e67('0x4c')]=qs[_0x0e67('0x44')](_[_0x0e67('0x4d')](_0x40f86f[_0x0e67('0x42')],_0x4b12c7['filters']),_0x238ec6);if(_0x40f86f['query'][_0x0e67('0x32')]){_0x5d6a5c[_0x0e67('0x4c')]=_[_0x0e67('0x4e')](_0x5d6a5c[_0x0e67('0x4c')],{'$or':_[_0x0e67('0x34')](_0x238ec6,function(_0xb6d5d0){if(_0xb6d5d0[_0x0e67('0x37')]!==_0x0e67('0x4f')){var _0x417ade={};_0x417ade[_0xb6d5d0[_0x0e67('0x3b')]]={'$like':'%'+_0x40f86f[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x417ade;}})});}_0x5d6a5c=_[_0x0e67('0x4e')]({},_0x5d6a5c,_0x40f86f[_0x0e67('0x50')]);var _0x443c7e={'where':_0x5d6a5c['where']};return db['VoiceQueue']['count'](_0x443c7e)[_0x0e67('0x2d')](function(_0x7ca91){_0x213f77['count']=_0x7ca91;if(_0x40f86f[_0x0e67('0x42')][_0x0e67('0x51')]){_0x5d6a5c['include']=[{'all':!![]}];}return db[_0x0e67('0x3e')]['findAll'](_0x5d6a5c);})[_0x0e67('0x2d')](function(_0x251941){_0x213f77[_0x0e67('0x52')]=_0x251941;return _0x213f77;})[_0x0e67('0x2d')](respondWithFilteredResult(_0x596eeb,_0x5d6a5c))[_0x0e67('0x53')](handleError(_0x596eeb,null));};exports[_0x0e67('0x54')]=function(_0x4e43ce,_0x5a899e){var _0x52af54={'raw':![],'where':{'id':_0x4e43ce[_0x0e67('0x55')]['id']}},_0x57eb73={};_0x57eb73[_0x0e67('0x45')]=_['keys'](db['VoiceQueue'][_0x0e67('0x3f')]);_0x57eb73['query']=_[_0x0e67('0x43')](_0x4e43ce[_0x0e67('0x42')]);_0x57eb73[_0x0e67('0x44')]=_[_0x0e67('0x47')](_0x57eb73[_0x0e67('0x45')],_0x57eb73[_0x0e67('0x42')]);_0x52af54['attributes']=_[_0x0e67('0x47')](_0x57eb73[_0x0e67('0x45')],qs[_0x0e67('0x48')](_0x4e43ce[_0x0e67('0x42')]['fields']));_0x52af54[_0x0e67('0x46')]=_0x52af54[_0x0e67('0x46')][_0x0e67('0x49')]?_0x52af54[_0x0e67('0x46')]:_0x57eb73['model'];if(_0x4e43ce[_0x0e67('0x42')][_0x0e67('0x51')]){_0x52af54[_0x0e67('0x56')]=[{'all':!![]}];}_0x52af54=_[_0x0e67('0x4e')]({},_0x52af54,_0x4e43ce['options']);return db[_0x0e67('0x3e')][_0x0e67('0x36')](_0x52af54)[_0x0e67('0x2d')](handleEntityNotFound(_0x5a899e,null))[_0x0e67('0x2d')](respondWithResult(_0x5a899e,null))[_0x0e67('0x53')](handleError(_0x5a899e,null));};exports[_0x0e67('0x57')]=function(_0x49e27f,_0xfa450d){return db[_0x0e67('0x3e')][_0x0e67('0x57')](_0x49e27f[_0x0e67('0x58')],{})[_0x0e67('0x2d')](function(_0x1d1c18){var _0xcc2673=_0x49e27f[_0x0e67('0x59')][_0x0e67('0x2f')]({'plain':!![]});if(!_0xcc2673)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcc2673[_0x0e67('0x5a')]===_0x0e67('0x59')){var _0xdac38a=_0x1d1c18[_0x0e67('0x2f')]({'plain':!![]});var _0xbde0a1=[{'name':_0x0e67('0x30'),'value':_0x0e67('0x31')},{'name':_0x0e67('0x5b'),'value':_0x0e67('0x5c')}];var _0x38d9aa=_[_0x0e67('0x36')](_0xbde0a1,['value',_0xdac38a[_0x0e67('0x37')]])['name'];return db[_0x0e67('0x5d')][_0x0e67('0x36')]({'where':{'name':_0x38d9aa,'userProfileId':_0xcc2673[_0x0e67('0x5e')]},'raw':!![]})[_0x0e67('0x2d')](function(_0x2133f2){if(_0x2133f2&&_0x2133f2[_0x0e67('0x5f')]===0x0){return db[_0x0e67('0x38')]['create']({'name':_0xdac38a['name'],'resourceId':_0xdac38a['id'],'type':_0x2133f2[_0x0e67('0x3b')],'sectionId':_0x2133f2['id']},{})[_0x0e67('0x2d')](function(){return _0x1d1c18;});}else{return _0x1d1c18;}})[_0x0e67('0x53')](function(_0x43e12d){logger[_0x0e67('0x60')](_0x0e67('0x61'),_0x43e12d);throw _0x43e12d;});}return _0x1d1c18;})[_0x0e67('0x2d')](respondWithResult(_0xfa450d,0xc9))[_0x0e67('0x53')](handleError(_0xfa450d,null));};exports[_0x0e67('0x62')]=function(_0x48c796,_0x3538ef){var _0x4320ef={'where':{'id':_0x48c796[_0x0e67('0x55')]['id']}},_0x224ab2={};_0x224ab2[_0x0e67('0x45')]=_[_0x0e67('0x43')](db['VoiceQueue']['rawAttributes']);_0x4320ef['attributes']=_[_0x0e67('0x47')](_0x224ab2['model'],qs[_0x0e67('0x48')](_0x48c796[_0x0e67('0x42')][_0x0e67('0x48')]));_0x4320ef[_0x0e67('0x46')]=_0x4320ef[_0x0e67('0x46')][_0x0e67('0x49')]?_0x4320ef[_0x0e67('0x46')]:_0x224ab2['model'];if(_0x48c796[_0x0e67('0x42')][_0x0e67('0x51')]){_0x4320ef[_0x0e67('0x56')]=[{'all':!![]}];}_0x4320ef=_['merge']({},_0x4320ef,_0x48c796[_0x0e67('0x50')]);return db[_0x0e67('0x3e')][_0x0e67('0x36')](_0x4320ef)['then'](handleEntityNotFound(_0x3538ef,null))[_0x0e67('0x2d')](function(_0x51d5fe){if(_0x51d5fe){var _0x15ec92=_0x51d5fe[_0x0e67('0x2f')]({'plain':!![]});_0x15ec92=qs[_0x0e67('0x63')](_0x15ec92,['id','createdAt',_0x0e67('0x64')]);_0x48c796[_0x0e67('0x58')]=_[_0x0e67('0x63')](_0x48c796['body'],['id',_0x0e67('0x65'),_0x0e67('0x64')]);return db['VoiceQueue'][_0x0e67('0x57')](_['merge'](_0x15ec92,_0x48c796[_0x0e67('0x58')]),{'include':_0x48c796['query'][_0x0e67('0x51')]?[{'all':!![]}]:undefined})[_0x0e67('0x2d')](function(_0x42d751){var _0x561b19=_0x48c796[_0x0e67('0x59')]['get']({'plain':!![]});if(!_0x561b19)throw new Error(_0x0e67('0x66'));if(_0x561b19[_0x0e67('0x5a')]===_0x0e67('0x59')){var _0x15fbae=_0x42d751[_0x0e67('0x2f')]({'plain':!![]});var _0xdc0175=[{'name':_0x0e67('0x30'),'value':_0x0e67('0x31')},{'name':_0x0e67('0x5b'),'value':_0x0e67('0x5c')}];var _0x1820c7=_[_0x0e67('0x36')](_0xdc0175,[_0x0e67('0x35'),_0x15fbae[_0x0e67('0x37')]])[_0x0e67('0x3b')];return db[_0x0e67('0x5d')]['find']({'where':{'name':_0x1820c7,'userProfileId':_0x561b19[_0x0e67('0x5e')]},'raw':!![]})[_0x0e67('0x2d')](function(_0x1bbeb7){if(_0x1bbeb7&&_0x1bbeb7[_0x0e67('0x5f')]===0x0){return db[_0x0e67('0x38')][_0x0e67('0x57')]({'name':_0x15fbae['name'],'resourceId':_0x15fbae['id'],'type':_0x1bbeb7[_0x0e67('0x3b')],'sectionId':_0x1bbeb7['id']},{})['then'](function(){return _0x42d751;});}else{return _0x42d751;}})[_0x0e67('0x53')](function(_0x5e05fd){logger['error'](_0x0e67('0x61'),_0x5e05fd);throw _0x5e05fd;});}return _0x42d751;});}})['then'](respondWithResult(_0x3538ef,0xc9))[_0x0e67('0x53')](handleError(_0x3538ef,null));};exports[_0x0e67('0x67')]=function(_0x528ac1,_0x5527b7){if(_0x528ac1['body']['id']){delete _0x528ac1[_0x0e67('0x58')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x528ac1[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x5527b7,null))[_0x0e67('0x2d')](saveUpdates(_0x528ac1[_0x0e67('0x58')],null))[_0x0e67('0x2d')](respondWithResult(_0x5527b7,null))[_0x0e67('0x53')](handleError(_0x5527b7,null));};exports[_0x0e67('0x2e')]=function(_0x81ede5,_0x8c637c){return db[_0x0e67('0x3e')][_0x0e67('0x36')]({'where':{'id':_0x81ede5[_0x0e67('0x55')]['id']}})['then'](handleEntityNotFound(_0x8c637c,null))[_0x0e67('0x2d')](removeEntity(_0x8c637c,null))[_0x0e67('0x53')](handleError(_0x8c637c,null));};exports['getHoppers']=function(_0x2a72d3,_0x30e51d,_0x1daa8a){var _0x4f6ff2={'raw':![],'where':{}};var _0x2961d7={};var _0x19dba7={'count':0x0,'rows':[]};return db[_0x0e67('0x3e')][_0x0e67('0x68')]({'where':{'id':_0x2a72d3[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x30e51d,null))['then'](function(_0x11fe60){if(_0x11fe60){_0x2961d7[_0x0e67('0x45')]=_[_0x0e67('0x43')](db['CmHopper'][_0x0e67('0x3f')]);_0x2961d7[_0x0e67('0x42')]=_[_0x0e67('0x43')](_0x2a72d3[_0x0e67('0x42')]);_0x2961d7[_0x0e67('0x44')]=_[_0x0e67('0x47')](_0x2961d7['model'],_0x2961d7[_0x0e67('0x42')]);_0x4f6ff2[_0x0e67('0x46')]=_[_0x0e67('0x47')](_0x2961d7['model'],qs['fields'](_0x2a72d3[_0x0e67('0x42')][_0x0e67('0x48')]));_0x4f6ff2[_0x0e67('0x46')]=_0x4f6ff2[_0x0e67('0x46')][_0x0e67('0x49')]?_0x4f6ff2[_0x0e67('0x46')]:_0x2961d7[_0x0e67('0x45')];if(!_0x2a72d3[_0x0e67('0x42')][_0x0e67('0x4a')](_0x0e67('0x69'))){_0x4f6ff2[_0x0e67('0x27')]=qs[_0x0e67('0x27')](_0x2a72d3[_0x0e67('0x42')][_0x0e67('0x27')]);_0x4f6ff2['offset']=qs['offset'](_0x2a72d3[_0x0e67('0x42')][_0x0e67('0x25')]);}_0x4f6ff2[_0x0e67('0x6a')]=qs['sort'](_0x2a72d3[_0x0e67('0x42')]['sort']);_0x4f6ff2[_0x0e67('0x4c')]=qs[_0x0e67('0x44')](_['pick'](_0x2a72d3[_0x0e67('0x42')],_0x2961d7[_0x0e67('0x44')]));_0x4f6ff2[_0x0e67('0x4c')][_0x0e67('0x6b')]=_0x11fe60['id'];if(_0x2a72d3['query'][_0x0e67('0x32')]){_0x4f6ff2['where']=_[_0x0e67('0x4e')](_0x4f6ff2[_0x0e67('0x4c')],{'$or':_[_0x0e67('0x34')](_0x4f6ff2['attributes'],function(_0x4ced4d){var _0x5f175a={};_0x5f175a[_0x4ced4d]={'$like':'%'+_0x2a72d3[_0x0e67('0x42')]['filter']+'%'};return _0x5f175a;})});}_0x4f6ff2=_[_0x0e67('0x4e')]({},_0x4f6ff2,_0x2a72d3[_0x0e67('0x50')]);return db[_0x0e67('0x6c')][_0x0e67('0x28')]({'where':_0x4f6ff2[_0x0e67('0x4c')]})[_0x0e67('0x2d')](function(_0x56796c){_0x19dba7[_0x0e67('0x28')]=_0x56796c;if(_0x2a72d3['query'][_0x0e67('0x51')]){_0x4f6ff2[_0x0e67('0x56')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x4f6ff2);})[_0x0e67('0x2d')](function(_0xd8881a){_0x19dba7[_0x0e67('0x52')]=_0xd8881a;return _0x19dba7;});}})[_0x0e67('0x2d')](respondWithFilteredResult(_0x30e51d,_0x4f6ff2))[_0x0e67('0x53')](handleError(_0x30e51d,null));};exports[_0x0e67('0x6d')]=function(_0x575baa,_0x4a84c8,_0x1a96bc){var _0x244ec5={'raw':!![],'where':{}};var _0x51cc81={};var _0x4dc2b6={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0e67('0x68')]({'where':{'id':_0x575baa[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x4a84c8,null))[_0x0e67('0x2d')](function(_0x1f5197){if(_0x1f5197){_0x51cc81['model']=_['keys'](db[_0x0e67('0x6e')]['rawAttributes']);_0x51cc81['query']=_[_0x0e67('0x43')](_0x575baa['query']);_0x51cc81[_0x0e67('0x44')]=_[_0x0e67('0x47')](_0x51cc81[_0x0e67('0x45')],_0x51cc81[_0x0e67('0x42')]);_0x244ec5['attributes']=_[_0x0e67('0x47')](_0x51cc81['model'],qs[_0x0e67('0x48')](_0x575baa[_0x0e67('0x42')][_0x0e67('0x48')]));_0x244ec5['attributes']=_0x244ec5[_0x0e67('0x46')][_0x0e67('0x49')]?_0x244ec5['attributes']:_0x51cc81[_0x0e67('0x45')];if(!_0x575baa[_0x0e67('0x42')][_0x0e67('0x4a')](_0x0e67('0x69'))){_0x244ec5[_0x0e67('0x27')]=qs[_0x0e67('0x27')](_0x575baa[_0x0e67('0x42')][_0x0e67('0x27')]);_0x244ec5[_0x0e67('0x25')]=qs['offset'](_0x575baa[_0x0e67('0x42')][_0x0e67('0x25')]);}_0x244ec5[_0x0e67('0x6a')]=qs[_0x0e67('0x4b')](_0x575baa['query'][_0x0e67('0x4b')]);_0x244ec5[_0x0e67('0x4c')]=qs[_0x0e67('0x44')](_['pick'](_0x575baa[_0x0e67('0x42')],_0x51cc81[_0x0e67('0x44')]));_0x244ec5[_0x0e67('0x4c')][_0x0e67('0x6b')]=_0x1f5197['id'];if(_0x575baa[_0x0e67('0x42')][_0x0e67('0x32')]){_0x244ec5[_0x0e67('0x4c')]=_[_0x0e67('0x4e')](_0x244ec5[_0x0e67('0x4c')],{'$or':_[_0x0e67('0x34')](_0x244ec5[_0x0e67('0x46')],function(_0x1a0f29){var _0x53ab46={};_0x53ab46[_0x1a0f29]={'$like':'%'+_0x575baa[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x53ab46;})});}_0x244ec5=_[_0x0e67('0x4e')]({},_0x244ec5,_0x575baa[_0x0e67('0x50')]);return db[_0x0e67('0x6e')]['count']({'where':_0x244ec5['where']})[_0x0e67('0x2d')](function(_0x3238f6){_0x4dc2b6['count']=_0x3238f6;if(_0x575baa['query'][_0x0e67('0x51')]){_0x244ec5[_0x0e67('0x56')]=[{'all':!![]}];}return db[_0x0e67('0x6e')][_0x0e67('0x6f')](_0x244ec5);})['then'](function(_0x145826){_0x4dc2b6['rows']=_0x145826;return _0x4dc2b6;});}})[_0x0e67('0x2d')](respondWithFilteredResult(_0x4a84c8,_0x244ec5))['catch'](handleError(_0x4a84c8,null));};exports[_0x0e67('0x70')]=function(_0x140f5f,_0x5f014b,_0x557b10){var _0x1c7e9d={'raw':!![],'where':{}};var _0x5e551e={};var _0x5e0d80={'count':0x0,'rows':[]};return db[_0x0e67('0x3e')][_0x0e67('0x68')]({'where':{'id':_0x140f5f[_0x0e67('0x55')]['id']}})['then'](handleEntityNotFound(_0x5f014b,null))[_0x0e67('0x2d')](function(_0x36d2fa){if(_0x36d2fa){_0x5e551e[_0x0e67('0x45')]=_[_0x0e67('0x43')](db[_0x0e67('0x71')]['rawAttributes']);_0x5e551e[_0x0e67('0x42')]=_[_0x0e67('0x43')](_0x140f5f[_0x0e67('0x42')]);_0x5e551e['filters']=_[_0x0e67('0x47')](_0x5e551e[_0x0e67('0x45')],_0x5e551e[_0x0e67('0x42')]);_0x1c7e9d['attributes']=_[_0x0e67('0x47')](_0x5e551e[_0x0e67('0x45')],qs[_0x0e67('0x48')](_0x140f5f['query'][_0x0e67('0x48')]));_0x1c7e9d[_0x0e67('0x46')]=_0x1c7e9d[_0x0e67('0x46')][_0x0e67('0x49')]?_0x1c7e9d['attributes']:_0x5e551e[_0x0e67('0x45')];if(!_0x140f5f[_0x0e67('0x42')][_0x0e67('0x4a')](_0x0e67('0x69'))){_0x1c7e9d[_0x0e67('0x27')]=qs['limit'](_0x140f5f[_0x0e67('0x42')][_0x0e67('0x27')]);_0x1c7e9d[_0x0e67('0x25')]=qs[_0x0e67('0x25')](_0x140f5f[_0x0e67('0x42')][_0x0e67('0x25')]);}_0x1c7e9d[_0x0e67('0x6a')]=qs[_0x0e67('0x4b')](_0x140f5f[_0x0e67('0x42')]['sort']);_0x1c7e9d['where']=qs[_0x0e67('0x44')](_[_0x0e67('0x4d')](_0x140f5f[_0x0e67('0x42')],_0x5e551e[_0x0e67('0x44')]));_0x1c7e9d[_0x0e67('0x4c')][_0x0e67('0x6b')]=_0x36d2fa['id'];if(_0x140f5f[_0x0e67('0x42')][_0x0e67('0x32')]){_0x1c7e9d['where']=_[_0x0e67('0x4e')](_0x1c7e9d[_0x0e67('0x4c')],{'$or':_[_0x0e67('0x34')](_0x1c7e9d['attributes'],function(_0x23875f){var _0x415a11={};_0x415a11[_0x23875f]={'$like':'%'+_0x140f5f[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x415a11;})});}_0x1c7e9d=_[_0x0e67('0x4e')]({},_0x1c7e9d,_0x140f5f['options']);return db[_0x0e67('0x71')]['count']({'where':_0x1c7e9d['where']})[_0x0e67('0x2d')](function(_0x330ced){_0x5e0d80[_0x0e67('0x28')]=_0x330ced;if(_0x140f5f[_0x0e67('0x42')][_0x0e67('0x51')]){_0x1c7e9d[_0x0e67('0x56')]=[{'all':!![]}];}return db[_0x0e67('0x71')][_0x0e67('0x6f')](_0x1c7e9d);})[_0x0e67('0x2d')](function(_0x30c114){_0x5e0d80[_0x0e67('0x52')]=_0x30c114;return _0x5e0d80;});}})[_0x0e67('0x2d')](respondWithFilteredResult(_0x5f014b,_0x1c7e9d))[_0x0e67('0x53')](handleError(_0x5f014b,null));};exports[_0x0e67('0x72')]=function(_0x3eb8e8,_0x490b05,_0x197ca7){var _0x32c0c7={'raw':!![],'where':{}};var _0x5de4d4={};var _0x4eceda={'count':0x0,'rows':[]};return db[_0x0e67('0x3e')][_0x0e67('0x68')]({'where':{'id':_0x3eb8e8[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x490b05,null))[_0x0e67('0x2d')](function(_0x2da371){if(_0x2da371){_0x5de4d4[_0x0e67('0x45')]=_[_0x0e67('0x43')](db[_0x0e67('0x73')][_0x0e67('0x3f')]);_0x5de4d4['query']=_['keys'](_0x3eb8e8[_0x0e67('0x42')]);_0x5de4d4['filters']=_[_0x0e67('0x47')](_0x5de4d4['model'],_0x5de4d4[_0x0e67('0x42')]);_0x32c0c7[_0x0e67('0x46')]=_[_0x0e67('0x47')](_0x5de4d4[_0x0e67('0x45')],qs[_0x0e67('0x48')](_0x3eb8e8[_0x0e67('0x42')]['fields']));_0x32c0c7[_0x0e67('0x46')]=_0x32c0c7[_0x0e67('0x46')][_0x0e67('0x49')]?_0x32c0c7[_0x0e67('0x46')]:_0x5de4d4[_0x0e67('0x45')];if(!_0x3eb8e8[_0x0e67('0x42')]['hasOwnProperty'](_0x0e67('0x69'))){_0x32c0c7['limit']=qs['limit'](_0x3eb8e8[_0x0e67('0x42')][_0x0e67('0x27')]);_0x32c0c7[_0x0e67('0x25')]=qs[_0x0e67('0x25')](_0x3eb8e8['query'][_0x0e67('0x25')]);}_0x32c0c7[_0x0e67('0x6a')]=qs['sort'](_0x3eb8e8[_0x0e67('0x42')][_0x0e67('0x4b')]);_0x32c0c7['where']=qs[_0x0e67('0x44')](_[_0x0e67('0x4d')](_0x3eb8e8[_0x0e67('0x42')],_0x5de4d4['filters']));_0x32c0c7[_0x0e67('0x4c')]['VoiceQueueId']=_0x2da371['id'];if(_0x3eb8e8[_0x0e67('0x42')][_0x0e67('0x32')]){_0x32c0c7[_0x0e67('0x4c')]=_[_0x0e67('0x4e')](_0x32c0c7[_0x0e67('0x4c')],{'$or':_['map'](_0x32c0c7[_0x0e67('0x46')],function(_0x55c53f){var _0x46e9a4={};_0x46e9a4[_0x55c53f]={'$like':'%'+_0x3eb8e8[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x46e9a4;})});}_0x32c0c7=_['merge']({},_0x32c0c7,_0x3eb8e8[_0x0e67('0x50')]);return db['CmHopperBlack'][_0x0e67('0x28')]({'where':_0x32c0c7[_0x0e67('0x4c')]})[_0x0e67('0x2d')](function(_0x85b968){_0x4eceda[_0x0e67('0x28')]=_0x85b968;if(_0x3eb8e8['query'][_0x0e67('0x51')]){_0x32c0c7[_0x0e67('0x56')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x0e67('0x6f')](_0x32c0c7);})['then'](function(_0x8252e){_0x4eceda[_0x0e67('0x52')]=_0x8252e;return _0x4eceda;});}})[_0x0e67('0x2d')](respondWithFilteredResult(_0x490b05,_0x32c0c7))[_0x0e67('0x53')](handleError(_0x490b05,null));};exports[_0x0e67('0x74')]=function(_0x29cd02,_0xe0343,_0x55a092){var _0x1b089a={};var _0x2d8cbd={};var _0x3a4881;var _0x325173;return db[_0x0e67('0x3e')][_0x0e67('0x68')]({'where':{'id':_0x29cd02[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0xe0343,null))[_0x0e67('0x2d')](function(_0x13b591){if(_0x13b591){_0x3a4881=_0x13b591;_0x2d8cbd[_0x0e67('0x45')]=_[_0x0e67('0x43')](db[_0x0e67('0x75')][_0x0e67('0x3f')]);_0x2d8cbd[_0x0e67('0x42')]=_[_0x0e67('0x43')](_0x29cd02['query']);_0x2d8cbd[_0x0e67('0x44')]=_['intersection'](_0x2d8cbd[_0x0e67('0x45')],_0x2d8cbd[_0x0e67('0x42')]);_0x1b089a[_0x0e67('0x46')]=_[_0x0e67('0x47')](_0x2d8cbd[_0x0e67('0x45')],qs['fields'](_0x29cd02[_0x0e67('0x42')][_0x0e67('0x48')]));_0x1b089a[_0x0e67('0x46')]=_0x1b089a[_0x0e67('0x46')]['length']?_0x1b089a['attributes']:_0x2d8cbd[_0x0e67('0x45')];_0x1b089a['order']=qs[_0x0e67('0x4b')](_0x29cd02[_0x0e67('0x42')][_0x0e67('0x4b')]);_0x1b089a['where']=qs[_0x0e67('0x44')](_[_0x0e67('0x4d')](_0x29cd02['query'],_0x2d8cbd[_0x0e67('0x44')]));if(_0x29cd02[_0x0e67('0x42')][_0x0e67('0x32')]){_0x1b089a['where']=_[_0x0e67('0x4e')](_0x1b089a[_0x0e67('0x4c')],{'$or':_[_0x0e67('0x34')](_0x1b089a[_0x0e67('0x46')],function(_0x90cec2){var _0x2787c5={};_0x2787c5[_0x90cec2]={'$like':'%'+_0x29cd02[_0x0e67('0x42')]['filter']+'%'};return _0x2787c5;})});}_0x1b089a=_[_0x0e67('0x4e')]({},_0x1b089a,_0x29cd02['options']);return _0x3a4881[_0x0e67('0x74')](_0x1b089a);}})[_0x0e67('0x2d')](function(_0x2e75e0){if(_0x2e75e0){_0x325173=_0x2e75e0['length'];if(!_0x29cd02[_0x0e67('0x42')][_0x0e67('0x4a')](_0x0e67('0x69'))){_0x1b089a[_0x0e67('0x27')]=qs['limit'](_0x29cd02[_0x0e67('0x42')][_0x0e67('0x27')]);_0x1b089a[_0x0e67('0x25')]=qs[_0x0e67('0x25')](_0x29cd02[_0x0e67('0x42')][_0x0e67('0x25')]);}return _0x3a4881[_0x0e67('0x74')](_0x1b089a);}})[_0x0e67('0x2d')](function(_0x13e3ef){if(_0x13e3ef){return _0x13e3ef?{'count':_0x325173,'rows':_0x13e3ef}:null;}})[_0x0e67('0x2d')](respondWithResult(_0xe0343,null))['catch'](handleError(_0xe0343,null));};exports[_0x0e67('0x76')]=function(_0x543eb3,_0x533821,_0x100e60){var _0x2a7585=_0x543eb3['body']['teams'];var _0x71c9cb=_['map'](_0x2a7585,'id');return db['Team'][_0x0e67('0x6f')]({'where':{'id':_0x71c9cb},'attributes':['id'],'include':[{'model':db[_0x0e67('0x77')],'as':_0x0e67('0x78'),'attributes':['id',_0x0e67('0x3b'),_0x0e67('0x79'),_0x0e67('0x7a'),_0x0e67('0x7b')],'raw':!![]}]})[_0x0e67('0x2d')](function(_0x4bdd62){if(_0x4bdd62){var _0x4fa12c=_[_0x0e67('0x7c')](_0x4bdd62,function(_0x2b5d6d){var _0x358423=_0x2b5d6d['get']({'plain':!![]});_0x358423[_0x0e67('0x78')][_0x0e67('0x7d')](function(_0x56af9b){_0x56af9b[_0x0e67('0x7e')]=_['find'](_0x2a7585,{'id':_0x358423['id']})[_0x0e67('0x7e')];});return _0x358423[_0x0e67('0x78')];});return db['VoiceQueue']['find']({'where':{'id':_0x543eb3[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](function(_0x41f8f4){return db['sequelize'][_0x0e67('0x7f')](function(_0x2c1193){return _0x41f8f4[_0x0e67('0x76')](_0x71c9cb,{'transaction':_0x2c1193})['then'](function(){return BPromise[_0x0e67('0x80')](_0x2a7585,function(_0x297979){return db[_0x0e67('0x81')][_0x0e67('0x82')]({'TeamId':_0x297979['id'],'VoiceQueueId':_0x543eb3[_0x0e67('0x55')]['id'],'penalty':_0x297979['penalty']},{'transaction':_0x2c1193});});})['then'](function(){return BPromise[_0x0e67('0x80')](_0x4fa12c,function(_0xa9abab){return db['UserVoiceQueue'][_0x0e67('0x83')]({'where':{'UserId':_0xa9abab['id'],'VoiceQueueId':_0x543eb3[_0x0e67('0x55')]['id']},'defaults':{'penalty':_0xa9abab[_0x0e67('0x7e')]},'transaction':_0x2c1193});});})['then'](function(){return BPromise['each'](_[_0x0e67('0x32')](_0x4fa12c,{'online':!![]}),function(_0x48e260){return db[_0x0e67('0x84')][_0x0e67('0x82')]({'membername':_0x48e260[_0x0e67('0x3b')],'UserId':_0x48e260['id'],'queue_name':_0x41f8f4[_0x0e67('0x3b')],'VoiceQueueId':_0x41f8f4['id'],'interface':_[_0x0e67('0x85')](_0x48e260[_0x0e67('0x7b')])?util[_0x0e67('0x86')]('SIP/%s',_0x48e260[_0x0e67('0x3b')]):_0x48e260[_0x0e67('0x7b')],'paused':_0x48e260[_0x0e67('0x7a')]||![],'penalty':_0x48e260[_0x0e67('0x7e')]},{'transaction':_0x2c1193});});})[_0x0e67('0x2d')](function(){_0x4fa12c['forEach'](function(_0x47cfca){socket[_0x0e67('0x87')](_0x0e67('0x88'),{'UserId':_0x47cfca['id'],'VoiceQueueId':_0x41f8f4['id']});});});});});}})[_0x0e67('0x2d')](respondWithStatusCode(_0x533821,null))[_0x0e67('0x53')](handleError(_0x533821,null));};exports[_0x0e67('0x89')]=function(_0x38f5fa,_0x5430a2,_0x5db76c){return db[_0x0e67('0x75')][_0x0e67('0x6f')]({'where':{'id':_0x38f5fa[_0x0e67('0x42')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0e67('0x78'),'attributes':['id'],'raw':!![]}]})[_0x0e67('0x2d')](handleEntityNotFound(_0x5430a2,null))['then'](function(_0x527720){var _0x23aff5=_[_0x0e67('0x34')](_0x527720,'id');var _0x226f55=[];var _0x279c0f=[];var _0x4b2e64=squel[_0x0e67('0x8a')]();_0x4b2e64[_0x0e67('0x8b')](_0x0e67('0x8c'))[_0x0e67('0x8d')]('team_has_voice_queues','tq')['join'](_0x0e67('0x8e'),'ut',_0x0e67('0x8f'))['where'](_0x0e67('0x90'),_0x38f5fa[_0x0e67('0x55')]['id']);for(var _0x3b755c=0x0;_0x3b755c<_0x527720[_0x0e67('0x49')];_0x3b755c+=0x1){let _0x58f230=_0x527720[_0x3b755c];for(var _0x42a545=0x0;_0x42a545<_0x58f230[_0x0e67('0x78')]['length'];_0x42a545+=0x1){let _0x1837b8=_0x58f230[_0x0e67('0x78')][_0x42a545];var _0x58318a=_0x4b2e64[_0x0e67('0x62')]();_0x58318a['where'](_0x0e67('0x91'),_0x1837b8['id']);_0x279c0f[_0x0e67('0x92')](db[_0x0e67('0x93')][_0x0e67('0x42')](_0x58318a['toString'](),{'type':db[_0x0e67('0x93')][_0x0e67('0x94')][_0x0e67('0x95')]})['then'](function(_0x598451){if(_0x598451[_0x0e67('0x49')]===0x1){return _0x1837b8['id'];}else{var _0x48da21=_['every'](_[_0x0e67('0x34')](_0x598451,_0x0e67('0x96')),function(_0x401f7f){return _[_0x0e67('0x97')](_0x23aff5,_0x401f7f);});if(_0x48da21){return _0x1837b8['id'];}}}));}}return BPromise[_0x0e67('0x98')](_0x279c0f)[_0x0e67('0x2d')](function(_0x24e7b7){_0x226f55=_(_0x226f55)[_0x0e67('0x99')](_0x24e7b7)['compact']()[_0x0e67('0x35')]();return db['VoiceQueue'][_0x0e67('0x36')]({'where':{'id':_0x38f5fa[_0x0e67('0x55')]['id']}})['then'](function(_0x5bf1ec){return db[_0x0e67('0x93')][_0x0e67('0x7f')](function(_0x9775a9){return _0x5bf1ec[_0x0e67('0x89')](_0x38f5fa['query'][_0x0e67('0x9a')],{'transaction':_0x9775a9})['then'](function(){if(!_[_0x0e67('0x9b')](_0x226f55)){return _0x5bf1ec[_0x0e67('0x9c')](_0x226f55,{'transaction':_0x9775a9})[_0x0e67('0x2d')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x38f5fa['params']['id'],'UserId':_0x226f55},'transaction':_0x9775a9});});}})['then'](function(){_0x226f55['forEach'](function(_0x45977e){socket['emit'](_0x0e67('0x9d'),{'UserId':_0x45977e,'VoiceQueueId':_0x5bf1ec['id']});});});});});});})[_0x0e67('0x2d')](respondWithStatusCode(_0x5430a2,null))['catch'](handleError(_0x5430a2,null));};exports[_0x0e67('0x9e')]=function(_0xe4ca0b,_0x4c938b,_0x2752d4){var _0xbd387e,_0xd783c6;return db['VoiceQueue'][_0x0e67('0x36')]({'where':{'id':_0xe4ca0b['params']['id']}})['then'](handleEntityNotFound(_0x4c938b,null))['then'](function(_0x1f642){if(_0x1f642){_0xd783c6=_0x1f642;return _0x1f642[_0x0e67('0x9e')](_0xe4ca0b[_0x0e67('0x58')][_0x0e67('0x9a')],_[_0x0e67('0x63')](_0xe4ca0b['body'],['ids','id'])||{})['spread'](function(_0x4bc417){for(var _0x554e8e=0x0;_0x554e8e<_0xe4ca0b[_0x0e67('0x58')][_0x0e67('0x9a')][_0x0e67('0x49')];_0x554e8e+=0x1){socket[_0x0e67('0x87')](_0x0e67('0x88'),{'UserId':Number(_0xe4ca0b[_0x0e67('0x58')]['ids'][_0x554e8e]),'VoiceQueueId':Number(_0xe4ca0b['params']['id'])});}return _0x4bc417;});}})['then'](function(_0x2d1c21){_0xbd387e=_0x2d1c21||[];if(_0xd783c6){return db[_0x0e67('0x77')][_0x0e67('0x6f')]({'where':{'id':_0xe4ca0b[_0x0e67('0x58')][_0x0e67('0x9a')]},'attributes':['id','name',_0x0e67('0x79'),'voicePause',_0x0e67('0x7b')],'raw':!![]});}})[_0x0e67('0x2d')](function(_0xb0fd3){if(!_[_0x0e67('0x9b')](_0xb0fd3)){var _0x1fcb03=[];for(var _0x4da9de=0x0;_0x4da9de<_0xb0fd3[_0x0e67('0x49')];_0x4da9de++){if(_0xb0fd3[_0x4da9de][_0x0e67('0x79')]){_0x1fcb03[_0x0e67('0x92')](db[_0x0e67('0x84')]['upsert']({'membername':_0xb0fd3[_0x4da9de]['name'],'UserId':_0xb0fd3[_0x4da9de]['id'],'queue_name':_0xd783c6['name'],'VoiceQueueId':_0xd783c6['id'],'interface':_[_0x0e67('0x85')](_0xb0fd3[_0x4da9de][_0x0e67('0x7b')])?util['format'](_0x0e67('0x9f'),_0xb0fd3[_0x4da9de][_0x0e67('0x3b')]):_0xb0fd3[_0x4da9de][_0x0e67('0x7b')],'paused':_0xb0fd3[_0x4da9de][_0x0e67('0x7a')]||![],'penalty':_0xe4ca0b[_0x0e67('0x58')][_0x0e67('0x7e')]||0x0}));}}return BPromise[_0x0e67('0x98')](_0x1fcb03);}})[_0x0e67('0x2d')](function(){return _0xbd387e;})[_0x0e67('0x2d')](respondWithResult(_0x4c938b,null))[_0x0e67('0x53')](handleError(_0x4c938b,null));};exports[_0x0e67('0x9c')]=function(_0x22246f,_0xd363bb,_0x3a773b){return db['VoiceQueue'][_0x0e67('0x36')]({'where':{'id':_0x22246f['params']['id']}})['then'](handleEntityNotFound(_0xd363bb,null))['then'](function(_0x3dca62){if(_0x3dca62){return _0x3dca62[_0x0e67('0x9c')](_0x22246f['query'][_0x0e67('0x9a')])[_0x0e67('0x2d')](function(){if(_[_0x0e67('0xa0')](_0x22246f[_0x0e67('0x42')]['ids'])){for(var _0x5e5036=0x0;_0x5e5036<_0x22246f[_0x0e67('0x42')][_0x0e67('0x9a')][_0x0e67('0x49')];_0x5e5036+=0x1){socket[_0x0e67('0x87')](_0x0e67('0x9d'),{'UserId':Number(_0x22246f['query'][_0x0e67('0x9a')][_0x5e5036]),'VoiceQueueId':Number(_0x22246f['params']['id'])});}}else{socket[_0x0e67('0x87')]('userVoiceQueue:remove',{'UserId':Number(_0x22246f[_0x0e67('0x42')][_0x0e67('0x9a')]),'VoiceQueueId':Number(_0x22246f['params']['id'])});}});}})[_0x0e67('0x2d')](function(_0x459201){return db[_0x0e67('0x84')][_0x0e67('0x2e')]({'where':{'VoiceQueueId':_0x22246f[_0x0e67('0x55')]['id'],'UserId':_0x22246f[_0x0e67('0x42')][_0x0e67('0x9a')]}})[_0x0e67('0x2d')](function(){return _0x459201;});})[_0x0e67('0x2d')](respondWithStatusCode(_0xd363bb,null))[_0x0e67('0x53')](handleError(_0xd363bb,null));};exports[_0x0e67('0xa1')]=function(_0x36f0de,_0x454ea9,_0x58c0ca){var _0x25231d={};var _0x3369e5={};var _0x52f469;var _0x4dc3e3;return db[_0x0e67('0x3e')][_0x0e67('0x68')]({'where':{'id':_0x36f0de[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x454ea9,null))[_0x0e67('0x2d')](function(_0x85bf45){if(_0x85bf45){_0x52f469=_0x85bf45;_0x3369e5['model']=_['keys'](db['User'][_0x0e67('0x3f')]);_0x3369e5[_0x0e67('0x42')]=_['keys'](_0x36f0de['query']);_0x3369e5[_0x0e67('0x44')]=_[_0x0e67('0x47')](_0x3369e5[_0x0e67('0x45')],_0x3369e5[_0x0e67('0x42')]);_0x25231d[_0x0e67('0x46')]=_[_0x0e67('0x47')](_0x3369e5['model'],qs[_0x0e67('0x48')](_0x36f0de[_0x0e67('0x42')]['fields']));_0x25231d[_0x0e67('0x46')]=_0x25231d[_0x0e67('0x46')][_0x0e67('0x49')]?_0x25231d[_0x0e67('0x46')]:_0x3369e5[_0x0e67('0x45')];_0x25231d[_0x0e67('0x6a')]=qs['sort'](_0x36f0de[_0x0e67('0x42')]['sort']);_0x25231d['where']=qs['filters'](_[_0x0e67('0x4d')](_0x36f0de[_0x0e67('0x42')],_0x3369e5[_0x0e67('0x44')]));if(_0x36f0de[_0x0e67('0x42')][_0x0e67('0x32')]){_0x25231d[_0x0e67('0x4c')]=_[_0x0e67('0x4e')](_0x25231d[_0x0e67('0x4c')],{'$or':_['map'](_0x25231d[_0x0e67('0x46')],function(_0x8f143d){var _0x1d6566={};_0x1d6566[_0x8f143d]={'$like':'%'+_0x36f0de[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x1d6566;})});}_0x25231d=_[_0x0e67('0x4e')]({},_0x25231d,_0x36f0de[_0x0e67('0x50')]);return _0x52f469[_0x0e67('0xa1')](_0x25231d);}})[_0x0e67('0x2d')](function(_0x22f3cd){if(_0x22f3cd){_0x4dc3e3=_0x22f3cd[_0x0e67('0x49')];if(!_0x36f0de[_0x0e67('0x42')][_0x0e67('0x4a')](_0x0e67('0x69'))){_0x25231d[_0x0e67('0x27')]=qs[_0x0e67('0x27')](_0x36f0de[_0x0e67('0x42')]['limit']);_0x25231d[_0x0e67('0x25')]=qs[_0x0e67('0x25')](_0x36f0de[_0x0e67('0x42')][_0x0e67('0x25')]);}return _0x52f469['getAgents'](_0x25231d);}})[_0x0e67('0x2d')](function(_0x24cc83){if(_0x24cc83){return _0x24cc83?{'count':_0x4dc3e3,'rows':_0x24cc83}:null;}})[_0x0e67('0x2d')](respondWithResult(_0x454ea9,null))[_0x0e67('0x53')](handleError(_0x454ea9,null));};exports[_0x0e67('0xa2')]=function(_0x5aa5dc,_0xd6d72a,_0x254ec9){var _0x1fb4ab={};var _0xe6121e={};var _0x4cd0e9;var _0x367110;return db[_0x0e67('0x3e')]['findOne']({'where':{'id':_0x5aa5dc[_0x0e67('0x55')]['id']}})['then'](handleEntityNotFound(_0xd6d72a,null))[_0x0e67('0x2d')](function(_0x37af9a){if(_0x37af9a){_0x4cd0e9=_0x37af9a;_0xe6121e[_0x0e67('0x45')]=_['keys'](db[_0x0e67('0x84')][_0x0e67('0x3f')]);_0xe6121e[_0x0e67('0x42')]=_['keys'](_0x5aa5dc[_0x0e67('0x42')]);_0xe6121e[_0x0e67('0x44')]=_['intersection'](_0xe6121e['model'],_0xe6121e[_0x0e67('0x42')]);_0x1fb4ab['attributes']=_[_0x0e67('0x47')](_0xe6121e['model'],qs[_0x0e67('0x48')](_0x5aa5dc['query'][_0x0e67('0x48')]));_0x1fb4ab['attributes']=_0x1fb4ab['attributes'][_0x0e67('0x49')]?_0x1fb4ab[_0x0e67('0x46')]:_0xe6121e[_0x0e67('0x45')];_0x1fb4ab[_0x0e67('0x6a')]=qs[_0x0e67('0x4b')](_0x5aa5dc['query'][_0x0e67('0x4b')]);_0x1fb4ab[_0x0e67('0x4c')]=qs['filters'](_[_0x0e67('0x4d')](_0x5aa5dc['query'],_0xe6121e[_0x0e67('0x44')]));if(_0x5aa5dc[_0x0e67('0x42')][_0x0e67('0x32')]){_0x1fb4ab[_0x0e67('0x4c')]=_['merge'](_0x1fb4ab[_0x0e67('0x4c')],{'$or':_[_0x0e67('0x34')](_0x1fb4ab[_0x0e67('0x46')],function(_0x5e449c){var _0x242679={};_0x242679[_0x5e449c]={'$like':'%'+_0x5aa5dc[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x242679;})});}_0x1fb4ab=_['merge']({},_0x1fb4ab,_0x5aa5dc['options']);return _0x4cd0e9[_0x0e67('0xa2')](_0x1fb4ab);}})[_0x0e67('0x2d')](function(_0xfddf1a){if(_0xfddf1a){_0x367110=_0xfddf1a[_0x0e67('0x49')];if(!_0x5aa5dc[_0x0e67('0x42')][_0x0e67('0x4a')](_0x0e67('0x69'))){_0x1fb4ab[_0x0e67('0x27')]=qs[_0x0e67('0x27')](_0x5aa5dc['query']['limit']);_0x1fb4ab[_0x0e67('0x25')]=qs[_0x0e67('0x25')](_0x5aa5dc[_0x0e67('0x42')][_0x0e67('0x25')]);}return _0x4cd0e9[_0x0e67('0xa2')](_0x1fb4ab);}})[_0x0e67('0x2d')](function(_0x1f2859){return _0x1f2859?{'count':_0x367110,'rows':_0x1f2859}:null;})[_0x0e67('0x2d')](respondWithResult(_0xd6d72a,null))[_0x0e67('0x53')](handleError(_0xd6d72a,null));};exports[_0x0e67('0xa3')]=function(_0x2d1b29,_0x5653be,_0xadf313){var _0x244565={};var _0x117446={};var _0x2501cd;var _0x2d560c;return db['VoiceQueue'][_0x0e67('0x68')]({'where':{'id':_0x2d1b29[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x5653be,null))[_0x0e67('0x2d')](function(_0x36bfd3){if(_0x36bfd3){_0x2501cd=_0x36bfd3;_0x117446['model']=_[_0x0e67('0x43')](db[_0x0e67('0xa4')][_0x0e67('0x3f')]);_0x117446[_0x0e67('0x42')]=_[_0x0e67('0x43')](_0x2d1b29['query']);_0x117446[_0x0e67('0x44')]=_[_0x0e67('0x47')](_0x117446[_0x0e67('0x45')],_0x117446['query']);_0x244565[_0x0e67('0x46')]=_[_0x0e67('0x47')](_0x117446[_0x0e67('0x45')],qs[_0x0e67('0x48')](_0x2d1b29[_0x0e67('0x42')]['fields']));_0x244565[_0x0e67('0x46')]=_0x244565['attributes']['length']?_0x244565[_0x0e67('0x46')]:_0x117446[_0x0e67('0x45')];_0x244565[_0x0e67('0x6a')]=qs[_0x0e67('0x4b')](_0x2d1b29[_0x0e67('0x42')]['sort']);_0x244565['where']=qs[_0x0e67('0x44')](_[_0x0e67('0x4d')](_0x2d1b29['query'],_0x117446[_0x0e67('0x44')]));if(_0x2d1b29[_0x0e67('0x42')][_0x0e67('0x32')]){_0x244565['where']=_[_0x0e67('0x4e')](_0x244565[_0x0e67('0x4c')],{'$or':_['map'](_0x244565[_0x0e67('0x46')],function(_0x483d48){var _0x2f5176={};_0x2f5176[_0x483d48]={'$like':'%'+_0x2d1b29[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x2f5176;})});}_0x244565=_['merge']({},_0x244565,_0x2d1b29[_0x0e67('0x50')]);return _0x2501cd[_0x0e67('0xa3')](_0x244565);}})[_0x0e67('0x2d')](function(_0x2cbc33){if(_0x2cbc33){_0x2d560c=_0x2cbc33[_0x0e67('0x49')];if(!_0x2d1b29[_0x0e67('0x42')][_0x0e67('0x4a')](_0x0e67('0x69'))){_0x244565[_0x0e67('0x27')]=qs['limit'](_0x2d1b29[_0x0e67('0x42')]['limit']);_0x244565['offset']=qs[_0x0e67('0x25')](_0x2d1b29['query'][_0x0e67('0x25')]);}return _0x2501cd['getLists'](_0x244565);}})[_0x0e67('0x2d')](function(_0x527ad0){if(_0x527ad0){return _0x527ad0?{'count':_0x2d560c,'rows':_0x527ad0}:null;}})['then'](respondWithResult(_0x5653be,null))[_0x0e67('0x53')](handleError(_0x5653be,null));};exports[_0x0e67('0xa5')]=function(_0x512da2,_0x4ef9ea,_0x54f466){var _0x99a518,_0x55722b;return db['VoiceQueue'][_0x0e67('0x36')]({'where':{'id':_0x512da2[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x4ef9ea,null))[_0x0e67('0x2d')](function(_0x32b683){if(_0x32b683){_0x55722b=_0x32b683;return _0x32b683[_0x0e67('0xa5')](_0x512da2[_0x0e67('0x58')]['ids'],_['omit'](_0x512da2[_0x0e67('0x58')],[_0x0e67('0x9a'),'id'])||{});}return null;})[_0x0e67('0xa6')](function(_0x516a60){var _0xb823f1;_0x99a518=_0x516a60||[];var _0x40e8b9=[];if(_0x516a60){for(var _0x4a27b2=0x0;_0x4a27b2<_0x516a60[_0x0e67('0x49')];_0x4a27b2+=0x1){var _0x3c472b=_0x516a60[_0x4a27b2][_0x0e67('0x2f')]({'plain':!![]});_0x55722b['dialCheckDuplicateType']=_0x512da2['body'][_0x0e67('0xa7')]?_0x512da2[_0x0e67('0x58')][_0x0e67('0xa7')]:_0x55722b[_0x0e67('0xa7')];switch(_0x55722b[_0x0e67('0xa7')]){case _0x0e67('0xa8'):_0xb823f1=squel[_0x0e67('0xa9')]()['into'](_0x0e67('0xaa'))[_0x0e67('0xab')]([_0x0e67('0xac'),_0x0e67('0xad'),_0x0e67('0xae'),_0x0e67('0xaf'),'VoiceQueueId',_0x0e67('0x65'),_0x0e67('0x64')],squel[_0x0e67('0x8a')]()[_0x0e67('0x8b')](_0x0e67('0xac'),_0x0e67('0xac'))[_0x0e67('0x8b')](_0x0e67('0xb0'),_0x0e67('0xad'))[_0x0e67('0x8b')]('id',_0x0e67('0xae'))[_0x0e67('0x8b')](_0x3c472b[_0x0e67('0xb1')][_0x0e67('0xb2')](),'ListId')[_0x0e67('0x8b')](_0x512da2[_0x0e67('0x55')]['id'][_0x0e67('0xb2')](),'VoiceQueueId')[_0x0e67('0x8b')]('NOW()',_0x0e67('0x65'))[_0x0e67('0x8b')](_0x0e67('0xb0'),_0x0e67('0x64'))['from'](_0x0e67('0xb3'))[_0x0e67('0x4c')](_0x0e67('0xb4'))[_0x0e67('0x4c')]('ListId\x20=\x20?',_0x3c472b[_0x0e67('0xb1')]['toString']())[_0x0e67('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x0e67('0x4c')](_0x0e67('0xb5'),squel[_0x0e67('0x8a')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x0e67('0x8d')](_0x0e67('0xb6'))[_0x0e67('0x4c')](_0x0e67('0x90'),_0x512da2[_0x0e67('0x55')]['id'][_0x0e67('0xb2')]()))[_0x0e67('0x4c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0e67('0x8a')]()[_0x0e67('0x8b')](_0x0e67('0xb7'))['from'](_0x0e67('0xaa'))[_0x0e67('0x4c')]('VoiceQueueId\x20=\x20?',_0x512da2[_0x0e67('0x55')]['id'][_0x0e67('0xb2')]())))['toString']();break;case'onlyIfOpen':_0xb823f1=squel[_0x0e67('0xa9')]()['into'](_0x0e67('0xaa'))[_0x0e67('0xab')](['phone',_0x0e67('0xad'),_0x0e67('0xae'),_0x0e67('0xaf'),_0x0e67('0x6b'),_0x0e67('0x65'),_0x0e67('0x64')],squel[_0x0e67('0x8a')]()[_0x0e67('0x8b')]('phone',_0x0e67('0xac'))[_0x0e67('0x8b')](_0x0e67('0xb0'),_0x0e67('0xad'))[_0x0e67('0x8b')]('id','ContactId')[_0x0e67('0x8b')](_0x3c472b[_0x0e67('0xb1')][_0x0e67('0xb2')](),_0x0e67('0xaf'))[_0x0e67('0x8b')](_0x512da2['params']['id']['toString'](),_0x0e67('0x6b'))[_0x0e67('0x8b')](_0x0e67('0xb0'),_0x0e67('0x65'))[_0x0e67('0x8b')](_0x0e67('0xb0'),'updatedAt')['from']('cm_contacts')[_0x0e67('0x4c')](_0x0e67('0xb4'))[_0x0e67('0x4c')](_0x0e67('0xb8'),_0x3c472b[_0x0e67('0xb1')][_0x0e67('0xb2')]())[_0x0e67('0x4c')](_0x0e67('0xb9'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0e67('0x8a')]()[_0x0e67('0x8b')](_0x0e67('0xb7'))['from'](_0x0e67('0xaa'))[_0x0e67('0x4c')]('VoiceQueueId\x20=\x20?',_0x512da2[_0x0e67('0x55')]['id']['toString']())))['toString']();break;default:_0xb823f1=squel[_0x0e67('0xa9')]()[_0x0e67('0xba')](_0x0e67('0xaa'))[_0x0e67('0xab')]([_0x0e67('0xac'),_0x0e67('0xad'),'ContactId',_0x0e67('0xaf'),_0x0e67('0x6b'),_0x0e67('0x65'),_0x0e67('0x64')],squel[_0x0e67('0x8a')]()[_0x0e67('0x8b')]('phone','phone')['field']('NOW()',_0x0e67('0xad'))[_0x0e67('0x8b')]('id',_0x0e67('0xae'))[_0x0e67('0x8b')](_0x3c472b[_0x0e67('0xb1')]['toString'](),_0x0e67('0xaf'))['field'](_0x512da2['params']['id'][_0x0e67('0xb2')](),_0x0e67('0x6b'))[_0x0e67('0x8b')](_0x0e67('0xb0'),_0x0e67('0x65'))[_0x0e67('0x8b')]('NOW()',_0x0e67('0x64'))['from'](_0x0e67('0xb3'))[_0x0e67('0x4c')](_0x0e67('0xb4'))[_0x0e67('0x4c')](_0x0e67('0xb8'),_0x3c472b[_0x0e67('0xb1')][_0x0e67('0xb2')]())[_0x0e67('0x4c')](_0x0e67('0xb9')))['toString']();}_0x40e8b9[_0x0e67('0x92')](db[_0x0e67('0x93')][_0x0e67('0x42')](_0xb823f1));}return BPromise[_0x0e67('0x98')](_0x40e8b9);}})[_0x0e67('0x2d')](function(){return _0x99a518;})[_0x0e67('0x2d')](respondWithResult(_0x4ef9ea,null))[_0x0e67('0x53')](handleError(_0x4ef9ea,null));};exports[_0x0e67('0xbb')]=function(_0x14f743,_0x2ee267,_0x244bf0){return db[_0x0e67('0x3e')][_0x0e67('0x36')]({'where':{'id':_0x14f743[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x2ee267,null))[_0x0e67('0x2d')](function(_0xa1e3ce){if(_0xa1e3ce){return _0xa1e3ce[_0x0e67('0xbb')](_0x14f743[_0x0e67('0x42')][_0x0e67('0x9a')]);}})[_0x0e67('0x2d')](function(_0x1a201a){if(_0x1a201a){return db[_0x0e67('0x6c')]['destroy']({'where':{'ListId':_0x14f743[_0x0e67('0x42')][_0x0e67('0x9a')],'VoiceQueueId':_0x14f743[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](function(){return _0x1a201a;});}})[_0x0e67('0x2d')](respondWithStatusCode(_0x2ee267,null))[_0x0e67('0x53')](handleError(_0x2ee267,null));};exports[_0x0e67('0xbc')]=function(_0x46d36a,_0x9aa7d0,_0x2f062f){var _0x2e5272={};var _0x429f0e={};var _0x57daa5;var _0x345ede;return db[_0x0e67('0x3e')][_0x0e67('0x68')]({'where':{'id':_0x46d36a[_0x0e67('0x55')]['id']}})['then'](handleEntityNotFound(_0x9aa7d0,null))[_0x0e67('0x2d')](function(_0x80814c){if(_0x80814c){_0x57daa5=_0x80814c;_0x429f0e['model']=_[_0x0e67('0x43')](db[_0x0e67('0xa4')][_0x0e67('0x3f')]);_0x429f0e[_0x0e67('0x42')]=_[_0x0e67('0x43')](_0x46d36a[_0x0e67('0x42')]);_0x429f0e[_0x0e67('0x44')]=_['intersection'](_0x429f0e[_0x0e67('0x45')],_0x429f0e['query']);_0x2e5272['attributes']=_[_0x0e67('0x47')](_0x429f0e['model'],qs['fields'](_0x46d36a[_0x0e67('0x42')][_0x0e67('0x48')]));_0x2e5272['attributes']=_0x2e5272[_0x0e67('0x46')][_0x0e67('0x49')]?_0x2e5272[_0x0e67('0x46')]:_0x429f0e[_0x0e67('0x45')];_0x2e5272[_0x0e67('0x6a')]=qs[_0x0e67('0x4b')](_0x46d36a[_0x0e67('0x42')]['sort']);_0x2e5272[_0x0e67('0x4c')]=qs[_0x0e67('0x44')](_[_0x0e67('0x4d')](_0x46d36a[_0x0e67('0x42')],_0x429f0e[_0x0e67('0x44')]));if(_0x46d36a[_0x0e67('0x42')][_0x0e67('0x32')]){_0x2e5272[_0x0e67('0x4c')]=_['merge'](_0x2e5272[_0x0e67('0x4c')],{'$or':_[_0x0e67('0x34')](_0x2e5272['attributes'],function(_0x307850){var _0x494430={};_0x494430[_0x307850]={'$like':'%'+_0x46d36a[_0x0e67('0x42')][_0x0e67('0x32')]+'%'};return _0x494430;})});}_0x2e5272=_['merge']({},_0x2e5272,_0x46d36a[_0x0e67('0x50')]);return _0x57daa5[_0x0e67('0xbc')](_0x2e5272);}})[_0x0e67('0x2d')](function(_0x504c6a){if(_0x504c6a){_0x345ede=_0x504c6a[_0x0e67('0x49')];if(!_0x46d36a[_0x0e67('0x42')][_0x0e67('0x4a')]('nolimit')){_0x2e5272[_0x0e67('0x27')]=qs['limit'](_0x46d36a[_0x0e67('0x42')][_0x0e67('0x27')]);_0x2e5272[_0x0e67('0x25')]=qs[_0x0e67('0x25')](_0x46d36a['query'][_0x0e67('0x25')]);}return _0x57daa5['getBlackLists'](_0x2e5272);}})[_0x0e67('0x2d')](function(_0x5eae17){if(_0x5eae17){return _0x5eae17?{'count':_0x345ede,'rows':_0x5eae17}:null;}})[_0x0e67('0x2d')](respondWithResult(_0x9aa7d0,null))['catch'](handleError(_0x9aa7d0,null));};exports[_0x0e67('0xbd')]=function(_0x5252f4,_0x563654,_0xfecd7){var _0x5ed836,_0x3ada82;return db['VoiceQueue'][_0x0e67('0x36')]({'where':{'id':_0x5252f4['params']['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x563654,null))[_0x0e67('0x2d')](function(_0x4e6bae){if(_0x4e6bae){_0x3ada82=_0x4e6bae;return _0x4e6bae[_0x0e67('0xbd')](_0x5252f4[_0x0e67('0x58')][_0x0e67('0x9a')],_[_0x0e67('0x63')](_0x5252f4[_0x0e67('0x58')],[_0x0e67('0x9a'),'id'])||{});}return null;})['spread'](function(_0x4efdff){var _0x12f5fa;_0x5ed836=_0x4efdff||[];var _0x5e7022=[];if(_0x4efdff){for(var _0x5c74ce=0x0;_0x5c74ce<_0x4efdff['length'];_0x5c74ce+=0x1){var _0x9bdf57=_0x4efdff[_0x5c74ce]['get']({'plain':!![]});_0x12f5fa=squel[_0x0e67('0xa9')]()[_0x0e67('0xba')](_0x0e67('0xbe'))[_0x0e67('0xab')](['phone','ContactId','ListId',_0x0e67('0x6b'),'createdAt',_0x0e67('0x64')],squel['select']()[_0x0e67('0x8b')](_0x0e67('0xac'),'phone')['field']('id','ContactId')[_0x0e67('0x8b')](_0x9bdf57[_0x0e67('0xb1')][_0x0e67('0xb2')](),'ListId')[_0x0e67('0x8b')](_0x5252f4[_0x0e67('0x55')]['id'][_0x0e67('0xb2')](),'VoiceQueueId')[_0x0e67('0x8b')](_0x0e67('0xb0'),_0x0e67('0x65'))[_0x0e67('0x8b')](_0x0e67('0xb0'),_0x0e67('0x64'))['from'](_0x0e67('0xb3'))[_0x0e67('0x4c')]('deletedAt\x20IS\x20NULL')[_0x0e67('0x4c')](_0x0e67('0xb8'),_0x9bdf57[_0x0e67('0xb1')]['toString']())['where'](_0x0e67('0xb9')))[_0x0e67('0xb2')]();_0x5e7022['push'](db[_0x0e67('0x93')]['query'](_0x12f5fa));}return BPromise[_0x0e67('0x98')](_0x5e7022);}})['then'](function(){return _0x5ed836;})[_0x0e67('0x2d')](respondWithResult(_0x563654,null))['catch'](handleError(_0x563654,null));};exports[_0x0e67('0xbf')]=function(_0x5cc48f,_0x80395b,_0x463291){return db[_0x0e67('0x3e')]['find']({'where':{'id':_0x5cc48f[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](handleEntityNotFound(_0x80395b,null))[_0x0e67('0x2d')](function(_0xea75df){if(_0xea75df){return _0xea75df[_0x0e67('0xbf')](_0x5cc48f[_0x0e67('0x42')]['ids']);}})[_0x0e67('0x2d')](function(_0x83e88a){if(_0x83e88a){return db['CmHopperBlack'][_0x0e67('0x2e')]({'where':{'ListId':_0x5cc48f[_0x0e67('0x42')]['ids'],'VoiceQueueId':_0x5cc48f[_0x0e67('0x55')]['id']}})[_0x0e67('0x2d')](function(){return _0x83e88a;});}})['then'](respondWithStatusCode(_0x80395b,null))[_0x0e67('0x53')](handleError(_0x80395b,null));}; \ No newline at end of file +var _0xb880=['sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','createdAt','updatedAt','role','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','VoiceQueueId','getHopperHistories','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','interface','Agents','forEach','penalty','transaction','TeamVoiceQueue','upsert','each','findOrCreate','UserVoiceQueueRt','SIP/%s','voicePause','ids','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','every','TeamId','all','union','compact','removeTeams','emit','addAgents','spread','isEmpty','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','removeLists','getBlackLists','addBlackLists','omit','cm_hopper_black','removeBlackLists','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','get','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','name','error','stack','send','VoiceQueue','fieldName','key','model','query','keys','attributes','intersection','fields','length','order'];(function(_0x40ec84,_0x25f950){var _0x3c230c=function(_0x46f6b7){while(--_0x46f6b7){_0x40ec84['push'](_0x40ec84['shift']());}};_0x3c230c(++_0x25f950);}(_0xb880,0x1e3));var _0x0b88=function(_0x529ef2,_0x531331){_0x529ef2=_0x529ef2-0x0;var _0x4da2f7=_0xb880[_0x529ef2];return _0x4da2f7;};'use strict';var emlformat=require(_0x0b88('0x0'));var rimraf=require(_0x0b88('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0b88('0x2'));var rp=require(_0x0b88('0x3'));var moment=require('moment');var BPromise=require(_0x0b88('0x4'));var Mustache=require(_0x0b88('0x5'));var util=require(_0x0b88('0x6'));var path=require(_0x0b88('0x7'));var sox=require('sox');var csv=require(_0x0b88('0x8'));var ejs=require(_0x0b88('0x9'));var fs=require('fs');var fs_extra=require(_0x0b88('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0b88('0xb'));var deskjs=require(_0x0b88('0xc'));var toCsv=require(_0x0b88('0x8'));var querystring=require(_0x0b88('0xd'));var Papa=require(_0x0b88('0xe'));var Redis=require(_0x0b88('0xf'));var authService=require(_0x0b88('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0b88('0x11'));var hardwareService=require(_0x0b88('0x12'));var logger=require(_0x0b88('0x13'))(_0x0b88('0x14'));var utils=require('../../config/utils');var config=require(_0x0b88('0x15'));var licenseUtil=require(_0x0b88('0x16'));var db=require(_0x0b88('0x17'))['db'];config[_0x0b88('0x18')]=_[_0x0b88('0x19')](config['redis'],{'host':_0x0b88('0x1a'),'port':0x18eb});var socket=require(_0x0b88('0x1b'))(new Redis(config['redis']));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x2eafba,_0x4305fa){_0x4305fa=_0x4305fa||0xcc;return function(_0x4bb744){if(_0x4bb744){return _0x2eafba[_0x0b88('0x1c')](_0x4305fa);}return _0x2eafba[_0x0b88('0x1d')](_0x4305fa)[_0x0b88('0x1e')]();};}function respondWithResult(_0x557a07,_0x427d35){_0x427d35=_0x427d35||0xc8;return function(_0x477362){if(_0x477362){return _0x557a07['status'](_0x427d35)[_0x0b88('0x1f')](_0x477362);}};}function respondWithFilteredResult(_0xff19f0,_0x534a5c){return function(_0x216e8a){if(_0x216e8a){var _0x4760de=typeof _0x534a5c[_0x0b88('0x20')]===_0x0b88('0x21')&&typeof _0x534a5c['limit']==='undefined';var _0x5c2219=_0x216e8a[_0x0b88('0x22')];var _0x1baf7f=_0x4760de?0x0:_0x534a5c['offset'];var _0x558391=_0x4760de?_0x216e8a[_0x0b88('0x22')]:_0x534a5c['offset']+_0x534a5c[_0x0b88('0x23')];var _0x6a4c0d;if(_0x558391>=_0x5c2219){_0x558391=_0x5c2219;_0x6a4c0d=0xc8;}else{_0x6a4c0d=0xce;}_0xff19f0[_0x0b88('0x1d')](_0x6a4c0d);return _0xff19f0['set'](_0x0b88('0x24'),_0x1baf7f+'-'+_0x558391+'/'+_0x5c2219)['json'](_0x216e8a);}return null;};}function patchUpdates(_0x1915fe){return function(_0x49607c){try{jsonpatch[_0x0b88('0x25')](_0x49607c,_0x1915fe,!![]);}catch(_0x195603){return BPromise[_0x0b88('0x26')](_0x195603);}return _0x49607c['save']();};}function saveUpdates(_0x2ed02b,_0x251f7b){return function(_0x5912cc){if(_0x5912cc){return _0x5912cc[_0x0b88('0x27')](_0x2ed02b)[_0x0b88('0x28')](function(_0x51c37b){return _0x51c37b;});}return null;};}function removeEntity(_0x15fabf,_0x74f3ab){return function(_0x8bbbe5){if(_0x8bbbe5){return _0x8bbbe5[_0x0b88('0x29')]()[_0x0b88('0x28')](function(){var _0x5656d2=_0x8bbbe5[_0x0b88('0x2a')]({'plain':!![]});var _0x470597=[{'name':'VoiceQueues','value':'inbound','ignore':![]},{'name':_0x0b88('0x2b'),'value':_0x0b88('0x2c'),'ignore':![]}];var _0x3930d1=_(_0x470597)[_0x0b88('0x2d')](_0x0b88('0x2e'))[_0x0b88('0x2f')](_0x0b88('0x30'))[_0x0b88('0x30')]();if(_[_0x0b88('0x31')](_0x3930d1,_0x5656d2[_0x0b88('0x32')])){return;}var _0x2f00d8=_['find'](_0x470597,['value',_0x5656d2['type']])[_0x0b88('0x33')];return db['UserProfileResource'][_0x0b88('0x29')]({'where':{'type':_0x2f00d8,'resourceId':_0x5656d2['id']}})[_0x0b88('0x28')](function(){return _0x8bbbe5;});})[_0x0b88('0x28')](function(){_0x15fabf[_0x0b88('0x1d')](0xcc)[_0x0b88('0x1e')]();});}};}function handleEntityNotFound(_0x360186,_0x361744){return function(_0x1cae15){if(!_0x1cae15){_0x360186['sendStatus'](0x194);}return _0x1cae15;};}function handleError(_0x4466cf,_0x26346a){_0x26346a=_0x26346a||0x1f4;return function(_0x9195cc){logger[_0x0b88('0x34')](_0x9195cc[_0x0b88('0x35')]);if(_0x9195cc[_0x0b88('0x33')]){delete _0x9195cc['name'];}_0x4466cf[_0x0b88('0x1d')](_0x26346a)[_0x0b88('0x36')](_0x9195cc);};}exports['index']=function(_0x2e3cb4,_0x4abd36){var _0x168043={},_0x4205aa={},_0x24c4ae={'count':0x0,'rows':[]};var _0x24166f=_[_0x0b88('0x2f')](db[_0x0b88('0x37')]['rawAttributes'],function(_0x58dec8){return{'name':_0x58dec8[_0x0b88('0x38')],'type':_0x58dec8['type'][_0x0b88('0x39')]};});_0x4205aa[_0x0b88('0x3a')]=_[_0x0b88('0x2f')](_0x24166f,_0x0b88('0x33'));_0x4205aa[_0x0b88('0x3b')]=_[_0x0b88('0x3c')](_0x2e3cb4['query']);_0x4205aa['filters']=_['intersection'](_0x4205aa[_0x0b88('0x3a')],_0x4205aa[_0x0b88('0x3b')]);_0x168043[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x4205aa[_0x0b88('0x3a')],qs[_0x0b88('0x3f')](_0x2e3cb4[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0x168043[_0x0b88('0x3d')]=_0x168043[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x168043[_0x0b88('0x3d')]:_0x4205aa[_0x0b88('0x3a')];if(!_0x2e3cb4[_0x0b88('0x3b')]['hasOwnProperty']('nolimit')){_0x168043[_0x0b88('0x23')]=qs[_0x0b88('0x23')](_0x2e3cb4['query'][_0x0b88('0x23')]);_0x168043[_0x0b88('0x20')]=qs[_0x0b88('0x20')](_0x2e3cb4['query'][_0x0b88('0x20')]);}_0x168043[_0x0b88('0x41')]=qs[_0x0b88('0x42')](_0x2e3cb4['query']['sort']);_0x168043[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_['pick'](_0x2e3cb4['query'],_0x4205aa[_0x0b88('0x44')]),_0x24166f);if(_0x2e3cb4[_0x0b88('0x3b')][_0x0b88('0x2d')]){_0x168043[_0x0b88('0x43')]=_[_0x0b88('0x45')](_0x168043[_0x0b88('0x43')],{'$or':_[_0x0b88('0x2f')](_0x24166f,function(_0x5f5c1b){if(_0x5f5c1b[_0x0b88('0x32')]!==_0x0b88('0x46')){var _0x9d2001={};_0x9d2001[_0x5f5c1b[_0x0b88('0x33')]]={'$like':'%'+_0x2e3cb4[_0x0b88('0x3b')][_0x0b88('0x2d')]+'%'};return _0x9d2001;}})});}_0x168043=_[_0x0b88('0x45')]({},_0x168043,_0x2e3cb4[_0x0b88('0x47')]);var _0x9e027b={'where':_0x168043[_0x0b88('0x43')]};return db[_0x0b88('0x37')]['count'](_0x9e027b)['then'](function(_0x509d65){_0x24c4ae[_0x0b88('0x22')]=_0x509d65;if(_0x2e3cb4[_0x0b88('0x3b')][_0x0b88('0x48')]){_0x168043[_0x0b88('0x49')]=[{'all':!![]}];}return db['VoiceQueue'][_0x0b88('0x4a')](_0x168043);})[_0x0b88('0x28')](function(_0x107e5e){_0x24c4ae[_0x0b88('0x4b')]=_0x107e5e;return _0x24c4ae;})['then'](respondWithFilteredResult(_0x4abd36,_0x168043))[_0x0b88('0x4c')](handleError(_0x4abd36,null));};exports[_0x0b88('0x4d')]=function(_0x101eb0,_0x33d985){var _0x3ec100={'raw':![],'where':{'id':_0x101eb0[_0x0b88('0x4e')]['id']}},_0x52a767={};_0x52a767[_0x0b88('0x3a')]=_['keys'](db[_0x0b88('0x37')]['rawAttributes']);_0x52a767[_0x0b88('0x3b')]=_[_0x0b88('0x3c')](_0x101eb0[_0x0b88('0x3b')]);_0x52a767['filters']=_[_0x0b88('0x3e')](_0x52a767[_0x0b88('0x3a')],_0x52a767[_0x0b88('0x3b')]);_0x3ec100[_0x0b88('0x3d')]=_['intersection'](_0x52a767['model'],qs['fields'](_0x101eb0[_0x0b88('0x3b')]['fields']));_0x3ec100['attributes']=_0x3ec100[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x3ec100[_0x0b88('0x3d')]:_0x52a767[_0x0b88('0x3a')];if(_0x101eb0[_0x0b88('0x3b')][_0x0b88('0x48')]){_0x3ec100[_0x0b88('0x49')]=[{'all':!![]}];}_0x3ec100=_['merge']({},_0x3ec100,_0x101eb0[_0x0b88('0x47')]);return db['VoiceQueue'][_0x0b88('0x4f')](_0x3ec100)[_0x0b88('0x28')](handleEntityNotFound(_0x33d985,null))[_0x0b88('0x28')](respondWithResult(_0x33d985,null))[_0x0b88('0x4c')](handleError(_0x33d985,null));};exports['create']=function(_0x1c833d,_0xd8e184){return db[_0x0b88('0x37')]['create'](_0x1c833d[_0x0b88('0x50')],{})[_0x0b88('0x28')](function(_0x2c07db){var _0x342f0a=_0x1c833d[_0x0b88('0x51')][_0x0b88('0x2a')]({'plain':!![]});if(!_0x342f0a)throw new Error(_0x0b88('0x52'));if(_0x342f0a['role']===_0x0b88('0x51')){var _0x47aa4a=_0x2c07db[_0x0b88('0x2a')]({'plain':!![]});var _0x510961=[{'name':_0x0b88('0x53'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x0b88('0x2c')}];var _0x1e1b5e=_[_0x0b88('0x4f')](_0x510961,[_0x0b88('0x30'),_0x47aa4a[_0x0b88('0x32')]])[_0x0b88('0x33')];return db[_0x0b88('0x54')]['find']({'where':{'name':_0x1e1b5e,'userProfileId':_0x342f0a[_0x0b88('0x55')]},'raw':!![]})[_0x0b88('0x28')](function(_0x4a7300){if(_0x4a7300&&_0x4a7300[_0x0b88('0x56')]===0x0){return db[_0x0b88('0x57')][_0x0b88('0x58')]({'name':_0x47aa4a['name'],'resourceId':_0x47aa4a['id'],'type':_0x4a7300[_0x0b88('0x33')],'sectionId':_0x4a7300['id']},{})[_0x0b88('0x28')](function(){return _0x2c07db;});}else{return _0x2c07db;}})[_0x0b88('0x4c')](function(_0x16c4c0){logger[_0x0b88('0x34')](_0x0b88('0x59'),_0x16c4c0);throw _0x16c4c0;});}return _0x2c07db;})[_0x0b88('0x28')](respondWithResult(_0xd8e184,0xc9))[_0x0b88('0x4c')](handleError(_0xd8e184,null));};exports[_0x0b88('0x5a')]=function(_0x4804c0,_0x11a05b){var _0x4c2605={'where':{'id':_0x4804c0[_0x0b88('0x4e')]['id']}},_0x6e61e3={};_0x6e61e3['model']=_['keys'](db['VoiceQueue'][_0x0b88('0x5b')]);_0x4c2605[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x6e61e3['model'],qs['fields'](_0x4804c0[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0x4c2605[_0x0b88('0x3d')]=_0x4c2605[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x4c2605[_0x0b88('0x3d')]:_0x6e61e3['model'];if(_0x4804c0['query'][_0x0b88('0x48')]){_0x4c2605[_0x0b88('0x49')]=[{'all':!![]}];}_0x4c2605=_[_0x0b88('0x45')]({},_0x4c2605,_0x4804c0['options']);return db[_0x0b88('0x37')][_0x0b88('0x4f')](_0x4c2605)[_0x0b88('0x28')](handleEntityNotFound(_0x11a05b,null))[_0x0b88('0x28')](function(_0x4ec3aa){if(_0x4ec3aa){var _0x4f67ad=_0x4ec3aa[_0x0b88('0x2a')]({'plain':!![]});_0x4f67ad=qs['omit'](_0x4f67ad,['id',_0x0b88('0x5c'),'updatedAt']);_0x4804c0[_0x0b88('0x50')]=_['omit'](_0x4804c0[_0x0b88('0x50')],['id','createdAt',_0x0b88('0x5d')]);return db[_0x0b88('0x37')][_0x0b88('0x58')](_[_0x0b88('0x45')](_0x4f67ad,_0x4804c0[_0x0b88('0x50')]),{'include':_0x4804c0[_0x0b88('0x3b')][_0x0b88('0x48')]?[{'all':!![]}]:undefined})['then'](function(_0x2cd8fa){var _0x212f93=_0x4804c0['user'][_0x0b88('0x2a')]({'plain':!![]});if(!_0x212f93)throw new Error(_0x0b88('0x52'));if(_0x212f93[_0x0b88('0x5e')]===_0x0b88('0x51')){var _0x38693a=_0x2cd8fa[_0x0b88('0x2a')]({'plain':!![]});var _0x4c0313=[{'name':_0x0b88('0x53'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x0b88('0x2c')}];var _0x17a349=_['find'](_0x4c0313,[_0x0b88('0x30'),_0x38693a[_0x0b88('0x32')]])[_0x0b88('0x33')];return db['UserProfileSection']['find']({'where':{'name':_0x17a349,'userProfileId':_0x212f93['userProfileId']},'raw':!![]})[_0x0b88('0x28')](function(_0x56391c){if(_0x56391c&&_0x56391c['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x38693a[_0x0b88('0x33')],'resourceId':_0x38693a['id'],'type':_0x56391c['name'],'sectionId':_0x56391c['id']},{})['then'](function(){return _0x2cd8fa;});}else{return _0x2cd8fa;}})['catch'](function(_0x130a6b){logger['error'](_0x0b88('0x59'),_0x130a6b);throw _0x130a6b;});}return _0x2cd8fa;});}})[_0x0b88('0x28')](respondWithResult(_0x11a05b,0xc9))[_0x0b88('0x4c')](handleError(_0x11a05b,null));};exports['update']=function(_0xca0f8f,_0x5aa555){if(_0xca0f8f[_0x0b88('0x50')]['id']){delete _0xca0f8f[_0x0b88('0x50')]['id'];}return db[_0x0b88('0x37')][_0x0b88('0x4f')]({'where':{'id':_0xca0f8f[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x5aa555,null))['then'](saveUpdates(_0xca0f8f[_0x0b88('0x50')],null))[_0x0b88('0x28')](respondWithResult(_0x5aa555,null))[_0x0b88('0x4c')](handleError(_0x5aa555,null));};exports[_0x0b88('0x29')]=function(_0x491dad,_0x5e57fe){return db[_0x0b88('0x37')][_0x0b88('0x4f')]({'where':{'id':_0x491dad[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x5e57fe,null))[_0x0b88('0x28')](removeEntity(_0x5e57fe,null))[_0x0b88('0x4c')](handleError(_0x5e57fe,null));};exports[_0x0b88('0x5f')]=function(_0x3d1171,_0x19506f,_0x217316){var _0x3e1237={'raw':![],'where':{}};var _0x5256de={};var _0x8d33c3={'count':0x0,'rows':[]};return db[_0x0b88('0x37')][_0x0b88('0x60')]({'where':{'id':_0x3d1171[_0x0b88('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19506f,null))[_0x0b88('0x28')](function(_0x8586b6){if(_0x8586b6){_0x5256de[_0x0b88('0x3a')]=_[_0x0b88('0x3c')](db[_0x0b88('0x61')][_0x0b88('0x5b')]);_0x5256de[_0x0b88('0x3b')]=_[_0x0b88('0x3c')](_0x3d1171[_0x0b88('0x3b')]);_0x5256de[_0x0b88('0x44')]=_[_0x0b88('0x3e')](_0x5256de[_0x0b88('0x3a')],_0x5256de[_0x0b88('0x3b')]);_0x3e1237[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x5256de[_0x0b88('0x3a')],qs[_0x0b88('0x3f')](_0x3d1171[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0x3e1237['attributes']=_0x3e1237[_0x0b88('0x3d')]['length']?_0x3e1237[_0x0b88('0x3d')]:_0x5256de[_0x0b88('0x3a')];if(!_0x3d1171[_0x0b88('0x3b')][_0x0b88('0x62')](_0x0b88('0x63'))){_0x3e1237[_0x0b88('0x23')]=qs[_0x0b88('0x23')](_0x3d1171['query'][_0x0b88('0x23')]);_0x3e1237['offset']=qs[_0x0b88('0x20')](_0x3d1171[_0x0b88('0x3b')][_0x0b88('0x20')]);}_0x3e1237[_0x0b88('0x41')]=qs[_0x0b88('0x42')](_0x3d1171[_0x0b88('0x3b')][_0x0b88('0x42')]);_0x3e1237[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_['pick'](_0x3d1171[_0x0b88('0x3b')],_0x5256de[_0x0b88('0x44')]));_0x3e1237[_0x0b88('0x43')][_0x0b88('0x64')]=_0x8586b6['id'];if(_0x3d1171[_0x0b88('0x3b')][_0x0b88('0x2d')]){_0x3e1237['where']=_['merge'](_0x3e1237[_0x0b88('0x43')],{'$or':_[_0x0b88('0x2f')](_0x3e1237['attributes'],function(_0x5f0840){var _0x4ddd6a={};_0x4ddd6a[_0x5f0840]={'$like':'%'+_0x3d1171[_0x0b88('0x3b')][_0x0b88('0x2d')]+'%'};return _0x4ddd6a;})});}_0x3e1237=_[_0x0b88('0x45')]({},_0x3e1237,_0x3d1171['options']);return db[_0x0b88('0x61')][_0x0b88('0x22')]({'where':_0x3e1237[_0x0b88('0x43')]})[_0x0b88('0x28')](function(_0x5a5ed7){_0x8d33c3['count']=_0x5a5ed7;if(_0x3d1171['query'][_0x0b88('0x48')]){_0x3e1237[_0x0b88('0x49')]=[{'all':!![]}];}return db[_0x0b88('0x61')][_0x0b88('0x4a')](_0x3e1237);})[_0x0b88('0x28')](function(_0x1f891d){_0x8d33c3[_0x0b88('0x4b')]=_0x1f891d;return _0x8d33c3;});}})[_0x0b88('0x28')](respondWithFilteredResult(_0x19506f,_0x3e1237))[_0x0b88('0x4c')](handleError(_0x19506f,null));};exports[_0x0b88('0x65')]=function(_0x18b5fb,_0x1001c8,_0x37f8b9){var _0x2d9209={'raw':!![],'where':{}};var _0x8fe9dc={};var _0x185c11={'count':0x0,'rows':[]};return db[_0x0b88('0x37')]['findOne']({'where':{'id':_0x18b5fb[_0x0b88('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1001c8,null))[_0x0b88('0x28')](function(_0x2226ce){if(_0x2226ce){_0x8fe9dc['model']=_[_0x0b88('0x3c')](db[_0x0b88('0x66')][_0x0b88('0x5b')]);_0x8fe9dc[_0x0b88('0x3b')]=_[_0x0b88('0x3c')](_0x18b5fb['query']);_0x8fe9dc[_0x0b88('0x44')]=_['intersection'](_0x8fe9dc['model'],_0x8fe9dc[_0x0b88('0x3b')]);_0x2d9209[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x8fe9dc[_0x0b88('0x3a')],qs[_0x0b88('0x3f')](_0x18b5fb[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0x2d9209[_0x0b88('0x3d')]=_0x2d9209[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x2d9209[_0x0b88('0x3d')]:_0x8fe9dc[_0x0b88('0x3a')];if(!_0x18b5fb[_0x0b88('0x3b')][_0x0b88('0x62')]('nolimit')){_0x2d9209['limit']=qs[_0x0b88('0x23')](_0x18b5fb[_0x0b88('0x3b')]['limit']);_0x2d9209[_0x0b88('0x20')]=qs[_0x0b88('0x20')](_0x18b5fb[_0x0b88('0x3b')]['offset']);}_0x2d9209['order']=qs[_0x0b88('0x42')](_0x18b5fb[_0x0b88('0x3b')][_0x0b88('0x42')]);_0x2d9209[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_[_0x0b88('0x67')](_0x18b5fb[_0x0b88('0x3b')],_0x8fe9dc[_0x0b88('0x44')]));_0x2d9209[_0x0b88('0x43')][_0x0b88('0x64')]=_0x2226ce['id'];if(_0x18b5fb[_0x0b88('0x3b')][_0x0b88('0x2d')]){_0x2d9209[_0x0b88('0x43')]=_['merge'](_0x2d9209[_0x0b88('0x43')],{'$or':_[_0x0b88('0x2f')](_0x2d9209['attributes'],function(_0x42e361){var _0x1227ac={};_0x1227ac[_0x42e361]={'$like':'%'+_0x18b5fb[_0x0b88('0x3b')]['filter']+'%'};return _0x1227ac;})});}_0x2d9209=_[_0x0b88('0x45')]({},_0x2d9209,_0x18b5fb[_0x0b88('0x47')]);return db[_0x0b88('0x66')]['count']({'where':_0x2d9209['where']})[_0x0b88('0x28')](function(_0x527c07){_0x185c11['count']=_0x527c07;if(_0x18b5fb[_0x0b88('0x3b')]['includeAll']){_0x2d9209[_0x0b88('0x49')]=[{'all':!![]}];}return db[_0x0b88('0x66')][_0x0b88('0x4a')](_0x2d9209);})['then'](function(_0x1d9b48){_0x185c11[_0x0b88('0x4b')]=_0x1d9b48;return _0x185c11;});}})['then'](respondWithFilteredResult(_0x1001c8,_0x2d9209))['catch'](handleError(_0x1001c8,null));};exports[_0x0b88('0x68')]=function(_0x396433,_0x5059ac,_0x420578){var _0x4c7472={'raw':!![],'where':{}};var _0x46f1b5={};var _0x54f824={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0b88('0x60')]({'where':{'id':_0x396433[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x5059ac,null))[_0x0b88('0x28')](function(_0x1a12b6){if(_0x1a12b6){_0x46f1b5[_0x0b88('0x3a')]=_[_0x0b88('0x3c')](db[_0x0b88('0x69')][_0x0b88('0x5b')]);_0x46f1b5[_0x0b88('0x3b')]=_[_0x0b88('0x3c')](_0x396433['query']);_0x46f1b5[_0x0b88('0x44')]=_['intersection'](_0x46f1b5['model'],_0x46f1b5[_0x0b88('0x3b')]);_0x4c7472[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x46f1b5[_0x0b88('0x3a')],qs[_0x0b88('0x3f')](_0x396433[_0x0b88('0x3b')]['fields']));_0x4c7472['attributes']=_0x4c7472[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x4c7472['attributes']:_0x46f1b5['model'];if(!_0x396433[_0x0b88('0x3b')][_0x0b88('0x62')](_0x0b88('0x63'))){_0x4c7472[_0x0b88('0x23')]=qs[_0x0b88('0x23')](_0x396433[_0x0b88('0x3b')][_0x0b88('0x23')]);_0x4c7472[_0x0b88('0x20')]=qs[_0x0b88('0x20')](_0x396433[_0x0b88('0x3b')][_0x0b88('0x20')]);}_0x4c7472['order']=qs[_0x0b88('0x42')](_0x396433[_0x0b88('0x3b')][_0x0b88('0x42')]);_0x4c7472[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_[_0x0b88('0x67')](_0x396433[_0x0b88('0x3b')],_0x46f1b5['filters']));_0x4c7472[_0x0b88('0x43')][_0x0b88('0x64')]=_0x1a12b6['id'];if(_0x396433[_0x0b88('0x3b')]['filter']){_0x4c7472[_0x0b88('0x43')]=_[_0x0b88('0x45')](_0x4c7472[_0x0b88('0x43')],{'$or':_[_0x0b88('0x2f')](_0x4c7472[_0x0b88('0x3d')],function(_0x5546a2){var _0x28f075={};_0x28f075[_0x5546a2]={'$like':'%'+_0x396433[_0x0b88('0x3b')][_0x0b88('0x2d')]+'%'};return _0x28f075;})});}_0x4c7472=_['merge']({},_0x4c7472,_0x396433['options']);return db['CmHopperFinal']['count']({'where':_0x4c7472[_0x0b88('0x43')]})[_0x0b88('0x28')](function(_0x3ea5a8){_0x54f824[_0x0b88('0x22')]=_0x3ea5a8;if(_0x396433[_0x0b88('0x3b')][_0x0b88('0x48')]){_0x4c7472['include']=[{'all':!![]}];}return db[_0x0b88('0x69')][_0x0b88('0x4a')](_0x4c7472);})[_0x0b88('0x28')](function(_0x71a873){_0x54f824[_0x0b88('0x4b')]=_0x71a873;return _0x54f824;});}})[_0x0b88('0x28')](respondWithFilteredResult(_0x5059ac,_0x4c7472))[_0x0b88('0x4c')](handleError(_0x5059ac,null));};exports[_0x0b88('0x6a')]=function(_0x2187bc,_0x5ef539,_0xf29915){var _0xffe0e2={'raw':!![],'where':{}};var _0x2c7cf6={};var _0x34013a={'count':0x0,'rows':[]};return db[_0x0b88('0x37')]['findOne']({'where':{'id':_0x2187bc[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x5ef539,null))['then'](function(_0x83724f){if(_0x83724f){_0x2c7cf6['model']=_[_0x0b88('0x3c')](db[_0x0b88('0x6b')]['rawAttributes']);_0x2c7cf6[_0x0b88('0x3b')]=_['keys'](_0x2187bc['query']);_0x2c7cf6['filters']=_['intersection'](_0x2c7cf6['model'],_0x2c7cf6[_0x0b88('0x3b')]);_0xffe0e2['attributes']=_['intersection'](_0x2c7cf6[_0x0b88('0x3a')],qs['fields'](_0x2187bc[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0xffe0e2['attributes']=_0xffe0e2[_0x0b88('0x3d')]['length']?_0xffe0e2[_0x0b88('0x3d')]:_0x2c7cf6['model'];if(!_0x2187bc[_0x0b88('0x3b')]['hasOwnProperty'](_0x0b88('0x63'))){_0xffe0e2[_0x0b88('0x23')]=qs[_0x0b88('0x23')](_0x2187bc[_0x0b88('0x3b')]['limit']);_0xffe0e2['offset']=qs[_0x0b88('0x20')](_0x2187bc[_0x0b88('0x3b')]['offset']);}_0xffe0e2[_0x0b88('0x41')]=qs['sort'](_0x2187bc[_0x0b88('0x3b')][_0x0b88('0x42')]);_0xffe0e2[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_[_0x0b88('0x67')](_0x2187bc['query'],_0x2c7cf6['filters']));_0xffe0e2[_0x0b88('0x43')][_0x0b88('0x64')]=_0x83724f['id'];if(_0x2187bc['query']['filter']){_0xffe0e2[_0x0b88('0x43')]=_['merge'](_0xffe0e2['where'],{'$or':_[_0x0b88('0x2f')](_0xffe0e2[_0x0b88('0x3d')],function(_0x1ca800){var _0x12576b={};_0x12576b[_0x1ca800]={'$like':'%'+_0x2187bc[_0x0b88('0x3b')]['filter']+'%'};return _0x12576b;})});}_0xffe0e2=_[_0x0b88('0x45')]({},_0xffe0e2,_0x2187bc[_0x0b88('0x47')]);return db[_0x0b88('0x6b')][_0x0b88('0x22')]({'where':_0xffe0e2[_0x0b88('0x43')]})['then'](function(_0x863634){_0x34013a[_0x0b88('0x22')]=_0x863634;if(_0x2187bc['query'][_0x0b88('0x48')]){_0xffe0e2['include']=[{'all':!![]}];}return db[_0x0b88('0x6b')][_0x0b88('0x4a')](_0xffe0e2);})[_0x0b88('0x28')](function(_0x4861e9){_0x34013a['rows']=_0x4861e9;return _0x34013a;});}})['then'](respondWithFilteredResult(_0x5ef539,_0xffe0e2))[_0x0b88('0x4c')](handleError(_0x5ef539,null));};exports[_0x0b88('0x6c')]=function(_0x57369e,_0x58c101,_0x3f0b31){var _0x2bd813={};var _0x39da0e={};var _0x35fba1;var _0x516b88;return db[_0x0b88('0x37')][_0x0b88('0x60')]({'where':{'id':_0x57369e[_0x0b88('0x4e')]['id']}})['then'](handleEntityNotFound(_0x58c101,null))[_0x0b88('0x28')](function(_0x2197da){if(_0x2197da){_0x35fba1=_0x2197da;_0x39da0e[_0x0b88('0x3a')]=_[_0x0b88('0x3c')](db[_0x0b88('0x6d')]['rawAttributes']);_0x39da0e[_0x0b88('0x3b')]=_[_0x0b88('0x3c')](_0x57369e[_0x0b88('0x3b')]);_0x39da0e['filters']=_[_0x0b88('0x3e')](_0x39da0e[_0x0b88('0x3a')],_0x39da0e[_0x0b88('0x3b')]);_0x2bd813[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x39da0e['model'],qs[_0x0b88('0x3f')](_0x57369e[_0x0b88('0x3b')]['fields']));_0x2bd813['attributes']=_0x2bd813[_0x0b88('0x3d')]['length']?_0x2bd813[_0x0b88('0x3d')]:_0x39da0e[_0x0b88('0x3a')];_0x2bd813[_0x0b88('0x41')]=qs[_0x0b88('0x42')](_0x57369e[_0x0b88('0x3b')][_0x0b88('0x42')]);_0x2bd813['where']=qs[_0x0b88('0x44')](_['pick'](_0x57369e[_0x0b88('0x3b')],_0x39da0e[_0x0b88('0x44')]));if(_0x57369e[_0x0b88('0x3b')][_0x0b88('0x2d')]){_0x2bd813[_0x0b88('0x43')]=_['merge'](_0x2bd813[_0x0b88('0x43')],{'$or':_[_0x0b88('0x2f')](_0x2bd813[_0x0b88('0x3d')],function(_0x5b2383){var _0xe0cb3f={};_0xe0cb3f[_0x5b2383]={'$like':'%'+_0x57369e[_0x0b88('0x3b')][_0x0b88('0x2d')]+'%'};return _0xe0cb3f;})});}_0x2bd813=_[_0x0b88('0x45')]({},_0x2bd813,_0x57369e['options']);return _0x35fba1[_0x0b88('0x6c')](_0x2bd813);}})['then'](function(_0x2c4359){if(_0x2c4359){_0x516b88=_0x2c4359[_0x0b88('0x40')];if(!_0x57369e[_0x0b88('0x3b')][_0x0b88('0x62')](_0x0b88('0x63'))){_0x2bd813[_0x0b88('0x23')]=qs[_0x0b88('0x23')](_0x57369e[_0x0b88('0x3b')][_0x0b88('0x23')]);_0x2bd813['offset']=qs[_0x0b88('0x20')](_0x57369e[_0x0b88('0x3b')][_0x0b88('0x20')]);}return _0x35fba1[_0x0b88('0x6c')](_0x2bd813);}})[_0x0b88('0x28')](function(_0x4e9df4){if(_0x4e9df4){return _0x4e9df4?{'count':_0x516b88,'rows':_0x4e9df4}:null;}})['then'](respondWithResult(_0x58c101,null))[_0x0b88('0x4c')](handleError(_0x58c101,null));};exports[_0x0b88('0x6e')]=function(_0x378937,_0x5a9dad,_0x1c8115){var _0x23b816=_0x378937[_0x0b88('0x50')][_0x0b88('0x6f')];var _0x29fccb=_[_0x0b88('0x2f')](_0x23b816,'id');return db[_0x0b88('0x6d')][_0x0b88('0x4a')]({'where':{'id':_0x29fccb},'attributes':['id'],'include':[{'model':db[_0x0b88('0x70')],'as':'Agents','attributes':['id',_0x0b88('0x33'),_0x0b88('0x71'),'voicePause',_0x0b88('0x72')],'raw':!![]}]})['then'](function(_0xac3c21){if(_0xac3c21){var _0xd1a078=_['flatMap'](_0xac3c21,function(_0xd0fd7d){var _0x36e83f=_0xd0fd7d[_0x0b88('0x2a')]({'plain':!![]});_0x36e83f[_0x0b88('0x73')][_0x0b88('0x74')](function(_0x4e7809){_0x4e7809[_0x0b88('0x75')]=_[_0x0b88('0x4f')](_0x23b816,{'id':_0x36e83f['id']})[_0x0b88('0x75')];});return _0x36e83f['Agents'];});return db[_0x0b88('0x37')][_0x0b88('0x4f')]({'where':{'id':_0x378937[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](function(_0x42b184){return db['sequelize'][_0x0b88('0x76')](function(_0x382e87){return _0x42b184['addTeams'](_0x29fccb,{'transaction':_0x382e87})[_0x0b88('0x28')](function(){return BPromise['each'](_0x23b816,function(_0x124171){return db[_0x0b88('0x77')][_0x0b88('0x78')]({'TeamId':_0x124171['id'],'VoiceQueueId':_0x378937[_0x0b88('0x4e')]['id'],'penalty':_0x124171[_0x0b88('0x75')]},{'transaction':_0x382e87});});})[_0x0b88('0x28')](function(){return BPromise[_0x0b88('0x79')](_0xd1a078,function(_0x5ae048){return db['UserVoiceQueue'][_0x0b88('0x7a')]({'where':{'UserId':_0x5ae048['id'],'VoiceQueueId':_0x378937[_0x0b88('0x4e')]['id']},'defaults':{'penalty':_0x5ae048[_0x0b88('0x75')]},'transaction':_0x382e87});});})[_0x0b88('0x28')](function(){return BPromise[_0x0b88('0x79')](_[_0x0b88('0x2d')](_0xd1a078,{'online':!![]}),function(_0x1b314a){return db[_0x0b88('0x7b')][_0x0b88('0x78')]({'membername':_0x1b314a['name'],'UserId':_0x1b314a['id'],'queue_name':_0x42b184[_0x0b88('0x33')],'VoiceQueueId':_0x42b184['id'],'interface':_['isNil'](_0x1b314a[_0x0b88('0x72')])?util['format'](_0x0b88('0x7c'),_0x1b314a['name']):_0x1b314a[_0x0b88('0x72')],'paused':_0x1b314a[_0x0b88('0x7d')]||![],'penalty':_0x1b314a['penalty']},{'transaction':_0x382e87});});})[_0x0b88('0x28')](function(){_0xd1a078['forEach'](function(_0x4d66bf){socket['emit']('userVoiceQueue:save',{'UserId':_0x4d66bf['id'],'VoiceQueueId':_0x42b184['id']});});});});});}})['then'](respondWithStatusCode(_0x5a9dad,null))[_0x0b88('0x4c')](handleError(_0x5a9dad,null));};exports['removeTeams']=function(_0x30725b,_0x5b207f,_0x1d8fc6){return db[_0x0b88('0x6d')][_0x0b88('0x4a')]({'where':{'id':_0x30725b[_0x0b88('0x3b')][_0x0b88('0x7e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0b88('0x73'),'attributes':['id'],'raw':!![]}]})[_0x0b88('0x28')](handleEntityNotFound(_0x5b207f,null))[_0x0b88('0x28')](function(_0x4958ba){var _0x2e7608=_[_0x0b88('0x2f')](_0x4958ba,'id');var _0x3d37ce=[];var _0x564293=[];var _0x1df0ea=squel[_0x0b88('0x7f')]();_0x1df0ea['field'](_0x0b88('0x80'))[_0x0b88('0x81')]('team_has_voice_queues','tq')[_0x0b88('0x82')](_0x0b88('0x83'),'ut',_0x0b88('0x84'))[_0x0b88('0x43')](_0x0b88('0x85'),_0x30725b[_0x0b88('0x4e')]['id']);for(var _0x14efa0=0x0;_0x14efa0<_0x4958ba[_0x0b88('0x40')];_0x14efa0+=0x1){let _0x52334b=_0x4958ba[_0x14efa0];for(var _0x57a26c=0x0;_0x57a26c<_0x52334b[_0x0b88('0x73')]['length'];_0x57a26c+=0x1){let _0x2f7728=_0x52334b[_0x0b88('0x73')][_0x57a26c];var _0x536cff=_0x1df0ea['clone']();_0x536cff['where'](_0x0b88('0x86'),_0x2f7728['id']);_0x564293[_0x0b88('0x87')](db[_0x0b88('0x88')]['query'](_0x536cff['toString'](),{'type':db[_0x0b88('0x88')][_0x0b88('0x89')]['SELECT']})[_0x0b88('0x28')](function(_0x223cc4){if(_0x223cc4[_0x0b88('0x40')]===0x1){return _0x2f7728['id'];}else{var _0x564a8d=_[_0x0b88('0x8a')](_[_0x0b88('0x2f')](_0x223cc4,_0x0b88('0x8b')),function(_0x5b9cda){return _[_0x0b88('0x31')](_0x2e7608,_0x5b9cda);});if(_0x564a8d){return _0x2f7728['id'];}}}));}}return BPromise[_0x0b88('0x8c')](_0x564293)[_0x0b88('0x28')](function(_0x1204ca){_0x3d37ce=_(_0x3d37ce)[_0x0b88('0x8d')](_0x1204ca)[_0x0b88('0x8e')]()[_0x0b88('0x30')]();return db[_0x0b88('0x37')][_0x0b88('0x4f')]({'where':{'id':_0x30725b[_0x0b88('0x4e')]['id']}})['then'](function(_0x58f3ea){return db[_0x0b88('0x88')][_0x0b88('0x76')](function(_0x1bc0ee){return _0x58f3ea[_0x0b88('0x8f')](_0x30725b['query'][_0x0b88('0x7e')],{'transaction':_0x1bc0ee})[_0x0b88('0x28')](function(){if(!_['isEmpty'](_0x3d37ce)){return _0x58f3ea['removeAgents'](_0x3d37ce,{'transaction':_0x1bc0ee})[_0x0b88('0x28')](function(){return db['UserVoiceQueueRt'][_0x0b88('0x29')]({'where':{'VoiceQueueId':_0x30725b[_0x0b88('0x4e')]['id'],'UserId':_0x3d37ce},'transaction':_0x1bc0ee});});}})['then'](function(){_0x3d37ce['forEach'](function(_0x34554b){socket[_0x0b88('0x90')]('userVoiceQueue:remove',{'UserId':_0x34554b,'VoiceQueueId':_0x58f3ea['id']});});});});});});})[_0x0b88('0x28')](respondWithStatusCode(_0x5b207f,null))[_0x0b88('0x4c')](handleError(_0x5b207f,null));};exports['addAgents']=function(_0x1994ac,_0x3e38dc,_0x51eb81){var _0x1c7329,_0x491790;return db[_0x0b88('0x37')][_0x0b88('0x4f')]({'where':{'id':_0x1994ac[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x3e38dc,null))[_0x0b88('0x28')](function(_0x168461){if(_0x168461){_0x491790=_0x168461;return _0x168461[_0x0b88('0x91')](_0x1994ac['body'][_0x0b88('0x7e')],_['omit'](_0x1994ac[_0x0b88('0x50')],[_0x0b88('0x7e'),'id'])||{})[_0x0b88('0x92')](function(_0x1c9e2a){for(var _0x26feef=0x0;_0x26feef<_0x1994ac[_0x0b88('0x50')]['ids'][_0x0b88('0x40')];_0x26feef+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x1994ac[_0x0b88('0x50')][_0x0b88('0x7e')][_0x26feef]),'VoiceQueueId':Number(_0x1994ac[_0x0b88('0x4e')]['id'])});}return _0x1c9e2a;});}})[_0x0b88('0x28')](function(_0x18ab2f){_0x1c7329=_0x18ab2f||[];if(_0x491790){return db[_0x0b88('0x70')][_0x0b88('0x4a')]({'where':{'id':_0x1994ac['body'][_0x0b88('0x7e')]},'attributes':['id',_0x0b88('0x33'),'online',_0x0b88('0x7d'),_0x0b88('0x72')],'raw':!![]});}})[_0x0b88('0x28')](function(_0x567c51){if(!_[_0x0b88('0x93')](_0x567c51)){var _0x4c758a=[];for(var _0x135f83=0x0;_0x135f83<_0x567c51[_0x0b88('0x40')];_0x135f83++){if(_0x567c51[_0x135f83][_0x0b88('0x71')]){_0x4c758a[_0x0b88('0x87')](db['UserVoiceQueueRt'][_0x0b88('0x78')]({'membername':_0x567c51[_0x135f83][_0x0b88('0x33')],'UserId':_0x567c51[_0x135f83]['id'],'queue_name':_0x491790[_0x0b88('0x33')],'VoiceQueueId':_0x491790['id'],'interface':_[_0x0b88('0x94')](_0x567c51[_0x135f83][_0x0b88('0x72')])?util['format'](_0x0b88('0x7c'),_0x567c51[_0x135f83][_0x0b88('0x33')]):_0x567c51[_0x135f83][_0x0b88('0x72')],'paused':_0x567c51[_0x135f83][_0x0b88('0x7d')]||![],'penalty':_0x1994ac['body']['penalty']||0x0}));}}return BPromise[_0x0b88('0x8c')](_0x4c758a);}})[_0x0b88('0x28')](function(){return _0x1c7329;})[_0x0b88('0x28')](respondWithResult(_0x3e38dc,null))['catch'](handleError(_0x3e38dc,null));};exports['removeAgents']=function(_0x2e2d9d,_0x38dac3,_0xcfc196){return db[_0x0b88('0x37')]['find']({'where':{'id':_0x2e2d9d[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x38dac3,null))['then'](function(_0x550f9d){if(_0x550f9d){return _0x550f9d['removeAgents'](_0x2e2d9d[_0x0b88('0x3b')]['ids'])[_0x0b88('0x28')](function(){if(_[_0x0b88('0x95')](_0x2e2d9d[_0x0b88('0x3b')][_0x0b88('0x7e')])){for(var _0xe0e322=0x0;_0xe0e322<_0x2e2d9d[_0x0b88('0x3b')][_0x0b88('0x7e')][_0x0b88('0x40')];_0xe0e322+=0x1){socket[_0x0b88('0x90')](_0x0b88('0x96'),{'UserId':Number(_0x2e2d9d[_0x0b88('0x3b')][_0x0b88('0x7e')][_0xe0e322]),'VoiceQueueId':Number(_0x2e2d9d[_0x0b88('0x4e')]['id'])});}}else{socket[_0x0b88('0x90')](_0x0b88('0x96'),{'UserId':Number(_0x2e2d9d[_0x0b88('0x3b')][_0x0b88('0x7e')]),'VoiceQueueId':Number(_0x2e2d9d[_0x0b88('0x4e')]['id'])});}});}})[_0x0b88('0x28')](function(_0x56835e){return db[_0x0b88('0x7b')][_0x0b88('0x29')]({'where':{'VoiceQueueId':_0x2e2d9d[_0x0b88('0x4e')]['id'],'UserId':_0x2e2d9d['query'][_0x0b88('0x7e')]}})[_0x0b88('0x28')](function(){return _0x56835e;});})[_0x0b88('0x28')](respondWithStatusCode(_0x38dac3,null))[_0x0b88('0x4c')](handleError(_0x38dac3,null));};exports['getAgents']=function(_0x3b5f8a,_0x599d30,_0x196cdf){var _0x337b0a={};var _0x57624d={};var _0x47d58d;var _0x5201c0;return db[_0x0b88('0x37')][_0x0b88('0x60')]({'where':{'id':_0x3b5f8a[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x599d30,null))[_0x0b88('0x28')](function(_0x2aed00){if(_0x2aed00){_0x47d58d=_0x2aed00;_0x57624d[_0x0b88('0x3a')]=_[_0x0b88('0x3c')](db['User'][_0x0b88('0x5b')]);_0x57624d[_0x0b88('0x3b')]=_[_0x0b88('0x3c')](_0x3b5f8a[_0x0b88('0x3b')]);_0x57624d[_0x0b88('0x44')]=_[_0x0b88('0x3e')](_0x57624d[_0x0b88('0x3a')],_0x57624d[_0x0b88('0x3b')]);_0x337b0a[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x57624d[_0x0b88('0x3a')],qs[_0x0b88('0x3f')](_0x3b5f8a[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0x337b0a[_0x0b88('0x3d')]=_0x337b0a[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x337b0a[_0x0b88('0x3d')]:_0x57624d[_0x0b88('0x3a')];_0x337b0a[_0x0b88('0x41')]=qs['sort'](_0x3b5f8a[_0x0b88('0x3b')][_0x0b88('0x42')]);_0x337b0a[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_[_0x0b88('0x67')](_0x3b5f8a['query'],_0x57624d['filters']));if(_0x3b5f8a[_0x0b88('0x3b')][_0x0b88('0x2d')]){_0x337b0a['where']=_[_0x0b88('0x45')](_0x337b0a['where'],{'$or':_[_0x0b88('0x2f')](_0x337b0a[_0x0b88('0x3d')],function(_0x43fd4b){var _0x127d25={};_0x127d25[_0x43fd4b]={'$like':'%'+_0x3b5f8a[_0x0b88('0x3b')]['filter']+'%'};return _0x127d25;})});}_0x337b0a=_[_0x0b88('0x45')]({},_0x337b0a,_0x3b5f8a[_0x0b88('0x47')]);return _0x47d58d[_0x0b88('0x97')](_0x337b0a);}})[_0x0b88('0x28')](function(_0x38d259){if(_0x38d259){_0x5201c0=_0x38d259[_0x0b88('0x40')];if(!_0x3b5f8a[_0x0b88('0x3b')][_0x0b88('0x62')]('nolimit')){_0x337b0a[_0x0b88('0x23')]=qs['limit'](_0x3b5f8a[_0x0b88('0x3b')][_0x0b88('0x23')]);_0x337b0a[_0x0b88('0x20')]=qs['offset'](_0x3b5f8a['query'][_0x0b88('0x20')]);}return _0x47d58d['getAgents'](_0x337b0a);}})[_0x0b88('0x28')](function(_0x44f355){if(_0x44f355){return _0x44f355?{'count':_0x5201c0,'rows':_0x44f355}:null;}})[_0x0b88('0x28')](respondWithResult(_0x599d30,null))[_0x0b88('0x4c')](handleError(_0x599d30,null));};exports[_0x0b88('0x98')]=function(_0x54e568,_0xcc50d4,_0x12ce32){var _0x35fbd4={};var _0x35d854={};var _0x419568;var _0x3b0016;return db[_0x0b88('0x37')]['findOne']({'where':{'id':_0x54e568['params']['id']}})['then'](handleEntityNotFound(_0xcc50d4,null))[_0x0b88('0x28')](function(_0x4f27b2){if(_0x4f27b2){_0x419568=_0x4f27b2;_0x35d854[_0x0b88('0x3a')]=_[_0x0b88('0x3c')](db[_0x0b88('0x7b')][_0x0b88('0x5b')]);_0x35d854['query']=_[_0x0b88('0x3c')](_0x54e568[_0x0b88('0x3b')]);_0x35d854[_0x0b88('0x44')]=_['intersection'](_0x35d854[_0x0b88('0x3a')],_0x35d854[_0x0b88('0x3b')]);_0x35fbd4[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x35d854[_0x0b88('0x3a')],qs[_0x0b88('0x3f')](_0x54e568[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0x35fbd4[_0x0b88('0x3d')]=_0x35fbd4[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x35fbd4[_0x0b88('0x3d')]:_0x35d854[_0x0b88('0x3a')];_0x35fbd4['order']=qs[_0x0b88('0x42')](_0x54e568[_0x0b88('0x3b')][_0x0b88('0x42')]);_0x35fbd4[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_[_0x0b88('0x67')](_0x54e568[_0x0b88('0x3b')],_0x35d854[_0x0b88('0x44')]));if(_0x54e568[_0x0b88('0x3b')][_0x0b88('0x2d')]){_0x35fbd4[_0x0b88('0x43')]=_[_0x0b88('0x45')](_0x35fbd4[_0x0b88('0x43')],{'$or':_['map'](_0x35fbd4[_0x0b88('0x3d')],function(_0x55353a){var _0x3d5074={};_0x3d5074[_0x55353a]={'$like':'%'+_0x54e568[_0x0b88('0x3b')][_0x0b88('0x2d')]+'%'};return _0x3d5074;})});}_0x35fbd4=_[_0x0b88('0x45')]({},_0x35fbd4,_0x54e568[_0x0b88('0x47')]);return _0x419568['getMembers'](_0x35fbd4);}})[_0x0b88('0x28')](function(_0x1135f8){if(_0x1135f8){_0x3b0016=_0x1135f8[_0x0b88('0x40')];if(!_0x54e568[_0x0b88('0x3b')]['hasOwnProperty'](_0x0b88('0x63'))){_0x35fbd4[_0x0b88('0x23')]=qs['limit'](_0x54e568[_0x0b88('0x3b')][_0x0b88('0x23')]);_0x35fbd4[_0x0b88('0x20')]=qs[_0x0b88('0x20')](_0x54e568['query'][_0x0b88('0x20')]);}return _0x419568[_0x0b88('0x98')](_0x35fbd4);}})[_0x0b88('0x28')](function(_0x2cf566){return _0x2cf566?{'count':_0x3b0016,'rows':_0x2cf566}:null;})[_0x0b88('0x28')](respondWithResult(_0xcc50d4,null))[_0x0b88('0x4c')](handleError(_0xcc50d4,null));};exports[_0x0b88('0x99')]=function(_0x1b9204,_0xd5afae,_0x329469){var _0x13ccff={};var _0x572e0f={};var _0x5236e7;var _0x2d6033;return db['VoiceQueue'][_0x0b88('0x60')]({'where':{'id':_0x1b9204[_0x0b88('0x4e')]['id']}})['then'](handleEntityNotFound(_0xd5afae,null))['then'](function(_0x3aa8a2){if(_0x3aa8a2){_0x5236e7=_0x3aa8a2;_0x572e0f[_0x0b88('0x3a')]=_[_0x0b88('0x3c')](db[_0x0b88('0x9a')][_0x0b88('0x5b')]);_0x572e0f['query']=_[_0x0b88('0x3c')](_0x1b9204[_0x0b88('0x3b')]);_0x572e0f['filters']=_[_0x0b88('0x3e')](_0x572e0f[_0x0b88('0x3a')],_0x572e0f['query']);_0x13ccff['attributes']=_[_0x0b88('0x3e')](_0x572e0f['model'],qs[_0x0b88('0x3f')](_0x1b9204['query']['fields']));_0x13ccff[_0x0b88('0x3d')]=_0x13ccff[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x13ccff['attributes']:_0x572e0f['model'];_0x13ccff['order']=qs[_0x0b88('0x42')](_0x1b9204[_0x0b88('0x3b')][_0x0b88('0x42')]);_0x13ccff['where']=qs['filters'](_[_0x0b88('0x67')](_0x1b9204['query'],_0x572e0f[_0x0b88('0x44')]));if(_0x1b9204['query'][_0x0b88('0x2d')]){_0x13ccff[_0x0b88('0x43')]=_['merge'](_0x13ccff[_0x0b88('0x43')],{'$or':_[_0x0b88('0x2f')](_0x13ccff[_0x0b88('0x3d')],function(_0x21ccda){var _0x1bdf89={};_0x1bdf89[_0x21ccda]={'$like':'%'+_0x1b9204[_0x0b88('0x3b')]['filter']+'%'};return _0x1bdf89;})});}_0x13ccff=_[_0x0b88('0x45')]({},_0x13ccff,_0x1b9204['options']);return _0x5236e7[_0x0b88('0x99')](_0x13ccff);}})[_0x0b88('0x28')](function(_0x31fc22){if(_0x31fc22){_0x2d6033=_0x31fc22[_0x0b88('0x40')];if(!_0x1b9204[_0x0b88('0x3b')][_0x0b88('0x62')](_0x0b88('0x63'))){_0x13ccff[_0x0b88('0x23')]=qs[_0x0b88('0x23')](_0x1b9204[_0x0b88('0x3b')][_0x0b88('0x23')]);_0x13ccff[_0x0b88('0x20')]=qs['offset'](_0x1b9204[_0x0b88('0x3b')][_0x0b88('0x20')]);}return _0x5236e7[_0x0b88('0x99')](_0x13ccff);}})[_0x0b88('0x28')](function(_0x578f69){if(_0x578f69){return _0x578f69?{'count':_0x2d6033,'rows':_0x578f69}:null;}})[_0x0b88('0x28')](respondWithResult(_0xd5afae,null))[_0x0b88('0x4c')](handleError(_0xd5afae,null));};exports[_0x0b88('0x9b')]=function(_0x50108f,_0x3cf2b8,_0x1bfee4){var _0x49606a,_0x4b2fbf;return db[_0x0b88('0x37')]['find']({'where':{'id':_0x50108f[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x3cf2b8,null))['then'](function(_0x4f2e7d){if(_0x4f2e7d){_0x4b2fbf=_0x4f2e7d;return _0x4f2e7d[_0x0b88('0x9b')](_0x50108f[_0x0b88('0x50')][_0x0b88('0x7e')],_['omit'](_0x50108f['body'],[_0x0b88('0x7e'),'id'])||{});}return null;})['spread'](function(_0x16937d){var _0x5c71cd;_0x49606a=_0x16937d||[];var _0x5662a0=[];if(_0x16937d){for(var _0x30200a=0x0;_0x30200a<_0x16937d[_0x0b88('0x40')];_0x30200a+=0x1){var _0xe57f1e=_0x16937d[_0x30200a][_0x0b88('0x2a')]({'plain':!![]});_0x4b2fbf[_0x0b88('0x9c')]=_0x50108f[_0x0b88('0x50')][_0x0b88('0x9c')]?_0x50108f['body'][_0x0b88('0x9c')]:_0x4b2fbf['dialCheckDuplicateType'];switch(_0x4b2fbf['dialCheckDuplicateType']){case _0x0b88('0x9d'):_0x5c71cd=squel[_0x0b88('0x9e')]()[_0x0b88('0x9f')]('cm_hopper')[_0x0b88('0xa0')]([_0x0b88('0xa1'),_0x0b88('0xa2'),_0x0b88('0xa3'),_0x0b88('0xa4'),_0x0b88('0x64'),_0x0b88('0x5c'),'updatedAt'],squel['select']()[_0x0b88('0xa5')](_0x0b88('0xa1'),_0x0b88('0xa1'))[_0x0b88('0xa5')](_0x0b88('0xa6'),'scheduledAt')[_0x0b88('0xa5')]('id',_0x0b88('0xa3'))[_0x0b88('0xa5')](_0xe57f1e[_0x0b88('0xa7')]['toString'](),_0x0b88('0xa4'))[_0x0b88('0xa5')](_0x50108f['params']['id'][_0x0b88('0xa8')](),_0x0b88('0x64'))['field'](_0x0b88('0xa6'),_0x0b88('0x5c'))[_0x0b88('0xa5')](_0x0b88('0xa6'),_0x0b88('0x5d'))[_0x0b88('0x81')](_0x0b88('0xa9'))[_0x0b88('0x43')](_0x0b88('0xaa'))['where']('ListId\x20=\x20?',_0xe57f1e[_0x0b88('0xa7')][_0x0b88('0xa8')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x0b88('0x43')](_0x0b88('0xab'),squel[_0x0b88('0x7f')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0x0b88('0x81')]('cm_hopper_final')[_0x0b88('0x43')](_0x0b88('0x85'),_0x50108f[_0x0b88('0x4e')]['id'][_0x0b88('0xa8')]()))[_0x0b88('0x43')]('phone\x20NOT\x20IN\x20(?)',squel[_0x0b88('0x7f')]()[_0x0b88('0xa5')](_0x0b88('0xac'))['from'](_0x0b88('0xad'))[_0x0b88('0x43')](_0x0b88('0x85'),_0x50108f[_0x0b88('0x4e')]['id'][_0x0b88('0xa8')]())))['toString']();break;case _0x0b88('0xae'):_0x5c71cd=squel[_0x0b88('0x9e')]()[_0x0b88('0x9f')](_0x0b88('0xad'))[_0x0b88('0xa0')](['phone',_0x0b88('0xa2'),_0x0b88('0xa3'),'ListId',_0x0b88('0x64'),'createdAt',_0x0b88('0x5d')],squel[_0x0b88('0x7f')]()['field'](_0x0b88('0xa1'),'phone')['field']('NOW()',_0x0b88('0xa2'))['field']('id',_0x0b88('0xa3'))[_0x0b88('0xa5')](_0xe57f1e[_0x0b88('0xa7')][_0x0b88('0xa8')](),_0x0b88('0xa4'))['field'](_0x50108f[_0x0b88('0x4e')]['id'][_0x0b88('0xa8')](),_0x0b88('0x64'))[_0x0b88('0xa5')](_0x0b88('0xa6'),_0x0b88('0x5c'))['field']('NOW()','updatedAt')[_0x0b88('0x81')](_0x0b88('0xa9'))[_0x0b88('0x43')](_0x0b88('0xaa'))[_0x0b88('0x43')](_0x0b88('0xaf'),_0xe57f1e[_0x0b88('0xa7')][_0x0b88('0xa8')]())[_0x0b88('0x43')](_0x0b88('0xb0'))['where'](_0x0b88('0xab'),squel['select']()['field'](_0x0b88('0xac'))[_0x0b88('0x81')](_0x0b88('0xad'))['where']('VoiceQueueId\x20=\x20?',_0x50108f[_0x0b88('0x4e')]['id'][_0x0b88('0xa8')]())))['toString']();break;default:_0x5c71cd=squel['insert']()[_0x0b88('0x9f')]('cm_hopper')[_0x0b88('0xa0')]([_0x0b88('0xa1'),_0x0b88('0xa2'),_0x0b88('0xa3'),_0x0b88('0xa4'),_0x0b88('0x64'),_0x0b88('0x5c'),'updatedAt'],squel[_0x0b88('0x7f')]()[_0x0b88('0xa5')](_0x0b88('0xa1'),_0x0b88('0xa1'))[_0x0b88('0xa5')](_0x0b88('0xa6'),_0x0b88('0xa2'))[_0x0b88('0xa5')]('id','ContactId')[_0x0b88('0xa5')](_0xe57f1e[_0x0b88('0xa7')][_0x0b88('0xa8')](),_0x0b88('0xa4'))[_0x0b88('0xa5')](_0x50108f[_0x0b88('0x4e')]['id']['toString'](),'VoiceQueueId')[_0x0b88('0xa5')](_0x0b88('0xa6'),_0x0b88('0x5c'))[_0x0b88('0xa5')](_0x0b88('0xa6'),_0x0b88('0x5d'))[_0x0b88('0x81')](_0x0b88('0xa9'))[_0x0b88('0x43')](_0x0b88('0xaa'))[_0x0b88('0x43')]('ListId\x20=\x20?',_0xe57f1e[_0x0b88('0xa7')][_0x0b88('0xa8')]())[_0x0b88('0x43')](_0x0b88('0xb0')))[_0x0b88('0xa8')]();}_0x5662a0['push'](db['sequelize'][_0x0b88('0x3b')](_0x5c71cd));}return BPromise[_0x0b88('0x8c')](_0x5662a0);}})[_0x0b88('0x28')](function(){return _0x49606a;})[_0x0b88('0x28')](respondWithResult(_0x3cf2b8,null))[_0x0b88('0x4c')](handleError(_0x3cf2b8,null));};exports[_0x0b88('0xb1')]=function(_0xb54bec,_0x27786b,_0x3ea734){return db['VoiceQueue'][_0x0b88('0x4f')]({'where':{'id':_0xb54bec[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x27786b,null))['then'](function(_0x5a45f3){if(_0x5a45f3){return _0x5a45f3[_0x0b88('0xb1')](_0xb54bec[_0x0b88('0x3b')][_0x0b88('0x7e')]);}})[_0x0b88('0x28')](function(_0x2e06ae){if(_0x2e06ae){return db[_0x0b88('0x61')][_0x0b88('0x29')]({'where':{'ListId':_0xb54bec[_0x0b88('0x3b')][_0x0b88('0x7e')],'VoiceQueueId':_0xb54bec[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](function(){return _0x2e06ae;});}})[_0x0b88('0x28')](respondWithStatusCode(_0x27786b,null))[_0x0b88('0x4c')](handleError(_0x27786b,null));};exports['getBlackLists']=function(_0x1cf1b8,_0x2e9bb0,_0x31cbbc){var _0x554371={};var _0x45d5af={};var _0xbb0606;var _0x5a45d5;return db[_0x0b88('0x37')]['findOne']({'where':{'id':_0x1cf1b8[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x2e9bb0,null))[_0x0b88('0x28')](function(_0x3f6028){if(_0x3f6028){_0xbb0606=_0x3f6028;_0x45d5af[_0x0b88('0x3a')]=_[_0x0b88('0x3c')](db[_0x0b88('0x9a')][_0x0b88('0x5b')]);_0x45d5af[_0x0b88('0x3b')]=_['keys'](_0x1cf1b8[_0x0b88('0x3b')]);_0x45d5af['filters']=_['intersection'](_0x45d5af[_0x0b88('0x3a')],_0x45d5af[_0x0b88('0x3b')]);_0x554371[_0x0b88('0x3d')]=_[_0x0b88('0x3e')](_0x45d5af['model'],qs[_0x0b88('0x3f')](_0x1cf1b8[_0x0b88('0x3b')][_0x0b88('0x3f')]));_0x554371[_0x0b88('0x3d')]=_0x554371[_0x0b88('0x3d')][_0x0b88('0x40')]?_0x554371['attributes']:_0x45d5af[_0x0b88('0x3a')];_0x554371[_0x0b88('0x41')]=qs['sort'](_0x1cf1b8[_0x0b88('0x3b')]['sort']);_0x554371[_0x0b88('0x43')]=qs[_0x0b88('0x44')](_[_0x0b88('0x67')](_0x1cf1b8[_0x0b88('0x3b')],_0x45d5af[_0x0b88('0x44')]));if(_0x1cf1b8[_0x0b88('0x3b')]['filter']){_0x554371[_0x0b88('0x43')]=_[_0x0b88('0x45')](_0x554371[_0x0b88('0x43')],{'$or':_[_0x0b88('0x2f')](_0x554371[_0x0b88('0x3d')],function(_0x336dde){var _0x2f14fe={};_0x2f14fe[_0x336dde]={'$like':'%'+_0x1cf1b8['query'][_0x0b88('0x2d')]+'%'};return _0x2f14fe;})});}_0x554371=_[_0x0b88('0x45')]({},_0x554371,_0x1cf1b8['options']);return _0xbb0606[_0x0b88('0xb2')](_0x554371);}})['then'](function(_0x10c2b4){if(_0x10c2b4){_0x5a45d5=_0x10c2b4[_0x0b88('0x40')];if(!_0x1cf1b8[_0x0b88('0x3b')][_0x0b88('0x62')](_0x0b88('0x63'))){_0x554371['limit']=qs['limit'](_0x1cf1b8[_0x0b88('0x3b')][_0x0b88('0x23')]);_0x554371[_0x0b88('0x20')]=qs[_0x0b88('0x20')](_0x1cf1b8[_0x0b88('0x3b')][_0x0b88('0x20')]);}return _0xbb0606[_0x0b88('0xb2')](_0x554371);}})[_0x0b88('0x28')](function(_0x1aa27d){if(_0x1aa27d){return _0x1aa27d?{'count':_0x5a45d5,'rows':_0x1aa27d}:null;}})['then'](respondWithResult(_0x2e9bb0,null))[_0x0b88('0x4c')](handleError(_0x2e9bb0,null));};exports[_0x0b88('0xb3')]=function(_0xe808ce,_0x45da6a,_0x6b01b4){var _0x50f9e6,_0x2985b8;return db['VoiceQueue'][_0x0b88('0x4f')]({'where':{'id':_0xe808ce[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x45da6a,null))[_0x0b88('0x28')](function(_0x56e152){if(_0x56e152){_0x2985b8=_0x56e152;return _0x56e152['addBlackLists'](_0xe808ce['body']['ids'],_[_0x0b88('0xb4')](_0xe808ce[_0x0b88('0x50')],[_0x0b88('0x7e'),'id'])||{});}return null;})[_0x0b88('0x92')](function(_0x5dbb2d){var _0x1234e4;_0x50f9e6=_0x5dbb2d||[];var _0x5a0082=[];if(_0x5dbb2d){for(var _0x22a0ae=0x0;_0x22a0ae<_0x5dbb2d['length'];_0x22a0ae+=0x1){var _0x5953b5=_0x5dbb2d[_0x22a0ae][_0x0b88('0x2a')]({'plain':!![]});_0x1234e4=squel[_0x0b88('0x9e')]()['into'](_0x0b88('0xb5'))['fromQuery']([_0x0b88('0xa1'),_0x0b88('0xa3'),_0x0b88('0xa4'),_0x0b88('0x64'),_0x0b88('0x5c'),_0x0b88('0x5d')],squel[_0x0b88('0x7f')]()['field']('phone','phone')[_0x0b88('0xa5')]('id',_0x0b88('0xa3'))['field'](_0x5953b5[_0x0b88('0xa7')][_0x0b88('0xa8')](),_0x0b88('0xa4'))[_0x0b88('0xa5')](_0xe808ce[_0x0b88('0x4e')]['id'][_0x0b88('0xa8')](),_0x0b88('0x64'))[_0x0b88('0xa5')](_0x0b88('0xa6'),_0x0b88('0x5c'))['field'](_0x0b88('0xa6'),_0x0b88('0x5d'))[_0x0b88('0x81')](_0x0b88('0xa9'))['where']('deletedAt\x20IS\x20NULL')[_0x0b88('0x43')](_0x0b88('0xaf'),_0x5953b5['CmListId']['toString']())[_0x0b88('0x43')](_0x0b88('0xb0')))[_0x0b88('0xa8')]();_0x5a0082[_0x0b88('0x87')](db[_0x0b88('0x88')][_0x0b88('0x3b')](_0x1234e4));}return BPromise[_0x0b88('0x8c')](_0x5a0082);}})['then'](function(){return _0x50f9e6;})[_0x0b88('0x28')](respondWithResult(_0x45da6a,null))[_0x0b88('0x4c')](handleError(_0x45da6a,null));};exports[_0x0b88('0xb6')]=function(_0x96f018,_0x2a4be4,_0x5afc75){return db['VoiceQueue'][_0x0b88('0x4f')]({'where':{'id':_0x96f018[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](handleEntityNotFound(_0x2a4be4,null))['then'](function(_0xe5d4d9){if(_0xe5d4d9){return _0xe5d4d9[_0x0b88('0xb6')](_0x96f018['query'][_0x0b88('0x7e')]);}})[_0x0b88('0x28')](function(_0x57d09f){if(_0x57d09f){return db['CmHopperBlack'][_0x0b88('0x29')]({'where':{'ListId':_0x96f018[_0x0b88('0x3b')][_0x0b88('0x7e')],'VoiceQueueId':_0x96f018[_0x0b88('0x4e')]['id']}})[_0x0b88('0x28')](function(){return _0x57d09f;});}})['then'](respondWithStatusCode(_0x2a4be4,null))[_0x0b88('0x4c')](handleError(_0x2a4be4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2e8f79b..9ca6857 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 _0x948a=['emit','hasOwnProperty','hook','events','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x948a,0x174));var _0xa948=function(_0x35ac23,_0x12f157){_0x35ac23=_0x35ac23-0x0;var _0x1a3737=_0x948a[_0x35ac23];return _0x1a3737;};'use strict';var EventEmitter=require(_0xa948('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xa948('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xa948('0x2')](0x0);var events={'afterCreate':_0xa948('0x3'),'afterUpdate':_0xa948('0x4'),'afterDestroy':_0xa948('0x5')};function emitEvent(_0xfadfd8){return function(_0x2e5761,_0x4338fb,_0x14da4f){VoiceQueueEvents[_0xa948('0x6')](_0xfadfd8+':'+_0x2e5761['id'],_0x2e5761);VoiceQueueEvents[_0xa948('0x6')](_0xfadfd8,_0x2e5761);_0x14da4f(null);};}for(var e in events){if(events[_0xa948('0x7')](e)){var event=events[e];VoiceQueue[_0xa948('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x4258=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x40bc63,_0x1dcc41){var _0x193477=function(_0x303062){while(--_0x303062){_0x40bc63['push'](_0x40bc63['shift']());}};_0x193477(++_0x1dcc41);}(_0x4258,0x1dd));var _0x8425=function(_0xdd4c0d,_0x5b678a){_0xdd4c0d=_0xdd4c0d-0x0;var _0x42dd78=_0x4258[_0xdd4c0d];return _0x42dd78;};'use strict';var EventEmitter=require(_0x8425('0x0'));var VoiceQueue=require(_0x8425('0x1'))['db'][_0x8425('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8425('0x3')](0x0);var events={'afterCreate':_0x8425('0x4'),'afterUpdate':_0x8425('0x5'),'afterDestroy':_0x8425('0x6')};function emitEvent(_0xac698b){return function(_0x43395d,_0xfa026a,_0x46e869){VoiceQueueEvents[_0x8425('0x7')](_0xac698b+':'+_0x43395d['id'],_0x43395d);VoiceQueueEvents[_0x8425('0x7')](_0xac698b,_0x43395d);_0x46e869(null);};}for(var e in events){if(events[_0x8425('0x8')](e)){var event=events[e];VoiceQueue[_0x8425('0x9')](e,emitEvent(event));}}module[_0x8425('0xa')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index e82595f..d79ab9d 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x37d239,_0x9890dc){var _0x219891=function(_0xff7ebb){while(--_0xff7ebb){_0x37d239['push'](_0x37d239['shift']());}};_0x219891(++_0x9890dc);}(_0x008c,0x188));var _0xc008=function(_0x2d4a54,_0x1f759f){_0x2d4a54=_0x2d4a54-0x0;var _0x489a0f=_0x008c[_0x2d4a54];return _0x489a0f;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x16d352,_0x29bdbe){var _0x42cd8e=function(_0xbb9466){while(--_0xbb9466){_0x16d352['push'](_0x16d352['shift']());}};_0x42cd8e(++_0x29bdbe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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':'voice_queues','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 e70fa1d..ed70547 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 _0x3f3e=['attributes','limit','include','model','map','GetVoiceQueue','debug','ShowVoiceQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','VoiceQueue','findAll','options','raw','where'];(function(_0x4cf6d2,_0x22e6d3){var _0x4146b4=function(_0x4f1d7c){while(--_0x4f1d7c){_0x4cf6d2['push'](_0x4cf6d2['shift']());}};_0x4146b4(++_0x22e6d3);}(_0x3f3e,0x91));var _0xe3f3=function(_0x3b2069,_0x96623){_0x3b2069=_0x3b2069-0x0;var _0x521643=_0x3f3e[_0x3b2069];return _0x521643;};'use strict';var _=require(_0xe3f3('0x0'));var util=require(_0xe3f3('0x1'));var moment=require(_0xe3f3('0x2'));var BPromise=require(_0xe3f3('0x3'));var rs=require(_0xe3f3('0x4'));var fs=require('fs');var Redis=require(_0xe3f3('0x5'));var db=require(_0xe3f3('0x6'))['db'];var utils=require(_0xe3f3('0x7'));var logger=require(_0xe3f3('0x8'))(_0xe3f3('0x9'));var config=require(_0xe3f3('0xa'));var jayson=require(_0xe3f3('0xb'));var client=jayson[_0xe3f3('0xc')][_0xe3f3('0xd')]({'port':0x232a});config[_0xe3f3('0xe')]=_[_0xe3f3('0xf')](config['redis'],{'host':_0xe3f3('0x10'),'port':0x18eb});var socket=require(_0xe3f3('0x11'))(new Redis(config[_0xe3f3('0xe')]));require(_0xe3f3('0x12'))[_0xe3f3('0x13')](socket);function respondWithRpcPromise(_0x59b900,_0x39b3cf,_0x20303d){return new BPromise(function(_0x274ba9,_0x339e11){return client[_0xe3f3('0x14')](_0x59b900,_0x20303d)[_0xe3f3('0x15')](function(_0x2b27e6){logger[_0xe3f3('0x16')](_0xe3f3('0x17'),_0x39b3cf,_0xe3f3('0x18'));logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x39b3cf,'request\x20sent',JSON[_0xe3f3('0x19')](_0x2b27e6));if(_0x2b27e6[_0xe3f3('0x1a')]){if(_0x2b27e6[_0xe3f3('0x1a')][_0xe3f3('0x1b')]===0x1f4){logger[_0xe3f3('0x1a')](_0xe3f3('0x17'),_0x39b3cf,_0x2b27e6[_0xe3f3('0x1a')][_0xe3f3('0x1c')]);return _0x339e11(_0x2b27e6[_0xe3f3('0x1a')][_0xe3f3('0x1c')]);}logger['error'](_0xe3f3('0x17'),_0x39b3cf,_0x2b27e6['error'][_0xe3f3('0x1c')]);return _0x274ba9(_0x2b27e6[_0xe3f3('0x1a')]['message']);}else{logger['info'](_0xe3f3('0x17'),_0x39b3cf,_0xe3f3('0x18'));_0x274ba9(_0x2b27e6[_0xe3f3('0x1d')][_0xe3f3('0x1c')]);}})['catch'](function(_0x262127){logger['error'](_0xe3f3('0x17'),_0x39b3cf,_0x262127);_0x339e11(_0x262127);});});}exports['GetVoiceQueue']=function(_0x3c18b2){var _0x2294de=this;return new Promise(function(_0x296199,_0x473b58){return db[_0xe3f3('0x1e')][_0xe3f3('0x1f')]({'raw':_0x3c18b2['options']?_0x3c18b2[_0xe3f3('0x20')][_0xe3f3('0x21')]===undefined?!![]:![]:!![],'where':_0x3c18b2[_0xe3f3('0x20')]?_0x3c18b2[_0xe3f3('0x20')][_0xe3f3('0x22')]||null:null,'attributes':_0x3c18b2[_0xe3f3('0x20')]?_0x3c18b2['options'][_0xe3f3('0x23')]||null:null,'limit':_0x3c18b2['options']?_0x3c18b2['options'][_0xe3f3('0x24')]||null:null,'include':_0x3c18b2[_0xe3f3('0x20')]?_0x3c18b2['options'][_0xe3f3('0x25')]?_['map'](_0x3c18b2[_0xe3f3('0x20')][_0xe3f3('0x25')],function(_0x585be8){return{'model':db[_0x585be8[_0xe3f3('0x26')]],'as':_0x585be8['as'],'attributes':_0x585be8[_0xe3f3('0x23')],'include':_0x585be8[_0xe3f3('0x25')]?_[_0xe3f3('0x27')](_0x585be8[_0xe3f3('0x25')],function(_0x1a0b64){return{'model':db[_0x1a0b64[_0xe3f3('0x26')]],'as':_0x1a0b64['as'],'attributes':_0x1a0b64[_0xe3f3('0x23')],'include':_0x1a0b64[_0xe3f3('0x25')]?_[_0xe3f3('0x27')](_0x1a0b64['include'],function(_0xa32440){return{'model':db[_0xa32440[_0xe3f3('0x26')]],'as':_0xa32440['as'],'attributes':_0xa32440[_0xe3f3('0x23')]};}):[]};}):[]};}):[]:[]})[_0xe3f3('0x15')](function(_0x43f749){logger[_0xe3f3('0x16')](_0xe3f3('0x28'),_0x3c18b2);logger[_0xe3f3('0x29')](_0xe3f3('0x28'),_0x3c18b2,JSON[_0xe3f3('0x19')](_0x43f749));_0x296199(_0x43f749);})['catch'](function(_0x1d85ae){logger[_0xe3f3('0x1a')](_0xe3f3('0x28'),_0x1d85ae[_0xe3f3('0x1c')],_0x3c18b2);_0x473b58(_0x2294de[_0xe3f3('0x1a')](0x1f4,_0x1d85ae['message']));});});};exports[_0xe3f3('0x2a')]=function(_0x5df91c){var _0x57891c=this;return new Promise(function(_0x553a10,_0x3e5ad5){return db[_0xe3f3('0x1e')][_0xe3f3('0x2b')]({'raw':_0x5df91c[_0xe3f3('0x20')]?_0x5df91c[_0xe3f3('0x20')][_0xe3f3('0x21')]===undefined?!![]:![]:!![],'where':_0x5df91c['options']?_0x5df91c[_0xe3f3('0x20')][_0xe3f3('0x22')]||null:null,'attributes':_0x5df91c[_0xe3f3('0x20')]?_0x5df91c['options'][_0xe3f3('0x23')]||null:null,'include':_0x5df91c[_0xe3f3('0x20')]?_0x5df91c[_0xe3f3('0x20')][_0xe3f3('0x25')]?_[_0xe3f3('0x27')](_0x5df91c[_0xe3f3('0x20')][_0xe3f3('0x25')],function(_0x1ca0a5){return{'model':db[_0x1ca0a5['model']],'as':_0x1ca0a5['as'],'attributes':_0x1ca0a5[_0xe3f3('0x23')],'include':_0x1ca0a5['include']?_['map'](_0x1ca0a5[_0xe3f3('0x25')],function(_0x252c14){return{'model':db[_0x252c14[_0xe3f3('0x26')]],'as':_0x252c14['as'],'attributes':_0x252c14['attributes'],'include':_0x252c14[_0xe3f3('0x25')]?_['map'](_0x252c14['include'],function(_0xf3e790){return{'model':db[_0xf3e790[_0xe3f3('0x26')]],'as':_0xf3e790['as'],'attributes':_0xf3e790[_0xe3f3('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4accff){logger[_0xe3f3('0x16')](_0xe3f3('0x2a'),_0x5df91c);logger['debug'](_0xe3f3('0x2a'),_0x5df91c,JSON[_0xe3f3('0x19')](_0x4accff));_0x553a10(_0x4accff);})[_0xe3f3('0x2c')](function(_0x23b710){logger['error'](_0xe3f3('0x2a'),_0x23b710[_0xe3f3('0x1c')],_0x5df91c);_0x3e5ad5(_0x57891c[_0xe3f3('0x1a')](0x1f4,_0x23b710['message']));});});}; \ No newline at end of file +var _0xfc94=['../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','then','info','VoiceQueue,\x20%s,\x20%s','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','findAll','options','raw','where','attributes','limit','include','map','model','VoiceQueue','find','ShowVoiceQueue','lodash','randomstring','ioredis','../../config/logger','rpc'];(function(_0x858bb6,_0x474936){var _0x5d2376=function(_0x348910){while(--_0x348910){_0x858bb6['push'](_0x858bb6['shift']());}};_0x5d2376(++_0x474936);}(_0xfc94,0x1a8));var _0x4fc9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xfc94[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x4fc9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4fc9('0x1'));var fs=require('fs');var Redis=require(_0x4fc9('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4fc9('0x3'))(_0x4fc9('0x4'));var config=require(_0x4fc9('0x5'));var jayson=require(_0x4fc9('0x6'));var client=jayson[_0x4fc9('0x7')][_0x4fc9('0x8')]({'port':0x232a});config[_0x4fc9('0x9')]=_[_0x4fc9('0xa')](config[_0x4fc9('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fc9('0xb'))(new Redis(config[_0x4fc9('0x9')]));require(_0x4fc9('0xc'))[_0x4fc9('0xd')](socket);function respondWithRpcPromise(_0x50db6a,_0x998c72,_0xe23d6e){return new BPromise(function(_0x36866b,_0x4f6b0a){return client['request'](_0x50db6a,_0xe23d6e)[_0x4fc9('0xe')](function(_0x162890){logger[_0x4fc9('0xf')](_0x4fc9('0x10'),_0x998c72,'request\x20sent');logger[_0x4fc9('0x11')](_0x4fc9('0x12'),_0x998c72,_0x4fc9('0x13'),JSON[_0x4fc9('0x14')](_0x162890));if(_0x162890[_0x4fc9('0x15')]){if(_0x162890[_0x4fc9('0x15')][_0x4fc9('0x16')]===0x1f4){logger[_0x4fc9('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x998c72,_0x162890[_0x4fc9('0x15')][_0x4fc9('0x17')]);return _0x4f6b0a(_0x162890[_0x4fc9('0x15')][_0x4fc9('0x17')]);}logger[_0x4fc9('0x15')]('VoiceQueue,\x20%s,\x20%s',_0x998c72,_0x162890['error'][_0x4fc9('0x17')]);return _0x36866b(_0x162890[_0x4fc9('0x15')]['message']);}else{logger[_0x4fc9('0xf')](_0x4fc9('0x10'),_0x998c72,'request\x20sent');_0x36866b(_0x162890[_0x4fc9('0x18')][_0x4fc9('0x17')]);}})[_0x4fc9('0x19')](function(_0x1985f8){logger[_0x4fc9('0x15')](_0x4fc9('0x10'),_0x998c72,_0x1985f8);_0x4f6b0a(_0x1985f8);});});}exports[_0x4fc9('0x1a')]=function(_0x123ab7){var _0x578a60=this;return new Promise(function(_0x122cf5,_0x32adf1){return db['VoiceQueue'][_0x4fc9('0x1b')]({'raw':_0x123ab7[_0x4fc9('0x1c')]?_0x123ab7['options'][_0x4fc9('0x1d')]===undefined?!![]:![]:!![],'where':_0x123ab7[_0x4fc9('0x1c')]?_0x123ab7[_0x4fc9('0x1c')][_0x4fc9('0x1e')]||null:null,'attributes':_0x123ab7[_0x4fc9('0x1c')]?_0x123ab7[_0x4fc9('0x1c')][_0x4fc9('0x1f')]||null:null,'limit':_0x123ab7['options']?_0x123ab7['options'][_0x4fc9('0x20')]||null:null,'include':_0x123ab7[_0x4fc9('0x1c')]?_0x123ab7[_0x4fc9('0x1c')][_0x4fc9('0x21')]?_[_0x4fc9('0x22')](_0x123ab7[_0x4fc9('0x1c')][_0x4fc9('0x21')],function(_0x126059){return{'model':db[_0x126059[_0x4fc9('0x23')]],'as':_0x126059['as'],'attributes':_0x126059['attributes'],'include':_0x126059[_0x4fc9('0x21')]?_[_0x4fc9('0x22')](_0x126059[_0x4fc9('0x21')],function(_0x5d8ff9){return{'model':db[_0x5d8ff9[_0x4fc9('0x23')]],'as':_0x5d8ff9['as'],'attributes':_0x5d8ff9[_0x4fc9('0x1f')],'include':_0x5d8ff9[_0x4fc9('0x21')]?_[_0x4fc9('0x22')](_0x5d8ff9['include'],function(_0x1643f2){return{'model':db[_0x1643f2[_0x4fc9('0x23')]],'as':_0x1643f2['as'],'attributes':_0x1643f2[_0x4fc9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4fc9('0xe')](function(_0x129a6e){logger[_0x4fc9('0xf')](_0x4fc9('0x1a'),_0x123ab7);logger[_0x4fc9('0x11')](_0x4fc9('0x1a'),_0x123ab7,JSON[_0x4fc9('0x14')](_0x129a6e));_0x122cf5(_0x129a6e);})[_0x4fc9('0x19')](function(_0x5544f5){logger[_0x4fc9('0x15')](_0x4fc9('0x1a'),_0x5544f5[_0x4fc9('0x17')],_0x123ab7);_0x32adf1(_0x578a60[_0x4fc9('0x15')](0x1f4,_0x5544f5[_0x4fc9('0x17')]));});});};exports['ShowVoiceQueue']=function(_0x1f1dee){var _0x2a08d8=this;return new Promise(function(_0x37494a,_0x11ee8d){return db[_0x4fc9('0x24')][_0x4fc9('0x25')]({'raw':_0x1f1dee[_0x4fc9('0x1c')]?_0x1f1dee[_0x4fc9('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1f1dee[_0x4fc9('0x1c')]?_0x1f1dee[_0x4fc9('0x1c')][_0x4fc9('0x1e')]||null:null,'attributes':_0x1f1dee[_0x4fc9('0x1c')]?_0x1f1dee[_0x4fc9('0x1c')][_0x4fc9('0x1f')]||null:null,'include':_0x1f1dee[_0x4fc9('0x1c')]?_0x1f1dee[_0x4fc9('0x1c')]['include']?_[_0x4fc9('0x22')](_0x1f1dee[_0x4fc9('0x1c')][_0x4fc9('0x21')],function(_0x5b63ab){return{'model':db[_0x5b63ab[_0x4fc9('0x23')]],'as':_0x5b63ab['as'],'attributes':_0x5b63ab[_0x4fc9('0x1f')],'include':_0x5b63ab['include']?_[_0x4fc9('0x22')](_0x5b63ab['include'],function(_0x246df0){return{'model':db[_0x246df0[_0x4fc9('0x23')]],'as':_0x246df0['as'],'attributes':_0x246df0[_0x4fc9('0x1f')],'include':_0x246df0[_0x4fc9('0x21')]?_['map'](_0x246df0['include'],function(_0x3f80a){return{'model':db[_0x3f80a['model']],'as':_0x3f80a['as'],'attributes':_0x3f80a[_0x4fc9('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4fc9('0xe')](function(_0x2cc9f2){logger['info'](_0x4fc9('0x26'),_0x1f1dee);logger['debug'](_0x4fc9('0x26'),_0x1f1dee,JSON[_0x4fc9('0x14')](_0x2cc9f2));_0x37494a(_0x2cc9f2);})[_0x4fc9('0x19')](function(_0x363487){logger[_0x4fc9('0x15')](_0x4fc9('0x26'),_0x363487[_0x4fc9('0x17')],_0x1f1dee);_0x11ee8d(_0x2a08d8[_0x4fc9('0x15')](0x1f4,_0x363487[_0x4fc9('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index b9528e6..02df40f 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 _0x5550=['length','voiceQueue:','remove','update','emit','removeListener','register'];(function(_0x236250,_0x4b241f){var _0x1f278e=function(_0x2d6344){while(--_0x2d6344){_0x236250['push'](_0x236250['shift']());}};_0x1f278e(++_0x4b241f);}(_0x5550,0x160));var _0x0555=function(_0x56bfd3,_0x55bcd3){_0x56bfd3=_0x56bfd3-0x0;var _0x2b230f=_0x5550[_0x56bfd3];return _0x2b230f;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=['save',_0x0555('0x0'),_0x0555('0x1')];function createListener(_0x3d846c,_0x3259f6){return function(_0x2f2c8c){_0x3259f6[_0x0555('0x2')](_0x3d846c,_0x2f2c8c);};}function removeListener(_0x38b143,_0x10d8c5){return function(){VoiceQueueEvents[_0x0555('0x3')](_0x38b143,_0x10d8c5);};}exports[_0x0555('0x4')]=function(_0x49ac12){for(var _0x3b39a9=0x0,_0x380731=events[_0x0555('0x5')];_0x3b39a9<_0x380731;_0x3b39a9++){var _0x7da4bc=events[_0x3b39a9];var _0x472a6b=createListener(_0x0555('0x6')+_0x7da4bc,_0x49ac12);VoiceQueueEvents['on'](_0x7da4bc,_0x472a6b);}}; \ No newline at end of file +var _0xa400=['length','voiceQueue:','./voiceQueue.events','save','removeListener','register'];(function(_0x4f1bf,_0x1efe2f){var _0x45265a=function(_0xc1849){while(--_0xc1849){_0x4f1bf['push'](_0x4f1bf['shift']());}};_0x45265a(++_0x1efe2f);}(_0xa400,0x110));var _0x0a40=function(_0x279f40,_0x51d275){_0x279f40=_0x279f40-0x0;var _0x2cfaf0=_0xa400[_0x279f40];return _0x2cfaf0;};'use strict';var VoiceQueueEvents=require(_0x0a40('0x0'));var events=[_0x0a40('0x1'),'remove','update'];function createListener(_0x5691f6,_0x1dc8fb){return function(_0x10a390){_0x1dc8fb['emit'](_0x5691f6,_0x10a390);};}function removeListener(_0x5ce144,_0x2071fc){return function(){VoiceQueueEvents[_0x0a40('0x2')](_0x5ce144,_0x2071fc);};}exports[_0x0a40('0x3')]=function(_0x2570ed){for(var _0x215c53=0x0,_0x2cb75f=events[_0x0a40('0x4')];_0x215c53<_0x2cb75f;_0x215c53++){var _0x2bd2fa=events[_0x215c53];var _0x498e36=createListener(_0x0a40('0x5')+_0x2bd2fa,_0x2570ed);VoiceQueueEvents['on'](_0x2bd2fa,_0x498e36);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 374f3e9..2ab81e8 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 _0x423f=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','getVoiceQueuesReport','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x31b8fa,_0x37d486){var _0x51d697=function(_0x4bada3){while(--_0x4bada3){_0x31b8fa['push'](_0x31b8fa['shift']());}};_0x51d697(++_0x37d486);}(_0x423f,0x71));var _0xf423=function(_0x503a42,_0x58c61b){_0x503a42=_0x503a42-0x0;var _0x37beb7=_0x423f[_0x503a42];return _0x37beb7;};'use strict';var multer=require(_0xf423('0x0'));var util=require(_0xf423('0x1'));var path=require('path');var timeout=require(_0xf423('0x2'));var express=require(_0xf423('0x3'));var router=express['Router']();var fs_extra=require(_0xf423('0x4'));var auth=require(_0xf423('0x5'));var interaction=require(_0xf423('0x6'));var config=require(_0xf423('0x7'));var controller=require(_0xf423('0x8'));router[_0xf423('0x9')]('/',auth[_0xf423('0xa')](),controller['index']);router[_0xf423('0x9')](_0xf423('0xb'),auth[_0xf423('0xa')](),controller[_0xf423('0xc')]);router['get']('/index',auth[_0xf423('0xa')](),controller[_0xf423('0xd')]);router[_0xf423('0x9')](_0xf423('0xe'),auth['isAuthenticated'](),controller[_0xf423('0xf')]);router[_0xf423('0x10')]('/',auth['isAuthenticated'](),controller[_0xf423('0x11')]);router[_0xf423('0x12')](_0xf423('0xe'),auth[_0xf423('0xa')](),controller[_0xf423('0x13')]);router[_0xf423('0x14')]('/:id',auth[_0xf423('0xa')](),controller[_0xf423('0x15')]);module[_0xf423('0x16')]=router; \ No newline at end of file +var _0x2c5b=['/:id','delete','destroy','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','/describe','describe','getVoiceQueuesReport','show','create','put'];(function(_0x51cf64,_0x303dab){var _0x2c982b=function(_0x471301){while(--_0x471301){_0x51cf64['push'](_0x51cf64['shift']());}};_0x2c982b(++_0x303dab);}(_0x2c5b,0x193));var _0xb2c5=function(_0x10b6ae,_0x25b184){_0x10b6ae=_0x10b6ae-0x0;var _0xcb72da=_0x2c5b[_0x10b6ae];return _0xcb72da;};'use strict';var multer=require(_0xb2c5('0x0'));var util=require('util');var path=require(_0xb2c5('0x1'));var timeout=require(_0xb2c5('0x2'));var express=require(_0xb2c5('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb2c5('0x4'));var interaction=require(_0xb2c5('0x5'));var config=require(_0xb2c5('0x6'));var controller=require(_0xb2c5('0x7'));router['get']('/',auth[_0xb2c5('0x8')](),controller[_0xb2c5('0x9')]);router[_0xb2c5('0xa')](_0xb2c5('0xb'),auth[_0xb2c5('0x8')](),controller[_0xb2c5('0xc')]);router['get']('/index',auth[_0xb2c5('0x8')](),controller[_0xb2c5('0xd')]);router[_0xb2c5('0xa')]('/:id',auth[_0xb2c5('0x8')](),controller[_0xb2c5('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb2c5('0xf')]);router[_0xb2c5('0x10')](_0xb2c5('0x11'),auth[_0xb2c5('0x8')](),controller['update']);router[_0xb2c5('0x12')](_0xb2c5('0x11'),auth[_0xb2c5('0x8')](),controller[_0xb2c5('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index ba37540..cdccfa8 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 _0xec2c=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','BOOLEAN','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4df71f,_0x234d9b){var _0x7f292b=function(_0x3e4323){while(--_0x3e4323){_0x4df71f['push'](_0x4df71f['shift']());}};_0x7f292b(++_0x234d9b);}(_0xec2c,0xf8));var _0xcec2=function(_0x3530d0,_0x4dfb47){_0x3530d0=_0x3530d0-0x0;var _0x2165c6=_0xec2c[_0x3530d0];return _0x2165c6;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcec2('0x0'));module[_0xcec2('0x1')]={'type':{'type':Sequelize[_0xcec2('0x2')]},'uniqueid':{'type':Sequelize[_0xcec2('0x2')]},'calleridnum':{'type':Sequelize[_0xcec2('0x2')]},'calleridname':{'type':Sequelize[_0xcec2('0x2')]},'queue':{'type':Sequelize[_0xcec2('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xcec2('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xcec2('0x3')],'set':function(_0x3e9add){var _0x178c6e=moment(_0x3e9add);var _0x3e5b81=moment(this[_0xcec2('0x4')](_0xcec2('0x5')))[_0xcec2('0x6')](_0xcec2('0x7'));var _0xc6acd0=_0x178c6e[_0xcec2('0x8')](_0x3e5b81,_0xcec2('0x9'));this[_0xcec2('0xa')](_0xcec2('0xb'),_0x3e9add);this[_0xcec2('0xa')](_0xcec2('0xc'),_0xc6acd0||null);}},'position':{'type':Sequelize[_0xcec2('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xcec2('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xcec2('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xcec2('0xe')},'originalposition':{'type':Sequelize[_0xcec2('0xd')]},'channel':{'type':Sequelize[_0xcec2('0x2')]},'connectedlinenum':{'type':Sequelize[_0xcec2('0x2')]},'connectedlinename':{'type':Sequelize[_0xcec2('0x2')]},'accountcode':{'type':Sequelize[_0xcec2('0x2')]},'context':{'type':Sequelize[_0xcec2('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0xcec2('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xcec2('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xcec2('0x2')]},'transfer':{'type':Sequelize[_0xcec2('0xf')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xcec2('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xcec2('0x2')]},'transferuniqueid':{'type':Sequelize[_0xcec2('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcec2('0x2')]},'thirdDisposition':{'type':Sequelize[_0xcec2('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xcec2('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0x67e5=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','queuecallerleaveAt'];(function(_0x3d4864,_0x10ff93){var _0x489010=function(_0x577f25){while(--_0x577f25){_0x3d4864['push'](_0x3d4864['shift']());}};_0x489010(++_0x10ff93);}(_0x67e5,0x73));var _0x567e=function(_0x1eaeac,_0x336e9b){_0x1eaeac=_0x1eaeac-0x0;var _0x4dd949=_0x67e5[_0x1eaeac];return _0x4dd949;};'use strict';var Sequelize=require(_0x567e('0x0'));var moment=require(_0x567e('0x1'));module[_0x567e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x567e('0x3')]},'calleridnum':{'type':Sequelize[_0x567e('0x3')]},'calleridname':{'type':Sequelize[_0x567e('0x3')]},'queue':{'type':Sequelize[_0x567e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x567e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x567e('0x4')],'set':function(_0x449273){var _0x10474c=moment(_0x449273);var _0x55a924=moment(this[_0x567e('0x5')](_0x567e('0x6')))[_0x567e('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1c043b=_0x10474c['diff'](_0x55a924,_0x567e('0x8'));this[_0x567e('0x9')](_0x567e('0xa'),_0x449273);this[_0x567e('0x9')]('holdtime',_0x1c043b||null);}},'position':{'type':Sequelize[_0x567e('0xb')]},'count':{'type':Sequelize[_0x567e('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x567e('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x567e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x567e('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x567e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x567e('0x3')],'comment':_0x567e('0xd')},'originalposition':{'type':Sequelize[_0x567e('0xb')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x567e('0x3')]},'accountcode':{'type':Sequelize[_0x567e('0x3')]},'context':{'type':Sequelize[_0x567e('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x567e('0x3')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x567e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x567e('0x3')]},'disposition':{'type':Sequelize[_0x567e('0x3')]},'secondDisposition':{'type':Sequelize[_0x567e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x567e('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index be0f154..49fae4c 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 _0xcce6=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','error','name','send','map','VoiceQueueReport','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','type','VIRTUAL','filter','then','includeAll','include','rows','catch','show','rawAttributes','length','options','find','create','body','params','describe','getVoiceQueuesReport','nolimit','pick','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0xcce6,0x17e));var _0x6cce=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0xcce6[_0x367336];return _0x3423a7;};'use strict';var emlformat=require(_0x6cce('0x0'));var rimraf=require(_0x6cce('0x1'));var zipdir=require(_0x6cce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6cce('0x3'));var moment=require(_0x6cce('0x4'));var BPromise=require(_0x6cce('0x5'));var Mustache=require(_0x6cce('0x6'));var util=require(_0x6cce('0x7'));var path=require(_0x6cce('0x8'));var sox=require(_0x6cce('0x9'));var csv=require(_0x6cce('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6cce('0xb'));var _=require(_0x6cce('0xc'));var squel=require(_0x6cce('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6cce('0xa'));var querystring=require(_0x6cce('0xe'));var Papa=require('papaparse');var Redis=require(_0x6cce('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6cce('0x10'));var as=require(_0x6cce('0x11'));var hardwareService=require(_0x6cce('0x12'));var logger=require(_0x6cce('0x13'))('api');var utils=require(_0x6cce('0x14'));var config=require(_0x6cce('0x15'));var licenseUtil=require(_0x6cce('0x16'));var db=require(_0x6cce('0x17'))['db'];config[_0x6cce('0x18')]=_[_0x6cce('0x19')](config[_0x6cce('0x18')],{'host':_0x6cce('0x1a'),'port':0x18eb});var socket=require(_0x6cce('0x1b'))(new Redis(config[_0x6cce('0x18')]));require('./voiceQueueReport.socket')[_0x6cce('0x1c')](socket);function respondWithStatusCode(_0x41dbf3,_0x55cc0a){_0x55cc0a=_0x55cc0a||0xcc;return function(_0x452152){if(_0x452152){return _0x41dbf3[_0x6cce('0x1d')](_0x55cc0a);}return _0x41dbf3['status'](_0x55cc0a)[_0x6cce('0x1e')]();};}function respondWithResult(_0x58bd72,_0x237999){_0x237999=_0x237999||0xc8;return function(_0x136f24){if(_0x136f24){return _0x58bd72[_0x6cce('0x1f')](_0x237999)[_0x6cce('0x20')](_0x136f24);}};}function respondWithFilteredResult(_0x33cc15,_0x418523){return function(_0x9f2bdc){if(_0x9f2bdc){var _0x21041b=typeof _0x418523[_0x6cce('0x21')]===_0x6cce('0x22')&&typeof _0x418523[_0x6cce('0x23')]===_0x6cce('0x22');var _0x565c4a=_0x9f2bdc[_0x6cce('0x24')];var _0x387922=_0x21041b?0x0:_0x418523[_0x6cce('0x21')];var _0x4d5f41=_0x21041b?_0x9f2bdc['count']:_0x418523[_0x6cce('0x21')]+_0x418523[_0x6cce('0x23')];var _0x22eed9;if(_0x4d5f41>=_0x565c4a){_0x4d5f41=_0x565c4a;_0x22eed9=0xc8;}else{_0x22eed9=0xce;}_0x33cc15['status'](_0x22eed9);return _0x33cc15['set'](_0x6cce('0x25'),_0x387922+'-'+_0x4d5f41+'/'+_0x565c4a)[_0x6cce('0x20')](_0x9f2bdc);}return null;};}function patchUpdates(_0x180678){return function(_0x26203e){try{jsonpatch[_0x6cce('0x26')](_0x26203e,_0x180678,!![]);}catch(_0x233841){return BPromise[_0x6cce('0x27')](_0x233841);}return _0x26203e[_0x6cce('0x28')]();};}function saveUpdates(_0x2d4aae,_0xca6bbb){return function(_0x576975){if(_0x576975){return _0x576975[_0x6cce('0x29')](_0x2d4aae)['then'](function(_0x3196f){return _0x3196f;});}return null;};}function removeEntity(_0x4c0775,_0x59f29b){return function(_0x16ee63){if(_0x16ee63){return _0x16ee63[_0x6cce('0x2a')]()['then'](function(){_0x4c0775[_0x6cce('0x1f')](0xcc)[_0x6cce('0x1e')]();});}};}function handleEntityNotFound(_0x2ac213,_0x2a0134){return function(_0x387984){if(!_0x387984){_0x2ac213[_0x6cce('0x1d')](0x194);}return _0x387984;};}function handleError(_0xef626c,_0x1e657a){_0x1e657a=_0x1e657a||0x1f4;return function(_0x10f622){logger[_0x6cce('0x2b')](_0x10f622['stack']);if(_0x10f622['name']){delete _0x10f622[_0x6cce('0x2c')];}_0xef626c[_0x6cce('0x1f')](_0x1e657a)[_0x6cce('0x2d')](_0x10f622);};}exports['index']=function(_0x4a6b1d,_0x1b6657){var _0x3cda69={},_0x2b234c={},_0x1bed97={'count':0x0,'rows':[]};var _0x140241=_[_0x6cce('0x2e')](db[_0x6cce('0x2f')]['rawAttributes'],function(_0x42d15b){return{'name':_0x42d15b['fieldName'],'type':_0x42d15b['type'][_0x6cce('0x30')]};});_0x2b234c[_0x6cce('0x31')]=_['map'](_0x140241,'name');_0x2b234c[_0x6cce('0x32')]=_[_0x6cce('0x33')](_0x4a6b1d['query']);_0x2b234c[_0x6cce('0x34')]=_[_0x6cce('0x35')](_0x2b234c[_0x6cce('0x31')],_0x2b234c[_0x6cce('0x32')]);_0x3cda69[_0x6cce('0x36')]=_[_0x6cce('0x35')](_0x2b234c[_0x6cce('0x31')],qs[_0x6cce('0x37')](_0x4a6b1d[_0x6cce('0x32')][_0x6cce('0x37')]));_0x3cda69[_0x6cce('0x36')]=_0x3cda69[_0x6cce('0x36')]['length']?_0x3cda69['attributes']:_0x2b234c[_0x6cce('0x31')];if(!_0x4a6b1d[_0x6cce('0x32')]['hasOwnProperty']('nolimit')){_0x3cda69[_0x6cce('0x23')]=qs[_0x6cce('0x23')](_0x4a6b1d[_0x6cce('0x32')][_0x6cce('0x23')]);_0x3cda69['offset']=qs[_0x6cce('0x21')](_0x4a6b1d[_0x6cce('0x32')][_0x6cce('0x21')]);}_0x3cda69[_0x6cce('0x38')]=qs['sort'](_0x4a6b1d[_0x6cce('0x32')][_0x6cce('0x39')]);_0x3cda69[_0x6cce('0x3a')]=qs[_0x6cce('0x34')](_['pick'](_0x4a6b1d[_0x6cce('0x32')],_0x2b234c[_0x6cce('0x34')]),_0x140241);if(_0x4a6b1d['query']['filter']){_0x3cda69['where']=_[_0x6cce('0x3b')](_0x3cda69[_0x6cce('0x3a')],{'$or':_[_0x6cce('0x2e')](_0x140241,function(_0x2173c7){if(_0x2173c7[_0x6cce('0x3c')]!==_0x6cce('0x3d')){var _0x2fb8e8={};_0x2fb8e8[_0x2173c7[_0x6cce('0x2c')]]={'$like':'%'+_0x4a6b1d[_0x6cce('0x32')][_0x6cce('0x3e')]+'%'};return _0x2fb8e8;}})});}_0x3cda69=_[_0x6cce('0x3b')]({},_0x3cda69,_0x4a6b1d['options']);var _0x2f7a10={'where':_0x3cda69[_0x6cce('0x3a')]};return db[_0x6cce('0x2f')][_0x6cce('0x24')](_0x2f7a10)[_0x6cce('0x3f')](function(_0x2359b9){_0x1bed97[_0x6cce('0x24')]=_0x2359b9;if(_0x4a6b1d['query'][_0x6cce('0x40')]){_0x3cda69[_0x6cce('0x41')]=[{'all':!![]}];}return db[_0x6cce('0x2f')]['findAll'](_0x3cda69);})[_0x6cce('0x3f')](function(_0x464af2){_0x1bed97[_0x6cce('0x42')]=_0x464af2;return _0x1bed97;})[_0x6cce('0x3f')](respondWithFilteredResult(_0x1b6657,_0x3cda69))[_0x6cce('0x43')](handleError(_0x1b6657,null));};exports[_0x6cce('0x44')]=function(_0x512330,_0x1219a3){var _0x22cc29={'raw':![],'where':{'id':_0x512330['params']['id']}},_0x333917={};_0x333917[_0x6cce('0x31')]=_[_0x6cce('0x33')](db['VoiceQueueReport'][_0x6cce('0x45')]);_0x333917[_0x6cce('0x32')]=_['keys'](_0x512330[_0x6cce('0x32')]);_0x333917['filters']=_[_0x6cce('0x35')](_0x333917[_0x6cce('0x31')],_0x333917[_0x6cce('0x32')]);_0x22cc29[_0x6cce('0x36')]=_[_0x6cce('0x35')](_0x333917['model'],qs[_0x6cce('0x37')](_0x512330['query'][_0x6cce('0x37')]));_0x22cc29[_0x6cce('0x36')]=_0x22cc29[_0x6cce('0x36')][_0x6cce('0x46')]?_0x22cc29[_0x6cce('0x36')]:_0x333917[_0x6cce('0x31')];if(_0x512330[_0x6cce('0x32')]['includeAll']){_0x22cc29[_0x6cce('0x41')]=[{'all':!![]}];}_0x22cc29=_['merge']({},_0x22cc29,_0x512330[_0x6cce('0x47')]);return db['VoiceQueueReport'][_0x6cce('0x48')](_0x22cc29)['then'](handleEntityNotFound(_0x1219a3,null))[_0x6cce('0x3f')](respondWithResult(_0x1219a3,null))[_0x6cce('0x43')](handleError(_0x1219a3,null));};exports[_0x6cce('0x49')]=function(_0x3b7ac6,_0x436a5c){return db[_0x6cce('0x2f')][_0x6cce('0x49')](_0x3b7ac6[_0x6cce('0x4a')],{})[_0x6cce('0x3f')](respondWithResult(_0x436a5c,0xc9))['catch'](handleError(_0x436a5c,null));};exports[_0x6cce('0x29')]=function(_0x4bf0b6,_0x57c78c){if(_0x4bf0b6[_0x6cce('0x4a')]['id']){delete _0x4bf0b6[_0x6cce('0x4a')]['id'];}return db[_0x6cce('0x2f')][_0x6cce('0x48')]({'where':{'id':_0x4bf0b6['params']['id']}})[_0x6cce('0x3f')](handleEntityNotFound(_0x57c78c,null))[_0x6cce('0x3f')](saveUpdates(_0x4bf0b6[_0x6cce('0x4a')],null))['then'](respondWithResult(_0x57c78c,null))[_0x6cce('0x43')](handleError(_0x57c78c,null));};exports[_0x6cce('0x2a')]=function(_0x145a1c,_0x98a26a){return db[_0x6cce('0x2f')][_0x6cce('0x48')]({'where':{'id':_0x145a1c[_0x6cce('0x4b')]['id']}})[_0x6cce('0x3f')](handleEntityNotFound(_0x98a26a,null))[_0x6cce('0x3f')](removeEntity(_0x98a26a,null))['catch'](handleError(_0x98a26a,null));};exports[_0x6cce('0x4c')]=function(_0x384ca2,_0x369384){return db[_0x6cce('0x2f')]['describe']()[_0x6cce('0x3f')](respondWithResult(_0x369384,null))[_0x6cce('0x43')](handleError(_0x369384,null));};exports[_0x6cce('0x4d')]=function(_0x5d5c6a,_0x47551b){var _0xbb7078={},_0x4e6e0d={},_0x362a80={'count':0x0,'rows':[]};_0x4e6e0d[_0x6cce('0x31')]=_[_0x6cce('0x33')](db[_0x6cce('0x2f')][_0x6cce('0x45')]);_0x4e6e0d[_0x6cce('0x32')]=_[_0x6cce('0x33')](_0x5d5c6a[_0x6cce('0x32')]);_0x4e6e0d[_0x6cce('0x34')]=_[_0x6cce('0x35')](_0x4e6e0d[_0x6cce('0x31')],_0x4e6e0d[_0x6cce('0x32')]);_0xbb7078['attributes']=_[_0x6cce('0x35')](_0x4e6e0d[_0x6cce('0x31')],qs['fields'](_0x5d5c6a['query'][_0x6cce('0x37')]));_0xbb7078[_0x6cce('0x36')]=_0xbb7078['attributes'][_0x6cce('0x46')]?_0xbb7078['attributes']:_0x4e6e0d[_0x6cce('0x31')];if(!_0x5d5c6a[_0x6cce('0x32')]['hasOwnProperty'](_0x6cce('0x4e'))){_0xbb7078[_0x6cce('0x23')]=qs[_0x6cce('0x23')](_0x5d5c6a[_0x6cce('0x32')][_0x6cce('0x23')]);_0xbb7078[_0x6cce('0x21')]=qs[_0x6cce('0x21')](_0x5d5c6a['query'][_0x6cce('0x21')]);}_0xbb7078[_0x6cce('0x38')]=qs[_0x6cce('0x39')](_0x5d5c6a[_0x6cce('0x32')][_0x6cce('0x39')]);_0xbb7078['where']=qs[_0x6cce('0x34')](_[_0x6cce('0x4f')](_0x5d5c6a[_0x6cce('0x32')],_0x4e6e0d['filters']));if(_0x5d5c6a[_0x6cce('0x32')][_0x6cce('0x3e')]){_0xbb7078[_0x6cce('0x3a')]=_[_0x6cce('0x3b')](_0xbb7078[_0x6cce('0x3a')],{'$or':_[_0x6cce('0x2e')](_0xbb7078['attributes'],function(_0x4a6847){var _0x5a25df={};_0x5a25df[_0x4a6847]={'$like':'%'+_0x5d5c6a[_0x6cce('0x32')][_0x6cce('0x3e')]+'%'};return _0x5a25df;})});}_0xbb7078=_[_0x6cce('0x3b')]({},_0xbb7078,_0x5d5c6a[_0x6cce('0x47')]);var _0x333aa5={'where':_0xbb7078[_0x6cce('0x3a')]};return db['VoiceQueueReport'][_0x6cce('0x24')](_0x333aa5)[_0x6cce('0x3f')](function(_0xcdeb28){_0x362a80['count']=_0xcdeb28;if(_0x5d5c6a[_0x6cce('0x32')][_0x6cce('0x40')]){_0xbb7078[_0x6cce('0x41')]=[{'all':!![]}];}return db[_0x6cce('0x2f')][_0x6cce('0x50')](_0xbb7078);})[_0x6cce('0x3f')](function(_0x55431d){_0x362a80[_0x6cce('0x42')]=_0x55431d;return _0x362a80;})[_0x6cce('0x3f')](respondWithFilteredResult(_0x47551b,_0xbb7078,_0x6cce('0x4d')))[_0x6cce('0x43')](handleError(_0x47551b,null,_0x6cce('0x4d')));}; \ No newline at end of file +var _0x5b77=['../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','rows','include','find','create','body','catch','params','describe','findAll','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x1dd9a2,_0x15ea6d){var _0x3d4326=function(_0x4cf86c){while(--_0x4cf86c){_0x1dd9a2['push'](_0x1dd9a2['shift']());}};_0x3d4326(++_0x15ea6d);}(_0x5b77,0xde));var _0x75b7=function(_0x1097c7,_0x5cd9e5){_0x1097c7=_0x1097c7-0x0;var _0x4384e9=_0x5b77[_0x1097c7];return _0x4384e9;};'use strict';var emlformat=require(_0x75b7('0x0'));var rimraf=require(_0x75b7('0x1'));var zipdir=require(_0x75b7('0x2'));var jsonpatch=require(_0x75b7('0x3'));var rp=require('request-promise');var moment=require(_0x75b7('0x4'));var BPromise=require(_0x75b7('0x5'));var Mustache=require(_0x75b7('0x6'));var util=require(_0x75b7('0x7'));var path=require('path');var sox=require(_0x75b7('0x8'));var csv=require(_0x75b7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75b7('0xa'));var _=require(_0x75b7('0xb'));var squel=require(_0x75b7('0xc'));var crypto=require('crypto');var jsforce=require(_0x75b7('0xd'));var deskjs=require(_0x75b7('0xe'));var toCsv=require('to-csv');var querystring=require(_0x75b7('0xf'));var Papa=require(_0x75b7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x75b7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75b7('0x12'));var logger=require(_0x75b7('0x13'))(_0x75b7('0x14'));var utils=require(_0x75b7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x75b7('0x16'));var db=require('../../mysqldb')['db'];config[_0x75b7('0x17')]=_[_0x75b7('0x18')](config['redis'],{'host':_0x75b7('0x19'),'port':0x18eb});var socket=require(_0x75b7('0x1a'))(new Redis(config[_0x75b7('0x17')]));require(_0x75b7('0x1b'))[_0x75b7('0x1c')](socket);function respondWithStatusCode(_0x48558d,_0x1ad12c){_0x1ad12c=_0x1ad12c||0xcc;return function(_0x8d2d2b){if(_0x8d2d2b){return _0x48558d['sendStatus'](_0x1ad12c);}return _0x48558d[_0x75b7('0x1d')](_0x1ad12c)['end']();};}function respondWithResult(_0x50e103,_0x173871){_0x173871=_0x173871||0xc8;return function(_0x3800a1){if(_0x3800a1){return _0x50e103['status'](_0x173871)[_0x75b7('0x1e')](_0x3800a1);}};}function respondWithFilteredResult(_0x54b211,_0x48e715){return function(_0x39a20b){if(_0x39a20b){var _0x554b76=typeof _0x48e715[_0x75b7('0x1f')]===_0x75b7('0x20')&&typeof _0x48e715[_0x75b7('0x21')]===_0x75b7('0x20');var _0x4f802d=_0x39a20b[_0x75b7('0x22')];var _0x115029=_0x554b76?0x0:_0x48e715[_0x75b7('0x1f')];var _0x46ed2b=_0x554b76?_0x39a20b[_0x75b7('0x22')]:_0x48e715[_0x75b7('0x1f')]+_0x48e715[_0x75b7('0x21')];var _0x407a15;if(_0x46ed2b>=_0x4f802d){_0x46ed2b=_0x4f802d;_0x407a15=0xc8;}else{_0x407a15=0xce;}_0x54b211[_0x75b7('0x1d')](_0x407a15);return _0x54b211['set'](_0x75b7('0x23'),_0x115029+'-'+_0x46ed2b+'/'+_0x4f802d)['json'](_0x39a20b);}return null;};}function patchUpdates(_0x1fd663){return function(_0x4ac231){try{jsonpatch[_0x75b7('0x24')](_0x4ac231,_0x1fd663,!![]);}catch(_0x2d3dfb){return BPromise[_0x75b7('0x25')](_0x2d3dfb);}return _0x4ac231['save']();};}function saveUpdates(_0x28f38b,_0x3bf05f){return function(_0x5113ca){if(_0x5113ca){return _0x5113ca[_0x75b7('0x26')](_0x28f38b)['then'](function(_0x51a6ed){return _0x51a6ed;});}return null;};}function removeEntity(_0x199143,_0x4df107){return function(_0x5c359e){if(_0x5c359e){return _0x5c359e[_0x75b7('0x27')]()[_0x75b7('0x28')](function(){_0x199143[_0x75b7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f8a8b,_0x145f5d){return function(_0x54f017){if(!_0x54f017){_0x3f8a8b[_0x75b7('0x29')](0x194);}return _0x54f017;};}function handleError(_0xe9457b,_0x3ec8ec){_0x3ec8ec=_0x3ec8ec||0x1f4;return function(_0x43ca2f){logger[_0x75b7('0x2a')](_0x43ca2f[_0x75b7('0x2b')]);if(_0x43ca2f[_0x75b7('0x2c')]){delete _0x43ca2f[_0x75b7('0x2c')];}_0xe9457b[_0x75b7('0x1d')](_0x3ec8ec)[_0x75b7('0x2d')](_0x43ca2f);};}exports[_0x75b7('0x2e')]=function(_0xfd207b,_0x59ca6e){var _0x23dce8={},_0x51a68a={},_0xb400e1={'count':0x0,'rows':[]};var _0x360d74=_[_0x75b7('0x2f')](db[_0x75b7('0x30')][_0x75b7('0x31')],function(_0x5192a2){return{'name':_0x5192a2[_0x75b7('0x32')],'type':_0x5192a2['type'][_0x75b7('0x33')]};});_0x51a68a['model']=_[_0x75b7('0x2f')](_0x360d74,_0x75b7('0x2c'));_0x51a68a[_0x75b7('0x34')]=_[_0x75b7('0x35')](_0xfd207b['query']);_0x51a68a[_0x75b7('0x36')]=_[_0x75b7('0x37')](_0x51a68a[_0x75b7('0x38')],_0x51a68a[_0x75b7('0x34')]);_0x23dce8[_0x75b7('0x39')]=_['intersection'](_0x51a68a[_0x75b7('0x38')],qs[_0x75b7('0x3a')](_0xfd207b[_0x75b7('0x34')][_0x75b7('0x3a')]));_0x23dce8[_0x75b7('0x39')]=_0x23dce8['attributes'][_0x75b7('0x3b')]?_0x23dce8[_0x75b7('0x39')]:_0x51a68a[_0x75b7('0x38')];if(!_0xfd207b[_0x75b7('0x34')][_0x75b7('0x3c')](_0x75b7('0x3d'))){_0x23dce8[_0x75b7('0x21')]=qs[_0x75b7('0x21')](_0xfd207b[_0x75b7('0x34')][_0x75b7('0x21')]);_0x23dce8[_0x75b7('0x1f')]=qs[_0x75b7('0x1f')](_0xfd207b[_0x75b7('0x34')][_0x75b7('0x1f')]);}_0x23dce8[_0x75b7('0x3e')]=qs[_0x75b7('0x3f')](_0xfd207b[_0x75b7('0x34')][_0x75b7('0x3f')]);_0x23dce8[_0x75b7('0x40')]=qs[_0x75b7('0x36')](_[_0x75b7('0x41')](_0xfd207b['query'],_0x51a68a['filters']),_0x360d74);if(_0xfd207b['query'][_0x75b7('0x42')]){_0x23dce8[_0x75b7('0x40')]=_['merge'](_0x23dce8['where'],{'$or':_[_0x75b7('0x2f')](_0x360d74,function(_0x41116c){if(_0x41116c[_0x75b7('0x43')]!=='VIRTUAL'){var _0x25b495={};_0x25b495[_0x41116c[_0x75b7('0x2c')]]={'$like':'%'+_0xfd207b[_0x75b7('0x34')][_0x75b7('0x42')]+'%'};return _0x25b495;}})});}_0x23dce8=_[_0x75b7('0x44')]({},_0x23dce8,_0xfd207b[_0x75b7('0x45')]);var _0x2e8079={'where':_0x23dce8[_0x75b7('0x40')]};return db[_0x75b7('0x30')][_0x75b7('0x22')](_0x2e8079)[_0x75b7('0x28')](function(_0xdabd48){_0xb400e1[_0x75b7('0x22')]=_0xdabd48;if(_0xfd207b[_0x75b7('0x34')][_0x75b7('0x46')]){_0x23dce8['include']=[{'all':!![]}];}return db[_0x75b7('0x30')]['findAll'](_0x23dce8);})[_0x75b7('0x28')](function(_0x47e1bc){_0xb400e1[_0x75b7('0x47')]=_0x47e1bc;return _0xb400e1;})[_0x75b7('0x28')](respondWithFilteredResult(_0x59ca6e,_0x23dce8))['catch'](handleError(_0x59ca6e,null));};exports['show']=function(_0x5b87b9,_0x3d17b0){var _0x4b249a={'raw':![],'where':{'id':_0x5b87b9['params']['id']}},_0xcd9799={};_0xcd9799[_0x75b7('0x38')]=_[_0x75b7('0x35')](db[_0x75b7('0x30')][_0x75b7('0x31')]);_0xcd9799[_0x75b7('0x34')]=_[_0x75b7('0x35')](_0x5b87b9['query']);_0xcd9799[_0x75b7('0x36')]=_[_0x75b7('0x37')](_0xcd9799['model'],_0xcd9799['query']);_0x4b249a['attributes']=_[_0x75b7('0x37')](_0xcd9799['model'],qs[_0x75b7('0x3a')](_0x5b87b9[_0x75b7('0x34')]['fields']));_0x4b249a[_0x75b7('0x39')]=_0x4b249a[_0x75b7('0x39')]['length']?_0x4b249a['attributes']:_0xcd9799['model'];if(_0x5b87b9['query'][_0x75b7('0x46')]){_0x4b249a[_0x75b7('0x48')]=[{'all':!![]}];}_0x4b249a=_['merge']({},_0x4b249a,_0x5b87b9[_0x75b7('0x45')]);return db[_0x75b7('0x30')][_0x75b7('0x49')](_0x4b249a)[_0x75b7('0x28')](handleEntityNotFound(_0x3d17b0,null))[_0x75b7('0x28')](respondWithResult(_0x3d17b0,null))['catch'](handleError(_0x3d17b0,null));};exports['create']=function(_0x1312e8,_0x587f33){return db[_0x75b7('0x30')][_0x75b7('0x4a')](_0x1312e8[_0x75b7('0x4b')],{})[_0x75b7('0x28')](respondWithResult(_0x587f33,0xc9))[_0x75b7('0x4c')](handleError(_0x587f33,null));};exports[_0x75b7('0x26')]=function(_0x380d22,_0x283bb9){if(_0x380d22[_0x75b7('0x4b')]['id']){delete _0x380d22[_0x75b7('0x4b')]['id'];}return db[_0x75b7('0x30')][_0x75b7('0x49')]({'where':{'id':_0x380d22[_0x75b7('0x4d')]['id']}})[_0x75b7('0x28')](handleEntityNotFound(_0x283bb9,null))[_0x75b7('0x28')](saveUpdates(_0x380d22[_0x75b7('0x4b')],null))['then'](respondWithResult(_0x283bb9,null))['catch'](handleError(_0x283bb9,null));};exports[_0x75b7('0x27')]=function(_0x111d1c,_0x5a6e30){return db['VoiceQueueReport'][_0x75b7('0x49')]({'where':{'id':_0x111d1c['params']['id']}})[_0x75b7('0x28')](handleEntityNotFound(_0x5a6e30,null))[_0x75b7('0x28')](removeEntity(_0x5a6e30,null))['catch'](handleError(_0x5a6e30,null));};exports[_0x75b7('0x4e')]=function(_0x54c8f9,_0x3c4b27){return db['VoiceQueueReport'][_0x75b7('0x4e')]()[_0x75b7('0x28')](respondWithResult(_0x3c4b27,null))[_0x75b7('0x4c')](handleError(_0x3c4b27,null));};exports['getVoiceQueuesReport']=function(_0x3e4718,_0x5af595){var _0x24badf={},_0x4e22aa={},_0x188c8a={'count':0x0,'rows':[]};_0x4e22aa[_0x75b7('0x38')]=_['keys'](db['VoiceQueueReport'][_0x75b7('0x31')]);_0x4e22aa[_0x75b7('0x34')]=_[_0x75b7('0x35')](_0x3e4718[_0x75b7('0x34')]);_0x4e22aa[_0x75b7('0x36')]=_[_0x75b7('0x37')](_0x4e22aa[_0x75b7('0x38')],_0x4e22aa[_0x75b7('0x34')]);_0x24badf[_0x75b7('0x39')]=_[_0x75b7('0x37')](_0x4e22aa[_0x75b7('0x38')],qs[_0x75b7('0x3a')](_0x3e4718[_0x75b7('0x34')]['fields']));_0x24badf['attributes']=_0x24badf[_0x75b7('0x39')][_0x75b7('0x3b')]?_0x24badf['attributes']:_0x4e22aa[_0x75b7('0x38')];if(!_0x3e4718[_0x75b7('0x34')][_0x75b7('0x3c')](_0x75b7('0x3d'))){_0x24badf[_0x75b7('0x21')]=qs[_0x75b7('0x21')](_0x3e4718[_0x75b7('0x34')][_0x75b7('0x21')]);_0x24badf[_0x75b7('0x1f')]=qs['offset'](_0x3e4718[_0x75b7('0x34')][_0x75b7('0x1f')]);}_0x24badf['order']=qs[_0x75b7('0x3f')](_0x3e4718[_0x75b7('0x34')][_0x75b7('0x3f')]);_0x24badf[_0x75b7('0x40')]=qs[_0x75b7('0x36')](_[_0x75b7('0x41')](_0x3e4718[_0x75b7('0x34')],_0x4e22aa[_0x75b7('0x36')]));if(_0x3e4718[_0x75b7('0x34')][_0x75b7('0x42')]){_0x24badf[_0x75b7('0x40')]=_[_0x75b7('0x44')](_0x24badf[_0x75b7('0x40')],{'$or':_[_0x75b7('0x2f')](_0x24badf[_0x75b7('0x39')],function(_0x4ffafc){var _0x23c2a6={};_0x23c2a6[_0x4ffafc]={'$like':'%'+_0x3e4718[_0x75b7('0x34')]['filter']+'%'};return _0x23c2a6;})});}_0x24badf=_[_0x75b7('0x44')]({},_0x24badf,_0x3e4718[_0x75b7('0x45')]);var _0x22d8ca={'where':_0x24badf[_0x75b7('0x40')]};return db['VoiceQueueReport']['count'](_0x22d8ca)[_0x75b7('0x28')](function(_0x2a0d6c){_0x188c8a['count']=_0x2a0d6c;if(_0x3e4718['query'][_0x75b7('0x46')]){_0x24badf[_0x75b7('0x48')]=[{'all':!![]}];}return db[_0x75b7('0x30')][_0x75b7('0x4f')](_0x24badf);})['then'](function(_0x18bb24){_0x188c8a['rows']=_0x18bb24;return _0x188c8a;})[_0x75b7('0x28')](respondWithFilteredResult(_0x5af595,_0x24badf,_0x75b7('0x50')))[_0x75b7('0x4c')](handleError(_0x5af595,null,_0x75b7('0x50')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 40ca1be..2fa5bfa 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 _0x61fa=['hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save','update','emit'];(function(_0x1d95e9,_0x8f72e7){var _0x337999=function(_0x2669b9){while(--_0x2669b9){_0x1d95e9['push'](_0x1d95e9['shift']());}};_0x337999(++_0x8f72e7);}(_0x61fa,0x102));var _0xa61f=function(_0x497642,_0x55c481){_0x497642=_0x497642-0x0;var _0x351a14=_0x61fa[_0x497642];return _0x351a14;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xa61f('0x0'))['db'][_0xa61f('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xa61f('0x2')](0x0);var events={'afterCreate':_0xa61f('0x3'),'afterUpdate':_0xa61f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c7e57){return function(_0x8b382b,_0x5a71fe,_0x34d855){VoiceQueueReportEvents['emit'](_0x1c7e57+':'+_0x8b382b['id'],_0x8b382b);VoiceQueueReportEvents[_0xa61f('0x5')](_0x1c7e57,_0x8b382b);_0x34d855(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xa61f('0x6')](e,emitEvent(event));}}module[_0xa61f('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe25a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x5a0227,_0x43a1fe){var _0x560d6b=function(_0x4ccf5f){while(--_0x4ccf5f){_0x5a0227['push'](_0x5a0227['shift']());}};_0x560d6b(++_0x43a1fe);}(_0xe25a,0x1dc));var _0xae25=function(_0x246c9b,_0x155fcb){_0x246c9b=_0x246c9b-0x0;var _0x5f1555=_0xe25a[_0x246c9b];return _0x5f1555;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xae25('0x0')](0x0);var events={'afterCreate':_0xae25('0x1'),'afterUpdate':_0xae25('0x2'),'afterDestroy':_0xae25('0x3')};function emitEvent(_0x2770d5){return function(_0x162ddd,_0x1d4c4f,_0x27a46d){VoiceQueueReportEvents[_0xae25('0x4')](_0x2770d5+':'+_0x162ddd['id'],_0x162ddd);VoiceQueueReportEvents[_0xae25('0x4')](_0x2770d5,_0x162ddd);_0x27a46d(null);};}for(var e in events){if(events[_0xae25('0x5')](e)){var event=events[e];VoiceQueueReport[_0xae25('0x6')](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 4277aac..e20a068 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 _0x57af=['VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','api','bluebird'];(function(_0x467070,_0x393133){var _0x5a5575=function(_0x5881ff){while(--_0x5881ff){_0x467070['push'](_0x467070['shift']());}};_0x5a5575(++_0x393133);}(_0x57af,0x14c));var _0xf57a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x57af[_0x243b2f];return _0xcb3c2d;};'use strict';var _=require('lodash');var util=require(_0xf57a('0x0'));var logger=require(_0xf57a('0x1'))(_0xf57a('0x2'));var moment=require('moment');var BPromise=require(_0xf57a('0x3'));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('./voiceQueueReport.attributes');module['exports']=function(_0x791e61,_0x5d1675){return _0x791e61['define'](_0xf57a('0x4'),attributes,{'tableName':_0xf57a('0x5'),'paranoid':![],'indexes':[{'fields':[_0xf57a('0x6')]},{'fields':[_0xf57a('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xddb3=['calleridnum','lodash','bluebird','request-promise','path','rimraf','./voiceQueueReport.attributes','exports','define','report_queue','uniqueid'];(function(_0x4d24c3,_0x369b16){var _0x1ff57a=function(_0xc85e0b){while(--_0xc85e0b){_0x4d24c3['push'](_0x4d24c3['shift']());}};_0x1ff57a(++_0x369b16);}(_0xddb3,0x1a3));var _0x3ddb=function(_0x28accd,_0x1fef4c){_0x28accd=_0x28accd-0x0;var _0x449029=_0xddb3[_0x28accd];return _0x449029;};'use strict';var _=require(_0x3ddb('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3ddb('0x1'));var rp=require(_0x3ddb('0x2'));var fs=require('fs');var path=require(_0x3ddb('0x3'));var rimraf=require(_0x3ddb('0x4'));var config=require('../../config/environment');var attributes=require(_0x3ddb('0x5'));module[_0x3ddb('0x6')]=function(_0x5c9d43,_0x3b99cf){return _0x5c9d43[_0x3ddb('0x7')]('VoiceQueueReport',attributes,{'tableName':_0x3ddb('0x8'),'paranoid':![],'indexes':[{'fields':[_0x3ddb('0x9')]},{'fields':[_0x3ddb('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 01cdf6f..5e5f9d8 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 _0xb446=['./voiceQueueReport.socket','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','GetVoiceQueueReport','findAll','options','raw','where','limit','include','model','attributes','map','VoiceQueueReport','create','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4d7e3b,_0x5427f4){var _0xdb998f=function(_0x5981bc){while(--_0x5981bc){_0x4d7e3b['push'](_0x4d7e3b['shift']());}};_0xdb998f(++_0x5427f4);}(_0xb446,0x197));var _0x6b44=function(_0x42e98c,_0x1c6bb9){_0x42e98c=_0x42e98c-0x0;var _0x59803e=_0xb446[_0x42e98c];return _0x59803e;};'use strict';var _=require('lodash');var util=require(_0x6b44('0x0'));var moment=require('moment');var BPromise=require(_0x6b44('0x1'));var rs=require(_0x6b44('0x2'));var fs=require('fs');var Redis=require(_0x6b44('0x3'));var db=require(_0x6b44('0x4'))['db'];var utils=require(_0x6b44('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b44('0x6'));var jayson=require(_0x6b44('0x7'));var client=jayson['client'][_0x6b44('0x8')]({'port':0x232a});config[_0x6b44('0x9')]=_[_0x6b44('0xa')](config[_0x6b44('0x9')],{'host':_0x6b44('0xb'),'port':0x18eb});var socket=require(_0x6b44('0xc'))(new Redis(config[_0x6b44('0x9')]));require(_0x6b44('0xd'))[_0x6b44('0xe')](socket);function respondWithRpcPromise(_0x5c68d5,_0x47031c,_0x56556a){return new BPromise(function(_0x433080,_0x15a688){return client[_0x6b44('0xf')](_0x5c68d5,_0x56556a)[_0x6b44('0x10')](function(_0x264ce8){logger['info'](_0x6b44('0x11'),_0x47031c,'request\x20sent');logger[_0x6b44('0x12')](_0x6b44('0x13'),_0x47031c,'request\x20sent',JSON[_0x6b44('0x14')](_0x264ce8));if(_0x264ce8[_0x6b44('0x15')]){if(_0x264ce8['error'][_0x6b44('0x16')]===0x1f4){logger[_0x6b44('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x47031c,_0x264ce8[_0x6b44('0x15')][_0x6b44('0x17')]);return _0x15a688(_0x264ce8['error'][_0x6b44('0x17')]);}logger[_0x6b44('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x47031c,_0x264ce8[_0x6b44('0x15')][_0x6b44('0x17')]);return _0x433080(_0x264ce8[_0x6b44('0x15')][_0x6b44('0x17')]);}else{logger[_0x6b44('0x18')](_0x6b44('0x11'),_0x47031c,_0x6b44('0x19'));_0x433080(_0x264ce8['result']['message']);}})[_0x6b44('0x1a')](function(_0x26fcbd){logger['error'](_0x6b44('0x11'),_0x47031c,_0x26fcbd);_0x15a688(_0x26fcbd);});});}exports[_0x6b44('0x1b')]=function(_0x300cc1){var _0x350ea6=this;return new Promise(function(_0x2fff50,_0xc5f778){return db['VoiceQueueReport'][_0x6b44('0x1c')]({'raw':_0x300cc1[_0x6b44('0x1d')]?_0x300cc1[_0x6b44('0x1d')][_0x6b44('0x1e')]===undefined?!![]:![]:!![],'where':_0x300cc1[_0x6b44('0x1d')]?_0x300cc1[_0x6b44('0x1d')][_0x6b44('0x1f')]||null:null,'attributes':_0x300cc1[_0x6b44('0x1d')]?_0x300cc1['options']['attributes']||null:null,'limit':_0x300cc1[_0x6b44('0x1d')]?_0x300cc1[_0x6b44('0x1d')][_0x6b44('0x20')]||null:null,'include':_0x300cc1['options']?_0x300cc1[_0x6b44('0x1d')][_0x6b44('0x21')]?_['map'](_0x300cc1[_0x6b44('0x1d')][_0x6b44('0x21')],function(_0x49bce2){return{'model':db[_0x49bce2[_0x6b44('0x22')]],'as':_0x49bce2['as'],'attributes':_0x49bce2[_0x6b44('0x23')],'include':_0x49bce2['include']?_[_0x6b44('0x24')](_0x49bce2[_0x6b44('0x21')],function(_0x231f7c){return{'model':db[_0x231f7c[_0x6b44('0x22')]],'as':_0x231f7c['as'],'attributes':_0x231f7c[_0x6b44('0x23')],'include':_0x231f7c[_0x6b44('0x21')]?_[_0x6b44('0x24')](_0x231f7c['include'],function(_0x294a5b){return{'model':db[_0x294a5b[_0x6b44('0x22')]],'as':_0x294a5b['as'],'attributes':_0x294a5b[_0x6b44('0x23')]};}):[]};}):[]};}):[]:[]})[_0x6b44('0x10')](function(_0x49708e){logger['info'](_0x6b44('0x1b'),_0x300cc1);logger[_0x6b44('0x12')]('GetVoiceQueueReport',_0x300cc1,JSON['stringify'](_0x49708e));_0x2fff50(_0x49708e);})[_0x6b44('0x1a')](function(_0x5b3a97){logger[_0x6b44('0x15')](_0x6b44('0x1b'),_0x5b3a97[_0x6b44('0x17')],_0x300cc1);_0xc5f778(_0x350ea6[_0x6b44('0x15')](0x1f4,_0x5b3a97[_0x6b44('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x4034fa){var _0x594279=this;return new Promise(function(_0x43db5d,_0x2d0696){return db[_0x6b44('0x25')][_0x6b44('0x26')](_0x4034fa['body'],{'raw':_0x4034fa[_0x6b44('0x1d')]?_0x4034fa[_0x6b44('0x1d')][_0x6b44('0x1e')]===undefined?!![]:![]:!![]})[_0x6b44('0x10')](function(_0x5e9650){logger[_0x6b44('0x18')](_0x6b44('0x27'),_0x4034fa);logger['debug']('CreateVoiceQueueReport',_0x4034fa,JSON['stringify'](_0x5e9650));_0x43db5d(_0x5e9650);})['catch'](function(_0x4f78c2){logger[_0x6b44('0x15')](_0x6b44('0x27'),_0x4f78c2[_0x6b44('0x17')],_0x4034fa);_0x2d0696(_0x594279[_0x6b44('0x15')](0x1f4,_0x4f78c2['message']));});});};exports[_0x6b44('0x28')]=function(_0x5bfe65){var _0x404b7a=this;return new Promise(function(_0x5f3aa3,_0x2cdef8){return db[_0x6b44('0x25')][_0x6b44('0x29')](_0x5bfe65['body'],{'raw':_0x5bfe65[_0x6b44('0x1d')]?_0x5bfe65[_0x6b44('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5bfe65[_0x6b44('0x1d')]?_0x5bfe65['options'][_0x6b44('0x1f')]||null:null,'attributes':_0x5bfe65[_0x6b44('0x1d')]?_0x5bfe65[_0x6b44('0x1d')][_0x6b44('0x23')]||null:null,'limit':_0x5bfe65[_0x6b44('0x1d')]?_0x5bfe65[_0x6b44('0x1d')][_0x6b44('0x20')]||null:null})[_0x6b44('0x10')](function(_0x7aa29){logger[_0x6b44('0x18')](_0x6b44('0x28'),_0x5bfe65);logger['debug'](_0x6b44('0x28'),_0x5bfe65,JSON[_0x6b44('0x14')](_0x7aa29));_0x5f3aa3(_0x7aa29);})['catch'](function(_0x2f1001){logger['error'](_0x6b44('0x28'),_0x2f1001[_0x6b44('0x17')],_0x5bfe65);_0x2cdef8(_0x404b7a[_0x6b44('0x15')](0x1f4,_0x2f1001[_0x6b44('0x17')]));});});}; \ No newline at end of file +var _0x1700=['VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','limit','include','model','attributes','map','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','body','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x55f1fe,_0x2387e1){var _0x15adf7=function(_0x4475c7){while(--_0x4475c7){_0x55f1fe['push'](_0x55f1fe['shift']());}};_0x15adf7(++_0x2387e1);}(_0x1700,0x14e));var _0x0170=function(_0x11f519,_0x5c42b7){_0x11f519=_0x11f519-0x0;var _0x50786a=_0x1700[_0x11f519];return _0x50786a;};'use strict';var _=require(_0x0170('0x0'));var util=require(_0x0170('0x1'));var moment=require('moment');var BPromise=require(_0x0170('0x2'));var rs=require(_0x0170('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0170('0x4'))['db'];var utils=require(_0x0170('0x5'));var logger=require(_0x0170('0x6'))(_0x0170('0x7'));var config=require(_0x0170('0x8'));var jayson=require(_0x0170('0x9'));var client=jayson[_0x0170('0xa')][_0x0170('0xb')]({'port':0x232a});config[_0x0170('0xc')]=_[_0x0170('0xd')](config[_0x0170('0xc')],{'host':_0x0170('0xe'),'port':0x18eb});var socket=require(_0x0170('0xf'))(new Redis(config[_0x0170('0xc')]));require('./voiceQueueReport.socket')[_0x0170('0x10')](socket);function respondWithRpcPromise(_0x3a9b7c,_0x28582d,_0x375eb5){return new BPromise(function(_0x258d48,_0x127084){return client[_0x0170('0x11')](_0x3a9b7c,_0x375eb5)[_0x0170('0x12')](function(_0x5f401c){logger[_0x0170('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x28582d,_0x0170('0x14'));logger[_0x0170('0x15')](_0x0170('0x16'),_0x28582d,_0x0170('0x14'),JSON[_0x0170('0x17')](_0x5f401c));if(_0x5f401c['error']){if(_0x5f401c[_0x0170('0x18')][_0x0170('0x19')]===0x1f4){logger[_0x0170('0x18')](_0x0170('0x1a'),_0x28582d,_0x5f401c[_0x0170('0x18')][_0x0170('0x1b')]);return _0x127084(_0x5f401c[_0x0170('0x18')]['message']);}logger['error'](_0x0170('0x1a'),_0x28582d,_0x5f401c[_0x0170('0x18')][_0x0170('0x1b')]);return _0x258d48(_0x5f401c[_0x0170('0x18')][_0x0170('0x1b')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x28582d,'request\x20sent');_0x258d48(_0x5f401c[_0x0170('0x1c')][_0x0170('0x1b')]);}})[_0x0170('0x1d')](function(_0x316825){logger[_0x0170('0x18')](_0x0170('0x1a'),_0x28582d,_0x316825);_0x127084(_0x316825);});});}exports[_0x0170('0x1e')]=function(_0x18fd63){var _0x51051c=this;return new Promise(function(_0x3d22e2,_0x556e86){return db[_0x0170('0x1f')][_0x0170('0x20')]({'raw':_0x18fd63['options']?_0x18fd63[_0x0170('0x21')][_0x0170('0x22')]===undefined?!![]:![]:!![],'where':_0x18fd63[_0x0170('0x21')]?_0x18fd63[_0x0170('0x21')][_0x0170('0x23')]||null:null,'attributes':_0x18fd63['options']?_0x18fd63[_0x0170('0x21')]['attributes']||null:null,'limit':_0x18fd63['options']?_0x18fd63['options'][_0x0170('0x24')]||null:null,'include':_0x18fd63[_0x0170('0x21')]?_0x18fd63[_0x0170('0x21')]['include']?_['map'](_0x18fd63[_0x0170('0x21')][_0x0170('0x25')],function(_0x2dd296){return{'model':db[_0x2dd296[_0x0170('0x26')]],'as':_0x2dd296['as'],'attributes':_0x2dd296[_0x0170('0x27')],'include':_0x2dd296[_0x0170('0x25')]?_[_0x0170('0x28')](_0x2dd296[_0x0170('0x25')],function(_0x4ac47a){return{'model':db[_0x4ac47a['model']],'as':_0x4ac47a['as'],'attributes':_0x4ac47a[_0x0170('0x27')],'include':_0x4ac47a[_0x0170('0x25')]?_[_0x0170('0x28')](_0x4ac47a[_0x0170('0x25')],function(_0x495072){return{'model':db[_0x495072[_0x0170('0x26')]],'as':_0x495072['as'],'attributes':_0x495072['attributes']};}):[]};}):[]};}):[]:[]})[_0x0170('0x12')](function(_0x5f38d4){logger[_0x0170('0x13')](_0x0170('0x1e'),_0x18fd63);logger['debug']('GetVoiceQueueReport',_0x18fd63,JSON[_0x0170('0x17')](_0x5f38d4));_0x3d22e2(_0x5f38d4);})[_0x0170('0x1d')](function(_0x2f1d55){logger[_0x0170('0x18')](_0x0170('0x1e'),_0x2f1d55[_0x0170('0x1b')],_0x18fd63);_0x556e86(_0x51051c[_0x0170('0x18')](0x1f4,_0x2f1d55[_0x0170('0x1b')]));});});};exports[_0x0170('0x29')]=function(_0x1e50e8){var _0x43f505=this;return new Promise(function(_0x81b2fa,_0xc92cb8){return db[_0x0170('0x1f')]['create'](_0x1e50e8['body'],{'raw':_0x1e50e8[_0x0170('0x21')]?_0x1e50e8[_0x0170('0x21')][_0x0170('0x22')]===undefined?!![]:![]:!![]})['then'](function(_0x412cb4){logger['info'](_0x0170('0x29'),_0x1e50e8);logger[_0x0170('0x15')](_0x0170('0x29'),_0x1e50e8,JSON[_0x0170('0x17')](_0x412cb4));_0x81b2fa(_0x412cb4);})[_0x0170('0x1d')](function(_0xd8121d){logger[_0x0170('0x18')]('CreateVoiceQueueReport',_0xd8121d[_0x0170('0x1b')],_0x1e50e8);_0xc92cb8(_0x43f505[_0x0170('0x18')](0x1f4,_0xd8121d[_0x0170('0x1b')]));});});};exports[_0x0170('0x2a')]=function(_0xcd97f7){var _0x172e59=this;return new Promise(function(_0x2f8fe9,_0x1bb170){return db[_0x0170('0x1f')][_0x0170('0x2b')](_0xcd97f7[_0x0170('0x2c')],{'raw':_0xcd97f7[_0x0170('0x21')]?_0xcd97f7[_0x0170('0x21')][_0x0170('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xcd97f7['options']?_0xcd97f7[_0x0170('0x21')][_0x0170('0x23')]||null:null,'attributes':_0xcd97f7[_0x0170('0x21')]?_0xcd97f7['options'][_0x0170('0x27')]||null:null,'limit':_0xcd97f7['options']?_0xcd97f7['options']['limit']||null:null})['then'](function(_0x14f037){logger[_0x0170('0x13')](_0x0170('0x2a'),_0xcd97f7);logger[_0x0170('0x15')](_0x0170('0x2a'),_0xcd97f7,JSON[_0x0170('0x17')](_0x14f037));_0x2f8fe9(_0x14f037);})['catch'](function(_0x1e2c27){logger[_0x0170('0x18')](_0x0170('0x2a'),_0x1e2c27[_0x0170('0x1b')],_0xcd97f7);_0x1bb170(_0x172e59[_0x0170('0x18')](0x1f4,_0x1e2c27[_0x0170('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 15a8bc0..b10567f 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 _0x0f3c=['voiceQueueReport:','./voiceQueueReport.events','save','emit','removeListener','register','length'];(function(_0x11a722,_0x387175){var _0x412e25=function(_0x334202){while(--_0x334202){_0x11a722['push'](_0x11a722['shift']());}};_0x412e25(++_0x387175);}(_0x0f3c,0x189));var _0xc0f3=function(_0x1f00dc,_0x536acb){_0x1f00dc=_0x1f00dc-0x0;var _0x27e117=_0x0f3c[_0x1f00dc];return _0x27e117;};'use strict';var VoiceQueueReportEvents=require(_0xc0f3('0x0'));var events=[_0xc0f3('0x1'),'remove','update'];function createListener(_0x4fe464,_0x7999f0){return function(_0x4648a5){_0x7999f0[_0xc0f3('0x2')](_0x4fe464,_0x4648a5);};}function removeListener(_0x2d1f5d,_0x1be43d){return function(){VoiceQueueReportEvents[_0xc0f3('0x3')](_0x2d1f5d,_0x1be43d);};}exports[_0xc0f3('0x4')]=function(_0x256643){for(var _0x4b76a0=0x0,_0x37d939=events[_0xc0f3('0x5')];_0x4b76a0<_0x37d939;_0x4b76a0++){var _0x48fc5d=events[_0x4b76a0];var _0x435864=createListener(_0xc0f3('0x6')+_0x48fc5d,_0x256643);VoiceQueueReportEvents['on'](_0x48fc5d,_0x435864);}}; \ No newline at end of file +var _0x446c=['./voiceQueueReport.events','save','remove','update','emit','voiceQueueReport:'];(function(_0x3ee5cd,_0x3023f6){var _0x593fa4=function(_0x266f68){while(--_0x266f68){_0x3ee5cd['push'](_0x3ee5cd['shift']());}};_0x593fa4(++_0x3023f6);}(_0x446c,0x156));var _0xc446=function(_0x3be7ff,_0x12e714){_0x3be7ff=_0x3be7ff-0x0;var _0x186721=_0x446c[_0x3be7ff];return _0x186721;};'use strict';var VoiceQueueReportEvents=require(_0xc446('0x0'));var events=[_0xc446('0x1'),_0xc446('0x2'),_0xc446('0x3')];function createListener(_0x48222e,_0x303cd0){return function(_0x2136f6){_0x303cd0[_0xc446('0x4')](_0x48222e,_0x2136f6);};}function removeListener(_0x570a67,_0x10047a){return function(){VoiceQueueReportEvents['removeListener'](_0x570a67,_0x10047a);};}exports['register']=function(_0x115a9e){for(var _0x235050=0x0,_0x578895=events['length'];_0x235050<_0x578895;_0x235050++){var _0x2eea75=events[_0x235050];var _0x3e9e70=createListener(_0xc446('0x5')+_0x2eea75,_0x115a9e);VoiceQueueReportEvents['on'](_0x2eea75,_0x3e9e70);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 32bc90e..3c9e702 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 _0x26cf=['put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create'];(function(_0xb0f6bd,_0x5a87fb){var _0xb5292e=function(_0x50c8cf){while(--_0x50c8cf){_0xb0f6bd['push'](_0xb0f6bd['shift']());}};_0xb5292e(++_0x5a87fb);}(_0x26cf,0x135));var _0xf26c=function(_0x1b2b88,_0x119cb7){_0x1b2b88=_0x1b2b88-0x0;var _0x421efa=_0x26cf[_0x1b2b88];return _0x421efa;};'use strict';var multer=require('multer');var util=require(_0xf26c('0x0'));var path=require(_0xf26c('0x1'));var timeout=require('connect-timeout');var express=require(_0xf26c('0x2'));var router=express['Router']();var fs_extra=require(_0xf26c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xf26c('0x4'));var config=require(_0xf26c('0x5'));var controller=require('./voiceQueuesLog.controller');router[_0xf26c('0x6')]('/',auth[_0xf26c('0x7')](),controller[_0xf26c('0x8')]);router[_0xf26c('0x6')](_0xf26c('0x9'),auth[_0xf26c('0x7')](),controller['show']);router['post']('/',auth[_0xf26c('0x7')](),controller[_0xf26c('0xa')]);router[_0xf26c('0xb')](_0xf26c('0x9'),auth[_0xf26c('0x7')](),controller[_0xf26c('0xc')]);router[_0xf26c('0xd')](_0xf26c('0x9'),auth['isAuthenticated'](),controller[_0xf26c('0xe')]);module[_0xf26c('0xf')]=router; \ No newline at end of file +var _0xdfaa=['index','/:id','show','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0xdfaa,0x14a));var _0xadfa=function(_0x1c9257,_0x56c1e8){_0x1c9257=_0x1c9257-0x0;var _0x4487db=_0xdfaa[_0x1c9257];return _0x4487db;};'use strict';var multer=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var path=require(_0xadfa('0x2'));var timeout=require(_0xadfa('0x3'));var express=require(_0xadfa('0x4'));var router=express['Router']();var fs_extra=require(_0xadfa('0x5'));var auth=require(_0xadfa('0x6'));var interaction=require(_0xadfa('0x7'));var config=require(_0xadfa('0x8'));var controller=require(_0xadfa('0x9'));router[_0xadfa('0xa')]('/',auth[_0xadfa('0xb')](),controller[_0xadfa('0xc')]);router[_0xadfa('0xa')](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xadfa('0xd'),auth[_0xadfa('0xb')](),controller[_0xadfa('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xadfa('0x10')]);module[_0xadfa('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index d61b110..29e2c3f 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 _0x3d32=['DATE','sequelize','STRING'];(function(_0xe36749,_0x2a45c8){var _0x5d86b7=function(_0x1219e5){while(--_0x1219e5){_0xe36749['push'](_0xe36749['shift']());}};_0x5d86b7(++_0x2a45c8);}(_0x3d32,0x13c));var _0x23d3=function(_0x35284c,_0x323c72){_0x35284c=_0x35284c-0x0;var _0x3665ec=_0x3d32[_0x35284c];return _0x3665ec;};'use strict';var Sequelize=require(_0x23d3('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x23d3('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x23d3('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x23d3('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x23d3('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x23d3('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x23d3('0x2')],'allowNull':![],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file +var _0x71f3=['exports','STRING','YYYY-MM-DD\x20HH:mm:ss','sequelize'];(function(_0xe7be45,_0x10856b){var _0x5a193d=function(_0x5acd21){while(--_0x5acd21){_0xe7be45['push'](_0xe7be45['shift']());}};_0x5a193d(++_0x10856b);}(_0x71f3,0x13f));var _0x371f=function(_0x5b4e76,_0x567169){_0x5b4e76=_0x5b4e76-0x0;var _0x4c12db=_0x71f3[_0x5b4e76];return _0x4c12db;};'use strict';var Sequelize=require(_0x371f('0x0'));var moment=require('moment');module[_0x371f('0x1')]={'time':{'type':Sequelize[_0x371f('0x2')]},'callid':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x371f('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()['format'](_0x371f('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2d3de0d..cf7dddf 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 _0xd9ec=['order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','keys','VoiceQueuesLog','rawAttributes','length','includeAll','options','create','body','update','find','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','then','status','error','stack','name','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x24fc05,_0x5be194){var _0x2577e2=function(_0x5dbda8){while(--_0x5dbda8){_0x24fc05['push'](_0x24fc05['shift']());}};_0x2577e2(++_0x5be194);}(_0xd9ec,0x1a3));var _0xcd9e=function(_0x1f4533,_0xa9d930){_0x1f4533=_0x1f4533-0x0;var _0x5f1483=_0xd9ec[_0x1f4533];return _0x5f1483;};'use strict';var emlformat=require(_0xcd9e('0x0'));var rimraf=require(_0xcd9e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd9e('0x2'));var rp=require(_0xcd9e('0x3'));var moment=require(_0xcd9e('0x4'));var BPromise=require(_0xcd9e('0x5'));var Mustache=require('mustache');var util=require(_0xcd9e('0x6'));var path=require(_0xcd9e('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xcd9e('0x8'));var fs=require('fs');var fs_extra=require(_0xcd9e('0x9'));var _=require(_0xcd9e('0xa'));var squel=require(_0xcd9e('0xb'));var crypto=require(_0xcd9e('0xc'));var jsforce=require(_0xcd9e('0xd'));var deskjs=require(_0xcd9e('0xe'));var toCsv=require(_0xcd9e('0xf'));var querystring=require(_0xcd9e('0x10'));var Papa=require('papaparse');var Redis=require(_0xcd9e('0x11'));var authService=require(_0xcd9e('0x12'));var qs=require(_0xcd9e('0x13'));var as=require(_0xcd9e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcd9e('0x15'));var utils=require(_0xcd9e('0x16'));var config=require(_0xcd9e('0x17'));var licenseUtil=require(_0xcd9e('0x18'));var db=require(_0xcd9e('0x19'))['db'];function respondWithStatusCode(_0x4ddb49,_0x39316d){_0x39316d=_0x39316d||0xcc;return function(_0x58adcc){if(_0x58adcc){return _0x4ddb49[_0xcd9e('0x1a')](_0x39316d);}return _0x4ddb49['status'](_0x39316d)[_0xcd9e('0x1b')]();};}function respondWithResult(_0x100555,_0x5dad65){_0x5dad65=_0x5dad65||0xc8;return function(_0xcb4806){if(_0xcb4806){return _0x100555['status'](_0x5dad65)[_0xcd9e('0x1c')](_0xcb4806);}};}function respondWithFilteredResult(_0x2626f2,_0x315207){return function(_0x2a53f3){if(_0x2a53f3){var _0xf55a3c=typeof _0x315207['offset']===_0xcd9e('0x1d')&&typeof _0x315207[_0xcd9e('0x1e')]===_0xcd9e('0x1d');var _0x3c523b=_0x2a53f3['count'];var _0x48ad2f=_0xf55a3c?0x0:_0x315207[_0xcd9e('0x1f')];var _0x433c86=_0xf55a3c?_0x2a53f3[_0xcd9e('0x20')]:_0x315207[_0xcd9e('0x1f')]+_0x315207[_0xcd9e('0x1e')];var _0x5cd802;if(_0x433c86>=_0x3c523b){_0x433c86=_0x3c523b;_0x5cd802=0xc8;}else{_0x5cd802=0xce;}_0x2626f2['status'](_0x5cd802);return _0x2626f2[_0xcd9e('0x21')](_0xcd9e('0x22'),_0x48ad2f+'-'+_0x433c86+'/'+_0x3c523b)[_0xcd9e('0x1c')](_0x2a53f3);}return null;};}function patchUpdates(_0x1218b0){return function(_0x2b767c){try{jsonpatch[_0xcd9e('0x23')](_0x2b767c,_0x1218b0,!![]);}catch(_0x57f608){return BPromise['reject'](_0x57f608);}return _0x2b767c[_0xcd9e('0x24')]();};}function saveUpdates(_0x4a672d,_0x4a9414){return function(_0x379e47){if(_0x379e47){return _0x379e47['update'](_0x4a672d)[_0xcd9e('0x25')](function(_0x1afedb){return _0x1afedb;});}return null;};}function removeEntity(_0x3f2089,_0x5323bb){return function(_0x3728a3){if(_0x3728a3){return _0x3728a3['destroy']()[_0xcd9e('0x25')](function(){_0x3f2089[_0xcd9e('0x26')](0xcc)[_0xcd9e('0x1b')]();});}};}function handleEntityNotFound(_0x279da5,_0x39af25){return function(_0x4bad04){if(!_0x4bad04){_0x279da5[_0xcd9e('0x1a')](0x194);}return _0x4bad04;};}function handleError(_0x50eb7d,_0x4355b0){_0x4355b0=_0x4355b0||0x1f4;return function(_0x4035d8){logger[_0xcd9e('0x27')](_0x4035d8[_0xcd9e('0x28')]);if(_0x4035d8[_0xcd9e('0x29')]){delete _0x4035d8[_0xcd9e('0x29')];}_0x50eb7d['status'](_0x4355b0)['send'](_0x4035d8);};}exports[_0xcd9e('0x2a')]=function(_0x36b89b,_0x2d532d){var _0x42753a={},_0x5bb55a={},_0x192f6a={'count':0x0,'rows':[]};var _0x3e3a44=_[_0xcd9e('0x2b')](db['VoiceQueuesLog']['rawAttributes'],function(_0x3c6f68){return{'name':_0x3c6f68[_0xcd9e('0x2c')],'type':_0x3c6f68[_0xcd9e('0x2d')][_0xcd9e('0x2e')]};});_0x5bb55a[_0xcd9e('0x2f')]=_[_0xcd9e('0x2b')](_0x3e3a44,'name');_0x5bb55a[_0xcd9e('0x30')]=_['keys'](_0x36b89b[_0xcd9e('0x30')]);_0x5bb55a[_0xcd9e('0x31')]=_['intersection'](_0x5bb55a['model'],_0x5bb55a[_0xcd9e('0x30')]);_0x42753a[_0xcd9e('0x32')]=_[_0xcd9e('0x33')](_0x5bb55a[_0xcd9e('0x2f')],qs[_0xcd9e('0x34')](_0x36b89b[_0xcd9e('0x30')][_0xcd9e('0x34')]));_0x42753a[_0xcd9e('0x32')]=_0x42753a[_0xcd9e('0x32')]['length']?_0x42753a['attributes']:_0x5bb55a[_0xcd9e('0x2f')];if(!_0x36b89b[_0xcd9e('0x30')][_0xcd9e('0x35')](_0xcd9e('0x36'))){_0x42753a[_0xcd9e('0x1e')]=qs['limit'](_0x36b89b['query'][_0xcd9e('0x1e')]);_0x42753a['offset']=qs[_0xcd9e('0x1f')](_0x36b89b[_0xcd9e('0x30')]['offset']);}_0x42753a[_0xcd9e('0x37')]=qs[_0xcd9e('0x38')](_0x36b89b[_0xcd9e('0x30')]['sort']);_0x42753a[_0xcd9e('0x39')]=qs[_0xcd9e('0x31')](_[_0xcd9e('0x3a')](_0x36b89b['query'],_0x5bb55a[_0xcd9e('0x31')]),_0x3e3a44);if(_0x36b89b['query'][_0xcd9e('0x3b')]){_0x42753a[_0xcd9e('0x39')]=_[_0xcd9e('0x3c')](_0x42753a[_0xcd9e('0x39')],{'$or':_[_0xcd9e('0x2b')](_0x3e3a44,function(_0x1d22fe){if(_0x1d22fe['type']!==_0xcd9e('0x3d')){var _0x354def={};_0x354def[_0x1d22fe[_0xcd9e('0x29')]]={'$like':'%'+_0x36b89b[_0xcd9e('0x30')][_0xcd9e('0x3b')]+'%'};return _0x354def;}})});}_0x42753a=_[_0xcd9e('0x3c')]({},_0x42753a,_0x36b89b['options']);var _0x5bfe09={'where':_0x42753a[_0xcd9e('0x39')]};return db['VoiceQueuesLog'][_0xcd9e('0x20')](_0x5bfe09)[_0xcd9e('0x25')](function(_0x581a91){_0x192f6a[_0xcd9e('0x20')]=_0x581a91;if(_0x36b89b[_0xcd9e('0x30')]['includeAll']){_0x42753a[_0xcd9e('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xcd9e('0x3f')](_0x42753a);})[_0xcd9e('0x25')](function(_0x39496e){_0x192f6a[_0xcd9e('0x40')]=_0x39496e;return _0x192f6a;})[_0xcd9e('0x25')](respondWithFilteredResult(_0x2d532d,_0x42753a))[_0xcd9e('0x41')](handleError(_0x2d532d,null));};exports[_0xcd9e('0x42')]=function(_0x1b81ab,_0x48ef16){var _0x23511c={'raw':!![],'where':{'id':_0x1b81ab['params']['id']}},_0xec6387={};_0xec6387[_0xcd9e('0x2f')]=_[_0xcd9e('0x43')](db[_0xcd9e('0x44')][_0xcd9e('0x45')]);_0xec6387[_0xcd9e('0x30')]=_[_0xcd9e('0x43')](_0x1b81ab[_0xcd9e('0x30')]);_0xec6387[_0xcd9e('0x31')]=_[_0xcd9e('0x33')](_0xec6387[_0xcd9e('0x2f')],_0xec6387[_0xcd9e('0x30')]);_0x23511c['attributes']=_[_0xcd9e('0x33')](_0xec6387[_0xcd9e('0x2f')],qs[_0xcd9e('0x34')](_0x1b81ab['query'][_0xcd9e('0x34')]));_0x23511c[_0xcd9e('0x32')]=_0x23511c[_0xcd9e('0x32')][_0xcd9e('0x46')]?_0x23511c[_0xcd9e('0x32')]:_0xec6387[_0xcd9e('0x2f')];if(_0x1b81ab[_0xcd9e('0x30')][_0xcd9e('0x47')]){_0x23511c['include']=[{'all':!![]}];}_0x23511c=_['merge']({},_0x23511c,_0x1b81ab[_0xcd9e('0x48')]);return db[_0xcd9e('0x44')]['find'](_0x23511c)[_0xcd9e('0x25')](handleEntityNotFound(_0x48ef16,null))[_0xcd9e('0x25')](respondWithResult(_0x48ef16,null))[_0xcd9e('0x41')](handleError(_0x48ef16,null));};exports[_0xcd9e('0x49')]=function(_0x105b3f,_0x4ed9e0){return db['VoiceQueuesLog'][_0xcd9e('0x49')](_0x105b3f[_0xcd9e('0x4a')],{})[_0xcd9e('0x25')](respondWithResult(_0x4ed9e0,0xc9))[_0xcd9e('0x41')](handleError(_0x4ed9e0,null));};exports[_0xcd9e('0x4b')]=function(_0x462396,_0x585b0e){if(_0x462396[_0xcd9e('0x4a')]['id']){delete _0x462396[_0xcd9e('0x4a')]['id'];}return db[_0xcd9e('0x44')][_0xcd9e('0x4c')]({'where':{'id':_0x462396['params']['id']}})[_0xcd9e('0x25')](handleEntityNotFound(_0x585b0e,null))['then'](saveUpdates(_0x462396['body'],null))[_0xcd9e('0x25')](respondWithResult(_0x585b0e,null))['catch'](handleError(_0x585b0e,null));};exports[_0xcd9e('0x4d')]=function(_0x1ed072,_0x56f6d1){return db['VoiceQueuesLog'][_0xcd9e('0x4c')]({'where':{'id':_0x1ed072[_0xcd9e('0x4e')]['id']}})['then'](handleEntityNotFound(_0x56f6d1,null))[_0xcd9e('0x25')](removeEntity(_0x56f6d1,null))[_0xcd9e('0x41')](handleError(_0x56f6d1,null));}; \ No newline at end of file +var _0xf108=['params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','name','index','map','VoiceQueuesLog','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','includeAll','findAll','rows','catch','show'];(function(_0x3c7e14,_0x2c92ff){var _0x5e3c07=function(_0x4ee899){while(--_0x4ee899){_0x3c7e14['push'](_0x3c7e14['shift']());}};_0x5e3c07(++_0x2c92ff);}(_0xf108,0xde));var _0x8f10=function(_0x2f3093,_0x43b41e){_0x2f3093=_0x2f3093-0x0;var _0x4bab08=_0xf108[_0x2f3093];return _0x4bab08;};'use strict';var emlformat=require(_0x8f10('0x0'));var rimraf=require(_0x8f10('0x1'));var zipdir=require(_0x8f10('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8f10('0x3'));var moment=require(_0x8f10('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8f10('0x5'));var util=require(_0x8f10('0x6'));var path=require(_0x8f10('0x7'));var sox=require(_0x8f10('0x8'));var csv=require(_0x8f10('0x9'));var ejs=require(_0x8f10('0xa'));var fs=require('fs');var fs_extra=require(_0x8f10('0xb'));var _=require(_0x8f10('0xc'));var squel=require(_0x8f10('0xd'));var crypto=require(_0x8f10('0xe'));var jsforce=require(_0x8f10('0xf'));var deskjs=require(_0x8f10('0x10'));var toCsv=require(_0x8f10('0x9'));var querystring=require('querystring');var Papa=require(_0x8f10('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8f10('0x12'));var hardwareService=require(_0x8f10('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x8f10('0x14'));var licenseUtil=require(_0x8f10('0x15'));var db=require(_0x8f10('0x16'))['db'];function respondWithStatusCode(_0x18b9a3,_0x151dac){_0x151dac=_0x151dac||0xcc;return function(_0x416da1){if(_0x416da1){return _0x18b9a3['sendStatus'](_0x151dac);}return _0x18b9a3[_0x8f10('0x17')](_0x151dac)['end']();};}function respondWithResult(_0x51e554,_0x25ec2c){_0x25ec2c=_0x25ec2c||0xc8;return function(_0x5426a9){if(_0x5426a9){return _0x51e554[_0x8f10('0x17')](_0x25ec2c)[_0x8f10('0x18')](_0x5426a9);}};}function respondWithFilteredResult(_0x402482,_0x33b584){return function(_0xc29e17){if(_0xc29e17){var _0xa21e03=typeof _0x33b584[_0x8f10('0x19')]===_0x8f10('0x1a')&&typeof _0x33b584[_0x8f10('0x1b')]===_0x8f10('0x1a');var _0x655ad6=_0xc29e17[_0x8f10('0x1c')];var _0x559bb4=_0xa21e03?0x0:_0x33b584['offset'];var _0x1ec4b2=_0xa21e03?_0xc29e17[_0x8f10('0x1c')]:_0x33b584[_0x8f10('0x19')]+_0x33b584['limit'];var _0x5d0bd0;if(_0x1ec4b2>=_0x655ad6){_0x1ec4b2=_0x655ad6;_0x5d0bd0=0xc8;}else{_0x5d0bd0=0xce;}_0x402482[_0x8f10('0x17')](_0x5d0bd0);return _0x402482[_0x8f10('0x1d')](_0x8f10('0x1e'),_0x559bb4+'-'+_0x1ec4b2+'/'+_0x655ad6)[_0x8f10('0x18')](_0xc29e17);}return null;};}function patchUpdates(_0xb94aa0){return function(_0xe378eb){try{jsonpatch[_0x8f10('0x1f')](_0xe378eb,_0xb94aa0,!![]);}catch(_0x2e5436){return BPromise[_0x8f10('0x20')](_0x2e5436);}return _0xe378eb[_0x8f10('0x21')]();};}function saveUpdates(_0x41501d,_0x59b879){return function(_0x91e9ca){if(_0x91e9ca){return _0x91e9ca[_0x8f10('0x22')](_0x41501d)[_0x8f10('0x23')](function(_0x36f95d){return _0x36f95d;});}return null;};}function removeEntity(_0x1f3de5,_0x1eeebb){return function(_0x3bb7d8){if(_0x3bb7d8){return _0x3bb7d8['destroy']()['then'](function(){_0x1f3de5[_0x8f10('0x17')](0xcc)[_0x8f10('0x24')]();});}};}function handleEntityNotFound(_0x4b4630,_0x5e48a3){return function(_0x2918e0){if(!_0x2918e0){_0x4b4630[_0x8f10('0x25')](0x194);}return _0x2918e0;};}function handleError(_0x2b37e7,_0x407faf){_0x407faf=_0x407faf||0x1f4;return function(_0x1ddbb3){logger['error'](_0x1ddbb3['stack']);if(_0x1ddbb3[_0x8f10('0x26')]){delete _0x1ddbb3['name'];}_0x2b37e7[_0x8f10('0x17')](_0x407faf)['send'](_0x1ddbb3);};}exports[_0x8f10('0x27')]=function(_0x49944d,_0x134671){var _0x49396b={},_0x3841c={},_0x5e7650={'count':0x0,'rows':[]};var _0x179366=_[_0x8f10('0x28')](db[_0x8f10('0x29')]['rawAttributes'],function(_0x506496){return{'name':_0x506496[_0x8f10('0x2a')],'type':_0x506496['type'][_0x8f10('0x2b')]};});_0x3841c[_0x8f10('0x2c')]=_['map'](_0x179366,_0x8f10('0x26'));_0x3841c[_0x8f10('0x2d')]=_[_0x8f10('0x2e')](_0x49944d[_0x8f10('0x2d')]);_0x3841c[_0x8f10('0x2f')]=_['intersection'](_0x3841c[_0x8f10('0x2c')],_0x3841c[_0x8f10('0x2d')]);_0x49396b[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x3841c[_0x8f10('0x2c')],qs[_0x8f10('0x32')](_0x49944d[_0x8f10('0x2d')][_0x8f10('0x32')]));_0x49396b[_0x8f10('0x30')]=_0x49396b[_0x8f10('0x30')]['length']?_0x49396b[_0x8f10('0x30')]:_0x3841c[_0x8f10('0x2c')];if(!_0x49944d[_0x8f10('0x2d')][_0x8f10('0x33')](_0x8f10('0x34'))){_0x49396b[_0x8f10('0x1b')]=qs[_0x8f10('0x1b')](_0x49944d[_0x8f10('0x2d')][_0x8f10('0x1b')]);_0x49396b['offset']=qs['offset'](_0x49944d[_0x8f10('0x2d')][_0x8f10('0x19')]);}_0x49396b[_0x8f10('0x35')]=qs[_0x8f10('0x36')](_0x49944d[_0x8f10('0x2d')][_0x8f10('0x36')]);_0x49396b['where']=qs[_0x8f10('0x2f')](_[_0x8f10('0x37')](_0x49944d[_0x8f10('0x2d')],_0x3841c[_0x8f10('0x2f')]),_0x179366);if(_0x49944d['query']['filter']){_0x49396b[_0x8f10('0x38')]=_[_0x8f10('0x39')](_0x49396b[_0x8f10('0x38')],{'$or':_[_0x8f10('0x28')](_0x179366,function(_0x15ad3b){if(_0x15ad3b[_0x8f10('0x3a')]!=='VIRTUAL'){var _0x50cf01={};_0x50cf01[_0x15ad3b[_0x8f10('0x26')]]={'$like':'%'+_0x49944d['query'][_0x8f10('0x3b')]+'%'};return _0x50cf01;}})});}_0x49396b=_['merge']({},_0x49396b,_0x49944d[_0x8f10('0x3c')]);var _0x469699={'where':_0x49396b[_0x8f10('0x38')]};return db[_0x8f10('0x29')][_0x8f10('0x1c')](_0x469699)[_0x8f10('0x23')](function(_0x4bfdd1){_0x5e7650[_0x8f10('0x1c')]=_0x4bfdd1;if(_0x49944d['query'][_0x8f10('0x3d')]){_0x49396b['include']=[{'all':!![]}];}return db[_0x8f10('0x29')][_0x8f10('0x3e')](_0x49396b);})[_0x8f10('0x23')](function(_0x95e90e){_0x5e7650[_0x8f10('0x3f')]=_0x95e90e;return _0x5e7650;})[_0x8f10('0x23')](respondWithFilteredResult(_0x134671,_0x49396b))[_0x8f10('0x40')](handleError(_0x134671,null));};exports[_0x8f10('0x41')]=function(_0x3e7e8f,_0x30d4f0){var _0x279c58={'raw':!![],'where':{'id':_0x3e7e8f[_0x8f10('0x42')]['id']}},_0x5d4907={};_0x5d4907[_0x8f10('0x2c')]=_['keys'](db[_0x8f10('0x29')][_0x8f10('0x43')]);_0x5d4907[_0x8f10('0x2d')]=_[_0x8f10('0x2e')](_0x3e7e8f[_0x8f10('0x2d')]);_0x5d4907['filters']=_[_0x8f10('0x31')](_0x5d4907[_0x8f10('0x2c')],_0x5d4907[_0x8f10('0x2d')]);_0x279c58[_0x8f10('0x30')]=_[_0x8f10('0x31')](_0x5d4907[_0x8f10('0x2c')],qs[_0x8f10('0x32')](_0x3e7e8f[_0x8f10('0x2d')][_0x8f10('0x32')]));_0x279c58[_0x8f10('0x30')]=_0x279c58['attributes']['length']?_0x279c58[_0x8f10('0x30')]:_0x5d4907[_0x8f10('0x2c')];if(_0x3e7e8f['query']['includeAll']){_0x279c58[_0x8f10('0x44')]=[{'all':!![]}];}_0x279c58=_[_0x8f10('0x39')]({},_0x279c58,_0x3e7e8f[_0x8f10('0x3c')]);return db[_0x8f10('0x29')][_0x8f10('0x45')](_0x279c58)['then'](handleEntityNotFound(_0x30d4f0,null))[_0x8f10('0x23')](respondWithResult(_0x30d4f0,null))[_0x8f10('0x40')](handleError(_0x30d4f0,null));};exports[_0x8f10('0x46')]=function(_0x2921e2,_0x47b0a5){return db[_0x8f10('0x29')][_0x8f10('0x46')](_0x2921e2[_0x8f10('0x47')],{})[_0x8f10('0x23')](respondWithResult(_0x47b0a5,0xc9))[_0x8f10('0x40')](handleError(_0x47b0a5,null));};exports[_0x8f10('0x22')]=function(_0x5cc80e,_0x8989cc){if(_0x5cc80e[_0x8f10('0x47')]['id']){delete _0x5cc80e['body']['id'];}return db[_0x8f10('0x29')]['find']({'where':{'id':_0x5cc80e[_0x8f10('0x42')]['id']}})[_0x8f10('0x23')](handleEntityNotFound(_0x8989cc,null))[_0x8f10('0x23')](saveUpdates(_0x5cc80e[_0x8f10('0x47')],null))[_0x8f10('0x23')](respondWithResult(_0x8989cc,null))[_0x8f10('0x40')](handleError(_0x8989cc,null));};exports['destroy']=function(_0x4f67ff,_0x30c14e){return db[_0x8f10('0x29')][_0x8f10('0x45')]({'where':{'id':_0x4f67ff['params']['id']}})[_0x8f10('0x23')](handleEntityNotFound(_0x30c14e,null))[_0x8f10('0x23')](removeEntity(_0x30c14e,null))['catch'](handleError(_0x30c14e,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index e998cd0..dfea601 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 _0xb700=['define','VoiceQueuesLog','voice_queues_log','event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d6309,_0x340d7d){var _0x35d96b=function(_0x50144e){while(--_0x50144e){_0x5d6309['push'](_0x5d6309['shift']());}};_0x35d96b(++_0x340d7d);}(_0xb700,0x1d3));var _0x0b70=function(_0x46a3ff,_0x470b9a){_0x46a3ff=_0x46a3ff-0x0;var _0x404bc2=_0xb700[_0x46a3ff];return _0x404bc2;};'use strict';var _=require(_0x0b70('0x0'));var util=require('util');var logger=require(_0x0b70('0x1'))(_0x0b70('0x2'));var moment=require(_0x0b70('0x3'));var BPromise=require(_0x0b70('0x4'));var rp=require(_0x0b70('0x5'));var fs=require('fs');var path=require(_0x0b70('0x6'));var rimraf=require(_0x0b70('0x7'));var config=require(_0x0b70('0x8'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x5818a1,_0x186d93){return _0x5818a1[_0x0b70('0x9')](_0x0b70('0xa'),attributes,{'tableName':_0x0b70('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0b70('0xc'),_0x0b70('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xe2a3=['voice_queues_log','event_dtm','event','dtm','lodash','util','moment','bluebird','request-promise','../../config/environment','VoiceQueuesLog'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xe2a3,0x67));var _0x3e2a=function(_0x405868,_0x3b6e2c){_0x405868=_0x405868-0x0;var _0x51873d=_0xe2a3[_0x405868];return _0x51873d;};'use strict';var _=require(_0x3e2a('0x0'));var util=require(_0x3e2a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3e2a('0x2'));var BPromise=require(_0x3e2a('0x3'));var rp=require(_0x3e2a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e2a('0x5'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x4fb263,_0x3c26d0){return _0x4fb263['define'](_0x3e2a('0x6'),attributes,{'tableName':_0x3e2a('0x7'),'paranoid':![],'indexes':[{'name':_0x3e2a('0x8'),'fields':[_0x3e2a('0x9'),_0x3e2a('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 800992c..3e5dc1b 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 _0x92aa=['randomstring','../../mysqldb','rpc','jayson/promise','request','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x43f6d0,_0x448b68){var _0x213c2e=function(_0x47cea7){while(--_0x47cea7){_0x43f6d0['push'](_0x43f6d0['shift']());}};_0x213c2e(++_0x448b68);}(_0x92aa,0xf3));var _0xa92a=function(_0x8ae6d2,_0x54240d){_0x8ae6d2=_0x8ae6d2-0x0;var _0x251f5e=_0x92aa[_0x8ae6d2];return _0x251f5e;};'use strict';var _=require(_0xa92a('0x0'));var util=require(_0xa92a('0x1'));var moment=require(_0xa92a('0x2'));var BPromise=require(_0xa92a('0x3'));var rs=require(_0xa92a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa92a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa92a('0x6'));var config=require('../../config/environment');var jayson=require(_0xa92a('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x172966,_0x1fba88,_0x595f11){return new BPromise(function(_0x38c479,_0x270dbe){return client[_0xa92a('0x8')](_0x172966,_0x595f11)[_0xa92a('0x9')](function(_0x3c6b4c){logger['info'](_0xa92a('0xa'),_0x1fba88,_0xa92a('0xb'));logger['debug'](_0xa92a('0xc'),_0x1fba88,_0xa92a('0xb'),JSON[_0xa92a('0xd')](_0x3c6b4c));if(_0x3c6b4c['error']){if(_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0xf')]===0x1f4){logger[_0xa92a('0xe')](_0xa92a('0xa'),_0x1fba88,_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0x10')]);return _0x270dbe(_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0x10')]);}logger[_0xa92a('0xe')](_0xa92a('0xa'),_0x1fba88,_0x3c6b4c[_0xa92a('0xe')][_0xa92a('0x10')]);return _0x38c479(_0x3c6b4c['error']['message']);}else{logger['info'](_0xa92a('0xa'),_0x1fba88,_0xa92a('0xb'));_0x38c479(_0x3c6b4c[_0xa92a('0x11')][_0xa92a('0x10')]);}})[_0xa92a('0x12')](function(_0x160a99){logger[_0xa92a('0xe')](_0xa92a('0xa'),_0x1fba88,_0x160a99);_0x270dbe(_0x160a99);});});} \ No newline at end of file +var _0x35d4=['VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info'];(function(_0x38fec6,_0x4cf8ac){var _0xcad4d8=function(_0x4f5020){while(--_0x4f5020){_0x38fec6['push'](_0x38fec6['shift']());}};_0xcad4d8(++_0x4cf8ac);}(_0x35d4,0x1e7));var _0x435d=function(_0xd1e040,_0x4937e3){_0xd1e040=_0xd1e040-0x0;var _0x3f2dbc=_0x35d4[_0xd1e040];return _0x3f2dbc;};'use strict';var _=require(_0x435d('0x0'));var util=require('util');var moment=require(_0x435d('0x1'));var BPromise=require(_0x435d('0x2'));var rs=require(_0x435d('0x3'));var fs=require('fs');var Redis=require(_0x435d('0x4'));var db=require(_0x435d('0x5'))['db'];var utils=require(_0x435d('0x6'));var logger=require(_0x435d('0x7'))('rpc');var config=require(_0x435d('0x8'));var jayson=require(_0x435d('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b1cc7,_0x55b365,_0x5f39e1){return new BPromise(function(_0xfbcabe,_0x594ae1){return client[_0x435d('0xa')](_0x2b1cc7,_0x5f39e1)[_0x435d('0xb')](function(_0x40b818){logger[_0x435d('0xc')](_0x435d('0xd'),_0x55b365,_0x435d('0xe'));logger[_0x435d('0xf')](_0x435d('0x10'),_0x55b365,'request\x20sent',JSON[_0x435d('0x11')](_0x40b818));if(_0x40b818[_0x435d('0x12')]){if(_0x40b818[_0x435d('0x12')]['code']===0x1f4){logger[_0x435d('0x12')](_0x435d('0xd'),_0x55b365,_0x40b818[_0x435d('0x12')][_0x435d('0x13')]);return _0x594ae1(_0x40b818['error'][_0x435d('0x13')]);}logger['error'](_0x435d('0xd'),_0x55b365,_0x40b818[_0x435d('0x12')]['message']);return _0xfbcabe(_0x40b818[_0x435d('0x12')][_0x435d('0x13')]);}else{logger[_0x435d('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x55b365,'request\x20sent');_0xfbcabe(_0x40b818['result'][_0x435d('0x13')]);}})['catch'](function(_0x39eba7){logger[_0x435d('0x12')]('VoiceQueuesLog,\x20%s,\x20%s',_0x55b365,_0x39eba7);_0x594ae1(_0x39eba7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index f18ac47..9ac295a 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 _0x4eb9=['show','/:id/download','download','/:id/downloads','/:id/transcribe','downloadTranscribe','post','create','put','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x4ba565,_0x475a09){var _0x1a7945=function(_0x5f42b3){while(--_0x5f42b3){_0x4ba565['push'](_0x4ba565['shift']());}};_0x1a7945(++_0x475a09);}(_0x4eb9,0x1d4));var _0x94eb=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4eb9[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require('multer');var util=require(_0x94eb('0x0'));var path=require(_0x94eb('0x1'));var timeout=require(_0x94eb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x94eb('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x94eb('0x4'));var controller=require(_0x94eb('0x5'));router['get']('/',auth[_0x94eb('0x6')](),controller[_0x94eb('0x7')]);router[_0x94eb('0x8')](_0x94eb('0x9'),auth['isAuthenticated'](),controller[_0x94eb('0xa')]);router[_0x94eb('0x8')](_0x94eb('0xb'),auth[_0x94eb('0x6')](),controller[_0x94eb('0xc')]);router[_0x94eb('0x8')](_0x94eb('0xd'),auth[_0x94eb('0x6')](),controller[_0x94eb('0xe')]);router[_0x94eb('0x8')](_0x94eb('0xf'),controller['downloads']);router[_0x94eb('0x8')](_0x94eb('0x10'),auth[_0x94eb('0x6')](),controller[_0x94eb('0x11')]);router[_0x94eb('0x12')]('/',auth[_0x94eb('0x6')](),controller[_0x94eb('0x13')]);router[_0x94eb('0x12')](_0x94eb('0x10'),auth[_0x94eb('0x6')](),controller['runTranscribe']);router[_0x94eb('0x14')](_0x94eb('0xb'),auth[_0x94eb('0x6')](),controller['update']);router[_0x94eb('0x15')](_0x94eb('0xb'),auth[_0x94eb('0x6')](),controller[_0x94eb('0x16')]);module[_0x94eb('0x17')]=router; \ No newline at end of file +var _0xdc39=['post','create','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe'];(function(_0x5a1e40,_0x172118){var _0x494eec=function(_0x13861a){while(--_0x13861a){_0x5a1e40['push'](_0x5a1e40['shift']());}};_0x494eec(++_0x172118);}(_0xdc39,0x19d));var _0x9dc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc39[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9dc3('0x0'));var timeout=require(_0x9dc3('0x1'));var express=require(_0x9dc3('0x2'));var router=express[_0x9dc3('0x3')]();var fs_extra=require(_0x9dc3('0x4'));var auth=require(_0x9dc3('0x5'));var interaction=require(_0x9dc3('0x6'));var config=require(_0x9dc3('0x7'));var controller=require('./voiceRecording.controller');router[_0x9dc3('0x8')]('/',auth['isAuthenticated'](),controller[_0x9dc3('0x9')]);router[_0x9dc3('0x8')](_0x9dc3('0xa'),auth[_0x9dc3('0xb')](),controller[_0x9dc3('0xc')]);router[_0x9dc3('0x8')](_0x9dc3('0xd'),auth['isAuthenticated'](),controller[_0x9dc3('0xe')]);router[_0x9dc3('0x8')](_0x9dc3('0xf'),auth[_0x9dc3('0xb')](),controller[_0x9dc3('0x10')]);router[_0x9dc3('0x8')]('/:id/downloads',controller[_0x9dc3('0x11')]);router[_0x9dc3('0x8')](_0x9dc3('0x12'),auth[_0x9dc3('0xb')](),controller['downloadTranscribe']);router[_0x9dc3('0x13')]('/',auth[_0x9dc3('0xb')](),controller[_0x9dc3('0x14')]);router[_0x9dc3('0x13')](_0x9dc3('0x12'),auth[_0x9dc3('0xb')](),controller['runTranscribe']);router['put']('/:id',auth[_0x9dc3('0xb')](),controller[_0x9dc3('0x15')]);router[_0x9dc3('0x16')]('/:id',auth[_0x9dc3('0xb')](),controller[_0x9dc3('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 81c1ded..8e93a42 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(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 591c276..cd505bd 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 _0x2048=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','set','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','VoiceRecording','type','key','model','map','format','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','count','includeAll','include','show','params','rawAttributes','fields','catch','create','update','body','find','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','secrets','recording','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','%s.cypher','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','runTranscribe','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','transcribeRegion','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','tempSentiment','runSentiment','writeFile','downloadTranscribe','fileText','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','uuid/v4','ioredis'];(function(_0x3d6ce2,_0x3cb753){var _0x4bae94=function(_0xfb7462){while(--_0xfb7462){_0x3d6ce2['push'](_0x3d6ce2['shift']());}};_0x4bae94(++_0x3cb753);}(_0x2048,0x11c));var _0x8204=function(_0x3e41a6,_0xe86451){_0x3e41a6=_0x3e41a6-0x0;var _0x221e4e=_0x2048[_0x3e41a6];return _0x221e4e;};'use strict';var emlformat=require(_0x8204('0x0'));var rimraf=require(_0x8204('0x1'));var zipdir=require(_0x8204('0x2'));var jsonpatch=require(_0x8204('0x3'));var rp=require(_0x8204('0x4'));var moment=require(_0x8204('0x5'));var BPromise=require(_0x8204('0x6'));var Mustache=require(_0x8204('0x7'));var util=require(_0x8204('0x8'));var path=require(_0x8204('0x9'));var sox=require(_0x8204('0xa'));var csv=require('to-csv');var ejs=require(_0x8204('0xb'));var fs=require('fs');var fs_extra=require(_0x8204('0xc'));var _=require(_0x8204('0xd'));var squel=require(_0x8204('0xe'));var crypto=require(_0x8204('0xf'));var jsforce=require(_0x8204('0x10'));var deskjs=require(_0x8204('0x11'));var toCsv=require(_0x8204('0x12'));var querystring=require(_0x8204('0x13'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0x8204('0x14'));var Redis=require(_0x8204('0x15'));var authService=require(_0x8204('0x16'));var qs=require(_0x8204('0x17'));var as=require(_0x8204('0x18'));var hardwareService=require(_0x8204('0x19'));var logger=require(_0x8204('0x1a'))(_0x8204('0x1b'));var utils=require(_0x8204('0x1c'));var config=require(_0x8204('0x1d'));var licenseUtil=require(_0x8204('0x1e'));var db=require(_0x8204('0x1f'))['db'];function respondWithStatusCode(_0x5d3ebe,_0x9fcf6){_0x9fcf6=_0x9fcf6||0xcc;return function(_0xd14bc2){if(_0xd14bc2){return _0x5d3ebe[_0x8204('0x20')](_0x9fcf6);}return _0x5d3ebe[_0x8204('0x21')](_0x9fcf6)['end']();};}function respondWithResult(_0x4181db,_0x4fdb4c){_0x4fdb4c=_0x4fdb4c||0xc8;return function(_0x40cfb4){if(_0x40cfb4){return _0x4181db[_0x8204('0x21')](_0x4fdb4c)[_0x8204('0x22')](_0x40cfb4);}};}function respondWithFilteredResult(_0x1167e3,_0x1b0c3f){return function(_0x512916){if(_0x512916){var _0x477b3f=typeof _0x1b0c3f['offset']==='undefined'&&typeof _0x1b0c3f[_0x8204('0x23')]===_0x8204('0x24');var _0x2e4fe5=_0x512916['count'];var _0x4c4df2=_0x477b3f?0x0:_0x1b0c3f['offset'];var _0xe2a93b=_0x477b3f?_0x512916['count']:_0x1b0c3f[_0x8204('0x25')]+_0x1b0c3f[_0x8204('0x23')];var _0x1ae872;if(_0xe2a93b>=_0x2e4fe5){_0xe2a93b=_0x2e4fe5;_0x1ae872=0xc8;}else{_0x1ae872=0xce;}_0x1167e3['status'](_0x1ae872);return _0x1167e3[_0x8204('0x26')](_0x8204('0x27'),_0x4c4df2+'-'+_0xe2a93b+'/'+_0x2e4fe5)[_0x8204('0x22')](_0x512916);}return null;};}function patchUpdates(_0x26ce6c){return function(_0xc19aa7){try{jsonpatch[_0x8204('0x28')](_0xc19aa7,_0x26ce6c,!![]);}catch(_0x39316e){return BPromise[_0x8204('0x29')](_0x39316e);}return _0xc19aa7[_0x8204('0x2a')]();};}function saveUpdates(_0x579b41,_0xd44aaa){return function(_0x1a768e){if(_0x1a768e){return _0x1a768e['update'](_0x579b41)[_0x8204('0x2b')](function(_0x1e09ae){return _0x1e09ae;});}return null;};}function removeEntity(_0x2fdc6e,_0x721894){return function(_0x45954c){if(_0x45954c){return _0x45954c[_0x8204('0x2c')]()[_0x8204('0x2b')](function(){_0x2fdc6e[_0x8204('0x21')](0xcc)[_0x8204('0x2d')]();});}};}function handleEntityNotFound(_0xfc10af,_0x4e942a){return function(_0x3e7781){if(!_0x3e7781){_0xfc10af[_0x8204('0x20')](0x194);}return _0x3e7781;};}function handleError(_0x2ee1f0,_0x4ee508){_0x4ee508=_0x4ee508||0x1f4;return function(_0x266551){logger['error'](_0x266551[_0x8204('0x2e')]);if(_0x266551[_0x8204('0x2f')]){delete _0x266551['name'];}_0x2ee1f0[_0x8204('0x21')](_0x4ee508)[_0x8204('0x30')](_0x266551);};}exports['index']=function(_0x34cd78,_0x356b0b){var _0x18eb9e={},_0x551ead={},_0x2b1c1={'count':0x0,'rows':[]};var _0x949e5=_['map'](db[_0x8204('0x31')]['rawAttributes'],function(_0x220072){return{'name':_0x220072['fieldName'],'type':_0x220072[_0x8204('0x32')][_0x8204('0x33')]};});_0x551ead[_0x8204('0x34')]=_['differenceBy'](_[_0x8204('0x35')](_0x949e5,_0x8204('0x2f')),[_0x8204('0x36')]);_0x551ead[_0x8204('0x37')]=_[_0x8204('0x38')](_0x34cd78[_0x8204('0x37')]);_0x551ead['filters']=_[_0x8204('0x39')](_0x551ead[_0x8204('0x34')],_0x551ead['query']);_0x18eb9e[_0x8204('0x3a')]=_['intersection'](_0x551ead[_0x8204('0x34')],qs['fields'](_0x34cd78[_0x8204('0x37')]['fields']));_0x18eb9e[_0x8204('0x3a')]=_0x18eb9e[_0x8204('0x3a')][_0x8204('0x3b')]?_0x18eb9e['attributes']:_0x551ead[_0x8204('0x34')];if(!_0x34cd78['query'][_0x8204('0x3c')](_0x8204('0x3d'))){_0x18eb9e['limit']=qs[_0x8204('0x23')](_0x34cd78['query'][_0x8204('0x23')]);_0x18eb9e[_0x8204('0x25')]=qs[_0x8204('0x25')](_0x34cd78[_0x8204('0x37')][_0x8204('0x25')]);}_0x18eb9e[_0x8204('0x3e')]=qs[_0x8204('0x3f')](_0x34cd78[_0x8204('0x37')][_0x8204('0x3f')]);_0x18eb9e[_0x8204('0x40')]=qs[_0x8204('0x41')](_[_0x8204('0x42')](_0x34cd78[_0x8204('0x37')],_0x551ead[_0x8204('0x41')]),_0x949e5);if(_0x34cd78[_0x8204('0x37')][_0x8204('0x43')]){_0x18eb9e[_0x8204('0x40')]=_[_0x8204('0x44')](_0x18eb9e[_0x8204('0x40')],{'$or':_[_0x8204('0x35')](_0x949e5,function(_0x2ad72){if(_0x2ad72['type']!=='VIRTUAL'){var _0x807551={};_0x807551[_0x2ad72[_0x8204('0x2f')]]={'$like':'%'+_0x34cd78[_0x8204('0x37')][_0x8204('0x43')]+'%'};return _0x807551;}})});}_0x18eb9e=_[_0x8204('0x44')]({},_0x18eb9e,_0x34cd78[_0x8204('0x45')]);var _0x1edca0={'where':_0x18eb9e[_0x8204('0x40')]};return db[_0x8204('0x31')][_0x8204('0x46')](_0x1edca0)[_0x8204('0x2b')](function(_0x12707c){_0x2b1c1[_0x8204('0x46')]=_0x12707c;if(_0x34cd78['query'][_0x8204('0x47')]){_0x18eb9e[_0x8204('0x48')]=[{'all':!![]}];}return db[_0x8204('0x31')]['findAll'](_0x18eb9e);})[_0x8204('0x2b')](function(_0x266575){_0x2b1c1['rows']=_0x266575;return _0x2b1c1;})['then'](respondWithFilteredResult(_0x356b0b,_0x18eb9e))['catch'](handleError(_0x356b0b,null));};exports[_0x8204('0x49')]=function(_0x4b8f6a,_0x30a9b0){var _0x4d1daa={'raw':![],'where':{'id':_0x4b8f6a[_0x8204('0x4a')]['id']}},_0x428b3a={};_0x428b3a['model']=_[_0x8204('0x38')](db[_0x8204('0x31')][_0x8204('0x4b')]);_0x428b3a[_0x8204('0x37')]=_[_0x8204('0x38')](_0x4b8f6a[_0x8204('0x37')]);_0x428b3a[_0x8204('0x41')]=_['intersection'](_0x428b3a[_0x8204('0x34')],_0x428b3a['query']);_0x4d1daa[_0x8204('0x3a')]=_[_0x8204('0x39')](_0x428b3a[_0x8204('0x34')],qs['fields'](_0x4b8f6a[_0x8204('0x37')][_0x8204('0x4c')]));_0x4d1daa[_0x8204('0x3a')]=_0x4d1daa[_0x8204('0x3a')][_0x8204('0x3b')]?_0x4d1daa[_0x8204('0x3a')]:_0x428b3a[_0x8204('0x34')];if(_0x4b8f6a[_0x8204('0x37')][_0x8204('0x47')]){_0x4d1daa[_0x8204('0x48')]=[{'all':!![]}];}_0x4d1daa=_[_0x8204('0x44')]({},_0x4d1daa,_0x4b8f6a[_0x8204('0x45')]);return db['VoiceRecording']['find'](_0x4d1daa)[_0x8204('0x2b')](handleEntityNotFound(_0x30a9b0,null))['then'](respondWithResult(_0x30a9b0,null))[_0x8204('0x4d')](handleError(_0x30a9b0,null));};exports[_0x8204('0x4e')]=function(_0x3b7732,_0x320888){return db['VoiceRecording'][_0x8204('0x4e')](_0x3b7732['body'],{})[_0x8204('0x2b')](respondWithResult(_0x320888,0xc9))['catch'](handleError(_0x320888,null));};exports[_0x8204('0x4f')]=function(_0x4d15d3,_0x3c028d){if(_0x4d15d3['body']['id']){delete _0x4d15d3[_0x8204('0x50')]['id'];}return db['VoiceRecording'][_0x8204('0x51')]({'where':{'id':_0x4d15d3['params']['id']}})[_0x8204('0x2b')](handleEntityNotFound(_0x3c028d,null))['then'](saveUpdates(_0x4d15d3[_0x8204('0x50')],null))['then'](respondWithResult(_0x3c028d,null))[_0x8204('0x4d')](handleError(_0x3c028d,null));};exports[_0x8204('0x52')]=function(_0x4c7bd5,_0x2e10d3){return db[_0x8204('0x31')][_0x8204('0x52')]()[_0x8204('0x2b')](respondWithResult(_0x2e10d3,null))[_0x8204('0x4d')](handleError(_0x2e10d3,null));};exports[_0x8204('0x53')]=function(_0x23c35e,_0x1bd031,_0x5a7955){var _0x315905=require(_0x8204('0x54'));var _0x44d644=![];var _0x129045={};if(_0x23c35e[_0x8204('0x37')][_0x8204('0x32')]&&_0x23c35e[_0x8204('0x37')][_0x8204('0x32')]===_0x8204('0x55')){_0x129045[_0x8204('0x55')]=_0x23c35e[_0x8204('0x4a')]['id'];}else{_0x129045['id']=_0x23c35e[_0x8204('0x4a')]['id'];}return db[_0x8204('0x31')][_0x8204('0x51')]({'where':_0x129045,'attributes':['id',_0x8204('0x56')],'raw':!![]})['then'](handleEntityNotFound(_0x1bd031,null))['then'](function(_0x387ea7){if(_0x387ea7){var _0x573bfa=_0x387ea7[_0x8204('0x56')];var _0x312e54=util[_0x8204('0x36')]('%s.cypher',_0x573bfa);if(fs[_0x8204('0x57')](_0x312e54)){_0x44d644=!![];return _0x315905[_0x8204('0x58')](_0x312e54,_0x573bfa,config[_0x8204('0x59')][_0x8204('0x5a')])[_0x8204('0x2b')](function(){return _0x387ea7;});}return _0x387ea7;}})[_0x8204('0x2b')](function(_0x583760){if(_0x583760){var _0x1da2b3=_0x583760[_0x8204('0x56')];if(!fs[_0x8204('0x57')](_0x1da2b3)){throw new db[(_0x8204('0x5b'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x583760[_0x8204('0x5c')]){return _0x1bd031['download'](_0x1da2b3,_0x583760[_0x8204('0x5c')]+path[_0x8204('0x5d')](_0x1da2b3),function(){if(_0x44d644){fs[_0x8204('0x5e')](_0x1da2b3);}});}else{return _0x1bd031[_0x8204('0x53')](_0x1da2b3,function(_0x4a1c6f){if(_0x44d644){fs[_0x8204('0x5e')](_0x1da2b3);}});}}})['catch'](function(_0xe8dfbb){if(_0xe8dfbb[_0x8204('0x5f')]===_0x8204('0x60')){_0x1bd031[_0x8204('0x21')](0x194)['send'](_0x8204('0x61'));}else{return handleError(_0x1bd031,null);}});};exports[_0x8204('0x62')]=function(_0x2a44e3,_0x14aa3a,_0x238263){var _0x59385f=require(_0x8204('0x54'));var _0x59f835=![];var _0x287ef0={'$and':[db[_0x8204('0x63')][_0x8204('0x40')](db[_0x8204('0x63')]['fn'](_0x8204('0x64'),db[_0x8204('0x63')][_0x8204('0x65')](_0x8204('0x55'))),_0x2a44e3[_0x8204('0x37')][_0x8204('0x66')])]};if(_0x2a44e3[_0x8204('0x37')][_0x8204('0x32')]&&_0x2a44e3[_0x8204('0x37')][_0x8204('0x32')]===_0x8204('0x55')){_0x287ef0[_0x8204('0x67')]['push']({'uniqueid':_0x2a44e3['params']['id']});}else{_0x287ef0[_0x8204('0x67')][_0x8204('0x68')]({'id':_0x2a44e3[_0x8204('0x4a')]['id']});}return db[_0x8204('0x31')][_0x8204('0x51')]({'where':_0x287ef0,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x14aa3a,null))[_0x8204('0x2b')](function(_0x1aa815){if(_0x1aa815){var _0x4acb63=util['format'](_0x8204('0x69'),_0x1aa815[_0x8204('0x56')]);if(fs[_0x8204('0x57')](_0x4acb63)){_0x59f835=!![];return _0x59385f[_0x8204('0x58')](_0x4acb63,_0x1aa815[_0x8204('0x56')],config[_0x8204('0x59')][_0x8204('0x5a')])[_0x8204('0x2b')](function(){return _0x1aa815;});}return _0x1aa815;}})[_0x8204('0x2b')](function(_0x183b19){if(_0x183b19){if(!fs[_0x8204('0x57')](_0x183b19['value'])){throw new db[(_0x8204('0x5b'))][(_0x8204('0x6a'))](_0x8204('0x60'));}if(_0x183b19[_0x8204('0x5c')]){return _0x14aa3a[_0x8204('0x53')](_0x183b19[_0x8204('0x56')],_0x183b19['filename']+path['extname'](_0x183b19[_0x8204('0x56')]),function(){if(_0x59f835){fs[_0x8204('0x5e')](_0x183b19[_0x8204('0x56')]);}});}else{return _0x14aa3a[_0x8204('0x53')](_0x183b19[_0x8204('0x56')],function(_0x532d17){if(_0x59f835){fs['unlink'](_0x183b19[_0x8204('0x56')]);}});}}})[_0x8204('0x4d')](handleError(_0x14aa3a,null));};exports['destroy']=function(_0x4dda7c,_0x3a6744){return db[_0x8204('0x31')][_0x8204('0x51')]({'where':{'id':_0x4dda7c[_0x8204('0x4a')]['id']}})['then'](function(_0x28ffb2){if(_[_0x8204('0x6b')](_0x28ffb2)){throw new ReferenceError(_0x8204('0x6c'));}return _0x28ffb2;})[_0x8204('0x2b')](function(_0x5ca3e8){var _0x4074bd=_0x5ca3e8[_0x8204('0x56')];logger[_0x8204('0x6d')](_0x8204('0x6e'),_0x4074bd);if(!_['isNil'](_0x5ca3e8[_0x8204('0x56')])&&fs[_0x8204('0x57')](_0x4074bd)){logger[_0x8204('0x6d')](_0x8204('0x6f')+_0x4074bd+_0x8204('0x70'));fs[_0x8204('0x71')](_0x4074bd);}_0x4074bd=_0x4074bd+'.cypher';if(!_['isNil'](_0x5ca3e8[_0x8204('0x56')])&&fs[_0x8204('0x57')](_0x4074bd)){logger[_0x8204('0x6d')](_0x8204('0x6f')+_0x4074bd+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4074bd);}return _0x5ca3e8;})[_0x8204('0x2b')](function(_0x19dcab){if(!_0x19dcab)throw new InternalError();return _0x19dcab[_0x8204('0x2c')]();})['then'](function(){_0x3a6744[_0x8204('0x21')](0xcc)[_0x8204('0x2d')]();})[_0x8204('0x4d')](handleError(_0x3a6744,null));};function getBucketslist(_0x434faa,_0x226994,_0x56c685){return new Promise(function(_0x23429b,_0x1ed862){var _0x2ed8b7=new AWS['S3']({'accessKeyId':_0x226994,'secretAccessKey':_0x434faa,'region':_0x56c685});_0x2ed8b7['listBuckets']({},function(_0x4e94fe,_0x2cef88){if(_0x4e94fe){return _0x1ed862(_0x4e94fe);}else{return _0x23429b(_0x2cef88);}});});}function createBucket(_0x5c0c16,_0x37f901,_0x18817a,_0x1650e5){return new Promise(function(_0xaba43a,_0x4caf5c){var _0xc0b8dd=new AWS['S3']({'accessKeyId':_0x37f901,'secretAccessKey':_0x5c0c16,'region':_0x18817a});_0xc0b8dd['createBucket']({'Bucket':_0x1650e5},function(_0x58c397,_0x42484f){if(_0x58c397){return _0x4caf5c(_0x58c397);}else{return _0xaba43a(_0x42484f);}});});}function uploadFile(_0x1d9dcd,_0x39da79,_0x2a2ecb,_0x3c1687,_0x27cb68,_0x1a4d00){return new Promise(function(_0x333049,_0x331f65){var _0x2bf248=new AWS['S3']({'accessKeyId':_0x39da79,'secretAccessKey':_0x1d9dcd,'region':_0x2a2ecb});_0x2bf248[_0x8204('0x72')]({'Bucket':_0x3c1687,'Key':_0x27cb68,'Body':_0x1a4d00},function(_0x2e15ce,_0x2abe41){if(_0x2e15ce){return _0x331f65(_0x2e15ce);}else{return _0x333049(_0x2abe41);}});});}function startTranscribe(_0x5e6849,_0x2af181,_0x58dcc5,_0x382077,_0x5684b1,_0x41170c){return new Promise(function(_0x404eed,_0x36bd48){var _0x571124=new AWS[(_0x8204('0x73'))]({'accessKeyId':_0x2af181,'secretAccessKey':_0x5e6849,'region':_0x58dcc5});_0x571124[_0x8204('0x74')]({'TranscriptionJobName':_0x382077,'LanguageCode':_0x5684b1,'Media':{'MediaFileUri':_0x41170c}},function(_0x556db6,_0x1c5a99){if(_0x556db6){return _0x36bd48(_0x556db6);}else{return _0x404eed(_0x1c5a99);}});});}function transcribe(_0x3b8774,_0xf37ba5,_0x510eea,_0x5537a2,_0x1fc2a2,_0x57442f,_0x3f5af9){return new Promise(function(_0x1a3e3d,_0x1111ed){var _0x3a463d={};logger[_0x8204('0x6d')](util[_0x8204('0x36')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x3b8774,_0x1fc2a2));return uploadFile(_0xf37ba5,_0x510eea,_0x5537a2,_0x1fc2a2,path[_0x8204('0x75')](_0x57442f),fs[_0x8204('0x76')](_0x57442f))['then'](function(_0x266122){logger[_0x8204('0x6d')](util[_0x8204('0x36')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x3b8774,_0x1fc2a2,_0x266122[_0x8204('0x77')]));_0x3a463d[_0x8204('0x78')]=_0x266122[_0x8204('0x79')];_0x3a463d[_0x8204('0x7a')]=_0x266122[_0x8204('0x77')];logger[_0x8204('0x6d')](util[_0x8204('0x36')](_0x8204('0x7b'),_0x3b8774));return startTranscribe(_0xf37ba5,_0x510eea,_0x5537a2,uuidv4(),_0x3f5af9,_0x266122['Location']);})[_0x8204('0x2b')](function(_0x56d4b6){logger['info'](util[_0x8204('0x36')](_0x8204('0x7c'),_0x3b8774,_0x56d4b6[_0x8204('0x7d')][_0x8204('0x7e')]));_0x3a463d['transcribeName']=_0x56d4b6[_0x8204('0x7d')][_0x8204('0x7e')];_0x3a463d[_0x8204('0x7f')]=_0x56d4b6['TranscriptionJob']['TranscriptionJobStatus'];return _0x1a3e3d(_0x3a463d);})['catch'](function(_0xf7b668){return _0x1111ed(_0xf7b668);});});}exports[_0x8204('0x80')]=function(_0x2e2d2e,_0x2ca891,_0x5067c7){var _0x5c1588;var _0x3f7e13;var _0x29dd2d;var _0x147d45=require(_0x8204('0x54'));return db[_0x8204('0x31')]['findOne']({'where':{'id':_0x2e2d2e[_0x8204('0x4a')]['id']}})['then'](function(_0xfb1053){if(_0xfb1053){var _0x9554ba=util[_0x8204('0x36')](_0x8204('0x69'),_0xfb1053['value']);if(fs[_0x8204('0x57')](_0x9554ba)){cypher=!![];return _0x147d45[_0x8204('0x58')](_0x9554ba,_0xfb1053[_0x8204('0x56')],config['secrets'][_0x8204('0x5a')])[_0x8204('0x2b')](function(){return _0xfb1053;});}return _0xfb1053;}})[_0x8204('0x2b')](function(_0x50fb0c){if(!_0x50fb0c){throw new db[(_0x8204('0x5b'))][(_0x8204('0x6a'))](_0x8204('0x81'));}_0x3f7e13=_0x50fb0c;return db[_0x8204('0x82')][_0x8204('0x83')]({'where':{'id':0x1}});})[_0x8204('0x2b')](handleEntityNotFound(_0x2ca891,null))['then'](function(_0x56e7ae){if(_0x56e7ae){_0x5c1588=_0x56e7ae;if(!_0x5c1588[_0x8204('0x84')]||!_0x5c1588[_0x8204('0x85')]||!_0x5c1588[_0x8204('0x86')]||!_0x5c1588['language']||!_0x5c1588[_0x8204('0x78')]){throw new db[(_0x8204('0x5b'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x2e2d2e[_0x8204('0x50')]['runSentiment']&&(!_0x5c1588['sentiment']||!_0x5c1588[_0x8204('0x87')]||!_0x5c1588['sentimentRegion']||!_0x5c1588[_0x8204('0x88')]||!_0x5c1588[_0x8204('0x78')])){throw new db['Sequelize'][(_0x8204('0x6a'))](_0x8204('0x89'));}return db[_0x8204('0x8a')][_0x8204('0x83')]({'where':{'id':_0x5c1588['transcribeAccountId']}});}})[_0x8204('0x2b')](function(_0x10e90d){if(!_0x10e90d){throw new db[(_0x8204('0x5b'))]['ValidationError'](_0x8204('0x8b'));}if(!_0x10e90d[_0x8204('0x8c')]||!_0x10e90d[_0x8204('0x8d')]){throw new db[(_0x8204('0x5b'))][(_0x8204('0x6a'))](_0x8204('0x8e'));}_0x29dd2d=_0x10e90d;return getBucketslist(_0x29dd2d[_0x8204('0x8c')],_0x29dd2d[_0x8204('0x8d')],_0x5c1588['transcribeRegion']);})[_0x8204('0x2b')](function(_0x1e25f6){if(_0x1e25f6&&_0x1e25f6[_0x8204('0x8f')]){var _0x50578d=_[_0x8204('0x51')](_0x1e25f6[_0x8204('0x8f')],function(_0x44a9f5){return _0x44a9f5[_0x8204('0x90')]===_0x5c1588[_0x8204('0x78')];});if(!_0x50578d){logger[_0x8204('0x6d')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x2e2d2e[_0x8204('0x4a')]['id'],_0x5c1588[_0x8204('0x78')]));return createBucket(_0x29dd2d['data1'],_0x29dd2d[_0x8204('0x8d')],_0x5c1588[_0x8204('0x86')],_0x5c1588[_0x8204('0x78')]);}logger[_0x8204('0x6d')](util['format'](_0x8204('0x91'),_0x2e2d2e['params']['id'],_0x5c1588['bucket']));return;}})[_0x8204('0x2b')](function(_0x39a8dc){if(_0x3f7e13[_0x8204('0x7f')]==='NEW'){return transcribe(_0x2e2d2e[_0x8204('0x4a')]['id'],_0x29dd2d[_0x8204('0x8c')],_0x29dd2d[_0x8204('0x8d')],_0x5c1588[_0x8204('0x86')],_0x5c1588[_0x8204('0x78')],_0x3f7e13[_0x8204('0x56')],_0x5c1588[_0x8204('0x88')]);}else{logger['info'](util[_0x8204('0x36')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x2e2d2e['params']['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x367540){if(_0x367540){_0x367540[_0x8204('0x92')]=_0x2e2d2e[_0x8204('0x50')][_0x8204('0x93')];return _0x3f7e13['updateAttributes'](_0x367540);}})['then'](respondWithResult(_0x2ca891,null))[_0x8204('0x4d')](handleError(_0x2ca891,null));};function writeFile(_0x3bdce1,_0x473135){return new Promise(function(_0x4f9d55,_0x4db2e3){fs[_0x8204('0x94')](_0x473135,_0x3bdce1,function(_0x87a38,_0x3aefc6){if(_0x87a38){return _0x4db2e3(_0x87a38);}else{return _0x4f9d55(_0x3aefc6);}});});}exports[_0x8204('0x95')]=function(_0x43f420,_0x2870cc,_0x391d69){return db['VoiceRecording']['findOne']({'where':{'id':_0x43f420[_0x8204('0x4a')]['id']}})[_0x8204('0x2b')](handleEntityNotFound(_0x2870cc))['then'](function(_0x56e0c5){if(_0x56e0c5&&_0x56e0c5['fileText']){var _0x5d7a20=_0x56e0c5[_0x8204('0x96')];var _0x5573df=config['root']+'/server/files/transcribes/transcribe_'+_0x56e0c5['id']+_0x8204('0x97');if(fs[_0x8204('0x57')](_0x5573df)){return _0x5573df;}return writeFile(_0x5d7a20,_0x5573df)[_0x8204('0x2b')](function(){return _0x5573df;});}else{throw new db[(_0x8204('0x5b'))]['ValidationError'](_0x8204('0x98'));}})[_0x8204('0x2b')](function(_0x142a58){return _0x2870cc[_0x8204('0x53')](_0x142a58);})['catch'](handleError(_0x2870cc));}; \ No newline at end of file +var _0x0e3d=['listBuckets','createBucket','upload','startTranscriptionJob','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','data1','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','reject','update','then','status','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','format','query','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceRecording','count','includeAll','include','rows','catch','keys','create','body','params','describe','../../components/encryptor','uniqueid','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','download','Not\x20found','downloads','sequelize','MD5','token','push','find','value','destroy','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher'];(function(_0xcfc898,_0x401a1b){var _0x4ec6e7=function(_0x18b1f8){while(--_0x18b1f8){_0xcfc898['push'](_0xcfc898['shift']());}};_0x4ec6e7(++_0x401a1b);}(_0x0e3d,0xba));var _0xd0e3=function(_0x305fa5,_0xf4a403){_0x305fa5=_0x305fa5-0x0;var _0x5b1b15=_0x0e3d[_0x305fa5];return _0x5b1b15;};'use strict';var emlformat=require(_0xd0e3('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(_0xd0e3('0x1'));var Mustache=require('mustache');var util=require(_0xd0e3('0x2'));var path=require(_0xd0e3('0x3'));var sox=require(_0xd0e3('0x4'));var csv=require(_0xd0e3('0x5'));var ejs=require(_0xd0e3('0x6'));var fs=require('fs');var fs_extra=require(_0xd0e3('0x7'));var _=require(_0xd0e3('0x8'));var squel=require(_0xd0e3('0x9'));var crypto=require(_0xd0e3('0xa'));var jsforce=require(_0xd0e3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd0e3('0x5'));var querystring=require(_0xd0e3('0xc'));var Papa=require(_0xd0e3('0xd'));var AWS=require(_0xd0e3('0xe'));var uuidv4=require(_0xd0e3('0xf'));var Redis=require(_0xd0e3('0x10'));var authService=require(_0xd0e3('0x11'));var qs=require(_0xd0e3('0x12'));var as=require(_0xd0e3('0x13'));var hardwareService=require(_0xd0e3('0x14'));var logger=require(_0xd0e3('0x15'))('api');var utils=require(_0xd0e3('0x16'));var config=require(_0xd0e3('0x17'));var licenseUtil=require(_0xd0e3('0x18'));var db=require(_0xd0e3('0x19'))['db'];function respondWithStatusCode(_0xef0885,_0xb0fae9){_0xb0fae9=_0xb0fae9||0xcc;return function(_0x23076a){if(_0x23076a){return _0xef0885['sendStatus'](_0xb0fae9);}return _0xef0885['status'](_0xb0fae9)['end']();};}function respondWithResult(_0xcbf71b,_0x28e3cf){_0x28e3cf=_0x28e3cf||0xc8;return function(_0x4a244e){if(_0x4a244e){return _0xcbf71b['status'](_0x28e3cf)[_0xd0e3('0x1a')](_0x4a244e);}};}function respondWithFilteredResult(_0x12a4d,_0x5bcf65){return function(_0x5170f9){if(_0x5170f9){var _0x205dc=typeof _0x5bcf65[_0xd0e3('0x1b')]===_0xd0e3('0x1c')&&typeof _0x5bcf65[_0xd0e3('0x1d')]===_0xd0e3('0x1c');var _0x18454f=_0x5170f9['count'];var _0x132362=_0x205dc?0x0:_0x5bcf65[_0xd0e3('0x1b')];var _0x529b04=_0x205dc?_0x5170f9['count']:_0x5bcf65[_0xd0e3('0x1b')]+_0x5bcf65['limit'];var _0xa18f1b;if(_0x529b04>=_0x18454f){_0x529b04=_0x18454f;_0xa18f1b=0xc8;}else{_0xa18f1b=0xce;}_0x12a4d['status'](_0xa18f1b);return _0x12a4d['set']('Content-Range',_0x132362+'-'+_0x529b04+'/'+_0x18454f)[_0xd0e3('0x1a')](_0x5170f9);}return null;};}function patchUpdates(_0x3bd669){return function(_0x3edb85){try{jsonpatch['apply'](_0x3edb85,_0x3bd669,!![]);}catch(_0x510112){return BPromise[_0xd0e3('0x1e')](_0x510112);}return _0x3edb85['save']();};}function saveUpdates(_0x120a5f,_0x2ff0a2){return function(_0xabfed1){if(_0xabfed1){return _0xabfed1[_0xd0e3('0x1f')](_0x120a5f)[_0xd0e3('0x20')](function(_0x91e41d){return _0x91e41d;});}return null;};}function removeEntity(_0x2d58b5,_0x39811e){return function(_0x41b690){if(_0x41b690){return _0x41b690['destroy']()[_0xd0e3('0x20')](function(){_0x2d58b5[_0xd0e3('0x21')](0xcc)[_0xd0e3('0x22')]();});}};}function handleEntityNotFound(_0x52bbd1,_0x4c5fe5){return function(_0x500c34){if(!_0x500c34){_0x52bbd1[_0xd0e3('0x23')](0x194);}return _0x500c34;};}function handleError(_0x4c8eb6,_0x2c7159){_0x2c7159=_0x2c7159||0x1f4;return function(_0x3b4513){logger[_0xd0e3('0x24')](_0x3b4513[_0xd0e3('0x25')]);if(_0x3b4513[_0xd0e3('0x26')]){delete _0x3b4513[_0xd0e3('0x26')];}_0x4c8eb6[_0xd0e3('0x21')](_0x2c7159)[_0xd0e3('0x27')](_0x3b4513);};}exports[_0xd0e3('0x28')]=function(_0x38e0ae,_0x4821ac){var _0x300c11={},_0x1bf869={},_0x35bb0d={'count':0x0,'rows':[]};var _0x2323b5=_[_0xd0e3('0x29')](db['VoiceRecording'][_0xd0e3('0x2a')],function(_0x20d9cd){return{'name':_0x20d9cd[_0xd0e3('0x2b')],'type':_0x20d9cd[_0xd0e3('0x2c')][_0xd0e3('0x2d')]};});_0x1bf869[_0xd0e3('0x2e')]=_[_0xd0e3('0x2f')](_[_0xd0e3('0x29')](_0x2323b5,_0xd0e3('0x26')),[_0xd0e3('0x30')]);_0x1bf869[_0xd0e3('0x31')]=_['keys'](_0x38e0ae[_0xd0e3('0x31')]);_0x1bf869['filters']=_[_0xd0e3('0x32')](_0x1bf869[_0xd0e3('0x2e')],_0x1bf869[_0xd0e3('0x31')]);_0x300c11['attributes']=_[_0xd0e3('0x32')](_0x1bf869[_0xd0e3('0x2e')],qs[_0xd0e3('0x33')](_0x38e0ae[_0xd0e3('0x31')]['fields']));_0x300c11[_0xd0e3('0x34')]=_0x300c11[_0xd0e3('0x34')][_0xd0e3('0x35')]?_0x300c11[_0xd0e3('0x34')]:_0x1bf869[_0xd0e3('0x2e')];if(!_0x38e0ae[_0xd0e3('0x31')]['hasOwnProperty']('nolimit')){_0x300c11[_0xd0e3('0x1d')]=qs[_0xd0e3('0x1d')](_0x38e0ae[_0xd0e3('0x31')][_0xd0e3('0x1d')]);_0x300c11[_0xd0e3('0x1b')]=qs[_0xd0e3('0x1b')](_0x38e0ae['query']['offset']);}_0x300c11[_0xd0e3('0x36')]=qs[_0xd0e3('0x37')](_0x38e0ae[_0xd0e3('0x31')][_0xd0e3('0x37')]);_0x300c11[_0xd0e3('0x38')]=qs[_0xd0e3('0x39')](_[_0xd0e3('0x3a')](_0x38e0ae[_0xd0e3('0x31')],_0x1bf869[_0xd0e3('0x39')]),_0x2323b5);if(_0x38e0ae[_0xd0e3('0x31')][_0xd0e3('0x3b')]){_0x300c11[_0xd0e3('0x38')]=_[_0xd0e3('0x3c')](_0x300c11[_0xd0e3('0x38')],{'$or':_[_0xd0e3('0x29')](_0x2323b5,function(_0x211ebc){if(_0x211ebc[_0xd0e3('0x2c')]!==_0xd0e3('0x3d')){var _0x5e9dc3={};_0x5e9dc3[_0x211ebc[_0xd0e3('0x26')]]={'$like':'%'+_0x38e0ae['query']['filter']+'%'};return _0x5e9dc3;}})});}_0x300c11=_[_0xd0e3('0x3c')]({},_0x300c11,_0x38e0ae[_0xd0e3('0x3e')]);var _0x364df9={'where':_0x300c11[_0xd0e3('0x38')]};return db[_0xd0e3('0x3f')][_0xd0e3('0x40')](_0x364df9)[_0xd0e3('0x20')](function(_0x345b1d){_0x35bb0d['count']=_0x345b1d;if(_0x38e0ae[_0xd0e3('0x31')][_0xd0e3('0x41')]){_0x300c11[_0xd0e3('0x42')]=[{'all':!![]}];}return db[_0xd0e3('0x3f')]['findAll'](_0x300c11);})['then'](function(_0xb362cf){_0x35bb0d[_0xd0e3('0x43')]=_0xb362cf;return _0x35bb0d;})['then'](respondWithFilteredResult(_0x4821ac,_0x300c11))[_0xd0e3('0x44')](handleError(_0x4821ac,null));};exports['show']=function(_0x1d4581,_0x108349){var _0x5f3ad4={'raw':![],'where':{'id':_0x1d4581['params']['id']}},_0x2d7c20={};_0x2d7c20[_0xd0e3('0x2e')]=_[_0xd0e3('0x45')](db[_0xd0e3('0x3f')][_0xd0e3('0x2a')]);_0x2d7c20[_0xd0e3('0x31')]=_['keys'](_0x1d4581['query']);_0x2d7c20['filters']=_['intersection'](_0x2d7c20['model'],_0x2d7c20['query']);_0x5f3ad4[_0xd0e3('0x34')]=_[_0xd0e3('0x32')](_0x2d7c20[_0xd0e3('0x2e')],qs['fields'](_0x1d4581[_0xd0e3('0x31')][_0xd0e3('0x33')]));_0x5f3ad4[_0xd0e3('0x34')]=_0x5f3ad4[_0xd0e3('0x34')]['length']?_0x5f3ad4[_0xd0e3('0x34')]:_0x2d7c20[_0xd0e3('0x2e')];if(_0x1d4581[_0xd0e3('0x31')][_0xd0e3('0x41')]){_0x5f3ad4['include']=[{'all':!![]}];}_0x5f3ad4=_[_0xd0e3('0x3c')]({},_0x5f3ad4,_0x1d4581[_0xd0e3('0x3e')]);return db['VoiceRecording']['find'](_0x5f3ad4)['then'](handleEntityNotFound(_0x108349,null))[_0xd0e3('0x20')](respondWithResult(_0x108349,null))[_0xd0e3('0x44')](handleError(_0x108349,null));};exports[_0xd0e3('0x46')]=function(_0x5e056b,_0x42de9c){return db[_0xd0e3('0x3f')][_0xd0e3('0x46')](_0x5e056b[_0xd0e3('0x47')],{})['then'](respondWithResult(_0x42de9c,0xc9))[_0xd0e3('0x44')](handleError(_0x42de9c,null));};exports[_0xd0e3('0x1f')]=function(_0x3143b3,_0x58836f){if(_0x3143b3['body']['id']){delete _0x3143b3['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x3143b3[_0xd0e3('0x48')]['id']}})[_0xd0e3('0x20')](handleEntityNotFound(_0x58836f,null))[_0xd0e3('0x20')](saveUpdates(_0x3143b3[_0xd0e3('0x47')],null))[_0xd0e3('0x20')](respondWithResult(_0x58836f,null))[_0xd0e3('0x44')](handleError(_0x58836f,null));};exports[_0xd0e3('0x49')]=function(_0x3419ed,_0xb93006){return db[_0xd0e3('0x3f')][_0xd0e3('0x49')]()[_0xd0e3('0x20')](respondWithResult(_0xb93006,null))[_0xd0e3('0x44')](handleError(_0xb93006,null));};exports['download']=function(_0x22fffe,_0x279fdf,_0x39e2c3){var _0x1ac4ed=require(_0xd0e3('0x4a'));var _0x467565=![];var _0x29d75b={};if(_0x22fffe[_0xd0e3('0x31')][_0xd0e3('0x2c')]&&_0x22fffe[_0xd0e3('0x31')][_0xd0e3('0x2c')]===_0xd0e3('0x4b')){_0x29d75b['uniqueid']=_0x22fffe[_0xd0e3('0x48')]['id'];}else{_0x29d75b['id']=_0x22fffe[_0xd0e3('0x48')]['id'];}return db[_0xd0e3('0x3f')]['find']({'where':_0x29d75b,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x279fdf,null))[_0xd0e3('0x20')](function(_0x40bf1c){if(_0x40bf1c){var _0x37a626=_0x40bf1c['value'];var _0x56d7bb=util['format'](_0xd0e3('0x4c'),_0x37a626);if(fs[_0xd0e3('0x4d')](_0x56d7bb)){_0x467565=!![];return _0x1ac4ed[_0xd0e3('0x4e')](_0x56d7bb,_0x37a626,config[_0xd0e3('0x4f')][_0xd0e3('0x50')])[_0xd0e3('0x20')](function(){return _0x40bf1c;});}return _0x40bf1c;}})[_0xd0e3('0x20')](function(_0x3a2dd6){if(_0x3a2dd6){var _0x143919=_0x3a2dd6['value'];if(!fs['existsSync'](_0x143919)){throw new db[(_0xd0e3('0x51'))][(_0xd0e3('0x52'))](_0xd0e3('0x53'));}if(_0x3a2dd6[_0xd0e3('0x54')]){return _0x279fdf['download'](_0x143919,_0x3a2dd6[_0xd0e3('0x54')]+path[_0xd0e3('0x55')](_0x143919),function(){if(_0x467565){fs[_0xd0e3('0x56')](_0x143919);}});}else{return _0x279fdf[_0xd0e3('0x57')](_0x143919,function(_0x57b733){if(_0x467565){fs[_0xd0e3('0x56')](_0x143919);}});}}})[_0xd0e3('0x44')](function(_0x56ce58){if(_0x56ce58['message']===_0xd0e3('0x53')){_0x279fdf['status'](0x194)[_0xd0e3('0x27')](_0xd0e3('0x58'));}else{return handleError(_0x279fdf,null);}});};exports[_0xd0e3('0x59')]=function(_0x9a93a0,_0x257052,_0x4d1a49){var _0x575ad4=require(_0xd0e3('0x4a'));var _0xfa50fd=![];var _0x38d6ed={'$and':[db['sequelize']['where'](db[_0xd0e3('0x5a')]['fn'](_0xd0e3('0x5b'),db[_0xd0e3('0x5a')]['col']('uniqueid')),_0x9a93a0[_0xd0e3('0x31')][_0xd0e3('0x5c')])]};if(_0x9a93a0[_0xd0e3('0x31')][_0xd0e3('0x2c')]&&_0x9a93a0[_0xd0e3('0x31')]['type']==='uniqueid'){_0x38d6ed['$and']['push']({'uniqueid':_0x9a93a0[_0xd0e3('0x48')]['id']});}else{_0x38d6ed['$and'][_0xd0e3('0x5d')]({'id':_0x9a93a0[_0xd0e3('0x48')]['id']});}return db[_0xd0e3('0x3f')][_0xd0e3('0x5e')]({'where':_0x38d6ed,'attributes':['id',_0xd0e3('0x5f')],'raw':!![]})[_0xd0e3('0x20')](handleEntityNotFound(_0x257052,null))[_0xd0e3('0x20')](function(_0x525fdc){if(_0x525fdc){var _0x4c51e4=util[_0xd0e3('0x30')](_0xd0e3('0x4c'),_0x525fdc['value']);if(fs[_0xd0e3('0x4d')](_0x4c51e4)){_0xfa50fd=!![];return _0x575ad4[_0xd0e3('0x4e')](_0x4c51e4,_0x525fdc[_0xd0e3('0x5f')],config[_0xd0e3('0x4f')][_0xd0e3('0x50')])[_0xd0e3('0x20')](function(){return _0x525fdc;});}return _0x525fdc;}})[_0xd0e3('0x20')](function(_0x37f312){if(_0x37f312){if(!fs[_0xd0e3('0x4d')](_0x37f312['value'])){throw new db[(_0xd0e3('0x51'))][(_0xd0e3('0x52'))]('VoiceRecording\x20not\x20found');}if(_0x37f312[_0xd0e3('0x54')]){return _0x257052[_0xd0e3('0x57')](_0x37f312[_0xd0e3('0x5f')],_0x37f312[_0xd0e3('0x54')]+path[_0xd0e3('0x55')](_0x37f312[_0xd0e3('0x5f')]),function(){if(_0xfa50fd){fs[_0xd0e3('0x56')](_0x37f312[_0xd0e3('0x5f')]);}});}else{return _0x257052[_0xd0e3('0x57')](_0x37f312[_0xd0e3('0x5f')],function(_0x10d2cc){if(_0xfa50fd){fs[_0xd0e3('0x56')](_0x37f312[_0xd0e3('0x5f')]);}});}}})[_0xd0e3('0x44')](handleError(_0x257052,null));};exports[_0xd0e3('0x60')]=function(_0x194bba,_0x28fd9a){return db['VoiceRecording'][_0xd0e3('0x5e')]({'where':{'id':_0x194bba[_0xd0e3('0x48')]['id']}})[_0xd0e3('0x20')](function(_0xa52a10){if(_[_0xd0e3('0x61')](_0xa52a10)){throw new ReferenceError(_0xd0e3('0x62'));}return _0xa52a10;})[_0xd0e3('0x20')](function(_0x8965f6){var _0x347c17=_0x8965f6[_0xd0e3('0x5f')];logger['info'](_0xd0e3('0x63'),_0x347c17);if(!_['isNil'](_0x8965f6[_0xd0e3('0x5f')])&&fs[_0xd0e3('0x4d')](_0x347c17)){logger[_0xd0e3('0x64')]('File:\x20\x22'+_0x347c17+_0xd0e3('0x65'));fs[_0xd0e3('0x66')](_0x347c17);}_0x347c17=_0x347c17+_0xd0e3('0x67');if(!_[_0xd0e3('0x61')](_0x8965f6['value'])&&fs[_0xd0e3('0x4d')](_0x347c17)){logger[_0xd0e3('0x64')]('File:\x20\x22'+_0x347c17+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xd0e3('0x66')](_0x347c17);}return _0x8965f6;})[_0xd0e3('0x20')](function(_0x3a733a){if(!_0x3a733a)throw new InternalError();return _0x3a733a[_0xd0e3('0x60')]();})['then'](function(){_0x28fd9a[_0xd0e3('0x21')](0xcc)['end']();})[_0xd0e3('0x44')](handleError(_0x28fd9a,null));};function getBucketslist(_0x500d2e,_0x24f930,_0x37831c){return new Promise(function(_0xc16937,_0x106173){var _0x36a57e=new AWS['S3']({'accessKeyId':_0x24f930,'secretAccessKey':_0x500d2e,'region':_0x37831c});_0x36a57e[_0xd0e3('0x68')]({},function(_0x13800f,_0x53b523){if(_0x13800f){return _0x106173(_0x13800f);}else{return _0xc16937(_0x53b523);}});});}function createBucket(_0x5287e6,_0x42e250,_0x2c2d9b,_0x4d9542){return new Promise(function(_0x14a077,_0x91744f){var _0x2b50e6=new AWS['S3']({'accessKeyId':_0x42e250,'secretAccessKey':_0x5287e6,'region':_0x2c2d9b});_0x2b50e6[_0xd0e3('0x69')]({'Bucket':_0x4d9542},function(_0x148c13,_0x38ef16){if(_0x148c13){return _0x91744f(_0x148c13);}else{return _0x14a077(_0x38ef16);}});});}function uploadFile(_0x44604c,_0x918fa0,_0xf0ff40,_0x5252c1,_0x58597e,_0xc15019){return new Promise(function(_0x4c7695,_0x296ea6){var _0xd9dbe1=new AWS['S3']({'accessKeyId':_0x918fa0,'secretAccessKey':_0x44604c,'region':_0xf0ff40});_0xd9dbe1[_0xd0e3('0x6a')]({'Bucket':_0x5252c1,'Key':_0x58597e,'Body':_0xc15019},function(_0x1e093e,_0x14e653){if(_0x1e093e){return _0x296ea6(_0x1e093e);}else{return _0x4c7695(_0x14e653);}});});}function startTranscribe(_0x167ce1,_0x3ed482,_0x2ba379,_0x4e83a7,_0x5ca7b2,_0x1abc44){return new Promise(function(_0x4fcf95,_0x2e4efe){var _0x2cee63=new AWS['TranscribeService']({'accessKeyId':_0x3ed482,'secretAccessKey':_0x167ce1,'region':_0x2ba379});_0x2cee63[_0xd0e3('0x6b')]({'TranscriptionJobName':_0x4e83a7,'LanguageCode':_0x5ca7b2,'Media':{'MediaFileUri':_0x1abc44}},function(_0x3bd359,_0x3713c5){if(_0x3bd359){return _0x2e4efe(_0x3bd359);}else{return _0x4fcf95(_0x3713c5);}});});}function transcribe(_0x154213,_0x2a752b,_0x537ee8,_0x1c5e53,_0x1751ac,_0x317adb,_0x12cb02){return new Promise(function(_0x28aed2,_0x4badb0){var _0x2f5881={};logger[_0xd0e3('0x64')](util[_0xd0e3('0x30')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x154213,_0x1751ac));return uploadFile(_0x2a752b,_0x537ee8,_0x1c5e53,_0x1751ac,path[_0xd0e3('0x6c')](_0x317adb),fs['readFileSync'](_0x317adb))['then'](function(_0x5ba90f){logger[_0xd0e3('0x64')](util['format'](_0xd0e3('0x6d'),_0x154213,_0x1751ac,_0x5ba90f[_0xd0e3('0x6e')]));_0x2f5881[_0xd0e3('0x6f')]=_0x5ba90f[_0xd0e3('0x70')];_0x2f5881[_0xd0e3('0x71')]=_0x5ba90f[_0xd0e3('0x6e')];logger[_0xd0e3('0x64')](util['format'](_0xd0e3('0x72'),_0x154213));return startTranscribe(_0x2a752b,_0x537ee8,_0x1c5e53,uuidv4(),_0x12cb02,_0x5ba90f[_0xd0e3('0x6e')]);})['then'](function(_0x211f0d){logger[_0xd0e3('0x64')](util[_0xd0e3('0x30')](_0xd0e3('0x73'),_0x154213,_0x211f0d[_0xd0e3('0x74')][_0xd0e3('0x75')]));_0x2f5881['transcribeName']=_0x211f0d[_0xd0e3('0x74')][_0xd0e3('0x75')];_0x2f5881[_0xd0e3('0x76')]=_0x211f0d[_0xd0e3('0x74')][_0xd0e3('0x77')];return _0x28aed2(_0x2f5881);})['catch'](function(_0x3dc796){return _0x4badb0(_0x3dc796);});});}exports['runTranscribe']=function(_0x49b526,_0x592bc8,_0xe50079){var _0x3fed31;var _0x19843b;var _0x29ae92;var _0x584f35=require(_0xd0e3('0x4a'));return db['VoiceRecording'][_0xd0e3('0x78')]({'where':{'id':_0x49b526[_0xd0e3('0x48')]['id']}})[_0xd0e3('0x20')](function(_0x462991){if(_0x462991){var _0x1528ca=util['format'](_0xd0e3('0x4c'),_0x462991['value']);if(fs['existsSync'](_0x1528ca)){cypher=!![];return _0x584f35[_0xd0e3('0x4e')](_0x1528ca,_0x462991[_0xd0e3('0x5f')],config[_0xd0e3('0x4f')][_0xd0e3('0x50')])[_0xd0e3('0x20')](function(){return _0x462991;});}return _0x462991;}})[_0xd0e3('0x20')](function(_0x1db053){if(!_0x1db053){throw new db['Sequelize']['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x19843b=_0x1db053;return db[_0xd0e3('0x79')][_0xd0e3('0x78')]({'where':{'id':0x1}});})[_0xd0e3('0x20')](handleEntityNotFound(_0x592bc8,null))['then'](function(_0x56abdc){if(_0x56abdc){_0x3fed31=_0x56abdc;if(!_0x3fed31[_0xd0e3('0x7a')]||!_0x3fed31[_0xd0e3('0x7b')]||!_0x3fed31[_0xd0e3('0x7c')]||!_0x3fed31[_0xd0e3('0x7d')]||!_0x3fed31[_0xd0e3('0x6f')]){throw new db[(_0xd0e3('0x51'))][(_0xd0e3('0x52'))](_0xd0e3('0x7e'));}if(_0x49b526[_0xd0e3('0x47')][_0xd0e3('0x7f')]&&(!_0x3fed31['sentiment']||!_0x3fed31['sentimentAccountId']||!_0x3fed31[_0xd0e3('0x80')]||!_0x3fed31[_0xd0e3('0x7d')]||!_0x3fed31[_0xd0e3('0x6f')])){throw new db[(_0xd0e3('0x51'))][(_0xd0e3('0x52'))]('Sentiment\x20Analysis\x20not\x20configured');}return db['CloudProvider'][_0xd0e3('0x78')]({'where':{'id':_0x3fed31[_0xd0e3('0x7b')]}});}})['then'](function(_0x3805de){if(!_0x3805de){throw new db['Sequelize'][(_0xd0e3('0x52'))](_0xd0e3('0x81'));}if(!_0x3805de['data1']||!_0x3805de[_0xd0e3('0x82')]){throw new db[(_0xd0e3('0x51'))][(_0xd0e3('0x52'))](_0xd0e3('0x83'));}_0x29ae92=_0x3805de;return getBucketslist(_0x29ae92['data1'],_0x29ae92[_0xd0e3('0x82')],_0x3fed31['transcribeRegion']);})['then'](function(_0x49ce4d){if(_0x49ce4d&&_0x49ce4d['Buckets']){var _0x27f45b=_[_0xd0e3('0x5e')](_0x49ce4d['Buckets'],function(_0x49438b){return _0x49438b['Name']===_0x3fed31['bucket'];});if(!_0x27f45b){logger[_0xd0e3('0x64')](util[_0xd0e3('0x30')](_0xd0e3('0x84'),_0x49b526[_0xd0e3('0x48')]['id'],_0x3fed31[_0xd0e3('0x6f')]));return createBucket(_0x29ae92['data1'],_0x29ae92[_0xd0e3('0x82')],_0x3fed31[_0xd0e3('0x7c')],_0x3fed31[_0xd0e3('0x6f')]);}logger[_0xd0e3('0x64')](util['format'](_0xd0e3('0x85'),_0x49b526[_0xd0e3('0x48')]['id'],_0x3fed31[_0xd0e3('0x6f')]));return;}})[_0xd0e3('0x20')](function(_0x4cf168){if(_0x19843b[_0xd0e3('0x76')]==='NEW'){return transcribe(_0x49b526[_0xd0e3('0x48')]['id'],_0x29ae92[_0xd0e3('0x86')],_0x29ae92[_0xd0e3('0x82')],_0x3fed31[_0xd0e3('0x7c')],_0x3fed31[_0xd0e3('0x6f')],_0x19843b[_0xd0e3('0x5f')],_0x3fed31[_0xd0e3('0x7d')]);}else{logger[_0xd0e3('0x64')](util[_0xd0e3('0x30')](_0xd0e3('0x87'),_0x49b526[_0xd0e3('0x48')]['id']));return{'transcribeStatus':_0xd0e3('0x88')};}})['then'](function(_0x323bb1){if(_0x323bb1){_0x323bb1[_0xd0e3('0x89')]=_0x49b526[_0xd0e3('0x47')][_0xd0e3('0x7f')];return _0x19843b[_0xd0e3('0x8a')](_0x323bb1);}})[_0xd0e3('0x20')](respondWithResult(_0x592bc8,null))[_0xd0e3('0x44')](handleError(_0x592bc8,null));};function writeFile(_0x40afcd,_0x573cbc){return new Promise(function(_0x5b0e0a,_0x34e795){fs[_0xd0e3('0x8b')](_0x573cbc,_0x40afcd,function(_0x1d7a76,_0x2cd66e){if(_0x1d7a76){return _0x34e795(_0x1d7a76);}else{return _0x5b0e0a(_0x2cd66e);}});});}exports[_0xd0e3('0x8c')]=function(_0x539b7f,_0x27d361,_0x57b72e){return db[_0xd0e3('0x3f')][_0xd0e3('0x78')]({'where':{'id':_0x539b7f['params']['id']}})[_0xd0e3('0x20')](handleEntityNotFound(_0x27d361))[_0xd0e3('0x20')](function(_0x201f3a){if(_0x201f3a&&_0x201f3a[_0xd0e3('0x8d')]){var _0x18d861=_0x201f3a[_0xd0e3('0x8d')];var _0x33b3dc=config[_0xd0e3('0x8e')]+_0xd0e3('0x8f')+_0x201f3a['id']+'.txt';if(fs['existsSync'](_0x33b3dc)){return _0x33b3dc;}return writeFile(_0x18d861,_0x33b3dc)['then'](function(){return _0x33b3dc;});}else{throw new db[(_0xd0e3('0x51'))][(_0xd0e3('0x52'))](_0xd0e3('0x90'));}})[_0xd0e3('0x20')](function(_0x319d2b){return _0x27d361[_0xd0e3('0x57')](_0x319d2b);})[_0xd0e3('0x44')](handleError(_0x27d361));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 497c096..98a74e2 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 _0x6b23=['bluebird','request-promise','../../config/environment','exports','VoiceRecording','uniqueid','lodash','api','moment'];(function(_0x1e3923,_0x477ce9){var _0x36cd0f=function(_0x48e77d){while(--_0x48e77d){_0x1e3923['push'](_0x1e3923['shift']());}};_0x36cd0f(++_0x477ce9);}(_0x6b23,0x102));var _0x36b2=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x6b23[_0x279d37];return _0x530173;};'use strict';var _=require(_0x36b2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x36b2('0x1'));var moment=require(_0x36b2('0x2'));var BPromise=require(_0x36b2('0x3'));var rp=require(_0x36b2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x36b2('0x5'));var attributes=require('./voiceRecording.attributes');module[_0x36b2('0x6')]=function(_0x5bd38b,_0x1d18f7){return _0x5bd38b['define'](_0x36b2('0x7'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0x36b2('0x8'),'fields':[_0x36b2('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0b6c=['uniqueid','util','bluebird','path','rimraf','../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings'];(function(_0x56e4e8,_0x4db38f){var _0x376e63=function(_0x141906){while(--_0x141906){_0x56e4e8['push'](_0x56e4e8['shift']());}};_0x376e63(++_0x4db38f);}(_0x0b6c,0x6f));var _0xc0b6=function(_0x33e27e,_0x584210){_0x33e27e=_0x33e27e-0x0;var _0x51be34=_0x0b6c[_0x33e27e];return _0x51be34;};'use strict';var _=require('lodash');var util=require(_0xc0b6('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc0b6('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc0b6('0x2'));var rimraf=require(_0xc0b6('0x3'));var config=require(_0xc0b6('0x4'));var attributes=require(_0xc0b6('0x5'));module[_0xc0b6('0x6')]=function(_0x3c8750,_0x709711){return _0x3c8750[_0xc0b6('0x7')](_0xc0b6('0x8'),attributes,{'tableName':_0xc0b6('0x9'),'paranoid':![],'indexes':[{'name':_0xc0b6('0xa'),'fields':[_0xc0b6('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 62ff0fc..ba51823 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 _0xe2fe=['options','raw','where','attributes','limit','debug','catch','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','recording','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','UpdateVoiceRecording','VoiceRecording','update','body'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_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']('VoiceRecording,\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);});});}exports[_0xee2f('0x12')]=function(_0x502eb6){var _0x550da7=this;return new Promise(function(_0x40b5bc,_0x5a5078){return db[_0xee2f('0x13')][_0xee2f('0x14')](_0x502eb6[_0xee2f('0x15')],{'raw':_0x502eb6['options']?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x502eb6[_0xee2f('0x16')]?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x18')]||null:null,'attributes':_0x502eb6['options']?_0x502eb6['options'][_0xee2f('0x19')]||null:null,'limit':_0x502eb6[_0xee2f('0x16')]?_0x502eb6[_0xee2f('0x16')][_0xee2f('0x1a')]||null:null})[_0xee2f('0xa')](function(_0xf278cc){logger[_0xee2f('0xb')]('UpdateVoiceRecording',_0x502eb6);logger[_0xee2f('0x1b')](_0xee2f('0x12'),_0x502eb6,JSON[_0xee2f('0xd')](_0xf278cc));_0x40b5bc(_0xf278cc);})[_0xee2f('0x1c')](function(_0x820101){logger[_0xee2f('0xe')](_0xee2f('0x12'),_0x820101[_0xee2f('0xf')],_0x502eb6);_0x5a5078(_0x550da7[_0xee2f('0xe')](0x1f4,_0x820101[_0xee2f('0xf')]));});});};exports[_0xee2f('0x1d')]=function(_0x168adc){var _0x1c8454=this;return new Promise(function(_0x45c4a0,_0x53f6ed){var _0x4ef690=require('../../components/encryptor');var _0x18bdbb;return db[_0xee2f('0x1e')][_0xee2f('0x1f')]({'attributes':['id',_0xee2f('0x20')],'where':{'id':0x1},'raw':!![]})[_0xee2f('0xa')](function(_0x3737fd){_0x18bdbb=_0x3737fd;return db['VoiceRecording'][_0xee2f('0x21')](_0x168adc['body']);})[_0xee2f('0xa')](function(_0x180429){if(_0x18bdbb[_0xee2f('0x20')]&&fs[_0xee2f('0x22')](_0x180429[_0xee2f('0x23')])){var _0x47d5a6=util[_0xee2f('0x24')](_0xee2f('0x25'),_0x180429['value']);return _0x4ef690['encryptFile'](_0x180429[_0xee2f('0x23')],_0x47d5a6,config['secrets'][_0xee2f('0x26')])[_0xee2f('0xa')](function(){fs['unlink'](_0x180429[_0xee2f('0x23')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x180429;});}return _0x180429;})['then'](function(_0x3f1fe8){logger[_0xee2f('0xb')]('CreateVoiceRecording',_0x168adc);logger[_0xee2f('0x1b')](_0xee2f('0x1d'),_0x168adc,JSON[_0xee2f('0xd')](_0x3f1fe8));_0x45c4a0(_0x3f1fe8);})[_0xee2f('0x1c')](function(_0x1c3a01){logger['error'](_0xee2f('0x1d'),_0x1c3a01['message'],_0x168adc);_0x53f6ed(_0x1c8454[_0xee2f('0xe')](0x1f4,_0x1c3a01[_0xee2f('0xf')]));});});}; \ No newline at end of file +var _0x66fa=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceRecording,\x20%s,\x20%s','message','catch','VoiceRecording','update','body','options','raw','where','attributes','UpdateVoiceRecording','stringify'];(function(_0x24c856,_0x5da73d){var _0x3ccb92=function(_0x22f98a){while(--_0x22f98a){_0x24c856['push'](_0x24c856['shift']());}};_0x3ccb92(++_0x5da73d);}(_0x66fa,0x117));var _0xa66f=function(_0xae6a36,_0x57209c){_0xae6a36=_0xae6a36-0x0;var _0x3d9e14=_0x66fa[_0xae6a36];return _0x3d9e14;};'use strict';var _=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var moment=require('moment');var BPromise=require(_0xa66f('0x2'));var rs=require(_0xa66f('0x3'));var fs=require('fs');var Redis=require(_0xa66f('0x4'));var db=require(_0xa66f('0x5'))['db'];var utils=require(_0xa66f('0x6'));var logger=require(_0xa66f('0x7'))(_0xa66f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa66f('0x9')][_0xa66f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f0b78,_0x1d02fc,_0x38b58b){return new BPromise(function(_0x5096bf,_0x39c1ef){return client['request'](_0x2f0b78,_0x38b58b)[_0xa66f('0xb')](function(_0x597c7c){logger[_0xa66f('0xc')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,'request\x20sent');logger['debug'](_0xa66f('0xd'),_0x1d02fc,_0xa66f('0xe'),JSON['stringify'](_0x597c7c));if(_0x597c7c[_0xa66f('0xf')]){if(_0x597c7c['error'][_0xa66f('0x10')]===0x1f4){logger['error'](_0xa66f('0x11'),_0x1d02fc,_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);return _0x39c1ef(_0x597c7c['error']['message']);}logger[_0xa66f('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1d02fc,_0x597c7c['error']['message']);return _0x5096bf(_0x597c7c[_0xa66f('0xf')][_0xa66f('0x12')]);}else{logger[_0xa66f('0xc')](_0xa66f('0x11'),_0x1d02fc,_0xa66f('0xe'));_0x5096bf(_0x597c7c['result']['message']);}})[_0xa66f('0x13')](function(_0x32d338){logger[_0xa66f('0xf')](_0xa66f('0x11'),_0x1d02fc,_0x32d338);_0x39c1ef(_0x32d338);});});}exports['UpdateVoiceRecording']=function(_0x1cbe64){var _0x55b59d=this;return new Promise(function(_0x4a28d4,_0x2f9da2){return db[_0xa66f('0x14')][_0xa66f('0x15')](_0x1cbe64[_0xa66f('0x16')],{'raw':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x19')]||null:null,'attributes':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')][_0xa66f('0x1a')]||null:null,'limit':_0x1cbe64[_0xa66f('0x17')]?_0x1cbe64[_0xa66f('0x17')]['limit']||null:null})[_0xa66f('0xb')](function(_0xc5c82e){logger[_0xa66f('0xc')](_0xa66f('0x1b'),_0x1cbe64);logger['debug'](_0xa66f('0x1b'),_0x1cbe64,JSON[_0xa66f('0x1c')](_0xc5c82e));_0x4a28d4(_0xc5c82e);})[_0xa66f('0x13')](function(_0x16f1fa){logger['error']('UpdateVoiceRecording',_0x16f1fa[_0xa66f('0x12')],_0x1cbe64);_0x2f9da2(_0x55b59d['error'](0x1f4,_0x16f1fa[_0xa66f('0x12')]));});});};exports[_0xa66f('0x1d')]=function(_0x384164){var _0x57da7f=this;return new Promise(function(_0x4683c7,_0x1c2903){var _0x13495f=require(_0xa66f('0x1e'));var _0x17c103;return db[_0xa66f('0x1f')][_0xa66f('0x20')]({'attributes':['id',_0xa66f('0x21')],'where':{'id':0x1},'raw':!![]})[_0xa66f('0xb')](function(_0x117d03){_0x17c103=_0x117d03;return db[_0xa66f('0x14')][_0xa66f('0x22')](_0x384164[_0xa66f('0x16')]);})[_0xa66f('0xb')](function(_0x49f615){if(_0x17c103['callRecordingEncryption']&&fs[_0xa66f('0x23')](_0x49f615[_0xa66f('0x24')])){var _0x55f309=util[_0xa66f('0x25')](_0xa66f('0x26'),_0x49f615['value']);return _0x13495f[_0xa66f('0x27')](_0x49f615[_0xa66f('0x24')],_0x55f309,config[_0xa66f('0x28')][_0xa66f('0x29')])[_0xa66f('0xb')](function(){fs['unlink'](_0x49f615[_0xa66f('0x24')]);logger['info'](_0xa66f('0x2a'));return _0x49f615;});}return _0x49f615;})[_0xa66f('0xb')](function(_0x2e4dc8){logger['info'](_0xa66f('0x1d'),_0x384164);logger[_0xa66f('0x2b')]('CreateVoiceRecording',_0x384164,JSON[_0xa66f('0x1c')](_0x2e4dc8));_0x4683c7(_0x2e4dc8);})[_0xa66f('0x13')](function(_0xba9457){logger[_0xa66f('0xf')](_0xa66f('0x1d'),_0xba9457[_0xa66f('0x12')],_0x384164);_0x1c2903(_0x57da7f[_0xa66f('0xf')](0x1f4,_0xba9457[_0xa66f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index ee262c6..58c44a3 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 _0x6bae=['../../components/auth/service','../../config/environment','./voiceTransferReport.controller','get','/describe','describe','isAuthenticated','show','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6bae,0x174));var _0xe6ba=function(_0x540673,_0x5c1348){_0x540673=_0x540673-0x0;var _0xb057e3=_0x6bae[_0x540673];return _0xb057e3;};'use strict';var multer=require(_0xe6ba('0x0'));var util=require(_0xe6ba('0x1'));var path=require('path');var timeout=require(_0xe6ba('0x2'));var express=require(_0xe6ba('0x3'));var router=express[_0xe6ba('0x4')]();var fs_extra=require(_0xe6ba('0x5'));var auth=require(_0xe6ba('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe6ba('0x7'));var controller=require(_0xe6ba('0x8'));router[_0xe6ba('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe6ba('0x9')](_0xe6ba('0xa'),auth['isAuthenticated'](),controller[_0xe6ba('0xb')]);router[_0xe6ba('0x9')]('/:id',auth[_0xe6ba('0xc')](),controller[_0xe6ba('0xd')]);router[_0xe6ba('0xe')]('/',auth[_0xe6ba('0xc')](),controller[_0xe6ba('0xf')]);router[_0xe6ba('0x10')]('/:id',auth[_0xe6ba('0xc')](),controller[_0xe6ba('0x11')]);router['delete'](_0xe6ba('0x12'),auth[_0xe6ba('0xc')](),controller[_0xe6ba('0x13')]);module[_0xe6ba('0x14')]=router; \ No newline at end of file +var _0x8544=['../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x525d78,_0x14175d){var _0x4c203d=function(_0x45d4f4){while(--_0x45d4f4){_0x525d78['push'](_0x525d78['shift']());}};_0x4c203d(++_0x14175d);}(_0x8544,0x1c7));var _0x4854=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x8544[_0x576170];return _0x397c70;};'use strict';var multer=require(_0x4854('0x0'));var util=require(_0x4854('0x1'));var path=require(_0x4854('0x2'));var timeout=require('connect-timeout');var express=require(_0x4854('0x3'));var router=express['Router']();var fs_extra=require(_0x4854('0x4'));var auth=require(_0x4854('0x5'));var interaction=require(_0x4854('0x6'));var config=require(_0x4854('0x7'));var controller=require(_0x4854('0x8'));router[_0x4854('0x9')]('/',auth['isAuthenticated'](),controller[_0x4854('0xa')]);router[_0x4854('0x9')](_0x4854('0xb'),auth[_0x4854('0xc')](),controller[_0x4854('0xd')]);router[_0x4854('0x9')](_0x4854('0xe'),auth[_0x4854('0xc')](),controller[_0x4854('0xf')]);router[_0x4854('0x10')]('/',auth[_0x4854('0xc')](),controller[_0x4854('0x11')]);router[_0x4854('0x12')](_0x4854('0xe'),auth[_0x4854('0xc')](),controller[_0x4854('0x13')]);router['delete'](_0x4854('0xe'),auth['isAuthenticated'](),controller[_0x4854('0x14')]);module[_0x4854('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 8c13cda..1e81a0a 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 _0x22f5=['attended','STRING','sequelize','moment','exports','ENUM','blind'];(function(_0x4f3c9b,_0x28e078){var _0x84e58a=function(_0x37bf49){while(--_0x37bf49){_0x4f3c9b['push'](_0x4f3c9b['shift']());}};_0x84e58a(++_0x28e078);}(_0x22f5,0x79));var _0x522f=function(_0x5282d5,_0x31bda1){_0x5282d5=_0x5282d5-0x0;var _0x196ee8=_0x22f5[_0x5282d5];return _0x196ee8;};'use strict';var Sequelize=require(_0x522f('0x0'));var moment=require(_0x522f('0x1'));module[_0x522f('0x2')]={'type':{'type':Sequelize[_0x522f('0x3')](_0x522f('0x4'),_0x522f('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x522f('0x6')]},'transferercalleridname':{'type':Sequelize[_0x522f('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x522f('0x6')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0x522f('0x6')]},'transfererexten':{'type':Sequelize[_0x522f('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x522f('0x6')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x522f('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x522f('0x6')]},'transfereecontext':{'type':Sequelize[_0x522f('0x6')]},'transfereeexten':{'type':Sequelize[_0x522f('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x522f('0x6')]},'isexternal':{'type':Sequelize[_0x522f('0x3')]('Yes','No')},'context':{'type':Sequelize[_0x522f('0x6')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe858=['moment','ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x475cde,_0x1e1bdb){var _0x28b017=function(_0x2a2523){while(--_0x2a2523){_0x475cde['push'](_0x475cde['shift']());}};_0x28b017(++_0x1e1bdb);}(_0xe858,0x1b1));var _0x8e85=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xe858[_0x35a140];return _0x30ab82;};'use strict';var Sequelize=require(_0x8e85('0x0'));var moment=require(_0x8e85('0x1'));module['exports']={'type':{'type':Sequelize[_0x8e85('0x2')](_0x8e85('0x3'),_0x8e85('0x4'))},'result':{'type':Sequelize[_0x8e85('0x5')]},'transfererchannel':{'type':Sequelize[_0x8e85('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x8e85('0x5')]},'transferercalleridname':{'type':Sequelize[_0x8e85('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0x8e85('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x8e85('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x8e85('0x5')]},'transferercontext':{'type':Sequelize[_0x8e85('0x5')]},'transfererexten':{'type':Sequelize[_0x8e85('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x8e85('0x5')]},'transfereechannel':{'type':Sequelize[_0x8e85('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x8e85('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x8e85('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8e85('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x8e85('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x8e85('0x5')]},'transfereecontext':{'type':Sequelize[_0x8e85('0x5')]},'transfereeexten':{'type':Sequelize[_0x8e85('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x8e85('0x5')]},'isexternal':{'type':Sequelize[_0x8e85('0x2')](_0x8e85('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8e85('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 38b7318..3c9e1ce 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 _0x0156=['destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','then','includeAll','include','rows','catch','show','params','find','create','body'];(function(_0x2b7880,_0x4f5103){var _0x23e889=function(_0x160aa7){while(--_0x160aa7){_0x2b7880['push'](_0x2b7880['shift']());}};_0x23e889(++_0x4f5103);}(_0x0156,0x1ca));var _0x6015=function(_0x28eaea,_0x334baa){_0x28eaea=_0x28eaea-0x0;var _0x4938ef=_0x0156[_0x28eaea];return _0x4938ef;};'use strict';var emlformat=require(_0x6015('0x0'));var rimraf=require(_0x6015('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6015('0x2'));var rp=require(_0x6015('0x3'));var moment=require('moment');var BPromise=require(_0x6015('0x4'));var Mustache=require('mustache');var util=require(_0x6015('0x5'));var path=require(_0x6015('0x6'));var sox=require(_0x6015('0x7'));var csv=require(_0x6015('0x8'));var ejs=require(_0x6015('0x9'));var fs=require('fs');var fs_extra=require(_0x6015('0xa'));var _=require(_0x6015('0xb'));var squel=require(_0x6015('0xc'));var crypto=require(_0x6015('0xd'));var jsforce=require(_0x6015('0xe'));var deskjs=require(_0x6015('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6015('0x10'));var Redis=require('ioredis');var authService=require(_0x6015('0x11'));var qs=require(_0x6015('0x12'));var as=require(_0x6015('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6015('0x14'));var utils=require(_0x6015('0x15'));var config=require(_0x6015('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2946f2,_0x2c12f7){_0x2c12f7=_0x2c12f7||0xcc;return function(_0xcaffc9){if(_0xcaffc9){return _0x2946f2[_0x6015('0x17')](_0x2c12f7);}return _0x2946f2[_0x6015('0x18')](_0x2c12f7)[_0x6015('0x19')]();};}function respondWithResult(_0xb24641,_0x3d10c3){_0x3d10c3=_0x3d10c3||0xc8;return function(_0x12971c){if(_0x12971c){return _0xb24641['status'](_0x3d10c3)[_0x6015('0x1a')](_0x12971c);}};}function respondWithFilteredResult(_0x148435,_0x53f92d){return function(_0x5ad066){if(_0x5ad066){var _0x55a52f=typeof _0x53f92d[_0x6015('0x1b')]===_0x6015('0x1c')&&typeof _0x53f92d[_0x6015('0x1d')]===_0x6015('0x1c');var _0xeca8f3=_0x5ad066['count'];var _0x563e53=_0x55a52f?0x0:_0x53f92d[_0x6015('0x1b')];var _0x45a3e7=_0x55a52f?_0x5ad066['count']:_0x53f92d[_0x6015('0x1b')]+_0x53f92d[_0x6015('0x1d')];var _0x5f5732;if(_0x45a3e7>=_0xeca8f3){_0x45a3e7=_0xeca8f3;_0x5f5732=0xc8;}else{_0x5f5732=0xce;}_0x148435[_0x6015('0x18')](_0x5f5732);return _0x148435[_0x6015('0x1e')](_0x6015('0x1f'),_0x563e53+'-'+_0x45a3e7+'/'+_0xeca8f3)[_0x6015('0x1a')](_0x5ad066);}return null;};}function patchUpdates(_0x210907){return function(_0x2d6981){try{jsonpatch[_0x6015('0x20')](_0x2d6981,_0x210907,!![]);}catch(_0x4d330f){return BPromise[_0x6015('0x21')](_0x4d330f);}return _0x2d6981[_0x6015('0x22')]();};}function saveUpdates(_0x1d8326,_0x16d6b2){return function(_0x18d9dd){if(_0x18d9dd){return _0x18d9dd[_0x6015('0x23')](_0x1d8326)['then'](function(_0xa2f23d){return _0xa2f23d;});}return null;};}function removeEntity(_0x3b4279,_0xeaefef){return function(_0x462da6){if(_0x462da6){return _0x462da6['destroy']()['then'](function(){_0x3b4279[_0x6015('0x18')](0xcc)[_0x6015('0x19')]();});}};}function handleEntityNotFound(_0x4846bf,_0x2f3ecc){return function(_0x572bae){if(!_0x572bae){_0x4846bf[_0x6015('0x17')](0x194);}return _0x572bae;};}function handleError(_0x2f72f3,_0x577e33){_0x577e33=_0x577e33||0x1f4;return function(_0x48946f){logger[_0x6015('0x24')](_0x48946f[_0x6015('0x25')]);if(_0x48946f[_0x6015('0x26')]){delete _0x48946f[_0x6015('0x26')];}_0x2f72f3[_0x6015('0x18')](_0x577e33)['send'](_0x48946f);};}exports[_0x6015('0x27')]=function(_0x24ff57,_0x30983e){var _0x14315f={},_0x44172c={},_0x2859cf={'count':0x0,'rows':[]};var _0x39eb8e=_[_0x6015('0x28')](db[_0x6015('0x29')][_0x6015('0x2a')],function(_0x67bca8){return{'name':_0x67bca8[_0x6015('0x2b')],'type':_0x67bca8[_0x6015('0x2c')][_0x6015('0x2d')]};});_0x44172c[_0x6015('0x2e')]=_['map'](_0x39eb8e,'name');_0x44172c[_0x6015('0x2f')]=_[_0x6015('0x30')](_0x24ff57[_0x6015('0x2f')]);_0x44172c[_0x6015('0x31')]=_[_0x6015('0x32')](_0x44172c[_0x6015('0x2e')],_0x44172c[_0x6015('0x2f')]);_0x14315f['attributes']=_[_0x6015('0x32')](_0x44172c[_0x6015('0x2e')],qs['fields'](_0x24ff57['query'][_0x6015('0x33')]));_0x14315f[_0x6015('0x34')]=_0x14315f['attributes'][_0x6015('0x35')]?_0x14315f[_0x6015('0x34')]:_0x44172c[_0x6015('0x2e')];if(!_0x24ff57['query'][_0x6015('0x36')](_0x6015('0x37'))){_0x14315f[_0x6015('0x1d')]=qs[_0x6015('0x1d')](_0x24ff57[_0x6015('0x2f')]['limit']);_0x14315f[_0x6015('0x1b')]=qs[_0x6015('0x1b')](_0x24ff57[_0x6015('0x2f')][_0x6015('0x1b')]);}_0x14315f[_0x6015('0x38')]=qs[_0x6015('0x39')](_0x24ff57[_0x6015('0x2f')][_0x6015('0x39')]);_0x14315f[_0x6015('0x3a')]=qs['filters'](_['pick'](_0x24ff57['query'],_0x44172c[_0x6015('0x31')]),_0x39eb8e);if(_0x24ff57[_0x6015('0x2f')][_0x6015('0x3b')]){_0x14315f[_0x6015('0x3a')]=_[_0x6015('0x3c')](_0x14315f[_0x6015('0x3a')],{'$or':_['map'](_0x39eb8e,function(_0x2cda84){if(_0x2cda84[_0x6015('0x2c')]!==_0x6015('0x3d')){var _0x2f6b61={};_0x2f6b61[_0x2cda84[_0x6015('0x26')]]={'$like':'%'+_0x24ff57[_0x6015('0x2f')][_0x6015('0x3b')]+'%'};return _0x2f6b61;}})});}_0x14315f=_['merge']({},_0x14315f,_0x24ff57[_0x6015('0x3e')]);var _0x51895c={'where':_0x14315f[_0x6015('0x3a')]};return db['VoiceTransferReport'][_0x6015('0x3f')](_0x51895c)[_0x6015('0x40')](function(_0x141cde){_0x2859cf[_0x6015('0x3f')]=_0x141cde;if(_0x24ff57['query'][_0x6015('0x41')]){_0x14315f[_0x6015('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x14315f);})['then'](function(_0x13cbc3){_0x2859cf[_0x6015('0x43')]=_0x13cbc3;return _0x2859cf;})[_0x6015('0x40')](respondWithFilteredResult(_0x30983e,_0x14315f))[_0x6015('0x44')](handleError(_0x30983e,null));};exports[_0x6015('0x45')]=function(_0x1bcae8,_0x23fa33){var _0x89be69={'raw':!![],'where':{'id':_0x1bcae8[_0x6015('0x46')]['id']}},_0x164527={};_0x164527['model']=_[_0x6015('0x30')](db[_0x6015('0x29')][_0x6015('0x2a')]);_0x164527['query']=_[_0x6015('0x30')](_0x1bcae8[_0x6015('0x2f')]);_0x164527[_0x6015('0x31')]=_[_0x6015('0x32')](_0x164527['model'],_0x164527[_0x6015('0x2f')]);_0x89be69[_0x6015('0x34')]=_[_0x6015('0x32')](_0x164527[_0x6015('0x2e')],qs[_0x6015('0x33')](_0x1bcae8[_0x6015('0x2f')][_0x6015('0x33')]));_0x89be69[_0x6015('0x34')]=_0x89be69[_0x6015('0x34')]['length']?_0x89be69[_0x6015('0x34')]:_0x164527[_0x6015('0x2e')];if(_0x1bcae8[_0x6015('0x2f')]['includeAll']){_0x89be69[_0x6015('0x42')]=[{'all':!![]}];}_0x89be69=_[_0x6015('0x3c')]({},_0x89be69,_0x1bcae8[_0x6015('0x3e')]);return db['VoiceTransferReport'][_0x6015('0x47')](_0x89be69)[_0x6015('0x40')](handleEntityNotFound(_0x23fa33,null))[_0x6015('0x40')](respondWithResult(_0x23fa33,null))[_0x6015('0x44')](handleError(_0x23fa33,null));};exports[_0x6015('0x48')]=function(_0x541b41,_0x2b0368){return db['VoiceTransferReport'][_0x6015('0x48')](_0x541b41[_0x6015('0x49')],{})[_0x6015('0x40')](respondWithResult(_0x2b0368,0xc9))['catch'](handleError(_0x2b0368,null));};exports['update']=function(_0xfe0933,_0x14bfe9){if(_0xfe0933[_0x6015('0x49')]['id']){delete _0xfe0933[_0x6015('0x49')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0xfe0933[_0x6015('0x46')]['id']}})['then'](handleEntityNotFound(_0x14bfe9,null))[_0x6015('0x40')](saveUpdates(_0xfe0933[_0x6015('0x49')],null))[_0x6015('0x40')](respondWithResult(_0x14bfe9,null))[_0x6015('0x44')](handleError(_0x14bfe9,null));};exports[_0x6015('0x4a')]=function(_0x282a60,_0x443c8d){return db['VoiceTransferReport'][_0x6015('0x47')]({'where':{'id':_0x282a60[_0x6015('0x46')]['id']}})[_0x6015('0x40')](handleEntityNotFound(_0x443c8d,null))[_0x6015('0x40')](removeEntity(_0x443c8d,null))[_0x6015('0x44')](handleError(_0x443c8d,null));};exports[_0x6015('0x4b')]=function(_0x1f5ac8,_0x1ff411){return db['VoiceTransferReport']['describe']()[_0x6015('0x40')](respondWithResult(_0x1ff411,null))[_0x6015('0x44')](handleError(_0x1ff411,null));}; \ No newline at end of file +var _0x7c09=['crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','map','VoiceTransferReport','rawAttributes','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x493353,_0x4a2fa9){var _0x52bf9b=function(_0x1bc25e){while(--_0x1bc25e){_0x493353['push'](_0x493353['shift']());}};_0x52bf9b(++_0x4a2fa9);}(_0x7c09,0x16a));var _0x97c0=function(_0x59810d,_0x179d93){_0x59810d=_0x59810d-0x0;var _0x469c27=_0x7c09[_0x59810d];return _0x469c27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97c0('0x1'));var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require(_0x97c0('0x9'));var ejs=require(_0x97c0('0xa'));var fs=require('fs');var fs_extra=require(_0x97c0('0xb'));var _=require('lodash');var squel=require(_0x97c0('0xc'));var crypto=require(_0x97c0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x97c0('0xe'));var toCsv=require(_0x97c0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require(_0x97c0('0x11'));var as=require(_0x97c0('0x12'));var hardwareService=require(_0x97c0('0x13'));var logger=require(_0x97c0('0x14'))(_0x97c0('0x15'));var utils=require(_0x97c0('0x16'));var config=require(_0x97c0('0x17'));var licenseUtil=require(_0x97c0('0x18'));var db=require(_0x97c0('0x19'))['db'];function respondWithStatusCode(_0x1516e6,_0x145811){_0x145811=_0x145811||0xcc;return function(_0x21a9a9){if(_0x21a9a9){return _0x1516e6[_0x97c0('0x1a')](_0x145811);}return _0x1516e6[_0x97c0('0x1b')](_0x145811)[_0x97c0('0x1c')]();};}function respondWithResult(_0x1bef8d,_0x4c6ab3){_0x4c6ab3=_0x4c6ab3||0xc8;return function(_0x11f2e8){if(_0x11f2e8){return _0x1bef8d[_0x97c0('0x1b')](_0x4c6ab3)[_0x97c0('0x1d')](_0x11f2e8);}};}function respondWithFilteredResult(_0x2108fe,_0x3f4b62){return function(_0x4afcb4){if(_0x4afcb4){var _0xe89950=typeof _0x3f4b62['offset']===_0x97c0('0x1e')&&typeof _0x3f4b62[_0x97c0('0x1f')]==='undefined';var _0x5dc2a3=_0x4afcb4[_0x97c0('0x20')];var _0x1d862d=_0xe89950?0x0:_0x3f4b62[_0x97c0('0x21')];var _0x234ca5=_0xe89950?_0x4afcb4['count']:_0x3f4b62['offset']+_0x3f4b62[_0x97c0('0x1f')];var _0x39bb60;if(_0x234ca5>=_0x5dc2a3){_0x234ca5=_0x5dc2a3;_0x39bb60=0xc8;}else{_0x39bb60=0xce;}_0x2108fe['status'](_0x39bb60);return _0x2108fe[_0x97c0('0x22')](_0x97c0('0x23'),_0x1d862d+'-'+_0x234ca5+'/'+_0x5dc2a3)['json'](_0x4afcb4);}return null;};}function patchUpdates(_0xbdcfdd){return function(_0x67fac1){try{jsonpatch['apply'](_0x67fac1,_0xbdcfdd,!![]);}catch(_0x359eef){return BPromise[_0x97c0('0x24')](_0x359eef);}return _0x67fac1[_0x97c0('0x25')]();};}function saveUpdates(_0xf1f3e,_0x5e1acd){return function(_0x2c74b1){if(_0x2c74b1){return _0x2c74b1[_0x97c0('0x26')](_0xf1f3e)['then'](function(_0x3708a1){return _0x3708a1;});}return null;};}function removeEntity(_0x53007b,_0x198545){return function(_0x29a293){if(_0x29a293){return _0x29a293[_0x97c0('0x27')]()[_0x97c0('0x28')](function(){_0x53007b[_0x97c0('0x1b')](0xcc)[_0x97c0('0x1c')]();});}};}function handleEntityNotFound(_0x297482,_0x336b5e){return function(_0x504767){if(!_0x504767){_0x297482[_0x97c0('0x1a')](0x194);}return _0x504767;};}function handleError(_0x41d5f7,_0x1a07a4){_0x1a07a4=_0x1a07a4||0x1f4;return function(_0x1abe49){logger[_0x97c0('0x29')](_0x1abe49[_0x97c0('0x2a')]);if(_0x1abe49['name']){delete _0x1abe49['name'];}_0x41d5f7[_0x97c0('0x1b')](_0x1a07a4)['send'](_0x1abe49);};}exports['index']=function(_0x4ffd18,_0x5944b9){var _0x4d374e={},_0x16301b={},_0x33682e={'count':0x0,'rows':[]};var _0x1e6c11=_[_0x97c0('0x2b')](db[_0x97c0('0x2c')][_0x97c0('0x2d')],function(_0x188d5d){return{'name':_0x188d5d['fieldName'],'type':_0x188d5d[_0x97c0('0x2e')][_0x97c0('0x2f')]};});_0x16301b[_0x97c0('0x30')]=_[_0x97c0('0x2b')](_0x1e6c11,_0x97c0('0x31'));_0x16301b[_0x97c0('0x32')]=_[_0x97c0('0x33')](_0x4ffd18[_0x97c0('0x32')]);_0x16301b[_0x97c0('0x34')]=_[_0x97c0('0x35')](_0x16301b[_0x97c0('0x30')],_0x16301b[_0x97c0('0x32')]);_0x4d374e[_0x97c0('0x36')]=_[_0x97c0('0x35')](_0x16301b[_0x97c0('0x30')],qs[_0x97c0('0x37')](_0x4ffd18[_0x97c0('0x32')]['fields']));_0x4d374e[_0x97c0('0x36')]=_0x4d374e[_0x97c0('0x36')][_0x97c0('0x38')]?_0x4d374e[_0x97c0('0x36')]:_0x16301b[_0x97c0('0x30')];if(!_0x4ffd18['query'][_0x97c0('0x39')](_0x97c0('0x3a'))){_0x4d374e['limit']=qs['limit'](_0x4ffd18['query'][_0x97c0('0x1f')]);_0x4d374e['offset']=qs['offset'](_0x4ffd18[_0x97c0('0x32')]['offset']);}_0x4d374e[_0x97c0('0x3b')]=qs['sort'](_0x4ffd18[_0x97c0('0x32')][_0x97c0('0x3c')]);_0x4d374e['where']=qs[_0x97c0('0x34')](_['pick'](_0x4ffd18[_0x97c0('0x32')],_0x16301b[_0x97c0('0x34')]),_0x1e6c11);if(_0x4ffd18['query'][_0x97c0('0x3d')]){_0x4d374e[_0x97c0('0x3e')]=_['merge'](_0x4d374e[_0x97c0('0x3e')],{'$or':_[_0x97c0('0x2b')](_0x1e6c11,function(_0x2426b9){if(_0x2426b9['type']!=='VIRTUAL'){var _0x151759={};_0x151759[_0x2426b9[_0x97c0('0x31')]]={'$like':'%'+_0x4ffd18[_0x97c0('0x32')][_0x97c0('0x3d')]+'%'};return _0x151759;}})});}_0x4d374e=_[_0x97c0('0x3f')]({},_0x4d374e,_0x4ffd18[_0x97c0('0x40')]);var _0x30f7de={'where':_0x4d374e['where']};return db[_0x97c0('0x2c')]['count'](_0x30f7de)[_0x97c0('0x28')](function(_0x55b6d5){_0x33682e[_0x97c0('0x20')]=_0x55b6d5;if(_0x4ffd18[_0x97c0('0x32')][_0x97c0('0x41')]){_0x4d374e[_0x97c0('0x42')]=[{'all':!![]}];}return db[_0x97c0('0x2c')][_0x97c0('0x43')](_0x4d374e);})[_0x97c0('0x28')](function(_0x74fdb2){_0x33682e[_0x97c0('0x44')]=_0x74fdb2;return _0x33682e;})[_0x97c0('0x28')](respondWithFilteredResult(_0x5944b9,_0x4d374e))[_0x97c0('0x45')](handleError(_0x5944b9,null));};exports[_0x97c0('0x46')]=function(_0x3529f9,_0x4f5541){var _0x5b31cd={'raw':!![],'where':{'id':_0x3529f9[_0x97c0('0x47')]['id']}},_0x2b67b7={};_0x2b67b7[_0x97c0('0x30')]=_[_0x97c0('0x33')](db[_0x97c0('0x2c')][_0x97c0('0x2d')]);_0x2b67b7[_0x97c0('0x32')]=_[_0x97c0('0x33')](_0x3529f9[_0x97c0('0x32')]);_0x2b67b7[_0x97c0('0x34')]=_['intersection'](_0x2b67b7[_0x97c0('0x30')],_0x2b67b7[_0x97c0('0x32')]);_0x5b31cd[_0x97c0('0x36')]=_[_0x97c0('0x35')](_0x2b67b7[_0x97c0('0x30')],qs[_0x97c0('0x37')](_0x3529f9[_0x97c0('0x32')][_0x97c0('0x37')]));_0x5b31cd[_0x97c0('0x36')]=_0x5b31cd[_0x97c0('0x36')][_0x97c0('0x38')]?_0x5b31cd[_0x97c0('0x36')]:_0x2b67b7[_0x97c0('0x30')];if(_0x3529f9[_0x97c0('0x32')][_0x97c0('0x41')]){_0x5b31cd[_0x97c0('0x42')]=[{'all':!![]}];}_0x5b31cd=_[_0x97c0('0x3f')]({},_0x5b31cd,_0x3529f9[_0x97c0('0x40')]);return db['VoiceTransferReport'][_0x97c0('0x48')](_0x5b31cd)[_0x97c0('0x28')](handleEntityNotFound(_0x4f5541,null))['then'](respondWithResult(_0x4f5541,null))['catch'](handleError(_0x4f5541,null));};exports[_0x97c0('0x49')]=function(_0x4954b6,_0x595717){return db[_0x97c0('0x2c')]['create'](_0x4954b6[_0x97c0('0x4a')],{})[_0x97c0('0x28')](respondWithResult(_0x595717,0xc9))['catch'](handleError(_0x595717,null));};exports['update']=function(_0x2d2d0b,_0x166081){if(_0x2d2d0b[_0x97c0('0x4a')]['id']){delete _0x2d2d0b[_0x97c0('0x4a')]['id'];}return db[_0x97c0('0x2c')][_0x97c0('0x48')]({'where':{'id':_0x2d2d0b[_0x97c0('0x47')]['id']}})['then'](handleEntityNotFound(_0x166081,null))[_0x97c0('0x28')](saveUpdates(_0x2d2d0b[_0x97c0('0x4a')],null))[_0x97c0('0x28')](respondWithResult(_0x166081,null))[_0x97c0('0x45')](handleError(_0x166081,null));};exports[_0x97c0('0x27')]=function(_0xc13863,_0x55891b){return db['VoiceTransferReport'][_0x97c0('0x48')]({'where':{'id':_0xc13863['params']['id']}})[_0x97c0('0x28')](handleEntityNotFound(_0x55891b,null))[_0x97c0('0x28')](removeEntity(_0x55891b,null))[_0x97c0('0x45')](handleError(_0x55891b,null));};exports['describe']=function(_0x49e227,_0xafd3ff){return db['VoiceTransferReport']['describe']()[_0x97c0('0x28')](respondWithResult(_0xafd3ff,null))['catch'](handleError(_0xafd3ff,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 041f565..730090a 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 _0xb10e=['../../config/environment','./voiceTransferReport.attributes','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x47698e,_0x4224d6){var _0x4600dd=function(_0x56350f){while(--_0x56350f){_0x47698e['push'](_0x47698e['shift']());}};_0x4600dd(++_0x4224d6);}(_0xb10e,0xc2));var _0xeb10=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xb10e[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xeb10('0x0'));var util=require(_0xeb10('0x1'));var logger=require(_0xeb10('0x2'))(_0xeb10('0x3'));var moment=require(_0xeb10('0x4'));var BPromise=require(_0xeb10('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xeb10('0x6'));var attributes=require(_0xeb10('0x7'));module['exports']=function(_0x49fb4a,_0x58e01d){return _0x49fb4a['define'](_0xeb10('0x8'),attributes,{'tableName':_0xeb10('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b81=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x5bb77c,_0x406b58){var _0x4373d7=function(_0xbf0723){while(--_0xbf0723){_0x5bb77c['push'](_0x5bb77c['shift']());}};_0x4373d7(++_0x406b58);}(_0x9b81,0x1cc));var _0x19b8=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x9b81[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x19b8('0x0'))(_0x19b8('0x1'));var moment=require(_0x19b8('0x2'));var BPromise=require(_0x19b8('0x3'));var rp=require(_0x19b8('0x4'));var fs=require('fs');var path=require(_0x19b8('0x5'));var rimraf=require(_0x19b8('0x6'));var config=require(_0x19b8('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x19b8('0x8')]=function(_0x4b856d,_0x546582){return _0x4b856d[_0x19b8('0x9')]('VoiceTransferReport',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 6a3d7b4..5a27490 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 _0xdf53=['raw','info','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options'];(function(_0x4d686b,_0x1483a1){var _0x1608e3=function(_0x1689c3){while(--_0x1689c3){_0x4d686b['push'](_0x4d686b['shift']());}};_0x1608e3(++_0x1483a1);}(_0xdf53,0xe2));var _0x3df5=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xdf53[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x3df5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3df5('0x1'));var fs=require('fs');var Redis=require(_0x3df5('0x2'));var db=require(_0x3df5('0x3'))['db'];var utils=require(_0x3df5('0x4'));var logger=require(_0x3df5('0x5'))(_0x3df5('0x6'));var config=require(_0x3df5('0x7'));var jayson=require(_0x3df5('0x8'));var client=jayson[_0x3df5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c58be,_0x14948d,_0x14d507){return new BPromise(function(_0x6c1e34,_0x1a2dfd){return client[_0x3df5('0xa')](_0x3c58be,_0x14d507)[_0x3df5('0xb')](function(_0x41a5d7){logger['info'](_0x3df5('0xc'),_0x14948d,'request\x20sent');logger[_0x3df5('0xd')](_0x3df5('0xe'),_0x14948d,_0x3df5('0xf'),JSON[_0x3df5('0x10')](_0x41a5d7));if(_0x41a5d7[_0x3df5('0x11')]){if(_0x41a5d7[_0x3df5('0x11')]['code']===0x1f4){logger[_0x3df5('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x14948d,_0x41a5d7[_0x3df5('0x11')]['message']);return _0x1a2dfd(_0x41a5d7[_0x3df5('0x11')][_0x3df5('0x12')]);}logger[_0x3df5('0x11')](_0x3df5('0xc'),_0x14948d,_0x41a5d7['error'][_0x3df5('0x12')]);return _0x6c1e34(_0x41a5d7[_0x3df5('0x11')][_0x3df5('0x12')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x14948d,'request\x20sent');_0x6c1e34(_0x41a5d7[_0x3df5('0x13')]['message']);}})[_0x3df5('0x14')](function(_0x891c21){logger[_0x3df5('0x11')](_0x3df5('0xc'),_0x14948d,_0x891c21);_0x1a2dfd(_0x891c21);});});}exports[_0x3df5('0x15')]=function(_0x32226d){var _0x57e35b=this;return new Promise(function(_0x2b8a7c,_0x4386b3){return db[_0x3df5('0x16')][_0x3df5('0x17')](_0x32226d[_0x3df5('0x18')],{'raw':_0x32226d[_0x3df5('0x19')]?_0x32226d[_0x3df5('0x19')][_0x3df5('0x1a')]===undefined?!![]:![]:!![]})[_0x3df5('0xb')](function(_0x40b778){logger[_0x3df5('0x1b')](_0x3df5('0x15'),_0x32226d);logger['debug'](_0x3df5('0x15'),_0x32226d,JSON[_0x3df5('0x10')](_0x40b778));_0x2b8a7c(_0x40b778);})['catch'](function(_0x392aa5){logger[_0x3df5('0x11')](_0x3df5('0x15'),_0x392aa5[_0x3df5('0x12')],_0x32226d);_0x4386b3(_0x57e35b[_0x3df5('0x11')](0x1f4,_0x392aa5[_0x3df5('0x12')]));});});}; \ No newline at end of file +var _0xfe22=['VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','then','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','info','VoiceTransferReport,\x20%s,\x20%s','debug'];(function(_0x46dedf,_0xa59cac){var _0x3851dc=function(_0x3bd161){while(--_0x3bd161){_0x46dedf['push'](_0x46dedf['shift']());}};_0x3851dc(++_0xa59cac);}(_0xfe22,0x1a2));var _0x2fe2=function(_0x404944,_0x4b7782){_0x404944=_0x404944-0x0;var _0x5a47d1=_0xfe22[_0x404944];return _0x5a47d1;};'use strict';var _=require(_0x2fe2('0x0'));var util=require(_0x2fe2('0x1'));var moment=require('moment');var BPromise=require(_0x2fe2('0x2'));var rs=require(_0x2fe2('0x3'));var fs=require('fs');var Redis=require(_0x2fe2('0x4'));var db=require(_0x2fe2('0x5'))['db'];var utils=require(_0x2fe2('0x6'));var logger=require(_0x2fe2('0x7'))(_0x2fe2('0x8'));var config=require(_0x2fe2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2fe2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c5007,_0x250a56,_0x484f89){return new BPromise(function(_0x58b056,_0x1cb021){return client['request'](_0x4c5007,_0x484f89)['then'](function(_0x3e9178){logger[_0x2fe2('0xb')](_0x2fe2('0xc'),_0x250a56,'request\x20sent');logger[_0x2fe2('0xd')](_0x2fe2('0xe'),_0x250a56,'request\x20sent',JSON[_0x2fe2('0xf')](_0x3e9178));if(_0x3e9178['error']){if(_0x3e9178[_0x2fe2('0x10')][_0x2fe2('0x11')]===0x1f4){logger[_0x2fe2('0x10')](_0x2fe2('0xc'),_0x250a56,_0x3e9178['error'][_0x2fe2('0x12')]);return _0x1cb021(_0x3e9178[_0x2fe2('0x10')][_0x2fe2('0x12')]);}logger[_0x2fe2('0x10')](_0x2fe2('0xc'),_0x250a56,_0x3e9178['error'][_0x2fe2('0x12')]);return _0x58b056(_0x3e9178[_0x2fe2('0x10')][_0x2fe2('0x12')]);}else{logger['info'](_0x2fe2('0xc'),_0x250a56,'request\x20sent');_0x58b056(_0x3e9178[_0x2fe2('0x13')][_0x2fe2('0x12')]);}})['catch'](function(_0x5bec16){logger[_0x2fe2('0x10')](_0x2fe2('0xc'),_0x250a56,_0x5bec16);_0x1cb021(_0x5bec16);});});}exports[_0x2fe2('0x14')]=function(_0x42511f){var _0x11fc3d=this;return new Promise(function(_0xfe07e0,_0x236ff1){return db[_0x2fe2('0x15')]['create'](_0x42511f[_0x2fe2('0x16')],{'raw':_0x42511f[_0x2fe2('0x17')]?_0x42511f[_0x2fe2('0x17')][_0x2fe2('0x18')]===undefined?!![]:![]:!![]})[_0x2fe2('0x19')](function(_0x5f54be){logger[_0x2fe2('0xb')]('CreateVoiceTransferReport',_0x42511f);logger['debug']('CreateVoiceTransferReport',_0x42511f,JSON['stringify'](_0x5f54be));_0xfe07e0(_0x5f54be);})[_0x2fe2('0x1a')](function(_0x5f4d11){logger[_0x2fe2('0x10')](_0x2fe2('0x14'),_0x5f4d11[_0x2fe2('0x12')],_0x42511f);_0x236ff1(_0x11fc3d['error'](0x1f4,_0x5f4d11[_0x2fe2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index b24fd3a..a5a4d2f 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 _0x526d=['/unhold','unhold','/calls','calls','/transfer','transfer','express','Router','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','answer','/hold'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0x526d,0x15c));var _0xd526=function(_0x48ee30,_0x4cb1c6){_0x48ee30=_0x48ee30-0x0;var _0x160817=_0x526d[_0x48ee30];return _0x160817;};'use strict';var express=require(_0xd526('0x0'));var router=express[_0xd526('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xd526('0x2'));router[_0xd526('0x3')](_0xd526('0x4'),auth[_0xd526('0x5')](),auth[_0xd526('0x6')](),controller[_0xd526('0x7')]);router[_0xd526('0x3')](_0xd526('0x8'),auth[_0xd526('0x5')](),auth['canUpdate'](),controller[_0xd526('0x9')]);router[_0xd526('0x3')](_0xd526('0xa'),auth[_0xd526('0x5')](),auth[_0xd526('0x6')](),controller[_0xd526('0xb')]);router[_0xd526('0x3')](_0xd526('0xc'),auth['isAuthenticated'](),auth[_0xd526('0x6')](),controller['hold']);router[_0xd526('0x3')](_0xd526('0xd'),auth['isAuthenticated'](),auth[_0xd526('0x6')](),controller[_0xd526('0xe')]);router[_0xd526('0x3')](_0xd526('0xf'),auth[_0xd526('0x5')](),auth[_0xd526('0x6')](),controller[_0xd526('0x10')]);router['post'](_0xd526('0x11'),auth[_0xd526('0x5')](),auth['canUpdate'](),controller[_0xd526('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3684=['hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','answer','/hold'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x3684,0xbc));var _0x4368=function(_0x96a4ee,_0x4d83d5){_0x96a4ee=_0x96a4ee-0x0;var _0x3c0b24=_0x3684[_0x96a4ee];return _0x3c0b24;};'use strict';var express=require(_0x4368('0x0'));var router=express[_0x4368('0x1')]();var auth=require(_0x4368('0x2'));var controller=require(_0x4368('0x3'));router[_0x4368('0x4')](_0x4368('0x5'),auth[_0x4368('0x6')](),auth[_0x4368('0x7')](),controller[_0x4368('0x8')]);router['post'](_0x4368('0x9'),auth[_0x4368('0x6')](),auth['canUpdate'](),controller['hangup']);router['post']('/answer',auth[_0x4368('0x6')](),auth[_0x4368('0x7')](),controller[_0x4368('0xa')]);router[_0x4368('0x4')](_0x4368('0xb'),auth[_0x4368('0x6')](),auth[_0x4368('0x7')](),controller[_0x4368('0xc')]);router['post'](_0x4368('0xd'),auth[_0x4368('0x6')](),auth[_0x4368('0x7')](),controller[_0x4368('0xe')]);router[_0x4368('0x4')](_0x4368('0xf'),auth[_0x4368('0x6')](),auth[_0x4368('0x7')](),controller[_0x4368('0x10')]);router[_0x4368('0x4')](_0x4368('0x11'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x4368('0x12')]);module[_0x4368('0x13')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index b29f161..a1f11c8 100644 --- a/server/api/webbar/webbar.controller.js +++ b/server/api/webbar/webbar.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f7a=['findOne','agent','then','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','code','catch','User'];(function(_0x3da832,_0x2133f1){var _0xe602f2=function(_0xb7b2f){while(--_0xb7b2f){_0x3da832['push'](_0x3da832['shift']());}};_0xe602f2(++_0x2133f1);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x3f1c5c,_0x49e24b){_0x3f1c5c=_0x3f1c5c-0x0;var _0x702595=_0x6f7a[_0x3f1c5c];return _0x702595;};'use strict';var path=require(_0xa6f7('0x0'));var fs=require('fs');var _=require(_0xa6f7('0x1'));var db=require(_0xa6f7('0x2'))['db'];var config=require(_0xa6f7('0x3'));var util=require('util');var BPromise=require(_0xa6f7('0x4'));var jayson=require(_0xa6f7('0x5'));var amiClient=jayson[_0xa6f7('0x6')][_0xa6f7('0x7')]({'port':0x232a});var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));var Redis=require(_0xa6f7('0xa'));config[_0xa6f7('0xb')]=_[_0xa6f7('0xc')](config[_0xa6f7('0xb')],{'host':_0xa6f7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xa6f7('0xe'));var originateValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'callNumber':{'type':_0xa6f7('0x11'),'required':[!![],_0xa6f7('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa6f7('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':_0xa6f7('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xa6f7('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':_0xa6f7('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]}});function emit(_0x6efd38,_0x47e664,_0xdb37e2){logger[_0xa6f7('0x13')](_0x6efd38,_0x47e664,JSON[_0xa6f7('0x14')](_0xdb37e2));io['to'](_0x6efd38)[_0xa6f7('0x15')](_0x47e664,_0xdb37e2);}function handleError(_0x5681d5){return function(_0x4a8827){console[_0xa6f7('0x16')]('handleError:',_0x4a8827,_0x4a8827 instanceof RangeError);logger[_0xa6f7('0x17')](_0x4a8827[_0xa6f7('0x18')]);if(_0x4a8827 instanceof RangeError){if(_0x4a8827['name']){delete _0x4a8827[_0xa6f7('0x19')];}_0x5681d5[_0xa6f7('0x1a')](0x194)[_0xa6f7('0x1b')](_0x4a8827);}else{if(_0x4a8827[_0xa6f7('0x19')]){delete _0x4a8827[_0xa6f7('0x19')];}_0x5681d5[_0xa6f7('0x1a')](0x1f4)['send'](_0x4a8827);}};}function checkError(){return function(_0x3c0c55){if(!_0x3c0c55){throw new RangeError(_0xa6f7('0x1c'));}return _0x3c0c55;};}function respondWithRpcPromise(_0x58b6a1,_0x5d1159){return new BPromise(function(_0x5ddc8d,_0x1de6c9){var _0x119950=amiClient;return _0x119950['request'](_0x58b6a1,_0x5d1159)['then'](function(_0x50e2be){if(_0x50e2be[_0xa6f7('0x17')]){if(_0x50e2be[_0xa6f7('0x17')][_0xa6f7('0x1d')]===0x1f4){return _0x1de6c9(_0x50e2be['error']['message']);}return _0x5ddc8d(_0x50e2be[_0xa6f7('0x17')]['message']);}else{_0x5ddc8d(_0x50e2be['result']);}})[_0xa6f7('0x1e')](function(_0x5efdce){_0x1de6c9(_0x5efdce);});});}function getAgent(_0x35847e){return db[_0xa6f7('0x1f')][_0xa6f7('0x20')]({'where':{'id':_0x35847e,'role':_0xa6f7('0x21')}})[_0xa6f7('0x22')](checkError());}function getAgentCheckSession(_0x4b8d2b,_0x51db47){return new BPromise(function(_0x1c419b,_0x2ad0d9){var _0x55d45a=respondWithRpcPromise(_0xa6f7('0x23'));var _0x27babb=getAgent(_0x4b8d2b);Promise[_0xa6f7('0x24')]([_0x55d45a,_0x27babb])[_0xa6f7('0x22')](function(_0x224f5a){var _0x10bf77=_0x224f5a[0x0];var _0x353de8=_0x224f5a[0x1];var _0x54f72c=_[_0xa6f7('0x25')](_0x10bf77[_0xa6f7('0x26')],function(_0x40b0f8){return _0x40b0f8[_0xa6f7('0x27')]==_0x353de8['id']&&_0x40b0f8['sessionId']==_0x51db47;});if(_0x54f72c[_0xa6f7('0x28')]==0x1){_0x1c419b(_0x353de8);}else{_0x2ad0d9(new RangeError(_0xa6f7('0x29')+_0x51db47+'\x20not\x20found!'));}});});}exports[_0xa6f7('0x2a')]=function(_0x34d571,_0x4d79d8){logger['info'](_0xa6f7('0x2b'),_0x34d571[_0xa6f7('0x2c')]);var _0x2b33d=originateValidation[_0xa6f7('0xe')](_0x34d571[_0xa6f7('0x2c')]);if(_0x2b33d['length']>0x0){return _0x4d79d8['status'](0x190)[_0xa6f7('0x2d')](_0x2b33d);}var _0x4c2acd=_0x34d571[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0xfa0fb6=_0x34d571[_0xa6f7('0x2c')][_0xa6f7('0x2f')];var _0xbdfc5a=_0x34d571['body'][_0xa6f7('0x30')];var _0xb1a7f8=_0x34d571[_0xa6f7('0x2c')]['callbackUrl'];return getAgent(_0x4c2acd)[_0xa6f7('0x22')](function(_0x5ab03d){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x5ab03d[_0xa6f7('0x19')]);emit(util['format'](_0xa6f7('0x32'),_0x5ab03d[_0xa6f7('0x19')]),_0xa6f7('0x33'),{'callNumber':_0xfa0fb6,'callerId':_0xbdfc5a,'callbackUrl':_0xb1a7f8});return _0x4d79d8[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x34')});})['catch'](handleError(_0x4d79d8));};exports[_0xa6f7('0x35')]=function(_0xd930e8,_0xc25a1b){logger[_0xa6f7('0x13')](_0xa6f7('0x36'),_0xd930e8[_0xa6f7('0x2c')]);var _0x45acdd=hangupValidation[_0xa6f7('0xe')](_0xd930e8['body']);if(_0x45acdd[_0xa6f7('0x28')]>0x0){return _0xc25a1b[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x45acdd);}var _0x518088=_0xd930e8[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x589d94=_0xd930e8[_0xa6f7('0x2c')][_0xa6f7('0x37')];return getAgent(_0x518088)[_0xa6f7('0x22')](function(_0x14d532){logger[_0xa6f7('0x13')]('entityFound:',_0x14d532[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x14d532[_0xa6f7('0x19')]),_0xa6f7('0x39'),{'sessionId':_0x589d94});return _0xc25a1b[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x3a')});})['catch'](handleError(_0xc25a1b));};exports['answer']=function(_0x12f7b5,_0x3e1535){logger[_0xa6f7('0x13')](_0xa6f7('0x3b'),_0x12f7b5[_0xa6f7('0x2c')]);var _0x387714=answerValidation[_0xa6f7('0xe')](_0x12f7b5[_0xa6f7('0x2c')]);if(_0x387714[_0xa6f7('0x28')]>0x0){return _0x3e1535[_0xa6f7('0x1a')](0x190)['json'](_0x387714);}var _0x41917c=_0x12f7b5[_0xa6f7('0x2c')]['userId'];var _0x22d500=_0x12f7b5[_0xa6f7('0x2c')][_0xa6f7('0x37')];return getAgent(_0x41917c)[_0xa6f7('0x22')](function(_0x51de13){logger[_0xa6f7('0x13')]('entityFound:',_0x51de13['name']);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x51de13[_0xa6f7('0x19')]),_0xa6f7('0x3c'),{'sessionId':_0x22d500});return _0x3e1535[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x3d')});})['catch'](handleError(_0x3e1535));};exports[_0xa6f7('0x3e')]=function(_0x40dbe6,_0x55cb70){logger[_0xa6f7('0x13')](_0xa6f7('0x3f'),_0x40dbe6[_0xa6f7('0x2c')]);var _0x5cc89c=holdValidation[_0xa6f7('0xe')](_0x40dbe6['body']);if(_0x5cc89c[_0xa6f7('0x28')]>0x0){return _0x55cb70[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x5cc89c);}var _0x5f3c84=_0x40dbe6['body'][_0xa6f7('0x2e')];var _0x5928e4=_0x40dbe6[_0xa6f7('0x2c')]['sessionId'];return getAgent(_0x5f3c84)['then'](function(_0x1e7089){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x1e7089[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x1e7089['name']),_0xa6f7('0x40'),{'sessionId':_0x5928e4});return _0x55cb70[_0xa6f7('0x1a')](0xc8)['json']({'error':![],'message':_0xa6f7('0x41')});})['catch'](handleError(_0x55cb70));};exports[_0xa6f7('0x42')]=function(_0x59091a,_0x488efc){logger[_0xa6f7('0x13')](_0xa6f7('0x43'),_0x59091a[_0xa6f7('0x2c')]);var _0x2b3de2=unholdValidation[_0xa6f7('0xe')](_0x59091a['body']);if(_0x2b3de2[_0xa6f7('0x28')]>0x0){return _0x488efc[_0xa6f7('0x1a')](0x190)['json'](_0x2b3de2);}var _0x4b83f6=_0x59091a['body'][_0xa6f7('0x2e')];var _0x1c2099=_0x59091a[_0xa6f7('0x2c')]['sessionId'];return getAgent(_0x4b83f6)[_0xa6f7('0x22')](function(_0x5dab05){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x5dab05[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x5dab05['name']),'webbar:unhold',{'sessionId':_0x1c2099});return _0x488efc[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x44')});})[_0xa6f7('0x1e')](handleError(_0x488efc));};exports['calls']=function(_0x9d901e,_0x2105dd){logger[_0xa6f7('0x13')](_0xa6f7('0x45'),_0x2105dd[_0xa6f7('0x2c')]);var _0x39538e=callsValidation['validate'](_0x9d901e[_0xa6f7('0x2c')]);if(_0x39538e[_0xa6f7('0x28')]>0x0){return _0x2105dd[_0xa6f7('0x1a')](0x190)['json'](_0x39538e);}var _0xb049d7=_0x9d901e[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x4496f1=respondWithRpcPromise('VoiceChannels');var _0x4ec005=getAgent(_0xb049d7);return Promise[_0xa6f7('0x24')]([_0x4496f1,_0x4ec005])[_0xa6f7('0x22')](function(_0x1103c6){var _0x52e647=_0x1103c6[0x0];var _0x301327=_0x1103c6[0x1];var _0x269249=_[_0xa6f7('0x25')](_0x52e647['rows'],function(_0x169bbe){return _0x169bbe[_0xa6f7('0x27')]==_0x301327['id'];});return _0x2105dd[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'count':_0x269249[_0xa6f7('0x28')],'rows':_0x269249});})[_0xa6f7('0x1e')](handleError(_0x2105dd));};exports[_0xa6f7('0x46')]=function(_0x3bc870,_0x444177){logger[_0xa6f7('0x13')](_0xa6f7('0x47'),_0x3bc870['body']);var _0x224e33=conferenceValidation['validate'](_0x3bc870[_0xa6f7('0x2c')]);if(_0x224e33['length']>0x0){return _0x444177[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x224e33);}var _0x5a158f=_0x3bc870[_0xa6f7('0x2c')][_0xa6f7('0x2e')];return getAgent(_0x5a158f)[_0xa6f7('0x22')](function(_0x501503){logger[_0xa6f7('0x13')]('entityFound:',_0x501503[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')]('user:%s',_0x501503[_0xa6f7('0x19')]),'webbar:conference');return _0x444177[_0xa6f7('0x1a')](0xc8)['json']({'error':![],'message':_0xa6f7('0x48')});})[_0xa6f7('0x1e')](handleError(_0x444177));};exports[_0xa6f7('0x49')]=function(_0xca47c2,_0x315939){logger[_0xa6f7('0x13')](_0xa6f7('0x4a'),_0xca47c2[_0xa6f7('0x2c')]);var _0x153635=transferValidation[_0xa6f7('0xe')](_0xca47c2[_0xa6f7('0x2c')]);if(_0x153635[_0xa6f7('0x28')]>0x0){return _0x315939['status'](0x190)[_0xa6f7('0x2d')](_0x153635);}var _0x3c0c6e=_0xca47c2[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x154c78=_0xca47c2[_0xa6f7('0x2c')][_0xa6f7('0x37')];var _0x3a5700=_0xca47c2['body'][_0xa6f7('0x4b')];return getAgent(_0x3c0c6e)[_0xa6f7('0x22')](function(_0x9c102f){logger['info'](_0xa6f7('0x31'),_0x9c102f[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x9c102f[_0xa6f7('0x19')]),_0xa6f7('0x4c'),{'sessionId':_0x154c78,'transferNumber':_0x3a5700});return _0x315939[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x315939));}; \ No newline at end of file +var _0xf403=['answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','redis','defaults','localhost','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','stringify','emit','log','error','stack','name','status','send','NotFound','request','then','code','result','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','originate','info','originate\x20fired:','validate','body','json','userId','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','catch','hangup'];(function(_0x4cb5a8,_0x3a517a){var _0x447cdd=function(_0x191531){while(--_0x191531){_0x4cb5a8['push'](_0x4cb5a8['shift']());}};_0x447cdd(++_0x3a517a);}(_0xf403,0x1d3));var _0x3f40=function(_0x3592de,_0x3754ec){_0x3592de=_0x3592de-0x0;var _0x1f714f=_0xf403[_0x3592de];return _0x1f714f;};'use strict';var path=require(_0x3f40('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x3f40('0x1'))['db'];var config=require(_0x3f40('0x2'));var util=require(_0x3f40('0x3'));var BPromise=require(_0x3f40('0x4'));var jayson=require(_0x3f40('0x5'));var amiClient=jayson[_0x3f40('0x6')][_0x3f40('0x7')]({'port':0x232a});var logger=require(_0x3f40('0x8'))('webbarapi');var Redis=require('ioredis');config[_0x3f40('0x9')]=_[_0x3f40('0xa')](config[_0x3f40('0x9')],{'host':_0x3f40('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3f40('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3f40('0xc')]},'callNumber':{'type':_0x3f40('0xd'),'required':[!![],_0x3f40('0xe')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]},'sessionId':{'type':_0x3f40('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3f40('0xc')]},'sessionId':{'type':_0x3f40('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x3f40('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x3f40('0xd'),'required':[!![],_0x3f40('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]},'sessionId':{'type':_0x3f40('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x3f40('0xf'),'required':[!![],_0x3f40('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x3f40('0xc')]}});function emit(_0x3d11c9,_0x535f85,_0x4ef80e){logger['info'](_0x3d11c9,_0x535f85,JSON[_0x3f40('0x11')](_0x4ef80e));io['to'](_0x3d11c9)[_0x3f40('0x12')](_0x535f85,_0x4ef80e);}function handleError(_0x59718c){return function(_0x131e55){console[_0x3f40('0x13')]('handleError:',_0x131e55,_0x131e55 instanceof RangeError);logger[_0x3f40('0x14')](_0x131e55[_0x3f40('0x15')]);if(_0x131e55 instanceof RangeError){if(_0x131e55[_0x3f40('0x16')]){delete _0x131e55[_0x3f40('0x16')];}_0x59718c[_0x3f40('0x17')](0x194)['send'](_0x131e55);}else{if(_0x131e55[_0x3f40('0x16')]){delete _0x131e55['name'];}_0x59718c[_0x3f40('0x17')](0x1f4)[_0x3f40('0x18')](_0x131e55);}};}function checkError(){return function(_0x3f4a93){if(!_0x3f4a93){throw new RangeError(_0x3f40('0x19'));}return _0x3f4a93;};}function respondWithRpcPromise(_0x628816,_0x4aa559){return new BPromise(function(_0x27f5a5,_0x379b4e){var _0x117823=amiClient;return _0x117823[_0x3f40('0x1a')](_0x628816,_0x4aa559)[_0x3f40('0x1b')](function(_0xa1f39d){if(_0xa1f39d['error']){if(_0xa1f39d[_0x3f40('0x14')][_0x3f40('0x1c')]===0x1f4){return _0x379b4e(_0xa1f39d[_0x3f40('0x14')]['message']);}return _0x27f5a5(_0xa1f39d[_0x3f40('0x14')]['message']);}else{_0x27f5a5(_0xa1f39d[_0x3f40('0x1d')]);}})['catch'](function(_0x4b206b){_0x379b4e(_0x4b206b);});});}function getAgent(_0x4b0ade){return db[_0x3f40('0x1e')][_0x3f40('0x1f')]({'where':{'id':_0x4b0ade,'role':_0x3f40('0x20')}})[_0x3f40('0x1b')](checkError());}function getAgentCheckSession(_0x5b1079,_0x300665){return new BPromise(function(_0x47ec1c,_0x319997){var _0xbaf5d4=respondWithRpcPromise(_0x3f40('0x21'));var _0x5e0f25=getAgent(_0x5b1079);Promise[_0x3f40('0x22')]([_0xbaf5d4,_0x5e0f25])['then'](function(_0x1cab5c){var _0x5b9079=_0x1cab5c[0x0];var _0x49057b=_0x1cab5c[0x1];var _0xb6ab4d=_[_0x3f40('0x23')](_0x5b9079[_0x3f40('0x24')],function(_0xb23186){return _0xb23186[_0x3f40('0x25')]==_0x49057b['id']&&_0xb23186[_0x3f40('0x26')]==_0x300665;});if(_0xb6ab4d[_0x3f40('0x27')]==0x1){_0x47ec1c(_0x49057b);}else{_0x319997(new RangeError(_0x3f40('0x28')+_0x300665+'\x20not\x20found!'));}});});}exports[_0x3f40('0x29')]=function(_0x2d2624,_0x18dbb3){logger[_0x3f40('0x2a')](_0x3f40('0x2b'),_0x2d2624['body']);var _0x42b6b4=originateValidation[_0x3f40('0x2c')](_0x2d2624[_0x3f40('0x2d')]);if(_0x42b6b4['length']>0x0){return _0x18dbb3[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x42b6b4);}var _0x239fd5=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x323908=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x30')];var _0x10356d=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x31')];var _0x25399a=_0x2d2624[_0x3f40('0x2d')][_0x3f40('0x32')];return getAgent(_0x239fd5)[_0x3f40('0x1b')](function(_0xf26a2f){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0xf26a2f[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')](_0x3f40('0x35'),_0xf26a2f[_0x3f40('0x16')]),_0x3f40('0x36'),{'callNumber':_0x323908,'callerId':_0x10356d,'callbackUrl':_0x25399a});return _0x18dbb3[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x37')});})[_0x3f40('0x38')](handleError(_0x18dbb3));};exports[_0x3f40('0x39')]=function(_0x411c98,_0x2df15b){logger['info']('hangup\x20fired:',_0x411c98[_0x3f40('0x2d')]);var _0x1b005e=hangupValidation[_0x3f40('0x2c')](_0x411c98[_0x3f40('0x2d')]);if(_0x1b005e[_0x3f40('0x27')]>0x0){return _0x2df15b[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x1b005e);}var _0x4de3e7=_0x411c98[_0x3f40('0x2d')]['userId'];var _0x229bff=_0x411c98[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x4de3e7)['then'](function(_0x37a83d){logger[_0x3f40('0x2a')]('entityFound:',_0x37a83d[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')]('user:%s',_0x37a83d[_0x3f40('0x16')]),'webbar:hangup',{'sessionId':_0x229bff});return _0x2df15b[_0x3f40('0x17')](0xc8)['json']({'error':![],'message':'hangup\x20executed!'});})[_0x3f40('0x38')](handleError(_0x2df15b));};exports['answer']=function(_0x2210bc,_0xe04271){logger[_0x3f40('0x2a')](_0x3f40('0x3a'),_0x2210bc['body']);var _0x237c91=answerValidation['validate'](_0x2210bc[_0x3f40('0x2d')]);if(_0x237c91[_0x3f40('0x27')]>0x0){return _0xe04271[_0x3f40('0x17')](0x190)['json'](_0x237c91);}var _0x4a198d=_0x2210bc[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x41bd93=_0x2210bc[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x4a198d)[_0x3f40('0x1b')](function(_0x38c5d6){logger[_0x3f40('0x2a')]('entityFound:',_0x38c5d6[_0x3f40('0x16')]);emit(util['format']('user:%s',_0x38c5d6[_0x3f40('0x16')]),_0x3f40('0x3b'),{'sessionId':_0x41bd93});return _0xe04271[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x3c')});})[_0x3f40('0x38')](handleError(_0xe04271));};exports[_0x3f40('0x3d')]=function(_0x3d6cf8,_0x1cc958){logger[_0x3f40('0x2a')](_0x3f40('0x3e'),_0x3d6cf8[_0x3f40('0x2d')]);var _0x2068ab=holdValidation[_0x3f40('0x2c')](_0x3d6cf8['body']);if(_0x2068ab[_0x3f40('0x27')]>0x0){return _0x1cc958['status'](0x190)[_0x3f40('0x2e')](_0x2068ab);}var _0x2f16d6=_0x3d6cf8['body'][_0x3f40('0x2f')];var _0x1f66fa=_0x3d6cf8[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x2f16d6)[_0x3f40('0x1b')](function(_0x268ae4){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0x268ae4[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')](_0x3f40('0x35'),_0x268ae4[_0x3f40('0x16')]),_0x3f40('0x3f'),{'sessionId':_0x1f66fa});return _0x1cc958[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x40')});})[_0x3f40('0x38')](handleError(_0x1cc958));};exports[_0x3f40('0x41')]=function(_0x32bd05,_0x2d7e66){logger[_0x3f40('0x2a')]('unhold\x20fired:',_0x32bd05[_0x3f40('0x2d')]);var _0x50db96=unholdValidation[_0x3f40('0x2c')](_0x32bd05[_0x3f40('0x2d')]);if(_0x50db96[_0x3f40('0x27')]>0x0){return _0x2d7e66['status'](0x190)['json'](_0x50db96);}var _0x54b7cd=_0x32bd05[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x5f4f1a=_0x32bd05[_0x3f40('0x2d')][_0x3f40('0x26')];return getAgent(_0x54b7cd)['then'](function(_0x1cd70d){logger['info'](_0x3f40('0x33'),_0x1cd70d[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')](_0x3f40('0x35'),_0x1cd70d[_0x3f40('0x16')]),_0x3f40('0x42'),{'sessionId':_0x5f4f1a});return _0x2d7e66[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x43')});})[_0x3f40('0x38')](handleError(_0x2d7e66));};exports[_0x3f40('0x44')]=function(_0x13f191,_0x109752){logger['info'](_0x3f40('0x45'),_0x109752[_0x3f40('0x2d')]);var _0x1c94a1=callsValidation[_0x3f40('0x2c')](_0x13f191[_0x3f40('0x2d')]);if(_0x1c94a1['length']>0x0){return _0x109752[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x1c94a1);}var _0x1c4b44=_0x13f191[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x5c030a=respondWithRpcPromise('VoiceChannels');var _0x6c81fe=getAgent(_0x1c4b44);return Promise[_0x3f40('0x22')]([_0x5c030a,_0x6c81fe])['then'](function(_0x701ed0){var _0x5a3456=_0x701ed0[0x0];var _0x204cff=_0x701ed0[0x1];var _0x557c0c=_[_0x3f40('0x23')](_0x5a3456['rows'],function(_0xab34b){return _0xab34b[_0x3f40('0x25')]==_0x204cff['id'];});return _0x109752[_0x3f40('0x17')](0xc8)['json']({'count':_0x557c0c['length'],'rows':_0x557c0c});})['catch'](handleError(_0x109752));};exports['conference']=function(_0x273739,_0x4e1c35){logger['info'](_0x3f40('0x46'),_0x273739[_0x3f40('0x2d')]);var _0x37f636=conferenceValidation[_0x3f40('0x2c')](_0x273739['body']);if(_0x37f636[_0x3f40('0x27')]>0x0){return _0x4e1c35['status'](0x190)['json'](_0x37f636);}var _0x48b0ed=_0x273739[_0x3f40('0x2d')]['userId'];return getAgent(_0x48b0ed)['then'](function(_0x45d7e5){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0x45d7e5[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')]('user:%s',_0x45d7e5[_0x3f40('0x16')]),'webbar:conference');return _0x4e1c35[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x47')});})['catch'](handleError(_0x4e1c35));};exports[_0x3f40('0x48')]=function(_0x2408f4,_0x46821c){logger[_0x3f40('0x2a')](_0x3f40('0x49'),_0x2408f4['body']);var _0x2f76a1=transferValidation[_0x3f40('0x2c')](_0x2408f4[_0x3f40('0x2d')]);if(_0x2f76a1[_0x3f40('0x27')]>0x0){return _0x46821c[_0x3f40('0x17')](0x190)[_0x3f40('0x2e')](_0x2f76a1);}var _0x29fdfc=_0x2408f4[_0x3f40('0x2d')][_0x3f40('0x2f')];var _0x37add1=_0x2408f4[_0x3f40('0x2d')][_0x3f40('0x26')];var _0x52c075=_0x2408f4['body']['transferNumber'];return getAgent(_0x29fdfc)[_0x3f40('0x1b')](function(_0x137cd8){logger[_0x3f40('0x2a')](_0x3f40('0x33'),_0x137cd8[_0x3f40('0x16')]);emit(util[_0x3f40('0x34')]('user:%s',_0x137cd8[_0x3f40('0x16')]),'webbar:transfer',{'sessionId':_0x37add1,'transferNumber':_0x52c075});return _0x46821c[_0x3f40('0x17')](0xc8)[_0x3f40('0x2e')]({'error':![],'message':_0x3f40('0x4a')});})[_0x3f40('0x38')](handleError(_0x46821c));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 95f358b..3dea08d 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 _0xd4a2=['../../components/auth/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/canned_answers','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents','multer','connect-timeout','Router'];(function(_0x42f3b0,_0x9d900a){var _0x44e5a4=function(_0x3ad916){while(--_0x3ad916){_0x42f3b0['push'](_0x42f3b0['shift']());}};_0x44e5a4(++_0x9d900a);}(_0xd4a2,0x173));var _0x2d4a=function(_0x3e0350,_0x704ad0){_0x3e0350=_0x3e0350-0x0;var _0x496d51=_0xd4a2[_0x3e0350];return _0x496d51;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['get'](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x11')]);router[_0x2d4a('0x6')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x13')]);router[_0x2d4a('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d4a('0x14')]('/:id/dispositions',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x14')](_0x2d4a('0x16'),auth['isAuthenticated'](),controller[_0x2d4a('0x17')]);router['post'](_0x2d4a('0x10'),auth['isAuthenticated'](),controller[_0x2d4a('0x18')]);router[_0x2d4a('0x14')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller['addApplications']);router['post']('/:id/notify',controller[_0x2d4a('0x19')]);router[_0x2d4a('0x14')](_0x2d4a('0x1a'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1b')]);router[_0x2d4a('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x2d4a('0x1d')]);router[_0x2d4a('0x1e')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1f')]);router[_0x2d4a('0x1e')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller['removeDispositions']);router[_0x2d4a('0x1e')](_0x2d4a('0x16'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x20')]);router[_0x2d4a('0x1e')](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x21')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['notify','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addAnswer','addAgents'];(function(_0x3f6c29,_0x370d86){var _0x4af959=function(_0x263612){while(--_0x263612){_0x3f6c29['push'](_0x3f6c29['shift']());}};_0x4af959(++_0x370d86);}(_0xadb5,0xad));var _0x5adb=function(_0x27fc55,_0x122998){_0x27fc55=_0x27fc55-0x0;var _0x4e0ea5=_0xadb5[_0x27fc55];return _0x4e0ea5;};'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('./whatsappAccount.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('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getDispositions']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['get'](_0x5adb('0x11'),auth['isAuthenticated'](),controller[_0x5adb('0x12')]);router['get'](_0x5adb('0x13'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);router['post']('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x15')]);router[_0x5adb('0x16')]('/:id/dispositions',auth[_0x5adb('0x8')](),controller['addDisposition']);router[_0x5adb('0x16')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x16')](_0x5adb('0x11'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x18')]);router[_0x5adb('0x16')]('/:id/applications',auth[_0x5adb('0x8')](),controller['addApplications']);router[_0x5adb('0x16')]('/:id/notify',controller[_0x5adb('0x19')]);router['post']('/:id/send',auth[_0x5adb('0x8')](),controller[_0x5adb('0x1a')]);router[_0x5adb('0x1b')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller['update']);router[_0x5adb('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x5adb('0x1d')]);router[_0x5adb('0x1c')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x1e')]);router[_0x5adb('0x1c')](_0x5adb('0xf'),auth['isAuthenticated'](),controller[_0x5adb('0x1f')]);router[_0x5adb('0x1c')](_0x5adb('0x11'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index f13d78e..a16b6b9 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 _0x7f11=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','twilio','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x3cf009,_0xb0da7a){var _0x15d7cd=function(_0xa37c14){while(--_0xa37c14){_0x3cf009['push'](_0x3cf009['shift']());}};_0x15d7cd(++_0xb0da7a);}(_0x7f11,0x1bf));var _0x17f1=function(_0x3275bc,_0x25b968){_0x3275bc=_0x3275bc-0x0;var _0x35744e=_0x7f11[_0x3275bc];return _0x35744e;};'use strict';var Sequelize=require(_0x17f1('0x0'));var rs=require('randomstring');module[_0x17f1('0x1')]={'name':{'type':Sequelize[_0x17f1('0x2')],'unique':_0x17f1('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x17f1('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x17f1('0x2')]},'type':{'type':Sequelize[_0x17f1('0x4')](_0x17f1('0x5'))},'accountSid':{'type':Sequelize[_0x17f1('0x2')]},'authToken':{'type':Sequelize[_0x17f1('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x17f1('0x6')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x17f1('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x17f1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x17f1('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x17f1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x17f1('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x17f1('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x17f1('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x17f1('0x6')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x7ccd06){if(!_0x7ccd06){this[_0x17f1('0x9')](_0x17f1('0xa'),null);}this[_0x17f1('0x9')](_0x17f1('0xb'),_0x7ccd06);}},'description':{'type':Sequelize[_0x17f1('0x2')]}}; \ No newline at end of file +var _0xcf31=['sequelize','randomstring','exports','STRING','name','generate','ENUM','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x2d558a,_0x3b3a95){var _0x57859=function(_0x44bd99){while(--_0x44bd99){_0x2d558a['push'](_0x2d558a['shift']());}};_0x57859(++_0x3b3a95);}(_0xcf31,0x13b));var _0x1cf3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcf31[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x1cf3('0x0'));var rs=require(_0x1cf3('0x1'));module[_0x1cf3('0x2')]={'name':{'type':Sequelize[_0x1cf3('0x3')],'unique':_0x1cf3('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x1cf3('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x1cf3('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x1cf3('0x3')],'defaultValue':function(){return rs[_0x1cf3('0x5')]();}},'phone':{'type':Sequelize[_0x1cf3('0x3')]},'type':{'type':Sequelize[_0x1cf3('0x6')]('twilio')},'accountSid':{'type':Sequelize[_0x1cf3('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x1cf3('0x7')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1cf3('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1cf3('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1cf3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1cf3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1cf3('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1cf3('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1cf3('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x1cf3('0x8')],'defaultValue':![],'comment':_0x1cf3('0xb'),'set':function(_0x18e37a){if(!_0x18e37a){this[_0x1cf3('0xc')](_0x1cf3('0xd'),null);}this[_0x1cf3('0xc')](_0x1cf3('0xe'),_0x18e37a);}},'description':{'type':Sequelize[_0x1cf3('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 7cdef6a..4c9fea2 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 _0x9e4a=['Pause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','WhatsappAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','Disposition','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','nolimit','removeAnswers','addAgents','spread','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','User','getAgents','transaction','WhatsappApplication','findAndCountAll','getApplications','notify','whatsapp','account','orderBy','Applications','priority','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','replace','whatsapp:','Body','messageId','MessageSid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','omit','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','ContactId','UserId','applications','unshift','agent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','send','\x0a','to\x20is\x20mandatory','List','DESC','WhatsappMessage','Messages','dataValues','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','update','destroy','get','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','sort','pick','filters','where','VIRTUAL','filter','merge','includeAll','include','rows','show'];(function(_0x3965b2,_0x4c950b){var _0x1bea9e=function(_0x4ec9d8){while(--_0x4ec9d8){_0x3965b2['push'](_0x3965b2['shift']());}};_0x1bea9e(++_0x4c950b);}(_0x9e4a,0x124));var _0xa9e4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9e4a[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0xa9e4('0x0'));var rimraf=require(_0xa9e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9e4('0x2'));var rp=require(_0xa9e4('0x3'));var moment=require(_0xa9e4('0x4'));var BPromise=require(_0xa9e4('0x5'));var Mustache=require(_0xa9e4('0x6'));var util=require('util');var path=require(_0xa9e4('0x7'));var sox=require(_0xa9e4('0x8'));var csv=require(_0xa9e4('0x9'));var ejs=require(_0xa9e4('0xa'));var fs=require('fs');var fs_extra=require(_0xa9e4('0xb'));var _=require(_0xa9e4('0xc'));var squel=require(_0xa9e4('0xd'));var crypto=require(_0xa9e4('0xe'));var jsforce=require(_0xa9e4('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa9e4('0x10'));var Papa=require(_0xa9e4('0x11'));var Redis=require(_0xa9e4('0x12'));var authService=require(_0xa9e4('0x13'));var qs=require(_0xa9e4('0x14'));var as=require(_0xa9e4('0x15'));var hardwareService=require(_0xa9e4('0x16'));var logger=require('../../config/logger')(_0xa9e4('0x17'));var utils=require(_0xa9e4('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa9e4('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa9e4('0x1a')](config['redis'],{'host':_0xa9e4('0x1b'),'port':0x18eb});var socket=require(_0xa9e4('0x1c'))(new Redis(config[_0xa9e4('0x1d')]));require(_0xa9e4('0x1e'))[_0xa9e4('0x1f')](socket);var jayson=require(_0xa9e4('0x20'));var client=jayson[_0xa9e4('0x21')][_0xa9e4('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x356ce1,_0x31d8b1,_0x3918fa,_0x156561){return new BPromise(function(_0x4598b4,_0x27c34d){var _0x52231c=_0x156561||client;return _0x52231c[_0xa9e4('0x23')](_0x356ce1,_0x3918fa)[_0xa9e4('0x24')](function(_0xb97bc1){logger[_0xa9e4('0x25')](_0xa9e4('0x26'),_0x31d8b1,'request\x20sent');logger[_0xa9e4('0x27')](_0xa9e4('0x28'),_0x31d8b1,_0xa9e4('0x29'),JSON[_0xa9e4('0x2a')](_0xb97bc1));if(_0xb97bc1[_0xa9e4('0x2b')]){if(_0xb97bc1[_0xa9e4('0x2b')][_0xa9e4('0x2c')]===0x1f4){logger[_0xa9e4('0x2b')](_0xa9e4('0x26'),_0x31d8b1,_0xb97bc1[_0xa9e4('0x2b')][_0xa9e4('0x2d')]);return _0x27c34d(_0xb97bc1[_0xa9e4('0x2b')][_0xa9e4('0x2d')]);}logger[_0xa9e4('0x2b')](_0xa9e4('0x26'),_0x31d8b1,_0xb97bc1['error'][_0xa9e4('0x2d')]);return _0x4598b4(_0xb97bc1[_0xa9e4('0x2b')][_0xa9e4('0x2d')]);}else{logger[_0xa9e4('0x25')](_0xa9e4('0x26'),_0x31d8b1,_0xa9e4('0x29'));_0x4598b4(_0xb97bc1['result'][_0xa9e4('0x2d')]);}})[_0xa9e4('0x2e')](function(_0x2f50e6){logger[_0xa9e4('0x2b')](_0xa9e4('0x26'),_0x31d8b1,_0x2f50e6);_0x27c34d(_0x2f50e6);});});}function respondWithStatusCode(_0x30216b,_0x84bd94){_0x84bd94=_0x84bd94||0xcc;return function(_0x5dc3ca){if(_0x5dc3ca){return _0x30216b[_0xa9e4('0x2f')](_0x84bd94);}return _0x30216b[_0xa9e4('0x30')](_0x84bd94)[_0xa9e4('0x31')]();};}function respondWithResult(_0x11ba88,_0x10b8b2){_0x10b8b2=_0x10b8b2||0xc8;return function(_0x31f5c8){if(_0x31f5c8){return _0x11ba88['status'](_0x10b8b2)[_0xa9e4('0x32')](_0x31f5c8);}};}function respondWithFilteredResult(_0x2dd413,_0x303525){return function(_0x2dce70){if(_0x2dce70){var _0x43e476=typeof _0x303525['offset']==='undefined'&&typeof _0x303525[_0xa9e4('0x33')]===_0xa9e4('0x34');var _0x4ec502=_0x2dce70[_0xa9e4('0x35')];var _0x1de523=_0x43e476?0x0:_0x303525[_0xa9e4('0x36')];var _0x178e76=_0x43e476?_0x2dce70[_0xa9e4('0x35')]:_0x303525[_0xa9e4('0x36')]+_0x303525[_0xa9e4('0x33')];var _0xe58c01;if(_0x178e76>=_0x4ec502){_0x178e76=_0x4ec502;_0xe58c01=0xc8;}else{_0xe58c01=0xce;}_0x2dd413[_0xa9e4('0x30')](_0xe58c01);return _0x2dd413[_0xa9e4('0x37')]('Content-Range',_0x1de523+'-'+_0x178e76+'/'+_0x4ec502)[_0xa9e4('0x32')](_0x2dce70);}return null;};}function patchUpdates(_0x131af5){return function(_0x2433a7){try{jsonpatch[_0xa9e4('0x38')](_0x2433a7,_0x131af5,!![]);}catch(_0x34de99){return BPromise['reject'](_0x34de99);}return _0x2433a7['save']();};}function saveUpdates(_0x20f9c1,_0x14fe38){return function(_0x56b2dc){if(_0x56b2dc){return _0x56b2dc[_0xa9e4('0x39')](_0x20f9c1)[_0xa9e4('0x24')](function(_0xdc24d7){return _0xdc24d7;});}return null;};}function removeEntity(_0xbf1b01,_0x37922b){return function(_0x465d74){if(_0x465d74){return _0x465d74[_0xa9e4('0x3a')]()[_0xa9e4('0x24')](function(){var _0x474b66=_0x465d74[_0xa9e4('0x3b')]({'plain':!![]});var _0x107487='WhatsappAccounts';return db[_0xa9e4('0x3c')][_0xa9e4('0x3a')]({'where':{'type':_0x107487,'resourceId':_0x474b66['id']}})['then'](function(){return _0x465d74;});})[_0xa9e4('0x24')](function(){_0xbf1b01[_0xa9e4('0x30')](0xcc)[_0xa9e4('0x31')]();});}};}function handleEntityNotFound(_0x385a8b,_0x2c36ed){return function(_0x11f29b){if(!_0x11f29b){_0x385a8b[_0xa9e4('0x2f')](0x194);}return _0x11f29b;};}function handleError(_0x444cf2,_0x498d16){_0x498d16=_0x498d16||0x1f4;return function(_0x26b7d2){logger['error'](_0x26b7d2[_0xa9e4('0x3d')]);if(_0x26b7d2[_0xa9e4('0x3e')]){delete _0x26b7d2[_0xa9e4('0x3e')];}_0x444cf2[_0xa9e4('0x30')](_0x498d16)['send'](_0x26b7d2);};}exports[_0xa9e4('0x3f')]=function(_0x564622,_0x5b3e2f){var _0x2cc129={'include':[{'model':db['Pause'],'as':_0xa9e4('0x40')}]},_0xe5561f={},_0x307073={'count':0x0,'rows':[]};var _0xc6939f=_[_0xa9e4('0x41')](db[_0xa9e4('0x42')][_0xa9e4('0x43')],function(_0x2c3e5a){return{'name':_0x2c3e5a[_0xa9e4('0x44')],'type':_0x2c3e5a[_0xa9e4('0x45')]['key']};});_0xe5561f[_0xa9e4('0x46')]=_[_0xa9e4('0x41')](_0xc6939f,'name');_0xe5561f[_0xa9e4('0x47')]=_[_0xa9e4('0x48')](_0x564622['query']);_0xe5561f['filters']=_[_0xa9e4('0x49')](_0xe5561f[_0xa9e4('0x46')],_0xe5561f[_0xa9e4('0x47')]);_0x2cc129[_0xa9e4('0x4a')]=_['intersection'](_0xe5561f['model'],qs[_0xa9e4('0x4b')](_0x564622[_0xa9e4('0x47')]['fields']));_0x2cc129['attributes']=_0x2cc129[_0xa9e4('0x4a')][_0xa9e4('0x4c')]?_0x2cc129[_0xa9e4('0x4a')]:_0xe5561f[_0xa9e4('0x46')];if(!_0x564622[_0xa9e4('0x47')]['hasOwnProperty']('nolimit')){_0x2cc129[_0xa9e4('0x33')]=qs['limit'](_0x564622['query'][_0xa9e4('0x33')]);_0x2cc129[_0xa9e4('0x36')]=qs[_0xa9e4('0x36')](_0x564622['query'][_0xa9e4('0x36')]);}_0x2cc129['order']=qs[_0xa9e4('0x4d')](_0x564622[_0xa9e4('0x47')][_0xa9e4('0x4d')]);_0x2cc129['where']=qs['filters'](_[_0xa9e4('0x4e')](_0x564622['query'],_0xe5561f[_0xa9e4('0x4f')]),_0xc6939f);if(_0x564622[_0xa9e4('0x47')]['filter']){_0x2cc129[_0xa9e4('0x50')]=_['merge'](_0x2cc129[_0xa9e4('0x50')],{'$or':_[_0xa9e4('0x41')](_0xc6939f,function(_0x103799){if(_0x103799[_0xa9e4('0x45')]!==_0xa9e4('0x51')){var _0x4066ab={};_0x4066ab[_0x103799[_0xa9e4('0x3e')]]={'$like':'%'+_0x564622[_0xa9e4('0x47')][_0xa9e4('0x52')]+'%'};return _0x4066ab;}})});}_0x2cc129=_[_0xa9e4('0x53')]({},_0x2cc129,_0x564622['options']);var _0x36a269={'where':_0x2cc129[_0xa9e4('0x50')]};return db['WhatsappAccount'][_0xa9e4('0x35')](_0x36a269)[_0xa9e4('0x24')](function(_0x104774){_0x307073[_0xa9e4('0x35')]=_0x104774;if(_0x564622[_0xa9e4('0x47')][_0xa9e4('0x54')]){_0x2cc129[_0xa9e4('0x55')]=[{'all':!![]}];}return db[_0xa9e4('0x42')]['findAll'](_0x2cc129);})['then'](function(_0xb79f6e){_0x307073[_0xa9e4('0x56')]=_0xb79f6e;return _0x307073;})[_0xa9e4('0x24')](respondWithFilteredResult(_0x5b3e2f,_0x2cc129))[_0xa9e4('0x2e')](handleError(_0x5b3e2f,null));};exports[_0xa9e4('0x57')]=function(_0x324657,_0x4d4629){var _0x4aa042={'raw':![],'where':{'id':_0x324657['params']['id']},'include':[{'model':db[_0xa9e4('0x58')],'as':'mandatoryDispositionPause'}]},_0x3d385c={};_0x3d385c[_0xa9e4('0x46')]=_[_0xa9e4('0x48')](db[_0xa9e4('0x42')]['rawAttributes']);_0x3d385c[_0xa9e4('0x47')]=_['keys'](_0x324657[_0xa9e4('0x47')]);_0x3d385c[_0xa9e4('0x4f')]=_[_0xa9e4('0x49')](_0x3d385c[_0xa9e4('0x46')],_0x3d385c['query']);_0x4aa042[_0xa9e4('0x4a')]=_[_0xa9e4('0x49')](_0x3d385c[_0xa9e4('0x46')],qs[_0xa9e4('0x4b')](_0x324657[_0xa9e4('0x47')][_0xa9e4('0x4b')]));_0x4aa042[_0xa9e4('0x4a')]=_0x4aa042[_0xa9e4('0x4a')][_0xa9e4('0x4c')]?_0x4aa042[_0xa9e4('0x4a')]:_0x3d385c[_0xa9e4('0x46')];if(_0x324657[_0xa9e4('0x47')][_0xa9e4('0x54')]){_0x4aa042['include']=[{'all':!![]}];}_0x4aa042=_['merge']({},_0x4aa042,_0x324657[_0xa9e4('0x59')]);return db[_0xa9e4('0x42')][_0xa9e4('0x5a')](_0x4aa042)[_0xa9e4('0x24')](handleEntityNotFound(_0x4d4629,null))[_0xa9e4('0x24')](respondWithResult(_0x4d4629,null))[_0xa9e4('0x2e')](handleError(_0x4d4629,null));};exports[_0xa9e4('0x5b')]=function(_0x3098af,_0x1dda37){return db[_0xa9e4('0x42')][_0xa9e4('0x5b')](_0x3098af[_0xa9e4('0x5c')],{})[_0xa9e4('0x24')](function(_0x42eee1){var _0x5f21ff=_0x3098af[_0xa9e4('0x5d')][_0xa9e4('0x3b')]({'plain':!![]});if(!_0x5f21ff)throw new Error(_0xa9e4('0x5e'));if(_0x5f21ff[_0xa9e4('0x5f')]===_0xa9e4('0x5d')){var _0x293794=_0x42eee1['get']({'plain':!![]});var _0x37d92a=_0xa9e4('0x60');return db[_0xa9e4('0x61')][_0xa9e4('0x5a')]({'where':{'name':_0x37d92a,'userProfileId':_0x5f21ff['userProfileId']},'raw':!![]})[_0xa9e4('0x24')](function(_0x58d539){if(_0x58d539&&_0x58d539[_0xa9e4('0x62')]===0x0){return db[_0xa9e4('0x3c')][_0xa9e4('0x5b')]({'name':_0x293794[_0xa9e4('0x3e')],'resourceId':_0x293794['id'],'type':_0x58d539['name'],'sectionId':_0x58d539['id']},{})[_0xa9e4('0x24')](function(){return _0x42eee1;});}else{return _0x42eee1;}})[_0xa9e4('0x2e')](function(_0x276232){logger['error'](_0xa9e4('0x63'),_0x276232);throw _0x276232;});}return _0x42eee1;})[_0xa9e4('0x24')](respondWithResult(_0x1dda37,0xc9))[_0xa9e4('0x2e')](handleError(_0x1dda37,null));};exports[_0xa9e4('0x39')]=function(_0x143891,_0x1b7fb7){if(_0x143891[_0xa9e4('0x5c')]['id']){delete _0x143891[_0xa9e4('0x5c')]['id'];}return db[_0xa9e4('0x42')][_0xa9e4('0x5a')]({'where':{'id':_0x143891[_0xa9e4('0x64')]['id']},'include':[{'model':db[_0xa9e4('0x58')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1b7fb7,null))[_0xa9e4('0x24')](saveUpdates(_0x143891['body'],null))['then'](respondWithResult(_0x1b7fb7,null))[_0xa9e4('0x2e')](handleError(_0x1b7fb7,null));};exports['destroy']=function(_0x5e0970,_0x29ae4c){return db[_0xa9e4('0x42')][_0xa9e4('0x5a')]({'where':{'id':_0x5e0970[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x29ae4c,null))[_0xa9e4('0x24')](removeEntity(_0x29ae4c,null))['catch'](handleError(_0x29ae4c,null));};exports[_0xa9e4('0x65')]=function(_0x48ee74,_0xe574c){return db[_0xa9e4('0x42')]['describe']()[_0xa9e4('0x24')](respondWithResult(_0xe574c,null))[_0xa9e4('0x2e')](handleError(_0xe574c,null));};exports[_0xa9e4('0x66')]=function(_0x23f54d,_0x529164,_0xa4bcef){if(_0x23f54d[_0xa9e4('0x5c')]['id']){delete _0x23f54d[_0xa9e4('0x5c')]['id'];}return db[_0xa9e4('0x42')][_0xa9e4('0x5a')]({'where':{'id':_0x23f54d[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x529164,null))[_0xa9e4('0x24')](function(_0x183cac){if(_0x183cac){_0x23f54d['body'][_0xa9e4('0x67')]=_0x183cac['id'];return db['Disposition']['create'](_0x23f54d[_0xa9e4('0x5c')]);}})[_0xa9e4('0x24')](respondWithResult(_0x529164,null))[_0xa9e4('0x2e')](handleError(_0x529164,null));};exports[_0xa9e4('0x68')]=function(_0x274fee,_0x25a8dd,_0x25d6c9){var _0x54dd4c={'raw':![],'where':{}};var _0x469669={};var _0x15a764={'count':0x0,'rows':[]};return db[_0xa9e4('0x42')][_0xa9e4('0x69')]({'where':{'id':_0x274fee[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x25a8dd,null))['then'](function(_0x5af0d2){if(_0x5af0d2){_0x469669[_0xa9e4('0x46')]=_[_0xa9e4('0x48')](db[_0xa9e4('0x6a')][_0xa9e4('0x43')]);_0x469669['query']=_[_0xa9e4('0x48')](_0x274fee[_0xa9e4('0x47')]);_0x469669['filters']=_[_0xa9e4('0x49')](_0x469669['model'],_0x469669['query']);_0x54dd4c[_0xa9e4('0x4a')]=_[_0xa9e4('0x49')](_0x469669['model'],qs['fields'](_0x274fee[_0xa9e4('0x47')]['fields']));_0x54dd4c[_0xa9e4('0x4a')]=_0x54dd4c[_0xa9e4('0x4a')][_0xa9e4('0x4c')]?_0x54dd4c[_0xa9e4('0x4a')]:_0x469669[_0xa9e4('0x46')];if(!_0x274fee[_0xa9e4('0x47')]['hasOwnProperty']('nolimit')){_0x54dd4c[_0xa9e4('0x33')]=qs[_0xa9e4('0x33')](_0x274fee['query']['limit']);_0x54dd4c[_0xa9e4('0x36')]=qs[_0xa9e4('0x36')](_0x274fee[_0xa9e4('0x47')][_0xa9e4('0x36')]);}_0x54dd4c[_0xa9e4('0x6b')]=qs[_0xa9e4('0x4d')](_0x274fee[_0xa9e4('0x47')][_0xa9e4('0x4d')]);_0x54dd4c['where']=qs[_0xa9e4('0x4f')](_[_0xa9e4('0x4e')](_0x274fee['query'],_0x469669[_0xa9e4('0x4f')]));_0x54dd4c[_0xa9e4('0x50')][_0xa9e4('0x67')]=_0x5af0d2['id'];if(_0x274fee['query'][_0xa9e4('0x52')]){_0x54dd4c[_0xa9e4('0x50')]=_[_0xa9e4('0x53')](_0x54dd4c['where'],{'$or':_[_0xa9e4('0x41')](_0x54dd4c['attributes'],function(_0x24fa2b){var _0x53b3dc={};_0x53b3dc[_0x24fa2b]={'$like':'%'+_0x274fee[_0xa9e4('0x47')]['filter']+'%'};return _0x53b3dc;})});}_0x54dd4c=_['merge']({},_0x54dd4c,_0x274fee['options']);return db['Disposition'][_0xa9e4('0x35')]({'where':_0x54dd4c[_0xa9e4('0x50')]})[_0xa9e4('0x24')](function(_0x1bec52){_0x15a764[_0xa9e4('0x35')]=_0x1bec52;if(_0x274fee[_0xa9e4('0x47')][_0xa9e4('0x54')]){_0x54dd4c[_0xa9e4('0x55')]=[{'all':!![]}];}return db[_0xa9e4('0x6a')]['findAll'](_0x54dd4c);})['then'](function(_0x38ec12){_0x15a764[_0xa9e4('0x56')]=_0x38ec12;return _0x15a764;});}})['then'](respondWithFilteredResult(_0x25a8dd,_0x54dd4c))['catch'](handleError(_0x25a8dd,null));};exports[_0xa9e4('0x6c')]=function(_0x353fca,_0x114403,_0x52673a){return db[_0xa9e4('0x42')][_0xa9e4('0x5a')]({'where':{'id':_0x353fca[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x114403,null))[_0xa9e4('0x24')](function(_0x8d5e28){if(_0x8d5e28){return _0x8d5e28[_0xa9e4('0x6c')](_0x353fca[_0xa9e4('0x47')][_0xa9e4('0x6d')]);}})[_0xa9e4('0x24')](respondWithStatusCode(_0x114403,null))[_0xa9e4('0x2e')](handleError(_0x114403,null));};exports[_0xa9e4('0x6e')]=function(_0xf072b4,_0x174c32,_0x528a89){if(_0xf072b4[_0xa9e4('0x5c')]['id']){delete _0xf072b4['body']['id'];}return db[_0xa9e4('0x42')][_0xa9e4('0x5a')]({'where':{'id':_0xf072b4[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x174c32,null))[_0xa9e4('0x24')](function(_0x14847c){if(_0x14847c){_0xf072b4[_0xa9e4('0x5c')]['WhatsappAccountId']=_0x14847c['id'];return db[_0xa9e4('0x6f')][_0xa9e4('0x5b')](_0xf072b4['body']);}})['then'](respondWithResult(_0x174c32,null))[_0xa9e4('0x2e')](handleError(_0x174c32,null));};exports[_0xa9e4('0x70')]=function(_0x369d16,_0x45b9df,_0x319181){var _0x2da089={'raw':![],'where':{}};var _0x39ed79={};var _0x33962e={'count':0x0,'rows':[]};return db[_0xa9e4('0x42')][_0xa9e4('0x69')]({'where':{'id':_0x369d16[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x45b9df,null))[_0xa9e4('0x24')](function(_0x51db13){if(_0x51db13){_0x39ed79[_0xa9e4('0x46')]=_[_0xa9e4('0x48')](db[_0xa9e4('0x6f')][_0xa9e4('0x43')]);_0x39ed79[_0xa9e4('0x47')]=_[_0xa9e4('0x48')](_0x369d16[_0xa9e4('0x47')]);_0x39ed79[_0xa9e4('0x4f')]=_[_0xa9e4('0x49')](_0x39ed79['model'],_0x39ed79['query']);_0x2da089[_0xa9e4('0x4a')]=_[_0xa9e4('0x49')](_0x39ed79[_0xa9e4('0x46')],qs[_0xa9e4('0x4b')](_0x369d16[_0xa9e4('0x47')]['fields']));_0x2da089['attributes']=_0x2da089[_0xa9e4('0x4a')][_0xa9e4('0x4c')]?_0x2da089[_0xa9e4('0x4a')]:_0x39ed79[_0xa9e4('0x46')];if(!_0x369d16['query'][_0xa9e4('0x71')](_0xa9e4('0x72'))){_0x2da089[_0xa9e4('0x33')]=qs['limit'](_0x369d16[_0xa9e4('0x47')][_0xa9e4('0x33')]);_0x2da089[_0xa9e4('0x36')]=qs[_0xa9e4('0x36')](_0x369d16[_0xa9e4('0x47')][_0xa9e4('0x36')]);}_0x2da089[_0xa9e4('0x6b')]=qs[_0xa9e4('0x4d')](_0x369d16['query'][_0xa9e4('0x4d')]);_0x2da089[_0xa9e4('0x50')]=qs[_0xa9e4('0x4f')](_[_0xa9e4('0x4e')](_0x369d16[_0xa9e4('0x47')],_0x39ed79[_0xa9e4('0x4f')]));_0x2da089[_0xa9e4('0x50')][_0xa9e4('0x67')]=_0x51db13['id'];if(_0x369d16[_0xa9e4('0x47')][_0xa9e4('0x52')]){_0x2da089[_0xa9e4('0x50')]=_['merge'](_0x2da089[_0xa9e4('0x50')],{'$or':_['map'](_0x2da089[_0xa9e4('0x4a')],function(_0x283254){var _0x54f313={};_0x54f313[_0x283254]={'$like':'%'+_0x369d16[_0xa9e4('0x47')][_0xa9e4('0x52')]+'%'};return _0x54f313;})});}_0x2da089=_[_0xa9e4('0x53')]({},_0x2da089,_0x369d16[_0xa9e4('0x59')]);return db[_0xa9e4('0x6f')]['count']({'where':_0x2da089[_0xa9e4('0x50')]})['then'](function(_0x470466){_0x33962e[_0xa9e4('0x35')]=_0x470466;if(_0x369d16['query'][_0xa9e4('0x54')]){_0x2da089[_0xa9e4('0x55')]=[{'all':!![]}];}return db[_0xa9e4('0x6f')]['findAll'](_0x2da089);})[_0xa9e4('0x24')](function(_0x513cb8){_0x33962e['rows']=_0x513cb8;return _0x33962e;});}})['then'](respondWithFilteredResult(_0x45b9df,_0x2da089))[_0xa9e4('0x2e')](handleError(_0x45b9df,null));};exports[_0xa9e4('0x73')]=function(_0x42a5a4,_0x396f5c,_0xeb573d){return db[_0xa9e4('0x42')]['find']({'where':{'id':_0x42a5a4[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x396f5c,null))[_0xa9e4('0x24')](function(_0x2b1db4){if(_0x2b1db4){return _0x2b1db4[_0xa9e4('0x73')](_0x42a5a4[_0xa9e4('0x47')]['ids']);}})[_0xa9e4('0x24')](respondWithStatusCode(_0x396f5c,null))[_0xa9e4('0x2e')](handleError(_0x396f5c,null));};exports[_0xa9e4('0x74')]=function(_0x3fcca4,_0x36a469,_0x1d1e93){return db[_0xa9e4('0x42')][_0xa9e4('0x5a')]({'where':{'id':_0x3fcca4['params']['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x36a469,null))[_0xa9e4('0x24')](function(_0x3951e0){if(_0x3951e0){return _0x3951e0[_0xa9e4('0x74')](_0x3fcca4[_0xa9e4('0x5c')][_0xa9e4('0x6d')],_['omit'](_0x3fcca4['body'],['ids','id'])||{})[_0xa9e4('0x75')](function(_0x3d51da){for(var _0x52614f=0x0;_0x52614f<_0x3fcca4[_0xa9e4('0x5c')][_0xa9e4('0x6d')][_0xa9e4('0x4c')];_0x52614f+=0x1){socket['emit'](_0xa9e4('0x76'),{'UserId':Number(_0x3fcca4['body']['ids'][_0x52614f]),'WhatsappAccountId':Number(_0x3fcca4[_0xa9e4('0x64')]['id'])});}return _0x3d51da;});}})[_0xa9e4('0x24')](respondWithResult(_0x36a469,null))[_0xa9e4('0x2e')](handleError(_0x36a469,null));};exports[_0xa9e4('0x77')]=function(_0x128524,_0x5e19cc,_0x50ae30){return db['WhatsappAccount'][_0xa9e4('0x5a')]({'where':{'id':_0x128524[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x5e19cc,null))[_0xa9e4('0x24')](function(_0x111523){if(_0x111523){return _0x111523['removeAgents'](_0x128524[_0xa9e4('0x47')][_0xa9e4('0x6d')])[_0xa9e4('0x24')](function(){if(_[_0xa9e4('0x78')](_0x128524[_0xa9e4('0x47')]['ids'])){for(var _0x257474=0x0;_0x257474<_0x128524['query']['ids']['length'];_0x257474+=0x1){socket['emit'](_0xa9e4('0x79'),{'UserId':Number(_0x128524[_0xa9e4('0x47')][_0xa9e4('0x6d')][_0x257474]),'WhatsappAccountId':Number(_0x128524[_0xa9e4('0x64')]['id'])});}}else{socket[_0xa9e4('0x7a')](_0xa9e4('0x79'),{'UserId':Number(_0x128524['query']['ids']),'WhatsappAccountId':Number(_0x128524[_0xa9e4('0x64')]['id'])});}});}})[_0xa9e4('0x24')](respondWithStatusCode(_0x5e19cc,null))[_0xa9e4('0x2e')](handleError(_0x5e19cc,null));};exports['getAgents']=function(_0x278bde,_0x1e27a2,_0x21c463){var _0x5428c7={};var _0x4074d4={};var _0x28c66b;var _0x552c62;return db[_0xa9e4('0x42')][_0xa9e4('0x69')]({'where':{'id':_0x278bde[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x1e27a2,null))[_0xa9e4('0x24')](function(_0x4cf404){if(_0x4cf404){_0x28c66b=_0x4cf404;_0x4074d4[_0xa9e4('0x46')]=_[_0xa9e4('0x48')](db[_0xa9e4('0x7b')][_0xa9e4('0x43')]);_0x4074d4[_0xa9e4('0x47')]=_[_0xa9e4('0x48')](_0x278bde[_0xa9e4('0x47')]);_0x4074d4[_0xa9e4('0x4f')]=_[_0xa9e4('0x49')](_0x4074d4[_0xa9e4('0x46')],_0x4074d4[_0xa9e4('0x47')]);_0x5428c7[_0xa9e4('0x4a')]=_[_0xa9e4('0x49')](_0x4074d4[_0xa9e4('0x46')],qs[_0xa9e4('0x4b')](_0x278bde[_0xa9e4('0x47')][_0xa9e4('0x4b')]));_0x5428c7['attributes']=_0x5428c7[_0xa9e4('0x4a')][_0xa9e4('0x4c')]?_0x5428c7['attributes']:_0x4074d4[_0xa9e4('0x46')];_0x5428c7['order']=qs[_0xa9e4('0x4d')](_0x278bde[_0xa9e4('0x47')][_0xa9e4('0x4d')]);_0x5428c7['where']=qs['filters'](_[_0xa9e4('0x4e')](_0x278bde['query'],_0x4074d4[_0xa9e4('0x4f')]));if(_0x278bde['query'][_0xa9e4('0x52')]){_0x5428c7[_0xa9e4('0x50')]=_['merge'](_0x5428c7[_0xa9e4('0x50')],{'$or':_[_0xa9e4('0x41')](_0x5428c7[_0xa9e4('0x4a')],function(_0x84b1c7){var _0x1bad36={};_0x1bad36[_0x84b1c7]={'$like':'%'+_0x278bde['query'][_0xa9e4('0x52')]+'%'};return _0x1bad36;})});}_0x5428c7=_['merge']({},_0x5428c7,_0x278bde[_0xa9e4('0x59')]);return _0x28c66b[_0xa9e4('0x7c')](_0x5428c7);}})[_0xa9e4('0x24')](function(_0x2e747a){if(_0x2e747a){_0x552c62=_0x2e747a[_0xa9e4('0x4c')];if(!_0x278bde[_0xa9e4('0x47')][_0xa9e4('0x71')]('nolimit')){_0x5428c7[_0xa9e4('0x33')]=qs[_0xa9e4('0x33')](_0x278bde['query']['limit']);_0x5428c7[_0xa9e4('0x36')]=qs[_0xa9e4('0x36')](_0x278bde[_0xa9e4('0x47')][_0xa9e4('0x36')]);}return _0x28c66b[_0xa9e4('0x7c')](_0x5428c7);}})[_0xa9e4('0x24')](function(_0x309c60){if(_0x309c60){return _0x309c60?{'count':_0x552c62,'rows':_0x309c60}:null;}})[_0xa9e4('0x24')](respondWithResult(_0x1e27a2,null))[_0xa9e4('0x2e')](handleError(_0x1e27a2,null));};exports['addApplications']=function(_0x693152,_0x239475,_0x102411){return db[_0xa9e4('0x42')]['findOne']({'where':{'id':_0x693152[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x239475,null))[_0xa9e4('0x24')](function(_0x3f99ac){if(_0x3f99ac){return db['sequelize'][_0xa9e4('0x7d')](function(_0x37f970){return db[_0xa9e4('0x7e')][_0xa9e4('0x3a')]({'where':{'WhatsappAccountId':_0x693152[_0xa9e4('0x64')]['id']},'transaction':_0x37f970})[_0xa9e4('0x24')](function(_0x325863){var _0x430c9d=_[_0xa9e4('0x41')](_0x693152[_0xa9e4('0x5c')],function(_0x467591){_0x467591['WhatsappAccountId']=_0x693152[_0xa9e4('0x64')]['id'];return _0x467591;});return db[_0xa9e4('0x7e')]['bulkCreate'](_0x430c9d,{'transaction':_0x37f970});});})['then'](function(){return db[_0xa9e4('0x7e')][_0xa9e4('0x7f')]({'where':{'WhatsappAccountId':_0x693152[_0xa9e4('0x64')]['id']},'order':'priority'});});}})[_0xa9e4('0x24')](respondWithResult(_0x239475,null))['catch'](handleError(_0x239475,null));};exports[_0xa9e4('0x80')]=function(_0x5a288a,_0x51a08f,_0x38a71b){var _0x35d918={};var _0x208ff8={};var _0x6e2837;var _0x46899f;return db[_0xa9e4('0x42')][_0xa9e4('0x69')]({'where':{'id':_0x5a288a[_0xa9e4('0x64')]['id']}})[_0xa9e4('0x24')](handleEntityNotFound(_0x51a08f,null))[_0xa9e4('0x24')](function(_0x52bf55){if(_0x52bf55){_0x6e2837=_0x52bf55;_0x208ff8['model']=_[_0xa9e4('0x48')](db[_0xa9e4('0x7e')][_0xa9e4('0x43')]);_0x208ff8[_0xa9e4('0x47')]=_[_0xa9e4('0x48')](_0x5a288a[_0xa9e4('0x47')]);_0x208ff8[_0xa9e4('0x4f')]=_[_0xa9e4('0x49')](_0x208ff8[_0xa9e4('0x46')],_0x208ff8['query']);_0x35d918[_0xa9e4('0x4a')]=_['intersection'](_0x208ff8[_0xa9e4('0x46')],qs['fields'](_0x5a288a[_0xa9e4('0x47')][_0xa9e4('0x4b')]));_0x35d918[_0xa9e4('0x4a')]=_0x35d918['attributes'][_0xa9e4('0x4c')]?_0x35d918[_0xa9e4('0x4a')]:_0x208ff8[_0xa9e4('0x46')];_0x35d918[_0xa9e4('0x6b')]=qs[_0xa9e4('0x4d')](_0x5a288a[_0xa9e4('0x47')][_0xa9e4('0x4d')]);_0x35d918[_0xa9e4('0x50')]=qs[_0xa9e4('0x4f')](_['pick'](_0x5a288a['query'],_0x208ff8[_0xa9e4('0x4f')]));if(_0x5a288a['query']['filter']){_0x35d918[_0xa9e4('0x50')]=_['merge'](_0x35d918[_0xa9e4('0x50')],{'$or':_['map'](_0x35d918[_0xa9e4('0x4a')],function(_0x8e1db5){var _0x3121e2={};_0x3121e2[_0x8e1db5]={'$like':'%'+_0x5a288a[_0xa9e4('0x47')][_0xa9e4('0x52')]+'%'};return _0x3121e2;})});}_0x35d918=_[_0xa9e4('0x53')]({},_0x35d918,_0x5a288a[_0xa9e4('0x59')]);return _0x6e2837['getApplications'](_0x35d918);}})['then'](function(_0x2525f5){if(_0x2525f5){_0x46899f=_0x2525f5[_0xa9e4('0x4c')];if(!_0x5a288a[_0xa9e4('0x47')][_0xa9e4('0x71')](_0xa9e4('0x72'))){_0x35d918[_0xa9e4('0x33')]=qs['limit'](_0x5a288a[_0xa9e4('0x47')]['limit']);_0x35d918[_0xa9e4('0x36')]=qs['offset'](_0x5a288a[_0xa9e4('0x47')][_0xa9e4('0x36')]);}return _0x6e2837[_0xa9e4('0x80')](_0x35d918);}})['then'](function(_0x3179ca){if(_0x3179ca){return _0x3179ca?{'count':_0x46899f,'rows':_0x3179ca}:null;}})[_0xa9e4('0x24')](respondWithResult(_0x51a08f,null))[_0xa9e4('0x2e')](handleError(_0x51a08f,null));};exports[_0xa9e4('0x81')]=function(_0x2bc990,_0x2cd49b,_0x19ceee){var _0x4f0025={'channel':_0xa9e4('0x82')};var _0x5a4da9=[];var _0x43d315=[];var _0x18452={};return db['WhatsappAccount']['find']({'where':{'id':_0x2bc990[_0xa9e4('0x64')]['id']},'include':[{'model':db[_0xa9e4('0x7e')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x2cd49b,null))[_0xa9e4('0x24')](function(_0x1e3b58){_0x4f0025[_0xa9e4('0x83')]=_0x1e3b58;_0x4f0025['applications']=_[_0xa9e4('0x84')](_0x1e3b58[_0xa9e4('0x85')],[_0xa9e4('0x86')],['asc']);if(_0x4f0025[_0xa9e4('0x83')][_0xa9e4('0x85')]){delete _0x4f0025[_0xa9e4('0x83')][_0xa9e4('0x85')];}return db['CmContact'][_0xa9e4('0x65')]();})['then'](function(_0x4e0430){if(!_0x4e0430){throw new db[(_0xa9e4('0x87'))][(_0xa9e4('0x88'))](_0xa9e4('0x89'));}_0x5a4da9=_[_0xa9e4('0x8a')](_[_0xa9e4('0x48')](_0x4e0430),[_0xa9e4('0x8b'),'updatedAt']);_0x43d315=_[_0xa9e4('0x8a')](_[_0xa9e4('0x48')](_0x4e0430),[_0xa9e4('0x8b'),_0xa9e4('0x8c'),_0xa9e4('0x8d'),_0xa9e4('0x8e')]);_0x4f0025[_0xa9e4('0x5c')]={'mapKey':_0xa9e4('0x8f')};if(_0x4f0025[_0xa9e4('0x83')][_0xa9e4('0x45')]&&_0x4f0025[_0xa9e4('0x83')]['type']==='twilio'){_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x90')]=_0x2bc990[_0xa9e4('0x5c')][_0xa9e4('0x91')][_0xa9e4('0x92')](_0xa9e4('0x93'),'');_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x5c')]=_0x2bc990['body'][_0xa9e4('0x94')];_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x95')]=_0x2bc990['body'][_0xa9e4('0x96')];}if(_0x4f0025[_0xa9e4('0x5c')]['id']){delete _0x4f0025[_0xa9e4('0x5c')]['id'];}if(_['isNil'](_0x4f0025['body'][_0xa9e4('0x90')])){throw new db[(_0xa9e4('0x87'))][(_0xa9e4('0x88'))](_0xa9e4('0x97'));}if(_[_0xa9e4('0x98')](_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x5c')])||_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x5c')]===''){throw new db[(_0xa9e4('0x87'))][(_0xa9e4('0x88'))](_0xa9e4('0x99'));}if(_['isNil'](_0x4f0025[_0xa9e4('0x5c')]['mapKey'])){throw new db[(_0xa9e4('0x87'))][(_0xa9e4('0x88'))](_0xa9e4('0x9a')+_0x43d315);}if(!_['includes'](_0x43d315,_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x9b')])){throw new db[(_0xa9e4('0x87'))]['ValidationError'](_0xa9e4('0x9c')+_0x43d315);}_0x18452[_0x4f0025[_0xa9e4('0x5c')]['mapKey']]=_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x90')];return db[_0xa9e4('0x9d')]['find']({'where':{'id':_0x4f0025['account'][_0xa9e4('0x8e')]},'include':[{'model':db[_0xa9e4('0x9e')],'as':_0xa9e4('0x9f'),'where':_0x18452,'limit':0x1,'order':[[_0xa9e4('0x8c'),'DESC']]}]});})['then'](handleEntityNotFound(_0x2cd49b,null))[_0xa9e4('0x24')](function(_0x48346c){if(_0x48346c){_0x4f0025['list']=_[_0xa9e4('0xa0')](_0x48346c,[_0xa9e4('0x9f')]);if(_0x48346c[_0xa9e4('0x9f')][_0xa9e4('0x4c')]){return _0x48346c[_0xa9e4('0x9f')][0x0];}var _0x176f83=_[_0xa9e4('0x1a')](_0x4f0025[_0xa9e4('0x5c')],{'firstName':_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x90')],'ListId':_0x48346c['id']});_0x176f83[_0x4f0025['body'][_0xa9e4('0x9b')]]=_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x90')];return db['CmContact'][_0xa9e4('0x5b')](_0x176f83,{'fields':_0x5a4da9,'raw':!![]});}})[_0xa9e4('0x24')](handleEntityNotFound(_0x2cd49b,null))[_0xa9e4('0x24')](function(_0x5291e5){if(_0x5291e5){_0x4f0025[_0xa9e4('0xa1')]=_0x5291e5;var _0x4d5e50={'ContactId':_0x5291e5['id'],'phone':_0x4f0025['body'][_0xa9e4('0x90')],'WhatsappAccountId':_0x2bc990[_0xa9e4('0x64')]['id']};var _0x4d857b={'ContactId':_0x5291e5['id'],'WhatsappAccountId':_0x2bc990[_0xa9e4('0x64')]['id'],'closed':![]};return db[_0xa9e4('0xa2')][_0xa9e4('0x5a')]({'where':_0x4d857b})['then'](function(_0x5bb27d){if(_0x5bb27d){return[_0x5bb27d,![]];}return db['WhatsappInteraction'][_0xa9e4('0x5b')](_0x4d5e50)[_0xa9e4('0x24')](function(_0x104ab6){return[_0x104ab6,!![]];});});}})[_0xa9e4('0x75')](function(_0x14496a,_0x4fc829){_0x4f0025[_0xa9e4('0xa3')]=_0x14496a['get']({'plain':!![]});_0x4f0025['interaction'][_0xa9e4('0xa4')]=![];if(_0x4fc829){if(_0x4f0025[_0xa9e4('0x83')][_0xa9e4('0xa5')]){_0x4f0025['applications']['push']({'id':0x0,'priority':_0x4f0025['applications'][_0xa9e4('0x4c')]+0x1,'app':_0xa9e4('0xa6'),'appdata':_0xa9e4('0xa7'),'interval':'*,*,*,*'});}_0x4f0025[_0xa9e4('0xa3')]['created']=!![];}return db['WhatsappMessage'][_0xa9e4('0x5b')]({'phone':_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x90')],'messageId':_0x4f0025[_0xa9e4('0x5c')]['messageId'],'body':_0x4f0025[_0xa9e4('0x5c')][_0xa9e4('0x5c')],'WhatsappAccountId':_0x2bc990[_0xa9e4('0x64')]['id'],'WhatsappInteractionId':_0x14496a['id'],'direction':'in','ContactId':_0x14496a[_0xa9e4('0xa8')],'AttachmentId':_0x4f0025[_0xa9e4('0x5c')]['AttachmentId']});})[_0xa9e4('0x24')](function(_0x8acfed){_0x4f0025[_0xa9e4('0x2d')]=_0x8acfed;if(_0x4f0025[_0xa9e4('0xa3')]['UserId']){return db[_0xa9e4('0x7b')]['find']({'attributes':['id','name'],'where':{'id':_0x4f0025[_0xa9e4('0xa3')][_0xa9e4('0xa9')]}})[_0xa9e4('0x24')](function(_0x16ef69){if(_0x16ef69){_0x4f0025[_0xa9e4('0xaa')][_0xa9e4('0xab')]({'id':0x0,'priority':0x0,'app':_0xa9e4('0xac'),'appdata':_0x16ef69[_0xa9e4('0x3e')]+','+(_0x4f0025['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xa9e4('0xad'),_0xa9e4('0xae'),_0x4f0025);});}return respondWithRpcPromise(_0xa9e4('0xad'),'startRouting',_0x4f0025);})[_0xa9e4('0x24')](function(_0x29fbae){if(_0x29fbae){var _0x32e27c=0xc8;var _0x49461c=_0xa9e4('0xaf');logger[_0xa9e4('0x25')](_0xa9e4('0x28'),_0x49461c,_0x32e27c,_0xa9e4('0xb0'));logger['debug'](_0xa9e4('0xb1'),_0x49461c,_0x32e27c,'entity\x20found',JSON[_0xa9e4('0x2a')](_0x29fbae));if(_0x4f0025[_0xa9e4('0x83')][_0xa9e4('0x45')]===_0xa9e4('0xb2')){return _0x2cd49b[_0xa9e4('0x30')](_0x32e27c)[_0xa9e4('0x37')](_0xa9e4('0xb3'),_0xa9e4('0xb4'))[_0xa9e4('0xb5')](_0xa9e4('0xb6'));}else{return _0x2cd49b[_0xa9e4('0x30')](_0x32e27c)[_0xa9e4('0x32')](_0x29fbae);}}})[_0xa9e4('0x2e')](handleError(_0x2cd49b,null));};exports[_0xa9e4('0xb5')]=function(_0x5593db,_0x544782,_0x4af113){var _0x46aacc,_0x2858f4,_0x51a84e;if(_[_0xa9e4('0x98')](_0x5593db['body'][_0xa9e4('0x5c')])||_0x5593db[_0xa9e4('0x5c')][_0xa9e4('0x5c')]===''){throw new db[(_0xa9e4('0x87'))]['ValidationError'](_0xa9e4('0x99'));}if(_[_0xa9e4('0x98')](_0x5593db[_0xa9e4('0x5c')]['to'])){throw new db['Sequelize'][(_0xa9e4('0x88'))](_0xa9e4('0xb7'));}_0x46aacc=_0x5593db[_0xa9e4('0x5c')]['to'];return db[_0xa9e4('0x42')][_0xa9e4('0x5a')]({'where':{'id':_0x5593db['params']['id']},'include':[{'model':db[_0xa9e4('0x9d')],'as':_0xa9e4('0xb8'),'include':[{'model':db[_0xa9e4('0x9e')],'as':_0xa9e4('0x9f'),'where':{'mobile':_0x46aacc},'limit':0x1,'order':[[_0xa9e4('0x8c'),_0xa9e4('0xb9')]]}]}]})[_0xa9e4('0x24')](handleEntityNotFound(_0x544782,null))['then'](function(_0x5bd172){if(_0x5bd172&&_0x5bd172[_0xa9e4('0xb8')]){_0x2858f4=_0x5bd172[_0xa9e4('0x3b')]({'plain':!![]});if(_0x2858f4[_0xa9e4('0xb8')]&&_0x2858f4[_0xa9e4('0xb8')][_0xa9e4('0x9f')][_0xa9e4('0x4c')]){return _0x2858f4[_0xa9e4('0xb8')]['Contacts'][0x0];}return db[_0xa9e4('0x9e')][_0xa9e4('0x5b')](_[_0xa9e4('0x1a')](_0x5593db['body'],{'firstName':_0x46aacc,'mobile':_0x46aacc,'phone':_0x46aacc,'ListId':_0x2858f4['ListId']}));}})['then'](handleEntityNotFound(_0x544782,null))[_0xa9e4('0x24')](function(_0x17c463){if(_0x17c463){_0x51a84e=_0x17c463;return db[_0xa9e4('0xa2')][_0xa9e4('0x5a')]({'where':{'ContactId':_0x51a84e['id'],'closed':![],'WhatsappAccountId':_0x2858f4['id']}})['then'](function(_0x4ef95e){if(_0x4ef95e){return[_0x4ef95e,![]];}return db[_0xa9e4('0xa2')][_0xa9e4('0x5b')]({'UserId':_0x5593db[_0xa9e4('0x5d')]['id'],'ContactId':_0x51a84e['id'],'WhatsappAccountId':_0x2858f4['id'],'phone':_0x46aacc,'firstMsgDirection':'out','Messages':[_['merge'](_0x5593db['body'],{'read':![],'body':_0x5593db['body'][_0xa9e4('0x5c')],'phone':_0x46aacc,'WhatsappAccountId':_0x2858f4['id'],'UserId':_0x5593db[_0xa9e4('0x5d')]['id'],'ContactId':_0x51a84e['id']})]},{'include':[{'model':db[_0xa9e4('0xba')],'as':_0xa9e4('0xbb')}]})[_0xa9e4('0x24')](function(_0x17d31d){return[_0x17d31d,!![]];});});}})[_0xa9e4('0x75')](function(_0x16bf55,_0x38e0cc){if(_0x38e0cc){return _0x16bf55;}return db[_0xa9e4('0xba')][_0xa9e4('0x5b')](_['merge'](_0x5593db['body'],{'read':![],'body':_0x5593db[_0xa9e4('0x5c')]['body'],'phone':_0x46aacc,'WhatsappAccountId':_0x2858f4['id'],'WhatsappInteractionId':_0x16bf55['id'],'UserId':_0x5593db[_0xa9e4('0x5d')]['id'],'ContactId':_0x51a84e['id']}))[_0xa9e4('0x24')](function(_0x48679e){_0x16bf55[_0xa9e4('0xbc')][_0xa9e4('0xbb')]=[];_0x16bf55[_0xa9e4('0xbc')][_0xa9e4('0xbb')][_0xa9e4('0xbd')](_0x48679e[_0xa9e4('0xbc')]);return _0x16bf55;});})[_0xa9e4('0x24')](respondWithResult(_0x544782,null))[_0xa9e4('0x2e')](handleError(_0x544782,null));}; \ No newline at end of file +var _0x9c1c=['describe','WhatsappAccountId','findOne','Disposition','nolimit','removeDispositions','getAnswers','CannedAnswer','findAll','removeAnswers','ids','addAgents','omit','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','whatsapp','Applications','account','applications','orderBy','asc','CmContact','ValidationError','no\x20available\x20attributes','updatedAt','difference','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','messageId','MessageSid','isNil','from\x20is\x20mandatory','Sequelize','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','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','to\x20is\x20mandatory','List','out','WhatsappMessage','Messages','spread','dataValues','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','destroy','get','WhatsappAccounts','UserProfileResource','name','index','Pause','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','include','rows','show','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'];(function(_0x4b156f,_0x31107a){var _0x3e61f0=function(_0x120a3c){while(--_0x120a3c){_0x4b156f['push'](_0x4b156f['shift']());}};_0x3e61f0(++_0x31107a);}(_0x9c1c,0x105));var _0xc9c1=function(_0x3d9176,_0x399d6f){_0x3d9176=_0x3d9176-0x0;var _0x12adc5=_0x9c1c[_0x3d9176];return _0x12adc5;};'use strict';var emlformat=require(_0xc9c1('0x0'));var rimraf=require(_0xc9c1('0x1'));var zipdir=require(_0xc9c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc9c1('0x3'));var moment=require(_0xc9c1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc9c1('0x5'));var util=require(_0xc9c1('0x6'));var path=require('path');var sox=require(_0xc9c1('0x7'));var csv=require(_0xc9c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9c1('0x9'));var squel=require(_0xc9c1('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc9c1('0xb'));var toCsv=require(_0xc9c1('0x8'));var querystring=require('querystring');var Papa=require(_0xc9c1('0xc'));var Redis=require('ioredis');var authService=require(_0xc9c1('0xd'));var qs=require(_0xc9c1('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9c1('0xf'))('api');var utils=require(_0xc9c1('0x10'));var config=require(_0xc9c1('0x11'));var licenseUtil=require(_0xc9c1('0x12'));var db=require(_0xc9c1('0x13'))['db'];config['redis']=_['defaults'](config[_0xc9c1('0x14')],{'host':_0xc9c1('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc9c1('0x14')]));require(_0xc9c1('0x16'))[_0xc9c1('0x17')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x56ce89,_0x510d80,_0x2c044c,_0xa56b52){return new BPromise(function(_0x441e12,_0x4ccee1){var _0x1c2b9c=_0xa56b52||client;return _0x1c2b9c['request'](_0x56ce89,_0x2c044c)[_0xc9c1('0x18')](function(_0x3f4e66){logger[_0xc9c1('0x19')](_0xc9c1('0x1a'),_0x510d80,_0xc9c1('0x1b'));logger[_0xc9c1('0x1c')](_0xc9c1('0x1d'),_0x510d80,_0xc9c1('0x1b'),JSON[_0xc9c1('0x1e')](_0x3f4e66));if(_0x3f4e66['error']){if(_0x3f4e66[_0xc9c1('0x1f')]['code']===0x1f4){logger[_0xc9c1('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x510d80,_0x3f4e66[_0xc9c1('0x1f')][_0xc9c1('0x20')]);return _0x4ccee1(_0x3f4e66[_0xc9c1('0x1f')][_0xc9c1('0x20')]);}logger[_0xc9c1('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x510d80,_0x3f4e66[_0xc9c1('0x1f')][_0xc9c1('0x20')]);return _0x441e12(_0x3f4e66[_0xc9c1('0x1f')][_0xc9c1('0x20')]);}else{logger[_0xc9c1('0x19')](_0xc9c1('0x1a'),_0x510d80,_0xc9c1('0x1b'));_0x441e12(_0x3f4e66[_0xc9c1('0x21')][_0xc9c1('0x20')]);}})[_0xc9c1('0x22')](function(_0x5a5be3){logger[_0xc9c1('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0x510d80,_0x5a5be3);_0x4ccee1(_0x5a5be3);});});}function respondWithStatusCode(_0x3052d7,_0x5093b2){_0x5093b2=_0x5093b2||0xcc;return function(_0x5ad5cb){if(_0x5ad5cb){return _0x3052d7[_0xc9c1('0x23')](_0x5093b2);}return _0x3052d7[_0xc9c1('0x24')](_0x5093b2)[_0xc9c1('0x25')]();};}function respondWithResult(_0x3de676,_0x2c7098){_0x2c7098=_0x2c7098||0xc8;return function(_0xceaa03){if(_0xceaa03){return _0x3de676[_0xc9c1('0x24')](_0x2c7098)[_0xc9c1('0x26')](_0xceaa03);}};}function respondWithFilteredResult(_0x12982e,_0x4bdd9b){return function(_0x153a0a){if(_0x153a0a){var _0x35d8fb=typeof _0x4bdd9b['offset']===_0xc9c1('0x27')&&typeof _0x4bdd9b[_0xc9c1('0x28')]===_0xc9c1('0x27');var _0x51d05d=_0x153a0a[_0xc9c1('0x29')];var _0x8ef741=_0x35d8fb?0x0:_0x4bdd9b[_0xc9c1('0x2a')];var _0x3e1ab8=_0x35d8fb?_0x153a0a['count']:_0x4bdd9b[_0xc9c1('0x2a')]+_0x4bdd9b[_0xc9c1('0x28')];var _0x18ab13;if(_0x3e1ab8>=_0x51d05d){_0x3e1ab8=_0x51d05d;_0x18ab13=0xc8;}else{_0x18ab13=0xce;}_0x12982e['status'](_0x18ab13);return _0x12982e['set'](_0xc9c1('0x2b'),_0x8ef741+'-'+_0x3e1ab8+'/'+_0x51d05d)[_0xc9c1('0x26')](_0x153a0a);}return null;};}function patchUpdates(_0x5d555e){return function(_0x2e610f){try{jsonpatch['apply'](_0x2e610f,_0x5d555e,!![]);}catch(_0x4349a2){return BPromise[_0xc9c1('0x2c')](_0x4349a2);}return _0x2e610f['save']();};}function saveUpdates(_0x58e7af,_0x48d57c){return function(_0xcfa3d2){if(_0xcfa3d2){return _0xcfa3d2['update'](_0x58e7af)[_0xc9c1('0x18')](function(_0x56cc0a){return _0x56cc0a;});}return null;};}function removeEntity(_0x1095be,_0x52a30b){return function(_0x5aeafc){if(_0x5aeafc){return _0x5aeafc[_0xc9c1('0x2d')]()[_0xc9c1('0x18')](function(){var _0x39fcc4=_0x5aeafc[_0xc9c1('0x2e')]({'plain':!![]});var _0x2ffebd=_0xc9c1('0x2f');return db[_0xc9c1('0x30')][_0xc9c1('0x2d')]({'where':{'type':_0x2ffebd,'resourceId':_0x39fcc4['id']}})[_0xc9c1('0x18')](function(){return _0x5aeafc;});})[_0xc9c1('0x18')](function(){_0x1095be[_0xc9c1('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cfaf3,_0x4f54dc){return function(_0x28a008){if(!_0x28a008){_0x1cfaf3['sendStatus'](0x194);}return _0x28a008;};}function handleError(_0x253236,_0x1fdf5c){_0x1fdf5c=_0x1fdf5c||0x1f4;return function(_0x129fcb){logger[_0xc9c1('0x1f')](_0x129fcb['stack']);if(_0x129fcb[_0xc9c1('0x31')]){delete _0x129fcb[_0xc9c1('0x31')];}_0x253236[_0xc9c1('0x24')](_0x1fdf5c)['send'](_0x129fcb);};}exports[_0xc9c1('0x32')]=function(_0x2ef0a9,_0x28659b){var _0x7ac86f={'include':[{'model':db[_0xc9c1('0x33')],'as':'mandatoryDispositionPause'}]},_0x5180f8={},_0x1907c3={'count':0x0,'rows':[]};var _0x4c4057=_['map'](db['WhatsappAccount'][_0xc9c1('0x34')],function(_0x381b18){return{'name':_0x381b18['fieldName'],'type':_0x381b18[_0xc9c1('0x35')][_0xc9c1('0x36')]};});_0x5180f8['model']=_[_0xc9c1('0x37')](_0x4c4057,_0xc9c1('0x31'));_0x5180f8[_0xc9c1('0x38')]=_[_0xc9c1('0x39')](_0x2ef0a9[_0xc9c1('0x38')]);_0x5180f8[_0xc9c1('0x3a')]=_[_0xc9c1('0x3b')](_0x5180f8[_0xc9c1('0x3c')],_0x5180f8[_0xc9c1('0x38')]);_0x7ac86f[_0xc9c1('0x3d')]=_[_0xc9c1('0x3b')](_0x5180f8[_0xc9c1('0x3c')],qs[_0xc9c1('0x3e')](_0x2ef0a9[_0xc9c1('0x38')][_0xc9c1('0x3e')]));_0x7ac86f['attributes']=_0x7ac86f[_0xc9c1('0x3d')][_0xc9c1('0x3f')]?_0x7ac86f['attributes']:_0x5180f8['model'];if(!_0x2ef0a9[_0xc9c1('0x38')]['hasOwnProperty']('nolimit')){_0x7ac86f['limit']=qs[_0xc9c1('0x28')](_0x2ef0a9[_0xc9c1('0x38')][_0xc9c1('0x28')]);_0x7ac86f['offset']=qs[_0xc9c1('0x2a')](_0x2ef0a9[_0xc9c1('0x38')]['offset']);}_0x7ac86f[_0xc9c1('0x40')]=qs[_0xc9c1('0x41')](_0x2ef0a9[_0xc9c1('0x38')][_0xc9c1('0x41')]);_0x7ac86f[_0xc9c1('0x42')]=qs[_0xc9c1('0x3a')](_[_0xc9c1('0x43')](_0x2ef0a9['query'],_0x5180f8['filters']),_0x4c4057);if(_0x2ef0a9[_0xc9c1('0x38')][_0xc9c1('0x44')]){_0x7ac86f[_0xc9c1('0x42')]=_[_0xc9c1('0x45')](_0x7ac86f[_0xc9c1('0x42')],{'$or':_[_0xc9c1('0x37')](_0x4c4057,function(_0x2740f6){if(_0x2740f6[_0xc9c1('0x35')]!==_0xc9c1('0x46')){var _0x5786b5={};_0x5786b5[_0x2740f6[_0xc9c1('0x31')]]={'$like':'%'+_0x2ef0a9['query'][_0xc9c1('0x44')]+'%'};return _0x5786b5;}})});}_0x7ac86f=_[_0xc9c1('0x45')]({},_0x7ac86f,_0x2ef0a9[_0xc9c1('0x47')]);var _0x373895={'where':_0x7ac86f[_0xc9c1('0x42')]};return db[_0xc9c1('0x48')][_0xc9c1('0x29')](_0x373895)[_0xc9c1('0x18')](function(_0x162358){_0x1907c3['count']=_0x162358;if(_0x2ef0a9[_0xc9c1('0x38')]['includeAll']){_0x7ac86f[_0xc9c1('0x49')]=[{'all':!![]}];}return db[_0xc9c1('0x48')]['findAll'](_0x7ac86f);})[_0xc9c1('0x18')](function(_0x35aa34){_0x1907c3[_0xc9c1('0x4a')]=_0x35aa34;return _0x1907c3;})['then'](respondWithFilteredResult(_0x28659b,_0x7ac86f))[_0xc9c1('0x22')](handleError(_0x28659b,null));};exports[_0xc9c1('0x4b')]=function(_0x515eb9,_0x4a6e71){var _0x392c64={'raw':![],'where':{'id':_0x515eb9[_0xc9c1('0x4c')]['id']},'include':[{'model':db[_0xc9c1('0x33')],'as':'mandatoryDispositionPause'}]},_0x3322d5={};_0x3322d5[_0xc9c1('0x3c')]=_[_0xc9c1('0x39')](db['WhatsappAccount'][_0xc9c1('0x34')]);_0x3322d5[_0xc9c1('0x38')]=_[_0xc9c1('0x39')](_0x515eb9[_0xc9c1('0x38')]);_0x3322d5[_0xc9c1('0x3a')]=_[_0xc9c1('0x3b')](_0x3322d5[_0xc9c1('0x3c')],_0x3322d5[_0xc9c1('0x38')]);_0x392c64[_0xc9c1('0x3d')]=_[_0xc9c1('0x3b')](_0x3322d5['model'],qs[_0xc9c1('0x3e')](_0x515eb9[_0xc9c1('0x38')][_0xc9c1('0x3e')]));_0x392c64['attributes']=_0x392c64[_0xc9c1('0x3d')][_0xc9c1('0x3f')]?_0x392c64['attributes']:_0x3322d5['model'];if(_0x515eb9[_0xc9c1('0x38')][_0xc9c1('0x4d')]){_0x392c64[_0xc9c1('0x49')]=[{'all':!![]}];}_0x392c64=_['merge']({},_0x392c64,_0x515eb9[_0xc9c1('0x47')]);return db[_0xc9c1('0x48')][_0xc9c1('0x4e')](_0x392c64)[_0xc9c1('0x18')](handleEntityNotFound(_0x4a6e71,null))['then'](respondWithResult(_0x4a6e71,null))[_0xc9c1('0x22')](handleError(_0x4a6e71,null));};exports[_0xc9c1('0x4f')]=function(_0x5663e9,_0xcfbece){return db['WhatsappAccount']['create'](_0x5663e9[_0xc9c1('0x50')],{})[_0xc9c1('0x18')](function(_0x4ee696){var _0x20600b=_0x5663e9[_0xc9c1('0x51')][_0xc9c1('0x2e')]({'plain':!![]});if(!_0x20600b)throw new Error(_0xc9c1('0x52'));if(_0x20600b['role']===_0xc9c1('0x51')){var _0x4f5669=_0x4ee696[_0xc9c1('0x2e')]({'plain':!![]});var _0x416bc9=_0xc9c1('0x2f');return db[_0xc9c1('0x53')][_0xc9c1('0x4e')]({'where':{'name':_0x416bc9,'userProfileId':_0x20600b[_0xc9c1('0x54')]},'raw':!![]})[_0xc9c1('0x18')](function(_0x566641){if(_0x566641&&_0x566641[_0xc9c1('0x55')]===0x0){return db[_0xc9c1('0x30')]['create']({'name':_0x4f5669[_0xc9c1('0x31')],'resourceId':_0x4f5669['id'],'type':_0x566641[_0xc9c1('0x31')],'sectionId':_0x566641['id']},{})[_0xc9c1('0x18')](function(){return _0x4ee696;});}else{return _0x4ee696;}})[_0xc9c1('0x22')](function(_0x2c0ced){logger[_0xc9c1('0x1f')](_0xc9c1('0x56'),_0x2c0ced);throw _0x2c0ced;});}return _0x4ee696;})['then'](respondWithResult(_0xcfbece,0xc9))[_0xc9c1('0x22')](handleError(_0xcfbece,null));};exports['update']=function(_0x2e1d54,_0xd5de22){if(_0x2e1d54['body']['id']){delete _0x2e1d54['body']['id'];}return db[_0xc9c1('0x48')][_0xc9c1('0x4e')]({'where':{'id':_0x2e1d54[_0xc9c1('0x4c')]['id']},'include':[{'model':db[_0xc9c1('0x33')],'as':'mandatoryDispositionPause'}]})[_0xc9c1('0x18')](handleEntityNotFound(_0xd5de22,null))['then'](saveUpdates(_0x2e1d54[_0xc9c1('0x50')],null))[_0xc9c1('0x18')](respondWithResult(_0xd5de22,null))[_0xc9c1('0x22')](handleError(_0xd5de22,null));};exports[_0xc9c1('0x2d')]=function(_0x3752e1,_0x5e0246){return db[_0xc9c1('0x48')][_0xc9c1('0x4e')]({'where':{'id':_0x3752e1[_0xc9c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5e0246,null))['then'](removeEntity(_0x5e0246,null))['catch'](handleError(_0x5e0246,null));};exports[_0xc9c1('0x57')]=function(_0x54ddf5,_0xb30941){return db[_0xc9c1('0x48')][_0xc9c1('0x57')]()[_0xc9c1('0x18')](respondWithResult(_0xb30941,null))[_0xc9c1('0x22')](handleError(_0xb30941,null));};exports['addDisposition']=function(_0x4bf18c,_0x289376,_0x33d231){if(_0x4bf18c[_0xc9c1('0x50')]['id']){delete _0x4bf18c[_0xc9c1('0x50')]['id'];}return db[_0xc9c1('0x48')][_0xc9c1('0x4e')]({'where':{'id':_0x4bf18c[_0xc9c1('0x4c')]['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x289376,null))[_0xc9c1('0x18')](function(_0x54c9e1){if(_0x54c9e1){_0x4bf18c['body'][_0xc9c1('0x58')]=_0x54c9e1['id'];return db['Disposition'][_0xc9c1('0x4f')](_0x4bf18c[_0xc9c1('0x50')]);}})[_0xc9c1('0x18')](respondWithResult(_0x289376,null))[_0xc9c1('0x22')](handleError(_0x289376,null));};exports['getDispositions']=function(_0x4e07d6,_0x1f52f4,_0x118a6c){var _0x45da41={'raw':![],'where':{}};var _0x1a1158={};var _0x54028b={'count':0x0,'rows':[]};return db[_0xc9c1('0x48')][_0xc9c1('0x59')]({'where':{'id':_0x4e07d6[_0xc9c1('0x4c')]['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x1f52f4,null))[_0xc9c1('0x18')](function(_0x551ac8){if(_0x551ac8){_0x1a1158[_0xc9c1('0x3c')]=_['keys'](db[_0xc9c1('0x5a')]['rawAttributes']);_0x1a1158['query']=_[_0xc9c1('0x39')](_0x4e07d6[_0xc9c1('0x38')]);_0x1a1158[_0xc9c1('0x3a')]=_[_0xc9c1('0x3b')](_0x1a1158['model'],_0x1a1158[_0xc9c1('0x38')]);_0x45da41[_0xc9c1('0x3d')]=_['intersection'](_0x1a1158[_0xc9c1('0x3c')],qs['fields'](_0x4e07d6[_0xc9c1('0x38')][_0xc9c1('0x3e')]));_0x45da41[_0xc9c1('0x3d')]=_0x45da41[_0xc9c1('0x3d')][_0xc9c1('0x3f')]?_0x45da41['attributes']:_0x1a1158[_0xc9c1('0x3c')];if(!_0x4e07d6[_0xc9c1('0x38')]['hasOwnProperty'](_0xc9c1('0x5b'))){_0x45da41[_0xc9c1('0x28')]=qs['limit'](_0x4e07d6[_0xc9c1('0x38')][_0xc9c1('0x28')]);_0x45da41[_0xc9c1('0x2a')]=qs[_0xc9c1('0x2a')](_0x4e07d6[_0xc9c1('0x38')][_0xc9c1('0x2a')]);}_0x45da41[_0xc9c1('0x40')]=qs[_0xc9c1('0x41')](_0x4e07d6[_0xc9c1('0x38')]['sort']);_0x45da41[_0xc9c1('0x42')]=qs[_0xc9c1('0x3a')](_['pick'](_0x4e07d6['query'],_0x1a1158[_0xc9c1('0x3a')]));_0x45da41[_0xc9c1('0x42')][_0xc9c1('0x58')]=_0x551ac8['id'];if(_0x4e07d6[_0xc9c1('0x38')][_0xc9c1('0x44')]){_0x45da41[_0xc9c1('0x42')]=_['merge'](_0x45da41[_0xc9c1('0x42')],{'$or':_['map'](_0x45da41[_0xc9c1('0x3d')],function(_0x3bc410){var _0x1bc4c9={};_0x1bc4c9[_0x3bc410]={'$like':'%'+_0x4e07d6[_0xc9c1('0x38')][_0xc9c1('0x44')]+'%'};return _0x1bc4c9;})});}_0x45da41=_[_0xc9c1('0x45')]({},_0x45da41,_0x4e07d6[_0xc9c1('0x47')]);return db[_0xc9c1('0x5a')][_0xc9c1('0x29')]({'where':_0x45da41['where']})[_0xc9c1('0x18')](function(_0x11d689){_0x54028b[_0xc9c1('0x29')]=_0x11d689;if(_0x4e07d6[_0xc9c1('0x38')][_0xc9c1('0x4d')]){_0x45da41[_0xc9c1('0x49')]=[{'all':!![]}];}return db[_0xc9c1('0x5a')]['findAll'](_0x45da41);})[_0xc9c1('0x18')](function(_0x1c6a19){_0x54028b[_0xc9c1('0x4a')]=_0x1c6a19;return _0x54028b;});}})[_0xc9c1('0x18')](respondWithFilteredResult(_0x1f52f4,_0x45da41))[_0xc9c1('0x22')](handleError(_0x1f52f4,null));};exports['removeDispositions']=function(_0x2d3da7,_0x2bac7d,_0x3fdd6){return db['WhatsappAccount'][_0xc9c1('0x4e')]({'where':{'id':_0x2d3da7['params']['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x2bac7d,null))[_0xc9c1('0x18')](function(_0xd65c2){if(_0xd65c2){return _0xd65c2[_0xc9c1('0x5c')](_0x2d3da7[_0xc9c1('0x38')]['ids']);}})['then'](respondWithStatusCode(_0x2bac7d,null))[_0xc9c1('0x22')](handleError(_0x2bac7d,null));};exports['addAnswer']=function(_0x55c0f5,_0x158287,_0xe8cfa7){if(_0x55c0f5[_0xc9c1('0x50')]['id']){delete _0x55c0f5[_0xc9c1('0x50')]['id'];}return db['WhatsappAccount'][_0xc9c1('0x4e')]({'where':{'id':_0x55c0f5['params']['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x158287,null))[_0xc9c1('0x18')](function(_0x473607){if(_0x473607){_0x55c0f5['body'][_0xc9c1('0x58')]=_0x473607['id'];return db['CannedAnswer'][_0xc9c1('0x4f')](_0x55c0f5[_0xc9c1('0x50')]);}})[_0xc9c1('0x18')](respondWithResult(_0x158287,null))['catch'](handleError(_0x158287,null));};exports[_0xc9c1('0x5d')]=function(_0x54f550,_0x2e0325,_0x32b674){var _0x58a658={'raw':![],'where':{}};var _0x1031b9={};var _0x3a811d={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x54f550[_0xc9c1('0x4c')]['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x2e0325,null))[_0xc9c1('0x18')](function(_0x39045d){if(_0x39045d){_0x1031b9[_0xc9c1('0x3c')]=_[_0xc9c1('0x39')](db[_0xc9c1('0x5e')]['rawAttributes']);_0x1031b9[_0xc9c1('0x38')]=_[_0xc9c1('0x39')](_0x54f550[_0xc9c1('0x38')]);_0x1031b9[_0xc9c1('0x3a')]=_[_0xc9c1('0x3b')](_0x1031b9[_0xc9c1('0x3c')],_0x1031b9['query']);_0x58a658[_0xc9c1('0x3d')]=_[_0xc9c1('0x3b')](_0x1031b9[_0xc9c1('0x3c')],qs[_0xc9c1('0x3e')](_0x54f550[_0xc9c1('0x38')][_0xc9c1('0x3e')]));_0x58a658[_0xc9c1('0x3d')]=_0x58a658[_0xc9c1('0x3d')][_0xc9c1('0x3f')]?_0x58a658[_0xc9c1('0x3d')]:_0x1031b9['model'];if(!_0x54f550[_0xc9c1('0x38')]['hasOwnProperty']('nolimit')){_0x58a658[_0xc9c1('0x28')]=qs[_0xc9c1('0x28')](_0x54f550[_0xc9c1('0x38')]['limit']);_0x58a658[_0xc9c1('0x2a')]=qs['offset'](_0x54f550[_0xc9c1('0x38')]['offset']);}_0x58a658[_0xc9c1('0x40')]=qs[_0xc9c1('0x41')](_0x54f550[_0xc9c1('0x38')][_0xc9c1('0x41')]);_0x58a658[_0xc9c1('0x42')]=qs[_0xc9c1('0x3a')](_[_0xc9c1('0x43')](_0x54f550[_0xc9c1('0x38')],_0x1031b9[_0xc9c1('0x3a')]));_0x58a658['where']['WhatsappAccountId']=_0x39045d['id'];if(_0x54f550['query'][_0xc9c1('0x44')]){_0x58a658[_0xc9c1('0x42')]=_[_0xc9c1('0x45')](_0x58a658[_0xc9c1('0x42')],{'$or':_[_0xc9c1('0x37')](_0x58a658[_0xc9c1('0x3d')],function(_0x1107c0){var _0x49d155={};_0x49d155[_0x1107c0]={'$like':'%'+_0x54f550[_0xc9c1('0x38')]['filter']+'%'};return _0x49d155;})});}_0x58a658=_[_0xc9c1('0x45')]({},_0x58a658,_0x54f550[_0xc9c1('0x47')]);return db[_0xc9c1('0x5e')]['count']({'where':_0x58a658[_0xc9c1('0x42')]})['then'](function(_0x264dc8){_0x3a811d[_0xc9c1('0x29')]=_0x264dc8;if(_0x54f550['query'][_0xc9c1('0x4d')]){_0x58a658[_0xc9c1('0x49')]=[{'all':!![]}];}return db[_0xc9c1('0x5e')][_0xc9c1('0x5f')](_0x58a658);})['then'](function(_0x5b2c35){_0x3a811d[_0xc9c1('0x4a')]=_0x5b2c35;return _0x3a811d;});}})[_0xc9c1('0x18')](respondWithFilteredResult(_0x2e0325,_0x58a658))[_0xc9c1('0x22')](handleError(_0x2e0325,null));};exports[_0xc9c1('0x60')]=function(_0x48f0f3,_0x1565f6,_0x1a0063){return db['WhatsappAccount']['find']({'where':{'id':_0x48f0f3[_0xc9c1('0x4c')]['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x1565f6,null))[_0xc9c1('0x18')](function(_0x2453c4){if(_0x2453c4){return _0x2453c4['removeAnswers'](_0x48f0f3[_0xc9c1('0x38')][_0xc9c1('0x61')]);}})[_0xc9c1('0x18')](respondWithStatusCode(_0x1565f6,null))[_0xc9c1('0x22')](handleError(_0x1565f6,null));};exports[_0xc9c1('0x62')]=function(_0xfb851e,_0x5ed253,_0x445367){return db[_0xc9c1('0x48')][_0xc9c1('0x4e')]({'where':{'id':_0xfb851e[_0xc9c1('0x4c')]['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x5ed253,null))[_0xc9c1('0x18')](function(_0x10e3c4){if(_0x10e3c4){return _0x10e3c4[_0xc9c1('0x62')](_0xfb851e[_0xc9c1('0x50')]['ids'],_[_0xc9c1('0x63')](_0xfb851e[_0xc9c1('0x50')],[_0xc9c1('0x61'),'id'])||{})['spread'](function(_0x520f96){for(var _0x24d7b1=0x0;_0x24d7b1<_0xfb851e[_0xc9c1('0x50')][_0xc9c1('0x61')][_0xc9c1('0x3f')];_0x24d7b1+=0x1){socket['emit'](_0xc9c1('0x64'),{'UserId':Number(_0xfb851e[_0xc9c1('0x50')]['ids'][_0x24d7b1]),'WhatsappAccountId':Number(_0xfb851e['params']['id'])});}return _0x520f96;});}})[_0xc9c1('0x18')](respondWithResult(_0x5ed253,null))[_0xc9c1('0x22')](handleError(_0x5ed253,null));};exports['removeAgents']=function(_0x5410cf,_0xb6df28,_0x1655d0){return db['WhatsappAccount']['find']({'where':{'id':_0x5410cf['params']['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0xb6df28,null))[_0xc9c1('0x18')](function(_0x213be0){if(_0x213be0){return _0x213be0[_0xc9c1('0x65')](_0x5410cf['query'][_0xc9c1('0x61')])[_0xc9c1('0x18')](function(){if(_[_0xc9c1('0x66')](_0x5410cf[_0xc9c1('0x38')][_0xc9c1('0x61')])){for(var _0x540d64=0x0;_0x540d64<_0x5410cf[_0xc9c1('0x38')][_0xc9c1('0x61')]['length'];_0x540d64+=0x1){socket[_0xc9c1('0x67')](_0xc9c1('0x68'),{'UserId':Number(_0x5410cf['query'][_0xc9c1('0x61')][_0x540d64]),'WhatsappAccountId':Number(_0x5410cf[_0xc9c1('0x4c')]['id'])});}}else{socket[_0xc9c1('0x67')](_0xc9c1('0x68'),{'UserId':Number(_0x5410cf[_0xc9c1('0x38')][_0xc9c1('0x61')]),'WhatsappAccountId':Number(_0x5410cf['params']['id'])});}});}})[_0xc9c1('0x18')](respondWithStatusCode(_0xb6df28,null))[_0xc9c1('0x22')](handleError(_0xb6df28,null));};exports[_0xc9c1('0x69')]=function(_0xa107,_0x26972b,_0x44b1ae){var _0x1ad7ee={};var _0x4a76c8={};var _0x37eb6f;var _0x233545;return db[_0xc9c1('0x48')][_0xc9c1('0x59')]({'where':{'id':_0xa107[_0xc9c1('0x4c')]['id']}})['then'](handleEntityNotFound(_0x26972b,null))['then'](function(_0x10cd51){if(_0x10cd51){_0x37eb6f=_0x10cd51;_0x4a76c8[_0xc9c1('0x3c')]=_['keys'](db[_0xc9c1('0x6a')]['rawAttributes']);_0x4a76c8[_0xc9c1('0x38')]=_[_0xc9c1('0x39')](_0xa107[_0xc9c1('0x38')]);_0x4a76c8[_0xc9c1('0x3a')]=_[_0xc9c1('0x3b')](_0x4a76c8['model'],_0x4a76c8[_0xc9c1('0x38')]);_0x1ad7ee[_0xc9c1('0x3d')]=_[_0xc9c1('0x3b')](_0x4a76c8['model'],qs[_0xc9c1('0x3e')](_0xa107[_0xc9c1('0x38')][_0xc9c1('0x3e')]));_0x1ad7ee['attributes']=_0x1ad7ee['attributes'][_0xc9c1('0x3f')]?_0x1ad7ee[_0xc9c1('0x3d')]:_0x4a76c8[_0xc9c1('0x3c')];_0x1ad7ee[_0xc9c1('0x40')]=qs[_0xc9c1('0x41')](_0xa107[_0xc9c1('0x38')][_0xc9c1('0x41')]);_0x1ad7ee[_0xc9c1('0x42')]=qs[_0xc9c1('0x3a')](_[_0xc9c1('0x43')](_0xa107[_0xc9c1('0x38')],_0x4a76c8[_0xc9c1('0x3a')]));if(_0xa107[_0xc9c1('0x38')][_0xc9c1('0x44')]){_0x1ad7ee['where']=_[_0xc9c1('0x45')](_0x1ad7ee[_0xc9c1('0x42')],{'$or':_[_0xc9c1('0x37')](_0x1ad7ee[_0xc9c1('0x3d')],function(_0x270274){var _0x180bd3={};_0x180bd3[_0x270274]={'$like':'%'+_0xa107['query'][_0xc9c1('0x44')]+'%'};return _0x180bd3;})});}_0x1ad7ee=_['merge']({},_0x1ad7ee,_0xa107[_0xc9c1('0x47')]);return _0x37eb6f[_0xc9c1('0x69')](_0x1ad7ee);}})[_0xc9c1('0x18')](function(_0x249279){if(_0x249279){_0x233545=_0x249279['length'];if(!_0xa107[_0xc9c1('0x38')]['hasOwnProperty'](_0xc9c1('0x5b'))){_0x1ad7ee[_0xc9c1('0x28')]=qs['limit'](_0xa107[_0xc9c1('0x38')][_0xc9c1('0x28')]);_0x1ad7ee['offset']=qs[_0xc9c1('0x2a')](_0xa107[_0xc9c1('0x38')][_0xc9c1('0x2a')]);}return _0x37eb6f[_0xc9c1('0x69')](_0x1ad7ee);}})[_0xc9c1('0x18')](function(_0x4c563c){if(_0x4c563c){return _0x4c563c?{'count':_0x233545,'rows':_0x4c563c}:null;}})[_0xc9c1('0x18')](respondWithResult(_0x26972b,null))['catch'](handleError(_0x26972b,null));};exports['addApplications']=function(_0x31fb6c,_0x5dff8c,_0x29655d){return db['WhatsappAccount'][_0xc9c1('0x59')]({'where':{'id':_0x31fb6c[_0xc9c1('0x4c')]['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x5dff8c,null))['then'](function(_0x297764){if(_0x297764){return db['sequelize']['transaction'](function(_0x1ba31e){return db[_0xc9c1('0x6b')]['destroy']({'where':{'WhatsappAccountId':_0x31fb6c[_0xc9c1('0x4c')]['id']},'transaction':_0x1ba31e})[_0xc9c1('0x18')](function(_0x5b597d){var _0xd3b5ee=_[_0xc9c1('0x37')](_0x31fb6c[_0xc9c1('0x50')],function(_0x9b063e){_0x9b063e[_0xc9c1('0x58')]=_0x31fb6c[_0xc9c1('0x4c')]['id'];return _0x9b063e;});return db['WhatsappApplication'][_0xc9c1('0x6c')](_0xd3b5ee,{'transaction':_0x1ba31e});});})['then'](function(){return db['WhatsappApplication'][_0xc9c1('0x6d')]({'where':{'WhatsappAccountId':_0x31fb6c[_0xc9c1('0x4c')]['id']},'order':_0xc9c1('0x6e')});});}})[_0xc9c1('0x18')](respondWithResult(_0x5dff8c,null))[_0xc9c1('0x22')](handleError(_0x5dff8c,null));};exports[_0xc9c1('0x6f')]=function(_0x1d52f8,_0x4c5a3b,_0x2b3797){var _0x3b21e4={};var _0x14497f={};var _0x3c3e16;var _0x50a7c3;return db[_0xc9c1('0x48')]['findOne']({'where':{'id':_0x1d52f8[_0xc9c1('0x4c')]['id']}})[_0xc9c1('0x18')](handleEntityNotFound(_0x4c5a3b,null))[_0xc9c1('0x18')](function(_0x2182cc){if(_0x2182cc){_0x3c3e16=_0x2182cc;_0x14497f['model']=_[_0xc9c1('0x39')](db[_0xc9c1('0x6b')]['rawAttributes']);_0x14497f[_0xc9c1('0x38')]=_['keys'](_0x1d52f8['query']);_0x14497f[_0xc9c1('0x3a')]=_[_0xc9c1('0x3b')](_0x14497f[_0xc9c1('0x3c')],_0x14497f['query']);_0x3b21e4[_0xc9c1('0x3d')]=_[_0xc9c1('0x3b')](_0x14497f[_0xc9c1('0x3c')],qs[_0xc9c1('0x3e')](_0x1d52f8[_0xc9c1('0x38')][_0xc9c1('0x3e')]));_0x3b21e4[_0xc9c1('0x3d')]=_0x3b21e4[_0xc9c1('0x3d')][_0xc9c1('0x3f')]?_0x3b21e4[_0xc9c1('0x3d')]:_0x14497f[_0xc9c1('0x3c')];_0x3b21e4[_0xc9c1('0x40')]=qs[_0xc9c1('0x41')](_0x1d52f8['query']['sort']);_0x3b21e4[_0xc9c1('0x42')]=qs['filters'](_[_0xc9c1('0x43')](_0x1d52f8[_0xc9c1('0x38')],_0x14497f['filters']));if(_0x1d52f8[_0xc9c1('0x38')][_0xc9c1('0x44')]){_0x3b21e4[_0xc9c1('0x42')]=_[_0xc9c1('0x45')](_0x3b21e4[_0xc9c1('0x42')],{'$or':_['map'](_0x3b21e4[_0xc9c1('0x3d')],function(_0xc4055f){var _0x36e8f5={};_0x36e8f5[_0xc4055f]={'$like':'%'+_0x1d52f8[_0xc9c1('0x38')][_0xc9c1('0x44')]+'%'};return _0x36e8f5;})});}_0x3b21e4=_['merge']({},_0x3b21e4,_0x1d52f8[_0xc9c1('0x47')]);return _0x3c3e16[_0xc9c1('0x6f')](_0x3b21e4);}})[_0xc9c1('0x18')](function(_0x241724){if(_0x241724){_0x50a7c3=_0x241724['length'];if(!_0x1d52f8[_0xc9c1('0x38')]['hasOwnProperty'](_0xc9c1('0x5b'))){_0x3b21e4[_0xc9c1('0x28')]=qs[_0xc9c1('0x28')](_0x1d52f8[_0xc9c1('0x38')][_0xc9c1('0x28')]);_0x3b21e4[_0xc9c1('0x2a')]=qs['offset'](_0x1d52f8[_0xc9c1('0x38')][_0xc9c1('0x2a')]);}return _0x3c3e16[_0xc9c1('0x6f')](_0x3b21e4);}})[_0xc9c1('0x18')](function(_0xccd735){if(_0xccd735){return _0xccd735?{'count':_0x50a7c3,'rows':_0xccd735}:null;}})[_0xc9c1('0x18')](respondWithResult(_0x4c5a3b,null))['catch'](handleError(_0x4c5a3b,null));};exports[_0xc9c1('0x70')]=function(_0x4ea4b7,_0x16cf5d,_0x1d121d){var _0x33e74b={'channel':_0xc9c1('0x71')};var _0x447a36=[];var _0xe199fb=[];var _0x3dc4cd={};return db[_0xc9c1('0x48')][_0xc9c1('0x4e')]({'where':{'id':_0x4ea4b7[_0xc9c1('0x4c')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xc9c1('0x72')}]})[_0xc9c1('0x18')](handleEntityNotFound(_0x16cf5d,null))[_0xc9c1('0x18')](function(_0x59a9cc){_0x33e74b[_0xc9c1('0x73')]=_0x59a9cc;_0x33e74b[_0xc9c1('0x74')]=_[_0xc9c1('0x75')](_0x59a9cc[_0xc9c1('0x72')],['priority'],[_0xc9c1('0x76')]);if(_0x33e74b['account'][_0xc9c1('0x72')]){delete _0x33e74b[_0xc9c1('0x73')]['Applications'];}return db[_0xc9c1('0x77')][_0xc9c1('0x57')]();})[_0xc9c1('0x18')](function(_0xeaf486){if(!_0xeaf486){throw new db['Sequelize'][(_0xc9c1('0x78'))](_0xc9c1('0x79'));}_0x447a36=_['difference'](_[_0xc9c1('0x39')](_0xeaf486),['createdAt',_0xc9c1('0x7a')]);_0xe199fb=_[_0xc9c1('0x7b')](_['keys'](_0xeaf486),['createdAt',_0xc9c1('0x7a'),_0xc9c1('0x7c'),_0xc9c1('0x7d')]);_0x33e74b[_0xc9c1('0x50')]={'mapKey':_0xc9c1('0x7e')};if(_0x33e74b[_0xc9c1('0x73')][_0xc9c1('0x35')]&&_0x33e74b[_0xc9c1('0x73')][_0xc9c1('0x35')]===_0xc9c1('0x7f')){_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x80')]=_0x4ea4b7[_0xc9c1('0x50')]['From'][_0xc9c1('0x81')](_0xc9c1('0x82'),'');_0x33e74b['body'][_0xc9c1('0x50')]=_0x4ea4b7[_0xc9c1('0x50')]['Body'];_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x83')]=_0x4ea4b7[_0xc9c1('0x50')][_0xc9c1('0x84')];}if(_0x33e74b[_0xc9c1('0x50')]['id']){delete _0x33e74b[_0xc9c1('0x50')]['id'];}if(_[_0xc9c1('0x85')](_0x33e74b[_0xc9c1('0x50')]['from'])){throw new db['Sequelize'][(_0xc9c1('0x78'))](_0xc9c1('0x86'));}if(_[_0xc9c1('0x85')](_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x50')])||_0x33e74b[_0xc9c1('0x50')]['body']===''){throw new db[(_0xc9c1('0x87'))][(_0xc9c1('0x78'))](_0xc9c1('0x88'));}if(_[_0xc9c1('0x85')](_0x33e74b['body']['mapKey'])){throw new db[(_0xc9c1('0x87'))][(_0xc9c1('0x78'))](_0xc9c1('0x89')+_0xe199fb);}if(!_[_0xc9c1('0x8a')](_0xe199fb,_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x8b')])){throw new db[(_0xc9c1('0x87'))][(_0xc9c1('0x78'))](_0xc9c1('0x8c')+_0xe199fb);}_0x3dc4cd[_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x8b')]]=_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x80')];return db[_0xc9c1('0x8d')][_0xc9c1('0x4e')]({'where':{'id':_0x33e74b[_0xc9c1('0x73')][_0xc9c1('0x7d')]},'include':[{'model':db[_0xc9c1('0x77')],'as':_0xc9c1('0x8e'),'where':_0x3dc4cd,'limit':0x1,'order':[[_0xc9c1('0x7a'),_0xc9c1('0x8f')]]}]});})[_0xc9c1('0x18')](handleEntityNotFound(_0x16cf5d,null))[_0xc9c1('0x18')](function(_0x4112fd){if(_0x4112fd){_0x33e74b[_0xc9c1('0x90')]=_['omit'](_0x4112fd,[_0xc9c1('0x8e')]);if(_0x4112fd['Contacts']['length']){return _0x4112fd[_0xc9c1('0x8e')][0x0];}var _0xc3cef2=_[_0xc9c1('0x91')](_0x33e74b[_0xc9c1('0x50')],{'firstName':_0x33e74b['body'][_0xc9c1('0x80')],'ListId':_0x4112fd['id']});_0xc3cef2[_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x8b')]]=_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x80')];return db['CmContact']['create'](_0xc3cef2,{'fields':_0x447a36,'raw':!![]});}})[_0xc9c1('0x18')](handleEntityNotFound(_0x16cf5d,null))[_0xc9c1('0x18')](function(_0x2a0d9c){if(_0x2a0d9c){_0x33e74b[_0xc9c1('0x92')]=_0x2a0d9c;var _0x31160d={'ContactId':_0x2a0d9c['id'],'phone':_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x80')],'WhatsappAccountId':_0x4ea4b7[_0xc9c1('0x4c')]['id']};var _0x178200={'ContactId':_0x2a0d9c['id'],'WhatsappAccountId':_0x4ea4b7[_0xc9c1('0x4c')]['id'],'closed':![]};return db[_0xc9c1('0x93')][_0xc9c1('0x4e')]({'where':_0x178200})[_0xc9c1('0x18')](function(_0x1d4f4a){if(_0x1d4f4a){return[_0x1d4f4a,![]];}return db[_0xc9c1('0x93')][_0xc9c1('0x4f')](_0x31160d)[_0xc9c1('0x18')](function(_0xd0f17d){return[_0xd0f17d,!![]];});});}})['spread'](function(_0x112be6,_0x340277){_0x33e74b[_0xc9c1('0x94')]=_0x112be6[_0xc9c1('0x2e')]({'plain':!![]});_0x33e74b[_0xc9c1('0x94')][_0xc9c1('0x95')]=![];if(_0x340277){if(_0x33e74b['account'][_0xc9c1('0x96')]){_0x33e74b[_0xc9c1('0x74')][_0xc9c1('0x97')]({'id':0x0,'priority':_0x33e74b[_0xc9c1('0x74')][_0xc9c1('0x3f')]+0x1,'app':_0xc9c1('0x98'),'appdata':'unmanaged','interval':_0xc9c1('0x99')});}_0x33e74b['interaction'][_0xc9c1('0x95')]=!![];}return db['WhatsappMessage']['create']({'phone':_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x80')],'messageId':_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x83')],'body':_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x50')],'WhatsappAccountId':_0x4ea4b7[_0xc9c1('0x4c')]['id'],'WhatsappInteractionId':_0x112be6['id'],'direction':'in','ContactId':_0x112be6[_0xc9c1('0x9a')],'AttachmentId':_0x33e74b[_0xc9c1('0x50')][_0xc9c1('0x9b')]});})[_0xc9c1('0x18')](function(_0x5063a0){_0x33e74b[_0xc9c1('0x20')]=_0x5063a0;if(_0x33e74b[_0xc9c1('0x94')][_0xc9c1('0x9c')]){return db[_0xc9c1('0x6a')]['find']({'attributes':['id',_0xc9c1('0x31')],'where':{'id':_0x33e74b['interaction'][_0xc9c1('0x9c')]}})[_0xc9c1('0x18')](function(_0x45e9ac){if(_0x45e9ac){_0x33e74b['applications'][_0xc9c1('0x9d')]({'id':0x0,'priority':0x0,'app':_0xc9c1('0x9e'),'appdata':_0x45e9ac[_0xc9c1('0x31')]+','+(_0x33e74b[_0xc9c1('0x73')][_0xc9c1('0x9f')]||0xa),'interval':_0xc9c1('0x99')});}return respondWithRpcPromise(_0xc9c1('0xa0'),_0xc9c1('0xa1'),_0x33e74b);});}return respondWithRpcPromise(_0xc9c1('0xa0'),_0xc9c1('0xa1'),_0x33e74b);})[_0xc9c1('0x18')](function(_0x531972){if(_0x531972){var _0x78c607=0xc8;var _0x2599d7='receiveMessage';logger[_0xc9c1('0x19')](_0xc9c1('0x1d'),_0x2599d7,_0x78c607,_0xc9c1('0xa2'));logger[_0xc9c1('0x1c')](_0xc9c1('0xa3'),_0x2599d7,_0x78c607,_0xc9c1('0xa2'),JSON[_0xc9c1('0x1e')](_0x531972));if(_0x33e74b[_0xc9c1('0x73')][_0xc9c1('0x35')]==='twilio'){return _0x16cf5d[_0xc9c1('0x24')](_0x78c607)['set'](_0xc9c1('0xa4'),_0xc9c1('0xa5'))[_0xc9c1('0xa6')]('\x0a');}else{return _0x16cf5d[_0xc9c1('0x24')](_0x78c607)['json'](_0x531972);}}})[_0xc9c1('0x22')](handleError(_0x16cf5d,null));};exports[_0xc9c1('0xa6')]=function(_0x2ca6f1,_0x3cec08,_0x149355){var _0x5e684c,_0x342489,_0x1b01a4;if(_['isNil'](_0x2ca6f1[_0xc9c1('0x50')][_0xc9c1('0x50')])||_0x2ca6f1[_0xc9c1('0x50')][_0xc9c1('0x50')]===''){throw new db[(_0xc9c1('0x87'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xc9c1('0x85')](_0x2ca6f1['body']['to'])){throw new db[(_0xc9c1('0x87'))][(_0xc9c1('0x78'))](_0xc9c1('0xa7'));}_0x5e684c=_0x2ca6f1[_0xc9c1('0x50')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x2ca6f1[_0xc9c1('0x4c')]['id']},'include':[{'model':db[_0xc9c1('0x8d')],'as':_0xc9c1('0xa8'),'include':[{'model':db[_0xc9c1('0x77')],'as':_0xc9c1('0x8e'),'where':{'mobile':_0x5e684c},'limit':0x1,'order':[[_0xc9c1('0x7a'),_0xc9c1('0x8f')]]}]}]})['then'](handleEntityNotFound(_0x3cec08,null))[_0xc9c1('0x18')](function(_0x439d65){if(_0x439d65&&_0x439d65[_0xc9c1('0xa8')]){_0x342489=_0x439d65[_0xc9c1('0x2e')]({'plain':!![]});if(_0x342489[_0xc9c1('0xa8')]&&_0x342489[_0xc9c1('0xa8')]['Contacts'][_0xc9c1('0x3f')]){return _0x342489[_0xc9c1('0xa8')][_0xc9c1('0x8e')][0x0];}return db['CmContact']['create'](_['defaults'](_0x2ca6f1[_0xc9c1('0x50')],{'firstName':_0x5e684c,'mobile':_0x5e684c,'phone':_0x5e684c,'ListId':_0x342489[_0xc9c1('0x7d')]}));}})[_0xc9c1('0x18')](handleEntityNotFound(_0x3cec08,null))[_0xc9c1('0x18')](function(_0x3d4674){if(_0x3d4674){_0x1b01a4=_0x3d4674;return db['WhatsappInteraction'][_0xc9c1('0x4e')]({'where':{'ContactId':_0x1b01a4['id'],'closed':![],'WhatsappAccountId':_0x342489['id']}})[_0xc9c1('0x18')](function(_0x1dd41b){if(_0x1dd41b){return[_0x1dd41b,![]];}return db[_0xc9c1('0x93')][_0xc9c1('0x4f')]({'UserId':_0x2ca6f1[_0xc9c1('0x51')]['id'],'ContactId':_0x1b01a4['id'],'WhatsappAccountId':_0x342489['id'],'phone':_0x5e684c,'firstMsgDirection':_0xc9c1('0xa9'),'Messages':[_[_0xc9c1('0x45')](_0x2ca6f1[_0xc9c1('0x50')],{'read':![],'body':_0x2ca6f1['body'][_0xc9c1('0x50')],'phone':_0x5e684c,'WhatsappAccountId':_0x342489['id'],'UserId':_0x2ca6f1[_0xc9c1('0x51')]['id'],'ContactId':_0x1b01a4['id']})]},{'include':[{'model':db[_0xc9c1('0xaa')],'as':_0xc9c1('0xab')}]})[_0xc9c1('0x18')](function(_0x1df475){return[_0x1df475,!![]];});});}})[_0xc9c1('0xac')](function(_0x4c4ae8,_0x1886db){if(_0x1886db){return _0x4c4ae8;}return db['WhatsappMessage'][_0xc9c1('0x4f')](_[_0xc9c1('0x45')](_0x2ca6f1[_0xc9c1('0x50')],{'read':![],'body':_0x2ca6f1['body'][_0xc9c1('0x50')],'phone':_0x5e684c,'WhatsappAccountId':_0x342489['id'],'WhatsappInteractionId':_0x4c4ae8['id'],'UserId':_0x2ca6f1[_0xc9c1('0x51')]['id'],'ContactId':_0x1b01a4['id']}))[_0xc9c1('0x18')](function(_0x440e9d){_0x4c4ae8[_0xc9c1('0xad')][_0xc9c1('0xab')]=[];_0x4c4ae8[_0xc9c1('0xad')][_0xc9c1('0xab')][_0xc9c1('0x97')](_0x440e9d[_0xc9c1('0xad')]);return _0x4c4ae8;});})[_0xc9c1('0x18')](respondWithResult(_0x3cec08,null))['catch'](handleError(_0x3cec08,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 0192ea7..ed2ea4d 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 _0xad8d=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2f83aa,_0x281c78){var _0x2523d6=function(_0x54daa0){while(--_0x54daa0){_0x2f83aa['push'](_0x2f83aa['shift']());}};_0x2523d6(++_0x281c78);}(_0xad8d,0x15c));var _0xdad8=function(_0xa36880,_0x23084c){_0xa36880=_0xa36880-0x0;var _0x55e0d3=_0xad8d[_0xa36880];return _0x55e0d3;};'use strict';var EventEmitter=require(_0xdad8('0x0'));var WhatsappAccount=require(_0xdad8('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xdad8('0x2')](0x0);var events={'afterCreate':_0xdad8('0x3'),'afterUpdate':_0xdad8('0x4'),'afterDestroy':_0xdad8('0x5')};function emitEvent(_0x55270b){return function(_0x5fd113,_0x50c172,_0x587957){WhatsappAccountEvents[_0xdad8('0x6')](_0x55270b+':'+_0x5fd113['id'],_0x5fd113);WhatsappAccountEvents[_0xdad8('0x6')](_0x55270b,_0x5fd113);_0x587957(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xdad8('0x7')](e,emitEvent(event));}}module[_0xdad8('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xf921=['WhatsappAccount','save','update','emit','hasOwnProperty'];(function(_0x5cd282,_0x31a3a6){var _0x37929a=function(_0x2c587c){while(--_0x2c587c){_0x5cd282['push'](_0x5cd282['shift']());}};_0x37929a(++_0x31a3a6);}(_0xf921,0x1c7));var _0x1f92=function(_0x5622d4,_0x396780){_0x5622d4=_0x5622d4-0x0;var _0x353176=_0xf921[_0x5622d4];return _0x353176;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x1f92('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1f92('0x1'),'afterUpdate':_0x1f92('0x2'),'afterDestroy':'remove'};function emitEvent(_0x5a2028){return function(_0x49ef7a,_0xef7d18,_0x54efa9){WhatsappAccountEvents['emit'](_0x5a2028+':'+_0x49ef7a['id'],_0x49ef7a);WhatsappAccountEvents[_0x1f92('0x3')](_0x5a2028,_0x49ef7a);_0x54efa9(null);};}for(var e in events){if(events[_0x1f92('0x4')](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 8ef97cf..c14c62c 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 _0x0b4f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','../../config/logger'];(function(_0x250fab,_0x5b4baf){var _0x45b46b=function(_0x5a639e){while(--_0x5a639e){_0x250fab['push'](_0x250fab['shift']());}};_0x45b46b(++_0x5b4baf);}(_0x0b4f,0x16a));var _0xf0b4=function(_0xcb6143,_0x11f4dc){_0xcb6143=_0xcb6143-0x0;var _0xac2fb6=_0x0b4f[_0xcb6143];return _0xac2fb6;};'use strict';var _=require(_0xf0b4('0x0'));var util=require('util');var logger=require(_0xf0b4('0x1'))(_0xf0b4('0x2'));var moment=require(_0xf0b4('0x3'));var BPromise=require(_0xf0b4('0x4'));var rp=require(_0xf0b4('0x5'));var fs=require('fs');var path=require(_0xf0b4('0x6'));var rimraf=require(_0xf0b4('0x7'));var config=require(_0xf0b4('0x8'));var attributes=require(_0xf0b4('0x9'));module[_0xf0b4('0xa')]=function(_0x2d9299,_0x16485c){return _0x2d9299[_0xf0b4('0xb')]('WhatsappAccount',attributes,{'tableName':_0xf0b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeed5=['request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','api','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeed5,0xee));var _0x5eed=function(_0x37d754,_0x4aaf27){_0x37d754=_0x37d754-0x0;var _0x378b70=_0xeed5[_0x37d754];return _0x378b70;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5eed('0x0'));var moment=require('moment');var BPromise=require(_0x5eed('0x1'));var rp=require(_0x5eed('0x2'));var fs=require('fs');var path=require(_0x5eed('0x3'));var rimraf=require(_0x5eed('0x4'));var config=require(_0x5eed('0x5'));var attributes=require(_0x5eed('0x6'));module[_0x5eed('0x7')]=function(_0x43388b,_0x389fbd){return _0x43388b['define']('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 0aef7a9..8998b05 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 _0x7e5c=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','include','map','model','attributes','stringify','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info'];(function(_0x330ca0,_0x363537){var _0x23ab97=function(_0x472a89){while(--_0x472a89){_0x330ca0['push'](_0x330ca0['shift']());}};_0x23ab97(++_0x363537);}(_0x7e5c,0xc6));var _0xc7e5=function(_0x4169d5,_0x20c845){_0x4169d5=_0x4169d5-0x0;var _0x10f11f=_0x7e5c[_0x4169d5];return _0x10f11f;};'use strict';var _=require(_0xc7e5('0x0'));var util=require('util');var moment=require(_0xc7e5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc7e5('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc7e5('0x3'));var logger=require(_0xc7e5('0x4'))(_0xc7e5('0x5'));var config=require('../../config/environment');var jayson=require(_0xc7e5('0x6'));var client=jayson[_0xc7e5('0x7')][_0xc7e5('0x8')]({'port':0x232a});config['redis']=_[_0xc7e5('0x9')](config[_0xc7e5('0xa')],{'host':_0xc7e5('0xb'),'port':0x18eb});var socket=require(_0xc7e5('0xc'))(new Redis(config['redis']));require(_0xc7e5('0xd'))[_0xc7e5('0xe')](socket);function respondWithRpcPromise(_0x23d506,_0x2d9f56,_0x351966){return new BPromise(function(_0x2aaea9,_0x5d0690){return client[_0xc7e5('0xf')](_0x23d506,_0x351966)[_0xc7e5('0x10')](function(_0x924e53){logger[_0xc7e5('0x11')](_0xc7e5('0x12'),_0x2d9f56,_0xc7e5('0x13'));logger[_0xc7e5('0x14')](_0xc7e5('0x15'),_0x2d9f56,_0xc7e5('0x13'),JSON['stringify'](_0x924e53));if(_0x924e53[_0xc7e5('0x16')]){if(_0x924e53[_0xc7e5('0x16')]['code']===0x1f4){logger['error'](_0xc7e5('0x12'),_0x2d9f56,_0x924e53['error']['message']);return _0x5d0690(_0x924e53[_0xc7e5('0x16')][_0xc7e5('0x17')]);}logger['error'](_0xc7e5('0x12'),_0x2d9f56,_0x924e53['error'][_0xc7e5('0x17')]);return _0x2aaea9(_0x924e53[_0xc7e5('0x16')][_0xc7e5('0x17')]);}else{logger[_0xc7e5('0x11')](_0xc7e5('0x12'),_0x2d9f56,_0xc7e5('0x13'));_0x2aaea9(_0x924e53[_0xc7e5('0x18')][_0xc7e5('0x17')]);}})[_0xc7e5('0x19')](function(_0x265bb7){logger[_0xc7e5('0x16')](_0xc7e5('0x12'),_0x2d9f56,_0x265bb7);_0x5d0690(_0x265bb7);});});}exports[_0xc7e5('0x1a')]=function(_0x2786b9){var _0x3c1580=this;return new Promise(function(_0x5ab28c,_0x5a95ee){return db[_0xc7e5('0x1b')]['find']({'raw':_0x2786b9[_0xc7e5('0x1c')]?_0x2786b9[_0xc7e5('0x1c')][_0xc7e5('0x1d')]===undefined?!![]:![]:!![],'where':_0x2786b9[_0xc7e5('0x1c')]?_0x2786b9['options'][_0xc7e5('0x1e')]||null:null,'attributes':_0x2786b9['options']?_0x2786b9[_0xc7e5('0x1c')]['attributes']||null:null,'include':_0x2786b9[_0xc7e5('0x1c')]?_0x2786b9[_0xc7e5('0x1c')][_0xc7e5('0x1f')]?_[_0xc7e5('0x20')](_0x2786b9[_0xc7e5('0x1c')][_0xc7e5('0x1f')],function(_0x541c84){return{'model':db[_0x541c84['model']],'as':_0x541c84['as'],'attributes':_0x541c84['attributes'],'include':_0x541c84[_0xc7e5('0x1f')]?_[_0xc7e5('0x20')](_0x541c84[_0xc7e5('0x1f')],function(_0x207023){return{'model':db[_0x207023[_0xc7e5('0x21')]],'as':_0x207023['as'],'attributes':_0x207023[_0xc7e5('0x22')],'include':_0x207023[_0xc7e5('0x1f')]?_[_0xc7e5('0x20')](_0x207023['include'],function(_0x2c5645){return{'model':db[_0x2c5645[_0xc7e5('0x21')]],'as':_0x2c5645['as'],'attributes':_0x2c5645[_0xc7e5('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc7e5('0x10')](function(_0x3ab6a2){logger['info'](_0xc7e5('0x1a'),_0x2786b9);logger[_0xc7e5('0x14')](_0xc7e5('0x1a'),_0x2786b9,JSON[_0xc7e5('0x23')](_0x3ab6a2));_0x5ab28c(_0x3ab6a2);})['catch'](function(_0x3632f9){logger[_0xc7e5('0x16')](_0xc7e5('0x1a'),_0x3632f9[_0xc7e5('0x17')],_0x2786b9);_0x5a95ee(_0x3c1580[_0xc7e5('0x16')](0x1f4,_0x3632f9[_0xc7e5('0x17')]));});});}; \ No newline at end of file +var _0xeeff=['info','request\x20sent','debug','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','include','map','model','attributes','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','then'];(function(_0x4b1974,_0x30108e){var _0x4585f0=function(_0x598332){while(--_0x598332){_0x4b1974['push'](_0x4b1974['shift']());}};_0x4585f0(++_0x30108e);}(_0xeeff,0x12b));var _0xfeef=function(_0x11746d,_0x9e53a6){_0x11746d=_0x11746d-0x0;var _0xc0044c=_0xeeff[_0x11746d];return _0xc0044c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfeef('0x0'));var BPromise=require(_0xfeef('0x1'));var rs=require(_0xfeef('0x2'));var fs=require('fs');var Redis=require(_0xfeef('0x3'));var db=require(_0xfeef('0x4'))['db'];var utils=require(_0xfeef('0x5'));var logger=require(_0xfeef('0x6'))(_0xfeef('0x7'));var config=require(_0xfeef('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfeef('0x9')]({'port':0x232a});config[_0xfeef('0xa')]=_[_0xfeef('0xb')](config[_0xfeef('0xa')],{'host':_0xfeef('0xc'),'port':0x18eb});var socket=require(_0xfeef('0xd'))(new Redis(config[_0xfeef('0xa')]));require(_0xfeef('0xe'))['register'](socket);function respondWithRpcPromise(_0x382326,_0x134c34,_0x5a7a0f){return new BPromise(function(_0x33d4d3,_0x41cbf3){return client['request'](_0x382326,_0x5a7a0f)[_0xfeef('0xf')](function(_0x168b77){logger[_0xfeef('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x134c34,_0xfeef('0x11'));logger[_0xfeef('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x134c34,'request\x20sent',JSON[_0xfeef('0x13')](_0x168b77));if(_0x168b77[_0xfeef('0x14')]){if(_0x168b77[_0xfeef('0x14')][_0xfeef('0x15')]===0x1f4){logger[_0xfeef('0x14')](_0xfeef('0x16'),_0x134c34,_0x168b77[_0xfeef('0x14')][_0xfeef('0x17')]);return _0x41cbf3(_0x168b77['error'][_0xfeef('0x17')]);}logger['error'](_0xfeef('0x16'),_0x134c34,_0x168b77['error'][_0xfeef('0x17')]);return _0x33d4d3(_0x168b77[_0xfeef('0x14')][_0xfeef('0x17')]);}else{logger[_0xfeef('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x134c34,_0xfeef('0x11'));_0x33d4d3(_0x168b77[_0xfeef('0x18')][_0xfeef('0x17')]);}})[_0xfeef('0x19')](function(_0x1861fe){logger[_0xfeef('0x14')](_0xfeef('0x16'),_0x134c34,_0x1861fe);_0x41cbf3(_0x1861fe);});});}exports[_0xfeef('0x1a')]=function(_0x542357){var _0x232cfb=this;return new Promise(function(_0xf671ea,_0x55586e){return db[_0xfeef('0x1b')][_0xfeef('0x1c')]({'raw':_0x542357['options']?_0x542357[_0xfeef('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x542357[_0xfeef('0x1d')]?_0x542357[_0xfeef('0x1d')][_0xfeef('0x1e')]||null:null,'attributes':_0x542357[_0xfeef('0x1d')]?_0x542357[_0xfeef('0x1d')]['attributes']||null:null,'include':_0x542357[_0xfeef('0x1d')]?_0x542357['options'][_0xfeef('0x1f')]?_[_0xfeef('0x20')](_0x542357['options'][_0xfeef('0x1f')],function(_0x2b0b77){return{'model':db[_0x2b0b77[_0xfeef('0x21')]],'as':_0x2b0b77['as'],'attributes':_0x2b0b77['attributes'],'include':_0x2b0b77['include']?_[_0xfeef('0x20')](_0x2b0b77[_0xfeef('0x1f')],function(_0x17a869){return{'model':db[_0x17a869[_0xfeef('0x21')]],'as':_0x17a869['as'],'attributes':_0x17a869['attributes'],'include':_0x17a869['include']?_['map'](_0x17a869[_0xfeef('0x1f')],function(_0x25c8f8){return{'model':db[_0x25c8f8['model']],'as':_0x25c8f8['as'],'attributes':_0x25c8f8[_0xfeef('0x22')]};}):[]};}):[]};}):[]:[]})[_0xfeef('0xf')](function(_0x5c836b){logger[_0xfeef('0x10')](_0xfeef('0x1a'),_0x542357);logger[_0xfeef('0x12')](_0xfeef('0x1a'),_0x542357,JSON[_0xfeef('0x13')](_0x5c836b));_0xf671ea(_0x5c836b);})[_0xfeef('0x19')](function(_0x991f55){logger['error'](_0xfeef('0x1a'),_0x991f55[_0xfeef('0x17')],_0x542357);_0x55586e(_0x232cfb[_0xfeef('0x14')](0x1f4,_0x991f55['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5087f14..98812f9 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 _0x127c=['update','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x127c,0x19b));var _0xc127=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x127c[_0x2641f9];return _0x585741;};'use strict';var WhatsappAccountEvents=require(_0xc127('0x0'));var events=[_0xc127('0x1'),'remove',_0xc127('0x2')];function createListener(_0xbf1d25,_0x2fafbb){return function(_0x3eae1d){_0x2fafbb['emit'](_0xbf1d25,_0x3eae1d);};}function removeListener(_0x194aa1,_0x45b2db){return function(){WhatsappAccountEvents[_0xc127('0x3')](_0x194aa1,_0x45b2db);};}exports[_0xc127('0x4')]=function(_0x28c72e){for(var _0x4688a9=0x0,_0x105b44=events[_0xc127('0x5')];_0x4688a9<_0x105b44;_0x4688a9++){var _0x4859a4=events[_0x4688a9];var _0x9f8068=createListener(_0xc127('0x6')+_0x4859a4,_0x28c72e);WhatsappAccountEvents['on'](_0x4859a4,_0x9f8068);}}; \ No newline at end of file +var _0x6587=['save','remove','emit','removeListener','register','length','whatsappAccount:'];(function(_0x266563,_0x4cc4a6){var _0x273a89=function(_0x476554){while(--_0x476554){_0x266563['push'](_0x266563['shift']());}};_0x273a89(++_0x4cc4a6);}(_0x6587,0x1e3));var _0x7658=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6587[_0x138adb];return _0x1b27f2;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x7658('0x0'),_0x7658('0x1'),'update'];function createListener(_0x37740f,_0x420eb3){return function(_0x11403f){_0x420eb3[_0x7658('0x2')](_0x37740f,_0x11403f);};}function removeListener(_0x523405,_0x1ad32b){return function(){WhatsappAccountEvents[_0x7658('0x3')](_0x523405,_0x1ad32b);};}exports[_0x7658('0x4')]=function(_0x2de0f4){for(var _0x27bf81=0x0,_0x3e7594=events[_0x7658('0x5')];_0x27bf81<_0x3e7594;_0x27bf81++){var _0x5e12a8=events[_0x27bf81];var _0x4dc898=createListener(_0x7658('0x6')+_0x5e12a8,_0x2de0f4);WhatsappAccountEvents['on'](_0x5e12a8,_0x4dc898);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index e51bfb9..dafafa7 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 _0x240e=['get','index','/:id','isAuthenticated','show','create','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller'];(function(_0x252f30,_0x3fb75a){var _0x2b9909=function(_0x11fc96){while(--_0x11fc96){_0x252f30['push'](_0x252f30['shift']());}};_0x2b9909(++_0x3fb75a);}(_0x240e,0x173));var _0xe240=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x240e[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xe240('0x0'));var util=require('util');var path=require(_0xe240('0x1'));var timeout=require(_0xe240('0x2'));var express=require('express');var router=express[_0xe240('0x3')]();var fs_extra=require(_0xe240('0x4'));var auth=require(_0xe240('0x5'));var interaction=require(_0xe240('0x6'));var config=require(_0xe240('0x7'));var controller=require(_0xe240('0x8'));router[_0xe240('0x9')]('/',auth['isAuthenticated'](),controller[_0xe240('0xa')]);router[_0xe240('0x9')](_0xe240('0xb'),auth[_0xe240('0xc')](),controller[_0xe240('0xd')]);router['post']('/',auth[_0xe240('0xc')](),controller[_0xe240('0xe')]);router[_0xe240('0xf')]('/:id',auth[_0xe240('0xc')](),controller['update']);router[_0xe240('0x10')](_0xe240('0xb'),auth['isAuthenticated'](),controller[_0xe240('0x11')]);module[_0xe240('0x12')]=router; \ No newline at end of file +var _0x93ec=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./whatsappApplication.controller','get','isAuthenticated','index','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x93ec,0x103));var _0xc93e=function(_0x47b4ba,_0x4b1e91){_0x47b4ba=_0x47b4ba-0x0;var _0x2204a9=_0x93ec[_0x47b4ba];return _0x2204a9;};'use strict';var multer=require(_0xc93e('0x0'));var util=require(_0xc93e('0x1'));var path=require(_0xc93e('0x2'));var timeout=require(_0xc93e('0x3'));var express=require('express');var router=express[_0xc93e('0x4')]();var fs_extra=require(_0xc93e('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc93e('0x6'));router[_0xc93e('0x7')]('/',auth[_0xc93e('0x8')](),controller[_0xc93e('0x9')]);router[_0xc93e('0x7')](_0xc93e('0xa'),auth[_0xc93e('0x8')](),controller[_0xc93e('0xb')]);router[_0xc93e('0xc')]('/',auth['isAuthenticated'](),controller[_0xc93e('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc93e('0xe')]);router[_0xc93e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc93e('0x10')]);module[_0xc93e('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index a10e150..4835612 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 _0xb4cc=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x10d43e,_0x4e5d08){var _0xbcf9a5=function(_0x44ee2f){while(--_0x44ee2f){_0x10d43e['push'](_0x10d43e['shift']());}};_0xbcf9a5(++_0x4e5d08);}(_0xb4cc,0xa6));var _0xcb4c=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xb4cc[_0x3a6e4b];return _0x36572d;};'use strict';var Sequelize=require(_0xcb4c('0x0'));module[_0xcb4c('0x1')]={'priority':{'type':Sequelize[_0xcb4c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xcb4c('0x3')],'allowNull':![],'defaultValue':_0xcb4c('0x4')},'appdata':{'type':Sequelize[_0xcb4c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xcb4c('0x6')}}; \ No newline at end of file +var _0x1bd1=['sequelize','exports','INTEGER','noop','STRING','*,*,*,*'];(function(_0x56ab99,_0x51d057){var _0x24605a=function(_0x1bdca7){while(--_0x1bdca7){_0x56ab99['push'](_0x56ab99['shift']());}};_0x24605a(++_0x51d057);}(_0x1bd1,0x11a));var _0x11bd=function(_0x557778,_0x3adbc5){_0x557778=_0x557778-0x0;var _0x4edd95=_0x1bd1[_0x557778];return _0x4edd95;};'use strict';var Sequelize=require(_0x11bd('0x0'));module[_0x11bd('0x1')]={'priority':{'type':Sequelize[_0x11bd('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x11bd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x11bd('0x4')]},'interval':{'type':Sequelize[_0x11bd('0x4')],'defaultValue':_0x11bd('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e01c501..0dcc29b 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 _0x3f96=['includeAll','create','body','params','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','filters','attributes','intersection','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','fields'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3f96,0x1d3));var _0x63f9=function(_0xcc3688,_0x33139a){_0xcc3688=_0xcc3688-0x0;var _0x3b4331=_0x3f96[_0xcc3688];return _0x3b4331;};'use strict';var emlformat=require(_0x63f9('0x0'));var rimraf=require(_0x63f9('0x1'));var zipdir=require(_0x63f9('0x2'));var jsonpatch=require(_0x63f9('0x3'));var rp=require(_0x63f9('0x4'));var moment=require('moment');var BPromise=require(_0x63f9('0x5'));var Mustache=require(_0x63f9('0x6'));var util=require(_0x63f9('0x7'));var path=require(_0x63f9('0x8'));var sox=require(_0x63f9('0x9'));var csv=require('to-csv');var ejs=require(_0x63f9('0xa'));var fs=require('fs');var fs_extra=require(_0x63f9('0xb'));var _=require(_0x63f9('0xc'));var squel=require(_0x63f9('0xd'));var crypto=require('crypto');var jsforce=require(_0x63f9('0xe'));var deskjs=require(_0x63f9('0xf'));var toCsv=require(_0x63f9('0x10'));var querystring=require(_0x63f9('0x11'));var Papa=require(_0x63f9('0x12'));var Redis=require(_0x63f9('0x13'));var authService=require(_0x63f9('0x14'));var qs=require(_0x63f9('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x63f9('0x16'));var logger=require(_0x63f9('0x17'))('api');var utils=require(_0x63f9('0x18'));var config=require(_0x63f9('0x19'));var licenseUtil=require(_0x63f9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45881b,_0x376780){_0x376780=_0x376780||0xcc;return function(_0x7025cc){if(_0x7025cc){return _0x45881b[_0x63f9('0x1b')](_0x376780);}return _0x45881b[_0x63f9('0x1c')](_0x376780)[_0x63f9('0x1d')]();};}function respondWithResult(_0x31997c,_0x51ec79){_0x51ec79=_0x51ec79||0xc8;return function(_0x19b409){if(_0x19b409){return _0x31997c['status'](_0x51ec79)[_0x63f9('0x1e')](_0x19b409);}};}function respondWithFilteredResult(_0x52be5e,_0x47050b){return function(_0x1fa6dd){if(_0x1fa6dd){var _0x37fc43=typeof _0x47050b[_0x63f9('0x1f')]===_0x63f9('0x20')&&typeof _0x47050b[_0x63f9('0x21')]===_0x63f9('0x20');var _0x5e25ae=_0x1fa6dd[_0x63f9('0x22')];var _0x4475d9=_0x37fc43?0x0:_0x47050b[_0x63f9('0x1f')];var _0x41d3a3=_0x37fc43?_0x1fa6dd[_0x63f9('0x22')]:_0x47050b['offset']+_0x47050b[_0x63f9('0x21')];var _0x30aa4d;if(_0x41d3a3>=_0x5e25ae){_0x41d3a3=_0x5e25ae;_0x30aa4d=0xc8;}else{_0x30aa4d=0xce;}_0x52be5e[_0x63f9('0x1c')](_0x30aa4d);return _0x52be5e['set'](_0x63f9('0x23'),_0x4475d9+'-'+_0x41d3a3+'/'+_0x5e25ae)[_0x63f9('0x1e')](_0x1fa6dd);}return null;};}function patchUpdates(_0x170f4){return function(_0x262b43){try{jsonpatch[_0x63f9('0x24')](_0x262b43,_0x170f4,!![]);}catch(_0x537a11){return BPromise['reject'](_0x537a11);}return _0x262b43[_0x63f9('0x25')]();};}function saveUpdates(_0x3926a2,_0x3c0589){return function(_0x39c2d4){if(_0x39c2d4){return _0x39c2d4[_0x63f9('0x26')](_0x3926a2)[_0x63f9('0x27')](function(_0x3720c9){return _0x3720c9;});}return null;};}function removeEntity(_0x549454,_0x5994c1){return function(_0x33092b){if(_0x33092b){return _0x33092b[_0x63f9('0x28')]()[_0x63f9('0x27')](function(){_0x549454[_0x63f9('0x1c')](0xcc)[_0x63f9('0x1d')]();});}};}function handleEntityNotFound(_0x62c363,_0x3e3c14){return function(_0xbb9716){if(!_0xbb9716){_0x62c363['sendStatus'](0x194);}return _0xbb9716;};}function handleError(_0x4abbf2,_0x5cf43d){_0x5cf43d=_0x5cf43d||0x1f4;return function(_0x1fcb7c){logger[_0x63f9('0x29')](_0x1fcb7c[_0x63f9('0x2a')]);if(_0x1fcb7c['name']){delete _0x1fcb7c[_0x63f9('0x2b')];}_0x4abbf2['status'](_0x5cf43d)[_0x63f9('0x2c')](_0x1fcb7c);};}exports[_0x63f9('0x2d')]=function(_0x25f5f0,_0x51c84b){var _0x1b56bd={},_0x3e6728={},_0x271872={'count':0x0,'rows':[]};var _0x22a82a=_[_0x63f9('0x2e')](db[_0x63f9('0x2f')]['rawAttributes'],function(_0x32f2d5){return{'name':_0x32f2d5[_0x63f9('0x30')],'type':_0x32f2d5[_0x63f9('0x31')][_0x63f9('0x32')]};});_0x3e6728[_0x63f9('0x33')]=_[_0x63f9('0x2e')](_0x22a82a,_0x63f9('0x2b'));_0x3e6728[_0x63f9('0x34')]=_[_0x63f9('0x35')](_0x25f5f0['query']);_0x3e6728[_0x63f9('0x36')]=_['intersection'](_0x3e6728[_0x63f9('0x33')],_0x3e6728[_0x63f9('0x34')]);_0x1b56bd[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x3e6728[_0x63f9('0x33')],qs['fields'](_0x25f5f0[_0x63f9('0x34')]['fields']));_0x1b56bd['attributes']=_0x1b56bd[_0x63f9('0x37')][_0x63f9('0x39')]?_0x1b56bd[_0x63f9('0x37')]:_0x3e6728['model'];if(!_0x25f5f0[_0x63f9('0x34')]['hasOwnProperty'](_0x63f9('0x3a'))){_0x1b56bd[_0x63f9('0x21')]=qs[_0x63f9('0x21')](_0x25f5f0['query']['limit']);_0x1b56bd[_0x63f9('0x1f')]=qs[_0x63f9('0x1f')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x1f')]);}_0x1b56bd['order']=qs[_0x63f9('0x3b')](_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3b')]);_0x1b56bd[_0x63f9('0x3c')]=qs['filters'](_[_0x63f9('0x3d')](_0x25f5f0[_0x63f9('0x34')],_0x3e6728[_0x63f9('0x36')]),_0x22a82a);if(_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]){_0x1b56bd[_0x63f9('0x3c')]=_[_0x63f9('0x3f')](_0x1b56bd[_0x63f9('0x3c')],{'$or':_[_0x63f9('0x2e')](_0x22a82a,function(_0x54f4d0){if(_0x54f4d0[_0x63f9('0x31')]!==_0x63f9('0x40')){var _0x110aa1={};_0x110aa1[_0x54f4d0[_0x63f9('0x2b')]]={'$like':'%'+_0x25f5f0[_0x63f9('0x34')][_0x63f9('0x3e')]+'%'};return _0x110aa1;}})});}_0x1b56bd=_['merge']({},_0x1b56bd,_0x25f5f0[_0x63f9('0x41')]);var _0x2f1202={'where':_0x1b56bd[_0x63f9('0x3c')]};return db[_0x63f9('0x2f')][_0x63f9('0x22')](_0x2f1202)[_0x63f9('0x27')](function(_0x1d733a){_0x271872[_0x63f9('0x22')]=_0x1d733a;if(_0x25f5f0['query']['includeAll']){_0x1b56bd['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0x63f9('0x42')](_0x1b56bd);})[_0x63f9('0x27')](function(_0x19a603){_0x271872[_0x63f9('0x43')]=_0x19a603;return _0x271872;})[_0x63f9('0x27')](respondWithFilteredResult(_0x51c84b,_0x1b56bd))[_0x63f9('0x44')](handleError(_0x51c84b,null));};exports[_0x63f9('0x45')]=function(_0x16a1f3,_0x388261){var _0x5f53ab={'raw':!![],'where':{'id':_0x16a1f3['params']['id']}},_0x23ee18={};_0x23ee18[_0x63f9('0x33')]=_['keys'](db[_0x63f9('0x2f')][_0x63f9('0x46')]);_0x23ee18[_0x63f9('0x34')]=_['keys'](_0x16a1f3[_0x63f9('0x34')]);_0x23ee18[_0x63f9('0x36')]=_[_0x63f9('0x38')](_0x23ee18['model'],_0x23ee18['query']);_0x5f53ab[_0x63f9('0x37')]=_[_0x63f9('0x38')](_0x23ee18[_0x63f9('0x33')],qs[_0x63f9('0x47')](_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x47')]));_0x5f53ab['attributes']=_0x5f53ab[_0x63f9('0x37')][_0x63f9('0x39')]?_0x5f53ab['attributes']:_0x23ee18[_0x63f9('0x33')];if(_0x16a1f3[_0x63f9('0x34')][_0x63f9('0x48')]){_0x5f53ab['include']=[{'all':!![]}];}_0x5f53ab=_['merge']({},_0x5f53ab,_0x16a1f3[_0x63f9('0x41')]);return db[_0x63f9('0x2f')]['find'](_0x5f53ab)[_0x63f9('0x27')](handleEntityNotFound(_0x388261,null))[_0x63f9('0x27')](respondWithResult(_0x388261,null))[_0x63f9('0x44')](handleError(_0x388261,null));};exports[_0x63f9('0x49')]=function(_0x119b8e,_0x51d818){return db[_0x63f9('0x2f')][_0x63f9('0x49')](_0x119b8e[_0x63f9('0x4a')],{})['then'](respondWithResult(_0x51d818,0xc9))['catch'](handleError(_0x51d818,null));};exports['update']=function(_0x4e6466,_0x13803d){if(_0x4e6466[_0x63f9('0x4a')]['id']){delete _0x4e6466[_0x63f9('0x4a')]['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x4e6466[_0x63f9('0x4b')]['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x13803d,null))[_0x63f9('0x27')](saveUpdates(_0x4e6466[_0x63f9('0x4a')],null))[_0x63f9('0x27')](respondWithResult(_0x13803d,null))[_0x63f9('0x44')](handleError(_0x13803d,null));};exports[_0x63f9('0x28')]=function(_0x387aa5,_0x53f06f){return db[_0x63f9('0x2f')][_0x63f9('0x4c')]({'where':{'id':_0x387aa5['params']['id']}})[_0x63f9('0x27')](handleEntityNotFound(_0x53f06f,null))[_0x63f9('0x27')](removeEntity(_0x53f06f,null))['catch'](handleError(_0x53f06f,null));}; \ No newline at end of file +var _0x6f83=['destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','WhatsappApplication','count','includeAll','findAll','rows','catch','show','params','include','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then'];(function(_0x1c6f91,_0x34dc40){var _0x3e56ac=function(_0x199781){while(--_0x199781){_0x1c6f91['push'](_0x1c6f91['shift']());}};_0x3e56ac(++_0x34dc40);}(_0x6f83,0x72));var _0x36f8=function(_0x2d3ec1,_0xdaac7b){_0x2d3ec1=_0x2d3ec1-0x0;var _0x5f5eda=_0x6f83[_0x2d3ec1];return _0x5f5eda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x36f8('0x0'));var zipdir=require(_0x36f8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36f8('0x2'));var moment=require(_0x36f8('0x3'));var BPromise=require(_0x36f8('0x4'));var Mustache=require(_0x36f8('0x5'));var util=require(_0x36f8('0x6'));var path=require(_0x36f8('0x7'));var sox=require(_0x36f8('0x8'));var csv=require(_0x36f8('0x9'));var ejs=require(_0x36f8('0xa'));var fs=require('fs');var fs_extra=require(_0x36f8('0xb'));var _=require(_0x36f8('0xc'));var squel=require(_0x36f8('0xd'));var crypto=require(_0x36f8('0xe'));var jsforce=require(_0x36f8('0xf'));var deskjs=require(_0x36f8('0x10'));var toCsv=require(_0x36f8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36f8('0x11'));var qs=require(_0x36f8('0x12'));var as=require(_0x36f8('0x13'));var hardwareService=require(_0x36f8('0x14'));var logger=require(_0x36f8('0x15'))(_0x36f8('0x16'));var utils=require(_0x36f8('0x17'));var config=require(_0x36f8('0x18'));var licenseUtil=require(_0x36f8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x71e1ab,_0x196122){_0x196122=_0x196122||0xcc;return function(_0x166a1c){if(_0x166a1c){return _0x71e1ab[_0x36f8('0x1a')](_0x196122);}return _0x71e1ab['status'](_0x196122)[_0x36f8('0x1b')]();};}function respondWithResult(_0x189e22,_0x40a1c0){_0x40a1c0=_0x40a1c0||0xc8;return function(_0x5a8556){if(_0x5a8556){return _0x189e22[_0x36f8('0x1c')](_0x40a1c0)[_0x36f8('0x1d')](_0x5a8556);}};}function respondWithFilteredResult(_0x1ba051,_0x5048e0){return function(_0x429efc){if(_0x429efc){var _0x3e3281=typeof _0x5048e0[_0x36f8('0x1e')]===_0x36f8('0x1f')&&typeof _0x5048e0['limit']==='undefined';var _0x3f9947=_0x429efc['count'];var _0x517cba=_0x3e3281?0x0:_0x5048e0[_0x36f8('0x1e')];var _0x3d6a3c=_0x3e3281?_0x429efc['count']:_0x5048e0[_0x36f8('0x1e')]+_0x5048e0[_0x36f8('0x20')];var _0x290e63;if(_0x3d6a3c>=_0x3f9947){_0x3d6a3c=_0x3f9947;_0x290e63=0xc8;}else{_0x290e63=0xce;}_0x1ba051[_0x36f8('0x1c')](_0x290e63);return _0x1ba051[_0x36f8('0x21')](_0x36f8('0x22'),_0x517cba+'-'+_0x3d6a3c+'/'+_0x3f9947)[_0x36f8('0x1d')](_0x429efc);}return null;};}function patchUpdates(_0x16b9e8){return function(_0x283fd0){try{jsonpatch[_0x36f8('0x23')](_0x283fd0,_0x16b9e8,!![]);}catch(_0x26fc64){return BPromise[_0x36f8('0x24')](_0x26fc64);}return _0x283fd0['save']();};}function saveUpdates(_0xefe5b2,_0x42d203){return function(_0x41ccc3){if(_0x41ccc3){return _0x41ccc3['update'](_0xefe5b2)[_0x36f8('0x25')](function(_0x52b5ac){return _0x52b5ac;});}return null;};}function removeEntity(_0x362eae,_0x206075){return function(_0x4d2cd9){if(_0x4d2cd9){return _0x4d2cd9[_0x36f8('0x26')]()['then'](function(){_0x362eae[_0x36f8('0x1c')](0xcc)[_0x36f8('0x1b')]();});}};}function handleEntityNotFound(_0xb2acc5,_0x2eeb82){return function(_0x6740e1){if(!_0x6740e1){_0xb2acc5[_0x36f8('0x1a')](0x194);}return _0x6740e1;};}function handleError(_0x59291b,_0x462fd2){_0x462fd2=_0x462fd2||0x1f4;return function(_0xb2bbfd){logger[_0x36f8('0x27')](_0xb2bbfd[_0x36f8('0x28')]);if(_0xb2bbfd[_0x36f8('0x29')]){delete _0xb2bbfd[_0x36f8('0x29')];}_0x59291b[_0x36f8('0x1c')](_0x462fd2)[_0x36f8('0x2a')](_0xb2bbfd);};}exports[_0x36f8('0x2b')]=function(_0x51a2a1,_0x449882){var _0x1f67ea={},_0x3f01a6={},_0x328be8={'count':0x0,'rows':[]};var _0x191cdc=_[_0x36f8('0x2c')](db['WhatsappApplication'][_0x36f8('0x2d')],function(_0x302745){return{'name':_0x302745[_0x36f8('0x2e')],'type':_0x302745[_0x36f8('0x2f')][_0x36f8('0x30')]};});_0x3f01a6[_0x36f8('0x31')]=_[_0x36f8('0x2c')](_0x191cdc,_0x36f8('0x29'));_0x3f01a6[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x51a2a1[_0x36f8('0x32')]);_0x3f01a6['filters']=_['intersection'](_0x3f01a6['model'],_0x3f01a6[_0x36f8('0x32')]);_0x1f67ea[_0x36f8('0x34')]=_[_0x36f8('0x35')](_0x3f01a6['model'],qs[_0x36f8('0x36')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x36')]));_0x1f67ea[_0x36f8('0x34')]=_0x1f67ea[_0x36f8('0x34')][_0x36f8('0x37')]?_0x1f67ea[_0x36f8('0x34')]:_0x3f01a6[_0x36f8('0x31')];if(!_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x38')]('nolimit')){_0x1f67ea[_0x36f8('0x20')]=qs[_0x36f8('0x20')](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x20')]);_0x1f67ea[_0x36f8('0x1e')]=qs['offset'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x1e')]);}_0x1f67ea[_0x36f8('0x39')]=qs['sort'](_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3a')]);_0x1f67ea[_0x36f8('0x3b')]=qs[_0x36f8('0x3c')](_['pick'](_0x51a2a1['query'],_0x3f01a6[_0x36f8('0x3c')]),_0x191cdc);if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x3d')]){_0x1f67ea[_0x36f8('0x3b')]=_[_0x36f8('0x3e')](_0x1f67ea[_0x36f8('0x3b')],{'$or':_[_0x36f8('0x2c')](_0x191cdc,function(_0x598db5){if(_0x598db5[_0x36f8('0x2f')]!=='VIRTUAL'){var _0x258c27={};_0x258c27[_0x598db5[_0x36f8('0x29')]]={'$like':'%'+_0x51a2a1[_0x36f8('0x32')]['filter']+'%'};return _0x258c27;}})});}_0x1f67ea=_['merge']({},_0x1f67ea,_0x51a2a1[_0x36f8('0x3f')]);var _0x245a27={'where':_0x1f67ea[_0x36f8('0x3b')]};return db[_0x36f8('0x40')][_0x36f8('0x41')](_0x245a27)[_0x36f8('0x25')](function(_0x437218){_0x328be8[_0x36f8('0x41')]=_0x437218;if(_0x51a2a1[_0x36f8('0x32')][_0x36f8('0x42')]){_0x1f67ea['include']=[{'all':!![]}];}return db[_0x36f8('0x40')][_0x36f8('0x43')](_0x1f67ea);})[_0x36f8('0x25')](function(_0x1e97de){_0x328be8[_0x36f8('0x44')]=_0x1e97de;return _0x328be8;})['then'](respondWithFilteredResult(_0x449882,_0x1f67ea))[_0x36f8('0x45')](handleError(_0x449882,null));};exports[_0x36f8('0x46')]=function(_0x3e1700,_0x53aa30){var _0x10e763={'raw':!![],'where':{'id':_0x3e1700[_0x36f8('0x47')]['id']}},_0x3b9d5e={};_0x3b9d5e[_0x36f8('0x31')]=_[_0x36f8('0x33')](db['WhatsappApplication'][_0x36f8('0x2d')]);_0x3b9d5e[_0x36f8('0x32')]=_[_0x36f8('0x33')](_0x3e1700[_0x36f8('0x32')]);_0x3b9d5e[_0x36f8('0x3c')]=_[_0x36f8('0x35')](_0x3b9d5e[_0x36f8('0x31')],_0x3b9d5e[_0x36f8('0x32')]);_0x10e763['attributes']=_[_0x36f8('0x35')](_0x3b9d5e['model'],qs[_0x36f8('0x36')](_0x3e1700[_0x36f8('0x32')]['fields']));_0x10e763[_0x36f8('0x34')]=_0x10e763[_0x36f8('0x34')]['length']?_0x10e763['attributes']:_0x3b9d5e[_0x36f8('0x31')];if(_0x3e1700[_0x36f8('0x32')][_0x36f8('0x42')]){_0x10e763[_0x36f8('0x48')]=[{'all':!![]}];}_0x10e763=_[_0x36f8('0x3e')]({},_0x10e763,_0x3e1700['options']);return db['WhatsappApplication'][_0x36f8('0x49')](_0x10e763)[_0x36f8('0x25')](handleEntityNotFound(_0x53aa30,null))[_0x36f8('0x25')](respondWithResult(_0x53aa30,null))[_0x36f8('0x45')](handleError(_0x53aa30,null));};exports[_0x36f8('0x4a')]=function(_0x5085ac,_0x4b324d){return db[_0x36f8('0x40')][_0x36f8('0x4a')](_0x5085ac[_0x36f8('0x4b')],{})[_0x36f8('0x25')](respondWithResult(_0x4b324d,0xc9))[_0x36f8('0x45')](handleError(_0x4b324d,null));};exports['update']=function(_0x8e0950,_0x488b41){if(_0x8e0950[_0x36f8('0x4b')]['id']){delete _0x8e0950[_0x36f8('0x4b')]['id'];}return db[_0x36f8('0x40')]['find']({'where':{'id':_0x8e0950[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x488b41,null))[_0x36f8('0x25')](saveUpdates(_0x8e0950[_0x36f8('0x4b')],null))[_0x36f8('0x25')](respondWithResult(_0x488b41,null))['catch'](handleError(_0x488b41,null));};exports[_0x36f8('0x26')]=function(_0x4bacdb,_0x5b38da){return db['WhatsappApplication'][_0x36f8('0x49')]({'where':{'id':_0x4bacdb[_0x36f8('0x47')]['id']}})[_0x36f8('0x25')](handleEntityNotFound(_0x5b38da,null))[_0x36f8('0x25')](removeEntity(_0x5b38da,null))[_0x36f8('0x45')](handleError(_0x5b38da,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 16c228c..e134400 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 _0x3d6d=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash'];(function(_0xee5192,_0x3bdad4){var _0x54e76f=function(_0x59bc1e){while(--_0x59bc1e){_0xee5192['push'](_0xee5192['shift']());}};_0x54e76f(++_0x3bdad4);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x7be910,_0x2b381b){_0x7be910=_0x7be910-0x0;var _0x496ddf=_0x3d6d[_0x7be910];return _0x496ddf;};'use strict';var _=require(_0xd3d6('0x0'));var util=require(_0xd3d6('0x1'));var logger=require(_0xd3d6('0x2'))(_0xd3d6('0x3'));var moment=require(_0xd3d6('0x4'));var BPromise=require(_0xd3d6('0x5'));var rp=require(_0xd3d6('0x6'));var fs=require('fs');var path=require(_0xd3d6('0x7'));var rimraf=require(_0xd3d6('0x8'));var config=require(_0xd3d6('0x9'));var attributes=require(_0xd3d6('0xa'));module['exports']=function(_0x5400f8,_0x3f36){return _0x5400f8[_0xd3d6('0xb')](_0xd3d6('0xc'),attributes,{'tableName':_0xd3d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd3d6('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7764=['moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger','api'];(function(_0x5d6482,_0x1c9b00){var _0x32e681=function(_0x398459){while(--_0x398459){_0x5d6482['push'](_0x5d6482['shift']());}};_0x32e681(++_0x1c9b00);}(_0x7764,0xa4));var _0x4776=function(_0x93942f,_0xb48547){_0x93942f=_0x93942f-0x0;var _0x23fcd8=_0x7764[_0x93942f];return _0x23fcd8;};'use strict';var _=require(_0x4776('0x0'));var util=require(_0x4776('0x1'));var logger=require(_0x4776('0x2'))(_0x4776('0x3'));var moment=require(_0x4776('0x4'));var BPromise=require(_0x4776('0x5'));var rp=require(_0x4776('0x6'));var fs=require('fs');var path=require(_0x4776('0x7'));var rimraf=require(_0x4776('0x8'));var config=require(_0x4776('0x9'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xc431bf,_0x3eff9c){return _0xc431bf['define'](_0x4776('0xa'),attributes,{'tableName':_0x4776('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index deb004f..12e33c7 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 _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','catch','util'];(function(_0xe9cb5a,_0x3521a3){var _0x5bec62=function(_0x5c31e9){while(--_0x5c31e9){_0xe9cb5a['push'](_0xe9cb5a['shift']());}};_0x5bec62(++_0x3521a3);}(_0xedd9,0xfc));var _0x9edd=function(_0x924c29,_0x309120){_0x924c29=_0x924c29-0x0;var _0x24ddd6=_0xedd9[_0x924c29];return _0x24ddd6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('WhatsappApplication,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0x33c5=['then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x33c5,0xe6));var _0x533c=function(_0x135704,_0x539aee){_0x135704=_0x135704-0x0;var _0x24e9fd=_0x33c5[_0x135704];return _0x24e9fd;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index dd5fda9..f7af83b 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 _0xe3da=['post','create','addMessage','/:id/tags','tracked','whatsapp','addTags','put','/:id','update','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages'];(function(_0x5658ef,_0x2b3cc1){var _0x49154c=function(_0xab7703){while(--_0xab7703){_0x5658ef['push'](_0x5658ef['shift']());}};_0x49154c(++_0x2b3cc1);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var fs_extra=require(_0xae3d('0x6'));var auth=require(_0xae3d('0x7'));var interaction=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var controller=require(_0xae3d('0xa'));router[_0xae3d('0xb')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0xd')]);router[_0xae3d('0xb')](_0xae3d('0xe'),auth['isAuthenticated'](),controller[_0xae3d('0xf')]);router[_0xae3d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xae3d('0x10')]);router[_0xae3d('0xb')](_0xae3d('0x11'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x12')]);router[_0xae3d('0xb')]('/:id/download',auth[_0xae3d('0xc')](),controller['download']);router[_0xae3d('0x13')]('/',auth[_0xae3d('0xc')](),controller[_0xae3d('0x14')]);router[_0xae3d('0x13')]('/:id/messages',auth[_0xae3d('0xc')](),controller[_0xae3d('0x15')]);router[_0xae3d('0x13')](_0xae3d('0x16'),auth[_0xae3d('0xc')](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:addtags'),controller[_0xae3d('0x19')]);router[_0xae3d('0x1a')](_0xae3d('0x1b'),auth[_0xae3d('0xc')](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:update'),controller[_0xae3d('0x1c')]);router[_0xae3d('0x1d')](_0xae3d('0x1b'),auth['isAuthenticated'](),interaction[_0xae3d('0x17')](_0xae3d('0x18'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xae3d('0x1d')](_0xae3d('0x16'),auth[_0xae3d('0xc')](),controller[_0xae3d('0x1e')]);module[_0xae3d('0x1f')]=router; \ No newline at end of file +var _0x4351=['whatsappinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','download','post','/:id/tags','whatsappinteraction:addtags','put','tracked','whatsapp','whatsappinteraction:update','update','delete'];(function(_0xbabd8a,_0x3cefad){var _0x1b1fb2=function(_0x754baa){while(--_0x754baa){_0xbabd8a['push'](_0xbabd8a['shift']());}};_0x1b1fb2(++_0x3cefad);}(_0x4351,0x1b5));var _0x1435=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x4351[_0x33032e];return _0x13316b;};'use strict';var multer=require(_0x1435('0x0'));var util=require(_0x1435('0x1'));var path=require(_0x1435('0x2'));var timeout=require(_0x1435('0x3'));var express=require(_0x1435('0x4'));var router=express[_0x1435('0x5')]();var fs_extra=require(_0x1435('0x6'));var auth=require(_0x1435('0x7'));var interaction=require(_0x1435('0x8'));var config=require(_0x1435('0x9'));var controller=require(_0x1435('0xa'));router[_0x1435('0xb')]('/',auth[_0x1435('0xc')](),controller[_0x1435('0xd')]);router[_0x1435('0xb')]('/describe',auth[_0x1435('0xc')](),controller['describe']);router['get'](_0x1435('0xe'),auth[_0x1435('0xc')](),controller[_0x1435('0xf')]);router[_0x1435('0xb')](_0x1435('0x10'),auth['isAuthenticated'](),controller[_0x1435('0x11')]);router[_0x1435('0xb')]('/:id/download',auth['isAuthenticated'](),controller[_0x1435('0x12')]);router['post']('/',auth[_0x1435('0xc')](),controller['create']);router[_0x1435('0x13')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x1435('0x13')](_0x1435('0x14'),auth[_0x1435('0xc')](),interaction['tracked']('whatsapp',_0x1435('0x15')),controller['addTags']);router[_0x1435('0x16')](_0x1435('0xe'),auth[_0x1435('0xc')](),interaction[_0x1435('0x17')](_0x1435('0x18'),_0x1435('0x19')),controller[_0x1435('0x1a')]);router[_0x1435('0x1b')](_0x1435('0xe'),auth[_0x1435('0xc')](),interaction[_0x1435('0x17')](_0x1435('0x18'),_0x1435('0x1c')),controller[_0x1435('0x1d')]);router[_0x1435('0x1b')]('/:id/tags',auth[_0x1435('0xc')](),controller[_0x1435('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index dacca09..06d4200 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 _0x9f5a=['sequelize','moment','exports','BOOLEAN','STRING','ENUM','out'];(function(_0x382ca6,_0x1aaf79){var _0x295a6c=function(_0x294a0b){while(--_0x294a0b){_0x382ca6['push'](_0x382ca6['shift']());}};_0x295a6c(++_0x1aaf79);}(_0x9f5a,0xbd));var _0xa9f5=function(_0xb51fb9,_0x397a4e){_0xb51fb9=_0xb51fb9-0x0;var _0x135391=_0x9f5a[_0xb51fb9];return _0x135391;};'use strict';var Sequelize=require(_0xa9f5('0x0'));var moment=require(_0xa9f5('0x1'));module[_0xa9f5('0x2')]={'closed':{'type':Sequelize[_0xa9f5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xa9f5('0x4')]},'secondDisposition':{'type':Sequelize[_0xa9f5('0x4')]},'thirdDisposition':{'type':Sequelize[_0xa9f5('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa9f5('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa9f5('0x5')]('in',_0xa9f5('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xa9f5('0x5')]('in',_0xa9f5('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa9f5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe260=['out','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe260,0x94));var _0x0e26=function(_0x59333a,_0x1d183c){_0x59333a=_0x59333a-0x0;var _0x3b28f7=_0xe260[_0x59333a];return _0x3b28f7;};'use strict';var Sequelize=require(_0x0e26('0x0'));var moment=require('moment');module[_0x0e26('0x1')]={'closed':{'type':Sequelize[_0x0e26('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0e26('0x3')]},'disposition':{'type':Sequelize[_0x0e26('0x4')]},'secondDisposition':{'type':Sequelize[_0x0e26('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0e26('0x4')]},'note':{'type':Sequelize[_0x0e26('0x4')]},'phone':{'type':Sequelize[_0x0e26('0x4')]},'read1stAt':{'type':Sequelize[_0x0e26('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0e26('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x0e26('0x5')]('in',_0x0e26('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0e26('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 afc1b51..090f31a 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 _0x1841=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','set','reject','save','update','then','error','stack','name','send','map','TagIds','split','forEach','Tags','push','catch','index','WhatsappInteraction','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','conditions','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','body','some','compact','isEmpty','WhatsappAccountId','concat','createdAt','$gte','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','having','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','t.id\x20IN\x20?','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','i.WhatsappAccountId\x20IN\x20?','sequelize','toString','keyBy','merge','a.mandatoryDisposition','Account.mandatoryDisposition','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','all','show','params','rawAttributes','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','WhatsappInteractionId','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','addTags','setTags','spread','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','CmContact','firstName','Attachment','Messages','direction','Owner','get','mkdirSync','Whatsapp','Account','format','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x43cae9,_0x44742f){var _0x4ef4cd=function(_0x3443a2){while(--_0x3443a2){_0x43cae9['push'](_0x43cae9['shift']());}};_0x4ef4cd(++_0x44742f);}(_0x1841,0xdf));var _0x1184=function(_0x1156aa,_0x1d2582){_0x1156aa=_0x1156aa-0x0;var _0x157c0c=_0x1841[_0x1156aa];return _0x157c0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1184('0x0'));var zipdir=require(_0x1184('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1184('0x2'));var BPromise=require(_0x1184('0x3'));var Mustache=require(_0x1184('0x4'));var util=require(_0x1184('0x5'));var path=require(_0x1184('0x6'));var sox=require('sox');var csv=require(_0x1184('0x7'));var ejs=require(_0x1184('0x8'));var fs=require('fs');var fs_extra=require(_0x1184('0x9'));var _=require(_0x1184('0xa'));var squel=require(_0x1184('0xb'));var crypto=require(_0x1184('0xc'));var jsforce=require(_0x1184('0xd'));var deskjs=require(_0x1184('0xe'));var toCsv=require(_0x1184('0x7'));var querystring=require(_0x1184('0xf'));var Papa=require(_0x1184('0x10'));var Redis=require(_0x1184('0x11'));var authService=require(_0x1184('0x12'));var qs=require(_0x1184('0x13'));var as=require(_0x1184('0x14'));var pdf=require(_0x1184('0x15'));var hardwareService=require(_0x1184('0x16'));var logger=require(_0x1184('0x17'))(_0x1184('0x18'));var utils=require('../../config/utils');var config=require(_0x1184('0x19'));var licenseUtil=require(_0x1184('0x1a'));var db=require(_0x1184('0x1b'))['db'];config[_0x1184('0x1c')]=_[_0x1184('0x1d')](config['redis'],{'host':_0x1184('0x1e'),'port':0x18eb});var socket=require(_0x1184('0x1f'))(new Redis(config[_0x1184('0x1c')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x27637d,_0x4a9543){_0x4a9543=_0x4a9543||0xcc;return function(_0x53d39b){if(_0x53d39b){return _0x27637d[_0x1184('0x20')](_0x4a9543);}return _0x27637d[_0x1184('0x21')](_0x4a9543)[_0x1184('0x22')]();};}function respondWithResult(_0x3e1d78,_0x56f21c){_0x56f21c=_0x56f21c||0xc8;return function(_0x18d82a){if(_0x18d82a){return _0x3e1d78[_0x1184('0x21')](_0x56f21c)[_0x1184('0x23')](_0x18d82a);}};}function respondWithFilteredResult(_0x2e30f6,_0x2ce3c0){return function(_0x5bf7e7){if(_0x5bf7e7){var _0x1841d2=typeof _0x2ce3c0[_0x1184('0x24')]==='undefined'&&typeof _0x2ce3c0[_0x1184('0x25')]==='undefined';var _0x38fe7e=_0x5bf7e7[_0x1184('0x26')];var _0x4cc76c=_0x1841d2?0x0:_0x2ce3c0[_0x1184('0x24')];var _0x576306=_0x1841d2?_0x5bf7e7[_0x1184('0x26')]:_0x2ce3c0[_0x1184('0x24')]+_0x2ce3c0[_0x1184('0x25')];var _0x2cc094;if(_0x576306>=_0x38fe7e){_0x576306=_0x38fe7e;_0x2cc094=0xc8;}else{_0x2cc094=0xce;}_0x2e30f6[_0x1184('0x21')](_0x2cc094);return _0x2e30f6[_0x1184('0x27')]('Content-Range',_0x4cc76c+'-'+_0x576306+'/'+_0x38fe7e)[_0x1184('0x23')](_0x5bf7e7);}return null;};}function patchUpdates(_0x28bc84){return function(_0x4ab277){try{jsonpatch['apply'](_0x4ab277,_0x28bc84,!![]);}catch(_0x4fc891){return BPromise[_0x1184('0x28')](_0x4fc891);}return _0x4ab277[_0x1184('0x29')]();};}function saveUpdates(_0x31b0d0,_0x202616){return function(_0x4a60b4){if(_0x4a60b4){return _0x4a60b4[_0x1184('0x2a')](_0x31b0d0)[_0x1184('0x2b')](function(_0x1f2a6a){return _0x1f2a6a;});}return null;};}function removeEntity(_0x32a97b,_0x31293a){return function(_0x302da9){if(_0x302da9){return _0x302da9['destroy']()[_0x1184('0x2b')](function(){_0x32a97b[_0x1184('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf5e540,_0x54fc94){return function(_0x4ad474){if(!_0x4ad474){_0xf5e540[_0x1184('0x20')](0x194);}return _0x4ad474;};}function handleError(_0x5ec856,_0x323110){_0x323110=_0x323110||0x1f4;return function(_0x39494c){logger[_0x1184('0x2c')](_0x39494c[_0x1184('0x2d')]);if(_0x39494c[_0x1184('0x2e')]){delete _0x39494c[_0x1184('0x2e')];}_0x5ec856['status'](_0x323110)[_0x1184('0x2f')](_0x39494c);};}function getInteractionUsers(_0x5b8c72,_0x325811){return new BPromise(function(_0xc0cf7a,_0xbb1746){try{if(_0x325811[_0x5b8c72['id']]){_0x5b8c72['Users']=_[_0x1184('0x30')](_0x325811[_0x5b8c72['id']],function(_0x13e902){return{'id':_0x13e902['id'],'fullname':_0x13e902['fullname']};});}}catch(_0xef33fa){_0xbb1746(_0xef33fa);}_0xc0cf7a(_0x5b8c72);});}function getInteractionTags(_0x327329,_0x436c32){return new BPromise(function(_0x2f5231,_0x2ae33b){try{if(_0x327329[_0x1184('0x31')]){_0x327329['Tags']=[];_0x327329[_0x1184('0x31')][_0x1184('0x32')](',')[_0x1184('0x33')](function(_0x3b1d15){_0x327329[_0x1184('0x34')][_0x1184('0x35')](_0x436c32[_0x3b1d15]);});}delete _0x327329['TagIds'];}catch(_0x45398e){_0x2ae33b(_0x45398e);}_0x2f5231(_0x327329);});}function updateWhatsappInteraction(_0x2d4fb6,_0x58a3e7,_0x905450){return new BPromise(function(_0x17e40e,_0x7c2b8){return getInteractionUsers(_0x2d4fb6,_0x905450)[_0x1184('0x2b')](function(_0x246586){return getInteractionTags(_0x246586,_0x58a3e7);})[_0x1184('0x2b')](function(_0x57d79d){_0x17e40e(_0x57d79d);})[_0x1184('0x36')](function(_0x47578f){_0x7c2b8(_0x47578f);});});}exports[_0x1184('0x37')]=function(_0x3fb3b9,_0x13a78e){var _0x1ce233={},_0x40ebc6={},_0x10b87a={'count':0x0,'rows':[]};var _0x36e068=_[_0x1184('0x30')](db[_0x1184('0x38')]['rawAttributes'],function(_0x5334e5){return{'name':_0x5334e5[_0x1184('0x39')],'type':_0x5334e5['type'][_0x1184('0x3a')]};});_0x40ebc6[_0x1184('0x3b')]=_['map'](_0x36e068,_0x1184('0x2e'));_0x40ebc6['query']=_[_0x1184('0x3c')](_0x3fb3b9[_0x1184('0x3d')]);_0x40ebc6[_0x1184('0x3e')]=_['intersection'](_0x40ebc6[_0x1184('0x3b')],_0x40ebc6[_0x1184('0x3d')]);_0x1ce233['attributes']=_[_0x1184('0x3f')](_0x40ebc6[_0x1184('0x3b')],qs[_0x1184('0x40')](_0x3fb3b9[_0x1184('0x3d')]['fields']));_0x1ce233[_0x1184('0x41')]=_0x1ce233[_0x1184('0x41')][_0x1184('0x42')]?_0x1ce233['attributes']:_0x40ebc6['model'];if(!_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x43')](_0x1184('0x44'))){_0x1ce233[_0x1184('0x25')]=qs[_0x1184('0x25')](_0x3fb3b9['query'][_0x1184('0x25')]);_0x1ce233['offset']=qs['offset'](_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x24')]);}_0x1ce233[_0x1184('0x45')]=qs[_0x1184('0x46')](_0x3fb3b9[_0x1184('0x3d')]['sort']);_0x1ce233[_0x1184('0x47')]=qs[_0x1184('0x3e')](_[_0x1184('0x48')](_0x3fb3b9[_0x1184('0x3d')],_0x40ebc6['filters']),_0x36e068);var _0x156b6c=[];var _0x420864=squel[_0x1184('0x49')]()[_0x1184('0x4a')]('id')[_0x1184('0x4a')](_0x1184('0x2e'))[_0x1184('0x4a')](_0x1184('0x4b'))[_0x1184('0x4c')](_0x1184('0x4d'));var _0x17e2c9=squel[_0x1184('0x49')]()[_0x1184('0x4a')](_0x1184('0x4e'))[_0x1184('0x4a')](_0x1184('0x4f'))[_0x1184('0x4a')](_0x1184('0x50'))[_0x1184('0x4c')](_0x1184('0x51'),'ui')[_0x1184('0x52')](_0x1184('0x53'),'u',_0x1184('0x54'));var _0x4573a0=squel['select']()['from'](_0x1184('0x55'),'i')[_0x1184('0x52')](_0x1184('0x56'),'c',_0x1184('0x57'))[_0x1184('0x52')](_0x1184('0x53'),'o','o.id\x20=\x20i.UserId')[_0x1184('0x52')](_0x1184('0x58'),'a',_0x1184('0x59'))['left_join'](_0x1184('0x5a'),'me',_0x1184('0x5b'))['left_join'](_0x1184('0x5c'),'it','it.WhatsappInteractionId\x20=\x20i.id')[_0x1184('0x52')](_0x1184('0x4d'),'t',_0x1184('0x5d'));var _0x45e9ab=squel[_0x1184('0x5e')]();var _0x342cd8=[];var _0x2ca7d1=squel[_0x1184('0x5e')]();var _0x495bc1;if(_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x5f')]){_0x495bc1=as['parseSearch'](_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x5f')]);var _0x34f4c1=_0x495bc1['sqlOperator'];for(var _0x1fb7eb=0x0;_0x1fb7eb<_0x495bc1[_0x1184('0x60')][_0x1184('0x42')];_0x1fb7eb++){var _0x56192a=_0x495bc1['conditions'][_0x1fb7eb];var _0x13b2ce='i';var _0x50b46f=_['find'](_0x36e068,[_0x1184('0x2e'),_0x56192a[_0x1184('0x4a')]]);if(!_0x50b46f){switch(_0x56192a[_0x1184('0x4a')]){case _0x1184('0x61'):if(_0x56192a[_0x1184('0x62')]==0x1){_0x4573a0['having']('`'+_0x56192a[_0x1184('0x4a')]+_0x1184('0x63'));}else{_0x4573a0['having']('`'+_0x56192a[_0x1184('0x4a')]+_0x1184('0x64'));}break;case _0x1184('0x65'):if(_0x56192a[_0x1184('0x66')]==='$substring'){if(_0x56192a[_0x1184('0x62')][_0x1184('0x32')]('\x20')[_0x1184('0x42')]>0x1){_0x45e9ab[_0x34f4c1](_0x1184('0x67'),qs[_0x1184('0x68')](_0x56192a[_0x1184('0x62')]),null);}else{var _0x222041='%'+_0x56192a[_0x1184('0x62')]+'%';_0x45e9ab[_0x34f4c1]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x222041,_0x222041,_0x222041);}}else{_0x50b46f=_['find'](_0x36e068,['name',_0x1184('0x69')]);_0x56192a[_0x1184('0x4a')]=_0x1184('0x69');_0x528bb9=as[_0x1184('0x6a')](_0x13b2ce,_0x50b46f[_0x1184('0x6b')],_0x56192a);_0x45e9ab[_0x34f4c1](_0x528bb9[_0x1184('0x6c')],_0x528bb9[_0x1184('0x62')][_0x1184('0x6d')],_0x528bb9['value']['end']);}break;case _0x1184('0x6e'):var _0x3598f4=_0x56192a[_0x1184('0x62')][_0x1184('0x32')](',')[_0x1184('0x30')](function(_0x2deeff){return Number(_0x2deeff);});_0x3598f4[_0x1184('0x33')](function(_0x12cb2b){_0x2ca7d1['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x12cb2b+',%');});_0x342cd8=_[_0x1184('0x6f')](_0x342cd8,_0x3598f4);break;case _0x1184('0x70'):if(_0x56192a['operator']==='$substring'){_0x45e9ab[_0x34f4c1](_0x1184('0x71'),'%'+_0x56192a[_0x1184('0x62')]+'%',null);}else{_0x50b46f=_[_0x1184('0x72')](_0x36e068,['name','UserId']);_0x56192a[_0x1184('0x4a')]=_0x1184('0x73');_0x528bb9=as[_0x1184('0x6a')](_0x13b2ce,_0x50b46f['type'],_0x56192a);_0x45e9ab[_0x34f4c1](_0x528bb9[_0x1184('0x6c')],_0x528bb9[_0x1184('0x62')][_0x1184('0x6d')],_0x528bb9[_0x1184('0x62')][_0x1184('0x22')]);}break;case _0x1184('0x74'):_0x528bb9=as[_0x1184('0x6a')]('me',null,_0x56192a);_0x45e9ab[_0x34f4c1](_0x528bb9[_0x1184('0x6c')],_0x528bb9[_0x1184('0x62')][_0x1184('0x6d')],_0x528bb9[_0x1184('0x62')][_0x1184('0x22')]);break;}}else{var _0x528bb9=as[_0x1184('0x6a')](_0x13b2ce,_0x50b46f[_0x1184('0x6b')],_0x56192a);_0x45e9ab[_0x34f4c1](_0x528bb9[_0x1184('0x6c')],_0x528bb9[_0x1184('0x62')][_0x1184('0x6d')],_0x528bb9['value']['end']);}}}else{var _0x224d91=_(_0x3fb3b9['query'])['keys']()['map'](function(_0x27726d){return _[_0x1184('0x75')](_0x36e068,['name',_0x27726d])?_0x27726d:undefined;})[_0x1184('0x76')]()[_0x1184('0x62')]();if(!_[_0x1184('0x77')](_0x224d91)){_0x224d91['forEach'](function(_0x32cb61){if(_0x32cb61===_0x1184('0x78')){_0x4573a0[_0x1184('0x47')]('i.WhatsappAccountId\x20IN\x20?',[][_0x1184('0x79')](_0x3fb3b9[_0x1184('0x3d')][_0x32cb61]));}else if(_0x32cb61===_0x1184('0x7a')){var _0x2940dc=JSON['parse'](_0x3fb3b9[_0x1184('0x3d')][_0x32cb61])[_0x1184('0x7b')];var _0x3b447e=JSON[_0x1184('0x7c')](_0x3fb3b9['query'][_0x32cb61])[_0x1184('0x7d')];_0x4573a0[_0x1184('0x47')](_0x1184('0x7e'),_0x2940dc,_0x3b447e);}else{if(_0x3fb3b9[_0x1184('0x3d')][_0x32cb61]===_0x1184('0x7f')){_0x4573a0[_0x1184('0x47')]('i.'+_0x32cb61+_0x1184('0x80'));}else{_0x4573a0[_0x1184('0x47')]('i.'+_0x32cb61+_0x1184('0x81'),_0x3fb3b9[_0x1184('0x3d')][_0x32cb61]);}}});}if(_0x3fb3b9['query'][_0x1184('0x82')]){if(_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x82')]==0x1){_0x4573a0['having'](_0x1184('0x83'));}else{_0x4573a0[_0x1184('0x84')](_0x1184('0x85'));}}if(_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x86')]){_0x342cd8=_[_0x1184('0x87')](_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x86')])?_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x86')]:new Array(_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x86')]);_0x342cd8[_0x1184('0x33')](function(_0x103513){_0x2ca7d1['or'](_0x1184('0x88'),'%,'+_0x103513+',%');});}if(_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x89')]){var _0x3cc1ef=_0x3fb3b9[_0x1184('0x3d')]['filter']['replace']('\x5c','\x5c\x5c')[_0x1184('0x8a')](/'/g,'\x27\x27');if(qs[_0x1184('0x8b')](_0x3cc1ef)){_0x45e9ab['or'](_0x1184('0x8c'),_0x3cc1ef+'%')['or'](_0x1184('0x8d'),_0x3cc1ef+'%');}else{_0x45e9ab['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3cc1ef))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x3cc1ef+'%');}}}_0x4573a0[_0x1184('0x47')](_0x45e9ab);_0x4573a0['group'](_0x1184('0x8e'));var _0x113599={'type':db[_0x1184('0x8f')][_0x1184('0x90')][_0x1184('0x91')],'raw':!![]};var _0x5e7c37=_0x4573a0[_0x1184('0x92')]();_0x5e7c37['field'](_0x1184('0x8e'));_0x5e7c37[_0x1184('0x4a')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1184('0x61'));if(_0x1ce233['order']){_0x1ce233[_0x1184('0x45')][_0x1184('0x33')](function(_0x439c7b){var _0x235482=_0x439c7b[0x0]===_0x1184('0x93')?_0x439c7b[0x0]:'i.'+_0x439c7b[0x0];_0x4573a0[_0x1184('0x45')](_0x235482,_0x439c7b[0x1]==='DESC'?![]:!![]);});}if(!_[_0x1184('0x77')](_0x342cd8)){_0x4573a0[_0x1184('0x84')](_0x2ca7d1);_0x5e7c37[_0x1184('0x47')](_0x1184('0x94'),_0x342cd8);}BPromise['resolve']()[_0x1184('0x2b')](function(){if(!_0x495bc1){if(_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x78')])return;_0x5e7c37[_0x1184('0x47')](_0x1184('0x95'));_0x4573a0[_0x1184('0x47')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x3fb3b9[_0x1184('0x96')][_0x1184('0x97')]!==_0x1184('0x98'))return;return _0x3fb3b9[_0x1184('0x96')][_0x1184('0x99')]({'attributes':['id'],'raw':!![]})[_0x1184('0x2b')](function(_0x3b6b14){if(_[_0x1184('0x77')](_0x3b6b14)){_0x5e7c37['where']('i.WhatsappAccountId\x20IS\x20NULL');_0x4573a0[_0x1184('0x47')](_0x1184('0x9a'));}else{_0x5e7c37[_0x1184('0x47')](_0x1184('0x9b'),_['map'](_0x3b6b14,'id'));_0x4573a0['where']('i.WhatsappAccountId\x20IN\x20?',_['map'](_0x3b6b14,'id'));}});})[_0x1184('0x2b')](function(){if(_0x3fb3b9[_0x1184('0x96')][_0x1184('0x97')]===_0x1184('0x98')&&!_0x495bc1&&!_0x3fb3b9[_0x1184('0x3d')][_0x1184('0x78')])return[];return db[_0x1184('0x9c')]['query'](_0x5e7c37[_0x1184('0x9d')](),_0x113599);})['then'](function(_0x50a025){_0x10b87a['count']=_0x50a025[_0x1184('0x42')];if(_0x10b87a[_0x1184('0x26')]===0x0)return[];return db[_0x1184('0x9c')]['query'](_0x420864[_0x1184('0x9d')](),_0x113599)[_0x1184('0x2b')](function(_0x408fa6){_0x156b6c=_[_0x1184('0x9e')](_0x408fa6,'id');_0x113599=_[_0x1184('0x9f')](_0x113599,{'model':db[_0x1184('0x38')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3fb3b9['query']['fields']){_0x1ce233['attributes'][_0x1184('0x33')](function(_0x4b4dec){_0x4573a0[_0x1184('0x4a')]('i.'+_0x4b4dec);});}else{_0x4573a0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1184('0x61'));_0x4573a0[_0x1184('0x4a')]('a.key','Account.key');_0x4573a0[_0x1184('0x4a')](_0x1184('0xa0'),_0x1184('0xa1'));_0x4573a0['field'](_0x1184('0xa2'),_0x1184('0x93'));_0x4573a0[_0x1184('0x4a')](_0x1184('0xa3'));_0x4573a0[_0x1184('0x4a')](_0x1184('0xa4'),_0x1184('0xa5'));_0x4573a0[_0x1184('0x4a')](_0x1184('0xa6'),_0x1184('0xa7'));_0x4573a0[_0x1184('0x4a')]('c.email',_0x1184('0xa8'));_0x4573a0['field'](_0x1184('0xa9'),_0x1184('0xaa'));_0x4573a0['field'](_0x1184('0xab'),_0x1184('0xac'));_0x4573a0[_0x1184('0x4a')]('c.fax',_0x1184('0xad'));_0x4573a0[_0x1184('0x4a')](_0x1184('0xae'),_0x1184('0xaf'));_0x4573a0[_0x1184('0x4a')](_0x1184('0xb0'),_0x1184('0xb1'));_0x4573a0[_0x1184('0x4a')](_0x1184('0xb2'),_0x1184('0x31'));}if(_0x1ce233[_0x1184('0x25')])_0x4573a0[_0x1184('0x25')](_0x1ce233[_0x1184('0x25')]);if(_0x1ce233[_0x1184('0x24')])_0x4573a0[_0x1184('0x24')](_0x1ce233[_0x1184('0x24')]);return db[_0x1184('0x9c')][_0x1184('0x3d')](_0x4573a0[_0x1184('0x9d')](),_0x113599);})[_0x1184('0x2b')](function(_0x717141){if(_0x717141[_0x1184('0x42')]>0x0)_0x17e2c9[_0x1184('0x47')]('ui.WhatsappInteractionId\x20IN\x20?',_['map'](_0x717141,'id'));return db['sequelize'][_0x1184('0x3d')](_0x17e2c9[_0x1184('0x9d')](),_0x113599)['then'](function(_0x34702f){var _0x41d761=_['groupBy'](_0x34702f,'WhatsappInteractionId');var _0x409178=[];_0x717141[_0x1184('0x33')](function(_0x575d9d){_0x409178[_0x1184('0x35')](updateWhatsappInteraction(_0x575d9d,_0x156b6c,_0x41d761));});return BPromise[_0x1184('0xb3')](_0x409178);});});})[_0x1184('0x2b')](function(_0x49463f){_0x10b87a['rows']=_0x49463f;return _0x10b87a;})[_0x1184('0x2b')](respondWithFilteredResult(_0x13a78e,_0x1ce233))['catch'](handleError(_0x13a78e,null));};exports[_0x1184('0xb4')]=function(_0x467972,_0x45920c){var _0x1ac485={'raw':![],'where':{'id':_0x467972[_0x1184('0xb5')]['id']}},_0x3e0ee6={};_0x3e0ee6[_0x1184('0x3b')]=_[_0x1184('0x3c')](db[_0x1184('0x38')][_0x1184('0xb6')]);_0x3e0ee6[_0x1184('0x3d')]=_[_0x1184('0x3c')](_0x467972[_0x1184('0x3d')]);_0x3e0ee6[_0x1184('0x3e')]=_[_0x1184('0x3f')](_0x3e0ee6[_0x1184('0x3b')],_0x3e0ee6[_0x1184('0x3d')]);_0x1ac485[_0x1184('0x41')]=_[_0x1184('0x3f')](_0x3e0ee6['model'],qs[_0x1184('0x40')](_0x467972[_0x1184('0x3d')][_0x1184('0x40')]));_0x1ac485[_0x1184('0x41')]=_0x1ac485['attributes']['length']?_0x1ac485['attributes']:_0x3e0ee6[_0x1184('0x3b')];if(_0x467972[_0x1184('0x3d')]['includeAll']){_0x1ac485['include']=[{'all':!![]}];}_0x1ac485=_['merge']({},_0x1ac485,_0x467972[_0x1184('0xb7')]);return db[_0x1184('0x38')][_0x1184('0x72')](_0x1ac485)[_0x1184('0x2b')](handleEntityNotFound(_0x45920c,null))[_0x1184('0x2b')](respondWithResult(_0x45920c,null))['catch'](handleError(_0x45920c,null));};exports[_0x1184('0xb8')]=function(_0x3709a2,_0x4166a6){return db['WhatsappInteraction'][_0x1184('0xb8')](_0x3709a2[_0x1184('0x74')],{})['then'](respondWithResult(_0x4166a6,0xc9))['catch'](handleError(_0x4166a6,null));};exports['update']=function(_0x24d07c,_0x2973a0){if(_0x24d07c[_0x1184('0x74')]['id']){delete _0x24d07c[_0x1184('0x74')]['id'];}return db[_0x1184('0x38')][_0x1184('0x72')]({'where':{'id':_0x24d07c[_0x1184('0xb5')]['id']}})[_0x1184('0x2b')](handleEntityNotFound(_0x2973a0,null))[_0x1184('0x2b')](saveUpdates(_0x24d07c[_0x1184('0x74')],null))['then'](respondWithResult(_0x2973a0,null))['catch'](handleError(_0x2973a0,null));};exports['destroy']=function(_0x17781c,_0x23c08c){return db[_0x1184('0x38')][_0x1184('0x72')]({'where':{'id':_0x17781c[_0x1184('0xb5')]['id']}})[_0x1184('0x2b')](handleEntityNotFound(_0x23c08c,null))[_0x1184('0x2b')](removeEntity(_0x23c08c,null))[_0x1184('0x36')](handleError(_0x23c08c,null));};exports[_0x1184('0xb9')]=function(_0x1fd65f,_0x21f603){return db[_0x1184('0x38')][_0x1184('0xb9')]()[_0x1184('0x2b')](respondWithResult(_0x21f603,null))['catch'](handleError(_0x21f603,null));};exports[_0x1184('0xba')]=function(_0x38894b,_0x10ddd7,_0x46bbb0){return db[_0x1184('0xbb')][_0x1184('0x72')]({'where':{'id':_0x38894b['params']['id']}})[_0x1184('0x2b')](handleEntityNotFound(_0x10ddd7,null))[_0x1184('0x2b')](function(_0x3b6a6b){if(_0x3b6a6b){return _0x3b6a6b[_0x1184('0xba')](_0x38894b[_0x1184('0x74')][_0x1184('0xbc')],_[_0x1184('0xbd')](_0x38894b[_0x1184('0x74')],[_0x1184('0xbc'),'id'])||{});}})['then'](respondWithResult(_0x10ddd7,null))[_0x1184('0x36')](handleError(_0x10ddd7,null));};exports[_0x1184('0xbe')]=function(_0x3c1a18,_0x7202ca,_0x1501ad){var _0x1aaaaf={'raw':![],'where':{}};var _0x20d93b={};var _0x4c29e3={'count':0x0,'rows':[]};return db[_0x1184('0x38')][_0x1184('0xbf')]({'where':{'id':_0x3c1a18[_0x1184('0xb5')]['id']}})['then'](handleEntityNotFound(_0x7202ca,null))[_0x1184('0x2b')](function(_0xec9d71){if(_0xec9d71){_0x20d93b[_0x1184('0x3b')]=_['keys'](db[_0x1184('0xbb')]['rawAttributes']);_0x20d93b[_0x1184('0x3d')]=_['keys'](_0x3c1a18[_0x1184('0x3d')]);_0x20d93b[_0x1184('0x3e')]=_[_0x1184('0x3f')](_0x20d93b['model'],_0x20d93b['query']);_0x1aaaaf[_0x1184('0x41')]=_[_0x1184('0x3f')](_0x20d93b['model'],qs['fields'](_0x3c1a18[_0x1184('0x3d')]['fields']));_0x1aaaaf[_0x1184('0x41')]=_0x1aaaaf[_0x1184('0x41')][_0x1184('0x42')]?_0x1aaaaf['attributes']:_0x20d93b[_0x1184('0x3b')];if(!_0x3c1a18[_0x1184('0x3d')][_0x1184('0x43')](_0x1184('0x44'))){_0x1aaaaf[_0x1184('0x25')]=qs[_0x1184('0x25')](_0x3c1a18['query']['limit']);_0x1aaaaf[_0x1184('0x24')]=qs['offset'](_0x3c1a18[_0x1184('0x3d')]['offset']);}_0x1aaaaf[_0x1184('0x45')]=qs['sort'](_0x3c1a18[_0x1184('0x3d')][_0x1184('0x46')]);_0x1aaaaf[_0x1184('0x47')]=qs[_0x1184('0x3e')](_[_0x1184('0x48')](_0x3c1a18[_0x1184('0x3d')],_0x20d93b['filters']));_0x1aaaaf[_0x1184('0x47')][_0x1184('0xc0')]=_0xec9d71['id'];if(_0x3c1a18[_0x1184('0x3d')][_0x1184('0x89')]){_0x1aaaaf[_0x1184('0x47')]=_[_0x1184('0x9f')](_0x1aaaaf[_0x1184('0x47')],{'$or':_[_0x1184('0x30')](_0x1aaaaf[_0x1184('0x41')],function(_0x16bd61){var _0x13eba5={};_0x13eba5[_0x16bd61]={'$like':'%'+_0x3c1a18[_0x1184('0x3d')]['filter']+'%'};return _0x13eba5;})});}if(_0x3c1a18[_0x1184('0x3d')][_0x1184('0x7b')]){var _0x1f4f16=_0x3c1a18[_0x1184('0x3d')]['$gte'][_0x1184('0x32')](',');var _0x21b13c={};_0x21b13c[_0x1f4f16[0x0]]={'$gte':moment(_0x1f4f16[0x1])['format'](_0x1184('0xc1'))};_0x1aaaaf['where']=_[_0x1184('0x9f')](_0x1aaaaf['where'],_0x21b13c);}_0x1aaaaf=_['merge']({},_0x1aaaaf,_0x3c1a18['options']);return db[_0x1184('0xbb')][_0x1184('0x26')]({'where':_0x1aaaaf[_0x1184('0x47')]})['then'](function(_0x1356e9){_0x4c29e3['count']=_0x1356e9;if(_0x3c1a18[_0x1184('0x3d')][_0x1184('0xc2')]){_0x1aaaaf[_0x1184('0xc3')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x1184('0xc4')](_0x1aaaaf);})[_0x1184('0x2b')](function(_0x3d529a){_0x4c29e3[_0x1184('0xc5')]=_0x3d529a;return _0x4c29e3;});}})[_0x1184('0x2b')](respondWithFilteredResult(_0x7202ca,_0x1aaaaf))['catch'](handleError(_0x7202ca,null));};exports[_0x1184('0xc6')]=function(_0x1c8ef4,_0x745ce9,_0x26ebf8){return db[_0x1184('0x38')]['find']({'where':{'id':_0x1c8ef4[_0x1184('0xb5')]['id']}})[_0x1184('0x2b')](handleEntityNotFound(_0x745ce9,null))[_0x1184('0x2b')](function(_0x1d4ae5){if(_0x1d4ae5){return _0x1d4ae5[_0x1184('0xc7')](_0x1c8ef4['body'][_0x1184('0xbc')],_['omit'](_0x1c8ef4[_0x1184('0x74')],[_0x1184('0xbc'),'id'])||{})[_0x1184('0xc8')](function(){return db[_0x1184('0x6e')][_0x1184('0xc4')]({'attributes':['id',_0x1184('0x2e'),_0x1184('0x4b')],'where':{'id':_0x1c8ef4[_0x1184('0x74')]['ids']}});})[_0x1184('0x2b')](function(_0x5b6a37){socket[_0x1184('0xc9')](_0x1184('0xca'),{'id':Number(_0x1c8ef4[_0x1184('0xb5')]['id']),'tags':_0x5b6a37||[]});return{'id':Number(_0x1c8ef4[_0x1184('0xb5')]['id']),'tags':_0x5b6a37||[]};});}})[_0x1184('0x2b')](respondWithResult(_0x745ce9,null))['catch'](handleError(_0x745ce9,null));};exports[_0x1184('0xcb')]=function(_0x3bfe9a,_0x228118,_0x3d7b9e){return db[_0x1184('0x38')][_0x1184('0x72')]({'where':{'id':_0x3bfe9a['params']['id']}})[_0x1184('0x2b')](handleEntityNotFound(_0x228118,null))[_0x1184('0x2b')](function(_0xe0fea3){if(_0xe0fea3){return _0xe0fea3[_0x1184('0xcb')](_0x3bfe9a[_0x1184('0x3d')][_0x1184('0xbc')]);}})[_0x1184('0x2b')](respondWithStatusCode(_0x228118,null))['catch'](handleError(_0x228118,null));};exports[_0x1184('0xcc')]=function(_0x438da9,_0x502ae4){var _0x556217=moment()[_0x1184('0xcd')]()[_0x1184('0x9d')]();var _0x463ecd=path[_0x1184('0xce')](config[_0x1184('0xcf')],_0x1184('0xd0'),_0x1184('0xd1'),_0x1184('0xd2'));var _0x1ab317=path[_0x1184('0xce')](config[_0x1184('0xcf')],_0x1184('0xd0'),_0x1184('0xd1'),_0x1184('0xd3'));var _0x3a08b0=path[_0x1184('0xce')](_0x463ecd,_0x556217);var _0x2652d5=util['format'](_0x1184('0xd4'),_0x438da9[_0x1184('0xb5')]['id'],_0x556217);var _0x534bd3=path[_0x1184('0xce')](_0x463ecd,_0x2652d5);var _0x44aa36=[];_0x44aa36[_0x1184('0x35')]({'model':db[_0x1184('0x70')],'as':_0x1184('0x70'),'attributes':['id',_0x1184('0xd5')],'raw':!![]});_0x44aa36[_0x1184('0x35')]({'model':db[_0x1184('0xd6')],'as':_0x1184('0x65'),'attributes':['id',_0x1184('0xd7'),'lastName'],'raw':!![]});if(_0x438da9[_0x1184('0x3d')][_0x1184('0xd3')]){_0x44aa36[_0x1184('0x35')]({'model':db['Attachment'],'as':_0x1184('0xd8'),'raw':!![]});}var _0x38bc78=[{'model':db[_0x1184('0xbb')],'as':_0x1184('0xd9'),'attributes':['id',_0x1184('0x74'),_0x1184('0x7a'),_0x1184('0xda'),'secret',_0x1184('0x82')],'include':_0x44aa36}];_0x38bc78[_0x1184('0x35')]({'model':db['WhatsappAccount'],'as':'Account','attributes':['id',_0x1184('0x2e')]});_0x38bc78[_0x1184('0x35')]({'model':db[_0x1184('0x70')],'as':_0x1184('0xdb'),'attributes':['id',_0x1184('0xd5')]});return db[_0x1184('0x38')][_0x1184('0x72')]({'where':{'id':_0x438da9['params']['id']},'include':_0x38bc78})[_0x1184('0x2b')](handleEntityNotFound(_0x502ae4,null))[_0x1184('0x2b')](function(_0x2ce297){if(_0x2ce297){var _0x1c085e=_0x2ce297[_0x1184('0xdc')]({'plain':!![]});fs[_0x1184('0xdd')](_0x3a08b0);var _0x5c54a0={'channel':_0x1184('0xde'),'account':_0x1c085e[_0x1184('0xdf')][_0x1184('0x2e')],'agent':_0x1c085e['Owner']?_0x1c085e[_0x1184('0xdb')][_0x1184('0xd5')]:'N.A.','createdAt':moment(_0x1c085e[_0x1184('0x7a')])[_0x1184('0xe0')](_0x1184('0xc1'))[_0x1184('0x9d')](),'closedAt':_0x1c085e['closed']?moment(_0x1c085e[_0x1184('0xe1')])[_0x1184('0xe0')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1184('0x9d')]():'','disposition':_0x1c085e[_0x1184('0xe2')],'messages':_(_0x1c085e[_0x1184('0xd9')])[_0x1184('0x89')]({'secret':![]})[_0x1184('0x30')](function(_0x43e9a3){if(_0x43e9a3[_0x1184('0xd8')]){var _0xe55db6=path[_0x1184('0xce')](_0x1ab317,_0x43e9a3[_0x1184('0xd8')]['basename']);if(fs[_0x1184('0xe3')](_0xe55db6)){fs[_0x1184('0xe4')](_0xe55db6)[_0x1184('0xe5')](fs[_0x1184('0xe6')](path[_0x1184('0xce')](_0x3a08b0,_0x43e9a3[_0x1184('0xd8')][_0x1184('0xe7')])));}}return{'date':moment(_0x43e9a3[_0x1184('0x7a')])['format'](_0x1184('0xc1'))['toString'](),'sender':_0x43e9a3[_0x1184('0xda')]===_0x1184('0xe8')?_0x43e9a3[_0x1184('0x70')]?_0x43e9a3[_0x1184('0x70')][_0x1184('0xd5')]:_0x1184('0xe9'):_0x43e9a3[_0x1184('0x65')]['firstName']+(_0x43e9a3[_0x1184('0x65')][_0x1184('0xea')]?'\x20'+_0x43e9a3[_0x1184('0x65')][_0x1184('0xea')]:''),'body':_0x43e9a3[_0x1184('0xd8')]?_0x43e9a3[_0x1184('0xd8')]['basename']:_0x43e9a3[_0x1184('0x74')],'direction':_0x43e9a3['direction']===_0x1184('0xe8')?'A':'C','secret':_0x43e9a3['secret'],'read':_0x43e9a3[_0x1184('0x82')],'attachment':_0x43e9a3[_0x1184('0xd8')]};})[_0x1184('0x62')]()};return ejs[_0x1184('0xeb')](path[_0x1184('0xce')](config[_0x1184('0xcf')],_0x1184('0xd0'),_0x1184('0xec'),_0x1184('0xed')),{'interaction':_0x5c54a0})['then'](function(_0x3f404a){var _0x588678=path[_0x1184('0xce')](_0x3a08b0,_0x1184('0xee')+_0x1c085e['id']+'-'+_0x556217+_0x1184('0xef'));var _0x5d0945={'path':_0x588678,'channel':_0x1184('0xde'),'interactionId':_0x1c085e['id']};return pdf[_0x1184('0xf0')](_0x3f404a,_0x5d0945);})[_0x1184('0x2b')](function(){return new BPromise(function(_0x5dd46a,_0x493844){zipdir(_0x3a08b0,{'saveTo':_0x534bd3},function(_0x553c34,_0x45bf45){if(_0x553c34)return _0x493844(_0x553c34);return _0x5dd46a(_0x45bf45);});})[_0x1184('0x2b')](function(){return new BPromise(function(_0x160a69,_0x352454){rimraf(_0x3a08b0,function(_0x11ed36){if(_0x11ed36)_0x352454(_0x11ed36);return _0x160a69();});});})[_0x1184('0x2b')](function(){return _0x502ae4[_0x1184('0xcc')](_0x534bd3,_0x2652d5,function(_0x4b3751){if(_0x4b3751){console[_0x1184('0xf1')]('err',_0x4b3751);}else{fs['unlinkSync'](_0x534bd3);}});});});}else{return _0x502ae4['sendStatus'](0xc8);}})[_0x1184('0x36')](handleError(_0x502ae4,null));}; \ No newline at end of file +var _0xcb70=['views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','download','log','err','unlinkSync','eml-format','rimraf','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','error','name','send','Users','map','fullname','Tags','split','forEach','push','TagIds','index','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','nolimit','sort','select','field','color','from','tools_tags','u.id','u.fullname','ui.WhatsappInteractionId','user_has_whatsapp_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','value','having','`\x20=\x200','`\x20>\x200','Contact','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','find','ContactId','buildExpression','text','Tag','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','compact','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','isEmpty','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','toString','sequelize','merge','fields','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','WhatsappInteractionId','all','rows','catch','params','WhatsappInteraction','includeAll','include','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','pick','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','whatsappInteractionTags:save','removeTags','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','firstName','lastName','Attachment','Messages','direction','secret','WhatsappAccount','Owner','get','Account','N.A.','format','closed','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','renderFile'];(function(_0x12d757,_0x49122f){var _0x6956d7=function(_0x47980a){while(--_0x47980a){_0x12d757['push'](_0x12d757['shift']());}};_0x6956d7(++_0x49122f);}(_0xcb70,0xf3));var _0x0cb7=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xcb70[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0x0cb7('0x0'));var rimraf=require(_0x0cb7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0cb7('0x2'));var Mustache=require(_0x0cb7('0x3'));var util=require(_0x0cb7('0x4'));var path=require(_0x0cb7('0x5'));var sox=require(_0x0cb7('0x6'));var csv=require(_0x0cb7('0x7'));var ejs=require(_0x0cb7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cb7('0x9'));var squel=require(_0x0cb7('0xa'));var crypto=require(_0x0cb7('0xb'));var jsforce=require(_0x0cb7('0xc'));var deskjs=require(_0x0cb7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0cb7('0xe'));var Redis=require(_0x0cb7('0xf'));var authService=require(_0x0cb7('0x10'));var qs=require(_0x0cb7('0x11'));var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x0cb7('0x12'));var hardwareService=require(_0x0cb7('0x13'));var logger=require(_0x0cb7('0x14'))('api');var utils=require(_0x0cb7('0x15'));var config=require(_0x0cb7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cb7('0x17'))['db'];config[_0x0cb7('0x18')]=_[_0x0cb7('0x19')](config[_0x0cb7('0x18')],{'host':_0x0cb7('0x1a'),'port':0x18eb});var socket=require(_0x0cb7('0x1b'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3eb702,_0x5a145f){_0x5a145f=_0x5a145f||0xcc;return function(_0x5e763f){if(_0x5e763f){return _0x3eb702[_0x0cb7('0x1c')](_0x5a145f);}return _0x3eb702[_0x0cb7('0x1d')](_0x5a145f)[_0x0cb7('0x1e')]();};}function respondWithResult(_0x516c38,_0x2f99ba){_0x2f99ba=_0x2f99ba||0xc8;return function(_0xe4179d){if(_0xe4179d){return _0x516c38[_0x0cb7('0x1d')](_0x2f99ba)[_0x0cb7('0x1f')](_0xe4179d);}};}function respondWithFilteredResult(_0x29c339,_0x3bf1ba){return function(_0x2325a1){if(_0x2325a1){var _0x3dd7cf=typeof _0x3bf1ba['offset']===_0x0cb7('0x20')&&typeof _0x3bf1ba[_0x0cb7('0x21')]===_0x0cb7('0x20');var _0x43db1c=_0x2325a1[_0x0cb7('0x22')];var _0x2bb3b0=_0x3dd7cf?0x0:_0x3bf1ba[_0x0cb7('0x23')];var _0x3bb7ae=_0x3dd7cf?_0x2325a1[_0x0cb7('0x22')]:_0x3bf1ba[_0x0cb7('0x23')]+_0x3bf1ba[_0x0cb7('0x21')];var _0x132940;if(_0x3bb7ae>=_0x43db1c){_0x3bb7ae=_0x43db1c;_0x132940=0xc8;}else{_0x132940=0xce;}_0x29c339[_0x0cb7('0x1d')](_0x132940);return _0x29c339['set'](_0x0cb7('0x24'),_0x2bb3b0+'-'+_0x3bb7ae+'/'+_0x43db1c)[_0x0cb7('0x1f')](_0x2325a1);}return null;};}function patchUpdates(_0x122cd3){return function(_0x2c5094){try{jsonpatch[_0x0cb7('0x25')](_0x2c5094,_0x122cd3,!![]);}catch(_0x48e9c3){return BPromise['reject'](_0x48e9c3);}return _0x2c5094[_0x0cb7('0x26')]();};}function saveUpdates(_0xeb8f94,_0x440709){return function(_0x5a9a44){if(_0x5a9a44){return _0x5a9a44[_0x0cb7('0x27')](_0xeb8f94)[_0x0cb7('0x28')](function(_0x4ed738){return _0x4ed738;});}return null;};}function removeEntity(_0x4df18b,_0x137de5){return function(_0x197dac){if(_0x197dac){return _0x197dac['destroy']()[_0x0cb7('0x28')](function(){_0x4df18b[_0x0cb7('0x1d')](0xcc)[_0x0cb7('0x1e')]();});}};}function handleEntityNotFound(_0x460e36,_0x3133d9){return function(_0x299a9d){if(!_0x299a9d){_0x460e36['sendStatus'](0x194);}return _0x299a9d;};}function handleError(_0x223304,_0x43c054){_0x43c054=_0x43c054||0x1f4;return function(_0xf85c9f){logger[_0x0cb7('0x29')](_0xf85c9f['stack']);if(_0xf85c9f[_0x0cb7('0x2a')]){delete _0xf85c9f[_0x0cb7('0x2a')];}_0x223304['status'](_0x43c054)[_0x0cb7('0x2b')](_0xf85c9f);};}function getInteractionUsers(_0x2cca12,_0x7face8){return new BPromise(function(_0x8e6c49,_0x470b8e){try{if(_0x7face8[_0x2cca12['id']]){_0x2cca12[_0x0cb7('0x2c')]=_[_0x0cb7('0x2d')](_0x7face8[_0x2cca12['id']],function(_0x584b40){return{'id':_0x584b40['id'],'fullname':_0x584b40[_0x0cb7('0x2e')]};});}}catch(_0x22dc07){_0x470b8e(_0x22dc07);}_0x8e6c49(_0x2cca12);});}function getInteractionTags(_0x14fdac,_0x592b00){return new BPromise(function(_0x29ef86,_0x37f485){try{if(_0x14fdac['TagIds']){_0x14fdac[_0x0cb7('0x2f')]=[];_0x14fdac['TagIds'][_0x0cb7('0x30')](',')[_0x0cb7('0x31')](function(_0x4c848d){_0x14fdac[_0x0cb7('0x2f')][_0x0cb7('0x32')](_0x592b00[_0x4c848d]);});}delete _0x14fdac[_0x0cb7('0x33')];}catch(_0x492756){_0x37f485(_0x492756);}_0x29ef86(_0x14fdac);});}function updateWhatsappInteraction(_0x380eb5,_0x30127f,_0xe5278d){return new BPromise(function(_0x3d511d,_0x421c24){return getInteractionUsers(_0x380eb5,_0xe5278d)[_0x0cb7('0x28')](function(_0x23f266){return getInteractionTags(_0x23f266,_0x30127f);})[_0x0cb7('0x28')](function(_0x5548a0){_0x3d511d(_0x5548a0);})['catch'](function(_0x39ddcb){_0x421c24(_0x39ddcb);});});}exports[_0x0cb7('0x34')]=function(_0x1c3064,_0x3b011b){var _0xf70c76={},_0x2b4f78={},_0x1a348f={'count':0x0,'rows':[]};var _0x30aaa1=_['map'](db['WhatsappInteraction'][_0x0cb7('0x35')],function(_0x3a2377){return{'name':_0x3a2377[_0x0cb7('0x36')],'type':_0x3a2377[_0x0cb7('0x37')][_0x0cb7('0x38')]};});_0x2b4f78[_0x0cb7('0x39')]=_['map'](_0x30aaa1,_0x0cb7('0x2a'));_0x2b4f78[_0x0cb7('0x3a')]=_[_0x0cb7('0x3b')](_0x1c3064[_0x0cb7('0x3a')]);_0x2b4f78[_0x0cb7('0x3c')]=_['intersection'](_0x2b4f78[_0x0cb7('0x39')],_0x2b4f78[_0x0cb7('0x3a')]);_0xf70c76[_0x0cb7('0x3d')]=_[_0x0cb7('0x3e')](_0x2b4f78[_0x0cb7('0x39')],qs['fields'](_0x1c3064['query']['fields']));_0xf70c76[_0x0cb7('0x3d')]=_0xf70c76[_0x0cb7('0x3d')]['length']?_0xf70c76['attributes']:_0x2b4f78[_0x0cb7('0x39')];if(!_0x1c3064[_0x0cb7('0x3a')][_0x0cb7('0x3f')](_0x0cb7('0x40'))){_0xf70c76[_0x0cb7('0x21')]=qs[_0x0cb7('0x21')](_0x1c3064[_0x0cb7('0x3a')][_0x0cb7('0x21')]);_0xf70c76[_0x0cb7('0x23')]=qs[_0x0cb7('0x23')](_0x1c3064[_0x0cb7('0x3a')]['offset']);}_0xf70c76['order']=qs[_0x0cb7('0x41')](_0x1c3064['query'][_0x0cb7('0x41')]);_0xf70c76['where']=qs['filters'](_['pick'](_0x1c3064[_0x0cb7('0x3a')],_0x2b4f78[_0x0cb7('0x3c')]),_0x30aaa1);var _0x151c87=[];var _0x37231a=squel[_0x0cb7('0x42')]()[_0x0cb7('0x43')]('id')[_0x0cb7('0x43')](_0x0cb7('0x2a'))[_0x0cb7('0x43')](_0x0cb7('0x44'))[_0x0cb7('0x45')](_0x0cb7('0x46'));var _0x1dddd0=squel[_0x0cb7('0x42')]()['field'](_0x0cb7('0x47'))['field'](_0x0cb7('0x48'))['field'](_0x0cb7('0x49'))['from'](_0x0cb7('0x4a'),'ui')[_0x0cb7('0x4b')](_0x0cb7('0x4c'),'u',_0x0cb7('0x4d'));var _0x28106b=squel[_0x0cb7('0x42')]()[_0x0cb7('0x45')]('whatsapp_interactions','i')[_0x0cb7('0x4b')](_0x0cb7('0x4e'),'c',_0x0cb7('0x4f'))['left_join'](_0x0cb7('0x4c'),'o',_0x0cb7('0x50'))[_0x0cb7('0x4b')](_0x0cb7('0x51'),'a',_0x0cb7('0x52'))[_0x0cb7('0x4b')](_0x0cb7('0x53'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x0cb7('0x4b')]('whatsapp_interaction_has_tags','it','it.WhatsappInteractionId\x20=\x20i.id')[_0x0cb7('0x4b')]('tools_tags','t',_0x0cb7('0x54'));var _0xaefee8=squel[_0x0cb7('0x55')]();var _0x134e28=[];var _0x528306=squel[_0x0cb7('0x55')]();var _0x530ec0;if(_0x1c3064['query'][_0x0cb7('0x56')]){_0x530ec0=as[_0x0cb7('0x57')](_0x1c3064['query']['search']);var _0x178ecc=_0x530ec0[_0x0cb7('0x58')];for(var _0x4b6f1a=0x0;_0x4b6f1a<_0x530ec0[_0x0cb7('0x59')][_0x0cb7('0x5a')];_0x4b6f1a++){var _0x1db874=_0x530ec0[_0x0cb7('0x59')][_0x4b6f1a];var _0x24f7f1='i';var _0x110f76=_['find'](_0x30aaa1,[_0x0cb7('0x2a'),_0x1db874['field']]);if(!_0x110f76){switch(_0x1db874[_0x0cb7('0x43')]){case'unreadMessages':if(_0x1db874[_0x0cb7('0x5b')]==0x1){_0x28106b[_0x0cb7('0x5c')]('`'+_0x1db874['field']+_0x0cb7('0x5d'));}else{_0x28106b[_0x0cb7('0x5c')]('`'+_0x1db874[_0x0cb7('0x43')]+_0x0cb7('0x5e'));}break;case _0x0cb7('0x5f'):if(_0x1db874['operator']===_0x0cb7('0x60')){if(_0x1db874[_0x0cb7('0x5b')]['split']('\x20')[_0x0cb7('0x5a')]>0x1){_0xaefee8[_0x178ecc](_0x0cb7('0x61'),qs[_0x0cb7('0x62')](_0x1db874[_0x0cb7('0x5b')]),null);}else{var _0x5f4698='%'+_0x1db874[_0x0cb7('0x5b')]+'%';_0xaefee8[_0x178ecc]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5f4698,_0x5f4698,_0x5f4698);}}else{_0x110f76=_[_0x0cb7('0x63')](_0x30aaa1,[_0x0cb7('0x2a'),_0x0cb7('0x64')]);_0x1db874[_0x0cb7('0x43')]='ContactId';_0x54db46=as[_0x0cb7('0x65')](_0x24f7f1,_0x110f76[_0x0cb7('0x37')],_0x1db874);_0xaefee8[_0x178ecc](_0x54db46[_0x0cb7('0x66')],_0x54db46[_0x0cb7('0x5b')]['start'],_0x54db46['value'][_0x0cb7('0x1e')]);}break;case _0x0cb7('0x67'):var _0x22d6a0=_0x1db874[_0x0cb7('0x5b')][_0x0cb7('0x30')](',')['map'](function(_0x16ba6e){return Number(_0x16ba6e);});_0x22d6a0[_0x0cb7('0x31')](function(_0x6ab7c7){_0x528306['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x6ab7c7+',%');});_0x134e28=_[_0x0cb7('0x68')](_0x134e28,_0x22d6a0);break;case _0x0cb7('0x69'):if(_0x1db874[_0x0cb7('0x6a')]===_0x0cb7('0x60')){_0xaefee8[_0x178ecc](_0x0cb7('0x6b'),'%'+_0x1db874[_0x0cb7('0x5b')]+'%',null);}else{_0x110f76=_['find'](_0x30aaa1,[_0x0cb7('0x2a'),_0x0cb7('0x6c')]);_0x1db874[_0x0cb7('0x43')]='UserId';_0x54db46=as[_0x0cb7('0x65')](_0x24f7f1,_0x110f76[_0x0cb7('0x37')],_0x1db874);_0xaefee8[_0x178ecc](_0x54db46[_0x0cb7('0x66')],_0x54db46[_0x0cb7('0x5b')][_0x0cb7('0x6d')],_0x54db46[_0x0cb7('0x5b')]['end']);}break;case _0x0cb7('0x6e'):_0x54db46=as[_0x0cb7('0x65')]('me',null,_0x1db874);_0xaefee8[_0x178ecc](_0x54db46['text'],_0x54db46['value'][_0x0cb7('0x6d')],_0x54db46[_0x0cb7('0x5b')][_0x0cb7('0x1e')]);break;}}else{var _0x54db46=as[_0x0cb7('0x65')](_0x24f7f1,_0x110f76[_0x0cb7('0x37')],_0x1db874);_0xaefee8[_0x178ecc](_0x54db46[_0x0cb7('0x66')],_0x54db46['value'][_0x0cb7('0x6d')],_0x54db46[_0x0cb7('0x5b')][_0x0cb7('0x1e')]);}}}else{var _0x6fae86=_(_0x1c3064['query'])[_0x0cb7('0x3b')]()['map'](function(_0x16ae46){return _['some'](_0x30aaa1,['name',_0x16ae46])?_0x16ae46:undefined;})[_0x0cb7('0x6f')]()[_0x0cb7('0x5b')]();if(!_['isEmpty'](_0x6fae86)){_0x6fae86[_0x0cb7('0x31')](function(_0x271def){if(_0x271def===_0x0cb7('0x70')){_0x28106b['where'](_0x0cb7('0x71'),[][_0x0cb7('0x72')](_0x1c3064[_0x0cb7('0x3a')][_0x271def]));}else if(_0x271def==='createdAt'){var _0xce9b9e=JSON[_0x0cb7('0x73')](_0x1c3064[_0x0cb7('0x3a')][_0x271def])[_0x0cb7('0x74')];var _0x2f615d=JSON['parse'](_0x1c3064['query'][_0x271def])[_0x0cb7('0x75')];_0x28106b[_0x0cb7('0x76')](_0x0cb7('0x77'),_0xce9b9e,_0x2f615d);}else{if(_0x1c3064[_0x0cb7('0x3a')][_0x271def]===_0x0cb7('0x78')){_0x28106b['where']('i.'+_0x271def+'\x20IS\x20NULL');}else{_0x28106b[_0x0cb7('0x76')]('i.'+_0x271def+_0x0cb7('0x79'),_0x1c3064[_0x0cb7('0x3a')][_0x271def]);}}});}if(_0x1c3064[_0x0cb7('0x3a')]['read']){if(_0x1c3064['query'][_0x0cb7('0x7a')]==0x1){_0x28106b['having'](_0x0cb7('0x7b'));}else{_0x28106b[_0x0cb7('0x5c')]('`unreadMessages`\x20>\x200');}}if(_0x1c3064['query'][_0x0cb7('0x7c')]){_0x134e28=_[_0x0cb7('0x7d')](_0x1c3064[_0x0cb7('0x3a')]['tag'])?_0x1c3064[_0x0cb7('0x3a')][_0x0cb7('0x7c')]:new Array(_0x1c3064['query'][_0x0cb7('0x7c')]);_0x134e28[_0x0cb7('0x31')](function(_0x3a0a1d){_0x528306['or'](_0x0cb7('0x7e'),'%,'+_0x3a0a1d+',%');});}if(_0x1c3064[_0x0cb7('0x3a')][_0x0cb7('0x7f')]){var _0x5594b3=_0x1c3064[_0x0cb7('0x3a')]['filter'][_0x0cb7('0x80')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x0cb7('0x81')](_0x5594b3)){_0xaefee8['or']('i.id\x20LIKE\x20?',_0x5594b3+'%')['or'](_0x0cb7('0x82'),_0x5594b3+'%');}else{_0xaefee8['or'](_0x0cb7('0x83'),qs['getFullTextValue'](_0x5594b3))['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x5594b3+'%');}}}_0x28106b[_0x0cb7('0x76')](_0xaefee8);_0x28106b[_0x0cb7('0x84')]('i.id');var _0xde01f4={'type':db['Sequelize'][_0x0cb7('0x85')][_0x0cb7('0x86')],'raw':!![]};var _0xbcd513=_0x28106b[_0x0cb7('0x87')]();_0xbcd513['field'](_0x0cb7('0x88'));_0xbcd513[_0x0cb7('0x43')](_0x0cb7('0x89'),_0x0cb7('0x8a'));if(_0xf70c76['order']){_0xf70c76[_0x0cb7('0x8b')][_0x0cb7('0x31')](function(_0x48f8e2){var _0x45bb45=_0x48f8e2[0x0]===_0x0cb7('0x8c')?_0x48f8e2[0x0]:'i.'+_0x48f8e2[0x0];_0x28106b[_0x0cb7('0x8b')](_0x45bb45,_0x48f8e2[0x1]==='DESC'?![]:!![]);});}if(!_[_0x0cb7('0x8d')](_0x134e28)){_0x28106b[_0x0cb7('0x5c')](_0x528306);_0xbcd513[_0x0cb7('0x76')]('t.id\x20IN\x20?',_0x134e28);}BPromise[_0x0cb7('0x8e')]()[_0x0cb7('0x28')](function(){if(!_0x530ec0){if(_0x1c3064[_0x0cb7('0x3a')][_0x0cb7('0x70')])return;_0xbcd513[_0x0cb7('0x76')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x28106b['where'](_0x0cb7('0x8f'));return;}if(_0x1c3064[_0x0cb7('0x90')][_0x0cb7('0x91')]!==_0x0cb7('0x92'))return;return _0x1c3064[_0x0cb7('0x90')][_0x0cb7('0x93')]({'attributes':['id'],'raw':!![]})[_0x0cb7('0x28')](function(_0x5cebaf){if(_[_0x0cb7('0x8d')](_0x5cebaf)){_0xbcd513['where'](_0x0cb7('0x94'));_0x28106b[_0x0cb7('0x76')](_0x0cb7('0x94'));}else{_0xbcd513['where']('i.WhatsappAccountId\x20IN\x20?',_[_0x0cb7('0x2d')](_0x5cebaf,'id'));_0x28106b[_0x0cb7('0x76')](_0x0cb7('0x71'),_[_0x0cb7('0x2d')](_0x5cebaf,'id'));}});})[_0x0cb7('0x28')](function(){if(_0x1c3064[_0x0cb7('0x90')][_0x0cb7('0x91')]===_0x0cb7('0x92')&&!_0x530ec0&&!_0x1c3064[_0x0cb7('0x3a')]['WhatsappAccountId'])return[];return db['sequelize'][_0x0cb7('0x3a')](_0xbcd513[_0x0cb7('0x95')](),_0xde01f4);})['then'](function(_0x2e8223){_0x1a348f[_0x0cb7('0x22')]=_0x2e8223[_0x0cb7('0x5a')];if(_0x1a348f[_0x0cb7('0x22')]===0x0)return[];return db[_0x0cb7('0x96')][_0x0cb7('0x3a')](_0x37231a[_0x0cb7('0x95')](),_0xde01f4)['then'](function(_0x58ae0e){_0x151c87=_['keyBy'](_0x58ae0e,'id');_0xde01f4=_[_0x0cb7('0x97')](_0xde01f4,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1c3064[_0x0cb7('0x3a')][_0x0cb7('0x98')]){_0xf70c76[_0x0cb7('0x3d')][_0x0cb7('0x31')](function(_0x378974){_0x28106b['field']('i.'+_0x378974);});}else{_0x28106b[_0x0cb7('0x43')](_0x0cb7('0x89'),_0x0cb7('0x8a'));_0x28106b['field'](_0x0cb7('0x99'),_0x0cb7('0x9a'));_0x28106b[_0x0cb7('0x43')](_0x0cb7('0x9b'),'Account.mandatoryDisposition');_0x28106b[_0x0cb7('0x43')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');_0x28106b[_0x0cb7('0x43')](_0x0cb7('0x9c'));_0x28106b[_0x0cb7('0x43')](_0x0cb7('0x9d'),'Contact.firstName');_0x28106b[_0x0cb7('0x43')](_0x0cb7('0x9e'),_0x0cb7('0x9f'));_0x28106b[_0x0cb7('0x43')](_0x0cb7('0xa0'),_0x0cb7('0xa1'));_0x28106b[_0x0cb7('0x43')]('c.phone','Contact.phone');_0x28106b[_0x0cb7('0x43')](_0x0cb7('0xa2'),_0x0cb7('0xa3'));_0x28106b[_0x0cb7('0x43')](_0x0cb7('0xa4'),_0x0cb7('0xa5'));_0x28106b[_0x0cb7('0x43')]('o.fullname','Owner.fullname');_0x28106b[_0x0cb7('0x43')](_0x0cb7('0xa6'),_0x0cb7('0xa7'));_0x28106b[_0x0cb7('0x43')](_0x0cb7('0xa8'),_0x0cb7('0x33'));}if(_0xf70c76[_0x0cb7('0x21')])_0x28106b[_0x0cb7('0x21')](_0xf70c76['limit']);if(_0xf70c76['offset'])_0x28106b['offset'](_0xf70c76[_0x0cb7('0x23')]);return db[_0x0cb7('0x96')]['query'](_0x28106b[_0x0cb7('0x95')](),_0xde01f4);})[_0x0cb7('0x28')](function(_0x1b8968){if(_0x1b8968['length']>0x0)_0x1dddd0[_0x0cb7('0x76')](_0x0cb7('0xa9'),_['map'](_0x1b8968,'id'));return db[_0x0cb7('0x96')]['query'](_0x1dddd0[_0x0cb7('0x95')](),_0xde01f4)[_0x0cb7('0x28')](function(_0x4bf743){var _0x502e59=_[_0x0cb7('0xaa')](_0x4bf743,_0x0cb7('0xab'));var _0x104e3d=[];_0x1b8968['forEach'](function(_0x538cae){_0x104e3d[_0x0cb7('0x32')](updateWhatsappInteraction(_0x538cae,_0x151c87,_0x502e59));});return BPromise[_0x0cb7('0xac')](_0x104e3d);});});})[_0x0cb7('0x28')](function(_0x57625f){_0x1a348f[_0x0cb7('0xad')]=_0x57625f;return _0x1a348f;})[_0x0cb7('0x28')](respondWithFilteredResult(_0x3b011b,_0xf70c76))[_0x0cb7('0xae')](handleError(_0x3b011b,null));};exports['show']=function(_0x22e839,_0x899c60){var _0x33018e={'raw':![],'where':{'id':_0x22e839[_0x0cb7('0xaf')]['id']}},_0x4e9c0d={};_0x4e9c0d[_0x0cb7('0x39')]=_['keys'](db[_0x0cb7('0xb0')]['rawAttributes']);_0x4e9c0d['query']=_[_0x0cb7('0x3b')](_0x22e839[_0x0cb7('0x3a')]);_0x4e9c0d[_0x0cb7('0x3c')]=_['intersection'](_0x4e9c0d[_0x0cb7('0x39')],_0x4e9c0d[_0x0cb7('0x3a')]);_0x33018e['attributes']=_[_0x0cb7('0x3e')](_0x4e9c0d['model'],qs[_0x0cb7('0x98')](_0x22e839['query']['fields']));_0x33018e['attributes']=_0x33018e[_0x0cb7('0x3d')][_0x0cb7('0x5a')]?_0x33018e[_0x0cb7('0x3d')]:_0x4e9c0d[_0x0cb7('0x39')];if(_0x22e839[_0x0cb7('0x3a')][_0x0cb7('0xb1')]){_0x33018e[_0x0cb7('0xb2')]=[{'all':!![]}];}_0x33018e=_['merge']({},_0x33018e,_0x22e839[_0x0cb7('0xb3')]);return db['WhatsappInteraction'][_0x0cb7('0x63')](_0x33018e)[_0x0cb7('0x28')](handleEntityNotFound(_0x899c60,null))[_0x0cb7('0x28')](respondWithResult(_0x899c60,null))[_0x0cb7('0xae')](handleError(_0x899c60,null));};exports['create']=function(_0x23fdf9,_0x186249){return db['WhatsappInteraction'][_0x0cb7('0xb4')](_0x23fdf9[_0x0cb7('0x6e')],{})[_0x0cb7('0x28')](respondWithResult(_0x186249,0xc9))[_0x0cb7('0xae')](handleError(_0x186249,null));};exports[_0x0cb7('0x27')]=function(_0x5e3b5b,_0x99c49c){if(_0x5e3b5b[_0x0cb7('0x6e')]['id']){delete _0x5e3b5b[_0x0cb7('0x6e')]['id'];}return db[_0x0cb7('0xb0')][_0x0cb7('0x63')]({'where':{'id':_0x5e3b5b['params']['id']}})[_0x0cb7('0x28')](handleEntityNotFound(_0x99c49c,null))[_0x0cb7('0x28')](saveUpdates(_0x5e3b5b[_0x0cb7('0x6e')],null))['then'](respondWithResult(_0x99c49c,null))[_0x0cb7('0xae')](handleError(_0x99c49c,null));};exports['destroy']=function(_0x5282fb,_0x2fa3f1){return db[_0x0cb7('0xb0')][_0x0cb7('0x63')]({'where':{'id':_0x5282fb[_0x0cb7('0xaf')]['id']}})[_0x0cb7('0x28')](handleEntityNotFound(_0x2fa3f1,null))[_0x0cb7('0x28')](removeEntity(_0x2fa3f1,null))[_0x0cb7('0xae')](handleError(_0x2fa3f1,null));};exports['describe']=function(_0x50f586,_0x3f2e3f){return db['WhatsappInteraction'][_0x0cb7('0xb5')]()[_0x0cb7('0x28')](respondWithResult(_0x3f2e3f,null))[_0x0cb7('0xae')](handleError(_0x3f2e3f,null));};exports[_0x0cb7('0xb6')]=function(_0x3bf90d,_0x26c2df,_0x13e957){return db[_0x0cb7('0xb7')][_0x0cb7('0x63')]({'where':{'id':_0x3bf90d[_0x0cb7('0xaf')]['id']}})[_0x0cb7('0x28')](handleEntityNotFound(_0x26c2df,null))['then'](function(_0x12caa6){if(_0x12caa6){return _0x12caa6['addMessage'](_0x3bf90d[_0x0cb7('0x6e')][_0x0cb7('0xb8')],_[_0x0cb7('0xb9')](_0x3bf90d[_0x0cb7('0x6e')],[_0x0cb7('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x26c2df,null))[_0x0cb7('0xae')](handleError(_0x26c2df,null));};exports[_0x0cb7('0xba')]=function(_0x1958d8,_0x51764a,_0x22b7f){var _0x3f8af5={'raw':![],'where':{}};var _0x513b66={};var _0xb0aff3={'count':0x0,'rows':[]};return db[_0x0cb7('0xb0')]['findOne']({'where':{'id':_0x1958d8[_0x0cb7('0xaf')]['id']}})[_0x0cb7('0x28')](handleEntityNotFound(_0x51764a,null))['then'](function(_0x3b0050){if(_0x3b0050){_0x513b66[_0x0cb7('0x39')]=_[_0x0cb7('0x3b')](db[_0x0cb7('0xb7')][_0x0cb7('0x35')]);_0x513b66[_0x0cb7('0x3a')]=_[_0x0cb7('0x3b')](_0x1958d8['query']);_0x513b66['filters']=_[_0x0cb7('0x3e')](_0x513b66['model'],_0x513b66[_0x0cb7('0x3a')]);_0x3f8af5[_0x0cb7('0x3d')]=_[_0x0cb7('0x3e')](_0x513b66[_0x0cb7('0x39')],qs[_0x0cb7('0x98')](_0x1958d8[_0x0cb7('0x3a')][_0x0cb7('0x98')]));_0x3f8af5[_0x0cb7('0x3d')]=_0x3f8af5[_0x0cb7('0x3d')][_0x0cb7('0x5a')]?_0x3f8af5['attributes']:_0x513b66['model'];if(!_0x1958d8['query']['hasOwnProperty'](_0x0cb7('0x40'))){_0x3f8af5['limit']=qs[_0x0cb7('0x21')](_0x1958d8['query'][_0x0cb7('0x21')]);_0x3f8af5['offset']=qs['offset'](_0x1958d8['query']['offset']);}_0x3f8af5[_0x0cb7('0x8b')]=qs[_0x0cb7('0x41')](_0x1958d8['query'][_0x0cb7('0x41')]);_0x3f8af5['where']=qs[_0x0cb7('0x3c')](_[_0x0cb7('0xbb')](_0x1958d8[_0x0cb7('0x3a')],_0x513b66['filters']));_0x3f8af5['where']['WhatsappInteractionId']=_0x3b0050['id'];if(_0x1958d8['query'][_0x0cb7('0x7f')]){_0x3f8af5[_0x0cb7('0x76')]=_[_0x0cb7('0x97')](_0x3f8af5[_0x0cb7('0x76')],{'$or':_[_0x0cb7('0x2d')](_0x3f8af5['attributes'],function(_0x25e2c0){var _0x23c8ee={};_0x23c8ee[_0x25e2c0]={'$like':'%'+_0x1958d8[_0x0cb7('0x3a')]['filter']+'%'};return _0x23c8ee;})});}if(_0x1958d8['query']['$gte']){var _0x2d3dd0=_0x1958d8['query'][_0x0cb7('0x74')][_0x0cb7('0x30')](',');var _0x5b9685={};_0x5b9685[_0x2d3dd0[0x0]]={'$gte':moment(_0x2d3dd0[0x1])['format'](_0x0cb7('0xbc'))};_0x3f8af5[_0x0cb7('0x76')]=_['merge'](_0x3f8af5[_0x0cb7('0x76')],_0x5b9685);}_0x3f8af5=_[_0x0cb7('0x97')]({},_0x3f8af5,_0x1958d8['options']);return db['WhatsappMessage'][_0x0cb7('0x22')]({'where':_0x3f8af5[_0x0cb7('0x76')]})[_0x0cb7('0x28')](function(_0x172636){_0xb0aff3['count']=_0x172636;if(_0x1958d8[_0x0cb7('0x3a')][_0x0cb7('0xb1')]){_0x3f8af5['include']=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x3f8af5);})[_0x0cb7('0x28')](function(_0x436e39){_0xb0aff3[_0x0cb7('0xad')]=_0x436e39;return _0xb0aff3;});}})[_0x0cb7('0x28')](respondWithFilteredResult(_0x51764a,_0x3f8af5))[_0x0cb7('0xae')](handleError(_0x51764a,null));};exports['addTags']=function(_0x5d201b,_0x978bf6,_0x33312b){return db['WhatsappInteraction'][_0x0cb7('0x63')]({'where':{'id':_0x5d201b[_0x0cb7('0xaf')]['id']}})[_0x0cb7('0x28')](handleEntityNotFound(_0x978bf6,null))[_0x0cb7('0x28')](function(_0x23b7a9){if(_0x23b7a9){return _0x23b7a9[_0x0cb7('0xbd')](_0x5d201b['body'][_0x0cb7('0xb8')],_[_0x0cb7('0xb9')](_0x5d201b[_0x0cb7('0x6e')],[_0x0cb7('0xb8'),'id'])||{})[_0x0cb7('0xbe')](function(){return db['Tag']['findAll']({'attributes':['id',_0x0cb7('0x2a'),_0x0cb7('0x44')],'where':{'id':_0x5d201b[_0x0cb7('0x6e')][_0x0cb7('0xb8')]}});})['then'](function(_0x19a01f){socket['emit'](_0x0cb7('0xbf'),{'id':Number(_0x5d201b[_0x0cb7('0xaf')]['id']),'tags':_0x19a01f||[]});return{'id':Number(_0x5d201b[_0x0cb7('0xaf')]['id']),'tags':_0x19a01f||[]};});}})[_0x0cb7('0x28')](respondWithResult(_0x978bf6,null))['catch'](handleError(_0x978bf6,null));};exports[_0x0cb7('0xc0')]=function(_0xc24027,_0x1b09e5,_0x4375ca){return db[_0x0cb7('0xb0')][_0x0cb7('0x63')]({'where':{'id':_0xc24027[_0x0cb7('0xaf')]['id']}})[_0x0cb7('0x28')](handleEntityNotFound(_0x1b09e5,null))[_0x0cb7('0x28')](function(_0x314ff7){if(_0x314ff7){return _0x314ff7['removeTags'](_0xc24027['query']['ids']);}})[_0x0cb7('0x28')](respondWithStatusCode(_0x1b09e5,null))['catch'](handleError(_0x1b09e5,null));};exports['download']=function(_0xa79955,_0x1ddbce){var _0x1e0621=moment()[_0x0cb7('0xc1')]()[_0x0cb7('0x95')]();var _0x1c60e6=path[_0x0cb7('0xc2')](config[_0x0cb7('0xc3')],_0x0cb7('0xc4'),_0x0cb7('0xc5'),_0x0cb7('0xc6'));var _0x21bfad=path[_0x0cb7('0xc2')](config[_0x0cb7('0xc3')],_0x0cb7('0xc4'),_0x0cb7('0xc5'),_0x0cb7('0xc7'));var _0x23f119=path['join'](_0x1c60e6,_0x1e0621);var _0x10f56e=util['format'](_0x0cb7('0xc8'),_0xa79955[_0x0cb7('0xaf')]['id'],_0x1e0621);var _0x47f430=path[_0x0cb7('0xc2')](_0x1c60e6,_0x10f56e);var _0x47ffe5=[];_0x47ffe5[_0x0cb7('0x32')]({'model':db[_0x0cb7('0x69')],'as':_0x0cb7('0x69'),'attributes':['id','fullname'],'raw':!![]});_0x47ffe5['push']({'model':db['CmContact'],'as':_0x0cb7('0x5f'),'attributes':['id',_0x0cb7('0xc9'),_0x0cb7('0xca')],'raw':!![]});if(_0xa79955[_0x0cb7('0x3a')][_0x0cb7('0xc7')]){_0x47ffe5[_0x0cb7('0x32')]({'model':db[_0x0cb7('0xcb')],'as':_0x0cb7('0xcb'),'raw':!![]});}var _0x57c223=[{'model':db[_0x0cb7('0xb7')],'as':_0x0cb7('0xcc'),'attributes':['id',_0x0cb7('0x6e'),'createdAt',_0x0cb7('0xcd'),_0x0cb7('0xce'),'read'],'include':_0x47ffe5}];_0x57c223[_0x0cb7('0x32')]({'model':db[_0x0cb7('0xcf')],'as':'Account','attributes':['id',_0x0cb7('0x2a')]});_0x57c223[_0x0cb7('0x32')]({'model':db[_0x0cb7('0x69')],'as':_0x0cb7('0xd0'),'attributes':['id',_0x0cb7('0x2e')]});return db[_0x0cb7('0xb0')]['find']({'where':{'id':_0xa79955[_0x0cb7('0xaf')]['id']},'include':_0x57c223})[_0x0cb7('0x28')](handleEntityNotFound(_0x1ddbce,null))[_0x0cb7('0x28')](function(_0x18131c){if(_0x18131c){var _0x4e8b5b=_0x18131c[_0x0cb7('0xd1')]({'plain':!![]});fs['mkdirSync'](_0x23f119);var _0x14ed18={'channel':'Whatsapp','account':_0x4e8b5b[_0x0cb7('0xd2')][_0x0cb7('0x2a')],'agent':_0x4e8b5b[_0x0cb7('0xd0')]?_0x4e8b5b['Owner']['fullname']:_0x0cb7('0xd3'),'createdAt':moment(_0x4e8b5b['createdAt'])[_0x0cb7('0xd4')](_0x0cb7('0xbc'))[_0x0cb7('0x95')](),'closedAt':_0x4e8b5b[_0x0cb7('0xd5')]?moment(_0x4e8b5b['closedAt'])['format'](_0x0cb7('0xbc'))[_0x0cb7('0x95')]():'','disposition':_0x4e8b5b[_0x0cb7('0xd6')],'messages':_(_0x4e8b5b['Messages'])[_0x0cb7('0x7f')]({'secret':![]})['map'](function(_0x58f582){if(_0x58f582['Attachment']){var _0x3db47d=path['join'](_0x21bfad,_0x58f582[_0x0cb7('0xcb')]['basename']);if(fs[_0x0cb7('0xd7')](_0x3db47d)){fs[_0x0cb7('0xd8')](_0x3db47d)[_0x0cb7('0xd9')](fs[_0x0cb7('0xda')](path['join'](_0x23f119,_0x58f582['Attachment'][_0x0cb7('0xdb')])));}}return{'date':moment(_0x58f582['createdAt'])[_0x0cb7('0xd4')](_0x0cb7('0xbc'))[_0x0cb7('0x95')](),'sender':_0x58f582['direction']===_0x0cb7('0xdc')?_0x58f582['User']?_0x58f582[_0x0cb7('0x69')][_0x0cb7('0x2e')]:_0x0cb7('0xdd'):_0x58f582['Contact'][_0x0cb7('0xc9')]+(_0x58f582[_0x0cb7('0x5f')][_0x0cb7('0xca')]?'\x20'+_0x58f582['Contact'][_0x0cb7('0xca')]:''),'body':_0x58f582[_0x0cb7('0xcb')]?_0x58f582['Attachment'][_0x0cb7('0xdb')]:_0x58f582[_0x0cb7('0x6e')],'direction':_0x58f582[_0x0cb7('0xcd')]===_0x0cb7('0xdc')?'A':'C','secret':_0x58f582['secret'],'read':_0x58f582[_0x0cb7('0x7a')],'attachment':_0x58f582[_0x0cb7('0xcb')]};})[_0x0cb7('0x5b')]()};return ejs[_0x0cb7('0xde')](path[_0x0cb7('0xc2')](config['root'],_0x0cb7('0xc4'),_0x0cb7('0xdf'),_0x0cb7('0xe0')),{'interaction':_0x14ed18})[_0x0cb7('0x28')](function(_0x45dda1){var _0x1c16dc=path[_0x0cb7('0xc2')](_0x23f119,_0x0cb7('0xe1')+_0x4e8b5b['id']+'-'+_0x1e0621+_0x0cb7('0xe2'));var _0x43f63c={'path':_0x1c16dc,'channel':_0x0cb7('0xe3'),'interactionId':_0x4e8b5b['id']};return pdf[_0x0cb7('0xe4')](_0x45dda1,_0x43f63c);})['then'](function(){return new BPromise(function(_0x2e3461,_0x261e50){zipdir(_0x23f119,{'saveTo':_0x47f430},function(_0x3979f1,_0x527ebd){if(_0x3979f1)return _0x261e50(_0x3979f1);return _0x2e3461(_0x527ebd);});})[_0x0cb7('0x28')](function(){return new BPromise(function(_0x3ea8a2,_0x326874){rimraf(_0x23f119,function(_0x4becef){if(_0x4becef)_0x326874(_0x4becef);return _0x3ea8a2();});});})[_0x0cb7('0x28')](function(){return _0x1ddbce[_0x0cb7('0xe5')](_0x47f430,_0x10f56e,function(_0xd0ec21){if(_0xd0ec21){console[_0x0cb7('0xe6')](_0x0cb7('0xe7'),_0xd0ec21);}else{fs[_0x0cb7('0xe8')](_0x47f430);}});});});}else{return _0x1ddbce[_0x0cb7('0x1c')](0xc8);}})[_0x0cb7('0xae')](handleError(_0x1ddbce,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index ab35151..d87b8aa 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 _0xd52a=['map','length','emit','catch','../../mysqldb','WhatsappMessage','setMaxListeners','update','remove','then','setDataValue'];(function(_0x4af064,_0xb5016b){var _0x5034fe=function(_0x2d477f){while(--_0x2d477f){_0x4af064['push'](_0x4af064['shift']());}};_0x5034fe(++_0xb5016b);}(_0xd52a,0xca));var _0xad52=function(_0xc37100,_0x508a23){_0xc37100=_0xc37100-0x0;var _0x1c5766=_0xd52a[_0xc37100];return _0x1c5766;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xad52('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xad52('0x0'))['db'][_0xad52('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xad52('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xad52('0x3'),'afterDestroy':_0xad52('0x4')};function emitEvent(_0x130d6d){return function(_0x27cbf3,_0x4ed1e9,_0x525806){_0x27cbf3['getUsers']({'attributes':['id'],'raw':!![]})[_0xad52('0x5')](function(_0x55f7a7){_0x27cbf3[_0xad52('0x6')]('Users',_0x55f7a7[_0xad52('0x7')](function(_0x4244f3){return{'id':_0x4244f3['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x27cbf3['id'],'direction':'in','read':![]},'raw':!![]});})[_0xad52('0x5')](function(_0x47db32){_0x27cbf3[_0xad52('0x6')]('unreadMessages',_0x47db32[_0xad52('0x8')]);WhatsappInteractionEvents[_0xad52('0x9')](_0x130d6d+':'+_0x27cbf3['id'],_0x27cbf3);WhatsappInteractionEvents[_0xad52('0x9')](_0x130d6d,_0x27cbf3);_0x525806(null);})[_0xad52('0xa')](_0x525806(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x4ef1=['update','remove','then','Users','map','findAll','setDataValue','length','emit','catch','exports','events','../../mysqldb','WhatsappMessage','setMaxListeners','save'];(function(_0x10a985,_0x2c5252){var _0x46f374=function(_0xf636b4){while(--_0xf636b4){_0x10a985['push'](_0x10a985['shift']());}};_0x46f374(++_0x2c5252);}(_0x4ef1,0xeb));var _0x14ef=function(_0xedc5db,_0x210b81){_0xedc5db=_0xedc5db-0x0;var _0x319879=_0x4ef1[_0xedc5db];return _0x319879;};'use strict';var EventEmitter=require(_0x14ef('0x0'));var WhatsappInteraction=require(_0x14ef('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x14ef('0x1'))['db'][_0x14ef('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x14ef('0x3')](0x0);var events={'afterCreate':_0x14ef('0x4'),'afterUpdate':_0x14ef('0x5'),'afterDestroy':_0x14ef('0x6')};function emitEvent(_0x2be867){return function(_0x289570,_0x27d703,_0x10ed4b){_0x289570['getUsers']({'attributes':['id'],'raw':!![]})[_0x14ef('0x7')](function(_0x2dc335){_0x289570['setDataValue'](_0x14ef('0x8'),_0x2dc335[_0x14ef('0x9')](function(_0x1f7950){return{'id':_0x1f7950['id']};}));return WhatsappMessage[_0x14ef('0xa')]({'where':{'WhatsappInteractionId':_0x289570['id'],'direction':'in','read':![]},'raw':!![]});})[_0x14ef('0x7')](function(_0x59d889){_0x289570[_0x14ef('0xb')]('unreadMessages',_0x59d889[_0x14ef('0xc')]);WhatsappInteractionEvents[_0x14ef('0xd')](_0x2be867+':'+_0x289570['id'],_0x289570);WhatsappInteractionEvents[_0x14ef('0xd')](_0x2be867,_0x289570);_0x10ed4b(null);})[_0x14ef('0xe')](_0x10ed4b(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x14ef('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 323ac4c..38dab05 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 _0x37eb=['define','WhatsappInteraction','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes'];(function(_0x5c14f6,_0x2979d8){var _0x4949b3=function(_0xcc4206){while(--_0xcc4206){_0x5c14f6['push'](_0x5c14f6['shift']());}};_0x4949b3(++_0x2979d8);}(_0x37eb,0x124));var _0xb37e=function(_0x459286,_0x2eba3d){_0x459286=_0x459286-0x0;var _0x4d4c1a=_0x37eb[_0x459286];return _0x4d4c1a;};'use strict';var _=require(_0xb37e('0x0'));var util=require('util');var logger=require(_0xb37e('0x1'))(_0xb37e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb37e('0x3'));var fs=require('fs');var path=require(_0xb37e('0x4'));var rimraf=require(_0xb37e('0x5'));var config=require(_0xb37e('0x6'));var attributes=require(_0xb37e('0x7'));module['exports']=function(_0x4f0093,_0x90b931){return _0x4f0093[_0xb37e('0x8')](_0xb37e('0x9'),attributes,{'tableName':_0xb37e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x353cb0,_0x54931d,_0x2b3198){if(_0x353cb0[_0xb37e('0xb')]('closed')){_0x353cb0[_0xb37e('0xc')]=moment()[_0xb37e('0xd')](_0xb37e('0xe'));}_0x2b3198(null,_0x353cb0);}}});}; \ No newline at end of file +var _0xf04b=['define','WhatsappInteraction','changed','closedAt','../../config/logger','bluebird','request-promise','./whatsappInteraction.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xf04b,0x175));var _0xbf04=function(_0x331d1f,_0x54588f){_0x331d1f=_0x331d1f-0x0;var _0x3f58b9=_0xf04b[_0x331d1f];return _0x3f58b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbf04('0x0'))('api');var moment=require('moment');var BPromise=require(_0xbf04('0x1'));var rp=require(_0xbf04('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf04('0x3'));module[_0xbf04('0x4')]=function(_0x276b00,_0x217339){return _0x276b00[_0xbf04('0x5')](_0xbf04('0x6'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1efad8,_0x3ffa9f,_0x52e048){if(_0x1efad8[_0xbf04('0x7')]('closed')){_0x1efad8[_0xbf04('0x8')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x52e048(null,_0x1efad8);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index f8e6f09..00337f1 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 _0xe356=['raw','where','attributes','limit','UpdateWhatsappInteraction','debug','find','addTags','ids','omit','spread','AddTags','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','WhatsappInteraction','update','body','options'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xe356,0x164));var _0x6e35=function(_0x59e3ab,_0x3af278){_0x59e3ab=_0x59e3ab-0x0;var _0x46ce93=_0xe356[_0x59e3ab];return _0x46ce93;};'use strict';var _=require('lodash');var util=require(_0x6e35('0x0'));var moment=require(_0x6e35('0x1'));var BPromise=require('bluebird');var rs=require(_0x6e35('0x2'));var fs=require('fs');var Redis=require(_0x6e35('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6e35('0x4'));var config=require(_0x6e35('0x5'));var jayson=require(_0x6e35('0x6'));var client=jayson[_0x6e35('0x7')][_0x6e35('0x8')]({'port':0x232a});config[_0x6e35('0x9')]=_[_0x6e35('0xa')](config[_0x6e35('0x9')],{'host':_0x6e35('0xb'),'port':0x18eb});var socket=require(_0x6e35('0xc'))(new Redis(config[_0x6e35('0x9')]));require(_0x6e35('0xd'))[_0x6e35('0xe')](socket);function respondWithRpcPromise(_0x4c13ac,_0x350fdd,_0x15f7da){return new BPromise(function(_0x2fe272,_0x41cc8e){return client[_0x6e35('0xf')](_0x4c13ac,_0x15f7da)[_0x6e35('0x10')](function(_0x4d1971){logger[_0x6e35('0x11')](_0x6e35('0x12'),_0x350fdd,'request\x20sent');logger['debug'](_0x6e35('0x13'),_0x350fdd,_0x6e35('0x14'),JSON[_0x6e35('0x15')](_0x4d1971));if(_0x4d1971[_0x6e35('0x16')]){if(_0x4d1971[_0x6e35('0x16')][_0x6e35('0x17')]===0x1f4){logger['error'](_0x6e35('0x12'),_0x350fdd,_0x4d1971[_0x6e35('0x16')]['message']);return _0x41cc8e(_0x4d1971[_0x6e35('0x16')][_0x6e35('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x350fdd,_0x4d1971[_0x6e35('0x16')][_0x6e35('0x18')]);return _0x2fe272(_0x4d1971[_0x6e35('0x16')][_0x6e35('0x18')]);}else{logger[_0x6e35('0x11')](_0x6e35('0x12'),_0x350fdd,'request\x20sent');_0x2fe272(_0x4d1971[_0x6e35('0x19')][_0x6e35('0x18')]);}})[_0x6e35('0x1a')](function(_0x33f90e){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x350fdd,_0x33f90e);_0x41cc8e(_0x33f90e);});});}exports['UpdateWhatsappInteraction']=function(_0x5be612){var _0x1a829c=this;return new Promise(function(_0x2a840f,_0x692e5d){return db[_0x6e35('0x1b')][_0x6e35('0x1c')](_0x5be612[_0x6e35('0x1d')],{'raw':_0x5be612[_0x6e35('0x1e')]?_0x5be612[_0x6e35('0x1e')][_0x6e35('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5be612[_0x6e35('0x1e')]?_0x5be612[_0x6e35('0x1e')][_0x6e35('0x20')]||null:null,'attributes':_0x5be612[_0x6e35('0x1e')]?_0x5be612[_0x6e35('0x1e')][_0x6e35('0x21')]||null:null,'limit':_0x5be612[_0x6e35('0x1e')]?_0x5be612[_0x6e35('0x1e')][_0x6e35('0x22')]||null:null})[_0x6e35('0x10')](function(_0x36a46e){logger['info'](_0x6e35('0x23'),_0x5be612);logger[_0x6e35('0x24')](_0x6e35('0x23'),_0x5be612,JSON['stringify'](_0x36a46e));_0x2a840f(_0x36a46e);})[_0x6e35('0x1a')](function(_0x4b827c){logger[_0x6e35('0x16')]('UpdateWhatsappInteraction',_0x4b827c['message'],_0x5be612);_0x692e5d(_0x1a829c['error'](0x1f4,_0x4b827c[_0x6e35('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2a1d75){return new Promise(function(_0x2fa7c4,_0x24498f){return db['WhatsappInteraction'][_0x6e35('0x25')]({'where':_0x2a1d75['options']?_0x2a1d75[_0x6e35('0x1e')][_0x6e35('0x20')]||null:null})['then'](function(_0xb95aed){if(_0xb95aed){return _0xb95aed[_0x6e35('0x26')](_0x2a1d75[_0x6e35('0x1d')][_0x6e35('0x27')],_[_0x6e35('0x28')](_0x2a1d75['body'],[_0x6e35('0x27'),'id'])||{});}})[_0x6e35('0x29')](function(_0x1f4b18){logger[_0x6e35('0x11')](_0x6e35('0x2a'),_0x2a1d75);logger[_0x6e35('0x24')]('AddTags',_0x2a1d75,JSON[_0x6e35('0x15')](_0x1f4b18));_0x2fa7c4(_0x1f4b18);})[_0x6e35('0x1a')](function(_0x225aa1){logger[_0x6e35('0x16')](_0x6e35('0x2a'),_0x225aa1[_0x6e35('0x18')],_0x2a1d75);_0x24498f(_this[_0x6e35('0x16')](0x1f4,_0x225aa1['message']));});});}; \ No newline at end of file +var _0x7b98=['UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','find','addTags','ids','spread','AddTags','moment','ioredis','../../config/utils','rpc','jayson/promise','client','http','defaults','redis','./whatsappInteraction.socket','register','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3a99e1,_0x3731d8){var _0x565afa=function(_0x3a5472){while(--_0x3a5472){_0x3a99e1['push'](_0x3a99e1['shift']());}};_0x565afa(++_0x3731d8);}(_0x7b98,0x109));var _0x87b9=function(_0x14a862,_0x2b559d){_0x14a862=_0x14a862-0x0;var _0x245eb5=_0x7b98[_0x14a862];return _0x245eb5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87b9('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87b9('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x87b9('0x2'));var logger=require('../../config/logger')(_0x87b9('0x3'));var config=require('../../config/environment');var jayson=require(_0x87b9('0x4'));var client=jayson[_0x87b9('0x5')][_0x87b9('0x6')]({'port':0x232a});config['redis']=_[_0x87b9('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x87b9('0x8')]));require(_0x87b9('0x9'))[_0x87b9('0xa')](socket);function respondWithRpcPromise(_0x335a4e,_0x15a32e,_0x25654e){return new BPromise(function(_0x2f3c71,_0x116844){return client['request'](_0x335a4e,_0x25654e)[_0x87b9('0xb')](function(_0x48a9d1){logger[_0x87b9('0xc')](_0x87b9('0xd'),_0x15a32e,'request\x20sent');logger[_0x87b9('0xe')](_0x87b9('0xf'),_0x15a32e,'request\x20sent',JSON[_0x87b9('0x10')](_0x48a9d1));if(_0x48a9d1[_0x87b9('0x11')]){if(_0x48a9d1['error'][_0x87b9('0x12')]===0x1f4){logger[_0x87b9('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x15a32e,_0x48a9d1[_0x87b9('0x11')]['message']);return _0x116844(_0x48a9d1[_0x87b9('0x11')][_0x87b9('0x13')]);}logger[_0x87b9('0x11')](_0x87b9('0xd'),_0x15a32e,_0x48a9d1[_0x87b9('0x11')][_0x87b9('0x13')]);return _0x2f3c71(_0x48a9d1[_0x87b9('0x11')][_0x87b9('0x13')]);}else{logger[_0x87b9('0xc')](_0x87b9('0xd'),_0x15a32e,_0x87b9('0x14'));_0x2f3c71(_0x48a9d1[_0x87b9('0x15')][_0x87b9('0x13')]);}})[_0x87b9('0x16')](function(_0x23d8b9){logger['error'](_0x87b9('0xd'),_0x15a32e,_0x23d8b9);_0x116844(_0x23d8b9);});});}exports[_0x87b9('0x17')]=function(_0x28f1c5){var _0x29ed87=this;return new Promise(function(_0x3e55ea,_0x1358ef){return db['WhatsappInteraction'][_0x87b9('0x18')](_0x28f1c5[_0x87b9('0x19')],{'raw':_0x28f1c5[_0x87b9('0x1a')]?_0x28f1c5[_0x87b9('0x1a')][_0x87b9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28f1c5[_0x87b9('0x1a')]?_0x28f1c5[_0x87b9('0x1a')][_0x87b9('0x1c')]||null:null,'attributes':_0x28f1c5[_0x87b9('0x1a')]?_0x28f1c5['options'][_0x87b9('0x1d')]||null:null,'limit':_0x28f1c5[_0x87b9('0x1a')]?_0x28f1c5[_0x87b9('0x1a')][_0x87b9('0x1e')]||null:null})[_0x87b9('0xb')](function(_0x4069b4){logger[_0x87b9('0xc')](_0x87b9('0x17'),_0x28f1c5);logger[_0x87b9('0xe')](_0x87b9('0x17'),_0x28f1c5,JSON[_0x87b9('0x10')](_0x4069b4));_0x3e55ea(_0x4069b4);})[_0x87b9('0x16')](function(_0x5424d2){logger['error'](_0x87b9('0x17'),_0x5424d2[_0x87b9('0x13')],_0x28f1c5);_0x1358ef(_0x29ed87[_0x87b9('0x11')](0x1f4,_0x5424d2['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4e96a0){return new Promise(function(_0x1a1d50,_0x5e3f86){return db['WhatsappInteraction'][_0x87b9('0x1f')]({'where':_0x4e96a0[_0x87b9('0x1a')]?_0x4e96a0[_0x87b9('0x1a')]['where']||null:null})[_0x87b9('0xb')](function(_0x4360d9){if(_0x4360d9){return _0x4360d9[_0x87b9('0x20')](_0x4e96a0[_0x87b9('0x19')][_0x87b9('0x21')],_['omit'](_0x4e96a0[_0x87b9('0x19')],[_0x87b9('0x21'),'id'])||{});}})[_0x87b9('0x22')](function(_0x2cbac5){logger[_0x87b9('0xc')](_0x87b9('0x23'),_0x4e96a0);logger[_0x87b9('0xe')](_0x87b9('0x23'),_0x4e96a0,JSON[_0x87b9('0x10')](_0x2cbac5));_0x1a1d50(_0x2cbac5);})[_0x87b9('0x16')](function(_0x3a6058){logger[_0x87b9('0x11')](_0x87b9('0x23'),_0x3a6058[_0x87b9('0x13')],_0x4e96a0);_0x5e3f86(_this[_0x87b9('0x11')](0x1f4,_0x3a6058[_0x87b9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 7bee09e..ecbf3e9 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 _0x8fb6=['update','emit','removeListener','register','length','whatsappInteraction:','save','remove'];(function(_0x1fcc28,_0x29f18c){var _0x1a44d6=function(_0x5893d9){while(--_0x5893d9){_0x1fcc28['push'](_0x1fcc28['shift']());}};_0x1a44d6(++_0x29f18c);}(_0x8fb6,0x7e));var _0x68fb=function(_0x5c24e2,_0x5bc669){_0x5c24e2=_0x5c24e2-0x0;var _0x13a108=_0x8fb6[_0x5c24e2];return _0x13a108;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=[_0x68fb('0x0'),_0x68fb('0x1'),_0x68fb('0x2')];function createListener(_0x50b5d2,_0x293611){return function(_0x25e751){_0x293611[_0x68fb('0x3')](_0x50b5d2,_0x25e751);};}function removeListener(_0x5e8a98,_0x1386a0){return function(){WhatsappInteractionEvents[_0x68fb('0x4')](_0x5e8a98,_0x1386a0);};}exports[_0x68fb('0x5')]=function(_0xefc31a){for(var _0x4b32f4=0x0,_0x28d30f=events[_0x68fb('0x6')];_0x4b32f4<_0x28d30f;_0x4b32f4++){var _0x39c9cc=events[_0x4b32f4];var _0x4a470c=createListener(_0x68fb('0x7')+_0x39c9cc,_0xefc31a);WhatsappInteractionEvents['on'](_0x39c9cc,_0x4a470c);}}; \ No newline at end of file +var _0x2cf7=['length','whatsappInteraction:','./whatsappInteraction.events','remove','emit','removeListener','register'];(function(_0x3e893f,_0x2c2d02){var _0x1f17d2=function(_0x7cd7e8){while(--_0x7cd7e8){_0x3e893f['push'](_0x3e893f['shift']());}};_0x1f17d2(++_0x2c2d02);}(_0x2cf7,0x1b4));var _0x72cf=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x2cf7[_0x138836];return _0x322688;};'use strict';var WhatsappInteractionEvents=require(_0x72cf('0x0'));var events=['save',_0x72cf('0x1'),'update'];function createListener(_0x1f3ec9,_0x55d6c2){return function(_0x2daece){_0x55d6c2[_0x72cf('0x2')](_0x1f3ec9,_0x2daece);};}function removeListener(_0x5de036,_0x15c2a6){return function(){WhatsappInteractionEvents[_0x72cf('0x3')](_0x5de036,_0x15c2a6);};}exports[_0x72cf('0x4')]=function(_0x3d2abb){for(var _0xf60094=0x0,_0x4187ba=events[_0x72cf('0x5')];_0xf60094<_0x4187ba;_0xf60094++){var _0x4568d7=events[_0xf60094];var _0x466bd6=createListener(_0x72cf('0x6')+_0x4568d7,_0x3d2abb);WhatsappInteractionEvents['on'](_0x4568d7,_0x466bd6);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 0105762..f016f68 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 _0xfcfd=['whatsapp','whatsappmessage:create','create','status','put','update','/:id/accept','accept','/:id/reject','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x3d5333,_0x5b8745){var _0x36eb94=function(_0x57bca5){while(--_0x57bca5){_0x3d5333['push'](_0x3d5333['shift']());}};_0x36eb94(++_0x5b8745);}(_0xfcfd,0x173));var _0xdfcf=function(_0x3af80e,_0x13df24){_0x3af80e=_0x3af80e-0x0;var _0x10ccc1=_0xfcfd[_0x3af80e];return _0x10ccc1;};'use strict';var multer=require(_0xdfcf('0x0'));var util=require(_0xdfcf('0x1'));var path=require(_0xdfcf('0x2'));var timeout=require(_0xdfcf('0x3'));var express=require(_0xdfcf('0x4'));var router=express[_0xdfcf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdfcf('0x6'));var interaction=require(_0xdfcf('0x7'));var config=require(_0xdfcf('0x8'));var controller=require(_0xdfcf('0x9'));router[_0xdfcf('0xa')]('/',auth[_0xdfcf('0xb')](),controller[_0xdfcf('0xc')]);router[_0xdfcf('0xa')](_0xdfcf('0xd'),auth['isAuthenticated'](),controller[_0xdfcf('0xe')]);router[_0xdfcf('0xa')](_0xdfcf('0xf'),auth[_0xdfcf('0xb')](),controller[_0xdfcf('0x10')]);router[_0xdfcf('0x11')]('/',auth[_0xdfcf('0xb')](),interaction[_0xdfcf('0x12')](_0xdfcf('0x13'),_0xdfcf('0x14')),controller[_0xdfcf('0x15')]);router[_0xdfcf('0x11')]('/:id/status',controller[_0xdfcf('0x16')]);router[_0xdfcf('0x17')](_0xdfcf('0xf'),auth[_0xdfcf('0xb')](),controller[_0xdfcf('0x18')]);router[_0xdfcf('0x17')](_0xdfcf('0x19'),auth[_0xdfcf('0xb')](),controller[_0xdfcf('0x1a')]);router[_0xdfcf('0x17')](_0xdfcf('0x1b'),auth[_0xdfcf('0xb')](),controller['reject']);router[_0xdfcf('0x1c')](_0xdfcf('0xf'),auth[_0xdfcf('0xb')](),controller['destroy']);module[_0xdfcf('0x1d')]=router; \ No newline at end of file +var _0x05fb=['create','post','/:id/status','status','update','put','/:id/accept','accept','reject','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','index','get','/describe','isAuthenticated','describe','/:id','show','whatsapp','whatsappmessage:create'];(function(_0x5d786e,_0x1c9031){var _0x433a41=function(_0x270749){while(--_0x270749){_0x5d786e['push'](_0x5d786e['shift']());}};_0x433a41(++_0x1c9031);}(_0x05fb,0x1a0));var _0xb05f=function(_0x55751d,_0x39e78f){_0x55751d=_0x55751d-0x0;var _0x9f76fe=_0x05fb[_0x55751d];return _0x9f76fe;};'use strict';var multer=require(_0xb05f('0x0'));var util=require(_0xb05f('0x1'));var path=require('path');var timeout=require(_0xb05f('0x2'));var express=require(_0xb05f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb05f('0x4'));var config=require(_0xb05f('0x5'));var controller=require(_0xb05f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb05f('0x7')]);router[_0xb05f('0x8')](_0xb05f('0x9'),auth[_0xb05f('0xa')](),controller[_0xb05f('0xb')]);router['get'](_0xb05f('0xc'),auth[_0xb05f('0xa')](),controller[_0xb05f('0xd')]);router['post']('/',auth[_0xb05f('0xa')](),interaction['tracked'](_0xb05f('0xe'),_0xb05f('0xf')),controller[_0xb05f('0x10')]);router[_0xb05f('0x11')](_0xb05f('0x12'),controller[_0xb05f('0x13')]);router['put'](_0xb05f('0xc'),auth[_0xb05f('0xa')](),controller[_0xb05f('0x14')]);router[_0xb05f('0x15')](_0xb05f('0x16'),auth[_0xb05f('0xa')](),controller[_0xb05f('0x17')]);router['put']('/:id/reject',auth[_0xb05f('0xa')](),controller[_0xb05f('0x18')]);router[_0xb05f('0x19')](_0xb05f('0xc'),auth[_0xb05f('0xa')](),controller['destroy']);module[_0xb05f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 0f62faf..a3386e9 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 _0x3351=['STRING','TEXT','sequelize','medium','BOOLEAN','ENUM','out'];(function(_0x2dd57a,_0x284143){var _0x41a808=function(_0x48d83a){while(--_0x48d83a){_0x2dd57a['push'](_0x2dd57a['shift']());}};_0x41a808(++_0x284143);}(_0x3351,0x1b4));var _0x1335=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x3351[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x1335('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x1335('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x1335('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1335('0x3')]('in',_0x1335('0x4')),'defaultValue':_0x1335('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1335('0x5')](0xbe)},'phone':{'type':Sequelize[_0x1335('0x5')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x1335('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1335('0x5')]},'providerResponse':{'type':Sequelize[_0x1335('0x6')]}}; \ No newline at end of file +var _0xed5a=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xed5a,0xb6));var _0xaed5=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xed5a[_0x25d386];return _0x857f4a;};'use strict';var Sequelize=require(_0xaed5('0x0'));module[_0xaed5('0x1')]={'body':{'type':Sequelize[_0xaed5('0x2')](_0xaed5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xaed5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaed5('0x5')]('in',_0xaed5('0x6')),'defaultValue':_0xaed5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaed5('0x7')](0xbe)},'phone':{'type':Sequelize[_0xaed5('0x7')]},'readAt':{'type':Sequelize[_0xaed5('0x8')]},'secret':{'type':Sequelize[_0xaed5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xaed5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 78f23ce..2186a8f 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 _0x6a9a=['acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','QueryTypes','internal','reject','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','MessageStatus','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','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','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','rows','params','intersection','include','find','create','body','destroy','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','null','AcceptMessage'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x6a9a,0x1bd));var _0xa6a9=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x6a9a[_0x144b30];return _0x1bb7bc;};'use strict';var emlformat=require(_0xa6a9('0x0'));var rimraf=require(_0xa6a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa6a9('0x2'));var rp=require(_0xa6a9('0x3'));var moment=require('moment');var BPromise=require(_0xa6a9('0x4'));var Mustache=require('mustache');var util=require(_0xa6a9('0x5'));var path=require(_0xa6a9('0x6'));var sox=require('sox');var csv=require(_0xa6a9('0x7'));var ejs=require(_0xa6a9('0x8'));var fs=require('fs');var fs_extra=require(_0xa6a9('0x9'));var _=require(_0xa6a9('0xa'));var squel=require(_0xa6a9('0xb'));var crypto=require(_0xa6a9('0xc'));var jsforce=require(_0xa6a9('0xd'));var deskjs=require(_0xa6a9('0xe'));var toCsv=require(_0xa6a9('0x7'));var querystring=require(_0xa6a9('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa6a9('0x10'));var qs=require(_0xa6a9('0x11'));var as=require(_0xa6a9('0x12'));var hardwareService=require(_0xa6a9('0x13'));var logger=require(_0xa6a9('0x14'))(_0xa6a9('0x15'));var utils=require(_0xa6a9('0x16'));var config=require(_0xa6a9('0x17'));var licenseUtil=require(_0xa6a9('0x18'));var db=require(_0xa6a9('0x19'))['db'];config[_0xa6a9('0x1a')]=_[_0xa6a9('0x1b')](config[_0xa6a9('0x1a')],{'host':_0xa6a9('0x1c'),'port':0x18eb});var socket=require(_0xa6a9('0x1d'))(new Redis(config[_0xa6a9('0x1a')]));require(_0xa6a9('0x1e'))[_0xa6a9('0x1f')](socket);var jayson=require(_0xa6a9('0x20'));var client=jayson[_0xa6a9('0x21')][_0xa6a9('0x22')]({'port':0x232c});var client9002=jayson[_0xa6a9('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fcf2e,_0x2f3e71,_0x19a4ad,_0x2e676b){return new BPromise(function(_0x82b9d,_0x523872){var _0x45037a=_0x2e676b||client;return _0x45037a['request'](_0x4fcf2e,_0x19a4ad)['then'](function(_0x36964d){logger[_0xa6a9('0x23')](_0xa6a9('0x24'),_0x2f3e71,_0xa6a9('0x25'));logger[_0xa6a9('0x26')](_0xa6a9('0x27'),_0x2f3e71,'request\x20sent',JSON[_0xa6a9('0x28')](_0x36964d));if(_0x36964d[_0xa6a9('0x29')]){if(_0x36964d[_0xa6a9('0x29')]['code']===0x1f4){logger['error'](_0xa6a9('0x24'),_0x2f3e71,_0x36964d[_0xa6a9('0x29')]['message']);return _0x523872(_0x36964d[_0xa6a9('0x29')]['message']);}logger['error'](_0xa6a9('0x24'),_0x2f3e71,_0x36964d[_0xa6a9('0x29')]['message']);return _0x82b9d(_0x36964d[_0xa6a9('0x29')][_0xa6a9('0x2a')]);}else{logger[_0xa6a9('0x23')](_0xa6a9('0x24'),_0x2f3e71,_0xa6a9('0x25'));_0x82b9d(_0x36964d[_0xa6a9('0x2b')]['message']);}})[_0xa6a9('0x2c')](function(_0x5a675b){logger['error'](_0xa6a9('0x24'),_0x2f3e71,_0x5a675b);_0x523872(_0x5a675b);});});}function respondWithStatusCode(_0x5ba2dc,_0x123a23){_0x123a23=_0x123a23||0xcc;return function(_0x40bb9e){if(_0x40bb9e){return _0x5ba2dc[_0xa6a9('0x2d')](_0x123a23);}return _0x5ba2dc[_0xa6a9('0x2e')](_0x123a23)[_0xa6a9('0x2f')]();};}function respondWithResult(_0x2f4835,_0x2fb9e7){_0x2fb9e7=_0x2fb9e7||0xc8;return function(_0x142628){if(_0x142628){return _0x2f4835[_0xa6a9('0x2e')](_0x2fb9e7)[_0xa6a9('0x30')](_0x142628);}};}function respondWithFilteredResult(_0x568ad8,_0x30c843){return function(_0x59a42f){if(_0x59a42f){var _0x353665=typeof _0x30c843[_0xa6a9('0x31')]===_0xa6a9('0x32')&&typeof _0x30c843[_0xa6a9('0x33')]==='undefined';var _0x34558b=_0x59a42f[_0xa6a9('0x34')];var _0xc93311=_0x353665?0x0:_0x30c843[_0xa6a9('0x31')];var _0x237b8c=_0x353665?_0x59a42f['count']:_0x30c843[_0xa6a9('0x31')]+_0x30c843[_0xa6a9('0x33')];var _0x5f4c69;if(_0x237b8c>=_0x34558b){_0x237b8c=_0x34558b;_0x5f4c69=0xc8;}else{_0x5f4c69=0xce;}_0x568ad8['status'](_0x5f4c69);return _0x568ad8[_0xa6a9('0x35')](_0xa6a9('0x36'),_0xc93311+'-'+_0x237b8c+'/'+_0x34558b)[_0xa6a9('0x30')](_0x59a42f);}return null;};}function patchUpdates(_0x4217ae){return function(_0x3f918e){try{jsonpatch['apply'](_0x3f918e,_0x4217ae,!![]);}catch(_0x4ba59b){return BPromise['reject'](_0x4ba59b);}return _0x3f918e['save']();};}function saveUpdates(_0x286037,_0x35c366){return function(_0x4bb289){if(_0x4bb289){return _0x4bb289[_0xa6a9('0x37')](_0x286037)['then'](function(_0x1232f6){return _0x1232f6;});}return null;};}function removeEntity(_0x1ce668,_0x5b6637){return function(_0x311986){if(_0x311986){return _0x311986['destroy']()[_0xa6a9('0x38')](function(){_0x1ce668['status'](0xcc)[_0xa6a9('0x2f')]();});}};}function handleEntityNotFound(_0x100535,_0x49d8cf){return function(_0x582b55){if(!_0x582b55){_0x100535[_0xa6a9('0x2d')](0x194);}return _0x582b55;};}function handleError(_0x38c975,_0x1e2ecf){_0x1e2ecf=_0x1e2ecf||0x1f4;return function(_0x397cbf){logger[_0xa6a9('0x29')](_0x397cbf[_0xa6a9('0x39')]);if(_0x397cbf[_0xa6a9('0x3a')]){delete _0x397cbf[_0xa6a9('0x3a')];}_0x38c975[_0xa6a9('0x2e')](_0x1e2ecf)['send'](_0x397cbf);};}exports[_0xa6a9('0x3b')]=function(_0x674a51,_0x5b8728){var _0x36187d={},_0x20377b={},_0x1494f1={'count':0x0,'rows':[]};var _0x5a4207=_[_0xa6a9('0x3c')](db[_0xa6a9('0x3d')][_0xa6a9('0x3e')],function(_0xf79305){return{'name':_0xf79305[_0xa6a9('0x3f')],'type':_0xf79305[_0xa6a9('0x40')]['key']};});_0x20377b[_0xa6a9('0x41')]=_['map'](_0x5a4207,'name');_0x20377b[_0xa6a9('0x42')]=_[_0xa6a9('0x43')](_0x674a51[_0xa6a9('0x42')]);_0x20377b['filters']=_['intersection'](_0x20377b['model'],_0x20377b['query']);_0x36187d[_0xa6a9('0x44')]=_['intersection'](_0x20377b[_0xa6a9('0x41')],qs[_0xa6a9('0x45')](_0x674a51['query'][_0xa6a9('0x45')]));_0x36187d[_0xa6a9('0x44')]=_0x36187d['attributes'][_0xa6a9('0x46')]?_0x36187d[_0xa6a9('0x44')]:_0x20377b['model'];if(!_0x674a51[_0xa6a9('0x42')][_0xa6a9('0x47')]('nolimit')){_0x36187d[_0xa6a9('0x33')]=qs[_0xa6a9('0x33')](_0x674a51['query']['limit']);_0x36187d[_0xa6a9('0x31')]=qs[_0xa6a9('0x31')](_0x674a51[_0xa6a9('0x42')][_0xa6a9('0x31')]);}_0x36187d['order']=qs[_0xa6a9('0x48')](_0x674a51[_0xa6a9('0x42')][_0xa6a9('0x48')]);_0x36187d['where']=qs[_0xa6a9('0x49')](_[_0xa6a9('0x4a')](_0x674a51['query'],_0x20377b[_0xa6a9('0x49')]),_0x5a4207);if(_0x674a51[_0xa6a9('0x42')]['filter']){_0x36187d[_0xa6a9('0x4b')]=_[_0xa6a9('0x4c')](_0x36187d[_0xa6a9('0x4b')],{'$or':_[_0xa6a9('0x3c')](_0x5a4207,function(_0x36f198){if(_0x36f198[_0xa6a9('0x40')]!==_0xa6a9('0x4d')){var _0x4bccf5={};_0x4bccf5[_0x36f198[_0xa6a9('0x3a')]]={'$like':'%'+_0x674a51[_0xa6a9('0x42')][_0xa6a9('0x4e')]+'%'};return _0x4bccf5;}})});}_0x36187d=_[_0xa6a9('0x4c')]({},_0x36187d,_0x674a51[_0xa6a9('0x4f')]);var _0x4c0bc5={'where':_0x36187d['where']};return db[_0xa6a9('0x3d')][_0xa6a9('0x34')](_0x4c0bc5)[_0xa6a9('0x38')](function(_0x222806){_0x1494f1[_0xa6a9('0x34')]=_0x222806;if(_0x674a51[_0xa6a9('0x42')][_0xa6a9('0x50')]){_0x36187d['include']=[{'all':!![]}];}return db[_0xa6a9('0x3d')]['findAll'](_0x36187d);})[_0xa6a9('0x38')](function(_0x44074a){_0x1494f1[_0xa6a9('0x51')]=_0x44074a;return _0x1494f1;})[_0xa6a9('0x38')](respondWithFilteredResult(_0x5b8728,_0x36187d))[_0xa6a9('0x2c')](handleError(_0x5b8728,null));};exports['show']=function(_0x2f08ab,_0x3c082b){var _0x56285={'raw':!![],'where':{'id':_0x2f08ab[_0xa6a9('0x52')]['id']}},_0x4217bf={};_0x4217bf[_0xa6a9('0x41')]=_[_0xa6a9('0x43')](db['WhatsappMessage'][_0xa6a9('0x3e')]);_0x4217bf[_0xa6a9('0x42')]=_[_0xa6a9('0x43')](_0x2f08ab[_0xa6a9('0x42')]);_0x4217bf['filters']=_[_0xa6a9('0x53')](_0x4217bf['model'],_0x4217bf['query']);_0x56285[_0xa6a9('0x44')]=_[_0xa6a9('0x53')](_0x4217bf[_0xa6a9('0x41')],qs[_0xa6a9('0x45')](_0x2f08ab[_0xa6a9('0x42')][_0xa6a9('0x45')]));_0x56285[_0xa6a9('0x44')]=_0x56285[_0xa6a9('0x44')]['length']?_0x56285['attributes']:_0x4217bf[_0xa6a9('0x41')];if(_0x2f08ab[_0xa6a9('0x42')][_0xa6a9('0x50')]){_0x56285[_0xa6a9('0x54')]=[{'all':!![]}];}_0x56285=_[_0xa6a9('0x4c')]({},_0x56285,_0x2f08ab[_0xa6a9('0x4f')]);return db['WhatsappMessage'][_0xa6a9('0x55')](_0x56285)[_0xa6a9('0x38')](handleEntityNotFound(_0x3c082b,null))[_0xa6a9('0x38')](respondWithResult(_0x3c082b,null))[_0xa6a9('0x2c')](handleError(_0x3c082b,null));};exports[_0xa6a9('0x56')]=function(_0x5e9cb0,_0x820faa){return db['WhatsappMessage']['create'](_0x5e9cb0[_0xa6a9('0x57')],{})['then'](respondWithResult(_0x820faa,0xc9))['catch'](handleError(_0x820faa,null));};exports[_0xa6a9('0x37')]=function(_0x5f03a5,_0x37a048){if(_0x5f03a5[_0xa6a9('0x57')]['id']){delete _0x5f03a5[_0xa6a9('0x57')]['id'];}return db[_0xa6a9('0x3d')][_0xa6a9('0x55')]({'where':{'id':_0x5f03a5[_0xa6a9('0x52')]['id']}})[_0xa6a9('0x38')](handleEntityNotFound(_0x37a048,null))['then'](saveUpdates(_0x5f03a5[_0xa6a9('0x57')],null))['then'](respondWithResult(_0x37a048,null))['catch'](handleError(_0x37a048,null));};exports[_0xa6a9('0x58')]=function(_0x4bd243,_0x2ec58a){return db['WhatsappMessage'][_0xa6a9('0x55')]({'where':{'id':_0x4bd243[_0xa6a9('0x52')]['id']}})[_0xa6a9('0x38')](handleEntityNotFound(_0x2ec58a,null))['then'](removeEntity(_0x2ec58a,null))['catch'](handleError(_0x2ec58a,null));};exports['describe']=function(_0x3a398f,_0x2e2eed){return db['WhatsappMessage'][_0xa6a9('0x59')]()[_0xa6a9('0x38')](respondWithResult(_0x2e2eed,null))['catch'](handleError(_0x2e2eed,null));};var interaction_log=require(_0xa6a9('0x14'))(_0xa6a9('0x5a'));exports[_0xa6a9('0x5b')]=function(_0x386c00,_0x3dbbd8,_0x37b8fe){var _0xccb979={'agent':{},'channel':_0xa6a9('0x5c')};if(_0x386c00[_0xa6a9('0x57')]['id']){delete _0x386c00['body']['id'];}_0x386c00[_0xa6a9('0x57')][_0xa6a9('0x5d')]=!![];_0x386c00['body'][_0xa6a9('0x5e')]=moment()[_0xa6a9('0x5f')](_0xa6a9('0x60'));_0x386c00[_0xa6a9('0x57')][_0xa6a9('0x61')]=_0x386c00[_0xa6a9('0x57')]['UserId']||_0x386c00[_0xa6a9('0x62')]['id'];_0xccb979[_0xa6a9('0x63')]['id']=_0x386c00[_0xa6a9('0x57')]['UserId'];return db[_0xa6a9('0x3d')][_0xa6a9('0x55')]({'where':{'id':_0x386c00[_0xa6a9('0x52')]['id'],'UserId':null}})[_0xa6a9('0x38')](handleEntityNotFound(_0x3dbbd8,null))[_0xa6a9('0x38')](saveUpdates(_0x386c00[_0xa6a9('0x57')],null))[_0xa6a9('0x38')](function(_0x154a40){if(_0x154a40){_0xccb979['message']=_0x154a40[_0xa6a9('0x64')]({'plain':!![]});return db[_0xa6a9('0x65')][_0xa6a9('0x55')]({'where':{'id':_0x154a40[_0xa6a9('0x66')]}});}return null;})[_0xa6a9('0x38')](handleEntityNotFound(_0x3dbbd8,null))[_0xa6a9('0x38')](function(_0x4d420c){if(_0x4d420c){return _0x4d420c[_0xa6a9('0x37')]({'UserId':_0x386c00['body'][_0xa6a9('0x61')],'read1stAt':_[_0xa6a9('0x67')](_0x4d420c['read1stAt'])?moment()[_0xa6a9('0x5f')](_0xa6a9('0x60')):undefined});}return null;})[_0xa6a9('0x38')](function(_0x49ebce){if(_0x49ebce){_0xccb979[_0xa6a9('0x68')]=_0x49ebce['get']({'plain':!![]});interaction_log[_0xa6a9('0x23')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x386c00[_0xa6a9('0x62')]['id'],_0x386c00[_0xa6a9('0x62')][_0xa6a9('0x3a')],_0x386c00[_0xa6a9('0x62')]['role'],_0xccb979[_0xa6a9('0x68')]['id'],_0x386c00[_0xa6a9('0x57')]?JSON['stringify'](_0x386c00[_0xa6a9('0x57')]):_0xa6a9('0x69'));return respondWithRpcPromise(_0xa6a9('0x6a'),_0xa6a9('0x6b'),_0xccb979);}return null;})[_0xa6a9('0x38')](function(_0x3e4f2e){var _0x158fc3=_0xa6a9('0x6c')+_0x3e4f2e['message']['ContactId'];return db[_0xa6a9('0x6d')][_0xa6a9('0x42')](_0x158fc3,{'type':db[_0xa6a9('0x6e')]['QueryTypes'][_0xa6a9('0x6f')],'raw':!![]})[_0xa6a9('0x38')](function(_0x5589e0){return _0x5589e0;});})['then'](function(_0x5820dd){if(_0x5820dd){_0xccb979[_0xa6a9('0x2a')][_0xa6a9('0x70')]=_0x5820dd[0x0];if(!_0x386c00[_0xa6a9('0x57')]['UserId'])return;return db[_0xa6a9('0x71')][_0xa6a9('0x55')]({'where':{'id':_0x386c00[_0xa6a9('0x57')][_0xa6a9('0x61')],'role':'agent'},'attributes':['id',_0xa6a9('0x3a'),_0xa6a9('0x72'),_0xa6a9('0x73'),'internal'],'raw':!![]});}return null;})[_0xa6a9('0x38')](function(_0x5ddea0){if(!_0x5ddea0)return null;_0xccb979[_0xa6a9('0x2a')]['agent']=_0x5ddea0;return _0xccb979;})[_0xa6a9('0x38')](function(_0x6384b1){if(_0x6384b1){if(_0x386c00['body'][_0xa6a9('0x74')]){_0xccb979[_0xa6a9('0x2a')][_0xa6a9('0x75')]=util[_0xa6a9('0x5f')](_0xa6a9('0x76'),_0x386c00[_0xa6a9('0x62')][_0xa6a9('0x3a')]);_0xccb979[_0xa6a9('0x2a')]['channel']=_0xccb979[_0xa6a9('0x77')];_0xccb979[_0xa6a9('0x2a')][_0xa6a9('0x78')]=_0xa6a9('0x5b');return respondWithRpcPromise('EventManager',_0xa6a9('0x79'),{'event':_0xa6a9('0x7a'),'message':_0xccb979[_0xa6a9('0x2a')]},client9002)[_0xa6a9('0x38')](function(){return _0xccb979;});}return _0xccb979;}return null;})['then'](respondWithResult(_0x3dbbd8,null))[_0xa6a9('0x2c')](handleError(_0x3dbbd8,null));};var interaction_log=require(_0xa6a9('0x14'))(_0xa6a9('0x5a'));exports['reject']=function(_0x344241,_0x2e36ec,_0x41e749){var _0x4048d5={'agent':{},'channel':'whatsapp'};if(_0x344241['body']['id']){delete _0x344241[_0xa6a9('0x57')]['id'];}_0x344241[_0xa6a9('0x57')][_0xa6a9('0x61')]=_0x344241[_0xa6a9('0x57')]['UserId']||_0x344241[_0xa6a9('0x62')]['id'];_0x4048d5[_0xa6a9('0x63')]['id']=_0x344241[_0xa6a9('0x57')][_0xa6a9('0x61')];return db[_0xa6a9('0x3d')][_0xa6a9('0x55')]({'where':{'id':_0x344241[_0xa6a9('0x52')]['id'],'UserId':null}})[_0xa6a9('0x38')](handleEntityNotFound(_0x2e36ec,null))[_0xa6a9('0x38')](function(_0x1833cd){if(_0x1833cd){_0x4048d5[_0xa6a9('0x2a')]=_0x1833cd[_0xa6a9('0x64')]({'plain':!![]});return db[_0xa6a9('0x65')][_0xa6a9('0x55')]({'where':{'id':_0x1833cd[_0xa6a9('0x66')]}});}return null;})[_0xa6a9('0x38')](handleEntityNotFound(_0x2e36ec,null))[_0xa6a9('0x38')](function(_0x466d78){if(_0x466d78){_0x4048d5[_0xa6a9('0x68')]=_0x466d78[_0xa6a9('0x64')]({'plain':!![]});interaction_log[_0xa6a9('0x23')](_0xa6a9('0x7b'),_0x344241[_0xa6a9('0x62')]['id'],_0x344241[_0xa6a9('0x62')][_0xa6a9('0x3a')],_0x344241['user'][_0xa6a9('0x7c')],_0x4048d5[_0xa6a9('0x68')]['id'],_0x344241['body']?JSON['stringify'](_0x344241[_0xa6a9('0x57')]):_0xa6a9('0x69'));return respondWithRpcPromise(_0xa6a9('0x7d'),_0xa6a9('0x7e'),_0x4048d5);}return null;})[_0xa6a9('0x38')](function(_0x26c85e){var _0x1be674=_0xa6a9('0x6c')+_0x26c85e[_0xa6a9('0x2a')]['ContactId'];return db['sequelize'][_0xa6a9('0x42')](_0x1be674,{'type':db[_0xa6a9('0x6e')][_0xa6a9('0x7f')]['SELECT'],'raw':!![]})[_0xa6a9('0x38')](function(_0x5cd1c9){return _0x5cd1c9;});})[_0xa6a9('0x38')](function(_0xbd3e53){if(_0xbd3e53){_0x4048d5[_0xa6a9('0x2a')][_0xa6a9('0x70')]=_0xbd3e53[0x0];if(!_0x344241[_0xa6a9('0x57')][_0xa6a9('0x61')])return;return db[_0xa6a9('0x71')][_0xa6a9('0x55')]({'where':{'id':_0x344241[_0xa6a9('0x57')][_0xa6a9('0x61')],'role':_0xa6a9('0x63')},'attributes':['id',_0xa6a9('0x3a'),_0xa6a9('0x72'),_0xa6a9('0x73'),_0xa6a9('0x80')],'raw':!![]});}return null;})['then'](function(_0x21daca){if(!_0x21daca)return null;_0x4048d5[_0xa6a9('0x2a')]['agent']=_0x21daca;return _0x4048d5;})[_0xa6a9('0x38')](function(_0x536662){if(_0x536662){_0x536662['message']['interface']=util[_0xa6a9('0x5f')](_0xa6a9('0x76'),_0x344241[_0xa6a9('0x62')][_0xa6a9('0x3a')]);_0x536662['message']['channel']=_0x4048d5[_0xa6a9('0x77')];_0x536662[_0xa6a9('0x2a')][_0xa6a9('0x78')]=_0xa6a9('0x81');respondWithRpcPromise(_0xa6a9('0x79'),_0xa6a9('0x79'),{'event':_0xa6a9('0x82'),'message':_0x536662[_0xa6a9('0x2a')]},client9002);return _0x4048d5;}return null;})[_0xa6a9('0x38')](respondWithResult(_0x2e36ec,null))[_0xa6a9('0x2c')](handleError(_0x2e36ec,null));};exports[_0xa6a9('0x2e')]=function(_0xb739bc,_0x264fd7,_0x129e5e){if(_0xb739bc[_0xa6a9('0x57')]['id']){delete _0xb739bc[_0xa6a9('0x57')]['id'];}var _0x3c0a5f;return db[_0xa6a9('0x3d')][_0xa6a9('0x55')]({'where':{'id':_0xb739bc[_0xa6a9('0x52')]['id']}})[_0xa6a9('0x38')](handleEntityNotFound(_0x264fd7,null))['then'](function(_0x5aad70){if(_0x5aad70){_0x3c0a5f=_0x5aad70;return db[_0xa6a9('0x83')]['find']({'where':{'id':_0x5aad70['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x264fd7,null))['then'](function(_0x40f163){if(_0x40f163){logger['debug'](_0xa6a9('0x84'),_0xa6a9('0x2e'),_0xa6a9('0x85'),_0x40f163['type'],util[_0xa6a9('0x86')](_0xb739bc['body'],{'showHidden':![],'depth':null}));switch(_0x40f163[_0xa6a9('0x40')]){case'twilio':if(_0xb739bc['body'][_0xa6a9('0x87')]&&_0xb739bc['body'][_0xa6a9('0x87')]===_0x3c0a5f[_0xa6a9('0x88')]&&_0xb739bc[_0xa6a9('0x57')][_0xa6a9('0x89')]&&_0xb739bc[_0xa6a9('0x57')][_0xa6a9('0x89')]===_0xa6a9('0x5d')){return _0x3c0a5f['update']({'read':!![]});}else{logger[_0xa6a9('0x29')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa6a9('0x2e'),'twilio',util['inspect'](_0xb739bc['body'],{'showHidden':![],'depth':null}));}break;}return _0x3c0a5f;}})[_0xa6a9('0x38')](respondWithResult(_0x264fd7,null))[_0xa6a9('0x2c')](handleError(_0x264fd7,null));}; \ No newline at end of file +var _0x3c72=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','../../config/logger','whatsapp-interactions','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','info','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','QueryTypes','User','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','WhatsappMessage','rawAttributes','key','query','keys','intersection'];(function(_0x921b88,_0xe050a6){var _0x3cdc23=function(_0x1e95ca){while(--_0x1e95ca){_0x921b88['push'](_0x921b88['shift']());}};_0x3cdc23(++_0xe050a6);}(_0x3c72,0x1ee));var _0x23c7=function(_0x2cdef9,_0x1a38d2){_0x2cdef9=_0x2cdef9-0x0;var _0xbacd98=_0x3c72[_0x2cdef9];return _0xbacd98;};'use strict';var emlformat=require(_0x23c7('0x0'));var rimraf=require(_0x23c7('0x1'));var zipdir=require(_0x23c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23c7('0x3'));var moment=require(_0x23c7('0x4'));var BPromise=require(_0x23c7('0x5'));var Mustache=require(_0x23c7('0x6'));var util=require(_0x23c7('0x7'));var path=require(_0x23c7('0x8'));var sox=require(_0x23c7('0x9'));var csv=require(_0x23c7('0xa'));var ejs=require(_0x23c7('0xb'));var fs=require('fs');var fs_extra=require(_0x23c7('0xc'));var _=require(_0x23c7('0xd'));var squel=require(_0x23c7('0xe'));var crypto=require(_0x23c7('0xf'));var jsforce=require(_0x23c7('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x23c7('0xa'));var querystring=require(_0x23c7('0x11'));var Papa=require(_0x23c7('0x12'));var Redis=require(_0x23c7('0x13'));var authService=require(_0x23c7('0x14'));var qs=require(_0x23c7('0x15'));var as=require(_0x23c7('0x16'));var hardwareService=require(_0x23c7('0x17'));var logger=require('../../config/logger')(_0x23c7('0x18'));var utils=require(_0x23c7('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x23c7('0x1a')](config[_0x23c7('0x1b')],{'host':_0x23c7('0x1c'),'port':0x18eb});var socket=require(_0x23c7('0x1d'))(new Redis(config[_0x23c7('0x1b')]));require('./whatsappMessage.socket')[_0x23c7('0x1e')](socket);var jayson=require(_0x23c7('0x1f'));var client=jayson[_0x23c7('0x20')][_0x23c7('0x21')]({'port':0x232c});var client9002=jayson[_0x23c7('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482a2e,_0x4a8ee3,_0x20090a,_0x3f92d2){return new BPromise(function(_0x2a2038,_0x47201a){var _0x177adc=_0x3f92d2||client;return _0x177adc[_0x23c7('0x22')](_0x482a2e,_0x20090a)['then'](function(_0x99adff){logger['info'](_0x23c7('0x23'),_0x4a8ee3,'request\x20sent');logger[_0x23c7('0x24')](_0x23c7('0x25'),_0x4a8ee3,'request\x20sent',JSON['stringify'](_0x99adff));if(_0x99adff[_0x23c7('0x26')]){if(_0x99adff[_0x23c7('0x26')][_0x23c7('0x27')]===0x1f4){logger['error'](_0x23c7('0x23'),_0x4a8ee3,_0x99adff[_0x23c7('0x26')][_0x23c7('0x28')]);return _0x47201a(_0x99adff[_0x23c7('0x26')]['message']);}logger[_0x23c7('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x4a8ee3,_0x99adff[_0x23c7('0x26')]['message']);return _0x2a2038(_0x99adff[_0x23c7('0x26')][_0x23c7('0x28')]);}else{logger['info'](_0x23c7('0x23'),_0x4a8ee3,'request\x20sent');_0x2a2038(_0x99adff['result']['message']);}})[_0x23c7('0x29')](function(_0x502ddf){logger[_0x23c7('0x26')](_0x23c7('0x23'),_0x4a8ee3,_0x502ddf);_0x47201a(_0x502ddf);});});}function respondWithStatusCode(_0x354fa2,_0x53b250){_0x53b250=_0x53b250||0xcc;return function(_0x258002){if(_0x258002){return _0x354fa2[_0x23c7('0x2a')](_0x53b250);}return _0x354fa2[_0x23c7('0x2b')](_0x53b250)[_0x23c7('0x2c')]();};}function respondWithResult(_0x1d1d49,_0x36ff4b){_0x36ff4b=_0x36ff4b||0xc8;return function(_0x451f1e){if(_0x451f1e){return _0x1d1d49['status'](_0x36ff4b)[_0x23c7('0x2d')](_0x451f1e);}};}function respondWithFilteredResult(_0x47b835,_0x320e68){return function(_0xb07bf7){if(_0xb07bf7){var _0x46f91c=typeof _0x320e68[_0x23c7('0x2e')]===_0x23c7('0x2f')&&typeof _0x320e68[_0x23c7('0x30')]===_0x23c7('0x2f');var _0x3820e3=_0xb07bf7[_0x23c7('0x31')];var _0x5ee2c5=_0x46f91c?0x0:_0x320e68['offset'];var _0x1b7e8d=_0x46f91c?_0xb07bf7['count']:_0x320e68[_0x23c7('0x2e')]+_0x320e68[_0x23c7('0x30')];var _0x100312;if(_0x1b7e8d>=_0x3820e3){_0x1b7e8d=_0x3820e3;_0x100312=0xc8;}else{_0x100312=0xce;}_0x47b835[_0x23c7('0x2b')](_0x100312);return _0x47b835[_0x23c7('0x32')](_0x23c7('0x33'),_0x5ee2c5+'-'+_0x1b7e8d+'/'+_0x3820e3)[_0x23c7('0x2d')](_0xb07bf7);}return null;};}function patchUpdates(_0x2a2130){return function(_0x2a4660){try{jsonpatch[_0x23c7('0x34')](_0x2a4660,_0x2a2130,!![]);}catch(_0x256e8a){return BPromise[_0x23c7('0x35')](_0x256e8a);}return _0x2a4660['save']();};}function saveUpdates(_0x110583,_0x4cbdf4){return function(_0x155e7a){if(_0x155e7a){return _0x155e7a[_0x23c7('0x36')](_0x110583)[_0x23c7('0x37')](function(_0x3de8ab){return _0x3de8ab;});}return null;};}function removeEntity(_0x48fa91,_0x31bd8b){return function(_0x2ab569){if(_0x2ab569){return _0x2ab569[_0x23c7('0x38')]()[_0x23c7('0x37')](function(){_0x48fa91[_0x23c7('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x584d99,_0x54c0f4){return function(_0x56ad38){if(!_0x56ad38){_0x584d99[_0x23c7('0x2a')](0x194);}return _0x56ad38;};}function handleError(_0x217d13,_0x35b1ac){_0x35b1ac=_0x35b1ac||0x1f4;return function(_0x59893c){logger[_0x23c7('0x26')](_0x59893c[_0x23c7('0x39')]);if(_0x59893c[_0x23c7('0x3a')]){delete _0x59893c[_0x23c7('0x3a')];}_0x217d13[_0x23c7('0x2b')](_0x35b1ac)[_0x23c7('0x3b')](_0x59893c);};}exports['index']=function(_0x2ffcab,_0x4824ef){var _0xbdb878={},_0x516f19={},_0xdc274c={'count':0x0,'rows':[]};var _0x162446=_['map'](db[_0x23c7('0x3c')][_0x23c7('0x3d')],function(_0x3b8789){return{'name':_0x3b8789['fieldName'],'type':_0x3b8789['type'][_0x23c7('0x3e')]};});_0x516f19['model']=_['map'](_0x162446,_0x23c7('0x3a'));_0x516f19[_0x23c7('0x3f')]=_[_0x23c7('0x40')](_0x2ffcab['query']);_0x516f19['filters']=_[_0x23c7('0x41')](_0x516f19[_0x23c7('0x42')],_0x516f19[_0x23c7('0x3f')]);_0xbdb878[_0x23c7('0x43')]=_['intersection'](_0x516f19[_0x23c7('0x42')],qs[_0x23c7('0x44')](_0x2ffcab[_0x23c7('0x3f')]['fields']));_0xbdb878[_0x23c7('0x43')]=_0xbdb878[_0x23c7('0x43')][_0x23c7('0x45')]?_0xbdb878[_0x23c7('0x43')]:_0x516f19['model'];if(!_0x2ffcab[_0x23c7('0x3f')][_0x23c7('0x46')](_0x23c7('0x47'))){_0xbdb878[_0x23c7('0x30')]=qs['limit'](_0x2ffcab['query'][_0x23c7('0x30')]);_0xbdb878[_0x23c7('0x2e')]=qs[_0x23c7('0x2e')](_0x2ffcab[_0x23c7('0x3f')][_0x23c7('0x2e')]);}_0xbdb878[_0x23c7('0x48')]=qs[_0x23c7('0x49')](_0x2ffcab[_0x23c7('0x3f')][_0x23c7('0x49')]);_0xbdb878[_0x23c7('0x4a')]=qs['filters'](_[_0x23c7('0x4b')](_0x2ffcab[_0x23c7('0x3f')],_0x516f19[_0x23c7('0x4c')]),_0x162446);if(_0x2ffcab['query'][_0x23c7('0x4d')]){_0xbdb878[_0x23c7('0x4a')]=_[_0x23c7('0x4e')](_0xbdb878[_0x23c7('0x4a')],{'$or':_['map'](_0x162446,function(_0x52e7dd){if(_0x52e7dd[_0x23c7('0x4f')]!==_0x23c7('0x50')){var _0x52d28f={};_0x52d28f[_0x52e7dd[_0x23c7('0x3a')]]={'$like':'%'+_0x2ffcab['query']['filter']+'%'};return _0x52d28f;}})});}_0xbdb878=_[_0x23c7('0x4e')]({},_0xbdb878,_0x2ffcab[_0x23c7('0x51')]);var _0xb02656={'where':_0xbdb878[_0x23c7('0x4a')]};return db[_0x23c7('0x3c')][_0x23c7('0x31')](_0xb02656)[_0x23c7('0x37')](function(_0x5702b8){_0xdc274c[_0x23c7('0x31')]=_0x5702b8;if(_0x2ffcab[_0x23c7('0x3f')][_0x23c7('0x52')]){_0xbdb878[_0x23c7('0x53')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x23c7('0x54')](_0xbdb878);})['then'](function(_0x541233){_0xdc274c[_0x23c7('0x55')]=_0x541233;return _0xdc274c;})[_0x23c7('0x37')](respondWithFilteredResult(_0x4824ef,_0xbdb878))[_0x23c7('0x29')](handleError(_0x4824ef,null));};exports[_0x23c7('0x56')]=function(_0x58f44f,_0xffcd31){var _0x2e1635={'raw':!![],'where':{'id':_0x58f44f[_0x23c7('0x57')]['id']}},_0x3fb3f7={};_0x3fb3f7[_0x23c7('0x42')]=_['keys'](db['WhatsappMessage'][_0x23c7('0x3d')]);_0x3fb3f7[_0x23c7('0x3f')]=_['keys'](_0x58f44f[_0x23c7('0x3f')]);_0x3fb3f7[_0x23c7('0x4c')]=_['intersection'](_0x3fb3f7[_0x23c7('0x42')],_0x3fb3f7[_0x23c7('0x3f')]);_0x2e1635[_0x23c7('0x43')]=_[_0x23c7('0x41')](_0x3fb3f7[_0x23c7('0x42')],qs[_0x23c7('0x44')](_0x58f44f[_0x23c7('0x3f')]['fields']));_0x2e1635[_0x23c7('0x43')]=_0x2e1635['attributes']['length']?_0x2e1635['attributes']:_0x3fb3f7[_0x23c7('0x42')];if(_0x58f44f[_0x23c7('0x3f')][_0x23c7('0x52')]){_0x2e1635['include']=[{'all':!![]}];}_0x2e1635=_[_0x23c7('0x4e')]({},_0x2e1635,_0x58f44f[_0x23c7('0x51')]);return db[_0x23c7('0x3c')][_0x23c7('0x58')](_0x2e1635)[_0x23c7('0x37')](handleEntityNotFound(_0xffcd31,null))[_0x23c7('0x37')](respondWithResult(_0xffcd31,null))[_0x23c7('0x29')](handleError(_0xffcd31,null));};exports['create']=function(_0x47d522,_0x58c64a){return db['WhatsappMessage'][_0x23c7('0x59')](_0x47d522[_0x23c7('0x5a')],{})[_0x23c7('0x37')](respondWithResult(_0x58c64a,0xc9))[_0x23c7('0x29')](handleError(_0x58c64a,null));};exports[_0x23c7('0x36')]=function(_0xe09613,_0x17b0d9){if(_0xe09613[_0x23c7('0x5a')]['id']){delete _0xe09613[_0x23c7('0x5a')]['id'];}return db[_0x23c7('0x3c')]['find']({'where':{'id':_0xe09613[_0x23c7('0x57')]['id']}})['then'](handleEntityNotFound(_0x17b0d9,null))[_0x23c7('0x37')](saveUpdates(_0xe09613[_0x23c7('0x5a')],null))[_0x23c7('0x37')](respondWithResult(_0x17b0d9,null))[_0x23c7('0x29')](handleError(_0x17b0d9,null));};exports[_0x23c7('0x38')]=function(_0x3315ad,_0x25a06d){return db[_0x23c7('0x3c')][_0x23c7('0x58')]({'where':{'id':_0x3315ad[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x25a06d,null))[_0x23c7('0x37')](removeEntity(_0x25a06d,null))['catch'](handleError(_0x25a06d,null));};exports['describe']=function(_0x3c7c51,_0x506a7d){return db[_0x23c7('0x3c')][_0x23c7('0x5b')]()['then'](respondWithResult(_0x506a7d,null))[_0x23c7('0x29')](handleError(_0x506a7d,null));};var interaction_log=require(_0x23c7('0x5c'))(_0x23c7('0x5d'));exports[_0x23c7('0x5e')]=function(_0x1d770f,_0x12c3b1,_0x59bafe){var _0x7c253b={'agent':{},'channel':_0x23c7('0x5f')};if(_0x1d770f[_0x23c7('0x5a')]['id']){delete _0x1d770f[_0x23c7('0x5a')]['id'];}_0x1d770f[_0x23c7('0x5a')][_0x23c7('0x60')]=!![];_0x1d770f['body'][_0x23c7('0x61')]=moment()[_0x23c7('0x62')](_0x23c7('0x63'));_0x1d770f[_0x23c7('0x5a')][_0x23c7('0x64')]=_0x1d770f[_0x23c7('0x5a')][_0x23c7('0x64')]||_0x1d770f['user']['id'];_0x7c253b[_0x23c7('0x65')]['id']=_0x1d770f[_0x23c7('0x5a')][_0x23c7('0x64')];return db['WhatsappMessage'][_0x23c7('0x58')]({'where':{'id':_0x1d770f['params']['id'],'UserId':null}})[_0x23c7('0x37')](handleEntityNotFound(_0x12c3b1,null))['then'](saveUpdates(_0x1d770f['body'],null))['then'](function(_0xccc85b){if(_0xccc85b){_0x7c253b[_0x23c7('0x28')]=_0xccc85b[_0x23c7('0x66')]({'plain':!![]});return db[_0x23c7('0x67')][_0x23c7('0x58')]({'where':{'id':_0xccc85b[_0x23c7('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x12c3b1,null))[_0x23c7('0x37')](function(_0x329bf8){if(_0x329bf8){return _0x329bf8[_0x23c7('0x36')]({'UserId':_0x1d770f[_0x23c7('0x5a')][_0x23c7('0x64')],'read1stAt':_[_0x23c7('0x69')](_0x329bf8['read1stAt'])?moment()[_0x23c7('0x62')](_0x23c7('0x63')):undefined});}return null;})[_0x23c7('0x37')](function(_0x497891){if(_0x497891){_0x7c253b[_0x23c7('0x6a')]=_0x497891[_0x23c7('0x66')]({'plain':!![]});interaction_log[_0x23c7('0x6b')](_0x23c7('0x6c'),_0x1d770f[_0x23c7('0x6d')]['id'],_0x1d770f[_0x23c7('0x6d')]['name'],_0x1d770f[_0x23c7('0x6d')][_0x23c7('0x6e')],_0x7c253b[_0x23c7('0x6a')]['id'],_0x1d770f[_0x23c7('0x5a')]?JSON[_0x23c7('0x6f')](_0x1d770f['body']):_0x23c7('0x70'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x7c253b);}return null;})[_0x23c7('0x37')](function(_0x12280a){var _0x5da657=_0x23c7('0x71')+_0x12280a['message'][_0x23c7('0x72')];return db[_0x23c7('0x73')][_0x23c7('0x3f')](_0x5da657,{'type':db[_0x23c7('0x74')]['QueryTypes'][_0x23c7('0x75')],'raw':!![]})[_0x23c7('0x37')](function(_0x43ae10){return _0x43ae10;});})[_0x23c7('0x37')](function(_0x459854){if(_0x459854){_0x7c253b['message'][_0x23c7('0x76')]=_0x459854[0x0];if(!_0x1d770f[_0x23c7('0x5a')]['UserId'])return;return db['User'][_0x23c7('0x58')]({'where':{'id':_0x1d770f[_0x23c7('0x5a')][_0x23c7('0x64')],'role':'agent'},'attributes':['id',_0x23c7('0x3a'),'fullname',_0x23c7('0x77'),_0x23c7('0x78')],'raw':!![]});}return null;})[_0x23c7('0x37')](function(_0x2873d9){if(!_0x2873d9)return null;_0x7c253b['message'][_0x23c7('0x65')]=_0x2873d9;return _0x7c253b;})[_0x23c7('0x37')](function(_0x2a678e){if(_0x2a678e){if(_0x1d770f['body'][_0x23c7('0x79')]){_0x7c253b['message'][_0x23c7('0x7a')]=util[_0x23c7('0x62')](_0x23c7('0x7b'),_0x1d770f[_0x23c7('0x6d')]['name']);_0x7c253b[_0x23c7('0x28')][_0x23c7('0x7c')]=_0x7c253b[_0x23c7('0x7c')];_0x7c253b[_0x23c7('0x28')][_0x23c7('0x7d')]='accept';return respondWithRpcPromise(_0x23c7('0x7e'),_0x23c7('0x7e'),{'event':'acceptmessage','message':_0x7c253b[_0x23c7('0x28')]},client9002)[_0x23c7('0x37')](function(){return _0x7c253b;});}return _0x7c253b;}return null;})[_0x23c7('0x37')](respondWithResult(_0x12c3b1,null))[_0x23c7('0x29')](handleError(_0x12c3b1,null));};var interaction_log=require('../../config/logger')(_0x23c7('0x5d'));exports[_0x23c7('0x35')]=function(_0x227100,_0x3c2bdc,_0x2ed379){var _0x58617f={'agent':{},'channel':_0x23c7('0x5f')};if(_0x227100['body']['id']){delete _0x227100[_0x23c7('0x5a')]['id'];}_0x227100[_0x23c7('0x5a')]['UserId']=_0x227100[_0x23c7('0x5a')][_0x23c7('0x64')]||_0x227100[_0x23c7('0x6d')]['id'];_0x58617f['agent']['id']=_0x227100[_0x23c7('0x5a')][_0x23c7('0x64')];return db[_0x23c7('0x3c')][_0x23c7('0x58')]({'where':{'id':_0x227100[_0x23c7('0x57')]['id'],'UserId':null}})[_0x23c7('0x37')](handleEntityNotFound(_0x3c2bdc,null))[_0x23c7('0x37')](function(_0x28a370){if(_0x28a370){_0x58617f[_0x23c7('0x28')]=_0x28a370[_0x23c7('0x66')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x28a370[_0x23c7('0x68')]}});}return null;})[_0x23c7('0x37')](handleEntityNotFound(_0x3c2bdc,null))['then'](function(_0x1c7adc){if(_0x1c7adc){_0x58617f[_0x23c7('0x6a')]=_0x1c7adc['get']({'plain':!![]});interaction_log[_0x23c7('0x6b')](_0x23c7('0x7f'),_0x227100[_0x23c7('0x6d')]['id'],_0x227100[_0x23c7('0x6d')][_0x23c7('0x3a')],_0x227100[_0x23c7('0x6d')]['role'],_0x58617f[_0x23c7('0x6a')]['id'],_0x227100[_0x23c7('0x5a')]?JSON[_0x23c7('0x6f')](_0x227100[_0x23c7('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0x23c7('0x80'),_0x58617f);}return null;})[_0x23c7('0x37')](function(_0x1cf3e5){var _0x4b3085=_0x23c7('0x71')+_0x1cf3e5[_0x23c7('0x28')][_0x23c7('0x72')];return db[_0x23c7('0x73')][_0x23c7('0x3f')](_0x4b3085,{'type':db[_0x23c7('0x74')][_0x23c7('0x81')][_0x23c7('0x75')],'raw':!![]})[_0x23c7('0x37')](function(_0x290534){return _0x290534;});})['then'](function(_0x258c77){if(_0x258c77){_0x58617f[_0x23c7('0x28')][_0x23c7('0x76')]=_0x258c77[0x0];if(!_0x227100['body'][_0x23c7('0x64')])return;return db[_0x23c7('0x82')]['find']({'where':{'id':_0x227100[_0x23c7('0x5a')][_0x23c7('0x64')],'role':_0x23c7('0x65')},'attributes':['id',_0x23c7('0x3a'),'fullname',_0x23c7('0x77'),_0x23c7('0x78')],'raw':!![]});}return null;})[_0x23c7('0x37')](function(_0x4d040e){if(!_0x4d040e)return null;_0x58617f['message'][_0x23c7('0x65')]=_0x4d040e;return _0x58617f;})[_0x23c7('0x37')](function(_0x36a0b7){if(_0x36a0b7){_0x36a0b7[_0x23c7('0x28')][_0x23c7('0x7a')]=util[_0x23c7('0x62')](_0x23c7('0x7b'),_0x227100[_0x23c7('0x6d')][_0x23c7('0x3a')]);_0x36a0b7['message'][_0x23c7('0x7c')]=_0x58617f['channel'];_0x36a0b7[_0x23c7('0x28')]['event']=_0x23c7('0x35');respondWithRpcPromise(_0x23c7('0x7e'),_0x23c7('0x7e'),{'event':_0x23c7('0x83'),'message':_0x36a0b7['message']},client9002);return _0x58617f;}return null;})['then'](respondWithResult(_0x3c2bdc,null))[_0x23c7('0x29')](handleError(_0x3c2bdc,null));};exports[_0x23c7('0x2b')]=function(_0x4cd6bc,_0x1a3268,_0x1a1eab){if(_0x4cd6bc[_0x23c7('0x5a')]['id']){delete _0x4cd6bc[_0x23c7('0x5a')]['id'];}var _0x245755;return db[_0x23c7('0x3c')][_0x23c7('0x58')]({'where':{'id':_0x4cd6bc[_0x23c7('0x57')]['id']}})[_0x23c7('0x37')](handleEntityNotFound(_0x1a3268,null))['then'](function(_0x3af741){if(_0x3af741){_0x245755=_0x3af741;return db['WhatsappAccount'][_0x23c7('0x58')]({'where':{'id':_0x3af741[_0x23c7('0x84')]}});}})['then'](handleEntityNotFound(_0x1a3268,null))[_0x23c7('0x37')](function(_0x1c74d8){if(_0x1c74d8){logger[_0x23c7('0x24')](_0x23c7('0x85'),_0x23c7('0x2b'),_0x23c7('0x86'),_0x1c74d8[_0x23c7('0x4f')],util['inspect'](_0x4cd6bc[_0x23c7('0x5a')],{'showHidden':![],'depth':null}));switch(_0x1c74d8[_0x23c7('0x4f')]){case _0x23c7('0x87'):if(_0x4cd6bc[_0x23c7('0x5a')][_0x23c7('0x88')]&&_0x4cd6bc[_0x23c7('0x5a')][_0x23c7('0x88')]===_0x245755['messageId']&&_0x4cd6bc['body'][_0x23c7('0x89')]&&_0x4cd6bc[_0x23c7('0x5a')][_0x23c7('0x89')]===_0x23c7('0x60')){return _0x245755[_0x23c7('0x36')]({'read':!![]});}else{logger['error'](_0x23c7('0x8a'),_0x23c7('0x2b'),_0x23c7('0x87'),util[_0x23c7('0x8b')](_0x4cd6bc[_0x23c7('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x245755;}})[_0x23c7('0x37')](respondWithResult(_0x1a3268,null))[_0x23c7('0x29')](handleError(_0x1a3268,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 2ec25f0..600e99e 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 _0x6e6c=['../../mysqldb','setMaxListeners','save','emit','hook','exports','events'];(function(_0xf084dd,_0x54467b){var _0x2f6d39=function(_0x3318e6){while(--_0x3318e6){_0xf084dd['push'](_0xf084dd['shift']());}};_0x2f6d39(++_0x54467b);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xc6e6('0x0'));var WhatsappMessage=require(_0xc6e6('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc6e6('0x2')](0x0);var events={'afterCreate':_0xc6e6('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e97f5){return function(_0x5a9e2b,_0x40b7e1,_0x4b13f0){WhatsappMessageEvents[_0xc6e6('0x4')](_0x2e97f5+':'+_0x5a9e2b['id'],_0x5a9e2b);WhatsappMessageEvents[_0xc6e6('0x4')](_0x2e97f5,_0x5a9e2b);_0x4b13f0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0xc6e6('0x5')](e,emitEvent(event));}}module[_0xc6e6('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x693f=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update'];(function(_0x11ef1d,_0x1b689f){var _0x356d4a=function(_0x1b02ed){while(--_0x1b02ed){_0x11ef1d['push'](_0x11ef1d['shift']());}};_0x356d4a(++_0x1b689f);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0xf693('0x0'));var WhatsappMessage=require(_0xf693('0x1'))['db'][_0xf693('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xf693('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf693('0x4'),'afterDestroy':_0xf693('0x5')};function emitEvent(_0xe37cf3){return function(_0x1d272f,_0x3d2e05,_0x6e749b){WhatsappMessageEvents[_0xf693('0x6')](_0xe37cf3+':'+_0x1d272f['id'],_0x1d272f);WhatsappMessageEvents['emit'](_0xe37cf3,_0x1d272f);_0x6e749b(null);};}for(var e in events){if(events[_0xf693('0x7')](e)){var event=events[e];WhatsappMessage[_0xf693('0x8')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0b92ca4..22ef3b0 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 _0x51dc=['fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','update','createdAt','WhatsappAccount','find','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/status?token=','token','sid','catch','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId'];(function(_0x3a06d3,_0x588a8e){var _0x4055e9=function(_0x487404){while(--_0x487404){_0x3a06d3['push'](_0x3a06d3['shift']());}};_0x4055e9(++_0x588a8e);}(_0x51dc,0xbc));var _0xc51d=function(_0x22bdbf,_0x479aa2){_0x22bdbf=_0x22bdbf-0x0;var _0x5053da=_0x51dc[_0x22bdbf];return _0x5053da;};'use strict';var _=require('lodash');var util=require(_0xc51d('0x0'));var logger=require(_0xc51d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc51d('0x2'));var rp=require(_0xc51d('0x3'));var fs=require('fs');var path=require(_0xc51d('0x4'));var rimraf=require(_0xc51d('0x5'));var config=require(_0xc51d('0x6'));var attributes=require(_0xc51d('0x7'));module['exports']=function(_0x2542b9,_0x1b5953){return _0x2542b9[_0xc51d('0x8')](_0xc51d('0x9'),attributes,{'tableName':_0xc51d('0xa'),'paranoid':![],'indexes':[{'name':_0xc51d('0xb'),'fields':[_0xc51d('0xb')]},{'name':_0xc51d('0xc'),'fields':[_0xc51d('0xd')],'type':_0xc51d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xd2edf0,_0x43a8ac,_0x500321){var _0x5c6a8b=_0x2542b9[_0xc51d('0xf')];var _0x1e09f1=_0xd2edf0[_0xc51d('0x10')]({'plain':!![]});if(_0x1e09f1[_0xc51d('0x11')][_0xc51d('0x12')]()==='in'||_0x1e09f1['direction'][_0xc51d('0x12')]()===_0xc51d('0x13')&&!_0x1e09f1[_0xc51d('0x14')]&&!_[_0xc51d('0x15')](_0x1e09f1[_0xc51d('0x16')])){_0x5c6a8b[_0xc51d('0x17')][_0xc51d('0x18')]({'where':{'id':_0x1e09f1['WhatsappInteractionId']}})['then'](function(_0x3229b0){if(_0x3229b0){_0x3229b0[_0xc51d('0x19')]({'lastMsgAt':_0x1e09f1[_0xc51d('0x1a')],'lastMsgDirection':_0x1e09f1[_0xc51d('0x11')][_0xc51d('0x12')]()});}})['catch'](function(_0x469374){console['error'](_0x469374);});}if(_0x1e09f1[_0xc51d('0x11')]===_0xc51d('0x13')&&!_0x1e09f1[_0xc51d('0x14')]){var _0x479968;_0x5c6a8b[_0xc51d('0x1b')][_0xc51d('0x1c')]({'where':{'id':_0x1e09f1[_0xc51d('0x1d')]},'raw':!![]})[_0xc51d('0x1e')](function(_0x1886f1){_0x479968=_0x1886f1;if(_0x479968&&_0x479968[_0xc51d('0x1f')]){switch(_0x479968[_0xc51d('0x1f')]){case _0xc51d('0x20'):var _0x588670=require('twilio');if(_0x479968['accountSid']&&_0x479968[_0xc51d('0x21')]&&_0x479968[_0xc51d('0x22')]){var _0x5c0153=new _0x588670(_0x479968[_0xc51d('0x23')],_0x479968[_0xc51d('0x21')]);_0x5c0153[_0xc51d('0x24')][_0xc51d('0x25')]({'body':_0x1e09f1[_0xc51d('0xd')],'to':'whatsapp:'+_0x1e09f1[_0xc51d('0x22')],'from':_0xc51d('0x26')+_0x479968[_0xc51d('0x22')],'statusCallback':_0x479968[_0xc51d('0x27')]+'/api/whatsapp/messages/'+_0x1e09f1['id']+_0xc51d('0x28')+_0x479968[_0xc51d('0x29')]})[_0xc51d('0x1e')](function(_0x42daec){if(_0x42daec[_0xc51d('0x2a')]){return _0xd2edf0[_0xc51d('0x19')]({'messageId':_0x42daec['sid']});}})[_0xc51d('0x2b')](function(_0x2958cd){logger[_0xc51d('0x2c')](_0xc51d('0x2d'),_0xc51d('0x2e'),_0xc51d('0x20'),util['inspect'](_0x2958cd,{'showHidden':![],'depth':null}));});}else{logger[_0xc51d('0x2c')](_0xc51d('0x2d'),_0xc51d('0x2e'),_0xc51d('0x20'),_0xc51d('0x2f'));}break;}}})['finally'](function(){_0x500321();});}else{_0x500321();}}},'charset':_0xc51d('0x30'),'collate':_0xc51d('0x31')});}; \ No newline at end of file +var _0x447e=['inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','then','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate'];(function(_0x422d5f,_0x1f00c9){var _0x2bf171=function(_0x22ccb4){while(--_0x22ccb4){_0x422d5f['push'](_0x422d5f['shift']());}};_0x2bf171(++_0x1f00c9);}(_0x447e,0x10c));var _0xe447=function(_0x5b345c,_0xd6fcfd){_0x5b345c=_0x5b345c-0x0;var _0x3c9988=_0x447e[_0x5b345c];return _0x3c9988;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe447('0x0'))(_0xe447('0x1'));var moment=require(_0xe447('0x2'));var BPromise=require('bluebird');var rp=require(_0xe447('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe447('0x4'));module[_0xe447('0x5')]=function(_0x2de47d,_0x2aacc5){return _0x2de47d['define']('WhatsappMessage',attributes,{'tableName':_0xe447('0x6'),'paranoid':![],'indexes':[{'name':_0xe447('0x7'),'fields':[_0xe447('0x7')]},{'name':_0xe447('0x8'),'fields':[_0xe447('0x9')],'type':_0xe447('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f4a87,_0x5bb54c,_0x1c328c){var _0xc2caae=_0x2de47d[_0xe447('0xb')];var _0x47dec4=_0x4f4a87[_0xe447('0xc')]({'plain':!![]});if(_0x47dec4[_0xe447('0xd')][_0xe447('0xe')]()==='in'||_0x47dec4[_0xe447('0xd')][_0xe447('0xe')]()===_0xe447('0xf')&&!_0x47dec4[_0xe447('0x10')]&&!_[_0xe447('0x11')](_0x47dec4[_0xe447('0x12')])){_0xc2caae['WhatsappInteraction'][_0xe447('0x13')]({'where':{'id':_0x47dec4['WhatsappInteractionId']}})['then'](function(_0x568a00){if(_0x568a00){_0x568a00['update']({'lastMsgAt':_0x47dec4[_0xe447('0x14')],'lastMsgDirection':_0x47dec4[_0xe447('0xd')][_0xe447('0xe')]()});}})[_0xe447('0x15')](function(_0x3e9534){console[_0xe447('0x16')](_0x3e9534);});}if(_0x47dec4['direction']===_0xe447('0xf')&&!_0x47dec4['secret']){var _0x37c53a;_0xc2caae[_0xe447('0x17')][_0xe447('0x18')]({'where':{'id':_0x47dec4[_0xe447('0x19')]},'raw':!![]})[_0xe447('0x1a')](function(_0x39430e){_0x37c53a=_0x39430e;if(_0x37c53a&&_0x37c53a['type']){switch(_0x37c53a['type']){case'twilio':var _0x40acd6=require(_0xe447('0x1b'));if(_0x37c53a['accountSid']&&_0x37c53a[_0xe447('0x1c')]&&_0x37c53a[_0xe447('0x1d')]){var _0xfe1031=new _0x40acd6(_0x37c53a[_0xe447('0x1e')],_0x37c53a[_0xe447('0x1c')]);_0xfe1031[_0xe447('0x1f')][_0xe447('0x20')]({'body':_0x47dec4['body'],'to':_0xe447('0x21')+_0x47dec4['phone'],'from':_0xe447('0x21')+_0x37c53a['phone'],'statusCallback':_0x37c53a[_0xe447('0x22')]+_0xe447('0x23')+_0x47dec4['id']+_0xe447('0x24')+_0x37c53a['token']})[_0xe447('0x1a')](function(_0x4c3f72){if(_0x4c3f72[_0xe447('0x25')]){return _0x4f4a87['update']({'messageId':_0x4c3f72[_0xe447('0x25')]});}})[_0xe447('0x15')](function(_0x43cc7d){logger[_0xe447('0x16')](_0xe447('0x26'),_0xe447('0x27'),_0xe447('0x1b'),util[_0xe447('0x28')](_0x43cc7d,{'showHidden':![],'depth':null}));});}else{logger[_0xe447('0x16')](_0xe447('0x26'),_0xe447('0x27'),'twilio',_0xe447('0x29'));}break;}}})['finally'](function(){_0x1c328c();});}else{_0x1c328c();}}},'charset':_0xe447('0x2a'),'collate':_0xe447('0x2b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 154fb4b..d03e685 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 _0x5fa6=['../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','body','options','raw','CreateWhatsappMessage','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4c94d1,_0x573a4f){var _0x48c2c3=function(_0x326bcc){while(--_0x326bcc){_0x4c94d1['push'](_0x4c94d1['shift']());}};_0x48c2c3(++_0x573a4f);}(_0x5fa6,0xcc));var _0x65fa=function(_0x40ba9d,_0x56f93f){_0x40ba9d=_0x40ba9d-0x0;var _0x78bfee=_0x5fa6[_0x40ba9d];return _0x78bfee;};'use strict';var _=require(_0x65fa('0x0'));var util=require(_0x65fa('0x1'));var moment=require('moment');var BPromise=require(_0x65fa('0x2'));var rs=require(_0x65fa('0x3'));var fs=require('fs');var Redis=require(_0x65fa('0x4'));var db=require(_0x65fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x65fa('0x6'))('rpc');var config=require(_0x65fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x65fa('0x8')][_0x65fa('0x9')]({'port':0x232a});config[_0x65fa('0xa')]=_[_0x65fa('0xb')](config[_0x65fa('0xa')],{'host':_0x65fa('0xc'),'port':0x18eb});var socket=require(_0x65fa('0xd'))(new Redis(config[_0x65fa('0xa')]));require(_0x65fa('0xe'))[_0x65fa('0xf')](socket);function respondWithRpcPromise(_0x2fc978,_0x325a4f,_0x1c0fb7){return new BPromise(function(_0x3f7f6a,_0x314afa){return client['request'](_0x2fc978,_0x1c0fb7)[_0x65fa('0x10')](function(_0x4c24cc){logger[_0x65fa('0x11')](_0x65fa('0x12'),_0x325a4f,_0x65fa('0x13'));logger[_0x65fa('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x325a4f,_0x65fa('0x13'),JSON[_0x65fa('0x15')](_0x4c24cc));if(_0x4c24cc[_0x65fa('0x16')]){if(_0x4c24cc['error'][_0x65fa('0x17')]===0x1f4){logger[_0x65fa('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x325a4f,_0x4c24cc[_0x65fa('0x16')][_0x65fa('0x18')]);return _0x314afa(_0x4c24cc[_0x65fa('0x16')][_0x65fa('0x18')]);}logger[_0x65fa('0x16')](_0x65fa('0x12'),_0x325a4f,_0x4c24cc[_0x65fa('0x16')][_0x65fa('0x18')]);return _0x3f7f6a(_0x4c24cc[_0x65fa('0x16')][_0x65fa('0x18')]);}else{logger[_0x65fa('0x11')](_0x65fa('0x12'),_0x325a4f,_0x65fa('0x13'));_0x3f7f6a(_0x4c24cc['result'][_0x65fa('0x18')]);}})[_0x65fa('0x19')](function(_0x432447){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x325a4f,_0x432447);_0x314afa(_0x432447);});});}exports['CreateWhatsappMessage']=function(_0x29bb56){var _0x2d2d03=this;return new Promise(function(_0x2cc05c,_0x2b6525){return db['WhatsappMessage']['create'](_0x29bb56[_0x65fa('0x1a')],{'raw':_0x29bb56[_0x65fa('0x1b')]?_0x29bb56[_0x65fa('0x1b')][_0x65fa('0x1c')]===undefined?!![]:![]:!![]})[_0x65fa('0x10')](function(_0x4c3128){logger[_0x65fa('0x11')](_0x65fa('0x1d'),_0x29bb56);logger['debug']('CreateWhatsappMessage',_0x29bb56,JSON['stringify'](_0x4c3128));_0x2cc05c(_0x4c3128);})['catch'](function(_0xe905b2){logger[_0x65fa('0x16')](_0x65fa('0x1d'),_0xe905b2[_0x65fa('0x18')],_0x29bb56);_0x2b6525(_0x2d2d03['error'](0x1f4,_0xe905b2[_0x65fa('0x18')]));});});}; \ No newline at end of file +var _0x7ebd=['catch','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','result'];(function(_0x1da9b1,_0x1356d7){var _0x1eef81=function(_0x555d35){while(--_0x555d35){_0x1da9b1['push'](_0x1da9b1['shift']());}};_0x1eef81(++_0x1356d7);}(_0x7ebd,0x1c7));var _0xd7eb=function(_0x1f43a6,_0x257d2f){_0x1f43a6=_0x1f43a6-0x0;var _0x5eed9e=_0x7ebd[_0x1f43a6];return _0x5eed9e;};'use strict';var _=require(_0xd7eb('0x0'));var util=require('util');var moment=require(_0xd7eb('0x1'));var BPromise=require(_0xd7eb('0x2'));var rs=require(_0xd7eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd7eb('0x4'))['db'];var utils=require(_0xd7eb('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd7eb('0x6'));var jayson=require(_0xd7eb('0x7'));var client=jayson[_0xd7eb('0x8')][_0xd7eb('0x9')]({'port':0x232a});config[_0xd7eb('0xa')]=_[_0xd7eb('0xb')](config[_0xd7eb('0xa')],{'host':_0xd7eb('0xc'),'port':0x18eb});var socket=require(_0xd7eb('0xd'))(new Redis(config['redis']));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x1c504d,_0x489769,_0x56c4c6){return new BPromise(function(_0x579d9b,_0x11a61a){return client['request'](_0x1c504d,_0x56c4c6)[_0xd7eb('0xe')](function(_0x179c18){logger[_0xd7eb('0xf')]('WhatsappMessage,\x20%s,\x20%s',_0x489769,_0xd7eb('0x10'));logger[_0xd7eb('0x11')](_0xd7eb('0x12'),_0x489769,'request\x20sent',JSON[_0xd7eb('0x13')](_0x179c18));if(_0x179c18[_0xd7eb('0x14')]){if(_0x179c18[_0xd7eb('0x14')][_0xd7eb('0x15')]===0x1f4){logger[_0xd7eb('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x489769,_0x179c18[_0xd7eb('0x14')]['message']);return _0x11a61a(_0x179c18[_0xd7eb('0x14')][_0xd7eb('0x16')]);}logger[_0xd7eb('0x14')](_0xd7eb('0x17'),_0x489769,_0x179c18[_0xd7eb('0x14')]['message']);return _0x579d9b(_0x179c18['error'][_0xd7eb('0x16')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x489769,_0xd7eb('0x10'));_0x579d9b(_0x179c18[_0xd7eb('0x18')]['message']);}})[_0xd7eb('0x19')](function(_0x4cff9b){logger[_0xd7eb('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x489769,_0x4cff9b);_0x11a61a(_0x4cff9b);});});}exports['CreateWhatsappMessage']=function(_0x114564){var _0x448b22=this;return new Promise(function(_0x56d9f8,_0x3c5cea){return db[_0xd7eb('0x1a')][_0xd7eb('0x1b')](_0x114564[_0xd7eb('0x1c')],{'raw':_0x114564[_0xd7eb('0x1d')]?_0x114564[_0xd7eb('0x1d')][_0xd7eb('0x1e')]===undefined?!![]:![]:!![]})[_0xd7eb('0xe')](function(_0x181263){logger[_0xd7eb('0xf')](_0xd7eb('0x1f'),_0x114564);logger[_0xd7eb('0x11')](_0xd7eb('0x1f'),_0x114564,JSON[_0xd7eb('0x13')](_0x181263));_0x56d9f8(_0x181263);})[_0xd7eb('0x19')](function(_0x5cade6){logger[_0xd7eb('0x14')](_0xd7eb('0x1f'),_0x5cade6[_0xd7eb('0x16')],_0x114564);_0x3c5cea(_0x448b22[_0xd7eb('0x14')](0x1f4,_0x5cade6[_0xd7eb('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index aeba388..02fa876 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 _0xbb5f=['emit','removeListener','register','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xbb5f,0x184));var _0xfbb5=function(_0x420dad,_0x1ad5a8){_0x420dad=_0x420dad-0x0;var _0x50556b=_0xbb5f[_0x420dad];return _0x50556b;};'use strict';var WhatsappMessageEvents=require(_0xfbb5('0x0'));var events=[_0xfbb5('0x1'),_0xfbb5('0x2'),_0xfbb5('0x3')];function createListener(_0x16e2ef,_0x5af3d1){return function(_0x3a1bbc){_0x5af3d1[_0xfbb5('0x4')](_0x16e2ef,_0x3a1bbc);};}function removeListener(_0x535d4c,_0x37644a){return function(){WhatsappMessageEvents[_0xfbb5('0x5')](_0x535d4c,_0x37644a);};}exports[_0xfbb5('0x6')]=function(_0x39be33){for(var _0x241938=0x0,_0x443b96=events['length'];_0x241938<_0x443b96;_0x241938++){var _0x421a74=events[_0x241938];var _0x1920b6=createListener(_0xfbb5('0x7')+_0x421a74,_0x39be33);WhatsappMessageEvents['on'](_0x421a74,_0x1920b6);}}; \ No newline at end of file +var _0x1cea=['remove','update','removeListener','register','length','whatsappMessage:','save'];(function(_0x16c5e5,_0x2ad3e6){var _0x4069cc=function(_0x3bc44f){while(--_0x3bc44f){_0x16c5e5['push'](_0x16c5e5['shift']());}};_0x4069cc(++_0x2ad3e6);}(_0x1cea,0x102));var _0xa1ce=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0x1cea[_0xc8db6b];return _0x12cb81;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xa1ce('0x0'),_0xa1ce('0x1'),_0xa1ce('0x2')];function createListener(_0x1c5d7b,_0x5e5563){return function(_0x51e2b0){_0x5e5563['emit'](_0x1c5d7b,_0x51e2b0);};}function removeListener(_0x605188,_0x112693){return function(){WhatsappMessageEvents[_0xa1ce('0x3')](_0x605188,_0x112693);};}exports[_0xa1ce('0x4')]=function(_0x56c91e){for(var _0x15f601=0x0,_0xd94f71=events[_0xa1ce('0x5')];_0x15f601<_0xd94f71;_0x15f601++){var _0x83f910=events[_0x15f601];var _0x4cb0b=createListener(_0xa1ce('0x6')+_0x83f910,_0x56c91e);WhatsappMessageEvents['on'](_0x83f910,_0x4cb0b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7109141..911d3b1 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 _0xc03d=['show','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe'];(function(_0x110ea8,_0xacb6fa){var _0x4073cf=function(_0x444fcb){while(--_0x444fcb){_0x110ea8['push'](_0x110ea8['shift']());}};_0x4073cf(++_0xacb6fa);}(_0xc03d,0x1b5));var _0xdc03=function(_0x45eabe,_0x3b18f4){_0x45eabe=_0x45eabe-0x0;var _0xd297f1=_0xc03d[_0x45eabe];return _0xd297f1;};'use strict';var multer=require('multer');var util=require(_0xdc03('0x0'));var path=require(_0xdc03('0x1'));var timeout=require(_0xdc03('0x2'));var express=require(_0xdc03('0x3'));var router=express['Router']();var fs_extra=require(_0xdc03('0x4'));var auth=require(_0xdc03('0x5'));var interaction=require(_0xdc03('0x6'));var config=require(_0xdc03('0x7'));var controller=require(_0xdc03('0x8'));router[_0xdc03('0x9')]('/',auth[_0xdc03('0xa')](),controller[_0xdc03('0xb')]);router['get'](_0xdc03('0xc'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xdc03('0xa')](),controller[_0xdc03('0xd')]);router[_0xdc03('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xdc03('0xe')]);router[_0xdc03('0x9')](_0xdc03('0xf'),auth[_0xdc03('0xa')](),controller['getTeams']);router[_0xdc03('0x9')](_0xdc03('0x10'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x11')]);router[_0xdc03('0x12')]('/',auth[_0xdc03('0xa')](),controller[_0xdc03('0x13')]);router['post'](_0xdc03('0xf'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x14')]);router['post'](_0xdc03('0x10'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x15')]);router[_0xdc03('0x16')](_0xdc03('0x17'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x18')]);router[_0xdc03('0x19')](_0xdc03('0x17'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x1a')]);router[_0xdc03('0x19')](_0xdc03('0xf'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x1b')]);router[_0xdc03('0x19')](_0xdc03('0x10'),auth[_0xdc03('0xa')](),controller[_0xdc03('0x1c')]);module[_0xdc03('0x1d')]=router; \ No newline at end of file +var _0x378c=['delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x378c,0x159));var _0xc378=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x378c[_0x819464];return _0x49dcc0;};'use strict';var multer=require(_0xc378('0x0'));var util=require(_0xc378('0x1'));var path=require(_0xc378('0x2'));var timeout=require(_0xc378('0x3'));var express=require(_0xc378('0x4'));var router=express['Router']();var fs_extra=require(_0xc378('0x5'));var auth=require(_0xc378('0x6'));var interaction=require(_0xc378('0x7'));var config=require(_0xc378('0x8'));var controller=require(_0xc378('0x9'));router[_0xc378('0xa')]('/',auth[_0xc378('0xb')](),controller[_0xc378('0xc')]);router[_0xc378('0xa')](_0xc378('0xd'),auth[_0xc378('0xb')](),controller['describe']);router[_0xc378('0xa')](_0xc378('0xe'),auth['isAuthenticated'](),controller[_0xc378('0xf')]);router[_0xc378('0xa')](_0xc378('0x10'),auth[_0xc378('0xb')](),controller[_0xc378('0x11')]);router[_0xc378('0xa')](_0xc378('0x12'),auth[_0xc378('0xb')](),controller[_0xc378('0x13')]);router[_0xc378('0xa')](_0xc378('0x14'),auth[_0xc378('0xb')](),controller[_0xc378('0x15')]);router[_0xc378('0x16')]('/',auth[_0xc378('0xb')](),controller[_0xc378('0x17')]);router['post'](_0xc378('0x12'),auth[_0xc378('0xb')](),controller[_0xc378('0x18')]);router[_0xc378('0x16')](_0xc378('0x14'),auth['isAuthenticated'](),controller[_0xc378('0x19')]);router[_0xc378('0x1a')](_0xc378('0xe'),auth[_0xc378('0xb')](),controller['update']);router[_0xc378('0x1b')](_0xc378('0xe'),auth[_0xc378('0xb')](),controller[_0xc378('0x1c')]);router[_0xc378('0x1b')](_0xc378('0x12'),auth['isAuthenticated'](),controller[_0xc378('0x1d')]);router['delete'](_0xc378('0x14'),auth[_0xc378('0xb')](),controller[_0xc378('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c78808d..073f536 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 _0x4b6c=['roundrobin','STRING','sequelize','exports','name','INTEGER','ENUM','beepall'];(function(_0x317764,_0x833545){var _0x2b9070=function(_0x5168d8){while(--_0x5168d8){_0x317764['push'](_0x317764['shift']());}};_0x2b9070(++_0x833545);}(_0x4b6c,0x14a));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc4b6('0x0'));module[_0xc4b6('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xc4b6('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xc4b6('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc4b6('0x4')]('rrmemory',_0xc4b6('0x5'),_0xc4b6('0x6'))},'description':{'type':Sequelize[_0xc4b6('0x7')]}}; \ No newline at end of file +var _0x2bc6=['exports','STRING','beepall','sequelize'];(function(_0x599da4,_0x2ec53d){var _0x380805=function(_0x15d390){while(--_0x15d390){_0x599da4['push'](_0x599da4['shift']());}};_0x380805(++_0x2ec53d);}(_0x2bc6,0x163));var _0x62bc=function(_0x13d67b,_0x52f11e){_0x13d67b=_0x13d67b-0x0;var _0x8b78ac=_0x2bc6[_0x13d67b];return _0x8b78ac;};'use strict';var Sequelize=require(_0x62bc('0x0'));module[_0x62bc('0x1')]={'name':{'type':Sequelize[_0x62bc('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x62bc('0x3'),'roundrobin')},'description':{'type':Sequelize[_0x62bc('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 9d04dc1..d72e9fe 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 _0xb35a=['filter','merge','VIRTUAL','WhatsappQueue','include','findAll','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','UserWhatsappQueue','nolimit','WhatsappQueueId','options','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','pick','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','end','json','limit','undefined','count','status','set','Content-Range','apply','save','update','then','destroy','WhatsappQueues','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','filters'];(function(_0x41c0f7,_0x13623a){var _0x50d64a=function(_0x3022a8){while(--_0x3022a8){_0x41c0f7['push'](_0x41c0f7['shift']());}};_0x50d64a(++_0x13623a);}(_0xb35a,0xd6));var _0xab35=function(_0x2898ee,_0x28fb35){_0x2898ee=_0x2898ee-0x0;var _0xaf68fc=_0xb35a[_0x2898ee];return _0xaf68fc;};'use strict';var emlformat=require(_0xab35('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab35('0x1'));var jsonpatch=require(_0xab35('0x2'));var rp=require(_0xab35('0x3'));var moment=require(_0xab35('0x4'));var BPromise=require(_0xab35('0x5'));var Mustache=require(_0xab35('0x6'));var util=require(_0xab35('0x7'));var path=require(_0xab35('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xab35('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab35('0xa'));var squel=require(_0xab35('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xab35('0xc'));var toCsv=require(_0xab35('0xd'));var querystring=require(_0xab35('0xe'));var Papa=require(_0xab35('0xf'));var Redis=require(_0xab35('0x10'));var authService=require(_0xab35('0x11'));var qs=require(_0xab35('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xab35('0x13'));var logger=require('../../config/logger')(_0xab35('0x14'));var utils=require('../../config/utils');var config=require(_0xab35('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xab35('0x16')]=_[_0xab35('0x17')](config[_0xab35('0x16')],{'host':_0xab35('0x18'),'port':0x18eb});var socket=require(_0xab35('0x19'))(new Redis(config[_0xab35('0x16')]));require(_0xab35('0x1a'))['register'](socket);function respondWithStatusCode(_0x579bee,_0x35863d){_0x35863d=_0x35863d||0xcc;return function(_0x257bb0){if(_0x257bb0){return _0x579bee['sendStatus'](_0x35863d);}return _0x579bee['status'](_0x35863d)[_0xab35('0x1b')]();};}function respondWithResult(_0x40374d,_0x107149){_0x107149=_0x107149||0xc8;return function(_0x4fdf58){if(_0x4fdf58){return _0x40374d['status'](_0x107149)[_0xab35('0x1c')](_0x4fdf58);}};}function respondWithFilteredResult(_0x4cbdb9,_0xee17f0){return function(_0x44a6df){if(_0x44a6df){var _0x19d54a=typeof _0xee17f0['offset']==='undefined'&&typeof _0xee17f0[_0xab35('0x1d')]===_0xab35('0x1e');var _0x415e09=_0x44a6df[_0xab35('0x1f')];var _0x39969a=_0x19d54a?0x0:_0xee17f0['offset'];var _0x3d8dd5=_0x19d54a?_0x44a6df[_0xab35('0x1f')]:_0xee17f0['offset']+_0xee17f0[_0xab35('0x1d')];var _0x354e4d;if(_0x3d8dd5>=_0x415e09){_0x3d8dd5=_0x415e09;_0x354e4d=0xc8;}else{_0x354e4d=0xce;}_0x4cbdb9[_0xab35('0x20')](_0x354e4d);return _0x4cbdb9[_0xab35('0x21')](_0xab35('0x22'),_0x39969a+'-'+_0x3d8dd5+'/'+_0x415e09)[_0xab35('0x1c')](_0x44a6df);}return null;};}function patchUpdates(_0x108c67){return function(_0x341d1b){try{jsonpatch[_0xab35('0x23')](_0x341d1b,_0x108c67,!![]);}catch(_0x382fef){return BPromise['reject'](_0x382fef);}return _0x341d1b[_0xab35('0x24')]();};}function saveUpdates(_0x43ef59,_0x535160){return function(_0x25f929){if(_0x25f929){return _0x25f929[_0xab35('0x25')](_0x43ef59)[_0xab35('0x26')](function(_0x814e3a){return _0x814e3a;});}return null;};}function removeEntity(_0x5c078b,_0x48e168){return function(_0x17b097){if(_0x17b097){return _0x17b097[_0xab35('0x27')]()['then'](function(){var _0x3d0be1=_0x17b097['get']({'plain':!![]});var _0x6b53b=_0xab35('0x28');return db['UserProfileResource'][_0xab35('0x27')]({'where':{'type':_0x6b53b,'resourceId':_0x3d0be1['id']}})[_0xab35('0x26')](function(){return _0x17b097;});})[_0xab35('0x26')](function(){_0x5c078b[_0xab35('0x20')](0xcc)[_0xab35('0x1b')]();});}};}function handleEntityNotFound(_0x12ff35,_0x45915f){return function(_0x41b3c9){if(!_0x41b3c9){_0x12ff35[_0xab35('0x29')](0x194);}return _0x41b3c9;};}function handleError(_0x28ba15,_0x41e264){_0x41e264=_0x41e264||0x1f4;return function(_0x53b480){logger[_0xab35('0x2a')](_0x53b480[_0xab35('0x2b')]);if(_0x53b480['name']){delete _0x53b480[_0xab35('0x2c')];}_0x28ba15[_0xab35('0x20')](_0x41e264)[_0xab35('0x2d')](_0x53b480);};}exports['index']=function(_0xee08dc,_0x478627){var _0x27e6be={},_0x57191b={},_0x4c710d={'count':0x0,'rows':[]};var _0x640e43=_[_0xab35('0x2e')](db['WhatsappQueue'][_0xab35('0x2f')],function(_0x3f1862){return{'name':_0x3f1862[_0xab35('0x30')],'type':_0x3f1862[_0xab35('0x31')][_0xab35('0x32')]};});_0x57191b[_0xab35('0x33')]=_[_0xab35('0x2e')](_0x640e43,_0xab35('0x2c'));_0x57191b[_0xab35('0x34')]=_[_0xab35('0x35')](_0xee08dc[_0xab35('0x34')]);_0x57191b['filters']=_[_0xab35('0x36')](_0x57191b['model'],_0x57191b[_0xab35('0x34')]);_0x27e6be[_0xab35('0x37')]=_[_0xab35('0x36')](_0x57191b['model'],qs['fields'](_0xee08dc[_0xab35('0x34')][_0xab35('0x38')]));_0x27e6be[_0xab35('0x37')]=_0x27e6be['attributes'][_0xab35('0x39')]?_0x27e6be[_0xab35('0x37')]:_0x57191b[_0xab35('0x33')];if(!_0xee08dc['query'][_0xab35('0x3a')]('nolimit')){_0x27e6be[_0xab35('0x1d')]=qs[_0xab35('0x1d')](_0xee08dc[_0xab35('0x34')]['limit']);_0x27e6be[_0xab35('0x3b')]=qs[_0xab35('0x3b')](_0xee08dc['query'][_0xab35('0x3b')]);}_0x27e6be[_0xab35('0x3c')]=qs[_0xab35('0x3d')](_0xee08dc[_0xab35('0x34')][_0xab35('0x3d')]);_0x27e6be[_0xab35('0x3e')]=qs[_0xab35('0x3f')](_['pick'](_0xee08dc[_0xab35('0x34')],_0x57191b[_0xab35('0x3f')]),_0x640e43);if(_0xee08dc['query'][_0xab35('0x40')]){_0x27e6be[_0xab35('0x3e')]=_[_0xab35('0x41')](_0x27e6be[_0xab35('0x3e')],{'$or':_[_0xab35('0x2e')](_0x640e43,function(_0x2d3122){if(_0x2d3122[_0xab35('0x31')]!==_0xab35('0x42')){var _0x4952d3={};_0x4952d3[_0x2d3122['name']]={'$like':'%'+_0xee08dc[_0xab35('0x34')]['filter']+'%'};return _0x4952d3;}})});}_0x27e6be=_[_0xab35('0x41')]({},_0x27e6be,_0xee08dc['options']);var _0x3b078={'where':_0x27e6be[_0xab35('0x3e')]};return db[_0xab35('0x43')][_0xab35('0x1f')](_0x3b078)[_0xab35('0x26')](function(_0x346fa9){_0x4c710d[_0xab35('0x1f')]=_0x346fa9;if(_0xee08dc[_0xab35('0x34')]['includeAll']){_0x27e6be[_0xab35('0x44')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xab35('0x45')](_0x27e6be);})[_0xab35('0x26')](function(_0x1bf092){_0x4c710d['rows']=_0x1bf092;return _0x4c710d;})[_0xab35('0x26')](respondWithFilteredResult(_0x478627,_0x27e6be))[_0xab35('0x46')](handleError(_0x478627,null));};exports[_0xab35('0x47')]=function(_0x1b7798,_0x3e892b){var _0x51da1d={'raw':!![],'where':{'id':_0x1b7798[_0xab35('0x48')]['id']}},_0x13837e={};_0x13837e[_0xab35('0x33')]=_[_0xab35('0x35')](db['WhatsappQueue']['rawAttributes']);_0x13837e[_0xab35('0x34')]=_[_0xab35('0x35')](_0x1b7798[_0xab35('0x34')]);_0x13837e[_0xab35('0x3f')]=_[_0xab35('0x36')](_0x13837e[_0xab35('0x33')],_0x13837e[_0xab35('0x34')]);_0x51da1d['attributes']=_['intersection'](_0x13837e[_0xab35('0x33')],qs[_0xab35('0x38')](_0x1b7798[_0xab35('0x34')][_0xab35('0x38')]));_0x51da1d[_0xab35('0x37')]=_0x51da1d[_0xab35('0x37')][_0xab35('0x39')]?_0x51da1d[_0xab35('0x37')]:_0x13837e[_0xab35('0x33')];if(_0x1b7798[_0xab35('0x34')]['includeAll']){_0x51da1d['include']=[{'all':!![]}];}_0x51da1d=_[_0xab35('0x41')]({},_0x51da1d,_0x1b7798['options']);return db[_0xab35('0x43')]['find'](_0x51da1d)[_0xab35('0x26')](handleEntityNotFound(_0x3e892b,null))[_0xab35('0x26')](respondWithResult(_0x3e892b,null))['catch'](handleError(_0x3e892b,null));};exports[_0xab35('0x49')]=function(_0x2bc995,_0x7c3cd8){return db['WhatsappQueue'][_0xab35('0x49')](_0x2bc995[_0xab35('0x4a')],{})[_0xab35('0x26')](function(_0x386089){var _0x5cf1a3=_0x2bc995[_0xab35('0x4b')][_0xab35('0x4c')]({'plain':!![]});if(!_0x5cf1a3)throw new Error(_0xab35('0x4d'));if(_0x5cf1a3[_0xab35('0x4e')]===_0xab35('0x4b')){var _0x31859c=_0x386089[_0xab35('0x4c')]({'plain':!![]});var _0x16d9ee=_0xab35('0x28');return db[_0xab35('0x4f')][_0xab35('0x50')]({'where':{'name':_0x16d9ee,'userProfileId':_0x5cf1a3[_0xab35('0x51')]},'raw':!![]})['then'](function(_0x5bf9c6){if(_0x5bf9c6&&_0x5bf9c6[_0xab35('0x52')]===0x0){return db[_0xab35('0x53')][_0xab35('0x49')]({'name':_0x31859c[_0xab35('0x2c')],'resourceId':_0x31859c['id'],'type':_0x5bf9c6[_0xab35('0x2c')],'sectionId':_0x5bf9c6['id']},{})[_0xab35('0x26')](function(){return _0x386089;});}else{return _0x386089;}})[_0xab35('0x46')](function(_0xa10d62){logger[_0xab35('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa10d62);throw _0xa10d62;});}return _0x386089;})['then'](respondWithResult(_0x7c3cd8,0xc9))[_0xab35('0x46')](handleError(_0x7c3cd8,null));};exports[_0xab35('0x25')]=function(_0x184658,_0x428062){if(_0x184658[_0xab35('0x4a')]['id']){delete _0x184658[_0xab35('0x4a')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x184658[_0xab35('0x48')]['id']}})['then'](handleEntityNotFound(_0x428062,null))['then'](saveUpdates(_0x184658['body'],null))['then'](respondWithResult(_0x428062,null))[_0xab35('0x46')](handleError(_0x428062,null));};exports[_0xab35('0x27')]=function(_0x5e0bbc,_0x460676){return db[_0xab35('0x43')]['find']({'where':{'id':_0x5e0bbc[_0xab35('0x48')]['id']}})['then'](handleEntityNotFound(_0x460676,null))[_0xab35('0x26')](removeEntity(_0x460676,null))[_0xab35('0x46')](handleError(_0x460676,null));};exports[_0xab35('0x54')]=function(_0x4e0c9f,_0x4526dd){return db['WhatsappQueue'][_0xab35('0x54')]()['then'](respondWithResult(_0x4526dd,null))[_0xab35('0x46')](handleError(_0x4526dd,null));};exports['getMembers']=function(_0x1cfc1c,_0x28a767,_0x2989e3){var _0x1b00bd={'raw':!![],'where':{}},_0x2fddc4={},_0x4650c5;return db[_0xab35('0x43')]['findOne']({'where':{'id':_0x1cfc1c['params']['id']}})[_0xab35('0x26')](handleEntityNotFound(_0x28a767,null))[_0xab35('0x26')](function(_0x2ccb90){if(_0x2ccb90){_0x4650c5=_0x2ccb90[_0xab35('0x4c')]({'plain':!![]});_0x2fddc4[_0xab35('0x33')]=_[_0xab35('0x35')](db[_0xab35('0x55')][_0xab35('0x2f')]);_0x2fddc4['query']=_[_0xab35('0x35')](_0x1cfc1c[_0xab35('0x34')]);_0x2fddc4['filters']=_[_0xab35('0x36')](_0x2fddc4[_0xab35('0x33')],_0x2fddc4[_0xab35('0x34')]);_0x1b00bd[_0xab35('0x37')]=_[_0xab35('0x36')](_0x2fddc4[_0xab35('0x33')],qs[_0xab35('0x38')](_0x1cfc1c[_0xab35('0x34')][_0xab35('0x38')]));_0x1b00bd[_0xab35('0x37')]=_0x1b00bd['attributes'][_0xab35('0x39')]?_0x1b00bd[_0xab35('0x37')]:_0x2fddc4[_0xab35('0x33')];if(!_0x1cfc1c['query'][_0xab35('0x3a')](_0xab35('0x56'))){_0x1b00bd[_0xab35('0x1d')]=qs[_0xab35('0x1d')](_0x1cfc1c[_0xab35('0x34')][_0xab35('0x1d')]);_0x1b00bd[_0xab35('0x3b')]=qs[_0xab35('0x3b')](_0x1cfc1c[_0xab35('0x34')][_0xab35('0x3b')]);}_0x1b00bd[_0xab35('0x3c')]=qs[_0xab35('0x3d')](_0x1cfc1c['query'][_0xab35('0x3d')]);_0x1b00bd[_0xab35('0x3e')]=qs[_0xab35('0x3f')](_['pick'](_0x1cfc1c[_0xab35('0x34')],_0x2fddc4['filters']));_0x1b00bd[_0xab35('0x3e')][_0xab35('0x57')]=_0x2ccb90['id'];if(_0x1cfc1c[_0xab35('0x34')][_0xab35('0x40')]){_0x1b00bd['where']=_['merge'](_0x1b00bd[_0xab35('0x3e')],{'$or':_[_0xab35('0x2e')](_0x1b00bd['attributes'],function(_0x457ddd){var _0x53659a={};_0x53659a[_0x457ddd]={'$like':'%'+_0x1cfc1c[_0xab35('0x34')]['filter']+'%'};return _0x53659a;})});}_0x1b00bd=_['merge']({},_0x1b00bd,_0x1cfc1c[_0xab35('0x58')]);return db[_0xab35('0x55')]['findAll'](_0x1b00bd);}})[_0xab35('0x26')](function(_0x5da4b1){if(_0x5da4b1){return db[_0xab35('0x59')]['findAndCountAll']({'where':{'id':_[_0xab35('0x2e')](_0x5da4b1,_0xab35('0x5a')),'role':_0xab35('0x5b')},'attributes':['id',_0xab35('0x2c'),_0xab35('0x5c'),_0xab35('0x5d'),_0xab35('0x5e')]});}})[_0xab35('0x26')](function(_0x1e26c4){if(_0x1e26c4){return{'count':_0x1e26c4[_0xab35('0x1f')],'rows':_[_0xab35('0x2e')](_0x1e26c4['rows'],function(_0x428c49){return{'membername':_0x428c49[_0xab35('0x2c')],'UserId':_0x428c49['id'],'queue_name':_0x4650c5[_0xab35('0x2c')],'WhatsappQueueId':_0x4650c5['id'],'interface':util[_0xab35('0x5f')](_0xab35('0x60'),_0xab35('0x61'),_0x428c49['name']),'penalty':0x0,'paused':_0x428c49[_0xab35('0x5c')],'createdAt':_0x428c49[_0xab35('0x5e')],'updatedAt':_0x428c49['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x28a767,_0x1b00bd))[_0xab35('0x46')](handleError(_0x28a767,null));};exports[_0xab35('0x62')]=function(_0x1ae445,_0xd522fd,_0x5adac6){var _0x1c0c94={};var _0x2ee0af={};var _0x3db5a3;var _0x2a87c8;return db[_0xab35('0x43')][_0xab35('0x63')]({'where':{'id':_0x1ae445['params']['id']}})[_0xab35('0x26')](handleEntityNotFound(_0xd522fd,null))[_0xab35('0x26')](function(_0x1d5949){if(_0x1d5949){_0x3db5a3=_0x1d5949;_0x2ee0af[_0xab35('0x33')]=_[_0xab35('0x35')](db[_0xab35('0x64')][_0xab35('0x2f')]);_0x2ee0af[_0xab35('0x34')]=_[_0xab35('0x35')](_0x1ae445[_0xab35('0x34')]);_0x2ee0af[_0xab35('0x3f')]=_[_0xab35('0x36')](_0x2ee0af['model'],_0x2ee0af[_0xab35('0x34')]);_0x1c0c94[_0xab35('0x37')]=_[_0xab35('0x36')](_0x2ee0af[_0xab35('0x33')],qs[_0xab35('0x38')](_0x1ae445['query']['fields']));_0x1c0c94['attributes']=_0x1c0c94[_0xab35('0x37')][_0xab35('0x39')]?_0x1c0c94[_0xab35('0x37')]:_0x2ee0af[_0xab35('0x33')];_0x1c0c94[_0xab35('0x3c')]=qs[_0xab35('0x3d')](_0x1ae445[_0xab35('0x34')]['sort']);_0x1c0c94[_0xab35('0x3e')]=qs[_0xab35('0x3f')](_[_0xab35('0x65')](_0x1ae445[_0xab35('0x34')],_0x2ee0af['filters']));if(_0x1ae445[_0xab35('0x34')][_0xab35('0x40')]){_0x1c0c94['where']=_[_0xab35('0x41')](_0x1c0c94[_0xab35('0x3e')],{'$or':_['map'](_0x1c0c94['attributes'],function(_0x598452){var _0x7877fb={};_0x7877fb[_0x598452]={'$like':'%'+_0x1ae445['query'][_0xab35('0x40')]+'%'};return _0x7877fb;})});}_0x1c0c94=_[_0xab35('0x41')]({},_0x1c0c94,_0x1ae445[_0xab35('0x58')]);return _0x3db5a3[_0xab35('0x62')](_0x1c0c94);}})[_0xab35('0x26')](function(_0x50c54b){if(_0x50c54b){_0x2a87c8=_0x50c54b['length'];if(!_0x1ae445[_0xab35('0x34')][_0xab35('0x3a')](_0xab35('0x56'))){_0x1c0c94['limit']=qs[_0xab35('0x1d')](_0x1ae445[_0xab35('0x34')][_0xab35('0x1d')]);_0x1c0c94['offset']=qs[_0xab35('0x3b')](_0x1ae445[_0xab35('0x34')][_0xab35('0x3b')]);}return _0x3db5a3['getTeams'](_0x1c0c94);}})[_0xab35('0x26')](function(_0x29cb09){if(_0x29cb09){return _0x29cb09?{'count':_0x2a87c8,'rows':_0x29cb09}:null;}})[_0xab35('0x26')](respondWithResult(_0xd522fd,null))[_0xab35('0x46')](handleError(_0xd522fd,null));};exports[_0xab35('0x66')]=function(_0x36365b,_0x2ca5d5,_0x598846){var _0x4d3401=_0x36365b['body'][_0xab35('0x67')];return db[_0xab35('0x64')][_0xab35('0x45')]({'where':{'id':_0x4d3401},'attributes':['id'],'include':[{'model':db[_0xab35('0x59')],'as':_0xab35('0x68'),'attributes':['id',_0xab35('0x2c'),_0xab35('0x69'),_0xab35('0x6a'),_0xab35('0x6b')],'raw':!![]}]})[_0xab35('0x26')](function(_0xb1c1d7){if(_0xb1c1d7){var _0x4ddb4b=_[_0xab35('0x6c')](_0xb1c1d7,function(_0x1f8e42){var _0x53b415=_0x1f8e42[_0xab35('0x4c')]({'plain':!![]});return _0x53b415[_0xab35('0x68')];});return db[_0xab35('0x43')][_0xab35('0x50')]({'where':{'id':_0x36365b['params']['id']}})[_0xab35('0x26')](function(_0x5770be){return db[_0xab35('0x6d')]['transaction'](function(_0x47aa59){return _0x5770be[_0xab35('0x66')](_0x4d3401,{'transaction':_0x47aa59})[_0xab35('0x26')](function(){return BPromise[_0xab35('0x6e')](_0x4ddb4b,function(_0x496360){return db[_0xab35('0x55')][_0xab35('0x6f')]({'where':{'UserId':_0x496360['id'],'WhatsappQueueId':_0x36365b[_0xab35('0x48')]['id']},'transaction':_0x47aa59});});})[_0xab35('0x26')](function(){_0x4ddb4b['forEach'](function(_0x1b063d){socket[_0xab35('0x70')](_0xab35('0x71'),{'UserId':_0x1b063d['id'],'WhatsappQueueId':_0x5770be['id']});});});});});}})[_0xab35('0x26')](respondWithStatusCode(_0x2ca5d5,null))[_0xab35('0x46')](handleError(_0x2ca5d5,null));};exports['removeTeams']=function(_0x2430e1,_0x19a618,_0x2b09b2){return db[_0xab35('0x64')]['findAll']({'where':{'id':_0x2430e1['query'][_0xab35('0x67')]},'attributes':['id'],'include':[{'model':db[_0xab35('0x59')],'as':_0xab35('0x68'),'attributes':['id'],'raw':!![]}]})[_0xab35('0x26')](handleEntityNotFound(_0x19a618,null))[_0xab35('0x26')](function(_0x795b2b){var _0x964ed7=_['map'](_0x795b2b,'id');var _0x4ac594=[];var _0x3e75ee=[];var _0x3c7f97=squel[_0xab35('0x72')]();_0x3c7f97[_0xab35('0x73')](_0xab35('0x74'))[_0xab35('0x75')](_0xab35('0x76'),'tq')[_0xab35('0x77')](_0xab35('0x78'),'ut',_0xab35('0x79'))[_0xab35('0x3e')](_0xab35('0x7a'),_0x2430e1[_0xab35('0x48')]['id']);for(var _0x268e88=0x0;_0x268e88<_0x795b2b[_0xab35('0x39')];_0x268e88+=0x1){let _0x43f557=_0x795b2b[_0x268e88];for(var _0x453af2=0x0;_0x453af2<_0x43f557['Agents'][_0xab35('0x39')];_0x453af2+=0x1){let _0x38a3fc=_0x43f557[_0xab35('0x68')][_0x453af2];var _0x124b36=_0x3c7f97['clone']();_0x124b36[_0xab35('0x3e')]('ut.UserId\x20=\x20?',_0x38a3fc['id']);_0x3e75ee[_0xab35('0x7b')](db[_0xab35('0x6d')][_0xab35('0x34')](_0x124b36['toString'](),{'type':db[_0xab35('0x6d')][_0xab35('0x7c')]['SELECT']})['then'](function(_0x4b0497){if(_0x4b0497[_0xab35('0x39')]===0x1){return _0x38a3fc['id'];}else{var _0x5decbb=_['every'](_[_0xab35('0x2e')](_0x4b0497,_0xab35('0x7d')),function(_0x328dd4){return _[_0xab35('0x7e')](_0x964ed7,_0x328dd4);});if(_0x5decbb){return _0x38a3fc['id'];}}}));}}return BPromise[_0xab35('0x7f')](_0x3e75ee)['then'](function(_0x595f5a){_0x4ac594=_(_0x4ac594)[_0xab35('0x80')](_0x595f5a)['compact']()[_0xab35('0x81')]();return db[_0xab35('0x43')]['find']({'where':{'id':_0x2430e1['params']['id']}})[_0xab35('0x26')](function(_0x5cf743){return db[_0xab35('0x6d')]['transaction'](function(_0x13ed1a){return _0x5cf743[_0xab35('0x82')](_0x2430e1[_0xab35('0x34')][_0xab35('0x67')],{'transaction':_0x13ed1a})[_0xab35('0x26')](function(){if(!_[_0xab35('0x83')](_0x4ac594)){return _0x5cf743[_0xab35('0x84')](_0x4ac594,{'transaction':_0x13ed1a});}})['then'](function(){_0x4ac594[_0xab35('0x85')](function(_0x28b959){socket['emit'](_0xab35('0x86'),{'UserId':_0x28b959,'WhatsappQueueId':_0x5cf743['id']});});});});});});})[_0xab35('0x26')](respondWithStatusCode(_0x19a618,null))['catch'](handleError(_0x19a618,null));};exports[_0xab35('0x87')]=function(_0xd9c48d,_0x4e4085,_0x3c2c19){return db[_0xab35('0x43')][_0xab35('0x50')]({'where':{'id':_0xd9c48d[_0xab35('0x48')]['id']}})[_0xab35('0x26')](handleEntityNotFound(_0x4e4085,null))['then'](function(_0x342609){if(_0x342609){return _0x342609[_0xab35('0x87')](_0xd9c48d[_0xab35('0x4a')][_0xab35('0x67')],_[_0xab35('0x88')](_0xd9c48d[_0xab35('0x4a')],[_0xab35('0x67'),'id'])||{})[_0xab35('0x89')](function(_0x3b9683){for(var _0x5817c2=0x0;_0x5817c2<_0xd9c48d['body'][_0xab35('0x67')]['length'];_0x5817c2+=0x1){socket[_0xab35('0x70')](_0xab35('0x71'),{'UserId':Number(_0xd9c48d[_0xab35('0x4a')][_0xab35('0x67')][_0x5817c2]),'WhatsappQueueId':Number(_0xd9c48d[_0xab35('0x48')]['id'])});}return _0x3b9683;});}})['then'](respondWithResult(_0x4e4085,null))[_0xab35('0x46')](handleError(_0x4e4085,null));};exports['removeAgents']=function(_0x4a89df,_0x4f0b28,_0x2a7ebc){return db[_0xab35('0x43')][_0xab35('0x50')]({'where':{'id':_0x4a89df[_0xab35('0x48')]['id']}})[_0xab35('0x26')](handleEntityNotFound(_0x4f0b28,null))[_0xab35('0x26')](function(_0xf084ef){if(_0xf084ef){return _0xf084ef[_0xab35('0x84')](_0x4a89df[_0xab35('0x34')][_0xab35('0x67')])[_0xab35('0x26')](function(){if(_['isArray'](_0x4a89df[_0xab35('0x34')][_0xab35('0x67')])){for(var _0x324b8c=0x0;_0x324b8c<_0x4a89df[_0xab35('0x34')][_0xab35('0x67')][_0xab35('0x39')];_0x324b8c+=0x1){socket[_0xab35('0x70')](_0xab35('0x86'),{'UserId':Number(_0x4a89df[_0xab35('0x34')]['ids'][_0x324b8c]),'WhatsappQueueId':Number(_0x4a89df[_0xab35('0x48')]['id'])});}}else{socket[_0xab35('0x70')](_0xab35('0x86'),{'UserId':Number(_0x4a89df[_0xab35('0x34')]['ids']),'WhatsappQueueId':Number(_0x4a89df[_0xab35('0x48')]['id'])});}});}})[_0xab35('0x26')](respondWithStatusCode(_0x4f0b28,null))['catch'](handleError(_0x4f0b28,null));};exports[_0xab35('0x8a')]=function(_0x40eb48,_0x1b78af,_0x131c75){var _0x14d1e1={};var _0x269e42={};var _0x3dae3c;var _0x5c4cad;return db[_0xab35('0x43')][_0xab35('0x63')]({'where':{'id':_0x40eb48['params']['id']}})['then'](handleEntityNotFound(_0x1b78af,null))[_0xab35('0x26')](function(_0x26911b){if(_0x26911b){_0x3dae3c=_0x26911b;_0x269e42['model']=_[_0xab35('0x35')](db['User'][_0xab35('0x2f')]);_0x269e42[_0xab35('0x34')]=_[_0xab35('0x35')](_0x40eb48[_0xab35('0x34')]);_0x269e42[_0xab35('0x3f')]=_[_0xab35('0x36')](_0x269e42[_0xab35('0x33')],_0x269e42[_0xab35('0x34')]);_0x14d1e1[_0xab35('0x37')]=_[_0xab35('0x36')](_0x269e42[_0xab35('0x33')],qs[_0xab35('0x38')](_0x40eb48['query'][_0xab35('0x38')]));_0x14d1e1[_0xab35('0x37')]=_0x14d1e1[_0xab35('0x37')][_0xab35('0x39')]?_0x14d1e1[_0xab35('0x37')]:_0x269e42[_0xab35('0x33')];_0x14d1e1[_0xab35('0x3c')]=qs[_0xab35('0x3d')](_0x40eb48[_0xab35('0x34')][_0xab35('0x3d')]);_0x14d1e1['where']=qs[_0xab35('0x3f')](_[_0xab35('0x65')](_0x40eb48[_0xab35('0x34')],_0x269e42[_0xab35('0x3f')]));if(_0x40eb48[_0xab35('0x34')][_0xab35('0x40')]){_0x14d1e1['where']=_['merge'](_0x14d1e1[_0xab35('0x3e')],{'$or':_['map'](_0x14d1e1[_0xab35('0x37')],function(_0x218646){var _0x43db9d={};_0x43db9d[_0x218646]={'$like':'%'+_0x40eb48[_0xab35('0x34')]['filter']+'%'};return _0x43db9d;})});}_0x14d1e1=_[_0xab35('0x41')]({},_0x14d1e1,_0x40eb48['options']);return _0x3dae3c[_0xab35('0x8a')](_0x14d1e1);}})[_0xab35('0x26')](function(_0x1a1750){if(_0x1a1750){_0x5c4cad=_0x1a1750['length'];if(!_0x40eb48[_0xab35('0x34')][_0xab35('0x3a')](_0xab35('0x56'))){_0x14d1e1[_0xab35('0x1d')]=qs['limit'](_0x40eb48[_0xab35('0x34')]['limit']);_0x14d1e1[_0xab35('0x3b')]=qs[_0xab35('0x3b')](_0x40eb48[_0xab35('0x34')]['offset']);}return _0x3dae3c['getAgents'](_0x14d1e1);}})[_0xab35('0x26')](function(_0xa6bdd9){if(_0xa6bdd9){return _0xa6bdd9?{'count':_0x5c4cad,'rows':_0xa6bdd9}:null;}})['then'](respondWithResult(_0x1b78af,null))[_0xab35('0x46')](handleError(_0x1b78af,null));}; \ No newline at end of file +var _0xf2c6=['describe','findOne','sort','pick','WhatsappQueueId','UserWhatsappQueue','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','SIP','getTeams','Team','ids','Agents','online','voicePause','sequelize','addTeams','each','findOrCreate','userWhatsappQueue:save','select','field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','clone','push','toString','SELECT','TeamId','includes','all','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','emit','isArray','getAgents','order','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x128ca2,_0x317f92){var _0x5e7378=function(_0x43c742){while(--_0x43c742){_0x128ca2['push'](_0x128ca2['shift']());}};_0x5e7378(++_0x317f92);}(_0xf2c6,0x1da));var _0x6f2c=function(_0x35a274,_0x98b399){_0x35a274=_0x35a274-0x0;var _0x40d905=_0xf2c6[_0x35a274];return _0x40d905;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f2c('0x0'));var zipdir=require(_0x6f2c('0x1'));var jsonpatch=require(_0x6f2c('0x2'));var rp=require(_0x6f2c('0x3'));var moment=require(_0x6f2c('0x4'));var BPromise=require(_0x6f2c('0x5'));var Mustache=require(_0x6f2c('0x6'));var util=require(_0x6f2c('0x7'));var path=require(_0x6f2c('0x8'));var sox=require(_0x6f2c('0x9'));var csv=require(_0x6f2c('0xa'));var ejs=require(_0x6f2c('0xb'));var fs=require('fs');var fs_extra=require(_0x6f2c('0xc'));var _=require(_0x6f2c('0xd'));var squel=require(_0x6f2c('0xe'));var crypto=require(_0x6f2c('0xf'));var jsforce=require(_0x6f2c('0x10'));var deskjs=require(_0x6f2c('0x11'));var toCsv=require(_0x6f2c('0xa'));var querystring=require(_0x6f2c('0x12'));var Papa=require(_0x6f2c('0x13'));var Redis=require(_0x6f2c('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x6f2c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f2c('0x16'));var logger=require(_0x6f2c('0x17'))(_0x6f2c('0x18'));var utils=require(_0x6f2c('0x19'));var config=require(_0x6f2c('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f2c('0x1b'))['db'];config[_0x6f2c('0x1c')]=_[_0x6f2c('0x1d')](config[_0x6f2c('0x1c')],{'host':_0x6f2c('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f2c('0x1c')]));require(_0x6f2c('0x1f'))['register'](socket);function respondWithStatusCode(_0x15195d,_0x3a69f3){_0x3a69f3=_0x3a69f3||0xcc;return function(_0x1b9097){if(_0x1b9097){return _0x15195d[_0x6f2c('0x20')](_0x3a69f3);}return _0x15195d[_0x6f2c('0x21')](_0x3a69f3)[_0x6f2c('0x22')]();};}function respondWithResult(_0x235682,_0x455060){_0x455060=_0x455060||0xc8;return function(_0x29e60d){if(_0x29e60d){return _0x235682[_0x6f2c('0x21')](_0x455060)['json'](_0x29e60d);}};}function respondWithFilteredResult(_0x4c1522,_0x2a14c1){return function(_0x59cd29){if(_0x59cd29){var _0x4156fe=typeof _0x2a14c1[_0x6f2c('0x23')]==='undefined'&&typeof _0x2a14c1[_0x6f2c('0x24')]===_0x6f2c('0x25');var _0x5e675d=_0x59cd29['count'];var _0x443150=_0x4156fe?0x0:_0x2a14c1[_0x6f2c('0x23')];var _0x311245=_0x4156fe?_0x59cd29[_0x6f2c('0x26')]:_0x2a14c1[_0x6f2c('0x23')]+_0x2a14c1[_0x6f2c('0x24')];var _0x3f6d41;if(_0x311245>=_0x5e675d){_0x311245=_0x5e675d;_0x3f6d41=0xc8;}else{_0x3f6d41=0xce;}_0x4c1522['status'](_0x3f6d41);return _0x4c1522[_0x6f2c('0x27')](_0x6f2c('0x28'),_0x443150+'-'+_0x311245+'/'+_0x5e675d)[_0x6f2c('0x29')](_0x59cd29);}return null;};}function patchUpdates(_0x29710c){return function(_0x50821a){try{jsonpatch[_0x6f2c('0x2a')](_0x50821a,_0x29710c,!![]);}catch(_0x17fcdb){return BPromise[_0x6f2c('0x2b')](_0x17fcdb);}return _0x50821a['save']();};}function saveUpdates(_0x888030,_0xbc4313){return function(_0x501da9){if(_0x501da9){return _0x501da9[_0x6f2c('0x2c')](_0x888030)['then'](function(_0x226d40){return _0x226d40;});}return null;};}function removeEntity(_0x171c19,_0x1f0b0f){return function(_0x52a398){if(_0x52a398){return _0x52a398[_0x6f2c('0x2d')]()[_0x6f2c('0x2e')](function(){var _0x1d8de6=_0x52a398[_0x6f2c('0x2f')]({'plain':!![]});var _0x13411a='WhatsappQueues';return db[_0x6f2c('0x30')]['destroy']({'where':{'type':_0x13411a,'resourceId':_0x1d8de6['id']}})[_0x6f2c('0x2e')](function(){return _0x52a398;});})[_0x6f2c('0x2e')](function(){_0x171c19[_0x6f2c('0x21')](0xcc)[_0x6f2c('0x22')]();});}};}function handleEntityNotFound(_0x39b191,_0x326672){return function(_0x1a8ebf){if(!_0x1a8ebf){_0x39b191[_0x6f2c('0x20')](0x194);}return _0x1a8ebf;};}function handleError(_0x409655,_0x52ef9f){_0x52ef9f=_0x52ef9f||0x1f4;return function(_0x305f3d){logger[_0x6f2c('0x31')](_0x305f3d[_0x6f2c('0x32')]);if(_0x305f3d[_0x6f2c('0x33')]){delete _0x305f3d[_0x6f2c('0x33')];}_0x409655[_0x6f2c('0x21')](_0x52ef9f)[_0x6f2c('0x34')](_0x305f3d);};}exports[_0x6f2c('0x35')]=function(_0x4bf943,_0x5d9629){var _0x1fcf5a={},_0x1de423={},_0xf0db54={'count':0x0,'rows':[]};var _0x576da7=_[_0x6f2c('0x36')](db[_0x6f2c('0x37')][_0x6f2c('0x38')],function(_0x36923f){return{'name':_0x36923f['fieldName'],'type':_0x36923f[_0x6f2c('0x39')][_0x6f2c('0x3a')]};});_0x1de423[_0x6f2c('0x3b')]=_['map'](_0x576da7,_0x6f2c('0x33'));_0x1de423['query']=_[_0x6f2c('0x3c')](_0x4bf943['query']);_0x1de423[_0x6f2c('0x3d')]=_[_0x6f2c('0x3e')](_0x1de423[_0x6f2c('0x3b')],_0x1de423[_0x6f2c('0x3f')]);_0x1fcf5a['attributes']=_['intersection'](_0x1de423['model'],qs[_0x6f2c('0x40')](_0x4bf943['query'][_0x6f2c('0x40')]));_0x1fcf5a[_0x6f2c('0x41')]=_0x1fcf5a[_0x6f2c('0x41')][_0x6f2c('0x42')]?_0x1fcf5a['attributes']:_0x1de423['model'];if(!_0x4bf943[_0x6f2c('0x3f')][_0x6f2c('0x43')](_0x6f2c('0x44'))){_0x1fcf5a['limit']=qs[_0x6f2c('0x24')](_0x4bf943[_0x6f2c('0x3f')][_0x6f2c('0x24')]);_0x1fcf5a['offset']=qs['offset'](_0x4bf943['query'][_0x6f2c('0x23')]);}_0x1fcf5a['order']=qs['sort'](_0x4bf943[_0x6f2c('0x3f')]['sort']);_0x1fcf5a[_0x6f2c('0x45')]=qs[_0x6f2c('0x3d')](_['pick'](_0x4bf943[_0x6f2c('0x3f')],_0x1de423[_0x6f2c('0x3d')]),_0x576da7);if(_0x4bf943[_0x6f2c('0x3f')][_0x6f2c('0x46')]){_0x1fcf5a[_0x6f2c('0x45')]=_[_0x6f2c('0x47')](_0x1fcf5a[_0x6f2c('0x45')],{'$or':_[_0x6f2c('0x36')](_0x576da7,function(_0x2840c3){if(_0x2840c3[_0x6f2c('0x39')]!==_0x6f2c('0x48')){var _0x322281={};_0x322281[_0x2840c3[_0x6f2c('0x33')]]={'$like':'%'+_0x4bf943[_0x6f2c('0x3f')][_0x6f2c('0x46')]+'%'};return _0x322281;}})});}_0x1fcf5a=_['merge']({},_0x1fcf5a,_0x4bf943['options']);var _0x32c99b={'where':_0x1fcf5a[_0x6f2c('0x45')]};return db[_0x6f2c('0x37')][_0x6f2c('0x26')](_0x32c99b)[_0x6f2c('0x2e')](function(_0x57ea51){_0xf0db54[_0x6f2c('0x26')]=_0x57ea51;if(_0x4bf943[_0x6f2c('0x3f')][_0x6f2c('0x49')]){_0x1fcf5a[_0x6f2c('0x4a')]=[{'all':!![]}];}return db[_0x6f2c('0x37')][_0x6f2c('0x4b')](_0x1fcf5a);})['then'](function(_0x26adc8){_0xf0db54[_0x6f2c('0x4c')]=_0x26adc8;return _0xf0db54;})[_0x6f2c('0x2e')](respondWithFilteredResult(_0x5d9629,_0x1fcf5a))[_0x6f2c('0x4d')](handleError(_0x5d9629,null));};exports[_0x6f2c('0x4e')]=function(_0x24a891,_0x455476){var _0x4d4c4d={'raw':!![],'where':{'id':_0x24a891[_0x6f2c('0x4f')]['id']}},_0x30ad9c={};_0x30ad9c[_0x6f2c('0x3b')]=_[_0x6f2c('0x3c')](db[_0x6f2c('0x37')][_0x6f2c('0x38')]);_0x30ad9c['query']=_['keys'](_0x24a891['query']);_0x30ad9c['filters']=_['intersection'](_0x30ad9c[_0x6f2c('0x3b')],_0x30ad9c[_0x6f2c('0x3f')]);_0x4d4c4d['attributes']=_[_0x6f2c('0x3e')](_0x30ad9c[_0x6f2c('0x3b')],qs[_0x6f2c('0x40')](_0x24a891[_0x6f2c('0x3f')]['fields']));_0x4d4c4d[_0x6f2c('0x41')]=_0x4d4c4d['attributes'][_0x6f2c('0x42')]?_0x4d4c4d['attributes']:_0x30ad9c[_0x6f2c('0x3b')];if(_0x24a891[_0x6f2c('0x3f')][_0x6f2c('0x49')]){_0x4d4c4d[_0x6f2c('0x4a')]=[{'all':!![]}];}_0x4d4c4d=_[_0x6f2c('0x47')]({},_0x4d4c4d,_0x24a891[_0x6f2c('0x50')]);return db[_0x6f2c('0x37')][_0x6f2c('0x51')](_0x4d4c4d)['then'](handleEntityNotFound(_0x455476,null))[_0x6f2c('0x2e')](respondWithResult(_0x455476,null))[_0x6f2c('0x4d')](handleError(_0x455476,null));};exports[_0x6f2c('0x52')]=function(_0x2899a4,_0x4b5d0c){return db['WhatsappQueue'][_0x6f2c('0x52')](_0x2899a4['body'],{})[_0x6f2c('0x2e')](function(_0x392d78){var _0x27f54f=_0x2899a4[_0x6f2c('0x53')][_0x6f2c('0x2f')]({'plain':!![]});if(!_0x27f54f)throw new Error(_0x6f2c('0x54'));if(_0x27f54f[_0x6f2c('0x55')]===_0x6f2c('0x53')){var _0x191ac0=_0x392d78['get']({'plain':!![]});var _0x3aa682='WhatsappQueues';return db['UserProfileSection'][_0x6f2c('0x51')]({'where':{'name':_0x3aa682,'userProfileId':_0x27f54f[_0x6f2c('0x56')]},'raw':!![]})[_0x6f2c('0x2e')](function(_0x5c182c){if(_0x5c182c&&_0x5c182c[_0x6f2c('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x191ac0[_0x6f2c('0x33')],'resourceId':_0x191ac0['id'],'type':_0x5c182c['name'],'sectionId':_0x5c182c['id']},{})[_0x6f2c('0x2e')](function(){return _0x392d78;});}else{return _0x392d78;}})[_0x6f2c('0x4d')](function(_0x388867){logger['error'](_0x6f2c('0x58'),_0x388867);throw _0x388867;});}return _0x392d78;})[_0x6f2c('0x2e')](respondWithResult(_0x4b5d0c,0xc9))[_0x6f2c('0x4d')](handleError(_0x4b5d0c,null));};exports[_0x6f2c('0x2c')]=function(_0x317b61,_0x4c0c9d){if(_0x317b61[_0x6f2c('0x59')]['id']){delete _0x317b61[_0x6f2c('0x59')]['id'];}return db[_0x6f2c('0x37')]['find']({'where':{'id':_0x317b61[_0x6f2c('0x4f')]['id']}})[_0x6f2c('0x2e')](handleEntityNotFound(_0x4c0c9d,null))[_0x6f2c('0x2e')](saveUpdates(_0x317b61[_0x6f2c('0x59')],null))['then'](respondWithResult(_0x4c0c9d,null))[_0x6f2c('0x4d')](handleError(_0x4c0c9d,null));};exports['destroy']=function(_0x3c89d3,_0x5e0a5c){return db[_0x6f2c('0x37')][_0x6f2c('0x51')]({'where':{'id':_0x3c89d3[_0x6f2c('0x4f')]['id']}})[_0x6f2c('0x2e')](handleEntityNotFound(_0x5e0a5c,null))[_0x6f2c('0x2e')](removeEntity(_0x5e0a5c,null))['catch'](handleError(_0x5e0a5c,null));};exports[_0x6f2c('0x5a')]=function(_0x235d55,_0x2ea66b){return db[_0x6f2c('0x37')][_0x6f2c('0x5a')]()[_0x6f2c('0x2e')](respondWithResult(_0x2ea66b,null))[_0x6f2c('0x4d')](handleError(_0x2ea66b,null));};exports['getMembers']=function(_0x4245c4,_0x240f33,_0x5653da){var _0x3217d1={'raw':!![],'where':{}},_0x46cf4f={},_0x32a2cd;return db[_0x6f2c('0x37')][_0x6f2c('0x5b')]({'where':{'id':_0x4245c4[_0x6f2c('0x4f')]['id']}})[_0x6f2c('0x2e')](handleEntityNotFound(_0x240f33,null))[_0x6f2c('0x2e')](function(_0x30df07){if(_0x30df07){_0x32a2cd=_0x30df07[_0x6f2c('0x2f')]({'plain':!![]});_0x46cf4f[_0x6f2c('0x3b')]=_['keys'](db['UserWhatsappQueue'][_0x6f2c('0x38')]);_0x46cf4f['query']=_['keys'](_0x4245c4[_0x6f2c('0x3f')]);_0x46cf4f[_0x6f2c('0x3d')]=_[_0x6f2c('0x3e')](_0x46cf4f[_0x6f2c('0x3b')],_0x46cf4f[_0x6f2c('0x3f')]);_0x3217d1[_0x6f2c('0x41')]=_[_0x6f2c('0x3e')](_0x46cf4f[_0x6f2c('0x3b')],qs[_0x6f2c('0x40')](_0x4245c4['query']['fields']));_0x3217d1[_0x6f2c('0x41')]=_0x3217d1[_0x6f2c('0x41')][_0x6f2c('0x42')]?_0x3217d1[_0x6f2c('0x41')]:_0x46cf4f['model'];if(!_0x4245c4[_0x6f2c('0x3f')][_0x6f2c('0x43')]('nolimit')){_0x3217d1[_0x6f2c('0x24')]=qs[_0x6f2c('0x24')](_0x4245c4[_0x6f2c('0x3f')]['limit']);_0x3217d1[_0x6f2c('0x23')]=qs['offset'](_0x4245c4['query'][_0x6f2c('0x23')]);}_0x3217d1['order']=qs['sort'](_0x4245c4[_0x6f2c('0x3f')][_0x6f2c('0x5c')]);_0x3217d1['where']=qs[_0x6f2c('0x3d')](_[_0x6f2c('0x5d')](_0x4245c4['query'],_0x46cf4f[_0x6f2c('0x3d')]));_0x3217d1[_0x6f2c('0x45')][_0x6f2c('0x5e')]=_0x30df07['id'];if(_0x4245c4[_0x6f2c('0x3f')]['filter']){_0x3217d1[_0x6f2c('0x45')]=_['merge'](_0x3217d1[_0x6f2c('0x45')],{'$or':_[_0x6f2c('0x36')](_0x3217d1[_0x6f2c('0x41')],function(_0x50275a){var _0x3d7c58={};_0x3d7c58[_0x50275a]={'$like':'%'+_0x4245c4[_0x6f2c('0x3f')]['filter']+'%'};return _0x3d7c58;})});}_0x3217d1=_[_0x6f2c('0x47')]({},_0x3217d1,_0x4245c4['options']);return db[_0x6f2c('0x5f')][_0x6f2c('0x4b')](_0x3217d1);}})[_0x6f2c('0x2e')](function(_0x573078){if(_0x573078){return db[_0x6f2c('0x60')][_0x6f2c('0x61')]({'where':{'id':_[_0x6f2c('0x36')](_0x573078,'UserId'),'role':_0x6f2c('0x62')},'attributes':['id',_0x6f2c('0x33'),_0x6f2c('0x63'),_0x6f2c('0x64'),_0x6f2c('0x65')]});}})[_0x6f2c('0x2e')](function(_0x52f6df){if(_0x52f6df){return{'count':_0x52f6df['count'],'rows':_[_0x6f2c('0x36')](_0x52f6df[_0x6f2c('0x4c')],function(_0x139de6){return{'membername':_0x139de6[_0x6f2c('0x33')],'UserId':_0x139de6['id'],'queue_name':_0x32a2cd[_0x6f2c('0x33')],'WhatsappQueueId':_0x32a2cd['id'],'interface':util['format']('%s/%s',_0x6f2c('0x66'),_0x139de6[_0x6f2c('0x33')]),'penalty':0x0,'paused':_0x139de6[_0x6f2c('0x63')],'createdAt':_0x139de6[_0x6f2c('0x65')],'updatedAt':_0x139de6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6f2c('0x2e')](respondWithFilteredResult(_0x240f33,_0x3217d1))[_0x6f2c('0x4d')](handleError(_0x240f33,null));};exports[_0x6f2c('0x67')]=function(_0x1ba527,_0xc9db79,_0x42e11e){var _0x12b31b={};var _0xf59bf7={};var _0x27ecc0;var _0x20b9fa;return db[_0x6f2c('0x37')][_0x6f2c('0x5b')]({'where':{'id':_0x1ba527[_0x6f2c('0x4f')]['id']}})[_0x6f2c('0x2e')](handleEntityNotFound(_0xc9db79,null))[_0x6f2c('0x2e')](function(_0x6bdf52){if(_0x6bdf52){_0x27ecc0=_0x6bdf52;_0xf59bf7[_0x6f2c('0x3b')]=_[_0x6f2c('0x3c')](db[_0x6f2c('0x68')][_0x6f2c('0x38')]);_0xf59bf7[_0x6f2c('0x3f')]=_[_0x6f2c('0x3c')](_0x1ba527[_0x6f2c('0x3f')]);_0xf59bf7[_0x6f2c('0x3d')]=_['intersection'](_0xf59bf7[_0x6f2c('0x3b')],_0xf59bf7[_0x6f2c('0x3f')]);_0x12b31b[_0x6f2c('0x41')]=_[_0x6f2c('0x3e')](_0xf59bf7[_0x6f2c('0x3b')],qs[_0x6f2c('0x40')](_0x1ba527[_0x6f2c('0x3f')][_0x6f2c('0x40')]));_0x12b31b[_0x6f2c('0x41')]=_0x12b31b[_0x6f2c('0x41')][_0x6f2c('0x42')]?_0x12b31b[_0x6f2c('0x41')]:_0xf59bf7['model'];_0x12b31b['order']=qs[_0x6f2c('0x5c')](_0x1ba527[_0x6f2c('0x3f')][_0x6f2c('0x5c')]);_0x12b31b[_0x6f2c('0x45')]=qs[_0x6f2c('0x3d')](_['pick'](_0x1ba527['query'],_0xf59bf7['filters']));if(_0x1ba527[_0x6f2c('0x3f')]['filter']){_0x12b31b['where']=_['merge'](_0x12b31b[_0x6f2c('0x45')],{'$or':_[_0x6f2c('0x36')](_0x12b31b['attributes'],function(_0x36df7d){var _0x520204={};_0x520204[_0x36df7d]={'$like':'%'+_0x1ba527[_0x6f2c('0x3f')][_0x6f2c('0x46')]+'%'};return _0x520204;})});}_0x12b31b=_[_0x6f2c('0x47')]({},_0x12b31b,_0x1ba527[_0x6f2c('0x50')]);return _0x27ecc0[_0x6f2c('0x67')](_0x12b31b);}})[_0x6f2c('0x2e')](function(_0x466f78){if(_0x466f78){_0x20b9fa=_0x466f78['length'];if(!_0x1ba527[_0x6f2c('0x3f')]['hasOwnProperty'](_0x6f2c('0x44'))){_0x12b31b[_0x6f2c('0x24')]=qs['limit'](_0x1ba527['query'][_0x6f2c('0x24')]);_0x12b31b[_0x6f2c('0x23')]=qs['offset'](_0x1ba527[_0x6f2c('0x3f')][_0x6f2c('0x23')]);}return _0x27ecc0['getTeams'](_0x12b31b);}})[_0x6f2c('0x2e')](function(_0x3b8dea){if(_0x3b8dea){return _0x3b8dea?{'count':_0x20b9fa,'rows':_0x3b8dea}:null;}})[_0x6f2c('0x2e')](respondWithResult(_0xc9db79,null))['catch'](handleError(_0xc9db79,null));};exports['addTeams']=function(_0x3cbbf3,_0x151037,_0x13d94b){var _0x2f7bad=_0x3cbbf3[_0x6f2c('0x59')][_0x6f2c('0x69')];return db[_0x6f2c('0x68')]['findAll']({'where':{'id':_0x2f7bad},'attributes':['id'],'include':[{'model':db[_0x6f2c('0x60')],'as':_0x6f2c('0x6a'),'attributes':['id','name',_0x6f2c('0x6b'),_0x6f2c('0x6c'),'interface'],'raw':!![]}]})[_0x6f2c('0x2e')](function(_0x3632d5){if(_0x3632d5){var _0x436f65=_['flatMap'](_0x3632d5,function(_0x167c7c){var _0x2db2eb=_0x167c7c[_0x6f2c('0x2f')]({'plain':!![]});return _0x2db2eb[_0x6f2c('0x6a')];});return db[_0x6f2c('0x37')][_0x6f2c('0x51')]({'where':{'id':_0x3cbbf3['params']['id']}})[_0x6f2c('0x2e')](function(_0x2affde){return db[_0x6f2c('0x6d')]['transaction'](function(_0x5ce847){return _0x2affde[_0x6f2c('0x6e')](_0x2f7bad,{'transaction':_0x5ce847})[_0x6f2c('0x2e')](function(){return BPromise[_0x6f2c('0x6f')](_0x436f65,function(_0x4cf24e){return db[_0x6f2c('0x5f')][_0x6f2c('0x70')]({'where':{'UserId':_0x4cf24e['id'],'WhatsappQueueId':_0x3cbbf3[_0x6f2c('0x4f')]['id']},'transaction':_0x5ce847});});})['then'](function(){_0x436f65['forEach'](function(_0x39e5d2){socket['emit'](_0x6f2c('0x71'),{'UserId':_0x39e5d2['id'],'WhatsappQueueId':_0x2affde['id']});});});});});}})[_0x6f2c('0x2e')](respondWithStatusCode(_0x151037,null))[_0x6f2c('0x4d')](handleError(_0x151037,null));};exports['removeTeams']=function(_0x5ecf11,_0x1067d2,_0x5c2ca5){return db[_0x6f2c('0x68')][_0x6f2c('0x4b')]({'where':{'id':_0x5ecf11[_0x6f2c('0x3f')][_0x6f2c('0x69')]},'attributes':['id'],'include':[{'model':db[_0x6f2c('0x60')],'as':_0x6f2c('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x6f2c('0x2e')](handleEntityNotFound(_0x1067d2,null))['then'](function(_0x5bf480){var _0x15216f=_['map'](_0x5bf480,'id');var _0x5ee26f=[];var _0x1ea03d=[];var _0x362286=squel[_0x6f2c('0x72')]();_0x362286[_0x6f2c('0x73')](_0x6f2c('0x74'))['from'](_0x6f2c('0x75'),'tq')['join'](_0x6f2c('0x76'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6f2c('0x45')]('WhatsappQueueId\x20=\x20?',_0x5ecf11[_0x6f2c('0x4f')]['id']);for(var _0x2fc254=0x0;_0x2fc254<_0x5bf480[_0x6f2c('0x42')];_0x2fc254+=0x1){let _0x16617e=_0x5bf480[_0x2fc254];for(var _0xa605f3=0x0;_0xa605f3<_0x16617e['Agents'][_0x6f2c('0x42')];_0xa605f3+=0x1){let _0x1e6637=_0x16617e[_0x6f2c('0x6a')][_0xa605f3];var _0x6045f7=_0x362286[_0x6f2c('0x77')]();_0x6045f7[_0x6f2c('0x45')]('ut.UserId\x20=\x20?',_0x1e6637['id']);_0x1ea03d[_0x6f2c('0x78')](db[_0x6f2c('0x6d')][_0x6f2c('0x3f')](_0x6045f7[_0x6f2c('0x79')](),{'type':db[_0x6f2c('0x6d')]['QueryTypes'][_0x6f2c('0x7a')]})[_0x6f2c('0x2e')](function(_0x551770){if(_0x551770['length']===0x1){return _0x1e6637['id'];}else{var _0xa0cdc5=_['every'](_[_0x6f2c('0x36')](_0x551770,_0x6f2c('0x7b')),function(_0x44b1af){return _[_0x6f2c('0x7c')](_0x15216f,_0x44b1af);});if(_0xa0cdc5){return _0x1e6637['id'];}}}));}}return BPromise[_0x6f2c('0x7d')](_0x1ea03d)[_0x6f2c('0x2e')](function(_0xfffc5d){_0x5ee26f=_(_0x5ee26f)[_0x6f2c('0x7e')](_0xfffc5d)[_0x6f2c('0x7f')]()[_0x6f2c('0x80')]();return db[_0x6f2c('0x37')][_0x6f2c('0x51')]({'where':{'id':_0x5ecf11['params']['id']}})['then'](function(_0x18919e){return db[_0x6f2c('0x6d')][_0x6f2c('0x81')](function(_0x200f44){return _0x18919e[_0x6f2c('0x82')](_0x5ecf11['query'][_0x6f2c('0x69')],{'transaction':_0x200f44})[_0x6f2c('0x2e')](function(){if(!_[_0x6f2c('0x83')](_0x5ee26f)){return _0x18919e[_0x6f2c('0x84')](_0x5ee26f,{'transaction':_0x200f44});}})[_0x6f2c('0x2e')](function(){_0x5ee26f[_0x6f2c('0x85')](function(_0x110693){socket['emit'](_0x6f2c('0x86'),{'UserId':_0x110693,'WhatsappQueueId':_0x18919e['id']});});});});});});})[_0x6f2c('0x2e')](respondWithStatusCode(_0x1067d2,null))['catch'](handleError(_0x1067d2,null));};exports['addAgents']=function(_0x1e52a1,_0x2f767e,_0x364a01){return db[_0x6f2c('0x37')][_0x6f2c('0x51')]({'where':{'id':_0x1e52a1[_0x6f2c('0x4f')]['id']}})[_0x6f2c('0x2e')](handleEntityNotFound(_0x2f767e,null))[_0x6f2c('0x2e')](function(_0x531fd4){if(_0x531fd4){return _0x531fd4[_0x6f2c('0x87')](_0x1e52a1[_0x6f2c('0x59')][_0x6f2c('0x69')],_[_0x6f2c('0x88')](_0x1e52a1['body'],[_0x6f2c('0x69'),'id'])||{})['spread'](function(_0x1294e9){for(var _0x5f3a04=0x0;_0x5f3a04<_0x1e52a1[_0x6f2c('0x59')]['ids'][_0x6f2c('0x42')];_0x5f3a04+=0x1){socket[_0x6f2c('0x89')](_0x6f2c('0x71'),{'UserId':Number(_0x1e52a1[_0x6f2c('0x59')][_0x6f2c('0x69')][_0x5f3a04]),'WhatsappQueueId':Number(_0x1e52a1[_0x6f2c('0x4f')]['id'])});}return _0x1294e9;});}})[_0x6f2c('0x2e')](respondWithResult(_0x2f767e,null))[_0x6f2c('0x4d')](handleError(_0x2f767e,null));};exports[_0x6f2c('0x84')]=function(_0x24d020,_0x20cd8d,_0x3d27e8){return db[_0x6f2c('0x37')][_0x6f2c('0x51')]({'where':{'id':_0x24d020[_0x6f2c('0x4f')]['id']}})[_0x6f2c('0x2e')](handleEntityNotFound(_0x20cd8d,null))[_0x6f2c('0x2e')](function(_0x2104bb){if(_0x2104bb){return _0x2104bb[_0x6f2c('0x84')](_0x24d020[_0x6f2c('0x3f')][_0x6f2c('0x69')])[_0x6f2c('0x2e')](function(){if(_[_0x6f2c('0x8a')](_0x24d020[_0x6f2c('0x3f')][_0x6f2c('0x69')])){for(var _0x1b10cb=0x0;_0x1b10cb<_0x24d020[_0x6f2c('0x3f')][_0x6f2c('0x69')]['length'];_0x1b10cb+=0x1){socket[_0x6f2c('0x89')](_0x6f2c('0x86'),{'UserId':Number(_0x24d020[_0x6f2c('0x3f')][_0x6f2c('0x69')][_0x1b10cb]),'WhatsappQueueId':Number(_0x24d020[_0x6f2c('0x4f')]['id'])});}}else{socket[_0x6f2c('0x89')](_0x6f2c('0x86'),{'UserId':Number(_0x24d020['query']['ids']),'WhatsappQueueId':Number(_0x24d020[_0x6f2c('0x4f')]['id'])});}});}})['then'](respondWithStatusCode(_0x20cd8d,null))['catch'](handleError(_0x20cd8d,null));};exports[_0x6f2c('0x8b')]=function(_0x383259,_0x483a08,_0x1826b6){var _0x2bf08e={};var _0x341ad3={};var _0x569873;var _0x223a31;return db[_0x6f2c('0x37')][_0x6f2c('0x5b')]({'where':{'id':_0x383259[_0x6f2c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x483a08,null))[_0x6f2c('0x2e')](function(_0x5c35ca){if(_0x5c35ca){_0x569873=_0x5c35ca;_0x341ad3[_0x6f2c('0x3b')]=_['keys'](db['User'][_0x6f2c('0x38')]);_0x341ad3[_0x6f2c('0x3f')]=_[_0x6f2c('0x3c')](_0x383259['query']);_0x341ad3['filters']=_[_0x6f2c('0x3e')](_0x341ad3[_0x6f2c('0x3b')],_0x341ad3[_0x6f2c('0x3f')]);_0x2bf08e[_0x6f2c('0x41')]=_[_0x6f2c('0x3e')](_0x341ad3['model'],qs[_0x6f2c('0x40')](_0x383259[_0x6f2c('0x3f')]['fields']));_0x2bf08e[_0x6f2c('0x41')]=_0x2bf08e[_0x6f2c('0x41')][_0x6f2c('0x42')]?_0x2bf08e[_0x6f2c('0x41')]:_0x341ad3[_0x6f2c('0x3b')];_0x2bf08e[_0x6f2c('0x8c')]=qs[_0x6f2c('0x5c')](_0x383259[_0x6f2c('0x3f')][_0x6f2c('0x5c')]);_0x2bf08e['where']=qs[_0x6f2c('0x3d')](_[_0x6f2c('0x5d')](_0x383259[_0x6f2c('0x3f')],_0x341ad3['filters']));if(_0x383259['query'][_0x6f2c('0x46')]){_0x2bf08e[_0x6f2c('0x45')]=_['merge'](_0x2bf08e['where'],{'$or':_[_0x6f2c('0x36')](_0x2bf08e[_0x6f2c('0x41')],function(_0x36434f){var _0x24b0fc={};_0x24b0fc[_0x36434f]={'$like':'%'+_0x383259[_0x6f2c('0x3f')][_0x6f2c('0x46')]+'%'};return _0x24b0fc;})});}_0x2bf08e=_[_0x6f2c('0x47')]({},_0x2bf08e,_0x383259[_0x6f2c('0x50')]);return _0x569873[_0x6f2c('0x8b')](_0x2bf08e);}})[_0x6f2c('0x2e')](function(_0x30367f){if(_0x30367f){_0x223a31=_0x30367f[_0x6f2c('0x42')];if(!_0x383259['query'][_0x6f2c('0x43')](_0x6f2c('0x44'))){_0x2bf08e['limit']=qs[_0x6f2c('0x24')](_0x383259['query']['limit']);_0x2bf08e[_0x6f2c('0x23')]=qs[_0x6f2c('0x23')](_0x383259[_0x6f2c('0x3f')][_0x6f2c('0x23')]);}return _0x569873[_0x6f2c('0x8b')](_0x2bf08e);}})['then'](function(_0x487ff9){if(_0x487ff9){return _0x487ff9?{'count':_0x223a31,'rows':_0x487ff9}:null;}})['then'](respondWithResult(_0x483a08,null))[_0x6f2c('0x4d')](handleError(_0x483a08,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 6a8bc84..8e1b4cf 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 _0x0951=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','save','update','emit'];(function(_0x24332e,_0x4208e5){var _0x1b54e1=function(_0x706d7d){while(--_0x706d7d){_0x24332e['push'](_0x24332e['shift']());}};_0x1b54e1(++_0x4208e5);}(_0x0951,0xae));var _0x1095=function(_0x2a2e5a,_0x559064){_0x2a2e5a=_0x2a2e5a-0x0;var _0x5bd549=_0x0951[_0x2a2e5a];return _0x5bd549;};'use strict';var EventEmitter=require(_0x1095('0x0'));var WhatsappQueue=require(_0x1095('0x1'))['db'][_0x1095('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1095('0x3'),'afterUpdate':_0x1095('0x4'),'afterDestroy':'remove'};function emitEvent(_0x347b9a){return function(_0x2848a0,_0x2681d8,_0x1ff74f){WhatsappQueueEvents['emit'](_0x347b9a+':'+_0x2848a0['id'],_0x2848a0);WhatsappQueueEvents[_0x1095('0x5')](_0x347b9a,_0x2848a0);_0x1ff74f(null);};}for(var e in events){if(events[_0x1095('0x6')](e)){var event=events[e];WhatsappQueue[_0x1095('0x7')](e,emitEvent(event));}}module[_0x1095('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0x710e=['events','../../mysqldb','update','emit','hasOwnProperty','exports'];(function(_0x3dcfd6,_0x1a0526){var _0x392ac7=function(_0x515e1e){while(--_0x515e1e){_0x3dcfd6['push'](_0x3dcfd6['shift']());}};_0x392ac7(++_0x1a0526);}(_0x710e,0xd8));var _0xe710=function(_0x4e928c,_0x334a0c){_0x4e928c=_0x4e928c-0x0;var _0x5c4985=_0x710e[_0x4e928c];return _0x5c4985;};'use strict';var EventEmitter=require(_0xe710('0x0'));var WhatsappQueue=require(_0xe710('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe710('0x2'),'afterDestroy':'remove'};function emitEvent(_0x17ef01){return function(_0x176a7d,_0x4a7c7b,_0xf92f83){WhatsappQueueEvents[_0xe710('0x3')](_0x17ef01+':'+_0x176a7d['id'],_0x176a7d);WhatsappQueueEvents[_0xe710('0x3')](_0x17ef01,_0x176a7d);_0xf92f83(null);};}for(var e in events){if(events[_0xe710('0x4')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0xe710('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e745167..98ffbdd 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 _0xc135=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','api','path'];(function(_0x5e8eae,_0x4f81e0){var _0xdd09cd=function(_0x28c85c){while(--_0x28c85c){_0x5e8eae['push'](_0x5e8eae['shift']());}};_0xdd09cd(++_0x4f81e0);}(_0xc135,0x15a));var _0x5c13=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc135[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x5c13('0x0'));var util=require(_0x5c13('0x1'));var logger=require('../../config/logger')(_0x5c13('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5c13('0x3'));var rimraf=require('rimraf');var config=require(_0x5c13('0x4'));var attributes=require(_0x5c13('0x5'));module[_0x5c13('0x6')]=function(_0x4869be,_0x5538f7){return _0x4869be[_0x5c13('0x7')](_0x5c13('0x8'),attributes,{'tableName':_0x5c13('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5bb5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','define','whatsapp_queues'];(function(_0x39c5dd,_0x1cc742){var _0x3053d5=function(_0x2f2b3a){while(--_0x2f2b3a){_0x39c5dd['push'](_0x39c5dd['shift']());}};_0x3053d5(++_0x1cc742);}(_0x5bb5,0x15c));var _0x55bb=function(_0x6f3461,_0x5402ff){_0x6f3461=_0x6f3461-0x0;var _0x540d33=_0x5bb5[_0x6f3461];return _0x540d33;};'use strict';var _=require(_0x55bb('0x0'));var util=require(_0x55bb('0x1'));var logger=require(_0x55bb('0x2'))(_0x55bb('0x3'));var moment=require(_0x55bb('0x4'));var BPromise=require(_0x55bb('0x5'));var rp=require(_0x55bb('0x6'));var fs=require('fs');var path=require(_0x55bb('0x7'));var rimraf=require(_0x55bb('0x8'));var config=require('../../config/environment');var attributes=require(_0x55bb('0x9'));module['exports']=function(_0x298135,_0x4d14bf){return _0x298135[_0x55bb('0xa')]('WhatsappQueue',attributes,{'tableName':_0x55bb('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 16985b2..deadc7a 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 _0x2819=['then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','limit','map','include','model','attributes','stringify','ShowWhatsappQueue','find','raw','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request'];(function(_0x5159fd,_0x4b760b){var _0x409bae=function(_0x30f5f0){while(--_0x30f5f0){_0x5159fd['push'](_0x5159fd['shift']());}};_0x409bae(++_0x4b760b);}(_0x2819,0x6b));var _0x9281=function(_0x4069d0,_0x44af90){_0x4069d0=_0x4069d0-0x0;var _0x412e06=_0x2819[_0x4069d0];return _0x412e06;};'use strict';var _=require(_0x9281('0x0'));var util=require(_0x9281('0x1'));var moment=require(_0x9281('0x2'));var BPromise=require(_0x9281('0x3'));var rs=require(_0x9281('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9281('0x5'))['db'];var utils=require(_0x9281('0x6'));var logger=require(_0x9281('0x7'))('rpc');var config=require(_0x9281('0x8'));var jayson=require(_0x9281('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x9281('0xa')]=_[_0x9281('0xb')](config[_0x9281('0xa')],{'host':_0x9281('0xc'),'port':0x18eb});var socket=require(_0x9281('0xd'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x9281('0xe')](socket);function respondWithRpcPromise(_0x382dc9,_0x4e5846,_0x344f5b){return new BPromise(function(_0xef8113,_0x147787){return client[_0x9281('0xf')](_0x382dc9,_0x344f5b)[_0x9281('0x10')](function(_0xc2e227){logger['info'](_0x9281('0x11'),_0x4e5846,_0x9281('0x12'));logger['debug'](_0x9281('0x13'),_0x4e5846,_0x9281('0x12'),JSON['stringify'](_0xc2e227));if(_0xc2e227['error']){if(_0xc2e227[_0x9281('0x14')][_0x9281('0x15')]===0x1f4){logger[_0x9281('0x14')](_0x9281('0x11'),_0x4e5846,_0xc2e227[_0x9281('0x14')]['message']);return _0x147787(_0xc2e227[_0x9281('0x14')][_0x9281('0x16')]);}logger[_0x9281('0x14')](_0x9281('0x11'),_0x4e5846,_0xc2e227['error'][_0x9281('0x16')]);return _0xef8113(_0xc2e227[_0x9281('0x14')][_0x9281('0x16')]);}else{logger[_0x9281('0x17')](_0x9281('0x11'),_0x4e5846,_0x9281('0x12'));_0xef8113(_0xc2e227[_0x9281('0x18')][_0x9281('0x16')]);}})[_0x9281('0x19')](function(_0x50d9eb){logger[_0x9281('0x14')](_0x9281('0x11'),_0x4e5846,_0x50d9eb);_0x147787(_0x50d9eb);});});}exports[_0x9281('0x1a')]=function(_0x403339){var _0xb0b41f=this;return new Promise(function(_0x4bb0a7,_0x1a5933){return db[_0x9281('0x1b')][_0x9281('0x1c')]({'raw':_0x403339[_0x9281('0x1d')]?_0x403339[_0x9281('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x403339[_0x9281('0x1d')]?_0x403339[_0x9281('0x1d')][_0x9281('0x1e')]||null:null,'attributes':_0x403339[_0x9281('0x1d')]?_0x403339[_0x9281('0x1d')]['attributes']||null:null,'limit':_0x403339[_0x9281('0x1d')]?_0x403339[_0x9281('0x1d')][_0x9281('0x1f')]||null:null,'include':_0x403339[_0x9281('0x1d')]?_0x403339[_0x9281('0x1d')]['include']?_[_0x9281('0x20')](_0x403339[_0x9281('0x1d')]['include'],function(_0x3979d6){return{'model':db[_0x3979d6['model']],'as':_0x3979d6['as'],'attributes':_0x3979d6['attributes'],'include':_0x3979d6[_0x9281('0x21')]?_[_0x9281('0x20')](_0x3979d6[_0x9281('0x21')],function(_0x23418d){return{'model':db[_0x23418d[_0x9281('0x22')]],'as':_0x23418d['as'],'attributes':_0x23418d[_0x9281('0x23')],'include':_0x23418d['include']?_[_0x9281('0x20')](_0x23418d[_0x9281('0x21')],function(_0x5be33e){return{'model':db[_0x5be33e[_0x9281('0x22')]],'as':_0x5be33e['as'],'attributes':_0x5be33e[_0x9281('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9281('0x10')](function(_0x5c8222){logger[_0x9281('0x17')](_0x9281('0x1a'),_0x403339);logger['debug']('GetWhatsappQueue',_0x403339,JSON[_0x9281('0x24')](_0x5c8222));_0x4bb0a7(_0x5c8222);})[_0x9281('0x19')](function(_0x417c73){logger[_0x9281('0x14')](_0x9281('0x1a'),_0x417c73[_0x9281('0x16')],_0x403339);_0x1a5933(_0xb0b41f[_0x9281('0x14')](0x1f4,_0x417c73[_0x9281('0x16')]));});});};exports[_0x9281('0x25')]=function(_0x2ae7dd){var _0x546765=this;return new Promise(function(_0x4f2ec9,_0x4397c2){return db[_0x9281('0x1b')][_0x9281('0x26')]({'raw':_0x2ae7dd[_0x9281('0x1d')]?_0x2ae7dd[_0x9281('0x1d')][_0x9281('0x27')]===undefined?!![]:![]:!![],'where':_0x2ae7dd[_0x9281('0x1d')]?_0x2ae7dd[_0x9281('0x1d')][_0x9281('0x1e')]||null:null,'attributes':_0x2ae7dd['options']?_0x2ae7dd[_0x9281('0x1d')][_0x9281('0x23')]||null:null,'include':_0x2ae7dd[_0x9281('0x1d')]?_0x2ae7dd[_0x9281('0x1d')]['include']?_[_0x9281('0x20')](_0x2ae7dd[_0x9281('0x1d')][_0x9281('0x21')],function(_0x4e4001){return{'model':db[_0x4e4001[_0x9281('0x22')]],'as':_0x4e4001['as'],'attributes':_0x4e4001[_0x9281('0x23')],'include':_0x4e4001[_0x9281('0x21')]?_[_0x9281('0x20')](_0x4e4001[_0x9281('0x21')],function(_0x4c7549){return{'model':db[_0x4c7549['model']],'as':_0x4c7549['as'],'attributes':_0x4c7549[_0x9281('0x23')],'include':_0x4c7549[_0x9281('0x21')]?_[_0x9281('0x20')](_0x4c7549['include'],function(_0x3c9e13){return{'model':db[_0x3c9e13['model']],'as':_0x3c9e13['as'],'attributes':_0x3c9e13[_0x9281('0x23')]};}):[]};}):[]};}):[]:[]})[_0x9281('0x10')](function(_0x367802){logger[_0x9281('0x17')](_0x9281('0x25'),_0x2ae7dd);logger[_0x9281('0x28')]('ShowWhatsappQueue',_0x2ae7dd,JSON[_0x9281('0x24')](_0x367802));_0x4f2ec9(_0x367802);})[_0x9281('0x19')](function(_0x12a952){logger[_0x9281('0x14')](_0x9281('0x25'),_0x12a952[_0x9281('0x16')],_0x2ae7dd);_0x4397c2(_0x546765[_0x9281('0x14')](0x1f4,_0x12a952[_0x9281('0x16')]));});});}; \ No newline at end of file +var _0x6962=['WhatsappQueue','where','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','./whatsappQueue.socket','register','request','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','request\x20sent','GetWhatsappQueue','findAll','raw','options','limit','include','map','model','attributes','catch','ShowWhatsappQueue'];(function(_0x1d4a4b,_0x1703b0){var _0x3942c0=function(_0x157eb6){while(--_0x157eb6){_0x1d4a4b['push'](_0x1d4a4b['shift']());}};_0x3942c0(++_0x1703b0);}(_0x6962,0x174));var _0x2696=function(_0x4d9fd9,_0x2eae8b){_0x4d9fd9=_0x4d9fd9-0x0;var _0x4d6339=_0x6962[_0x4d9fd9];return _0x4d6339;};'use strict';var _=require(_0x2696('0x0'));var util=require('util');var moment=require(_0x2696('0x1'));var BPromise=require(_0x2696('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2696('0x3'));var db=require(_0x2696('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2696('0x5'));var config=require(_0x2696('0x6'));var jayson=require(_0x2696('0x7'));var client=jayson['client'][_0x2696('0x8')]({'port':0x232a});config['redis']=_[_0x2696('0x9')](config['redis'],{'host':_0x2696('0xa'),'port':0x18eb});var socket=require(_0x2696('0xb'))(new Redis(config[_0x2696('0xc')]));require(_0x2696('0xd'))[_0x2696('0xe')](socket);function respondWithRpcPromise(_0x57a808,_0x4b43e4,_0x1c3210){return new BPromise(function(_0x1fbcac,_0x2e6527){return client[_0x2696('0xf')](_0x57a808,_0x1c3210)['then'](function(_0xfbcab5){logger[_0x2696('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x4b43e4,'request\x20sent');logger[_0x2696('0x11')](_0x2696('0x12'),_0x4b43e4,'request\x20sent',JSON[_0x2696('0x13')](_0xfbcab5));if(_0xfbcab5[_0x2696('0x14')]){if(_0xfbcab5[_0x2696('0x14')]['code']===0x1f4){logger[_0x2696('0x14')](_0x2696('0x15'),_0x4b43e4,_0xfbcab5[_0x2696('0x14')][_0x2696('0x16')]);return _0x2e6527(_0xfbcab5['error'][_0x2696('0x16')]);}logger['error'](_0x2696('0x15'),_0x4b43e4,_0xfbcab5[_0x2696('0x14')]['message']);return _0x1fbcac(_0xfbcab5[_0x2696('0x14')][_0x2696('0x16')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x4b43e4,_0x2696('0x17'));_0x1fbcac(_0xfbcab5['result'][_0x2696('0x16')]);}})['catch'](function(_0x49c26b){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x4b43e4,_0x49c26b);_0x2e6527(_0x49c26b);});});}exports[_0x2696('0x18')]=function(_0x1f656b){var _0x37c619=this;return new Promise(function(_0x50a2cf,_0x21ae0c){return db['WhatsappQueue'][_0x2696('0x19')]({'raw':_0x1f656b['options']?_0x1f656b['options'][_0x2696('0x1a')]===undefined?!![]:![]:!![],'where':_0x1f656b[_0x2696('0x1b')]?_0x1f656b['options']['where']||null:null,'attributes':_0x1f656b[_0x2696('0x1b')]?_0x1f656b['options']['attributes']||null:null,'limit':_0x1f656b[_0x2696('0x1b')]?_0x1f656b[_0x2696('0x1b')][_0x2696('0x1c')]||null:null,'include':_0x1f656b[_0x2696('0x1b')]?_0x1f656b[_0x2696('0x1b')][_0x2696('0x1d')]?_[_0x2696('0x1e')](_0x1f656b[_0x2696('0x1b')][_0x2696('0x1d')],function(_0x40e02f){return{'model':db[_0x40e02f[_0x2696('0x1f')]],'as':_0x40e02f['as'],'attributes':_0x40e02f[_0x2696('0x20')],'include':_0x40e02f[_0x2696('0x1d')]?_[_0x2696('0x1e')](_0x40e02f[_0x2696('0x1d')],function(_0x42d5e9){return{'model':db[_0x42d5e9['model']],'as':_0x42d5e9['as'],'attributes':_0x42d5e9['attributes'],'include':_0x42d5e9[_0x2696('0x1d')]?_[_0x2696('0x1e')](_0x42d5e9[_0x2696('0x1d')],function(_0x5e3531){return{'model':db[_0x5e3531[_0x2696('0x1f')]],'as':_0x5e3531['as'],'attributes':_0x5e3531[_0x2696('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3379e8){logger['info']('GetWhatsappQueue',_0x1f656b);logger['debug']('GetWhatsappQueue',_0x1f656b,JSON[_0x2696('0x13')](_0x3379e8));_0x50a2cf(_0x3379e8);})[_0x2696('0x21')](function(_0x340d07){logger[_0x2696('0x14')](_0x2696('0x18'),_0x340d07[_0x2696('0x16')],_0x1f656b);_0x21ae0c(_0x37c619[_0x2696('0x14')](0x1f4,_0x340d07[_0x2696('0x16')]));});});};exports[_0x2696('0x22')]=function(_0x4a4f4d){var _0x4df2cd=this;return new Promise(function(_0x538828,_0x1466a2){return db[_0x2696('0x23')]['find']({'raw':_0x4a4f4d[_0x2696('0x1b')]?_0x4a4f4d['options'][_0x2696('0x1a')]===undefined?!![]:![]:!![],'where':_0x4a4f4d[_0x2696('0x1b')]?_0x4a4f4d[_0x2696('0x1b')][_0x2696('0x24')]||null:null,'attributes':_0x4a4f4d['options']?_0x4a4f4d[_0x2696('0x1b')][_0x2696('0x20')]||null:null,'include':_0x4a4f4d[_0x2696('0x1b')]?_0x4a4f4d[_0x2696('0x1b')][_0x2696('0x1d')]?_[_0x2696('0x1e')](_0x4a4f4d[_0x2696('0x1b')][_0x2696('0x1d')],function(_0x157abc){return{'model':db[_0x157abc[_0x2696('0x1f')]],'as':_0x157abc['as'],'attributes':_0x157abc[_0x2696('0x20')],'include':_0x157abc[_0x2696('0x1d')]?_[_0x2696('0x1e')](_0x157abc[_0x2696('0x1d')],function(_0x350eb3){return{'model':db[_0x350eb3['model']],'as':_0x350eb3['as'],'attributes':_0x350eb3['attributes'],'include':_0x350eb3['include']?_[_0x2696('0x1e')](_0x350eb3[_0x2696('0x1d')],function(_0x10257d){return{'model':db[_0x10257d['model']],'as':_0x10257d['as'],'attributes':_0x10257d[_0x2696('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36edff){logger[_0x2696('0x10')](_0x2696('0x22'),_0x4a4f4d);logger['debug'](_0x2696('0x22'),_0x4a4f4d,JSON[_0x2696('0x13')](_0x36edff));_0x538828(_0x36edff);})[_0x2696('0x21')](function(_0x166c43){logger[_0x2696('0x14')](_0x2696('0x22'),_0x166c43['message'],_0x4a4f4d);_0x1466a2(_0x4df2cd[_0x2696('0x14')](0x1f4,_0x166c43[_0x2696('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 67e6997..9c4b3a9 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 _0xfe76=['register','length','./whatsappQueue.events','emit','removeListener'];(function(_0xd7f8f7,_0x42785e){var _0x34b92c=function(_0x4833c9){while(--_0x4833c9){_0xd7f8f7['push'](_0xd7f8f7['shift']());}};_0x34b92c(++_0x42785e);}(_0xfe76,0x7f));var _0x6fe7=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0xfe76[_0x2a7b8e];return _0x29b5c8;};'use strict';var WhatsappQueueEvents=require(_0x6fe7('0x0'));var events=['save','remove','update'];function createListener(_0x17466b,_0x70b232){return function(_0x558530){_0x70b232[_0x6fe7('0x1')](_0x17466b,_0x558530);};}function removeListener(_0x56e863,_0x47871b){return function(){WhatsappQueueEvents[_0x6fe7('0x2')](_0x56e863,_0x47871b);};}exports[_0x6fe7('0x3')]=function(_0x270f71){for(var _0x5dd9e7=0x0,_0x878e3d=events[_0x6fe7('0x4')];_0x5dd9e7<_0x878e3d;_0x5dd9e7++){var _0x25f7c3=events[_0x5dd9e7];var _0x8b0c2b=createListener('whatsappQueue:'+_0x25f7c3,_0x270f71);WhatsappQueueEvents['on'](_0x25f7c3,_0x8b0c2b);}}; \ No newline at end of file +var _0xa037=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa037,0x1ad));var _0x7a03=function(_0x34885a,_0x2998da){_0x34885a=_0x34885a-0x0;var _0x37f3ff=_0xa037[_0x34885a];return _0x37f3ff;};'use strict';var WhatsappQueueEvents=require(_0x7a03('0x0'));var events=[_0x7a03('0x1'),_0x7a03('0x2'),'update'];function createListener(_0x3ad179,_0xd72dac){return function(_0x205021){_0xd72dac[_0x7a03('0x3')](_0x3ad179,_0x205021);};}function removeListener(_0x4098e1,_0x245dc2){return function(){WhatsappQueueEvents[_0x7a03('0x4')](_0x4098e1,_0x245dc2);};}exports[_0x7a03('0x5')]=function(_0x137b14){for(var _0x4a35df=0x0,_0x3a366b=events[_0x7a03('0x6')];_0x4a35df<_0x3a366b;_0x4a35df++){var _0x6f7817=events[_0x4a35df];var _0x55331f=createListener(_0x7a03('0x7')+_0x6f7817,_0x137b14);WhatsappQueueEvents['on'](_0x6f7817,_0x55331f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index e70f4a8..2236c93 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 _0x8506=['delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','/:id','show','create','put','update'];(function(_0x352bda,_0x40960c){var _0x319a89=function(_0x34f253){while(--_0x34f253){_0x352bda['push'](_0x352bda['shift']());}};_0x319a89(++_0x40960c);}(_0x8506,0x17d));var _0x6850=function(_0x3a32ec,_0x58f40e){_0x3a32ec=_0x3a32ec-0x0;var _0xe226bf=_0x8506[_0x3a32ec];return _0xe226bf;};'use strict';var multer=require(_0x6850('0x0'));var util=require(_0x6850('0x1'));var path=require(_0x6850('0x2'));var timeout=require(_0x6850('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6850('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6850('0x5'));router[_0x6850('0x6')]('/',auth['isAuthenticated'](),controller[_0x6850('0x7')]);router[_0x6850('0x6')](_0x6850('0x8'),auth[_0x6850('0x9')](),controller['describe']);router[_0x6850('0x6')](_0x6850('0xa'),auth['isAuthenticated'](),controller[_0x6850('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6850('0xc')]);router[_0x6850('0xd')](_0x6850('0xa'),auth[_0x6850('0x9')](),controller[_0x6850('0xe')]);router[_0x6850('0xf')](_0x6850('0xa'),auth[_0x6850('0x9')](),controller[_0x6850('0x10')]);module[_0x6850('0x11')]=router; \ No newline at end of file +var _0x9d11=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','/:id','show','isAuthenticated','create','put','update','destroy','exports','multer','path'];(function(_0x23a957,_0x1d2f90){var _0x490836=function(_0x57ac39){while(--_0x57ac39){_0x23a957['push'](_0x23a957['shift']());}};_0x490836(++_0x1d2f90);}(_0x9d11,0x17a));var _0x19d1=function(_0x1795df,_0xcb261e){_0x1795df=_0x1795df-0x0;var _0x3f13c0=_0x9d11[_0x1795df];return _0x3f13c0;};'use strict';var multer=require(_0x19d1('0x0'));var util=require('util');var path=require(_0x19d1('0x1'));var timeout=require(_0x19d1('0x2'));var express=require('express');var router=express[_0x19d1('0x3')]();var fs_extra=require(_0x19d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x19d1('0x5'));var config=require(_0x19d1('0x6'));var controller=require(_0x19d1('0x7'));router[_0x19d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x19d1('0x9')]);router[_0x19d1('0x8')](_0x19d1('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x19d1('0x8')](_0x19d1('0xb'),auth['isAuthenticated'](),controller[_0x19d1('0xc')]);router['post']('/',auth[_0x19d1('0xd')](),controller[_0x19d1('0xe')]);router[_0x19d1('0xf')]('/:id',auth[_0x19d1('0xd')](),controller[_0x19d1('0x10')]);router['delete'](_0x19d1('0xb'),auth[_0x19d1('0xd')](),controller[_0x19d1('0x11')]);module[_0x19d1('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 42260d8..2dd1da1 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(_0x3725d7,_0x10fca2){var _0x329180=function(_0x3f4499){while(--_0x3f4499){_0x3725d7['push'](_0x3725d7['shift']());}};_0x329180(++_0x10fca2);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x27541e,_0x159fd4){var _0x130758=function(_0x5856a5){while(--_0x5856a5){_0x27541e['push'](_0x27541e['shift']());}};_0x130758(++_0x159fd4);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index f54c150..dde6715 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 _0xefda=['body','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','WhatsappQueueReport','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create'];(function(_0x4c894b,_0x54fa91){var _0x490258=function(_0x145534){while(--_0x145534){_0x4c894b['push'](_0x4c894b['shift']());}};_0x490258(++_0x54fa91);}(_0xefda,0x96));var _0xaefd=function(_0x444889,_0x291162){_0x444889=_0x444889-0x0;var _0x48bfec=_0xefda[_0x444889];return _0x48bfec;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];function respondWithStatusCode(_0x382983,_0x2a310c){_0x2a310c=_0x2a310c||0xcc;return function(_0x4b2b5c){if(_0x4b2b5c){return _0x382983[_0xaefd('0x18')](_0x2a310c);}return _0x382983['status'](_0x2a310c)[_0xaefd('0x19')]();};}function respondWithResult(_0x1725af,_0x9dfdf6){_0x9dfdf6=_0x9dfdf6||0xc8;return function(_0x43b82a){if(_0x43b82a){return _0x1725af['status'](_0x9dfdf6)[_0xaefd('0x1a')](_0x43b82a);}};}function respondWithFilteredResult(_0x13492c,_0x41f345){return function(_0x411701){if(_0x411701){var _0x10ee28=typeof _0x41f345[_0xaefd('0x1b')]===_0xaefd('0x1c')&&typeof _0x41f345[_0xaefd('0x1d')]==='undefined';var _0x9d9c29=_0x411701[_0xaefd('0x1e')];var _0x9748f4=_0x10ee28?0x0:_0x41f345[_0xaefd('0x1b')];var _0x2db61b=_0x10ee28?_0x411701[_0xaefd('0x1e')]:_0x41f345['offset']+_0x41f345[_0xaefd('0x1d')];var _0x182f9a;if(_0x2db61b>=_0x9d9c29){_0x2db61b=_0x9d9c29;_0x182f9a=0xc8;}else{_0x182f9a=0xce;}_0x13492c[_0xaefd('0x1f')](_0x182f9a);return _0x13492c[_0xaefd('0x20')](_0xaefd('0x21'),_0x9748f4+'-'+_0x2db61b+'/'+_0x9d9c29)[_0xaefd('0x1a')](_0x411701);}return null;};}function patchUpdates(_0x5282ed){return function(_0x463d48){try{jsonpatch[_0xaefd('0x22')](_0x463d48,_0x5282ed,!![]);}catch(_0x2dcdd8){return BPromise[_0xaefd('0x23')](_0x2dcdd8);}return _0x463d48[_0xaefd('0x24')]();};}function saveUpdates(_0x577fb7,_0x479486){return function(_0x5b9967){if(_0x5b9967){return _0x5b9967[_0xaefd('0x25')](_0x577fb7)[_0xaefd('0x26')](function(_0x313a6f){return _0x313a6f;});}return null;};}function removeEntity(_0x5a44ed,_0x23060f){return function(_0x4cd9b2){if(_0x4cd9b2){return _0x4cd9b2[_0xaefd('0x27')]()[_0xaefd('0x26')](function(){_0x5a44ed[_0xaefd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x435413,_0x3ffc9c){return function(_0x18e720){if(!_0x18e720){_0x435413[_0xaefd('0x18')](0x194);}return _0x18e720;};}function handleError(_0x33862f,_0x5a170c){_0x5a170c=_0x5a170c||0x1f4;return function(_0x2fe27e){logger['error'](_0x2fe27e[_0xaefd('0x28')]);if(_0x2fe27e[_0xaefd('0x29')]){delete _0x2fe27e['name'];}_0x33862f[_0xaefd('0x1f')](_0x5a170c)[_0xaefd('0x2a')](_0x2fe27e);};}exports['index']=function(_0xbeb1b8,_0x114ec0){var _0x36b6b7={},_0x4c0898={},_0x45f0e8={'count':0x0,'rows':[]};var _0x5c573b=_[_0xaefd('0x2b')](db['WhatsappQueueReport']['rawAttributes'],function(_0x1d89c4){return{'name':_0x1d89c4[_0xaefd('0x2c')],'type':_0x1d89c4['type']['key']};});_0x4c0898['model']=_[_0xaefd('0x2b')](_0x5c573b,_0xaefd('0x29'));_0x4c0898['query']=_['keys'](_0xbeb1b8[_0xaefd('0x2d')]);_0x4c0898[_0xaefd('0x2e')]=_[_0xaefd('0x2f')](_0x4c0898[_0xaefd('0x30')],_0x4c0898['query']);_0x36b6b7[_0xaefd('0x31')]=_[_0xaefd('0x2f')](_0x4c0898[_0xaefd('0x30')],qs[_0xaefd('0x32')](_0xbeb1b8[_0xaefd('0x2d')][_0xaefd('0x32')]));_0x36b6b7[_0xaefd('0x31')]=_0x36b6b7[_0xaefd('0x31')][_0xaefd('0x33')]?_0x36b6b7[_0xaefd('0x31')]:_0x4c0898[_0xaefd('0x30')];if(!_0xbeb1b8[_0xaefd('0x2d')][_0xaefd('0x34')](_0xaefd('0x35'))){_0x36b6b7[_0xaefd('0x1d')]=qs[_0xaefd('0x1d')](_0xbeb1b8['query'][_0xaefd('0x1d')]);_0x36b6b7[_0xaefd('0x1b')]=qs[_0xaefd('0x1b')](_0xbeb1b8['query'][_0xaefd('0x1b')]);}_0x36b6b7['order']=qs[_0xaefd('0x36')](_0xbeb1b8[_0xaefd('0x2d')][_0xaefd('0x36')]);_0x36b6b7[_0xaefd('0x37')]=qs[_0xaefd('0x2e')](_[_0xaefd('0x38')](_0xbeb1b8[_0xaefd('0x2d')],_0x4c0898[_0xaefd('0x2e')]),_0x5c573b);if(_0xbeb1b8[_0xaefd('0x2d')][_0xaefd('0x39')]){_0x36b6b7[_0xaefd('0x37')]=_[_0xaefd('0x3a')](_0x36b6b7[_0xaefd('0x37')],{'$or':_[_0xaefd('0x2b')](_0x5c573b,function(_0x5c327d){if(_0x5c327d[_0xaefd('0x3b')]!=='VIRTUAL'){var _0xf869a1={};_0xf869a1[_0x5c327d[_0xaefd('0x29')]]={'$like':'%'+_0xbeb1b8[_0xaefd('0x2d')][_0xaefd('0x39')]+'%'};return _0xf869a1;}})});}_0x36b6b7=_[_0xaefd('0x3a')]({},_0x36b6b7,_0xbeb1b8[_0xaefd('0x3c')]);var _0xa98181={'where':_0x36b6b7[_0xaefd('0x37')]};return db[_0xaefd('0x3d')][_0xaefd('0x1e')](_0xa98181)['then'](function(_0x696af5){_0x45f0e8[_0xaefd('0x1e')]=_0x696af5;if(_0xbeb1b8['query'][_0xaefd('0x3e')]){_0x36b6b7[_0xaefd('0x3f')]=[{'all':!![]}];}return db[_0xaefd('0x3d')]['findAll'](_0x36b6b7);})['then'](function(_0x43b6a6){_0x45f0e8[_0xaefd('0x40')]=_0x43b6a6;return _0x45f0e8;})[_0xaefd('0x26')](respondWithFilteredResult(_0x114ec0,_0x36b6b7))[_0xaefd('0x41')](handleError(_0x114ec0,null));};exports[_0xaefd('0x42')]=function(_0xa145c6,_0x2e17b5){var _0x2e98aa={'raw':!![],'where':{'id':_0xa145c6[_0xaefd('0x43')]['id']}},_0x48a7af={};_0x48a7af[_0xaefd('0x30')]=_[_0xaefd('0x44')](db[_0xaefd('0x3d')][_0xaefd('0x45')]);_0x48a7af[_0xaefd('0x2d')]=_[_0xaefd('0x44')](_0xa145c6[_0xaefd('0x2d')]);_0x48a7af['filters']=_['intersection'](_0x48a7af[_0xaefd('0x30')],_0x48a7af[_0xaefd('0x2d')]);_0x2e98aa['attributes']=_['intersection'](_0x48a7af[_0xaefd('0x30')],qs[_0xaefd('0x32')](_0xa145c6[_0xaefd('0x2d')][_0xaefd('0x32')]));_0x2e98aa[_0xaefd('0x31')]=_0x2e98aa[_0xaefd('0x31')][_0xaefd('0x33')]?_0x2e98aa[_0xaefd('0x31')]:_0x48a7af[_0xaefd('0x30')];if(_0xa145c6['query'][_0xaefd('0x3e')]){_0x2e98aa[_0xaefd('0x3f')]=[{'all':!![]}];}_0x2e98aa=_[_0xaefd('0x3a')]({},_0x2e98aa,_0xa145c6[_0xaefd('0x3c')]);return db[_0xaefd('0x3d')][_0xaefd('0x46')](_0x2e98aa)[_0xaefd('0x26')](handleEntityNotFound(_0x2e17b5,null))['then'](respondWithResult(_0x2e17b5,null))[_0xaefd('0x41')](handleError(_0x2e17b5,null));};exports['create']=function(_0x1095ad,_0x374845){return db[_0xaefd('0x3d')][_0xaefd('0x47')](_0x1095ad['body'],{})['then'](respondWithResult(_0x374845,0xc9))[_0xaefd('0x41')](handleError(_0x374845,null));};exports[_0xaefd('0x25')]=function(_0x179b8b,_0x4eeb56){if(_0x179b8b[_0xaefd('0x48')]['id']){delete _0x179b8b[_0xaefd('0x48')]['id'];}return db['WhatsappQueueReport'][_0xaefd('0x46')]({'where':{'id':_0x179b8b[_0xaefd('0x43')]['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x4eeb56,null))[_0xaefd('0x26')](saveUpdates(_0x179b8b[_0xaefd('0x48')],null))[_0xaefd('0x26')](respondWithResult(_0x4eeb56,null))[_0xaefd('0x41')](handleError(_0x4eeb56,null));};exports[_0xaefd('0x27')]=function(_0x4dc674,_0x567ceb){return db[_0xaefd('0x3d')][_0xaefd('0x46')]({'where':{'id':_0x4dc674['params']['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x567ceb,null))['then'](removeEntity(_0x567ceb,null))[_0xaefd('0x41')](handleError(_0x567ceb,null));};exports[_0xaefd('0x49')]=function(_0x99bbf3,_0x69185e){return db[_0xaefd('0x3d')][_0xaefd('0x49')]()['then'](respondWithResult(_0x69185e,null))['catch'](handleError(_0x69185e,null));}; \ No newline at end of file +var _0xd4f4=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name','send','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','type','VIRTUAL','findAll','rows','then','catch','show','params','keys','includeAll','include','merge','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3d3a9b,_0x363612){_0x3d3a9b=_0x3d3a9b-0x0;var _0x241128=_0xd4f4[_0x3d3a9b];return _0x241128;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x1cf365,_0x28443b){return function(_0x5cf9e7){if(!_0x5cf9e7){_0x1cf365['sendStatus'](0x194);}return _0x5cf9e7;};}function handleError(_0x141245,_0xd51604){_0xd51604=_0xd51604||0x1f4;return function(_0xa2492c){logger[_0x4d4f('0x2b')](_0xa2492c['stack']);if(_0xa2492c[_0x4d4f('0x2c')]){delete _0xa2492c[_0x4d4f('0x2c')];}_0x141245[_0x4d4f('0x1f')](_0xd51604)[_0x4d4f('0x2d')](_0xa2492c);};}exports['index']=function(_0x338ba2,_0x51cb3d){var _0x1688bb={},_0x333a40={},_0x550040={'count':0x0,'rows':[]};var _0x2768f1=_[_0x4d4f('0x2e')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')],function(_0x19a502){return{'name':_0x19a502[_0x4d4f('0x31')],'type':_0x19a502['type'][_0x4d4f('0x32')]};});_0x333a40[_0x4d4f('0x33')]=_[_0x4d4f('0x2e')](_0x2768f1,_0x4d4f('0x2c'));_0x333a40[_0x4d4f('0x34')]=_['keys'](_0x338ba2[_0x4d4f('0x34')]);_0x333a40['filters']=_[_0x4d4f('0x35')](_0x333a40['model'],_0x333a40['query']);_0x1688bb['attributes']=_[_0x4d4f('0x35')](_0x333a40['model'],qs[_0x4d4f('0x36')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x36')]));_0x1688bb['attributes']=_0x1688bb[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x1688bb[_0x4d4f('0x37')]:_0x333a40['model'];if(!_0x338ba2[_0x4d4f('0x34')]['hasOwnProperty'](_0x4d4f('0x39'))){_0x1688bb[_0x4d4f('0x23')]=qs[_0x4d4f('0x23')](_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x23')]);_0x1688bb[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x338ba2[_0x4d4f('0x34')]['offset']);}_0x1688bb['order']=qs[_0x4d4f('0x3a')](_0x338ba2['query']['sort']);_0x1688bb[_0x4d4f('0x3b')]=qs[_0x4d4f('0x3c')](_[_0x4d4f('0x3d')](_0x338ba2[_0x4d4f('0x34')],_0x333a40[_0x4d4f('0x3c')]),_0x2768f1);if(_0x338ba2['query'][_0x4d4f('0x3e')]){_0x1688bb[_0x4d4f('0x3b')]=_['merge'](_0x1688bb[_0x4d4f('0x3b')],{'$or':_[_0x4d4f('0x2e')](_0x2768f1,function(_0x336625){if(_0x336625[_0x4d4f('0x3f')]!==_0x4d4f('0x40')){var _0x19ebfe={};_0x19ebfe[_0x336625[_0x4d4f('0x2c')]]={'$like':'%'+_0x338ba2[_0x4d4f('0x34')][_0x4d4f('0x3e')]+'%'};return _0x19ebfe;}})});}_0x1688bb=_['merge']({},_0x1688bb,_0x338ba2['options']);var _0x1cb919={'where':_0x1688bb[_0x4d4f('0x3b')]};return db[_0x4d4f('0x2f')][_0x4d4f('0x24')](_0x1cb919)['then'](function(_0x5764cb){_0x550040[_0x4d4f('0x24')]=_0x5764cb;if(_0x338ba2[_0x4d4f('0x34')]['includeAll']){_0x1688bb['include']=[{'all':!![]}];}return db[_0x4d4f('0x2f')][_0x4d4f('0x41')](_0x1688bb);})['then'](function(_0x949a6d){_0x550040[_0x4d4f('0x42')]=_0x949a6d;return _0x550040;})[_0x4d4f('0x43')](respondWithFilteredResult(_0x51cb3d,_0x1688bb))[_0x4d4f('0x44')](handleError(_0x51cb3d,null));};exports[_0x4d4f('0x45')]=function(_0x587e6e,_0x2b274e){var _0x4c7c24={'raw':!![],'where':{'id':_0x587e6e[_0x4d4f('0x46')]['id']}},_0x45a0c1={};_0x45a0c1['model']=_[_0x4d4f('0x47')](db[_0x4d4f('0x2f')][_0x4d4f('0x30')]);_0x45a0c1['query']=_[_0x4d4f('0x47')](_0x587e6e['query']);_0x45a0c1[_0x4d4f('0x3c')]=_['intersection'](_0x45a0c1[_0x4d4f('0x33')],_0x45a0c1[_0x4d4f('0x34')]);_0x4c7c24[_0x4d4f('0x37')]=_[_0x4d4f('0x35')](_0x45a0c1[_0x4d4f('0x33')],qs['fields'](_0x587e6e['query'][_0x4d4f('0x36')]));_0x4c7c24[_0x4d4f('0x37')]=_0x4c7c24[_0x4d4f('0x37')][_0x4d4f('0x38')]?_0x4c7c24['attributes']:_0x45a0c1['model'];if(_0x587e6e['query'][_0x4d4f('0x48')]){_0x4c7c24[_0x4d4f('0x49')]=[{'all':!![]}];}_0x4c7c24=_[_0x4d4f('0x4a')]({},_0x4c7c24,_0x587e6e[_0x4d4f('0x4b')]);return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')](_0x4c7c24)[_0x4d4f('0x43')](handleEntityNotFound(_0x2b274e,null))[_0x4d4f('0x43')](respondWithResult(_0x2b274e,null))[_0x4d4f('0x44')](handleError(_0x2b274e,null));};exports[_0x4d4f('0x4d')]=function(_0x37745d,_0x1c290b){return db['WhatsappQueueReport'][_0x4d4f('0x4d')](_0x37745d[_0x4d4f('0x4e')],{})['then'](respondWithResult(_0x1c290b,0xc9))[_0x4d4f('0x44')](handleError(_0x1c290b,null));};exports['update']=function(_0x15cf38,_0x401466){if(_0x15cf38['body']['id']){delete _0x15cf38[_0x4d4f('0x4e')]['id'];}return db[_0x4d4f('0x2f')][_0x4d4f('0x4c')]({'where':{'id':_0x15cf38[_0x4d4f('0x46')]['id']}})[_0x4d4f('0x43')](handleEntityNotFound(_0x401466,null))[_0x4d4f('0x43')](saveUpdates(_0x15cf38[_0x4d4f('0x4e')],null))[_0x4d4f('0x43')](respondWithResult(_0x401466,null))[_0x4d4f('0x44')](handleError(_0x401466,null));};exports[_0x4d4f('0x2a')]=function(_0xa6cef,_0x3a21a6){return db['WhatsappQueueReport'][_0x4d4f('0x4c')]({'where':{'id':_0xa6cef['params']['id']}})['then'](handleEntityNotFound(_0x3a21a6,null))['then'](removeEntity(_0x3a21a6,null))[_0x4d4f('0x44')](handleError(_0x3a21a6,null));};exports[_0x4d4f('0x4f')]=function(_0x487212,_0x5f3252){return db[_0x4d4f('0x2f')][_0x4d4f('0x4f')]()['then'](respondWithResult(_0x5f3252,null))[_0x4d4f('0x44')](handleError(_0x5f3252,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 7f63963..92dd1d2 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 _0x1f24=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x4dee28,_0x5d01f6){var _0x5dbfe7=function(_0x5f27f7){while(--_0x5f27f7){_0x4dee28['push'](_0x4dee28['shift']());}};_0x5dbfe7(++_0x5d01f6);}(_0x1f24,0xec));var _0x41f2=function(_0x45b23b,_0x3a1611){_0x45b23b=_0x45b23b-0x0;var _0x29d8fd=_0x1f24[_0x45b23b];return _0x29d8fd;};'use strict';var _=require(_0x41f2('0x0'));var util=require(_0x41f2('0x1'));var logger=require(_0x41f2('0x2'))('api');var moment=require(_0x41f2('0x3'));var BPromise=require(_0x41f2('0x4'));var rp=require(_0x41f2('0x5'));var fs=require('fs');var path=require(_0x41f2('0x6'));var rimraf=require(_0x41f2('0x7'));var config=require(_0x41f2('0x8'));var attributes=require(_0x41f2('0x9'));module[_0x41f2('0xa')]=function(_0x67946c,_0x3cf988){return _0x67946c[_0x41f2('0xb')]('WhatsappQueueReport',attributes,{'tableName':_0x41f2('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x41f2('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8c4=['path','../../config/environment','./whatsappQueueReport.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x439cd6,_0x1ec864){var _0x385ea2=function(_0x2af21d){while(--_0x2af21d){_0x439cd6['push'](_0x439cd6['shift']());}};_0x385ea2(++_0x1ec864);}(_0xe8c4,0xcb));var _0x4e8c=function(_0x3c12ce,_0x2ab5a9){_0x3c12ce=_0x3c12ce-0x0;var _0x230f11=_0xe8c4[_0x3c12ce];return _0x230f11;};'use strict';var _=require(_0x4e8c('0x0'));var util=require('util');var logger=require(_0x4e8c('0x1'))(_0x4e8c('0x2'));var moment=require(_0x4e8c('0x3'));var BPromise=require(_0x4e8c('0x4'));var rp=require(_0x4e8c('0x5'));var fs=require('fs');var path=require(_0x4e8c('0x6'));var rimraf=require('rimraf');var config=require(_0x4e8c('0x7'));var attributes=require(_0x4e8c('0x8'));module[_0x4e8c('0x9')]=function(_0x3d314b,_0xcf3a39){return _0x3d314b[_0x4e8c('0xa')]('WhatsappQueueReport',attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','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 1d1c1c5..5253499 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 _0xfcf5=['request\x20sent','debug','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','lodash','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s'];(function(_0x469319,_0x535213){var _0x3a485e=function(_0x41afaf){while(--_0x41afaf){_0x469319['push'](_0x469319['shift']());}};_0x3a485e(++_0x535213);}(_0xfcf5,0x6e));var _0x5fcf=function(_0x20f233,_0x4d4bce){_0x20f233=_0x20f233-0x0;var _0x2eefd0=_0xfcf5[_0x20f233];return _0x2eefd0;};'use strict';var _=require(_0x5fcf('0x0'));var util=require('util');var moment=require(_0x5fcf('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5fcf('0x2'))['db'];var utils=require(_0x5fcf('0x3'));var logger=require(_0x5fcf('0x4'))(_0x5fcf('0x5'));var config=require(_0x5fcf('0x6'));var jayson=require(_0x5fcf('0x7'));var client=jayson[_0x5fcf('0x8')][_0x5fcf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18c3f0,_0x15f18d,_0x53e3f5){return new BPromise(function(_0x149e34,_0x1d223e){return client[_0x5fcf('0xa')](_0x18c3f0,_0x53e3f5)[_0x5fcf('0xb')](function(_0x3b1489){logger[_0x5fcf('0xc')](_0x5fcf('0xd'),_0x15f18d,_0x5fcf('0xe'));logger[_0x5fcf('0xf')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x15f18d,_0x5fcf('0xe'),JSON[_0x5fcf('0x10')](_0x3b1489));if(_0x3b1489[_0x5fcf('0x11')]){if(_0x3b1489['error'][_0x5fcf('0x12')]===0x1f4){logger[_0x5fcf('0x11')](_0x5fcf('0xd'),_0x15f18d,_0x3b1489[_0x5fcf('0x11')]['message']);return _0x1d223e(_0x3b1489[_0x5fcf('0x11')][_0x5fcf('0x13')]);}logger[_0x5fcf('0x11')](_0x5fcf('0xd'),_0x15f18d,_0x3b1489['error'][_0x5fcf('0x13')]);return _0x149e34(_0x3b1489[_0x5fcf('0x11')][_0x5fcf('0x13')]);}else{logger[_0x5fcf('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x15f18d,_0x5fcf('0xe'));_0x149e34(_0x3b1489['result'][_0x5fcf('0x13')]);}})[_0x5fcf('0x14')](function(_0x19fcc7){logger[_0x5fcf('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x15f18d,_0x19fcc7);_0x1d223e(_0x19fcc7);});});}exports[_0x5fcf('0x15')]=function(_0x278f00){var _0x167ee0=this;return new Promise(function(_0xefb4c5,_0x3b8d32){return db[_0x5fcf('0x16')]['create'](_0x278f00[_0x5fcf('0x17')],{'raw':_0x278f00[_0x5fcf('0x18')]?_0x278f00['options'][_0x5fcf('0x19')]===undefined?!![]:![]:!![]})[_0x5fcf('0xb')](function(_0x352b18){logger[_0x5fcf('0xc')](_0x5fcf('0x15'),_0x278f00);logger[_0x5fcf('0xf')]('CreateWhatsappQueueReport',_0x278f00,JSON[_0x5fcf('0x10')](_0x352b18));_0xefb4c5(_0x352b18);})[_0x5fcf('0x14')](function(_0x25799c){logger[_0x5fcf('0x11')](_0x5fcf('0x15'),_0x25799c[_0x5fcf('0x13')],_0x278f00);_0x3b8d32(_0x167ee0[_0x5fcf('0x11')](0x1f4,_0x25799c[_0x5fcf('0x13')]));});});};exports[_0x5fcf('0x1a')]=function(_0x2c6cd4){var _0x27efb3=this;return new Promise(function(_0x118f24,_0xf902b5){return db[_0x5fcf('0x16')][_0x5fcf('0x1b')](_0x2c6cd4['body'],{'raw':_0x2c6cd4[_0x5fcf('0x18')]?_0x2c6cd4[_0x5fcf('0x18')][_0x5fcf('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6cd4[_0x5fcf('0x18')]?_0x2c6cd4[_0x5fcf('0x18')][_0x5fcf('0x1c')]||null:null,'attributes':_0x2c6cd4[_0x5fcf('0x18')]?_0x2c6cd4[_0x5fcf('0x18')][_0x5fcf('0x1d')]||null:null,'limit':_0x2c6cd4[_0x5fcf('0x18')]?_0x2c6cd4[_0x5fcf('0x18')][_0x5fcf('0x1e')]||null:null})[_0x5fcf('0xb')](function(_0x2d3060){logger['info'](_0x5fcf('0x1a'),_0x2c6cd4);logger[_0x5fcf('0xf')]('UpdateWhatsappQueueReport',_0x2c6cd4,JSON[_0x5fcf('0x10')](_0x2d3060));_0x118f24(_0x2d3060);})[_0x5fcf('0x14')](function(_0x220d46){logger[_0x5fcf('0x11')](_0x5fcf('0x1a'),_0x220d46[_0x5fcf('0x13')],_0x2c6cd4);_0xf902b5(_0x27efb3[_0x5fcf('0x11')](0x1f4,_0x220d46['message']));});});}; \ No newline at end of file +var _0x79b0=['debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','stringify','UpdateWhatsappQueueReport','update','body','raw','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x118139,_0x7ce965){var _0x2fece9=function(_0xd145a4){while(--_0xd145a4){_0x118139['push'](_0x118139['shift']());}};_0x2fece9(++_0x7ce965);}(_0x79b0,0x9f));var _0x079b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x79b0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x079b('0x0'));var util=require(_0x079b('0x1'));var moment=require(_0x079b('0x2'));var BPromise=require(_0x079b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x079b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x079b('0x5'));var logger=require(_0x079b('0x6'))(_0x079b('0x7'));var config=require(_0x079b('0x8'));var jayson=require(_0x079b('0x9'));var client=jayson[_0x079b('0xa')][_0x079b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fc98e,_0x2f4ab8,_0x3be1c0){return new BPromise(function(_0x22f900,_0x59ae6f){return client[_0x079b('0xc')](_0x2fc98e,_0x3be1c0)[_0x079b('0xd')](function(_0x15315a){logger[_0x079b('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x2f4ab8,_0x079b('0xf'));logger[_0x079b('0x10')](_0x079b('0x11'),_0x2f4ab8,'request\x20sent',JSON['stringify'](_0x15315a));if(_0x15315a[_0x079b('0x12')]){if(_0x15315a['error'][_0x079b('0x13')]===0x1f4){logger[_0x079b('0x12')](_0x079b('0x14'),_0x2f4ab8,_0x15315a[_0x079b('0x12')][_0x079b('0x15')]);return _0x59ae6f(_0x15315a['error'][_0x079b('0x15')]);}logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x2f4ab8,_0x15315a[_0x079b('0x12')][_0x079b('0x15')]);return _0x22f900(_0x15315a['error'][_0x079b('0x15')]);}else{logger[_0x079b('0xe')](_0x079b('0x14'),_0x2f4ab8,_0x079b('0xf'));_0x22f900(_0x15315a[_0x079b('0x16')][_0x079b('0x15')]);}})[_0x079b('0x17')](function(_0x5732b0){logger[_0x079b('0x12')](_0x079b('0x14'),_0x2f4ab8,_0x5732b0);_0x59ae6f(_0x5732b0);});});}exports[_0x079b('0x18')]=function(_0x2df17a){var _0x59d36e=this;return new Promise(function(_0x52bba5,_0x43b289){return db[_0x079b('0x19')][_0x079b('0x1a')](_0x2df17a['body'],{'raw':_0x2df17a[_0x079b('0x1b')]?_0x2df17a[_0x079b('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xfc5ddb){logger[_0x079b('0xe')](_0x079b('0x18'),_0x2df17a);logger[_0x079b('0x10')]('CreateWhatsappQueueReport',_0x2df17a,JSON[_0x079b('0x1c')](_0xfc5ddb));_0x52bba5(_0xfc5ddb);})['catch'](function(_0x125fc2){logger[_0x079b('0x12')]('CreateWhatsappQueueReport',_0x125fc2['message'],_0x2df17a);_0x43b289(_0x59d36e[_0x079b('0x12')](0x1f4,_0x125fc2[_0x079b('0x15')]));});});};exports[_0x079b('0x1d')]=function(_0x15246b){var _0xf3d804=this;return new Promise(function(_0x1a20bb,_0x26b0d5){return db['WhatsappQueueReport'][_0x079b('0x1e')](_0x15246b[_0x079b('0x1f')],{'raw':_0x15246b[_0x079b('0x1b')]?_0x15246b[_0x079b('0x1b')][_0x079b('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15246b['options']?_0x15246b[_0x079b('0x1b')]['where']||null:null,'attributes':_0x15246b[_0x079b('0x1b')]?_0x15246b[_0x079b('0x1b')][_0x079b('0x21')]||null:null,'limit':_0x15246b[_0x079b('0x1b')]?_0x15246b['options'][_0x079b('0x22')]||null:null})[_0x079b('0xd')](function(_0x58b2fa){logger['info'](_0x079b('0x1d'),_0x15246b);logger[_0x079b('0x10')](_0x079b('0x1d'),_0x15246b,JSON[_0x079b('0x1c')](_0x58b2fa));_0x1a20bb(_0x58b2fa);})[_0x079b('0x17')](function(_0x33d26a){logger[_0x079b('0x12')](_0x079b('0x1d'),_0x33d26a[_0x079b('0x15')],_0x15246b);_0x26b0d5(_0xf3d804[_0x079b('0x12')](0x1f4,_0x33d26a[_0x079b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1b36d2e..07aa248 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 _0x539c=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','get','describe','/:id','show','post','put','update','destroy','exports','multer'];(function(_0x52ab89,_0x58a774){var _0x5e689d=function(_0x348888){while(--_0x348888){_0x52ab89['push'](_0x52ab89['shift']());}};_0x5e689d(++_0x58a774);}(_0x539c,0xc5));var _0xc539=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x539c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc539('0x0'));var util=require(_0xc539('0x1'));var path=require(_0xc539('0x2'));var timeout=require(_0xc539('0x3'));var express=require(_0xc539('0x4'));var router=express['Router']();var fs_extra=require(_0xc539('0x5'));var auth=require(_0xc539('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc539('0x7'));var controller=require('./whatsappTransferReport.controller');router['get']('/',auth[_0xc539('0x8')](),controller['index']);router[_0xc539('0x9')]('/describe',auth[_0xc539('0x8')](),controller[_0xc539('0xa')]);router['get'](_0xc539('0xb'),auth[_0xc539('0x8')](),controller[_0xc539('0xc')]);router[_0xc539('0xd')]('/',auth[_0xc539('0x8')](),controller['create']);router[_0xc539('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc539('0xf')]);router['delete'](_0xc539('0xb'),auth[_0xc539('0x8')](),controller[_0xc539('0x10')]);module[_0xc539('0x11')]=router; \ No newline at end of file +var _0x9242=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update'];(function(_0x4da01b,_0x43e82d){var _0x14b448=function(_0x5d784e){while(--_0x5d784e){_0x4da01b['push'](_0x4da01b['shift']());}};_0x14b448(++_0x43e82d);}(_0x9242,0x1d0));var _0x2924=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x9242[_0x209941];return _0x1e8729;};'use strict';var multer=require('multer');var util=require(_0x2924('0x0'));var path=require(_0x2924('0x1'));var timeout=require(_0x2924('0x2'));var express=require(_0x2924('0x3'));var router=express[_0x2924('0x4')]();var fs_extra=require(_0x2924('0x5'));var auth=require(_0x2924('0x6'));var interaction=require(_0x2924('0x7'));var config=require('../../config/environment');var controller=require(_0x2924('0x8'));router[_0x2924('0x9')]('/',auth[_0x2924('0xa')](),controller[_0x2924('0xb')]);router[_0x2924('0x9')]('/describe',auth[_0x2924('0xa')](),controller[_0x2924('0xc')]);router[_0x2924('0x9')](_0x2924('0xd'),auth['isAuthenticated'](),controller[_0x2924('0xe')]);router[_0x2924('0xf')]('/',auth[_0x2924('0xa')](),controller[_0x2924('0x10')]);router[_0x2924('0x11')](_0x2924('0xd'),auth[_0x2924('0xa')](),controller[_0x2924('0x12')]);router['delete']('/:id',auth[_0x2924('0xa')](),controller[_0x2924('0x13')]);module[_0x2924('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 96b48fe..1a7659b 100644 --- a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js +++ b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe458=['queue','DATE','sequelize','exports','ENUM','account','agent'];(function(_0x425e15,_0x1f9133){var _0x3fa628=function(_0x9dd18){while(--_0x9dd18){_0x425e15['push'](_0x425e15['shift']());}};_0x3fa628(++_0x1f9133);}(_0xe458,0x160));var _0x8e45=function(_0x11e747,_0x40a56e){_0x11e747=_0x11e747-0x0;var _0x40ea1d=_0xe458[_0x11e747];return _0x40ea1d;};'use strict';var Sequelize=require(_0x8e45('0x0'));module[_0x8e45('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8e45('0x2')](_0x8e45('0x3'),_0x8e45('0x4'),_0x8e45('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x8e45('0x6')]}}; \ No newline at end of file +var _0xb98e=['account','agent','queue','sequelize','exports'];(function(_0x3b23b3,_0x458e9b){var _0x15aa85=function(_0x3f327d){while(--_0x3f327d){_0x3b23b3['push'](_0x3b23b3['shift']());}};_0x15aa85(++_0x458e9b);}(_0xb98e,0x184));var _0xeb98=function(_0x41fa1a,_0x2df729){_0x41fa1a=_0x41fa1a-0x0;var _0x5df99f=_0xb98e[_0x41fa1a];return _0x5df99f;};'use strict';var Sequelize=require(_0xeb98('0x0'));module[_0xeb98('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xeb98('0x2'),_0xeb98('0x3'),_0xeb98('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index a966d29..e35a70a 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 _0x317b=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','options','WhatsappTransferReport','include','rows','catch','show','params','find','create'];(function(_0x4de723,_0x5d9958){var _0x423e4d=function(_0x597946){while(--_0x597946){_0x4de723['push'](_0x4de723['shift']());}};_0x423e4d(++_0x5d9958);}(_0x317b,0x96));var _0xb317=function(_0x5c48c1,_0x10d0cc){_0x5c48c1=_0x5c48c1-0x0;var _0x4ceb22=_0x317b[_0x5c48c1];return _0x4ceb22;};'use strict';var emlformat=require(_0xb317('0x0'));var rimraf=require(_0xb317('0x1'));var zipdir=require(_0xb317('0x2'));var jsonpatch=require(_0xb317('0x3'));var rp=require(_0xb317('0x4'));var moment=require(_0xb317('0x5'));var BPromise=require(_0xb317('0x6'));var Mustache=require(_0xb317('0x7'));var util=require(_0xb317('0x8'));var path=require(_0xb317('0x9'));var sox=require(_0xb317('0xa'));var csv=require(_0xb317('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb317('0xc'));var _=require(_0xb317('0xd'));var squel=require(_0xb317('0xe'));var crypto=require(_0xb317('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb317('0xb'));var querystring=require(_0xb317('0x10'));var Papa=require(_0xb317('0x11'));var Redis=require('ioredis');var authService=require(_0xb317('0x12'));var qs=require(_0xb317('0x13'));var as=require(_0xb317('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb317('0x15'))('api');var utils=require(_0xb317('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb317('0x17'));var db=require(_0xb317('0x18'))['db'];function respondWithStatusCode(_0x4c0871,_0x2b1c65){_0x2b1c65=_0x2b1c65||0xcc;return function(_0x31dc70){if(_0x31dc70){return _0x4c0871['sendStatus'](_0x2b1c65);}return _0x4c0871[_0xb317('0x19')](_0x2b1c65)[_0xb317('0x1a')]();};}function respondWithResult(_0x532873,_0x1ef7df){_0x1ef7df=_0x1ef7df||0xc8;return function(_0x17de2f){if(_0x17de2f){return _0x532873['status'](_0x1ef7df)[_0xb317('0x1b')](_0x17de2f);}};}function respondWithFilteredResult(_0x8a8623,_0x20305c){return function(_0x1953a7){if(_0x1953a7){var _0x18f754=typeof _0x20305c['offset']===_0xb317('0x1c')&&typeof _0x20305c[_0xb317('0x1d')]==='undefined';var _0x549f94=_0x1953a7['count'];var _0x2f0070=_0x18f754?0x0:_0x20305c['offset'];var _0x5086fe=_0x18f754?_0x1953a7[_0xb317('0x1e')]:_0x20305c['offset']+_0x20305c[_0xb317('0x1d')];var _0x120d7a;if(_0x5086fe>=_0x549f94){_0x5086fe=_0x549f94;_0x120d7a=0xc8;}else{_0x120d7a=0xce;}_0x8a8623['status'](_0x120d7a);return _0x8a8623['set'](_0xb317('0x1f'),_0x2f0070+'-'+_0x5086fe+'/'+_0x549f94)['json'](_0x1953a7);}return null;};}function patchUpdates(_0x201342){return function(_0x383af0){try{jsonpatch['apply'](_0x383af0,_0x201342,!![]);}catch(_0x58ce14){return BPromise[_0xb317('0x20')](_0x58ce14);}return _0x383af0[_0xb317('0x21')]();};}function saveUpdates(_0x2d9d8a,_0x53b9c3){return function(_0x1bae83){if(_0x1bae83){return _0x1bae83[_0xb317('0x22')](_0x2d9d8a)['then'](function(_0x8b182){return _0x8b182;});}return null;};}function removeEntity(_0x5b087a,_0x3aa5d4){return function(_0x2d4978){if(_0x2d4978){return _0x2d4978[_0xb317('0x23')]()[_0xb317('0x24')](function(){_0x5b087a[_0xb317('0x19')](0xcc)[_0xb317('0x1a')]();});}};}function handleEntityNotFound(_0x547e7f,_0x3f8cdd){return function(_0x526c80){if(!_0x526c80){_0x547e7f['sendStatus'](0x194);}return _0x526c80;};}function handleError(_0x35b5cd,_0x2013e2){_0x2013e2=_0x2013e2||0x1f4;return function(_0x5a9371){logger[_0xb317('0x25')](_0x5a9371[_0xb317('0x26')]);if(_0x5a9371[_0xb317('0x27')]){delete _0x5a9371['name'];}_0x35b5cd[_0xb317('0x19')](_0x2013e2)[_0xb317('0x28')](_0x5a9371);};}exports[_0xb317('0x29')]=function(_0x5b9ef9,_0x37d9a2){var _0x85b36={},_0x3d12ac={},_0x2536a4={'count':0x0,'rows':[]};var _0x3eac64=_[_0xb317('0x2a')](db['WhatsappTransferReport'][_0xb317('0x2b')],function(_0x2eb67a){return{'name':_0x2eb67a[_0xb317('0x2c')],'type':_0x2eb67a[_0xb317('0x2d')]['key']};});_0x3d12ac[_0xb317('0x2e')]=_['map'](_0x3eac64,'name');_0x3d12ac[_0xb317('0x2f')]=_[_0xb317('0x30')](_0x5b9ef9[_0xb317('0x2f')]);_0x3d12ac[_0xb317('0x31')]=_[_0xb317('0x32')](_0x3d12ac[_0xb317('0x2e')],_0x3d12ac[_0xb317('0x2f')]);_0x85b36[_0xb317('0x33')]=_[_0xb317('0x32')](_0x3d12ac[_0xb317('0x2e')],qs[_0xb317('0x34')](_0x5b9ef9['query']['fields']));_0x85b36[_0xb317('0x33')]=_0x85b36['attributes'][_0xb317('0x35')]?_0x85b36['attributes']:_0x3d12ac[_0xb317('0x2e')];if(!_0x5b9ef9['query'][_0xb317('0x36')](_0xb317('0x37'))){_0x85b36[_0xb317('0x1d')]=qs[_0xb317('0x1d')](_0x5b9ef9[_0xb317('0x2f')]['limit']);_0x85b36[_0xb317('0x38')]=qs['offset'](_0x5b9ef9['query'][_0xb317('0x38')]);}_0x85b36[_0xb317('0x39')]=qs['sort'](_0x5b9ef9[_0xb317('0x2f')][_0xb317('0x3a')]);_0x85b36[_0xb317('0x3b')]=qs[_0xb317('0x31')](_[_0xb317('0x3c')](_0x5b9ef9[_0xb317('0x2f')],_0x3d12ac[_0xb317('0x31')]),_0x3eac64);if(_0x5b9ef9[_0xb317('0x2f')]['filter']){_0x85b36[_0xb317('0x3b')]=_['merge'](_0x85b36['where'],{'$or':_[_0xb317('0x2a')](_0x3eac64,function(_0x5d621e){if(_0x5d621e[_0xb317('0x2d')]!=='VIRTUAL'){var _0x336336={};_0x336336[_0x5d621e[_0xb317('0x27')]]={'$like':'%'+_0x5b9ef9['query'][_0xb317('0x3d')]+'%'};return _0x336336;}})});}_0x85b36=_[_0xb317('0x3e')]({},_0x85b36,_0x5b9ef9[_0xb317('0x3f')]);var _0x561704={'where':_0x85b36['where']};return db[_0xb317('0x40')]['count'](_0x561704)['then'](function(_0x36c5ea){_0x2536a4[_0xb317('0x1e')]=_0x36c5ea;if(_0x5b9ef9['query']['includeAll']){_0x85b36[_0xb317('0x41')]=[{'all':!![]}];}return db[_0xb317('0x40')]['findAll'](_0x85b36);})['then'](function(_0x26b0df){_0x2536a4[_0xb317('0x42')]=_0x26b0df;return _0x2536a4;})[_0xb317('0x24')](respondWithFilteredResult(_0x37d9a2,_0x85b36))[_0xb317('0x43')](handleError(_0x37d9a2,null));};exports[_0xb317('0x44')]=function(_0x39bab2,_0x503d22){var _0x3b6803={'raw':!![],'where':{'id':_0x39bab2[_0xb317('0x45')]['id']}},_0x49b139={};_0x49b139[_0xb317('0x2e')]=_[_0xb317('0x30')](db['WhatsappTransferReport']['rawAttributes']);_0x49b139[_0xb317('0x2f')]=_['keys'](_0x39bab2[_0xb317('0x2f')]);_0x49b139['filters']=_[_0xb317('0x32')](_0x49b139[_0xb317('0x2e')],_0x49b139['query']);_0x3b6803[_0xb317('0x33')]=_[_0xb317('0x32')](_0x49b139[_0xb317('0x2e')],qs[_0xb317('0x34')](_0x39bab2[_0xb317('0x2f')][_0xb317('0x34')]));_0x3b6803['attributes']=_0x3b6803[_0xb317('0x33')][_0xb317('0x35')]?_0x3b6803['attributes']:_0x49b139[_0xb317('0x2e')];if(_0x39bab2[_0xb317('0x2f')]['includeAll']){_0x3b6803[_0xb317('0x41')]=[{'all':!![]}];}_0x3b6803=_[_0xb317('0x3e')]({},_0x3b6803,_0x39bab2[_0xb317('0x3f')]);return db['WhatsappTransferReport'][_0xb317('0x46')](_0x3b6803)[_0xb317('0x24')](handleEntityNotFound(_0x503d22,null))[_0xb317('0x24')](respondWithResult(_0x503d22,null))[_0xb317('0x43')](handleError(_0x503d22,null));};exports['create']=function(_0x27b8a9,_0x37bdad){return db[_0xb317('0x40')][_0xb317('0x47')](_0x27b8a9[_0xb317('0x48')],{})[_0xb317('0x24')](respondWithResult(_0x37bdad,0xc9))[_0xb317('0x43')](handleError(_0x37bdad,null));};exports[_0xb317('0x22')]=function(_0x5acc57,_0x3468ec){if(_0x5acc57[_0xb317('0x48')]['id']){delete _0x5acc57[_0xb317('0x48')]['id'];}return db[_0xb317('0x40')]['find']({'where':{'id':_0x5acc57['params']['id']}})[_0xb317('0x24')](handleEntityNotFound(_0x3468ec,null))[_0xb317('0x24')](saveUpdates(_0x5acc57['body'],null))['then'](respondWithResult(_0x3468ec,null))['catch'](handleError(_0x3468ec,null));};exports[_0xb317('0x23')]=function(_0x41f223,_0x286180){return db['WhatsappTransferReport'][_0xb317('0x46')]({'where':{'id':_0x41f223[_0xb317('0x45')]['id']}})[_0xb317('0x24')](handleEntityNotFound(_0x286180,null))[_0xb317('0x24')](removeEntity(_0x286180,null))['catch'](handleError(_0x286180,null));};exports[_0xb317('0x49')]=function(_0x583be1,_0x3d7b15){return db[_0xb317('0x40')][_0xb317('0x49')]()['then'](respondWithResult(_0x3d7b15,null))[_0xb317('0x43')](handleError(_0x3d7b15,null));}; \ No newline at end of file +var _0xf316=['ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','WhatsappTransferReport','rawAttributes','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv'];(function(_0x4294b7,_0x23ce22){var _0x1a21e6=function(_0x4f2509){while(--_0x4f2509){_0x4294b7['push'](_0x4294b7['shift']());}};_0x1a21e6(++_0x23ce22);}(_0xf316,0xd7));var _0x6f31=function(_0x363dc4,_0x127d52){_0x363dc4=_0x363dc4-0x0;var _0x2a683e=_0xf316[_0x363dc4];return _0x2a683e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6f31('0x0'));var zipdir=require(_0x6f31('0x1'));var jsonpatch=require(_0x6f31('0x2'));var rp=require(_0x6f31('0x3'));var moment=require(_0x6f31('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6f31('0x5'));var util=require(_0x6f31('0x6'));var path=require(_0x6f31('0x7'));var sox=require(_0x6f31('0x8'));var csv=require(_0x6f31('0x9'));var ejs=require(_0x6f31('0xa'));var fs=require('fs');var fs_extra=require(_0x6f31('0xb'));var _=require(_0x6f31('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6f31('0xd'));var deskjs=require(_0x6f31('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f31('0xf'));var Papa=require(_0x6f31('0x10'));var Redis=require(_0x6f31('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6f31('0x12'));var as=require(_0x6f31('0x13'));var hardwareService=require(_0x6f31('0x14'));var logger=require(_0x6f31('0x15'))(_0x6f31('0x16'));var utils=require(_0x6f31('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6f31('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c2ddc,_0x5f3984){_0x5f3984=_0x5f3984||0xcc;return function(_0x13ac63){if(_0x13ac63){return _0x1c2ddc['sendStatus'](_0x5f3984);}return _0x1c2ddc[_0x6f31('0x19')](_0x5f3984)[_0x6f31('0x1a')]();};}function respondWithResult(_0x53a5b5,_0x2d7f2e){_0x2d7f2e=_0x2d7f2e||0xc8;return function(_0x5443aa){if(_0x5443aa){return _0x53a5b5['status'](_0x2d7f2e)['json'](_0x5443aa);}};}function respondWithFilteredResult(_0x134e10,_0x126562){return function(_0xd32b02){if(_0xd32b02){var _0x1e29ad=typeof _0x126562[_0x6f31('0x1b')]===_0x6f31('0x1c')&&typeof _0x126562[_0x6f31('0x1d')]==='undefined';var _0x5d1189=_0xd32b02[_0x6f31('0x1e')];var _0x15f14d=_0x1e29ad?0x0:_0x126562[_0x6f31('0x1b')];var _0x4cfdfa=_0x1e29ad?_0xd32b02[_0x6f31('0x1e')]:_0x126562[_0x6f31('0x1b')]+_0x126562['limit'];var _0x314a46;if(_0x4cfdfa>=_0x5d1189){_0x4cfdfa=_0x5d1189;_0x314a46=0xc8;}else{_0x314a46=0xce;}_0x134e10[_0x6f31('0x19')](_0x314a46);return _0x134e10[_0x6f31('0x1f')]('Content-Range',_0x15f14d+'-'+_0x4cfdfa+'/'+_0x5d1189)[_0x6f31('0x20')](_0xd32b02);}return null;};}function patchUpdates(_0x4d5b87){return function(_0x1e8691){try{jsonpatch[_0x6f31('0x21')](_0x1e8691,_0x4d5b87,!![]);}catch(_0x257e3b){return BPromise[_0x6f31('0x22')](_0x257e3b);}return _0x1e8691[_0x6f31('0x23')]();};}function saveUpdates(_0x141358,_0x5c451f){return function(_0x19cb0b){if(_0x19cb0b){return _0x19cb0b[_0x6f31('0x24')](_0x141358)[_0x6f31('0x25')](function(_0x2aa875){return _0x2aa875;});}return null;};}function removeEntity(_0x522d62,_0x3c2548){return function(_0x32c77d){if(_0x32c77d){return _0x32c77d[_0x6f31('0x26')]()[_0x6f31('0x25')](function(){_0x522d62[_0x6f31('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18963b,_0x5bef6d){return function(_0x877e1a){if(!_0x877e1a){_0x18963b[_0x6f31('0x27')](0x194);}return _0x877e1a;};}function handleError(_0x51ec9d,_0x5d18e0){_0x5d18e0=_0x5d18e0||0x1f4;return function(_0x16d871){logger[_0x6f31('0x28')](_0x16d871[_0x6f31('0x29')]);if(_0x16d871[_0x6f31('0x2a')]){delete _0x16d871[_0x6f31('0x2a')];}_0x51ec9d['status'](_0x5d18e0)['send'](_0x16d871);};}exports[_0x6f31('0x2b')]=function(_0xc16ee2,_0x4317f8){var _0x58f717={},_0x358dbe={},_0x15329b={'count':0x0,'rows':[]};var _0x5eabaa=_[_0x6f31('0x2c')](db[_0x6f31('0x2d')][_0x6f31('0x2e')],function(_0x5efbe1){return{'name':_0x5efbe1['fieldName'],'type':_0x5efbe1[_0x6f31('0x2f')][_0x6f31('0x30')]};});_0x358dbe['model']=_[_0x6f31('0x2c')](_0x5eabaa,'name');_0x358dbe[_0x6f31('0x31')]=_[_0x6f31('0x32')](_0xc16ee2[_0x6f31('0x31')]);_0x358dbe[_0x6f31('0x33')]=_[_0x6f31('0x34')](_0x358dbe['model'],_0x358dbe[_0x6f31('0x31')]);_0x58f717[_0x6f31('0x35')]=_[_0x6f31('0x34')](_0x358dbe[_0x6f31('0x36')],qs[_0x6f31('0x37')](_0xc16ee2[_0x6f31('0x31')][_0x6f31('0x37')]));_0x58f717[_0x6f31('0x35')]=_0x58f717[_0x6f31('0x35')][_0x6f31('0x38')]?_0x58f717[_0x6f31('0x35')]:_0x358dbe['model'];if(!_0xc16ee2[_0x6f31('0x31')][_0x6f31('0x39')](_0x6f31('0x3a'))){_0x58f717[_0x6f31('0x1d')]=qs[_0x6f31('0x1d')](_0xc16ee2['query'][_0x6f31('0x1d')]);_0x58f717[_0x6f31('0x1b')]=qs['offset'](_0xc16ee2[_0x6f31('0x31')]['offset']);}_0x58f717[_0x6f31('0x3b')]=qs[_0x6f31('0x3c')](_0xc16ee2[_0x6f31('0x31')]['sort']);_0x58f717[_0x6f31('0x3d')]=qs['filters'](_[_0x6f31('0x3e')](_0xc16ee2[_0x6f31('0x31')],_0x358dbe[_0x6f31('0x33')]),_0x5eabaa);if(_0xc16ee2[_0x6f31('0x31')][_0x6f31('0x3f')]){_0x58f717[_0x6f31('0x3d')]=_[_0x6f31('0x40')](_0x58f717[_0x6f31('0x3d')],{'$or':_['map'](_0x5eabaa,function(_0x1c33e0){if(_0x1c33e0[_0x6f31('0x2f')]!=='VIRTUAL'){var _0x330680={};_0x330680[_0x1c33e0[_0x6f31('0x2a')]]={'$like':'%'+_0xc16ee2['query'][_0x6f31('0x3f')]+'%'};return _0x330680;}})});}_0x58f717=_[_0x6f31('0x40')]({},_0x58f717,_0xc16ee2[_0x6f31('0x41')]);var _0x10529d={'where':_0x58f717[_0x6f31('0x3d')]};return db[_0x6f31('0x2d')][_0x6f31('0x1e')](_0x10529d)[_0x6f31('0x25')](function(_0x50d252){_0x15329b[_0x6f31('0x1e')]=_0x50d252;if(_0xc16ee2[_0x6f31('0x31')][_0x6f31('0x42')]){_0x58f717[_0x6f31('0x43')]=[{'all':!![]}];}return db[_0x6f31('0x2d')]['findAll'](_0x58f717);})[_0x6f31('0x25')](function(_0x5eb139){_0x15329b['rows']=_0x5eb139;return _0x15329b;})[_0x6f31('0x25')](respondWithFilteredResult(_0x4317f8,_0x58f717))[_0x6f31('0x44')](handleError(_0x4317f8,null));};exports[_0x6f31('0x45')]=function(_0x272b9d,_0x506217){var _0x2f2d8a={'raw':!![],'where':{'id':_0x272b9d[_0x6f31('0x46')]['id']}},_0x1b7b24={};_0x1b7b24[_0x6f31('0x36')]=_[_0x6f31('0x32')](db[_0x6f31('0x2d')]['rawAttributes']);_0x1b7b24['query']=_[_0x6f31('0x32')](_0x272b9d[_0x6f31('0x31')]);_0x1b7b24[_0x6f31('0x33')]=_[_0x6f31('0x34')](_0x1b7b24[_0x6f31('0x36')],_0x1b7b24[_0x6f31('0x31')]);_0x2f2d8a['attributes']=_[_0x6f31('0x34')](_0x1b7b24['model'],qs[_0x6f31('0x37')](_0x272b9d['query']['fields']));_0x2f2d8a[_0x6f31('0x35')]=_0x2f2d8a[_0x6f31('0x35')][_0x6f31('0x38')]?_0x2f2d8a[_0x6f31('0x35')]:_0x1b7b24['model'];if(_0x272b9d[_0x6f31('0x31')]['includeAll']){_0x2f2d8a[_0x6f31('0x43')]=[{'all':!![]}];}_0x2f2d8a=_[_0x6f31('0x40')]({},_0x2f2d8a,_0x272b9d[_0x6f31('0x41')]);return db[_0x6f31('0x2d')][_0x6f31('0x47')](_0x2f2d8a)[_0x6f31('0x25')](handleEntityNotFound(_0x506217,null))[_0x6f31('0x25')](respondWithResult(_0x506217,null))[_0x6f31('0x44')](handleError(_0x506217,null));};exports[_0x6f31('0x48')]=function(_0x41f29c,_0x3cffde){return db[_0x6f31('0x2d')][_0x6f31('0x48')](_0x41f29c[_0x6f31('0x49')],{})[_0x6f31('0x25')](respondWithResult(_0x3cffde,0xc9))[_0x6f31('0x44')](handleError(_0x3cffde,null));};exports[_0x6f31('0x24')]=function(_0x38dad9,_0x2524d5){if(_0x38dad9[_0x6f31('0x49')]['id']){delete _0x38dad9[_0x6f31('0x49')]['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x38dad9['params']['id']}})['then'](handleEntityNotFound(_0x2524d5,null))['then'](saveUpdates(_0x38dad9[_0x6f31('0x49')],null))['then'](respondWithResult(_0x2524d5,null))[_0x6f31('0x44')](handleError(_0x2524d5,null));};exports[_0x6f31('0x26')]=function(_0x2cad32,_0x37c022){return db[_0x6f31('0x2d')][_0x6f31('0x47')]({'where':{'id':_0x2cad32[_0x6f31('0x46')]['id']}})[_0x6f31('0x25')](handleEntityNotFound(_0x37c022,null))[_0x6f31('0x25')](removeEntity(_0x37c022,null))[_0x6f31('0x44')](handleError(_0x37c022,null));};exports[_0x6f31('0x4a')]=function(_0xc04b39,_0x2f877d){return db[_0x6f31('0x2d')][_0x6f31('0x4a')]()['then'](respondWithResult(_0x2f877d,null))[_0x6f31('0x44')](handleError(_0x2f877d,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 7df0828..735100a 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 _0x1553=['../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x1553,0x18f));var _0x3155=function(_0x53208e,_0x4a1eb8){_0x53208e=_0x53208e-0x0;var _0xa97d9b=_0x1553[_0x53208e];return _0xa97d9b;};'use strict';var _=require(_0x3155('0x0'));var util=require(_0x3155('0x1'));var logger=require(_0x3155('0x2'))(_0x3155('0x3'));var moment=require('moment');var BPromise=require(_0x3155('0x4'));var rp=require(_0x3155('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3155('0x6'));var config=require(_0x3155('0x7'));var attributes=require(_0x3155('0x8'));module[_0x3155('0x9')]=function(_0x49f806,_0x296f77){return _0x49f806[_0x3155('0xa')](_0x3155('0xb'),attributes,{'tableName':_0x3155('0xc'),'paranoid':![],'indexes':[{'name':_0x3155('0xd'),'fields':[_0x3155('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7538=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x456c9d,_0xa6b604){var _0x38d5c=function(_0x5c0323){while(--_0x5c0323){_0x456c9d['push'](_0x456c9d['shift']());}};_0x38d5c(++_0xa6b604);}(_0x7538,0x1f0));var _0x8753=function(_0x3ed0ec,_0x44ece7){_0x3ed0ec=_0x3ed0ec-0x0;var _0x4b32f4=_0x7538[_0x3ed0ec];return _0x4b32f4;};'use strict';var _=require('lodash');var util=require(_0x8753('0x0'));var logger=require(_0x8753('0x1'))(_0x8753('0x2'));var moment=require(_0x8753('0x3'));var BPromise=require(_0x8753('0x4'));var rp=require(_0x8753('0x5'));var fs=require('fs');var path=require(_0x8753('0x6'));var rimraf=require(_0x8753('0x7'));var config=require(_0x8753('0x8'));var attributes=require(_0x8753('0x9'));module[_0x8753('0xa')]=function(_0x1e3e7f,_0x59d98d){return _0x1e3e7f[_0x8753('0xb')](_0x8753('0xc'),attributes,{'tableName':_0x8753('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8753('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index a5eb879..4ba1570 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 _0xf591=['request\x20sent','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf591,0x1cf));var _0x1f59=function(_0x11b3db,_0x1b0ebe){_0x11b3db=_0x11b3db-0x0;var _0x2efc12=_0xf591[_0x11b3db];return _0x2efc12;};'use strict';var _=require('lodash');var util=require(_0x1f59('0x0'));var moment=require('moment');var BPromise=require(_0x1f59('0x1'));var rs=require(_0x1f59('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f59('0x3'))['db'];var utils=require(_0x1f59('0x4'));var logger=require(_0x1f59('0x5'))(_0x1f59('0x6'));var config=require(_0x1f59('0x7'));var jayson=require(_0x1f59('0x8'));var client=jayson[_0x1f59('0x9')][_0x1f59('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ab268,_0x25026d,_0x262966){return new BPromise(function(_0x398a1b,_0x28fa26){return client[_0x1f59('0xb')](_0x3ab268,_0x262966)[_0x1f59('0xc')](function(_0x19fc7b){logger[_0x1f59('0xd')](_0x1f59('0xe'),_0x25026d,'request\x20sent');logger[_0x1f59('0xf')](_0x1f59('0x10'),_0x25026d,'request\x20sent',JSON['stringify'](_0x19fc7b));if(_0x19fc7b[_0x1f59('0x11')]){if(_0x19fc7b[_0x1f59('0x11')][_0x1f59('0x12')]===0x1f4){logger[_0x1f59('0x11')](_0x1f59('0xe'),_0x25026d,_0x19fc7b['error']['message']);return _0x28fa26(_0x19fc7b[_0x1f59('0x11')][_0x1f59('0x13')]);}logger[_0x1f59('0x11')](_0x1f59('0xe'),_0x25026d,_0x19fc7b['error'][_0x1f59('0x13')]);return _0x398a1b(_0x19fc7b[_0x1f59('0x11')][_0x1f59('0x13')]);}else{logger[_0x1f59('0xd')](_0x1f59('0xe'),_0x25026d,_0x1f59('0x14'));_0x398a1b(_0x19fc7b['result'][_0x1f59('0x13')]);}})['catch'](function(_0x5eeac6){logger[_0x1f59('0x11')](_0x1f59('0xe'),_0x25026d,_0x5eeac6);_0x28fa26(_0x5eeac6);});});} \ No newline at end of file +var _0x1ed1=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1ed1,0x134));var _0x11ed=function(_0xdad59c,_0x4d5267){_0xdad59c=_0xdad59c-0x0;var _0x2c980d=_0x1ed1[_0xdad59c];return _0x2c980d;};'use strict';var _=require(_0x11ed('0x0'));var util=require('util');var moment=require(_0x11ed('0x1'));var BPromise=require('bluebird');var rs=require(_0x11ed('0x2'));var fs=require('fs');var Redis=require(_0x11ed('0x3'));var db=require(_0x11ed('0x4'))['db'];var utils=require(_0x11ed('0x5'));var logger=require(_0x11ed('0x6'))('rpc');var config=require(_0x11ed('0x7'));var jayson=require(_0x11ed('0x8'));var client=jayson[_0x11ed('0x9')][_0x11ed('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e632,_0x490a26,_0x391846){return new BPromise(function(_0x135b0d,_0x353472){return client['request'](_0x19e632,_0x391846)[_0x11ed('0xb')](function(_0xd9e012){logger['info'](_0x11ed('0xc'),_0x490a26,_0x11ed('0xd'));logger['debug'](_0x11ed('0xe'),_0x490a26,_0x11ed('0xd'),JSON[_0x11ed('0xf')](_0xd9e012));if(_0xd9e012[_0x11ed('0x10')]){if(_0xd9e012[_0x11ed('0x10')][_0x11ed('0x11')]===0x1f4){logger[_0x11ed('0x10')](_0x11ed('0xc'),_0x490a26,_0xd9e012[_0x11ed('0x10')][_0x11ed('0x12')]);return _0x353472(_0xd9e012[_0x11ed('0x10')]['message']);}logger[_0x11ed('0x10')](_0x11ed('0xc'),_0x490a26,_0xd9e012[_0x11ed('0x10')][_0x11ed('0x12')]);return _0x135b0d(_0xd9e012['error'][_0x11ed('0x12')]);}else{logger[_0x11ed('0x13')](_0x11ed('0xc'),_0x490a26,'request\x20sent');_0x135b0d(_0xd9e012[_0x11ed('0x14')][_0x11ed('0x12')]);}})[_0x11ed('0x15')](function(_0x12d2b6){logger[_0x11ed('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x490a26,_0x12d2b6);_0x353472(_0x12d2b6);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 709113b..08583a9 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1825=['Online\x20apps:','online','name','join','map','status','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','start','info'];(function(_0x479b27,_0x1a437a){var _0x47b4db=function(_0x16c600){while(--_0x16c600){_0x479b27['push'](_0x479b27['shift']());}};_0x47b4db(++_0x1a437a);}(_0x1825,0x100));var _0x5182=function(_0xdf0ffa,_0x4722c7){_0xdf0ffa=_0xdf0ffa-0x0;var _0x240c9f=_0x1825[_0xdf0ffa];return _0x240c9f;};'use strict';var _=require('lodash');var mysqldb=require(_0x5182('0x0'));var rpc=require(_0x5182('0x1'));var config=require('./config/environment');var logger=require(_0x5182('0x2'))(_0x5182('0x3'));var pm2=require(_0x5182('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x5182('0x5'));var chat=require(_0x5182('0x6'));var whatsapp=require(_0x5182('0x7'));var transcribe=require(_0x5182('0x8'));function main(){return mysqldb['db']['sequelize'][_0x5182('0x9')]()[_0x5182('0xa')](function(){return rpc[_0x5182('0xb')]();})['then'](function(_0x5ca134){logger['info'](_0x5ca134);return chat['start']();})[_0x5182('0xa')](function(){return whatsapp[_0x5182('0xc')]();})[_0x5182('0xa')](function(){return schedule['start']();})[_0x5182('0xa')](function(){return transcribe[_0x5182('0xc')]();})[_0x5182('0xa')](function(_0x17c685){logger[_0x5182('0xd')](_0x17c685);return pm2[_0x5182('0xc')](pm2Config);})[_0x5182('0xa')](function(_0xa5bbc3){logger[_0x5182('0xd')](_0x5182('0xe'),_['map'](_['filter'](_0xa5bbc3,{'status':_0x5182('0xf')}),_0x5182('0x10'))[_0x5182('0x11')]());logger['info']('Offline\x20apps:',_[_0x5182('0x12')](_['filter'](_0xa5bbc3,function(_0x23b759){return _0x23b759[_0x5182('0x13')]!==_0x5182('0xf');}),_0x5182('0x10'))[_0x5182('0x11')]()||'None');config[_0x5182('0x14')]&&require('./config/seedDB')[_0x5182('0x15')]();require(_0x5182('0x16'))[_0x5182('0x15')]();})[_0x5182('0x17')](function(_0x2a3b4c){logger[_0x5182('0x18')](_0x5182('0x19'),_0x2a3b4c);process[_0x5182('0x1a')](0x1);});}main(); \ No newline at end of file +var _0xed16=['./rpc','./config/logger','app','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','name','join','Offline\x20apps:','status','online','None','seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb'];(function(_0x5e0a3a,_0x5c5ec4){var _0x4327c9=function(_0x270152){while(--_0x270152){_0x5e0a3a['push'](_0x5e0a3a['shift']());}};_0x4327c9(++_0x5c5ec4);}(_0xed16,0xfa));var _0x6ed1=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xed16[_0x521929];return _0x632436;};'use strict';var _=require(_0x6ed1('0x0'));var mysqldb=require(_0x6ed1('0x1'));var rpc=require(_0x6ed1('0x2'));var config=require('./config/environment');var logger=require(_0x6ed1('0x3'))(_0x6ed1('0x4'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x6ed1('0x5'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x6ed1('0x6'));var transcribe=require(_0x6ed1('0x7'));function main(){return mysqldb['db']['sequelize'][_0x6ed1('0x8')]()[_0x6ed1('0x9')](function(){return rpc[_0x6ed1('0xa')]();})['then'](function(_0x5391f3){logger[_0x6ed1('0xb')](_0x5391f3);return chat[_0x6ed1('0xc')]();})[_0x6ed1('0x9')](function(){return whatsapp[_0x6ed1('0xc')]();})[_0x6ed1('0x9')](function(){return schedule['start']();})[_0x6ed1('0x9')](function(){return transcribe[_0x6ed1('0xc')]();})[_0x6ed1('0x9')](function(_0x58dd00){logger[_0x6ed1('0xb')](_0x58dd00);return pm2[_0x6ed1('0xc')](pm2Config);})['then'](function(_0x497e2e){logger[_0x6ed1('0xb')](_0x6ed1('0xd'),_[_0x6ed1('0xe')](_[_0x6ed1('0xf')](_0x497e2e,{'status':'online'}),_0x6ed1('0x10'))[_0x6ed1('0x11')]());logger[_0x6ed1('0xb')](_0x6ed1('0x12'),_['map'](_['filter'](_0x497e2e,function(_0x3aac28){return _0x3aac28[_0x6ed1('0x13')]!==_0x6ed1('0x14');}),_0x6ed1('0x10'))['join']()||_0x6ed1('0x15'));config[_0x6ed1('0x16')]&&require('./config/seedDB')[_0x6ed1('0x17')]();require(_0x6ed1('0x18'))[_0x6ed1('0x17')]();})[_0x6ed1('0x19')](function(_0x546e5b){logger[_0x6ed1('0x1a')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x546e5b);process[_0x6ed1('0x1b')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 50ea015..406a1a1 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 _0x0b5c=['composable-middleware','basic-auth','crypto','bluebird','util','moment','role','fullname','name','internal','email','userpic','permissions','faxPause','smsPause','pauseType','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','findOne','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','Forbidden.','authorization','startsWith','User','find','authenticate','pass','Wrong\x20credentials.','headers','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','blocked','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','catch','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','Forbidden','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','query','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','length','splice','unshift','encryptString','join','promisify','session','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/license/hardware','../encryptor','lodash','jsonwebtoken','express-jwt'];(function(_0x4f3eb5,_0xe5e344){var _0x120122=function(_0xba07c0){while(--_0xba07c0){_0x4f3eb5['push'](_0x4f3eb5['shift']());}};_0x120122(++_0xe5e344);}(_0x0b5c,0xfa));var _0xc0b5=function(_0x17d342,_0x4f78e3){_0x17d342=_0x17d342-0x0;var _0x595c44=_0x0b5c[_0x17d342];return _0x595c44;};'use strict';var db=require(_0xc0b5('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xc0b5('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0xc0b5('0x2'));var _=require(_0xc0b5('0x3'));var jwt=require(_0xc0b5('0x4'));var expressJwt=require(_0xc0b5('0x5'));var compose=require(_0xc0b5('0x6'));var basicAuth=require(_0xc0b5('0x7'));var crypto=require(_0xc0b5('0x8'));var BPromise=require(_0xc0b5('0x9'));var util=require(_0xc0b5('0xa'));var moment=require(_0xc0b5('0xb'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xc0b5('0xc'),_0xc0b5('0xd'),_0xc0b5('0xe'),_0xc0b5('0xf'),_0xc0b5('0x10'),_0xc0b5('0x11'),_0xc0b5('0x12'),'md5secret','voicePause','chatPause','mailPause',_0xc0b5('0x13'),_0xc0b5('0x14'),'openchannelPause',_0xc0b5('0x15'),'showWebBar',_0xc0b5('0x16'),'lastPauseAt',_0xc0b5('0x17'),_0xc0b5('0x18'),_0xc0b5('0x19'),_0xc0b5('0x1a'),_0xc0b5('0x1b'),_0xc0b5('0x1c'),_0xc0b5('0x1d'),_0xc0b5('0x1e'),_0xc0b5('0x1f'),_0xc0b5('0x20'),_0xc0b5('0x21'),_0xc0b5('0x22'),_0xc0b5('0x23'),'phoneBarRemoteControlPort',_0xc0b5('0x24'),_0xc0b5('0x25'),_0xc0b5('0x26'),_0xc0b5('0x27'),_0xc0b5('0x28'),_0xc0b5('0x29'),_0xc0b5('0x2a'),_0xc0b5('0x2b'),_0xc0b5('0x2c')];exports[_0xc0b5('0x2d')]=function(){return this[_0xc0b5('0x2e')](!![])[_0xc0b5('0x2f')](function(_0x4a19f6,_0x2b4da6,_0xf4869b){if(_0x4a19f6[_0xc0b5('0x30')]){_0xf4869b();}else{return db['ChatInteraction'][_0xc0b5('0x31')]({'where':{'id':_0x4a19f6[_0xc0b5('0x32')]['id']},'attributes':['id',_0xc0b5('0x33'),_0xc0b5('0x34')],'raw':!![]})[_0xc0b5('0x35')](function(_0x334aa1){if(_0x334aa1&&_0x334aa1['closed']){return _0x2b4da6[_0xc0b5('0x36')](_0x334aa1['disposition']===_0xc0b5('0x37')?0x195:0x193)[_0xc0b5('0x38')]({'message':_0x334aa1[_0xc0b5('0x34')]===_0xc0b5('0x37')?_0xc0b5('0x39'):_0xc0b5('0x3a')});}else{_0xf4869b();}})['catch'](function(_0x469b9f){_0xf4869b(_0x469b9f);});}});};exports[_0xc0b5('0x2e')]=function isAuthenticated(_0x286ccd){return compose()['use'](function(_0x1490bb,_0x4cea7c,_0x48f568){var _0x139cb6;if(_0x1490bb['headers'][_0xc0b5('0x3b')]){if(_[_0xc0b5('0x3c')](_0x1490bb['headers']['authorization'],'Basic')){var _0x32a3ef=basicAuth(_0x1490bb);db[_0xc0b5('0x3d')][_0xc0b5('0x3e')]({'where':{'name':_0x32a3ef[_0xc0b5('0xe')]}})['then'](function(_0x5a89d3){if(!_0x5a89d3||!_0x5a89d3[_0xc0b5('0x3f')](_0x32a3ef[_0xc0b5('0x40')])){return _0x4cea7c[_0xc0b5('0x36')](0x191)['json']({'message':_0xc0b5('0x41')});}_0x1490bb['user']={'id':_0x5a89d3['id']};_0x48f568();})['catch'](function(_0x1e48f6){_0x48f568(_0x1e48f6);});}else if(_[_0xc0b5('0x3c')](_0x1490bb[_0xc0b5('0x42')][_0xc0b5('0x3b')],_0xc0b5('0x43'))){validateJwt(_0x1490bb,_0x4cea7c,_0x48f568);}else{if(_0x286ccd){_0x48f568();}else{return _0x4cea7c['status'](0x193)[_0xc0b5('0x38')]({'message':_0xc0b5('0x44')});}}}else if(_0x1490bb['query'][_0xc0b5('0x45')]){try{var _0x258a95={'audience':hardwareConf[_0xc0b5('0x46')](),'issuer':hardwareConf[_0xc0b5('0x46')]()};verifyJwt(_0x1490bb['query'][_0xc0b5('0x45')],_0x258a95)[_0xc0b5('0x35')](function(_0x58d2f1){return db[_0xc0b5('0x3d')][_0xc0b5('0x3e')]({'where':{'id':_0x58d2f1[_0xc0b5('0x47')]}})[_0xc0b5('0x35')](function(_0x5d6e84){_0x139cb6=_0x5d6e84;return db[_0xc0b5('0x48')][_0xc0b5('0x31')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xc0b5('0x49')],'raw':!![]});})[_0xc0b5('0x35')](function(_0x210614){if(!_0x139cb6||!_[_0xc0b5('0x4a')](_0x139cb6[_0xc0b5('0x4b')],_0x58d2f1[_0xc0b5('0x4c')])){return _0x4cea7c[_0xc0b5('0x36')](0x191)[_0xc0b5('0x38')]({'message':_0xc0b5('0x4d')});}if(_0x139cb6['disabled']){return _0x4cea7c[_0xc0b5('0x36')](0x191)[_0xc0b5('0x38')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x139cb6[_0xc0b5('0x4e')]){if(_0x210614['blockDuration']>0x0){if(moment(_0x139cb6[_0xc0b5('0x4f')])[_0xc0b5('0x50')](_0x210614[_0xc0b5('0x49')],_0xc0b5('0x51'))>moment()){return _0x4cea7c[_0xc0b5('0x36')](0x191)[_0xc0b5('0x38')]({'message':_0xc0b5('0x52')});}}else{return _0x4cea7c[_0xc0b5('0x36')](0x191)[_0xc0b5('0x38')]({'message':_0xc0b5('0x52')});}}_0x1490bb[_0xc0b5('0x30')]={'id':_0x139cb6['id']};_0x48f568();});})[_0xc0b5('0x53')](function(){return _0x4cea7c[_0xc0b5('0x36')](0x191)[_0xc0b5('0x38')]({'message':_0xc0b5('0x52')});});}catch(_0x59f1ac){_0x48f568(_0x59f1ac);}}else if(_0x286ccd){_0x48f568();}else{return _0x4cea7c['status'](0x193)[_0xc0b5('0x38')]({'message':'Unknown\x20authorization\x20format'});}})[_0xc0b5('0x2f')](function(_0x5f58eb,_0x36da64,_0x3aca20){if(_0x5f58eb['user']){db[_0xc0b5('0x3d')][_0xc0b5('0x3e')]({'where':{'id':_0x5f58eb[_0xc0b5('0x30')]['id']},'attributes':userAttributes})[_0xc0b5('0x35')](function(_0x48d8f7){if(!_0x48d8f7){return _0x36da64[_0xc0b5('0x36')](0x194)[_0xc0b5('0x38')]({'message':_0xc0b5('0x54')});}_0x5f58eb[_0xc0b5('0x30')]=_0x48d8f7;_0x3aca20();})['catch'](function(_0x19d01e){_0x3aca20(_0x19d01e);});}else if(_0x286ccd){_0x3aca20();}else{return _0x36da64['status'](0x194)['json']({'message':_0xc0b5('0x55')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xc0b5('0x2f')](function(_0x31e4fc,_0x5ab47b,_0x47320d){return licenseUtil[_0xc0b5('0x56')]()['then'](function(_0x443e65){if(_0x443e65['update']){_0x47320d();}else{return _0x5ab47b[_0xc0b5('0x36')](0x193)[_0xc0b5('0x38')]({'message':_0xc0b5('0x57')});}})['catch'](function(_0x1b07b8){_0x47320d(_0x1b07b8);});});};exports[_0xc0b5('0x58')]=function(_0x4f0459,_0x37b64e,_0x1b65bd){_0x4f0459[_0xc0b5('0x58')]=!![];return _0x1b65bd();};exports['signToken']=function signToken(_0x201eb9){return signJwt(_0x201eb9);};exports[_0xc0b5('0x59')]=function(_0x3ba6d2,_0x3639de){if(!_0x3ba6d2['user']){return _0x3639de[_0xc0b5('0x36')](0x194)['json']({'message':_0xc0b5('0x5a')});}var _0x2d199f={'payload':{'id':_0x3ba6d2[_0xc0b5('0x30')]['id'],'role':_0x3ba6d2[_0xc0b5('0x30')][_0xc0b5('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x2d199f)[_0xc0b5('0x35')](function(_0x1a8cdb){_0x3639de[_0xc0b5('0x5b')](_0xc0b5('0x5c'),_0x1a8cdb);_0x3639de[_0xc0b5('0x5d')](_0xc0b5('0x5e'));})[_0xc0b5('0x53')](function(_0x2f68d1){return _0x3639de['status'](0x1f4)['send'](_0x2f68d1);});};exports[_0xc0b5('0x5f')]=function(_0x34b1ec){if(_[_0xc0b5('0x60')](_0x34b1ec[_0xc0b5('0x4b')])||_[_0xc0b5('0x60')](_0x34b1ec[_0xc0b5('0x61')])){return null;}else{return createJwt(_0x34b1ec);}};exports[_0xc0b5('0x62')]=function(_0x359148){_0x359148[_0xc0b5('0x4b')]=generateNonce();_0x359148['apiKeyIat']=generateIssuedAt();return createJwt(_0x359148);};exports['regenerateApiKey']=function(_0x81664b,_0x34265d){var _0xa845b3=_0x81664b[_0xc0b5('0x63')][_0xc0b5('0x45')];if(_0xa845b3){var _0x36d9ad={'nonce':_0x34265d[_0xc0b5('0x4b')],'iat':_0x34265d[_0xc0b5('0x61')],'audience':hardwareConf[_0xc0b5('0x46')](),'issuer':hardwareConf[_0xc0b5('0x46')]()};return verifyJwt(_0xa845b3,_0x36d9ad)[_0xc0b5('0x35')](function(){return generateApiKey(_0x34265d);});}else{throw{'message':_0xc0b5('0x64')};}};exports[_0xc0b5('0x65')]=function(_0x468041){var _0x38fd8a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x38fd8a[_0xc0b5('0x66')](_0x468041))throw new db[(_0xc0b5('0x67'))]['ValidationError'](_0xc0b5('0x68'));return;};exports[_0xc0b5('0x69')]=function(_0x5e0458,_0x1b79d0,_0xc994e5){var _0x3d3766=encryptor[_0xc0b5('0x6a')](_0x1b79d0)[_0xc0b5('0x6b')](',');for(var _0x509532=0x0;_0x509532<_0xc994e5;_0x509532++){if(!_0x3d3766[_0x509532])break;if(_0x5e0458[_0xc0b5('0x6c')]()===_0x3d3766[_0x509532]['toLowerCase']()){var _0x38e3c6=util[_0xc0b5('0x6d')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xc994e5);if(_0xc994e5===0x1){_0x38e3c6=_0xc0b5('0x6e');}throw new db[(_0xc0b5('0x67'))][(_0xc0b5('0x6f'))](_0x38e3c6);}}return;};exports['updatePasswordsHistory']=function(_0x3465e8,_0x36c5f4){var _0x39094b=_0x36c5f4?encryptor['decryptString'](_0x36c5f4)[_0xc0b5('0x6b')](','):[];if(_0x39094b[_0xc0b5('0x70')]===0x5){_0x39094b[_0xc0b5('0x71')](-0x1,0x1);}_0x39094b[_0xc0b5('0x72')](_0x3465e8);return encryptor[_0xc0b5('0x73')](_0x39094b[_0xc0b5('0x74')](','));};function signJwt(_0x156687){var _0x5c3113=BPromise[_0xc0b5('0x75')](jwt['sign'],{'context':jwt});var _0x426d59=_0x156687['secret']||config['secrets'][_0xc0b5('0x76')];return new BPromise(function(_0x117f01,_0x3fc96f){_0x5c3113(_0x156687[_0xc0b5('0x77')],_0x426d59,_0x156687[_0xc0b5('0x78')])['then'](function(_0x419f88){_0x117f01(_0x419f88);})['catch'](function(_0x3cddea){_0x3fc96f(_0x3cddea);});});}function verifyJwt(_0xb92d01,_0x46f1c9,_0x381c63){var _0x4982e3=BPromise[_0xc0b5('0x75')](jwt[_0xc0b5('0x79')],{'context':jwt});var _0x20e772=_0x381c63||config['secrets'][_0xc0b5('0x76')];return new BPromise(function(_0x196d4b,_0x86ab51){_0x4982e3(_0xb92d01,_0x20e772,_0x46f1c9)[_0xc0b5('0x35')](function(_0x452177){_0x196d4b(_0x452177);})['catch'](function(_0x1f44fb){_0x86ab51(_0x1f44fb);});});}function generateNonce(){return crypto[_0xc0b5('0x7a')](0x10)[_0xc0b5('0x7b')](_0xc0b5('0x7c'));}function generateIssuedAt(){return Math[_0xc0b5('0x7d')](Date[_0xc0b5('0x7e')]()/0x3e8)[_0xc0b5('0x7b')]();}function createJwt(_0xca7b84){var _0x5715a8={'payload':{'iat':_0xca7b84['apiKeyIat'],'nonce':_0xca7b84['apiKeyNonce']},'options':{'algorithm':_0xc0b5('0x7f'),'subject':_0xca7b84['id'][_0xc0b5('0x7b')](),'issuer':hardwareConf[_0xc0b5('0x46')](),'audience':hardwareConf[_0xc0b5('0x46')]()}};return signJwt(_0x5715a8)[_0xc0b5('0x35')](function(_0x1c42ad){return{'iat':_0xca7b84[_0xc0b5('0x61')],'nonce':_0xca7b84[_0xc0b5('0x4b')],'token':_0x1c42ad};});} \ No newline at end of file +var _0x0d2d=['blocked','blockedAt','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','getUuid','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','updatePasswordsHistory','length','splice','unshift','join','promisify','sign','payload','options','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','composable-middleware','basic-auth','crypto','bluebird','util','secrets','session','role','fullname','name','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','use','user','findOne','params','closed','disposition','then','status','unmanaged','Forbidden.','catch','isAuthenticated','headers','startsWith','Basic','User','Wrong\x20credentials.','authorization','Bearer','Unknown\x20authorization\x20format','query','apikey','sub','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','json','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key'];(function(_0x527906,_0x97561e){var _0x43ba3c=function(_0x2d5f40){while(--_0x2d5f40){_0x527906['push'](_0x527906['shift']());}};_0x43ba3c(++_0x97561e);}(_0x0d2d,0x19c));var _0xd0d2=function(_0x45b85d,_0xf62e5){_0x45b85d=_0x45b85d-0x0;var _0x459b38=_0x0d2d[_0x45b85d];return _0x459b38;};'use strict';var db=require(_0xd0d2('0x0'))['db'];var config=require(_0xd0d2('0x1'));var hardwareConf=require(_0xd0d2('0x2'));var licenseUtil=require(_0xd0d2('0x3'));var encryptor=require(_0xd0d2('0x4'));var _=require(_0xd0d2('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xd0d2('0x6'));var basicAuth=require(_0xd0d2('0x7'));var crypto=require(_0xd0d2('0x8'));var BPromise=require(_0xd0d2('0x9'));var util=require(_0xd0d2('0xa'));var moment=require('moment');var validateJwt=expressJwt({'secret':config[_0xd0d2('0xb')][_0xd0d2('0xc')]});var userAttributes=['id',_0xd0d2('0xd'),_0xd0d2('0xe'),_0xd0d2('0xf'),'internal',_0xd0d2('0x10'),_0xd0d2('0x11'),'permissions',_0xd0d2('0x12'),_0xd0d2('0x13'),_0xd0d2('0x14'),_0xd0d2('0x15'),_0xd0d2('0x16'),'smsPause','openchannelPause',_0xd0d2('0x17'),_0xd0d2('0x18'),_0xd0d2('0x19'),_0xd0d2('0x1a'),_0xd0d2('0x1b'),_0xd0d2('0x1c'),_0xd0d2('0x1d'),_0xd0d2('0x1e'),'phoneBarAutoAnswer','phoneBarAutoAnswerDelay',_0xd0d2('0x1f'),'phoneBarEnableRecording',_0xd0d2('0x20'),_0xd0d2('0x21'),_0xd0d2('0x22'),_0xd0d2('0x23'),'phoneBarRemoteControl',_0xd0d2('0x24'),'hotdesk',_0xd0d2('0x25'),_0xd0d2('0x26'),_0xd0d2('0x27'),_0xd0d2('0x28'),'wssPort',_0xd0d2('0x29'),_0xd0d2('0x2a'),_0xd0d2('0x2b')];exports[_0xd0d2('0x2c')]=function(){return this['isAuthenticated'](!![])[_0xd0d2('0x2d')](function(_0x2394f0,_0xdbf0d0,_0x4ec2ac){if(_0x2394f0[_0xd0d2('0x2e')]){_0x4ec2ac();}else{return db['ChatInteraction'][_0xd0d2('0x2f')]({'where':{'id':_0x2394f0[_0xd0d2('0x30')]['id']},'attributes':['id',_0xd0d2('0x31'),_0xd0d2('0x32')],'raw':!![]})[_0xd0d2('0x33')](function(_0x8f10b4){if(_0x8f10b4&&_0x8f10b4[_0xd0d2('0x31')]){return _0xdbf0d0[_0xd0d2('0x34')](_0x8f10b4[_0xd0d2('0x32')]===_0xd0d2('0x35')?0x195:0x193)['json']({'message':_0x8f10b4[_0xd0d2('0x32')]===_0xd0d2('0x35')?'Unmanaged.':_0xd0d2('0x36')});}else{_0x4ec2ac();}})[_0xd0d2('0x37')](function(_0x3b8b62){_0x4ec2ac(_0x3b8b62);});}});};exports[_0xd0d2('0x38')]=function isAuthenticated(_0x5a6459){return compose()[_0xd0d2('0x2d')](function(_0x105997,_0x44a36d,_0x503f2c){var _0x8db553;if(_0x105997[_0xd0d2('0x39')]['authorization']){if(_[_0xd0d2('0x3a')](_0x105997['headers']['authorization'],_0xd0d2('0x3b'))){var _0x5df64e=basicAuth(_0x105997);db[_0xd0d2('0x3c')]['find']({'where':{'name':_0x5df64e[_0xd0d2('0xf')]}})['then'](function(_0x4b1426){if(!_0x4b1426||!_0x4b1426['authenticate'](_0x5df64e['pass'])){return _0x44a36d[_0xd0d2('0x34')](0x191)['json']({'message':_0xd0d2('0x3d')});}_0x105997[_0xd0d2('0x2e')]={'id':_0x4b1426['id']};_0x503f2c();})[_0xd0d2('0x37')](function(_0x127b42){_0x503f2c(_0x127b42);});}else if(_[_0xd0d2('0x3a')](_0x105997[_0xd0d2('0x39')][_0xd0d2('0x3e')],_0xd0d2('0x3f'))){validateJwt(_0x105997,_0x44a36d,_0x503f2c);}else{if(_0x5a6459){_0x503f2c();}else{return _0x44a36d[_0xd0d2('0x34')](0x193)['json']({'message':_0xd0d2('0x40')});}}}else if(_0x105997[_0xd0d2('0x41')][_0xd0d2('0x42')]){try{var _0x483395={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x105997[_0xd0d2('0x41')]['apikey'],_0x483395)[_0xd0d2('0x33')](function(_0x546755){return db['User']['find']({'where':{'id':_0x546755[_0xd0d2('0x43')]}})[_0xd0d2('0x33')](function(_0x1f1f4f){_0x8db553=_0x1f1f4f;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xd0d2('0x44'),_0xd0d2('0x45')],'raw':!![]});})[_0xd0d2('0x33')](function(_0x1d0913){if(!_0x8db553||!_[_0xd0d2('0x46')](_0x8db553[_0xd0d2('0x47')],_0x546755['nonce'])){return _0x44a36d[_0xd0d2('0x34')](0x191)[_0xd0d2('0x48')]({'message':_0xd0d2('0x49')});}if(_0x8db553[_0xd0d2('0x4a')]){return _0x44a36d['status'](0x191)[_0xd0d2('0x48')]({'message':_0xd0d2('0x4b')});}if(_0x8db553[_0xd0d2('0x4c')]){if(_0x1d0913[_0xd0d2('0x45')]>0x0){if(moment(_0x8db553[_0xd0d2('0x4d')])['add'](_0x1d0913['blockDuration'],_0xd0d2('0x4e'))>moment()){return _0x44a36d[_0xd0d2('0x34')](0x191)[_0xd0d2('0x48')]({'message':_0xd0d2('0x4b')});}}else{return _0x44a36d[_0xd0d2('0x34')](0x191)[_0xd0d2('0x48')]({'message':_0xd0d2('0x4b')});}}_0x105997[_0xd0d2('0x2e')]={'id':_0x8db553['id']};_0x503f2c();});})[_0xd0d2('0x37')](function(){return _0x44a36d[_0xd0d2('0x34')](0x191)[_0xd0d2('0x48')]({'message':_0xd0d2('0x4b')});});}catch(_0x5a03f5){_0x503f2c(_0x5a03f5);}}else if(_0x5a6459){_0x503f2c();}else{return _0x44a36d['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0xd0d2('0x2d')](function(_0x57c629,_0x2ccc80,_0x59b01a){if(_0x57c629[_0xd0d2('0x2e')]){db[_0xd0d2('0x3c')]['find']({'where':{'id':_0x57c629[_0xd0d2('0x2e')]['id']},'attributes':userAttributes})['then'](function(_0x564e62){if(!_0x564e62){return _0x2ccc80[_0xd0d2('0x34')](0x194)[_0xd0d2('0x48')]({'message':_0xd0d2('0x4f')});}_0x57c629[_0xd0d2('0x2e')]=_0x564e62;_0x59b01a();})[_0xd0d2('0x37')](function(_0x25c394){_0x59b01a(_0x25c394);});}else if(_0x5a6459){_0x59b01a();}else{return _0x2ccc80[_0xd0d2('0x34')](0x194)[_0xd0d2('0x48')]({'message':_0xd0d2('0x50')});}});};exports[_0xd0d2('0x51')]=function canUpdate(){return compose()['use'](function(_0x56b0af,_0x53d33c,_0x5b2bd0){return licenseUtil[_0xd0d2('0x52')]()[_0xd0d2('0x33')](function(_0x4ada7c){if(_0x4ada7c[_0xd0d2('0x53')]){_0x5b2bd0();}else{return _0x53d33c['status'](0x193)[_0xd0d2('0x48')]({'message':_0xd0d2('0x54')});}})[_0xd0d2('0x37')](function(_0x5b5d2b){_0x5b2bd0(_0x5b5d2b);});});};exports[_0xd0d2('0x55')]=function(_0x2fc752,_0xb17fc,_0x1146b5){_0x2fc752[_0xd0d2('0x55')]=!![];return _0x1146b5();};exports[_0xd0d2('0x56')]=function signToken(_0x15c1e1){return signJwt(_0x15c1e1);};exports[_0xd0d2('0x57')]=function(_0x47d49a,_0x25a805){if(!_0x47d49a['user']){return _0x25a805[_0xd0d2('0x34')](0x194)[_0xd0d2('0x48')]({'message':_0xd0d2('0x58')});}var _0x5b05f0={'payload':{'id':_0x47d49a[_0xd0d2('0x2e')]['id'],'role':_0x47d49a['user'][_0xd0d2('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5b05f0)[_0xd0d2('0x33')](function(_0xdf1f14){_0x25a805[_0xd0d2('0x59')](_0xd0d2('0x5a'),_0xdf1f14);_0x25a805[_0xd0d2('0x5b')](_0xd0d2('0x5c'));})[_0xd0d2('0x37')](function(_0x112b81){return _0x25a805[_0xd0d2('0x34')](0x1f4)[_0xd0d2('0x5d')](_0x112b81);});};exports[_0xd0d2('0x5e')]=function(_0x53bc00){if(_[_0xd0d2('0x5f')](_0x53bc00[_0xd0d2('0x47')])||_[_0xd0d2('0x5f')](_0x53bc00[_0xd0d2('0x60')])){return null;}else{return createJwt(_0x53bc00);}};exports[_0xd0d2('0x61')]=function(_0x5f3cdf){_0x5f3cdf[_0xd0d2('0x47')]=generateNonce();_0x5f3cdf[_0xd0d2('0x60')]=generateIssuedAt();return createJwt(_0x5f3cdf);};exports[_0xd0d2('0x62')]=function(_0x356311,_0x3a1261){var _0x25e2c6=_0x356311[_0xd0d2('0x41')]['apikey'];if(_0x25e2c6){var _0xbb5e79={'nonce':_0x3a1261[_0xd0d2('0x47')],'iat':_0x3a1261[_0xd0d2('0x60')],'audience':hardwareConf[_0xd0d2('0x63')](),'issuer':hardwareConf[_0xd0d2('0x63')]()};return verifyJwt(_0x25e2c6,_0xbb5e79)[_0xd0d2('0x33')](function(){return generateApiKey(_0x3a1261);});}else{throw{'message':_0xd0d2('0x64')};}};exports[_0xd0d2('0x65')]=function(_0x4d0fa2){var _0x2f0d1c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2f0d1c[_0xd0d2('0x66')](_0x4d0fa2))throw new db[(_0xd0d2('0x67'))]['ValidationError'](_0xd0d2('0x68'));return;};exports[_0xd0d2('0x69')]=function(_0xc04da,_0x563102,_0x17aab4){var _0x3ec5d0=encryptor[_0xd0d2('0x6a')](_0x563102)[_0xd0d2('0x6b')](',');for(var _0x5152cc=0x0;_0x5152cc<_0x17aab4;_0x5152cc++){if(!_0x3ec5d0[_0x5152cc])break;if(_0xc04da[_0xd0d2('0x6c')]()===_0x3ec5d0[_0x5152cc][_0xd0d2('0x6c')]()){var _0x512fc5=util[_0xd0d2('0x6d')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x17aab4);if(_0x17aab4===0x1){_0x512fc5='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x512fc5);}}return;};exports[_0xd0d2('0x6e')]=function(_0x4325d1,_0x19b5d5){var _0x2788f7=_0x19b5d5?encryptor[_0xd0d2('0x6a')](_0x19b5d5)[_0xd0d2('0x6b')](','):[];if(_0x2788f7[_0xd0d2('0x6f')]===0x5){_0x2788f7[_0xd0d2('0x70')](-0x1,0x1);}_0x2788f7[_0xd0d2('0x71')](_0x4325d1);return encryptor['encryptString'](_0x2788f7[_0xd0d2('0x72')](','));};function signJwt(_0x8e225){var _0x366ecf=BPromise[_0xd0d2('0x73')](jwt[_0xd0d2('0x74')],{'context':jwt});var _0xcbb5d=_0x8e225['secret']||config['secrets']['session'];return new BPromise(function(_0x38e6fa,_0x60343f){_0x366ecf(_0x8e225[_0xd0d2('0x75')],_0xcbb5d,_0x8e225[_0xd0d2('0x76')])['then'](function(_0x2cca03){_0x38e6fa(_0x2cca03);})[_0xd0d2('0x37')](function(_0x355649){_0x60343f(_0x355649);});});}function verifyJwt(_0x9b5337,_0xadd757,_0x424d4d){var _0x2df815=BPromise[_0xd0d2('0x73')](jwt['verify'],{'context':jwt});var _0x1ad923=_0x424d4d||config['secrets'][_0xd0d2('0xc')];return new BPromise(function(_0x285c81,_0x9f484d){_0x2df815(_0x9b5337,_0x1ad923,_0xadd757)[_0xd0d2('0x33')](function(_0x1f868e){_0x285c81(_0x1f868e);})[_0xd0d2('0x37')](function(_0x244447){_0x9f484d(_0x244447);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0xd0d2('0x77')](_0xd0d2('0x78'));}function generateIssuedAt(){return Math[_0xd0d2('0x79')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x131148){var _0x5cea8e={'payload':{'iat':_0x131148[_0xd0d2('0x60')],'nonce':_0x131148[_0xd0d2('0x47')]},'options':{'algorithm':'HS512','subject':_0x131148['id'][_0xd0d2('0x77')](),'issuer':hardwareConf[_0xd0d2('0x63')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x5cea8e)['then'](function(_0x22774b){return{'iat':_0x131148[_0xd0d2('0x60')],'nonce':_0x131148[_0xd0d2('0x47')],'token':_0x22774b};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 843cbf2..cd4e41f 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 _0x3d83=['unlink','encryptString','secret','createCipher','utf8','base64','decryptString','crypto','bluebird','lodash','../../config/environment','../../config/logger','app','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','write','end','final','binary','decryptFile','createDecipher','close'];(function(_0x58b6d3,_0x1c6605){var _0x3843ff=function(_0x20d302){while(--_0x20d302){_0x58b6d3['push'](_0x58b6d3['shift']());}};_0x3843ff(++_0x1c6605);}(_0x3d83,0x73));var _0x33d8=function(_0x402509,_0x568829){_0x402509=_0x402509-0x0;var _0x27fca1=_0x3d83[_0x402509];return _0x27fca1;};'use strict';var crypto=require(_0x33d8('0x0'));var fs=require('fs');var BPromise=require(_0x33d8('0x1'));var _=require(_0x33d8('0x2'));var config=require(_0x33d8('0x3'));var logger=require(_0x33d8('0x4'))(_0x33d8('0x5'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x33d8('0x6')],'algorithm':_0x33d8('0x7')};const fileOptions={'algorithm':'aes192'};if(config[_0x33d8('0x8')]&&config['encrypt'][_0x33d8('0x9')]){var isSupported=isAlgorithmSupported(config[_0x33d8('0x8')][_0x33d8('0x9')]);if(isSupported){fileOptions[_0x33d8('0x9')]=config['encrypt'][_0x33d8('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x33d8('0xa')](',\x20');logger[_0x33d8('0xb')](config[_0x33d8('0x8')][_0x33d8('0x9')],_0x33d8('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x4e3f34){return AES_SUPPORTED_RX[_0x33d8('0xd')](_0x4e3f34);}function getSupportedCiphers(){return crypto[_0x33d8('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xfa662f){return getSupportedCiphers()[_0x33d8('0xf')](_0xfa662f)>-0x1;}function combineOptions(_0x22be71){var _0x5e9431={};for(var _0x16e26f in fileOptions){if(fileOptions[_0x33d8('0x10')](_0x16e26f)){_0x5e9431[_0x16e26f]=fileOptions[_0x16e26f];}}if(_0x22be71){for(var _0x507dab in _0x22be71){if(_0x22be71[_0x33d8('0x10')](_0x507dab)){_0x5e9431[_0x507dab]=_0x22be71[_0x507dab];}}}return _0x5e9431;}exports[_0x33d8('0x11')]=function(_0x5d5515,_0x216304,_0x5e82e9,_0x47bafc){return new BPromise(function(_0x399f3f,_0x3bc2ee){_0x47bafc=combineOptions(_0x47bafc);var _0x2f5643=new Buffer(_0x5e82e9);var _0x2ff3d2=fs[_0x33d8('0x12')](_0x5d5515);var _0x16181c=fs[_0x33d8('0x13')](_0x216304);var _0x3f54b3=crypto['createCipher'](_0x47bafc[_0x33d8('0x9')],_0x2f5643);_0x2ff3d2['on'](_0x33d8('0x14'),function(_0x30b589){var _0x361493=new Buffer(_0x3f54b3[_0x33d8('0x15')](_0x30b589),'binary');_0x16181c[_0x33d8('0x16')](_0x361493);});_0x2ff3d2['on'](_0x33d8('0x17'),function(){try{var _0xeac54=new Buffer(_0x3f54b3[_0x33d8('0x18')](_0x33d8('0x19')),_0x33d8('0x19'));_0x16181c['write'](_0xeac54);_0x16181c[_0x33d8('0x17')]();_0x16181c['on']('close',function(){return _0x399f3f(_0x216304);});}catch(_0x4f17f5){fs['unlink'](_0x216304);return _0x3bc2ee(_0x4f17f5);}});});};exports[_0x33d8('0x1a')]=function(_0x40015c,_0x3e6a72,_0x4e47d5,_0x35de8c){return new BPromise(function(_0x154783,_0x457f98){_0x35de8c=combineOptions(_0x35de8c);var _0x506ed6=new Buffer(_0x4e47d5);var _0x789f5a=fs['createReadStream'](_0x40015c);var _0x14d082=fs[_0x33d8('0x13')](_0x3e6a72);var _0x561c35=crypto[_0x33d8('0x1b')](_0x35de8c[_0x33d8('0x9')],_0x506ed6);_0x789f5a['on'](_0x33d8('0x14'),function(_0x4638e3){var _0x26cabf=new Buffer(_0x561c35['update'](_0x4638e3),_0x33d8('0x19'));_0x14d082[_0x33d8('0x16')](_0x26cabf);});_0x789f5a['on'](_0x33d8('0x17'),function(){try{var _0x472142=new Buffer(_0x561c35['final']('binary'),_0x33d8('0x19'));_0x14d082['write'](_0x472142);_0x14d082[_0x33d8('0x17')]();_0x14d082['on'](_0x33d8('0x1c'),function(){return _0x154783(_0x3e6a72);});}catch(_0x5b2acc){fs[_0x33d8('0x1d')](_0x3e6a72);return _0x457f98(_0x5b2acc);}});});};exports[_0x33d8('0x1e')]=function(_0x16f81a,_0x15392a,_0x9cd545){var _0x103776=_0x9cd545||stringOptions[_0x33d8('0x9')];var _0x5ecd2f=_0x15392a||stringOptions[_0x33d8('0x1f')];var _0x5180d7=crypto[_0x33d8('0x20')](_0x103776,_0x5ecd2f);var _0xf1b34f=_0x5180d7[_0x33d8('0x15')](_0x16f81a,_0x33d8('0x21'),_0x33d8('0x22'));_0xf1b34f+=_0x5180d7[_0x33d8('0x18')](_0x33d8('0x22'));return _0xf1b34f;};exports[_0x33d8('0x23')]=function(_0x8c718,_0x5bb97d,_0x220215){var _0x2535b5=_0x220215||stringOptions['algorithm'];var _0x2d2b1c=_0x5bb97d||stringOptions[_0x33d8('0x1f')];var _0x3e224d=crypto['createDecipher'](_0x2535b5,_0x2d2b1c);var _0x5d454a=_0x3e224d['update'](_0x8c718,_0x33d8('0x22'),'utf8');_0x5d454a+=_0x3e224d[_0x33d8('0x18')](_0x33d8('0x21'));return _0x5d454a;}; \ No newline at end of file +var _0xccb4=['createWriteStream','createCipher','data','update','binary','write','end','close','unlink','createDecipher','final','encryptString','utf8','base64','decryptString','secret','crypto','lodash','../../config/environment','../../config/logger','app','secrets','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream'];(function(_0xcbb4ee,_0x5f441d){var _0x2769f1=function(_0xa0aeee){while(--_0xa0aeee){_0xcbb4ee['push'](_0xcbb4ee['shift']());}};_0x2769f1(++_0x5f441d);}(_0xccb4,0x1f0));var _0x4ccb=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0xccb4[_0x565c49];return _0x20ca34;};'use strict';var crypto=require(_0x4ccb('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x4ccb('0x1'));var config=require(_0x4ccb('0x2'));var logger=require(_0x4ccb('0x3'))(_0x4ccb('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4ccb('0x5')]['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':'aes192'};if(config[_0x4ccb('0x6')]&&config[_0x4ccb('0x6')][_0x4ccb('0x7')]){var isSupported=isAlgorithmSupported(config[_0x4ccb('0x6')][_0x4ccb('0x7')]);if(isSupported){fileOptions[_0x4ccb('0x7')]=config[_0x4ccb('0x6')][_0x4ccb('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4ccb('0x8')](',\x20');logger['error'](config[_0x4ccb('0x6')][_0x4ccb('0x7')],_0x4ccb('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x2f99d0){return AES_SUPPORTED_RX[_0x4ccb('0xa')](_0x2f99d0);}function getSupportedCiphers(){return crypto[_0x4ccb('0xb')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x22b067){return getSupportedCiphers()[_0x4ccb('0xc')](_0x22b067)>-0x1;}function combineOptions(_0x53d43a){var _0xdf5631={};for(var _0xb95831 in fileOptions){if(fileOptions[_0x4ccb('0xd')](_0xb95831)){_0xdf5631[_0xb95831]=fileOptions[_0xb95831];}}if(_0x53d43a){for(var _0x4fd49a in _0x53d43a){if(_0x53d43a[_0x4ccb('0xd')](_0x4fd49a)){_0xdf5631[_0x4fd49a]=_0x53d43a[_0x4fd49a];}}}return _0xdf5631;}exports[_0x4ccb('0xe')]=function(_0x51f733,_0x1f74d5,_0x1dcd0e,_0x25e608){return new BPromise(function(_0x12baef,_0x464416){_0x25e608=combineOptions(_0x25e608);var _0x56cca4=new Buffer(_0x1dcd0e);var _0x3d55b4=fs[_0x4ccb('0xf')](_0x51f733);var _0x2d9774=fs[_0x4ccb('0x10')](_0x1f74d5);var _0x31be81=crypto[_0x4ccb('0x11')](_0x25e608['algorithm'],_0x56cca4);_0x3d55b4['on'](_0x4ccb('0x12'),function(_0x4b3de8){var _0x742f81=new Buffer(_0x31be81[_0x4ccb('0x13')](_0x4b3de8),_0x4ccb('0x14'));_0x2d9774[_0x4ccb('0x15')](_0x742f81);});_0x3d55b4['on'](_0x4ccb('0x16'),function(){try{var _0x6e515d=new Buffer(_0x31be81['final'](_0x4ccb('0x14')),_0x4ccb('0x14'));_0x2d9774[_0x4ccb('0x15')](_0x6e515d);_0x2d9774['end']();_0x2d9774['on'](_0x4ccb('0x17'),function(){return _0x12baef(_0x1f74d5);});}catch(_0x3c1299){fs[_0x4ccb('0x18')](_0x1f74d5);return _0x464416(_0x3c1299);}});});};exports['decryptFile']=function(_0x25cd63,_0x43c4d4,_0x27b641,_0x551f96){return new BPromise(function(_0x59dc04,_0x5084be){_0x551f96=combineOptions(_0x551f96);var _0xc0aeba=new Buffer(_0x27b641);var _0x35b12c=fs[_0x4ccb('0xf')](_0x25cd63);var _0x4656d6=fs[_0x4ccb('0x10')](_0x43c4d4);var _0x54b143=crypto[_0x4ccb('0x19')](_0x551f96[_0x4ccb('0x7')],_0xc0aeba);_0x35b12c['on'](_0x4ccb('0x12'),function(_0x43a994){var _0x1c2553=new Buffer(_0x54b143['update'](_0x43a994),_0x4ccb('0x14'));_0x4656d6[_0x4ccb('0x15')](_0x1c2553);});_0x35b12c['on'](_0x4ccb('0x16'),function(){try{var _0x4fde72=new Buffer(_0x54b143[_0x4ccb('0x1a')]('binary'),_0x4ccb('0x14'));_0x4656d6[_0x4ccb('0x15')](_0x4fde72);_0x4656d6[_0x4ccb('0x16')]();_0x4656d6['on'](_0x4ccb('0x17'),function(){return _0x59dc04(_0x43c4d4);});}catch(_0x318c45){fs[_0x4ccb('0x18')](_0x43c4d4);return _0x5084be(_0x318c45);}});});};exports[_0x4ccb('0x1b')]=function(_0x41c016,_0x2965c3,_0x353311){var _0x1bfa7b=_0x353311||stringOptions['algorithm'];var _0x12bf00=_0x2965c3||stringOptions['secret'];var _0x2af404=crypto[_0x4ccb('0x11')](_0x1bfa7b,_0x12bf00);var _0x30b1bd=_0x2af404[_0x4ccb('0x13')](_0x41c016,_0x4ccb('0x1c'),_0x4ccb('0x1d'));_0x30b1bd+=_0x2af404['final'](_0x4ccb('0x1d'));return _0x30b1bd;};exports[_0x4ccb('0x1e')]=function(_0x16c65f,_0x92ce30,_0x65db0f){var _0x38d39f=_0x65db0f||stringOptions[_0x4ccb('0x7')];var _0x398e76=_0x92ce30||stringOptions[_0x4ccb('0x1f')];var _0x3f33df=crypto[_0x4ccb('0x19')](_0x38d39f,_0x398e76);var _0x8d204c=_0x3f33df[_0x4ccb('0x13')](_0x16c65f,_0x4ccb('0x1d'),_0x4ccb('0x1c'));_0x8d204c+=_0x3f33df[_0x4ccb('0x1a')](_0x4ccb('0x1c'));return _0x8d204c;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 25fcf0f..407e622 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 _0x7534=['CSV','split','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','zip','catch','Failed','finally','util','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format'];(function(_0x1280c9,_0x3aa8ca){var _0x521c37=function(_0x31ffc0){while(--_0x31ffc0){_0x1280c9['push'](_0x1280c9['shift']());}};_0x521c37(++_0x3aa8ca);}(_0x7534,0x1a2));var _0x4753=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x7534[_0x17d9e3];return _0x14192d;};'use strict';var util=require(_0x4753('0x0'));var path=require('path');var _=require(_0x4753('0x1'));var csv=require(_0x4753('0x2'));var fs=require('fs');var BPromise=require(_0x4753('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x4753('0x4'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4753('0x5'))[_0x4753('0x6')];var logger=require('../../config/logger')(_0x4753('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x4753('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4753('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x48edec,_0x3e9d03){var _0x7f0412={'status':_0x48edec};var _0x3b8413={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3e9d03){_0x7f0412['savename']=_0x3e9d03;}return db[_0x4753('0x9')][_0x4753('0xa')](_0x7f0412,_0x3b8413);}function main(){var _0x18d6c0=0x1388;var _0x288563;logger[_0x4753('0xb')](util[_0x4753('0xc')](_0x4753('0xd'),EXTRACTED_REPORT_ID,_0x4753('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4753('0xf'),_0x4753('0x10')]})[_0x4753('0x11')](function(_0x34ef86){if(_0x34ef86){_0x288563=_0x34ef86;_0x18d6c0=_0x288563['splitSizeCsv']||0x1388;}})[_0x4753('0x11')](function(){return dbH['sequelize'][_0x4753('0x12')](util[_0x4753('0xc')](_0x4753('0x13'),QUERY),{'type':dbH['sequelize'][_0x4753('0x14')][_0x4753('0x15')]});})[_0x4753('0x11')](function(_0x37bad3){if(!_0x37bad3[0x0]['num']){return analyticExtractedReport(_0x4753('0x16'));}var _0x572be3=[];var _0x195f13=0x0;if(_0x288563['split']){if(_0x37bad3&&_0x37bad3[_0x4753('0x17')]){var _0x290ffd=_[_0x4753('0x18')](_0x37bad3[0x0][_0x4753('0x19')]/_0x18d6c0);var _0x1094eb=Number[_0x4753('0x1a')](_0x37bad3[0x0][_0x4753('0x19')]/_0x18d6c0)?_0x37bad3[0x0][_0x4753('0x19')]%_0x18d6c0:0x0;_0x290ffd[_0x4753('0x1b')](function(_0x4ea173){if(_0x4ea173>0x0){_0x195f13+=_0x18d6c0;}_0x572be3[_0x4753('0x1c')](dbH[_0x4753('0x1d')]['query'](util[_0x4753('0xc')](_0x4753('0x1e'),QUERY,_0x18d6c0,_0x195f13),{'type':dbH['sequelize'][_0x4753('0x14')][_0x4753('0x15')]}));});if(_0x1094eb>0x0){_0x195f13+=_0x18d6c0;_0x572be3[_0x4753('0x1c')](dbH[_0x4753('0x1d')][_0x4753('0x12')](util[_0x4753('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1094eb,_0x195f13),{'type':dbH[_0x4753('0x1d')]['QueryTypes'][_0x4753('0x15')]}));}}}else{_0x572be3[_0x4753('0x1c')](dbH['sequelize'][_0x4753('0x12')](QUERY,{'type':dbH[_0x4753('0x1d')][_0x4753('0x14')][_0x4753('0x15')]}));}var _0x535599=path[_0x4753('0x1f')](PATH);var _0xe8faeb=path[_0x4753('0x20')](PATH,_0x4753('0x21'));var _0x1852cd=_0x288563[_0x4753('0xf')]&&_0x572be3[_0x4753('0x17')]>0x1;var _0x572cd0=[];if(!fs[_0x4753('0x22')](path[_0x4753('0x23')](_0x535599,_0xe8faeb))&&_0x1852cd){fs[_0x4753('0x24')](path['join'](_0x535599,_0xe8faeb));}return BPromise[_0x4753('0x25')](_0x572be3,function(_0x1d150e){_0x572cd0[_0x4753('0x1c')](_0x1d150e);})[_0x4753('0x11')](function(){for(var _0x5e2443=0x0;_0x5e2443<_0x572cd0[_0x4753('0x17')];_0x5e2443+=0x1){var _0xdde8a0;var _0x6cb0f5=_0x572cd0[_0x5e2443];if(_0x1852cd){_0xdde8a0=path['join'](_0x535599,_0xe8faeb,util[_0x4753('0xc')](_0x4753('0x26'),_0xe8faeb,_0x5e2443,'csv'));}else{_0xdde8a0=path['join'](_0x535599,util[_0x4753('0xc')](_0x4753('0x27'),_0xe8faeb,_0x4753('0x28')));}fs[_0x4753('0x29')](_0xdde8a0,csv(_0x6cb0f5));}})[_0x4753('0x11')](function(){if(_0x1852cd){return new Promise(function(_0x50d9c3){zipdir(path[_0x4753('0x23')](_0x535599,_0xe8faeb),{'saveTo':path['join'](_0x535599,util[_0x4753('0xc')](_0x4753('0x27'),_0xe8faeb,'zip'))},function(_0xc25557,_0x11f1d8){rimraf(path[_0x4753('0x23')](_0x535599,_0xe8faeb),function(){});_0x50d9c3(_0x4753('0x2a'));});});}})[_0x4753('0x11')](function(){logger['info'](util[_0x4753('0xc')](_0x4753('0x2b'),EXTRACTED_REPORT_ID,_0x4753('0xe')));return analyticExtractedReport('Completed',_0x1852cd?util[_0x4753('0xc')](_0x4753('0x27'),_0xe8faeb,_0x1852cd?_0x4753('0x2c'):_0x4753('0x28')):null);});})[_0x4753('0x2d')](function(_0x1ff865){logger[_0x4753('0xb')](util[_0x4753('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4753('0xe')),util['inspect'](_0x1ff865,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4753('0x2e'));})[_0x4753('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x2007=['info','format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','mkdirSync','each','join','%s.%s','csv','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport'];(function(_0x14fa94,_0x5da10b){var _0x3f1bfe=function(_0x22d49d){while(--_0x22d49d){_0x14fa94['push'](_0x14fa94['shift']());}};_0x3f1bfe(++_0x5da10b);}(_0x2007,0xd8));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x7200('0x0'));var path=require('path');var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x7200('0x1'));var zipdir=require(_0x7200('0x2'));var rimraf=require(_0x7200('0x3'));var db=require(_0x7200('0x4'))['db'];var dbH=require(_0x7200('0x4'))[_0x7200('0x5')];var logger=require(_0x7200('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x7200('0x7')][0x2]);var QUERY=process[_0x7200('0x7')][0x3];var PATH=process[_0x7200('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x7755f1,_0xb5f2d3){var _0x14b1dc={'status':_0x7755f1};var _0x91786a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb5f2d3){_0x14b1dc['savename']=_0xb5f2d3;}return db[_0x7200('0x8')]['update'](_0x14b1dc,_0x91786a);}function main(){var _0x4cdee0=0x1388;var _0x56da80;logger[_0x7200('0x9')](util[_0x7200('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x7200('0xb')));return db['Setting'][_0x7200('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x7200('0xd'),_0x7200('0xe')]})[_0x7200('0xf')](function(_0x4b209f){if(_0x4b209f){_0x56da80=_0x4b209f;_0x4cdee0=_0x56da80[_0x7200('0xe')]||0x1388;}})[_0x7200('0xf')](function(){return dbH[_0x7200('0x10')][_0x7200('0x11')](util['format'](_0x7200('0x12'),QUERY),{'type':dbH[_0x7200('0x10')][_0x7200('0x13')][_0x7200('0x14')]});})['then'](function(_0x539952){if(!_0x539952[0x0][_0x7200('0x15')]){return analyticExtractedReport(_0x7200('0x16'));}var _0x587119=[];var _0x3869e8=0x0;if(_0x56da80[_0x7200('0xd')]){if(_0x539952&&_0x539952[_0x7200('0x17')]){var _0xdf8d45=_[_0x7200('0x18')](_0x539952[0x0][_0x7200('0x15')]/_0x4cdee0);var _0x2f2ba9=Number['isInteger'](_0x539952[0x0]['num']/_0x4cdee0)?_0x539952[0x0][_0x7200('0x15')]%_0x4cdee0:0x0;_0xdf8d45['forEach'](function(_0x55d085){if(_0x55d085>0x0){_0x3869e8+=_0x4cdee0;}_0x587119['push'](dbH['sequelize']['query'](util[_0x7200('0xa')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4cdee0,_0x3869e8),{'type':dbH[_0x7200('0x10')][_0x7200('0x13')]['SELECT']}));});if(_0x2f2ba9>0x0){_0x3869e8+=_0x4cdee0;_0x587119[_0x7200('0x19')](dbH[_0x7200('0x10')][_0x7200('0x11')](util[_0x7200('0xa')](_0x7200('0x1a'),QUERY,_0x2f2ba9,_0x3869e8),{'type':dbH['sequelize']['QueryTypes'][_0x7200('0x14')]}));}}}else{_0x587119['push'](dbH[_0x7200('0x10')][_0x7200('0x11')](QUERY,{'type':dbH[_0x7200('0x10')][_0x7200('0x13')][_0x7200('0x14')]}));}var _0x288d10=path[_0x7200('0x1b')](PATH);var _0x1db0f1=path[_0x7200('0x1c')](PATH,_0x7200('0x1d'));var _0x1987f6=_0x56da80[_0x7200('0xd')]&&_0x587119[_0x7200('0x17')]>0x1;var _0xd7657d=[];if(!fs['existsSync'](path['join'](_0x288d10,_0x1db0f1))&&_0x1987f6){fs[_0x7200('0x1e')](path['join'](_0x288d10,_0x1db0f1));}return BPromise[_0x7200('0x1f')](_0x587119,function(_0x3f3e92){_0xd7657d['push'](_0x3f3e92);})[_0x7200('0xf')](function(){for(var _0x4ea174=0x0;_0x4ea174<_0xd7657d[_0x7200('0x17')];_0x4ea174+=0x1){var _0x1f1ab5;var _0x496016=_0xd7657d[_0x4ea174];if(_0x1987f6){_0x1f1ab5=path[_0x7200('0x20')](_0x288d10,_0x1db0f1,util[_0x7200('0xa')]('%s%d.%s',_0x1db0f1,_0x4ea174,'csv'));}else{_0x1f1ab5=path[_0x7200('0x20')](_0x288d10,util[_0x7200('0xa')](_0x7200('0x21'),_0x1db0f1,_0x7200('0x22')));}fs[_0x7200('0x23')](_0x1f1ab5,csv(_0x496016));}})['then'](function(){if(_0x1987f6){return new Promise(function(_0x488d95){zipdir(path[_0x7200('0x20')](_0x288d10,_0x1db0f1),{'saveTo':path[_0x7200('0x20')](_0x288d10,util[_0x7200('0xa')](_0x7200('0x21'),_0x1db0f1,_0x7200('0x24')))},function(_0x59d1bd,_0x416247){rimraf(path['join'](_0x288d10,_0x1db0f1),function(){});_0x488d95(_0x7200('0x25'));});});}})[_0x7200('0xf')](function(){logger[_0x7200('0x9')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x7200('0x26'),_0x1987f6?util[_0x7200('0xa')]('%s.%s',_0x1db0f1,_0x1987f6?_0x7200('0x24'):_0x7200('0x22')):null);});})[_0x7200('0x27')](function(_0x25a38d){logger[_0x7200('0x9')](util[_0x7200('0xa')](_0x7200('0x28'),EXTRACTED_REPORT_ID,_0x7200('0xb')),util[_0x7200('0x29')](_0x25a38d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x7200('0x2a'));})[_0x7200('0x2b')](function(){process[_0x7200('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 6318803..e82aa3e 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 _0xef91=['tableHeader','pick','toString','fill','auto','body','push','chunk','keys','forEach','format','name','startDate','endDate','length','pageBreak','before','margin','landscape','\x20/\x20','Arial','num','Empty','Setting','split','then','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','existsSync','join','each','flatten','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','YYYY-MM-DD','center','Interaction\x20Transcript','header','footer','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map'];(function(_0x139790,_0x466283){var _0x23d99d=function(_0x1463c2){while(--_0x1463c2){_0x139790['push'](_0x139790['shift']());}};_0x23d99d(++_0x466283);}(_0xef91,0xf5));var _0x1ef9=function(_0x49b257,_0x2903d6){_0x49b257=_0x49b257-0x0;var _0x4ead3a=_0xef91[_0x49b257];return _0x4ead3a;};'use strict';var _=require(_0x1ef9('0x0'));var fs=require('fs');var util=require(_0x1ef9('0x1'));var path=require(_0x1ef9('0x2'));var moment=require(_0x1ef9('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x1ef9('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x1ef9('0x5'));var JSDOM=require(_0x1ef9('0x6'))[_0x1ef9('0x7')];var window=new JSDOM('')[_0x1ef9('0x8')];var BPromise=require(_0x1ef9('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1ef9('0xa'))[_0x1ef9('0xb')];var logger=require(_0x1ef9('0xc'))(_0x1ef9('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x1ef9('0xe')][0x2]);var QUERY=process[_0x1ef9('0xe')][0x3];var PATH=process[_0x1ef9('0xe')][0x4];var NAME=process[_0x1ef9('0xe')][0x5];var FORMAT=_0x1ef9('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x26d765,_0x573777){var _0x19a115={'status':_0x26d765};var _0x2cc5f3={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x573777){_0x19a115['savename']=_0x573777;}return db[_0x1ef9('0x10')][_0x1ef9('0x11')](_0x19a115,_0x2cc5f3);}function getHeaders(_0x5ec701){return _[_0x1ef9('0x12')](_0x5ec701,function(_0x1c1804){return{'text':_0x1c1804,'style':_0x1ef9('0x13')};});}function getRows(_0x4ecbe5,_0x2779cf){return _[_0x1ef9('0x12')](_0x2779cf,function(_0x3fe27b){return _(_0x3fe27b)[_0x1ef9('0x14')](_0x4ecbe5)[_0x1ef9('0x12')](function(_0x13f579){return _0x13f579?_[_0x1ef9('0x15')](_0x13f579):'';})['value']();});}function createTable(_0x1ce026,_0x46dd19){var _0x26e7be={'widths':_[_0x1ef9('0x16')](Array(_0x1ce026['length']),0x91),'heights':function(_0x1966bf){return _0x1966bf===0x0?_0x1ef9('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x248b50=getHeaders(_0x1ce026);_0x26e7be[_0x1ef9('0x18')][_0x1ef9('0x19')](_0x248b50);var _0x277cf9=getRows(_0x1ce026,_0x46dd19);_0x26e7be[_0x1ef9('0x18')]=_0x26e7be[_0x1ef9('0x18')]['concat'](_0x277cf9);return _0x26e7be;}function createTables(_0x40c7c0){var _0x406a2c=[];var _0x9852a9=_[_0x1ef9('0x1a')](Object[_0x1ef9('0x1b')](_0x40c7c0[0x0]),0x5);_0x9852a9[_0x1ef9('0x1c')](function(_0x1cd384){_0x406a2c[_0x1ef9('0x19')](createTable(_0x1cd384,_0x40c7c0));});return _0x406a2c;}function getPDFDocDefinition(_0x112f75){var _0x10381e=util[_0x1ef9('0x1d')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x1ef9('0x1e')],moment(EXTRACTED_REPORT[_0x1ef9('0x1f')])[_0x1ef9('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x1ef9('0x20')])[_0x1ef9('0x1d')](FORMAT));var _0x223aa4=[];for(var _0xb8a624=0x0;_0xb8a624<_0x112f75[_0x1ef9('0x21')];_0xb8a624++){var _0x95e47f=[];if(_0xb8a624===0x0){_0x95e47f['push']({'text':_0x10381e,'style':'header'});}var _0x5b303d={'table':_0x112f75[_0xb8a624]};if(_0xb8a624>0x0){_0x5b303d[_0x1ef9('0x22')]=_0x1ef9('0x23');_0x5b303d[_0x1ef9('0x24')]=[0x0,0x46,0x0,0x0];}_0x95e47f[_0x1ef9('0x19')](_0x5b303d);_0x223aa4[_0x1ef9('0x19')](_0x95e47f);}return{'pageSize':'A4','pageOrientation':_0x1ef9('0x25'),'content':_0x223aa4,'footer':function(_0x345adc,_0x21b184){return{'text':_0x345adc['toString']()+_0x1ef9('0x26')+_0x21b184,'style':'footer'};},'defaultStyle':{'font':_0x1ef9('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3d8a65){var _0x566e18=0x1388;var _0x44053a;if(!_0x3d8a65[0x0][_0x1ef9('0x28')]){return analyticExtractedReport(_0x1ef9('0x29'));}return db[_0x1ef9('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1ef9('0x2b'),'splitSizePdf']})['then'](function(_0x2dfda9){if(_0x2dfda9){_0x44053a=_0x2dfda9;_0x566e18=_0x44053a['splitSizePdf']||0x3e8;}})[_0x1ef9('0x2c')](function(){var _0x44da19=[];var _0x27949f=0x0;if(_0x44053a['split']){if(_0x3d8a65&&_0x3d8a65[_0x1ef9('0x21')]){var _0x4e1c1c=_['range'](_0x3d8a65[0x0]['num']/_0x566e18);var _0x2d67b5=Number['isInteger'](_0x3d8a65[0x0][_0x1ef9('0x28')]/_0x566e18)?_0x3d8a65[0x0]['num']%_0x566e18:0x0;_0x4e1c1c[_0x1ef9('0x1c')](function(_0x813a9c){if(_0x813a9c>0x0){_0x27949f+=_0x566e18;}_0x44da19[_0x1ef9('0x19')](dbH[_0x1ef9('0x2d')][_0x1ef9('0x2e')](util['format'](_0x1ef9('0x2f'),QUERY,_0x566e18,_0x27949f),{'type':dbH[_0x1ef9('0x2d')][_0x1ef9('0x30')][_0x1ef9('0x31')]}));});if(_0x2d67b5>0x0){_0x27949f+=_0x566e18;_0x44da19[_0x1ef9('0x19')](dbH[_0x1ef9('0x2d')][_0x1ef9('0x2e')](util[_0x1ef9('0x1d')](_0x1ef9('0x2f'),QUERY,_0x2d67b5,_0x27949f),{'type':dbH[_0x1ef9('0x2d')]['QueryTypes'][_0x1ef9('0x31')]}));}}}else{_0x44da19[_0x1ef9('0x19')](dbH[_0x1ef9('0x2d')][_0x1ef9('0x2e')](QUERY,{'type':dbH[_0x1ef9('0x2d')][_0x1ef9('0x30')]['SELECT']}));}var _0x312d38=path[_0x1ef9('0x32')](PATH);var _0x308163=path['basename'](PATH,'.pdf');var _0x7e768=_0x44053a[_0x1ef9('0x2b')]&&_0x44da19[_0x1ef9('0x21')]>0x1;var _0x77f6e7=[];if(!fs[_0x1ef9('0x33')](path[_0x1ef9('0x34')](_0x312d38,_0x308163))&&_0x7e768){fs['mkdirSync'](path[_0x1ef9('0x34')](_0x312d38,_0x308163));}return BPromise[_0x1ef9('0x35')](_0x44da19,function(_0x245ac6){_0x77f6e7[_0x1ef9('0x19')](_0x245ac6);})['then'](function(){var _0x2c8d2f=[];for(var _0xe5223=0x0;_0xe5223<_0x77f6e7['length'];_0xe5223+=0x1){var _0x5a930d=_0x77f6e7[_0xe5223];var _0x54e94d=createTables(_[_0x1ef9('0x36')](_0x5a930d));var _0x2e2292;var _0x26a0ef=getPDFDocDefinition(_0x54e94d);var _0x98b663=getPDFPrinter();var _0x38aa12=_0x98b663['createPdfKitDocument'](_0x26a0ef);if(_0x7e768){_0x2e2292=path[_0x1ef9('0x34')](_0x312d38,_0x308163,util['format'](_0x1ef9('0x37'),_0x308163,_0xe5223,_0x1ef9('0x38')));}else{_0x2e2292=path[_0x1ef9('0x34')](_0x312d38,util['format'](_0x1ef9('0x39'),_0x308163,_0x1ef9('0x38')));}_0x2c8d2f[_0x1ef9('0x19')](writePDFDocument(_0x38aa12,_0x2e2292));}return Promise['all'](_0x2c8d2f);})['then'](function(){if(_0x7e768){return new Promise(function(_0x3d9900){zipdir(path[_0x1ef9('0x34')](_0x312d38,_0x308163),{'saveTo':path[_0x1ef9('0x34')](_0x312d38,util[_0x1ef9('0x1d')](_0x1ef9('0x39'),_0x308163,_0x1ef9('0x3a')))},function(){rimraf(path['join'](_0x312d38,_0x308163),function(){});_0x3d9900(_0x1ef9('0x3b'));});});}})['then'](function(){if(!_0x7e768)return;rimraf(path['join'](_0x312d38,_0x308163),function(){});})[_0x1ef9('0x2c')](function(){logger['info'](util['format'](_0x1ef9('0x3c'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1ef9('0x3d'),_0x7e768?util[_0x1ef9('0x1d')]('%s.%s',_0x308163,_0x7e768?_0x1ef9('0x3a'):_0x1ef9('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1ef9('0x3e')](util[_0x1ef9('0x1d')](_0x1ef9('0x3f'),EXTRACTED_REPORT_ID,_0x1ef9('0x40')));return db[_0x1ef9('0x10')][_0x1ef9('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x1ef9('0x2c')](function(_0xa72989){EXTRACTED_REPORT=_0xa72989;return dbH[_0x1ef9('0x2d')][_0x1ef9('0x2e')](util[_0x1ef9('0x1d')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1ef9('0x2d')]['QueryTypes'][_0x1ef9('0x31')]});})[_0x1ef9('0x2c')](extractReport)[_0x1ef9('0x42')](function(_0x426ab5){logger['info'](util[_0x1ef9('0x1d')](_0x1ef9('0x43'),EXTRACTED_REPORT_ID,_0x1ef9('0x40')),util[_0x1ef9('0x44')](_0x426ab5,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1ef9('0x45'));})['finally'](function(){process[_0x1ef9('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xfd129d=new PdfPrinter({'Arial':{'normal':__dirname+_0x1ef9('0x47'),'bold':__dirname+_0x1ef9('0x48'),'italics':__dirname+_0x1ef9('0x49'),'bolditalics':__dirname+_0x1ef9('0x4a')}});return _0xfd129d;}function getPDFDocDefinitionFromHTML(_0x3435a4,_0x26383c){var _0x176a2a=util[_0x1ef9('0x1d')]('%s\x20#%d',_0x26383c[_0x1ef9('0x4b')],_0x26383c['interactionId']);var _0x138a5b=moment()[_0x1ef9('0x1d')](_0x1ef9('0x4c'))['toString']();var _0x41b4d5=htmlToPdfmake(_0x3435a4,{'window':window,'tableAutoSize':!![]});return{'content':[_0x41b4d5],'defaultStyle':{'font':_0x1ef9('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1ef9('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1ef9('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x1ef9('0x4d')}},'header':function(){return[{'text':_0x1ef9('0x4e'),'style':_0x1ef9('0x4f')}];},'footer':function(_0x1f361e,_0x3bd896){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x176a2a,_0x1f361e,_0x3bd896,_0x138a5b),'style':_0x1ef9('0x50')}];}};}function writePDFDocument(_0x1bfbd3,_0x108146){return new Promise(function(_0x254ae9,_0x3bf6ca){var _0x35fff9=_0x1bfbd3[_0x1ef9('0x51')](fs[_0x1ef9('0x52')](_0x108146));_0x35fff9['on'](_0x1ef9('0x53'),function(){_0x254ae9(_0x1ef9('0x53'));});_0x35fff9['on'](_0x1ef9('0x54'),function(_0x4796d1){_0x3bf6ca(_0x4796d1);});_0x1bfbd3[_0x1ef9('0x55')]();});}exports[_0x1ef9('0x56')]=function(_0x388043,_0x3a4767){var _0x26f42a=getPDFPrinter();var _0x38775e=getPDFDocDefinitionFromHTML(_0x388043,_0x3a4767);var _0x5ebb36=_0x26f42a[_0x1ef9('0x57')](_0x38775e);return writePDFDocument(_0x5ebb36,_0x3a4767[_0x1ef9('0x2')])[_0x1ef9('0x42')](function(_0x49b88c){throw _0x49b88c;});}; \ No newline at end of file +var _0xbd34=['rimraf','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','pick','value','fill','length','auto','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','isInteger','forEach','query','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','exit','/fonts/arial-bold.ttf','%s\x20#%d','YYYY-MM-DD','toString','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir'];(function(_0xe2bead,_0x4b30c0){var _0x47a684=function(_0x3d9bf6){while(--_0x3d9bf6){_0xe2bead['push'](_0xe2bead['shift']());}};_0x47a684(++_0x4b30c0);}(_0xbd34,0x172));var _0x4bd3=function(_0xc0f78e,_0x1847f3){_0xc0f78e=_0xc0f78e-0x0;var _0x4cc625=_0xbd34[_0xc0f78e];return _0x4cc625;};'use strict';var _=require(_0x4bd3('0x0'));var fs=require('fs');var util=require(_0x4bd3('0x1'));var path=require('path');var moment=require(_0x4bd3('0x2'));var htmlToPdfmake=require(_0x4bd3('0x3'));var PdfPrinter=require(_0x4bd3('0x4'));var zipdir=require(_0x4bd3('0x5'));var rimraf=require(_0x4bd3('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x4bd3('0x7')];var BPromise=require(_0x4bd3('0x8'));var db=require(_0x4bd3('0x9'))['db'];var dbH=require(_0x4bd3('0x9'))['dbH'];var logger=require(_0x4bd3('0xa'))(_0x4bd3('0xb'));var EXTRACTED_REPORT_ID=Number(process[_0x4bd3('0xc')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x4bd3('0xc')][0x4];var NAME=process[_0x4bd3('0xc')][0x5];var FORMAT=_0x4bd3('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x164529,_0x2fb962){var _0x2118a3={'status':_0x164529};var _0x58874e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2fb962){_0x2118a3[_0x4bd3('0xe')]=_0x2fb962;}return db[_0x4bd3('0xf')][_0x4bd3('0x10')](_0x2118a3,_0x58874e);}function getHeaders(_0x1d2b6d){return _[_0x4bd3('0x11')](_0x1d2b6d,function(_0x1c1d99){return{'text':_0x1c1d99,'style':'tableHeader'};});}function getRows(_0x32ba1f,_0x128974){return _[_0x4bd3('0x11')](_0x128974,function(_0x6a93d8){return _(_0x6a93d8)[_0x4bd3('0x12')](_0x32ba1f)[_0x4bd3('0x11')](function(_0x5342b1){return _0x5342b1?_['toString'](_0x5342b1):'';})[_0x4bd3('0x13')]();});}function createTable(_0x1398a9,_0x3e990e){var _0x1803fd={'widths':_[_0x4bd3('0x14')](Array(_0x1398a9[_0x4bd3('0x15')]),0x91),'heights':function(_0x1b161d){return _0x1b161d===0x0?_0x4bd3('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xf9a1f3=getHeaders(_0x1398a9);_0x1803fd[_0x4bd3('0x17')]['push'](_0xf9a1f3);var _0x4aa3a1=getRows(_0x1398a9,_0x3e990e);_0x1803fd[_0x4bd3('0x17')]=_0x1803fd[_0x4bd3('0x17')][_0x4bd3('0x18')](_0x4aa3a1);return _0x1803fd;}function createTables(_0x26d68a){var _0x30ceb6=[];var _0x351ebf=_[_0x4bd3('0x19')](Object[_0x4bd3('0x1a')](_0x26d68a[0x0]),0x5);_0x351ebf['forEach'](function(_0x45e3e6){_0x30ceb6[_0x4bd3('0x1b')](createTable(_0x45e3e6,_0x26d68a));});return _0x30ceb6;}function getPDFDocDefinition(_0x4997e5){var _0x355416=util[_0x4bd3('0x1c')](_0x4bd3('0x1d'),NAME,EXTRACTED_REPORT[_0x4bd3('0x1e')],moment(EXTRACTED_REPORT[_0x4bd3('0x1f')])[_0x4bd3('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x4bd3('0x20')])[_0x4bd3('0x1c')](FORMAT));var _0x362d90=[];for(var _0x6bec38=0x0;_0x6bec38<_0x4997e5[_0x4bd3('0x15')];_0x6bec38++){var _0x32f7bf=[];if(_0x6bec38===0x0){_0x32f7bf[_0x4bd3('0x1b')]({'text':_0x355416,'style':_0x4bd3('0x21')});}var _0x9f3896={'table':_0x4997e5[_0x6bec38]};if(_0x6bec38>0x0){_0x9f3896[_0x4bd3('0x22')]=_0x4bd3('0x23');_0x9f3896[_0x4bd3('0x24')]=[0x0,0x46,0x0,0x0];}_0x32f7bf[_0x4bd3('0x1b')](_0x9f3896);_0x362d90[_0x4bd3('0x1b')](_0x32f7bf);}return{'pageSize':'A4','pageOrientation':_0x4bd3('0x25'),'content':_0x362d90,'footer':function(_0x4e36f7,_0x15c617){return{'text':_0x4e36f7['toString']()+_0x4bd3('0x26')+_0x15c617,'style':_0x4bd3('0x27')};},'defaultStyle':{'font':_0x4bd3('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4bd3('0x29')},'footer':{'alignment':_0x4bd3('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xadafa7){var _0x5c6897=0x1388;var _0xd9a306;if(!_0xadafa7[0x0][_0x4bd3('0x2b')]){return analyticExtractedReport(_0x4bd3('0x2c'));}return db[_0x4bd3('0x2d')][_0x4bd3('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4bd3('0x2f'),_0x4bd3('0x30')]})[_0x4bd3('0x31')](function(_0x5622c4){if(_0x5622c4){_0xd9a306=_0x5622c4;_0x5c6897=_0xd9a306[_0x4bd3('0x30')]||0x3e8;}})[_0x4bd3('0x31')](function(){var _0x3bc023=[];var _0x5789fa=0x0;if(_0xd9a306[_0x4bd3('0x2f')]){if(_0xadafa7&&_0xadafa7[_0x4bd3('0x15')]){var _0x2b58f9=_['range'](_0xadafa7[0x0]['num']/_0x5c6897);var _0x351041=Number[_0x4bd3('0x32')](_0xadafa7[0x0][_0x4bd3('0x2b')]/_0x5c6897)?_0xadafa7[0x0][_0x4bd3('0x2b')]%_0x5c6897:0x0;_0x2b58f9[_0x4bd3('0x33')](function(_0x3d502a){if(_0x3d502a>0x0){_0x5789fa+=_0x5c6897;}_0x3bc023['push'](dbH['sequelize'][_0x4bd3('0x34')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x5c6897,_0x5789fa),{'type':dbH[_0x4bd3('0x35')][_0x4bd3('0x36')][_0x4bd3('0x37')]}));});if(_0x351041>0x0){_0x5789fa+=_0x5c6897;_0x3bc023[_0x4bd3('0x1b')](dbH[_0x4bd3('0x35')][_0x4bd3('0x34')](util[_0x4bd3('0x1c')](_0x4bd3('0x38'),QUERY,_0x351041,_0x5789fa),{'type':dbH[_0x4bd3('0x35')][_0x4bd3('0x36')]['SELECT']}));}}}else{_0x3bc023[_0x4bd3('0x1b')](dbH[_0x4bd3('0x35')][_0x4bd3('0x34')](QUERY,{'type':dbH[_0x4bd3('0x35')]['QueryTypes'][_0x4bd3('0x37')]}));}var _0x55b7a1=path[_0x4bd3('0x39')](PATH);var _0x47545d=path['basename'](PATH,_0x4bd3('0x3a'));var _0x4e0947=_0xd9a306['split']&&_0x3bc023['length']>0x1;var _0x253fef=[];if(!fs[_0x4bd3('0x3b')](path[_0x4bd3('0x3c')](_0x55b7a1,_0x47545d))&&_0x4e0947){fs[_0x4bd3('0x3d')](path[_0x4bd3('0x3c')](_0x55b7a1,_0x47545d));}return BPromise[_0x4bd3('0x3e')](_0x3bc023,function(_0x1d90a1){_0x253fef['push'](_0x1d90a1);})[_0x4bd3('0x31')](function(){var _0x21f13d=[];for(var _0x43520d=0x0;_0x43520d<_0x253fef['length'];_0x43520d+=0x1){var _0x4d9eed=_0x253fef[_0x43520d];var _0xa6dc85=createTables(_[_0x4bd3('0x3f')](_0x4d9eed));var _0x19aa92;var _0x3a8654=getPDFDocDefinition(_0xa6dc85);var _0xdf583b=getPDFPrinter();var _0x2ebf33=_0xdf583b[_0x4bd3('0x40')](_0x3a8654);if(_0x4e0947){_0x19aa92=path['join'](_0x55b7a1,_0x47545d,util[_0x4bd3('0x1c')](_0x4bd3('0x41'),_0x47545d,_0x43520d,'pdf'));}else{_0x19aa92=path[_0x4bd3('0x3c')](_0x55b7a1,util[_0x4bd3('0x1c')](_0x4bd3('0x42'),_0x47545d,'pdf'));}_0x21f13d[_0x4bd3('0x1b')](writePDFDocument(_0x2ebf33,_0x19aa92));}return Promise[_0x4bd3('0x43')](_0x21f13d);})[_0x4bd3('0x31')](function(){if(_0x4e0947){return new Promise(function(_0x3f43b9){zipdir(path[_0x4bd3('0x3c')](_0x55b7a1,_0x47545d),{'saveTo':path['join'](_0x55b7a1,util[_0x4bd3('0x1c')](_0x4bd3('0x42'),_0x47545d,_0x4bd3('0x44')))},function(){rimraf(path[_0x4bd3('0x3c')](_0x55b7a1,_0x47545d),function(){});_0x3f43b9('zip\x20finished');});});}})[_0x4bd3('0x31')](function(){if(!_0x4e0947)return;rimraf(path[_0x4bd3('0x3c')](_0x55b7a1,_0x47545d),function(){});})['then'](function(){logger[_0x4bd3('0x45')](util[_0x4bd3('0x1c')](_0x4bd3('0x46'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x4bd3('0x47'),_0x4e0947?util['format']('%s.%s',_0x47545d,_0x4e0947?'zip':_0x4bd3('0x48')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4bd3('0x45')](util[_0x4bd3('0x1c')](_0x4bd3('0x49'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x4bd3('0xf')][_0x4bd3('0x4a')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4bd3('0x31')](function(_0x1f6166){EXTRACTED_REPORT=_0x1f6166;return dbH[_0x4bd3('0x35')][_0x4bd3('0x34')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x4bd3('0x37')]});})[_0x4bd3('0x31')](extractReport)[_0x4bd3('0x4b')](function(_0x1f94f7){logger['info'](util[_0x4bd3('0x1c')](_0x4bd3('0x4c'),EXTRACTED_REPORT_ID,_0x4bd3('0x4d')),util[_0x4bd3('0x4e')](_0x1f94f7,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4bd3('0x4f'));})['finally'](function(){process[_0x4bd3('0x50')](EXIT_CODE);});}main();function getPDFPrinter(){var _0xa6ad9b=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x4bd3('0x51'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0xa6ad9b;}function getPDFDocDefinitionFromHTML(_0x247e0c,_0x45c05e){var _0x4bcb54=util['format'](_0x4bd3('0x52'),_0x45c05e['channel'],_0x45c05e['interactionId']);var _0x40b28b=moment()[_0x4bd3('0x1c')](_0x4bd3('0x53'))[_0x4bd3('0x54')]();var _0x12b2df=htmlToPdfmake(_0x247e0c,{'window':window,'tableAutoSize':!![]});return{'content':[_0x12b2df],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4bd3('0x55'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4bd3('0x55')}},'header':function(){return[{'text':_0x4bd3('0x56'),'style':_0x4bd3('0x21')}];},'footer':function(_0x4b4cd7,_0x43d280){return[{'text':util[_0x4bd3('0x1c')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x4bcb54,_0x4b4cd7,_0x43d280,_0x40b28b),'style':_0x4bd3('0x27')}];}};}function writePDFDocument(_0x45d73c,_0x197df1){return new Promise(function(_0x294925,_0x3a3bbd){var _0xa0cf4c=_0x45d73c[_0x4bd3('0x57')](fs[_0x4bd3('0x58')](_0x197df1));_0xa0cf4c['on'](_0x4bd3('0x59'),function(){_0x294925(_0x4bd3('0x59'));});_0xa0cf4c['on'](_0x4bd3('0x5a'),function(_0x231d37){_0x3a3bbd(_0x231d37);});_0x45d73c[_0x4bd3('0x5b')]();});}exports[_0x4bd3('0x5c')]=function(_0xc89252,_0x174131){var _0x32863d=getPDFPrinter();var _0x2c89f8=getPDFDocDefinitionFromHTML(_0xc89252,_0x174131);var _0x42e213=_0x32863d[_0x4bd3('0x40')](_0x2c89f8);return writePDFDocument(_0x42e213,_0x174131[_0x4bd3('0x5d')])[_0x4bd3('0x4b')](function(_0x164f62){throw _0x164f62;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 0f9257e..a1a1ad3 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 _0xcf61=['mkdirSync','%s%d.%s','xlsx','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join'];(function(_0x69dca0,_0x49dade){var _0x18dfb5=function(_0x13883c){while(--_0x13883c){_0x69dca0['push'](_0x69dca0['shift']());}};_0x18dfb5(++_0x49dade);}(_0xcf61,0xda));var _0x1cf6=function(_0x3e1c65,_0x21dbcd){_0x3e1c65=_0x3e1c65-0x0;var _0x9c0ed2=_0xcf61[_0x3e1c65];return _0x9c0ed2;};'use strict';var util=require('util');var path=require(_0x1cf6('0x0'));var _=require(_0x1cf6('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x1cf6('0x2'));var zipdir=require(_0x1cf6('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x1cf6('0x4'))[_0x1cf6('0x5')];var logger=require('../../config/logger')(_0x1cf6('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0x1cf6('0x7')][0x2]);var QUERY=process[_0x1cf6('0x7')][0x3];var PATH=process[_0x1cf6('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ddef2,_0x503b17){var _0x326181={'status':_0x2ddef2};var _0x1234d5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x503b17){_0x326181[_0x1cf6('0x8')]=_0x503b17;}return db[_0x1cf6('0x9')][_0x1cf6('0xa')](_0x326181,_0x1234d5);}function main(){var _0x1ba23d=0x1388;var _0x36aa87;logger[_0x1cf6('0xb')](util[_0x1cf6('0xc')](_0x1cf6('0xd'),EXTRACTED_REPORT_ID,_0x1cf6('0xe')));return db[_0x1cf6('0xf')][_0x1cf6('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1cf6('0x11'),_0x1cf6('0x12')]})[_0x1cf6('0x13')](function(_0x5bcf1e){if(_0x5bcf1e){_0x36aa87=_0x5bcf1e;_0x1ba23d=_0x36aa87[_0x1cf6('0x12')]||0x1388;}})[_0x1cf6('0x13')](function(){return dbH[_0x1cf6('0x14')][_0x1cf6('0x15')](util[_0x1cf6('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1cf6('0x14')][_0x1cf6('0x16')][_0x1cf6('0x17')]});})['then'](function(_0x738500){if(!_0x738500[0x0]['num']){return analyticExtractedReport(_0x1cf6('0x18'));}var _0xfcfe28=[];var _0x2271c9=0x0;if(_0x36aa87[_0x1cf6('0x11')]){if(_0x738500&&_0x738500[_0x1cf6('0x19')]){var _0x594a84=_[_0x1cf6('0x1a')](_0x738500[0x0][_0x1cf6('0x1b')]/_0x1ba23d);var _0x797a95=Number[_0x1cf6('0x1c')](_0x738500[0x0][_0x1cf6('0x1b')]/_0x1ba23d)?_0x738500[0x0][_0x1cf6('0x1b')]%_0x1ba23d:0x0;_0x594a84[_0x1cf6('0x1d')](function(_0x2e6fa2){if(_0x2e6fa2>0x0){_0x2271c9+=_0x1ba23d;}_0xfcfe28['push'](dbH[_0x1cf6('0x14')][_0x1cf6('0x15')](util[_0x1cf6('0xc')](_0x1cf6('0x1e'),QUERY,_0x1ba23d,_0x2271c9),{'type':dbH[_0x1cf6('0x14')][_0x1cf6('0x16')][_0x1cf6('0x17')]}));});if(_0x797a95>0x0){_0x2271c9+=_0x1ba23d;_0xfcfe28[_0x1cf6('0x1f')](dbH[_0x1cf6('0x14')]['query'](util[_0x1cf6('0xc')](_0x1cf6('0x1e'),QUERY,_0x797a95,_0x2271c9),{'type':dbH[_0x1cf6('0x14')][_0x1cf6('0x16')][_0x1cf6('0x17')]}));}}}else{_0xfcfe28[_0x1cf6('0x1f')](dbH[_0x1cf6('0x14')][_0x1cf6('0x15')](QUERY,{'type':dbH[_0x1cf6('0x14')][_0x1cf6('0x16')][_0x1cf6('0x17')]}));}var _0x5333bc=path[_0x1cf6('0x20')](PATH);var _0x5519bb=path[_0x1cf6('0x21')](PATH,_0x1cf6('0x22'));var _0x10292d=_0x36aa87[_0x1cf6('0x11')]&&_0xfcfe28['length']>0x1;var _0x2183f9=[];if(!fs[_0x1cf6('0x23')](path[_0x1cf6('0x24')](_0x5333bc,_0x5519bb))&&_0x10292d){fs[_0x1cf6('0x25')](path['join'](_0x5333bc,_0x5519bb));}return BPromise['each'](_0xfcfe28,function(_0x43c62a){_0x2183f9['push'](_0x43c62a);})[_0x1cf6('0x13')](function(){for(var _0x2b2d98=0x0;_0x2b2d98<_0x2183f9['length'];_0x2b2d98+=0x1){var _0x4ded2c;var _0x354722=_0x2183f9[_0x2b2d98];if(_0x10292d){_0x4ded2c=path[_0x1cf6('0x24')](_0x5333bc,_0x5519bb,util[_0x1cf6('0xc')](_0x1cf6('0x26'),_0x5519bb,_0x2b2d98,_0x1cf6('0x27')));}else{_0x4ded2c=path[_0x1cf6('0x24')](_0x5333bc,util[_0x1cf6('0xc')](_0x1cf6('0x28'),_0x5519bb,_0x1cf6('0x27')));}fs[_0x1cf6('0x29')](_0x4ded2c,json2xls(_0x354722),'binary');}})[_0x1cf6('0x13')](function(){if(_0x10292d){return new Promise(function(_0xa8c02a){zipdir(path['join'](_0x5333bc,_0x5519bb),{'saveTo':path['join'](_0x5333bc,util[_0x1cf6('0xc')](_0x1cf6('0x28'),_0x5519bb,_0x1cf6('0x2a')))},function(_0xcf92b6,_0x2c545){rimraf(path[_0x1cf6('0x24')](_0x5333bc,_0x5519bb),function(){});_0xa8c02a('zip\x20finished');});});}})[_0x1cf6('0x13')](function(){logger[_0x1cf6('0xb')](util[_0x1cf6('0xc')](_0x1cf6('0x2b'),EXTRACTED_REPORT_ID,_0x1cf6('0xe')));return analyticExtractedReport(_0x1cf6('0x2c'),_0x10292d?util[_0x1cf6('0xc')](_0x1cf6('0x28'),_0x5519bb,_0x10292d?_0x1cf6('0x2a'):_0x1cf6('0x27')):null);});})[_0x1cf6('0x2d')](function(_0x3c4d08){logger['info'](util[_0x1cf6('0xc')](_0x1cf6('0x2e'),EXTRACTED_REPORT_ID,_0x1cf6('0xe')),util[_0x1cf6('0x2f')](_0x3c4d08,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1cf6('0x30'));})[_0x1cf6('0x31')](function(){process[_0x1cf6('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xa30f=['query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','each','%s%d.%s','%s.%s','xlsx','writeFileSync','binary','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','format','Setting','find','split','splitSizeXlsx','then','sequelize'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa30f,0xb8));var _0xfa30=function(_0x3a826b,_0x4d1404){_0x3a826b=_0x3a826b-0x0;var _0x20d2e9=_0xa30f[_0x3a826b];return _0x20d2e9;};'use strict';var util=require(_0xfa30('0x0'));var path=require('path');var _=require(_0xfa30('0x1'));var fs=require('fs');var json2xls=require(_0xfa30('0x2'));var BPromise=require(_0xfa30('0x3'));var zipdir=require(_0xfa30('0x4'));var rimraf=require(_0xfa30('0x5'));var db=require(_0xfa30('0x6'))['db'];var dbH=require('../../mysqldb')[_0xfa30('0x7')];var logger=require('../../config/logger')(_0xfa30('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xfa30('0x9')][0x2]);var QUERY=process[_0xfa30('0x9')][0x3];var PATH=process[_0xfa30('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2769e2,_0x1fd3df){var _0x4c21f1={'status':_0x2769e2};var _0x313f5c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1fd3df){_0x4c21f1[_0xfa30('0xa')]=_0x1fd3df;}return db[_0xfa30('0xb')][_0xfa30('0xc')](_0x4c21f1,_0x313f5c);}function main(){var _0x47f50a=0x1388;var _0x28f747;logger['info'](util[_0xfa30('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0xfa30('0xe')][_0xfa30('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfa30('0x10'),_0xfa30('0x11')]})[_0xfa30('0x12')](function(_0x14f27b){if(_0x14f27b){_0x28f747=_0x14f27b;_0x47f50a=_0x28f747[_0xfa30('0x11')]||0x1388;}})[_0xfa30('0x12')](function(){return dbH[_0xfa30('0x13')][_0xfa30('0x14')](util['format'](_0xfa30('0x15'),QUERY),{'type':dbH[_0xfa30('0x13')]['QueryTypes'][_0xfa30('0x16')]});})[_0xfa30('0x12')](function(_0x556543){if(!_0x556543[0x0][_0xfa30('0x17')]){return analyticExtractedReport(_0xfa30('0x18'));}var _0x4b8bc3=[];var _0x1a616d=0x0;if(_0x28f747['split']){if(_0x556543&&_0x556543[_0xfa30('0x19')]){var _0x1159ac=_[_0xfa30('0x1a')](_0x556543[0x0][_0xfa30('0x17')]/_0x47f50a);var _0x5596a3=Number[_0xfa30('0x1b')](_0x556543[0x0][_0xfa30('0x17')]/_0x47f50a)?_0x556543[0x0][_0xfa30('0x17')]%_0x47f50a:0x0;_0x1159ac['forEach'](function(_0x13468e){if(_0x13468e>0x0){_0x1a616d+=_0x47f50a;}_0x4b8bc3['push'](dbH['sequelize'][_0xfa30('0x14')](util[_0xfa30('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x47f50a,_0x1a616d),{'type':dbH['sequelize'][_0xfa30('0x1c')]['SELECT']}));});if(_0x5596a3>0x0){_0x1a616d+=_0x47f50a;_0x4b8bc3[_0xfa30('0x1d')](dbH[_0xfa30('0x13')][_0xfa30('0x14')](util[_0xfa30('0xd')](_0xfa30('0x1e'),QUERY,_0x5596a3,_0x1a616d),{'type':dbH[_0xfa30('0x13')][_0xfa30('0x1c')]['SELECT']}));}}}else{_0x4b8bc3['push'](dbH[_0xfa30('0x13')][_0xfa30('0x14')](QUERY,{'type':dbH[_0xfa30('0x13')][_0xfa30('0x1c')][_0xfa30('0x16')]}));}var _0x328839=path[_0xfa30('0x1f')](PATH);var _0x5107e6=path[_0xfa30('0x20')](PATH,_0xfa30('0x21'));var _0x278312=_0x28f747[_0xfa30('0x10')]&&_0x4b8bc3['length']>0x1;var _0x36c39e=[];if(!fs[_0xfa30('0x22')](path[_0xfa30('0x23')](_0x328839,_0x5107e6))&&_0x278312){fs['mkdirSync'](path['join'](_0x328839,_0x5107e6));}return BPromise[_0xfa30('0x24')](_0x4b8bc3,function(_0x5ba087){_0x36c39e['push'](_0x5ba087);})['then'](function(){for(var _0x106bc2=0x0;_0x106bc2<_0x36c39e[_0xfa30('0x19')];_0x106bc2+=0x1){var _0x1303e8;var _0x2dbfd6=_0x36c39e[_0x106bc2];if(_0x278312){_0x1303e8=path[_0xfa30('0x23')](_0x328839,_0x5107e6,util[_0xfa30('0xd')](_0xfa30('0x25'),_0x5107e6,_0x106bc2,'xlsx'));}else{_0x1303e8=path[_0xfa30('0x23')](_0x328839,util[_0xfa30('0xd')](_0xfa30('0x26'),_0x5107e6,_0xfa30('0x27')));}fs[_0xfa30('0x28')](_0x1303e8,json2xls(_0x2dbfd6),_0xfa30('0x29'));}})[_0xfa30('0x12')](function(){if(_0x278312){return new Promise(function(_0x2a45e9){zipdir(path[_0xfa30('0x23')](_0x328839,_0x5107e6),{'saveTo':path[_0xfa30('0x23')](_0x328839,util['format'](_0xfa30('0x26'),_0x5107e6,_0xfa30('0x2a')))},function(_0x1ca185,_0x17ce0b){rimraf(path[_0xfa30('0x23')](_0x328839,_0x5107e6),function(){});_0x2a45e9(_0xfa30('0x2b'));});});}})[_0xfa30('0x12')](function(){logger[_0xfa30('0x2c')](util[_0xfa30('0xd')](_0xfa30('0x2d'),EXTRACTED_REPORT_ID,_0xfa30('0x2e')));return analyticExtractedReport('Completed',_0x278312?util[_0xfa30('0xd')](_0xfa30('0x26'),_0x5107e6,_0x278312?'zip':_0xfa30('0x27')):null);});})[_0xfa30('0x2f')](function(_0x14d30c){logger[_0xfa30('0x2c')](util[_0xfa30('0xd')](_0xfa30('0x30'),EXTRACTED_REPORT_ID,_0xfa30('0x2e')),util['inspect'](_0x14d30c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xfa30('0x31')](function(){process[_0xfa30('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 06e78a9..ce2c016 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 _0x90a2=['filter','groupBy','exten','queue','playback','hasOwnProperty','priority','extensions','extension','find','type','Set','format','context','VoiceExtensionId','inbound','push','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','):Goto(','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','catch','util','models','Interval','findAll','intervals','VoiceExtension','IntervalId','then','uniq'];(function(_0x24759a,_0x1ba302){var _0x5c622f=function(_0x438923){while(--_0x438923){_0x24759a['push'](_0x24759a['shift']());}};_0x5c622f(++_0x1ba302);}(_0x90a2,0x79));var _0x290a=function(_0x1e40e9,_0x16cc7a){_0x1e40e9=_0x1e40e9-0x0;var _0x3d3cbc=_0x90a2[_0x1e40e9];return _0x3d3cbc;};'use strict';var _=require('lodash');var util=require(_0x290a('0x0'));function rewrite(_0x4a89b3,_0xb72abc){var _0x254455=this;return _0x4a89b3[_0x290a('0x1')][_0x290a('0x2')][_0x290a('0x3')]({'raw':!![]})['then'](function(_0x40a534){_0x254455[_0x290a('0x4')]=_0x40a534;return _0x4a89b3['models'][_0x290a('0x5')][_0x290a('0x3')]({'where':{'IntervalId':_0xb72abc[_0x290a('0x6')]},'raw':!![]});})[_0x290a('0x7')](function(_0x252668){return _0x4a89b3[_0x290a('0x1')]['VoiceExtension'][_0x290a('0x3')]({'where':{'exten':{'$in':_[_0x290a('0x8')](_['map'](_0x252668,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x290a('0x7')](function(_0x7d5ab2){var _0x40ec54=_['filter'](_0x7d5ab2,{'priority':'1'});var _0x4340a4=_[_0x290a('0x9')](_0x7d5ab2,{'isApp':0x1});var _0x56ec30=_[_0x290a('0xa')](_0x4340a4,_0x290a('0xb'));var _0xc53921=[_0x290a('0xc'),_0x290a('0xd')];var _0x1b686b=[];var _0x1133dc=[];for(var _0x54c861 in _0x56ec30){if(_0x56ec30[_0x290a('0xe')](_0x54c861)){_0x254455[_0x290a('0xf')]=0x2;_0x254455[_0x290a('0x10')]=[];_0x254455[_0x290a('0x11')]=_[_0x290a('0x12')](_0x40ec54,{'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')]});_0x254455['extensions']['push']({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':util[_0x290a('0x15')]('CDR(type)=%s',_0x56ec30[_0x54c861][0x0][_0x290a('0x13')]),'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});if(_0x56ec30[_0x54c861][0x0][_0x290a('0x13')]===_0x290a('0x18')){_0x254455['extensions'][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':_0x290a('0x1a')+_0x56ec30[_0x54c861][0x0][_0x290a('0x17')],'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});}else if(_0x56ec30[_0x54c861][0x0][_0x290a('0x13')]===_0x290a('0x1b')){if(_0x254455['extension']){_0x254455[_0x290a('0x10')][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':_0x290a('0x1c')+(_0x254455['extension']['cutdigits']?_0x290a('0x1d')+_0x254455[_0x290a('0x11')][_0x290a('0x1e')]+'}':'${EXTEN}'),'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0]['VoiceExtensionId']});}_0x254455[_0x290a('0x10')]['push']({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':_0x290a('0x1a')+_0x56ec30[_0x54c861][0x0]['VoiceExtensionId'],'context':_0x56ec30[_0x54c861][0x0]['context'],'exten':_0x56ec30[_0x54c861][0x0]['exten'],'priority':_0x254455['priority']++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});var _0x2f716a=_0x254455[_0x290a('0xf')]++;_0x254455[_0x290a('0x10')]['push']({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x2f716a+0x2)+_0x290a('0x20')+(_0x2f716a+0x1)+')','context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x2f716a,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0]['VoiceExtensionId']});if(_0x254455[_0x290a('0x11')]){_0x254455['extensions'][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':_0x254455[_0x290a('0x11')][_0x290a('0x1e')]?'CDR(prefix)=${EXTEN:0:'+_0x254455[_0x290a('0x11')][_0x290a('0x1e')]+'}':_0x290a('0x21'),'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0]['VoiceExtensionId']});}_0x254455[_0x290a('0x10')][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':_0x290a('0x22')+_0x56ec30[_0x54c861][0x0][_0x290a('0x17')],'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});if(_0x254455[_0x290a('0x11')]&&_0x254455[_0x290a('0x11')][_0x290a('0xe')](_0x290a('0x23'))&&_0x254455[_0x290a('0x11')]['recordingFormat']!==_0x290a('0x24')){_0x254455['extensions'][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0]['type'],'app':_0x290a('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});_0x254455['extensions'][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':_0x290a('0x25')+_0x254455['extension'][_0x290a('0x23')]||_0x290a('0x26'),'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455['priority']++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});}}_0x254455[_0x290a('0x10')]['push']({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':_0x290a('0x27'),'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});_0x254455[_0x290a('0x10')][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});_0x254455[_0x290a('0x10')][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0]['type'],'app':_0x290a('0x14'),'appdata':_0x290a('0x28'),'context':_0x56ec30[_0x54c861][0x0]['context'],'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'priority':_0x254455[_0x290a('0xf')]++,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0]['VoiceExtensionId']});for(var _0x3e87a5=0x0,_0x281638=0x0;_0x3e87a5<_0x56ec30[_0x54c861][_0x290a('0x29')];_0x3e87a5+=0x1,_0x281638=0x0){var _0x48cd65=_0x56ec30[_0x54c861][_0x3e87a5];if(_0x48cd65[_0x290a('0x13')]){_0x48cd65[_0x290a('0x13')]=_0x48cd65[_0x290a('0x13')][_0x290a('0x2a')]();}var _0x53a16d=[];var _0x260307=[];delete _0x48cd65['id'];delete _0x48cd65[_0x290a('0x2b')];delete _0x48cd65[_0x290a('0x2c')];var _0x34bff5=_0x48cd65['interval']!=='*,*,*,*'?[_0x48cd65[_0x290a('0x2d')]]:_0x48cd65[_0x290a('0x6')]?_[_0x290a('0x2e')](_[_0x290a('0x9')](_0x254455[_0x290a('0x4')],{'IntervalId':_0x48cd65[_0x290a('0x6')]}),_0x290a('0x2d')):[];if(_0x48cd65[_0x290a('0xe')](_0x290a('0x2f'))){if(_0x48cd65['tag']&&_0x48cd65[_0x290a('0x2f')]!=='--'){_0x53a16d[_0x290a('0x19')]({'type':_0x48cd65['type'],'app':_0x290a('0x14'),'appdata':_0x290a('0x30')+_0x48cd65['tag'],'context':_0x48cd65['context'],'exten':_0x48cd65[_0x290a('0xb')],'priority':_0x34bff5[_0x290a('0x29')]+_0x254455[_0x290a('0xf')]+_0x281638++,'VoiceExtensionId':_0x48cd65[_0x290a('0x17')]});}}if(_0x48cd65[_0x290a('0x13')]==='outbound'&&_0x48cd65['hasOwnProperty'](_0x290a('0x31'))){if(_0x48cd65[_0x290a('0x31')]){_0x53a16d[_0x290a('0x19')]({'type':_0x48cd65[_0x290a('0x13')],'app':'ExecIf','appdata':_0x290a('0x32')+_0x48cd65[_0x290a('0x31')]+')','context':_0x48cd65['context'],'exten':_0x48cd65[_0x290a('0xb')],'priority':_0x34bff5['length']+_0x254455['priority']+_0x281638++,'VoiceExtensionId':_0x48cd65['VoiceExtensionId']});}else{_0x53a16d[_0x290a('0x19')]({'type':_0x48cd65[_0x290a('0x13')],'app':_0x290a('0x1f'),'appdata':_0x290a('0x33'),'context':_0x48cd65[_0x290a('0x16')],'exten':_0x48cd65[_0x290a('0xb')],'priority':_0x34bff5['length']+_0x254455[_0x290a('0xf')]+_0x281638++,'VoiceExtensionId':_0x48cd65['VoiceExtensionId']});}}if(_0x48cd65['hasOwnProperty']('answer')){if(_0xc53921[_0x290a('0x34')](_0x48cd65[_0x290a('0x35')][_0x290a('0x2a')]())>=0x0&&_0x48cd65[_0x290a('0x36')]!==_0x290a('0x37')){if(_0x48cd65[_0x290a('0x38')]){_0x53a16d[_0x290a('0x19')]({'type':_0x48cd65[_0x290a('0x13')],'app':_0x290a('0x1f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x48cd65['context'],'exten':_0x48cd65[_0x290a('0xb')],'priority':_0x34bff5[_0x290a('0x29')]+_0x254455[_0x290a('0xf')]+_0x281638++,'VoiceExtensionId':_0x48cd65['VoiceExtensionId']});_0x53a16d[_0x290a('0x19')]({'type':_0x48cd65['type'],'app':_0x290a('0x14'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x48cd65['context'],'exten':_0x48cd65[_0x290a('0xb')],'priority':_0x34bff5['length']+_0x254455[_0x290a('0xf')]+_0x281638++,'VoiceExtensionId':_0x48cd65['VoiceExtensionId']});}else{_0x53a16d[_0x290a('0x19')]({'type':_0x48cd65[_0x290a('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x48cd65['context'],'exten':_0x48cd65['exten'],'priority':_0x34bff5[_0x290a('0x29')]+_0x254455[_0x290a('0xf')]+_0x281638++,'VoiceExtensionId':_0x48cd65['VoiceExtensionId']});_0x53a16d[_0x290a('0x19')]({'type':_0x48cd65[_0x290a('0x13')],'app':_0x290a('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x48cd65['context'],'exten':_0x48cd65[_0x290a('0xb')],'priority':_0x34bff5[_0x290a('0x29')]+_0x254455[_0x290a('0xf')]+_0x281638++,'VoiceExtensionId':_0x48cd65[_0x290a('0x17')]});}}}for(var _0x3c3e95=0x0;_0x3c3e95<_0x34bff5['length'];_0x3c3e95+=0x1){var _0x2c62c7=_0x254455[_0x290a('0xf')]+_0x34bff5['length'];var _0x3ea005=_0x3c3e95===_0x34bff5[_0x290a('0x29')]-0x1?_0x254455[_0x290a('0xf')]+_0x53a16d['length']+_0x260307[_0x290a('0x29')]+0x2:_0x254455['priority']+_0x3c3e95+0x1;_0x53a16d['splice'](_0x3c3e95,0x0,{'type':_0x48cd65['type'],'app':_0x290a('0x39'),'appdata':_0x34bff5[_0x3c3e95]+'?'+_0x48cd65[_0x290a('0x16')]+_0x290a('0x3a')+_0x2c62c7+':'+_0x48cd65[_0x290a('0x16')]+',${EXTEN},'+_0x3ea005,'exten':_0x48cd65[_0x290a('0xb')],'context':_0x48cd65[_0x290a('0x16')],'priority':_0x254455[_0x290a('0xf')]+_0x3c3e95,'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});}_0x48cd65['priority']=_0x53a16d['length']?_[_0x290a('0x3b')](_0x53a16d)[_0x290a('0xf')]+0x1:_0x254455[_0x290a('0xf')];_0x254455[_0x290a('0xf')]=(_0x260307[_0x290a('0x29')]?_[_0x290a('0x3b')](_0x260307)['priority']:_0x48cd65[_0x290a('0xf')])+0x1;_0x254455[_0x290a('0x10')]=_['concat'](_0x254455[_0x290a('0x10')],_0x53a16d,[_0x48cd65],_0x260307);}_0x254455['extensions'][_0x290a('0x19')]({'type':_0x56ec30[_0x54c861][0x0][_0x290a('0x13')],'app':_0x290a('0x3c'),'exten':_0x56ec30[_0x54c861][0x0][_0x290a('0xb')],'context':_0x56ec30[_0x54c861][0x0][_0x290a('0x16')],'priority':_0x254455[_0x290a('0xf')],'VoiceExtensionId':_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]});_0x1b686b['push'](_0x56ec30[_0x54c861][0x0][_0x290a('0x17')]);_0x1133dc=_[_0x290a('0x3d')](_0x1133dc,_0x254455[_0x290a('0x10')]);}}return _0x4a89b3['transaction'](function(_0x46c934){return _0x4a89b3['models']['VoiceExtension'][_0x290a('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1b686b}},'transaction':_0x46c934})[_0x290a('0x7')](function(_0x52749f){return _0x4a89b3['models'][_0x290a('0x5')][_0x290a('0x3f')](_['sortBy'](_0x1133dc,_0x290a('0xf')),{'transaction':_0x46c934});});});})[_0x290a('0x40')](function(_0x107732){console['error'](_0x107732);});}exports['rewrite']=rewrite; \ No newline at end of file +var _0x7d32=['XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','priority','extensions','extension','format','type','context','inbound','push','Set','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','IntervalId','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d32,0x1d4));var _0x27d3=function(_0x959488,_0x1a944d){_0x959488=_0x959488-0x0;var _0x4a4308=_0x7d32[_0x959488];return _0x4a4308;};'use strict';var _=require(_0x27d3('0x0'));var util=require('util');function rewrite(_0x4c740c,_0x40e4e9){var _0x13b5af=this;return _0x4c740c[_0x27d3('0x1')][_0x27d3('0x2')][_0x27d3('0x3')]({'raw':!![]})[_0x27d3('0x4')](function(_0x30fc60){_0x13b5af[_0x27d3('0x5')]=_0x30fc60;return _0x4c740c[_0x27d3('0x1')]['VoiceExtension'][_0x27d3('0x3')]({'where':{'IntervalId':_0x40e4e9['IntervalId']},'raw':!![]});})['then'](function(_0x7bbf8e){return _0x4c740c[_0x27d3('0x1')][_0x27d3('0x6')]['findAll']({'where':{'exten':{'$in':_['uniq'](_[_0x27d3('0x7')](_0x7bbf8e,_0x27d3('0x8')))}},'order':[{'raw':_0x27d3('0x9')}],'raw':!![]});})[_0x27d3('0x4')](function(_0x4d5dad){var _0x3d86c6=_['filter'](_0x4d5dad,{'priority':'1'});var _0x55309c=_[_0x27d3('0xa')](_0x4d5dad,{'isApp':0x1});var _0x114fe2=_[_0x27d3('0xb')](_0x55309c,_0x27d3('0x8'));var _0x5bee22=[_0x27d3('0xc'),'playback'];var _0x26bd30=[];var _0x49c1e7=[];for(var _0xe6db3b in _0x114fe2){if(_0x114fe2[_0x27d3('0xd')](_0xe6db3b)){_0x13b5af[_0x27d3('0xe')]=0x2;_0x13b5af[_0x27d3('0xf')]=[];_0x13b5af[_0x27d3('0x10')]=_['find'](_0x3d86c6,{'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')]});_0x13b5af[_0x27d3('0xf')]['push']({'type':_0x114fe2[_0xe6db3b][0x0]['type'],'app':'Set','appdata':util[_0x27d3('0x11')]('CDR(type)=%s',_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')]),'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0]['exten'],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0]['VoiceExtensionId']});if(_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')]===_0x27d3('0x14')){_0x13b5af[_0x27d3('0xf')][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':_0x27d3('0x16'),'appdata':_0x27d3('0x17')+_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')],'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});}else if(_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')]===_0x27d3('0x19')){if(_0x13b5af['extension']){_0x13b5af['extensions'][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':_0x27d3('0x16'),'appdata':_0x27d3('0x1a')+(_0x13b5af[_0x27d3('0x10')][_0x27d3('0x1b')]?_0x27d3('0x1c')+_0x13b5af[_0x27d3('0x10')][_0x27d3('0x1b')]+'}':_0x27d3('0x1d')),'context':_0x114fe2[_0xe6db3b][0x0]['context'],'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0]['VoiceExtensionId']});}_0x13b5af['extensions']['push']({'type':_0x114fe2[_0xe6db3b][0x0]['type'],'app':_0x27d3('0x16'),'appdata':_0x27d3('0x17')+_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')],'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});var _0x4f5ce2=_0x13b5af[_0x27d3('0xe')]++;_0x13b5af['extensions'][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0]['type'],'app':_0x27d3('0x1e'),'appdata':_0x27d3('0x1f')+(_0x4f5ce2+0x2)+_0x27d3('0x20')+(_0x4f5ce2+0x1)+')','context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')],'priority':_0x4f5ce2,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});if(_0x13b5af[_0x27d3('0x10')]){_0x13b5af[_0x27d3('0xf')][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':_0x27d3('0x16'),'appdata':_0x13b5af[_0x27d3('0x10')][_0x27d3('0x1b')]?_0x27d3('0x21')+_0x13b5af['extension']['cutdigits']+'}':'CDR(prefix)=noprefix','context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});}_0x13b5af['extensions'][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':_0x27d3('0x16'),'appdata':'outboundrouteid='+_0x114fe2[_0xe6db3b][0x0]['VoiceExtensionId'],'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0]['exten'],'priority':_0x13b5af['priority']++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});if(_0x13b5af[_0x27d3('0x10')]&&_0x13b5af[_0x27d3('0x10')][_0x27d3('0xd')](_0x27d3('0x22'))&&_0x13b5af[_0x27d3('0x10')]['recordingFormat']!=='none'){_0x13b5af['extensions'][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':'Set','appdata':_0x27d3('0x23'),'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});_0x13b5af[_0x27d3('0xf')]['push']({'type':_0x114fe2[_0xe6db3b][0x0]['type'],'app':_0x27d3('0x16'),'appdata':_0x27d3('0x24')+_0x13b5af[_0x27d3('0x10')][_0x27d3('0x22')]||'wav','context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x8')],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});}}_0x13b5af[_0x27d3('0xf')][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':'Set','appdata':_0x27d3('0x25'),'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0]['exten'],'priority':_0x13b5af[_0x27d3('0xe')]++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});_0x13b5af[_0x27d3('0xf')][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0]['type'],'app':_0x27d3('0x16'),'appdata':_0x27d3('0x26'),'context':_0x114fe2[_0xe6db3b][0x0]['context'],'exten':_0x114fe2[_0xe6db3b][0x0]['exten'],'priority':_0x13b5af['priority']++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});_0x13b5af[_0x27d3('0xf')][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':_0x27d3('0x16'),'appdata':_0x27d3('0x27'),'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'exten':_0x114fe2[_0xe6db3b][0x0]['exten'],'priority':_0x13b5af['priority']++,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});for(var _0x943e78=0x0,_0x1179ee=0x0;_0x943e78<_0x114fe2[_0xe6db3b][_0x27d3('0x28')];_0x943e78+=0x1,_0x1179ee=0x0){var _0x52bc40=_0x114fe2[_0xe6db3b][_0x943e78];if(_0x52bc40['type']){_0x52bc40[_0x27d3('0x12')]=_0x52bc40[_0x27d3('0x12')][_0x27d3('0x29')]();}var _0x28b7f3=[];var _0x5b7983=[];delete _0x52bc40['id'];delete _0x52bc40['createdAt'];delete _0x52bc40[_0x27d3('0x2a')];var _0x1e6488=_0x52bc40[_0x27d3('0x2b')]!=='*,*,*,*'?[_0x52bc40[_0x27d3('0x2b')]]:_0x52bc40[_0x27d3('0x2c')]?_[_0x27d3('0x7')](_[_0x27d3('0xa')](_0x13b5af[_0x27d3('0x5')],{'IntervalId':_0x52bc40[_0x27d3('0x2c')]}),_0x27d3('0x2b')):[];if(_0x52bc40[_0x27d3('0xd')](_0x27d3('0x2d'))){if(_0x52bc40[_0x27d3('0x2d')]&&_0x52bc40[_0x27d3('0x2d')]!=='--'){_0x28b7f3[_0x27d3('0x15')]({'type':_0x52bc40[_0x27d3('0x12')],'app':_0x27d3('0x16'),'appdata':'CDR(tag)='+_0x52bc40['tag'],'context':_0x52bc40[_0x27d3('0x13')],'exten':_0x52bc40[_0x27d3('0x8')],'priority':_0x1e6488[_0x27d3('0x28')]+_0x13b5af[_0x27d3('0xe')]+_0x1179ee++,'VoiceExtensionId':_0x52bc40[_0x27d3('0x18')]});}}if(_0x52bc40[_0x27d3('0x12')]===_0x27d3('0x19')&&_0x52bc40[_0x27d3('0xd')]('callerID')){if(_0x52bc40[_0x27d3('0x2e')]){_0x28b7f3['push']({'type':_0x52bc40[_0x27d3('0x12')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x52bc40[_0x27d3('0x2e')]+')','context':_0x52bc40[_0x27d3('0x13')],'exten':_0x52bc40[_0x27d3('0x8')],'priority':_0x1e6488[_0x27d3('0x28')]+_0x13b5af['priority']+_0x1179ee++,'VoiceExtensionId':_0x52bc40['VoiceExtensionId']});}else{_0x28b7f3[_0x27d3('0x15')]({'type':_0x52bc40[_0x27d3('0x12')],'app':_0x27d3('0x1e'),'appdata':_0x27d3('0x2f'),'context':_0x52bc40['context'],'exten':_0x52bc40[_0x27d3('0x8')],'priority':_0x1e6488['length']+_0x13b5af['priority']+_0x1179ee++,'VoiceExtensionId':_0x52bc40['VoiceExtensionId']});}}if(_0x52bc40['hasOwnProperty'](_0x27d3('0x30'))){if(_0x5bee22[_0x27d3('0x31')](_0x52bc40[_0x27d3('0x32')][_0x27d3('0x29')]())>=0x0&&_0x52bc40[_0x27d3('0x33')]!=='custom'){if(_0x52bc40[_0x27d3('0x30')]){_0x28b7f3[_0x27d3('0x15')]({'type':_0x52bc40[_0x27d3('0x12')],'app':_0x27d3('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x52bc40[_0x27d3('0x13')],'exten':_0x52bc40['exten'],'priority':_0x1e6488[_0x27d3('0x28')]+_0x13b5af[_0x27d3('0xe')]+_0x1179ee++,'VoiceExtensionId':_0x52bc40[_0x27d3('0x18')]});_0x28b7f3[_0x27d3('0x15')]({'type':_0x52bc40[_0x27d3('0x12')],'app':_0x27d3('0x16'),'appdata':_0x27d3('0x34'),'context':_0x52bc40[_0x27d3('0x13')],'exten':_0x52bc40[_0x27d3('0x8')],'priority':_0x1e6488['length']+_0x13b5af[_0x27d3('0xe')]+_0x1179ee++,'VoiceExtensionId':_0x52bc40['VoiceExtensionId']});}else{_0x28b7f3['push']({'type':_0x52bc40[_0x27d3('0x12')],'app':'ExecIf','appdata':_0x27d3('0x35'),'context':_0x52bc40['context'],'exten':_0x52bc40[_0x27d3('0x8')],'priority':_0x1e6488[_0x27d3('0x28')]+_0x13b5af['priority']+_0x1179ee++,'VoiceExtensionId':_0x52bc40[_0x27d3('0x18')]});_0x28b7f3[_0x27d3('0x15')]({'type':_0x52bc40['type'],'app':'Set','appdata':_0x27d3('0x36'),'context':_0x52bc40[_0x27d3('0x13')],'exten':_0x52bc40[_0x27d3('0x8')],'priority':_0x1e6488[_0x27d3('0x28')]+_0x13b5af['priority']+_0x1179ee++,'VoiceExtensionId':_0x52bc40['VoiceExtensionId']});}}}for(var _0x398c90=0x0;_0x398c90<_0x1e6488[_0x27d3('0x28')];_0x398c90+=0x1){var _0x36cf04=_0x13b5af['priority']+_0x1e6488['length'];var _0x1d4eb4=_0x398c90===_0x1e6488[_0x27d3('0x28')]-0x1?_0x13b5af['priority']+_0x28b7f3[_0x27d3('0x28')]+_0x5b7983[_0x27d3('0x28')]+0x2:_0x13b5af['priority']+_0x398c90+0x1;_0x28b7f3[_0x27d3('0x37')](_0x398c90,0x0,{'type':_0x52bc40[_0x27d3('0x12')],'app':_0x27d3('0x38'),'appdata':_0x1e6488[_0x398c90]+'?'+_0x52bc40[_0x27d3('0x13')]+_0x27d3('0x39')+_0x36cf04+':'+_0x52bc40[_0x27d3('0x13')]+_0x27d3('0x39')+_0x1d4eb4,'exten':_0x52bc40[_0x27d3('0x8')],'context':_0x52bc40['context'],'priority':_0x13b5af[_0x27d3('0xe')]+_0x398c90,'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});}_0x52bc40[_0x27d3('0xe')]=_0x28b7f3[_0x27d3('0x28')]?_[_0x27d3('0x3a')](_0x28b7f3)['priority']+0x1:_0x13b5af[_0x27d3('0xe')];_0x13b5af[_0x27d3('0xe')]=(_0x5b7983[_0x27d3('0x28')]?_[_0x27d3('0x3a')](_0x5b7983)[_0x27d3('0xe')]:_0x52bc40['priority'])+0x1;_0x13b5af['extensions']=_[_0x27d3('0x3b')](_0x13b5af[_0x27d3('0xf')],_0x28b7f3,[_0x52bc40],_0x5b7983);}_0x13b5af[_0x27d3('0xf')][_0x27d3('0x15')]({'type':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x12')],'app':_0x27d3('0x3c'),'exten':_0x114fe2[_0xe6db3b][0x0]['exten'],'context':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x13')],'priority':_0x13b5af['priority'],'VoiceExtensionId':_0x114fe2[_0xe6db3b][0x0][_0x27d3('0x18')]});_0x26bd30[_0x27d3('0x15')](_0x114fe2[_0xe6db3b][0x0]['VoiceExtensionId']);_0x49c1e7=_[_0x27d3('0x3b')](_0x49c1e7,_0x13b5af['extensions']);}}return _0x4c740c['transaction'](function(_0x18a7d7){return _0x4c740c['models']['VoiceExtension'][_0x27d3('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x26bd30}},'transaction':_0x18a7d7})['then'](function(_0x1dd2f4){return _0x4c740c[_0x27d3('0x1')][_0x27d3('0x6')][_0x27d3('0x3e')](_[_0x27d3('0x3f')](_0x49c1e7,_0x27d3('0xe')),{'transaction':_0x18a7d7});});});})['catch'](function(_0x5b61e6){console['error'](_0x5b61e6);});}exports[_0x27d3('0x40')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index c460d2a..2dd37a8 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 _0xff74=['NOW()','toString','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cm_contacts','str','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','query','VoiceQueueId','onlyIfOpen','BlackLists','Campaign','always','CampaignId','all','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','resolve','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','error','index','test','isNil','errors','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','CompanyId','length','find','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','phone'];(function(_0x59a791,_0x3b49a7){var _0x235d58=function(_0x2bbb78){while(--_0x2bbb78){_0x59a791['push'](_0x59a791['shift']());}};_0x235d58(++_0x3b49a7);}(_0xff74,0xfc));var _0x4ff7=function(_0x257280,_0x2921df){_0x257280=_0x257280-0x0;var _0xc4550e=_0xff74[_0x257280];return _0xc4550e;};'use strict';var BPromise=require(_0x4ff7('0x0'));var util=require(_0x4ff7('0x1'));var _=require(_0x4ff7('0x2'));var fs=require('fs');var squel=require(_0x4ff7('0x3'));var Papa=require(_0x4ff7('0x4'));var Redis=require(_0x4ff7('0x5'));var db=require(_0x4ff7('0x6'))['db'];var config=require(_0x4ff7('0x7'));var logger=require('../../../config/logger')(_0x4ff7('0x8'));config[_0x4ff7('0x9')]=_[_0x4ff7('0xa')](config[_0x4ff7('0x9')],{'host':_0x4ff7('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4ff7('0xc'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x4ff7('0xd')][0x2]===_0x4ff7('0xe')||process[_0x4ff7('0xd')][0x2]===_0x4ff7('0xf')){throw new Error(_0x4ff7('0x10'));}var FILEPATH=process[_0x4ff7('0xd')][0x2];if(!process[_0x4ff7('0xd')][0x3]||process[_0x4ff7('0xd')][0x3]===_0x4ff7('0xe')||process[_0x4ff7('0xd')][0x3]===_0x4ff7('0xf')||!process['argv'][0x4]||process[_0x4ff7('0xd')][0x4]===_0x4ff7('0xe')||process[_0x4ff7('0xd')][0x4]===_0x4ff7('0xf')){throw new Error(_0x4ff7('0x11'));}var FIELDS=_[_0x4ff7('0x12')](process[_0x4ff7('0xd')][0x3][_0x4ff7('0x13')](','),process['argv'][0x4][_0x4ff7('0x13')](','));if(!process[_0x4ff7('0xd')][0x5]||process[_0x4ff7('0xd')][0x5]===_0x4ff7('0xe')||process[_0x4ff7('0xd')][0x5]===_0x4ff7('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x4ff7('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x4ff7('0xd')][0x6]!==_0x4ff7('0xe')&&process[_0x4ff7('0xd')][0x6]!==_0x4ff7('0xf')?process[_0x4ff7('0xd')][0x6]:null;var DUPLICATES=process[_0x4ff7('0xd')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x4ff7('0xd')][0x7]!==_0x4ff7('0xf')?process[_0x4ff7('0xd')][0x7]:null;if(!process[_0x4ff7('0xd')][0x8]||process[_0x4ff7('0xd')][0x8]===_0x4ff7('0xe')||process[_0x4ff7('0xd')][0x8]===_0x4ff7('0xf')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x4ff7('0xd')][0x8];}catch(_0xd6c3d3){logger[_0x4ff7('0x14')](_0xd6c3d3);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(_0x4e7422,_0x572d42,_0x12f03b,_0x1f370b){var _0xc07de={'message':_0x572d42};_0xc07de[_0x4e7422]=!![];if(_0x12f03b){_0xc07de['contact']=_0x12f03b;}if(_0x1f370b){_0xc07de[_0x4ff7('0x15')]=_0x1f370b;}return _0xc07de;}function isEmail(_0x391751){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))*$/[_0x4ff7('0x16')](_0x391751);}function checkRow(_0x13f1d8,_0x460c43,_0x396435){return new BPromise(function(_0x22db4e,_0x2494a5){if(_[_0x4ff7('0x17')](_0x13f1d8)){return _0x2494a5(handleCheckRowError(_0x4ff7('0x14'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x396435));}if(_0x13f1d8[_0x4ff7('0x18')]&&_0x13f1d8[_0x4ff7('0x18')]['length']){var _0x4cabd4=_['map'](_0x13f1d8[_0x4ff7('0x18')],'message')[_0x4ff7('0x19')](';');return _0x2494a5(handleCheckRowError('error',_0x4cabd4,null,_0x396435));}var _0x4bb0aa={};for(var _0x4400cf in FIELDS){if(FIELDS[_0x4ff7('0x1a')](_0x4400cf)&&FIELDS[_0x4400cf]){_0x4bb0aa[_0x4400cf]=_0x13f1d8[_0x4ff7('0x1b')][0x0][FIELDS[_0x4400cf]]||_0x13f1d8[_0x4ff7('0x1b')][0x0]['\ufeff'+FIELDS[_0x4400cf]];}}if(!_0x4bb0aa[_0x4ff7('0x1c')]){return _0x2494a5(handleCheckRowError('error',_0x4ff7('0x1d'),null,_0x396435));}if(!_0x4bb0aa['phone']){return _0x2494a5(handleCheckRowError(_0x4ff7('0x14'),'phone\x20not\x20specified!',null,_0x396435));}if(_0x4bb0aa[_0x4ff7('0x1e')]){var _0xab84c8=moment(_0x4bb0aa[_0x4ff7('0x1e')],_0x4ff7('0x1f'));if(!_0xab84c8['isValid']()){return _0x2494a5(handleCheckRowError(_0x4ff7('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x396435));}}if(_0x4bb0aa[_0x4ff7('0x20')]){if(!isEmail(_0x4bb0aa[_0x4ff7('0x20')])){return _0x2494a5(handleCheckRowError('error',_0x4ff7('0x21'),null,_0x396435));}}_0x4bb0aa['ListId']=LISTID;_0x4bb0aa[_0x4ff7('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4ff7('0x23')]&&_0x460c43){var _0x5417c3={};for(var _0xda832c=0x0,_0x5af8da=DUPLICATES[_0x4ff7('0x23')];_0xda832c<_0x5af8da;_0xda832c+=0x1){_0x5417c3[DUPLICATES[_0xda832c]]=_0x4bb0aa[DUPLICATES[_0xda832c]];}var _0x5bd549=_[_0x4ff7('0x24')](_0x460c43,_0x5417c3);if(_0x5bd549){return _0x2494a5(handleCheckRowError('duplicate',_0x4ff7('0x25'),_0x5bd549,_0x396435));}}return db[_0x4ff7('0x26')][_0x4ff7('0x27')](_0x4bb0aa,{'raw':!![],'hooks':![],'fields':_[_0x4ff7('0x28')](_0x4bb0aa)})[_0x4ff7('0x29')](function(_0x2e35ad){if(DUPLICATES&&DUPLICATES[_0x4ff7('0x23')]&&_0x460c43){_0x460c43[_0x4ff7('0x2a')](_[_0x4ff7('0x2b')](_0x4bb0aa,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2e35ad['id'];return _0x22db4e();})[_0x4ff7('0x2c')](function(_0x259b6d){return _0x2494a5(handleCheckRowError(_0x4ff7('0x14'),_0x4ff7('0x2d')+(_0x259b6d[_0x4ff7('0x2e')]||JSON[_0x4ff7('0x2f')](_0x259b6d)),null,_0x396435));});});}function checkHopper(){function _0x1f38f3(){return function(_0x41478d){logger['error'](_0x4ff7('0x30'),_0x4ff7('0x31'),util[_0x4ff7('0x32')](_0x41478d,{'showHidden':![],'depth':null}));};}var _0x2e3c95=function(_0x178cb9,_0x2d57e7){var _0x43af1e=squel[_0x4ff7('0x33')]()[_0x4ff7('0x34')](_0x4ff7('0x35'))[_0x4ff7('0x36')](['phone',_0x4ff7('0x37'),_0x4ff7('0x38'),_0x4ff7('0x39'),_0x2d57e7,_0x4ff7('0x3a'),_0x4ff7('0x3b')],squel[_0x4ff7('0x3c')]()[_0x4ff7('0x3d')](_0x4ff7('0x3e'),'phone')[_0x4ff7('0x3d')](_0x4ff7('0x3f'),_0x4ff7('0x37'))['field']('id','ContactId')['field'](LISTID[_0x4ff7('0x40')](),_0x4ff7('0x39'))['field'](_0x178cb9['id']['toString'](),_0x2d57e7)[_0x4ff7('0x3d')](_0x4ff7('0x3f'),_0x4ff7('0x3a'))[_0x4ff7('0x3d')](_0x4ff7('0x3f'),_0x4ff7('0x3b'))[_0x4ff7('0x41')]('cm_contacts')[_0x4ff7('0x42')](_0x4ff7('0x43'))['where'](_0x4ff7('0x44'),LISTID['toString']())[_0x4ff7('0x42')](_0x4ff7('0x45'))[_0x4ff7('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4ff7('0x3c')]()['field'](_0x4ff7('0x3e'))[_0x4ff7('0x41')](_0x4ff7('0x35'))[_0x4ff7('0x42')](_0x2d57e7+'\x20=\x20?',_0x178cb9['id'][_0x4ff7('0x40')]())))['toString']();return _0x43af1e;};var _0x4cc2bb=function(_0x183327,_0x7928d4){var _0x5c5d15=squel[_0x4ff7('0x33')]()['into'](_0x4ff7('0x35'))[_0x4ff7('0x36')]([_0x4ff7('0x3e'),_0x4ff7('0x37'),_0x4ff7('0x38'),_0x4ff7('0x39'),_0x7928d4,_0x4ff7('0x3a'),'updatedAt'],squel['select']()[_0x4ff7('0x3d')](_0x4ff7('0x3e'),_0x4ff7('0x3e'))['field']('NOW()',_0x4ff7('0x37'))[_0x4ff7('0x3d')]('id',_0x4ff7('0x38'))[_0x4ff7('0x3d')](LISTID[_0x4ff7('0x40')](),_0x4ff7('0x39'))['field'](_0x183327['id'][_0x4ff7('0x40')](),_0x7928d4)[_0x4ff7('0x3d')](_0x4ff7('0x3f'),'createdAt')[_0x4ff7('0x3d')](_0x4ff7('0x3f'),_0x4ff7('0x3b'))['from'](_0x4ff7('0x46'))['where'](_0x4ff7('0x43'))['where'](_0x4ff7('0x44'),LISTID['toString']())[_0x4ff7('0x42')]('id\x20IN\x20?',squel[_0x4ff7('0x47')](hopperContacts))[_0x4ff7('0x42')](_0x4ff7('0x45'))[_0x4ff7('0x42')](_0x4ff7('0x48'),squel[_0x4ff7('0x3c')]()[_0x4ff7('0x3d')]('calleridnum')[_0x4ff7('0x41')](_0x4ff7('0x49'))[_0x4ff7('0x42')](_0x7928d4+_0x4ff7('0x4a'),_0x183327['id']['toString']()))[_0x4ff7('0x42')]('phone\x20NOT\x20IN\x20(?)',squel[_0x4ff7('0x3c')]()[_0x4ff7('0x3d')](_0x4ff7('0x3e'))[_0x4ff7('0x41')](_0x4ff7('0x35'))[_0x4ff7('0x42')](_0x7928d4+_0x4ff7('0x4a'),_0x183327['id'][_0x4ff7('0x40')]())))['toString']();return _0x5c5d15;};function _0xb030e4(_0x57b887,_0x314c65){var _0x9cd6ad=squel[_0x4ff7('0x33')]()['into']('cm_hopper')[_0x4ff7('0x36')]([_0x4ff7('0x3e'),_0x4ff7('0x37'),_0x4ff7('0x38'),_0x4ff7('0x39'),_0x314c65,'createdAt',_0x4ff7('0x3b')],squel[_0x4ff7('0x3c')]()[_0x4ff7('0x3d')](_0x4ff7('0x3e'),_0x4ff7('0x3e'))[_0x4ff7('0x3d')](_0x4ff7('0x3f'),_0x4ff7('0x37'))[_0x4ff7('0x3d')]('id',_0x4ff7('0x38'))[_0x4ff7('0x3d')](LISTID[_0x4ff7('0x40')](),_0x4ff7('0x39'))['field'](_0x57b887['id']['toString'](),_0x314c65)[_0x4ff7('0x3d')](_0x4ff7('0x3f'),'createdAt')['field']('NOW()',_0x4ff7('0x3b'))['from']('cm_contacts')[_0x4ff7('0x42')](_0x4ff7('0x43'))[_0x4ff7('0x42')](_0x4ff7('0x44'),LISTID[_0x4ff7('0x40')]())[_0x4ff7('0x42')](_0x4ff7('0x4b'),squel[_0x4ff7('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x4ff7('0x40')]();return _0x9cd6ad;}function _0x29baca(_0x6c192,_0xfd74f3){var _0x175fbc=squel[_0x4ff7('0x33')]()[_0x4ff7('0x34')](_0x4ff7('0x4c'))['fromQuery']([_0x4ff7('0x3e'),_0x4ff7('0x38'),_0x4ff7('0x39'),_0xfd74f3,_0x4ff7('0x3a'),_0x4ff7('0x3b')],squel[_0x4ff7('0x3c')]()[_0x4ff7('0x3d')](_0x4ff7('0x3e'),_0x4ff7('0x3e'))[_0x4ff7('0x3d')]('id',_0x4ff7('0x38'))['field'](LISTID[_0x4ff7('0x40')](),'ListId')[_0x4ff7('0x3d')](_0x6c192['id'][_0x4ff7('0x40')](),_0xfd74f3)[_0x4ff7('0x3d')](_0x4ff7('0x3f'),_0x4ff7('0x3a'))['field'](_0x4ff7('0x3f'),_0x4ff7('0x3b'))[_0x4ff7('0x41')](_0x4ff7('0x46'))[_0x4ff7('0x42')]('deletedAt\x20IS\x20NULL')[_0x4ff7('0x42')]('ListId\x20=\x20?',LISTID['toString']())['where'](_0x4ff7('0x4b'),squel[_0x4ff7('0x47')](hopperContacts))[_0x4ff7('0x42')](_0x4ff7('0x45')))['toString']();return _0x175fbc;}return db[_0x4ff7('0x4d')][_0x4ff7('0x4e')]({'where':{'type':_0x4ff7('0x4f')},'attributes':['id',_0x4ff7('0x50')],'include':[{'model':db[_0x4ff7('0x51')],'as':_0x4ff7('0x52'),'where':{'id':LISTID}}]})[_0x4ff7('0x29')](function(_0xae2171){var _0x1f6dcc=[];if(_0xae2171){var _0x3a1627;for(var _0x5d6219=0x0,_0x2bb53a;_0x5d6219<_0xae2171['length'];_0x5d6219+=0x1){_0x2bb53a=_0xae2171[_0x5d6219][_0x4ff7('0x53')]({'plain':!![]});switch(_0x2bb53a[_0x4ff7('0x50')]){case'always':_0x1f6dcc[_0x4ff7('0x2a')](db[_0x4ff7('0x54')][_0x4ff7('0x55')](_0x4cc2bb(_0x2bb53a,_0x4ff7('0x56')))['then'](function(){})['catch'](_0x1f38f3()));break;case _0x4ff7('0x57'):_0x1f6dcc[_0x4ff7('0x2a')](db[_0x4ff7('0x54')]['query'](_0x2e3c95(_0x2bb53a,_0x4ff7('0x56')))[_0x4ff7('0x29')](function(){})[_0x4ff7('0x2c')](_0x1f38f3()));break;default:_0x1f6dcc[_0x4ff7('0x2a')](db[_0x4ff7('0x54')]['query'](_0xb030e4(_0x2bb53a,'VoiceQueueId'))[_0x4ff7('0x29')](function(){})['catch'](_0x1f38f3()));}}}return _0x1f6dcc;})['all']()[_0x4ff7('0x29')](function(){return db['VoiceQueue'][_0x4ff7('0x4e')]({'where':{'type':_0x4ff7('0x4f')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x4ff7('0x58'),'where':{'id':LISTID}}]})[_0x4ff7('0x29')](function(_0x45faef){var _0x26cd09=[];if(_0x45faef){var _0x443a9b;for(var _0x4dddc1=0x0,_0x44a392;_0x4dddc1<_0x45faef[_0x4ff7('0x23')];_0x4dddc1+=0x1){_0x44a392=_0x45faef[_0x4dddc1][_0x4ff7('0x53')]({'plain':!![]});_0x26cd09[_0x4ff7('0x2a')](db['sequelize'][_0x4ff7('0x55')](_0x29baca(_0x44a392,_0x4ff7('0x56')))['then'](function(){})[_0x4ff7('0x2c')](_0x1f38f3()));}}return _0x26cd09;})['all']();})[_0x4ff7('0x29')](function(){return db[_0x4ff7('0x59')][_0x4ff7('0x4e')]({'attributes':['id',_0x4ff7('0x50')],'include':[{'model':db[_0x4ff7('0x51')],'as':_0x4ff7('0x52'),'where':{'id':LISTID}}]})[_0x4ff7('0x29')](function(_0x125eaa){var _0x48832a=[];if(_0x125eaa){for(var _0x5198b0=0x0,_0x51f89e;_0x5198b0<_0x125eaa[_0x4ff7('0x23')];_0x5198b0+=0x1){_0x51f89e=_0x125eaa[_0x5198b0][_0x4ff7('0x53')]({'plain':!![]});switch(_0x51f89e[_0x4ff7('0x50')]){case _0x4ff7('0x5a'):_0x48832a[_0x4ff7('0x2a')](db[_0x4ff7('0x54')]['query'](_0x4cc2bb(_0x51f89e,_0x4ff7('0x5b')))[_0x4ff7('0x29')](function(){})[_0x4ff7('0x2c')](_0x1f38f3()));break;case _0x4ff7('0x57'):_0x48832a['push'](db['sequelize']['query'](_0x2e3c95(_0x51f89e,_0x4ff7('0x5b')))[_0x4ff7('0x29')](function(){})['catch'](_0x1f38f3()));break;default:_0x48832a[_0x4ff7('0x2a')](db['sequelize'][_0x4ff7('0x55')](_0xb030e4(_0x51f89e,_0x4ff7('0x5b')))['then'](function(){})['catch'](_0x1f38f3()));}}}return _0x48832a;})['all']();})[_0x4ff7('0x29')](function(){return db['Campaign'][_0x4ff7('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x4ff7('0x51')],'as':_0x4ff7('0x58'),'where':{'id':LISTID}}]})[_0x4ff7('0x29')](function(_0x5e731e){var _0x4803e8=[];if(_0x5e731e){for(var _0xb4dc75=0x0,_0xeeb8e1;_0xb4dc75<_0x5e731e[_0x4ff7('0x23')];_0xb4dc75+=0x1){_0xeeb8e1=_0x5e731e[_0xb4dc75][_0x4ff7('0x53')]({'plain':!![]});_0x4803e8[_0x4ff7('0x2a')](db['sequelize']['query'](_0x29baca(_0xeeb8e1,_0x4ff7('0x5b')))[_0x4ff7('0x29')](function(){})['catch'](_0x1f38f3()));}}return _0x4803e8;})[_0x4ff7('0x5c')]();})[_0x4ff7('0x2c')](function(_0x392b19){logger['error']('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x392b19[_0x4ff7('0x2e')]);});}var processPromises=function(_0x2c0dda){return BPromise[_0x4ff7('0x5c')](promises)[_0x4ff7('0x29')](function(_0x4b6bf2){})['catch'](function(_0x5df1eb){logger[_0x4ff7('0x14')](_0x4ff7('0x5d'),JSON['stringify'](_0x5df1eb));})['finally'](function(){socket[_0x4ff7('0x5e')](_0x4ff7('0x5f')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2c0dda){return _0x2c0dda[_0x4ff7('0x60')]();}});};var endCsv=function(){return BPromise[_0x4ff7('0x61')]()[_0x4ff7('0x29')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0x4ff7('0x5e')](_0x4ff7('0x5f')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1bcb35){logger[_0x4ff7('0x14')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x1bcb35));}finally{process[_0x4ff7('0x62')](0x0);}});};process['on'](_0x4ff7('0x63'),function(){logger[_0x4ff7('0x64')](_0x4ff7('0x65'));endCsv();});function main(){return BPromise['resolve']()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4ff7('0x13')](',');return db[_0x4ff7('0x26')][_0x4ff7('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x482b72){var _0x15b23e=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x15b23e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c458c,_0x386058){total+=0x1;var _0xb9443e=total;promises[_0x4ff7('0x2a')](checkRow(_0x1c458c,_0x482b72,_0xb9443e)[_0x4ff7('0x29')](function(){success+=0x1;})[_0x4ff7('0x2c')](function(_0x66511b){if(_0x66511b[_0x4ff7('0x14')]){errors+=0x1;delete _0x66511b[_0x4ff7('0x14')];}else if(_0x66511b['duplicate']){duplicates+=0x1;delete _0x66511b['duplicate'];}rows[_0x4ff7('0x2a')](_0x66511b);}));if(total%0xc8===0x0){_0x386058['pause']();return processPromises(_0x386058);}},'complete':function(){return processPromises()[_0x4ff7('0x29')](function(){logger['info'](_0x4ff7('0x66'));endCsv();});},'error':function(_0x1d4ab0,_0x49f01b){logger[_0x4ff7('0x64')](_0x4ff7('0x67'),JSON[_0x4ff7('0x2f')](_0x1d4ab0));endCsv();}});})[_0x4ff7('0x2c')](function(_0x42e83b){logger[_0x4ff7('0x14')](_0x4ff7('0x68'),JSON[_0x4ff7('0x2f')](_0x42e83b));});}main(); \ No newline at end of file +var _0x1596=['The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','hasOwnProperty','data','error','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','then','length','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','phone','ContactId','createdAt','updatedAt','select','field','scheduledAt','toString','NOW()','from','cm_contacts','where','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','ListId\x20=\x20?','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','get','always','sequelize','query','VoiceQueueId','catch','all','VoiceQueue','BlackLists','Campaign','CampaignId','onlyIfOpen','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','exit','SIGINT','info','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','argv','null','undefined','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','contact','index'];(function(_0xc18227,_0x4782ea){var _0x39d60f=function(_0x3e9926){while(--_0x3e9926){_0xc18227['push'](_0xc18227['shift']());}};_0x39d60f(++_0x4782ea);}(_0x1596,0x122));var _0x6159=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1596[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0x6159('0x0'));var util=require(_0x6159('0x1'));var _=require('lodash');var fs=require('fs');var squel=require('squel');var Papa=require(_0x6159('0x2'));var Redis=require(_0x6159('0x3'));var db=require(_0x6159('0x4'))['db'];var config=require(_0x6159('0x5'));var logger=require(_0x6159('0x6'))('api');config['redis']=_[_0x6159('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6159('0x8'))(new Redis(config[_0x6159('0x9')]));require(_0x6159('0xa'))['register'](socket);try{if(!process[_0x6159('0xb')][0x2]||process[_0x6159('0xb')][0x2]==='undefined'||process[_0x6159('0xb')][0x2]===_0x6159('0xc')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0x6159('0xd')||process[_0x6159('0xb')][0x3]===_0x6159('0xc')||!process['argv'][0x4]||process[_0x6159('0xb')][0x4]===_0x6159('0xd')||process[_0x6159('0xb')][0x4]==='null'){throw new Error(_0x6159('0xe'));}var FIELDS=_['zipObject'](process[_0x6159('0xb')][0x3][_0x6159('0xf')](','),process[_0x6159('0xb')][0x4][_0x6159('0xf')](','));if(!process[_0x6159('0xb')][0x5]||process[_0x6159('0xb')][0x5]===_0x6159('0xd')||process['argv'][0x5]==='null'){throw new Error(_0x6159('0x10'));}var LISTID=process[_0x6159('0xb')][0x5];var COMPANYID=process[_0x6159('0xb')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0x6159('0xb')][0x6]!==_0x6159('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x6159('0xb')][0x7]&&process[_0x6159('0xb')][0x7]!==_0x6159('0xd')&&process[_0x6159('0xb')][0x7]!==_0x6159('0xc')?process[_0x6159('0xb')][0x7]:null;if(!process[_0x6159('0xb')][0x8]||process[_0x6159('0xb')][0x8]===_0x6159('0xd')||process['argv'][0x8]===_0x6159('0xc')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x6159('0xb')][0x8];}catch(_0x3fc4bf){logger['error'](_0x3fc4bf);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(_0x2842fc,_0x11810f,_0x77d725,_0x438032){var _0x411f1d={'message':_0x11810f};_0x411f1d[_0x2842fc]=!![];if(_0x77d725){_0x411f1d[_0x6159('0x11')]=_0x77d725;}if(_0x438032){_0x411f1d[_0x6159('0x12')]=_0x438032;}return _0x411f1d;}function isEmail(_0x5a5461){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'](_0x5a5461);}function checkRow(_0x14b067,_0x489cbd,_0x12b2fe){return new BPromise(function(_0x1bd29a,_0x9e371a){if(_['isNil'](_0x14b067)){return _0x9e371a(handleCheckRowError('error',_0x6159('0x13'),null,_0x12b2fe));}if(_0x14b067[_0x6159('0x14')]&&_0x14b067[_0x6159('0x14')]['length']){var _0x3f12a1=_[_0x6159('0x15')](_0x14b067[_0x6159('0x14')],_0x6159('0x16'))['join'](';');return _0x9e371a(handleCheckRowError('error',_0x3f12a1,null,_0x12b2fe));}var _0x31076f={};for(var _0x4dd72f in FIELDS){if(FIELDS[_0x6159('0x17')](_0x4dd72f)&&FIELDS[_0x4dd72f]){_0x31076f[_0x4dd72f]=_0x14b067[_0x6159('0x18')][0x0][FIELDS[_0x4dd72f]]||_0x14b067[_0x6159('0x18')][0x0]['\ufeff'+FIELDS[_0x4dd72f]];}}if(!_0x31076f['firstName']){return _0x9e371a(handleCheckRowError(_0x6159('0x19'),_0x6159('0x1a'),null,_0x12b2fe));}if(!_0x31076f['phone']){return _0x9e371a(handleCheckRowError(_0x6159('0x19'),_0x6159('0x1b'),null,_0x12b2fe));}if(_0x31076f['birthDate']){var _0x38e227=moment(_0x31076f[_0x6159('0x1c')],_0x6159('0x1d'));if(!_0x38e227[_0x6159('0x1e')]()){return _0x9e371a(handleCheckRowError(_0x6159('0x19'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x12b2fe));}}if(_0x31076f[_0x6159('0x1f')]){if(!isEmail(_0x31076f[_0x6159('0x1f')])){return _0x9e371a(handleCheckRowError(_0x6159('0x19'),_0x6159('0x20'),null,_0x12b2fe));}}_0x31076f[_0x6159('0x21')]=LISTID;_0x31076f[_0x6159('0x22')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x489cbd){var _0x5dad2b={};for(var _0x72217c=0x0,_0x2ed567=DUPLICATES['length'];_0x72217c<_0x2ed567;_0x72217c+=0x1){_0x5dad2b[DUPLICATES[_0x72217c]]=_0x31076f[DUPLICATES[_0x72217c]];}var _0x3b430b=_['find'](_0x489cbd,_0x5dad2b);if(_0x3b430b){return _0x9e371a(handleCheckRowError(_0x6159('0x23'),_0x6159('0x24'),_0x3b430b,_0x12b2fe));}}return db[_0x6159('0x25')]['create'](_0x31076f,{'raw':!![],'hooks':![],'fields':_['keys'](_0x31076f)})[_0x6159('0x26')](function(_0x31440d){if(DUPLICATES&&DUPLICATES[_0x6159('0x27')]&&_0x489cbd){_0x489cbd[_0x6159('0x28')](_[_0x6159('0x29')](_0x31076f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x31440d['id'];return _0x1bd29a();})['catch'](function(_0x36ece4){return _0x9e371a(handleCheckRowError(_0x6159('0x19'),_0x6159('0x2a')+(_0x36ece4['message']||JSON[_0x6159('0x2b')](_0x36ece4)),null,_0x12b2fe));});});}function checkHopper(){function _0x1e2f6a(){return function(_0x17d677){logger[_0x6159('0x19')](_0x6159('0x2c'),_0x6159('0x2d'),util[_0x6159('0x2e')](_0x17d677,{'showHidden':![],'depth':null}));};}var _0xc291b7=function(_0x5292e3,_0x10755e){var _0x35eaaa=squel['insert']()[_0x6159('0x2f')](_0x6159('0x30'))[_0x6159('0x31')]([_0x6159('0x32'),'scheduledAt',_0x6159('0x33'),_0x6159('0x21'),_0x10755e,_0x6159('0x34'),_0x6159('0x35')],squel[_0x6159('0x36')]()[_0x6159('0x37')](_0x6159('0x32'),_0x6159('0x32'))['field']('NOW()',_0x6159('0x38'))['field']('id',_0x6159('0x33'))[_0x6159('0x37')](LISTID[_0x6159('0x39')](),_0x6159('0x21'))[_0x6159('0x37')](_0x5292e3['id'][_0x6159('0x39')](),_0x10755e)[_0x6159('0x37')](_0x6159('0x3a'),'createdAt')['field'](_0x6159('0x3a'),_0x6159('0x35'))[_0x6159('0x3b')](_0x6159('0x3c'))[_0x6159('0x3d')]('deletedAt\x20IS\x20NULL')[_0x6159('0x3d')]('ListId\x20=\x20?',LISTID[_0x6159('0x39')]())[_0x6159('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0x6159('0x3d')](_0x6159('0x3e'),squel[_0x6159('0x36')]()[_0x6159('0x37')](_0x6159('0x32'))[_0x6159('0x3b')](_0x6159('0x30'))[_0x6159('0x3d')](_0x10755e+_0x6159('0x3f'),_0x5292e3['id']['toString']())))['toString']();return _0x35eaaa;};var _0x37059f=function(_0xa5fe86,_0x42a294){var _0x1fad56=squel[_0x6159('0x40')]()[_0x6159('0x2f')](_0x6159('0x30'))[_0x6159('0x31')]([_0x6159('0x32'),_0x6159('0x38'),_0x6159('0x33'),_0x6159('0x21'),_0x42a294,_0x6159('0x34'),_0x6159('0x35')],squel[_0x6159('0x36')]()['field'](_0x6159('0x32'),'phone')['field'](_0x6159('0x3a'),_0x6159('0x38'))[_0x6159('0x37')]('id',_0x6159('0x33'))[_0x6159('0x37')](LISTID[_0x6159('0x39')](),_0x6159('0x21'))[_0x6159('0x37')](_0xa5fe86['id'][_0x6159('0x39')](),_0x42a294)[_0x6159('0x37')](_0x6159('0x3a'),_0x6159('0x34'))[_0x6159('0x37')](_0x6159('0x3a'),_0x6159('0x35'))[_0x6159('0x3b')](_0x6159('0x3c'))[_0x6159('0x3d')](_0x6159('0x41'))[_0x6159('0x3d')]('ListId\x20=\x20?',LISTID[_0x6159('0x39')]())[_0x6159('0x3d')](_0x6159('0x42'),squel[_0x6159('0x43')](hopperContacts))[_0x6159('0x3d')](_0x6159('0x44'))[_0x6159('0x3d')](_0x6159('0x3e'),squel[_0x6159('0x36')]()['field'](_0x6159('0x45'))[_0x6159('0x3b')](_0x6159('0x46'))[_0x6159('0x3d')](_0x42a294+_0x6159('0x3f'),_0xa5fe86['id']['toString']()))[_0x6159('0x3d')](_0x6159('0x3e'),squel['select']()[_0x6159('0x37')](_0x6159('0x32'))['from']('cm_hopper')[_0x6159('0x3d')](_0x42a294+'\x20=\x20?',_0xa5fe86['id'][_0x6159('0x39')]())))['toString']();return _0x1fad56;};function _0x4627f7(_0x347b31,_0x1b89a9){var _0x2a601a=squel['insert']()[_0x6159('0x2f')](_0x6159('0x30'))[_0x6159('0x31')]([_0x6159('0x32'),_0x6159('0x38'),_0x6159('0x33'),_0x6159('0x21'),_0x1b89a9,'createdAt',_0x6159('0x35')],squel[_0x6159('0x36')]()[_0x6159('0x37')](_0x6159('0x32'),_0x6159('0x32'))[_0x6159('0x37')](_0x6159('0x3a'),'scheduledAt')['field']('id',_0x6159('0x33'))['field'](LISTID[_0x6159('0x39')](),'ListId')['field'](_0x347b31['id']['toString'](),_0x1b89a9)[_0x6159('0x37')]('NOW()','createdAt')[_0x6159('0x37')](_0x6159('0x3a'),_0x6159('0x35'))[_0x6159('0x3b')](_0x6159('0x3c'))['where'](_0x6159('0x41'))[_0x6159('0x3d')](_0x6159('0x47'),LISTID['toString']())[_0x6159('0x3d')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x6159('0x3d')](_0x6159('0x44')))[_0x6159('0x39')]();return _0x2a601a;}function _0x3ea453(_0x50d5a2,_0x251081){var _0x2dcefc=squel[_0x6159('0x40')]()[_0x6159('0x2f')](_0x6159('0x48'))[_0x6159('0x31')](['phone',_0x6159('0x33'),'ListId',_0x251081,_0x6159('0x34'),_0x6159('0x35')],squel[_0x6159('0x36')]()['field'](_0x6159('0x32'),'phone')['field']('id',_0x6159('0x33'))[_0x6159('0x37')](LISTID[_0x6159('0x39')](),_0x6159('0x21'))[_0x6159('0x37')](_0x50d5a2['id'][_0x6159('0x39')](),_0x251081)[_0x6159('0x37')](_0x6159('0x3a'),_0x6159('0x34'))['field'](_0x6159('0x3a'),_0x6159('0x35'))[_0x6159('0x3b')](_0x6159('0x3c'))[_0x6159('0x3d')](_0x6159('0x41'))[_0x6159('0x3d')](_0x6159('0x47'),LISTID[_0x6159('0x39')]())[_0x6159('0x3d')](_0x6159('0x42'),squel[_0x6159('0x43')](hopperContacts))[_0x6159('0x3d')]('phone\x20IS\x20NOT\x20NULL'))[_0x6159('0x39')]();return _0x2dcefc;}return db['VoiceQueue'][_0x6159('0x49')]({'where':{'type':_0x6159('0x4a')},'attributes':['id',_0x6159('0x4b')],'include':[{'model':db[_0x6159('0x4c')],'as':'Lists','where':{'id':LISTID}}]})[_0x6159('0x26')](function(_0x145120){var _0x5c0a2f=[];if(_0x145120){var _0x288f37;for(var _0x1194a5=0x0,_0x968c10;_0x1194a5<_0x145120[_0x6159('0x27')];_0x1194a5+=0x1){_0x968c10=_0x145120[_0x1194a5][_0x6159('0x4d')]({'plain':!![]});switch(_0x968c10[_0x6159('0x4b')]){case _0x6159('0x4e'):_0x5c0a2f[_0x6159('0x28')](db[_0x6159('0x4f')][_0x6159('0x50')](_0x37059f(_0x968c10,_0x6159('0x51')))[_0x6159('0x26')](function(){})['catch'](_0x1e2f6a()));break;case'onlyIfOpen':_0x5c0a2f['push'](db[_0x6159('0x4f')][_0x6159('0x50')](_0xc291b7(_0x968c10,_0x6159('0x51')))[_0x6159('0x26')](function(){})[_0x6159('0x52')](_0x1e2f6a()));break;default:_0x5c0a2f['push'](db[_0x6159('0x4f')][_0x6159('0x50')](_0x4627f7(_0x968c10,'VoiceQueueId'))[_0x6159('0x26')](function(){})[_0x6159('0x52')](_0x1e2f6a()));}}}return _0x5c0a2f;})[_0x6159('0x53')]()[_0x6159('0x26')](function(){return db[_0x6159('0x54')][_0x6159('0x49')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x6159('0x4c')],'as':_0x6159('0x55'),'where':{'id':LISTID}}]})[_0x6159('0x26')](function(_0x5a17d2){var _0x3809c5=[];if(_0x5a17d2){var _0x3a6f38;for(var _0x448c8e=0x0,_0x705e22;_0x448c8e<_0x5a17d2[_0x6159('0x27')];_0x448c8e+=0x1){_0x705e22=_0x5a17d2[_0x448c8e][_0x6159('0x4d')]({'plain':!![]});_0x3809c5['push'](db[_0x6159('0x4f')]['query'](_0x3ea453(_0x705e22,_0x6159('0x51')))[_0x6159('0x26')](function(){})[_0x6159('0x52')](_0x1e2f6a()));}}return _0x3809c5;})[_0x6159('0x53')]();})[_0x6159('0x26')](function(){return db[_0x6159('0x56')][_0x6159('0x49')]({'attributes':['id',_0x6159('0x4b')],'include':[{'model':db[_0x6159('0x4c')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x507444){var _0x154a59=[];if(_0x507444){for(var _0x386b67=0x0,_0x598693;_0x386b67<_0x507444[_0x6159('0x27')];_0x386b67+=0x1){_0x598693=_0x507444[_0x386b67][_0x6159('0x4d')]({'plain':!![]});switch(_0x598693[_0x6159('0x4b')]){case _0x6159('0x4e'):_0x154a59[_0x6159('0x28')](db[_0x6159('0x4f')][_0x6159('0x50')](_0x37059f(_0x598693,_0x6159('0x57')))[_0x6159('0x26')](function(){})[_0x6159('0x52')](_0x1e2f6a()));break;case _0x6159('0x58'):_0x154a59['push'](db[_0x6159('0x4f')]['query'](_0xc291b7(_0x598693,'CampaignId'))[_0x6159('0x26')](function(){})[_0x6159('0x52')](_0x1e2f6a()));break;default:_0x154a59[_0x6159('0x28')](db[_0x6159('0x4f')][_0x6159('0x50')](_0x4627f7(_0x598693,_0x6159('0x57')))[_0x6159('0x26')](function(){})[_0x6159('0x52')](_0x1e2f6a()));}}}return _0x154a59;})[_0x6159('0x53')]();})[_0x6159('0x26')](function(){return db[_0x6159('0x56')]['findAll']({'attributes':['id'],'include':[{'model':db[_0x6159('0x4c')],'as':_0x6159('0x55'),'where':{'id':LISTID}}]})[_0x6159('0x26')](function(_0x1afeb2){var _0x3f4dc4=[];if(_0x1afeb2){for(var _0x487bac=0x0,_0x4fe15a;_0x487bac<_0x1afeb2['length'];_0x487bac+=0x1){_0x4fe15a=_0x1afeb2[_0x487bac][_0x6159('0x4d')]({'plain':!![]});_0x3f4dc4['push'](db['sequelize'][_0x6159('0x50')](_0x3ea453(_0x4fe15a,_0x6159('0x57')))[_0x6159('0x26')](function(){})[_0x6159('0x52')](_0x1e2f6a()));}}return _0x3f4dc4;})['all']();})[_0x6159('0x52')](function(_0x36200a){logger[_0x6159('0x19')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x36200a['message']);});}var processPromises=function(_0x1895f2){return BPromise[_0x6159('0x53')](promises)[_0x6159('0x26')](function(_0x165588){})['catch'](function(_0x15644b){logger['error'](_0x6159('0x59'),JSON['stringify'](_0x15644b));})[_0x6159('0x5a')](function(){socket[_0x6159('0x5b')](_0x6159('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x1895f2){return _0x1895f2[_0x6159('0x5d')]();}});};var endCsv=function(){return BPromise[_0x6159('0x5e')]()[_0x6159('0x26')](function(){if(hopperContacts){return checkHopper();}})[_0x6159('0x26')](function(){socket[_0x6159('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x2b6742){logger[_0x6159('0x19')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x6159('0x2b')](_0x2b6742));}finally{process[_0x6159('0x5f')](0x0);}});};process['on'](_0x6159('0x60'),function(){logger[_0x6159('0x61')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x6159('0x5e')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x6159('0xf')](',');return db[_0x6159('0x25')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x12ed19){var _0x895d45=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x6159('0x62')](_0x895d45,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3e290f,_0x4931e9){total+=0x1;var _0x3b3b03=total;promises[_0x6159('0x28')](checkRow(_0x3e290f,_0x12ed19,_0x3b3b03)['then'](function(){success+=0x1;})[_0x6159('0x52')](function(_0x2b702b){if(_0x2b702b[_0x6159('0x19')]){errors+=0x1;delete _0x2b702b[_0x6159('0x19')];}else if(_0x2b702b[_0x6159('0x23')]){duplicates+=0x1;delete _0x2b702b[_0x6159('0x23')];}rows[_0x6159('0x28')](_0x2b702b);}));if(total%0xc8===0x0){_0x4931e9[_0x6159('0x63')]();return processPromises(_0x4931e9);}},'complete':function(){return processPromises()[_0x6159('0x26')](function(){logger[_0x6159('0x61')](_0x6159('0x64'));endCsv();});},'error':function(_0x1b67b1,_0xbe5351){logger[_0x6159('0x61')](_0x6159('0x65'),JSON[_0x6159('0x2b')](_0x1b67b1));endCsv();}});})[_0x6159('0x52')](function(_0x558c47){logger['error'](_0x6159('0x66'),JSON[_0x6159('0x2b')](_0x558c47));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 221d235..00b3200 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 _0xb90a=['appendFileSync','rows','emit','contact:import:','Abort\x20parser','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','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','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','UserId','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','../../../config/environment','../../../config/logger','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','createdAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','cm_hopper_black','ListId','updatedAt','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','error','errors','push','code','message','sequelize','spread','catch','send','binding','socket_timestamp','root','.csv','header','writeFileSync','parse','createReadStream','length','hasOwnProperty','data','trim','replace','isValid','isNaN','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow'];(function(_0x301a82,_0x33d322){var _0x384701=function(_0x449d06){while(--_0x449d06){_0x301a82['push'](_0x301a82['shift']());}};_0x384701(++_0x33d322);}(_0xb90a,0x12a));var _0xab90=function(_0x2b9bed,_0x6bbea5){_0x2b9bed=_0x2b9bed-0x0;var _0x225eaf=_0xb90a[_0x2b9bed];return _0x225eaf;};'use strict';var fs=require('fs');var path=require(_0xab90('0x0'));var _=require(_0xab90('0x1'));var Papa=require('papaparse');var util=require(_0xab90('0x2'));var BPromise=require('bluebird');var moment=require('moment');var squel=require('squel');var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require(_0xab90('0x3'));var logger=require(_0xab90('0x4'))('import');config['redis']=_[_0xab90('0x5')](config[_0xab90('0x6')],{'host':_0xab90('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xab90('0x6')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xab90('0x8')](_0xab90('0x9'));function isEmail(_0x1e7b79){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))*$/[_0xab90('0xa')](_0x1e7b79);}function selectNotIn(_0x5e042d,_0x171562,_0x1e0cf4,_0x4b90b0,_0x1d749){return squel[_0xab90('0xb')]()[_0xab90('0xc')](_0xab90('0xd'))[_0xab90('0xe')](_0x4b90b0)['join'](_0x171562,null,_0x171562+_0xab90('0xf')+_0x4b90b0+'.'+_0x1e0cf4)[_0xab90('0x10')](_0x4b90b0+'.'+_0x1e0cf4+_0xab90('0x11')+_0x5e042d+'.'+_0x1e0cf4)[_0xab90('0x10')](_0x171562+_0xab90('0x12')+_0x1d749[_0xab90('0x13')]()+')');}function insertCmHopper(_0x57a03d,_0x11e95a,_0xd485f5,_0x3dc022,_0x9abf7c){var _0x29f352=[_0xab90('0x14'),'cm_contacts.scheduledat',_0xab90('0x15'),'cm_contacts.ListId',_0x11e95a+'.'+_0x3dc022,_0xab90('0x16'),_0xab90('0x17'),'cm_contacts.priority',_0xab90('0x18'),'\x22'+_0x9abf7c+'\x22'];return squel[_0xab90('0x19')]()[_0xab90('0x1a')]('cm_hopper')[_0xab90('0x1b')]([_0xab90('0xd'),_0xab90('0x1c'),_0xab90('0x1d'),'ListId',_0x3dc022,_0xab90('0x1e'),'updatedAt',_0xab90('0x1f'),'UserId',_0xab90('0x20')],squel[_0xab90('0xb')]()[_0xab90('0x21')](_0x29f352)[_0xab90('0xe')](_0x11e95a)['join'](_0xab90('0x22'),null,_0xab90('0x23')+_0x11e95a+_0xab90('0x24'))[_0xab90('0x13')](_0xd485f5,null,_0xd485f5+_0xab90('0xf')+_0x11e95a+'.'+_0x3dc022)[_0xab90('0x10')](_0x11e95a+_0xab90('0x25'),_0x57a03d)[_0xab90('0x10')](_0xab90('0x26'),NOW)[_0xab90('0x10')](_0xab90('0x27'),selectNotIn(_0x11e95a,_0xd485f5,_0x3dc022,_0xab90('0x28'),[_0xab90('0x29'),_0xab90('0x2a')]))['where'](_0xab90('0x27'),selectNotIn(_0x11e95a,_0xd485f5,_0x3dc022,_0xab90('0x28'),[_0xab90('0x29')])))[_0xab90('0x2b')]();}function insertCmHopperBlack(_0x4a37de,_0x205b63,_0x2cad38,_0x20ce8a){var _0x1a79d0=['cm_contacts.phone',_0xab90('0x15'),_0xab90('0x2c'),_0x205b63+'.'+_0x20ce8a,'cm_contacts.createdAt',_0xab90('0x17')];return squel[_0xab90('0x19')]()[_0xab90('0x1a')](_0xab90('0x2d'))[_0xab90('0x1b')]([_0xab90('0xd'),_0xab90('0x1d'),_0xab90('0x2e'),_0x20ce8a,_0xab90('0x1e'),_0xab90('0x2f')],squel['select']()['fields'](_0x1a79d0)['from'](_0x205b63)[_0xab90('0x13')]('cm_contacts',null,_0xab90('0x23')+_0x205b63+_0xab90('0x24'))[_0xab90('0x13')](_0x2cad38,null,_0x2cad38+_0xab90('0xf')+_0x205b63+'.'+_0x20ce8a)['where'](_0x205b63+_0xab90('0x25'),_0x4a37de)[_0xab90('0x10')](_0xab90('0x26'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xab90('0xb')]()[_0xab90('0xc')](_0xab90('0xd'))[_0xab90('0xe')](_0xab90('0x2d'))[_0xab90('0x10')](_0xab90('0x30'),_0x4a37de)[_0xab90('0x10')](_0x20ce8a+_0xab90('0x31'),_0x205b63+'.'+_0x20ce8a)))[_0xab90('0x2b')]();}function insertCmContact(_0x12f540,_0x5d277c,_0x4751ae,_0x1eb4d0){var _0x41ff0c=_[_0xab90('0x32')](_[_0xab90('0x33')](_0x1eb4d0),['ListId',_0xab90('0x34'),_0xab90('0x1e'),_0xab90('0x2f')]);return squel['insert']()[_0xab90('0x1a')](_0xab90('0x22'))[_0xab90('0x1b')](_0x41ff0c,squel[_0xab90('0xb')]()[_0xab90('0x21')](_0x41ff0c)[_0xab90('0xe')](_0x5d277c)['where']('('+_0x4751ae[_0xab90('0x13')](',')+')\x20NOT\x20IN\x20?',squel[_0xab90('0xb')]()[_0xab90('0x21')](_0x4751ae)['from'](_0xab90('0x22'))['where'](_0xab90('0x30'),_0x12f540)[_0xab90('0x10')](_0xab90('0x35')))[_0xab90('0x10')](_0xab90('0x36'),squel['select']()[_0xab90('0xc')]('MIN(id)',_0xab90('0x37'))[_0xab90('0xe')](_0x5d277c)['group'](_0x4751ae[_0xab90('0x13')](','))))[_0xab90('0x2b')]();}function handleStop(){logger[_0xab90('0x38')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x313469){logger[_0xab90('0x39')](_0x313469['message']);process['exit'](0x1);}function handleError(_0xe573ca,_0x3ee976){stats[_0xab90('0x3a')][_0xab90('0x3b')]({'name':_0x3ee976[_0xab90('0x3c')],'message':_0x3ee976[_0xab90('0x3d')],'row':_0xe573ca});}function handleQuery(_0x1e7caf){logger['info'](_0x1e7caf);return db[_0xab90('0x3e')]['query'](_0x1e7caf)[_0xab90('0x3f')](function(_0x5f0491){results[_0xab90('0x3b')](_0x5f0491);})[_0xab90('0x40')](function(_0x75c1b4){logger[_0xab90('0x39')](_0x75c1b4[_0xab90('0x3d')]);});}function main(_0x28213d,_0xda9abf,_0x71e440,_0x57082f){logger['info']('main',_0x28213d,JSON['stringify'](_0xda9abf));process[_0xab90('0x41')]('start');var _0x45e038=_0xda9abf[_0xab90('0x42')];var _0x1b79be=_0xda9abf[_0xab90('0x43')];var _0x1de020=path['join'](config[_0xab90('0x44')],'server/files/tmp',_0x1b79be+_0xab90('0x45'));var _0x1d9dfc=_['keys'](_0x45e038)[_0xab90('0x13')]();logger[_0xab90('0x38')](_0xab90('0x46'),_0x1d9dfc);fs[_0xab90('0x47')](_0x1de020,_0x1d9dfc+'\x0a');Papa[_0xab90('0x48')](fs[_0xab90('0x49')](_0x28213d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4d534b,_0x36f3ec){try{for(var _0x55e1e1=0x0,_0x1b7e3a=[];_0x55e1e1<_0x4d534b['data'][_0xab90('0x4a')];_0x55e1e1++){stats['rows']+=0x1;if(_0x4d534b[_0xab90('0x3a')][_0x55e1e1]){handleError(_0x4d534b['data'][_0x55e1e1],_0x4d534b['errors'][_0x55e1e1]);}else{var _0x57a73b=[];for(var _0x1bd4bd in _0x45e038){if(_0x45e038[_0xab90('0x4b')](_0x1bd4bd)){if(_0x4d534b[_0xab90('0x4c')][_0x55e1e1][_0x45e038[_0x1bd4bd]]){var _0x1a2133=_[_0xab90('0x4d')](_0x4d534b[_0xab90('0x4c')][_0x55e1e1][_0x45e038[_0x1bd4bd]][_0xab90('0x4e')](/"/g,'\x27'));switch(_0x1bd4bd){case _0xab90('0x1c'):var _0xce10c4=moment(_0x1a2133,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xce10c4[_0xab90('0x4f')]()){_0x1b7e3a[_0xab90('0x3b')]('\x22'+_0x1a2133+'\x22');}else{_0x57a73b[_0xab90('0x3b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x3acd29=parseInt(_0x1a2133);_0x1a2133=_[_0xab90('0x50')](_0x3acd29)||_0x3acd29<0x0||_0x3acd29>0x4?_0x57082f?0x3:0x2:_0x3acd29;_0x1b7e3a[_0xab90('0x3b')]('\x22'+_0x1a2133+'\x22');break;case'UserId':var _0x198781=parseInt(_0x1a2133);if(_[_0xab90('0x51')](_0x198781)&&_[_0xab90('0x52')](_0x71e440,_0x198781)){_0x1b7e3a[_0xab90('0x3b')]('\x22'+_0x198781+'\x22');}else{_0x57a73b[_0xab90('0x3b')](_0xab90('0x53'));}break;case _0xab90('0x54'):if(isEmail(_0x1a2133)){_0x1b7e3a['push']('\x22'+_0x1a2133+'\x22');}else{_0x57a73b[_0xab90('0x3b')](_0xab90('0x55'));}break;case _0xab90('0x56'):var _0x39aca2=moment(_0x1a2133,_0xab90('0x57'),!![]);if(_0x39aca2['isValid']()){_0x1b7e3a[_0xab90('0x3b')]('\x22'+_0x1a2133+'\x22');}else{_0x57a73b[_0xab90('0x3b')](_0xab90('0x58'));}break;default:_0x1b7e3a[_0xab90('0x3b')]('\x22'+_0x1a2133+'\x22');}}else{switch(_0x1bd4bd){case _0xab90('0x59'):case _0xab90('0xd'):_0x57a73b[_0xab90('0x3b')](_0x1bd4bd+_0xab90('0x5a'));break;default:_0x1b7e3a[_0xab90('0x3b')]('\x22\x22');}}}}if(_0x57a73b[_0xab90('0x4a')]){handleError(_0x4d534b['data'][_0x55e1e1],{'code':_0xab90('0x5b'),'message':_0x57a73b[_0xab90('0x13')]()});}else{fs[_0xab90('0x5c')](_0x1de020,_0x1b7e3a['join']()+'\x0a');}_0x1b7e3a=[];}if(!(stats[_0xab90('0x5d')]%0xc8)){socket[_0xab90('0x5e')](_0xab90('0x5f')+_0x1b79be,stats);stats[_0xab90('0x3a')]=[];}}if(stopped){logger[_0xab90('0x38')](_0xab90('0x60'));_0x36f3ec['abort']();}}catch(_0x1afb61){handleError(_0x4d534b[_0xab90('0x4c')][_0x55e1e1],{'code':_0xab90('0x61'),'message':_0x1afb61[_0xab90('0x3d')]});logger[_0xab90('0x39')](_0xab90('0x62'),_0x1afb61[_0xab90('0x3d')]);}},'complete':function(){try{var _0x425f44=[];var _0xc3a9e5=_0xab90('0x22');if(_0xda9abf[_0xab90('0x63')]&&_0xda9abf[_0xab90('0x63')][_0xab90('0x4a')]){_0xc3a9e5=_0xab90('0x64')+_0x1b79be;_0x425f44[_0xab90('0x3b')](_0xab90('0x65')+_0xc3a9e5+_0xab90('0x66'));}var _0x385a3c=util[_0xab90('0x8')](_0xab90('0x67'),_0x1de020,_0xc3a9e5,_0x1d9dfc,_0xda9abf[_0xab90('0x2e')],_0xda9abf[_0xab90('0x34')]||null,NOW,NOW);if(_['isNil'](_0x45e038[_0xab90('0x1c')])){_0x385a3c+=',\x20scheduledAt\x20=\x20NOW()';}_0x425f44[_0xab90('0x3b')](_0x385a3c);if(_0xda9abf[_0xab90('0x63')]&&_0xda9abf['duplicates'][_0xab90('0x4a')]){_0x425f44[_0xab90('0x3b')](insertCmContact(_0xda9abf[_0xab90('0x2e')],_0xc3a9e5,_0xda9abf[_0xab90('0x63')],_0x45e038));_0x425f44[_0xab90('0x3b')]('DROP\x20TABLE\x20'+_0xc3a9e5+';');}_0x425f44[_0xab90('0x3b')](insertCmHopper(_0xda9abf[_0xab90('0x2e')],_0xab90('0x68'),_0xab90('0x69'),'VoiceQueueId',_0x57082f));_0x425f44[_0xab90('0x3b')](insertCmHopperBlack(_0xda9abf[_0xab90('0x2e')],_0xab90('0x6a'),_0xab90('0x69'),_0xab90('0x6b')));_0x425f44['push'](insertCmHopper(_0xda9abf[_0xab90('0x2e')],_0xab90('0x6c'),_0xab90('0x6d'),'CampaignId',_0x57082f));_0x425f44[_0xab90('0x3b')](insertCmHopperBlack(_0xda9abf['ListId'],_0xab90('0x6e'),_0xab90('0x6d'),_0xab90('0x6f')));BPromise[_0xab90('0x70')](_0x425f44,handleQuery)[_0xab90('0x71')](function(_0x617352){stats[_0xab90('0x72')]=!![];stats[_0xab90('0x73')]=_0xda9abf[_0xab90('0x63')]&&_0xda9abf[_0xab90('0x63')][_0xab90('0x4a')]?results[0x2][_0xab90('0x73')]:results[0x0]['affectedRows'];socket[_0xab90('0x5e')](_0xab90('0x5f')+_0x1b79be,stats);fs[_0xab90('0x74')](_0x28213d);fs[_0xab90('0x74')](_0x1de020);process['exit'](0x0);})[_0xab90('0x40')](function(_0x4a5d78){logger[_0xab90('0x39')](_0x4a5d78[_0xab90('0x3d')]);process[_0xab90('0x75')](0x1);});}catch(_0x224e5a){logger[_0xab90('0x39')](_0xab90('0x76'),_0x224e5a[_0xab90('0x3d')]);process[_0xab90('0x75')](0x1);}},'error':function(_0x27fa8,_0x4e5099,_0x3bdbce,_0x18553d){throw new Error(_0x18553d);}});}function validate(){if(process[_0xab90('0x77')]&&process['argv'][_0xab90('0x4a')]<0x4){throw new Error(_0xab90('0x78'));}var _0x1298cf=path['join'](config[_0xab90('0x44')],_0xab90('0x79'),process['argv'][0x2]);if(!fs[_0xab90('0x7a')](_0x1298cf)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x679d56={};try{_0x679d56=JSON[_0xab90('0x48')](process[_0xab90('0x77')][0x3]);if(!_0x679d56[_0xab90('0x42')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x679d56['binding'][_0xab90('0xd')]){throw new Error(_0xab90('0x7b'));}if(!_0x679d56['binding'][_0xab90('0x59')]){throw new Error(_0xab90('0x7c'));}var _0x257554=0x0;if(_0x679d56['binding'][_0xab90('0x7d')]){_0x257554=0x1;}if(!_0x679d56[_0xab90('0x2e')]){throw new Error(_0xab90('0x7e'));}}catch(_0x50bde4){throw new Error('body\x20id\x20mandatory');}var _0x5dc558=[];try{_0x5dc558=_[_0xab90('0x7f')](JSON['parse'](process[_0xab90('0x77')][0x4]),'id');}catch(_0x468e02){logger[_0xab90('0x38')](_0xab90('0x80'));}main(_0x1298cf,_0x679d56,_0x5dc558,_0x257554);}validate();process['on'](_0xab90('0x81'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xb996=['cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','ListId','priority','UserId','recallme','join','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','updatedAt','fields','ListId\x20=\x20?','\x20=\x20?','keys','createdAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','error','exit','errors','push','message','sequelize','spread','catch','send','start','binding','socket_timestamp','root','.csv','header','writeFileSync','parse','createReadStream','data','length','hasOwnProperty','replace','isNaN','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','rows','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','format','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','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','CampaignId','each','then','finish','affectedRows','emit','unlink','complete','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','import','defaults','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','select','field','phone','from','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone'];(function(_0x54cf83,_0x16469b){var _0x4fcc27=function(_0x35fb21){while(--_0x35fb21){_0x54cf83['push'](_0x54cf83['shift']());}};_0x4fcc27(++_0x16469b);}(_0xb996,0x179));var _0x6b99=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xb996[_0x37c22c];return _0x119d79;};'use strict';var fs=require('fs');var path=require(_0x6b99('0x0'));var _=require(_0x6b99('0x1'));var Papa=require(_0x6b99('0x2'));var util=require('util');var BPromise=require(_0x6b99('0x3'));var moment=require(_0x6b99('0x4'));var squel=require(_0x6b99('0x5'));var Redis=require(_0x6b99('0x6'));var db=require(_0x6b99('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x6b99('0x8'));config['redis']=_[_0x6b99('0x9')](config[_0x6b99('0xa')],{'host':_0x6b99('0xb'),'port':0x18eb});var socket=require(_0x6b99('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()['format'](_0x6b99('0xd'));function isEmail(_0xd4001a){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'](_0xd4001a);}function selectNotIn(_0x1e2c1c,_0x279c44,_0x34bbb2,_0x46ae8f,_0x361bd7){return squel[_0x6b99('0xe')]()[_0x6b99('0xf')](_0x6b99('0x10'))[_0x6b99('0x11')](_0x46ae8f)['join'](_0x279c44,null,_0x279c44+_0x6b99('0x12')+_0x46ae8f+'.'+_0x34bbb2)[_0x6b99('0x13')](_0x46ae8f+'.'+_0x34bbb2+'\x20=\x20'+_0x1e2c1c+'.'+_0x34bbb2)[_0x6b99('0x13')](_0x279c44+_0x6b99('0x14')+_0x361bd7['join']()+')');}function insertCmHopper(_0x294e39,_0x24564b,_0x3e7d3f,_0x1becaf,_0x276e2c){var _0x485ebf=[_0x6b99('0x15'),'cm_contacts.scheduledat',_0x6b99('0x16'),_0x6b99('0x17'),_0x24564b+'.'+_0x1becaf,_0x6b99('0x18'),'cm_contacts.updatedAt',_0x6b99('0x19'),'cm_contacts.UserId','\x22'+_0x276e2c+'\x22'];return squel[_0x6b99('0x1a')]()[_0x6b99('0x1b')](_0x6b99('0x1c'))['fromQuery'](['phone',_0x6b99('0x1d'),_0x6b99('0x1e'),_0x6b99('0x1f'),_0x1becaf,'createdAt','updatedAt',_0x6b99('0x20'),_0x6b99('0x21'),_0x6b99('0x22')],squel[_0x6b99('0xe')]()['fields'](_0x485ebf)[_0x6b99('0x11')](_0x24564b)[_0x6b99('0x23')](_0x6b99('0x24'),null,_0x6b99('0x25')+_0x24564b+_0x6b99('0x26'))['join'](_0x3e7d3f,null,_0x3e7d3f+'.id\x20=\x20'+_0x24564b+'.'+_0x1becaf)['where'](_0x24564b+_0x6b99('0x27'),_0x294e39)['where'](_0x6b99('0x28'),NOW)[_0x6b99('0x13')](_0x6b99('0x29'),selectNotIn(_0x24564b,_0x3e7d3f,_0x1becaf,_0x6b99('0x1c'),[_0x6b99('0x2a'),_0x6b99('0x2b')]))[_0x6b99('0x13')](_0x6b99('0x29'),selectNotIn(_0x24564b,_0x3e7d3f,_0x1becaf,_0x6b99('0x1c'),[_0x6b99('0x2a')])))[_0x6b99('0x2c')]();}function insertCmHopperBlack(_0x33aa50,_0x313435,_0x21767f,_0x349127){var _0x383910=['cm_contacts.phone',_0x6b99('0x16'),_0x6b99('0x17'),_0x313435+'.'+_0x349127,_0x6b99('0x18'),'cm_contacts.updatedAt'];return squel[_0x6b99('0x1a')]()['into'](_0x6b99('0x2d'))[_0x6b99('0x2e')]([_0x6b99('0x10'),'ContactId',_0x6b99('0x1f'),_0x349127,'createdAt',_0x6b99('0x2f')],squel['select']()[_0x6b99('0x30')](_0x383910)['from'](_0x313435)['join'](_0x6b99('0x24'),null,_0x6b99('0x25')+_0x313435+'.CmListId')[_0x6b99('0x23')](_0x21767f,null,_0x21767f+_0x6b99('0x12')+_0x313435+'.'+_0x349127)[_0x6b99('0x13')](_0x313435+_0x6b99('0x27'),_0x33aa50)[_0x6b99('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x6b99('0x13')](_0x6b99('0x29'),squel[_0x6b99('0xe')]()['field']('phone')['from']('cm_hopper_black')['where'](_0x6b99('0x31'),_0x33aa50)['where'](_0x349127+_0x6b99('0x32'),_0x313435+'.'+_0x349127)))[_0x6b99('0x2c')]();}function insertCmContact(_0x35edba,_0x1f4ca0,_0x200fc2,_0x328b8f){var _0x4e9dd9=_['concat'](_[_0x6b99('0x33')](_0x328b8f),[_0x6b99('0x1f'),'CompanyId',_0x6b99('0x34'),_0x6b99('0x2f')]);return squel[_0x6b99('0x1a')]()[_0x6b99('0x1b')](_0x6b99('0x24'))[_0x6b99('0x2e')](_0x4e9dd9,squel[_0x6b99('0xe')]()[_0x6b99('0x30')](_0x4e9dd9)[_0x6b99('0x11')](_0x1f4ca0)['where']('('+_0x200fc2['join'](',')+_0x6b99('0x35'),squel[_0x6b99('0xe')]()[_0x6b99('0x30')](_0x200fc2)[_0x6b99('0x11')](_0x6b99('0x24'))[_0x6b99('0x13')](_0x6b99('0x31'),_0x35edba)[_0x6b99('0x13')](_0x6b99('0x36')))['where'](_0x6b99('0x37'),squel[_0x6b99('0xe')]()[_0x6b99('0xf')](_0x6b99('0x38'),_0x6b99('0x39'))[_0x6b99('0x11')](_0x1f4ca0)[_0x6b99('0x3a')](_0x200fc2['join'](','))))['toString']();}function handleStop(){logger[_0x6b99('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x18ebc6){logger[_0x6b99('0x3c')](_0x18ebc6['message']);process[_0x6b99('0x3d')](0x1);}function handleError(_0x3d8a54,_0x126760){stats[_0x6b99('0x3e')][_0x6b99('0x3f')]({'name':_0x126760['code'],'message':_0x126760[_0x6b99('0x40')],'row':_0x3d8a54});}function handleQuery(_0x244de9){logger[_0x6b99('0x3b')](_0x244de9);return db[_0x6b99('0x41')]['query'](_0x244de9)[_0x6b99('0x42')](function(_0x36c686){results[_0x6b99('0x3f')](_0x36c686);})[_0x6b99('0x43')](function(_0x319121){logger[_0x6b99('0x3c')](_0x319121[_0x6b99('0x40')]);});}function main(_0x25e511,_0x5666ea,_0x1316cb,_0x5a315c){logger[_0x6b99('0x3b')]('main',_0x25e511,JSON['stringify'](_0x5666ea));process[_0x6b99('0x44')](_0x6b99('0x45'));var _0x45def3=_0x5666ea[_0x6b99('0x46')];var _0x5c42ea=_0x5666ea[_0x6b99('0x47')];var _0xdb8f1f=path[_0x6b99('0x23')](config[_0x6b99('0x48')],'server/files/tmp',_0x5c42ea+_0x6b99('0x49'));var _0x52fab5=_[_0x6b99('0x33')](_0x45def3)['join']();logger[_0x6b99('0x3b')](_0x6b99('0x4a'),_0x52fab5);fs[_0x6b99('0x4b')](_0xdb8f1f,_0x52fab5+'\x0a');Papa[_0x6b99('0x4c')](fs[_0x6b99('0x4d')](_0x25e511),{'header':!![],'skipEmptyLines':!![],'step':function(_0x99360e,_0x404118){try{for(var _0xc5516d=0x0,_0x1a90f6=[];_0xc5516d<_0x99360e[_0x6b99('0x4e')][_0x6b99('0x4f')];_0xc5516d++){stats['rows']+=0x1;if(_0x99360e['errors'][_0xc5516d]){handleError(_0x99360e['data'][_0xc5516d],_0x99360e[_0x6b99('0x3e')][_0xc5516d]);}else{var _0x5e61ff=[];for(var _0x140ba2 in _0x45def3){if(_0x45def3[_0x6b99('0x50')](_0x140ba2)){if(_0x99360e[_0x6b99('0x4e')][_0xc5516d][_0x45def3[_0x140ba2]]){var _0xd08f0e=_['trim'](_0x99360e[_0x6b99('0x4e')][_0xc5516d][_0x45def3[_0x140ba2]][_0x6b99('0x51')](/"/g,'\x27'));switch(_0x140ba2){case _0x6b99('0x1d'):var _0x27602b=moment(_0xd08f0e,_0x6b99('0xd'),!![]);if(_0x27602b['isValid']()){_0x1a90f6['push']('\x22'+_0xd08f0e+'\x22');}else{_0x5e61ff['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x18f4eb=parseInt(_0xd08f0e);_0xd08f0e=_[_0x6b99('0x52')](_0x18f4eb)||_0x18f4eb<0x0||_0x18f4eb>0x4?_0x5a315c?0x3:0x2:_0x18f4eb;_0x1a90f6[_0x6b99('0x3f')]('\x22'+_0xd08f0e+'\x22');break;case'UserId':var _0x5c25df=parseInt(_0xd08f0e);if(_['isNumber'](_0x5c25df)&&_['includes'](_0x1316cb,_0x5c25df)){_0x1a90f6[_0x6b99('0x3f')]('\x22'+_0x5c25df+'\x22');}else{_0x5e61ff[_0x6b99('0x3f')]('agent\x20not\x20exists');}break;case _0x6b99('0x53'):if(isEmail(_0xd08f0e)){_0x1a90f6[_0x6b99('0x3f')]('\x22'+_0xd08f0e+'\x22');}else{_0x5e61ff[_0x6b99('0x3f')](_0x6b99('0x54'));}break;case _0x6b99('0x55'):var _0x533c12=moment(_0xd08f0e,_0x6b99('0x56'),!![]);if(_0x533c12[_0x6b99('0x57')]()){_0x1a90f6[_0x6b99('0x3f')]('\x22'+_0xd08f0e+'\x22');}else{_0x5e61ff[_0x6b99('0x3f')](_0x6b99('0x58'));}break;default:_0x1a90f6[_0x6b99('0x3f')]('\x22'+_0xd08f0e+'\x22');}}else{switch(_0x140ba2){case'firstName':case _0x6b99('0x10'):_0x5e61ff[_0x6b99('0x3f')](_0x140ba2+_0x6b99('0x59'));break;default:_0x1a90f6['push']('\x22\x22');}}}}if(_0x5e61ff['length']){handleError(_0x99360e[_0x6b99('0x4e')][_0xc5516d],{'code':_0x6b99('0x5a'),'message':_0x5e61ff[_0x6b99('0x23')]()});}else{fs['appendFileSync'](_0xdb8f1f,_0x1a90f6['join']()+'\x0a');}_0x1a90f6=[];}if(!(stats[_0x6b99('0x5b')]%0xc8)){socket['emit'](_0x6b99('0x5c')+_0x5c42ea,stats);stats[_0x6b99('0x3e')]=[];}}if(stopped){logger['info'](_0x6b99('0x5d'));_0x404118[_0x6b99('0x5e')]();}}catch(_0x48d8de){handleError(_0x99360e['data'][_0xc5516d],{'code':_0x6b99('0x5f'),'message':_0x48d8de[_0x6b99('0x40')]});logger[_0x6b99('0x3c')](_0x6b99('0x60'),_0x48d8de[_0x6b99('0x40')]);}},'complete':function(){try{var _0x495ad4=[];var _0x250357=_0x6b99('0x24');if(_0x5666ea[_0x6b99('0x61')]&&_0x5666ea[_0x6b99('0x61')]['length']){_0x250357=_0x6b99('0x62')+_0x5c42ea;_0x495ad4[_0x6b99('0x3f')](_0x6b99('0x63')+_0x250357+'\x20LIKE\x20cm_contacts;');}var _0xc9ddf5=util[_0x6b99('0x64')](_0x6b99('0x65'),_0xdb8f1f,_0x250357,_0x52fab5,_0x5666ea[_0x6b99('0x1f')],_0x5666ea[_0x6b99('0x66')]||null,NOW,NOW);if(_[_0x6b99('0x67')](_0x45def3['scheduledat'])){_0xc9ddf5+=_0x6b99('0x68');}_0x495ad4[_0x6b99('0x3f')](_0xc9ddf5);if(_0x5666ea['duplicates']&&_0x5666ea[_0x6b99('0x61')]['length']){_0x495ad4[_0x6b99('0x3f')](insertCmContact(_0x5666ea[_0x6b99('0x1f')],_0x250357,_0x5666ea[_0x6b99('0x61')],_0x45def3));_0x495ad4[_0x6b99('0x3f')]('DROP\x20TABLE\x20'+_0x250357+';');}_0x495ad4[_0x6b99('0x3f')](insertCmHopper(_0x5666ea[_0x6b99('0x1f')],_0x6b99('0x69'),_0x6b99('0x6a'),'VoiceQueueId',_0x5a315c));_0x495ad4[_0x6b99('0x3f')](insertCmHopperBlack(_0x5666ea['ListId'],_0x6b99('0x6b'),_0x6b99('0x6a'),_0x6b99('0x6c')));_0x495ad4[_0x6b99('0x3f')](insertCmHopper(_0x5666ea[_0x6b99('0x1f')],_0x6b99('0x6d'),_0x6b99('0x6e'),'CampaignId',_0x5a315c));_0x495ad4[_0x6b99('0x3f')](insertCmHopperBlack(_0x5666ea[_0x6b99('0x1f')],_0x6b99('0x6f'),'campaigns',_0x6b99('0x70')));BPromise[_0x6b99('0x71')](_0x495ad4,handleQuery)[_0x6b99('0x72')](function(_0x3688b9){stats[_0x6b99('0x73')]=!![];stats[_0x6b99('0x74')]=_0x5666ea[_0x6b99('0x61')]&&_0x5666ea[_0x6b99('0x61')]['length']?results[0x2][_0x6b99('0x74')]:results[0x0]['affectedRows'];socket[_0x6b99('0x75')](_0x6b99('0x5c')+_0x5c42ea,stats);fs[_0x6b99('0x76')](_0x25e511);fs['unlink'](_0xdb8f1f);process[_0x6b99('0x3d')](0x0);})[_0x6b99('0x43')](function(_0x1fd848){logger[_0x6b99('0x3c')](_0x1fd848[_0x6b99('0x40')]);process[_0x6b99('0x3d')](0x1);});}catch(_0x564c9f){logger[_0x6b99('0x3c')](_0x6b99('0x77'),_0x564c9f[_0x6b99('0x40')]);process[_0x6b99('0x3d')](0x1);}},'error':function(_0x46a21d,_0x1edc83,_0x22cb04,_0x534ae1){throw new Error(_0x534ae1);}});}function validate(){if(process[_0x6b99('0x78')]&&process[_0x6b99('0x78')]['length']<0x4){throw new Error(_0x6b99('0x79'));}var _0x2fde93=path['join'](config['root'],_0x6b99('0x7a'),process[_0x6b99('0x78')][0x2]);if(!fs[_0x6b99('0x7b')](_0x2fde93)){throw new Error(_0x6b99('0x7c'));}var _0x143390={};try{_0x143390=JSON[_0x6b99('0x4c')](process[_0x6b99('0x78')][0x3]);if(!_0x143390[_0x6b99('0x46')]){throw new Error(_0x6b99('0x7d'));}if(!_0x143390[_0x6b99('0x46')]['phone']){throw new Error(_0x6b99('0x7e'));}if(!_0x143390[_0x6b99('0x46')][_0x6b99('0x7f')]){throw new Error(_0x6b99('0x80'));}var _0x1ccbab=0x0;if(_0x143390[_0x6b99('0x46')]['UserId']){_0x1ccbab=0x1;}if(!_0x143390[_0x6b99('0x1f')]){throw new Error(_0x6b99('0x81'));}}catch(_0x5a81e6){throw new Error(_0x6b99('0x82'));}var _0x35b524=[];try{_0x35b524=_[_0x6b99('0x83')](JSON[_0x6b99('0x4c')](process[_0x6b99('0x78')][0x4]),'id');}catch(_0x3c0bef){logger[_0x6b99('0x3b')]('No\x20agent\x20available');}main(_0x2fde93,_0x143390,_0x35b524,_0x1ccbab);}validate();process['on'](_0x6b99('0x84'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 162894e..f06148b 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb867=['string','toLowerCase','voice','push','variable','queue','calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','destexten','UniqueId','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','Hold\x20Time','Talk\x20Time','Member\x20Name','membername','uniqueid','starttime','Answer\x20Time','answertime','Complete\x20Time','Billable\x20Time'];(function(_0x5304e0,_0x37cb64){var _0x2660b7=function(_0x253c50){while(--_0x253c50){_0x5304e0['push'](_0x5304e0['shift']());}};_0x2660b7(++_0x37cb64);}(_0xb867,0x15e));var _0x7b86=function(_0x2ed827,_0x1e6d3f){_0x2ed827=_0x2ed827-0x0;var _0x99e17e=_0xb867[_0x2ed827];return _0x99e17e;};'use strict';exports['getSubjects']=function(_0x5e5f4f,_0x84ffe3){var _0x44d2f2=[{'type':_0x7b86('0x0'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x5e5f4f[_0x7b86('0x1')]()){case _0x7b86('0x2'):switch(_0x84ffe3[_0x7b86('0x1')]()){case'inbound':_0x44d2f2[_0x7b86('0x3')]({'type':_0x7b86('0x4'),'content':'','variableName':_0x7b86('0x5')});_0x44d2f2[_0x7b86('0x3')]({'type':'variable','content':'','variableName':_0x7b86('0x6')});break;case _0x7b86('0x7'):_0x44d2f2[_0x7b86('0x3')]({'type':_0x7b86('0x0'),'content':_0x7b86('0x8'),'variableName':null});_0x44d2f2[_0x7b86('0x3')]({'type':_0x7b86('0x4'),'content':'','variableName':'destcalleridnum'});break;}}return _0x44d2f2;};exports['getDescriptions']=function(_0x56db54,_0x308089){var _0x4fe6a3=[];switch(_0x56db54[_0x7b86('0x1')]()){case'voice':switch(_0x308089[_0x7b86('0x1')]()){case'inbound':_0x4fe6a3=[{'type':_0x7b86('0x0'),'content':_0x7b86('0x9'),'key':null,'keyType':null,'variableName':null},{'type':_0x7b86('0xa'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x7b86('0x6')},{'type':_0x7b86('0xa'),'content':'','key':'Caller\x20Name','keyType':_0x7b86('0x4'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':'Call\x20To','keyType':'variable','variableName':_0x7b86('0xb')},{'type':_0x7b86('0xa'),'content':'','key':'Queue','keyType':_0x7b86('0x4'),'variableName':_0x7b86('0x5')},{'type':'keyValue','content':'','key':_0x7b86('0xc'),'keyType':_0x7b86('0x4'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x7b86('0xd'),'keyType':'variable','variableName':_0x7b86('0xe')},{'type':_0x7b86('0x0'),'content':_0x7b86('0xf'),'key':null,'keyType':null,'variableName':null},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x10'),'keyType':_0x7b86('0x4'),'variableName':_0x7b86('0x11')},{'type':'keyValue','content':'','key':_0x7b86('0x12'),'keyType':_0x7b86('0x4'),'variableName':_0x7b86('0x13')},{'type':_0x7b86('0x0'),'content':_0x7b86('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x7b86('0x15'),'keyType':_0x7b86('0x4'),'variableName':'agentcalledAt'},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x16'),'keyType':_0x7b86('0x4'),'variableName':_0x7b86('0x17')},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x18'),'keyType':_0x7b86('0x4'),'variableName':'agentcompleteAt'},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x19'),'keyType':_0x7b86('0x4'),'variableName':'holdtime'},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x1a'),'keyType':'variable','variableName':'talktime'}];break;case _0x7b86('0x7'):_0x4fe6a3=[{'type':_0x7b86('0x0'),'content':_0x7b86('0x9'),'variableName':null},{'type':_0x7b86('0xa'),'content':'','key':'Called\x20Number','keyType':_0x7b86('0x4'),'keyContent':'','variableName':_0x7b86('0x13')},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x1b'),'keyType':_0x7b86('0x4'),'keyContent':'','variableName':_0x7b86('0x1c')},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0xc'),'keyType':'variable','keyContent':'','variableName':_0x7b86('0x1d')},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0xd'),'keyType':_0x7b86('0x4'),'keyContent':'','variableName':_0x7b86('0x1e')},{'type':'string','content':'***\x20Time\x20Info\x20***'},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x1f'),'keyType':'variable','keyContent':'','variableName':_0x7b86('0x20')},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x21'),'keyType':_0x7b86('0x4'),'keyContent':'','variableName':'endtime'},{'type':_0x7b86('0xa'),'content':'','key':'Duration','keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x7b86('0xa'),'content':'','key':_0x7b86('0x22'),'keyType':'variable','keyContent':'','variableName':'billableseconds'}];break;}}return _0x4fe6a3;}; \ No newline at end of file +var _0xb237=['Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','Hold\x20Time','holdtime','talktime','***\x20Call\x20Info\x20***','Called\x20Number','Member\x20Name','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','outbound','Outbound\x20Call','getDescriptions','string','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','uniqueid','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','destcalleridnum'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb237,0xf1));var _0x7b23=function(_0x4713df,_0x2b0887){_0x4713df=_0x4713df-0x0;var _0x3f70e2=_0xb237[_0x4713df];return _0x3f70e2;};'use strict';exports['getSubjects']=function(_0x511292,_0x27ff11){var _0x2b7bdc=[{'type':'string','content':_0x7b23('0x0'),'variableName':null}];switch(_0x511292['toLowerCase']()){case _0x7b23('0x1'):switch(_0x27ff11[_0x7b23('0x2')]()){case _0x7b23('0x3'):_0x2b7bdc[_0x7b23('0x4')]({'type':_0x7b23('0x5'),'content':'','variableName':_0x7b23('0x6')});_0x2b7bdc['push']({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x7b23('0x7'):_0x2b7bdc['push']({'type':'string','content':_0x7b23('0x8'),'variableName':null});_0x2b7bdc['push']({'type':_0x7b23('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x2b7bdc;};exports[_0x7b23('0x9')]=function(_0x9afe4,_0x1232d4){var _0x309009=[];switch(_0x9afe4[_0x7b23('0x2')]()){case _0x7b23('0x1'):switch(_0x1232d4['toLowerCase']()){case _0x7b23('0x3'):_0x309009=[{'type':_0x7b23('0xa'),'content':'***\x20Call\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0xc'),'keyType':_0x7b23('0x5'),'variableName':'calleridnum'},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0xd'),'keyType':_0x7b23('0x5'),'variableName':_0x7b23('0xe')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0xf'),'keyType':_0x7b23('0x5'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0x7b23('0x10'),'keyType':_0x7b23('0x5'),'variableName':_0x7b23('0x6')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x11'),'keyType':'variable','variableName':_0x7b23('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':_0x7b23('0x5'),'variableName':'agentcalledAt'},{'type':'string','content':_0x7b23('0x13'),'key':null,'keyType':null,'variableName':null},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x14'),'keyType':_0x7b23('0x5'),'variableName':'destcalleridname'},{'type':'keyValue','content':'','key':_0x7b23('0x15'),'keyType':_0x7b23('0x5'),'variableName':_0x7b23('0x16')},{'type':_0x7b23('0xa'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x17'),'keyType':'variable','variableName':_0x7b23('0x18')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x19'),'keyType':'variable','variableName':'agentconnectAt'},{'type':'keyValue','content':'','key':_0x7b23('0x1a'),'keyType':'variable','variableName':'agentcompleteAt'},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x1b'),'keyType':'variable','variableName':_0x7b23('0x1c')},{'type':_0x7b23('0xb'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0x7b23('0x1d')}];break;case _0x7b23('0x7'):_0x309009=[{'type':_0x7b23('0xa'),'content':_0x7b23('0x1e'),'variableName':null},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x1f'),'keyType':'variable','keyContent':'','variableName':'destcalleridnum'},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x20'),'keyType':_0x7b23('0x5'),'keyContent':'','variableName':_0x7b23('0x21')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x11'),'keyType':_0x7b23('0x5'),'keyContent':'','variableName':_0x7b23('0x12')},{'type':_0x7b23('0xb'),'content':'','key':'Date','keyType':_0x7b23('0x5'),'keyContent':'','variableName':_0x7b23('0x22')},{'type':_0x7b23('0xa'),'content':_0x7b23('0x23')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x24'),'keyType':_0x7b23('0x5'),'keyContent':'','variableName':_0x7b23('0x25')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x26'),'keyType':'variable','keyContent':'','variableName':_0x7b23('0x27')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x28'),'keyType':_0x7b23('0x5'),'keyContent':'','variableName':_0x7b23('0x29')},{'type':_0x7b23('0xb'),'content':'','key':_0x7b23('0x2a'),'keyType':_0x7b23('0x5'),'keyContent':'','variableName':_0x7b23('0x2b')}];break;}}return _0x309009;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 06e0186..02abb10 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x064e=['mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','upperFirst','InteractionId','unknown','toLowerCase','name','role','stringify','null','Interaction','findOne','then','info','error','tracked','user','clone','body','omit','html','fax','mobile','lodash','../../mysqldb','../../config/logger','openchannel-interactions'];(function(_0x21ee11,_0x172225){var _0xb4c64e=function(_0x157c8f){while(--_0x157c8f){_0x21ee11['push'](_0x21ee11['shift']());}};_0xb4c64e(++_0x172225);}(_0x064e,0xaa));var _0xe064=function(_0x17290a,_0x2a6891){_0x17290a=_0x17290a-0x0;var _0x2fd1f4=_0x064e[_0x17290a];return _0x2fd1f4;};'use strict';var _=require(_0xe064('0x0'));var db=require(_0xe064('0x1'))['db'];var loggers={'openchannel':require(_0xe064('0x2'))(_0xe064('0x3')),'mail':require(_0xe064('0x2'))(_0xe064('0x4')),'fax':require(_0xe064('0x2'))(_0xe064('0x5')),'sms':require('../../config/logger')('sms-interactions'),'chat':require(_0xe064('0x2'))(_0xe064('0x6')),'whatsapp':require('../../config/logger')(_0xe064('0x7'))};function getInteractionId(_0xa0f1e1,_0x5f083f,_0x360ba0){if(_0xa0f1e1&&_0xa0f1e1[_[_0xe064('0x8')](_0x360ba0)+_0xe064('0x9')]){return _0xa0f1e1[_[_0xe064('0x8')](_0x360ba0)+_0xe064('0x9')];}else if(_0xa0f1e1&&_0xa0f1e1['id']){return _0xa0f1e1['id'];}else if(_0x5f083f&&_0x5f083f['id']){return _0x5f083f['id'];}else{return _0xe064('0xa');}}function log(_0x249dc8,_0x4afeb2,_0x38ef00,_0x2fba1f,_0xccd8b7,_0x3afc60){loggers[_0xccd8b7[_0xe064('0xb')]()][_0x249dc8]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3afc60['toUpperCase'](),_0x4afeb2?_0x4afeb2['id']:null,_0x4afeb2?_0x4afeb2[_0xe064('0xc')]:null,_0x4afeb2?_0x4afeb2[_0xe064('0xd')]:null,getInteractionId(_0x38ef00,_0x2fba1f,_0xccd8b7),_0x38ef00?JSON[_0xe064('0xe')](_0x38ef00):_0xe064('0xf'));}function updateUser(_0x43c131,_0x1c29b2,_0x217196,_0x3b1b7e,_0x28e2e4){db[_[_0xe064('0x8')](_0x3b1b7e)+_0xe064('0x10')][_0xe064('0x11')]({'where':{'id':getInteractionId(_0x1c29b2,_0x217196,_0x3b1b7e)}})[_0xe064('0x12')](function(_0x2c7d83){if(_0x2c7d83){return _0x2c7d83['update']({'UserId':_0x43c131?_0x43c131['id']:null});}})[_0xe064('0x12')](function(_0x5eda8a){if(_0x5eda8a){log(_0xe064('0x13'),_0x43c131,_0x1c29b2,_0x217196,_0x3b1b7e,_0x28e2e4);}})['catch'](function(){log(_0xe064('0x14'),_0x43c131,_0x1c29b2,_0x217196,_0x3b1b7e,_0x28e2e4);});}exports[_0xe064('0x15')]=function(_0x5bd30b,_0x2d1697){return function(_0x156978,_0x2990d8,_0x881e3c){var _0x1d2288=_0x156978[_0xe064('0x16')];var _0x567d05={};var _0x185c02=_0x156978['query'];if(_0x567d05){_0x567d05=_[_0xe064('0x17')](_0x156978[_0xe064('0x18')]);_0x567d05=_[_0xe064('0x19')](_0x567d05,[_0xe064('0x18'),_0xe064('0x1a'),'phone',_0xe064('0x1b'),_0xe064('0x1c')]);}updateUser(_0x1d2288,_0x567d05,_0x185c02,_0x5bd30b,_0x2d1697);_0x881e3c(null);};}; \ No newline at end of file +var _0x56de=['fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','Interaction','findOne','then','update','info','catch','user','query','clone','body','omit','html','phone','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions'];(function(_0x3cf392,_0x4f215c){var _0x543dac=function(_0x113355){while(--_0x113355){_0x3cf392['push'](_0x3cf392['shift']());}};_0x543dac(++_0x4f215c);}(_0x56de,0x98));var _0xe56d=function(_0x428c7f,_0x3b6302){_0x428c7f=_0x428c7f-0x0;var _0xca72fe=_0x56de[_0x428c7f];return _0xca72fe;};'use strict';var _=require('lodash');var db=require(_0xe56d('0x0'))['db'];var loggers={'openchannel':require(_0xe56d('0x1'))(_0xe56d('0x2')),'mail':require(_0xe56d('0x1'))(_0xe56d('0x3')),'fax':require(_0xe56d('0x1'))(_0xe56d('0x4')),'sms':require(_0xe56d('0x1'))(_0xe56d('0x5')),'chat':require(_0xe56d('0x1'))('chat-interactions'),'whatsapp':require(_0xe56d('0x1'))('whatsapp-interactions')};function getInteractionId(_0x3b2853,_0x26afe8,_0x5d0bff){if(_0x3b2853&&_0x3b2853[_[_0xe56d('0x6')](_0x5d0bff)+'InteractionId']){return _0x3b2853[_[_0xe56d('0x6')](_0x5d0bff)+_0xe56d('0x7')];}else if(_0x3b2853&&_0x3b2853['id']){return _0x3b2853['id'];}else if(_0x26afe8&&_0x26afe8['id']){return _0x26afe8['id'];}else{return _0xe56d('0x8');}}function log(_0x3796ca,_0x4ff0ca,_0x2f9dd5,_0x37c337,_0xba248d,_0x477fed){loggers[_0xba248d[_0xe56d('0x9')]()][_0x3796ca](_0xe56d('0xa'),_0x477fed['toUpperCase'](),_0x4ff0ca?_0x4ff0ca['id']:null,_0x4ff0ca?_0x4ff0ca['name']:null,_0x4ff0ca?_0x4ff0ca[_0xe56d('0xb')]:null,getInteractionId(_0x2f9dd5,_0x37c337,_0xba248d),_0x2f9dd5?JSON[_0xe56d('0xc')](_0x2f9dd5):'null');}function updateUser(_0x143aa3,_0x5f0d96,_0x3d3c56,_0x1fc33d,_0x8c8016){db[_['upperFirst'](_0x1fc33d)+_0xe56d('0xd')][_0xe56d('0xe')]({'where':{'id':getInteractionId(_0x5f0d96,_0x3d3c56,_0x1fc33d)}})[_0xe56d('0xf')](function(_0x1f4dca){if(_0x1f4dca){return _0x1f4dca[_0xe56d('0x10')]({'UserId':_0x143aa3?_0x143aa3['id']:null});}})[_0xe56d('0xf')](function(_0x17a668){if(_0x17a668){log(_0xe56d('0x11'),_0x143aa3,_0x5f0d96,_0x3d3c56,_0x1fc33d,_0x8c8016);}})[_0xe56d('0x12')](function(){log('error',_0x143aa3,_0x5f0d96,_0x3d3c56,_0x1fc33d,_0x8c8016);});}exports['tracked']=function(_0x7b4a2,_0x24f42a){return function(_0x26c6a4,_0xfee32e,_0x134718){var _0x1cc660=_0x26c6a4[_0xe56d('0x13')];var _0x3710c0={};var _0x1c8048=_0x26c6a4[_0xe56d('0x14')];if(_0x3710c0){_0x3710c0=_[_0xe56d('0x15')](_0x26c6a4[_0xe56d('0x16')]);_0x3710c0=_[_0xe56d('0x17')](_0x3710c0,[_0xe56d('0x16'),_0xe56d('0x18'),_0xe56d('0x19'),'fax','mobile']);}updateUser(_0x1cc660,_0x3710c0,_0x1c8048,_0x7b4a2,_0x24f42a);_0x134718(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9b57ec7..ed78753 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 _0xc267=['hasOwnProperty','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','isUserLimit','crypto','util','../../config/environment','license','data1','split','createDecipher','format','update','base64','utf8','final','parse'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0xc267,0x14c));var _0x7c26=function(_0xc36b9d,_0x72da4){_0xc36b9d=_0xc36b9d-0x0;var _0x2e3867=_0xc267[_0xc36b9d];return _0x2e3867;};'use strict';var crypto=require(_0x7c26('0x0'));var util=require(_0x7c26('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x7c26('0x2'));function getValueFromLicense(_0x2a821f,_0x1ce1fe){if(_0x2a821f&&_0x1ce1fe){if(_0x1ce1fe['data1']&&_0x1ce1fe[_0x7c26('0x3')]){var _0x5558f3=_0x1ce1fe[_0x7c26('0x4')];var _0x5b0f44=_0x1ce1fe[_0x7c26('0x3')];var _0x42701a=_0x5558f3['split']('-')[0x4];var _0x16463a=_0x5558f3[_0x7c26('0x5')]('-')[0x0];var _0x26a0e9=crypto[_0x7c26('0x6')]('aes-256-ctr',util[_0x7c26('0x7')]('%s:%s:%s',_0x42701a,_0x5558f3,_0x16463a));var _0x4110a2=_0x26a0e9[_0x7c26('0x8')](_0x5b0f44,_0x7c26('0x9'),_0x7c26('0xa'));_0x4110a2+=_0x26a0e9[_0x7c26('0xb')](_0x7c26('0xa'));var _0x4e6db6=JSON[_0x7c26('0xc')](_0x4110a2);return _0x4e6db6[_0x7c26('0xd')](_0x2a821f)?_0x4e6db6[_0x2a821f]:null;}}return null;}function isLimit(_0x160c1a,_0x221356,_0xc16214,_0x1a5c93){var _0x169c9b=_0x221356;return compose()['use'](function(_0x58e539,_0x2f3a61,_0x33b323){return db['License'][_0x7c26('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x7c26('0xf')](function(_0x5848e0){var _0x5eb776=getValueFromLicense(_0x160c1a,_0x5848e0);return _0x5eb776?_0x5eb776:_0x169c9b;})[_0x7c26('0xf')](function(_0x4e12e5){_0x169c9b=_0x4e12e5;return _0xc16214[_0x7c26('0x10')](_0x1a5c93);})[_0x7c26('0xf')](function(_0x10b602){if(_0x10b602>=_0x169c9b){return _0x2f3a61[_0x7c26('0x11')](0x193)[_0x7c26('0x12')]({'message':util['format'](_0x7c26('0x13'),_0x160c1a)});}_0x33b323();})[_0x7c26('0x14')](function(_0x48a30c){_0x33b323(_0x48a30c);});});}function isUserLimit(){return isLimit(_0x7c26('0x15'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x7c26('0x16')]=isUserLimit; \ No newline at end of file +var _0x269b=['../../mysqldb','../../config/environment','data1','license','split','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','isUserLimit','crypto','composable-middleware'];(function(_0x81ba5c,_0x5a443e){var _0x120d99=function(_0xdad10a){while(--_0xdad10a){_0x81ba5c['push'](_0x81ba5c['shift']());}};_0x120d99(++_0x5a443e);}(_0x269b,0x9a));var _0xb269=function(_0x4f76b6,_0x38b4ef){_0x4f76b6=_0x4f76b6-0x0;var _0x3a7853=_0x269b[_0x4f76b6];return _0x3a7853;};'use strict';var crypto=require(_0xb269('0x0'));var util=require('util');var compose=require(_0xb269('0x1'));var db=require(_0xb269('0x2'))['db'];var config=require(_0xb269('0x3'));function getValueFromLicense(_0x3faa15,_0x4e5500){if(_0x3faa15&&_0x4e5500){if(_0x4e5500[_0xb269('0x4')]&&_0x4e5500['license']){var _0x5c4827=_0x4e5500['data1'];var _0x349406=_0x4e5500[_0xb269('0x5')];var _0x456d40=_0x5c4827[_0xb269('0x6')]('-')[0x4];var _0x17dcff=_0x5c4827[_0xb269('0x6')]('-')[0x0];var _0x1572cc=crypto['createDecipher']('aes-256-ctr',util[_0xb269('0x7')](_0xb269('0x8'),_0x456d40,_0x5c4827,_0x17dcff));var _0x33799c=_0x1572cc[_0xb269('0x9')](_0x349406,_0xb269('0xa'),_0xb269('0xb'));_0x33799c+=_0x1572cc[_0xb269('0xc')](_0xb269('0xb'));var _0x2b57c0=JSON[_0xb269('0xd')](_0x33799c);return _0x2b57c0[_0xb269('0xe')](_0x3faa15)?_0x2b57c0[_0x3faa15]:null;}}return null;}function isLimit(_0x159c87,_0x54e6f0,_0x4ab7e6,_0x261911){var _0x20e826=_0x54e6f0;return compose()[_0xb269('0xf')](function(_0x2ba87c,_0x21298a,_0x217954){return db['License'][_0xb269('0x10')]({'where':{'id':0x1},'raw':!![]})[_0xb269('0x11')](function(_0xd15fe){var _0x32d28c=getValueFromLicense(_0x159c87,_0xd15fe);return _0x32d28c?_0x32d28c:_0x20e826;})[_0xb269('0x11')](function(_0x4d3c6d){_0x20e826=_0x4d3c6d;return _0x4ab7e6['count'](_0x261911);})[_0xb269('0x11')](function(_0x4e70e7){if(_0x4e70e7>=_0x20e826){return _0x21298a[_0xb269('0x12')](0x193)[_0xb269('0x13')]({'message':util[_0xb269('0x7')](_0xb269('0x14'),_0x159c87)});}_0x217954();})[_0xb269('0x15')](function(_0x545a75){_0x217954(_0x545a75);});});}function isUserLimit(){return isLimit(_0xb269('0x16'),0x1,db[_0xb269('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0xb269('0x18')}]}});}exports[_0xb269('0x19')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5a73a20..18f6b78 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 _0x4343=['lodash','moment','sqlOperator','startsWith','[$or]','and','[$and]','replace','split','length','slice','forEach','shift','match','filter','indexOf','conditions','push','buildExpression','DATE','operator','$eq','$between','includes','$gt','value','add','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith','$lt','>\x20?','$lte','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds'];(function(_0x3fee7e,_0xcaeb28){var _0x200ed5=function(_0x2cec13){while(--_0x2cec13){_0x3fee7e['push'](_0x3fee7e['shift']());}};_0x200ed5(++_0xcaeb28);}(_0x4343,0x13e));var _0x3434=function(_0x55b275,_0x43ad67){_0x55b275=_0x55b275-0x0;var _0xcf16f1=_0x4343[_0x55b275];return _0xcf16f1;};'use strict';var _=require(_0x3434('0x0'));var moment=require(_0x3434('0x1'));exports['parseSearch']=function(_0x522127){var _0x5bd90d={'conditions':[]};_0x5bd90d[_0x3434('0x2')]=_[_0x3434('0x3')](_0x522127,_0x3434('0x4'))?'or':_0x3434('0x5');var _0x44bf3a=_0x522127['replace'](_0x3434('0x6'),'')[_0x3434('0x7')](_0x3434('0x4'),'')[_0x3434('0x8')]('||');for(var _0x4897cb=0x0;_0x4897cb<_0x44bf3a[_0x3434('0x9')];_0x4897cb++){var _0x174f35=_0x44bf3a[_0x4897cb][_0x3434('0x8')](':=');var _0x1259d0=_0x174f35[0x0];var _0x4fe51e=_0x174f35[_0x3434('0xa')](0x1);_0x4fe51e[_0x3434('0xb')](function(_0xfc9393){var _0x362095=_0xfc9393[_0x3434('0x8')]('[')[_0x3434('0xc')]();var _0x3f3db3=_0xfc9393[_0x3434('0xd')](/\[(.*?)\]/g);_0x3f3db3[_0x3434('0xb')](function(_0x209cd9){var _0x140cf5=_0x209cd9['split']('[')[_0x3434('0xe')](function(_0x614b39){return _0x614b39[_0x3434('0xf')](']')>-0x1;})['map'](function(_0x473c3e){return _0x473c3e[_0x3434('0x8')](']')[0x0];})[0x0];_0x5bd90d[_0x3434('0x10')][_0x3434('0x11')]({'field':_0x1259d0,'operator':_0x362095,'value':_0x140cf5});});});}return _0x5bd90d;};exports[_0x3434('0x12')]=function(_0x17a51a,_0x32a762,_0x2dbdcb){var _0xeb8c6c={};if(_0x32a762===_0x3434('0x13')){if(_0x2dbdcb[_0x3434('0x14')]===_0x3434('0x15')){_0x2dbdcb[_0x3434('0x14')]=_0x3434('0x16');_0x2dbdcb['value']+=','+_0x2dbdcb['value'];}else if(_[_0x3434('0x17')]([_0x3434('0x18'),'$lte'],_0x2dbdcb[_0x3434('0x14')])){_0x2dbdcb['value']=moment(_0x2dbdcb[_0x3434('0x19')])[_0x3434('0x1a')](0x1,'days')[_0x3434('0x1b')](_0x3434('0x1c'));}}if(_0x2dbdcb[_0x3434('0x1d')]){_0x32a762=_0x2dbdcb[_0x3434('0x1d')];_0xeb8c6c[_0x3434('0x1e')]='CAST('+_0x17a51a+'.'+_0x2dbdcb[_0x3434('0x1f')]+_0x3434('0x20')+_0x2dbdcb['castTo']+')\x20'+parseOperator(_0x2dbdcb[_0x3434('0x14')]);}else{_0xeb8c6c[_0x3434('0x1e')]=_0x17a51a+'.'+_0x2dbdcb[_0x3434('0x1f')]+'\x20'+parseOperator(_0x2dbdcb[_0x3434('0x14')]);}if(_['includes'](['$ne',_0x3434('0x21')],_0x2dbdcb[_0x3434('0x14')]))_0xeb8c6c[_0x3434('0x1e')]='('+_0xeb8c6c[_0x3434('0x1e')]+_0x3434('0x22')+_0x17a51a+'.'+_0x2dbdcb['field']+_0x3434('0x23');_0xeb8c6c['value']=parseValue(_0x32a762,_0x2dbdcb[_0x3434('0x14')],_0x2dbdcb[_0x3434('0x19')]);return _0xeb8c6c;};function parseOperator(_0x354d6a){var _0x1f7254;switch(_0x354d6a){case _0x3434('0x24'):_0x1f7254=_0x3434('0x25');break;case'$notIn':_0x1f7254='NOT\x20IN\x20?';break;case _0x3434('0x15'):_0x1f7254=_0x3434('0x26');break;case _0x3434('0x27'):_0x1f7254='<>\x20?';break;case _0x3434('0x28'):case _0x3434('0x29'):case _0x3434('0x2a'):_0x1f7254='LIKE\x20?';break;case _0x3434('0x2b'):_0x1f7254='<\x20?';break;case _0x3434('0x18'):_0x1f7254=_0x3434('0x2c');break;case _0x3434('0x2d'):_0x1f7254='<=\x20?';break;case'$gte':_0x1f7254='>=\x20?';break;case _0x3434('0x16'):_0x1f7254=_0x3434('0x2e');break;}return _0x1f7254;}function parseValue(_0x5a31f6,_0x962071,_0x3832c3){var _0x240ed8={'start':undefined,'end':undefined};switch(_0x962071){case _0x3434('0x24'):case _0x3434('0x21'):_0x240ed8[_0x3434('0x2f')]=_0x3832c3[_0x3434('0x8')](',');break;case _0x3434('0x28'):_0x240ed8[_0x3434('0x2f')]='%'+_0x3832c3+'%';break;case _0x3434('0x29'):_0x240ed8[_0x3434('0x2f')]=_0x3832c3+'%';break;case _0x3434('0x2a'):_0x240ed8[_0x3434('0x2f')]='%'+_0x3832c3;break;case _0x3434('0x16'):var _0x11df8c=_0x3832c3[_0x3434('0x8')](',');var _0x3832c3=_0x11df8c['shift']();var _0x46484e=_0x11df8c[_0x3434('0x30')]();if(_0x5a31f6==='DATE'){_0x3832c3=moment(_0x3832c3)[_0x3434('0x31')](0x0,!![])['format']();_0x46484e=moment(_0x46484e)[_0x3434('0x31')](0x0,!![])['add'](0x17,_0x3434('0x32'))[_0x3434('0x1a')](0x3b,_0x3434('0x33'))['add'](0x3b,_0x3434('0x34'))[_0x3434('0x1b')]();}_0x240ed8={'start':_0x3832c3,'end':_0x46484e};break;default:_0x240ed8[_0x3434('0x2f')]=_0x3832c3;break;}return _0x240ed8;} \ No newline at end of file +var _0x4fbd=['BETWEEN\x20?\x20AND\x20?','$in','start','pop','utcOffset','format','hours','add','minutes','seconds','lodash','moment','parseSearch','sqlOperator','[$or]','and','replace','split','length','slice','forEach','shift','filter','indexOf','map','buildExpression','DATE','operator','$eq','$between','value','days','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','$lte','$gte','>=\x20?'];(function(_0x1fe3aa,_0x644bf8){var _0x7105c8=function(_0x71d3a4){while(--_0x71d3a4){_0x1fe3aa['push'](_0x1fe3aa['shift']());}};_0x7105c8(++_0x644bf8);}(_0x4fbd,0x122));var _0xd4fb=function(_0x155f57,_0x48443b){_0x155f57=_0x155f57-0x0;var _0x56f84c=_0x4fbd[_0x155f57];return _0x56f84c;};'use strict';var _=require(_0xd4fb('0x0'));var moment=require(_0xd4fb('0x1'));exports[_0xd4fb('0x2')]=function(_0x491449){var _0x1a543b={'conditions':[]};_0x1a543b[_0xd4fb('0x3')]=_['startsWith'](_0x491449,_0xd4fb('0x4'))?'or':_0xd4fb('0x5');var _0xd2f9e1=_0x491449[_0xd4fb('0x6')]('[$and]','')[_0xd4fb('0x6')](_0xd4fb('0x4'),'')[_0xd4fb('0x7')]('||');for(var _0x374f35=0x0;_0x374f35<_0xd2f9e1[_0xd4fb('0x8')];_0x374f35++){var _0x25d5d4=_0xd2f9e1[_0x374f35]['split'](':=');var _0x5c1d18=_0x25d5d4[0x0];var _0x2077f7=_0x25d5d4[_0xd4fb('0x9')](0x1);_0x2077f7[_0xd4fb('0xa')](function(_0x800b89){var _0x4454de=_0x800b89[_0xd4fb('0x7')]('[')[_0xd4fb('0xb')]();var _0x5a384b=_0x800b89['match'](/\[(.*?)\]/g);_0x5a384b['forEach'](function(_0x8c2704){var _0x2f69be=_0x8c2704['split']('[')[_0xd4fb('0xc')](function(_0x44fe9d){return _0x44fe9d[_0xd4fb('0xd')](']')>-0x1;})[_0xd4fb('0xe')](function(_0x362b7d){return _0x362b7d['split'](']')[0x0];})[0x0];_0x1a543b['conditions']['push']({'field':_0x5c1d18,'operator':_0x4454de,'value':_0x2f69be});});});}return _0x1a543b;};exports[_0xd4fb('0xf')]=function(_0xc2e39a,_0x21a33d,_0x172022){var _0xeb5d57={};if(_0x21a33d===_0xd4fb('0x10')){if(_0x172022[_0xd4fb('0x11')]===_0xd4fb('0x12')){_0x172022[_0xd4fb('0x11')]=_0xd4fb('0x13');_0x172022[_0xd4fb('0x14')]+=','+_0x172022['value'];}else if(_['includes'](['$gt','$lte'],_0x172022[_0xd4fb('0x11')])){_0x172022[_0xd4fb('0x14')]=moment(_0x172022['value'])['add'](0x1,_0xd4fb('0x15'))['format'](_0xd4fb('0x16'));}}if(_0x172022[_0xd4fb('0x17')]){_0x21a33d=_0x172022[_0xd4fb('0x17')];_0xeb5d57[_0xd4fb('0x18')]='CAST('+_0xc2e39a+'.'+_0x172022[_0xd4fb('0x19')]+_0xd4fb('0x1a')+_0x172022[_0xd4fb('0x17')]+')\x20'+parseOperator(_0x172022[_0xd4fb('0x11')]);}else{_0xeb5d57[_0xd4fb('0x18')]=_0xc2e39a+'.'+_0x172022[_0xd4fb('0x19')]+'\x20'+parseOperator(_0x172022[_0xd4fb('0x11')]);}if(_[_0xd4fb('0x1b')]([_0xd4fb('0x1c'),_0xd4fb('0x1d')],_0x172022[_0xd4fb('0x11')]))_0xeb5d57[_0xd4fb('0x18')]='('+_0xeb5d57[_0xd4fb('0x18')]+_0xd4fb('0x1e')+_0xc2e39a+'.'+_0x172022['field']+_0xd4fb('0x1f');_0xeb5d57[_0xd4fb('0x14')]=parseValue(_0x21a33d,_0x172022[_0xd4fb('0x11')],_0x172022['value']);return _0xeb5d57;};function parseOperator(_0x599806){var _0x1ef3b8;switch(_0x599806){case'$in':_0x1ef3b8=_0xd4fb('0x20');break;case _0xd4fb('0x1d'):_0x1ef3b8=_0xd4fb('0x21');break;case _0xd4fb('0x12'):_0x1ef3b8=_0xd4fb('0x22');break;case _0xd4fb('0x1c'):_0x1ef3b8=_0xd4fb('0x23');break;case _0xd4fb('0x24'):case _0xd4fb('0x25'):case _0xd4fb('0x26'):_0x1ef3b8=_0xd4fb('0x27');break;case _0xd4fb('0x28'):_0x1ef3b8=_0xd4fb('0x29');break;case _0xd4fb('0x2a'):_0x1ef3b8='>\x20?';break;case _0xd4fb('0x2b'):_0x1ef3b8='<=\x20?';break;case _0xd4fb('0x2c'):_0x1ef3b8=_0xd4fb('0x2d');break;case'$between':_0x1ef3b8=_0xd4fb('0x2e');break;}return _0x1ef3b8;}function parseValue(_0x2beee1,_0x11dd79,_0x56f829){var _0x59ca34={'start':undefined,'end':undefined};switch(_0x11dd79){case _0xd4fb('0x2f'):case _0xd4fb('0x1d'):_0x59ca34[_0xd4fb('0x30')]=_0x56f829[_0xd4fb('0x7')](',');break;case _0xd4fb('0x24'):_0x59ca34[_0xd4fb('0x30')]='%'+_0x56f829+'%';break;case _0xd4fb('0x25'):_0x59ca34[_0xd4fb('0x30')]=_0x56f829+'%';break;case'$endsWith':_0x59ca34[_0xd4fb('0x30')]='%'+_0x56f829;break;case'$between':var _0x43df2a=_0x56f829[_0xd4fb('0x7')](',');var _0x56f829=_0x43df2a[_0xd4fb('0xb')]();var _0x393c60=_0x43df2a[_0xd4fb('0x31')]();if(_0x2beee1==='DATE'){_0x56f829=moment(_0x56f829)[_0xd4fb('0x32')](0x0,!![])[_0xd4fb('0x33')]();_0x393c60=moment(_0x393c60)[_0xd4fb('0x32')](0x0,!![])['add'](0x17,_0xd4fb('0x34'))[_0xd4fb('0x35')](0x3b,_0xd4fb('0x36'))[_0xd4fb('0x35')](0x3b,_0xd4fb('0x37'))['format']();}_0x59ca34={'start':_0x56f829,'end':_0x393c60};break;default:_0x59ca34[_0xd4fb('0x30')]=_0x56f829;break;}return _0x59ca34;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index e1b4f67..170dfd0 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 _0x05b3=['DESC','ASC','omit','isObject','isString','length','unset','hasOwnProperty','match','isEmail','getFullTextValue','forEach','join','getOptions','$id','query','model','keys','intersection','attributes','fields','nolimit','where','pick','filter','merge','type','lower','options','lodash','sequelize','parse','includes','filters','isEmpty','find','DATE','isPlainObject','$gte','YYYY-MM-DD','format','$lte','subtract','name','uniqueid','isArray','split','limit','offset','sort','map','indexOf','priority','cast','col','unsigned'];(function(_0x343a07,_0x2284ee){var _0x47562a=function(_0x303ec3){while(--_0x303ec3){_0x343a07['push'](_0x343a07['shift']());}};_0x47562a(++_0x2284ee);}(_0x05b3,0xc5));var _0x305b=function(_0x1a4748,_0x40c46e){_0x1a4748=_0x1a4748-0x0;var _0x28ca99=_0x05b3[_0x1a4748];return _0x28ca99;};'use strict';var _=require(_0x305b('0x0'));var sequelize=require(_0x305b('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x49db75){var _0x589170=['ne'];try{var _0xb95f4b=JSON[_0x305b('0x2')](_0x49db75);var _0x5e611e=Object['keys'](_0xb95f4b)[0x0];return _0x589170[_0x305b('0x3')](_0x5e611e);}catch(_0x2da6d6){return![];}}function getOperatorValue(_0x1d605d){var _0x13eebc=JSON[_0x305b('0x2')](_0x1d605d);var _0x17e946=Object['keys'](_0x13eebc)[0x0];var _0x5b697f=_0x13eebc[_0x17e946];return{['$'+_0x17e946]:_0x5b697f};}exports['fields']=function(_0x773c8f){var _0x370900=null;if(_0x773c8f){_0x370900=_0x773c8f['split'](',');}return _0x370900;};exports[_0x305b('0x4')]=function(_0x2b5a92,_0xa3c51f){var _0xbcb0f5={};if(!_[_0x305b('0x5')](_0x2b5a92)){_['forOwn'](_0x2b5a92,function(_0x5b78c5,_0xbe1de6){try{if(_0xa3c51f){var _0x5a067b=_[_0x305b('0x6')](_0xa3c51f,{'name':_0xbe1de6})||{};if(hasSequelizeOperator(_0x5b78c5)){_0xbcb0f5[_0xbe1de6]=getOperatorValue(_0x5b78c5);}else if(_0x5a067b['type']===_0x305b('0x7')&&_[_0x305b('0x8')](_0x5b78c5)){var _0x263ee1=JSON[_0x305b('0x2')](_0x5b78c5);var _0x2e032b={'$gte':moment(moment(_0x263ee1[_0x305b('0x9')])['format'](_0x305b('0xa')))['utc']()[_0x305b('0xb')](),'$lte':moment(moment(_0x263ee1[_0x305b('0xc')])[_0x305b('0xb')](_0x305b('0xa')))['utc']()[_0x305b('0xd')](0x1,'s')[_0x305b('0xb')]()};_0xbcb0f5[_0xbe1de6]=_0x2e032b;}else if(_0x5a067b[_0x305b('0xe')]===_0x305b('0xf')){_0xbcb0f5[_0xbe1de6]=_0x5b78c5;}else{_0xbcb0f5[_0xbe1de6]=_[_0x305b('0x10')](_0x5b78c5)?_0x5b78c5:JSON[_0x305b('0x2')](_0x5b78c5);}}else{_0xbcb0f5[_0xbe1de6]=_[_0x305b('0x10')](_0x5b78c5)?_0x5b78c5:JSON[_0x305b('0x2')](_0x5b78c5);}}catch(_0x20b15c){_0xbcb0f5[_0xbe1de6]=_0x5b78c5[_0x305b('0x11')](',');}});}return _0xbcb0f5;};exports[_0x305b('0x12')]=function(_0x371daf){_0x371daf=parseInt(_0x371daf,0xa);if(!_0x371daf||_0x371daf<0x0){_0x371daf=LIMIT_VALUE;}return _0x371daf;};exports[_0x305b('0x13')]=function(_0x4a1af4){_0x4a1af4=parseInt(_0x4a1af4,0xa);if(!_0x4a1af4||_0x4a1af4<0x0){_0x4a1af4=0x0;}return _0x4a1af4;};exports[_0x305b('0x14')]=function(_0x4bbe12){var _0x2ff2f1,_0x39bd0f=null;if(_0x4bbe12){_0x2ff2f1=_0x4bbe12[_0x305b('0x11')](',');_0x39bd0f=_[_0x305b('0x15')](_0x2ff2f1,function(_0x2be98a){if(_0x2be98a[_0x305b('0x16')]('-')===0x0){return[_0x2be98a===_0x305b('0x17')?sequelize[_0x305b('0x18')](sequelize[_0x305b('0x19')](_0x305b('0x17')),_0x305b('0x1a')):_0x2be98a['substr'](0x1),_0x305b('0x1b')];}else{return[_0x2be98a===_0x305b('0x17')?sequelize[_0x305b('0x18')](sequelize[_0x305b('0x19')]('priority'),_0x305b('0x1a')):_0x2be98a,_0x305b('0x1c')];}});}return _0x39bd0f;};exports[_0x305b('0x1d')]=function(_0xb1fc1d,_0x793127){if(_[_0x305b('0x5')](_0xb1fc1d)){return _0xb1fc1d;}if(_['isArray'](_0xb1fc1d)){for(var _0x5e89d8=0x0;_0x5e89d8<_0xb1fc1d['length'];_0x5e89d8+=0x1){_0xb1fc1d[_0x5e89d8]=this['omit'](_0xb1fc1d[_0x5e89d8],_0x793127);}return _0xb1fc1d;}if(!_[_0x305b('0x1e')](_0xb1fc1d)){return _0xb1fc1d;}if(_[_0x305b('0x1f')](_0x793127)){_0x793127=[_0x793127];}if(!_['isArray'](_0x793127)){return _0xb1fc1d;}for(var _0x3e4252=0x0;_0x3e4252<_0x793127[_0x305b('0x20')];_0x3e4252+=0x1){_[_0x305b('0x21')](_0xb1fc1d,_0x793127[_0x3e4252]);}for(var _0x94b3e6 in _0xb1fc1d){if(_0xb1fc1d[_0x305b('0x22')](_0x94b3e6)){_0xb1fc1d[_0x94b3e6]=this[_0x305b('0x1d')](_0xb1fc1d[_0x94b3e6],_0x793127);}}return _0xb1fc1d;};exports['isNumeric']=function(_0x5cce22){return _0x5cce22[_0x305b('0x23')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports[_0x305b('0x24')]=function(_0x357954){return _0x357954[_0x305b('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x305b('0x25')]=function(_0x13dcc8){var _0x1311c5=[];_0x13dcc8[_0x305b('0x11')](/[ ,]+/)[_0x305b('0x26')](function(_0x3133a0){_0x3133a0=_0x3133a0['replace'](/([^:]")"+/g,'$1');_0x3133a0='+'+_0x3133a0+'*';if(_0x3133a0[_0x305b('0x3')]('@'))_0x3133a0='\x22'+_0x3133a0+'\x22';_0x1311c5['push'](_0x3133a0);});return _0x1311c5[_0x305b('0x27')]('\x20');};exports[_0x305b('0x28')]=function(_0x228eac,_0x478030,_0x237aa0){var _0x4c9417={},_0xf41f2={};if(_0x478030['query'][_0x305b('0x29')]){_0x478030[_0x305b('0x2a')]['id']=_0x478030[_0x305b('0x2a')]['$id'];delete _0x478030[_0x305b('0x2a')][_0x305b('0x29')];}_0x4c9417[_0x305b('0x2b')]=_[_0x305b('0x15')](_0x228eac,'name');_0x4c9417[_0x305b('0x2a')]=_[_0x305b('0x2c')](_0x478030['query']);_0x4c9417[_0x305b('0x4')]=_[_0x305b('0x2d')](_0x4c9417[_0x305b('0x2b')],_0x4c9417[_0x305b('0x2a')]);_0xf41f2[_0x305b('0x2e')]=_[_0x305b('0x2d')](_0x4c9417['model'],this[_0x305b('0x2f')](_0x478030[_0x305b('0x2a')][_0x305b('0x2f')]));_0xf41f2['attributes']=_0xf41f2[_0x305b('0x2e')][_0x305b('0x20')]?_0xf41f2[_0x305b('0x2e')]:_0x4c9417[_0x305b('0x2b')];if(!_0x478030[_0x305b('0x2a')][_0x305b('0x22')](_0x305b('0x30'))){_0xf41f2['limit']=this[_0x305b('0x12')](_0x478030['query'][_0x305b('0x12')]);_0xf41f2['offset']=this['offset'](_0x478030['query'][_0x305b('0x13')]);}_0xf41f2['order']=this['sort'](_0x478030[_0x305b('0x2a')][_0x305b('0x14')]);_0xf41f2[_0x305b('0x31')]=this['filters'](_[_0x305b('0x32')](_0x478030[_0x305b('0x2a')],_0x4c9417[_0x305b('0x4')]),_0x228eac);if(_0x478030[_0x305b('0x2a')][_0x305b('0x33')]){_0xf41f2[_0x305b('0x31')]=_[_0x305b('0x34')](_0xf41f2[_0x305b('0x31')],{'$or':_[_0x305b('0x15')](_0x228eac,function(_0x141005){if(_0x141005[_0x305b('0x35')]!=='VIRTUAL'){if(_0x237aa0){return sequelize[_0x305b('0x31')](sequelize['fn']('lower',sequelize[_0x305b('0x19')](_0x141005[_0x305b('0xe')])),{'$like':sequelize['fn'](_0x305b('0x36'),'%'+_0x478030['query'][_0x305b('0x33')]+'%')});}else{var _0x4909fc={};_0x4909fc[_0x141005[_0x305b('0xe')]]={'$like':'%'+_0x478030[_0x305b('0x2a')]['filter']+'%'};return _0x4909fc;}}})});}_0xf41f2=_[_0x305b('0x34')]({},_0xf41f2,_0x478030[_0x305b('0x37')]);return _0xf41f2;}; \ No newline at end of file +var _0x6548=['isNumeric','^[+]?[0-9]*$','isEmail','replace','push','getOptions','query','$id','model','intersection','attributes','nolimit','order','where','pick','filter','VIRTUAL','lower','merge','options','sequelize','moment','keys','parse','fields','split','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','format','utc','subtract','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','unsigned','substr','cast','col','ASC','omit','isObject','length','hasOwnProperty'];(function(_0x157366,_0x2e1128){var _0x8dbd5d=function(_0x2f6012){while(--_0x2f6012){_0x157366['push'](_0x157366['shift']());}};_0x8dbd5d(++_0x2e1128);}(_0x6548,0xb6));var _0x8654=function(_0x487210,_0x5e1692){_0x487210=_0x487210-0x0;var _0x45e133=_0x6548[_0x487210];return _0x45e133;};'use strict';var _=require('lodash');var sequelize=require(_0x8654('0x0'));var moment=require(_0x8654('0x1'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4e8463){var _0x2a2a6a=['ne'];try{var _0x185ec0=JSON['parse'](_0x4e8463);var _0x33cb87=Object[_0x8654('0x2')](_0x185ec0)[0x0];return _0x2a2a6a['includes'](_0x33cb87);}catch(_0x1129fc){return![];}}function getOperatorValue(_0x528a23){var _0x12ef9f=JSON[_0x8654('0x3')](_0x528a23);var _0x24055a=Object['keys'](_0x12ef9f)[0x0];var _0x1b8e23=_0x12ef9f[_0x24055a];return{['$'+_0x24055a]:_0x1b8e23};}exports[_0x8654('0x4')]=function(_0xfd6f5a){var _0x35bb3b=null;if(_0xfd6f5a){_0x35bb3b=_0xfd6f5a[_0x8654('0x5')](',');}return _0x35bb3b;};exports[_0x8654('0x6')]=function(_0x53870a,_0x3845dd){var _0x3f846a={};if(!_[_0x8654('0x7')](_0x53870a)){_[_0x8654('0x8')](_0x53870a,function(_0x519c86,_0x5f0925){try{if(_0x3845dd){var _0x42552e=_[_0x8654('0x9')](_0x3845dd,{'name':_0x5f0925})||{};if(hasSequelizeOperator(_0x519c86)){_0x3f846a[_0x5f0925]=getOperatorValue(_0x519c86);}else if(_0x42552e[_0x8654('0xa')]===_0x8654('0xb')&&_[_0x8654('0xc')](_0x519c86)){var _0x54a6e1=JSON[_0x8654('0x3')](_0x519c86);var _0x4f5d68={'$gte':moment(moment(_0x54a6e1['$gte'])[_0x8654('0xd')]('YYYY-MM-DD'))['utc']()[_0x8654('0xd')](),'$lte':moment(moment(_0x54a6e1['$lte'])[_0x8654('0xd')]('YYYY-MM-DD'))[_0x8654('0xe')]()[_0x8654('0xf')](0x1,'s')[_0x8654('0xd')]()};_0x3f846a[_0x5f0925]=_0x4f5d68;}else if(_0x42552e[_0x8654('0x10')]===_0x8654('0x11')){_0x3f846a[_0x5f0925]=_0x519c86;}else{_0x3f846a[_0x5f0925]=_[_0x8654('0x12')](_0x519c86)?_0x519c86:JSON['parse'](_0x519c86);}}else{_0x3f846a[_0x5f0925]=_[_0x8654('0x12')](_0x519c86)?_0x519c86:JSON[_0x8654('0x3')](_0x519c86);}}catch(_0x50c39c){_0x3f846a[_0x5f0925]=_0x519c86[_0x8654('0x5')](',');}});}return _0x3f846a;};exports[_0x8654('0x13')]=function(_0x39c87d){_0x39c87d=parseInt(_0x39c87d,0xa);if(!_0x39c87d||_0x39c87d<0x0){_0x39c87d=LIMIT_VALUE;}return _0x39c87d;};exports[_0x8654('0x14')]=function(_0x1f5ed0){_0x1f5ed0=parseInt(_0x1f5ed0,0xa);if(!_0x1f5ed0||_0x1f5ed0<0x0){_0x1f5ed0=0x0;}return _0x1f5ed0;};exports[_0x8654('0x15')]=function(_0x286b80){var _0x467517,_0x482433=null;if(_0x286b80){_0x467517=_0x286b80[_0x8654('0x5')](',');_0x482433=_[_0x8654('0x16')](_0x467517,function(_0x9d0e08){if(_0x9d0e08[_0x8654('0x17')]('-')===0x0){return[_0x9d0e08==='priority'?sequelize['cast'](sequelize['col'](_0x8654('0x18')),_0x8654('0x19')):_0x9d0e08[_0x8654('0x1a')](0x1),'DESC'];}else{return[_0x9d0e08===_0x8654('0x18')?sequelize[_0x8654('0x1b')](sequelize[_0x8654('0x1c')]('priority'),'unsigned'):_0x9d0e08,_0x8654('0x1d')];}});}return _0x482433;};exports[_0x8654('0x1e')]=function(_0x5c5b08,_0x4da7a){if(_[_0x8654('0x7')](_0x5c5b08)){return _0x5c5b08;}if(_[_0x8654('0x12')](_0x5c5b08)){for(var _0x244e76=0x0;_0x244e76<_0x5c5b08['length'];_0x244e76+=0x1){_0x5c5b08[_0x244e76]=this[_0x8654('0x1e')](_0x5c5b08[_0x244e76],_0x4da7a);}return _0x5c5b08;}if(!_[_0x8654('0x1f')](_0x5c5b08)){return _0x5c5b08;}if(_['isString'](_0x4da7a)){_0x4da7a=[_0x4da7a];}if(!_[_0x8654('0x12')](_0x4da7a)){return _0x5c5b08;}for(var _0x22b19a=0x0;_0x22b19a<_0x4da7a[_0x8654('0x20')];_0x22b19a+=0x1){_['unset'](_0x5c5b08,_0x4da7a[_0x22b19a]);}for(var _0x12c82d in _0x5c5b08){if(_0x5c5b08[_0x8654('0x21')](_0x12c82d)){_0x5c5b08[_0x12c82d]=this[_0x8654('0x1e')](_0x5c5b08[_0x12c82d],_0x4da7a);}}return _0x5c5b08;};exports[_0x8654('0x22')]=function(_0x5e9380){return _0x5e9380['match'](RegExp(_0x8654('0x23')))?!![]:![];};exports[_0x8654('0x24')]=function(_0x2af0e0){return _0x2af0e0['match'](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x4bf803){var _0x127476=[];_0x4bf803[_0x8654('0x5')](/[ ,]+/)['forEach'](function(_0x5e2e02){_0x5e2e02=_0x5e2e02[_0x8654('0x25')](/([^:]")"+/g,'$1');_0x5e2e02='+'+_0x5e2e02+'*';if(_0x5e2e02['includes']('@'))_0x5e2e02='\x22'+_0x5e2e02+'\x22';_0x127476[_0x8654('0x26')](_0x5e2e02);});return _0x127476['join']('\x20');};exports[_0x8654('0x27')]=function(_0x14fe2e,_0x3c249d,_0x1eaf30){var _0xaf5f35={},_0x2133df={};if(_0x3c249d[_0x8654('0x28')][_0x8654('0x29')]){_0x3c249d[_0x8654('0x28')]['id']=_0x3c249d[_0x8654('0x28')]['$id'];delete _0x3c249d[_0x8654('0x28')][_0x8654('0x29')];}_0xaf5f35[_0x8654('0x2a')]=_['map'](_0x14fe2e,_0x8654('0x10'));_0xaf5f35[_0x8654('0x28')]=_['keys'](_0x3c249d[_0x8654('0x28')]);_0xaf5f35['filters']=_[_0x8654('0x2b')](_0xaf5f35[_0x8654('0x2a')],_0xaf5f35[_0x8654('0x28')]);_0x2133df[_0x8654('0x2c')]=_['intersection'](_0xaf5f35[_0x8654('0x2a')],this[_0x8654('0x4')](_0x3c249d[_0x8654('0x28')][_0x8654('0x4')]));_0x2133df[_0x8654('0x2c')]=_0x2133df[_0x8654('0x2c')][_0x8654('0x20')]?_0x2133df['attributes']:_0xaf5f35[_0x8654('0x2a')];if(!_0x3c249d[_0x8654('0x28')][_0x8654('0x21')](_0x8654('0x2d'))){_0x2133df[_0x8654('0x13')]=this['limit'](_0x3c249d[_0x8654('0x28')][_0x8654('0x13')]);_0x2133df[_0x8654('0x14')]=this['offset'](_0x3c249d[_0x8654('0x28')]['offset']);}_0x2133df[_0x8654('0x2e')]=this[_0x8654('0x15')](_0x3c249d[_0x8654('0x28')][_0x8654('0x15')]);_0x2133df[_0x8654('0x2f')]=this['filters'](_[_0x8654('0x30')](_0x3c249d[_0x8654('0x28')],_0xaf5f35[_0x8654('0x6')]),_0x14fe2e);if(_0x3c249d[_0x8654('0x28')][_0x8654('0x31')]){_0x2133df[_0x8654('0x2f')]=_['merge'](_0x2133df[_0x8654('0x2f')],{'$or':_[_0x8654('0x16')](_0x14fe2e,function(_0x3d1473){if(_0x3d1473[_0x8654('0xa')]!==_0x8654('0x32')){if(_0x1eaf30){return sequelize[_0x8654('0x2f')](sequelize['fn'](_0x8654('0x33'),sequelize[_0x8654('0x1c')](_0x3d1473[_0x8654('0x10')])),{'$like':sequelize['fn'](_0x8654('0x33'),'%'+_0x3c249d['query'][_0x8654('0x31')]+'%')});}else{var _0x303541={};_0x303541[_0x3d1473[_0x8654('0x10')]]={'$like':'%'+_0x3c249d[_0x8654('0x28')][_0x8654('0x31')]+'%'};return _0x303541;}}})});}_0x2133df=_[_0x8654('0x34')]({},_0x2133df,_0x3c249d[_0x8654('0x35')]);return _0x2133df;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f3397d6..f69f3fe 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d25=['get','env','production','set','appPath','join','root','public','use','json\x20replacer','toISOString','split','static','views','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize','express','method-override','cookie-parser','errorhandler','path','passport','cors','./environment','default'];(function(_0x46143c,_0x576382){var _0x3442d3=function(_0x438fcb){while(--_0x438fcb){_0x46143c['push'](_0x46143c['shift']());}};_0x3442d3(++_0x576382);}(_0x8d25,0x123));var _0x58d2=function(_0x5a7c40,_0x238134){_0x5a7c40=_0x5a7c40-0x0;var _0x489adc=_0x8d25[_0x5a7c40];return _0x489adc;};'use strict';var express=require(_0x58d2('0x0'));var favicon=require('serve-favicon');var bodyParser=require('body-parser');var methodOverride=require(_0x58d2('0x1'));var cookieParser=require(_0x58d2('0x2'));var errorHandler=require(_0x58d2('0x3'));var path=require(_0x58d2('0x4'));var passport=require(_0x58d2('0x5'));var cors=require(_0x58d2('0x6'));var moment=require('moment');var config=require(_0x58d2('0x7'));var db=require('../mysqldb')['db'];exports[_0x58d2('0x8')]=function(_0x56cf7a){var _0x211059=_0x56cf7a[_0x58d2('0x9')](_0x58d2('0xa'));if(_0x211059===_0x58d2('0xb')){_0x56cf7a[_0x58d2('0xc')](_0x58d2('0xd'),path[_0x58d2('0xe')](config[_0x58d2('0xf')],_0x58d2('0x10')));}if(_0x211059==='development'||_0x211059==='test'){_0x56cf7a[_0x58d2('0xc')](_0x58d2('0xd'),path[_0x58d2('0xe')](config[_0x58d2('0xf')],'client'));_0x56cf7a[_0x58d2('0x11')](errorHandler());}_0x56cf7a['set'](_0x58d2('0x12'),function(_0x4060e4,_0x38dff6){if(this[_0x4060e4]instanceof Date){_0x38dff6=this[_0x4060e4][_0x58d2('0x13')]()[_0x58d2('0x14')]('.')[0x0]+'Z';}return _0x38dff6;});_0x56cf7a['use'](express[_0x58d2('0x15')](_0x56cf7a['get']('appPath')));_0x56cf7a['set'](_0x58d2('0x16'),config[_0x58d2('0xf')]+'/server/views');_0x56cf7a['engine'](_0x58d2('0x17'),require(_0x58d2('0x18'))[_0x58d2('0x19')]);_0x56cf7a[_0x58d2('0xc')](_0x58d2('0x1a'),_0x58d2('0x17'));_0x56cf7a['use'](bodyParser[_0x58d2('0x1b')]({'limit':_0x58d2('0x1c'),'extended':!![]}));_0x56cf7a[_0x58d2('0x11')](bodyParser['json']({'limit':_0x58d2('0x1c')}));_0x56cf7a[_0x58d2('0x11')](cors());_0x56cf7a[_0x58d2('0x11')](methodOverride());_0x56cf7a[_0x58d2('0x11')](cookieParser());_0x56cf7a[_0x58d2('0x11')](passport[_0x58d2('0x1d')]());}; \ No newline at end of file +var _0xbe0f=['split','static','views','/server/views','engine','renderFile','view\x20engine','json','initialize','serve-favicon','body-parser','method-override','cookie-parser','errorhandler','path','passport','cors','moment','../mysqldb','default','get','set','appPath','root','public','test','join','client','use','json\x20replacer'];(function(_0x5dae22,_0x966198){var _0x78858f=function(_0x5733b7){while(--_0x5733b7){_0x5dae22['push'](_0x5dae22['shift']());}};_0x78858f(++_0x966198);}(_0xbe0f,0x135));var _0xfbe0=function(_0x48aff9,_0x2846db){_0x48aff9=_0x48aff9-0x0;var _0xab7f7b=_0xbe0f[_0x48aff9];return _0xab7f7b;};'use strict';var express=require('express');var favicon=require(_0xfbe0('0x0'));var bodyParser=require(_0xfbe0('0x1'));var methodOverride=require(_0xfbe0('0x2'));var cookieParser=require(_0xfbe0('0x3'));var errorHandler=require(_0xfbe0('0x4'));var path=require(_0xfbe0('0x5'));var passport=require(_0xfbe0('0x6'));var cors=require(_0xfbe0('0x7'));var moment=require(_0xfbe0('0x8'));var config=require('./environment');var db=require(_0xfbe0('0x9'))['db'];exports[_0xfbe0('0xa')]=function(_0x1fcc8e){var _0x40d80a=_0x1fcc8e[_0xfbe0('0xb')]('env');if(_0x40d80a==='production'){_0x1fcc8e[_0xfbe0('0xc')](_0xfbe0('0xd'),path['join'](config[_0xfbe0('0xe')],_0xfbe0('0xf')));}if(_0x40d80a==='development'||_0x40d80a===_0xfbe0('0x10')){_0x1fcc8e[_0xfbe0('0xc')](_0xfbe0('0xd'),path[_0xfbe0('0x11')](config[_0xfbe0('0xe')],_0xfbe0('0x12')));_0x1fcc8e[_0xfbe0('0x13')](errorHandler());}_0x1fcc8e['set'](_0xfbe0('0x14'),function(_0x17aba6,_0x258cb8){if(this[_0x17aba6]instanceof Date){_0x258cb8=this[_0x17aba6]['toISOString']()[_0xfbe0('0x15')]('.')[0x0]+'Z';}return _0x258cb8;});_0x1fcc8e[_0xfbe0('0x13')](express[_0xfbe0('0x16')](_0x1fcc8e[_0xfbe0('0xb')](_0xfbe0('0xd'))));_0x1fcc8e[_0xfbe0('0xc')](_0xfbe0('0x17'),config[_0xfbe0('0xe')]+_0xfbe0('0x18'));_0x1fcc8e[_0xfbe0('0x19')]('html',require('ejs')[_0xfbe0('0x1a')]);_0x1fcc8e[_0xfbe0('0xc')](_0xfbe0('0x1b'),'html');_0x1fcc8e[_0xfbe0('0x13')](bodyParser['urlencoded']({'limit':'50mb','extended':!![]}));_0x1fcc8e[_0xfbe0('0x13')](bodyParser[_0xfbe0('0x1c')]({'limit':'50mb'}));_0x1fcc8e['use'](cors());_0x1fcc8e[_0xfbe0('0x13')](methodOverride());_0x1fcc8e[_0xfbe0('0x13')](cookieParser());_0x1fcc8e[_0xfbe0('0x13')](passport[_0xfbe0('0x1d')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a2fcb21..9f2e907 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 _0x9e0e=['orderBy','keys','length','internal','concat','mac','00:00:00:00:00:00','address','127.0.0.1','model','join','createHash','md5','update','digest','hex','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','hostname','macAddress','ipAddress','substring','child_process','execSync'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9e0e,0x15d));var _0xe9e0=function(_0x2f1cae,_0x10e370){_0x2f1cae=_0x2f1cae-0x0;var _0x11de10=_0x9e0e[_0x2f1cae];return _0x11de10;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0xe9e0('0x0'))[_0xe9e0('0x1')];var config=require('../environment');function getInterfaces(){var _0x39f122=[];var _0x516303=os['networkInterfaces']();var _0x45a870=_[_0xe9e0('0x2')](_[_0xe9e0('0x3')](_0x516303));for(var _0x35e3b1=0x0;_0x35e3b1<_0x45a870[_0xe9e0('0x4')];_0x35e3b1++){var _0x148b14=_0x516303[_0x45a870[_0x35e3b1]]['filter'](function(_0x4c519a){return _0x4c519a['family']==='IPv4'&&_0x4c519a[_0xe9e0('0x5')]===![];});_0x39f122=_0x39f122[_0xe9e0('0x6')](_0x148b14);}return _0x39f122;}function getFirstInterface(){var _0x4682ee=_['head'](getInterfaces());return{'macAddress':_0x4682ee&&_0x4682ee[_0xe9e0('0x7')]?_0x4682ee[_0xe9e0('0x7')]:_0xe9e0('0x8'),'ipAddress':_0x4682ee&&_0x4682ee[_0xe9e0('0x9')]?_0x4682ee[_0xe9e0('0x9')]:_0xe9e0('0xa')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x235a10=_[_0xe9e0('0x2')](os['cpus']()['map'](function(_0x4dab3a){return _0x4dab3a[_0xe9e0('0xb')];}))[_0xe9e0('0xc')](':');return crypto[_0xe9e0('0xd')](_0xe9e0('0xe'))[_0xe9e0('0xf')](_0x235a10)[_0xe9e0('0x10')](_0xe9e0('0x11'));}exports['getUuid']=function(){var _0x43f7e8=os[_0xe9e0('0x12')]();var _0x203379=/[0-9a-f-]{36}/;if(config[_0xe9e0('0x13')]&&_0x203379['test'](config[_0xe9e0('0x13')])){return config[_0xe9e0('0x13')];}else if(_0x43f7e8===_0xe9e0('0x14')){return exec(_0xe9e0('0x15'),{'encoding':_0xe9e0('0x16')})['replace']('\x0d\x0a','');}else{var _0x590deb=getFirstInterface();var _0x16f1c2=getCPUhash();var _0x567f3b=_0x16f1c2+'|'+os[_0xe9e0('0x17')]()+'|'+_0x590deb[_0xe9e0('0x18')]+'|'+_0x590deb[_0xe9e0('0x19')];var _0x4d7be9=crypto[_0xe9e0('0xd')](_0xe9e0('0xe'))[_0xe9e0('0xf')](_0x567f3b)[_0xe9e0('0x10')](_0xe9e0('0x11'));return _0x4d7be9[_0xe9e0('0x1a')](0x0,0x8)+'-'+_0x4d7be9[_0xe9e0('0x1a')](0x8,0xc)+'-'+_0x4d7be9[_0xe9e0('0x1a')](0xc,0x10)+'-'+_0x4d7be9['substring'](0x10,0x14)+'-'+_0x4d7be9[_0xe9e0('0x1a')](0x14);}}; \ No newline at end of file +var _0x9728=['filter','family','IPv4','internal','mac','00:00:00:00:00:00','getFirstInterface','map','join','update','digest','getUuid','platform','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','hex','substring','child_process','execSync','networkInterfaces','keys'];(function(_0x43cd8c,_0x53b715){var _0x4f879e=function(_0x1d5eb7){while(--_0x1d5eb7){_0x43cd8c['push'](_0x43cd8c['shift']());}};_0x4f879e(++_0x53b715);}(_0x9728,0x1af));var _0x8972=function(_0xace2bb,_0x5c2051){_0xace2bb=_0xace2bb-0x0;var _0x2cacee=_0x9728[_0xace2bb];return _0x2cacee;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x8972('0x0'))[_0x8972('0x1')];var config=require('../environment');function getInterfaces(){var _0x1b53d7=[];var _0x54775e=os[_0x8972('0x2')]();var _0x5d1a76=_['orderBy'](_[_0x8972('0x3')](_0x54775e));for(var _0xa12f20=0x0;_0xa12f20<_0x5d1a76['length'];_0xa12f20++){var _0x4d44b6=_0x54775e[_0x5d1a76[_0xa12f20]][_0x8972('0x4')](function(_0x29be76){return _0x29be76[_0x8972('0x5')]===_0x8972('0x6')&&_0x29be76[_0x8972('0x7')]===![];});_0x1b53d7=_0x1b53d7['concat'](_0x4d44b6);}return _0x1b53d7;}function getFirstInterface(){var _0x40918a=_['head'](getInterfaces());return{'macAddress':_0x40918a&&_0x40918a[_0x8972('0x8')]?_0x40918a['mac']:_0x8972('0x9'),'ipAddress':_0x40918a&&_0x40918a['address']?_0x40918a['address']:'127.0.0.1'};}exports[_0x8972('0xa')]=getFirstInterface;function getCPUhash(){var _0x4deb5e=_['orderBy'](os['cpus']()[_0x8972('0xb')](function(_0x37a7c4){return _0x37a7c4['model'];}))[_0x8972('0xc')](':');return crypto['createHash']('md5')[_0x8972('0xd')](_0x4deb5e)[_0x8972('0xe')]('hex');}exports[_0x8972('0xf')]=function(){var _0x3fbb4f=os[_0x8972('0x10')]();var _0x128eab=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x128eab[_0x8972('0x11')](config[_0x8972('0x12')])){return config['licenseToken'];}else if(_0x3fbb4f===_0x8972('0x13')){return exec(_0x8972('0x14'),{'encoding':_0x8972('0x15')})[_0x8972('0x16')]('\x0d\x0a','');}else{var _0x2d82c5=getFirstInterface();var _0x253238=getCPUhash();var _0x3b55ba=_0x253238+'|'+os[_0x8972('0x17')]()+'|'+_0x2d82c5[_0x8972('0x18')]+'|'+_0x2d82c5[_0x8972('0x19')];var _0x19e372=crypto[_0x8972('0x1a')]('md5')[_0x8972('0xd')](_0x3b55ba)['digest'](_0x8972('0x1b'));return _0x19e372[_0x8972('0x1c')](0x0,0x8)+'-'+_0x19e372[_0x8972('0x1c')](0x8,0xc)+'-'+_0x19e372['substring'](0xc,0x10)+'-'+_0x19e372[_0x8972('0x1c')](0x10,0x14)+'-'+_0x19e372[_0x8972('0x1c')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index fb804e1..f700b7f 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 _0x1a4f=['update','encryptString','YYYY-MM-DD\x20HH:mm','days','finally','getUuid','License','findOrCreate','error','default','util','moment','bluebird','pkginfo','version','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x2a40bd,_0x7351d3){var _0x3504f3=function(_0x2fb338){while(--_0x2fb338){_0x2a40bd['push'](_0x2a40bd['shift']());}};_0x3504f3(++_0x7351d3);}(_0x1a4f,0x1de));var _0xf1a4=function(_0x3c9c2f,_0x10db65){_0x3c9c2f=_0x3c9c2f-0x0;var _0x457119=_0x1a4f[_0x3c9c2f];return _0x457119;};'use strict';var util=require(_0xf1a4('0x0'));var moment=require(_0xf1a4('0x1'));var rp=require('request-promise');var BPromise=require(_0xf1a4('0x2'));var pkginfo=require(_0xf1a4('0x3'))(module,_0xf1a4('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xf1a4('0x5'));var hardware=require('./hardware');var logger=require(_0xf1a4('0x6'))(_0xf1a4('0x7'));var HOST=_0xf1a4('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2155b8){return new BPromise(function(_0xd57b68,_0x5a9498){var _0x4ae0c1=util[_0xf1a4('0x9')](_0xf1a4('0xa'),HOST,_0x2155b8,module[_0xf1a4('0xb')][_0xf1a4('0x4')]);if(oldToken){_0x4ae0c1=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x2155b8,module[_0xf1a4('0xb')]['version'],oldToken);}var _0x124951={'uri':_0x4ae0c1,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x124951)[_0xf1a4('0xc')](function(_0x5a6021){_0xd57b68(_0x5a6021);})[_0xf1a4('0xd')](function(_0x14602f){_0x5a9498(_0x14602f);});});}function manageLicense(_0x1e1790,_0x28c64f){var _0x531d1d=_0x28c64f[_0xf1a4('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x531d1d[_0xf1a4('0xf')]!==_0x1e1790&&!_0x531d1d[_0xf1a4('0x10')]){oldToken=_0x531d1d[_0xf1a4('0xf')];}httpRequest(_0x1e1790)[_0xf1a4('0xc')](function(_0x9ef62c){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x9ef62c[_0xf1a4('0x11')]){isOldTokenSent=![];if(!_0x531d1d[_0xf1a4('0x7')]&&_0x531d1d[_0xf1a4('0x7')]!=_0x9ef62c[_0xf1a4('0x7')]||_0x531d1d[_0xf1a4('0x7')]&&_0x531d1d[_0xf1a4('0x10')]){logger[_0xf1a4('0x12')](_0xf1a4('0x13'));}if(_0x531d1d[_0xf1a4('0x7')]&&!_0x531d1d[_0xf1a4('0x10')]&&_0x531d1d[_0xf1a4('0x7')]!=_0x9ef62c[_0xf1a4('0x7')]){logger[_0xf1a4('0x12')](_0xf1a4('0x14'));}if(_0x531d1d['license']&&!_0x531d1d[_0xf1a4('0x10')]&&_0x531d1d['license']==_0x9ef62c[_0xf1a4('0x7')]){return _0x28c64f;}return _0x28c64f['update']({'data1':_0x1e1790,'data2':null,'license':_0x9ef62c[_0xf1a4('0x7')]});}else{if(_0x9ef62c[_0xf1a4('0x7')]||_0x531d1d['license']){if(!_0x531d1d[_0xf1a4('0x10')]){if(_0x531d1d[_0xf1a4('0xf')]==_0x1e1790){GRAY_PERIOD_REASON=_0xf1a4('0x15');logger[_0xf1a4('0x12')](_0xf1a4('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xf1a4('0x12')](_0xf1a4('0x17'),_0x531d1d['data1'],_0x1e1790);}logger[_0xf1a4('0x12')](_0xf1a4('0x18'),GRAY_PERIOD_REASON[_0xf1a4('0x19')](),moment()[_0xf1a4('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x28c64f[_0xf1a4('0x1a')]({'data2':encryptor[_0xf1a4('0x1b')](moment()[_0xf1a4('0x9')](_0xf1a4('0x1c')))});}else{if(moment()['diff'](encryptor['decryptString'](_0x531d1d[_0xf1a4('0x10')]),_0xf1a4('0x1d'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()['format'](_0xf1a4('0x1c')));isOldTokenSent=![];return _0x28c64f[_0xf1a4('0x1a')]({'data1':_0x1e1790,'data2':null,'license':null});}}}else{if(_0x531d1d[_0xf1a4('0xf')]!=_0x1e1790){logger['info'](_0xf1a4('0x17'),_0x531d1d['data1'],_0x1e1790);return _0x28c64f['update']({'data1':_0x1e1790,'data2':null,'license':null});}}}return _0x28c64f;})[_0xf1a4('0xc')](function(_0x13927f){_0x28c64f=_0x13927f;})['catch'](function(_0x5013b6){logger['error'](_0x5013b6['message']);})[_0xf1a4('0x1e')](function(){setTimeout(function(){manageLicense(hardware[_0xf1a4('0x1f')](),_0x28c64f);},TIME);});}function defaultLicense(){var _0x271333=hardware[_0xf1a4('0x1f')]();if(_0x271333){return db[_0xf1a4('0x20')][_0xf1a4('0x21')]({'where':{'id':0x1},'defaults':{'data1':_0x271333}})['spread'](function(_0x1e1ea3,_0x5b8c4f){logger[_0xf1a4('0x12')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x271333);manageLicense(_0x271333,_0x1e1ea3);})[_0xf1a4('0xd')](function(_0x4c9c80){logger[_0xf1a4('0x22')](_0x4c9c80['message']);});}}exports[_0xf1a4('0x23')]=defaultLicense; \ No newline at end of file +var _0x0ce1=['bluebird','pkginfo','../../mysqldb','../../components/encryptor','./hardware','../logger','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','catch','data1','license','data2','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','decryptString','DEMO\x20START\x20AT\x20%s','message','getUuid','License','findOrCreate','spread','error','default','util','moment'];(function(_0x1d6abc,_0x41c5cc){var _0x1cf65b=function(_0x17d12e){while(--_0x17d12e){_0x1d6abc['push'](_0x1d6abc['shift']());}};_0x1cf65b(++_0x41c5cc);}(_0x0ce1,0x166));var _0x10ce=function(_0x38f705,_0x2b09c7){_0x38f705=_0x38f705-0x0;var _0x5d2722=_0x0ce1[_0x38f705];return _0x5d2722;};'use strict';var util=require(_0x10ce('0x0'));var moment=require(_0x10ce('0x1'));var rp=require('request-promise');var BPromise=require(_0x10ce('0x2'));var pkginfo=require(_0x10ce('0x3'))(module,'version');var db=require(_0x10ce('0x4'))['db'];var encryptor=require(_0x10ce('0x5'));var hardware=require(_0x10ce('0x6'));var logger=require(_0x10ce('0x7'))('license');var HOST=_0x10ce('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xe7392c){return new BPromise(function(_0x4e6f6b,_0x16698b){var _0x5aaa19=util[_0x10ce('0x9')](_0x10ce('0xa'),HOST,_0xe7392c,module[_0x10ce('0xb')]['version']);if(oldToken){_0x5aaa19=util[_0x10ce('0x9')](_0x10ce('0xc'),HOST,_0xe7392c,module['exports'][_0x10ce('0xd')],oldToken);}var _0x2628dc={'uri':_0x5aaa19,'method':_0x10ce('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2628dc)[_0x10ce('0xf')](function(_0x199590){_0x4e6f6b(_0x199590);})[_0x10ce('0x10')](function(_0x26c604){_0x16698b(_0x26c604);});});}function manageLicense(_0x1ba885,_0x1538b4){var _0x8fccdc=_0x1538b4['get']({'plain':!![]});if(!isOldTokenSent&&_0x8fccdc[_0x10ce('0x11')]!==_0x1ba885&&!_0x8fccdc['data2']){oldToken=_0x8fccdc[_0x10ce('0x11')];}httpRequest(_0x1ba885)['then'](function(_0x199298){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x199298['active']){isOldTokenSent=![];if(!_0x8fccdc[_0x10ce('0x12')]&&_0x8fccdc[_0x10ce('0x12')]!=_0x199298[_0x10ce('0x12')]||_0x8fccdc[_0x10ce('0x12')]&&_0x8fccdc[_0x10ce('0x13')]){logger['info'](_0x10ce('0x14'));}if(_0x8fccdc['license']&&!_0x8fccdc[_0x10ce('0x13')]&&_0x8fccdc[_0x10ce('0x12')]!=_0x199298['license']){logger[_0x10ce('0x15')](_0x10ce('0x16'));}if(_0x8fccdc['license']&&!_0x8fccdc[_0x10ce('0x13')]&&_0x8fccdc[_0x10ce('0x12')]==_0x199298['license']){return _0x1538b4;}return _0x1538b4[_0x10ce('0x17')]({'data1':_0x1ba885,'data2':null,'license':_0x199298[_0x10ce('0x12')]});}else{if(_0x199298[_0x10ce('0x12')]||_0x8fccdc['license']){if(!_0x8fccdc[_0x10ce('0x13')]){if(_0x8fccdc[_0x10ce('0x11')]==_0x1ba885){GRAY_PERIOD_REASON=_0x10ce('0x18');logger['info'](_0x10ce('0x19'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x10ce('0x15')](_0x10ce('0x1a'),_0x8fccdc[_0x10ce('0x11')],_0x1ba885);}logger[_0x10ce('0x15')](_0x10ce('0x1b'),GRAY_PERIOD_REASON[_0x10ce('0x1c')](),moment()[_0x10ce('0x9')](_0x10ce('0x1d')));return _0x1538b4['update']({'data2':encryptor[_0x10ce('0x1e')](moment()[_0x10ce('0x9')](_0x10ce('0x1d')))});}else{if(moment()['diff'](encryptor[_0x10ce('0x1f')](_0x8fccdc[_0x10ce('0x13')]),'days')>DAYS){logger[_0x10ce('0x15')](_0x10ce('0x20'),moment()[_0x10ce('0x9')](_0x10ce('0x1d')));isOldTokenSent=![];return _0x1538b4[_0x10ce('0x17')]({'data1':_0x1ba885,'data2':null,'license':null});}}}else{if(_0x8fccdc[_0x10ce('0x11')]!=_0x1ba885){logger[_0x10ce('0x15')](_0x10ce('0x1a'),_0x8fccdc[_0x10ce('0x11')],_0x1ba885);return _0x1538b4[_0x10ce('0x17')]({'data1':_0x1ba885,'data2':null,'license':null});}}}return _0x1538b4;})[_0x10ce('0xf')](function(_0x3d8098){_0x1538b4=_0x3d8098;})[_0x10ce('0x10')](function(_0x4a0a04){logger['error'](_0x4a0a04[_0x10ce('0x21')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0x10ce('0x22')](),_0x1538b4);},TIME);});}function defaultLicense(){var _0x5e2c17=hardware[_0x10ce('0x22')]();if(_0x5e2c17){return db[_0x10ce('0x23')][_0x10ce('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x5e2c17}})[_0x10ce('0x25')](function(_0x13e43c,_0x5d6249){logger[_0x10ce('0x15')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x5e2c17);manageLicense(_0x5e2c17,_0x13e43c);})['catch'](function(_0x4a5244){logger[_0x10ce('0x26')](_0x4a5244['message']);});}}exports[_0x10ce('0x27')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 4ecfdf9..b467a90 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 _0x7ba0=['../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','then','catch','uuid','license','isEmpty','data1','data2','split','format','%s:%s:%s','parse','machineUuid','decryptString','gray','deadline','add','grayReason','changed','disabled','message','User','role','COUNT','sequelize','col','count','admin','user','telephone','users','telephones','forEach','pick','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','./hardware'];(function(_0x51f632,_0x5a14d5){var _0x24cf36=function(_0x3f2799){while(--_0x3f2799){_0x51f632['push'](_0x51f632['shift']());}};_0x24cf36(++_0x5a14d5);}(_0x7ba0,0x11b));var _0x07ba=function(_0x1992eb,_0x2e3d14){_0x1992eb=_0x1992eb-0x0;var _0x142b11=_0x7ba0[_0x1992eb];return _0x142b11;};'use strict';var util=require(_0x07ba('0x0'));var _=require(_0x07ba('0x1'));var moment=require(_0x07ba('0x2'));var BPromise=require(_0x07ba('0x3'));var hardware=require(_0x07ba('0x4'));var encryptor=require(_0x07ba('0x5'));var db=require(_0x07ba('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x07ba('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x07ba('0x8'),'machineUuid':hardware[_0x07ba('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':_0x07ba('0xa'),'machineUuid':hardware[_0x07ba('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x258b37){return new BPromise(function(_0x5a385a,_0x103bad){return db[_0x07ba('0xb')][_0x07ba('0xc')](_['defaults'](_0x258b37,{'raw':!![],'where':{'id':0x1}}))[_0x07ba('0xd')](function(_0x555bfc){return checkLicense(_0x555bfc,null);})[_0x07ba('0xd')](function(_0x2da10a){_0x5a385a(_0x2da10a);return;})[_0x07ba('0xe')](function(_0x5cfde5){_0x103bad(_0x5cfde5);});});}function checkLicense(_0x1efd13,_0x57f5b2){if(!_0x1efd13){demoLicense[_0x07ba('0xf')]=_0x1efd13['data1'];return demoLicense;}try{var _0x3bb5f8=_0x57f5b2||_0x1efd13[_0x07ba('0x10')];if(_[_0x07ba('0x11')](_0x3bb5f8)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x273316=_0x1efd13[_0x07ba('0x12')];var _0x449ebd=_0x1efd13[_0x07ba('0x13')];var _0x17dc19=_0x273316[_0x07ba('0x14')]('-')[0x4];var _0x2be913=_0x273316[_0x07ba('0x14')]('-')[0x0];var _0x465b20=encryptor['decryptString'](_0x3bb5f8,util[_0x07ba('0x15')](_0x07ba('0x16'),_0x17dc19,_0x273316,_0x2be913));var _0x44800c=JSON[_0x07ba('0x17')](_0x465b20);_0x44800c['demo']=![];_0x44800c['uuid']=_0x273316;_0x44800c[_0x07ba('0x18')]=hardware['getUuid']();if(_0x449ebd){var _0x5505cd=encryptor[_0x07ba('0x19')](_0x449ebd);_0x44800c[_0x07ba('0x1a')]=_0x5505cd;_0x44800c[_0x07ba('0x1b')]=moment(_0x5505cd)[_0x07ba('0x1c')](0x7,'days')[_0x07ba('0x15')]();_0x44800c[_0x07ba('0x1d')]=_0x44800c[_0x07ba('0xf')]!=_0x44800c[_0x07ba('0x18')]?_0x07ba('0x1e'):_0x07ba('0x1f');}return _0x44800c;}catch(_0x2031dc){breakingLicense[_0x07ba('0xf')]=_0x1efd13['data1'];breakingLicense[_0x07ba('0x20')]=_0x2031dc[_0x07ba('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x1590be,_0x43dcb4){getLicense()[_0x07ba('0xd')](function(_0x4c5ea5){return db[_0x07ba('0x21')]['findAll']({'attributes':[_0x07ba('0x22'),[db['sequelize']['fn'](_0x07ba('0x23'),db[_0x07ba('0x24')][_0x07ba('0x25')](_0x07ba('0x22'))),_0x07ba('0x26')]],'group':_0x07ba('0x22'),'where':{'role':{'$or':[_0x07ba('0x27'),_0x07ba('0x28'),_0x07ba('0x29')]}},'raw':!![]})['then'](function(_0x52159a){var _0x28dcbb={'user':_0x4c5ea5[_0x07ba('0x2a')]||0x0,'telephone':_0x4c5ea5[_0x07ba('0x2b')]||0x0};_0x52159a[_0x07ba('0x2c')](function(_0x2ecd79){var _0x3a1059=_0x2ecd79['role']==='admin'?_0x07ba('0x28'):_0x2ecd79[_0x07ba('0x22')];_0x28dcbb[_0x3a1059]-=_0x2ecd79['count'];if(_0x28dcbb[_0x3a1059]<0x0)_0x28dcbb[_0x3a1059]=0x0;});_0x1590be(_0x28dcbb);return;});})[_0x07ba('0xe')](function(_0x2bda0e){_0x43dcb4(_0x2bda0e);});});}function checkUserLimits(_0x36b354){return new BPromise(function(_0x50cf24,_0x495fd4){getLimits()[_0x07ba('0xd')](function(_0xf11556){var _0x3c620b=_[_0x07ba('0x2d')](_['countBy'](_0x36b354,_0x07ba('0x22')),[_0x07ba('0x27'),'user',_0x07ba('0x29')]);var _0x1d2a11=(_0x3c620b['admin']||0x0)+(_0x3c620b[_0x07ba('0x28')]||0x0);var _0x36441c=_0x3c620b[_0x07ba('0x29')]||0x0;if(_0x1d2a11>_0xf11556[_0x07ba('0x28')])return _0x495fd4(_0x07ba('0x2e'));if(_0x36441c>_0xf11556[_0x07ba('0x29')])return _0x495fd4('License\x20limit\x20reached\x20for\x20telephones');return _0x50cf24();})[_0x07ba('0xe')](function(_0x4c0119){_0x495fd4(_0x4c0119);});});}module[_0x07ba('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x4717=['./hardware','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','uuid','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','%s:%s:%s','parse','gray','deadline','days','grayReason','changed','data1','message','role','sequelize','col','admin','user','telephone','users','telephones','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment'];(function(_0xf394a,_0x20d1dd){var _0xde580f=function(_0x44798e){while(--_0x44798e){_0xf394a['push'](_0xf394a['shift']());}};_0xde580f(++_0x20d1dd);}(_0x4717,0x17f));var _0x7471=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x4717[_0x5e36d1];return _0x950b9e;};'use strict';var util=require('util');var _=require(_0x7471('0x0'));var moment=require(_0x7471('0x1'));var BPromise=require('bluebird');var hardware=require(_0x7471('0x2'));var encryptor=require('../../components/encryptor');var db=require(_0x7471('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7471('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x7471('0x5'),'machineUuid':hardware[_0x7471('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x7471('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x7471('0x7'),'machineUuid':hardware[_0x7471('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x14c5e8){return new BPromise(function(_0x1bd6da,_0x3cf8ad){return db['License'][_0x7471('0x8')](_['defaults'](_0x14c5e8,{'raw':!![],'where':{'id':0x1}}))[_0x7471('0x9')](function(_0x30661d){return checkLicense(_0x30661d,null);})[_0x7471('0x9')](function(_0x43079c){_0x1bd6da(_0x43079c);return;})[_0x7471('0xa')](function(_0x58b61a){_0x3cf8ad(_0x58b61a);});});}function checkLicense(_0x1116cd,_0x541ad7){if(!_0x1116cd){demoLicense[_0x7471('0xb')]=_0x1116cd['data1'];return demoLicense;}try{var _0x599160=_0x541ad7||_0x1116cd[_0x7471('0xc')];if(_[_0x7471('0xd')](_0x599160)){throw new Error(_0x7471('0xe'));}var _0x12103f=_0x1116cd['data1'];var _0x4a171a=_0x1116cd[_0x7471('0xf')];var _0x1f4b5e=_0x12103f['split']('-')[0x4];var _0x15fd9f=_0x12103f['split']('-')[0x0];var _0x1c4470=encryptor['decryptString'](_0x599160,util['format'](_0x7471('0x10'),_0x1f4b5e,_0x12103f,_0x15fd9f));var _0x3b58b7=JSON[_0x7471('0x11')](_0x1c4470);_0x3b58b7['demo']=![];_0x3b58b7[_0x7471('0xb')]=_0x12103f;_0x3b58b7['machineUuid']=hardware[_0x7471('0x6')]();if(_0x4a171a){var _0x193100=encryptor['decryptString'](_0x4a171a);_0x3b58b7[_0x7471('0x12')]=_0x193100;_0x3b58b7[_0x7471('0x13')]=moment(_0x193100)['add'](0x7,_0x7471('0x14'))['format']();_0x3b58b7[_0x7471('0x15')]=_0x3b58b7['uuid']!=_0x3b58b7['machineUuid']?_0x7471('0x16'):'disabled';}return _0x3b58b7;}catch(_0x519070){breakingLicense[_0x7471('0xb')]=_0x1116cd[_0x7471('0x17')];breakingLicense[_0x7471('0x18')]=_0x519070[_0x7471('0x18')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x412ac5,_0x386123){getLicense()[_0x7471('0x9')](function(_0x56e567){return db['User']['findAll']({'attributes':[_0x7471('0x19'),[db[_0x7471('0x1a')]['fn']('COUNT',db[_0x7471('0x1a')][_0x7471('0x1b')](_0x7471('0x19'))),'count']],'group':'role','where':{'role':{'$or':[_0x7471('0x1c'),_0x7471('0x1d'),_0x7471('0x1e')]}},'raw':!![]})[_0x7471('0x9')](function(_0x1d1128){var _0x2c3a47={'user':_0x56e567[_0x7471('0x1f')]||0x0,'telephone':_0x56e567[_0x7471('0x20')]||0x0};_0x1d1128['forEach'](function(_0x34b4d4){var _0x48d33b=_0x34b4d4[_0x7471('0x19')]===_0x7471('0x1c')?_0x7471('0x1d'):_0x34b4d4['role'];_0x2c3a47[_0x48d33b]-=_0x34b4d4['count'];if(_0x2c3a47[_0x48d33b]<0x0)_0x2c3a47[_0x48d33b]=0x0;});_0x412ac5(_0x2c3a47);return;});})['catch'](function(_0x1cf640){_0x386123(_0x1cf640);});});}function checkUserLimits(_0x269463){return new BPromise(function(_0x5e8bfa,_0x216f3e){getLimits()['then'](function(_0x4aae7c){var _0x208390=_['pick'](_['countBy'](_0x269463,_0x7471('0x19')),['admin',_0x7471('0x1d'),_0x7471('0x1e')]);var _0x3a7735=(_0x208390[_0x7471('0x1c')]||0x0)+(_0x208390['user']||0x0);var _0x10d193=_0x208390[_0x7471('0x1e')]||0x0;if(_0x3a7735>_0x4aae7c[_0x7471('0x1d')])return _0x216f3e('License\x20limit\x20reached\x20for\x20users');if(_0x10d193>_0x4aae7c[_0x7471('0x1e')])return _0x216f3e(_0x7471('0x21'));return _0x5e8bfa();})[_0x7471('0xa')](function(_0xfd08b2){_0x216f3e(_0xfd08b2);});});}module[_0x7471('0x22')]={'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 8e91c78..dbe1ece 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 _0x1c9a=['myappanuglar-secret','secret','exports'];(function(_0x1e52df,_0x1c19d3){var _0x48b53b=function(_0x475121){while(--_0x475121){_0x1e52df['push'](_0x1e52df['shift']());}};_0x48b53b(++_0x1c19d3);}(_0x1c9a,0x98));var _0xa1c9=function(_0xb04355,_0x57aeef){_0xb04355=_0xb04355-0x0;var _0x587dd1=_0x1c9a[_0xb04355];return _0x587dd1;};'use strict';module[_0xa1c9('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0xa1c9('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa1c9('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x84a0=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0xde277c,_0x4ab374){var _0x22add1=function(_0x433f71){while(--_0x433f71){_0xde277c['push'](_0xde277c['shift']());}};_0x22add1(++_0x4ab374);}(_0x84a0,0x66));var _0x084a=function(_0xb96a3f,_0x5ace6c){_0xb96a3f=_0xb96a3f-0x0;var _0x4f9a09=_0x84a0[_0xb96a3f];return _0x4f9a09;};'use strict';module[_0x084a('0x0')]={'DOMAIN':_0x084a('0x1'),'SESSION_SECRET':_0x084a('0x2'),'GOOGLE_ID':_0x084a('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 425e03d..fd38420 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5989=['INFO','join','/var','log','xcally','format','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','exports','File','%s-%s','error','transports','info','env','debugLevel','winston','util'];(function(_0x349204,_0xd65f54){var _0x5ec406=function(_0x4b7eeb){while(--_0x4b7eeb){_0x349204['push'](_0x349204['shift']());}};_0x5ec406(++_0xd65f54);}(_0x5989,0x1ae));var _0x9598=function(_0x59ed8c,_0x497c0f){_0x59ed8c=_0x59ed8c-0x0;var _0x2ae760=_0x5989[_0x59ed8c];return _0x2ae760;};'use strict';var moment=require('moment');var winston=require(_0x9598('0x0'));var util=require(_0x9598('0x1'));var path=require('path');var debugLevel=_0x9598('0x2');function filename(_0x192105,_0x578d7b){return path[_0x9598('0x3')](_0x9598('0x4'),_0x9598('0x5'),_0x9598('0x6'),util[_0x9598('0x7')]('%s-%s.log',_0x192105,_0x578d7b));}function formatter(_0x2cabbb,_0xe135d7){_0xe135d7[_0x9598('0x8')]=_0xe135d7[_0x9598('0x8')][_0x9598('0x9')](/@@{/g,_0x9598('0xa'))[_0x9598('0x9')](/}@@/g,_0x9598('0xb'))[_0x9598('0x9')](/@{/g,'{{')[_0x9598('0x9')](/}@/g,'}}');return util[_0x9598('0x7')](_0x9598('0xc'),moment()[_0x9598('0x7')](_0x9598('0xd')),_0xe135d7[_0x9598('0xe')][_0x9598('0xf')](),_0x2cabbb,_0xe135d7[_0x9598('0x8')]);}module[_0x9598('0x10')]=function(_0x51f38a){return new winston['Logger']({'transports':[new winston['transports'][(_0x9598('0x11'))]({'name':util[_0x9598('0x7')](_0x9598('0x12'),_0x51f38a,_0x9598('0x13')),'filename':filename(_0x51f38a,_0x9598('0x13')),'level':_0x9598('0x13'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x24017b){return formatter(_0x51f38a,_0x24017b);}}),new winston[(_0x9598('0x14'))][(_0x9598('0x11'))]({'name':util['format'](_0x9598('0x12'),_0x51f38a,_0x9598('0x15')),'filename':filename(_0x51f38a,_0x9598('0x15')),'level':_0x9598('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x10f7ab){return formatter(_0x51f38a,_0x10f7ab);}}),new winston[(_0x9598('0x14'))]['Console']({'level':process[_0x9598('0x16')][_0x9598('0x17')]||debugLevel,'json':![],'formatter':function(_0x209820){return formatter(_0x51f38a,_0x209820);}})]});}; \ No newline at end of file +var _0x2768=['xcally','format','%s-%s.log','message','{{{','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','Logger','File','%s-%s','error','transports','info','Console','env','debugLevel','moment','winston','util','path','INFO','/var'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0x2768,0x13f));var _0x8276=function(_0xf64f2f,_0x31b44d){_0xf64f2f=_0xf64f2f-0x0;var _0xc70aac=_0x2768[_0xf64f2f];return _0xc70aac;};'use strict';var moment=require(_0x8276('0x0'));var winston=require(_0x8276('0x1'));var util=require(_0x8276('0x2'));var path=require(_0x8276('0x3'));var debugLevel=_0x8276('0x4');function filename(_0x167f65,_0x5ec384){return path['join'](_0x8276('0x5'),'log',_0x8276('0x6'),util[_0x8276('0x7')](_0x8276('0x8'),_0x167f65,_0x5ec384));}function formatter(_0x567d40,_0x1248d0){_0x1248d0[_0x8276('0x9')]=_0x1248d0['message']['replace'](/@@{/g,_0x8276('0xa'))[_0x8276('0xb')](/}@@/g,_0x8276('0xc'))[_0x8276('0xb')](/@{/g,'{{')[_0x8276('0xb')](/}@/g,'}}');return util[_0x8276('0x7')](_0x8276('0xd'),moment()[_0x8276('0x7')](_0x8276('0xe')),_0x1248d0['level'][_0x8276('0xf')](),_0x567d40,_0x1248d0['message']);}module['exports']=function(_0x3b9130){return new winston[(_0x8276('0x10'))]({'transports':[new winston['transports'][(_0x8276('0x11'))]({'name':util['format'](_0x8276('0x12'),_0x3b9130,_0x8276('0x13')),'filename':filename(_0x3b9130,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2bc890){return formatter(_0x3b9130,_0x2bc890);}}),new winston[(_0x8276('0x14'))]['File']({'name':util['format'](_0x8276('0x12'),_0x3b9130,_0x8276('0x15')),'filename':filename(_0x3b9130,_0x8276('0x15')),'level':_0x8276('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xd11678){return formatter(_0x3b9130,_0xd11678);}}),new winston['transports'][(_0x8276('0x16'))]({'level':process[_0x8276('0x17')][_0x8276('0x18')]||debugLevel,'json':![],'formatter':function(_0xe43073){return formatter(_0x3b9130,_0xe43073);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index e4b2380..a8096bd 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 _0x4059=['join','../../services/express/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','express'];(function(_0x46a635,_0x3cf6f0){var _0xff72f1=function(_0x3ac57b){while(--_0x3ac57b){_0x46a635['push'](_0x46a635['shift']());}};_0xff72f1(++_0x3cf6f0);}(_0x4059,0x1c7));var _0x9405=function(_0x1f6bd4,_0x35ebcd){_0x1f6bd4=_0x1f6bd4-0x0;var _0x4d582a=_0x4059[_0x1f6bd4];return _0x4d582a;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x9405('0x0'),'script':path[_0x9405('0x1')](__dirname,_0x9405('0x2'))},{'name':'ami','script':path[_0x9405('0x1')](__dirname,'../../services/ami/index.js')},{'name':_0x9405('0x3'),'script':path[_0x9405('0x1')](__dirname,_0x9405('0x4'))},{'name':_0x9405('0x5'),'script':path[_0x9405('0x1')](__dirname,_0x9405('0x6'))},{'name':_0x9405('0x7'),'script':path[_0x9405('0x1')](__dirname,_0x9405('0x8'))},{'name':_0x9405('0x9'),'script':path[_0x9405('0x1')](__dirname,_0x9405('0xa'))}]};module[_0x9405('0xb')]=config; \ No newline at end of file +var _0xc74f=['../../services/routing/index.js','xdr','exports','express','../../services/express/index.js','ami','join','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0x20f294,_0x276c6b){var _0x14738e=function(_0x161c86){while(--_0x161c86){_0x20f294['push'](_0x20f294['shift']());}};_0x14738e(++_0x276c6b);}(_0xc74f,0x1c5));var _0xfc74=function(_0x3220f9,_0x5e6590){_0x3220f9=_0x3220f9-0x0;var _0x1002b0=_0xc74f[_0x3220f9];return _0x1002b0;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xfc74('0x0'),'script':path['join'](__dirname,_0xfc74('0x1'))},{'name':_0xfc74('0x2'),'script':path[_0xfc74('0x3')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0xfc74('0x3')](__dirname,_0xfc74('0x4'))},{'name':_0xfc74('0x5'),'script':path[_0xfc74('0x3')](__dirname,_0xfc74('0x6'))},{'name':'routing','script':path['join'](__dirname,_0xfc74('0x7'))},{'name':_0xfc74('0x8'),'script':path[_0xfc74('0x3')](__dirname,'../../services/xdr/index.js')}]};module[_0xfc74('0x9')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 18afc16..e220587 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 _0x5ffe=['delete','dump','pm2','bluebird','connect','connected','start','disconnect','stop','restart','then','list','describe'];(function(_0x247690,_0x339971){var _0x3d4732=function(_0x21b0aa){while(--_0x21b0aa){_0x247690['push'](_0x247690['shift']());}};_0x3d4732(++_0x339971);}(_0x5ffe,0x17b));var _0xe5ff=function(_0x453d05,_0x60e2e9){_0x453d05=_0x453d05-0x0;var _0x2d8018=_0x5ffe[_0x453d05];return _0x2d8018;};'use strict';var pm2=require(_0xe5ff('0x0'));var BPromise=require(_0xe5ff('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x911ee5,_0x77192f){return pm2[_0xe5ff('0x2')](function(_0x2e089a){if(_0x2e089a){return _0x77192f(_0x2e089a);}return _0x911ee5(_0xe5ff('0x3'));});});};exports['start']=function(_0x10f9c0){return connect()['then'](function(){return new BPromise(function(_0x516692,_0x310035){return pm2[_0xe5ff('0x4')](_0x10f9c0,function(_0x3d412f,_0x3224ef){if(_0x3d412f){return _0x310035(_0x3d412f);}pm2[_0xe5ff('0x5')]();return _0x516692(_0x3224ef);});});});};exports[_0xe5ff('0x6')]=function(_0xf4e4ea){return connect()['then'](function(){return new BPromise(function(_0x5a6a85,_0x461274){return pm2[_0xe5ff('0x6')](_0xf4e4ea,function(_0x3ec823,_0x3b3601){if(_0x3ec823){return _0x461274(_0x3ec823);}pm2['disconnect']();return _0x5a6a85(_0x3b3601);});});});};exports[_0xe5ff('0x7')]=function(_0x4a4530){return connect()[_0xe5ff('0x8')](function(){return new BPromise(function(_0x2914e4,_0x34faae){return pm2[_0xe5ff('0x7')](_0x4a4530,function(_0x9bf0f4,_0x387cd2){if(_0x9bf0f4){return _0x34faae(_0x9bf0f4);}pm2[_0xe5ff('0x5')]();return _0x2914e4(_0x387cd2);});});});};exports[_0xe5ff('0x9')]=function(){return connect()[_0xe5ff('0x8')](function(){return new BPromise(function(_0x4094d8,_0x48a809){return pm2[_0xe5ff('0x9')](function(_0x228634,_0xf00123){if(_0x228634){return _0x48a809(_0x228634);}pm2['disconnect']();return _0x4094d8(_0xf00123);});});});};exports['describe']=function(_0x29b4f9){return connect()[_0xe5ff('0x8')](function(){return new BPromise(function(_0x1d6133,_0x2c21b9){return pm2[_0xe5ff('0xa')](_0x29b4f9,function(_0x3069ad,_0x231e0e){if(_0x3069ad){return _0x2c21b9(_0x3069ad);}pm2['disconnect']();return _0x1d6133(_0x231e0e);});});});};exports[_0xe5ff('0xb')]=function(_0x32d3e0){return connect()['then'](function(){return new BPromise(function(_0x7a2dcd,_0x2e4bd7){return pm2[_0xe5ff('0xb')](_0x32d3e0,function(_0x181499,_0x2c4904){if(_0x181499){return _0x2e4bd7(_0x181499);}pm2['disconnect']();return _0x7a2dcd(_0x2c4904);});});});};exports[_0xe5ff('0xc')]=function(){return connect()[_0xe5ff('0x8')](function(){return new BPromise(function(_0x15a982,_0x337793){return pm2['dump'](function(_0x547f4a){if(_0x547f4a){return _0x337793(_0x547f4a);}return _0x15a982('saved');});});});}; \ No newline at end of file +var _0xbebf=['saved','pm2','bluebird','then','start','disconnect','stop','restart','list','describe','delete','dump'];(function(_0x5408f0,_0x59fb0f){var _0x5b65ef=function(_0x38920c){while(--_0x38920c){_0x5408f0['push'](_0x5408f0['shift']());}};_0x5b65ef(++_0x59fb0f);}(_0xbebf,0x1bd));var _0xfbeb=function(_0x183786,_0x4ba236){_0x183786=_0x183786-0x0;var _0x11d7de=_0xbebf[_0x183786];return _0x11d7de;};'use strict';var pm2=require(_0xfbeb('0x0'));var BPromise=require(_0xfbeb('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x460c2b,_0x420439){return pm2['connect'](function(_0x351901){if(_0x351901){return _0x420439(_0x351901);}return _0x460c2b('connected');});});};exports['start']=function(_0x40cfb7){return connect()[_0xfbeb('0x2')](function(){return new BPromise(function(_0x519975,_0x2ae170){return pm2[_0xfbeb('0x3')](_0x40cfb7,function(_0x2d9f28,_0xb0ce98){if(_0x2d9f28){return _0x2ae170(_0x2d9f28);}pm2[_0xfbeb('0x4')]();return _0x519975(_0xb0ce98);});});});};exports[_0xfbeb('0x5')]=function(_0x1f8c7b){return connect()['then'](function(){return new BPromise(function(_0x137845,_0x4e8261){return pm2[_0xfbeb('0x5')](_0x1f8c7b,function(_0x129597,_0x1838b6){if(_0x129597){return _0x4e8261(_0x129597);}pm2[_0xfbeb('0x4')]();return _0x137845(_0x1838b6);});});});};exports[_0xfbeb('0x6')]=function(_0xa4f2f7){return connect()['then'](function(){return new BPromise(function(_0x50335c,_0x1d35b8){return pm2[_0xfbeb('0x6')](_0xa4f2f7,function(_0x29a014,_0x2ff2a8){if(_0x29a014){return _0x1d35b8(_0x29a014);}pm2[_0xfbeb('0x4')]();return _0x50335c(_0x2ff2a8);});});});};exports[_0xfbeb('0x7')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3ccc92,_0x37ae5d){return pm2[_0xfbeb('0x7')](function(_0x2f5b89,_0x38bd2c){if(_0x2f5b89){return _0x37ae5d(_0x2f5b89);}pm2[_0xfbeb('0x4')]();return _0x3ccc92(_0x38bd2c);});});});};exports[_0xfbeb('0x8')]=function(_0x1b243c){return connect()[_0xfbeb('0x2')](function(){return new BPromise(function(_0x56893d,_0x24bf2d){return pm2[_0xfbeb('0x8')](_0x1b243c,function(_0x31581e,_0x557665){if(_0x31581e){return _0x24bf2d(_0x31581e);}pm2[_0xfbeb('0x4')]();return _0x56893d(_0x557665);});});});};exports[_0xfbeb('0x9')]=function(_0x3f89e1){return connect()[_0xfbeb('0x2')](function(){return new BPromise(function(_0x371177,_0x3f43d9){return pm2[_0xfbeb('0x9')](_0x3f89e1,function(_0x280fd6,_0x37b0b2){if(_0x280fd6){return _0x3f43d9(_0x280fd6);}pm2[_0xfbeb('0x4')]();return _0x371177(_0x37b0b2);});});});};exports[_0xfbeb('0xa')]=function(){return connect()[_0xfbeb('0x2')](function(){return new BPromise(function(_0x37b461,_0x4ebd76){return pm2[_0xfbeb('0xa')](function(_0x5ea5ba){if(_0x5ea5ba){return _0x4ebd76(_0x5ea5ba);}return _0x37b461(_0xfbeb('0xb'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index f070424..87d5d88 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 _0x5dea=['ioredis','../../config/environment','../../mysqldb','../logger','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment'];(function(_0x2a4095,_0x13f4f0){var _0x52eeab=function(_0x3950dd){while(--_0x3950dd){_0x2a4095['push'](_0x2a4095['shift']());}};_0x52eeab(++_0x13f4f0);}(_0x5dea,0x94));var _0xa5de=function(_0x2c04b0,_0x47826a){_0x2c04b0=_0x2c04b0-0x0;var _0xb72a6d=_0x5dea[_0x2c04b0];return _0xb72a6d;};'use strict';var _=require(_0xa5de('0x0'));var moment=require(_0xa5de('0x1'));var Redis=require(_0xa5de('0x2'));var util=require('util');var config=require(_0xa5de('0x3'));var db=require(_0xa5de('0x4'))['db'];var logger=require(_0xa5de('0x5'))('schedule');config['redis']=_[_0xa5de('0x6')](config['redis'],{'host':_0xa5de('0x7'),'port':0x18eb});var io=require(_0xa5de('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x541120=0x0;var _0x54f1e0=[];return db[_0xa5de('0x9')]['find']({'raw':!![],'attributes':['id',_0xa5de('0xa')],'where':{'id':0x1}})[_0xa5de('0xb')](function(_0x42aac8){_0x541120=_0x42aac8[_0xa5de('0xa')];if(_0x541120){return db[_0xa5de('0xc')][_0xa5de('0xd')]({'raw':!![],'attributes':['id',_0xa5de('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x42aac8[_0xa5de('0xa')],_0xa5de('0xf'))}}});}else{return[];}})[_0xa5de('0xb')](function(_0x39411b){if(_0x39411b&&_0x39411b['length']){_0x54f1e0=_[_0xa5de('0x10')](_0x39411b||[],'id');logger[_0xa5de('0x11')](_0xa5de('0x12'),_0x54f1e0[_0xa5de('0x13')]());return db['ChatInteraction'][_0xa5de('0x14')]({'closeReason':'system','disposition':_0xa5de('0x15'),'closed':!![],'closedAt':moment()['format'](_0xa5de('0x16'))},{'where':{'id':_0x54f1e0}});}})[_0xa5de('0xb')](function(){if(_0x54f1e0&&_0x54f1e0[_0xa5de('0x17')]){logger['info'](_0xa5de('0x18'),_0x54f1e0[_0xa5de('0x13')]());for(var _0x342e3f=0x0;_0x342e3f<_0x54f1e0[_0xa5de('0x17')];_0x342e3f++){io[_0xa5de('0x19')]('chatInteraction:update',{'id':_0x54f1e0[_0x342e3f],'closed':!![]});}}})[_0xa5de('0x1a')](function(_0x20eb49){logger['error'](_0xa5de('0x1b'),_0x20eb49?util[_0xa5de('0x1c')](_0x20eb49,{'showHidden':![],'depth':null}):'');});}exports[_0xa5de('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x59e2=['then','ChatInteraction','findAll','lastMsgAt','minutes','length','info','join','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout'];(function(_0x9d9f9e,_0x52a029){var _0x48cb13=function(_0x177d55){while(--_0x177d55){_0x9d9f9e['push'](_0x9d9f9e['shift']());}};_0x48cb13(++_0x52a029);}(_0x59e2,0x8e));var _0x259e=function(_0x125c5d,_0x809f6f){_0x125c5d=_0x125c5d-0x0;var _0x1cab49=_0x59e2[_0x125c5d];return _0x1cab49;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x259e('0x0'));var util=require(_0x259e('0x1'));var config=require(_0x259e('0x2'));var db=require(_0x259e('0x3'))['db'];var logger=require(_0x259e('0x4'))(_0x259e('0x5'));config[_0x259e('0x6')]=_[_0x259e('0x7')](config[_0x259e('0x6')],{'host':_0x259e('0x8'),'port':0x18eb});var io=require(_0x259e('0x9'))(new Redis(config[_0x259e('0x6')]));function closeInteractions(){var _0x2b5634=0x0;var _0x390058=[];return db[_0x259e('0xa')][_0x259e('0xb')]({'raw':!![],'attributes':['id',_0x259e('0xc')],'where':{'id':0x1}})[_0x259e('0xd')](function(_0x3037c4){_0x2b5634=_0x3037c4[_0x259e('0xc')];if(_0x2b5634){return db[_0x259e('0xe')][_0x259e('0xf')]({'raw':!![],'attributes':['id',_0x259e('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x3037c4[_0x259e('0xc')],_0x259e('0x11'))}}});}else{return[];}})[_0x259e('0xd')](function(_0x4c04e6){if(_0x4c04e6&&_0x4c04e6[_0x259e('0x12')]){_0x390058=_['map'](_0x4c04e6||[],'id');logger[_0x259e('0x13')]('[CHAT]\x20Interactions\x20to\x20close:',_0x390058[_0x259e('0x14')]());return db[_0x259e('0xe')]['update']({'closeReason':'system','disposition':_0x259e('0x15'),'closed':!![],'closedAt':moment()[_0x259e('0x16')](_0x259e('0x17'))},{'where':{'id':_0x390058}});}})['then'](function(){if(_0x390058&&_0x390058[_0x259e('0x12')]){logger[_0x259e('0x13')](_0x259e('0x18'),_0x390058[_0x259e('0x14')]());for(var _0xa382e4=0x0;_0xa382e4<_0x390058[_0x259e('0x12')];_0xa382e4++){io[_0x259e('0x19')](_0x259e('0x1a'),{'id':_0x390058[_0xa382e4],'closed':!![]});}}})[_0x259e('0x1b')](function(_0x2d42b2){logger['error'](_0x259e('0x1c'),_0x2d42b2?util[_0x259e('0x1d')](_0x2d42b2,{'showHidden':![],'depth':null}):'');});}exports[_0x259e('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1f94465..f6bb2ee 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 _0xf705=['MailAccount','Smtp','host','port','secure','authentication','pass','\x22%s\x22\x20<%s>','name','user','bcc','subtractUnit','join','../../files/reports','savename','format','%s.%s','basename','extname','zip','existsSync','status','Sent','message','text','stringify','request','SendMail','then','error','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','keys','jobs','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','stop\x20cron','update','update\x20cron','util','lodash','moment','cron-job-manager','bluebird','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','service'];(function(_0x4d8389,_0xb964e7){var _0x149a41=function(_0x35c878){while(--_0x35c878){_0x4d8389['push'](_0x4d8389['shift']());}};_0x149a41(++_0xb964e7);}(_0xf705,0x9f));var _0x5f70=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xf705[_0xfae23b];return _0x200640;};'use strict';var fs=require('fs');var util=require(_0x5f70('0x0'));var path=require('path');var _=require(_0x5f70('0x1'));var moment=require(_0x5f70('0x2'));var CronJobManager=require(_0x5f70('0x3'));var jayson=require('jayson/promise');var BPromise=require(_0x5f70('0x4'));var logger=require('../logger')('schedule');var db=require(_0x5f70('0x5'))['db'];var analyticCustomReportController=require(_0x5f70('0x6'));var analyticDefaultReportController=require(_0x5f70('0x7'));var client=jayson[_0x5f70('0x8')][_0x5f70('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5e7740,_0x4c337b){return function(){logger[_0x5f70('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x5e7740[_0x5f70('0xb')]);var _0x27bca3=!![];var _0x38c972={'tls':{'rejectUnauthorized':![]}};if(_0x5e7740['MailAccount']['Smtp'][_0x5f70('0xc')]){_0x38c972['service']=_0x5e7740[_0x5f70('0xd')][_0x5f70('0xe')][_0x5f70('0xc')];}else{_0x38c972[_0x5f70('0xf')]=_0x5e7740[_0x5f70('0xd')][_0x5f70('0xe')][_0x5f70('0xf')];_0x38c972['port']=_0x5e7740[_0x5f70('0xd')][_0x5f70('0xe')][_0x5f70('0x10')];_0x38c972[_0x5f70('0x11')]=_0x5e7740['MailAccount'][_0x5f70('0xe')][_0x5f70('0x11')];}if(_0x5e7740[_0x5f70('0xd')][_0x5f70('0xe')][_0x5f70('0x12')]){_0x38c972['auth']={'user':_0x5e7740['MailAccount'][_0x5f70('0xe')]['user'],'pass':_0x5e7740[_0x5f70('0xd')][_0x5f70('0xe')][_0x5f70('0x13')]};}var _0xc2e477={'account':_0x38c972,'message':{'from':util['format'](_0x5f70('0x14'),_0x5e7740[_0x5f70('0xd')][_0x5f70('0x15')],_0x5e7740[_0x5f70('0xd')][_0x5f70('0xb')]||_0x5e7740['MailAccount'][_0x5f70('0xe')][_0x5f70('0x16')]),'to':_0x5e7740[_0x5f70('0xb')],'cc':_0x5e7740['cc'],'bcc':_0x5e7740[_0x5f70('0x17')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x4c337b[_0x5f70('0x15')],_0x5e7740['subtractNumber'],_0x5e7740[_0x5f70('0x18')])}};var _0x343afc=path[_0x5f70('0x19')](__dirname,_0x5f70('0x1a'));var _0x26d8eb=_0x4c337b[_0x5f70('0x1b')];var _0x380688=util[_0x5f70('0x1c')](_0x5f70('0x1d'),path[_0x5f70('0x1e')](_0x4c337b['savename'],path[_0x5f70('0x1f')](_0x4c337b[_0x5f70('0x1b')])),_0x5f70('0x20'));var _0x57f294=path[_0x5f70('0x19')](_0x343afc,_0x26d8eb);var _0x4cfda8=path[_0x5f70('0x19')](_0x343afc,_0x380688);if(fs[_0x5f70('0x21')](_0x57f294)){_0x4c337b[_0x5f70('0x22')]=_0x5f70('0x23');_0xc2e477[_0x5f70('0x24')]['attachments']=[{'filename':_0x26d8eb,'path':_0x57f294}];_0xc2e477[_0x5f70('0x24')][_0x5f70('0x25')]=util[_0x5f70('0x1c')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x5f70('0x26')](_0x4c337b,null,0x2));}else if(fs[_0x5f70('0x21')](_0x4cfda8)){_0x4c337b[_0x5f70('0x22')]=_0x5f70('0x23');_0xc2e477[_0x5f70('0x24')]['attachments']=[{'filename':_0x380688,'path':_0x4cfda8}];}else{_0xc2e477[_0x5f70('0x24')][_0x5f70('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x5e7740['sendIfEmpty']){_0x27bca3=![];logger['info']('empty\x20file,\x20email\x20not\x20sent');}}if(_0x27bca3){return client[_0x5f70('0x27')](_0x5f70('0x28'),_0xc2e477)[_0x5f70('0x29')](function(_0x637c1c){if(_0x637c1c[_0x5f70('0x2a')]){return logger['error']('error\x20mail',JSON[_0x5f70('0x26')](_0x637c1c));}return logger[_0x5f70('0xa')](_0x5f70('0x2b'));})[_0x5f70('0x2c')](function(_0x59d708){return logger[_0x5f70('0x2a')](_0x5f70('0x2d'),JSON[_0x5f70('0x26')](_0x59d708));});}};}function handleError(){return function(_0x5b12c6){return logger[_0x5f70('0x2a')](JSON[_0x5f70('0x26')](_0x5b12c6));};}function handleResult(_0x16ed18){return function(_0x12adf0){logger[_0x5f70('0xa')](_0x5f70('0x2e'),JSON[_0x5f70('0x26')](_0x12adf0));if(_0x16ed18[_0x5f70('0xd')]&&_0x16ed18['MailAccount'][_0x5f70('0xe')]&&!_[_0x5f70('0x2f')](_0x16ed18[_0x5f70('0xb')])){setTimeout(handleSendEmail(_0x16ed18,_0x12adf0),0x3c*0x3e8);}};}function handleJob(_0x41bdef){return function(){try{if(_[_0x5f70('0x2f')](_0x41bdef[_0x5f70('0x30')])){return logger[_0x5f70('0xa')](_0x5f70('0x31'));}if(_[_0x5f70('0x2f')](_0x41bdef[_0x5f70('0x18')])){return logger['info']('subtractUnit\x20null\x20or\x20undefined');}var _0x1206cb={'startDate':moment()[_0x5f70('0x32')](_0x41bdef['subtractNumber'],_0x41bdef[_0x5f70('0x18')])['format'](_0x5f70('0x33')),'endDate':moment()[_0x5f70('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x5f70('0x34'),'output':_0x41bdef[_0x5f70('0x35')],'name':_0x41bdef[_0x5f70('0x15')]};if(!_['isNil'](_0x41bdef['DefaultReportId'])){logger['info'](_0x5f70('0x36'),_0x41bdef[_0x5f70('0x37')]);return analyticDefaultReportController[_0x5f70('0x38')]({'id':_0x41bdef[_0x5f70('0x37')]},_0x1206cb)['then'](handleResult(_0x41bdef))[_0x5f70('0x2c')](handleError());}if(!_[_0x5f70('0x2f')](_0x41bdef[_0x5f70('0x39')])){logger[_0x5f70('0xa')](_0x5f70('0x3a'),_0x41bdef['CustomReportId']);return analyticCustomReportController['runReport']({'id':_0x41bdef[_0x5f70('0x39')]},_0x1206cb)[_0x5f70('0x29')](handleResult(_0x41bdef))[_0x5f70('0x2c')](handleError());}}catch(_0x3328f3){logger[_0x5f70('0x2a')](JSON['stringify'](_0x3328f3));}return logger[_0x5f70('0xa')](_0x5f70('0x3b'));};}function getJobs(_0xf87286){var _0x28ee1d={};if(_0xf87286){_0x28ee1d['id']=_0xf87286;}return db[_0x5f70('0x3c')]['findAll']({'where':_0x28ee1d,'include':[{'model':db[_0x5f70('0xd')],'attributes':['id',_0x5f70('0x15'),_0x5f70('0xb')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x5f70('0x29')](function(_0x2a9fd3){var _0x54170a=_[_0x5f70('0x3d')](manager[_0x5f70('0x3e')]);var _0x4d29b1=_['map'](_0x2a9fd3,function(_0x5074b7){return _0x5074b7['id'][_0x5f70('0x3f')]();});var _0x1f31e9=_[_0x5f70('0x40')](_0x2a9fd3,function(_0x1ec4de){return _0x1ec4de['id'][_0x5f70('0x3f')]();});var _0x4e6db2=_0xf87286?_0x4d29b1:_[_0x5f70('0x41')](_0x4d29b1,_0x54170a);var _0xc3f71b=_[_0x5f70('0x42')](_0x4d29b1,_0x54170a);var _0x55d95f=_[_0x5f70('0x41')](_0x54170a,_0x4d29b1);var _0x3c65ef;var _0x5e9eba;for(_0x3c65ef=0x0;_0x3c65ef<_0x55d95f[_0x5f70('0x43')]&&!_0xf87286;_0x3c65ef+=0x1){_0x5e9eba=_0x55d95f[_0x3c65ef]['toString']();if(manager[_0x5f70('0x44')](_0x5e9eba)){manager[_0x5f70('0x45')](_0x5e9eba);manager[_0x5f70('0x46')](_0x5e9eba);logger[_0x5f70('0xa')](_0x5f70('0x47'),_0x5e9eba);}}logger['info'](_0x5f70('0x48'),JSON[_0x5f70('0x26')](_0x4e6db2));for(_0x3c65ef=0x0;_0x3c65ef<_0x4e6db2[_0x5f70('0x43')];_0x3c65ef+=0x1){_0x5e9eba=_0x4e6db2[_0x3c65ef]['toString']();logger[_0x5f70('0xa')](_0x5f70('0x49'),_0x5e9eba);if(_0xf87286){logger[_0x5f70('0xa')]('my\x20id',_0xf87286);logger[_0x5f70('0xa')](JSON[_0x5f70('0x26')](_0x1f31e9[_0x5e9eba]));BPromise[_0x5f70('0x4a')]()[_0x5f70('0x29')](handleJob(_0x1f31e9[_0x5e9eba]));logger[_0x5f70('0xa')](_0x5f70('0x4b'),_0x1f31e9[_0x5e9eba][_0x5f70('0x15')],_0x1f31e9[_0x5e9eba]['cron']);}else if(_0x1f31e9[_0x5e9eba][_0x5f70('0x4c')]&&_0x1f31e9[_0x5e9eba][_0x5f70('0x4d')]&&moment()[_0x5f70('0x4e')](_0x1f31e9[_0x5e9eba][_0x5f70('0x4f')],_0x1f31e9[_0x5e9eba][_0x5f70('0x50')])){manager[_0x5f70('0x51')](_0x5e9eba,_0x1f31e9[_0x5e9eba]['cron'],handleJob(_0x1f31e9[_0x5e9eba]));manager[_0x5f70('0x52')](_0x5e9eba);logger[_0x5f70('0xa')]('add\x20cron',_0x1f31e9[_0x5e9eba][_0x5f70('0x15')],_0x1f31e9[_0x5e9eba]['cron']);}else if(manager['exists'](_0x5e9eba)){manager['stop'](_0x5e9eba);manager[_0x5f70('0x46')](_0x5e9eba);logger[_0x5f70('0xa')](_0x5f70('0x53'),_0x1f31e9[_0x5e9eba][_0x5f70('0x15')],_0x1f31e9[_0x5e9eba]['cron']);}}for(_0x3c65ef=0x0,_0x5e9eba;_0x3c65ef<_0xc3f71b['length']&&!_0xf87286;_0x3c65ef+=0x1){_0x5e9eba=_0xc3f71b[_0x3c65ef][_0x5f70('0x3f')]();if(manager[_0x5f70('0x44')](_0x5e9eba)){if(_0x1f31e9[_0x5e9eba]['cron']&&_0x1f31e9[_0x5e9eba][_0x5f70('0x4d')]&&moment()[_0x5f70('0x4e')](_0x1f31e9[_0x5e9eba][_0x5f70('0x4f')],_0x1f31e9[_0x5e9eba][_0x5f70('0x50')])){manager[_0x5f70('0x54')](_0x5e9eba,_0x1f31e9[_0x5e9eba][_0x5f70('0x4c')],handleJob(_0x1f31e9[_0x5e9eba]));logger[_0x5f70('0xa')](_0x5f70('0x55'),_0x1f31e9[_0x5e9eba]['name'],_0x1f31e9[_0x5e9eba][_0x5f70('0x4c')]);}else{manager[_0x5f70('0x45')](_0x5e9eba);manager[_0x5f70('0x46')](_0x5e9eba);logger[_0x5f70('0xa')]('stop\x20cron',_0x1f31e9[_0x5e9eba][_0x5f70('0x15')],_0x1f31e9[_0x5e9eba][_0x5f70('0x4c')]);}}}})[_0x5f70('0x2c')](function(_0x493b58){logger[_0x5f70('0x2a')](JSON['stringify'](_0x493b58));});}exports['run']=function(_0x7d0e0d){return getJobs(_0x7d0e0d);};exports[_0x5f70('0x52')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x2bea=['%s.%s','basename','extname','zip','join','existsSync','status','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','stringify','attachments','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','error','error\x20mail','info','email\x20sent','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','no\x20report\x20id','Schedule','findAll','MailServerOut','keys','jobs','map','toString','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','active','update','update\x20cron','run','util','path','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','client','http','email','Smtp','service','host','MailAccount','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','savename'];(function(_0x3e5595,_0xbe4275){var _0x3fd3a6=function(_0x43874c){while(--_0x43874c){_0x3e5595['push'](_0x3e5595['shift']());}};_0x3fd3a6(++_0xbe4275);}(_0x2bea,0x1cc));var _0xa2be=function(_0x482bb2,_0x3f3405){_0x482bb2=_0x482bb2-0x0;var _0x4dc2b2=_0x2bea[_0x482bb2];return _0x4dc2b2;};'use strict';var fs=require('fs');var util=require(_0xa2be('0x0'));var path=require(_0xa2be('0x1'));var _=require('lodash');var moment=require(_0xa2be('0x2'));var CronJobManager=require(_0xa2be('0x3'));var jayson=require(_0xa2be('0x4'));var BPromise=require(_0xa2be('0x5'));var logger=require(_0xa2be('0x6'))(_0xa2be('0x7'));var db=require(_0xa2be('0x8'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0xa2be('0x9')][_0xa2be('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0xeb9629,_0x20c10d){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0xeb9629[_0xa2be('0xb')]);var _0x216d80=!![];var _0x2bcaf4={'tls':{'rejectUnauthorized':![]}};if(_0xeb9629['MailAccount'][_0xa2be('0xc')][_0xa2be('0xd')]){_0x2bcaf4[_0xa2be('0xd')]=_0xeb9629['MailAccount']['Smtp'][_0xa2be('0xd')];}else{_0x2bcaf4[_0xa2be('0xe')]=_0xeb9629[_0xa2be('0xf')][_0xa2be('0xc')][_0xa2be('0xe')];_0x2bcaf4[_0xa2be('0x10')]=_0xeb9629[_0xa2be('0xf')][_0xa2be('0xc')]['port'];_0x2bcaf4[_0xa2be('0x11')]=_0xeb9629[_0xa2be('0xf')]['Smtp'][_0xa2be('0x11')];}if(_0xeb9629[_0xa2be('0xf')][_0xa2be('0xc')][_0xa2be('0x12')]){_0x2bcaf4[_0xa2be('0x13')]={'user':_0xeb9629[_0xa2be('0xf')][_0xa2be('0xc')][_0xa2be('0x14')],'pass':_0xeb9629['MailAccount']['Smtp'][_0xa2be('0x15')]};}var _0x5afdad={'account':_0x2bcaf4,'message':{'from':util[_0xa2be('0x16')](_0xa2be('0x17'),_0xeb9629[_0xa2be('0xf')][_0xa2be('0x18')],_0xeb9629['MailAccount'][_0xa2be('0xb')]||_0xeb9629[_0xa2be('0xf')][_0xa2be('0xc')][_0xa2be('0x14')]),'to':_0xeb9629[_0xa2be('0xb')],'cc':_0xeb9629['cc'],'bcc':_0xeb9629[_0xa2be('0x19')],'subject':util['format'](_0xa2be('0x1a'),_0x20c10d[_0xa2be('0x18')],_0xeb9629[_0xa2be('0x1b')],_0xeb9629[_0xa2be('0x1c')])}};var _0xb4e80f=path['join'](__dirname,'../../files/reports');var _0x3c47d7=_0x20c10d[_0xa2be('0x1d')];var _0x4b62e5=util[_0xa2be('0x16')](_0xa2be('0x1e'),path[_0xa2be('0x1f')](_0x20c10d[_0xa2be('0x1d')],path[_0xa2be('0x20')](_0x20c10d['savename'])),_0xa2be('0x21'));var _0x218347=path[_0xa2be('0x22')](_0xb4e80f,_0x3c47d7);var _0x1ad1b3=path['join'](_0xb4e80f,_0x4b62e5);if(fs[_0xa2be('0x23')](_0x218347)){_0x20c10d[_0xa2be('0x24')]=_0xa2be('0x25');_0x5afdad[_0xa2be('0x26')]['attachments']=[{'filename':_0x3c47d7,'path':_0x218347}];_0x5afdad[_0xa2be('0x26')][_0xa2be('0x27')]=util['format'](_0xa2be('0x28'),JSON[_0xa2be('0x29')](_0x20c10d,null,0x2));}else if(fs['existsSync'](_0x1ad1b3)){_0x20c10d['status']=_0xa2be('0x25');_0x5afdad['message'][_0xa2be('0x2a')]=[{'filename':_0x4b62e5,'path':_0x1ad1b3}];}else{_0x5afdad['message'][_0xa2be('0x27')]=_0xa2be('0x2b');if(!_0xeb9629[_0xa2be('0x2c')]){_0x216d80=![];logger['info'](_0xa2be('0x2d'));}}if(_0x216d80){return client[_0xa2be('0x2e')](_0xa2be('0x2f'),_0x5afdad)['then'](function(_0x4f770c){if(_0x4f770c[_0xa2be('0x30')]){return logger[_0xa2be('0x30')](_0xa2be('0x31'),JSON['stringify'](_0x4f770c));}return logger[_0xa2be('0x32')](_0xa2be('0x33'));})['catch'](function(_0x462a14){return logger[_0xa2be('0x30')](_0xa2be('0x31'),JSON['stringify'](_0x462a14));});}};}function handleError(){return function(_0x3f66a8){return logger[_0xa2be('0x30')](JSON[_0xa2be('0x29')](_0x3f66a8));};}function handleResult(_0x2c6c01){return function(_0x213eda){logger[_0xa2be('0x32')](_0xa2be('0x34'),JSON['stringify'](_0x213eda));if(_0x2c6c01[_0xa2be('0xf')]&&_0x2c6c01[_0xa2be('0xf')][_0xa2be('0xc')]&&!_[_0xa2be('0x35')](_0x2c6c01[_0xa2be('0xb')])){setTimeout(handleSendEmail(_0x2c6c01,_0x213eda),0x3c*0x3e8);}};}function handleJob(_0x4f1b75){return function(){try{if(_['isNil'](_0x4f1b75['subtractNumber'])){return logger[_0xa2be('0x32')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa2be('0x35')](_0x4f1b75[_0xa2be('0x1c')])){return logger[_0xa2be('0x32')](_0xa2be('0x36'));}var _0x9f9896={'startDate':moment()[_0xa2be('0x37')](_0x4f1b75[_0xa2be('0x1b')],_0x4f1b75[_0xa2be('0x1c')])[_0xa2be('0x16')](_0xa2be('0x38')),'endDate':moment()['format'](_0xa2be('0x38')),'type':_0xa2be('0x39'),'output':_0x4f1b75[_0xa2be('0x3a')],'name':_0x4f1b75[_0xa2be('0x18')]};if(!_[_0xa2be('0x35')](_0x4f1b75[_0xa2be('0x3b')])){logger['info'](_0xa2be('0x3c'),_0x4f1b75['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x4f1b75[_0xa2be('0x3b')]},_0x9f9896)[_0xa2be('0x3d')](handleResult(_0x4f1b75))[_0xa2be('0x3e')](handleError());}if(!_[_0xa2be('0x35')](_0x4f1b75[_0xa2be('0x3f')])){logger[_0xa2be('0x32')](_0xa2be('0x40'),_0x4f1b75['CustomReportId']);return analyticCustomReportController[_0xa2be('0x41')]({'id':_0x4f1b75['CustomReportId']},_0x9f9896)[_0xa2be('0x3d')](handleResult(_0x4f1b75))[_0xa2be('0x3e')](handleError());}}catch(_0x2def1f){logger[_0xa2be('0x30')](JSON[_0xa2be('0x29')](_0x2def1f));}return logger['info'](_0xa2be('0x42'));};}function getJobs(_0x45ab5b){var _0x23c226={};if(_0x45ab5b){_0x23c226['id']=_0x45ab5b;}return db[_0xa2be('0x43')][_0xa2be('0x44')]({'where':_0x23c226,'include':[{'model':db[_0xa2be('0xf')],'attributes':['id','name',_0xa2be('0xb')],'include':[{'model':db[_0xa2be('0x45')],'as':_0xa2be('0xc')}]}]})[_0xa2be('0x3d')](function(_0x37bbb1){var _0x299323=_[_0xa2be('0x46')](manager[_0xa2be('0x47')]);var _0x1c53f3=_[_0xa2be('0x48')](_0x37bbb1,function(_0x1ee1bd){return _0x1ee1bd['id']['toString']();});var _0x1d8137=_['keyBy'](_0x37bbb1,function(_0xba8f3e){return _0xba8f3e['id'][_0xa2be('0x49')]();});var _0x4f2777=_0x45ab5b?_0x1c53f3:_[_0xa2be('0x4a')](_0x1c53f3,_0x299323);var _0x8e3798=_[_0xa2be('0x4b')](_0x1c53f3,_0x299323);var _0x54dcf6=_[_0xa2be('0x4a')](_0x299323,_0x1c53f3);var _0x128219;var _0x22ad64;for(_0x128219=0x0;_0x128219<_0x54dcf6[_0xa2be('0x4c')]&&!_0x45ab5b;_0x128219+=0x1){_0x22ad64=_0x54dcf6[_0x128219][_0xa2be('0x49')]();if(manager[_0xa2be('0x4d')](_0x22ad64)){manager[_0xa2be('0x4e')](_0x22ad64);manager[_0xa2be('0x4f')](_0x22ad64);logger['info'](_0xa2be('0x50'),_0x22ad64);}}logger[_0xa2be('0x32')](_0xa2be('0x51'),JSON[_0xa2be('0x29')](_0x4f2777));for(_0x128219=0x0;_0x128219<_0x4f2777[_0xa2be('0x4c')];_0x128219+=0x1){_0x22ad64=_0x4f2777[_0x128219][_0xa2be('0x49')]();logger[_0xa2be('0x32')](_0xa2be('0x52'),_0x22ad64);if(_0x45ab5b){logger['info'](_0xa2be('0x53'),_0x45ab5b);logger[_0xa2be('0x32')](JSON[_0xa2be('0x29')](_0x1d8137[_0x22ad64]));BPromise[_0xa2be('0x54')]()[_0xa2be('0x3d')](handleJob(_0x1d8137[_0x22ad64]));logger['info'](_0xa2be('0x55'),_0x1d8137[_0x22ad64][_0xa2be('0x18')],_0x1d8137[_0x22ad64][_0xa2be('0x56')]);}else if(_0x1d8137[_0x22ad64][_0xa2be('0x56')]&&_0x1d8137[_0x22ad64]['active']&&moment()[_0xa2be('0x57')](_0x1d8137[_0x22ad64][_0xa2be('0x58')],_0x1d8137[_0x22ad64][_0xa2be('0x59')])){manager[_0xa2be('0x5a')](_0x22ad64,_0x1d8137[_0x22ad64]['cron'],handleJob(_0x1d8137[_0x22ad64]));manager[_0xa2be('0x5b')](_0x22ad64);logger[_0xa2be('0x32')](_0xa2be('0x5c'),_0x1d8137[_0x22ad64]['name'],_0x1d8137[_0x22ad64]['cron']);}else if(manager[_0xa2be('0x4d')](_0x22ad64)){manager['stop'](_0x22ad64);manager[_0xa2be('0x4f')](_0x22ad64);logger['info'](_0xa2be('0x5d'),_0x1d8137[_0x22ad64][_0xa2be('0x18')],_0x1d8137[_0x22ad64][_0xa2be('0x56')]);}}for(_0x128219=0x0,_0x22ad64;_0x128219<_0x8e3798[_0xa2be('0x4c')]&&!_0x45ab5b;_0x128219+=0x1){_0x22ad64=_0x8e3798[_0x128219][_0xa2be('0x49')]();if(manager['exists'](_0x22ad64)){if(_0x1d8137[_0x22ad64][_0xa2be('0x56')]&&_0x1d8137[_0x22ad64][_0xa2be('0x5e')]&&moment()['isBetween'](_0x1d8137[_0x22ad64][_0xa2be('0x58')],_0x1d8137[_0x22ad64][_0xa2be('0x59')])){manager[_0xa2be('0x5f')](_0x22ad64,_0x1d8137[_0x22ad64]['cron'],handleJob(_0x1d8137[_0x22ad64]));logger[_0xa2be('0x32')](_0xa2be('0x60'),_0x1d8137[_0x22ad64][_0xa2be('0x18')],_0x1d8137[_0x22ad64]['cron']);}else{manager[_0xa2be('0x4e')](_0x22ad64);manager[_0xa2be('0x4f')](_0x22ad64);logger[_0xa2be('0x32')](_0xa2be('0x5d'),_0x1d8137[_0x22ad64][_0xa2be('0x18')],_0x1d8137[_0x22ad64][_0xa2be('0x56')]);}}}})[_0xa2be('0x3e')](function(_0x570fad){logger[_0xa2be('0x30')](JSON[_0xa2be('0x29')](_0x570fad));});}exports[_0xa2be('0x61')]=function(_0x47e919){return getJobs(_0x47e919);};exports[_0xa2be('0x5b')]=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 9f538b3..4f7d678 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 _0xbb35=['findOne','Cloud\x20Provider\x20not\x20configured','Sentiment','Mixed','COMPLETED','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','results','transcripts','length','transcript','update','then','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','ValidationError','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Negative','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','tempSentiment','sentiment','bucket','Transcript\x20not\x20available'];(function(_0x7459ef,_0x321c13){var _0x476b3f=function(_0x4dff4b){while(--_0x4dff4b){_0x7459ef['push'](_0x7459ef['shift']());}};_0x476b3f(++_0x321c13);}(_0xbb35,0x1d3));var _0x5bb3=function(_0xfe02fe,_0x583bd3){_0xfe02fe=_0xfe02fe-0x0;var _0x2af69b=_0xbb35[_0xfe02fe];return _0x2af69b;};var _=require('lodash');var AWS=require(_0x5bb3('0x0'));var rp=require(_0x5bb3('0x1'));var util=require(_0x5bb3('0x2'));var BPromise=require(_0x5bb3('0x3'));var db=require(_0x5bb3('0x4'))['db'];var logger=require('../../config/logger')(_0x5bb3('0x5'));function getTranscriptionJob(_0x3d71f2,_0x3f992b,_0x3fc728,_0x1d3554){return new Promise(function(_0x321535,_0x46ef03){var _0xbd7a90=new AWS[(_0x5bb3('0x6'))]({'accessKeyId':_0x3f992b,'secretAccessKey':_0x3d71f2,'region':_0x3fc728});_0xbd7a90['getTranscriptionJob']({'TranscriptionJobName':_0x1d3554},function(_0x14986f,_0x11d7df){if(_0x14986f){return _0x46ef03(_0x14986f);}else{return _0x321535(_0x11d7df);}});});}function sentiment(_0x182c0f,_0x383d1b,_0x534872,_0x399f28,_0x5621a8){return new Promise(function(_0x4035d1,_0x5a8b3b){var _0x12513f=new AWS[(_0x5bb3('0x7'))]({'accessKeyId':_0x383d1b,'secretAccessKey':_0x182c0f,'region':_0x534872});_0x12513f[_0x5bb3('0x8')]({'Text':_0x399f28,'LanguageCode':_0x5621a8[_0x5bb3('0x9')](0x0,0x2)},function(_0xdc37a2,_0x573d78){if(_0xdc37a2){return _0x5a8b3b(_0xdc37a2);}else{return _0x4035d1(_0x573d78);}});});}function checkTranscribeJob(_0x10e5ee,_0xdf7055,_0x159793){var _0x5a1040;return new BPromise(function(_0x693078,_0x2f9eb3){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0xc'),_0x10e5ee['id'],_0x10e5ee[_0x5bb3('0xd')]));return getTranscriptionJob(_0x159793[_0x5bb3('0xe')],_0x159793[_0x5bb3('0xf')],_0xdf7055['transcribeRegion'],_0x10e5ee['transcribeName'])['then'](function(_0x3722f3){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x10'),_0x10e5ee['id'],_0x10e5ee[_0x5bb3('0xd')],_0x3722f3[_0x5bb3('0x11')][_0x5bb3('0x12')]));if(!_0x10e5ee[_0x5bb3('0x13')]){switch(_0x3722f3[_0x5bb3('0x11')][_0x5bb3('0x12')]){case'COMPLETED':var _0x5a541b={'transcribeStatus':_0x3722f3[_0x5bb3('0x11')][_0x5bb3('0x12')],'fileUri':_0x3722f3[_0x5bb3('0x11')][_0x5bb3('0x14')][_0x5bb3('0x15')]};logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')]('[RECORDING:%d]\x20Get\x20transcript',_0x10e5ee['id']));return rp({'uri':_0x3722f3[_0x5bb3('0x11')][_0x5bb3('0x14')][_0x5bb3('0x15')],'json':!![]})['then'](function(_0x30c982){logger['info'](util[_0x5bb3('0xb')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x10e5ee['id']));if(_0x30c982&&_0x30c982[_0x5bb3('0x16')]&&_0x30c982[_0x5bb3('0x16')][_0x5bb3('0x17')]&&_0x30c982[_0x5bb3('0x16')][_0x5bb3('0x17')][_0x5bb3('0x18')]){_0x5a541b[_0x5bb3('0x13')]='';for(var _0x4977df=0x0;_0x4977df<_0x30c982[_0x5bb3('0x16')][_0x5bb3('0x17')]['length'];_0x4977df++){_0x5a541b[_0x5bb3('0x13')]+=_0x30c982[_0x5bb3('0x16')][_0x5bb3('0x17')][_0x4977df][_0x5bb3('0x19')]+'';}}return _0x10e5ee[_0x5bb3('0x1a')](_0x5a541b);})[_0x5bb3('0x1b')](function(){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x10e5ee['id']));if(!_0x10e5ee['tempSentiment']){throw new db[(_0x5bb3('0x1c'))]['ValidationError'](_0x5bb3('0x1d'));}if(!_0xdf7055['sentiment']||!_0xdf7055[_0x5bb3('0x1e')]||!_0xdf7055[_0x5bb3('0x1f')]||!_0xdf7055[_0x5bb3('0x20')]||!_0xdf7055['bucket']){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))](_0x5bb3('0x22'));}if(!_0x5a541b[_0x5bb3('0x13')]){throw new Error('Transcript\x20not\x20available');}if(_0xdf7055['sentimentAccountId']===_0x159793['id']){return _0x159793;}else{return db[_0x5bb3('0x23')]['findOne']({'where':{'id':_settings[_0x5bb3('0x1e')]}});}})[_0x5bb3('0x1b')](function(_0x5217ca){if(!_0x5217ca){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))](_0x5bb3('0x24'));}if(!_0x5217ca[_0x5bb3('0xe')]||!_0x5217ca[_0x5bb3('0xf')]){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x5a1040=_0x5217ca;logger[_0x5bb3('0xa')](util['format'](_0x5bb3('0x25'),_0x10e5ee['id']));return sentiment(_0x5a1040[_0x5bb3('0xe')],_0x5a1040[_0x5bb3('0xf')],_0xdf7055[_0x5bb3('0x1f')],_0x5a541b['fileText'],_0xdf7055['language']);})[_0x5bb3('0x1b')](function(_0x5ba9ab){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x26'),_0x10e5ee['id']));return _0x10e5ee[_0x5bb3('0x1a')]({'sentiment':_0x5ba9ab['Sentiment'],'sPositive':_0x5ba9ab[_0x5bb3('0x27')][_0x5bb3('0x28')],'sNegative':_0x5ba9ab[_0x5bb3('0x27')][_0x5bb3('0x29')],'sMixed':_0x5ba9ab[_0x5bb3('0x27')]['Mixed'],'sNeutral':_0x5ba9ab[_0x5bb3('0x27')][_0x5bb3('0x2a')]});})[_0x5bb3('0x1b')](function(){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x2b'),_0x10e5ee['id']));_0x693078();});case _0x5bb3('0x2c'):return _0x10e5ee[_0x5bb3('0x1a')]({'transcribeStatus':_0x5bb3('0x2c'),'failureReason':_0x3722f3[_0x5bb3('0x11')]['FailureReason']})[_0x5bb3('0x1b')](function(){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x2b'),_0x10e5ee['id']));_0x693078();});default:logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x2d'),_0x10e5ee['id']));break;}}else{return BPromise[_0x5bb3('0x2e')]()[_0x5bb3('0x1b')](function(){if(!_0x10e5ee[_0x5bb3('0x2f')]){throw new db[(_0x5bb3('0x1c'))]['ValidationError'](_0x5bb3('0x1d'));}if(!_0xdf7055[_0x5bb3('0x30')]||!_0xdf7055['sentimentAccountId']||!_0xdf7055[_0x5bb3('0x1f')]||!_0xdf7055[_0x5bb3('0x20')]||!_0xdf7055[_0x5bb3('0x31')]){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x10e5ee[_0x5bb3('0x13')]){throw new Error(_0x5bb3('0x32'));}if(_0xdf7055[_0x5bb3('0x1e')]===_0x159793['id']){return _0x159793;}else{return db[_0x5bb3('0x23')][_0x5bb3('0x33')]({'where':{'id':_settings[_0x5bb3('0x1e')]}});}})['then'](function(_0x6d6c39){if(!_0x6d6c39){throw new db['Sequelize'][(_0x5bb3('0x21'))](_0x5bb3('0x24'));}if(!_0x6d6c39['data1']||!_0x6d6c39[_0x5bb3('0xf')]){throw new db['Sequelize'][(_0x5bb3('0x21'))](_0x5bb3('0x34'));}_0x5a1040=_0x6d6c39;logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x25'),_0x10e5ee['id']));return sentiment(_0x5a1040[_0x5bb3('0xe')],_0x5a1040['data2'],_0xdf7055[_0x5bb3('0x1f')],_0x10e5ee[_0x5bb3('0x13')],_0xdf7055[_0x5bb3('0x20')]);})[_0x5bb3('0x1b')](function(_0x47cad3){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x26'),_0x10e5ee['id']));return _0x10e5ee[_0x5bb3('0x1a')]({'sentiment':_0x47cad3[_0x5bb3('0x35')],'sPositive':_0x47cad3[_0x5bb3('0x27')][_0x5bb3('0x28')],'sNegative':_0x47cad3[_0x5bb3('0x27')][_0x5bb3('0x29')],'sMixed':_0x47cad3['SentimentScore'][_0x5bb3('0x36')],'sNeutral':_0x47cad3[_0x5bb3('0x27')][_0x5bb3('0x2a')],'transcribeStatus':_0x5bb3('0x37')});})[_0x5bb3('0x1b')](function(){logger[_0x5bb3('0xa')](util[_0x5bb3('0xb')](_0x5bb3('0x2b'),_0x10e5ee['id']));_0x693078();});}})[_0x5bb3('0x38')](function(_0x165e72){if(_0x165e72){if(!_0x165e72[_0x5bb3('0x39')]||_0x165e72[_0x5bb3('0x39')]!==_0x5bb3('0x3a')){logger[_0x5bb3('0x3b')](util[_0x5bb3('0xb')](_0x5bb3('0x3c'),_0x10e5ee['id']),util[_0x5bb3('0x3d')](_0x165e72,{'showHidden':![],'depth':null}));}}_0x693078();});});}function checkTranscribe(){var _0x398219;var _0x133f4c;var _0x3ad935;return db[_0x5bb3('0x3e')][_0x5bb3('0x3f')]({'where':{'transcribeStatus':_0x5bb3('0x40')}})[_0x5bb3('0x1b')](function(_0x22c773){if(!_0x22c773||!_0x22c773[_0x5bb3('0x18')]){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))](_0x5bb3('0x41'));}_0x398219=_0x22c773;return db[_0x5bb3('0x42')][_0x5bb3('0x33')]({'where':{'id':0x1}});})['then'](function(_0x114c35){if(!_0x114c35){throw new db[(_0x5bb3('0x1c'))]['ValidationError'](_0x5bb3('0x43'));}_0x133f4c=_0x114c35;if(!_0x133f4c[_0x5bb3('0x5')]||!_0x133f4c[_0x5bb3('0x44')]||!_0x133f4c['transcribeRegion']||!_0x133f4c[_0x5bb3('0x20')]||!_0x133f4c[_0x5bb3('0x31')]){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))](_0x5bb3('0x45'));}return db[_0x5bb3('0x23')]['findOne']({'where':{'id':_0x133f4c[_0x5bb3('0x44')]}});})['then'](function(_0xffa73e){if(!_0xffa73e){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))](_0x5bb3('0x24'));}if(!_0xffa73e['data1']||!_0xffa73e['data2']){throw new db[(_0x5bb3('0x1c'))][(_0x5bb3('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x3ad935=_0xffa73e;var _0x5d6bf0=[];_0x398219[_0x5bb3('0x46')](function(_0x937d9f){_0x5d6bf0[_0x5bb3('0x47')](checkTranscribeJob(_0x937d9f,_0x133f4c,_0x3ad935));});return BPromise[_0x5bb3('0x48')](_0x5d6bf0);})['catch'](function(_0x2122d1){if(_0x2122d1){if(!_0x2122d1[_0x5bb3('0x39')]||_0x2122d1[_0x5bb3('0x39')]!==_0x5bb3('0x3a')){logger['error'](util[_0x5bb3('0x3d')](_0x2122d1,{'showHidden':![],'depth':null}));}}});}exports[_0x5bb3('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x5242=['update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','Mixed','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','all','catch','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','TranscriptionJob','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','transcript'];(function(_0x43b2d3,_0x370f3d){var _0x2ad657=function(_0x2bcd6e){while(--_0x2bcd6e){_0x43b2d3['push'](_0x43b2d3['shift']());}};_0x2ad657(++_0x370f3d);}(_0x5242,0x148));var _0x2524=function(_0xa2c1c4,_0x1be1e7){_0xa2c1c4=_0xa2c1c4-0x0;var _0x24154b=_0x5242[_0xa2c1c4];return _0x24154b;};var _=require(_0x2524('0x0'));var AWS=require(_0x2524('0x1'));var rp=require(_0x2524('0x2'));var util=require(_0x2524('0x3'));var BPromise=require(_0x2524('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x2524('0x5'))(_0x2524('0x6'));function getTranscriptionJob(_0x1fe425,_0x281204,_0x26cfec,_0x109874){return new Promise(function(_0x9140b3,_0x5e0f80){var _0x2b070c=new AWS[(_0x2524('0x7'))]({'accessKeyId':_0x281204,'secretAccessKey':_0x1fe425,'region':_0x26cfec});_0x2b070c[_0x2524('0x8')]({'TranscriptionJobName':_0x109874},function(_0x9f927c,_0x5729dd){if(_0x9f927c){return _0x5e0f80(_0x9f927c);}else{return _0x9140b3(_0x5729dd);}});});}function sentiment(_0x491085,_0x27992c,_0x2ecd8f,_0x40f826,_0x52e6e0){return new Promise(function(_0x11c213,_0x2a1599){var _0x3a8a54=new AWS[(_0x2524('0x9'))]({'accessKeyId':_0x27992c,'secretAccessKey':_0x491085,'region':_0x2ecd8f});_0x3a8a54[_0x2524('0xa')]({'Text':_0x40f826,'LanguageCode':_0x52e6e0[_0x2524('0xb')](0x0,0x2)},function(_0x23b47c,_0x5edc88){if(_0x23b47c){return _0x2a1599(_0x23b47c);}else{return _0x11c213(_0x5edc88);}});});}function checkTranscribeJob(_0x507eae,_0x44d626,_0x3ab81e){var _0x3b3d6d;return new BPromise(function(_0xa0dadd,_0x389484){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0xe'),_0x507eae['id'],_0x507eae[_0x2524('0xf')]));return getTranscriptionJob(_0x3ab81e[_0x2524('0x10')],_0x3ab81e[_0x2524('0x11')],_0x44d626[_0x2524('0x12')],_0x507eae[_0x2524('0xf')])[_0x2524('0x13')](function(_0x4dc476){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x14'),_0x507eae['id'],_0x507eae[_0x2524('0xf')],_0x4dc476['TranscriptionJob'][_0x2524('0x15')]));if(!_0x507eae[_0x2524('0x16')]){switch(_0x4dc476[_0x2524('0x17')][_0x2524('0x15')]){case _0x2524('0x18'):var _0x319cbb={'transcribeStatus':_0x4dc476[_0x2524('0x17')][_0x2524('0x15')],'fileUri':_0x4dc476[_0x2524('0x17')]['Transcript'][_0x2524('0x19')]};logger['info'](util[_0x2524('0xd')](_0x2524('0x1a'),_0x507eae['id']));return rp({'uri':_0x4dc476[_0x2524('0x17')][_0x2524('0x1b')]['TranscriptFileUri'],'json':!![]})['then'](function(_0x29528f){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x1c'),_0x507eae['id']));if(_0x29528f&&_0x29528f['results']&&_0x29528f['results'][_0x2524('0x1d')]&&_0x29528f[_0x2524('0x1e')]['transcripts']['length']){_0x319cbb[_0x2524('0x16')]='';for(var _0x9026d7=0x0;_0x9026d7<_0x29528f[_0x2524('0x1e')]['transcripts']['length'];_0x9026d7++){_0x319cbb[_0x2524('0x16')]+=_0x29528f[_0x2524('0x1e')]['transcripts'][_0x9026d7][_0x2524('0x1f')]+'';}}return _0x507eae[_0x2524('0x20')](_0x319cbb);})['then'](function(){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x21'),_0x507eae['id']));if(!_0x507eae[_0x2524('0x22')]){throw new db[(_0x2524('0x23'))][(_0x2524('0x24'))](_0x2524('0x25'));}if(!_0x44d626[_0x2524('0x26')]||!_0x44d626[_0x2524('0x27')]||!_0x44d626[_0x2524('0x28')]||!_0x44d626[_0x2524('0x29')]||!_0x44d626[_0x2524('0x2a')]){throw new db[(_0x2524('0x23'))][(_0x2524('0x24'))](_0x2524('0x2b'));}if(!_0x319cbb[_0x2524('0x16')]){throw new Error(_0x2524('0x2c'));}if(_0x44d626[_0x2524('0x27')]===_0x3ab81e['id']){return _0x3ab81e;}else{return db['CloudProvider'][_0x2524('0x2d')]({'where':{'id':_settings[_0x2524('0x27')]}});}})[_0x2524('0x13')](function(_0x4729ae){if(!_0x4729ae){throw new db['Sequelize'][(_0x2524('0x24'))](_0x2524('0x2e'));}if(!_0x4729ae[_0x2524('0x10')]||!_0x4729ae['data2']){throw new db['Sequelize'][(_0x2524('0x24'))](_0x2524('0x2f'));}_0x3b3d6d=_0x4729ae;logger['info'](util[_0x2524('0xd')](_0x2524('0x30'),_0x507eae['id']));return sentiment(_0x3b3d6d['data1'],_0x3b3d6d['data2'],_0x44d626[_0x2524('0x28')],_0x319cbb[_0x2524('0x16')],_0x44d626[_0x2524('0x29')]);})[_0x2524('0x13')](function(_0x53281d){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x31'),_0x507eae['id']));return _0x507eae[_0x2524('0x20')]({'sentiment':_0x53281d[_0x2524('0x32')],'sPositive':_0x53281d[_0x2524('0x33')][_0x2524('0x34')],'sNegative':_0x53281d[_0x2524('0x33')][_0x2524('0x35')],'sMixed':_0x53281d['SentimentScore']['Mixed'],'sNeutral':_0x53281d[_0x2524('0x33')][_0x2524('0x36')]});})[_0x2524('0x13')](function(){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x21'),_0x507eae['id']));_0xa0dadd();});case _0x2524('0x37'):return _0x507eae[_0x2524('0x20')]({'transcribeStatus':_0x2524('0x37'),'failureReason':_0x4dc476[_0x2524('0x17')]['FailureReason']})[_0x2524('0x13')](function(){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x21'),_0x507eae['id']));_0xa0dadd();});default:logger[_0x2524('0xc')](util['format'](_0x2524('0x38'),_0x507eae['id']));break;}}else{return BPromise[_0x2524('0x39')]()[_0x2524('0x13')](function(){if(!_0x507eae[_0x2524('0x22')]){throw new db[(_0x2524('0x23'))]['ValidationError'](_0x2524('0x25'));}if(!_0x44d626[_0x2524('0x26')]||!_0x44d626[_0x2524('0x27')]||!_0x44d626[_0x2524('0x28')]||!_0x44d626[_0x2524('0x29')]||!_0x44d626[_0x2524('0x2a')]){throw new db[(_0x2524('0x23'))][(_0x2524('0x24'))](_0x2524('0x2b'));}if(!_0x507eae['fileText']){throw new Error(_0x2524('0x2c'));}if(_0x44d626[_0x2524('0x27')]===_0x3ab81e['id']){return _0x3ab81e;}else{return db[_0x2524('0x3a')][_0x2524('0x2d')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x2524('0x13')](function(_0x10deb5){if(!_0x10deb5){throw new db[(_0x2524('0x23'))][(_0x2524('0x24'))](_0x2524('0x2e'));}if(!_0x10deb5[_0x2524('0x10')]||!_0x10deb5[_0x2524('0x11')]){throw new db[(_0x2524('0x23'))]['ValidationError'](_0x2524('0x2f'));}_0x3b3d6d=_0x10deb5;logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x30'),_0x507eae['id']));return sentiment(_0x3b3d6d[_0x2524('0x10')],_0x3b3d6d[_0x2524('0x11')],_0x44d626[_0x2524('0x28')],_0x507eae['fileText'],_0x44d626[_0x2524('0x29')]);})[_0x2524('0x13')](function(_0x11adbf){logger['info'](util[_0x2524('0xd')](_0x2524('0x31'),_0x507eae['id']));return _0x507eae[_0x2524('0x20')]({'sentiment':_0x11adbf[_0x2524('0x32')],'sPositive':_0x11adbf['SentimentScore'][_0x2524('0x34')],'sNegative':_0x11adbf[_0x2524('0x33')][_0x2524('0x35')],'sMixed':_0x11adbf[_0x2524('0x33')][_0x2524('0x3b')],'sNeutral':_0x11adbf[_0x2524('0x33')][_0x2524('0x36')],'transcribeStatus':_0x2524('0x18')});})[_0x2524('0x13')](function(){logger[_0x2524('0xc')](util[_0x2524('0xd')](_0x2524('0x21'),_0x507eae['id']));_0xa0dadd();});}})['catch'](function(_0x27bdbe){if(_0x27bdbe){if(!_0x27bdbe[_0x2524('0x3c')]||_0x27bdbe[_0x2524('0x3c')]!==_0x2524('0x3d')){logger[_0x2524('0x3e')](util[_0x2524('0xd')](_0x2524('0x3f'),_0x507eae['id']),util[_0x2524('0x40')](_0x27bdbe,{'showHidden':![],'depth':null}));}}_0xa0dadd();});});}function checkTranscribe(){var _0x1adf6c;var _0x2401fe;var _0x582a13;return db['VoiceRecording'][_0x2524('0x41')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x149999){if(!_0x149999||!_0x149999['length']){throw new db[(_0x2524('0x23'))][(_0x2524('0x24'))]('No\x20transcribe\x20job\x20to\x20check');}_0x1adf6c=_0x149999;return db[_0x2524('0x42')][_0x2524('0x2d')]({'where':{'id':0x1}});})['then'](function(_0x2a7939){if(!_0x2a7939){throw new db[(_0x2524('0x23'))][(_0x2524('0x24'))](_0x2524('0x43'));}_0x2401fe=_0x2a7939;if(!_0x2401fe[_0x2524('0x6')]||!_0x2401fe['transcribeAccountId']||!_0x2401fe[_0x2524('0x12')]||!_0x2401fe[_0x2524('0x29')]||!_0x2401fe[_0x2524('0x2a')]){throw new db[(_0x2524('0x23'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x2524('0x2d')]({'where':{'id':_0x2401fe[_0x2524('0x44')]}});})['then'](function(_0x32ceaf){if(!_0x32ceaf){throw new db[(_0x2524('0x23'))][(_0x2524('0x24'))](_0x2524('0x2e'));}if(!_0x32ceaf[_0x2524('0x10')]||!_0x32ceaf[_0x2524('0x11')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x582a13=_0x32ceaf;var _0x332b33=[];_0x1adf6c[_0x2524('0x45')](function(_0x4869a0){_0x332b33['push'](checkTranscribeJob(_0x4869a0,_0x2401fe,_0x582a13));});return BPromise[_0x2524('0x46')](_0x332b33);})[_0x2524('0x47')](function(_0x2e728f){if(_0x2e728f){if(!_0x2e728f['name']||_0x2e728f[_0x2524('0x3c')]!=='SequelizeValidationError'){logger[_0x2524('0x3e')](util[_0x2524('0x40')](_0x2e728f,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 5717681..8f097e4 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 _0x8028=['subtract','then','length','map','info','join','update','system','YYYY-MM-DD\x20HH:mm:ss','error','inspect','start','moment','util','../../mysqldb','../logger'];(function(_0x28b6f3,_0x1b0567){var _0x18976e=function(_0x54e0a3){while(--_0x54e0a3){_0x28b6f3['push'](_0x28b6f3['shift']());}};_0x18976e(++_0x1b0567);}(_0x8028,0xcc));var _0x8802=function(_0x260fee,_0x5e4266){_0x260fee=_0x260fee-0x0;var _0x5b1ff2=_0x8028[_0x260fee];return _0x5b1ff2;};'use strict';var _=require('lodash');var moment=require(_0x8802('0x0'));var Redis=require('ioredis');var util=require(_0x8802('0x1'));var config=require('../../config/environment');var db=require(_0x8802('0x2'))['db'];var logger=require(_0x8802('0x3'))('schedule');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x4d1f36=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8802('0x4')](0x18,'hours')}}})[_0x8802('0x5')](function(_0x17cc41){if(_0x17cc41&&_0x17cc41[_0x8802('0x6')]){_0x4d1f36=_[_0x8802('0x7')](_0x17cc41||[],'id');logger[_0x8802('0x8')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4d1f36[_0x8802('0x9')]());return db['WhatsappInteraction'][_0x8802('0xa')]({'closeReason':_0x8802('0xb'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x8802('0xc'))},{'where':{'id':_0x4d1f36}});}})[_0x8802('0x5')](function(){if(_0x4d1f36&&_0x4d1f36[_0x8802('0x6')]){logger[_0x8802('0x8')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x4d1f36[_0x8802('0x9')]());for(var _0x22e81a=0x0;_0x22e81a<_0x4d1f36['length'];_0x22e81a++){io['emit']('whatsappInteraction:update',{'id':_0x4d1f36[_0x22e81a],'closed':!![]});}}})['catch'](function(_0x17e72a){logger[_0x8802('0xd')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x17e72a?util[_0x8802('0xe')](_0x17e72a,{'showHidden':![],'depth':null}):'');});}exports[_0x8802('0xf')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa6b0=['update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','inspect','lodash','moment','ioredis','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','redis','findAll','lastMsgAt','subtract','hours','length','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction'];(function(_0x178c9d,_0x1bf7cf){var _0x363cd7=function(_0x23d80e){while(--_0x23d80e){_0x178c9d['push'](_0x178c9d['shift']());}};_0x363cd7(++_0x1bf7cf);}(_0xa6b0,0x1dc));var _0x0a6b=function(_0x146793,_0xe13ac0){_0x146793=_0x146793-0x0;var _0x21e15b=_0xa6b0[_0x146793];return _0x21e15b;};'use strict';var _=require(_0x0a6b('0x0'));var moment=require(_0x0a6b('0x1'));var Redis=require(_0x0a6b('0x2'));var util=require('util');var config=require(_0x0a6b('0x3'));var db=require(_0x0a6b('0x4'))['db'];var logger=require(_0x0a6b('0x5'))(_0x0a6b('0x6'));config['redis']=_[_0x0a6b('0x7')](config['redis'],{'host':_0x0a6b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a6b('0x9')]));function closeInteractions(){var _0x5a28f4=[];return db['WhatsappInteraction'][_0x0a6b('0xa')]({'raw':!![],'attributes':['id',_0x0a6b('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x0a6b('0xc')](0x18,_0x0a6b('0xd'))}}})['then'](function(_0x64e156){if(_0x64e156&&_0x64e156[_0x0a6b('0xe')]){_0x5a28f4=_['map'](_0x64e156||[],'id');logger['info'](_0x0a6b('0xf'),_0x5a28f4['join']());return db[_0x0a6b('0x10')][_0x0a6b('0x11')]({'closeReason':_0x0a6b('0x12'),'disposition':_0x0a6b('0x13'),'closed':!![],'closedAt':moment()[_0x0a6b('0x14')](_0x0a6b('0x15'))},{'where':{'id':_0x5a28f4}});}})[_0x0a6b('0x16')](function(){if(_0x5a28f4&&_0x5a28f4[_0x0a6b('0xe')]){logger[_0x0a6b('0x17')](_0x0a6b('0x18'),_0x5a28f4['join']());for(var _0x36f6a7=0x0;_0x36f6a7<_0x5a28f4['length'];_0x36f6a7++){io[_0x0a6b('0x19')]('whatsappInteraction:update',{'id':_0x5a28f4[_0x36f6a7],'closed':!![]});}}})[_0x0a6b('0x1a')](function(_0x260a9b){logger[_0x0a6b('0x1b')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x260a9b?util[_0x0a6b('0x1c')](_0x260a9b,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 88eb9c8..fe66395 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a3d=['then','bulkCreate','log','finished\x20populating','CmHopper','destroy','hopper1','contacts2','hopper2','util','../mysqldb','Biondo','innocenzo.biondo','@xcally.com','push','now','Innocenzo','CmContact'];(function(_0x3f3d98,_0x10602d){var _0x8282c6=function(_0x3b8082){while(--_0x3b8082){_0x3f3d98['push'](_0x3f3d98['shift']());}};_0x8282c6(++_0x10602d);}(_0x9a3d,0xf3));var _0xd9a3=function(_0x2afad9,_0x155ae0){_0x2afad9=_0x2afad9-0x0;var _0x3f1e1f=_0x9a3d[_0x2afad9];return _0x3f1e1f;};'use strict';var util=require(_0xd9a3('0x0'));var db=require(_0xd9a3('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xd9a3('0x2')+i,'phone':0xf879fb460+i,'email':_0xd9a3('0x3')+i+_0xd9a3('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd9a3('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xd9a3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd9a3('0x6')](),'updatedAt':Date[_0xd9a3('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':_0xd9a3('0x7')+i,'lastName':_0xd9a3('0x2')+i,'phone':0xf879fb460+i,'email':_0xd9a3('0x3')+i+_0xd9a3('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd9a3('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xd9a3('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd9a3('0x6')](),'updatedAt':Date[_0xd9a3('0x6')]()});}db[_0xd9a3('0x8')]['destroy']({'where':{}})[_0xd9a3('0x9')](function(){return db[_0xd9a3('0x8')][_0xd9a3('0xa')](contacts);})[_0xd9a3('0x9')](function(){console[_0xd9a3('0xb')](_0xd9a3('0xc'),'contacts1');return db[_0xd9a3('0xd')][_0xd9a3('0xe')]({'where':{}});})['then'](function(){return db[_0xd9a3('0xd')][_0xd9a3('0xa')](hopper);})[_0xd9a3('0x9')](function(){console[_0xd9a3('0xb')](_0xd9a3('0xc'),_0xd9a3('0xf'));return db['CmContact'][_0xd9a3('0xa')](contacts2);})[_0xd9a3('0x9')](function(){console[_0xd9a3('0xb')](_0xd9a3('0xc'),_0xd9a3('0x10'));return db['CmHopper'][_0xd9a3('0xa')](hopper2);})['then'](function(){console[_0xd9a3('0xb')](_0xd9a3('0xc'),_0xd9a3('0x11'));})['catch'](function(_0x484d11){console[_0xd9a3('0xb')](_0x484d11);}); \ No newline at end of file +var _0x831f=['CmContact','destroy','finished\x20populating','contacts1','CmHopper','then','log','hopper1','contacts2','bulkCreate','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x831f,0x129));var _0xf831=function(_0x3ff9bc,_0x51778d){_0x3ff9bc=_0x3ff9bc-0x0;var _0x4017d6=_0x831f[_0x3ff9bc];return _0x4017d6;};'use strict';var util=require(_0xf831('0x0'));var db=require(_0xf831('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf831('0x2')]({'id':i,'firstName':_0xf831('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xf831('0x4')+i+_0xf831('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xf831('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf831('0x6')](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0xf831('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf831('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf831('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf831('0x6')](),'updatedAt':Date[_0xf831('0x6')]()});}db[_0xf831('0x7')][_0xf831('0x8')]({'where':{}})['then'](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console['log'](_0xf831('0x9'),_0xf831('0xa'));return db[_0xf831('0xb')]['destroy']({'where':{}});})[_0xf831('0xc')](function(){return db[_0xf831('0xb')]['bulkCreate'](hopper);})['then'](function(){console[_0xf831('0xd')](_0xf831('0x9'),_0xf831('0xe'));return db[_0xf831('0x7')]['bulkCreate'](contacts2);})['then'](function(){console[_0xf831('0xd')](_0xf831('0x9'),_0xf831('0xf'));return db['CmHopper'][_0xf831('0x10')](hopper2);})['then'](function(){console[_0xf831('0xd')](_0xf831('0x9'),_0xf831('0x11'));})[_0xf831('0x12')](function(_0xd732a7){console['log'](_0xd732a7);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index e9b4b17..48cd4ee 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2685=['catch','../mysqldb','push','format','agent','%s%s@xcally.com','password','friend','wss','all','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','%s%s','User','bulkCreate','then','log','add\x20user'];(function(_0xe5a26b,_0x1421ae){var _0x9ea56b=function(_0x4bec39){while(--_0x4bec39){_0xe5a26b['push'](_0xe5a26b['shift']());}};_0x9ea56b(++_0x1421ae);}(_0x2685,0x191));var _0x5268=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x2685[_0x4bfe08];return _0x1f9125;};'use strict';var util=require('util');var db=require(_0x5268('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5268('0x1')]({'name':util[_0x5268('0x2')]('%s%s',_0x5268('0x3'),i),'fullname':util['format']('%s%s',_0x5268('0x3'),i),'email':util['format'](_0x5268('0x4'),_0x5268('0x3'),i),'role':_0x5268('0x3'),'password':_0x5268('0x5'),'internal':0xfa0+i,'type':_0x5268('0x6'),'transport':['udp','ws',_0x5268('0x7')],'disallow':[_0x5268('0x8')],'allow':['ulaw'],'defaultuser':util[_0x5268('0x2')]('%s%s',_0x5268('0x3'),i),'encryption':_0x5268('0x9'),'avpf':'yes','force_avp':_0x5268('0x9'),'icesupport':_0x5268('0x9'),'dtlsenable':_0x5268('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x5268('0xa'),'dtlssetup':_0x5268('0xb'),'callerid':util[_0x5268('0x2')](_0x5268('0xc'),util[_0x5268('0x2')](_0x5268('0xd'),_0x5268('0x3'),i),0xfa0+i)});}db[_0x5268('0xe')][_0x5268('0xf')](users)[_0x5268('0x10')](function(){console[_0x5268('0x11')](_0x5268('0x12'));})[_0x5268('0x13')](function(_0x12543d){console[_0x5268('0x11')](_0x12543d);}); \ No newline at end of file +var _0x02b2=['format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util'];(function(_0x1355c6,_0x584851){var _0x50fe6c=function(_0x24d00a){while(--_0x24d00a){_0x1355c6['push'](_0x1355c6['shift']());}};_0x50fe6c(++_0x584851);}(_0x02b2,0x9f));var _0x202b=function(_0x1ccfc2,_0xab3180){_0x1ccfc2=_0x1ccfc2-0x0;var _0x3cc5c6=_0x02b2[_0x1ccfc2];return _0x3cc5c6;};'use strict';var util=require(_0x202b('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0x202b('0x1')](_0x202b('0x2'),_0x202b('0x3'),i),'fullname':util[_0x202b('0x1')](_0x202b('0x2'),_0x202b('0x3'),i),'email':util[_0x202b('0x1')](_0x202b('0x4'),_0x202b('0x3'),i),'role':_0x202b('0x3'),'password':_0x202b('0x5'),'internal':0xfa0+i,'type':_0x202b('0x6'),'transport':[_0x202b('0x7'),'ws',_0x202b('0x8')],'disallow':[_0x202b('0x9')],'allow':[_0x202b('0xa')],'defaultuser':util['format'](_0x202b('0x2'),_0x202b('0x3'),i),'encryption':_0x202b('0xb'),'avpf':_0x202b('0xb'),'force_avp':_0x202b('0xb'),'icesupport':_0x202b('0xb'),'dtlsenable':_0x202b('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x202b('0xc'),'dtlssetup':'actpass','callerid':util[_0x202b('0x1')](_0x202b('0xd'),util['format'](_0x202b('0x2'),'agent',i),0xfa0+i)});}db[_0x202b('0xe')][_0x202b('0xf')](users)[_0x202b('0x10')](function(){console[_0x202b('0x11')](_0x202b('0x12'));})[_0x202b('0x13')](function(_0x1d9e1e){console[_0x202b('0x11')](_0x1d9e1e);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 6119aef..28d7215 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce08=['WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','map','where','Campaign','format','%s:queue:%s','user:%s','find','userProfileId','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','user','ChatQueue','Trunk','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','fax','sms','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','emit','removeMailInteractions','length','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','join','default','connection','setMaxListeners','address','remoteAddress','request','remotePort','connectedAt','SocketIO\x20','lodash','util','bluebird','../mysqldb','./environment','name','Agents','User','role','telephone','agent','type','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xce08,0xb4));var _0x8ce0=function(_0x192e67,_0x475f98){_0x192e67=_0x192e67-0x0;var _0x2147cb=_0xce08[_0x192e67];return _0x2147cb;};'use strict';var _=require(_0x8ce0('0x0'));var util=require(_0x8ce0('0x1'));var BPromise=require(_0x8ce0('0x2'));var db=require(_0x8ce0('0x3'))['db'];var config=require(_0x8ce0('0x4'));var queryQueues={'attributes':['id',_0x8ce0('0x5')],'include':[{'as':_0x8ce0('0x6'),'model':db[_0x8ce0('0x7')],'attributes':['id','name',_0x8ce0('0x8')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x8ce0('0x5')],'where':{'role':_0x8ce0('0x9')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x8ce0('0xa')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x8ce0('0x5'),_0x8ce0('0xb')],'where':{'type':_0x8ce0('0xc')}};function getAssociatedResources(_0xbd08b6,_0x733de3,_0x2b5fa9){return db[_0x8ce0('0xd')][_0x8ce0('0xe')]({'where':{'name':_0xbd08b6,'userProfileId':_0x733de3},'raw':!![]})[_0x8ce0('0xf')](function(_0x57133f){if(_0x57133f){if(_0x57133f[_0x8ce0('0x10')]){switch(_0xbd08b6){case _0x8ce0('0x11'):case _0x8ce0('0x12'):case _0x8ce0('0x13'):case _0x8ce0('0x14'):case _0x8ce0('0x15'):case'OpenchannelQueues':case _0x8ce0('0x16'):return db[_0x2b5fa9][_0x8ce0('0x17')](queryQueues);case _0x8ce0('0x18'):return db[_0x2b5fa9]['findAll'](queryTelephones);case _0x8ce0('0x19'):return db[_0x2b5fa9]['findAll'](queryTrunks);case _0x8ce0('0x1a'):return db[_0x2b5fa9][_0x8ce0('0x17')](queryCampaigns);}}else{return db['UserProfileResource'][_0x8ce0('0x17')]({'attributes':[_0x8ce0('0x1b')],'where':{'sectionId':_0x57133f['id']},'raw':!![]})[_0x8ce0('0xf')](function(_0x2f961c){if(_0x2f961c){var _0x88994a={'where':{'id':_[_0x8ce0('0x1c')](_0x2f961c,'resourceId')},'raw':!![]};switch(_0x2b5fa9){case _0x8ce0('0x7'):_0x88994a[_0x8ce0('0x1d')][_0x8ce0('0x8')]=_0x8ce0('0x9');break;case _0x8ce0('0x1e'):_0x88994a[_0x8ce0('0x1d')][_0x8ce0('0xb')]=_0x8ce0('0xc');break;}return db[_0x2b5fa9][_0x8ce0('0x17')](_0x88994a);}else{return[];}});}}else{return[];}})[_0x8ce0('0xf')](function(_0x53d980){return _0x53d980;});}function joinOrLeaveQueues(_0x184f6e,_0x353b9f,_0x2ecdb3,_0x3a97b9){_0x184f6e[_0x353b9f](util[_0x8ce0('0x1f')](_0x8ce0('0x20'),_0x2ecdb3,_0x3a97b9[_0x8ce0('0x5')]));if(_0x3a97b9[_0x8ce0('0x6')]){for(var _0x3d3d6a=0x0;_0x3d3d6a<_0x3a97b9[_0x8ce0('0x6')]['length'];_0x3d3d6a+=0x1){_0x184f6e[_0x353b9f](util[_0x8ce0('0x1f')](_0x8ce0('0x21'),_0x3a97b9[_0x8ce0('0x6')][_0x3d3d6a][_0x8ce0('0x5')]));}}}function joinOrLeave(_0x11c68d,_0x521d6a,_0x9d940){var _0x3b8553;if(_0x11c68d['handshake']['query']['id']){db[_0x8ce0('0x7')][_0x8ce0('0x22')]({'attributes':['id',_0x8ce0('0x5'),_0x8ce0('0x8'),_0x8ce0('0x23')],'where':{'id':_0x11c68d[_0x8ce0('0x24')][_0x8ce0('0x25')]['id']},'include':[{'model':db[_0x8ce0('0x26')],'as':_0x8ce0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ce0('0x28')],'as':_0x8ce0('0x29'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x8ce0('0x2a'),'attributes':['id'],'raw':!![]},{'model':db[_0x8ce0('0x2b')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x8ce0('0x2c')],'as':_0x8ce0('0x2d'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x8ce0('0x2e'),'attributes':['id'],'raw':!![]}]})[_0x8ce0('0xf')](function(_0x9ac201){if(_0x9ac201){_0x3b8553=_0x9ac201;_0x11c68d[_0x521d6a](util['format'](_0x8ce0('0x21'),_0x9ac201[_0x8ce0('0x5')]));var _0x389138=[];switch(_0x9ac201['role']){case _0x8ce0('0x2f'):_0x11c68d[_0x521d6a](_0x8ce0('0x30'));_0x11c68d[_0x521d6a](_0x8ce0('0x31'));if(queryQueues[_0x8ce0('0x32')](_0x8ce0('0x33'))){delete queryQueues[_0x8ce0('0x33')];}_0x389138['push'](db[_0x8ce0('0x34')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db['ChatQueue'][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x36')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x37')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x38')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x39')]['findAll'](queryQueues));_0x389138['push'](db[_0x8ce0('0x3a')][_0x8ce0('0x17')](queryQueues));_0x389138[_0x8ce0('0x35')](db['User'][_0x8ce0('0x17')](queryTelephones));_0x389138[_0x8ce0('0x35')](db['Trunk'][_0x8ce0('0x17')](queryTrunks));_0x389138[_0x8ce0('0x35')](db['Campaign'][_0x8ce0('0x17')](queryCampaigns));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x7')][_0x8ce0('0x17')](queryAgents));break;case _0x8ce0('0x3b'):_0x11c68d[_0x521d6a](_0x8ce0('0x30'));_0x11c68d[_0x521d6a](_0x8ce0('0x31'));_0x389138['push'](getAssociatedResources('VoiceQueues',_0x9ac201['userProfileId'],_0x8ce0('0x34')));_0x389138['push'](getAssociatedResources(_0x8ce0('0x12'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x3c')));_0x389138['push'](getAssociatedResources(_0x8ce0('0x13'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x36')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x14'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x37')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x15'),_0x9ac201[_0x8ce0('0x23')],'MailQueue'));_0x389138['push'](getAssociatedResources('OpenchannelQueues',_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x39')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x16'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x3a')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x18'),_0x9ac201[_0x8ce0('0x23')],'User'));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x19'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x3d')));_0x389138[_0x8ce0('0x35')](getAssociatedResources(_0x8ce0('0x1a'),_0x9ac201[_0x8ce0('0x23')],_0x8ce0('0x1e')));_0x389138[_0x8ce0('0x35')](db[_0x8ce0('0x7')][_0x8ce0('0x17')](queryAgents));break;case'agent':_0x11c68d[_0x521d6a](_0x8ce0('0x30'));_0x11c68d[_0x521d6a]('voice:outbound');_0x389138['push'](_0x9ac201[_0x8ce0('0x3e')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138['push'](_0x9ac201[_0x8ce0('0x3f')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201['getFaxQueues']({'attributes':['id','name']}));_0x389138['push'](_0x9ac201[_0x8ce0('0x40')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201[_0x8ce0('0x41')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201[_0x8ce0('0x42')]({'attributes':['id',_0x8ce0('0x5')]}));_0x389138[_0x8ce0('0x35')](_0x9ac201[_0x8ce0('0x43')]({'attributes':['id',_0x8ce0('0x5')]}));break;}return BPromise[_0x8ce0('0x44')](_0x389138);}})[_0x8ce0('0xf')](function(_0x1fe6b9){if(_0x1fe6b9&&_0x1fe6b9['length']){for(var _0x14d95a=0x0;_0x14d95a<_0x1fe6b9['length'];_0x14d95a+=0x1){for(var _0x123b4d=0x0;_0x123b4d<_0x1fe6b9[_0x14d95a]['length'];_0x123b4d+=0x1){switch(_0x14d95a){case 0x0:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x45'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x1:joinOrLeaveQueues(_0x11c68d,_0x521d6a,'chat',_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x2:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x46'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x3:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x47'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x4:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x48'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x5:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x49'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x6:joinOrLeaveQueues(_0x11c68d,_0x521d6a,_0x8ce0('0x4a'),_0x1fe6b9[_0x14d95a][_0x123b4d]);break;case 0x7:if(_0x3b8553[_0x8ce0('0x8')]!==_0x8ce0('0xa'))_0x11c68d[_0x521d6a](util[_0x8ce0('0x1f')](_0x8ce0('0x4b'),_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;case 0x8:if(_0x3b8553[_0x8ce0('0x8')]!==_0x8ce0('0xa'))_0x11c68d[_0x521d6a](util[_0x8ce0('0x1f')]('trunk:%s',_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;case 0x9:if(_0x3b8553[_0x8ce0('0x8')]!==_0x8ce0('0xa'))_0x11c68d[_0x521d6a](util['format'](_0x8ce0('0x4c'),_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0xb')],_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;case 0xa:_0x11c68d[_0x521d6a](util[_0x8ce0('0x1f')](_0x8ce0('0x21'),_0x1fe6b9[_0x14d95a][_0x123b4d][_0x8ce0('0x5')]));break;}}}}})['then'](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x53c673=_['map'](_0x3b8553[_0x8ce0('0x27')],'id');return _0x3b8553['removeChatInteractions'](_0x53c673)[_0x8ce0('0xf')](function(){for(var _0x3a1bba=0x0;_0x3a1bba<_0x53c673['length'];_0x3a1bba+=0x1){_0x9d940[_0x8ce0('0x4e')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x53c673[_0x3a1bba]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x83eb79=_[_0x8ce0('0x1c')](_0x3b8553['MailInteractions'],'id');return _0x3b8553[_0x8ce0('0x4f')](_0x83eb79)['then'](function(){for(var _0x31f73d=0x0;_0x31f73d<_0x83eb79[_0x8ce0('0x50')];_0x31f73d+=0x1){_0x9d940[_0x8ce0('0x4e')](_0x8ce0('0x51'),{'MailInteractionId':Number(_0x83eb79[_0x31f73d]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x202226=_[_0x8ce0('0x1c')](_0x3b8553[_0x8ce0('0x2a')],'id');return _0x3b8553[_0x8ce0('0x52')](_0x202226)['then'](function(){for(var _0x451acb=0x0;_0x451acb<_0x202226['length'];_0x451acb+=0x1){_0x9d940[_0x8ce0('0x4e')](_0x8ce0('0x53'),{'FaxInteractionId':Number(_0x202226[_0x451acb]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x5b1cec=_[_0x8ce0('0x1c')](_0x3b8553[_0x8ce0('0x54')],'id');return _0x3b8553[_0x8ce0('0x55')](_0x5b1cec)[_0x8ce0('0xf')](function(){for(var _0x3fc49=0x0;_0x3fc49<_0x5b1cec[_0x8ce0('0x50')];_0x3fc49+=0x1){_0x9d940[_0x8ce0('0x4e')](_0x8ce0('0x56'),{'SmsInteractionId':Number(_0x5b1cec[_0x3fc49]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x21db0c=_[_0x8ce0('0x1c')](_0x3b8553['OpenchannelInteractions'],'id');return _0x3b8553['removeOpenchannelInteractions'](_0x21db0c)[_0x8ce0('0xf')](function(){for(var _0x271886=0x0;_0x271886<_0x21db0c['length'];_0x271886+=0x1){_0x9d940['emit'](_0x8ce0('0x57'),{'OpenchannelInteractionId':Number(_0x21db0c[_0x271886]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0xf')](function(){if(_0x521d6a===_0x8ce0('0x4d')){var _0x182f63=_['map'](_0x3b8553[_0x8ce0('0x2e')],'id');return _0x3b8553[_0x8ce0('0x58')](_0x182f63)['then'](function(){for(var _0x59f8c2=0x0;_0x59f8c2<_0x182f63[_0x8ce0('0x50')];_0x59f8c2+=0x1){_0x9d940[_0x8ce0('0x4e')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x182f63[_0x59f8c2]),'UserId':Number(_0x3b8553['id'])});}});}})[_0x8ce0('0x59')](function(_0xf74cc2){_0x11c68d[_0x8ce0('0x5a')](_0xf74cc2);});}}function onDisconnect(_0x16d505,_0x1395b8){joinOrLeave(_0x16d505,_0x8ce0('0x4d'),_0x1395b8);}function onConnect(_0xb00c6f){joinOrLeave(_0xb00c6f,_0x8ce0('0x5b'));}exports[_0x8ce0('0x5c')]=function(_0x5475e6){_0x5475e6['on'](_0x8ce0('0x5d'),function(_0x1c82e9){_0x1c82e9[_0x8ce0('0x5e')](0x0);_0x1c82e9[_0x8ce0('0x5f')]=_0x1c82e9['request'][_0x8ce0('0x5d')][_0x8ce0('0x60')]+':'+_0x1c82e9[_0x8ce0('0x61')][_0x8ce0('0x5d')][_0x8ce0('0x62')];_0x1c82e9[_0x8ce0('0x63')]=new Date();_0x1c82e9[_0x8ce0('0x5a')]=function(_0x32be39){console[_0x8ce0('0x5a')](_0x8ce0('0x64')+_0x1c82e9['nsp'][_0x8ce0('0x5')]+'['+_0x1c82e9[_0x8ce0('0x5f')]+']',_0x32be39);};_0x1c82e9['on']('disconnect',function(){onDisconnect(_0x1c82e9,_0x5475e6);_0x1c82e9[_0x8ce0('0x5a')]('DISCONNECTED');});onConnect(_0x1c82e9);_0x1c82e9[_0x8ce0('0x5a')]('CONNECTED');});}; \ No newline at end of file +var _0xc373=['UserProfileResource','resourceId','then','map','telephone','%s:queue:%s','format','userProfileId','handshake','MailInteraction','MailInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','voice:inbound','VoiceQueue','MailQueue','OpenchannelQueues','Trunks','IvrCampaigns','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','all','length','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','ChatInteractions','removeChatInteractions','emit','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','catch','log','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','Agents','User','name','role','agent','type','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0xc373,0x1c7));var _0x3c37=function(_0x1f27df,_0x4f1a64){_0x1f27df=_0x1f27df-0x0;var _0x286ee2=_0xc373[_0x1f27df];return _0x286ee2;};'use strict';var _=require('lodash');var util=require(_0x3c37('0x0'));var BPromise=require(_0x3c37('0x1'));var db=require(_0x3c37('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0x3c37('0x3'),'model':db[_0x3c37('0x4')],'attributes':['id',_0x3c37('0x5'),_0x3c37('0x6')],'raw':!![],'where':{'role':_0x3c37('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x3c37('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x3c37('0x5')],'where':{'role':_0x3c37('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x3c37('0x5'),_0x3c37('0x8')],'where':{'type':_0x3c37('0x9')}};function getAssociatedResources(_0x44166e,_0x1b7306,_0x59d4f9){return db[_0x3c37('0xa')]['findOne']({'where':{'name':_0x44166e,'userProfileId':_0x1b7306},'raw':!![]})['then'](function(_0x444545){if(_0x444545){if(_0x444545[_0x3c37('0xb')]){switch(_0x44166e){case _0x3c37('0xc'):case _0x3c37('0xd'):case _0x3c37('0xe'):case _0x3c37('0xf'):case _0x3c37('0x10'):case'OpenchannelQueues':case _0x3c37('0x11'):return db[_0x59d4f9][_0x3c37('0x12')](queryQueues);case _0x3c37('0x13'):return db[_0x59d4f9]['findAll'](queryTelephones);case'Trunks':return db[_0x59d4f9][_0x3c37('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x59d4f9]['findAll'](queryCampaigns);}}else{return db[_0x3c37('0x14')][_0x3c37('0x12')]({'attributes':[_0x3c37('0x15')],'where':{'sectionId':_0x444545['id']},'raw':!![]})[_0x3c37('0x16')](function(_0x1268b3){if(_0x1268b3){var _0x22e851={'where':{'id':_[_0x3c37('0x17')](_0x1268b3,_0x3c37('0x15'))},'raw':!![]};switch(_0x59d4f9){case _0x3c37('0x4'):_0x22e851['where'][_0x3c37('0x6')]=_0x3c37('0x18');break;case'Campaign':_0x22e851['where'][_0x3c37('0x8')]=_0x3c37('0x9');break;}return db[_0x59d4f9][_0x3c37('0x12')](_0x22e851);}else{return[];}});}}else{return[];}})[_0x3c37('0x16')](function(_0x22de19){return _0x22de19;});}function joinOrLeaveQueues(_0x2b0f25,_0x5df78c,_0x97c790,_0x5dfcbb){_0x2b0f25[_0x5df78c](util['format'](_0x3c37('0x19'),_0x97c790,_0x5dfcbb[_0x3c37('0x5')]));if(_0x5dfcbb[_0x3c37('0x3')]){for(var _0x7fe4f0=0x0;_0x7fe4f0<_0x5dfcbb[_0x3c37('0x3')]['length'];_0x7fe4f0+=0x1){_0x2b0f25[_0x5df78c](util[_0x3c37('0x1a')]('user:%s',_0x5dfcbb[_0x3c37('0x3')][_0x7fe4f0]['name']));}}}function joinOrLeave(_0xb662e3,_0x2e4226,_0x348802){var _0x574890;if(_0xb662e3['handshake']['query']['id']){db['User']['find']({'attributes':['id',_0x3c37('0x5'),_0x3c37('0x6'),_0x3c37('0x1b')],'where':{'id':_0xb662e3[_0x3c37('0x1c')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3c37('0x1d')],'as':_0x3c37('0x1e'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x3c37('0x1f')],'as':_0x3c37('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x3c37('0x21')],'as':_0x3c37('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x3c37('0x23')],'as':_0x3c37('0x24'),'attributes':['id'],'raw':!![]}]})[_0x3c37('0x16')](function(_0x3abacf){if(_0x3abacf){_0x574890=_0x3abacf;_0xb662e3[_0x2e4226](util[_0x3c37('0x1a')](_0x3c37('0x25'),_0x3abacf['name']));var _0x22cf15=[];switch(_0x3abacf[_0x3c37('0x6')]){case'admin':_0xb662e3[_0x2e4226]('voice:inbound');_0xb662e3[_0x2e4226](_0x3c37('0x26'));if(queryQueues[_0x3c37('0x27')](_0x3c37('0x28'))){delete queryQueues['include'];}_0x22cf15[_0x3c37('0x29')](db['VoiceQueue'][_0x3c37('0x12')](queryQueues));_0x22cf15[_0x3c37('0x29')](db[_0x3c37('0x2a')][_0x3c37('0x12')](queryQueues));_0x22cf15[_0x3c37('0x29')](db[_0x3c37('0x2b')][_0x3c37('0x12')](queryQueues));_0x22cf15[_0x3c37('0x29')](db[_0x3c37('0x2c')][_0x3c37('0x12')](queryQueues));_0x22cf15['push'](db['MailQueue']['findAll'](queryQueues));_0x22cf15[_0x3c37('0x29')](db[_0x3c37('0x2d')][_0x3c37('0x12')](queryQueues));_0x22cf15[_0x3c37('0x29')](db[_0x3c37('0x2e')][_0x3c37('0x12')](queryQueues));_0x22cf15[_0x3c37('0x29')](db[_0x3c37('0x4')][_0x3c37('0x12')](queryTelephones));_0x22cf15[_0x3c37('0x29')](db[_0x3c37('0x2f')][_0x3c37('0x12')](queryTrunks));_0x22cf15['push'](db[_0x3c37('0x30')][_0x3c37('0x12')](queryCampaigns));_0x22cf15['push'](db['User'][_0x3c37('0x12')](queryAgents));break;case _0x3c37('0x31'):_0xb662e3[_0x2e4226](_0x3c37('0x32'));_0xb662e3[_0x2e4226](_0x3c37('0x26'));_0x22cf15[_0x3c37('0x29')](getAssociatedResources(_0x3c37('0xc'),_0x3abacf[_0x3c37('0x1b')],_0x3c37('0x33')));_0x22cf15[_0x3c37('0x29')](getAssociatedResources('ChatQueues',_0x3abacf[_0x3c37('0x1b')],_0x3c37('0x2a')));_0x22cf15[_0x3c37('0x29')](getAssociatedResources(_0x3c37('0xe'),_0x3abacf[_0x3c37('0x1b')],_0x3c37('0x2b')));_0x22cf15[_0x3c37('0x29')](getAssociatedResources(_0x3c37('0xf'),_0x3abacf[_0x3c37('0x1b')],_0x3c37('0x2c')));_0x22cf15['push'](getAssociatedResources(_0x3c37('0x10'),_0x3abacf[_0x3c37('0x1b')],_0x3c37('0x34')));_0x22cf15[_0x3c37('0x29')](getAssociatedResources(_0x3c37('0x35'),_0x3abacf['userProfileId'],_0x3c37('0x2d')));_0x22cf15[_0x3c37('0x29')](getAssociatedResources(_0x3c37('0x11'),_0x3abacf[_0x3c37('0x1b')],'WhatsappQueue'));_0x22cf15[_0x3c37('0x29')](getAssociatedResources('Telephones',_0x3abacf[_0x3c37('0x1b')],'User'));_0x22cf15[_0x3c37('0x29')](getAssociatedResources(_0x3c37('0x36'),_0x3abacf[_0x3c37('0x1b')],'Trunk'));_0x22cf15[_0x3c37('0x29')](getAssociatedResources(_0x3c37('0x37'),_0x3abacf[_0x3c37('0x1b')],_0x3c37('0x30')));_0x22cf15[_0x3c37('0x29')](db['User'][_0x3c37('0x12')](queryAgents));break;case _0x3c37('0x7'):_0xb662e3[_0x2e4226](_0x3c37('0x32'));_0xb662e3[_0x2e4226](_0x3c37('0x26'));_0x22cf15[_0x3c37('0x29')](_0x3abacf[_0x3c37('0x38')]({'attributes':['id',_0x3c37('0x5')]}));_0x22cf15['push'](_0x3abacf[_0x3c37('0x39')]({'attributes':['id',_0x3c37('0x5')]}));_0x22cf15[_0x3c37('0x29')](_0x3abacf['getFaxQueues']({'attributes':['id',_0x3c37('0x5')]}));_0x22cf15['push'](_0x3abacf[_0x3c37('0x3a')]({'attributes':['id',_0x3c37('0x5')]}));_0x22cf15[_0x3c37('0x29')](_0x3abacf[_0x3c37('0x3b')]({'attributes':['id','name']}));_0x22cf15['push'](_0x3abacf['getOpenchannelQueues']({'attributes':['id',_0x3c37('0x5')]}));_0x22cf15[_0x3c37('0x29')](_0x3abacf['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x3c37('0x3c')](_0x22cf15);}})['then'](function(_0x834af3){if(_0x834af3&&_0x834af3[_0x3c37('0x3d')]){for(var _0x3c4988=0x0;_0x3c4988<_0x834af3[_0x3c37('0x3d')];_0x3c4988+=0x1){for(var _0x150f71=0x0;_0x150f71<_0x834af3[_0x3c4988][_0x3c37('0x3d')];_0x150f71+=0x1){switch(_0x3c4988){case 0x0:joinOrLeaveQueues(_0xb662e3,_0x2e4226,_0x3c37('0x3e'),_0x834af3[_0x3c4988][_0x150f71]);break;case 0x1:joinOrLeaveQueues(_0xb662e3,_0x2e4226,_0x3c37('0x3f'),_0x834af3[_0x3c4988][_0x150f71]);break;case 0x2:joinOrLeaveQueues(_0xb662e3,_0x2e4226,_0x3c37('0x40'),_0x834af3[_0x3c4988][_0x150f71]);break;case 0x3:joinOrLeaveQueues(_0xb662e3,_0x2e4226,_0x3c37('0x41'),_0x834af3[_0x3c4988][_0x150f71]);break;case 0x4:joinOrLeaveQueues(_0xb662e3,_0x2e4226,_0x3c37('0x42'),_0x834af3[_0x3c4988][_0x150f71]);break;case 0x5:joinOrLeaveQueues(_0xb662e3,_0x2e4226,'openchannel',_0x834af3[_0x3c4988][_0x150f71]);break;case 0x6:joinOrLeaveQueues(_0xb662e3,_0x2e4226,_0x3c37('0x43'),_0x834af3[_0x3c4988][_0x150f71]);break;case 0x7:if(_0x574890[_0x3c37('0x6')]!=='agent')_0xb662e3[_0x2e4226](util[_0x3c37('0x1a')](_0x3c37('0x44'),_0x834af3[_0x3c4988][_0x150f71][_0x3c37('0x5')]));break;case 0x8:if(_0x574890['role']!==_0x3c37('0x7'))_0xb662e3[_0x2e4226](util['format'](_0x3c37('0x45'),_0x834af3[_0x3c4988][_0x150f71][_0x3c37('0x5')]));break;case 0x9:if(_0x574890[_0x3c37('0x6')]!=='agent')_0xb662e3[_0x2e4226](util[_0x3c37('0x1a')](_0x3c37('0x46'),_0x834af3[_0x3c4988][_0x150f71][_0x3c37('0x8')],_0x834af3[_0x3c4988][_0x150f71][_0x3c37('0x5')]));break;case 0xa:_0xb662e3[_0x2e4226](util[_0x3c37('0x1a')](_0x3c37('0x25'),_0x834af3[_0x3c4988][_0x150f71][_0x3c37('0x5')]));break;}}}}})[_0x3c37('0x16')](function(){if(_0x2e4226===_0x3c37('0x47')){var _0x293fdb=_[_0x3c37('0x17')](_0x574890[_0x3c37('0x48')],'id');return _0x574890[_0x3c37('0x49')](_0x293fdb)['then'](function(){for(var _0xed6864=0x0;_0xed6864<_0x293fdb[_0x3c37('0x3d')];_0xed6864+=0x1){_0x348802[_0x3c37('0x4a')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x293fdb[_0xed6864]),'UserId':Number(_0x574890['id'])});}});}})[_0x3c37('0x16')](function(){if(_0x2e4226===_0x3c37('0x47')){var _0x36bb8c=_['map'](_0x574890[_0x3c37('0x1e')],'id');return _0x574890[_0x3c37('0x4b')](_0x36bb8c)[_0x3c37('0x16')](function(){for(var _0x183b19=0x0;_0x183b19<_0x36bb8c[_0x3c37('0x3d')];_0x183b19+=0x1){_0x348802['emit'](_0x3c37('0x4c'),{'MailInteractionId':Number(_0x36bb8c[_0x183b19]),'UserId':Number(_0x574890['id'])});}});}})[_0x3c37('0x16')](function(){if(_0x2e4226===_0x3c37('0x47')){var _0x314b21=_['map'](_0x574890['FaxInteractions'],'id');return _0x574890[_0x3c37('0x4d')](_0x314b21)['then'](function(){for(var _0x117def=0x0;_0x117def<_0x314b21[_0x3c37('0x3d')];_0x117def+=0x1){_0x348802[_0x3c37('0x4a')](_0x3c37('0x4e'),{'FaxInteractionId':Number(_0x314b21[_0x117def]),'UserId':Number(_0x574890['id'])});}});}})['then'](function(){if(_0x2e4226===_0x3c37('0x47')){var _0x383ab4=_[_0x3c37('0x17')](_0x574890[_0x3c37('0x20')],'id');return _0x574890['removeSmsInteractions'](_0x383ab4)[_0x3c37('0x16')](function(){for(var _0x1858bf=0x0;_0x1858bf<_0x383ab4['length'];_0x1858bf+=0x1){_0x348802['emit'](_0x3c37('0x4f'),{'SmsInteractionId':Number(_0x383ab4[_0x1858bf]),'UserId':Number(_0x574890['id'])});}});}})['then'](function(){if(_0x2e4226===_0x3c37('0x47')){var _0x1b2629=_[_0x3c37('0x17')](_0x574890[_0x3c37('0x22')],'id');return _0x574890['removeOpenchannelInteractions'](_0x1b2629)[_0x3c37('0x16')](function(){for(var _0x5a0d96=0x0;_0x5a0d96<_0x1b2629[_0x3c37('0x3d')];_0x5a0d96+=0x1){_0x348802[_0x3c37('0x4a')](_0x3c37('0x50'),{'OpenchannelInteractionId':Number(_0x1b2629[_0x5a0d96]),'UserId':Number(_0x574890['id'])});}});}})[_0x3c37('0x16')](function(){if(_0x2e4226==='leave'){var _0x338098=_['map'](_0x574890[_0x3c37('0x24')],'id');return _0x574890[_0x3c37('0x51')](_0x338098)[_0x3c37('0x16')](function(){for(var _0x59d034=0x0;_0x59d034<_0x338098[_0x3c37('0x3d')];_0x59d034+=0x1){_0x348802[_0x3c37('0x4a')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x338098[_0x59d034]),'UserId':Number(_0x574890['id'])});}});}})[_0x3c37('0x52')](function(_0x22a86c){_0xb662e3[_0x3c37('0x53')](_0x22a86c);});}}function onDisconnect(_0x5964d4,_0x251cff){joinOrLeave(_0x5964d4,_0x3c37('0x47'),_0x251cff);}function onConnect(_0x5391f4){joinOrLeave(_0x5391f4,'join');}exports['default']=function(_0xbbdf5f){_0xbbdf5f['on'](_0x3c37('0x54'),function(_0x1fef45){_0x1fef45[_0x3c37('0x55')](0x0);_0x1fef45[_0x3c37('0x56')]=_0x1fef45[_0x3c37('0x57')][_0x3c37('0x54')][_0x3c37('0x58')]+':'+_0x1fef45[_0x3c37('0x57')][_0x3c37('0x54')][_0x3c37('0x59')];_0x1fef45[_0x3c37('0x5a')]=new Date();_0x1fef45[_0x3c37('0x53')]=function(_0x56cc4b){console[_0x3c37('0x53')](_0x3c37('0x5b')+_0x1fef45[_0x3c37('0x5c')][_0x3c37('0x5')]+'['+_0x1fef45[_0x3c37('0x56')]+']',_0x56cc4b);};_0x1fef45['on']('disconnect',function(){onDisconnect(_0x1fef45,_0xbbdf5f);_0x1fef45[_0x3c37('0x53')](_0x3c37('0x5d'));});onConnect(_0x1fef45);_0x1fef45[_0x3c37('0x53')](_0x3c37('0x5e'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 21815ab..b955dac 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 _0xf6f8=['jayson/promise','../logger','triggers','lodash','client','http','Chat','ChatInteraction','newinteraction','closedinteraction','ChatMessage','afterCreate','newmessage','SmsInteraction','afterUpdate','Sms','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','channel','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','query','Sequelize','QueryTypes','SELECT','UserId','find','fullname','email','internal','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','event','opened','sequelize','contact','closed','User','name','default','model','hook','callback','toLowerCase','util','../../mysqldb'];(function(_0x11110e,_0x231c06){var _0x53e0ad=function(_0x5e247f){while(--_0x5e247f){_0x11110e['push'](_0x11110e['shift']());}};_0x53e0ad(++_0x231c06);}(_0xf6f8,0x1a8));var _0x8f6f=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xf6f8[_0xc0a3d3];return _0x3386e8;};'use strict';var util=require(_0x8f6f('0x0'));var db=require(_0x8f6f('0x1'))['db'];var jayson=require(_0x8f6f('0x2'));var logger=require(_0x8f6f('0x3'))(_0x8f6f('0x4'));var _=require(_0x8f6f('0x5'));var client=jayson[_0x8f6f('0x6')][_0x8f6f('0x7')]({'port':0x232a});var triggers=[{'channel':_0x8f6f('0x8'),'model':_0x8f6f('0x9'),'event':'afterCreate','condition':_0x8f6f('0xa'),'callback':afterCreate},{'channel':_0x8f6f('0x8'),'model':'ChatInteraction','event':'afterUpdate','condition':_0x8f6f('0xb'),'callback':afterUpdate},{'channel':_0x8f6f('0x8'),'model':_0x8f6f('0xc'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xe'),'callback':afterCreateMessage},{'channel':'Sms','model':_0x8f6f('0xf'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xa'),'callback':afterCreate},{'channel':'Sms','model':_0x8f6f('0xf'),'event':_0x8f6f('0x10'),'condition':_0x8f6f('0xb'),'callback':afterUpdate},{'channel':_0x8f6f('0x11'),'model':_0x8f6f('0x12'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xe'),'callback':afterCreateMessage},{'channel':_0x8f6f('0x13'),'model':_0x8f6f('0x14'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xa'),'callback':afterCreate},{'channel':'Whatsapp','model':_0x8f6f('0x14'),'event':'afterUpdate','condition':_0x8f6f('0xb'),'callback':afterUpdate},{'channel':_0x8f6f('0x13'),'model':_0x8f6f('0x15'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0x8f6f('0x16'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xa'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0x8f6f('0x10'),'condition':_0x8f6f('0xb'),'callback':afterUpdate},{'channel':_0x8f6f('0x17'),'model':_0x8f6f('0x18'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xe'),'callback':afterCreateMessage},{'channel':_0x8f6f('0x19'),'model':_0x8f6f('0x1a'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xa'),'callback':afterCreate},{'channel':_0x8f6f('0x19'),'model':'MailInteraction','event':_0x8f6f('0x10'),'condition':_0x8f6f('0xb'),'callback':afterUpdate},{'channel':_0x8f6f('0x19'),'model':_0x8f6f('0x1b'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xe'),'callback':afterCreateMessage},{'channel':_0x8f6f('0x1c'),'model':_0x8f6f('0x1d'),'event':_0x8f6f('0xd'),'condition':_0x8f6f('0xa'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x8f6f('0x10'),'condition':_0x8f6f('0xb'),'callback':afterUpdate},{'channel':_0x8f6f('0x1c'),'model':_0x8f6f('0x1e'),'event':'afterCreate','condition':_0x8f6f('0xe'),'callback':afterCreateMessage}];function request(_0x2b5248){return client[_0x8f6f('0x1f')](_0x8f6f('0x20'),_0x2b5248)[_0x8f6f('0x21')](function(_0x2fd08d){logger[_0x8f6f('0x22')](_0x8f6f('0x23'),'EventManager',_0x2fd08d);if(_0x2fd08d[_0x8f6f('0x24')]){if(_0x2fd08d[_0x8f6f('0x24')][_0x8f6f('0x25')]===0x1f4){logger['error'](_0x8f6f('0x23'),_0x8f6f('0x20'),_0x2fd08d['error']);}}})[_0x8f6f('0x26')](function(_0x11af2a){logger[_0x8f6f('0x24')](_0x8f6f('0x23'),_0x8f6f('0x20'),_0x11af2a);});}function afterCreateMessage(_0x23ed9f,_0x5e03ba){return function(_0x2425e9,_0x4282e1){_0x2425e9=_0x2425e9[_0x8f6f('0x27')]({'plain':!![]});_0x2425e9[_0x8f6f('0x28')]=_0x23ed9f;_0x2425e9['event']=_0x2425e9[_0x8f6f('0x29')];var _0x4acd96=_0x8f6f('0x2a')+_0x2425e9[_0x8f6f('0x2b')];return db['sequelize'][_0x8f6f('0x2c')](_0x4acd96,{'type':db[_0x8f6f('0x2d')][_0x8f6f('0x2e')][_0x8f6f('0x2f')],'raw':!![]})[_0x8f6f('0x21')](function(_0x9f4d10){return _0x9f4d10;})[_0x8f6f('0x21')](function(_0x4d352f){if(_0x4d352f){_0x2425e9['contact']=_0x4d352f[0x0];}if(_0x2425e9[_0x8f6f('0x30')]){return db['User'][_0x8f6f('0x31')]({'where':{'id':_0x2425e9[_0x8f6f('0x30')]},'attributes':['id','name',_0x8f6f('0x32'),_0x8f6f('0x33'),_0x8f6f('0x34')],'raw':!![]})['then'](function(_0x9bd1b3){_0x2425e9[_0x8f6f('0x35')]=util[_0x8f6f('0x36')](_0x8f6f('0x37'),_0x9bd1b3['name']);_0x2425e9[_0x8f6f('0x28')]=_0x23ed9f;_0x2425e9[_0x8f6f('0x38')]=_0x9bd1b3;return request({'event':_0x8f6f('0x39'),'message':_0x2425e9});})['catch'](function(_0x33b197){console[_0x8f6f('0x24')](_0x33b197);});}else{return request({'event':_0x8f6f('0x3a'),'message':_0x2425e9});}});};}function afterCreate(_0x4e0a35,_0xeb593d){return function(_0x10e91b,_0x1d8455){_0x10e91b=_0x10e91b[_0x8f6f('0x27')]({'plain':!![]});_0x10e91b['channel']=_0x4e0a35;_0x10e91b[_0x8f6f('0x3b')]=_0x8f6f('0x3c');var _0x1fa1d4=_0x8f6f('0x2a')+_0x10e91b[_0x8f6f('0x2b')];return db[_0x8f6f('0x3d')]['query'](_0x1fa1d4,{'type':db[_0x8f6f('0x2d')][_0x8f6f('0x2e')][_0x8f6f('0x2f')],'raw':!![]})[_0x8f6f('0x21')](function(_0x33993c){return _0x33993c;})[_0x8f6f('0x21')](function(_0x5e019b){if(_0x5e019b){_0x10e91b[_0x8f6f('0x3e')]=_0x5e019b[0x0];}return request({'event':_0xeb593d,'message':_0x10e91b});});};}function afterUpdate(_0x2d7767,_0x58b98e){return function(_0x5e131b,_0x3e2f7f){if(_0x5e131b['changed'](_0x8f6f('0x3f'))&&_0x5e131b[_0x8f6f('0x3f')]){_0x5e131b=_0x5e131b[_0x8f6f('0x27')]({'plain':!![]});_0x5e131b[_0x8f6f('0x28')]=_0x2d7767;_0x5e131b['event']='closed';var _0x1b4d60='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5e131b[_0x8f6f('0x2b')];return db[_0x8f6f('0x3d')][_0x8f6f('0x2c')](_0x1b4d60,{'type':db['Sequelize'][_0x8f6f('0x2e')][_0x8f6f('0x2f')],'raw':!![]})[_0x8f6f('0x21')](function(_0x5a0a3e){return _0x5a0a3e;})[_0x8f6f('0x21')](function(_0x5341da){if(_0x5341da){_0x5e131b[_0x8f6f('0x3e')]=_0x5341da[0x0];}if(_0x5e131b['UserId']){return db[_0x8f6f('0x40')][_0x8f6f('0x31')]({'where':{'id':_0x5e131b['UserId']},'attributes':['id','name',_0x8f6f('0x32'),_0x8f6f('0x33'),_0x8f6f('0x34')],'raw':!![]})[_0x8f6f('0x21')](function(_0x319556){_0x5e131b['interface']=util[_0x8f6f('0x36')](_0x8f6f('0x37'),_0x319556[_0x8f6f('0x41')]);_0x5e131b[_0x8f6f('0x38')]=_0x319556;return request({'event':_0x58b98e,'message':_0x5e131b});})[_0x8f6f('0x26')](function(_0x3bb7ef){console[_0x8f6f('0x24')](_0x3bb7ef);});}else{return request({'event':_0x58b98e,'message':_0x5e131b});}});}};}exports[_0x8f6f('0x42')]=function(){for(var _0x145882=0x0;_0x145882=_0x21dcef[_0xd1cd('0x15')]){throw Error(_0xd1cd('0x16'));}_0x5902a4(_0x503352);})[_0xd1cd('0x17')](function(_0x5de176){_0x2eba49(_0x5de176);});});}; \ No newline at end of file +var _0xd9db=['count','then','agents','catch','lodash','bluebird','../mysqldb','mail','chat','fax','sms','whatsapp','isValidChannel','toLowerCase','clearBlockUser','blockedAt','getLicense','role','agent','User'];(function(_0x3fcf8f,_0xac53a1){var _0x4143de=function(_0x2987f4){while(--_0x2987f4){_0x3fcf8f['push'](_0x3fcf8f['shift']());}};_0x4143de(++_0xac53a1);}(_0xd9db,0x194));var _0xbd9d=function(_0x9966a9,_0x58fff3){_0x9966a9=_0x9966a9-0x0;var _0x22059d=_0xd9db[_0x9966a9];return _0x22059d;};'use strict';var _=require(_0xbd9d('0x0'));var BPromise=require(_0xbd9d('0x1'));var db=require(_0xbd9d('0x2'))['db'];var util=require('./license/util');var channels=['voice',_0xbd9d('0x3'),_0xbd9d('0x4'),_0xbd9d('0x5'),_0xbd9d('0x6'),_0xbd9d('0x7'),'openchannel'];exports['getChannels']=function(){return channels;};exports[_0xbd9d('0x8')]=function(_0x2a3afd){_0x2a3afd=_0x2a3afd[_0xbd9d('0x9')]();return _['includes'](channels,_0x2a3afd);};exports[_0xbd9d('0xa')]=function(_0x1ea1ab,_0x371659,_0x1eff80,_0x1375e0){var _0x4b4c49={'loginAttempts':_0x371659,'blocked':_0x1eff80};if(!_['isUndefined'](_0x1375e0)){_0x4b4c49[_0xbd9d('0xb')]=_0x1375e0;}return _0x1ea1ab['updateAttributes'](_0x4b4c49);};exports[_0xbd9d('0xc')]=function(_0x1794e6){return new BPromise(function(_0x26a691,_0x2a644c){var _0x3d32f9=0x0;if(_0x1794e6[_0xbd9d('0xd')]!==_0xbd9d('0xe')){_0x26a691(_0x1794e6);}db[_0xbd9d('0xf')][_0xbd9d('0x10')]({'where':{'role':_0xbd9d('0xe'),'online':!![],'id':{'$ne':_0x1794e6['id']}}})['then'](function(_0x542959){_0x3d32f9=_0x542959;return util[_0xbd9d('0xc')]();})[_0xbd9d('0x11')](function(_0x279ff6){if(_0x279ff6&&_0x279ff6[_0xbd9d('0x12')]&&_0x3d32f9>=_0x279ff6['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x26a691(_0x1794e6);})[_0xbd9d('0x13')](function(_0x3026c1){_0x2a644c(_0x3026c1);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7f7a4f2..41df55b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3064=['send','exports','404','status','render','json'];(function(_0x5a0f41,_0x3f931d){var _0x1cb1fb=function(_0xbf01ba){while(--_0xbf01ba){_0x5a0f41['push'](_0x5a0f41['shift']());}};_0x1cb1fb(++_0x3f931d);}(_0x3064,0x73));var _0x4306=function(_0x2a4cbd,_0x5616d3){_0x2a4cbd=_0x2a4cbd-0x0;var _0x248a77=_0x3064[_0x2a4cbd];return _0x248a77;};'use strict';module[_0x4306('0x0')][0x194]=function pageNotFound(_0x1f364e,_0x1bde77){var _0xef2e5a=_0x4306('0x1');var _0x2047a7=0x194;var _0x30d7f6={'status':_0x2047a7};_0x1bde77[_0x4306('0x2')](_0x30d7f6[_0x4306('0x2')]);_0x1bde77[_0x4306('0x3')](_0xef2e5a,{},function(_0x179ca0,_0x3565aa){if(_0x179ca0){return _0x1bde77[_0x4306('0x2')](_0x30d7f6[_0x4306('0x2')])[_0x4306('0x4')](_0x30d7f6);}_0x1bde77[_0x4306('0x5')](_0x3565aa);});}; \ No newline at end of file +var _0xb9e7=['status','render','json','send','404'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb9e7,0x1df));var _0x7b9e=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xb9e7[_0x4b1032];return _0x5a1d55;};'use strict';module['exports'][0x194]=function pageNotFound(_0xdc51fc,_0x30abef){var _0x2ca2bd=_0x7b9e('0x0');var _0x379946=0x194;var _0x3a5cdd={'status':_0x379946};_0x30abef['status'](_0x3a5cdd[_0x7b9e('0x1')]);_0x30abef[_0x7b9e('0x2')](_0x2ca2bd,{},function(_0x4c697c,_0x2372ee){if(_0x4c697c){return _0x30abef['status'](_0x3a5cdd[_0x7b9e('0x1')])[_0x7b9e('0x3')](_0x3a5cdd);}_0x30abef[_0x7b9e('0x4')](_0x2372ee);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 7aed8cb..382ada4 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1e14=['../api/cloudProvider/cloudProvider.model','Realtime','../api/realtime/realtime.model','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','UserVoiceQueueRt','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','SenderId','userProfileId','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueues','ChatQueues','UserFaxQueue','SmsQueues','UserSmsQueue','WhatsappQueues','VoicePrefix','user_has_voice_prefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccount','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','user_has_sms_accounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','ChanSpyId','Sound','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','IntervalId','belongsTo','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','Messages','mailboxuser','mailbox','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','CannedAnswer','Answers','Interactions','Applications','ListId','TemplateId','team_has_mail_queues','MailInteractionId','Account','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachments','Interaction','ChatWebsite','ChatWebsiteId','ChatOfflineMessageId','restrict','MailQueueReport','List','Dashboard','Items','FaxAccountId','FaxApplication','Exntensions','TagId','FaxInteractionId','Owner','fax_interaction_has_tags','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelMessage','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','ProactiveActions','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','ChatGroup','ChatGroupId','CompanyId','Hoppers','Company','cm_contact_has_tags','CampaignId','All','AutomationAllId','Automation','Any','OneAny','AutomationAnyId','Action','Actions','ParentId','Intervals','Extensions','MailApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','VariableId','Configurations','int_desk_configuration_has_tags','Description','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowAccount','Dynamics365Configuration','Dynamics365Field','FreshsalesField','FromId','ToId','SessionId','ProjectId','TeamVoiceQueue','team_has_chat_queues','FaxQueues','team_has_openchannel_queues','OpenchannelQueues','team_has_whatsapp_queues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ChatTransferReport','FromChatWebsiteId','ToAgent','ToChatQueueId','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','Queues','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','ToQueueId','WhatsappQueueId','path','../config/environment','sequelize','lodash','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','options','database','username','User','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/dashboard/dashboard.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','MailTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x1e14,0xef));var _0x41e1=function(_0x1e6479,_0x171ff9){_0x1e6479=_0x1e6479-0x0;var _0x40b1c4=_0x1e14[_0x1e6479];return _0x40b1c4;};'use strict';var path=require(_0x41e1('0x0'));var config=require(_0x41e1('0x1'));var Sequelize=require(_0x41e1('0x2'));var _=require(_0x41e1('0x3'));var jstz=require('jstz');var timezone=jstz['determine']();config['sequelize']=_[_0x41e1('0x4')](config['sequelize'],{'database':_0x41e1('0x5'),'username':_0x41e1('0x6'),'password':_0x41e1('0x7'),'options':{'host':_0x41e1('0x8'),'port':0xcea,'dialect':_0x41e1('0x9'),'dialectOptions':{'charset':_0x41e1('0xa')},'logging':![],'timezone':timezone[_0x41e1('0xb')](),'define':{'charset':_0x41e1('0xc'),'collate':_0x41e1('0xd')}}});config[_0x41e1('0xe')]=_[_0x41e1('0x4')](config[_0x41e1('0xe')],{'database':_0x41e1('0x5'),'username':'xcall','password':_0x41e1('0x7'),'options':{'host':_0x41e1('0x8'),'port':0xcea,'dialect':_0x41e1('0x9'),'dialectOptions':{'charset':_0x41e1('0xa')},'logging':![],'timezone':timezone[_0x41e1('0xb')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x41e1('0x2')]['username'],config[_0x41e1('0x2')]['password'],config[_0x41e1('0x2')][_0x41e1('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x41e1('0x10')],config[_0x41e1('0xe')][_0x41e1('0x11')],config['sequelizeHistory']['password'],config[_0x41e1('0xe')]['options'])};db[_0x41e1('0x12')]=db[_0x41e1('0x2')]['import']('../api/user/user.model');db[_0x41e1('0x13')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x15'));db[_0x41e1('0x16')]=db[_0x41e1('0x2')]['import']('../api/voiceContext/voiceContext.model');db[_0x41e1('0x17')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x18'));db[_0x41e1('0x19')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x1a'));db['VoiceQueue']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x1b'));db[_0x41e1('0x1c')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x1d'));db[_0x41e1('0x1e')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x1f'));db[_0x41e1('0x20')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x21'));db[_0x41e1('0x22')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x23'));db[_0x41e1('0x24')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x25'));db[_0x41e1('0x26')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x27'));db[_0x41e1('0x28')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x29'));db[_0x41e1('0x2a')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x2b'));db[_0x41e1('0x2c')]=db['sequelize']['import'](_0x41e1('0x2d'));db[_0x41e1('0x2e')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize']['import'](_0x41e1('0x2f'));db['UserVoiceQueueRt']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x30'));db[_0x41e1('0x31')]=db['sequelize'][_0x41e1('0x14')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x41e1('0x32')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x33'));db[_0x41e1('0x34')]=db['sequelize'][_0x41e1('0x14')]('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x35'));db['UserSmsQueue']=db['sequelize'][_0x41e1('0x14')]('../api/userSmsQueue/userSmsQueue.model');db[_0x41e1('0x36')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x37'));db[_0x41e1('0x38')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0x41e1('0x39')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x3a'));db[_0x41e1('0x3b')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x3c'));db['MailAccount']=db[_0x41e1('0x2')]['import'](_0x41e1('0x3d'));db[_0x41e1('0x3e')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x3f'));db[_0x41e1('0x40')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x41'));db[_0x41e1('0x42')]=db['sequelize']['import'](_0x41e1('0x43'));db[_0x41e1('0x44')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x45'));db[_0x41e1('0x46')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x41e1('0x2')]['import']('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db[_0x41e1('0x2')]['import'](_0x41e1('0x47'));db['DashboardItem']=db[_0x41e1('0x2')]['import']('../api/dashboardItem/dashboardItem.model');db[_0x41e1('0x48')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x49'));db['FaxApplication']=db['sequelize'][_0x41e1('0x14')]('../api/faxApplication/faxApplication.model');db[_0x41e1('0x4a')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x4b'));db[_0x41e1('0x4c')]=db['sequelize']['import']('../api/faxMessage/faxMessage.model');db[_0x41e1('0x4d')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/faxQueue/faxQueue.model');db[_0x41e1('0x4e')]=db['sequelize'][_0x41e1('0x14')]('../api/faxQueueReport/faxQueueReport.model');db[_0x41e1('0x4f')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x50'));db[_0x41e1('0x51')]=db['sequelize']['import']('../api/smsApplication/smsApplication.model');db[_0x41e1('0x52')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x53'));db[_0x41e1('0x54')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x55'));db[_0x41e1('0x56')]=db['sequelize']['import']('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x41e1('0x2')]['import'](_0x41e1('0x57'));db[_0x41e1('0x58')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x59'));db[_0x41e1('0x5a')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x5b'));db['OpenchannelMessage']=db[_0x41e1('0x2')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0x41e1('0x5c')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x5d'));db['ChatWebsite']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x5e'));db[_0x41e1('0x5f')]=db[_0x41e1('0x2')]['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x41e1('0x60')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x61'));db[_0x41e1('0x62')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x63'));db[_0x41e1('0x64')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x65'));db[_0x41e1('0x66')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x67'));db[_0x41e1('0x68')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x69'));db[_0x41e1('0x6a')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/chatProactiveAction/chatProactiveAction.model');db[_0x41e1('0x6b')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x6c'));db['CmContact']=db[_0x41e1('0x2')]['import'](_0x41e1('0x6d'));db[_0x41e1('0x6e')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x6f'));db[_0x41e1('0x70')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x71'));db[_0x41e1('0x72')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x41e1('0x73')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x74'));db[_0x41e1('0x75')]=db['sequelize']['import'](_0x41e1('0x76'));db['CmCustomField']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x77'));db['Action']=db['sequelize'][_0x41e1('0x14')]('../api/action/action.model');db['Automation']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x78'));db['CannedAnswer']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x79'));db[_0x41e1('0x7a')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x7b'));db[_0x41e1('0x7c')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x7d'));db[_0x41e1('0x7e')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x7f'));db[_0x41e1('0x80')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x81'));db[_0x41e1('0x82')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/cdr/cdr.model');db[_0x41e1('0x83')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x84'));db[_0x41e1('0x85')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x86'));db['Sound']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x87'));db[_0x41e1('0x88')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x89'));db[_0x41e1('0x8a')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x8b'));db[_0x41e1('0x8c')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x8d'));db[_0x41e1('0x8e')]=db[_0x41e1('0x2')]['import']('../api/variable/variable.model');db[_0x41e1('0x8f')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x90'));db[_0x41e1('0x91')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x92'));db[_0x41e1('0x93')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x94'));db[_0x41e1('0x95')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x96'));db[_0x41e1('0x97')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x98'));db[_0x41e1('0x99')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/analyticMetric/analyticMetric.model');db[_0x41e1('0x9a')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x9b'));db[_0x41e1('0x9c')]=db[_0x41e1('0x2')]['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0x41e1('0x9d')]=db['sequelize']['import'](_0x41e1('0x9e'));db[_0x41e1('0x9f')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xa0'));db[_0x41e1('0xa1')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/intSalesforceField/intSalesforceField.model');db[_0x41e1('0xa2')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xa3'));db[_0x41e1('0xa4')]=db[_0x41e1('0x2')]['import'](_0x41e1('0xa5'));db[_0x41e1('0xa6')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xa7'));db[_0x41e1('0xa8')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xa9'));db[_0x41e1('0xaa')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0xab'));db[_0x41e1('0xac')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xad'));db[_0x41e1('0xae')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xaf'));db[_0x41e1('0xb0')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x41e1('0xb1')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/intZohoField/intZohoField.model');db[_0x41e1('0xb2')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xb3'));db['ZendeskConfiguration']=db['sequelize'][_0x41e1('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db['ZendeskField']=db['sequelize']['import'](_0x41e1('0xb4'));db[_0x41e1('0xb5')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xb6'));db[_0x41e1('0xb7')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0xb8'));db['FreshdeskField']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xb9'));db[_0x41e1('0xba')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xbb'));db[_0x41e1('0xbc')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0xbd'));db[_0x41e1('0xbe')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xbf'));db['ServicenowAccount']=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0x41e1('0xc0')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xc1'));db[_0x41e1('0xc2')]=db['sequelize']['import'](_0x41e1('0xc3'));db[_0x41e1('0xc4')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0xc5'));db['Dynamics365Configuration']=db['sequelize']['import'](_0x41e1('0xc6'));db['Dynamics365Field']=db['sequelize'][_0x41e1('0x14')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x41e1('0xc7')]=db['sequelize']['import'](_0x41e1('0xc8'));db[_0x41e1('0xc9')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0xca'));db[_0x41e1('0x8f')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x90'));db['Network']=db['sequelize']['import'](_0x41e1('0xcb'));db[_0x41e1('0xcc')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xcd'));db[_0x41e1('0xce')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xcf'));db[_0x41e1('0xd0')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x41e1('0xd1')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x41e1('0xd2')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xd3'));db[_0x41e1('0xd4')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/smsQueueReport/smsQueueReport.model');db[_0x41e1('0xd5')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xd6'));db[_0x41e1('0xd7')]=db[_0x41e1('0x2')]['import'](_0x41e1('0xd8'));db[_0x41e1('0xd9')]=db[_0x41e1('0x2')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0x41e1('0xda')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xdb'));db[_0x41e1('0xdc')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x41e1('0xdd')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xde'));db[_0x41e1('0xdf')]=db[_0x41e1('0x2')]['import'](_0x41e1('0xe0'));db['SquareMessage']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xe1'));db[_0x41e1('0xe2')]=db[_0x41e1('0x2')]['import'](_0x41e1('0xe3'));db[_0x41e1('0xe4')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xe5'));db[_0x41e1('0xe6')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xe7'));db[_0x41e1('0xe8')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xe9'));db[_0x41e1('0xea')]=db[_0x41e1('0x2')]['import'](_0x41e1('0xeb'));db[_0x41e1('0xec')]=db['sequelize'][_0x41e1('0x14')]('../api/plugin/plugin.model');db[_0x41e1('0xed')]=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/mailTransferReport/mailTransferReport.model');db['ChatTransferReport']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xee'));db['FaxTransferReport']=db[_0x41e1('0x2')]['import'](_0x41e1('0xef'));db[_0x41e1('0xf0')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0xf1'));db[_0x41e1('0xf2')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xf3'));db[_0x41e1('0xf4')]=db[_0x41e1('0x2')]['import'](_0x41e1('0xf5'));db['VoicePrefix']=db['sequelize'][_0x41e1('0x14')](_0x41e1('0xf6'));db[_0x41e1('0xf7')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xf8'));db[_0x41e1('0xf9')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xfa'));db['UserProfileResource']=db['sequelize'][_0x41e1('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x41e1('0xfb')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xfc'));db[_0x41e1('0xfd')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xfe'));db['WhatsappApplication']=db[_0x41e1('0x2')][_0x41e1('0x14')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0xff'));db[_0x41e1('0x100')]=db['sequelize'][_0x41e1('0x14')](_0x41e1('0x101'));db['WhatsappQueueReport']=db['sequelize'][_0x41e1('0x14')]('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x41e1('0x102')]=db['sequelize'][_0x41e1('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x41e1('0x103')]=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x104'));db['CloudProvider']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x105'));db[_0x41e1('0x106')]=db[_0x41e1('0x2')]['import'](_0x41e1('0x107'));db['TeamVoiceQueue']=db[_0x41e1('0x2')][_0x41e1('0x14')](_0x41e1('0x108'));db[_0x41e1('0x12')][_0x41e1('0x109')](db[_0x41e1('0x20')],{'as':_0x41e1('0x20'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0x1c')],{'as':'Recordings','foreignKey':'UserId'});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0x10d')],{'as':'VoiceQueuesRt','foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0x17')],{'as':'Extensions','onDelete':'cascade','hooks':!![]});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0x72')],{'as':_0x41e1('0x10e'),'foreignKey':_0x41e1('0x10b')});db['User'][_0x41e1('0x10c')](db[_0x41e1('0x73')],{'as':_0x41e1('0x10f'),'foreignKey':'UserId'});db[_0x41e1('0x12')]['hasMany'](db['ReportAgentPreview'],{'as':_0x41e1('0x75'),'foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0x5a')],{'as':_0x41e1('0x110'),'foreignKey':'UserId'});db[_0x41e1('0x12')]['hasMany'](db[_0x41e1('0x62')],{'as':'ChatInteractions','foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0x52')],{'as':_0x41e1('0x111'),'foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0x4a')],{'as':'FaxInteractions','foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x12')]['hasMany'](db[_0x41e1('0x42')],{'as':_0x41e1('0x112'),'foreignKey':_0x41e1('0x10b')});db['User'][_0x41e1('0x10c')](db[_0x41e1('0x113')],{'as':_0x41e1('0x114'),'foreignKey':'UserId'});db[_0x41e1('0x12')][_0x41e1('0x10c')](db[_0x41e1('0xfb')],{'as':'UserNotifications','foreignKey':_0x41e1('0x115')});db[_0x41e1('0x12')]['belongsTo'](db[_0x41e1('0xf7')],{'as':_0x41e1('0xf7'),'foreignKey':_0x41e1('0x116')});db['User'][_0x41e1('0x117')](db['ChatGroup'],{'as':'Groups','through':_0x41e1('0x118')});db[_0x41e1('0x12')]['belongsToMany'](db[_0x41e1('0x119')],{'as':_0x41e1('0x11a'),'through':_0x41e1('0x11b')});db['User']['belongsToMany'](db['CmList'],{'as':_0x41e1('0x11c'),'through':_0x41e1('0x11d')});db['User'][_0x41e1('0x117')](db[_0x41e1('0xe2')],{'through':_0x41e1('0x11e')});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x42')],{'as':_0x41e1('0x112'),'through':_0x41e1('0x11f')});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x62')],{'as':_0x41e1('0x120'),'through':_0x41e1('0x121')});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x4a')],{'as':_0x41e1('0x122'),'through':_0x41e1('0x123')});db[_0x41e1('0x12')][_0x41e1('0x117')](db['SmsInteraction'],{'as':_0x41e1('0x111'),'through':_0x41e1('0x124')});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x5a')],{'as':_0x41e1('0x110'),'through':'user_has_openchannel_interactions'});db[_0x41e1('0x12')]['belongsToMany'](db[_0x41e1('0x113')],{'as':_0x41e1('0x114'),'through':_0x41e1('0x125')});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x126')],{'as':_0x41e1('0x127'),'through':_0x41e1('0x31'),'required':![]});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x3e')],{'as':_0x41e1('0x128'),'through':_0x41e1('0x34'),'required':![]});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x68')],{'as':_0x41e1('0x129'),'through':_0x41e1('0x32'),'required':![],'hooks':!![]});db[_0x41e1('0x12')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':_0x41e1('0x12a'),'required':![]});db['User']['belongsToMany'](db[_0x41e1('0x56')],{'as':_0x41e1('0x12b'),'through':_0x41e1('0x12c'),'required':![]});db['User'][_0x41e1('0x117')](db[_0x41e1('0x5c')],{'as':'OpenchannelQueues','through':_0x41e1('0x36'),'required':![]});db[_0x41e1('0x12')]['belongsToMany'](db[_0x41e1('0x103')],{'as':_0x41e1('0x12d'),'through':_0x41e1('0x38'),'required':![]});db[_0x41e1('0x12')]['belongsToMany'](db['CmList'],{'through':'cm_user_has_lists'});db[_0x41e1('0x12')]['belongsToMany'](db[_0x41e1('0x12e')],{'as':'VoicePrefixes','through':_0x41e1('0x12f'),'required':![]});db[_0x41e1('0x12')][_0x41e1('0x117')](db['ChatWebsite'],{'as':_0x41e1('0x130'),'through':_0x41e1('0x131')});db['User']['belongsToMany'](db[_0x41e1('0x48')],{'as':_0x41e1('0x132'),'through':'user_has_fax_accounts'});db[_0x41e1('0x12')][_0x41e1('0x117')](db[_0x41e1('0x133')],{'as':'MailAccounts','through':_0x41e1('0x134')});db['User'][_0x41e1('0x117')](db[_0x41e1('0x135')],{'as':_0x41e1('0x136'),'through':_0x41e1('0x137')});db['User']['belongsToMany'](db[_0x41e1('0x4f')],{'as':'SmsAccounts','through':_0x41e1('0x138')});db[_0x41e1('0x12')]['belongsToMany'](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x41e1('0x139')});db['User'][_0x41e1('0x117')](db[_0x41e1('0xdd')],{'as':_0x41e1('0x13a'),'through':_0x41e1('0x13b')});db[_0x41e1('0x13')][_0x41e1('0x10c')](db[_0x41e1('0x17')],{'as':_0x41e1('0x13c'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x13d')});db[_0x41e1('0x16')][_0x41e1('0x10c')](db['VoiceExtension'],{'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x17')][_0x41e1('0x10c')](db['VoiceExtension'],{'as':'Applications','onDelete':_0x41e1('0x10a')});db[_0x41e1('0x19')]['belongsToMany'](db[_0x41e1('0x13e')],{'as':_0x41e1('0x13f'),'through':_0x41e1('0x140')});db['VoiceQueue'][_0x41e1('0x10c')](db[_0x41e1('0x10d')],{'as':_0x41e1('0x141'),'foreignKey':_0x41e1('0x142')});db[_0x41e1('0x126')][_0x41e1('0x10c')](db[_0x41e1('0x6e')],{'as':'Hoppers','foreignKey':_0x41e1('0x142')});db[_0x41e1('0x126')]['hasMany'](db[_0x41e1('0x72')],{'as':'HopperFinals','foreignKey':_0x41e1('0x142')});db['VoiceQueue'][_0x41e1('0x10c')](db[_0x41e1('0x73')],{'as':_0x41e1('0x143'),'foreignKey':_0x41e1('0x142')});db[_0x41e1('0x126')][_0x41e1('0x10c')](db['ReportAgentPreview'],{'as':_0x41e1('0x75'),'foreignKey':_0x41e1('0x142')});db[_0x41e1('0x126')][_0x41e1('0x10c')](db[_0x41e1('0x70')],{'as':_0x41e1('0x144'),'foreignKey':'VoiceQueueId'});db[_0x41e1('0x126')][_0x41e1('0x10c')](db['JscriptySessionReport'],{'as':_0x41e1('0x145'),'foreignKey':_0x41e1('0x142')});db[_0x41e1('0x126')]['belongsTo'](db[_0x41e1('0x2e')],{'as':_0x41e1('0x2e'),'foreignKey':_0x41e1('0x146')});db[_0x41e1('0x126')]['belongsTo'](db[_0x41e1('0x2e')],{'as':_0x41e1('0x147'),'foreignKey':'TrunkBackupId'});db[_0x41e1('0x126')]['belongsTo'](db['Interval'],{'as':_0x41e1('0x7e'),'foreignKey':_0x41e1('0x148')});db[_0x41e1('0x126')][_0x41e1('0x149')](db[_0x41e1('0x80')],{'as':_0x41e1('0x14a'),'foreignKey':_0x41e1('0x14b')});db[_0x41e1('0x126')][_0x41e1('0x117')](db[_0x41e1('0xf4')],{'as':'Lists','through':_0x41e1('0x14c')});db[_0x41e1('0x126')][_0x41e1('0x117')](db['User'],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x31')});db[_0x41e1('0x126')][_0x41e1('0x117')](db['Team'],{'as':_0x41e1('0x14e'),'through':'TeamVoiceQueue'});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x41e1('0x14f'),'through':'voice_queues_has_cm_blacklists'});db[_0x41e1('0x1c')][_0x41e1('0x149')](db['User'],{'as':'User','foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x1e')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x12'),'foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x20')][_0x41e1('0x10c')](db[_0x41e1('0x22')],{'as':_0x41e1('0x150'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x151'),'sourceKey':_0x41e1('0x152')});db['VoiceMailMessage']['belongsTo'](db['VoiceMail'],{'foreignKey':_0x41e1('0x151'),'targetKey':_0x41e1('0x152')});db[_0x41e1('0x24')]['hasMany'](db[_0x41e1('0x2a')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x41e1('0x24')]['hasMany'](db[_0x41e1('0x28')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0x41e1('0x24')][_0x41e1('0x149')](db['User'],{'as':'User','foreignKey':'UserId'});db['VoiceCallReport']['belongsTo'](db['CmContact'],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x39')][_0x41e1('0x149')](db['MailAccount'],{'as':_0x41e1('0x133'),'foreignKey':_0x41e1('0x155')});db[_0x41e1('0x3b')][_0x41e1('0x149')](db['MailAccount'],{'as':_0x41e1('0x133'),'foreignKey':_0x41e1('0x155')});db[_0x41e1('0x133')]['hasOne'](db[_0x41e1('0x39')],{'as':_0x41e1('0x156'),'onDelete':'cascade'});db['MailAccount'][_0x41e1('0x109')](db[_0x41e1('0x3b')],{'as':_0x41e1('0x157'),'onDelete':'cascade'});db[_0x41e1('0x133')][_0x41e1('0x10c')](db[_0x41e1('0x7a')],{'as':_0x41e1('0x158'),'foreignKey':_0x41e1('0x155'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x133')][_0x41e1('0x10c')](db[_0x41e1('0x159')],{'as':_0x41e1('0x15a'),'foreignKey':_0x41e1('0x155')});db[_0x41e1('0x133')][_0x41e1('0x10c')](db[_0x41e1('0x44')],{'as':_0x41e1('0x150'),'foreignKey':_0x41e1('0x155')});db[_0x41e1('0x133')][_0x41e1('0x10c')](db[_0x41e1('0x42')],{'as':_0x41e1('0x15b')});db['MailAccount']['hasMany'](db['MailApplication'],{'as':_0x41e1('0x15c')});db[_0x41e1('0x133')][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':'List','foreignKey':_0x41e1('0x15d')});db[_0x41e1('0x133')][_0x41e1('0x149')](db[_0x41e1('0x8a')],{'as':_0x41e1('0x8a'),'foreignKey':_0x41e1('0x15e')});db['MailAccount']['belongsTo'](db['Pause'],{'as':_0x41e1('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x134')});db[_0x41e1('0x3e')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x34')});db[_0x41e1('0x3e')][_0x41e1('0x117')](db[_0x41e1('0xe2')],{'through':_0x41e1('0x15f'),'as':_0x41e1('0x14e')});db[_0x41e1('0x42')][_0x41e1('0x10c')](db[_0x41e1('0x44')],{'as':_0x41e1('0x150'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x160')});db['MailInteraction'][_0x41e1('0x149')](db[_0x41e1('0x133')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x155')});db[_0x41e1('0x42')][_0x41e1('0x149')](db['CmContact'],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x42')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':'Owner','foreignKey':_0x41e1('0x10b')});db['MailInteraction'][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':'mail_interaction_has_tags','as':_0x41e1('0x162')});db[_0x41e1('0x42')][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x163'),'as':_0x41e1('0x164')});db['MailInteraction'][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x165'),'through':'user_has_mail_interactions','foreignKey':'MailInteractionId'});db[_0x41e1('0x44')][_0x41e1('0x10c')](db[_0x41e1('0xea')],{'as':_0x41e1('0x166'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x44')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x12')});db[_0x41e1('0x44')]['belongsTo'](db['CmContact'],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x153')});db['MailMessage'][_0x41e1('0x149')](db['MailInteraction'],{'as':_0x41e1('0x167'),'foreignKey':_0x41e1('0x160')});db[_0x41e1('0x44')]['belongsTo'](db[_0x41e1('0x133')],{'as':'Account','foreignKey':_0x41e1('0x155')});db[_0x41e1('0x44')]['belongsTo'](db['ChatWebsite'],{'as':_0x41e1('0x168'),'foreignKey':_0x41e1('0x169')});db['MailMessage']['belongsTo'](db[_0x41e1('0x66')],{'as':_0x41e1('0x66'),'foreignKey':_0x41e1('0x16a')});db[_0x41e1('0x46')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x46')][_0x41e1('0x149')](db[_0x41e1('0x3e')],{'onDelete':_0x41e1('0x16b')});db['MailApplication'][_0x41e1('0x149')](db[_0x41e1('0x133')],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x46')][_0x41e1('0x149')](db[_0x41e1('0x7e')],{'onDelete':'restrict','foreignKey':_0x41e1('0x148')});db['MailApplication'][_0x41e1('0x149')](db[_0x41e1('0x88')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x41e1('0x16c')]['belongsTo'](db[_0x41e1('0x133')],{});db[_0x41e1('0x16c')][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0x16c')][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x16c')]['belongsTo'](db[_0x41e1('0x42')],{});db[_0x41e1('0x16c')][_0x41e1('0x149')](db['MailMessage'],{});db[_0x41e1('0x16c')][_0x41e1('0x149')](db['User'],{});db[_0x41e1('0x16c')][_0x41e1('0x149')](db[_0x41e1('0x3e')],{});db[_0x41e1('0x16e')][_0x41e1('0x10c')](db['DashboardItem'],{'as':_0x41e1('0x16f'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x48')][_0x41e1('0x10c')](db[_0x41e1('0x7a')],{'as':_0x41e1('0x158'),'foreignKey':_0x41e1('0x170'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x48')]['hasMany'](db['CannedAnswer'],{'as':_0x41e1('0x15a'),'foreignKey':_0x41e1('0x170')});db[_0x41e1('0x48')][_0x41e1('0x10c')](db[_0x41e1('0x4a')],{'as':_0x41e1('0x15b')});db[_0x41e1('0x48')]['hasMany'](db[_0x41e1('0x171')],{'as':_0x41e1('0x15c')});db[_0x41e1('0x48')][_0x41e1('0x10c')](db[_0x41e1('0x17')],{'as':_0x41e1('0x172'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x48')][_0x41e1('0x10c')](db[_0x41e1('0x4c')],{'as':_0x41e1('0x150')});db['FaxAccount'][_0x41e1('0x149')](db[_0x41e1('0x2e')],{'as':_0x41e1('0x2e')});db[_0x41e1('0x48')]['belongsTo'](db[_0x41e1('0xf4')],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0x48')][_0x41e1('0x149')](db[_0x41e1('0x80')],{'as':_0x41e1('0x14a'),'foreignKey':_0x41e1('0x14b')});db[_0x41e1('0x48')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':'user_has_fax_accounts'});db[_0x41e1('0x171')]['belongsTo'](db[_0x41e1('0x12')],{'onDelete':_0x41e1('0x16b')});db['FaxApplication'][_0x41e1('0x149')](db[_0x41e1('0x4d')],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x171')][_0x41e1('0x149')](db[_0x41e1('0x48')],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x171')][_0x41e1('0x149')](db[_0x41e1('0x88')],{'onDelete':_0x41e1('0x16b'),'foreignKey':_0x41e1('0x173')});db['FaxInteraction'][_0x41e1('0x10c')](db[_0x41e1('0x4c')],{'as':_0x41e1('0x150'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x174')});db[_0x41e1('0x4a')][_0x41e1('0x149')](db[_0x41e1('0x48')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x170')});db[_0x41e1('0x4a')][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db['FaxInteraction'][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x175'),'foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x4a')][_0x41e1('0x117')](db['Tag'],{'through':_0x41e1('0x176'),'as':'Tags'});db[_0x41e1('0x4a')][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x176'),'as':_0x41e1('0x164')});db[_0x41e1('0x4a')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x165'),'through':_0x41e1('0x123'),'foreignKey':_0x41e1('0x174')});db[_0x41e1('0x4c')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x12')});db[_0x41e1('0x4c')][_0x41e1('0x149')](db[_0x41e1('0x4a')],{'as':_0x41e1('0x167'),'foreignKey':_0x41e1('0x174')});db[_0x41e1('0x4c')]['belongsTo'](db[_0x41e1('0x119')],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x153')});db[_0x41e1('0x4c')][_0x41e1('0x149')](db[_0x41e1('0xea')],{'as':_0x41e1('0xea'),'foreignKey':'AttachmentId'});db[_0x41e1('0x4c')][_0x41e1('0x149')](db['FaxAccount'],{'as':'Account','foreignKey':'FaxAccountId'});db[_0x41e1('0x4d')][_0x41e1('0x117')](db['User'],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x12a')});db[_0x41e1('0x4d')]['belongsToMany'](db[_0x41e1('0xe2')],{'through':_0x41e1('0x177'),'as':_0x41e1('0x14e')});db[_0x41e1('0x4e')][_0x41e1('0x149')](db[_0x41e1('0x48')],{});db[_0x41e1('0x4e')][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d')});db['FaxQueueReport'][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db['FaxQueueReport']['belongsTo'](db[_0x41e1('0x4a')],{});db['FaxQueueReport'][_0x41e1('0x149')](db['FaxMessage'],{});db[_0x41e1('0x4e')]['belongsTo'](db[_0x41e1('0x12')],{});db[_0x41e1('0x4e')]['belongsTo'](db[_0x41e1('0x4d')],{});db[_0x41e1('0x4f')]['hasMany'](db[_0x41e1('0x7a')],{'as':_0x41e1('0x158'),'foreignKey':_0x41e1('0x178'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x4f')][_0x41e1('0x10c')](db[_0x41e1('0x159')],{'as':_0x41e1('0x15a'),'foreignKey':_0x41e1('0x178')});db[_0x41e1('0x4f')][_0x41e1('0x10c')](db[_0x41e1('0x54')],{'as':_0x41e1('0x150'),'foreignKey':_0x41e1('0x178')});db['SmsAccount'][_0x41e1('0x10c')](db[_0x41e1('0x52')],{'as':_0x41e1('0x15b')});db[_0x41e1('0x4f')]['hasMany'](db[_0x41e1('0x51')],{'as':_0x41e1('0x15c')});db['SmsAccount'][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':'List','foreignKey':_0x41e1('0x15d')});db['SmsAccount'][_0x41e1('0x149')](db['Pause'],{'as':_0x41e1('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x41e1('0x4f')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x138')});db['SmsApplication']['belongsTo'](db['User'],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x51')][_0x41e1('0x149')](db['SmsQueue'],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x51')][_0x41e1('0x149')](db[_0x41e1('0x4f')],{'onDelete':'restrict'});db[_0x41e1('0x51')][_0x41e1('0x149')](db[_0x41e1('0x7e')],{'onDelete':_0x41e1('0x16b'),'foreignKey':_0x41e1('0x148')});db[_0x41e1('0x51')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x41e1('0x173')});db[_0x41e1('0x52')][_0x41e1('0x10c')](db[_0x41e1('0x54')],{'as':'Messages','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x179')});db[_0x41e1('0x52')][_0x41e1('0x149')](db[_0x41e1('0x4f')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x178')});db[_0x41e1('0x52')][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':'ContactId'});db[_0x41e1('0x52')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x175'),'foreignKey':_0x41e1('0x10b')});db['SmsInteraction'][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x17a'),'as':'Tags'});db['SmsInteraction'][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x17a'),'as':_0x41e1('0x164')});db[_0x41e1('0x52')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x165'),'through':_0x41e1('0x124'),'foreignKey':_0x41e1('0x179')});db[_0x41e1('0x54')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x12')});db[_0x41e1('0x54')]['belongsTo'](db[_0x41e1('0x119')],{'onDelete':_0x41e1('0x10a'),'as':'Contact'});db['SmsMessage'][_0x41e1('0x149')](db['SmsInteraction'],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x167'),'foreignKey':'SmsInteractionId'});db[_0x41e1('0x54')][_0x41e1('0x149')](db[_0x41e1('0x4f')],{'as':_0x41e1('0x161'),'foreignKey':'SmsAccountId'});db[_0x41e1('0x56')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x41e1('0x17b')});db[_0x41e1('0x56')]['belongsToMany'](db[_0x41e1('0xe2')],{'through':_0x41e1('0x17c'),'as':_0x41e1('0x14e')});db['OpenchannelAccount'][_0x41e1('0x10c')](db[_0x41e1('0x7a')],{'as':'Dispositions','foreignKey':_0x41e1('0x17d'),'onDelete':'cascade'});db[_0x41e1('0x135')][_0x41e1('0x10c')](db[_0x41e1('0x159')],{'as':_0x41e1('0x15a'),'foreignKey':_0x41e1('0x17d')});db[_0x41e1('0x135')][_0x41e1('0x10c')](db['OpenchannelInteraction'],{'as':_0x41e1('0x15b'),'foreignKey':_0x41e1('0x17d')});db[_0x41e1('0x135')][_0x41e1('0x10c')](db['OpenchannelMessage'],{'as':'Messages','foreignKey':_0x41e1('0x17d')});db[_0x41e1('0x135')][_0x41e1('0x10c')](db[_0x41e1('0x58')],{'as':'Applications','foreignKey':_0x41e1('0x17d')});db[_0x41e1('0x135')]['belongsTo'](db[_0x41e1('0xf4')],{'as':'List','foreignKey':'ListId'});db[_0x41e1('0x135')][_0x41e1('0x149')](db[_0x41e1('0x80')],{'as':_0x41e1('0x14a'),'foreignKey':_0x41e1('0x14b')});db[_0x41e1('0x135')]['belongsToMany'](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':'user_has_openchannel_accounts'});db[_0x41e1('0x58')][_0x41e1('0x149')](db['User'],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x58')][_0x41e1('0x149')](db[_0x41e1('0x5c')],{'onDelete':'restrict','foreignKey':_0x41e1('0x17e')});db[_0x41e1('0x58')][_0x41e1('0x149')](db[_0x41e1('0x135')],{'onDelete':_0x41e1('0x16b'),'foreignKey':_0x41e1('0x17d')});db['OpenchannelApplication'][_0x41e1('0x149')](db[_0x41e1('0x7e')],{'onDelete':'restrict','foreignKey':_0x41e1('0x148')});db['OpenchannelApplication']['belongsTo'](db[_0x41e1('0x88')],{'onDelete':_0x41e1('0x16b'),'foreignKey':_0x41e1('0x173')});db[_0x41e1('0x5a')][_0x41e1('0x10c')](db[_0x41e1('0x17f')],{'as':'Messages','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x180')});db[_0x41e1('0x5a')][_0x41e1('0x149')](db[_0x41e1('0x135')],{'as':'Account','foreignKey':_0x41e1('0x17d')});db[_0x41e1('0x5a')]['belongsTo'](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x5a')][_0x41e1('0x149')](db['User'],{'as':_0x41e1('0x175'),'foreignKey':'UserId'});db[_0x41e1('0x5a')][_0x41e1('0x117')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'Tags'});db['OpenchannelInteraction']['belongsToMany'](db['Tag'],{'through':_0x41e1('0x181'),'as':_0x41e1('0x164')});db[_0x41e1('0x5a')]['belongsToMany'](db[_0x41e1('0x12')],{'as':'Users','through':_0x41e1('0x182'),'foreignKey':_0x41e1('0x180')});db[_0x41e1('0x17f')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'onDelete':_0x41e1('0x10a'),'as':'User'});db[_0x41e1('0x17f')][_0x41e1('0x149')](db[_0x41e1('0x119')],{'onDelete':'cascade','as':_0x41e1('0x153')});db[_0x41e1('0x17f')][_0x41e1('0x149')](db[_0x41e1('0x5a')],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x167'),'foreignKey':_0x41e1('0x180')});db[_0x41e1('0x17f')][_0x41e1('0x149')](db[_0x41e1('0xea')],{'as':'Attachment','foreignKey':_0x41e1('0x183')});db[_0x41e1('0x17f')]['belongsTo'](db[_0x41e1('0x135')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x17d')});db[_0x41e1('0x5c')]['belongsToMany'](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x36'),'foreignKey':_0x41e1('0x17e')});db[_0x41e1('0x5c')][_0x41e1('0x117')](db[_0x41e1('0xe2')],{'through':'team_has_openchannel_queues','as':_0x41e1('0x14e')});db[_0x41e1('0x168')][_0x41e1('0x10c')](db[_0x41e1('0x7a')],{'as':_0x41e1('0x158'),'foreignKey':_0x41e1('0x169'),'onDelete':'cascade'});db['ChatWebsite'][_0x41e1('0x10c')](db[_0x41e1('0x159')],{'as':_0x41e1('0x15a'),'foreignKey':_0x41e1('0x169')});db[_0x41e1('0x168')][_0x41e1('0x10c')](db[_0x41e1('0x6a')],{'as':_0x41e1('0x184')});db['ChatWebsite'][_0x41e1('0x10c')](db[_0x41e1('0x62')],{'as':_0x41e1('0x15b')});db[_0x41e1('0x168')][_0x41e1('0x10c')](db[_0x41e1('0x60')],{'as':_0x41e1('0x15c')});db[_0x41e1('0x168')][_0x41e1('0x10c')](db['ChatMessage'],{'as':_0x41e1('0x150')});db[_0x41e1('0x168')][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0x168')][_0x41e1('0x149')](db[_0x41e1('0x7e')],{'as':_0x41e1('0x7e'),'foreignKey':'IntervalId'});db[_0x41e1('0x168')][_0x41e1('0x149')](db[_0x41e1('0x133')],{'as':_0x41e1('0x133'),'foreignKey':'MailAccountId'});db[_0x41e1('0x168')][_0x41e1('0x149')](db[_0x41e1('0x80')],{'as':_0x41e1('0x14a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x41e1('0x168')][_0x41e1('0x117')](db['User'],{'as':'Agents','through':_0x41e1('0x131')});db[_0x41e1('0x5f')][_0x41e1('0x149')](db[_0x41e1('0x135')],{});db[_0x41e1('0x5f')]['belongsTo'](db[_0x41e1('0xf4')],{'as':'List','foreignKey':'ListId'});db['OpenchannelQueueReport'][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x5f')]['belongsTo'](db[_0x41e1('0x5a')],{});db[_0x41e1('0x5f')][_0x41e1('0x149')](db['OpenchannelMessage'],{});db[_0x41e1('0x5f')]['belongsTo'](db[_0x41e1('0x12')],{});db[_0x41e1('0x5f')][_0x41e1('0x149')](db[_0x41e1('0x5c')],{});db[_0x41e1('0x60')]['belongsTo'](db[_0x41e1('0x12')],{'as':_0x41e1('0x185'),'foreignKey':_0x41e1('0x10b'),'onDelete':'restrict'});db['ChatApplication'][_0x41e1('0x149')](db[_0x41e1('0x68')],{'as':_0x41e1('0x186'),'foreignKey':_0x41e1('0x187'),'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x60')][_0x41e1('0x149')](db[_0x41e1('0x168')],{'as':_0x41e1('0x188'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db[_0x41e1('0x60')][_0x41e1('0x149')](db['Tag'],{'onDelete':_0x41e1('0x16b'),'foreignKey':_0x41e1('0x173')});db['ChatInteraction'][_0x41e1('0x10c')](db[_0x41e1('0x64')],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x41e1('0x62')][_0x41e1('0x149')](db[_0x41e1('0x168')],{'as':_0x41e1('0x161'),'foreignKey':'ChatWebsiteId'});db[_0x41e1('0x62')][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':'Contact','foreignKey':_0x41e1('0x154')});db[_0x41e1('0x62')][_0x41e1('0x149')](db['User'],{'as':_0x41e1('0x175'),'foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x62')][_0x41e1('0x117')](db['Tag'],{'through':_0x41e1('0x189'),'as':_0x41e1('0x162')});db['ChatInteraction'][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x189'),'as':'ThroughTags'});db['ChatInteraction'][_0x41e1('0x117')](db['User'],{'as':_0x41e1('0x165'),'through':_0x41e1('0x121'),'foreignKey':_0x41e1('0x18a')});db[_0x41e1('0x64')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x12')});db[_0x41e1('0x64')][_0x41e1('0x149')](db[_0x41e1('0x119')],{'onDelete':'cascade','as':_0x41e1('0x153'),'foreignKey':'ContactId'});db[_0x41e1('0x64')][_0x41e1('0x149')](db[_0x41e1('0x62')],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x167'),'foreignKey':_0x41e1('0x18a')});db[_0x41e1('0x64')][_0x41e1('0x149')](db['Attachment'],{'as':_0x41e1('0xea'),'foreignKey':_0x41e1('0x183')});db[_0x41e1('0x64')][_0x41e1('0x149')](db[_0x41e1('0x168')],{'as':_0x41e1('0x161'),'foreignKey':'ChatWebsiteId'});db['ChatOfflineMessage']['hasMany'](db['Attachment'],{'as':_0x41e1('0x166'),'foreignKey':'ChatOfflineMessageId','onDelete':_0x41e1('0x10a'),'hooks':!![]});db[_0x41e1('0x66')]['belongsTo'](db[_0x41e1('0x119')],{'onDelete':_0x41e1('0x10a'),'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db['ChatOfflineMessage'][_0x41e1('0x149')](db['ChatWebsite'],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x169')});db[_0x41e1('0x68')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x32'),'hooks':!![]});db[_0x41e1('0x68')]['belongsToMany'](db[_0x41e1('0xe2')],{'through':'team_has_chat_queues','as':'Teams'});db[_0x41e1('0x18b')][_0x41e1('0x10c')](db[_0x41e1('0xce')],{'as':'Messages','foreignKey':_0x41e1('0x18c'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x18b')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':'Members','through':_0x41e1('0x118')});db['ChatProactiveAction'][_0x41e1('0x149')](db[_0x41e1('0x168')],{'as':_0x41e1('0x188'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x41e1('0x10c')](db[_0x41e1('0x119')],{'as':_0x41e1('0x11a'),'foreignKey':_0x41e1('0x18d')});db['CmContact']['hasMany'](db['CmHopper'],{'as':_0x41e1('0x18e'),'foreignKey':_0x41e1('0x154')});db['CmContact'][_0x41e1('0x10c')](db[_0x41e1('0x72')],{'as':_0x41e1('0x10e'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x119')][_0x41e1('0x10c')](db[_0x41e1('0x73')],{'as':_0x41e1('0x143'),'foreignKey':_0x41e1('0x154')});db['CmContact'][_0x41e1('0x10c')](db['ReportAgentPreview'],{'as':_0x41e1('0x75'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x119')][_0x41e1('0x10c')](db[_0x41e1('0xd2')],{'as':_0x41e1('0x145'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x119')][_0x41e1('0x10c')](db[_0x41e1('0x5a')],{'as':_0x41e1('0x110'),'foreignKey':_0x41e1('0x154'),'onDelete':_0x41e1('0x16b')});db['CmContact']['hasMany'](db[_0x41e1('0x62')],{'as':_0x41e1('0x120'),'foreignKey':_0x41e1('0x154'),'onDelete':'restrict'});db[_0x41e1('0x119')][_0x41e1('0x10c')](db[_0x41e1('0x52')],{'as':_0x41e1('0x111'),'foreignKey':'ContactId','onDelete':_0x41e1('0x16b')});db[_0x41e1('0x119')][_0x41e1('0x10c')](db[_0x41e1('0x4a')],{'as':'FaxInteractions','foreignKey':_0x41e1('0x154'),'onDelete':_0x41e1('0x16b')});db['CmContact'][_0x41e1('0x10c')](db[_0x41e1('0x42')],{'as':_0x41e1('0x112'),'foreignKey':_0x41e1('0x154'),'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x119')][_0x41e1('0x149')](db[_0x41e1('0x6b')],{'as':_0x41e1('0x18f'),'foreignKey':_0x41e1('0x18d')});db[_0x41e1('0x119')][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d'),'onDelete':'cascade'});db[_0x41e1('0x119')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x165'),'through':_0x41e1('0x11b')});db[_0x41e1('0x119')][_0x41e1('0x117')](db['Tag'],{'as':_0x41e1('0x162'),'through':_0x41e1('0x190')});db[_0x41e1('0x119')][_0x41e1('0x117')](db['Tag'],{'through':_0x41e1('0x190'),'as':_0x41e1('0x164')});db[_0x41e1('0x6e')]['belongsTo'](db[_0x41e1('0x119')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x41e1('0x10a')});db['CmHopper'][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':'List','foreignKey':_0x41e1('0x15d'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x6e')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x185'),'foreignKey':_0x41e1('0x10b')});db[_0x41e1('0x6e')]['belongsTo'](db[_0x41e1('0x126')],{'as':'Queue','foreignKey':_0x41e1('0x142'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x6e')][_0x41e1('0x149')](db[_0x41e1('0xe6')],{'as':_0x41e1('0xe6'),'foreignKey':_0x41e1('0x191'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x6e')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x175'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154'),'onDelete':'cascade'});db[_0x41e1('0x70')][_0x41e1('0x149')](db['CmList'],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d'),'onDelete':'cascade'});db[_0x41e1('0x70')][_0x41e1('0x149')](db[_0x41e1('0x126')],{'as':_0x41e1('0x186'),'foreignKey':_0x41e1('0x142'),'onDelete':_0x41e1('0x10a')});db['CmHopperBlack'][_0x41e1('0x149')](db['Campaign'],{'as':_0x41e1('0xe6'),'foreignKey':'CampaignId','onDelete':_0x41e1('0x10a')});db['Automation'][_0x41e1('0x10c')](db[_0x41e1('0x7c')],{'as':{'plural':_0x41e1('0x192'),'singular':'OneAll'},'foreignKey':_0x41e1('0x193'),'onDelete':_0x41e1('0x10a'),'hooks':!![]});db[_0x41e1('0x194')][_0x41e1('0x10c')](db[_0x41e1('0x7c')],{'as':{'plural':_0x41e1('0x195'),'singular':_0x41e1('0x196')},'foreignKey':_0x41e1('0x197'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0x41e1('0x10c')](db[_0x41e1('0x198')],{'as':_0x41e1('0x199'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x41e1('0x7a')][_0x41e1('0x10c')](db[_0x41e1('0x7a')],{'as':'Dispositions','foreignKey':_0x41e1('0x19a'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0x7e')]['hasMany'](db[_0x41e1('0x7e')],{'as':_0x41e1('0x19b'),'foreignKey':'IntervalId','onDelete':'cascade','hooks':!![],'required':![]});db[_0x41e1('0x7e')]['hasMany'](db[_0x41e1('0x17')],{'as':_0x41e1('0x19c'),'foreignKey':_0x41e1('0x148'),'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x7e')]['hasMany'](db['MailApplication'],{'as':_0x41e1('0x19d'),'foreignKey':_0x41e1('0x148')});db['Interval'][_0x41e1('0x10c')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':_0x41e1('0x148')});db[_0x41e1('0x7e')][_0x41e1('0x10c')](db[_0x41e1('0x171')],{'as':_0x41e1('0x19e'),'foreignKey':'IntervalId'});db[_0x41e1('0x7e')]['hasMany'](db[_0x41e1('0x51')],{'as':_0x41e1('0x19f'),'foreignKey':'IntervalId'});db[_0x41e1('0x85')][_0x41e1('0x149')](db[_0x41e1('0x133')],{});db[_0x41e1('0x85')][_0x41e1('0x149')](db[_0x41e1('0x95')],{'foreignKey':_0x41e1('0x1a0')});db[_0x41e1('0x85')][_0x41e1('0x149')](db[_0x41e1('0x93')],{'foreignKey':_0x41e1('0x1a1')});db[_0x41e1('0x13e')]['belongsToMany'](db[_0x41e1('0x19')],{'as':_0x41e1('0x1a2'),'through':_0x41e1('0x140'),'onDelete':'restrict'});db[_0x41e1('0x88')][_0x41e1('0x117')](db['CmContact'],{'through':_0x41e1('0x190')});db[_0x41e1('0x88')][_0x41e1('0x117')](db[_0x41e1('0x62')],{'through':_0x41e1('0x189')});db['Tag'][_0x41e1('0x117')](db[_0x41e1('0x42')],{'through':_0x41e1('0x163')});db[_0x41e1('0x88')][_0x41e1('0x117')](db[_0x41e1('0x52')],{'through':_0x41e1('0x17a')});db[_0x41e1('0x88')][_0x41e1('0x117')](db[_0x41e1('0x4a')],{'through':'fax_interaction_has_tags'});db[_0x41e1('0x88')][_0x41e1('0x117')](db[_0x41e1('0x5a')],{'through':_0x41e1('0x181')});db[_0x41e1('0x88')][_0x41e1('0x117')](db['WhatsappInteraction'],{'through':_0x41e1('0x1a3')});db[_0x41e1('0x8c')][_0x41e1('0x10c')](db['Condition'],{'as':{'plural':_0x41e1('0x1a4'),'singular':_0x41e1('0x1a5')},'foreignKey':_0x41e1('0x1a6'),'onDelete':_0x41e1('0x10a'),'hooks':!![]});db[_0x41e1('0x8c')]['hasMany'](db[_0x41e1('0x7c')],{'as':{'plural':_0x41e1('0x1a7'),'singular':_0x41e1('0x1a8')},'foreignKey':_0x41e1('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0x41e1('0x8c')]['hasMany'](db[_0x41e1('0x198')],{'as':_0x41e1('0x199'),'foreignKey':_0x41e1('0x1aa'),'onDelete':_0x41e1('0x10a'),'hooks':!![]});db[_0x41e1('0x93')][_0x41e1('0x10c')](db[_0x41e1('0x9a')],{'as':_0x41e1('0x1ab'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1a1'),'hooks':!![]});db[_0x41e1('0x95')][_0x41e1('0x10c')](db[_0x41e1('0x9a')],{'as':_0x41e1('0x1ab'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1a0')});db[_0x41e1('0x99')][_0x41e1('0x10c')](db[_0x41e1('0x9a')],{'as':_0x41e1('0x1ab'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1ac')});db[_0x41e1('0x9a')][_0x41e1('0x149')](db[_0x41e1('0x99')],{'foreignKey':_0x41e1('0x1ac')});db[_0x41e1('0x9d')][_0x41e1('0x10c')](db[_0x41e1('0x9f')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0x9f')][_0x41e1('0x10c')](db['SalesforceField'],{'as':_0x41e1('0x1ae'),'onDelete':'cascade','foreignKey':_0x41e1('0x1af')});db[_0x41e1('0x9f')][_0x41e1('0x10c')](db[_0x41e1('0xa1')],{'as':_0x41e1('0x1b0'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0x9f')]['hasMany'](db[_0x41e1('0xa1')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0x9f')][_0x41e1('0x149')](db[_0x41e1('0x9d')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xa1')][_0x41e1('0x10c')](db[_0x41e1('0xa1')],{'as':_0x41e1('0x1b3'),'foreignKey':_0x41e1('0x1af')});db['SalesforceField'][_0x41e1('0x10c')](db[_0x41e1('0xa1')],{'as':'Description','foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0xa1')][_0x41e1('0x10c')](db['SalesforceField'],{'as':_0x41e1('0x1b4'),'foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xa1')]['belongsTo'](db[_0x41e1('0x8e')],{'as':'Variable','foreignKey':_0x41e1('0x1b5')});db['SugarcrmAccount'][_0x41e1('0x10c')](db[_0x41e1('0xa4')],{'as':_0x41e1('0x1b6'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xa4')][_0x41e1('0x10c')](db[_0x41e1('0xa6')],{'as':_0x41e1('0x1ae'),'onDelete':'cascade','foreignKey':_0x41e1('0x1af')});db['SugarcrmConfiguration'][_0x41e1('0x10c')](db[_0x41e1('0xa6')],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x41e1('0xa4')][_0x41e1('0x10c')](db[_0x41e1('0xa6')],{'as':_0x41e1('0x1ab'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1b2')});db['SugarcrmConfiguration'][_0x41e1('0x149')](db[_0x41e1('0xa2')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xa6')][_0x41e1('0x10c')](db[_0x41e1('0xa6')],{'as':_0x41e1('0x1b3'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0xa6')]['hasMany'](db[_0x41e1('0xa6')],{'as':'Description','foreignKey':_0x41e1('0x1b1')});db['SugarcrmField'][_0x41e1('0x10c')](db['SugarcrmField'],{'as':'Field','foreignKey':'FieldId'});db[_0x41e1('0xa6')][_0x41e1('0x149')](db[_0x41e1('0x8e')],{'as':_0x41e1('0x8e'),'foreignKey':_0x41e1('0x1b5')});db[_0x41e1('0xa8')][_0x41e1('0x10c')](db[_0x41e1('0xaa')],{'as':_0x41e1('0x1b6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x41e1('0xaa')][_0x41e1('0x10c')](db[_0x41e1('0xac')],{'as':'Subjects','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1af')});db['DeskConfiguration'][_0x41e1('0x10c')](db[_0x41e1('0xac')],{'as':_0x41e1('0x1b0'),'onDelete':'cascade','foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0xaa')]['hasMany'](db[_0x41e1('0xac')],{'as':'Fields','onDelete':_0x41e1('0x10a'),'foreignKey':'FieldId'});db[_0x41e1('0xaa')][_0x41e1('0x149')](db['DeskAccount'],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xaa')][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x1b7')});db[_0x41e1('0xac')]['hasMany'](db[_0x41e1('0xac')],{'as':_0x41e1('0x1b3'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0xac')][_0x41e1('0x10c')](db[_0x41e1('0xac')],{'as':_0x41e1('0x1b8'),'foreignKey':'DescriptionId'});db[_0x41e1('0xac')]['hasMany'](db['DeskField'],{'as':'Field','foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xac')][_0x41e1('0x149')](db[_0x41e1('0x8e')],{'as':_0x41e1('0x8e'),'foreignKey':'VariableId'});db[_0x41e1('0xae')][_0x41e1('0x10c')](db[_0x41e1('0xb0')],{'as':_0x41e1('0x1b6'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xb0')][_0x41e1('0x10c')](db[_0x41e1('0xb1')],{'as':_0x41e1('0x1ae'),'onDelete':'cascade','foreignKey':_0x41e1('0x1af')});db['ZohoConfiguration']['hasMany'](db[_0x41e1('0xb1')],{'as':_0x41e1('0x1b0'),'onDelete':_0x41e1('0x10a'),'foreignKey':'DescriptionId'});db[_0x41e1('0xb0')][_0x41e1('0x10c')](db['ZohoField'],{'as':_0x41e1('0x1ab'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xb0')][_0x41e1('0x149')](db['ZohoAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x41e1('0xb1')][_0x41e1('0x10c')](db[_0x41e1('0xb1')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x41e1('0xb1')][_0x41e1('0x10c')](db[_0x41e1('0xb1')],{'as':_0x41e1('0x1b8'),'foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0xb1')]['hasMany'](db['ZohoField'],{'as':_0x41e1('0x1b4'),'foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xb1')][_0x41e1('0x149')](db[_0x41e1('0x8e')],{'as':'Variable','foreignKey':'VariableId'});db[_0x41e1('0xb2')][_0x41e1('0x10c')](db[_0x41e1('0x1b9')],{'as':'Configurations','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0x1b9')][_0x41e1('0x10c')](db['ZendeskField'],{'as':_0x41e1('0x1ae'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0x1b9')][_0x41e1('0x10c')](db[_0x41e1('0x1ba')],{'as':_0x41e1('0x1b0'),'foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0x1b9')][_0x41e1('0x10c')](db['ZendeskField'],{'as':_0x41e1('0x1ab'),'foreignKey':_0x41e1('0x1b2')});db['ZendeskConfiguration'][_0x41e1('0x149')](db[_0x41e1('0xb2')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0x1b9')][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x1bb')});db[_0x41e1('0x1ba')][_0x41e1('0x10c')](db[_0x41e1('0x1ba')],{'as':_0x41e1('0x1b3'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0x1ba')][_0x41e1('0x10c')](db['ZendeskField'],{'as':'Description','foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0x1ba')][_0x41e1('0x10c')](db['ZendeskField'],{'as':_0x41e1('0x1b4'),'foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0x1ba')][_0x41e1('0x149')](db[_0x41e1('0x8e')],{'as':'Variable','foreignKey':_0x41e1('0x1b5')});db[_0x41e1('0xb5')][_0x41e1('0x10c')](db[_0x41e1('0xb7')],{'as':'Configurations','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xb7')][_0x41e1('0x10c')](db[_0x41e1('0x1bc')],{'as':_0x41e1('0x1ae'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0xb7')][_0x41e1('0x10c')](db[_0x41e1('0x1bc')],{'as':_0x41e1('0x1b0'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1b1')});db['FreshdeskConfiguration'][_0x41e1('0x10c')](db[_0x41e1('0x1bc')],{'as':'Fields','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xb7')][_0x41e1('0x149')](db['FreshdeskAccount'],{'as':'Account','foreignKey':'AccountId'});db[_0x41e1('0xb7')]['belongsToMany'](db[_0x41e1('0x88')],{'through':_0x41e1('0x1bd')});db[_0x41e1('0x1bc')]['hasMany'](db[_0x41e1('0x1bc')],{'as':_0x41e1('0x1b3'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0x1bc')][_0x41e1('0x10c')](db[_0x41e1('0x1bc')],{'as':_0x41e1('0x1b8'),'foreignKey':'DescriptionId'});db[_0x41e1('0x1bc')][_0x41e1('0x10c')](db['FreshdeskField'],{'as':_0x41e1('0x1b4'),'foreignKey':'FieldId'});db[_0x41e1('0x1bc')][_0x41e1('0x149')](db['Variable'],{'as':_0x41e1('0x8e'),'foreignKey':'VariableId'});db[_0x41e1('0xba')]['hasMany'](db[_0x41e1('0xbc')],{'as':_0x41e1('0x1b6'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xbc')][_0x41e1('0x10c')](db[_0x41e1('0xbe')],{'as':_0x41e1('0x1ae'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0xbc')]['hasMany'](db[_0x41e1('0xbe')],{'as':_0x41e1('0x1b0'),'foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0xbc')][_0x41e1('0x10c')](db[_0x41e1('0xbe')],{'as':_0x41e1('0x1ab'),'foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xbc')]['belongsTo'](db[_0x41e1('0xba')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x1ad')});db['VtigerField'][_0x41e1('0x10c')](db['VtigerField'],{'as':'Subject','foreignKey':_0x41e1('0x1af')});db[_0x41e1('0xbe')][_0x41e1('0x10c')](db[_0x41e1('0xbe')],{'as':_0x41e1('0x1b8'),'foreignKey':_0x41e1('0x1b1')});db['VtigerField'][_0x41e1('0x10c')](db[_0x41e1('0xbe')],{'as':'Field','foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xbe')][_0x41e1('0x149')](db['Variable'],{'as':_0x41e1('0x8e'),'foreignKey':_0x41e1('0x1b5')});db[_0x41e1('0x1be')]['hasMany'](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0xc0')]['hasMany'](db['ServicenowField'],{'as':_0x41e1('0x1ae'),'foreignKey':_0x41e1('0x1af')});db[_0x41e1('0xc0')]['hasMany'](db['ServicenowField'],{'as':_0x41e1('0x1b0'),'foreignKey':'DescriptionId'});db[_0x41e1('0xc0')][_0x41e1('0x10c')](db[_0x41e1('0xc2')],{'as':_0x41e1('0x1ab'),'foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0xc0')][_0x41e1('0x149')](db[_0x41e1('0x1be')],{'as':'Account','foreignKey':'AccountId'});db[_0x41e1('0xc2')][_0x41e1('0x10c')](db[_0x41e1('0xc2')],{'as':_0x41e1('0x1b3'),'foreignKey':'SubjectId'});db[_0x41e1('0xc2')][_0x41e1('0x10c')](db[_0x41e1('0xc2')],{'as':_0x41e1('0x1b8'),'foreignKey':_0x41e1('0x1b1')});db['ServicenowField'][_0x41e1('0x10c')](db[_0x41e1('0xc2')],{'as':_0x41e1('0x1b4'),'foreignKey':_0x41e1('0x1b2')});db['ServicenowField']['belongsTo'](db[_0x41e1('0x8e')],{'as':_0x41e1('0x8e'),'foreignKey':'VariableId'});db[_0x41e1('0xc4')]['hasMany'](db[_0x41e1('0x1bf')],{'as':_0x41e1('0x1b6'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x41e1('0x1bf')][_0x41e1('0x10c')](db[_0x41e1('0x1c0')],{'as':'Subjects','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1af')});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0x1bf')][_0x41e1('0x10c')](db[_0x41e1('0x1c0')],{'as':'Fields','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1b2')});db['Dynamics365Configuration'][_0x41e1('0x149')](db[_0x41e1('0xc4')],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0x1c0')][_0x41e1('0x10c')](db[_0x41e1('0x1c0')],{'as':_0x41e1('0x1b3'),'foreignKey':_0x41e1('0x1af')});db['Dynamics365Field']['hasMany'](db[_0x41e1('0x1c0')],{'as':'Description','foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0x1c0')][_0x41e1('0x10c')](db[_0x41e1('0x1c0')],{'as':'Field','foreignKey':_0x41e1('0x1b2')});db[_0x41e1('0x1c0')]['belongsTo'](db[_0x41e1('0x8e')],{'as':_0x41e1('0x8e'),'foreignKey':_0x41e1('0x1b5')});db['FreshsalesAccount'][_0x41e1('0x10c')](db[_0x41e1('0xc9')],{'as':'Configurations','onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1ad')});db['FreshsalesConfiguration'][_0x41e1('0x10c')](db[_0x41e1('0x1c1')],{'as':_0x41e1('0x1ae'),'foreignKey':'SubjectId'});db[_0x41e1('0xc9')][_0x41e1('0x10c')](db[_0x41e1('0x1c1')],{'as':_0x41e1('0x1b0'),'foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0xc9')]['hasMany'](db[_0x41e1('0x1c1')],{'as':'Fields','foreignKey':'FieldId'});db[_0x41e1('0xc9')][_0x41e1('0x149')](db[_0x41e1('0xc7')],{'as':'Account','foreignKey':_0x41e1('0x1ad')});db[_0x41e1('0x1c1')][_0x41e1('0x10c')](db[_0x41e1('0x1c1')],{'as':_0x41e1('0x1b3'),'foreignKey':'SubjectId'});db[_0x41e1('0x1c1')][_0x41e1('0x10c')](db[_0x41e1('0x1c1')],{'as':_0x41e1('0x1b8'),'foreignKey':_0x41e1('0x1b1')});db[_0x41e1('0x1c1')][_0x41e1('0x10c')](db[_0x41e1('0x1c1')],{'as':_0x41e1('0x1b4'),'foreignKey':'FieldId'});db[_0x41e1('0x1c1')][_0x41e1('0x149')](db[_0x41e1('0x8e')],{'as':'Variable','foreignKey':_0x41e1('0x1b5')});db[_0x41e1('0xcc')]['belongsTo'](db[_0x41e1('0x168')],{});db[_0x41e1('0xcc')][_0x41e1('0x149')](db['CmList'],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0xcc')][_0x41e1('0x149')](db['CmContact'],{'as':'Contact','foreignKey':_0x41e1('0x154')});db[_0x41e1('0xcc')][_0x41e1('0x149')](db['ChatInteraction'],{});db[_0x41e1('0xcc')][_0x41e1('0x149')](db[_0x41e1('0x64')],{});db['ChatQueueReport']['belongsTo'](db[_0x41e1('0x12')],{});db[_0x41e1('0xcc')][_0x41e1('0x149')](db[_0x41e1('0x68')],{});db['ChatInternalMessage']['belongsTo'](db['User'],{'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1c2')});db[_0x41e1('0xce')][_0x41e1('0x149')](db['User'],{'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1c3')});db[_0x41e1('0xd2')]['hasMany'](db[_0x41e1('0xd1')],{'foreignKey':_0x41e1('0x1c4'),'onDelete':_0x41e1('0x10a')});db['JscriptySessionReport'][_0x41e1('0x10c')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x41e1('0x10a')});db[_0x41e1('0xd4')][_0x41e1('0x149')](db[_0x41e1('0x4f')],{});db[_0x41e1('0xd4')][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0xd4')][_0x41e1('0x149')](db['CmContact'],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0xd4')][_0x41e1('0x149')](db[_0x41e1('0x52')],{});db[_0x41e1('0xd4')][_0x41e1('0x149')](db[_0x41e1('0x54')],{});db[_0x41e1('0xd4')][_0x41e1('0x149')](db['User'],{});db['SmsQueueReport'][_0x41e1('0x149')](db[_0x41e1('0x56')],{});db[_0x41e1('0xd9')][_0x41e1('0x10c')](db[_0x41e1('0xd2')],{'foreignKey':'ProjectId'});db[_0x41e1('0xd9')][_0x41e1('0x10c')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x41e1('0xd9')][_0x41e1('0x10c')](db[_0x41e1('0xd0')],{'foreignKey':_0x41e1('0x1c5')});db['SquareProject'][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x165'),'through':'user_has_square_projects'});db[_0x41e1('0xe2')]['belongsToMany'](db['User'],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x11e')});db[_0x41e1('0xe2')]['belongsToMany'](db['VoiceQueue'],{'through':_0x41e1('0x1c6'),'as':'VoiceQueues'});db[_0x41e1('0xe2')][_0x41e1('0x117')](db[_0x41e1('0x3e')],{'through':_0x41e1('0x15f'),'as':_0x41e1('0x128')});db[_0x41e1('0xe2')][_0x41e1('0x117')](db[_0x41e1('0x68')],{'through':_0x41e1('0x1c7'),'as':_0x41e1('0x129')});db[_0x41e1('0xe2')]['belongsToMany'](db['FaxQueue'],{'through':'team_has_fax_queues','as':_0x41e1('0x1c8')});db['Team'][_0x41e1('0x117')](db['SmsQueue'],{'through':'team_has_sms_queues','as':_0x41e1('0x12b')});db[_0x41e1('0xe2')][_0x41e1('0x117')](db[_0x41e1('0x5c')],{'through':_0x41e1('0x1c9'),'as':_0x41e1('0x1ca')});db['Team'][_0x41e1('0x117')](db[_0x41e1('0x103')],{'through':_0x41e1('0x1cb'),'as':_0x41e1('0x12d')});db[_0x41e1('0xe6')][_0x41e1('0x10c')](db[_0x41e1('0x6e')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0x41e1('0xe6')][_0x41e1('0x10c')](db[_0x41e1('0x72')],{'as':'HopperFinals','foreignKey':_0x41e1('0x191')});db[_0x41e1('0xe6')][_0x41e1('0x10c')](db[_0x41e1('0x73')],{'as':_0x41e1('0x143'),'foreignKey':_0x41e1('0x191')});db[_0x41e1('0xe6')][_0x41e1('0x10c')](db[_0x41e1('0x70')],{'as':_0x41e1('0x144'),'foreignKey':'CampaignId'});db[_0x41e1('0xe6')][_0x41e1('0x149')](db[_0x41e1('0x2e')],{'as':'Trunk','foreignKey':_0x41e1('0x146')});db[_0x41e1('0xe6')]['belongsTo'](db[_0x41e1('0x2e')],{'as':_0x41e1('0x147'),'foreignKey':_0x41e1('0x1cc')});db[_0x41e1('0xe6')][_0x41e1('0x149')](db[_0x41e1('0x7e')],{'as':'Interval','foreignKey':_0x41e1('0x148')});db[_0x41e1('0xe6')][_0x41e1('0x149')](db[_0x41e1('0xdd')],{'as':_0x41e1('0xdd'),'foreignKey':_0x41e1('0x1cd')});db['Campaign'][_0x41e1('0x117')](db[_0x41e1('0xf4')],{'as':_0x41e1('0x11c'),'through':_0x41e1('0x1ce')});db[_0x41e1('0xe6')][_0x41e1('0x117')](db['CmList'],{'as':'BlackLists','through':_0x41e1('0x1cf')});db[_0x41e1('0xea')][_0x41e1('0x149')](db[_0x41e1('0x66')],{'as':_0x41e1('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x41e1('0xed')]['belongsTo'](db[_0x41e1('0x44')],{});db['MailTransferReport'][_0x41e1('0x149')](db[_0x41e1('0x42')],{});db['MailTransferReport'][_0x41e1('0x149')](db['MailAccount'],{'foreignKey':_0x41e1('0x1d0'),'as':_0x41e1('0x1d1')});db['MailTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x41e1('0x1d2'),'as':_0x41e1('0x1d3')});db['MailTransferReport'][_0x41e1('0x149')](db[_0x41e1('0x12')],{'foreignKey':_0x41e1('0x1d4'),'as':'ToAgent'});db[_0x41e1('0xed')][_0x41e1('0x149')](db[_0x41e1('0x3e')],{'foreignKey':_0x41e1('0x1d5'),'as':_0x41e1('0x1d6')});db['MailTransferReport'][_0x41e1('0x149')](db[_0x41e1('0x133')],{'foreignKey':_0x41e1('0x1d7'),'as':_0x41e1('0x1d8')});db[_0x41e1('0x1d9')][_0x41e1('0x149')](db[_0x41e1('0x64')],{});db['ChatTransferReport'][_0x41e1('0x149')](db['ChatInteraction'],{});db[_0x41e1('0x1d9')][_0x41e1('0x149')](db[_0x41e1('0x168')],{'foreignKey':_0x41e1('0x1da'),'as':_0x41e1('0x1d1')});db[_0x41e1('0x1d9')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'foreignKey':_0x41e1('0x1d2'),'as':_0x41e1('0x1d3')});db[_0x41e1('0x1d9')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'foreignKey':_0x41e1('0x1d4'),'as':_0x41e1('0x1db')});db[_0x41e1('0x1d9')][_0x41e1('0x149')](db[_0x41e1('0x68')],{'foreignKey':_0x41e1('0x1dc'),'as':_0x41e1('0x1d6')});db[_0x41e1('0x1d9')]['belongsTo'](db[_0x41e1('0x168')],{'foreignKey':_0x41e1('0x1dd'),'as':_0x41e1('0x1d8')});db['FaxTransferReport'][_0x41e1('0x149')](db[_0x41e1('0x4c')],{});db[_0x41e1('0x1de')][_0x41e1('0x149')](db[_0x41e1('0x4a')],{});db['FaxTransferReport']['belongsTo'](db[_0x41e1('0x48')],{'foreignKey':_0x41e1('0x1df'),'as':'FromAccount'});db['FaxTransferReport']['belongsTo'](db[_0x41e1('0x12')],{'foreignKey':_0x41e1('0x1d2'),'as':_0x41e1('0x1d3')});db[_0x41e1('0x1de')][_0x41e1('0x149')](db['User'],{'foreignKey':_0x41e1('0x1d4'),'as':'ToAgent'});db[_0x41e1('0x1de')][_0x41e1('0x149')](db[_0x41e1('0x4d')],{'foreignKey':_0x41e1('0x1e0'),'as':_0x41e1('0x1d6')});db[_0x41e1('0x1de')][_0x41e1('0x149')](db['FaxAccount'],{'foreignKey':_0x41e1('0x1e1'),'as':'ToAccount'});db[_0x41e1('0xf0')][_0x41e1('0x149')](db['OpenchannelMessage'],{});db[_0x41e1('0xf0')]['belongsTo'](db[_0x41e1('0x5a')],{});db[_0x41e1('0xf0')][_0x41e1('0x149')](db[_0x41e1('0x135')],{'foreignKey':_0x41e1('0x1e2'),'as':_0x41e1('0x1d1')});db[_0x41e1('0xf0')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'foreignKey':_0x41e1('0x1d2'),'as':_0x41e1('0x1d3')});db[_0x41e1('0xf0')]['belongsTo'](db['User'],{'foreignKey':_0x41e1('0x1d4'),'as':_0x41e1('0x1db')});db['OpenchannelTransferReport'][_0x41e1('0x149')](db[_0x41e1('0x5c')],{'foreignKey':_0x41e1('0x1e3'),'as':'ToQueue'});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':'ToOpenchannelAccountId','as':_0x41e1('0x1d8')});db['SmsTransferReport'][_0x41e1('0x149')](db[_0x41e1('0x54')],{});db[_0x41e1('0xf2')]['belongsTo'](db['SmsInteraction'],{});db[_0x41e1('0xf2')][_0x41e1('0x149')](db[_0x41e1('0x4f')],{'foreignKey':_0x41e1('0x1e4'),'as':_0x41e1('0x1d1')});db['SmsTransferReport'][_0x41e1('0x149')](db['User'],{'foreignKey':'FromUserId','as':_0x41e1('0x1d3')});db[_0x41e1('0xf2')]['belongsTo'](db[_0x41e1('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x41e1('0xf2')][_0x41e1('0x149')](db[_0x41e1('0x56')],{'foreignKey':_0x41e1('0x1e5'),'as':'ToQueue'});db[_0x41e1('0xf2')][_0x41e1('0x149')](db[_0x41e1('0x4f')],{'foreignKey':_0x41e1('0x1e6'),'as':'ToAccount'});db[_0x41e1('0xf4')][_0x41e1('0x10c')](db[_0x41e1('0x7a')],{'as':_0x41e1('0x158'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x41e1('0xf4')][_0x41e1('0x10c')](db[_0x41e1('0x1e7')],{'as':_0x41e1('0x1e8'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0xf4')][_0x41e1('0x10c')](db['CmContact'],{'as':_0x41e1('0x11a'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0xf4')]['hasMany'](db['CmHopperFinal'],{'as':_0x41e1('0x10e'),'foreignKey':'ListId'});db['CmList']['hasMany'](db[_0x41e1('0x73')],{'as':'HopperHistory','foreignKey':_0x41e1('0x15d')});db['CmList'][_0x41e1('0x10c')](db['ReportAgentPreview'],{'as':_0x41e1('0x75'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0xf4')][_0x41e1('0x117')](db['VoiceQueue'],{'as':_0x41e1('0x1e9'),'through':_0x41e1('0x14c')});db[_0x41e1('0xf4')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':_0x41e1('0x11d')});db['VoicePrefix'][_0x41e1('0x10c')](db[_0x41e1('0x17')],{'as':_0x41e1('0x19c'),'onDelete':_0x41e1('0x10a')});db['VoicePrefix'][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x14d'),'through':'user_has_voice_prefixes'});db[_0x41e1('0xf7')][_0x41e1('0x10c')](db['User'],{'as':_0x41e1('0x165'),'foreignKey':_0x41e1('0x116')});db[_0x41e1('0xf7')][_0x41e1('0x10c')](db['UserProfileSection'],{'as':_0x41e1('0x1ea'),'foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection'][_0x41e1('0x10c')](db[_0x41e1('0x1eb')],{'as':_0x41e1('0x1ec'),'foreignKey':_0x41e1('0x1ed'),'onDelete':_0x41e1('0x10a')});db[_0x41e1('0xfd')][_0x41e1('0x10c')](db[_0x41e1('0x7a')],{'as':_0x41e1('0x158'),'foreignKey':_0x41e1('0x1ee'),'onDelete':_0x41e1('0x10a')});db['WhatsappAccount']['hasMany'](db['CannedAnswer'],{'as':_0x41e1('0x15a'),'foreignKey':_0x41e1('0x1ee')});db[_0x41e1('0xfd')]['hasMany'](db[_0x41e1('0x100')],{'as':_0x41e1('0x150'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0x41e1('0x113')],{'as':_0x41e1('0x15b')});db[_0x41e1('0xfd')][_0x41e1('0x10c')](db[_0x41e1('0x1ef')],{'as':'Applications'});db['WhatsappAccount'][_0x41e1('0x149')](db[_0x41e1('0xf4')],{'as':_0x41e1('0x16d'),'foreignKey':_0x41e1('0x15d')});db[_0x41e1('0xfd')][_0x41e1('0x149')](db[_0x41e1('0x80')],{'as':_0x41e1('0x14a'),'foreignKey':_0x41e1('0x14b')});db['WhatsappAccount'][_0x41e1('0x117')](db['User'],{'as':_0x41e1('0x14d'),'through':'user_has_whatsapp_accounts'});db[_0x41e1('0x1ef')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'onDelete':'restrict'});db[_0x41e1('0x1ef')][_0x41e1('0x149')](db[_0x41e1('0x103')],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x1ef')]['belongsTo'](db[_0x41e1('0xfd')],{'onDelete':_0x41e1('0x16b')});db[_0x41e1('0x1ef')]['belongsTo'](db[_0x41e1('0x7e')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x41e1('0x1ef')][_0x41e1('0x149')](db['Tag'],{'onDelete':_0x41e1('0x16b'),'foreignKey':_0x41e1('0x173')});db[_0x41e1('0x113')][_0x41e1('0x10c')](db['WhatsappMessage'],{'as':_0x41e1('0x150'),'onDelete':_0x41e1('0x10a'),'foreignKey':_0x41e1('0x1f0')});db[_0x41e1('0x113')][_0x41e1('0x149')](db[_0x41e1('0xfd')],{'as':'Account','foreignKey':_0x41e1('0x1ee')});db['WhatsappInteraction'][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db[_0x41e1('0x113')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'as':_0x41e1('0x175'),'foreignKey':_0x41e1('0x10b')});db['WhatsappInteraction']['belongsToMany'](db[_0x41e1('0x88')],{'through':_0x41e1('0x1a3'),'as':_0x41e1('0x162')});db[_0x41e1('0x113')][_0x41e1('0x117')](db[_0x41e1('0x88')],{'through':_0x41e1('0x1a3'),'as':_0x41e1('0x164')});db[_0x41e1('0x113')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':_0x41e1('0x165'),'through':_0x41e1('0x125'),'foreignKey':'WhatsappInteractionId'});db[_0x41e1('0x100')]['belongsTo'](db[_0x41e1('0x12')],{'as':_0x41e1('0x12')});db['WhatsappMessage'][_0x41e1('0x149')](db[_0x41e1('0x119')],{'onDelete':'cascade','as':_0x41e1('0x153')});db['WhatsappMessage'][_0x41e1('0x149')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x41e1('0x167'),'foreignKey':'WhatsappInteractionId'});db[_0x41e1('0x100')]['belongsTo'](db['WhatsappAccount'],{'as':_0x41e1('0x161'),'foreignKey':_0x41e1('0x1ee')});db[_0x41e1('0x1f1')][_0x41e1('0x149')](db[_0x41e1('0xfd')],{});db[_0x41e1('0x1f1')][_0x41e1('0x149')](db['CmList'],{'as':'List','foreignKey':_0x41e1('0x15d')});db[_0x41e1('0x1f1')][_0x41e1('0x149')](db[_0x41e1('0x119')],{'as':_0x41e1('0x153'),'foreignKey':_0x41e1('0x154')});db['WhatsappQueueReport'][_0x41e1('0x149')](db[_0x41e1('0x113')],{});db[_0x41e1('0x1f1')][_0x41e1('0x149')](db['WhatsappQueue'],{});db[_0x41e1('0x1f1')][_0x41e1('0x149')](db['WhatsappMessage'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x41e1('0x12')],{});db[_0x41e1('0x102')][_0x41e1('0x149')](db[_0x41e1('0x100')],{});db[_0x41e1('0x102')][_0x41e1('0x149')](db[_0x41e1('0x113')],{});db[_0x41e1('0x102')][_0x41e1('0x149')](db[_0x41e1('0xfd')],{'foreignKey':'FromWhatsappAccountId','as':_0x41e1('0x1d1')});db[_0x41e1('0x102')][_0x41e1('0x149')](db[_0x41e1('0xfd')],{'foreignKey':'ToWhatsappAccountId','as':_0x41e1('0x1d8')});db[_0x41e1('0x102')][_0x41e1('0x149')](db[_0x41e1('0x103')],{'foreignKey':_0x41e1('0x1f2'),'as':_0x41e1('0x1d6')});db[_0x41e1('0x102')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'foreignKey':'FromUserId','as':_0x41e1('0x1d3')});db[_0x41e1('0x102')][_0x41e1('0x149')](db[_0x41e1('0x12')],{'foreignKey':_0x41e1('0x1d4'),'as':_0x41e1('0x1db')});db[_0x41e1('0x103')][_0x41e1('0x117')](db[_0x41e1('0x12')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x41e1('0x1f3')});db[_0x41e1('0x103')][_0x41e1('0x117')](db[_0x41e1('0xe2')],{'through':_0x41e1('0x1cb'),'as':_0x41e1('0x14e')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x8031=['../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','MailServerOut','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsQueue/smsQueue.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','Automation','../api/automation/automation.model','CannedAnswer','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','Trigger','../api/trigger/trigger.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReportDetail/squareReportDetail.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','License','../api/license/license.model','../api/campaign/campaign.model','Attachment','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','VoiceMail','cascade','hasMany','VoiceQueuesRt','UserId','Extensions','CmHopperFinal','HopperFinals','HopperHistory','OpenchannelInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','belongsTo','userProfileId','belongsToMany','Groups','Contacts','cm_user_has_contacts','CmList','Lists','cm_user_has_lists','user_has_teams','MailInteraction','user_has_mail_interactions','user_has_chat_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueues','ChatQueues','FaxQueue','FaxQueues','SmsQueue','SmsQueues','WhatsappQueues','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccount','OpenchannelAccounts','SmsAccount','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SquareProjects','user_has_square_projects','SpiedAgents','VoiceContext','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperHistories','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','mailbox','mailboxuser','QueueCalls','AgentReports','uniqueid','ContactId','MailAccountId','Imap','Smtp','Dispositions','Messages','Interactions','Applications','ListId','TemplateId','Agents','user_has_mail_accounts','MailInteractionId','Contact','Owner','mail_interaction_has_tags','Tags','ThroughTags','Interaction','Account','ChatWebsiteId','restrict','TagId','MailQueueReport','List','FaxAccountId','Answers','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Website','chat_interaction_has_tags','ChatInteractionId','Attachments','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','chat_group_has_users','CompanyId','JscriptySessions','Company','cm_contact_has_tags','CmHopper','Queue','Campaign','CampaignId','CmHopperBlack','Condition','All','Any','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','AnalyticCustomReport','CustomReportId','AnalyticDefaultReport','Fields','MetricId','SalesforceAccount','AccountId','Subjects','SubjectId','DescriptionId','Description','FieldId','Variable','VariableId','SugarcrmAccount','Configurations','DeskAccount','Descriptions','int_desk_configuration_has_tags','Subject','Field','ZendeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','FreshsalesAccount','ChatQueueReport','FromId','ToId','SessionId','ProjectId','JscriptyProject','team_has_mail_queues','team_has_sms_queues','OpenchannelQueues','team_has_whatsapp_queues','HopperBlacks','SquareProjectId','campaigns_has_cm_lists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToChatWebsiteId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','UserProfileSections','sectionId','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','WhatsappQueueId','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','defaultsDeep','database','username','options','password','User','import'];(function(_0x5ce8b9,_0x5cded8){var _0xe34be0=function(_0xe3d4e5){while(--_0xe3d4e5){_0x5ce8b9['push'](_0x5ce8b9['shift']());}};_0xe34be0(++_0x5cded8);}(_0x8031,0x1d7));var _0x1803=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x8031[_0x47aa64];return _0x549c7a;};'use strict';var path=require('path');var config=require(_0x1803('0x0'));var Sequelize=require(_0x1803('0x1'));var _=require(_0x1803('0x2'));var jstz=require(_0x1803('0x3'));var timezone=jstz[_0x1803('0x4')]();config[_0x1803('0x1')]=_['defaultsDeep'](config[_0x1803('0x1')],{'database':_0x1803('0x5'),'username':_0x1803('0x6'),'password':_0x1803('0x7'),'options':{'host':_0x1803('0x8'),'port':0xcea,'dialect':_0x1803('0x9'),'dialectOptions':{'charset':_0x1803('0xa')},'logging':![],'timezone':timezone[_0x1803('0xb')](),'define':{'charset':_0x1803('0xc'),'collate':'utf8_general_ci'}}});config[_0x1803('0xd')]=_[_0x1803('0xe')](config[_0x1803('0xd')],{'database':'motion2','username':'xcall','password':_0x1803('0x7'),'options':{'host':_0x1803('0x8'),'port':0xcea,'dialect':_0x1803('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x1803('0xb')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x1803('0xf')],config[_0x1803('0x1')][_0x1803('0x10')],config[_0x1803('0x1')]['password'],config[_0x1803('0x1')][_0x1803('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1803('0xd')][_0x1803('0xf')],config[_0x1803('0xd')][_0x1803('0x10')],config[_0x1803('0xd')][_0x1803('0x12')],config[_0x1803('0xd')]['options'])};db[_0x1803('0x13')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x15'));db[_0x1803('0x16')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x17'));db['VoiceContext']=db[_0x1803('0x1')]['import'](_0x1803('0x18'));db[_0x1803('0x19')]=db[_0x1803('0x1')]['import'](_0x1803('0x1a'));db[_0x1803('0x1b')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x1c'));db[_0x1803('0x1d')]=db[_0x1803('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db[_0x1803('0x1e')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x1803('0x1f')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x20'));db['VoiceMail']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x21'));db[_0x1803('0x22')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x23'));db[_0x1803('0x24')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x25'));db['VoiceDialReport']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x26'));db[_0x1803('0x27')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x28'));db[_0x1803('0x29')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0x1803('0x2a')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x2b'));db[_0x1803('0x2c')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x2d'));db[_0x1803('0x2e')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x2f'));db[_0x1803('0x30')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x31'));db[_0x1803('0x32')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x33'));db[_0x1803('0x34')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x35'));db[_0x1803('0x36')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0x1803('0x37')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x38'));db[_0x1803('0x39')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x3a'));db[_0x1803('0x3b')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x1803('0x3c')]=db['sequelize']['import'](_0x1803('0x3d'));db[_0x1803('0x3e')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/mailServerIn/mailServerIn.model');db[_0x1803('0x3f')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/mailServerOut/mailServerOut.model');db[_0x1803('0x40')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x41'));db[_0x1803('0x42')]=db[_0x1803('0x1')]['import'](_0x1803('0x43'));db[_0x1803('0x44')]=db[_0x1803('0x1')]['import'](_0x1803('0x45'));db['MailInteraction']=db['sequelize'][_0x1803('0x14')]('../api/mailInteraction/mailInteraction.model');db[_0x1803('0x46')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x47'));db[_0x1803('0x48')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x49'));db['MailQueueReport']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x4a'));db[_0x1803('0x4b')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x4c'));db[_0x1803('0x4d')]=db[_0x1803('0x1')]['import'](_0x1803('0x4e'));db[_0x1803('0x4f')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x50'));db[_0x1803('0x51')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x52'));db[_0x1803('0x53')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x54'));db[_0x1803('0x55')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x56'));db['FaxQueue']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x57'));db[_0x1803('0x58')]=db['sequelize']['import']('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x59'));db[_0x1803('0x5a')]=db[_0x1803('0x1')]['import']('../api/smsApplication/smsApplication.model');db[_0x1803('0x5b')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x5c'));db[_0x1803('0x5d')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/smsMessage/smsMessage.model');db['SmsQueue']=db['sequelize'][_0x1803('0x14')](_0x1803('0x5e'));db['OpenchannelAccount']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/openchannelAccount/openchannelAccount.model');db[_0x1803('0x5f')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x60'));db['OpenchannelInteraction']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x61'));db[_0x1803('0x62')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/openchannelMessage/openchannelMessage.model');db[_0x1803('0x63')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x64'));db['ChatWebsite']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x1803('0x65')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x66'));db[_0x1803('0x67')]=db[_0x1803('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x1803('0x68')]=db['sequelize'][_0x1803('0x14')]('../api/chatMessage/chatMessage.model');db[_0x1803('0x69')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x6a'));db[_0x1803('0x6b')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x6c'));db[_0x1803('0x6d')]=db[_0x1803('0x1')]['import']('../api/chatGroup/chatGroup.model');db[_0x1803('0x6e')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x6f'));db[_0x1803('0x70')]=db['sequelize']['import'](_0x1803('0x71'));db[_0x1803('0x72')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x73'));db['CmHopper']=db['sequelize'][_0x1803('0x14')]('../api/cmHopper/cmHopper.model');db['CmHopperBlack']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x74'));db['CmHopperFinal']=db['sequelize']['import'](_0x1803('0x75'));db[_0x1803('0x76')]=db['sequelize'][_0x1803('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x1803('0x77')]=db['sequelize']['import'](_0x1803('0x78'));db['CmCustomField']=db['sequelize'][_0x1803('0x14')]('../api/cmCustomField/cmCustomField.model');db[_0x1803('0x79')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/action/action.model');db[_0x1803('0x7a')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x7b'));db[_0x1803('0x7c')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/cannedAnswer/cannedAnswer.model');db[_0x1803('0x7d')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x7e'));db['Condition']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x7f'));db[_0x1803('0x80')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x81'));db[_0x1803('0x82')]=db[_0x1803('0x1')]['import'](_0x1803('0x83'));db[_0x1803('0x84')]=db[_0x1803('0x1')]['import'](_0x1803('0x85'));db[_0x1803('0x86')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x87'));db[_0x1803('0x88')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/schedule/schedule.model');db[_0x1803('0x89')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x8a'));db[_0x1803('0x8b')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x8c'));db[_0x1803('0x8d')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/template/template.model');db[_0x1803('0x8e')]=db[_0x1803('0x1')]['import'](_0x1803('0x8f'));db['Variable']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/variable/variable.model');db[_0x1803('0x90')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/integration/integration.model');db[_0x1803('0x91')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x92'));db['AnalyticCustomReport']=db[_0x1803('0x1')]['import'](_0x1803('0x93'));db['AnalyticDefaultReport']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x94'));db['AnalyticExtractedReport']=db[_0x1803('0x1')]['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x1803('0x95')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x96'));db[_0x1803('0x97')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x98'));db[_0x1803('0x99')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x9a'));db['SalesforceAccount']=db['sequelize']['import'](_0x1803('0x9b'));db[_0x1803('0x9c')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0x9d'));db[_0x1803('0x9e')]=db[_0x1803('0x1')]['import'](_0x1803('0x9f'));db['SugarcrmAccount']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xa0'));db[_0x1803('0xa1')]=db['sequelize'][_0x1803('0x14')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x1803('0xa2')]=db[_0x1803('0x1')]['import'](_0x1803('0xa3'));db['DeskAccount']=db[_0x1803('0x1')]['import'](_0x1803('0xa4'));db[_0x1803('0xa5')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xa6'));db[_0x1803('0xa7')]=db[_0x1803('0x1')]['import'](_0x1803('0xa8'));db[_0x1803('0xa9')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xaa'));db[_0x1803('0xab')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/intZohoConfiguration/intZohoConfiguration.model');db[_0x1803('0xac')]=db[_0x1803('0x1')]['import'](_0x1803('0xad'));db[_0x1803('0xae')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xaf'));db[_0x1803('0xb0')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xb1'));db['ZendeskField']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xb2'));db['FreshdeskAccount']=db['sequelize'][_0x1803('0x14')](_0x1803('0xb3'));db[_0x1803('0xb4')]=db['sequelize'][_0x1803('0x14')](_0x1803('0xb5'));db[_0x1803('0xb6')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xb7'));db[_0x1803('0xb8')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x1803('0xb9')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xba'));db[_0x1803('0xbb')]=db[_0x1803('0x1')]['import'](_0x1803('0xbc'));db[_0x1803('0xbd')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xbe'));db[_0x1803('0xbf')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xc0'));db[_0x1803('0xc1')]=db['sequelize'][_0x1803('0x14')](_0x1803('0xc2'));db[_0x1803('0xc3')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x1803('0xc4')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xc5'));db[_0x1803('0xc6')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xc7'));db['FreshsalesAccount']=db[_0x1803('0x1')]['import'](_0x1803('0xc8'));db[_0x1803('0xc9')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xca'));db[_0x1803('0xcb')]=db[_0x1803('0x1')]['import'](_0x1803('0xcc'));db[_0x1803('0x90')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xcd'));db[_0x1803('0xce')]=db[_0x1803('0x1')]['import'](_0x1803('0xcf'));db['ChatQueueReport']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xd0'));db[_0x1803('0xd1')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xd2'));db[_0x1803('0xd3')]=db[_0x1803('0x1')]['import']('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db[_0x1803('0xd4')]=db['sequelize'][_0x1803('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x1803('0xd5')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x1803('0xd6')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xd7'));db['SquareReport']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xd8'));db['JscriptyProject']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/jscriptyProject/jscriptyProject.model');db[_0x1803('0xd9')]=db['sequelize'][_0x1803('0x14')](_0x1803('0xda'));db[_0x1803('0xdb')]=db[_0x1803('0x1')]['import']('../api/squareOdbc/squareOdbc.model');db[_0x1803('0xdc')]=db['sequelize']['import'](_0x1803('0xdd'));db[_0x1803('0xde')]=db['sequelize'][_0x1803('0x14')](_0x1803('0xdf'));db[_0x1803('0xe0')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/squareMessage/squareMessage.model');db[_0x1803('0xe1')]=db['sequelize'][_0x1803('0x14')](_0x1803('0xe2'));db[_0x1803('0xe3')]=db['sequelize']['import'](_0x1803('0xe4'));db['Campaign']=db['sequelize'][_0x1803('0x14')](_0x1803('0xe5'));db['Migration']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/migration/migration.model');db[_0x1803('0xe6')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/attachment/attachment.model');db['Plugin']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/plugin/plugin.model');db[_0x1803('0xe7')]=db['sequelize']['import'](_0x1803('0xe8'));db[_0x1803('0xe9')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/chatTransferReport/chatTransferReport.model');db[_0x1803('0xea')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xeb'));db['OpenchannelTransferReport']=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xec'));db['SmsTransferReport']=db[_0x1803('0x1')][_0x1803('0x14')]('../api/smsTransferReport/smsTransferReport.model');db['CmList']=db[_0x1803('0x1')]['import'](_0x1803('0xed'));db[_0x1803('0xee')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xef'));db[_0x1803('0xf0')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xf1'));db[_0x1803('0xf2')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x1803('0xf3')]=db['sequelize'][_0x1803('0x14')]('../api/userProfileResource/userProfileResource.model');db[_0x1803('0xf4')]=db[_0x1803('0x1')][_0x1803('0x14')]('../api/userNotification/userNotification.model');db[_0x1803('0xf5')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xf6'));db[_0x1803('0xf7')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xf8'));db[_0x1803('0xf9')]=db[_0x1803('0x1')][_0x1803('0x14')](_0x1803('0xfa'));db[_0x1803('0xfb')]=db[_0x1803('0x1')]['import'](_0x1803('0xfc'));db[_0x1803('0xfd')]=db[_0x1803('0x1')]['import']('../api/whatsappQueueReport/whatsappQueueReport.model');db[_0x1803('0xfe')]=db['sequelize']['import'](_0x1803('0xff'));db[_0x1803('0x100')]=db[_0x1803('0x1')]['import'](_0x1803('0x101'));db[_0x1803('0x102')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x103'));db[_0x1803('0x104')]=db[_0x1803('0x1')]['import'](_0x1803('0x105'));db[_0x1803('0x106')]=db['sequelize'][_0x1803('0x14')](_0x1803('0x107'));db[_0x1803('0x13')][_0x1803('0x108')](db[_0x1803('0x109')],{'as':_0x1803('0x109'),'onDelete':_0x1803('0x10a'),'foreignKey':'UserId'});db['User'][_0x1803('0x10b')](db[_0x1803('0x1e')],{'as':'Recordings','foreignKey':'UserId'});db[_0x1803('0x13')][_0x1803('0x10b')](db[_0x1803('0x30')],{'as':_0x1803('0x10c'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x13')][_0x1803('0x10b')](db['VoiceExtension'],{'as':_0x1803('0x10e'),'onDelete':_0x1803('0x10a'),'hooks':!![]});db[_0x1803('0x13')][_0x1803('0x10b')](db[_0x1803('0x10f')],{'as':_0x1803('0x110'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x13')]['hasMany'](db['CmHopperHistory'],{'as':_0x1803('0x111'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x13')][_0x1803('0x10b')](db[_0x1803('0x77')],{'as':_0x1803('0x77'),'foreignKey':'UserId'});db[_0x1803('0x13')][_0x1803('0x10b')](db[_0x1803('0x112')],{'as':'OpenchannelInteractions','foreignKey':_0x1803('0x10d')});db[_0x1803('0x13')]['hasMany'](db[_0x1803('0x67')],{'as':_0x1803('0x113'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x13')][_0x1803('0x10b')](db[_0x1803('0x5b')],{'as':_0x1803('0x114'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x13')]['hasMany'](db[_0x1803('0x53')],{'as':_0x1803('0x115'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x13')][_0x1803('0x10b')](db['MailInteraction'],{'as':_0x1803('0x116'),'foreignKey':'UserId'});db[_0x1803('0x13')]['hasMany'](db[_0x1803('0xf9')],{'as':_0x1803('0x117'),'foreignKey':'UserId'});db[_0x1803('0x13')][_0x1803('0x10b')](db[_0x1803('0xf4')],{'as':_0x1803('0x118'),'foreignKey':'SenderId'});db[_0x1803('0x13')][_0x1803('0x119')](db[_0x1803('0xf0')],{'as':_0x1803('0xf0'),'foreignKey':_0x1803('0x11a')});db['User'][_0x1803('0x11b')](db[_0x1803('0x6d')],{'as':_0x1803('0x11c'),'through':'chat_group_has_users'});db['User'][_0x1803('0x11b')](db['CmContact'],{'as':_0x1803('0x11d'),'through':_0x1803('0x11e')});db[_0x1803('0x13')]['belongsToMany'](db[_0x1803('0x11f')],{'as':_0x1803('0x120'),'through':_0x1803('0x121')});db[_0x1803('0x13')]['belongsToMany'](db['Team'],{'through':_0x1803('0x122')});db['User'][_0x1803('0x11b')](db[_0x1803('0x123')],{'as':_0x1803('0x116'),'through':_0x1803('0x124')});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x67')],{'as':_0x1803('0x113'),'through':_0x1803('0x125')});db[_0x1803('0x13')]['belongsToMany'](db[_0x1803('0x53')],{'as':_0x1803('0x115'),'through':'user_has_fax_interactions'});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x5b')],{'as':'SmsInteractions','through':_0x1803('0x126')});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x112')],{'as':_0x1803('0x127'),'through':_0x1803('0x128')});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0xf9')],{'as':_0x1803('0x117'),'through':_0x1803('0x129')});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x1d')],{'as':_0x1803('0x12a'),'through':_0x1803('0x32'),'required':![]});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x42')],{'as':_0x1803('0x12b'),'through':_0x1803('0x36'),'required':![]});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x6b')],{'as':_0x1803('0x12c'),'through':_0x1803('0x34'),'required':![],'hooks':!![]});db['User'][_0x1803('0x11b')](db[_0x1803('0x12d')],{'as':_0x1803('0x12e'),'through':_0x1803('0x37'),'required':![]});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x12f')],{'as':_0x1803('0x130'),'through':_0x1803('0x39'),'required':![]});db['User'][_0x1803('0x11b')](db['OpenchannelQueue'],{'as':'OpenchannelQueues','through':_0x1803('0x3b'),'required':![]});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x100')],{'as':_0x1803('0x131'),'through':'UserWhatsappQueue','required':![]});db[_0x1803('0x13')][_0x1803('0x11b')](db['CmList'],{'through':_0x1803('0x121')});db['User'][_0x1803('0x11b')](db[_0x1803('0xee')],{'as':_0x1803('0x132'),'through':'user_has_voice_prefixes','required':![]});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x133')],{'as':_0x1803('0x134'),'through':_0x1803('0x135')});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x4f')],{'as':_0x1803('0x136'),'through':_0x1803('0x137')});db[_0x1803('0x13')]['belongsToMany'](db['MailAccount'],{'as':_0x1803('0x138'),'through':'user_has_mail_accounts'});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0x139')],{'as':_0x1803('0x13a'),'through':'user_has_openchannel_accounts'});db['User'][_0x1803('0x11b')](db[_0x1803('0x13b')],{'as':_0x1803('0x13c'),'through':_0x1803('0x13d')});db[_0x1803('0x13')][_0x1803('0x11b')](db[_0x1803('0xf5')],{'as':_0x1803('0x13e'),'through':_0x1803('0x13f')});db[_0x1803('0x13')][_0x1803('0x11b')](db['SquareProject'],{'as':_0x1803('0x140'),'through':_0x1803('0x141')});db[_0x1803('0x16')][_0x1803('0x10b')](db[_0x1803('0x19')],{'as':_0x1803('0x142'),'onDelete':_0x1803('0x10a'),'foreignKey':'ChanSpyId'});db[_0x1803('0x143')][_0x1803('0x10b')](db[_0x1803('0x19')],{'onDelete':_0x1803('0x10a')});db[_0x1803('0x19')]['hasMany'](db['VoiceExtension'],{'as':'Applications','onDelete':_0x1803('0x10a')});db[_0x1803('0x1b')][_0x1803('0x11b')](db[_0x1803('0x89')],{'as':'Sounds','through':_0x1803('0x144')});db['VoiceQueue']['hasMany'](db[_0x1803('0x30')],{'as':_0x1803('0x145'),'foreignKey':_0x1803('0x146')});db['VoiceQueue']['hasMany'](db['CmHopper'],{'as':_0x1803('0x147'),'foreignKey':_0x1803('0x146')});db[_0x1803('0x1d')][_0x1803('0x10b')](db[_0x1803('0x10f')],{'as':_0x1803('0x110'),'foreignKey':_0x1803('0x146')});db[_0x1803('0x1d')]['hasMany'](db[_0x1803('0x76')],{'as':_0x1803('0x148'),'foreignKey':'VoiceQueueId'});db[_0x1803('0x1d')][_0x1803('0x10b')](db[_0x1803('0x77')],{'as':_0x1803('0x77'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x1803('0x10b')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'VoiceQueueId'});db[_0x1803('0x1d')][_0x1803('0x10b')](db[_0x1803('0xd5')],{'as':'JscriptySessions','foreignKey':_0x1803('0x146')});db['VoiceQueue'][_0x1803('0x119')](db[_0x1803('0x2c')],{'as':_0x1803('0x2c'),'foreignKey':_0x1803('0x149')});db[_0x1803('0x1d')][_0x1803('0x119')](db['Trunk'],{'as':_0x1803('0x14a'),'foreignKey':_0x1803('0x14b')});db[_0x1803('0x1d')][_0x1803('0x119')](db[_0x1803('0x80')],{'as':_0x1803('0x80'),'foreignKey':_0x1803('0x14c')});db[_0x1803('0x1d')]['belongsTo'](db[_0x1803('0x82')],{'as':_0x1803('0x14d'),'foreignKey':_0x1803('0x14e')});db['VoiceQueue']['belongsToMany'](db['CmList'],{'as':_0x1803('0x120'),'through':_0x1803('0x14f')});db[_0x1803('0x1d')]['belongsToMany'](db[_0x1803('0x13')],{'as':'Agents','through':_0x1803('0x32')});db['VoiceQueue'][_0x1803('0x11b')](db['Team'],{'as':_0x1803('0x150'),'through':'TeamVoiceQueue'});db[_0x1803('0x1d')][_0x1803('0x11b')](db[_0x1803('0x11f')],{'as':_0x1803('0x151'),'through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x1803('0x119')](db[_0x1803('0x13')],{'as':_0x1803('0x13'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x1f')][_0x1803('0x119')](db[_0x1803('0x13')],{'as':'User','foreignKey':_0x1803('0x10d')});db[_0x1803('0x109')][_0x1803('0x10b')](db[_0x1803('0x22')],{'as':'Messages','onDelete':_0x1803('0x10a'),'foreignKey':'mailboxuser','sourceKey':_0x1803('0x152')});db[_0x1803('0x22')]['belongsTo'](db[_0x1803('0x109')],{'foreignKey':_0x1803('0x153'),'targetKey':'mailbox'});db[_0x1803('0x24')][_0x1803('0x10b')](db[_0x1803('0x29')],{'as':_0x1803('0x154'),'foreignKey':'uniqueid','constraints':![]});db[_0x1803('0x24')]['hasMany'](db[_0x1803('0x27')],{'as':_0x1803('0x155'),'foreignKey':_0x1803('0x156'),'constraints':![]});db[_0x1803('0x24')][_0x1803('0x119')](db['User'],{'as':_0x1803('0x13'),'foreignKey':_0x1803('0x10d')});db['VoiceCallReport'][_0x1803('0x119')](db[_0x1803('0x72')],{'as':'Contact','foreignKey':_0x1803('0x157')});db[_0x1803('0x3e')]['belongsTo'](db[_0x1803('0x40')],{'as':'MailAccount','foreignKey':_0x1803('0x158')});db['MailServerOut'][_0x1803('0x119')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0x1803('0x158')});db[_0x1803('0x40')]['hasOne'](db[_0x1803('0x3e')],{'as':_0x1803('0x159'),'onDelete':'cascade'});db[_0x1803('0x40')]['hasOne'](db[_0x1803('0x3f')],{'as':_0x1803('0x15a'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x40')][_0x1803('0x10b')](db['Disposition'],{'as':_0x1803('0x15b'),'foreignKey':_0x1803('0x158'),'onDelete':_0x1803('0x10a')});db['MailAccount'][_0x1803('0x10b')](db[_0x1803('0x7c')],{'as':'Answers','foreignKey':_0x1803('0x158')});db[_0x1803('0x40')][_0x1803('0x10b')](db[_0x1803('0x46')],{'as':_0x1803('0x15c'),'foreignKey':_0x1803('0x158')});db[_0x1803('0x40')][_0x1803('0x10b')](db[_0x1803('0x123')],{'as':_0x1803('0x15d')});db['MailAccount'][_0x1803('0x10b')](db[_0x1803('0x48')],{'as':_0x1803('0x15e')});db[_0x1803('0x40')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':_0x1803('0x15f')});db['MailAccount'][_0x1803('0x119')](db[_0x1803('0x8d')],{'as':_0x1803('0x8d'),'foreignKey':_0x1803('0x160')});db[_0x1803('0x40')][_0x1803('0x119')](db[_0x1803('0x82')],{'as':_0x1803('0x14d'),'foreignKey':_0x1803('0x14e')});db['MailAccount'][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':_0x1803('0x161'),'through':_0x1803('0x162')});db[_0x1803('0x42')][_0x1803('0x11b')](db['User'],{'as':_0x1803('0x161'),'through':_0x1803('0x36')});db[_0x1803('0x42')][_0x1803('0x11b')](db[_0x1803('0xe1')],{'through':'team_has_mail_queues','as':'Teams'});db[_0x1803('0x123')][_0x1803('0x10b')](db[_0x1803('0x46')],{'as':'Messages','onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x163')});db[_0x1803('0x123')][_0x1803('0x119')](db[_0x1803('0x40')],{'as':'Account','foreignKey':_0x1803('0x158')});db[_0x1803('0x123')][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db['MailInteraction'][_0x1803('0x119')](db[_0x1803('0x13')],{'as':_0x1803('0x165'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x123')][_0x1803('0x11b')](db[_0x1803('0x8b')],{'through':_0x1803('0x166'),'as':_0x1803('0x167')});db['MailInteraction']['belongsToMany'](db[_0x1803('0x8b')],{'through':_0x1803('0x166'),'as':_0x1803('0x168')});db[_0x1803('0x123')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':'Users','through':_0x1803('0x124'),'foreignKey':_0x1803('0x163')});db[_0x1803('0x46')][_0x1803('0x10b')](db['Attachment'],{'as':'Attachments','onDelete':_0x1803('0x10a')});db[_0x1803('0x46')][_0x1803('0x119')](db['User'],{'as':_0x1803('0x13')});db[_0x1803('0x46')][_0x1803('0x119')](db[_0x1803('0x72')],{'onDelete':_0x1803('0x10a'),'as':'Contact'});db[_0x1803('0x46')][_0x1803('0x119')](db[_0x1803('0x123')],{'as':_0x1803('0x169'),'foreignKey':_0x1803('0x163')});db[_0x1803('0x46')][_0x1803('0x119')](db[_0x1803('0x40')],{'as':_0x1803('0x16a'),'foreignKey':'MailAccountId'});db[_0x1803('0x46')][_0x1803('0x119')](db[_0x1803('0x133')],{'as':_0x1803('0x133'),'foreignKey':_0x1803('0x16b')});db[_0x1803('0x46')]['belongsTo'](db[_0x1803('0x69')],{'as':_0x1803('0x69'),'foreignKey':'ChatOfflineMessageId'});db[_0x1803('0x48')][_0x1803('0x119')](db[_0x1803('0x13')],{'onDelete':_0x1803('0x16c')});db[_0x1803('0x48')]['belongsTo'](db['MailQueue'],{'onDelete':'restrict'});db['MailApplication']['belongsTo'](db[_0x1803('0x40')],{'onDelete':_0x1803('0x16c')});db[_0x1803('0x48')][_0x1803('0x119')](db[_0x1803('0x80')],{'onDelete':_0x1803('0x16c'),'foreignKey':_0x1803('0x14c')});db[_0x1803('0x48')]['belongsTo'](db[_0x1803('0x8b')],{'onDelete':_0x1803('0x16c'),'foreignKey':_0x1803('0x16d')});db[_0x1803('0x16e')][_0x1803('0x119')](db[_0x1803('0x40')],{});db[_0x1803('0x16e')][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0x16e')][_0x1803('0x119')](db[_0x1803('0x72')],{'as':'Contact','foreignKey':_0x1803('0x157')});db['MailQueueReport'][_0x1803('0x119')](db[_0x1803('0x123')],{});db['MailQueueReport'][_0x1803('0x119')](db[_0x1803('0x46')],{});db['MailQueueReport']['belongsTo'](db[_0x1803('0x13')],{});db['MailQueueReport'][_0x1803('0x119')](db[_0x1803('0x42')],{});db[_0x1803('0x4b')][_0x1803('0x10b')](db[_0x1803('0x4d')],{'as':'Items','onDelete':_0x1803('0x10a')});db[_0x1803('0x4f')][_0x1803('0x10b')](db[_0x1803('0x7d')],{'as':_0x1803('0x15b'),'foreignKey':_0x1803('0x170'),'onDelete':'cascade'});db[_0x1803('0x4f')]['hasMany'](db[_0x1803('0x7c')],{'as':_0x1803('0x171'),'foreignKey':_0x1803('0x170')});db[_0x1803('0x4f')][_0x1803('0x10b')](db[_0x1803('0x53')],{'as':'Interactions'});db[_0x1803('0x4f')][_0x1803('0x10b')](db[_0x1803('0x51')],{'as':_0x1803('0x15e')});db[_0x1803('0x4f')]['hasMany'](db['VoiceExtension'],{'as':'Exntensions','onDelete':'cascade'});db[_0x1803('0x4f')][_0x1803('0x10b')](db[_0x1803('0x55')],{'as':_0x1803('0x15c')});db[_0x1803('0x4f')][_0x1803('0x119')](db[_0x1803('0x2c')],{'as':_0x1803('0x2c')});db[_0x1803('0x4f')]['belongsTo'](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0x4f')]['belongsTo'](db[_0x1803('0x82')],{'as':_0x1803('0x14d'),'foreignKey':_0x1803('0x14e')});db[_0x1803('0x4f')]['belongsToMany'](db[_0x1803('0x13')],{'as':_0x1803('0x161'),'through':_0x1803('0x137')});db[_0x1803('0x51')][_0x1803('0x119')](db[_0x1803('0x13')],{'onDelete':_0x1803('0x16c')});db[_0x1803('0x51')]['belongsTo'](db[_0x1803('0x12d')],{'onDelete':_0x1803('0x16c')});db['FaxApplication'][_0x1803('0x119')](db['FaxAccount'],{'onDelete':'restrict'});db[_0x1803('0x51')]['belongsTo'](db[_0x1803('0x8b')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x1803('0x53')][_0x1803('0x10b')](db[_0x1803('0x55')],{'as':'Messages','onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x172')});db[_0x1803('0x53')][_0x1803('0x119')](db['FaxAccount'],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x170')});db['FaxInteraction'][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':'ContactId'});db[_0x1803('0x53')][_0x1803('0x119')](db['User'],{'as':_0x1803('0x165'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x53')][_0x1803('0x11b')](db[_0x1803('0x8b')],{'through':_0x1803('0x173'),'as':_0x1803('0x167')});db[_0x1803('0x53')][_0x1803('0x11b')](db[_0x1803('0x8b')],{'through':_0x1803('0x173'),'as':'ThroughTags'});db[_0x1803('0x53')][_0x1803('0x11b')](db['User'],{'as':_0x1803('0x174'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0x1803('0x55')]['belongsTo'](db['User'],{'onDelete':'cascade','as':'User'});db[_0x1803('0x55')][_0x1803('0x119')](db['FaxInteraction'],{'as':_0x1803('0x169'),'foreignKey':'FaxInteractionId'});db[_0x1803('0x55')][_0x1803('0x119')](db[_0x1803('0x72')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x164')});db[_0x1803('0x55')][_0x1803('0x119')](db[_0x1803('0xe6')],{'as':_0x1803('0xe6'),'foreignKey':_0x1803('0x175')});db[_0x1803('0x55')][_0x1803('0x119')](db[_0x1803('0x4f')],{'as':'Account','foreignKey':_0x1803('0x170')});db[_0x1803('0x12d')]['belongsToMany'](db[_0x1803('0x13')],{'as':_0x1803('0x161'),'through':_0x1803('0x37')});db['FaxQueue']['belongsToMany'](db[_0x1803('0xe1')],{'through':_0x1803('0x176'),'as':_0x1803('0x150')});db[_0x1803('0x58')][_0x1803('0x119')](db[_0x1803('0x4f')],{});db[_0x1803('0x58')][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db['FaxQueueReport'][_0x1803('0x119')](db['CmContact'],{'as':_0x1803('0x164'),'foreignKey':'ContactId'});db[_0x1803('0x58')][_0x1803('0x119')](db[_0x1803('0x53')],{});db['FaxQueueReport']['belongsTo'](db['FaxMessage'],{});db[_0x1803('0x58')][_0x1803('0x119')](db[_0x1803('0x13')],{});db[_0x1803('0x58')][_0x1803('0x119')](db[_0x1803('0x12d')],{});db[_0x1803('0x13b')][_0x1803('0x10b')](db[_0x1803('0x7d')],{'as':_0x1803('0x15b'),'foreignKey':_0x1803('0x177'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x13b')]['hasMany'](db[_0x1803('0x7c')],{'as':_0x1803('0x171'),'foreignKey':_0x1803('0x177')});db[_0x1803('0x13b')][_0x1803('0x10b')](db[_0x1803('0x5d')],{'as':_0x1803('0x15c'),'foreignKey':_0x1803('0x177')});db[_0x1803('0x13b')][_0x1803('0x10b')](db[_0x1803('0x5b')],{'as':_0x1803('0x15d')});db[_0x1803('0x13b')]['hasMany'](db[_0x1803('0x5a')],{'as':_0x1803('0x15e')});db[_0x1803('0x13b')][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0x13b')][_0x1803('0x119')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x1803('0x14e')});db[_0x1803('0x13b')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':'Agents','through':_0x1803('0x13d')});db[_0x1803('0x5a')]['belongsTo'](db[_0x1803('0x13')],{'onDelete':_0x1803('0x16c')});db[_0x1803('0x5a')][_0x1803('0x119')](db[_0x1803('0x12f')],{'onDelete':'restrict'});db[_0x1803('0x5a')]['belongsTo'](db[_0x1803('0x13b')],{'onDelete':_0x1803('0x16c')});db['SmsApplication'][_0x1803('0x119')](db[_0x1803('0x80')],{'onDelete':_0x1803('0x16c'),'foreignKey':_0x1803('0x14c')});db['SmsApplication']['belongsTo'](db[_0x1803('0x8b')],{'onDelete':'restrict','foreignKey':_0x1803('0x16d')});db[_0x1803('0x5b')][_0x1803('0x10b')](db['SmsMessage'],{'as':_0x1803('0x15c'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x178')});db[_0x1803('0x5b')][_0x1803('0x119')](db[_0x1803('0x13b')],{'as':_0x1803('0x16a'),'foreignKey':'SmsAccountId'});db[_0x1803('0x5b')][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db['SmsInteraction'][_0x1803('0x119')](db[_0x1803('0x13')],{'as':_0x1803('0x165'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0x5b')][_0x1803('0x11b')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0x1803('0x167')});db[_0x1803('0x5b')][_0x1803('0x11b')](db['Tag'],{'through':_0x1803('0x179'),'as':_0x1803('0x168')});db[_0x1803('0x5b')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':_0x1803('0x174'),'through':_0x1803('0x126'),'foreignKey':_0x1803('0x178')});db[_0x1803('0x5d')][_0x1803('0x119')](db[_0x1803('0x13')],{'as':'User'});db[_0x1803('0x5d')][_0x1803('0x119')](db[_0x1803('0x72')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x164')});db[_0x1803('0x5d')][_0x1803('0x119')](db[_0x1803('0x5b')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x169'),'foreignKey':_0x1803('0x178')});db[_0x1803('0x5d')]['belongsTo'](db[_0x1803('0x13b')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x1803('0x12f')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':_0x1803('0x161'),'through':_0x1803('0x39'),'foreignKey':_0x1803('0x17a')});db[_0x1803('0x12f')][_0x1803('0x11b')](db[_0x1803('0xe1')],{'through':'team_has_sms_queues','as':_0x1803('0x150')});db[_0x1803('0x139')][_0x1803('0x10b')](db[_0x1803('0x7d')],{'as':'Dispositions','foreignKey':_0x1803('0x17b'),'onDelete':'cascade'});db[_0x1803('0x139')][_0x1803('0x10b')](db[_0x1803('0x7c')],{'as':_0x1803('0x171'),'foreignKey':_0x1803('0x17b')});db[_0x1803('0x139')][_0x1803('0x10b')](db['OpenchannelInteraction'],{'as':_0x1803('0x15d'),'foreignKey':'OpenchannelAccountId'});db[_0x1803('0x139')][_0x1803('0x10b')](db[_0x1803('0x62')],{'as':_0x1803('0x15c'),'foreignKey':_0x1803('0x17b')});db[_0x1803('0x139')][_0x1803('0x10b')](db[_0x1803('0x5f')],{'as':_0x1803('0x15e'),'foreignKey':_0x1803('0x17b')});db[_0x1803('0x139')][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0x139')][_0x1803('0x119')](db[_0x1803('0x82')],{'as':_0x1803('0x14d'),'foreignKey':_0x1803('0x14e')});db[_0x1803('0x139')][_0x1803('0x11b')](db['User'],{'as':_0x1803('0x161'),'through':_0x1803('0x17c')});db[_0x1803('0x5f')]['belongsTo'](db[_0x1803('0x13')],{'onDelete':_0x1803('0x16c')});db[_0x1803('0x5f')][_0x1803('0x119')](db[_0x1803('0x63')],{'onDelete':'restrict','foreignKey':_0x1803('0x17d')});db[_0x1803('0x5f')][_0x1803('0x119')](db[_0x1803('0x139')],{'onDelete':_0x1803('0x16c'),'foreignKey':_0x1803('0x17b')});db[_0x1803('0x5f')][_0x1803('0x119')](db[_0x1803('0x80')],{'onDelete':'restrict','foreignKey':_0x1803('0x14c')});db[_0x1803('0x5f')][_0x1803('0x119')](db[_0x1803('0x8b')],{'onDelete':_0x1803('0x16c'),'foreignKey':_0x1803('0x16d')});db[_0x1803('0x112')]['hasMany'](db['OpenchannelMessage'],{'as':_0x1803('0x15c'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x17e')});db['OpenchannelInteraction'][_0x1803('0x119')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x1803('0x17b')});db[_0x1803('0x112')]['belongsTo'](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db[_0x1803('0x112')]['belongsTo'](db[_0x1803('0x13')],{'as':_0x1803('0x165'),'foreignKey':_0x1803('0x10d')});db['OpenchannelInteraction']['belongsToMany'](db[_0x1803('0x8b')],{'through':_0x1803('0x17f'),'as':'Tags'});db['OpenchannelInteraction'][_0x1803('0x11b')](db['Tag'],{'through':_0x1803('0x17f'),'as':'ThroughTags'});db[_0x1803('0x112')]['belongsToMany'](db[_0x1803('0x13')],{'as':_0x1803('0x174'),'through':'user_has_openchannel_interactions','foreignKey':'OpenchannelInteractionId'});db[_0x1803('0x62')]['belongsTo'](db[_0x1803('0x13')],{'onDelete':_0x1803('0x10a'),'as':'User'});db[_0x1803('0x62')][_0x1803('0x119')](db['CmContact'],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x164')});db[_0x1803('0x62')][_0x1803('0x119')](db[_0x1803('0x112')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x169'),'foreignKey':_0x1803('0x17e')});db[_0x1803('0x62')]['belongsTo'](db[_0x1803('0xe6')],{'as':_0x1803('0xe6'),'foreignKey':_0x1803('0x175')});db['OpenchannelMessage'][_0x1803('0x119')](db[_0x1803('0x139')],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x17b')});db[_0x1803('0x63')]['belongsToMany'](db[_0x1803('0x13')],{'as':'Agents','through':_0x1803('0x3b'),'foreignKey':_0x1803('0x17d')});db[_0x1803('0x63')][_0x1803('0x11b')](db[_0x1803('0xe1')],{'through':_0x1803('0x180'),'as':_0x1803('0x150')});db['ChatWebsite']['hasMany'](db[_0x1803('0x7d')],{'as':_0x1803('0x15b'),'foreignKey':_0x1803('0x16b'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x133')][_0x1803('0x10b')](db[_0x1803('0x7c')],{'as':_0x1803('0x171'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db[_0x1803('0x6e')],{'as':_0x1803('0x181')});db['ChatWebsite'][_0x1803('0x10b')](db[_0x1803('0x67')],{'as':_0x1803('0x15d')});db[_0x1803('0x133')][_0x1803('0x10b')](db[_0x1803('0x65')],{'as':'Applications'});db['ChatWebsite'][_0x1803('0x10b')](db['ChatMessage'],{'as':'Messages'});db[_0x1803('0x133')][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db['ChatWebsite'][_0x1803('0x119')](db[_0x1803('0x80')],{'as':_0x1803('0x80'),'foreignKey':_0x1803('0x14c')});db[_0x1803('0x133')][_0x1803('0x119')](db[_0x1803('0x40')],{'as':_0x1803('0x40'),'foreignKey':_0x1803('0x158')});db['ChatWebsite'][_0x1803('0x119')](db['Pause'],{'as':_0x1803('0x14d'),'foreignKey':_0x1803('0x14e')});db[_0x1803('0x133')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':'Agents','through':_0x1803('0x135')});db[_0x1803('0x182')][_0x1803('0x119')](db[_0x1803('0x139')],{});db[_0x1803('0x182')][_0x1803('0x119')](db['CmList'],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0x182')][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db[_0x1803('0x182')][_0x1803('0x119')](db[_0x1803('0x112')],{});db[_0x1803('0x182')][_0x1803('0x119')](db[_0x1803('0x62')],{});db[_0x1803('0x182')][_0x1803('0x119')](db[_0x1803('0x13')],{});db['OpenchannelQueueReport'][_0x1803('0x119')](db[_0x1803('0x63')],{});db[_0x1803('0x65')][_0x1803('0x119')](db[_0x1803('0x13')],{'as':'Agent','foreignKey':'UserId','onDelete':'restrict'});db[_0x1803('0x65')][_0x1803('0x119')](db['ChatQueue'],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0x1803('0x16c')});db[_0x1803('0x65')]['belongsTo'](db[_0x1803('0x133')],{'as':_0x1803('0x183'),'foreignKey':_0x1803('0x16b'),'onDelete':'restrict'});db['ChatApplication'][_0x1803('0x119')](db[_0x1803('0x8b')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x1803('0x67')][_0x1803('0x10b')](db[_0x1803('0x68')],{'as':_0x1803('0x15c'),'onDelete':_0x1803('0x10a'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0x1803('0x119')](db['ChatWebsite'],{'as':'Account','foreignKey':'ChatWebsiteId'});db['ChatInteraction'][_0x1803('0x119')](db['CmContact'],{'as':'Contact','foreignKey':_0x1803('0x157')});db[_0x1803('0x67')][_0x1803('0x119')](db[_0x1803('0x13')],{'as':_0x1803('0x165'),'foreignKey':'UserId'});db[_0x1803('0x67')][_0x1803('0x11b')](db[_0x1803('0x8b')],{'through':_0x1803('0x184'),'as':_0x1803('0x167')});db['ChatInteraction'][_0x1803('0x11b')](db[_0x1803('0x8b')],{'through':_0x1803('0x184'),'as':_0x1803('0x168')});db[_0x1803('0x67')]['belongsToMany'](db[_0x1803('0x13')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x1803('0x185')});db['ChatMessage']['belongsTo'](db[_0x1803('0x13')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x13')});db['ChatMessage'][_0x1803('0x119')](db['CmContact'],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x164'),'foreignKey':'ContactId'});db[_0x1803('0x68')][_0x1803('0x119')](db[_0x1803('0x67')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x169'),'foreignKey':_0x1803('0x185')});db[_0x1803('0x68')][_0x1803('0x119')](db[_0x1803('0xe6')],{'as':_0x1803('0xe6'),'foreignKey':'AttachmentId'});db[_0x1803('0x68')][_0x1803('0x119')](db['ChatWebsite'],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x16b')});db['ChatOfflineMessage'][_0x1803('0x10b')](db[_0x1803('0xe6')],{'as':_0x1803('0x186'),'foreignKey':_0x1803('0x187'),'onDelete':_0x1803('0x10a'),'hooks':!![]});db[_0x1803('0x69')]['belongsTo'](db[_0x1803('0x72')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db[_0x1803('0x69')][_0x1803('0x119')](db[_0x1803('0x133')],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x16b')});db[_0x1803('0x6b')][_0x1803('0x11b')](db['User'],{'as':_0x1803('0x161'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x1803('0x11b')](db[_0x1803('0xe1')],{'through':_0x1803('0x188'),'as':_0x1803('0x150')});db[_0x1803('0x6d')][_0x1803('0x10b')](db[_0x1803('0xd1')],{'as':'Messages','foreignKey':_0x1803('0x189'),'onDelete':_0x1803('0x10a')});db['ChatGroup'][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':_0x1803('0x145'),'through':_0x1803('0x18a')});db['ChatProactiveAction']['belongsTo'](db['ChatWebsite'],{'as':_0x1803('0x183'),'foreignKey':_0x1803('0x16b')});db[_0x1803('0x70')]['hasMany'](db[_0x1803('0x72')],{'as':_0x1803('0x11d'),'foreignKey':_0x1803('0x18b')});db[_0x1803('0x72')]['hasMany'](db['CmHopper'],{'as':_0x1803('0x147'),'foreignKey':_0x1803('0x157')});db[_0x1803('0x72')]['hasMany'](db[_0x1803('0x10f')],{'as':_0x1803('0x110'),'foreignKey':_0x1803('0x157')});db[_0x1803('0x72')][_0x1803('0x10b')](db['CmHopperHistory'],{'as':_0x1803('0x148'),'foreignKey':'ContactId'});db[_0x1803('0x72')][_0x1803('0x10b')](db[_0x1803('0x77')],{'as':_0x1803('0x77'),'foreignKey':_0x1803('0x157')});db['CmContact'][_0x1803('0x10b')](db[_0x1803('0xd5')],{'as':_0x1803('0x18c'),'foreignKey':_0x1803('0x157')});db['CmContact']['hasMany'](db[_0x1803('0x112')],{'as':_0x1803('0x127'),'foreignKey':_0x1803('0x157'),'onDelete':_0x1803('0x16c')});db[_0x1803('0x72')][_0x1803('0x10b')](db[_0x1803('0x67')],{'as':'ChatInteractions','foreignKey':_0x1803('0x157'),'onDelete':_0x1803('0x16c')});db['CmContact'][_0x1803('0x10b')](db[_0x1803('0x5b')],{'as':_0x1803('0x114'),'foreignKey':_0x1803('0x157'),'onDelete':_0x1803('0x16c')});db[_0x1803('0x72')][_0x1803('0x10b')](db[_0x1803('0x53')],{'as':_0x1803('0x115'),'foreignKey':_0x1803('0x157'),'onDelete':_0x1803('0x16c')});db['CmContact']['hasMany'](db[_0x1803('0x123')],{'as':_0x1803('0x116'),'foreignKey':_0x1803('0x157'),'onDelete':'restrict'});db[_0x1803('0x72')]['belongsTo'](db[_0x1803('0x70')],{'as':_0x1803('0x18d'),'foreignKey':_0x1803('0x18b')});db['CmContact']['belongsTo'](db['CmList'],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f'),'onDelete':_0x1803('0x10a')});db['CmContact']['belongsToMany'](db[_0x1803('0x13')],{'as':'Users','through':'cm_user_has_contacts'});db[_0x1803('0x72')]['belongsToMany'](db[_0x1803('0x8b')],{'as':_0x1803('0x167'),'through':_0x1803('0x18e')});db[_0x1803('0x72')][_0x1803('0x11b')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x1803('0x168')});db[_0x1803('0x18f')][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157'),'onDelete':_0x1803('0x10a')});db['CmHopper']['belongsTo'](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x18f')][_0x1803('0x119')](db[_0x1803('0x13')],{'as':'Agent','foreignKey':'UserId'});db[_0x1803('0x18f')]['belongsTo'](db[_0x1803('0x1d')],{'as':_0x1803('0x190'),'foreignKey':_0x1803('0x146'),'onDelete':'cascade'});db['CmHopper'][_0x1803('0x119')](db[_0x1803('0x191')],{'as':'Campaign','foreignKey':_0x1803('0x192'),'onDelete':_0x1803('0x10a')});db['CmHopper'][_0x1803('0x119')](db[_0x1803('0x13')],{'as':_0x1803('0x165'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x193')][_0x1803('0x119')](db['CmList'],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x193')]['belongsTo'](db[_0x1803('0x1d')],{'as':_0x1803('0x190'),'foreignKey':_0x1803('0x146'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x193')][_0x1803('0x119')](db[_0x1803('0x191')],{'as':'Campaign','foreignKey':_0x1803('0x192'),'onDelete':'cascade'});db[_0x1803('0x7a')][_0x1803('0x10b')](db[_0x1803('0x194')],{'as':{'plural':_0x1803('0x195'),'singular':'OneAll'},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x1803('0x7a')]['hasMany'](db[_0x1803('0x194')],{'as':{'plural':_0x1803('0x196'),'singular':'OneAny'},'foreignKey':'AutomationAnyId','onDelete':_0x1803('0x10a'),'hooks':!![]});db[_0x1803('0x7a')][_0x1803('0x10b')](db['Action'],{'as':_0x1803('0x197'),'foreignKey':_0x1803('0x198'),'onDelete':_0x1803('0x10a'),'hooks':!![]});db[_0x1803('0x7d')]['hasMany'](db[_0x1803('0x7d')],{'as':_0x1803('0x15b'),'foreignKey':_0x1803('0x199'),'onDelete':_0x1803('0x10a')});db[_0x1803('0x80')]['hasMany'](db[_0x1803('0x80')],{'as':_0x1803('0x19a'),'foreignKey':'IntervalId','onDelete':_0x1803('0x10a'),'hooks':!![],'required':![]});db[_0x1803('0x80')][_0x1803('0x10b')](db['VoiceExtension'],{'as':_0x1803('0x10e'),'foreignKey':_0x1803('0x14c'),'onDelete':_0x1803('0x16c')});db[_0x1803('0x80')][_0x1803('0x10b')](db[_0x1803('0x48')],{'as':'MailApplications','foreignKey':_0x1803('0x14c')});db['Interval']['hasMany'](db['ChatApplication'],{'as':_0x1803('0x19b'),'foreignKey':_0x1803('0x14c')});db['Interval'][_0x1803('0x10b')](db['FaxApplication'],{'as':_0x1803('0x19c'),'foreignKey':_0x1803('0x14c')});db[_0x1803('0x80')][_0x1803('0x10b')](db[_0x1803('0x5a')],{'as':_0x1803('0x19d'),'foreignKey':_0x1803('0x14c')});db['Schedule'][_0x1803('0x119')](db['MailAccount'],{});db[_0x1803('0x88')][_0x1803('0x119')](db['AnalyticDefaultReport'],{'foreignKey':_0x1803('0x19e')});db['Schedule'][_0x1803('0x119')](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db['Sound'][_0x1803('0x11b')](db[_0x1803('0x1b')],{'as':_0x1803('0x19f'),'through':_0x1803('0x144'),'onDelete':_0x1803('0x16c')});db[_0x1803('0x8b')]['belongsToMany'](db[_0x1803('0x72')],{'through':_0x1803('0x18e')});db[_0x1803('0x8b')][_0x1803('0x11b')](db[_0x1803('0x67')],{'through':_0x1803('0x184')});db[_0x1803('0x8b')][_0x1803('0x11b')](db[_0x1803('0x123')],{'through':_0x1803('0x166')});db['Tag'][_0x1803('0x11b')](db[_0x1803('0x5b')],{'through':_0x1803('0x179')});db[_0x1803('0x8b')][_0x1803('0x11b')](db['FaxInteraction'],{'through':_0x1803('0x173')});db[_0x1803('0x8b')][_0x1803('0x11b')](db[_0x1803('0x112')],{'through':'openchannel_interaction_has_tags'});db[_0x1803('0x8b')][_0x1803('0x11b')](db[_0x1803('0xf9')],{'through':_0x1803('0x1a0')});db[_0x1803('0x8e')]['hasMany'](db['Condition'],{'as':{'plural':_0x1803('0x1a1'),'singular':_0x1803('0x1a2')},'foreignKey':_0x1803('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x1803('0x8e')][_0x1803('0x10b')](db[_0x1803('0x194')],{'as':{'plural':_0x1803('0x1a4'),'singular':_0x1803('0x1a5')},'foreignKey':_0x1803('0x1a6'),'onDelete':_0x1803('0x10a'),'hooks':!![]});db['Trigger'][_0x1803('0x10b')](db[_0x1803('0x79')],{'as':_0x1803('0x197'),'foreignKey':_0x1803('0x1a7'),'onDelete':_0x1803('0x10a'),'hooks':!![]});db[_0x1803('0x1a8')]['hasMany'](db[_0x1803('0x97')],{'as':'Fields','onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1a9'),'hooks':!![]});db[_0x1803('0x1aa')][_0x1803('0x10b')](db[_0x1803('0x97')],{'as':'Fields','onDelete':_0x1803('0x10a'),'foreignKey':'DefaultReportId'});db[_0x1803('0x95')][_0x1803('0x10b')](db['AnalyticFieldReport'],{'as':_0x1803('0x1ab'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1ac')});db[_0x1803('0x97')][_0x1803('0x119')](db['AnalyticMetric'],{'foreignKey':'MetricId'});db[_0x1803('0x1ad')][_0x1803('0x10b')](db[_0x1803('0x9c')],{'as':'Configurations','onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0x9c')][_0x1803('0x10b')](db['SalesforceField'],{'as':_0x1803('0x1af'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0x9c')][_0x1803('0x10b')](db[_0x1803('0x9e')],{'as':'Descriptions','onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0x9c')][_0x1803('0x10b')](db[_0x1803('0x9e')],{'as':_0x1803('0x1ab'),'onDelete':_0x1803('0x10a'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0x1803('0x119')](db['SalesforceAccount'],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0x9e')][_0x1803('0x10b')](db[_0x1803('0x9e')],{'as':'Subject','foreignKey':_0x1803('0x1b0')});db[_0x1803('0x9e')][_0x1803('0x10b')](db[_0x1803('0x9e')],{'as':_0x1803('0x1b2'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0x9e')][_0x1803('0x10b')](db['SalesforceField'],{'as':'Field','foreignKey':_0x1803('0x1b3')});db[_0x1803('0x9e')][_0x1803('0x119')](db[_0x1803('0x1b4')],{'as':'Variable','foreignKey':_0x1803('0x1b5')});db[_0x1803('0x1b6')]['hasMany'](db[_0x1803('0xa1')],{'as':_0x1803('0x1b7'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xa1')][_0x1803('0x10b')](db['SugarcrmField'],{'as':_0x1803('0x1af'),'onDelete':_0x1803('0x10a'),'foreignKey':'SubjectId'});db[_0x1803('0xa1')][_0x1803('0x10b')](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0xa1')]['hasMany'](db[_0x1803('0xa2')],{'as':'Fields','onDelete':_0x1803('0x10a'),'foreignKey':'FieldId'});db[_0x1803('0xa1')]['belongsTo'](db[_0x1803('0x1b6')],{'as':_0x1803('0x16a'),'foreignKey':'AccountId'});db[_0x1803('0xa2')][_0x1803('0x10b')](db[_0x1803('0xa2')],{'as':'Subject','foreignKey':_0x1803('0x1b0')});db['SugarcrmField'][_0x1803('0x10b')](db['SugarcrmField'],{'as':_0x1803('0x1b2'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0x1803('0x10b')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x1803('0x1b3')});db[_0x1803('0xa2')]['belongsTo'](db[_0x1803('0x1b4')],{'as':'Variable','foreignKey':'VariableId'});db[_0x1803('0x1b8')]['hasMany'](db[_0x1803('0xa5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1803('0x1ae')});db['DeskConfiguration'][_0x1803('0x10b')](db['DeskField'],{'as':'Subjects','onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xa5')]['hasMany'](db[_0x1803('0xa7')],{'as':_0x1803('0x1b9'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0xa5')]['hasMany'](db[_0x1803('0xa7')],{'as':_0x1803('0x1ab'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b3')});db[_0x1803('0xa5')]['belongsTo'](db[_0x1803('0x1b8')],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xa5')]['belongsToMany'](db[_0x1803('0x8b')],{'through':_0x1803('0x1ba')});db[_0x1803('0xa7')][_0x1803('0x10b')](db[_0x1803('0xa7')],{'as':_0x1803('0x1bb'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xa7')][_0x1803('0x10b')](db[_0x1803('0xa7')],{'as':_0x1803('0x1b2'),'foreignKey':'DescriptionId'});db['DeskField'][_0x1803('0x10b')](db['DeskField'],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db[_0x1803('0xa7')]['belongsTo'](db[_0x1803('0x1b4')],{'as':_0x1803('0x1b4'),'foreignKey':_0x1803('0x1b5')});db['ZohoAccount'][_0x1803('0x10b')](db[_0x1803('0xab')],{'as':_0x1803('0x1b7'),'onDelete':_0x1803('0x10a'),'foreignKey':'AccountId'});db[_0x1803('0xab')][_0x1803('0x10b')](db['ZohoField'],{'as':_0x1803('0x1af'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xab')]['hasMany'](db[_0x1803('0xac')],{'as':_0x1803('0x1b9'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0xab')][_0x1803('0x10b')](db[_0x1803('0xac')],{'as':_0x1803('0x1ab'),'onDelete':_0x1803('0x10a'),'foreignKey':'FieldId'});db[_0x1803('0xab')][_0x1803('0x119')](db['ZohoAccount'],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x1ae')});db['ZohoField'][_0x1803('0x10b')](db[_0x1803('0xac')],{'as':_0x1803('0x1bb'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xac')][_0x1803('0x10b')](db['ZohoField'],{'as':'Description','foreignKey':_0x1803('0x1b1')});db['ZohoField'][_0x1803('0x10b')](db['ZohoField'],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db['ZohoField']['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0x1803('0xae')][_0x1803('0x10b')](db[_0x1803('0xb0')],{'as':_0x1803('0x1b7'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xb0')][_0x1803('0x10b')](db[_0x1803('0x1bd')],{'as':'Subjects','foreignKey':_0x1803('0x1b0')});db[_0x1803('0xb0')][_0x1803('0x10b')](db['ZendeskField'],{'as':_0x1803('0x1b9'),'foreignKey':_0x1803('0x1b1')});db['ZendeskConfiguration'][_0x1803('0x10b')](db[_0x1803('0x1bd')],{'as':_0x1803('0x1ab'),'foreignKey':'FieldId'});db[_0x1803('0xb0')][_0x1803('0x119')](db['ZendeskAccount'],{'as':'Account','foreignKey':_0x1803('0x1ae')});db[_0x1803('0xb0')][_0x1803('0x11b')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x1803('0x1bd')][_0x1803('0x10b')](db[_0x1803('0x1bd')],{'as':'Subject','foreignKey':_0x1803('0x1b0')});db[_0x1803('0x1bd')][_0x1803('0x10b')](db['ZendeskField'],{'as':_0x1803('0x1b2'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0x1bd')]['hasMany'](db[_0x1803('0x1bd')],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db[_0x1803('0x1bd')]['belongsTo'](db['Variable'],{'as':_0x1803('0x1b4'),'foreignKey':_0x1803('0x1b5')});db[_0x1803('0x1be')]['hasMany'](db[_0x1803('0xb4')],{'as':_0x1803('0x1b7'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x1803('0xb4')][_0x1803('0x10b')](db[_0x1803('0xb6')],{'as':_0x1803('0x1af'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xb4')][_0x1803('0x10b')](db['FreshdeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x1803('0xb4')][_0x1803('0x10b')](db[_0x1803('0xb6')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x1803('0x1b3')});db[_0x1803('0xb4')][_0x1803('0x119')](db[_0x1803('0x1be')],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xb4')][_0x1803('0x11b')](db['Tag'],{'through':_0x1803('0x1bf')});db['FreshdeskField'][_0x1803('0x10b')](db[_0x1803('0xb6')],{'as':_0x1803('0x1bb'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xb6')][_0x1803('0x10b')](db[_0x1803('0xb6')],{'as':_0x1803('0x1b2'),'foreignKey':_0x1803('0x1b1')});db['FreshdeskField'][_0x1803('0x10b')](db[_0x1803('0xb6')],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db['FreshdeskField'][_0x1803('0x119')](db['Variable'],{'as':_0x1803('0x1b4'),'foreignKey':_0x1803('0x1b5')});db[_0x1803('0xb8')][_0x1803('0x10b')](db[_0x1803('0xb9')],{'as':_0x1803('0x1b7'),'onDelete':'cascade','foreignKey':_0x1803('0x1ae')});db[_0x1803('0xb9')][_0x1803('0x10b')](db[_0x1803('0xbb')],{'as':'Subjects','foreignKey':_0x1803('0x1b0')});db[_0x1803('0xb9')][_0x1803('0x10b')](db['VtigerField'],{'as':'Descriptions','foreignKey':_0x1803('0x1b1')});db['VtigerConfiguration']['hasMany'](db[_0x1803('0xbb')],{'as':_0x1803('0x1ab'),'foreignKey':_0x1803('0x1b3')});db[_0x1803('0xb9')][_0x1803('0x119')](db[_0x1803('0xb8')],{'as':'Account','foreignKey':_0x1803('0x1ae')});db['VtigerField'][_0x1803('0x10b')](db['VtigerField'],{'as':_0x1803('0x1bb'),'foreignKey':'SubjectId'});db[_0x1803('0xbb')][_0x1803('0x10b')](db[_0x1803('0xbb')],{'as':'Description','foreignKey':_0x1803('0x1b1')});db['VtigerField'][_0x1803('0x10b')](db[_0x1803('0xbb')],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db[_0x1803('0xbb')][_0x1803('0x119')](db[_0x1803('0x1b4')],{'as':_0x1803('0x1b4'),'foreignKey':_0x1803('0x1b5')});db['ServicenowAccount'][_0x1803('0x10b')](db[_0x1803('0xbf')],{'as':_0x1803('0x1b7'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xbf')]['hasMany'](db[_0x1803('0xc1')],{'as':_0x1803('0x1af'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xbf')][_0x1803('0x10b')](db['ServicenowField'],{'as':_0x1803('0x1b9'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0xbf')]['hasMany'](db['ServicenowField'],{'as':_0x1803('0x1ab'),'foreignKey':_0x1803('0x1b3')});db['ServicenowConfiguration'][_0x1803('0x119')](db[_0x1803('0xbd')],{'as':'Account','foreignKey':'AccountId'});db['ServicenowField'][_0x1803('0x10b')](db['ServicenowField'],{'as':_0x1803('0x1bb'),'foreignKey':'SubjectId'});db[_0x1803('0xc1')][_0x1803('0x10b')](db[_0x1803('0xc1')],{'as':_0x1803('0x1b2'),'foreignKey':'DescriptionId'});db[_0x1803('0xc1')][_0x1803('0x10b')](db[_0x1803('0xc1')],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db[_0x1803('0xc1')][_0x1803('0x119')](db[_0x1803('0x1b4')],{'as':_0x1803('0x1b4'),'foreignKey':_0x1803('0x1b5')});db['Dynamics365Account'][_0x1803('0x10b')](db[_0x1803('0xc4')],{'as':_0x1803('0x1b7'),'onDelete':_0x1803('0x10a'),'foreignKey':'AccountId'});db[_0x1803('0xc4')][_0x1803('0x10b')](db[_0x1803('0xc6')],{'as':_0x1803('0x1af'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b0')});db['Dynamics365Configuration'][_0x1803('0x10b')](db['Dynamics365Field'],{'as':_0x1803('0x1b9'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0xc4')][_0x1803('0x10b')](db[_0x1803('0xc6')],{'as':_0x1803('0x1ab'),'onDelete':'cascade','foreignKey':_0x1803('0x1b3')});db['Dynamics365Configuration'][_0x1803('0x119')](db[_0x1803('0xc3')],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xc6')][_0x1803('0x10b')](db[_0x1803('0xc6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x1803('0xc6')]['hasMany'](db[_0x1803('0xc6')],{'as':_0x1803('0x1b2'),'foreignKey':_0x1803('0x1b1')});db[_0x1803('0xc6')]['hasMany'](db[_0x1803('0xc6')],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db[_0x1803('0xc6')]['belongsTo'](db[_0x1803('0x1b4')],{'as':_0x1803('0x1b4'),'foreignKey':_0x1803('0x1b5')});db[_0x1803('0x1c0')][_0x1803('0x10b')](db[_0x1803('0xc9')],{'as':_0x1803('0x1b7'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xc9')][_0x1803('0x10b')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x1803('0x1b0')});db[_0x1803('0xc9')][_0x1803('0x10b')](db[_0x1803('0xcb')],{'as':'Descriptions','foreignKey':'DescriptionId'});db[_0x1803('0xc9')][_0x1803('0x10b')](db[_0x1803('0xcb')],{'as':_0x1803('0x1ab'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0x1803('0x119')](db[_0x1803('0x1c0')],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x1ae')});db[_0x1803('0xcb')]['hasMany'](db[_0x1803('0xcb')],{'as':_0x1803('0x1bb'),'foreignKey':_0x1803('0x1b0')});db[_0x1803('0xcb')][_0x1803('0x10b')](db[_0x1803('0xcb')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1803('0xcb')]['hasMany'](db[_0x1803('0xcb')],{'as':_0x1803('0x1bc'),'foreignKey':_0x1803('0x1b3')});db['FreshsalesField']['belongsTo'](db[_0x1803('0x1b4')],{'as':_0x1803('0x1b4'),'foreignKey':_0x1803('0x1b5')});db[_0x1803('0x1c1')]['belongsTo'](db['ChatWebsite'],{});db[_0x1803('0x1c1')][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':'List','foreignKey':_0x1803('0x15f')});db[_0x1803('0x1c1')][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db['ChatQueueReport'][_0x1803('0x119')](db['ChatInteraction'],{});db[_0x1803('0x1c1')][_0x1803('0x119')](db['ChatMessage'],{});db[_0x1803('0x1c1')][_0x1803('0x119')](db[_0x1803('0x13')],{});db[_0x1803('0x1c1')][_0x1803('0x119')](db[_0x1803('0x6b')],{});db['ChatInternalMessage'][_0x1803('0x119')](db[_0x1803('0x13')],{'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1c2')});db[_0x1803('0xd1')][_0x1803('0x119')](db[_0x1803('0x13')],{'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x1c3')});db['JscriptySessionReport'][_0x1803('0x10b')](db[_0x1803('0xd4')],{'foreignKey':_0x1803('0x1c4'),'onDelete':_0x1803('0x10a')});db[_0x1803('0xd5')][_0x1803('0x10b')](db['JscriptyAnswerReport'],{'foreignKey':'SessionId','onDelete':_0x1803('0x10a')});db[_0x1803('0xd6')]['belongsTo'](db['SmsAccount'],{});db['SmsQueueReport'][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':'ListId'});db[_0x1803('0xd6')]['belongsTo'](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db[_0x1803('0xd6')][_0x1803('0x119')](db[_0x1803('0x5b')],{});db[_0x1803('0xd6')]['belongsTo'](db[_0x1803('0x5d')],{});db[_0x1803('0xd6')]['belongsTo'](db[_0x1803('0x13')],{});db[_0x1803('0xd6')][_0x1803('0x119')](db[_0x1803('0x12f')],{});db['JscriptyProject']['hasMany'](db[_0x1803('0xd5')],{'foreignKey':'ProjectId'});db['JscriptyProject']['hasMany'](db[_0x1803('0xd4')],{'foreignKey':_0x1803('0x1c5')});db[_0x1803('0x1c6')][_0x1803('0x10b')](db[_0x1803('0xd3')],{'foreignKey':'ProjectId'});db['SquareProject'][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':'Users','through':_0x1803('0x141')});db[_0x1803('0xe1')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':_0x1803('0x161'),'through':_0x1803('0x122')});db['Team'][_0x1803('0x11b')](db[_0x1803('0x1d')],{'through':_0x1803('0x106'),'as':_0x1803('0x12a')});db[_0x1803('0xe1')][_0x1803('0x11b')](db[_0x1803('0x42')],{'through':_0x1803('0x1c7'),'as':_0x1803('0x12b')});db[_0x1803('0xe1')][_0x1803('0x11b')](db['ChatQueue'],{'through':_0x1803('0x188'),'as':_0x1803('0x12c')});db[_0x1803('0xe1')]['belongsToMany'](db[_0x1803('0x12d')],{'through':_0x1803('0x176'),'as':_0x1803('0x12e')});db[_0x1803('0xe1')][_0x1803('0x11b')](db[_0x1803('0x12f')],{'through':_0x1803('0x1c8'),'as':_0x1803('0x130')});db[_0x1803('0xe1')][_0x1803('0x11b')](db[_0x1803('0x63')],{'through':_0x1803('0x180'),'as':_0x1803('0x1c9')});db[_0x1803('0xe1')]['belongsToMany'](db[_0x1803('0x100')],{'through':_0x1803('0x1ca'),'as':_0x1803('0x131')});db[_0x1803('0x191')]['hasMany'](db[_0x1803('0x18f')],{'as':_0x1803('0x147'),'foreignKey':_0x1803('0x192')});db[_0x1803('0x191')][_0x1803('0x10b')](db[_0x1803('0x10f')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0x1803('0x191')][_0x1803('0x10b')](db[_0x1803('0x76')],{'as':'HopperHistories','foreignKey':_0x1803('0x192')});db['Campaign'][_0x1803('0x10b')](db[_0x1803('0x193')],{'as':_0x1803('0x1cb'),'foreignKey':_0x1803('0x192')});db[_0x1803('0x191')][_0x1803('0x119')](db[_0x1803('0x2c')],{'as':_0x1803('0x2c'),'foreignKey':_0x1803('0x149')});db[_0x1803('0x191')][_0x1803('0x119')](db['Trunk'],{'as':_0x1803('0x14a'),'foreignKey':_0x1803('0x14b')});db['Campaign']['belongsTo'](db[_0x1803('0x80')],{'as':_0x1803('0x80'),'foreignKey':'IntervalId'});db[_0x1803('0x191')][_0x1803('0x119')](db['SquareProject'],{'as':_0x1803('0xdc'),'foreignKey':_0x1803('0x1cc')});db[_0x1803('0x191')][_0x1803('0x11b')](db[_0x1803('0x11f')],{'as':_0x1803('0x120'),'through':_0x1803('0x1cd')});db[_0x1803('0x191')][_0x1803('0x11b')](db[_0x1803('0x11f')],{'as':_0x1803('0x151'),'through':'campaigns_has_cm_blacklists'});db['Attachment'][_0x1803('0x119')](db['ChatOfflineMessage'],{'as':_0x1803('0x69'),'foreignKey':_0x1803('0x187')});db[_0x1803('0xe7')][_0x1803('0x119')](db[_0x1803('0x46')],{});db[_0x1803('0xe7')][_0x1803('0x119')](db[_0x1803('0x123')],{});db[_0x1803('0xe7')][_0x1803('0x119')](db[_0x1803('0x40')],{'foreignKey':_0x1803('0x1ce'),'as':_0x1803('0x1cf')});db[_0x1803('0xe7')][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':_0x1803('0x1d0'),'as':_0x1803('0x1d1')});db[_0x1803('0xe7')][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':_0x1803('0x1d2'),'as':_0x1803('0x1d3')});db['MailTransferReport'][_0x1803('0x119')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0x1803('0x1d4')});db[_0x1803('0xe7')][_0x1803('0x119')](db[_0x1803('0x40')],{'foreignKey':_0x1803('0x1d5'),'as':_0x1803('0x1d6')});db[_0x1803('0xe9')]['belongsTo'](db[_0x1803('0x68')],{});db[_0x1803('0xe9')][_0x1803('0x119')](db[_0x1803('0x67')],{});db[_0x1803('0xe9')]['belongsTo'](db[_0x1803('0x133')],{'foreignKey':_0x1803('0x1d7'),'as':'FromAccount'});db[_0x1803('0xe9')][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':_0x1803('0x1d0'),'as':_0x1803('0x1d1')});db[_0x1803('0xe9')]['belongsTo'](db[_0x1803('0x13')],{'foreignKey':'ToUserId','as':_0x1803('0x1d3')});db['ChatTransferReport']['belongsTo'](db['ChatQueue'],{'foreignKey':_0x1803('0x1d8'),'as':'ToQueue'});db[_0x1803('0xe9')][_0x1803('0x119')](db[_0x1803('0x133')],{'foreignKey':_0x1803('0x1d9'),'as':_0x1803('0x1d6')});db[_0x1803('0xea')][_0x1803('0x119')](db[_0x1803('0x55')],{});db[_0x1803('0xea')][_0x1803('0x119')](db[_0x1803('0x53')],{});db[_0x1803('0xea')]['belongsTo'](db[_0x1803('0x4f')],{'foreignKey':'FromFaxAccountId','as':_0x1803('0x1cf')});db['FaxTransferReport'][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':_0x1803('0x1d0'),'as':_0x1803('0x1d1')});db['FaxTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x1803('0x1d2'),'as':_0x1803('0x1d3')});db[_0x1803('0xea')][_0x1803('0x119')](db[_0x1803('0x12d')],{'foreignKey':_0x1803('0x1da'),'as':_0x1803('0x1d4')});db[_0x1803('0xea')][_0x1803('0x119')](db[_0x1803('0x4f')],{'foreignKey':_0x1803('0x1db'),'as':'ToAccount'});db['OpenchannelTransferReport'][_0x1803('0x119')](db[_0x1803('0x62')],{});db[_0x1803('0x1dc')]['belongsTo'](db[_0x1803('0x112')],{});db[_0x1803('0x1dc')]['belongsTo'](db[_0x1803('0x139')],{'foreignKey':'FromOpenchannelAccountId','as':_0x1803('0x1cf')});db['OpenchannelTransferReport'][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':_0x1803('0x1d0'),'as':'FromAgent'});db['OpenchannelTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x1803('0x1d2'),'as':'ToAgent'});db[_0x1803('0x1dc')]['belongsTo'](db[_0x1803('0x63')],{'foreignKey':_0x1803('0x1dd'),'as':_0x1803('0x1d4')});db[_0x1803('0x1dc')][_0x1803('0x119')](db['OpenchannelAccount'],{'foreignKey':_0x1803('0x1de'),'as':_0x1803('0x1d6')});db['SmsTransferReport'][_0x1803('0x119')](db[_0x1803('0x5d')],{});db[_0x1803('0x1df')]['belongsTo'](db[_0x1803('0x5b')],{});db[_0x1803('0x1df')][_0x1803('0x119')](db[_0x1803('0x13b')],{'foreignKey':'FromSmsAccountId','as':_0x1803('0x1cf')});db[_0x1803('0x1df')][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':'FromUserId','as':_0x1803('0x1d1')});db[_0x1803('0x1df')]['belongsTo'](db[_0x1803('0x13')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x1803('0x1df')][_0x1803('0x119')](db[_0x1803('0x12f')],{'foreignKey':_0x1803('0x1e0'),'as':_0x1803('0x1d4')});db[_0x1803('0x1df')][_0x1803('0x119')](db[_0x1803('0x13b')],{'foreignKey':_0x1803('0x1e1'),'as':_0x1803('0x1d6')});db['CmList']['hasMany'](db[_0x1803('0x7d')],{'as':_0x1803('0x15b'),'foreignKey':'ListId','onDelete':_0x1803('0x10a')});db[_0x1803('0x11f')]['hasMany'](db['CmCustomField'],{'as':_0x1803('0x1e2'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0x11f')][_0x1803('0x10b')](db[_0x1803('0x72')],{'as':_0x1803('0x11d'),'onDelete':_0x1803('0x10a'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0x11f')][_0x1803('0x10b')](db[_0x1803('0x10f')],{'as':_0x1803('0x110'),'foreignKey':_0x1803('0x15f')});db['CmList']['hasMany'](db[_0x1803('0x76')],{'as':'HopperHistory','foreignKey':_0x1803('0x15f')});db[_0x1803('0x11f')][_0x1803('0x10b')](db[_0x1803('0x77')],{'as':'ReportAgentPreview','foreignKey':_0x1803('0x15f')});db[_0x1803('0x11f')][_0x1803('0x11b')](db['VoiceQueue'],{'as':_0x1803('0x1e3'),'through':_0x1803('0x14f')});db[_0x1803('0x11f')]['belongsToMany'](db['User'],{'as':_0x1803('0x161'),'through':'cm_user_has_lists'});db['VoicePrefix'][_0x1803('0x10b')](db[_0x1803('0x19')],{'as':_0x1803('0x10e'),'onDelete':_0x1803('0x10a')});db[_0x1803('0xee')]['belongsToMany'](db['User'],{'as':_0x1803('0x161'),'through':_0x1803('0x1e4')});db[_0x1803('0xf0')][_0x1803('0x10b')](db['User'],{'as':_0x1803('0x174'),'foreignKey':'userProfileId'});db[_0x1803('0xf0')][_0x1803('0x10b')](db[_0x1803('0xf2')],{'as':_0x1803('0x1e5'),'foreignKey':_0x1803('0x11a'),'onDelete':_0x1803('0x10a')});db[_0x1803('0xf2')][_0x1803('0x10b')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x1803('0x1e6'),'onDelete':_0x1803('0x10a')});db[_0x1803('0xf5')][_0x1803('0x10b')](db[_0x1803('0x7d')],{'as':'Dispositions','foreignKey':'WhatsappAccountId','onDelete':_0x1803('0x10a')});db[_0x1803('0xf5')][_0x1803('0x10b')](db[_0x1803('0x7c')],{'as':_0x1803('0x171'),'foreignKey':_0x1803('0x1e7')});db['WhatsappAccount']['hasMany'](db[_0x1803('0xfb')],{'as':_0x1803('0x15c'),'foreignKey':_0x1803('0x1e7')});db['WhatsappAccount'][_0x1803('0x10b')](db['WhatsappInteraction'],{'as':_0x1803('0x15d')});db[_0x1803('0xf5')]['hasMany'](db['WhatsappApplication'],{'as':_0x1803('0x15e')});db[_0x1803('0xf5')]['belongsTo'](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0xf5')][_0x1803('0x119')](db[_0x1803('0x82')],{'as':_0x1803('0x14d'),'foreignKey':_0x1803('0x14e')});db[_0x1803('0xf5')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':'Agents','through':_0x1803('0x13f')});db[_0x1803('0xf7')][_0x1803('0x119')](db[_0x1803('0x13')],{'onDelete':_0x1803('0x16c')});db[_0x1803('0xf7')][_0x1803('0x119')](db[_0x1803('0x100')],{'onDelete':_0x1803('0x16c')});db[_0x1803('0xf7')][_0x1803('0x119')](db[_0x1803('0xf5')],{'onDelete':'restrict'});db[_0x1803('0xf7')][_0x1803('0x119')](db[_0x1803('0x80')],{'onDelete':_0x1803('0x16c'),'foreignKey':_0x1803('0x14c')});db[_0x1803('0xf7')][_0x1803('0x119')](db[_0x1803('0x8b')],{'onDelete':'restrict','foreignKey':_0x1803('0x16d')});db['WhatsappInteraction'][_0x1803('0x10b')](db['WhatsappMessage'],{'as':_0x1803('0x15c'),'onDelete':'cascade','foreignKey':_0x1803('0x1e8')});db[_0x1803('0xf9')]['belongsTo'](db[_0x1803('0xf5')],{'as':_0x1803('0x16a'),'foreignKey':_0x1803('0x1e7')});db[_0x1803('0xf9')][_0x1803('0x119')](db['CmContact'],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db['WhatsappInteraction'][_0x1803('0x119')](db[_0x1803('0x13')],{'as':_0x1803('0x165'),'foreignKey':_0x1803('0x10d')});db[_0x1803('0xf9')][_0x1803('0x11b')](db[_0x1803('0x8b')],{'through':'whatsapp_interaction_has_tags','as':_0x1803('0x167')});db[_0x1803('0xf9')][_0x1803('0x11b')](db[_0x1803('0x8b')],{'through':'whatsapp_interaction_has_tags','as':_0x1803('0x168')});db[_0x1803('0xf9')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':_0x1803('0x174'),'through':_0x1803('0x129'),'foreignKey':_0x1803('0x1e8')});db[_0x1803('0xfb')]['belongsTo'](db[_0x1803('0x13')],{'as':_0x1803('0x13')});db['WhatsappMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x164')});db['WhatsappMessage']['belongsTo'](db[_0x1803('0xf9')],{'onDelete':_0x1803('0x10a'),'as':_0x1803('0x169'),'foreignKey':'WhatsappInteractionId'});db[_0x1803('0xfb')][_0x1803('0x119')](db[_0x1803('0xf5')],{'as':_0x1803('0x16a'),'foreignKey':'WhatsappAccountId'});db[_0x1803('0xfd')][_0x1803('0x119')](db[_0x1803('0xf5')],{});db[_0x1803('0xfd')][_0x1803('0x119')](db[_0x1803('0x11f')],{'as':_0x1803('0x16f'),'foreignKey':_0x1803('0x15f')});db[_0x1803('0xfd')][_0x1803('0x119')](db[_0x1803('0x72')],{'as':_0x1803('0x164'),'foreignKey':_0x1803('0x157')});db[_0x1803('0xfd')][_0x1803('0x119')](db['WhatsappInteraction'],{});db['WhatsappQueueReport'][_0x1803('0x119')](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x1803('0xfb')],{});db['WhatsappQueueReport'][_0x1803('0x119')](db['User'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x1803('0xfb')],{});db[_0x1803('0xfe')][_0x1803('0x119')](db[_0x1803('0xf9')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x1803('0xf5')],{'foreignKey':_0x1803('0x1e9'),'as':_0x1803('0x1cf')});db[_0x1803('0xfe')]['belongsTo'](db[_0x1803('0xf5')],{'foreignKey':'ToWhatsappAccountId','as':_0x1803('0x1d6')});db['WhatsappTransferReport'][_0x1803('0x119')](db[_0x1803('0x100')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0x1803('0xfe')][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':_0x1803('0x1d0'),'as':_0x1803('0x1d1')});db['WhatsappTransferReport'][_0x1803('0x119')](db[_0x1803('0x13')],{'foreignKey':_0x1803('0x1d2'),'as':'ToAgent'});db[_0x1803('0x100')][_0x1803('0x11b')](db[_0x1803('0x13')],{'as':'Agents','through':_0x1803('0x3c'),'foreignKey':_0x1803('0x1ea')});db[_0x1803('0x100')][_0x1803('0x11b')](db[_0x1803('0xe1')],{'through':'team_has_whatsapp_queues','as':_0x1803('0x150')});module[_0x1803('0x1eb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 2b9b0eb..c3fc290 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x013e=['./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','./api/chatWebsite','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','/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/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integrationReport','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/license','./api/migration','/api/attachments','./api/attachment','/api/plugins','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','/api/auth/local','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/apidoc','static','join','root','/www','/demo','snippet','3.0.0','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','username','password','newPassword','firstName','lastName','phone','mobile','email','clientSecret','securityToken','tenantId','token','channelSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','accesskeyid','key','pass','localstationid','dsn','secret','registry','isPlainObject','length','isString','replace','@@{','}@@','includes','path','express-winston','util','./config/logger','api','default','use','logger','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','headers','connection','remoteAddress','url','statusCode','responseTime','user','name','role','inspect','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/fax/reports/queue'];(function(_0x2d0657,_0x4a9b38){var _0x3b269f=function(_0x2bfb43){while(--_0x2bfb43){_0x2d0657['push'](_0x2d0657['shift']());}};_0x3b269f(++_0x4a9b38);}(_0x013e,0xf4));var _0xe013=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x013e[_0x39ea42];return _0x33f5b7;};'use strict';var _=require('lodash');var path=require(_0xe013('0x0'));var express=require('express');var ewinston=require(_0xe013('0x1'));var util=require(_0xe013('0x2'));var errors=require('./errors');var config=require('./config/environment');var logger=require(_0xe013('0x3'))(_0xe013('0x4'));var authLogger=require(_0xe013('0x3'))('auth');exports[_0xe013('0x5')]=function(_0x2fb724){_0x2fb724[_0xe013('0x6')](ewinston[_0xe013('0x7')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0xf9f88,_0x3a5914){var _0x2fd49b='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0xe013('0x8')](_0xf9f88[_0xe013('0x9')])){_0x2fd49b+=_0xe013('0xa');var _0x5ae7e0=_0xf9f88[_0xe013('0x9')];maskSensitiveData(_0x5ae7e0);}return util[_0xe013('0xb')](_0x2fd49b,_0xf9f88[_0xe013('0xc')],_0xf9f88['headers'][_0xe013('0xd')]?_0xf9f88[_0xe013('0xe')][_0xe013('0xd')]:_0xf9f88[_0xe013('0xf')][_0xe013('0x10')]||_0xf9f88['ip'],_0xf9f88[_0xe013('0x11')],_0x3a5914[_0xe013('0x12')],_0x3a5914[_0xe013('0x13')],_0xf9f88[_0xe013('0x14')]?_0xf9f88['user']['id']:null,_0xf9f88[_0xe013('0x14')]?_0xf9f88[_0xe013('0x14')][_0xe013('0x15')]:null,_0xf9f88[_0xe013('0x14')]?_0xf9f88['user'][_0xe013('0x16')]:null,_0x5ae7e0?util[_0xe013('0x17')](_0x5ae7e0,![],null):'');}}));_0x2fb724[_0xe013('0x6')](ewinston[_0xe013('0x7')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x52b41b,_0x5762e3){var _0x2e272f='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x52b41b[_0xe013('0x9')]&&_0x52b41b[_0xe013('0x9')][_0xe013('0x18')]&&_0x52b41b[_0xe013('0x9')][_0xe013('0x19')]){_0x2e272f=_0xe013('0x1a');}return util[_0xe013('0xb')](_0x2e272f,_0x52b41b[_0xe013('0xc')],_0x52b41b['headers'][_0xe013('0xd')]?_0x52b41b['headers'][_0xe013('0xd')]:_0x52b41b[_0xe013('0xf')]['remoteAddress']||_0x52b41b['ip'],_0x52b41b[_0xe013('0x11')],_0x5762e3[_0xe013('0x12')],_0x5762e3[_0xe013('0x13')],_0x52b41b[_0xe013('0x14')]?_0x52b41b[_0xe013('0x14')]['id']:null,_0x52b41b[_0xe013('0x14')]?_0x52b41b[_0xe013('0x14')][_0xe013('0x15')]:null,_0x52b41b[_0xe013('0x14')]?_0x52b41b[_0xe013('0x14')][_0xe013('0x16')]:null,_0x52b41b[_0xe013('0x9')]&&_0x52b41b['body'][_0xe013('0x18')]?_0x52b41b[_0xe013('0x9')]['device']:_0xe013('0x1b'),_0x52b41b[_0xe013('0x9')]&&_0x52b41b['body']['agent_id']?_0x52b41b['body'][_0xe013('0x19')]:'',_0x52b41b[_0xe013('0x9')]&&_0x52b41b['body'][_0xe013('0x1c')]?_0x52b41b[_0xe013('0x9')][_0xe013('0x1c')]:'');},'ignoreRoute':function(_0x529201){var _0x20895b=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x20895b['test'](_0x529201[_0xe013('0x11')]);}}));_0x2fb724['use'](_0xe013('0x1d'),require(_0xe013('0x1e')));_0x2fb724[_0xe013('0x6')]('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x2fb724[_0xe013('0x6')](_0xe013('0x1f'),require(_0xe013('0x20')));_0x2fb724[_0xe013('0x6')](_0xe013('0x21'),require(_0xe013('0x22')));_0x2fb724[_0xe013('0x6')](_0xe013('0x23'),require(_0xe013('0x24')));_0x2fb724[_0xe013('0x6')](_0xe013('0x25'),require('./api/voiceQueue'));_0x2fb724[_0xe013('0x6')](_0xe013('0x26'),require(_0xe013('0x27')));_0x2fb724[_0xe013('0x6')](_0xe013('0x28'),require(_0xe013('0x29')));_0x2fb724['use'](_0xe013('0x2a'),require(_0xe013('0x2b')));_0x2fb724['use'](_0xe013('0x2c'),require(_0xe013('0x2d')));_0x2fb724['use'](_0xe013('0x2e'),require(_0xe013('0x2f')));_0x2fb724[_0xe013('0x6')](_0xe013('0x30'),require(_0xe013('0x31')));_0x2fb724[_0xe013('0x6')](_0xe013('0x32'),require(_0xe013('0x33')));_0x2fb724['use'](_0xe013('0x34'),require(_0xe013('0x35')));_0x2fb724[_0xe013('0x6')](_0xe013('0x36'),require(_0xe013('0x37')));_0x2fb724[_0xe013('0x6')]('/api/trunks',require('./api/trunk'));_0x2fb724[_0xe013('0x6')]('/api/voice/transfers/reports',require(_0xe013('0x38')));_0x2fb724['use'](_0xe013('0x39'),require(_0xe013('0x3a')));_0x2fb724[_0xe013('0x6')]('/api/mail/accounts',require(_0xe013('0x3b')));_0x2fb724['use']('/api/mail/queues',require(_0xe013('0x3c')));_0x2fb724[_0xe013('0x6')](_0xe013('0x3d'),require(_0xe013('0x3e')));_0x2fb724[_0xe013('0x6')]('/api/mail/interactions',require(_0xe013('0x3f')));_0x2fb724[_0xe013('0x6')]('/api/mail/messages',require(_0xe013('0x40')));_0x2fb724[_0xe013('0x6')](_0xe013('0x41'),require('./api/mailApplication'));_0x2fb724[_0xe013('0x6')](_0xe013('0x42'),require(_0xe013('0x43')));_0x2fb724[_0xe013('0x6')](_0xe013('0x44'),require('./api/dashboard'));_0x2fb724['use'](_0xe013('0x45'),require(_0xe013('0x46')));_0x2fb724[_0xe013('0x6')](_0xe013('0x47'),require(_0xe013('0x48')));_0x2fb724[_0xe013('0x6')](_0xe013('0x49'),require(_0xe013('0x4a')));_0x2fb724[_0xe013('0x6')](_0xe013('0x4b'),require('./api/faxInteraction'));_0x2fb724[_0xe013('0x6')](_0xe013('0x4c'),require(_0xe013('0x4d')));_0x2fb724[_0xe013('0x6')](_0xe013('0x4e'),require('./api/faxQueue'));_0x2fb724[_0xe013('0x6')](_0xe013('0x4f'),require(_0xe013('0x50')));_0x2fb724[_0xe013('0x6')]('/api/sms/accounts',require(_0xe013('0x51')));_0x2fb724[_0xe013('0x6')](_0xe013('0x52'),require(_0xe013('0x53')));_0x2fb724[_0xe013('0x6')](_0xe013('0x54'),require(_0xe013('0x55')));_0x2fb724[_0xe013('0x6')](_0xe013('0x56'),require(_0xe013('0x57')));_0x2fb724[_0xe013('0x6')]('/api/sms/queues',require(_0xe013('0x58')));_0x2fb724['use'](_0xe013('0x59'),require(_0xe013('0x5a')));_0x2fb724['use'](_0xe013('0x5b'),require('./api/openchannelApplication'));_0x2fb724['use']('/api/openchannel/interactions',require(_0xe013('0x5c')));_0x2fb724[_0xe013('0x6')](_0xe013('0x5d'),require(_0xe013('0x5e')));_0x2fb724[_0xe013('0x6')]('/api/openchannel/queues',require(_0xe013('0x5f')));_0x2fb724[_0xe013('0x6')]('/api/chat/websites',require(_0xe013('0x60')));_0x2fb724[_0xe013('0x6')]('/api/openchannel/reports/queue',require('./api/openchannelQueueReport'));_0x2fb724['use'](_0xe013('0x61'),require('./api/chatApplication'));_0x2fb724[_0xe013('0x6')](_0xe013('0x62'),require(_0xe013('0x63')));_0x2fb724[_0xe013('0x6')](_0xe013('0x64'),require('./api/chatMessage'));_0x2fb724[_0xe013('0x6')](_0xe013('0x65'),require('./api/chatOfflineMessage'));_0x2fb724[_0xe013('0x6')](_0xe013('0x66'),require(_0xe013('0x67')));_0x2fb724[_0xe013('0x6')](_0xe013('0x68'),require(_0xe013('0x69')));_0x2fb724[_0xe013('0x6')](_0xe013('0x6a'),require(_0xe013('0x6b')));_0x2fb724[_0xe013('0x6')](_0xe013('0x6c'),require('./api/cmCompany'));_0x2fb724[_0xe013('0x6')](_0xe013('0x6d'),require(_0xe013('0x6e')));_0x2fb724['use'](_0xe013('0x6f'),require(_0xe013('0x70')));_0x2fb724[_0xe013('0x6')](_0xe013('0x71'),require(_0xe013('0x72')));_0x2fb724[_0xe013('0x6')]('/api/cm/hopper_final',require(_0xe013('0x73')));_0x2fb724[_0xe013('0x6')](_0xe013('0x74'),require(_0xe013('0x75')));_0x2fb724[_0xe013('0x6')](_0xe013('0x76'),require(_0xe013('0x77')));_0x2fb724['use'](_0xe013('0x78'),require(_0xe013('0x79')));_0x2fb724['use'](_0xe013('0x7a'),require(_0xe013('0x7b')));_0x2fb724[_0xe013('0x6')](_0xe013('0x7c'),require(_0xe013('0x7d')));_0x2fb724[_0xe013('0x6')](_0xe013('0x7e'),require(_0xe013('0x7f')));_0x2fb724[_0xe013('0x6')](_0xe013('0x80'),require('./api/condition'));_0x2fb724[_0xe013('0x6')](_0xe013('0x81'),require(_0xe013('0x82')));_0x2fb724[_0xe013('0x6')](_0xe013('0x83'),require(_0xe013('0x84')));_0x2fb724[_0xe013('0x6')](_0xe013('0x85'),require(_0xe013('0x86')));_0x2fb724[_0xe013('0x6')](_0xe013('0x87'),require(_0xe013('0x88')));_0x2fb724[_0xe013('0x6')](_0xe013('0x89'),require(_0xe013('0x8a')));_0x2fb724[_0xe013('0x6')](_0xe013('0x8b'),require(_0xe013('0x8c')));_0x2fb724[_0xe013('0x6')](_0xe013('0x8d'),require(_0xe013('0x8e')));_0x2fb724[_0xe013('0x6')](_0xe013('0x8f'),require(_0xe013('0x90')));_0x2fb724[_0xe013('0x6')](_0xe013('0x91'),require(_0xe013('0x92')));_0x2fb724[_0xe013('0x6')](_0xe013('0x93'),require(_0xe013('0x94')));_0x2fb724['use'](_0xe013('0x95'),require('./api/integration'));_0x2fb724['use']('/api/integrations/reports',require(_0xe013('0x96')));_0x2fb724[_0xe013('0x6')]('/api/analytics/custom_reports',require(_0xe013('0x97')));_0x2fb724['use']('/api/analytics/default_reports',require(_0xe013('0x98')));_0x2fb724[_0xe013('0x6')](_0xe013('0x99'),require(_0xe013('0x9a')));_0x2fb724[_0xe013('0x6')](_0xe013('0x9b'),require(_0xe013('0x9c')));_0x2fb724[_0xe013('0x6')](_0xe013('0x9d'),require(_0xe013('0x9e')));_0x2fb724[_0xe013('0x6')](_0xe013('0x9f'),require(_0xe013('0xa0')));_0x2fb724[_0xe013('0x6')](_0xe013('0xa1'),require(_0xe013('0xa2')));_0x2fb724[_0xe013('0x6')](_0xe013('0xa3'),require(_0xe013('0xa4')));_0x2fb724[_0xe013('0x6')]('/api/integrations/salesforce/fields',require(_0xe013('0xa5')));_0x2fb724[_0xe013('0x6')]('/api/integrations/sugarcrm/accounts',require('./api/intSugarcrmAccount'));_0x2fb724[_0xe013('0x6')](_0xe013('0xa6'),require(_0xe013('0xa7')));_0x2fb724['use'](_0xe013('0xa8'),require('./api/intSugarcrmField'));_0x2fb724[_0xe013('0x6')]('/api/integrations/desk/accounts',require(_0xe013('0xa9')));_0x2fb724[_0xe013('0x6')](_0xe013('0xaa'),require(_0xe013('0xab')));_0x2fb724[_0xe013('0x6')]('/api/integrations/desk/fields',require(_0xe013('0xac')));_0x2fb724[_0xe013('0x6')](_0xe013('0xad'),require(_0xe013('0xae')));_0x2fb724[_0xe013('0x6')](_0xe013('0xaf'),require(_0xe013('0xb0')));_0x2fb724[_0xe013('0x6')](_0xe013('0xb1'),require(_0xe013('0xb2')));_0x2fb724[_0xe013('0x6')](_0xe013('0xb3'),require('./api/intZendeskAccount'));_0x2fb724[_0xe013('0x6')](_0xe013('0xb4'),require('./api/intZendeskConfiguration'));_0x2fb724[_0xe013('0x6')](_0xe013('0xb5'),require(_0xe013('0xb6')));_0x2fb724['use'](_0xe013('0xb7'),require('./api/intFreshdeskAccount'));_0x2fb724[_0xe013('0x6')]('/api/integrations/freshdesk/configurations',require(_0xe013('0xb8')));_0x2fb724[_0xe013('0x6')](_0xe013('0xb9'),require(_0xe013('0xba')));_0x2fb724[_0xe013('0x6')](_0xe013('0xbb'),require(_0xe013('0xbc')));_0x2fb724[_0xe013('0x6')]('/api/integrations/vtiger/configurations',require(_0xe013('0xbd')));_0x2fb724[_0xe013('0x6')](_0xe013('0xbe'),require('./api/intVtigerField'));_0x2fb724[_0xe013('0x6')](_0xe013('0xbf'),require('./api/intServicenowAccount'));_0x2fb724['use'](_0xe013('0xc0'),require(_0xe013('0xc1')));_0x2fb724[_0xe013('0x6')](_0xe013('0xc2'),require(_0xe013('0xc3')));_0x2fb724['use'](_0xe013('0xc4'),require('./api/intDynamics365Account'));_0x2fb724[_0xe013('0x6')]('/api/integrations/dynamics365/configurations',require(_0xe013('0xc5')));_0x2fb724['use'](_0xe013('0xc6'),require(_0xe013('0xc7')));_0x2fb724['use'](_0xe013('0xc8'),require('./api/intFreshsalesAccount'));_0x2fb724[_0xe013('0x6')](_0xe013('0xc9'),require(_0xe013('0xca')));_0x2fb724[_0xe013('0x6')]('/api/integrations/freshsales/fields',require(_0xe013('0xcb')));_0x2fb724['use'](_0xe013('0xcc'),require('./api/network'));_0x2fb724['use']('/api/chat/reports/queue',require(_0xe013('0xcd')));_0x2fb724[_0xe013('0x6')](_0xe013('0xce'),require(_0xe013('0xcf')));_0x2fb724['use'](_0xe013('0xd0'),require(_0xe013('0xd1')));_0x2fb724[_0xe013('0x6')](_0xe013('0xd2'),require(_0xe013('0xd3')));_0x2fb724[_0xe013('0x6')](_0xe013('0xd4'),require(_0xe013('0xd5')));_0x2fb724[_0xe013('0x6')](_0xe013('0xd6'),require('./api/smsQueueReport'));_0x2fb724[_0xe013('0x6')](_0xe013('0xd7'),require('./api/squareReport'));_0x2fb724[_0xe013('0x6')](_0xe013('0xd8'),require(_0xe013('0xd9')));_0x2fb724[_0xe013('0x6')](_0xe013('0xda'),require(_0xe013('0xdb')));_0x2fb724[_0xe013('0x6')](_0xe013('0xdc'),require('./api/setting'));_0x2fb724[_0xe013('0x6')](_0xe013('0xdd'),require(_0xe013('0xde')));_0x2fb724[_0xe013('0x6')](_0xe013('0xdf'),require('./api/squareProject'));_0x2fb724['use'](_0xe013('0xe0'),require(_0xe013('0xe1')));_0x2fb724[_0xe013('0x6')](_0xe013('0xe2'),require('./api/squareMessage'));_0x2fb724[_0xe013('0x6')]('/api/teams',require('./api/team'));_0x2fb724[_0xe013('0x6')]('/api/license',require(_0xe013('0xe3')));_0x2fb724['use']('/api/campaigns',require('./api/campaign'));_0x2fb724[_0xe013('0x6')]('/api/migrations',require(_0xe013('0xe4')));_0x2fb724['use'](_0xe013('0xe5'),require(_0xe013('0xe6')));_0x2fb724[_0xe013('0x6')](_0xe013('0xe7'),require('./api/plugin'));_0x2fb724['use'](_0xe013('0xe8'),require(_0xe013('0xe9')));_0x2fb724[_0xe013('0x6')]('/api/chat/reports/transfer',require(_0xe013('0xea')));_0x2fb724[_0xe013('0x6')](_0xe013('0xeb'),require(_0xe013('0xec')));_0x2fb724['use'](_0xe013('0xed'),require(_0xe013('0xee')));_0x2fb724[_0xe013('0x6')]('/api/sms/reports/transfer',require(_0xe013('0xef')));_0x2fb724[_0xe013('0x6')](_0xe013('0xf0'),require(_0xe013('0xf1')));_0x2fb724[_0xe013('0x6')](_0xe013('0xf2'),require(_0xe013('0xf3')));_0x2fb724[_0xe013('0x6')](_0xe013('0xf4'),require('./api/userProfile'));_0x2fb724[_0xe013('0x6')]('/api/userProfile/sections',require(_0xe013('0xf5')));_0x2fb724[_0xe013('0x6')](_0xe013('0xf6'),require('./api/userProfileResource'));_0x2fb724[_0xe013('0x6')](_0xe013('0xf7'),require('./api/userNotification'));_0x2fb724[_0xe013('0x6')]('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x2fb724['use'](_0xe013('0xf8'),require(_0xe013('0xf9')));_0x2fb724['use']('/api/whatsapp/interactions',require(_0xe013('0xfa')));_0x2fb724[_0xe013('0x6')](_0xe013('0xfb'),require(_0xe013('0xfc')));_0x2fb724[_0xe013('0x6')]('/api/whatsapp/reports/queue',require(_0xe013('0xfd')));_0x2fb724[_0xe013('0x6')]('/api/whatsapp/reports/transfer',require(_0xe013('0xfe')));_0x2fb724[_0xe013('0x6')](_0xe013('0xff'),require(_0xe013('0x100')));_0x2fb724['use'](_0xe013('0x101'),require('./api/cloudProvider'));_0x2fb724['use'](_0xe013('0x102'),require(_0xe013('0x103')));_0x2fb724[_0xe013('0x6')](_0xe013('0x104'),require('./api/authLocal'));_0x2fb724[_0xe013('0x6')](_0xe013('0x105'),require(_0xe013('0x106')));_0x2fb724['use'](_0xe013('0x107'),require(_0xe013('0x108')));_0x2fb724[_0xe013('0x6')](_0xe013('0x109'),require('./api/rpc'));_0x2fb724[_0xe013('0x6')](_0xe013('0x10a'),require(_0xe013('0x10b')));_0x2fb724[_0xe013('0x6')](_0xe013('0x10c'),require(_0xe013('0x10d')));_0x2fb724[_0xe013('0x6')](_0xe013('0x10e'),require(_0xe013('0x10f')));_0x2fb724[_0xe013('0x6')](_0xe013('0x110'),require(_0xe013('0x111')));_0x2fb724['use'](_0xe013('0x112'),express[_0xe013('0x113')](path[_0xe013('0x114')](config[_0xe013('0x115')],_0xe013('0x112'))));_0x2fb724[_0xe013('0x6')]('/www',express[_0xe013('0x113')](path['join'](config[_0xe013('0x115')],_0xe013('0x116'))));_0x2fb724['use']('/demo',express['static'](path[_0xe013('0x114')](config[_0xe013('0x115')],_0xe013('0x117'))));_0x2fb724['use']('/snippet',express['static'](path['join'](config[_0xe013('0x115')],_0xe013('0x118'),_0xe013('0x119'))));_0x2fb724[_0xe013('0x6')](_0xe013('0x11a'),express[_0xe013('0x113')](path[_0xe013('0x114')](config[_0xe013('0x115')],'/server/files/plugins')));_0x2fb724[_0xe013('0x11b')](_0xe013('0x11c'))[_0xe013('0x11d')](errors[0x194]);_0x2fb724[_0xe013('0x11b')]('/*')['get'](function(_0x42a38b,_0x4a661a){_0x4a661a['sendFile'](path[_0xe013('0x11e')](_0x2fb724['get'](_0xe013('0x11f'))+_0xe013('0x120')));});};var sensitiveFields=[_0xe013('0x121'),_0xe013('0x122'),_0xe013('0x123'),'apiKey',_0xe013('0x124'),_0xe013('0x125'),'street',_0xe013('0x126'),_0xe013('0x127'),'fax',_0xe013('0x128'),'clientId',_0xe013('0x129'),_0xe013('0x12a'),'code','accessKey',_0xe013('0x12b'),_0xe013('0x12c'),_0xe013('0x12d'),'accessToken','accessTokenSecret',_0xe013('0x12e'),_0xe013('0x12f'),_0xe013('0x130'),_0xe013('0x131'),_0xe013('0x132'),_0xe013('0x133'),_0xe013('0x134'),_0xe013('0x135'),'clientEmail','privateKey',_0xe013('0x136'),'secretaccesskey',_0xe013('0x137'),_0xe013('0x14'),_0xe013('0x138'),'accountSid',_0xe013('0x139'),_0xe013('0x13a'),_0xe013('0x13b'),_0xe013('0x13c'),'oldPassword'];function maskSensitiveData(_0x2f9e60){var _0x21539c=/(?!^)[\s\S](?!$)/g;if(!_[_0xe013('0x13d')](_0x2f9e60))return;for(var _0x371b50 in _0x2f9e60){if(_['isArray'](_0x2f9e60[_0x371b50])){for(var _0x1c50a3=0x0;_0x1c50a3<_0x2f9e60[_0x371b50][_0xe013('0x13e')];_0x1c50a3++){maskSensitiveData(_0x2f9e60[_0x371b50][_0x1c50a3]);}}else if(_[_0xe013('0x13d')](_0x2f9e60[_0x371b50])){maskSensitiveData(_0x2f9e60[_0x371b50]);}else if(_[_0xe013('0x13f')](_0x2f9e60[_0x371b50])){_0x2f9e60[_0x371b50]=_0x2f9e60[_0x371b50][_0xe013('0x140')](/{{{/g,_0xe013('0x141'))[_0xe013('0x140')](/}}}/g,_0xe013('0x142'))[_0xe013('0x140')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0xe013('0x143')](sensitiveFields,_0x371b50)){_0x2f9e60[_0x371b50]=_0x2f9e60[_0x371b50][_0xe013('0x140')](_0x21539c,'*');}}}} \ No newline at end of file +var _0xa153=['code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','pass','accountSid','localstationid','dsn','secret','registry','isPlainObject','length','isString','@@{','}@@','replace','lodash','path','express-winston','util','./errors','./config/environment','api','auth','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','\x20body=%s','body','format','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','user','name','role','inspect','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','url','other','agent_id','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/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/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','/api/integrations','./api/integration','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/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/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','join','root','/apidoc','static','/demo','snippet','3.0.0','/plugins','/:url(api|auth|components|app|bower_components|assets)/*','get','route','sendFile','resolve','appPath','username','password','newPassword','firstName','lastName','mobile','fax','email','clientId','securityToken'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0xa153,0x15e));var _0x3a15=function(_0x2da068,_0x1327b9){_0x2da068=_0x2da068-0x0;var _0x165503=_0xa153[_0x2da068];return _0x165503;};'use strict';var _=require(_0x3a15('0x0'));var path=require(_0x3a15('0x1'));var express=require('express');var ewinston=require(_0x3a15('0x2'));var util=require(_0x3a15('0x3'));var errors=require(_0x3a15('0x4'));var config=require(_0x3a15('0x5'));var logger=require('./config/logger')(_0x3a15('0x6'));var authLogger=require('./config/logger')(_0x3a15('0x7'));exports['default']=function(_0x565bad){_0x565bad['use'](ewinston[_0x3a15('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3a867d,_0x28a2ff){var _0x4b8dc1=_0x3a15('0x9');if(!_['isEmpty'](_0x3a867d['body'])){_0x4b8dc1+=_0x3a15('0xa');var _0x257213=_0x3a867d[_0x3a15('0xb')];maskSensitiveData(_0x257213);}return util[_0x3a15('0xc')](_0x4b8dc1,_0x3a867d['method'],_0x3a867d[_0x3a15('0xd')][_0x3a15('0xe')]?_0x3a867d[_0x3a15('0xd')][_0x3a15('0xe')]:_0x3a867d[_0x3a15('0xf')][_0x3a15('0x10')]||_0x3a867d['ip'],_0x3a867d['url'],_0x28a2ff[_0x3a15('0x11')],_0x28a2ff[_0x3a15('0x12')],_0x3a867d[_0x3a15('0x13')]?_0x3a867d[_0x3a15('0x13')]['id']:null,_0x3a867d[_0x3a15('0x13')]?_0x3a867d[_0x3a15('0x13')][_0x3a15('0x14')]:null,_0x3a867d[_0x3a15('0x13')]?_0x3a867d['user'][_0x3a15('0x15')]:null,_0x257213?util[_0x3a15('0x16')](_0x257213,![],null):'');}}));_0x565bad[_0x3a15('0x17')](ewinston[_0x3a15('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2f2d4f,_0x54d5d4){var _0x2c10db=_0x3a15('0x18');if(_0x2f2d4f[_0x3a15('0xb')]&&_0x2f2d4f['body'][_0x3a15('0x19')]&&_0x2f2d4f['body']['agent_id']){_0x2c10db=_0x3a15('0x1a');}return util[_0x3a15('0xc')](_0x2c10db,_0x2f2d4f[_0x3a15('0x1b')],_0x2f2d4f[_0x3a15('0xd')]['x-forwarded-for']?_0x2f2d4f['headers'][_0x3a15('0xe')]:_0x2f2d4f[_0x3a15('0xf')][_0x3a15('0x10')]||_0x2f2d4f['ip'],_0x2f2d4f[_0x3a15('0x1c')],_0x54d5d4[_0x3a15('0x11')],_0x54d5d4[_0x3a15('0x12')],_0x2f2d4f[_0x3a15('0x13')]?_0x2f2d4f[_0x3a15('0x13')]['id']:null,_0x2f2d4f[_0x3a15('0x13')]?_0x2f2d4f[_0x3a15('0x13')]['name']:null,_0x2f2d4f[_0x3a15('0x13')]?_0x2f2d4f['user']['role']:null,_0x2f2d4f[_0x3a15('0xb')]&&_0x2f2d4f[_0x3a15('0xb')][_0x3a15('0x19')]?_0x2f2d4f[_0x3a15('0xb')][_0x3a15('0x19')]:_0x3a15('0x1d'),_0x2f2d4f['body']&&_0x2f2d4f[_0x3a15('0xb')][_0x3a15('0x1e')]?_0x2f2d4f[_0x3a15('0xb')][_0x3a15('0x1e')]:'',_0x2f2d4f[_0x3a15('0xb')]&&_0x2f2d4f[_0x3a15('0xb')]['agent_name']?_0x2f2d4f[_0x3a15('0xb')][_0x3a15('0x1f')]:'');},'ignoreRoute':function(_0x581a05){var _0x9fefad=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x9fefad[_0x3a15('0x20')](_0x581a05['url']);}}));_0x565bad['use']('/api/users',require(_0x3a15('0x21')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x22'),require(_0x3a15('0x23')));_0x565bad['use'](_0x3a15('0x24'),require(_0x3a15('0x25')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x26'),require(_0x3a15('0x27')));_0x565bad['use'](_0x3a15('0x28'),require('./api/voiceMusicOnHold'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x29'),require(_0x3a15('0x2a')));_0x565bad[_0x3a15('0x17')]('/api/voice/recordings',require('./api/voiceRecording'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x2b'),require(_0x3a15('0x2c')));_0x565bad['use'](_0x3a15('0x2d'),require('./api/voiceMail'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x2e'),require('./api/voiceMailMessage'));_0x565bad['use'](_0x3a15('0x2f'),require(_0x3a15('0x30')));_0x565bad['use'](_0x3a15('0x31'),require(_0x3a15('0x32')));_0x565bad['use'](_0x3a15('0x33'),require('./api/voiceAgentReport'));_0x565bad[_0x3a15('0x17')]('/api/voice/queues/reports',require(_0x3a15('0x34')));_0x565bad[_0x3a15('0x17')]('/api/members/reports',require(_0x3a15('0x35')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x36'),require('./api/trunk'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x37'),require('./api/voiceTransferReport'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x38'),require(_0x3a15('0x39')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x3a'),require('./api/mailAccount'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x3b'),require(_0x3a15('0x3c')));_0x565bad['use'](_0x3a15('0x3d'),require(_0x3a15('0x3e')));_0x565bad['use']('/api/mail/interactions',require(_0x3a15('0x3f')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x40'),require('./api/mailMessage'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x41'),require(_0x3a15('0x42')));_0x565bad['use'](_0x3a15('0x43'),require(_0x3a15('0x44')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x45'),require(_0x3a15('0x46')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x47'),require(_0x3a15('0x48')));_0x565bad[_0x3a15('0x17')]('/api/fax/accounts',require('./api/faxAccount'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x49'),require(_0x3a15('0x4a')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x4b'),require(_0x3a15('0x4c')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x4d'),require(_0x3a15('0x4e')));_0x565bad['use'](_0x3a15('0x4f'),require('./api/faxQueue'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x50'),require(_0x3a15('0x51')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x52'),require(_0x3a15('0x53')));_0x565bad['use'](_0x3a15('0x54'),require(_0x3a15('0x55')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x56'),require(_0x3a15('0x57')));_0x565bad['use']('/api/sms/messages',require('./api/smsMessage'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x58'),require(_0x3a15('0x59')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x5a'),require(_0x3a15('0x5b')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x5c'),require('./api/openchannelApplication'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x5d'),require('./api/openchannelInteraction'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x5e'),require(_0x3a15('0x5f')));_0x565bad[_0x3a15('0x17')]('/api/openchannel/queues',require(_0x3a15('0x60')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x61'),require('./api/chatWebsite'));_0x565bad[_0x3a15('0x17')]('/api/openchannel/reports/queue',require(_0x3a15('0x62')));_0x565bad['use'](_0x3a15('0x63'),require(_0x3a15('0x64')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x65'),require(_0x3a15('0x66')));_0x565bad['use'](_0x3a15('0x67'),require(_0x3a15('0x68')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x69'),require(_0x3a15('0x6a')));_0x565bad['use']('/api/chat/queues',require('./api/chatQueue'));_0x565bad['use'](_0x3a15('0x6b'),require('./api/chatGroup'));_0x565bad['use'](_0x3a15('0x6c'),require(_0x3a15('0x6d')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x6e'),require(_0x3a15('0x6f')));_0x565bad['use'](_0x3a15('0x70'),require(_0x3a15('0x71')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x72'),require(_0x3a15('0x73')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x74'),require('./api/cmHopperBlack'));_0x565bad['use'](_0x3a15('0x75'),require('./api/cmHopperFinal'));_0x565bad[_0x3a15('0x17')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x565bad['use']('/api/cm/custom_fields',require('./api/cmCustomField'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x76'),require(_0x3a15('0x77')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x78'),require(_0x3a15('0x79')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x7a'),require('./api/cannedAnswer'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x7b'),require(_0x3a15('0x7c')));_0x565bad[_0x3a15('0x17')]('/api/conditions',require(_0x3a15('0x7d')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x7e'),require(_0x3a15('0x7f')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x80'),require('./api/pause'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x81'),require('./api/cdr'));_0x565bad[_0x3a15('0x17')]('/api/voiceQueuesLog',require(_0x3a15('0x82')));_0x565bad[_0x3a15('0x17')]('/api/schedules',require(_0x3a15('0x83')));_0x565bad[_0x3a15('0x17')]('/api/sounds',require(_0x3a15('0x84')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x85'),require(_0x3a15('0x86')));_0x565bad['use'](_0x3a15('0x87'),require(_0x3a15('0x88')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x89'),require(_0x3a15('0x8a')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x8b'),require('./api/variable'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x8c'),require(_0x3a15('0x8d')));_0x565bad[_0x3a15('0x17')]('/api/integrations/reports',require('./api/integrationReport'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x8e'),require(_0x3a15('0x8f')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x90'),require(_0x3a15('0x91')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x92'),require(_0x3a15('0x93')));_0x565bad[_0x3a15('0x17')]('/api/analytics/metrics',require(_0x3a15('0x94')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x95'),require(_0x3a15('0x96')));_0x565bad['use'](_0x3a15('0x97'),require('./api/analyticTreeReport'));_0x565bad['use'](_0x3a15('0x98'),require(_0x3a15('0x99')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x9a'),require(_0x3a15('0x9b')));_0x565bad[_0x3a15('0x17')]('/api/integrations/salesforce/fields',require(_0x3a15('0x9c')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x9d'),require(_0x3a15('0x9e')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x9f'),require(_0x3a15('0xa0')));_0x565bad['use'](_0x3a15('0xa1'),require(_0x3a15('0xa2')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xa3'),require(_0x3a15('0xa4')));_0x565bad[_0x3a15('0x17')]('/api/integrations/desk/configurations',require(_0x3a15('0xa5')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xa6'),require(_0x3a15('0xa7')));_0x565bad[_0x3a15('0x17')]('/api/integrations/zoho/accounts',require(_0x3a15('0xa8')));_0x565bad[_0x3a15('0x17')]('/api/integrations/zoho/configurations',require(_0x3a15('0xa9')));_0x565bad['use'](_0x3a15('0xaa'),require(_0x3a15('0xab')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xac'),require('./api/intZendeskAccount'));_0x565bad['use']('/api/integrations/zendesk/configurations',require(_0x3a15('0xad')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xae'),require(_0x3a15('0xaf')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xb0'),require(_0x3a15('0xb1')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xb2'),require(_0x3a15('0xb3')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xb4'),require(_0x3a15('0xb5')));_0x565bad['use']('/api/integrations/vtiger/accounts',require(_0x3a15('0xb6')));_0x565bad['use'](_0x3a15('0xb7'),require(_0x3a15('0xb8')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xb9'),require(_0x3a15('0xba')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xbb'),require('./api/intServicenowAccount'));_0x565bad[_0x3a15('0x17')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x565bad[_0x3a15('0x17')](_0x3a15('0xbc'),require(_0x3a15('0xbd')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xbe'),require('./api/intDynamics365Account'));_0x565bad[_0x3a15('0x17')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x565bad[_0x3a15('0x17')]('/api/integrations/dynamics365/fields',require(_0x3a15('0xbf')));_0x565bad['use'](_0x3a15('0xc0'),require('./api/intFreshsalesAccount'));_0x565bad['use'](_0x3a15('0xc1'),require(_0x3a15('0xc2')));_0x565bad[_0x3a15('0x17')]('/api/integrations/freshsales/fields',require(_0x3a15('0xc3')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xc4'),require(_0x3a15('0xc5')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xc6'),require(_0x3a15('0xc7')));_0x565bad['use']('/api/chat/internal/messages',require(_0x3a15('0xc8')));_0x565bad[_0x3a15('0x17')]('/api/jscripty/answers/reports',require(_0x3a15('0xc9')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xca'),require(_0x3a15('0xcb')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xcc'),require(_0x3a15('0xcd')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xce'),require(_0x3a15('0xcf')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xd0'),require(_0x3a15('0xd1')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xd2'),require('./api/squareReportDetail'));_0x565bad[_0x3a15('0x17')](_0x3a15('0xd3'),require('./api/jscriptyProject'));_0x565bad[_0x3a15('0x17')](_0x3a15('0xd4'),require(_0x3a15('0xd5')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xd6'),require(_0x3a15('0xd7')));_0x565bad[_0x3a15('0x17')]('/api/square/projects',require('./api/squareProject'));_0x565bad[_0x3a15('0x17')]('/api/square/recordings',require(_0x3a15('0xd8')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xd9'),require('./api/squareMessage'));_0x565bad[_0x3a15('0x17')](_0x3a15('0xda'),require(_0x3a15('0xdb')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xdc'),require(_0x3a15('0xdd')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xde'),require(_0x3a15('0xdf')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xe0'),require('./api/migration'));_0x565bad[_0x3a15('0x17')]('/api/attachments',require(_0x3a15('0xe1')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xe2'),require(_0x3a15('0xe3')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xe4'),require(_0x3a15('0xe5')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xe6'),require(_0x3a15('0xe7')));_0x565bad['use']('/api/fax/reports/transfer',require(_0x3a15('0xe8')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xe9'),require(_0x3a15('0xea')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xeb'),require(_0x3a15('0xec')));_0x565bad[_0x3a15('0x17')]('/api/cm/lists',require(_0x3a15('0xed')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xee'),require(_0x3a15('0xef')));_0x565bad['use'](_0x3a15('0xf0'),require('./api/userProfile'));_0x565bad[_0x3a15('0x17')](_0x3a15('0xf1'),require('./api/userProfileSection'));_0x565bad[_0x3a15('0x17')]('/api/userProfile/resources',require(_0x3a15('0xf2')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xf3'),require('./api/userNotification'));_0x565bad['use'](_0x3a15('0xf4'),require(_0x3a15('0xf5')));_0x565bad['use']('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x565bad[_0x3a15('0x17')](_0x3a15('0xf6'),require(_0x3a15('0xf7')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xf8'),require(_0x3a15('0xf9')));_0x565bad['use'](_0x3a15('0xfa'),require(_0x3a15('0xfb')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xfc'),require(_0x3a15('0xfd')));_0x565bad[_0x3a15('0x17')](_0x3a15('0xfe'),require(_0x3a15('0xff')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x100'),require(_0x3a15('0x101')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x102'),require('./api/realtime'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x103'),require(_0x3a15('0x104')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x105'),require(_0x3a15('0x106')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x107'),require(_0x3a15('0x108')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x109'),require('./api/rpc'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x10a'),require(_0x3a15('0x10b')));_0x565bad['use'](_0x3a15('0x10c'),require('./api/system'));_0x565bad[_0x3a15('0x17')](_0x3a15('0x10d'),require('./api/pm2'));_0x565bad[_0x3a15('0x17')]('/api/webbar',require('./api/webbar'));_0x565bad[_0x3a15('0x17')]('/apidoc',express['static'](path[_0x3a15('0x10e')](config[_0x3a15('0x10f')],_0x3a15('0x110'))));_0x565bad['use']('/www',express[_0x3a15('0x111')](path[_0x3a15('0x10e')](config[_0x3a15('0x10f')],'/www')));_0x565bad[_0x3a15('0x17')](_0x3a15('0x112'),express[_0x3a15('0x111')](path[_0x3a15('0x10e')](config['root'],_0x3a15('0x112'))));_0x565bad[_0x3a15('0x17')]('/snippet',express['static'](path[_0x3a15('0x10e')](config[_0x3a15('0x10f')],_0x3a15('0x113'),_0x3a15('0x114'))));_0x565bad[_0x3a15('0x17')](_0x3a15('0x115'),express[_0x3a15('0x111')](path[_0x3a15('0x10e')](config[_0x3a15('0x10f')],'/server/files/plugins')));_0x565bad['route'](_0x3a15('0x116'))[_0x3a15('0x117')](errors[0x194]);_0x565bad[_0x3a15('0x118')]('/*')[_0x3a15('0x117')](function(_0x188b62,_0x21f9ab){_0x21f9ab[_0x3a15('0x119')](path[_0x3a15('0x11a')](_0x565bad[_0x3a15('0x117')](_0x3a15('0x11b'))+'/index.html'));});};var sensitiveFields=[_0x3a15('0x11c'),_0x3a15('0x11d'),_0x3a15('0x11e'),'apiKey',_0x3a15('0x11f'),_0x3a15('0x120'),'street','phone',_0x3a15('0x121'),_0x3a15('0x122'),_0x3a15('0x123'),_0x3a15('0x124'),'clientSecret',_0x3a15('0x125'),_0x3a15('0x126'),_0x3a15('0x127'),_0x3a15('0x128'),_0x3a15('0x129'),'channelSecret',_0x3a15('0x12a'),_0x3a15('0x12b'),'authToken',_0x3a15('0x12c'),_0x3a15('0x12d'),_0x3a15('0x12e'),_0x3a15('0x12f'),_0x3a15('0x130'),_0x3a15('0x131'),_0x3a15('0x132'),_0x3a15('0x133'),'privateKey',_0x3a15('0x134'),_0x3a15('0x135'),'key','user',_0x3a15('0x136'),_0x3a15('0x137'),_0x3a15('0x138'),_0x3a15('0x139'),_0x3a15('0x13a'),_0x3a15('0x13b'),'oldPassword'];function maskSensitiveData(_0x287553){var _0x3f80b2=/(?!^)[\s\S](?!$)/g;if(!_[_0x3a15('0x13c')](_0x287553))return;for(var _0x3b31d8 in _0x287553){if(_['isArray'](_0x287553[_0x3b31d8])){for(var _0x3c48d5=0x0;_0x3c48d5<_0x287553[_0x3b31d8][_0x3a15('0x13d')];_0x3c48d5++){maskSensitiveData(_0x287553[_0x3b31d8][_0x3c48d5]);}}else if(_['isPlainObject'](_0x287553[_0x3b31d8])){maskSensitiveData(_0x287553[_0x3b31d8]);}else if(_[_0x3a15('0x13e')](_0x287553[_0x3b31d8])){_0x287553[_0x3b31d8]=_0x287553[_0x3b31d8]['replace'](/{{{/g,_0x3a15('0x13f'))['replace'](/}}}/g,_0x3a15('0x140'))[_0x3a15('0x141')](/{{/g,'@{')[_0x3a15('0x141')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x3b31d8)){_0x287553[_0x3b31d8]=_0x287553[_0x3b31d8]['replace'](_0x3f80b2,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index e6552e7..c4b56f6 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0697=['RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default'];(function(_0xb35ffd,_0x3541fb){var _0x51499a=function(_0x31ee0e){while(--_0x31ee0e){_0xb35ffd['push'](_0xb35ffd['shift']());}};_0x51499a(++_0x3541fb);}(_0x0697,0x1e4));var _0x7069=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x0697[_0x403c20];return _0x2b271a;};'use strict';var jayson=require(_0x7069('0x0'));var BPromise=require(_0x7069('0x1'));var _=require(_0x7069('0x2'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x2e8de3,_0x325c49){var _0x5a4457={};_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x3')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x5')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x6')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x7')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x8')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x9')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0xa')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/memberReport/memberReport.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0xb')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0xc')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/mailServerIn/mailServerIn.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/mailAccount/mailAccount.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0xd')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/mailInteraction/mailInteraction.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0xe')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0xf')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x10')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x11')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x12')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/faxInteraction/faxInteraction.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x13')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/faxQueue/faxQueue.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x14')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x15')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x16')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x17')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x18')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x19')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x1a')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x1b')));_0x5a4457=_['merge'](_0x5a4457,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x1c')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x1d')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/chatQueue/chatQueue.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x1e')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x1f')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x20')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x21')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x22')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x23')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x24')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/pause/pause.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/sound/sound.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/template/template.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x25')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/variable/variable.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x26')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x27')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x28')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x29')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x2a')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x2b')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x2c')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x2d')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x2e')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x2f')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x30')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/squareReport/squareReport.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x31')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x32')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x33')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/squareRecording/squareRecording.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x34')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x35')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x36')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x37')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x38')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x39')));_0x5a4457=_[_0x7069('0x4')](_0x5a4457,require(_0x7069('0x3a')));_0x5a4457=_['merge'](_0x5a4457,require(_0x7069('0x3b')));var _0x521dd7=jayson[_0x7069('0x3c')](_0x5a4457)['http']();var _0x475045=config[_0x7069('0x3d')][_0x7069('0x3e')]||config['port']+0x1;var _0x17130f=config['rpc']['ip']||_0x7069('0x3f');_0x521dd7['on'](_0x7069('0x40'),function(_0x14d98c){return _0x325c49(_0x14d98c);});_0x521dd7['listen'](_0x475045,_0x17130f,function(){console[_0x7069('0x41')](_0x7069('0x42'),_0x17130f,_0x475045);require('../config/triggers')[_0x7069('0x43')]();return _0x2e8de3(_0x7069('0x44')+_0x17130f+':'+_0x475045);});});}; \ No newline at end of file +var _0x6ab5=['../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','merge','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.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'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6ab5,0x7c));var _0x56ab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x6ab5[_0xfae23b];return _0x200640;};'use strict';var jayson=require(_0x56ab('0x0'));var BPromise=require(_0x56ab('0x1'));var _=require(_0x56ab('0x2'));var config=require(_0x56ab('0x3'));exports[_0x56ab('0x4')]=function(){return new BPromise(function(_0x48cdd4,_0x1ed0f4){var _0x51b5f3={};_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x5')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x6')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x7')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x9')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0xa')));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0xb')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0xc')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0xd')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0xe')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0xf')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x10')));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/mailAccount/mailAccount.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x11')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/mailInteraction/mailInteraction.rpc'));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x12')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x13')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x14')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x15')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x16')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x17')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/faxMessage/faxMessage.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x18')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x19')));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/smsInteraction/smsInteraction.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x1a')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x1b')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x1c')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x1d')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x1e')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x1f')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/chatInteraction/chatInteraction.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x20')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/chatQueue/chatQueue.rpc'));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x21')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x22')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x23')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x24')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x25')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x26')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x27')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x28')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x29')));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/variable/variable.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x2a')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x2b')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x2c')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x2d')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x2e')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x2f')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x30')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x31')));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x32')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x33')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x34')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x35')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x36')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x37')));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/squareOdbc/squareOdbc.rpc'));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/squareProject/squareProject.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x38')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/squareMessage/squareMessage.rpc'));_0x51b5f3=_['merge'](_0x51b5f3,require(_0x56ab('0x39')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x3a')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require('../api/plugin/plugin.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x3b')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x3c')));_0x51b5f3=_['merge'](_0x51b5f3,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x3d')));_0x51b5f3=_[_0x56ab('0x8')](_0x51b5f3,require(_0x56ab('0x3e')));var _0x3dc623=jayson[_0x56ab('0x3f')](_0x51b5f3)[_0x56ab('0x40')]();var _0x29b378=config[_0x56ab('0x41')][_0x56ab('0x42')]||config[_0x56ab('0x42')]+0x1;var _0x3a0b7f=config[_0x56ab('0x41')]['ip']||_0x56ab('0x43');_0x3dc623['on'](_0x56ab('0x44'),function(_0x3ab991){return _0x1ed0f4(_0x3ab991);});_0x3dc623[_0x56ab('0x4')](_0x29b378,_0x3a0b7f,function(){console[_0x56ab('0x45')](_0x56ab('0x46'),_0x3a0b7f,_0x29b378);require(_0x56ab('0x47'))[_0x56ab('0x48')]();return _0x48cdd4(_0x56ab('0x49')+_0x3a0b7f+':'+_0x29b378);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f0f8cae..7a51116 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 _0xb30f=['join','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','call','setEncoding','utf8','setTimeout','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','no\x20code','indexOf','substr','startsWith','split','length','match','error','code','close','timeout','destroy','pipe','command','function','write','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s'];(function(_0x7fbb45,_0x117833){var _0xbc5809=function(_0x49e6f0){while(--_0x49e6f0){_0x7fbb45['push'](_0x7fbb45['shift']());}};_0xbc5809(++_0x117833);}(_0xb30f,0x109));var _0xfb30=function(_0x32e2cc,_0x464fff){_0x32e2cc=_0x32e2cc-0x0;var _0x1591c5=_0xb30f[_0x32e2cc];return _0x1591c5;};'use strict';var util=require(_0xfb30('0x0'));var _=require(_0xfb30('0x1'));var EventEmitter=require(_0xfb30('0x2'))[_0xfb30('0x3')];var AGIReply=require(_0xfb30('0x4'));var AGIError=require('./error');function AGIChannel(_0x10d07c){var _0x1b28df=this,_0x228bc2=new AGIReply(),_0x49c38d=![],_0x12285b={};EventEmitter[_0xfb30('0x5')](_0x1b28df);_0x10d07c[_0xfb30('0x6')](_0xfb30('0x7'));_0x10d07c[_0xfb30('0x8')](0x8*0x3c*0x3c*0x3e8);_0x228bc2['setEncoding'](_0xfb30('0x7'));_0x228bc2['on'](_0xfb30('0x9'),function(_0x519a56){for(var _0x1a4de4 in _0x519a56){_0x1b28df[_0x1a4de4]=_0x519a56[_0x1a4de4];}_0x1b28df[_0xfb30('0xa')]('ready');});_0x228bc2['on'](_0xfb30('0xb'),function(_0x47664e){if(_0x47664e[_0xfb30('0xc')]()==_0xfb30('0xd')){_0x1b28df[_0xfb30('0xa')](_0xfb30('0xd'));return;}if(_0x47664e[_0xfb30('0xe')](0x0,0xb)==_0xfb30('0xf')){_0x49c38d=!![];}if(_0x49c38d){_0x12285b['rx']+=_0x47664e+'\x0a';if(_0x47664e['search'](_0xfb30('0x10'))!=-0x1){_0x49c38d=![];}}else{_0x12285b['rx']=_0x47664e;}if(_0x49c38d){return;}if(typeof _0x12285b['cb']=='function'){var _0x191273=_0x12285b['rx'][_0xfb30('0xe')](0x0,0x3),_0xb95c9e=null,_0x124a3d=null;_0x191273=parseInt(_0x191273);if(isNaN(_0x191273)){_0x12285b['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xfb30('0x11')});return;}if(_0x191273!=0xc8){_0x12285b['cb'](null,{'code':_0x191273,'result':-0x1,'extra':'KO'});return;}_0xb95c9e=_0x12285b['rx'][_0xfb30('0xe')](0x4)['replace']('result=','');if(_0xb95c9e[_0xfb30('0x12')]('\x20')!=-0x1){_0xb95c9e=_0xb95c9e[_0xfb30('0x13')](0x0,_0xb95c9e[_0xfb30('0x12')]('\x20'));}if(_[_0xfb30('0x14')](_0xb95c9e,'-1')){_0xb95c9e=parseInt(_0xb95c9e);}_0x124a3d=_0x12285b['rx'][_0xfb30('0x15')]('\x20');if(_0x124a3d[_0xfb30('0x16')]==0x3){_0x124a3d=_0x124a3d[0x2][_0xfb30('0xe')](0x1,_0x124a3d[0x2]['length']-0x1);}else if(_0x124a3d['length']>0x3){var _0xb1c99e=/\((.+)\)/;var _0x1261e3=_0x12285b['rx'][_0xfb30('0x17')](_0xb1c99e);if(_0x1261e3){_0x124a3d=_0x1261e3[0x1];}else{_0x124a3d=null;}}else{_0x124a3d=null;}_0x12285b['cb'](null,{'code':_0x191273,'result':_0xb95c9e,'extra':_0x124a3d});}});_0x10d07c['on'](_0xfb30('0x18'),function(_0x1099d4){_0x1b28df[_0xfb30('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x1099d4[_0xfb30('0x19')]));});_0x10d07c['on'](_0xfb30('0x1a'),function(){_0x1b28df['emit'](_0xfb30('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x10d07c['on']('timeout',function(){_0x1b28df[_0xfb30('0xa')](_0xfb30('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x10d07c[_0xfb30('0x1c')]();});_0x10d07c[_0xfb30('0x1d')](_0x228bc2);this[_0xfb30('0x1e')]=function(_0x4f563b,_0x47fafa){var _0x4f563b=_0x4f563b||'',_0x47fafa=typeof _0x47fafa==_0xfb30('0x1f')?_0x47fafa:new Function();_0x12285b={'tx':_0x4f563b,'rx':'','cb':_0x47fafa};_0x10d07c[_0xfb30('0x20')](_0x4f563b+'\x0a');},this['close']=function(){_0x10d07c[_0xfb30('0x1c')]();};}util[_0xfb30('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xfb30('0x22')]=function(_0x7e9f3){return this[_0xfb30('0x1e')][_0xfb30('0x23')](this,_0x7e9f3);};AGIChannel[_0xfb30('0x24')][_0xfb30('0x25')]=function(){return this[_0xfb30('0x22')](_0xfb30('0x26'));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x27')]=function(_0x3c5fcb,_0x2a51c6,_0x29d6f7){_0x3c5fcb=_0x3c5fcb===undefined?_0xfb30('0x28'):_0x3c5fcb;_0x2a51c6=_0x2a51c6===undefined?'5':_0x2a51c6;_0x29d6f7=_0x29d6f7===undefined?'1':_0x29d6f7;return this[_0xfb30('0x22')](util[_0xfb30('0x29')](_0xfb30('0x2a'),_0x3c5fcb,_0x2a51c6*0x3e8,_0x29d6f7));};AGIChannel[_0xfb30('0x24')]['noop']=function(_0x36f7a4){_0x36f7a4=_0x36f7a4||_0xfb30('0x2b');return this['sendRequest'](util[_0xfb30('0x29')]('VERBOSE\x20\x22%s\x22',_0x36f7a4));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x2c')]=function(_0x4afecc,_0x593a04){if(_[_0xfb30('0x2d')](_0x593a04)){return this['sendRequest'](util[_0xfb30('0x29')](_0xfb30('0x2e'),_0x4afecc,_0x593a04[_0xfb30('0x2f')](',')));}return this['sendRequest'](util[_0xfb30('0x29')](_0xfb30('0x2e'),_0x4afecc,_0x593a04));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x30')]=function(_0x5dbb75){return this[_0xfb30('0x22')](util[_0xfb30('0x29')](_0xfb30('0x31'),_0x5dbb75));};AGIChannel['prototype'][_0xfb30('0x32')]=function(_0xd017d3){return this['sendRequest'](util[_0xfb30('0x29')]('SET\x20EXTENSION\x20%s',_0xd017d3));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x33')]=function(_0x45e144){return this[_0xfb30('0x22')](util[_0xfb30('0x29')](_0xfb30('0x34'),_0x45e144));};AGIChannel[_0xfb30('0x24')][_0xfb30('0xd')]=function(){return this[_0xfb30('0x22')]('HANGUP');};AGIChannel[_0xfb30('0x24')][_0xfb30('0x35')]=function(_0xb6e1c6,_0x4584fc){var _0x5829da=_[_0xfb30('0x36')](_0x4584fc)||_['isNumber'](_0x4584fc)?_0x4584fc[_0xfb30('0x37')]():_0x4584fc;return this[_0xfb30('0x22')](util['format'](_0xfb30('0x38'),_0xb6e1c6,_0x5829da?_0x5829da[_0xfb30('0x37')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xfb30('0x24')]['sayNumber']=function(_0x2b327a,_0x19d2cc){return this[_0xfb30('0x22')](util[_0xfb30('0x29')]('SAY\x20NUMBER\x20%s\x20%s',_0x2b327a,_0x19d2cc));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x39')]=function(_0x955e05,_0x41c3d3){return this[_0xfb30('0x22')](util[_0xfb30('0x29')](_0xfb30('0x3a'),_0x955e05,_0x41c3d3));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x3b')]=function(_0x592275,_0x2533ee){return this[_0xfb30('0x22')](util[_0xfb30('0x29')](_0xfb30('0x3c'),_0x592275,_0x2533ee));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x3d')]=function(_0x150849,_0x35c579,_0x15f242){_0x35c579=_0x35c579||this[_0xfb30('0x3e')];_0x15f242=_0x15f242||0x1;this[_0xfb30('0x30')](_0x150849);this[_0xfb30('0x32')](_0x35c579);this[_0xfb30('0x33')](_0x15f242);return this[_0xfb30('0x3f')](util[_0xfb30('0x29')](_0xfb30('0x40'),_0x150849,_0x35c579,_0x15f242));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x41')]=function(_0x35ea8f){return this[_0xfb30('0x22')](util[_0xfb30('0x29')](_0xfb30('0x42'),_0x35ea8f));};AGIChannel[_0xfb30('0x24')]['recordFile']=function(_0x3144b5,_0x2c04d7,_0x5d178a,_0x1bc808,_0x7a1c8e,_0x287729){_0x2c04d7=_0x2c04d7||_0xfb30('0x43');_0x5d178a=_0x5d178a||'';_0x1bc808=_0x1bc808===undefined?-0x1:_0x1bc808==='-1'?-0x1:_0x1bc808*0x3e8;_0x7a1c8e=_0x7a1c8e===undefined?'':'s='+_0x7a1c8e;_0x287729=_0x287729?_0xfb30('0x44'):'';return this[_0xfb30('0x22')](util[_0xfb30('0x29')](_0xfb30('0x45'),_0x3144b5,_0x2c04d7,_0x5d178a,_0x1bc808,_0x287729,_0x7a1c8e));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x46')]=function(_0x393f17,_0x55445e){_0x55445e=_0x55445e||'';return this['sendRequest'](util['format']('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x393f17,_0x55445e));};AGIChannel[_0xfb30('0x24')][_0xfb30('0x47')]=function(_0x3dd1bd){return this['exec'](_0xfb30('0x48'),_0x3dd1bd);};AGIChannel[_0xfb30('0x24')][_0xfb30('0x49')]=function(_0x401d09){return this['exec'](_0xfb30('0x4a'),_0x401d09);};AGIChannel['prototype'][_0xfb30('0x18')]=function(_0x1f371f,_0x4b376f){this[_0xfb30('0x3f')](util[_0xfb30('0x29')](_0xfb30('0x4b'),_0x1f371f['id'],_0x1f371f[_0xfb30('0x4c')],_0x4b376f));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xfb30('0x4d')]=AGIChannel; \ No newline at end of file +var _0x9527=['headers','emit','ready','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sync','answer','ANSWER','getData','beep','sendRequest','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','lodash','events','EventEmitter','./error','call','setEncoding','utf8'];(function(_0x41f9b1,_0x559f5c){var _0x2a8caa=function(_0x5a742c){while(--_0x5a742c){_0x41f9b1['push'](_0x41f9b1['shift']());}};_0x2a8caa(++_0x559f5c);}(_0x9527,0x135));var _0x7952=function(_0x41c834,_0x44f5a5){_0x41c834=_0x41c834-0x0;var _0x17e225=_0x9527[_0x41c834];return _0x17e225;};'use strict';var util=require('util');var _=require(_0x7952('0x0'));var EventEmitter=require(_0x7952('0x1'))[_0x7952('0x2')];var AGIReply=require('./reply');var AGIError=require(_0x7952('0x3'));function AGIChannel(_0x67558){var _0x43ebbd=this,_0x22e2a8=new AGIReply(),_0xf20ae8=![],_0x4aca8c={};EventEmitter[_0x7952('0x4')](_0x43ebbd);_0x67558[_0x7952('0x5')]('utf8');_0x67558['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x22e2a8['setEncoding'](_0x7952('0x6'));_0x22e2a8['on'](_0x7952('0x7'),function(_0x4364fb){for(var _0x32d288 in _0x4364fb){_0x43ebbd[_0x32d288]=_0x4364fb[_0x32d288];}_0x43ebbd[_0x7952('0x8')](_0x7952('0x9'));});_0x22e2a8['on']('line',function(_0x5e2fb9){if(_0x5e2fb9['toLowerCase']()==_0x7952('0xa')){_0x43ebbd[_0x7952('0x8')](_0x7952('0xa'));return;}if(_0x5e2fb9[_0x7952('0xb')](0x0,0xb)==_0x7952('0xc')){_0xf20ae8=!![];}if(_0xf20ae8){_0x4aca8c['rx']+=_0x5e2fb9+'\x0a';if(_0x5e2fb9['search'](_0x7952('0xd'))!=-0x1){_0xf20ae8=![];}}else{_0x4aca8c['rx']=_0x5e2fb9;}if(_0xf20ae8){return;}if(typeof _0x4aca8c['cb']==_0x7952('0xe')){var _0x4c5e7c=_0x4aca8c['rx'][_0x7952('0xb')](0x0,0x3),_0xa9b8cf=null,_0x2cfa53=null;_0x4c5e7c=parseInt(_0x4c5e7c);if(isNaN(_0x4c5e7c)){_0x4aca8c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x7952('0xf')});return;}if(_0x4c5e7c!=0xc8){_0x4aca8c['cb'](null,{'code':_0x4c5e7c,'result':-0x1,'extra':'KO'});return;}_0xa9b8cf=_0x4aca8c['rx']['substring'](0x4)[_0x7952('0x10')]('result=','');if(_0xa9b8cf[_0x7952('0x11')]('\x20')!=-0x1){_0xa9b8cf=_0xa9b8cf[_0x7952('0x12')](0x0,_0xa9b8cf['indexOf']('\x20'));}if(_[_0x7952('0x13')](_0xa9b8cf,'-1')){_0xa9b8cf=parseInt(_0xa9b8cf);}_0x2cfa53=_0x4aca8c['rx'][_0x7952('0x14')]('\x20');if(_0x2cfa53[_0x7952('0x15')]==0x3){_0x2cfa53=_0x2cfa53[0x2][_0x7952('0xb')](0x1,_0x2cfa53[0x2][_0x7952('0x15')]-0x1);}else if(_0x2cfa53[_0x7952('0x15')]>0x3){var _0x1e78af=/\((.+)\)/;var _0x11c775=_0x4aca8c['rx'][_0x7952('0x16')](_0x1e78af);if(_0x11c775){_0x2cfa53=_0x11c775[0x1];}else{_0x2cfa53=null;}}else{_0x2cfa53=null;}_0x4aca8c['cb'](null,{'code':_0x4c5e7c,'result':_0xa9b8cf,'extra':_0x2cfa53});}});_0x67558['on'](_0x7952('0x17'),function(_0x3ecb77){_0x43ebbd[_0x7952('0x8')](_0x7952('0x17'),new AGIError(_0x7952('0x18'),_0x3ecb77[_0x7952('0x19')]));});_0x67558['on'](_0x7952('0x1a'),function(){_0x43ebbd[_0x7952('0x8')](_0x7952('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x67558['on'](_0x7952('0x1b'),function(){_0x43ebbd[_0x7952('0x8')](_0x7952('0x1b'),new AGIError(_0x7952('0x1c')));_0x67558[_0x7952('0x1d')]();});_0x67558[_0x7952('0x1e')](_0x22e2a8);this[_0x7952('0x1f')]=function(_0x1ad82d,_0x55d860){var _0x1ad82d=_0x1ad82d||'',_0x55d860=typeof _0x55d860==_0x7952('0xe')?_0x55d860:new Function();_0x4aca8c={'tx':_0x1ad82d,'rx':'','cb':_0x55d860};_0x67558['write'](_0x1ad82d+'\x0a');},this[_0x7952('0x1a')]=function(){_0x67558['destroy']();};}util[_0x7952('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x7952('0x21')]['sendRequest']=function(_0x52bbb8){return this['command'][_0x7952('0x22')](this,_0x52bbb8);};AGIChannel['prototype'][_0x7952('0x23')]=function(){return this['sendRequest'](_0x7952('0x24'));};AGIChannel[_0x7952('0x21')][_0x7952('0x25')]=function(_0xed467b,_0x5d62cd,_0xb565ae){_0xed467b=_0xed467b===undefined?_0x7952('0x26'):_0xed467b;_0x5d62cd=_0x5d62cd===undefined?'5':_0x5d62cd;_0xb565ae=_0xb565ae===undefined?'1':_0xb565ae;return this[_0x7952('0x27')](util[_0x7952('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xed467b,_0x5d62cd*0x3e8,_0xb565ae));};AGIChannel[_0x7952('0x21')][_0x7952('0x29')]=function(_0x353374){_0x353374=_0x353374||_0x7952('0x2a');return this[_0x7952('0x27')](util[_0x7952('0x28')](_0x7952('0x2b'),_0x353374));};AGIChannel[_0x7952('0x21')]['exec']=function(_0x48913b,_0x42fd92){if(_[_0x7952('0x2c')](_0x42fd92)){return this[_0x7952('0x27')](util['format'](_0x7952('0x2d'),_0x48913b,_0x42fd92[_0x7952('0x2e')](',')));}return this['sendRequest'](util[_0x7952('0x28')](_0x7952('0x2d'),_0x48913b,_0x42fd92));};AGIChannel[_0x7952('0x21')][_0x7952('0x2f')]=function(_0x3cf257){return this[_0x7952('0x27')](util['format'](_0x7952('0x30'),_0x3cf257));};AGIChannel['prototype']['setExtension']=function(_0x566c96){return this[_0x7952('0x27')](util[_0x7952('0x28')]('SET\x20EXTENSION\x20%s',_0x566c96));};AGIChannel[_0x7952('0x21')]['setPriority']=function(_0x473f22){return this[_0x7952('0x27')](util['format'](_0x7952('0x31'),_0x473f22));};AGIChannel['prototype'][_0x7952('0xa')]=function(){return this[_0x7952('0x27')](_0x7952('0x32'));};AGIChannel[_0x7952('0x21')][_0x7952('0x33')]=function(_0x173c86,_0x16f589){var _0x4ac759=_[_0x7952('0x34')](_0x16f589)||_[_0x7952('0x35')](_0x16f589)?_0x16f589['toString']():_0x16f589;return this['sendRequest'](util[_0x7952('0x28')](_0x7952('0x36'),_0x173c86,_0x4ac759?_0x4ac759[_0x7952('0x37')]()[_0x7952('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x7952('0x38')]=function(_0x268fec,_0x48f7c7){return this[_0x7952('0x27')](util[_0x7952('0x28')](_0x7952('0x39'),_0x268fec,_0x48f7c7));};AGIChannel['prototype'][_0x7952('0x3a')]=function(_0x14eba1,_0x5650ba){return this[_0x7952('0x27')](util[_0x7952('0x28')](_0x7952('0x3b'),_0x14eba1,_0x5650ba));};AGIChannel[_0x7952('0x21')]['sayPhonetic']=function(_0x48c87f,_0x1e7647){return this[_0x7952('0x27')](util[_0x7952('0x28')](_0x7952('0x3c'),_0x48c87f,_0x1e7647));};AGIChannel[_0x7952('0x21')]['continueAt']=function(_0x10e61a,_0x4a2431,_0x3a8937){_0x4a2431=_0x4a2431||this[_0x7952('0x3d')];_0x3a8937=_0x3a8937||0x1;this['setContext'](_0x10e61a);this[_0x7952('0x3e')](_0x4a2431);this[_0x7952('0x3f')](_0x3a8937);return this[_0x7952('0x29')](util[_0x7952('0x28')](_0x7952('0x40'),_0x10e61a,_0x4a2431,_0x3a8937));};AGIChannel[_0x7952('0x21')][_0x7952('0x41')]=function(_0x29d0da){return this[_0x7952('0x27')](util[_0x7952('0x28')](_0x7952('0x42'),_0x29d0da));};AGIChannel[_0x7952('0x21')][_0x7952('0x43')]=function(_0x51be94,_0x12a9be,_0x13d4c5,_0x2e6dbd,_0xdc578f,_0x23dc6b){_0x12a9be=_0x12a9be||_0x7952('0x44');_0x13d4c5=_0x13d4c5||'';_0x2e6dbd=_0x2e6dbd===undefined?-0x1:_0x2e6dbd==='-1'?-0x1:_0x2e6dbd*0x3e8;_0xdc578f=_0xdc578f===undefined?'':'s='+_0xdc578f;_0x23dc6b=_0x23dc6b?_0x7952('0x45'):'';return this['sendRequest'](util[_0x7952('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x51be94,_0x12a9be,_0x13d4c5,_0x2e6dbd,_0x23dc6b,_0xdc578f));};AGIChannel[_0x7952('0x21')][_0x7952('0x46')]=function(_0x14268b,_0x3d4fc2){_0x3d4fc2=_0x3d4fc2||'';return this[_0x7952('0x27')](util[_0x7952('0x28')](_0x7952('0x47'),_0x14268b,_0x3d4fc2));};AGIChannel['prototype'][_0x7952('0x48')]=function(_0xc20c48){return this[_0x7952('0x49')](_0x7952('0x4a'),_0xc20c48);};AGIChannel[_0x7952('0x21')][_0x7952('0x4b')]=function(_0x24d524){return this[_0x7952('0x49')](_0x7952('0x4c'),_0x24d524);};AGIChannel[_0x7952('0x21')][_0x7952('0x17')]=function(_0x52eb76,_0x565cb9){this[_0x7952('0x29')](util['format'](_0x7952('0x4d'),_0x52eb76['id'],_0x52eb76['label'],_0x565cb9));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7952('0x4e')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 560c981..5b686f8 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 _0x3177=['Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','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.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x3177,0x1b8));var _0x7317=function(_0x12d23a,_0x1cad42){_0x12d23a=_0x12d23a-0x0;var _0x239536=_0x3177[_0x12d23a];return _0x239536;};'use strict';var util=require(_0x7317('0x0'));var error={'E_AGI_UNDEFINED':_0x7317('0x1'),'E_AGI_ARGUMENT_PORT':_0x7317('0x2'),'E_AGI_SERVER_ERROR':_0x7317('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x7317('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x7317('0x5'),'E_AGI_SOCKET_CLOSE':_0x7317('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x7317('0x7'),'E_AGI_COMMAND_EMPTY':_0x7317('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x7317('0x9'),'E_AGI_IVR_ENTRY':_0x7317('0xa')};function AGIError(_0xaa92ec){var _0xaa92ec=_0xaa92ec||null,_0x5bd652=_0x5bd652||[],_0x549cf5=0x1,_0x4828cb='';if(!error[_0xaa92ec]){_0xaa92ec=_0x7317('0xb');}_0x5bd652[_0x7317('0xc')](error[_0xaa92ec]);while(arguments[_0x549cf5]){_0x5bd652[_0x7317('0xc')](arguments[_0x549cf5]);_0x549cf5++;}_0x4828cb=util['format'][_0x7317('0xd')](util,_0x5bd652);this[_0x7317('0xe')]=_0x4828cb;this['name']=_0xaa92ec;}module[_0x7317('0xf')]=AGIError; \ No newline at end of file +var _0xb270=['[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','exports','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xb270,0x159));var _0x0b27=function(_0x3a39f9,_0x1e9da8){_0x3a39f9=_0x3a39f9-0x0;var _0x305044=_0xb270[_0x3a39f9];return _0x305044;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x0b27('0x0'),'E_AGI_SERVER_CLOSE':_0x0b27('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x0b27('0x2'),'E_AGI_SERVER_VOICE_DISABLED':_0x0b27('0x3'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x0b27('0x4'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x0b27('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0b27('0x6')};function AGIError(_0x48a687){var _0x48a687=_0x48a687||null,_0x444627=_0x444627||[],_0x362617=0x1,_0x89a869='';if(!error[_0x48a687]){_0x48a687='E_AGI_UNDEFINED';}_0x444627['push'](error[_0x48a687]);while(arguments[_0x362617]){_0x444627[_0x0b27('0x7')](arguments[_0x362617]);_0x362617++;}_0x89a869=util[_0x0b27('0x8')][_0x0b27('0x9')](util,_0x444627);this[_0x0b27('0xa')]=_0x89a869;this['name']=_0x48a687;}module[_0x0b27('0xb')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index b8710e3..3f7c398 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 _0xd254=['lodash','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','agicommand','vswitch','target','default','invalid','default\x20on\x20switch\x20not\x20found','max\x20retry\x20reach','condition\x20not\x20found','exports'];(function(_0x46d87a,_0x5183db){var _0x115296=function(_0x880a1c){while(--_0x880a1c){_0x46d87a['push'](_0x46d87a['shift']());}};_0x115296(++_0x5183db);}(_0xd254,0x1dc));var _0x4d25=function(_0x4b70bd,_0x115c5d){_0x4b70bd=_0x4b70bd-0x0;var _0x31dada=_0xd254[_0x4b70bd];return _0x31dada;};'use strict';var _=require(_0x4d25('0x0'));var logger=require('../../../config/logger')(_0x4d25('0x1'));var verticesWithRetry=[_0x4d25('0x2'),_0x4d25('0x3'),_0x4d25('0x4')];var Graph=function(){this[_0x4d25('0x5')]={};this[_0x4d25('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0x4d25('0x7')][_0x4d25('0x8')]=function(_0x15b02f){this[_0x4d25('0x5')][_0x15b02f['id']]=_0x15b02f;this['edges'][_0x15b02f['id']]=[];};Graph['prototype']['addEdge']=function(_0x1f566a,_0x514309,_0x320d91){this['edges'][_0x1f566a]['push']({'target':_0x514309,'condition':_0x320d91});this[_0x4d25('0x9')]+=0x1;};Graph[_0x4d25('0x7')][_0x4d25('0xa')]=function(){return _[_0x4d25('0xa')](this[_0x4d25('0x5')]);};Graph['prototype'][_0x4d25('0xb')]=function(){return this['numberOfEdges'];};Graph[_0x4d25('0x7')][_0x4d25('0xc')]=function(_0x2c2802){return this[_0x4d25('0x5')][_0x2c2802];};Graph['prototype'][_0x4d25('0xd')]=function(_0x24aa7a,_0x4cdc52){if(!this[_0x4d25('0x5')][_0x24aa7a]){return logger[_0x4d25('0xe')](_0x4d25('0xf'));}var _0xcfce60=_0x4cdc52(this[_0x4d25('0x5')][_0x24aa7a]);if(!_0xcfce60){return logger['info'](_0x4d25('0x10'));}if(this[_0x4d25('0x6')][_0x24aa7a][_0x4d25('0x11')]===0x0){return logger['info'](_0x4d25('0x12'));}for(var _0x53f06d=0x0,_0x1a8dbd=[],_0x1ace83=![];_0x53f06d\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','hangup','sync','production','start','debug','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','context','extension','priority','agicommand','response','code','result','isUndefined','agicommand\x20not\x20found','finally','toString','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','xml2json','lodash','syncho','util','moment','../../config/environment','agi','../../config/license/util','./mailRpc','./graph','./vertices','127.0.0.1','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','error','format','[%s]\x20%s','[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','dnid','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','evtHangup','mxGraphModel','root','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','addEdge','value','then','createSquareReport','catch','indexOf','substring'];(function(_0x48fd52,_0x1d4420){var _0x204845=function(_0x29d0d2){while(--_0x29d0d2){_0x48fd52['push'](_0x48fd52['shift']());}};_0x204845(++_0x1d4420);}(_0x8b30,0x16e));var _0x08b3=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0x8b30[_0x2555d0];return _0x3bb486;};'use strict';var parser=require(_0x08b3('0x0'));var _=require(_0x08b3('0x1'));var syncho=require(_0x08b3('0x2'));var util=require(_0x08b3('0x3'));var moment=require(_0x08b3('0x4'));var config=require(_0x08b3('0x5'));var logger=require('../../config/logger')(_0x08b3('0x6'));var utilLicense=require(_0x08b3('0x7'));var rpc=require('./rpc');var mailRpc=require(_0x08b3('0x8'));var Graph=require(_0x08b3('0x9'));var Vertices=require(_0x08b3('0xa'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x08b3('0x6')]=_['defaults'](config[_0x08b3('0x6')],{'ip':_0x08b3('0xb'),'port':0x11dd});function connectionHandler(_0x3c77e7){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x3c77e7);agiHandler(_0x3c77e7);}catch(_0x48203e){logger['error'](_0x48203e[_0x08b3('0xc')]);}});});}function listeningHandler(){console[_0x08b3('0xd')](_0x08b3('0xe'),config['agi']['port']);logger['info'](util['format'](_0x08b3('0xf'),config['agi']['ip'],config[_0x08b3('0x6')][_0x08b3('0x10')]));}function errorHandler(_0x30dc7e){if(_0x30dc7e&&_0x30dc7e[_0x08b3('0x11')]&&_0x30dc7e['message']){logger[_0x08b3('0x12')](util[_0x08b3('0x13')](_0x08b3('0x14'),_0x30dc7e[_0x08b3('0x11')],_0x30dc7e['message']));}else{logger[_0x08b3('0x12')](util['format'](_0x08b3('0x15'),_0x30dc7e['stack']));}}function closeHandler(){logger[_0x08b3('0x16')](util[_0x08b3('0x13')](_0x08b3('0x17'),this[_0x08b3('0x18')],this['calleridname'],this[_0x08b3('0x19')],this[_0x08b3('0x1a')],this['uniqueid']));try{createSquareReport(this);}catch(_0x2b2f90){logger[_0x08b3('0x12')](_0x2b2f90[_0x08b3('0xc')]);}}function timeoutHandler(){logger[_0x08b3('0x16')](util[_0x08b3('0x13')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x08b3('0x18')],this['calleridname'],this['callerid'],this[_0x08b3('0x1a')],this[_0x08b3('0x1b')]));}function hangupHandler(){logger[_0x08b3('0x16')](util[_0x08b3('0x13')](_0x08b3('0x1c'),this[_0x08b3('0x18')],this[_0x08b3('0x1d')],this['callerid'],this[_0x08b3('0x1a')],this[_0x08b3('0x1b')]));this[_0x08b3('0x1e')]=!![];}function getRoot(_0x4a678a){return parser['toJson'](_0x4a678a,{'object':!![]})[_0x08b3('0x1f')][_0x08b3('0x20')];}function addVertex(_0x89eb8d,_0x34494a,_0x3d88e8){_0x34494a['agicommand']=_0x3d88e8;if(_0x34494a[_0x08b3('0x21')](_0x08b3('0x22'))){_0x34494a[_0x08b3('0x23')]=parseInt(_0x34494a['retry'],0xa);}_0x89eb8d[_0x08b3('0x24')](_[_0x08b3('0x25')](_0x34494a,_0x08b3('0x26')));}function initGraph(_0x5c12d2,_0x5e944){var _0x402f9a=new Graph();for(var _0x46a30e in _0x5c12d2){if(_0x5c12d2[_0x08b3('0x21')](_0x46a30e)){if(_[_0x08b3('0x27')](_0x5c12d2[_0x46a30e])){for(var _0x5af07c=0x0;_0x5af07c<_0x5c12d2[_0x46a30e][_0x08b3('0x28')];_0x5af07c+=0x1){addVertex(_0x402f9a,_0x5c12d2[_0x46a30e][_0x5af07c],_0x46a30e);}}else{addVertex(_0x402f9a,_0x5c12d2[_0x46a30e],_0x46a30e);}}}for(var _0x17a849=0x0;_0x17a849<_0x5e944[_0x08b3('0x28')];_0x17a849+=0x1){if(_0x5e944[_0x17a849][_0x08b3('0x29')]&&_0x5e944[_0x17a849]['target']){_0x402f9a[_0x08b3('0x2a')](_0x5e944[_0x17a849][_0x08b3('0x29')],_0x5e944[_0x17a849]['target'],_0x5e944[_0x17a849][_0x08b3('0x2b')]);}}return _0x402f9a;}function getSquareProject(_0x5e03d0,_0x51b9ab){rpc['getSquareProject'](_0x5e03d0)[_0x08b3('0x2c')](function(_0x533d8e){_0x51b9ab(null,_0x533d8e);})['catch'](function(_0x5a86e5){_0x51b9ab(null,_0x5a86e5);});}function createSquareReport(_0x2d2bb0,_0x185e72){rpc[_0x08b3('0x2d')](_0x2d2bb0)[_0x08b3('0x2c')](function(_0x4d01ba){if(_0x185e72){_0x185e72(null,_0x4d01ba);}})[_0x08b3('0x2e')](function(_0xdc2fc1){if(_0x185e72){_0x185e72(null,_0xdc2fc1);}});}function setChannelVariables(_0x265555){for(var _0x2589ba in _0x265555){if(_0x265555[_0x08b3('0x21')](_0x2589ba)){if(_0x2589ba[_0x08b3('0x2f')]('agi_')===0x0){_0x265555[_0x2589ba[_0x08b3('0x30')](0x4)]=_0x265555[_0x2589ba];delete _0x265555[_0x2589ba];}}}}function getLogFromObject(_0x438b47){return util['inspect'](_0x438b47,{'showHidden':![],'depth':null});}function agiHandler(_0x386826){var _0x463896,_0x31b536,_0x1da12b,_0x508e09,_0x1ca769;logger['debug'](_0x08b3('0x31'),JSON[_0x08b3('0x32')](_0x386826,null,0x2));logger[_0x08b3('0x16')](util[_0x08b3('0x13')](_0x08b3('0x33'),_0x386826[_0x08b3('0x18')],_0x386826['calleridname'],_0x386826[_0x08b3('0x19')],_0x386826[_0x08b3('0x1a')],_0x386826[_0x08b3('0x1b')]));_0x386826['on'](_0x08b3('0x12'),errorHandler);_0x386826['on']('close',closeHandler);_0x386826['on']('timeout',timeoutHandler);_0x386826[_0x08b3('0x1e')]=![];_0x386826['on'](_0x08b3('0x34'),hangupHandler);var _0x7f3b44=getSquareProject[_0x08b3('0x35')](null,_0x386826['arg_1']);if(_0x7f3b44){if(_0x7f3b44[_0x08b3('0x36')]){_0x463896=getRoot(_0x7f3b44[_0x08b3('0x36')]);if(_0x463896&&_0x463896[_0x08b3('0x37')]){logger[_0x08b3('0x38')](_0x08b3('0x20'),JSON['stringify'](_0x463896,null,0x2));_0x386826['joinAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x31b536=initGraph(_[_0x08b3('0x25')](_0x463896,_0x08b3('0x26')),_0x463896[_0x08b3('0x26')]);_0x1da12b=new Vertices(_0x386826,rpc,mailRpc);logger[_0x08b3('0x16')](util[_0x08b3('0x13')](_0x08b3('0x39'),_0x386826[_0x08b3('0x18')],_0x386826['calleridname'],_0x386826[_0x08b3('0x19')],_0x386826[_0x08b3('0x1a')],_0x386826[_0x08b3('0x1b')]));_0x31b536[_0x08b3('0x3a')](_0x463896[_0x08b3('0x37')]['id'],function(_0x175222){try{_0x175222=_0x1da12b[_0x08b3('0x3b')](_0x175222);logger[_0x08b3('0x38')]('vertex',JSON[_0x08b3('0x32')](_0x175222,null,0x2));if(_0x175222['agicommand']==='gotoc'){logger[_0x08b3('0x16')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x386826[_0x08b3('0x3c')]=_0x175222[_0x08b3('0x3c')]||_0x386826[_0x08b3('0x3c')];_0x386826[_0x08b3('0x3d')]=_0x175222[_0x08b3('0x3d')];_0x386826[_0x08b3('0x3e')]=_0x175222[_0x08b3('0x3e')]?_0x175222[_0x08b3('0x3e')]-0x1:0x1;return null;}else if(_0x175222&&_0x1da12b[_0x175222['agicommand']]){_0x1ca769=_0x1da12b[_0x175222[_0x08b3('0x3f')]](_0x175222);logger[_0x08b3('0x16')](_0x08b3('0x40'),JSON[_0x08b3('0x32')](_0x1ca769,null,0x2));if(_0x1ca769&&_0x1ca769[_0x08b3('0x41')]===AGI_CODE_SUCCESS&&_0x1ca769[_0x08b3('0x42')]!==AGI_RESULT_ERROR&&!_0x386826[_0x08b3('0x1e')]){logger[_0x08b3('0x38')](_0x08b3('0x40'),getLogFromObject(_0x1ca769));return _[_0x08b3('0x43')](_0x1ca769[_0x08b3('0x42')])?null:_0x1ca769['result']['toString']();}else{logger[_0x08b3('0x12')]('response',getLogFromObject(_0x1ca769));return null;}}else{logger[_0x08b3('0x12')](_0x08b3('0x44'));return null;}}catch(_0x45b936){logger[_0x08b3('0x12')](_0x45b936['stack']);return null;}});if(_0x463896[_0x08b3('0x45')]){logger[_0x08b3('0x16')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x386826[_0x08b3('0x18')],_0x386826[_0x08b3('0x1d')],_0x386826[_0x08b3('0x19')],_0x386826[_0x08b3('0x1a')],_0x386826[_0x08b3('0x1b')]));_0x31b536[_0x08b3('0x3a')](_0x463896[_0x08b3('0x45')]['id'],function(_0x10ce87){try{_0x10ce87=_0x1da12b[_0x08b3('0x3b')](_0x10ce87);logger['debug']('vertex',JSON[_0x08b3('0x32')](_0x10ce87,null,0x2));if(_0x10ce87&&_0x1da12b[_0x10ce87[_0x08b3('0x3f')]]){_0x1ca769=_0x1da12b[_0x10ce87[_0x08b3('0x3f')]](_0x10ce87);if(_0x1ca769){logger[_0x08b3('0x38')]('response',getLogFromObject(_0x1ca769));return _[_0x08b3('0x43')](_0x1ca769[_0x08b3('0x42')])?null:_0x1ca769[_0x08b3('0x42')][_0x08b3('0x46')]();}else{logger[_0x08b3('0x12')](_0x08b3('0x40'),getLogFromObject(_0x1ca769));return null;}}else{logger[_0x08b3('0x12')](_0x08b3('0x44'));return null;}}catch(_0x42e729){logger[_0x08b3('0x12')](_0x42e729['stack']);return null;}});}logger[_0x08b3('0x16')](util['format']('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x386826[_0x08b3('0x18')],_0x386826[_0x08b3('0x1d')],_0x386826[_0x08b3('0x19')],_0x386826[_0x08b3('0x1a')],_0x386826[_0x08b3('0x1b')]));logger['info'](util[_0x08b3('0x13')](_0x08b3('0x47'),_0x386826[_0x08b3('0x3c')],_0x386826[_0x08b3('0x3d')],parseInt(_0x386826[_0x08b3('0x3e')],0xa)+0x1));_0x386826[_0x08b3('0x48')](_0x386826[_0x08b3('0x3c')],_0x386826['extension'],parseInt(_0x386826[_0x08b3('0x3e')],0xa)+0x1);_0x386826[_0x08b3('0x49')]();}}else{logger['error'](util[_0x08b3('0x13')]('Project\x20%s\x20not\x20published',_0x386826['arg_1']));_0x386826[_0x08b3('0x48')](_0x386826['context'],_0x386826[_0x08b3('0x3d')],parseInt(_0x386826['priority'],0xa)+0x1);_0x386826['close']();}}else{logger[_0x08b3('0x12')](util[_0x08b3('0x13')](_0x08b3('0x4a'),_0x386826[_0x08b3('0x18')]));_0x386826['continueAt'](_0x386826[_0x08b3('0x3c')],_0x386826[_0x08b3('0x3d')],parseInt(_0x386826[_0x08b3('0x3e')],0xa)+0x1);_0x386826[_0x08b3('0x49')]();}}function main(){var _0x3540b7;return utilLicense[_0x08b3('0x4b')]()[_0x08b3('0x2c')](function(_0x48ed22){if(_0x48ed22){if(_0x48ed22[_0x08b3('0x4c')]){if(_0x48ed22[_0x08b3('0x4d')]&&_0x48ed22[_0x08b3('0x4d')]>0x0){logger[_0x08b3('0x16')](util[_0x08b3('0x13')]('[LICENSE]\x20CHANNELS:\x20%s',_0x48ed22[_0x08b3('0x4d')]));_0x3540b7=_0x48ed22[_0x08b3('0x4d')];}else{logger['info'](_0x08b3('0x4e'));}}else{logger[_0x08b3('0x16')](_0x08b3('0x4f'));_0x3540b7=-0x1;}}})[_0x08b3('0x2e')](function(_0x1e441d){logger[_0x08b3('0x12')](_0x08b3('0x50'),_0x1e441d[_0x08b3('0xc')]);})[_0x08b3('0x45')](function(){var _0x3bcec5=require(_0x08b3('0x51'))(config[_0x08b3('0x6')][_0x08b3('0x10')],config[_0x08b3('0x6')]['ip'],_0x3540b7);_0x3bcec5['on'](_0x08b3('0x12'),errorHandler);_0x3bcec5['on'](_0x08b3('0x52'),listeningHandler);_0x3bcec5['on']('connection',connectionHandler);_0x3bcec5['on'](_0x08b3('0x49'),closeHandler);});}main(); \ No newline at end of file +var _0xe8e2=['substring','inspect','debug','stringify','close','timeout','hangup','sync','production','start','joinAt','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','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','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','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','syncho','util','moment','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./graph','./vertices','defaults','127.0.0.1','nextTick','error','log','port','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','[%s]\x20%s','name','[ERROR]\x20%s','stack','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','uniqueid','arg_1','evtHangup','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','value','getSquareProject','then','createSquareReport','catch','agi_'];(function(_0x52a113,_0x164c4d){var _0x4b4208=function(_0x2a0bcf){while(--_0x2a0bcf){_0x52a113['push'](_0x52a113['shift']());}};_0x4b4208(++_0x164c4d);}(_0xe8e2,0x181));var _0x2e8e=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xe8e2[_0x2adbeb];return _0x5e18a6;};'use strict';var parser=require('xml2json');var _=require('lodash');var syncho=require(_0x2e8e('0x0'));var util=require(_0x2e8e('0x1'));var moment=require(_0x2e8e('0x2'));var config=require(_0x2e8e('0x3'));var logger=require(_0x2e8e('0x4'))(_0x2e8e('0x5'));var utilLicense=require(_0x2e8e('0x6'));var rpc=require(_0x2e8e('0x7'));var mailRpc=require('./mailRpc');var Graph=require(_0x2e8e('0x8'));var Vertices=require(_0x2e8e('0x9'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x2e8e('0x5')]=_[_0x2e8e('0xa')](config[_0x2e8e('0x5')],{'ip':_0x2e8e('0xb'),'port':0x11dd});function connectionHandler(_0x1b883c){process[_0x2e8e('0xc')](function(){syncho(function(){try{setChannelVariables(_0x1b883c);agiHandler(_0x1b883c);}catch(_0x31e50d){logger[_0x2e8e('0xd')](_0x31e50d['stack']);}});});}function listeningHandler(){console[_0x2e8e('0xe')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2e8e('0x5')][_0x2e8e('0xf')]);logger['info'](util[_0x2e8e('0x10')](_0x2e8e('0x11'),config[_0x2e8e('0x5')]['ip'],config[_0x2e8e('0x5')][_0x2e8e('0xf')]));}function errorHandler(_0x2f2a93){if(_0x2f2a93&&_0x2f2a93['name']&&_0x2f2a93['message']){logger['error'](util[_0x2e8e('0x10')](_0x2e8e('0x12'),_0x2f2a93[_0x2e8e('0x13')],_0x2f2a93['message']));}else{logger[_0x2e8e('0xd')](util[_0x2e8e('0x10')](_0x2e8e('0x14'),_0x2f2a93[_0x2e8e('0x15')]));}}function closeHandler(){logger[_0x2e8e('0x16')](util['format'](_0x2e8e('0x17'),this['arg_1'],this[_0x2e8e('0x18')],this[_0x2e8e('0x19')],this[_0x2e8e('0x1a')],this[_0x2e8e('0x1b')]));try{createSquareReport(this);}catch(_0xb3f20e){logger[_0x2e8e('0xd')](_0xb3f20e['stack']);}}function timeoutHandler(){logger['info'](util['format']('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2e8e('0x1c')],this[_0x2e8e('0x18')],this[_0x2e8e('0x19')],this[_0x2e8e('0x1a')],this[_0x2e8e('0x1b')]));}function hangupHandler(){logger['info'](util[_0x2e8e('0x10')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x2e8e('0x1c')],this[_0x2e8e('0x18')],this['callerid'],this[_0x2e8e('0x1a')],this[_0x2e8e('0x1b')]));this[_0x2e8e('0x1d')]=!![];}function getRoot(_0x299f0a){return parser[_0x2e8e('0x1e')](_0x299f0a,{'object':!![]})[_0x2e8e('0x1f')][_0x2e8e('0x20')];}function addVertex(_0x181a87,_0x1daaab,_0x5a11e8){_0x1daaab[_0x2e8e('0x21')]=_0x5a11e8;if(_0x1daaab[_0x2e8e('0x22')](_0x2e8e('0x23'))){_0x1daaab[_0x2e8e('0x24')]=parseInt(_0x1daaab[_0x2e8e('0x23')],0xa);}_0x181a87[_0x2e8e('0x25')](_[_0x2e8e('0x26')](_0x1daaab,_0x2e8e('0x27')));}function initGraph(_0x3a6350,_0x59641c){var _0x522825=new Graph();for(var _0x53f637 in _0x3a6350){if(_0x3a6350[_0x2e8e('0x22')](_0x53f637)){if(_[_0x2e8e('0x28')](_0x3a6350[_0x53f637])){for(var _0x51a4b9=0x0;_0x51a4b9<_0x3a6350[_0x53f637][_0x2e8e('0x29')];_0x51a4b9+=0x1){addVertex(_0x522825,_0x3a6350[_0x53f637][_0x51a4b9],_0x53f637);}}else{addVertex(_0x522825,_0x3a6350[_0x53f637],_0x53f637);}}}for(var _0x415d70=0x0;_0x415d70<_0x59641c[_0x2e8e('0x29')];_0x415d70+=0x1){if(_0x59641c[_0x415d70][_0x2e8e('0x2a')]&&_0x59641c[_0x415d70][_0x2e8e('0x2b')]){_0x522825['addEdge'](_0x59641c[_0x415d70]['source'],_0x59641c[_0x415d70][_0x2e8e('0x2b')],_0x59641c[_0x415d70][_0x2e8e('0x2c')]);}}return _0x522825;}function getSquareProject(_0x105619,_0x4282e9){rpc[_0x2e8e('0x2d')](_0x105619)[_0x2e8e('0x2e')](function(_0xc3b776){_0x4282e9(null,_0xc3b776);})['catch'](function(_0xd7f756){_0x4282e9(null,_0xd7f756);});}function createSquareReport(_0x1f9faf,_0x385220){rpc[_0x2e8e('0x2f')](_0x1f9faf)[_0x2e8e('0x2e')](function(_0x142fde){if(_0x385220){_0x385220(null,_0x142fde);}})[_0x2e8e('0x30')](function(_0x1a6b84){if(_0x385220){_0x385220(null,_0x1a6b84);}});}function setChannelVariables(_0x47ff14){for(var _0x93f462 in _0x47ff14){if(_0x47ff14['hasOwnProperty'](_0x93f462)){if(_0x93f462['indexOf'](_0x2e8e('0x31'))===0x0){_0x47ff14[_0x93f462[_0x2e8e('0x32')](0x4)]=_0x47ff14[_0x93f462];delete _0x47ff14[_0x93f462];}}}}function getLogFromObject(_0x3a7b9a){return util[_0x2e8e('0x33')](_0x3a7b9a,{'showHidden':![],'depth':null});}function agiHandler(_0x42c91e){var _0x557a58,_0x4ec82a,_0x5070be,_0x500475,_0x21ecd4;logger[_0x2e8e('0x34')]('variables',JSON[_0x2e8e('0x35')](_0x42c91e,null,0x2));logger[_0x2e8e('0x16')](util[_0x2e8e('0x10')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x42c91e[_0x2e8e('0x1c')],_0x42c91e['calleridname'],_0x42c91e[_0x2e8e('0x19')],_0x42c91e[_0x2e8e('0x1a')],_0x42c91e[_0x2e8e('0x1b')]));_0x42c91e['on'](_0x2e8e('0xd'),errorHandler);_0x42c91e['on'](_0x2e8e('0x36'),closeHandler);_0x42c91e['on'](_0x2e8e('0x37'),timeoutHandler);_0x42c91e[_0x2e8e('0x1d')]=![];_0x42c91e['on'](_0x2e8e('0x38'),hangupHandler);var _0x28330a=getSquareProject[_0x2e8e('0x39')](null,_0x42c91e[_0x2e8e('0x1c')]);if(_0x28330a){if(_0x28330a[_0x2e8e('0x3a')]){_0x557a58=getRoot(_0x28330a[_0x2e8e('0x3a')]);if(_0x557a58&&_0x557a58[_0x2e8e('0x3b')]){logger['debug'](_0x2e8e('0x20'),JSON[_0x2e8e('0x35')](_0x557a58,null,0x2));_0x42c91e[_0x2e8e('0x3c')]=moment()[_0x2e8e('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x4ec82a=initGraph(_[_0x2e8e('0x26')](_0x557a58,_0x2e8e('0x27')),_0x557a58[_0x2e8e('0x27')]);_0x5070be=new Vertices(_0x42c91e,rpc,mailRpc);logger[_0x2e8e('0x16')](util[_0x2e8e('0x10')](_0x2e8e('0x3d'),_0x42c91e[_0x2e8e('0x1c')],_0x42c91e[_0x2e8e('0x18')],_0x42c91e[_0x2e8e('0x19')],_0x42c91e[_0x2e8e('0x1a')],_0x42c91e[_0x2e8e('0x1b')]));_0x4ec82a[_0x2e8e('0x3e')](_0x557a58[_0x2e8e('0x3b')]['id'],function(_0x12e312){try{_0x12e312=_0x5070be[_0x2e8e('0x3f')](_0x12e312);logger[_0x2e8e('0x34')](_0x2e8e('0x40'),JSON[_0x2e8e('0x35')](_0x12e312,null,0x2));if(_0x12e312[_0x2e8e('0x21')]==='gotoc'){logger[_0x2e8e('0x16')](_0x2e8e('0x41'));_0x42c91e[_0x2e8e('0x42')]=_0x12e312[_0x2e8e('0x42')]||_0x42c91e[_0x2e8e('0x42')];_0x42c91e[_0x2e8e('0x43')]=_0x12e312[_0x2e8e('0x43')];_0x42c91e[_0x2e8e('0x44')]=_0x12e312['priority']?_0x12e312[_0x2e8e('0x44')]-0x1:0x1;return null;}else if(_0x12e312&&_0x5070be[_0x12e312[_0x2e8e('0x21')]]){_0x21ecd4=_0x5070be[_0x12e312[_0x2e8e('0x21')]](_0x12e312);logger['info'](_0x2e8e('0x45'),JSON[_0x2e8e('0x35')](_0x21ecd4,null,0x2));if(_0x21ecd4&&_0x21ecd4['code']===AGI_CODE_SUCCESS&&_0x21ecd4[_0x2e8e('0x46')]!==AGI_RESULT_ERROR&&!_0x42c91e['evtHangup']){logger[_0x2e8e('0x34')]('response',getLogFromObject(_0x21ecd4));return _[_0x2e8e('0x47')](_0x21ecd4[_0x2e8e('0x46')])?null:_0x21ecd4[_0x2e8e('0x46')]['toString']();}else{logger['error'](_0x2e8e('0x45'),getLogFromObject(_0x21ecd4));return null;}}else{logger[_0x2e8e('0xd')](_0x2e8e('0x48'));return null;}}catch(_0x33f6fe){logger[_0x2e8e('0xd')](_0x33f6fe[_0x2e8e('0x15')]);return null;}});if(_0x557a58[_0x2e8e('0x49')]){logger[_0x2e8e('0x16')](util[_0x2e8e('0x10')](_0x2e8e('0x4a'),_0x42c91e[_0x2e8e('0x1c')],_0x42c91e['calleridname'],_0x42c91e[_0x2e8e('0x19')],_0x42c91e[_0x2e8e('0x1a')],_0x42c91e['uniqueid']));_0x4ec82a[_0x2e8e('0x3e')](_0x557a58[_0x2e8e('0x49')]['id'],function(_0x9d9b3f){try{_0x9d9b3f=_0x5070be['clear'](_0x9d9b3f);logger[_0x2e8e('0x34')](_0x2e8e('0x40'),JSON[_0x2e8e('0x35')](_0x9d9b3f,null,0x2));if(_0x9d9b3f&&_0x5070be[_0x9d9b3f[_0x2e8e('0x21')]]){_0x21ecd4=_0x5070be[_0x9d9b3f[_0x2e8e('0x21')]](_0x9d9b3f);if(_0x21ecd4){logger[_0x2e8e('0x34')](_0x2e8e('0x45'),getLogFromObject(_0x21ecd4));return _[_0x2e8e('0x47')](_0x21ecd4[_0x2e8e('0x46')])?null:_0x21ecd4['result'][_0x2e8e('0x4b')]();}else{logger['error'](_0x2e8e('0x45'),getLogFromObject(_0x21ecd4));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x276fbc){logger[_0x2e8e('0xd')](_0x276fbc[_0x2e8e('0x15')]);return null;}});}logger['info'](util[_0x2e8e('0x10')](_0x2e8e('0x4c'),_0x42c91e[_0x2e8e('0x1c')],_0x42c91e[_0x2e8e('0x18')],_0x42c91e['callerid'],_0x42c91e[_0x2e8e('0x1a')],_0x42c91e['uniqueid']));logger[_0x2e8e('0x16')](util[_0x2e8e('0x10')](_0x2e8e('0x4d'),_0x42c91e['context'],_0x42c91e[_0x2e8e('0x43')],parseInt(_0x42c91e[_0x2e8e('0x44')],0xa)+0x1));_0x42c91e[_0x2e8e('0x4e')](_0x42c91e[_0x2e8e('0x42')],_0x42c91e['extension'],parseInt(_0x42c91e[_0x2e8e('0x44')],0xa)+0x1);_0x42c91e[_0x2e8e('0x36')]();}}else{logger[_0x2e8e('0xd')](util['format']('Project\x20%s\x20not\x20published',_0x42c91e[_0x2e8e('0x1c')]));_0x42c91e[_0x2e8e('0x4e')](_0x42c91e[_0x2e8e('0x42')],_0x42c91e[_0x2e8e('0x43')],parseInt(_0x42c91e[_0x2e8e('0x44')],0xa)+0x1);_0x42c91e[_0x2e8e('0x36')]();}}else{logger[_0x2e8e('0xd')](util['format']('Project\x20%s\x20not\x20found',_0x42c91e[_0x2e8e('0x1c')]));_0x42c91e[_0x2e8e('0x4e')](_0x42c91e[_0x2e8e('0x42')],_0x42c91e[_0x2e8e('0x43')],parseInt(_0x42c91e[_0x2e8e('0x44')],0xa)+0x1);_0x42c91e[_0x2e8e('0x36')]();}}function main(){var _0x17ceaa;return utilLicense[_0x2e8e('0x4f')]()['then'](function(_0xdfa829){if(_0xdfa829){if(_0xdfa829['voice']){if(_0xdfa829[_0x2e8e('0x50')]&&_0xdfa829['callysquare']>0x0){logger['info'](util[_0x2e8e('0x10')](_0x2e8e('0x51'),_0xdfa829[_0x2e8e('0x50')]));_0x17ceaa=_0xdfa829[_0x2e8e('0x50')];}else{logger[_0x2e8e('0x16')](_0x2e8e('0x52'));}}else{logger[_0x2e8e('0x16')](_0x2e8e('0x53'));_0x17ceaa=-0x1;}}})[_0x2e8e('0x30')](function(_0x13fd2b){logger[_0x2e8e('0xd')](_0x2e8e('0x54'),_0x13fd2b['stack']);})['finally'](function(){var _0x5790ae=require(_0x2e8e('0x55'))(config['agi'][_0x2e8e('0xf')],config[_0x2e8e('0x5')]['ip'],_0x17ceaa);_0x5790ae['on'](_0x2e8e('0xd'),errorHandler);_0x5790ae['on'](_0x2e8e('0x56'),listeningHandler);_0x5790ae['on']('connection',connectionHandler);_0x5790ae['on']('close',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 09c3c86..2c58cce 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 _0x9015=['then','error','result','catch','SendMail','jayson/promise','client','http','request'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x9015,0x7a));var _0x5901=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x9015[_0x525c7b];return _0x27b33e;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x5901('0x0'));var client=jayson[_0x5901('0x1')][_0x5901('0x2')]({'port':0x232b});function request(_0x757b37,_0x515a9e){return new BPromise(function(_0x31eb51,_0x40afdf){return client[_0x5901('0x3')](_0x757b37,_0x515a9e)[_0x5901('0x4')](function(_0x397aa1){if(_0x397aa1[_0x5901('0x5')]){return _0x40afdf(_0x397aa1[_0x5901('0x5')]['message']);}else{return _0x31eb51(_0x397aa1[_0x5901('0x6')]);}})[_0x5901('0x7')](function(_0x259b19){return _0x40afdf(_0x259b19);});});}exports['sendMailMessage']=function(_0xee5686,_0x186010){return request(_0x5901('0x8'),{'account':_0xee5686,'message':_0x186010});}; \ No newline at end of file +var _0x3d16=['client','http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise'];(function(_0x3fe4ef,_0x190ea4){var _0x22a826=function(_0x1b1cd3){while(--_0x1b1cd3){_0x3fe4ef['push'](_0x3fe4ef['shift']());}};_0x22a826(++_0x190ea4);}(_0x3d16,0x18a));var _0x63d1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d16[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0x63d1('0x0'));var jayson=require(_0x63d1('0x1'));var client=jayson[_0x63d1('0x2')][_0x63d1('0x3')]({'port':0x232b});function request(_0x36c2f1,_0x5d4e99){return new BPromise(function(_0x1ed8b6,_0x33e2c5){return client[_0x63d1('0x4')](_0x36c2f1,_0x5d4e99)[_0x63d1('0x5')](function(_0x5158d1){if(_0x5158d1[_0x63d1('0x6')]){return _0x33e2c5(_0x5158d1[_0x63d1('0x6')][_0x63d1('0x7')]);}else{return _0x1ed8b6(_0x5158d1['result']);}})[_0x63d1('0x8')](function(_0x47c720){return _0x33e2c5(_0x47c720);});});}exports[_0x63d1('0x9')]=function(_0x3db1e4,_0x188b56){return request(_0x63d1('0xa'),{'account':_0x3db1e4,'message':_0x188b56});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 91beaf2..40dc6c0 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 _0x6b72=['_inBody','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','line','exports','util','Transform','_localBuffer'];(function(_0x3120ec,_0x46c370){var _0x1c33f1=function(_0x13c850){while(--_0x13c850){_0x3120ec['push'](_0x3120ec['shift']());}};_0x1c33f1(++_0x46c370);}(_0x6b72,0x19d));var _0x26b7=function(_0x55e80e,_0x160c43){_0x55e80e=_0x55e80e-0x0;var _0x1c4a62=_0x6b72[_0x55e80e];return _0x1c4a62;};'use strict';var util=require(_0x26b7('0x0'));var Transform=require('stream')[_0x26b7('0x1')];function AGIReply(_0x45fdc9){Transform['call'](this,_0x45fdc9);this[_0x26b7('0x2')]='';this[_0x26b7('0x3')]=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x26b7('0x4')]=function(_0x997ba6,_0x44d910,_0x5bf038){var _0x26ac11='\x0a',_0x1d2a56=['\x0a\x0a',_0x26b7('0x5')],_0xf5559f=-0x1,_0x72ddab=-0x1,_0x20eff5='',_0x10c2b3=0x0,_0xc25a24='',_0x50dfb8='';this[_0x26b7('0x2')]+=_0x997ba6[_0x26b7('0x6')]();_0xc25a24=this['_localBuffer'];if(!this[_0x26b7('0x3')]){_0x10c2b3=0x0;while(_0x1d2a56[_0x10c2b3]){while((_0x72ddab=_0xc25a24['indexOf'](_0x1d2a56[_0x10c2b3]))!=-0x1){_0x20eff5=_0x1d2a56[_0x10c2b3];_0x50dfb8=_0xc25a24[_0x26b7('0x7')](0x0,_0x72ddab);_0xc25a24=_0xc25a24['substring'](_0x72ddab+_0x20eff5[_0x26b7('0x8')]);var _0x7f53db=_0x50dfb8[_0x26b7('0x9')](_0x26ac11),_0x44691b=0x0,_0x77fa3={},_0x5dc52a='',_0x2d1fd1='',_0x3def02=-0x1;while(_0x7f53db[_0x44691b]){_0x3def02=_0x7f53db[_0x44691b][_0x26b7('0xa')](':');if(_0x3def02!=-0x1){_0x5dc52a=_0x7f53db[_0x44691b][_0x26b7('0xb')](0x0,_0x3def02)[_0x26b7('0xc')]();_0x2d1fd1=_0x7f53db[_0x44691b][_0x26b7('0xb')](_0x3def02+0x1)[_0x26b7('0xc')]();if(_0x5dc52a[_0x26b7('0x8')]>0x0){_0x77fa3[_0x5dc52a]=_0x2d1fd1;}}else{}_0x44691b++;}this[_0x26b7('0xd')]('headers',_0x77fa3);this[_0x26b7('0x3')]=!![];}_0x10c2b3++;}this[_0x26b7('0x2')]=_0xc25a24;}else{while((_0xf5559f=_0xc25a24[_0x26b7('0xa')](_0x26ac11))!=-0x1){_0x50dfb8=_0xc25a24[_0x26b7('0x7')](0x0,_0xf5559f);this['emit'](_0x26b7('0xe'),_0x50dfb8);_0xc25a24=_0xc25a24[_0x26b7('0x7')](_0xf5559f+_0x26ac11[_0x26b7('0x8')]);}this[_0x26b7('0x2')]=_0xc25a24;}_0x5bf038();};module[_0x26b7('0xf')]=AGIReply; \ No newline at end of file +var _0x28f3=['emit','headers','line','exports','util','stream','call','_localBuffer','_transform','toString','_inBody','indexOf','substring','length','split','slice','trim'];(function(_0x5cae6c,_0x387268){var _0x5f21c0=function(_0x4603e9){while(--_0x4603e9){_0x5cae6c['push'](_0x5cae6c['shift']());}};_0x5f21c0(++_0x387268);}(_0x28f3,0x9d));var _0x328f=function(_0x4447fa,_0x4fb44e){_0x4447fa=_0x4447fa-0x0;var _0x3b749a=_0x28f3[_0x4447fa];return _0x3b749a;};'use strict';var util=require(_0x328f('0x0'));var Transform=require(_0x328f('0x1'))['Transform'];function AGIReply(_0x2eb3df){Transform[_0x328f('0x2')](this,_0x2eb3df);this[_0x328f('0x3')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply['prototype'][_0x328f('0x4')]=function(_0x233d14,_0x5b3463,_0x2d2d2a){var _0x41e70d='\x0a',_0x2fb66c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x254912=-0x1,_0x4b30ef=-0x1,_0x46552e='',_0x1311c=0x0,_0x34e024='',_0x52f292='';this[_0x328f('0x3')]+=_0x233d14[_0x328f('0x5')]();_0x34e024=this[_0x328f('0x3')];if(!this[_0x328f('0x6')]){_0x1311c=0x0;while(_0x2fb66c[_0x1311c]){while((_0x4b30ef=_0x34e024[_0x328f('0x7')](_0x2fb66c[_0x1311c]))!=-0x1){_0x46552e=_0x2fb66c[_0x1311c];_0x52f292=_0x34e024['substring'](0x0,_0x4b30ef);_0x34e024=_0x34e024[_0x328f('0x8')](_0x4b30ef+_0x46552e[_0x328f('0x9')]);var _0x49be56=_0x52f292[_0x328f('0xa')](_0x41e70d),_0x167daf=0x0,_0x395a35={},_0x48ae4d='',_0x3106c4='',_0x48b7ff=-0x1;while(_0x49be56[_0x167daf]){_0x48b7ff=_0x49be56[_0x167daf][_0x328f('0x7')](':');if(_0x48b7ff!=-0x1){_0x48ae4d=_0x49be56[_0x167daf][_0x328f('0xb')](0x0,_0x48b7ff)[_0x328f('0xc')]();_0x3106c4=_0x49be56[_0x167daf][_0x328f('0xb')](_0x48b7ff+0x1)[_0x328f('0xc')]();if(_0x48ae4d[_0x328f('0x9')]>0x0){_0x395a35[_0x48ae4d]=_0x3106c4;}}else{}_0x167daf++;}this[_0x328f('0xd')](_0x328f('0xe'),_0x395a35);this[_0x328f('0x6')]=!![];}_0x1311c++;}this[_0x328f('0x3')]=_0x34e024;}else{while((_0x254912=_0x34e024[_0x328f('0x7')](_0x41e70d))!=-0x1){_0x52f292=_0x34e024[_0x328f('0x8')](0x0,_0x254912);this[_0x328f('0xd')](_0x328f('0xf'),_0x52f292);_0x34e024=_0x34e024['substring'](_0x254912+_0x41e70d[_0x328f('0x9')]);}this[_0x328f('0x3')]=_0x34e024;}_0x2d2d2a();};module[_0x328f('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 31dcfe0..c7191e5 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 _0xf291=['CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','LogoutUser','bluebird','lodash','util','jayson/promise','client','http','then','error','message','result','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount'];(function(_0x42c5b0,_0x19551d){var _0x2378e6=function(_0x135a9e){while(--_0x135a9e){_0x42c5b0['push'](_0x42c5b0['shift']());}};_0x2378e6(++_0x19551d);}(_0xf291,0xc2));var _0x1f29=function(_0x57f60d,_0x55152f){_0x57f60d=_0x57f60d-0x0;var _0x5d6e6c=_0xf291[_0x57f60d];return _0x5d6e6c;};'use strict';var BPromise=require(_0x1f29('0x0'));var moment=require('moment');var _=require(_0x1f29('0x1'));var util=require(_0x1f29('0x2'));var jayson=require(_0x1f29('0x3'));var client=jayson[_0x1f29('0x4')][_0x1f29('0x5')]({'port':0x2329});function request(_0x4238f8,_0x25d24b){return new BPromise(function(_0x341380,_0x5d8fa6){return client['request'](_0x4238f8,_0x25d24b)[_0x1f29('0x6')](function(_0xe2a3f){if(_0xe2a3f[_0x1f29('0x7')]){return _0x5d8fa6(_0xe2a3f[_0x1f29('0x7')][_0x1f29('0x8')]);}else{return _0x341380(_0xe2a3f[_0x1f29('0x9')]);}})['catch'](function(_0x2dc6fd){return _0x5d8fa6(_0x2dc6fd);});});}exports[_0x1f29('0xa')]=function(_0x5396b6){return request(_0x1f29('0xb'),{'options':{'raw':![],'where':{'name':_0x5396b6},'attributes':['production']}});};exports[_0x1f29('0xc')]=function(_0x13c9bd){return request(_0x1f29('0xd'),{'options':{'raw':![],'where':{'id':_0x13c9bd},'include':[{'model':'MailServerOut','as':_0x1f29('0xe')}],'attributes':['id',_0x1f29('0xf'),_0x1f29('0x10')]}});};exports['getSquareProjectById']=function(_0x78c459){return request(_0x1f29('0xb'),{'options':{'where':{'id':_0x78c459},'attributes':['name']}});};exports[_0x1f29('0x11')]=function(_0x14c9c4){return request(_0x1f29('0x12'),{'options':{'where':{'id':_0x14c9c4},'attributes':[_0x1f29('0xf')]}});};exports[_0x1f29('0x13')]=function(_0x25c8e1){return request('ShowVariable',{'options':{'where':{'id':_0x25c8e1},'attributes':['name']}});};exports[_0x1f29('0x14')]=function(_0x409c51){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x409c51},'attributes':[_0x1f29('0x15')]}});};exports[_0x1f29('0x16')]=function(_0x205990){return request(_0x1f29('0x17'),{'options':{'where':{'id':_0x205990},'attributes':[_0x1f29('0xf')]}});};exports[_0x1f29('0x18')]=function(_0x3d2245){return request(_0x1f29('0x19'),{'options':{'where':{'id':_0x3d2245},'attributes':['name']}});};exports[_0x1f29('0x1a')]=function(_0x11165d){return request(_0x1f29('0x1b'),{'options':{'where':{'id':_0x11165d},'attributes':[_0x1f29('0x1c')]}});};exports[_0x1f29('0x1d')]=function(_0x57c96c){return request(_0x1f29('0x1e'),{'options':{'raw':![],'where':{'id':_0x57c96c},'include':[{'model':_0x1f29('0x1f'),'as':'Intervals'}]}});};exports[_0x1f29('0x20')]=function(_0x33a1d7){return request(_0x1f29('0x21'),{'options':{'where':{'id':_0x33a1d7},'attributes':['id',_0x1f29('0xf')]}});};exports['createSmsMessage']=function(_0x58f613){return request(_0x1f29('0x22'),{'body':_0x58f613});};exports[_0x1f29('0x23')]=function(_0x111e88){return request(_0x1f29('0x24'),{'body':_0x111e88});};exports[_0x1f29('0x25')]=function(_0xb63551){return request(_0x1f29('0x26'),{'body':_[_0x1f29('0x27')](_0xb63551,{'project_name':_0xb63551[_0x1f29('0x28')],'prev_project_name':_0xb63551[_0x1f29('0x29')]||'','is_subproject':_0xb63551[_0x1f29('0x29')]?!![]:![],'leaveAt':moment()[_0x1f29('0x2a')](_0x1f29('0x2b'))})});};exports[_0x1f29('0x2c')]=function(_0x4bb38e){return request(_0x1f29('0x2d'),{'body':_0x4bb38e});};exports[_0x1f29('0x2e')]=function(_0x415300){return request(_0x1f29('0x2f'),{'body':_0x415300});};exports[_0x1f29('0x30')]=function(_0x311175){return request(_0x1f29('0x31'),{'options':{'raw':![],'where':{'phone':_0x311175[_0x1f29('0x32')],'ListId':_0x311175['ListId']}}})[_0x1f29('0x6')](function(_0x397e6d){if(_0x397e6d){return _0x397e6d;}return request('CreateCmContact',{'body':_0x311175});});};exports[_0x1f29('0x33')]=function(_0x404f86){return request(_0x1f29('0x34'),{'options':{'where':{'id':_0x404f86},'attributes':[_0x1f29('0xf')]}});};exports[_0x1f29('0x35')]=function(_0x4e5857,_0x1cfc8b){return request(_0x1f29('0x36'),{'body':{'interface':_0x1cfc8b},'options':{'where':_0x4e5857}});};exports[_0x1f29('0x37')]=function(_0x1482fc,_0x9568d,_0x543a4c){return request('PauseUser',{'body':{'type':_0x9568d,'uniqueid':_0x543a4c},'options':{'where':_0x1482fc}});};exports['agentUnpause']=function(_0x15c4a4){return request('UnpauseUser',{'body':{},'options':{'where':_0x15c4a4}});};exports['agentLogout']=function(_0x149b88){return request(_0x1f29('0x38'),{'body':{},'options':{'where':_0x149b88}});}; \ No newline at end of file +var _0x227c=['save_name','getIntervalById','Interval','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','phone','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','moment','util','jayson/promise','client','request','then','error','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowTrunk','getSoundById','ShowSound'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x227c,0x1b4));var _0xc227=function(_0x1055d6,_0x2b2cf3){_0x1055d6=_0x1055d6-0x0;var _0x4dc056=_0x227c[_0x1055d6];return _0x4dc056;};'use strict';var BPromise=require('bluebird');var moment=require(_0xc227('0x0'));var _=require('lodash');var util=require(_0xc227('0x1'));var jayson=require(_0xc227('0x2'));var client=jayson[_0xc227('0x3')]['http']({'port':0x2329});function request(_0x1aa6d2,_0x978295){return new BPromise(function(_0x34b108,_0x5c80b8){return client[_0xc227('0x4')](_0x1aa6d2,_0x978295)[_0xc227('0x5')](function(_0x2e30b1){if(_0x2e30b1[_0xc227('0x6')]){return _0x5c80b8(_0x2e30b1[_0xc227('0x6')][_0xc227('0x7')]);}else{return _0x34b108(_0x2e30b1['result']);}})[_0xc227('0x8')](function(_0x28ccda){return _0x5c80b8(_0x28ccda);});});}exports[_0xc227('0x9')]=function(_0x4462db){return request(_0xc227('0xa'),{'options':{'raw':![],'where':{'name':_0x4462db},'attributes':[_0xc227('0xb')]}});};exports[_0xc227('0xc')]=function(_0x38a88f){return request(_0xc227('0xd'),{'options':{'raw':![],'where':{'id':_0x38a88f},'include':[{'model':'MailServerOut','as':_0xc227('0xe')}],'attributes':['id',_0xc227('0xf'),_0xc227('0x10')]}});};exports[_0xc227('0x11')]=function(_0x1793ad){return request(_0xc227('0xa'),{'options':{'where':{'id':_0x1793ad},'attributes':[_0xc227('0xf')]}});};exports[_0xc227('0x12')]=function(_0x15f7fc){return request(_0xc227('0x13'),{'options':{'where':{'id':_0x15f7fc},'attributes':[_0xc227('0xf')]}});};exports[_0xc227('0x14')]=function(_0xd1efc0){return request(_0xc227('0x15'),{'options':{'where':{'id':_0xd1efc0},'attributes':[_0xc227('0xf')]}});};exports[_0xc227('0x16')]=function(_0x18fb62){return request(_0xc227('0x17'),{'options':{'where':{'id':_0x18fb62},'attributes':['dsn']}});};exports[_0xc227('0x18')]=function(_0x5bb0d9){return request('ShowUser',{'options':{'where':{'id':_0x5bb0d9},'attributes':[_0xc227('0xf')]}});};exports['getTrunkById']=function(_0x325c56){return request(_0xc227('0x19'),{'options':{'where':{'id':_0x325c56},'attributes':[_0xc227('0xf')]}});};exports[_0xc227('0x1a')]=function(_0x4f26f8){return request(_0xc227('0x1b'),{'options':{'where':{'id':_0x4f26f8},'attributes':[_0xc227('0x1c')]}});};exports[_0xc227('0x1d')]=function(_0x5b820e){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x5b820e},'include':[{'model':_0xc227('0x1e'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x5a29bb){return request('ShowSmsAccount',{'options':{'where':{'id':_0x5a29bb},'attributes':['id',_0xc227('0xf')]}});};exports[_0xc227('0x1f')]=function(_0x3cf333){return request(_0xc227('0x20'),{'body':_0x3cf333});};exports[_0xc227('0x21')]=function(_0x565701){return request(_0xc227('0x22'),{'body':_0x565701});};exports[_0xc227('0x23')]=function(_0x5bd465){return request('CreateSquareReport',{'body':_[_0xc227('0x24')](_0x5bd465,{'project_name':_0x5bd465[_0xc227('0x25')],'prev_project_name':_0x5bd465[_0xc227('0x26')]||'','is_subproject':_0x5bd465[_0xc227('0x26')]?!![]:![],'leaveAt':moment()[_0xc227('0x27')](_0xc227('0x28'))})});};exports[_0xc227('0x29')]=function(_0x15a8d8){return request(_0xc227('0x2a'),{'body':_0x15a8d8});};exports[_0xc227('0x2b')]=function(_0x5d7f40){return request(_0xc227('0x2c'),{'body':_0x5d7f40});};exports[_0xc227('0x2d')]=function(_0x1b4173){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1b4173[_0xc227('0x2e')],'ListId':_0x1b4173[_0xc227('0x2f')]}}})[_0xc227('0x5')](function(_0x3717e5){if(_0x3717e5){return _0x3717e5;}return request('CreateCmContact',{'body':_0x1b4173});});};exports[_0xc227('0x30')]=function(_0x46421e){return request(_0xc227('0x31'),{'options':{'where':{'id':_0x46421e},'attributes':['name']}});};exports[_0xc227('0x32')]=function(_0x92ea50,_0x2d1fea){return request(_0xc227('0x33'),{'body':{'interface':_0x2d1fea},'options':{'where':_0x92ea50}});};exports[_0xc227('0x34')]=function(_0x366175,_0xb9fce0,_0x3249a2){return request(_0xc227('0x35'),{'body':{'type':_0xb9fce0,'uniqueid':_0x3249a2},'options':{'where':_0x366175}});};exports[_0xc227('0x36')]=function(_0x970ee7){return request(_0xc227('0x37'),{'body':{},'options':{'where':_0x970ee7}});};exports[_0xc227('0x38')]=function(_0x257ec4){return request(_0xc227('0x39'),{'body':{},'options':{'where':_0x257ec4}});}; \ 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 4a9027b..c4fc45a 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 _0xe015=['./polly','./lex','exports'];(function(_0x508c71,_0x55b144){var _0x1a1f53=function(_0x3755e7){while(--_0x3755e7){_0x508c71['push'](_0x508c71['shift']());}};_0x1a1f53(++_0x55b144);}(_0xe015,0x13b));var _0x5e01=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xe015[_0x138adb];return _0x1b27f2;};var polly=require(_0x5e01('0x0'));var lex=require(_0x5e01('0x1'));module[_0x5e01('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x18b2=['exports','./lex'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x18b2,0x85));var _0x218b=function(_0x4afcc3,_0x5b016e){_0x4afcc3=_0x4afcc3-0x0;var _0x3e0462=_0x18b2[_0x4afcc3];return _0x3e0462;};var polly=require('./polly');var lex=require(_0x218b('0x0'));module[_0x218b('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 4828fd4..6db96a7 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5c00=['./lib/api','exports'];(function(_0x3a5e26,_0x5131f2){var _0x5b3748=function(_0x1befdf){while(--_0x1befdf){_0x3a5e26['push'](_0x3a5e26['shift']());}};_0x5b3748(++_0x5131f2);}(_0x5c00,0x17e));var _0x05c0=function(_0x40d5c8,_0x411c6e){_0x40d5c8=_0x40d5c8-0x0;var _0x5f294f=_0x5c00[_0x40d5c8];return _0x5f294f;};'use strict';var lex=require(_0x05c0('0x0'));module[_0x05c0('0x1')]=function(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9){return lex(_0x1c3b79,_0x4e54ec,_0x1e76da,_0x5859bc,_0x41c4b4,_0x25c3a9);}; \ No newline at end of file +var _0xb4e6=['./lib/api'];(function(_0x28203e,_0x723dff){var _0x51db1e=function(_0x2e1fcd){while(--_0x2e1fcd){_0x28203e['push'](_0x28203e['shift']());}};_0x51db1e(++_0x723dff);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0xb4e6[_0x4d2f00];return _0x2d7b7f;};'use strict';var lex=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad){return lex(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad);}; \ 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 7145d8c..fe15b92 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(_0xe0fb43,_0x26144e){var _0x263ec9=function(_0x17877e){while(--_0x17877e){_0xe0fb43['push'](_0xe0fb43['shift']());}};_0x263ec9(++_0x26144e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x410be7,_0x429ecd){var _0xa06def=function(_0x1110a0){while(--_0x1110a0){_0x410be7['push'](_0x410be7['shift']());}};_0xa06def(++_0x429ecd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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 3ba8612..b3e7771 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 _0x47e2=['./lib/api','exports'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x47e2,0x80));var _0x247e=function(_0x235edf,_0x595708){_0x235edf=_0x235edf-0x0;var _0xd8f79=_0x47e2[_0x235edf];return _0xd8f79;};'use strict';var polly=require(_0x247e('0x0'));module[_0x247e('0x1')]=function(_0x4db9e5,_0x24f3f5,_0x53cd07,_0x47d09c,_0x54ce52,_0x522f0d,_0x562203){return polly(_0x4db9e5,_0x24f3f5,_0x53cd07,_0x47d09c,_0x54ce52,_0x522f0d,_0x562203);}; \ No newline at end of file +var _0xcad7=['exports'];(function(_0x16fa59,_0x3dab18){var _0x1cf6a1=function(_0x4d4df9){while(--_0x4d4df9){_0x16fa59['push'](_0x16fa59['shift']());}};_0x1cf6a1(++_0x3dab18);}(_0xcad7,0xbe));var _0x7cad=function(_0x225915,_0x2eaa2f){_0x225915=_0x225915-0x0;var _0x3b8d10=_0xcad7[_0x225915];return _0x3b8d10;};'use strict';var polly=require('./lib/api');module[_0x7cad('0x0')]=function(_0x424d03,_0x30788b,_0xa87c69,_0x18a679,_0x15ebea,_0x5b73ab,_0x145e62){return polly(_0x424d03,_0x30788b,_0xa87c69,_0x18a679,_0x15ebea,_0x5b73ab,_0x145e62);}; \ 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 aeb9dd4..3186caf 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 _0xcc5e=['Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xcc5e,0x7b));var _0xecc5=function(_0x25a787,_0x6926e7){_0x25a787=_0x25a787-0x0;var _0x37712a=_0xcc5e[_0x25a787];return _0x37712a;};'use strict';var fs=require('fs');var path=require(_0xecc5('0x0'));var BPromise=require('bluebird');var rs=require(_0xecc5('0x1'));var AWS=require(_0xecc5('0x2'));function pollyResult(_0x221a3b,_0x2032a4,_0x3a1487){return new BPromise(function(_0x3b7cd3,_0x584942){_0x221a3b[_0xecc5('0x3')](_0x2032a4,function(_0x548377,_0x4dae98){if(_0x548377){_0x584942(_0x548377);}else if(_0x4dae98){if(_0x4dae98['AudioStream']instanceof Buffer){fs[_0xecc5('0x4')](_0x3a1487,_0x4dae98[_0xecc5('0x5')],function(_0x5c5b4e){if(_0x5c5b4e){_0x584942(_0x5c5b4e);}else{_0x3b7cd3();}});}else{_0x584942(new Error(_0xecc5('0x6')));}}else{_0x584942(new Error(_0xecc5('0x7')));}});});}module[_0xecc5('0x8')]=function(_0x30eaf7,_0x43f385,_0x41bc47,_0x407501,_0x493196,_0xd544e2,_0x2e2dd4){var _0x32f3a6=new AWS[(_0xecc5('0x9'))]({'accessKeyId':_0x30eaf7,'secretAccessKey':_0x43f385,'region':_0x41bc47});var _0x91c194={'Text':_0x493196,'TextType':_0xd544e2||_0xecc5('0xa'),'OutputFormat':_0xecc5('0xb'),'VoiceId':_0x407501};return pollyResult(_0x32f3a6,_0x91c194,_0x2e2dd4);}; \ No newline at end of file +var _0x11a3=['synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird'];(function(_0x1fb6e2,_0x3a22ce){var _0x354690=function(_0x51f968){while(--_0x51f968){_0x1fb6e2['push'](_0x1fb6e2['shift']());}};_0x354690(++_0x3a22ce);}(_0x11a3,0x15d));var _0x311a=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x11a3[_0x44bcb0];return _0xfaf881;};'use strict';var fs=require('fs');var path=require(_0x311a('0x0'));var BPromise=require(_0x311a('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x4c636b,_0x3f659b,_0x51ab2e){return new BPromise(function(_0x4cc3bd,_0x1ac184){_0x4c636b[_0x311a('0x2')](_0x3f659b,function(_0x4ba59d,_0x46485d){if(_0x4ba59d){_0x1ac184(_0x4ba59d);}else if(_0x46485d){if(_0x46485d[_0x311a('0x3')]instanceof Buffer){fs['writeFile'](_0x51ab2e,_0x46485d[_0x311a('0x3')],function(_0x1d9e2d){if(_0x1d9e2d){_0x1ac184(_0x1d9e2d);}else{_0x4cc3bd();}});}else{_0x1ac184(new Error(_0x311a('0x4')));}}else{_0x1ac184(new Error(_0x311a('0x5')));}});});}module['exports']=function(_0x220128,_0x7f416,_0x2f06ea,_0x490f24,_0x2a97a5,_0x253339,_0x4a0898){var _0x1ca7a9=new AWS[(_0x311a('0x6'))]({'accessKeyId':_0x220128,'secretAccessKey':_0x7f416,'region':_0x2f06ea});var _0xe6bbd={'Text':_0x2a97a5,'TextType':_0x253339||_0x311a('0x7'),'OutputFormat':_0x311a('0x8'),'VoiceId':_0x490f24};return pollyResult(_0x1ca7a9,_0xe6bbd,_0x4a0898);}; \ 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 7efc5fa..d9986e1 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 _0xbec7=['exports','./lib/api'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0xbec7,0x13b));var _0x7bec=function(_0x5e46b3,_0x300392){_0x5e46b3=_0x5e46b3-0x0;var _0x2ef9eb=_0xbec7[_0x5e46b3];return _0x2ef9eb;};'use strict';var asr=require(_0x7bec('0x0'));module[_0x7bec('0x1')]=function(_0x202736,_0x36ac0a,_0x26e5b1,_0x264a02){return asr(_0x202736,_0x36ac0a,_0x26e5b1);}; \ No newline at end of file +var _0x8a9d=['exports'];(function(_0x56138f,_0x1e9ebb){var _0x1acaf7=function(_0x48690d){while(--_0x48690d){_0x56138f['push'](_0x56138f['shift']());}};_0x1acaf7(++_0x1e9ebb);}(_0x8a9d,0xdf));var _0xd8a9=function(_0x1d5677,_0x342d27){_0x1d5677=_0x1d5677-0x0;var _0x274227=_0x8a9d[_0x1d5677];return _0x274227;};'use strict';var asr=require('./lib/api');module[_0xd8a9('0x0')]=function(_0x32c804,_0x435eea,_0x1a6d6d,_0x1b5288){return asr(_0x32c804,_0x435eea,_0x1a6d6d);}; \ 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 06598fd..4ce75d8 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 _0xb18e=['lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb18e,0x181));var _0xeb18=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0xb18e[_0x12a2a6];return _0x1754ae;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0xeb18('0x0');module['exports']=function(_0x13e5b4,_0x56e41c,_0xf647b9){return new BPromise(function(_0x1bf23e,_0x5d5ff9){var _0x125c34;if(typeof _0x13e5b4!==_0xeb18('0x1')||_0x13e5b4[_0xeb18('0x2')]===0x0){return _0x5d5ff9(_0xeb18('0x3'));}if(typeof _0x56e41c!==_0xeb18('0x1')||_0x56e41c[_0xeb18('0x2')]===0x0){return _0x5d5ff9('key\x20should\x20be\x20a\x20string');}if(typeof _0xf647b9!==_0xeb18('0x4')&&(typeof _0xf647b9!==_0xeb18('0x1')||_0xf647b9['length']===0x0)){return _0x5d5ff9(_0xeb18('0x5'));}try{_0x125c34=fs[_0xeb18('0x6')](_0x13e5b4)[_0xeb18('0x7')](_0xeb18('0x8'));}catch(_0x3ad7a3){return _0x5d5ff9(_0x3ad7a3);}return _0x1bf23e({'method':_0xeb18('0x9'),'uri':host+_0xeb18('0xa')+_0x56e41c,'body':{'config':{'encoding':_0xeb18('0xb'),'sampleRateHertz':_0xeb18('0xc'),'languageCode':_0xf647b9},'audio':{'content':_0x125c34}},'json':!![]});});}; \ No newline at end of file +var _0xd2ea=['LINEAR16','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','toString','POST','/v1/speech:recognize?key='];(function(_0xb69e0f,_0x13beb8){var _0x453602=function(_0x329367){while(--_0x329367){_0xb69e0f['push'](_0xb69e0f['shift']());}};_0x453602(++_0x13beb8);}(_0xd2ea,0x15f));var _0xad2e=function(_0x5b7a21,_0xc73ab1){_0x5b7a21=_0x5b7a21-0x0;var _0x13c4bb=_0xd2ea[_0x5b7a21];return _0x13c4bb;};'use strict';var url=require(_0xad2e('0x0'));var BPromise=require(_0xad2e('0x1'));var fs=require('fs');var host=_0xad2e('0x2');module[_0xad2e('0x3')]=function(_0x44b30d,_0x5c9fa9,_0x3a9d11){return new BPromise(function(_0x46a911,_0xcba7cb){var _0x3e0741;if(typeof _0x44b30d!==_0xad2e('0x4')||_0x44b30d[_0xad2e('0x5')]===0x0){return _0xcba7cb(_0xad2e('0x6'));}if(typeof _0x5c9fa9!=='string'||_0x5c9fa9[_0xad2e('0x5')]===0x0){return _0xcba7cb(_0xad2e('0x7'));}if(typeof _0x3a9d11!==_0xad2e('0x8')&&(typeof _0x3a9d11!=='string'||_0x3a9d11[_0xad2e('0x5')]===0x0)){return _0xcba7cb(_0xad2e('0x9'));}try{_0x3e0741=fs['readFileSync'](_0x44b30d)[_0xad2e('0xa')]('base64');}catch(_0x430443){return _0xcba7cb(_0x430443);}return _0x46a911({'method':_0xad2e('0xb'),'uri':host+_0xad2e('0xc')+_0x5c9fa9,'body':{'config':{'encoding':_0xad2e('0xd'),'sampleRateHertz':'8000','languageCode':_0x3a9d11},'audio':{'content':_0x3e0741}},'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 f014782..59ff8fa 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 _0x4af0=['exports'];(function(_0x5927cb,_0x366af0){var _0x4ba191=function(_0x407ad3){while(--_0x407ad3){_0x5927cb['push'](_0x5927cb['shift']());}};_0x4ba191(++_0x366af0);}(_0x4af0,0x138));var _0x04af=function(_0x56ff5e,_0x257c79){_0x56ff5e=_0x56ff5e-0x0;var _0x26d7c6=_0x4af0[_0x56ff5e];return _0x26d7c6;};var asr=require('./asr');module[_0x04af('0x0')]={'asr':asr}; \ No newline at end of file +var _0xcb67=['exports'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0xcb67,0xd8));var _0x7cb6=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0xcb67[_0x17bb31];return _0x505c71;};var asr=require('./asr');module[_0x7cb6('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 ed2f2a2..c656807 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 _0x39f8=['result','action','actionIncomplete','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','sestekNDA','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','dialogflow','http','https','md5','path','querystring','request-promise','sox','google-tts-api','parse','util','https://api.ispeech.org/api/rest','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','error','download\x20error','end','protocol','\x20failed,\x20status\x20code\x20=\x20','data','transcode','wav','error\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent','writeFile','unlink','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','source','resolvedQuery'];(function(_0x399aca,_0x1c223a){var _0x36cb1a=function(_0x444c4d){while(--_0x444c4d){_0x399aca['push'](_0x399aca['shift']());}};_0x36cb1a(++_0x1c223a);}(_0x39f8,0x1b4));var _0x839f=function(_0x3f3acb,_0x5575d5){_0x3f3acb=_0x3f3acb-0x0;var _0x1d8999=_0x39f8[_0x3f3acb];return _0x1d8999;};'use strict';var apiai=require('apiai-promise');var BPromise=require('bluebird');var dialogflow=require(_0x839f('0x0'));var fs=require('fs');var http=require(_0x839f('0x1'));var https=require(_0x839f('0x2'));var md5=require(_0x839f('0x3'));var path=require(_0x839f('0x4'));var querystring=require(_0x839f('0x5'));var rp=require(_0x839f('0x6'));var rs=require('randomstring');var sox=require(_0x839f('0x7'));var tts=require(_0x839f('0x8'));var urlParse=require('url')[_0x839f('0x9')];var util=require(_0x839f('0xa'));var aws=require('./aws');var google=require('./google');var sestek=require('./sestek');var tilde=require('./tilde');var logger=require('../../../config/logger')('agi');var ISPEECH_API=_0x839f('0xb');function downloadFile(_0x18566b,_0x566583){return new BPromise(function(_0x3b2687,_0xcbc7c6){var _0x38c922=urlParse(_0x18566b);var _0x3b868d=_0x38c922['protocol']===_0x839f('0xc')?https:http;var _0x4bcfe5={'host':_0x38c922[_0x839f('0xd')],'path':_0x38c922[_0x839f('0x4')],'headers':{'user-agent':_0x839f('0xe')}};_0x3b868d[_0x839f('0xf')](_0x4bcfe5,function(_0x2ee0f2){if(_0x2ee0f2[_0x839f('0x10')]!==0xc8){logger['error'](_0x839f('0x11')+_0x18566b+'\x20failed,\x20status\x20code\x20=\x20'+_0x2ee0f2[_0x839f('0x10')]+'\x20('+_0x2ee0f2[_0x839f('0x12')]+')');_0xcbc7c6(new Error(_0x839f('0x11')+_0x18566b+'\x20failed,\x20status\x20code\x20=\x20'+_0x2ee0f2[_0x839f('0x10')]+'\x20('+_0x2ee0f2[_0x839f('0x12')]+')'));return;}var _0x109331=fs[_0x839f('0x13')](_0x566583);_0x109331['on'](_0x839f('0x14'),function(){logger[_0x839f('0x15')](_0x839f('0x16'));_0x109331[_0x839f('0x17')](_0x3b2687);});_0x109331['on'](_0x839f('0x18'),function(_0x3930ab){fs['unlink'](_0x566583);logger[_0x839f('0x18')](_0x839f('0x19'),_0x3930ab);_0xcbc7c6(_0x3930ab);});_0x2ee0f2['pipe'](_0x109331);})['on']('error',function(_0x3b3953){logger[_0x839f('0x18')](_0x3b3953);_0xcbc7c6(_0x3b3953);})[_0x839f('0x1a')]();});}function uploadFile(_0xbed502){return new BPromise(function(_0x27a85a,_0x1c5e23){var _0x437d7b=urlParse(_0xbed502);var _0xf73864=_0x437d7b[_0x839f('0x1b')]===_0x839f('0xc')?https:http;var _0x912884={'host':_0x437d7b[_0x839f('0xd')],'path':_0x437d7b[_0x839f('0x4')],'headers':{'user-agent':_0x839f('0xe')}};_0xf73864['get'](_0x912884,function(_0x21b03f){if(_0x21b03f[_0x839f('0x10')]!==0xc8){_0x1c5e23(new Error(_0x839f('0x11')+_0xbed502+_0x839f('0x1c')+_0x21b03f[_0x839f('0x10')]+'\x20('+_0x21b03f[_0x839f('0x12')]+')'));return;}var _0x3b343d='';_0x21b03f['on'](_0x839f('0x1d'),function(_0x37dbbd){_0x3b343d+=_0x37dbbd;});_0x21b03f['on'](_0x839f('0x1a'),function(){_0x27a85a(_0x3b343d);});})['on'](_0x839f('0x18'),function(_0x4206d0){_0x1c5e23(_0x4206d0);})[_0x839f('0x1a')]();});}function convertFile(_0x13821b,_0x54f165){return new BPromise(function(_0x38c37d,_0x60492c){var _0x4425a6=sox[_0x839f('0x1e')](_0x13821b,_0x54f165,{'sampleRate':0x1f40,'format':_0x839f('0x1f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4425a6['on']('error',function(_0x259266){logger[_0x839f('0x18')](_0x839f('0x20'),_0x259266);_0x60492c(_0x259266);});_0x4425a6['on'](_0x839f('0x1a'),function(){logger[_0x839f('0x15')]('finish\x20to\x20convert');_0x38c37d();});_0x4425a6[_0x839f('0x21')]();});}function base64Decode(_0xeaee28,_0x2acbba){var _0x2736c9=path[_0x839f('0x22')](__dirname,_0x839f('0x23'),rs[_0x839f('0x24')](0x4)+_0x839f('0x25'));fs['writeFileSync'](_0x2736c9,_0xeaee28,_0x839f('0x26'));return convertFile(_0x2736c9,_0x2acbba)[_0x839f('0x27')](function(){try{fs['unlink'](_0x2736c9);fs[_0x839f('0x28')](_0x2acbba,_0x839f('0x29'));}catch(_0x379a54){logger[_0x839f('0x18')](_0x379a54);}return _0x2acbba[_0x839f('0x2a')]('.')[0x0];});}function base64Encode(_0x40e41c){var _0x12afad=fs[_0x839f('0x2b')](_0x40e41c);return new Buffer(_0x12afad)[_0x839f('0x2c')](_0x839f('0x26'));}exports[_0x839f('0x2d')]=function(_0x1e70a0,_0x452102,_0x385a32,_0x2563c1,_0x1b3333,_0x3db3fb){var _0x1eaf10,_0xf14759;var _0x169586=_0x839f('0x2e');var _0x47b558=_0x839f('0x2f')+_0x1e70a0;var _0x2cebe6={};if(_0x452102===_0x839f('0x30')){_0x2cebe6[_0x839f('0x31')]={'ssml':_0x385a32};}else{_0x2cebe6[_0x839f('0x31')]={'text':_0x385a32};};_0x2cebe6[_0x839f('0x32')]={'languageCode':_0x2563c1,'ssmlGender':_0x1b3333};_0x2cebe6[_0x839f('0x33')]={'audioEncoding':_0x839f('0x34'),'sampleRateHertz':0x1f40};var _0x4ccb2f={'url':_0x169586+_0x839f('0x35')+_0x47b558,'method':_0x839f('0x36'),'json':!![],'body':_0x2cebe6};return rp(_0x4ccb2f)[_0x839f('0x27')](function(_0x201545){return new BPromise(function(_0x5c0834,_0x1c23e9){_0x1eaf10=path[_0x839f('0x22')](__dirname,'tmp',rs[_0x839f('0x24')](0x4)+_0x839f('0x37'));var _0x2f01b5=Buffer[_0x839f('0x38')](_0x201545[_0x839f('0x39')],'base64');return fs[_0x839f('0x3a')](_0x1eaf10,_0x2f01b5,function(_0x12ce9f){_0x1c23e9(_0x12ce9f);},function(_0x1de54e){fs[_0x839f('0x28')](_0x1eaf10,_0x839f('0x29'));_0x5c0834(_0x1de54e);});});})[_0x839f('0x27')](function(_0x5c7bc6){_0xf14759=path[_0x839f('0x22')](__dirname,_0x839f('0x23'),rs['generate'](0x4)+_0x839f('0x25'));return convertFile(_0x1eaf10,_0xf14759);})['then'](function(){try{fs[_0x839f('0x3b')](_0x1eaf10);fs[_0x839f('0x28')](_0xf14759,'777');}catch(_0x22c8b5){logger[_0x839f('0x18')](_0x22c8b5);}logger[_0x839f('0x15')]('googleCloudTTS\x20path',_0xf14759['split']('.')[0x0]);return _0xf14759['split']('.')[0x0];});};exports[_0x839f('0x3c')]=function(_0x2a3513,_0x2804dc){var _0x6c07b6=_0x839f('0x3d');var _0x189dab,_0x1a0ad4;var _0x5f2639;var _0x28c479={'encoding':_0x839f('0x3e'),'method':'POST','timeout':0x2710,'url':_0x6c07b6,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x839f('0x3f')]([[['jQ1olc',JSON['stringify']([_0x2a3513,_0x2804dc||'en',![],'null']),null,_0x839f('0x40')]]]))};return rp(_0x28c479)['then'](function(_0x51e715){try{_0x5f2639=eval(_0x51e715['slice'](0x5))[0x0][0x2];}catch(_0x11fc73){throw new Error(_0x839f('0x41')+_0x51e715[_0x839f('0x1d')]);}if(!_0x5f2639){if(_0x2a3513[_0x839f('0x42')]>0xc8){throw new Error(_0x839f('0x43'));}else{throw new Error(_0x839f('0x44')+_0x2804dc+_0x839f('0x45'));}}try{_0x5f2639=eval(_0x5f2639)[0x0];}catch(_0x408426){throw new Error(_0x839f('0x41')+res[_0x839f('0x1d')]);}const _0x6b35bb=_0x5f2639;_0x189dab=path[_0x839f('0x22')](__dirname,_0x839f('0x23'),rs['generate'](0x4)+_0x839f('0x37'));fs['writeFileSync'](_0x189dab,_0x5f2639,{'encoding':_0x839f('0x26')});_0x1a0ad4=path[_0x839f('0x22')](__dirname,'tmp',rs['generate'](0x4)+_0x839f('0x25'));return convertFile(_0x189dab,_0x1a0ad4);})[_0x839f('0x27')](function(){try{fs[_0x839f('0x3b')](_0x189dab);fs['chmodSync'](_0x1a0ad4,_0x839f('0x29'));}catch(_0x3ef5f7){logger[_0x839f('0x18')](_0x3ef5f7);}logger['info']('goggleTTS\x20path',_0x1a0ad4[_0x839f('0x2a')]('.')[0x0]);return _0x1a0ad4['split']('.')[0x0];});};exports[_0x839f('0x46')]=function(_0x4381ab,_0x4d0944,_0x4d069f){return google[_0x839f('0x47')](_0x4381ab,_0x4d0944,_0x4d069f)[_0x839f('0x27')](function(_0x28df7d){logger['info'](_0x28df7d[_0x839f('0x48')]);return rp(_0x28df7d);})[_0x839f('0x27')](function(_0x314cbe){var _0x442ada='';var _0x5ef676=0x0;try{fs[_0x839f('0x3b')](_0x4381ab);}catch(_0x5cce1c){logger['error'](_0x5cce1c);}if(_0x314cbe&&_0x314cbe[_0x839f('0x49')]){_0x442ada=_0x314cbe[_0x839f('0x49')][_0x839f('0x4a')](function(_0x36316a){return _0x36316a&&_0x36316a[_0x839f('0x4b')][0x0]&&_0x36316a[_0x839f('0x4b')][0x0][_0x839f('0x4c')]?_0x36316a[_0x839f('0x4b')][0x0][_0x839f('0x4c')]:'';})[_0x839f('0x4d')]('\x0a');_0x5ef676=_0x314cbe[_0x839f('0x49')][_0x839f('0x4a')](function(_0x5b0957){return _0x5b0957&&_0x5b0957[_0x839f('0x4b')][0x0]&&_0x5b0957['alternatives'][0x0][_0x839f('0x4e')]?_0x5b0957['alternatives'][0x0][_0x839f('0x4e')]:0x0;})['join']('\x0a');}logger[_0x839f('0x15')](_0x839f('0x4f'),_0x442ada);logger[_0x839f('0x15')](_0x839f('0x50'),_0x5ef676);return{'transcript':_0x442ada,'confidence':_0x5ef676};})[_0x839f('0x51')](function(_0x17f586){logger[_0x839f('0x18')](_0x839f('0x52'),_0x17f586[_0x839f('0x10')],_0x17f586[_0x839f('0x53')],_0x17f586[_0x839f('0x54')]);});};exports['googleDialogflow']=function(_0x1dfa0b,_0x1ec490,_0x4fdf1b,_0x3a81e0){var _0x414a59=apiai(_0x1ec490,{'language':_0x3a81e0||'en'});return _0x414a59[_0x839f('0x55')](_0x4fdf1b,{'sessionId':md5(_0x1dfa0b)})[_0x839f('0x27')](function(_0x28c4b2){logger[_0x839f('0x15')](JSON['stringify'](_0x28c4b2));return{'source':_0x28c4b2['result'][_0x839f('0x56')],'resolvedQuery':_0x28c4b2['result'][_0x839f('0x57')],'action':_0x28c4b2[_0x839f('0x58')][_0x839f('0x59')],'actionIncomplete':_0x28c4b2[_0x839f('0x58')][_0x839f('0x5a')],'speech':_0x28c4b2['result']['fulfillment']['speech'],'score':_0x28c4b2[_0x839f('0x58')]['score'],'statusCode':_0x28c4b2[_0x839f('0x5b')][_0x839f('0x5c')],'endConversation':_0x28c4b2[_0x839f('0x58')]['metadata']['endConversation']||![],'isFallbackIntent':_0x28c4b2['result'][_0x839f('0x5d')][_0x839f('0x5e')]};});};exports[_0x839f('0x5f')]=function(_0x4fe41a,_0x2dca91,_0x4dfe34,_0x555e92,_0x224e96,_0x4da2bd){var _0x494a35=_0x555e92[_0x839f('0x60')](/\\n/g,'\x0a');var _0x2511ff={'credentials':{'private_key':_0x494a35,'client_email':_0x4dfe34}};var _0x45fd89=new dialogflow[(_0x839f('0x61'))](_0x2511ff);var _0x229657=_0x45fd89['sessionPath'](_0x2dca91,md5(_0x4fe41a));var _0x42cb14={'session':_0x229657,'queryInput':{'text':{'text':_0x224e96,'languageCode':_0x4da2bd}}};return _0x45fd89[_0x839f('0x62')](_0x42cb14)[_0x839f('0x27')](function(_0x1653b8){if(_0x1653b8&&_0x1653b8[_0x839f('0x42')]){logger[_0x839f('0x15')](_0x839f('0x63'),JSON[_0x839f('0x3f')](_0x1653b8));var _0x25c207=_0x1653b8[0x0];if(_0x25c207){var _0x5aef62={'action':_0x25c207[_0x839f('0x64')][_0x839f('0x59')],'allRequiredParamsPresent':_0x25c207[_0x839f('0x64')]['allRequiredParamsPresent'],'endConversation':_0x25c207[_0x839f('0x64')][_0x839f('0x65')]&&_0x25c207[_0x839f('0x64')][_0x839f('0x65')][_0x839f('0x66')]?_0x25c207['queryResult'][_0x839f('0x65')][_0x839f('0x66')][_0x839f('0x67')][_0x839f('0x68')]:![],'fulfillmentText':_0x25c207[_0x839f('0x64')]['fulfillmentText'],'intentName':_0x25c207[_0x839f('0x64')][_0x839f('0x69')][_0x839f('0x53')],'intentDisplayName':_0x25c207['queryResult'][_0x839f('0x69')][_0x839f('0x6a')],'isFallbackIntent':_0x25c207[_0x839f('0x64')][_0x839f('0x69')][_0x839f('0x6b')],'languageCode':_0x25c207[_0x839f('0x64')][_0x839f('0x6c')],'queryText':_0x25c207[_0x839f('0x64')][_0x839f('0x6d')],'responseId':_0x25c207[_0x839f('0x6e')],'score':_0x25c207[_0x839f('0x64')][_0x839f('0x6f')],'speech':_0x25c207[_0x839f('0x64')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x1653b8)};return _0x5aef62;}}});};exports[_0x839f('0x70')]=function(_0x38c279,_0x455d97,_0x15a954,_0xa0623c){return tilde[_0x839f('0x47')](_0x38c279,_0x455d97,_0x15a954,_0xa0623c)['then'](function(_0x92f87d){try{fs[_0x839f('0x3b')](_0x38c279);}catch(_0x3a8397){logger['error'](_0x3a8397);}logger[_0x839f('0x15')](_0x839f('0x71'),_0x92f87d[_0x839f('0x4c')]);logger[_0x839f('0x15')](_0x839f('0x72'),_0x92f87d[_0x839f('0x4e')]);return _0x92f87d;});};exports['awsPolly']=function(_0x26e600,_0x1d67a3,_0x2a065b,_0x4e59fc,_0x508e6f,_0xb2e566){var _0x5c3cc8=path['resolve'](__dirname,_0x839f('0x23'),rs[_0x839f('0x24')](0x4)+_0x839f('0x37'));var _0x5ce392;return aws[_0x839f('0x73')](_0x26e600,_0x1d67a3,_0x2a065b,_0x4e59fc,_0x508e6f,_0xb2e566,_0x5c3cc8)[_0x839f('0x27')](function(){_0x5ce392=path[_0x839f('0x22')](__dirname,_0x839f('0x23'),rs[_0x839f('0x24')](0x4)+_0x839f('0x25'));return convertFile(_0x5c3cc8,_0x5ce392);})['then'](function(){try{fs[_0x839f('0x3b')](_0x5c3cc8);fs[_0x839f('0x28')](_0x5ce392,_0x839f('0x29'));}catch(_0x1ea8b6){logger[_0x839f('0x18')](_0x1ea8b6);}return _0x5ce392[_0x839f('0x2a')]('.')[0x0];});};exports[_0x839f('0x74')]=function(_0x18c227,_0x58e52f,_0xc796e3,_0x25ba5b,_0x14e88a,_0x229ceb){return aws[_0x839f('0x75')](_0x18c227,_0x58e52f,_0xc796e3,_0x25ba5b,_0x14e88a,_0x229ceb)[_0x839f('0x27')](function(_0x49f98c){logger[_0x839f('0x15')](JSON['stringify'](_0x49f98c));return _0x49f98c;});};exports[_0x839f('0x76')]=function(_0x213df6,_0x36af7c,_0x577b76,_0x1bb896){var _0x2ae179=util[_0x839f('0x77')](_0x839f('0x78'),ISPEECH_API,_0x213df6,encodeURIComponent(_0x36af7c),_0x577b76,_0x1bb896);var _0x58019c=path[_0x839f('0x22')](__dirname,_0x839f('0x23'),rs[_0x839f('0x24')](0x4)+_0x839f('0x37'));var _0x37f2c7;return downloadFile(_0x2ae179,_0x58019c)['then'](function(){_0x37f2c7=path[_0x839f('0x22')](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x58019c,_0x37f2c7);})[_0x839f('0x27')](function(){try{fs[_0x839f('0x3b')](_0x58019c);fs[_0x839f('0x28')](_0x37f2c7,'777');}catch(_0x4c6f1d){logger['error'](_0x4c6f1d);}return _0x37f2c7['split']('.')[0x0];});};exports[_0x839f('0x79')]=function(_0xa862ef,_0x4f5486,_0x6b3ee3,_0x53a77a){var _0x132792=util[_0x839f('0x77')](_0x839f('0x7a'),ISPEECH_API,_0x4f5486,_0x6b3ee3,base64Encode(_0xa862ef),_0x53a77a?util[_0x839f('0x77')](_0x839f('0x7b'),encodeURIComponent(_0x53a77a)):'freeform=3');return uploadFile(_0x132792)[_0x839f('0x27')](function(_0x153e6f){return querystring[_0x839f('0x9')](_0x153e6f);});};exports[_0x839f('0x7c')]=function(_0x507c22,_0x538b1a){return sestek['nda'](_0x507c22,_0x538b1a)['then'](function(_0x5d3f96){logger[_0x839f('0x15')](JSON[_0x839f('0x3f')](_0x5d3f96));var _0x520a3e={'speech':_0x5d3f96['text'],'action':_0x5d3f96[_0x839f('0x7d')]?_0x5d3f96[_0x839f('0x7d')][_0x839f('0x7e')]:undefined,'actiondata':_0x5d3f96[_0x839f('0x7d')]?_0x5d3f96[_0x839f('0x7d')][_0x839f('0x7f')]:undefined};if(_0x5d3f96[_0x839f('0x7d')]&&_0x5d3f96[_0x839f('0x7d')]['AudioFromTts']){return base64Decode(_0x5d3f96[_0x839f('0x7d')][_0x839f('0x80')]['Data'],path['resolve'](__dirname,'tmp',rs[_0x839f('0x24')](0x4)+_0x839f('0x25')))[_0x839f('0x27')](function(_0x2517a5){_0x520a3e[_0x839f('0x81')]=_0x2517a5;return _0x520a3e;});}return _0x520a3e;});};exports[_0x839f('0x82')]=function(){return __dirname;}; \ No newline at end of file +var _0x501e=['resolvedQuery','actionIncomplete','fulfillment','score','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','end_conversation','boolValue','fulfillmentText','displayName','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','dialogflow','http','md5','path','querystring','request-promise','randomstring','sox','url','util','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','close','unlink','pipe','end','data','transcode','error\x20convert','finish\x20to\x20convert','start','tmp','.wav','base64','then','chmodSync','split','readFileSync','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','generate','from','audioContent','writeFile','777','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','.mp3','goggleTTS\x20path','googleASR','uri','map','alternatives','transcript','join','results','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result'];(function(_0x5c745a,_0x510f75){var _0x254909=function(_0x3760c5){while(--_0x3760c5){_0x5c745a['push'](_0x5c745a['shift']());}};_0x254909(++_0x510f75);}(_0x501e,0x13f));var _0xe501=function(_0x1bed0d,_0x564923){_0x1bed0d=_0x1bed0d-0x0;var _0x39d152=_0x501e[_0x1bed0d];return _0x39d152;};'use strict';var apiai=require(_0xe501('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xe501('0x1'));var fs=require('fs');var http=require(_0xe501('0x2'));var https=require('https');var md5=require(_0xe501('0x3'));var path=require(_0xe501('0x4'));var querystring=require(_0xe501('0x5'));var rp=require(_0xe501('0x6'));var rs=require(_0xe501('0x7'));var sox=require(_0xe501('0x8'));var tts=require('google-tts-api');var urlParse=require(_0xe501('0x9'))['parse'];var util=require(_0xe501('0xa'));var aws=require(_0xe501('0xb'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0xe501('0xc'));var logger=require(_0xe501('0xd'))(_0xe501('0xe'));var ISPEECH_API=_0xe501('0xf');function downloadFile(_0x55db9d,_0x332dbe){return new BPromise(function(_0x472ed3,_0x5dbf65){var _0x2ed7bd=urlParse(_0x55db9d);var _0x46c044=_0x2ed7bd[_0xe501('0x10')]===_0xe501('0x11')?https:http;var _0x1ae735={'host':_0x2ed7bd[_0xe501('0x12')],'path':_0x2ed7bd[_0xe501('0x4')],'headers':{'user-agent':_0xe501('0x13')}};_0x46c044[_0xe501('0x14')](_0x1ae735,function(_0xf31564){if(_0xf31564[_0xe501('0x15')]!==0xc8){logger[_0xe501('0x16')](_0xe501('0x17')+_0x55db9d+_0xe501('0x18')+_0xf31564['statusCode']+'\x20('+_0xf31564[_0xe501('0x19')]+')');_0x5dbf65(new Error('request\x20to\x20'+_0x55db9d+_0xe501('0x18')+_0xf31564['statusCode']+'\x20('+_0xf31564[_0xe501('0x19')]+')'));return;}var _0x35a72f=fs['createWriteStream'](_0x332dbe);_0x35a72f['on'](_0xe501('0x1a'),function(){logger[_0xe501('0x1b')](_0xe501('0x1c'));_0x35a72f[_0xe501('0x1d')](_0x472ed3);});_0x35a72f['on']('error',function(_0x2f9a44){fs[_0xe501('0x1e')](_0x332dbe);logger['error']('download\x20error',_0x2f9a44);_0x5dbf65(_0x2f9a44);});_0xf31564[_0xe501('0x1f')](_0x35a72f);})['on'](_0xe501('0x16'),function(_0x195e59){logger[_0xe501('0x16')](_0x195e59);_0x5dbf65(_0x195e59);})[_0xe501('0x20')]();});}function uploadFile(_0x1d5bb6){return new BPromise(function(_0xc2ea4e,_0x2e67e0){var _0x50a050=urlParse(_0x1d5bb6);var _0x46b7c1=_0x50a050[_0xe501('0x10')]===_0xe501('0x11')?https:http;var _0x10125c={'host':_0x50a050['host'],'path':_0x50a050['path'],'headers':{'user-agent':_0xe501('0x13')}};_0x46b7c1[_0xe501('0x14')](_0x10125c,function(_0x2e4455){if(_0x2e4455['statusCode']!==0xc8){_0x2e67e0(new Error(_0xe501('0x17')+_0x1d5bb6+_0xe501('0x18')+_0x2e4455['statusCode']+'\x20('+_0x2e4455[_0xe501('0x19')]+')'));return;}var _0x4e7953='';_0x2e4455['on'](_0xe501('0x21'),function(_0x5d4aba){_0x4e7953+=_0x5d4aba;});_0x2e4455['on'](_0xe501('0x20'),function(){_0xc2ea4e(_0x4e7953);});})['on'](_0xe501('0x16'),function(_0x33f708){_0x2e67e0(_0x33f708);})['end']();});}function convertFile(_0x871b15,_0x580d03){return new BPromise(function(_0x4708b6,_0x1c1f32){var _0x10e521=sox[_0xe501('0x22')](_0x871b15,_0x580d03,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x10e521['on'](_0xe501('0x16'),function(_0x159f3){logger[_0xe501('0x16')](_0xe501('0x23'),_0x159f3);_0x1c1f32(_0x159f3);});_0x10e521['on']('end',function(){logger[_0xe501('0x1b')](_0xe501('0x24'));_0x4708b6();});_0x10e521[_0xe501('0x25')]();});}function base64Decode(_0x4bb3a0,_0x207764){var _0x1e1c34=path['resolve'](__dirname,_0xe501('0x26'),rs['generate'](0x4)+_0xe501('0x27'));fs['writeFileSync'](_0x1e1c34,_0x4bb3a0,_0xe501('0x28'));return convertFile(_0x1e1c34,_0x207764)[_0xe501('0x29')](function(){try{fs[_0xe501('0x1e')](_0x1e1c34);fs[_0xe501('0x2a')](_0x207764,'777');}catch(_0x477999){logger[_0xe501('0x16')](_0x477999);}return _0x207764[_0xe501('0x2b')]('.')[0x0];});}function base64Encode(_0x15b24b){var _0x4482a4=fs[_0xe501('0x2c')](_0x15b24b);return new Buffer(_0x4482a4)['toString'](_0xe501('0x28'));}exports['googleCloudTTS']=function(_0x467c9f,_0x262aef,_0x323178,_0x4b60ec,_0x24ee19,_0x3c93dc){var _0x7725e7,_0x5e739c;var _0x30c9ea=_0xe501('0x2d');var _0x537c00=_0xe501('0x2e')+_0x467c9f;var _0x481bd5={};if(_0x262aef===_0xe501('0x2f')){_0x481bd5[_0xe501('0x30')]={'ssml':_0x323178};}else{_0x481bd5['input']={'text':_0x323178};};_0x481bd5[_0xe501('0x31')]={'languageCode':_0x4b60ec,'ssmlGender':_0x24ee19};_0x481bd5[_0xe501('0x32')]={'audioEncoding':_0xe501('0x33'),'sampleRateHertz':0x1f40};var _0x4c5504={'url':_0x30c9ea+_0xe501('0x34')+_0x537c00,'method':_0xe501('0x35'),'json':!![],'body':_0x481bd5};return rp(_0x4c5504)['then'](function(_0x6b5386){return new BPromise(function(_0x555ab5,_0x982748){_0x7725e7=path[_0xe501('0x36')](__dirname,_0xe501('0x26'),rs[_0xe501('0x37')](0x4)+'.mp3');var _0x462b63=Buffer[_0xe501('0x38')](_0x6b5386[_0xe501('0x39')],_0xe501('0x28'));return fs[_0xe501('0x3a')](_0x7725e7,_0x462b63,function(_0x3e70ee){_0x982748(_0x3e70ee);},function(_0x5b0bf1){fs[_0xe501('0x2a')](_0x7725e7,_0xe501('0x3b'));_0x555ab5(_0x5b0bf1);});});})[_0xe501('0x29')](function(_0x337ddd){_0x5e739c=path[_0xe501('0x36')](__dirname,'tmp',rs[_0xe501('0x37')](0x4)+_0xe501('0x27'));return convertFile(_0x7725e7,_0x5e739c);})[_0xe501('0x29')](function(){try{fs[_0xe501('0x1e')](_0x7725e7);fs[_0xe501('0x2a')](_0x5e739c,_0xe501('0x3b'));}catch(_0x5879ee){logger[_0xe501('0x16')](_0x5879ee);}logger[_0xe501('0x1b')]('googleCloudTTS\x20path',_0x5e739c[_0xe501('0x2b')]('.')[0x0]);return _0x5e739c[_0xe501('0x2b')]('.')[0x0];});};exports[_0xe501('0x3c')]=function(_0x24f4de,_0x3bc8fc){var _0x4aa6c9=_0xe501('0x3d');var _0x537380,_0x41945a;var _0x417568;var _0x1ac62a={'encoding':_0xe501('0x3e'),'method':_0xe501('0x35'),'timeout':0x2710,'url':_0x4aa6c9,'headers':{'Content-Type':_0xe501('0x3f')},'body':_0xe501('0x40')+encodeURIComponent(JSON[_0xe501('0x41')]([[[_0xe501('0x42'),JSON[_0xe501('0x41')]([_0x24f4de,_0x3bc8fc||'en',![],_0xe501('0x43')]),null,_0xe501('0x44')]]]))};return rp(_0x1ac62a)[_0xe501('0x29')](function(_0x3de2e6){try{_0x417568=eval(_0x3de2e6['slice'](0x5))[0x0][0x2];}catch(_0x36af45){throw new Error(_0xe501('0x45')+_0x3de2e6[_0xe501('0x21')]);}if(!_0x417568){if(_0x24f4de[_0xe501('0x46')]>0xc8){throw new Error(_0xe501('0x47'));}else{throw new Error('lang\x20\x22'+_0x3bc8fc+_0xe501('0x48'));}}try{_0x417568=eval(_0x417568)[0x0];}catch(_0xcaa9b3){throw new Error('parse\x20response\x20failed:\x0a'+res[_0xe501('0x21')]);}const _0x530bef=_0x417568;_0x537380=path[_0xe501('0x36')](__dirname,_0xe501('0x26'),rs[_0xe501('0x37')](0x4)+_0xe501('0x49'));fs['writeFileSync'](_0x537380,_0x417568,{'encoding':_0xe501('0x28')});_0x41945a=path[_0xe501('0x36')](__dirname,_0xe501('0x26'),rs[_0xe501('0x37')](0x4)+'.wav');return convertFile(_0x537380,_0x41945a);})['then'](function(){try{fs[_0xe501('0x1e')](_0x537380);fs[_0xe501('0x2a')](_0x41945a,_0xe501('0x3b'));}catch(_0x396c18){logger[_0xe501('0x16')](_0x396c18);}logger[_0xe501('0x1b')](_0xe501('0x4a'),_0x41945a[_0xe501('0x2b')]('.')[0x0]);return _0x41945a[_0xe501('0x2b')]('.')[0x0];});};exports[_0xe501('0x4b')]=function(_0x33b297,_0x123f4c,_0x48b377){return google['asr'](_0x33b297,_0x123f4c,_0x48b377)[_0xe501('0x29')](function(_0x138cb2){logger['info'](_0x138cb2[_0xe501('0x4c')]);return rp(_0x138cb2);})[_0xe501('0x29')](function(_0x1eab3d){var _0x3ae05f='';var _0x3575c8=0x0;try{fs[_0xe501('0x1e')](_0x33b297);}catch(_0x154c8b){logger[_0xe501('0x16')](_0x154c8b);}if(_0x1eab3d&&_0x1eab3d['results']){_0x3ae05f=_0x1eab3d['results'][_0xe501('0x4d')](function(_0xdcf3bd){return _0xdcf3bd&&_0xdcf3bd[_0xe501('0x4e')][0x0]&&_0xdcf3bd[_0xe501('0x4e')][0x0][_0xe501('0x4f')]?_0xdcf3bd[_0xe501('0x4e')][0x0][_0xe501('0x4f')]:'';})[_0xe501('0x50')]('\x0a');_0x3575c8=_0x1eab3d[_0xe501('0x51')][_0xe501('0x4d')](function(_0x2a2214){return _0x2a2214&&_0x2a2214[_0xe501('0x4e')][0x0]&&_0x2a2214[_0xe501('0x4e')][0x0][_0xe501('0x52')]?_0x2a2214[_0xe501('0x4e')][0x0][_0xe501('0x52')]:0x0;})['join']('\x0a');}logger[_0xe501('0x1b')](_0xe501('0x53'),_0x3ae05f);logger['info']('googleASR\x20confidence',_0x3575c8);return{'transcript':_0x3ae05f,'confidence':_0x3575c8};})[_0xe501('0x54')](function(_0x126ce6){logger[_0xe501('0x16')](_0xe501('0x55'),_0x126ce6['statusCode'],_0x126ce6[_0xe501('0x56')],_0x126ce6[_0xe501('0x57')]);});};exports[_0xe501('0x58')]=function(_0x2c8e24,_0x3f6d76,_0x216283,_0x6c1f35){var _0x3ee288=apiai(_0x3f6d76,{'language':_0x6c1f35||'en'});return _0x3ee288[_0xe501('0x59')](_0x216283,{'sessionId':md5(_0x2c8e24)})[_0xe501('0x29')](function(_0x43e957){logger[_0xe501('0x1b')](JSON[_0xe501('0x41')](_0x43e957));return{'source':_0x43e957['result'][_0xe501('0x5a')],'resolvedQuery':_0x43e957[_0xe501('0x5b')][_0xe501('0x5c')],'action':_0x43e957[_0xe501('0x5b')]['action'],'actionIncomplete':_0x43e957[_0xe501('0x5b')][_0xe501('0x5d')],'speech':_0x43e957['result'][_0xe501('0x5e')]['speech'],'score':_0x43e957[_0xe501('0x5b')][_0xe501('0x5f')],'statusCode':_0x43e957['status'][_0xe501('0x60')],'endConversation':_0x43e957[_0xe501('0x5b')][_0xe501('0x61')][_0xe501('0x62')]||![],'isFallbackIntent':_0x43e957[_0xe501('0x5b')]['metadata'][_0xe501('0x63')]};});};exports['googleDialogflowV2']=function(_0x232394,_0x42cc21,_0x220ac5,_0x525438,_0x23b60d,_0x504324){var _0x5d8056=_0x525438[_0xe501('0x64')](/\\n/g,'\x0a');var _0x25b0c3={'credentials':{'private_key':_0x5d8056,'client_email':_0x220ac5}};var _0x5b4aca=new dialogflow[(_0xe501('0x65'))](_0x25b0c3);var _0x1ad9a6=_0x5b4aca[_0xe501('0x66')](_0x42cc21,md5(_0x232394));var _0x29a323={'session':_0x1ad9a6,'queryInput':{'text':{'text':_0x23b60d,'languageCode':_0x504324}}};return _0x5b4aca['detectIntent'](_0x29a323)[_0xe501('0x29')](function(_0x54e29d){if(_0x54e29d&&_0x54e29d[_0xe501('0x46')]){logger[_0xe501('0x1b')](_0xe501('0x67'),JSON[_0xe501('0x41')](_0x54e29d));var _0x46aa02=_0x54e29d[0x0];if(_0x46aa02){var _0x174a59={'action':_0x46aa02[_0xe501('0x68')][_0xe501('0x69')],'allRequiredParamsPresent':_0x46aa02[_0xe501('0x68')][_0xe501('0x6a')],'endConversation':_0x46aa02['queryResult']['diagnosticInfo']&&_0x46aa02[_0xe501('0x68')][_0xe501('0x6b')]['fields']?_0x46aa02[_0xe501('0x68')]['diagnosticInfo']['fields'][_0xe501('0x6c')][_0xe501('0x6d')]:![],'fulfillmentText':_0x46aa02[_0xe501('0x68')][_0xe501('0x6e')],'intentName':_0x46aa02[_0xe501('0x68')]['intent'][_0xe501('0x56')],'intentDisplayName':_0x46aa02[_0xe501('0x68')]['intent'][_0xe501('0x6f')],'isFallbackIntent':_0x46aa02[_0xe501('0x68')][_0xe501('0x70')][_0xe501('0x71')],'languageCode':_0x46aa02['queryResult'][_0xe501('0x72')],'queryText':_0x46aa02['queryResult'][_0xe501('0x73')],'responseId':_0x46aa02[_0xe501('0x74')],'score':_0x46aa02[_0xe501('0x68')][_0xe501('0x75')],'speech':_0x46aa02['queryResult'][_0xe501('0x6e')],'providerResponse':JSON[_0xe501('0x41')](_0x54e29d)};return _0x174a59;}}});};exports[_0xe501('0x76')]=function(_0x1472dc,_0x480666,_0x13c360,_0x3eb74c){return tilde[_0xe501('0x77')](_0x1472dc,_0x480666,_0x13c360,_0x3eb74c)['then'](function(_0x54826e){try{fs[_0xe501('0x1e')](_0x1472dc);}catch(_0x65153a){logger[_0xe501('0x16')](_0x65153a);}logger['info']('Tilde\x20ASR\x20transcription',_0x54826e[_0xe501('0x4f')]);logger[_0xe501('0x1b')](_0xe501('0x78'),_0x54826e[_0xe501('0x52')]);return _0x54826e;});};exports[_0xe501('0x79')]=function(_0x160c44,_0x33c620,_0x1db761,_0xb2c4ee,_0x41ca20,_0x49095b){var _0x3e752f=path['resolve'](__dirname,'tmp',rs[_0xe501('0x37')](0x4)+'.mp3');var _0x5478d6;return aws[_0xe501('0x7a')](_0x160c44,_0x33c620,_0x1db761,_0xb2c4ee,_0x41ca20,_0x49095b,_0x3e752f)[_0xe501('0x29')](function(){_0x5478d6=path['resolve'](__dirname,_0xe501('0x26'),rs['generate'](0x4)+_0xe501('0x27'));return convertFile(_0x3e752f,_0x5478d6);})[_0xe501('0x29')](function(){try{fs['unlink'](_0x3e752f);fs[_0xe501('0x2a')](_0x5478d6,_0xe501('0x3b'));}catch(_0x5367c5){logger[_0xe501('0x16')](_0x5367c5);}return _0x5478d6['split']('.')[0x0];});};exports[_0xe501('0x7b')]=function(_0x261ef1,_0x15d655,_0x419ab8,_0x5e7948,_0x20316b,_0x1db71e){return aws['lex'](_0x261ef1,_0x15d655,_0x419ab8,_0x5e7948,_0x20316b,_0x1db71e)[_0xe501('0x29')](function(_0x17ab6e){logger['info'](JSON[_0xe501('0x41')](_0x17ab6e));return _0x17ab6e;});};exports[_0xe501('0x7c')]=function(_0x4bbe62,_0x13ddb8,_0x5d8441,_0x58b2b0){var _0x46a09e=util[_0xe501('0x7d')](_0xe501('0x7e'),ISPEECH_API,_0x4bbe62,encodeURIComponent(_0x13ddb8),_0x5d8441,_0x58b2b0);var _0xe1c242=path['resolve'](__dirname,_0xe501('0x26'),rs[_0xe501('0x37')](0x4)+_0xe501('0x49'));var _0x215703;return downloadFile(_0x46a09e,_0xe1c242)[_0xe501('0x29')](function(){_0x215703=path['resolve'](__dirname,_0xe501('0x26'),rs[_0xe501('0x37')](0x4)+_0xe501('0x27'));return convertFile(_0xe1c242,_0x215703);})['then'](function(){try{fs[_0xe501('0x1e')](_0xe1c242);fs['chmodSync'](_0x215703,_0xe501('0x3b'));}catch(_0x1d6717){logger['error'](_0x1d6717);}return _0x215703[_0xe501('0x2b')]('.')[0x0];});};exports[_0xe501('0x7f')]=function(_0x219264,_0x5212b6,_0x208e3d,_0x108ae0){var _0x135553=util[_0xe501('0x7d')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x5212b6,_0x208e3d,base64Encode(_0x219264),_0x108ae0?util[_0xe501('0x7d')]('model=%s',encodeURIComponent(_0x108ae0)):_0xe501('0x80'));return uploadFile(_0x135553)[_0xe501('0x29')](function(_0x2c899e){return querystring['parse'](_0x2c899e);});};exports[_0xe501('0x81')]=function(_0x3fe2d8,_0x36537f){return sestek[_0xe501('0x82')](_0x3fe2d8,_0x36537f)[_0xe501('0x29')](function(_0x2c3e11){logger[_0xe501('0x1b')](JSON[_0xe501('0x41')](_0x2c3e11));var _0x45ec9e={'speech':_0x2c3e11[_0xe501('0x83')],'action':_0x2c3e11['channelData']?_0x2c3e11[_0xe501('0x84')][_0xe501('0x85')]:undefined,'actiondata':_0x2c3e11[_0xe501('0x84')]?_0x2c3e11[_0xe501('0x84')]['CustomActionData']:undefined};if(_0x2c3e11[_0xe501('0x84')]&&_0x2c3e11['channelData'][_0xe501('0x86')]){return base64Decode(_0x2c3e11[_0xe501('0x84')]['AudioFromTts']['Data'],path[_0xe501('0x36')](__dirname,'tmp',rs[_0xe501('0x37')](0x4)+'.wav'))['then'](function(_0x541a21){_0x45ec9e[_0xe501('0x87')]=_0x541a21;return _0x45ec9e;});}return _0x45ec9e;});};exports[_0xe501('0x88')]=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 1153e48..0ae74fb 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 _0x1e7c=['exports'];(function(_0x4ed38f,_0x2e2d0c){var _0x1763a4=function(_0x1f1481){while(--_0x1f1481){_0x4ed38f['push'](_0x4ed38f['shift']());}};_0x1763a4(++_0x2e2d0c);}(_0x1e7c,0x6a));var _0xc1e7=function(_0x5def89,_0x493344){_0x5def89=_0x5def89-0x0;var _0x16619c=_0x1e7c[_0x5def89];return _0x16619c;};var nda=require('./nda');module[_0xc1e7('0x0')]={'nda':nda}; \ No newline at end of file +var _0xa50e=['exports'];(function(_0xd648cd,_0x42ff94){var _0xa3e72c=function(_0x38cee2){while(--_0x38cee2){_0xd648cd['push'](_0xd648cd['shift']());}};_0xa3e72c(++_0x42ff94);}(_0xa50e,0xa3));var _0xea50=function(_0x14aff9,_0x209150){_0x14aff9=_0x14aff9-0x0;var _0x5d80de=_0xa50e[_0x14aff9];return _0x5d80de;};var nda=require('./nda');module[_0xea50('0x0')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ea678da..d83d3e0 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 _0xcc40=['project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','custom_action_data','info','stringify','request-promise','agi','exports','POST','resolve','/token','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xcc40,0x97));var _0x0cc4=function(_0xa038c5,_0x427209){_0xa038c5=_0xa038c5-0x0;var _0x135fb9=_0xcc40[_0xa038c5];return _0x135fb9;};'use strict';var rp=require(_0x0cc4('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0x0cc4('0x1'));module[_0x0cc4('0x2')]=function(_0x5cfa9a,_0x19b2bd){var _0x4ba107={'method':_0x0cc4('0x3'),'uri':url[_0x0cc4('0x4')](_0x19b2bd['ndauth_url'],_0x0cc4('0x5')),'form':{'grant_type':'password','username':_0x19b2bd[_0x0cc4('0x6')],'password':_0x19b2bd['password']},'json':!![]};return rp(_0x4ba107)['then'](function(_0x349c6a){var _0x2fd087={'method':_0x0cc4('0x3'),'uri':url['resolve'](_0x19b2bd['ndassistant_url'],_0x0cc4('0x7')),'body':{'type':_0x19b2bd[_0x0cc4('0x8')]||'message','channelId':'Nda','conversation':{'id':_0x5cfa9a[_0x0cc4('0x9')]},'from':{'id':_0x5cfa9a[_0x0cc4('0xa')],'name':_0x5cfa9a[_0x0cc4('0xb')]},'recipient':{'id':_0x5cfa9a[_0x0cc4('0xc')],'name':_0x5cfa9a[_0x0cc4('0xd')]},'text':_0x19b2bd[_0x0cc4('0xe')],'channelData':{}},'headers':{'Authorization':_0x0cc4('0xf')+_0x349c6a[_0x0cc4('0x10')]},'json':!![]};if(_0x19b2bd[_0x0cc4('0x11')]){_0x2fd087[_0x0cc4('0x12')][_0x0cc4('0x13')][_0x0cc4('0x14')]=_0x19b2bd[_0x0cc4('0x11')];}if(_0x19b2bd[_0x0cc4('0x15')]=='1'){_0x2fd087[_0x0cc4('0x12')]['channelData'][_0x0cc4('0x16')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x0cc4('0x17')};}if(_0x19b2bd[_0x0cc4('0x18')]){_0x2fd087[_0x0cc4('0x12')][_0x0cc4('0x13')]['CustomAction']=_0x19b2bd[_0x0cc4('0x18')];if(_0x19b2bd[_0x0cc4('0x19')]){_0x2fd087[_0x0cc4('0x12')][_0x0cc4('0x13')]['CustomActionData']=_0x19b2bd[_0x0cc4('0x19')];}}logger[_0x0cc4('0x1a')](JSON[_0x0cc4('0x1b')](_0x2fd087));return rp(_0x2fd087);});}; \ No newline at end of file +var _0x263f=['exports','POST','resolve','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','text','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi'];(function(_0xc04394,_0x16410c){var _0x335408=function(_0x1a822f){while(--_0x1a822f){_0xc04394['push'](_0xc04394['shift']());}};_0x335408(++_0x16410c);}(_0x263f,0x182));var _0xf263=function(_0x3b2397,_0x4d52e8){_0x3b2397=_0x3b2397-0x0;var _0x4a81ea=_0x263f[_0x3b2397];return _0x4a81ea;};'use strict';var rp=require(_0xf263('0x0'));var url=require(_0xf263('0x1'));var logger=require(_0xf263('0x2'))(_0xf263('0x3'));module[_0xf263('0x4')]=function(_0x40bbe9,_0x59c41f){var _0x3696a6={'method':_0xf263('0x5'),'uri':url[_0xf263('0x6')](_0x59c41f['ndauth_url'],_0xf263('0x7')),'form':{'grant_type':_0xf263('0x8'),'username':_0x59c41f['username'],'password':_0x59c41f['password']},'json':!![]};return rp(_0x3696a6)[_0xf263('0x9')](function(_0x9644ab){var _0xa2e77e={'method':_0xf263('0x5'),'uri':url['resolve'](_0x59c41f[_0xf263('0xa')],_0xf263('0xb')),'body':{'type':_0x59c41f[_0xf263('0xc')]||_0xf263('0xd'),'channelId':_0xf263('0xe'),'conversation':{'id':_0x40bbe9[_0xf263('0xf')]},'from':{'id':_0x40bbe9[_0xf263('0x10')],'name':_0x40bbe9['calleridname']},'recipient':{'id':_0x40bbe9[_0xf263('0x11')],'name':_0x40bbe9['extension']},'text':_0x59c41f[_0xf263('0x12')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x9644ab['access_token']},'json':!![]};if(_0x59c41f[_0xf263('0x13')]){_0xa2e77e[_0xf263('0x14')][_0xf263('0x15')][_0xf263('0x16')]=_0x59c41f[_0xf263('0x13')];}if(_0x59c41f[_0xf263('0x17')]=='1'){_0xa2e77e[_0xf263('0x14')]['channelData'][_0xf263('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x59c41f[_0xf263('0x19')]){_0xa2e77e[_0xf263('0x14')][_0xf263('0x15')][_0xf263('0x1a')]=_0x59c41f[_0xf263('0x19')];if(_0x59c41f[_0xf263('0x1b')]){_0xa2e77e[_0xf263('0x14')]['channelData']['CustomActionData']=_0x59c41f[_0xf263('0x1b')];}}logger[_0xf263('0x1c')](JSON[_0xf263('0x1d')](_0xa2e77e));return rp(_0xa2e77e);});}; \ 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 8e5e9f5..d24e9bb 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. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x1ff055,_0x303226,_0x2299d1,_0x5c16fc){return asr(_0x1ff055,_0x303226,_0x2299d1,_0x5c16fc);}; \ No newline at end of file +var _0xd7f3=['exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xd7f3,0x7d));var _0x3d7f=function(_0x82f586,_0x382c19){_0x82f586=_0x82f586-0x0;var _0x591ec8=_0xd7f3[_0x82f586];return _0x591ec8;};'use strict';var asr=require('./lib/api');module[_0x3d7f('0x0')]=function(_0x334ab3,_0x5ecf20,_0x3ad9ab,_0x4abb8d){return asr(_0x334ab3,_0x5ecf20,_0x3ad9ab,_0x4abb8d);}; \ 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 2b779d6..02ac092 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 _0x017b=['bluebird','lodash','crypto','../../../../../../config/logger','agi','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','update','digest','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','parse','status','result','info','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','terminate','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.','error','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isObject','message'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0x017b,0xbe));var _0xb017=function(_0x7e5018,_0x2670e0){_0x7e5018=_0x7e5018-0x0;var _0x17bf2f=_0x017b[_0x7e5018];return _0x17bf2f;};'use strict';var BPromise=require(_0xb017('0x0'));var _=require(_0xb017('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0xb017('0x2'));var logger=require(_0xb017('0x3'))(_0xb017('0x4'));module['exports']=function(_0x22af75,_0x1aadd3,_0x474fe8,_0x210298){return new BPromise(function(_0x1cf972,_0x4d5c58){logger['info'](_0xb017('0x5'),_0x210298||_0xb017('0x6'));var _0x2d1027=new WebSocket(_0x210298||_0xb017('0x6'),{'perMessageDeflate':![]});var _0x43f6be='';var _0x3e9ffe='0';var _0x3d8fa4='1';var _0x341d51='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x10abc6(_0x130ffe){var _0x423e18=crypto['createHash']('sha1');_0x423e18[_0xb017('0x7')](_0x130ffe);return _0x423e18[_0xb017('0x8')]('hex');}function _0x3f4f2d(){try{logger['info'](_0xb017('0x9'));var _0x5a6013=moment()[_0xb017('0xa')]();var _0x48a18b=_0x10abc6(_0x5a6013+_0x1aadd3+_0x474fe8);_0x2d1027[_0xb017('0xb')](JSON[_0xb017('0xc')]({'appID':_0x1aadd3,'timestamp':_0x5a6013,'appKey':_0x48a18b}));var _0x57dfb6=fs[_0xb017('0xd')](_0x22af75);_0x57dfb6['on'](_0xb017('0xe'),function(_0x307b3f){_0x2d1027[_0xb017('0xb')](_0x307b3f);});_0x57dfb6['on'](_0xb017('0xf'),function(){_0x2d1027[_0xb017('0xb')](_0xb017('0x10'));});}catch(_0x3ff4e2){logger['error'](_0xb017('0x11'),JSON[_0xb017('0xc')](_0x3ff4e2));_0x2d1027['terminate']();}}function _0xbc29c0(_0x5d694c){try{if(_0x5d694c){var _0x2bc0eb=JSON[_0xb017('0x12')](_0x5d694c);switch(_0x2bc0eb[_0xb017('0x13')]){case 0x0:if(_0x2bc0eb[_0xb017('0x14')]){if(_0x2bc0eb[_0xb017('0x14')]['final']){logger[_0xb017('0x15')](_0xb017('0x16'),JSON[_0xb017('0xc')](_0x2bc0eb[_0xb017('0x14')][_0xb017('0x17')]));_0x43f6be=_0x2bc0eb['result'][_0xb017('0x17')][0x0][_0xb017('0x18')];_0x3e9ffe=_0x2bc0eb['result'][_0xb017('0x17')][0x0][_0xb017('0x19')];_0x3d8fa4='0';_0x341d51=_0xb017('0x1a');_0x2d1027[_0xb017('0x1b')]();}}break;case 0x1:logger[_0xb017('0x15')](_0xb017('0x1c'));_0x3d8fa4='1';_0x341d51='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0xb017('0x1d'));_0x3d8fa4='2';_0x341d51=_0xb017('0x1d');break;case 0x9:logger[_0xb017('0x15')](_0xb017('0x1e'));_0x3d8fa4='9';_0x341d51=_0xb017('0x1e');break;case 0xa:logger[_0xb017('0x15')](_0xb017('0x1f'));_0x3d8fa4='10';_0x341d51=_0xb017('0x1f');break;case 0xb:logger[_0xb017('0x15')](_0xb017('0x20'));_0x3d8fa4='11';_0x341d51=_0xb017('0x20');}}}catch(_0x1d97c3){logger[_0xb017('0x21')](_0xb017('0x22'),JSON[_0xb017('0xc')](_0x1d97c3));_0x2d1027[_0xb017('0x1b')]();}}function _0x198e2f(){logger[_0xb017('0x15')]('Close\x20Tilde\x20ASR\x20socket');_0x1cf972({'transcript':_0x43f6be,'confidence':_0x3e9ffe,'status':_0x3d8fa4,'status_message':_0x341d51});}function _0x4cf0d1(_0x34ef5e){logger['error'](_0xb017('0x23'));if(!_['isNil'](_0x34ef5e)){logger[_0xb017('0x21')](_[_0xb017('0x24')](_0x34ef5e)?JSON[_0xb017('0xc')](_0x34ef5e):_0x34ef5e);}}_0x2d1027['on']('open',_0x3f4f2d);_0x2d1027['on'](_0xb017('0x25'),_0xbc29c0);_0x2d1027['on'](_0xb017('0xf'),_0x198e2f);_0x2d1027['on'](_0xb017('0x21'),_0x4cf0d1);});}; \ No newline at end of file +var _0xe803=['bluebird','moment','crypto','agi','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','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','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','message'];(function(_0x1495be,_0x2cf60b){var _0xce120d=function(_0x47d684){while(--_0x47d684){_0x1495be['push'](_0x1495be['shift']());}};_0xce120d(++_0x2cf60b);}(_0xe803,0x1ea));var _0x3e80=function(_0x1cca5c,_0xa5099d){_0x1cca5c=_0x1cca5c-0x0;var _0x38b488=_0xe803[_0x1cca5c];return _0x38b488;};'use strict';var BPromise=require(_0x3e80('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3e80('0x1'));var crypto=require(_0x3e80('0x2'));var logger=require('../../../../../../config/logger')(_0x3e80('0x3'));module['exports']=function(_0x4571ec,_0x2a27f0,_0xabbd1,_0xa5377b){return new BPromise(function(_0x22f3e8,_0x3abaea){logger[_0x3e80('0x4')](_0x3e80('0x5'),_0xa5377b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x5a356a=new WebSocket(_0xa5377b||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x572809='';var _0x163a38='0';var _0x3e4d23='1';var _0x44bdd5=_0x3e80('0x6');function _0xfb28c(_0x1c8189){var _0x31ea53=crypto['createHash']('sha1');_0x31ea53[_0x3e80('0x7')](_0x1c8189);return _0x31ea53[_0x3e80('0x8')](_0x3e80('0x9'));}function _0x26ed2e(){try{logger['info'](_0x3e80('0xa'));var _0x15ca27=moment()[_0x3e80('0xb')]();var _0x12d978=_0xfb28c(_0x15ca27+_0x2a27f0+_0xabbd1);_0x5a356a[_0x3e80('0xc')](JSON[_0x3e80('0xd')]({'appID':_0x2a27f0,'timestamp':_0x15ca27,'appKey':_0x12d978}));var _0xcb4e73=fs['createReadStream'](_0x4571ec);_0xcb4e73['on'](_0x3e80('0xe'),function(_0x33de12){_0x5a356a['send'](_0x33de12);});_0xcb4e73['on'](_0x3e80('0xf'),function(){_0x5a356a[_0x3e80('0xc')](_0x3e80('0x10'));});}catch(_0x4f09fe){logger[_0x3e80('0x11')](_0x3e80('0x12'),JSON['stringify'](_0x4f09fe));_0x5a356a['terminate']();}}function _0x36d3e5(_0x19c0d6){try{if(_0x19c0d6){var _0x56348b=JSON[_0x3e80('0x13')](_0x19c0d6);switch(_0x56348b['status']){case 0x0:if(_0x56348b['result']){if(_0x56348b[_0x3e80('0x14')][_0x3e80('0x15')]){logger[_0x3e80('0x4')](_0x3e80('0x16'),JSON[_0x3e80('0xd')](_0x56348b[_0x3e80('0x14')]['hypotheses']));_0x572809=_0x56348b['result']['hypotheses'][0x0]['transcript'];_0x163a38=_0x56348b['result'][_0x3e80('0x17')][0x0][_0x3e80('0x18')];_0x3e4d23='0';_0x44bdd5=_0x3e80('0x19');_0x5a356a['terminate']();}}break;case 0x1:logger[_0x3e80('0x4')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x3e4d23='1';_0x44bdd5='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x3e4d23='2';_0x44bdd5=_0x3e80('0x1a');break;case 0x9:logger[_0x3e80('0x4')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3e4d23='9';_0x44bdd5=_0x3e80('0x1b');break;case 0xa:logger[_0x3e80('0x4')](_0x3e80('0x1c'));_0x3e4d23='10';_0x44bdd5=_0x3e80('0x1c');break;case 0xb:logger[_0x3e80('0x4')](_0x3e80('0x1d'));_0x3e4d23='11';_0x44bdd5=_0x3e80('0x1d');}}}catch(_0x59d28c){logger[_0x3e80('0x11')](_0x3e80('0x1e'),JSON[_0x3e80('0xd')](_0x59d28c));_0x5a356a[_0x3e80('0x1f')]();}}function _0x123a5f(){logger[_0x3e80('0x4')](_0x3e80('0x20'));_0x22f3e8({'transcript':_0x572809,'confidence':_0x163a38,'status':_0x3e4d23,'status_message':_0x44bdd5});}function _0x599430(_0xedaa89){logger[_0x3e80('0x11')](_0x3e80('0x21'));if(!_['isNil'](_0xedaa89)){logger[_0x3e80('0x11')](_['isObject'](_0xedaa89)?JSON['stringify'](_0xedaa89):_0xedaa89);}}_0x5a356a['on']('open',_0x26ed2e);_0x5a356a['on'](_0x3e80('0x22'),_0x36d3e5);_0x5a356a['on'](_0x3e80('0xf'),_0x123a5f);_0x5a356a['on'](_0x3e80('0x11'),_0x599430);});}; \ 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 4f94190..b5a2796 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 _0x146c=['exports','./asr'];(function(_0x4653b1,_0x2aa0e3){var _0x44f0c6=function(_0x7c47c9){while(--_0x7c47c9){_0x4653b1['push'](_0x4653b1['shift']());}};_0x44f0c6(++_0x2aa0e3);}(_0x146c,0x119));var _0xc146=function(_0x5cac06,_0x39ddc5){_0x5cac06=_0x5cac06-0x0;var _0x49685d=_0x146c[_0x5cac06];return _0x49685d;};var asr=require(_0xc146('0x0'));module[_0xc146('0x1')]={'asr':asr}; \ No newline at end of file +var _0x2a08=['exports'];(function(_0x41d813,_0x846fbf){var _0x3cdc9d=function(_0x360dcc){while(--_0x360dcc){_0x41d813['push'](_0x41d813['shift']());}};_0x3cdc9d(++_0x846fbf);}(_0x2a08,0x1e4));var _0x82a0=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2a08[_0x502c7d];return _0x30b7ed;};var asr=require('./asr');module[_0x82a0('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c9f6dda..885941e 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 _0x4d73=['close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','127.0.0.1','E_AGI_ARGUMENT_PORT','createServer','emit','listening','connection','getConnections','E_AGI_SERVER_ERROR','error','E_AGI_SERVER_VOICE_DISABLED','destroy','ready','code'];(function(_0x13f2ec,_0x407206){var _0x389ca9=function(_0x43d7d6){while(--_0x43d7d6){_0x13f2ec['push'](_0x13f2ec['shift']());}};_0x389ca9(++_0x407206);}(_0x4d73,0x1e8));var _0x34d7=function(_0x1f43f4,_0x16d500){_0x1f43f4=_0x1f43f4-0x0;var _0x5435b7=_0x4d73[_0x1f43f4];return _0x5435b7;};'use strict';var util=require(_0x34d7('0x0'));var net=require(_0x34d7('0x1'));var EventEmitter=require(_0x34d7('0x2'))[_0x34d7('0x3')];var AGIError=require(_0x34d7('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x25b0fd,_0x5bf8df,_0x5c4eb1){var _0x232be6=this,_0x25b0fd=_0x25b0fd||0x11dd,_0x5bf8df=_0x5bf8df||_0x34d7('0x5'),_0x387019=null,_0xf13cad=0x0;EventEmitter['call'](_0x232be6);function _0x5434c5(){if(!_0x25b0fd){_0x232be6['emit']('error',new AGIError(_0x34d7('0x6')));return![];}_0x387019=net[_0x34d7('0x7')]();_0x387019['listen'](_0x25b0fd,_0x5bf8df);_0x387019['on']('listening',function(){_0x232be6[_0x34d7('0x8')](_0x34d7('0x9'));});_0x387019['on'](_0x34d7('0xa'),function(_0x5e782d){_0x387019[_0x34d7('0xb')](function(_0x5b9892,_0x28243c){if(_0x5b9892){_0x232be6[_0x34d7('0x8')]('error',new AGIError(_0x34d7('0xc'),_0x5b9892));}else if(_0x5c4eb1&&_0x5c4eb1<0x0){_0x232be6[_0x34d7('0x8')](_0x34d7('0xd'),new AGIError(_0x34d7('0xe')));_0x5e782d[_0x34d7('0xf')]();}else if(_0x5c4eb1&&_0x5c4eb1>0x0&&_0x5c4eb1<_0x28243c){_0xf13cad+=0x1;_0x232be6[_0x34d7('0x8')](_0x34d7('0xd'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0xf13cad));_0x5e782d[_0x34d7('0xf')]();}else{var _0x54a3ce=new AGIChannel(_0x5e782d);_0x54a3ce['on'](_0x34d7('0x10'),function(){_0x232be6['emit'](_0x34d7('0xa'),_0x54a3ce);});}});});_0x387019['on'](_0x34d7('0xd'),function(_0x3c5711){_0x232be6[_0x34d7('0x8')](_0x34d7('0xd'),new AGIError(_0x34d7('0xc'),_0x3c5711[_0x34d7('0x11')]));});_0x387019['on'](_0x34d7('0x12'),function(){_0x232be6[_0x34d7('0x8')](_0x34d7('0x12'),new AGIError(_0x34d7('0x13')));});}process[_0x34d7('0x14')](function(){_0x5434c5();});};util[_0x34d7('0x15')](AGIServer,EventEmitter);module[_0x34d7('0x16')]=function(_0x33b16a,_0x4aad6e,_0x39326d){return new AGIServer(_0x33b16a,_0x4aad6e,_0x39326d);}; \ No newline at end of file +var _0x41a0=['inherits','util','net','events','EventEmitter','./error','127.0.0.1','call','emit','error','listening','connection','getConnections','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','nextTick'];(function(_0x3d26d9,_0x2f901c){var _0x2d7f8c=function(_0x15340f){while(--_0x15340f){_0x3d26d9['push'](_0x3d26d9['shift']());}};_0x2d7f8c(++_0x2f901c);}(_0x41a0,0x79));var _0x041a=function(_0x126c55,_0x21dabc){_0x126c55=_0x126c55-0x0;var _0x444e11=_0x41a0[_0x126c55];return _0x444e11;};'use strict';var util=require(_0x041a('0x0'));var net=require(_0x041a('0x1'));var EventEmitter=require(_0x041a('0x2'))[_0x041a('0x3')];var AGIError=require(_0x041a('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x281228,_0x22f542,_0x17a47c){var _0x285d2c=this,_0x281228=_0x281228||0x11dd,_0x22f542=_0x22f542||_0x041a('0x5'),_0x4b5885=null,_0x2c97d1=0x0;EventEmitter[_0x041a('0x6')](_0x285d2c);function _0x238c78(){if(!_0x281228){_0x285d2c[_0x041a('0x7')](_0x041a('0x8'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x4b5885=net['createServer']();_0x4b5885['listen'](_0x281228,_0x22f542);_0x4b5885['on'](_0x041a('0x9'),function(){_0x285d2c[_0x041a('0x7')]('listening');});_0x4b5885['on'](_0x041a('0xa'),function(_0x2d4d14){_0x4b5885[_0x041a('0xb')](function(_0x1a8204,_0x2c2035){if(_0x1a8204){_0x285d2c[_0x041a('0x7')](_0x041a('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x1a8204));}else if(_0x17a47c&&_0x17a47c<0x0){_0x285d2c[_0x041a('0x7')](_0x041a('0x8'),new AGIError(_0x041a('0xc')));_0x2d4d14[_0x041a('0xd')]();}else if(_0x17a47c&&_0x17a47c>0x0&&_0x17a47c<_0x2c2035){_0x2c97d1+=0x1;_0x285d2c[_0x041a('0x7')](_0x041a('0x8'),new AGIError(_0x041a('0xe'),_0x2c97d1));_0x2d4d14[_0x041a('0xd')]();}else{var _0x5f24d5=new AGIChannel(_0x2d4d14);_0x5f24d5['on']('ready',function(){_0x285d2c[_0x041a('0x7')](_0x041a('0xa'),_0x5f24d5);});}});});_0x4b5885['on']('error',function(_0x3765fe){_0x285d2c[_0x041a('0x7')](_0x041a('0x8'),new AGIError(_0x041a('0xf'),_0x3765fe['code']));});_0x4b5885['on'](_0x041a('0x10'),function(){_0x285d2c[_0x041a('0x7')](_0x041a('0x10'),new AGIError(_0x041a('0x11')));});}process[_0x041a('0x12')](function(){_0x238c78();});};util[_0x041a('0x13')](AGIServer,EventEmitter);module['exports']=function(_0x201528,_0x4627ec,_0xc051ff){return new AGIServer(_0x201528,_0x4627ec,_0xc051ff);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 99d6f08..0fefb18 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 _0x2db9=['apiKey','text','languageCode','en-US','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','key','dialogflow_language','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','speed','ispeech_asr_language','isConfigured','awsPolly','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult','length','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','retry','mrcpsynth','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','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','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','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','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','googleDialogflow','DIALOGFLOW_%s','speech','out','dialogflow','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','no\x20private_key\x20configured','dialogflowV2_language','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','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','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','NOBEEP','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','interval_id','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechASR','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','no\x20file\x20audio\x20selected','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','secure','authentication','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','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','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','path','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','catch','getVoiceQueue','getSquareProject','getSquareProjectById','then','name','getSquareOdbc','getSquareOdbcById','dsn','getUser','getSound','getSoundById','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervalById','IntervalId','interval','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','callerid','agent','agentLogout','%s/%s@from-sip/n','agentLogin','shellCommand','exec','replace','googleCloudTTS'];(function(_0x224dda,_0x16d0f9){var _0x2987ac=function(_0x3b1033){while(--_0x3b1033){_0x224dda['push'](_0x224dda['shift']());}};_0x2987ac(++_0x16d0f9);}(_0x2db9,0x171));var _0x92db=function(_0x38139d,_0x265993){_0x38139d=_0x38139d-0x0;var _0x455d24=_0x2db9[_0x38139d];return _0x455d24;};'use strict';var fs=require('fs');var path=require(_0x92db('0x0'));var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x92db('0x1'))();var rs=require(_0x92db('0x2'));var moment=require(_0x92db('0x3'));var Mustache=require(_0x92db('0x4'));var rp=require('request-promise');var logger=require(_0x92db('0x5'))(_0x92db('0x6'));var config=require(_0x92db('0x7'));var scripts=require(_0x92db('0x8'));var FILES_PATH=_0x92db('0x9');var recursiveMapAttributes=[_0x92db('0xa'),_0x92db('0xb')];var verticesWithRetry=['menu',_0x92db('0xc'),_0x92db('0xd')];var AGIVertices=function(_0x1c29bf,_0x390a33,_0x574e09){this[_0x92db('0xe')]=_0x1c29bf;this[_0x92db('0xf')]=_0x390a33;this[_0x92db('0x10')]=_0x574e09;};AGIVertices[_0x92db('0x11')][_0x92db('0x12')]=function(_0x568ae4,_0x11a0a4){this[_0x92db('0xf')][_0x92db('0x13')](_0x568ae4)['then'](function(_0x2e0ac4){_0x11a0a4(null,_0x2e0ac4?_0x2e0ac4['name']:![]);})[_0x92db('0x14')](function(_0x5dfb2e){_0x11a0a4(_0x5dfb2e);});};AGIVertices[_0x92db('0x11')][_0x92db('0x15')]=function(_0x4188ab,_0x1ca310){this[_0x92db('0xf')]['getVoiceQueueById'](_0x4188ab)['then'](function(_0x3c5d10){_0x1ca310(null,_0x3c5d10?_0x3c5d10['name']:![]);})['catch'](function(_0x164b1a){_0x1ca310(_0x164b1a);});};AGIVertices['prototype'][_0x92db('0x16')]=function(_0x1612bf,_0x1cd924){this['rpc'][_0x92db('0x17')](_0x1612bf)[_0x92db('0x18')](function(_0x1d00ed){_0x1cd924(null,_0x1d00ed?_0x1d00ed[_0x92db('0x19')]:![]);})['catch'](function(_0x59856c){_0x1cd924(_0x59856c);});};AGIVertices['prototype'][_0x92db('0x1a')]=function(_0x574042,_0x5a974c){this['rpc'][_0x92db('0x1b')](_0x574042)[_0x92db('0x18')](function(_0x4b2aae){_0x5a974c(null,_0x4b2aae?_0x4b2aae[_0x92db('0x1c')]:![]);})['catch'](function(_0x29affd){_0x5a974c(_0x29affd);});};AGIVertices[_0x92db('0x11')][_0x92db('0x1d')]=function(_0x547a24,_0x71fc7c){this[_0x92db('0xf')]['getUserById'](_0x547a24)[_0x92db('0x18')](function(_0x363dd9){_0x71fc7c(null,_0x363dd9?_0x363dd9['name']:![]);})['catch'](function(_0x3c73a8){_0x71fc7c(_0x3c73a8);});};AGIVertices[_0x92db('0x11')]['getTrunk']=function(_0x19bfbe,_0x1b01e6){this[_0x92db('0xf')]['getTrunkById'](_0x19bfbe)[_0x92db('0x18')](function(_0x27455f){_0x1b01e6(null,_0x27455f?_0x27455f[_0x92db('0x19')]:![]);})['catch'](function(_0x461621){_0x1b01e6(_0x461621);});};AGIVertices[_0x92db('0x11')][_0x92db('0x1e')]=function(_0x5e43d3,_0x2125e9){var _0x2b1374=this;this['rpc'][_0x92db('0x1f')](_0x5e43d3)[_0x92db('0x18')](function(_0x3c21e0){_0x2125e9(null,_0x3c21e0?_0x2b1374['getSoundPath'](_0x3c21e0[_0x92db('0x20')]):![]);})[_0x92db('0x14')](function(_0x493797){_0x2125e9(_0x493797);});};AGIVertices[_0x92db('0x11')][_0x92db('0x21')]=function(_0x5c6787,_0x1b7195){this[_0x92db('0xf')][_0x92db('0x22')](_0x5c6787)[_0x92db('0x18')](function(_0x2228dc){_0x1b7195(null,_0x2228dc?_0x2228dc:![]);})[_0x92db('0x14')](function(_0x134b33){_0x1b7195(_0x134b33);});};AGIVertices[_0x92db('0x11')][_0x92db('0x23')]=function(_0x52e3f4,_0x369d25,_0x6a57cb){this['mailRpc'][_0x92db('0x23')](_0x52e3f4,_0x369d25)[_0x92db('0x18')](function(){_0x6a57cb(null);})[_0x92db('0x14')](function(_0x59689f){_0x6a57cb(_0x59689f);});};AGIVertices[_0x92db('0x11')]['getIntervals']=function(_0x37ed39,_0x5ebf5c){this['rpc'][_0x92db('0x24')](_0x37ed39)[_0x92db('0x18')](function(_0xc2c2a0){if(_0xc2c2a0){if(_0xc2c2a0[_0x92db('0x25')]){_0x5ebf5c(null,[_0xc2c2a0[_0x92db('0x26')]]);}else{_0x5ebf5c(null,_['map'](_0xc2c2a0[_0x92db('0x27')],_0x92db('0x26')));}}else{_0x5ebf5c(null,![]);}})[_0x92db('0x14')](function(_0x301156){_0x5ebf5c(_0x301156);});};AGIVertices[_0x92db('0x11')][_0x92db('0x28')]=function(_0xf6a05f){return util[_0x92db('0x29')](_0x92db('0x2a'),FILES_PATH,_0xf6a05f);};AGIVertices[_0x92db('0x11')]['getQueryOdbc']=function(_0x460516,_0x299088,_0x55937a){odbc[_0x92db('0x2b')](_0x460516,function(_0x27c689){if(_0x27c689){logger[_0x92db('0x2c')](_0x92db('0x2d'),_0x27c689);_0x55937a(_0x27c689);}else{logger['info'](_0x92db('0x2e'));odbc[_0x92db('0x2f')](_0x299088,function(_0x19220c,_0x55fcb2){if(_0x19220c){logger[_0x92db('0x30')]('Error\x20executing\x20query\x20%s',_0x299088);_0x55937a(_0x19220c);}else{logger[_0x92db('0x30')](_0x92db('0x31'),_0x299088);odbc[_0x92db('0x32')](function(_0x3b2efe){if(_0x3b2efe){logger[_0x92db('0x2c')](_0x92db('0x33'),_0x3b2efe);}_0x55937a(null,_0x55fcb2);});}});}});};AGIVertices[_0x92db('0x11')][_0x92db('0x34')]=function(_0x27974b,_0x22761b){this[_0x92db('0xf')][_0x92db('0x35')](_0x27974b)[_0x92db('0x18')](function(_0x1e913c){_0x22761b(null,_0x1e913c?_0x1e913c:![]);})[_0x92db('0x14')](function(_0x59c2b9){_0x22761b(_0x59c2b9);});};AGIVertices[_0x92db('0x11')][_0x92db('0x36')]=function(_0x2e54ad,_0xdcc5e7){this[_0x92db('0xf')][_0x92db('0x36')](_0x2e54ad)[_0x92db('0x18')](function(_0x5c9544){_0xdcc5e7(null,_0x5c9544);})[_0x92db('0x14')](function(_0x4d795c){_0xdcc5e7(_0x4d795c);});};AGIVertices['prototype'][_0x92db('0x37')]=function(_0x1ab533,_0x4e6258,_0x1f4c3f){this[_0x92db('0xf')][_0x92db('0x37')]({'uniqueid':this[_0x92db('0xe')][_0x92db('0x38')],'node':_0x1ab533[_0x92db('0x39')],'application':_0x1ab533[_0x92db('0x3a')],'data':_0x4e6258||null,'project_name':this[_0x92db('0xe')][_0x92db('0x3b')],'callerid':this['channel']['callerid']})[_0x92db('0x18')](function(_0x47426b){if(_0x1f4c3f){_0x1f4c3f(null,_0x47426b);}})[_0x92db('0x14')](function(_0x27ccc6){if(_0x1f4c3f){_0x1f4c3f(_0x27ccc6);}});};AGIVertices[_0x92db('0x11')]['createSquareRecording']=function(_0x4580e7,_0xecef14,_0x194bda,_0x429992){this['rpc'][_0x92db('0x3c')]({'uniqueid':this[_0x92db('0xe')][_0x92db('0x38')],'callerid':this[_0x92db('0xe')]['callerid'],'calleridname':this[_0x92db('0xe')][_0x92db('0x3d')],'context':this[_0x92db('0xe')][_0x92db('0x3e')],'extension':this[_0x92db('0xe')][_0x92db('0x3f')],'priority':this[_0x92db('0xe')][_0x92db('0x40')],'accountcode':this[_0x92db('0xe')][_0x92db('0x41')],'dnid':this[_0x92db('0xe')][_0x92db('0x42')],'projectName':this[_0x92db('0xe')][_0x92db('0x3b')],'saveName':_0xecef14,'filename':_0x4580e7['file']||_0xecef14,'savePath':_0x194bda})[_0x92db('0x18')](function(_0x1be412){_0x429992(null,_0x1be412);})[_0x92db('0x14')](function(_0xae74c4){_0x429992(_0xae74c4);});};AGIVertices[_0x92db('0x11')][_0x92db('0x43')]=function(_0xbfc69d,_0x1f3195,_0x150a5d,_0xf4148d,_0x2631c6){this[_0x92db('0xf')]['createSquareMessage']({'uniqueid':this[_0x92db('0xe')]['uniqueid'],'body':_0xbfc69d,'direction':_0x1f3195,'providerName':_0x150a5d,'providerResponse':_0xf4148d})['then'](function(_0x42381d){if(_0x2631c6){_0x2631c6(null,_0x42381d);}})[_0x92db('0x14')](function(_0x379bfd){if(_0x2631c6){_0x2631c6(_0x379bfd);}});};AGIVertices[_0x92db('0x11')][_0x92db('0x44')]=function(_0x4fdc8b,_0x5b3667){this[_0x92db('0xf')][_0x92db('0x44')]({'firstName':_[_0x92db('0x45')](_0x4fdc8b['name'])||_[_0x92db('0x46')](_0x4fdc8b[_0x92db('0x19')])?_0x92db('0x47')+Math['random']():_0x4fdc8b[_0x92db('0x19')],'lastName':_[_0x92db('0x45')](_0x4fdc8b['lastName'])||_[_0x92db('0x46')](_0x4fdc8b[_0x92db('0x48')])?null:_0x4fdc8b[_0x92db('0x48')],'phone':_0x4fdc8b[_0x92db('0x49')],'ListId':_0x4fdc8b[_0x92db('0x4a')],'scheduledat':_0x4fdc8b[_0x92db('0x4b')],'callbackUniqueid':this[_0x92db('0xe')][_0x92db('0x38')],'tags':_0x92db('0x4c'),'description':_0x92db('0x4d')+_0x4fdc8b[_0x92db('0x4b')]['toString'](),'priority':_0x4fdc8b[_0x92db('0x4e')]})[_0x92db('0x18')](function(_0x35ecd2){_0x5b3667(null,_0x35ecd2);})[_0x92db('0x14')](function(_0x47578d){_0x5b3667(_0x47578d);});};AGIVertices[_0x92db('0x11')][_0x92db('0x4f')]=function(_0x29bd1c,_0x4e5015){this[_0x92db('0xf')]['getPauseById'](_0x29bd1c)[_0x92db('0x18')](function(_0x20ce92){_0x4e5015(null,_0x20ce92?_0x20ce92[_0x92db('0x19')]:![]);})[_0x92db('0x14')](function(_0x5bebc8){_0x4e5015(_0x5bebc8);});};AGIVertices[_0x92db('0x11')][_0x92db('0x50')]=function(_0x1a2dbc,_0x488906,_0x89dec3){var _0xd8646b={'role':'agent'};_0xd8646b[_0x1a2dbc]=this[_0x92db('0xe')][_0x92db('0x51')];this[_0x92db('0xf')][_0x92db('0x50')](_0xd8646b,_0x488906,this[_0x92db('0xe')]['uniqueid'])[_0x92db('0x18')](function(_0x44e6c5){_0x89dec3(null,_[_0x92db('0x46')](_0x44e6c5)?![]:!![]);})[_0x92db('0x14')](function(_0x22bd81){logger['error'](_0x22bd81);_0x89dec3(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x30b888,_0x38e025){var _0xa9cc54={'role':_0x92db('0x52')};_0xa9cc54[_0x30b888]=this['channel'][_0x92db('0x51')];this[_0x92db('0xf')]['agentUnpause'](_0xa9cc54)[_0x92db('0x18')](function(_0x1d5082){_0x38e025(null,_[_0x92db('0x46')](_0x1d5082)?![]:!![]);})[_0x92db('0x14')](function(_0x11e463){logger[_0x92db('0x2c')](_0x11e463);_0x38e025(null,![]);});};AGIVertices[_0x92db('0x11')][_0x92db('0x53')]=function(_0x121bfd,_0x176266){var _0x259d8b={'role':'agent'};_0x259d8b[_0x121bfd]=this[_0x92db('0xe')]['callerid'];this[_0x92db('0xf')]['agentLogout'](_0x259d8b)[_0x92db('0x18')](function(_0x29decb){_0x176266(null,_['isNil'](_0x29decb)?![]:!![]);})['catch'](function(_0x44bd95){logger[_0x92db('0x2c')](_0x44bd95);_0x176266(null,![]);});};AGIVertices[_0x92db('0x11')]['agentLogin']=function(_0x5ebda1,_0x126d32){var _0x5daddd={'role':'agent'};_0x5daddd[_0x5ebda1]=this['channel'][_0x92db('0x51')];var _0x2010b6=_0x5ebda1!='internal'?util[_0x92db('0x29')](_0x92db('0x54'),'LOCAL',this[_0x92db('0xe')][_0x92db('0x51')]):undefined;this[_0x92db('0xf')][_0x92db('0x55')](_0x5daddd,_0x2010b6)['then'](function(_0x134fee){_0x126d32(null,_[_0x92db('0x46')](_0x134fee)?![]:!![]);})[_0x92db('0x14')](function(_0x1a2c16){logger[_0x92db('0x2c')](_0x1a2c16);_0x126d32(null,![]);});};AGIVertices['prototype'][_0x92db('0x56')]=function(_0x347ee8,_0x370fe6){sh[_0x92db('0x57')](_['trim'](_0x347ee8),function(_0x333992,_0x35c0a5){var _0x54acfc=_0x35c0a5[_0x92db('0x58')](/(\r\n|\n|\r)/gm,'');_0x370fe6(null,_0x54acfc);});};AGIVertices[_0x92db('0x11')][_0x92db('0x59')]=function(_0x511262,_0x2df2b9){scripts[_0x92db('0x59')](_0x511262[_0x92db('0x5a')],_0x511262['google_cloud_tts_text_type']||_0x92db('0x5b'),_0x511262[_0x92db('0x5b')],_0x511262[_0x92db('0x5c')]||_0x92db('0x5d'),_0x511262[_0x92db('0x5e')]||_0x92db('0x5f'),_0x511262['audioEncoding']||_0x92db('0x60'))[_0x92db('0x18')](function(_0x12eeaf){_0x2df2b9(null,_0x12eeaf);})[_0x92db('0x14')](function(_0x4bba0a){_0x2df2b9(_0x4bba0a);});};AGIVertices[_0x92db('0x11')][_0x92db('0x61')]=function(_0x742f48,_0x5ba3e8){scripts[_0x92db('0x61')](_0x742f48[_0x92db('0x5b')],_0x742f48[_0x92db('0x62')]||'en',0x1)['then'](function(_0x433d95){_0x5ba3e8(null,_0x433d95);})['catch'](function(_0x477fe5){_0x5ba3e8(_0x477fe5);});};AGIVertices[_0x92db('0x11')][_0x92db('0x63')]=function(_0x42f53d,_0x6ca19d){var _0x2e64bc={'uri':_0x42f53d[_0x92db('0x64')],'method':_0x42f53d[_0x92db('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x42f53d['timeout'])===_0x92db('0x66')&&parseInt(_0x42f53d['timeout'])>=0x1?parseInt(_0x42f53d[_0x92db('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x92db('0x68')]([_0x92db('0x69'),_0x92db('0x6a')],_0x2e64bc[_0x92db('0x65')][_0x92db('0x6b')]())){try{_0x2e64bc[_0x92db('0x6c')]=_0x42f53d[_0x92db('0xb')]?JSON['parse'](_0x42f53d[_0x92db('0xb')]):{};}catch(_0x58baed){logger[_0x92db('0x2c')](_0x92db('0x6d'),_0x58baed);}}try{_0x2e64bc[_0x92db('0x6e')]=_0x42f53d[_0x92db('0xa')]?JSON[_0x92db('0x6f')](_0x42f53d['rawHeaders']):{};}catch(_0x8dbd0c){logger['error'](_0x92db('0x70'),_0x8dbd0c);}if(_0x42f53d[_0x92db('0x71')]){try{var _0x3aba3c=require(_0x42f53d['computedVariables'])[_0x92db('0x72')](this,_0x2e64bc);_0x2e64bc[_0x92db('0x73')]=Mustache[_0x92db('0x74')](_0x42f53d['url'],_0x3aba3c,{},['$$','$$']);if(_0x2e64bc[_0x92db('0x6e')]){_0x2e64bc[_0x92db('0x6e')]=JSON['parse'](Mustache['render'](JSON[_0x92db('0x75')](_0x2e64bc[_0x92db('0x6e')]),_0x3aba3c,{},['$$','$$']));}if(_0x2e64bc[_0x92db('0x6c')]){_0x2e64bc[_0x92db('0x6c')]=JSON[_0x92db('0x6f')](Mustache[_0x92db('0x74')](JSON[_0x92db('0x75')](_0x2e64bc['body']),_0x3aba3c,{},['$$','$$']));}}catch(_0x384f5a){logger[_0x92db('0x2c')](_0x92db('0x76'),_0x384f5a);}}rp(_0x2e64bc)[_0x92db('0x18')](function(_0x28c9b7){var _0x40982d={'statusCode':_0x28c9b7[_0x92db('0x77')]||0xc8,'statusMessage':_0x28c9b7[_0x92db('0x78')]||'OK','headers':_0x28c9b7[_0x92db('0x6e')]||{},'body':_0x28c9b7[_0x92db('0x6c')]||{}};_0x6ca19d(null,_0x40982d);})[_0x92db('0x14')](function(_0x5e1199){var _0x197440={'statusCode':_0x5e1199[_0x92db('0x77')]||0x1f4,'statusMessage':_0x5e1199[_0x92db('0x79')]||_0x92db('0x7a'),'headers':_0x5e1199['options'][_0x92db('0x6e')]||{},'body':_0x5e1199[_0x92db('0x7b')][_0x92db('0x6c')]||{}};_0x6ca19d(null,_0x197440);});};AGIVertices[_0x92db('0x11')]['googleDialogflow']=function(_0x4b80a2,_0x5eb457){scripts['googleDialogflow'](this['channel'][_0x92db('0x38')],_0x4b80a2[_0x92db('0x7c')],_0x4b80a2[_0x92db('0x5b')],_0x4b80a2[_0x92db('0x7d')]||'en')[_0x92db('0x18')](function(_0x549c80){_0x5eb457(null,_0x549c80);})[_0x92db('0x14')](function(_0xad593a){_0x5eb457(_0xad593a);});};AGIVertices[_0x92db('0x11')]['googleDialogflowV2']=function(_0x3de08b,_0x11a190){scripts[_0x92db('0x7e')](this[_0x92db('0xe')]['uniqueid'],_0x3de08b['dialogflowV2_project_id'],_0x3de08b[_0x92db('0x7f')],_0x3de08b[_0x92db('0x80')],_0x3de08b[_0x92db('0x5b')],_0x3de08b['dialogflowV2_language']||'en')[_0x92db('0x18')](function(_0xafb9e7){_0x11a190(null,_0xafb9e7);})['catch'](function(_0x742e7){_0x11a190(_0x742e7);});};AGIVertices[_0x92db('0x11')][_0x92db('0x81')]=function(_0x4be322,_0x5b7b07){scripts['sestekNDA'](this[_0x92db('0xe')],_0x4be322)[_0x92db('0x18')](function(_0x169947){_0x5b7b07(null,_0x169947);})[_0x92db('0x14')](function(_0x3af608){_0x5b7b07(_0x3af608);});};AGIVertices[_0x92db('0x11')][_0x92db('0x82')]=function(_0x590b52,_0x591782){scripts['ispeechTTS'](_0x590b52[_0x92db('0x7c')],_0x590b52[_0x92db('0x5b')],_0x590b52['ispeech_tts_language']||'en-US',_0x590b52[_0x92db('0x83')])[_0x92db('0x18')](function(_0x4d2ab2){_0x591782(null,_0x4d2ab2);})['catch'](function(_0x3b4365){_0x591782(_0x3b4365);});};AGIVertices[_0x92db('0x11')]['ispeechASR']=function(_0x4d9aa7,_0x25d39d,_0x4d3886){scripts['ispeechASR'](_0x25d39d,_0x4d9aa7[_0x92db('0x7c')],_0x4d9aa7[_0x92db('0x84')]||_0x92db('0x5d'),this[_0x92db('0x85')](_0x4d9aa7['model'])?_0x4d9aa7['model']:undefined)[_0x92db('0x18')](function(_0x5b858e){_0x4d3886(null,_0x5b858e);})[_0x92db('0x14')](function(_0x542828){_0x4d3886(_0x542828);});};AGIVertices[_0x92db('0x11')][_0x92db('0x86')]=function(_0x1f5978,_0x225452){scripts[_0x92db('0x86')](_0x1f5978['aws_access_key_id'],_0x1f5978[_0x92db('0x87')],_0x1f5978['aws_polly_region'],_0x1f5978['aws_polly_voice']||_0x92db('0x88'),_0x1f5978[_0x92db('0x5b')],_0x1f5978[_0x92db('0x89')]||_0x92db('0x5b'))['then'](function(_0x20ea9d){_0x225452(null,_0x20ea9d);})[_0x92db('0x14')](function(_0xbb4e1a){_0x225452(_0xbb4e1a);});};AGIVertices[_0x92db('0x11')][_0x92db('0x8a')]=function(_0x33a4ee,_0x574b2f){scripts[_0x92db('0x8a')](this[_0x92db('0xe')][_0x92db('0x38')],_0x33a4ee[_0x92db('0x8b')],_0x33a4ee[_0x92db('0x87')],_0x33a4ee[_0x92db('0x8c')],_0x33a4ee['text'],_0x33a4ee[_0x92db('0x8d')])[_0x92db('0x18')](function(_0x527562){_0x574b2f(null,_0x527562);})['catch'](function(_0x3dc6fa){_0x574b2f(_0x3dc6fa);});};AGIVertices[_0x92db('0x11')][_0x92db('0x8e')]=function(_0x12ecae,_0x11d455,_0x7a5ad5){scripts[_0x92db('0x8e')](_0x11d455,_0x12ecae[_0x92db('0x7c')],_0x12ecae['google_asr_language']||_0x92db('0x5d'))[_0x92db('0x18')](function(_0x5ab818){_0x7a5ad5(null,_0x5ab818);})[_0x92db('0x14')](function(_0x530262){_0x7a5ad5(_0x530262);});};AGIVertices['prototype'][_0x92db('0x8f')]=function(_0x305b83,_0xf9d35c,_0x1d2c62){scripts['tildeASR'](_0xf9d35c,_0x305b83['appid'],_0x305b83['appsecret'],_0x305b83[_0x92db('0x73')])['then'](function(_0x21e7d9){_0x1d2c62(null,_0x21e7d9);})['catch'](function(_0x26d011){_0x1d2c62(_0x26d011);});};AGIVertices[_0x92db('0x11')]['clear']=function(_0x3bcfde){var _0x37a71b=_[_0x92db('0x68')](verticesWithRetry,_0x3bcfde['agicommand'])?_0x3bcfde:_[_0x92db('0x90')](_0x3bcfde);for(var _0x5c81da in _0x37a71b){if(_0x37a71b[_0x92db('0x91')](_0x5c81da)){if(_0x37a71b[_0x5c81da]&&_[_0x92db('0x92')](_0x37a71b[_0x5c81da])){if(_['includes'](recursiveMapAttributes,_0x5c81da)){_0x37a71b[_0x5c81da]=this[_0x92db('0x93')](_0x37a71b[_0x5c81da]);}else{_0x37a71b[_0x5c81da]=this[_0x92db('0x94')](_0x37a71b[_0x5c81da]);}}}}return _0x37a71b;};AGIVertices[_0x92db('0x11')]['recursiveNodeIndex']=function(_0x3ddea7){for(var _0xda4744 in _0x3ddea7){if(_0x3ddea7[_0x92db('0x91')](_0xda4744)){if(_[_0x92db('0x95')](_0x3ddea7[_0xda4744])){this[_0x92db('0x96')](_0x3ddea7[_0xda4744]);}else if(_[_0x92db('0x97')](_0x3ddea7[_0xda4744])){for(var _0x2b9833=0x0;_0x2b9833<_0x3ddea7[_0xda4744]['length'];_0x2b9833++){this[_0x92db('0x96')](_0x3ddea7[_0xda4744][_0x2b9833]);}}else if(_['isString'](_0x3ddea7[_0xda4744])){_0x3ddea7[_0xda4744]=this['replaceAllVariables'](_0x3ddea7[_0xda4744]);}}}};AGIVertices[_0x92db('0x11')][_0x92db('0x98')]=function(_0x4c2385,_0x3f907d){for(var _0x1954b6 in _0x4c2385){if(_0x4c2385[_0x92db('0x91')](_0x1954b6)){if(_[_0x92db('0x95')](_0x4c2385[_0x1954b6])){if(!_[_0x92db('0x45')](_0x4c2385[_0x1954b6])){this[_0x92db('0x98')](_0x4c2385[_0x1954b6],util[_0x92db('0x29')]('%s.%s',_0x3f907d,_0x1954b6));}}else if(_['isArray'](_0x4c2385[_0x1954b6])){for(var _0x594fff=0x0;_0x594fff<_0x4c2385[_0x1954b6][_0x92db('0x99')];_0x594fff++){this['saveRestApiResult'](_0x4c2385[_0x1954b6][_0x594fff],util[_0x92db('0x29')](_0x92db('0x9a'),_0x3f907d,_0x1954b6+'['+_0x594fff+']'));}}else{if(!_[_0x92db('0x46')](_0x4c2385[_0x1954b6])){this['channel'][_0x92db('0x9b')](util['format']('%s.%s',_0x3f907d,_0x1954b6),_0x4c2385[_0x1954b6]);}}}}};AGIVertices['prototype'][_0x92db('0x93')]=function(_0x4249e3){try{var _0x2555ef=JSON['parse'](_0x4249e3);this[_0x92db('0x96')](_0x2555ef);return JSON[_0x92db('0x75')](_0x2555ef);}catch(_0x18c8b9){return this[_0x92db('0x94')](_0x4249e3);}};AGIVertices[_0x92db('0x11')]['replaceAllVariables']=function(_0x587269){var _0x8ae81b=_0x587269['split']('{');for(var _0x1c5ccb=0x1;_0x1c5ccb<_0x8ae81b[_0x92db('0x99')];_0x1c5ccb+=0x1){var _0x28c326=_0x8ae81b[_0x1c5ccb][_0x92db('0x9c')]('}');if(_0x28c326[_0x92db('0x99')]>0x1){_0x587269=_0x587269[_0x92db('0x9d')]('{'+_0x28c326[0x0]+'}',this[_0x92db('0xe')][_0x92db('0x12')](_0x28c326[0x0])[_0x92db('0x9e')]||_0x28c326[0x0]);}}if(_0x8ae81b[_0x92db('0x99')]===0x1){return _0x587269[_0x92db('0x9f')]();}return this[_0x92db('0x94')](_0x587269);};AGIVertices[_0x92db('0x11')][_0x92db('0xa0')]=function(_0x5babd4,_0x305bf6){var _0x3ca63d=this[_0x92db('0xe')]['getVariable'](_0x5babd4);if(_0x3ca63d[_0x92db('0xa1')]===-0x1){return _0x3ca63d;}logger[_0x92db('0x30')](util[_0x92db('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x305bf6,_0x3ca63d[_0x92db('0x9e')]));return this['channel'][_0x92db('0x9b')](_0x305bf6,_0x3ca63d[_0x92db('0x9e')]);};AGIVertices[_0x92db('0x11')][_0x92db('0x85')]=function(_0x295ea9){return _0x295ea9&&_0x295ea9!=='0'&&_0x295ea9!=='-1'&&_0x295ea9!=='';};AGIVertices[_0x92db('0x11')][_0x92db('0xa2')]=function(_0x267915){this[_0x92db('0x37')][_0x92db('0x72')](this,_0x267915,'-');_0x267915[_0x92db('0xa3')]=_0x267915[_0x92db('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x92db('0x11')][_0x92db('0xa4')]=function(_0x2e48d0){logger[_0x92db('0x30')](util['format']('Enter\x20in\x20MRCPSynth\x20(%s)\x20block',_0x2e48d0[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x2e48d0[_0x92db('0x5b')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xa6'));}var _0x1c4b13='\x22'+_0x2e48d0[_0x92db('0x5b')]+'\x22';if(this[_0x92db('0x85')](_0x2e48d0['options'])){_0x1c4b13+=','+_0x2e48d0[_0x92db('0x7b')];}var _0x8d3bc0=this[_0x92db('0xe')]['exec'](_0x92db('0xa7'),_0x1c4b13);if(_0x8d3bc0[_0x92db('0xa1')]===-0x1){return _0x8d3bc0;}return this[_0x92db('0xe')][_0x92db('0xa5')](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x1c4b13));};AGIVertices['prototype'][_0x92db('0xa8')]=function(_0x396a1e){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xa9'),_0x396a1e['label']));if(!this[_0x92db('0x85')](_0x396a1e[_0x92db('0xaa')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xab'));}var _0x2700d8=_0x396a1e[_0x92db('0xaa')];if(this[_0x92db('0x85')](_0x396a1e[_0x92db('0x7b')])){_0x2700d8+=','+_0x396a1e['options'];}var _0x27fb9c=this[_0x92db('0xe')]['exec'](_0x92db('0xac'),_0x2700d8);if(_0x27fb9c['result']===-0x1){return _0x27fb9c;}var _0x40a985=this[_0x92db('0xa0')](_0x92db('0xad'),_0x92db('0xae'));if(_0x40a985[_0x92db('0xa1')]===-0x1){return _0x40a985;}var _0x30e59=this[_0x92db('0xa0')](_0x92db('0xaf'),'MRCP_RECOG_TRANSCRIPT');if(_0x30e59[_0x92db('0xa1')]===-0x1){return _0x30e59;}var _0x1abc3f=this[_0x92db('0xa0')]('RECOG_INSTANCE()','MRCP_RECOG_INSTANCE');if(_0x1abc3f[_0x92db('0xa1')]===-0x1){return _0x1abc3f;}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xb0'),_0x2700d8));};AGIVertices['prototype']['agi']=function(_0xa3fb3){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xb1'),_0xa3fb3[_0x92db('0x39')]));return this[_0x92db('0xe')][_0x92db('0x6')]([_0xa3fb3['command'],_0xa3fb3[_0x92db('0xb2')]]);};AGIVertices[_0x92db('0x11')][_0x92db('0xb3')]=function(_0x5e6b81){logger[_0x92db('0x30')](util['format'](_0x92db('0xb4'),_0x5e6b81[_0x92db('0x39')]));if(this[_0x92db('0x85')](_0x5e6b81['timeout'])){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xb5'),_0x5e6b81['timeout']));var _0x2e1d2c=this['channel'][_0x92db('0xb6')](_0x5e6b81[_0x92db('0x67')]);if(_0x2e1d2c['result']===-0x1){return _0x2e1d2c;}}return this[_0x92db('0xe')]['answer']();};AGIVertices[_0x92db('0x11')][_0x92db('0x4c')]=function(_0x6806ee){logger['info'](util['format'](_0x92db('0xb7'),_0x6806ee[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x6806ee[_0x92db('0x4a')])){return this['channel'][_0x92db('0x2c')](_0x6806ee,_0x92db('0xb8'));}_0x6806ee[_0x92db('0x4b')]=moment();if(this[_0x92db('0x85')](_0x6806ee['delay'])){_0x6806ee[_0x92db('0x4b')]=moment()[_0x92db('0xb9')](_0x6806ee[_0x92db('0xba')],'minutes');}if(!this[_0x92db('0x85')](_0x6806ee[_0x92db('0x4e')])){_0x6806ee[_0x92db('0x4e')]=0x2;}this[_0x92db('0x44')][_0x92db('0x72')](this,_0x6806ee);return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xbb'),_0x6806ee[_0x92db('0x49')],_0x6806ee[_0x92db('0x4a')],_0x6806ee[_0x92db('0x4b')]));};AGIVertices[_0x92db('0x11')][_0x92db('0xbc')]=function(_0x39e4a5){logger[_0x92db('0x30')](util['format'](_0x92db('0xbd'),_0x39e4a5[_0x92db('0x39')]));var _0x4cb859=this[_0x92db('0xe')][_0x92db('0x57')](_0x39e4a5[_0x92db('0xbe')],_0x39e4a5[_0x92db('0x7b')]);if(_0x4cb859['result']===-0x1){return _0x4cb859;}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xbf'),_0x39e4a5[_0x92db('0xbe')],_0x39e4a5['options']));};AGIVertices['prototype'][_0x92db('0xc0')]=function(_0x440bc0){logger['info'](util['format'](_0x92db('0xc1'),_0x440bc0[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x440bc0[_0x92db('0x5b')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xa6'));}var _0x4f5949='\x22'+_0x440bc0[_0x92db('0x5b')]+'\x22';if(this[_0x92db('0x85')](_0x440bc0[_0x92db('0x7b')])){_0x4f5949+=','+_0x440bc0[_0x92db('0x7b')];}var _0x16fba8=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0xa7'),_0x4f5949);if(_0x16fba8[_0x92db('0xa1')]===-0x1){return _0x16fba8;}return this['channel'][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xc2'),_0x4f5949));};AGIVertices[_0x92db('0x11')][_0x92db('0xc3')]=function(_0x3f9417){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xc4'),_0x3f9417[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x3f9417[_0x92db('0x5b')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xa6'));}var _0xafc16f='\x22'+_0x3f9417['text']+'\x22';if(this[_0x92db('0x85')](_0x3f9417['options'])){_0xafc16f+=','+_0x3f9417[_0x92db('0x7b')];}var _0x211427=this[_0x92db('0xe')][_0x92db('0x57')]('MRCPSynth',_0xafc16f);if(_0x211427['result']===-0x1){return _0x211427;}return this['channel'][_0x92db('0xa5')](util[_0x92db('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0xafc16f));};AGIVertices[_0x92db('0x11')]['lumenvoxasr']=function(_0x120de6){logger[_0x92db('0x30')](util['format'](_0x92db('0xc5'),_0x120de6[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x120de6['grammar'])){return this[_0x92db('0xe')]['noop'](_0x92db('0xab'));}var _0x97060a=_0x120de6['grammar'];if(this[_0x92db('0x85')](_0x120de6[_0x92db('0x7b')])){_0x97060a+=','+_0x120de6[_0x92db('0x7b')];}var _0x1e8142=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0xac'),_0x97060a);if(_0x1e8142[_0x92db('0xa1')]===-0x1){return _0x1e8142;}var _0x5e0349=this[_0x92db('0xa0')](_0x92db('0xad'),_0x92db('0xc6'));if(_0x5e0349['result']===-0x1){return _0x5e0349;}var _0x33caf8=this[_0x92db('0xa0')](_0x92db('0xaf'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x33caf8['result']===-0x1){return _0x33caf8;}var _0x4a5000=this[_0x92db('0xa0')](_0x92db('0xc7'),_0x92db('0xc8'));if(_0x4a5000['result']===-0x1){return _0x4a5000;}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x97060a));};AGIVertices[_0x92db('0x11')][_0x92db('0xc9')]=function(_0x2087dd){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xca'),_0x2087dd['label']));if(!this[_0x92db('0x85')](_0x2087dd[_0x92db('0xaa')])){return this[_0x92db('0xe')][_0x92db('0xa5')]('no\x20grammar\x20configured');}var _0x431ea9=_0x2087dd[_0x92db('0xaa')];if(this[_0x92db('0x85')](_0x2087dd[_0x92db('0x7b')])){_0x431ea9+=','+_0x2087dd['options'];}var _0xaa7d9b=this[_0x92db('0xe')][_0x92db('0x57')]('MRCPRecog',_0x431ea9);if(_0xaa7d9b[_0x92db('0xa1')]===-0x1){return _0xaa7d9b;}var _0x3b030b=this[_0x92db('0xa0')](_0x92db('0xad'),'SESTEK_ASR_CONFIDENCE');if(_0x3b030b[_0x92db('0xa1')]===-0x1){return _0x3b030b;}var _0x700ac8=this[_0x92db('0xa0')](_0x92db('0xaf'),_0x92db('0xcb'));if(_0x700ac8[_0x92db('0xa1')]===-0x1){return _0x700ac8;}var _0xeab7c4=this[_0x92db('0xa0')](_0x92db('0xc7'),_0x92db('0xcc'));if(_0xeab7c4[_0x92db('0xa1')]===-0x1){return _0xeab7c4;}return this[_0x92db('0xe')][_0x92db('0xa5')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x431ea9));};AGIVertices[_0x92db('0x11')][_0x92db('0xcd')]=function(_0x3c89e8){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xce'),_0x3c89e8[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x3c89e8['odbc_id'])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x3c89e8,'no\x20database\x20selected');}var _0x3805dd=this[_0x92db('0x1a')][_0x92db('0x72')](this,_0x3c89e8['odbc_id']);if(!_0x3805dd){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x3c89e8,_0x92db('0xcf'));}if(!this[_0x92db('0x85')](_0x3c89e8[_0x92db('0x2f')])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x3c89e8,_0x92db('0xd0'));}var _0x74b84c=_0x3c89e8[_0x92db('0x2f')][_0x92db('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xd1'),_0x74b84c));var _0x24ae32=this[_0x92db('0xd2')][_0x92db('0x72')](this,_0x3805dd,_0x74b84c);this[_0x92db('0x37')][_0x92db('0x72')](this,_0x3c89e8,_0x74b84c);if(!this[_0x92db('0x85')](_0x3c89e8[_0x92db('0xd3')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xd4'));}var _0xe0c3f1=this[_0x92db('0x12')][_0x92db('0x72')](this,_0x3c89e8['variable_id']);if(!_0xe0c3f1){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x3c89e8,_0x92db('0xd5'));}var _0x1ad48a=this;_0x24ae32['forEach'](function(_0x53c44a,_0x5f3997){Object[_0x92db('0xd6')](_0x53c44a)[_0x92db('0xd7')](function(_0x49d713){_0x1ad48a[_0x92db('0xe')]['setVariable'](util[_0x92db('0x29')](_0x92db('0xd8'),_0xe0c3f1,_0x5f3997,_0x49d713),_0x53c44a[_0x49d713]);});});this['channel'][_0x92db('0x9b')](util[_0x92db('0x29')](_0x92db('0xd9'),_0xe0c3f1),_0x24ae32[_0x92db('0x99')]);return this[_0x92db('0xe')]['noop'](util['format']('variable\x20%s\x20set',_0xe0c3f1));};AGIVertices[_0x92db('0x11')][_0x92db('0xda')]=function(_0x367737){logger[_0x92db('0xdb')](util[_0x92db('0x29')](_0x92db('0xdc'),_0x367737[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x367737[_0x92db('0xdd')])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x367737,'no\x20user\x20selected');}var _0x58c49b=this['getUser'][_0x92db('0x72')](this,_0x367737['sip_id']);if(!_0x58c49b){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x367737,_0x92db('0xde'));}var _0xa10256=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0xdf'),[util[_0x92db('0x29')](_0x92db('0xe0'),_0x58c49b),_0x367737[_0x92db('0x67')],_0x367737[_0x92db('0xe1')],_0x367737[_0x92db('0x64')]]);if(_0xa10256[_0x92db('0xa1')]===-0x1){return _0xa10256;}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xe2'),'DIAL'));};AGIVertices['prototype']['dialogflow']=function(_0x160382){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xe3'),_0x160382[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x160382['key'])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xe4'));}if(!this[_0x92db('0x85')](_0x160382['text'])){return this[_0x92db('0xe')]['noop']('no\x20text\x20configured');}this[_0x92db('0xe')][_0x92db('0xe5')]=!![];this[_0x92db('0x37')](_0x160382);this['createSquareMessage'](_0x160382[_0x92db('0x5b')],'in','','');this[_0x92db('0xe')][_0x92db('0xa5')](util['format'](_0x92db('0xe6'),_0x160382[_0x92db('0x5b')]));var _0x3ba2a9=this[_0x92db('0xe7')][_0x92db('0x72')](this,_0x160382);if(_0x3ba2a9){for(var _0x5bf390 in _0x3ba2a9){if(_0x3ba2a9['hasOwnProperty'](_0x5bf390)){this[_0x92db('0xe')]['setVariable'](util[_0x92db('0x29')](_0x92db('0xe8'),_0x5bf390[_0x92db('0x6b')]()),_0x3ba2a9[_0x5bf390]);}}this[_0x92db('0x43')](_0x3ba2a9[_0x92db('0xe9')],_0x92db('0xea'),_0x92db('0xeb'),'');return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xec'),_0x3ba2a9[_0x92db('0xe9')]));}return this[_0x92db('0xe')][_0x92db('0x2c')](_0x160382,_0x92db('0xed'));};AGIVertices[_0x92db('0x11')][_0x92db('0xee')]=function(_0x4b4af3){logger['info'](util[_0x92db('0x29')](_0x92db('0xef'),_0x4b4af3[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x4b4af3[_0x92db('0xf0')])){return this['channel'][_0x92db('0xa5')](_0x92db('0xf1'));}if(!this['isConfigured'](_0x4b4af3['client_email'])){return this['channel'][_0x92db('0xa5')](_0x92db('0xf2'));}if(!this['isConfigured'](_0x4b4af3[_0x92db('0x80')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xf3'));}if(!this['isConfigured'](_0x4b4af3[_0x92db('0xf4')])){return this[_0x92db('0xe')]['noop']('no\x20anguage\x20configured');}if(!this[_0x92db('0x85')](_0x4b4af3[_0x92db('0x5b')])){return this[_0x92db('0xe')]['noop']('no\x20text\x20configured');}this[_0x92db('0xe')][_0x92db('0xe5')]=!![];this[_0x92db('0x37')](_0x4b4af3);this['createSquareMessage'](_0x4b4af3[_0x92db('0x5b')],'in','','');this[_0x92db('0xe')][_0x92db('0xa5')](util['format'](_0x92db('0xf5'),_0x4b4af3[_0x92db('0x5b')]));var _0x20f6cc=this['googleDialogflowV2'][_0x92db('0x72')](this,_0x4b4af3);if(_0x20f6cc){for(var _0x2a1562 in _0x20f6cc){if(_0x20f6cc['hasOwnProperty'](_0x2a1562)){if(_0x2a1562!==_0x92db('0xf6')){this[_0x92db('0xe')]['setVariable'](util[_0x92db('0x29')](_0x92db('0xe8'),_0x2a1562['toUpperCase']()),_0x20f6cc[_0x2a1562]);}}}this['createSquareMessage'](_0x20f6cc['speech'],_0x92db('0xea'),_0x92db('0xee'),_0x20f6cc[_0x92db('0xf6')]);return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xf7'),_0x20f6cc[_0x92db('0xe9')]));}return this[_0x92db('0xe')][_0x92db('0x2c')](_0x4b4af3,_0x92db('0xf8'));};AGIVertices['prototype']['sesteknda']=function(_0x4b9d2a){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0xf9'),_0x4b9d2a[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x4b9d2a[_0x92db('0xfa')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xfb'));}if(!this[_0x92db('0x85')](_0x4b9d2a[_0x92db('0xfc')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xfd'));}if(!this['isConfigured'](_0x4b9d2a[_0x92db('0xfe')])){return this['channel']['noop'](_0x92db('0xff'));}if(!this[_0x92db('0x85')](_0x4b9d2a[_0x92db('0x100')])){return this['channel'][_0x92db('0xa5')]('no\x20text\x20configured');}this[_0x92db('0xe')][_0x92db('0xe5')]=!![];this[_0x92db('0x37')](_0x4b9d2a);this['createSquareMessage'](_0x4b9d2a[_0x92db('0x5b')],'in','','');this['channel'][_0x92db('0xa5')](util['format'](_0x92db('0x101'),_0x4b9d2a['text']));var _0x495d33=this[_0x92db('0x81')][_0x92db('0x72')](this,_0x4b9d2a);if(_0x495d33){for(var _0x4c706d in _0x495d33){if(_0x495d33[_0x92db('0x91')](_0x4c706d)){this[_0x92db('0xe')]['setVariable'](util[_0x92db('0x29')](_0x92db('0x102'),_0x4c706d['toUpperCase']()),_0x495d33[_0x4c706d]);}}this['createSquareMessage'](_0x495d33['speech'],_0x92db('0xea'),_0x92db('0x103'),'');if(_0x495d33[_0x92db('0x104')]){this['channel'][_0x92db('0xa5')](util['format'](_0x92db('0x105'),_0x495d33[_0x92db('0x104')]));var _0x46d5bd=this[_0x92db('0xe')][_0x92db('0x106')](_0x495d33[_0x92db('0x104')]);try{fs[_0x92db('0x107')](_0x495d33[_0x92db('0x104')]+'.wav');}catch(_0x3e3279){logger['error'](_0x3e3279);}return _0x46d5bd;}else{return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x108'),_0x495d33[_0x92db('0xe9')]));}}return this['channel'][_0x92db('0x2c')](_0x4b9d2a,_0x92db('0x109'));};AGIVertices[_0x92db('0x11')]['end']=function(_0x19e6f7){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x10a'),_0x19e6f7['label']));return this[_0x92db('0xe')][_0x92db('0xa5')]('end');};AGIVertices[_0x92db('0x11')]['ext_dial']=function(_0x231898){logger['info'](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x231898[_0x92db('0x39')]));var _0xe9472e='';if(_0x231898[_0x92db('0x10b')]){if(!this['isConfigured'](_0x231898[_0x92db('0x10b')])){return this[_0x92db('0xe')]['error'](_0x231898,_0x92db('0x10c'));}else{var _0x1073ff=parseInt(_0x231898[_0x92db('0x10b')],0xa);if(isNaN(_0x1073ff)){_0xe9472e=_0x231898[_0x92db('0x10b')];}else{_0xe9472e=this['getTrunk'][_0x92db('0x72')](this,_0x231898['trunk_id']);if(!_0xe9472e){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x231898,_0x92db('0x10d'));}}}}else if(_0x231898[_0x92db('0x10e')]){_0xe9472e=_0x231898[_0x92db('0x10e')];}else{return this[_0x92db('0xe')]['error'](_0x231898,'no\x20trunk\x20selected');}var _0x213439=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0xdf'),[util[_0x92db('0x29')](_0x92db('0x10f'),_0xe9472e,_0x231898[_0x92db('0x49')]),_0x231898[_0x92db('0x67')],_0x231898[_0x92db('0xe1')],_0x231898['url']]);if(_0x213439[_0x92db('0xa1')]===-0x1){return _0x213439;}return this['channel'][_0x92db('0xa5')](util[_0x92db('0x29')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0x92db('0x11')][_0x92db('0x110')]=function(_0x4d97b3){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4d97b3[_0x92db('0x39')]));return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x110'));};AGIVertices[_0x92db('0x11')][_0x92db('0xc')]=function(_0x48612d){logger['info'](util[_0x92db('0x29')](_0x92db('0x111'),_0x48612d[_0x92db('0x39')]));if(_0x48612d[_0x92db('0xa3')]===0x0){return this[_0x92db('0xa2')](_0x48612d);}_0x48612d['retry']-=0x1;if(!this['isConfigured'](_0x48612d[_0x92db('0x112')])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x48612d,'no\x20file\x20audio\x20selected');}var _0x4c50d0=this[_0x92db('0x1e')][_0x92db('0x72')](this,_0x48612d['file_id']);if(!_0x4c50d0){return this['channel'][_0x92db('0x2c')](_0x48612d,_0x92db('0x113'));}if(!this[_0x92db('0x85')](_0x48612d['variable_id'])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x92db('0xd4'));}var _0x191ab8=this[_0x92db('0xe')][_0x92db('0x114')](_0x4c50d0,_0x48612d['response'],_0x48612d['maxdigit']);var _0x4914e3=_0x191ab8[_0x92db('0xa1')]?_0x191ab8[_0x92db('0xa1')]['toString']():'';logger[_0x92db('0x30')]('test',JSON[_0x92db('0x75')](_0x191ab8));if(_0x191ab8[_0x92db('0xa1')]===-0x1){this[_0x92db('0x37')]['sync'](this,_0x48612d,_0x4914e3);return _0x191ab8;}else if(_0x191ab8[_0x92db('0x9e')]===_0x92db('0x67')){_0x191ab8[_0x92db('0xa1')]=_0x4914e3[_0x92db('0x99')]>=parseInt(_0x48612d[_0x92db('0x115')])?'x':'i';}else{_0x191ab8[_0x92db('0xa1')]=_0x4914e3[_0x92db('0x99')]>=parseInt(_0x48612d[_0x92db('0x115')])&&_0x4914e3[_0x92db('0x99')]<=parseInt(_0x48612d['maxdigit'])?'x':'i';}var _0x585f54=this[_0x92db('0x12')]['sync'](this,_0x48612d['variable_id']);if(!_0x585f54){return this[_0x92db('0xe')]['error'](_0x48612d,_0x92db('0xd5'));}this['channel'][_0x92db('0x9b')](_0x585f54,_0x4914e3);if(this[_0x92db('0x85')](_0x48612d[_0x92db('0x116')])){var _0x5e3478=parseInt(_0x48612d[_0x92db('0x116')],0xa);var _0x4ef175=rs[_0x92db('0x117')]({'charset':'*','length':_0x5e3478});var _0x19bccc=_0x4914e3[_0x92db('0x99')];if(_0x19bccc>0x0){if(_0x19bccc>_0x5e3478){this[_0x92db('0x37')][_0x92db('0x72')](this,_0x48612d,_0x48612d[_0x92db('0x118')]===_0x92db('0x119')?_0x4ef175+_0x4914e3[_0x92db('0x11a')](_0x5e3478):_0x4914e3[_0x92db('0x11a')](0x0,_0x19bccc-_0x5e3478)+_0x4ef175);}else{this[_0x92db('0x37')]['sync'](this,_0x48612d,rs[_0x92db('0x117')]({'charset':'*','length':_0x19bccc}));}}else{this[_0x92db('0x37')][_0x92db('0x72')](this,_0x48612d,'');}}else{this[_0x92db('0x37')][_0x92db('0x72')](this,_0x48612d,_0x4914e3);}return _0x191ab8;};AGIVertices[_0x92db('0x11')]['getsecretdigits']=function(_0x2ed9e7){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x11b'),_0x2ed9e7[_0x92db('0x39')]));return this[_0x92db('0xc')](_0x2ed9e7);};AGIVertices['prototype']['goal']=function(_0x18bd38){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x11c'),_0x18bd38[_0x92db('0x39')]));this['createSquareDetailsReport'][_0x92db('0x72')](this,_0x18bd38,_0x18bd38[_0x92db('0x11d')]);return this[_0x92db('0xe')]['noop'](util[_0x92db('0x29')](_0x92db('0x11e'),_0x18bd38[_0x92db('0x11d')]));};AGIVertices[_0x92db('0x11')][_0x92db('0x11f')]=function(_0x3f57fb){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x120'),_0x3f57fb['label']));if(!this[_0x92db('0x85')](_0x3f57fb['aws_access_key_id'])||!this[_0x92db('0x85')](_0x3f57fb[_0x92db('0x87')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x121'));}if(!this[_0x92db('0x85')](_0x3f57fb[_0x92db('0x5b')])){return this[_0x92db('0xe')]['noop'](_0x92db('0xa6'));}this['channel']['noop'](util[_0x92db('0x29')]('Trying\x20aws\x20Polly\x20%s',_0x3f57fb[_0x92db('0x5b')]));var _0x5e8f5e=this[_0x92db('0x86')][_0x92db('0x72')](this,_0x3f57fb);if(_0x5e8f5e){this[_0x92db('0xe')]['noop'](util[_0x92db('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x5e8f5e));var _0x3254ef=this['channel'][_0x92db('0x106')](_0x5e8f5e);try{fs[_0x92db('0x107')](_0x5e8f5e+_0x92db('0x122'));}catch(_0x3e94de){logger[_0x92db('0x2c')](_0x3e94de);}return _0x3254ef;}return this['channel'][_0x92db('0x2c')](_0x3f57fb,_0x92db('0x123'));};AGIVertices[_0x92db('0x11')][_0x92db('0x124')]=function(_0x36a98d){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x36a98d['label']));if(!this[_0x92db('0x85')](_0x36a98d[_0x92db('0x8b')])||!this[_0x92db('0x85')](_0x36a98d[_0x92db('0x87')])){return this['channel'][_0x92db('0xa5')](_0x92db('0x121'));}if(!this['isConfigured'](_0x36a98d[_0x92db('0x8d')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x125'));}if(!this[_0x92db('0x85')](_0x36a98d[_0x92db('0x5b')])){return this['channel'][_0x92db('0xa5')](_0x92db('0xa6'));}this[_0x92db('0xe')]['bot']=!![];this[_0x92db('0x37')](_0x36a98d);this[_0x92db('0x43')](_0x36a98d[_0x92db('0x5b')],'in','','');this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x126'),_0x36a98d['text']));var _0x43635c=this['awsLex'][_0x92db('0x72')](this,_0x36a98d);if(_0x43635c){for(var _0x32b39f in _0x43635c){if(_0x43635c['hasOwnProperty'](_0x32b39f)&&_[_0x92db('0x92')](_0x43635c[_0x32b39f])){this['channel'][_0x92db('0x9b')](util[_0x92db('0x29')](_0x92db('0x127'),_0x32b39f['toUpperCase']()),_0x43635c[_0x32b39f]);}}if(_['isNil'](_0x43635c[_0x92db('0x79')])){return this['channel'][_0x92db('0xa5')](_0x92db('0x128'));}else{this[_0x92db('0x43')](_0x43635c[_0x92db('0x79')],_0x92db('0xea'),_0x92db('0x129'),'');return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x12a'),_0x43635c[_0x92db('0x79')]));}}return this['channel'][_0x92db('0x2c')](_0x36a98d,_0x92db('0x12b'));};AGIVertices[_0x92db('0x11')][_0x92db('0x12c')]=function(_0x4c51f0){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x4c51f0[_0x92db('0x39')],_0x4c51f0[_0x92db('0x67')]));if(!this[_0x92db('0x85')](_0x4c51f0[_0x92db('0x7c')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xe4'));}var _0x1fe4ff=_0x92db('0x12d');var _0x47a1a7=util[_0x92db('0x29')](_0x92db('0x12e'),FILES_PATH,rs['generate'](0x4));var _0x4a1d17=util[_0x92db('0x29')](_0x92db('0x9a'),_0x47a1a7,_0x1fe4ff);var _0xb02e6e=!![];if(_0x4c51f0[_0x92db('0x12f')]==='NOBEEP'){_0xb02e6e=![];}var _0x1f6302=this[_0x92db('0xe')][_0x92db('0x130')](_0x47a1a7,_0x1fe4ff,_0x4c51f0[_0x92db('0x131')],_0x4c51f0[_0x92db('0x67')],undefined,_0xb02e6e);if(_0x1f6302[_0x92db('0xa1')]!==-0x1){this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x132'),_0x4a1d17));var _0xee640e=this[_0x92db('0x8e')][_0x92db('0x72')](this,_0x4c51f0,_0x4a1d17);if(_0xee640e){for(var _0x45ed42 in _0xee640e){if(_0xee640e[_0x92db('0x91')](_0x45ed42)){this[_0x92db('0xe')][_0x92db('0x9b')](util[_0x92db('0x29')](_0x92db('0x133'),_0x45ed42[_0x92db('0x6b')]()),_0xee640e[_0x45ed42]);}}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x134'),JSON['stringify'](_0xee640e)));}}return _0x1f6302;};AGIVertices['prototype'][_0x92db('0x135')]=function(_0x354598){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x136'),_0x354598['label']));if(!this['isConfigured'](_0x354598[_0x92db('0x137')])){return this['channel'][_0x92db('0xa5')](_0x92db('0x138'));}if(!this[_0x92db('0x85')](_0x354598[_0x92db('0x139')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x13a'));}var _0xe28860=_0x92db('0x12d');var _0x4fa167=util[_0x92db('0x29')](_0x92db('0x12e'),FILES_PATH,rs[_0x92db('0x117')](0x4));var _0x30ba2f=util[_0x92db('0x29')]('%s.%s',_0x4fa167,_0xe28860);var _0x83f859=!![];if(_0x354598[_0x92db('0x12f')]===_0x92db('0x13b')){_0x83f859=![];}var _0x2675e7=this[_0x92db('0xe')][_0x92db('0x130')](_0x4fa167,_0xe28860,_0x354598[_0x92db('0x131')],_0x354598[_0x92db('0x67')],undefined,_0x83f859);if(_0x2675e7[_0x92db('0xa1')]!==-0x1){this['channel'][_0x92db('0xa5')](util[_0x92db('0x29')]('tilde\x20%s\x20file\x20created',_0x30ba2f));var _0x16dead=this[_0x92db('0x8f')]['sync'](this,_0x354598,_0x30ba2f);if(_0x16dead){for(var _0x26cec0 in _0x16dead){if(_0x16dead['hasOwnProperty'](_0x26cec0)){this[_0x92db('0xe')]['setVariable'](util[_0x92db('0x29')](_0x92db('0x13c'),_0x26cec0[_0x92db('0x6b')]()),_0x16dead[_0x26cec0]);}}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x13d'),JSON[_0x92db('0x75')](_0x16dead)));}}return _0x2675e7;};AGIVertices[_0x92db('0x11')][_0x92db('0x13e')]=function(_0x2da723){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x13f'),_0x2da723['label']));return this[_0x92db('0xe')][_0x92db('0x140')](_0x2da723[_0x92db('0x3e')],_0x2da723[_0x92db('0x3f')],_0x2da723[_0x92db('0x40')]);};AGIVertices[_0x92db('0x11')][_0x92db('0x141')]=function(_0x1fbe13){logger['info'](util[_0x92db('0x29')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x1fbe13[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x1fbe13[_0x92db('0x142')])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x1fbe13,_0x92db('0x143'));}try{var _0x67c8c0=eval(_0x1fbe13[_0x92db('0x142')])?_0x92db('0x144'):_0x92db('0x145');this[_0x92db('0xe')]['noop'](util[_0x92db('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x1fbe13[_0x92db('0x142')],_0x67c8c0));return{'code':0xc8,'result':_0x67c8c0};}catch(_0x2d417f){return{'code':0xc8,'result':_0x92db('0x145')};}};AGIVertices[_0x92db('0x11')][_0x92db('0x146')]=function(_0x39bf3b){logger['info'](util[_0x92db('0x29')](_0x92db('0x147'),_0x39bf3b[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x39bf3b['interval_id'])){return this['channel'][_0x92db('0x2c')](_0x39bf3b,_0x92db('0x148'));}var _0x310fec=this['getIntervals'][_0x92db('0x72')](this,_0x39bf3b[_0x92db('0x149')]);if(!_0x310fec){return this[_0x92db('0xe')]['error'](_0x39bf3b,_0x92db('0x14a'));}for(var _0x541a08=0x0;_0x541a08<_0x310fec[_0x92db('0x99')];_0x541a08+=0x1){var _0x4e4f5b=this['channel']['getVariable'](util[_0x92db('0x29')]('IFTIME(%s?true:false)',_0x310fec[_0x541a08]));if(_0x4e4f5b['result']===-0x1){return _0x4e4f5b;}logger[_0x92db('0x30')](util['format'](_0x92db('0x14b'),_0x310fec[_0x541a08],_0x4e4f5b[_0x92db('0x9e')]));if(_0x4e4f5b[_0x92db('0x9e')]===_0x92db('0x144')){logger[_0x92db('0x30')](util[_0x92db('0x29')]('IFTIME\x20%s\x20%s',_0x310fec[_0x541a08],_0x92db('0x144')));this[_0x92db('0xe')]['noop'](util[_0x92db('0x29')]('IFTIME\x20%s\x20%s',_0x310fec[_0x541a08],_0x92db('0x144')));return{'code':0xc8,'result':_0x92db('0x144')};}else{logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x14b'),_0x310fec[_0x541a08],_0x92db('0x145')));this[_0x92db('0xe')]['noop'](util['format'](_0x92db('0x14b'),_0x310fec[_0x541a08],_0x92db('0x145')));}}return{'code':0xc8,'result':_0x92db('0x145')};};AGIVertices[_0x92db('0x11')][_0x92db('0x14c')]=function(_0x27a1a2){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x14d'),_0x27a1a2[_0x92db('0x39')]));return this[_0x92db('0xe')][_0x92db('0x14c')]();};AGIVertices[_0x92db('0x11')][_0x92db('0x14e')]=function(_0x506b54){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x14f'),_0x506b54[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x506b54[_0x92db('0x7c')])){return this['channel'][_0x92db('0xa5')]('no\x20key\x20configured');}var _0x244962=_0x92db('0x12d');var _0x11f28c=util[_0x92db('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x92db('0x117')](0x4));var _0x46329b=util['format']('%s.%s',_0x11f28c,_0x244962);var _0x26a787=!![];if(_0x506b54['beep']===_0x92db('0x13b')){_0x26a787=![];}var _0x50299d=this['channel']['recordFile'](_0x11f28c,_0x244962,_0x506b54[_0x92db('0x131')],_0x506b54[_0x92db('0x67')],undefined,_0x26a787);if(_0x50299d[_0x92db('0xa1')]!==-0x1){this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x150'),_0x46329b));var _0x5f26a9=this[_0x92db('0x151')]['sync'](this,_0x506b54,_0x46329b);if(_0x5f26a9){for(var _0x5914e1 in _0x5f26a9){if(_0x5f26a9['hasOwnProperty'](_0x5914e1)){this[_0x92db('0xe')][_0x92db('0x9b')](util[_0x92db('0x29')](_0x92db('0x152'),_0x5914e1[_0x92db('0x6b')]()),_0x5f26a9[_0x5914e1]);}}return this[_0x92db('0xe')]['noop'](util[_0x92db('0x29')](_0x92db('0x153'),JSON[_0x92db('0x75')](_0x5f26a9)));}}return _0x50299d;};AGIVertices[_0x92db('0x11')][_0x92db('0x154')]=function(_0x3e951a){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x155'),_0x3e951a[_0x92db('0x39')]));if(!this['isConfigured'](_0x3e951a['key'])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xe4'));}if(!this[_0x92db('0x85')](_0x3e951a[_0x92db('0x5b')])){return this['channel'][_0x92db('0xa5')](_0x92db('0xa6'));}this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x156'),_0x3e951a[_0x92db('0x5b')]));var _0x32642e=this[_0x92db('0x82')][_0x92db('0x72')](this,_0x3e951a);if(_0x32642e){this[_0x92db('0xe')][_0x92db('0xa5')](util['format'](_0x92db('0x150'),_0x32642e));var _0x32b262=this[_0x92db('0xe')][_0x92db('0x106')](_0x32642e,_0x3e951a['intKey']);try{fs['unlink'](_0x32642e+'.wav');}catch(_0x17bb08){logger[_0x92db('0x2c')](_0x17bb08);}return _0x32b262;}return this[_0x92db('0xe')][_0x92db('0x2c')](_0x3e951a,_0x92db('0x157'));};AGIVertices[_0x92db('0x11')][_0x92db('0x158')]=function(_0x1c93e3){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1c93e3[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x1c93e3['findBy'])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x1c93e3,'no\x20find\x20by\x20configured');}logger['info'](util[_0x92db('0x29')](_0x92db('0x159'),this[_0x92db('0xe')]['callerid'],_0x1c93e3[_0x92db('0x15a')]));var _0x3f0a2d=this[_0x92db('0x55')]['sync'](this,_0x1c93e3['findBy']);if(_0x3f0a2d){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x15b'),this[_0x92db('0xe')][_0x92db('0x51')],_0x1c93e3['findBy']));this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x15b'),this[_0x92db('0xe')]['callerid'],_0x1c93e3['findBy']));return{'code':0xc8,'result':_0x92db('0x15c')};}else{logger['info'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x92db('0xe')]['callerid'],_0x1c93e3[_0x92db('0x15a')]));this[_0x92db('0xe')][_0x92db('0xa5')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x92db('0xe')]['callerid'],_0x1c93e3[_0x92db('0x15a')]));return{'code':0xc8,'result':_0x92db('0x15d')};}};AGIVertices[_0x92db('0x11')][_0x92db('0x15e')]=function(_0x2b7715){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x15f'),_0x2b7715[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x2b7715[_0x92db('0x15a')])){return this[_0x92db('0xe')]['error'](_0x2b7715,_0x92db('0x160'));}logger['info'](util[_0x92db('0x29')](_0x92db('0x159'),this['channel'][_0x92db('0x51')],_0x2b7715[_0x92db('0x15a')]));var _0xbf5685=this['agentLogout'][_0x92db('0x72')](this,_0x2b7715[_0x92db('0x15a')]);if(_0xbf5685){logger['info'](util[_0x92db('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x92db('0xe')]['callerid'],_0x2b7715[_0x92db('0x15a')]));this['channel'][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x15b'),this[_0x92db('0xe')][_0x92db('0x51')],_0x2b7715['findBy']));return{'code':0xc8,'result':_0x92db('0x15c')};}else{logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x161'),this['channel']['callerid'],_0x2b7715[_0x92db('0x15a')]));this[_0x92db('0xe')]['noop'](util['format'](_0x92db('0x161'),this[_0x92db('0xe')]['callerid'],_0x2b7715[_0x92db('0x15a')]));return{'code':0xc8,'result':_0x92db('0x15d')};}};AGIVertices['prototype']['math']=function(_0x5210db){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x162'),_0x5210db['label']));if(!this[_0x92db('0x85')](_0x5210db['operation'])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x5210db,_0x92db('0x163'));}this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x164'),_0x5210db['operation']));var _0x4a779f=eval(_0x5210db['operation']);if(!this['isConfigured'](_0x5210db[_0x92db('0xd3')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xd4'));}var _0x1287b1=this[_0x92db('0x12')][_0x92db('0x72')](this,_0x5210db[_0x92db('0xd3')]);if(!_0x1287b1){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x5210db,_0x92db('0xd5'));}if(_[_0x92db('0x97')](_0x4a779f)){var _0x1d255b=this;_0x4a779f[_0x92db('0xd7')](function(_0x43ce8c,_0x3a745f){_0x1d255b[_0x92db('0xe')][_0x92db('0x9b')](util[_0x92db('0x29')](_0x92db('0x165'),_0x1287b1,_0x3a745f),_0x43ce8c);});return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x166'),_0x1287b1));}else{return this[_0x92db('0xe')][_0x92db('0x9b')](_0x1287b1,_0x4a779f);}};AGIVertices['prototype'][_0x92db('0x167')]=function(_0x221d55){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x221d55[_0x92db('0x39')]));if(_0x221d55[_0x92db('0xa3')]===0x0){return this['maxRetry'](_0x221d55);}_0x221d55[_0x92db('0xa3')]-=0x1;if(!this[_0x92db('0x85')](_0x221d55[_0x92db('0x112')])){return this[_0x92db('0xe')]['error'](_0x221d55,_0x92db('0x168'));}var _0x582829=this[_0x92db('0x1e')][_0x92db('0x72')](this,_0x221d55['file_id']);if(!_0x582829){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x221d55,_0x92db('0x113'));}var _0x2b1f10=this[_0x92db('0xe')]['getData'](_0x582829,_0x221d55[_0x92db('0x169')],_0x221d55['digit']);var _0x504176=_0x2b1f10[_0x92db('0xa1')];if(_0x2b1f10['result']===-0x1){this['createSquareDetailsReport']['sync'](this,_0x221d55,'-1');return _0x2b1f10;}else if(_0x2b1f10[_0x92db('0x9e')]===_0x92db('0x67')){_0x2b1f10[_0x92db('0xa1')]=_0x2b1f10[_0x92db('0xa1')][_0x92db('0x99')]>0x0?_0x2b1f10[_0x92db('0xa1')]:'t';}else if(_[_0x92db('0x45')](_0x2b1f10[_0x92db('0xa1')])){_0x2b1f10[_0x92db('0xa1')]='#';_0x504176='#';}if(!this[_0x92db('0x85')](_0x221d55[_0x92db('0xd3')])){this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xd4'));}else{var _0x1f3d03=this[_0x92db('0x12')][_0x92db('0x72')](this,_0x221d55[_0x92db('0xd3')]);if(!_0x1f3d03){return this[_0x92db('0xe')]['error'](_0x221d55,_0x92db('0xd5'));}this[_0x92db('0xe')][_0x92db('0x9b')](_0x1f3d03,_0x504176);}this[_0x92db('0x37')][_0x92db('0x72')](this,_0x221d55,_0x504176);return _0x2b1f10;};AGIVertices[_0x92db('0x11')][_0x92db('0xa5')]=function(_0x463512){logger[_0x92db('0x30')](util['format'](_0x92db('0x16a'),_0x463512['label']));return this['channel']['noop'](_0x463512[_0x92db('0x16b')]||_0x463512['label']);};AGIVertices[_0x92db('0x11')][_0x92db('0x16c')]=function(_0x5aaef2){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x16d'),_0x5aaef2[_0x92db('0x39')]));if(!this['isConfigured'](_0x5aaef2[_0x92db('0x15a')])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x5aaef2,'no\x20find\x20by\x20configured');}logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x159'),this[_0x92db('0xe')]['callerid'],_0x5aaef2['findBy']));var _0x5ef79b=this[_0x92db('0x4f')][_0x92db('0x72')](this,_0x5aaef2['pause_id']);var _0xd21148=this[_0x92db('0x50')][_0x92db('0x72')](this,_0x5aaef2['findBy'],_0x5ef79b);if(_0xd21148){logger[_0x92db('0x30')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x92db('0xe')][_0x92db('0x51')],_0x5aaef2[_0x92db('0x15a')]));this[_0x92db('0xe')]['noop'](util[_0x92db('0x29')](_0x92db('0x15b'),this[_0x92db('0xe')][_0x92db('0x51')],_0x5aaef2[_0x92db('0x15a')]));return{'code':0xc8,'result':_0x92db('0x15c')};}else{logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x161'),this[_0x92db('0xe')][_0x92db('0x51')],_0x5aaef2[_0x92db('0x15a')]));this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x15b'),this['channel']['callerid'],_0x5aaef2[_0x92db('0x15a')]));return{'code':0xc8,'result':_0x92db('0x15d')};}};AGIVertices[_0x92db('0x11')][_0x92db('0x16e')]=function(_0x508dab){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x16f'),_0x508dab[_0x92db('0x39')]));if(!this['isConfigured'](_0x508dab[_0x92db('0x112')])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x508dab,'no\x20file\x20audio\x20selected');}var _0x11dbf8=this['getSound'][_0x92db('0x72')](this,_0x508dab['file_id']);if(!_0x11dbf8){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x508dab,_0x92db('0x113'));}var _0x2afafb=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0x170'),[_0x11dbf8,_0x508dab[_0x92db('0xe1')]]);if(_0x2afafb[_0x92db('0xa1')]===-0x1){return _0x2afafb;}return this[_0x92db('0xe')][_0x92db('0xa5')](util['format'](_0x92db('0xbf'),_0x92db('0x170'),_0x11dbf8));};AGIVertices['prototype'][_0x92db('0x171')]=function(_0x243a48){logger[_0x92db('0x30')](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x243a48[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x243a48[_0x92db('0x172')])){return this['channel'][_0x92db('0x2c')](_0x243a48,'no\x20queue\x20selected');}var _0x3d1018='';var _0x4ddc09=parseInt(_0x243a48[_0x92db('0x172')],0xa);if(isNaN(_0x4ddc09)){_0x3d1018=_0x243a48['queue_id'];}else{_0x3d1018=this[_0x92db('0x15')][_0x92db('0x72')](this,_0x243a48['queue_id']);if(!_0x3d1018){return this[_0x92db('0xe')]['error'](_0x243a48,_0x92db('0x173'));}}var _0x110db8='';if(this['isConfigured'](_0x243a48[_0x92db('0x112')])){var _0x1768cd=this[_0x92db('0x1e')][_0x92db('0x72')](this,_0x243a48['file_id']);if(_0x1768cd){_0x110db8=_0x1768cd;}}this[_0x92db('0x37')]['sync'](this,_0x243a48,_0x3d1018);if(_0x243a48[_0x92db('0xe1')][_0x92db('0x174')]('x')<0x0){_0x243a48[_0x92db('0xe1')]+='x';}if(_0x243a48[_0x92db('0xe1')][_0x92db('0x174')]('X')<0x0){_0x243a48['opts']+='X';}this[_0x92db('0xe')][_0x92db('0x9b')]('XMCS-QUEUE',_0x3d1018?_0x3d1018[_0x92db('0x175')]():'');var _0x1e0fad=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0x176'),[_0x3d1018,_0x243a48[_0x92db('0xe1')],_0x243a48[_0x92db('0x64')],_0x110db8,_0x243a48[_0x92db('0x67')],_0x243a48[_0x92db('0x6')],_0x243a48[_0x92db('0x177')],_0x243a48[_0x92db('0x178')],'',_0x243a48[_0x92db('0x179')]]);if(_0x1e0fad[_0x92db('0xa1')]===-0x1){return _0x1e0fad;}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xbf'),'QUEUE',_0x3d1018));};AGIVertices[_0x92db('0x11')]['record']=function(_0x2ac3e2){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x2ac3e2[_0x92db('0x39')]));var _0x3cf0d7=_0x2ac3e2[_0x92db('0x17a')]||_0x92db('0x12d');var _0x524d1e=util[_0x92db('0x29')](_0x92db('0x17b'),this['channel'][_0x92db('0x38')],rs['generate'](0x5));var _0x393ae6=util[_0x92db('0x29')](_0x92db('0x17c'),FILES_PATH,_0x524d1e,_0x3cf0d7);var _0x367007=util[_0x92db('0x29')](_0x92db('0x12e'),FILES_PATH,_0x524d1e);this[_0x92db('0x3c')]['sync'](this,_0x2ac3e2,_0x524d1e,_0x393ae6);this[_0x92db('0xe')][_0x92db('0x9b')](_0x92db('0x17d'),_0x524d1e);logger[_0x92db('0x30')](_0x92db('0x17e'),_0x367007,_0x3cf0d7,_0x2ac3e2[_0x92db('0x17f')],_0x2ac3e2[_0x92db('0x67')]);return this[_0x92db('0xe')][_0x92db('0x130')](_0x367007,_0x3cf0d7,_0x2ac3e2[_0x92db('0x17f')],_0x2ac3e2[_0x92db('0x67')],undefined,!![]);};AGIVertices[_0x92db('0x11')][_0x92db('0x180')]=function(_0x4c99ca){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x181'),_0x4c99ca[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x4c99ca[_0x92db('0x64')])){return this['channel']['noop'](_0x92db('0x182'));}var _0x47e42e=this[_0x92db('0x63')]['sync'](this,_0x4c99ca);logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x183'),util[_0x92db('0x184')](_0x47e42e,{'showHidden':![],'depth':null})));if(!this[_0x92db('0x85')](_0x4c99ca[_0x92db('0xd3')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x185'));}var _0x3cd334=this[_0x92db('0x12')][_0x92db('0x72')](this,_0x4c99ca[_0x92db('0xd3')]);if(!_0x3cd334){return this['channel'][_0x92db('0x2c')](_0x4c99ca,_0x92db('0xd5'));}this[_0x92db('0xe')][_0x92db('0x9b')](util[_0x92db('0x29')](_0x92db('0x186'),_0x3cd334),_0x47e42e[_0x92db('0x77')]?_0x47e42e[_0x92db('0x77')]:'200');this[_0x92db('0xe')][_0x92db('0x9b')](util['format'](_0x92db('0x187'),_0x3cd334),_0x47e42e[_0x92db('0x78')]?_0x47e42e[_0x92db('0x78')]:'OK');if(_0x47e42e[_0x92db('0x6c')]){try{this['saveRestApiResult'](_0x47e42e[_0x92db('0x6c')],_0x3cd334);}catch(_0x426783){logger[_0x92db('0x2c')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x3cd334));}}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x188'),_0x3cd334));};AGIVertices[_0x92db('0x11')][_0x92db('0x189')]=function(_0xc0c23f){logger['info'](util['format'](_0x92db('0x18a'),_0xc0c23f['label']));return this[_0x92db('0xe')][_0x92db('0x18b')](_0xc0c23f[_0x92db('0x18c')][_0x92db('0x58')](/\s+/g,''),_0xc0c23f[_0x92db('0x17f')]);};AGIVertices[_0x92db('0x11')]['saynumber']=function(_0x3213e6){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x3213e6[_0x92db('0x39')]));return this[_0x92db('0xe')]['sayNumber'](_0x3213e6['number']['replace'](/\s+/g,''),_0x3213e6[_0x92db('0x17f')]);};AGIVertices['prototype'][_0x92db('0x18d')]=function(_0x5743ea){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x18e'),_0x5743ea['label']));return this[_0x92db('0xe')][_0x92db('0x18f')](_0x5743ea[_0x92db('0x5b')],_0x5743ea[_0x92db('0x17f')]);};AGIVertices[_0x92db('0x11')]['sendMail']=function(_0x1fd9dc){logger['info'](util[_0x92db('0x29')](_0x92db('0x190'),_0x1fd9dc[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x1fd9dc['account_id'])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x191'));}var _0x40d07e=this['getMailAccount'][_0x92db('0x72')](this,_0x1fd9dc['account_id']);if(!_0x40d07e||!_0x40d07e[_0x92db('0x192')]){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x1fd9dc,'no\x20mail\x20account\x20found');}var _0x40ac73={'from':util['format'](_0x92db('0x193'),_0x40d07e[_0x92db('0x19')],_0x40d07e[_0x92db('0x194')]||_0x40d07e['Smtp'][_0x92db('0x195')]),'to':_0x1fd9dc['to']||'','cc':_0x1fd9dc['cc']||'','bcc':_0x1fd9dc[_0x92db('0x196')]||'','subject':_0x1fd9dc['subject'],'html':_0x1fd9dc[_0x92db('0x5b')],'text':_0x1fd9dc[_0x92db('0x5b')]};var _0x47863d={'tls':{'rejectUnauthorized':![]}};if(_0x40d07e['Smtp'][_0x92db('0x197')]){_0x47863d['service']=_0x40d07e['Smtp'][_0x92db('0x197')];}else{_0x47863d[_0x92db('0x198')]=_0x40d07e[_0x92db('0x192')][_0x92db('0x198')];_0x47863d[_0x92db('0x199')]=_0x40d07e[_0x92db('0x192')]['port'];_0x47863d[_0x92db('0x19a')]=_0x40d07e[_0x92db('0x192')][_0x92db('0x19a')];}if(_0x40d07e[_0x92db('0x192')][_0x92db('0x19b')]){_0x47863d[_0x92db('0x19c')]={'user':_0x40d07e['Smtp'][_0x92db('0x195')],'pass':_0x40d07e['Smtp'][_0x92db('0x19d')]};}if(this[_0x92db('0x85')](_0x1fd9dc[_0x92db('0x19e')])){}logger['debug']('sendMail\x20message',JSON[_0x92db('0x75')](_0x40ac73));this[_0x92db('0x37')][_0x92db('0x72')](this,_0x1fd9dc,_0x1fd9dc['account_id']);this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x19f'),_0x40d07e['name']));this[_0x92db('0x23')][_0x92db('0x72')](this,_0x47863d,_0x40ac73);return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x1a0'));};AGIVertices['prototype'][_0x92db('0x1a1')]=function(_0x5a353a){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x1a2'),_0x5a353a['label']));return this[_0x92db('0xe')][_0x92db('0xa5')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x92db('0x11')][_0x92db('0x1a3')]=function(_0x55ae8a){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x1a4'),_0x55ae8a[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x55ae8a[_0x92db('0x1a5')])){return this['channel'][_0x92db('0xa5')](_0x92db('0x1a6'));}var _0x3d934e=this[_0x92db('0x34')][_0x92db('0x72')](this,_0x55ae8a['sms_account_id']);if(!_0x3d934e){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x55ae8a,_0x92db('0x1a7'));}var _0x1099e5={'body':_0x55ae8a[_0x92db('0x1a8')],'phone':_0x55ae8a['to']||'','SmsAccountId':_0x3d934e['id']};logger[_0x92db('0xdb')](_0x92db('0x1a9'),JSON[_0x92db('0x75')](_0x1099e5));this[_0x92db('0x37')][_0x92db('0x72')](this,_0x55ae8a,_0x55ae8a['sms_account_id']);this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x1aa'),_0x3d934e['name']));this[_0x92db('0x36')]['sync'](this,_0x1099e5);return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x1ab'));};AGIVertices[_0x92db('0x11')]['set']=function(_0xa39f9){logger['info'](util[_0x92db('0x29')](_0x92db('0x1ac'),_0xa39f9[_0x92db('0x39')]));if(!this['isConfigured'](_0xa39f9[_0x92db('0xd3')])){return this[_0x92db('0xe')]['error'](_0xa39f9,_0x92db('0x1ad'));}var _0x75d500=this[_0x92db('0x12')][_0x92db('0x72')](this,_0xa39f9['variable_id']);if(!_0x75d500){return this[_0x92db('0xe')][_0x92db('0x2c')](_0xa39f9,_0x92db('0xd5'));}return this['channel']['setVariable'](_0x75d500,_0xa39f9[_0x92db('0x1ae')]);};AGIVertices['prototype'][_0x92db('0x1af')]=function(_0x33f3da){logger['info'](util[_0x92db('0x29')](_0x92db('0x1b0'),_0x33f3da['label']));this[_0x92db('0xe')][_0x92db('0xa5')]('START\x20CALLY\x20SQUARE');if(_0x33f3da[_0x92db('0xb3')]===_0x92db('0x1b1')){this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x1b2'));return this[_0x92db('0xe')][_0x92db('0xb3')]();}return this[_0x92db('0xe')][_0x92db('0xa5')]('Skipped\x20Answer');};AGIVertices[_0x92db('0x11')]['subproject']=function(_0x39667f){logger['info'](util[_0x92db('0x29')](_0x92db('0x1b3'),_0x39667f[_0x92db('0x39')]));if(!this['isConfigured'](_0x39667f[_0x92db('0x1b4')])){return this[_0x92db('0xe')]['error'](_0x39667f,_0x92db('0x1b5'));}var _0x18db20=this[_0x92db('0x16')][_0x92db('0x72')](this,_0x39667f[_0x92db('0x1b4')]);if(!this['isConfigured'](_0x18db20)){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x39667f,util[_0x92db('0x29')](_0x92db('0x1b6'),_0x39667f[_0x92db('0x1b4')]));}if(_0x18db20===this[_0x92db('0xe')][_0x92db('0x3b')]){return this['channel'][_0x92db('0x2c')](_0x39667f,_0x92db('0x1b7'));}this[_0x92db('0x37')][_0x92db('0x72')](this,_0x39667f,_0x18db20);var _0x33e0ac=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0x1b8'),util[_0x92db('0x29')](_0x92db('0x1b9'),config[_0x92db('0x6')][_0x92db('0x198')]||_0x92db('0x1ba'),_0x18db20,this[_0x92db('0xe')][_0x92db('0x3b')]));if(_0x33e0ac[_0x92db('0xa1')]===-0x1){return _0x33e0ac;}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xbf'),_0x92db('0x1b8'),_0x18db20));};AGIVertices[_0x92db('0x11')][_0x92db('0x1bb')]=function(_0x3d4118){logger['info'](util['format'](_0x92db('0x1bc'),_0x3d4118[_0x92db('0x39')]));var _0xe5b8fd=this[_0x92db('0x56')][_0x92db('0x72')](this,_0x3d4118['command']);this[_0x92db('0x37')][_0x92db('0x72')](this,_0x3d4118,_0x3d4118[_0x92db('0x1bd')]);if(this[_0x92db('0x85')](_0x3d4118[_0x92db('0xd3')])){var _0x577e47=this['getVariable'][_0x92db('0x72')](this,_0x3d4118[_0x92db('0xd3')]);if(_0x577e47){this['channel']['setVariable'](_0x577e47,_0xe5b8fd);return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x3d4118[_0x92db('0x1bd')],_0x577e47));}}return this[_0x92db('0xe')]['noop'](util[_0x92db('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3d4118[_0x92db('0x1bd')]));};AGIVertices[_0x92db('0x11')][_0x92db('0x1be')]=function(_0x386508){logger[_0x92db('0x30')](util['format'](_0x92db('0x1bf'),_0x386508['label']));_0x386508[_0x92db('0x5b')]=_0x386508[_0x92db('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x386508[_0x92db('0x5a')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0x1c0'));}if(!this['isConfigured'](_0x386508['text'])){return this['channel'][_0x92db('0xa5')]('no\x20text\x20configured');}this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x386508['text']));var _0x298b1a=this['googleCloudTTS'][_0x92db('0x72')](this,_0x386508);if(_0x298b1a){this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x1c1'),_0x298b1a));var _0x1b0a72=this[_0x92db('0xe')]['streamFile'](_0x298b1a);try{fs[_0x92db('0x107')](_0x298b1a+_0x92db('0x122'));}catch(_0x4ea3ec){logger[_0x92db('0x2c')](_0x4ea3ec);}return _0x1b0a72;}return this[_0x92db('0xe')][_0x92db('0x2c')](_0x386508,_0x92db('0x1c2'));};AGIVertices['prototype']['tts']=function(_0x599c31){logger[_0x92db('0x30')](util[_0x92db('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x599c31[_0x92db('0x39')]));_0x599c31['text']=_0x599c31['text'][_0x92db('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x599c31[_0x92db('0x5b')])){return this[_0x92db('0xe')][_0x92db('0xa5')](_0x92db('0xa6'));}this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x599c31[_0x92db('0x5b')]));var _0x1371de=this[_0x92db('0x61')][_0x92db('0x72')](this,_0x599c31);if(_0x1371de){this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x1c3'),_0x1371de));var _0x205cca=this[_0x92db('0xe')][_0x92db('0x106')](_0x1371de);try{fs[_0x92db('0x107')](_0x1371de+'.wav');}catch(_0x3f4aa8){logger[_0x92db('0x2c')](_0x3f4aa8);}return _0x205cca;}return this[_0x92db('0xe')][_0x92db('0x2c')](_0x599c31,_0x92db('0x1c4'));};AGIVertices['prototype'][_0x92db('0x1c5')]=function(_0x1332ad){logger['info'](util[_0x92db('0x29')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x1332ad['label']));if(!this[_0x92db('0x85')](_0x1332ad[_0x92db('0x15a')])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x1332ad,_0x92db('0x160'));}logger[_0x92db('0x30')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x92db('0x51')],_0x1332ad[_0x92db('0x15a')]));var _0x32a069=this['agentUnpause'][_0x92db('0x72')](this,_0x1332ad['findBy']);if(_0x32a069){logger[_0x92db('0x30')](util['format'](_0x92db('0x15b'),this[_0x92db('0xe')][_0x92db('0x51')],_0x1332ad[_0x92db('0x15a')]));this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0x15b'),this['channel'][_0x92db('0x51')],_0x1332ad[_0x92db('0x15a')]));return{'code':0xc8,'result':_0x92db('0x15c')};}else{logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x161'),this[_0x92db('0xe')][_0x92db('0x51')],_0x1332ad['findBy']));this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x92db('0x51')],_0x1332ad[_0x92db('0x15a')]));return{'code':0xc8,'result':_0x92db('0x15d')};}};AGIVertices['prototype'][_0x92db('0x1c6')]=function(_0x58f6eb){logger[_0x92db('0x30')](util[_0x92db('0x29')](_0x92db('0x1c7'),_0x58f6eb[_0x92db('0x39')]));var _0x4c1067=this[_0x92db('0xe')][_0x92db('0x57')](_0x92db('0x1c8'),[_0x58f6eb[_0x92db('0x1c9')],_0x58f6eb[_0x92db('0x7b')]]);if(_0x4c1067['result']===-0x1){return _0x4c1067;}return this[_0x92db('0xe')][_0x92db('0xa5')](util[_0x92db('0x29')](_0x92db('0xbf'),_0x92db('0x1c8'),_0x58f6eb['mailbox']));};AGIVertices['prototype'][_0x92db('0x1ca')]=function(_0x1f7e9f){logger['info'](util[_0x92db('0x29')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x1f7e9f[_0x92db('0x39')]));if(!this[_0x92db('0x85')](_0x1f7e9f['variable_id'])){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x1f7e9f,_0x92db('0x1ad'));}var _0x55dc08=this[_0x92db('0x12')][_0x92db('0x72')](this,_0x1f7e9f[_0x92db('0xd3')]);if(!_0x55dc08){return this[_0x92db('0xe')][_0x92db('0x2c')](_0x1f7e9f,'no\x20variable\x20found');}var _0x4a9708=this[_0x92db('0xe')]['getVariable'](_0x55dc08);return{'code':0xc8,'result':_0x4a9708['extra']?_0x4a9708[_0x92db('0x9e')]:'-'};};String[_0x92db('0x11')]['replaceAll']=function(_0x2ece58,_0x39c7fb){return this[_0x92db('0x9c')](_0x2ece58)['join'](_0x39c7fb);};module['exports']=AGIVertices; \ No newline at end of file +var _0xc7d1=['AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','success','failure','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','digit','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','service','host','port','secure','auth','pass','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','debug','Trying\x20SendSMS\x20with\x20account\x20%s','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Skipped\x20Answer','subproject','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','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','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','VOICEMAIL','mailbox','join','exports','path','util','lodash','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','name','getSquareProject','getSquareProjectById','dsn','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','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','computedVariables','sync','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','dialogflowV2_project_id','client_email','dialogflowV2_language','ispeechTTS','key','ispeech_tts_language','en-US','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','includes','agicommand','isString','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','length','saveRestApiResult','%s.%s','setVariable','replaceObjectAllVariables','split','replaceAll','extra','toString','getAndSetVariable','result','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','isConfigured','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','database','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','googleDialogflowV2','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','audiofile','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20variable\x20selected\x20for\x20the\x20result','response','maxdigit','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','Trying\x20Amazon\x20Lex:\x20%s'];(function(_0xfd5f37,_0x24a79c){var _0x11bd01=function(_0x4ae9bd){while(--_0x4ae9bd){_0xfd5f37['push'](_0xfd5f37['shift']());}};_0x11bd01(++_0x24a79c);}(_0xc7d1,0xa4));var _0x1c7d=function(_0x2fe78c,_0x458be9){_0x2fe78c=_0x2fe78c-0x0;var _0x3f18bc=_0xc7d1[_0x2fe78c];return _0x3f18bc;};'use strict';var fs=require('fs');var path=require(_0x1c7d('0x0'));var util=require(_0x1c7d('0x1'));var _=require(_0x1c7d('0x2'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x1c7d('0x3'));var moment=require(_0x1c7d('0x4'));var Mustache=require(_0x1c7d('0x5'));var rp=require('request-promise');var logger=require(_0x1c7d('0x6'))(_0x1c7d('0x7'));var config=require(_0x1c7d('0x8'));var scripts=require('./scripts');var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x1c7d('0x9'),_0x1c7d('0xa')];var verticesWithRetry=['menu',_0x1c7d('0xb'),_0x1c7d('0xc')];var AGIVertices=function(_0x4af699,_0x2c9d9d,_0x468a1f){this[_0x1c7d('0xd')]=_0x4af699;this[_0x1c7d('0xe')]=_0x2c9d9d;this[_0x1c7d('0xf')]=_0x468a1f;};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x11')]=function(_0x17d5bb,_0x346352){this[_0x1c7d('0xe')][_0x1c7d('0x12')](_0x17d5bb)[_0x1c7d('0x13')](function(_0x38bf0b){_0x346352(null,_0x38bf0b?_0x38bf0b['name']:![]);})[_0x1c7d('0x14')](function(_0x3935a2){_0x346352(_0x3935a2);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x15')]=function(_0x5200d4,_0x35b5cb){this[_0x1c7d('0xe')]['getVoiceQueueById'](_0x5200d4)[_0x1c7d('0x13')](function(_0x42e6bb){_0x35b5cb(null,_0x42e6bb?_0x42e6bb[_0x1c7d('0x16')]:![]);})[_0x1c7d('0x14')](function(_0x54f507){_0x35b5cb(_0x54f507);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x17')]=function(_0x568134,_0x120ed9){this[_0x1c7d('0xe')][_0x1c7d('0x18')](_0x568134)[_0x1c7d('0x13')](function(_0x125377){_0x120ed9(null,_0x125377?_0x125377[_0x1c7d('0x16')]:![]);})[_0x1c7d('0x14')](function(_0x471505){_0x120ed9(_0x471505);});};AGIVertices[_0x1c7d('0x10')]['getSquareOdbc']=function(_0x19866e,_0x28f630){this[_0x1c7d('0xe')]['getSquareOdbcById'](_0x19866e)['then'](function(_0x51cadf){_0x28f630(null,_0x51cadf?_0x51cadf[_0x1c7d('0x19')]:![]);})[_0x1c7d('0x14')](function(_0x13b976){_0x28f630(_0x13b976);});};AGIVertices['prototype']['getUser']=function(_0x583839,_0x1c64f8){this[_0x1c7d('0xe')][_0x1c7d('0x1a')](_0x583839)['then'](function(_0x4a7091){_0x1c64f8(null,_0x4a7091?_0x4a7091['name']:![]);})['catch'](function(_0x1c81e5){_0x1c64f8(_0x1c81e5);});};AGIVertices['prototype'][_0x1c7d('0x1b')]=function(_0x119f93,_0x4c3f08){this[_0x1c7d('0xe')]['getTrunkById'](_0x119f93)[_0x1c7d('0x13')](function(_0x1658dc){_0x4c3f08(null,_0x1658dc?_0x1658dc[_0x1c7d('0x16')]:![]);})['catch'](function(_0x54e20f){_0x4c3f08(_0x54e20f);});};AGIVertices['prototype'][_0x1c7d('0x1c')]=function(_0x2fb99e,_0x300e4e){var _0x1e60c3=this;this[_0x1c7d('0xe')][_0x1c7d('0x1d')](_0x2fb99e)[_0x1c7d('0x13')](function(_0x1deec1){_0x300e4e(null,_0x1deec1?_0x1e60c3[_0x1c7d('0x1e')](_0x1deec1[_0x1c7d('0x1f')]):![]);})[_0x1c7d('0x14')](function(_0x862b3e){_0x300e4e(_0x862b3e);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x20')]=function(_0x58fb5b,_0x831a6a){this[_0x1c7d('0xe')][_0x1c7d('0x21')](_0x58fb5b)[_0x1c7d('0x13')](function(_0x29162b){_0x831a6a(null,_0x29162b?_0x29162b:![]);})['catch'](function(_0x3214bb){_0x831a6a(_0x3214bb);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x22')]=function(_0x4785cf,_0x31562b,_0x445d04){this[_0x1c7d('0xf')][_0x1c7d('0x22')](_0x4785cf,_0x31562b)[_0x1c7d('0x13')](function(){_0x445d04(null);})['catch'](function(_0x5c134f){_0x445d04(_0x5c134f);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x23')]=function(_0x445b62,_0x3872f9){this[_0x1c7d('0xe')]['getIntervalById'](_0x445b62)[_0x1c7d('0x13')](function(_0x3f47d9){if(_0x3f47d9){if(_0x3f47d9[_0x1c7d('0x24')]){_0x3872f9(null,[_0x3f47d9[_0x1c7d('0x25')]]);}else{_0x3872f9(null,_[_0x1c7d('0x26')](_0x3f47d9['Intervals'],_0x1c7d('0x25')));}}else{_0x3872f9(null,![]);}})[_0x1c7d('0x14')](function(_0x3eda1a){_0x3872f9(_0x3eda1a);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x1e')]=function(_0x46484e){return util['format'](_0x1c7d('0x27'),FILES_PATH,_0x46484e);};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x28')]=function(_0x48696c,_0x293e3a,_0x1e697c){odbc['open'](_0x48696c,function(_0x2963b9){if(_0x2963b9){logger[_0x1c7d('0x29')](_0x1c7d('0x2a'),_0x2963b9);_0x1e697c(_0x2963b9);}else{logger[_0x1c7d('0x2b')](_0x1c7d('0x2c'));odbc[_0x1c7d('0x2d')](_0x293e3a,function(_0x33ea7e,_0xb2c15f){if(_0x33ea7e){logger[_0x1c7d('0x2b')](_0x1c7d('0x2e'),_0x293e3a);_0x1e697c(_0x33ea7e);}else{logger['info'](_0x1c7d('0x2f'),_0x293e3a);odbc[_0x1c7d('0x30')](function(_0x56fa66){if(_0x56fa66){logger[_0x1c7d('0x29')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x56fa66);}_0x1e697c(null,_0xb2c15f);});}});}});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x31')]=function(_0x2ff998,_0x16cf85){this[_0x1c7d('0xe')][_0x1c7d('0x32')](_0x2ff998)[_0x1c7d('0x13')](function(_0x35f134){_0x16cf85(null,_0x35f134?_0x35f134:![]);})[_0x1c7d('0x14')](function(_0x129fc1){_0x16cf85(_0x129fc1);});};AGIVertices['prototype'][_0x1c7d('0x33')]=function(_0x136853,_0x305508){this['rpc'][_0x1c7d('0x33')](_0x136853)[_0x1c7d('0x13')](function(_0x210554){_0x305508(null,_0x210554);})[_0x1c7d('0x14')](function(_0x295aef){_0x305508(_0x295aef);});};AGIVertices['prototype'][_0x1c7d('0x34')]=function(_0x3bdce7,_0x200f2b,_0xf196f3){this[_0x1c7d('0xe')][_0x1c7d('0x34')]({'uniqueid':this['channel'][_0x1c7d('0x35')],'node':_0x3bdce7[_0x1c7d('0x36')],'application':_0x3bdce7['agicommand'],'data':_0x200f2b||null,'project_name':this[_0x1c7d('0xd')][_0x1c7d('0x37')],'callerid':this[_0x1c7d('0xd')][_0x1c7d('0x38')]})[_0x1c7d('0x13')](function(_0x1c2e1a){if(_0xf196f3){_0xf196f3(null,_0x1c2e1a);}})['catch'](function(_0x354382){if(_0xf196f3){_0xf196f3(_0x354382);}});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x39')]=function(_0x38e5b0,_0x44321c,_0x163fee,_0x2807cc){this[_0x1c7d('0xe')][_0x1c7d('0x39')]({'uniqueid':this[_0x1c7d('0xd')][_0x1c7d('0x35')],'callerid':this[_0x1c7d('0xd')]['callerid'],'calleridname':this[_0x1c7d('0xd')][_0x1c7d('0x3a')],'context':this[_0x1c7d('0xd')][_0x1c7d('0x3b')],'extension':this['channel']['extension'],'priority':this[_0x1c7d('0xd')][_0x1c7d('0x3c')],'accountcode':this[_0x1c7d('0xd')][_0x1c7d('0x3d')],'dnid':this[_0x1c7d('0xd')][_0x1c7d('0x3e')],'projectName':this[_0x1c7d('0xd')][_0x1c7d('0x37')],'saveName':_0x44321c,'filename':_0x38e5b0[_0x1c7d('0x3f')]||_0x44321c,'savePath':_0x163fee})[_0x1c7d('0x13')](function(_0x45e6a8){_0x2807cc(null,_0x45e6a8);})[_0x1c7d('0x14')](function(_0x4b905d){_0x2807cc(_0x4b905d);});};AGIVertices['prototype'][_0x1c7d('0x40')]=function(_0x236dd6,_0x34327e,_0x1e8109,_0x151fdb,_0x1b0317){this[_0x1c7d('0xe')][_0x1c7d('0x40')]({'uniqueid':this[_0x1c7d('0xd')][_0x1c7d('0x35')],'body':_0x236dd6,'direction':_0x34327e,'providerName':_0x1e8109,'providerResponse':_0x151fdb})[_0x1c7d('0x13')](function(_0x4ad4d4){if(_0x1b0317){_0x1b0317(null,_0x4ad4d4);}})[_0x1c7d('0x14')](function(_0x3147a2){if(_0x1b0317){_0x1b0317(_0x3147a2);}});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x41')]=function(_0x58eb68,_0x5704b7){this[_0x1c7d('0xe')][_0x1c7d('0x41')]({'firstName':_[_0x1c7d('0x42')](_0x58eb68['name'])||_[_0x1c7d('0x43')](_0x58eb68[_0x1c7d('0x16')])?_0x1c7d('0x44')+Math[_0x1c7d('0x45')]():_0x58eb68[_0x1c7d('0x16')],'lastName':_[_0x1c7d('0x42')](_0x58eb68[_0x1c7d('0x46')])||_[_0x1c7d('0x43')](_0x58eb68[_0x1c7d('0x46')])?null:_0x58eb68[_0x1c7d('0x46')],'phone':_0x58eb68[_0x1c7d('0x47')],'ListId':_0x58eb68[_0x1c7d('0x48')],'scheduledat':_0x58eb68[_0x1c7d('0x49')],'callbackUniqueid':this[_0x1c7d('0xd')][_0x1c7d('0x35')],'tags':_0x1c7d('0x4a'),'description':_0x1c7d('0x4b')+_0x58eb68['scheduledAt']['toString'](),'priority':_0x58eb68[_0x1c7d('0x4c')]})[_0x1c7d('0x13')](function(_0x3b9d1d){_0x5704b7(null,_0x3b9d1d);})[_0x1c7d('0x14')](function(_0xf15f4f){_0x5704b7(_0xf15f4f);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x4d')]=function(_0x2c8137,_0x179a05){this[_0x1c7d('0xe')][_0x1c7d('0x4e')](_0x2c8137)[_0x1c7d('0x13')](function(_0x492243){_0x179a05(null,_0x492243?_0x492243[_0x1c7d('0x16')]:![]);})[_0x1c7d('0x14')](function(_0x38dfe4){_0x179a05(_0x38dfe4);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x4f')]=function(_0x51740b,_0x4d9765,_0x5eb00a){var _0x1d816e={'role':_0x1c7d('0x50')};_0x1d816e[_0x51740b]=this[_0x1c7d('0xd')]['callerid'];this[_0x1c7d('0xe')][_0x1c7d('0x4f')](_0x1d816e,_0x4d9765,this[_0x1c7d('0xd')]['uniqueid'])['then'](function(_0xd55c9f){_0x5eb00a(null,_['isNil'](_0xd55c9f)?![]:!![]);})[_0x1c7d('0x14')](function(_0x54ff9f){logger[_0x1c7d('0x29')](_0x54ff9f);_0x5eb00a(null,![]);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x51')]=function(_0x26d6a5,_0x2c2909){var _0x4ecc08={'role':_0x1c7d('0x50')};_0x4ecc08[_0x26d6a5]=this['channel'][_0x1c7d('0x38')];this[_0x1c7d('0xe')][_0x1c7d('0x51')](_0x4ecc08)[_0x1c7d('0x13')](function(_0x40b452){_0x2c2909(null,_[_0x1c7d('0x43')](_0x40b452)?![]:!![]);})[_0x1c7d('0x14')](function(_0x365096){logger[_0x1c7d('0x29')](_0x365096);_0x2c2909(null,![]);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x52')]=function(_0x1aab9a,_0xc20de3){var _0xa63fe1={'role':_0x1c7d('0x50')};_0xa63fe1[_0x1aab9a]=this[_0x1c7d('0xd')][_0x1c7d('0x38')];this[_0x1c7d('0xe')][_0x1c7d('0x52')](_0xa63fe1)[_0x1c7d('0x13')](function(_0x11c6f3){_0xc20de3(null,_['isNil'](_0x11c6f3)?![]:!![]);})[_0x1c7d('0x14')](function(_0x49caff){logger[_0x1c7d('0x29')](_0x49caff);_0xc20de3(null,![]);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x53')]=function(_0x28309a,_0x4bbe12){var _0x576440={'role':_0x1c7d('0x50')};_0x576440[_0x28309a]=this[_0x1c7d('0xd')][_0x1c7d('0x38')];var _0x1913f8=_0x28309a!=_0x1c7d('0x54')?util[_0x1c7d('0x55')](_0x1c7d('0x56'),_0x1c7d('0x57'),this[_0x1c7d('0xd')][_0x1c7d('0x38')]):undefined;this[_0x1c7d('0xe')][_0x1c7d('0x53')](_0x576440,_0x1913f8)[_0x1c7d('0x13')](function(_0xfe1c1d){_0x4bbe12(null,_[_0x1c7d('0x43')](_0xfe1c1d)?![]:!![]);})[_0x1c7d('0x14')](function(_0x1cd9a1){logger[_0x1c7d('0x29')](_0x1cd9a1);_0x4bbe12(null,![]);});};AGIVertices['prototype'][_0x1c7d('0x58')]=function(_0x337d31,_0x535740){sh[_0x1c7d('0x59')](_[_0x1c7d('0x5a')](_0x337d31),function(_0xd1240e,_0x180811){var _0x58e669=_0x180811[_0x1c7d('0x5b')](/(\r\n|\n|\r)/gm,'');_0x535740(null,_0x58e669);});};AGIVertices[_0x1c7d('0x10')]['googleCloudTTS']=function(_0x5e7c4f,_0xbda825){scripts[_0x1c7d('0x5c')](_0x5e7c4f[_0x1c7d('0x5d')],_0x5e7c4f['google_cloud_tts_text_type']||'text',_0x5e7c4f[_0x1c7d('0x5e')],_0x5e7c4f[_0x1c7d('0x5f')]||'en-US',_0x5e7c4f[_0x1c7d('0x60')]||_0x1c7d('0x61'),_0x5e7c4f[_0x1c7d('0x62')]||_0x1c7d('0x63'))[_0x1c7d('0x13')](function(_0x1339c4){_0xbda825(null,_0x1339c4);})['catch'](function(_0x2cda50){_0xbda825(_0x2cda50);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x64')]=function(_0x1bbd5e,_0x4c98a0){scripts[_0x1c7d('0x64')](_0x1bbd5e[_0x1c7d('0x5e')],_0x1bbd5e[_0x1c7d('0x65')]||'en',0x1)[_0x1c7d('0x13')](function(_0x3a4e6e){_0x4c98a0(null,_0x3a4e6e);})['catch'](function(_0x2cddf8){_0x4c98a0(_0x2cddf8);});};AGIVertices['prototype'][_0x1c7d('0x66')]=function(_0x344f94,_0x2b5243){var _0x30ba66={'uri':_0x344f94[_0x1c7d('0x67')],'method':_0x344f94[_0x1c7d('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x344f94['timeout'])===_0x1c7d('0x69')&&parseInt(_0x344f94['timeout'])>=0x1?parseInt(_0x344f94[_0x1c7d('0x6a')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x1c7d('0x6b'),'PUT'],_0x30ba66[_0x1c7d('0x68')][_0x1c7d('0x6c')]())){try{_0x30ba66[_0x1c7d('0x6d')]=_0x344f94['rawBody']?JSON[_0x1c7d('0x6e')](_0x344f94['rawBody']):{};}catch(_0x12c7c3){logger[_0x1c7d('0x29')](_0x1c7d('0x6f'),_0x12c7c3);}}try{_0x30ba66[_0x1c7d('0x70')]=_0x344f94[_0x1c7d('0x9')]?JSON[_0x1c7d('0x6e')](_0x344f94['rawHeaders']):{};}catch(_0xb46caa){logger[_0x1c7d('0x29')](_0x1c7d('0x71'),_0xb46caa);}if(_0x344f94[_0x1c7d('0x72')]){try{var _0x13ea11=require(_0x344f94[_0x1c7d('0x72')])[_0x1c7d('0x73')](this,_0x30ba66);_0x30ba66['uri']=Mustache[_0x1c7d('0x74')](_0x344f94[_0x1c7d('0x67')],_0x13ea11,{},['$$','$$']);if(_0x30ba66[_0x1c7d('0x70')]){_0x30ba66[_0x1c7d('0x70')]=JSON['parse'](Mustache['render'](JSON[_0x1c7d('0x75')](_0x30ba66[_0x1c7d('0x70')]),_0x13ea11,{},['$$','$$']));}if(_0x30ba66[_0x1c7d('0x6d')]){_0x30ba66['body']=JSON[_0x1c7d('0x6e')](Mustache[_0x1c7d('0x74')](JSON[_0x1c7d('0x75')](_0x30ba66[_0x1c7d('0x6d')]),_0x13ea11,{},['$$','$$']));}}catch(_0x2453e5){logger[_0x1c7d('0x29')](_0x1c7d('0x76'),_0x2453e5);}}rp(_0x30ba66)[_0x1c7d('0x13')](function(_0x4fdfcd){var _0x36c912={'statusCode':_0x4fdfcd['statusCode']||0xc8,'statusMessage':_0x4fdfcd[_0x1c7d('0x77')]||'OK','headers':_0x4fdfcd[_0x1c7d('0x70')]||{},'body':_0x4fdfcd['body']||{}};_0x2b5243(null,_0x36c912);})[_0x1c7d('0x14')](function(_0x2bbbbe){var _0x12df0e={'statusCode':_0x2bbbbe[_0x1c7d('0x78')]||0x1f4,'statusMessage':_0x2bbbbe[_0x1c7d('0x79')]||_0x1c7d('0x7a'),'headers':_0x2bbbbe[_0x1c7d('0x7b')]['headers']||{},'body':_0x2bbbbe[_0x1c7d('0x7b')][_0x1c7d('0x6d')]||{}};_0x2b5243(null,_0x12df0e);});};AGIVertices[_0x1c7d('0x10')]['googleDialogflow']=function(_0x418928,_0x2d1497){scripts[_0x1c7d('0x7c')](this[_0x1c7d('0xd')][_0x1c7d('0x35')],_0x418928['key'],_0x418928[_0x1c7d('0x5e')],_0x418928[_0x1c7d('0x7d')]||'en')[_0x1c7d('0x13')](function(_0x441f79){_0x2d1497(null,_0x441f79);})['catch'](function(_0x229bff){_0x2d1497(_0x229bff);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x5217d0,_0xb2c6d4){scripts['googleDialogflowV2'](this[_0x1c7d('0xd')][_0x1c7d('0x35')],_0x5217d0[_0x1c7d('0x7e')],_0x5217d0[_0x1c7d('0x7f')],_0x5217d0['private_key'],_0x5217d0[_0x1c7d('0x5e')],_0x5217d0[_0x1c7d('0x80')]||'en')[_0x1c7d('0x13')](function(_0x73553){_0xb2c6d4(null,_0x73553);})[_0x1c7d('0x14')](function(_0x546570){_0xb2c6d4(_0x546570);});};AGIVertices[_0x1c7d('0x10')]['sestekNDA']=function(_0x42dede,_0x5ae9b8){scripts['sestekNDA'](this[_0x1c7d('0xd')],_0x42dede)['then'](function(_0x2e4304){_0x5ae9b8(null,_0x2e4304);})[_0x1c7d('0x14')](function(_0x24b321){_0x5ae9b8(_0x24b321);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x81')]=function(_0x41e87f,_0x207b2e){scripts[_0x1c7d('0x81')](_0x41e87f[_0x1c7d('0x82')],_0x41e87f[_0x1c7d('0x5e')],_0x41e87f[_0x1c7d('0x83')]||_0x1c7d('0x84'),_0x41e87f['speed'])[_0x1c7d('0x13')](function(_0x17c003){_0x207b2e(null,_0x17c003);})[_0x1c7d('0x14')](function(_0x176059){_0x207b2e(_0x176059);});};AGIVertices[_0x1c7d('0x10')]['ispeechASR']=function(_0x594f1a,_0x414cbf,_0x56486a){scripts[_0x1c7d('0x85')](_0x414cbf,_0x594f1a['key'],_0x594f1a[_0x1c7d('0x86')]||'en-US',this['isConfigured'](_0x594f1a['model'])?_0x594f1a[_0x1c7d('0x87')]:undefined)[_0x1c7d('0x13')](function(_0x1456b5){_0x56486a(null,_0x1456b5);})[_0x1c7d('0x14')](function(_0x3c16f6){_0x56486a(_0x3c16f6);});};AGIVertices['prototype'][_0x1c7d('0x88')]=function(_0x3c80e2,_0xb70931){scripts[_0x1c7d('0x88')](_0x3c80e2[_0x1c7d('0x89')],_0x3c80e2[_0x1c7d('0x8a')],_0x3c80e2['aws_polly_region'],_0x3c80e2[_0x1c7d('0x8b')]||_0x1c7d('0x8c'),_0x3c80e2[_0x1c7d('0x5e')],_0x3c80e2[_0x1c7d('0x8d')]||_0x1c7d('0x5e'))['then'](function(_0x2dd989){_0xb70931(null,_0x2dd989);})[_0x1c7d('0x14')](function(_0x456909){_0xb70931(_0x456909);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x8e')]=function(_0x53043d,_0x48b3ed){scripts[_0x1c7d('0x8e')](this[_0x1c7d('0xd')][_0x1c7d('0x35')],_0x53043d[_0x1c7d('0x89')],_0x53043d[_0x1c7d('0x8a')],_0x53043d[_0x1c7d('0x8f')],_0x53043d[_0x1c7d('0x5e')],_0x53043d[_0x1c7d('0x90')])[_0x1c7d('0x13')](function(_0x465ccc){_0x48b3ed(null,_0x465ccc);})[_0x1c7d('0x14')](function(_0x1dbc09){_0x48b3ed(_0x1dbc09);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x91')]=function(_0x2d9dc0,_0x490c33,_0x3e42bf){scripts[_0x1c7d('0x91')](_0x490c33,_0x2d9dc0[_0x1c7d('0x82')],_0x2d9dc0[_0x1c7d('0x92')]||_0x1c7d('0x84'))['then'](function(_0x488ba5){_0x3e42bf(null,_0x488ba5);})[_0x1c7d('0x14')](function(_0x335a3d){_0x3e42bf(_0x335a3d);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x93')]=function(_0x4016ba,_0x5673f0,_0x3312b7){scripts[_0x1c7d('0x93')](_0x5673f0,_0x4016ba[_0x1c7d('0x94')],_0x4016ba[_0x1c7d('0x95')],_0x4016ba[_0x1c7d('0x96')])[_0x1c7d('0x13')](function(_0x2fb331){_0x3312b7(null,_0x2fb331);})[_0x1c7d('0x14')](function(_0x541c7e){_0x3312b7(_0x541c7e);});};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x97')]=function(_0x5908ad){var _0x446c2e=_[_0x1c7d('0x98')](verticesWithRetry,_0x5908ad[_0x1c7d('0x99')])?_0x5908ad:_['clone'](_0x5908ad);for(var _0x5f0612 in _0x446c2e){if(_0x446c2e['hasOwnProperty'](_0x5f0612)){if(_0x446c2e[_0x5f0612]&&_[_0x1c7d('0x9a')](_0x446c2e[_0x5f0612])){if(_[_0x1c7d('0x98')](recursiveMapAttributes,_0x5f0612)){_0x446c2e[_0x5f0612]=this['replaceObjectAllVariables'](_0x446c2e[_0x5f0612]);}else{_0x446c2e[_0x5f0612]=this[_0x1c7d('0x9b')](_0x446c2e[_0x5f0612]);}}}}return _0x446c2e;};AGIVertices[_0x1c7d('0x10')]['recursiveNodeIndex']=function(_0x2e0a1c){for(var _0x29adfb in _0x2e0a1c){if(_0x2e0a1c[_0x1c7d('0x9c')](_0x29adfb)){if(_[_0x1c7d('0x9d')](_0x2e0a1c[_0x29adfb])){this[_0x1c7d('0x9e')](_0x2e0a1c[_0x29adfb]);}else if(_[_0x1c7d('0x9f')](_0x2e0a1c[_0x29adfb])){for(var _0x1ee4d0=0x0;_0x1ee4d0<_0x2e0a1c[_0x29adfb][_0x1c7d('0xa0')];_0x1ee4d0++){this[_0x1c7d('0x9e')](_0x2e0a1c[_0x29adfb][_0x1ee4d0]);}}else if(_['isString'](_0x2e0a1c[_0x29adfb])){_0x2e0a1c[_0x29adfb]=this[_0x1c7d('0x9b')](_0x2e0a1c[_0x29adfb]);}}}};AGIVertices[_0x1c7d('0x10')]['saveRestApiResult']=function(_0x44f95a,_0x448bff){for(var _0x3e842e in _0x44f95a){if(_0x44f95a[_0x1c7d('0x9c')](_0x3e842e)){if(_[_0x1c7d('0x9d')](_0x44f95a[_0x3e842e])){if(!_[_0x1c7d('0x42')](_0x44f95a[_0x3e842e])){this[_0x1c7d('0xa1')](_0x44f95a[_0x3e842e],util[_0x1c7d('0x55')](_0x1c7d('0xa2'),_0x448bff,_0x3e842e));}}else if(_[_0x1c7d('0x9f')](_0x44f95a[_0x3e842e])){for(var _0x4a1a92=0x0;_0x4a1a92<_0x44f95a[_0x3e842e][_0x1c7d('0xa0')];_0x4a1a92++){this['saveRestApiResult'](_0x44f95a[_0x3e842e][_0x4a1a92],util['format'](_0x1c7d('0xa2'),_0x448bff,_0x3e842e+'['+_0x4a1a92+']'));}}else{if(!_[_0x1c7d('0x43')](_0x44f95a[_0x3e842e])){this['channel'][_0x1c7d('0xa3')](util[_0x1c7d('0x55')](_0x1c7d('0xa2'),_0x448bff,_0x3e842e),_0x44f95a[_0x3e842e]);}}}}};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xa4')]=function(_0x4abdf7){try{var _0x16fc7b=JSON[_0x1c7d('0x6e')](_0x4abdf7);this[_0x1c7d('0x9e')](_0x16fc7b);return JSON['stringify'](_0x16fc7b);}catch(_0x2d5c19){return this['replaceAllVariables'](_0x4abdf7);}};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x9b')]=function(_0x557ab4){var _0x347a93=_0x557ab4[_0x1c7d('0xa5')]('{');for(var _0xc23ff8=0x1;_0xc23ff8<_0x347a93[_0x1c7d('0xa0')];_0xc23ff8+=0x1){var _0x3ff0d8=_0x347a93[_0xc23ff8][_0x1c7d('0xa5')]('}');if(_0x3ff0d8[_0x1c7d('0xa0')]>0x1){_0x557ab4=_0x557ab4[_0x1c7d('0xa6')]('{'+_0x3ff0d8[0x0]+'}',this[_0x1c7d('0xd')][_0x1c7d('0x11')](_0x3ff0d8[0x0])[_0x1c7d('0xa7')]||_0x3ff0d8[0x0]);}}if(_0x347a93[_0x1c7d('0xa0')]===0x1){return _0x557ab4[_0x1c7d('0xa8')]();}return this[_0x1c7d('0x9b')](_0x557ab4);};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xa9')]=function(_0x44e508,_0x59b615){var _0x3f2187=this['channel'][_0x1c7d('0x11')](_0x44e508);if(_0x3f2187[_0x1c7d('0xaa')]===-0x1){return _0x3f2187;}logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x59b615,_0x3f2187[_0x1c7d('0xa7')]));return this['channel'][_0x1c7d('0xa3')](_0x59b615,_0x3f2187['extra']);};AGIVertices[_0x1c7d('0x10')]['isConfigured']=function(_0x12f9a3){return _0x12f9a3&&_0x12f9a3!=='0'&&_0x12f9a3!=='-1'&&_0x12f9a3!=='';};AGIVertices[_0x1c7d('0x10')]['maxRetry']=function(_0x55c6ff){this[_0x1c7d('0x34')]['sync'](this,_0x55c6ff,'-');_0x55c6ff[_0x1c7d('0xab')]=_0x55c6ff[_0x1c7d('0xac')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x1c7d('0xad')]=function(_0x49fc24){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0xae'),_0x49fc24[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x49fc24[_0x1c7d('0x5e')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xb1'));}var _0x46316a='\x22'+_0x49fc24['text']+'\x22';if(this['isConfigured'](_0x49fc24[_0x1c7d('0x7b')])){_0x46316a+=','+_0x49fc24[_0x1c7d('0x7b')];}var _0x102766=this[_0x1c7d('0xd')][_0x1c7d('0x59')](_0x1c7d('0xb2'),_0x46316a);if(_0x102766['result']===-0x1){return _0x102766;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0xb3'),_0x46316a));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xb4')]=function(_0x59e64f){logger['info'](util['format'](_0x1c7d('0xb5'),_0x59e64f['label']));if(!this['isConfigured'](_0x59e64f[_0x1c7d('0xb6')])){return this[_0x1c7d('0xd')]['noop'](_0x1c7d('0xb7'));}var _0x32314c=_0x59e64f[_0x1c7d('0xb6')];if(this[_0x1c7d('0xaf')](_0x59e64f[_0x1c7d('0x7b')])){_0x32314c+=','+_0x59e64f[_0x1c7d('0x7b')];}var _0x4885d7=this[_0x1c7d('0xd')][_0x1c7d('0x59')]('MRCPRecog',_0x32314c);if(_0x4885d7[_0x1c7d('0xaa')]===-0x1){return _0x4885d7;}var _0x46288e=this[_0x1c7d('0xa9')](_0x1c7d('0xb8'),_0x1c7d('0xb9'));if(_0x46288e['result']===-0x1){return _0x46288e;}var _0x424e9b=this['getAndSetVariable'](_0x1c7d('0xba'),'MRCP_RECOG_TRANSCRIPT');if(_0x424e9b[_0x1c7d('0xaa')]===-0x1){return _0x424e9b;}var _0x3114ff=this[_0x1c7d('0xa9')](_0x1c7d('0xbb'),_0x1c7d('0xbc'));if(_0x3114ff[_0x1c7d('0xaa')]===-0x1){return _0x3114ff;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('Executed\x20command\x20MRCPRecog\x20%s',_0x32314c));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x7')]=function(_0x590fe3){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0xbd'),_0x590fe3[_0x1c7d('0x36')]));return this[_0x1c7d('0xd')][_0x1c7d('0x7')]([_0x590fe3[_0x1c7d('0xbe')],_0x590fe3[_0x1c7d('0xbf')]]);};AGIVertices['prototype'][_0x1c7d('0xc0')]=function(_0x27357a){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0xc1'),_0x27357a[_0x1c7d('0x36')]));if(this[_0x1c7d('0xaf')](_0x27357a[_0x1c7d('0x6a')])){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0xc2'),_0x27357a[_0x1c7d('0x6a')]));var _0x42f4a8=this['channel']['wait'](_0x27357a[_0x1c7d('0x6a')]);if(_0x42f4a8[_0x1c7d('0xaa')]===-0x1){return _0x42f4a8;}}return this[_0x1c7d('0xd')][_0x1c7d('0xc0')]();};AGIVertices['prototype'][_0x1c7d('0x4a')]=function(_0x520f0f){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0xc3'),_0x520f0f[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x520f0f['list_id'])){return this['channel'][_0x1c7d('0x29')](_0x520f0f,_0x1c7d('0xc4'));}_0x520f0f[_0x1c7d('0x49')]=moment();if(this[_0x1c7d('0xaf')](_0x520f0f['delay'])){_0x520f0f[_0x1c7d('0x49')]=moment()[_0x1c7d('0xc5')](_0x520f0f[_0x1c7d('0xc6')],_0x1c7d('0xc7'));}if(!this['isConfigured'](_0x520f0f['callback_priority'])){_0x520f0f['callback_priority']=0x2;}this[_0x1c7d('0x41')]['sync'](this,_0x520f0f);return this[_0x1c7d('0xd')]['noop'](util[_0x1c7d('0x55')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x520f0f[_0x1c7d('0x47')],_0x520f0f['list_id'],_0x520f0f[_0x1c7d('0x49')]));};AGIVertices[_0x1c7d('0x10')]['custom_app']=function(_0x1dda6e){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0xc8'),_0x1dda6e[_0x1c7d('0x36')]));var _0x238505=this[_0x1c7d('0xd')]['exec'](_0x1dda6e[_0x1c7d('0xc9')],_0x1dda6e['options']);if(_0x238505[_0x1c7d('0xaa')]===-0x1){return _0x238505;}return this['channel'][_0x1c7d('0xb0')](util['format'](_0x1c7d('0xca'),_0x1dda6e[_0x1c7d('0xc9')],_0x1dda6e[_0x1c7d('0x7b')]));};AGIVertices['prototype']['lumenvoxtts']=function(_0x21c4c3){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x21c4c3[_0x1c7d('0x36')]));if(!this['isConfigured'](_0x21c4c3['text'])){return this[_0x1c7d('0xd')]['noop'](_0x1c7d('0xb1'));}var _0x20dd8a='\x22'+_0x21c4c3['text']+'\x22';if(this['isConfigured'](_0x21c4c3['options'])){_0x20dd8a+=','+_0x21c4c3[_0x1c7d('0x7b')];}var _0x1d723a=this['channel']['exec'](_0x1c7d('0xb2'),_0x20dd8a);if(_0x1d723a[_0x1c7d('0xaa')]===-0x1){return _0x1d723a;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xb3'),_0x20dd8a));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xcb')]=function(_0x6827cd){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0xcc'),_0x6827cd[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x6827cd[_0x1c7d('0x5e')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xb1'));}var _0x3752f3='\x22'+_0x6827cd[_0x1c7d('0x5e')]+'\x22';if(this[_0x1c7d('0xaf')](_0x6827cd[_0x1c7d('0x7b')])){_0x3752f3+=','+_0x6827cd[_0x1c7d('0x7b')];}var _0x2ed872=this[_0x1c7d('0xd')][_0x1c7d('0x59')](_0x1c7d('0xb2'),_0x3752f3);if(_0x2ed872[_0x1c7d('0xaa')]===-0x1){return _0x2ed872;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xb3'),_0x3752f3));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xcd')]=function(_0x5dacd1){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0xce'),_0x5dacd1[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x5dacd1[_0x1c7d('0xb6')])){return this['channel'][_0x1c7d('0xb0')](_0x1c7d('0xb7'));}var _0x165544=_0x5dacd1['grammar'];if(this[_0x1c7d('0xaf')](_0x5dacd1[_0x1c7d('0x7b')])){_0x165544+=','+_0x5dacd1[_0x1c7d('0x7b')];}var _0x32aa95=this['channel'][_0x1c7d('0x59')](_0x1c7d('0xcf'),_0x165544);if(_0x32aa95[_0x1c7d('0xaa')]===-0x1){return _0x32aa95;}var _0x2654e6=this[_0x1c7d('0xa9')](_0x1c7d('0xb8'),_0x1c7d('0xd0'));if(_0x2654e6['result']===-0x1){return _0x2654e6;}var _0x1b2176=this[_0x1c7d('0xa9')]('RECOG_INPUT()',_0x1c7d('0xd1'));if(_0x1b2176['result']===-0x1){return _0x1b2176;}var _0x315a9d=this['getAndSetVariable'](_0x1c7d('0xbb'),'LUMENVOX_ASR_INSTANCE');if(_0x315a9d['result']===-0x1){return _0x315a9d;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xd2'),_0x165544));};AGIVertices['prototype'][_0x1c7d('0xd3')]=function(_0x13a97d){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0xd4'),_0x13a97d[_0x1c7d('0x36')]));if(!this['isConfigured'](_0x13a97d[_0x1c7d('0xb6')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xb7'));}var _0x2c4ec5=_0x13a97d[_0x1c7d('0xb6')];if(this['isConfigured'](_0x13a97d[_0x1c7d('0x7b')])){_0x2c4ec5+=','+_0x13a97d['options'];}var _0x207d26=this[_0x1c7d('0xd')][_0x1c7d('0x59')](_0x1c7d('0xcf'),_0x2c4ec5);if(_0x207d26[_0x1c7d('0xaa')]===-0x1){return _0x207d26;}var _0x2a1db5=this[_0x1c7d('0xa9')](_0x1c7d('0xb8'),_0x1c7d('0xd5'));if(_0x2a1db5[_0x1c7d('0xaa')]===-0x1){return _0x2a1db5;}var _0x5191ac=this['getAndSetVariable'](_0x1c7d('0xba'),'SESTEK_ASR_TRANSCRIPT');if(_0x5191ac[_0x1c7d('0xaa')]===-0x1){return _0x5191ac;}var _0x277abf=this[_0x1c7d('0xa9')](_0x1c7d('0xbb'),'SESTEK_ASR_INSTANCE');if(_0x277abf[_0x1c7d('0xaa')]===-0x1){return _0x277abf;}return this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xd2'),_0x2c4ec5));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xd6')]=function(_0x38939a){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x38939a[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x38939a[_0x1c7d('0xd7')])){return this['channel']['error'](_0x38939a,_0x1c7d('0xd8'));}var _0x76b8fe=this[_0x1c7d('0xd9')][_0x1c7d('0x73')](this,_0x38939a[_0x1c7d('0xd7')]);if(!_0x76b8fe){return this['channel'][_0x1c7d('0x29')](_0x38939a,_0x1c7d('0xda'));}if(!this[_0x1c7d('0xaf')](_0x38939a[_0x1c7d('0x2d')])){return this['channel'][_0x1c7d('0x29')](_0x38939a,_0x1c7d('0xdb'));}var _0x4094f4=_0x38939a['query'][_0x1c7d('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0x1c7d('0xd')]['noop'](util[_0x1c7d('0x55')]('query:\x20%s',_0x4094f4));var _0x1c6ad0=this[_0x1c7d('0x28')][_0x1c7d('0x73')](this,_0x76b8fe,_0x4094f4);this['createSquareDetailsReport']['sync'](this,_0x38939a,_0x4094f4);if(!this[_0x1c7d('0xaf')](_0x38939a[_0x1c7d('0xdc')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x376d92=this['getVariable']['sync'](this,_0x38939a[_0x1c7d('0xdc')]);if(!_0x376d92){return this['channel']['error'](_0x38939a,_0x1c7d('0xdd'));}var _0x1e36af=this;_0x1c6ad0[_0x1c7d('0xde')](function(_0x22ce7a,_0x1add2e){Object[_0x1c7d('0xdf')](_0x22ce7a)[_0x1c7d('0xde')](function(_0x15d98a){_0x1e36af['channel'][_0x1c7d('0xa3')](util['format'](_0x1c7d('0xe0'),_0x376d92,_0x1add2e,_0x15d98a),_0x22ce7a[_0x15d98a]);});});this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util['format']('%s_ROWS_COUNT',_0x376d92),_0x1c6ad0['length']);return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('variable\x20%s\x20set',_0x376d92));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xe1')]=function(_0x1a4888){logger['debug'](util[_0x1c7d('0x55')](_0x1c7d('0xe2'),_0x1a4888[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x1a4888[_0x1c7d('0xe3')])){return this['channel']['error'](_0x1a4888,_0x1c7d('0xe4'));}var _0x4b02e9=this[_0x1c7d('0xe5')][_0x1c7d('0x73')](this,_0x1a4888[_0x1c7d('0xe3')]);if(!_0x4b02e9){return this[_0x1c7d('0xd')]['error'](_0x1a4888,'no\x20user\x20found');}var _0x181266=this[_0x1c7d('0xd')][_0x1c7d('0x59')](_0x1c7d('0xe6'),[util[_0x1c7d('0x55')](_0x1c7d('0xe7'),_0x4b02e9),_0x1a4888['timeout'],_0x1a4888['opts'],_0x1a4888[_0x1c7d('0x67')]]);if(_0x181266[_0x1c7d('0xaa')]===-0x1){return _0x181266;}return this[_0x1c7d('0xd')]['noop'](util[_0x1c7d('0x55')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0x1c7d('0xe8')]=function(_0x2caee8){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0xe9'),_0x2caee8[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x2caee8['key'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xea'));}if(!this['isConfigured'](_0x2caee8[_0x1c7d('0x5e')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('no\x20text\x20configured');}this[_0x1c7d('0xd')][_0x1c7d('0xeb')]=!![];this[_0x1c7d('0x34')](_0x2caee8);this['createSquareMessage'](_0x2caee8[_0x1c7d('0x5e')],'in','','');this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xec'),_0x2caee8['text']));var _0x502bea=this['googleDialogflow'][_0x1c7d('0x73')](this,_0x2caee8);if(_0x502bea){for(var _0x3ef218 in _0x502bea){if(_0x502bea[_0x1c7d('0x9c')](_0x3ef218)){this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util[_0x1c7d('0x55')](_0x1c7d('0xed'),_0x3ef218[_0x1c7d('0x6c')]()),_0x502bea[_0x3ef218]);}}this[_0x1c7d('0x40')](_0x502bea[_0x1c7d('0xee')],'out',_0x1c7d('0xe8'),'');return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xef'),_0x502bea['speech']));}return this[_0x1c7d('0xd')]['error'](_0x2caee8,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xf0')]=function(_0x42845f){logger['info'](util['format'](_0x1c7d('0xf1'),_0x42845f[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x42845f[_0x1c7d('0x7e')])){return this['channel'][_0x1c7d('0xb0')](_0x1c7d('0xf2'));}if(!this[_0x1c7d('0xaf')](_0x42845f[_0x1c7d('0x7f')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xf3'));}if(!this[_0x1c7d('0xaf')](_0x42845f[_0x1c7d('0xf4')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('no\x20private_key\x20configured');}if(!this[_0x1c7d('0xaf')](_0x42845f['dialogflowV2_language'])){return this['channel'][_0x1c7d('0xb0')](_0x1c7d('0xf5'));}if(!this[_0x1c7d('0xaf')](_0x42845f['text'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('no\x20text\x20configured');}this[_0x1c7d('0xd')][_0x1c7d('0xeb')]=!![];this[_0x1c7d('0x34')](_0x42845f);this[_0x1c7d('0x40')](_0x42845f[_0x1c7d('0x5e')],'in','','');this[_0x1c7d('0xd')]['noop'](util['format']('Trying\x20DialogflowV2:\x20%s',_0x42845f[_0x1c7d('0x5e')]));var _0x87103d=this[_0x1c7d('0xf6')]['sync'](this,_0x42845f);if(_0x87103d){for(var _0x242001 in _0x87103d){if(_0x87103d[_0x1c7d('0x9c')](_0x242001)){if(_0x242001!==_0x1c7d('0xf7')){this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util['format']('DIALOGFLOW_%s',_0x242001[_0x1c7d('0x6c')]()),_0x87103d[_0x242001]);}}}this['createSquareMessage'](_0x87103d[_0x1c7d('0xee')],_0x1c7d('0xf8'),_0x1c7d('0xf0'),_0x87103d[_0x1c7d('0xf7')]);return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xf9'),_0x87103d[_0x1c7d('0xee')]));}return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x42845f,_0x1c7d('0xfa'));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0xfb')]=function(_0x4739e8){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0xfc'),_0x4739e8['label']));if(!this[_0x1c7d('0xaf')](_0x4739e8[_0x1c7d('0xfd')])){return this['channel'][_0x1c7d('0xb0')](_0x1c7d('0xfe'));}if(!this[_0x1c7d('0xaf')](_0x4739e8[_0x1c7d('0xff')])){return this['channel'][_0x1c7d('0xb0')]('no\x20username\x20configured');}if(!this[_0x1c7d('0xaf')](_0x4739e8['password'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x100'));}if(!this[_0x1c7d('0xaf')](_0x4739e8['ndassistant_url'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xb1'));}this[_0x1c7d('0xd')]['bot']=!![];this[_0x1c7d('0x34')](_0x4739e8);this[_0x1c7d('0x40')](_0x4739e8[_0x1c7d('0x5e')],'in','','');this['channel']['noop'](util[_0x1c7d('0x55')](_0x1c7d('0x101'),_0x4739e8[_0x1c7d('0x5e')]));var _0x5a00f9=this[_0x1c7d('0x102')]['sync'](this,_0x4739e8);if(_0x5a00f9){for(var _0x41a881 in _0x5a00f9){if(_0x5a00f9[_0x1c7d('0x9c')](_0x41a881)){this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util[_0x1c7d('0x55')](_0x1c7d('0x103'),_0x41a881[_0x1c7d('0x6c')]()),_0x5a00f9[_0x41a881]);}}this[_0x1c7d('0x40')](_0x5a00f9[_0x1c7d('0xee')],_0x1c7d('0xf8'),'sesteknda','');if(_0x5a00f9['audiofile']){this[_0x1c7d('0xd')]['noop'](util[_0x1c7d('0x55')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x5a00f9[_0x1c7d('0x104')]));var _0x24141b=this[_0x1c7d('0xd')][_0x1c7d('0x105')](_0x5a00f9[_0x1c7d('0x104')]);try{fs[_0x1c7d('0x106')](_0x5a00f9[_0x1c7d('0x104')]+_0x1c7d('0x107'));}catch(_0x35848b){logger[_0x1c7d('0x29')](_0x35848b);}return _0x24141b;}else{return this['channel'][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x108'),_0x5a00f9['speech']));}}return this['channel']['error'](_0x4739e8,_0x1c7d('0x109'));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x10a')]=function(_0x51862f){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x10b'),_0x51862f[_0x1c7d('0x36')]));return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x10a'));};AGIVertices['prototype']['ext_dial']=function(_0x397b01){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x10c'),_0x397b01[_0x1c7d('0x36')]));var _0x1d06db='';if(_0x397b01['trunk_id']){if(!this['isConfigured'](_0x397b01[_0x1c7d('0x10d')])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x397b01,_0x1c7d('0x10e'));}else{var _0x5ea294=parseInt(_0x397b01['trunk_id'],0xa);if(isNaN(_0x5ea294)){_0x1d06db=_0x397b01[_0x1c7d('0x10d')];}else{_0x1d06db=this[_0x1c7d('0x1b')]['sync'](this,_0x397b01[_0x1c7d('0x10d')]);if(!_0x1d06db){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x397b01,'no\x20trunk\x20found');}}}}else if(_0x397b01[_0x1c7d('0x10f')]){_0x1d06db=_0x397b01[_0x1c7d('0x10f')];}else{return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x397b01,_0x1c7d('0x10e'));}var _0x249961=this[_0x1c7d('0xd')][_0x1c7d('0x59')](_0x1c7d('0xe6'),[util[_0x1c7d('0x55')]('SIP/%s/%s',_0x1d06db,_0x397b01[_0x1c7d('0x47')]),_0x397b01[_0x1c7d('0x6a')],_0x397b01[_0x1c7d('0x110')],_0x397b01[_0x1c7d('0x67')]]);if(_0x249961[_0x1c7d('0xaa')]===-0x1){return _0x249961;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format']('Executed\x20command\x20%s',_0x1c7d('0xe6')));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x111')]=function(_0x3ff573){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x112'),_0x3ff573['label']));return this[_0x1c7d('0xd')]['noop'](_0x1c7d('0x111'));};AGIVertices[_0x1c7d('0x10')]['getdigits']=function(_0x141759){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x113'),_0x141759['label']));if(_0x141759[_0x1c7d('0xab')]===0x0){return this[_0x1c7d('0xac')](_0x141759);}_0x141759['retry']-=0x1;if(!this[_0x1c7d('0xaf')](_0x141759[_0x1c7d('0x114')])){return this[_0x1c7d('0xd')]['error'](_0x141759,_0x1c7d('0x115'));}var _0x3fb84c=this[_0x1c7d('0x1c')]['sync'](this,_0x141759['file_id']);if(!_0x3fb84c){return this[_0x1c7d('0xd')]['error'](_0x141759,'no\x20file\x20audio\x20found');}if(!this[_0x1c7d('0xaf')](_0x141759[_0x1c7d('0xdc')])){return this['channel'][_0x1c7d('0x29')](_0x1c7d('0x116'));}var _0x2a932d=this[_0x1c7d('0xd')]['getData'](_0x3fb84c,_0x141759[_0x1c7d('0x117')],_0x141759[_0x1c7d('0x118')]);var _0x4c12fd=_0x2a932d[_0x1c7d('0xaa')]?_0x2a932d[_0x1c7d('0xaa')][_0x1c7d('0xa8')]():'';logger[_0x1c7d('0x2b')](_0x1c7d('0x119'),JSON['stringify'](_0x2a932d));if(_0x2a932d['result']===-0x1){this[_0x1c7d('0x34')]['sync'](this,_0x141759,_0x4c12fd);return _0x2a932d;}else if(_0x2a932d[_0x1c7d('0xa7')]===_0x1c7d('0x6a')){_0x2a932d[_0x1c7d('0xaa')]=_0x4c12fd[_0x1c7d('0xa0')]>=parseInt(_0x141759[_0x1c7d('0x11a')])?'x':'i';}else{_0x2a932d['result']=_0x4c12fd['length']>=parseInt(_0x141759[_0x1c7d('0x11a')])&&_0x4c12fd[_0x1c7d('0xa0')]<=parseInt(_0x141759[_0x1c7d('0x118')])?'x':'i';}var _0x56ebe9=this[_0x1c7d('0x11')][_0x1c7d('0x73')](this,_0x141759['variable_id']);if(!_0x56ebe9){return this['channel'][_0x1c7d('0x29')](_0x141759,_0x1c7d('0xdd'));}this[_0x1c7d('0xd')][_0x1c7d('0xa3')](_0x56ebe9,_0x4c12fd);if(this[_0x1c7d('0xaf')](_0x141759[_0x1c7d('0x11b')])){var _0x597398=parseInt(_0x141759[_0x1c7d('0x11b')],0xa);var _0x3cb166=rs['generate']({'charset':'*','length':_0x597398});var _0x3e8fea=_0x4c12fd[_0x1c7d('0xa0')];if(_0x3e8fea>0x0){if(_0x3e8fea>_0x597398){this['createSquareDetailsReport'][_0x1c7d('0x73')](this,_0x141759,_0x141759[_0x1c7d('0x11c')]===_0x1c7d('0x11d')?_0x3cb166+_0x4c12fd[_0x1c7d('0x11e')](_0x597398):_0x4c12fd['substr'](0x0,_0x3e8fea-_0x597398)+_0x3cb166);}else{this[_0x1c7d('0x34')][_0x1c7d('0x73')](this,_0x141759,rs[_0x1c7d('0x11f')]({'charset':'*','length':_0x3e8fea}));}}else{this['createSquareDetailsReport']['sync'](this,_0x141759,'');}}else{this[_0x1c7d('0x34')]['sync'](this,_0x141759,_0x4c12fd);}return _0x2a932d;};AGIVertices['prototype'][_0x1c7d('0xc')]=function(_0x1cf8a2){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x120'),_0x1cf8a2[_0x1c7d('0x36')]));return this[_0x1c7d('0xb')](_0x1cf8a2);};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x121')]=function(_0x47f327){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x47f327[_0x1c7d('0x36')]));this[_0x1c7d('0x34')]['sync'](this,_0x47f327,_0x47f327[_0x1c7d('0x122')]);return this['channel']['noop'](util['format'](_0x1c7d('0x123'),_0x47f327[_0x1c7d('0x122')]));};AGIVertices['prototype'][_0x1c7d('0x124')]=function(_0x4dcddc){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x125'),_0x4dcddc['label']));if(!this['isConfigured'](_0x4dcddc[_0x1c7d('0x89')])||!this[_0x1c7d('0xaf')](_0x4dcddc['aws_secret_access_key'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x126'));}if(!this['isConfigured'](_0x4dcddc[_0x1c7d('0x5e')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('no\x20text\x20configured');}this['channel'][_0x1c7d('0xb0')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x4dcddc[_0x1c7d('0x5e')]));var _0x442d4e=this[_0x1c7d('0x88')][_0x1c7d('0x73')](this,_0x4dcddc);if(_0x442d4e){this[_0x1c7d('0xd')]['noop'](util[_0x1c7d('0x55')](_0x1c7d('0x127'),_0x442d4e));var _0x109002=this['channel'][_0x1c7d('0x105')](_0x442d4e);try{fs[_0x1c7d('0x106')](_0x442d4e+_0x1c7d('0x107'));}catch(_0x10d9b7){logger[_0x1c7d('0x29')](_0x10d9b7);}return _0x109002;}return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x4dcddc,_0x1c7d('0x128'));};AGIVertices['prototype']['awslex']=function(_0x28d423){logger[_0x1c7d('0x2b')](util['format']('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x28d423['label']));if(!this['isConfigured'](_0x28d423['aws_access_key_id'])||!this[_0x1c7d('0xaf')](_0x28d423[_0x1c7d('0x8a')])){return this['channel'][_0x1c7d('0xb0')](_0x1c7d('0x126'));}if(!this['isConfigured'](_0x28d423['aws_bot_name'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('no\x20bot\x20name\x20configured');}if(!this['isConfigured'](_0x28d423[_0x1c7d('0x5e')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xb1'));}this[_0x1c7d('0xd')][_0x1c7d('0xeb')]=!![];this[_0x1c7d('0x34')](_0x28d423);this[_0x1c7d('0x40')](_0x28d423[_0x1c7d('0x5e')],'in','','');this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x129'),_0x28d423[_0x1c7d('0x5e')]));var _0x5ce573=this['awsLex'][_0x1c7d('0x73')](this,_0x28d423);if(_0x5ce573){for(var _0xfe1848 in _0x5ce573){if(_0x5ce573[_0x1c7d('0x9c')](_0xfe1848)&&_[_0x1c7d('0x9a')](_0x5ce573[_0xfe1848])){this[_0x1c7d('0xd')]['setVariable'](util[_0x1c7d('0x55')](_0x1c7d('0x12a'),_0xfe1848['toUpperCase']()),_0x5ce573[_0xfe1848]);}}if(_['isNil'](_0x5ce573[_0x1c7d('0x79')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x1c7d('0x40')](_0x5ce573[_0x1c7d('0x79')],_0x1c7d('0xf8'),_0x1c7d('0x12b'),'');return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x12c'),_0x5ce573[_0x1c7d('0x79')]));}}return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x28d423,_0x1c7d('0x12d'));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x12e')]=function(_0x2e8513){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x12f'),_0x2e8513[_0x1c7d('0x36')],_0x2e8513['timeout']));if(!this[_0x1c7d('0xaf')](_0x2e8513[_0x1c7d('0x82')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xea'));}var _0x46f337=_0x1c7d('0x130');var _0x1531f1=util[_0x1c7d('0x55')](_0x1c7d('0x131'),FILES_PATH,rs[_0x1c7d('0x11f')](0x4));var _0x306a8c=util[_0x1c7d('0x55')](_0x1c7d('0xa2'),_0x1531f1,_0x46f337);var _0x54e2de=!![];if(_0x2e8513['beep']===_0x1c7d('0x132')){_0x54e2de=![];}var _0x462a00=this[_0x1c7d('0xd')][_0x1c7d('0x133')](_0x1531f1,_0x46f337,_0x2e8513[_0x1c7d('0x134')],_0x2e8513['timeout'],undefined,_0x54e2de);if(_0x462a00['result']!==-0x1){this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format']('google\x20%s\x20file\x20created',_0x306a8c));var _0x1060c4=this['googleASR'][_0x1c7d('0x73')](this,_0x2e8513,_0x306a8c);if(_0x1060c4){for(var _0x3d419d in _0x1060c4){if(_0x1060c4[_0x1c7d('0x9c')](_0x3d419d)){this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util[_0x1c7d('0x55')]('GOOGLE_ASR_%s',_0x3d419d['toUpperCase']()),_0x1060c4[_0x3d419d]);}}return this['channel'][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x135'),JSON[_0x1c7d('0x75')](_0x1060c4)));}}return _0x462a00;};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x136')]=function(_0x3c5f9a){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x137'),_0x3c5f9a[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x3c5f9a[_0x1c7d('0x94')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x138'));}if(!this[_0x1c7d('0xaf')](_0x3c5f9a[_0x1c7d('0x95')])){return this[_0x1c7d('0xd')]['noop']('no\x20appsecret\x20configured');}var _0x529bfd=_0x1c7d('0x130');var _0x3454d3=util[_0x1c7d('0x55')](_0x1c7d('0x131'),FILES_PATH,rs[_0x1c7d('0x11f')](0x4));var _0x160683=util[_0x1c7d('0x55')](_0x1c7d('0xa2'),_0x3454d3,_0x529bfd);var _0x2360e7=!![];if(_0x3c5f9a[_0x1c7d('0x139')]===_0x1c7d('0x132')){_0x2360e7=![];}var _0x5bbabf=this[_0x1c7d('0xd')][_0x1c7d('0x133')](_0x3454d3,_0x529bfd,_0x3c5f9a[_0x1c7d('0x134')],_0x3c5f9a[_0x1c7d('0x6a')],undefined,_0x2360e7);if(_0x5bbabf[_0x1c7d('0xaa')]!==-0x1){this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x13a'),_0x160683));var _0x23e379=this['tildeASR'][_0x1c7d('0x73')](this,_0x3c5f9a,_0x160683);if(_0x23e379){for(var _0x335220 in _0x23e379){if(_0x23e379[_0x1c7d('0x9c')](_0x335220)){this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util[_0x1c7d('0x55')]('TILDE_ASR_%s',_0x335220['toUpperCase']()),_0x23e379[_0x335220]);}}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x13b'),JSON[_0x1c7d('0x75')](_0x23e379)));}}return _0x5bbabf;};AGIVertices['prototype'][_0x1c7d('0x13c')]=function(_0x411793){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x13d'),_0x411793[_0x1c7d('0x36')]));return this['channel'][_0x1c7d('0x13e')](_0x411793[_0x1c7d('0x3b')],_0x411793[_0x1c7d('0x13f')],_0x411793[_0x1c7d('0x3c')]);};AGIVertices[_0x1c7d('0x10')]['gotoif']=function(_0x3212c8){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x140'),_0x3212c8[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x3212c8[_0x1c7d('0x141')])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x3212c8,_0x1c7d('0x142'));}try{var _0x21a25a=eval(_0x3212c8['condition'])?_0x1c7d('0x143'):_0x1c7d('0x144');this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('EVAL\x20CONDITION\x20%s\x20%s',_0x3212c8[_0x1c7d('0x141')],_0x21a25a));return{'code':0xc8,'result':_0x21a25a};}catch(_0x4bb51f){return{'code':0xc8,'result':_0x1c7d('0x144')};}};AGIVertices[_0x1c7d('0x10')]['gotoiftime']=function(_0x1b48f0){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x145'),_0x1b48f0[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x1b48f0[_0x1c7d('0x146')])){return this[_0x1c7d('0xd')]['error'](_0x1b48f0,_0x1c7d('0x147'));}var _0x99223d=this[_0x1c7d('0x23')][_0x1c7d('0x73')](this,_0x1b48f0[_0x1c7d('0x146')]);if(!_0x99223d){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x1b48f0,_0x1c7d('0x148'));}for(var _0x3c59ae=0x0;_0x3c59ae<_0x99223d[_0x1c7d('0xa0')];_0x3c59ae+=0x1){var _0x5d37c9=this[_0x1c7d('0xd')]['getVariable'](util[_0x1c7d('0x55')]('IFTIME(%s?true:false)',_0x99223d[_0x3c59ae]));if(_0x5d37c9[_0x1c7d('0xaa')]===-0x1){return _0x5d37c9;}logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x149'),_0x99223d[_0x3c59ae],_0x5d37c9['extra']));if(_0x5d37c9[_0x1c7d('0xa7')]===_0x1c7d('0x143')){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x149'),_0x99223d[_0x3c59ae],_0x1c7d('0x143')));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x149'),_0x99223d[_0x3c59ae],_0x1c7d('0x143')));return{'code':0xc8,'result':_0x1c7d('0x143')};}else{logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('IFTIME\x20%s\x20%s',_0x99223d[_0x3c59ae],_0x1c7d('0x144')));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x149'),_0x99223d[_0x3c59ae],_0x1c7d('0x144')));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x14a')]=function(_0x299f50){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x14b'),_0x299f50[_0x1c7d('0x36')]));return this['channel'][_0x1c7d('0x14a')]();};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x14c')]=function(_0x4e248d){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x14d'),_0x4e248d[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x4e248d[_0x1c7d('0x82')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xea'));}var _0xa30270=_0x1c7d('0x130');var _0x35373b=util['format'](_0x1c7d('0x131'),FILES_PATH,rs[_0x1c7d('0x11f')](0x4));var _0xa65ba=util['format'](_0x1c7d('0xa2'),_0x35373b,_0xa30270);var _0x1816fb=!![];if(_0x4e248d[_0x1c7d('0x139')]===_0x1c7d('0x132')){_0x1816fb=![];}var _0x4c7ed2=this[_0x1c7d('0xd')][_0x1c7d('0x133')](_0x35373b,_0xa30270,_0x4e248d['intKey'],_0x4e248d[_0x1c7d('0x6a')],undefined,_0x1816fb);if(_0x4c7ed2[_0x1c7d('0xaa')]!==-0x1){this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x14e'),_0xa65ba));var _0x70c9a5=this[_0x1c7d('0x85')][_0x1c7d('0x73')](this,_0x4e248d,_0xa65ba);if(_0x70c9a5){for(var _0x137c2e in _0x70c9a5){if(_0x70c9a5[_0x1c7d('0x9c')](_0x137c2e)){this['channel']['setVariable'](util[_0x1c7d('0x55')](_0x1c7d('0x14f'),_0x137c2e[_0x1c7d('0x6c')]()),_0x70c9a5[_0x137c2e]);}}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x150'),JSON[_0x1c7d('0x75')](_0x70c9a5)));}}return _0x4c7ed2;};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x151')]=function(_0x192110){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x152'),_0x192110[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x192110[_0x1c7d('0x82')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xea'));}if(!this['isConfigured'](_0x192110['text'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('no\x20text\x20configured');}this['channel'][_0x1c7d('0xb0')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x192110[_0x1c7d('0x5e')]));var _0x1b1e91=this[_0x1c7d('0x81')][_0x1c7d('0x73')](this,_0x192110);if(_0x1b1e91){this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('ispeech\x20%s\x20file\x20created',_0x1b1e91));var _0x37bf6f=this[_0x1c7d('0xd')]['streamFile'](_0x1b1e91,_0x192110[_0x1c7d('0x134')]);try{fs[_0x1c7d('0x106')](_0x1b1e91+_0x1c7d('0x107'));}catch(_0x310513){logger[_0x1c7d('0x29')](_0x310513);}return _0x37bf6f;}return this[_0x1c7d('0xd')]['error'](_0x192110,_0x1c7d('0x153'));};AGIVertices['prototype']['login']=function(_0x48fce8){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x154'),_0x48fce8[_0x1c7d('0x36')]));if(!this['isConfigured'](_0x48fce8[_0x1c7d('0x155')])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x48fce8,_0x1c7d('0x156'));}logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x157'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x48fce8[_0x1c7d('0x155')]));var _0x5b66a3=this['agentLogin'][_0x1c7d('0x73')](this,_0x48fce8['findBy']);if(_0x5b66a3){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x158'),this['channel'][_0x1c7d('0x38')],_0x48fce8[_0x1c7d('0x155')]));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x158'),this[_0x1c7d('0xd')]['callerid'],_0x48fce8['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x1c7d('0x38')],_0x48fce8[_0x1c7d('0x155')]));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x159'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x48fce8[_0x1c7d('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x1c7d('0x10')]['logout']=function(_0x12397d){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x12397d['label']));if(!this[_0x1c7d('0xaf')](_0x12397d['findBy'])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x12397d,_0x1c7d('0x156'));}logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x157'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x12397d[_0x1c7d('0x155')]));var _0x1e4a2d=this[_0x1c7d('0x52')][_0x1c7d('0x73')](this,_0x12397d[_0x1c7d('0x155')]);if(_0x1e4a2d){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x158'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x12397d[_0x1c7d('0x155')]));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x158'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x12397d[_0x1c7d('0x155')]));return{'code':0xc8,'result':_0x1c7d('0x15a')};}else{logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x159'),this['channel']['callerid'],_0x12397d[_0x1c7d('0x155')]));this['channel']['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x12397d[_0x1c7d('0x155')]));return{'code':0xc8,'result':_0x1c7d('0x15b')};}};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x15c')]=function(_0x514185){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x15d'),_0x514185[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x514185[_0x1c7d('0x15e')])){return this['channel'][_0x1c7d('0x29')](_0x514185,'no\x20operation\x20configured');}this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x15f'),_0x514185[_0x1c7d('0x15e')]));var _0x342d4a=eval(_0x514185[_0x1c7d('0x15e')]);if(!this[_0x1c7d('0xaf')](_0x514185['variable_id'])){return this['channel']['noop'](_0x1c7d('0x116'));}var _0x752502=this[_0x1c7d('0x11')]['sync'](this,_0x514185[_0x1c7d('0xdc')]);if(!_0x752502){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x514185,_0x1c7d('0xdd'));}if(_[_0x1c7d('0x9f')](_0x342d4a)){var _0x14871c=this;_0x342d4a[_0x1c7d('0xde')](function(_0x5051e2,_0x437491){_0x14871c[_0x1c7d('0xd')][_0x1c7d('0xa3')](util['format'](_0x1c7d('0x160'),_0x752502,_0x437491),_0x5051e2);});return this['channel']['noop'](util[_0x1c7d('0x55')](_0x1c7d('0x161'),_0x752502));}else{return this['channel'][_0x1c7d('0xa3')](_0x752502,_0x342d4a);}};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x162')]=function(_0xe951af){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x163'),_0xe951af[_0x1c7d('0x36')]));if(_0xe951af[_0x1c7d('0xab')]===0x0){return this[_0x1c7d('0xac')](_0xe951af);}_0xe951af['retry']-=0x1;if(!this[_0x1c7d('0xaf')](_0xe951af[_0x1c7d('0x114')])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0xe951af,'no\x20file\x20audio\x20selected');}var _0x954979=this[_0x1c7d('0x1c')][_0x1c7d('0x73')](this,_0xe951af[_0x1c7d('0x114')]);if(!_0x954979){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0xe951af,_0x1c7d('0x164'));}var _0x134bb1=this['channel'][_0x1c7d('0x165')](_0x954979,_0xe951af[_0x1c7d('0x117')],_0xe951af[_0x1c7d('0x166')]);var _0x1885ea=_0x134bb1['result'];if(_0x134bb1[_0x1c7d('0xaa')]===-0x1){this[_0x1c7d('0x34')][_0x1c7d('0x73')](this,_0xe951af,'-1');return _0x134bb1;}else if(_0x134bb1['extra']===_0x1c7d('0x6a')){_0x134bb1[_0x1c7d('0xaa')]=_0x134bb1[_0x1c7d('0xaa')]['length']>0x0?_0x134bb1[_0x1c7d('0xaa')]:'t';}else if(_['isEmpty'](_0x134bb1[_0x1c7d('0xaa')])){_0x134bb1[_0x1c7d('0xaa')]='#';_0x1885ea='#';}if(!this[_0x1c7d('0xaf')](_0xe951af[_0x1c7d('0xdc')])){this['channel'][_0x1c7d('0xb0')](_0x1c7d('0x116'));}else{var _0xfa28e5=this[_0x1c7d('0x11')][_0x1c7d('0x73')](this,_0xe951af['variable_id']);if(!_0xfa28e5){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0xe951af,'no\x20variable\x20found');}this[_0x1c7d('0xd')][_0x1c7d('0xa3')](_0xfa28e5,_0x1885ea);}this[_0x1c7d('0x34')][_0x1c7d('0x73')](this,_0xe951af,_0x1885ea);return _0x134bb1;};AGIVertices['prototype'][_0x1c7d('0xb0')]=function(_0x55f02d){logger[_0x1c7d('0x2b')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x55f02d[_0x1c7d('0x36')]));return this['channel'][_0x1c7d('0xb0')](_0x55f02d['output']||_0x55f02d[_0x1c7d('0x36')]);};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x167')]=function(_0x288e60){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x168'),_0x288e60[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x288e60[_0x1c7d('0x155')])){return this['channel'][_0x1c7d('0x29')](_0x288e60,'no\x20find\x20by\x20configured');}logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x157'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x288e60['findBy']));var _0x33722c=this['getPause'][_0x1c7d('0x73')](this,_0x288e60[_0x1c7d('0x169')]);var _0x29727e=this[_0x1c7d('0x4f')][_0x1c7d('0x73')](this,_0x288e60[_0x1c7d('0x155')],_0x33722c);if(_0x29727e){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x158'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x288e60['findBy']));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x158'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x288e60['findBy']));return{'code':0xc8,'result':_0x1c7d('0x15a')};}else{logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x159'),this['channel'][_0x1c7d('0x38')],_0x288e60[_0x1c7d('0x155')]));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x158'),this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x288e60[_0x1c7d('0x155')]));return{'code':0xc8,'result':_0x1c7d('0x15b')};}};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x16a')]=function(_0x4f7551){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x16b'),_0x4f7551[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x4f7551[_0x1c7d('0x114')])){return this['channel'][_0x1c7d('0x29')](_0x4f7551,_0x1c7d('0x115'));}var _0x5ccb94=this[_0x1c7d('0x1c')][_0x1c7d('0x73')](this,_0x4f7551[_0x1c7d('0x114')]);if(!_0x5ccb94){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x4f7551,_0x1c7d('0x164'));}var _0x2c2dd9=this['channel'][_0x1c7d('0x59')](_0x1c7d('0x16c'),[_0x5ccb94,_0x4f7551['opts']]);if(_0x2c2dd9[_0x1c7d('0xaa')]===-0x1){return _0x2c2dd9;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0xca'),_0x1c7d('0x16c'),_0x5ccb94));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x16d')]=function(_0x4e32f9){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x16e'),_0x4e32f9['label']));if(!this['isConfigured'](_0x4e32f9[_0x1c7d('0x16f')])){return this['channel'][_0x1c7d('0x29')](_0x4e32f9,'no\x20queue\x20selected');}var _0xc112ef='';var _0x2a26f5=parseInt(_0x4e32f9[_0x1c7d('0x16f')],0xa);if(isNaN(_0x2a26f5)){_0xc112ef=_0x4e32f9[_0x1c7d('0x16f')];}else{_0xc112ef=this['getVoiceQueue'][_0x1c7d('0x73')](this,_0x4e32f9[_0x1c7d('0x16f')]);if(!_0xc112ef){return this['channel'][_0x1c7d('0x29')](_0x4e32f9,_0x1c7d('0x170'));}}var _0x44b7df='';if(this[_0x1c7d('0xaf')](_0x4e32f9[_0x1c7d('0x114')])){var _0xa7d93a=this['getSound']['sync'](this,_0x4e32f9[_0x1c7d('0x114')]);if(_0xa7d93a){_0x44b7df=_0xa7d93a;}}this[_0x1c7d('0x34')]['sync'](this,_0x4e32f9,_0xc112ef);if(_0x4e32f9[_0x1c7d('0x110')][_0x1c7d('0x171')]('x')<0x0){_0x4e32f9['opts']+='x';}if(_0x4e32f9['opts']['indexOf']('X')<0x0){_0x4e32f9[_0x1c7d('0x110')]+='X';}this[_0x1c7d('0xd')]['setVariable'](_0x1c7d('0x172'),_0xc112ef?_0xc112ef[_0x1c7d('0x173')]():'');var _0x104a46=this[_0x1c7d('0xd')][_0x1c7d('0x59')]('QUEUE',[_0xc112ef,_0x4e32f9['opts'],_0x4e32f9[_0x1c7d('0x67')],_0x44b7df,_0x4e32f9['timeout'],_0x4e32f9[_0x1c7d('0x7')],_0x4e32f9['macro'],_0x4e32f9[_0x1c7d('0x174')],'',_0x4e32f9[_0x1c7d('0x175')]]);if(_0x104a46[_0x1c7d('0xaa')]===-0x1){return _0x104a46;}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0xca'),'QUEUE',_0xc112ef));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x176')]=function(_0x4cf161){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x177'),_0x4cf161['label']));var _0x22b2f6=_0x4cf161[_0x1c7d('0x178')]||_0x1c7d('0x130');var _0x1d6d6f=util[_0x1c7d('0x55')]('%s_%s',this['channel'][_0x1c7d('0x35')],rs[_0x1c7d('0x11f')](0x5));var _0x340960=util[_0x1c7d('0x55')](_0x1c7d('0x179'),FILES_PATH,_0x1d6d6f,_0x22b2f6);var _0x4ad55e=util[_0x1c7d('0x55')]('%s/recordings/%s',FILES_PATH,_0x1d6d6f);this['createSquareRecording'][_0x1c7d('0x73')](this,_0x4cf161,_0x1d6d6f,_0x340960);this[_0x1c7d('0xd')][_0x1c7d('0xa3')](_0x1c7d('0x17a'),_0x1d6d6f);logger['info'](_0x1c7d('0x17b'),_0x4ad55e,_0x22b2f6,_0x4cf161[_0x1c7d('0x17c')],_0x4cf161['timeout']);return this['channel']['recordFile'](_0x4ad55e,_0x22b2f6,_0x4cf161[_0x1c7d('0x17c')],_0x4cf161[_0x1c7d('0x6a')],undefined,!![]);};AGIVertices['prototype'][_0x1c7d('0x17d')]=function(_0x3a0eec){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x17e'),_0x3a0eec[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x3a0eec[_0x1c7d('0x67')])){return this['channel'][_0x1c7d('0xb0')](_0x1c7d('0x17f'));}var _0x1bca31=this[_0x1c7d('0x66')]['sync'](this,_0x3a0eec);logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x180'),util['inspect'](_0x1bca31,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x3a0eec['variable_id'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x181'));}var _0x122af3=this['getVariable']['sync'](this,_0x3a0eec[_0x1c7d('0xdc')]);if(!_0x122af3){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x3a0eec,_0x1c7d('0xdd'));}this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util['format'](_0x1c7d('0x182'),_0x122af3),_0x1bca31[_0x1c7d('0x78')]?_0x1bca31[_0x1c7d('0x78')]:_0x1c7d('0x183'));this[_0x1c7d('0xd')][_0x1c7d('0xa3')](util[_0x1c7d('0x55')](_0x1c7d('0x184'),_0x122af3),_0x1bca31[_0x1c7d('0x77')]?_0x1bca31[_0x1c7d('0x77')]:'OK');if(_0x1bca31[_0x1c7d('0x6d')]){try{this[_0x1c7d('0xa1')](_0x1bca31[_0x1c7d('0x6d')],_0x122af3);}catch(_0x220678){logger[_0x1c7d('0x29')](util[_0x1c7d('0x55')]('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0x122af3));}}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('variable\x20%s\x20set',_0x122af3));};AGIVertices[_0x1c7d('0x10')]['saydigits']=function(_0x4cdd11){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x185'),_0x4cdd11[_0x1c7d('0x36')]));return this[_0x1c7d('0xd')][_0x1c7d('0x186')](_0x4cdd11[_0x1c7d('0x187')]['replace'](/\s+/g,''),_0x4cdd11[_0x1c7d('0x17c')]);};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x188')]=function(_0x15ba39){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x15ba39[_0x1c7d('0x36')]));return this[_0x1c7d('0xd')][_0x1c7d('0x189')](_0x15ba39[_0x1c7d('0x69')][_0x1c7d('0x5b')](/\s+/g,''),_0x15ba39['escape_digits']);};AGIVertices['prototype'][_0x1c7d('0x18a')]=function(_0x137b67){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x18b'),_0x137b67[_0x1c7d('0x36')]));return this[_0x1c7d('0xd')][_0x1c7d('0x18c')](_0x137b67[_0x1c7d('0x5e')],_0x137b67[_0x1c7d('0x17c')]);};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x18d')]=function(_0x1f4db7){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x18e'),_0x1f4db7[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x1f4db7['account_id'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x18f'));}var _0xa1399b=this[_0x1c7d('0x20')][_0x1c7d('0x73')](this,_0x1f4db7[_0x1c7d('0x190')]);if(!_0xa1399b||!_0xa1399b[_0x1c7d('0x191')]){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x1f4db7,_0x1c7d('0x192'));}var _0x31c12b={'from':util[_0x1c7d('0x55')](_0x1c7d('0x193'),_0xa1399b['name'],_0xa1399b['email']||_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x194')]),'to':_0x1f4db7['to']||'','cc':_0x1f4db7['cc']||'','bcc':_0x1f4db7[_0x1c7d('0x195')]||'','subject':_0x1f4db7[_0x1c7d('0x196')],'html':_0x1f4db7[_0x1c7d('0x5e')],'text':_0x1f4db7[_0x1c7d('0x5e')]};var _0x4149a1={'tls':{'rejectUnauthorized':![]}};if(_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x197')]){_0x4149a1[_0x1c7d('0x197')]=_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x197')];}else{_0x4149a1[_0x1c7d('0x198')]=_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x198')];_0x4149a1[_0x1c7d('0x199')]=_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x199')];_0x4149a1['secure']=_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x19a')];}if(_0xa1399b[_0x1c7d('0x191')]['authentication']){_0x4149a1[_0x1c7d('0x19b')]={'user':_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x194')],'pass':_0xa1399b[_0x1c7d('0x191')][_0x1c7d('0x19c')]};}if(this[_0x1c7d('0xaf')](_0x1f4db7[_0x1c7d('0x19d')])){}logger['debug'](_0x1c7d('0x19e'),JSON[_0x1c7d('0x75')](_0x31c12b));this[_0x1c7d('0x34')][_0x1c7d('0x73')](this,_0x1f4db7,_0x1f4db7[_0x1c7d('0x190')]);this['channel']['noop'](util[_0x1c7d('0x55')](_0x1c7d('0x19f'),_0xa1399b[_0x1c7d('0x16')]));this[_0x1c7d('0x22')][_0x1c7d('0x73')](this,_0x4149a1,_0x31c12b);return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x1a0'));};AGIVertices['prototype'][_0x1c7d('0x1a1')]=function(_0x5e3939){logger['info'](util['format']('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x5e3939[_0x1c7d('0x36')]));return this['channel']['noop'](_0x1c7d('0x1a2'));};AGIVertices['prototype'][_0x1c7d('0x1a3')]=function(_0xd2a5a6){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x1a4'),_0xd2a5a6['label']));if(!this[_0x1c7d('0xaf')](_0xd2a5a6[_0x1c7d('0x1a5')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x1a6'));}var _0xcce236=this[_0x1c7d('0x31')]['sync'](this,_0xd2a5a6[_0x1c7d('0x1a5')]);if(!_0xcce236){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0xd2a5a6,_0x1c7d('0x1a7'));}var _0x4f9741={'body':_0xd2a5a6['sms_text'],'phone':_0xd2a5a6['to']||'','SmsAccountId':_0xcce236['id']};logger[_0x1c7d('0x1a8')]('sendSMS\x20message',JSON[_0x1c7d('0x75')](_0x4f9741));this[_0x1c7d('0x34')][_0x1c7d('0x73')](this,_0xd2a5a6,_0xd2a5a6[_0x1c7d('0x1a5')]);this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x1a9'),_0xcce236[_0x1c7d('0x16')]));this[_0x1c7d('0x33')][_0x1c7d('0x73')](this,_0x4f9741);return this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype']['set']=function(_0x553e35){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x1aa'),_0x553e35[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x553e35[_0x1c7d('0xdc')])){return this[_0x1c7d('0xd')]['error'](_0x553e35,_0x1c7d('0x1ab'));}var _0x3119d0=this[_0x1c7d('0x11')][_0x1c7d('0x73')](this,_0x553e35[_0x1c7d('0xdc')]);if(!_0x3119d0){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x553e35,_0x1c7d('0xdd'));}return this[_0x1c7d('0xd')][_0x1c7d('0xa3')](_0x3119d0,_0x553e35['variable_value']);};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x1ac')]=function(_0x53e0d9){logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x1ad'),_0x53e0d9[_0x1c7d('0x36')]));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x1ae'));if(_0x53e0d9[_0x1c7d('0xc0')]===_0x1c7d('0x1af')){this[_0x1c7d('0xd')][_0x1c7d('0xb0')]('Answer');return this[_0x1c7d('0xd')][_0x1c7d('0xc0')]();}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0x1b0'));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x1b1')]=function(_0x408ba6){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x1b2'),_0x408ba6[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x408ba6[_0x1c7d('0x1b3')])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x408ba6,_0x1c7d('0x1b4'));}var _0x3b5aff=this[_0x1c7d('0x17')][_0x1c7d('0x73')](this,_0x408ba6[_0x1c7d('0x1b3')]);if(!this[_0x1c7d('0xaf')](_0x3b5aff)){return this['channel'][_0x1c7d('0x29')](_0x408ba6,util['format'](_0x1c7d('0x1b5'),_0x408ba6[_0x1c7d('0x1b3')]));}if(_0x3b5aff===this[_0x1c7d('0xd')][_0x1c7d('0x37')]){return this[_0x1c7d('0xd')]['error'](_0x408ba6,_0x1c7d('0x1b6'));}this[_0x1c7d('0x34')]['sync'](this,_0x408ba6,_0x3b5aff);var _0x12775b=this[_0x1c7d('0xd')][_0x1c7d('0x59')](_0x1c7d('0x1b7'),util[_0x1c7d('0x55')](_0x1c7d('0x1b8'),config[_0x1c7d('0x7')]['host']||_0x1c7d('0x1b9'),_0x3b5aff,this[_0x1c7d('0xd')][_0x1c7d('0x37')]));if(_0x12775b[_0x1c7d('0xaa')]===-0x1){return _0x12775b;}return this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0xca'),_0x1c7d('0x1b7'),_0x3b5aff));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x1ba')]=function(_0x30a851){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x1bb'),_0x30a851[_0x1c7d('0x36')]));var _0x1693fc=this[_0x1c7d('0x58')][_0x1c7d('0x73')](this,_0x30a851['command']);this['createSquareDetailsReport'][_0x1c7d('0x73')](this,_0x30a851,_0x30a851[_0x1c7d('0xbe')]);if(this['isConfigured'](_0x30a851['variable_id'])){var _0x56585c=this['getVariable']['sync'](this,_0x30a851[_0x1c7d('0xdc')]);if(_0x56585c){this['channel']['setVariable'](_0x56585c,_0x1693fc);return this[_0x1c7d('0xd')]['noop'](util['format'](_0x1c7d('0x1bc'),_0x30a851[_0x1c7d('0xbe')],_0x56585c));}}return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x1bd'),_0x30a851[_0x1c7d('0xbe')]));};AGIVertices[_0x1c7d('0x10')]['google_cloud_tts']=function(_0x114c5c){logger[_0x1c7d('0x2b')](util['format'](_0x1c7d('0x1be'),_0x114c5c[_0x1c7d('0x36')]));_0x114c5c['text']=_0x114c5c['text'][_0x1c7d('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1c7d('0xaf')](_0x114c5c['apiKey'])){return this['channel'][_0x1c7d('0xb0')](_0x1c7d('0x1bf'));}if(!this[_0x1c7d('0xaf')](_0x114c5c['text'])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xb1'));}this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x1c0'),_0x114c5c[_0x1c7d('0x5e')]));var _0x41e7c1=this[_0x1c7d('0x5c')][_0x1c7d('0x73')](this,_0x114c5c);if(_0x41e7c1){this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util['format'](_0x1c7d('0x1c1'),_0x41e7c1));var _0x35780e=this['channel'][_0x1c7d('0x105')](_0x41e7c1);try{fs[_0x1c7d('0x106')](_0x41e7c1+_0x1c7d('0x107'));}catch(_0x56f2fe){logger[_0x1c7d('0x29')](_0x56f2fe);}return _0x35780e;}return this['channel'][_0x1c7d('0x29')](_0x114c5c,_0x1c7d('0x1c2'));};AGIVertices['prototype'][_0x1c7d('0x1c3')]=function(_0x4748c9){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4748c9[_0x1c7d('0x36')]));_0x4748c9['text']=_0x4748c9['text'][_0x1c7d('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x1c7d('0xaf')](_0x4748c9[_0x1c7d('0x5e')])){return this[_0x1c7d('0xd')][_0x1c7d('0xb0')](_0x1c7d('0xb1'));}this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x1c4'),_0x4748c9['text']));var _0x2bac4f=this['googleTTS'][_0x1c7d('0x73')](this,_0x4748c9);if(_0x2bac4f){this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')](_0x1c7d('0x1c5'),_0x2bac4f));var _0x49df91=this[_0x1c7d('0xd')][_0x1c7d('0x105')](_0x2bac4f);try{fs[_0x1c7d('0x106')](_0x2bac4f+_0x1c7d('0x107'));}catch(_0x31aad3){logger['error'](_0x31aad3);}return _0x49df91;}return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x4748c9,_0x1c7d('0x1c6'));};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x1c7')]=function(_0x384c98){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')](_0x1c7d('0x1c8'),_0x384c98[_0x1c7d('0x36')]));if(!this[_0x1c7d('0xaf')](_0x384c98[_0x1c7d('0x155')])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x384c98,_0x1c7d('0x156'));}logger['info'](util[_0x1c7d('0x55')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x1c7d('0x38')],_0x384c98[_0x1c7d('0x155')]));var _0x20ea3b=this[_0x1c7d('0x51')][_0x1c7d('0x73')](this,_0x384c98[_0x1c7d('0x155')]);if(_0x20ea3b){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x1c7d('0x38')],_0x384c98[_0x1c7d('0x155')]));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x1c7d('0xd')][_0x1c7d('0x38')],_0x384c98[_0x1c7d('0x155')]));return{'code':0xc8,'result':_0x1c7d('0x15a')};}else{logger['info'](util[_0x1c7d('0x55')](_0x1c7d('0x159'),this[_0x1c7d('0xd')]['callerid'],_0x384c98[_0x1c7d('0x155')]));this[_0x1c7d('0xd')][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x384c98[_0x1c7d('0x155')]));return{'code':0xc8,'result':_0x1c7d('0x15b')};}};AGIVertices[_0x1c7d('0x10')][_0x1c7d('0x1c9')]=function(_0x4046dd){logger[_0x1c7d('0x2b')](util[_0x1c7d('0x55')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x4046dd[_0x1c7d('0x36')]));var _0x1cd06a=this[_0x1c7d('0xd')]['exec'](_0x1c7d('0x1ca'),[_0x4046dd[_0x1c7d('0x1cb')],_0x4046dd['options']]);if(_0x1cd06a[_0x1c7d('0xaa')]===-0x1){return _0x1cd06a;}return this['channel'][_0x1c7d('0xb0')](util[_0x1c7d('0x55')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x4046dd[_0x1c7d('0x1cb')]));};AGIVertices[_0x1c7d('0x10')]['vswitch']=function(_0x458d5f){logger[_0x1c7d('0x2b')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x458d5f[_0x1c7d('0x36')]));if(!this['isConfigured'](_0x458d5f['variable_id'])){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x458d5f,_0x1c7d('0x1ab'));}var _0x40e2b1=this[_0x1c7d('0x11')]['sync'](this,_0x458d5f[_0x1c7d('0xdc')]);if(!_0x40e2b1){return this[_0x1c7d('0xd')][_0x1c7d('0x29')](_0x458d5f,_0x1c7d('0xdd'));}var _0x7ca9b5=this[_0x1c7d('0xd')][_0x1c7d('0x11')](_0x40e2b1);return{'code':0xc8,'result':_0x7ca9b5[_0x1c7d('0xa7')]?_0x7ca9b5[_0x1c7d('0xa7')]:'-'};};String[_0x1c7d('0x10')][_0x1c7d('0xa6')]=function(_0x5b6713,_0x2c8794){return this[_0x1c7d('0xa5')](_0x5b6713)[_0x1c7d('0x1cc')](_0x2c8794);};module[_0x1c7d('0x1cd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index e9ccc5f..d09eb0e 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 _0x2b66=['info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','timer','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','bind','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','then','voicePause'];(function(_0xbe796f,_0x1b280c){var _0x2f300e=function(_0x5c9f98){while(--_0x5c9f98){_0xbe796f['push'](_0xbe796f['shift']());}};_0x2f300e(++_0x1b280c);}(_0x2b66,0x80));var _0x62b6=function(_0x44af28,_0x4e8e41){_0x44af28=_0x44af28-0x0;var _0x1dd5f6=_0x2b66[_0x44af28];return _0x1dd5f6;};'use strict';var util=require(_0x62b6('0x0'));var _=require(_0x62b6('0x1'));var moment=require(_0x62b6('0x2'));var ami=require('../ami');var logger=require(_0x62b6('0x3'))(_0x62b6('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x62b6('0x5'));function Acw(_0x385d5d){this[_0x62b6('0x6')]=_0x385d5d[_0x62b6('0x6')];this['agents']=_0x385d5d[_0x62b6('0x7')];this['timers']=_0x385d5d[_0x62b6('0x8')];this[_0x62b6('0x9')]={};ami['on'](_0x62b6('0xa'),this['syncAgentConnect']['bind'](this));ami['on']('hanguprequest',this[_0x62b6('0xb')]['bind'](this));ami['on'](_0x62b6('0xc'),this[_0x62b6('0xd')]['bind'](this));ami['on']('agentringnoanswer',this[_0x62b6('0xe')][_0x62b6('0xf')](this));ami['on'](_0x62b6('0x10'),this[_0x62b6('0x11')]['bind'](this));ami['on'](_0x62b6('0x12'),this[_0x62b6('0x13')][_0x62b6('0xf')](this));ami['on'](_0x62b6('0x14'),this[_0x62b6('0x15')][_0x62b6('0xf')](this));}function getDiff(_0x58906f){var _0x3678ff=moment()['milliseconds'](0x0);var _0x56acc0=moment(_0x58906f)[_0x62b6('0x16')](0x0);return _0x3678ff[_0x62b6('0x17')](_0x56acc0,'seconds');}Acw[_0x62b6('0x18')][_0x62b6('0x19')]=function(_0x58af2f){try{var _0x3c9f50=this;var _0x1ab008=this['channels'][_0x58af2f][_0x62b6('0x1a')];var _0x23f269=this[_0x62b6('0x9')][_0x58af2f][_0x62b6('0x1b')];var _0x351596=this[_0x62b6('0x6')][_0x23f269];var _0x232e48=![];var _0x203f89=_0x62b6('0x1c');if(_0x351596[_0x62b6('0x1d')]){if(_0x351596['mandatoryDispositionPause']['name']){_0x232e48=!![];_0x203f89=_0x351596[_0x62b6('0x1e')][_0x62b6('0x1f')];}}ami['Action']({'action':'QueuePause','interface':_0x1ab008,'paused':!![],'reason':_0x203f89})[_0x62b6('0x20')](function(_0x1c66ca){if(_0x3c9f50[_0x62b6('0x7')][_0x1ab008]){return RpcUser['getAgent'](_0x3c9f50[_0x62b6('0x7')][_0x1ab008]['id'])[_0x62b6('0x20')](function(_0x553c7b){if(_0x553c7b&&!_0x553c7b[_0x62b6('0x21')]){logger[_0x62b6('0x22')](_0x62b6('0x23'),_0x58af2f,_0x1ab008,_0x23f269);var _0x197671=_0x3c9f50['channels'][_0x58af2f][_0x62b6('0x24')]&&_0x3c9f50[_0x62b6('0x9')][_0x58af2f][_0x62b6('0x25')]?_0x3c9f50[_0x62b6('0x9')][_0x58af2f]['destlinkedid']:_0x58af2f;return RpcUser[_0x62b6('0x26')](_0x3c9f50[_0x62b6('0x7')][_0x1ab008],_0x203f89,_0x197671)[_0x62b6('0x20')](function(_0x13de75){if(!_0x232e48){_0x3c9f50[_0x62b6('0x8')][_0x1ab008]={};logger[_0x62b6('0x22')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x58af2f,_0x3c9f50['voiceQueues'][_0x23f269][_0x62b6('0x27')],_0x1ab008,_0x23f269);_0x3c9f50[_0x62b6('0x8')][_0x1ab008][_0x62b6('0x28')]=setTimeout(_0x3c9f50[_0x62b6('0x29')][_0x62b6('0xf')](_0x3c9f50,_0x1ab008),_0x3c9f50[_0x62b6('0x6')][_0x23f269][_0x62b6('0x27')]*0x3e8);_0x3c9f50['timers'][_0x1ab008]['lastPauseAt']=moment()[_0x62b6('0x2a')](_0x62b6('0x2b'));_0x3c9f50[_0x62b6('0x8')][_0x1ab008][_0x62b6('0x2c')]=_0x58af2f;_0x3c9f50[_0x62b6('0x8')][_0x1ab008]['queue']=_0x23f269;_0x3c9f50['timers'][_0x1ab008]['updateAcw']=function(){var _0x1666bc=getDiff(_0x3c9f50[_0x62b6('0x8')][_0x1ab008][_0x62b6('0x2d')]);clearTimeout(_0x3c9f50['timers'][_0x1ab008][_0x62b6('0x28')]);_0x3c9f50['timers'][_0x1ab008][_0x62b6('0x28')]=![];RpcVoiceAgentReport[_0x62b6('0x2e')]({'acwtime':_0x1666bc},_0x3c9f50[_0x62b6('0x8')][_0x1ab008][_0x62b6('0x2c')],_0x1ab008)[_0x62b6('0x20')](function(_0x1b4c15){logger[_0x62b6('0x22')](_0x62b6('0x2f'),_0x58af2f,_0x1666bc,_0x1b4c15);})[_0x62b6('0x30')](function(_0x151aac){logger[_0x62b6('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x58af2f,_0x151aac);});delete _0x3c9f50[_0x62b6('0x8')][_0x1ab008];};}});}else{logger[_0x62b6('0x22')](_0x62b6('0x32'),_0x58af2f,_0x1ab008,_0x23f269);}});}})[_0x62b6('0x30')](function(_0x1f01d8){logger['error'](_0x62b6('0x33'),_0x58af2f,_0x3c9f50['voiceQueues'][_0x23f269]['acwTimeout'],_0x1ab008,_0x23f269);})['finally'](function(){delete _0x3c9f50[_0x62b6('0x9')][_0x58af2f];});}catch(_0x106b46){logger[_0x62b6('0x31')](_0x62b6('0x34'),_0x106b46[_0x62b6('0x35')]);}};Acw['prototype'][_0x62b6('0x29')]=function(_0x10466a){try{var _0x4544c1=this;if(_0x4544c1[_0x62b6('0x8')][_0x10466a]){_0x4544c1['timers'][_0x10466a][_0x62b6('0x28')]=![];var _0xf72487=_0x4544c1[_0x62b6('0x8')][_0x10466a][_0x62b6('0x2c')];var _0x20ee15=_0x4544c1[_0x62b6('0x8')][_0x10466a][_0x62b6('0x1b')];var _0x1650ed=_0x4544c1['voiceQueues'][_0x20ee15][_0x62b6('0x27')];logger[_0x62b6('0x22')](_0x62b6('0x36'),_0xf72487,_0x10466a);RpcUser[_0x62b6('0x37')](this[_0x62b6('0x7')][_0x10466a]);RpcVoiceAgentReport['update']({'acwtime':_0x1650ed,'agentacw':!![]},_0xf72487,_0x10466a)['then'](function(_0x571b92){logger['info'](_0x62b6('0x2f'),_0xf72487,_0x1650ed,_0x571b92);})[_0x62b6('0x30')](function(_0x15653e){logger[_0x62b6('0x31')]('[%s][UPDATE][ERRORS:%s]',_0xf72487,_0x15653e);});}else{logger[_0x62b6('0x31')](_0x62b6('0x38'),_0x10466a);if(_0x4544c1['timers']){logger['info']('[ACW][TIMERS]',JSON[_0x62b6('0x39')](_0x4544c1[_0x62b6('0x8')]));}}}catch(_0x28e513){logger[_0x62b6('0x31')](_0x62b6('0x3a'),_0x28e513[_0x62b6('0x35')]);}};Acw[_0x62b6('0x18')]['syncAgentConnect']=function(_0x147997){try{if(this[_0x62b6('0x6')][_0x147997[_0x62b6('0x1b')]]&&(this[_0x62b6('0x6')][_0x147997[_0x62b6('0x1b')]][_0x62b6('0x4')]||this[_0x62b6('0x6')][_0x147997[_0x62b6('0x1b')]][_0x62b6('0x1d')])){if(this[_0x62b6('0x7')][_0x147997[_0x62b6('0x1a')]]){this[_0x62b6('0x9')][_0x147997['uniqueid']]={'queue':_0x147997['queue'],'interface':_0x147997[_0x62b6('0x1a')],'destlinkedid':_0x147997[_0x62b6('0x25')]};}}}catch(_0x5d751b){logger[_0x62b6('0x31')](_0x62b6('0x3b'),_0x5d751b['message']);}};Acw[_0x62b6('0x18')][_0x62b6('0x15')]=function(_0x319447){try{if(this[_0x62b6('0x6')][_0x319447['queue']]&&(this[_0x62b6('0x6')][_0x319447['queue']]['acw']||this[_0x62b6('0x6')][_0x319447['queue']][_0x62b6('0x1d')])){if(this[_0x62b6('0x7')][_0x319447[_0x62b6('0x1a')]]){this[_0x62b6('0x9')][_0x319447[_0x62b6('0x2c')]]={'queue':_0x319447['queue'],'interface':_0x319447[_0x62b6('0x1a')]};}}}catch(_0x53a922){logger[_0x62b6('0x31')](_0x62b6('0x3c'),_0x53a922[_0x62b6('0x35')]);}};Acw[_0x62b6('0x18')][_0x62b6('0xb')]=function(_0x47f1ce){try{if(this[_0x62b6('0x9')][_0x47f1ce[_0x62b6('0x2c')]]&&_['isUndefined'](this[_0x62b6('0x9')][_0x47f1ce[_0x62b6('0x2c')]][_0x62b6('0x24')])){logger[_0x62b6('0x22')]('[%s][HANGUP:UNIQUEID]',_0x47f1ce[_0x62b6('0x2c')]);this[_0x62b6('0x19')](_0x47f1ce[_0x62b6('0x2c')]);}else if(this[_0x62b6('0x9')][_0x47f1ce[_0x62b6('0x3d')]]&&_[_0x62b6('0x3e')](this[_0x62b6('0x9')][_0x47f1ce[_0x62b6('0x3d')]]['attended'])){logger[_0x62b6('0x22')](_0x62b6('0x3f'),_0x47f1ce[_0x62b6('0x3d')]);this[_0x62b6('0x19')](_0x47f1ce['linkedid']);}}catch(_0x572f39){logger[_0x62b6('0x31')](_0x62b6('0x40'),_0x572f39[_0x62b6('0x35')]);}};Acw[_0x62b6('0x18')][_0x62b6('0xd')]=function(_0x487d7f){try{if(this[_0x62b6('0x9')][_0x487d7f[_0x62b6('0x2c')]]&&this[_0x62b6('0x9')][_0x487d7f['uniqueid']][_0x62b6('0x24')]){logger[_0x62b6('0x22')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x487d7f[_0x62b6('0x2c')]);this[_0x62b6('0x19')](_0x487d7f[_0x62b6('0x2c')]);}else if(this[_0x62b6('0x9')][_0x487d7f[_0x62b6('0x3d')]]&&this['channels'][_0x487d7f[_0x62b6('0x3d')]][_0x62b6('0x24')]){logger['info'](_0x62b6('0x41'),_0x487d7f[_0x62b6('0x3d')]);this[_0x62b6('0x19')](_0x487d7f[_0x62b6('0x3d')]);}}catch(_0x3d5f36){logger[_0x62b6('0x31')](_0x62b6('0x42'),_0x3d5f36[_0x62b6('0x35')]);}};Acw[_0x62b6('0x18')][_0x62b6('0x11')]=function(_0x31cdb3){try{if(!_[_0x62b6('0x43')](this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x44')]])){this[_0x62b6('0x19')](_0x31cdb3['transfereeuniqueid']);if(this['channels'][_0x31cdb3[_0x62b6('0x45')]]){this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x45')]][_0x62b6('0x24')]=!![];this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x46')]]=this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x45')]];delete this['channels'][_0x31cdb3[_0x62b6('0x45')]];}}else if(!_[_0x62b6('0x43')](this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x46')]])){this[_0x62b6('0x19')](_0x31cdb3[_0x62b6('0x46')]);if(this[_0x62b6('0x9')][_0x31cdb3['origtransfereruniqueid']]){this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x47')]][_0x62b6('0x24')]=!![];this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x44')]]=this['channels'][_0x31cdb3[_0x62b6('0x47')]];delete this[_0x62b6('0x9')][_0x31cdb3[_0x62b6('0x47')]];}}}catch(_0x1477ac){logger[_0x62b6('0x31')](_0x62b6('0x48'),_0x1477ac[_0x62b6('0x35')]);}};Acw[_0x62b6('0x18')]['syncBlindTransfer']=function(_0xc0fc5d){try{if(this[_0x62b6('0x9')][_0xc0fc5d[_0x62b6('0x49')]]){logger['info']('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x62b6('0x39')](_0xc0fc5d['transfereruniqueid']));this[_0x62b6('0x19')](_0xc0fc5d['transfereruniqueid']);}else if(this['channels'][_0xc0fc5d[_0x62b6('0x4a')]]){logger['info'](_0x62b6('0x4b'),JSON[_0x62b6('0x39')](_0xc0fc5d['transfererlinkedid']));this[_0x62b6('0x19')](_0xc0fc5d['transfererlinkedid']);}}catch(_0x4e74e1){logger[_0x62b6('0x31')](_0x62b6('0x4c'),_0x4e74e1[_0x62b6('0x35')]);}};Acw[_0x62b6('0x18')][_0x62b6('0xe')]=function(_0x2a4a13){try{if(this[_0x62b6('0x6')][_0x2a4a13['queue']]&&this['voiceQueues'][_0x2a4a13[_0x62b6('0x1b')]]['autopause']===_0x62b6('0x4d')){if(this[_0x62b6('0x7')][_0x2a4a13['interface']]){logger[_0x62b6('0x22')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x2a4a13[_0x62b6('0x2c')],_0x2a4a13[_0x62b6('0x1a')],_0x2a4a13[_0x62b6('0x1b')]);return RpcUser['savePause'](this['agents'][_0x2a4a13[_0x62b6('0x1a')]],_0x62b6('0x4e'),_0x2a4a13[_0x62b6('0x2c')]);}}}catch(_0x51d87f){logger['error'](_0x62b6('0x4f'),_0x51d87f[_0x62b6('0x35')]);}};module[_0x62b6('0x50')]=Acw; \ No newline at end of file +var _0x94f3=['savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','updateAcw','timer','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','mandatoryDisposition','message','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','[ACW][syncAgentRingNoAnswer]\x20%s','util','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','interface','channels','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','getAgent','then','voicePause','info','destlinkedid'];(function(_0x1cc5f6,_0x2e6995){var _0x4b8b64=function(_0x3868f3){while(--_0x3868f3){_0x1cc5f6['push'](_0x1cc5f6['shift']());}};_0x4b8b64(++_0x2e6995);}(_0x94f3,0xd8));var _0x394f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x94f3[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x394f('0x0'));var _=require(_0x394f('0x1'));var moment=require(_0x394f('0x2'));var ami=require(_0x394f('0x3'));var logger=require(_0x394f('0x4'))(_0x394f('0x5'));var RpcUser=require(_0x394f('0x6'));var RpcVoiceAgentReport=require(_0x394f('0x7'));function Acw(_0x14c2b7){this[_0x394f('0x8')]=_0x14c2b7[_0x394f('0x8')];this[_0x394f('0x9')]=_0x14c2b7[_0x394f('0x9')];this[_0x394f('0xa')]=_0x14c2b7[_0x394f('0xa')];this['channels']={};ami['on'](_0x394f('0xb'),this[_0x394f('0xc')][_0x394f('0xd')](this));ami['on'](_0x394f('0xe'),this[_0x394f('0xf')]['bind'](this));ami['on'](_0x394f('0x10'),this['syncHangup'][_0x394f('0xd')](this));ami['on'](_0x394f('0x11'),this[_0x394f('0x12')][_0x394f('0xd')](this));ami['on'](_0x394f('0x13'),this[_0x394f('0x14')][_0x394f('0xd')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x394f('0xd')](this));ami['on'](_0x394f('0x15'),this[_0x394f('0x16')][_0x394f('0xd')](this));}function getDiff(_0x4a4892){var _0x6617bb=moment()['milliseconds'](0x0);var _0x27b6ce=moment(_0x4a4892)[_0x394f('0x17')](0x0);return _0x6617bb[_0x394f('0x18')](_0x27b6ce,'seconds');}Acw[_0x394f('0x19')]['startAcw']=function(_0x21ac25){try{var _0x580815=this;var _0x1c8062=this['channels'][_0x21ac25][_0x394f('0x1a')];var _0x213fdb=this[_0x394f('0x1b')][_0x21ac25][_0x394f('0x1c')];var _0x61902c=this[_0x394f('0x8')][_0x213fdb];var _0x1cd3db=![];var _0x19bd43=_0x394f('0x1d');if(_0x61902c['mandatoryDisposition']){if(_0x61902c[_0x394f('0x1e')][_0x394f('0x1f')]){_0x1cd3db=!![];_0x19bd43=_0x61902c['mandatoryDispositionPause']['name'];}}ami[_0x394f('0x20')]({'action':_0x394f('0x21'),'interface':_0x1c8062,'paused':!![],'reason':_0x19bd43})['then'](function(_0x125efa){if(_0x580815[_0x394f('0x9')][_0x1c8062]){return RpcUser[_0x394f('0x22')](_0x580815[_0x394f('0x9')][_0x1c8062]['id'])[_0x394f('0x23')](function(_0x1f3c28){if(_0x1f3c28&&!_0x1f3c28[_0x394f('0x24')]){logger[_0x394f('0x25')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x21ac25,_0x1c8062,_0x213fdb);var _0x13dd64=_0x580815['channels'][_0x21ac25]['attended']&&_0x580815[_0x394f('0x1b')][_0x21ac25][_0x394f('0x26')]?_0x580815[_0x394f('0x1b')][_0x21ac25][_0x394f('0x26')]:_0x21ac25;return RpcUser[_0x394f('0x27')](_0x580815[_0x394f('0x9')][_0x1c8062],_0x19bd43,_0x13dd64)[_0x394f('0x23')](function(_0x31195c){if(!_0x1cd3db){_0x580815[_0x394f('0xa')][_0x1c8062]={};logger['info'](_0x394f('0x28'),_0x21ac25,_0x580815[_0x394f('0x8')][_0x213fdb][_0x394f('0x29')],_0x1c8062,_0x213fdb);_0x580815[_0x394f('0xa')][_0x1c8062]['timer']=setTimeout(_0x580815[_0x394f('0x2a')][_0x394f('0xd')](_0x580815,_0x1c8062),_0x580815[_0x394f('0x8')][_0x213fdb]['acwTimeout']*0x3e8);_0x580815[_0x394f('0xa')][_0x1c8062][_0x394f('0x2b')]=moment()['format'](_0x394f('0x2c'));_0x580815[_0x394f('0xa')][_0x1c8062]['uniqueid']=_0x21ac25;_0x580815[_0x394f('0xa')][_0x1c8062][_0x394f('0x1c')]=_0x213fdb;_0x580815[_0x394f('0xa')][_0x1c8062][_0x394f('0x2d')]=function(){var _0x5b4eee=getDiff(_0x580815['timers'][_0x1c8062]['lastPauseAt']);clearTimeout(_0x580815['timers'][_0x1c8062][_0x394f('0x2e')]);_0x580815[_0x394f('0xa')][_0x1c8062][_0x394f('0x2e')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5b4eee},_0x580815[_0x394f('0xa')][_0x1c8062][_0x394f('0x2f')],_0x1c8062)[_0x394f('0x23')](function(_0x4ca2ec){logger[_0x394f('0x25')](_0x394f('0x30'),_0x21ac25,_0x5b4eee,_0x4ca2ec);})[_0x394f('0x31')](function(_0x4b15d8){logger[_0x394f('0x32')](_0x394f('0x33'),_0x21ac25,_0x4b15d8);});delete _0x580815[_0x394f('0xa')][_0x1c8062];};}});}else{logger['info'](_0x394f('0x34'),_0x21ac25,_0x1c8062,_0x213fdb);}});}})[_0x394f('0x31')](function(_0x344e12){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x21ac25,_0x580815['voiceQueues'][_0x213fdb][_0x394f('0x29')],_0x1c8062,_0x213fdb);})[_0x394f('0x35')](function(){delete _0x580815['channels'][_0x21ac25];});}catch(_0x588934){logger['error'](_0x394f('0x36'),_0x588934['message']);}};Acw[_0x394f('0x19')][_0x394f('0x2a')]=function(_0x587f8f){try{var _0x304615=this;if(_0x304615[_0x394f('0xa')][_0x587f8f]){_0x304615[_0x394f('0xa')][_0x587f8f]['timer']=![];var _0x14b21b=_0x304615[_0x394f('0xa')][_0x587f8f][_0x394f('0x2f')];var _0x29cf9e=_0x304615[_0x394f('0xa')][_0x587f8f][_0x394f('0x1c')];var _0xbeda3a=_0x304615[_0x394f('0x8')][_0x29cf9e][_0x394f('0x29')];logger[_0x394f('0x25')](_0x394f('0x37'),_0x14b21b,_0x587f8f);RpcUser[_0x394f('0x38')](this[_0x394f('0x9')][_0x587f8f]);RpcVoiceAgentReport[_0x394f('0x39')]({'acwtime':_0xbeda3a,'agentacw':!![]},_0x14b21b,_0x587f8f)['then'](function(_0x5ee257){logger[_0x394f('0x25')]('[%s][UPDATE][ACWTIME:%s]',_0x14b21b,_0xbeda3a,_0x5ee257);})[_0x394f('0x31')](function(_0x178f5e){logger['error'](_0x394f('0x33'),_0x14b21b,_0x178f5e);});}else{logger[_0x394f('0x32')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x587f8f);if(_0x304615[_0x394f('0xa')]){logger[_0x394f('0x25')](_0x394f('0x3a'),JSON[_0x394f('0x3b')](_0x304615[_0x394f('0xa')]));}}}catch(_0xb87cad){logger[_0x394f('0x32')](_0x394f('0x3c'),_0xb87cad['message']);}};Acw[_0x394f('0x19')][_0x394f('0xc')]=function(_0x4442db){try{if(this[_0x394f('0x8')][_0x4442db[_0x394f('0x1c')]]&&(this[_0x394f('0x8')][_0x4442db[_0x394f('0x1c')]][_0x394f('0x5')]||this[_0x394f('0x8')][_0x4442db[_0x394f('0x1c')]][_0x394f('0x3d')])){if(this[_0x394f('0x9')][_0x4442db[_0x394f('0x1a')]]){this[_0x394f('0x1b')][_0x4442db['uniqueid']]={'queue':_0x4442db['queue'],'interface':_0x4442db[_0x394f('0x1a')],'destlinkedid':_0x4442db[_0x394f('0x26')]};}}}catch(_0xb6275e){logger[_0x394f('0x32')]('[ACW][syncAgentConnect]\x20%s',_0xb6275e[_0x394f('0x3e')]);}};Acw[_0x394f('0x19')][_0x394f('0x16')]=function(_0x3811e0){try{if(this[_0x394f('0x8')][_0x3811e0[_0x394f('0x1c')]]&&(this[_0x394f('0x8')][_0x3811e0[_0x394f('0x1c')]]['acw']||this[_0x394f('0x8')][_0x3811e0[_0x394f('0x1c')]][_0x394f('0x3d')])){if(this[_0x394f('0x9')][_0x3811e0[_0x394f('0x1a')]]){this[_0x394f('0x1b')][_0x3811e0[_0x394f('0x2f')]]={'queue':_0x3811e0['queue'],'interface':_0x3811e0[_0x394f('0x1a')]};}}}catch(_0x1a64ef){logger[_0x394f('0x32')]('[ACW][syncAgentConnectPreview]\x20%s',_0x1a64ef['message']);}};Acw[_0x394f('0x19')][_0x394f('0xf')]=function(_0x3bc173){try{if(this[_0x394f('0x1b')][_0x3bc173[_0x394f('0x2f')]]&&_[_0x394f('0x3f')](this[_0x394f('0x1b')][_0x3bc173[_0x394f('0x2f')]]['attended'])){logger['info'](_0x394f('0x40'),_0x3bc173[_0x394f('0x2f')]);this[_0x394f('0x41')](_0x3bc173['uniqueid']);}else if(this[_0x394f('0x1b')][_0x3bc173[_0x394f('0x42')]]&&_[_0x394f('0x3f')](this['channels'][_0x3bc173[_0x394f('0x42')]][_0x394f('0x43')])){logger[_0x394f('0x25')](_0x394f('0x44'),_0x3bc173['linkedid']);this[_0x394f('0x41')](_0x3bc173[_0x394f('0x42')]);}}catch(_0x5c0865){logger[_0x394f('0x32')]('[ACW][syncHangupRequest]\x20%s',_0x5c0865['message']);}};Acw[_0x394f('0x19')]['syncHangup']=function(_0x36f006){try{if(this['channels'][_0x36f006[_0x394f('0x2f')]]&&this[_0x394f('0x1b')][_0x36f006[_0x394f('0x2f')]]['attended']){logger[_0x394f('0x25')]('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x36f006[_0x394f('0x2f')]);this[_0x394f('0x41')](_0x36f006[_0x394f('0x2f')]);}else if(this[_0x394f('0x1b')][_0x36f006[_0x394f('0x42')]]&&this[_0x394f('0x1b')][_0x36f006['linkedid']][_0x394f('0x43')]){logger['info'](_0x394f('0x45'),_0x36f006['linkedid']);this[_0x394f('0x41')](_0x36f006['linkedid']);}}catch(_0x1f2766){logger['error'](_0x394f('0x46'),_0x1f2766[_0x394f('0x3e')]);}};Acw[_0x394f('0x19')][_0x394f('0x14')]=function(_0x4d8964){try{if(!_['isNil'](this['channels'][_0x4d8964['transfereeuniqueid']])){this[_0x394f('0x41')](_0x4d8964[_0x394f('0x47')]);if(this[_0x394f('0x1b')][_0x4d8964[_0x394f('0x48')]]){this[_0x394f('0x1b')][_0x4d8964[_0x394f('0x48')]][_0x394f('0x43')]=!![];this[_0x394f('0x1b')][_0x4d8964['transfertargetuniqueid']]=this[_0x394f('0x1b')][_0x4d8964[_0x394f('0x48')]];delete this[_0x394f('0x1b')][_0x4d8964[_0x394f('0x48')]];}}else if(!_['isNil'](this['channels'][_0x4d8964[_0x394f('0x49')]])){this[_0x394f('0x41')](_0x4d8964[_0x394f('0x49')]);if(this[_0x394f('0x1b')][_0x4d8964['origtransfereruniqueid']]){this[_0x394f('0x1b')][_0x4d8964[_0x394f('0x4a')]]['attended']=!![];this[_0x394f('0x1b')][_0x4d8964[_0x394f('0x47')]]=this['channels'][_0x4d8964['origtransfereruniqueid']];delete this[_0x394f('0x1b')][_0x4d8964['origtransfereruniqueid']];}}}catch(_0x4dc900){logger[_0x394f('0x32')](_0x394f('0x4b'),_0x4dc900[_0x394f('0x3e')]);}};Acw[_0x394f('0x19')]['syncBlindTransfer']=function(_0x4ec406){try{if(this[_0x394f('0x1b')][_0x4ec406[_0x394f('0x4c')]]){logger['info'](_0x394f('0x4d'),JSON[_0x394f('0x3b')](_0x4ec406[_0x394f('0x4c')]));this[_0x394f('0x41')](_0x4ec406[_0x394f('0x4c')]);}else if(this['channels'][_0x4ec406['transfererlinkedid']]){logger['info'](_0x394f('0x4e'),JSON['stringify'](_0x4ec406[_0x394f('0x4f')]));this[_0x394f('0x41')](_0x4ec406[_0x394f('0x4f')]);}}catch(_0x232329){logger[_0x394f('0x32')](_0x394f('0x50'),_0x232329[_0x394f('0x3e')]);}};Acw[_0x394f('0x19')][_0x394f('0x12')]=function(_0x539d71){try{if(this[_0x394f('0x8')][_0x539d71['queue']]&&this[_0x394f('0x8')][_0x539d71[_0x394f('0x1c')]][_0x394f('0x51')]===_0x394f('0x52')){if(this[_0x394f('0x9')][_0x539d71['interface']]){logger['info'](_0x394f('0x53'),_0x539d71['uniqueid'],_0x539d71[_0x394f('0x1a')],_0x539d71['queue']);return RpcUser['savePause'](this['agents'][_0x539d71['interface']],'Auto-Pause',_0x539d71[_0x394f('0x2f')]);}}}catch(_0x2b346e){logger[_0x394f('0x32')](_0x394f('0x54'),_0x2b346e[_0x394f('0x3e')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 39e97ff..f90e659 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 _0xabe4=['log','exports','asterisk-manager','util','lodash','../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','actionDeviceStateList','catch'];(function(_0x5a7112,_0x1f9492){var _0x3147f7=function(_0x4d2329){while(--_0x4d2329){_0x5a7112['push'](_0x5a7112['shift']());}};_0x3147f7(++_0x1f9492);}(_0xabe4,0x152));var _0x4abe=function(_0x4737a0,_0x36520e){_0x4737a0=_0x4737a0-0x0;var _0x4d558b=_0xabe4[_0x4737a0];return _0x4d558b;};'use strict';var Manager=require(_0x4abe('0x0'));var BPromise=require('bluebird');var moment=require('moment');var util=require(_0x4abe('0x1'));var _=require(_0x4abe('0x2'));var logger=require(_0x4abe('0x3'))(_0x4abe('0x4'));var config=require(_0x4abe('0x5'));var ami=new Manager(config[_0x4abe('0x6')][_0x4abe('0x7')],config[_0x4abe('0x6')]['ip'],config[_0x4abe('0x6')][_0x4abe('0x8')],config[_0x4abe('0x6')][_0x4abe('0x9')],!![]);ami[_0x4abe('0xa')]();ami[_0x4abe('0xb')]=BPromise[_0x4abe('0xc')](ami[_0x4abe('0xd')]);function error(_0x4d2a37){logger['error'](util[_0x4abe('0xe')](_0x4abe('0xf'),config[_0x4abe('0x6')][_0x4abe('0x8')],config[_0x4abe('0x6')]['ip'],config[_0x4abe('0x6')]['port'],util[_0x4abe('0x10')](_0x4d2a37,![],null)));}function close(){logger[_0x4abe('0x11')](util[_0x4abe('0xe')](_0x4abe('0x12'),config[_0x4abe('0x6')][_0x4abe('0x8')],config[_0x4abe('0x6')]['ip'],config['asterisk']['port']));}ami[_0x4abe('0x13')]=function(){return function(){return ami[_0x4abe('0xb')]({'action':_0x4abe('0x14')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x4abe('0xb')]({'action':_0x4abe('0x15')});};};ami[_0x4abe('0x16')]=function(){return function(){return ami[_0x4abe('0xb')]({'action':_0x4abe('0x17')});};};ami[_0x4abe('0x18')]=function(){return function(){return ami[_0x4abe('0xb')]({'action':_0x4abe('0x19')});};};ami[_0x4abe('0x1a')]=function(){return function(){return ami[_0x4abe('0xb')]({'action':_0x4abe('0x1b')});};};function connect(_0x1dc047){logger[_0x4abe('0x1c')](util[_0x4abe('0xe')](_0x4abe('0x1d'),config['asterisk'][_0x4abe('0x8')],config['asterisk']['ip'],config[_0x4abe('0x6')][_0x4abe('0x7')]));ami[_0x4abe('0x1e')](_0x4abe('0x11'),error);ami[_0x4abe('0x1e')](_0x4abe('0x1f'),close);}ami['on'](_0x4abe('0x20'),connect);ami['on'](_0x4abe('0x21'),function(_0x349505){logger['info'](util[_0x4abe('0xe')](_0x4abe('0x22'),config[_0x4abe('0x6')]['username'],config[_0x4abe('0x6')]['ip'],config[_0x4abe('0x6')][_0x4abe('0x7')],util[_0x4abe('0x10')](_0x349505,![],null)));});ami['on'](_0x4abe('0x23'),function(_0x488012){logger[_0x4abe('0x1c')](util['format']('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x4abe('0x6')][_0x4abe('0x8')],config[_0x4abe('0x6')]['ip'],config['asterisk']['port']));return BPromise[_0x4abe('0x24')]()[_0x4abe('0x25')](ami[_0x4abe('0x13')]())[_0x4abe('0x25')](ami[_0x4abe('0x26')]())[_0x4abe('0x25')](ami[_0x4abe('0x16')]())[_0x4abe('0x25')](ami[_0x4abe('0x18')]())[_0x4abe('0x25')](ami['actionCoreShowChannels']())[_0x4abe('0x27')](function(_0x4e6a47){console[_0x4abe('0x28')](_0x4e6a47);});});ami[_0x4abe('0x1e')](_0x4abe('0x11'),error);ami[_0x4abe('0x1e')]('close',close);module[_0x4abe('0x29')]=ami; \ No newline at end of file +var _0x5462=['coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','error','once','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','actionSipShowRegistry','then','actionQueueSummary','catch','log','close','asterisk-manager','moment','util','lodash','ami','../../config/environment','asterisk','port','keepConnected','Action','username','inspect','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels'];(function(_0x5fd029,_0x3356d8){var _0x399960=function(_0xc41ac6){while(--_0xc41ac6){_0x5fd029['push'](_0x5fd029['shift']());}};_0x399960(++_0x3356d8);}(_0x5462,0x11b));var _0x2546=function(_0x3fd3a3,_0x36c863){_0x3fd3a3=_0x3fd3a3-0x0;var _0xa3e4d5=_0x5462[_0x3fd3a3];return _0xa3e4d5;};'use strict';var Manager=require(_0x2546('0x0'));var BPromise=require('bluebird');var moment=require(_0x2546('0x1'));var util=require(_0x2546('0x2'));var _=require(_0x2546('0x3'));var logger=require('../../config/logger')(_0x2546('0x4'));var config=require(_0x2546('0x5'));var ami=new Manager(config[_0x2546('0x6')][_0x2546('0x7')],config[_0x2546('0x6')]['ip'],config[_0x2546('0x6')]['username'],config[_0x2546('0x6')]['password'],!![]);ami[_0x2546('0x8')]();ami[_0x2546('0x9')]=BPromise['promisify'](ami['action']);function error(_0x3d7b13){logger['error'](util['format']('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x2546('0xa')],config[_0x2546('0x6')]['ip'],config[_0x2546('0x6')][_0x2546('0x7')],util[_0x2546('0xb')](_0x3d7b13,![],null)));}function close(){logger['error'](util[_0x2546('0xc')](_0x2546('0xd'),config['asterisk'][_0x2546('0xa')],config[_0x2546('0x6')]['ip'],config[_0x2546('0x6')][_0x2546('0x7')]));}ami['actionSipShowRegistry']=function(){return function(){return ami['Action']({'action':_0x2546('0xe')});};};ami[_0x2546('0xf')]=function(){return function(){return ami[_0x2546('0x9')]({'action':_0x2546('0x10')});};};ami[_0x2546('0x11')]=function(){return function(){return ami[_0x2546('0x9')]({'action':_0x2546('0x12')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x2546('0x9')]({'action':_0x2546('0x13')});};};ami[_0x2546('0x14')]=function(){return function(){return ami[_0x2546('0x9')]({'action':_0x2546('0x15')});};};function connect(_0x8c8bd5){logger[_0x2546('0x16')](util['format'](_0x2546('0x17'),config['asterisk']['username'],config[_0x2546('0x6')]['ip'],config[_0x2546('0x6')]['port']));ami['once'](_0x2546('0x18'),error);ami[_0x2546('0x19')]('close',close);}ami['on'](_0x2546('0x1a'),connect);ami['on'](_0x2546('0x1b'),function(_0x5e4628){logger[_0x2546('0x16')](util[_0x2546('0xc')](_0x2546('0x1c'),config[_0x2546('0x6')][_0x2546('0xa')],config[_0x2546('0x6')]['ip'],config[_0x2546('0x6')]['port'],util[_0x2546('0xb')](_0x5e4628,![],null)));});ami['on'](_0x2546('0x1d'),function(_0x247361){logger[_0x2546('0x16')](util[_0x2546('0xc')](_0x2546('0x1e'),config['asterisk'][_0x2546('0xa')],config[_0x2546('0x6')]['ip'],config[_0x2546('0x6')][_0x2546('0x7')]));return BPromise[_0x2546('0x1f')]()['then'](ami[_0x2546('0x20')]())[_0x2546('0x21')](ami['actionDeviceStateList']())[_0x2546('0x21')](ami[_0x2546('0x11')]())['then'](ami[_0x2546('0x22')]())[_0x2546('0x21')](ami[_0x2546('0x14')]())[_0x2546('0x23')](function(_0x33d41e){console[_0x2546('0x24')](_0x33d41e);});});ami[_0x2546('0x19')]('error',error);ami['once'](_0x2546('0x25'),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 7321040..7df0577 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1cb0b4,_0x1fd48d){_0x1cb0b4=_0x1cb0b4-0x0;var _0x525b60=_0xcb91[_0x1cb0b4];return _0x525b60;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x324d02,_0x6d9c0b){var _0x3d4f59=function(_0x279f6b){while(--_0x279f6b){_0x324d02['push'](_0x324d02['shift']());}};_0x3d4f59(++_0x6d9c0b);}(_0x9bde,0xe1));var _0xe9bd=function(_0x26ccb4,_0x540aae){_0x26ccb4=_0x26ccb4-0x0;var _0x41d114=_0x9bde[_0x26ccb4];return _0x41d114;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 2d6bad5..c90ee5d 100644 --- a/server/services/ami/dialer/action.js +++ b/server/services/ami/dialer/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcbfb=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callbackuniqueid','callbackat','recallme','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','string','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue','active','type','dialQueueTimeout'];(function(_0x2fbd2b,_0x17c378){var _0x1fa4d0=function(_0x27552c){while(--_0x27552c){_0x2fbd2b['push'](_0x2fbd2b['shift']());}};_0x1fa4d0(++_0x17c378);}(_0xcbfb,0x1a9));var _0xbcbf=function(_0x54b399,_0x3f9425){_0x54b399=_0x54b399-0x0;var _0x221f7f=_0xcbfb[_0x54b399];return _0x221f7f;};'use strict';var util=require('util');var _=require(_0xbcbf('0x0'));var moment=require(_0xbcbf('0x1'));function checkNameSurname(_0x527ce0,_0x3a5c5c,_0xe2dd5d){var _0x12070e='';if(!_['isNil'](_0x3a5c5c)&&_0xbcbf('0x2')===typeof _0x3a5c5c){_0x12070e+=_0x3a5c5c;}if(!_[_0xbcbf('0x3')](_0xe2dd5d)&&_0xbcbf('0x2')===typeof _0xe2dd5d){_0x12070e+='\x20'+_0xe2dd5d;}if(_0x12070e!==''){return _0x12070e;}return _0x527ce0;}function Action(_0x400f70,_0x22f421,_0x16acf5){this[_0xbcbf('0x4')]=_0x400f70;this[_0xbcbf('0x5')]=_0x16acf5||undefined;this[_0xbcbf('0x6')]=checkNameSurname(_0x22f421[_0xbcbf('0x7')][_0xbcbf('0x8')],_0x22f421['Contact'][_0xbcbf('0x9')],_0x22f421['Contact']['lastName']);this[_0xbcbf('0xa')]=_0x22f421['Contact'][_0xbcbf('0x8')];this[_0xbcbf('0xb')]=_0x400f70['name'];this['active']=_0x22f421[_0xbcbf('0xc')]||![];this[_0xbcbf('0xd')]=_0x400f70[_0xbcbf('0xd')];this[_0xbcbf('0xe')]=_0x400f70[_0xbcbf('0xe')]||0x3;this[_0xbcbf('0xf')]=_0x22f421[_0xbcbf('0xf')];this[_0xbcbf('0x10')]=_0x22f421[_0xbcbf('0x10')];this[_0xbcbf('0x11')]=_0x22f421[_0xbcbf('0x11')];this['countnoanswerretry']=_0x22f421[_0xbcbf('0x12')];this[_0xbcbf('0x13')]=_0x22f421[_0xbcbf('0x13')];this[_0xbcbf('0x14')]=_0x22f421['countdropretry'];this['countabandonedretry']=_0x22f421[_0xbcbf('0x15')];this[_0xbcbf('0x16')]=_0x22f421[_0xbcbf('0x16')];this[_0xbcbf('0x17')]=_0x22f421[_0xbcbf('0x17')];this[_0xbcbf('0x18')]=_0x22f421['ContactId'];this[_0xbcbf('0x19')]=_0x22f421[_0xbcbf('0x19')];this[_0xbcbf('0x1a')]=_0x22f421[_0xbcbf('0x1a')];this[_0xbcbf('0x1b')]=_0x22f421['VoiceQueueId'];this[_0xbcbf('0x1c')]=_0x22f421['CampaignId'];this[_0xbcbf('0x1d')]=_0x22f421['id'];this[_0xbcbf('0x1e')]=_0x22f421[_0xbcbf('0x7')][_0xbcbf('0x9')]||'';this[_0xbcbf('0x1f')]=moment()[_0xbcbf('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this['callback']=_0x22f421['callback'];this[_0xbcbf('0x21')]=_0x22f421[_0xbcbf('0x21')];this['callbackat']=_0x22f421[_0xbcbf('0x22')];this[_0xbcbf('0x23')]=_0x22f421[_0xbcbf('0x23')];this['originatecalleridnum']='';this[_0xbcbf('0x24')]='';}Action['prototype'][_0xbcbf('0x25')]=function(){return util['format'](_0xbcbf('0x26'),this[_0xbcbf('0x6')],this[_0xbcbf('0x4')][_0xbcbf('0x27')]>0x0?this[_0xbcbf('0xa')][_0xbcbf('0x28')](this[_0xbcbf('0x4')][_0xbcbf('0x27')]):this['number']);};Action[_0xbcbf('0x29')][_0xbcbf('0x2a')]=function(){return this[_0xbcbf('0xb')];};module[_0xbcbf('0x2b')]=Action; \ No newline at end of file +var _0x0e94=['getQueue','exports','lodash','isNil','string','voiceQueue','uniqueid','name','phone','firstName','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','getCaller','\x22%s\x22\x20<%s>','dialCutDigit'];(function(_0x40b331,_0x43a3e8){var _0x169be0=function(_0x1b25c7){while(--_0x1b25c7){_0x40b331['push'](_0x40b331['shift']());}};_0x169be0(++_0x43a3e8);}(_0x0e94,0x128));var _0x40e9=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x0e94[_0x53ccf2];return _0x5a2964;};'use strict';var util=require('util');var _=require(_0x40e9('0x0'));var moment=require('moment');function checkNameSurname(_0x34795a,_0x573961,_0x1d12b4){var _0x3c4103='';if(!_[_0x40e9('0x1')](_0x573961)&&_0x40e9('0x2')===typeof _0x573961){_0x3c4103+=_0x573961;}if(!_[_0x40e9('0x1')](_0x1d12b4)&&'string'===typeof _0x1d12b4){_0x3c4103+='\x20'+_0x1d12b4;}if(_0x3c4103!==''){return _0x3c4103;}return _0x34795a;}function Action(_0x1241c4,_0x51cc41,_0x3b3959){this[_0x40e9('0x3')]=_0x1241c4;this[_0x40e9('0x4')]=_0x3b3959||undefined;this[_0x40e9('0x5')]=checkNameSurname(_0x51cc41['Contact'][_0x40e9('0x6')],_0x51cc41['Contact'][_0x40e9('0x7')],_0x51cc41[_0x40e9('0x8')][_0x40e9('0x9')]);this[_0x40e9('0xa')]=_0x51cc41[_0x40e9('0x8')][_0x40e9('0x6')];this[_0x40e9('0xb')]=_0x1241c4[_0x40e9('0x5')];this['active']=_0x51cc41[_0x40e9('0xc')]||![];this[_0x40e9('0xd')]=_0x1241c4[_0x40e9('0xd')];this[_0x40e9('0xe')]=_0x1241c4[_0x40e9('0xe')]||0x3;this[_0x40e9('0xf')]=_0x51cc41['scheduledat'];this[_0x40e9('0x10')]=_0x51cc41['countbusyretry'];this[_0x40e9('0x11')]=_0x51cc41[_0x40e9('0x11')];this[_0x40e9('0x12')]=_0x51cc41['countnoanswerretry'];this[_0x40e9('0x13')]=_0x51cc41[_0x40e9('0x13')];this[_0x40e9('0x14')]=_0x51cc41[_0x40e9('0x14')];this[_0x40e9('0x15')]=_0x51cc41[_0x40e9('0x15')];this['countmachineretry']=_0x51cc41[_0x40e9('0x16')];this[_0x40e9('0x17')]=_0x51cc41[_0x40e9('0x17')];this[_0x40e9('0x18')]=_0x51cc41['ContactId'];this[_0x40e9('0x19')]=_0x51cc41[_0x40e9('0x19')];this[_0x40e9('0x1a')]=_0x51cc41[_0x40e9('0x1a')];this[_0x40e9('0x1b')]=_0x51cc41[_0x40e9('0x1b')];this['CampaignId']=_0x51cc41[_0x40e9('0x1c')];this[_0x40e9('0x1d')]=_0x51cc41['id'];this[_0x40e9('0x1e')]=_0x51cc41[_0x40e9('0x8')]['firstName']||'';this[_0x40e9('0x1f')]=moment()[_0x40e9('0x20')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x40e9('0x21')]=_0x51cc41[_0x40e9('0x21')];this[_0x40e9('0x22')]=_0x51cc41[_0x40e9('0x22')];this[_0x40e9('0x23')]=_0x51cc41[_0x40e9('0x23')];this[_0x40e9('0x24')]=_0x51cc41[_0x40e9('0x24')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action['prototype'][_0x40e9('0x25')]=function(){return util[_0x40e9('0x20')](_0x40e9('0x26'),this[_0x40e9('0x5')],this[_0x40e9('0x3')]['dialCutDigit']>0x0?this[_0x40e9('0xa')]['substring'](this['voiceQueue'][_0x40e9('0x27')]):this[_0x40e9('0xa')]);};Action['prototype'][_0x40e9('0x28')]=function(){return this[_0x40e9('0xb')];};module[_0x40e9('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index cf37e21..fba5303 100644 --- a/server/services/ami/dialer/agentComplete.js +++ b/server/services/ami/dialer/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x85ab=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x352923,_0x1b7c4c){var _0x4b93af=function(_0x1f1686){while(--_0x1f1686){_0x352923['push'](_0x352923['shift']());}};_0x4b93af(++_0x1b7c4c);}(_0x85ab,0x1ea));var _0xb85a=function(_0x3fc5e9,_0x21abe9){_0x3fc5e9=_0x3fc5e9-0x0;var _0x1bb03d=_0x85ab[_0x3fc5e9];return _0x1bb03d;};'use strict';var util=require(_0xb85a('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x8def43,_0x38d496){var _0x1e4790=moment(_0x8def43)[_0xb85a('0x1')](0x0);var _0x2f8415=moment(_0x38d496)[_0xb85a('0x1')](0x0);return _0x1e4790[_0xb85a('0x2')](_0x2f8415,_0xb85a('0x3'));}function AgentComplete(_0x293785,_0x396d72){this[_0xb85a('0x4')]=0x4;this[_0xb85a('0x5')]=_0xb85a('0x6');this[_0xb85a('0x7')]=_0x293785[_0xb85a('0x7')];this[_0xb85a('0x8')]=_0x293785[_0xb85a('0x8')];this[_0xb85a('0x9')]=_0x293785[_0xb85a('0x8')]===_0xb85a('0xa')?_0xb85a('0xb'):_0x293785['type'];this[_0xb85a('0xc')]=_0x293785[_0xb85a('0xc')];this[_0xb85a('0xd')]=_0x293785[_0xb85a('0xd')];this[_0xb85a('0xe')]=_0x293785['countnoanswerretry'];this[_0xb85a('0xf')]=_0x293785[_0xb85a('0xc')]+_0x293785[_0xb85a('0xd')]+_0x293785[_0xb85a('0xe')]+_0x293785[_0xb85a('0x10')]+_0x293785[_0xb85a('0x11')]+_0x293785[_0xb85a('0x12')]+_0x293785[_0xb85a('0x13')]+_0x293785['countagentrejectretry'];this[_0xb85a('0x10')]=_0x293785[_0xb85a('0x10')];this[_0xb85a('0x11')]=_0x293785[_0xb85a('0x11')];this[_0xb85a('0x12')]=_0x293785['countabandonedretry'];this[_0xb85a('0x13')]=_0x293785[_0xb85a('0x13')];this[_0xb85a('0x14')]=_0x293785['countagentrejectretry'];this[_0xb85a('0x15')]=_0x396d72['uniqueid'];this['calleridname']=_0x293785[_0xb85a('0x16')];this[_0xb85a('0x17')]=_0x293785[_0xb85a('0x18')];this[_0xb85a('0x19')]=_0x293785['starttime'];this[_0xb85a('0x1a')]=_0x293785[_0xb85a('0x1a')];this['answertime']=_0x293785[_0xb85a('0x1b')];this['endtime']=moment()[_0xb85a('0x1c')](_0xb85a('0x1d'));this['ringtime']=getSeconds(_0x293785[_0xb85a('0x1a')],_0x293785[_0xb85a('0x19')]);this[_0xb85a('0x1e')]=getSeconds(_0x293785[_0xb85a('0x1b')],_0x293785[_0xb85a('0x1a')]);this['talktime']=getSeconds(this[_0xb85a('0x1f')],_0x293785[_0xb85a('0x1b')]);this[_0xb85a('0xb')]=_0x396d72[_0xb85a('0xb')];this[_0xb85a('0x20')]=_0x396d72['membername'];this[_0xb85a('0x21')]=_0x396d72[_0xb85a('0x21')];this[_0xb85a('0x22')]=_0x293785[_0xb85a('0x22')];this[_0xb85a('0x23')]=_0x293785[_0xb85a('0x23')];this[_0xb85a('0x24')]=_0x293785[_0xb85a('0x24')];this[_0xb85a('0x25')]=_0x293785['recallme'];this['ContactId']=_0x293785[_0xb85a('0x26')];this[_0xb85a('0x27')]=_0x293785[_0xb85a('0x27')];this[_0xb85a('0x28')]=_0x293785[_0xb85a('0x28')];this[_0xb85a('0x29')]=_0x293785['VoiceQueueId'];this[_0xb85a('0x2a')]=_0x293785[_0xb85a('0x2a')];this[_0xb85a('0x2b')]=_0x293785['originatecalleridnum']||'';this['originatecalleridname']=_0x293785[_0xb85a('0x2c')]||'';}module[_0xb85a('0x2d')]=AgentComplete; \ No newline at end of file +var _0xb1ef=['countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','answertime','talktime','endtime','queue','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','util','seconds','state','statedesc','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb1ef,0x152));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0xfb1e('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x5730cf,_0x2538d6){var _0x3d49aa=moment(_0x5730cf)['milliseconds'](0x0);var _0x30d7c5=moment(_0x2538d6)['milliseconds'](0x0);return _0x3d49aa['diff'](_0x30d7c5,_0xfb1e('0x1'));}function AgentComplete(_0x2886d9,_0x2b436f){this[_0xfb1e('0x2')]=0x4;this[_0xfb1e('0x3')]='Answer';this[_0xfb1e('0x4')]=_0x2886d9[_0xfb1e('0x4')];this[_0xfb1e('0x5')]=_0x2886d9['type'];this[_0xfb1e('0x6')]=_0x2886d9['type']==='outbound'?'queue':_0x2886d9[_0xfb1e('0x5')];this[_0xfb1e('0x7')]=_0x2886d9[_0xfb1e('0x7')];this[_0xfb1e('0x8')]=_0x2886d9[_0xfb1e('0x8')];this[_0xfb1e('0x9')]=_0x2886d9['countnoanswerretry'];this[_0xfb1e('0xa')]=_0x2886d9[_0xfb1e('0x7')]+_0x2886d9[_0xfb1e('0x8')]+_0x2886d9[_0xfb1e('0x9')]+_0x2886d9[_0xfb1e('0xb')]+_0x2886d9[_0xfb1e('0xc')]+_0x2886d9[_0xfb1e('0xd')]+_0x2886d9['countmachineretry']+_0x2886d9[_0xfb1e('0xe')];this[_0xfb1e('0xb')]=_0x2886d9[_0xfb1e('0xb')];this[_0xfb1e('0xc')]=_0x2886d9['countdropretry'];this[_0xfb1e('0xd')]=_0x2886d9[_0xfb1e('0xd')];this[_0xfb1e('0xf')]=_0x2886d9['countmachineretry'];this[_0xfb1e('0xe')]=_0x2886d9['countagentrejectretry'];this[_0xfb1e('0x10')]=_0x2b436f['uniqueid'];this['calleridname']=_0x2886d9['name'];this[_0xfb1e('0x11')]=_0x2886d9[_0xfb1e('0x12')];this[_0xfb1e('0x13')]=_0x2886d9[_0xfb1e('0x13')];this[_0xfb1e('0x14')]=_0x2886d9['responsetime'];this['answertime']=_0x2886d9['answertime'];this['endtime']=moment()[_0xfb1e('0x15')](_0xfb1e('0x16'));this[_0xfb1e('0x17')]=getSeconds(_0x2886d9['responsetime'],_0x2886d9['starttime']);this['holdtime']=getSeconds(_0x2886d9[_0xfb1e('0x18')],_0x2886d9[_0xfb1e('0x14')]);this[_0xfb1e('0x19')]=getSeconds(this[_0xfb1e('0x1a')],_0x2886d9['answertime']);this['queue']=_0x2b436f[_0xfb1e('0x1b')];this['membername']=_0x2b436f['membername'];this[_0xfb1e('0x1c')]=_0x2b436f[_0xfb1e('0x1c')];this[_0xfb1e('0x1d')]=_0x2886d9[_0xfb1e('0x1d')];this[_0xfb1e('0x1e')]=_0x2886d9[_0xfb1e('0x1e')];this[_0xfb1e('0x1f')]=_0x2886d9[_0xfb1e('0x1f')];this['recallme']=_0x2886d9[_0xfb1e('0x20')];this[_0xfb1e('0x21')]=_0x2886d9[_0xfb1e('0x21')];this[_0xfb1e('0x22')]=_0x2886d9[_0xfb1e('0x22')];this[_0xfb1e('0x23')]=_0x2886d9[_0xfb1e('0x23')];this['VoiceQueueId']=_0x2886d9['VoiceQueueId'];this[_0xfb1e('0x24')]=_0x2886d9[_0xfb1e('0x24')];this[_0xfb1e('0x25')]=_0x2886d9[_0xfb1e('0x25')]||'';this[_0xfb1e('0x26')]=_0x2886d9[_0xfb1e('0x26')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 165c9f8..7ed2b7c 100644 --- a/server/services/ami/dialer/final.js +++ b/server/services/ami/dialer/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4f0d=['campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','milliseconds','diff','uniqueid','scheduledat','type'];(function(_0x1abef8,_0x435184){var _0x440a4d=function(_0x47e06b){while(--_0x47e06b){_0x1abef8['push'](_0x1abef8['shift']());}};_0x440a4d(++_0x435184);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0x4f0d[_0x4c7935];return _0x30651d;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function getSeconds(_0x5290b6,_0x5cd109){var _0xc4d56b=moment(_0x5290b6)[_0xd4f0('0x0')](0x0);var _0x216b0d=moment(_0x5cd109)['milliseconds'](0x0);return _0xc4d56b[_0xd4f0('0x1')](_0x216b0d,'seconds');}function Final(_0x501b8f){this[_0xd4f0('0x2')]=_0x501b8f['uniqueid'];this[_0xd4f0('0x3')]=_0x501b8f[_0xd4f0('0x3')];this['type']=_0x501b8f[_0xd4f0('0x4')];this[_0xd4f0('0x5')]=_0x501b8f[_0xd4f0('0x4')]===_0xd4f0('0x6')?_0xd4f0('0x7'):_0x501b8f['type'];this[_0xd4f0('0x8')]=_0x501b8f[_0xd4f0('0x8')];this['countcongestionretry']=_0x501b8f['countcongestionretry'];this[_0xd4f0('0x9')]=_0x501b8f[_0xd4f0('0x9')];this['countglobal']=_0x501b8f[_0xd4f0('0x8')]+_0x501b8f[_0xd4f0('0xa')]+_0x501b8f[_0xd4f0('0x9')]+_0x501b8f[_0xd4f0('0xb')]+_0x501b8f[_0xd4f0('0xc')]+_0x501b8f['countabandonedretry']+_0x501b8f[_0xd4f0('0xd')]+_0x501b8f[_0xd4f0('0xe')];this[_0xd4f0('0xb')]=_0x501b8f[_0xd4f0('0xb')];this[_0xd4f0('0xc')]=_0x501b8f[_0xd4f0('0xc')];this[_0xd4f0('0xf')]=_0x501b8f[_0xd4f0('0xf')];this[_0xd4f0('0xd')]=_0x501b8f[_0xd4f0('0xd')];this[_0xd4f0('0xe')]=_0x501b8f[_0xd4f0('0xe')];this['queue']=_0x501b8f['queue'];this[_0xd4f0('0x10')]=_0x501b8f[_0xd4f0('0x10')];this[_0xd4f0('0x11')]=_0x501b8f[_0xd4f0('0x11')];this['starttime']=_0x501b8f['starttime'];this[_0xd4f0('0x12')]=_0x501b8f[_0xd4f0('0x12')];this[_0xd4f0('0x13')]=_0x501b8f[_0xd4f0('0x12')];this[_0xd4f0('0x14')]=_0x501b8f[_0xd4f0('0x14')]||0x0;this[_0xd4f0('0x15')]=_0x501b8f[_0xd4f0('0x15')]||0x0;this[_0xd4f0('0x16')]=_0x501b8f[_0xd4f0('0x16')]||0x0;this['callback']=_0x501b8f[_0xd4f0('0x17')];this[_0xd4f0('0x18')]=_0x501b8f[_0xd4f0('0x18')];this['callbackat']=_0x501b8f[_0xd4f0('0x19')];this[_0xd4f0('0x1a')]=_0x501b8f[_0xd4f0('0x1a')];this['ContactId']=_0x501b8f[_0xd4f0('0x1b')];this[_0xd4f0('0x1c')]=_0x501b8f[_0xd4f0('0x1c')];this[_0xd4f0('0x1d')]=_0x501b8f['UserId'];this[_0xd4f0('0x1e')]=_0x501b8f[_0xd4f0('0x1e')];this[_0xd4f0('0x1f')]=_0x501b8f[_0xd4f0('0x1f')];this['originatecalleridnum']=_0x501b8f[_0xd4f0('0x20')]||'';this['originatecalleridname']=_0x501b8f[_0xd4f0('0x21')]||'';}module[_0xd4f0('0x22')]=Final; \ No newline at end of file +var _0x7fbe=['talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','CampaignId','originatecalleridnum','originatecalleridname','exports','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime'];(function(_0x3ee7e2,_0x15cf09){var _0x1c1f18=function(_0x3426e0){while(--_0x3426e0){_0x3ee7e2['push'](_0x3ee7e2['shift']());}};_0x1c1f18(++_0x15cf09);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x56fb02,_0x179d7a){_0x56fb02=_0x56fb02-0x0;var _0x177f5b=_0x7fbe[_0x56fb02];return _0x177f5b;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xe7fb('0x0'));function getSeconds(_0x183779,_0x294c21){var _0x1703d5=moment(_0x183779)[_0xe7fb('0x1')](0x0);var _0x47625b=moment(_0x294c21)[_0xe7fb('0x1')](0x0);return _0x1703d5[_0xe7fb('0x2')](_0x47625b,_0xe7fb('0x3'));}function Final(_0x5dbf04){this[_0xe7fb('0x4')]=_0x5dbf04[_0xe7fb('0x4')];this[_0xe7fb('0x5')]=_0x5dbf04[_0xe7fb('0x5')];this['type']=_0x5dbf04[_0xe7fb('0x6')];this[_0xe7fb('0x7')]=_0x5dbf04[_0xe7fb('0x6')]===_0xe7fb('0x8')?'queue':_0x5dbf04['type'];this[_0xe7fb('0x9')]=_0x5dbf04[_0xe7fb('0x9')];this[_0xe7fb('0xa')]=_0x5dbf04[_0xe7fb('0xa')];this[_0xe7fb('0xb')]=_0x5dbf04[_0xe7fb('0xb')];this[_0xe7fb('0xc')]=_0x5dbf04[_0xe7fb('0x9')]+_0x5dbf04[_0xe7fb('0xa')]+_0x5dbf04[_0xe7fb('0xb')]+_0x5dbf04[_0xe7fb('0xd')]+_0x5dbf04[_0xe7fb('0xe')]+_0x5dbf04[_0xe7fb('0xf')]+_0x5dbf04[_0xe7fb('0x10')]+_0x5dbf04[_0xe7fb('0x11')];this['countnosuchnumberretry']=_0x5dbf04[_0xe7fb('0xd')];this[_0xe7fb('0xe')]=_0x5dbf04['countdropretry'];this[_0xe7fb('0xf')]=_0x5dbf04[_0xe7fb('0xf')];this['countmachineretry']=_0x5dbf04[_0xe7fb('0x10')];this['countagentrejectretry']=_0x5dbf04[_0xe7fb('0x11')];this[_0xe7fb('0x12')]=_0x5dbf04[_0xe7fb('0x12')];this[_0xe7fb('0x13')]=_0x5dbf04['calleridname'];this[_0xe7fb('0x14')]=_0x5dbf04['calleridnum'];this[_0xe7fb('0x15')]=_0x5dbf04['starttime'];this[_0xe7fb('0x16')]=_0x5dbf04[_0xe7fb('0x16')];this[_0xe7fb('0x17')]=_0x5dbf04[_0xe7fb('0x16')];this['ringtime']=_0x5dbf04[_0xe7fb('0x18')]||0x0;this['holdtime']=_0x5dbf04[_0xe7fb('0x19')]||0x0;this['talktime']=_0x5dbf04[_0xe7fb('0x1a')]||0x0;this['callback']=_0x5dbf04[_0xe7fb('0x1b')];this[_0xe7fb('0x1c')]=_0x5dbf04['callbackuniqueid'];this[_0xe7fb('0x1d')]=_0x5dbf04[_0xe7fb('0x1d')];this[_0xe7fb('0x1e')]=_0x5dbf04['recallme'];this[_0xe7fb('0x1f')]=_0x5dbf04[_0xe7fb('0x1f')];this['ListId']=_0x5dbf04['ListId'];this['UserId']=_0x5dbf04[_0xe7fb('0x20')];this['VoiceQueueId']=_0x5dbf04['VoiceQueueId'];this[_0xe7fb('0x21')]=_0x5dbf04[_0xe7fb('0x21')];this[_0xe7fb('0x22')]=_0x5dbf04['originatecalleridnum']||'';this[_0xe7fb('0x23')]=_0x5dbf04[_0xe7fb('0x23')]||'';}module[_0xe7fb('0x24')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index cef55ae..aba1248 100644 --- a/server/services/ami/dialer/hangup.js +++ b/server/services/ami/dialer/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x452b=['name','calleridnum','number','starttime','responsetime','YYYY-MM-DD\x20HH:mm:ss','holdtime','endtime','membername','IVR','reason','cause-txt','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname'];(function(_0x21f3b2,_0x1b7b34){var _0x47717d=function(_0x508c32){while(--_0x508c32){_0x21f3b2['push'](_0x21f3b2['shift']());}};_0x47717d(++_0x1b7b34);}(_0x452b,0x66));var _0xb452=function(_0x5a9841,_0x950566){_0x5a9841=_0x5a9841-0x0;var _0xb4f748=_0x452b[_0x5a9841];return _0xb4f748;};'use strict';var util=require(_0xb452('0x0'));var _=require(_0xb452('0x1'));var moment=require(_0xb452('0x2'));function getSeconds(_0x25534a,_0x3b85fe){var _0x365b9c=moment(_0x25534a)['milliseconds'](0x0);var _0x1d4d5f=moment(_0x3b85fe)[_0xb452('0x3')](0x0);return _0x365b9c[_0xb452('0x4')](_0x1d4d5f,_0xb452('0x5'));}function Hangup(_0x1c17fc,_0xecd18f){this['state']=0x4;this[_0xb452('0x6')]='Answer';this[_0xb452('0x7')]=_0x1c17fc[_0xb452('0x7')];this['type']=_0x1c17fc[_0xb452('0x8')];this['campaigntype']=_0x1c17fc[_0xb452('0x8')]==='outbound'?_0xb452('0x9'):_0x1c17fc[_0xb452('0x8')];this[_0xb452('0xa')]=_0x1c17fc[_0xb452('0xa')];this[_0xb452('0xb')]=_0x1c17fc['countcongestionretry'];this['countnoanswerretry']=_0x1c17fc[_0xb452('0xc')];this[_0xb452('0xd')]=_0x1c17fc[_0xb452('0xa')]+_0x1c17fc['countcongestionretry']+_0x1c17fc[_0xb452('0xc')]+_0x1c17fc[_0xb452('0xe')]+_0x1c17fc[_0xb452('0xf')]+_0x1c17fc[_0xb452('0x10')]+_0x1c17fc[_0xb452('0x11')]+_0x1c17fc['countagentrejectretry'];this['countnosuchnumberretry']=_0x1c17fc[_0xb452('0xe')];this[_0xb452('0xf')]=_0x1c17fc[_0xb452('0xf')];this[_0xb452('0x10')]=_0x1c17fc[_0xb452('0x10')];this[_0xb452('0x11')]=_0x1c17fc['countmachineretry'];this[_0xb452('0x12')]=_0x1c17fc['countagentrejectretry'];this[_0xb452('0x13')]=_0xecd18f['uniqueid'];this[_0xb452('0x14')]=_0x1c17fc[_0xb452('0x15')];this[_0xb452('0x16')]=_0x1c17fc[_0xb452('0x17')];this[_0xb452('0x18')]=_0x1c17fc[_0xb452('0x18')];this['responsetime']=_0x1c17fc[_0xb452('0x19')];this['endtime']=moment()['format'](_0xb452('0x1a'));this['ringtime']=getSeconds(_0x1c17fc[_0xb452('0x19')],_0x1c17fc[_0xb452('0x18')]);this[_0xb452('0x1b')]=0x0;this['talktime']=getSeconds(this[_0xb452('0x1c')],_0x1c17fc[_0xb452('0x19')]);this[_0xb452('0x9')]=_0x1c17fc[_0xb452('0x9')];this[_0xb452('0x1d')]=_0xb452('0x1e');this[_0xb452('0x1f')]=_0xecd18f[_0xb452('0x20')];this['callback']=_0x1c17fc['callback'];this[_0xb452('0x21')]=_0x1c17fc[_0xb452('0x21')];this['callbackat']=_0x1c17fc[_0xb452('0x22')];this['recallme']=_0x1c17fc['recallme'];this[_0xb452('0x23')]=_0x1c17fc[_0xb452('0x23')];this[_0xb452('0x24')]=_0x1c17fc[_0xb452('0x24')];this[_0xb452('0x25')]=_0x1c17fc['UserId'];this[_0xb452('0x26')]=_0x1c17fc[_0xb452('0x26')];this[_0xb452('0x27')]=_0x1c17fc['CampaignId'];}module[_0xb452('0x28')]=Hangup; \ No newline at end of file +var _0x75d3=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','util','moment','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound'];(function(_0x5beda8,_0x1e8554){var _0x2aa042=function(_0x510f45){while(--_0x510f45){_0x5beda8['push'](_0x5beda8['shift']());}};_0x2aa042(++_0x1e8554);}(_0x75d3,0x1c1));var _0x375d=function(_0x5391db,_0x6ed25a){_0x5391db=_0x5391db-0x0;var _0x2f2b8f=_0x75d3[_0x5391db];return _0x2f2b8f;};'use strict';var util=require(_0x375d('0x0'));var _=require('lodash');var moment=require(_0x375d('0x1'));function getSeconds(_0x34f72d,_0x28d8f3){var _0x43fb01=moment(_0x34f72d)['milliseconds'](0x0);var _0xcff0b1=moment(_0x28d8f3)['milliseconds'](0x0);return _0x43fb01[_0x375d('0x2')](_0xcff0b1,_0x375d('0x3'));}function Hangup(_0x1915d4,_0x392886){this[_0x375d('0x4')]=0x4;this[_0x375d('0x5')]=_0x375d('0x6');this['scheduledat']=_0x1915d4[_0x375d('0x7')];this[_0x375d('0x8')]=_0x1915d4[_0x375d('0x8')];this[_0x375d('0x9')]=_0x1915d4[_0x375d('0x8')]===_0x375d('0xa')?_0x375d('0xb'):_0x1915d4[_0x375d('0x8')];this[_0x375d('0xc')]=_0x1915d4[_0x375d('0xc')];this[_0x375d('0xd')]=_0x1915d4['countcongestionretry'];this[_0x375d('0xe')]=_0x1915d4[_0x375d('0xe')];this[_0x375d('0xf')]=_0x1915d4[_0x375d('0xc')]+_0x1915d4['countcongestionretry']+_0x1915d4[_0x375d('0xe')]+_0x1915d4['countnosuchnumberretry']+_0x1915d4['countdropretry']+_0x1915d4[_0x375d('0x10')]+_0x1915d4[_0x375d('0x11')]+_0x1915d4['countagentrejectretry'];this[_0x375d('0x12')]=_0x1915d4['countnosuchnumberretry'];this[_0x375d('0x13')]=_0x1915d4['countdropretry'];this[_0x375d('0x10')]=_0x1915d4[_0x375d('0x10')];this['countmachineretry']=_0x1915d4[_0x375d('0x11')];this['countagentrejectretry']=_0x1915d4[_0x375d('0x14')];this[_0x375d('0x15')]=_0x392886[_0x375d('0x15')];this['calleridname']=_0x1915d4[_0x375d('0x16')];this[_0x375d('0x17')]=_0x1915d4[_0x375d('0x18')];this[_0x375d('0x19')]=_0x1915d4[_0x375d('0x19')];this['responsetime']=_0x1915d4[_0x375d('0x1a')];this[_0x375d('0x1b')]=moment()[_0x375d('0x1c')](_0x375d('0x1d'));this[_0x375d('0x1e')]=getSeconds(_0x1915d4[_0x375d('0x1a')],_0x1915d4['starttime']);this[_0x375d('0x1f')]=0x0;this[_0x375d('0x20')]=getSeconds(this[_0x375d('0x1b')],_0x1915d4[_0x375d('0x1a')]);this[_0x375d('0xb')]=_0x1915d4[_0x375d('0xb')];this[_0x375d('0x21')]=_0x375d('0x22');this[_0x375d('0x23')]=_0x392886[_0x375d('0x24')];this['callback']=_0x1915d4[_0x375d('0x25')];this['callbackuniqueid']=_0x1915d4[_0x375d('0x26')];this[_0x375d('0x27')]=_0x1915d4['callbackat'];this['recallme']=_0x1915d4[_0x375d('0x28')];this[_0x375d('0x29')]=_0x1915d4['ContactId'];this[_0x375d('0x2a')]=_0x1915d4[_0x375d('0x2a')];this[_0x375d('0x2b')]=_0x1915d4[_0x375d('0x2b')];this[_0x375d('0x2c')]=_0x1915d4[_0x375d('0x2c')];this['CampaignId']=_0x1915d4['CampaignId'];}module[_0x375d('0x2d')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index ea0846d..faf0c41 100644 --- a/server/services/ami/dialer/history.js +++ b/server/services/ami/dialer/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd751=['ringtime','starttime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','moment','diff','seconds','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','responsetime'];(function(_0x2516f2,_0x36d7a0){var _0x2d396c=function(_0x34871c){while(--_0x34871c){_0x2516f2['push'](_0x2516f2['shift']());}};_0x2d396c(++_0x36d7a0);}(_0xd751,0x79));var _0x1d75=function(_0x1ee293,_0x465cda){_0x1ee293=_0x1ee293-0x0;var _0x161342=_0xd751[_0x1ee293];return _0x161342;};'use strict';var util=require(_0x1d75('0x0'));var _=require('lodash');var moment=require(_0x1d75('0x1'));function getSeconds(_0x216e27,_0x196409){var _0x109ea5=moment(_0x216e27)['milliseconds'](0x0);var _0x1fdd67=moment(_0x196409)['milliseconds'](0x0);return _0x109ea5[_0x1d75('0x2')](_0x1fdd67,_0x1d75('0x3'));}function History(_0x554047){this[_0x1d75('0x4')]=_0x554047[_0x1d75('0x4')];this[_0x1d75('0x5')]=_0x554047['scheduledat']||undefined;this['type']=_0x554047[_0x1d75('0x6')];this['campaigntype']=_0x554047[_0x1d75('0x6')]===_0x1d75('0x7')?_0x1d75('0x8'):_0x554047[_0x1d75('0x6')];this[_0x1d75('0x9')]=_0x554047[_0x1d75('0x9')];this[_0x1d75('0xa')]=_0x554047[_0x1d75('0xa')];this[_0x1d75('0xb')]=_0x554047[_0x1d75('0xb')];this[_0x1d75('0xc')]=_0x554047[_0x1d75('0x9')]+_0x554047[_0x1d75('0xa')]+_0x554047[_0x1d75('0xb')]+_0x554047[_0x1d75('0xd')]+_0x554047[_0x1d75('0xe')]+_0x554047['countabandonedretry']+_0x554047[_0x1d75('0xf')]+_0x554047[_0x1d75('0x10')];this[_0x1d75('0xd')]=_0x554047[_0x1d75('0xd')];this[_0x1d75('0xe')]=_0x554047[_0x1d75('0xe')];this[_0x1d75('0x11')]=_0x554047['countabandonedretry'];this[_0x1d75('0xf')]=_0x554047[_0x1d75('0xf')];this[_0x1d75('0x10')]=_0x554047[_0x1d75('0x10')];this[_0x1d75('0x8')]=_0x554047[_0x1d75('0x8')];this['calleridname']=_0x554047['name'];this['calleridnum']=_0x554047['number'];this['starttime']=_0x554047['starttime'];this[_0x1d75('0x12')]=_0x554047[_0x1d75('0x12')];this['endtime']=_0x554047[_0x1d75('0x12')];this[_0x1d75('0x13')]=getSeconds(_0x554047[_0x1d75('0x12')],_0x554047[_0x1d75('0x14')]);this[_0x1d75('0x15')]=0x0;this[_0x1d75('0x16')]=0x0;this[_0x1d75('0x17')]=_0x554047[_0x1d75('0x17')];this['callbackuniqueid']=_0x554047[_0x1d75('0x18')];this[_0x1d75('0x19')]=_0x554047['callbackat'];this[_0x1d75('0x1a')]=_0x554047[_0x1d75('0x1a')];this[_0x1d75('0x1b')]=_0x554047[_0x1d75('0x1b')];this[_0x1d75('0x1c')]=_0x554047[_0x1d75('0x1c')];this[_0x1d75('0x1d')]=_0x554047[_0x1d75('0x1d')];this[_0x1d75('0x1e')]=_0x554047[_0x1d75('0x1e')];this[_0x1d75('0x1f')]=_0x554047[_0x1d75('0x1f')];this[_0x1d75('0x20')]=_0x554047[_0x1d75('0x20')]||'';this['originatecalleridname']=_0x554047[_0x1d75('0x21')]||'';}module[_0x1d75('0x22')]=History; \ No newline at end of file +var _0x8cb7=['countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry'];(function(_0x3c9f26,_0x8cd2f0){var _0x4eef8b=function(_0x45d10f){while(--_0x45d10f){_0x3c9f26['push'](_0x3c9f26['shift']());}};_0x4eef8b(++_0x8cd2f0);}(_0x8cb7,0x6c));var _0x78cb=function(_0x3b90ab,_0x174a22){_0x3b90ab=_0x3b90ab-0x0;var _0x206e92=_0x8cb7[_0x3b90ab];return _0x206e92;};'use strict';var util=require(_0x78cb('0x0'));var _=require(_0x78cb('0x1'));var moment=require(_0x78cb('0x2'));function getSeconds(_0x5ccda9,_0x10fb14){var _0x6bf78c=moment(_0x5ccda9)[_0x78cb('0x3')](0x0);var _0x495bad=moment(_0x10fb14)[_0x78cb('0x3')](0x0);return _0x6bf78c['diff'](_0x495bad,_0x78cb('0x4'));}function History(_0x5b83e0){this[_0x78cb('0x5')]=_0x5b83e0[_0x78cb('0x5')];this[_0x78cb('0x6')]=_0x5b83e0[_0x78cb('0x6')]||undefined;this[_0x78cb('0x7')]=_0x5b83e0[_0x78cb('0x7')];this[_0x78cb('0x8')]=_0x5b83e0[_0x78cb('0x7')]===_0x78cb('0x9')?_0x78cb('0xa'):_0x5b83e0[_0x78cb('0x7')];this['countbusyretry']=_0x5b83e0['countbusyretry'];this['countcongestionretry']=_0x5b83e0[_0x78cb('0xb')];this['countnoanswerretry']=_0x5b83e0[_0x78cb('0xc')];this[_0x78cb('0xd')]=_0x5b83e0[_0x78cb('0xe')]+_0x5b83e0[_0x78cb('0xb')]+_0x5b83e0[_0x78cb('0xc')]+_0x5b83e0[_0x78cb('0xf')]+_0x5b83e0[_0x78cb('0x10')]+_0x5b83e0['countabandonedretry']+_0x5b83e0[_0x78cb('0x11')]+_0x5b83e0['countagentrejectretry'];this[_0x78cb('0xf')]=_0x5b83e0[_0x78cb('0xf')];this[_0x78cb('0x10')]=_0x5b83e0[_0x78cb('0x10')];this[_0x78cb('0x12')]=_0x5b83e0[_0x78cb('0x12')];this['countmachineretry']=_0x5b83e0[_0x78cb('0x11')];this['countagentrejectretry']=_0x5b83e0[_0x78cb('0x13')];this[_0x78cb('0xa')]=_0x5b83e0[_0x78cb('0xa')];this[_0x78cb('0x14')]=_0x5b83e0[_0x78cb('0x15')];this[_0x78cb('0x16')]=_0x5b83e0[_0x78cb('0x17')];this['starttime']=_0x5b83e0[_0x78cb('0x18')];this['responsetime']=_0x5b83e0[_0x78cb('0x19')];this[_0x78cb('0x1a')]=_0x5b83e0[_0x78cb('0x19')];this[_0x78cb('0x1b')]=getSeconds(_0x5b83e0[_0x78cb('0x19')],_0x5b83e0[_0x78cb('0x18')]);this['holdtime']=0x0;this[_0x78cb('0x1c')]=0x0;this[_0x78cb('0x1d')]=_0x5b83e0[_0x78cb('0x1d')];this[_0x78cb('0x1e')]=_0x5b83e0[_0x78cb('0x1e')];this[_0x78cb('0x1f')]=_0x5b83e0['callbackat'];this['recallme']=_0x5b83e0[_0x78cb('0x20')];this['ContactId']=_0x5b83e0[_0x78cb('0x21')];this['ListId']=_0x5b83e0[_0x78cb('0x22')];this[_0x78cb('0x23')]=_0x5b83e0[_0x78cb('0x23')];this[_0x78cb('0x24')]=_0x5b83e0[_0x78cb('0x24')];this[_0x78cb('0x25')]=_0x5b83e0[_0x78cb('0x25')];this[_0x78cb('0x26')]=_0x5b83e0[_0x78cb('0x26')]||'';this[_0x78cb('0x27')]=_0x5b83e0[_0x78cb('0x27')]||'';}module[_0x78cb('0x28')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index d3144f6..7d0fbf4 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 _0xf17f=['AMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countagentrejectretry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','agent','dialQueueProject2','[syncAgentComplete][createHistory]','syncAgentConnect','answertime','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dropreason','TIMEOUT','agiafterat','dialDropMaxRetry','queueCallerAbandonCreateState','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','endtime','[syncAgentComplete][createHistory][11]','syncNewExten','actionid','paused','stateinterface','locked','queueStatusComplete','[unlockQueueStatus][undefined]','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','[booked][RR][finaly]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','interval','content','indexOf','command','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','Global:\x20','Timezone:\x20','progressive','handlePower','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','dialActive','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','dialAgiAfterHangupAgent','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','tags','createdAt','updatedAt','%s%s','toUpper','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','getQueue','response','callProgressDetecting','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropRetryFrequency','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason','[syncAgentComplete][createHistory][?]','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','busyFactor','floor','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','dialRecallInQueue','RECALLINQUEUE','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','[Originate][MoveBlacklist]','limitCalls','maxNumberOriginate','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','push','[countReScheduled]\x20','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','util','lodash','bluebird','moment','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./final','./agentComplete','./queueCallerAbandon','env','XCALLY_IP_AGI','rrmemory','roundrobin','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','contactsId','optionPredictive','startPredictive','startProgressive','queueBooked','queueBookedRR','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','Error','stringify','milliseconds','seconds','emit','type','outbound','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','unmanaged','abandoned','waiting','dialMethod','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','md5','format','voice:queue:%s','voice_queue:save','ivr','campaign:ivr:%s','campaign:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','info','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','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','diff','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','preview','\x22%s\x22\x20<%s>','error','stack','inspect','length','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','AVAILABLE_CONTACTS_FINISHED','talking','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20disactive','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','IS_DISACTIVED','state','statedesc','starttime','clearZombieChannels','[uniqueid]','actions','prototype','enqueue','isNil','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel][ivr]','then','countReScheduled','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','saveInDb','pick','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','reachable','SIP/%s','unmonitored','uniqueId','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','HangupInAMD','membername','custom:amd','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countglobal','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','ContactId','[rescheduleContact][Machine]'];(function(_0x5662ce,_0x4a5dcf){var _0x2ef963=function(_0x17a899){while(--_0x17a899){_0x5662ce['push'](_0x5662ce['shift']());}};_0x2ef963(++_0x4a5dcf);}(_0xf17f,0x113));var _0xff17=function(_0x2aaeac,_0x30bda5){_0x2aaeac=_0x2aaeac-0x0;var _0x757741=_0xf17f[_0x2aaeac];return _0x757741;};'use strict';var util=require(_0xff17('0x0'));var _=require(_0xff17('0x1'));var BPromise=require(_0xff17('0x2'));var uuid=require('uuid');var moment=require(_0xff17('0x3'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0xff17('0x4'));var config=require(_0xff17('0x5'));var logger=require(_0xff17('0x6'))(_0xff17('0x7'));var loggerBooked=require('../../../config/logger')(_0xff17('0x8'));var loggerPredictive=require(_0xff17('0x6'))('predictive');var loggerPredictiveCalls=require(_0xff17('0x6'))(_0xff17('0x9'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xff17('0xa'));var ami=require(_0xff17('0xb'));config[_0xff17('0xc')]=_['defaults'](config[_0xff17('0xc')],{'host':_0xff17('0xd'),'port':0x18eb});var io=require(_0xff17('0xe'))(new Redis(config['redis']));var cmHopper=require(_0xff17('0xf'));var cmHopperHistory=require(_0xff17('0x10'));var cmHopperBlack=require(_0xff17('0x11'));var voiceQueueRt=require(_0xff17('0x12'));var Action=require('./action');var History=require('./history');var Final=require(_0xff17('0x13'));var AgentComplete=require(_0xff17('0x14'));var QueueCallerAbandon=require(_0xff17('0x15'));var Hangup=require('./hangup');var ipAgi=process[_0xff17('0x16')][_0xff17('0x17')]||'127.0.0.1';var strategy={'rrmemory':_0xff17('0x18'),'roundrobin':_0xff17('0x19')};var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x53f625){this[_0xff17('0x1a')]=this['tail']?this[_0xff17('0x1a')][_0xff17('0x1b')](_0x53f625):_0x53f625();};function Dialer(_0x249641,_0x290c1c){this[_0xff17('0x1c')]=new Sequence();this['preview']=_0x290c1c;this[_0xff17('0x1d')]=_0x249641[_0xff17('0x1d')];this[_0xff17('0x1e')]=_0x249641['campaigns'];this['agents']=_0x249641[_0xff17('0x1f')];this[_0xff17('0x20')]=_0x249641[_0xff17('0x20')];this['maxNumberOriginate']=config['maxNumberOriginate']||0x2;this['channels']={};this['actions']={};this[_0xff17('0x21')]={};this['uniqueId']={};this[_0xff17('0x22')]={};this[_0xff17('0x23')]={};this[_0xff17('0x24')]={};this['ivrOriginated']={};this[_0xff17('0x25')]={};this[_0xff17('0x26')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xff17('0x27')](this));ami['on'](_0xff17('0x28'),this[_0xff17('0x29')]['bind'](this));ami['on']('originateresponse',this[_0xff17('0x2a')][_0xff17('0x27')](this));ami['on'](_0xff17('0x2b'),this[_0xff17('0x2c')]['bind'](this));ami['on'](_0xff17('0x2d'),this[_0xff17('0xa')]['bind'](this));ami['on'](_0xff17('0x2e'),this[_0xff17('0x2f')]['bind'](this));ami['on'](_0xff17('0x30'),this['syncNewExten']['bind'](this));ami['on']('varset',this[_0xff17('0x31')][_0xff17('0x27')](this));ami['on'](_0xff17('0x32'),this[_0xff17('0x33')][_0xff17('0x27')](this));ami['on'](_0xff17('0x34'),this[_0xff17('0x35')][_0xff17('0x27')](this));this[_0xff17('0x36')]();this[_0xff17('0x37')]();}function isNotNull(_0x52f588){return _0x52f588!==null&&!_[_0xff17('0x38')](_0x52f588);}function checkIsLoggedIn(_0x7d745a,_0x2fe2bc){return function(){if(_0x2fe2bc<=0x0){_0x7d745a[_0xff17('0x39')]=_0xff17('0x3a');throw _0x7d745a[_0xff17('0x3b')]+_0xff17('0x3c');}};}function isActive(_0x3dc73c){return _0x3dc73c;}function checkIsActive(_0x4642e6,_0x4305f2){return function(){if(!isActive(_0x4305f2)){_0x4642e6[_0xff17('0x39')]=_0xff17('0x3d');throw _0x4642e6[_0xff17('0x3b')]+_0xff17('0x3e');}};}function checkInterval(_0x40b035){return function(){if(!isNotNull(_0x40b035[_0xff17('0x3f')])){_0x40b035[_0xff17('0x39')]=_0xff17('0x40');throw _0x40b035[_0xff17('0x3b')]+_0xff17('0x41');}if(!isNotNull(_0x40b035['Interval'][_0xff17('0x42')])){_0x40b035[_0xff17('0x39')]=_0xff17('0x40');throw _0x40b035['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_['isEmpty'](_0x40b035['Interval'][_0xff17('0x42')]))){_0x40b035[_0xff17('0x39')]='INTERVAL_IS_NULL';throw _0x40b035[_0xff17('0x3b')]+_0xff17('0x41');}};}function msgResponse(_0x5e6504,_0x3cbadd,_0x1e30b2){return{'action':_0x5e6504,'response':_0x3cbadd,'message':_0x1e30b2,'stack':_0x1e30b2};}function myreject(_0x3fe045){return function(_0x4daa4e){return _0x3fe045(msgResponse('[ifTime][Action]',_0xff17('0x43'),JSON[_0xff17('0x44')](_0x4daa4e)));};}function getSeconds(_0x43a562,_0x11ff46){var _0x18a27=moment(_0x43a562)['milliseconds'](0x0);var _0x5f4cc1=moment(_0x11ff46)[_0xff17('0x45')](0x0);return _0x18a27['diff'](_0x5f4cc1,_0xff17('0x46'));}function emit(_0x5b9e03,_0x52fcf3,_0x1fd209){io['to'](_0x5b9e03)[_0xff17('0x47')](_0x52fcf3,_0x1fd209);}function emitVoiceQueueSummary(_0x140dfa){if(_0x140dfa[_0xff17('0x48')]===_0xff17('0x49')){var _0x4a6bfd={'id':_0x140dfa['id'],'name':_0x140dfa[_0xff17('0x3b')],'strategy':_0x140dfa[_0xff17('0x4a')],'answered':_0x140dfa['answered'],'available':_0x140dfa[_0xff17('0x4b')],'loggedIn':_0x140dfa[_0xff17('0x4c')],'pTalking':_0x140dfa[_0xff17('0x4d')],'sumBillable':_0x140dfa[_0xff17('0x4e')],'sumDuration':_0x140dfa[_0xff17('0x4f')],'sumHoldTime':_0x140dfa['sumHoldTime']||0x0,'talking':_0x140dfa['talking'],'total':_0x140dfa['total'],'type':_0x140dfa['type'],'unmanaged':_0x140dfa[_0xff17('0x50')],'abandoned':_0x140dfa[_0xff17('0x51')],'waiting':_0x140dfa[_0xff17('0x52')],'loggedInDb':_0x140dfa['loggedInDb'],'dialActive':_0x140dfa['dialActive'],'dialMethod':_0x140dfa[_0xff17('0x53')],'dialOriginateCallerIdName':_0x140dfa[_0xff17('0x54')],'dialOriginateCallerIdNumber':_0x140dfa['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x140dfa[_0xff17('0x55')],'dialPrefix':_0x140dfa[_0xff17('0x56')],'outboundAnswerAgiCallsDay':_0x140dfa[_0xff17('0x57')],'outboundAnswerCallsDay':_0x140dfa[_0xff17('0x58')],'outboundBlacklistCallsDay':_0x140dfa[_0xff17('0x59')],'outboundBusyCallsDay':_0x140dfa[_0xff17('0x5a')],'outboundCongestionCallsDay':_0x140dfa[_0xff17('0x5b')],'outboundDropCallsDayACS':_0x140dfa[_0xff17('0x5c')],'outboundDropCallsDayCallersExit':_0x140dfa['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x140dfa[_0xff17('0x5d')],'outboundNoAnswerCallsDay':_0x140dfa[_0xff17('0x5e')],'outboundNoSuchCallsDay':_0x140dfa[_0xff17('0x5f')],'outboundOriginateFailureCallsDay':_0x140dfa[_0xff17('0x60')],'outboundReCallsDay':_0x140dfa[_0xff17('0x61')],'outboundRejectCallsDay':_0x140dfa[_0xff17('0x62')],'outboundUnknownCallsDay':_0x140dfa[_0xff17('0x63')],'predictiveIntervalAnsweredCalls':_0x140dfa['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x140dfa[_0xff17('0x64')],'predictiveIntervalAvgTalktime':_0x140dfa['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x140dfa['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x140dfa[_0xff17('0x65')],'predictiveIntervalErlangCalls':_0x140dfa[_0xff17('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x140dfa[_0xff17('0x67')],'predictiveIntervalHitRate':_0x140dfa[_0xff17('0x68')],'predictiveIntervalMultiplicativeFactor':_0x140dfa[_0xff17('0x69')],'predictiveIntervalPauses':_0x140dfa[_0xff17('0x6a')],'predictiveIntervalAvailable':_0x140dfa['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x140dfa[_0xff17('0x6b')],'message':_0x140dfa[_0xff17('0x39')],'originated':_0x140dfa[_0xff17('0x6c')],'erlangCalls':_0x140dfa['erlangCalls'],'erlangCallToSecond':_0x140dfa['erlangCallToSecond'],'erlangAbandonmentRate':_0x140dfa[_0xff17('0x6d')],'erlangBusyFactor':_0x140dfa[_0xff17('0x6e')],'startPredictive':_0x140dfa[_0xff17('0x23')],'startProgressive':_0x140dfa[_0xff17('0x24')]};if(_0x140dfa[_0xff17('0x6f')]){_0x4a6bfd[_0xff17('0x6f')]={'id':_0x140dfa[_0xff17('0x6f')]['id'],'name':_0x140dfa[_0xff17('0x6f')]['name'],'active':_0x140dfa['Trunk'][_0xff17('0x70')],'callerid':_0x140dfa[_0xff17('0x6f')][_0xff17('0x71')]};}if(_0x140dfa[_0xff17('0x3f')]){_0x4a6bfd[_0xff17('0x3f')]={'id':_0x140dfa['Interval']['id'],'name':_0x140dfa[_0xff17('0x3f')][_0xff17('0x3b')]};}var _0xa9579b=md5(JSON[_0xff17('0x44')](_0x4a6bfd));if(_0x140dfa[_0xff17('0x72')]!==_0xa9579b){_0x140dfa['md5']=_0xa9579b;emit(util[_0xff17('0x73')](_0xff17('0x74'),_0x4a6bfd[_0xff17('0x3b')]),_0xff17('0x75'),_0x4a6bfd);}}}function emitCampaignSummary(_0x58e60f){if(_0x58e60f[_0xff17('0x48')]===_0xff17('0x76')){emit(util[_0xff17('0x73')](_0xff17('0x77'),_0x58e60f['name']),_0xff17('0x78'),_0x58e60f);}}function checkGetDataPredictive(_0xb925ee){if(isNotNull(_0xb925ee)&&!_[_0xff17('0x79')](_0xb925ee)){loggerPredictive['info'](_0xff17('0x7a'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb925ee[_0xff17('0x6b')]);loggerPredictive['info'](_0xff17('0x7b'),_0xb925ee[_0xff17('0x7c')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x7e'),_0xb925ee[_0xff17('0x65')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x7f'),_0xb925ee[_0xff17('0x80')]);loggerPredictive['info'](_0xff17('0x81'),_0xb925ee['predictiveIntervalAvgHoldtime']);loggerPredictive[_0xff17('0x7d')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xb925ee[_0xff17('0x82')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x83'));if(_0xb925ee['predictiveIntervalTotalCalls']>0x0){if(!_[_0xff17('0x38')](_0xb925ee[_0xff17('0x82')])&&_0xb925ee[_0xff17('0x82')]>0x0){return!![];}loggerPredictive[_0xff17('0x7d')](_0xff17('0x84'));if(!_['isUndefined'](_0xb925ee['predictiveIntervalAvgHoldtime'])&&_0xb925ee[_0xff17('0x64')]>0x0){return!![];}loggerPredictive[_0xff17('0x7d')](_0xff17('0x85'));}else{loggerPredictive[_0xff17('0x7d')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0xff17('0x86'));}return![];}function mergeDataErlangB(_0x5b7f82){return function(_0x4ae794){loggerPredictive[_0xff17('0x7d')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xff17('0x7d')](_0xff17('0x87'),_0x4ae794[_0xff17('0x88')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x89'),_0x4ae794[_0xff17('0x8a')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x8b'),_0x4ae794[_0xff17('0x6d')]);loggerPredictive[_0xff17('0x7d')](_0xff17('0x8c'),_0x4ae794['erlangBusyFactor']);loggerPredictive[_0xff17('0x7d')](_0xff17('0x8b'),_0x4ae794['erlangAbandonmentRate']);loggerPredictive[_0xff17('0x7d')]('---------------------------');_[_0xff17('0x8d')](_0x5b7f82,_0x4ae794);};}function getDiff(_0x70db75){var _0x2cef9e=moment()['milliseconds'](0x0);var _0x1408aa=moment(_0x70db75)[_0xff17('0x45')](0x0);return _0x2cef9e[_0xff17('0x8e')](_0x1408aa,_0xff17('0x46'));}function ifInterval(_0x38c059,_0x531bd7){if(_[_0xff17('0x38')](_0x531bd7)){return![];}return getDiff(_0x531bd7)<_0x38c059*0x3c;}function freeVariablesPredictive(_0xba4363){if(isNotNull(_0xba4363)){if(!_[_0xff17('0x38')](_0xba4363[_0xff17('0x24')])){_0xba4363[_0xff17('0x24')]=undefined;loggerPredictive[_0xff17('0x7d')](_0xba4363['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xff17('0x38')](_0xba4363[_0xff17('0x23')])){_0xba4363[_0xff17('0x23')]=undefined;loggerPredictive[_0xff17('0x7d')](_0xba4363[_0xff17('0x3b')],_0xff17('0x8f'));}if(!_[_0xff17('0x38')](_0xba4363[_0xff17('0x90')])){clearInterval(_0xba4363[_0xff17('0x90')]);_0xba4363[_0xff17('0x90')]=undefined;loggerPredictive[_0xff17('0x7d')](_0xba4363[_0xff17('0x3b')],_0xff17('0x91'));}}}function erlangb(_0x58a80c,_0x4b1a62){if(_0x4b1a62===0x0){return 0x0;}var _0x339b5a=0x1;for(var _0x59bfab=0x1;_0x59bfab<=_0x4b1a62;_0x59bfab+=0x1){_0x339b5a=0x1+_0x339b5a*_0x59bfab/_0x58a80c;}return 0x1/_0x339b5a;}function isVoiceQueueOutbound(_0x3fc5ba){return _0x3fc5ba===_0xff17('0x49');}function isNotPreview(_0x44f8fe){return _0x44f8fe!==_0xff17('0x92');}function isCampaignIvr(_0x574813){return _0x574813==='ivr';}function getCallerId(_0x1d5dcf,_0x3eec86,_0x4e97e4){if(!_[_0xff17('0x38')](_0x4e97e4)&&typeof _0x4e97e4==='string'&&!_[_0xff17('0x79')](_0x4e97e4)){if(!_[_0xff17('0x38')](_0x3eec86)&&typeof _0x3eec86==='string'&&!_[_0xff17('0x79')](_0x3eec86)){return util[_0xff17('0x73')](_0xff17('0x93'),_0x3eec86,_0x4e97e4);}return util[_0xff17('0x73')](_0xff17('0x93'),_0x4e97e4,_0x4e97e4);}if(!_['isUndefined'](_0x1d5dcf)&&typeof _0x1d5dcf==='string'&&!_['isEmpty'](_0x1d5dcf)){return _0x1d5dcf;}return'\x22\x22\x20<>';}function loggerCatchQueueSummary(_0x3a757d,_0x53ec10){return function(_0x4b657d){freeVariablesPredictive(_0x53ec10);emitVoiceQueueSummary(_0x53ec10);emitCampaignSummary(_0x53ec10);loggerSyncQueueSummary[_0xff17('0x94')](_0x3a757d,util['inspect'](_0x4b657d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2d6233,_0x27c96f){return function(_0x11deaa){loggerPredictive['error'](_0x27c96f[_0xff17('0x3b')],_0x2d6233);loggerPredictive[_0xff17('0x94')](_0x11deaa[_0xff17('0x95')]);freeVariablesPredictive(_0x27c96f);};}function loggerCatch(_0x54ec9b){return function(_0xd4542){logger['error'](_0x54ec9b,util[_0xff17('0x96')](_0xd4542,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x125437){return _0x125437&&!_[_0xff17('0x38')](_0x125437)&&_0x125437[_0xff17('0x97')]>0x0;}function decremetOriginate(_0xcb7b59){if(!_['isUndefined'](_0xcb7b59)&&_0xcb7b59!==null){if(typeof _0xcb7b59['originated']!==_0xff17('0x98')){if(_0xcb7b59[_0xff17('0x6c')]>0x0){_0xcb7b59[_0xff17('0x6c')]-=0x1;}else{logger[_0xff17('0x94')](_0xff17('0x99'));}}}else{logger[_0xff17('0x94')](_0xff17('0x9a'));}}function checkContactLowerLimitOriginate(_0x1f2c40,_0x2da33c,_0x5f153c){if(_0x2da33c>_0x5f153c){for(var _0x5f10a3=0x0;_0x5f10a3<_0x2da33c-_0x5f153c;_0x5f10a3+=0x1){decremetOriginate(_0x1f2c40);}}}function loggerGetContactDialer(_0x53d8a4,_0x6e904e,_0x3b2f39){return function(_0x424efb){checkContactLowerLimitOriginate(_0x6e904e,_0x3b2f39,0x0);logger['error'](_0x53d8a4,util[_0xff17('0x96')](_0x424efb,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x51dcc0){return function(_0x3cb6f5){if(isNotNull(_0x3cb6f5)&&isNotNull(_0x3cb6f5[0x0])){if(_0x3cb6f5[0x0][_0xff17('0x9b')]>0x0){_0x51dcc0[_0xff17('0x39')]=_0xff17('0x9c');logger[_0xff17('0x7d')](_0xff17('0x9d')+_0x51dcc0[_0xff17('0x3b')],_0x3cb6f5[0x0][_0xff17('0x9b')],'contacts');}else{_0x51dcc0[_0xff17('0x39')]=_0xff17('0x9e');logger['info']('[getContactDialer2][Empty]'+_0x51dcc0[_0xff17('0x3b')]);}}};}function notSendMessagesQueue(_0x35631a){if(_0x35631a['sendMessageOneNotActive']){freeVariablesPredictive(_0x35631a);if(_0x35631a[_0xff17('0x6c')]===0x0&&_0x35631a[_0xff17('0x9f')]===0x0&&_0x35631a[_0xff17('0x52')]===0x0&&(_0x35631a['pTalking']||0x0)===0x0){_0x35631a['sendMessageOneNotActive']=![];_0x35631a[_0xff17('0x4b')]=0x0;_0x35631a['message']=_0xff17('0x3d');loggerSyncQueueSummary[_0xff17('0x94')]('[syncQueueSummary]\x20Campaign\x20Queue:\x20',_0x35631a[_0xff17('0x3b')],'is\x20not\x20active');}else{_0x35631a[_0xff17('0x39')]='IS_DISACTIVED';loggerSyncQueueSummary[_0xff17('0x94')](_0xff17('0xa0'),_0x35631a[_0xff17('0x3b')],_0xff17('0xa1'));}emitVoiceQueueSummary(_0x35631a);}}function notSendMessagesCampaign(_0x224bc0){if(_0x224bc0[_0xff17('0xa2')]){if(_0x224bc0[_0xff17('0x6c')]===0x0){_0x224bc0['sendMessageOneNotActive']=![];_0x224bc0[_0xff17('0x39')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xff17('0x94')](_0xff17('0xa3'),_0x224bc0[_0xff17('0x3b')],_0xff17('0xa4'));}else{_0x224bc0[_0xff17('0x39')]=_0xff17('0xa5');loggerSyncQueueSummary[_0xff17('0x94')](_0xff17('0xa3'),_0x224bc0[_0xff17('0x3b')],'is\x20disactive');}emitCampaignSummary(_0x224bc0);}}function createObjHistory(_0x18add0,_0x522c9d,_0x5a2b26,_0x33298b,_0x2bc0c3){_0x18add0[_0xff17('0x39')]=_0x5a2b26;var _0x2c0f5f=new Action(_0x18add0,_0x522c9d);var _0x3d91f9=new History(_0x2c0f5f);_0x3d91f9[_0xff17('0xa6')]=_0x33298b;_0x3d91f9[_0xff17('0xa7')]=_0x2bc0c3;_0x3d91f9['endtime']=_0x2c0f5f[_0xff17('0xa8')];return _0x3d91f9;}Dialer['prototype'][_0xff17('0x37')]=function(){var _0x151757=this;setInterval(function(){_0x151757[_0xff17('0xa9')](_0x151757['uniqueId'],_0xff17('0xaa'));_0x151757[_0xff17('0xa9')](_0x151757[_0xff17('0xab')],'[actions]');},0x32c8);};Dialer[_0xff17('0xac')][_0xff17('0xa9')]=function(_0x425aae,_0x284c48){var _0xa1f246=this;for(var _0x5a9f94 in _0x425aae){if(typeof _0x425aae[_0x5a9f94]!==_0xff17('0x98')){this['sequence'][_0xff17('0xad')](function(){if(!_[_0xff17('0xae')](_0x425aae[_0x5a9f94])){return ami[_0xff17('0xaf')]({'action':_0xff17('0xb0'),'channel':_0x425aae[_0x5a9f94][_0xff17('0xb1')]})[_0xff17('0xb2')](function(_0x23bced){if(_0x23bced[_0xff17('0x39')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x425aae[_0x5a9f94]&&_0x425aae[_0x5a9f94][_0xff17('0x48')]!=='ivr'){_0xa1f246[_0xff17('0xb3')](_0xa1f246['voiceQueues'][_0x425aae[_0x5a9f94][_0xff17('0xb4')]]);logger[_0xff17('0x94')]('[Dialer][checkChannel]',_0x284c48,_0x5a9f94,_0x425aae[_0x5a9f94][_0xff17('0xb4')]);delete _0x425aae[_0x5a9f94];}if(_0x425aae[_0x5a9f94]&&_0x425aae[_0x5a9f94][_0xff17('0x48')]===_0xff17('0x76')){_0xa1f246[_0xff17('0xb3')](_0xa1f246[_0xff17('0x1e')][_0x425aae[_0x5a9f94][_0xff17('0xb4')]]);logger[_0xff17('0x94')](_0xff17('0xb5'),_0x284c48,_0x5a9f94,_0x425aae[_0x5a9f94]['queue']);delete _0x425aae[_0x5a9f94];}},0x2328);}});}});}}};Dialer[_0xff17('0xac')]['countReScheduled']=function(_0x3680df){return BPromise['resolve']()[_0xff17('0xb6')](cmHopper[_0xff17('0xb7')](_0x3680df))[_0xff17('0xb2')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xff17('0xac')][_0xff17('0xb8')]=function(_0x12c17d){return BPromise[_0xff17('0xb9')]()[_0xff17('0xb6')](cmHopperBlack[_0xff17('0xb8')](_0x12c17d))['catch'](loggerCatch(_0xff17('0xba')));};Dialer[_0xff17('0xac')][_0xff17('0xbb')]=function(_0xa5e5b7){return BPromise[_0xff17('0xb9')]()[_0xff17('0xb6')](cmHopperBlack[_0xff17('0xbb')](_0xa5e5b7))[_0xff17('0xb2')](loggerCatch(_0xff17('0xbc')));};Dialer[_0xff17('0xac')][_0xff17('0xbd')]=function(_0x54fe1f){return BPromise[_0xff17('0xb9')]()['then'](cmHopperHistory[_0xff17('0xbe')](_0x54fe1f))['catch'](loggerCatch(_0xff17('0xbf')));};Dialer[_0xff17('0xac')][_0xff17('0xc0')]=function(_0x45ff3b){return BPromise[_0xff17('0xb9')]()[_0xff17('0xb6')](cmHopper['rescheduleContact'](_0x45ff3b))[_0xff17('0xb2')](loggerCatch(_0xff17('0xc1')));};Dialer[_0xff17('0xac')][_0xff17('0xc2')]=function(_0x32d175,_0x4603a2,_0x35bdfa){return BPromise[_0xff17('0xb9')]()['then'](cmHopper[_0xff17('0xc2')](_0x32d175,_0x4603a2,_0x35bdfa))[_0xff17('0xb2')](loggerCatch(_0xff17('0xc3')));};Dialer[_0xff17('0xac')][_0xff17('0xc4')]=function(_0x5ccd4c,_0x230a93,_0x7db508,_0x2d1e83,_0x7cd7f6){return BPromise[_0xff17('0xb9')]()['then'](cmHopper[_0xff17('0xc4')](_0x5ccd4c,_0x230a93,_0x7db508,_0x2d1e83))['catch'](function(_0x9794aa){_0x7cd7f6['temp']-=_0x7db508;_0x7cd7f6[_0xff17('0xc5')]=_0x7cd7f6[_0xff17('0xc5')]>0x0?_0x7cd7f6['temp']:0x0;loggerCatch(_0xff17('0xc6'))(_0x9794aa);});};Dialer[_0xff17('0xac')]['getContactDialerIvr']=function(_0x38318e,_0x551054,_0x52e27e,_0x36a7a4){return BPromise['resolve']()[_0xff17('0xb6')](cmHopper[_0xff17('0xc7')](_0x38318e,_0x551054,_0x52e27e))[_0xff17('0xb2')](function(_0x47ee49){_0x36a7a4[_0xff17('0xc5')]-=_0x551054;_0x36a7a4[_0xff17('0xc5')]=_0x36a7a4[_0xff17('0xc5')]>0x0?_0x36a7a4[_0xff17('0xc5')]:0x0;loggerCatch(_0xff17('0xc8'))(_0x47ee49);});};Dialer['prototype'][_0xff17('0xc9')]=function(_0x1ad21a){return BPromise[_0xff17('0xb9')]()[_0xff17('0xb6')](voiceQueueRt[_0xff17('0xc9')](_0x1ad21a))[_0xff17('0xb2')](loggerCatch(_0xff17('0xca')));};Dialer['prototype'][_0xff17('0xcb')]=function(_0x14ae15){return BPromise[_0xff17('0xb9')]()[_0xff17('0xb6')](cmHopper['moveContactManagedDialer'](_0x14ae15))['catch'](loggerCatch(_0xff17('0xcc')));};Dialer[_0xff17('0xac')][_0xff17('0xcd')]=function(_0x39a340){return BPromise[_0xff17('0xb9')]()[_0xff17('0xb6')](cmHopperHistory[_0xff17('0xcd')](_0x39a340))[_0xff17('0xb2')](loggerCatch(_0xff17('0xce')));};Dialer[_0xff17('0xac')][_0xff17('0xb3')]=function(_0x5641d6){if(!_['isUndefined'](_0x5641d6)&&_0x5641d6!==null){if(typeof _0x5641d6[_0xff17('0x6c')]!==_0xff17('0x98')){if(_0x5641d6['originated']>0x0){_0x5641d6[_0xff17('0x6c')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error'](_0xff17('0xcf'));}};Dialer[_0xff17('0xac')][_0xff17('0xd0')]=function(_0x14adc4,_0x528095){var _0x278579=this;return function(_0x4ebfe9){_0x278579[_0xff17('0xb3')](_0x528095);logger[_0xff17('0x94')](_0x14adc4,util[_0xff17('0x96')](_0x4ebfe9,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xff17('0xd1')]=function(_0x76105a,_0x4071b7,_0xbf2a24){var _0x55abd8={'state':0x19,'statedesc':_0xff17('0xd2')};this[_0xff17('0xb3')](_0x4071b7);this[_0xff17('0xd3')](_[_0xff17('0x8d')](_0x55abd8,_[_0xff17('0xd4')](_0xbf2a24,['ContactId',_0xff17('0xd5'),_0xff17('0xd6'),_0xff17('0xd7'),_0xff17('0xd8')])),_0xff17('0xd9'),'[emptyContact]');logger[_0xff17('0x94')](_0x76105a);};Dialer[_0xff17('0xac')][_0xff17('0xda')]=function(_0x2f4760){return _0x2f4760===_0xff17('0xdb');};Dialer[_0xff17('0xac')][_0xff17('0xdc')]=function(_0x3a5303){return!_[_0xff17('0x38')](_0x3a5303)&&_0x3a5303&&!_[_0xff17('0x38')](_0x3a5303[_0xff17('0x3b')])&&!_[_0xff17('0x38')](_0x3a5303[_0xff17('0x70')])&&_0x3a5303[_0xff17('0x70')]&&(this['trunks'][util[_0xff17('0x73')]('SIP/%s',_0x3a5303[_0xff17('0x3b')])][_0xff17('0xb0')]===_0xff17('0xdd')||this['trunks'][util[_0xff17('0x73')](_0xff17('0xde'),_0x3a5303[_0xff17('0x3b')])][_0xff17('0xb0')]===_0xff17('0xdf'));};Dialer[_0xff17('0xac')][_0xff17('0xd3')]=function(_0x1bd58a,_0x5b57f9,_0x3ceffc){this[_0xff17('0xcd')](_0x1bd58a)[_0xff17('0xb2')](loggerCatch(_0x5b57f9));this[_0xff17('0xcb')](_0x1bd58a)[_0xff17('0xb2')](loggerCatch(_0x3ceffc));};Dialer[_0xff17('0xac')][_0xff17('0x31')]=function(_0x528da3){var _0x2be214=this[_0xff17('0xe0')][_0x528da3['uniqueid']];var _0xf1293;if(!_['isNil'](_0x528da3)&&!_[_0xff17('0xae')](_0x528da3[_0xff17('0xe1')])&&!_[_0xff17('0xae')](_0x528da3[_0xff17('0xe1')][_0xff17('0xe2')])&&_0x528da3[_0xff17('0xe3')]===_0xff17('0xe4')&&_0x2be214){if(_0x2be214['type']!=='ivr'&&this[_0xff17('0x1d')][_0x2be214[_0xff17('0xb4')]][_0xff17('0xe5')]&&_0x528da3[_0xff17('0xe6')]===_0xff17('0xe7')){delete this[_0xff17('0xe0')][_0x528da3[_0xff17('0xe8')]];this[_0xff17('0xb3')](this['voiceQueues'][_0x2be214[_0xff17('0xb4')]]);this[_0xff17('0x1d')][_0x2be214[_0xff17('0xb4')]][_0xff17('0x58')]+=0x1;this[_0xff17('0x1d')][_0x2be214['queue']]['outboundAnswerAgiCallsDay']+=0x1;_0xf1293=new Hangup(_0x2be214,_0x528da3);_0xf1293['state']=0x12;_0xf1293[_0xff17('0xa7')]=_0xff17('0xe9');_0xf1293[_0xff17('0xea')]='AMD';ami[_0xff17('0x47')](_0xff17('0xeb'),ut[_0xff17('0xec')](_0xf1293,'amd'));this['saveInDb'](_0xf1293,_0xff17('0xed'),_0xff17('0xee'));}if(_0x2be214[_0xff17('0x48')]!==_0xff17('0x76')&&this[_0xff17('0x1d')][_0x2be214[_0xff17('0xb4')]][_0xff17('0xe5')]&&_0x528da3['value']===_0xff17('0xef')){var _0x5db6b1=this;return new BPromise(function(_0x5086db,_0x253f0e){delete _0x5db6b1[_0xff17('0xe0')][_0x528da3[_0xff17('0xe8')]];_0x5db6b1[_0xff17('0xb3')](_0x5db6b1[_0xff17('0x1d')][_0x2be214[_0xff17('0xb4')]]);_0x5db6b1[_0xff17('0x1d')][_0x2be214[_0xff17('0xb4')]][_0xff17('0x58')]+=0x1;_0x5db6b1['voiceQueues'][_0x2be214['queue']][_0xff17('0x57')]+=0x1;var _0x408d84=_0x5db6b1['voiceQueues'][_0x2be214['queue']];var _0x2764b2=new Hangup(_0x2be214,_0x528da3);_0x2764b2['state']=0x13;_0x2764b2[_0xff17('0xa7')]=_0xff17('0xf0');_0x2764b2[_0xff17('0xea')]='AMD';_0x2764b2['countmachineretry']+=0x1;_0x2764b2[_0xff17('0xf1')]+=0x1;_0x2764b2[_0xff17('0xf2')]=!![];ami[_0xff17('0x47')](_0xff17('0xeb'),ut[_0xff17('0xec')](_0x2764b2,'amd'));_0x5db6b1[_0xff17('0xcd')](_0x2764b2)['catch'](loggerCatch(_0xff17('0xf3')));if(_0x2764b2[_0xff17('0xf4')]+_0x2764b2[_0xff17('0xf5')]+_0x2764b2[_0xff17('0xf6')]+_0x2764b2[_0xff17('0xf7')]+_0x2764b2[_0xff17('0xf8')]+_0x2764b2[_0xff17('0xf9')]+_0x2764b2[_0xff17('0xfa')]+_0x2764b2['countagentrejectretry']>=_0x408d84['dialGlobalMaxRetry']){_0x5db6b1['stateGlobal'](_0x2764b2,_0x5086db,_0x253f0e,_0xff17('0xfb'));}else{if(_0x2764b2[_0xff17('0xfa')]>=_0x408d84[_0xff17('0xfc')]){_0x5db6b1[_0xff17('0xfd')](_0x2764b2,_0x5086db,_0x253f0e,_0xff17('0xfe'));}else{_0x5db6b1[_0xff17('0xc0')]({'active':![],'countmachineretry':_0x2764b2[_0xff17('0xfa')],'scheduledat':moment()[_0xff17('0xff')](_0x408d84[_0xff17('0x100')],_0xff17('0x101'))['format'](_0xff17('0x102')),'ContactId':_0x2764b2[_0xff17('0x103')],'ListId':_0x2764b2['ListId'],'VoiceQueueId':_0x2764b2['VoiceQueueId']||undefined,'CampaignId':_0x2764b2[_0xff17('0xd8')]||undefined})['catch'](loggerCatch(_0xff17('0x104')));_0x5086db({'reschedule':0x1});}}});}if(_0x2be214[_0xff17('0x48')]===_0xff17('0x76')&&this['campaigns'][_0x2be214[_0xff17('0xb4')]][_0xff17('0xe5')]&&_0x528da3[_0xff17('0xe6')]===_0xff17('0xe7')){delete this[_0xff17('0xe0')][_0x528da3['uniqueid']];this['updateOriginated'](this[_0xff17('0x1e')][_0x2be214[_0xff17('0xb4')]]);_0xf1293=new Hangup(_0x2be214,_0x528da3);_0xf1293[_0xff17('0xa6')]=0x12;_0xf1293[_0xff17('0xa7')]=_0xff17('0xe9');_0xf1293['membername']=_0xff17('0x105');ami[_0xff17('0x47')](_0xff17('0xeb'),ut['buildObj'](_0xf1293,_0xff17('0xf2')));this[_0xff17('0xd3')](_0xf1293,_0xff17('0x106'),_0xff17('0x107'));}if(_0x2be214[_0xff17('0x48')]===_0xff17('0x76')&&this['campaigns'][_0x2be214[_0xff17('0xb4')]]['dialAMDActive']&&_0x528da3[_0xff17('0xe6')]===_0xff17('0xef')){var _0x5db6b1=this;return new BPromise(function(_0x2137fe,_0x1acb92){delete _0x5db6b1[_0xff17('0xe0')][_0x528da3['uniqueid']];_0x5db6b1[_0xff17('0xb3')](_0x5db6b1['campaigns'][_0x2be214[_0xff17('0xb4')]]);_0x5db6b1[_0xff17('0x1e')][_0x2be214[_0xff17('0xb4')]][_0xff17('0x58')]+=0x1;_0x5db6b1[_0xff17('0x1e')][_0x2be214[_0xff17('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x97d1de=_0x5db6b1[_0xff17('0x1e')][_0x2be214[_0xff17('0xb4')]];var _0x56a6eb=new Hangup(_0x2be214,_0x528da3);_0x56a6eb[_0xff17('0xa6')]=0x13;_0x56a6eb['statedesc']='Machine';_0x56a6eb['membername']='AMD';_0x56a6eb[_0xff17('0xfa')]+=0x1;_0x56a6eb[_0xff17('0xf1')]+=0x1;_0x56a6eb[_0xff17('0xf2')]=!![];ami[_0xff17('0x47')]('custom:amd',ut[_0xff17('0xec')](_0x56a6eb,_0xff17('0xf2')));_0x5db6b1[_0xff17('0xcd')](_0x56a6eb)[_0xff17('0xb2')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x56a6eb[_0xff17('0xf4')]+_0x56a6eb[_0xff17('0xf5')]+_0x56a6eb[_0xff17('0xf6')]+_0x56a6eb['countnosuchnumberretry']+_0x56a6eb['countdropretry']+_0x56a6eb[_0xff17('0xf9')]+_0x56a6eb[_0xff17('0xfa')]+_0x56a6eb[_0xff17('0x108')]>=_0x97d1de['dialGlobalMaxRetry']){_0x5db6b1[_0xff17('0x109')](_0x56a6eb,_0x2137fe,_0x1acb92,'reason19\x20machine....');}else{if(_0x56a6eb[_0xff17('0xfa')]>=_0x97d1de['dialMachineMaxRetry']){_0x5db6b1['createStateFinal'](_0x56a6eb,_0x2137fe,_0x1acb92,'reason\x2019\x20machine....');}else{_0x5db6b1[_0xff17('0xc0')]({'active':![],'countmachineretry':_0x56a6eb[_0xff17('0xfa')],'scheduledat':moment()[_0xff17('0xff')](_0x97d1de[_0xff17('0x100')],_0xff17('0x101'))['format'](_0xff17('0x102')),'ContactId':_0x56a6eb[_0xff17('0x103')],'ListId':_0x56a6eb[_0xff17('0xd5')],'VoiceQueueId':_0x56a6eb['VoiceQueueId']||undefined,'CampaignId':_0x56a6eb[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x104')));_0x2137fe({'reschedule':0x1});}}});}}};Dialer['prototype'][_0xff17('0x2f')]=function(_0x2a914c){var _0x5c9d13=this['uniqueId'][_0x2a914c[_0xff17('0xe8')]];var _0x191230=this;var _0x231eae;if(_0x5c9d13&&_0x5c9d13[_0xff17('0x48')]===_0xff17('0x76')){delete this[_0xff17('0xe0')][_0x2a914c[_0xff17('0xe8')]];this[_0xff17('0xb3')](this[_0xff17('0x1e')][_0x5c9d13['queue']]);this['campaigns'][_0x5c9d13[_0xff17('0xb4')]][_0xff17('0x10a')]+=0x1;_0x231eae=new Hangup(_0x5c9d13,_0x2a914c);this[_0xff17('0xcd')](_0x231eae)[_0xff17('0xb2')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x231eae)[_0xff17('0xb2')](loggerCatch(_0xff17('0x10b')));}if(_0x5c9d13&&_0x5c9d13[_0xff17('0x48')]!==_0xff17('0x76')&&isNotNull(this['voiceQueues'][_0x5c9d13[_0xff17('0xb4')]][_0xff17('0x10c')])){delete this[_0xff17('0xe0')][_0x2a914c[_0xff17('0xe8')]];this[_0xff17('0xb3')](this['voiceQueues'][_0x5c9d13['queue']]);this['voiceQueues'][_0x5c9d13[_0xff17('0xb4')]][_0xff17('0x58')]+=0x1;this[_0xff17('0x1d')][_0x5c9d13[_0xff17('0xb4')]]['outboundAnswerAgiCallsDay']+=0x1;_0x231eae=new Hangup(_0x5c9d13,_0x2a914c);_0x231eae['state']=0x10;_0x231eae[_0xff17('0xa7')]=_0xff17('0x10d');_0x231eae['membername']=_0xff17('0x10e');this[_0xff17('0xcd')](_0x231eae)['catch'](loggerCatch(_0xff17('0x10f')));this[_0xff17('0xcb')](_0x231eae)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x5c9d13&&_0x5c9d13[_0xff17('0x48')]!==_0xff17('0x76')&&!isNotNull(this['voiceQueues'][_0x5c9d13[_0xff17('0xb4')]][_0xff17('0x10c')])){delete this[_0xff17('0xe0')][_0x2a914c['uniqueid']];this[_0xff17('0xb3')](this[_0xff17('0x1d')][_0x5c9d13[_0xff17('0xb4')]]);this[_0xff17('0x1d')][_0x5c9d13[_0xff17('0xb4')]][_0xff17('0x63')]+=0x1;_0x231eae=new Hangup(_0x5c9d13,_0x2a914c);_0x231eae[_0xff17('0xa6')]=0xc;_0x231eae[_0xff17('0xa7')]=_0x2a914c[_0xff17('0x110')];_0x231eae[_0xff17('0xea')]='Unknow';this[_0xff17('0xcd')](_0x231eae)[_0xff17('0xb2')](loggerCatch(_0xff17('0x10f')));this[_0xff17('0xcb')](_0x231eae)[_0xff17('0xb2')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xff17('0xac')][_0xff17('0x2c')]=function(_0x69179d){var _0x323152=this['uniqueId'][_0x69179d[_0xff17('0xe8')]];var _0x167694=this;if(this[_0xff17('0x1d')][_0x69179d[_0xff17('0xb4')]]){if(_0x323152&&_0x323152['type']!==_0xff17('0x76')){delete this[_0xff17('0xe0')][_0x69179d['uniqueid']];this[_0xff17('0x1d')][_0x69179d[_0xff17('0xb4')]][_0xff17('0x58')]+=0x1;var _0x107754=new AgentComplete(_0x323152,_0x69179d);if(_0x69179d['reason']===_0xff17('0x111')){_0x107754['agiafterat']=this['voiceQueues'][_0x69179d[_0xff17('0xb4')]][_0xff17('0x112')]&&this['voiceQueues'][_0x69179d[_0xff17('0xb4')]]['dialAgiAfterHangupAgent']?moment()[_0xff17('0x73')](_0xff17('0x102')):undefined;}this[_0xff17('0xcd')](_0x107754)[_0xff17('0xb2')](loggerCatch(_0xff17('0x113')));this[_0xff17('0xcb')](_0x107754)[_0xff17('0xb2')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xff17('0xac')][_0xff17('0x114')]=function(_0x580148){if(this['voiceQueues'][_0x580148[_0xff17('0xb4')]]){if(this[_0xff17('0xe0')][_0x580148[_0xff17('0xe8')]]&&this['uniqueId'][_0x580148[_0xff17('0xe8')]][_0xff17('0x48')]!==_0xff17('0x76')){this[_0xff17('0xb3')](this['voiceQueues'][_0x580148[_0xff17('0xb4')]]);this['uniqueId'][_0x580148['uniqueid']][_0xff17('0x115')]=moment()[_0xff17('0x73')](_0xff17('0x102'));}}};Dialer[_0xff17('0xac')]['queueCallerAbandonCreateState']=function(_0x1a2a93){this[_0xff17('0xcd')](_0x1a2a93)[_0xff17('0xb2')](loggerCatch(_0xff17('0x113')));this[_0xff17('0xcb')](_0x1a2a93)[_0xff17('0xb2')](loggerCatch(_0xff17('0x116')));};Dialer['prototype'][_0xff17('0x29')]=function(_0x254d33){var _0x440e27=this[_0xff17('0xe0')][_0x254d33[_0xff17('0xe8')]];var _0x2d7b93=this;if(this['voiceQueues'][_0x254d33[_0xff17('0xb4')]]){if(_0x440e27&&_0x440e27[_0xff17('0x48')]!==_0xff17('0x76')){delete this[_0xff17('0xe0')][_0x254d33[_0xff17('0xe8')]];this[_0xff17('0xb3')](this[_0xff17('0x1d')][_0x254d33[_0xff17('0xb4')]]);_0x440e27[_0xff17('0x117')]=moment()[_0xff17('0x73')]('YYYY-MM-DD\x20HH:mm:ss');var _0x224fd7=new QueueCallerAbandon(_0x440e27,_0x254d33);if(getSeconds(_0x440e27[_0xff17('0x117')],_0x440e27[_0xff17('0x118')])>=_0x440e27['dialQueueTimeout']){this['voiceQueues'][_0x254d33[_0xff17('0xb4')]][_0xff17('0x65')]+=0x1;this['voiceQueues'][_0x254d33['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xff17('0x1d')][_0x254d33[_0xff17('0xb4')]][_0xff17('0x67')]+=0x1;_0x224fd7[_0xff17('0xa6')]=0xa;_0x224fd7[_0xff17('0xa7')]='Drop';_0x224fd7[_0xff17('0x119')]=_0xff17('0x11a');_0x224fd7[_0xff17('0x11b')]=this['voiceQueues'][_0x254d33[_0xff17('0xb4')]][_0xff17('0x112')]?moment()[_0xff17('0x73')](_0xff17('0x102')):undefined;_0x224fd7[_0xff17('0xf8')]+=0x1;_0x224fd7[_0xff17('0xf1')]+=0x1;if(_0x224fd7[_0xff17('0xf8')]>=this[_0xff17('0x1d')][_0x254d33['queue']][_0xff17('0x11c')]){this[_0xff17('0x11d')](_0x224fd7);}else{this['rescheduleContact']({'active':![],'countdropretry':_0x224fd7[_0xff17('0xf8')],'scheduledat':moment()[_0xff17('0xff')](this['voiceQueues'][_0x254d33[_0xff17('0xb4')]]['dialDropRetryFrequency'],'minutes')[_0xff17('0x73')](_0xff17('0x102')),'ContactId':_0x440e27[_0xff17('0x103')],'ListId':_0x440e27[_0xff17('0xd5')],'VoiceQueueId':_0x440e27[_0xff17('0xd7')]||undefined,'CampaignId':_0x440e27[_0xff17('0xd8')]||undefined})['catch'](loggerCatch(_0xff17('0x11e')));var _0x1011d0=new History(_0x224fd7);_0x1011d0['state']=0xa;_0x1011d0['statedesc']=_0xff17('0x11f');_0x1011d0[_0xff17('0xa8')]=moment()[_0xff17('0x73')](_0xff17('0x102'));_0x1011d0['endtime']=_0x1011d0['starttime'];_0x1011d0[_0xff17('0x120')]=_0x224fd7[_0xff17('0x120')];_0x1011d0[_0xff17('0x121')]=_0x224fd7[_0xff17('0x121')];this[_0xff17('0xcd')](_0x1011d0)[_0xff17('0xb2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this['voiceQueues'][_0x254d33[_0xff17('0xb4')]][_0xff17('0x80')]+=0x1;this[_0xff17('0x1d')][_0x254d33['queue']][_0xff17('0x122')]+=0x1;_0x224fd7['state']=0xb;_0x224fd7[_0xff17('0xa7')]=_0xff17('0x123');_0x224fd7[_0xff17('0x119')]=_0xff17('0x124');_0x224fd7['countabandonedretry']+=0x1;_0x224fd7[_0xff17('0xf1')]+=0x1;if(_0x224fd7['countabandonedretry']>=this[_0xff17('0x1d')][_0x254d33[_0xff17('0xb4')]][_0xff17('0x125')]){this['queueCallerAbandonCreateState'](_0x224fd7);}else{this[_0xff17('0xc0')]({'active':![],'countabandonedretry':_0x224fd7[_0xff17('0xf9')],'scheduledat':moment()[_0xff17('0xff')](this[_0xff17('0x1d')][_0x254d33[_0xff17('0xb4')]][_0xff17('0x126')],_0xff17('0x101'))['format'](_0xff17('0x102')),'ContactId':_0x440e27[_0xff17('0x103')],'ListId':_0x440e27[_0xff17('0xd5')],'VoiceQueueId':_0x440e27[_0xff17('0xd7')]||undefined,'CampaignId':_0x440e27[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x127')));var _0x1011d0=new History(_0x224fd7);_0x1011d0[_0xff17('0xa6')]=0xb;_0x1011d0[_0xff17('0xa7')]='Abandoned';_0x1011d0['starttime']=moment()[_0xff17('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x1011d0[_0xff17('0x128')]=_0x1011d0['starttime'];_0x1011d0[_0xff17('0x120')]=_0x224fd7[_0xff17('0x120')];_0x1011d0[_0xff17('0x121')]=_0x224fd7['calleridnum'];this['createHistory'](_0x1011d0)['catch'](loggerCatch(_0xff17('0x129')));}}}}};Dialer['prototype'][_0xff17('0x12a')]=function(_0x31e121){if(this['actions'][_0x31e121['uniqueid']]){this[_0xff17('0xab')][_0x31e121[_0xff17('0xe8')]][_0xff17('0xb1')]=_0x31e121[_0xff17('0xb1')];}if(this[_0xff17('0xe0')][_0x31e121[_0xff17('0xe8')]]){this[_0xff17('0xe0')][_0x31e121[_0xff17('0xe8')]][_0xff17('0xb1')]=_0x31e121[_0xff17('0xb1')];}};Dialer[_0xff17('0xac')][_0xff17('0x33')]=function(_0x2ca034){if(strategy[this[_0xff17('0x1d')][this[_0xff17('0xab')][_0x2ca034[_0xff17('0x12b')]]['queue']][_0xff17('0x4a')]]==='roundrobin'){if(this[_0xff17('0xab')][_0x2ca034[_0xff17('0x12b')]]&&_['isNil'](this[_0xff17('0xab')][_0x2ca034['actionid']]['locked'])&&_0x2ca034[_0xff17('0xb0')]==='1'&&_0x2ca034[_0xff17('0x12c')]==='0'){if(this[_0xff17('0x1f')][_0x2ca034[_0xff17('0x12d')]]){if(!this[_0xff17('0x1f')][_0x2ca034[_0xff17('0x12d')]]['locked']){this[_0xff17('0x1f')][_0x2ca034['stateinterface']][_0xff17('0x12e')]=!![];this['actions'][_0x2ca034[_0xff17('0x12b')]][_0xff17('0x12e')]=!![];this['actions'][_0x2ca034['actionid']][_0xff17('0x12d')]=_0x2ca034[_0xff17('0x12d')];}}}}else if((strategy[this[_0xff17('0x1d')][this[_0xff17('0xab')][_0x2ca034[_0xff17('0x12b')]][_0xff17('0xb4')]][_0xff17('0x4a')]]||_0xff17('0x18'))===_0xff17('0x18')){if(this['actions'][_0x2ca034[_0xff17('0x12b')]]){if(this[_0xff17('0x1f')][_0x2ca034[_0xff17('0x12d')]]){this[_0xff17('0xab')][_0x2ca034[_0xff17('0x12b')]][_0xff17('0x12d')]=_0x2ca034[_0xff17('0x12d')];if(_[_0xff17('0xae')](this[_0xff17('0x25')][this['actions'][_0x2ca034[_0xff17('0x12b')]][_0xff17('0xb4')]])){this[_0xff17('0x25')][this[_0xff17('0xab')][_0x2ca034[_0xff17('0x12b')]][_0xff17('0xb4')]]=[];}this[_0xff17('0x25')][this[_0xff17('0xab')][_0x2ca034['actionid']]['queue']]['push'](_['merge'](_[_0xff17('0xd4')](this[_0xff17('0xab')][_0x2ca034[_0xff17('0x12b')]],['idHopper',_0xff17('0x12d')]),{'status':_0x2ca034[_0xff17('0xb0')],'paused':_0x2ca034[_0xff17('0x12c')]}));}}}};function unlockQueueStatus(_0x3e6e4e,_0x2894ff){setTimeout(function(){if(_[_0xff17('0x38')](_0x3e6e4e[_0xff17('0x12f')])){loggerBooked[_0xff17('0x94')](_0xff17('0x130'),_0x2894ff);}_0x3e6e4e[_0xff17('0x12f')]=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x2894ff,JSON[_0xff17('0x44')](_['pick'](_0x3e6e4e,[_0xff17('0x3b'),_0xff17('0x12f')])));},0x1f3);}Dialer[_0xff17('0xac')]['syncQueueStatusComplete']=function(_0x5abbd2){var _0x229464=this;var _0x53d019=_0x229464[_0xff17('0x1d')][_0x229464[_0xff17('0xab')][_0x5abbd2['actionid']][_0xff17('0xb4')]];if(strategy[this['voiceQueues'][this['actions'][_0x5abbd2['actionid']][_0xff17('0xb4')]][_0xff17('0x4a')]]===_0xff17('0x19')){if(this['actions'][_0x5abbd2['actionid']]&&this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0x12d')]){this[_0xff17('0x92')][_0xff17('0x131')](this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0x132')],this[_0xff17('0xab')][_0x5abbd2['actionid']][_0xff17('0x12d')])['catch'](function(_0x123ba1){logger[_0xff17('0x94')](_0xff17('0x133'),util['inspect'](_0x123ba1,{'showHidden':![],'depth':null}));})[_0xff17('0x1b')](function(){_0x229464[_0xff17('0xb3')](_0x229464['voiceQueues'][_0x229464[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]]);_0x229464[_0xff17('0x1f')][_0x229464[_0xff17('0xab')][_0x5abbd2['actionid']][_0xff17('0x12d')]]['locked']=![];delete _0x229464[_0xff17('0xab')][_0x5abbd2['actionid']];unlockQueueStatus(_0x53d019);});}else{this[_0xff17('0xb3')](this['voiceQueues'][this[_0xff17('0xab')][_0x5abbd2['actionid']]['queue']]);this['rescheduleContact']({'active':![],'ContactId':this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0x103')],'ListId':this[_0xff17('0xab')][_0x5abbd2['actionid']]['ListId'],'VoiceQueueId':this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xd7')]||undefined,'CampaignId':this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xd8')]||undefined})['catch'](loggerCatch(_0xff17('0x134')));delete this['actions'][_0x5abbd2['actionid']];unlockQueueStatus(_0x53d019);}}else if((strategy[this[_0xff17('0x1d')][this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]]['strategy']]||_0xff17('0x18'))===_0xff17('0x18')){var _0x461b7f;if(this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]]&&!_[_0xff17('0x79')](this[_0xff17('0x25')][this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]])){if(this[_0xff17('0x26')][_0x229464['actions'][_0x5abbd2['actionid']][_0xff17('0xb4')]]){this[_0xff17('0x26')][_0x229464[_0xff17('0xab')][_0x5abbd2['actionid']][_0xff17('0xb4')]]=this[_0xff17('0x26')][this['actions'][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]]?this[_0xff17('0x26')][this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]]:this[_0xff17('0x25')][this[_0xff17('0xab')][_0x5abbd2['actionid']]['queue']]?this[_0xff17('0x25')][this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]][_0xff17('0x135')]||0x0:0x0;}this[_0xff17('0x25')][this[_0xff17('0xab')][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]][_0xff17('0x135')]=this[_0xff17('0x26')][this['actions'][_0x5abbd2[_0xff17('0x12b')]][_0xff17('0xb4')]];for(var _0x58c1b6=0x0;_0x58c1b6=0x0;})[_0xff17('0xb2')](myreject(_0x35138a)));}}else{_0x5a9f03['push'](ami['Action']({'action':_0xff17('0x152'),'command':util[_0xff17('0x73')](_0xff17('0x14e'),_0x3ef3d4,!_[_0xff17('0x38')](config[_0xff17('0x14a')][_0x1d3b75])?_0x1d3b75:'')})[_0xff17('0xb6')](function(_0xdf8738){return _0xdf8738[_0xff17('0x150')][_0xff17('0x151')]('true')>=0x0;})[_0xff17('0xb2')](myreject(_0x35138a)));}BPromise[_0xff17('0x153')](_0x5a9f03)[_0xff17('0xb6')](function(_0x2fa860){var _0x462747=_[_0xff17('0x154')](_0x2fa860);if(_0x462747){return _0x5c61a0(_0x462747);}else{_0x419d14[_0xff17('0x39')]=_0x452fdc?_0xff17('0x155'):_0xff17('0x156');return _0x35138a(msgResponse('[ifTime][promiseAll]',_0xff17('0x147'),_0xff17('0x157')+_0x452fdc+'\x20'+_0x58525b+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3ef3d4,{'showHidden':![],'depth':null})+_0xff17('0x158')+_0x1d3b75));}})[_0xff17('0xb2')](function(_0x32b556){return _0x35138a(msgResponse(_0xff17('0x146'),'Failure',JSON[_0xff17('0x44')](_0x32b556)));});});};Dialer['prototype']['checkDialMethod']=function(_0x43275e){var _0x351359=this;return function(){switch(_0x43275e[_0xff17('0x53')]){case _0xff17('0x159'):freeVariablesPredictive(_0x43275e);_0x351359[_0xff17('0x15a')](_0x43275e,0x1);break;case'power':freeVariablesPredictive(_0x43275e);_0x351359[_0xff17('0x15a')](_0x43275e,_0x43275e[_0xff17('0x15b')]);break;case _0xff17('0x15c'):_0x351359[_0xff17('0x15c')](_0x43275e);break;case _0xff17('0x8'):freeVariablesPredictive(_0x43275e);_0x351359[_0xff17('0x15a')](_0x43275e,0x1);break;default:freeVariablesPredictive(_0x43275e);logger['error'](_0xff17('0x15d'),_0x43275e['name'],_0xff17('0x15e'));}};};Dialer[_0xff17('0xac')][_0xff17('0x15f')]=function(_0x4168b2){var _0x313634=this;return function(){_0x313634[_0xff17('0x160')](_0x4168b2);};};Dialer[_0xff17('0xac')][_0xff17('0xa')]=function(_0xbc8cf0){var _0x2bf7c6=this;if(isNotPreview(_0xbc8cf0[_0xff17('0x53')])){if(isVoiceQueueOutbound(_0xbc8cf0[_0xff17('0x48')])&&isActive(_0xbc8cf0[_0xff17('0x161')])){_0xbc8cf0['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xff17('0xb6')](checkIsLoggedIn(_0xbc8cf0,_0xbc8cf0[_0xff17('0x4c')]))[_0xff17('0xb6')](checkIsActive(_0xbc8cf0,_0xbc8cf0['dialActive']))[_0xff17('0xb6')](checkInterval(_0xbc8cf0))[_0xff17('0xb6')](_0x2bf7c6[_0xff17('0x141')](_0xbc8cf0))[_0xff17('0xb6')](_0x2bf7c6[_0xff17('0x162')](_0xbc8cf0[_0xff17('0x163')],_0xbc8cf0[_0xff17('0x164')],_0xbc8cf0[_0xff17('0x3b')],_0xbc8cf0))[_0xff17('0xb6')](_0x2bf7c6[_0xff17('0x145')](_0xbc8cf0[_0xff17('0x3f')],_0xbc8cf0['dialTimezone'],_0xbc8cf0[_0xff17('0x3b')],_0xbc8cf0))[_0xff17('0xb6')](_0x2bf7c6['checkDialMethod'](_0xbc8cf0))[_0xff17('0xb2')](loggerCatchQueueSummary(_0xff17('0x165'),_0xbc8cf0));}else{notSendMessagesQueue(_0xbc8cf0);}}else{freeVariablesPredictive(_0xbc8cf0);}};Dialer['prototype'][_0xff17('0x140')]=function(){var _0x269b62=this;var _0x48bee6;for(var _0x864e16 in this[_0xff17('0x1e')]){if(typeof this[_0xff17('0x1e')][_0x864e16]!==_0xff17('0x98')){_0x48bee6=this[_0xff17('0x1e')][_0x864e16];if(isCampaignIvr(_0x48bee6['type'])&&isActive(_0x48bee6['active'])){_0x48bee6[_0xff17('0xa2')]=!![];BPromise[_0xff17('0xb9')]()[_0xff17('0xb6')](checkIsActive(_0x48bee6,_0x48bee6[_0xff17('0x70')]))[_0xff17('0xb6')](checkInterval(_0x48bee6))[_0xff17('0xb6')](_0x269b62[_0xff17('0x141')](_0x48bee6))['then'](_0x269b62['checkIfTime'](_0x48bee6[_0xff17('0x163')],_0x48bee6[_0xff17('0x164')],_0x48bee6[_0xff17('0x3b')],_0x48bee6))[_0xff17('0xb6')](_0x269b62['checkIfTimeIntervals'](_0x48bee6[_0xff17('0x3f')],_0x48bee6[_0xff17('0x164')],_0x48bee6[_0xff17('0x3b')],_0x48bee6))[_0xff17('0xb6')](_0x269b62[_0xff17('0x15f')](_0x48bee6))[_0xff17('0xb2')](loggerCatchQueueSummary(_0xff17('0x166'),_0x48bee6));}else{notSendMessagesCampaign(_0x48bee6);}}}};function getCallerIdRandom(_0x2b1a68,_0x357da7){var _0x146ae1;var _0x2c746e;var _0x4d8442;if(_0x357da7<=0x0){_0x357da7=0x1;}_0x146ae1=new RegExp(_0xff17('0x167')+_0x357da7+'}$');_0x2c746e=Math['pow'](0xa,_0x357da7-0x1);_0x4d8442=Math[_0xff17('0x168')](0xa,_0x357da7)-0x1;return util['format']('%s',_[_0xff17('0x169')](_0x2b1a68,_0x146ae1,_[_0xff17('0x16a')](_0x2c746e,_0x4d8442)));}function extractCalleridName(_0x44bed6){var _0x1ed47=_0x44bed6[_0xff17('0x16b')](/"(.*?)"/);return _0x1ed47?_0x1ed47[0x1]:_0x44bed6;}function extractCalleridNumber(_0xa48a2f){var _0x177724=_0xa48a2f[_0xff17('0x16b')](/<(.*?)>/);return _0x177724?_0x177724[0x1]:_0xa48a2f;}Dialer[_0xff17('0xac')]['actionOriginate']=function(_0xbd4aec,_0x6c4c48){var _0xe5646e=this;var _0x5d8eac=uuid['v4']();this[_0xff17('0xab')][_0x5d8eac]=new Action(_0xbd4aec,_0x6c4c48,_0x5d8eac);return new BPromise(function(_0x386e35,_0x4527c2){if(_[_0xff17('0x38')](_0xbd4aec)&&typeof _0xbd4aec!==_0xff17('0x16c')){return _0x4527c2(msgResponse('originate',_0xff17('0x147'),_0xff17('0x16d')));}if(_[_0xff17('0x38')](_0x6c4c48[_0xff17('0x16e')]['phone'])||_0x6c4c48[_0xff17('0x16e')][_0xff17('0x16f')]===null){return _0x4527c2(msgResponse(_0xff17('0x170'),'Failure',_0xff17('0x171')));}var _0x21867e={'XMD-CALLERID':_0xe5646e[_0xff17('0xab')][_0x5d8eac][_0xff17('0x172')](),'XMD-AGI':_0xbd4aec['dialQueueProject']?util[_0xff17('0x73')](_0xff17('0x173'),ipAgi,_0xbd4aec[_0xff17('0x10c')]):_0xff17('0x174'),'XMD-AGIAFTER':_0xbd4aec[_0xff17('0x112')]?util[_0xff17('0x73')]('\x22agi://%s/square,%s\x22',ipAgi,_0xbd4aec[_0xff17('0x112')]):_0xff17('0x174'),'XMD-QUEUE':_0xbd4aec[_0xff17('0x48')]==='outbound'?util[_0xff17('0x73')]('\x22%s,%s%s,,,%s\x22',_0xbd4aec['name'],_0xbd4aec[_0xff17('0x175')]||'',_0xbd4aec[_0xff17('0x176')]?'c':'',_0xbd4aec['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0x6c4c48['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xe5646e[_0xff17('0xab')][_0x5d8eac]['getCaller'](),'XMD-AMD':_0xbd4aec[_0xff17('0xe5')]?_0xff17('0x177'):'NONE','XMD-DESTINATION':_0xff17('0xe4')};if(_0xbd4aec[_0xff17('0xe5')]){_0x21867e[_0xff17('0x178')]=_0xbd4aec[_0xff17('0x179')]||0x9c4;_0x21867e[_0xff17('0x17a')]=_0xbd4aec[_0xff17('0x17b')]||0x5dc;_0x21867e[_0xff17('0x17c')]=_0xbd4aec[_0xff17('0x17d')]||0x320;_0x21867e[_0xff17('0x17e')]=_0xbd4aec[_0xff17('0x17f')]||0x1388;_0x21867e[_0xff17('0x180')]=_0xbd4aec[_0xff17('0x181')]||0x64;_0x21867e['XMD-AMDBETWEENWORDSSILENCE']=_0xbd4aec['dialAMDBetweenWordsSilence']||0x32;_0x21867e[_0xff17('0x182')]=_0xbd4aec['dialAMDMaximumNumberOfWords']||0x3;_0x21867e[_0xff17('0x183')]=_0xbd4aec[_0xff17('0x184')]||0x100;_0x21867e[_0xff17('0x185')]=_0xbd4aec['dialAMDMaximumWordLength']||0x1388;}if(_0xbd4aec[_0xff17('0x48')]===_0xff17('0x49')){_0x21867e[_0xff17('0x186')]=_0x6c4c48[_0xff17('0xd7')];}else{_0x21867e['XMD-CAMPAIGNID']=_0x6c4c48[_0xff17('0xd8')];}for(var _0x5d08a8 in _0x6c4c48[_0xff17('0x16e')]){if(typeof _0x6c4c48[_0xff17('0x16e')][_0x5d08a8]!==_0xff17('0x98')){if(isNotNull(_0x6c4c48[_0xff17('0x16e')][_0x5d08a8])&&_0x5d08a8!=='id'&&_0x5d08a8!==_0xff17('0x187')&&_0x5d08a8!==_0xff17('0x188')&&_0x5d08a8!==_0xff17('0x189')){_0x21867e[util['format'](_0xff17('0x18a'),'XMD-',_[_0xff17('0x18b')](_0x5d08a8))]=_0x6c4c48['Contact'][_0x5d08a8];}}}var _0xf778a3=_0xe5646e[_0xff17('0xdc')](_0xbd4aec['Trunk'])?getCallerId(_0xbd4aec[_0xff17('0x6f')][_0xff17('0x71')],_0xbd4aec[_0xff17('0x54')],_0xbd4aec['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0xbd4aec[_0xff17('0x18c')],_0xbd4aec[_0xff17('0x18d')]):_0xbd4aec['dialOriginateCallerIdNumber']):getCallerId(_[_0xff17('0xae')](_0xbd4aec[_0xff17('0x142')])?_0xbd4aec[_0xff17('0x6f')][_0xff17('0x71')]:_0xbd4aec[_0xff17('0x142')][_0xff17('0x71')],_0xbd4aec[_0xff17('0x54')],_0xbd4aec[_0xff17('0x18d')]>0x0?getCallerIdRandom(_0xbd4aec[_0xff17('0x18c')],_0xbd4aec[_0xff17('0x18d')]):_0xbd4aec[_0xff17('0x18c')]);if(_0xf778a3){_0x21867e['XMD-ORIGINATECALLERIDNAME']=_0xe5646e[_0xff17('0xab')][_0x5d8eac][_0xff17('0x18e')]=extractCalleridName(_0xf778a3);_0x21867e[_0xff17('0x18f')]=_0xe5646e['actions'][_0x5d8eac]['originatecalleridnum']=extractCalleridNumber(_0xf778a3);}return ami['Action']({'actionid':_0x5d8eac,'action':_0xff17('0x170'),'channel':_0xe5646e[_0xff17('0xdc')](_0xbd4aec['Trunk'])?util[_0xff17('0x73')](_0xff17('0x190'),_0xbd4aec[_0xff17('0x6f')]['name'],isNotNull(_0xbd4aec[_0xff17('0x56')])?_0xbd4aec[_0xff17('0x56')]['trim']()||'':'',_0xbd4aec[_0xff17('0x191')]>0x0?_0x6c4c48[_0xff17('0x16e')]['phone']['substring'](_0xbd4aec['dialCutDigit']):_0x6c4c48[_0xff17('0x16e')][_0xff17('0x16f')]):util[_0xff17('0x73')](_0xff17('0x190'),_[_0xff17('0xae')](_0xbd4aec[_0xff17('0x142')])?_0xbd4aec[_0xff17('0x6f')][_0xff17('0x3b')]:_0xbd4aec['TrunkBackup'][_0xff17('0x3b')],isNotNull(_0xbd4aec[_0xff17('0x56')])?_0xbd4aec[_0xff17('0x56')]['trim']()||'':'',_0xbd4aec[_0xff17('0x191')]>0x0?_0x6c4c48[_0xff17('0x16e')][_0xff17('0x16f')][_0xff17('0x192')](_0xbd4aec['dialCutDigit']):_0x6c4c48[_0xff17('0x16e')][_0xff17('0x16f')]),'callerid':_0xf778a3,'Exten':_0xff17('0xe4'),'Context':_0xff17('0x193'),'Priority':'1','variable':_0x21867e,'timeout':(_0xbd4aec[_0xff17('0x55')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5d8eac})['then'](function(_0x346c92){return _0x386e35(_0x346c92);})[_0xff17('0xb2')](function(_0x265266){_0xbd4aec[_0xff17('0x60')]+=0x1;var _0x35fcaf=new History(_0xe5646e[_0xff17('0xab')][_0x5d8eac]);logger[_0xff17('0x94')](util[_0xff17('0x73')](_0xff17('0x194'),JSON[_0xff17('0x44')](_0x265266)));_0x35fcaf['state']=0xe;_0x35fcaf[_0xff17('0xa7')]=_0xff17('0x195');_0x35fcaf[_0xff17('0xa8')]=moment()[_0xff17('0x73')]('YYYY-MM-DD\x20HH:mm:ss');_0x35fcaf[_0xff17('0x128')]=_0x35fcaf[_0xff17('0xa8')];_0xe5646e[_0xff17('0xcd')](_0x35fcaf)[_0xff17('0xb2')](loggerCatch(_0xff17('0x196')));_0xe5646e[_0xff17('0xcb')](_0x35fcaf)[_0xff17('0xb2')](loggerCatch(_0xff17('0x196')))[_0xff17('0x1b')](function(){delete _0xe5646e['actions'][_0x5d8eac];return _0x4527c2(msgResponse('originate',_0xff17('0x43'),'originate\x20action\x20Error'));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x295b49){var _0x1d89fa=this[_0xff17('0xab')][_0x295b49[_0xff17('0x12b')]];if(_0x1d89fa){delete this[_0xff17('0xab')][_0x295b49[_0xff17('0x12b')]];_0x1d89fa['responsetime']=moment()[_0xff17('0x73')](_0xff17('0x102'));var _0x1eb1be=_0x1d89fa['type']===_0xff17('0x76')?this['campaigns'][_0x1d89fa[_0xff17('0xb4')]]:this[_0xff17('0x1d')][_0x1d89fa[_0xff17('0x197')]()];if(!this[_0xff17('0xda')](_0x295b49[_0xff17('0x198')])){this[_0xff17('0xb3')](_0x1eb1be);return this[_0xff17('0x199')](_0x1d89fa,_0x1eb1be,_0x295b49)[_0xff17('0xb2')](loggerCatch('[callProgressDetecting]\x20'));}this['uniqueId'][_0x295b49[_0xff17('0xe8')]]=_0x1d89fa;}};Dialer['prototype'][_0xff17('0x19a')]=function(_0x86776b,_0x3b375c,_0x16ed01){var _0xfd380c=new History(_0x3b375c);if(_0xfd380c[_0xff17('0xf4')]+_0xfd380c[_0xff17('0xf5')]+_0xfd380c[_0xff17('0xf6')]+_0xfd380c[_0xff17('0xf7')]+_0xfd380c['countdropretry']+_0xfd380c[_0xff17('0xf9')]+_0xfd380c[_0xff17('0xfa')]+_0xfd380c['countagentrejectretry']>=_0x16ed01[_0xff17('0x19b')]-0x1){return!![];}switch(_0x86776b){case 0x3:if(_0xfd380c[_0xff17('0xf6')]>=_0x16ed01[_0xff17('0x19c')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countnoanswerretry':_0xfd380c['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xff17('0xff')](_0x16ed01[_0xff17('0x19d')],'minutes')['format'](_0xff17('0x102')),'ContactId':_0xfd380c[_0xff17('0x103')],'ListId':_0xfd380c[_0xff17('0xd5')],'VoiceQueueId':_0xfd380c['VoiceQueueId']||undefined,'CampaignId':_0xfd380c[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xfd380c[_0xff17('0xf4')]>=_0x16ed01[_0xff17('0x19e')]-0x1){return!![];}this[_0xff17('0xc0')]({'active':![],'countbusyretry':_0xfd380c['countbusyretry']+=0x1,'scheduledat':moment()[_0xff17('0xff')](_0x16ed01[_0xff17('0x19f')],_0xff17('0x101'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfd380c['ContactId'],'ListId':_0xfd380c[_0xff17('0xd5')],'VoiceQueueId':_0xfd380c[_0xff17('0xd7')]||undefined,'CampaignId':_0xfd380c[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0xfd380c['countcongestionretry']>=_0x16ed01[_0xff17('0x1a0')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0xfd380c[_0xff17('0xf5')]+=0x1,'scheduledat':moment()[_0xff17('0xff')](_0x16ed01[_0xff17('0x1a1')],'minutes')[_0xff17('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfd380c[_0xff17('0x103')],'ListId':_0xfd380c[_0xff17('0xd5')],'VoiceQueueId':_0xfd380c[_0xff17('0xd7')]||undefined,'CampaignId':_0xfd380c[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x1a2')));break;case 0x0:if(_0xfd380c[_0xff17('0xf7')]>=_0x16ed01[_0xff17('0x1a3')]-0x1){return!![];}else{this[_0xff17('0xc0')]({'active':![],'countnosuchnumberretry':_0xfd380c[_0xff17('0xf7')]+=0x1,'scheduledat':moment()[_0xff17('0xff')](_0x16ed01[_0xff17('0x1a4')],_0xff17('0x101'))[_0xff17('0x73')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xfd380c[_0xff17('0x103')],'ListId':_0xfd380c[_0xff17('0xd5')],'VoiceQueueId':_0xfd380c[_0xff17('0xd7')]||undefined,'CampaignId':_0xfd380c[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x1a5')));}break;case 0xa:if(_0xfd380c[_0xff17('0xf8')]>=_0x16ed01['dialDropMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0xfd380c['countdropretry']+=0x1,'scheduledat':moment()[_0xff17('0xff')](_0x16ed01[_0xff17('0x1a6')],'minutes')[_0xff17('0x73')](_0xff17('0x102')),'ContactId':_0xfd380c['ContactId'],'ListId':_0xfd380c['ListId'],'VoiceQueueId':_0xfd380c['VoiceQueueId']||undefined,'CampaignId':_0xfd380c[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x11e')));break;case 0xb:if(_0xfd380c['countabandonedretry']>=_0x16ed01[_0xff17('0x125')]-0x1){return!![];}this[_0xff17('0xc0')]({'active':![],'countabandonedretry':_0xfd380c['countabandonedretry']+=0x1,'scheduledat':moment()[_0xff17('0xff')](_0x16ed01[_0xff17('0x126')],_0xff17('0x101'))['format'](_0xff17('0x102')),'ContactId':_0xfd380c[_0xff17('0x103')],'ListId':_0xfd380c[_0xff17('0xd5')],'VoiceQueueId':_0xfd380c[_0xff17('0xd7')]||undefined,'CampaignId':_0xfd380c['CampaignId']||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x127')));break;case 0x13:if(_0xfd380c[_0xff17('0xfa')]>=_0x16ed01[_0xff17('0xfc')]-0x1){return!![];}this[_0xff17('0xc0')]({'active':![],'countmachineretry':_0xfd380c[_0xff17('0xfa')]+=0x1,'scheduledat':moment()[_0xff17('0xff')](_0x16ed01[_0xff17('0x100')],_0xff17('0x101'))[_0xff17('0x73')](_0xff17('0x102')),'ContactId':_0xfd380c['ContactId'],'ListId':_0xfd380c[_0xff17('0xd5')],'VoiceQueueId':_0xfd380c[_0xff17('0xd7')]||undefined,'CampaignId':_0xfd380c[_0xff17('0xd8')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xfd380c[_0xff17('0x108')]>=_0x16ed01['dialAgentRejectMaxRetry']-0x1){return!![];}this[_0xff17('0xc0')]({'active':![],'countagentrejectretry':_0xfd380c[_0xff17('0x108')]+=0x1,'scheduledat':moment()['add'](_0x16ed01[_0xff17('0x1a7')],'minutes')[_0xff17('0x73')](_0xff17('0x102')),'ContactId':_0xfd380c[_0xff17('0x103')],'ListId':_0xfd380c['ListId'],'VoiceQueueId':_0xfd380c[_0xff17('0xd7')]||undefined,'CampaignId':_0xfd380c[_0xff17('0xd8')]||undefined})['catch'](loggerCatch(_0xff17('0x1a8')));break;default:return!![];}};Dialer[_0xff17('0xac')][_0xff17('0x199')]=function(_0x1494f7,_0x3c13b8,_0x3591a5){var _0x43fc5e=this;var _0x37a4f7=new History(_0x1494f7);return new BPromise(function(_0x22c0e5,_0x4e9a52){if(_['isUndefined'](_0x3c13b8)&&typeof _0x3c13b8!==_0xff17('0x16c')){return _0x4e9a52(msgResponse('[callProgressDetecting]',_0xff17('0x147'),_0xff17('0x1a9')));}if(_[_0xff17('0x38')](_0x3591a5)&&typeof _0x3591a5!==_0xff17('0x16c')){return _0x4e9a52(msgResponse(_0xff17('0x1aa'),_0xff17('0x147'),_0xff17('0x1ab')));}switch(_0x3591a5['reason']){case'0':_0x3c13b8[_0xff17('0x5f')]+=0x1;_0x37a4f7[_0xff17('0xa6')]=0x0;_0x37a4f7[_0xff17('0xa7')]=_0xff17('0x1ac');_0x37a4f7['countnosuchnumberretry']+=0x1;_0x37a4f7[_0xff17('0xf1')]+=0x1;ami[_0xff17('0x47')](_0xff17('0x1ad'),ut[_0xff17('0xec')](_0x1494f7,_0xff17('0x1ae')));_0x43fc5e[_0xff17('0xcd')](_0x37a4f7)['catch'](loggerCatch(_0xff17('0xf3')));if(_0x43fc5e['checkRetriveMax'](0x0,_0x1494f7,_0x3c13b8)){if(_0x37a4f7[_0xff17('0xf7')]>=_0x3c13b8[_0xff17('0x1a3')]){_0x43fc5e[_0xff17('0xfd')](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1af'));}else{_0x43fc5e[_0xff17('0x109')](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1af'));}}break;case'3':_0x3c13b8[_0xff17('0x5e')]+=0x1;_0x37a4f7['state']=0x3;_0x37a4f7[_0xff17('0xa7')]=_0xff17('0x1b0');_0x37a4f7[_0xff17('0xf6')]+=0x1;_0x37a4f7[_0xff17('0xf1')]+=0x1;ami[_0xff17('0x47')](_0xff17('0x1b1'),ut[_0xff17('0xec')](_0x1494f7,_0xff17('0x1b2')));_0x43fc5e[_0xff17('0xcd')](_0x37a4f7)['catch'](loggerCatch(_0xff17('0x1b3')));if(_0x43fc5e[_0xff17('0x19a')](0x3,_0x1494f7,_0x3c13b8)){if(_0x37a4f7['countnoanswerretry']>=_0x3c13b8[_0xff17('0x19c')]){_0x43fc5e[_0xff17('0xfd')](_0x37a4f7,_0x22c0e5,_0x4e9a52,'reason\x203\x20ringing\x20no\x20answer');}else{_0x43fc5e['stateGlobal'](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1b4'));}}break;case'5':_0x3c13b8['outboundBusyCallsDay']+=0x1;_0x37a4f7[_0xff17('0xa6')]=0x5;_0x37a4f7[_0xff17('0xa7')]=_0xff17('0x1b5');_0x37a4f7[_0xff17('0xf4')]+=0x1;_0x37a4f7['countglobal']+=0x1;ami['emit'](_0xff17('0x1b6'),ut[_0xff17('0xec')](_0x1494f7,'busy'));_0x43fc5e[_0xff17('0xcd')](_0x37a4f7)[_0xff17('0xb2')](loggerCatch(_0xff17('0x1b7')));if(_0x43fc5e[_0xff17('0x19a')](0x5,_0x1494f7,_0x3c13b8)){if(_0x37a4f7[_0xff17('0xf4')]>=_0x3c13b8[_0xff17('0x19e')]){_0x43fc5e['createStateFinal'](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1b8'));}else{_0x43fc5e[_0xff17('0x109')](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1b8'));}}break;case'8':_0x3c13b8[_0xff17('0x5b')]+=0x1;_0x37a4f7[_0xff17('0xa6')]=0x8;_0x37a4f7[_0xff17('0xa7')]=_0xff17('0x1b9');_0x37a4f7[_0xff17('0xf5')]+=0x1;_0x37a4f7[_0xff17('0xf1')]+=0x1;ami['emit'](_0xff17('0x1ba'),ut['buildObj'](_0x1494f7,'congestion'));_0x43fc5e[_0xff17('0xcd')](_0x37a4f7)[_0xff17('0xb2')](loggerCatch(_0xff17('0x1bb')));if(_0x43fc5e['checkRetriveMax'](0x8,_0x1494f7,_0x3c13b8)){if(_0x37a4f7[_0xff17('0xf5')]>=_0x3c13b8[_0xff17('0x1a0')]){_0x43fc5e[_0xff17('0xfd')](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1bc'));}else{_0x43fc5e['stateGlobal'](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1bc'));}}break;case'11':_0x3c13b8[_0xff17('0x1bd')]+=0x1;_0x37a4f7[_0xff17('0xa6')]=0xb;_0x37a4f7[_0xff17('0xa7')]='Abandoned';_0x37a4f7['countabandonedretry']+=0x1;_0x37a4f7['countglobal']+=0x1;_0x43fc5e[_0xff17('0xcd')](_0x37a4f7)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x43fc5e['checkRetriveMax'](0xb,_0x1494f7,_0x3c13b8)){if(_0x37a4f7[_0xff17('0xf9')]>=_0x3c13b8['dialAbandonedMaxRetry']){_0x43fc5e['createStateFinal'](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1be'));}else{_0x43fc5e['stateGlobal'](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0xff17('0x1be'));}}break;case'20':_0x3c13b8['outboundRejectCallsDay']+=0x1;_0x37a4f7[_0xff17('0xa6')]=0x14;_0x37a4f7[_0xff17('0xa7')]='AgentReject';_0x37a4f7['countagentrejectretry']+=0x1;_0x37a4f7[_0xff17('0xf1')]+=0x1;ami[_0xff17('0x47')](_0xff17('0x1bf'),ut['buildObj'](_0x1494f7,_0xff17('0x1c0')));_0x43fc5e[_0xff17('0xcd')](_0x37a4f7)[_0xff17('0xb2')](loggerCatch(_0xff17('0x1c1')));if(_0x43fc5e[_0xff17('0x19a')](0x14,_0x1494f7,_0x3c13b8)){if(_0x37a4f7[_0xff17('0x108')]>=_0x3c13b8[_0xff17('0x1c2')]){_0x43fc5e[_0xff17('0xfd')](_0x37a4f7,_0x22c0e5,_0x4e9a52,'reason\x2020\x20agentreject');}else{_0x43fc5e['stateGlobal'](_0x37a4f7,_0x22c0e5,_0x4e9a52,'reason\x2020\x20agentreject');}}break;default:_0x3c13b8['outboundUnknownCallsDay']+=0x1;_0x37a4f7[_0xff17('0xa6')]=0xc;_0x37a4f7[_0xff17('0xa7')]=_0x3591a5[_0xff17('0x1c3')];_0x43fc5e[_0xff17('0xcd')](_0x37a4f7)['catch'](loggerCatch(_0xff17('0x1c4')));if(_0x43fc5e[_0xff17('0x19a')](_0x3591a5[_0xff17('0x1c3')],_0x1494f7,_0x3c13b8)){if(_0x37a4f7['countbusyretry']+_0x37a4f7[_0xff17('0xf5')]+_0x37a4f7[_0xff17('0xf6')]+_0x37a4f7[_0xff17('0xf7')]+_0x37a4f7[_0xff17('0xf8')]+_0x37a4f7[_0xff17('0xf9')]+_0x37a4f7[_0xff17('0xfa')]+_0x37a4f7[_0xff17('0x108')]>=_0x3c13b8[_0xff17('0x19b')]){_0x43fc5e[_0xff17('0x109')](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0x3591a5[_0xff17('0x1c3')]);}else{_0x43fc5e['createStateFinal'](_0x37a4f7,_0x22c0e5,_0x4e9a52,_0x3591a5[_0xff17('0x1c3')]);}}}});};Dialer[_0xff17('0xac')][_0xff17('0x109')]=function(_0xab1b09,_0x46cc0f,_0x59fc69,_0x4629c3){var _0x54969e=new Final(_0xab1b09);_0x54969e['state']=0xf;_0x54969e['statedesc']=_0xff17('0x1c5');this[_0xff17('0xfd')](_0x54969e,_0x46cc0f,_0x59fc69,_0x4629c3);};Dialer['prototype'][_0xff17('0xfd')]=function(_0x3c67a3,_0x310ee1,_0x288cce,_0x1f8079){this[_0xff17('0xcb')](_0x3c67a3)['then'](function(){return _0x310ee1(msgResponse(_0xff17('0x1aa'),_0xff17('0xdb'),_0x1f8079));})[_0xff17('0xb2')](function(){return _0x288cce(msgResponse('[moveContactManagedDialer][0]',_0xff17('0x147'),_0xff17('0x1c6')));});};Dialer[_0xff17('0xac')][_0xff17('0x15c')]=function(_0x3db607){var _0x8f26d8=_0x3db607['dialPredictiveOptimizationPercentage']/0x64;var _0x37c637=_0x3db607[_0xff17('0x5d')]/(_0x3db607[_0xff17('0x5d')]+_0x3db607[_0xff17('0x58')]);var _0x2a2213=Math[_0xff17('0x1c7')](_0x3db607[_0xff17('0x1c8')]*(_0x3db607['predictiveIntervalMaxThreshold']/0x64));var _0x1a29d0=Math['round'](_0x3db607[_0xff17('0x1c8')]*(_0x3db607[_0xff17('0x1c9')]/0x64));var _0x433e0a=_0x3db607['available']+_0x3db607[_0xff17('0x9f')];var _0x266127=Math['floor'](_0x3db607[_0xff17('0x88')]*_0x3db607['erlangAbandonmentRate']*_0x3db607[_0xff17('0x68')]*_0x3db607['predictiveIntervalMultiplicativeFactor']);if(_['isUndefined'](_0x3db607['startProgressive'])){if(!_[_0xff17('0x38')](_0x3db607[_0xff17('0x23')])){_0x3db607[_0xff17('0x23')]=undefined;loggerPredictive[_0xff17('0x94')](_0xff17('0x1ca'),_0xff17('0x1cb'));}if(!_[_0xff17('0x38')](_0x3db607[_0xff17('0x90')])){loggerPredictive[_0xff17('0x94')](_0xff17('0x1ca'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x3db607[_0xff17('0x90')]);_0x3db607[_0xff17('0x90')]=undefined;}_0x3db607[_0xff17('0x24')]=moment()['format'](_0xff17('0x102'));loggerPredictive[_0xff17('0x7d')](_0x3db607[_0xff17('0x3b')],_0xff17('0x1cc'),_0x3db607[_0xff17('0x24')]);this[_0xff17('0x15a')](_0x3db607,0x1);}else if(ifInterval(_0x3db607[_0xff17('0x1cd')],_0x3db607[_0xff17('0x24')])){this[_0xff17('0x15a')](_0x3db607,0x1);loggerPredictiveCalls[_0xff17('0x7d')]('[startMethodPredictive][StartProgressive][Loop]',_0x3db607[_0xff17('0x24')],_0x3db607['name']);_0x3db607[_0xff17('0x88')]=0x0;_0x3db607[_0xff17('0x67')]=0x0;}else if(_0x8f26d8<_0x37c637&&_0x3db607['dialPredictiveOptimization']===_0xff17('0x1ce')){freeVariablesPredictive(_0x3db607);loggerPredictive[_0xff17('0x7d')](_0xff17('0x1cf'),_0xff17('0x1d0'),_0x37c637,_0xff17('0x24'),_0x3db607['name']);}else if(_0x266127<_0x3db607[_0xff17('0x67')]&&_0x3db607['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x3db607);loggerPredictive[_0xff17('0x7d')](_0xff17('0x1d1'),_0xff17('0x1d2'),_0x266127,_0xff17('0x1d3'),_0x3db607[_0xff17('0x67')],_0xff17('0x24'),_0x3db607[_0xff17('0x3b')]);}else if(!ifInterval(_0x3db607['dialPredictiveInterval'],_0x3db607[_0xff17('0x24')])&&_[_0xff17('0x38')](_0x3db607['startPredictive'])&&!_[_0xff17('0x38')](_0x3db607[_0xff17('0x24')])){_0x3db607[_0xff17('0x23')]=moment()[_0xff17('0x73')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xff17('0x7d')](_0x3db607[_0xff17('0x3b')],_0xff17('0x1d4'),_0x3db607[_0xff17('0x23')]);this[_0xff17('0xbd')](_0x3db607['dialPredictiveInterval'])[_0xff17('0xb6')](this[_0xff17('0x1d5')](_0x3db607))[_0xff17('0xb6')](mergeDataErlangB(_0x3db607))['then'](this[_0xff17('0x1d6')](_0x3db607))[_0xff17('0xb2')](loggerCatchPredictive(_0xff17('0x1d7'),_0x3db607));}else if(!ifInterval(_0x3db607[_0xff17('0x1cd')],_0x3db607[_0xff17('0x23')])){_0x3db607[_0xff17('0x67')]=0x0;_0x3db607[_0xff17('0x23')]=moment()[_0xff17('0x73')](_0xff17('0x102'));loggerPredictive[_0xff17('0x7d')](_0x3db607[_0xff17('0x3b')],_0xff17('0x1d8'),_0x3db607[_0xff17('0x23')]);clearInterval(_0x3db607['handlePredictive']);_0x3db607['handlePredictive']=undefined;this[_0xff17('0xbd')](_0x3db607[_0xff17('0x1cd')])['then'](this[_0xff17('0x1d5')](_0x3db607))['then'](mergeDataErlangB(_0x3db607))[_0xff17('0xb6')](this[_0xff17('0x1d6')](_0x3db607))[_0xff17('0xb2')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3db607));}else if(_0x3db607[_0xff17('0x1c8')]&&_0x433e0a<_0x3db607[_0xff17('0x1c8')]-_0x1a29d0){freeVariablesPredictive(_0x3db607);loggerPredictive[_0xff17('0x7d')](_0x3db607['name'],_0xff17('0x1d9'),_0x433e0a,')\x20are\x20less\x20than\x20threshold\x20(',_0x3db607[_0xff17('0x1c8')],'-',_0x1a29d0,'=',_0x3db607[_0xff17('0x1c8')]-_0x1a29d0,')');}else if(_0x3db607[_0xff17('0x1c8')]&&_0x433e0a>_0x3db607['predictiveIntervalAvailable']+_0x2a2213){freeVariablesPredictive(_0x3db607);loggerPredictive[_0xff17('0x7d')](_0x3db607['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x433e0a,_0xff17('0x1da'),_0x3db607[_0xff17('0x1c8')],'+',_0x2a2213,'=',_0x3db607[_0xff17('0x1c8')]+_0x2a2213,')');}};Dialer[_0xff17('0xac')][_0xff17('0x1d5')]=function(_0x4c41cd){var _0x211cb0=this;return function(_0x9d4ec){return new BPromise(function(_0x337543,_0x8be654){_['merge'](_0x4c41cd,_0x9d4ec[0x0]);if(checkGetDataPredictive(_0x9d4ec[0x0])){var _0x20a279=_0x4c41cd[_0xff17('0x1c8')]=_0x4c41cd[_0xff17('0x9f')]+_0x4c41cd['available'];var _0x2e1cab=_0x4c41cd[_0xff17('0x1cd')]*0x3c;var _0x2f4308=_0x9d4ec[0x0][_0xff17('0x82')]+_0x9d4ec[0x0][_0xff17('0x64')];var _0x4f0fe3=(_0x9d4ec[0x0][_0xff17('0x7c')]+_0x9d4ec[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x9d4ec[0x0][_0xff17('0x80')])/_0x9d4ec[0x0][_0xff17('0x6b')];_0x4c41cd[_0xff17('0x68')]=_0x4f0fe3>0x0?_0x4f0fe3:0x1;switch(_0x4c41cd['dialPredictiveOptimization']){case _0xff17('0x1ce'):var _0xd78ef3=_0x4c41cd['dialPredictiveOptimizationPercentage']/0x64;return _0x211cb0[_0xff17('0x1db')](_0x20a279,_0x2e1cab,_0x2f4308,_0x4f0fe3,_0xd78ef3)['then'](function(_0x29ad9c){return _0x337543(_0x29ad9c);});case _0xff17('0x1dc'):var _0x58de2d=_0x4c41cd[_0xff17('0x1dd')]/0x64;return _0x211cb0['busyFactor'](_0x20a279,_0x2e1cab,_0x2f4308,_0x4f0fe3,_0x58de2d)[_0xff17('0xb6')](function(_0x2c0f4d){return _0x337543(_0x2c0f4d);});default:return _0x8be654(msgResponse(_0xff17('0x1de'),_0xff17('0x147'),_0xff17('0x1df')));}}else{return _0x8be654(msgResponse(_0xff17('0x1de'),_0xff17('0x147'),_0xff17('0x1e0')));}});};};Dialer[_0xff17('0xac')][_0xff17('0x1e1')]=function(_0x1acc26){var _0x43e770=this;return function(_0x59ee0d){return new BPromise(function(_0x2819fc,_0xab0858){_[_0xff17('0x8d')](_0x1acc26,_0x59ee0d[0x0]);if(checkGetDataPredictive(_0x59ee0d[0x0])){loggerPredictive['info'](JSON[_0xff17('0x44')](_0x59ee0d[0x0]));if(_0x1acc26['dialPredictiveOptimization']===_0xff17('0x1ce')){return _0x43e770[_0xff17('0xc9')](_0x1acc26['id'])[_0xff17('0xb6')](function(_0x107118){var _0x4f1209=_0x1acc26[_0xff17('0x4c')]-_0x107118[0x0][_0xff17('0x1e2')];var _0x277c55=_0x1acc26[_0xff17('0x1cd')]*0x3c;var _0x4fde72=_0x59ee0d[0x0]['predictiveIntervalAvgTalktime']+_0x59ee0d[0x0][_0xff17('0x64')];var _0x3d9e47=(_0x59ee0d[0x0]['predictiveIntervalAnsweredCalls']+_0x59ee0d[0x0][_0xff17('0x65')]+_0x59ee0d[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x59ee0d[0x0][_0xff17('0x6b')];var _0x5108a3=_0x1acc26[_0xff17('0x1dd')]/0x64;_0x1acc26['predictiveIntervalPauses']=_0x107118[0x0][_0xff17('0x1e2')]||0x0;_0x1acc26[_0xff17('0x68')]=_0x3d9e47>0x0?_0x3d9e47:0x1;return _0x43e770[_0xff17('0x1db')](_0x4f1209,_0x277c55,_0x4fde72,_0x3d9e47,_0x5108a3);})['then'](function(_0x21341b){return _0x2819fc(_0x21341b);})[_0xff17('0xb2')](function(_0x2f15ad){return _0xab0858(msgResponse('[CatchErlangB]',_0xff17('0x147'),JSON[_0xff17('0x44')](_0x2f15ad)));});}if(_0x1acc26['dialPredictiveOptimization']==='agentBusyFactor'){return _0x43e770[_0xff17('0xc9')](_0x1acc26['id'])[_0xff17('0xb6')](function(_0x4cefa4){var _0x11886a=_0x1acc26[_0xff17('0x4c')]-_0x4cefa4[0x0][_0xff17('0x1e2')];var _0xb4ad1a=_0x1acc26[_0xff17('0x1cd')]*0x3c;var _0x92025d=_0x59ee0d[0x0][_0xff17('0x82')]+_0x59ee0d[0x0]['predictiveIntervalAvgHoldtime'];var _0x3b75b5=(_0x59ee0d[0x0][_0xff17('0x7c')]+_0x59ee0d[0x0][_0xff17('0x65')]+_0x59ee0d[0x0][_0xff17('0x80')])/_0x59ee0d[0x0]['predictiveIntervalTotalCalls'];var _0x240460=_0x1acc26['dialPredictiveOptimizationPercentage']/0x64;_0x1acc26[_0xff17('0x6a')]=_0x4cefa4[0x0][_0xff17('0x1e2')]||0x0;_0x1acc26[_0xff17('0x68')]=_0x3b75b5>0x0?_0x3b75b5:0x1;return _0x43e770[_0xff17('0x1e3')](_0x11886a,_0xb4ad1a,_0x92025d,_0x3b75b5,_0x240460);})[_0xff17('0xb6')](function(_0x10e677){return _0x2819fc(_0x10e677);})['catch'](function(_0x324a0a){return _0xab0858(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x324a0a)));});}}else{return _0xab0858(msgResponse(_0xff17('0x1de'),_0xff17('0x147'),_0xff17('0x1e0')));}});};};Dialer[_0xff17('0xac')][_0xff17('0x1d6')]=function(_0x3a3238){var _0x57e241=this;return function(){var _0x4b2d87=0x0;var _0x11cbad=Math[_0xff17('0x1e4')](_0x3a3238[_0xff17('0x8a')]*0x3e8);if(_0x11cbad>0x0){_0x11cbad=_0x11cbad<0x64?0x64:_0x11cbad;loggerPredictive[_0xff17('0x7d')](_0x3a3238[_0xff17('0x3b')],_0xff17('0x1e5'),_0x11cbad,_0xff17('0x45'));_0x3a3238[_0xff17('0x90')]=setInterval(function(){_0x57e241[_0xff17('0x90')](_0x3a3238);loggerPredictiveCalls[_0xff17('0x7d')]('[handlePredictive]',_0x4b2d87+=0x1);},_0x11cbad);}else{loggerPredictive[_0xff17('0x7d')](_0x3a3238[_0xff17('0x3b')],_0xff17('0x1e6'));}};};Dialer[_0xff17('0xac')][_0xff17('0x1e7')]=function(_0x4803c9,_0x5c4632){var _0x52c562=this;return function(_0x21e94b){if(_[_0xff17('0x79')](_0x21e94b)){if(_['isNil'](_0x5c4632[_0xff17('0xd6')])||!_0x5c4632[_0xff17('0x1e8')]){if(_0x4803c9[_0xff17('0x53')]==='booked'){_0x4803c9['queueStatusComplete']=_[_0xff17('0x38')](_0x4803c9['queueStatusComplete'])?!![]:_0x4803c9[_0xff17('0x12f')];var _0x538a0a=uuid['v4']();_0x52c562[_0xff17('0xab')][_0x538a0a]=new Action(_0x4803c9,_0x5c4632,_0x538a0a);loggerBooked[_0xff17('0x7d')]('[booked][checkContactBlack]',_0x538a0a,'queueStatusComplete:\x20',JSON['stringify'](_0x4803c9[_0xff17('0x12f')]),_0xff17('0x1e9'),_0x4803c9['name']);if(_0x4803c9[_0xff17('0x12f')]){_0x4803c9[_0xff17('0x12f')]=![];_0x52c562[_0xff17('0x25')][_0x52c562['actions'][_0x538a0a][_0xff17('0xb4')]]=[];ami[_0xff17('0xaf')]({'actionid':_0x538a0a,'action':'queuestatus','queue':_0x4803c9[_0xff17('0x3b')]})[_0xff17('0xb2')](function(){_0x52c562[_0xff17('0xb3')](_0x4803c9);_0x52c562[_0xff17('0xc0')]({'active':![],'ContactId':_0x52c562[_0xff17('0xab')][_0x538a0a]['ContactId'],'ListId':_0x52c562[_0xff17('0xab')][_0x538a0a][_0xff17('0xd5')],'VoiceQueueId':_0x52c562[_0xff17('0xab')][_0x538a0a][_0xff17('0xd7')]||undefined,'CampaignId':_0x52c562[_0xff17('0xab')][_0x538a0a][_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x1ea')));delete _0x52c562[_0xff17('0xab')][_0x538a0a];});}else{loggerBooked[_0xff17('0x7d')](_0xff17('0x1eb'),JSON[_0xff17('0x44')](_0x4803c9[_0xff17('0x12f')]),_0xff17('0x1e9'),_0x4803c9['name']);_0x52c562[_0xff17('0xb3')](_0x4803c9);_0x52c562[_0xff17('0xc0')]({'active':![],'ContactId':_0x52c562['actions'][_0x538a0a]['ContactId'],'ListId':_0x52c562[_0xff17('0xab')][_0x538a0a][_0xff17('0xd5')],'VoiceQueueId':_0x52c562[_0xff17('0xab')][_0x538a0a][_0xff17('0xd7')]||undefined,'CampaignId':_0x52c562[_0xff17('0xab')][_0x538a0a][_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch(_0xff17('0x1ea')));delete _0x52c562[_0xff17('0xab')][_0x538a0a];}}else{return _0x52c562['actionOriginate'](_0x4803c9,_0x5c4632);}}else{if(getDiff(_0x5c4632[_0xff17('0x1ec')])<_0x4803c9[_0xff17('0x1ed')]*0x3c){if(_0x5c4632[_0xff17('0x1ee')]&&!_0x5c4632[_0xff17('0x1ee')]['voicePause']){_0x52c562[_0xff17('0x92')][_0xff17('0x131')](_0x5c4632['id'])[_0xff17('0x1b')](function(){_0x52c562[_0xff17('0xb3')](_0x4803c9);});}else{_0x52c562['unlockContact']({'active':![]},_0x5c4632['id'],0x1)[_0xff17('0x1b')](function(){_0x52c562['updateOriginated'](_0x4803c9);});}}else{_0x4803c9['outboundReCallsDay']+=0x1;_0x52c562['updateOriginated'](_0x4803c9);if(_0x4803c9[_0xff17('0x1ef')]){_0x52c562['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c4632[_0xff17('0x103')],'ListId':_0x5c4632['ListId'],'VoiceQueueId':_0x5c4632[_0xff17('0xd7')]||undefined,'CampaignId':_0x5c4632[_0xff17('0xd8')]||undefined})[_0xff17('0xb2')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x52c562[_0xff17('0xcd')](createObjHistory(_0x4803c9,_0x5c4632,_0xff17('0x1f0'),0x17,'RecallInQueue'))[_0xff17('0xb2')](loggerCatch(_0xff17('0x1f1')));}else{_0x52c562['saveInDb'](createObjHistory(_0x4803c9,_0x5c4632,'RECALLFAILEDTIMEOUT',0x16,_0xff17('0x1f2')),_0xff17('0x1f3'),_0xff17('0x1f4'));}}}}else{_0x4803c9[_0xff17('0x59')]+=0x1;_0x52c562[_0xff17('0xd3')](createObjHistory(_0x4803c9,_0x5c4632,_0xff17('0x1f5'),0xd,'Blacklist'),'[Originate][historyBlacklist]',_0xff17('0x1f6'));throw'inBlackList';}};};Dialer[_0xff17('0xac')][_0xff17('0x160')]=function(_0x3150e0){var _0x2ac56a=this;var _0x503c52=_0x3150e0[_0xff17('0x1f7')]-_0x3150e0['originated']-_0x3150e0[_0xff17('0xc5')];emitCampaignSummary(_0x3150e0);if(_0x503c52>0x0){if(_0x503c52>this[_0xff17('0x1f8')]){_0x503c52=this[_0xff17('0x1f8')];}_0x3150e0[_0xff17('0xc5')]+=_0x503c52;this[_0xff17('0xc7')](_0x3150e0['id'],_0x503c52,_0x3150e0[_0xff17('0x1f9')],_0x3150e0)[_0xff17('0xb6')](function(_0x34b5e4){_0x3150e0[_0xff17('0xc5')]-=_0x503c52;_0x3150e0[_0xff17('0xc5')]=_0x3150e0[_0xff17('0xc5')]>0x0?_0x3150e0['temp']:0x0;if(!checkContactEmpty(_0x34b5e4)){_0x3150e0[_0xff17('0x39')]=_0xff17('0x9e');logger[_0xff17('0x7d')]('[getContactCampaign2][Empty]'+_0x3150e0[_0xff17('0x3b')]);}else{_0x3150e0['originated']+=_0x34b5e4[_0xff17('0x97')];_0x3150e0[_0xff17('0x39')]=_0xff17('0x1fa');for(var _0x8a9cce=0x0;_0x8a9cce<_0x34b5e4[_0xff17('0x97')];_0x8a9cce+=0x1){_0x3150e0[_0xff17('0x1fb')]+=0x1;if(_['isNil'](_0x34b5e4[_0x8a9cce])||_['isNil'](_0x34b5e4[_0x8a9cce][_0xff17('0x16e')])||_[_0xff17('0xae')](_0x34b5e4[_0x8a9cce][_0xff17('0x16e')][_0xff17('0x16f')])){_0x2ac56a[_0xff17('0xd1')]('[actionOriginate]\x20',_0x3150e0,_0x34b5e4[_0x8a9cce]);}else{_0x2ac56a[_0xff17('0xbb')](_[_0xff17('0xd4')](_0x34b5e4[_0x8a9cce],[_0xff17('0xd8'),_0xff17('0x1fc')]))['then'](_0x2ac56a[_0xff17('0x1e7')](_0x3150e0,_0x34b5e4[_0x8a9cce]))[_0xff17('0xb2')](_0x2ac56a[_0xff17('0xd0')](_0xff17('0x1fd'),_0x3150e0));}}}})[_0xff17('0xb2')](loggerGetContactDialer(_0xff17('0x1fe'),_0x3150e0,_0x503c52));}};Dialer[_0xff17('0xac')]['handlePower']=function(_0x2ddad1,_0x3d6b0d){var _0x8645fc=this;var _0x3c57a2=[];var _0x261a0e=_0x3d6b0d>=0x1?_0x3d6b0d:0x1;if(_0x2ddad1[_0xff17('0x53')]===_0xff17('0x8')){_0x261a0e=0x1;}var _0xd871d5=Math[_0xff17('0x1e4')](_0x2ddad1['available']*_0x261a0e)-_0x2ddad1[_0xff17('0x6c')]-_0x2ddad1['temp'];emitVoiceQueueSummary(_0x2ddad1);if(_0x2ddad1[_0xff17('0x1ff')]>0x0){var _0x5ed9a9=_0x2ddad1[_0xff17('0x1ff')]-_0x2ddad1[_0xff17('0x6c')]-_0x2ddad1[_0xff17('0x9f')]-_0x2ddad1[_0xff17('0xc5')]-_0x2ddad1[_0xff17('0x4d')];if(_0xd871d5>_0x5ed9a9){_0xd871d5=_0x5ed9a9;}}if(_0xd871d5>0x0){if(_0x2ddad1['dialMethod']==='booked'){_0xd871d5=0x1;}if(_0xd871d5>this[_0xff17('0x1f8')]){_0xd871d5=this[_0xff17('0x1f8')];}_0x2ddad1[_0xff17('0xc5')]+=_0xd871d5;for(var _0x63089d in this[_0xff17('0x1f')]){if(typeof this[_0xff17('0x1f')][_0x63089d]!==_0xff17('0x98')){if(this[_0xff17('0x1f')][_0x63089d][_0xff17('0xa6')]===_0xff17('0x200')&&this['agents'][_0x63089d][_0xff17('0xb0')]===_0xff17('0xdd')){_0x3c57a2[_0xff17('0x201')](this[_0xff17('0x1f')][_0x63089d]['id']);}}}this[_0xff17('0xc4')](_0x2ddad1['id'],_0x3c57a2,_0xd871d5,_0x2ddad1[_0xff17('0x1f9')],_0x2ddad1)['then'](function(_0x2f5b37){_0x2ddad1[_0xff17('0xc5')]-=_0xd871d5;_0x2ddad1[_0xff17('0xc5')]=_0x2ddad1[_0xff17('0xc5')]>0x0?_0x2ddad1[_0xff17('0xc5')]:0x0;if(!checkContactEmpty(_0x2f5b37)){_0x8645fc[_0xff17('0xb7')](_0x2ddad1)[_0xff17('0xb6')](sendMessageReschedule(_0x2ddad1))[_0xff17('0xb2')](loggerCatch(_0xff17('0x202')));}else{_0x2ddad1['originated']+=_0x2f5b37[_0xff17('0x97')];_0x2ddad1[_0xff17('0x39')]=_0x2ddad1['dialMethod']===_0xff17('0x8')?'ACTIVE':_0xff17('0x1fa');for(var _0x3b5f8e=0x0;_0x3b5f8e<_0x2f5b37[_0xff17('0x97')];_0x3b5f8e+=0x1){if(_[_0xff17('0xae')](_0x2f5b37[_0x3b5f8e])||_['isNil'](_0x2f5b37[_0x3b5f8e][_0xff17('0x16e')])||_[_0xff17('0xae')](_0x2f5b37[_0x3b5f8e][_0xff17('0x16e')]['phone'])){_0x8645fc[_0xff17('0xd1')](_0xff17('0x203'),_0x2ddad1,_0x2f5b37[_0x3b5f8e]);}else{_0x8645fc[_0xff17('0xb8')](_[_0xff17('0xd4')](_0x2f5b37[_0x3b5f8e],[_0xff17('0xd7'),_0xff17('0x1fc')]))[_0xff17('0xb6')](_0x8645fc[_0xff17('0x1e7')](_0x2ddad1,_0x2f5b37[_0x3b5f8e]))[_0xff17('0xb2')](_0x8645fc[_0xff17('0xd0')](_0xff17('0x203'),_0x2ddad1));}}}})['catch'](loggerGetContactDialer(_0xff17('0x204'),_0x2ddad1,_0xd871d5));}};Dialer['prototype'][_0xff17('0x90')]=function(_0x86ec2b){if(_0x86ec2b[_0xff17('0x1ff')]>0x0){var _0x34b03b=_0x86ec2b[_0xff17('0x1ff')]-_0x86ec2b[_0xff17('0x6c')]-_0x86ec2b[_0xff17('0x9f')];if(_0x34b03b>0x0){this[_0xff17('0x205')](_0x86ec2b);}else{loggerPredictiveCalls['info'](_0xff17('0x206'));}}else{this[_0xff17('0x205')](_0x86ec2b);}};Dialer[_0xff17('0xac')][_0xff17('0x205')]=function(_0x36a6b0){var _0x6f484b=this;var _0x3b5e06=[];_0x36a6b0['originated']+=0x1;for(var _0x2957a5 in this[_0xff17('0x1f')]){if(typeof this['agents'][_0x2957a5]!=='undefined'){if(this[_0xff17('0x1f')][_0x2957a5][_0xff17('0xa6')]===_0xff17('0x200')&&this[_0xff17('0x1f')][_0x2957a5][_0xff17('0xb0')]==='reachable'){_0x3b5e06[_0xff17('0x201')](this[_0xff17('0x1f')][_0x2957a5]['id']);}}}this[_0xff17('0xc4')](_0x36a6b0['id'],_0x3b5e06,0x1,_0x36a6b0[_0xff17('0x1f9')],_0x36a6b0)[_0xff17('0xb6')](function(_0x51fd5b){if(!checkContactEmpty(_0x51fd5b)){checkContactLowerLimitOriginate(_0x36a6b0,0x1,0x0);_0x6f484b[_0xff17('0xb7')](_0x36a6b0)[_0xff17('0xb6')](sendMessageReschedule(_0x36a6b0))[_0xff17('0xb2')](loggerCatch('[countReScheduled]\x20'));}else{_0x36a6b0['message']='RUNNING';if(_[_0xff17('0xae')](_0x51fd5b[0x0])||_[_0xff17('0xae')](_0x51fd5b[0x0][_0xff17('0x16e')])||_[_0xff17('0xae')](_0x51fd5b[0x0][_0xff17('0x16e')][_0xff17('0x16f')])){_0x6f484b['emptyContact'](_0xff17('0x203'),_0x36a6b0,_0x51fd5b[0x0]);}else{_0x6f484b[_0xff17('0xb8')](_[_0xff17('0xd4')](_0x51fd5b[0x0],['VoiceQueueId',_0xff17('0x1fc')]))[_0xff17('0xb6')](_0x6f484b[_0xff17('0x1e7')](_0x36a6b0,_0x51fd5b[0x0]))[_0xff17('0xb2')](_0x6f484b[_0xff17('0xd0')](_0xff17('0x207'),_0x36a6b0));}}})[_0xff17('0xb2')](loggerGetContactDialer('[getContactDialerPredictive]',_0x36a6b0,0x1));emitVoiceQueueSummary(_0x36a6b0);};Dialer[_0xff17('0xac')][_0xff17('0x1db')]=function(_0x2562cf,_0x293dbc,_0x272fc1,_0x5485c9,_0x10e17b,_0x35a833){loggerPredictive[_0xff17('0x7d')](_0xff17('0x208'));loggerPredictive[_0xff17('0x7d')](_0xff17('0x209'),_0x2562cf);loggerPredictive[_0xff17('0x7d')](_0xff17('0x20a'),_0x293dbc);loggerPredictive[_0xff17('0x7d')](_0xff17('0x20b'),_0x272fc1);loggerPredictive[_0xff17('0x7d')](_0xff17('0x20c'),_0x5485c9);loggerPredictive[_0xff17('0x7d')](_0xff17('0x20d'),_0x10e17b);loggerPredictive['info'](_0xff17('0x83'));return new BPromise(function(_0x574377,_0x2f2d7c){if(_0x2562cf<=0x0||isNaN(_0x2562cf)){return _0x2f2d7c(msgResponse('[abandonmentRate]',_0xff17('0x43'),_0xff17('0x20e')+_0x2562cf));}if(_0x272fc1<=0x0||isNaN(_0x272fc1)){return _0x2f2d7c(msgResponse(_0xff17('0x20f'),_0xff17('0x43'),_0xff17('0x210')+_0x272fc1));}if(_0x5485c9<=0x0||isNaN(_0x5485c9)){return _0x2f2d7c(msgResponse(_0xff17('0x20f'),_0xff17('0x43'),_0xff17('0x211')+_0x5485c9));}if(_0x293dbc<=0x0||isNaN(_0x293dbc)){return _0x2f2d7c(msgResponse('[abandonmentRate]','Error',_0xff17('0x212')+_0x293dbc));}if(_0x10e17b<=0x0||isNaN(_0x10e17b)){return _0x2f2d7c(msgResponse(_0xff17('0x20f'),_0xff17('0x43'),_0xff17('0x213')+_0x10e17b));}_0x35a833=_0x35a833||0x0;var _0x30e9a6=0x1/_0x272fc1;var _0xfbde50=0x0;var _0x445450=0x0;var _0x357040=0x0;var _0x12c358=0x0;for(var _0x4628dd=0x0;_0x357040<_0x10e17b;_0x4628dd+=0x1){_0x445450=_0x4628dd/_0x293dbc;_0xfbde50=(_0x5485c9*_0x445450+_0x35a833)/_0x30e9a6;_0x357040=erlangb(_0xfbde50,_0x2562cf);_0x12c358=_0xfbde50/_0x2562cf*(0x1-erlangb(_0xfbde50,_0x2562cf));}return _0x574377({'erlangCalls':_0x4628dd,'erlangCallToSecond':_0x293dbc/_0x4628dd,'erlangAbandonmentRate':_0x357040,'erlangBusyFactor':_0x12c358});});};Dialer[_0xff17('0xac')]['busyFactor']=function(_0x46fb5f,_0x438f25,_0x48895e,_0x39c223,_0x5c8fa7,_0x55e642){loggerPredictive[_0xff17('0x7d')](_0xff17('0x214'));loggerPredictive[_0xff17('0x7d')](_0xff17('0x209'),_0x46fb5f);loggerPredictive[_0xff17('0x7d')](_0xff17('0x20a'),_0x438f25);loggerPredictive[_0xff17('0x7d')](_0xff17('0x20b'),_0x48895e);loggerPredictive[_0xff17('0x7d')](_0xff17('0x20c'),_0x39c223);loggerPredictive[_0xff17('0x7d')](_0xff17('0x215'),_0x5c8fa7);loggerPredictive['info'](_0xff17('0x83'));return new BPromise(function(_0xe46567,_0x15e106){if(_0x46fb5f<=0x0||isNaN(_0x46fb5f)){return _0x15e106(msgResponse(_0xff17('0x216'),_0xff17('0x43'),_0xff17('0x20e')+_0x46fb5f));}if(_0x48895e<=0x0||isNaN(_0x48895e)){return _0x15e106(msgResponse(_0xff17('0x216'),_0xff17('0x43'),_0xff17('0x210')+_0x48895e));}if(_0x39c223<=0x0||isNaN(_0x39c223)){return _0x15e106(msgResponse(_0xff17('0x216'),'Error',_0xff17('0x211')+_0x39c223));}if(_0x438f25<=0x0||isNaN(_0x438f25)){return _0x15e106(msgResponse(_0xff17('0x216'),_0xff17('0x43'),_0xff17('0x212')+_0x438f25));}if(_0x5c8fa7<=0x0||isNaN(_0x5c8fa7)){return _0x15e106(msgResponse(_0xff17('0x216'),_0xff17('0x43'),_0xff17('0x217')+_0x5c8fa7));}_0x55e642=_0x55e642||0x0;var _0x535705=0x1/_0x48895e;var _0x10e7ae=0x0;var _0x49bf60=0x0;var _0xa4012=0x0;var _0x588a91=0x0;for(var _0x13f0f9=0x0;_0x588a91<_0x5c8fa7;_0x13f0f9+=0x1){_0x49bf60=_0x13f0f9/_0x438f25;_0x10e7ae=(_0x39c223*_0x49bf60+_0x55e642)/_0x535705;_0xa4012=erlangb(_0x10e7ae,_0x46fb5f);_0x588a91=_0x10e7ae/_0x46fb5f*(0x1-erlangb(_0x10e7ae,_0x46fb5f));}return _0xe46567({'erlangCalls':_0x13f0f9,'erlangCallToSecond':_0x438f25/_0x13f0f9,'erlangAbandonmentRate':_0xa4012,'erlangBusyFactor':_0x588a91});});};module['exports']=Dialer; \ No newline at end of file +var _0xb945=['XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','XMD-','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','dialPrefix','dialCutDigit','substring','trim','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','noanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','dialPredictiveInterval','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(','predictiveIntervalDroppedCallsCallersExit','dialPredictiveOptimizationPercentage','abandonmentRate','agentBusyFactor','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','busyFactor','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','dialRecallInQueue','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','inBlackList','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','Contact.phone','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','tryOriginatePredictive','[handlePredictive][limitChannel]','[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','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','m\x20=\x20','[abandonmentRate]','p\x20=\x20','interval\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]','Ts\x20=\x20','Umin\x20=\x20','exports','util','bluebird','moment','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','../ami','defaults','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueRt','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncHangup','newexten','syncNewExten','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20NOT\x20Active','Interval','\x20INTERVAL_IS_NULL','INTERVAL_IS_NULL','name','isEmpty','[ifTime][Action]','milliseconds','diff','seconds','emit','type','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','stringify','md5','format','voice:queue:%s','ivr','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','contactsRescheduled','RESCHEDULED_CONTACTS','[getContactDialer2][ReScheduled]','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','waiting','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','clearZombieChannels','[uniqueid]','[actions]','prototype','sequence','isNil','Action','status','catch','No\x20such\x20channel','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','checkIsBlackListIvr','averageHandleTime','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','merge','pick','ContactId','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','SIP/%s','reachable','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','uniqueid','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','[syncHangupInAMD][createHistory]','value','MACHINE','Machine','countmachineretry','countglobal','buildObj','[syncAgentComplete][createHistory][0]','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','add','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete]','[syncAgentComplete][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','Drop','dropreason','dialDropRetryFrequency','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','CALLEREXIT','dialAbandonedMaxRetry','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','locked','stateinterface','strategy','queueBooked','push','idHopper','paused','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','loopCampaigns','syncCampaigns','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','timezones','\x20Timezone\x20unknow\x20','isArray','iftime\x20%s,%s','indexOf','true','content','all','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','checkDialMethod','progressive','power','dialPowerLevel','booked','handlePower','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncQueueSummary]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','Contact','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','ACTIVE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence'];(function(_0x20d680,_0xc4c9af){var _0x43c303=function(_0x4f5fe5){while(--_0x4f5fe5){_0x20d680['push'](_0x20d680['shift']());}};_0x43c303(++_0xc4c9af);}(_0xb945,0x97));var _0x5b94=function(_0x2e7d42,_0x16c6b9){_0x2e7d42=_0x2e7d42-0x0;var _0x1c5197=_0xb945[_0x2e7d42];return _0x1c5197;};'use strict';var util=require(_0x5b94('0x0'));var _=require('lodash');var BPromise=require(_0x5b94('0x1'));var uuid=require('uuid');var moment=require(_0x5b94('0x2'));var rr=require('rr');var md5=require('md5');var Redis=require('ioredis');var ut=require(_0x5b94('0x3'));var config=require(_0x5b94('0x4'));var logger=require(_0x5b94('0x5'))(_0x5b94('0x6'));var loggerBooked=require(_0x5b94('0x5'))('booked');var loggerPredictive=require('../../../config/logger')(_0x5b94('0x7'));var loggerPredictiveCalls=require(_0x5b94('0x5'))(_0x5b94('0x8'));var loggerSyncQueueSummary=require(_0x5b94('0x5'))('syncQueueSummary');var ami=require(_0x5b94('0x9'));config['redis']=_[_0x5b94('0xa')](config[_0x5b94('0xb')],{'host':_0x5b94('0xc'),'port':0x18eb});var io=require(_0x5b94('0xd'))(new Redis(config[_0x5b94('0xb')]));var cmHopper=require(_0x5b94('0xe'));var cmHopperHistory=require(_0x5b94('0xf'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x5b94('0x10'));var Action=require('./action');var History=require(_0x5b94('0x11'));var Final=require(_0x5b94('0x12'));var AgentComplete=require(_0x5b94('0x13'));var QueueCallerAbandon=require(_0x5b94('0x14'));var Hangup=require(_0x5b94('0x15'));var ipAgi=process['env'][_0x5b94('0x16')]||_0x5b94('0x17');var strategy={'rrmemory':_0x5b94('0x18'),'roundrobin':_0x5b94('0x19')};var Sequence=function(){};Sequence['prototype'][_0x5b94('0x1a')]=function(_0x5ed62e){this[_0x5b94('0x1b')]=this[_0x5b94('0x1b')]?this['tail'][_0x5b94('0x1c')](_0x5ed62e):_0x5ed62e();};function Dialer(_0x168640,_0x1b1628){this['sequence']=new Sequence();this[_0x5b94('0x1d')]=_0x1b1628;this[_0x5b94('0x1e')]=_0x168640['voiceQueues'];this[_0x5b94('0x1f')]=_0x168640[_0x5b94('0x1f')];this[_0x5b94('0x20')]=_0x168640['agents'];this[_0x5b94('0x21')]=_0x168640[_0x5b94('0x21')];this['maxNumberOriginate']=config[_0x5b94('0x22')]||0x2;this[_0x5b94('0x23')]={};this[_0x5b94('0x24')]={};this[_0x5b94('0x25')]={};this[_0x5b94('0x26')]={};this['optionPredictive']={};this[_0x5b94('0x27')]={};this[_0x5b94('0x28')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0x5b94('0x29')]={};ami['on'](_0x5b94('0x2a'),this[_0x5b94('0x2b')][_0x5b94('0x2c')](this));ami['on'](_0x5b94('0x2d'),this[_0x5b94('0x2e')][_0x5b94('0x2c')](this));ami['on'](_0x5b94('0x2f'),this[_0x5b94('0x30')][_0x5b94('0x2c')](this));ami['on'](_0x5b94('0x31'),this[_0x5b94('0x32')][_0x5b94('0x2c')](this));ami['on'](_0x5b94('0x33'),this[_0x5b94('0x34')][_0x5b94('0x2c')](this));ami['on']('hangup',this[_0x5b94('0x35')][_0x5b94('0x2c')](this));ami['on'](_0x5b94('0x36'),this[_0x5b94('0x37')][_0x5b94('0x2c')](this));ami['on']('varset',this['syncVarSet'][_0x5b94('0x2c')](this));ami['on'](_0x5b94('0x38'),this[_0x5b94('0x39')]['bind'](this));ami['on'](_0x5b94('0x3a'),this[_0x5b94('0x3b')]['bind'](this));this['loopCampaigns']();this[_0x5b94('0x3c')]();}function isNotNull(_0xc2a8bd){return _0xc2a8bd!==null&&!_[_0x5b94('0x3d')](_0xc2a8bd);}function checkIsLoggedIn(_0x1ecbfc,_0x67a149){return function(){if(_0x67a149<=0x0){_0x1ecbfc[_0x5b94('0x3e')]=_0x5b94('0x3f');throw _0x1ecbfc['name']+_0x5b94('0x40');}};}function isActive(_0x578098){return _0x578098;}function checkIsActive(_0x5ba892,_0x4b703a){return function(){if(!isActive(_0x4b703a)){_0x5ba892[_0x5b94('0x3e')]=_0x5b94('0x41');throw _0x5ba892['name']+_0x5b94('0x42');}};}function checkInterval(_0x2a3fd3){return function(){if(!isNotNull(_0x2a3fd3[_0x5b94('0x43')])){_0x2a3fd3[_0x5b94('0x3e')]='INTERVAL_IS_NULL';throw _0x2a3fd3['name']+_0x5b94('0x44');}if(!isNotNull(_0x2a3fd3[_0x5b94('0x43')]['Intervals'])){_0x2a3fd3[_0x5b94('0x3e')]=_0x5b94('0x45');throw _0x2a3fd3[_0x5b94('0x46')]+_0x5b94('0x44');}if(!isNotNull(_[_0x5b94('0x47')](_0x2a3fd3['Interval']['Intervals']))){_0x2a3fd3['message']=_0x5b94('0x45');throw _0x2a3fd3[_0x5b94('0x46')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x22818d,_0x48054a,_0x5b1824){return{'action':_0x22818d,'response':_0x48054a,'message':_0x5b1824,'stack':_0x5b1824};}function myreject(_0x25e667){return function(_0x2d1412){return _0x25e667(msgResponse(_0x5b94('0x48'),'Error',JSON['stringify'](_0x2d1412)));};}function getSeconds(_0x1b00fd,_0x270d8b){var _0x4d7394=moment(_0x1b00fd)['milliseconds'](0x0);var _0x461eef=moment(_0x270d8b)[_0x5b94('0x49')](0x0);return _0x4d7394[_0x5b94('0x4a')](_0x461eef,_0x5b94('0x4b'));}function emit(_0x49b71d,_0x4aebb8,_0x2693bb){io['to'](_0x49b71d)[_0x5b94('0x4c')](_0x4aebb8,_0x2693bb);}function emitVoiceQueueSummary(_0x38c7b6){if(_0x38c7b6[_0x5b94('0x4d')]===_0x5b94('0x4e')){var _0x504487={'id':_0x38c7b6['id'],'name':_0x38c7b6['name'],'strategy':_0x38c7b6['strategy'],'answered':_0x38c7b6[_0x5b94('0x4f')],'available':_0x38c7b6[_0x5b94('0x50')],'loggedIn':_0x38c7b6[_0x5b94('0x51')],'pTalking':_0x38c7b6[_0x5b94('0x52')],'sumBillable':_0x38c7b6[_0x5b94('0x53')],'sumDuration':_0x38c7b6[_0x5b94('0x54')],'sumHoldTime':_0x38c7b6[_0x5b94('0x55')]||0x0,'talking':_0x38c7b6[_0x5b94('0x56')],'total':_0x38c7b6[_0x5b94('0x57')],'type':_0x38c7b6[_0x5b94('0x4d')],'unmanaged':_0x38c7b6[_0x5b94('0x58')],'abandoned':_0x38c7b6[_0x5b94('0x59')],'waiting':_0x38c7b6['waiting'],'loggedInDb':_0x38c7b6[_0x5b94('0x5a')],'dialActive':_0x38c7b6[_0x5b94('0x5b')],'dialMethod':_0x38c7b6[_0x5b94('0x5c')],'dialOriginateCallerIdName':_0x38c7b6[_0x5b94('0x5d')],'dialOriginateCallerIdNumber':_0x38c7b6[_0x5b94('0x5e')],'dialOriginateTimeout':_0x38c7b6[_0x5b94('0x5f')],'dialPrefix':_0x38c7b6['dialPrefix'],'outboundAnswerAgiCallsDay':_0x38c7b6['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x38c7b6[_0x5b94('0x60')],'outboundBlacklistCallsDay':_0x38c7b6[_0x5b94('0x61')],'outboundBusyCallsDay':_0x38c7b6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x38c7b6[_0x5b94('0x62')],'outboundDropCallsDayACS':_0x38c7b6[_0x5b94('0x63')],'outboundDropCallsDayCallersExit':_0x38c7b6[_0x5b94('0x64')],'outboundDropCallsDayTimeout':_0x38c7b6['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x38c7b6[_0x5b94('0x65')],'outboundNoSuchCallsDay':_0x38c7b6[_0x5b94('0x66')],'outboundOriginateFailureCallsDay':_0x38c7b6['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x38c7b6[_0x5b94('0x67')],'outboundRejectCallsDay':_0x38c7b6[_0x5b94('0x68')],'outboundUnknownCallsDay':_0x38c7b6[_0x5b94('0x69')],'predictiveIntervalAnsweredCalls':_0x38c7b6['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x38c7b6[_0x5b94('0x6a')],'predictiveIntervalAvgTalktime':_0x38c7b6['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x38c7b6['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x38c7b6[_0x5b94('0x6b')],'predictiveIntervalErlangCalls':_0x38c7b6[_0x5b94('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x38c7b6[_0x5b94('0x6d')],'predictiveIntervalHitRate':_0x38c7b6[_0x5b94('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x38c7b6['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x38c7b6[_0x5b94('0x6f')],'predictiveIntervalAvailable':_0x38c7b6[_0x5b94('0x70')],'predictiveIntervalTotalCalls':_0x38c7b6['predictiveIntervalTotalCalls'],'message':_0x38c7b6[_0x5b94('0x3e')],'originated':_0x38c7b6[_0x5b94('0x71')],'erlangCalls':_0x38c7b6[_0x5b94('0x72')],'erlangCallToSecond':_0x38c7b6[_0x5b94('0x73')],'erlangAbandonmentRate':_0x38c7b6[_0x5b94('0x74')],'erlangBusyFactor':_0x38c7b6[_0x5b94('0x75')],'startPredictive':_0x38c7b6[_0x5b94('0x27')],'startProgressive':_0x38c7b6['startProgressive']};if(_0x38c7b6[_0x5b94('0x76')]){_0x504487[_0x5b94('0x76')]={'id':_0x38c7b6[_0x5b94('0x76')]['id'],'name':_0x38c7b6['Trunk']['name'],'active':_0x38c7b6['Trunk'][_0x5b94('0x77')],'callerid':_0x38c7b6['Trunk'][_0x5b94('0x78')]};}if(_0x38c7b6[_0x5b94('0x43')]){_0x504487['Interval']={'id':_0x38c7b6['Interval']['id'],'name':_0x38c7b6[_0x5b94('0x43')][_0x5b94('0x46')]};}var _0x157593=md5(JSON[_0x5b94('0x79')](_0x504487));if(_0x38c7b6[_0x5b94('0x7a')]!==_0x157593){_0x38c7b6[_0x5b94('0x7a')]=_0x157593;emit(util[_0x5b94('0x7b')](_0x5b94('0x7c'),_0x504487[_0x5b94('0x46')]),'voice_queue:save',_0x504487);}}}function emitCampaignSummary(_0x131323){if(_0x131323[_0x5b94('0x4d')]===_0x5b94('0x7d')){emit(util[_0x5b94('0x7b')](_0x5b94('0x7e'),_0x131323['name']),_0x5b94('0x7f'),_0x131323);}}function checkGetDataPredictive(_0x567e92){if(isNotNull(_0x567e92)&&!_[_0x5b94('0x47')](_0x567e92)){loggerPredictive['info'](_0x5b94('0x80'));loggerPredictive[_0x5b94('0x81')](_0x5b94('0x82'),_0x567e92[_0x5b94('0x83')]);loggerPredictive['info'](_0x5b94('0x84'),_0x567e92[_0x5b94('0x85')]);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x86'),_0x567e92[_0x5b94('0x6b')]);loggerPredictive['info'](_0x5b94('0x87'),_0x567e92['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x5b94('0x81')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x567e92[_0x5b94('0x6a')]);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x88'),_0x567e92['predictiveIntervalAvgTalktime']);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x89'));if(_0x567e92[_0x5b94('0x83')]>0x0){if(!_[_0x5b94('0x3d')](_0x567e92[_0x5b94('0x8a')])&&_0x567e92[_0x5b94('0x8a')]>0x0){return!![];}loggerPredictive[_0x5b94('0x81')](_0x5b94('0x8b'));if(!_[_0x5b94('0x3d')](_0x567e92[_0x5b94('0x6a')])&&_0x567e92[_0x5b94('0x6a')]>0x0){return!![];}loggerPredictive[_0x5b94('0x81')](_0x5b94('0x8c'));}else{loggerPredictive[_0x5b94('0x81')](_0x5b94('0x8d'));}}else{loggerPredictive[_0x5b94('0x81')](_0x5b94('0x8e'));}return![];}function mergeDataErlangB(_0x3ee66a){return function(_0x721595){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x5b94('0x81')](_0x5b94('0x8f'),_0x721595[_0x5b94('0x72')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x721595['erlangCallToSecond']);loggerPredictive[_0x5b94('0x81')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x721595[_0x5b94('0x74')]);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x90'),_0x721595[_0x5b94('0x75')]);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x91'),_0x721595[_0x5b94('0x74')]);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x89'));_['merge'](_0x3ee66a,_0x721595);};}function getDiff(_0x9557d1){var _0x237766=moment()[_0x5b94('0x49')](0x0);var _0x294001=moment(_0x9557d1)[_0x5b94('0x49')](0x0);return _0x237766['diff'](_0x294001,_0x5b94('0x4b'));}function ifInterval(_0x539148,_0xfe261a){if(_['isUndefined'](_0xfe261a)){return![];}return getDiff(_0xfe261a)<_0x539148*0x3c;}function freeVariablesPredictive(_0x7a116a){if(isNotNull(_0x7a116a)){if(!_[_0x5b94('0x3d')](_0x7a116a[_0x5b94('0x28')])){_0x7a116a[_0x5b94('0x28')]=undefined;loggerPredictive[_0x5b94('0x81')](_0x7a116a[_0x5b94('0x46')],_0x5b94('0x92'));}if(!_[_0x5b94('0x3d')](_0x7a116a[_0x5b94('0x27')])){_0x7a116a[_0x5b94('0x27')]=undefined;loggerPredictive[_0x5b94('0x81')](_0x7a116a[_0x5b94('0x46')],_0x5b94('0x93'));}if(!_[_0x5b94('0x3d')](_0x7a116a[_0x5b94('0x94')])){clearInterval(_0x7a116a[_0x5b94('0x94')]);_0x7a116a[_0x5b94('0x94')]=undefined;loggerPredictive[_0x5b94('0x81')](_0x7a116a['name'],_0x5b94('0x95'));}}}function erlangb(_0x5658ad,_0x395d2b){if(_0x395d2b===0x0){return 0x0;}var _0x1e4c5a=0x1;for(var _0xd7febd=0x1;_0xd7febd<=_0x395d2b;_0xd7febd+=0x1){_0x1e4c5a=0x1+_0x1e4c5a*_0xd7febd/_0x5658ad;}return 0x1/_0x1e4c5a;}function isVoiceQueueOutbound(_0x4970d7){return _0x4970d7==='outbound';}function isNotPreview(_0xc3e26b){return _0xc3e26b!==_0x5b94('0x1d');}function isCampaignIvr(_0x1d8dba){return _0x1d8dba==='ivr';}function getCallerId(_0x400384,_0x51a319,_0xa6d8cc){if(!_[_0x5b94('0x3d')](_0xa6d8cc)&&typeof _0xa6d8cc===_0x5b94('0x96')&&!_['isEmpty'](_0xa6d8cc)){if(!_[_0x5b94('0x3d')](_0x51a319)&&typeof _0x51a319===_0x5b94('0x96')&&!_[_0x5b94('0x47')](_0x51a319)){return util[_0x5b94('0x7b')](_0x5b94('0x97'),_0x51a319,_0xa6d8cc);}return util[_0x5b94('0x7b')](_0x5b94('0x97'),_0xa6d8cc,_0xa6d8cc);}if(!_['isUndefined'](_0x400384)&&typeof _0x400384==='string'&&!_['isEmpty'](_0x400384)){return _0x400384;}return _0x5b94('0x98');}function loggerCatchQueueSummary(_0x9016aa,_0x4bf7e2){return function(_0x19263d){freeVariablesPredictive(_0x4bf7e2);emitVoiceQueueSummary(_0x4bf7e2);emitCampaignSummary(_0x4bf7e2);loggerSyncQueueSummary[_0x5b94('0x99')](_0x9016aa,util[_0x5b94('0x9a')](_0x19263d,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x158a78,_0x9ebbaa){return function(_0x459957){loggerPredictive[_0x5b94('0x99')](_0x9ebbaa['name'],_0x158a78);loggerPredictive[_0x5b94('0x99')](_0x459957[_0x5b94('0x9b')]);freeVariablesPredictive(_0x9ebbaa);};}function loggerCatch(_0x50e277){return function(_0x510e75){logger[_0x5b94('0x99')](_0x50e277,util[_0x5b94('0x9a')](_0x510e75,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x29e38c){return _0x29e38c&&!_['isUndefined'](_0x29e38c)&&_0x29e38c['length']>0x0;}function decremetOriginate(_0x3534d1){if(!_[_0x5b94('0x3d')](_0x3534d1)&&_0x3534d1!==null){if(typeof _0x3534d1['originated']!==_0x5b94('0x9c')){if(_0x3534d1['originated']>0x0){_0x3534d1['originated']-=0x1;}else{logger['error'](_0x5b94('0x9d'));}}}else{logger[_0x5b94('0x99')](_0x5b94('0x9e'));}}function checkContactLowerLimitOriginate(_0x4074fa,_0x84031b,_0x5ada39){if(_0x84031b>_0x5ada39){for(var _0x126381=0x0;_0x126381<_0x84031b-_0x5ada39;_0x126381+=0x1){decremetOriginate(_0x4074fa);}}}function loggerGetContactDialer(_0x208f8d,_0x32a91d,_0x3b4eea){return function(_0x3189ba){checkContactLowerLimitOriginate(_0x32a91d,_0x3b4eea,0x0);logger[_0x5b94('0x99')](_0x208f8d,util[_0x5b94('0x9a')](_0x3189ba,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3f154b){return function(_0x48e608){if(isNotNull(_0x48e608)&&isNotNull(_0x48e608[0x0])){if(_0x48e608[0x0][_0x5b94('0x9f')]>0x0){_0x3f154b[_0x5b94('0x3e')]=_0x5b94('0xa0');logger['info'](_0x5b94('0xa1')+_0x3f154b[_0x5b94('0x46')],_0x48e608[0x0]['contactsRescheduled'],_0x5b94('0xa2'));}else{_0x3f154b[_0x5b94('0x3e')]=_0x5b94('0xa3');logger['info'](_0x5b94('0xa4')+_0x3f154b[_0x5b94('0x46')]);}}};}function notSendMessagesQueue(_0x27a0ee){if(_0x27a0ee[_0x5b94('0xa5')]){freeVariablesPredictive(_0x27a0ee);if(_0x27a0ee[_0x5b94('0x71')]===0x0&&_0x27a0ee[_0x5b94('0x56')]===0x0&&_0x27a0ee[_0x5b94('0xa6')]===0x0&&(_0x27a0ee[_0x5b94('0x52')]||0x0)===0x0){_0x27a0ee[_0x5b94('0xa5')]=![];_0x27a0ee[_0x5b94('0x50')]=0x0;_0x27a0ee[_0x5b94('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x5b94('0x99')](_0x5b94('0xa7'),_0x27a0ee[_0x5b94('0x46')],_0x5b94('0xa8'));}else{_0x27a0ee[_0x5b94('0x3e')]=_0x5b94('0xa9');loggerSyncQueueSummary[_0x5b94('0x99')](_0x5b94('0xa7'),_0x27a0ee[_0x5b94('0x46')],_0x5b94('0xaa'));}emitVoiceQueueSummary(_0x27a0ee);}}function notSendMessagesCampaign(_0x21fa43){if(_0x21fa43[_0x5b94('0xa5')]){if(_0x21fa43[_0x5b94('0x71')]===0x0){_0x21fa43[_0x5b94('0xa5')]=![];_0x21fa43[_0x5b94('0x3e')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x5b94('0x99')](_0x5b94('0xab'),_0x21fa43[_0x5b94('0x46')],_0x5b94('0xa8'));}else{_0x21fa43['message']=_0x5b94('0xa9');loggerSyncQueueSummary[_0x5b94('0x99')](_0x5b94('0xab'),_0x21fa43['name'],'is\x20disactive');}emitCampaignSummary(_0x21fa43);}}function createObjHistory(_0x122bee,_0x50b632,_0x483d1,_0x50d87e,_0x541b2e){_0x122bee[_0x5b94('0x3e')]=_0x483d1;var _0x4bb736=new Action(_0x122bee,_0x50b632);var _0x12f4f2=new History(_0x4bb736);_0x12f4f2[_0x5b94('0xac')]=_0x50d87e;_0x12f4f2[_0x5b94('0xad')]=_0x541b2e;_0x12f4f2['endtime']=_0x4bb736['starttime'];return _0x12f4f2;}Dialer['prototype'][_0x5b94('0x3c')]=function(){var _0x52cdb9=this;setInterval(function(){_0x52cdb9[_0x5b94('0xae')](_0x52cdb9[_0x5b94('0x26')],_0x5b94('0xaf'));_0x52cdb9[_0x5b94('0xae')](_0x52cdb9[_0x5b94('0x24')],_0x5b94('0xb0'));},0x32c8);};Dialer[_0x5b94('0xb1')]['clearZombieChannels']=function(_0x5a423b,_0x1d5f18){var _0x3587da=this;for(var _0x123cf5 in _0x5a423b){if(typeof _0x5a423b[_0x123cf5]!==_0x5b94('0x9c')){this[_0x5b94('0xb2')][_0x5b94('0x1a')](function(){if(!_[_0x5b94('0xb3')](_0x5a423b[_0x123cf5])){return ami[_0x5b94('0xb4')]({'action':_0x5b94('0xb5'),'channel':_0x5a423b[_0x123cf5]['channel']})[_0x5b94('0xb6')](function(_0xb5c965){if(_0xb5c965[_0x5b94('0x3e')]===_0x5b94('0xb7')){setTimeout(function(){if(_0x5a423b[_0x123cf5]&&_0x5a423b[_0x123cf5]['type']!==_0x5b94('0x7d')){_0x3587da['updateOriginated'](_0x3587da[_0x5b94('0x1e')][_0x5a423b[_0x123cf5][_0x5b94('0xb8')]]);logger[_0x5b94('0x99')](_0x5b94('0xb9'),_0x1d5f18,_0x123cf5,_0x5a423b[_0x123cf5][_0x5b94('0xb8')]);delete _0x5a423b[_0x123cf5];}if(_0x5a423b[_0x123cf5]&&_0x5a423b[_0x123cf5][_0x5b94('0x4d')]==='ivr'){_0x3587da['updateOriginated'](_0x3587da[_0x5b94('0x1f')][_0x5a423b[_0x123cf5][_0x5b94('0xb8')]]);logger['error'](_0x5b94('0xba'),_0x1d5f18,_0x123cf5,_0x5a423b[_0x123cf5][_0x5b94('0xb8')]);delete _0x5a423b[_0x123cf5];}},0x2328);}});}});}}};Dialer[_0x5b94('0xb1')][_0x5b94('0xbb')]=function(_0x172b86){return BPromise[_0x5b94('0xbc')]()[_0x5b94('0xbd')](cmHopper['countReScheduled'](_0x172b86))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xbe')));};Dialer[_0x5b94('0xb1')][_0x5b94('0xbf')]=function(_0x58b0e1){return BPromise[_0x5b94('0xbc')]()[_0x5b94('0xbd')](cmHopperBlack[_0x5b94('0xbf')](_0x58b0e1))['catch'](loggerCatch('[checkIsBlackList]\x20'));};Dialer[_0x5b94('0xb1')][_0x5b94('0xc0')]=function(_0x529d98){return BPromise[_0x5b94('0xbc')]()[_0x5b94('0xbd')](cmHopperBlack[_0x5b94('0xc0')](_0x529d98))['catch'](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer['prototype'][_0x5b94('0xc1')]=function(_0x34549c){return BPromise[_0x5b94('0xbc')]()[_0x5b94('0xbd')](cmHopperHistory[_0x5b94('0xc2')](_0x34549c))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xc3')));};Dialer[_0x5b94('0xb1')][_0x5b94('0xc4')]=function(_0xb7cfe9){return BPromise[_0x5b94('0xbc')]()['then'](cmHopper[_0x5b94('0xc4')](_0xb7cfe9))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xc5')));};Dialer[_0x5b94('0xb1')][_0x5b94('0xc6')]=function(_0x3d7a9d,_0x53fbee,_0x19de2e){return BPromise['resolve']()['then'](cmHopper['unlockContact'](_0x3d7a9d,_0x53fbee,_0x19de2e))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xc7')));};Dialer[_0x5b94('0xb1')][_0x5b94('0xc8')]=function(_0x17b712,_0x1d4d2e,_0x3eb1ce,_0x51609d,_0x16cff5){return BPromise['resolve']()['then'](cmHopper[_0x5b94('0xc8')](_0x17b712,_0x1d4d2e,_0x3eb1ce,_0x51609d))['catch'](function(_0x4df0b8){_0x16cff5['temp']-=_0x3eb1ce;_0x16cff5[_0x5b94('0xc9')]=_0x16cff5[_0x5b94('0xc9')]>0x0?_0x16cff5[_0x5b94('0xc9')]:0x0;loggerCatch(_0x5b94('0xca'))(_0x4df0b8);});};Dialer[_0x5b94('0xb1')][_0x5b94('0xcb')]=function(_0x5195be,_0x2ffeaf,_0x10023f,_0x557265){return BPromise[_0x5b94('0xbc')]()[_0x5b94('0xbd')](cmHopper['getContactDialerIvr'](_0x5195be,_0x2ffeaf,_0x10023f))[_0x5b94('0xb6')](function(_0x49244e){_0x557265[_0x5b94('0xc9')]-=_0x2ffeaf;_0x557265[_0x5b94('0xc9')]=_0x557265['temp']>0x0?_0x557265[_0x5b94('0xc9')]:0x0;loggerCatch(_0x5b94('0xcc'))(_0x49244e);});};Dialer[_0x5b94('0xb1')][_0x5b94('0xcd')]=function(_0x23293a){return BPromise[_0x5b94('0xbc')]()['then'](voiceQueueRt[_0x5b94('0xcd')](_0x23293a))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xce')));};Dialer[_0x5b94('0xb1')][_0x5b94('0xcf')]=function(_0x5c8863){return BPromise['resolve']()[_0x5b94('0xbd')](cmHopper['moveContactManagedDialer'](_0x5c8863))['catch'](loggerCatch(_0x5b94('0xd0')));};Dialer[_0x5b94('0xb1')][_0x5b94('0xd1')]=function(_0x37d354){return BPromise[_0x5b94('0xbc')]()[_0x5b94('0xbd')](cmHopperHistory[_0x5b94('0xd1')](_0x37d354))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xd2')));};Dialer[_0x5b94('0xb1')][_0x5b94('0xd3')]=function(_0x1f88af){if(!_[_0x5b94('0x3d')](_0x1f88af)&&_0x1f88af!==null){if(typeof _0x1f88af[_0x5b94('0x71')]!==_0x5b94('0x9c')){if(_0x1f88af[_0x5b94('0x71')]>0x0){_0x1f88af[_0x5b94('0x71')]-=0x1;}else{logger[_0x5b94('0x99')](_0x5b94('0xd4'));}}}else{logger['error'](_0x5b94('0xd5'));}};Dialer[_0x5b94('0xb1')][_0x5b94('0xd6')]=function(_0x1cba28,_0x51fb48){var _0x11968c=this;return function(_0x40548c){_0x11968c[_0x5b94('0xd3')](_0x51fb48);logger['error'](_0x1cba28,util[_0x5b94('0x9a')](_0x40548c,{'showHidden':![],'depth':null}));};};Dialer[_0x5b94('0xb1')]['emptyContact']=function(_0x480579,_0x299967,_0x7106e){var _0x1ff7ee={'state':0x19,'statedesc':_0x5b94('0xd7')};this[_0x5b94('0xd3')](_0x299967);this[_0x5b94('0xd8')](_[_0x5b94('0xd9')](_0x1ff7ee,_[_0x5b94('0xda')](_0x7106e,[_0x5b94('0xdb'),_0x5b94('0xdc'),_0x5b94('0xdd'),_0x5b94('0xde'),_0x5b94('0xdf')])),_0x5b94('0xe0'),_0x5b94('0xe1'));logger[_0x5b94('0x99')](_0x480579);};Dialer['prototype'][_0x5b94('0xe2')]=function(_0xaf6935){return _0xaf6935===_0x5b94('0xe3');};Dialer[_0x5b94('0xb1')]['isTrunkReachable']=function(_0x2e7ac2){return!_['isUndefined'](_0x2e7ac2)&&_0x2e7ac2&&!_[_0x5b94('0x3d')](_0x2e7ac2[_0x5b94('0x46')])&&!_[_0x5b94('0x3d')](_0x2e7ac2[_0x5b94('0x77')])&&_0x2e7ac2['active']&&(this['trunks'][util['format'](_0x5b94('0xe4'),_0x2e7ac2[_0x5b94('0x46')])][_0x5b94('0xb5')]===_0x5b94('0xe5')||this[_0x5b94('0x21')][util[_0x5b94('0x7b')](_0x5b94('0xe4'),_0x2e7ac2[_0x5b94('0x46')])][_0x5b94('0xb5')]===_0x5b94('0xe6'));};Dialer[_0x5b94('0xb1')][_0x5b94('0xd8')]=function(_0x3144de,_0x37fecc,_0x1ebfa1){this[_0x5b94('0xd1')](_0x3144de)['catch'](loggerCatch(_0x37fecc));this['moveContactManagedDialer'](_0x3144de)[_0x5b94('0xb6')](loggerCatch(_0x1ebfa1));};Dialer[_0x5b94('0xb1')]['syncVarSet']=function(_0x1d0752){var _0x3a20d3=this[_0x5b94('0x26')][_0x1d0752['uniqueid']];var _0x48eb76;if(!_[_0x5b94('0xb3')](_0x1d0752)&&!_[_0x5b94('0xb3')](_0x1d0752[_0x5b94('0xe7')])&&!_[_0x5b94('0xb3')](_0x1d0752['variable'][_0x5b94('0xe8')])&&_0x1d0752[_0x5b94('0xe9')]===_0x5b94('0xea')&&_0x3a20d3){if(_0x3a20d3[_0x5b94('0x4d')]!==_0x5b94('0x7d')&&this[_0x5b94('0x1e')][_0x3a20d3[_0x5b94('0xb8')]][_0x5b94('0xeb')]&&_0x1d0752['value']===_0x5b94('0xec')){delete this['uniqueId'][_0x1d0752[_0x5b94('0xed')]];this[_0x5b94('0xd3')](this[_0x5b94('0x1e')][_0x3a20d3['queue']]);this[_0x5b94('0x1e')][_0x3a20d3[_0x5b94('0xb8')]][_0x5b94('0x60')]+=0x1;this[_0x5b94('0x1e')][_0x3a20d3[_0x5b94('0xb8')]][_0x5b94('0xee')]+=0x1;_0x48eb76=new Hangup(_0x3a20d3,_0x1d0752);_0x48eb76[_0x5b94('0xac')]=0x12;_0x48eb76['statedesc']=_0x5b94('0xef');_0x48eb76[_0x5b94('0xf0')]=_0x5b94('0xf1');ami['emit'](_0x5b94('0xf2'),ut['buildObj'](_0x48eb76,_0x5b94('0xf3')));this[_0x5b94('0xd8')](_0x48eb76,_0x5b94('0xf4'),'[syncHangupInAMD]');}if(_0x3a20d3[_0x5b94('0x4d')]!==_0x5b94('0x7d')&&this[_0x5b94('0x1e')][_0x3a20d3[_0x5b94('0xb8')]]['dialAMDActive']&&_0x1d0752[_0x5b94('0xf5')]===_0x5b94('0xf6')){var _0x16e85b=this;return new BPromise(function(_0x2fd204,_0x49b270){delete _0x16e85b[_0x5b94('0x26')][_0x1d0752['uniqueid']];_0x16e85b[_0x5b94('0xd3')](_0x16e85b[_0x5b94('0x1e')][_0x3a20d3[_0x5b94('0xb8')]]);_0x16e85b[_0x5b94('0x1e')][_0x3a20d3['queue']]['outboundAnswerCallsDay']+=0x1;_0x16e85b[_0x5b94('0x1e')][_0x3a20d3[_0x5b94('0xb8')]][_0x5b94('0xee')]+=0x1;var _0x5233da=_0x16e85b[_0x5b94('0x1e')][_0x3a20d3[_0x5b94('0xb8')]];var _0x250f7f=new Hangup(_0x3a20d3,_0x1d0752);_0x250f7f[_0x5b94('0xac')]=0x13;_0x250f7f[_0x5b94('0xad')]=_0x5b94('0xf7');_0x250f7f[_0x5b94('0xf0')]=_0x5b94('0xf1');_0x250f7f[_0x5b94('0xf8')]+=0x1;_0x250f7f[_0x5b94('0xf9')]+=0x1;_0x250f7f['amd']=!![];ami[_0x5b94('0x4c')](_0x5b94('0xf2'),ut[_0x5b94('0xfa')](_0x250f7f,_0x5b94('0xf3')));_0x16e85b[_0x5b94('0xd1')](_0x250f7f)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xfb')));if(_0x250f7f['countbusyretry']+_0x250f7f[_0x5b94('0xfc')]+_0x250f7f[_0x5b94('0xfd')]+_0x250f7f[_0x5b94('0xfe')]+_0x250f7f[_0x5b94('0xff')]+_0x250f7f[_0x5b94('0x100')]+_0x250f7f[_0x5b94('0xf8')]+_0x250f7f[_0x5b94('0x101')]>=_0x5233da[_0x5b94('0x102')]){_0x16e85b[_0x5b94('0x103')](_0x250f7f,_0x2fd204,_0x49b270,_0x5b94('0x104'));}else{if(_0x250f7f[_0x5b94('0xf8')]>=_0x5233da[_0x5b94('0x105')]){_0x16e85b['createStateFinal'](_0x250f7f,_0x2fd204,_0x49b270,_0x5b94('0x106'));}else{_0x16e85b[_0x5b94('0xc4')]({'active':![],'countmachineretry':_0x250f7f['countmachineretry'],'scheduledat':moment()['add'](_0x5233da['dialMachineRetryFrequency'],_0x5b94('0x107'))['format'](_0x5b94('0x108')),'ContactId':_0x250f7f[_0x5b94('0xdb')],'ListId':_0x250f7f[_0x5b94('0xdc')],'VoiceQueueId':_0x250f7f[_0x5b94('0xde')]||undefined,'CampaignId':_0x250f7f[_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x109')));_0x2fd204({'reschedule':0x1});}}});}if(_0x3a20d3[_0x5b94('0x4d')]===_0x5b94('0x7d')&&this[_0x5b94('0x1f')][_0x3a20d3[_0x5b94('0xb8')]][_0x5b94('0xeb')]&&_0x1d0752[_0x5b94('0xf5')]===_0x5b94('0xec')){delete this[_0x5b94('0x26')][_0x1d0752['uniqueid']];this[_0x5b94('0xd3')](this[_0x5b94('0x1f')][_0x3a20d3['queue']]);_0x48eb76=new Hangup(_0x3a20d3,_0x1d0752);_0x48eb76[_0x5b94('0xac')]=0x12;_0x48eb76[_0x5b94('0xad')]=_0x5b94('0xef');_0x48eb76['membername']=_0x5b94('0xf1');ami['emit'](_0x5b94('0xf2'),ut[_0x5b94('0xfa')](_0x48eb76,_0x5b94('0xf3')));this[_0x5b94('0xd8')](_0x48eb76,'[syncHangupInAMDIvr][createHistory]',_0x5b94('0x10a'));}if(_0x3a20d3['type']===_0x5b94('0x7d')&&this['campaigns'][_0x3a20d3[_0x5b94('0xb8')]]['dialAMDActive']&&_0x1d0752['value']===_0x5b94('0xf6')){var _0x16e85b=this;return new BPromise(function(_0x356143,_0x5aab48){delete _0x16e85b['uniqueId'][_0x1d0752['uniqueid']];_0x16e85b[_0x5b94('0xd3')](_0x16e85b['campaigns'][_0x3a20d3[_0x5b94('0xb8')]]);_0x16e85b[_0x5b94('0x1f')][_0x3a20d3[_0x5b94('0xb8')]]['outboundAnswerCallsDay']+=0x1;_0x16e85b[_0x5b94('0x1f')][_0x3a20d3[_0x5b94('0xb8')]][_0x5b94('0xee')]+=0x1;var _0x12c89d=_0x16e85b[_0x5b94('0x1f')][_0x3a20d3[_0x5b94('0xb8')]];var _0x289630=new Hangup(_0x3a20d3,_0x1d0752);_0x289630[_0x5b94('0xac')]=0x13;_0x289630['statedesc']=_0x5b94('0xf7');_0x289630[_0x5b94('0xf0')]=_0x5b94('0xf1');_0x289630[_0x5b94('0xf8')]+=0x1;_0x289630[_0x5b94('0xf9')]+=0x1;_0x289630[_0x5b94('0xf3')]=!![];ami[_0x5b94('0x4c')]('custom:amd',ut[_0x5b94('0xfa')](_0x289630,_0x5b94('0xf3')));_0x16e85b['createHistory'](_0x289630)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xfb')));if(_0x289630['countbusyretry']+_0x289630['countcongestionretry']+_0x289630[_0x5b94('0xfd')]+_0x289630[_0x5b94('0xfe')]+_0x289630[_0x5b94('0xff')]+_0x289630[_0x5b94('0x100')]+_0x289630[_0x5b94('0xf8')]+_0x289630['countagentrejectretry']>=_0x12c89d[_0x5b94('0x102')]){_0x16e85b['stateGlobal'](_0x289630,_0x356143,_0x5aab48,_0x5b94('0x104'));}else{if(_0x289630['countmachineretry']>=_0x12c89d[_0x5b94('0x105')]){_0x16e85b['createStateFinal'](_0x289630,_0x356143,_0x5aab48,'reason\x2019\x20machine....');}else{_0x16e85b[_0x5b94('0xc4')]({'active':![],'countmachineretry':_0x289630[_0x5b94('0xf8')],'scheduledat':moment()[_0x5b94('0x10b')](_0x12c89d[_0x5b94('0x10c')],_0x5b94('0x107'))[_0x5b94('0x7b')](_0x5b94('0x108')),'ContactId':_0x289630[_0x5b94('0xdb')],'ListId':_0x289630['ListId'],'VoiceQueueId':_0x289630['VoiceQueueId']||undefined,'CampaignId':_0x289630['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x356143({'reschedule':0x1});}}});}}};Dialer[_0x5b94('0xb1')][_0x5b94('0x35')]=function(_0xa739d8){var _0x4485ec=this[_0x5b94('0x26')][_0xa739d8[_0x5b94('0xed')]];var _0x792186=this;var _0x22172c;if(_0x4485ec&&_0x4485ec[_0x5b94('0x4d')]===_0x5b94('0x7d')){delete this[_0x5b94('0x26')][_0xa739d8[_0x5b94('0xed')]];this['updateOriginated'](this[_0x5b94('0x1f')][_0x4485ec[_0x5b94('0xb8')]]);this['campaigns'][_0x4485ec[_0x5b94('0xb8')]][_0x5b94('0x10d')]+=0x1;_0x22172c=new Hangup(_0x4485ec,_0xa739d8);this[_0x5b94('0xd1')](_0x22172c)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x10e')));this[_0x5b94('0xcf')](_0x22172c)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x10f')));}if(_0x4485ec&&_0x4485ec[_0x5b94('0x4d')]!==_0x5b94('0x7d')&&isNotNull(this[_0x5b94('0x1e')][_0x4485ec[_0x5b94('0xb8')]][_0x5b94('0x110')])){delete this[_0x5b94('0x26')][_0xa739d8[_0x5b94('0xed')]];this[_0x5b94('0xd3')](this[_0x5b94('0x1e')][_0x4485ec['queue']]);this[_0x5b94('0x1e')][_0x4485ec[_0x5b94('0xb8')]][_0x5b94('0x60')]+=0x1;this['voiceQueues'][_0x4485ec[_0x5b94('0xb8')]]['outboundAnswerAgiCallsDay']+=0x1;_0x22172c=new Hangup(_0x4485ec,_0xa739d8);_0x22172c[_0x5b94('0xac')]=0x10;_0x22172c[_0x5b94('0xad')]=_0x5b94('0x111');_0x22172c[_0x5b94('0xf0')]=_0x5b94('0x112');this[_0x5b94('0xd1')](_0x22172c)[_0x5b94('0xb6')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x22172c)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x10f')));}if(_0x4485ec&&_0x4485ec[_0x5b94('0x4d')]!==_0x5b94('0x7d')&&!isNotNull(this[_0x5b94('0x1e')][_0x4485ec['queue']][_0x5b94('0x110')])){delete this[_0x5b94('0x26')][_0xa739d8[_0x5b94('0xed')]];this[_0x5b94('0xd3')](this[_0x5b94('0x1e')][_0x4485ec['queue']]);this[_0x5b94('0x1e')][_0x4485ec[_0x5b94('0xb8')]][_0x5b94('0x69')]+=0x1;_0x22172c=new Hangup(_0x4485ec,_0xa739d8);_0x22172c[_0x5b94('0xac')]=0xc;_0x22172c[_0x5b94('0xad')]=_0xa739d8[_0x5b94('0x113')];_0x22172c[_0x5b94('0xf0')]='Unknow';this['createHistory'](_0x22172c)['catch'](loggerCatch(_0x5b94('0x10e')));this[_0x5b94('0xcf')](_0x22172c)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x10f')));}};Dialer['prototype'][_0x5b94('0x32')]=function(_0x323644){var _0x5f2d52=this['uniqueId'][_0x323644[_0x5b94('0xed')]];var _0x3fb13c=this;if(this[_0x5b94('0x1e')][_0x323644[_0x5b94('0xb8')]]){if(_0x5f2d52&&_0x5f2d52[_0x5b94('0x4d')]!=='ivr'){delete this[_0x5b94('0x26')][_0x323644[_0x5b94('0xed')]];this[_0x5b94('0x1e')][_0x323644[_0x5b94('0xb8')]][_0x5b94('0x60')]+=0x1;var _0x1a7eba=new AgentComplete(_0x5f2d52,_0x323644);if(_0x323644[_0x5b94('0x114')]===_0x5b94('0x115')){_0x1a7eba[_0x5b94('0x116')]=this[_0x5b94('0x1e')][_0x323644['queue']][_0x5b94('0x117')]&&this[_0x5b94('0x1e')][_0x323644['queue']][_0x5b94('0x118')]?moment()[_0x5b94('0x7b')](_0x5b94('0x108')):undefined;}this[_0x5b94('0xd1')](_0x1a7eba)[_0x5b94('0xb6')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x1a7eba)['catch'](loggerCatch(_0x5b94('0x119')));}}};Dialer['prototype'][_0x5b94('0x2b')]=function(_0x3f7214){if(this[_0x5b94('0x1e')][_0x3f7214[_0x5b94('0xb8')]]){if(this[_0x5b94('0x26')][_0x3f7214[_0x5b94('0xed')]]&&this[_0x5b94('0x26')][_0x3f7214['uniqueid']]['type']!==_0x5b94('0x7d')){this[_0x5b94('0xd3')](this[_0x5b94('0x1e')][_0x3f7214['queue']]);this[_0x5b94('0x26')][_0x3f7214['uniqueid']]['answertime']=moment()['format'](_0x5b94('0x108'));}}};Dialer[_0x5b94('0xb1')]['queueCallerAbandonCreateState']=function(_0x1ef90e){this[_0x5b94('0xd1')](_0x1ef90e)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x11a')));this[_0x5b94('0xcf')](_0x1ef90e)['catch'](loggerCatch(_0x5b94('0x11b')));};Dialer[_0x5b94('0xb1')][_0x5b94('0x2e')]=function(_0x15ad29){var _0x565c23=this[_0x5b94('0x26')][_0x15ad29[_0x5b94('0xed')]];var _0x55a137=this;if(this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]]){if(_0x565c23&&_0x565c23[_0x5b94('0x4d')]!==_0x5b94('0x7d')){delete this[_0x5b94('0x26')][_0x15ad29[_0x5b94('0xed')]];this['updateOriginated'](this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]]);_0x565c23[_0x5b94('0x11c')]=moment()[_0x5b94('0x7b')](_0x5b94('0x108'));var _0x2f0c91=new QueueCallerAbandon(_0x565c23,_0x15ad29);if(getSeconds(_0x565c23['droptime'],_0x565c23[_0x5b94('0x11d')])>=_0x565c23[_0x5b94('0x11e')]){this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]][_0x5b94('0x6b')]+=0x1;this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]][_0x5b94('0x11f')]+=0x1;this['voiceQueues'][_0x15ad29[_0x5b94('0xb8')]][_0x5b94('0x6d')]+=0x1;_0x2f0c91[_0x5b94('0xac')]=0xa;_0x2f0c91['statedesc']=_0x5b94('0x120');_0x2f0c91[_0x5b94('0x121')]='TIMEOUT';_0x2f0c91[_0x5b94('0x116')]=this['voiceQueues'][_0x15ad29[_0x5b94('0xb8')]][_0x5b94('0x117')]?moment()[_0x5b94('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2f0c91['countdropretry']+=0x1;_0x2f0c91[_0x5b94('0xf9')]+=0x1;if(_0x2f0c91[_0x5b94('0xff')]>=this['voiceQueues'][_0x15ad29[_0x5b94('0xb8')]]['dialDropMaxRetry']){this['queueCallerAbandonCreateState'](_0x2f0c91);}else{this[_0x5b94('0xc4')]({'active':![],'countdropretry':_0x2f0c91[_0x5b94('0xff')],'scheduledat':moment()[_0x5b94('0x10b')](this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]][_0x5b94('0x122')],_0x5b94('0x107'))['format'](_0x5b94('0x108')),'ContactId':_0x565c23[_0x5b94('0xdb')],'ListId':_0x565c23[_0x5b94('0xdc')],'VoiceQueueId':_0x565c23[_0x5b94('0xde')]||undefined,'CampaignId':_0x565c23[_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x123')));var _0x583322=new History(_0x2f0c91);_0x583322[_0x5b94('0xac')]=0xa;_0x583322[_0x5b94('0xad')]=_0x5b94('0x120');_0x583322[_0x5b94('0x124')]=moment()[_0x5b94('0x7b')](_0x5b94('0x108'));_0x583322[_0x5b94('0x125')]=_0x583322[_0x5b94('0x124')];_0x583322[_0x5b94('0x126')]=_0x2f0c91['calleridname'];_0x583322[_0x5b94('0x127')]=_0x2f0c91[_0x5b94('0x127')];this[_0x5b94('0xd1')](_0x583322)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x128')));}}else{this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]]['outboundDropCallsDayCallersExit']+=0x1;_0x2f0c91[_0x5b94('0xac')]=0xb;_0x2f0c91[_0x5b94('0xad')]=_0x5b94('0x129');_0x2f0c91[_0x5b94('0x121')]=_0x5b94('0x12a');_0x2f0c91[_0x5b94('0x100')]+=0x1;_0x2f0c91['countglobal']+=0x1;if(_0x2f0c91[_0x5b94('0x100')]>=this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]][_0x5b94('0x12b')]){this[_0x5b94('0x12c')](_0x2f0c91);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x2f0c91[_0x5b94('0x100')],'scheduledat':moment()[_0x5b94('0x10b')](this[_0x5b94('0x1e')][_0x15ad29[_0x5b94('0xb8')]][_0x5b94('0x12d')],_0x5b94('0x107'))['format'](_0x5b94('0x108')),'ContactId':_0x565c23[_0x5b94('0xdb')],'ListId':_0x565c23[_0x5b94('0xdc')],'VoiceQueueId':_0x565c23[_0x5b94('0xde')]||undefined,'CampaignId':_0x565c23[_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x12e')));var _0x583322=new History(_0x2f0c91);_0x583322['state']=0xb;_0x583322[_0x5b94('0xad')]=_0x5b94('0x129');_0x583322['starttime']=moment()[_0x5b94('0x7b')](_0x5b94('0x108'));_0x583322[_0x5b94('0x125')]=_0x583322[_0x5b94('0x124')];_0x583322[_0x5b94('0x126')]=_0x2f0c91['calleridname'];_0x583322[_0x5b94('0x127')]=_0x2f0c91['calleridnum'];this[_0x5b94('0xd1')](_0x583322)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x12f')));}}}}};Dialer[_0x5b94('0xb1')][_0x5b94('0x37')]=function(_0xd24417){if(this[_0x5b94('0x24')][_0xd24417[_0x5b94('0xed')]]){this[_0x5b94('0x24')][_0xd24417[_0x5b94('0xed')]][_0x5b94('0x130')]=_0xd24417[_0x5b94('0x130')];}if(this[_0x5b94('0x26')][_0xd24417[_0x5b94('0xed')]]){this[_0x5b94('0x26')][_0xd24417['uniqueid']][_0x5b94('0x130')]=_0xd24417['channel'];}};Dialer['prototype'][_0x5b94('0x39')]=function(_0x51fc8a){if(strategy[this[_0x5b94('0x1e')][this[_0x5b94('0x24')][_0x51fc8a[_0x5b94('0x131')]][_0x5b94('0xb8')]]['strategy']]===_0x5b94('0x19')){if(this[_0x5b94('0x24')][_0x51fc8a['actionid']]&&_[_0x5b94('0xb3')](this['actions'][_0x51fc8a['actionid']][_0x5b94('0x132')])&&_0x51fc8a[_0x5b94('0xb5')]==='1'&&_0x51fc8a['paused']==='0'){if(this[_0x5b94('0x20')][_0x51fc8a[_0x5b94('0x133')]]){if(!this[_0x5b94('0x20')][_0x51fc8a[_0x5b94('0x133')]][_0x5b94('0x132')]){this[_0x5b94('0x20')][_0x51fc8a['stateinterface']][_0x5b94('0x132')]=!![];this[_0x5b94('0x24')][_0x51fc8a['actionid']][_0x5b94('0x132')]=!![];this[_0x5b94('0x24')][_0x51fc8a[_0x5b94('0x131')]][_0x5b94('0x133')]=_0x51fc8a[_0x5b94('0x133')];}}}}else if((strategy[this[_0x5b94('0x1e')][this[_0x5b94('0x24')][_0x51fc8a['actionid']][_0x5b94('0xb8')]][_0x5b94('0x134')]]||_0x5b94('0x18'))===_0x5b94('0x18')){if(this[_0x5b94('0x24')][_0x51fc8a[_0x5b94('0x131')]]){if(this[_0x5b94('0x20')][_0x51fc8a[_0x5b94('0x133')]]){this[_0x5b94('0x24')][_0x51fc8a['actionid']][_0x5b94('0x133')]=_0x51fc8a[_0x5b94('0x133')];if(_[_0x5b94('0xb3')](this['queueBooked'][this[_0x5b94('0x24')][_0x51fc8a[_0x5b94('0x131')]][_0x5b94('0xb8')]])){this[_0x5b94('0x135')][this['actions'][_0x51fc8a[_0x5b94('0x131')]][_0x5b94('0xb8')]]=[];}this[_0x5b94('0x135')][this['actions'][_0x51fc8a[_0x5b94('0x131')]]['queue']][_0x5b94('0x136')](_[_0x5b94('0xd9')](_[_0x5b94('0xda')](this[_0x5b94('0x24')][_0x51fc8a['actionid']],[_0x5b94('0x137'),_0x5b94('0x133')]),{'status':_0x51fc8a[_0x5b94('0xb5')],'paused':_0x51fc8a[_0x5b94('0x138')]}));}}}};function unlockQueueStatus(_0x1920e2,_0x37c387){setTimeout(function(){if(_[_0x5b94('0x3d')](_0x1920e2[_0x5b94('0x139')])){loggerBooked[_0x5b94('0x99')](_0x5b94('0x13a'),_0x37c387);}_0x1920e2[_0x5b94('0x139')]=!![];loggerBooked[_0x5b94('0x81')](_0x5b94('0x13b'),_0x37c387,JSON[_0x5b94('0x79')](_[_0x5b94('0xda')](_0x1920e2,[_0x5b94('0x46'),_0x5b94('0x139')])));},0x1f3);}Dialer[_0x5b94('0xb1')]['syncQueueStatusComplete']=function(_0x2c07bc){var _0x3ac345=this;var _0x44cbbd=_0x3ac345[_0x5b94('0x1e')][_0x3ac345[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xb8')]];if(strategy[this[_0x5b94('0x1e')][this[_0x5b94('0x24')][_0x2c07bc['actionid']][_0x5b94('0xb8')]]['strategy']]===_0x5b94('0x19')){if(this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]]&&this[_0x5b94('0x24')][_0x2c07bc['actionid']][_0x5b94('0x133')]){this[_0x5b94('0x1d')][_0x5b94('0x13c')](this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0x137')],this[_0x5b94('0x24')][_0x2c07bc['actionid']][_0x5b94('0x133')])[_0x5b94('0xb6')](function(_0x4266cf){logger['error'](_0x5b94('0x13d'),util['inspect'](_0x4266cf,{'showHidden':![],'depth':null}));})[_0x5b94('0x1c')](function(){_0x3ac345[_0x5b94('0xd3')](_0x3ac345[_0x5b94('0x1e')][_0x3ac345[_0x5b94('0x24')][_0x2c07bc['actionid']][_0x5b94('0xb8')]]);_0x3ac345[_0x5b94('0x20')][_0x3ac345[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0x133')]][_0x5b94('0x132')]=![];delete _0x3ac345[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]];unlockQueueStatus(_0x44cbbd);});}else{this[_0x5b94('0xd3')](this[_0x5b94('0x1e')][this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xb8')]]);this[_0x5b94('0xc4')]({'active':![],'ContactId':this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xdb')],'ListId':this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xdc')],'VoiceQueueId':this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xde')]||undefined,'CampaignId':this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x13e')));delete this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]];unlockQueueStatus(_0x44cbbd);}}else if((strategy[this[_0x5b94('0x1e')][this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]]['queue']]['strategy']]||'rrmemory')==='rrmemory'){var _0x1e9245;if(this['actions'][_0x2c07bc['actionid']]&&!_[_0x5b94('0x47')](this[_0x5b94('0x135')][this[_0x5b94('0x24')][_0x2c07bc['actionid']]['queue']])){if(this[_0x5b94('0x29')][_0x3ac345[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]]['queue']]){this['queueBookedRR'][_0x3ac345[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xb8')]]=this[_0x5b94('0x29')][this['actions'][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xb8')]]?this[_0x5b94('0x29')][this['actions'][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xb8')]]:this[_0x5b94('0x135')][this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]]['queue']]?this[_0x5b94('0x135')][this[_0x5b94('0x24')][_0x2c07bc['actionid']][_0x5b94('0xb8')]][_0x5b94('0x13f')]||0x0:0x0;}this[_0x5b94('0x135')][this[_0x5b94('0x24')][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xb8')]][_0x5b94('0x13f')]=this[_0x5b94('0x29')][this['actions'][_0x2c07bc[_0x5b94('0x131')]][_0x5b94('0xb8')]];for(var _0x594216=0x0;_0x594216=0x0;})['catch'](myreject(_0x5f0349)));}}else{_0x19918b[_0x5b94('0x136')](ami[_0x5b94('0xb4')]({'action':'command','command':util['format']('iftime\x20%s,%s',_0x453380,!_['isUndefined'](config[_0x5b94('0x156')][_0x37b957])?_0x37b957:'')})['then'](function(_0x41a45e){return _0x41a45e[_0x5b94('0x15c')][_0x5b94('0x15a')](_0x5b94('0x15b'))>=0x0;})[_0x5b94('0xb6')](myreject(_0x5f0349)));}BPromise[_0x5b94('0x15d')](_0x19918b)[_0x5b94('0xbd')](function(_0x4a012a){var _0x3a0a9a=_['some'](_0x4a012a);if(_0x3a0a9a){return _0xf0da87(_0x3a0a9a);}else{_0x5e92b6['message']=_0x1293eb?_0x5b94('0x15e'):_0x5b94('0x15f');return _0x5f0349(msgResponse(_0x5b94('0x160'),_0x5b94('0x153'),_0x5b94('0x161')+_0x1293eb+'\x20'+_0x528c05+_0x5b94('0x162')+util[_0x5b94('0x9a')](_0x453380,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x37b957));}})['catch'](function(_0x4911ca){return _0x5f0349(msgResponse(_0x5b94('0x150'),_0x5b94('0x153'),JSON[_0x5b94('0x79')](_0x4911ca)));});});};Dialer[_0x5b94('0xb1')][_0x5b94('0x163')]=function(_0x34cfa1){var _0x23cb3b=this;return function(){switch(_0x34cfa1[_0x5b94('0x5c')]){case _0x5b94('0x164'):freeVariablesPredictive(_0x34cfa1);_0x23cb3b['handlePower'](_0x34cfa1,0x1);break;case _0x5b94('0x165'):freeVariablesPredictive(_0x34cfa1);_0x23cb3b['handlePower'](_0x34cfa1,_0x34cfa1[_0x5b94('0x166')]);break;case'predictive':_0x23cb3b['predictive'](_0x34cfa1);break;case _0x5b94('0x167'):freeVariablesPredictive(_0x34cfa1);_0x23cb3b[_0x5b94('0x168')](_0x34cfa1,0x1);break;default:freeVariablesPredictive(_0x34cfa1);logger['error']('Queue',_0x34cfa1[_0x5b94('0x46')],_0x5b94('0x169'));}};};Dialer['prototype'][_0x5b94('0x16a')]=function(_0x1d2218){var _0xc903b4=this;return function(){_0xc903b4[_0x5b94('0x16b')](_0x1d2218);};};Dialer['prototype']['syncQueueSummary']=function(_0x5459e4){var _0x22214c=this;if(isNotPreview(_0x5459e4[_0x5b94('0x5c')])){if(isVoiceQueueOutbound(_0x5459e4[_0x5b94('0x4d')])&&isActive(_0x5459e4[_0x5b94('0x5b')])){_0x5459e4[_0x5b94('0xa5')]=!![];BPromise['resolve']()[_0x5b94('0xbd')](checkIsLoggedIn(_0x5459e4,_0x5459e4[_0x5b94('0x51')]))[_0x5b94('0xbd')](checkIsActive(_0x5459e4,_0x5459e4['dialActive']))[_0x5b94('0xbd')](checkInterval(_0x5459e4))[_0x5b94('0xbd')](_0x22214c[_0x5b94('0x16c')](_0x5459e4))[_0x5b94('0xbd')](_0x22214c[_0x5b94('0x14f')](_0x5459e4[_0x5b94('0x16d')],_0x5459e4['dialTimezone'],_0x5459e4['name'],_0x5459e4))[_0x5b94('0xbd')](_0x22214c[_0x5b94('0x151')](_0x5459e4[_0x5b94('0x43')],_0x5459e4[_0x5b94('0x16e')],_0x5459e4[_0x5b94('0x46')],_0x5459e4))[_0x5b94('0xbd')](_0x22214c[_0x5b94('0x163')](_0x5459e4))[_0x5b94('0xb6')](loggerCatchQueueSummary(_0x5b94('0x16f'),_0x5459e4));}else{notSendMessagesQueue(_0x5459e4);}}else{freeVariablesPredictive(_0x5459e4);}};Dialer[_0x5b94('0xb1')][_0x5b94('0x14b')]=function(){var _0xccc235=this;var _0x2e69ec;for(var _0x1a3f88 in this['campaigns']){if(typeof this[_0x5b94('0x1f')][_0x1a3f88]!==_0x5b94('0x9c')){_0x2e69ec=this[_0x5b94('0x1f')][_0x1a3f88];if(isCampaignIvr(_0x2e69ec[_0x5b94('0x4d')])&&isActive(_0x2e69ec[_0x5b94('0x77')])){_0x2e69ec['sendMessageOneNotActive']=!![];BPromise[_0x5b94('0xbc')]()[_0x5b94('0xbd')](checkIsActive(_0x2e69ec,_0x2e69ec[_0x5b94('0x77')]))[_0x5b94('0xbd')](checkInterval(_0x2e69ec))[_0x5b94('0xbd')](_0xccc235['checkIsTrunkReachable'](_0x2e69ec))[_0x5b94('0xbd')](_0xccc235[_0x5b94('0x14f')](_0x2e69ec['dialGlobalInterval'],_0x2e69ec[_0x5b94('0x16e')],_0x2e69ec[_0x5b94('0x46')],_0x2e69ec))['then'](_0xccc235['checkIfTimeIntervals'](_0x2e69ec[_0x5b94('0x43')],_0x2e69ec[_0x5b94('0x16e')],_0x2e69ec[_0x5b94('0x46')],_0x2e69ec))['then'](_0xccc235[_0x5b94('0x16a')](_0x2e69ec))[_0x5b94('0xb6')](loggerCatchQueueSummary('[syncCampaigns]',_0x2e69ec));}else{notSendMessagesCampaign(_0x2e69ec);}}}};function getCallerIdRandom(_0x6ee85d,_0x2ce847){var _0x54ab4d;var _0x42d996;var _0x434e76;if(_0x2ce847<=0x0){_0x2ce847=0x1;}_0x54ab4d=new RegExp(_0x5b94('0x170')+_0x2ce847+'}$');_0x42d996=Math[_0x5b94('0x171')](0xa,_0x2ce847-0x1);_0x434e76=Math[_0x5b94('0x171')](0xa,_0x2ce847)-0x1;return util[_0x5b94('0x7b')]('%s',_[_0x5b94('0x172')](_0x6ee85d,_0x54ab4d,_[_0x5b94('0x173')](_0x42d996,_0x434e76)));}function extractCalleridName(_0x2c514a){var _0x23d6ba=_0x2c514a[_0x5b94('0x174')](/"(.*?)"/);return _0x23d6ba?_0x23d6ba[0x1]:_0x2c514a;}function extractCalleridNumber(_0x2b872a){var _0x3b947c=_0x2b872a[_0x5b94('0x174')](/<(.*?)>/);return _0x3b947c?_0x3b947c[0x1]:_0x2b872a;}Dialer[_0x5b94('0xb1')][_0x5b94('0x175')]=function(_0x52a6de,_0xb0ad62){var _0x24197c=this;var _0x4737c7=uuid['v4']();this[_0x5b94('0x24')][_0x4737c7]=new Action(_0x52a6de,_0xb0ad62,_0x4737c7);return new BPromise(function(_0x2d54ea,_0x26ba6b){if(_[_0x5b94('0x3d')](_0x52a6de)&&typeof _0x52a6de!==_0x5b94('0x176')){return _0x26ba6b(msgResponse(_0x5b94('0x177'),_0x5b94('0x153'),_0x5b94('0x178')));}if(_['isUndefined'](_0xb0ad62['Contact'][_0x5b94('0x179')])||_0xb0ad62[_0x5b94('0x17a')][_0x5b94('0x179')]===null){return _0x26ba6b(msgResponse(_0x5b94('0x177'),'Failure',_0x5b94('0x17b')));}var _0x3944f4={'XMD-CALLERID':_0x24197c[_0x5b94('0x24')][_0x4737c7][_0x5b94('0x17c')](),'XMD-AGI':_0x52a6de[_0x5b94('0x110')]?util[_0x5b94('0x7b')](_0x5b94('0x17d'),ipAgi,_0x52a6de[_0x5b94('0x110')]):_0x5b94('0x17e'),'XMD-AGIAFTER':_0x52a6de['dialQueueProject2']?util[_0x5b94('0x7b')]('\x22agi://%s/square,%s\x22',ipAgi,_0x52a6de['dialQueueProject2']):'NONE','XMD-QUEUE':_0x52a6de[_0x5b94('0x4d')]==='outbound'?util[_0x5b94('0x7b')](_0x5b94('0x17f'),_0x52a6de[_0x5b94('0x46')],_0x52a6de['dialQueueOptions']||'',_0x52a6de[_0x5b94('0x118')]?'c':'',_0x52a6de['dialQueueTimeout']||0x3):'NONE','XMD-CONTACTID':_0xb0ad62[_0x5b94('0xdb')],'XMD-CDRTYPE':_0x5b94('0x6'),'CALLERID(all)':_0x24197c[_0x5b94('0x24')][_0x4737c7][_0x5b94('0x17c')](),'XMD-AMD':_0x52a6de['dialAMDActive']?_0x5b94('0x180'):'NONE','XMD-DESTINATION':_0x5b94('0xea')};if(_0x52a6de[_0x5b94('0xeb')]){_0x3944f4['XMD-AMDINITIALSILENCE']=_0x52a6de[_0x5b94('0x181')]||0x9c4;_0x3944f4[_0x5b94('0x182')]=_0x52a6de[_0x5b94('0x183')]||0x5dc;_0x3944f4[_0x5b94('0x184')]=_0x52a6de['dialAMDAfterGreetingSilence']||0x320;_0x3944f4[_0x5b94('0x185')]=_0x52a6de[_0x5b94('0x186')]||0x1388;_0x3944f4[_0x5b94('0x187')]=_0x52a6de[_0x5b94('0x188')]||0x64;_0x3944f4[_0x5b94('0x189')]=_0x52a6de[_0x5b94('0x18a')]||0x32;_0x3944f4[_0x5b94('0x18b')]=_0x52a6de['dialAMDMaximumNumberOfWords']||0x3;_0x3944f4[_0x5b94('0x18c')]=_0x52a6de[_0x5b94('0x18d')]||0x100;_0x3944f4[_0x5b94('0x18e')]=_0x52a6de[_0x5b94('0x18f')]||0x1388;}if(_0x52a6de[_0x5b94('0x4d')]===_0x5b94('0x4e')){_0x3944f4[_0x5b94('0x190')]=_0xb0ad62[_0x5b94('0xde')];}else{_0x3944f4[_0x5b94('0x191')]=_0xb0ad62['CampaignId'];}for(var _0x1a7cd8 in _0xb0ad62[_0x5b94('0x17a')]){if(typeof _0xb0ad62[_0x5b94('0x17a')][_0x1a7cd8]!==_0x5b94('0x9c')){if(isNotNull(_0xb0ad62[_0x5b94('0x17a')][_0x1a7cd8])&&_0x1a7cd8!=='id'&&_0x1a7cd8!==_0x5b94('0x192')&&_0x1a7cd8!==_0x5b94('0x193')&&_0x1a7cd8!==_0x5b94('0x194')){_0x3944f4[util['format'](_0x5b94('0x195'),_0x5b94('0x196'),_['toUpper'](_0x1a7cd8))]=_0xb0ad62['Contact'][_0x1a7cd8];}}}var _0x418fe8=_0x24197c['isTrunkReachable'](_0x52a6de['Trunk'])?getCallerId(_0x52a6de[_0x5b94('0x76')]['callerid'],_0x52a6de[_0x5b94('0x5d')],_0x52a6de[_0x5b94('0x197')]>0x0?getCallerIdRandom(_0x52a6de[_0x5b94('0x5e')],_0x52a6de[_0x5b94('0x197')]):_0x52a6de['dialOriginateCallerIdNumber']):getCallerId(_[_0x5b94('0xb3')](_0x52a6de[_0x5b94('0x14d')])?_0x52a6de[_0x5b94('0x76')][_0x5b94('0x78')]:_0x52a6de['TrunkBackup'][_0x5b94('0x78')],_0x52a6de[_0x5b94('0x5d')],_0x52a6de['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x52a6de[_0x5b94('0x5e')],_0x52a6de[_0x5b94('0x197')]):_0x52a6de[_0x5b94('0x5e')]);if(_0x418fe8){_0x3944f4[_0x5b94('0x198')]=_0x24197c['actions'][_0x4737c7][_0x5b94('0x199')]=extractCalleridName(_0x418fe8);_0x3944f4['XMD-ORIGINATECALLERIDNUM']=_0x24197c['actions'][_0x4737c7][_0x5b94('0x19a')]=extractCalleridNumber(_0x418fe8);}return ami[_0x5b94('0xb4')]({'actionid':_0x4737c7,'action':_0x5b94('0x177'),'channel':_0x24197c[_0x5b94('0x14c')](_0x52a6de['Trunk'])?util[_0x5b94('0x7b')]('SIP/%s/%s%s',_0x52a6de[_0x5b94('0x76')][_0x5b94('0x46')],isNotNull(_0x52a6de[_0x5b94('0x19b')])?_0x52a6de[_0x5b94('0x19b')]['trim']()||'':'',_0x52a6de[_0x5b94('0x19c')]>0x0?_0xb0ad62[_0x5b94('0x17a')][_0x5b94('0x179')][_0x5b94('0x19d')](_0x52a6de['dialCutDigit']):_0xb0ad62[_0x5b94('0x17a')]['phone']):util['format']('SIP/%s/%s%s',_['isNil'](_0x52a6de[_0x5b94('0x14d')])?_0x52a6de[_0x5b94('0x76')][_0x5b94('0x46')]:_0x52a6de[_0x5b94('0x14d')][_0x5b94('0x46')],isNotNull(_0x52a6de['dialPrefix'])?_0x52a6de[_0x5b94('0x19b')][_0x5b94('0x19e')]()||'':'',_0x52a6de['dialCutDigit']>0x0?_0xb0ad62[_0x5b94('0x17a')][_0x5b94('0x179')][_0x5b94('0x19d')](_0x52a6de[_0x5b94('0x19c')]):_0xb0ad62[_0x5b94('0x17a')][_0x5b94('0x179')]),'callerid':_0x418fe8,'Exten':_0x5b94('0xea'),'Context':'from-sip','Priority':'1','variable':_0x3944f4,'timeout':(_0x52a6de[_0x5b94('0x5f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4737c7})[_0x5b94('0xbd')](function(_0x508cd0){return _0x2d54ea(_0x508cd0);})[_0x5b94('0xb6')](function(_0xfd0a2c){_0x52a6de[_0x5b94('0x19f')]+=0x1;var _0x35bde6=new History(_0x24197c[_0x5b94('0x24')][_0x4737c7]);logger[_0x5b94('0x99')](util[_0x5b94('0x7b')](_0x5b94('0x1a0'),JSON['stringify'](_0xfd0a2c)));_0x35bde6[_0x5b94('0xac')]=0xe;_0x35bde6[_0x5b94('0xad')]=_0x5b94('0x1a1');_0x35bde6['starttime']=moment()[_0x5b94('0x7b')](_0x5b94('0x108'));_0x35bde6['endtime']=_0x35bde6[_0x5b94('0x124')];_0x24197c['createHistory'](_0x35bde6)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1a2')));_0x24197c[_0x5b94('0xcf')](_0x35bde6)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1a2')))[_0x5b94('0x1c')](function(){delete _0x24197c[_0x5b94('0x24')][_0x4737c7];return _0x26ba6b(msgResponse(_0x5b94('0x177'),_0x5b94('0x1a3'),_0x5b94('0x1a4')));});});});};Dialer['prototype']['syncOriginateResponse']=function(_0x38d8ba){var _0x2b67bc=this[_0x5b94('0x24')][_0x38d8ba[_0x5b94('0x131')]];if(_0x2b67bc){delete this[_0x5b94('0x24')][_0x38d8ba['actionid']];_0x2b67bc[_0x5b94('0x11d')]=moment()[_0x5b94('0x7b')](_0x5b94('0x108'));var _0x528f31=_0x2b67bc[_0x5b94('0x4d')]===_0x5b94('0x7d')?this[_0x5b94('0x1f')][_0x2b67bc[_0x5b94('0xb8')]]:this[_0x5b94('0x1e')][_0x2b67bc['getQueue']()];if(!this[_0x5b94('0xe2')](_0x38d8ba[_0x5b94('0x1a5')])){this[_0x5b94('0xd3')](_0x528f31);return this[_0x5b94('0x1a6')](_0x2b67bc,_0x528f31,_0x38d8ba)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1a7')));}this[_0x5b94('0x26')][_0x38d8ba[_0x5b94('0xed')]]=_0x2b67bc;}};Dialer[_0x5b94('0xb1')][_0x5b94('0x1a8')]=function(_0x14a34c,_0x2302f7,_0x2b3712){var _0x44402f=new History(_0x2302f7);if(_0x44402f[_0x5b94('0x1a9')]+_0x44402f[_0x5b94('0xfc')]+_0x44402f[_0x5b94('0xfd')]+_0x44402f[_0x5b94('0xfe')]+_0x44402f[_0x5b94('0xff')]+_0x44402f['countabandonedretry']+_0x44402f['countmachineretry']+_0x44402f['countagentrejectretry']>=_0x2b3712[_0x5b94('0x102')]-0x1){return!![];}switch(_0x14a34c){case 0x3:if(_0x44402f[_0x5b94('0xfd')]>=_0x2b3712[_0x5b94('0x1aa')]-0x1){return!![];}this[_0x5b94('0xc4')]({'active':![],'countnoanswerretry':_0x44402f[_0x5b94('0xfd')]+=0x1,'scheduledat':moment()[_0x5b94('0x10b')](_0x2b3712[_0x5b94('0x1ab')],_0x5b94('0x107'))[_0x5b94('0x7b')](_0x5b94('0x108')),'ContactId':_0x44402f[_0x5b94('0xdb')],'ListId':_0x44402f[_0x5b94('0xdc')],'VoiceQueueId':_0x44402f[_0x5b94('0xde')]||undefined,'CampaignId':_0x44402f['CampaignId']||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1ac')));break;case 0x5:if(_0x44402f['countbusyretry']>=_0x2b3712[_0x5b94('0x1ad')]-0x1){return!![];}this[_0x5b94('0xc4')]({'active':![],'countbusyretry':_0x44402f[_0x5b94('0x1a9')]+=0x1,'scheduledat':moment()[_0x5b94('0x10b')](_0x2b3712[_0x5b94('0x1ae')],_0x5b94('0x107'))[_0x5b94('0x7b')](_0x5b94('0x108')),'ContactId':_0x44402f[_0x5b94('0xdb')],'ListId':_0x44402f['ListId'],'VoiceQueueId':_0x44402f[_0x5b94('0xde')]||undefined,'CampaignId':_0x44402f['CampaignId']||undefined})[_0x5b94('0xb6')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x44402f[_0x5b94('0xfc')]>=_0x2b3712[_0x5b94('0x1af')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x44402f[_0x5b94('0xfc')]+=0x1,'scheduledat':moment()['add'](_0x2b3712[_0x5b94('0x1b0')],_0x5b94('0x107'))[_0x5b94('0x7b')](_0x5b94('0x108')),'ContactId':_0x44402f[_0x5b94('0xdb')],'ListId':_0x44402f[_0x5b94('0xdc')],'VoiceQueueId':_0x44402f[_0x5b94('0xde')]||undefined,'CampaignId':_0x44402f['CampaignId']||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1b1')));break;case 0x0:if(_0x44402f['countnosuchnumberretry']>=_0x2b3712[_0x5b94('0x1b2')]-0x1){return!![];}else{this[_0x5b94('0xc4')]({'active':![],'countnosuchnumberretry':_0x44402f['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0x5b94('0x10b')](_0x2b3712['dialNoSuchNumberRetryFrequency'],'minutes')[_0x5b94('0x7b')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x44402f['ContactId'],'ListId':_0x44402f[_0x5b94('0xdc')],'VoiceQueueId':_0x44402f[_0x5b94('0xde')]||undefined,'CampaignId':_0x44402f[_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x44402f[_0x5b94('0xff')]>=_0x2b3712[_0x5b94('0x1b3')]-0x1){return!![];}this[_0x5b94('0xc4')]({'active':![],'countdropretry':_0x44402f[_0x5b94('0xff')]+=0x1,'scheduledat':moment()[_0x5b94('0x10b')](_0x2b3712[_0x5b94('0x122')],_0x5b94('0x107'))[_0x5b94('0x7b')](_0x5b94('0x108')),'ContactId':_0x44402f[_0x5b94('0xdb')],'ListId':_0x44402f[_0x5b94('0xdc')],'VoiceQueueId':_0x44402f[_0x5b94('0xde')]||undefined,'CampaignId':_0x44402f[_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x123')));break;case 0xb:if(_0x44402f['countabandonedretry']>=_0x2b3712[_0x5b94('0x12b')]-0x1){return!![];}this[_0x5b94('0xc4')]({'active':![],'countabandonedretry':_0x44402f[_0x5b94('0x100')]+=0x1,'scheduledat':moment()[_0x5b94('0x10b')](_0x2b3712[_0x5b94('0x12d')],_0x5b94('0x107'))[_0x5b94('0x7b')](_0x5b94('0x108')),'ContactId':_0x44402f['ContactId'],'ListId':_0x44402f[_0x5b94('0xdc')],'VoiceQueueId':_0x44402f[_0x5b94('0xde')]||undefined,'CampaignId':_0x44402f['CampaignId']||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x12e')));break;case 0x13:if(_0x44402f[_0x5b94('0xf8')]>=_0x2b3712[_0x5b94('0x105')]-0x1){return!![];}this[_0x5b94('0xc4')]({'active':![],'countmachineretry':_0x44402f[_0x5b94('0xf8')]+=0x1,'scheduledat':moment()['add'](_0x2b3712[_0x5b94('0x10c')],_0x5b94('0x107'))['format'](_0x5b94('0x108')),'ContactId':_0x44402f[_0x5b94('0xdb')],'ListId':_0x44402f['ListId'],'VoiceQueueId':_0x44402f[_0x5b94('0xde')]||undefined,'CampaignId':_0x44402f['CampaignId']||undefined})[_0x5b94('0xb6')](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x44402f[_0x5b94('0x101')]>=_0x2b3712[_0x5b94('0x1b4')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x44402f['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x5b94('0x10b')](_0x2b3712[_0x5b94('0x1b5')],'minutes')[_0x5b94('0x7b')](_0x5b94('0x108')),'ContactId':_0x44402f[_0x5b94('0xdb')],'ListId':_0x44402f['ListId'],'VoiceQueueId':_0x44402f['VoiceQueueId']||undefined,'CampaignId':_0x44402f['CampaignId']||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1b6')));break;default:return!![];}};Dialer[_0x5b94('0xb1')][_0x5b94('0x1a6')]=function(_0x54dc64,_0x2974d5,_0x93f3c5){var _0x61cf7a=this;var _0x56815f=new History(_0x54dc64);return new BPromise(function(_0x8fc893,_0x5de740){if(_[_0x5b94('0x3d')](_0x2974d5)&&typeof _0x2974d5!==_0x5b94('0x176')){return _0x5de740(msgResponse(_0x5b94('0x1b7'),_0x5b94('0x153'),_0x5b94('0x1b8')));}if(_[_0x5b94('0x3d')](_0x93f3c5)&&typeof _0x93f3c5!==_0x5b94('0x176')){return _0x5de740(msgResponse(_0x5b94('0x1b7'),_0x5b94('0x153'),_0x5b94('0x1b9')));}switch(_0x93f3c5['reason']){case'0':_0x2974d5['outboundNoSuchCallsDay']+=0x1;_0x56815f['state']=0x0;_0x56815f[_0x5b94('0xad')]=_0x5b94('0x1ba');_0x56815f['countnosuchnumberretry']+=0x1;_0x56815f['countglobal']+=0x1;ami['emit'](_0x5b94('0x1bb'),ut[_0x5b94('0xfa')](_0x54dc64,_0x5b94('0x1bc')));_0x61cf7a['createHistory'](_0x56815f)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xfb')));if(_0x61cf7a['checkRetriveMax'](0x0,_0x54dc64,_0x2974d5)){if(_0x56815f[_0x5b94('0xfe')]>=_0x2974d5[_0x5b94('0x1b2')]){_0x61cf7a[_0x5b94('0x1bd')](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1be'));}else{_0x61cf7a[_0x5b94('0x103')](_0x56815f,_0x8fc893,_0x5de740,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2974d5[_0x5b94('0x65')]+=0x1;_0x56815f[_0x5b94('0xac')]=0x3;_0x56815f[_0x5b94('0xad')]=_0x5b94('0x1bf');_0x56815f[_0x5b94('0xfd')]+=0x1;_0x56815f[_0x5b94('0xf9')]+=0x1;ami[_0x5b94('0x4c')](_0x5b94('0x1c0'),ut[_0x5b94('0xfa')](_0x54dc64,_0x5b94('0x1c1')));_0x61cf7a[_0x5b94('0xd1')](_0x56815f)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1c2')));if(_0x61cf7a[_0x5b94('0x1a8')](0x3,_0x54dc64,_0x2974d5)){if(_0x56815f['countnoanswerretry']>=_0x2974d5[_0x5b94('0x1aa')]){_0x61cf7a[_0x5b94('0x1bd')](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1c3'));}else{_0x61cf7a['stateGlobal'](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1c3'));}}break;case'5':_0x2974d5['outboundBusyCallsDay']+=0x1;_0x56815f[_0x5b94('0xac')]=0x5;_0x56815f[_0x5b94('0xad')]=_0x5b94('0x1c4');_0x56815f[_0x5b94('0x1a9')]+=0x1;_0x56815f[_0x5b94('0xf9')]+=0x1;ami[_0x5b94('0x4c')](_0x5b94('0x1c5'),ut[_0x5b94('0xfa')](_0x54dc64,_0x5b94('0x1c6')));_0x61cf7a[_0x5b94('0xd1')](_0x56815f)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1c7')));if(_0x61cf7a[_0x5b94('0x1a8')](0x5,_0x54dc64,_0x2974d5)){if(_0x56815f[_0x5b94('0x1a9')]>=_0x2974d5[_0x5b94('0x1ad')]){_0x61cf7a['createStateFinal'](_0x56815f,_0x8fc893,_0x5de740,'reason\x205\x20busy');}else{_0x61cf7a['stateGlobal'](_0x56815f,_0x8fc893,_0x5de740,'reason\x205\x20busy');}}break;case'8':_0x2974d5[_0x5b94('0x62')]+=0x1;_0x56815f[_0x5b94('0xac')]=0x8;_0x56815f['statedesc']='Congestion';_0x56815f[_0x5b94('0xfc')]+=0x1;_0x56815f['countglobal']+=0x1;ami[_0x5b94('0x4c')](_0x5b94('0x1c8'),ut['buildObj'](_0x54dc64,_0x5b94('0x1c9')));_0x61cf7a['createHistory'](_0x56815f)['catch'](loggerCatch(_0x5b94('0x1ca')));if(_0x61cf7a[_0x5b94('0x1a8')](0x8,_0x54dc64,_0x2974d5)){if(_0x56815f[_0x5b94('0xfc')]>=_0x2974d5[_0x5b94('0x1af')]){_0x61cf7a[_0x5b94('0x1bd')](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1cb'));}else{_0x61cf7a[_0x5b94('0x103')](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1cb'));}}break;case'11':_0x2974d5['outboundAbandonedCallsDay']+=0x1;_0x56815f['state']=0xb;_0x56815f[_0x5b94('0xad')]=_0x5b94('0x129');_0x56815f[_0x5b94('0x100')]+=0x1;_0x56815f['countglobal']+=0x1;_0x61cf7a[_0x5b94('0xd1')](_0x56815f)[_0x5b94('0xb6')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x61cf7a[_0x5b94('0x1a8')](0xb,_0x54dc64,_0x2974d5)){if(_0x56815f[_0x5b94('0x100')]>=_0x2974d5['dialAbandonedMaxRetry']){_0x61cf7a[_0x5b94('0x1bd')](_0x56815f,_0x8fc893,_0x5de740,'reason\x2011\x20abandoned');}else{_0x61cf7a[_0x5b94('0x103')](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1cc'));}}break;case'20':_0x2974d5[_0x5b94('0x68')]+=0x1;_0x56815f['state']=0x14;_0x56815f[_0x5b94('0xad')]=_0x5b94('0x1cd');_0x56815f['countagentrejectretry']+=0x1;_0x56815f[_0x5b94('0xf9')]+=0x1;ami[_0x5b94('0x4c')]('custom:agentreject',ut['buildObj'](_0x54dc64,'agentreject'));_0x61cf7a[_0x5b94('0xd1')](_0x56815f)[_0x5b94('0xb6')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x61cf7a[_0x5b94('0x1a8')](0x14,_0x54dc64,_0x2974d5)){if(_0x56815f[_0x5b94('0x101')]>=_0x2974d5[_0x5b94('0x1b4')]){_0x61cf7a[_0x5b94('0x1bd')](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1ce'));}else{_0x61cf7a[_0x5b94('0x103')](_0x56815f,_0x8fc893,_0x5de740,_0x5b94('0x1ce'));}}break;default:_0x2974d5['outboundUnknownCallsDay']+=0x1;_0x56815f[_0x5b94('0xac')]=0xc;_0x56815f[_0x5b94('0xad')]=_0x93f3c5['reason'];_0x61cf7a['createHistory'](_0x56815f)[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1cf')));if(_0x61cf7a[_0x5b94('0x1a8')](_0x93f3c5[_0x5b94('0x114')],_0x54dc64,_0x2974d5)){if(_0x56815f['countbusyretry']+_0x56815f[_0x5b94('0xfc')]+_0x56815f[_0x5b94('0xfd')]+_0x56815f[_0x5b94('0xfe')]+_0x56815f[_0x5b94('0xff')]+_0x56815f['countabandonedretry']+_0x56815f['countmachineretry']+_0x56815f[_0x5b94('0x101')]>=_0x2974d5[_0x5b94('0x102')]){_0x61cf7a['stateGlobal'](_0x56815f,_0x8fc893,_0x5de740,_0x93f3c5['reason']);}else{_0x61cf7a['createStateFinal'](_0x56815f,_0x8fc893,_0x5de740,_0x93f3c5[_0x5b94('0x114')]);}}}});};Dialer[_0x5b94('0xb1')][_0x5b94('0x103')]=function(_0x45dc52,_0x3ed08f,_0x1e3891,_0x1cf4ea){var _0x4f72fb=new Final(_0x45dc52);_0x4f72fb['state']=0xf;_0x4f72fb[_0x5b94('0xad')]=_0x5b94('0x1d0');this['createStateFinal'](_0x4f72fb,_0x3ed08f,_0x1e3891,_0x1cf4ea);};Dialer['prototype'][_0x5b94('0x1bd')]=function(_0x5a79b6,_0x357843,_0x54c23c,_0x46d39f){this[_0x5b94('0xcf')](_0x5a79b6)[_0x5b94('0xbd')](function(){return _0x357843(msgResponse(_0x5b94('0x1b7'),_0x5b94('0xe3'),_0x46d39f));})[_0x5b94('0xb6')](function(){return _0x54c23c(msgResponse(_0x5b94('0x1d1'),_0x5b94('0x153'),_0x5b94('0x1d2')));});};Dialer['prototype'][_0x5b94('0x7')]=function(_0x42b2df){var _0x478407=_0x42b2df['dialPredictiveOptimizationPercentage']/0x64;var _0x31ae7d=_0x42b2df['outboundDropCallsDayTimeout']/(_0x42b2df[_0x5b94('0x11f')]+_0x42b2df[_0x5b94('0x60')]);var _0x2f9b69=Math[_0x5b94('0x1d3')](_0x42b2df[_0x5b94('0x70')]*(_0x42b2df['predictiveIntervalMaxThreshold']/0x64));var _0x55a76f=Math['round'](_0x42b2df[_0x5b94('0x70')]*(_0x42b2df['predictiveIntervalMinThreshold']/0x64));var _0x3bfba3=_0x42b2df[_0x5b94('0x50')]+_0x42b2df['talking'];var _0x35899d=Math['floor'](_0x42b2df[_0x5b94('0x72')]*_0x42b2df[_0x5b94('0x74')]*_0x42b2df['predictiveIntervalHitRate']*_0x42b2df[_0x5b94('0x1d4')]);if(_[_0x5b94('0x3d')](_0x42b2df[_0x5b94('0x28')])){if(!_['isUndefined'](_0x42b2df[_0x5b94('0x27')])){_0x42b2df[_0x5b94('0x27')]=undefined;loggerPredictive[_0x5b94('0x99')](_0x5b94('0x1d5'),_0x5b94('0x1d6'));}if(!_[_0x5b94('0x3d')](_0x42b2df['handlePredictive'])){loggerPredictive[_0x5b94('0x99')](_0x5b94('0x1d5'),_0x5b94('0x1d7'));clearInterval(_0x42b2df['handlePredictive']);_0x42b2df['handlePredictive']=undefined;}_0x42b2df[_0x5b94('0x28')]=moment()[_0x5b94('0x7b')](_0x5b94('0x108'));loggerPredictive[_0x5b94('0x81')](_0x42b2df[_0x5b94('0x46')],_0x5b94('0x1d8'),_0x42b2df['startProgressive']);this[_0x5b94('0x168')](_0x42b2df,0x1);}else if(ifInterval(_0x42b2df['dialPredictiveInterval'],_0x42b2df[_0x5b94('0x28')])){this[_0x5b94('0x168')](_0x42b2df,0x1);loggerPredictiveCalls[_0x5b94('0x81')](_0x5b94('0x1d9'),_0x42b2df[_0x5b94('0x28')],_0x42b2df[_0x5b94('0x46')]);_0x42b2df[_0x5b94('0x72')]=0x0;_0x42b2df[_0x5b94('0x6d')]=0x0;}else if(_0x478407<_0x31ae7d&&_0x42b2df['dialPredictiveOptimization']===_0x5b94('0x1da')){freeVariablesPredictive(_0x42b2df);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x1db'),'Dropped\x20calls\x20day',_0x31ae7d,_0x5b94('0x28'),_0x42b2df[_0x5b94('0x46')]);}else if(_0x35899d<_0x42b2df['predictiveIntervalErlangCallsDroppedCalls']&&_0x42b2df[_0x5b94('0x1dc')]===_0x5b94('0x1da')){freeVariablesPredictive(_0x42b2df);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x1dd'),_0x5b94('0x1de'),_0x35899d,'Drop\x20in\x20this\x20interval',_0x42b2df[_0x5b94('0x6d')],_0x5b94('0x28'),_0x42b2df['name']);}else if(!ifInterval(_0x42b2df[_0x5b94('0x1df')],_0x42b2df[_0x5b94('0x28')])&&_[_0x5b94('0x3d')](_0x42b2df[_0x5b94('0x27')])&&!_[_0x5b94('0x3d')](_0x42b2df['startProgressive'])){_0x42b2df[_0x5b94('0x27')]=moment()[_0x5b94('0x7b')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x5b94('0x81')](_0x42b2df[_0x5b94('0x46')],_0x5b94('0x1e0'),_0x42b2df[_0x5b94('0x27')]);this['averageHandleTime'](_0x42b2df[_0x5b94('0x1df')])[_0x5b94('0xbd')](this[_0x5b94('0x1e1')](_0x42b2df))[_0x5b94('0xbd')](mergeDataErlangB(_0x42b2df))[_0x5b94('0xbd')](this[_0x5b94('0x1e2')](_0x42b2df))[_0x5b94('0xb6')](loggerCatchPredictive(_0x5b94('0x1e3'),_0x42b2df));}else if(!ifInterval(_0x42b2df[_0x5b94('0x1df')],_0x42b2df['startPredictive'])){_0x42b2df[_0x5b94('0x6d')]=0x0;_0x42b2df[_0x5b94('0x27')]=moment()['format'](_0x5b94('0x108'));loggerPredictive[_0x5b94('0x81')](_0x42b2df[_0x5b94('0x46')],_0x5b94('0x1e4'),_0x42b2df[_0x5b94('0x27')]);clearInterval(_0x42b2df[_0x5b94('0x94')]);_0x42b2df['handlePredictive']=undefined;this[_0x5b94('0xc1')](_0x42b2df['dialPredictiveInterval'])[_0x5b94('0xbd')](this[_0x5b94('0x1e1')](_0x42b2df))[_0x5b94('0xbd')](mergeDataErlangB(_0x42b2df))[_0x5b94('0xbd')](this[_0x5b94('0x1e2')](_0x42b2df))[_0x5b94('0xb6')](loggerCatchPredictive(_0x5b94('0x1e5'),_0x42b2df));}else if(_0x42b2df['predictiveIntervalAvailable']&&_0x3bfba3<_0x42b2df[_0x5b94('0x70')]-_0x55a76f){freeVariablesPredictive(_0x42b2df);loggerPredictive['info'](_0x42b2df[_0x5b94('0x46')],_0x5b94('0x1e6'),_0x3bfba3,')\x20are\x20less\x20than\x20threshold\x20(',_0x42b2df[_0x5b94('0x70')],'-',_0x55a76f,'=',_0x42b2df['predictiveIntervalAvailable']-_0x55a76f,')');}else if(_0x42b2df[_0x5b94('0x70')]&&_0x3bfba3>_0x42b2df['predictiveIntervalAvailable']+_0x2f9b69){freeVariablesPredictive(_0x42b2df);loggerPredictive[_0x5b94('0x81')](_0x42b2df[_0x5b94('0x46')],_0x5b94('0x1e6'),_0x3bfba3,')\x20are\x20more\x20than\x20threshold\x20(',_0x42b2df['predictiveIntervalAvailable'],'+',_0x2f9b69,'=',_0x42b2df['predictiveIntervalAvailable']+_0x2f9b69,')');}};Dialer[_0x5b94('0xb1')]['getDataPredictive']=function(_0x3636e8){var _0x422794=this;return function(_0x224da1){return new BPromise(function(_0xfe6994,_0x3a402b){_[_0x5b94('0xd9')](_0x3636e8,_0x224da1[0x0]);if(checkGetDataPredictive(_0x224da1[0x0])){var _0x45bceb=_0x3636e8[_0x5b94('0x70')]=_0x3636e8[_0x5b94('0x56')]+_0x3636e8[_0x5b94('0x50')];var _0x1b8a55=_0x3636e8[_0x5b94('0x1df')]*0x3c;var _0x3bd975=_0x224da1[0x0][_0x5b94('0x8a')]+_0x224da1[0x0][_0x5b94('0x6a')];var _0x4ec46c=(_0x224da1[0x0][_0x5b94('0x85')]+_0x224da1[0x0][_0x5b94('0x6b')]+_0x224da1[0x0][_0x5b94('0x1e7')])/_0x224da1[0x0][_0x5b94('0x83')];_0x3636e8[_0x5b94('0x6e')]=_0x4ec46c>0x0?_0x4ec46c:0x1;switch(_0x3636e8[_0x5b94('0x1dc')]){case _0x5b94('0x1da'):var _0x412883=_0x3636e8[_0x5b94('0x1e8')]/0x64;return _0x422794[_0x5b94('0x1e9')](_0x45bceb,_0x1b8a55,_0x3bd975,_0x4ec46c,_0x412883)['then'](function(_0x30cfff){return _0xfe6994(_0x30cfff);});case _0x5b94('0x1ea'):var _0x323476=_0x3636e8[_0x5b94('0x1e8')]/0x64;return _0x422794['busyFactor'](_0x45bceb,_0x1b8a55,_0x3bd975,_0x4ec46c,_0x323476)[_0x5b94('0xbd')](function(_0x382522){return _0xfe6994(_0x382522);});default:return _0x3a402b(msgResponse(_0x5b94('0x1eb'),'Failure','Unknown\x20Predictive'));}}else{return _0x3a402b(msgResponse(_0x5b94('0x1eb'),'Failure',_0x5b94('0x1ec')));}});};};Dialer[_0x5b94('0xb1')][_0x5b94('0x1ed')]=function(_0x66bea2){var _0x4235a5=this;return function(_0x48678f){return new BPromise(function(_0x482aec,_0x16e21a){_[_0x5b94('0xd9')](_0x66bea2,_0x48678f[0x0]);if(checkGetDataPredictive(_0x48678f[0x0])){loggerPredictive[_0x5b94('0x81')](JSON['stringify'](_0x48678f[0x0]));if(_0x66bea2['dialPredictiveOptimization']===_0x5b94('0x1da')){return _0x4235a5[_0x5b94('0xcd')](_0x66bea2['id'])[_0x5b94('0xbd')](function(_0x4604e2){var _0x56aaf7=_0x66bea2[_0x5b94('0x51')]-_0x4604e2[0x0]['outboundQueuePauses'];var _0x416c41=_0x66bea2[_0x5b94('0x1df')]*0x3c;var _0x121536=_0x48678f[0x0][_0x5b94('0x8a')]+_0x48678f[0x0][_0x5b94('0x6a')];var _0x5140a9=(_0x48678f[0x0][_0x5b94('0x85')]+_0x48678f[0x0][_0x5b94('0x6b')]+_0x48678f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x48678f[0x0][_0x5b94('0x83')];var _0xa70a92=_0x66bea2[_0x5b94('0x1e8')]/0x64;_0x66bea2['predictiveIntervalPauses']=_0x4604e2[0x0][_0x5b94('0x1ee')]||0x0;_0x66bea2[_0x5b94('0x6e')]=_0x5140a9>0x0?_0x5140a9:0x1;return _0x4235a5['abandonmentRate'](_0x56aaf7,_0x416c41,_0x121536,_0x5140a9,_0xa70a92);})[_0x5b94('0xbd')](function(_0x426228){return _0x482aec(_0x426228);})[_0x5b94('0xb6')](function(_0x5792ca){return _0x16e21a(msgResponse(_0x5b94('0x1ef'),_0x5b94('0x153'),JSON['stringify'](_0x5792ca)));});}if(_0x66bea2[_0x5b94('0x1dc')]===_0x5b94('0x1ea')){return _0x4235a5[_0x5b94('0xcd')](_0x66bea2['id'])[_0x5b94('0xbd')](function(_0x403417){var _0x48b01d=_0x66bea2[_0x5b94('0x51')]-_0x403417[0x0][_0x5b94('0x1ee')];var _0x5338e5=_0x66bea2[_0x5b94('0x1df')]*0x3c;var _0xb52f53=_0x48678f[0x0][_0x5b94('0x8a')]+_0x48678f[0x0][_0x5b94('0x6a')];var _0x101e6f=(_0x48678f[0x0][_0x5b94('0x85')]+_0x48678f[0x0][_0x5b94('0x6b')]+_0x48678f[0x0][_0x5b94('0x1e7')])/_0x48678f[0x0]['predictiveIntervalTotalCalls'];var _0x3c408a=_0x66bea2[_0x5b94('0x1e8')]/0x64;_0x66bea2[_0x5b94('0x6f')]=_0x403417[0x0][_0x5b94('0x1ee')]||0x0;_0x66bea2[_0x5b94('0x6e')]=_0x101e6f>0x0?_0x101e6f:0x1;return _0x4235a5[_0x5b94('0x1f0')](_0x48b01d,_0x5338e5,_0xb52f53,_0x101e6f,_0x3c408a);})[_0x5b94('0xbd')](function(_0x142e01){return _0x482aec(_0x142e01);})[_0x5b94('0xb6')](function(_0x1c4929){return _0x16e21a(msgResponse(_0x5b94('0x1ef'),'Failure',JSON['stringify'](_0x1c4929)));});}}else{return _0x16e21a(msgResponse(_0x5b94('0x1eb'),_0x5b94('0x153'),'check\x20failure'));}});};};Dialer[_0x5b94('0xb1')]['startMethodPredictive']=function(_0x4c4d79){var _0x4addc2=this;return function(){var _0x46f5c4=0x0;var _0x5784f5=Math[_0x5b94('0x1f1')](_0x4c4d79[_0x5b94('0x73')]*0x3e8);if(_0x5784f5>0x0){_0x5784f5=_0x5784f5<0x64?0x64:_0x5784f5;loggerPredictive[_0x5b94('0x81')](_0x4c4d79[_0x5b94('0x46')],_0x5b94('0x1f2'),_0x5784f5,_0x5b94('0x49'));_0x4c4d79[_0x5b94('0x94')]=setInterval(function(){_0x4addc2['handlePredictive'](_0x4c4d79);loggerPredictiveCalls['info'](_0x5b94('0x1f3'),_0x46f5c4+=0x1);},_0x5784f5);}else{loggerPredictive[_0x5b94('0x81')](_0x4c4d79[_0x5b94('0x46')],_0x5b94('0x1f4'));}};};Dialer[_0x5b94('0xb1')]['checkContactBlack']=function(_0xdbbbc4,_0x2e2871){var _0x11f8f5=this;return function(_0x1af48e){if(_[_0x5b94('0x47')](_0x1af48e)){if(_[_0x5b94('0xb3')](_0x2e2871['UserId'])||!_0x2e2871['recallme']){if(_0xdbbbc4[_0x5b94('0x5c')]==='booked'){_0xdbbbc4['queueStatusComplete']=_[_0x5b94('0x3d')](_0xdbbbc4[_0x5b94('0x139')])?!![]:_0xdbbbc4[_0x5b94('0x139')];var _0x6b978b=uuid['v4']();_0x11f8f5[_0x5b94('0x24')][_0x6b978b]=new Action(_0xdbbbc4,_0x2e2871,_0x6b978b);loggerBooked[_0x5b94('0x81')]('[booked][checkContactBlack]',_0x6b978b,'queueStatusComplete:\x20',JSON[_0x5b94('0x79')](_0xdbbbc4[_0x5b94('0x139')]),_0x5b94('0x1f5'),_0xdbbbc4[_0x5b94('0x46')]);if(_0xdbbbc4[_0x5b94('0x139')]){_0xdbbbc4[_0x5b94('0x139')]=![];_0x11f8f5[_0x5b94('0x135')][_0x11f8f5[_0x5b94('0x24')][_0x6b978b][_0x5b94('0xb8')]]=[];ami[_0x5b94('0xb4')]({'actionid':_0x6b978b,'action':'queuestatus','queue':_0xdbbbc4[_0x5b94('0x46')]})[_0x5b94('0xb6')](function(){_0x11f8f5['updateOriginated'](_0xdbbbc4);_0x11f8f5[_0x5b94('0xc4')]({'active':![],'ContactId':_0x11f8f5[_0x5b94('0x24')][_0x6b978b][_0x5b94('0xdb')],'ListId':_0x11f8f5[_0x5b94('0x24')][_0x6b978b]['ListId'],'VoiceQueueId':_0x11f8f5[_0x5b94('0x24')][_0x6b978b][_0x5b94('0xde')]||undefined,'CampaignId':_0x11f8f5[_0x5b94('0x24')][_0x6b978b][_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1f6')));delete _0x11f8f5[_0x5b94('0x24')][_0x6b978b];});}else{loggerBooked[_0x5b94('0x81')](_0x5b94('0x1f7'),JSON[_0x5b94('0x79')](_0xdbbbc4[_0x5b94('0x139')]),_0x5b94('0x1f5'),_0xdbbbc4[_0x5b94('0x46')]);_0x11f8f5[_0x5b94('0xd3')](_0xdbbbc4);_0x11f8f5[_0x5b94('0xc4')]({'active':![],'ContactId':_0x11f8f5['actions'][_0x6b978b][_0x5b94('0xdb')],'ListId':_0x11f8f5[_0x5b94('0x24')][_0x6b978b]['ListId'],'VoiceQueueId':_0x11f8f5['actions'][_0x6b978b][_0x5b94('0xde')]||undefined,'CampaignId':_0x11f8f5['actions'][_0x6b978b]['CampaignId']||undefined})[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1f6')));delete _0x11f8f5[_0x5b94('0x24')][_0x6b978b];}}else{return _0x11f8f5[_0x5b94('0x175')](_0xdbbbc4,_0x2e2871);}}else{if(getDiff(_0x2e2871[_0x5b94('0x1f8')])<_0xdbbbc4[_0x5b94('0x1f9')]*0x3c){if(_0x2e2871[_0x5b94('0x1fa')]&&!_0x2e2871[_0x5b94('0x1fa')][_0x5b94('0x1fb')]){_0x11f8f5['preview'][_0x5b94('0x13c')](_0x2e2871['id'])[_0x5b94('0x1c')](function(){_0x11f8f5[_0x5b94('0xd3')](_0xdbbbc4);});}else{_0x11f8f5[_0x5b94('0xc6')]({'active':![]},_0x2e2871['id'],0x1)[_0x5b94('0x1c')](function(){_0x11f8f5[_0x5b94('0xd3')](_0xdbbbc4);});}}else{_0xdbbbc4[_0x5b94('0x67')]+=0x1;_0x11f8f5[_0x5b94('0xd3')](_0xdbbbc4);if(_0xdbbbc4[_0x5b94('0x1fc')]){_0x11f8f5[_0x5b94('0xc4')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2e2871[_0x5b94('0xdb')],'ListId':_0x2e2871[_0x5b94('0xdc')],'VoiceQueueId':_0x2e2871[_0x5b94('0xde')]||undefined,'CampaignId':_0x2e2871[_0x5b94('0xdf')]||undefined})[_0x5b94('0xb6')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));_0x11f8f5[_0x5b94('0xd1')](createObjHistory(_0xdbbbc4,_0x2e2871,'RECALLINQUEUE',0x17,_0x5b94('0x1fd')))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0x1fe')));}else{_0x11f8f5[_0x5b94('0xd8')](createObjHistory(_0xdbbbc4,_0x2e2871,_0x5b94('0x1ff'),0x16,_0x5b94('0x200')),_0x5b94('0x201'),_0x5b94('0x202'));}}}}else{_0xdbbbc4[_0x5b94('0x61')]+=0x1;_0x11f8f5[_0x5b94('0xd8')](createObjHistory(_0xdbbbc4,_0x2e2871,_0x5b94('0x203'),0xd,_0x5b94('0x204')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0x5b94('0x205');}};};Dialer[_0x5b94('0xb1')][_0x5b94('0x16b')]=function(_0x45a40f){var _0x2ed7ec=this;var _0x5bed02=_0x45a40f[_0x5b94('0x206')]-_0x45a40f[_0x5b94('0x71')]-_0x45a40f[_0x5b94('0xc9')];emitCampaignSummary(_0x45a40f);if(_0x5bed02>0x0){if(_0x5bed02>this['maxNumberOriginate']){_0x5bed02=this[_0x5b94('0x22')];}_0x45a40f[_0x5b94('0xc9')]+=_0x5bed02;this[_0x5b94('0xcb')](_0x45a40f['id'],_0x5bed02,_0x45a40f[_0x5b94('0x207')],_0x45a40f)[_0x5b94('0xbd')](function(_0x3414a6){_0x45a40f['temp']-=_0x5bed02;_0x45a40f[_0x5b94('0xc9')]=_0x45a40f[_0x5b94('0xc9')]>0x0?_0x45a40f[_0x5b94('0xc9')]:0x0;if(!checkContactEmpty(_0x3414a6)){_0x45a40f[_0x5b94('0x3e')]=_0x5b94('0xa3');logger['info']('[getContactCampaign2][Empty]'+_0x45a40f['name']);}else{_0x45a40f[_0x5b94('0x71')]+=_0x3414a6[_0x5b94('0x140')];_0x45a40f[_0x5b94('0x3e')]=_0x5b94('0x208');for(var _0x2c5c62=0x0;_0x2c5c62<_0x3414a6['length'];_0x2c5c62+=0x1){_0x45a40f[_0x5b94('0x209')]+=0x1;if(_[_0x5b94('0xb3')](_0x3414a6[_0x2c5c62])||_[_0x5b94('0xb3')](_0x3414a6[_0x2c5c62]['Contact'])||_['isNil'](_0x3414a6[_0x2c5c62][_0x5b94('0x17a')][_0x5b94('0x179')])){_0x2ed7ec[_0x5b94('0x20a')](_0x5b94('0x20b'),_0x45a40f,_0x3414a6[_0x2c5c62]);}else{_0x2ed7ec['checkIsBlackListIvr'](_['pick'](_0x3414a6[_0x2c5c62],[_0x5b94('0xdf'),_0x5b94('0x20c')]))[_0x5b94('0xbd')](_0x2ed7ec[_0x5b94('0x20d')](_0x45a40f,_0x3414a6[_0x2c5c62]))[_0x5b94('0xb6')](_0x2ed7ec[_0x5b94('0xd6')](_0x5b94('0x20e'),_0x45a40f));}}}})[_0x5b94('0xb6')](loggerGetContactDialer(_0x5b94('0x20f'),_0x45a40f,_0x5bed02));}};Dialer['prototype'][_0x5b94('0x168')]=function(_0x480474,_0x224b57){var _0x475317=this;var _0x247b1f=[];var _0x3c9813=_0x224b57>=0x1?_0x224b57:0x1;if(_0x480474[_0x5b94('0x5c')]===_0x5b94('0x167')){_0x3c9813=0x1;}var _0x4da25b=Math[_0x5b94('0x1f1')](_0x480474['available']*_0x3c9813)-_0x480474[_0x5b94('0x71')]-_0x480474[_0x5b94('0xc9')];emitVoiceQueueSummary(_0x480474);if(_0x480474[_0x5b94('0x210')]>0x0){var _0x53ed9e=_0x480474[_0x5b94('0x210')]-_0x480474['originated']-_0x480474[_0x5b94('0x56')]-_0x480474[_0x5b94('0xc9')]-_0x480474[_0x5b94('0x52')];if(_0x4da25b>_0x53ed9e){_0x4da25b=_0x53ed9e;}}if(_0x4da25b>0x0){if(_0x480474[_0x5b94('0x5c')]==='booked'){_0x4da25b=0x1;}if(_0x4da25b>this[_0x5b94('0x22')]){_0x4da25b=this[_0x5b94('0x22')];}_0x480474[_0x5b94('0xc9')]+=_0x4da25b;for(var _0x25e51d in this['agents']){if(typeof this[_0x5b94('0x20')][_0x25e51d]!==_0x5b94('0x9c')){if(this[_0x5b94('0x20')][_0x25e51d][_0x5b94('0xac')]===_0x5b94('0x211')&&this[_0x5b94('0x20')][_0x25e51d][_0x5b94('0xb5')]===_0x5b94('0xe5')){_0x247b1f[_0x5b94('0x136')](this['agents'][_0x25e51d]['id']);}}}this[_0x5b94('0xc8')](_0x480474['id'],_0x247b1f,_0x4da25b,_0x480474[_0x5b94('0x207')],_0x480474)['then'](function(_0x4d4489){_0x480474[_0x5b94('0xc9')]-=_0x4da25b;_0x480474[_0x5b94('0xc9')]=_0x480474['temp']>0x0?_0x480474[_0x5b94('0xc9')]:0x0;if(!checkContactEmpty(_0x4d4489)){_0x475317[_0x5b94('0xbb')](_0x480474)[_0x5b94('0xbd')](sendMessageReschedule(_0x480474))[_0x5b94('0xb6')](loggerCatch('[countReScheduled]\x20'));}else{_0x480474['originated']+=_0x4d4489[_0x5b94('0x140')];_0x480474[_0x5b94('0x3e')]=_0x480474[_0x5b94('0x5c')]==='booked'?_0x5b94('0x180'):_0x5b94('0x208');for(var _0x2a46f6=0x0;_0x2a46f6<_0x4d4489[_0x5b94('0x140')];_0x2a46f6+=0x1){if(_['isNil'](_0x4d4489[_0x2a46f6])||_[_0x5b94('0xb3')](_0x4d4489[_0x2a46f6][_0x5b94('0x17a')])||_[_0x5b94('0xb3')](_0x4d4489[_0x2a46f6][_0x5b94('0x17a')][_0x5b94('0x179')])){_0x475317[_0x5b94('0x20a')]('[actionOriginate]\x20',_0x480474,_0x4d4489[_0x2a46f6]);}else{_0x475317['checkIsBlackList'](_[_0x5b94('0xda')](_0x4d4489[_0x2a46f6],[_0x5b94('0xde'),_0x5b94('0x20c')]))[_0x5b94('0xbd')](_0x475317[_0x5b94('0x20d')](_0x480474,_0x4d4489[_0x2a46f6]))[_0x5b94('0xb6')](_0x475317['loggerHandler']('[actionOriginate]\x20',_0x480474));}}}})[_0x5b94('0xb6')](loggerGetContactDialer('[getContactDialer2]',_0x480474,_0x4da25b));}};Dialer['prototype'][_0x5b94('0x94')]=function(_0x18a0a5){if(_0x18a0a5[_0x5b94('0x210')]>0x0){var _0x48cf1e=_0x18a0a5[_0x5b94('0x210')]-_0x18a0a5[_0x5b94('0x71')]-_0x18a0a5[_0x5b94('0x56')];if(_0x48cf1e>0x0){this[_0x5b94('0x212')](_0x18a0a5);}else{loggerPredictiveCalls[_0x5b94('0x81')](_0x5b94('0x213'));}}else{this[_0x5b94('0x212')](_0x18a0a5);}};Dialer['prototype']['tryOriginatePredictive']=function(_0x17f415){var _0x34736c=this;var _0x5586f9=[];_0x17f415['originated']+=0x1;for(var _0x4a4b7c in this[_0x5b94('0x20')]){if(typeof this[_0x5b94('0x20')][_0x4a4b7c]!==_0x5b94('0x9c')){if(this[_0x5b94('0x20')][_0x4a4b7c][_0x5b94('0xac')]===_0x5b94('0x211')&&this['agents'][_0x4a4b7c]['status']===_0x5b94('0xe5')){_0x5586f9[_0x5b94('0x136')](this['agents'][_0x4a4b7c]['id']);}}}this[_0x5b94('0xc8')](_0x17f415['id'],_0x5586f9,0x1,_0x17f415['dialOrderByScheduledAt'],_0x17f415)['then'](function(_0x5d2283){if(!checkContactEmpty(_0x5d2283)){checkContactLowerLimitOriginate(_0x17f415,0x1,0x0);_0x34736c['countReScheduled'](_0x17f415)[_0x5b94('0xbd')](sendMessageReschedule(_0x17f415))[_0x5b94('0xb6')](loggerCatch(_0x5b94('0xbe')));}else{_0x17f415['message']=_0x5b94('0x208');if(_[_0x5b94('0xb3')](_0x5d2283[0x0])||_[_0x5b94('0xb3')](_0x5d2283[0x0][_0x5b94('0x17a')])||_[_0x5b94('0xb3')](_0x5d2283[0x0]['Contact'][_0x5b94('0x179')])){_0x34736c[_0x5b94('0x20a')](_0x5b94('0x20b'),_0x17f415,_0x5d2283[0x0]);}else{_0x34736c['checkIsBlackList'](_['pick'](_0x5d2283[0x0],[_0x5b94('0xde'),_0x5b94('0x20c')]))['then'](_0x34736c[_0x5b94('0x20d')](_0x17f415,_0x5d2283[0x0]))[_0x5b94('0xb6')](_0x34736c[_0x5b94('0xd6')](_0x5b94('0x214'),_0x17f415));}}})[_0x5b94('0xb6')](loggerGetContactDialer(_0x5b94('0x215'),_0x17f415,0x1));emitVoiceQueueSummary(_0x17f415);};Dialer[_0x5b94('0xb1')]['abandonmentRate']=function(_0xbddd48,_0x5d1fe2,_0x19f281,_0x292e02,_0x2d2ddc,_0x50d51c){loggerPredictive[_0x5b94('0x81')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x5b94('0x81')](_0x5b94('0x216'),_0xbddd48);loggerPredictive[_0x5b94('0x81')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d1fe2);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x217'),_0x19f281);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x218'),_0x292e02);loggerPredictive['info']('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2d2ddc);loggerPredictive[_0x5b94('0x81')]('---------------------------');return new BPromise(function(_0x114f1b,_0x10f98c){if(_0xbddd48<=0x0||isNaN(_0xbddd48)){return _0x10f98c(msgResponse('[abandonmentRate]',_0x5b94('0x1a3'),_0x5b94('0x219')+_0xbddd48));}if(_0x19f281<=0x0||isNaN(_0x19f281)){return _0x10f98c(msgResponse('[abandonmentRate]',_0x5b94('0x1a3'),'Ts\x20=\x20'+_0x19f281));}if(_0x292e02<=0x0||isNaN(_0x292e02)){return _0x10f98c(msgResponse(_0x5b94('0x21a'),_0x5b94('0x1a3'),_0x5b94('0x21b')+_0x292e02));}if(_0x5d1fe2<=0x0||isNaN(_0x5d1fe2)){return _0x10f98c(msgResponse(_0x5b94('0x21a'),_0x5b94('0x1a3'),_0x5b94('0x21c')+_0x5d1fe2));}if(_0x2d2ddc<=0x0||isNaN(_0x2d2ddc)){return _0x10f98c(msgResponse(_0x5b94('0x21a'),'Error','Amax\x20=\x20'+_0x2d2ddc));}_0x50d51c=_0x50d51c||0x0;var _0x441495=0x1/_0x19f281;var _0x4ab9ba=0x0;var _0x2a5668=0x0;var _0x1a8474=0x0;var _0x5c1b5d=0x0;for(var _0x2494c6=0x0;_0x1a8474<_0x2d2ddc;_0x2494c6+=0x1){_0x2a5668=_0x2494c6/_0x5d1fe2;_0x4ab9ba=(_0x292e02*_0x2a5668+_0x50d51c)/_0x441495;_0x1a8474=erlangb(_0x4ab9ba,_0xbddd48);_0x5c1b5d=_0x4ab9ba/_0xbddd48*(0x1-erlangb(_0x4ab9ba,_0xbddd48));}return _0x114f1b({'erlangCalls':_0x2494c6,'erlangCallToSecond':_0x5d1fe2/_0x2494c6,'erlangAbandonmentRate':_0x1a8474,'erlangBusyFactor':_0x5c1b5d});});};Dialer[_0x5b94('0xb1')][_0x5b94('0x1f0')]=function(_0x239294,_0x4f4b4c,_0x35982f,_0x24e913,_0x5b729f,_0x4a4404){loggerPredictive[_0x5b94('0x81')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x5b94('0x81')](_0x5b94('0x216'),_0x239294);loggerPredictive[_0x5b94('0x81')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4f4b4c);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x217'),_0x35982f);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x218'),_0x24e913);loggerPredictive[_0x5b94('0x81')](_0x5b94('0x21d'),_0x5b729f);loggerPredictive['info']('---------------------------');return new BPromise(function(_0x5907c8,_0x553725){if(_0x239294<=0x0||isNaN(_0x239294)){return _0x553725(msgResponse(_0x5b94('0x21e'),'Error',_0x5b94('0x219')+_0x239294));}if(_0x35982f<=0x0||isNaN(_0x35982f)){return _0x553725(msgResponse(_0x5b94('0x21e'),_0x5b94('0x1a3'),_0x5b94('0x21f')+_0x35982f));}if(_0x24e913<=0x0||isNaN(_0x24e913)){return _0x553725(msgResponse(_0x5b94('0x21e'),'Error',_0x5b94('0x21b')+_0x24e913));}if(_0x4f4b4c<=0x0||isNaN(_0x4f4b4c)){return _0x553725(msgResponse(_0x5b94('0x21e'),_0x5b94('0x1a3'),_0x5b94('0x21c')+_0x4f4b4c));}if(_0x5b729f<=0x0||isNaN(_0x5b729f)){return _0x553725(msgResponse(_0x5b94('0x21e'),'Error',_0x5b94('0x220')+_0x5b729f));}_0x4a4404=_0x4a4404||0x0;var _0x5bd8d6=0x1/_0x35982f;var _0x162c38=0x0;var _0xe8d8da=0x0;var _0x293546=0x0;var _0x4ccd70=0x0;for(var _0x3b7058=0x0;_0x4ccd70<_0x5b729f;_0x3b7058+=0x1){_0xe8d8da=_0x3b7058/_0x4f4b4c;_0x162c38=(_0x24e913*_0xe8d8da+_0x4a4404)/_0x5bd8d6;_0x293546=erlangb(_0x162c38,_0x239294);_0x4ccd70=_0x162c38/_0x239294*(0x1-erlangb(_0x162c38,_0x239294));}return _0x5907c8({'erlangCalls':_0x3b7058,'erlangCallToSecond':_0x4f4b4c/_0x3b7058,'erlangAbandonmentRate':_0x293546,'erlangBusyFactor':_0x4ccd70});});};module[_0x5b94('0x221')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 5ce4859..bf35bf7 100644 --- a/server/services/ami/dialer/queueCallerAbandon.js +++ b/server/services/ami/dialer/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6c2c=['starttime','responsetime','droptime','ringtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','name','calleridnum','number'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6c2c,0x8e));var _0xc6c2=function(_0x1c1b71,_0x35e844){_0x1c1b71=_0x1c1b71-0x0;var _0x374a55=_0x6c2c[_0x1c1b71];return _0x374a55;};'use strict';var util=require(_0xc6c2('0x0'));var _=require(_0xc6c2('0x1'));var moment=require(_0xc6c2('0x2'));function getSeconds(_0x1b1d8a,_0x36e39e){var _0x584f5e=moment(_0x1b1d8a)['milliseconds'](0x0);var _0x15ee80=moment(_0x36e39e)[_0xc6c2('0x3')](0x0);return _0x584f5e[_0xc6c2('0x4')](_0x15ee80,_0xc6c2('0x5'));}function QueueCallerAbandon(_0x1232a7,_0x3d9845){this[_0xc6c2('0x6')]=_0x1232a7['scheduledat'];this[_0xc6c2('0x7')]=_0x1232a7[_0xc6c2('0x7')];this[_0xc6c2('0x8')]=_0x1232a7[_0xc6c2('0x7')]==='outbound'?_0xc6c2('0x9'):_0x1232a7[_0xc6c2('0x7')];this[_0xc6c2('0xa')]=_0x1232a7[_0xc6c2('0xa')];this['countcongestionretry']=_0x1232a7[_0xc6c2('0xb')];this['countnoanswerretry']=_0x1232a7[_0xc6c2('0xc')];this['countglobal']=_0x1232a7[_0xc6c2('0xa')]+_0x1232a7[_0xc6c2('0xb')]+_0x1232a7[_0xc6c2('0xc')]+_0x1232a7[_0xc6c2('0xd')]+_0x1232a7[_0xc6c2('0xe')]+_0x1232a7['countabandonedretry']+_0x1232a7[_0xc6c2('0xf')]+_0x1232a7[_0xc6c2('0x10')];this['countnosuchnumberretry']=_0x1232a7[_0xc6c2('0xd')];this['countdropretry']=_0x1232a7['countdropretry'];this[_0xc6c2('0x11')]=_0x1232a7[_0xc6c2('0x11')];this[_0xc6c2('0xf')]=_0x1232a7[_0xc6c2('0xf')];this[_0xc6c2('0x10')]=_0x1232a7[_0xc6c2('0x10')];this['uniqueid']=_0x3d9845['uniqueid'];this[_0xc6c2('0x12')]=_0x1232a7[_0xc6c2('0x13')];this[_0xc6c2('0x14')]=_0x1232a7[_0xc6c2('0x15')];this['starttime']=_0x1232a7[_0xc6c2('0x16')];this[_0xc6c2('0x17')]=_0x1232a7[_0xc6c2('0x17')];this[_0xc6c2('0x18')]=_0x1232a7[_0xc6c2('0x18')];this['endtime']=this[_0xc6c2('0x18')];this[_0xc6c2('0x19')]=getSeconds(_0x1232a7['responsetime'],_0x1232a7['starttime']);this['holdtime']=getSeconds(this[_0xc6c2('0x18')],_0x1232a7[_0xc6c2('0x17')]);this[_0xc6c2('0x1a')]=0x0;this['queue']=_0x3d9845[_0xc6c2('0x9')];this['membername']=_0x3d9845[_0xc6c2('0x1b')];this[_0xc6c2('0x1c')]=_0x3d9845[_0xc6c2('0x1c')];this[_0xc6c2('0x1d')]=_0x1232a7[_0xc6c2('0x1d')];this['callbackuniqueid']=_0x1232a7[_0xc6c2('0x1e')];this[_0xc6c2('0x1f')]=_0x1232a7[_0xc6c2('0x1f')];this[_0xc6c2('0x20')]=_0x1232a7[_0xc6c2('0x20')];this['ContactId']=_0x1232a7[_0xc6c2('0x21')];this['ListId']=_0x1232a7[_0xc6c2('0x22')];this[_0xc6c2('0x23')]=_0x1232a7['UserId'];this[_0xc6c2('0x24')]=_0x1232a7[_0xc6c2('0x24')];this['CampaignId']=_0x1232a7[_0xc6c2('0x25')];this[_0xc6c2('0x26')]=_0x1232a7[_0xc6c2('0x26')]||'';this[_0xc6c2('0x27')]=_0x1232a7[_0xc6c2('0x27')]||'';}module[_0xc6c2('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0xf230=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','endtime','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry'];(function(_0x106e73,_0x33b83c){var _0x49b4a5=function(_0x468db1){while(--_0x468db1){_0x106e73['push'](_0x106e73['shift']());}};_0x49b4a5(++_0x33b83c);}(_0xf230,0xea));var _0x0f23=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf230[_0x2641f9];return _0x585741;};'use strict';var util=require(_0x0f23('0x0'));var _=require(_0x0f23('0x1'));var moment=require(_0x0f23('0x2'));function getSeconds(_0x7325b6,_0x1e51f5){var _0x521bf4=moment(_0x7325b6)['milliseconds'](0x0);var _0x16b060=moment(_0x1e51f5)[_0x0f23('0x3')](0x0);return _0x521bf4[_0x0f23('0x4')](_0x16b060,'seconds');}function QueueCallerAbandon(_0x3e657f,_0x5c78cf){this['scheduledat']=_0x3e657f[_0x0f23('0x5')];this['type']=_0x3e657f[_0x0f23('0x6')];this['campaigntype']=_0x3e657f[_0x0f23('0x6')]===_0x0f23('0x7')?_0x0f23('0x8'):_0x3e657f[_0x0f23('0x6')];this['countbusyretry']=_0x3e657f[_0x0f23('0x9')];this['countcongestionretry']=_0x3e657f[_0x0f23('0xa')];this[_0x0f23('0xb')]=_0x3e657f['countnoanswerretry'];this['countglobal']=_0x3e657f[_0x0f23('0x9')]+_0x3e657f[_0x0f23('0xa')]+_0x3e657f[_0x0f23('0xb')]+_0x3e657f[_0x0f23('0xc')]+_0x3e657f['countdropretry']+_0x3e657f[_0x0f23('0xd')]+_0x3e657f[_0x0f23('0xe')]+_0x3e657f[_0x0f23('0xf')];this[_0x0f23('0xc')]=_0x3e657f[_0x0f23('0xc')];this[_0x0f23('0x10')]=_0x3e657f[_0x0f23('0x10')];this[_0x0f23('0xd')]=_0x3e657f[_0x0f23('0xd')];this[_0x0f23('0xe')]=_0x3e657f[_0x0f23('0xe')];this[_0x0f23('0xf')]=_0x3e657f['countagentrejectretry'];this[_0x0f23('0x11')]=_0x5c78cf[_0x0f23('0x11')];this['calleridname']=_0x3e657f[_0x0f23('0x12')];this[_0x0f23('0x13')]=_0x3e657f[_0x0f23('0x14')];this[_0x0f23('0x15')]=_0x3e657f['starttime'];this[_0x0f23('0x16')]=_0x3e657f[_0x0f23('0x16')];this[_0x0f23('0x17')]=_0x3e657f[_0x0f23('0x17')];this[_0x0f23('0x18')]=this[_0x0f23('0x17')];this['ringtime']=getSeconds(_0x3e657f[_0x0f23('0x16')],_0x3e657f[_0x0f23('0x15')]);this[_0x0f23('0x19')]=getSeconds(this[_0x0f23('0x17')],_0x3e657f['responsetime']);this[_0x0f23('0x1a')]=0x0;this[_0x0f23('0x8')]=_0x5c78cf[_0x0f23('0x8')];this[_0x0f23('0x1b')]=_0x5c78cf[_0x0f23('0x1c')];this[_0x0f23('0x1d')]=_0x5c78cf[_0x0f23('0x1d')];this[_0x0f23('0x1e')]=_0x3e657f['callback'];this['callbackuniqueid']=_0x3e657f[_0x0f23('0x1f')];this[_0x0f23('0x20')]=_0x3e657f[_0x0f23('0x20')];this[_0x0f23('0x21')]=_0x3e657f[_0x0f23('0x21')];this[_0x0f23('0x22')]=_0x3e657f[_0x0f23('0x22')];this[_0x0f23('0x23')]=_0x3e657f[_0x0f23('0x23')];this[_0x0f23('0x24')]=_0x3e657f[_0x0f23('0x24')];this[_0x0f23('0x25')]=_0x3e657f[_0x0f23('0x25')];this[_0x0f23('0x26')]=_0x3e657f[_0x0f23('0x26')];this[_0x0f23('0x27')]=_0x3e657f[_0x0f23('0x27')]||'';this['originatecalleridname']=_0x3e657f[_0x0f23('0x28')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index da033bd..6e8c333 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(_0x3fdcb6,_0x3b889a){var _0x28ffed=function(_0xb6cfa9){while(--_0xb6cfa9){_0x3fdcb6['push'](_0x3fdcb6['shift']());}};_0x28ffed(++_0x3b889a);}(_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 +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5bdf36,_0xe04a7b){var _0x529d0f=function(_0x18e087){while(--_0x18e087){_0x5bdf36['push'](_0x5bdf36['shift']());}};_0x529d0f(++_0xe04a7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 fdb3914..db20a6b 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 _0xdff4=['%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','addVariables','ext','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','../rpc/faxAccount','faxAccounts','trunks','actions','bind','syncVarSet','newstate','syncNewState','newexten','syncNewExten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','channel','uniqueid','name','channels','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','application/pdf','then','notify','.pdf','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','update','AttachmentId','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]','syncHangup','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute'];(function(_0x4d29e7,_0x469ad3){var _0x419812=function(_0x2b9a9d){while(--_0x2b9a9d){_0x4d29e7['push'](_0x4d29e7['shift']());}};_0x419812(++_0x469ad3);}(_0xdff4,0x1d2));var _0x4dff=function(_0x2fc2a9,_0x5a4c89){_0x2fc2a9=_0x2fc2a9-0x0;var _0x41f799=_0xdff4[_0x2fc2a9];return _0x41f799;};'use strict';var util=require(_0x4dff('0x0'));var _=require(_0x4dff('0x1'));var BPromise=require('bluebird');var uuid=require(_0x4dff('0x2'));var moment=require('moment');var path=require(_0x4dff('0x3'));var tiff2pdf=require(_0x4dff('0x4'));var gs=require(_0x4dff('0x5'));var logger=require(_0x4dff('0x6'))(_0x4dff('0x7'));var ami=require(_0x4dff('0x8'));var rpcDb=require(_0x4dff('0x9'));var Channel=require(_0x4dff('0xa'));var ut=require('./util/util');var Action=require('./action');var faxAccount=require(_0x4dff('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require('../rpc/faxMessage');function Fax(_0x22b29e){this['channels']={};this[_0x4dff('0xc')]=_0x22b29e[_0x4dff('0xc')];this[_0x4dff('0xd')]=_0x22b29e['trunks'];this[_0x4dff('0xe')]={};ami['on']('newchannel',this['syncNewchannel'][_0x4dff('0xf')](this));ami['on']('varset',this[_0x4dff('0x10')]['bind'](this));ami['on'](_0x4dff('0x11'),this[_0x4dff('0x12')]['bind'](this));ami['on'](_0x4dff('0x13'),this[_0x4dff('0x14')][_0x4dff('0xf')](this));ami['on']('faxstatus',this[_0x4dff('0x15')][_0x4dff('0xf')](this));ami['on'](_0x4dff('0x16'),this[_0x4dff('0x17')]['bind'](this));ami['on'](_0x4dff('0x18'),this['syncHangup'][_0x4dff('0xf')](this));ami['on']('originateresponse',this[_0x4dff('0x19')]['bind'](this));}Fax[_0x4dff('0x1a')]['syncNewchannel']=function(_0x512e06){if(_0x512e06[_0x4dff('0x1b')]==='from-voip-provider'){for(var _0x31edf3 in this[_0x4dff('0xc')]){if(this[_0x4dff('0xc')][_0x4dff('0x1c')](_0x31edf3)){if(_0x512e06[_0x4dff('0x1d')]===this['faxAccounts'][_0x31edf3][_0x4dff('0x1e')]){this['channels'][_0x512e06['uniqueid']]={};this['channels'][_0x512e06['uniqueid']][_0x4dff('0x1f')]=_0x512e06[_0x4dff('0x1f')];this['channels'][_0x512e06[_0x4dff('0x20')]]['id']=this[_0x4dff('0xc')][_0x31edf3]['id'];this['channels'][_0x512e06['uniqueid']][_0x4dff('0x21')]=this[_0x4dff('0xc')][_0x31edf3]['name'];logger['info'](_0x512e06[_0x4dff('0x20')],'\x20syncNewchannel\x20');}}}}if(this[_0x4dff('0xe')][_0x512e06[_0x4dff('0x20')]]){this[_0x4dff('0x22')][_0x512e06[_0x4dff('0x20')]]={};this[_0x4dff('0x22')][_0x512e06['uniqueid']][_0x4dff('0x1f')]=_0x512e06[_0x4dff('0x1f')];logger[_0x4dff('0x23')](_0x512e06[_0x4dff('0x20')],_0x4dff('0x24'));}};Fax[_0x4dff('0x1a')]['syncVarSet']=function(_0x4d37a7){if(this[_0x4dff('0x22')][_0x4d37a7[_0x4dff('0x20')]]){for(var _0x4d1f59 in _0x4d37a7[_0x4dff('0x25')]){if(_0x4d37a7[_0x4dff('0x25')][_0x4dff('0x1c')](_0x4d1f59)){this['channels'][_0x4d37a7[_0x4dff('0x20')]][_0x4d1f59]=_0x4d37a7[_0x4dff('0x26')];}}}};Fax['prototype'][_0x4dff('0x12')]=function(_0x4bc85f){if(this[_0x4dff('0x22')][_0x4bc85f[_0x4dff('0x20')]]){this[_0x4dff('0x22')][_0x4bc85f['uniqueid']][_0x4dff('0x27')]=_0x4bc85f[_0x4dff('0x27')];this[_0x4dff('0x22')][_0x4bc85f['uniqueid']]['channelstatedesc']=_0x4bc85f[_0x4dff('0x28')];}};Fax[_0x4dff('0x1a')]['syncNewExten']=function(_0x2a8cfb){if(this['channels'][_0x2a8cfb['uniqueid']]){for(var _0x23c39a in _0x2a8cfb['variable']){if(_0x2a8cfb['variable'][_0x4dff('0x1c')](_0x23c39a)){this[_0x4dff('0x22')][_0x2a8cfb['uniqueid']][_0x23c39a]=_0x2a8cfb[_0x4dff('0x26')];}}}};Fax[_0x4dff('0x1a')][_0x4dff('0x15')]=function(_0x3cd315){if(this[_0x4dff('0x22')][_0x3cd315[_0x4dff('0x20')]]){this['channels'][_0x3cd315[_0x4dff('0x20')]]['operation']=_0x3cd315[_0x4dff('0x29')];this[_0x4dff('0x22')][_0x3cd315[_0x4dff('0x20')]][_0x4dff('0x2a')]=_0x3cd315[_0x4dff('0x2a')];this[_0x4dff('0x22')][_0x3cd315[_0x4dff('0x20')]]['localstationid']=_0x3cd315['localstationid'];this['channels'][_0x3cd315['uniqueid']][_0x4dff('0x2b')]=_0x3cd315[_0x4dff('0x2b')];logger['info'](_0x3cd315[_0x4dff('0x20')],_0x4dff('0x2c'));}};Fax[_0x4dff('0x1a')][_0x4dff('0x17')]=function(_0x2cd875){var _0x1a5241=this;if(this['channels'][_0x2cd875[_0x4dff('0x20')]]){var _0x4f6de5=this[_0x4dff('0x22')][_0x2cd875['uniqueid']]['id'];this[_0x4dff('0x22')][_0x2cd875[_0x4dff('0x20')]]['remotestationid']=_0x2cd875['remotestationid'];this[_0x4dff('0x22')][_0x2cd875[_0x4dff('0x20')]][_0x4dff('0x2d')]=_0x2cd875[_0x4dff('0x2d')];this[_0x4dff('0x22')][_0x2cd875[_0x4dff('0x20')]][_0x4dff('0x1e')]=_0x2cd875[_0x4dff('0x1e')];this[_0x4dff('0x22')][_0x2cd875['uniqueid']][_0x4dff('0x2e')]=_0x2cd875[_0x4dff('0x2e')];this['channels'][_0x2cd875[_0x4dff('0x20')]][_0x4dff('0x2f')]=_0x2cd875['transferrate'];this[_0x4dff('0x22')][_0x2cd875[_0x4dff('0x20')]][_0x4dff('0x2b')]=_0x2cd875[_0x4dff('0x2b')];this['channels'][_0x2cd875['uniqueid']]['calleridnum']=_0x2cd875['calleridnum'];if(this[_0x4dff('0x22')][_0x2cd875[_0x4dff('0x20')]][_0x4dff('0x2d')]>0x0){tiff2pdf(_0x2cd875[_0x4dff('0x2b')],_0x4dff('0x30'),function(_0x2a8a4d){logger[_0x4dff('0x23')](_0x2cd875['uniqueid'],_0x4dff('0x31'),_0x2a8a4d['message']);attachment[_0x4dff('0x32')]({'name':path['parse'](_0x2cd875[_0x4dff('0x2b')])['name'],'basename':path[_0x4dff('0x33')](_0x2cd875[_0x4dff('0x2b')])[_0x4dff('0x21')]+'.pdf','type':_0x4dff('0x34')})[_0x4dff('0x35')](function(_0xffa434){faxAccount[_0x4dff('0x36')](_0x4f6de5,{'from':_0x2cd875['calleridnum'],'mapKey':'fax','body':path[_0x4dff('0x33')](_0x2cd875[_0x4dff('0x2b')])[_0x4dff('0x21')]+_0x4dff('0x37'),'AttachmentId':_0xffa434['id']})[_0x4dff('0x38')](function(_0x236196){logger[_0x4dff('0x39')](_0x2cd875[_0x4dff('0x20')],_0x4dff('0x3a'),JSON[_0x4dff('0x3b')](_0x236196));});})[_0x4dff('0x38')](function(_0x4f890a){logger[_0x4dff('0x39')](_0x2cd875[_0x4dff('0x20')],_0x4dff('0x3c'),JSON['stringify'](_0x4f890a));});});}logger['info'](_0x2cd875[_0x4dff('0x20')],_0x4dff('0x3c'));}};Fax[_0x4dff('0x1a')][_0x4dff('0x19')]=function(_0x2862a8){if(this['actions'][_0x2862a8['uniqueid']]){_['merge'](this[_0x4dff('0x22')][_0x2862a8[_0x4dff('0x20')]],_[_0x4dff('0x3d')](_0x2862a8,[_0x4dff('0x3e'),_0x4dff('0x3f')]));}};function updateStatus(_0x4d6b61){if(_0x4d6b61['AttachmentId']){faxMessage[_0x4dff('0x40')](_0x4d6b61[_0x4dff('0x41')],{'failMessage':_0x4dff('0x42')})[_0x4dff('0x35')](function(_0x5f1df0){ut[_0x4dff('0x43')](_0x4dff('0x44'),_0x5f1df0);})[_0x4dff('0x38')](function(_0x4ec051){ut[_0x4dff('0x43')](_0x4dff('0x45'),_0x4ec051);});}else{ut[_0x4dff('0x43')](_0x4dff('0x46'));}}Fax[_0x4dff('0x1a')][_0x4dff('0x47')]=function(_0x14e836,_0x432f97,_0x348a74){var _0xef5171=this;var _0x4ea0f4={};if(_0x432f97){_0x4ea0f4={'read':_0x432f97};}else{_0x4ea0f4={'failMessage':_0x348a74};}if(this[_0x4dff('0xe')][_0x14e836][_0x4dff('0x41')]){faxMessage[_0x4dff('0x40')](this['actions'][_0x14e836][_0x4dff('0x41')],_0x4ea0f4)[_0x4dff('0x35')](function(_0x2de120){ut[_0x4dff('0x43')](_0x4dff('0x48'),_0x2de120);})[_0x4dff('0x38')](function(_0x4e7991){ut[_0x4dff('0x43')](_0x4dff('0x49'),_0x4e7991);})[_0x4dff('0x4a')](function(){delete _0xef5171[_0x4dff('0x22')][_0x14e836];delete _0xef5171[_0x4dff('0xe')][_0x14e836];});}else{ut[_0x4dff('0x43')](_0x4dff('0x4b'));delete this['channels'][_0x14e836];delete this[_0x4dff('0xe')][_0x14e836];}};Fax['prototype'][_0x4dff('0x4c')]=function(_0x56eb27){var _0x5eade9=this;if(this[_0x4dff('0x22')][_0x56eb27[_0x4dff('0x20')]]){if(this[_0x4dff('0xe')][_0x56eb27[_0x4dff('0x20')]]){this[_0x4dff('0x22')][_0x56eb27[_0x4dff('0x20')]]['id']=this[_0x4dff('0xe')][_0x56eb27[_0x4dff('0x20')]]['id'];this[_0x4dff('0x22')][_0x56eb27[_0x4dff('0x20')]][_0x4dff('0x21')]=this[_0x4dff('0xe')][_0x56eb27[_0x4dff('0x20')]][_0x4dff('0x21')];}logger['info'](_0x56eb27[_0x4dff('0x20')],this[_0x4dff('0xe')][_0x56eb27[_0x4dff('0x20')]]?_0x4dff('0x4d'):'\x20hangup\x20faxRiceive\x20',JSON[_0x4dff('0x3b')](this[_0x4dff('0x22')][_0x56eb27[_0x4dff('0x20')]]));if(this['actions'][_0x56eb27['uniqueid']]){if(this[_0x4dff('0x22')][_0x56eb27['uniqueid']][_0x4dff('0x4e')]>0x0&&this[_0x4dff('0x22')][_0x56eb27['uniqueid']]['faxstatus']===_0x4dff('0x4f')){this[_0x4dff('0x47')](_0x56eb27['uniqueid'],!![]);}else{this[_0x4dff('0x47')](_0x56eb27[_0x4dff('0x20')],![],this['channels'][_0x56eb27['uniqueid']]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this[_0x4dff('0x22')][_0x56eb27[_0x4dff('0x20')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax['prototype'][_0x4dff('0x50')]=function(_0xf331d8){var _0x3079dc=this;return new BPromise(function(_0x10b4fa,_0x1178a3){_0x3079dc[_0x4dff('0x51')](_0xf331d8,_0x3079dc['faxAccounts'][_0xf331d8['FaxAccountId']])[_0x4dff('0x35')](function(_0x147aff){ut['logger'](_0x4dff('0x52'),_0x147aff);_0x10b4fa(ut[_0x4dff('0x53')](_0x4dff('0x54')));})[_0x4dff('0x38')](function(_0x3e273f){ut[_0x4dff('0x43')](_0x4dff('0x55'),_0x3e273f);updateStatus(_0xf331d8);_0x1178a3(ut[_0x4dff('0x53')]('Fax\x20failed'));});});};Fax[_0x4dff('0x1a')][_0x4dff('0x56')]=function(_0x168bf6){var _0x487775=this;return new BPromise(function(_0x4fb038,_0x28e899){var _0x160f0c=_0x487775[_0x4dff('0x57')](_0x487775[_0x4dff('0xc')][_0x168bf6[_0x4dff('0x58')]]['Trunk'],_0x168bf6);if(_0x160f0c[_0x4dff('0x59')]){_0x4fb038(ut['message'](_0x4dff('0x5a')));}else{_0x28e899(ut[_0x4dff('0x53')](_0x160f0c[_0x4dff('0x53')]));}});};function originate(_0x3a8553,_0x4cfeab,_0xa5f597){return new BPromise(function(_0x40f992,_0x46a6bb){if(_0xa5f597){var _0x228a11=util[_0x4dff('0x5b')](_0x4dff('0x5c'),path[_0x4dff('0x33')](_0x3a8553[_0x4dff('0x3')])[_0x4dff('0x21')],_0x3a8553[_0x4dff('0x3')]);gs[_0x4dff('0x5d')](_0x228a11)[_0x4dff('0x35')](function(){_0x3a8553[_0x4dff('0x3')]=util['format'](_0x4dff('0x5e'),path[_0x4dff('0x33')](_0x3a8553[_0x4dff('0x3')])[_0x4dff('0x5f')],path[_0x4dff('0x33')](_0x3a8553[_0x4dff('0x3')])[_0x4dff('0x21')]);_0x4cfeab[_0x4dff('0x60')]=_0x3a8553[_0x4dff('0x3')];ut[_0x4dff('0x43')](_0x4dff('0x61'),'');ami[_0x4dff('0x62')](ut['variablesAction'](_0x3a8553,_0x4cfeab))[_0x4dff('0x35')](function(_0x3763b6){_0x40f992(_0x3763b6);})['catch'](function(_0x27d250){_0x46a6bb(_0x27d250);});})['catch'](function(_0x22b2e2){_0x46a6bb(_0x22b2e2);});}else{ami['Action'](ut['variablesAction'](_0x3a8553,_0x4cfeab))[_0x4dff('0x35')](function(_0x5b4280){_0x40f992(_0x5b4280);})[_0x4dff('0x38')](function(_0x37a60e){_0x46a6bb(_0x37a60e);});}});}Fax[_0x4dff('0x1a')]['execOriginate']=function(_0x40ec39,_0x3b6aa4){var _0x535183=this;return new BPromise(function(_0x4ec591,_0x4b9612){var _0xf90a96=uuid['v4']();var _0x36ed39=ut[_0x4dff('0x63')](_0x40ec39,_0x3b6aa4);_0x535183[_0x4dff('0xe')][_0xf90a96]=new Action(_0xf90a96,_0x3b6aa4,_0x40ec39);var _0x2c49b0=_0x535183[_0x4dff('0xe')][_0xf90a96];if(path[_0x4dff('0x33')](_0x40ec39['path'])[_0x4dff('0x64')]===_0x4dff('0x37')){originate(_0x2c49b0,_0x36ed39,!![])[_0x4dff('0x35')](function(_0x36a34f){_0x4ec591(_0x36a34f);})[_0x4dff('0x38')](function(_0x323dd1){_0x4b9612(_0x323dd1);});}else{originate(_0x2c49b0,_0x36ed39,![])[_0x4dff('0x35')](function(_0x184666){_0x4ec591(_0x184666);})[_0x4dff('0x38')](function(_0x2efad8){_0x4b9612(_0x2efad8);});}});};Fax[_0x4dff('0x1a')]['isTrunkReachable']=function(_0x4638bc){return!_[_0x4dff('0x65')](_0x4638bc)&&!_[_0x4dff('0x65')](_0x4638bc[_0x4dff('0x21')])&&!_[_0x4dff('0x65')](_0x4638bc[_0x4dff('0x66')])&&_0x4638bc[_0x4dff('0x66')]&&!_[_0x4dff('0x65')](this[_0x4dff('0xd')][util[_0x4dff('0x5b')](_0x4dff('0x67'),_0x4638bc[_0x4dff('0x21')])])&&!_[_0x4dff('0x65')](this['trunks'][util['format']('SIP/%s',_0x4638bc[_0x4dff('0x21')])][_0x4dff('0x2a')])&&(this[_0x4dff('0xd')][util['format'](_0x4dff('0x67'),_0x4638bc[_0x4dff('0x21')])][_0x4dff('0x2a')]===_0x4dff('0x68')||this['trunks'][util['format'](_0x4dff('0x67'),_0x4638bc[_0x4dff('0x21')])][_0x4dff('0x2a')]===_0x4dff('0x69'));};Fax['prototype'][_0x4dff('0x57')]=function(_0x450b65,_0x20dfd7){if(!this['isTrunkReachable'](_0x450b65)){ut[_0x4dff('0x43')](_0x4dff('0x6a'),_['isNil'](_0x450b65)?'':_0x450b65[_0x4dff('0x21')]+_0x4dff('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x4dff('0x65')](_0x20dfd7[_0x4dff('0x7')])){ut[_0x4dff('0x43')](_0x4dff('0x6c'),JSON[_0x4dff('0x3b')](_0x20dfd7));return{'isValid':![],'message':_0x4dff('0x6d')};}if(_[_0x4dff('0x65')](_0x20dfd7['path'])){ut[_0x4dff('0x43')](_0x4dff('0x6e'),JSON[_0x4dff('0x3b')](_0x20dfd7));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x4dff('0x6f')]=Fax; \ No newline at end of file +var _0x6168=['Is\x20Valid','util','lodash','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','newstate','syncNewState','bind','newexten','faxstatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','context','from-voip-provider','exten','channels','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','value','prototype','channelstate','syncNewExten','hasOwnProperty','operation','status','localstationid','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','filename','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','notify','.pdf','catch','error','\x20notify\x20','stringify','syncOriginateResponse','pick','response','reason','update','AttachmentId','then','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','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','checkTrunk','\x20Trunk\x20is\x20not\x20active','Empty\x20Fax'];(function(_0x2a8ee4,_0x2ee5a9){var _0x1d00f0=function(_0x2b4a5b){while(--_0x2b4a5b){_0x2a8ee4['push'](_0x2a8ee4['shift']());}};_0x1d00f0(++_0x2ee5a9);}(_0x6168,0x72));var _0x8616=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x6168[_0x178e48];return _0x440d7e;};'use strict';var util=require(_0x8616('0x0'));var _=require(_0x8616('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0x8616('0x2'));var path=require(_0x8616('0x3'));var tiff2pdf=require(_0x8616('0x4'));var gs=require(_0x8616('0x5'));var logger=require(_0x8616('0x6'))(_0x8616('0x7'));var ami=require('../ami');var rpcDb=require(_0x8616('0x8'));var Channel=require(_0x8616('0x9'));var ut=require(_0x8616('0xa'));var Action=require('./action');var faxAccount=require(_0x8616('0xb'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x8616('0xc'));function Fax(_0xf1cb09){this['channels']={};this[_0x8616('0xd')]=_0xf1cb09[_0x8616('0xd')];this[_0x8616('0xe')]=_0xf1cb09[_0x8616('0xe')];this[_0x8616('0xf')]={};ami['on'](_0x8616('0x10'),this[_0x8616('0x11')]['bind'](this));ami['on'](_0x8616('0x12'),this[_0x8616('0x13')]['bind'](this));ami['on'](_0x8616('0x14'),this[_0x8616('0x15')][_0x8616('0x16')](this));ami['on'](_0x8616('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0x8616('0x18'),this['syncFaxStatus'][_0x8616('0x16')](this));ami['on'](_0x8616('0x19'),this[_0x8616('0x1a')]['bind'](this));ami['on'](_0x8616('0x1b'),this[_0x8616('0x1c')]['bind'](this));ami['on'](_0x8616('0x1d'),this['syncOriginateResponse'][_0x8616('0x16')](this));}Fax['prototype']['syncNewchannel']=function(_0x365512){if(_0x365512[_0x8616('0x1e')]===_0x8616('0x1f')){for(var _0x314928 in this['faxAccounts']){if(this['faxAccounts']['hasOwnProperty'](_0x314928)){if(_0x365512[_0x8616('0x20')]===this['faxAccounts'][_0x314928]['localstationid']){this[_0x8616('0x21')][_0x365512[_0x8616('0x22')]]={};this[_0x8616('0x21')][_0x365512[_0x8616('0x22')]]['channel']=_0x365512['channel'];this['channels'][_0x365512[_0x8616('0x22')]]['id']=this[_0x8616('0xd')][_0x314928]['id'];this[_0x8616('0x21')][_0x365512[_0x8616('0x22')]]['name']=this[_0x8616('0xd')][_0x314928][_0x8616('0x23')];logger[_0x8616('0x24')](_0x365512['uniqueid'],_0x8616('0x25'));}}}}if(this[_0x8616('0xf')][_0x365512[_0x8616('0x22')]]){this[_0x8616('0x21')][_0x365512[_0x8616('0x22')]]={};this['channels'][_0x365512[_0x8616('0x22')]][_0x8616('0x26')]=_0x365512[_0x8616('0x26')];logger[_0x8616('0x24')](_0x365512['uniqueid'],'\x20syncNewchannel\x20');}};Fax['prototype'][_0x8616('0x13')]=function(_0x51d326){if(this[_0x8616('0x21')][_0x51d326[_0x8616('0x22')]]){for(var _0xbb2e34 in _0x51d326[_0x8616('0x27')]){if(_0x51d326['variable']['hasOwnProperty'](_0xbb2e34)){this[_0x8616('0x21')][_0x51d326[_0x8616('0x22')]][_0xbb2e34]=_0x51d326[_0x8616('0x28')];}}}};Fax[_0x8616('0x29')][_0x8616('0x15')]=function(_0x30912f){if(this[_0x8616('0x21')][_0x30912f[_0x8616('0x22')]]){this[_0x8616('0x21')][_0x30912f['uniqueid']][_0x8616('0x2a')]=_0x30912f[_0x8616('0x2a')];this[_0x8616('0x21')][_0x30912f[_0x8616('0x22')]]['channelstatedesc']=_0x30912f['channelstatedesc'];}};Fax[_0x8616('0x29')][_0x8616('0x2b')]=function(_0x29b623){if(this[_0x8616('0x21')][_0x29b623['uniqueid']]){for(var _0xa3630a in _0x29b623['variable']){if(_0x29b623[_0x8616('0x27')][_0x8616('0x2c')](_0xa3630a)){this[_0x8616('0x21')][_0x29b623['uniqueid']][_0xa3630a]=_0x29b623['value'];}}}};Fax[_0x8616('0x29')]['syncFaxStatus']=function(_0x31ba91){if(this[_0x8616('0x21')][_0x31ba91[_0x8616('0x22')]]){this[_0x8616('0x21')][_0x31ba91[_0x8616('0x22')]][_0x8616('0x2d')]=_0x31ba91[_0x8616('0x2d')];this[_0x8616('0x21')][_0x31ba91['uniqueid']]['status']=_0x31ba91[_0x8616('0x2e')];this[_0x8616('0x21')][_0x31ba91[_0x8616('0x22')]]['localstationid']=_0x31ba91[_0x8616('0x2f')];this[_0x8616('0x21')][_0x31ba91[_0x8616('0x22')]]['filename']=_0x31ba91['filename'];logger['info'](_0x31ba91[_0x8616('0x22')],_0x8616('0x30'));}};Fax[_0x8616('0x29')]['syncReceiveFax']=function(_0x224072){var _0x3e97f7=this;if(this[_0x8616('0x21')][_0x224072[_0x8616('0x22')]]){var _0x3626c8=this[_0x8616('0x21')][_0x224072[_0x8616('0x22')]]['id'];this[_0x8616('0x21')][_0x224072[_0x8616('0x22')]][_0x8616('0x31')]=_0x224072['remotestationid'];this[_0x8616('0x21')][_0x224072['uniqueid']][_0x8616('0x32')]=_0x224072['pagestransferred'];this[_0x8616('0x21')][_0x224072['uniqueid']]['localstationid']=_0x224072[_0x8616('0x2f')];this[_0x8616('0x21')][_0x224072['uniqueid']][_0x8616('0x33')]=_0x224072[_0x8616('0x33')];this['channels'][_0x224072[_0x8616('0x22')]][_0x8616('0x34')]=_0x224072[_0x8616('0x34')];this['channels'][_0x224072[_0x8616('0x22')]][_0x8616('0x35')]=_0x224072[_0x8616('0x35')];this[_0x8616('0x21')][_0x224072['uniqueid']][_0x8616('0x36')]=_0x224072[_0x8616('0x36')];if(this[_0x8616('0x21')][_0x224072[_0x8616('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x224072[_0x8616('0x35')],'/var/opt/motion2/server/files/attachments/',function(_0x6e0c7a){logger[_0x8616('0x24')](_0x224072[_0x8616('0x22')],_0x8616('0x37'),_0x6e0c7a[_0x8616('0x38')]);attachment['create']({'name':path['parse'](_0x224072[_0x8616('0x35')])[_0x8616('0x23')],'basename':path[_0x8616('0x39')](_0x224072[_0x8616('0x35')])[_0x8616('0x23')]+'.pdf','type':'application/pdf'})['then'](function(_0x5124c7){faxAccount[_0x8616('0x3a')](_0x3626c8,{'from':_0x224072[_0x8616('0x36')],'mapKey':_0x8616('0x7'),'body':path[_0x8616('0x39')](_0x224072['filename'])['name']+_0x8616('0x3b'),'AttachmentId':_0x5124c7['id']})[_0x8616('0x3c')](function(_0x22170d){logger[_0x8616('0x3d')](_0x224072['uniqueid'],_0x8616('0x3e'),JSON[_0x8616('0x3f')](_0x22170d));});})[_0x8616('0x3c')](function(_0x5055c5){logger[_0x8616('0x3d')](_0x224072['uniqueid'],'\x20receiveFax\x20',JSON[_0x8616('0x3f')](_0x5055c5));});});}logger[_0x8616('0x24')](_0x224072['uniqueid'],'\x20receiveFax\x20');}};Fax[_0x8616('0x29')][_0x8616('0x40')]=function(_0x3bf5cb){if(this[_0x8616('0xf')][_0x3bf5cb[_0x8616('0x22')]]){_['merge'](this[_0x8616('0x21')][_0x3bf5cb[_0x8616('0x22')]],_[_0x8616('0x41')](_0x3bf5cb,[_0x8616('0x42'),_0x8616('0x43')]));}};function updateStatus(_0x1b88e3){if(_0x1b88e3['AttachmentId']){faxMessage[_0x8616('0x44')](_0x1b88e3[_0x8616('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x8616('0x46')](function(_0x190425){ut[_0x8616('0x47')](_0x8616('0x48'),_0x190425);})[_0x8616('0x3c')](function(_0x42a7cf){ut[_0x8616('0x47')](_0x8616('0x49'),_0x42a7cf);});}else{ut[_0x8616('0x47')](_0x8616('0x4a'));}}Fax[_0x8616('0x29')][_0x8616('0x4b')]=function(_0x82ad60,_0x3f2399,_0x14aee6){var _0x3c0f85=this;var _0x3b744a={};if(_0x3f2399){_0x3b744a={'read':_0x3f2399};}else{_0x3b744a={'failMessage':_0x14aee6};}if(this[_0x8616('0xf')][_0x82ad60][_0x8616('0x45')]){faxMessage[_0x8616('0x44')](this[_0x8616('0xf')][_0x82ad60][_0x8616('0x45')],_0x3b744a)['then'](function(_0x4f3ebc){ut[_0x8616('0x47')](_0x8616('0x4c'),_0x4f3ebc);})[_0x8616('0x3c')](function(_0x148d2f){ut[_0x8616('0x47')](_0x8616('0x4d'),_0x148d2f);})[_0x8616('0x4e')](function(){delete _0x3c0f85[_0x8616('0x21')][_0x82ad60];delete _0x3c0f85[_0x8616('0xf')][_0x82ad60];});}else{ut['logger'](_0x8616('0x4f'));delete this['channels'][_0x82ad60];delete this['actions'][_0x82ad60];}};Fax['prototype'][_0x8616('0x1c')]=function(_0x46c8d0){var _0x4e7050=this;if(this[_0x8616('0x21')][_0x46c8d0[_0x8616('0x22')]]){if(this[_0x8616('0xf')][_0x46c8d0['uniqueid']]){this['channels'][_0x46c8d0[_0x8616('0x22')]]['id']=this[_0x8616('0xf')][_0x46c8d0['uniqueid']]['id'];this[_0x8616('0x21')][_0x46c8d0[_0x8616('0x22')]]['name']=this[_0x8616('0xf')][_0x46c8d0[_0x8616('0x22')]][_0x8616('0x23')];}logger[_0x8616('0x24')](_0x46c8d0[_0x8616('0x22')],this[_0x8616('0xf')][_0x46c8d0[_0x8616('0x22')]]?_0x8616('0x50'):_0x8616('0x51'),JSON[_0x8616('0x3f')](this[_0x8616('0x21')][_0x46c8d0['uniqueid']]));if(this[_0x8616('0xf')][_0x46c8d0[_0x8616('0x22')]]){if(this[_0x8616('0x21')][_0x46c8d0[_0x8616('0x22')]][_0x8616('0x52')]>0x0&&this[_0x8616('0x21')][_0x46c8d0[_0x8616('0x22')]][_0x8616('0x18')]==='SUCCESS'){this[_0x8616('0x4b')](_0x46c8d0[_0x8616('0x22')],!![]);}else{this[_0x8616('0x4b')](_0x46c8d0['uniqueid'],![],this[_0x8616('0x21')][_0x46c8d0[_0x8616('0x22')]]['faxstatusstring']?_0x8616('0x53')+this['channels'][_0x46c8d0[_0x8616('0x22')]][_0x8616('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0x8616('0x29')][_0x8616('0x55')]=function(_0x334a53){var _0x5e1a67=this;return new BPromise(function(_0x26806c,_0x42535b){_0x5e1a67[_0x8616('0x56')](_0x334a53,_0x5e1a67[_0x8616('0xd')][_0x334a53[_0x8616('0x57')]])[_0x8616('0x46')](function(_0x1a87dc){ut['logger'](_0x8616('0x58'),_0x1a87dc);_0x26806c(ut[_0x8616('0x38')](_0x8616('0x59')));})[_0x8616('0x3c')](function(_0xeeed1f){ut[_0x8616('0x47')]('[Fax][execOriginate][failure]',_0xeeed1f);updateStatus(_0x334a53);_0x42535b(ut[_0x8616('0x38')](_0x8616('0x5a')));});});};Fax[_0x8616('0x29')][_0x8616('0x5b')]=function(_0x3c621f){var _0x30b70f=this;return new BPromise(function(_0x4b1a8d,_0x2a1ffb){var _0x424701=_0x30b70f['checkTrunk'](_0x30b70f[_0x8616('0xd')][_0x3c621f[_0x8616('0x57')]][_0x8616('0x5c')],_0x3c621f);if(_0x424701[_0x8616('0x5d')]){_0x4b1a8d(ut[_0x8616('0x38')](_0x8616('0x5e')));}else{_0x2a1ffb(ut['message'](_0x424701[_0x8616('0x38')]));}});};function originate(_0x450d0f,_0x3bcc0e,_0x4a4d40){return new BPromise(function(_0x303c51,_0x19aa03){if(_0x4a4d40){var _0x1a5b3d=util[_0x8616('0x5f')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x8616('0x39')](_0x450d0f[_0x8616('0x3')])[_0x8616('0x23')],_0x450d0f['path']);gs[_0x8616('0x60')](_0x1a5b3d)['then'](function(){_0x450d0f[_0x8616('0x3')]=util[_0x8616('0x5f')](_0x8616('0x61'),path[_0x8616('0x39')](_0x450d0f[_0x8616('0x3')])[_0x8616('0x62')],path[_0x8616('0x39')](_0x450d0f[_0x8616('0x3')])[_0x8616('0x23')]);_0x3bcc0e[_0x8616('0x63')]=_0x450d0f[_0x8616('0x3')];ut[_0x8616('0x47')](_0x8616('0x64'),'');ami[_0x8616('0x65')](ut[_0x8616('0x66')](_0x450d0f,_0x3bcc0e))['then'](function(_0x548ec6){_0x303c51(_0x548ec6);})['catch'](function(_0x15ebba){_0x19aa03(_0x15ebba);});})[_0x8616('0x3c')](function(_0x40ceab){_0x19aa03(_0x40ceab);});}else{ami['Action'](ut[_0x8616('0x66')](_0x450d0f,_0x3bcc0e))[_0x8616('0x46')](function(_0x39093c){_0x303c51(_0x39093c);})[_0x8616('0x3c')](function(_0x28518c){_0x19aa03(_0x28518c);});}});}Fax[_0x8616('0x29')]['execOriginate']=function(_0x248f23,_0x343420){var _0x51960e=this;return new BPromise(function(_0xf9a343,_0x280cc7){var _0x21442c=uuid['v4']();var _0xf1d26=ut['addVariables'](_0x248f23,_0x343420);_0x51960e['actions'][_0x21442c]=new Action(_0x21442c,_0x343420,_0x248f23);var _0x5e8bfc=_0x51960e[_0x8616('0xf')][_0x21442c];if(path[_0x8616('0x39')](_0x248f23['path'])[_0x8616('0x67')]==='.pdf'){originate(_0x5e8bfc,_0xf1d26,!![])['then'](function(_0x5a6fbb){_0xf9a343(_0x5a6fbb);})['catch'](function(_0xd128d1){_0x280cc7(_0xd128d1);});}else{originate(_0x5e8bfc,_0xf1d26,![])['then'](function(_0x465913){_0xf9a343(_0x465913);})[_0x8616('0x3c')](function(_0x300c04){_0x280cc7(_0x300c04);});}});};Fax[_0x8616('0x29')][_0x8616('0x68')]=function(_0x36a5ca){return!_['isNil'](_0x36a5ca)&&!_[_0x8616('0x69')](_0x36a5ca[_0x8616('0x23')])&&!_[_0x8616('0x69')](_0x36a5ca[_0x8616('0x6a')])&&_0x36a5ca[_0x8616('0x6a')]&&!_[_0x8616('0x69')](this[_0x8616('0xe')][util[_0x8616('0x5f')]('SIP/%s',_0x36a5ca['name'])])&&!_['isNil'](this['trunks'][util[_0x8616('0x5f')](_0x8616('0x6b'),_0x36a5ca[_0x8616('0x23')])][_0x8616('0x2e')])&&(this[_0x8616('0xe')][util[_0x8616('0x5f')]('SIP/%s',_0x36a5ca[_0x8616('0x23')])][_0x8616('0x2e')]===_0x8616('0x6c')||this[_0x8616('0xe')][util[_0x8616('0x5f')](_0x8616('0x6b'),_0x36a5ca[_0x8616('0x23')])][_0x8616('0x2e')]==='unmonitored');};Fax[_0x8616('0x29')][_0x8616('0x6d')]=function(_0x23ce6e,_0x44b3a7){if(!this[_0x8616('0x68')](_0x23ce6e)){ut[_0x8616('0x47')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x8616('0x69')](_0x23ce6e)?'':_0x23ce6e['name']+_0x8616('0x6e'));return{'isValid':![],'message':'Trunk\x20not\x20working'};}if(_[_0x8616('0x69')](_0x44b3a7[_0x8616('0x7')])){ut[_0x8616('0x47')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x8616('0x3f')](_0x44b3a7));return{'isValid':![],'message':_0x8616('0x6f')};}if(_[_0x8616('0x69')](_0x44b3a7['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x8616('0x3f')](_0x44b3a7));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x8616('0x70')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 1280b6e..e26097a 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 _0x6459=['notify','catch','[Notify]\x20','util','bluebird','lodash','error','inspect'];(function(_0x44d8f9,_0x2916ef){var _0x4c3812=function(_0x1ef04e){while(--_0x1ef04e){_0x44d8f9['push'](_0x44d8f9['shift']());}};_0x4c3812(++_0x2916ef);}(_0x6459,0x183));var _0x9645=function(_0x409cfb,_0x233bef){_0x409cfb=_0x409cfb-0x0;var _0x1e4b8d=_0x6459[_0x409cfb];return _0x1e4b8d;};'use strict';var util=require(_0x9645('0x0'));var BPromise=require(_0x9645('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x9645('0x2'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x21bec7){return function(_0x3506f1){logger[_0x9645('0x3')](_0x21bec7,util[_0x9645('0x4')](_0x3506f1,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x6d28b2,_0x1de271){return BPromise['resolve']()['then'](faxAccount[_0x9645('0x5')](_0x6d28b2,_0x1de271))[_0x9645('0x6')](loggerCatch(_0x9645('0x7')));}; \ No newline at end of file +var _0x32ac=['bluebird','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','[Notify]\x20','util'];(function(_0x130417,_0x349dcc){var _0x53c4dc=function(_0x33bdd5){while(--_0x33bdd5){_0x130417['push'](_0x130417['shift']());}};_0x53c4dc(++_0x349dcc);}(_0x32ac,0x13e));var _0xc32a=function(_0x9d254f,_0x344a23){_0x9d254f=_0x9d254f-0x0;var _0x16e9a9=_0x32ac[_0x9d254f];return _0x16e9a9;};'use strict';var util=require(_0xc32a('0x0'));var BPromise=require(_0xc32a('0x1'));var logger=require(_0xc32a('0x2'))(_0xc32a('0x3'));var _=require('lodash');var faxAccount=require(_0xc32a('0x4'));function loggerCatch(_0x3afcc1){return function(_0x386e15){logger[_0xc32a('0x5')](_0x3afcc1,util[_0xc32a('0x6')](_0x386e15,{'showHidden':![],'depth':null}));};}exports[_0xc32a('0x7')]=function(_0x3ee8de,_0x46ec44){return BPromise[_0xc32a('0x8')]()[_0xc32a('0x9')](faxAccount['notify'](_0x3ee8de,_0x46ec44))['catch'](loggerCatch(_0xc32a('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index b4ead40..37e0ffe 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 _0x6a28=['fax','exec','info','util','../../../../config/logger'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x6a28,0x7b));var _0x86a2=function(_0x31f338,_0x53c31e){_0x31f338=_0x31f338-0x0;var _0x1b6898=_0x6a28[_0x31f338];return _0x1b6898;};'use strict';var util=require(_0x86a2('0x0'));var logger=require(_0x86a2('0x1'))(_0x86a2('0x2'));var BPromise=require('bluebird');var exec=require('child_process')[_0x86a2('0x3')];exports['execute']=function(_0x5c4335){return new BPromise(function(_0x5306f5,_0x44ef12){exec(_0x5c4335,function(_0x2fa004,_0x4da9a4,_0x416ee0){logger[_0x86a2('0x4')]('Exec\x20gs',_0x4da9a4);if(_0x2fa004){logger[_0x86a2('0x4')]('Exec\x20gs','\x20Error\x20:',util['inspect'](_0x2fa004,{'showHidden':![],'depth':null}),_0x4da9a4,_0x416ee0);_0x44ef12(_0x2fa004);}_0x5306f5(_0x4da9a4);});});}; \ No newline at end of file +var _0xbd27=['exec','Exec\x20gs','info','inspect','util','fax','bluebird'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd27,0xf9));var _0x7bd2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd27[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x7bd2('0x0'));var logger=require('../../../../config/logger')(_0x7bd2('0x1'));var BPromise=require(_0x7bd2('0x2'));var exec=require('child_process')[_0x7bd2('0x3')];exports['execute']=function(_0xd64c8){return new BPromise(function(_0x528b60,_0x3cca02){exec(_0xd64c8,function(_0x242af9,_0x4f9b86,_0x1536d0){logger['info'](_0x7bd2('0x4'),_0x4f9b86);if(_0x242af9){logger[_0x7bd2('0x5')]('Exec\x20gs','\x20Error\x20:',util[_0x7bd2('0x6')](_0x242af9,{'showHidden':![],'depth':null}),_0x4f9b86,_0x1536d0);_0x3cca02(_0x242af9);}_0x528b60(_0x4f9b86);});});}; \ 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 10e535b..6c851e7 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 _0x3e7c=['channel','\x22%s\x22\x20<%s>','util','lodash','moment','fax','message','logger','info','addVariables','ecm','headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','t38timeout','localstationid','path','uniqueid'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x3e7c,0x136));var _0xc3e7=function(_0x5e29c9,_0x9d6bd){_0x5e29c9=_0x5e29c9-0x0;var _0x4a2599=_0x3e7c[_0x5e29c9];return _0x4a2599;};'use strict';var util=require(_0xc3e7('0x0'));var _=require(_0xc3e7('0x1'));var moment=require(_0xc3e7('0x2'));var logger=require('../../../../config/logger')(_0xc3e7('0x3'));exports[_0xc3e7('0x4')]=function(_0x7711e0){return{'message':_0x7711e0};};exports[_0xc3e7('0x5')]=function(_0x2c2435,_0x42cbc9){logger[_0xc3e7('0x6')](_0x2c2435,util['inspect'](_0x42cbc9,{'showHidden':![],'depth':null}));};exports[_0xc3e7('0x7')]=function(_0x1faf3f,_0x2158a1){var _0x2de046={'XMF-ECM':_0x2158a1[_0xc3e7('0x8')],'XMF-HEADERINFO':_0x2158a1[_0xc3e7('0x9')],'XMF-MINRATE':_0x2158a1[_0xc3e7('0xa')],'XMF-MAXRATE':_0x2158a1[_0xc3e7('0xb')],'XMF-MODEM':util[_0xc3e7('0xc')]('\x22%s\x22',_0x2158a1[_0xc3e7('0xd')]),'XMF-GATEWAY':_0x2158a1[_0xc3e7('0xe')],'XMF-FAXDETECT':_0x2158a1[_0xc3e7('0xf')],'XMF-T38TIMEOUT':_0x2158a1[_0xc3e7('0x10')],'XMF-LOCALSTATIONID':_0x2158a1[_0xc3e7('0x11')],'XMF-PATH':_0x1faf3f[_0xc3e7('0x12')]};return _0x2de046;};exports['variablesAction']=function(_0x41b79d,_0x14dd11){return{'actionid':_0x41b79d[_0xc3e7('0x13')],'action':'originate','channel':_0x41b79d[_0xc3e7('0x14')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0xc3e7('0xc')](_0xc3e7('0x15'),_0x41b79d[_0xc3e7('0x9')]?_0x41b79d[_0xc3e7('0x9')]:'',_0x41b79d['localstationid']),'variable':_0x14dd11,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x41b79d['uniqueid']};}; \ No newline at end of file +var _0x18f2=['logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid','uniqueid','channel','xcally-motion-fax','\x22%s\x22\x20<%s>','util','lodash','../../../../config/logger','fax','message'];(function(_0x3a5889,_0x1ab80b){var _0x3c5106=function(_0x4f9b5f){while(--_0x4f9b5f){_0x3a5889['push'](_0x3a5889['shift']());}};_0x3c5106(++_0x1ab80b);}(_0x18f2,0x13d));var _0x218f=function(_0xde83e,_0xd3b6e4){_0xde83e=_0xde83e-0x0;var _0x5c7cae=_0x18f2[_0xde83e];return _0x5c7cae;};'use strict';var util=require(_0x218f('0x0'));var _=require(_0x218f('0x1'));var moment=require('moment');var logger=require(_0x218f('0x2'))(_0x218f('0x3'));exports[_0x218f('0x4')]=function(_0x17e7c4){return{'message':_0x17e7c4};};exports[_0x218f('0x5')]=function(_0x5499f9,_0x63e5d9){logger[_0x218f('0x6')](_0x5499f9,util[_0x218f('0x7')](_0x63e5d9,{'showHidden':![],'depth':null}));};exports[_0x218f('0x8')]=function(_0x2fb2ca,_0xa428b8){var _0x13e0ff={'XMF-ECM':_0xa428b8[_0x218f('0x9')],'XMF-HEADERINFO':_0xa428b8[_0x218f('0xa')],'XMF-MINRATE':_0xa428b8[_0x218f('0xb')],'XMF-MAXRATE':_0xa428b8[_0x218f('0xc')],'XMF-MODEM':util[_0x218f('0xd')](_0x218f('0xe'),_0xa428b8[_0x218f('0xf')]),'XMF-GATEWAY':_0xa428b8[_0x218f('0x10')],'XMF-FAXDETECT':_0xa428b8['faxdetect'],'XMF-T38TIMEOUT':_0xa428b8[_0x218f('0x11')],'XMF-LOCALSTATIONID':_0xa428b8[_0x218f('0x12')],'XMF-PATH':_0x2fb2ca['path']};return _0x13e0ff;};exports['variablesAction']=function(_0x150c4e,_0x337432){return{'actionid':_0x150c4e[_0x218f('0x13')],'action':'originate','channel':_0x150c4e[_0x218f('0x14')],'Exten':_0x218f('0x15'),'Context':'from-sip','Priority':'1','callerid':util['format'](_0x218f('0x16'),_0x150c4e[_0x218f('0xa')]?_0x150c4e[_0x218f('0xa')]:'',_0x150c4e[_0x218f('0x12')]),'variable':_0x337432,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x150c4e['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 1357967..546e8e1 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 _0x1aef=['initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','log','listen','sync','bluebird','util','moment','./server','./report','./acw','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents'];(function(_0x272306,_0x114621){var _0xaa19f9=function(_0x3b7b80){while(--_0x3b7b80){_0x272306['push'](_0x272306['shift']());}};_0xaa19f9(++_0x114621);}(_0x1aef,0x1b0));var _0xf1ae=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x1aef[_0x49ca18];return _0x145d54;};'use strict';var BPromise=require(_0xf1ae('0x0'));var util=require(_0xf1ae('0x1'));var moment=require(_0xf1ae('0x2'));var server=require(_0xf1ae('0x3'));var Realtime=require('./realtime');var Report=require(_0xf1ae('0x4'));var Acw=require(_0xf1ae('0x5'));var Trigger=require('./trigger');var Dialer=require(_0xf1ae('0x6'));var Preview=require(_0xf1ae('0x7'));var Fax=require('./fax');var user=require(_0xf1ae('0x8'));var voiceQueue=require(_0xf1ae('0x9'));var voiceQueueReport=require(_0xf1ae('0xa'));var voiceCallReport=require(_0xf1ae('0xb'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0xf1ae('0xc'));var cmHopperHistory=require(_0xf1ae('0xd'));var campaign=require(_0xf1ae('0xe'));var voiceExtension=require(_0xf1ae('0xf'));var faxAccount=require(_0xf1ae('0x10'));var zendesk=require(_0xf1ae('0x11'));var salesforce=require(_0xf1ae('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xf1ae('0x13'));var desk=require(_0xf1ae('0x14'));var zoho=require(_0xf1ae('0x15'));var vtiger=require(_0xf1ae('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0xf1ae('0x17'));var dynamics365=require(_0xf1ae('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xf1ae('0x19')](_0xf1ae('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xf1ae('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xf1ae('0x1b')]()[_0xf1ae('0x1c')](user[_0xf1ae('0x1d')]())[_0xf1ae('0x1c')](realtime['initAgents']())['then'](user['getTelephones']())['then'](realtime[_0xf1ae('0x1e')]())[_0xf1ae('0x1c')](trunk[_0xf1ae('0x1f')]())[_0xf1ae('0x1c')](realtime['initTrunks']())[_0xf1ae('0x1c')](voiceQueue[_0xf1ae('0x20')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x21')]())['then'](trigger[_0xf1ae('0x22')]())[_0xf1ae('0x1c')](realtime['initTriggers']())['then'](template['getTemplates']())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x23')]())[_0xf1ae('0x1c')](zendesk[_0xf1ae('0x24')]())[_0xf1ae('0x1c')](realtime['initZendeskAccounts']())['then'](salesforce[_0xf1ae('0x25')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x26')]())[_0xf1ae('0x1c')](sugarcrm[_0xf1ae('0x27')]())['then'](realtime['initSugarcrmAccounts']())[_0xf1ae('0x1c')](freshdesk[_0xf1ae('0x28')]())['then'](realtime[_0xf1ae('0x29')]())[_0xf1ae('0x1c')](desk[_0xf1ae('0x2a')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x2b')]())[_0xf1ae('0x1c')](zoho['getZohoAccounts']())['then'](realtime[_0xf1ae('0x2c')]())[_0xf1ae('0x1c')](vtiger[_0xf1ae('0x2d')]())[_0xf1ae('0x1c')](realtime['initVtigerAccounts']())[_0xf1ae('0x1c')](freshsales['getFreshsalesAccounts']())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x2e')]())['then'](servicenow[_0xf1ae('0x2f')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x30')]())[_0xf1ae('0x1c')](dynamics365[_0xf1ae('0x31')]())['then'](realtime[_0xf1ae('0x32')]())[_0xf1ae('0x1c')](campaign[_0xf1ae('0x33')]())[_0xf1ae('0x1c')](realtime['initCampaigns']())[_0xf1ae('0x1c')](voiceExtension[_0xf1ae('0x34')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x35')]())[_0xf1ae('0x1c')](faxAccount[_0xf1ae('0x36')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x37')]())[_0xf1ae('0x1c')](function(){return realtime;});}function initParams(){return BPromise[_0xf1ae('0x1b')]()[_0xf1ae('0x1c')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0xf1ae('0x38')]())[_0xf1ae('0x1c')](cmHopperHistory[_0xf1ae('0x39')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x3a')]())[_0xf1ae('0x1c')](cmHopperHistory[_0xf1ae('0x3b')]())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x3c')]())[_0xf1ae('0x1c')](voiceCallReport['getVoiceCallReports']())[_0xf1ae('0x1c')](realtime[_0xf1ae('0x3d')]())[_0xf1ae('0x1c')](function(_0x23983c){})[_0xf1ae('0x3e')](function(_0x2736cf){console[_0xf1ae('0x3f')](_0x2736cf);});}function main(){return server[_0xf1ae('0x40')](realtime,preview,fax)[_0xf1ae('0x1c')](function(_0x384a8a){return initRealtime();})[_0xf1ae('0x1c')](function(){return initParams();})['then'](function(){report[_0xf1ae('0x41')]();setInterval(initRealtime,0x1388);})[_0xf1ae('0x3e')](function(_0x31e286){console[_0xf1ae('0x3f')](_0x31e286);});}main(); \ No newline at end of file +var _0x5376=['getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','catch','log','sync','bluebird','util','moment','./server','./report','./acw','./trigger','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','get','hour','then','getAgents','initAgents','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve'];(function(_0x5e7cf2,_0x1d3e7c){var _0x412b1a=function(_0x218fe4){while(--_0x218fe4){_0x5e7cf2['push'](_0x5e7cf2['shift']());}};_0x412b1a(++_0x1d3e7c);}(_0x5376,0x181));var _0x6537=function(_0x3657d9,_0x3de284){_0x3657d9=_0x3657d9-0x0;var _0x4e5b18=_0x5376[_0x3657d9];return _0x4e5b18;};'use strict';var BPromise=require(_0x6537('0x0'));var util=require(_0x6537('0x1'));var moment=require(_0x6537('0x2'));var server=require(_0x6537('0x3'));var Realtime=require('./realtime');var Report=require(_0x6537('0x4'));var Acw=require(_0x6537('0x5'));var Trigger=require(_0x6537('0x6'));var Dialer=require('./dialer');var Preview=require(_0x6537('0x7'));var Fax=require(_0x6537('0x8'));var user=require(_0x6537('0x9'));var voiceQueue=require(_0x6537('0xa'));var voiceQueueReport=require(_0x6537('0xb'));var voiceCallReport=require(_0x6537('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require(_0x6537('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x6537('0xe'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x6537('0xf'));var zendesk=require(_0x6537('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6537('0x11'));var freshdesk=require(_0x6537('0x12'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x6537('0x13'));var vtiger=require(_0x6537('0x14'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x6537('0x15'));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 isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6537('0x16')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6537('0x16')](_0x6537('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x6537('0x18')](user[_0x6537('0x19')]())[_0x6537('0x18')](realtime[_0x6537('0x1a')]())[_0x6537('0x18')](user['getTelephones']())[_0x6537('0x18')](realtime[_0x6537('0x1b')]())[_0x6537('0x18')](trunk[_0x6537('0x1c')]())[_0x6537('0x18')](realtime[_0x6537('0x1d')]())[_0x6537('0x18')](voiceQueue[_0x6537('0x1e')]())[_0x6537('0x18')](realtime[_0x6537('0x1f')]())[_0x6537('0x18')](trigger[_0x6537('0x20')]())[_0x6537('0x18')](realtime[_0x6537('0x21')]())['then'](template[_0x6537('0x22')]())[_0x6537('0x18')](realtime['initTemplates']())[_0x6537('0x18')](zendesk[_0x6537('0x23')]())[_0x6537('0x18')](realtime[_0x6537('0x24')]())[_0x6537('0x18')](salesforce[_0x6537('0x25')]())['then'](realtime[_0x6537('0x26')]())['then'](sugarcrm[_0x6537('0x27')]())['then'](realtime[_0x6537('0x28')]())[_0x6537('0x18')](freshdesk[_0x6537('0x29')]())[_0x6537('0x18')](realtime[_0x6537('0x2a')]())[_0x6537('0x18')](desk['getDeskAccounts']())[_0x6537('0x18')](realtime['initDeskAccounts']())['then'](zoho['getZohoAccounts']())[_0x6537('0x18')](realtime['initZohoAccounts']())[_0x6537('0x18')](vtiger[_0x6537('0x2b')]())[_0x6537('0x18')](realtime[_0x6537('0x2c')]())[_0x6537('0x18')](freshsales[_0x6537('0x2d')]())[_0x6537('0x18')](realtime['initFreshsalesAccounts']())[_0x6537('0x18')](servicenow[_0x6537('0x2e')]())[_0x6537('0x18')](realtime[_0x6537('0x2f')]())[_0x6537('0x18')](dynamics365[_0x6537('0x30')]())[_0x6537('0x18')](realtime[_0x6537('0x31')]())[_0x6537('0x18')](campaign['getCampaigns']())[_0x6537('0x18')](realtime[_0x6537('0x32')]())['then'](voiceExtension[_0x6537('0x33')]())[_0x6537('0x18')](realtime[_0x6537('0x34')]())[_0x6537('0x18')](faxAccount[_0x6537('0x35')]())[_0x6537('0x18')](realtime[_0x6537('0x36')]())[_0x6537('0x18')](function(){return realtime;});}function initParams(){return BPromise[_0x6537('0x37')]()[_0x6537('0x18')](voiceQueueReport[_0x6537('0x38')]())['then'](realtime[_0x6537('0x39')]())[_0x6537('0x18')](cmHopperHistory[_0x6537('0x3a')]())[_0x6537('0x18')](realtime['initVoiceQueueHopperHistory']())[_0x6537('0x18')](cmHopperHistory[_0x6537('0x3b')]())[_0x6537('0x18')](realtime['initCampaignHopperHistory']())[_0x6537('0x18')](voiceCallReport['getVoiceCallReports']())[_0x6537('0x18')](realtime['initVoiceCallReports']())[_0x6537('0x18')](function(_0x39238c){})[_0x6537('0x3c')](function(_0x337720){console[_0x6537('0x3d')](_0x337720);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0xd6443){return initRealtime();})[_0x6537('0x18')](function(){return initParams();})[_0x6537('0x18')](function(){report[_0x6537('0x3e')]();setInterval(initRealtime,0x1388);})[_0x6537('0x3c')](function(_0x2c6d0b){console[_0x6537('0x3d')](_0x2c6d0b);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 1c1dac9..8acaf06 100644 --- a/server/services/ami/model/agent.js +++ b/server/services/ami/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface','online','voiceStatus','voiceStatusQueue','onhold','local','updateStatusRealtime','state','idle','inuse','talking','statePause','voiceStatusTime','toNumber','voiceStatusCallerIdNumber','stringify','format','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x31768e,_0xd02bb9){var _0x56952e=function(_0x31218c){while(--_0x31218c){_0x31768e['push'](_0x31768e['shift']());}};_0x56952e(++_0xd02bb9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1dbaf7,_0x3d05b3){_0x1dbaf7=_0x1dbaf7-0x0;var _0x593f05=_0xcb91[_0x1dbaf7];return _0x593f05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var md5=require(_0x1cb9('0x1'));var Redis=require(_0x1cb9('0x2'));var config=require(_0x1cb9('0x3'));config['redis']=_[_0x1cb9('0x4')](config[_0x1cb9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x1cb9('0x6'))(new Redis(config[_0x1cb9('0x5')]));function Agent(_0x53ffbd){this['id']=_0x53ffbd['id']||0x0;this[_0x1cb9('0x7')]=_0x53ffbd[_0x1cb9('0x7')]||'';this['email']=_0x53ffbd[_0x1cb9('0x8')]||'';this[_0x1cb9('0x9')]=_0x53ffbd['accountcode']||'';this[_0x1cb9('0xa')]=_0x53ffbd['fullname']||'';this['state']=_0x1cb9('0xb');this[_0x1cb9('0xc')]=0x0;this[_0x1cb9('0xd')]=_0x1cb9('0xb');this[_0x1cb9('0xe')]='';this['phone']='';this[_0x1cb9('0xf')]='';this[_0x1cb9('0x10')]='';this[_0x1cb9('0x11')]=_0x53ffbd[_0x1cb9('0x11')]||![];this[_0x1cb9('0x12')]='unknown';this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this[_0x1cb9('0x13')]='';this[_0x1cb9('0x14')]=![];this[_0x1cb9('0x15')]=![];this[_0x1cb9('0x1')]='';}Agent['prototype'][_0x1cb9('0x16')]=function(_0x6ef389){var _0x1b3cd7;if(_0x6ef389&&_0x6ef389[_0x1cb9('0x17')]){_0x1b3cd7=_0x6ef389[_0x1cb9('0x17')]['toLowerCase']();switch(_0x1b3cd7){case'not_inuse':_0x1b3cd7=_0x1cb9('0x18');break;case _0x1cb9('0x19'):_0x1b3cd7=_0x1cb9('0x1a');break;}}if(_0x1b3cd7&&this[_0x1cb9('0x12')]!==_0x1b3cd7||_0x6ef389[_0x1cb9('0x1b')]){this[_0x1cb9('0x1c')]=_[_0x1cb9('0x1d')](moment()['format']('x'));}if(_0x1b3cd7){this['voiceStatus']=_0x1b3cd7;}var _0x1b2fa6={'id':this['id'],'name':this[_0x1cb9('0x7')],'email':this[_0x1cb9('0x8')],'accountcode':this[_0x1cb9('0x9')],'fullname':this[_0x1cb9('0xa')],'state':this[_0x1cb9('0x17')],'stateTime':this[_0x1cb9('0xc')],'status':this['status'],'address':this['address'],'online':this[_0x1cb9('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x1cb9('0x1c')],'voiceStatusCallerIdNumber':this[_0x1cb9('0x1e')],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this[_0x1cb9('0x14')]};var _0x325637=md5(JSON[_0x1cb9('0x1f')](_0x1b2fa6));if(this[_0x1cb9('0x1')]!==_0x325637){this[_0x1cb9('0x1')]=_0x325637;io['to'](util[_0x1cb9('0x20')]('user:%s',_0x1b2fa6['name']))[_0x1cb9('0x21')]('user:save',_0x1b2fa6);io[_0x1cb9('0x21')](_0x1cb9('0x22'),_0x1b2fa6);}};module[_0x1cb9('0x23')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x43371b,_0x1cb4cf){var _0x19cd26=function(_0x5f43bf){while(--_0x5f43bf){_0x43371b['push'](_0x43371b['shift']());}};_0x19cd26(++_0x1cb4cf);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index b580dc8..aeec2f2 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 _0x9130=['Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup'];(function(_0x7d54f4,_0x3de8f5){var _0x202a96=function(_0x20665d){while(--_0x20665d){_0x7d54f4['push'](_0x7d54f4['shift']());}};_0x202a96(++_0x3de8f5);}(_0x9130,0x13a));var _0x0913=function(_0x14af88,_0x121dcf){_0x14af88=_0x14af88-0x0;var _0x2736b4=_0x9130[_0x14af88];return _0x2736b4;};'use strict';function Campaign(_0x358de5){this['id']=_0x358de5['id']||0x0;this['name']=_0x358de5[_0x0913('0x0')]||'';this['type']=_0x358de5[_0x0913('0x1')]||'campaign';this[_0x0913('0x2')]=0x0;this[_0x0913('0x3')]=0x0;this[_0x0913('0x4')]=0x0;this[_0x0913('0x5')]=0x0;this[_0x0913('0x6')]='';this[_0x0913('0x7')]=!![];this['active']=_0x358de5[_0x0913('0x8')];this['limitCalls']=_0x358de5['limitCalls'];this[_0x0913('0x9')]=_0x358de5[_0x0913('0x9')]||null;this['dialGlobalInterval']=_0x358de5[_0x0913('0xa')]?_0x358de5[_0x0913('0xa')]:null;this[_0x0913('0xb')]=_0x358de5[_0x0913('0xb')];this[_0x0913('0xc')]=_0x358de5[_0x0913('0xc')];this[_0x0913('0xd')]=_0x358de5[_0x0913('0xd')]||0x1e;this[_0x0913('0xe')]=_0x358de5[_0x0913('0xe')];this[_0x0913('0xf')]=_0x358de5[_0x0913('0xf')];this[_0x0913('0x10')]=_0x358de5['dialBusyMaxRetry'];this[_0x0913('0x11')]=_0x358de5[_0x0913('0x11')];this[_0x0913('0x12')]=_0x358de5['dialNoAnswerMaxRetry'];this[_0x0913('0x13')]=_0x358de5['dialNoAnswerRetryFrequency'];this[_0x0913('0x14')]=_0x358de5[_0x0913('0x14')];this['dialNoSuchNumberMaxRetry']=_0x358de5['dialNoSuchNumberMaxRetry']||0x3;this[_0x0913('0x15')]=_0x358de5[_0x0913('0x15')]||0x96;this[_0x0913('0x16')]=_0x358de5[_0x0913('0x16')]||0x3;this[_0x0913('0x17')]=_0x358de5['dialDropRetryFrequency']||0x96;this[_0x0913('0x18')]=_0x358de5[_0x0913('0x18')]||0x3;this[_0x0913('0x19')]=_0x358de5['dialAbandonedRetryFrequency']||0x96;this[_0x0913('0x1a')]=_0x358de5['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x358de5[_0x0913('0x1b')]||0x96;this[_0x0913('0x1c')]=_0x358de5[_0x0913('0x1c')]||0x3;this[_0x0913('0x1d')]=_0x358de5[_0x0913('0x1d')]||0x96;this[_0x0913('0x1e')]=_0x358de5[_0x0913('0x1e')]||_0x0913('0x1f');this[_0x0913('0x20')]=_0x358de5[_0x0913('0x20')]||undefined;this[_0x0913('0x21')]=_0x358de5[_0x0913('0x21')]||undefined;this[_0x0913('0x22')]=_0x358de5[_0x0913('0x22')]||undefined;this['TrunkBackup']=_0x358de5[_0x0913('0x23')]?_0x358de5[_0x0913('0x23')]:undefined;this[_0x0913('0x24')]=_0x358de5[_0x0913('0x24')]?_0x358de5[_0x0913('0x24')]:undefined;this['Interval']=_0x358de5[_0x0913('0x25')]?_0x358de5[_0x0913('0x25')]:undefined;this[_0x0913('0x26')]=_0x358de5[_0x0913('0x26')]?_0x358de5[_0x0913('0x26')]:undefined;this[_0x0913('0x27')]=_0x358de5[_0x0913('0x26')]?_0x358de5[_0x0913('0x26')][_0x0913('0x0')]:undefined;this['dialAMDActive']=_0x358de5['dialAMDActive']||![];this[_0x0913('0x28')]=_0x358de5['dialAMDInitialSilence'];this[_0x0913('0x29')]=_0x358de5[_0x0913('0x29')];this[_0x0913('0x2a')]=_0x358de5[_0x0913('0x2a')];this[_0x0913('0x2b')]=_0x358de5[_0x0913('0x2b')];this[_0x0913('0x2c')]=_0x358de5[_0x0913('0x2c')];this['dialAMDBetweenWordsSilence']=_0x358de5[_0x0913('0x2d')];this[_0x0913('0x2e')]=_0x358de5[_0x0913('0x2e')];this['dialAMDSilenceThreshold']=_0x358de5[_0x0913('0x2f')];this[_0x0913('0x30')]=_0x358de5['dialAMDMaximumWordLength'];}module[_0x0913('0x31')]=Campaign; \ No newline at end of file +var _0x7a0f=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x5af2d6,_0x15a911){var _0x258e83=function(_0x1f9dbd){while(--_0x1f9dbd){_0x5af2d6['push'](_0x5af2d6['shift']());}};_0x258e83(++_0x15a911);}(_0x7a0f,0x91));var _0xf7a0=function(_0x3e1b63,_0x23585c){_0x3e1b63=_0x3e1b63-0x0;var _0x13379d=_0x7a0f[_0x3e1b63];return _0x13379d;};'use strict';function Campaign(_0x490eaa){this['id']=_0x490eaa['id']||0x0;this[_0xf7a0('0x0')]=_0x490eaa[_0xf7a0('0x0')]||'';this['type']=_0x490eaa[_0xf7a0('0x1')]||_0xf7a0('0x2');this[_0xf7a0('0x3')]=0x0;this[_0xf7a0('0x4')]=0x0;this[_0xf7a0('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xf7a0('0x6')]='';this[_0xf7a0('0x7')]=!![];this[_0xf7a0('0x8')]=_0x490eaa[_0xf7a0('0x8')];this[_0xf7a0('0x9')]=_0x490eaa['limitCalls'];this[_0xf7a0('0xa')]=_0x490eaa[_0xf7a0('0xa')]||null;this[_0xf7a0('0xb')]=_0x490eaa['dialGlobalInterval']?_0x490eaa[_0xf7a0('0xb')]:null;this[_0xf7a0('0xc')]=_0x490eaa['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x490eaa[_0xf7a0('0xd')];this[_0xf7a0('0xe')]=_0x490eaa[_0xf7a0('0xe')]||0x1e;this[_0xf7a0('0xf')]=_0x490eaa['dialCongestionMaxRetry'];this[_0xf7a0('0x10')]=_0x490eaa[_0xf7a0('0x10')];this[_0xf7a0('0x11')]=_0x490eaa['dialBusyMaxRetry'];this[_0xf7a0('0x12')]=_0x490eaa[_0xf7a0('0x12')];this['dialNoAnswerMaxRetry']=_0x490eaa[_0xf7a0('0x13')];this[_0xf7a0('0x14')]=_0x490eaa[_0xf7a0('0x14')];this[_0xf7a0('0x15')]=_0x490eaa['dialGlobalMaxRetry'];this[_0xf7a0('0x16')]=_0x490eaa['dialNoSuchNumberMaxRetry']||0x3;this[_0xf7a0('0x17')]=_0x490eaa[_0xf7a0('0x17')]||0x96;this[_0xf7a0('0x18')]=_0x490eaa[_0xf7a0('0x18')]||0x3;this['dialDropRetryFrequency']=_0x490eaa['dialDropRetryFrequency']||0x96;this[_0xf7a0('0x19')]=_0x490eaa[_0xf7a0('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x490eaa[_0xf7a0('0x1a')]||0x96;this[_0xf7a0('0x1b')]=_0x490eaa['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x490eaa[_0xf7a0('0x1c')]||0x96;this[_0xf7a0('0x1d')]=_0x490eaa['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x490eaa[_0xf7a0('0x1e')]||0x96;this[_0xf7a0('0x1f')]=_0x490eaa[_0xf7a0('0x1f')]||_0xf7a0('0x20');this['dialPrefix']=_0x490eaa[_0xf7a0('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x490eaa[_0xf7a0('0x22')]||undefined;this[_0xf7a0('0x23')]=_0x490eaa[_0xf7a0('0x23')]||undefined;this['TrunkBackup']=_0x490eaa[_0xf7a0('0x24')]?_0x490eaa[_0xf7a0('0x24')]:undefined;this[_0xf7a0('0x25')]=_0x490eaa[_0xf7a0('0x25')]?_0x490eaa[_0xf7a0('0x25')]:undefined;this[_0xf7a0('0x26')]=_0x490eaa['Interval']?_0x490eaa['Interval']:undefined;this[_0xf7a0('0x27')]=_0x490eaa[_0xf7a0('0x27')]?_0x490eaa[_0xf7a0('0x27')]:undefined;this[_0xf7a0('0x28')]=_0x490eaa[_0xf7a0('0x27')]?_0x490eaa[_0xf7a0('0x27')][_0xf7a0('0x0')]:undefined;this[_0xf7a0('0x29')]=_0x490eaa[_0xf7a0('0x29')]||![];this['dialAMDInitialSilence']=_0x490eaa[_0xf7a0('0x2a')];this[_0xf7a0('0x2b')]=_0x490eaa['dialAMDGreeting'];this[_0xf7a0('0x2c')]=_0x490eaa[_0xf7a0('0x2c')];this[_0xf7a0('0x2d')]=_0x490eaa['dialAMDTotalAnalysisTime'];this[_0xf7a0('0x2e')]=_0x490eaa[_0xf7a0('0x2e')];this[_0xf7a0('0x2f')]=_0x490eaa['dialAMDBetweenWordsSilence'];this[_0xf7a0('0x30')]=_0x490eaa[_0xf7a0('0x30')];this[_0xf7a0('0x31')]=_0x490eaa[_0xf7a0('0x31')];this[_0xf7a0('0x32')]=_0x490eaa[_0xf7a0('0x32')];}module[_0xf7a0('0x33')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index a47eb39..8e24049 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 _0xb5fa=['billableseconds','holdtime','type','disposition','monitorFilename','monitors','transfercalleridnum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','unmanaged','abandoned','lastdata','duration'];(function(_0xeb8ea5,_0x5130fe){var _0x2f6669=function(_0x2e995c){while(--_0x2e995c){_0xeb8ea5['push'](_0xeb8ea5['shift']());}};_0x2f6669(++_0x5130fe);}(_0xb5fa,0xf8));var _0xab5f=function(_0x5babfc,_0x321e73){_0x5babfc=_0x5babfc-0x0;var _0x135938=_0xb5fa[_0x5babfc];return _0x135938;};'use strict';function Channel(){this[_0xab5f('0x0')]=null;this[_0xab5f('0x1')]='';this[_0xab5f('0x2')]='';this[_0xab5f('0x3')]=0x0;this[_0xab5f('0x4')]='';this[_0xab5f('0x5')]=undefined;this[_0xab5f('0x6')]=undefined;this[_0xab5f('0x7')]=0x0;this[_0xab5f('0x8')]='';this[_0xab5f('0x9')]=0x0;this[_0xab5f('0xa')]=0x0;this[_0xab5f('0xb')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0xab5f('0xc')]=![];this[_0xab5f('0xd')]=![];this['lastapplication']='';this[_0xab5f('0xe')]='';this[_0xab5f('0xf')]=0x0;this[_0xab5f('0x10')]=0x0;this[_0xab5f('0x11')]=0x0;this[_0xab5f('0x12')]=null;this['tag']=null;this[_0xab5f('0x13')]=null;this['monitor']=![];this[_0xab5f('0x14')]=null;this['queue']=null;this[_0xab5f('0x15')]=[];this[_0xab5f('0x16')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xab5f('0x17')]=Channel; \ No newline at end of file +var _0x09df=['transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','calleridnum','connectedlinename','uniqueid','linkedid','endtime','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','queue','transfercalleridnum'];(function(_0x2fc464,_0x2936c1){var _0x1bd429=function(_0x3c8bf5){while(--_0x3c8bf5){_0x2fc464['push'](_0x2fc464['shift']());}};_0x1bd429(++_0x2936c1);}(_0x09df,0x164));var _0xf09d=function(_0x507ac5,_0x33aaee){_0x507ac5=_0x507ac5-0x0;var _0x12c1bc=_0x09df[_0x507ac5];return _0x12c1bc;};'use strict';function Channel(){this[_0xf09d('0x0')]=null;this[_0xf09d('0x1')]='';this['destinationchannel']='';this[_0xf09d('0x2')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0xf09d('0x3')]=undefined;this['accountcode']=0x0;this['context']='';this[_0xf09d('0x4')]=0x0;this[_0xf09d('0x5')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0xf09d('0x6')]=null;this['unmanaged']=![];this[_0xf09d('0x7')]=![];this[_0xf09d('0x8')]='';this[_0xf09d('0x9')]='';this[_0xf09d('0xa')]=0x0;this[_0xf09d('0xb')]=0x0;this[_0xf09d('0xc')]=0x0;this[_0xf09d('0xd')]=null;this['tag']=null;this[_0xf09d('0xe')]=null;this[_0xf09d('0xf')]=![];this['monitorFilename']=null;this[_0xf09d('0x10')]=null;this['monitors']=[];this[_0xf09d('0x11')]=undefined;this[_0xf09d('0x12')]=undefined;this[_0xf09d('0x13')]=undefined;this[_0xf09d('0x14')]=0x0;}module[_0xf09d('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e48bca9..c2fcb9a 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 _0xb5a9=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type'];(function(_0x5608a8,_0x3e794a){var _0x59e5d8=function(_0x4d7687){while(--_0x4d7687){_0x5608a8['push'](_0x5608a8['shift']());}};_0x59e5d8(++_0x3e794a);}(_0xb5a9,0x19a));var _0x9b5a=function(_0x56c86b,_0xc36ff3){_0x56c86b=_0x56c86b-0x0;var _0x26ae80=_0xb5a9[_0x56c86b];return _0x26ae80;};'use strict';function DeskAccount(_0xca3bd6){this['id']=_0xca3bd6['id']||0x0;this['name']=_0xca3bd6[_0x9b5a('0x0')]||'';this[_0x9b5a('0x1')]=_0xca3bd6['username']||'';this['remoteUri']=_0xca3bd6[_0x9b5a('0x2')]||'';this[_0x9b5a('0x3')]=_0xca3bd6[_0x9b5a('0x3')]||'';this[_0x9b5a('0x4')]=_0xca3bd6[_0x9b5a('0x4')]||'';this[_0x9b5a('0x5')]=_0xca3bd6['consumerKey']||'';this['consumerSecret']=_0xca3bd6[_0x9b5a('0x6')]||'';this[_0x9b5a('0x7')]=_0xca3bd6[_0x9b5a('0x7')]||'';this[_0x9b5a('0x8')]=_0xca3bd6[_0x9b5a('0x8')]||'';this['type']=_0xca3bd6[_0x9b5a('0x9')]||'';this['serverUrl']=_0xca3bd6['serverUrl']||'';this[_0x9b5a('0xa')]=_0xca3bd6[_0x9b5a('0xa')]||{};}module[_0x9b5a('0xb')]=DeskAccount; \ No newline at end of file +var _0xb849=['consumerKey','consumerSecret','tokenSecret','type','serverUrl','exports','name','username','remoteUri','authType','password'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0xb849,0x166));var _0x9b84=function(_0x1e062d,_0x29218e){_0x1e062d=_0x1e062d-0x0;var _0xc47d9e=_0xb849[_0x1e062d];return _0xc47d9e;};'use strict';function DeskAccount(_0x38ef5a){this['id']=_0x38ef5a['id']||0x0;this['name']=_0x38ef5a[_0x9b84('0x0')]||'';this[_0x9b84('0x1')]=_0x38ef5a[_0x9b84('0x1')]||'';this[_0x9b84('0x2')]=_0x38ef5a['remoteUri']||'';this[_0x9b84('0x3')]=_0x38ef5a[_0x9b84('0x3')]||'';this[_0x9b84('0x4')]=_0x38ef5a[_0x9b84('0x4')]||'';this[_0x9b84('0x5')]=_0x38ef5a[_0x9b84('0x5')]||'';this[_0x9b84('0x6')]=_0x38ef5a[_0x9b84('0x6')]||'';this['token']=_0x38ef5a['token']||'';this[_0x9b84('0x7')]=_0x38ef5a[_0x9b84('0x7')]||'';this['type']=_0x38ef5a[_0x9b84('0x8')]||'';this[_0x9b84('0x9')]=_0x38ef5a[_0x9b84('0x9')]||'';this['Configurations']=_0x38ef5a['Configurations']||{};}module[_0x9b84('0xa')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6481d3a..fe7aed6 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 _0xd8b0=['Configurations','exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x218756,_0x419c39){var _0x1b90ec=function(_0x237c8e){while(--_0x237c8e){_0x218756['push'](_0x218756['shift']());}};_0x1b90ec(++_0x419c39);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';function Dynamics365Account(_0x5d04de){this['id']=_0x5d04de['id']||0x0;this[_0x0d8b('0x0')]=_0x5d04de['name']||'';this['username']=_0x5d04de['username']||'';this[_0x0d8b('0x1')]=_0x5d04de[_0x0d8b('0x1')]||'';this[_0x0d8b('0x2')]=_0x5d04de[_0x0d8b('0x2')]||'';this[_0x0d8b('0x3')]=_0x5d04de['tenantId']||'';this['clientId']=_0x5d04de[_0x0d8b('0x4')]||'';this[_0x0d8b('0x5')]=_0x5d04de[_0x0d8b('0x5')]||{};this['serverUrl']=_0x5d04de[_0x0d8b('0x6')]||'';this[_0x0d8b('0x7')]=_0x5d04de['Configurations']||{};}module[_0x0d8b('0x8')]=Dynamics365Account; \ No newline at end of file +var _0x91a7=['exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations'];(function(_0x1bc49,_0x2521a6){var _0x3eafb1=function(_0x4e2691){while(--_0x4e2691){_0x1bc49['push'](_0x1bc49['shift']());}};_0x3eafb1(++_0x2521a6);}(_0x91a7,0xe7));var _0x791a=function(_0x11cb1d,_0x4782da){_0x11cb1d=_0x11cb1d-0x0;var _0x353d97=_0x91a7[_0x11cb1d];return _0x353d97;};'use strict';function Dynamics365Account(_0x27c92e){this['id']=_0x27c92e['id']||0x0;this[_0x791a('0x0')]=_0x27c92e[_0x791a('0x0')]||'';this[_0x791a('0x1')]=_0x27c92e['username']||'';this[_0x791a('0x2')]=_0x27c92e['password']||'';this[_0x791a('0x3')]=_0x27c92e['remoteUri']||'';this['tenantId']=_0x27c92e[_0x791a('0x4')]||'';this[_0x791a('0x5')]=_0x27c92e['clientId']||'';this[_0x791a('0x6')]=_0x27c92e['clientSecret']||{};this[_0x791a('0x7')]=_0x27c92e[_0x791a('0x7')]||'';this['Configurations']=_0x27c92e[_0x791a('0x8')]||{};}module[_0x791a('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index c371f6d..3d21e74 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 _0x1a40=['faxdetect','t38timeout','tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway'];(function(_0x4d60e5,_0x21e76a){var _0x388e42=function(_0x3d2470){while(--_0x3d2470){_0x4d60e5['push'](_0x4d60e5['shift']());}};_0x388e42(++_0x21e76a);}(_0x1a40,0xb7));var _0x01a4=function(_0x2b6eaa,_0x3d91e7){_0x2b6eaa=_0x2b6eaa-0x0;var _0x3369f9=_0x1a40[_0x2b6eaa];return _0x3369f9;};'use strict';function FaxAccount(_0x477c3e){this['id']=_0x477c3e['id']||0x0;this[_0x01a4('0x0')]=_0x477c3e[_0x01a4('0x0')]||'';this[_0x01a4('0x1')]=_0x477c3e[_0x01a4('0x1')];this[_0x01a4('0x2')]=_0x477c3e[_0x01a4('0x2')];this[_0x01a4('0x3')]=_0x477c3e[_0x01a4('0x3')];this[_0x01a4('0x4')]=_0x477c3e[_0x01a4('0x4')];this[_0x01a4('0x5')]=_0x477c3e[_0x01a4('0x5')]||0x960;this[_0x01a4('0x6')]=_0x477c3e[_0x01a4('0x6')]||0x3840;this[_0x01a4('0x7')]=_0x477c3e[_0x01a4('0x7')]||'v17,v27,v29';this[_0x01a4('0x8')]=_0x477c3e[_0x01a4('0x8')]||'no';this[_0x01a4('0x9')]=_0x477c3e[_0x01a4('0x9')]||'no';this[_0x01a4('0xa')]=_0x477c3e[_0x01a4('0xa')]||0x1388;this['tech']=_0x477c3e[_0x01a4('0xb')]||'SIP';this[_0x01a4('0xc')]=_0x477c3e[_0x01a4('0xc')]?_0x477c3e['Trunk']:undefined;this[_0x01a4('0xd')]=_0x477c3e[_0x01a4('0xd')];this[_0x01a4('0xe')]=_0x477c3e[_0x01a4('0xe')];}module[_0x01a4('0xf')]=FaxAccount; \ No newline at end of file +var _0x910d=['key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','Trunk','ListId'];(function(_0x5d08f7,_0x30919d){var _0x223e4e=function(_0x25bd25){while(--_0x25bd25){_0x5d08f7['push'](_0x5d08f7['shift']());}};_0x223e4e(++_0x30919d);}(_0x910d,0x141));var _0xd910=function(_0x4e788d,_0x286bc5){_0x4e788d=_0x4e788d-0x0;var _0x2c66fe=_0x910d[_0x4e788d];return _0x2c66fe;};'use strict';function FaxAccount(_0x261780){this['id']=_0x261780['id']||0x0;this[_0xd910('0x0')]=_0x261780[_0xd910('0x0')]||'';this[_0xd910('0x1')]=_0x261780[_0xd910('0x1')];this[_0xd910('0x2')]=_0x261780['ecm'];this[_0xd910('0x3')]=_0x261780[_0xd910('0x3')];this['localstationid']=_0x261780[_0xd910('0x4')];this[_0xd910('0x5')]=_0x261780[_0xd910('0x5')]||0x960;this[_0xd910('0x6')]=_0x261780['maxrate']||0x3840;this[_0xd910('0x7')]=_0x261780['modem']||_0xd910('0x8');this[_0xd910('0x9')]=_0x261780[_0xd910('0x9')]||'no';this[_0xd910('0xa')]=_0x261780[_0xd910('0xa')]||'no';this[_0xd910('0xb')]=_0x261780['t38timeout']||0x1388;this[_0xd910('0xc')]=_0x261780[_0xd910('0xc')]||'SIP';this['Trunk']=_0x261780[_0xd910('0xd')]?_0x261780[_0xd910('0xd')]:undefined;this[_0xd910('0xe')]=_0x261780[_0xd910('0xe')];this[_0xd910('0xf')]=_0x261780['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 7291951..53d6a18 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 _0x1697=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x4e8f38,_0x3a9404){var _0x3a10a3=function(_0x2f79e2){while(--_0x2f79e2){_0x4e8f38['push'](_0x4e8f38['shift']());}};_0x3a10a3(++_0x3a9404);}(_0x1697,0x153));var _0x7169=function(_0x25662e,_0x4cec68){_0x25662e=_0x25662e-0x0;var _0x59b7bc=_0x1697[_0x25662e];return _0x59b7bc;};'use strict';function FreshdeskAccount(_0x1fc0c5){this['id']=_0x1fc0c5['id']||0x0;this[_0x7169('0x0')]=_0x1fc0c5[_0x7169('0x0')]||'';this['username']=_0x1fc0c5[_0x7169('0x1')]||'';this[_0x7169('0x2')]=_0x1fc0c5[_0x7169('0x3')]||'';this[_0x7169('0x4')]=_0x1fc0c5[_0x7169('0x4')]||'';this[_0x7169('0x5')]=_0x1fc0c5[_0x7169('0x5')]||'';this[_0x7169('0x6')]=_0x1fc0c5[_0x7169('0x6')]||{};}module[_0x7169('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0xf822=['remoteUri','serverUrl','Configurations','exports','username','apiKey','token'];(function(_0x9894ff,_0x9256ba){var _0x462988=function(_0x38f4ad){while(--_0x38f4ad){_0x9894ff['push'](_0x9894ff['shift']());}};_0x462988(++_0x9256ba);}(_0xf822,0x1e0));var _0x2f82=function(_0x7b2063,_0x41e070){_0x7b2063=_0x7b2063-0x0;var _0x2d8fa2=_0xf822[_0x7b2063];return _0x2d8fa2;};'use strict';function FreshdeskAccount(_0x4eaa98){this['id']=_0x4eaa98['id']||0x0;this['name']=_0x4eaa98['name']||'';this[_0x2f82('0x0')]=_0x4eaa98['username']||'';this[_0x2f82('0x1')]=_0x4eaa98[_0x2f82('0x2')]||'';this[_0x2f82('0x3')]=_0x4eaa98[_0x2f82('0x3')]||'';this['serverUrl']=_0x4eaa98[_0x2f82('0x4')]||'';this[_0x2f82('0x5')]=_0x4eaa98[_0x2f82('0x5')]||{};}module[_0x2f82('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7a71acc..75ae537 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 _0x5aaa=['token','remoteUri','serverUrl','Configurations','exports'];(function(_0x536d13,_0x475cff){var _0xe5071c=function(_0x522a06){while(--_0x522a06){_0x536d13['push'](_0x536d13['shift']());}};_0xe5071c(++_0x475cff);}(_0x5aaa,0xff));var _0xa5aa=function(_0x447c17,_0x59d3a2){_0x447c17=_0x447c17-0x0;var _0x1179ad=_0x5aaa[_0x447c17];return _0x1179ad;};'use strict';function FreshsalesAccount(_0x4b634e){this['id']=_0x4b634e['id']||0x0;this['name']=_0x4b634e['name']||'';this['username']=_0x4b634e['username']||'';this['apiKey']=_0x4b634e[_0xa5aa('0x0')]||'';this[_0xa5aa('0x1')]=_0x4b634e[_0xa5aa('0x1')]||'';this['serverUrl']=_0x4b634e[_0xa5aa('0x2')]||'';this[_0xa5aa('0x3')]=_0x4b634e['Configurations']||{};}module[_0xa5aa('0x4')]=FreshsalesAccount; \ No newline at end of file +var _0x4f0d=['apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x218fb1,_0x2aa008){var _0x57a5c3=function(_0x5babba){while(--_0x5babba){_0x218fb1['push'](_0x218fb1['shift']());}};_0x57a5c3(++_0x2aa008);}(_0x4f0d,0x1c2));var _0xd4f0=function(_0x3d8d0a,_0x11bb87){_0x3d8d0a=_0x3d8d0a-0x0;var _0x5b9df5=_0x4f0d[_0x3d8d0a];return _0x5b9df5;};'use strict';function FreshsalesAccount(_0x46c498){this['id']=_0x46c498['id']||0x0;this['name']=_0x46c498['name']||'';this['username']=_0x46c498['username']||'';this[_0xd4f0('0x0')]=_0x46c498[_0xd4f0('0x1')]||'';this[_0xd4f0('0x2')]=_0x46c498['remoteUri']||'';this[_0xd4f0('0x3')]=_0x46c498['serverUrl']||'';this['Configurations']=_0x46c498[_0xd4f0('0x4')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index bb0ac6e..90066ab 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 _0x001d=['queue','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','channel','connectedlinenum','connectedlinename','context','exten','priority','assigned','variables','exports','type','inbound','calleridnum','calleridname'];(function(_0x35d59c,_0x341ef9){var _0x18cd27=function(_0x16a9c4){while(--_0x16a9c4){_0x35d59c['push'](_0x35d59c['shift']());}};_0x18cd27(++_0x341ef9);}(_0x001d,0xd8));var _0xd001=function(_0x4449a8,_0x79adf3){_0x4449a8=_0x4449a8-0x0;var _0x4783b6=_0x001d[_0x4449a8];return _0x4783b6;};'use strict';function QueueReport(){this[_0xd001('0x0')]=_0xd001('0x1');this['uniqueid']='';this[_0xd001('0x2')]='';this[_0xd001('0x3')]='';this[_0xd001('0x4')]='';this['queuecallerjoinAt']=null;this['queuecallerleaveAt']=null;this[_0xd001('0x5')]=0x1;this[_0xd001('0x6')]=0x1;this[_0xd001('0x7')]=![];this[_0xd001('0x8')]=null;this[_0xd001('0x9')]=![];this[_0xd001('0xa')]=null;this[_0xd001('0xb')]=![];this[_0xd001('0xc')]=null;this['originalposition']=0x1;this[_0xd001('0xd')]='';this[_0xd001('0xe')]='';this[_0xd001('0xf')]='';this['accountcode']='';this[_0xd001('0x10')]='';this[_0xd001('0x11')]='';this[_0xd001('0x12')]='';this['holdtime']=0x0;this[_0xd001('0x13')]=![];this['lastAssignedTo']='';this['mohtime']=0x0;this[_0xd001('0x14')]={};}module[_0xd001('0x15')]=QueueReport; \ No newline at end of file +var _0x697b=['queuecallercompleteAt','queuecallerexit','channel','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete'];(function(_0x4574b0,_0x3bd754){var _0x3d720c=function(_0x18a7da){while(--_0x18a7da){_0x4574b0['push'](_0x4574b0['shift']());}};_0x3d720c(++_0x3bd754);}(_0x697b,0x16b));var _0xb697=function(_0x359311,_0x18f54d){_0x359311=_0x359311-0x0;var _0x579f21=_0x697b[_0x359311];return _0x579f21;};'use strict';function QueueReport(){this[_0xb697('0x0')]=_0xb697('0x1');this[_0xb697('0x2')]='';this[_0xb697('0x3')]='';this[_0xb697('0x4')]='';this[_0xb697('0x5')]='';this['queuecallerjoinAt']=null;this[_0xb697('0x6')]=null;this[_0xb697('0x7')]=0x1;this[_0xb697('0x8')]=0x1;this[_0xb697('0x9')]=![];this[_0xb697('0xa')]=null;this[_0xb697('0xb')]=![];this[_0xb697('0xc')]=null;this[_0xb697('0xd')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xb697('0xe')]='';this['connectedlinenum']='';this[_0xb697('0xf')]='';this[_0xb697('0x10')]='';this[_0xb697('0x11')]='';this[_0xb697('0x12')]='';this[_0xb697('0x13')]='';this[_0xb697('0x14')]=0x0;this[_0xb697('0x15')]=![];this[_0xb697('0x16')]='';this[_0xb697('0x17')]=0x0;this['variables']={};}module[_0xb697('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c03d5b5..c74087a 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 _0x0b70=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri','password','clientId'];(function(_0x42f600,_0x2fe5cd){var _0x27e916=function(_0x436b32){while(--_0x436b32){_0x42f600['push'](_0x42f600['shift']());}};_0x27e916(++_0x2fe5cd);}(_0x0b70,0x192));var _0x00b7=function(_0x48e532,_0x49672b){_0x48e532=_0x48e532-0x0;var _0x17403f=_0x0b70[_0x48e532];return _0x17403f;};'use strict';function SalesforceAccount(_0x45566e){this['id']=_0x45566e['id']||0x0;this[_0x00b7('0x0')]=_0x45566e[_0x00b7('0x0')]||'';this[_0x00b7('0x1')]=_0x45566e[_0x00b7('0x1')]||'';this['remoteUri']=_0x45566e[_0x00b7('0x2')]||'';this[_0x00b7('0x3')]=_0x45566e[_0x00b7('0x3')]||'';this[_0x00b7('0x4')]=_0x45566e[_0x00b7('0x4')]||'';this[_0x00b7('0x5')]=_0x45566e[_0x00b7('0x5')]||'';this[_0x00b7('0x6')]=_0x45566e[_0x00b7('0x6')]||'';this['type']=_0x45566e[_0x00b7('0x7')]||_0x00b7('0x8');this[_0x00b7('0x9')]=_0x45566e['serverUrl']||'';this[_0x00b7('0xa')]=_0x45566e[_0x00b7('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xf364=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x4c6275,_0x5ab0bc){var _0x480821=function(_0x3ca4da){while(--_0x3ca4da){_0x4c6275['push'](_0x4c6275['shift']());}};_0x480821(++_0x5ab0bc);}(_0xf364,0x170));var _0x4f36=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xf364[_0xf50820];return _0x2a9b10;};'use strict';function SalesforceAccount(_0x1b15e7){this['id']=_0x1b15e7['id']||0x0;this['name']=_0x1b15e7[_0x4f36('0x0')]||'';this[_0x4f36('0x1')]=_0x1b15e7['username']||'';this[_0x4f36('0x2')]=_0x1b15e7[_0x4f36('0x2')]||'';this[_0x4f36('0x3')]=_0x1b15e7[_0x4f36('0x3')]||'';this[_0x4f36('0x4')]=_0x1b15e7['clientId']||'';this[_0x4f36('0x5')]=_0x1b15e7[_0x4f36('0x5')]||'';this[_0x4f36('0x6')]=_0x1b15e7[_0x4f36('0x6')]||'';this[_0x4f36('0x7')]=_0x1b15e7[_0x4f36('0x7')]||_0x4f36('0x8');this['serverUrl']=_0x1b15e7[_0x4f36('0x9')]||'';this['Configurations']=_0x1b15e7[_0x4f36('0xa')]||{};}module[_0x4f36('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a423967..9b216c2 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 _0x6e67=['username','password','remoteUri','serverUrl','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x6e67,0x13a));var _0x76e6=function(_0x5440d3,_0x68412d){_0x5440d3=_0x5440d3-0x0;var _0x49b20a=_0x6e67[_0x5440d3];return _0x49b20a;};'use strict';function ServicenowAccount(_0x18ec24){this['id']=_0x18ec24['id']||0x0;this['name']=_0x18ec24[_0x76e6('0x0')]||'';this[_0x76e6('0x1')]=_0x18ec24['username']||'';this[_0x76e6('0x2')]=_0x18ec24[_0x76e6('0x2')]||'';this[_0x76e6('0x3')]=_0x18ec24[_0x76e6('0x3')]||'';this[_0x76e6('0x4')]=_0x18ec24['serverUrl']||'';this['Configurations']=_0x18ec24['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xb7a1=['username','password','remoteUri','Configurations'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb7a1,0x198));var _0x1b7a=function(_0x2d645f,_0x424e40){_0x2d645f=_0x2d645f-0x0;var _0x1da3ed=_0xb7a1[_0x2d645f];return _0x1da3ed;};'use strict';function ServicenowAccount(_0x42ac1f){this['id']=_0x42ac1f['id']||0x0;this['name']=_0x42ac1f['name']||'';this[_0x1b7a('0x0')]=_0x42ac1f[_0x1b7a('0x0')]||'';this[_0x1b7a('0x1')]=_0x42ac1f[_0x1b7a('0x1')]||'';this[_0x1b7a('0x2')]=_0x42ac1f[_0x1b7a('0x2')]||'';this['serverUrl']=_0x42ac1f['serverUrl']||'';this[_0x1b7a('0x3')]=_0x42ac1f[_0x1b7a('0x3')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 300759c..5e73e1f 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 _0x537e=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x5d9b2c,_0x551b33){var _0x19afb8=function(_0x2e3ff7){while(--_0x2e3ff7){_0x5d9b2c['push'](_0x5d9b2c['shift']());}};_0x19afb8(++_0x551b33);}(_0x537e,0x10c));var _0xe537=function(_0x1d075f,_0x4f4e75){_0x1d075f=_0x1d075f-0x0;var _0x4f3a69=_0x537e[_0x1d075f];return _0x4f3a69;};'use strict';function SugarcrmAccount(_0x3d385f){this['id']=_0x3d385f['id']||0x0;this['name']=_0x3d385f[_0xe537('0x0')]||'';this[_0xe537('0x1')]=_0x3d385f['username']||'';this[_0xe537('0x2')]=_0x3d385f[_0xe537('0x2')]||'';this[_0xe537('0x3')]=_0x3d385f['remoteUri']||'';this[_0xe537('0x4')]=_0x3d385f['serverUrl']||'';this['Configurations']=_0x3d385f[_0xe537('0x5')]||{};}module[_0xe537('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe9ed=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x1368b0,_0x215715){var _0x1e8286=function(_0x1365d6){while(--_0x1365d6){_0x1368b0['push'](_0x1368b0['shift']());}};_0x1e8286(++_0x215715);}(_0xe9ed,0xff));var _0xde9e=function(_0xe5794d,_0x224242){_0xe5794d=_0xe5794d-0x0;var _0x346ce9=_0xe9ed[_0xe5794d];return _0x346ce9;};'use strict';function SugarcrmAccount(_0x8b8a37){this['id']=_0x8b8a37['id']||0x0;this[_0xde9e('0x0')]=_0x8b8a37[_0xde9e('0x0')]||'';this[_0xde9e('0x1')]=_0x8b8a37[_0xde9e('0x1')]||'';this[_0xde9e('0x2')]=_0x8b8a37[_0xde9e('0x2')]||'';this[_0xde9e('0x3')]=_0x8b8a37['remoteUri']||'';this[_0xde9e('0x4')]=_0x8b8a37['serverUrl']||'';this[_0xde9e('0x5')]=_0x8b8a37['Configurations']||{};}module[_0xde9e('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index a2adcd6..a40273d 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 _0x7ff5=['exports','name','accountcode','state','unknown','stateTime'];(function(_0x53d4d7,_0x46a490){var _0x1ae81c=function(_0x41c7a7){while(--_0x41c7a7){_0x53d4d7['push'](_0x53d4d7['shift']());}};_0x1ae81c(++_0x46a490);}(_0x7ff5,0xcd));var _0x57ff=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x7ff5[_0xb98d8d];return _0x489b15;};'use strict';function Telephone(_0x25b20d){this['id']=_0x25b20d['id']||0x0;this[_0x57ff('0x0')]=_0x25b20d[_0x57ff('0x0')]||'';this[_0x57ff('0x1')]=_0x25b20d['accountcode']||'';this[_0x57ff('0x2')]=_0x57ff('0x3');this[_0x57ff('0x4')]=0x0;this['status']=_0x57ff('0x3');this['address']='';}module[_0x57ff('0x5')]=Telephone; \ No newline at end of file +var _0xaee2=['name','accountcode','state','unknown','stateTime','status','address','exports'];(function(_0x1b194c,_0x427e6a){var _0x4a2193=function(_0x548d08){while(--_0x548d08){_0x1b194c['push'](_0x1b194c['shift']());}};_0x4a2193(++_0x427e6a);}(_0xaee2,0x150));var _0x2aee=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0xaee2[_0x158f01];return _0x5ef74e;};'use strict';function Telephone(_0x2d95bd){this['id']=_0x2d95bd['id']||0x0;this[_0x2aee('0x0')]=_0x2d95bd[_0x2aee('0x0')]||'';this[_0x2aee('0x1')]=_0x2d95bd[_0x2aee('0x1')]||'';this[_0x2aee('0x2')]=_0x2aee('0x3');this[_0x2aee('0x4')]=0x0;this[_0x2aee('0x5')]=_0x2aee('0x3');this[_0x2aee('0x6')]='';}module[_0x2aee('0x7')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 742e58a..a72f9e0 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x31e571,_0x58ad50){var _0x13fffc=function(_0x3bacc7){while(--_0x3bacc7){_0x31e571['push'](_0x31e571['shift']());}};_0x13fffc(++_0x58ad50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xb10b=['name','html'];(function(_0x187d56,_0x2ecd6d){var _0x2acd2e=function(_0x178314){while(--_0x178314){_0x187d56['push'](_0x187d56['shift']());}};_0x2acd2e(++_0x2ecd6d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e6cbb,_0x3450f0){_0x4e6cbb=_0x4e6cbb-0x0;var _0x15ced4=_0xb10b[_0x4e6cbb];return _0x15ced4;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index a370391..62bb49e 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 _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x5eb8,0xb0));var _0x85eb=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0x5eb8[_0xfed299];return _0x4ef1f2;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x14af1b,_0x25cff8){var _0x4acefb=function(_0x327bcf){while(--_0x327bcf){_0x14af1b['push'](_0x14af1b['shift']());}};_0x4acefb(++_0x25cff8);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb7e7[_0x5d4607];return _0x5e4a86;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('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 c0f3879..77c8f94 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 _0x1816=['host','port','domainport','refresh','stateRegistry','address','defaultuser','exports','active','stateTime','unknown','registry','indexOf','split'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1816,0xa2));var _0x6181=function(_0x6786ee,_0x4aae5d){_0x6786ee=_0x6786ee-0x0;var _0x1026c2=_0x1816[_0x6786ee];return _0x1026c2;};'use strict';function Trunk(_0x142021){this['id']=_0x142021['id']||0x0;this[_0x6181('0x0')]=_0x142021[_0x6181('0x0')]||![];this['name']=_0x142021['name']||'';this['state']='unknown';this[_0x6181('0x1')]=0x0;this['status']=_0x6181('0x2');this[_0x6181('0x3')]=_0x142021[_0x6181('0x3')]&&_0x142021[_0x6181('0x3')][_0x6181('0x4')](':')?_0x142021[_0x6181('0x3')][_0x6181('0x5')](':')[0x0]:'';this[_0x6181('0x6')]='';this[_0x6181('0x7')]='';this['domain']='';this[_0x6181('0x8')]='';this[_0x6181('0x9')]='';this[_0x6181('0xa')]=_0x6181('0x2');this['registrationtime']='';this[_0x6181('0xb')]='';this[_0x6181('0xc')]=_0x142021[_0x6181('0xc')]||'';}module[_0x6181('0xd')]=Trunk; \ No newline at end of file +var _0x041f=['registry','split','host','port','domainport','stateRegistry','unknown','registrationtime','address','defaultuser','active','name','stateTime'];(function(_0x561cb9,_0x4ba9ef){var _0xf7abd=function(_0x181590){while(--_0x181590){_0x561cb9['push'](_0x561cb9['shift']());}};_0xf7abd(++_0x4ba9ef);}(_0x041f,0x8c));var _0xf041=function(_0x2c22c8,_0x1e0fc9){_0x2c22c8=_0x2c22c8-0x0;var _0x518942=_0x041f[_0x2c22c8];return _0x518942;};'use strict';function Trunk(_0xbef03e){this['id']=_0xbef03e['id']||0x0;this[_0xf041('0x0')]=_0xbef03e[_0xf041('0x0')]||![];this['name']=_0xbef03e[_0xf041('0x1')]||'';this['state']='unknown';this[_0xf041('0x2')]=0x0;this['status']='unknown';this[_0xf041('0x3')]=_0xbef03e[_0xf041('0x3')]&&_0xbef03e[_0xf041('0x3')]['indexOf'](':')?_0xbef03e[_0xf041('0x3')][_0xf041('0x4')](':')[0x0]:'';this[_0xf041('0x5')]='';this[_0xf041('0x6')]='';this['domain']='';this[_0xf041('0x7')]='';this['refresh']='';this[_0xf041('0x8')]=_0xf041('0x9');this[_0xf041('0xa')]='';this[_0xf041('0xb')]='';this[_0xf041('0xc')]=_0xbef03e[_0xf041('0xc')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ac1ce9f..962d04a 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 _0x2585=['exten','recordingFormat','none'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2585,0x135));var _0x5258=function(_0x4b7570,_0x3a97cf){_0x4b7570=_0x4b7570-0x0;var _0x39abd2=_0x2585[_0x4b7570];return _0x39abd2;};'use strict';function voiceExtension(_0x321f23){this['id']=_0x321f23['id']||0x0;this[_0x5258('0x0')]=_0x321f23[_0x5258('0x0')]||'';this[_0x5258('0x1')]=_0x321f23[_0x5258('0x1')]||_0x5258('0x2');this['mandatoryDisposition']=_0x321f23['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x5b0f=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x1428ac,_0x9a06ba){var _0x2cdda8=function(_0x2c6817){while(--_0x2c6817){_0x1428ac['push'](_0x1428ac['shift']());}};_0x2cdda8(++_0x9a06ba);}(_0x5b0f,0x74));var _0xf5b0=function(_0x5ba24b,_0x4ae1a5){_0x5ba24b=_0x5ba24b-0x0;var _0x39d28c=_0x5b0f[_0x5ba24b];return _0x39d28c;};'use strict';function voiceExtension(_0x4cf4c5){this['id']=_0x4cf4c5['id']||0x0;this['exten']=_0x4cf4c5[_0xf5b0('0x0')]||'';this[_0xf5b0('0x1')]=_0x4cf4c5[_0xf5b0('0x1')]||_0xf5b0('0x2');this[_0xf5b0('0x3')]=_0x4cf4c5['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index e1fc3f8..5f524de 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 _0xef66=['total','sumHoldTime','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','originated','temp','dialTimezone','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','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','invalid','ringinuse','onhold','wav','wav49','gsm','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting'];(function(_0x9e44ce,_0x3ac76a){var _0x594c98=function(_0x471117){while(--_0x471117){_0x9e44ce['push'](_0x9e44ce['shift']());}};_0x594c98(++_0x3ac76a);}(_0xef66,0x1db));var _0x6ef6=function(_0x259274,_0x2f48a8){_0x259274=_0x259274-0x0;var _0x32d1e6=_0xef66[_0x259274];return _0x32d1e6;};'use strict';var statusDesc=[_0x6ef6('0x0'),_0x6ef6('0x1'),_0x6ef6('0x2'),_0x6ef6('0x3'),_0x6ef6('0x4'),'unavailable','ringing',_0x6ef6('0x5'),_0x6ef6('0x6')];var monitorFormat={'wav':_0x6ef6('0x7'),'wav49':_0x6ef6('0x8'),'gsm':_0x6ef6('0x9')};var strategy={'rrmemory':_0x6ef6('0xa'),'roundrobin':_0x6ef6('0xb')};function VoiceQueue(_0x1830aa){this['id']=_0x1830aa['id']||0x0;this[_0x6ef6('0xc')]=_0x1830aa['name']||'';this['monitor_format']=_0x1830aa[_0x6ef6('0xd')]||'';this[_0x6ef6('0xe')]=_0x1830aa[_0x6ef6('0xe')]||_0x6ef6('0xf');this[_0x6ef6('0x10')]=0x0;this['talking']=0x0;this[_0x6ef6('0x11')]=0x0;this['answered']=0x0;this['sumDuration']=0x0;this[_0x6ef6('0x12')]=0x0;this['sumBillable']=0x0;this[_0x6ef6('0x13')]=0x0;this[_0x6ef6('0x14')]=0x0;this[_0x6ef6('0x15')]=0x0;this[_0x6ef6('0x16')]=0x0;this['acw']=_0x1830aa[_0x6ef6('0x17')]||![];this[_0x6ef6('0x18')]=_0x1830aa[_0x6ef6('0x18')]||0xa;this[_0x6ef6('0x19')]=_0x1830aa['autopause']||'no';this[_0x6ef6('0x1a')]=!![];this['message']='';this[_0x6ef6('0x1b')]=0x0;this[_0x6ef6('0x1c')]=0x0;this['dialTimezone']=_0x1830aa[_0x6ef6('0x1d')]||null;this[_0x6ef6('0x1e')]=_0x1830aa[_0x6ef6('0x1e')]?_0x1830aa[_0x6ef6('0x1e')]:null;this[_0x6ef6('0x1f')]=_0x1830aa[_0x6ef6('0x1f')];this[_0x6ef6('0x20')]=_0x1830aa[_0x6ef6('0x20')]||_0x6ef6('0x21');this[_0x6ef6('0x22')]=_0x1830aa['dialLimitChannel']||0x0;this[_0x6ef6('0x23')]=_0x1830aa[_0x6ef6('0x23')]||0x0;this[_0x6ef6('0x24')]=_0x1830aa[_0x6ef6('0x24')]||0x1;this[_0x6ef6('0x25')]=_0x1830aa[_0x6ef6('0x25')]||_0x6ef6('0x26');this['dialPredictiveOptimizationPercentage']=_0x1830aa[_0x6ef6('0x27')]||0.03;this[_0x6ef6('0x28')]=_0x1830aa[_0x6ef6('0x28')]||0x258;this[_0x6ef6('0x29')]=_0x1830aa['dialOriginateCallerIdName']||_0x6ef6('0x2a');this[_0x6ef6('0x2b')]=_0x1830aa[_0x6ef6('0x2b')]||'anonymous';this[_0x6ef6('0x2c')]=_0x1830aa[_0x6ef6('0x2c')]||0x1e;this['dialQueueOptions']=_0x1830aa[_0x6ef6('0x2d')]||_0x6ef6('0x2e');this['dialQueueTimeout']=_0x1830aa[_0x6ef6('0x2f')]||0x3;this[_0x6ef6('0x30')]=_0x1830aa[_0x6ef6('0x30')]||undefined;this[_0x6ef6('0x31')]=_0x1830aa[_0x6ef6('0x31')]||0x3;this[_0x6ef6('0x32')]=_0x1830aa[_0x6ef6('0x32')]||0x96;this['dialBusyMaxRetry']=_0x1830aa[_0x6ef6('0x33')]||0x3;this['dialBusyRetryFrequency']=_0x1830aa[_0x6ef6('0x34')]||0x96;this[_0x6ef6('0x35')]=_0x1830aa[_0x6ef6('0x35')]||0x3;this[_0x6ef6('0x36')]=_0x1830aa[_0x6ef6('0x36')]||0x96;this[_0x6ef6('0x37')]=_0x1830aa[_0x6ef6('0x37')]||0x3;this[_0x6ef6('0x38')]=_0x1830aa[_0x6ef6('0x38')]||0x96;this[_0x6ef6('0x39')]=_0x1830aa[_0x6ef6('0x39')]||0x3;this[_0x6ef6('0x3a')]=_0x1830aa[_0x6ef6('0x3a')]||0x96;this[_0x6ef6('0x3b')]=_0x1830aa[_0x6ef6('0x3b')]||0x3;this[_0x6ef6('0x3c')]=_0x1830aa[_0x6ef6('0x3c')]||0x96;this[_0x6ef6('0x3d')]=_0x1830aa[_0x6ef6('0x3d')]||0x3;this[_0x6ef6('0x3e')]=_0x1830aa['dialMachineRetryFrequency']||0x96;this[_0x6ef6('0x3f')]=_0x1830aa['dialAgentRejectMaxRetry']||0x3;this[_0x6ef6('0x40')]=_0x1830aa[_0x6ef6('0x40')]||0x96;this[_0x6ef6('0x41')]=_0x1830aa['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x1830aa[_0x6ef6('0x42')]?_0x1830aa[_0x6ef6('0x42')]:undefined;this[_0x6ef6('0x43')]=_0x1830aa['TrunkBackup']?_0x1830aa[_0x6ef6('0x43')]:undefined;this['dialPrefix']=_0x1830aa[_0x6ef6('0x44')]||undefined;this[_0x6ef6('0x45')]=_0x1830aa['Interval']?_0x1830aa['Interval']:undefined;this[_0x6ef6('0x46')]=_0x1830aa['dialOrderByScheduledAt']||_0x6ef6('0x47');this['dialRandomLastDigitCallerIdNumber']=_0x1830aa[_0x6ef6('0x48')]||undefined;this['dialCutDigit']=_0x1830aa['dialCutDigit']||undefined;this[_0x6ef6('0x49')]=strategy[_0x1830aa[_0x6ef6('0x49')]]||'rrmemory';this[_0x6ef6('0x4a')]=!![];this['dialAMDActive']=_0x1830aa[_0x6ef6('0x4b')]||![];this['dialAMDInitialSilence']=_0x1830aa[_0x6ef6('0x4c')];this['dialAMDGreeting']=_0x1830aa[_0x6ef6('0x4d')];this[_0x6ef6('0x4e')]=_0x1830aa[_0x6ef6('0x4e')];this['dialAMDTotalAnalysisTime']=_0x1830aa['dialAMDTotalAnalysisTime'];this[_0x6ef6('0x4f')]=_0x1830aa[_0x6ef6('0x4f')];this[_0x6ef6('0x50')]=_0x1830aa[_0x6ef6('0x50')];this['dialAMDMaximumNumberOfWords']=_0x1830aa['dialAMDMaximumNumberOfWords'];this[_0x6ef6('0x51')]=_0x1830aa['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x1830aa[_0x6ef6('0x52')];this['outboundRejectCallsDay']=0x0;this[_0x6ef6('0x53')]=0x0;this[_0x6ef6('0x54')]=_0x1830aa[_0x6ef6('0x54')];this[_0x6ef6('0x55')]=0x0;this[_0x6ef6('0x56')]=0x0;this[_0x6ef6('0x57')]=0x0;this[_0x6ef6('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x6ef6('0x59')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x6ef6('0x5a')]=0x0;this[_0x6ef6('0x5b')]=0x0;this[_0x6ef6('0x5c')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x6ef6('0x5d')]=0x0;this[_0x6ef6('0x5e')]=0x0;this[_0x6ef6('0x5f')]=undefined;this['startPredictive']=undefined;this[_0x6ef6('0x60')]=undefined;this[_0x6ef6('0x61')]=1.05;this[_0x6ef6('0x62')]=0x0;this[_0x6ef6('0x63')]=0x0;this[_0x6ef6('0x64')]=0x0;this[_0x6ef6('0x65')]=0x0;this[_0x6ef6('0x66')]=0x0;this[_0x6ef6('0x67')]=0x0;this[_0x6ef6('0x68')]=0x0;this[_0x6ef6('0x69')]=0x0;this['predictiveIntervalMaxThreshold']=_0x1830aa[_0x6ef6('0x6a')]||0x14;this[_0x6ef6('0x6b')]=_0x1830aa[_0x6ef6('0x6a')]||0xa;this[_0x6ef6('0x6c')]=0x0;this[_0x6ef6('0x6d')]=0x0;this[_0x6ef6('0x6e')]=0x1;this[_0x6ef6('0x6f')]=0x0;this[_0x6ef6('0x70')]=0x0;this[_0x6ef6('0x71')]=0x0;this[_0x6ef6('0x72')]=0x0;this[_0x6ef6('0x73')]=_0x1830aa['dialRecallMeTimeout']||0x1e;this[_0x6ef6('0x74')]=_0x1830aa['dialRecallInQueue']||![];this[_0x6ef6('0x75')]=_0x1830aa['dialQueueProject2']||undefined;this[_0x6ef6('0x76')]=_0x1830aa[_0x6ef6('0x76')]||![];this['dialAgiAfterHangupAgent']=_0x1830aa[_0x6ef6('0x77')]||![];this[_0x6ef6('0xd')]=monitorFormat[_0x1830aa[_0x6ef6('0xd')]]?monitorFormat[_0x1830aa[_0x6ef6('0xd')]]:undefined;this[_0x6ef6('0x78')]=_0x1830aa['mandatoryDisposition']||![];this[_0x6ef6('0x79')]=_0x1830aa[_0x6ef6('0x79')]?_0x1830aa[_0x6ef6('0x79')]:undefined;}module[_0x6ef6('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x8069=['tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','talking','total','answered','sumDuration','sumBillable','unmanaged','loggedIn','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0x6794b7,_0x48ee86){var _0x257760=function(_0x52cda6){while(--_0x52cda6){_0x6794b7['push'](_0x6794b7['shift']());}};_0x257760(++_0x48ee86);}(_0x8069,0xbb));var _0x9806=function(_0x1f9864,_0x384999){_0x1f9864=_0x1f9864-0x0;var _0xff7ccf=_0x8069[_0x1f9864];return _0xff7ccf;};'use strict';var statusDesc=[_0x9806('0x0'),_0x9806('0x1'),_0x9806('0x2'),_0x9806('0x3'),'invalid',_0x9806('0x4'),_0x9806('0x5'),'ringinuse','onhold'];var monitorFormat={'wav':_0x9806('0x6'),'wav49':_0x9806('0x7'),'gsm':'gsm'};var strategy={'rrmemory':_0x9806('0x8'),'roundrobin':_0x9806('0x9')};function VoiceQueue(_0x51eea1){this['id']=_0x51eea1['id']||0x0;this['name']=_0x51eea1[_0x9806('0xa')]||'';this['monitor_format']=_0x51eea1[_0x9806('0xb')]||'';this[_0x9806('0xc')]=_0x51eea1[_0x9806('0xc')]||'inbound';this['waiting']=0x0;this[_0x9806('0xd')]=0x0;this[_0x9806('0xe')]=0x0;this[_0x9806('0xf')]=0x0;this[_0x9806('0x10')]=0x0;this['sumHoldTime']=0x0;this[_0x9806('0x11')]=0x0;this[_0x9806('0x12')]=0x0;this['abandoned']=0x0;this[_0x9806('0x13')]=0x0;this['available']=0x0;this[_0x9806('0x14')]=_0x51eea1[_0x9806('0x14')]||![];this[_0x9806('0x15')]=_0x51eea1[_0x9806('0x15')]||0xa;this[_0x9806('0x16')]=_0x51eea1[_0x9806('0x16')]||'no';this[_0x9806('0x17')]=!![];this[_0x9806('0x18')]='';this[_0x9806('0x19')]=0x0;this[_0x9806('0x1a')]=0x0;this[_0x9806('0x1b')]=_0x51eea1[_0x9806('0x1b')]||null;this[_0x9806('0x1c')]=_0x51eea1[_0x9806('0x1c')]?_0x51eea1[_0x9806('0x1c')]:null;this[_0x9806('0x1d')]=_0x51eea1[_0x9806('0x1d')];this[_0x9806('0x1e')]=_0x51eea1[_0x9806('0x1e')]||_0x9806('0x1f');this[_0x9806('0x20')]=_0x51eea1[_0x9806('0x20')]||0x0;this[_0x9806('0x21')]=_0x51eea1[_0x9806('0x21')]||0x0;this['dialPowerLevel']=_0x51eea1['dialPowerLevel']||0x1;this[_0x9806('0x22')]=_0x51eea1['dialPredictiveOptimization']||_0x9806('0x23');this[_0x9806('0x24')]=_0x51eea1['dialPredictiveOptimizationPercentage']||0.03;this[_0x9806('0x25')]=_0x51eea1[_0x9806('0x25')]||0x258;this[_0x9806('0x26')]=_0x51eea1[_0x9806('0x26')]||_0x9806('0x27');this[_0x9806('0x28')]=_0x51eea1[_0x9806('0x28')]||'anonymous';this[_0x9806('0x29')]=_0x51eea1[_0x9806('0x29')]||0x1e;this['dialQueueOptions']=_0x51eea1[_0x9806('0x2a')]||_0x9806('0x2b');this[_0x9806('0x2c')]=_0x51eea1['dialQueueTimeout']||0x3;this[_0x9806('0x2d')]=_0x51eea1['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x51eea1['dialCongestionMaxRetry']||0x3;this['dialCongestionRetryFrequency']=_0x51eea1[_0x9806('0x2e')]||0x96;this['dialBusyMaxRetry']=_0x51eea1['dialBusyMaxRetry']||0x3;this['dialBusyRetryFrequency']=_0x51eea1[_0x9806('0x2f')]||0x96;this['dialNoAnswerMaxRetry']=_0x51eea1[_0x9806('0x30')]||0x3;this[_0x9806('0x31')]=_0x51eea1[_0x9806('0x31')]||0x96;this[_0x9806('0x32')]=_0x51eea1['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x51eea1[_0x9806('0x33')]||0x96;this[_0x9806('0x34')]=_0x51eea1[_0x9806('0x34')]||0x3;this[_0x9806('0x35')]=_0x51eea1[_0x9806('0x35')]||0x96;this[_0x9806('0x36')]=_0x51eea1['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x51eea1[_0x9806('0x37')]||0x96;this['dialMachineMaxRetry']=_0x51eea1[_0x9806('0x38')]||0x3;this[_0x9806('0x39')]=_0x51eea1[_0x9806('0x39')]||0x96;this[_0x9806('0x3a')]=_0x51eea1[_0x9806('0x3a')]||0x3;this[_0x9806('0x3b')]=_0x51eea1[_0x9806('0x3b')]||0x96;this[_0x9806('0x3c')]=_0x51eea1[_0x9806('0x3c')]||0x4;this[_0x9806('0x3d')]=_0x51eea1[_0x9806('0x3d')]?_0x51eea1[_0x9806('0x3d')]:undefined;this[_0x9806('0x3e')]=_0x51eea1['TrunkBackup']?_0x51eea1[_0x9806('0x3e')]:undefined;this['dialPrefix']=_0x51eea1[_0x9806('0x3f')]||undefined;this[_0x9806('0x40')]=_0x51eea1[_0x9806('0x40')]?_0x51eea1['Interval']:undefined;this[_0x9806('0x41')]=_0x51eea1[_0x9806('0x41')]||_0x9806('0x42');this[_0x9806('0x43')]=_0x51eea1[_0x9806('0x43')]||undefined;this[_0x9806('0x44')]=_0x51eea1[_0x9806('0x44')]||undefined;this[_0x9806('0x45')]=strategy[_0x51eea1['strategy']]||_0x9806('0x8');this[_0x9806('0x46')]=!![];this[_0x9806('0x47')]=_0x51eea1[_0x9806('0x47')]||![];this[_0x9806('0x48')]=_0x51eea1[_0x9806('0x48')];this['dialAMDGreeting']=_0x51eea1[_0x9806('0x49')];this['dialAMDAfterGreetingSilence']=_0x51eea1['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x51eea1[_0x9806('0x4a')];this[_0x9806('0x4b')]=_0x51eea1[_0x9806('0x4b')];this[_0x9806('0x4c')]=_0x51eea1[_0x9806('0x4c')];this[_0x9806('0x4d')]=_0x51eea1['dialAMDMaximumNumberOfWords'];this[_0x9806('0x4e')]=_0x51eea1[_0x9806('0x4e')];this[_0x9806('0x4f')]=_0x51eea1['dialAMDMaximumWordLength'];this[_0x9806('0x50')]=0x0;this['pTalking']=0x0;this[_0x9806('0x51')]=_0x51eea1[_0x9806('0x51')];this['outboundAnswerCallsDay']=0x0;this[_0x9806('0x52')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x9806('0x53')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x9806('0x54')]=0x0;this[_0x9806('0x55')]=0x0;this['outboundBlacklistCallsDay']=0x0;this['outboundOriginateFailureCallsDay']=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0x9806('0x56')]=0x0;this[_0x9806('0x57')]=0x0;this[_0x9806('0x58')]=0x0;this[_0x9806('0x59')]=0x0;this[_0x9806('0x5a')]=undefined;this['startPredictive']=undefined;this[_0x9806('0x5b')]=undefined;this[_0x9806('0x5c')]=1.05;this[_0x9806('0x5d')]=0x0;this[_0x9806('0x5e')]=0x0;this[_0x9806('0x5f')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x9806('0x60')]=0x0;this[_0x9806('0x61')]=0x0;this[_0x9806('0x62')]=0x0;this[_0x9806('0x63')]=0x0;this['predictiveIntervalMaxThreshold']=_0x51eea1[_0x9806('0x64')]||0x14;this[_0x9806('0x65')]=_0x51eea1[_0x9806('0x64')]||0xa;this[_0x9806('0x66')]=0x0;this[_0x9806('0x67')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x9806('0x68')]=0x0;this[_0x9806('0x69')]=0x0;this[_0x9806('0x6a')]=0x0;this['erlangBusyFactor']=0x0;this[_0x9806('0x6b')]=_0x51eea1[_0x9806('0x6b')]||0x1e;this[_0x9806('0x6c')]=_0x51eea1[_0x9806('0x6c')]||![];this[_0x9806('0x6d')]=_0x51eea1[_0x9806('0x6d')]||undefined;this[_0x9806('0x6e')]=_0x51eea1[_0x9806('0x6e')]||![];this[_0x9806('0x6f')]=_0x51eea1['dialAgiAfterHangupAgent']||![];this[_0x9806('0xb')]=monitorFormat[_0x51eea1[_0x9806('0xb')]]?monitorFormat[_0x51eea1[_0x9806('0xb')]]:undefined;this[_0x9806('0x70')]=_0x51eea1[_0x9806('0x70')]||![];this[_0x9806('0x71')]=_0x51eea1['mandatoryDispositionPause']?_0x51eea1[_0x9806('0x71')]:undefined;}module[_0x9806('0x72')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 1c05ac1..7abecb2 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 _0xda20=['remoteUri','serverUrl','Configurations','exports','username','accessKey'];(function(_0x10b24f,_0x2203b9){var _0x5e4a97=function(_0x1dc282){while(--_0x1dc282){_0x10b24f['push'](_0x10b24f['shift']());}};_0x5e4a97(++_0x2203b9);}(_0xda20,0xee));var _0x0da2=function(_0x418ccd,_0x51d1a9){_0x418ccd=_0x418ccd-0x0;var _0x55b14b=_0xda20[_0x418ccd];return _0x55b14b;};'use strict';function VtigerAccount(_0x487e36){this['id']=_0x487e36['id']||0x0;this['name']=_0x487e36['name']||'';this[_0x0da2('0x0')]=_0x487e36[_0x0da2('0x0')]||'';this[_0x0da2('0x1')]=_0x487e36[_0x0da2('0x1')]||'';this[_0x0da2('0x2')]=_0x487e36[_0x0da2('0x2')]||'';this[_0x0da2('0x3')]=_0x487e36[_0x0da2('0x3')]||'';this['Configurations']=_0x487e36[_0x0da2('0x4')]||{};}module[_0x0da2('0x5')]=VtigerAccount; \ No newline at end of file +var _0x9175=['username','accessKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0xcd0918,_0x56bdf9){var _0x250704=function(_0x56788e){while(--_0x56788e){_0xcd0918['push'](_0xcd0918['shift']());}};_0x250704(++_0x56bdf9);}(_0x9175,0x14f));var _0x5917=function(_0x43a791,_0x3621f8){_0x43a791=_0x43a791-0x0;var _0x4bb497=_0x9175[_0x43a791];return _0x4bb497;};'use strict';function VtigerAccount(_0x1b9fd9){this['id']=_0x1b9fd9['id']||0x0;this[_0x5917('0x0')]=_0x1b9fd9['name']||'';this['username']=_0x1b9fd9[_0x5917('0x1')]||'';this['accessKey']=_0x1b9fd9[_0x5917('0x2')]||'';this[_0x5917('0x3')]=_0x1b9fd9[_0x5917('0x3')]||'';this['serverUrl']=_0x1b9fd9[_0x5917('0x4')]||'';this[_0x5917('0x5')]=_0x1b9fd9[_0x5917('0x5')]||{};}module[_0x5917('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 19cf9a8..6f305a3 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 _0x699f=['password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x185087,_0x3cac31){var _0x31a169=function(_0x3c374c){while(--_0x3c374c){_0x185087['push'](_0x185087['shift']());}};_0x31a169(++_0x3cac31);}(_0x699f,0x1de));var _0xf699=function(_0x3074f3,_0x4f2c03){_0x3074f3=_0x3074f3-0x0;var _0x53f112=_0x699f[_0x3074f3];return _0x53f112;};'use strict';function ZendeskAccount(_0x22f094){this['id']=_0x22f094['id']||0x0;this['name']=_0x22f094[_0xf699('0x0')]||'';this[_0xf699('0x1')]=_0x22f094['username']||'';this[_0xf699('0x2')]=_0x22f094[_0xf699('0x2')]||'';this[_0xf699('0x3')]=_0x22f094[_0xf699('0x3')]||'';this[_0xf699('0x4')]=_0x22f094[_0xf699('0x4')]||'';this[_0xf699('0x5')]=_0x22f094[_0xf699('0x5')]||'';this[_0xf699('0x6')]=_0x22f094[_0xf699('0x6')]||_0xf699('0x7');this[_0xf699('0x8')]=_0x22f094[_0xf699('0x8')]||'';this[_0xf699('0x9')]=_0x22f094['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0x46c7=['username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x257b51,_0x284ba7){var _0x44ecba=function(_0x453c3d){while(--_0x453c3d){_0x257b51['push'](_0x257b51['shift']());}};_0x44ecba(++_0x284ba7);}(_0x46c7,0xb4));var _0x746c=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x46c7[_0x2d34d6];return _0x1d3d12;};'use strict';function ZendeskAccount(_0x528cde){this['id']=_0x528cde['id']||0x0;this['name']=_0x528cde['name']||'';this[_0x746c('0x0')]=_0x528cde[_0x746c('0x0')]||'';this[_0x746c('0x1')]=_0x528cde[_0x746c('0x1')]||'';this['token']=_0x528cde[_0x746c('0x2')]||'';this[_0x746c('0x3')]=_0x528cde[_0x746c('0x3')]||'';this[_0x746c('0x4')]=_0x528cde[_0x746c('0x4')]||'';this[_0x746c('0x5')]=_0x528cde[_0x746c('0x5')]||_0x746c('0x6');this[_0x746c('0x7')]=_0x528cde[_0x746c('0x7')]||'';this[_0x746c('0x8')]=_0x528cde[_0x746c('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 1a81390..ce2a8b8 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 _0xe65e=['zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host'];(function(_0x2f1ff5,_0x4602a2){var _0x3f2d07=function(_0x1ac968){while(--_0x1ac968){_0x2f1ff5['push'](_0x2f1ff5['shift']());}};_0x3f2d07(++_0x4602a2);}(_0xe65e,0x1d6));var _0xee65=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xe65e[_0x5a95fa];return _0x1a61b8;};'use strict';function ZohoAccount(_0x271ad7){this['id']=_0x271ad7['id']||0x0;this['name']=_0x271ad7[_0xee65('0x0')]||'';this[_0xee65('0x1')]=_0x271ad7[_0xee65('0x1')]||'';this[_0xee65('0x2')]=_0x271ad7[_0xee65('0x2')]||'';this['zone']=_0x271ad7[_0xee65('0x3')]||'';this[_0xee65('0x4')]=_0x271ad7[_0xee65('0x4')]||'';this[_0xee65('0x5')]=_0x271ad7[_0xee65('0x5')]||'';this[_0xee65('0x6')]=_0x271ad7[_0xee65('0x6')]||'';this[_0xee65('0x7')]=_0x271ad7[_0xee65('0x7')]||'';this[_0xee65('0x8')]=_0x271ad7['refreshToken']||'';this['Configurations']=_0x271ad7[_0xee65('0x9')]||{};}module[_0xee65('0xa')]=ZohoAccount; \ No newline at end of file +var _0xc321=['exports','name','description','host','zone','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x441f7a,_0x576321){var _0x4821da=function(_0x5c5b52){while(--_0x5c5b52){_0x441f7a['push'](_0x441f7a['shift']());}};_0x4821da(++_0x576321);}(_0xc321,0x1eb));var _0x1c32=function(_0x4af534,_0x271c55){_0x4af534=_0x4af534-0x0;var _0x29eda7=_0xc321[_0x4af534];return _0x29eda7;};'use strict';function ZohoAccount(_0x4bab36){this['id']=_0x4bab36['id']||0x0;this[_0x1c32('0x0')]=_0x4bab36[_0x1c32('0x0')]||'';this[_0x1c32('0x1')]=_0x4bab36[_0x1c32('0x1')]||'';this[_0x1c32('0x2')]=_0x4bab36['host']||'';this[_0x1c32('0x3')]=_0x4bab36[_0x1c32('0x3')]||'';this['clientId']=_0x4bab36['clientId']||'';this[_0x1c32('0x4')]=_0x4bab36[_0x1c32('0x4')]||'';this[_0x1c32('0x5')]=_0x4bab36[_0x1c32('0x5')]||'';this[_0x1c32('0x6')]=_0x4bab36[_0x1c32('0x6')]||'';this['refreshToken']=_0x4bab36[_0x1c32('0x7')]||'';this[_0x1c32('0x8')]=_0x4bab36[_0x1c32('0x8')]||{};}module[_0x1c32('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 7217e64..eeef486 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 _0x29db=['campaigntype','membername','Agent','name','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','moment','isNil','string','uniqueid','idContact','queue','type'];(function(_0x4e9a52,_0x25b20d){var _0x2d425f=function(_0x4f2157){while(--_0x4f2157){_0x4e9a52['push'](_0x4e9a52['shift']());}};_0x2d425f(++_0x25b20d);}(_0x29db,0x1d2));var _0xb29d=function(_0x378e97,_0x3a014a){_0x378e97=_0x378e97-0x0;var _0x326d6e=_0x29db[_0x378e97];return _0x326d6e;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xb29d('0x0'));function checkNameSurname(_0x59cdf3,_0x1b2f65,_0x5befdc){var _0x4fdc1e='';if(!_[_0xb29d('0x1')](_0x1b2f65)&&_0xb29d('0x2')===typeof _0x1b2f65){_0x4fdc1e+=_0x1b2f65;}if(!_[_0xb29d('0x1')](_0x5befdc)&&'string'===typeof _0x5befdc){_0x4fdc1e+='\x20'+_0x5befdc;}if(_0x4fdc1e!==''){return _0x4fdc1e;}return _0x59cdf3;}function Action(_0xc89afb,_0x52b6aa,_0x393cca,_0x3ee8d5,_0x4d97cf){this[_0xb29d('0x3')]=_0x393cca||undefined;this[_0xb29d('0x4')]=_0xc89afb['id'];this[_0xb29d('0x5')]=_0x52b6aa['name'];this['type']=_0x52b6aa[_0xb29d('0x6')];this[_0xb29d('0x7')]='queue';this['dialAnswer']=![];this[_0xb29d('0x8')]=_[_0xb29d('0x1')](_0xc89afb[_0xb29d('0x9')])?undefined:_0xc89afb[_0xb29d('0x9')][_0xb29d('0xa')];this[_0xb29d('0xb')]=this[_0xb29d('0x8')]?util[_0xb29d('0xc')](_0xb29d('0xd'),this['membername']):_0x3ee8d5||undefined;this[_0xb29d('0xe')]=checkNameSurname(_0xc89afb[_0xb29d('0xf')][_0xb29d('0x10')],_0xc89afb[_0xb29d('0xf')]['firstName'],_0xc89afb['Contact'][_0xb29d('0x11')]);this[_0xb29d('0x12')]=_0xc89afb[_0xb29d('0x12')]||![];this[_0xb29d('0x13')]=_0xc89afb['Contact']['phone'];this['scheduledat']=_0xc89afb['scheduledat'];this[_0xb29d('0x14')]=_0xc89afb[_0xb29d('0x14')]||0x0;this[_0xb29d('0x15')]=_0xc89afb[_0xb29d('0x15')]||0x0;this[_0xb29d('0x16')]=_0xc89afb[_0xb29d('0x16')]||0x0;this[_0xb29d('0x17')]=(_0xc89afb[_0xb29d('0x14')]||0x0)+(_0xc89afb[_0xb29d('0x15')]||0x0)+(_0xc89afb[_0xb29d('0x16')]||0x0)+(_0xc89afb['countnosuchnumberretry']||0x0)+(_0xc89afb[_0xb29d('0x18')]||0x0)+(_0xc89afb['countabandonedretry']||0x0)+(_0xc89afb[_0xb29d('0x19')]||0x0)+(_0xc89afb[_0xb29d('0x1a')]||0x0);this[_0xb29d('0x1b')]=_0xc89afb[_0xb29d('0x1b')]||0x0;this[_0xb29d('0x18')]=_0xc89afb['countdropretry']||0x0;this[_0xb29d('0x1c')]=_0xc89afb[_0xb29d('0x1c')]||0x0;this[_0xb29d('0x19')]=_0xc89afb['countmachineretry']||0x0;this[_0xb29d('0x1a')]=_0xc89afb['countagentrejectretry']||0x0;this[_0xb29d('0x1d')]=_0xc89afb[_0xb29d('0x1d')];this[_0xb29d('0x1e')]=_0xc89afb[_0xb29d('0x1e')];this[_0xb29d('0x1f')]=_0xc89afb['callbackat'];this[_0xb29d('0x20')]=_0xc89afb['recallme'];this[_0xb29d('0x21')]=_0xc89afb['ContactId'];this[_0xb29d('0x22')]=_0xc89afb[_0xb29d('0x22')];this[_0xb29d('0x23')]=_[_0xb29d('0x1')](_0xc89afb[_0xb29d('0x9')])?_0xc89afb[_0xb29d('0x23')]:_0xc89afb[_0xb29d('0x9')]['id'];this[_0xb29d('0x24')]=_0xc89afb[_0xb29d('0x24')];this[_0xb29d('0x25')]='';this[_0xb29d('0x26')]='';}Action[_0xb29d('0x27')][_0xb29d('0x28')]=function(){return util[_0xb29d('0xc')](_0xb29d('0x29'),this['calleridname'],this['number']);};module[_0xb29d('0x2a')]=Action; \ No newline at end of file +var _0xab1a=['phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','calleridname','exports','lodash','isNil','string','uniqueid','idContact','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact'];(function(_0xa89092,_0x969f9f){var _0x6949=function(_0x494d17){while(--_0x494d17){_0xa89092['push'](_0xa89092['shift']());}};_0x6949(++_0x969f9f);}(_0xab1a,0xc8));var _0xaab1=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0xab1a[_0x393d69];return _0x3cee37;};'use strict';var util=require('util');var _=require(_0xaab1('0x0'));var moment=require('moment');function checkNameSurname(_0x3cbf80,_0x316d11,_0x2ffb20){var _0x4cf6c9='';if(!_[_0xaab1('0x1')](_0x316d11)&&_0xaab1('0x2')===typeof _0x316d11){_0x4cf6c9+=_0x316d11;}if(!_[_0xaab1('0x1')](_0x2ffb20)&&_0xaab1('0x2')===typeof _0x2ffb20){_0x4cf6c9+='\x20'+_0x2ffb20;}if(_0x4cf6c9!==''){return _0x4cf6c9;}return _0x3cbf80;}function Action(_0x5708dd,_0x2bdb14,_0x39c504,_0xf6e99,_0xcb2ad3){this[_0xaab1('0x3')]=_0x39c504||undefined;this[_0xaab1('0x4')]=_0x5708dd['id'];this['queue']=_0x2bdb14[_0xaab1('0x5')];this[_0xaab1('0x6')]=_0x2bdb14[_0xaab1('0x6')];this[_0xaab1('0x7')]='queue';this[_0xaab1('0x8')]=![];this[_0xaab1('0x9')]=_[_0xaab1('0x1')](_0x5708dd['Agent'])?undefined:_0x5708dd[_0xaab1('0xa')][_0xaab1('0x5')];this[_0xaab1('0xb')]=this[_0xaab1('0x9')]?util[_0xaab1('0xc')](_0xaab1('0xd'),this[_0xaab1('0x9')]):_0xf6e99||undefined;this['calleridname']=checkNameSurname(_0x5708dd[_0xaab1('0xe')][_0xaab1('0xf')],_0x5708dd[_0xaab1('0xe')][_0xaab1('0x10')],_0x5708dd[_0xaab1('0xe')][_0xaab1('0x11')]);this[_0xaab1('0x12')]=_0x5708dd[_0xaab1('0x12')]||![];this[_0xaab1('0x13')]=_0x5708dd['Contact']['phone'];this[_0xaab1('0x14')]=_0x5708dd[_0xaab1('0x14')];this['countbusyretry']=_0x5708dd[_0xaab1('0x15')]||0x0;this[_0xaab1('0x16')]=_0x5708dd[_0xaab1('0x16')]||0x0;this[_0xaab1('0x17')]=_0x5708dd[_0xaab1('0x17')]||0x0;this[_0xaab1('0x18')]=(_0x5708dd[_0xaab1('0x15')]||0x0)+(_0x5708dd[_0xaab1('0x16')]||0x0)+(_0x5708dd[_0xaab1('0x17')]||0x0)+(_0x5708dd[_0xaab1('0x19')]||0x0)+(_0x5708dd[_0xaab1('0x1a')]||0x0)+(_0x5708dd['countabandonedretry']||0x0)+(_0x5708dd['countmachineretry']||0x0)+(_0x5708dd[_0xaab1('0x1b')]||0x0);this[_0xaab1('0x19')]=_0x5708dd['countnosuchnumberretry']||0x0;this[_0xaab1('0x1a')]=_0x5708dd[_0xaab1('0x1a')]||0x0;this[_0xaab1('0x1c')]=_0x5708dd[_0xaab1('0x1c')]||0x0;this[_0xaab1('0x1d')]=_0x5708dd[_0xaab1('0x1d')]||0x0;this['countagentrejectretry']=_0x5708dd[_0xaab1('0x1b')]||0x0;this[_0xaab1('0x1e')]=_0x5708dd[_0xaab1('0x1e')];this[_0xaab1('0x1f')]=_0x5708dd[_0xaab1('0x1f')];this[_0xaab1('0x20')]=_0x5708dd['callbackat'];this[_0xaab1('0x21')]=_0x5708dd[_0xaab1('0x21')];this[_0xaab1('0x22')]=_0x5708dd['ContactId'];this[_0xaab1('0x23')]=_0x5708dd[_0xaab1('0x23')];this[_0xaab1('0x24')]=_[_0xaab1('0x1')](_0x5708dd[_0xaab1('0xa')])?_0x5708dd[_0xaab1('0x24')]:_0x5708dd['Agent']['id'];this['VoiceQueueId']=_0x5708dd[_0xaab1('0x25')];this['originatecalleridnum']='';this[_0xaab1('0x26')]='';}Action[_0xaab1('0x27')][_0xaab1('0x28')]=function(){return util['format']('\x22%s\x22\x20<%s>',this[_0xaab1('0x29')],this['number']);};module[_0xaab1('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index f9f57c0..dda0fe4 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 _0xf5e7=['Contact.phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Trunk\x20not\x20work]','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridname','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','user:%s','user:agentconnect','accountcode','calleridnum','OriginateError','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','moment','md5','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','defaults','localhost','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','outbound','strategy','answered','sumBillable','sumHoldTime','talking','total','type','unmanaged','abandoned','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','Trunk','callerid','Interval','name','stringify','voice:queue:%s','voice_queue:save','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice_queue_channel:remove','originated','pTalking','paused','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','prototype','hasOwnProperty','booked','clearZombieChannels','setMessage','recallMe','clearZombieChannel','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','then','getDiff','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','sendMessageOneNotActive','IsNotLoggedIn','loggedIn','AGENTS_NOT_LOGGED','isActive','dialActive','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','responsetime','\x20Queue','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','complete','decrementTalkink','countglobal','Answer','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','uniqueid','pTalking:\x20','BUSY','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','NOANSWER','countnoanswerretry','NoAnswer','custom:agentnoanswer','noanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','countagentrejectretry','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','isNil','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','[Preview][execCall][success]','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','unmonitored','run','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid'];(function(_0x329202,_0xaf2193){var _0x28f0d4=function(_0x78a96b){while(--_0x78a96b){_0x329202['push'](_0x329202['shift']());}};_0x28f0d4(++_0xaf2193);}(_0xf5e7,0x191));var _0x7f5e=function(_0x2803dc,_0x1cdaf1){_0x2803dc=_0x2803dc-0x0;var _0x552ae4=_0xf5e7[_0x2803dc];return _0x552ae4;};'use strict';var util=require('util');var _=require(_0x7f5e('0x0'));var BPromise=require(_0x7f5e('0x1'));var uuid=require(_0x7f5e('0x2'));var moment=require(_0x7f5e('0x3'));var md5=require(_0x7f5e('0x4'));var Redis=require(_0x7f5e('0x5'));var config=require(_0x7f5e('0x6'));var logger=require(_0x7f5e('0x7'))(_0x7f5e('0x8'));var loggerAction=require(_0x7f5e('0x7'))(_0x7f5e('0x9'));var ami=require(_0x7f5e('0xa'));var rpcDb=require(_0x7f5e('0xb'));var Action=require('./action');var ut=require(_0x7f5e('0xc'));config[_0x7f5e('0xd')]=_[_0x7f5e('0xe')](config[_0x7f5e('0xd')],{'host':_0x7f5e('0xf'),'port':0x18eb});var io=require(_0x7f5e('0x10'))(new Redis(config[_0x7f5e('0xd')]));var Sequence=function(){};Sequence['prototype'][_0x7f5e('0x11')]=function(_0x16093a){this[_0x7f5e('0x12')]=this['tail']?this[_0x7f5e('0x12')]['finally'](_0x16093a):_0x16093a();};function Preview(_0x8cc58c){this[_0x7f5e('0x13')]=new Sequence();this[_0x7f5e('0x14')]=_0x8cc58c[_0x7f5e('0x15')];this[_0x7f5e('0x16')]=_0x8cc58c[_0x7f5e('0x16')];this[_0x7f5e('0x17')]={};this['agents']=_0x8cc58c[_0x7f5e('0x18')];this[_0x7f5e('0x19')]=0x0;ami['on']('originateresponse',this[_0x7f5e('0x1a')][_0x7f5e('0x1b')](this));ami['on'](_0x7f5e('0x1c'),this[_0x7f5e('0x1d')][_0x7f5e('0x1b')](this));ami['on'](_0x7f5e('0x1e'),this[_0x7f5e('0x1f')][_0x7f5e('0x1b')](this));ami['on'](_0x7f5e('0x20'),this[_0x7f5e('0x21')][_0x7f5e('0x1b')](this));ami['on'](_0x7f5e('0x22'),this[_0x7f5e('0x23')]['bind'](this));ami['on'](_0x7f5e('0x24'),this[_0x7f5e('0x25')][_0x7f5e('0x1b')](this));ami['on'](_0x7f5e('0x26'),this[_0x7f5e('0x27')][_0x7f5e('0x1b')](this));ami['on']('blindtransfer',this[_0x7f5e('0x28')]['bind'](this));this[_0x7f5e('0x29')](this[_0x7f5e('0x14')]);}function emit(_0x377f41,_0x1b0fea,_0x47efc9){io['to'](_0x377f41)[_0x7f5e('0x2a')](_0x1b0fea,_0x47efc9);}function emitCampaignPreview(_0x568dc9){if(_0x568dc9['type']===_0x7f5e('0x2b')){var _0x31b684={'id':_0x568dc9['id'],'name':_0x568dc9['name'],'strategy':_0x568dc9[_0x7f5e('0x2c')],'answered':_0x568dc9[_0x7f5e('0x2d')],'available':_0x568dc9['available'],'loggedIn':_0x568dc9['loggedIn'],'pTalking':_0x568dc9['pTalking'],'sumBillable':_0x568dc9[_0x7f5e('0x2e')],'sumDuration':_0x568dc9['sumDuration'],'sumHoldTime':_0x568dc9[_0x7f5e('0x2f')]||0x0,'talking':_0x568dc9[_0x7f5e('0x30')],'total':_0x568dc9[_0x7f5e('0x31')],'type':_0x568dc9[_0x7f5e('0x32')],'unmanaged':_0x568dc9[_0x7f5e('0x33')],'abandoned':_0x568dc9[_0x7f5e('0x34')],'waiting':_0x568dc9[_0x7f5e('0x35')],'loggedInDb':_0x568dc9[_0x7f5e('0x36')],'dialActive':_0x568dc9['dialActive'],'dialMethod':_0x568dc9[_0x7f5e('0x37')],'dialOriginateCallerIdName':_0x568dc9[_0x7f5e('0x38')],'dialOriginateCallerIdNumber':_0x568dc9[_0x7f5e('0x39')],'dialOriginateTimeout':_0x568dc9['dialOriginateTimeout'],'dialPrefix':_0x568dc9[_0x7f5e('0x3a')],'outboundAnswerAgiCallsDay':_0x568dc9[_0x7f5e('0x3b')],'outboundAnswerCallsDay':_0x568dc9[_0x7f5e('0x3c')],'outboundBlacklistCallsDay':_0x568dc9[_0x7f5e('0x3d')],'outboundBusyCallsDay':_0x568dc9[_0x7f5e('0x3e')],'outboundCongestionCallsDay':_0x568dc9[_0x7f5e('0x3f')],'outboundDropCallsDayACS':_0x568dc9['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x568dc9[_0x7f5e('0x40')],'outboundDropCallsDayTimeout':_0x568dc9[_0x7f5e('0x41')],'outboundNoAnswerCallsDay':_0x568dc9[_0x7f5e('0x42')],'outboundNoSuchCallsDay':_0x568dc9['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x568dc9['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x568dc9[_0x7f5e('0x43')],'outboundRejectCallsDay':_0x568dc9[_0x7f5e('0x44')],'outboundUnknownCallsDay':_0x568dc9[_0x7f5e('0x45')],'outboundAbandonedCallsDay':_0x568dc9['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x568dc9[_0x7f5e('0x46')],'predictiveIntervalAvgHoldtime':_0x568dc9[_0x7f5e('0x47')],'predictiveIntervalAvgTalktime':_0x568dc9['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x568dc9['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x568dc9[_0x7f5e('0x48')],'predictiveIntervalErlangCalls':_0x568dc9[_0x7f5e('0x49')],'predictiveIntervalErlangCallsDroppedCalls':_0x568dc9[_0x7f5e('0x4a')],'predictiveIntervalHitRate':_0x568dc9['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x568dc9[_0x7f5e('0x4b')],'predictiveIntervalPauses':_0x568dc9[_0x7f5e('0x4c')],'predictiveIntervalAvailable':_0x568dc9['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x568dc9[_0x7f5e('0x4d')],'message':_0x568dc9[_0x7f5e('0x4e')],'originated':_0x568dc9['originated'],'erlangCalls':_0x568dc9[_0x7f5e('0x4f')],'erlangCallToSecond':_0x568dc9[_0x7f5e('0x50')],'erlangAbandonmentRate':_0x568dc9[_0x7f5e('0x51')],'erlangBusyFactor':_0x568dc9['erlangBusyFactor'],'startPredictive':_0x568dc9[_0x7f5e('0x52')],'startProgressive':_0x568dc9[_0x7f5e('0x53')]};if(_0x568dc9[_0x7f5e('0x54')]){_0x31b684[_0x7f5e('0x54')]={'id':_0x568dc9[_0x7f5e('0x54')]['id'],'name':_0x568dc9['Trunk']['name'],'active':_0x568dc9[_0x7f5e('0x54')]['active'],'callerid':_0x568dc9[_0x7f5e('0x54')][_0x7f5e('0x55')]};}if(_0x568dc9['Interval']){_0x31b684[_0x7f5e('0x56')]={'id':_0x568dc9[_0x7f5e('0x56')]['id'],'name':_0x568dc9[_0x7f5e('0x56')][_0x7f5e('0x57')]};}var _0x62725f=md5(JSON[_0x7f5e('0x58')](_0x31b684));if(_0x568dc9[_0x7f5e('0x4')]!==_0x62725f){_0x568dc9[_0x7f5e('0x4')]=_0x62725f;emit(util['format'](_0x7f5e('0x59'),_0x31b684[_0x7f5e('0x57')]),_0x7f5e('0x5a'),_0x31b684);}}}function emitVoiceQueueChannelRemove(_0x2b885d){logger['info'](_0x7f5e('0x5b'),JSON[_0x7f5e('0x58')](_0x2b885d));emit(util[_0x7f5e('0x5c')]('voice:queue:%s',_0x2b885d[_0x7f5e('0x57')]),_0x7f5e('0x5d'),_0x2b885d);io['emit']('voice_queue_presence:remove',_0x2b885d);}function notSendMessagesQueue(_0x4f2597){if(_0x4f2597['sendMessageOneNotActive']){if(_0x4f2597[_0x7f5e('0x5e')]===0x0&&_0x4f2597[_0x7f5e('0x5f')]===0x0){_0x4f2597['sendMessageOneNotActive']=![];_0x4f2597['available']=0x0;_0x4f2597[_0x7f5e('0x60')]=0x0;_0x4f2597[_0x7f5e('0x4e')]='NOT_ACTIVE';ut[_0x7f5e('0x61')](_0x7f5e('0x62'),_0x4f2597['name']+_0x7f5e('0x63'));}else{_0x4f2597[_0x7f5e('0x4e')]='IS_DISACTIVED';ut[_0x7f5e('0x61')](_0x7f5e('0x62'),_0x4f2597[_0x7f5e('0x57')]+_0x7f5e('0x64'));}emitCampaignPreview(_0x4f2597);}}Preview[_0x7f5e('0x65')][_0x7f5e('0x29')]=function(){var _0x3a798e=this;setInterval(function(){_0x3a798e['syncCampaigns']();},0x7cf);};Preview[_0x7f5e('0x65')]['syncCampaigns']=function(){var _0x380deb=this[_0x7f5e('0x14')];this[_0x7f5e('0x19')]+=0x1;for(var _0x8b60e2 in _0x380deb){if(_0x380deb[_0x7f5e('0x66')](_0x8b60e2)&&(_0x380deb[_0x8b60e2][_0x7f5e('0x37')]===_0x7f5e('0x8')||_0x380deb[_0x8b60e2]['dialMethod']===_0x7f5e('0x67'))&&_0x380deb[_0x8b60e2][_0x7f5e('0x32')]==='outbound'){if(this[_0x7f5e('0x19')]>0x7){this['clockClearZombieChannels']=0x0;this[_0x7f5e('0x68')]();}}if(_0x380deb[_0x7f5e('0x66')](_0x8b60e2)&&_0x380deb[_0x8b60e2][_0x7f5e('0x37')]===_0x7f5e('0x8')&&_0x380deb[_0x8b60e2][_0x7f5e('0x32')]===_0x7f5e('0x2b')){if(_0x380deb[_0x8b60e2]['dialActive']){this[_0x7f5e('0x69')](_0x380deb[_0x8b60e2]);this[_0x7f5e('0x6a')](_0x380deb[_0x8b60e2]);}else{notSendMessagesQueue(_0x380deb[_0x8b60e2]);}}}};Preview['prototype'][_0x7f5e('0x6b')]=function(_0x178205){var _0x402c52=this;this[_0x7f5e('0x13')][_0x7f5e('0x11')](function(){if(!_['isNil'](_0x402c52[_0x7f5e('0x17')][_0x178205])){loggerAction[_0x7f5e('0x6c')](_0x7f5e('0x6d'),_0x178205,_0x7f5e('0x6e'),_0x402c52['actions'][_0x178205][_0x7f5e('0x6f')],_0x7f5e('0x70'),JSON[_0x7f5e('0x58')](_0x402c52[_0x7f5e('0x14')][_0x402c52[_0x7f5e('0x17')][_0x178205]['queue']][_0x7f5e('0x5e')]),'pTalking:\x20',JSON[_0x7f5e('0x58')](_0x402c52[_0x7f5e('0x14')][_0x402c52['actions'][_0x178205][_0x7f5e('0x6f')]][_0x7f5e('0x5f')]),JSON[_0x7f5e('0x58')](_0x402c52[_0x7f5e('0x17')][_0x178205][_0x7f5e('0x71')]),JSON['stringify'](_[_0x7f5e('0x72')](_0x402c52[_0x7f5e('0x17')][_0x178205],['contactId',_0x7f5e('0x73'),_0x7f5e('0x74'),_0x7f5e('0x75')])));return ami[_0x7f5e('0x76')]({'action':_0x7f5e('0x77'),'channel':_0x402c52[_0x7f5e('0x17')][_0x178205][_0x7f5e('0x78')]})[_0x7f5e('0x79')](function(_0x50e1ca){if(_0x50e1ca['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x402c52[_0x7f5e('0x17')][_0x178205]){ut['updateOriginated'](_0x402c52['campaignsPreview'][_0x402c52[_0x7f5e('0x17')][_0x178205]['queue']],'[clearZombieChannel]');if(_0x402c52[_0x7f5e('0x17')][_0x178205][_0x7f5e('0x71')]===!![]){ut['decrementTalkink'](_0x402c52[_0x7f5e('0x14')][_0x402c52['actions'][_0x178205][_0x7f5e('0x6f')]],'[clearZombieChannel]');ut[_0x7f5e('0x7a')](_0x7f5e('0x7b')+_0x178205,_0x402c52[_0x7f5e('0x17')][_0x178205]['queue']);}ut[_0x7f5e('0x7a')](_0x7f5e('0x7c')+_0x178205,_0x402c52[_0x7f5e('0x17')][_0x178205][_0x7f5e('0x6f')]);delete _0x402c52[_0x7f5e('0x17')][_0x178205];}},0x2328);}});}});};Preview['prototype'][_0x7f5e('0x68')]=function(){var _0x33b919=this;loggerAction[_0x7f5e('0x6c')](_0x7f5e('0x7d'),_[_0x7f5e('0x7e')](this[_0x7f5e('0x17')]));for(var _0x3350d1 in this[_0x7f5e('0x17')]){if(_0x33b919[_0x7f5e('0x17')][_0x7f5e('0x66')](_0x3350d1)){_0x33b919[_0x7f5e('0x6b')](_0x3350d1);}}};Preview['prototype'][_0x7f5e('0x6a')]=function(_0x3a9793){var _0x36b4b0=this;rpcDb[_0x7f5e('0x7f')](_0x3a9793['id'],ut['agentReadyId'](this['agents']))[_0x7f5e('0x80')](function(_0x4190da){if(!_['isNil'](_0x4190da)){for(var _0x4f3ab5=0x0;_0x4f3ab5<_0x4190da['length'];_0x4f3ab5+=0x1){if(ut[_0x7f5e('0x81')](_0x4190da[_0x4f3ab5]['scheduledat'])<_0x3a9793[_0x7f5e('0x82')]*0x3c){if(_0x4190da[_0x4f3ab5][_0x7f5e('0x83')]&&!_0x4190da[_0x4f3ab5][_0x7f5e('0x83')][_0x7f5e('0x84')]){_0x36b4b0['run'](_0x4190da[_0x4f3ab5]['id'])[_0x7f5e('0x80')](ut[_0x7f5e('0x85')]('[RecallMe]'))[_0x7f5e('0x79')](ut[_0x7f5e('0x85')](_0x7f5e('0x86')));}else{rpcDb[_0x7f5e('0x87')](_0x4190da[_0x4f3ab5]['id']);}}else{var _0x561339=new Action(_0x4190da[_0x4f3ab5],_0x3a9793);_0x561339[_0x7f5e('0x88')]=moment()[_0x7f5e('0x5c')](_0x7f5e('0x89'));_0x3a9793[_0x7f5e('0x43')]+=0x1;ut[_0x7f5e('0x8a')](_0x561339,0x17,_0x7f5e('0x8b'));if(_0x3a9793[_0x7f5e('0x8c')]){rpcDb['rescheduleContactInQueue'](ut[_0x7f5e('0x8d')](_0x4190da[_0x4f3ab5]));rpcDb[_0x7f5e('0x8e')](_0x561339,_0x7f5e('0x8f'));}else{ut['logCustomer'](_0x561339,0x16,_0x7f5e('0x90'));rpcDb[_0x7f5e('0x8e')](_0x561339,_0x7f5e('0x91'));rpcDb[_0x7f5e('0x92')](_0x561339,_0x7f5e('0x91'));}}}}})[_0x7f5e('0x79')](ut['logger2'](_0x7f5e('0x93')));};Preview[_0x7f5e('0x65')][_0x7f5e('0x69')]=function(_0x1261e0){_0x1261e0[_0x7f5e('0x94')]=!![];if(ut[_0x7f5e('0x95')](_0x1261e0[_0x7f5e('0x96')])){_0x1261e0[_0x7f5e('0x4e')]=_0x7f5e('0x97');}else if(!ut[_0x7f5e('0x98')](_0x1261e0[_0x7f5e('0x99')])){_0x1261e0['message']=_0x7f5e('0x9a');}else if(!this[_0x7f5e('0x9b')](_0x1261e0[_0x7f5e('0x54')])){if(!this[_0x7f5e('0x9b')](_0x1261e0[_0x7f5e('0x9c')])){_0x1261e0[_0x7f5e('0x4e')]=_0x7f5e('0x9d');}else{_0x1261e0[_0x7f5e('0x4e')]=_0x7f5e('0x9e');}}else{_0x1261e0['message']=_0x7f5e('0x9e');}emitCampaignPreview(_0x1261e0);};Preview[_0x7f5e('0x65')][_0x7f5e('0x9f')]=function(_0x4b4719,_0x348565,_0x14e897){var _0x5079d1=this;var _0x215736=this[_0x7f5e('0x17')][_0x348565];var _0x1d7513=this[_0x7f5e('0x14')][_0x215736[_0x7f5e('0x6f')]];var _0x25b9e0;if(_0x1d7513){switch(_0x14e897){case'1':_0x1d7513[_0x7f5e('0xa0')]+=0x1;_0x215736[_0x7f5e('0xa1')]+=0x1;_0x215736['countglobal']=ut[_0x7f5e('0xa2')](_0x215736);ut[_0x7f5e('0x8a')](_0x215736,0x0,_0x7f5e('0xa3'));ami[_0x7f5e('0x2a')]('custom:agentnosuchnumber',ut[_0x7f5e('0xa4')](_0x215736,_0x7f5e('0xa5')));rpcDb['createCustomerHistory'](_0x215736,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513[_0x7f5e('0xa6')]){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb[_0x7f5e('0x92')](_0x25b9e0,_0x7f5e('0xa9'));}else{if(_0x215736['countnosuchnumberretry']>=_0x1d7513[_0x7f5e('0xaa')]){rpcDb[_0x7f5e('0x92')](_0x215736,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x7f5e('0xab')](ut[_0x7f5e('0xac')](_0x215736,_0x7f5e('0xa1'),_0x1d7513[_0x7f5e('0xad')]),_0x215736[_0x7f5e('0xae')],_0x215736['activeContact']);}}delete this[_0x7f5e('0x17')][_0x4b4719[_0x7f5e('0xaf')]];break;case _0x7f5e('0xb0'):var _0x247224=moment()[_0x7f5e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x215736[_0x7f5e('0xb1')]=_0x247224;_0x215736['answertime']=_0x247224;_0x215736['dialAnswer']=!![];_0x1d7513[_0x7f5e('0x5f')]+=0x1;logger[_0x7f5e('0x6c')]('[syncHangup][talking][increment]',_0x215736['uniqueid'],_0x7f5e('0xb2'),_0x1d7513['name'],'pTalking:\x20',_0x1d7513['pTalking']);ami[_0x7f5e('0x2a')](_0x7f5e('0xb3'),ut['buildObj'](_0x215736,_0x7f5e('0xb4'),this[_0x7f5e('0x14')][_0x215736[_0x7f5e('0x6f')]]));if(_0x1d7513['acw']){ami[_0x7f5e('0x2a')](_0x7f5e('0xb5'),ut[_0x7f5e('0xb6')](_0x215736));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x7f5e('0xa4')](_0x215736,'complete',this['campaignsPreview'][_0x215736[_0x7f5e('0x6f')]]));emitVoiceQueueChannelRemove(ut[_0x7f5e('0xa4')](_0x215736,_0x7f5e('0xb7')));_0x1d7513['outboundAnswerCallsDay']+=0x1;_0x1d7513[_0x7f5e('0x31')]+=0x1;_0x1d7513[_0x7f5e('0x2d')]+=0x1;ut[_0x7f5e('0xb8')](_0x1d7513,'[16]');_0x215736[_0x7f5e('0xb9')]=ut[_0x7f5e('0xa2')](_0x215736);ut['logCustomer'](_0x215736,0x4,_0x7f5e('0xba'));rpcDb[_0x7f5e('0x8e')](_0x215736,'[callProgressDetectingCustomer][logAnswer]');rpcDb[_0x7f5e('0x92')](_0x215736,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x7f5e('0xbb')](_0x215736);_0x1d7513['sumDuration']+=_0x215736[_0x7f5e('0xbc')];_0x1d7513[_0x7f5e('0x2e')]+=_0x215736['talktime'];logger['info'](_0x7f5e('0xbd'),_0x215736[_0x7f5e('0xbe')],_0x7f5e('0xb2'),_0x1d7513[_0x7f5e('0x57')],_0x7f5e('0xbf'),_0x1d7513[_0x7f5e('0x5f')]);delete this['actions'][_0x4b4719['linkedid']];break;case _0x7f5e('0xc0'):_0x1d7513[_0x7f5e('0x3e')]+=0x1;_0x215736[_0x7f5e('0xc1')]+=0x1;_0x215736[_0x7f5e('0xb9')]=ut['totalGlobal'](_0x215736);ut['logCustomer'](_0x215736,0x5,_0x7f5e('0xc2'));ami['emit'](_0x7f5e('0xc3'),ut[_0x7f5e('0xa4')](_0x215736,_0x7f5e('0xc4')));rpcDb[_0x7f5e('0x8e')](_0x215736,_0x7f5e('0xc5'));if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513['dialGlobalMaxRetry']){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb[_0x7f5e('0x92')](_0x25b9e0,_0x7f5e('0xc6'));}else{if(_0x215736[_0x7f5e('0xc1')]>=_0x1d7513[_0x7f5e('0xc7')]){rpcDb[_0x7f5e('0x92')](_0x215736,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0x7f5e('0xac')](_0x215736,_0x7f5e('0xc1'),_0x1d7513[_0x7f5e('0xc8')]),_0x215736[_0x7f5e('0xae')],_0x215736[_0x7f5e('0xc9')]);}}break;case _0x7f5e('0xca'):_0x1d7513[_0x7f5e('0x42')]+=0x1;_0x215736[_0x7f5e('0xcb')]+=0x1;_0x215736[_0x7f5e('0xb9')]=ut['totalGlobal'](_0x215736);ut['logCustomer'](_0x215736,0x3,_0x7f5e('0xcc'));ami[_0x7f5e('0x2a')](_0x7f5e('0xcd'),ut[_0x7f5e('0xa4')](_0x215736,_0x7f5e('0xce')));rpcDb['createCustomerHistory'](_0x215736,_0x7f5e('0xcf'));if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513[_0x7f5e('0xa6')]){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb['createCustomerFinal'](_0x25b9e0,_0x7f5e('0xd0'));}else{if(_0x215736['countnoanswerretry']>=_0x1d7513['dialNoAnswerMaxRetry']){rpcDb[_0x7f5e('0x92')](_0x215736,_0x7f5e('0xcf'));}else{rpcDb[_0x7f5e('0xab')](ut['scheduledAt'](_0x215736,_0x7f5e('0xcb'),_0x1d7513[_0x7f5e('0xd1')]),_0x215736[_0x7f5e('0xae')],_0x215736['activeContact']);}}break;case _0x7f5e('0xd2'):_0x1d7513[_0x7f5e('0x3f')]+=0x1;_0x215736[_0x7f5e('0xd3')]+=0x1;_0x215736[_0x7f5e('0xb9')]=ut[_0x7f5e('0xa2')](_0x215736);ut[_0x7f5e('0x8a')](_0x215736,0x8,_0x7f5e('0xd4'));ami[_0x7f5e('0x2a')](_0x7f5e('0xd5'),ut[_0x7f5e('0xa4')](_0x215736,'congestion'));rpcDb[_0x7f5e('0x8e')](_0x215736,_0x7f5e('0xd6'));if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513[_0x7f5e('0xa6')]){_0x25b9e0=ut['cloneAction'](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb[_0x7f5e('0x92')](_0x25b9e0,_0x7f5e('0xd7'));}else{if(_0x215736['countcongestionretry']>=_0x1d7513[_0x7f5e('0xd8')]){rpcDb['createCustomerFinal'](_0x215736,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x7f5e('0xac')](_0x215736,'countcongestionretry',_0x1d7513[_0x7f5e('0xc8')]),_0x215736['unlockAgent'],_0x215736[_0x7f5e('0xc9')]);}}break;case _0x7f5e('0xd9'):_0x1d7513['outboundRejectCallsDay']+=0x1;_0x215736[_0x7f5e('0xda')]+=0x1;_0x215736[_0x7f5e('0xb9')]=ut[_0x7f5e('0xa2')](_0x215736);ut['logCustomer'](_0x215736,0x14,_0x7f5e('0xdb'));ami['emit']('custom:agentreject',ut['buildObj'](_0x215736,_0x7f5e('0xdc')));rpcDb[_0x7f5e('0x8e')](_0x215736,_0x7f5e('0xdd'));if(ut['totalGlobal'](_0x215736)>=_0x1d7513[_0x7f5e('0xa6')]){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0x14,_0x7f5e('0xdb'));rpcDb[_0x7f5e('0x92')](_0x25b9e0,_0x7f5e('0xde'));}else{if(_0x215736[_0x7f5e('0xda')]>=_0x1d7513[_0x7f5e('0xdf')]){rpcDb[_0x7f5e('0x92')](_0x215736,_0x7f5e('0xde'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x215736,_0x7f5e('0xda'),_0x1d7513[_0x7f5e('0xe0')]),_0x215736[_0x7f5e('0xae')],_0x215736['activeContact']);}}break;case _0x7f5e('0xe1'):_0x1d7513[_0x7f5e('0xe2')]+=0x1;_0x215736['countabandonedretry']+=0x1;_0x215736[_0x7f5e('0xb9')]=ut[_0x7f5e('0xa2')](_0x215736);ut[_0x7f5e('0x8a')](_0x215736,0xb,'Abandoned');rpcDb[_0x7f5e('0x8e')](_0x215736,'[callProgressDetectingCustomer][logAbandoned]');if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513[_0x7f5e('0xa6')]){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb[_0x7f5e('0x92')](_0x25b9e0,_0x7f5e('0xe3'));}else{if(_0x215736[_0x7f5e('0xe4')]>=_0x1d7513[_0x7f5e('0xe5')]){rpcDb[_0x7f5e('0x92')](_0x215736,_0x7f5e('0xe3'));}else{rpcDb['rescheduleContact'](ut[_0x7f5e('0xac')](_0x215736,_0x7f5e('0xe6'),_0x1d7513[_0x7f5e('0xe7')]),_0x215736[_0x7f5e('0xae')],_0x215736[_0x7f5e('0xc9')]);}}break;case'18':_0x1d7513[_0x7f5e('0x45')]+=0x1;_0x215736[_0x7f5e('0xe8')]+=0x1;_0x215736[_0x7f5e('0xb9')]=ut[_0x7f5e('0xa2')](_0x215736);ut['logCustomer'](_0x215736,0x12,_0x4b4719[_0x7f5e('0xe9')]||_0x4b4719[_0x7f5e('0xea')]);ami[_0x7f5e('0x2a')](_0x7f5e('0xeb'),ut[_0x7f5e('0xa4')](_0x215736,_0x7f5e('0xec')));rpcDb[_0x7f5e('0x8e')](_0x215736,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513['dialGlobalMaxRetry']){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb[_0x7f5e('0x92')](_0x25b9e0,_0x7f5e('0xed'));}else{rpcDb[_0x7f5e('0x92')](_0x215736,_0x7f5e('0xed'));}delete this[_0x7f5e('0x17')][_0x4b4719[_0x7f5e('0xaf')]];break;case'19':_0x1d7513['outboundUnknownCallsDay']+=0x1;_0x215736['countglobal']=ut['totalGlobal'](_0x215736);ut[_0x7f5e('0x8a')](_0x215736,0x13,_0x4b4719[_0x7f5e('0xe9')]||_0x4b4719[_0x7f5e('0xea')]);ami[_0x7f5e('0x2a')](_0x7f5e('0xeb'),ut['buildObj'](_0x215736,'amd'));rpcDb[_0x7f5e('0x8e')](_0x215736,_0x7f5e('0xee'));if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513[_0x7f5e('0xa6')]){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb[_0x7f5e('0x92')](_0x25b9e0,_0x7f5e('0xee'));}else{rpcDb['createCustomerFinal'](_0x215736,_0x7f5e('0xee'));}delete this[_0x7f5e('0x17')][_0x4b4719[_0x7f5e('0xaf')]];break;default:if(_0x215736['dialAnswer']){ut[_0x7f5e('0xb8')](_0x1d7513,_0x7f5e('0xef'));ut['loggerError'](_0x7f5e('0xf0')+_0x1d7513[_0x7f5e('0x57')],_0x4b4719);}_0x1d7513[_0x7f5e('0x45')]+=0x1;_0x215736[_0x7f5e('0xb9')]=ut[_0x7f5e('0xa2')](_0x215736);ut[_0x7f5e('0x8a')](_0x215736,0xc,_0x4b4719[_0x7f5e('0xe9')]||_0x4b4719['dialstatus']);rpcDb['createCustomerHistory'](_0x215736,_0x7f5e('0xf1'));if(ut[_0x7f5e('0xa2')](_0x215736)>=_0x1d7513['dialGlobalMaxRetry']){_0x25b9e0=ut[_0x7f5e('0xa7')](_0x215736,0xf,_0x7f5e('0xa8'));rpcDb['createCustomerFinal'](_0x25b9e0,_0x7f5e('0xf2'));}else{rpcDb[_0x7f5e('0x92')](_0x215736,_0x7f5e('0xf2'));}delete this['actions'][_0x4b4719['linkedid']];}if(!(_0x215736[_0x7f5e('0x71')]&&_0x14e897==='16')){ut[_0x7f5e('0xf3')](_0x1d7513,_0x7f5e('0xf4'));logger[_0x7f5e('0x6c')]('[originated][decrement][callProgressDetectingCustomer]',_0x215736[_0x7f5e('0xbe')],_0x7f5e('0xb2'),_0x1d7513['name'],_0x7f5e('0x70'),_0x1d7513[_0x7f5e('0x5e')]);}if(_0x14e897!==_0x7f5e('0xb0')){delete this[_0x7f5e('0x17')][_0x4b4719[_0x7f5e('0xaf')]];delete this[_0x7f5e('0x17')][_0x4b4719['destlinkedid']];}}};Preview['prototype'][_0x7f5e('0xf5')]=function(_0x14a128,_0x21e918,_0x381a7d){if(_[_0x7f5e('0xf6')](_0x21e918)&&'object'!==typeof _0x21e918){return;}if(_[_0x7f5e('0xf6')](_0x381a7d)&&_0x7f5e('0xf7')!==typeof _0x381a7d){return;}switch(_0x381a7d[_0x7f5e('0xf8')]){case'0':ut['logAgent'](_0x14a128,0x0,_0x7f5e('0xa3'));rpcDb[_0x7f5e('0xf9')](_0x14a128,_0x7f5e('0xfa'));break;case'3':ut[_0x7f5e('0xfb')](_0x14a128,0x3,_0x7f5e('0xcc'));rpcDb['createAgentHistory'](_0x14a128,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x7f5e('0xfb')](_0x14a128,0x5,'Busy');rpcDb[_0x7f5e('0xf9')](_0x14a128,_0x7f5e('0xfc'));break;case'8':ut[_0x7f5e('0xfb')](_0x14a128,0x8,'Congestion');rpcDb['createAgentHistory'](_0x14a128,_0x7f5e('0xfd'));break;case'22':ut['logAgent'](_0x14a128,0x16,_0x7f5e('0xfe'));rpcDb[_0x7f5e('0xf9')](_0x14a128,_0x7f5e('0xff'));break;default:ut[_0x7f5e('0xfb')](_0x14a128,0xc,_0x381a7d[_0x7f5e('0xf8')]);rpcDb[_0x7f5e('0xf9')](_0x14a128,'[callProgressDetectingAgent][logCongestion]');}ut['updateOriginated'](_0x21e918,'[callProgressDetectingAgent]');logger[_0x7f5e('0x6c')](_0x7f5e('0x100'),_0x14a128['uniqueid'],'\x20Queue',_0x21e918[_0x7f5e('0x57')],_0x7f5e('0x70'),_0x21e918['originated']);delete this[_0x7f5e('0x17')][_0x14a128[_0x7f5e('0xbe')]];};Preview[_0x7f5e('0x65')]['checkInBlack']=function(_0x5e3b93,_0x31a43a,_0x3592b8,_0x2e24ff,_0x781b92){var _0x21e667=this;return new BPromise(function(_0x11dfed,_0x3d2e16){if(_['isNil'](_0x31a43a)||_[_0x7f5e('0x101')](_0x31a43a['Contact'])||_[_0x7f5e('0x101')](_0x31a43a[_0x7f5e('0x102')][_0x7f5e('0x103')])||_[_0x7f5e('0x101')](_0x31a43a[_0x7f5e('0x74')])){_0x3d2e16(ut[_0x7f5e('0x4e')](_0x7f5e('0x104'),_0x2e24ff,_0x781b92));return;}var _0x44ea1c=uuid['v4']();var _0x254e24=_0x21e667[_0x7f5e('0x14')][_0x31a43a['Queue']['name']];var _0x410891=_0x3592b8?_0x21e667[_0x7f5e('0x18')][_0x3592b8]['id']:undefined;_0x21e667[_0x7f5e('0x17')][_0x44ea1c]=new Action(_0x31a43a,_0x254e24,_0x44ea1c,_0x3592b8,_0x410891);var _0x245a36=_0x21e667[_0x7f5e('0x17')][_0x44ea1c];_0x245a36[_0x7f5e('0xae')]=_0x2e24ff;_0x245a36[_0x7f5e('0xc9')]=_0x781b92;_0x245a36[_0x7f5e('0x105')]=_0x3592b8;if(_[_0x7f5e('0x106')](_0x5e3b93)){_0x21e667['execCall'](_0x245a36,_0x254e24,_0x31a43a,_0x3592b8)[_0x7f5e('0x80')](function(_0x47fede){logger[_0x7f5e('0x6c')](_0x7f5e('0x107'),'Queue:\x20'+_0x245a36[_0x7f5e('0x6f')]+_0x7f5e('0x108')+_0x245a36[_0x7f5e('0x109')],JSON[_0x7f5e('0x58')](_0x47fede));ami[_0x7f5e('0x2a')](_0x7f5e('0x10a'),ut[_0x7f5e('0xa4')](_0x245a36,_0x7f5e('0x10b'),_0x21e667[_0x7f5e('0x14')][_0x245a36['queue']]));_0x11dfed(ut[_0x7f5e('0x4e')](_0x7f5e('0x10c')));})[_0x7f5e('0x79')](function(_0x355699){ut[_0x7f5e('0x61')](_0x7f5e('0x10d'),_0x355699);_0x3d2e16(ut[_0x7f5e('0x4e')](_0x7f5e('0x10e'),_0x2e24ff,_0x781b92));});}else{_0x254e24[_0x7f5e('0x3d')]+=0x1;ut[_0x7f5e('0x10f')](_0x245a36);rpcDb[_0x7f5e('0x110')](_0x245a36,'[Blacklist][error]');delete _0x21e667['actions'][_0x44ea1c];_0x3d2e16(ut[_0x7f5e('0x4e')](_0x7f5e('0x111'),_0x2e24ff,_0x781b92));}});};Preview[_0x7f5e('0x65')][_0x7f5e('0x9b')]=function(_0x3b78e7){return!_[_0x7f5e('0x101')](_0x3b78e7)&&!_[_0x7f5e('0x101')](_0x3b78e7['name'])&&!_[_0x7f5e('0x101')](_0x3b78e7['active'])&&_0x3b78e7[_0x7f5e('0x112')]&&!_[_0x7f5e('0x101')](this[_0x7f5e('0x16')][util[_0x7f5e('0x5c')](_0x7f5e('0x113'),_0x3b78e7[_0x7f5e('0x57')])])&&!_[_0x7f5e('0x101')](this['trunks'][util[_0x7f5e('0x5c')]('SIP/%s',_0x3b78e7[_0x7f5e('0x57')])][_0x7f5e('0x77')])&&(this['trunks'][util['format'](_0x7f5e('0x113'),_0x3b78e7[_0x7f5e('0x57')])][_0x7f5e('0x77')]==='reachable'||this[_0x7f5e('0x16')][util[_0x7f5e('0x5c')](_0x7f5e('0x113'),_0x3b78e7[_0x7f5e('0x57')])][_0x7f5e('0x77')]===_0x7f5e('0x114'));};Preview[_0x7f5e('0x65')][_0x7f5e('0x115')]=function(_0xcdbb70,_0x39ffb4){var _0x21d328=this;return new BPromise(function(_0x44dcdc,_0x31de71){_0x21d328['execRun'](_0xcdbb70,_0x39ffb4)[_0x7f5e('0x80')](function(_0x7329d2){_0x44dcdc(_[_0x7f5e('0x72')](_0x7329d2,[_0x7f5e('0x4e')]));})[_0x7f5e('0x79')](function(_0x4c1260){if(_0x4c1260[_0x7f5e('0x116')]){rpcDb[_0x7f5e('0x117')](_0xcdbb70);}if(_0x4c1260[_0x7f5e('0x112')]){rpcDb[_0x7f5e('0x87')](_0xcdbb70);}_0x31de71(_['pick'](_0x4c1260,[_0x7f5e('0x4e')]));});});};Preview[_0x7f5e('0x65')][_0x7f5e('0x118')]=function(_0x353fc3,_0x4b0b9c){var _0x1049ff=this;return new BPromise(function(_0x19f513,_0x2b6fae){var _0x2577be,_0x17647a;rpcDb[_0x7f5e('0x119')](_0x353fc3)[_0x7f5e('0x80')](function(_0x2ca650){if(!_['isNil'](_0x2ca650[0x0])){_0x17647a=_0x2ca650[0x0][_0x7f5e('0x11a')]?![]:!![];_0x2577be=_0x2ca650[0x0][_0x7f5e('0x11a')]?!![]:![];_0x2577be=_0x4b0b9c?!![]:_0x2577be;}var _0x249c0c=_0x1049ff[_0x7f5e('0x11b')](_0x2ca650);if(_0x249c0c[_0x7f5e('0x11c')]){rpcDb['checkIsBlackList'](_['pick'](_0x2ca650[0x0],[_0x7f5e('0x74'),_0x7f5e('0x11d')]))['then'](function(_0x38b558){_0x1049ff[_0x7f5e('0x11e')](_0x38b558,_0x2ca650[0x0],_0x4b0b9c,_0x17647a,_0x2577be)[_0x7f5e('0x80')](function(_0x4d4cf3){_0x19f513(_0x4d4cf3);})[_0x7f5e('0x79')](function(_0x15596a){_0x2b6fae(_0x15596a);});})[_0x7f5e('0x79')](function(_0x579d77){ut[_0x7f5e('0x61')](_0x7f5e('0x11f'),_0x579d77);_0x2b6fae(ut[_0x7f5e('0x4e')](_0x7f5e('0x120'),_0x17647a,_0x2577be));});}else{_0x2b6fae(ut[_0x7f5e('0x4e')](_0x249c0c[_0x7f5e('0x4e')],_0x17647a,_0x2577be));}})[_0x7f5e('0x79')](function(_0x10ab0e){ut[_0x7f5e('0x61')](_0x7f5e('0x121'),_0x10ab0e);_0x2b6fae(ut['message'](_0x7f5e('0x120'),![],!![]));});});};Preview[_0x7f5e('0x65')][_0x7f5e('0x11b')]=function(_0x2a5a39){if(_[_0x7f5e('0x101')](_0x2a5a39)||_[_0x7f5e('0x106')](_0x2a5a39)||!_[_0x7f5e('0x101')](_0x2a5a39[0x0][_0x7f5e('0x83')])&&_[_0x7f5e('0x101')](_0x2a5a39[0x0]['Agent']['name'])){ut[_0x7f5e('0x61')](_0x7f5e('0x122'),_0x2a5a39);return{'isValid':![],'message':_0x7f5e('0x123')};}var _0x2cecda=this['campaignsPreview'][_0x2a5a39[0x0]['Queue'][_0x7f5e('0x57')]];_0x2cecda['message']=_0x7f5e('0x9e');if(_[_0x7f5e('0x101')](_0x2cecda)){ut[_0x7f5e('0x61')]('[Preview][validateContact][Empty\x20Campaign]',_0x2cecda);return{'isValid':![],'message':_0x7f5e('0x124')};}if(!this[_0x7f5e('0x9b')](_0x2cecda[_0x7f5e('0x54')])){ut[_0x7f5e('0x61')]('[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20'+_0x2cecda[_0x7f5e('0x57')]+_0x7f5e('0x125'));if(!this[_0x7f5e('0x9b')](_0x2cecda[_0x7f5e('0x9c')])){ut[_0x7f5e('0x61')](_0x7f5e('0x126'),_0x2cecda[_0x7f5e('0x57')]+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':_0x7f5e('0x127')};}}if(!ut['isActive'](_0x2cecda[_0x7f5e('0x99')])){ut['logger'](_0x7f5e('0x128'),_0x2cecda[_0x7f5e('0x57')]+_0x7f5e('0x129'));return{'isValid':![],'message':_0x7f5e('0x12a')+_0x2cecda[_0x7f5e('0x57')]+_0x7f5e('0x129')};}return{'isValid':!![],'message':_0x7f5e('0x12b')};};Preview['prototype']['execCall']=function(_0x3b93df,_0x17bb90,_0x3363ed,_0x19d054){var _0x73654=this;return new BPromise(function(_0x4496e1,_0x44c6f6){var _0x4efc88=_0x3b93df['uniqueid'];var _0x21d34a=_0x73654['isTrunkReachable'](_0x17bb90[_0x7f5e('0x54')])?util[_0x7f5e('0x5c')](_0x7f5e('0x12c'),_0x17bb90['Trunk'][_0x7f5e('0x57')],_[_0x7f5e('0x101')](_0x17bb90['dialPrefix'])?'':_0x17bb90['dialPrefix'][_0x7f5e('0x12d')]()||'',_0x17bb90[_0x7f5e('0x12e')]>0x0?_0x3363ed['Contact']['phone'][_0x7f5e('0x12f')](_0x17bb90[_0x7f5e('0x12e')]):_0x3363ed[_0x7f5e('0x102')][_0x7f5e('0x103')]):util[_0x7f5e('0x5c')](_0x7f5e('0x12c'),_['isNil'](_0x17bb90[_0x7f5e('0x9c')])?_0x17bb90[_0x7f5e('0x54')]['name']:_0x17bb90[_0x7f5e('0x9c')]['name'],_[_0x7f5e('0x101')](_0x17bb90[_0x7f5e('0x3a')])?'':_0x17bb90['dialPrefix']['trim']()||'',_0x17bb90[_0x7f5e('0x12e')]>0x0?_0x3363ed[_0x7f5e('0x102')][_0x7f5e('0x103')][_0x7f5e('0x12f')](_0x17bb90[_0x7f5e('0x12e')]):_0x3363ed['Contact']['phone']);var _0x1e9356=_0x73654[_0x7f5e('0x9b')](_0x17bb90['Trunk'])?ut['getCallerId'](_0x17bb90[_0x7f5e('0x54')]['callerid'],_0x17bb90['dialOriginateCallerIdName'],_0x17bb90[_0x7f5e('0x130')]>0x0?ut[_0x7f5e('0x131')](_0x17bb90['dialOriginateCallerIdNumber'],_0x17bb90['dialRandomLastDigitCallerIdNumber']):_0x17bb90['dialOriginateCallerIdNumber']):ut[_0x7f5e('0x132')](_['isNil'](_0x17bb90[_0x7f5e('0x9c')])?_0x17bb90[_0x7f5e('0x54')][_0x7f5e('0x55')]:_0x17bb90['TrunkBackup'][_0x7f5e('0x55')],_0x17bb90[_0x7f5e('0x38')],_0x17bb90[_0x7f5e('0x130')]>0x0?ut['getCallerIdRandom'](_0x17bb90[_0x7f5e('0x39')],_0x17bb90[_0x7f5e('0x130')]):_0x17bb90['dialOriginateCallerIdNumber']);if(_0x1e9356){_0x3b93df[_0x7f5e('0x133')]=ut['extractCalleridName'](_0x1e9356);_0x3b93df[_0x7f5e('0x134')]=ut[_0x7f5e('0x135')](_0x1e9356);}var _0x38730d=ut[_0x7f5e('0x136')](_0x17bb90,_0x3363ed,_0x21d34a,_0x1e9356,_0x4efc88,_0x3b93df);_[_0x7f5e('0x137')](_0x3b93df,ut[_0x7f5e('0x138')](_0x38730d));_0x3b93df['starttime']=moment()[_0x7f5e('0x5c')](_0x7f5e('0x89'));ami['Action'](ut[_0x7f5e('0x139')](_0x3b93df,_0x17bb90,_0x38730d,_0x3b93df[_0x7f5e('0xc9')],_0x19d054))[_0x7f5e('0x80')](function(_0x1bf436){var _0x9c83d1=_0x3b93df['channelAgent'];if(!_[_0x7f5e('0x101')](_0x9c83d1)){if(!_['isNil'](_0x73654[_0x7f5e('0x18')][_0x9c83d1])){_0x73654[_0x7f5e('0x18')][_0x9c83d1]['destconnectedlinenum']=_0x3b93df['calleridnum'];emit(util['format'](_0x7f5e('0x13a'),_0x73654[_0x7f5e('0x18')][_0x9c83d1][_0x7f5e('0x57')]),_0x7f5e('0x13b'),{'destaccountcode':_0x73654[_0x7f5e('0x18')][_0x9c83d1][_0x7f5e('0x13c')],'destconnectedlinenum':_0x3b93df[_0x7f5e('0x13d')]});}}_0x17bb90[_0x7f5e('0x5e')]+=0x1;logger[_0x7f5e('0x6c')]('[originated][increment]',_0x4efc88,_0x7f5e('0xb2'),_0x17bb90[_0x7f5e('0x57')],_0x7f5e('0x70'),_0x17bb90[_0x7f5e('0x5e')]);_0x4496e1(_0x1bf436);})[_0x7f5e('0x79')](function(_0x1df349){ut[_0x7f5e('0xfb')](_0x3b93df,0xe,_0x7f5e('0x13e'));rpcDb[_0x7f5e('0xf9')](_0x3b93df,_0x7f5e('0x13f'));_0x44c6f6(_0x1df349);});});};Preview[_0x7f5e('0x65')][_0x7f5e('0x23')]=function(_0x4cb20d){if(this[_0x7f5e('0x17')][_0x4cb20d[_0x7f5e('0xaf')]]){this[_0x7f5e('0x17')][_0x4cb20d[_0x7f5e('0xaf')]][_0x7f5e('0x78')]=_0x4cb20d[_0x7f5e('0x78')];}};Preview['prototype']['syncOriginateResponse']=function(_0x254fc4){var _0x4f0e6e=this;var _0x5017a4=this[_0x7f5e('0x17')][_0x254fc4['actionid']];if(_0x5017a4){if(_0x5017a4[_0x7f5e('0x105')]&&this[_0x7f5e('0x18')][_0x5017a4[_0x7f5e('0x105')]]){ut[_0x7f5e('0x140')](_0x5017a4,this['agents'][_0x5017a4[_0x7f5e('0x105')]][_0x7f5e('0x57')],this[_0x7f5e('0x18')][_0x5017a4[_0x7f5e('0x105')]]['id']);}var _0x28be1f=_[_0x7f5e('0x141')](_0x5017a4);_0x28be1f[_0x7f5e('0xb1')]=moment()[_0x7f5e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');var _0xf0c6de=_0x4f0e6e[_0x7f5e('0x14')][_0x5017a4[_0x7f5e('0x6f')]];if(ut[_0x7f5e('0x142')](_0x254fc4[_0x7f5e('0x143')])){if(_0x5017a4['unlockAgent']){rpcDb[_0x7f5e('0x117')](_0x5017a4[_0x7f5e('0x109')]);}if(_0x5017a4[_0x7f5e('0xc9')]){rpcDb[_0x7f5e('0x87')](_0x5017a4[_0x7f5e('0x109')]);}ami['emit'](_0x7f5e('0x144'),ut['buildObj'](_0x5017a4,'rejected',this['campaignsPreview'][_0x5017a4['queue']]));this[_0x7f5e('0xf5')](_0x28be1f,_0xf0c6de,_0x254fc4);}else{_0x5017a4[_0x7f5e('0x88')]=moment()[_0x7f5e('0x5c')](_0x7f5e('0x89'));ut[_0x7f5e('0xfb')](_0x28be1f,0x4,_0x7f5e('0xba'));rpcDb[_0x7f5e('0xf9')](_0x28be1f,_0x7f5e('0x145'));}}};Preview[_0x7f5e('0x65')][_0x7f5e('0x1d')]=function(_0x31cc1f){var _0x57dbd9=this;var _0x4db9b5=this['actions'][_0x31cc1f[_0x7f5e('0xaf')]];var _0x1c0115;if(_0x4db9b5){_0x1c0115=this[_0x7f5e('0x14')][_0x4db9b5['queue']];logger[_0x7f5e('0x6c')]('[syncHangup][talking]',_0x31cc1f[_0x7f5e('0xaf')],_0x7f5e('0xb2'),_0x1c0115['name'],_0x7f5e('0xbf'),_0x1c0115['pTalking']);}if(this['actions'][_0x31cc1f[_0x7f5e('0xaf')]]&&_0x31cc1f[_0x7f5e('0xaf')]!==_0x31cc1f[_0x7f5e('0xbe')]){if(_0x31cc1f[_0x7f5e('0x146')]==='16'&&this[_0x7f5e('0x17')][_0x31cc1f['linkedid']]['dialAnswer']){this[_0x7f5e('0x9f')](_0x31cc1f,_0x31cc1f[_0x7f5e('0xaf')],_0x31cc1f[_0x7f5e('0x146')]);}else if(this[_0x7f5e('0x17')][_0x31cc1f['linkedid']][_0x7f5e('0x71')]){logger[_0x7f5e('0x6c')](_0x7f5e('0x147'),_0x31cc1f[_0x7f5e('0xaf')],_0x31cc1f[_0x7f5e('0x146')],_0x7f5e('0xb2'),_0x1c0115['name'],_0x7f5e('0xbf'),_0x1c0115[_0x7f5e('0x5f')]);this['callProgressDetectingCustomer'](_0x31cc1f,_0x31cc1f[_0x7f5e('0xaf')],_0x31cc1f['cause']);}}else if(_0x4db9b5&&_['isNil'](_0x4db9b5['statedesc'])&&_0x1c0115['dialQueueProject']&&_0x31cc1f['linkedid']===_0x31cc1f['uniqueid']&&_[_0x7f5e('0x101')](_0x31cc1f[_0x7f5e('0xf8')])&&_0x31cc1f[_0x7f5e('0x146')]==='16'&&_0x31cc1f[_0x7f5e('0x148')]==='6'&&_[_0x7f5e('0xf6')](_0x4db9b5[_0x7f5e('0x149')])){if(_0x4db9b5['unlockAgent']){rpcDb[_0x7f5e('0x117')](_0x4db9b5['idContact']);}if(_0x4db9b5['activeContact']){rpcDb['disableContact'](_0x4db9b5['idContact']);}_0x31cc1f[_0x7f5e('0xf8')]='22';this[_0x7f5e('0xf5')](_0x4db9b5,_0x1c0115,_0x31cc1f);}else if(_0x4db9b5&&_0x4db9b5['transfer']){if(_0x31cc1f['cause']==='16'&&this[_0x7f5e('0x17')][_0x31cc1f['linkedid']][_0x7f5e('0x71')]){logger[_0x7f5e('0x6c')](_0x7f5e('0x14a'),_0x31cc1f[_0x7f5e('0xaf')],_0x31cc1f[_0x7f5e('0x146')],_0x7f5e('0xb2'),_0x1c0115[_0x7f5e('0x57')],'pTalking:\x20',_0x1c0115['pTalking']);this[_0x7f5e('0x9f')](_0x31cc1f,_0x31cc1f[_0x7f5e('0xaf')],_0x31cc1f['cause']);}else if(this[_0x7f5e('0x17')][_0x31cc1f[_0x7f5e('0xaf')]][_0x7f5e('0x71')]){logger['info'](_0x7f5e('0x147'),_0x31cc1f[_0x7f5e('0xaf')],_0x31cc1f[_0x7f5e('0x146')],'\x20Queue',_0x1c0115['name'],_0x7f5e('0xbf'),_0x1c0115[_0x7f5e('0x5f')]);this[_0x7f5e('0x9f')](_0x31cc1f,_0x31cc1f[_0x7f5e('0xaf')],_0x31cc1f['cause']);}}};Preview[_0x7f5e('0x65')][_0x7f5e('0x21')]=function(_0x4ff628){if(this['actions'][_0x4ff628['destlinkedid']]&&_0x4ff628[_0x7f5e('0x14b')]!==_0x4ff628[_0x7f5e('0x14c')]){this['callProgressDetectingCustomer'](_0x4ff628,_0x4ff628[_0x7f5e('0x14b')],_0x4ff628[_0x7f5e('0xea')]);}};Preview[_0x7f5e('0x65')]['syncHangupRequest']=function(_0x55befa){if(this[_0x7f5e('0x17')][_0x55befa['linkedid']]&&_0x55befa['linkedid']!==_0x55befa['uniqueid']&&!this[_0x7f5e('0x17')][_0x55befa[_0x7f5e('0xaf')]][_0x7f5e('0x71')]){if(_0x55befa[_0x7f5e('0x146')]==='1'){this[_0x7f5e('0x9f')](_0x55befa,_0x55befa['linkedid'],_0x55befa[_0x7f5e('0x146')]);}}};Preview['prototype'][_0x7f5e('0x14d')]=function(_0x444172,_0x243b8b,_0x1e347d){if(this[_0x7f5e('0x17')][_0x444172]){if(_[_0x7f5e('0x101')](this['actions'][_0x444172][_0x7f5e('0x14e')])){this[_0x7f5e('0x17')][_0x444172]['variables']={};}this[_0x7f5e('0x17')][_0x444172][_0x7f5e('0x14e')][_0x243b8b]=_0x1e347d;}};Preview['prototype']['syncVarSet']=function(_0x358e85){try{if(!_['isNil'](_0x358e85)){if(ut[_0x7f5e('0x14f')](_[_0x7f5e('0x150')](_0x358e85[_0x7f5e('0x151')])[0x0])){this[_0x7f5e('0x14d')](_0x358e85[_0x7f5e('0xbe')],_[_0x7f5e('0x150')](_0x358e85[_0x7f5e('0x151')])[0x0],_0x358e85[_0x7f5e('0x152')]);}}}catch(_0x5db228){logger[_0x7f5e('0x153')](_0x7f5e('0x154'),util['inspect'](_0x5db228,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x7f5e('0x27')]=function(_0x491521){if(_0x491521){if(this['actions'][_0x491521[_0x7f5e('0x155')]]){this[_0x7f5e('0x17')][_0x491521[_0x7f5e('0x155')]][_0x7f5e('0x149')]=!![];}}};Preview[_0x7f5e('0x65')]['syncBlindTransfer']=function(_0x202a2f){if(_0x202a2f){if(this['actions'][_0x202a2f['transfererlinkedid']]){this['actions'][_0x202a2f[_0x7f5e('0x156')]]['transfer']=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x7974=['IsNotLoggedIn','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','linkedid','ANSWER','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','countbusyretry','dialBusyMaxRetry','dialBusyRetryFrequency','activeContact','countnoanswerretry','NoAnswer','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','dialCongestionMaxRetry','CANCEL','AgentReject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlock','pick','getContactPreview','recallme','isValid','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','ACTIVE','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variablesAction','channelAgent','destconnectedlinenum','calleridnum','user:%s','user:agentconnect','accountcode','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','syncNewExten','channel','syncOriginateResponse','actionid','logLookAgent','clone','responsetime','isFailure','response','unlockContact','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','variable','keys','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','lodash','bluebird','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','varset','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','campaignsPreview','emit','type','outbound','name','strategy','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','waiting','loggedInDb','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','Trunk','active','callerid','Interval','stringify','md5','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','booked','clearZombieChannels','dialActive','isNil','[clearZombieChannels][talking]','Queue','actions','queue','originated:\x20','pTalking:\x20','dialAnswer','contactId','UserId','VoiceQueueId','ListId','Action','status','catch','message','updateOriginated','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannel','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7974,0xc9));var _0x4797=function(_0xdc37a1,_0x53ebb9){_0xdc37a1=_0xdc37a1-0x0;var _0x99b4fe=_0x7974[_0xdc37a1];return _0x99b4fe;};'use strict';var util=require('util');var _=require(_0x4797('0x0'));var BPromise=require(_0x4797('0x1'));var uuid=require(_0x4797('0x2'));var moment=require('moment');var md5=require('md5');var Redis=require(_0x4797('0x3'));var config=require(_0x4797('0x4'));var logger=require(_0x4797('0x5'))(_0x4797('0x6'));var loggerAction=require(_0x4797('0x5'))(_0x4797('0x7'));var ami=require(_0x4797('0x8'));var rpcDb=require(_0x4797('0x9'));var Action=require(_0x4797('0xa'));var ut=require(_0x4797('0xb'));config[_0x4797('0xc')]=_[_0x4797('0xd')](config['redis'],{'host':_0x4797('0xe'),'port':0x18eb});var io=require(_0x4797('0xf'))(new Redis(config[_0x4797('0xc')]));var Sequence=function(){};Sequence[_0x4797('0x10')][_0x4797('0x11')]=function(_0x3b8e38){this['tail']=this[_0x4797('0x12')]?this[_0x4797('0x12')][_0x4797('0x13')](_0x3b8e38):_0x3b8e38();};function Preview(_0xde01ac){this[_0x4797('0x14')]=new Sequence();this['campaignsPreview']=_0xde01ac[_0x4797('0x15')];this[_0x4797('0x16')]=_0xde01ac[_0x4797('0x16')];this['actions']={};this[_0x4797('0x17')]=_0xde01ac['agents'];this[_0x4797('0x18')]=0x0;ami['on'](_0x4797('0x19'),this['syncOriginateResponse'][_0x4797('0x1a')](this));ami['on'](_0x4797('0x1b'),this['syncHangup'][_0x4797('0x1a')](this));ami['on'](_0x4797('0x1c'),this[_0x4797('0x1d')][_0x4797('0x1a')](this));ami['on'](_0x4797('0x1e'),this[_0x4797('0x1f')][_0x4797('0x1a')](this));ami['on'](_0x4797('0x20'),this['syncNewExten']['bind'](this));ami['on'](_0x4797('0x21'),this['syncVarSet'][_0x4797('0x1a')](this));ami['on'](_0x4797('0x22'),this['syncAttendedTransfer'][_0x4797('0x1a')](this));ami['on'](_0x4797('0x23'),this[_0x4797('0x24')][_0x4797('0x1a')](this));this[_0x4797('0x25')](this[_0x4797('0x26')]);}function emit(_0x151379,_0x50e207,_0x9c11ce){io['to'](_0x151379)[_0x4797('0x27')](_0x50e207,_0x9c11ce);}function emitCampaignPreview(_0x4ffddd){if(_0x4ffddd[_0x4797('0x28')]===_0x4797('0x29')){var _0x25475c={'id':_0x4ffddd['id'],'name':_0x4ffddd[_0x4797('0x2a')],'strategy':_0x4ffddd[_0x4797('0x2b')],'answered':_0x4ffddd['answered'],'available':_0x4ffddd[_0x4797('0x2c')],'loggedIn':_0x4ffddd[_0x4797('0x2d')],'pTalking':_0x4ffddd[_0x4797('0x2e')],'sumBillable':_0x4ffddd[_0x4797('0x2f')],'sumDuration':_0x4ffddd[_0x4797('0x30')],'sumHoldTime':_0x4ffddd[_0x4797('0x31')]||0x0,'talking':_0x4ffddd[_0x4797('0x32')],'total':_0x4ffddd[_0x4797('0x33')],'type':_0x4ffddd['type'],'unmanaged':_0x4ffddd['unmanaged'],'abandoned':_0x4ffddd['abandoned'],'waiting':_0x4ffddd[_0x4797('0x34')],'loggedInDb':_0x4ffddd[_0x4797('0x35')],'dialActive':_0x4ffddd['dialActive'],'dialMethod':_0x4ffddd[_0x4797('0x36')],'dialOriginateCallerIdName':_0x4ffddd[_0x4797('0x37')],'dialOriginateCallerIdNumber':_0x4ffddd[_0x4797('0x38')],'dialOriginateTimeout':_0x4ffddd[_0x4797('0x39')],'dialPrefix':_0x4ffddd['dialPrefix'],'outboundAnswerAgiCallsDay':_0x4ffddd[_0x4797('0x3a')],'outboundAnswerCallsDay':_0x4ffddd[_0x4797('0x3b')],'outboundBlacklistCallsDay':_0x4ffddd[_0x4797('0x3c')],'outboundBusyCallsDay':_0x4ffddd['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x4ffddd[_0x4797('0x3d')],'outboundDropCallsDayACS':_0x4ffddd['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x4ffddd[_0x4797('0x3e')],'outboundDropCallsDayTimeout':_0x4ffddd[_0x4797('0x3f')],'outboundNoAnswerCallsDay':_0x4ffddd[_0x4797('0x40')],'outboundNoSuchCallsDay':_0x4ffddd[_0x4797('0x41')],'outboundOriginateFailureCallsDay':_0x4ffddd['outboundOriginateFailureCallsDay'],'outboundReCallsDay':_0x4ffddd['outboundReCallsDay'],'outboundRejectCallsDay':_0x4ffddd[_0x4797('0x42')],'outboundUnknownCallsDay':_0x4ffddd[_0x4797('0x43')],'outboundAbandonedCallsDay':_0x4ffddd[_0x4797('0x44')],'predictiveIntervalAnsweredCalls':_0x4ffddd[_0x4797('0x45')],'predictiveIntervalAvgHoldtime':_0x4ffddd[_0x4797('0x46')],'predictiveIntervalAvgTalktime':_0x4ffddd[_0x4797('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x4ffddd[_0x4797('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x4ffddd[_0x4797('0x49')],'predictiveIntervalErlangCalls':_0x4ffddd[_0x4797('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x4ffddd[_0x4797('0x4b')],'predictiveIntervalHitRate':_0x4ffddd[_0x4797('0x4c')],'predictiveIntervalMultiplicativeFactor':_0x4ffddd[_0x4797('0x4d')],'predictiveIntervalPauses':_0x4ffddd[_0x4797('0x4e')],'predictiveIntervalAvailable':_0x4ffddd[_0x4797('0x4f')],'predictiveIntervalTotalCalls':_0x4ffddd[_0x4797('0x50')],'message':_0x4ffddd['message'],'originated':_0x4ffddd[_0x4797('0x51')],'erlangCalls':_0x4ffddd[_0x4797('0x52')],'erlangCallToSecond':_0x4ffddd[_0x4797('0x53')],'erlangAbandonmentRate':_0x4ffddd[_0x4797('0x54')],'erlangBusyFactor':_0x4ffddd['erlangBusyFactor'],'startPredictive':_0x4ffddd[_0x4797('0x55')],'startProgressive':_0x4ffddd['startProgressive']};if(_0x4ffddd['Trunk']){_0x25475c[_0x4797('0x56')]={'id':_0x4ffddd['Trunk']['id'],'name':_0x4ffddd[_0x4797('0x56')]['name'],'active':_0x4ffddd[_0x4797('0x56')][_0x4797('0x57')],'callerid':_0x4ffddd[_0x4797('0x56')][_0x4797('0x58')]};}if(_0x4ffddd[_0x4797('0x59')]){_0x25475c[_0x4797('0x59')]={'id':_0x4ffddd['Interval']['id'],'name':_0x4ffddd['Interval'][_0x4797('0x2a')]};}var _0x1a9c75=md5(JSON[_0x4797('0x5a')](_0x25475c));if(_0x4ffddd[_0x4797('0x5b')]!==_0x1a9c75){_0x4ffddd[_0x4797('0x5b')]=_0x1a9c75;emit(util[_0x4797('0x5c')](_0x4797('0x5d'),_0x25475c['name']),_0x4797('0x5e'),_0x25475c);}}}function emitVoiceQueueChannelRemove(_0x39687b){logger[_0x4797('0x5f')](_0x4797('0x60'),JSON[_0x4797('0x5a')](_0x39687b));emit(util[_0x4797('0x5c')](_0x4797('0x5d'),_0x39687b[_0x4797('0x2a')]),_0x4797('0x61'),_0x39687b);io[_0x4797('0x27')](_0x4797('0x62'),_0x39687b);}function notSendMessagesQueue(_0x48250d){if(_0x48250d['sendMessageOneNotActive']){if(_0x48250d[_0x4797('0x51')]===0x0&&_0x48250d['pTalking']===0x0){_0x48250d[_0x4797('0x63')]=![];_0x48250d[_0x4797('0x2c')]=0x0;_0x48250d[_0x4797('0x64')]=0x0;_0x48250d['message']=_0x4797('0x65');ut[_0x4797('0x66')](_0x4797('0x67'),_0x48250d['name']+'\x20is\x20not\x20active');}else{_0x48250d['message']=_0x4797('0x68');ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x48250d[_0x4797('0x2a')]+_0x4797('0x69'));}emitCampaignPreview(_0x48250d);}}Preview[_0x4797('0x10')][_0x4797('0x25')]=function(){var _0x4585f6=this;setInterval(function(){_0x4585f6[_0x4797('0x6a')]();},0x7cf);};Preview['prototype'][_0x4797('0x6a')]=function(){var _0x4f00c8=this[_0x4797('0x26')];this[_0x4797('0x18')]+=0x1;for(var _0x53d230 in _0x4f00c8){if(_0x4f00c8[_0x4797('0x6b')](_0x53d230)&&(_0x4f00c8[_0x53d230][_0x4797('0x36')]===_0x4797('0x6')||_0x4f00c8[_0x53d230][_0x4797('0x36')]===_0x4797('0x6c'))&&_0x4f00c8[_0x53d230][_0x4797('0x28')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x4797('0x18')]=0x0;this[_0x4797('0x6d')]();}}if(_0x4f00c8[_0x4797('0x6b')](_0x53d230)&&_0x4f00c8[_0x53d230]['dialMethod']==='preview'&&_0x4f00c8[_0x53d230][_0x4797('0x28')]==='outbound'){if(_0x4f00c8[_0x53d230][_0x4797('0x6e')]){this['setMessage'](_0x4f00c8[_0x53d230]);this['recallMe'](_0x4f00c8[_0x53d230]);}else{notSendMessagesQueue(_0x4f00c8[_0x53d230]);}}}};Preview[_0x4797('0x10')]['clearZombieChannel']=function(_0x5401b3){var _0x200723=this;this['sequence'][_0x4797('0x11')](function(){if(!_[_0x4797('0x6f')](_0x200723['actions'][_0x5401b3])){loggerAction[_0x4797('0x5f')](_0x4797('0x70'),_0x5401b3,_0x4797('0x71'),_0x200723[_0x4797('0x72')][_0x5401b3][_0x4797('0x73')],_0x4797('0x74'),JSON['stringify'](_0x200723[_0x4797('0x26')][_0x200723[_0x4797('0x72')][_0x5401b3][_0x4797('0x73')]][_0x4797('0x51')]),_0x4797('0x75'),JSON[_0x4797('0x5a')](_0x200723[_0x4797('0x26')][_0x200723[_0x4797('0x72')][_0x5401b3]['queue']][_0x4797('0x2e')]),JSON[_0x4797('0x5a')](_0x200723[_0x4797('0x72')][_0x5401b3][_0x4797('0x76')]),JSON[_0x4797('0x5a')](_['pick'](_0x200723[_0x4797('0x72')][_0x5401b3],[_0x4797('0x77'),_0x4797('0x78'),_0x4797('0x79'),_0x4797('0x7a')])));return ami[_0x4797('0x7b')]({'action':_0x4797('0x7c'),'channel':_0x200723[_0x4797('0x72')][_0x5401b3]['channel']})[_0x4797('0x7d')](function(_0x10d60d){if(_0x10d60d[_0x4797('0x7e')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x200723['actions'][_0x5401b3]){ut[_0x4797('0x7f')](_0x200723[_0x4797('0x26')][_0x200723[_0x4797('0x72')][_0x5401b3][_0x4797('0x73')]],_0x4797('0x80'));if(_0x200723['actions'][_0x5401b3]['dialAnswer']===!![]){ut['decrementTalkink'](_0x200723[_0x4797('0x26')][_0x200723[_0x4797('0x72')][_0x5401b3][_0x4797('0x73')]],_0x4797('0x80'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x5401b3,_0x200723[_0x4797('0x72')][_0x5401b3][_0x4797('0x73')]);}ut[_0x4797('0x81')](_0x4797('0x82')+_0x5401b3,_0x200723[_0x4797('0x72')][_0x5401b3][_0x4797('0x73')]);delete _0x200723['actions'][_0x5401b3];}},0x2328);}});}});};Preview[_0x4797('0x10')]['clearZombieChannels']=function(){var _0x43b88b=this;loggerAction[_0x4797('0x5f')]('[action]',_['size'](this[_0x4797('0x72')]));for(var _0x45d5c3 in this['actions']){if(_0x43b88b[_0x4797('0x72')][_0x4797('0x6b')](_0x45d5c3)){_0x43b88b[_0x4797('0x83')](_0x45d5c3);}}};Preview[_0x4797('0x10')]['recallMe']=function(_0x50bbc5){var _0x511c92=this;rpcDb['getContactRecallMe'](_0x50bbc5['id'],ut[_0x4797('0x84')](this[_0x4797('0x17')]))[_0x4797('0x85')](function(_0x20b661){if(!_['isNil'](_0x20b661)){for(var _0x339f1c=0x0;_0x339f1c<_0x20b661[_0x4797('0x86')];_0x339f1c+=0x1){if(ut[_0x4797('0x87')](_0x20b661[_0x339f1c][_0x4797('0x88')])<_0x50bbc5[_0x4797('0x89')]*0x3c){if(_0x20b661[_0x339f1c][_0x4797('0x8a')]&&!_0x20b661[_0x339f1c][_0x4797('0x8a')][_0x4797('0x8b')]){_0x511c92['run'](_0x20b661[_0x339f1c]['id'])[_0x4797('0x85')](ut[_0x4797('0x8c')](_0x4797('0x8d')))['catch'](ut[_0x4797('0x8c')](_0x4797('0x8d')));}else{rpcDb[_0x4797('0x8e')](_0x20b661[_0x339f1c]['id']);}}else{var _0x23ba6d=new Action(_0x20b661[_0x339f1c],_0x50bbc5);_0x23ba6d[_0x4797('0x8f')]=moment()[_0x4797('0x5c')](_0x4797('0x90'));_0x50bbc5[_0x4797('0x91')]+=0x1;ut[_0x4797('0x92')](_0x23ba6d,0x17,_0x4797('0x93'));if(_0x50bbc5[_0x4797('0x94')]){rpcDb[_0x4797('0x95')](ut[_0x4797('0x96')](_0x20b661[_0x339f1c]));rpcDb[_0x4797('0x97')](_0x23ba6d,_0x4797('0x98'));}else{ut[_0x4797('0x92')](_0x23ba6d,0x16,'RecallFailedTimeout');rpcDb[_0x4797('0x97')](_0x23ba6d,_0x4797('0x99'));rpcDb['createCustomerFinal'](_0x23ba6d,'[HistoryRecallClose]');}}}}})[_0x4797('0x7d')](ut[_0x4797('0x8c')]('[getContactRecallMe]'));};Preview['prototype']['setMessage']=function(_0x1a7ca6){_0x1a7ca6[_0x4797('0x63')]=!![];if(ut[_0x4797('0x9a')](_0x1a7ca6[_0x4797('0x2d')])){_0x1a7ca6[_0x4797('0x7e')]=_0x4797('0x9b');}else if(!ut[_0x4797('0x9c')](_0x1a7ca6[_0x4797('0x6e')])){_0x1a7ca6[_0x4797('0x7e')]=_0x4797('0x65');}else if(!this[_0x4797('0x9d')](_0x1a7ca6['Trunk'])){if(!this[_0x4797('0x9d')](_0x1a7ca6[_0x4797('0x9e')])){_0x1a7ca6[_0x4797('0x7e')]=_0x4797('0x9f');}else{_0x1a7ca6[_0x4797('0x7e')]='ACTIVE';}}else{_0x1a7ca6[_0x4797('0x7e')]='ACTIVE';}emitCampaignPreview(_0x1a7ca6);};Preview[_0x4797('0x10')][_0x4797('0xa0')]=function(_0x98f2b5,_0xf6a1c2,_0x49f01e){var _0x4f1d54=this;var _0x353e73=this[_0x4797('0x72')][_0xf6a1c2];var _0x1cea37=this[_0x4797('0x26')][_0x353e73[_0x4797('0x73')]];var _0x48f501;if(_0x1cea37){switch(_0x49f01e){case'1':_0x1cea37[_0x4797('0x41')]+=0x1;_0x353e73[_0x4797('0xa1')]+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0x0,_0x4797('0xa4'));ami[_0x4797('0x27')](_0x4797('0xa5'),ut[_0x4797('0xa6')](_0x353e73,'nosuchnumber'));rpcDb['createCustomerHistory'](_0x353e73,'[callProgressDetectingCustomer][logNoSuch]');if(ut[_0x4797('0xa3')](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut[_0x4797('0xa8')](_0x353e73,0xf,_0x4797('0xa9'));rpcDb[_0x4797('0xaa')](_0x48f501,_0x4797('0xab'));}else{if(_0x353e73[_0x4797('0xa1')]>=_0x1cea37[_0x4797('0xac')]){rpcDb['createCustomerFinal'](_0x353e73,_0x4797('0xab'));}else{rpcDb[_0x4797('0xad')](ut[_0x4797('0xae')](_0x353e73,_0x4797('0xa1'),_0x1cea37[_0x4797('0xaf')]),_0x353e73[_0x4797('0xb0')],_0x353e73['activeContact']);}}delete this[_0x4797('0x72')][_0x98f2b5[_0x4797('0xb1')]];break;case _0x4797('0xb2'):var _0x56aee4=moment()['format'](_0x4797('0x90'));_0x353e73['responsetime']=_0x56aee4;_0x353e73[_0x4797('0xb3')]=_0x56aee4;_0x353e73[_0x4797('0x76')]=!![];_0x1cea37[_0x4797('0x2e')]+=0x1;logger[_0x4797('0x5f')](_0x4797('0xb4'),_0x353e73[_0x4797('0xb5')],_0x4797('0xb6'),_0x1cea37[_0x4797('0x2a')],'pTalking:\x20',_0x1cea37[_0x4797('0x2e')]);ami[_0x4797('0x27')](_0x4797('0xb7'),ut[_0x4797('0xa6')](_0x353e73,'connect',this[_0x4797('0x26')][_0x353e73[_0x4797('0x73')]]));if(_0x1cea37['acw']){ami[_0x4797('0x27')](_0x4797('0xb8'),ut[_0x4797('0xb9')](_0x353e73));}break;case'16':ami[_0x4797('0x27')](_0x4797('0xba'),ut['buildObj'](_0x353e73,_0x4797('0xbb'),this[_0x4797('0x26')][_0x353e73[_0x4797('0x73')]]));emitVoiceQueueChannelRemove(ut[_0x4797('0xa6')](_0x353e73,_0x4797('0xbb')));_0x1cea37['outboundAnswerCallsDay']+=0x1;_0x1cea37[_0x4797('0x33')]+=0x1;_0x1cea37['answered']+=0x1;ut[_0x4797('0xbc')](_0x1cea37,_0x4797('0xbd'));_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut['logCustomer'](_0x353e73,0x4,_0x4797('0xbe'));rpcDb[_0x4797('0x97')](_0x353e73,_0x4797('0xbf'));rpcDb['createCustomerFinal'](_0x353e73,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x4797('0xc0')](_0x353e73);_0x1cea37[_0x4797('0x30')]+=_0x353e73[_0x4797('0xc1')];_0x1cea37[_0x4797('0x2f')]+=_0x353e73[_0x4797('0xc1')];logger[_0x4797('0x5f')](_0x4797('0xc2'),_0x353e73[_0x4797('0xb5')],_0x4797('0xb6'),_0x1cea37[_0x4797('0x2a')],_0x4797('0x75'),_0x1cea37[_0x4797('0x2e')]);delete this['actions'][_0x98f2b5['linkedid']];break;case'BUSY':_0x1cea37[_0x4797('0xc3')]+=0x1;_0x353e73['countbusyretry']+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0x5,_0x4797('0xc4'));ami[_0x4797('0x27')](_0x4797('0xc5'),ut[_0x4797('0xa6')](_0x353e73,'busy'));rpcDb[_0x4797('0x97')](_0x353e73,_0x4797('0xc6'));if(ut[_0x4797('0xa3')](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut[_0x4797('0xa8')](_0x353e73,0xf,_0x4797('0xa9'));rpcDb[_0x4797('0xaa')](_0x48f501,_0x4797('0xc7'));}else{if(_0x353e73[_0x4797('0xc8')]>=_0x1cea37[_0x4797('0xc9')]){rpcDb[_0x4797('0xaa')](_0x353e73,_0x4797('0xc6'));}else{rpcDb[_0x4797('0xad')](ut['scheduledAt'](_0x353e73,_0x4797('0xc8'),_0x1cea37[_0x4797('0xca')]),_0x353e73[_0x4797('0xb0')],_0x353e73[_0x4797('0xcb')]);}}break;case'NOANSWER':_0x1cea37[_0x4797('0x40')]+=0x1;_0x353e73[_0x4797('0xcc')]+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0x3,_0x4797('0xcd'));ami['emit'](_0x4797('0xce'),ut['buildObj'](_0x353e73,'noanswer'));rpcDb[_0x4797('0x97')](_0x353e73,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0x4797('0xa3')](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut['cloneAction'](_0x353e73,0xf,'Global');rpcDb[_0x4797('0xaa')](_0x48f501,_0x4797('0xcf'));}else{if(_0x353e73['countnoanswerretry']>=_0x1cea37[_0x4797('0xd0')]){rpcDb['createCustomerFinal'](_0x353e73,_0x4797('0xd1'));}else{rpcDb[_0x4797('0xad')](ut[_0x4797('0xae')](_0x353e73,_0x4797('0xcc'),_0x1cea37[_0x4797('0xd2')]),_0x353e73['unlockAgent'],_0x353e73['activeContact']);}}break;case'CONGESTION':_0x1cea37[_0x4797('0x3d')]+=0x1;_0x353e73[_0x4797('0xd3')]+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut['logCustomer'](_0x353e73,0x8,_0x4797('0xd4'));ami[_0x4797('0x27')](_0x4797('0xd5'),ut['buildObj'](_0x353e73,_0x4797('0xd6')));rpcDb[_0x4797('0x97')](_0x353e73,_0x4797('0xd7'));if(ut['totalGlobal'](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut[_0x4797('0xa8')](_0x353e73,0xf,_0x4797('0xa9'));rpcDb[_0x4797('0xaa')](_0x48f501,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x353e73[_0x4797('0xd3')]>=_0x1cea37[_0x4797('0xd8')]){rpcDb['createCustomerFinal'](_0x353e73,_0x4797('0xd7'));}else{rpcDb[_0x4797('0xad')](ut[_0x4797('0xae')](_0x353e73,_0x4797('0xd3'),_0x1cea37['dialBusyRetryFrequency']),_0x353e73[_0x4797('0xb0')],_0x353e73[_0x4797('0xcb')]);}}break;case _0x4797('0xd9'):_0x1cea37[_0x4797('0x42')]+=0x1;_0x353e73['countagentrejectretry']+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0x14,_0x4797('0xda'));ami[_0x4797('0x27')]('custom:agentreject',ut[_0x4797('0xa6')](_0x353e73,_0x4797('0xdb')));rpcDb[_0x4797('0x97')](_0x353e73,_0x4797('0xdc'));if(ut['totalGlobal'](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut['cloneAction'](_0x353e73,0x14,_0x4797('0xda'));rpcDb[_0x4797('0xaa')](_0x48f501,_0x4797('0xdd'));}else{if(_0x353e73['countagentrejectretry']>=_0x1cea37[_0x4797('0xde')]){rpcDb[_0x4797('0xaa')](_0x353e73,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x4797('0xad')](ut[_0x4797('0xae')](_0x353e73,_0x4797('0xdf'),_0x1cea37[_0x4797('0xe0')]),_0x353e73['unlockAgent'],_0x353e73[_0x4797('0xcb')]);}}break;case _0x4797('0xe1'):_0x1cea37[_0x4797('0x44')]+=0x1;_0x353e73[_0x4797('0xe2')]+=0x1;_0x353e73[_0x4797('0xa2')]=ut['totalGlobal'](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0xb,_0x4797('0xe3'));rpcDb['createCustomerHistory'](_0x353e73,_0x4797('0xe4'));if(ut['totalGlobal'](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut[_0x4797('0xa8')](_0x353e73,0xf,_0x4797('0xa9'));rpcDb[_0x4797('0xaa')](_0x48f501,_0x4797('0xe4'));}else{if(_0x353e73['countabandonedetry']>=_0x1cea37[_0x4797('0xe5')]){rpcDb['createCustomerFinal'](_0x353e73,_0x4797('0xe4'));}else{rpcDb[_0x4797('0xad')](ut['scheduledAt'](_0x353e73,_0x4797('0xe2'),_0x1cea37[_0x4797('0xe6')]),_0x353e73['unlockAgent'],_0x353e73[_0x4797('0xcb')]);}}break;case'18':_0x1cea37[_0x4797('0x43')]+=0x1;_0x353e73[_0x4797('0xe7')]+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0x12,_0x98f2b5[_0x4797('0xe8')]||_0x98f2b5['dialstatus']);ami[_0x4797('0x27')](_0x4797('0xe9'),ut[_0x4797('0xa6')](_0x353e73,_0x4797('0xea')));rpcDb['createCustomerHistory'](_0x353e73,_0x4797('0xeb'));if(ut[_0x4797('0xa3')](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut['cloneAction'](_0x353e73,0xf,_0x4797('0xa9'));rpcDb['createCustomerFinal'](_0x48f501,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb['createCustomerFinal'](_0x353e73,_0x4797('0xeb'));}delete this[_0x4797('0x72')][_0x98f2b5[_0x4797('0xb1')]];break;case'19':_0x1cea37[_0x4797('0x43')]+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0x13,_0x98f2b5[_0x4797('0xe8')]||_0x98f2b5[_0x4797('0xec')]);ami['emit'](_0x4797('0xe9'),ut['buildObj'](_0x353e73,_0x4797('0xea')));rpcDb[_0x4797('0x97')](_0x353e73,_0x4797('0xed'));if(ut['totalGlobal'](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut[_0x4797('0xa8')](_0x353e73,0xf,_0x4797('0xa9'));rpcDb[_0x4797('0xaa')](_0x48f501,_0x4797('0xed'));}else{rpcDb[_0x4797('0xaa')](_0x353e73,'[callProgressDetectingCustomer][machine]');}delete this[_0x4797('0x72')][_0x98f2b5['linkedid']];break;default:if(_0x353e73[_0x4797('0x76')]){ut[_0x4797('0xbc')](_0x1cea37,_0x4797('0xee'));ut[_0x4797('0x81')](_0x4797('0xef')+_0x1cea37['name'],_0x98f2b5);}_0x1cea37[_0x4797('0x43')]+=0x1;_0x353e73[_0x4797('0xa2')]=ut[_0x4797('0xa3')](_0x353e73);ut[_0x4797('0x92')](_0x353e73,0xc,_0x98f2b5['cause-txt']||_0x98f2b5[_0x4797('0xec')]);rpcDb['createCustomerHistory'](_0x353e73,_0x4797('0xf0'));if(ut[_0x4797('0xa3')](_0x353e73)>=_0x1cea37[_0x4797('0xa7')]){_0x48f501=ut[_0x4797('0xa8')](_0x353e73,0xf,_0x4797('0xa9'));rpcDb[_0x4797('0xaa')](_0x48f501,_0x4797('0xf1'));}else{rpcDb[_0x4797('0xaa')](_0x353e73,_0x4797('0xf1'));}delete this[_0x4797('0x72')][_0x98f2b5['linkedid']];}if(!(_0x353e73['dialAnswer']&&_0x49f01e==='16')){ut[_0x4797('0x7f')](_0x1cea37,_0x4797('0xf2'));logger[_0x4797('0x5f')](_0x4797('0xf3'),_0x353e73[_0x4797('0xb5')],'\x20Queue',_0x1cea37['name'],'originated:\x20',_0x1cea37[_0x4797('0x51')]);}if(_0x49f01e!==_0x4797('0xb2')){delete this[_0x4797('0x72')][_0x98f2b5['linkedid']];delete this[_0x4797('0x72')][_0x98f2b5[_0x4797('0xf4')]];}}};Preview[_0x4797('0x10')][_0x4797('0xf5')]=function(_0x9fc22e,_0x347760,_0x232b78){if(_[_0x4797('0xf6')](_0x347760)&&_0x4797('0xf7')!==typeof _0x347760){return;}if(_[_0x4797('0xf6')](_0x232b78)&&_0x4797('0xf7')!==typeof _0x232b78){return;}switch(_0x232b78[_0x4797('0xf8')]){case'0':ut[_0x4797('0xf9')](_0x9fc22e,0x0,_0x4797('0xa4'));rpcDb['createAgentHistory'](_0x9fc22e,_0x4797('0xfa'));break;case'3':ut[_0x4797('0xf9')](_0x9fc22e,0x3,'NoAnswer');rpcDb[_0x4797('0xfb')](_0x9fc22e,_0x4797('0xfc'));break;case'5':ut[_0x4797('0xf9')](_0x9fc22e,0x5,_0x4797('0xc4'));rpcDb[_0x4797('0xfb')](_0x9fc22e,_0x4797('0xfd'));break;case'8':ut[_0x4797('0xf9')](_0x9fc22e,0x8,'Congestion');rpcDb['createAgentHistory'](_0x9fc22e,_0x4797('0xfe'));break;case'22':ut[_0x4797('0xf9')](_0x9fc22e,0x16,_0x4797('0xff'));rpcDb[_0x4797('0xfb')](_0x9fc22e,_0x4797('0x100'));break;default:ut['logAgent'](_0x9fc22e,0xc,_0x232b78['reason']);rpcDb[_0x4797('0xfb')](_0x9fc22e,'[callProgressDetectingAgent][logCongestion]');}ut[_0x4797('0x7f')](_0x347760,_0x4797('0x101'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x9fc22e[_0x4797('0xb5')],'\x20Queue',_0x347760['name'],'originated:\x20',_0x347760[_0x4797('0x51')]);delete this[_0x4797('0x72')][_0x9fc22e['uniqueid']];};Preview['prototype'][_0x4797('0x102')]=function(_0x47aaed,_0x453e9e,_0x22b0e7,_0x2010ce,_0x207dc1){var _0x5a3150=this;return new BPromise(function(_0x437a71,_0x12e781){if(_[_0x4797('0x6f')](_0x453e9e)||_['isNil'](_0x453e9e[_0x4797('0x103')])||_[_0x4797('0x6f')](_0x453e9e[_0x4797('0x103')][_0x4797('0x104')])||_['isNil'](_0x453e9e['VoiceQueueId'])){_0x12e781(ut['message'](_0x4797('0x105'),_0x2010ce,_0x207dc1));return;}var _0x1f7acf=uuid['v4']();var _0xf10189=_0x5a3150[_0x4797('0x26')][_0x453e9e[_0x4797('0x71')][_0x4797('0x2a')]];var _0xb59392=_0x22b0e7?_0x5a3150[_0x4797('0x17')][_0x22b0e7]['id']:undefined;_0x5a3150['actions'][_0x1f7acf]=new Action(_0x453e9e,_0xf10189,_0x1f7acf,_0x22b0e7,_0xb59392);var _0x29cd5b=_0x5a3150[_0x4797('0x72')][_0x1f7acf];_0x29cd5b[_0x4797('0xb0')]=_0x2010ce;_0x29cd5b[_0x4797('0xcb')]=_0x207dc1;_0x29cd5b[_0x4797('0x106')]=_0x22b0e7;if(_[_0x4797('0x107')](_0x47aaed)){_0x5a3150[_0x4797('0x108')](_0x29cd5b,_0xf10189,_0x453e9e,_0x22b0e7)[_0x4797('0x85')](function(_0x4d6772){logger[_0x4797('0x5f')]('[Preview][execCall][success]',_0x4797('0x109')+_0x29cd5b[_0x4797('0x73')]+_0x4797('0x10a')+_0x29cd5b[_0x4797('0x10b')],JSON['stringify'](_0x4d6772));ami[_0x4797('0x27')](_0x4797('0x10c'),ut[_0x4797('0xa6')](_0x29cd5b,_0x4797('0x10d'),_0x5a3150[_0x4797('0x26')][_0x29cd5b['queue']]));_0x437a71(ut[_0x4797('0x7e')](_0x4797('0x10e')));})['catch'](function(_0x1a4ef2){ut[_0x4797('0x66')](_0x4797('0x10f'),_0x1a4ef2);_0x12e781(ut[_0x4797('0x7e')]('Call\x20failed',_0x2010ce,_0x207dc1));});}else{_0xf10189[_0x4797('0x3c')]+=0x1;ut[_0x4797('0x110')](_0x29cd5b);rpcDb[_0x4797('0x111')](_0x29cd5b,_0x4797('0x112'));delete _0x5a3150[_0x4797('0x72')][_0x1f7acf];_0x12e781(ut[_0x4797('0x7e')](_0x4797('0x113'),_0x2010ce,_0x207dc1));}});};Preview[_0x4797('0x10')][_0x4797('0x9d')]=function(_0x440b85){return!_['isNil'](_0x440b85)&&!_['isNil'](_0x440b85['name'])&&!_[_0x4797('0x6f')](_0x440b85[_0x4797('0x57')])&&_0x440b85[_0x4797('0x57')]&&!_[_0x4797('0x6f')](this[_0x4797('0x16')][util[_0x4797('0x5c')](_0x4797('0x114'),_0x440b85['name'])])&&!_['isNil'](this[_0x4797('0x16')][util[_0x4797('0x5c')](_0x4797('0x114'),_0x440b85[_0x4797('0x2a')])][_0x4797('0x7c')])&&(this[_0x4797('0x16')][util[_0x4797('0x5c')]('SIP/%s',_0x440b85[_0x4797('0x2a')])][_0x4797('0x7c')]===_0x4797('0x115')||this[_0x4797('0x16')][util[_0x4797('0x5c')](_0x4797('0x114'),_0x440b85['name'])][_0x4797('0x7c')]==='unmonitored');};Preview[_0x4797('0x10')]['run']=function(_0x86f7db,_0x56eee2){var _0x2e8180=this;return new BPromise(function(_0x2c6765,_0xfe28cd){_0x2e8180[_0x4797('0x116')](_0x86f7db,_0x56eee2)['then'](function(_0x50dcac){_0x2c6765(_['pick'](_0x50dcac,[_0x4797('0x7e')]));})[_0x4797('0x7d')](function(_0x3f821b){if(_0x3f821b[_0x4797('0x117')]){rpcDb['unlockContact'](_0x86f7db);}if(_0x3f821b['active']){rpcDb['disableContact'](_0x86f7db);}_0xfe28cd(_[_0x4797('0x118')](_0x3f821b,['message']));});});};Preview[_0x4797('0x10')][_0x4797('0x116')]=function(_0x3a7275,_0x8d7bfa){var _0x30648e=this;return new BPromise(function(_0x46bd99,_0xe3dbc){var _0x5963d2,_0x31ffae;rpcDb[_0x4797('0x119')](_0x3a7275)['then'](function(_0x111291){if(!_[_0x4797('0x6f')](_0x111291[0x0])){_0x31ffae=_0x111291[0x0][_0x4797('0x11a')]?![]:!![];_0x5963d2=_0x111291[0x0][_0x4797('0x11a')]?!![]:![];_0x5963d2=_0x8d7bfa?!![]:_0x5963d2;}var _0x36b7f8=_0x30648e['validateContact'](_0x111291);if(_0x36b7f8[_0x4797('0x11b')]){rpcDb[_0x4797('0x11c')](_['pick'](_0x111291[0x0],[_0x4797('0x79'),_0x4797('0x11d')]))[_0x4797('0x85')](function(_0xc21cf6){_0x30648e[_0x4797('0x102')](_0xc21cf6,_0x111291[0x0],_0x8d7bfa,_0x31ffae,_0x5963d2)[_0x4797('0x85')](function(_0x5a8462){_0x46bd99(_0x5a8462);})['catch'](function(_0x124b1a){_0xe3dbc(_0x124b1a);});})[_0x4797('0x7d')](function(_0x52885e){ut[_0x4797('0x66')](_0x4797('0x11e'),_0x52885e);_0xe3dbc(ut['message'](_0x4797('0x11f'),_0x31ffae,_0x5963d2));});}else{_0xe3dbc(ut[_0x4797('0x7e')](_0x36b7f8['message'],_0x31ffae,_0x5963d2));}})[_0x4797('0x7d')](function(_0x1a7d2c){ut['logger'](_0x4797('0x120'),_0x1a7d2c);_0xe3dbc(ut[_0x4797('0x7e')](_0x4797('0x11f'),![],!![]));});});};Preview[_0x4797('0x10')]['validateContact']=function(_0x1cba14){if(_['isNil'](_0x1cba14)||_[_0x4797('0x107')](_0x1cba14)||!_[_0x4797('0x6f')](_0x1cba14[0x0][_0x4797('0x8a')])&&_[_0x4797('0x6f')](_0x1cba14[0x0][_0x4797('0x8a')][_0x4797('0x2a')])){ut[_0x4797('0x66')](_0x4797('0x121'),_0x1cba14);return{'isValid':![],'message':_0x4797('0x122')};}var _0x57db47=this[_0x4797('0x26')][_0x1cba14[0x0][_0x4797('0x71')][_0x4797('0x2a')]];_0x57db47[_0x4797('0x7e')]=_0x4797('0x123');if(_[_0x4797('0x6f')](_0x57db47)){ut[_0x4797('0x66')](_0x4797('0x124'),_0x57db47);return{'isValid':![],'message':_0x4797('0x125')};}if(!this[_0x4797('0x9d')](_0x57db47[_0x4797('0x56')])){ut[_0x4797('0x66')](_0x4797('0x126'),_0x4797('0x127')+_0x57db47[_0x4797('0x2a')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x4797('0x9d')](_0x57db47[_0x4797('0x9e')])){ut[_0x4797('0x66')](_0x4797('0x126'),_0x57db47[_0x4797('0x2a')]+_0x4797('0x128'));return{'isValid':![],'message':_0x4797('0x129')};}}if(!ut[_0x4797('0x9c')](_0x57db47[_0x4797('0x6e')])){ut[_0x4797('0x66')](_0x4797('0x12a'),_0x57db47[_0x4797('0x2a')]+'\x20Not\x20Active');return{'isValid':![],'message':_0x4797('0x127')+_0x57db47['name']+_0x4797('0x12b')};}return{'isValid':!![],'message':_0x4797('0x12c')};};Preview[_0x4797('0x10')][_0x4797('0x108')]=function(_0x1808b1,_0x1e8357,_0x5d92c1,_0x27974f){var _0x44d21c=this;return new BPromise(function(_0x55527f,_0xd30928){var _0x31766c=_0x1808b1['uniqueid'];var _0x4add4b=_0x44d21c['isTrunkReachable'](_0x1e8357[_0x4797('0x56')])?util['format'](_0x4797('0x12d'),_0x1e8357[_0x4797('0x56')][_0x4797('0x2a')],_[_0x4797('0x6f')](_0x1e8357['dialPrefix'])?'':_0x1e8357[_0x4797('0x12e')][_0x4797('0x12f')]()||'',_0x1e8357[_0x4797('0x130')]>0x0?_0x5d92c1[_0x4797('0x103')]['phone']['substring'](_0x1e8357[_0x4797('0x130')]):_0x5d92c1['Contact'][_0x4797('0x104')]):util['format'](_0x4797('0x12d'),_[_0x4797('0x6f')](_0x1e8357[_0x4797('0x9e')])?_0x1e8357['Trunk'][_0x4797('0x2a')]:_0x1e8357[_0x4797('0x9e')]['name'],_['isNil'](_0x1e8357['dialPrefix'])?'':_0x1e8357['dialPrefix'][_0x4797('0x12f')]()||'',_0x1e8357['dialCutDigit']>0x0?_0x5d92c1[_0x4797('0x103')][_0x4797('0x104')][_0x4797('0x131')](_0x1e8357['dialCutDigit']):_0x5d92c1[_0x4797('0x103')][_0x4797('0x104')]);var _0x192dce=_0x44d21c[_0x4797('0x9d')](_0x1e8357[_0x4797('0x56')])?ut[_0x4797('0x132')](_0x1e8357[_0x4797('0x56')][_0x4797('0x58')],_0x1e8357[_0x4797('0x37')],_0x1e8357[_0x4797('0x133')]>0x0?ut[_0x4797('0x134')](_0x1e8357['dialOriginateCallerIdNumber'],_0x1e8357['dialRandomLastDigitCallerIdNumber']):_0x1e8357[_0x4797('0x38')]):ut['getCallerId'](_['isNil'](_0x1e8357[_0x4797('0x9e')])?_0x1e8357[_0x4797('0x56')][_0x4797('0x58')]:_0x1e8357[_0x4797('0x9e')]['callerid'],_0x1e8357[_0x4797('0x37')],_0x1e8357['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x4797('0x134')](_0x1e8357['dialOriginateCallerIdNumber'],_0x1e8357[_0x4797('0x133')]):_0x1e8357[_0x4797('0x38')]);if(_0x192dce){_0x1808b1[_0x4797('0x135')]=ut[_0x4797('0x136')](_0x192dce);_0x1808b1[_0x4797('0x137')]=ut[_0x4797('0x138')](_0x192dce);}var _0x8f51e3=ut[_0x4797('0x139')](_0x1e8357,_0x5d92c1,_0x4add4b,_0x192dce,_0x31766c,_0x1808b1);_[_0x4797('0x13a')](_0x1808b1,ut[_0x4797('0x13b')](_0x8f51e3));_0x1808b1[_0x4797('0x8f')]=moment()[_0x4797('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x4797('0x7b')](ut[_0x4797('0x13c')](_0x1808b1,_0x1e8357,_0x8f51e3,_0x1808b1['activeContact'],_0x27974f))[_0x4797('0x85')](function(_0x186077){var _0x288bc8=_0x1808b1[_0x4797('0x13d')];if(!_[_0x4797('0x6f')](_0x288bc8)){if(!_[_0x4797('0x6f')](_0x44d21c[_0x4797('0x17')][_0x288bc8])){_0x44d21c[_0x4797('0x17')][_0x288bc8][_0x4797('0x13e')]=_0x1808b1[_0x4797('0x13f')];emit(util['format'](_0x4797('0x140'),_0x44d21c['agents'][_0x288bc8]['name']),_0x4797('0x141'),{'destaccountcode':_0x44d21c[_0x4797('0x17')][_0x288bc8][_0x4797('0x142')],'destconnectedlinenum':_0x1808b1['calleridnum']});}}_0x1e8357[_0x4797('0x51')]+=0x1;logger[_0x4797('0x5f')](_0x4797('0x143'),_0x31766c,_0x4797('0xb6'),_0x1e8357[_0x4797('0x2a')],_0x4797('0x74'),_0x1e8357['originated']);_0x55527f(_0x186077);})[_0x4797('0x7d')](function(_0x5485d4){ut[_0x4797('0xf9')](_0x1808b1,0xe,_0x4797('0x144'));rpcDb[_0x4797('0xfb')](_0x1808b1,_0x4797('0x145'));_0xd30928(_0x5485d4);});});};Preview['prototype'][_0x4797('0x146')]=function(_0x2e13ac){if(this[_0x4797('0x72')][_0x2e13ac['linkedid']]){this[_0x4797('0x72')][_0x2e13ac[_0x4797('0xb1')]]['channel']=_0x2e13ac[_0x4797('0x147')];}};Preview[_0x4797('0x10')][_0x4797('0x148')]=function(_0x773cb9){var _0x56a3b7=this;var _0x202559=this['actions'][_0x773cb9[_0x4797('0x149')]];if(_0x202559){if(_0x202559[_0x4797('0x106')]&&this[_0x4797('0x17')][_0x202559[_0x4797('0x106')]]){ut[_0x4797('0x14a')](_0x202559,this['agents'][_0x202559[_0x4797('0x106')]][_0x4797('0x2a')],this['agents'][_0x202559[_0x4797('0x106')]]['id']);}var _0x4b95ef=_[_0x4797('0x14b')](_0x202559);_0x4b95ef[_0x4797('0x14c')]=moment()[_0x4797('0x5c')](_0x4797('0x90'));var _0x311aba=_0x56a3b7[_0x4797('0x26')][_0x202559[_0x4797('0x73')]];if(ut[_0x4797('0x14d')](_0x773cb9[_0x4797('0x14e')])){if(_0x202559['unlockAgent']){rpcDb[_0x4797('0x14f')](_0x202559[_0x4797('0x10b')]);}if(_0x202559[_0x4797('0xcb')]){rpcDb[_0x4797('0x8e')](_0x202559[_0x4797('0x10b')]);}ami[_0x4797('0x27')]('custom:agentringnoanswer',ut[_0x4797('0xa6')](_0x202559,'rejected',this['campaignsPreview'][_0x202559[_0x4797('0x73')]]));this[_0x4797('0xf5')](_0x4b95ef,_0x311aba,_0x773cb9);}else{_0x202559['starttime']=moment()[_0x4797('0x5c')](_0x4797('0x90'));ut[_0x4797('0xf9')](_0x4b95ef,0x4,_0x4797('0xbe'));rpcDb[_0x4797('0xfb')](_0x4b95ef,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x4797('0x10')][_0x4797('0x150')]=function(_0x4e5182){var _0x4a7c75=this;var _0x24d298=this[_0x4797('0x72')][_0x4e5182['linkedid']];var _0x1f6028;if(_0x24d298){_0x1f6028=this[_0x4797('0x26')][_0x24d298[_0x4797('0x73')]];logger[_0x4797('0x5f')](_0x4797('0x151'),_0x4e5182[_0x4797('0xb1')],_0x4797('0xb6'),_0x1f6028[_0x4797('0x2a')],_0x4797('0x75'),_0x1f6028[_0x4797('0x2e')]);}if(this[_0x4797('0x72')][_0x4e5182['linkedid']]&&_0x4e5182[_0x4797('0xb1')]!==_0x4e5182[_0x4797('0xb5')]){if(_0x4e5182['cause']==='16'&&this['actions'][_0x4e5182[_0x4797('0xb1')]][_0x4797('0x76')]){this[_0x4797('0xa0')](_0x4e5182,_0x4e5182[_0x4797('0xb1')],_0x4e5182[_0x4797('0x152')]);}else if(this[_0x4797('0x72')][_0x4e5182[_0x4797('0xb1')]][_0x4797('0x76')]){logger[_0x4797('0x5f')](_0x4797('0x153'),_0x4e5182['linkedid'],_0x4e5182[_0x4797('0x152')],'\x20Queue',_0x1f6028[_0x4797('0x2a')],_0x4797('0x75'),_0x1f6028['pTalking']);this[_0x4797('0xa0')](_0x4e5182,_0x4e5182[_0x4797('0xb1')],_0x4e5182[_0x4797('0x152')]);}}else if(_0x24d298&&_[_0x4797('0x6f')](_0x24d298[_0x4797('0x154')])&&_0x1f6028[_0x4797('0x155')]&&_0x4e5182['linkedid']===_0x4e5182[_0x4797('0xb5')]&&_[_0x4797('0x6f')](_0x4e5182[_0x4797('0xf8')])&&_0x4e5182[_0x4797('0x152')]==='16'&&_0x4e5182[_0x4797('0x156')]==='6'&&_[_0x4797('0xf6')](_0x24d298[_0x4797('0x157')])){if(_0x24d298[_0x4797('0xb0')]){rpcDb['unlockContact'](_0x24d298[_0x4797('0x10b')]);}if(_0x24d298[_0x4797('0xcb')]){rpcDb[_0x4797('0x8e')](_0x24d298[_0x4797('0x10b')]);}_0x4e5182[_0x4797('0xf8')]='22';this[_0x4797('0xf5')](_0x24d298,_0x1f6028,_0x4e5182);}else if(_0x24d298&&_0x24d298[_0x4797('0x157')]){if(_0x4e5182[_0x4797('0x152')]==='16'&&this[_0x4797('0x72')][_0x4e5182[_0x4797('0xb1')]]['dialAnswer']){logger[_0x4797('0x5f')](_0x4797('0x158'),_0x4e5182['linkedid'],_0x4e5182[_0x4797('0x152')],_0x4797('0xb6'),_0x1f6028['name'],_0x4797('0x75'),_0x1f6028['pTalking']);this[_0x4797('0xa0')](_0x4e5182,_0x4e5182[_0x4797('0xb1')],_0x4e5182[_0x4797('0x152')]);}else if(this['actions'][_0x4e5182[_0x4797('0xb1')]][_0x4797('0x76')]){logger[_0x4797('0x5f')]('[syncHangup][talking][cause]',_0x4e5182['linkedid'],_0x4e5182[_0x4797('0x152')],_0x4797('0xb6'),_0x1f6028[_0x4797('0x2a')],_0x4797('0x75'),_0x1f6028[_0x4797('0x2e')]);this['callProgressDetectingCustomer'](_0x4e5182,_0x4e5182[_0x4797('0xb1')],_0x4e5182[_0x4797('0x152')]);}}};Preview[_0x4797('0x10')]['syncDialEnd']=function(_0x111082){if(this[_0x4797('0x72')][_0x111082[_0x4797('0xf4')]]&&_0x111082['destlinkedid']!==_0x111082[_0x4797('0x159')]){this[_0x4797('0xa0')](_0x111082,_0x111082[_0x4797('0xf4')],_0x111082[_0x4797('0xec')]);}};Preview[_0x4797('0x10')][_0x4797('0x1d')]=function(_0x2fd4cf){if(this[_0x4797('0x72')][_0x2fd4cf[_0x4797('0xb1')]]&&_0x2fd4cf[_0x4797('0xb1')]!==_0x2fd4cf[_0x4797('0xb5')]&&!this['actions'][_0x2fd4cf['linkedid']]['dialAnswer']){if(_0x2fd4cf[_0x4797('0x152')]==='1'){this[_0x4797('0xa0')](_0x2fd4cf,_0x2fd4cf[_0x4797('0xb1')],_0x2fd4cf[_0x4797('0x152')]);}}};Preview[_0x4797('0x10')][_0x4797('0x15a')]=function(_0x5c42ba,_0x264fcd,_0x2a2d70){if(this[_0x4797('0x72')][_0x5c42ba]){if(_[_0x4797('0x6f')](this[_0x4797('0x72')][_0x5c42ba]['variables'])){this[_0x4797('0x72')][_0x5c42ba][_0x4797('0x15b')]={};}this[_0x4797('0x72')][_0x5c42ba]['variables'][_0x264fcd]=_0x2a2d70;}};Preview[_0x4797('0x10')]['syncVarSet']=function(_0x21063a){try{if(!_[_0x4797('0x6f')](_0x21063a)){if(ut['filterKey'](_['keys'](_0x21063a[_0x4797('0x15c')])[0x0])){this[_0x4797('0x15a')](_0x21063a[_0x4797('0xb5')],_[_0x4797('0x15d')](_0x21063a['variable'])[0x0],_0x21063a['value']);}}}catch(_0x16c3ab){logger['error'](_0x4797('0x15e'),util[_0x4797('0x15f')](_0x16c3ab,{'showHidden':![],'depth':null}));}};Preview[_0x4797('0x10')][_0x4797('0x160')]=function(_0x4f6bc5){if(_0x4f6bc5){if(this['actions'][_0x4f6bc5['transfertargetlinkedid']]){this[_0x4797('0x72')][_0x4f6bc5[_0x4797('0x161')]][_0x4797('0x157')]=!![];}}};Preview['prototype'][_0x4797('0x24')]=function(_0x5f46ca){if(_0x5f46ca){if(this[_0x4797('0x72')][_0x5f46ca[_0x4797('0x162')]]){this[_0x4797('0x72')][_0x5f46ca[_0x4797('0x162')]][_0x4797('0x157')]=!![];}}};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 5c8b172..09ba1db 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 _0x6ea7=['assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip','exten','holdtime'];(function(_0x1bf9ab,_0x3f200d){var _0x3a3bfe=function(_0x317768){while(--_0x317768){_0x1bf9ab['push'](_0x1bf9ab['shift']());}};_0x3a3bfe(++_0x3f200d);}(_0x6ea7,0x78));var _0x76ea=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6ea7[_0x21a9d9];return _0x46adce;};'use strict';var util=require(_0x76ea('0x0'));var BPromise=require(_0x76ea('0x1'));var logger=require(_0x76ea('0x2'))('preview');var _=require(_0x76ea('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0x76ea('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x76ea('0x5'));var voiceQueueRt=require(_0x76ea('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x98a330){return function(_0x51c627){logger[_0x76ea('0x7')](_0x98a330,util[_0x76ea('0x8')](_0x51c627,{'showHidden':![],'depth':null}));};}function create(_0x4603f2){return BPromise['resolve']()['then'](cmHopperHistory['createHistory'](_0x4603f2))[_0x76ea('0x9')](loggerCatch(_0x76ea('0xa')));}function createAgent(_0x339278){return BPromise[_0x76ea('0xb')]()[_0x76ea('0xc')](agentReportPreview[_0x76ea('0xd')](_0x339278))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x217a29){return BPromise['resolve']()['then'](cmHopper[_0x76ea('0xe')](_0x217a29,!![]))[_0x76ea('0x9')](loggerCatch(_0x76ea('0xf')));}exports[_0x76ea('0x10')]=function(_0x1608be){return BPromise[_0x76ea('0xb')]()['then'](cmHopperBlack[_0x76ea('0x10')](_0x1608be))['catch'](loggerCatch(_0x76ea('0x11')));};exports[_0x76ea('0x12')]=function(_0x9f8b8f){return BPromise[_0x76ea('0xb')]()[_0x76ea('0xc')](cmHopper['getContactPreview'](_0x9f8b8f))[_0x76ea('0x9')](loggerCatch(_0x76ea('0x13')));};exports[_0x76ea('0xd')]=function(_0x1df2b9,_0x32df3c){create(_0x1df2b9)[_0x76ea('0x9')](loggerCatch(_0x32df3c));moveContact(_0x1df2b9)['catch'](loggerCatch(_0x32df3c));};exports[_0x76ea('0x14')]=function(_0x28c36d,_0x28193c){createAgent(_0x28c36d)['catch'](loggerCatch(_0x28193c));};exports[_0x76ea('0x15')]=function(_0x13eb1b,_0x3b97d8){create(_0x13eb1b)['catch'](loggerCatch(_0x3b97d8));};exports[_0x76ea('0x16')]=function(_0x4e61dd,_0x5746da){moveContact(_0x4e61dd)[_0x76ea('0x9')](loggerCatch(_0x5746da));};exports[_0x76ea('0x17')]=function(_0x1063fc,_0x2ff379,_0x1a57c7){if(_0x2ff379){_0x1063fc[_0x76ea('0x18')]=null;}if(_0x1a57c7){_0x1063fc[_0x76ea('0x19')]=![];}return BPromise[_0x76ea('0xb')]()['then'](cmHopper[_0x76ea('0x17')](_0x1063fc))[_0x76ea('0x9')](loggerCatch(_0x76ea('0x1a')));};exports['countReScheduled']=function(_0x2266a4){return BPromise[_0x76ea('0xb')]()[_0x76ea('0xc')](cmHopper[_0x76ea('0x1b')](_0x2266a4))[_0x76ea('0x9')](loggerCatch(_0x76ea('0x1c')));};exports[_0x76ea('0x1d')]=function(_0x7339d0){return BPromise[_0x76ea('0xb')]()[_0x76ea('0xc')](cmHopper[_0x76ea('0x1d')]({'UserId':null},_0x7339d0,0x1))[_0x76ea('0x9')](loggerCatch(_0x76ea('0x1e')));};exports['disableContact']=function(_0x4eb56){return BPromise[_0x76ea('0xb')]()[_0x76ea('0xc')](cmHopper[_0x76ea('0x1d')]({'active':![]},_0x4eb56,0x1))[_0x76ea('0x9')](loggerCatch(_0x76ea('0x1f')));};exports[_0x76ea('0x20')]=function(_0x2397cf){var _0x399e8a={};_0x399e8a['type']=_0x2397cf[_0x76ea('0x21')];_0x399e8a[_0x76ea('0x22')]=_0x2397cf[_0x76ea('0x22')];_0x399e8a['calleridnum']=_0x2397cf[_0x76ea('0x23')];_0x399e8a[_0x76ea('0x24')]=_0x2397cf[_0x76ea('0x24')];_0x399e8a[_0x76ea('0x25')]=_0x2397cf[_0x76ea('0x25')];_0x399e8a['queuecallerjoinAt']=_0x2397cf[_0x76ea('0x26')];_0x399e8a[_0x76ea('0x27')]=_0x2397cf[_0x76ea('0x26')];_0x399e8a[_0x76ea('0x28')]=0x1;_0x399e8a['queuecallercompleteAt']=_0x2397cf[_0x76ea('0x29')];_0x399e8a[_0x76ea('0x2a')]=_0x2397cf[_0x76ea('0x2b')];_0x399e8a[_0x76ea('0x2c')]=_0x76ea('0x2d');_0x399e8a[_0x76ea('0x2e')]='xcally-motion-preview';_0x399e8a[_0x76ea('0x2f')]=0x0;_0x399e8a[_0x76ea('0x30')]=0x1;_0x399e8a[_0x76ea('0x31')]=_0x2397cf[_0x76ea('0x2b')];_0x399e8a[_0x76ea('0x32')]=_0x76ea('0x33');return BPromise[_0x76ea('0xb')]()[_0x76ea('0xc')](voiceQueueReport[_0x76ea('0x34')](_0x399e8a))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0xe495f4,_0x41b84a){return BPromise[_0x76ea('0xb')]()['then'](cmHopper['getContactRecallMe'](_0xe495f4,_0x41b84a))['catch'](loggerCatch(_0x76ea('0x35')));};exports[_0x76ea('0x36')]=function(_0x1cbdb7){return BPromise['resolve']()['then'](cmHopper[_0x76ea('0x17')](_0x1cbdb7,!![],!![]))[_0x76ea('0x9')](loggerCatch(_0x76ea('0x37')));}; \ No newline at end of file +var _0x54e9=['[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20'];(function(_0x2da402,_0x14a691){var _0x31a57d=function(_0x3cfb60){while(--_0x3cfb60){_0x2da402['push'](_0x2da402['shift']());}};_0x31a57d(++_0x14a691);}(_0x54e9,0x1b0));var _0x954e=function(_0x5462f3,_0x25c65e){_0x5462f3=_0x5462f3-0x0;var _0x2ea644=_0x54e9[_0x5462f3];return _0x2ea644;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x954e('0x0'))(_0x954e('0x1'));var _=require(_0x954e('0x2'));var cmHopper=require(_0x954e('0x3'));var cmHopperFinal=require(_0x954e('0x4'));var cmHopperHistory=require(_0x954e('0x5'));var cmHopperBlack=require(_0x954e('0x6'));var voiceQueueRt=require(_0x954e('0x7'));var agentReportPreview=require(_0x954e('0x8'));var voiceQueueReport=require(_0x954e('0x9'));function loggerCatch(_0x2e1b51){return function(_0x265522){logger['error'](_0x2e1b51,util[_0x954e('0xa')](_0x265522,{'showHidden':![],'depth':null}));};}function create(_0x14cb5f){return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](cmHopperHistory[_0x954e('0xd')](_0x14cb5f))[_0x954e('0xe')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x149c80){return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](agentReportPreview[_0x954e('0xd')](_0x149c80))[_0x954e('0xe')](loggerCatch(_0x954e('0xf')));}function moveContact(_0x402bdc){return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](cmHopper['moveContactManagedDialer'](_0x402bdc,!![]))[_0x954e('0xe')](loggerCatch(_0x954e('0x10')));}exports[_0x954e('0x11')]=function(_0x99d724){return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](cmHopperBlack['checkIsBlackList'](_0x99d724))[_0x954e('0xe')](loggerCatch(_0x954e('0x12')));};exports[_0x954e('0x13')]=function(_0x26f6f8){return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](cmHopper[_0x954e('0x13')](_0x26f6f8))[_0x954e('0xe')](loggerCatch(_0x954e('0x14')));};exports[_0x954e('0xd')]=function(_0x9d5ea0,_0x48cdb0){create(_0x9d5ea0)[_0x954e('0xe')](loggerCatch(_0x48cdb0));moveContact(_0x9d5ea0)[_0x954e('0xe')](loggerCatch(_0x48cdb0));};exports[_0x954e('0x15')]=function(_0x289863,_0x34c32e){createAgent(_0x289863)[_0x954e('0xe')](loggerCatch(_0x34c32e));};exports[_0x954e('0x16')]=function(_0x4bccff,_0x5a26f0){create(_0x4bccff)['catch'](loggerCatch(_0x5a26f0));};exports[_0x954e('0x17')]=function(_0x1d87a4,_0x1136e4){moveContact(_0x1d87a4)[_0x954e('0xe')](loggerCatch(_0x1136e4));};exports[_0x954e('0x18')]=function(_0x126426,_0x47a3be,_0x3f17b1){if(_0x47a3be){_0x126426['UserId']=null;}if(_0x3f17b1){_0x126426[_0x954e('0x19')]=![];}return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](cmHopper['rescheduleContact'](_0x126426))[_0x954e('0xe')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x954e('0x1a')]=function(_0x139c58){return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](cmHopper['countReScheduled'](_0x139c58))['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0x954e('0x1b')]=function(_0x19381e){return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](cmHopper['unlockContact']({'UserId':null},_0x19381e,0x1))[_0x954e('0xe')](loggerCatch(_0x954e('0x1c')));};exports[_0x954e('0x1d')]=function(_0xcf9f18){return BPromise[_0x954e('0xb')]()['then'](cmHopper[_0x954e('0x1b')]({'active':![]},_0xcf9f18,0x1))[_0x954e('0xe')](loggerCatch(_0x954e('0x1e')));};exports[_0x954e('0x1f')]=function(_0x54c34e){var _0x3ec1b2={};_0x3ec1b2[_0x954e('0x20')]=_0x54c34e[_0x954e('0x20')];_0x3ec1b2[_0x954e('0x21')]=_0x54c34e['uniqueid'];_0x3ec1b2[_0x954e('0x22')]=_0x54c34e[_0x954e('0x22')];_0x3ec1b2['calleridname']=_0x54c34e['calleridname'];_0x3ec1b2[_0x954e('0x23')]=_0x54c34e[_0x954e('0x23')];_0x3ec1b2[_0x954e('0x24')]=_0x54c34e['answertime'];_0x3ec1b2[_0x954e('0x25')]=_0x54c34e[_0x954e('0x26')];_0x3ec1b2[_0x954e('0x27')]=0x1;_0x3ec1b2[_0x954e('0x28')]=_0x54c34e[_0x954e('0x29')];_0x3ec1b2[_0x954e('0x2a')]=_0x54c34e[_0x954e('0x2b')];_0x3ec1b2[_0x954e('0x2c')]=_0x954e('0x2d');_0x3ec1b2['exten']=_0x954e('0x2e');_0x3ec1b2[_0x954e('0x2f')]=0x0;_0x3ec1b2[_0x954e('0x30')]=0x1;_0x3ec1b2[_0x954e('0x31')]=_0x54c34e['membername'];_0x3ec1b2[_0x954e('0x32')]='COMPLETED';return BPromise[_0x954e('0xb')]()[_0x954e('0xc')](voiceQueueReport[_0x954e('0x33')](_0x3ec1b2))[_0x954e('0xe')](loggerCatch(_0x954e('0x34')));};exports[_0x954e('0x35')]=function(_0x130902,_0x366d76){return BPromise['resolve']()[_0x954e('0xc')](cmHopper['getContactRecallMe'](_0x130902,_0x366d76))[_0x954e('0xe')](loggerCatch(_0x954e('0x36')));};exports['rescheduleContactInQueue']=function(_0x569f29){return BPromise['resolve']()[_0x954e('0xc')](cmHopper[_0x954e('0x18')](_0x569f29,!![],!![]))[_0x954e('0xe')](loggerCatch(_0x954e('0x37')));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index 728d9cd..212910a 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 _0xa28f=['RECALL','calleridname','uniqueid','originate','channelAgent','calleridnum','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','scheduledat','add','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','buildObj','lastevent','queue','interface','mandatoryDisposition','buildAcw','not_inuse','status','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','membername','active','countbusyretry','callback','callbackuniqueid','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqosloss','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','match','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','error','logger','info','inspect','loggerError','logger2','message','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','dialQueueProject2','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Contact','hasOwnProperty','tags','updatedAt','%s%s','toUpper','toLowerVariables','updateOriginated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','starttime','logLookAgent','logCustomer','state','talktime','answertime','isFailure','Failure'];(function(_0x46bf3b,_0x380870){var _0x59644b=function(_0x193c96){while(--_0x193c96){_0x46bf3b['push'](_0x46bf3b['shift']());}};_0x59644b(++_0x380870);}(_0xa28f,0x159));var _0xfa28=function(_0x2c1265,_0x1f04d8){_0x2c1265=_0x2c1265-0x0;var _0x2b1084=_0xa28f[_0x2c1265];return _0x2b1084;};'use strict';var util=require(_0xfa28('0x0'));var _=require('lodash');var moment=require(_0xfa28('0x1'));var logger=require(_0xfa28('0x2'))('preview');var ipAgi=process[_0xfa28('0x3')][_0xfa28('0x4')]||_0xfa28('0x5');function getSeconds(_0x2b1987,_0x2f6731){var _0x57be21=moment(_0x2b1987)[_0xfa28('0x6')](0x0);var _0x10398c=moment(_0x2f6731)['milliseconds'](0x0);return _0x57be21['diff'](_0x10398c,_0xfa28('0x7'));}exports['loggerCatch']=function(_0x31b6fe){return function(_0x25da2d){logger[_0xfa28('0x8')](_0x31b6fe,util['inspect'](_0x25da2d,{'showHidden':![],'depth':null}));};};exports[_0xfa28('0x9')]=function(_0x33d2d4,_0x44ae72){logger[_0xfa28('0xa')](_0x33d2d4,util[_0xfa28('0xb')](_0x44ae72,{'showHidden':![],'depth':null}));};exports[_0xfa28('0xc')]=function(_0x126e0e,_0x484f8e){logger[_0xfa28('0x8')](_0x126e0e,util['inspect'](_0x484f8e,{'showHidden':![],'depth':null}));};exports[_0xfa28('0xd')]=function(_0x3b4f9d){return function(_0x3cadc2){logger['info'](_0x3b4f9d,util['inspect'](_0x3cadc2,{'showHidden':![],'depth':null}));};};exports[_0xfa28('0xe')]=function(_0x242304,_0x3279fe,_0x2ea55c){return{'message':_0x242304,'unlock':_0x3279fe,'active':_0x2ea55c};};exports['getCallerId']=function(_0x10e5a5,_0x33a68e,_0x947e96){if(!_[_0xfa28('0xf')](_0x947e96)&&_0xfa28('0x10')===typeof _0x947e96&&!_[_0xfa28('0x11')](_0x947e96)){if(!_[_0xfa28('0xf')](_0x33a68e)&&_0xfa28('0x10')===typeof _0x33a68e&&!_[_0xfa28('0x11')](_0x33a68e)){return util[_0xfa28('0x12')](_0xfa28('0x13'),_0x33a68e,_0x947e96);}return util[_0xfa28('0x12')](_0xfa28('0x13'),_0x947e96,_0x947e96);}if(!_[_0xfa28('0xf')](_0x10e5a5)&&_0xfa28('0x10')===typeof _0x10e5a5&&!_[_0xfa28('0x11')](_0x10e5a5)){return _0x10e5a5;}return _0xfa28('0x14');};exports[_0xfa28('0x15')]=function(_0x30207d){if(_[_0xfa28('0x16')](_0x30207d)){return![];}return _0x30207d;};exports['addVariables']=function(_0x1959b2,_0x12f90b,_0x54b887,_0x277cf0,_0x1bacc0,_0x37206a){var _0x3fdf67={'XMD-QUEUE':_0x12f90b[_0xfa28('0x17')]?_0x12f90b[_0xfa28('0x17')][_0xfa28('0x18')]:'','XMD-CALLERID':_0x277cf0,'XMD-CALLERID-PREVIEW':_0x37206a?util['format'](_0xfa28('0x13'),_0x37206a['calleridname'],_0x37206a['calleridnum']):_0x277cf0,'XMD-DIALID':_0x1bacc0,'XMD-CONTACTID':_0x12f90b[_0xfa28('0x19')],'XMD-CDRTYPE':_0xfa28('0x1a'),'CALLERID(all)':_0x277cf0,'XMD-VOICEQUEUEID':_0x12f90b['VoiceQueueId'],'XMD-DIALCHANNEL':_0x54b887,'XMD-DIALTIMEOUT':_0x1959b2[_0xfa28('0x1b')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0xfa28('0x1c'),_0x1959b2['dialQueueProject2']?'g':'',_['isEmpty'](_0x1959b2[_0xfa28('0x1d')])?'':_0xfa28('0x1e')),'XMD-DIALURL':_0x1959b2[_0xfa28('0x1f')]||'','XMD-AGI':_0x1959b2['dialQueueProject']?util[_0xfa28('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x1959b2[_0xfa28('0x20')]):_0xfa28('0x21'),'XMD-AGIAFTER':_0x1959b2[_0xfa28('0x22')]?util['format'](_0xfa28('0x23'),ipAgi,_0x1959b2[_0xfa28('0x22')]):_0xfa28('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x37206a?_0x37206a[_0xfa28('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x37206a?_0x37206a['originatecalleridname']:'','XMD-DESTINATION':_0xfa28('0x25')};if(!_['isEmpty'](_0x1959b2[_0xfa28('0x1d')])){_0x3fdf67[util[_0xfa28('0x12')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x1959b2[_0xfa28('0x1d')];_0x3fdf67[util[_0xfa28('0x12')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x1bacc0;}if(_0x12f90b&&_0x12f90b[_0xfa28('0x26')]){for(var _0x12a35a in _0x12f90b[_0xfa28('0x26')]){if(_0x12f90b[_0xfa28('0x26')][_0xfa28('0x27')](_0x12a35a)){if(!_[_0xfa28('0x16')](_0x12f90b[_0xfa28('0x26')][_0x12a35a])&&_0x12a35a!=='id'&&_0x12a35a!==_0xfa28('0x28')&&_0x12a35a!=='createdAt'&&_0x12a35a!==_0xfa28('0x29')){_0x3fdf67[util[_0xfa28('0x12')](_0xfa28('0x2a'),'XMD-',_[_0xfa28('0x2b')](_0x12a35a))]=_0x12f90b[_0xfa28('0x26')][_0x12a35a];}}}}return _0x3fdf67;};exports[_0xfa28('0x2c')]=function(_0x184557){var _0x393ac7={};for(var _0x45edb4 in _0x184557){if(_0x184557[_0xfa28('0x27')](_0x45edb4)){_0x393ac7[util['format']('%s',_['toLower'](_0x45edb4))]=_0x184557[_0x45edb4];}}return{'variables':_0x393ac7};};exports[_0xfa28('0x2d')]=function(_0x444f6e,_0x57a14c){if(!_['isNil'](_0x444f6e)){if(_0x444f6e[_0xfa28('0x27')]('originated')){if(_0x444f6e['originated']>0x0){_0x444f6e['originated']-=0x1;}else{logger['error'](_0xfa28('0x2e'),_0x57a14c);}}}else{logger[_0xfa28('0x8')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x57a14c);}};exports[_0xfa28('0x2f')]=function(_0x57ce45){var _0x300954=moment()['format'](_0xfa28('0x30'));_0x57ce45['state']=0xd;_0x57ce45[_0xfa28('0x31')]=_0xfa28('0x32');_0x57ce45['starttime']=_0x300954;_0x57ce45[_0xfa28('0x33')]=_0x300954;_0x57ce45[_0xfa28('0x34')]=_0x300954;};exports[_0xfa28('0x35')]=function(_0x2ef1c7,_0x4f673b,_0x396009){var _0x150614=moment()[_0xfa28('0x12')](_0xfa28('0x30'));_0x2ef1c7['state']=_0x4f673b;_0x2ef1c7[_0xfa28('0x31')]=_0x396009;_0x2ef1c7[_0xfa28('0x33')]=_0x150614;_0x2ef1c7[_0xfa28('0x36')]=getSeconds(_0x2ef1c7[_0xfa28('0x33')],_0x2ef1c7[_0xfa28('0x37')]);};exports[_0xfa28('0x38')]=function(_0x1f90e8,_0x5cebbf,_0x50e179){_0x1f90e8['membername']=_0x5cebbf;_0x1f90e8['UserId']=_0x50e179;};exports[_0xfa28('0x39')]=function(_0x4a38c4,_0x37dcfd,_0x3171c8){var _0x5d9968=moment()[_0xfa28('0x12')](_0xfa28('0x30'));_0x4a38c4[_0xfa28('0x3a')]=_0x37dcfd;_0x4a38c4[_0xfa28('0x31')]=_0x3171c8;_0x4a38c4[_0xfa28('0x33')]=_0x4a38c4[_0xfa28('0x33')]?_0x4a38c4[_0xfa28('0x33')]:_0x5d9968;_0x4a38c4[_0xfa28('0x34')]=_0x4a38c4[_0xfa28('0x34')]?_0x4a38c4[_0xfa28('0x34')]:_0x5d9968;_0x4a38c4['ringtime']=getSeconds(_0x4a38c4[_0xfa28('0x33')]||0x0,_0x4a38c4[_0xfa28('0x37')]||0x0);_0x4a38c4[_0xfa28('0x3b')]=_0x4a38c4[_0xfa28('0x3c')]?getSeconds(_0x4a38c4[_0xfa28('0x34')],_0x4a38c4['answertime']):0x0;};exports[_0xfa28('0x3d')]=function(_0x5aad4c){return _0x5aad4c===_0xfa28('0x3e');};exports['variablesAction']=function(_0x1501dd,_0x1ee3ce,_0xaf96e5,_0x7f257d,_0xcde1ef){var _0x1a50d1=_0x7f257d?_0xfa28('0x3f'):_0x1501dd[_0xfa28('0x40')];_0x1a50d1=_0xcde1ef?'BOOKED':_0x1a50d1;return{'actionid':_0x1501dd[_0xfa28('0x41')],'action':_0xfa28('0x42'),'channel':_0x1501dd[_0xfa28('0x43')],'callerid':util[_0xfa28('0x12')](_0xfa28('0x13'),_0x1a50d1,_0x1501dd[_0xfa28('0x44')]),'Exten':_0xfa28('0x25'),'Context':'from-sip','Priority':'1','variable':_0xaf96e5,'timeout':(_0x1ee3ce[_0xfa28('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1501dd[_0xfa28('0x41')]};};exports[_0xfa28('0x46')]=function(_0x2724a3){return _0x2724a3['countbusyretry']+_0x2724a3[_0xfa28('0x47')]+_0x2724a3[_0xfa28('0x48')]+_0x2724a3[_0xfa28('0x49')]+_0x2724a3[_0xfa28('0x4a')];};exports[_0xfa28('0x4b')]=function(_0xb4807f){var _0x1d661d=_['clone'](_0xb4807f);_0x1d661d[_0xfa28('0x3a')]=0xf;_0x1d661d[_0xfa28('0x31')]=_0xfa28('0x4c');return _0x1d661d;};exports[_0xfa28('0x4d')]=function(_0x26941b,_0x212bc8,_0x134a19){var _0x5e6f01={};_0x5e6f01[_0x212bc8]=_0x26941b[_0x212bc8];_0x5e6f01['active']=![];_0x5e6f01[_0xfa28('0x4e')]=moment()[_0xfa28('0x4f')](_0x134a19,'minutes')[_0xfa28('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e6f01[_0xfa28('0x19')]=_0x26941b['ContactId'];_0x5e6f01[_0xfa28('0x50')]=_0x26941b['ListId'];_0x5e6f01[_0xfa28('0x51')]=_0x26941b[_0xfa28('0x51')]||undefined;return _0x5e6f01;};exports[_0xfa28('0x52')]=function(_0x6ece5f,_0x360917){if(!_[_0xfa28('0x16')](_0x6ece5f)){if(_0x6ece5f['pTalking']>0x0){_0x6ece5f[_0xfa28('0x53')]-=0x1;}else{logger[_0xfa28('0x8')](_0x360917,_0xfa28('0x54'));}}else{logger[_0xfa28('0x8')](_0x360917,_0xfa28('0x55'));}};exports[_0xfa28('0x56')]=function(_0x120332){if(_0x120332<=0x0){return!![];}return![];};exports[_0xfa28('0x57')]=function(_0x522664,_0x29f4f5,_0x4c3f38){_0x522664[_0xfa28('0x58')]=_0x29f4f5;_0x522664[_0xfa28('0x18')]=_0x522664[_0xfa28('0x59')];_0x522664[_0xfa28('0x5a')]=_0x522664[_0xfa28('0x43')];if(_0x4c3f38){_0x522664[_0xfa28('0x5b')]=_0x4c3f38[_0xfa28('0x5b')];}return _0x522664;};exports[_0xfa28('0x5c')]=function(_0x288ecc){var _0x25e670={};_0x25e670[_0xfa28('0x59')]=_0x288ecc[_0xfa28('0x59')];_0x25e670['interface']=_0x288ecc[_0xfa28('0x43')];_0x25e670[_0xfa28('0x41')]=_0x288ecc[_0xfa28('0x41')];return _0x25e670;};exports['agentReadyId']=function(_0x3a5c92){var _0x353059=[];for(var _0x2dae9e in _0x3a5c92){if(_0x3a5c92[_0xfa28('0x27')](_0x2dae9e)){if(!_[_0xfa28('0x16')](_0x3a5c92[_0x2dae9e])&&_0x3a5c92[_0x2dae9e]['state']===_0xfa28('0x5d')&&_0x3a5c92[_0x2dae9e][_0xfa28('0x5e')]===_0xfa28('0x5f')){_0x353059[_0xfa28('0x60')](_0x3a5c92[_0x2dae9e]['id']);}}}return _0x353059;};exports[_0xfa28('0x61')]=function(_0x5858e0){var _0x5dba5c=moment()['milliseconds'](0x0);var _0x31cd57=moment(_0x5858e0)[_0xfa28('0x6')](0x0);return _0x5dba5c[_0xfa28('0x62')](_0x31cd57,_0xfa28('0x7'));};exports[_0xfa28('0x63')]=function(_0x73df01){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x73df01[_0xfa28('0x19')],'ListId':_0x73df01[_0xfa28('0x50')],'VoiceQueueId':_0x73df01[_0xfa28('0x51')]||undefined,'CampaignId':_0x73df01[_0xfa28('0x64')]||undefined};};exports[_0xfa28('0x65')]=function(_0x13705c){if(_0x13705c===_0xfa28('0x41')||_0x13705c===_0xfa28('0x66')||_0x13705c===_0xfa28('0x59')||_0x13705c===_0xfa28('0x67')||_0x13705c===_0xfa28('0x68')||_0x13705c===_0xfa28('0x69')||_0x13705c===_0xfa28('0x6a')||_0x13705c===_0xfa28('0x43')||_0x13705c===_0xfa28('0x40')||_0x13705c===_0xfa28('0x6b')||_0x13705c===_0xfa28('0x44')||_0x13705c==='scheduledat'||_0x13705c===_0xfa28('0x6c')||_0x13705c===_0xfa28('0x47')||_0x13705c===_0xfa28('0x48')||_0x13705c==='countglobal'||_0x13705c===_0xfa28('0x6d')||_0x13705c===_0xfa28('0x6e')||_0x13705c===_0xfa28('0x6f')||_0x13705c===_0xfa28('0x70')||_0x13705c===_0xfa28('0x19')||_0x13705c===_0xfa28('0x50')||_0x13705c===_0xfa28('0x71')||_0x13705c===_0xfa28('0x51')||_0x13705c===_0xfa28('0x72')||_0x13705c===_0xfa28('0x73')||_0x13705c===_0xfa28('0x74')||_0x13705c===_0xfa28('0x75')||_0x13705c==='xmd-listid'||_0x13705c==='xmd-dialurl'||_0x13705c==='xmd-dialtimeout'||_0x13705c==='xmd-dialoptions'||_0x13705c===_0xfa28('0x76')||_0x13705c===_0xfa28('0x77')||_0x13705c===_0xfa28('0x78')||_0x13705c===_0xfa28('0x79')||_0x13705c===_0xfa28('0x7a')||_0x13705c===_0xfa28('0x7b')||_0x13705c==='xmd-agi'||_0x13705c==='rtpaudioqos'||_0x13705c===_0xfa28('0x7c')||_0x13705c===_0xfa28('0x7d')||_0x13705c===_0xfa28('0x7e')||_0x13705c==='rtpaudioqosloss'||_0x13705c===_0xfa28('0x7f')||_0x13705c==='rtpaudioqosrtt'||_0x13705c===_0xfa28('0x80')||_0x13705c==='rtpaudioqos'||_0x13705c===_0xfa28('0x7c')||_0x13705c==='rtpaudioqosjitter'||_0x13705c===_0xfa28('0x7e')||_0x13705c===_0xfa28('0x81')||_0x13705c===_0xfa28('0x7f')||_0x13705c===_0xfa28('0x82')||_0x13705c===_0xfa28('0x80')||_0x13705c===_0xfa28('0x83')||_0x13705c===_0xfa28('0x84')||_0x13705c==='state'||_0x13705c===_0xfa28('0x31')){return![];}return!![];};exports[_0xfa28('0x85')]=function(_0x4ee1f4,_0x23fca2){var _0x1a8c94,_0x2c63b3,_0x1516f8;if(_0x23fca2<=0x0){_0x23fca2=0x1;}_0x1a8c94=new RegExp(_0xfa28('0x86')+_0x23fca2+'}$');_0x2c63b3=Math['pow'](0xa,_0x23fca2-0x1);_0x1516f8=Math['pow'](0xa,_0x23fca2)-0x1;return util[_0xfa28('0x12')]('%s',_['replace'](_0x4ee1f4,_0x1a8c94,_['random'](_0x2c63b3,_0x1516f8)));};exports['extractCalleridName']=function(_0xb8eff7){var _0x404695=_0xb8eff7[_0xfa28('0x87')](/"(.*?)"/);return _0x404695?_0x404695[0x1]:_0xb8eff7;};exports['extractCalleridNumber']=function(_0x26a12d){var _0x4ac13f=_0x26a12d['match'](/<(.*?)>/);return _0x4ac13f?_0x4ac13f[0x1]:_0x26a12d;}; \ No newline at end of file +var _0x0232=['xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','random','match','util','lodash','moment','env','127.0.0.1','milliseconds','diff','seconds','loggerCatch','error','logger','info','inspect','loggerError','logger2','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','createdAt','updatedAt','%s%s','toUpper','toLower','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','starttime','responsetime','endtime','logAgent','statedesc','ringtime','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','from-sip','totalGlobal','countnoanswerretry','countagentrejectretry','cloneAction','clone','Global','scheduledAt','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','queue','interface','channelAgent','mandatoryDisposition','status','push','getDiff','CampaignId','filterKey','idContact','type','campaigntype','active','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-phone','xmd-listid','xmd-dialurl','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter'];(function(_0x2619ab,_0x5bc665){var _0x267c56=function(_0x4de55a){while(--_0x4de55a){_0x2619ab['push'](_0x2619ab['shift']());}};_0x267c56(++_0x5bc665);}(_0x0232,0x10c));var _0x2023=function(_0x329b53,_0x55ab65){_0x329b53=_0x329b53-0x0;var _0x48468d=_0x0232[_0x329b53];return _0x48468d;};'use strict';var util=require(_0x2023('0x0'));var _=require(_0x2023('0x1'));var moment=require(_0x2023('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x2023('0x3')]['XCALLY_IP_AGI']||_0x2023('0x4');function getSeconds(_0xc09520,_0x4591b0){var _0x193cbe=moment(_0xc09520)[_0x2023('0x5')](0x0);var _0xff669c=moment(_0x4591b0)[_0x2023('0x5')](0x0);return _0x193cbe[_0x2023('0x6')](_0xff669c,_0x2023('0x7'));}exports[_0x2023('0x8')]=function(_0x357f5e){return function(_0xbf7e21){logger[_0x2023('0x9')](_0x357f5e,util['inspect'](_0xbf7e21,{'showHidden':![],'depth':null}));};};exports[_0x2023('0xa')]=function(_0x2c0b9f,_0x3fc7cd){logger[_0x2023('0xb')](_0x2c0b9f,util[_0x2023('0xc')](_0x3fc7cd,{'showHidden':![],'depth':null}));};exports[_0x2023('0xd')]=function(_0x594d13,_0x1e1a34){logger['error'](_0x594d13,util[_0x2023('0xc')](_0x1e1a34,{'showHidden':![],'depth':null}));};exports[_0x2023('0xe')]=function(_0x23159d){return function(_0x23fa83){logger[_0x2023('0xb')](_0x23159d,util[_0x2023('0xc')](_0x23fa83,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3e7895,_0x351f29,_0x178fd4){return{'message':_0x3e7895,'unlock':_0x351f29,'active':_0x178fd4};};exports['getCallerId']=function(_0x7e2acb,_0x87642,_0x5b6083){if(!_[_0x2023('0xf')](_0x5b6083)&&_0x2023('0x10')===typeof _0x5b6083&&!_[_0x2023('0x11')](_0x5b6083)){if(!_[_0x2023('0xf')](_0x87642)&&_0x2023('0x10')===typeof _0x87642&&!_[_0x2023('0x11')](_0x87642)){return util[_0x2023('0x12')](_0x2023('0x13'),_0x87642,_0x5b6083);}return util[_0x2023('0x12')](_0x2023('0x13'),_0x5b6083,_0x5b6083);}if(!_[_0x2023('0xf')](_0x7e2acb)&&_0x2023('0x10')===typeof _0x7e2acb&&!_[_0x2023('0x11')](_0x7e2acb)){return _0x7e2acb;}return'\x22\x22\x20<>';};exports[_0x2023('0x14')]=function(_0x4531e5){if(_['isNil'](_0x4531e5)){return![];}return _0x4531e5;};exports['addVariables']=function(_0x41befc,_0x1505c0,_0x47fafb,_0xb68583,_0x488487,_0x35e112){var _0x11fe55={'XMD-QUEUE':_0x1505c0['Queue']?_0x1505c0['Queue'][_0x2023('0x15')]:'','XMD-CALLERID':_0xb68583,'XMD-CALLERID-PREVIEW':_0x35e112?util[_0x2023('0x12')](_0x2023('0x13'),_0x35e112[_0x2023('0x16')],_0x35e112[_0x2023('0x17')]):_0xb68583,'XMD-DIALID':_0x488487,'XMD-CONTACTID':_0x1505c0['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xb68583,'XMD-VOICEQUEUEID':_0x1505c0[_0x2023('0x18')],'XMD-DIALCHANNEL':_0x47fafb,'XMD-DIALTIMEOUT':_0x41befc[_0x2023('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x2023('0x12')](_0x2023('0x1a'),_0x41befc[_0x2023('0x1b')]?'g':'',_['isEmpty'](_0x41befc['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x41befc[_0x2023('0x1c')]||'','XMD-AGI':_0x41befc[_0x2023('0x1d')]?util[_0x2023('0x12')](_0x2023('0x1e'),ipAgi,_0x41befc['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x41befc[_0x2023('0x1b')]?util[_0x2023('0x12')]('\x22agi://%s/square,%s\x22',ipAgi,_0x41befc['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x35e112?_0x35e112[_0x2023('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x35e112?_0x35e112[_0x2023('0x20')]:'','XMD-DESTINATION':_0x2023('0x21')};if(!_[_0x2023('0x11')](_0x41befc['monitor_format'])){_0x11fe55[util[_0x2023('0x12')]('%s',_0x2023('0x22'))]=_0x41befc[_0x2023('0x23')];_0x11fe55[util[_0x2023('0x12')]('%s',_0x2023('0x24'))]=_0x488487;}if(_0x1505c0&&_0x1505c0[_0x2023('0x25')]){for(var _0x5bd87e in _0x1505c0[_0x2023('0x25')]){if(_0x1505c0['Contact'][_0x2023('0x26')](_0x5bd87e)){if(!_[_0x2023('0x27')](_0x1505c0[_0x2023('0x25')][_0x5bd87e])&&_0x5bd87e!=='id'&&_0x5bd87e!==_0x2023('0x28')&&_0x5bd87e!==_0x2023('0x29')&&_0x5bd87e!==_0x2023('0x2a')){_0x11fe55[util[_0x2023('0x12')](_0x2023('0x2b'),'XMD-',_[_0x2023('0x2c')](_0x5bd87e))]=_0x1505c0[_0x2023('0x25')][_0x5bd87e];}}}}return _0x11fe55;};exports['toLowerVariables']=function(_0x371792){var _0x5dfdce={};for(var _0x3b572b in _0x371792){if(_0x371792[_0x2023('0x26')](_0x3b572b)){_0x5dfdce[util[_0x2023('0x12')]('%s',_[_0x2023('0x2d')](_0x3b572b))]=_0x371792[_0x3b572b];}}return{'variables':_0x5dfdce};};exports['updateOriginated']=function(_0x4b063b,_0xc753bb){if(!_['isNil'](_0x4b063b)){if(_0x4b063b[_0x2023('0x26')]('originated')){if(_0x4b063b['originated']>0x0){_0x4b063b[_0x2023('0x2e')]-=0x1;}else{logger['error'](_0x2023('0x2f'),_0xc753bb);}}}else{logger[_0x2023('0x9')](_0x2023('0x30'),_0xc753bb);}};exports[_0x2023('0x31')]=function(_0x357127){var _0x6f4d21=moment()[_0x2023('0x12')](_0x2023('0x32'));_0x357127[_0x2023('0x33')]=0xd;_0x357127['statedesc']='Blacklist';_0x357127[_0x2023('0x34')]=_0x6f4d21;_0x357127[_0x2023('0x35')]=_0x6f4d21;_0x357127[_0x2023('0x36')]=_0x6f4d21;};exports[_0x2023('0x37')]=function(_0x444515,_0x5077e3,_0x11d40a){var _0x326eed=moment()[_0x2023('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x444515[_0x2023('0x33')]=_0x5077e3;_0x444515[_0x2023('0x38')]=_0x11d40a;_0x444515[_0x2023('0x35')]=_0x326eed;_0x444515[_0x2023('0x39')]=getSeconds(_0x444515['responsetime'],_0x444515['starttime']);};exports[_0x2023('0x3a')]=function(_0x37bbb1,_0x14d1c4,_0x20ff95){_0x37bbb1[_0x2023('0x3b')]=_0x14d1c4;_0x37bbb1[_0x2023('0x3c')]=_0x20ff95;};exports[_0x2023('0x3d')]=function(_0x3f7dfc,_0x3e2abd,_0xbde6a2){var _0x227fab=moment()[_0x2023('0x12')](_0x2023('0x32'));_0x3f7dfc[_0x2023('0x33')]=_0x3e2abd;_0x3f7dfc[_0x2023('0x38')]=_0xbde6a2;_0x3f7dfc[_0x2023('0x35')]=_0x3f7dfc[_0x2023('0x35')]?_0x3f7dfc[_0x2023('0x35')]:_0x227fab;_0x3f7dfc[_0x2023('0x36')]=_0x3f7dfc['endtime']?_0x3f7dfc[_0x2023('0x36')]:_0x227fab;_0x3f7dfc[_0x2023('0x39')]=getSeconds(_0x3f7dfc[_0x2023('0x35')]||0x0,_0x3f7dfc[_0x2023('0x34')]||0x0);_0x3f7dfc[_0x2023('0x3e')]=_0x3f7dfc['answertime']?getSeconds(_0x3f7dfc[_0x2023('0x36')],_0x3f7dfc[_0x2023('0x3f')]):0x0;};exports[_0x2023('0x40')]=function(_0x32ff1b){return _0x32ff1b===_0x2023('0x41');};exports['variablesAction']=function(_0x2c853d,_0x5f1c35,_0x4a9ec5,_0x416937,_0x5a6a41){var _0x3a04a5=_0x416937?_0x2023('0x42'):_0x2c853d[_0x2023('0x16')];_0x3a04a5=_0x5a6a41?_0x2023('0x43'):_0x3a04a5;return{'actionid':_0x2c853d[_0x2023('0x44')],'action':_0x2023('0x45'),'channel':_0x2c853d['channelAgent'],'callerid':util[_0x2023('0x12')](_0x2023('0x13'),_0x3a04a5,_0x2c853d[_0x2023('0x17')]),'Exten':_0x2023('0x21'),'Context':_0x2023('0x46'),'Priority':'1','variable':_0x4a9ec5,'timeout':(_0x5f1c35['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2c853d[_0x2023('0x44')]};};exports[_0x2023('0x47')]=function(_0x4ec766){return _0x4ec766['countbusyretry']+_0x4ec766['countcongestionretry']+_0x4ec766[_0x2023('0x48')]+_0x4ec766[_0x2023('0x49')]+_0x4ec766['countnosuchnumberretry'];};exports[_0x2023('0x4a')]=function(_0xd3c5a2){var _0x35de35=_[_0x2023('0x4b')](_0xd3c5a2);_0x35de35[_0x2023('0x33')]=0xf;_0x35de35[_0x2023('0x38')]=_0x2023('0x4c');return _0x35de35;};exports[_0x2023('0x4d')]=function(_0x5efb60,_0x53c5fc,_0x3ff71e){var _0x1f0c50={};_0x1f0c50[_0x53c5fc]=_0x5efb60[_0x53c5fc];_0x1f0c50['active']=![];_0x1f0c50[_0x2023('0x4e')]=moment()[_0x2023('0x4f')](_0x3ff71e,_0x2023('0x50'))[_0x2023('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x1f0c50['ContactId']=_0x5efb60[_0x2023('0x51')];_0x1f0c50[_0x2023('0x52')]=_0x5efb60['ListId'];_0x1f0c50[_0x2023('0x18')]=_0x5efb60[_0x2023('0x18')]||undefined;return _0x1f0c50;};exports[_0x2023('0x53')]=function(_0x5ec026,_0x12b77d){if(!_['isNil'](_0x5ec026)){if(_0x5ec026[_0x2023('0x54')]>0x0){_0x5ec026[_0x2023('0x54')]-=0x1;}else{logger['error'](_0x12b77d,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2023('0x9')](_0x12b77d,_0x2023('0x55'));}};exports['IsNotLoggedIn']=function(_0x324092){if(_0x324092<=0x0){return!![];}return![];};exports[_0x2023('0x56')]=function(_0x3bef70,_0x5c82f0,_0x5bc17e){_0x3bef70['lastevent']=_0x5c82f0;_0x3bef70['name']=_0x3bef70[_0x2023('0x57')];_0x3bef70[_0x2023('0x58')]=_0x3bef70[_0x2023('0x59')];if(_0x5bc17e){_0x3bef70[_0x2023('0x5a')]=_0x5bc17e[_0x2023('0x5a')];}return _0x3bef70;};exports['buildAcw']=function(_0x257877){var _0xedd05e={};_0xedd05e[_0x2023('0x57')]=_0x257877['queue'];_0xedd05e['interface']=_0x257877[_0x2023('0x59')];_0xedd05e[_0x2023('0x44')]=_0x257877['uniqueid'];return _0xedd05e;};exports['agentReadyId']=function(_0x38c72d){var _0x52b345=[];for(var _0xa867aa in _0x38c72d){if(_0x38c72d[_0x2023('0x26')](_0xa867aa)){if(!_[_0x2023('0x27')](_0x38c72d[_0xa867aa])&&_0x38c72d[_0xa867aa][_0x2023('0x33')]==='not_inuse'&&_0x38c72d[_0xa867aa][_0x2023('0x5b')]==='reachable'){_0x52b345[_0x2023('0x5c')](_0x38c72d[_0xa867aa]['id']);}}}return _0x52b345;};exports[_0x2023('0x5d')]=function(_0x97d2df){var _0x54691c=moment()['milliseconds'](0x0);var _0x233065=moment(_0x97d2df)[_0x2023('0x5')](0x0);return _0x54691c[_0x2023('0x6')](_0x233065,'seconds');};exports['createBody']=function(_0x514405){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x514405[_0x2023('0x51')],'ListId':_0x514405[_0x2023('0x52')],'VoiceQueueId':_0x514405[_0x2023('0x18')]||undefined,'CampaignId':_0x514405[_0x2023('0x5e')]||undefined};};exports[_0x2023('0x5f')]=function(_0x49615f){if(_0x49615f==='uniqueid'||_0x49615f===_0x2023('0x60')||_0x49615f==='queue'||_0x49615f===_0x2023('0x61')||_0x49615f===_0x2023('0x62')||_0x49615f==='dialAnswer'||_0x49615f===_0x2023('0x3b')||_0x49615f==='channelAgent'||_0x49615f==='calleridname'||_0x49615f===_0x2023('0x63')||_0x49615f==='calleridnum'||_0x49615f===_0x2023('0x4e')||_0x49615f==='countbusyretry'||_0x49615f===_0x2023('0x64')||_0x49615f==='countnoanswerretry'||_0x49615f===_0x2023('0x65')||_0x49615f===_0x2023('0x66')||_0x49615f===_0x2023('0x67')||_0x49615f===_0x2023('0x68')||_0x49615f===_0x2023('0x69')||_0x49615f==='ContactId'||_0x49615f==='ListId'||_0x49615f===_0x2023('0x3c')||_0x49615f===_0x2023('0x18')||_0x49615f==='sipcallid'||_0x49615f==='xmd-voicequeueid'||_0x49615f==='xmd-queue'||_0x49615f===_0x2023('0x6a')||_0x49615f===_0x2023('0x6b')||_0x49615f===_0x2023('0x6c')||_0x49615f==='xmd-dialtimeout'||_0x49615f==='xmd-dialoptions'||_0x49615f==='xmd-dialid'||_0x49615f==='xmd-dialchannel'||_0x49615f===_0x2023('0x6d')||_0x49615f===_0x2023('0x6e')||_0x49615f===_0x2023('0x6f')||_0x49615f===_0x2023('0x70')||_0x49615f===_0x2023('0x71')||_0x49615f==='rtpaudioqos'||_0x49615f===_0x2023('0x72')||_0x49615f===_0x2023('0x73')||_0x49615f===_0x2023('0x74')||_0x49615f===_0x2023('0x75')||_0x49615f===_0x2023('0x76')||_0x49615f===_0x2023('0x77')||_0x49615f===_0x2023('0x78')||_0x49615f==='rtpaudioqos'||_0x49615f==='rtpaudioqosbridged'||_0x49615f===_0x2023('0x73')||_0x49615f===_0x2023('0x74')||_0x49615f===_0x2023('0x75')||_0x49615f===_0x2023('0x76')||_0x49615f===_0x2023('0x77')||_0x49615f==='rtpaudioqosrttbridged'||_0x49615f===_0x2023('0x79')||_0x49615f===_0x2023('0x7a')||_0x49615f===_0x2023('0x33')||_0x49615f===_0x2023('0x38')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x3d935c,_0x47e94a){var _0x269ae1,_0xe74532,_0x4a89d3;if(_0x47e94a<=0x0){_0x47e94a=0x1;}_0x269ae1=new RegExp(_0x2023('0x7b')+_0x47e94a+'}$');_0xe74532=Math[_0x2023('0x7c')](0xa,_0x47e94a-0x1);_0x4a89d3=Math['pow'](0xa,_0x47e94a)-0x1;return util[_0x2023('0x12')]('%s',_['replace'](_0x3d935c,_0x269ae1,_[_0x2023('0x7d')](_0xe74532,_0x4a89d3)));};exports['extractCalleridName']=function(_0x37acf3){var _0x47d9f1=_0x37acf3[_0x2023('0x7e')](/"(.*?)"/);return _0x47d9f1?_0x47d9f1[0x1]:_0x37acf3;};exports['extractCalleridNumber']=function(_0xb7ddb5){var _0x37312d=_0xb7ddb5[_0x2023('0x7e')](/<(.*?)>/);return _0x37312d?_0x37312d[0x1]:_0xb7ddb5;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 6969938..a44bbf2 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 _0xa7ef=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','queueremove','queuepause','boolean','reload'];(function(_0x49dfb3,_0x2199b9){var _0x227e2f=function(_0x6d9a2f){while(--_0x6d9a2f){_0x49dfb3['push'](_0x49dfb3['shift']());}};_0x227e2f(++_0x2199b9);}(_0xa7ef,0x8f));var _0xfa7e=function(_0x3fdda4,_0x4cc371){_0x3fdda4=_0x3fdda4-0x0;var _0x49d617=_0xa7ef[_0x3fdda4];return _0x49d617;};'use strict';exports[_0xfa7e('0x0')]={'queue':{'type':_0xfa7e('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xfa7e('0x1'),'required':!![]},'penalty':{'type':_0xfa7e('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0xfa7e('0x3')]={'queue':{'type':_0xfa7e('0x1'),'required':!![]},'interface':{'type':_0xfa7e('0x1'),'required':!![]}};exports[_0xfa7e('0x4')]={'interface':{'type':_0xfa7e('0x1'),'required':!![]},'paused':{'type':_0xfa7e('0x5')},'reason':{'type':_0xfa7e('0x1'),'required':![]}};exports[_0xfa7e('0x6')]={'module':{'type':'string','required':![]}};exports[_0xfa7e('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xfa7e('0x8')]={'uniqueid':{'type':_0xfa7e('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0xfa7e('0x1')},'mixmonitorid':{'type':'string'}};exports[_0xfa7e('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xfa7e('0x1'),'required':!![]},'exten':{'type':_0xfa7e('0x1'),'required':!![]},'context':{'type':_0xfa7e('0x1')}}; \ No newline at end of file +var _0x90c3=['boolean','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','queueremove'];(function(_0x59729c,_0x36728c){var _0x28a827=function(_0x5d2035){while(--_0x5d2035){_0x59729c['push'](_0x59729c['shift']());}};_0x28a827(++_0x36728c);}(_0x90c3,0x132));var _0x390c=function(_0x11599d,_0x17690c){_0x11599d=_0x11599d-0x0;var _0x1f6924=_0x90c3[_0x11599d];return _0x1f6924;};'use strict';exports['queueadd']={'queue':{'type':_0x390c('0x0'),'required':!![]},'interface':{'type':_0x390c('0x0'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x390c('0x1')]={'queue':{'type':_0x390c('0x0'),'required':!![]},'interface':{'type':_0x390c('0x0'),'required':!![]}};exports['queuepause']={'interface':{'type':'string','required':!![]},'paused':{'type':_0x390c('0x2')},'reason':{'type':'string','required':![]}};exports[_0x390c('0x3')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x390c('0x0'),'required':!![]}};exports[_0x390c('0x4')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x390c('0x0')},'format':{'type':_0x390c('0x0')},'mixmonitorid':{'type':_0x390c('0x0')}};exports[_0x390c('0x5')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x390c('0x6')]={'uniqueid':{'type':_0x390c('0x0'),'required':!![]},'exten':{'type':'string','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 45d6a3c..64483ea 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 _0x0b1f=['prototype','initAgents','isUndefined','mergeFromDatabase','initTrunks','voiceQueues','initTriggers','initTemplates','length','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','diff','seconds','sumDuration','queuecallerabandonAt','queuecallerjoinAt','initVoiceCallReports','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','util','lodash','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','triggers','templates','outbound','channels','outboundChannels','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','isNil','interface','name','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete'];(function(_0x217ee8,_0x28feb3){var _0x3135e9=function(_0x57326c){while(--_0x57326c){_0x217ee8['push'](_0x217ee8['shift']());}};_0x3135e9(++_0x28feb3);}(_0x0b1f,0x101));var _0xf0b1=function(_0x39fc12,_0x179339){_0x39fc12=_0x39fc12-0x0;var _0x429a48=_0x0b1f[_0x39fc12];return _0x429a48;};'use strict';var BPromise=require('bluebird');var util=require(_0xf0b1('0x0'));var _=require(_0xf0b1('0x1'));var moment=require(_0xf0b1('0x2'));var Agent=require(_0xf0b1('0x3'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xf0b1('0x4'));var Trigger=require(_0xf0b1('0x5'));var Template=require(_0xf0b1('0x6'));var Campaign=require(_0xf0b1('0x7'));var VoiceExtension=require(_0xf0b1('0x8'));var ZendeskAccount=require(_0xf0b1('0x9'));var SalesforceAccount=require(_0xf0b1('0xa'));var FreshdeskAccount=require(_0xf0b1('0xb'));var SugarcrmAccount=require(_0xf0b1('0xc'));var ZohoAccount=require(_0xf0b1('0xd'));var DeskAccount=require(_0xf0b1('0xe'));var VtigerAccount=require(_0xf0b1('0xf'));var ServicenowAccount=require(_0xf0b1('0x10'));var Dynamics365Account=require(_0xf0b1('0x11'));var FreshsalesAccount=require(_0xf0b1('0x12'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xf0b1('0x13')]={};this[_0xf0b1('0x14')]={};this[_0xf0b1('0x15')]={};this['voiceQueues']={};this[_0xf0b1('0x16')]={};this['campaigns']={};this[_0xf0b1('0x17')]={};this[_0xf0b1('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0xf0b1('0x19')]={};this['queueChannels']={};this[_0xf0b1('0x1a')]={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this[_0xf0b1('0x1b')]={};this[_0xf0b1('0x1c')]={};this[_0xf0b1('0x1d')]={};this['zohoAccounts']={};this[_0xf0b1('0x1e')]={};this[_0xf0b1('0x1f')]={};this[_0xf0b1('0x20')]={};this[_0xf0b1('0x21')]={};this['freshsalesAccounts']={};this[_0xf0b1('0x22')]={};};function freeIsNotKey(_0x473994,_0x2d3c55,_0x4be759){var _0x3dea6e=_[_0xf0b1('0x23')](_0x473994,function(_0x471791,_0x394bb2){return _0x471791[_0x4be759];});for(var _0x59cc42 in _0x2d3c55){if(_0x2d3c55[_0xf0b1('0x24')](_0x59cc42)){if(!_0x3dea6e[_0x59cc42]){delete _0x2d3c55[_0x59cc42];}}}}function freeIsNotKeySip(_0x4daba2,_0x45843b){var _0x28651d=_[_0xf0b1('0x23')](_0x4daba2,function(_0x84608f,_0xa7b26a){return util[_0xf0b1('0x25')](_0xf0b1('0x26'),_0x84608f['name']);});for(var _0x4cc1c3 in _0x45843b){if(_0x45843b[_0xf0b1('0x24')](_0x4cc1c3)){if(!_0x28651d[_0x4cc1c3]){delete _0x45843b[_0x4cc1c3];}}}}function freeIsNotKeyAgent(_0x135f51,_0x4f2893){var _0x262224=_[_0xf0b1('0x23')](_0x135f51,function(_0x549e22,_0x63e776){var _0xc887f9=_[_0xf0b1('0x27')](_0x549e22[_0xf0b1('0x28')])?util['format'](_0xf0b1('0x26'),_0x549e22[_0xf0b1('0x29')]):_0x549e22[_0xf0b1('0x28')];return _0xc887f9;});for(var _0x1cf49f in _0x4f2893){if(_0x4f2893[_0xf0b1('0x24')](_0x1cf49f)){if(!_0x262224[_0x1cf49f]){delete _0x4f2893[_0x1cf49f];}}}}function clearVoiceCallReports(_0x53b706){_0x53b706[_0xf0b1('0x2a')]=0x0;_0x53b706[_0xf0b1('0x2b')]=0x0;_0x53b706[_0xf0b1('0x2c')]=0x0;_0x53b706['sumDuration']=0x0;_0x53b706[_0xf0b1('0x2d')]=0x0;}function clearCampaigns(_0x1f4d0a){if(!_[_0xf0b1('0x2e')](_0x1f4d0a)){for(var _0x416ce0 in _0x1f4d0a){if(_0x1f4d0a[_0xf0b1('0x24')](_0x416ce0)){_0x1f4d0a[_0x416ce0][_0xf0b1('0x2f')]=0x0;_0x1f4d0a[_0x416ce0][_0xf0b1('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1559a7){if(!_[_0xf0b1('0x2e')](_0x1559a7)){for(var _0x3d0034 in _0x1559a7){if(_0x1559a7[_0xf0b1('0x24')](_0x3d0034)){_0x1559a7[_0x3d0034][_0xf0b1('0x2a')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x2b')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x31')]=0x0;_0x1559a7[_0x3d0034]['abandoned']=0x0;_0x1559a7[_0x3d0034]['sumHoldTime']=0x0;_0x1559a7[_0x3d0034]['sumDuration']=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x2d')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x32')]=0x0;_0x1559a7[_0x3d0034]['outboundNoAnswerCallsDay']=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x33')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x34')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x35')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x36')]=0x0;_0x1559a7[_0x3d0034]['outboundDropCallsDayTimeout']=0x0;_0x1559a7[_0x3d0034]['outboundDropCallsDayCallersExit']=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x37')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x38')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x39')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x3a')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x32')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x3b')]=0x0;_0x1559a7[_0x3d0034][_0xf0b1('0x3c')]=!![];}}}}Realtime[_0xf0b1('0x3d')]['mergeFromDatabase']=function(_0x46481a,_0x5510e6){for(var _0x3eb10e in _0x5510e6){if(_0x46481a[_0xf0b1('0x24')](_0x3eb10e)){_0x46481a[_0x3eb10e]=_0x5510e6[_0x3eb10e];}}};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x3e')]=function(){var _0x1e0f82=this;return function(_0x5d6dc9){if(_0x5d6dc9){freeIsNotKeyAgent(_0x5d6dc9,_0x1e0f82[_0xf0b1('0x13')]);for(var _0x55079f=0x0,_0x434d57={},_0x152203={};_0x55079f<_0x5d6dc9['length'];_0x55079f+=0x1){_0x434d57=_0x5d6dc9[_0x55079f];var _0x4e468b=_[_0xf0b1('0x27')](_0x434d57[_0xf0b1('0x28')])?util['format'](_0xf0b1('0x26'),_0x434d57[_0xf0b1('0x29')]):_0x434d57[_0xf0b1('0x28')];if(_[_0xf0b1('0x3f')](_0x1e0f82[_0xf0b1('0x13')][_0x4e468b])){_0x1e0f82[_0xf0b1('0x13')][_0x4e468b]=new Agent(_0x434d57);}else{_0x1e0f82['mergeFromDatabase'](_0x1e0f82[_0xf0b1('0x13')][_0x4e468b],_0x434d57);}}}return _0x1e0f82[_0xf0b1('0x13')];};};Realtime['prototype']['initTelephones']=function(){var _0x545bdd=this;return function(_0x10dd0d){if(_0x10dd0d){freeIsNotKeySip(_0x10dd0d,_0x545bdd['telephones']);for(var _0x9722ec=0x0,_0x108a27={},_0x3a11eb={};_0x9722ec<_0x10dd0d['length'];_0x9722ec+=0x1){_0x108a27=_0x10dd0d[_0x9722ec];if(_[_0xf0b1('0x3f')](_0x545bdd[_0xf0b1('0x14')][util[_0xf0b1('0x25')](_0xf0b1('0x26'),_0x108a27[_0xf0b1('0x29')])])){_0x545bdd[_0xf0b1('0x14')][util['format'](_0xf0b1('0x26'),_0x108a27['name'])]=new Telephone(_0x108a27);}else{_0x545bdd[_0xf0b1('0x40')](_0x545bdd[_0xf0b1('0x14')][util[_0xf0b1('0x25')](_0xf0b1('0x26'),_0x108a27[_0xf0b1('0x29')])],_0x108a27);}}}return _0x545bdd['telephones'];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x41')]=function(){var _0x4f42a2=this;return function(_0x2ef4e8){if(_0x2ef4e8){freeIsNotKeySip(_0x2ef4e8,_0x4f42a2['trunks']);for(var _0xe520d=0x0,_0xfe438f={},_0x155b21={};_0xe520d<_0x2ef4e8['length'];_0xe520d+=0x1){_0xfe438f=_0x2ef4e8[_0xe520d];if(_[_0xf0b1('0x3f')](_0x4f42a2[_0xf0b1('0x15')][util['format'](_0xf0b1('0x26'),_0xfe438f[_0xf0b1('0x29')])])){_0x4f42a2[_0xf0b1('0x15')][util[_0xf0b1('0x25')]('SIP/%s',_0xfe438f[_0xf0b1('0x29')])]=new Trunk(_0xfe438f);}else{_0x4f42a2[_0xf0b1('0x40')](_0x4f42a2['trunks'][util[_0xf0b1('0x25')](_0xf0b1('0x26'),_0xfe438f[_0xf0b1('0x29')])],_0xfe438f);}}}return _0x4f42a2['trunks'];};};Realtime[_0xf0b1('0x3d')]['initVoiceQueues']=function(){var _0x583f9a=this;return function(_0x2b0ae8){if(_0x2b0ae8){freeIsNotKey(_0x2b0ae8,_0x583f9a[_0xf0b1('0x42')],_0xf0b1('0x29'));for(var _0x36b72d=0x0,_0x2fbf9f={},_0x2924ac={};_0x36b72d<_0x2b0ae8['length'];_0x36b72d+=0x1){_0x2fbf9f=_0x2b0ae8[_0x36b72d];if(_['isUndefined'](_0x583f9a[_0xf0b1('0x42')][_0x2fbf9f[_0xf0b1('0x29')]])){_0x583f9a[_0xf0b1('0x42')][_0x2fbf9f[_0xf0b1('0x29')]]=new VoiceQueue(_0x2fbf9f);}else{_0x583f9a[_0xf0b1('0x40')](_0x583f9a[_0xf0b1('0x42')][_0x2fbf9f[_0xf0b1('0x29')]],_0x2fbf9f);}}}return _0x583f9a[_0xf0b1('0x42')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x43')]=function(){var _0x3f2d92=this;return function(_0x335932){if(_0x335932){freeIsNotKey(_0x335932,_0x3f2d92[_0xf0b1('0x16')],'id');for(var _0x596d60=0x0,_0x41c137={},_0x5e5817={};_0x596d60<_0x335932['length'];_0x596d60+=0x1){_0x41c137=_0x335932[_0x596d60];if(_['isUndefined'](_0x3f2d92[_0xf0b1('0x16')][_0x41c137['id']])){_0x3f2d92[_0xf0b1('0x16')][_0x41c137['id']]=new Trigger(_0x41c137);}else{_0x3f2d92['mergeFromDatabase'](_0x3f2d92[_0xf0b1('0x16')][_0x41c137['id']],_0x41c137);}}}return _0x3f2d92['triggers'];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x44')]=function(){var _0x3651d2=this;return function(_0x483120){if(_0x483120){freeIsNotKey(_0x483120,_0x3651d2['templates'],'id');for(var _0x593750=0x0,_0x1f1c7b={},_0x32f244={};_0x593750<_0x483120[_0xf0b1('0x45')];_0x593750+=0x1){_0x1f1c7b=_0x483120[_0x593750];if(_[_0xf0b1('0x3f')](_0x3651d2[_0xf0b1('0x17')][_0x1f1c7b['id']])){_0x3651d2[_0xf0b1('0x17')][_0x1f1c7b['id']]=new Template(_0x1f1c7b);}else{_0x3651d2[_0xf0b1('0x40')](_0x3651d2[_0xf0b1('0x17')][_0x1f1c7b['id']],_0x1f1c7b);}}}return _0x3651d2[_0xf0b1('0x17')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x46')]=function(){var _0xc56c6c=this;return function(_0x3bee8d){if(_0x3bee8d){freeIsNotKey(_0x3bee8d,_0xc56c6c[_0xf0b1('0x47')],'id');for(var _0x2f1bc8=0x0,_0x15ee86={},_0x14ea0c={};_0x2f1bc8<_0x3bee8d[_0xf0b1('0x45')];_0x2f1bc8+=0x1){_0x15ee86=_0x3bee8d[_0x2f1bc8];if(_[_0xf0b1('0x3f')](_0xc56c6c[_0xf0b1('0x47')][_0x15ee86['id']])){_0xc56c6c[_0xf0b1('0x47')][_0x15ee86['id']]=new ZendeskAccount(_0x15ee86);}else{_0xc56c6c['mergeFromDatabase'](_0xc56c6c[_0xf0b1('0x47')][_0x15ee86['id']],_0x15ee86);}}}return _0xc56c6c[_0xf0b1('0x47')];};};Realtime[_0xf0b1('0x3d')]['initSalesforceAccounts']=function(){var _0x4fc57a=this;return function(_0x46de29){if(_0x46de29){freeIsNotKey(_0x46de29,_0x4fc57a[_0xf0b1('0x1b')],'id');for(var _0x2cd38c=0x0,_0x5da352={},_0x2f5c5f={};_0x2cd38c<_0x46de29[_0xf0b1('0x45')];_0x2cd38c+=0x1){_0x5da352=_0x46de29[_0x2cd38c];if(_['isUndefined'](_0x4fc57a[_0xf0b1('0x1b')][_0x5da352['id']])){_0x4fc57a[_0xf0b1('0x1b')][_0x5da352['id']]=new SalesforceAccount(_0x5da352);}else{_0x4fc57a['mergeFromDatabase'](_0x4fc57a[_0xf0b1('0x1b')][_0x5da352['id']],_0x5da352);}}}return _0x4fc57a[_0xf0b1('0x1b')];};};Realtime['prototype'][_0xf0b1('0x48')]=function(){var _0x54229f=this;return function(_0x15edf1){if(_0x15edf1){freeIsNotKey(_0x15edf1,_0x54229f[_0xf0b1('0x1d')],'id');for(var _0x54719d=0x0,_0x5bbe25={},_0xe7d82={};_0x54719d<_0x15edf1['length'];_0x54719d+=0x1){_0x5bbe25=_0x15edf1[_0x54719d];if(_[_0xf0b1('0x3f')](_0x54229f[_0xf0b1('0x1d')][_0x5bbe25['id']])){_0x54229f[_0xf0b1('0x1d')][_0x5bbe25['id']]=new FreshdeskAccount(_0x5bbe25);}else{_0x54229f[_0xf0b1('0x40')](_0x54229f[_0xf0b1('0x1d')][_0x5bbe25['id']],_0x5bbe25);}}}return _0x54229f['freshdeskAccounts'];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x49')]=function(){var _0x7eb062=this;return function(_0x43eba7){if(_0x43eba7){freeIsNotKey(_0x43eba7,_0x7eb062[_0xf0b1('0x4a')],'id');for(var _0x4e36c7=0x0,_0x3199e4={},_0x6530a6={};_0x4e36c7<_0x43eba7['length'];_0x4e36c7+=0x1){_0x3199e4=_0x43eba7[_0x4e36c7];if(_[_0xf0b1('0x3f')](_0x7eb062[_0xf0b1('0x4a')][_0x3199e4['id']])){_0x7eb062[_0xf0b1('0x4a')][_0x3199e4['id']]=new ZohoAccount(_0x3199e4);}else{_0x7eb062[_0xf0b1('0x40')](_0x7eb062['zohoAccounts'][_0x3199e4['id']],_0x3199e4);}}}return _0x7eb062[_0xf0b1('0x4a')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x4b')]=function(){var _0x4ef06f=this;return function(_0x2577ff){if(_0x2577ff){freeIsNotKey(_0x2577ff,_0x4ef06f['deskAccounts'],'id');for(var _0x32be16=0x0,_0x4c5634={},_0x1e5965={};_0x32be16<_0x2577ff[_0xf0b1('0x45')];_0x32be16+=0x1){_0x4c5634=_0x2577ff[_0x32be16];if(_[_0xf0b1('0x3f')](_0x4ef06f[_0xf0b1('0x1e')][_0x4c5634['id']])){_0x4ef06f[_0xf0b1('0x1e')][_0x4c5634['id']]=new DeskAccount(_0x4c5634);}else{_0x4ef06f[_0xf0b1('0x40')](_0x4ef06f[_0xf0b1('0x1e')][_0x4c5634['id']],_0x4c5634);}}}return _0x4ef06f[_0xf0b1('0x1e')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x4c')]=function(){var _0x2b7234=this;return function(_0xbdbd0a){if(_0xbdbd0a){freeIsNotKey(_0xbdbd0a,_0x2b7234['sugarcrmAccounts'],'id');for(var _0x4dee25=0x0,_0xbdd251={},_0x439378={};_0x4dee25<_0xbdbd0a['length'];_0x4dee25+=0x1){_0xbdd251=_0xbdbd0a[_0x4dee25];if(_[_0xf0b1('0x3f')](_0x2b7234[_0xf0b1('0x1c')][_0xbdd251['id']])){_0x2b7234['sugarcrmAccounts'][_0xbdd251['id']]=new SugarcrmAccount(_0xbdd251);}else{_0x2b7234['mergeFromDatabase'](_0x2b7234[_0xf0b1('0x1c')][_0xbdd251['id']],_0xbdd251);}}}return _0x2b7234[_0xf0b1('0x1c')];};};Realtime[_0xf0b1('0x3d')]['initVtigerAccounts']=function(){var _0x5d022d=this;return function(_0x3bfca0){if(_0x3bfca0){freeIsNotKey(_0x3bfca0,_0x5d022d[_0xf0b1('0x1f')],'id');for(var _0x2eeaf7=0x0,_0x359345={},_0x141eba={};_0x2eeaf7<_0x3bfca0[_0xf0b1('0x45')];_0x2eeaf7+=0x1){_0x359345=_0x3bfca0[_0x2eeaf7];if(_[_0xf0b1('0x3f')](_0x5d022d['vtigerAccounts'][_0x359345['id']])){_0x5d022d[_0xf0b1('0x1f')][_0x359345['id']]=new VtigerAccount(_0x359345);}else{_0x5d022d['mergeFromDatabase'](_0x5d022d[_0xf0b1('0x1f')][_0x359345['id']],_0x359345);}}}return _0x5d022d['vtigerAccounts'];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x4d')]=function(){var _0x25b327=this;return function(_0xf93d30){if(_0xf93d30){freeIsNotKey(_0xf93d30,_0x25b327['servicenowAccounts'],'id');for(var _0x1bb815=0x0,_0x1da12c={},_0x178ac2={};_0x1bb815<_0xf93d30[_0xf0b1('0x45')];_0x1bb815+=0x1){_0x1da12c=_0xf93d30[_0x1bb815];if(_[_0xf0b1('0x3f')](_0x25b327[_0xf0b1('0x20')][_0x1da12c['id']])){_0x25b327[_0xf0b1('0x20')][_0x1da12c['id']]=new ServicenowAccount(_0x1da12c);}else{_0x25b327['mergeFromDatabase'](_0x25b327[_0xf0b1('0x20')][_0x1da12c['id']],_0x1da12c);}}}return _0x25b327[_0xf0b1('0x20')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x4e')]=function(){var _0x3b09c8=this;return function(_0x4f2e42){if(_0x4f2e42){freeIsNotKey(_0x4f2e42,_0x3b09c8[_0xf0b1('0x21')],'id');for(var _0x280376=0x0,_0x2fc098={},_0x2d5083={};_0x280376<_0x4f2e42[_0xf0b1('0x45')];_0x280376+=0x1){_0x2fc098=_0x4f2e42[_0x280376];if(_[_0xf0b1('0x3f')](_0x3b09c8[_0xf0b1('0x21')][_0x2fc098['id']])){_0x3b09c8[_0xf0b1('0x21')][_0x2fc098['id']]=new Dynamics365Account(_0x2fc098);}else{_0x3b09c8[_0xf0b1('0x40')](_0x3b09c8[_0xf0b1('0x21')][_0x2fc098['id']],_0x2fc098);}}}return _0x3b09c8[_0xf0b1('0x21')];};};Realtime['prototype'][_0xf0b1('0x4f')]=function(){var _0x430750=this;return function(_0xe4ed46){if(_0xe4ed46){freeIsNotKey(_0xe4ed46,_0x430750[_0xf0b1('0x50')],'id');for(var _0x26ea31=0x0,_0x2dacd6={},_0x4171ea={};_0x26ea31<_0xe4ed46[_0xf0b1('0x45')];_0x26ea31+=0x1){_0x2dacd6=_0xe4ed46[_0x26ea31];if(_[_0xf0b1('0x3f')](_0x430750[_0xf0b1('0x50')][_0x2dacd6['id']])){_0x430750['freshsalesAccounts'][_0x2dacd6['id']]=new FreshsalesAccount(_0x2dacd6);}else{_0x430750['mergeFromDatabase'](_0x430750[_0xf0b1('0x50')][_0x2dacd6['id']],_0x2dacd6);}}}return _0x430750[_0xf0b1('0x50')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x51')]=function(){var _0xe793be=this;return function(_0x3355d6){for(var _0x143ae0=0x0;_0x143ae0<_0x3355d6[_0xf0b1('0x45')];_0x143ae0+=0x1){_[_0xf0b1('0x52')](_0xe793be[_0xf0b1('0x42')][_0x3355d6[_0x143ae0]['name']],_0x3355d6[_0x143ae0]);}return _0xe793be[_0xf0b1('0x42')];};};Realtime['prototype'][_0xf0b1('0x53')]=function(){var _0x72ac35=this;return function(_0x5181b4){clearVoiceQueues(_0x72ac35['voiceQueues']);if(_0x5181b4){_0x5181b4=_[_0xf0b1('0x54')](_0x5181b4,_0xf0b1('0x55'));for(var _0x260fb2 in _0x5181b4){if(_0x5181b4[_0xf0b1('0x24')](_0x260fb2)){var _0x2157e1={};for(var _0x17039c=0x0;_0x17039c<_0x5181b4[_0x260fb2]['length'];_0x17039c+=0x1){var _0x4ded11=_0x5181b4[_0x260fb2][_0x17039c][_0xf0b1('0x56')];if(_0x72ac35[_0xf0b1('0x42')][_0x4ded11]){if(_0x5181b4[_0x260fb2][_0x17039c][_0xf0b1('0x57')]){_0x72ac35[_0xf0b1('0x42')][_0x4ded11]['unmanaged']+=0x1;}if(_0x5181b4[_0x260fb2][_0x17039c][_0xf0b1('0x58')]){_0x72ac35[_0xf0b1('0x42')][_0x4ded11][_0xf0b1('0x59')]+=0x1;}_0x72ac35[_0xf0b1('0x42')][_0x4ded11][_0xf0b1('0x2c')]+=moment(_0x5181b4[_0x260fb2][_0x17039c]['queuecallerleaveAt'])[_0xf0b1('0x5a')](moment(_0x5181b4[_0x260fb2][_0x17039c]['queuecallerjoinAt']),_0xf0b1('0x5b'))||0x0;if(_0x17039c===_0x5181b4[_0x260fb2][_0xf0b1('0x45')]-0x1){_0x72ac35[_0xf0b1('0x42')][_0x4ded11][_0xf0b1('0x5c')]+=moment(_0x5181b4[_0x260fb2][_0x17039c]['queuecallercompleteAt']||_0x5181b4[_0x260fb2][_0x17039c][_0xf0b1('0x5d')]||_0x5181b4[_0x260fb2][_0x17039c]['queuecallerexitAt'])[_0xf0b1('0x5a')](moment(_0x5181b4[_0x260fb2][_0x17039c][_0xf0b1('0x5e')]),'seconds')||0x0;_0x72ac35[_0xf0b1('0x42')][_0x4ded11][_0xf0b1('0x2a')]+=0x1;if(_0x5181b4[_0x260fb2][_0x17039c]['queuecallercomplete']){_0x72ac35[_0xf0b1('0x42')][_0x4ded11]['answered']+=0x1;_0x72ac35[_0xf0b1('0x42')][_0x4ded11][_0xf0b1('0x2d')]+=moment(_0x5181b4[_0x260fb2][_0x17039c]['queuecallercompleteAt'])[_0xf0b1('0x5a')](moment(_0x5181b4[_0x260fb2][_0x17039c]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x72ac35[_0xf0b1('0x42')][_0x4ded11][_0xf0b1('0x5c')]+=_0x72ac35['voiceQueues'][_0x4ded11]['sumHoldTime']||0x0;}}}}}}return _0x72ac35[_0xf0b1('0x42')];};};Realtime['prototype'][_0xf0b1('0x5f')]=function(){var _0x584f18=this;return function(_0x2ff987){clearVoiceCallReports(_0x584f18['outbound']);if(_0x2ff987){for(var _0x5965d6=0x0;_0x5965d6<_0x2ff987[_0xf0b1('0x45')];_0x5965d6+=0x1){_0x584f18['outbound'][_0xf0b1('0x2a')]+=0x1;_0x584f18[_0xf0b1('0x18')][_0xf0b1('0x5c')]+=_0x2ff987[_0x5965d6][_0xf0b1('0x60')];if(_0x2ff987[_0x5965d6]['disposition']==='ANSWERED'){_0x584f18[_0xf0b1('0x18')][_0xf0b1('0x2b')]+=0x1;_0x584f18[_0xf0b1('0x18')]['sumHoldTime']+=_0x2ff987[_0x5965d6][_0xf0b1('0x60')]-_0x2ff987[_0x5965d6][_0xf0b1('0x61')]||0x0;_0x584f18['outbound']['sumBillable']+=_0x2ff987[_0x5965d6][_0xf0b1('0x61')];}}}return _0x584f18['outbound'];};};Realtime[_0xf0b1('0x3d')]['initCampaigns']=function(){var _0x346bba=this;return function(_0x66d0ab){if(_0x66d0ab){freeIsNotKey(_0x66d0ab,_0x346bba[_0xf0b1('0x62')],'name');for(var _0xe7574f=0x0,_0x18bcf5={};_0xe7574f<_0x66d0ab['length'];_0xe7574f+=0x1){_0x18bcf5=_0x66d0ab[_0xe7574f];if(_['isUndefined'](_0x346bba[_0xf0b1('0x62')][_0x18bcf5[_0xf0b1('0x29')]])){_0x346bba[_0xf0b1('0x62')][_0x18bcf5['name']]=new Campaign(_0x18bcf5);}else{_0x346bba[_0xf0b1('0x40')](_0x346bba[_0xf0b1('0x62')][_0x18bcf5[_0xf0b1('0x29')]],_0x18bcf5);_0x346bba[_0xf0b1('0x62')][_0x18bcf5[_0xf0b1('0x29')]][_0xf0b1('0x63')]=_0x18bcf5[_0xf0b1('0x64')]?_0x18bcf5[_0xf0b1('0x64')][_0xf0b1('0x29')]:undefined;}}}return _0x346bba[_0xf0b1('0x62')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x65')]=function(){var _0x211e94=this;return function(_0x4aed81){if(_0x4aed81){freeIsNotKey(_0x4aed81,_0x211e94[_0xf0b1('0x66')],'id');for(var _0xe8e792=0x0,_0x3d090a={};_0xe8e792<_0x4aed81['length'];_0xe8e792+=0x1){_0x3d090a=_0x4aed81[_0xe8e792];if(_[_0xf0b1('0x3f')](_0x211e94[_0xf0b1('0x66')][_0x3d090a['id']])){_0x211e94['voiceExtensions'][_0x3d090a['id']]=new VoiceExtension(_0x3d090a);}else{_0x211e94[_0xf0b1('0x40')](_0x211e94[_0xf0b1('0x66')][_0x3d090a['id']],_0x3d090a);}}}return _0x211e94[_0xf0b1('0x66')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x67')]=function(){var _0x12a64a=this;return function(_0x328d9b){clearCampaigns(_0x12a64a['campaigns']);for(var _0x3eb575=0x0;_0x3eb575<_0x328d9b[_0xf0b1('0x45')];_0x3eb575+=0x1){_[_0xf0b1('0x52')](_0x12a64a['campaigns'][_0x328d9b[_0x3eb575][_0xf0b1('0x29')]],_0x328d9b[_0x3eb575]);}return _0x12a64a[_0xf0b1('0x62')];};};Realtime[_0xf0b1('0x3d')][_0xf0b1('0x68')]=function(){var _0x62e466=this;return function(_0x55812e){if(_0x55812e){freeIsNotKey(_0x55812e,_0x62e466[_0xf0b1('0x22')],'id');for(var _0x57f8ff=0x0,_0x4a07df={},_0x864c60={};_0x57f8ff<_0x55812e[_0xf0b1('0x45')];_0x57f8ff+=0x1){_0x4a07df=_0x55812e[_0x57f8ff];if(_[_0xf0b1('0x3f')](_0x62e466[_0xf0b1('0x22')][_0x4a07df['id']])){_0x62e466[_0xf0b1('0x22')][_0x4a07df['id']]=new FaxAccount(_0x4a07df);}else{_0x62e466[_0xf0b1('0x40')](_0x62e466['faxAccounts'][_0x4a07df['id']],_0x4a07df);}}}return _0x62e466[_0xf0b1('0x22')];};};module[_0xf0b1('0x69')]=Realtime; \ No newline at end of file +var _0x1fca=['ANSWERED','billableseconds','SquareProject','initFaxAccounts','faxAccounts','bluebird','util','lodash','moment','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/voiceExtension','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','trunks','voiceQueues','campaigns','templates','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','sumHoldTime','sumDuration','isEmpty','ivrAnswerCallsDay','answered','unmanaged','abandoned','sumBillable','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','prototype','initAgents','isNil','isUndefined','initTelephones','mergeFromDatabase','length','initVoiceQueues','initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','freshdeskAccounts','initZohoAccounts','initDeskAccounts','sugarcrmAccounts','initVtigerAccounts','initDynamics365Accounts','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration'];(function(_0x5640e0,_0x4370d8){var _0x1f96ae=function(_0x3d8442){while(--_0x3d8442){_0x5640e0['push'](_0x5640e0['shift']());}};_0x1f96ae(++_0x4370d8);}(_0x1fca,0x134));var _0xa1fc=function(_0x5ebc8c,_0x1e9a6d){_0x5ebc8c=_0x5ebc8c-0x0;var _0x5c9f7b=_0x1fca[_0x5ebc8c];return _0x5c9f7b;};'use strict';var BPromise=require(_0xa1fc('0x0'));var util=require(_0xa1fc('0x1'));var _=require(_0xa1fc('0x2'));var moment=require(_0xa1fc('0x3'));var Agent=require('../model/agent');var Telephone=require(_0xa1fc('0x4'));var Trunk=require(_0xa1fc('0x5'));var VoiceQueue=require(_0xa1fc('0x6'));var Trigger=require(_0xa1fc('0x7'));var Template=require(_0xa1fc('0x8'));var Campaign=require('../model/campaign');var VoiceExtension=require(_0xa1fc('0x9'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xa1fc('0xa'));var FreshdeskAccount=require(_0xa1fc('0xb'));var SugarcrmAccount=require(_0xa1fc('0xc'));var ZohoAccount=require(_0xa1fc('0xd'));var DeskAccount=require(_0xa1fc('0xe'));var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require(_0xa1fc('0xf'));var Dynamics365Account=require(_0xa1fc('0x10'));var FreshsalesAccount=require(_0xa1fc('0x11'));var FaxAccount=require('../model/faxAccount');var Realtime=function(){this[_0xa1fc('0x12')]={};this[_0xa1fc('0x13')]={};this[_0xa1fc('0x14')]={};this[_0xa1fc('0x15')]={};this['triggers']={};this[_0xa1fc('0x16')]={};this[_0xa1fc('0x17')]={};this[_0xa1fc('0x18')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xa1fc('0x19')]={};this[_0xa1fc('0x1a')]={};this[_0xa1fc('0x1b')]={};this[_0xa1fc('0x1c')]={};this[_0xa1fc('0x1d')]={};this['settings']={};this['zendeskAccounts']={};this[_0xa1fc('0x1e')]={};this['sugarcrmAccounts']={};this['freshdeskAccounts']={};this[_0xa1fc('0x1f')]={};this[_0xa1fc('0x20')]={};this[_0xa1fc('0x21')]={};this[_0xa1fc('0x22')]={};this[_0xa1fc('0x23')]={};this[_0xa1fc('0x24')]={};this['faxAccounts']={};};function freeIsNotKey(_0x2405db,_0x4f084b,_0x29cb85){var _0x4d63d9=_[_0xa1fc('0x25')](_0x2405db,function(_0x5a8fec,_0x5ab2a4){return _0x5a8fec[_0x29cb85];});for(var _0x45a3b5 in _0x4f084b){if(_0x4f084b[_0xa1fc('0x26')](_0x45a3b5)){if(!_0x4d63d9[_0x45a3b5]){delete _0x4f084b[_0x45a3b5];}}}}function freeIsNotKeySip(_0x44c717,_0x1a468e){var _0x4aa86d=_[_0xa1fc('0x25')](_0x44c717,function(_0xaaa7cb,_0x542c85){return util[_0xa1fc('0x27')](_0xa1fc('0x28'),_0xaaa7cb[_0xa1fc('0x29')]);});for(var _0x83e5b4 in _0x1a468e){if(_0x1a468e[_0xa1fc('0x26')](_0x83e5b4)){if(!_0x4aa86d[_0x83e5b4]){delete _0x1a468e[_0x83e5b4];}}}}function freeIsNotKeyAgent(_0x57a2ed,_0x33ece9){var _0x1a31c1=_[_0xa1fc('0x25')](_0x57a2ed,function(_0x419271,_0x225e64){var _0x2e84f2=_['isNil'](_0x419271['interface'])?util['format'](_0xa1fc('0x28'),_0x419271['name']):_0x419271[_0xa1fc('0x2a')];return _0x2e84f2;});for(var _0x20d52b in _0x33ece9){if(_0x33ece9[_0xa1fc('0x26')](_0x20d52b)){if(!_0x1a31c1[_0x20d52b]){delete _0x33ece9[_0x20d52b];}}}}function clearVoiceCallReports(_0x2025fb){_0x2025fb[_0xa1fc('0x2b')]=0x0;_0x2025fb['answered']=0x0;_0x2025fb[_0xa1fc('0x2c')]=0x0;_0x2025fb[_0xa1fc('0x2d')]=0x0;_0x2025fb['sumBillable']=0x0;}function clearCampaigns(_0x45014a){if(!_[_0xa1fc('0x2e')](_0x45014a)){for(var _0x1359e8 in _0x45014a){if(_0x45014a[_0xa1fc('0x26')](_0x1359e8)){_0x45014a[_0x1359e8]['ivrTotalCallsDays']=0x0;_0x45014a[_0x1359e8][_0xa1fc('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x1b6895){if(!_[_0xa1fc('0x2e')](_0x1b6895)){for(var _0x3d1aeb in _0x1b6895){if(_0x1b6895['hasOwnProperty'](_0x3d1aeb)){_0x1b6895[_0x3d1aeb][_0xa1fc('0x2b')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x30')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x31')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x32')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x2c')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x2d')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x33')]=0x0;_0x1b6895[_0x3d1aeb]['outboundAnswerAgiCallsDay']=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x34')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x35')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x36')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x37')]=0x0;_0x1b6895[_0x3d1aeb]['outboundUnknownCallsDay']=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x38')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x39')]=0x0;_0x1b6895[_0x3d1aeb]['outboundBlacklistCallsDay']=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x3a')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x3b')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x3c')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x3d')]=0x0;_0x1b6895[_0x3d1aeb][_0xa1fc('0x3e')]=0x0;_0x1b6895[_0x3d1aeb]['queueStatusComplete']=!![];}}}}Realtime[_0xa1fc('0x3f')]['mergeFromDatabase']=function(_0x532ccd,_0x355537){for(var _0x1152b7 in _0x355537){if(_0x532ccd[_0xa1fc('0x26')](_0x1152b7)){_0x532ccd[_0x1152b7]=_0x355537[_0x1152b7];}}};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x40')]=function(){var _0x220de2=this;return function(_0x39512a){if(_0x39512a){freeIsNotKeyAgent(_0x39512a,_0x220de2[_0xa1fc('0x12')]);for(var _0x231379=0x0,_0x3a1790={},_0x25c5a={};_0x231379<_0x39512a['length'];_0x231379+=0x1){_0x3a1790=_0x39512a[_0x231379];var _0x3b915d=_[_0xa1fc('0x41')](_0x3a1790[_0xa1fc('0x2a')])?util['format']('SIP/%s',_0x3a1790[_0xa1fc('0x29')]):_0x3a1790[_0xa1fc('0x2a')];if(_[_0xa1fc('0x42')](_0x220de2[_0xa1fc('0x12')][_0x3b915d])){_0x220de2['agents'][_0x3b915d]=new Agent(_0x3a1790);}else{_0x220de2['mergeFromDatabase'](_0x220de2[_0xa1fc('0x12')][_0x3b915d],_0x3a1790);}}}return _0x220de2[_0xa1fc('0x12')];};};Realtime['prototype'][_0xa1fc('0x43')]=function(){var _0x4dd469=this;return function(_0x513430){if(_0x513430){freeIsNotKeySip(_0x513430,_0x4dd469[_0xa1fc('0x13')]);for(var _0x37e13d=0x0,_0x3e4bf4={},_0x30218b={};_0x37e13d<_0x513430['length'];_0x37e13d+=0x1){_0x3e4bf4=_0x513430[_0x37e13d];if(_[_0xa1fc('0x42')](_0x4dd469[_0xa1fc('0x13')][util['format'](_0xa1fc('0x28'),_0x3e4bf4[_0xa1fc('0x29')])])){_0x4dd469[_0xa1fc('0x13')][util['format'](_0xa1fc('0x28'),_0x3e4bf4[_0xa1fc('0x29')])]=new Telephone(_0x3e4bf4);}else{_0x4dd469[_0xa1fc('0x44')](_0x4dd469[_0xa1fc('0x13')][util[_0xa1fc('0x27')](_0xa1fc('0x28'),_0x3e4bf4['name'])],_0x3e4bf4);}}}return _0x4dd469[_0xa1fc('0x13')];};};Realtime[_0xa1fc('0x3f')]['initTrunks']=function(){var _0x3a1bc1=this;return function(_0x31f17e){if(_0x31f17e){freeIsNotKeySip(_0x31f17e,_0x3a1bc1[_0xa1fc('0x14')]);for(var _0xd461ea=0x0,_0x565571={},_0x10d9b1={};_0xd461ea<_0x31f17e[_0xa1fc('0x45')];_0xd461ea+=0x1){_0x565571=_0x31f17e[_0xd461ea];if(_['isUndefined'](_0x3a1bc1[_0xa1fc('0x14')][util[_0xa1fc('0x27')]('SIP/%s',_0x565571[_0xa1fc('0x29')])])){_0x3a1bc1[_0xa1fc('0x14')][util[_0xa1fc('0x27')](_0xa1fc('0x28'),_0x565571[_0xa1fc('0x29')])]=new Trunk(_0x565571);}else{_0x3a1bc1[_0xa1fc('0x44')](_0x3a1bc1[_0xa1fc('0x14')][util[_0xa1fc('0x27')](_0xa1fc('0x28'),_0x565571[_0xa1fc('0x29')])],_0x565571);}}}return _0x3a1bc1[_0xa1fc('0x14')];};};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x46')]=function(){var _0x281885=this;return function(_0x22a255){if(_0x22a255){freeIsNotKey(_0x22a255,_0x281885[_0xa1fc('0x15')],_0xa1fc('0x29'));for(var _0x5ef602=0x0,_0x336177={},_0x422dda={};_0x5ef602<_0x22a255['length'];_0x5ef602+=0x1){_0x336177=_0x22a255[_0x5ef602];if(_[_0xa1fc('0x42')](_0x281885[_0xa1fc('0x15')][_0x336177[_0xa1fc('0x29')]])){_0x281885[_0xa1fc('0x15')][_0x336177['name']]=new VoiceQueue(_0x336177);}else{_0x281885[_0xa1fc('0x44')](_0x281885[_0xa1fc('0x15')][_0x336177[_0xa1fc('0x29')]],_0x336177);}}}return _0x281885[_0xa1fc('0x15')];};};Realtime['prototype'][_0xa1fc('0x47')]=function(){var _0x500b54=this;return function(_0x5e4266){if(_0x5e4266){freeIsNotKey(_0x5e4266,_0x500b54[_0xa1fc('0x48')],'id');for(var _0x5a8fea=0x0,_0x9d1dfe={},_0x318435={};_0x5a8fea<_0x5e4266['length'];_0x5a8fea+=0x1){_0x9d1dfe=_0x5e4266[_0x5a8fea];if(_[_0xa1fc('0x42')](_0x500b54[_0xa1fc('0x48')][_0x9d1dfe['id']])){_0x500b54[_0xa1fc('0x48')][_0x9d1dfe['id']]=new Trigger(_0x9d1dfe);}else{_0x500b54[_0xa1fc('0x44')](_0x500b54['triggers'][_0x9d1dfe['id']],_0x9d1dfe);}}}return _0x500b54['triggers'];};};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x49')]=function(){var _0x270179=this;return function(_0x9e1d94){if(_0x9e1d94){freeIsNotKey(_0x9e1d94,_0x270179['templates'],'id');for(var _0x3772e7=0x0,_0x28e5d2={},_0x448b7b={};_0x3772e7<_0x9e1d94[_0xa1fc('0x45')];_0x3772e7+=0x1){_0x28e5d2=_0x9e1d94[_0x3772e7];if(_[_0xa1fc('0x42')](_0x270179['templates'][_0x28e5d2['id']])){_0x270179[_0xa1fc('0x17')][_0x28e5d2['id']]=new Template(_0x28e5d2);}else{_0x270179[_0xa1fc('0x44')](_0x270179['templates'][_0x28e5d2['id']],_0x28e5d2);}}}return _0x270179[_0xa1fc('0x17')];};};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x4a')]=function(){var _0xb3ae8a=this;return function(_0x3bfbf8){if(_0x3bfbf8){freeIsNotKey(_0x3bfbf8,_0xb3ae8a[_0xa1fc('0x4b')],'id');for(var _0x57aa2c=0x0,_0x3e2784={},_0x551ed7={};_0x57aa2c<_0x3bfbf8[_0xa1fc('0x45')];_0x57aa2c+=0x1){_0x3e2784=_0x3bfbf8[_0x57aa2c];if(_[_0xa1fc('0x42')](_0xb3ae8a[_0xa1fc('0x4b')][_0x3e2784['id']])){_0xb3ae8a[_0xa1fc('0x4b')][_0x3e2784['id']]=new ZendeskAccount(_0x3e2784);}else{_0xb3ae8a[_0xa1fc('0x44')](_0xb3ae8a[_0xa1fc('0x4b')][_0x3e2784['id']],_0x3e2784);}}}return _0xb3ae8a[_0xa1fc('0x4b')];};};Realtime[_0xa1fc('0x3f')]['initSalesforceAccounts']=function(){var _0x1a3837=this;return function(_0xce88d0){if(_0xce88d0){freeIsNotKey(_0xce88d0,_0x1a3837[_0xa1fc('0x1e')],'id');for(var _0x4a547c=0x0,_0x2b4c89={},_0x395df5={};_0x4a547c<_0xce88d0[_0xa1fc('0x45')];_0x4a547c+=0x1){_0x2b4c89=_0xce88d0[_0x4a547c];if(_[_0xa1fc('0x42')](_0x1a3837[_0xa1fc('0x1e')][_0x2b4c89['id']])){_0x1a3837['salesforceAccounts'][_0x2b4c89['id']]=new SalesforceAccount(_0x2b4c89);}else{_0x1a3837[_0xa1fc('0x44')](_0x1a3837[_0xa1fc('0x1e')][_0x2b4c89['id']],_0x2b4c89);}}}return _0x1a3837[_0xa1fc('0x1e')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x4acf7f=this;return function(_0x19ccf8){if(_0x19ccf8){freeIsNotKey(_0x19ccf8,_0x4acf7f[_0xa1fc('0x4c')],'id');for(var _0x178e63=0x0,_0x5375ea={},_0x559d9b={};_0x178e63<_0x19ccf8[_0xa1fc('0x45')];_0x178e63+=0x1){_0x5375ea=_0x19ccf8[_0x178e63];if(_[_0xa1fc('0x42')](_0x4acf7f['freshdeskAccounts'][_0x5375ea['id']])){_0x4acf7f['freshdeskAccounts'][_0x5375ea['id']]=new FreshdeskAccount(_0x5375ea);}else{_0x4acf7f['mergeFromDatabase'](_0x4acf7f[_0xa1fc('0x4c')][_0x5375ea['id']],_0x5375ea);}}}return _0x4acf7f[_0xa1fc('0x4c')];};};Realtime['prototype'][_0xa1fc('0x4d')]=function(){var _0x3db863=this;return function(_0xb29777){if(_0xb29777){freeIsNotKey(_0xb29777,_0x3db863[_0xa1fc('0x1f')],'id');for(var _0x203ef8=0x0,_0x35a2c5={},_0x205c10={};_0x203ef8<_0xb29777[_0xa1fc('0x45')];_0x203ef8+=0x1){_0x35a2c5=_0xb29777[_0x203ef8];if(_[_0xa1fc('0x42')](_0x3db863[_0xa1fc('0x1f')][_0x35a2c5['id']])){_0x3db863[_0xa1fc('0x1f')][_0x35a2c5['id']]=new ZohoAccount(_0x35a2c5);}else{_0x3db863['mergeFromDatabase'](_0x3db863[_0xa1fc('0x1f')][_0x35a2c5['id']],_0x35a2c5);}}}return _0x3db863[_0xa1fc('0x1f')];};};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x4e')]=function(){var _0x1e910f=this;return function(_0x3df000){if(_0x3df000){freeIsNotKey(_0x3df000,_0x1e910f[_0xa1fc('0x20')],'id');for(var _0x214faa=0x0,_0x2ec6c5={},_0x371f7d={};_0x214faa<_0x3df000[_0xa1fc('0x45')];_0x214faa+=0x1){_0x2ec6c5=_0x3df000[_0x214faa];if(_[_0xa1fc('0x42')](_0x1e910f['deskAccounts'][_0x2ec6c5['id']])){_0x1e910f[_0xa1fc('0x20')][_0x2ec6c5['id']]=new DeskAccount(_0x2ec6c5);}else{_0x1e910f['mergeFromDatabase'](_0x1e910f[_0xa1fc('0x20')][_0x2ec6c5['id']],_0x2ec6c5);}}}return _0x1e910f[_0xa1fc('0x20')];};};Realtime[_0xa1fc('0x3f')]['initSugarcrmAccounts']=function(){var _0x335c83=this;return function(_0x190372){if(_0x190372){freeIsNotKey(_0x190372,_0x335c83[_0xa1fc('0x4f')],'id');for(var _0x319a07=0x0,_0xdf55a6={},_0x2e93ce={};_0x319a07<_0x190372[_0xa1fc('0x45')];_0x319a07+=0x1){_0xdf55a6=_0x190372[_0x319a07];if(_[_0xa1fc('0x42')](_0x335c83[_0xa1fc('0x4f')][_0xdf55a6['id']])){_0x335c83['sugarcrmAccounts'][_0xdf55a6['id']]=new SugarcrmAccount(_0xdf55a6);}else{_0x335c83[_0xa1fc('0x44')](_0x335c83[_0xa1fc('0x4f')][_0xdf55a6['id']],_0xdf55a6);}}}return _0x335c83['sugarcrmAccounts'];};};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x50')]=function(){var _0x15591f=this;return function(_0x3478cb){if(_0x3478cb){freeIsNotKey(_0x3478cb,_0x15591f[_0xa1fc('0x21')],'id');for(var _0xf26059=0x0,_0x25da1a={},_0xb84813={};_0xf26059<_0x3478cb[_0xa1fc('0x45')];_0xf26059+=0x1){_0x25da1a=_0x3478cb[_0xf26059];if(_['isUndefined'](_0x15591f[_0xa1fc('0x21')][_0x25da1a['id']])){_0x15591f[_0xa1fc('0x21')][_0x25da1a['id']]=new VtigerAccount(_0x25da1a);}else{_0x15591f[_0xa1fc('0x44')](_0x15591f[_0xa1fc('0x21')][_0x25da1a['id']],_0x25da1a);}}}return _0x15591f[_0xa1fc('0x21')];};};Realtime[_0xa1fc('0x3f')]['initServicenowAccounts']=function(){var _0x15b95e=this;return function(_0x5dcd3f){if(_0x5dcd3f){freeIsNotKey(_0x5dcd3f,_0x15b95e[_0xa1fc('0x22')],'id');for(var _0x35432e=0x0,_0x306a35={},_0x1ec02c={};_0x35432e<_0x5dcd3f[_0xa1fc('0x45')];_0x35432e+=0x1){_0x306a35=_0x5dcd3f[_0x35432e];if(_[_0xa1fc('0x42')](_0x15b95e[_0xa1fc('0x22')][_0x306a35['id']])){_0x15b95e['servicenowAccounts'][_0x306a35['id']]=new ServicenowAccount(_0x306a35);}else{_0x15b95e['mergeFromDatabase'](_0x15b95e[_0xa1fc('0x22')][_0x306a35['id']],_0x306a35);}}}return _0x15b95e[_0xa1fc('0x22')];};};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x51')]=function(){var _0x566705=this;return function(_0x4e6ed8){if(_0x4e6ed8){freeIsNotKey(_0x4e6ed8,_0x566705[_0xa1fc('0x23')],'id');for(var _0x371ab8=0x0,_0x337f1c={},_0x535a86={};_0x371ab8<_0x4e6ed8[_0xa1fc('0x45')];_0x371ab8+=0x1){_0x337f1c=_0x4e6ed8[_0x371ab8];if(_[_0xa1fc('0x42')](_0x566705[_0xa1fc('0x23')][_0x337f1c['id']])){_0x566705[_0xa1fc('0x23')][_0x337f1c['id']]=new Dynamics365Account(_0x337f1c);}else{_0x566705['mergeFromDatabase'](_0x566705[_0xa1fc('0x23')][_0x337f1c['id']],_0x337f1c);}}}return _0x566705[_0xa1fc('0x23')];};};Realtime[_0xa1fc('0x3f')]['initFreshsalesAccounts']=function(){var _0x3cd98f=this;return function(_0x1e9dc4){if(_0x1e9dc4){freeIsNotKey(_0x1e9dc4,_0x3cd98f[_0xa1fc('0x24')],'id');for(var _0x5bdb8d=0x0,_0x12d7c3={},_0x20f0ae={};_0x5bdb8d<_0x1e9dc4[_0xa1fc('0x45')];_0x5bdb8d+=0x1){_0x12d7c3=_0x1e9dc4[_0x5bdb8d];if(_[_0xa1fc('0x42')](_0x3cd98f[_0xa1fc('0x24')][_0x12d7c3['id']])){_0x3cd98f[_0xa1fc('0x24')][_0x12d7c3['id']]=new FreshsalesAccount(_0x12d7c3);}else{_0x3cd98f[_0xa1fc('0x44')](_0x3cd98f[_0xa1fc('0x24')][_0x12d7c3['id']],_0x12d7c3);}}}return _0x3cd98f['freshsalesAccounts'];};};Realtime[_0xa1fc('0x3f')]['initVoiceQueueHopperHistory']=function(){var _0x29b379=this;return function(_0x11ddf3){for(var _0x50abe8=0x0;_0x50abe8<_0x11ddf3[_0xa1fc('0x45')];_0x50abe8+=0x1){_['merge'](_0x29b379[_0xa1fc('0x15')][_0x11ddf3[_0x50abe8][_0xa1fc('0x29')]],_0x11ddf3[_0x50abe8]);}return _0x29b379[_0xa1fc('0x15')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x18817f=this;return function(_0x199dd1){clearVoiceQueues(_0x18817f[_0xa1fc('0x15')]);if(_0x199dd1){_0x199dd1=_[_0xa1fc('0x52')](_0x199dd1,_0xa1fc('0x53'));for(var _0x7888f in _0x199dd1){if(_0x199dd1[_0xa1fc('0x26')](_0x7888f)){var _0x2777db={};for(var _0x53d504=0x0;_0x53d504<_0x199dd1[_0x7888f]['length'];_0x53d504+=0x1){var _0x14ec64=_0x199dd1[_0x7888f][_0x53d504]['queue'];if(_0x18817f[_0xa1fc('0x15')][_0x14ec64]){if(_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x54')]){_0x18817f['voiceQueues'][_0x14ec64]['unmanaged']+=0x1;}if(_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x55')]){_0x18817f[_0xa1fc('0x15')][_0x14ec64]['abandoned']+=0x1;}_0x18817f[_0xa1fc('0x15')][_0x14ec64][_0xa1fc('0x2c')]+=moment(_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x56')])[_0xa1fc('0x57')](moment(_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x58')]),_0xa1fc('0x59'))||0x0;if(_0x53d504===_0x199dd1[_0x7888f][_0xa1fc('0x45')]-0x1){_0x18817f[_0xa1fc('0x15')][_0x14ec64][_0xa1fc('0x2d')]+=moment(_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x5a')]||_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x5b')]||_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x5c')])[_0xa1fc('0x57')](moment(_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x58')]),_0xa1fc('0x59'))||0x0;_0x18817f[_0xa1fc('0x15')][_0x14ec64]['total']+=0x1;if(_0x199dd1[_0x7888f][_0x53d504][_0xa1fc('0x5d')]){_0x18817f[_0xa1fc('0x15')][_0x14ec64][_0xa1fc('0x30')]+=0x1;_0x18817f[_0xa1fc('0x15')][_0x14ec64]['sumBillable']+=moment(_0x199dd1[_0x7888f][_0x53d504]['queuecallercompleteAt'])[_0xa1fc('0x57')](moment(_0x199dd1[_0x7888f][_0x53d504]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x18817f[_0xa1fc('0x15')][_0x14ec64][_0xa1fc('0x2d')]+=_0x18817f[_0xa1fc('0x15')][_0x14ec64][_0xa1fc('0x2c')]||0x0;}}}}}}return _0x18817f[_0xa1fc('0x15')];};};Realtime['prototype'][_0xa1fc('0x5e')]=function(){var _0x29962e=this;return function(_0x2aa59e){clearVoiceCallReports(_0x29962e[_0xa1fc('0x18')]);if(_0x2aa59e){for(var _0x5eeebc=0x0;_0x5eeebc<_0x2aa59e[_0xa1fc('0x45')];_0x5eeebc+=0x1){_0x29962e[_0xa1fc('0x18')][_0xa1fc('0x2b')]+=0x1;_0x29962e[_0xa1fc('0x18')][_0xa1fc('0x2d')]+=_0x2aa59e[_0x5eeebc][_0xa1fc('0x5f')];if(_0x2aa59e[_0x5eeebc]['disposition']===_0xa1fc('0x60')){_0x29962e['outbound'][_0xa1fc('0x30')]+=0x1;_0x29962e[_0xa1fc('0x18')][_0xa1fc('0x2c')]+=_0x2aa59e[_0x5eeebc][_0xa1fc('0x5f')]-_0x2aa59e[_0x5eeebc]['billableseconds']||0x0;_0x29962e[_0xa1fc('0x18')]['sumBillable']+=_0x2aa59e[_0x5eeebc][_0xa1fc('0x61')];}}}return _0x29962e[_0xa1fc('0x18')];};};Realtime[_0xa1fc('0x3f')]['initCampaigns']=function(){var _0x4bd4d7=this;return function(_0x1487f1){if(_0x1487f1){freeIsNotKey(_0x1487f1,_0x4bd4d7[_0xa1fc('0x16')],_0xa1fc('0x29'));for(var _0x1f4063=0x0,_0x5a9574={};_0x1f4063<_0x1487f1[_0xa1fc('0x45')];_0x1f4063+=0x1){_0x5a9574=_0x1487f1[_0x1f4063];if(_['isUndefined'](_0x4bd4d7[_0xa1fc('0x16')][_0x5a9574[_0xa1fc('0x29')]])){_0x4bd4d7[_0xa1fc('0x16')][_0x5a9574['name']]=new Campaign(_0x5a9574);}else{_0x4bd4d7[_0xa1fc('0x44')](_0x4bd4d7[_0xa1fc('0x16')][_0x5a9574[_0xa1fc('0x29')]],_0x5a9574);_0x4bd4d7[_0xa1fc('0x16')][_0x5a9574[_0xa1fc('0x29')]]['dialQueueProject']=_0x5a9574[_0xa1fc('0x62')]?_0x5a9574[_0xa1fc('0x62')][_0xa1fc('0x29')]:undefined;}}}return _0x4bd4d7['campaigns'];};};Realtime[_0xa1fc('0x3f')]['initVoiceExtensions']=function(){var _0x2867a5=this;return function(_0x30f33c){if(_0x30f33c){freeIsNotKey(_0x30f33c,_0x2867a5[_0xa1fc('0x19')],'id');for(var _0x34f50c=0x0,_0x35b632={};_0x34f50c<_0x30f33c[_0xa1fc('0x45')];_0x34f50c+=0x1){_0x35b632=_0x30f33c[_0x34f50c];if(_[_0xa1fc('0x42')](_0x2867a5['voiceExtensions'][_0x35b632['id']])){_0x2867a5[_0xa1fc('0x19')][_0x35b632['id']]=new VoiceExtension(_0x35b632);}else{_0x2867a5[_0xa1fc('0x44')](_0x2867a5[_0xa1fc('0x19')][_0x35b632['id']],_0x35b632);}}}return _0x2867a5[_0xa1fc('0x19')];};};Realtime[_0xa1fc('0x3f')]['initCampaignHopperHistory']=function(){var _0x548a3a=this;return function(_0x1ae6b3){clearCampaigns(_0x548a3a[_0xa1fc('0x16')]);for(var _0x530488=0x0;_0x530488<_0x1ae6b3[_0xa1fc('0x45')];_0x530488+=0x1){_['merge'](_0x548a3a[_0xa1fc('0x16')][_0x1ae6b3[_0x530488][_0xa1fc('0x29')]],_0x1ae6b3[_0x530488]);}return _0x548a3a['campaigns'];};};Realtime[_0xa1fc('0x3f')][_0xa1fc('0x63')]=function(){var _0x2f255f=this;return function(_0x2806d7){if(_0x2806d7){freeIsNotKey(_0x2806d7,_0x2f255f[_0xa1fc('0x64')],'id');for(var _0xb0c430=0x0,_0x2e70b7={},_0x5416ac={};_0xb0c430<_0x2806d7[_0xa1fc('0x45')];_0xb0c430+=0x1){_0x2e70b7=_0x2806d7[_0xb0c430];if(_[_0xa1fc('0x42')](_0x2f255f['faxAccounts'][_0x2e70b7['id']])){_0x2f255f[_0xa1fc('0x64')][_0x2e70b7['id']]=new FaxAccount(_0x2e70b7);}else{_0x2f255f['mergeFromDatabase'](_0x2f255f['faxAccounts'][_0x2e70b7['id']],_0x2e70b7);}}}return _0x2f255f['faxAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index dcdd9b9..e5ac3ec 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 _0xd3fd=['calleridnum','originatecalleridnum','channel','destinationchannel','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','monitor','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','Local','indexOf','mobile','phone','substring','lastIndexOf','membername','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedTransfer','findAgent','accountcode','name','isNil','find','SIP/%s','length','assigned','interface','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','destination','exten','type','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','calleridpreview'];(function(_0x2baca1,_0x2f3557){var _0x9aa62a=function(_0x5c47d5){while(--_0x5c47d5){_0x2baca1['push'](_0x2baca1['shift']());}};_0x9aa62a(++_0x2f3557);}(_0xd3fd,0xca));var _0xdd3f=function(_0x588f61,_0x532804){_0x588f61=_0x588f61-0x0;var _0x3153f3=_0xd3fd[_0x588f61];return _0x3153f3;};'use strict';var _=require(_0xdd3f('0x0'));var moment=require(_0xdd3f('0x1'));var util=require(_0xdd3f('0x2'));var config=require(_0xdd3f('0x3'));var ami=require(_0xdd3f('0x4'));var RpcVoiceAgentReport=require(_0xdd3f('0x5'));var RpcVoiceCallReport=require(_0xdd3f('0x6'));var RpcVoiceDialReport=require(_0xdd3f('0x7'));var RpcMemberReport=require(_0xdd3f('0x8'));var RpcVoiceQueueReport=require(_0xdd3f('0x9'));var RpcVoiceRecording=require(_0xdd3f('0xa'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xdd3f('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xdd3f('0xc'));var UserReport=require(_0xdd3f('0xd'));function Report(_0x1c9ae7){this[_0xdd3f('0xe')]=_0x1c9ae7;this['agents']=_0x1c9ae7[_0xdd3f('0xf')];this['telephones']=_0x1c9ae7[_0xdd3f('0x10')];}Report[_0xdd3f('0x11')][_0xdd3f('0x12')]=function(_0x1b21c5){var _0x255f5a=new VoiceQueueReport(this[_0xdd3f('0xe')]);var _0x4e5904=new VoiceAgentReport(this['realtime']);var _0x18db2c=new VoiceDialReport(this[_0xdd3f('0xe')]);var _0x222065=new VoiceCallReport(this['realtime']);var _0x2b0046=new UserReport(this['realtime']);if(config[_0xdd3f('0x13')]&&config[_0xdd3f('0x13')]['disabled']){ami['on'](_0xdd3f('0x14'),this[_0xdd3f('0x15')][_0xdd3f('0x16')](this));ami['on'](_0xdd3f('0x17'),this[_0xdd3f('0x18')][_0xdd3f('0x16')](this));ami['on']('custom:voiceAgentReport',this[_0xdd3f('0x19')][_0xdd3f('0x16')](this));ami['on']('custom:voiceDialReport',this[_0xdd3f('0x1a')]['bind'](this));ami['on'](_0xdd3f('0x1b'),this['blindTransfer'][_0xdd3f('0x16')](this));ami['on']('attendedtransfer',this[_0xdd3f('0x1c')][_0xdd3f('0x16')](this));}};Report[_0xdd3f('0x11')][_0xdd3f('0x1d')]=function(_0x42da16){var _0x2fd2f9;_0x2fd2f9=_['find'](this[_0xdd3f('0xf')],function(_0x532d30){return _0x532d30[_0xdd3f('0x1e')]==_0x42da16||_0x532d30[_0xdd3f('0x1f')]==_0x42da16;});if(_[_0xdd3f('0x20')](_0x2fd2f9)){var _0x32afae=_[_0xdd3f('0x21')](this[_0xdd3f('0x10')],function(_0x32dc98){return _0x32dc98['accountcode']==_0x42da16||_0x32dc98[_0xdd3f('0x1f')]==_0x42da16;});if(_0x32afae){_0x2fd2f9=_[_0xdd3f('0x21')](this[_0xdd3f('0xf')],function(_0x4f4a71){return _0x4f4a71['interface']==util['format'](_0xdd3f('0x22'),_0x32afae['name']);});}}return _0x2fd2f9;};Report[_0xdd3f('0x11')][_0xdd3f('0x15')]=function(_0x1e4f66){for(var _0x1935b3=0x0;_0x1935b3<_0x1e4f66[_0xdd3f('0x23')];_0x1935b3+=0x1){var _0x7211f2=this[_0xdd3f('0x1d')](_0x1e4f66[_0x1935b3]['connectedlinenum']);if(_0x7211f2){_0x1e4f66[_0x1935b3][_0xdd3f('0x1e')]=_0x7211f2[_0xdd3f('0x1e')];_0x1e4f66[_0x1935b3][_0xdd3f('0x24')]=!![];_0x1e4f66[_0x1935b3]['lastAssignedTo']=_0x7211f2[_0xdd3f('0x1f')];_0x1e4f66[_0x1935b3][_0xdd3f('0x25')]=_[_0xdd3f('0x20')](_0x7211f2[_0xdd3f('0x25')])?util[_0xdd3f('0x26')]('SIP/%s',_0x7211f2[_0xdd3f('0x1f')]):_0x7211f2[_0xdd3f('0x25')];if(_0x1e4f66[_0x1935b3][_0xdd3f('0x27')]){_0x1e4f66[_0x1935b3][_0xdd3f('0x28')]=moment()['format'](_0xdd3f('0x29'));}if(_0x1e4f66[_0x1935b3]['queuecallerexit']){_0x1e4f66[_0x1935b3][_0xdd3f('0x2a')]=moment()[_0xdd3f('0x26')](_0xdd3f('0x29'));}RpcMemberReport[_0xdd3f('0x15')](_0x1e4f66[_0x1935b3]);}RpcVoiceQueueReport[_0xdd3f('0x2b')](_0x1e4f66[_0x1935b3]);}};function extractCalleridNumber(_0x40c882){var _0x4eec3c=_0x40c882[_0xdd3f('0x2c')](/<(.*?)>/);return _0x4eec3c?_0x4eec3c[0x1]:_0x40c882;}Report['prototype'][_0xdd3f('0x18')]=function(_0x132518){_0x132518[_0xdd3f('0x2d')]=_0x132518[_0xdd3f('0x2d')]||_0x132518[_0xdd3f('0x2e')];if(_0x132518[_0xdd3f('0x2f')]=='dialer'){_0x132518['lastapplication']=_0xdd3f('0x30');_0x132518[_0xdd3f('0x31')]=_0x132518[_0xdd3f('0x30')];if(_0x132518[_0xdd3f('0x32')]==_0xdd3f('0x33')){_0x132518[_0xdd3f('0x1e')]='';_0x132518[_0xdd3f('0x2d')]=extractCalleridNumber(_0x132518[_0xdd3f('0x34')]);}else if(_0x132518['context']==_0xdd3f('0x35')){if(_0x132518['destination']==_0xdd3f('0x36')){_0x132518['destination']=extractCalleridNumber(_0x132518[_0xdd3f('0x37')]);_0x132518[_0xdd3f('0x38')]=_0x132518[_0xdd3f('0x39')];_0x132518['destinationchannel']=[_0x132518[_0xdd3f('0x3a')],_0x132518['channel']=_0x132518[_0xdd3f('0x3b')]][0x0];_0x132518[_0xdd3f('0x34')]=_0x132518[_0xdd3f('0x37')];}else{_0x132518[_0xdd3f('0x2d')]=_0x132518[_0xdd3f('0x38')];_0x132518[_0xdd3f('0x38')]=_0x132518[_0xdd3f('0x39')];if(_0x132518[_0xdd3f('0x3c')]==_0xdd3f('0x3d')){_0x132518[_0xdd3f('0x1e')]=_0x132518[_0xdd3f('0x3e')];}else{_0x132518[_0xdd3f('0x1e')]='';}}}}else{_0x132518[_0xdd3f('0x34')]=util[_0xdd3f('0x26')](_0xdd3f('0x3f'),_0x132518[_0xdd3f('0x40')],_0x132518['calleridnum']);}if(RpcVoiceTransferReport[_0xdd3f('0x41')][_0x132518[_0xdd3f('0x42')]]){var _0x39137c=RpcVoiceTransferReport[_0xdd3f('0x41')][_0x132518['linkedid']];_0x39137c[_0xdd3f('0x43')]=_0x132518['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x39137c);delete RpcVoiceTransferReport[_0xdd3f('0x41')][_0x132518['linkedid']];}RpcVoiceCallReport[_0xdd3f('0x2b')](_0x132518);if(_0x132518[_0xdd3f('0x44')]){for(var _0x209c56=0x0;_0x209c56<_0x132518[_0xdd3f('0x45')][_0xdd3f('0x23')];_0x209c56+=0x1){_0x132518[_0xdd3f('0x46')]=_0x132518[_0xdd3f('0x45')][_0x209c56][_0xdd3f('0x47')];_0x132518[_0xdd3f('0x48')]=_0x132518['monitors'][_0x209c56][_0xdd3f('0x48')];if(_0x132518[_0xdd3f('0x2e')]==_0xdd3f('0x36')){_0x132518[_0xdd3f('0x38')]=_0x132518['connectedlinenum'];_0x132518[_0xdd3f('0x40')]=_0x132518[_0xdd3f('0x49')];_0x132518[_0xdd3f('0x3e')]=_0x132518[_0xdd3f('0x1e')];_0x132518['connectedlinename']=_0x132518['membername'];_0x132518[_0xdd3f('0x2e')]=_0x132518[_0xdd3f('0x39')];}else if(_0x132518[_0xdd3f('0x2e')]==_0xdd3f('0x4a')){_0x132518[_0xdd3f('0x38')]=_0x132518[_0xdd3f('0x2d')];_0x132518[_0xdd3f('0x2e')]=_0x132518[_0xdd3f('0x39')];}RpcVoiceRecording['create'](_0x132518);}}};Report['prototype'][_0xdd3f('0x19')]=function(_0x2c3c42){if(_[_0xdd3f('0x4b')](_0x2c3c42)){_0x2c3c42[_0xdd3f('0x4c')](function(_0x58d433){RpcVoiceAgentReport[_0xdd3f('0x2b')](_0x58d433);});}else{RpcVoiceAgentReport[_0xdd3f('0x2b')](_0x2c3c42);}};Report[_0xdd3f('0x11')][_0xdd3f('0x1a')]=function(_0x530d18){RpcVoiceDialReport[_0xdd3f('0x2b')](_0x530d18);var _0x5b9679;var _0x483026;var _0x3532c3=_0x530d18[_0xdd3f('0x3a')];if(_['startsWith'](_0x3532c3,_0xdd3f('0x4d'))){_0x483026=_0x3532c3['substring'](_0x3532c3[_0xdd3f('0x4e')]('/')+0x1,_0x3532c3['indexOf']('@'));_0x5b9679=_[_0xdd3f('0x21')](this[_0xdd3f('0xf')],function(_0x41290a){return _0x41290a[_0xdd3f('0x4f')]==_0x483026||_0x41290a[_0xdd3f('0x50')]==_0x483026||_0x41290a[_0xdd3f('0x1e')]==_0x483026;});}else{_0x483026=_0x3532c3[_0xdd3f('0x51')](_0x3532c3['indexOf']('/')+0x1,_0x3532c3[_0xdd3f('0x52')]('-'));_0x5b9679=this['findAgent'](_0x483026);}if(_0x5b9679){_0x530d18[_0xdd3f('0x25')]=_['isNil'](_0x5b9679[_0xdd3f('0x25')])?util[_0xdd3f('0x26')](_0xdd3f('0x22'),_0x5b9679['name']):_0x5b9679[_0xdd3f('0x25')];_0x530d18[_0xdd3f('0x53')]=_0x5b9679[_0xdd3f('0x1f')];_0x530d18[_0xdd3f('0x1e')]=_0x5b9679[_0xdd3f('0x1e')];RpcMemberReport[_0xdd3f('0x1a')](_0x530d18);}};Report['prototype']['blindTransfer']=function(_0x56a7c0){RpcVoiceTransferReport[_0xdd3f('0x41')][_0x56a7c0[_0xdd3f('0x54')]]=_0x56a7c0;};Report[_0xdd3f('0x11')][_0xdd3f('0x1c')]=function(_0x1e8e77){RpcVoiceTransferReport['attendedTransfer'](_0x1e8e77);};module[_0xdd3f('0x55')]=Report; \ No newline at end of file +var _0x39da=['queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','xcally-motion-preview','calleridpreview','calleridnum','channel','destinationchannel','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','monitor','monitors','filename','createdAt','connectedlinename','membername','originatecalleridnum','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','SIP/%s','transfererlinkedid','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','prototype','sync','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','isNil','accountcode','name','interface','format','length','connectedlinenum','lastAssignedTo','queuecallercomplete'];(function(_0x265003,_0xf0f023){var _0x33c743=function(_0x326a5d){while(--_0x326a5d){_0x265003['push'](_0x265003['shift']());}};_0x33c743(++_0xf0f023);}(_0x39da,0x88));var _0xa39d=function(_0x24ee99,_0x26c483){_0x24ee99=_0x24ee99-0x0;var _0x4c2cce=_0x39da[_0x24ee99];return _0x4c2cce;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xa39d('0x0'));var config=require(_0xa39d('0x1'));var ami=require(_0xa39d('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xa39d('0x3'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xa39d('0x4'));var RpcVoiceRecording=require(_0xa39d('0x5'));var RpcVoiceTransferReport=require(_0xa39d('0x6'));var VoiceQueueReport=require(_0xa39d('0x7'));var VoiceCallReport=require(_0xa39d('0x8'));var VoiceAgentReport=require(_0xa39d('0x9'));var VoiceDialReport=require(_0xa39d('0xa'));var UserReport=require(_0xa39d('0xb'));function Report(_0x1f05f4){this['realtime']=_0x1f05f4;this[_0xa39d('0xc')]=_0x1f05f4[_0xa39d('0xc')];this['telephones']=_0x1f05f4[_0xa39d('0xd')];}Report[_0xa39d('0xe')][_0xa39d('0xf')]=function(_0x3e4714){var _0x3e93ec=new VoiceQueueReport(this[_0xa39d('0x10')]);var _0x10fa21=new VoiceAgentReport(this[_0xa39d('0x10')]);var _0x54595c=new VoiceDialReport(this[_0xa39d('0x10')]);var _0x287d5a=new VoiceCallReport(this[_0xa39d('0x10')]);var _0x4073ce=new UserReport(this[_0xa39d('0x10')]);if(config[_0xa39d('0x11')]&&config[_0xa39d('0x11')][_0xa39d('0x12')]){ami['on'](_0xa39d('0x13'),this[_0xa39d('0x14')][_0xa39d('0x15')](this));ami['on'](_0xa39d('0x16'),this[_0xa39d('0x17')]['bind'](this));ami['on'](_0xa39d('0x18'),this['voiceAgentReport']['bind'](this));ami['on'](_0xa39d('0x19'),this[_0xa39d('0x1a')][_0xa39d('0x15')](this));ami['on'](_0xa39d('0x1b'),this[_0xa39d('0x1c')][_0xa39d('0x15')](this));ami['on'](_0xa39d('0x1d'),this[_0xa39d('0x1e')][_0xa39d('0x15')](this));}};Report[_0xa39d('0xe')][_0xa39d('0x1f')]=function(_0xc42f43){var _0x3f367f;_0x3f367f=_[_0xa39d('0x20')](this[_0xa39d('0xc')],function(_0x3807f4){return _0x3807f4['accountcode']==_0xc42f43||_0x3807f4['name']==_0xc42f43;});if(_[_0xa39d('0x21')](_0x3f367f)){var _0x460557=_[_0xa39d('0x20')](this['telephones'],function(_0x596dd2){return _0x596dd2[_0xa39d('0x22')]==_0xc42f43||_0x596dd2[_0xa39d('0x23')]==_0xc42f43;});if(_0x460557){_0x3f367f=_[_0xa39d('0x20')](this[_0xa39d('0xc')],function(_0x4314b1){return _0x4314b1[_0xa39d('0x24')]==util[_0xa39d('0x25')]('SIP/%s',_0x460557[_0xa39d('0x23')]);});}}return _0x3f367f;};Report[_0xa39d('0xe')][_0xa39d('0x14')]=function(_0x5c4265){for(var _0x2ecb4b=0x0;_0x2ecb4b<_0x5c4265[_0xa39d('0x26')];_0x2ecb4b+=0x1){var _0x1fcb27=this[_0xa39d('0x1f')](_0x5c4265[_0x2ecb4b][_0xa39d('0x27')]);if(_0x1fcb27){_0x5c4265[_0x2ecb4b][_0xa39d('0x22')]=_0x1fcb27['accountcode'];_0x5c4265[_0x2ecb4b]['assigned']=!![];_0x5c4265[_0x2ecb4b][_0xa39d('0x28')]=_0x1fcb27[_0xa39d('0x23')];_0x5c4265[_0x2ecb4b]['interface']=_[_0xa39d('0x21')](_0x1fcb27['interface'])?util[_0xa39d('0x25')]('SIP/%s',_0x1fcb27[_0xa39d('0x23')]):_0x1fcb27[_0xa39d('0x24')];if(_0x5c4265[_0x2ecb4b][_0xa39d('0x29')]){_0x5c4265[_0x2ecb4b][_0xa39d('0x2a')]=moment()[_0xa39d('0x25')](_0xa39d('0x2b'));}if(_0x5c4265[_0x2ecb4b][_0xa39d('0x2c')]){_0x5c4265[_0x2ecb4b][_0xa39d('0x2d')]=moment()[_0xa39d('0x25')](_0xa39d('0x2b'));}RpcMemberReport['voiceQueueReport'](_0x5c4265[_0x2ecb4b]);}RpcVoiceQueueReport[_0xa39d('0x2e')](_0x5c4265[_0x2ecb4b]);}};function extractCalleridNumber(_0x2f07ee){var _0x5e19f8=_0x2f07ee[_0xa39d('0x2f')](/<(.*?)>/);return _0x5e19f8?_0x5e19f8[0x1]:_0x2f07ee;}Report[_0xa39d('0xe')][_0xa39d('0x17')]=function(_0x68b10c){_0x68b10c[_0xa39d('0x30')]=_0x68b10c[_0xa39d('0x30')]||_0x68b10c[_0xa39d('0x31')];if(_0x68b10c[_0xa39d('0x32')]==_0xa39d('0x33')){_0x68b10c[_0xa39d('0x34')]=_0xa39d('0x35');_0x68b10c[_0xa39d('0x36')]=_0x68b10c[_0xa39d('0x35')];if(_0x68b10c[_0xa39d('0x37')]==_0xa39d('0x38')){_0x68b10c['accountcode']='';_0x68b10c['destination']=extractCalleridNumber(_0x68b10c[_0xa39d('0x39')]);}else if(_0x68b10c[_0xa39d('0x37')]=='from-sip'){if(_0x68b10c['destination']==_0xa39d('0x3a')){_0x68b10c['destination']=extractCalleridNumber(_0x68b10c[_0xa39d('0x3b')]);_0x68b10c[_0xa39d('0x3c')]=_0x68b10c['originatecalleridnum'];_0x68b10c['destinationchannel']=[_0x68b10c[_0xa39d('0x3d')],_0x68b10c[_0xa39d('0x3d')]=_0x68b10c[_0xa39d('0x3e')]][0x0];_0x68b10c[_0xa39d('0x39')]=_0x68b10c[_0xa39d('0x3b')];}else{_0x68b10c[_0xa39d('0x30')]=_0x68b10c['calleridnum'];_0x68b10c['calleridnum']=_0x68b10c['originatecalleridnum'];if(_0x68b10c[_0xa39d('0x3f')]==_0xa39d('0x40')){_0x68b10c[_0xa39d('0x22')]=_0x68b10c[_0xa39d('0x27')];}else{_0x68b10c[_0xa39d('0x22')]='';}}}}else{_0x68b10c[_0xa39d('0x39')]=util[_0xa39d('0x25')](_0xa39d('0x41'),_0x68b10c[_0xa39d('0x42')],_0x68b10c['calleridnum']);}if(RpcVoiceTransferReport[_0xa39d('0x43')][_0x68b10c[_0xa39d('0x44')]]){var _0x2da00d=RpcVoiceTransferReport[_0xa39d('0x43')][_0x68b10c['linkedid']];_0x2da00d[_0xa39d('0x45')]=_0x68b10c['uniqueid'];RpcVoiceTransferReport[_0xa39d('0x1c')](_0x2da00d);delete RpcVoiceTransferReport[_0xa39d('0x43')][_0x68b10c[_0xa39d('0x44')]];}RpcVoiceCallReport[_0xa39d('0x2e')](_0x68b10c);if(_0x68b10c[_0xa39d('0x46')]){for(var _0x3dab9e=0x0;_0x3dab9e<_0x68b10c[_0xa39d('0x47')][_0xa39d('0x26')];_0x3dab9e+=0x1){_0x68b10c['monitorFilename']=_0x68b10c[_0xa39d('0x47')][_0x3dab9e][_0xa39d('0x48')];_0x68b10c[_0xa39d('0x49')]=_0x68b10c[_0xa39d('0x47')][_0x3dab9e][_0xa39d('0x49')];if(_0x68b10c['exten']=='xcally-motion-preview'){_0x68b10c[_0xa39d('0x3c')]=_0x68b10c['connectedlinenum'];_0x68b10c[_0xa39d('0x42')]=_0x68b10c[_0xa39d('0x4a')];_0x68b10c[_0xa39d('0x27')]=_0x68b10c[_0xa39d('0x22')];_0x68b10c[_0xa39d('0x4a')]=_0x68b10c[_0xa39d('0x4b')];_0x68b10c['exten']=_0x68b10c[_0xa39d('0x4c')];}else if(_0x68b10c['exten']==_0xa39d('0x4d')){_0x68b10c[_0xa39d('0x3c')]=_0x68b10c[_0xa39d('0x30')];_0x68b10c[_0xa39d('0x31')]=_0x68b10c[_0xa39d('0x4c')];}RpcVoiceRecording['create'](_0x68b10c);}}};Report['prototype']['voiceAgentReport']=function(_0x33c086){if(_[_0xa39d('0x4e')](_0x33c086)){_0x33c086[_0xa39d('0x4f')](function(_0x1f5ca7){RpcVoiceAgentReport[_0xa39d('0x2e')](_0x1f5ca7);});}else{RpcVoiceAgentReport[_0xa39d('0x2e')](_0x33c086);}};Report['prototype']['voiceDialReport']=function(_0x254107){RpcVoiceDialReport[_0xa39d('0x2e')](_0x254107);var _0x16c8f0;var _0x1827d4;var _0x3be312=_0x254107[_0xa39d('0x3d')];if(_[_0xa39d('0x50')](_0x3be312,_0xa39d('0x51'))){_0x1827d4=_0x3be312['substring'](_0x3be312[_0xa39d('0x52')]('/')+0x1,_0x3be312['indexOf']('@'));_0x16c8f0=_[_0xa39d('0x20')](this[_0xa39d('0xc')],function(_0x24a4d0){return _0x24a4d0[_0xa39d('0x53')]==_0x1827d4||_0x24a4d0[_0xa39d('0x54')]==_0x1827d4||_0x24a4d0[_0xa39d('0x22')]==_0x1827d4;});}else{_0x1827d4=_0x3be312[_0xa39d('0x55')](_0x3be312[_0xa39d('0x52')]('/')+0x1,_0x3be312[_0xa39d('0x56')]('-'));_0x16c8f0=this[_0xa39d('0x1f')](_0x1827d4);}if(_0x16c8f0){_0x254107[_0xa39d('0x24')]=_[_0xa39d('0x21')](_0x16c8f0['interface'])?util[_0xa39d('0x25')](_0xa39d('0x57'),_0x16c8f0['name']):_0x16c8f0[_0xa39d('0x24')];_0x254107['membername']=_0x16c8f0[_0xa39d('0x23')];_0x254107['accountcode']=_0x16c8f0[_0xa39d('0x22')];RpcMemberReport['voiceDialReport'](_0x254107);}};Report[_0xa39d('0xe')]['blindTransfer']=function(_0x5e726e){RpcVoiceTransferReport['transfers'][_0x5e726e[_0xa39d('0x58')]]=_0x5e726e;};Report[_0xa39d('0xe')][_0xa39d('0x1e')]=function(_0x3b62af){RpcVoiceTransferReport[_0xa39d('0x1e')](_0x3b62af);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 856d46d..a6a974a 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb98c=['syncPeerStatus','syncRealtimeShow','resolve','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionSipPeerStatus','prototype','emit','info','state','[userReport][registry]','find','username','stateRegistry','omit','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','trunk:%s','trunk:save','syncDeviceState','device','[userReport][devicestatechange]','local','inuse','toLowerCase','toNumber','format','updateStatusRealtime','stateTime','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','name','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','mobile','accountcode','isNotNull','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','[userReport][peerstatus]','registered','status','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','lodash','moment','util','bluebird','../../../config/logger','../ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange'];(function(_0x5ea908,_0x1dae33){var _0x2d7bb4=function(_0x19663e){while(--_0x19663e){_0x5ea908['push'](_0x5ea908['shift']());}};_0x2d7bb4(++_0x1dae33);}(_0xb98c,0x7a));var _0xcb98=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0xb98c[_0x874cf1];return _0x233579;};'use strict';var _=require(_0xcb98('0x0'));var moment=require(_0xcb98('0x1'));var util=require(_0xcb98('0x2'));var Redis=require('ioredis');var BPromise=require(_0xcb98('0x3'));var config=require('../../../config/environment');var logger=require(_0xcb98('0x4'))('ami');var ami=require(_0xcb98('0x5'));config[_0xcb98('0x6')]=_['defaults'](config[_0xcb98('0x6')],{'host':_0xcb98('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function UserReport(_0x4a98b7){this[_0xcb98('0x8')]=_0x4a98b7[_0xcb98('0x8')];this[_0xcb98('0x9')]=_0x4a98b7[_0xcb98('0x9')];this[_0xcb98('0xa')]=_0x4a98b7[_0xcb98('0xa')];ami['on'](_0xcb98('0xb'),this[_0xcb98('0xc')][_0xcb98('0xd')](this));ami['on'](_0xcb98('0xe'),this['syncRegistry'][_0xcb98('0xd')](this));ami['on'](_0xcb98('0xf'),this['syncDeviceState'][_0xcb98('0xd')](this));ami['on']('peerstatus',this[_0xcb98('0x10')][_0xcb98('0xd')](this));return this[_0xcb98('0x11')]();}function showSipRegistrations(){Promise[_0xcb98('0x12')]()[_0xcb98('0x13')](ami[_0xcb98('0x14')]())[_0xcb98('0x15')](function(_0x57b08e){logger[_0xcb98('0x16')](_0xcb98('0x17'),util['inspect'](_0x57b08e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xcb98('0x12')]()['then'](ami['actionDeviceStateList']())[_0xcb98('0x15')](function(_0x490121){logger['error']('[userReport][devicestatelist]',util[_0xcb98('0x18')](_0x490121,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xcb98('0x12')]()[_0xcb98('0x13')](ami[_0xcb98('0x19')]())[_0xcb98('0x15')](function(_0x51f363){logger['error']('[userReport][sippeerstatus]',util['inspect'](_0x51f363,{'showHidden':![],'depth':null}));});}UserReport[_0xcb98('0x1a')][_0xcb98('0x11')]=function(){setInterval(function(){BPromise[_0xcb98('0x12')]()[_0xcb98('0x13')](showSipRegistrations())[_0xcb98('0x13')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xcb98('0x1a')]['isNotNull']=function(_0x326442){return _0x326442!==null&&!_['isUndefined'](_0x326442);};UserReport[_0xcb98('0x1a')][_0xcb98('0x1b')]=function(_0x1c7509,_0x1fe345,_0x5d0ade){io['to'](_0x1c7509)[_0xcb98('0x1b')](_0x1fe345,_0x5d0ade);};UserReport[_0xcb98('0x1a')][_0xcb98('0xc')]=function(_0x92fca5){try{if(this['isNotNull'](_0x92fca5)){logger[_0xcb98('0x1c')]('[userReport][registry]\x20registry:%s\x20state:%s',_0x92fca5['username'],_0x92fca5[_0xcb98('0x1d')]);logger['debug'](_0xcb98('0x1e'),util[_0xcb98('0x18')](_0x92fca5,{'showHidden':![],'depth':null}));var _0x4a1dbc=_[_0xcb98('0x1f')](this[_0xcb98('0x8')],{'defaultuser':_0x92fca5[_0xcb98('0x20')]});if(_0x4a1dbc){_0x92fca5[_0xcb98('0x21')]=_0x92fca5[_0xcb98('0x1d')];_['merge'](_0x4a1dbc,_[_0xcb98('0x22')](_0x92fca5,['event','actionid',_0xcb98('0x20'),_0xcb98('0x1d')]));logger[_0xcb98('0x23')](_0xcb98('0x24'),util['inspect'](_0x4a1dbc,{'showHidden':![],'depth':null}));this[_0xcb98('0x1b')](util['format'](_0xcb98('0x25'),_0x4a1dbc['name']),_0xcb98('0x26'),_0x4a1dbc);}}}catch(_0x593e7c){logger[_0xcb98('0x16')]('[userReport][registry]',util['inspect'](_0x593e7c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xcb98('0x27')]=function(_0x4b447c){try{if(this['isNotNull'](_0x4b447c)){logger[_0xcb98('0x1c')]('[userReport][devicestatechange]\x20device:%s\x20state:%s',_0x4b447c[_0xcb98('0x28')],_0x4b447c[_0xcb98('0x1d')]);logger[_0xcb98('0x23')](_0xcb98('0x29'),util[_0xcb98('0x18')](_0x4b447c,{'showHidden':![],'depth':null}));if(this[_0xcb98('0x9')][_0x4b447c['device']]){if(!this[_0xcb98('0x9')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x2a')]||_0x4b447c[_0xcb98('0x1d')]['toLowerCase']()==_0xcb98('0x2b')){this[_0xcb98('0x9')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x2a')]=![];if(this[_0xcb98('0x9')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x1d')]!==_0x4b447c[_0xcb98('0x1d')][_0xcb98('0x2c')]()){this[_0xcb98('0x9')][_0x4b447c[_0xcb98('0x28')]]['stateTime']=_[_0xcb98('0x2d')](moment()[_0xcb98('0x2e')]('x'));}this['agents'][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x1d')]=_0x4b447c[_0xcb98('0x1d')][_0xcb98('0x2c')]();this[_0xcb98('0x9')][_0x4b447c['device']][_0xcb98('0x2f')](_0x4b447c);}}else if(this[_0xcb98('0xa')][_0x4b447c[_0xcb98('0x28')]]){if(this[_0xcb98('0xa')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x1d')]!==_0x4b447c[_0xcb98('0x1d')][_0xcb98('0x2c')]()){this[_0xcb98('0xa')][_0x4b447c['device']][_0xcb98('0x30')]=_['toNumber'](moment()['format']('x'));}this[_0xcb98('0xa')][_0x4b447c['device']][_0xcb98('0x1d')]=_0x4b447c['state'][_0xcb98('0x2c')]();logger[_0xcb98('0x23')](_0xcb98('0x31'),util[_0xcb98('0x18')](this['telephones'][_0x4b447c['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0xcb98('0x2e')]('telephone:%s',this['telephones'][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x32')]),_0xcb98('0x33'),this[_0xcb98('0xa')][_0x4b447c[_0xcb98('0x28')]]);}else if(this[_0xcb98('0x8')][_0x4b447c['device']]){if(this[_0xcb98('0x8')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x1d')]!==_0x4b447c[_0xcb98('0x1d')][_0xcb98('0x2c')]()){this[_0xcb98('0x8')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x30')]=_[_0xcb98('0x2d')](moment()[_0xcb98('0x2e')]('x'));}this[_0xcb98('0x8')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x1d')]=_0x4b447c['state'][_0xcb98('0x2c')]();logger[_0xcb98('0x23')](_0xcb98('0x34'),util[_0xcb98('0x18')](this[_0xcb98('0x8')][_0x4b447c[_0xcb98('0x28')]],{'showHidden':![],'depth':null}));this[_0xcb98('0x1b')](util[_0xcb98('0x2e')](_0xcb98('0x25'),this[_0xcb98('0x8')][_0x4b447c[_0xcb98('0x28')]][_0xcb98('0x32')]),_0xcb98('0x26'),this[_0xcb98('0x8')][_0x4b447c[_0xcb98('0x28')]]);}else if(_[_0xcb98('0x35')](_0x4b447c[_0xcb98('0x28')],_0xcb98('0x36'))){var _0x16f3ad=_0x4b447c['device'];var _0x16dde2=_0x16f3ad[_0xcb98('0x37')](_0x16f3ad[_0xcb98('0x38')]('/')+0x1,_0x16f3ad[_0xcb98('0x38')]('@'));var _0xe7e2cf=_[_0xcb98('0x1f')](this['agents'],function(_0x5d4e29){return _0x5d4e29[_0xcb98('0x39')]==_0x16dde2||_0x5d4e29['phone']==_0x16dde2||_0x5d4e29[_0xcb98('0x3a')]==_0x16dde2;});if(_0xe7e2cf){if(_0xe7e2cf[_0xcb98('0x1d')]!==_0x4b447c[_0xcb98('0x1d')]['toLowerCase']()){_0xe7e2cf[_0xcb98('0x30')]=_[_0xcb98('0x2d')](moment()[_0xcb98('0x2e')]('x'));}_0xe7e2cf[_0xcb98('0x1d')]=_0x4b447c['state'][_0xcb98('0x2c')]();_0xe7e2cf['local']=!![];_0xe7e2cf[_0xcb98('0x2f')](_0x4b447c);}}}}catch(_0xe9e5be){logger[_0xcb98('0x16')](_0xcb98('0x29'),util['inspect'](_0xe9e5be,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0xcb98('0x10')]=function(_0x2689b6){try{if(this[_0xcb98('0x3b')](_0x2689b6)&&this[_0xcb98('0x3b')](_0x2689b6[_0xcb98('0x3c')])){logger['info'](_0xcb98('0x3d'),_0x2689b6[_0xcb98('0x3e')],_0x2689b6[_0xcb98('0x3f')],_0x2689b6[_0xcb98('0x3c')]);logger[_0xcb98('0x23')](_0xcb98('0x40'),util[_0xcb98('0x18')](_0x2689b6,{'showHidden':![],'depth':null}));if(this[_0xcb98('0x9')][_0x2689b6[_0xcb98('0x3e')]]){if(!this[_0xcb98('0x9')][_0x2689b6[_0xcb98('0x3e')]]['local']||_0x2689b6[_0xcb98('0x3c')][_0xcb98('0x2c')]()==_0xcb98('0x41')){this['agents'][_0x2689b6['peer']][_0xcb98('0x2a')]=![];this[_0xcb98('0x9')][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x42')]=_0x2689b6[_0xcb98('0x3c')][_0xcb98('0x2c')]();this['agents'][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x3f')]=_0x2689b6[_0xcb98('0x3f')];this[_0xcb98('0x9')][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x2f')](_0x2689b6);}}else if(this[_0xcb98('0xa')][_0x2689b6[_0xcb98('0x3e')]]){this[_0xcb98('0xa')][_0x2689b6[_0xcb98('0x3e')]]['status']=_0x2689b6[_0xcb98('0x3c')][_0xcb98('0x2c')]();this[_0xcb98('0xa')][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x3f')]=_0x2689b6[_0xcb98('0x3f')];logger[_0xcb98('0x23')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xcb98('0x18')](this[_0xcb98('0xa')][_0x2689b6[_0xcb98('0x3e')]],{'showHidden':![],'depth':null}));this[_0xcb98('0x1b')](util[_0xcb98('0x2e')](_0xcb98('0x43'),this[_0xcb98('0xa')][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x32')]),_0xcb98('0x33'),this['telephones'][_0x2689b6[_0xcb98('0x3e')]]);}else if(this[_0xcb98('0x8')][_0x2689b6[_0xcb98('0x3e')]]){this[_0xcb98('0x8')][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x42')]=_0x2689b6[_0xcb98('0x3c')]['toLowerCase']();this[_0xcb98('0x8')][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x3f')]=_0x2689b6[_0xcb98('0x3f')];logger['debug'](_0xcb98('0x44'),util['inspect'](this[_0xcb98('0x8')][_0x2689b6[_0xcb98('0x3e')]],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xcb98('0x25'),this['trunks'][_0x2689b6[_0xcb98('0x3e')]][_0xcb98('0x32')]),_0xcb98('0x26'),this[_0xcb98('0x8')][_0x2689b6[_0xcb98('0x3e')]]);}}}catch(_0x552f7e){logger[_0xcb98('0x16')](_0xcb98('0x40'),util[_0xcb98('0x18')](_0x552f7e,{'showHidden':![],'depth':null}));}};module['exports']=UserReport; \ No newline at end of file +var _0x4a8a=['toLowerCase','inuse','stateTime','updateStatusRealtime','toNumber','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','substring','indexOf','mobile','phone','accountcode','peer','address','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','socket.io-emitter','trunks','agents','telephones','syncRegistry','registry','bind','devicestatechange','peerstatus','syncPeerStatus','syncRealtimeShow','then','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','resolve','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit','isNotNull','[userReport][registry]\x20registry:%s\x20state:%s','debug','find','stateRegistry','merge','omit','username','state','format','trunk:%s','name','trunk:save','[userReport][registry]','syncDeviceState','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x4a8a,0xf6));var _0xa4a8=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x4a8a[_0x59d0cc];return _0x2ae79f;};'use strict';var _=require(_0xa4a8('0x0'));var moment=require(_0xa4a8('0x1'));var util=require(_0xa4a8('0x2'));var Redis=require(_0xa4a8('0x3'));var BPromise=require('bluebird');var config=require(_0xa4a8('0x4'));var logger=require(_0xa4a8('0x5'))(_0xa4a8('0x6'));var ami=require(_0xa4a8('0x7'));config[_0xa4a8('0x8')]=_['defaults'](config[_0xa4a8('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xa4a8('0x9'))(new Redis(config[_0xa4a8('0x8')]));function UserReport(_0x2fcb89){this[_0xa4a8('0xa')]=_0x2fcb89[_0xa4a8('0xa')];this[_0xa4a8('0xb')]=_0x2fcb89[_0xa4a8('0xb')];this[_0xa4a8('0xc')]=_0x2fcb89[_0xa4a8('0xc')];ami['on']('registryentry',this[_0xa4a8('0xd')]['bind'](this));ami['on'](_0xa4a8('0xe'),this[_0xa4a8('0xd')][_0xa4a8('0xf')](this));ami['on'](_0xa4a8('0x10'),this['syncDeviceState']['bind'](this));ami['on'](_0xa4a8('0x11'),this[_0xa4a8('0x12')][_0xa4a8('0xf')](this));return this[_0xa4a8('0x13')]();}function showSipRegistrations(){Promise['resolve']()[_0xa4a8('0x14')](ami[_0xa4a8('0x15')]())[_0xa4a8('0x16')](function(_0x59a41e){logger[_0xa4a8('0x17')](_0xa4a8('0x18'),util[_0xa4a8('0x19')](_0x59a41e,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xa4a8('0x14')](ami[_0xa4a8('0x1a')]())['catch'](function(_0x53e2cc){logger['error'](_0xa4a8('0x1b'),util[_0xa4a8('0x19')](_0x53e2cc,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xa4a8('0x1c')]()[_0xa4a8('0x14')](ami[_0xa4a8('0x1d')]())[_0xa4a8('0x16')](function(_0x37c0a4){logger[_0xa4a8('0x17')](_0xa4a8('0x1e'),util[_0xa4a8('0x19')](_0x37c0a4,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0xa4a8('0x13')]=function(){setInterval(function(){BPromise[_0xa4a8('0x1c')]()['then'](showSipRegistrations())[_0xa4a8('0x14')](listDeviceStates())['then'](showPeersStatus());},0x32c8);};UserReport[_0xa4a8('0x1f')]['isNotNull']=function(_0x111270){return _0x111270!==null&&!_[_0xa4a8('0x20')](_0x111270);};UserReport['prototype']['emit']=function(_0x124af2,_0x2b5f24,_0x59d699){io['to'](_0x124af2)[_0xa4a8('0x21')](_0x2b5f24,_0x59d699);};UserReport[_0xa4a8('0x1f')][_0xa4a8('0xd')]=function(_0x31e7ff){try{if(this[_0xa4a8('0x22')](_0x31e7ff)){logger['info'](_0xa4a8('0x23'),_0x31e7ff['username'],_0x31e7ff['state']);logger[_0xa4a8('0x24')]('[userReport][registry]',util[_0xa4a8('0x19')](_0x31e7ff,{'showHidden':![],'depth':null}));var _0x4dc10b=_[_0xa4a8('0x25')](this[_0xa4a8('0xa')],{'defaultuser':_0x31e7ff['username']});if(_0x4dc10b){_0x31e7ff[_0xa4a8('0x26')]=_0x31e7ff['state'];_[_0xa4a8('0x27')](_0x4dc10b,_[_0xa4a8('0x28')](_0x31e7ff,['event','actionid',_0xa4a8('0x29'),_0xa4a8('0x2a')]));logger[_0xa4a8('0x24')]('[userReport][registry]\x20sending\x20trunk:save\x20event:',util['inspect'](_0x4dc10b,{'showHidden':![],'depth':null}));this[_0xa4a8('0x21')](util[_0xa4a8('0x2b')](_0xa4a8('0x2c'),_0x4dc10b[_0xa4a8('0x2d')]),_0xa4a8('0x2e'),_0x4dc10b);}}}catch(_0xf6577){logger['error'](_0xa4a8('0x2f'),util[_0xa4a8('0x19')](_0xf6577,{'showHidden':![],'depth':null}));}};UserReport[_0xa4a8('0x1f')][_0xa4a8('0x30')]=function(_0x545644){try{if(this['isNotNull'](_0x545644)){logger[_0xa4a8('0x31')](_0xa4a8('0x32'),_0x545644[_0xa4a8('0x33')],_0x545644[_0xa4a8('0x2a')]);logger[_0xa4a8('0x24')](_0xa4a8('0x34'),util['inspect'](_0x545644,{'showHidden':![],'depth':null}));if(this[_0xa4a8('0xb')][_0x545644[_0xa4a8('0x33')]]){if(!this[_0xa4a8('0xb')][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x35')]||_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]()==_0xa4a8('0x37')){this[_0xa4a8('0xb')][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x35')]=![];if(this[_0xa4a8('0xb')][_0x545644['device']]['state']!==_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]()){this[_0xa4a8('0xb')][_0x545644['device']][_0xa4a8('0x38')]=_['toNumber'](moment()[_0xa4a8('0x2b')]('x'));}this[_0xa4a8('0xb')][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x2a')]=_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]();this[_0xa4a8('0xb')][_0x545644['device']][_0xa4a8('0x39')](_0x545644);}}else if(this[_0xa4a8('0xc')][_0x545644[_0xa4a8('0x33')]]){if(this[_0xa4a8('0xc')][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x2a')]!==_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]()){this['telephones'][_0x545644[_0xa4a8('0x33')]]['stateTime']=_[_0xa4a8('0x3a')](moment()[_0xa4a8('0x2b')]('x'));}this['telephones'][_0x545644['device']][_0xa4a8('0x2a')]=_0x545644[_0xa4a8('0x2a')]['toLowerCase']();logger[_0xa4a8('0x24')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xa4a8('0x19')](this[_0xa4a8('0xc')][_0x545644[_0xa4a8('0x33')]],{'showHidden':![],'depth':null}));this[_0xa4a8('0x21')](util[_0xa4a8('0x2b')](_0xa4a8('0x3b'),this[_0xa4a8('0xc')][_0x545644['device']][_0xa4a8('0x2d')]),_0xa4a8('0x3c'),this[_0xa4a8('0xc')][_0x545644[_0xa4a8('0x33')]]);}else if(this[_0xa4a8('0xa')][_0x545644[_0xa4a8('0x33')]]){if(this[_0xa4a8('0xa')][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x2a')]!==_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]()){this['trunks'][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x38')]=_[_0xa4a8('0x3a')](moment()['format']('x'));}this['trunks'][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x2a')]=_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]();logger[_0xa4a8('0x24')](_0xa4a8('0x3d'),util[_0xa4a8('0x19')](this[_0xa4a8('0xa')][_0x545644[_0xa4a8('0x33')]],{'showHidden':![],'depth':null}));this[_0xa4a8('0x21')](util['format']('trunk:%s',this[_0xa4a8('0xa')][_0x545644[_0xa4a8('0x33')]][_0xa4a8('0x2d')]),_0xa4a8('0x2e'),this['trunks'][_0x545644[_0xa4a8('0x33')]]);}else if(_[_0xa4a8('0x3e')](_0x545644[_0xa4a8('0x33')],'Local')){var _0x40d305=_0x545644[_0xa4a8('0x33')];var _0x2b1cba=_0x40d305[_0xa4a8('0x3f')](_0x40d305[_0xa4a8('0x40')]('/')+0x1,_0x40d305[_0xa4a8('0x40')]('@'));var _0x122ea5=_['find'](this[_0xa4a8('0xb')],function(_0x3ad9c3){return _0x3ad9c3[_0xa4a8('0x41')]==_0x2b1cba||_0x3ad9c3[_0xa4a8('0x42')]==_0x2b1cba||_0x3ad9c3[_0xa4a8('0x43')]==_0x2b1cba;});if(_0x122ea5){if(_0x122ea5[_0xa4a8('0x2a')]!==_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]()){_0x122ea5['stateTime']=_['toNumber'](moment()['format']('x'));}_0x122ea5[_0xa4a8('0x2a')]=_0x545644[_0xa4a8('0x2a')][_0xa4a8('0x36')]();_0x122ea5['local']=!![];_0x122ea5['updateStatusRealtime'](_0x545644);}}}}catch(_0x3ece76){logger[_0xa4a8('0x17')](_0xa4a8('0x34'),util[_0xa4a8('0x19')](_0x3ece76,{'showHidden':![],'depth':null}));}};UserReport[_0xa4a8('0x1f')][_0xa4a8('0x12')]=function(_0x5f42df){try{if(this['isNotNull'](_0x5f42df)&&this[_0xa4a8('0x22')](_0x5f42df[_0xa4a8('0x11')])){logger[_0xa4a8('0x31')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x5f42df[_0xa4a8('0x44')],_0x5f42df[_0xa4a8('0x45')],_0x5f42df['peerstatus']);logger[_0xa4a8('0x24')](_0xa4a8('0x46'),util[_0xa4a8('0x19')](_0x5f42df,{'showHidden':![],'depth':null}));if(this[_0xa4a8('0xb')][_0x5f42df[_0xa4a8('0x44')]]){if(!this[_0xa4a8('0xb')][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x35')]||_0x5f42df[_0xa4a8('0x11')][_0xa4a8('0x36')]()==_0xa4a8('0x47')){this[_0xa4a8('0xb')][_0x5f42df['peer']][_0xa4a8('0x35')]=![];this['agents'][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x48')]=_0x5f42df[_0xa4a8('0x11')]['toLowerCase']();this['agents'][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x45')]=_0x5f42df['address'];this[_0xa4a8('0xb')][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x39')](_0x5f42df);}}else if(this[_0xa4a8('0xc')][_0x5f42df['peer']]){this[_0xa4a8('0xc')][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x48')]=_0x5f42df[_0xa4a8('0x11')][_0xa4a8('0x36')]();this[_0xa4a8('0xc')][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x45')]=_0x5f42df['address'];logger[_0xa4a8('0x24')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0xa4a8('0x19')](this[_0xa4a8('0xc')][_0x5f42df['peer']],{'showHidden':![],'depth':null}));this[_0xa4a8('0x21')](util[_0xa4a8('0x2b')]('telephone:%s',this[_0xa4a8('0xc')][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x2d')]),'telephone:save',this[_0xa4a8('0xc')][_0x5f42df['peer']]);}else if(this[_0xa4a8('0xa')][_0x5f42df['peer']]){this['trunks'][_0x5f42df[_0xa4a8('0x44')]]['status']=_0x5f42df[_0xa4a8('0x11')]['toLowerCase']();this['trunks'][_0x5f42df[_0xa4a8('0x44')]][_0xa4a8('0x45')]=_0x5f42df[_0xa4a8('0x45')];logger[_0xa4a8('0x24')](_0xa4a8('0x49'),util[_0xa4a8('0x19')](this[_0xa4a8('0xa')][_0x5f42df[_0xa4a8('0x44')]],{'showHidden':![],'depth':null}));this[_0xa4a8('0x21')](util[_0xa4a8('0x2b')](_0xa4a8('0x2c'),this[_0xa4a8('0xa')][_0x5f42df['peer']][_0xa4a8('0x2d')]),_0xa4a8('0x2e'),this[_0xa4a8('0xa')][_0x5f42df[_0xa4a8('0x44')]]);}}}catch(_0x4ae854){logger[_0xa4a8('0x17')](_0xa4a8('0x46'),util[_0xa4a8('0x19')](_0x4ae854,{'showHidden':![],'depth':null}));}};module[_0xa4a8('0x4a')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 280c9ed..9ce7af3 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x42b7f6,_0x96fb2){var _0x872ad8=function(_0xe540f8){while(--_0xe540f8){_0x42b7f6['push'](_0x42b7f6['shift']());}};_0x872ad8(++_0x96fb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0xa9e0=['redis','defaults','localhost','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','uniqueid','YYYY-MM-DD\x20HH:mm:ss','queue','mandatoryDisposition','type','inbound','merge','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','[%s][voiceAgentReport][agentcalled]','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','voiceChannels','routealias','interface','pick','destconnectedlinenum','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','error','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentringnoanswer','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','syncAttendedTransfer','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','lodash','moment','util','../../../config/logger','../ami'];(function(_0x30f084,_0xd58d70){var _0x5b835b=function(_0x51fe22){while(--_0x51fe22){_0x30f084['push'](_0x30f084['shift']());}};_0x5b835b(++_0xd58d70);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x0a9e('0x3'))('ami');var ami=require(_0x0a9e('0x4'));config[_0x0a9e('0x5')]=_[_0x0a9e('0x6')](config[_0x0a9e('0x5')],{'host':_0x0a9e('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0x5')]));function VoiceAgentReport(_0x441e3a){this[_0x0a9e('0x8')]={};this['voiceChannels']=_0x441e3a['channels'];this[_0x0a9e('0x9')]=_0x441e3a['voiceQueues'];this['agents']=_0x441e3a[_0x0a9e('0xa')];this[_0x0a9e('0xb')]={};ami['on'](_0x0a9e('0xc'),this[_0x0a9e('0xd')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0xf'),this['syncAgentConnect']['bind'](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x10'),this[_0x0a9e('0x11')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x12'),this[_0x0a9e('0x13')]['bind'](this));ami['on'](_0x0a9e('0x14'),this[_0x0a9e('0x15')][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0xe')](this));ami['on']('musiconholdstart',this[_0x0a9e('0x18')]['bind'](this));ami['on'](_0x0a9e('0x19'),this['syncMusicOnHoldStop'][_0x0a9e('0xe')](this));ami['on'](_0x0a9e('0x1a'),this['syncAttendedTransfer'][_0x0a9e('0xe')](this));ami['on']('blindtransfer',this[_0x0a9e('0x1b')][_0x0a9e('0xe')](this));}VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1d')]=function(_0x31b1ca,_0x2eb11f,_0x530eb7){io['to'](_0x31b1ca)[_0x0a9e('0x1d')](_0x2eb11f,_0x530eb7);};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1e')]=function(_0x1c696a){return _0x1c696a!==null&&!_[_0x0a9e('0x1f')](_0x1c696a);};VoiceAgentReport['prototype'][_0x0a9e('0xd')]=function(_0x155cce){try{if(this['isNotNull'](_0x155cce)){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x155cce['uniqueid'],_0x155cce[_0x0a9e('0x21')],_0x155cce[_0x0a9e('0x22')]);logger[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x155cce['uniqueid'],util[_0x0a9e('0x25')](_0x155cce,{'showHidden':![],'depth':null}));if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]]={};}if(_[_0x0a9e('0x1f')](this['channels'][_0x155cce['uniqueid']][_0x155cce[_0x0a9e('0x22')]])){this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]={'agentcalledAt':moment()['format'](_0x0a9e('0x27')),'lastevent':'called','mandatoryDisposition':this[_0x0a9e('0x9')][_0x155cce['queue']]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x29')]||![]:![],'type':this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]]?this[_0x0a9e('0x9')][_0x155cce[_0x0a9e('0x28')]][_0x0a9e('0x2a')]||'inbound':_0x0a9e('0x2b'),'variables':this[_0x0a9e('0xb')][_0x155cce[_0x0a9e('0x26')]]};}_[_0x0a9e('0x2c')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],_[_0x0a9e('0x2d')](_0x155cce,[_0x0a9e('0x2e'),_0x0a9e('0x2f')]));logger[_0x0a9e('0x23')](_0x0a9e('0x30'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x155cce[_0x0a9e('0x26')]][_0x155cce['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x31'),this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);logger['debug'](_0x0a9e('0x32'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')]('user:%s',_0x155cce[_0x0a9e('0x21')]),'user:called',this[_0x0a9e('0x8')][_0x155cce[_0x0a9e('0x26')]][_0x155cce[_0x0a9e('0x22')]]);}}catch(_0x3f3d41){logger['error'](_0x0a9e('0x34'),_0x155cce[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3f3d41,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncAgentConnect']=function(_0x54135e){try{if(this[_0x0a9e('0x1e')](_0x54135e)){if(this['channels'][_0x54135e[_0x0a9e('0x26')]]){logger[_0x0a9e('0x23')](_0x0a9e('0x35'),_0x54135e[_0x0a9e('0x26')],util['inspect'](_0x54135e,{'showHidden':![],'depth':null}));for(var _0x31916f in this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]]){if(this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x31916f)){if(_0x54135e[_0x0a9e('0x22')]===_0x31916f){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x54135e[_0x0a9e('0x26')],_0x54135e[_0x0a9e('0x21')],_0x54135e['destuniqueid']);this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x37')]=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x38')]=_0x54135e['connectedlinename'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x39')]=_0x54135e['connectedlinenum'];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3a')]=_0x54135e[_0x0a9e('0x3a')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3b')]=_0x54135e[_0x0a9e('0x3b')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3c')]=_0x54135e[_0x0a9e('0x3c')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3d')]='connect';if(this['voiceChannels'][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]]){var _0x315881=this[_0x0a9e('0x3e')][this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x26')]][_0x0a9e('0x3f')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x3f')]=_0x315881;_0x54135e['routealias']=_0x315881;}_[_0x0a9e('0x2c')](this[_0x0a9e('0xa')][_0x54135e[_0x0a9e('0x40')]],_[_0x0a9e('0x41')](_0x54135e,[_0x0a9e('0x28'),_0x0a9e('0x42'),_0x0a9e('0x3f')]));logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));ami['emit'](_0x0a9e('0x43'),this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]]);logger[_0x0a9e('0x23')](_0x0a9e('0x44'),_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x54135e[_0x0a9e('0x22')]],{'showHidden':![],'depth':null}));this[_0x0a9e('0x1d')](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x54135e[_0x0a9e('0x21')]),_0x0a9e('0x46'),this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x54135e[_0x0a9e('0x22')]]);}else if(!this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']&&!this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x47'),_0x54135e[_0x0a9e('0x26')],this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x21')],_0x31916f);this['channels'][_0x54135e['uniqueid']][_0x31916f]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f][_0x0a9e('0x48')]=moment()['format'](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['answeredelsewheredestinationuniqueid']=_0x54135e[_0x0a9e('0x22')];this['channels'][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['answeredelsewheremembername']=_0x54135e[_0x0a9e('0x21')];this[_0x0a9e('0x8')][_0x54135e[_0x0a9e('0x26')]][_0x31916f]['lastevent']=_0x0a9e('0x49');this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f]['reason']=_0x0a9e('0x49');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x54135e[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x54135e['uniqueid']][_0x31916f],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentansweredelsewhere',this['channels'][_0x54135e['uniqueid']][_0x31916f]);}}}}}}catch(_0x2da03c){logger['error'](_0x0a9e('0x4a'),_0x54135e[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2da03c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x4b')]=function(_0x272738){try{if(this[_0x0a9e('0x1e')](_0x272738)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20event:',_0x272738[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x272738,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]]&&this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']]){logger[_0x0a9e('0x20')](_0x0a9e('0x4c'),_0x272738['uniqueid'],_0x272738[_0x0a9e('0x21')],_0x272738['destuniqueid']);this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738['destuniqueid']]['agentringnoanswer']=!![];this[_0x0a9e('0x8')][_0x272738['uniqueid']][_0x272738[_0x0a9e('0x22')]][_0x0a9e('0x48')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']][_0x0a9e('0x3d')]='rejected';this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]['reason']=_0x0a9e('0x4d');logger[_0x0a9e('0x23')](_0x0a9e('0x4e'),_0x272738[_0x0a9e('0x26')],util['inspect'](this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x4f'),this[_0x0a9e('0x8')][_0x272738[_0x0a9e('0x26')]][_0x272738[_0x0a9e('0x22')]]);}}}catch(_0x4d4a35){logger[_0x0a9e('0x50')](_0x0a9e('0x51'),_0x272738[_0x0a9e('0x26')],util['inspect'](_0x4d4a35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncQueueCallerAbandon']=function(_0x5211e3){try{if(this[_0x0a9e('0x1e')](_0x5211e3)){logger[_0x0a9e('0x23')](_0x0a9e('0x52'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x5211e3,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){for(var _0x54a37d in this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x54a37d)&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]&&!this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]['agentcomplete']){logger[_0x0a9e('0x20')](_0x0a9e('0x54'),_0x5211e3[_0x0a9e('0x26')],this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x21')],_0x54a37d);this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x53')]=!![];this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x48')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x3d')]=_0x0a9e('0x55');this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d][_0x0a9e('0x56')]=_0x0a9e('0x55');logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this[_0x0a9e('0x8')][_0x5211e3['uniqueid']][_0x54a37d],{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')]('custom:agentqueuecallerabandon',this[_0x0a9e('0x8')][_0x5211e3[_0x0a9e('0x26')]][_0x54a37d]);}}}}}catch(_0x4c46c1){logger[_0x0a9e('0x50')](_0x0a9e('0x57'),_0x5211e3[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x4c46c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x13')]=function(_0x2e9552){try{if(this[_0x0a9e('0x1e')](_0x2e9552)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2e9552,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){for(var _0x4abc8f in this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x4abc8f)){if(this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x37')]&&!this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x12')]){logger[_0x0a9e('0x20')](_0x0a9e('0x58'),_0x2e9552[_0x0a9e('0x26')],this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x21')],_0x4abc8f);this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f][_0x0a9e('0x12')]=!![];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x59')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]['lastevent']=_0x0a9e('0x5a');this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x56')]=_0x2e9552['reason']==_0x0a9e('0x5b')?_0x0a9e('0x5c'):_0x2e9552[_0x0a9e('0x56')];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5d')]=_0x2e9552[_0x0a9e('0x5d')];if(this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]&&this[_0x0a9e('0x9')][_0x2e9552[_0x0a9e('0x28')]][_0x0a9e('0x5e')]){this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x5f')]=this['voiceQueues'][_0x2e9552[_0x0a9e('0x28')]]['acwTimeout'];this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f][_0x0a9e('0x60')]=!![];}this[_0x0a9e('0xa')][_0x2e9552['interface']]=_['omit'](this[_0x0a9e('0xa')][_0x2e9552[_0x0a9e('0x40')]],[_0x0a9e('0x28'),'destconnectedlinenum']);logger[_0x0a9e('0x23')](_0x0a9e('0x61'),_0x2e9552['uniqueid'],util['inspect'](this[_0x0a9e('0x8')][_0x2e9552['uniqueid']][_0x4abc8f],{'showHidden':![],'depth':null}));ami['emit']('custom:agentcomplete',this[_0x0a9e('0x8')][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);logger[_0x0a9e('0x23')](_0x0a9e('0x62'),_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f],{'showHidden':![],'depth':null}));this['emit'](util[_0x0a9e('0x33')](_0x0a9e('0x45'),_0x2e9552[_0x0a9e('0x21')]),_0x0a9e('0x63'),this['channels'][_0x2e9552[_0x0a9e('0x26')]][_0x4abc8f]);}}}}}}catch(_0x32f761){logger[_0x0a9e('0x50')]('[%s][voiceAgentReport][agentcomplete]',_0x2e9552[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x32f761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x15')]=function(_0x255e49){try{if(this[_0x0a9e('0x1e')](_0x255e49)){logger[_0x0a9e('0x23')](_0x0a9e('0x64'),_0x255e49['uniqueid'],util[_0x0a9e('0x25')](_0x255e49,{'showHidden':![],'depth':null}));this[_0x0a9e('0x65')](_0x255e49['uniqueid'],_[_0x0a9e('0x66')](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(this['channels'][_0x255e49[_0x0a9e('0x26')]]){for(var _0x52ec10 in this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]]){if(this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x0a9e('0x36')](_0x52ec10)){logger[_0x0a9e('0x20')](_0x0a9e('0x69'),_0x255e49[_0x0a9e('0x26')],_0x52ec10,_['keys'](_0x255e49[_0x0a9e('0x67')])[0x0],_0x255e49[_0x0a9e('0x68')]);if(_[_0x0a9e('0x1f')](this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')])){this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]={};}this[_0x0a9e('0x8')][_0x255e49[_0x0a9e('0x26')]][_0x52ec10][_0x0a9e('0xb')]=this[_0x0a9e('0xb')][_0x255e49['uniqueid']];}}}}}catch(_0xc81b64){logger[_0x0a9e('0x50')](_0x0a9e('0x6a'),_0x255e49[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xc81b64,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x0a9e('0x65')]=function(_0x1756c7,_0x5ce99d,_0x23b447){var _0x5e725e=[_0x0a9e('0x6b'),_0x0a9e('0x6c'),_0x0a9e('0x6d'),_0x0a9e('0x6e'),'rtpaudioqosloss',_0x0a9e('0x6f'),'rtpaudioqosrtt',_0x0a9e('0x70'),_0x0a9e('0x71'),'sipuri',_0x0a9e('0x72'),_0x0a9e('0x73'),_0x0a9e('0x74'),'memberdynamic','memberinterface',_0x0a9e('0x75'),_0x0a9e('0x21'),_0x0a9e('0x76'),_0x0a9e('0x77')];if(!_[_0x0a9e('0x78')](_0x5ce99d)&&!_[_0x0a9e('0x79')](_0x5e725e,_0x5ce99d)){if(_[_0x0a9e('0x1f')](this[_0x0a9e('0xb')][_0x1756c7])){this[_0x0a9e('0xb')][_0x1756c7]={};}this['variables'][_0x1756c7][_0x5ce99d]=_0x23b447;}};VoiceAgentReport[_0x0a9e('0x1c')]['syncHangup']=function(_0x287324){try{if(this[_0x0a9e('0x1e')](_0x287324)){logger[_0x0a9e('0x23')](_0x0a9e('0x7a'),_0x287324[_0x0a9e('0x26')],util['inspect'](_0x287324,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){for(var _0x2791c5 in this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]){if(this['channels'][_0x287324['uniqueid']][_0x0a9e('0x36')](_0x2791c5)){if(this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x56')]==_0x0a9e('0x5b')&&this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]][_0x2791c5][_0x0a9e('0x12')]){logger['info']('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x287324[_0x0a9e('0x26')],_0x2791c5);this['channels'][_0x287324[_0x0a9e('0x26')]][_0x2791c5]['agentcompleteAt']=moment()[_0x0a9e('0x33')]('YYYY-MM-DD\x20HH:mm:ss');}}}logger['debug'](_0x0a9e('0x7b'),_0x287324[_0x0a9e('0x26')],util['inspect'](_[_0x0a9e('0x7c')](this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]]),{'showHidden':![],'depth':null}));ami[_0x0a9e('0x1d')](_0x0a9e('0x7d'),_['values'](this['channels'][_0x287324[_0x0a9e('0x26')]]));delete this[_0x0a9e('0x8')][_0x287324[_0x0a9e('0x26')]];}if(this[_0x0a9e('0xb')][_0x287324[_0x0a9e('0x26')]]){delete this['variables'][_0x287324[_0x0a9e('0x26')]];}}}catch(_0xadce3d){logger['error'](_0x0a9e('0x7e'),_0x287324[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0xadce3d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x7f')]=function(_0x23b39e){try{if(this[_0x0a9e('0x1e')](_0x23b39e)){logger[_0x0a9e('0x23')](_0x0a9e('0x80'),_0x23b39e[_0x0a9e('0x26')],util['inspect'](_0x23b39e,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){for(var _0x2ada60 in this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]]){if(this['channels'][_0x23b39e['transfereeuniqueid']][_0x0a9e('0x36')](_0x2ada60)){if(_0x23b39e[_0x0a9e('0x82')]===_0x2ada60){logger[_0x0a9e('0x20')](_0x0a9e('0x83'),_0x23b39e[_0x0a9e('0x26')],this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x21')],_0x2ada60);var _0x3450ae=moment();this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x23b39e['transfereeuniqueid']][_0x2ada60][_0x0a9e('0x59')]=moment()[_0x0a9e('0x33')](_0x0a9e('0x27'));this['channels'][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60]['lastevent']=_0x0a9e('0x5a');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x5d')]=_0x3450ae[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]][_0x2ada60][_0x0a9e('0x37')],_0x0a9e('0x85'));}}}}if(this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x86')]]){var _0x248368=this['channels'][_0x23b39e['secondtransfereruniqueid']];this[_0x0a9e('0x8')][_0x23b39e['secondtransfereruniqueid']]=this[_0x0a9e('0x8')][_0x23b39e[_0x0a9e('0x81')]];this['channels'][_0x23b39e[_0x0a9e('0x81')]]=_0x248368;}}}catch(_0xe2b083){logger[_0x0a9e('0x50')](_0x0a9e('0x87'),_0x23b39e['uniqueid'],util[_0x0a9e('0x25')](_0xe2b083,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')][_0x0a9e('0x1b')]=function(_0x34a791){try{if(this['isNotNull'](_0x34a791)){logger[_0x0a9e('0x23')](_0x0a9e('0x88'),_0x34a791[_0x0a9e('0x26')],util['inspect'](_0x34a791,{'showHidden':![],'depth':null}));if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]]){for(var _0x17b29d in this['channels'][_0x34a791[_0x0a9e('0x81')]]){if(this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x0a9e('0x36')](_0x17b29d)){if(_0x34a791[_0x0a9e('0x89')]===_0x17b29d){logger['info'](_0x0a9e('0x8a'),_0x34a791[_0x0a9e('0x26')],this['channels'][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x21')],_0x17b29d);var _0x1f6f1c=moment();this['channels'][_0x34a791['transfereeuniqueid']][_0x17b29d]['agentcomplete']=!![];this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d]['agentcompleteAt']=_0x1f6f1c;this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x3d')]='complete';this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x56')]=_0x0a9e('0x5b');this[_0x0a9e('0x8')][_0x34a791[_0x0a9e('0x81')]][_0x17b29d][_0x0a9e('0x5d')]=_0x1f6f1c[_0x0a9e('0x84')](this[_0x0a9e('0x8')][_0x34a791['transfereeuniqueid']][_0x17b29d][_0x0a9e('0x37')],'seconds');}}}}}}catch(_0x138cf5){logger[_0x0a9e('0x50')](_0x0a9e('0x8b'),_0x34a791[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x138cf5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStart']=function(_0x1a0314){var _0x33da81='';try{if(this[_0x0a9e('0x1e')](_0x1a0314)){logger[_0x0a9e('0x23')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x1a0314,{'showHidden':![],'depth':null}));if(_0x1a0314[_0x0a9e('0x8c')]){_0x33da81=_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x1a0314[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0x33da81]){logger[_0x0a9e('0x20')](_0x0a9e('0x8f'),_0x1a0314['uniqueid'],_0x33da81);this[_0x0a9e('0xa')][_0x33da81][_0x0a9e('0x90')]=!![];}}}}catch(_0x2ff265){logger[_0x0a9e('0x50')](_0x0a9e('0x91'),_0x1a0314[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x2ff265,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x0a9e('0x1c')]['syncMusicOnHoldStop']=function(_0x3b581c){var _0xd2391='';try{if(this[_0x0a9e('0x1e')](_0x3b581c)){logger['debug'](_0x0a9e('0x92'),_0x3b581c[_0x0a9e('0x26')],util[_0x0a9e('0x25')](_0x3b581c,{'showHidden':![],'depth':null}));if(_0x3b581c[_0x0a9e('0x8c')]){_0xd2391=_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8d')](0x0,_0x3b581c[_0x0a9e('0x8c')][_0x0a9e('0x8e')]('-'));if(this[_0x0a9e('0xa')][_0xd2391]){logger[_0x0a9e('0x20')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x3b581c[_0x0a9e('0x26')],_0xd2391);this[_0x0a9e('0xa')][_0xd2391][_0x0a9e('0x90')]=![];}}}}catch(_0x3db98f){logger[_0x0a9e('0x50')](_0x0a9e('0x93'),_0x3b581c['uniqueid'],util[_0x0a9e('0x25')](_0x3db98f,{'showHidden':![],'depth':null}));}};module['exports']=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 5e36029..84c0586 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35a2=['[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','match','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','holdtime','connectedlinename','destinationchannel','toNumber','membername','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','diff','billableseconds','answertime','user:agentcomplete','resolve','undefined','isEmpty','getSettings','then','StopMixMonitor','catch','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','transferType','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','set','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','bind','syncNewExten','newchannel','syncNewChannel','newstate','varset','syncVarSet','syncHangup','newcallerid','syncNewCallerId','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','info','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','merge','context','from-sip','channel','exten','xcally-motion-preview','split','connectedlinenum','format','user:%s','name','accountcode','[%s][voiceCallReport][newcallerid]','linkedid','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','pick','keys','destconnectedlinenum','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)'];(function(_0x30c738,_0x325018){var _0x5e013b=function(_0x13f67a){while(--_0x13f67a){_0x30c738['push'](_0x30c738['shift']());}};_0x5e013b(++_0x325018);}(_0x35a2,0x72));var _0x235a=function(_0x4463cd,_0x4a686f){_0x4463cd=_0x4463cd-0x0;var _0x5e3a5e=_0x35a2[_0x4463cd];return _0x5e3a5e;};'use strict';var BPromise=require('bluebird');var _=require(_0x235a('0x0'));var moment=require(_0x235a('0x1'));var util=require(_0x235a('0x2'));var path=require(_0x235a('0x3'));var Redis=require(_0x235a('0x4'));var config=require(_0x235a('0x5'));var logger=require(_0x235a('0x6'))(_0x235a('0x7'));var ami=require(_0x235a('0x8'));var Channel=require(_0x235a('0x9'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0x235a('0xa'),_0x235a('0xb'),'inuse',_0x235a('0xc'),_0x235a('0xd'),_0x235a('0xe'),_0x235a('0xf'),_0x235a('0x10'),'onhold'];var applications=[_0x235a('0x11'),'queue',_0x235a('0x12'),_0x235a('0x13'),'playback',_0x235a('0x14')];var dispositions=[_0x235a('0x15'),_0x235a('0x16'),_0x235a('0x16'),'NO\x20ANSWER','NO\x20ANSWER',_0x235a('0x15'),_0x235a('0x17'),_0x235a('0x18'),_0x235a('0x16'),_0x235a('0x16'),_0x235a('0x16')];var actions={};config['redis']=_[_0x235a('0x19')](config[_0x235a('0x1a')],{'host':_0x235a('0x1b'),'port':0x18eb});var io=require(_0x235a('0x1c'))(new Redis(config[_0x235a('0x1a')]));function VoiceCallReport(_0x3ce96f){this['channels']=_0x3ce96f[_0x235a('0x1d')];this[_0x235a('0x1e')]=_0x3ce96f['agents'];this[_0x235a('0x1f')]={};ami['on']('coreshowchannel',this['syncNewExten'][_0x235a('0x20')](this));ami['on']('newexten',this[_0x235a('0x21')][_0x235a('0x20')](this));ami['on'](_0x235a('0x22'),this[_0x235a('0x23')][_0x235a('0x20')](this));ami['on'](_0x235a('0x24'),this['syncNewState'][_0x235a('0x20')](this));ami['on'](_0x235a('0x25'),this[_0x235a('0x26')][_0x235a('0x20')](this));ami['on']('hangup',this[_0x235a('0x27')][_0x235a('0x20')](this));ami['on'](_0x235a('0x28'),this[_0x235a('0x29')]['bind'](this));ami['on']('attendedtransfer',this[_0x235a('0x2a')][_0x235a('0x20')](this));ami['on'](_0x235a('0x2b'),this['syncBlindTransfer'][_0x235a('0x20')](this));ami['on'](_0x235a('0x2c'),this[_0x235a('0x2d')][_0x235a('0x20')](this));ami['on'](_0x235a('0x2e'),this['syncMusicOnHoldStop'][_0x235a('0x20')](this));try{logger['info'](_0x235a('0x2f'));ami[_0x235a('0x30')]();}catch(_0x12040c){logger[_0x235a('0x31')](_0x235a('0x32'),util[_0x235a('0x33')](_0x12040c,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x235a('0x34')]=function(_0x886dcf){return _0x886dcf!==null&&!_[_0x235a('0x35')](_0x886dcf);};VoiceCallReport[_0x235a('0x36')][_0x235a('0x37')]=function(_0x385ce8,_0x17c0ed,_0x2d33a3){io['to'](_0x385ce8)[_0x235a('0x37')](_0x17c0ed,_0x2d33a3);};VoiceCallReport['prototype'][_0x235a('0x29')]=function(_0x582810){try{if(this[_0x235a('0x34')](_0x582810)){logger[_0x235a('0x38')](_0x235a('0x39'),_0x582810[_0x235a('0x3a')],_0x582810[_0x235a('0x3b')],_0x582810[_0x235a('0x3c')]);logger[_0x235a('0x3d')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x582810['uniqueid'],util[_0x235a('0x33')](_0x582810,{'showHidden':![],'depth':null}));if(_0x582810['uniqueid']===_0x582810['linkedid']){if(!_[_0x235a('0x35')](this[_0x235a('0x1d')][_0x582810[_0x235a('0x3a')]])){_[_0x235a('0x3e')](this[_0x235a('0x1d')][_0x582810['uniqueid']],_['pick'](_0x582810,_['keys'](this[_0x235a('0x1d')][_0x582810[_0x235a('0x3a')]])));}}if(_0x582810[_0x235a('0x3f')]===_0x235a('0x40')){if(this[_0x235a('0x1e')][_0x582810[_0x235a('0x41')]['split']('-')[0x0]]){if(_0x582810[_0x235a('0x42')]==_0x235a('0x43')){this['agents'][_0x582810[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x582810[_0x235a('0x45')];this[_0x235a('0x37')](util[_0x235a('0x46')](_0x235a('0x47'),this['agents'][_0x582810[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]][_0x235a('0x48')]),'user:agentconnect',{'destaccountcode':this[_0x235a('0x1e')][_0x582810[_0x235a('0x41')]['split']('-')[0x0]][_0x235a('0x49')],'destconnectedlinenum':_0x582810[_0x235a('0x45')]});}}}}}catch(_0x478cc8){logger[_0x235a('0x31')](_0x235a('0x4a'),_0x582810[_0x235a('0x3a')],util[_0x235a('0x33')](_0x478cc8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')][_0x235a('0x23')]=function(_0x2a6440){try{if(this['isNotNull'](_0x2a6440)){logger['debug']('[%s][voiceCallReport][newchannel]\x20event:',_0x2a6440[_0x235a('0x3a')],util[_0x235a('0x33')](_0x2a6440,{'showHidden':![],'depth':null}));if(_0x2a6440[_0x235a('0x3a')]===_0x2a6440[_0x235a('0x4b')]&&_0x2a6440[_0x235a('0x41')]!=_0x235a('0x4c')){if(_[_0x235a('0x35')](this[_0x235a('0x1d')][_0x2a6440[_0x235a('0x3a')]])){logger[_0x235a('0x38')](_0x235a('0x4d'),_0x2a6440[_0x235a('0x3a')],_0x2a6440[_0x235a('0x3f')],_0x2a6440[_0x235a('0x42')]);this[_0x235a('0x1d')][_0x2a6440[_0x235a('0x3a')]]=new Channel();this['channels'][_0x2a6440[_0x235a('0x3a')]][_0x235a('0x4e')]=moment()['format'](_0x235a('0x4f'));this[_0x235a('0x1d')][_0x2a6440[_0x235a('0x3a')]][_0x235a('0x50')]=dispositions[_['toNumber'](_0x2a6440[_0x235a('0x51')])];_[_0x235a('0x3e')](this[_0x235a('0x1d')][_0x2a6440[_0x235a('0x3a')]],_[_0x235a('0x52')](_0x2a6440,_[_0x235a('0x53')](this[_0x235a('0x1d')][_0x2a6440[_0x235a('0x3a')]])));if(_0x2a6440[_0x235a('0x3f')]===_0x235a('0x40')){if(this[_0x235a('0x1e')][_0x2a6440[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]){if(_[_0x235a('0x35')](this[_0x235a('0x1e')][_0x2a6440[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]['destconnectedlinenum'])){this['agents'][_0x2a6440['channel'][_0x235a('0x44')]('-')[0x0]][_0x235a('0x54')]=_0x2a6440[_0x235a('0x42')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x2a6440[_0x235a('0x3a')],util[_0x235a('0x33')]({'destaccountcode':this[_0x235a('0x1e')][_0x2a6440[_0x235a('0x41')]['split']('-')[0x0]][_0x235a('0x49')],'destconnectedlinenum':_0x2a6440[_0x235a('0x42')]},{'showHidden':![],'depth':null}));this[_0x235a('0x37')](util['format'](_0x235a('0x47'),this[_0x235a('0x1e')][_0x2a6440[_0x235a('0x41')]['split']('-')[0x0]][_0x235a('0x48')]),_0x235a('0x55'),{'destaccountcode':this[_0x235a('0x1e')][_0x2a6440[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x2a6440[_0x235a('0x42')]});}}}}}}}catch(_0x4cb0bb){logger[_0x235a('0x31')]('[%s][voiceCallReport][newchannel]',_0x2a6440[_0x235a('0x3a')],util[_0x235a('0x33')](_0x4cb0bb,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')]['syncNewExten']=function(_0x517c77){try{if(this[_0x235a('0x34')](_0x517c77)){logger[_0x235a('0x3d')](_0x235a('0x56'),_0x517c77[_0x235a('0x3a')],util[_0x235a('0x33')](_0x517c77,{'showHidden':![],'depth':null}));if(_0x517c77[_0x235a('0x3a')]===_0x517c77[_0x235a('0x4b')]&&_0x517c77['exten']!='h'&&_0x517c77[_0x235a('0x41')]!=_0x235a('0x4c')){_0x517c77[_0x235a('0x57')]=_0x517c77[_0x235a('0x57')][_0x235a('0x58')]();_0x517c77[_0x235a('0x59')]=_0x517c77['appdata']&&_0x517c77[_0x235a('0x5a')][_0x235a('0x5b')](_0x235a('0x5c'))?_0x517c77[_0x235a('0x5a')]:(_0x517c77['appdata']||_0x517c77[_0x235a('0x59')])['toLowerCase']();logger[_0x235a('0x38')](_0x235a('0x5d'),_0x517c77[_0x235a('0x3a')],_0x517c77['application'],_0x517c77[_0x235a('0x59')]);if(_[_0x235a('0x35')](this[_0x235a('0x1d')][_0x517c77['uniqueid']])){this[_0x235a('0x1d')][_0x517c77[_0x235a('0x3a')]]=new Channel();this[_0x235a('0x1d')][_0x517c77[_0x235a('0x3a')]][_0x235a('0x4e')]=_0x517c77[_0x235a('0x5e')]?moment()[_0x235a('0x5f')](moment[_0x235a('0x5e')](_0x517c77[_0x235a('0x5e')])[_0x235a('0x60')](),'seconds')[_0x235a('0x46')](_0x235a('0x4f')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x517c77['uniqueid']][_0x235a('0x50')]=_0x235a('0x15');}_[_0x235a('0x3e')](this[_0x235a('0x1d')][_0x517c77['uniqueid']],_[_0x235a('0x52')](_0x517c77,_[_0x235a('0x53')](this[_0x235a('0x1d')][_0x517c77['uniqueid']])));if(_[_0x235a('0x61')](applications,_0x517c77[_0x235a('0x57')])){this[_0x235a('0x1d')][_0x517c77[_0x235a('0x3a')]][_0x235a('0x62')]=_0x517c77[_0x235a('0x57')];this[_0x235a('0x1d')][_0x517c77[_0x235a('0x3a')]][_0x235a('0x63')]=_0x517c77[_0x235a('0x59')];if(_0x517c77[_0x235a('0x57')]==='set'&&_[_0x235a('0x5b')](_0x517c77[_0x235a('0x59')][_0x235a('0x58')](),_0x235a('0x64'))){var _0x239afa=_0x517c77['applicationdata']['split']('=');var _0x470c78=_0x239afa[0x0]['toLowerCase']()[_0x235a('0x65')](/cdr\((.*)\)/);if(_0x470c78){this[_0x235a('0x1d')][_0x517c77[_0x235a('0x3a')]][_0x470c78[0x1]]=_0x239afa[0x1];}}else if(_0x517c77[_0x235a('0x57')]===_0x235a('0x66')){this[_0x235a('0x1d')][_0x517c77[_0x235a('0x3a')]][_0x235a('0x66')]=_0x517c77[_0x235a('0x59')][_0x235a('0x44')](',')[0x0];}}}}}catch(_0x5e62ff){logger[_0x235a('0x31')](_0x235a('0x67'),_0x517c77[_0x235a('0x3a')],util['inspect'](_0x5e62ff,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x235a('0x68')]=function(_0x48146a){try{if(this['isNotNull'](_0x48146a)){logger[_0x235a('0x38')](_0x235a('0x69'),_0x48146a[_0x235a('0x3a')],_0x48146a[_0x235a('0x4b')],_0x48146a[_0x235a('0x3b')],_0x48146a['calleridnum']);logger[_0x235a('0x3d')](_0x235a('0x6a'),_0x48146a['uniqueid'],util[_0x235a('0x33')](_0x48146a,{'showHidden':![],'depth':null}));if(_0x48146a[_0x235a('0x3a')]!==_0x48146a[_0x235a('0x4b')]){if(this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]]){if(_0x48146a[_0x235a('0x51')]==='6'){if(!this[_0x235a('0x1d')][_0x48146a['linkedid']]['answered']){var _0x4b0b81=moment();this['channels'][_0x48146a['linkedid']][_0x235a('0x6b')]=!![];this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]]['answertime']=_0x4b0b81[_0x235a('0x46')](_0x235a('0x4f'));if(this['channels'][_0x48146a['linkedid']][_0x235a('0x4e')]){this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]][_0x235a('0x6c')]=_0x4b0b81['diff'](this[_0x235a('0x1d')][_0x48146a['linkedid']][_0x235a('0x4e')],_0x235a('0x60'));}}this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]][_0x235a('0x4b')]=_0x48146a[_0x235a('0x3a')];if(_0x48146a[_0x235a('0x3c')]!==_0x235a('0x43')){this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]][_0x235a('0x45')]=_0x48146a[_0x235a('0x3c')];}this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]][_0x235a('0x6d')]=_0x48146a[_0x235a('0x3b')];this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]][_0x235a('0x6e')]=_0x48146a[_0x235a('0x41')];this['channels'][_0x48146a[_0x235a('0x4b')]][_0x235a('0x50')]=dispositions[_[_0x235a('0x6f')](_0x48146a[_0x235a('0x51')])];if(this[_0x235a('0x1e')][_0x48146a['channel']['split']('-')[0x0]]){this['channels'][_0x48146a['linkedid']]['UserId']=this[_0x235a('0x1e')][_0x48146a['channel'][_0x235a('0x44')]('-')[0x0]]['id'];this['channels'][_0x48146a[_0x235a('0x4b')]][_0x235a('0x70')]=this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]][_0x235a('0x48')];}}}}else{if(this[_0x235a('0x1d')][_0x48146a[_0x235a('0x3a')]]){if(_0x48146a[_0x235a('0x51')]==='6'){if(this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]){this['channels'][_0x48146a['uniqueid']]['UserId']=this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]['id'];this[_0x235a('0x1d')][_0x48146a[_0x235a('0x3a')]][_0x235a('0x70')]=this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]][_0x235a('0x48')];}}}}if(_0x48146a[_0x235a('0x51')]==='6'&&_0x48146a[_0x235a('0x3f')]===_0x235a('0x40')){if(this['agents'][_0x48146a['channel'][_0x235a('0x44')]('-')[0x0]]){this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]['destconnectedlinenum']=_0x48146a[_0x235a('0x42')];var _0x464dc6;if(this['channels'][_0x48146a['uniqueid']])_0x464dc6=this[_0x235a('0x1d')][_0x48146a[_0x235a('0x3a')]]['routealias'];else if(this[_0x235a('0x1d')][_0x48146a[_0x235a('0x4b')]])_0x464dc6=this['channels'][_0x48146a['linkedid']][_0x235a('0x71')];logger['debug'](_0x235a('0x72'),_0x48146a[_0x235a('0x3a')],util[_0x235a('0x33')]({'destaccountcode':this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]][_0x235a('0x49')],'destconnectedlinenum':_0x48146a[_0x235a('0x42')],'routealias':_0x464dc6},{'showHidden':![],'depth':null}));this['emit'](util[_0x235a('0x46')](_0x235a('0x47'),this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')]['split']('-')[0x0]][_0x235a('0x48')]),_0x235a('0x55'),{'destaccountcode':this[_0x235a('0x1e')][_0x48146a[_0x235a('0x41')]['split']('-')[0x0]][_0x235a('0x49')],'destconnectedlinenum':_0x48146a['exten'],'routealias':_0x464dc6});}}}}catch(_0x56169a){logger['error']('[%s][voiceCallReport][newstate]',_0x48146a['uniqueid'],util[_0x235a('0x33')](_0x56169a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')][_0x235a('0x73')]=function(_0x4b4ec4,_0x8ff9c7){try{if(this[_0x235a('0x1d')][_0x4b4ec4]){logger['info'](_0x235a('0x74'),_0x4b4ec4,_0x8ff9c7);this['channels'][_0x4b4ec4][_0x235a('0x75')]=!![];if(_[_0x235a('0x76')](_0x8ff9c7,_0x235a('0x77'))){_0x8ff9c7=_0x8ff9c7[_0x235a('0x78')](_0x235a('0x77'),_0x235a('0x79'));}this[_0x235a('0x1d')][_0x4b4ec4][_0x235a('0x7a')]=_0x8ff9c7;var _0x155808=_[_0x235a('0x7b')](this['channels'][_0x4b4ec4][_0x235a('0x7c')],{'filename':_0x8ff9c7});if(_['isNil'](_0x155808)){this[_0x235a('0x1d')][_0x4b4ec4][_0x235a('0x7c')]['push']({'filename':_0x8ff9c7,'createdAt':moment()[_0x235a('0x46')](_0x235a('0x4f')),'mixmonitorid':'','status':'rec'});}}}catch(_0x2da684){logger[_0x235a('0x31')](_0x235a('0x7d'),_0x4b4ec4,util[_0x235a('0x33')](_0x2da684,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')][_0x235a('0x26')]=function(_0x486756){try{if(this[_0x235a('0x34')](_0x486756)){logger[_0x235a('0x3d')](_0x235a('0x7e'),_0x486756[_0x235a('0x3a')],util[_0x235a('0x33')](_0x486756,{'showHidden':![],'depth':null}));if(this[_0x235a('0x1d')][_0x486756[_0x235a('0x3a')]]&&_0x486756[_0x235a('0x41')]!=_0x235a('0x4c')){if(this[_0x235a('0x34')](_0x486756['variable'])){if(this['isNotNull'](_0x486756[_0x235a('0x7f')][_0x235a('0x80')])){logger['info'](_0x235a('0x81'),_0x486756[_0x235a('0x3a')],_0x486756[_0x235a('0x82')]);this[_0x235a('0x73')](_0x486756[_0x235a('0x3a')],_0x486756[_0x235a('0x82')]);}else if(this[_0x235a('0x34')](_0x486756['variable'][_0x235a('0x83')])){logger['info'](_0x235a('0x84'),_0x486756['uniqueid'],_0x486756['value']);this[_0x235a('0x1d')][_0x486756['uniqueid']]['calleridnum']=_0x486756[_0x235a('0x82')];}else if(this[_0x235a('0x34')](_0x486756['variable']['xmd-callerid'])){logger['info'](_0x235a('0x85'),_0x486756['uniqueid'],_0x486756[_0x235a('0x82')]);this[_0x235a('0x1d')][_0x486756[_0x235a('0x3a')]]['callerid']=_0x486756[_0x235a('0x82')];}else if(this[_0x235a('0x34')](_0x486756[_0x235a('0x7f')]['xmd-cdrtype'])){logger['info'](_0x235a('0x86'),_0x486756[_0x235a('0x3a')],_0x486756[_0x235a('0x82')]);this[_0x235a('0x1d')][_0x486756[_0x235a('0x3a')]][_0x235a('0x87')]=_0x486756[_0x235a('0x82')];}else if(this[_0x235a('0x34')](_0x486756[_0x235a('0x7f')]['xmd-queue'])){logger[_0x235a('0x38')](_0x235a('0x88'),_0x486756[_0x235a('0x3a')],_0x486756[_0x235a('0x82')][_0x235a('0x44')](',')[0x0]);this[_0x235a('0x1d')][_0x486756[_0x235a('0x3a')]][_0x235a('0x66')]=_0x486756[_0x235a('0x82')][_0x235a('0x44')](',')[0x0];}else if(this[_0x235a('0x34')](_0x486756[_0x235a('0x7f')][_0x235a('0x89')])){logger[_0x235a('0x38')](_0x235a('0x8a'),_0x486756['uniqueid'],_0x486756[_0x235a('0x82')]);this['channels'][_0x486756[_0x235a('0x3a')]]['originatecalleridnum']=_0x486756[_0x235a('0x82')];}else if(this['isNotNull'](_0x486756[_0x235a('0x7f')][_0x235a('0x8b')])){logger[_0x235a('0x38')](_0x235a('0x8c'),_0x486756[_0x235a('0x3a')],_0x486756[_0x235a('0x82')]);this[_0x235a('0x1d')][_0x486756[_0x235a('0x3a')]][_0x235a('0x8d')]=_0x486756[_0x235a('0x82')];}else if(this[_0x235a('0x34')](_0x486756['variable'][_0x235a('0x8e')])){logger[_0x235a('0x38')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x486756[_0x235a('0x3a')],_0x486756[_0x235a('0x82')]);this['channels'][_0x486756[_0x235a('0x3a')]][_0x235a('0x8f')]=_0x486756[_0x235a('0x82')];}else if(this[_0x235a('0x34')](_0x486756[_0x235a('0x7f')][_0x235a('0x90')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x486756[_0x235a('0x3a')],_0x486756[_0x235a('0x82')]);this[_0x235a('0x1d')][_0x486756[_0x235a('0x3a')]]['queue']=_0x486756[_0x235a('0x82')];}else if(this[_0x235a('0x34')](_0x486756['variable'][_0x235a('0x91')])){logger['info'](_0x235a('0x92'),_0x486756['uniqueid'],_0x486756[_0x235a('0x82')]);this[_0x235a('0x1d')][_0x486756['uniqueid']][_0x235a('0x93')]=_0x486756['value'];}}}else if(this[_0x235a('0x34')](_0x486756[_0x235a('0x7f')]['mixmonitor_filename'])){if(_0x486756[_0x235a('0x82')]){var _0x4fc1c9=path['parse'](_0x486756[_0x235a('0x82')])['name'];logger[_0x235a('0x38')](_0x235a('0x81'),_0x4fc1c9,_0x486756['value']);this[_0x235a('0x73')](_0x4fc1c9,_0x486756[_0x235a('0x82')]);}}else if(this[_0x235a('0x1d')][_0x486756['linkedid']]){if(this[_0x235a('0x34')](_0x486756[_0x235a('0x7f')])){if(this[_0x235a('0x34')](_0x486756[_0x235a('0x7f')][_0x235a('0x91')])){logger[_0x235a('0x38')](_0x235a('0x92'),_0x486756[_0x235a('0x4b')],_0x486756[_0x235a('0x82')]);this[_0x235a('0x1d')][_0x486756['linkedid']][_0x235a('0x94')]=_0x486756['value'];}}}}}catch(_0x5278d9){logger[_0x235a('0x31')](_0x235a('0x95'),_0x486756[_0x235a('0x3a')],util[_0x235a('0x33')](_0x5278d9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')][_0x235a('0x27')]=function(_0x374276){try{if(this['isNotNull'](_0x374276)){logger[_0x235a('0x3d')](_0x235a('0x96'),_0x374276[_0x235a('0x3a')],util['inspect'](_0x374276,{'showHidden':![],'depth':null}));if(this[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]]){logger[_0x235a('0x38')](_0x235a('0x97'),_0x374276[_0x235a('0x3a')],_0x374276['cause-txt']);var _0x16ddce=moment();this[_0x235a('0x1d')][_0x374276['uniqueid']][_0x235a('0x98')]=_0x16ddce[_0x235a('0x46')](_0x235a('0x4f'));this[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]][_0x235a('0x5e')]=_0x16ddce[_0x235a('0x99')](this[_0x235a('0x1d')][_0x374276['uniqueid']][_0x235a('0x4e')],_0x235a('0x60'));if(this[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]][_0x235a('0x6b')]){this['channels'][_0x374276['uniqueid']][_0x235a('0x9a')]=_0x16ddce['diff'](this[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]][_0x235a('0x9b')],_0x235a('0x60'));this['channels'][_0x374276[_0x235a('0x3a')]]['holdtime']=this[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]][_0x235a('0x5e')]-this[_0x235a('0x1d')][_0x374276['uniqueid']][_0x235a('0x9a')];}if(_0x374276[_0x235a('0x3f')]==='from-sip'){if(this['agents'][_0x374276[_0x235a('0x41')]['split']('-')[0x0]]){this[_0x235a('0x1e')][_0x374276[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]=_['omit'](this[_0x235a('0x1e')][_0x374276[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]],[_0x235a('0x54')]);logger['debug']('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x374276[_0x235a('0x3a')],util[_0x235a('0x33')]({'id':this[_0x235a('0x1e')][_0x374276[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]]['id'],'destaccountcode':this[_0x235a('0x1e')][_0x374276['channel'][_0x235a('0x44')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x235a('0x37')](util[_0x235a('0x46')](_0x235a('0x47'),this[_0x235a('0x1e')][_0x374276[_0x235a('0x41')][_0x235a('0x44')]('-')[0x0]][_0x235a('0x48')]),_0x235a('0x9c'),{'id':this['agents'][_0x374276[_0x235a('0x41')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x374276[_0x235a('0x41')]['split']('-')[0x0]][_0x235a('0x49')]});}}var _0x18e9b1=this;Promise[_0x235a('0x9d')]()['then'](function(){var _0x4b7c8c=_0x18e9b1[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]];if(typeof _0x4b7c8c['transferType']===_0x235a('0x9e'))return;if(_[_0x235a('0x9f')](_0x4b7c8c[_0x235a('0x7c')]))return;return RpcSetting[_0x235a('0xa0')]()[_0x235a('0xa1')](function(_0x199679){if(!_0x199679['stopRecordingOnTransfer'])return;return Promise[_0x235a('0x9d')]()[_0x235a('0xa1')](function(){return ami['Action']({'action':_0x235a('0xa2'),'channel':_0x4b7c8c[_0x235a('0x41')]})[_0x235a('0xa3')](function(){});})['then'](function(){return ami['Action']({'action':'StopMixMonitor','channel':_0x4b7c8c[_0x235a('0x6e')]})[_0x235a('0xa3')](function(){})[_0x235a('0xa4')](function(){var _0x4c011e=_0x18e9b1[_0x235a('0x1e')][_0x4b7c8c[_0x235a('0x6e')][_0x235a('0x44')]('-')[0x0]];if(!_0x4c011e)return;io['emit'](_0x235a('0xa5'),{'agentId':_0x4c011e['id'],'uniqueid':_0x4b7c8c['uniqueid']});});});});})['then'](function(){if(_0x374276[_0x235a('0xa6')]===_0x235a('0xa7')){_0x18e9b1[_0x235a('0x1f')][_0x374276['uniqueid']]=_0x18e9b1[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]];}else{if(_0x18e9b1[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]][_0x235a('0x87')]===_0x235a('0xa8')&&_0x18e9b1[_0x235a('0x1f')][_0x374276[_0x235a('0x3a')]]){_0x18e9b1[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]][_0x235a('0x3a')]=[_0x18e9b1[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]]['linkedid'],_0x18e9b1[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]]['linkedid']=_0x18e9b1[_0x235a('0x1d')][_0x374276['uniqueid']][_0x235a('0x3a')]][0x0];delete _0x18e9b1[_0x235a('0x1f')][_0x374276[_0x235a('0x3a')]];}}logger[_0x235a('0x3d')](_0x235a('0xa9'),_0x374276[_0x235a('0x3a')],util['inspect'](_0x18e9b1[_0x235a('0x1d')][_0x374276[_0x235a('0x3a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x235a('0xaa'),_0x18e9b1[_0x235a('0x1d')][_0x374276['uniqueid']]);delete _0x18e9b1['channels'][_0x374276['uniqueid']];});}}}catch(_0x1b4e7a){logger[_0x235a('0x31')](_0x235a('0xab'),_0x374276['uniqueid'],util[_0x235a('0x33')](_0x1b4e7a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')]['syncAttendedTransfer']=function(_0x27de1a){try{if(this[_0x235a('0x34')](_0x27de1a)){logger[_0x235a('0x38')](_0x235a('0xac'),_0x27de1a[_0x235a('0x3a')],_0x27de1a[_0x235a('0xad')],_0x27de1a[_0x235a('0xae')]);logger['debug'](_0x235a('0xaf'),_0x27de1a[_0x235a('0x3a')],util[_0x235a('0x33')](_0x27de1a,{'showHidden':![],'depth':null}));if(this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb0')]]){this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb0')]][_0x235a('0xb1')]=_0x27de1a[_0x235a('0xad')];this['channels'][_0x27de1a[_0x235a('0xb0')]]['transferconnectedlinenum']=_0x27de1a['transfertargetcalleridnum'];if(this['channels'][_0x27de1a['secondtransfereruniqueid']]){var _0xa7eae=this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb2')]];this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb2')]]=this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb0')]];this['channels'][_0x27de1a['transfereeuniqueid']]=_0xa7eae;}}else if(this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb3')]]){this['channels'][_0x27de1a[_0x235a('0xb3')]][_0x235a('0xb1')]=_0x27de1a[_0x235a('0xad')];this['channels'][_0x27de1a['transfertargetuniqueid']][_0x235a('0xb4')]=_0x27de1a['transfertargetcalleridnum'];if(this['channels'][_0x27de1a[_0x235a('0xb5')]]){var _0xa7eae=this[_0x235a('0x1d')][_0x27de1a['origtransfereruniqueid']];this[_0x235a('0x1d')][_0x27de1a['origtransfereruniqueid']]=this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb3')]];this[_0x235a('0x1d')][_0x27de1a['transfertargetuniqueid']]=_0xa7eae;}}if((this['channels'][_0x27de1a['origtransfereruniqueid']]||this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb6')]])&&this['channels'][_0x27de1a['secondtransfereruniqueid']]){var _0x5842ed=_[_0x235a('0xb7')]([this['channels'][_0x27de1a[_0x235a('0xb5')]],this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb6')]],this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb2')]]],function(_0x2f16de){return _0x2f16de&&_0x2f16de[_0x235a('0x87')]==='outbound'&&_0x2f16de[_0x235a('0xb8')];});if(_0x5842ed){if(this[_0x235a('0x1d')][_0x27de1a['origtransfereruniqueid']])this['channels'][_0x27de1a['origtransfereruniqueid']]['transferType']=_0x235a('0xb9');if(this[_0x235a('0x1d')][_0x27de1a[_0x235a('0xb6')]])this['channels'][_0x27de1a[_0x235a('0xb6')]][_0x235a('0xba')]=_0x235a('0xb9');this['channels'][_0x27de1a['secondtransfereruniqueid']]['transferType']=_0x235a('0xb9');}}}}catch(_0x4ac735){logger['error'](_0x235a('0xbb'),_0x27de1a[_0x235a('0x3a')],util[_0x235a('0x33')](_0x4ac735,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')][_0x235a('0xbc')]=function(_0x2a844f){try{if(this['isNotNull'](_0x2a844f)){logger[_0x235a('0x38')](_0x235a('0xbd'),_0x2a844f[_0x235a('0x3a')],_0x2a844f[_0x235a('0xbe')],_0x2a844f[_0x235a('0xbf')]);logger['debug'](_0x235a('0xc0'),_0x2a844f['uniqueid'],util['inspect'](_0x2a844f,{'showHidden':![],'depth':null}));if(this[_0x235a('0x1d')][_0x2a844f[_0x235a('0xb0')]]){this[_0x235a('0x1d')][_0x2a844f[_0x235a('0xb0')]][_0x235a('0xb1')]=_0x2a844f[_0x235a('0xbe')];this[_0x235a('0x1d')][_0x2a844f[_0x235a('0xb0')]]['transferconnectedlinenum']=_0x2a844f['extension'];this[_0x235a('0x1d')][_0x2a844f['transfereeuniqueid']][_0x235a('0xba')]=_0x235a('0xc1');this[_0x235a('0x27')]({'event':_0x235a('0xa7'),'uniqueid':_0x2a844f['transfereeuniqueid'],'context':_0x2a844f[_0x235a('0x3f')],'channel':_0x2a844f[_0x235a('0xc2')]});}else{this['channels'][_0x2a844f[_0x235a('0xc3')]][_0x235a('0xba')]=_0x235a('0xc1');}}}catch(_0x34039d){logger['error'](_0x235a('0xc4'),_0x2a844f[_0x235a('0x3a')],util[_0x235a('0x33')](_0x34039d,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x235a('0x2d')]=function(_0x4ae113){try{if(this[_0x235a('0x34')](_0x4ae113)){logger['debug']('[%s][voiceCallReport][musiconholdstart]\x20event:',_0x4ae113['uniqueid'],util[_0x235a('0x33')](_0x4ae113,{'showHidden':![],'depth':null}));if(this[_0x235a('0x1d')][_0x4ae113[_0x235a('0x3a')]]){if(!_[_0x235a('0xc5')](this[_0x235a('0x1d')][_0x4ae113[_0x235a('0x3a')]][_0x235a('0x9b')])){this[_0x235a('0x1d')][_0x4ae113[_0x235a('0x3a')]][_0x235a('0xc6')]=moment()[_0x235a('0x46')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x235a('0x38')](_0x235a('0xc7'),_0x4ae113['uniqueid'],this['channels'][_0x4ae113['uniqueid']][_0x235a('0xc6')]);}}}}catch(_0x6a77){logger[_0x235a('0x31')](_0x235a('0xc8'),_0x4ae113['uniqueid'],util[_0x235a('0x33')](_0x6a77,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x235a('0x36')]['syncMusicOnHoldStop']=function(_0x5b697c){try{if(this[_0x235a('0x34')](_0x5b697c)){logger[_0x235a('0x3d')](_0x235a('0xc9'),_0x5b697c['uniqueid'],util[_0x235a('0x33')](_0x5b697c,{'showHidden':![],'depth':null}));if(this[_0x235a('0x1d')][_0x5b697c[_0x235a('0x3a')]]){if(!_[_0x235a('0xc5')](this['channels'][_0x5b697c['uniqueid']][_0x235a('0xc6')])){this[_0x235a('0x1d')][_0x5b697c[_0x235a('0x3a')]][_0x235a('0xca')]+=moment()[_0x235a('0xcb')](0x0)[_0x235a('0x99')](this['channels'][_0x5b697c[_0x235a('0x3a')]][_0x235a('0xc6')],_0x235a('0x60'));logger['info'](_0x235a('0xcc'),_0x5b697c[_0x235a('0x3a')],this[_0x235a('0x1d')][_0x5b697c['uniqueid']][_0x235a('0xca')]);delete this['channels'][_0x5b697c[_0x235a('0x3a')]][_0x235a('0xc6')];}}}}catch(_0x44ec43){logger[_0x235a('0x31')](_0x235a('0xcd'),_0x5b697c[_0x235a('0x3a')],util[_0x235a('0x33')](_0x44ec43,{'showHidden':![],'depth':null}));}};module[_0x235a('0xce')]=VoiceCallReport; \ No newline at end of file +var _0x1cda=['extension','BLIND','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','moment','util','ioredis','../../../config/environment','ami','../model/channel','unknown','not_inuse','inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','defaults','localhost','socket.io-emitter','channels','agents','syncNewExten','bind','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','prototype','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','pick','context','from-sip','split','xcally-motion-preview','channel','destconnectedlinenum','connectedlinenum','format','user:%s','accountcode','inspect','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','info','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','merge','keys','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','appdata','startsWith','toLowerCase','applicationdata','starttime','duration','seconds','includes','lastapplication','lastdata','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','diff','connectedlinename','destinationchannel','disposition','UserId','membername','routealias','user:agentconnect','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','endsWith','replace','.wav49','.WAV','monitorFilename','find','monitors','isNil','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','answertime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','then','transferType','undefined','isEmpty','stopRecordingOnTransfer','resolve','StopMixMonitor','Action','catch','finally','event','BlindTransfer','outbound','blindTransfers','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:'];(function(_0x271b38,_0x4d3993){var _0x86a919=function(_0x505010){while(--_0x505010){_0x271b38['push'](_0x271b38['shift']());}};_0x86a919(++_0x4d3993);}(_0x1cda,0xe3));var _0xa1cd=function(_0x3e49db,_0xfa4de5){_0x3e49db=_0x3e49db-0x0;var _0x3739c4=_0x1cda[_0x3e49db];return _0x3739c4;};'use strict';var BPromise=require(_0xa1cd('0x0'));var _=require(_0xa1cd('0x1'));var moment=require(_0xa1cd('0x2'));var util=require(_0xa1cd('0x3'));var path=require('path');var Redis=require(_0xa1cd('0x4'));var config=require(_0xa1cd('0x5'));var logger=require('../../../config/logger')(_0xa1cd('0x6'));var ami=require('../ami');var Channel=require(_0xa1cd('0x7'));var RpcSetting=require('../rpc/setting');var statusDesc=[_0xa1cd('0x8'),_0xa1cd('0x9'),_0xa1cd('0xa'),_0xa1cd('0xb'),_0xa1cd('0xc'),_0xa1cd('0xd'),_0xa1cd('0xe'),_0xa1cd('0xf'),_0xa1cd('0x10')];var applications=[_0xa1cd('0x11'),_0xa1cd('0x12'),_0xa1cd('0x13'),_0xa1cd('0x14'),'playback',_0xa1cd('0x15')];var dispositions=[_0xa1cd('0x16'),_0xa1cd('0x17'),_0xa1cd('0x17'),'NO\x20ANSWER',_0xa1cd('0x16'),_0xa1cd('0x16'),'ANSWERED',_0xa1cd('0x18'),_0xa1cd('0x17'),_0xa1cd('0x17'),_0xa1cd('0x17')];var actions={};config[_0xa1cd('0x19')]=_[_0xa1cd('0x1a')](config[_0xa1cd('0x19')],{'host':_0xa1cd('0x1b'),'port':0x18eb});var io=require(_0xa1cd('0x1c'))(new Redis(config['redis']));function VoiceCallReport(_0x4af0d2){this['channels']=_0x4af0d2[_0xa1cd('0x1d')];this[_0xa1cd('0x1e')]=_0x4af0d2[_0xa1cd('0x1e')];this['blindTransfers']={};ami['on']('coreshowchannel',this[_0xa1cd('0x1f')][_0xa1cd('0x20')](this));ami['on']('newexten',this[_0xa1cd('0x1f')]['bind'](this));ami['on']('newchannel',this[_0xa1cd('0x21')]['bind'](this));ami['on'](_0xa1cd('0x22'),this[_0xa1cd('0x23')]['bind'](this));ami['on'](_0xa1cd('0x24'),this[_0xa1cd('0x25')][_0xa1cd('0x20')](this));ami['on'](_0xa1cd('0x26'),this[_0xa1cd('0x27')][_0xa1cd('0x20')](this));ami['on'](_0xa1cd('0x28'),this[_0xa1cd('0x29')][_0xa1cd('0x20')](this));ami['on'](_0xa1cd('0x2a'),this[_0xa1cd('0x2b')][_0xa1cd('0x20')](this));ami['on'](_0xa1cd('0x2c'),this[_0xa1cd('0x2d')][_0xa1cd('0x20')](this));ami['on'](_0xa1cd('0x2e'),this['syncMusicOnHoldStart'][_0xa1cd('0x20')](this));ami['on']('musiconholdstop',this['syncMusicOnHoldStop'][_0xa1cd('0x20')](this));try{logger['info']('[voiceCallReport][coreshowchannels]\x20started');ami[_0xa1cd('0x2f')]();}catch(_0x259f37){logger[_0xa1cd('0x30')](_0xa1cd('0x31'),util['inspect'](_0x259f37,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xa1cd('0x32')]['isNotNull']=function(_0x562330){return _0x562330!==null&&!_[_0xa1cd('0x33')](_0x562330);};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0x34')]=function(_0x4994c4,_0x1b0cdb,_0x5775fe){io['to'](_0x4994c4)[_0xa1cd('0x34')](_0x1b0cdb,_0x5775fe);};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0x29')]=function(_0x424844){try{if(this['isNotNull'](_0x424844)){logger['info'](_0xa1cd('0x35'),_0x424844[_0xa1cd('0x36')],_0x424844['calleridname'],_0x424844[_0xa1cd('0x37')]);logger[_0xa1cd('0x38')](_0xa1cd('0x39'),_0x424844[_0xa1cd('0x36')],util['inspect'](_0x424844,{'showHidden':![],'depth':null}));if(_0x424844[_0xa1cd('0x36')]===_0x424844[_0xa1cd('0x3a')]){if(!_[_0xa1cd('0x33')](this['channels'][_0x424844[_0xa1cd('0x36')]])){_['merge'](this['channels'][_0x424844[_0xa1cd('0x36')]],_[_0xa1cd('0x3b')](_0x424844,_['keys'](this[_0xa1cd('0x1d')][_0x424844['uniqueid']])));}}if(_0x424844[_0xa1cd('0x3c')]===_0xa1cd('0x3d')){if(this[_0xa1cd('0x1e')][_0x424844['channel'][_0xa1cd('0x3e')]('-')[0x0]]){if(_0x424844['exten']==_0xa1cd('0x3f')){this[_0xa1cd('0x1e')][_0x424844[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x41')]=_0x424844[_0xa1cd('0x42')];this[_0xa1cd('0x34')](util[_0xa1cd('0x43')](_0xa1cd('0x44'),this[_0xa1cd('0x1e')][_0x424844['channel'][_0xa1cd('0x3e')]('-')[0x0]]['name']),'user:agentconnect',{'destaccountcode':this[_0xa1cd('0x1e')][_0x424844[_0xa1cd('0x40')]['split']('-')[0x0]][_0xa1cd('0x45')],'destconnectedlinenum':_0x424844['connectedlinenum']});}}}}}catch(_0xaf9d6b){logger[_0xa1cd('0x30')]('[%s][voiceCallReport][newcallerid]',_0x424844['uniqueid'],util[_0xa1cd('0x46')](_0xaf9d6b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0x21')]=function(_0x573373){try{if(this[_0xa1cd('0x47')](_0x573373)){logger['debug'](_0xa1cd('0x48'),_0x573373[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x573373,{'showHidden':![],'depth':null}));if(_0x573373[_0xa1cd('0x36')]===_0x573373[_0xa1cd('0x3a')]&&_0x573373[_0xa1cd('0x40')]!=_0xa1cd('0x49')){if(_[_0xa1cd('0x33')](this[_0xa1cd('0x1d')][_0x573373['uniqueid']])){logger[_0xa1cd('0x4a')](_0xa1cd('0x4b'),_0x573373[_0xa1cd('0x36')],_0x573373['context'],_0x573373[_0xa1cd('0x4c')]);this['channels'][_0x573373['uniqueid']]=new Channel();this['channels'][_0x573373[_0xa1cd('0x36')]]['starttime']=moment()[_0xa1cd('0x43')](_0xa1cd('0x4d'));this[_0xa1cd('0x1d')][_0x573373[_0xa1cd('0x36')]]['disposition']=dispositions[_[_0xa1cd('0x4e')](_0x573373[_0xa1cd('0x4f')])];_[_0xa1cd('0x50')](this[_0xa1cd('0x1d')][_0x573373[_0xa1cd('0x36')]],_[_0xa1cd('0x3b')](_0x573373,_[_0xa1cd('0x51')](this[_0xa1cd('0x1d')][_0x573373[_0xa1cd('0x36')]])));if(_0x573373[_0xa1cd('0x3c')]===_0xa1cd('0x3d')){if(this[_0xa1cd('0x1e')][_0x573373['channel'][_0xa1cd('0x3e')]('-')[0x0]]){if(_['isUndefined'](this['agents'][_0x573373[_0xa1cd('0x40')]['split']('-')[0x0]][_0xa1cd('0x41')])){this[_0xa1cd('0x1e')][_0x573373[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x41')]=_0x573373[_0xa1cd('0x4c')];logger[_0xa1cd('0x38')](_0xa1cd('0x52'),_0x573373[_0xa1cd('0x36')],util[_0xa1cd('0x46')]({'destaccountcode':this['agents'][_0x573373[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x45')],'destconnectedlinenum':_0x573373[_0xa1cd('0x4c')]},{'showHidden':![],'depth':null}));this[_0xa1cd('0x34')](util[_0xa1cd('0x43')]('user:%s',this['agents'][_0x573373['channel'][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x53')]),'user:agentconnect',{'destaccountcode':this['agents'][_0x573373[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x45')],'destconnectedlinenum':_0x573373[_0xa1cd('0x4c')]});}}}}}}}catch(_0x21f6da){logger['error'](_0xa1cd('0x54'),_0x573373[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x21f6da,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa1cd('0x1f')]=function(_0x202c48){try{if(this[_0xa1cd('0x47')](_0x202c48)){logger['debug'](_0xa1cd('0x55'),_0x202c48[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x202c48,{'showHidden':![],'depth':null}));if(_0x202c48[_0xa1cd('0x36')]===_0x202c48['linkedid']&&_0x202c48[_0xa1cd('0x4c')]!='h'&&_0x202c48['channel']!=_0xa1cd('0x49')){_0x202c48[_0xa1cd('0x56')]=_0x202c48[_0xa1cd('0x56')]['toLowerCase']();_0x202c48['applicationdata']=_0x202c48[_0xa1cd('0x57')]&&_0x202c48[_0xa1cd('0x57')][_0xa1cd('0x58')]('CDR(routeAlias)')?_0x202c48[_0xa1cd('0x57')]:(_0x202c48[_0xa1cd('0x57')]||_0x202c48['applicationdata'])[_0xa1cd('0x59')]();logger['info']('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x202c48['uniqueid'],_0x202c48[_0xa1cd('0x56')],_0x202c48[_0xa1cd('0x5a')]);if(_[_0xa1cd('0x33')](this[_0xa1cd('0x1d')][_0x202c48[_0xa1cd('0x36')]])){this['channels'][_0x202c48[_0xa1cd('0x36')]]=new Channel();this['channels'][_0x202c48[_0xa1cd('0x36')]][_0xa1cd('0x5b')]=_0x202c48[_0xa1cd('0x5c')]?moment()['subtract'](moment[_0xa1cd('0x5c')](_0x202c48[_0xa1cd('0x5c')])[_0xa1cd('0x5d')](),_0xa1cd('0x5d'))[_0xa1cd('0x43')](_0xa1cd('0x4d')):moment()[_0xa1cd('0x43')](_0xa1cd('0x4d'));this[_0xa1cd('0x1d')][_0x202c48['uniqueid']]['disposition']='NO\x20ANSWER';}_[_0xa1cd('0x50')](this[_0xa1cd('0x1d')][_0x202c48[_0xa1cd('0x36')]],_[_0xa1cd('0x3b')](_0x202c48,_[_0xa1cd('0x51')](this[_0xa1cd('0x1d')][_0x202c48[_0xa1cd('0x36')]])));if(_[_0xa1cd('0x5e')](applications,_0x202c48[_0xa1cd('0x56')])){this['channels'][_0x202c48[_0xa1cd('0x36')]][_0xa1cd('0x5f')]=_0x202c48[_0xa1cd('0x56')];this['channels'][_0x202c48['uniqueid']][_0xa1cd('0x60')]=_0x202c48[_0xa1cd('0x5a')];if(_0x202c48[_0xa1cd('0x56')]===_0xa1cd('0x11')&&_[_0xa1cd('0x58')](_0x202c48[_0xa1cd('0x5a')][_0xa1cd('0x59')](),_0xa1cd('0x61'))){var _0x352356=_0x202c48[_0xa1cd('0x5a')][_0xa1cd('0x3e')]('=');var _0x2867a5=_0x352356[0x0][_0xa1cd('0x59')]()[_0xa1cd('0x62')](/cdr\((.*)\)/);if(_0x2867a5){this[_0xa1cd('0x1d')][_0x202c48[_0xa1cd('0x36')]][_0x2867a5[0x1]]=_0x352356[0x1];}}else if(_0x202c48[_0xa1cd('0x56')]==='queue'){this[_0xa1cd('0x1d')][_0x202c48[_0xa1cd('0x36')]]['queue']=_0x202c48[_0xa1cd('0x5a')]['split'](',')[0x0];}}}}}catch(_0x4eeac2){logger[_0xa1cd('0x30')](_0xa1cd('0x63'),_0x202c48[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x4eeac2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0x23')]=function(_0x4e1f1d){try{if(this['isNotNull'](_0x4e1f1d)){logger[_0xa1cd('0x4a')](_0xa1cd('0x64'),_0x4e1f1d[_0xa1cd('0x36')],_0x4e1f1d[_0xa1cd('0x3a')],_0x4e1f1d[_0xa1cd('0x65')],_0x4e1f1d['calleridnum']);logger[_0xa1cd('0x38')](_0xa1cd('0x66'),_0x4e1f1d['uniqueid'],util[_0xa1cd('0x46')](_0x4e1f1d,{'showHidden':![],'depth':null}));if(_0x4e1f1d[_0xa1cd('0x36')]!==_0x4e1f1d[_0xa1cd('0x3a')]){if(this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]]){if(_0x4e1f1d[_0xa1cd('0x4f')]==='6'){if(!this['channels'][_0x4e1f1d['linkedid']][_0xa1cd('0x67')]){var _0x4caa85=moment();this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]]['answered']=!![];this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]]['answertime']=_0x4caa85['format'](_0xa1cd('0x4d'));if(this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]][_0xa1cd('0x5b')]){this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]]['holdtime']=_0x4caa85[_0xa1cd('0x68')](this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]]['starttime'],'seconds');}}this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]][_0xa1cd('0x3a')]=_0x4e1f1d[_0xa1cd('0x36')];if(_0x4e1f1d[_0xa1cd('0x37')]!=='xcally-motion-preview'){this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]][_0xa1cd('0x42')]=_0x4e1f1d[_0xa1cd('0x37')];}this['channels'][_0x4e1f1d[_0xa1cd('0x3a')]][_0xa1cd('0x69')]=_0x4e1f1d[_0xa1cd('0x65')];this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]][_0xa1cd('0x6a')]=_0x4e1f1d[_0xa1cd('0x40')];this['channels'][_0x4e1f1d[_0xa1cd('0x3a')]][_0xa1cd('0x6b')]=dispositions[_[_0xa1cd('0x4e')](_0x4e1f1d[_0xa1cd('0x4f')])];if(this[_0xa1cd('0x1e')][_0x4e1f1d['channel'][_0xa1cd('0x3e')]('-')[0x0]]){this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]]['UserId']=this['agents'][_0x4e1f1d['channel'][_0xa1cd('0x3e')]('-')[0x0]]['id'];this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]]['membername']=this[_0xa1cd('0x1e')][_0x4e1f1d[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x53')];}}}}else{if(this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x36')]]){if(_0x4e1f1d['channelstate']==='6'){if(this['agents'][_0x4e1f1d[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]]){this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x36')]][_0xa1cd('0x6c')]=this[_0xa1cd('0x1e')][_0x4e1f1d[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]]['id'];this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x36')]][_0xa1cd('0x6d')]=this[_0xa1cd('0x1e')][_0x4e1f1d[_0xa1cd('0x40')]['split']('-')[0x0]][_0xa1cd('0x53')];}}}}if(_0x4e1f1d['channelstate']==='6'&&_0x4e1f1d[_0xa1cd('0x3c')]===_0xa1cd('0x3d')){if(this[_0xa1cd('0x1e')][_0x4e1f1d['channel'][_0xa1cd('0x3e')]('-')[0x0]]){this['agents'][_0x4e1f1d[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x41')]=_0x4e1f1d['exten'];var _0x5816ee;if(this[_0xa1cd('0x1d')][_0x4e1f1d['uniqueid']])_0x5816ee=this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x36')]][_0xa1cd('0x6e')];else if(this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]])_0x5816ee=this[_0xa1cd('0x1d')][_0x4e1f1d[_0xa1cd('0x3a')]][_0xa1cd('0x6e')];logger['debug']('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x4e1f1d[_0xa1cd('0x36')],util[_0xa1cd('0x46')]({'destaccountcode':this[_0xa1cd('0x1e')][_0x4e1f1d[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x45')],'destconnectedlinenum':_0x4e1f1d[_0xa1cd('0x4c')],'routealias':_0x5816ee},{'showHidden':![],'depth':null}));this[_0xa1cd('0x34')](util[_0xa1cd('0x43')](_0xa1cd('0x44'),this[_0xa1cd('0x1e')][_0x4e1f1d[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x53')]),_0xa1cd('0x6f'),{'destaccountcode':this[_0xa1cd('0x1e')][_0x4e1f1d[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x45')],'destconnectedlinenum':_0x4e1f1d[_0xa1cd('0x4c')],'routealias':_0x5816ee});}}}}catch(_0x3b8546){logger[_0xa1cd('0x30')](_0xa1cd('0x70'),_0x4e1f1d[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x3b8546,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0x71')]=function(_0x4b6619,_0x2767ea){try{if(this[_0xa1cd('0x1d')][_0x4b6619]){logger[_0xa1cd('0x4a')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x4b6619,_0x2767ea);this[_0xa1cd('0x1d')][_0x4b6619]['monitor']=!![];if(_[_0xa1cd('0x72')](_0x2767ea,'.wav49')){_0x2767ea=_0x2767ea[_0xa1cd('0x73')](_0xa1cd('0x74'),_0xa1cd('0x75'));}this['channels'][_0x4b6619][_0xa1cd('0x76')]=_0x2767ea;var _0x197718=_[_0xa1cd('0x77')](this[_0xa1cd('0x1d')][_0x4b6619][_0xa1cd('0x78')],{'filename':_0x2767ea});if(_[_0xa1cd('0x79')](_0x197718)){this['channels'][_0x4b6619][_0xa1cd('0x78')][_0xa1cd('0x7a')]({'filename':_0x2767ea,'createdAt':moment()[_0xa1cd('0x43')](_0xa1cd('0x4d')),'mixmonitorid':'','status':_0xa1cd('0x7b')});}}}catch(_0x4d83c7){logger[_0xa1cd('0x30')](_0xa1cd('0x7c'),_0x4b6619,util[_0xa1cd('0x46')](_0x4d83c7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa1cd('0x32')]['syncVarSet']=function(_0x3f02db){try{if(this[_0xa1cd('0x47')](_0x3f02db)){logger['debug'](_0xa1cd('0x7d'),_0x3f02db[_0xa1cd('0x36')],util['inspect'](_0x3f02db,{'showHidden':![],'depth':null}));if(this[_0xa1cd('0x1d')][_0x3f02db[_0xa1cd('0x36')]]&&_0x3f02db[_0xa1cd('0x40')]!=_0xa1cd('0x49')){if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')])){if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x7f')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x80'),_0x3f02db[_0xa1cd('0x36')],_0x3f02db['value']);this[_0xa1cd('0x71')](_0x3f02db[_0xa1cd('0x36')],_0x3f02db[_0xa1cd('0x81')]);}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x82')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x83'),_0x3f02db['uniqueid'],_0x3f02db[_0xa1cd('0x81')]);this[_0xa1cd('0x1d')][_0x3f02db[_0xa1cd('0x36')]][_0xa1cd('0x37')]=_0x3f02db['value'];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x84')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x85'),_0x3f02db[_0xa1cd('0x36')],_0x3f02db['value']);this['channels'][_0x3f02db[_0xa1cd('0x36')]]['callerid']=_0x3f02db[_0xa1cd('0x81')];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x86')])){logger['info'](_0xa1cd('0x87'),_0x3f02db[_0xa1cd('0x36')],_0x3f02db[_0xa1cd('0x81')]);this[_0xa1cd('0x1d')][_0x3f02db[_0xa1cd('0x36')]][_0xa1cd('0x88')]=_0x3f02db[_0xa1cd('0x81')];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x89')])){logger['info'](_0xa1cd('0x8a'),_0x3f02db['uniqueid'],_0x3f02db['value'][_0xa1cd('0x3e')](',')[0x0]);this[_0xa1cd('0x1d')][_0x3f02db[_0xa1cd('0x36')]][_0xa1cd('0x12')]=_0x3f02db['value'][_0xa1cd('0x3e')](',')[0x0];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x8b')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x8c'),_0x3f02db['uniqueid'],_0x3f02db[_0xa1cd('0x81')]);this[_0xa1cd('0x1d')][_0x3f02db[_0xa1cd('0x36')]][_0xa1cd('0x8d')]=_0x3f02db['value'];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x8e')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x8f'),_0x3f02db[_0xa1cd('0x36')],_0x3f02db[_0xa1cd('0x81')]);this[_0xa1cd('0x1d')][_0x3f02db['uniqueid']]['destination']=_0x3f02db[_0xa1cd('0x81')];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x90')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x91'),_0x3f02db['uniqueid'],_0x3f02db[_0xa1cd('0x81')]);this['channels'][_0x3f02db[_0xa1cd('0x36')]]['calleridpreview']=_0x3f02db['value'];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x92')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x93'),_0x3f02db[_0xa1cd('0x36')],_0x3f02db['value']);this[_0xa1cd('0x1d')][_0x3f02db[_0xa1cd('0x36')]][_0xa1cd('0x12')]=_0x3f02db[_0xa1cd('0x81')];}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x94')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x95'),_0x3f02db[_0xa1cd('0x36')],_0x3f02db[_0xa1cd('0x81')]);this[_0xa1cd('0x1d')][_0x3f02db['uniqueid']][_0xa1cd('0x96')]=_0x3f02db[_0xa1cd('0x81')];}}}else if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x7f')])){if(_0x3f02db['value']){var _0x370c78=path[_0xa1cd('0x97')](_0x3f02db[_0xa1cd('0x81')])[_0xa1cd('0x53')];logger[_0xa1cd('0x4a')](_0xa1cd('0x80'),_0x370c78,_0x3f02db['value']);this[_0xa1cd('0x71')](_0x370c78,_0x3f02db[_0xa1cd('0x81')]);}}else if(this[_0xa1cd('0x1d')][_0x3f02db[_0xa1cd('0x3a')]]){if(this[_0xa1cd('0x47')](_0x3f02db['variable'])){if(this[_0xa1cd('0x47')](_0x3f02db[_0xa1cd('0x7e')][_0xa1cd('0x94')])){logger[_0xa1cd('0x4a')](_0xa1cd('0x95'),_0x3f02db[_0xa1cd('0x3a')],_0x3f02db['value']);this['channels'][_0x3f02db[_0xa1cd('0x3a')]][_0xa1cd('0x98')]=_0x3f02db['value'];}}}}}catch(_0x1dc91e){logger[_0xa1cd('0x30')](_0xa1cd('0x99'),_0x3f02db[_0xa1cd('0x36')],util['inspect'](_0x1dc91e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0x27')]=function(_0x10873a){try{if(this[_0xa1cd('0x47')](_0x10873a)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x10873a['uniqueid'],util[_0xa1cd('0x46')](_0x10873a,{'showHidden':![],'depth':null}));if(this[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]]){logger[_0xa1cd('0x4a')](_0xa1cd('0x9a'),_0x10873a[_0xa1cd('0x36')],_0x10873a[_0xa1cd('0x9b')]);var _0x1c427b=moment();this['channels'][_0x10873a[_0xa1cd('0x36')]]['endtime']=_0x1c427b[_0xa1cd('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa1cd('0x1d')][_0x10873a['uniqueid']][_0xa1cd('0x5c')]=_0x1c427b['diff'](this['channels'][_0x10873a[_0xa1cd('0x36')]][_0xa1cd('0x5b')],_0xa1cd('0x5d'));if(this[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]][_0xa1cd('0x67')]){this[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]]['billableseconds']=_0x1c427b[_0xa1cd('0x68')](this['channels'][_0x10873a[_0xa1cd('0x36')]][_0xa1cd('0x9c')],_0xa1cd('0x5d'));this[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]]['holdtime']=this['channels'][_0x10873a[_0xa1cd('0x36')]][_0xa1cd('0x5c')]-this[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]][_0xa1cd('0x9d')];}if(_0x10873a[_0xa1cd('0x3c')]===_0xa1cd('0x3d')){if(this[_0xa1cd('0x1e')][_0x10873a[_0xa1cd('0x40')]['split']('-')[0x0]]){this['agents'][_0x10873a[_0xa1cd('0x40')]['split']('-')[0x0]]=_[_0xa1cd('0x9e')](this[_0xa1cd('0x1e')][_0x10873a[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]],['destconnectedlinenum']);logger[_0xa1cd('0x38')](_0xa1cd('0x9f'),_0x10873a[_0xa1cd('0x36')],util[_0xa1cd('0x46')]({'id':this['agents'][_0x10873a[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x10873a['channel'][_0xa1cd('0x3e')]('-')[0x0]][_0xa1cd('0x45')]},{'showHidden':![],'depth':null}));this[_0xa1cd('0x34')](util['format'](_0xa1cd('0x44'),this['agents'][_0x10873a[_0xa1cd('0x40')][_0xa1cd('0x3e')]('-')[0x0]]['name']),_0xa1cd('0xa0'),{'id':this[_0xa1cd('0x1e')][_0x10873a['channel'][_0xa1cd('0x3e')]('-')[0x0]]['id'],'destaccountcode':this[_0xa1cd('0x1e')][_0x10873a[_0xa1cd('0x40')]['split']('-')[0x0]][_0xa1cd('0x45')]});}}var _0x31ae01=this;Promise['resolve']()[_0xa1cd('0xa1')](function(){var _0x42f65e=_0x31ae01[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]];if(typeof _0x42f65e[_0xa1cd('0xa2')]===_0xa1cd('0xa3'))return;if(_[_0xa1cd('0xa4')](_0x42f65e['monitors']))return;return RpcSetting['getSettings']()[_0xa1cd('0xa1')](function(_0x5849f2){if(!_0x5849f2[_0xa1cd('0xa5')])return;return Promise[_0xa1cd('0xa6')]()['then'](function(){return ami['Action']({'action':_0xa1cd('0xa7'),'channel':_0x42f65e['channel']})['catch'](function(){});})[_0xa1cd('0xa1')](function(){return ami[_0xa1cd('0xa8')]({'action':_0xa1cd('0xa7'),'channel':_0x42f65e[_0xa1cd('0x6a')]})[_0xa1cd('0xa9')](function(){})[_0xa1cd('0xaa')](function(){var _0x38ce22=_0x31ae01[_0xa1cd('0x1e')][_0x42f65e[_0xa1cd('0x6a')][_0xa1cd('0x3e')]('-')[0x0]];if(!_0x38ce22)return;io[_0xa1cd('0x34')]('webbar:stopmonitors',{'agentId':_0x38ce22['id'],'uniqueid':_0x42f65e['uniqueid']});});});});})[_0xa1cd('0xa1')](function(){if(_0x10873a[_0xa1cd('0xab')]===_0xa1cd('0xac')){_0x31ae01['blindTransfers'][_0x10873a['uniqueid']]=_0x31ae01[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]];}else{if(_0x31ae01[_0xa1cd('0x1d')][_0x10873a['uniqueid']]['type']===_0xa1cd('0xad')&&_0x31ae01[_0xa1cd('0xae')][_0x10873a['uniqueid']]){_0x31ae01[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]][_0xa1cd('0x36')]=[_0x31ae01[_0xa1cd('0x1d')][_0x10873a[_0xa1cd('0x36')]][_0xa1cd('0x3a')],_0x31ae01[_0xa1cd('0x1d')][_0x10873a['uniqueid']]['linkedid']=_0x31ae01['channels'][_0x10873a['uniqueid']][_0xa1cd('0x36')]][0x0];delete _0x31ae01[_0xa1cd('0xae')][_0x10873a[_0xa1cd('0x36')]];}}logger[_0xa1cd('0x38')](_0xa1cd('0xaf'),_0x10873a[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x31ae01['channels'][_0x10873a[_0xa1cd('0x36')]],{'showHidden':![],'depth':null}));ami[_0xa1cd('0x34')](_0xa1cd('0xb0'),_0x31ae01[_0xa1cd('0x1d')][_0x10873a['uniqueid']]);delete _0x31ae01[_0xa1cd('0x1d')][_0x10873a['uniqueid']];});}}}catch(_0x1ebd5f){logger[_0xa1cd('0x30')](_0xa1cd('0xb1'),_0x10873a[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x1ebd5f,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa1cd('0x2b')]=function(_0x5d7347){try{if(this[_0xa1cd('0x47')](_0x5d7347)){logger[_0xa1cd('0x4a')](_0xa1cd('0xb2'),_0x5d7347[_0xa1cd('0x36')],_0x5d7347[_0xa1cd('0xb3')],_0x5d7347[_0xa1cd('0xb4')]);logger['debug'](_0xa1cd('0xb5'),_0x5d7347[_0xa1cd('0x36')],util['inspect'](_0x5d7347,{'showHidden':![],'depth':null}));if(this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xb6')]]){this['channels'][_0x5d7347['transfereeuniqueid']][_0xa1cd('0xb7')]=_0x5d7347['origtransferercalleridnum'];this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xb6')]][_0xa1cd('0xb8')]=_0x5d7347['transfertargetcalleridnum'];if(this[_0xa1cd('0x1d')][_0x5d7347['secondtransfereruniqueid']]){var _0x42a09b=this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xb9')]];this['channels'][_0x5d7347[_0xa1cd('0xb9')]]=this['channels'][_0x5d7347[_0xa1cd('0xb6')]];this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xb6')]]=_0x42a09b;}}else if(this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xba')]]){this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xba')]][_0xa1cd('0xb7')]=_0x5d7347[_0xa1cd('0xb3')];this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xba')]][_0xa1cd('0xb8')]=_0x5d7347[_0xa1cd('0xb4')];if(this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbb')]]){var _0x42a09b=this[_0xa1cd('0x1d')][_0x5d7347['origtransfereruniqueid']];this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbb')]]=this['channels'][_0x5d7347[_0xa1cd('0xba')]];this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xba')]]=_0x42a09b;}}if((this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbb')]]||this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbc')]])&&this['channels'][_0x5d7347[_0xa1cd('0xb9')]]){var _0x3795e3=_[_0xa1cd('0xbd')]([this[_0xa1cd('0x1d')][_0x5d7347['origtransfereruniqueid']],this['channels'][_0x5d7347[_0xa1cd('0xbc')]],this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xb9')]]],function(_0x901146){return _0x901146&&_0x901146[_0xa1cd('0x88')]===_0xa1cd('0xad')&&_0x901146[_0xa1cd('0xbe')];});if(_0x3795e3){if(this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbb')]])this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbb')]]['transferType']='ATTENDED';if(this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbc')]])this[_0xa1cd('0x1d')][_0x5d7347[_0xa1cd('0xbc')]][_0xa1cd('0xa2')]=_0xa1cd('0xbf');this['channels'][_0x5d7347['secondtransfereruniqueid']][_0xa1cd('0xa2')]=_0xa1cd('0xbf');}}}}catch(_0x32747b){logger[_0xa1cd('0x30')]('[%s][voiceCallReport][attendedtransfer]',_0x5d7347[_0xa1cd('0x36')],util['inspect'](_0x32747b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0x2d')]=function(_0x30fc57){try{if(this['isNotNull'](_0x30fc57)){logger[_0xa1cd('0x4a')](_0xa1cd('0xc0'),_0x30fc57[_0xa1cd('0x36')],_0x30fc57[_0xa1cd('0xc1')],_0x30fc57['extension']);logger['debug'](_0xa1cd('0xc2'),_0x30fc57[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x30fc57,{'showHidden':![],'depth':null}));if(this[_0xa1cd('0x1d')][_0x30fc57['transfereeuniqueid']]){this[_0xa1cd('0x1d')][_0x30fc57[_0xa1cd('0xb6')]][_0xa1cd('0xb7')]=_0x30fc57[_0xa1cd('0xc1')];this[_0xa1cd('0x1d')][_0x30fc57['transfereeuniqueid']][_0xa1cd('0xb8')]=_0x30fc57[_0xa1cd('0xc3')];this[_0xa1cd('0x1d')][_0x30fc57[_0xa1cd('0xb6')]]['transferType']=_0xa1cd('0xc4');this[_0xa1cd('0x27')]({'event':_0xa1cd('0xac'),'uniqueid':_0x30fc57[_0xa1cd('0xb6')],'context':_0x30fc57[_0xa1cd('0x3c')],'channel':_0x30fc57['transfererchannel']});}else{this[_0xa1cd('0x1d')][_0x30fc57[_0xa1cd('0xc5')]][_0xa1cd('0xa2')]=_0xa1cd('0xc4');}}}catch(_0x366f16){logger[_0xa1cd('0x30')](_0xa1cd('0xc6'),_0x30fc57['uniqueid'],util['inspect'](_0x366f16,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xa1cd('0x32')][_0xa1cd('0xc7')]=function(_0x5f4cc5){try{if(this[_0xa1cd('0x47')](_0x5f4cc5)){logger[_0xa1cd('0x38')](_0xa1cd('0xc8'),_0x5f4cc5[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x5f4cc5,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f4cc5[_0xa1cd('0x36')]]){if(!_[_0xa1cd('0x79')](this[_0xa1cd('0x1d')][_0x5f4cc5[_0xa1cd('0x36')]]['answertime'])){this[_0xa1cd('0x1d')][_0x5f4cc5[_0xa1cd('0x36')]][_0xa1cd('0xc9')]=moment()[_0xa1cd('0x43')](_0xa1cd('0x4d'));logger[_0xa1cd('0x4a')](_0xa1cd('0xca'),_0x5f4cc5[_0xa1cd('0x36')],this[_0xa1cd('0x1d')][_0x5f4cc5['uniqueid']][_0xa1cd('0xc9')]);}}}}catch(_0x5dd908){logger[_0xa1cd('0x30')](_0xa1cd('0xcb'),_0x5f4cc5[_0xa1cd('0x36')],util['inspect'](_0x5dd908,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xa1cd('0xcc')]=function(_0x1338ab){try{if(this[_0xa1cd('0x47')](_0x1338ab)){logger[_0xa1cd('0x38')](_0xa1cd('0xcd'),_0x1338ab[_0xa1cd('0x36')],util[_0xa1cd('0x46')](_0x1338ab,{'showHidden':![],'depth':null}));if(this[_0xa1cd('0x1d')][_0x1338ab[_0xa1cd('0x36')]]){if(!_['isNil'](this['channels'][_0x1338ab[_0xa1cd('0x36')]][_0xa1cd('0xc9')])){this[_0xa1cd('0x1d')][_0x1338ab['uniqueid']][_0xa1cd('0xce')]+=moment()[_0xa1cd('0xcf')](0x0)[_0xa1cd('0x68')](this[_0xa1cd('0x1d')][_0x1338ab[_0xa1cd('0x36')]][_0xa1cd('0xc9')],_0xa1cd('0x5d'));logger['info'](_0xa1cd('0xd0'),_0x1338ab[_0xa1cd('0x36')],this[_0xa1cd('0x1d')][_0x1338ab[_0xa1cd('0x36')]][_0xa1cd('0xce')]);delete this[_0xa1cd('0x1d')][_0x1338ab['uniqueid']][_0xa1cd('0xc9')];}}}}catch(_0x1ba56c){logger[_0xa1cd('0x30')](_0xa1cd('0xd1'),_0x1338ab[_0xa1cd('0x36')],util['inspect'](_0x1ba56c,{'showHidden':![],'depth':null}));}};module[_0xa1cd('0xd2')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 3ab1ff2..5a278e4 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1b4c=['syncVarSet','syncNewExten','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','merge','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','seconds','complete','total','answered','holdtime','sumHoldTime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','applicationdata','appdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','match','exports','lodash','ioredis','../../../config/environment','localhost','socket.io-emitter','redis','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset'];(function(_0xce5dc,_0x17ae4b){var _0x2e96a6=function(_0xbb58f){while(--_0xbb58f){_0xce5dc['push'](_0xce5dc['shift']());}};_0x2e96a6(++_0x17ae4b);}(_0x1b4c,0x1c7));var _0xc1b4=function(_0x17d389,_0x2f85bf){_0x17d389=_0x17d389-0x0;var _0x28a0c4=_0x1b4c[_0x17d389];return _0x28a0c4;};'use strict';var _=require(_0xc1b4('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0xc1b4('0x1'));var config=require(_0xc1b4('0x2'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config['redis']=_['defaults'](config['redis'],{'host':_0xc1b4('0x3'),'port':0x18eb});var io=require(_0xc1b4('0x4'))(new Redis(config[_0xc1b4('0x5')]));function VoiceDialReport(_0x5ede30){this[_0xc1b4('0x6')]=_0x5ede30[_0xc1b4('0x7')];this['outbound']=_0x5ede30[_0xc1b4('0x8')];this[_0xc1b4('0x9')]={};this[_0xc1b4('0xa')]={};ami['on'](_0xc1b4('0xb'),this[_0xc1b4('0xc')][_0xc1b4('0xd')](this));ami['on'](_0xc1b4('0xe'),this[_0xc1b4('0xf')][_0xc1b4('0xd')](this));ami['on'](_0xc1b4('0x10'),this[_0xc1b4('0x11')][_0xc1b4('0xd')](this));ami['on']('newexten',this[_0xc1b4('0x12')][_0xc1b4('0xd')](this));ami['on']('hangup',this[_0xc1b4('0x13')][_0xc1b4('0xd')](this));}VoiceDialReport[_0xc1b4('0x14')][_0xc1b4('0x15')]=function(_0x23e252){return _0x23e252!==null&&!_[_0xc1b4('0x16')](_0x23e252);};VoiceDialReport[_0xc1b4('0x14')][_0xc1b4('0x17')]=function(_0x2e0bdd,_0x4f8491,_0x3a8cd2){io['to'](_0x2e0bdd)[_0xc1b4('0x17')](_0x4f8491,_0x3a8cd2);};VoiceDialReport[_0xc1b4('0x14')]['syncDialBegin']=function(_0x43a964){try{if(this[_0xc1b4('0x15')](_0x43a964)){logger[_0xc1b4('0x18')](_0xc1b4('0x19'),_0x43a964[_0xc1b4('0x1a')],util[_0xc1b4('0x1b')](_0x43a964,{'showHidden':![],'depth':null}));if(this['channels'][_0x43a964[_0xc1b4('0x1a')]]){_['merge'](this['channels'][_0x43a964[_0xc1b4('0x1a')]],{'starttime':moment()['format'](_0xc1b4('0x1c')),'lastevent':_0xc1b4('0x1d'),'interface':_0x43a964[_0xc1b4('0x1e')][_0xc1b4('0x1f')](0x0,_0x43a964[_0xc1b4('0x1e')][_0xc1b4('0x20')]('-')),'membername':_0x43a964[_0xc1b4('0x1e')][_0xc1b4('0x1f')](_0x43a964[_0xc1b4('0x1e')][_0xc1b4('0x20')]('/')+0x1,_0x43a964[_0xc1b4('0x1e')][_0xc1b4('0x20')]('-'))},_[_0xc1b4('0x21')](_0x43a964,[_0xc1b4('0x22'),_0xc1b4('0x23')]));logger[_0xc1b4('0x24')](_0xc1b4('0x25'),_0x43a964[_0xc1b4('0x1a')],this[_0xc1b4('0x6')][_0x43a964[_0xc1b4('0x1a')]][_0xc1b4('0x26')],this[_0xc1b4('0x6')][_0x43a964[_0xc1b4('0x1a')]][_0xc1b4('0x27')]);logger[_0xc1b4('0x18')](_0xc1b4('0x28'),_0x43a964['uniqueid'],util[_0xc1b4('0x1b')](this[_0xc1b4('0x6')][_0x43a964[_0xc1b4('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xc1b4('0x9')][_0x43a964[_0xc1b4('0x1a')]])_[_0xc1b4('0x29')](this['channels'][_0x43a964[_0xc1b4('0x1a')]],this[_0xc1b4('0x9')][_0x43a964[_0xc1b4('0x1a')]]);this[_0xc1b4('0x17')](_0xc1b4('0x2a'),_0xc1b4('0x2b'),this['channels'][_0x43a964['uniqueid']]);logger[_0xc1b4('0x18')](_0xc1b4('0x2c'),_0x43a964['uniqueid'],util[_0xc1b4('0x1b')](this[_0xc1b4('0x6')][_0x43a964['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xc1b4('0x17')](_0xc1b4('0x2d'),this[_0xc1b4('0x6')][_0x43a964[_0xc1b4('0x1a')]]);}}}catch(_0x3c034e){logger[_0xc1b4('0x2e')](_0xc1b4('0x2f'),_0x43a964['uniqueid'],util[_0xc1b4('0x1b')](_0x3c034e,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xc1b4('0xf')]=function(_0x4d9fac){try{if(this[_0xc1b4('0x15')](_0x4d9fac)){logger[_0xc1b4('0x18')](_0xc1b4('0x30'),_0x4d9fac[_0xc1b4('0x1a')],util['inspect'](_0x4d9fac,{'showHidden':![],'depth':null}));if(this['channels'][_0x4d9fac[_0xc1b4('0x1a')]]){this[_0xc1b4('0x6')][_0x4d9fac[_0xc1b4('0x1a')]]['dialstatus']=_0x4d9fac[_0xc1b4('0x31')];if(_0x4d9fac[_0xc1b4('0x31')]===_0xc1b4('0x32')){this['channels'][_0x4d9fac[_0xc1b4('0x1a')]][_0xc1b4('0x33')]=_0x4d9fac[_0xc1b4('0x33')];this[_0xc1b4('0x6')][_0x4d9fac[_0xc1b4('0x1a')]]['connectedlinename']=_0x4d9fac[_0xc1b4('0x34')];this[_0xc1b4('0x6')][_0x4d9fac[_0xc1b4('0x1a')]][_0xc1b4('0x35')]=moment()[_0xc1b4('0x36')](_0xc1b4('0x1c'));this[_0xc1b4('0x6')][_0x4d9fac['uniqueid']][_0xc1b4('0x37')]=_0xc1b4('0x38');logger['info']('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x4d9fac['uniqueid'],_0x4d9fac[_0xc1b4('0x1e')]['substring'](_0x4d9fac[_0xc1b4('0x1e')][_0xc1b4('0x20')]('/')+0x1,_0x4d9fac[_0xc1b4('0x1e')][_0xc1b4('0x20')]('-')));logger['debug'](_0xc1b4('0x39'),_0x4d9fac['uniqueid'],util[_0xc1b4('0x1b')](this[_0xc1b4('0x6')][_0x4d9fac[_0xc1b4('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xc1b4('0x17')](_0xc1b4('0x3a'),this[_0xc1b4('0x6')][_0x4d9fac['uniqueid']]);}logger['debug'](_0xc1b4('0x3b'),_0x4d9fac[_0xc1b4('0x1a')],util[_0xc1b4('0x1b')](this['channels'][_0x4d9fac['uniqueid']],{'showHidden':![],'depth':null}));this[_0xc1b4('0x17')](_0xc1b4('0x2a'),'voice_outbound_channel:save',this[_0xc1b4('0x6')][_0x4d9fac[_0xc1b4('0x1a')]]);}}}catch(_0x38f223){logger[_0xc1b4('0x2e')](_0xc1b4('0x3c'),_0x4d9fac['uniqueid'],util['inspect'](_0x38f223,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc1b4('0x14')][_0xc1b4('0x11')]=function(_0x43ae7f){try{if(this[_0xc1b4('0x15')](_0x43ae7f)){logger['debug'](_0xc1b4('0x3d'),_0x43ae7f[_0xc1b4('0x1a')],util[_0xc1b4('0x1b')](_0x43ae7f,{'showHidden':![],'depth':null}));this[_0xc1b4('0x3e')](_0x43ae7f['uniqueid'],_[_0xc1b4('0x3f')](_0x43ae7f[_0xc1b4('0x40')])[0x0],_0x43ae7f[_0xc1b4('0x41')]);if(this[_0xc1b4('0x15')](_0x43ae7f[_0xc1b4('0x40')])&&this['isNotNull'](_0x43ae7f[_0xc1b4('0x40')][_0xc1b4('0x42')])){if(_[_0xc1b4('0x16')](this[_0xc1b4('0x6')][_0x43ae7f[_0xc1b4('0x1a')]])){this[_0xc1b4('0x6')][_0x43ae7f[_0xc1b4('0x1a')]]={'routeId':_0x43ae7f['value'],'variables':this[_0xc1b4('0xa')][_0x43ae7f[_0xc1b4('0x1a')]]};logger['info'](_0xc1b4('0x43'),_0x43ae7f[_0xc1b4('0x1a')],_0x43ae7f[_0xc1b4('0x40')][_0xc1b4('0x42')],_['keys'](_0x43ae7f[_0xc1b4('0x40')])[0x0],_0x43ae7f[_0xc1b4('0x41')]);logger[_0xc1b4('0x18')](_0xc1b4('0x44'),_0x43ae7f[_0xc1b4('0x1a')],util[_0xc1b4('0x1b')](this[_0xc1b4('0x6')][_0x43ae7f[_0xc1b4('0x1a')]],{'showHidden':![],'depth':null}));this[_0xc1b4('0x17')](_0xc1b4('0x2a'),'voice_outbound_channel:save',this[_0xc1b4('0x6')][_0x43ae7f[_0xc1b4('0x1a')]]);}}}}catch(_0x15fdb9){logger[_0xc1b4('0x2e')](_0xc1b4('0x45'),_0x43ae7f['uniqueid'],util['inspect'](_0x15fdb9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc1b4('0x14')][_0xc1b4('0x3e')]=function(_0x174f2d,_0x20e448,_0x3da50d){var _0xbad16d=[_0xc1b4('0x46'),'rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss',_0xc1b4('0x47'),_0xc1b4('0x48'),_0xc1b4('0x49'),_0xc1b4('0x4a'),'sipuri',_0xc1b4('0x4b'),_0xc1b4('0x4c'),_0xc1b4('0x4d'),'memberdynamic',_0xc1b4('0x4e'),_0xc1b4('0x4f'),'membername',_0xc1b4('0x50'),_0xc1b4('0x51')];if(!_[_0xc1b4('0x52')](_0x20e448)&&!_[_0xc1b4('0x53')](_0xbad16d,_0x20e448)){if(_['isUndefined'](this['variables'][_0x174f2d])){this[_0xc1b4('0xa')][_0x174f2d]={};}this[_0xc1b4('0xa')][_0x174f2d][_0x20e448]=_0x3da50d;}};VoiceDialReport[_0xc1b4('0x14')][_0xc1b4('0x13')]=function(_0x42f273){try{if(this[_0xc1b4('0x15')](_0x42f273)){logger[_0xc1b4('0x18')](_0xc1b4('0x54'),_0x42f273['uniqueid'],util['inspect'](_0x42f273,{'showHidden':![],'depth':null}));if(this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]]){logger[_0xc1b4('0x24')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x42f273[_0xc1b4('0x1a')],_0x42f273[_0xc1b4('0x55')]);this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x56')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x57')]=moment(this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x56')])[_0xc1b4('0x58')](this['channels'][_0x42f273[_0xc1b4('0x1a')]]['starttime'],_0xc1b4('0x59'));this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x37')]=_0xc1b4('0x5a');this[_0xc1b4('0x8')][_0xc1b4('0x5b')]+=0x1;if(this[_0xc1b4('0x6')][_0x42f273['uniqueid']][_0xc1b4('0x35')]){this['outbound'][_0xc1b4('0x5c')]+=0x1;this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x5d')]=moment(this[_0xc1b4('0x6')][_0x42f273['uniqueid']][_0xc1b4('0x35')])[_0xc1b4('0x58')](this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]]['starttime'],'seconds');this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]]['billableseconds']=moment(this[_0xc1b4('0x6')][_0x42f273['uniqueid']][_0xc1b4('0x56')])[_0xc1b4('0x58')](this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x35')],'seconds');this['outbound'][_0xc1b4('0x5e')]+=this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x5d')]||0x0;this[_0xc1b4('0x8')][_0xc1b4('0x5f')]+=this['channels'][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x60')];}this[_0xc1b4('0x8')][_0xc1b4('0x61')]+=this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]][_0xc1b4('0x57')];logger[_0xc1b4('0x18')](_0xc1b4('0x62'),_0x42f273[_0xc1b4('0x1a')],util[_0xc1b4('0x1b')](this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xc1b4('0x63'),this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]]);logger[_0xc1b4('0x18')](_0xc1b4('0x64'),_0x42f273['uniqueid'],util[_0xc1b4('0x1b')](this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0xc1b4('0x65'),this['channels'][_0x42f273[_0xc1b4('0x1a')]]);logger['debug'](_0xc1b4('0x66'),_0x42f273[_0xc1b4('0x1a')],util['inspect'](this[_0xc1b4('0x6')][_0x42f273['uniqueid']],{'showHidden':![],'depth':null}));this[_0xc1b4('0x17')](_0xc1b4('0x2a'),'voice_outbound:save',this['outbound']);logger[_0xc1b4('0x24')](_0xc1b4('0x67'),JSON['stringify'](this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]]));logger[_0xc1b4('0x18')](_0xc1b4('0x68'),_0x42f273[_0xc1b4('0x1a')],util['inspect'](this['channels'][_0x42f273[_0xc1b4('0x1a')]],{'showHidden':![],'depth':null}));this[_0xc1b4('0x17')]('voice:outbound',_0xc1b4('0x69'),this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]]);delete this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x1a')]];}else if(this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x6a')]]){this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x6a')]][_0xc1b4('0x1a')]=this[_0xc1b4('0x6')][_0x42f273[_0xc1b4('0x6a')]][_0xc1b4('0x6b')];}if(this[_0xc1b4('0xa')][_0x42f273[_0xc1b4('0x1a')]]){delete this[_0xc1b4('0xa')][_0x42f273[_0xc1b4('0x1a')]];}}}catch(_0x4dafac){logger['error']('[%s][voiceDialReport][hangup]',_0x42f273[_0xc1b4('0x1a')],util[_0xc1b4('0x1b')](_0x4dafac,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xc1b4('0x14')][_0xc1b4('0x12')]=function(_0x3dae19){try{if(this[_0xc1b4('0x15')](_0x3dae19)){logger[_0xc1b4('0x18')](_0xc1b4('0x6c'),_0x3dae19['uniqueid'],util['inspect'](_0x3dae19,{'showHidden':![],'depth':null}));if(_0x3dae19['application'][_0xc1b4('0x6d')]()===_0xc1b4('0x6e')){_0x3dae19[_0xc1b4('0x6f')]=(_0x3dae19[_0xc1b4('0x70')]||_0x3dae19[_0xc1b4('0x6f')])[_0xc1b4('0x6d')]();if(_['startsWith'](_0x3dae19[_0xc1b4('0x6f')],_0xc1b4('0x71'))){if(_[_0xc1b4('0x16')](this[_0xc1b4('0x9')][_0x3dae19[_0xc1b4('0x1a')]]))this[_0xc1b4('0x9')][_0x3dae19[_0xc1b4('0x1a')]]={};logger['info'](_0xc1b4('0x72'),_0x3dae19[_0xc1b4('0x1a')],_0x3dae19[_0xc1b4('0x73')],_0x3dae19[_0xc1b4('0x6f')]);var _0x1bfe45=_0x3dae19[_0xc1b4('0x6f')]['split']('=');var _0x2efbbf=_0x1bfe45[0x0][_0xc1b4('0x74')](/cdr\((.*)\)/);if(_0x2efbbf)this[_0xc1b4('0x9')][_0x3dae19['uniqueid']][_0x2efbbf[0x1]]=_0x1bfe45[0x1];}}}}catch(_0x14b010){logger[_0xc1b4('0x2e')]('[%s][voiceDialReport][newexten]',_0x3dae19[_0xc1b4('0x1a')],util[_0xc1b4('0x1b')](_0x14b010,{'showHidden':![],'depth':null}));}};module[_0xc1b4('0x75')]=VoiceDialReport; \ No newline at end of file +var _0x08f2=['voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','split','match','exports','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','localhost','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','varset','syncVarSet','bind','newexten','hangup','prototype','isNotNull','isUndefined','emit','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','substring','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','membername','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','diff','starttime','seconds','complete','total','holdtime','billableseconds','endtime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:'];(function(_0x5645b8,_0x56bf75){var _0x1105e7=function(_0x5c4886){while(--_0x5c4886){_0x5645b8['push'](_0x5645b8['shift']());}};_0x1105e7(++_0x56bf75);}(_0x08f2,0x1e9));var _0x208f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x08f2[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x208f('0x0'));var util=require('util');var Redis=require(_0x208f('0x1'));var config=require(_0x208f('0x2'));var logger=require(_0x208f('0x3'))('ami');var ami=require(_0x208f('0x4'));config[_0x208f('0x5')]=_['defaults'](config['redis'],{'host':_0x208f('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x208f('0x5')]));function VoiceDialReport(_0x5ed0df){this['channels']=_0x5ed0df[_0x208f('0x7')];this[_0x208f('0x8')]=_0x5ed0df[_0x208f('0x8')];this[_0x208f('0x9')]={};this[_0x208f('0xa')]={};ami['on'](_0x208f('0xb'),this[_0x208f('0xc')]['bind'](this));ami['on'](_0x208f('0xd'),this[_0x208f('0xe')]['bind'](this));ami['on'](_0x208f('0xf'),this[_0x208f('0x10')][_0x208f('0x11')](this));ami['on'](_0x208f('0x12'),this['syncNewExten'][_0x208f('0x11')](this));ami['on'](_0x208f('0x13'),this['syncHangup'][_0x208f('0x11')](this));}VoiceDialReport[_0x208f('0x14')][_0x208f('0x15')]=function(_0x2e411b){return _0x2e411b!==null&&!_[_0x208f('0x16')](_0x2e411b);};VoiceDialReport[_0x208f('0x14')]['emit']=function(_0x36b3f8,_0x19ea88,_0x10fced){io['to'](_0x36b3f8)[_0x208f('0x17')](_0x19ea88,_0x10fced);};VoiceDialReport[_0x208f('0x14')][_0x208f('0xc')]=function(_0x38ac93){try{if(this['isNotNull'](_0x38ac93)){logger['debug'](_0x208f('0x18'),_0x38ac93[_0x208f('0x19')],util[_0x208f('0x1a')](_0x38ac93,{'showHidden':![],'depth':null}));if(this[_0x208f('0x1b')][_0x38ac93[_0x208f('0x19')]]){_[_0x208f('0x1c')](this[_0x208f('0x1b')][_0x38ac93[_0x208f('0x19')]],{'starttime':moment()[_0x208f('0x1d')](_0x208f('0x1e')),'lastevent':'called','interface':_0x38ac93['channel']['substring'](0x0,_0x38ac93[_0x208f('0x1f')][_0x208f('0x20')]('-')),'membername':_0x38ac93[_0x208f('0x1f')][_0x208f('0x21')](_0x38ac93[_0x208f('0x1f')]['lastIndexOf']('/')+0x1,_0x38ac93[_0x208f('0x1f')][_0x208f('0x20')]('-'))},_[_0x208f('0x22')](_0x38ac93,[_0x208f('0x23'),'privilege']));logger[_0x208f('0x24')](_0x208f('0x25'),_0x38ac93[_0x208f('0x19')],this['channels'][_0x38ac93[_0x208f('0x19')]]['membername'],this['channels'][_0x38ac93[_0x208f('0x19')]][_0x208f('0x26')]);logger[_0x208f('0x27')](_0x208f('0x28'),_0x38ac93[_0x208f('0x19')],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x38ac93['uniqueid']],{'showHidden':![],'depth':null}));if(this['applications'][_0x38ac93['uniqueid']])_[_0x208f('0x1c')](this[_0x208f('0x1b')][_0x38ac93[_0x208f('0x19')]],this[_0x208f('0x9')][_0x38ac93['uniqueid']]);this[_0x208f('0x17')]('voice:outbound','voice_outbound_channel:save',this[_0x208f('0x1b')][_0x38ac93['uniqueid']]);logger[_0x208f('0x27')](_0x208f('0x29'),_0x38ac93[_0x208f('0x19')],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x38ac93[_0x208f('0x19')]],{'showHidden':![],'depth':null}));ami[_0x208f('0x17')](_0x208f('0x2a'),this[_0x208f('0x1b')][_0x38ac93[_0x208f('0x19')]]);}}}catch(_0x764c06){logger[_0x208f('0x2b')](_0x208f('0x2c'),_0x38ac93[_0x208f('0x19')],util['inspect'](_0x764c06,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x208f('0x14')][_0x208f('0xe')]=function(_0x4fc9bd){try{if(this[_0x208f('0x15')](_0x4fc9bd)){logger[_0x208f('0x27')](_0x208f('0x2d'),_0x4fc9bd[_0x208f('0x19')],util['inspect'](_0x4fc9bd,{'showHidden':![],'depth':null}));if(this['channels'][_0x4fc9bd[_0x208f('0x19')]]){this['channels'][_0x4fc9bd[_0x208f('0x19')]][_0x208f('0x2e')]=_0x4fc9bd[_0x208f('0x2e')];if(_0x4fc9bd[_0x208f('0x2e')]===_0x208f('0x2f')){this['channels'][_0x4fc9bd[_0x208f('0x19')]][_0x208f('0x30')]=_0x4fc9bd[_0x208f('0x30')];this[_0x208f('0x1b')][_0x4fc9bd[_0x208f('0x19')]][_0x208f('0x31')]=_0x4fc9bd[_0x208f('0x31')];this[_0x208f('0x1b')][_0x4fc9bd['uniqueid']][_0x208f('0x32')]=moment()[_0x208f('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x4fc9bd['uniqueid']][_0x208f('0x33')]=_0x208f('0x34');logger['info'](_0x208f('0x35'),_0x4fc9bd['uniqueid'],_0x4fc9bd['channel'][_0x208f('0x21')](_0x4fc9bd['channel'][_0x208f('0x20')]('/')+0x1,_0x4fc9bd[_0x208f('0x1f')][_0x208f('0x20')]('-')));logger[_0x208f('0x27')](_0x208f('0x36'),_0x4fc9bd[_0x208f('0x19')],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x4fc9bd[_0x208f('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0x208f('0x37'),this['channels'][_0x4fc9bd[_0x208f('0x19')]]);}logger[_0x208f('0x27')](_0x208f('0x38'),_0x4fc9bd['uniqueid'],util[_0x208f('0x1a')](this['channels'][_0x4fc9bd['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound_channel:save',this[_0x208f('0x1b')][_0x4fc9bd[_0x208f('0x19')]]);}}}catch(_0xcb49ac){logger['error'](_0x208f('0x39'),_0x4fc9bd['uniqueid'],util[_0x208f('0x1a')](_0xcb49ac,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x208f('0x14')][_0x208f('0x10')]=function(_0x555c92){try{if(this[_0x208f('0x15')](_0x555c92)){logger['debug'](_0x208f('0x3a'),_0x555c92[_0x208f('0x19')],util[_0x208f('0x1a')](_0x555c92,{'showHidden':![],'depth':null}));this[_0x208f('0x3b')](_0x555c92[_0x208f('0x19')],_[_0x208f('0x3c')](_0x555c92[_0x208f('0x3d')])[0x0],_0x555c92[_0x208f('0x3e')]);if(this[_0x208f('0x15')](_0x555c92[_0x208f('0x3d')])&&this[_0x208f('0x15')](_0x555c92[_0x208f('0x3d')][_0x208f('0x3f')])){if(_[_0x208f('0x16')](this[_0x208f('0x1b')][_0x555c92[_0x208f('0x19')]])){this['channels'][_0x555c92[_0x208f('0x19')]]={'routeId':_0x555c92[_0x208f('0x3e')],'variables':this[_0x208f('0xa')][_0x555c92['uniqueid']]};logger[_0x208f('0x24')](_0x208f('0x40'),_0x555c92[_0x208f('0x19')],_0x555c92[_0x208f('0x3d')][_0x208f('0x3f')],_[_0x208f('0x3c')](_0x555c92[_0x208f('0x3d')])[0x0],_0x555c92[_0x208f('0x3e')]);logger['debug'](_0x208f('0x41'),_0x555c92['uniqueid'],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x555c92['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x208f('0x42'),'voice_outbound_channel:save',this[_0x208f('0x1b')][_0x555c92[_0x208f('0x19')]]);}}}}catch(_0x37b39b){logger[_0x208f('0x2b')](_0x208f('0x43'),_0x555c92[_0x208f('0x19')],util['inspect'](_0x37b39b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x208f('0x14')][_0x208f('0x3b')]=function(_0x241c35,_0x329d40,_0x145574){var _0x5f8d7f=[_0x208f('0x44'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x208f('0x45'),'rtpaudioqosloss',_0x208f('0x46'),_0x208f('0x47'),_0x208f('0x48'),'sipcallid',_0x208f('0x49'),'bridgepeer',_0x208f('0x4a'),_0x208f('0x4b'),_0x208f('0x4c'),'memberinterface',_0x208f('0x4d'),_0x208f('0x4e'),'memberpenalty',_0x208f('0x4f')];if(!_[_0x208f('0x50')](_0x329d40)&&!_['includes'](_0x5f8d7f,_0x329d40)){if(_[_0x208f('0x16')](this[_0x208f('0xa')][_0x241c35])){this['variables'][_0x241c35]={};}this['variables'][_0x241c35][_0x329d40]=_0x145574;}};VoiceDialReport['prototype']['syncHangup']=function(_0x386364){try{if(this['isNotNull'](_0x386364)){logger[_0x208f('0x27')](_0x208f('0x51'),_0x386364[_0x208f('0x19')],util['inspect'](_0x386364,{'showHidden':![],'depth':null}));if(this['channels'][_0x386364[_0x208f('0x19')]]){logger[_0x208f('0x24')](_0x208f('0x52'),_0x386364['uniqueid'],_0x386364[_0x208f('0x53')]);this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]]['endtime']=moment()[_0x208f('0x1d')](_0x208f('0x1e'));this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]][_0x208f('0x54')]=moment(this['channels'][_0x386364[_0x208f('0x19')]]['endtime'])[_0x208f('0x55')](this['channels'][_0x386364[_0x208f('0x19')]][_0x208f('0x56')],_0x208f('0x57'));this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]][_0x208f('0x33')]=_0x208f('0x58');this['outbound'][_0x208f('0x59')]+=0x1;if(this['channels'][_0x386364[_0x208f('0x19')]][_0x208f('0x32')]){this[_0x208f('0x8')]['answered']+=0x1;this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]][_0x208f('0x5a')]=moment(this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]][_0x208f('0x32')])[_0x208f('0x55')](this['channels'][_0x386364[_0x208f('0x19')]][_0x208f('0x56')],_0x208f('0x57'));this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]][_0x208f('0x5b')]=moment(this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]][_0x208f('0x5c')])[_0x208f('0x55')](this[_0x208f('0x1b')][_0x386364['uniqueid']][_0x208f('0x32')],_0x208f('0x57'));this[_0x208f('0x8')]['sumHoldTime']+=this[_0x208f('0x1b')][_0x386364['uniqueid']][_0x208f('0x5a')]||0x0;this['outbound']['sumBillable']+=this['channels'][_0x386364['uniqueid']][_0x208f('0x5b')];}this[_0x208f('0x8')][_0x208f('0x5d')]+=this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]][_0x208f('0x54')];logger[_0x208f('0x27')](_0x208f('0x5e'),_0x386364[_0x208f('0x19')],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]],{'showHidden':![],'depth':null}));ami[_0x208f('0x17')]('custom:voiceDialReport',this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]]);logger['debug'](_0x208f('0x5f'),_0x386364[_0x208f('0x19')],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]],{'showHidden':![],'depth':null}));ami[_0x208f('0x17')](_0x208f('0x60'),this['channels'][_0x386364['uniqueid']]);logger[_0x208f('0x27')](_0x208f('0x61'),_0x386364['uniqueid'],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]],{'showHidden':![],'depth':null}));this['emit'](_0x208f('0x42'),'voice_outbound:save',this[_0x208f('0x8')]);logger[_0x208f('0x24')](_0x208f('0x62'),JSON[_0x208f('0x63')](this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]]));logger[_0x208f('0x27')](_0x208f('0x64'),_0x386364[_0x208f('0x19')],util[_0x208f('0x1a')](this[_0x208f('0x1b')][_0x386364['uniqueid']],{'showHidden':![],'depth':null}));this['emit'](_0x208f('0x42'),_0x208f('0x65'),this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]]);delete this[_0x208f('0x1b')][_0x386364[_0x208f('0x19')]];}else if(this[_0x208f('0x1b')][_0x386364[_0x208f('0x66')]]){this['channels'][_0x386364['linkedid']]['uniqueid']=this['channels'][_0x386364[_0x208f('0x66')]][_0x208f('0x67')];}if(this['variables'][_0x386364[_0x208f('0x19')]]){delete this['variables'][_0x386364[_0x208f('0x19')]];}}}catch(_0x1b7507){logger[_0x208f('0x2b')](_0x208f('0x68'),_0x386364['uniqueid'],util[_0x208f('0x1a')](_0x1b7507,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x208f('0x14')][_0x208f('0x69')]=function(_0x251e12){try{if(this[_0x208f('0x15')](_0x251e12)){logger[_0x208f('0x27')](_0x208f('0x6a'),_0x251e12[_0x208f('0x19')],util[_0x208f('0x1a')](_0x251e12,{'showHidden':![],'depth':null}));if(_0x251e12[_0x208f('0x6b')][_0x208f('0x6c')]()===_0x208f('0x6d')){_0x251e12[_0x208f('0x6e')]=(_0x251e12[_0x208f('0x6f')]||_0x251e12[_0x208f('0x6e')])[_0x208f('0x6c')]();if(_[_0x208f('0x70')](_0x251e12[_0x208f('0x6e')],_0x208f('0x71'))){if(_[_0x208f('0x16')](this[_0x208f('0x9')][_0x251e12[_0x208f('0x19')]]))this['applications'][_0x251e12[_0x208f('0x19')]]={};logger[_0x208f('0x24')](_0x208f('0x72'),_0x251e12[_0x208f('0x19')],_0x251e12[_0x208f('0x6b')],_0x251e12['applicationdata']);var _0x1f2e4b=_0x251e12['applicationdata'][_0x208f('0x73')]('=');var _0x41c750=_0x1f2e4b[0x0][_0x208f('0x74')](/cdr\((.*)\)/);if(_0x41c750)this['applications'][_0x251e12['uniqueid']][_0x41c750[0x1]]=_0x1f2e4b[0x1];}}}}catch(_0x31bd78){logger[_0x208f('0x2b')]('[%s][voiceDialReport][newexten]',_0x251e12[_0x208f('0x19')],util[_0x208f('0x1a')](_0x31bd78,{'showHidden':![],'depth':null}));}};module[_0x208f('0x75')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 778850b..680a2bc 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89c4=['[voiceQueueReport][queuesummary]\x20name:%s','countBy','callers','toNumber','loggedin','custom:queuesummary','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','position','count','routealias','pick','keys','push','queuecallerjoin','syncQueueCallerAbandon','last','queuecallercomplete','queuecallercompleteAt','holdtime','queuecallerabandon','queuecallerabandonAt','queuecallerexitreason','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerleaveAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','queuecallerleave','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','linkedid','add','seconds','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','queuestatus','CONTINUE','lastevent','timeout','queuecallerexit','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','length','unmanaged','diff','sumDuration','milliseconds','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transferuniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','syncMusicOnHoldStop','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','CDR(routeAlias)','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','exports','lodash','moment','md5','../../../config/logger','ami','../ami','../model/queueReport','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','channels','queueChannels','voiceQueues','campaigns','queuesummary','bind','syncQueueSummaryComplete','syncQueueCallerJoin','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','newexten','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','clearZombieChannels','switch','isNil','Action','channel','catch','message','No\x20such\x20channel','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','variables','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','name','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','total','abandoned','Trunk','active','callerid','Interval','stringify','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','queues','flagQueueSummary','then','[voiceQueueReport][queuesummary]','syncQueueSummary','queue','info'];(function(_0x5e8398,_0x1b4120){var _0x192dc6=function(_0x346f6d){while(--_0x346f6d){_0x5e8398['push'](_0x5e8398['shift']());}};_0x192dc6(++_0x1b4120);}(_0x89c4,0x82));var _0x489c=function(_0x1b9198,_0x1f4ef5){_0x1b9198=_0x1b9198-0x0;var _0x91c4fb=_0x89c4[_0x1b9198];return _0x91c4fb;};'use strict';var _=require(_0x489c('0x0'));var moment=require(_0x489c('0x1'));var util=require('util');var md5=require(_0x489c('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x489c('0x3'))(_0x489c('0x4'));var ami=require(_0x489c('0x5'));var QueueReport=require(_0x489c('0x6'));config[_0x489c('0x7')]=_[_0x489c('0x8')](config[_0x489c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x489c('0x9'))(new Redis(config[_0x489c('0x7')]));var Sequence=function(){};Sequence[_0x489c('0xa')][_0x489c('0xb')]=function(_0x5a301e){this['tail']=this[_0x489c('0xc')]?this['tail'][_0x489c('0xd')](_0x5a301e):_0x5a301e();};function VoiceQueueReport(_0x3cc086){this[_0x489c('0xe')]=new Sequence();this[_0x489c('0xf')]={};this[_0x489c('0x10')]=_0x3cc086[_0x489c('0x10')];this[_0x489c('0x11')]=_0x3cc086[_0x489c('0x12')];this['voiceQueues']=_0x3cc086[_0x489c('0x13')];this['flagQueueSummary']=!![];this[_0x489c('0x14')]=_0x3cc086['campaigns'];this['variables']={};ami['on'](_0x489c('0x15'),this['syncQueueSummary'][_0x489c('0x16')](this));ami['on']('queuesummarycomplete',this[_0x489c('0x17')][_0x489c('0x16')](this));ami['on']('queuecallerjoin',this[_0x489c('0x18')][_0x489c('0x16')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x489c('0x16')](this));ami['on']('queuecallerleave',this[_0x489c('0x19')][_0x489c('0x16')](this));ami['on'](_0x489c('0x1a'),this[_0x489c('0x1b')][_0x489c('0x16')](this));ami['on'](_0x489c('0x1c'),this[_0x489c('0x1d')][_0x489c('0x16')](this));ami['on'](_0x489c('0x1e'),this[_0x489c('0x1f')][_0x489c('0x16')](this));ami['on'](_0x489c('0x20'),this[_0x489c('0x21')][_0x489c('0x16')](this));ami['on'](_0x489c('0x22'),this[_0x489c('0x23')][_0x489c('0x16')](this));ami['on'](_0x489c('0x24'),this['syncNewExten'][_0x489c('0x16')](this));ami['on'](_0x489c('0x25'),this[_0x489c('0x26')][_0x489c('0x16')](this));ami['on'](_0x489c('0x27'),this['syncMusicOnHoldStop'][_0x489c('0x16')](this));ami['on'](_0x489c('0x28'),this[_0x489c('0x29')]['bind'](this));ami['on'](_0x489c('0x2a'),this[_0x489c('0x2b')]['bind'](this));this[_0x489c('0x2c')]();this[_0x489c('0x2d')]();}function clearChannels(_0x49032e){if(!_[_0x489c('0x2e')](_0x49032e)){for(var _0x4cb1ae in _0x49032e){if(_0x49032e[_0x489c('0x2f')](_0x4cb1ae)){delete _0x49032e[_0x4cb1ae];}}}}function clearCampaigns(_0x1c1ad5){if(!_['isEmpty'](_0x1c1ad5)){for(var _0x20cf09 in _0x1c1ad5){if(_0x1c1ad5[_0x489c('0x2f')](_0x20cf09)){_0x1c1ad5[_0x20cf09][_0x489c('0x30')]=0x0;}}}}function clearVoiceQueues(_0x228c06){if(!_['isEmpty'](_0x228c06)){for(var _0x29c012 in _0x228c06){if(_0x228c06['hasOwnProperty'](_0x29c012)){_0x228c06[_0x29c012][_0x489c('0x30')]=0x0;_0x228c06[_0x29c012][_0x489c('0x31')]=0x0;_0x228c06[_0x29c012][_0x489c('0x32')]=0x0;_0x228c06[_0x29c012][_0x489c('0x33')]=0x0;_0x228c06[_0x29c012][_0x489c('0x34')]=!![];}}}}function clearAgentBooked(_0x31986e){if(!_['isEmpty'](_0x31986e)){for(var _0x79b260 in _0x31986e){if(_0x31986e[_0x489c('0x2f')](_0x79b260)){_0x31986e[_0x79b260]['unlockRR']=!![];}}}}VoiceQueueReport[_0x489c('0xa')][_0x489c('0x35')]=function(){var _0x58b523=this;for(var _0x1fe531 in this[_0x489c('0x11')]){if(this[_0x489c('0x11')][_0x489c('0x2f')](_0x1fe531)&&!this['channels'][_0x1fe531][_0x489c('0x36')]){this[_0x489c('0xe')]['enqueue'](function(){if(!_[_0x489c('0x37')](_0x58b523[_0x489c('0x11')][_0x1fe531])){return ami[_0x489c('0x38')]({'action':'status','channel':_0x58b523[_0x489c('0x11')][_0x1fe531][_0x489c('0x39')]})[_0x489c('0x3a')](function(_0x157760){if(_0x157760[_0x489c('0x3b')]===_0x489c('0x3c')){setTimeout(function(){if(_0x58b523[_0x489c('0x11')][_0x1fe531]){delete _0x58b523[_0x489c('0x11')][_0x1fe531];logger['error'](_0x489c('0x3d'),_0x1fe531,util[_0x489c('0x3e')](_0x157760,{'showHidden':![],'depth':null}));}if(_0x58b523[_0x489c('0xf')][_0x1fe531]){delete _0x58b523[_0x489c('0xf')][_0x1fe531];logger[_0x489c('0x3f')](_0x489c('0x40'),_0x1fe531,util[_0x489c('0x3e')](_0x157760,{'showHidden':![],'depth':null}));}if(_0x58b523[_0x489c('0x41')][_0x1fe531]){delete _0x58b523[_0x489c('0x41')][_0x1fe531];logger[_0x489c('0x3f')]('[%s][voiceQueueReport][checkVariables]',_0x1fe531,util[_0x489c('0x3e')](_0x157760,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype'][_0x489c('0x23')]=function(){logger[_0x489c('0x3f')](_0x489c('0x42'));clearChannels(this[_0x489c('0x11')]);this['clearQueueReport'](this[_0x489c('0xf')]);clearAgentBooked(this[_0x489c('0x10')]);clearVoiceQueues(this[_0x489c('0x13')]);clearCampaigns(this[_0x489c('0x14')]);};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x43')]=function(_0x2e2c80){var _0x58b478=this;if(!_[_0x489c('0x2e')](_0x2e2c80)){for(var _0x20d763 in _0x2e2c80){if(_0x2e2c80[_0x489c('0x2f')](_0x20d763)){_0x58b478[_0x489c('0x44')](_0x2e2c80[_0x20d763],_0x489c('0x45'));delete _0x2e2c80[_0x20d763];}}}};VoiceQueueReport['prototype'][_0x489c('0x46')]=function(_0x562f82,_0x21cd87,_0x56586e){io['to'](_0x562f82)[_0x489c('0x46')](_0x21cd87,_0x56586e);};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x47')]=function(_0xdcf742,_0x451393){logger[_0x489c('0x48')](_0x489c('0x49')+_0x451393+_0x489c('0x4a'),_0xdcf742[_0x489c('0x4b')],util[_0x489c('0x3e')](_0xdcf742,{'showHidden':![],'depth':null}));this[_0x489c('0x46')](util[_0x489c('0x4c')](_0x489c('0x4d'),_0xdcf742[_0x489c('0x4e')]),_0x489c('0x4f'),_0xdcf742);io['emit']('voice_queue_presence:save',_0xdcf742);};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x44')]=function(_0x31b58a,_0x2f879a){logger['debug'](_0x489c('0x49')+_0x2f879a+_0x489c('0x50'),_0x31b58a['uniqueid'],util[_0x489c('0x3e')](_0x31b58a,{'showHidden':![],'depth':null}));this['emit'](util[_0x489c('0x4c')]('voice:queue:%s',_0x31b58a[_0x489c('0x4e')]),_0x489c('0x51'),_0x31b58a);io[_0x489c('0x46')](_0x489c('0x52'),_0x31b58a);};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x53')]=function(_0xb24af0,_0x3ecc63){if(_0xb24af0[_0x489c('0x54')]===_0x489c('0x55')){var _0x2bbee6={'id':_0xb24af0['id'],'name':_0xb24af0[_0x489c('0x4e')],'strategy':_0xb24af0[_0x489c('0x56')],'answered':_0xb24af0[_0x489c('0x57')],'available':_0xb24af0[_0x489c('0x58')],'loggedIn':_0xb24af0[_0x489c('0x59')],'pTalking':_0xb24af0[_0x489c('0x32')],'sumBillable':_0xb24af0[_0x489c('0x5a')],'sumDuration':_0xb24af0['sumDuration'],'sumHoldTime':_0xb24af0[_0x489c('0x5b')]||0x0,'talking':_0xb24af0['talking'],'total':_0xb24af0[_0x489c('0x5c')],'type':_0xb24af0[_0x489c('0x54')],'unmanaged':_0xb24af0['unmanaged'],'abandoned':_0xb24af0[_0x489c('0x5d')],'waiting':_0xb24af0[_0x489c('0x33')]};if(_0xb24af0[_0x489c('0x5e')]){_0x2bbee6['Trunk']={'id':_0xb24af0['Trunk']['id'],'name':_0xb24af0[_0x489c('0x5e')][_0x489c('0x4e')],'active':_0xb24af0['Trunk'][_0x489c('0x5f')],'callerid':_0xb24af0[_0x489c('0x5e')][_0x489c('0x60')]};}if(_0xb24af0[_0x489c('0x61')]){_0x2bbee6[_0x489c('0x61')]={'id':_0xb24af0[_0x489c('0x61')]['id'],'name':_0xb24af0[_0x489c('0x61')][_0x489c('0x4e')]};}var _0x1d6cfd=md5(JSON[_0x489c('0x62')](_0x2bbee6));if(_0xb24af0[_0x489c('0x2')]!==_0x1d6cfd){_0xb24af0[_0x489c('0x2')]=_0x1d6cfd;logger[_0x489c('0x48')](_0x489c('0x63')+_0x3ecc63+_0x489c('0x64'),util[_0x489c('0x3e')](_0x2bbee6,{'showHidden':![],'depth':null}));this[_0x489c('0x46')](util[_0x489c('0x4c')](_0x489c('0x4d'),_0x2bbee6[_0x489c('0x4e')]),_0x489c('0x65'),_0x2bbee6);}}};VoiceQueueReport['prototype'][_0x489c('0x66')]=function(_0x258713){return _0x258713!==null&&!_[_0x489c('0x67')](_0x258713);};VoiceQueueReport['prototype']['loopQueueShow']=function(){var _0x2327fb=this;setInterval(function(){_0x2327fb[_0x489c('0x35')]();ami[_0x489c('0x38')]({'action':_0x489c('0x68')})['catch'](function(_0x348b8a){logger[_0x489c('0x3f')]('[voiceQueueReport][queues]',util[_0x489c('0x3e')](_0x348b8a,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype']['loopQueueSummary']=function(){var _0x6e4130=this;setInterval(function(){if(_0x6e4130[_0x489c('0x69')]){return ami[_0x489c('0x38')]({'action':_0x489c('0x15')})[_0x489c('0x6a')](function(_0x279090){_0x6e4130[_0x489c('0x69')]=![];})[_0x489c('0x3a')](function(_0x176b7d){logger[_0x489c('0x3f')](_0x489c('0x6b'),util[_0x489c('0x3e')](_0x176b7d,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x489c('0x6c')]=function(_0x3752b6){try{if(this[_0x489c('0x66')](_0x3752b6)&&this['isNotNull'](_0x3752b6[_0x489c('0x6d')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x489c('0x3e')](_0x3752b6,{'showHidden':![],'depth':null}));if(this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]]){logger[_0x489c('0x6e')](_0x489c('0x6f'),_0x3752b6[_0x489c('0x6d')]);var _0x135077=_[_0x489c('0x70')](this[_0x489c('0x11')],_0x489c('0x6d'))[_0x3752b6['queue']]||0x0;var _0x3e407a=_0x135077-_0x3752b6[_0x489c('0x71')];if(this[_0x489c('0x13')][_0x3752b6['queue']]['waiting']!==_['toNumber'](_0x3752b6[_0x489c('0x71')])||this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]][_0x489c('0x59')]!==_[_0x489c('0x72')](_0x3752b6[_0x489c('0x73')])||this[_0x489c('0x13')][_0x3752b6['queue']][_0x489c('0x58')]!==_[_0x489c('0x72')](_0x3752b6['available'])||this['voiceQueues'][_0x3752b6[_0x489c('0x6d')]][_0x489c('0x31')]!==_0x3e407a){this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]]['waiting']=_['toNumber'](_0x3752b6[_0x489c('0x71')]);this['voiceQueues'][_0x3752b6[_0x489c('0x6d')]][_0x489c('0x59')]=_[_0x489c('0x72')](_0x3752b6[_0x489c('0x73')]);this['voiceQueues'][_0x3752b6['queue']][_0x489c('0x58')]=_['toNumber'](_0x3752b6[_0x489c('0x58')]);this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]][_0x489c('0x31')]=_0x3e407a>0x0?_0x3e407a:0x0;this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]][_0x489c('0x31')]=this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]][_0x489c('0x31')]>_[_0x489c('0x72')](_0x3752b6['loggedin'])?_[_0x489c('0x72')](_0x3752b6['loggedin']):this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]]['talking'];this[_0x489c('0x53')](this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]],'queuesummary');}logger[_0x489c('0x48')]('[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:',util[_0x489c('0x3e')](this['voiceQueues'][_0x3752b6['queue']],{'showHidden':![],'depth':null}));ami[_0x489c('0x46')](_0x489c('0x74'),this[_0x489c('0x13')][_0x3752b6[_0x489c('0x6d')]]);}}}catch(_0x190f1c){logger['error'](_0x489c('0x6b'),util['inspect'](_0x190f1c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0x433df1){logger[_0x489c('0x48')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x489c('0x3e')](_0x433df1,{'showHidden':![],'depth':null}));this[_0x489c('0x69')]=!![];};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x18')]=function(_0x38ee40){try{if(this[_0x489c('0x66')](_0x38ee40)){logger[_0x489c('0x48')](_0x489c('0x75'),_0x38ee40['uniqueid'],util[_0x489c('0x3e')](_0x38ee40,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x489c('0xf')][_0x38ee40['uniqueid']]))this[_0x489c('0xf')][_0x38ee40[_0x489c('0x4b')]]=[];if(_['isUndefined'](this['channels'][_0x38ee40[_0x489c('0x4b')]]))this[_0x489c('0x11')][_0x38ee40['uniqueid']]={};var _0x43bf6f=new QueueReport();_0x43bf6f[_0x489c('0x4e')]=_0x38ee40[_0x489c('0x6d')];_0x43bf6f[_0x489c('0x54')]=this[_0x489c('0x13')][_0x43bf6f[_0x489c('0x4e')]]&&this['voiceQueues'][_0x43bf6f[_0x489c('0x4e')]][_0x489c('0x54')]?this['voiceQueues'][_0x43bf6f[_0x489c('0x4e')]][_0x489c('0x54')]||_0x489c('0x55'):'inbound';_0x43bf6f[_0x489c('0x6d')]=_0x38ee40[_0x489c('0x6d')];_0x43bf6f[_0x489c('0x76')]=moment()[_0x489c('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x43bf6f[_0x489c('0x77')]=_0x38ee40['position'];_0x43bf6f[_0x489c('0x78')]=_0x38ee40[_0x489c('0x78')];_0x43bf6f['uniqueid']=_0x38ee40[_0x489c('0x4b')];_0x43bf6f[_0x489c('0x79')]=this['channels'][_0x38ee40[_0x489c('0x4b')]][_0x489c('0x79')];logger[_0x489c('0x6e')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x43bf6f[_0x489c('0x4e')],_0x43bf6f[_0x489c('0x54')]);_['merge'](_0x43bf6f,_[_0x489c('0x7a')](_0x38ee40,_[_0x489c('0x7b')](_0x43bf6f)));this[_0x489c('0xf')][_0x38ee40[_0x489c('0x4b')]][_0x489c('0x7c')](_0x43bf6f);this['channels'][_0x38ee40['uniqueid']]=_0x43bf6f;this['emitVoiceQueueChannelSave'](_0x43bf6f,_0x489c('0x7d'));}}catch(_0x5720ac){logger[_0x489c('0x3f')](_0x489c('0x75'),_0x38ee40[_0x489c('0x4b')],util['inspect'](_0x5720ac,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x489c('0x7e')]=function(_0xff7d3b){try{if(this['isNotNull'](_0xff7d3b)){logger[_0x489c('0x48')]('[%s][voiceQueueReport][queuecallerabandon]',_0xff7d3b['uniqueid'],util[_0x489c('0x3e')](_0xff7d3b,{'showHidden':![],'depth':null}));if(this[_0x489c('0xf')][_0xff7d3b[_0x489c('0x4b')]]){var _0x65402d=_[_0x489c('0x7f')](this[_0x489c('0xf')][_0xff7d3b[_0x489c('0x4b')]]);_0x65402d[_0x489c('0x80')]=![];_0x65402d[_0x489c('0x81')]=null;_0x65402d[_0x489c('0x82')]=_0xff7d3b['holdtime'];_0x65402d['originalposition']=_0xff7d3b['originalposition'];_0x65402d[_0x489c('0x83')]=!![];_0x65402d[_0x489c('0x84')]=moment()[_0x489c('0x4c')]('YYYY-MM-DD\x20HH:mm:ss');_0x65402d[_0x489c('0x85')]=_0x489c('0x86');_0x65402d[_0x489c('0x87')]=null;logger['info'](_0x489c('0x88'),_0x65402d['name'],_0x65402d[_0x489c('0x54')]);this[_0x489c('0x11')][_0xff7d3b[_0x489c('0x4b')]]=_0x65402d;this[_0x489c('0x44')](_0x65402d,_0x489c('0x83'));}}}catch(_0xe98a05){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0xff7d3b[_0x489c('0x4b')],util[_0x489c('0x3e')](_0xe98a05,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x19')]=function(_0x506880){try{if(this[_0x489c('0x66')](_0x506880)){logger[_0x489c('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0x506880[_0x489c('0x4b')],util[_0x489c('0x3e')](_0x506880,{'showHidden':![],'depth':null}));if(this[_0x489c('0xf')][_0x506880['uniqueid']]){var _0x59d692=_['last'](this[_0x489c('0xf')][_0x506880[_0x489c('0x4b')]]);_0x59d692[_0x489c('0x89')]=moment()[_0x489c('0x4c')](_0x489c('0x8a'));_0x59d692[_0x489c('0x8b')]=_0x506880[_0x489c('0x8b')];_0x59d692[_0x489c('0x8c')]=_0x506880[_0x489c('0x8c')];logger['info'](_0x489c('0x8d'),_0x59d692[_0x489c('0x4e')],_0x59d692[_0x489c('0x54')],_0x506880[_0x489c('0x8b')],_0x506880[_0x489c('0x8c')]);this[_0x489c('0x11')][_0x506880[_0x489c('0x4b')]]=_0x59d692;this[_0x489c('0x47')](_0x59d692,_0x489c('0x8e'));}}}catch(_0x49e329){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x506880['uniqueid'],util['inspect'](_0x49e329,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x489c('0xa')]['syncAgentConnect']=function(_0x1b472c){try{if(this['isNotNull'](_0x1b472c)){logger['debug'](_0x489c('0x8f'),_0x1b472c[_0x489c('0x4b')],util[_0x489c('0x3e')](_0x1b472c,{'showHidden':![],'depth':null}));if(this[_0x489c('0xf')][_0x1b472c[_0x489c('0x4b')]]){var _0x4300be=_[_0x489c('0x7f')](this[_0x489c('0xf')][_0x1b472c['uniqueid']]);_0x4300be[_0x489c('0x80')]=!![];_0x4300be['queuecallerexitreason']=_0x489c('0x90');logger[_0x489c('0x6e')](_0x489c('0x91'),_0x4300be[_0x489c('0x4e')],_0x4300be[_0x489c('0x54')]);}}}catch(_0x463648){logger[_0x489c('0x3f')](_0x489c('0x8f'),_0x1b472c[_0x489c('0x4b')],util[_0x489c('0x3e')](_0x463648,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x1b')]=function(_0x46e245){try{if(this[_0x489c('0x66')](_0x46e245)){logger['debug'](_0x489c('0x92'),_0x46e245[_0x489c('0x4b')],util[_0x489c('0x3e')](_0x46e245,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x46e245['uniqueid']]){var _0x28f76c=_['last'](this[_0x489c('0xf')][_0x46e245['uniqueid']]);_0x28f76c[_0x489c('0x83')]=![];_0x28f76c[_0x489c('0x84')]=null;_0x28f76c[_0x489c('0x93')]=!![];_0x28f76c[_0x489c('0x87')]=_0x46e245[_0x489c('0x94')];_0x28f76c[_0x489c('0x82')]=_0x46e245[_0x489c('0x82')];_0x28f76c[_0x489c('0x80')]=!![];_0x28f76c['queuecallerexit']=![];_0x28f76c[_0x489c('0x95')]=null;if(!_0x28f76c[_0x489c('0x96')]){if(_0x46e245['reason']==_0x489c('0x96')){_0x28f76c[_0x489c('0x85')]='COMPLETED';logger[_0x489c('0x6e')](_0x489c('0x97'),_0x28f76c[_0x489c('0x4e')],_0x28f76c[_0x489c('0x54')]);}else{if(_[_0x489c('0x98')](_0x46e245[_0x489c('0x39')]['toLowerCase'](),'local/')){if(this[_0x489c('0xf')][_0x46e245[_0x489c('0x99')]]){var _0x442dfc=_[_0x489c('0x7f')](this[_0x489c('0xf')][_0x46e245[_0x489c('0x99')]]);_0x442dfc['queuecallercomplete']=![];_0x442dfc['queuecallerexit']=!![];_0x442dfc[_0x489c('0x95')]=moment(_0x28f76c[_0x489c('0x76')])[_0x489c('0x9a')](_0x46e245['holdtime'],_0x489c('0x9b'))[_0x489c('0x4c')](_0x489c('0x8a'));_0x442dfc['queuecallerexitreason']='FORWARDTRANSFER';_0x442dfc[_0x489c('0x96')]=!![];_0x442dfc[_0x489c('0x9c')]=_0x489c('0x9d');_0x442dfc[_0x489c('0x9e')]=_0x46e245[_0x489c('0x9f')];_0x442dfc['transferuniqueid']=_0x46e245[_0x489c('0x4b')];logger[_0x489c('0x6e')](_0x489c('0xa0'),_0x442dfc['name'],_0x442dfc[_0x489c('0x54')]);var _0x4632bf=this[_0x489c('0xf')][_0x46e245['linkedid']];this[_0x489c('0xf')][_0x46e245[_0x489c('0x99')]]=this[_0x489c('0xf')][_0x46e245[_0x489c('0x4b')]];this[_0x489c('0xf')][_0x46e245[_0x489c('0x4b')]]=_0x4632bf;}}else{_0x28f76c[_0x489c('0x85')]='COMPLETEDBY'+_0x46e245[_0x489c('0xa1')]['toUpperCase']();logger[_0x489c('0x6e')](_0x489c('0xa2'),_0x28f76c['name'],_0x28f76c['type'],_0x28f76c[_0x489c('0x85')]);}}}this[_0x489c('0x11')][_0x46e245[_0x489c('0x4b')]]=_0x28f76c;this[_0x489c('0x44')](_0x28f76c,_0x489c('0x1a'));}}}catch(_0x3be36){logger[_0x489c('0x3f')](_0x489c('0x92'),_0x46e245[_0x489c('0x4b')],util[_0x489c('0x3e')](_0x3be36,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x489c('0xa')]['syncVarSet']=function(_0x28c651){try{if(this['isNotNull'](_0x28c651)){logger[_0x489c('0x48')]('[%s][voiceQueueReport][varset]',_0x28c651['uniqueid'],util[_0x489c('0x3e')](_0x28c651,{'showHidden':![],'depth':null}));this[_0x489c('0xa3')](_0x28c651['uniqueid'],_[_0x489c('0x7b')](_0x28c651[_0x489c('0xa4')])[0x0],_0x28c651[_0x489c('0xa5')]);if(this[_0x489c('0xf')][_0x28c651[_0x489c('0x4b')]]){var _0x52ff97=_[_0x489c('0x7f')](this['queueReports'][_0x28c651[_0x489c('0x4b')]]);if(_0x52ff97){if(this[_0x489c('0x66')](_0x28c651[_0x489c('0xa4')])&&this[_0x489c('0x66')](_0x28c651['variable'][_0x489c('0xa6')])){switch(_0x28c651[_0x489c('0xa5')]){case _0x489c('0xa7'):_0x52ff97['queuecallerexit']=![];_0x52ff97[_0x489c('0x95')]=null;break;case'TIMEOUT':_0x52ff97[_0x489c('0xa8')]=_0x489c('0xa9');_0x52ff97[_0x489c('0xaa')]=!![];_0x52ff97[_0x489c('0x95')]=moment()[_0x489c('0x4c')](_0x489c('0x8a'));_0x52ff97[_0x489c('0x89')]=moment()[_0x489c('0x4c')](_0x489c('0x8a'));logger[_0x489c('0x48')](_0x489c('0xab'),_0x28c651[_0x489c('0x4b')],util[_0x489c('0x3e')](_0x52ff97,{'showHidden':![],'depth':null}));ami[_0x489c('0x46')](_0x489c('0xac'),_0x52ff97);break;default:_0x52ff97[_0x489c('0xaa')]=!![];_0x52ff97['queuecallerexitAt']=moment()[_0x489c('0x4c')](_0x489c('0x8a'));_0x52ff97[_0x489c('0x89')]=moment()[_0x489c('0x4c')](_0x489c('0x8a'));}_0x52ff97[_0x489c('0x83')]=![];_0x52ff97[_0x489c('0x84')]=null;_0x52ff97[_0x489c('0x85')]=_0x28c651['value'];this[_0x489c('0x11')][_0x28c651[_0x489c('0x4b')]]=_0x52ff97;this[_0x489c('0x44')](_0x52ff97,_0x489c('0x1e'));}else if(this['isNotNull'](_0x28c651['variable'])&&this[_0x489c('0x66')](_0x28c651[_0x489c('0xa4')]['queueposition'])){if(!_0x52ff97[_0x489c('0x83')]){_0x52ff97[_0x489c('0xaa')]=!![];_0x52ff97[_0x489c('0x95')]=moment()[_0x489c('0x4c')](_0x489c('0x8a'));_0x52ff97['queuecallerexitreason']=_0x489c('0xad');_0x52ff97[_0x489c('0x89')]=moment()[_0x489c('0x4c')](_0x489c('0x8a'));this[_0x489c('0x11')][_0x28c651[_0x489c('0x4b')]]=_0x52ff97;}}logger['info'](_0x489c('0xae'),_0x28c651[_0x489c('0x4b')],_0x52ff97[_0x489c('0x4e')],_0x52ff97['type'],_[_0x489c('0x7b')](_0x28c651[_0x489c('0xa4')])[0x0],_0x28c651[_0x489c('0xa5')]);_0x52ff97[_0x489c('0x41')]=this[_0x489c('0x41')][_0x28c651[_0x489c('0x4b')]];}}}}catch(_0x3e3bfd){logger[_0x489c('0x3f')](_0x489c('0xaf'),_0x28c651['uniqueid'],util[_0x489c('0x3e')](_0x3e3bfd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x489c('0xa')]['addVariable']=function(_0x49af27,_0x136a44,_0xe11855){var _0x384124=[_0x489c('0xb0'),'rtpaudioqosbridged',_0x489c('0xb1'),_0x489c('0xb2'),'rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt',_0x489c('0xb3'),_0x489c('0xb4'),_0x489c('0xb5'),_0x489c('0xb6'),_0x489c('0xb7'),_0x489c('0xb8'),_0x489c('0xb9'),_0x489c('0xba'),_0x489c('0xbb'),_0x489c('0x94'),_0x489c('0xbc'),_0x489c('0xbd')];if(!_[_0x489c('0x37')](_0x136a44)&&!_[_0x489c('0xbe')](_0x384124,_0x136a44)){if(_[_0x489c('0x67')](this['variables'][_0x49af27])){this[_0x489c('0x41')][_0x49af27]={};}this[_0x489c('0x41')][_0x49af27][_0x136a44]=_0xe11855;}};VoiceQueueReport[_0x489c('0xa')][_0x489c('0x21')]=function(_0x51c036){try{if(this[_0x489c('0x66')](_0x51c036)){logger[_0x489c('0x48')]('[%s][voiceQueueReport][hangup]',_0x51c036[_0x489c('0x4b')],util[_0x489c('0x3e')](_0x51c036,{'showHidden':![],'depth':null}));if(this[_0x489c('0xf')][_0x51c036[_0x489c('0x4b')]]){for(var _0x16b4f4=0x0,_0x42eea6={};_0x16b4f40x0?_0xecaf54:0x0;this['voiceQueues'][_0x161aeb[_0x8cb1('0x5e')]][_0x8cb1('0x2c')]=this[_0x8cb1('0x12')][_0x161aeb[_0x8cb1('0x5e')]][_0x8cb1('0x2c')]>_[_0x8cb1('0x61')](_0x161aeb[_0x8cb1('0x62')])?_[_0x8cb1('0x61')](_0x161aeb[_0x8cb1('0x62')]):this[_0x8cb1('0x12')][_0x161aeb[_0x8cb1('0x5e')]]['talking'];this['emitVoiceQueueSummary'](this[_0x8cb1('0x12')][_0x161aeb[_0x8cb1('0x5e')]],'queuesummary');}logger['debug'](_0x8cb1('0x63'),util[_0x8cb1('0x3c')](this[_0x8cb1('0x12')][_0x161aeb[_0x8cb1('0x5e')]],{'showHidden':![],'depth':null}));ami[_0x8cb1('0x40')](_0x8cb1('0x64'),this[_0x8cb1('0x12')][_0x161aeb['queue']]);}}}catch(_0x441a58){logger[_0x8cb1('0x39')](_0x8cb1('0x5c'),util[_0x8cb1('0x3c')](_0x441a58,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8cb1('0xa')][_0x8cb1('0x18')]=function(_0x192913){logger[_0x8cb1('0x41')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x8cb1('0x3c')](_0x192913,{'showHidden':![],'depth':null}));this['flagQueueSummary']=!![];};VoiceQueueReport[_0x8cb1('0xa')][_0x8cb1('0x1a')]=function(_0x3d308d){try{if(this[_0x8cb1('0x5a')](_0x3d308d)){logger['debug']('[%s][voiceQueueReport][queuecallerjoin]',_0x3d308d[_0x8cb1('0x43')],util['inspect'](_0x3d308d,{'showHidden':![],'depth':null}));if(_[_0x8cb1('0x65')](this[_0x8cb1('0xe')][_0x3d308d[_0x8cb1('0x43')]]))this[_0x8cb1('0xe')][_0x3d308d[_0x8cb1('0x43')]]=[];if(_['isUndefined'](this[_0x8cb1('0x10')][_0x3d308d[_0x8cb1('0x43')]]))this[_0x8cb1('0x10')][_0x3d308d[_0x8cb1('0x43')]]={};var _0x4bef57=new QueueReport();_0x4bef57[_0x8cb1('0x44')]=_0x3d308d[_0x8cb1('0x5e')];_0x4bef57['type']=this['voiceQueues'][_0x4bef57[_0x8cb1('0x44')]]&&this[_0x8cb1('0x12')][_0x4bef57[_0x8cb1('0x44')]][_0x8cb1('0x4a')]?this['voiceQueues'][_0x4bef57[_0x8cb1('0x44')]][_0x8cb1('0x4a')]||'inbound':'inbound';_0x4bef57['queue']=_0x3d308d[_0x8cb1('0x5e')];_0x4bef57[_0x8cb1('0x66')]=moment()['format'](_0x8cb1('0x67'));_0x4bef57[_0x8cb1('0x68')]=_0x3d308d[_0x8cb1('0x68')];_0x4bef57[_0x8cb1('0x69')]=_0x3d308d[_0x8cb1('0x69')];_0x4bef57['uniqueid']=_0x3d308d[_0x8cb1('0x43')];_0x4bef57[_0x8cb1('0x6a')]=this['channels'][_0x3d308d[_0x8cb1('0x43')]][_0x8cb1('0x6a')];logger[_0x8cb1('0x6b')](_0x8cb1('0x6c'),_0x4bef57[_0x8cb1('0x44')],_0x4bef57['type']);_[_0x8cb1('0x6d')](_0x4bef57,_[_0x8cb1('0x6e')](_0x3d308d,_[_0x8cb1('0x6f')](_0x4bef57)));this[_0x8cb1('0xe')][_0x3d308d[_0x8cb1('0x43')]][_0x8cb1('0x70')](_0x4bef57);this[_0x8cb1('0x10')][_0x3d308d['uniqueid']]=_0x4bef57;this[_0x8cb1('0x71')](_0x4bef57,_0x8cb1('0x19'));}}catch(_0x26ef17){logger[_0x8cb1('0x39')](_0x8cb1('0x72'),_0x3d308d[_0x8cb1('0x43')],util['inspect'](_0x26ef17,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8cb1('0xa')][_0x8cb1('0x73')]=function(_0x3109a3){try{if(this[_0x8cb1('0x5a')](_0x3109a3)){logger[_0x8cb1('0x41')](_0x8cb1('0x74'),_0x3109a3[_0x8cb1('0x43')],util[_0x8cb1('0x3c')](_0x3109a3,{'showHidden':![],'depth':null}));if(this[_0x8cb1('0xe')][_0x3109a3[_0x8cb1('0x43')]]){var _0x5376f8=_[_0x8cb1('0x75')](this[_0x8cb1('0xe')][_0x3109a3['uniqueid']]);_0x5376f8[_0x8cb1('0x76')]=![];_0x5376f8[_0x8cb1('0x77')]=null;_0x5376f8[_0x8cb1('0x78')]=_0x3109a3[_0x8cb1('0x78')];_0x5376f8['originalposition']=_0x3109a3[_0x8cb1('0x79')];_0x5376f8[_0x8cb1('0x1b')]=!![];_0x5376f8[_0x8cb1('0x7a')]=moment()[_0x8cb1('0x47')](_0x8cb1('0x67'));_0x5376f8['queuecallerexitreason']=_0x8cb1('0x7b');_0x5376f8['lastAssignedTo']=null;logger[_0x8cb1('0x6b')](_0x8cb1('0x7c'),_0x5376f8[_0x8cb1('0x44')],_0x5376f8[_0x8cb1('0x4a')]);this[_0x8cb1('0x10')][_0x3109a3[_0x8cb1('0x43')]]=_0x5376f8;this[_0x8cb1('0x3e')](_0x5376f8,'queuecallerabandon');}}}catch(_0x447fa1){logger[_0x8cb1('0x39')](_0x8cb1('0x74'),_0x3109a3[_0x8cb1('0x43')],util[_0x8cb1('0x3c')](_0x447fa1,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x8cb1('0x7d')]=function(_0x3ed516){try{if(this[_0x8cb1('0x5a')](_0x3ed516)){logger[_0x8cb1('0x41')](_0x8cb1('0x7e'),_0x3ed516['uniqueid'],util[_0x8cb1('0x3c')](_0x3ed516,{'showHidden':![],'depth':null}));if(this[_0x8cb1('0xe')][_0x3ed516['uniqueid']]){var _0xe81eff=_[_0x8cb1('0x75')](this[_0x8cb1('0xe')][_0x3ed516[_0x8cb1('0x43')]]);_0xe81eff[_0x8cb1('0x7f')]=moment()['format'](_0x8cb1('0x67'));_0xe81eff[_0x8cb1('0x80')]=_0x3ed516['connectedlinenum'];_0xe81eff[_0x8cb1('0x81')]=_0x3ed516[_0x8cb1('0x81')];logger[_0x8cb1('0x6b')](_0x8cb1('0x82'),_0xe81eff[_0x8cb1('0x44')],_0xe81eff[_0x8cb1('0x4a')],_0x3ed516['connectedlinenum'],_0x3ed516[_0x8cb1('0x81')]);this[_0x8cb1('0x10')][_0x3ed516[_0x8cb1('0x43')]]=_0xe81eff;this['emitVoiceQueueChannelSave'](_0xe81eff,_0x8cb1('0x83'));}}}catch(_0x2da89c){logger[_0x8cb1('0x39')]('[%s][voiceQueueReport][queuecallerleave]',_0x3ed516[_0x8cb1('0x43')],util[_0x8cb1('0x3c')](_0x2da89c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8cb1('0xa')][_0x8cb1('0x1e')]=function(_0x588b08){try{if(this[_0x8cb1('0x5a')](_0x588b08)){logger[_0x8cb1('0x41')](_0x8cb1('0x84'),_0x588b08[_0x8cb1('0x43')],util['inspect'](_0x588b08,{'showHidden':![],'depth':null}));if(this[_0x8cb1('0xe')][_0x588b08[_0x8cb1('0x43')]]){var _0x33825d=_[_0x8cb1('0x75')](this[_0x8cb1('0xe')][_0x588b08[_0x8cb1('0x43')]]);_0x33825d[_0x8cb1('0x76')]=!![];_0x33825d[_0x8cb1('0x85')]=_0x8cb1('0x86');logger['info'](_0x8cb1('0x87'),_0x33825d[_0x8cb1('0x44')],_0x33825d[_0x8cb1('0x4a')]);}}}catch(_0x59938b){logger[_0x8cb1('0x39')](_0x8cb1('0x84'),_0x588b08[_0x8cb1('0x43')],util[_0x8cb1('0x3c')](_0x59938b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8cb1('0xa')][_0x8cb1('0x1d')]=function(_0x316cc4){try{if(this[_0x8cb1('0x5a')](_0x316cc4)){logger['debug'](_0x8cb1('0x88'),_0x316cc4[_0x8cb1('0x43')],util[_0x8cb1('0x3c')](_0x316cc4,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x316cc4[_0x8cb1('0x43')]]){var _0x6c1ba6=_[_0x8cb1('0x75')](this[_0x8cb1('0xe')][_0x316cc4['uniqueid']]);_0x6c1ba6[_0x8cb1('0x1b')]=![];_0x6c1ba6['queuecallerabandonAt']=null;_0x6c1ba6[_0x8cb1('0x89')]=!![];_0x6c1ba6[_0x8cb1('0x8a')]=_0x316cc4[_0x8cb1('0x8b')];_0x6c1ba6[_0x8cb1('0x78')]=_0x316cc4[_0x8cb1('0x78')];_0x6c1ba6['queuecallercomplete']=!![];_0x6c1ba6[_0x8cb1('0x8c')]=![];_0x6c1ba6[_0x8cb1('0x8d')]=null;if(!_0x6c1ba6[_0x8cb1('0x8e')]){if(_0x316cc4[_0x8cb1('0x8f')]=='transfer'){_0x6c1ba6['queuecallerexitreason']=_0x8cb1('0x90');logger[_0x8cb1('0x6b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x6c1ba6[_0x8cb1('0x44')],_0x6c1ba6[_0x8cb1('0x4a')]);}else{if(_[_0x8cb1('0x91')](_0x316cc4['channel'][_0x8cb1('0x92')](),_0x8cb1('0x93'))){if(this[_0x8cb1('0xe')][_0x316cc4[_0x8cb1('0x94')]]){var _0x1b040f=_[_0x8cb1('0x75')](this[_0x8cb1('0xe')][_0x316cc4[_0x8cb1('0x94')]]);_0x1b040f[_0x8cb1('0x76')]=![];_0x1b040f[_0x8cb1('0x8c')]=!![];_0x1b040f[_0x8cb1('0x8d')]=moment(_0x6c1ba6[_0x8cb1('0x66')])[_0x8cb1('0x95')](_0x316cc4[_0x8cb1('0x78')],'seconds')[_0x8cb1('0x47')](_0x8cb1('0x67'));_0x1b040f['queuecallerexitreason']=_0x8cb1('0x96');_0x1b040f[_0x8cb1('0x8e')]=!![];_0x1b040f[_0x8cb1('0x97')]='FORWARD';_0x1b040f[_0x8cb1('0x98')]=_0x316cc4[_0x8cb1('0x99')];_0x1b040f[_0x8cb1('0x9a')]=_0x316cc4[_0x8cb1('0x43')];logger[_0x8cb1('0x6b')](_0x8cb1('0x9b'),_0x1b040f[_0x8cb1('0x44')],_0x1b040f['type']);var _0x24c1a5=this[_0x8cb1('0xe')][_0x316cc4[_0x8cb1('0x94')]];this['queueReports'][_0x316cc4[_0x8cb1('0x94')]]=this[_0x8cb1('0xe')][_0x316cc4[_0x8cb1('0x43')]];this[_0x8cb1('0xe')][_0x316cc4[_0x8cb1('0x43')]]=_0x24c1a5;}}else{_0x6c1ba6[_0x8cb1('0x85')]=_0x8cb1('0x9c')+_0x316cc4[_0x8cb1('0x8f')][_0x8cb1('0x9d')]();logger[_0x8cb1('0x6b')](_0x8cb1('0x9e'),_0x6c1ba6[_0x8cb1('0x44')],_0x6c1ba6[_0x8cb1('0x4a')],_0x6c1ba6[_0x8cb1('0x85')]);}}}this['channels'][_0x316cc4['uniqueid']]=_0x6c1ba6;this[_0x8cb1('0x3e')](_0x6c1ba6,_0x8cb1('0x1c'));}}}catch(_0x56bb9c){logger[_0x8cb1('0x39')](_0x8cb1('0x88'),_0x316cc4[_0x8cb1('0x43')],util['inspect'](_0x56bb9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8cb1('0xa')]['syncVarSet']=function(_0x108d30){try{if(this[_0x8cb1('0x5a')](_0x108d30)){logger['debug'](_0x8cb1('0x9f'),_0x108d30[_0x8cb1('0x43')],util['inspect'](_0x108d30,{'showHidden':![],'depth':null}));this[_0x8cb1('0xa0')](_0x108d30['uniqueid'],_[_0x8cb1('0x6f')](_0x108d30[_0x8cb1('0xa1')])[0x0],_0x108d30['value']);if(this[_0x8cb1('0xe')][_0x108d30[_0x8cb1('0x43')]]){var _0x5e003c=_['last'](this[_0x8cb1('0xe')][_0x108d30['uniqueid']]);if(_0x5e003c){if(this['isNotNull'](_0x108d30[_0x8cb1('0xa1')])&&this[_0x8cb1('0x5a')](_0x108d30['variable']['queuestatus'])){switch(_0x108d30['value']){case'CONTINUE':_0x5e003c[_0x8cb1('0x8c')]=![];_0x5e003c[_0x8cb1('0x8d')]=null;break;case _0x8cb1('0xa2'):_0x5e003c[_0x8cb1('0xa3')]=_0x8cb1('0xa4');_0x5e003c[_0x8cb1('0x8c')]=!![];_0x5e003c[_0x8cb1('0x8d')]=moment()['format'](_0x8cb1('0x67'));_0x5e003c[_0x8cb1('0x7f')]=moment()[_0x8cb1('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x8cb1('0x41')](_0x8cb1('0xa5'),_0x108d30[_0x8cb1('0x43')],util[_0x8cb1('0x3c')](_0x5e003c,{'showHidden':![],'depth':null}));ami['emit'](_0x8cb1('0xa6'),_0x5e003c);break;default:_0x5e003c[_0x8cb1('0x8c')]=!![];_0x5e003c[_0x8cb1('0x8d')]=moment()[_0x8cb1('0x47')](_0x8cb1('0x67'));_0x5e003c[_0x8cb1('0x7f')]=moment()[_0x8cb1('0x47')](_0x8cb1('0x67'));}_0x5e003c[_0x8cb1('0x1b')]=![];_0x5e003c['queuecallerabandonAt']=null;_0x5e003c['queuecallerexitreason']=_0x108d30[_0x8cb1('0xa7')];this['channels'][_0x108d30[_0x8cb1('0x43')]]=_0x5e003c;this[_0x8cb1('0x3e')](_0x5e003c,_0x8cb1('0xa8'));}else if(this['isNotNull'](_0x108d30[_0x8cb1('0xa1')])&&this[_0x8cb1('0x5a')](_0x108d30['variable']['queueposition'])){if(!_0x5e003c['queuecallerabandon']){_0x5e003c['queuecallerexit']=!![];_0x5e003c[_0x8cb1('0x8d')]=moment()[_0x8cb1('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x5e003c['queuecallerexitreason']=_0x8cb1('0xa9');_0x5e003c['queuecallerleaveAt']=moment()['format'](_0x8cb1('0x67'));this[_0x8cb1('0x10')][_0x108d30[_0x8cb1('0x43')]]=_0x5e003c;}}logger['info'](_0x8cb1('0xaa'),_0x108d30['uniqueid'],_0x5e003c[_0x8cb1('0x44')],_0x5e003c[_0x8cb1('0x4a')],_[_0x8cb1('0x6f')](_0x108d30[_0x8cb1('0xa1')])[0x0],_0x108d30[_0x8cb1('0xa7')]);_0x5e003c[_0x8cb1('0x15')]=this['variables'][_0x108d30[_0x8cb1('0x43')]];}}}}catch(_0x5d21b2){logger[_0x8cb1('0x39')](_0x8cb1('0x9f'),_0x108d30[_0x8cb1('0x43')],util[_0x8cb1('0x3c')](_0x5d21b2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x8cb1('0xa')][_0x8cb1('0xa0')]=function(_0x219160,_0x35d62f,_0x1cb6a8){var _0xc52d49=['rtpaudioqos',_0x8cb1('0xab'),_0x8cb1('0xac'),_0x8cb1('0xad'),_0x8cb1('0xae'),'rtpaudioqoslossbridged',_0x8cb1('0xaf'),'rtpaudioqosrttbridged',_0x8cb1('0xb0'),'sipuri','bridgepeer',_0x8cb1('0xb1'),_0x8cb1('0xb2'),_0x8cb1('0xb3'),_0x8cb1('0xb4'),_0x8cb1('0xb5'),_0x8cb1('0x8b'),_0x8cb1('0xb6'),_0x8cb1('0xb7')];if(!_[_0x8cb1('0x34')](_0x35d62f)&&!_[_0x8cb1('0xb8')](_0xc52d49,_0x35d62f)){if(_[_0x8cb1('0x65')](this[_0x8cb1('0x15')][_0x219160])){this[_0x8cb1('0x15')][_0x219160]={};}this[_0x8cb1('0x15')][_0x219160][_0x35d62f]=_0x1cb6a8;}};VoiceQueueReport[_0x8cb1('0xa')][_0x8cb1('0xb9')]=function(_0x5c8460){try{if(this[_0x8cb1('0x5a')](_0x5c8460)){logger[_0x8cb1('0x41')]('[%s][voiceQueueReport][hangup]',_0x5c8460[_0x8cb1('0x43')],util['inspect'](_0x5c8460,{'showHidden':![],'depth':null}));if(this[_0x8cb1('0xe')][_0x5c8460['uniqueid']]){for(var _0x31e2cb=0x0,_0x56e36e={};_0x31e2cb=0x0?moment(_0x2d493f['endtime'])[_0x52bd('0xe')](_0x2d493f[_0x52bd('0x17')],'seconds'):null,'data1':_0x52bd('0x19'),'data2':_0x2d493f[_0x52bd('0x13')],'data3':_0x2d493f[_0x52bd('0x12')],'data4':_0x2d493f['dialstring']||null,'role':'agent','internal':_0x2d493f['accountcode']?_['toNumber'](_0x2d493f[_0x52bd('0x13')]):undefined,'uniqueid':_0x2d493f[_0x52bd('0x1a')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0xb338=['CreateMemberReport','voice','lastAssignedTo','isNil','interface','TALKING','queuecallerleaveAt','diff','seconds','inbound','exten','queue','agent','accountcode','uniqueid','Request','membername','starttime','endtime','outbound','dialstring','toNumber','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xb338,0x82));var _0x8b33=function(_0x2ec7f2,_0xe24da3){_0x2ec7f2=_0x2ec7f2-0x0;var _0x29de00=_0xb338[_0x2ec7f2];return _0x29de00;};'use strict';var moment=require('moment');var _=require(_0x8b33('0x0'));var util=require('util');var client=require(_0x8b33('0x1'));exports[_0x8b33('0x2')]=function(_0x46ace6){var _0xbb748e=_0x46ace6[_0x8b33('0x3')]||_0x46ace6[_0x8b33('0x4')];return client['Request'](_0x8b33('0x5'),{'body':{'channel':_0x8b33('0x6'),'membername':_0x46ace6[_0x8b33('0x7')],'interface':_[_0x8b33('0x8')](_0x46ace6['interface'])?util['format']('SIP/%s',_0x46ace6['lastAssignedTo']):_0x46ace6[_0x8b33('0x9')],'type':_0x8b33('0xa'),'enterAt':_0x46ace6[_0x8b33('0xb')],'exitAt':_0xbb748e,'duration':moment(_0xbb748e)[_0x8b33('0xc')](_0x46ace6['queuecallerleaveAt'],_0x8b33('0xd')),'data1':_0x8b33('0xe'),'data2':_0x46ace6['calleridnum'],'data3':_0x46ace6[_0x8b33('0xf')],'data4':null,'data5':_0x46ace6[_0x8b33('0x10')],'role':_0x8b33('0x11'),'internal':_0x46ace6['accountcode']?_['toNumber'](_0x46ace6[_0x8b33('0x12')]):undefined,'uniqueid':_0x46ace6[_0x8b33('0x13')]},'log':_0x8b33('0x5')});};exports['voiceDialReport']=function(_0x5483a0){return client[_0x8b33('0x14')]('CreateMemberReport',{'body':{'channel':_0x8b33('0x6'),'membername':_0x5483a0[_0x8b33('0x15')],'interface':_0x5483a0[_0x8b33('0x9')],'type':_0x8b33('0xa'),'enterAt':_0x5483a0[_0x8b33('0x16')],'exitAt':_0x5483a0['endtime'],'duration':moment(_0x5483a0[_0x8b33('0x17')])['diff'](_0x5483a0['starttime'],'seconds')>=0x0?moment(_0x5483a0[_0x8b33('0x17')])['diff'](_0x5483a0[_0x8b33('0x16')],_0x8b33('0xd')):null,'data1':_0x8b33('0x18'),'data2':_0x5483a0['accountcode'],'data3':_0x5483a0[_0x8b33('0xf')],'data4':_0x5483a0[_0x8b33('0x19')]||null,'role':_0x8b33('0x11'),'internal':_0x5483a0['accountcode']?_[_0x8b33('0x1a')](_0x5483a0['accountcode']):undefined,'uniqueid':_0x5483a0[_0x8b33('0x13')]},'log':_0x8b33('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 54a0ca0..1f39bd8 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 _0x15ec=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings','getSettings'];(function(_0x1dfb80,_0x90df58){var _0x51a82d=function(_0x3ec21c){while(--_0x3ec21c){_0x1dfb80['push'](_0x1dfb80['shift']());}};_0x51a82d(++_0x90df58);}(_0x15ec,0x16c));var _0xc15e=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x15ec[_0x5416db];return _0x243e35;};'use strict';var client=require('../client');exports[_0xc15e('0x0')]=function(){return client[_0xc15e('0x1')](_0xc15e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc15e('0x3')]},'log':_0xc15e('0x4')});}; \ No newline at end of file +var _0xcf2d=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client','getSettings'];(function(_0x2caa59,_0x1f76c3){var _0x491b97=function(_0x21c3f9){while(--_0x21c3f9){_0x2caa59['push'](_0x2caa59['shift']());}};_0x491b97(++_0x1f76c3);}(_0xcf2d,0x1ea));var _0xdcf2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf2d[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xdcf2('0x0'));exports[_0xdcf2('0x1')]=function(){return client[_0xdcf2('0x2')](_0xdcf2('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xdcf2('0x4')]},'log':_0xdcf2('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 807cbd8..e6998a2 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 _0x57fa=['../client','getTemplates','GetTemplate','name','html'];(function(_0x36deb8,_0x4f8846){var _0x42225a=function(_0x13dc85){while(--_0x13dc85){_0x36deb8['push'](_0x36deb8['shift']());}};_0x42225a(++_0x4f8846);}(_0x57fa,0x127));var _0xa57f=function(_0x28b2b8,_0x109f8a){_0x28b2b8=_0x28b2b8-0x0;var _0x4e40cf=_0x57fa[_0x28b2b8];return _0x4e40cf;};'use strict';var client=require(_0xa57f('0x0'));exports[_0xa57f('0x1')]=function(_0x4915db){return function(_0x191cf7){return client['Request'](_0xa57f('0x2'),{'options':{'raw':!![],'attributes':['id',_0xa57f('0x3'),_0xa57f('0x4')]},'log':_0xa57f('0x2')});};}; \ No newline at end of file +var _0x927e=['html','../client','getTemplates','Request','GetTemplate','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x927e,0x1ab));var _0xe927=function(_0x749614,_0x9c4b56){_0x749614=_0x749614-0x0;var _0x4cacdf=_0x927e[_0x749614];return _0x4cacdf;};'use strict';var client=require(_0xe927('0x0'));exports[_0xe927('0x1')]=function(_0x4b582d){return function(_0x5a407c){return client[_0xe927('0x2')](_0xe927('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe927('0x4'),_0xe927('0x5')]},'log':_0xe927('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b0de645..4f80de2 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 _0xed0e=['data7','../client','getTriggers','Request','name','channel','status','Condition','operator','AnyConditions','Action','Actions','action','data1','data2','data3','data4','data5'];(function(_0xe0452c,_0x412461){var _0x3d45cb=function(_0x1007ec){while(--_0x1007ec){_0xe0452c['push'](_0xe0452c['shift']());}};_0x3d45cb(++_0x412461);}(_0xed0e,0x145));var _0xeed0=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xed0e[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0xeed0('0x0'));exports[_0xeed0('0x1')]=function(_0x47a66b){return function(_0x2efe19){return client[_0xeed0('0x2')]('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xeed0('0x3'),_0xeed0('0x4'),_0xeed0('0x5')],'include':[{'model':_0xeed0('0x6'),'as':'AllConditions','attributes':['id','field',_0xeed0('0x7'),'value']},{'model':_0xeed0('0x6'),'as':_0xeed0('0x8'),'attributes':['id','field',_0xeed0('0x7'),'value']},{'model':_0xeed0('0x9'),'as':_0xeed0('0xa'),'attributes':['id',_0xeed0('0xb'),_0xeed0('0xc'),_0xeed0('0xd'),_0xeed0('0xe'),_0xeed0('0xf'),_0xeed0('0x10'),'data6',_0xeed0('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0xd543=['data6','data7','getTriggers','Request','GetTrigger','name','channel','status','field','operator','value','Condition','AnyConditions','Actions','action','data1','data2','data3','data4'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xd543,0xf9));var _0x3d54=function(_0x18bc94,_0x1fe673){_0x18bc94=_0x18bc94-0x0;var _0x47843d=_0xd543[_0x18bc94];return _0x47843d;};'use strict';var client=require('../client');exports[_0x3d54('0x0')]=function(_0x370190){return function(_0xa5ad07){return client[_0x3d54('0x1')](_0x3d54('0x2'),{'options':{'raw':![],'attributes':['id',_0x3d54('0x3'),_0x3d54('0x4'),_0x3d54('0x5')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x3d54('0x6'),_0x3d54('0x7'),_0x3d54('0x8')]},{'model':_0x3d54('0x9'),'as':_0x3d54('0xa'),'attributes':['id',_0x3d54('0x6'),'operator','value']},{'model':'Action','as':_0x3d54('0xb'),'attributes':['id',_0x3d54('0xc'),_0x3d54('0xd'),_0x3d54('0xe'),_0x3d54('0xf'),_0x3d54('0x10'),'data5',_0x3d54('0x11'),_0x3d54('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 0f5c095..1b5033a 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 _0xf662=['defaultuser','GetTrunk','../client','Request','name','registry'];(function(_0x475235,_0x2540bf){var _0x5440cd=function(_0x390321){while(--_0x390321){_0x475235['push'](_0x475235['shift']());}};_0x5440cd(++_0x2540bf);}(_0xf662,0x116));var _0x2f66=function(_0x2577d9,_0x8f2f28){_0x2577d9=_0x2577d9-0x0;var _0x36fe58=_0xf662[_0x2577d9];return _0x36fe58;};'use strict';var client=require(_0x2f66('0x0'));exports['getTrunks']=function(_0x3965d4){return function(_0x3e6a8c){return client[_0x2f66('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x2f66('0x2'),_0x2f66('0x3'),_0x2f66('0x4')]},'log':_0x2f66('0x5')});};}; \ No newline at end of file +var _0x582f=['name','registry','defaultuser','../client','getTrunks','Request','GetTrunk'];(function(_0x351163,_0x38b99d){var _0x422703=function(_0x6326e4){while(--_0x6326e4){_0x351163['push'](_0x351163['shift']());}};_0x422703(++_0x38b99d);}(_0x582f,0xce));var _0xf582=function(_0x5db99b,_0xdee23a){_0x5db99b=_0x5db99b-0x0;var _0x4b2d0e=_0x582f[_0x5db99b];return _0x4b2d0e;};'use strict';var client=require(_0xf582('0x0'));exports[_0xf582('0x1')]=function(_0x18c0c5){return function(_0xa42206){return client[_0xf582('0x2')](_0xf582('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xf582('0x4'),_0xf582('0x5'),_0xf582('0x6')]},'log':_0xf582('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ec01104..d7d3a3b 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['mobile','getTelephones','internal','PauseUser','savePause','saveUnpause','UnpauseUser','ShowUser','interface','getAgent','getAgents','Request','GetUser','agent','name','email','accountcode','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause'];(function(_0x1d1679,_0x5e3d95){var _0x2cd491=function(_0x2b9ad1){while(--_0x2b9ad1){_0x1d1679['push'](_0x1d1679['shift']());}};_0x2cd491(++_0x5e3d95);}(_0xedd9,0xfc));var _0x9edd=function(_0x210372,_0x151782){_0x210372=_0x210372-0x0;var _0x59a79c=_0xedd9[_0x210372];return _0x59a79c;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3')},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),_0x9edd('0xb'),'phone',_0x9edd('0xc'),'interface']},'log':_0x9edd('0x0')});};};exports[_0x9edd('0xd')]=function(){return function(){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x9edd('0x4'),'accountcode',_0x9edd('0xe')]},'log':_0x9edd('0xd')});};};exports['savePause']=function(_0xbf9da6,_0x13dc4f,_0x5b6c00){return client[_0x9edd('0x1')](_0x9edd('0xf'),{'body':{'type':_0x13dc4f,'uniqueid':_0x5b6c00},'options':{'where':{'id':_0xbf9da6['id']}},'log':_0x9edd('0x10')});};exports[_0x9edd('0x11')]=function(_0x287ddd){return client[_0x9edd('0x1')](_0x9edd('0x12'),{'body':{},'options':{'where':{'id':_0x287ddd['id']}},'log':_0x9edd('0x10')});};exports['getAgent']=function(_0x176bfa){return client[_0x9edd('0x1')](_0x9edd('0x13'),{'options':{'raw':![],'where':{'role':_0x9edd('0x3'),'id':_0x176bfa},'attributes':['id',_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6'),_0x9edd('0x7'),'online',_0x9edd('0x8'),_0x9edd('0x9'),_0x9edd('0xa'),'voicePause',_0x9edd('0x14')]},'log':_0x9edd('0x15')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0xea7c53,_0x3ddb4d){var _0x4b2f6c=function(_0x2bbf9e){while(--_0x2bbf9e){_0xea7c53['push'](_0xea7c53['shift']());}};_0x4b2f6c(++_0x3ddb4d);}(_0x70e0,0x17b));var _0x070e=function(_0x1d0fe8,_0x18ebf8){_0x1d0fe8=_0x1d0fe8-0x0;var _0x541ad8=_0x70e0[_0x1d0fe8];return _0x541ad8;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 89f44b8..e343368 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 _0xb358=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x59833f,_0x3023ae){var _0x58d2c3=function(_0x3b5315){while(--_0x3b5315){_0x59833f['push'](_0x59833f['shift']());}};_0x58d2c3(++_0x3023ae);}(_0xb358,0x163));var _0x8b35=function(_0x4e0e93,_0x4f4a4d){_0x4e0e93=_0x4e0e93-0x0;var _0x106ec0=_0xb358[_0x4e0e93];return _0x106ec0;};'use strict';var client=require(_0x8b35('0x0'));exports[_0x8b35('0x1')]=function(_0x2d616d){return client[_0x8b35('0x2')](_0x8b35('0x3'),{'body':_0x2d616d,'log':'CreateVoiceAgentReport'});};exports[_0x8b35('0x4')]=function(_0x5ba7c5,_0xa4e381,_0x1ec8d2){return client['Request'](_0x8b35('0x5'),{'body':_0x5ba7c5,'options':{'where':{'uniqueid':_0xa4e381,'interface':_0x1ec8d2,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0xacd3=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x3f6e5d,_0x5ee3bc){var _0x34dc8a=function(_0x13f60e){while(--_0x13f60e){_0x3f6e5d['push'](_0x3f6e5d['shift']());}};_0x34dc8a(++_0x5ee3bc);}(_0xacd3,0x1e7));var _0x3acd=function(_0x3c0575,_0x4e7bb1){_0x3c0575=_0x3c0575-0x0;var _0x5de997=_0xacd3[_0x3c0575];return _0x5de997;};'use strict';var client=require(_0x3acd('0x0'));exports[_0x3acd('0x1')]=function(_0x194cee){return client[_0x3acd('0x2')](_0x3acd('0x3'),{'body':_0x194cee,'log':_0x3acd('0x3')});};exports['update']=function(_0xce98e7,_0x51fddd,_0x277ed9){return client[_0x3acd('0x2')](_0x3acd('0x4'),{'body':_0xce98e7,'options':{'where':{'uniqueid':_0x51fddd,'interface':_0x277ed9,'agentcomplete':!![]}},'log':_0x3acd('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index bc2cf99..fd089b6 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 _0xa36f=['DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','moment','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid'];(function(_0x5a1b0d,_0x458062){var _0x4efb97=function(_0x4e2b17){while(--_0x4e2b17){_0x5a1b0d['push'](_0x5a1b0d['shift']());}};_0x4efb97(++_0x458062);}(_0xa36f,0x16d));var _0xfa36=function(_0x3ffda5,_0x251f7f){_0x3ffda5=_0x3ffda5-0x0;var _0x1fa0a4=_0xa36f[_0x3ffda5];return _0x1fa0a4;};'use strict';var moment=require(_0xfa36('0x0'));var util=require(_0xfa36('0x1'));var _=require('lodash');var client=require('../client');exports[_0xfa36('0x2')]=function(_0x16408b){return client[_0xfa36('0x3')](_0xfa36('0x4'),{'body':_[_0xfa36('0x5')](_0x16408b,{'source':_0x16408b[_0xfa36('0x6')],'destinationcontext':_0x16408b[_0xfa36('0x7')],'callerid':_0x16408b[_0xfa36('0x8')],'amaflags':_0xfa36('0x9')}),'log':_0xfa36('0x4')});};exports[_0xfa36('0xa')]=function(){return function(){return client[_0xfa36('0x3')](_0xfa36('0xb'),{'options':{'where':{'type':[_0xfa36('0xc')],'createdAt':{'$between':[moment()[_0xfa36('0xd')](_0xfa36('0xe'))[_0xfa36('0xf')](_0xfa36('0x10')),moment()[_0xfa36('0x11')](_0xfa36('0xe'))[_0xfa36('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xfa36('0x12'),_0xfa36('0x13'),_0xfa36('0x14'),_0xfa36('0x15')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x4fe3=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','disposition','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','DOCUMENTATION','startOf','day'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x4fe3,0x184));var _0x34fe=function(_0x3079d9,_0x39d143){_0x3079d9=_0x3079d9-0x0;var _0xe5a9eb=_0x4fe3[_0x3079d9];return _0xe5a9eb;};'use strict';var moment=require(_0x34fe('0x0'));var util=require(_0x34fe('0x1'));var _=require('lodash');var client=require(_0x34fe('0x2'));exports[_0x34fe('0x3')]=function(_0x24c5a9){return client[_0x34fe('0x4')](_0x34fe('0x5'),{'body':_[_0x34fe('0x6')](_0x24c5a9,{'source':_0x24c5a9[_0x34fe('0x7')],'destinationcontext':_0x24c5a9['context'],'callerid':_0x24c5a9[_0x34fe('0x8')],'amaflags':_0x34fe('0x9')}),'log':_0x34fe('0x5')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x34fe('0x4')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x34fe('0xa')](_0x34fe('0xb'))[_0x34fe('0xc')](_0x34fe('0xd')),moment()[_0x34fe('0xe')](_0x34fe('0xb'))['format'](_0x34fe('0xd'))]}},'attributes':['type',_0x34fe('0xf'),'duration','billableseconds']},'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 ec38c19..aad6632 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 _0xdab0=['../client','create','Request','CreateVoiceDialReport'];(function(_0x2f52d6,_0x1e5a2a){var _0x1dec4b=function(_0xc29a94){while(--_0xc29a94){_0x2f52d6['push'](_0x2f52d6['shift']());}};_0x1dec4b(++_0x1e5a2a);}(_0xdab0,0x114));var _0x0dab=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xdab0[_0x4b7895];return _0x264180;};'use strict';var client=require(_0x0dab('0x0'));exports[_0x0dab('0x1')]=function(_0x4f43a8){return client[_0x0dab('0x2')]('CreateVoiceDialReport',{'body':_0x4f43a8,'log':_0x0dab('0x3')});}; \ No newline at end of file +var _0xd36d=['create','CreateVoiceDialReport'];(function(_0x5e9e62,_0x2be3fa){var _0x2c2aee=function(_0xde24f3){while(--_0xde24f3){_0x5e9e62['push'](_0x5e9e62['shift']());}};_0x2c2aee(++_0x2be3fa);}(_0xd36d,0x14c));var _0xdd36=function(_0x961f62,_0x53e8d7){_0x961f62=_0x961f62-0x0;var _0x4ff024=_0xd36d[_0x961f62];return _0x4ff024;};'use strict';var client=require('../client');exports[_0xdd36('0x0')]=function(_0x1584af){return client['Request'](_0xdd36('0x1'),{'body':_0x1584af,'log':_0xdd36('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 926ae66..f3d753b 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 _0x8cfd=['../client','getVoiceExtensions','Request','GetVoiceExtension','exten','recordingFormat'];(function(_0x7ea5e4,_0x314026){var _0x2d6f56=function(_0x6ddfd7){while(--_0x6ddfd7){_0x7ea5e4['push'](_0x7ea5e4['shift']());}};_0x2d6f56(++_0x314026);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0x8cfd[_0x318dda];return _0x3f97ca;};'use strict';var client=require(_0xd8cf('0x0'));exports[_0xd8cf('0x1')]=function(){return function(){return client[_0xd8cf('0x2')](_0xd8cf('0x3'),{'options':{'raw':!![],'attributes':['id',_0xd8cf('0x4'),_0xd8cf('0x5')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x9e5e=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x50bc98,_0x1e99b8){var _0x34163b=function(_0x18b463){while(--_0x18b463){_0x50bc98['push'](_0x50bc98['shift']());}};_0x34163b(++_0x1e99b8);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9e5e[_0x46e363];return _0x3fb059;};'use strict';var client=require(_0xe9e5('0x0'));exports[_0xe9e5('0x1')]=function(){return function(){return client['Request'](_0xe9e5('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe9e5('0x3'),_0xe9e5('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 195c80f..c8a7853 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 _0xd56d=['dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk','callerid','active','Pause','TrunkBackup','Interval','interval','getVoiceQueues','../client','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout'];(function(_0x192472,_0xdeb474){var _0x277cc2=function(_0x3d71a1){while(--_0x3d71a1){_0x192472['push'](_0x192472['shift']());}};_0x277cc2(++_0xdeb474);}(_0xd56d,0x108));var _0xdd56=function(_0x1f6e37,_0x560390){_0x1f6e37=_0x1f6e37-0x0;var _0x3d17ad=_0xd56d[_0x1f6e37];return _0x3d17ad;};'use strict';var client=require(_0xdd56('0x0'));exports['getVoiceQueues']=function(){return function(){return client['Request'](_0xdd56('0x1'),{'options':{'raw':![],'attributes':['id',_0xdd56('0x2'),_0xdd56('0x3'),_0xdd56('0x4'),'autopause',_0xdd56('0x5'),_0xdd56('0x6'),'dialActive',_0xdd56('0x7'),_0xdd56('0x8'),_0xdd56('0x9'),_0xdd56('0xa'),'dialPredictiveOptimization',_0xdd56('0xb'),_0xdd56('0xc'),_0xdd56('0xd'),_0xdd56('0xe'),_0xdd56('0xf'),_0xdd56('0x10'),_0xdd56('0x11'),_0xdd56('0x12'),_0xdd56('0x13'),_0xdd56('0x14'),_0xdd56('0x15'),_0xdd56('0x16'),_0xdd56('0x17'),'dialNoAnswerRetryFrequency',_0xdd56('0x18'),'dialTimezone',_0xdd56('0x19'),_0xdd56('0x1a'),_0xdd56('0x1b'),'dialAMDActive',_0xdd56('0x1c'),_0xdd56('0x1d'),'dialAMDAfterGreetingSilence',_0xdd56('0x1e'),_0xdd56('0x1f'),_0xdd56('0x20'),'dialAMDMaximumNumberOfWords',_0xdd56('0x21'),_0xdd56('0x22'),_0xdd56('0x23'),_0xdd56('0x24'),_0xdd56('0x25'),_0xdd56('0x26'),_0xdd56('0x27'),'dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0xdd56('0x28'),'dialRandomLastDigitCallerIdNumber',_0xdd56('0x29'),'dialNoSuchNumberMaxRetry',_0xdd56('0x2a'),_0xdd56('0x2b'),_0xdd56('0x2c'),_0xdd56('0x2d'),'dialAbandonedRetryFrequency',_0xdd56('0x2e'),_0xdd56('0x2f'),_0xdd56('0x30'),_0xdd56('0x31'),'mandatoryDisposition',_0xdd56('0x32'),_0xdd56('0x33')],'include':[{'model':_0xdd56('0x34'),'as':_0xdd56('0x34'),'attributes':['id','name',_0xdd56('0x35'),_0xdd56('0x36')]},{'model':_0xdd56('0x37'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xdd56('0x34'),'as':_0xdd56('0x38'),'attributes':['id','name',_0xdd56('0x35'),'active']},{'model':_0xdd56('0x39'),'as':_0xdd56('0x39'),'attributes':['id',_0xdd56('0x2')],'include':[{'model':_0xdd56('0x39'),'as':'Intervals','attributes':['id',_0xdd56('0x2'),_0xdd56('0x3a')]}]}]},'log':_0xdd56('0x3b')});};}; \ No newline at end of file +var _0x5df5=['callerid','TrunkBackup','active','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk'];(function(_0x4e5cd2,_0x5db252){var _0x29b410=function(_0x5f532e){while(--_0x5f532e){_0x4e5cd2['push'](_0x4e5cd2['shift']());}};_0x29b410(++_0x5db252);}(_0x5df5,0x7f));var _0x55df=function(_0x32cfce,_0x27238b){_0x32cfce=_0x32cfce-0x0;var _0xeec1fb=_0x5df5[_0x32cfce];return _0xeec1fb;};'use strict';var client=require(_0x55df('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x55df('0x1')](_0x55df('0x2'),{'options':{'raw':![],'attributes':['id',_0x55df('0x3'),_0x55df('0x4'),_0x55df('0x5'),_0x55df('0x6'),_0x55df('0x7'),_0x55df('0x8'),_0x55df('0x9'),'dialMethod',_0x55df('0xa'),_0x55df('0xb'),'dialPowerLevel',_0x55df('0xc'),'dialPredictiveOptimizationPercentage',_0x55df('0xd'),_0x55df('0xe'),'dialOriginateCallerIdNumber',_0x55df('0xf'),_0x55df('0x10'),_0x55df('0x11'),_0x55df('0x12'),_0x55df('0x13'),_0x55df('0x14'),'dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0x55df('0x15'),_0x55df('0x16'),_0x55df('0x17'),_0x55df('0x18'),'dialPrefix',_0x55df('0x19'),_0x55df('0x1a'),_0x55df('0x1b'),_0x55df('0x1c'),'dialAMDAfterGreetingSilence',_0x55df('0x1d'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence',_0x55df('0x1e'),_0x55df('0x1f'),'dialAMDMaximumWordLength',_0x55df('0x20'),_0x55df('0x21'),_0x55df('0x22'),_0x55df('0x23'),_0x55df('0x24'),'dialAgiAfterHangupClient',_0x55df('0x25'),_0x55df('0x7'),_0x55df('0x26'),_0x55df('0x27'),_0x55df('0x28'),_0x55df('0x29'),_0x55df('0x2a'),_0x55df('0x2b'),_0x55df('0x2c'),_0x55df('0x2d'),_0x55df('0x2e'),_0x55df('0x2f'),_0x55df('0x30'),'dialAgentRejectMaxRetry',_0x55df('0x31'),_0x55df('0x32'),'dialPredictiveIntervalMaxThreshold',_0x55df('0x33')],'include':[{'model':_0x55df('0x34'),'as':_0x55df('0x34'),'attributes':['id',_0x55df('0x3'),_0x55df('0x35'),'active']},{'model':'Pause','as':'mandatoryDispositionPause','attributes':['id','name']},{'model':'Trunk','as':_0x55df('0x36'),'attributes':['id',_0x55df('0x3'),_0x55df('0x35'),_0x55df('0x37')]},{'model':'Interval','as':_0x55df('0x38'),'attributes':['id',_0x55df('0x3')],'include':[{'model':_0x55df('0x38'),'as':_0x55df('0x39'),'attributes':['id',_0x55df('0x3'),_0x55df('0x3a')]}]}]},'log':_0x55df('0x3b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 46dec6e..6fa8874 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(_0x39b861,_0x1f2490){var _0x3ab315=function(_0x4f38c1){while(--_0x4f38c1){_0x39b861['push'](_0x39b861['shift']());}};_0x3ab315(++_0x1f2490);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +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(_0x24feff,_0x3488e9){var _0x32f367=function(_0x4c12ca){while(--_0x4c12ca){_0x24feff['push'](_0x24feff['shift']());}};_0x32f367(++_0x3488e9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 6581447..e071b48 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 _0xfd96=['../client','getVoiceQueueRtPauses','Request'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfd96,0x1f2));var _0x6fd9=function(_0x1bc284,_0x397f4b){_0x1bc284=_0x1bc284-0x0;var _0x1ca4ae=_0xfd96[_0x1bc284];return _0x1ca4ae;};'use strict';var client=require(_0x6fd9('0x0'));exports[_0x6fd9('0x1')]=function(_0x32e6da){return function(){return client[_0x6fd9('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x32e6da,'paused':!![]},'raw':!![]},'log':_0x6fd9('0x1')});};}; \ No newline at end of file +var _0xc23a=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x38c74e,_0x1090b3){var _0x758e83=function(_0x5288e9){while(--_0x5288e9){_0x38c74e['push'](_0x38c74e['shift']());}};_0x758e83(++_0x1090b3);}(_0xc23a,0x1c9));var _0xac23=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0xc23a[_0x54a761];return _0x37d1da;};'use strict';var client=require(_0xac23('0x0'));exports[_0xac23('0x1')]=function(_0x3fb6f9){return function(){return client[_0xac23('0x2')](_0xac23('0x3'),{'options':{'where':{'VoiceQueueId':_0x3fb6f9,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index b4fbc2a..40958bb 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(_0x3fe0b1,_0x19cace){var _0x1e2473=function(_0x3e6edc){while(--_0x3e6edc){_0x3fe0b1['push'](_0x3fe0b1['shift']());}};_0x1e2473(++_0x19cace);}(_0x7a54,0x106));var _0x47a5=function(_0x6b14df,_0x4c5d0e){_0x6b14df=_0x6b14df-0x0;var _0x32fc4d=_0x7a54[_0x6b14df];return _0x32fc4d;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x502844,_0x3a9b73){var _0x443889=function(_0x2ae980){while(--_0x2ae980){_0x502844['push'](_0x502844['shift']());}};_0x443889(++_0x3a9b73);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 2ae1dc1..6dd0a16 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 _0x68cd=['transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client'];(function(_0x7005dc,_0xeb51c4){var _0x5b2497=function(_0x236f43){while(--_0x236f43){_0x7005dc['push'](_0x7005dc['shift']());}};_0x5b2497(++_0xeb51c4);}(_0x68cd,0x71));var _0xd68c=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x68cd[_0x43b584];return _0x48f27b;};'use strict';var client=require(_0xd68c('0x0'));exports[_0xd68c('0x1')]={};exports['blindTransfer']=function(_0x1a8aa5){return client[_0xd68c('0x2')](_0xd68c('0x3'),{'body':{'result':_0x1a8aa5[_0xd68c('0x4')],'transfererchannel':_0x1a8aa5[_0xd68c('0x5')],'transferercalleridnum':_0x1a8aa5[_0xd68c('0x6')],'transferercalleridname':_0x1a8aa5[_0xd68c('0x7')],'transfererconnectedlinenum':_0x1a8aa5[_0xd68c('0x8')],'transfererconnectedlinename':_0x1a8aa5['transfererconnectedlinename'],'transfereraccountcode':_0x1a8aa5[_0xd68c('0x9')],'transferercontext':_0x1a8aa5[_0xd68c('0xa')],'transfererexten':_0x1a8aa5[_0xd68c('0xb')],'transfererlinkedid':_0x1a8aa5[_0xd68c('0xc')],'transfereechannel':_0x1a8aa5[_0xd68c('0xd')],'transfereecalleridnum':_0x1a8aa5['transfereecalleridnum'],'transfereecalleridname':_0x1a8aa5[_0xd68c('0xe')],'transfereeconnectedlinenum':_0x1a8aa5['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x1a8aa5[_0xd68c('0xf')],'transfereeaccountcode':_0x1a8aa5[_0xd68c('0x10')],'transfereecontext':_0x1a8aa5['transfereecontext'],'transfereeexten':_0x1a8aa5['transfereeexten'],'transfereelinkedid':_0x1a8aa5[_0xd68c('0x11')],'isexternal':_0x1a8aa5[_0xd68c('0x12')],'context':_0x1a8aa5[_0xd68c('0x13')],'extension':_0x1a8aa5[_0xd68c('0x14')],'type':_0xd68c('0x15')},'log':'CreateVoiceTransferReport'});};exports[_0xd68c('0x16')]=function(_0x196144){return client[_0xd68c('0x2')](_0xd68c('0x3'),{'body':{'result':_0x196144[_0xd68c('0x4')],'transfererchannel':_0x196144['origtransfererchannel'],'transferercalleridnum':_0x196144[_0xd68c('0x17')],'transferercalleridname':_0x196144[_0xd68c('0x18')],'transfererconnectedlinenum':_0x196144[_0xd68c('0x19')],'transfererconnectedlinename':_0x196144['secondtransfererconnectedlinename'],'transfereraccountcode':_0x196144[_0xd68c('0x1a')],'transferercontext':_0x196144['secondtransferercontext'],'transfererexten':_0x196144[_0xd68c('0x1b')],'transfererlinkedid':_0x196144[_0xd68c('0x1c')],'transfereechannel':_0x196144['transfertargetchannel'],'transfereecalleridnum':_0x196144[_0xd68c('0x1d')],'transfereecalleridname':_0x196144[_0xd68c('0x1e')],'transfereeconnectedlinenum':_0x196144['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x196144[_0xd68c('0x1f')],'transfereeaccountcode':_0x196144[_0xd68c('0x20')],'transfereecontext':_0x196144['transfertargetcontext'],'transfereeexten':_0x196144[_0xd68c('0x21')],'transfereelinkedid':_0x196144[_0xd68c('0x22')],'isexternal':_0x196144[_0xd68c('0x12')],'context':_0x196144[_0xd68c('0x23')],'extension':_0x196144[_0xd68c('0x24')],'type':_0xd68c('0x25')},'log':_0xd68c('0x3')});}; \ No newline at end of file +var _0xb8ff=['transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum'];(function(_0x2dae04,_0x29775b){var _0x585a45=function(_0x338c43){while(--_0x338c43){_0x2dae04['push'](_0x2dae04['shift']());}};_0x585a45(++_0x29775b);}(_0xb8ff,0x1ab));var _0xfb8f=function(_0x1da0ee,_0x1ea6e8){_0x1da0ee=_0x1da0ee-0x0;var _0x2429e9=_0xb8ff[_0x1da0ee];return _0x2429e9;};'use strict';var client=require(_0xfb8f('0x0'));exports[_0xfb8f('0x1')]={};exports[_0xfb8f('0x2')]=function(_0x42bc9a){return client[_0xfb8f('0x3')](_0xfb8f('0x4'),{'body':{'result':_0x42bc9a[_0xfb8f('0x5')],'transfererchannel':_0x42bc9a['transfererchannel'],'transferercalleridnum':_0x42bc9a['transferercalleridnum'],'transferercalleridname':_0x42bc9a[_0xfb8f('0x6')],'transfererconnectedlinenum':_0x42bc9a[_0xfb8f('0x7')],'transfererconnectedlinename':_0x42bc9a[_0xfb8f('0x8')],'transfereraccountcode':_0x42bc9a[_0xfb8f('0x9')],'transferercontext':_0x42bc9a[_0xfb8f('0xa')],'transfererexten':_0x42bc9a[_0xfb8f('0xb')],'transfererlinkedid':_0x42bc9a[_0xfb8f('0xc')],'transfereechannel':_0x42bc9a[_0xfb8f('0xd')],'transfereecalleridnum':_0x42bc9a[_0xfb8f('0xe')],'transfereecalleridname':_0x42bc9a[_0xfb8f('0xf')],'transfereeconnectedlinenum':_0x42bc9a[_0xfb8f('0x10')],'transfereeconnectedlinename':_0x42bc9a[_0xfb8f('0x11')],'transfereeaccountcode':_0x42bc9a[_0xfb8f('0x12')],'transfereecontext':_0x42bc9a['transfereecontext'],'transfereeexten':_0x42bc9a[_0xfb8f('0x13')],'transfereelinkedid':_0x42bc9a[_0xfb8f('0x14')],'isexternal':_0x42bc9a[_0xfb8f('0x15')],'context':_0x42bc9a[_0xfb8f('0x16')],'extension':_0x42bc9a['extension'],'type':_0xfb8f('0x17')},'log':_0xfb8f('0x4')});};exports[_0xfb8f('0x18')]=function(_0x148ac0){return client[_0xfb8f('0x3')](_0xfb8f('0x4'),{'body':{'result':_0x148ac0[_0xfb8f('0x5')],'transfererchannel':_0x148ac0[_0xfb8f('0x19')],'transferercalleridnum':_0x148ac0[_0xfb8f('0x1a')],'transferercalleridname':_0x148ac0[_0xfb8f('0x1b')],'transfererconnectedlinenum':_0x148ac0['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x148ac0[_0xfb8f('0x1c')],'transfereraccountcode':_0x148ac0[_0xfb8f('0x1d')],'transferercontext':_0x148ac0[_0xfb8f('0x1e')],'transfererexten':_0x148ac0[_0xfb8f('0x1f')],'transfererlinkedid':_0x148ac0[_0xfb8f('0x20')],'transfereechannel':_0x148ac0[_0xfb8f('0x21')],'transfereecalleridnum':_0x148ac0[_0xfb8f('0x22')],'transfereecalleridname':_0x148ac0[_0xfb8f('0x23')],'transfereeconnectedlinenum':_0x148ac0[_0xfb8f('0x24')],'transfereeconnectedlinename':_0x148ac0[_0xfb8f('0x25')],'transfereeaccountcode':_0x148ac0[_0xfb8f('0x26')],'transfereecontext':_0x148ac0[_0xfb8f('0x27')],'transfereeexten':_0x148ac0[_0xfb8f('0x28')],'transfereelinkedid':_0x148ac0['transfertargetlinkedid'],'isexternal':_0x148ac0[_0xfb8f('0x15')],'context':_0x148ac0['origtransferercontext'],'extension':_0x148ac0['origtransfererexten'],'type':_0xfb8f('0x29')},'log':_0xfb8f('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index be37f6c..bcf0a33 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 _0xee2c=['Interval','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','%s.%s','filename','wav','Action','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','StopMixMonitor','destinationchannel','status','stop','queueChannels','voicequeuechannelhangup','voicequeuechannelredirect','exten','context','telephones','trunks','outbound','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','then','message','catch','command','content','voiceQueues','hasOwnProperty','strategy','answered','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','callerid'];(function(_0x1de9a7,_0x517303){var _0x3fb33d=function(_0x1dc66e){while(--_0x1dc66e){_0x1de9a7['push'](_0x1de9a7['shift']());}};_0x3fb33d(++_0x517303);}(_0xee2c,0x1c7));var _0xcee2=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xee2c[_0x42bdad];return _0x122626;};'use strict';var _=require(_0xcee2('0x0'));var util=require('util');var jayson=require(_0xcee2('0x1'));var schema=require(_0xcee2('0x2'));var BPromise=require(_0xcee2('0x3'));var moment=require(_0xcee2('0x4'));var config=require('../../../config/environment');var properties=require('../properties');var ami=require(_0xcee2('0x5'));exports[_0xcee2('0x6')]=function(_0x49d04d,_0xae585b,_0x409944){return new BPromise(function(_0x12fa86,_0x3d7611){var _0x24ce33={'QueuePause':function(_0x5a8219){return new Promise(function(_0x52a4ac,_0xea6c3c){var _0x2059ef=util[_0xcee2('0x7')](_0xcee2('0x8'),_0xcee2('0x9'),_0x5a8219[_0xcee2('0xa')]);if(_0x49d04d[_0xcee2('0xb')]&&_0x49d04d[_0xcee2('0xb')][_0x2059ef]&&_0x49d04d['timers'][_0x2059ef][_0xcee2('0xc')]){_0x49d04d[_0xcee2('0xb')][_0x2059ef][_0xcee2('0xd')]();}if(_0x49d04d[_0xcee2('0xe')][_0x2059ef]){_0x49d04d[_0xcee2('0xe')][_0x2059ef]['updateStatusRealtime']({'statePause':_0x5a8219[_0xcee2('0xf')]?!![]:![]});}_0x52a4ac({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x50a306){var _0x5dad1e=this;return new Promise(function(_0xfa663a,_0x34cc92){if(ami[_0xcee2('0x10')]()==![]){return _0x34cc92(_0x5dad1e[_0xcee2('0x11')](0x1f4,[config['asterisk']['ip'],config[_0xcee2('0x12')][_0xcee2('0x13')],_0xcee2('0x14')][_0xcee2('0x15')]('\x20')));}_0x50a306=_[_0xcee2('0x16')](_0x50a306,_[_0xcee2('0x17')](properties[_0xcee2('0x18')]));_0x50a306[_0xcee2('0x19')]=_0xcee2('0x1a');return ami['Action'](_0x50a306)[_0xcee2('0x1b')](function(_0x548e47){_0xfa663a({'code':0xc8,'message':_0x548e47[_0xcee2('0x1c')]});})[_0xcee2('0x1d')](function(_0x2b2ea0){_0x34cc92(_0x5dad1e[_0xcee2('0x11')](0x1f5,_0x2b2ea0['message']));});});},'Command':function(_0x245811){var _0x317659=this;return new Promise(function(_0x19022a,_0x36af7f){if(ami[_0xcee2('0x10')]()==![]){return _0x36af7f(_0x317659[_0xcee2('0x11')](0x1f4,[config[_0xcee2('0x12')]['ip'],config[_0xcee2('0x12')][_0xcee2('0x13')],_0xcee2('0x14')][_0xcee2('0x15')]('\x20')));}_0x245811=_['pick'](_0x245811,_0xcee2('0x1e'));_0x245811[_0xcee2('0x19')]='Command';return ami['Action'](_0x245811)[_0xcee2('0x1b')](function(_0x4fa083){_0x19022a({'code':0xc8,'message':_0x4fa083[_0xcee2('0x1f')]});})[_0xcee2('0x1d')](function(_0x2edef5){_0x36af7f(_0x317659['error'](0x1f5,_0x2edef5['message']));});});},'VoiceQueues':function(_0x20a6de){return new Promise(function(_0x2ccc9c,_0x22789d){var _0x5905f6=[];for(var _0x2f18ec in _0x49d04d['voiceQueues']){if(_0x49d04d[_0xcee2('0x20')][_0xcee2('0x21')](_0x2f18ec)){var _0x14615a=_0x49d04d[_0xcee2('0x20')][_0x2f18ec];var _0x84d7c={'id':_0x14615a['id'],'name':_0x14615a[_0xcee2('0xa')],'strategy':_0x14615a[_0xcee2('0x22')],'answered':_0x14615a[_0xcee2('0x23')],'available':_0x14615a[_0xcee2('0x24')],'loggedIn':_0x14615a[_0xcee2('0x25')],'pTalking':_0x14615a[_0xcee2('0x26')],'sumBillable':_0x14615a['sumBillable'],'sumDuration':_0x14615a[_0xcee2('0x27')],'sumHoldTime':_0x14615a[_0xcee2('0x28')]||0x0,'talking':_0x14615a[_0xcee2('0x29')],'total':_0x14615a['total'],'type':_0x14615a[_0xcee2('0x2a')],'unmanaged':_0x14615a[_0xcee2('0x2b')],'abandoned':_0x14615a['abandoned'],'waiting':_0x14615a[_0xcee2('0x2c')],'loggedInDb':_0x14615a[_0xcee2('0x2d')]};if(_0x14615a['type']==='outbound'){_0x84d7c[_0xcee2('0x2e')]=_0x14615a['dialActive'];_0x84d7c['dialMethod']=_0x14615a[_0xcee2('0x2f')];_0x84d7c[_0xcee2('0x30')]=_0x14615a['dialOriginateCallerIdName'];_0x84d7c[_0xcee2('0x31')]=_0x14615a[_0xcee2('0x31')];_0x84d7c[_0xcee2('0x32')]=_0x14615a[_0xcee2('0x32')];_0x84d7c[_0xcee2('0x33')]=_0x14615a[_0xcee2('0x33')];_0x84d7c[_0xcee2('0x34')]=_0x14615a[_0xcee2('0x34')];_0x84d7c[_0xcee2('0x35')]=_0x14615a[_0xcee2('0x35')];_0x84d7c[_0xcee2('0x36')]=_0x14615a[_0xcee2('0x36')];_0x84d7c['outboundBlacklistCallsDay']=_0x14615a[_0xcee2('0x37')];_0x84d7c[_0xcee2('0x38')]=_0x14615a['outboundBusyCallsDay'];_0x84d7c[_0xcee2('0x39')]=_0x14615a[_0xcee2('0x39')];_0x84d7c['outboundDropCallsDayACS']=_0x14615a[_0xcee2('0x3a')];_0x84d7c[_0xcee2('0x3b')]=_0x14615a[_0xcee2('0x3b')];_0x84d7c['outboundDropCallsDayTimeout']=_0x14615a[_0xcee2('0x3c')];_0x84d7c[_0xcee2('0x3d')]=_0x14615a[_0xcee2('0x3d')];_0x84d7c[_0xcee2('0x3e')]=_0x14615a[_0xcee2('0x3e')];_0x84d7c[_0xcee2('0x3f')]=_0x14615a['outboundOriginateFailureCallsDay'];_0x84d7c[_0xcee2('0x40')]=_0x14615a[_0xcee2('0x40')];_0x84d7c[_0xcee2('0x41')]=_0x14615a['outboundRejectCallsDay'];_0x84d7c[_0xcee2('0x42')]=_0x14615a['outboundUnknownCallsDay'];_0x84d7c['predictiveIntervalAnsweredCalls']=_0x14615a[_0xcee2('0x43')];_0x84d7c[_0xcee2('0x44')]=_0x14615a[_0xcee2('0x44')];_0x84d7c[_0xcee2('0x45')]=_0x14615a[_0xcee2('0x45')];_0x84d7c[_0xcee2('0x46')]=_0x14615a['predictiveIntervalDroppedCallsCallersExit'];_0x84d7c['predictiveIntervalDroppedCallsTimeout']=_0x14615a['predictiveIntervalDroppedCallsTimeout'];_0x84d7c[_0xcee2('0x47')]=_0x14615a['predictiveIntervalErlangCalls'];_0x84d7c[_0xcee2('0x48')]=_0x14615a[_0xcee2('0x48')];_0x84d7c['predictiveIntervalHitRate']=_0x14615a[_0xcee2('0x49')];_0x84d7c['predictiveIntervalMultiplicativeFactor']=_0x14615a['predictiveIntervalMultiplicativeFactor'];_0x84d7c[_0xcee2('0x4a')]=_0x14615a[_0xcee2('0x4a')];_0x84d7c['predictiveIntervalAvailable']=_0x14615a['predictiveIntervalAvailable'];_0x84d7c[_0xcee2('0x4b')]=_0x14615a[_0xcee2('0x4b')];_0x84d7c[_0xcee2('0x1c')]=_0x14615a[_0xcee2('0x1c')];_0x84d7c[_0xcee2('0x4c')]=_0x14615a[_0xcee2('0x4c')];_0x84d7c[_0xcee2('0x4d')]=_0x14615a[_0xcee2('0x4d')];_0x84d7c[_0xcee2('0x4e')]=_0x14615a['erlangCallToSecond'];_0x84d7c[_0xcee2('0x4f')]=_0x14615a[_0xcee2('0x4f')];_0x84d7c[_0xcee2('0x50')]=_0x14615a[_0xcee2('0x50')];_0x84d7c['startPredictive']=_0x14615a[_0xcee2('0x51')];_0x84d7c[_0xcee2('0x52')]=_0x14615a[_0xcee2('0x52')];}if(_0x14615a[_0xcee2('0x53')]){_0x84d7c[_0xcee2('0x53')]={'id':_0x14615a[_0xcee2('0x53')]['id'],'name':_0x14615a[_0xcee2('0x53')][_0xcee2('0xa')],'active':_0x14615a[_0xcee2('0x53')]['active'],'callerid':_0x14615a[_0xcee2('0x53')][_0xcee2('0x54')]};}if(_0x14615a[_0xcee2('0x55')]){_0x84d7c['Interval']={'id':_0x14615a[_0xcee2('0x55')]['id'],'name':_0x14615a[_0xcee2('0x55')][_0xcee2('0xa')]};}_0x5905f6[_0xcee2('0x56')](_0x84d7c);}}_0x2ccc9c({'count':_0x5905f6[_0xcee2('0x57')],'rows':_0x5905f6});});},'UpdateVoiceQueue':function(_0x1a883a){return new Promise(function(_0x2f3cdd,_0x3af08a){var _0x27ec54=_[_0xcee2('0x58')](_0x49d04d[_0xcee2('0x20')],{'id':parseInt(_0x1a883a['id'])});var _0x4720c0=_[_0xcee2('0x59')](_0x1a883a,['id']);if(_0x27ec54){for(var _0xa98bc1 in _0x4720c0){if(typeof _0x4720c0[_0xa98bc1]!=='undefined'&&typeof _0x27ec54[_0xa98bc1]!==_0xcee2('0x5a')){_0x27ec54[_0xa98bc1]=_0x4720c0[_0xa98bc1];}}_0x2f3cdd(_0x27ec54);}else{_0x3af08a();}});},'VoiceChannels':function(_0x54ab70){return new Promise(function(_0x52c037,_0xe69b91){var _0x399291=_[_0xcee2('0x5b')](_0x49d04d[_0xcee2('0x5c')]);_0x52c037({'count':_0x399291[_0xcee2('0x57')],'rows':_0x399291});});},'VoiceChannelMixMonitor':function(_0x5e5011){var _0x10d8a6=this;return new Promise(function(_0x4b9864,_0x2f6cf0){if(ami[_0xcee2('0x10')]()==![]){return _0x2f6cf0(_0x10d8a6[_0xcee2('0x11')](0x1f4,[config[_0xcee2('0x12')]['ip'],config[_0xcee2('0x12')][_0xcee2('0x13')],_0xcee2('0x14')]['join']('\x20')));}var _0xfbd8d2=schema(properties[_0xcee2('0x5d')])[_0xcee2('0x2')](_0x5e5011);if(_0xfbd8d2[_0xcee2('0x57')]>0x0){return _0x2f6cf0(_0x10d8a6[_0xcee2('0x11')](0x1f4,_[_0xcee2('0x5e')](_0xfbd8d2,_0xcee2('0x1c'))[_0xcee2('0x15')](',\x20')));}var _0x228c88=_['find'](_0x49d04d['channels'],{'uniqueid':_0x5e5011[_0xcee2('0x5f')]});if(_0x228c88&&_0x228c88[_0xcee2('0x60')]){var _0x4b888f=util[_0xcee2('0x7')](_0xcee2('0x61'),_0x5e5011[_0xcee2('0x62')]||_0x5e5011[_0xcee2('0x5f')],_0x5e5011[_0xcee2('0x7')]||_0xcee2('0x63'));return ami[_0xcee2('0x64')]({'action':'MixMonitor','channel':_0x228c88['channel'],'file':_0x4b888f,'options':'ai(mixmonitorid)'})[_0xcee2('0x1b')](function(_0x3e0aa8){var _0x841efa=_['find'](_0x228c88[_0xcee2('0x65')],{'filename':_0xcee2('0x66')+_0x4b888f[_0xcee2('0x67')]()});if(_['isNil'](_0x841efa)){_0x228c88[_0xcee2('0x65')][_0xcee2('0x56')]({'filename':_0xcee2('0x66')+_0x4b888f['toLowerCase'](),'createdAt':moment()[_0xcee2('0x7')](_0xcee2('0x68')),'mixmonitorid':_0x3e0aa8[_0xcee2('0x69')],'status':_0xcee2('0x6a')});}else{_0x841efa['mixmonitorid']=_0x3e0aa8['mixmonitorid'];_0x841efa['status']=_0xcee2('0x6a');}_0x4b9864({'code':0xc8,'message':[_0x5e5011[_0xcee2('0x5f')],_0xcee2('0x6b'),_0x3e0aa8[_0xcee2('0x69')]][_0xcee2('0x15')]('\x20'),'mixmonitorid':_0x3e0aa8[_0xcee2('0x69')]});})[_0xcee2('0x1d')](function(_0x4c9a97){_0x2f6cf0(_0x10d8a6[_0xcee2('0x11')](0x1f5,[_0x5e5011[_0xcee2('0x5f')],_0x4c9a97[_0xcee2('0x1c')]['toLowerCase']()][_0xcee2('0x15')]('\x20')));});}else{return _0x2f6cf0(_0x10d8a6[_0xcee2('0x11')](0x1f5,_0xcee2('0x6c')));}});},'VoiceChannelStopMixMonitor':function(_0x1bb852){var _0x289744=this;return new Promise(function(_0x310098,_0x325f62){if(ami[_0xcee2('0x10')]()==![]){return _0x325f62(_0x289744['error'](0x1f4,[config[_0xcee2('0x12')]['ip'],config[_0xcee2('0x12')][_0xcee2('0x13')],_0xcee2('0x14')][_0xcee2('0x15')]('\x20')));}var _0x297e70=schema(properties[_0xcee2('0x5d')])[_0xcee2('0x2')](_0x1bb852);if(_0x297e70[_0xcee2('0x57')]>0x0){return _0x325f62(_0x289744[_0xcee2('0x11')](0x1f4,_['map'](_0x297e70,'message')[_0xcee2('0x15')](',\x20')));}var _0xaf7f73=_[_0xcee2('0x58')](_0x49d04d['channels'],{'uniqueid':_0x1bb852['uniqueid']});if(_0xaf7f73){return BPromise['resolve']()[_0xcee2('0x1b')](function(){if(_0xaf7f73['channel']){return ami['Action']({'action':_0xcee2('0x6d'),'channel':_0xaf7f73['channel'],'mixmonitorid':_0x1bb852[_0xcee2('0x69')]})[_0xcee2('0x1d')](function(_0x4920a1){});}})[_0xcee2('0x1b')](function(){if(_0xaf7f73[_0xcee2('0x6e')]){return ami['Action']({'action':'StopMixMonitor','channel':_0xaf7f73[_0xcee2('0x6e')],'mixmonitorid':_0x1bb852[_0xcee2('0x69')]})[_0xcee2('0x1d')](function(_0x1b07b5){});}})[_0xcee2('0x1b')](function(_0x4faaef){var _0x41521f=_[_0xcee2('0x58')](_0xaf7f73[_0xcee2('0x65')],{'mixmonitorid':_0x1bb852[_0xcee2('0x69')]});if(_0x41521f){_0x41521f[_0xcee2('0x6f')]=_0xcee2('0x70');}})[_0xcee2('0x1b')](function(){var _0xa2f8b0=util[_0xcee2('0x7')](_0xcee2('0x61'),_0x1bb852[_0xcee2('0x62')]||_0x1bb852[_0xcee2('0x5f')],_0x1bb852['format']||_0xcee2('0x63'));var _0x19feb8=_[_0xcee2('0x58')](_0xaf7f73['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0xa2f8b0[_0xcee2('0x67')]()});if(_0x19feb8){_0x19feb8[_0xcee2('0x6f')]=_0xcee2('0x70');}})[_0xcee2('0x1b')](function(){_0x310098({'code':0xc8,'message':[_0x1bb852['uniqueid'],'StopMixMonitor\x20Success'][_0xcee2('0x15')]('\x20')});})[_0xcee2('0x1d')](function(_0x81f30a){_0x325f62(_0x289744[_0xcee2('0x11')](0x1f5,[_0x1bb852[_0xcee2('0x5f')],_0x81f30a['message']['toLowerCase']()][_0xcee2('0x15')]('\x20')));});}else{return _0x325f62(_0x289744[_0xcee2('0x11')](0x1f5,_0xcee2('0x6c')));}});},'VoiceQueuesChannels':function(_0xd39003){return new Promise(function(_0x3ba2d0,_0x4ea04a){var _0x3796cf=_['values'](_0x49d04d[_0xcee2('0x71')]);_0x3ba2d0({'count':_0x3796cf[_0xcee2('0x57')],'rows':_0x3796cf});});},'VoiceQueuesChannel':function(_0x2c9497){var _0x3f11e2=this;return new Promise(function(_0x59d2fe,_0xc64dbb){var _0x4edaba=schema(properties['voicequeuechannel'])[_0xcee2('0x2')](_0x2c9497);if(_0x4edaba[_0xcee2('0x57')]>0x0){return _0xc64dbb(_0x3f11e2[_0xcee2('0x11')](0x1f4,_[_0xcee2('0x5e')](_0x4edaba,'message')[_0xcee2('0x15')](',\x20')));}var _0x51599d=_['find'](_0x49d04d[_0xcee2('0x71')],{'uniqueid':_0x2c9497[_0xcee2('0x5f')]});if(_0x51599d){_0x59d2fe(_0x51599d);}else{return _0xc64dbb(_0x3f11e2[_0xcee2('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x17cd07){var _0x5bbd36=this;return new Promise(function(_0x1c7436,_0x5a44be){if(ami[_0xcee2('0x10')]()==![]){return _0x5a44be(_0x5bbd36['error'](0x1f4,[config[_0xcee2('0x12')]['ip'],config[_0xcee2('0x12')][_0xcee2('0x13')],_0xcee2('0x14')][_0xcee2('0x15')]('\x20')));}var _0x43bf19=schema(properties[_0xcee2('0x72')])[_0xcee2('0x2')](_0x17cd07);if(_0x43bf19[_0xcee2('0x57')]>0x0){return _0x5a44be(_0x5bbd36[_0xcee2('0x11')](0x1f4,_[_0xcee2('0x5e')](_0x43bf19,_0xcee2('0x1c'))[_0xcee2('0x15')](',\x20')));}var _0x292549=_[_0xcee2('0x58')](_0x49d04d[_0xcee2('0x71')],{'uniqueid':_0x17cd07[_0xcee2('0x5f')]});if(_0x292549&&_0x292549[_0xcee2('0x60')]){return ami[_0xcee2('0x64')]({'action':'Hangup','channel':_0x292549[_0xcee2('0x60')]})[_0xcee2('0x1b')](function(_0x586b40){_0x1c7436({'code':0xc8,'message':[_0x17cd07[_0xcee2('0x5f')],_0x586b40[_0xcee2('0x1c')][_0xcee2('0x67')]()][_0xcee2('0x15')]('\x20')});})[_0xcee2('0x1d')](function(_0x355834){_0x5a44be(_0x5bbd36[_0xcee2('0x11')](0x1f5,[_0x17cd07[_0xcee2('0x5f')],_0x355834[_0xcee2('0x1c')][_0xcee2('0x67')]()]['join']('\x20')));});}else{return _0x5a44be(_0x5bbd36[_0xcee2('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x109b85){var _0x2907f1=this;return new Promise(function(_0x132436,_0x4025f2){if(ami['isConnected']()==![]){return _0x4025f2(_0x2907f1['error'](0x1f4,[config[_0xcee2('0x12')]['ip'],config['asterisk'][_0xcee2('0x13')],_0xcee2('0x14')][_0xcee2('0x15')]('\x20')));}var _0x10db5b=schema(properties[_0xcee2('0x73')])['validate'](_0x109b85);if(_0x10db5b['length']>0x0){return _0x4025f2(_0x2907f1[_0xcee2('0x11')](0x1f4,_[_0xcee2('0x5e')](_0x10db5b,'message')['join'](',\x20')));}var _0x1f1676=_[_0xcee2('0x58')](_0x49d04d[_0xcee2('0x71')],{'uniqueid':_0x109b85['uniqueid']});if(_0x1f1676&&_0x1f1676['channel']){return ami[_0xcee2('0x64')]({'action':'Redirect','channel':_0x1f1676['channel'],'exten':_0x109b85[_0xcee2('0x74')],'context':_0x109b85[_0xcee2('0x75')]||_0x1f1676[_0xcee2('0x75')],'priority':0x1})[_0xcee2('0x1b')](function(_0xf3d804){_0x132436({'code':0xc8,'message':[_0x109b85[_0xcee2('0x5f')],_0xf3d804[_0xcee2('0x1c')][_0xcee2('0x67')]()][_0xcee2('0x15')]('\x20')});})[_0xcee2('0x1d')](function(_0x21bbb5){_0x4025f2(_0x2907f1[_0xcee2('0x11')](0x1f5,[_0x109b85[_0xcee2('0x5f')],_0x21bbb5[_0xcee2('0x1c')]['toLowerCase']()][_0xcee2('0x15')]('\x20')));});}else{return _0x4025f2(_0x2907f1[_0xcee2('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x2057fb){return new Promise(function(_0x203572,_0x472e15){var _0x58511f=_['values'](_0x49d04d['agents']);_0x203572({'count':_0x58511f[_0xcee2('0x57')],'rows':_0x58511f});});},'Telephones':function(_0x2afc1e){return new Promise(function(_0x2d1a5e,_0x10fd3a){var _0x5e2d43=_['values'](_0x49d04d[_0xcee2('0x76')]);_0x2d1a5e({'count':_0x5e2d43[_0xcee2('0x57')],'rows':_0x5e2d43});});},'Trunks':function(_0x42cd1d){return new Promise(function(_0x255f8a,_0x10c8c4){var _0x56900e=_[_0xcee2('0x5b')](_0x49d04d[_0xcee2('0x77')]);_0x255f8a({'count':_0x56900e[_0xcee2('0x57')],'rows':_0x56900e});});},'OutboundChannels':function(_0x4c755a){return new Promise(function(_0x19c2e4,_0x28f6a9){var _0x51f8ff=_[_0xcee2('0x5b')](_0x49d04d['outboundChannels']);_0x19c2e4({'count':_0x51f8ff[_0xcee2('0x57')],'rows':_0x51f8ff});});},'Outbound':function(_0x30848b){return new Promise(function(_0x31c0f6,_0x6e6bff){_0x31c0f6(_0x49d04d[_0xcee2('0x78')]);});},'Campaigns':function(_0x4d753f){return new Promise(function(_0x51c204,_0x977c1a){var _0xc18245=_['values'](_0x49d04d[_0xcee2('0x79')]);_0x51c204({'count':_0xc18245[_0xcee2('0x57')],'rows':_0xc18245});});},'VoiceQueuesPreview':function(_0x1ecbbf){var _0x352100=this;return new Promise(function(_0x2c3d40,_0x58e5e5){_0xae585b[_0xcee2('0x7a')](_0x1ecbbf['id'])[_0xcee2('0x1b')](function(_0x3163d7){_0x2c3d40({'code':0xc8,'message':_0x3163d7[_0xcee2('0x1c')]});})['catch'](function(_0x3ba30c){_0x58e5e5(_0x352100[_0xcee2('0x11')](0x1f4,_0x3ba30c[_0xcee2('0x1c')]));});});},'EventManager':function(_0x1c18c0){var _0xdc2285=this;return new Promise(function(_0x13748b,_0xad1457){if(!_0x1c18c0[_0xcee2('0x7b')]){return _0xad1457(_0xdc2285[_0xcee2('0x11')](0x1f4,_0xcee2('0x7c')));}ami[_0xcee2('0x7d')](_0xcee2('0x7e')+_0x1c18c0[_0xcee2('0x7b')],_0x1c18c0[_0xcee2('0x1c')]);_0x13748b({'code':0xc8,'message':_0x1c18c0});});},'FaxAccounts':function(_0x2d0bfb){return new Promise(function(_0x49a1a5,_0x46c635){var _0x450e2a=_[_0xcee2('0x5b')](_0x49d04d['faxAccounts']);_0x49a1a5({'count':_0x450e2a[_0xcee2('0x57')],'rows':_0x450e2a});});},'SendFax':function(_0x75e016){var _0x5a8347=this;return new Promise(function(_0x3365ee,_0x532417){_0x409944[_0xcee2('0x7f')](_0x75e016)[_0xcee2('0x1b')](function(_0x257650){_0x3365ee({'code':0xc8,'message':_0x257650[_0xcee2('0x1c')]});})[_0xcee2('0x1d')](function(_0x17c838){_0x532417(_0x5a8347[_0xcee2('0x11')](0x1f4,_0x17c838[_0xcee2('0x1c')]));});});},'CheckAfterSend':function(_0x1db3c3){var _0x467911=this;return new Promise(function(_0x26ed21,_0x292045){_0x409944[_0xcee2('0x80')](_0x1db3c3)[_0xcee2('0x1b')](function(_0x5e8544){_0x26ed21({'code':0xc8,'message':_0x5e8544[_0xcee2('0x1c')]});})[_0xcee2('0x1d')](function(_0x558776){_0x292045(_0x467911[_0xcee2('0x11')](0x1f4,_0x558776[_0xcee2('0x1c')]));});});}};var _0x18b013=jayson[_0xcee2('0x81')](_0x24ce33)[_0xcee2('0x82')]();_0x18b013['on'](_0xcee2('0x11'),function(_0x1fce50){return _0x3d7611(_0x1fce50);});_0x18b013[_0xcee2('0x6')](0x232a,_0xcee2('0x83'),function(){console[_0xcee2('0x84')](_0xcee2('0x85'),0x232a);return _0x12fa86(_0xcee2('0x86')+0x232a);});});}; \ No newline at end of file +var _0xf072=['active','callerid','Interval','push','length','undefined','values','voicechannel','validate','find','channels','uniqueid','channel','filename','wav','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','map','resolve','destinationchannel','StopMixMonitor','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','context','agents','telephones','trunks','outboundChannels','outbound','campaigns','event','emit','custom:','faxAccounts','send','checkAfterSend','server','listen','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','../../../config/environment','../properties','../ami','format','%s/%s','SIP','name','timers','timer','updateAcw','updateStatusRealtime','pause','isConnected','error','asterisk','username','ami\x20disconnected','pick','module','action','Reload','Action','then','message','catch','join','command','Command','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','total','type','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk'];(function(_0x280e11,_0x136cd0){var _0x1211a6=function(_0x2b4413){while(--_0x2b4413){_0x280e11['push'](_0x280e11['shift']());}};_0x1211a6(++_0x136cd0);}(_0xf072,0x1cf));var _0x2f07=function(_0x4a44e4,_0x201c58){_0x4a44e4=_0x4a44e4-0x0;var _0x3b96c7=_0xf072[_0x4a44e4];return _0x3b96c7;};'use strict';var _=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var jayson=require(_0x2f07('0x2'));var schema=require('validate');var BPromise=require(_0x2f07('0x3'));var moment=require('moment');var config=require(_0x2f07('0x4'));var properties=require(_0x2f07('0x5'));var ami=require(_0x2f07('0x6'));exports['listen']=function(_0x1d5a33,_0x14d6e6,_0x3643bb){return new BPromise(function(_0x2e6422,_0x235418){var _0xf73d1a={'QueuePause':function(_0x33b99c){return new Promise(function(_0x379b2e,_0x4746c2){var _0x2e167=util[_0x2f07('0x7')](_0x2f07('0x8'),_0x2f07('0x9'),_0x33b99c[_0x2f07('0xa')]);if(_0x1d5a33[_0x2f07('0xb')]&&_0x1d5a33['timers'][_0x2e167]&&_0x1d5a33[_0x2f07('0xb')][_0x2e167][_0x2f07('0xc')]){_0x1d5a33[_0x2f07('0xb')][_0x2e167][_0x2f07('0xd')]();}if(_0x1d5a33['agents'][_0x2e167]){_0x1d5a33['agents'][_0x2e167][_0x2f07('0xe')]({'statePause':_0x33b99c[_0x2f07('0xf')]?!![]:![]});}_0x379b2e({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x6eb88a){var _0x34dbd4=this;return new Promise(function(_0x26edfa,_0x4dceb1){if(ami[_0x2f07('0x10')]()==![]){return _0x4dceb1(_0x34dbd4[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')]['join']('\x20')));}_0x6eb88a=_[_0x2f07('0x15')](_0x6eb88a,_['keys'](properties[_0x2f07('0x16')]));_0x6eb88a[_0x2f07('0x17')]=_0x2f07('0x18');return ami[_0x2f07('0x19')](_0x6eb88a)[_0x2f07('0x1a')](function(_0x46c9b4){_0x26edfa({'code':0xc8,'message':_0x46c9b4[_0x2f07('0x1b')]});})[_0x2f07('0x1c')](function(_0x55bd60){_0x4dceb1(_0x34dbd4[_0x2f07('0x11')](0x1f5,_0x55bd60['message']));});});},'Command':function(_0x3cd3c0){var _0x2df6ed=this;return new Promise(function(_0x119b68,_0xd944d6){if(ami[_0x2f07('0x10')]()==![]){return _0xd944d6(_0x2df6ed['error'](0x1f4,[config[_0x2f07('0x12')]['ip'],config['asterisk']['username'],'ami\x20disconnected'][_0x2f07('0x1d')]('\x20')));}_0x3cd3c0=_['pick'](_0x3cd3c0,_0x2f07('0x1e'));_0x3cd3c0['action']=_0x2f07('0x1f');return ami[_0x2f07('0x19')](_0x3cd3c0)[_0x2f07('0x1a')](function(_0x307888){_0x119b68({'code':0xc8,'message':_0x307888['content']});})[_0x2f07('0x1c')](function(_0x428d8c){_0xd944d6(_0x2df6ed[_0x2f07('0x11')](0x1f5,_0x428d8c['message']));});});},'VoiceQueues':function(_0x111376){return new Promise(function(_0x113916,_0x522006){var _0x1dcedc=[];for(var _0x1c9ca1 in _0x1d5a33['voiceQueues']){if(_0x1d5a33[_0x2f07('0x20')]['hasOwnProperty'](_0x1c9ca1)){var _0x894cd4=_0x1d5a33[_0x2f07('0x20')][_0x1c9ca1];var _0x27bd72={'id':_0x894cd4['id'],'name':_0x894cd4[_0x2f07('0xa')],'strategy':_0x894cd4[_0x2f07('0x21')],'answered':_0x894cd4[_0x2f07('0x22')],'available':_0x894cd4[_0x2f07('0x23')],'loggedIn':_0x894cd4[_0x2f07('0x24')],'pTalking':_0x894cd4[_0x2f07('0x25')],'sumBillable':_0x894cd4[_0x2f07('0x26')],'sumDuration':_0x894cd4[_0x2f07('0x27')],'sumHoldTime':_0x894cd4[_0x2f07('0x28')]||0x0,'talking':_0x894cd4['talking'],'total':_0x894cd4[_0x2f07('0x29')],'type':_0x894cd4[_0x2f07('0x2a')],'unmanaged':_0x894cd4[_0x2f07('0x2b')],'abandoned':_0x894cd4['abandoned'],'waiting':_0x894cd4[_0x2f07('0x2c')],'loggedInDb':_0x894cd4[_0x2f07('0x2d')]};if(_0x894cd4[_0x2f07('0x2a')]==='outbound'){_0x27bd72[_0x2f07('0x2e')]=_0x894cd4[_0x2f07('0x2e')];_0x27bd72[_0x2f07('0x2f')]=_0x894cd4[_0x2f07('0x2f')];_0x27bd72[_0x2f07('0x30')]=_0x894cd4[_0x2f07('0x30')];_0x27bd72[_0x2f07('0x31')]=_0x894cd4['dialOriginateCallerIdNumber'];_0x27bd72[_0x2f07('0x32')]=_0x894cd4['dialOriginateTimeout'];_0x27bd72[_0x2f07('0x33')]=_0x894cd4[_0x2f07('0x33')];_0x27bd72[_0x2f07('0x34')]=_0x894cd4[_0x2f07('0x34')];_0x27bd72[_0x2f07('0x35')]=_0x894cd4[_0x2f07('0x35')];_0x27bd72[_0x2f07('0x36')]=_0x894cd4[_0x2f07('0x36')];_0x27bd72[_0x2f07('0x37')]=_0x894cd4[_0x2f07('0x37')];_0x27bd72[_0x2f07('0x38')]=_0x894cd4[_0x2f07('0x38')];_0x27bd72[_0x2f07('0x39')]=_0x894cd4[_0x2f07('0x39')];_0x27bd72[_0x2f07('0x3a')]=_0x894cd4[_0x2f07('0x3a')];_0x27bd72['outboundDropCallsDayCallersExit']=_0x894cd4['outboundDropCallsDayCallersExit'];_0x27bd72[_0x2f07('0x3b')]=_0x894cd4[_0x2f07('0x3b')];_0x27bd72[_0x2f07('0x3c')]=_0x894cd4['outboundNoAnswerCallsDay'];_0x27bd72['outboundNoSuchCallsDay']=_0x894cd4[_0x2f07('0x3d')];_0x27bd72['outboundOriginateFailureCallsDay']=_0x894cd4[_0x2f07('0x3e')];_0x27bd72[_0x2f07('0x3f')]=_0x894cd4[_0x2f07('0x3f')];_0x27bd72[_0x2f07('0x40')]=_0x894cd4[_0x2f07('0x40')];_0x27bd72['outboundUnknownCallsDay']=_0x894cd4[_0x2f07('0x41')];_0x27bd72['predictiveIntervalAnsweredCalls']=_0x894cd4[_0x2f07('0x42')];_0x27bd72['predictiveIntervalAvgHoldtime']=_0x894cd4[_0x2f07('0x43')];_0x27bd72['predictiveIntervalAvgTalktime']=_0x894cd4['predictiveIntervalAvgTalktime'];_0x27bd72[_0x2f07('0x44')]=_0x894cd4[_0x2f07('0x44')];_0x27bd72['predictiveIntervalDroppedCallsTimeout']=_0x894cd4[_0x2f07('0x45')];_0x27bd72[_0x2f07('0x46')]=_0x894cd4[_0x2f07('0x46')];_0x27bd72['predictiveIntervalErlangCallsDroppedCalls']=_0x894cd4[_0x2f07('0x47')];_0x27bd72[_0x2f07('0x48')]=_0x894cd4[_0x2f07('0x48')];_0x27bd72[_0x2f07('0x49')]=_0x894cd4[_0x2f07('0x49')];_0x27bd72[_0x2f07('0x4a')]=_0x894cd4[_0x2f07('0x4a')];_0x27bd72[_0x2f07('0x4b')]=_0x894cd4['predictiveIntervalAvailable'];_0x27bd72[_0x2f07('0x4c')]=_0x894cd4[_0x2f07('0x4c')];_0x27bd72[_0x2f07('0x1b')]=_0x894cd4[_0x2f07('0x1b')];_0x27bd72[_0x2f07('0x4d')]=_0x894cd4[_0x2f07('0x4d')];_0x27bd72[_0x2f07('0x4e')]=_0x894cd4['erlangCalls'];_0x27bd72[_0x2f07('0x4f')]=_0x894cd4[_0x2f07('0x4f')];_0x27bd72[_0x2f07('0x50')]=_0x894cd4[_0x2f07('0x50')];_0x27bd72[_0x2f07('0x51')]=_0x894cd4[_0x2f07('0x51')];_0x27bd72['startPredictive']=_0x894cd4[_0x2f07('0x52')];_0x27bd72[_0x2f07('0x53')]=_0x894cd4[_0x2f07('0x53')];}if(_0x894cd4[_0x2f07('0x54')]){_0x27bd72['Trunk']={'id':_0x894cd4['Trunk']['id'],'name':_0x894cd4[_0x2f07('0x54')][_0x2f07('0xa')],'active':_0x894cd4[_0x2f07('0x54')][_0x2f07('0x55')],'callerid':_0x894cd4['Trunk'][_0x2f07('0x56')]};}if(_0x894cd4[_0x2f07('0x57')]){_0x27bd72[_0x2f07('0x57')]={'id':_0x894cd4[_0x2f07('0x57')]['id'],'name':_0x894cd4[_0x2f07('0x57')][_0x2f07('0xa')]};}_0x1dcedc[_0x2f07('0x58')](_0x27bd72);}}_0x113916({'count':_0x1dcedc[_0x2f07('0x59')],'rows':_0x1dcedc});});},'UpdateVoiceQueue':function(_0xf10865){return new Promise(function(_0xb9a4e9,_0x569ea9){var _0x5f33b3=_['find'](_0x1d5a33[_0x2f07('0x20')],{'id':parseInt(_0xf10865['id'])});var _0x320ad1=_['omit'](_0xf10865,['id']);if(_0x5f33b3){for(var _0x97c166 in _0x320ad1){if(typeof _0x320ad1[_0x97c166]!=='undefined'&&typeof _0x5f33b3[_0x97c166]!==_0x2f07('0x5a')){_0x5f33b3[_0x97c166]=_0x320ad1[_0x97c166];}}_0xb9a4e9(_0x5f33b3);}else{_0x569ea9();}});},'VoiceChannels':function(_0x83d27a){return new Promise(function(_0x1c4abe,_0x53e945){var _0x33f888=_[_0x2f07('0x5b')](_0x1d5a33['channels']);_0x1c4abe({'count':_0x33f888['length'],'rows':_0x33f888});});},'VoiceChannelMixMonitor':function(_0xe8b6b4){var _0x3a2cb1=this;return new Promise(function(_0x516260,_0x363245){if(ami[_0x2f07('0x10')]()==![]){return _0x363245(_0x3a2cb1[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x1d')]('\x20')));}var _0x9a94c8=schema(properties[_0x2f07('0x5c')])[_0x2f07('0x5d')](_0xe8b6b4);if(_0x9a94c8[_0x2f07('0x59')]>0x0){return _0x363245(_0x3a2cb1[_0x2f07('0x11')](0x1f4,_['map'](_0x9a94c8,_0x2f07('0x1b'))[_0x2f07('0x1d')](',\x20')));}var _0x38083a=_[_0x2f07('0x5e')](_0x1d5a33[_0x2f07('0x5f')],{'uniqueid':_0xe8b6b4[_0x2f07('0x60')]});if(_0x38083a&&_0x38083a[_0x2f07('0x61')]){var _0x23a8ee=util[_0x2f07('0x7')]('%s.%s',_0xe8b6b4[_0x2f07('0x62')]||_0xe8b6b4[_0x2f07('0x60')],_0xe8b6b4[_0x2f07('0x7')]||_0x2f07('0x63'));return ami['Action']({'action':'MixMonitor','channel':_0x38083a[_0x2f07('0x61')],'file':_0x23a8ee,'options':_0x2f07('0x64')})['then'](function(_0x510b35){var _0xc3b506=_['find'](_0x38083a[_0x2f07('0x65')],{'filename':_0x2f07('0x66')+_0x23a8ee[_0x2f07('0x67')]()});if(_[_0x2f07('0x68')](_0xc3b506)){_0x38083a[_0x2f07('0x65')][_0x2f07('0x58')]({'filename':_0x2f07('0x66')+_0x23a8ee[_0x2f07('0x67')](),'createdAt':moment()[_0x2f07('0x7')](_0x2f07('0x69')),'mixmonitorid':_0x510b35['mixmonitorid'],'status':_0x2f07('0x6a')});}else{_0xc3b506[_0x2f07('0x6b')]=_0x510b35[_0x2f07('0x6b')];_0xc3b506[_0x2f07('0x6c')]='rec';}_0x516260({'code':0xc8,'message':[_0xe8b6b4[_0x2f07('0x60')],'MixMonitor\x20Success',_0x510b35['mixmonitorid']]['join']('\x20'),'mixmonitorid':_0x510b35[_0x2f07('0x6b')]});})[_0x2f07('0x1c')](function(_0x111096){_0x363245(_0x3a2cb1[_0x2f07('0x11')](0x1f5,[_0xe8b6b4[_0x2f07('0x60')],_0x111096['message'][_0x2f07('0x67')]()][_0x2f07('0x1d')]('\x20')));});}else{return _0x363245(_0x3a2cb1[_0x2f07('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x58cba8){var _0x488dec=this;return new Promise(function(_0x64762c,_0x4c9b01){if(ami[_0x2f07('0x10')]()==![]){return _0x4c9b01(_0x488dec[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x1d')]('\x20')));}var _0x4f03a1=schema(properties[_0x2f07('0x5c')])[_0x2f07('0x5d')](_0x58cba8);if(_0x4f03a1['length']>0x0){return _0x4c9b01(_0x488dec['error'](0x1f4,_[_0x2f07('0x6d')](_0x4f03a1,'message')['join'](',\x20')));}var _0x580441=_['find'](_0x1d5a33[_0x2f07('0x5f')],{'uniqueid':_0x58cba8['uniqueid']});if(_0x580441){return BPromise[_0x2f07('0x6e')]()[_0x2f07('0x1a')](function(){if(_0x580441[_0x2f07('0x61')]){return ami[_0x2f07('0x19')]({'action':'StopMixMonitor','channel':_0x580441[_0x2f07('0x61')],'mixmonitorid':_0x58cba8[_0x2f07('0x6b')]})[_0x2f07('0x1c')](function(_0x3eb1ea){});}})['then'](function(){if(_0x580441[_0x2f07('0x6f')]){return ami[_0x2f07('0x19')]({'action':_0x2f07('0x70'),'channel':_0x580441[_0x2f07('0x6f')],'mixmonitorid':_0x58cba8['mixmonitorid']})[_0x2f07('0x1c')](function(_0x365298){});}})[_0x2f07('0x1a')](function(_0x28b3c3){var _0x58cfe6=_[_0x2f07('0x5e')](_0x580441['monitors'],{'mixmonitorid':_0x58cba8[_0x2f07('0x6b')]});if(_0x58cfe6){_0x58cfe6[_0x2f07('0x6c')]=_0x2f07('0x71');}})[_0x2f07('0x1a')](function(){var _0x5990d5=util[_0x2f07('0x7')](_0x2f07('0x72'),_0x58cba8['filename']||_0x58cba8[_0x2f07('0x60')],_0x58cba8[_0x2f07('0x7')]||'wav');var _0x356473=_[_0x2f07('0x5e')](_0x580441[_0x2f07('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x5990d5['toLowerCase']()});if(_0x356473){_0x356473[_0x2f07('0x6c')]=_0x2f07('0x71');}})['then'](function(){_0x64762c({'code':0xc8,'message':[_0x58cba8[_0x2f07('0x60')],_0x2f07('0x73')][_0x2f07('0x1d')]('\x20')});})[_0x2f07('0x1c')](function(_0x11e961){_0x4c9b01(_0x488dec[_0x2f07('0x11')](0x1f5,[_0x58cba8[_0x2f07('0x60')],_0x11e961[_0x2f07('0x1b')]['toLowerCase']()]['join']('\x20')));});}else{return _0x4c9b01(_0x488dec['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x5433c1){return new Promise(function(_0x503d9b,_0x4f76ac){var _0x3cca6d=_[_0x2f07('0x5b')](_0x1d5a33[_0x2f07('0x74')]);_0x503d9b({'count':_0x3cca6d[_0x2f07('0x59')],'rows':_0x3cca6d});});},'VoiceQueuesChannel':function(_0x49ae15){var _0x2fb109=this;return new Promise(function(_0xed7e01,_0x1e265a){var _0x33365c=schema(properties['voicequeuechannel'])[_0x2f07('0x5d')](_0x49ae15);if(_0x33365c[_0x2f07('0x59')]>0x0){return _0x1e265a(_0x2fb109['error'](0x1f4,_['map'](_0x33365c,'message')['join'](',\x20')));}var _0x8c5a=_[_0x2f07('0x5e')](_0x1d5a33[_0x2f07('0x74')],{'uniqueid':_0x49ae15['uniqueid']});if(_0x8c5a){_0xed7e01(_0x8c5a);}else{return _0x1e265a(_0x2fb109[_0x2f07('0x11')](0x1f5,_0x2f07('0x75')));}});},'VoiceQueuesChannelHangup':function(_0x332d91){var _0x455841=this;return new Promise(function(_0x285df7,_0x11ed87){if(ami[_0x2f07('0x10')]()==![]){return _0x11ed87(_0x455841[_0x2f07('0x11')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x1d')]('\x20')));}var _0x2ee500=schema(properties[_0x2f07('0x76')])[_0x2f07('0x5d')](_0x332d91);if(_0x2ee500[_0x2f07('0x59')]>0x0){return _0x11ed87(_0x455841[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x6d')](_0x2ee500,_0x2f07('0x1b'))[_0x2f07('0x1d')](',\x20')));}var _0x5effb2=_[_0x2f07('0x5e')](_0x1d5a33[_0x2f07('0x74')],{'uniqueid':_0x332d91[_0x2f07('0x60')]});if(_0x5effb2&&_0x5effb2[_0x2f07('0x61')]){return ami[_0x2f07('0x19')]({'action':'Hangup','channel':_0x5effb2[_0x2f07('0x61')]})[_0x2f07('0x1a')](function(_0x212d68){_0x285df7({'code':0xc8,'message':[_0x332d91[_0x2f07('0x60')],_0x212d68[_0x2f07('0x1b')][_0x2f07('0x67')]()]['join']('\x20')});})[_0x2f07('0x1c')](function(_0x33d20b){_0x11ed87(_0x455841['error'](0x1f5,[_0x332d91[_0x2f07('0x60')],_0x33d20b[_0x2f07('0x1b')][_0x2f07('0x67')]()]['join']('\x20')));});}else{return _0x11ed87(_0x455841[_0x2f07('0x11')](0x1f5,_0x2f07('0x75')));}});},'VoiceQueuesChannelRedirect':function(_0x4d141f){var _0x31d816=this;return new Promise(function(_0x4c182c,_0x3916c6){if(ami[_0x2f07('0x10')]()==![]){return _0x3916c6(_0x31d816[_0x2f07('0x11')](0x1f4,[config[_0x2f07('0x12')]['ip'],config[_0x2f07('0x12')][_0x2f07('0x13')],_0x2f07('0x14')][_0x2f07('0x1d')]('\x20')));}var _0xbdb45c=schema(properties['voicequeuechannelredirect'])[_0x2f07('0x5d')](_0x4d141f);if(_0xbdb45c[_0x2f07('0x59')]>0x0){return _0x3916c6(_0x31d816[_0x2f07('0x11')](0x1f4,_[_0x2f07('0x6d')](_0xbdb45c,_0x2f07('0x1b'))[_0x2f07('0x1d')](',\x20')));}var _0x4bef82=_['find'](_0x1d5a33[_0x2f07('0x74')],{'uniqueid':_0x4d141f[_0x2f07('0x60')]});if(_0x4bef82&&_0x4bef82[_0x2f07('0x61')]){return ami[_0x2f07('0x19')]({'action':'Redirect','channel':_0x4bef82[_0x2f07('0x61')],'exten':_0x4d141f['exten'],'context':_0x4d141f[_0x2f07('0x77')]||_0x4bef82['context'],'priority':0x1})[_0x2f07('0x1a')](function(_0x4705bb){_0x4c182c({'code':0xc8,'message':[_0x4d141f[_0x2f07('0x60')],_0x4705bb[_0x2f07('0x1b')][_0x2f07('0x67')]()][_0x2f07('0x1d')]('\x20')});})[_0x2f07('0x1c')](function(_0x33c74f){_0x3916c6(_0x31d816[_0x2f07('0x11')](0x1f5,[_0x4d141f[_0x2f07('0x60')],_0x33c74f['message'][_0x2f07('0x67')]()]['join']('\x20')));});}else{return _0x3916c6(_0x31d816[_0x2f07('0x11')](0x1f5,_0x2f07('0x75')));}});},'Agents':function(_0x1bbc64){return new Promise(function(_0x1da0ba,_0x20c9a6){var _0x5639db=_[_0x2f07('0x5b')](_0x1d5a33[_0x2f07('0x78')]);_0x1da0ba({'count':_0x5639db[_0x2f07('0x59')],'rows':_0x5639db});});},'Telephones':function(_0x515f43){return new Promise(function(_0x578f6e,_0x5061f3){var _0x50f150=_[_0x2f07('0x5b')](_0x1d5a33[_0x2f07('0x79')]);_0x578f6e({'count':_0x50f150[_0x2f07('0x59')],'rows':_0x50f150});});},'Trunks':function(_0x5d1fca){return new Promise(function(_0x678baf,_0x33f5a5){var _0x35f284=_[_0x2f07('0x5b')](_0x1d5a33[_0x2f07('0x7a')]);_0x678baf({'count':_0x35f284[_0x2f07('0x59')],'rows':_0x35f284});});},'OutboundChannels':function(_0x92b65){return new Promise(function(_0x5f57ba,_0x52eb67){var _0x4a325d=_[_0x2f07('0x5b')](_0x1d5a33[_0x2f07('0x7b')]);_0x5f57ba({'count':_0x4a325d['length'],'rows':_0x4a325d});});},'Outbound':function(_0x589923){return new Promise(function(_0x2a10f0,_0x471c92){_0x2a10f0(_0x1d5a33[_0x2f07('0x7c')]);});},'Campaigns':function(_0x3f3761){return new Promise(function(_0x135cc8,_0x8b8e89){var _0xf51d0a=_['values'](_0x1d5a33[_0x2f07('0x7d')]);_0x135cc8({'count':_0xf51d0a[_0x2f07('0x59')],'rows':_0xf51d0a});});},'VoiceQueuesPreview':function(_0x4d2ea7){var _0x58258f=this;return new Promise(function(_0x4510f7,_0x5112e2){_0x14d6e6['run'](_0x4d2ea7['id'])[_0x2f07('0x1a')](function(_0x267373){_0x4510f7({'code':0xc8,'message':_0x267373[_0x2f07('0x1b')]});})[_0x2f07('0x1c')](function(_0x5dbf21){_0x5112e2(_0x58258f[_0x2f07('0x11')](0x1f4,_0x5dbf21[_0x2f07('0x1b')]));});});},'EventManager':function(_0x2f7d88){var _0x4eb43b=this;return new Promise(function(_0xbd2f11,_0x3ffd83){if(!_0x2f7d88[_0x2f07('0x7e')]){return _0x3ffd83(_0x4eb43b['error'](0x1f4,'Event\x20name\x20mandatory'));}ami[_0x2f07('0x7f')](_0x2f07('0x80')+_0x2f7d88[_0x2f07('0x7e')],_0x2f7d88[_0x2f07('0x1b')]);_0xbd2f11({'code':0xc8,'message':_0x2f7d88});});},'FaxAccounts':function(_0x2f89bb){return new Promise(function(_0x414540,_0x1dd659){var _0x16711f=_[_0x2f07('0x5b')](_0x1d5a33[_0x2f07('0x81')]);_0x414540({'count':_0x16711f[_0x2f07('0x59')],'rows':_0x16711f});});},'SendFax':function(_0xc2eb59){var _0x56a571=this;return new Promise(function(_0x35aa11,_0x9b8074){_0x3643bb[_0x2f07('0x82')](_0xc2eb59)[_0x2f07('0x1a')](function(_0x25946d){_0x35aa11({'code':0xc8,'message':_0x25946d[_0x2f07('0x1b')]});})[_0x2f07('0x1c')](function(_0x5aa451){_0x9b8074(_0x56a571[_0x2f07('0x11')](0x1f4,_0x5aa451[_0x2f07('0x1b')]));});});},'CheckAfterSend':function(_0x2c79f3){var _0x3bd925=this;return new Promise(function(_0xcc5ab8,_0x546e72){_0x3643bb[_0x2f07('0x83')](_0x2c79f3)[_0x2f07('0x1a')](function(_0x418fab){_0xcc5ab8({'code':0xc8,'message':_0x418fab[_0x2f07('0x1b')]});})[_0x2f07('0x1c')](function(_0x1572d8){_0x546e72(_0x3bd925[_0x2f07('0x11')](0x1f4,_0x1572d8['message']));});});}};var _0x327b78=jayson[_0x2f07('0x84')](_0xf73d1a)['http']();_0x327b78['on'](_0x2f07('0x11'),function(_0x51a952){return _0x235418(_0x51a952);});_0x327b78[_0x2f07('0x85')](0x232a,'127.0.0.1',function(){console[_0x2f07('0x86')](_0x2f07('0x87'),0x232a);return _0x2e6422(_0x2f07('0x88')+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 af131fd..efa1f59 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 _0x61de=['fax','ListId','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','firstName','calleridname','','Unknown','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','format','trigger:%s','action','length','bluebird','ioredis','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','exec','xmd-contactid','data3','$or','map','destcalleridnum','calleridnum','lastName','phone','mobile'];(function(_0x3fa2bb,_0x387361){var _0x1840d1=function(_0x4d508c){while(--_0x4d508c){_0x3fa2bb['push'](_0x3fa2bb['shift']());}};_0x1840d1(++_0x387361);}(_0x61de,0x19b));var _0xe61d=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0x61de[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var BPromise=require(_0xe61d('0x0'));var Redis=require(_0xe61d('0x1'));var util=require('util');var config=require(_0xe61d('0x2'));var logger=require(_0xe61d('0x3'))('trigger');var cmContactRpc=require(_0xe61d('0x4'));config[_0xe61d('0x5')]=_[_0xe61d('0x6')](config[_0xe61d('0x5')],{'host':_0xe61d('0x7'),'port':0x18eb});var io=require(_0xe61d('0x8'))(new Redis(config[_0xe61d('0x5')]));function emit(_0x19f99e,_0x479834,_0x172bd3,_0x576167,_0x57fc7d){logger[_0xe61d('0x9')]('[CM][%s][%s]',_0x19f99e,_0x479834['id'],_0x172bd3,_0x576167,JSON[_0xe61d('0xa')](_0x57fc7d));io['to'](_0x172bd3)['emit'](_0x576167,_0x57fc7d);}exports[_0xe61d('0xb')]=function(_0x45ba81,_0x2ca582,_0x382bf6,_0x289155){var _0x2409e8,_0x500f81;var _0x9e236c={};var _0x27b894=Number(_0x382bf6['data1']);var _0x20eef4=_0x382bf6['data2']?Boolean(Number(_0x382bf6['data2'])):![];var _0x148f5a;if(_0x289155[_0xe61d('0xc')]){_0x9e236c['id']=_0x289155['xmd-contactid'];}if(!_0x9e236c['id']){_0x9e236c['ListId']=_0x27b894;_0x148f5a=_0x382bf6[_0xe61d('0xd')]&&_0x382bf6['data3']!=='0'?_0x382bf6[_0xe61d('0xd')]['split'](','):['phone'];_0x9e236c[_0xe61d('0xe')]=_[_0xe61d('0xf')](_0x148f5a,function(_0x2cb076){var _0x1ebf65={};_0x1ebf65[_0x2cb076]=_0x289155['routeId']?_0x289155[_0xe61d('0x10')]:_0x289155[_0xe61d('0x11')];return _0x1ebf65;});}var _0xf285c4=['id','firstName',_0xe61d('0x12'),_0xe61d('0x13'),_0xe61d('0x14'),_0xe61d('0x15'),_0xe61d('0x16'),'createdAt',_0xe61d('0x17'),_0xe61d('0x18')];var _0x407c3f=_['union'](_0xf285c4,_0x148f5a);BPromise[_0xe61d('0x19')]()[_0xe61d('0x1a')](cmContactRpc[_0xe61d('0x1b')]({'attributes':_0x407c3f,'where':_0x9e236c}))[_0xe61d('0x1a')](function(_0x2ebda4){_0x500f81=_0x2ebda4;if(!_[_0xe61d('0x1c')](_0x500f81)){if(_0x500f81['length']===0x1){_0x2409e8=_0x500f81[0x0];logger[_0xe61d('0x9')](_0xe61d('0x1d'),_0x289155[_0xe61d('0x1e')],_0x2ca582['id'],_0x2409e8['id']);}else{logger[_0xe61d('0x9')](_0xe61d('0x1f'),_0x289155[_0xe61d('0x1e')],_0x2ca582['id'],_[_0xe61d('0xf')](_0x500f81,'id')['join'](','));}return;}else{logger[_0xe61d('0x9')](_0xe61d('0x20'),_0x289155[_0xe61d('0x1e')],_0x2ca582['id']);var _0x243fc6={'ListId':_0x27b894};var _0x5066a3=_0x382bf6[_0xe61d('0x21')]&&_0x382bf6[_0xe61d('0x21')]!=='0'?_0x382bf6[_0xe61d('0x21')]:_0xe61d('0x13');if(_0x20eef4){logger[_0xe61d('0x9')](_0xe61d('0x22'),_0x289155[_0xe61d('0x1e')],_0x2ca582['id']);_0x243fc6[_0x5066a3]=_[_0xe61d('0x23')](_0x289155[_0xe61d('0x24')])?_0x289155[_0xe61d('0x11')]:_0x289155[_0xe61d('0x10')];if(_[_0xe61d('0x23')](_0x289155['routeId'])){_0x243fc6[_0xe61d('0x25')]=_0x289155[_0xe61d('0x26')]&&_0x289155['calleridname']!==_0xe61d('0x27')?_0x289155[_0xe61d('0x26')]:_0xe61d('0x28');}else{_0x243fc6[_0xe61d('0x25')]=_0x289155[_0xe61d('0x29')]&&_0x289155[_0xe61d('0x29')]!==_0xe61d('0x27')?_0x289155[_0xe61d('0x29')]:'Unknown';}return BPromise[_0xe61d('0x19')]()[_0xe61d('0x1a')](cmContactRpc['createContact'](_0x243fc6))[_0xe61d('0x1a')](function(_0x3f7a6b){_0x2409e8=_0x3f7a6b;_0x500f81[_0xe61d('0x2a')](_0x3f7a6b);if(_0x2409e8){logger[_0xe61d('0x9')](_0xe61d('0x2b'),_0x289155['uniqueid'],_0x2ca582['id'],_0x2409e8['id']);}return;});}else{logger[_0xe61d('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x289155[_0xe61d('0x1e')],_0x2ca582['id']);_0x243fc6[_0x5066a3]=_[_0xe61d('0x23')](_0x289155['routeId'])?_0x289155[_0xe61d('0x11')]:_0x289155[_0xe61d('0x10')];if(_['isNil'](_0x289155[_0xe61d('0x24')])){_0x243fc6[_0xe61d('0x25')]=_0x289155[_0xe61d('0x26')]&&_0x289155[_0xe61d('0x26')]!==_0xe61d('0x27')?_0x289155[_0xe61d('0x26')]:'Unknown';}else{_0x243fc6[_0xe61d('0x25')]=_0x289155[_0xe61d('0x29')]&&_0x289155[_0xe61d('0x29')]!==_0xe61d('0x27')?_0x289155[_0xe61d('0x29')]:_0xe61d('0x28');}_0x2409e8=_0x243fc6;_0x500f81['push'](_0x243fc6);return;}}})[_0xe61d('0x1a')](function(){if(_0x45ba81){emit(_0x289155[_0xe61d('0x1e')],_0x2ca582,util[_0xe61d('0x2c')]('user:%s',_0x45ba81['name']),util[_0xe61d('0x2c')](_0xe61d('0x2d'),_0x382bf6[_0xe61d('0x2e')]['toLowerCase']()),{'evt':_['merge'](_0x289155,{'autoCreate':_0x20eef4}),'contact':_0x2409e8===undefined?{}:_0x2409e8,'contacts':_0x500f81[_0xe61d('0x2f')]===0x0?undefined:_0x500f81});}});}; \ No newline at end of file +var _0x90f8=['Unknown','format','user:%s','name','trigger:%s','action','toLowerCase','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','map','destcalleridnum','calleridnum','firstName','lastName','phone','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','routeId','isNil','calleridname','','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0x90f8,0x1c7));var _0x890f=function(_0x20e23a,_0x55ebaf){_0x20e23a=_0x20e23a-0x0;var _0x1068a1=_0x90f8[_0x20e23a];return _0x1068a1;};'use strict';var _=require('lodash');var BPromise=require(_0x890f('0x0'));var Redis=require(_0x890f('0x1'));var util=require(_0x890f('0x2'));var config=require(_0x890f('0x3'));var logger=require(_0x890f('0x4'))('trigger');var cmContactRpc=require(_0x890f('0x5'));config[_0x890f('0x6')]=_[_0x890f('0x7')](config[_0x890f('0x6')],{'host':_0x890f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x890f('0x6')]));function emit(_0x46e261,_0x21b36b,_0x2f9d3e,_0x31d26b,_0x4cbf89){logger[_0x890f('0x9')](_0x890f('0xa'),_0x46e261,_0x21b36b['id'],_0x2f9d3e,_0x31d26b,JSON[_0x890f('0xb')](_0x4cbf89));io['to'](_0x2f9d3e)[_0x890f('0xc')](_0x31d26b,_0x4cbf89);}exports[_0x890f('0xd')]=function(_0x43712b,_0x4a3de3,_0xa4e03b,_0x2b2796){var _0x6a7f92,_0x216703;var _0x13c315={};var _0x8cc7e7=Number(_0xa4e03b[_0x890f('0xe')]);var _0x4481e1=_0xa4e03b[_0x890f('0xf')]?Boolean(Number(_0xa4e03b[_0x890f('0xf')])):![];var _0x51a0bd;if(_0x2b2796[_0x890f('0x10')]){_0x13c315['id']=_0x2b2796['xmd-contactid'];}if(!_0x13c315['id']){_0x13c315[_0x890f('0x11')]=_0x8cc7e7;_0x51a0bd=_0xa4e03b[_0x890f('0x12')]&&_0xa4e03b[_0x890f('0x12')]!=='0'?_0xa4e03b[_0x890f('0x12')]['split'](','):['phone'];_0x13c315['$or']=_[_0x890f('0x13')](_0x51a0bd,function(_0x285147){var _0x47414b={};_0x47414b[_0x285147]=_0x2b2796['routeId']?_0x2b2796[_0x890f('0x14')]:_0x2b2796[_0x890f('0x15')];return _0x47414b;});}var _0x5c431f=['id',_0x890f('0x16'),_0x890f('0x17'),_0x890f('0x18'),_0x890f('0x19'),'fax',_0x890f('0x11'),_0x890f('0x1a'),_0x890f('0x1b'),_0x890f('0x1c')];var _0x3a47cf=_[_0x890f('0x1d')](_0x5c431f,_0x51a0bd);BPromise[_0x890f('0x1e')]()[_0x890f('0x1f')](cmContactRpc['getContacts']({'attributes':_0x3a47cf,'where':_0x13c315}))[_0x890f('0x1f')](function(_0x4c411a){_0x216703=_0x4c411a;if(!_[_0x890f('0x20')](_0x216703)){if(_0x216703[_0x890f('0x21')]===0x1){_0x6a7f92=_0x216703[0x0];logger[_0x890f('0x9')](_0x890f('0x22'),_0x2b2796[_0x890f('0x23')],_0x4a3de3['id'],_0x6a7f92['id']);}else{logger[_0x890f('0x9')](_0x890f('0x24'),_0x2b2796[_0x890f('0x23')],_0x4a3de3['id'],_[_0x890f('0x13')](_0x216703,'id')[_0x890f('0x25')](','));}return;}else{logger[_0x890f('0x9')](_0x890f('0x26'),_0x2b2796[_0x890f('0x23')],_0x4a3de3['id']);var _0x32db46={'ListId':_0x8cc7e7};var _0x5ec8c5=_0xa4e03b[_0x890f('0x27')]&&_0xa4e03b[_0x890f('0x27')]!=='0'?_0xa4e03b[_0x890f('0x27')]:_0x890f('0x18');if(_0x4481e1){logger[_0x890f('0x9')](_0x890f('0x28'),_0x2b2796[_0x890f('0x23')],_0x4a3de3['id']);_0x32db46[_0x5ec8c5]=_['isNil'](_0x2b2796[_0x890f('0x29')])?_0x2b2796[_0x890f('0x15')]:_0x2b2796['destcalleridnum'];if(_[_0x890f('0x2a')](_0x2b2796[_0x890f('0x29')])){_0x32db46[_0x890f('0x16')]=_0x2b2796['calleridname']&&_0x2b2796[_0x890f('0x2b')]!==_0x890f('0x2c')?_0x2b2796['calleridname']:'Unknown';}else{_0x32db46[_0x890f('0x16')]=_0x2b2796[_0x890f('0x2d')]&&_0x2b2796[_0x890f('0x2d')]!==_0x890f('0x2c')?_0x2b2796[_0x890f('0x2d')]:'Unknown';}return BPromise[_0x890f('0x1e')]()['then'](cmContactRpc[_0x890f('0x2e')](_0x32db46))['then'](function(_0x62a06b){_0x6a7f92=_0x62a06b;_0x216703[_0x890f('0x2f')](_0x62a06b);if(_0x6a7f92){logger[_0x890f('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x2b2796[_0x890f('0x23')],_0x4a3de3['id'],_0x6a7f92['id']);}return;});}else{logger[_0x890f('0x9')](_0x890f('0x30'),_0x2b2796[_0x890f('0x23')],_0x4a3de3['id']);_0x32db46[_0x5ec8c5]=_[_0x890f('0x2a')](_0x2b2796[_0x890f('0x29')])?_0x2b2796[_0x890f('0x15')]:_0x2b2796[_0x890f('0x14')];if(_[_0x890f('0x2a')](_0x2b2796[_0x890f('0x29')])){_0x32db46[_0x890f('0x16')]=_0x2b2796[_0x890f('0x2b')]&&_0x2b2796[_0x890f('0x2b')]!==_0x890f('0x2c')?_0x2b2796[_0x890f('0x2b')]:_0x890f('0x31');}else{_0x32db46[_0x890f('0x16')]=_0x2b2796[_0x890f('0x2d')]&&_0x2b2796[_0x890f('0x2d')]!==''?_0x2b2796[_0x890f('0x2d')]:_0x890f('0x31');}_0x6a7f92=_0x32db46;_0x216703[_0x890f('0x2f')](_0x32db46);return;}}})['then'](function(){if(_0x43712b){emit(_0x2b2796[_0x890f('0x23')],_0x4a3de3,util[_0x890f('0x32')](_0x890f('0x33'),_0x43712b[_0x890f('0x34')]),util[_0x890f('0x32')](_0x890f('0x35'),_0xa4e03b[_0x890f('0x36')][_0x890f('0x37')]()),{'evt':_['merge'](_0x2b2796,{'autoCreate':_0x4481e1}),'contact':_0x6a7f92===undefined?{}:_0x6a7f92,'contacts':_0x216703[_0x890f('0x21')]===0x0?undefined:_0x216703});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 032dd50..e27655d 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 _0x7327=['variables','Actions','length','interface','action','toLowerCase','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','html','render','template\x20not\x20found','uri','data3','isNil','data4','location','uriLocation','windowWidth','data5','800','data6','600','winArguments','user:%s','format','jscripty','name','trigger:%s','exec','queue','routeId','script','buildUri','query','search','replace','AllConditions','every','checkConditions','channel','AnyConditions','field','chat','ChatWebsiteId','operator','value','AccountId','upperFirst','interaction','message','event','membername','lastevent','util','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','redis','defaults','localhost','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','accounts','vtigerAccounts','freshsalesAccounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','prototype','emit','info','stringify','clone','checkTriggers','hasOwnProperty','checkTrigger','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7327,0x122));var _0x7732=function(_0x476ed2,_0x5963a2){_0x476ed2=_0x476ed2-0x0;var _0x903533=_0x7327[_0x476ed2];return _0x903533;};'use strict';var util=require(_0x7732('0x0'));var _=require('lodash');var url=require(_0x7732('0x1'));var Mustache=require(_0x7732('0x2'));var Redis=require(_0x7732('0x3'));var urlforward=require(_0x7732('0x4'));var integration=require(_0x7732('0x5'));var cmContact=require(_0x7732('0x6'));var script=require(_0x7732('0x7'));var config=require(_0x7732('0x8'));var logger=require(_0x7732('0x9'))(_0x7732('0xa'));var ami=require('../ami');config[_0x7732('0xb')]=_[_0x7732('0xc')](config['redis'],{'host':_0x7732('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7732('0xb')]));var operators={'equals':function(_0x39702a,_0x2f0844){return _0x39702a==_0x2f0844;},'not_equals':function(_0x22605f,_0x3ad942){return _0x22605f!=_0x3ad942;}};var barAndWebActions=['popup',_0x7732('0x1'),_0x7732('0xe')];function Trigger(_0x1da84a){this[_0x7732('0xf')]=_0x1da84a[_0x7732('0xf')];this[_0x7732('0x10')]=_0x1da84a[_0x7732('0x10')];this[_0x7732('0x11')]=_0x1da84a['voiceQueues'];this['templates']=_0x1da84a[_0x7732('0x12')];this[_0x7732('0x13')]=_0x1da84a[_0x7732('0x13')];this[_0x7732('0x14')]=_0x1da84a[_0x7732('0x14')];this[_0x7732('0x15')]=_0x1da84a['freshdeskAccounts'];this[_0x7732('0x16')]=_0x1da84a[_0x7732('0x16')];this['sugarcrmAccounts']=_0x1da84a[_0x7732('0x17')];this[_0x7732('0x18')]=_0x1da84a['zohoAccounts'];this[_0x7732('0x19')]=_0x1da84a[_0x7732('0x19')];this['vtigerAccounts']=_0x1da84a['vtigerAccounts'];this['servicenowAccounts']=_0x1da84a[_0x7732('0x1a')];this[_0x7732('0x1b')]=_0x1da84a[_0x7732('0x1b')];this['freshsalesAccounts']=_0x1da84a['freshsalesAccounts'];this[_0x7732('0x1c')]={'zendesk':this[_0x7732('0x14')],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x7732('0x15')],'sugarcrm':this[_0x7732('0x17')],'zoho':this[_0x7732('0x18')],'desk':this[_0x7732('0x19')],'vtiger':this[_0x7732('0x1d')],'dynamics365':this[_0x7732('0x1b')],'freshsales':this[_0x7732('0x1e')],'servicenow':this[_0x7732('0x1a')]};ami['on']('custom:agentcalled',this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on']('custom:agentconnect',this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on'](_0x7732('0x21'),this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on'](_0x7732('0x22'),this[_0x7732('0x1f')]['bind'](this));ami['on'](_0x7732('0x23'),this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on'](_0x7732('0x24'),this['syncCustomEvent'][_0x7732('0x20')](this));ami['on'](_0x7732('0x25'),this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on'](_0x7732('0x26'),this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on'](_0x7732('0x27'),this[_0x7732('0x1f')]['bind'](this));ami['on'](_0x7732('0x28'),this['syncCustomEvent'][_0x7732('0x20')](this));ami['on'](_0x7732('0x29'),this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on']('custom:timeout',this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on'](_0x7732('0x2a'),this['syncAgentDial'][_0x7732('0x20')](this));ami['on']('custom:dialconnect',this[_0x7732('0x2b')][_0x7732('0x20')](this));ami['on']('custom:dialend',this['syncAgentDial'][_0x7732('0x20')](this));ami['on'](_0x7732('0x2c'),this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on']('custom:closedinteraction',this[_0x7732('0x1f')]['bind'](this));ami['on'](_0x7732('0x2d'),this['syncCustomEvent'][_0x7732('0x20')](this));ami['on'](_0x7732('0x2e'),this['syncCustomEvent'][_0x7732('0x20')](this));ami['on'](_0x7732('0x2f'),this[_0x7732('0x1f')][_0x7732('0x20')](this));ami['on'](_0x7732('0x30'),this['syncCustomEvent']['bind'](this));}Trigger[_0x7732('0x31')][_0x7732('0x32')]=function(_0x416b8c,_0x24fe54,_0x3199f9){logger[_0x7732('0x33')](_0x416b8c,_0x24fe54,JSON[_0x7732('0x34')](_0x3199f9));io['to'](_0x416b8c)['emit'](_0x24fe54,_0x3199f9);};Trigger[_0x7732('0x31')]['syncCustomEvent']=function(_0x223180){var _0x5403a8=_[_0x7732('0x35')](_0x223180);this['checkTriggers'](_0x5403a8);};Trigger[_0x7732('0x31')][_0x7732('0x2b')]=function(_0x11cc8b){if(this[_0x7732('0x10')][_0x11cc8b['interface']]){this[_0x7732('0x1f')](_0x11cc8b);}};Trigger[_0x7732('0x31')][_0x7732('0x36')]=function(_0x4ec304){var _0x33828f;for(var _0x49e856 in this['triggers']){if(this[_0x7732('0xf')][_0x7732('0x37')](_0x49e856)){if(this[_0x7732('0xf')][_0x49e856]['status']){_0x33828f=this[_0x7732('0x38')](this[_0x7732('0xf')][_0x49e856],_0x4ec304);if(_0x33828f){_[_0x7732('0x39')](_0x4ec304,_0x4ec304[_0x7732('0x3a')]);for(var _0x4897f5=0x0,_0x4ade8f,_0x568662,_0x673a7a;_0x4897f50x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x2cb34a,_0x14ab0b){var _0xcbdf86=function(_0x26896e){while(--_0x26896e){_0x2cb34a['push'](_0x2cb34a['shift']());}};_0xcbdf86(++_0x14ab0b);}(_0x55ca,0x126));var _0xa55c=function(_0x1d8c86,_0x35919a){_0x1d8c86=_0x1d8c86-0x0;var _0x47c8a5=_0x55ca[_0x1d8c86];return _0x47c8a5;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});}; \ 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 fad5a54..bbf79c9 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 _0x67d6=['bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','defaults','redis','socket.io-emitter','clientId','remoteUri','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','value','userEmail','email','internalemailaddress','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','message','toLowerCase','destcalleridnum','calleridnum','POST','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20Created!','length','forEach','picklist','nameField','idField','indexOf','ticketType','incident','incidents','assign','Subjects','getString','Descriptions','/contacts(','Fields','phonecall','phonecalls','queue','callDirection','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x67d6,0x1e9));var _0x667d=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x67d6[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0x667d('0x0'));var BPromise=require(_0x667d('0x1'));var rp=require(_0x667d('0x2'));var util=require(_0x667d('0x3'));var intUtil=require(_0x667d('0x4'));var md5=require(_0x667d('0x5'));var Redis=require(_0x667d('0x6'));var logger=require(_0x667d('0x7'))(_0x667d('0x8'));var config=require('../../../../config/environment');config['redis']=_[_0x667d('0x9')](config[_0x667d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x667d('0xb'))(new Redis(config['redis']));function getAuthToken(_0x11ce99,_0x266917,_0x1aa203){var _0x1a4874={'method':'POST','uri':_0x266917,'form':{'client_id':_0x11ce99[_0x667d('0xc')],'resource':_0x11ce99[_0x667d('0xd')],'username':_0x11ce99[_0x667d('0xe')],'password':_0x11ce99[_0x667d('0xf')],'grant_type':_0x667d('0xf'),'client_secret':_0x11ce99['clientSecret']},'json':!![]};return rp(_0x1a4874)[_0x667d('0x10')](function(_0xb4f138){return _0xb4f138[_0x667d('0x11')];})[_0x667d('0x12')](function(_0x112df8){logger[_0x667d('0x13')]('['+[_0x1aa203[_0x667d('0x14')]()]+_0x667d('0x15'));return _0x112df8['message'];});}function getUser(_0xa86fc0,_0x18cfa1,_0x266474,_0x21d92c,_0x123fee,_0x38f7b8){return new BPromise(function(_0x37cbe7,_0x28a2d1){return getAuthToken(_0x18cfa1,_0x21d92c,_0x38f7b8)[_0x667d('0x10')](function(_0x39cb2f){var _0x59be30={'method':_0x667d('0x16'),'uri':_0x123fee+_0x667d('0x17'),'headers':{'Authorization':_0x667d('0x18')+_0x39cb2f,'OData-Version':'4.0'},'json':!![]};return rp(_0x59be30);})[_0x667d('0x10')](function(_0xebf7ee){var _0x3fc599=_0xebf7ee[_0x667d('0x19')];var _0x20748d=![];var _0x4b731b=null;if(!_['isNil'](_0x266474)){if(intUtil['validateEmail'](_0x266474['email'])){_0xa86fc0[_0x667d('0x1a')]=_0x266474[_0x667d('0x1b')];for(_0x4b731b=0x0;_0x4b731b<_0x3fc599['length'];_0x4b731b++){if(_0x3fc599[_0x4b731b][_0x667d('0x1c')]===_0x266474[_0x667d('0x1b')]&&!_0x3fc599[_0x4b731b]['isdisabled']){_0x20748d=!![];logger[_0x667d('0x1d')]('['+[_0x38f7b8['toUpperCase']()]+_0x667d('0x1e')+_0x3fc599[_0x4b731b][_0x667d('0x1f')]+'!');_0xa86fc0[_0x667d('0x20')]=_0x3fc599[_0x4b731b]['systemuserid'];}}}}if(!_0x20748d){logger[_0x667d('0x1d')]('['+[_0x38f7b8[_0x667d('0x14')]()]+_0x667d('0x21'));_0xa86fc0[_0x667d('0x1a')]=_0x18cfa1[_0x667d('0xe')];for(_0x4b731b=0x0;_0x4b731b<_0x3fc599['length'];_0x4b731b++){if(_0x3fc599[_0x4b731b][_0x667d('0x1c')]===_0x18cfa1['username']){_0xa86fc0[_0x667d('0x20')]=_0x3fc599[_0x4b731b][_0x667d('0x1f')];}}}_0x37cbe7(_0xa86fc0);})[_0x667d('0x12')](function(_0x1d3f18){_0x28a2d1(_0x1d3f18[_0x667d('0x22')]);});});}function createEndUser(_0xef7b56,_0x358baf,_0x4654ab,_0x2178a1,_0x47b872,_0x37e677){return new BPromise(function(_0x428f7c,_0x2e901d){return getAuthToken(_0x358baf,_0x4654ab,_0x37e677)['then'](function(_0x54e40f){var _0x24c736=_0x37e677[_0x667d('0x23')]()==='outbound'?_0x47b872[_0x667d('0x24')]:_0x47b872[_0x667d('0x25')];var _0x4da1b5={'method':_0x667d('0x26'),'uri':_0x2178a1+_0x667d('0x27'),'body':{'telephone1':_0x24c736,'fullname':_0x24c736,'firstname':_0x24c736,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x667d('0x28')+_0xef7b56[_0x667d('0x20')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x54e40f,'OData-Version':_0x667d('0x29')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x4da1b5);})[_0x667d('0x10')](function(_0x3d8c13){var _0x20a722=_0x3d8c13[_0x667d('0x2a')][_0x667d('0x2b')];var _0x23bfad=_0x20a722[_0x667d('0x2c')](_0x20a722['lastIndexOf']('(')+0x1,_0x20a722[_0x667d('0x2d')](')'));_0xef7b56[_0x667d('0x2e')]=_0x23bfad;_0x428f7c(_0xef7b56);})['catch'](function(_0x1950a4){_0x2e901d(_0x1950a4[_0x667d('0x22')]);});});}function getEndUser(_0x442fd7,_0x5bd1de,_0x8ab13,_0x66bd60,_0x2d34ea,_0x1520c2){return new BPromise(function(_0x349593,_0x47ca1a){var _0x300e77=_0x1520c2[_0x667d('0x23')]()===_0x667d('0x2f')?_0x2d34ea[_0x667d('0x24')]:_0x2d34ea[_0x667d('0x25')];return getAuthToken(_0x5bd1de,_0x8ab13,_0x1520c2)[_0x667d('0x10')](function(_0x1019c9){var _0x546b74={'method':'GET','uri':_0x66bd60+_0x667d('0x30')+_0x300e77[_0x667d('0x31')]('+',_0x667d('0x32'))+'\x27','headers':{'Authorization':_0x667d('0x18')+_0x1019c9,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x546b74);})[_0x667d('0x10')](function(_0x10d39e){var _0x329f37=null;if(_0x10d39e){var _0x1d24f8=_0x10d39e['value'];var _0x328007=![];for(_0x329f37=0x0;_0x329f37<_0x1d24f8['length'];_0x329f37++){if(_0x1d24f8[_0x329f37][_0x667d('0x33')]===_0x300e77){_0x328007=!![];_0x442fd7[_0x667d('0x2e')]=_0x1d24f8[_0x329f37][_0x667d('0x34')];}}if(_0x328007){_0x349593(_0x442fd7);}else{return createEndUser(_0x442fd7,_0x5bd1de,_0x8ab13,_0x66bd60,_0x2d34ea,_0x1520c2)['then'](function(_0x4c2a66){logger[_0x667d('0x1d')]('['+[_0x1520c2[_0x667d('0x14')]()]+']\x20Enduser\x20created!',_0x4c2a66['enduserId']);_0x349593(_0x4c2a66);});}}else{return createEndUser(_0x442fd7,_0x5bd1de,_0x8ab13,_0x66bd60,_0x2d34ea,_0x1520c2)[_0x667d('0x10')](function(_0x3cd92a){logger[_0x667d('0x1d')]('['+[_0x1520c2[_0x667d('0x14')]()]+_0x667d('0x35'),_0x3cd92a[_0x667d('0x2e')]);_0x349593(_0x3cd92a);});}});});}function getCustomFields(_0xf648d3,_0x21f405,_0x4c41dd){var _0x37da16={};if(_0xf648d3[_0x667d('0x36')]>0x0){_[_0x667d('0x37')](_0xf648d3,function(_0x54be1f){if(_['includes'](['string',_0x667d('0x38')],_0x54be1f['type'])&&_0x54be1f[_0x667d('0x39')]&&!_0x54be1f['customField']){var _0x4fd26=_0x54be1f[_0x667d('0x3a')][_0x667d('0x23')]();var _0x20eade=_0x4fd26['substring'](0x0,_0x4fd26[_0x667d('0x3b')]('_'));var _0x5a08f0=_0x4fd26[_0x667d('0x2c')](_0x4fd26[_0x667d('0x3b')]('_')+0x1);if(_0x20eade===_0x4c41dd){_0x37da16[_0x5a08f0]=_0x54be1f['content'];}}});}return _0x37da16;}function getTicket(_0x215047,_0x59aab7,_0x467e04,_0x141d9d,_0x160cf5,_0x4c67d4,_0x5c785f){return new BPromise(function(_0x3d7dd3,_0x105fd9){var _0x4dbf46;return getAuthToken(_0x59aab7,_0x467e04,_0x5c785f)[_0x667d('0x10')](function(_0x4dfe62){if(_0x4c67d4[_0x667d('0x3c')]===_0x667d('0x3d')){_0x4dbf46={'method':_0x667d('0x26'),'uri':_0x141d9d+_0x667d('0x3e'),'body':Object[_0x667d('0x3f')]({},{'title':intUtil['getString'](_0x4c67d4[_0x667d('0x40')],_0x160cf5,'\x20'),'description':intUtil[_0x667d('0x41')](_0x4c67d4[_0x667d('0x42')],_0x160cf5,'\x0a'),'customerid_contact@odata.bind':_0x667d('0x43')+_0x215047['enduserId']+')','ownerid@odata.bind':_0x667d('0x28')+_0x215047[_0x667d('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x4c67d4[_0x667d('0x44')],_0x160cf5,_0x4c67d4[_0x667d('0x3c')])),'headers':{'Authorization':_0x667d('0x18')+_0x4dfe62,'OData-Version':_0x667d('0x29')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4c67d4[_0x667d('0x3c')]===_0x667d('0x45')){_0x4dbf46={'method':'POST','uri':_0x141d9d+_0x667d('0x46'),'body':Object['assign']({},{'subject':intUtil[_0x667d('0x41')](_0x4c67d4[_0x667d('0x40')],_0x160cf5,'\x20'),'phonenumber':String(_0x160cf5[_0x667d('0x25')]),'description':intUtil['getString'](_0x4c67d4['Descriptions'],_0x160cf5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x667d('0x43')+_0x215047[_0x667d('0x2e')]+')','ownerid@odata.bind':_0x667d('0x28')+_0x215047['userId']+')','directioncode':_0x215047['callDirection']===_0x667d('0x47')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x667d('0x28')+_0x215047[_0x667d('0x20')]+')','participationtypemask':_0x215047[_0x667d('0x48')]===_0x667d('0x47')?0x2:0x1},{'partyid_contact@odata.bind':_0x667d('0x43')+_0x215047[_0x667d('0x2e')]+')','participationtypemask':_0x215047[_0x667d('0x48')]==='queue'?0x1:0x2}]},getCustomFields(_0x4c67d4['Fields'],_0x160cf5,_0x4c67d4['ticketType'])),'headers':{'Authorization':_0x667d('0x18')+_0x4dfe62,'OData-Version':_0x667d('0x29')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4dbf46);})[_0x667d('0x10')](function(_0x28bfc2){var _0x24aa41=_0x28bfc2[_0x667d('0x2a')][_0x667d('0x2b')];var _0x40e8fe=_0x24aa41[_0x667d('0x2c')](_0x24aa41['lastIndexOf']('(')+0x1,_0x24aa41[_0x667d('0x2d')](')'));_0x215047[_0x667d('0x49')]=_0x40e8fe;_0x3d7dd3(_0x215047);})[_0x667d('0x12')](function(_0x2bb5d3){_0x105fd9(_0x2bb5d3[_0x667d('0x22')]);});});}function emit(_0x54a60d,_0x4773c9,_0x2e8824,_0x3cec3f){var _0x339557={'uri':util[_0x667d('0x4a')](_0x667d('0x4b'),_0x54a60d,_0x2e8824,_0x3cec3f)};io['to'](util['format'](_0x667d('0x4c'),_0x4773c9))[_0x667d('0x4d')](_0x667d('0x4e'),_0x339557);}exports['cs']=function(_0x28fae8,_0x589f18,_0x60146c,_0x4c99ac,_0x36f820,_0x5b79f8,_0x4375fc,_0x25e3cc){var _0xdf4fa5={};_0x5b79f8['remoteUri']=intUtil['stripTrailingSlash'](_0x5b79f8['remoteUri']);_0x5b79f8['serverUrl']=intUtil[_0x667d('0x4f')](_0x5b79f8[_0x667d('0x50')]);_0xdf4fa5[_0x667d('0x48')]=_0x25e3cc===_0x667d('0x47')||_0x25e3cc===_0x667d('0x51')?_0x667d('0x47'):_0x667d('0x2f');var _0xbee303=util[_0x667d('0x4a')]('%s/api/data/v9.0/',_0x5b79f8[_0x667d('0xd')]);var _0x377792=util[_0x667d('0x4a')](_0x667d('0x52'),_0x5b79f8['tenantId']);var _0x5bc9b0=util['format'](_0x667d('0x53'),_0x5b79f8['serverUrl'],_0x589f18[_0x667d('0x54')],md5(_0x589f18['uniqueid']));if(_0x36f820&&_0x36f820[_0x667d('0x55')]){logger[_0x667d('0x1d')](_0x667d('0x56'),_0x667d('0x57'));_0x589f18['recordingURL']=_0x5bc9b0;}else if(_0x4375fc&&_0x4375fc[_0x667d('0x58')]&&_0x4375fc['recordingFormat']!==_0x667d('0x59')){logger[_0x667d('0x1d')](_0x667d('0x5a'),_0x667d('0x57'));_0x589f18[_0x667d('0x5b')]=_0x5bc9b0;}else{_0x589f18[_0x667d('0x5b')]='';}return getUser(_0xdf4fa5,_0x5b79f8,_0x4c99ac,_0x377792,_0xbee303,_0x25e3cc)[_0x667d('0x10')](function(_0x35b9a5){logger['info']('['+_0x25e3cc[_0x667d('0x14')]()+_0x667d('0x5c'),_0x35b9a5[_0x667d('0x20')]);logger[_0x667d('0x1d')]('['+_0x25e3cc['toUpperCase']()+_0x667d('0x5d'),_0x35b9a5[_0x667d('0x1a')]);return getEndUser(_0x35b9a5,_0x5b79f8,_0x377792,_0xbee303,_0x589f18,_0x25e3cc);})[_0x667d('0x10')](function(_0x4cbba5){logger['info']('['+_0x25e3cc[_0x667d('0x14')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x4cbba5['enduserId']);logger['info']('['+_0x25e3cc['toUpperCase']()+_0x667d('0x5e'),_0x589f18['calleridnum']);return getTicket(_0x4cbba5,_0x5b79f8,_0x377792,_0xbee303,_0x589f18,_0x60146c,_0x25e3cc);})[_0x667d('0x10')](function(_0x44f0a6){logger[_0x667d('0x1d')](util['format']('['+_0x25e3cc[_0x667d('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x60146c['ticketType'],_0x44f0a6['ticketId']));logger[_0x667d('0x1d')](util[_0x667d('0x4a')]('['+_0x25e3cc[_0x667d('0x14')]()+_0x667d('0x5f'),_0x25e3cc));if(_0x25e3cc!=='unmanaged'){logger['info']('['+_0x25e3cc[_0x667d('0x14')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x5b79f8[_0x667d('0xd')],_0x4c99ac[_0x667d('0x60')],_0x60146c[_0x667d('0x3c')],_0x44f0a6[_0x667d('0x49')]);}})[_0x667d('0x12')](function(_0x30dd9d){logger[_0x667d('0x13')]('['+_0x25e3cc['toUpperCase']()+_0x667d('0x61'),util['inspect'](_0x30dd9d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xeb0f=['value','isNil','validateEmail','email','userEmail','length','isdisabled','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','internalemailaddress','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','odata-entityid','substring','lastIndexOf','enduserId','replace','telephone1','info',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','Subjects','Fields','phonecall','phonecalls','assign','getString','Descriptions','/contacts(','queue','callDirection','headers','ticketId','user:%s','emit','stripTrailingSlash','serverUrl','unmanaged','format','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','error','bluebird','util','./util','md5','ioredis','dynamics365','../../../../config/environment','defaults','redis','clientId','remoteUri','password','clientSecret','then','access_token','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0'];(function(_0x37b464,_0x191f52){var _0x3e45ae=function(_0x2a89f2){while(--_0x2a89f2){_0x37b464['push'](_0x37b464['shift']());}};_0x3e45ae(++_0x191f52);}(_0xeb0f,0x10a));var _0xfeb0=function(_0x5c3143,_0x20b6a9){_0x5c3143=_0x5c3143-0x0;var _0x415fc6=_0xeb0f[_0x5c3143];return _0x415fc6;};'use strict';var _=require('lodash');var BPromise=require(_0xfeb0('0x0'));var rp=require('request-promise');var util=require(_0xfeb0('0x1'));var intUtil=require(_0xfeb0('0x2'));var md5=require(_0xfeb0('0x3'));var Redis=require(_0xfeb0('0x4'));var logger=require('../../../../config/logger')(_0xfeb0('0x5'));var config=require(_0xfeb0('0x6'));config['redis']=_[_0xfeb0('0x7')](config[_0xfeb0('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfeb0('0x8')]));function getAuthToken(_0x10babe,_0x51ba3e,_0x5db3bc){var _0x43a790={'method':'POST','uri':_0x51ba3e,'form':{'client_id':_0x10babe[_0xfeb0('0x9')],'resource':_0x10babe[_0xfeb0('0xa')],'username':_0x10babe['username'],'password':_0x10babe[_0xfeb0('0xb')],'grant_type':_0xfeb0('0xb'),'client_secret':_0x10babe[_0xfeb0('0xc')]},'json':!![]};return rp(_0x43a790)[_0xfeb0('0xd')](function(_0x338cf9){return _0x338cf9[_0xfeb0('0xe')];})[_0xfeb0('0xf')](function(_0x245bb7){logger['error']('['+[_0x5db3bc[_0xfeb0('0x10')]()]+']\x20Wrong\x20credentials!');return _0x245bb7[_0xfeb0('0x11')];});}function getUser(_0x6cf88f,_0x4b78eb,_0x38f283,_0x48086b,_0x406314,_0x6e9136){return new BPromise(function(_0x568d1e,_0x49863b){return getAuthToken(_0x4b78eb,_0x48086b,_0x6e9136)[_0xfeb0('0xd')](function(_0x46b386){var _0x5c44fb={'method':_0xfeb0('0x12'),'uri':_0x406314+_0xfeb0('0x13'),'headers':{'Authorization':_0xfeb0('0x14')+_0x46b386,'OData-Version':_0xfeb0('0x15')},'json':!![]};return rp(_0x5c44fb);})['then'](function(_0x5f348b){var _0x23df06=_0x5f348b[_0xfeb0('0x16')];var _0x117326=![];var _0x1b673b=null;if(!_[_0xfeb0('0x17')](_0x38f283)){if(intUtil[_0xfeb0('0x18')](_0x38f283[_0xfeb0('0x19')])){_0x6cf88f[_0xfeb0('0x1a')]=_0x38f283[_0xfeb0('0x19')];for(_0x1b673b=0x0;_0x1b673b<_0x23df06[_0xfeb0('0x1b')];_0x1b673b++){if(_0x23df06[_0x1b673b]['internalemailaddress']===_0x38f283[_0xfeb0('0x19')]&&!_0x23df06[_0x1b673b][_0xfeb0('0x1c')]){_0x117326=!![];logger['info']('['+[_0x6e9136['toUpperCase']()]+']\x20Agent\x20found\x20'+_0x23df06[_0x1b673b][_0xfeb0('0x1d')]+'!');_0x6cf88f[_0xfeb0('0x1e')]=_0x23df06[_0x1b673b]['systemuserid'];}}}}if(!_0x117326){logger['info']('['+[_0x6e9136['toUpperCase']()]+_0xfeb0('0x1f'));_0x6cf88f[_0xfeb0('0x1a')]=_0x4b78eb[_0xfeb0('0x20')];for(_0x1b673b=0x0;_0x1b673b<_0x23df06[_0xfeb0('0x1b')];_0x1b673b++){if(_0x23df06[_0x1b673b][_0xfeb0('0x21')]===_0x4b78eb[_0xfeb0('0x20')]){_0x6cf88f[_0xfeb0('0x1e')]=_0x23df06[_0x1b673b][_0xfeb0('0x1d')];}}}_0x568d1e(_0x6cf88f);})[_0xfeb0('0xf')](function(_0x4db477){_0x49863b(_0x4db477[_0xfeb0('0x11')]);});});}function createEndUser(_0x136f97,_0x3efc0a,_0x43f519,_0x38df99,_0x1a2888,_0x19ad05){return new BPromise(function(_0x2e4c5a,_0x4bb464){return getAuthToken(_0x3efc0a,_0x43f519,_0x19ad05)[_0xfeb0('0xd')](function(_0x4ee03f){var _0x59a6cc=_0x19ad05[_0xfeb0('0x22')]()===_0xfeb0('0x23')?_0x1a2888[_0xfeb0('0x24')]:_0x1a2888[_0xfeb0('0x25')];var _0x47e29e={'method':_0xfeb0('0x26'),'uri':_0x38df99+_0xfeb0('0x27'),'body':{'telephone1':_0x59a6cc,'fullname':_0x59a6cc,'firstname':_0x59a6cc,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xfeb0('0x28')+_0x136f97[_0xfeb0('0x1e')]+')'},'headers':{'Authorization':_0xfeb0('0x14')+_0x4ee03f,'OData-Version':_0xfeb0('0x15')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x47e29e);})[_0xfeb0('0xd')](function(_0x5a5eb5){var _0x3e8ce6=_0x5a5eb5['headers'][_0xfeb0('0x29')];var _0x476c21=_0x3e8ce6[_0xfeb0('0x2a')](_0x3e8ce6[_0xfeb0('0x2b')]('(')+0x1,_0x3e8ce6[_0xfeb0('0x2b')](')'));_0x136f97[_0xfeb0('0x2c')]=_0x476c21;_0x2e4c5a(_0x136f97);})['catch'](function(_0x171945){_0x4bb464(_0x171945[_0xfeb0('0x11')]);});});}function getEndUser(_0x385189,_0x50f199,_0x1f38ee,_0x3265d3,_0x4d8a34,_0x331720){return new BPromise(function(_0x1eefc2,_0xff8cdb){var _0x2716bd=_0x331720[_0xfeb0('0x22')]()===_0xfeb0('0x23')?_0x4d8a34['destcalleridnum']:_0x4d8a34[_0xfeb0('0x25')];return getAuthToken(_0x50f199,_0x1f38ee,_0x331720)[_0xfeb0('0xd')](function(_0x450ad9){var _0x4dc010={'method':_0xfeb0('0x12'),'uri':_0x3265d3+'contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27'+_0x2716bd[_0xfeb0('0x2d')]('+','%2b')+'\x27','headers':{'Authorization':_0xfeb0('0x14')+_0x450ad9,'If-None-Match':null,'OData-Version':_0xfeb0('0x15')},'json':!![]};return rp(_0x4dc010);})[_0xfeb0('0xd')](function(_0x1323b0){var _0x978fb9=null;if(_0x1323b0){var _0x393cf1=_0x1323b0[_0xfeb0('0x16')];var _0x34064b=![];for(_0x978fb9=0x0;_0x978fb9<_0x393cf1[_0xfeb0('0x1b')];_0x978fb9++){if(_0x393cf1[_0x978fb9][_0xfeb0('0x2e')]===_0x2716bd){_0x34064b=!![];_0x385189[_0xfeb0('0x2c')]=_0x393cf1[_0x978fb9]['contactid'];}}if(_0x34064b){_0x1eefc2(_0x385189);}else{return createEndUser(_0x385189,_0x50f199,_0x1f38ee,_0x3265d3,_0x4d8a34,_0x331720)[_0xfeb0('0xd')](function(_0x1f8eff){logger[_0xfeb0('0x2f')]('['+[_0x331720[_0xfeb0('0x10')]()]+_0xfeb0('0x30'),_0x1f8eff[_0xfeb0('0x2c')]);_0x1eefc2(_0x1f8eff);});}}else{return createEndUser(_0x385189,_0x50f199,_0x1f38ee,_0x3265d3,_0x4d8a34,_0x331720)[_0xfeb0('0xd')](function(_0x374aa6){logger[_0xfeb0('0x2f')]('['+[_0x331720[_0xfeb0('0x10')]()]+']\x20Enduser\x20Created!',_0x374aa6[_0xfeb0('0x2c')]);_0x1eefc2(_0x374aa6);});}});});}function getCustomFields(_0x58e444,_0x385854,_0x5b3c8c){var _0xf52d77={};if(_0x58e444[_0xfeb0('0x1b')]>0x0){_[_0xfeb0('0x31')](_0x58e444,function(_0x33cc8c){if(_[_0xfeb0('0x32')]([_0xfeb0('0x33'),_0xfeb0('0x34')],_0x33cc8c[_0xfeb0('0x35')])&&_0x33cc8c[_0xfeb0('0x36')]&&!_0x33cc8c[_0xfeb0('0x37')]){var _0x2f45a7=_0x33cc8c[_0xfeb0('0x38')]['toLowerCase']();var _0x9b6791=_0x2f45a7[_0xfeb0('0x2a')](0x0,_0x2f45a7[_0xfeb0('0x39')]('_'));var _0x30332f=_0x2f45a7[_0xfeb0('0x2a')](_0x2f45a7['indexOf']('_')+0x1);if(_0x9b6791===_0x5b3c8c){_0xf52d77[_0x30332f]=_0x33cc8c[_0xfeb0('0x3a')];}}});}return _0xf52d77;}function getTicket(_0x20a31b,_0x2d456f,_0xb76f6f,_0x5363ed,_0x1960b1,_0x149c0d,_0x4b0f72){return new BPromise(function(_0x39b419,_0x4c4502){var _0x35811b;return getAuthToken(_0x2d456f,_0xb76f6f,_0x4b0f72)[_0xfeb0('0xd')](function(_0x3ae748){if(_0x149c0d[_0xfeb0('0x3b')]===_0xfeb0('0x3c')){_0x35811b={'method':_0xfeb0('0x26'),'uri':_0x5363ed+'incidents','body':Object['assign']({},{'title':intUtil['getString'](_0x149c0d[_0xfeb0('0x3d')],_0x1960b1,'\x20'),'description':intUtil['getString'](_0x149c0d['Descriptions'],_0x1960b1,'\x0a'),'customerid_contact@odata.bind':'/contacts('+_0x20a31b[_0xfeb0('0x2c')]+')','ownerid@odata.bind':_0xfeb0('0x28')+_0x20a31b[_0xfeb0('0x1e')]+')','caseorigincode':'1'},getCustomFields(_0x149c0d[_0xfeb0('0x3e')],_0x1960b1,_0x149c0d[_0xfeb0('0x3b')])),'headers':{'Authorization':_0xfeb0('0x14')+_0x3ae748,'OData-Version':_0xfeb0('0x15')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x149c0d[_0xfeb0('0x3b')]===_0xfeb0('0x3f')){_0x35811b={'method':_0xfeb0('0x26'),'uri':_0x5363ed+_0xfeb0('0x40'),'body':Object[_0xfeb0('0x41')]({},{'subject':intUtil[_0xfeb0('0x42')](_0x149c0d['Subjects'],_0x1960b1,'\x20'),'phonenumber':String(_0x1960b1[_0xfeb0('0x25')]),'description':intUtil[_0xfeb0('0x42')](_0x149c0d[_0xfeb0('0x43')],_0x1960b1,'\x0a'),'regardingobjectid_contact@odata.bind':_0xfeb0('0x44')+_0x20a31b['enduserId']+')','ownerid@odata.bind':_0xfeb0('0x28')+_0x20a31b[_0xfeb0('0x1e')]+')','directioncode':_0x20a31b['callDirection']===_0xfeb0('0x45')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xfeb0('0x28')+_0x20a31b[_0xfeb0('0x1e')]+')','participationtypemask':_0x20a31b[_0xfeb0('0x46')]===_0xfeb0('0x45')?0x2:0x1},{'partyid_contact@odata.bind':_0xfeb0('0x44')+_0x20a31b[_0xfeb0('0x2c')]+')','participationtypemask':_0x20a31b[_0xfeb0('0x46')]===_0xfeb0('0x45')?0x1:0x2}]},getCustomFields(_0x149c0d[_0xfeb0('0x3e')],_0x1960b1,_0x149c0d['ticketType'])),'headers':{'Authorization':_0xfeb0('0x14')+_0x3ae748,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x35811b);})[_0xfeb0('0xd')](function(_0x1e5299){var _0x3ada09=_0x1e5299[_0xfeb0('0x47')][_0xfeb0('0x29')];var _0x510851=_0x3ada09[_0xfeb0('0x2a')](_0x3ada09[_0xfeb0('0x2b')]('(')+0x1,_0x3ada09['lastIndexOf'](')'));_0x20a31b[_0xfeb0('0x48')]=_0x510851;_0x39b419(_0x20a31b);})[_0xfeb0('0xf')](function(_0x5799e7){_0x4c4502(_0x5799e7['message']);});});}function emit(_0x224ddd,_0x3e62c2,_0x501be4,_0x8ef10c){var _0x276682={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x224ddd,_0x501be4,_0x8ef10c)};io['to'](util['format'](_0xfeb0('0x49'),_0x3e62c2))[_0xfeb0('0x4a')]('trigger:browser:url',_0x276682);}exports['cs']=function(_0x50a465,_0x8d09c7,_0x37cf54,_0x4a28f2,_0x432193,_0x1d584e,_0x19612c,_0x447a52){var _0x57c643={};_0x1d584e[_0xfeb0('0xa')]=intUtil[_0xfeb0('0x4b')](_0x1d584e['remoteUri']);_0x1d584e[_0xfeb0('0x4c')]=intUtil[_0xfeb0('0x4b')](_0x1d584e['serverUrl']);_0x57c643[_0xfeb0('0x46')]=_0x447a52===_0xfeb0('0x45')||_0x447a52===_0xfeb0('0x4d')?'queue':_0xfeb0('0x23');var _0x364e93=util[_0xfeb0('0x4e')](_0xfeb0('0x4f'),_0x1d584e[_0xfeb0('0xa')]);var _0x3e2229=util['format'](_0xfeb0('0x50'),_0x1d584e[_0xfeb0('0x51')]);var _0x4074d8=util[_0xfeb0('0x4e')](_0xfeb0('0x52'),_0x1d584e[_0xfeb0('0x4c')],_0x8d09c7['uniqueid'],md5(_0x8d09c7['uniqueid']));if(_0x432193&&_0x432193[_0xfeb0('0x53')]){logger['info'](_0xfeb0('0x54'),'Recording\x20is\x20enabled!');_0x8d09c7[_0xfeb0('0x55')]=_0x4074d8;}else if(_0x19612c&&_0x19612c[_0xfeb0('0x56')]&&_0x19612c[_0xfeb0('0x56')]!=='none'){logger[_0xfeb0('0x2f')](_0xfeb0('0x57'),_0xfeb0('0x58'));_0x8d09c7[_0xfeb0('0x55')]=_0x4074d8;}else{_0x8d09c7[_0xfeb0('0x55')]='';}return getUser(_0x57c643,_0x1d584e,_0x4a28f2,_0x3e2229,_0x364e93,_0x447a52)[_0xfeb0('0xd')](function(_0x424338){logger[_0xfeb0('0x2f')]('['+_0x447a52['toUpperCase']()+_0xfeb0('0x59'),_0x424338[_0xfeb0('0x1e')]);logger[_0xfeb0('0x2f')]('['+_0x447a52[_0xfeb0('0x10')]()+_0xfeb0('0x5a'),_0x424338[_0xfeb0('0x1a')]);return getEndUser(_0x424338,_0x1d584e,_0x3e2229,_0x364e93,_0x8d09c7,_0x447a52);})[_0xfeb0('0xd')](function(_0x1e85e2){logger['info']('['+_0x447a52[_0xfeb0('0x10')]()+_0xfeb0('0x5b'),_0x1e85e2[_0xfeb0('0x2c')]);logger[_0xfeb0('0x2f')]('['+_0x447a52[_0xfeb0('0x10')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x8d09c7[_0xfeb0('0x25')]);return getTicket(_0x1e85e2,_0x1d584e,_0x3e2229,_0x364e93,_0x8d09c7,_0x37cf54,_0x447a52);})[_0xfeb0('0xd')](function(_0x4f5270){logger['info'](util[_0xfeb0('0x4e')]('['+_0x447a52[_0xfeb0('0x10')]()+_0xfeb0('0x5c'),_0x37cf54[_0xfeb0('0x3b')],_0x4f5270['ticketId']));logger[_0xfeb0('0x2f')](util['format']('['+_0x447a52[_0xfeb0('0x10')]()+_0xfeb0('0x5d'),_0x447a52));if(_0x447a52!==_0xfeb0('0x4d')){logger['info']('['+_0x447a52[_0xfeb0('0x10')]()+']',_0xfeb0('0x5e'));emit(_0x1d584e[_0xfeb0('0xa')],_0x4a28f2['name'],_0x37cf54[_0xfeb0('0x3b')],_0x4f5270[_0xfeb0('0x48')]);}})[_0xfeb0('0xf')](function(_0x34dcc0){logger[_0xfeb0('0x5f')]('['+_0x447a52[_0xfeb0('0x10')]()+']\x20Error\x20running\x20Dynamics365\x20integration',util['inspect'](_0x34dcc0,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/freshdesk.js b/server/services/ami/trigger/integration/freshdesk.js index 8d80138..e3fdf38 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 _0x4248=['string','type','nameField','customField','toLowerCase','picklist','idField','push','content','toString','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','[QUEUE]','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','unmanaged','toUpperCase','lodash','md5','util','ioredis','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','emit','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','Ticket\x20created!','validateEmail','length','info','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','then','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','Enduser\x20created.','apiKey','base64','debug','[HTTP]','stringify','includes'];(function(_0x1ef847,_0x231eb9){var _0x280279=function(_0x5b0a17){while(--_0x5b0a17){_0x1ef847['push'](_0x1ef847['shift']());}};_0x280279(++_0x231eb9);}(_0x4248,0x144));var _0x8424=function(_0x2eaa66,_0x2062c0){_0x2eaa66=_0x2eaa66-0x0;var _0x3b1dd3=_0x4248[_0x2eaa66];return _0x3b1dd3;};'use strict';var _=require(_0x8424('0x0'));var rp=require('request-promise');var md5=require(_0x8424('0x1'));var util=require(_0x8424('0x2'));var Redis=require(_0x8424('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x8424('0x4'))(_0x8424('0x5'));config[_0x8424('0x6')]=_[_0x8424('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x8424('0x8'))(new Redis(config[_0x8424('0x6')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x466117,_0x5a389d,_0x3841cb){io['to'](_0x466117)[_0x8424('0x9')](_0x5a389d,_0x3841cb);}function getTicket(_0x4415b3,_0x373d58,_0x4d2e30,_0x1d416f,_0x24b31f){logger['info'](_0x8424('0xa'));var _0x31f0f6=_[_0x8424('0xb')]({'responder_id':_0x373d58['id'],'requester_id':_0x4d2e30['id'],'name':util['format'](_0x8424('0xc'),_0x24b31f[_0x8424('0xd')]),'phone':_0x24b31f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8424('0xe')](_0x1d416f[_0x8424('0xf')],_0x24b31f,'\x20'),'description':intUtil[_0x8424('0xe')](_0x1d416f[_0x8424('0x10')],_0x24b31f,_0x8424('0x11')),'tags':getTags(_0x1d416f[_0x8424('0x12')],_0x8424('0x13'))},getCustomFields(_0x1d416f[_0x8424('0x14')],_0x24b31f));_0x31f0f6[_0x8424('0x15')]=_[_0x8424('0x16')](_[_0x8424('0x17')](_0x31f0f6[_0x8424('0x15')],'id'),_0x8424('0x18'));return request({'uri':util[_0x8424('0x19')](_0x8424('0x1a'),_0x4415b3[_0x8424('0x1b')]),'method':'POST','body':_0x31f0f6})['then'](function(_0x568b32){logger['info'](_0x8424('0x1c'));return _0x568b32;});}function getUser(_0x34c58f,_0x216878){if(intUtil[_0x8424('0x1d')](_0x216878)){return request({'uri':util[_0x8424('0x19')]('%s/api/v2/agents',_0x34c58f[_0x8424('0x1b')]),'qs':{'email':_0x216878}})['then'](function(_0x2cdf7e){if(_0x2cdf7e[_0x8424('0x1e')]){logger[_0x8424('0x1f')](_0x8424('0x20'));return _[_0x8424('0x21')](_0x2cdf7e,function(_0x26bab7){return _0x26bab7[_0x8424('0x22')][_0x8424('0x23')]===_0x216878;});}else{logger[_0x8424('0x1f')](_0x8424('0x24'));return request({'uri':util[_0x8424('0x19')](_0x8424('0x25'),_0x34c58f[_0x8424('0x1b')])})[_0x8424('0x26')](function(_0x2c4fa9){logger[_0x8424('0x1f')](_0x8424('0x27'));return _0x2c4fa9;});}});}else{logger[_0x8424('0x1f')](_0x8424('0x28'));return request({'uri':util['format'](_0x8424('0x25'),_0x34c58f[_0x8424('0x1b')])})[_0x8424('0x26')](function(_0x469689){logger['info']('Admin\x20account\x20selected.');return _0x469689;});}}function getEndUser(_0x4a9881,_0x428a3c,_0x396ff0){logger[_0x8424('0x1f')](_0x8424('0x29'),_0x396ff0);return request({'uri':util['format'](_0x8424('0x2a'),_0x4a9881['remoteUri']),'qs':{'phone':_0x396ff0}})[_0x8424('0x26')](function(_0x32e019){if(_0x32e019[_0x8424('0x1e')]){logger[_0x8424('0x1f')]('Enduser\x20found!');return _['find'](_0x32e019,{'phone':_0x396ff0});}else{logger[_0x8424('0x1f')](_0x8424('0x2b'));return request({'uri':util[_0x8424('0x19')](_0x8424('0x2a'),_0x4a9881['remoteUri']),'method':_0x8424('0x2c'),'body':{'name':_0x428a3c,'phone':_0x396ff0}})[_0x8424('0x26')](function(_0x52e309){logger[_0x8424('0x1f')](_0x8424('0x2d'));return _0x52e309;});}});}function getAuth(_0x3cb7d9){return util[_0x8424('0x19')]('Basic\x20%s',new Buffer(_0x3cb7d9[_0x8424('0x2e')]+':X')['toString'](_0x8424('0x2f')));}function request(_0x325325){logger[_0x8424('0x30')](_0x8424('0x31'),JSON[_0x8424('0x32')](_0x325325));return rp(_[_0x8424('0x7')](_0x325325,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x11c4f5,_0x1e1c8f){var _0xf6fb49=[];if(_0x11c4f5&&_0x11c4f5['length']>0x0){_0xf6fb49=_['map'](_0x11c4f5,_0x1e1c8f);}return _0xf6fb49;}function getCustomFields(_0x3e322d,_0x4b7eb4){var _0x4a4061=[];var _0xa51bc3={'custom_fields':[]};if(_0x3e322d['length']>0x0){_['forEach'](_0x3e322d,function(_0x57dd8b){if(_[_0x8424('0x33')]([_0x8424('0x34'),'picklist'],_0x57dd8b[_0x8424('0x35')])&&_0x57dd8b[_0x8424('0x36')]&&!_0x57dd8b[_0x8424('0x37')]){_0xa51bc3[_0x57dd8b['nameField'][_0x8424('0x38')]()]=_0x57dd8b['content']['toString']();}else if(_['includes']([_0x8424('0x34'),_0x8424('0x39')],_0x57dd8b[_0x8424('0x35')])&&_0x57dd8b[_0x8424('0x3a')]&&_0x57dd8b[_0x8424('0x37')]){_0xa51bc3[_0x8424('0x15')][_0x8424('0x3b')]({'id':_0x57dd8b['idField'],'value':_0x57dd8b[_0x8424('0x3c')][_0x8424('0x3d')]()});}else if(_0x57dd8b[_0x8424('0x35')]===_0x8424('0x3e')&&_0x57dd8b[_0x8424('0x3f')]&&_0x57dd8b['idField']&&_0x57dd8b[_0x8424('0x37')]){_0x4b7eb4[_0x57dd8b['variableName']]&&_0xa51bc3['custom_fields'][_0x8424('0x3b')]({'id':_0x57dd8b[_0x8424('0x3a')],'value':_0x4b7eb4[_0x57dd8b[_0x8424('0x3f')]][_0x8424('0x3d')]()});}else if(_0x57dd8b['type']===_0x8424('0x40')&&_0x57dd8b[_0x8424('0x41')]&&_0x57dd8b[_0x8424('0x41')]['name']&&_0x57dd8b[_0x8424('0x3a')]&&_0x57dd8b[_0x8424('0x37')]){_0x4b7eb4[_0x57dd8b[_0x8424('0x41')][_0x8424('0x13')][_0x8424('0x38')]()]&&_0xa51bc3[_0x8424('0x15')][_0x8424('0x3b')]({'id':_0x57dd8b[_0x8424('0x3a')],'value':_0x4b7eb4[_0x57dd8b[_0x8424('0x41')][_0x8424('0x13')][_0x8424('0x38')]()]['toString']()});}});}return _0xa51bc3;}exports[_0x8424('0x42')]=function(_0x397929,_0x30c273,_0x597712,_0x5216a8,_0x5c3252,_0x359ba4){var _0x16946a,_0x41d2f7;_0x359ba4[_0x8424('0x1b')]=intUtil[_0x8424('0x43')](_0x359ba4['remoteUri']);_0x359ba4[_0x8424('0x44')]=intUtil[_0x8424('0x43')](_0x359ba4[_0x8424('0x44')]);if(_0x5c3252&&_0x5c3252[_0x8424('0x45')]){logger[_0x8424('0x1f')]('[QUEUE]',_0x8424('0x46'));_0x30c273[_0x8424('0x47')]=util['format'](_0x8424('0x48'),_0x359ba4[_0x8424('0x44')],_0x30c273[_0x8424('0x49')],md5(_0x30c273[_0x8424('0x49')]));}else{_0x30c273['recordingURL']='';}headers[_0x8424('0x4a')]=getAuth(_0x359ba4);return getUser(_0x359ba4,_0x5216a8[_0x8424('0x23')])[_0x8424('0x26')](function(_0x36e930){_0x16946a=_0x36e930;logger[_0x8424('0x1f')](_0x8424('0x4b'),_0x16946a['id']);return getEndUser(_0x359ba4,_0x30c273[_0x8424('0xd')],_0x30c273[_0x8424('0x4c')]);})[_0x8424('0x26')](function(_0x25d637){_0x41d2f7=_0x25d637;logger[_0x8424('0x1f')](_0x8424('0x4d'),_0x41d2f7['id']);return getTicket(_0x359ba4,_0x16946a,_0x41d2f7,_0x597712,_0x30c273);})['then'](function(_0x50c161){if(_0x50c161&&_0x50c161['id']){logger['info'](_0x8424('0x1c'));logger[_0x8424('0x1f')](_0x8424('0x4e'),_0x50c161['id']);logger[_0x8424('0x1f')]('[QUEUE]',_0x8424('0x4f'));emit(util[_0x8424('0x19')](_0x8424('0x50'),_0x5216a8[_0x8424('0x13')]),_0x8424('0x51'),{'uri':util[_0x8424('0x19')](_0x8424('0x52'),_0x359ba4[_0x8424('0x1b')],_0x50c161['id'])});}})[_0x8424('0x53')](function(_0x56772d){logger[_0x8424('0x54')](_0x8424('0x55'),JSON[_0x8424('0x32')](_0x56772d));});};exports[_0x8424('0x56')]=function(_0xa6eec,_0x56d8a6,_0x428f5d,_0x4bb224,_0x4eb077,_0x42e869,_0x191fe9){var _0xfceb47,_0x3a0073;_0x42e869[_0x8424('0x1b')]=intUtil['stripTrailingSlash'](_0x42e869[_0x8424('0x1b')]);_0x42e869[_0x8424('0x44')]=intUtil[_0x8424('0x43')](_0x42e869['serverUrl']);if(_0x191fe9&&_0x191fe9[_0x8424('0x57')]&&_0x191fe9[_0x8424('0x57')]!==_0x8424('0x58')){logger[_0x8424('0x1f')](_0x8424('0x59'),_0x8424('0x46'));_0x56d8a6[_0x8424('0x47')]=util[_0x8424('0x19')](_0x8424('0x48'),_0x42e869[_0x8424('0x44')],_0x56d8a6[_0x8424('0x49')],md5(_0x56d8a6[_0x8424('0x49')]));}headers[_0x8424('0x4a')]=getAuth(_0x42e869);return getUser(_0x42e869,_0x4bb224[_0x8424('0x23')])[_0x8424('0x26')](function(_0x5623a0){_0xfceb47=_0x5623a0;logger[_0x8424('0x1f')](_0x8424('0x4b'),_0xfceb47['id']);return getEndUser(_0x42e869,_0x56d8a6[_0x8424('0x5a')],_0x56d8a6[_0x8424('0x5b')]);})[_0x8424('0x26')](function(_0x385338){_0x3a0073=_0x385338;logger[_0x8424('0x1f')](_0x8424('0x4d'),_0x3a0073['id']);return getTicket(_0x42e869,_0xfceb47,_0x3a0073,_0x428f5d,_0x56d8a6);})[_0x8424('0x26')](function(_0x1c2a69){if(_0x1c2a69&&_0x1c2a69['id']){logger[_0x8424('0x1f')]('Ticket\x20created!');logger[_0x8424('0x1f')](_0x8424('0x4e'),_0x1c2a69['id']);logger[_0x8424('0x1f')](_0x8424('0x59'),_0x8424('0x4f'));emit(util['format'](_0x8424('0x50'),_0x4bb224['name']),'trigger:browser:url',{'uri':util['format'](_0x8424('0x52'),_0x42e869[_0x8424('0x1b')],_0x1c2a69['id'])});}})['catch'](function(_0x3c207f){logger['error'](_0x8424('0x59'),JSON[_0x8424('0x32')](_0x3c207f));});};exports[_0x8424('0x5c')]=function(_0x430ead,_0x5f3097,_0x2b380b,_0x17c759,_0x16974f,_0x557674){var _0x5480cc,_0x27948d;_0x557674[_0x8424('0x1b')]=intUtil[_0x8424('0x43')](_0x557674['remoteUri']);_0x557674[_0x8424('0x44')]=intUtil['stripTrailingSlash'](_0x557674[_0x8424('0x44')]);if(_0x16974f&&_0x16974f[_0x8424('0x45')]){logger['info']('['+_0x5f3097['lastevent']['toUpperCase']()+']',_0x8424('0x46'));_0x5f3097[_0x8424('0x47')]=util[_0x8424('0x19')](_0x8424('0x48'),_0x557674['serverUrl'],_0x5f3097[_0x8424('0x49')],md5(_0x5f3097['uniqueid']));}else{_0x5f3097[_0x8424('0x47')]='';}headers[_0x8424('0x4a')]=getAuth(_0x557674);return getUser(_0x557674,'')['then'](function(_0xdee837){_0x5480cc=_0xdee837;logger['info'](_0x8424('0x4b'),_0x5480cc['id']);return getEndUser(_0x557674,_0x5f3097[_0x8424('0xd')],_0x5f3097[_0x8424('0x4c')]);})[_0x8424('0x26')](function(_0x3c6052){_0x27948d=_0x3c6052;logger['info'](_0x8424('0x4d'),_0x27948d['id']);return getTicket(_0x557674,_0x5480cc,_0x27948d,_0x2b380b,_0x5f3097);})[_0x8424('0x26')](function(_0x137088){if(_0x137088){logger[_0x8424('0x1f')](_0x8424('0x1c'));logger[_0x8424('0x1f')](_0x8424('0x4e'),_0x137088['id']);}})[_0x8424('0x53')](function(_0x31640f){logger[_0x8424('0x54')]('['+_0x5f3097['lastevent'][_0x8424('0x5d')]()+']',JSON['stringify'](_0x31640f));});}; \ No newline at end of file +var _0x85cf=['content','string','push','variableName','idField','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','stringify','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Authorization','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','map','includes','picklist','type','nameField','customField'];(function(_0xa648e0,_0x21fa29){var _0x2e5f73=function(_0x53b4b9){while(--_0x53b4b9){_0xa648e0['push'](_0xa648e0['shift']());}};_0x2e5f73(++_0x21fa29);}(_0x85cf,0x19b));var _0xf85c=function(_0x29386e,_0x59f3ce){_0x29386e=_0x29386e-0x0;var _0x590b0d=_0x85cf[_0x29386e];return _0x590b0d;};'use strict';var _=require(_0xf85c('0x0'));var rp=require(_0xf85c('0x1'));var md5=require(_0xf85c('0x2'));var util=require(_0xf85c('0x3'));var Redis=require(_0xf85c('0x4'));var intUtil=require(_0xf85c('0x5'));var config=require('../../../../config/environment');var logger=require(_0xf85c('0x6'))(_0xf85c('0x7'));config[_0xf85c('0x8')]=_[_0xf85c('0x9')](config['redis'],{'host':_0xf85c('0xa'),'port':0x18eb});var io=require(_0xf85c('0xb'))(new Redis(config[_0xf85c('0x8')]));var headers={'Content-Type':_0xf85c('0xc'),'Accept':_0xf85c('0xc')};function emit(_0x471937,_0x17c335,_0x11a76f){io['to'](_0x471937)[_0xf85c('0xd')](_0x17c335,_0x11a76f);}function getTicket(_0x10fcf7,_0x7367d6,_0x35e927,_0x3f9044,_0x471714){logger[_0xf85c('0xe')](_0xf85c('0xf'));var _0x399992=_[_0xf85c('0x10')]({'responder_id':_0x7367d6['id'],'requester_id':_0x35e927['id'],'name':util[_0xf85c('0x11')](_0xf85c('0x12'),_0x471714[_0xf85c('0x13')]),'phone':_0x471714[_0xf85c('0x14')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf85c('0x15')](_0x3f9044['Subjects'],_0x471714,'\x20'),'description':intUtil[_0xf85c('0x15')](_0x3f9044[_0xf85c('0x16')],_0x471714,_0xf85c('0x17')),'tags':getTags(_0x3f9044[_0xf85c('0x18')],_0xf85c('0x19'))},getCustomFields(_0x3f9044[_0xf85c('0x1a')],_0x471714));_0x399992[_0xf85c('0x1b')]=_['mapValues'](_[_0xf85c('0x1c')](_0x399992[_0xf85c('0x1b')],'id'),_0xf85c('0x1d'));return request({'uri':util['format'](_0xf85c('0x1e'),_0x10fcf7[_0xf85c('0x1f')]),'method':_0xf85c('0x20'),'body':_0x399992})[_0xf85c('0x21')](function(_0x2a289c){logger['info'](_0xf85c('0x22'));return _0x2a289c;});}function getUser(_0x1a209b,_0x345a89){if(intUtil['validateEmail'](_0x345a89)){return request({'uri':util[_0xf85c('0x11')](_0xf85c('0x23'),_0x1a209b[_0xf85c('0x1f')]),'qs':{'email':_0x345a89}})[_0xf85c('0x21')](function(_0x139ced){if(_0x139ced[_0xf85c('0x24')]){logger['info'](_0xf85c('0x25'));return _[_0xf85c('0x26')](_0x139ced,function(_0x576082){return _0x576082[_0xf85c('0x27')][_0xf85c('0x28')]===_0x345a89;});}else{logger['info'](_0xf85c('0x29'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x1a209b[_0xf85c('0x1f')])})[_0xf85c('0x21')](function(_0x5cb72e){logger['info']('Admin\x20account\x20selected.');return _0x5cb72e;});}});}else{logger[_0xf85c('0xe')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf85c('0x11')](_0xf85c('0x2a'),_0x1a209b[_0xf85c('0x1f')])})[_0xf85c('0x21')](function(_0x5bc2a7){logger[_0xf85c('0xe')](_0xf85c('0x2b'));return _0x5bc2a7;});}}function getEndUser(_0x218fd7,_0x44d17a,_0x37ea85){logger['info'](_0xf85c('0x2c'),_0x37ea85);return request({'uri':util[_0xf85c('0x11')](_0xf85c('0x2d'),_0x218fd7[_0xf85c('0x1f')]),'qs':{'phone':_0x37ea85}})['then'](function(_0x28027f){if(_0x28027f[_0xf85c('0x24')]){logger[_0xf85c('0xe')](_0xf85c('0x2e'));return _['find'](_0x28027f,{'phone':_0x37ea85});}else{logger[_0xf85c('0xe')](_0xf85c('0x2f'));return request({'uri':util['format'](_0xf85c('0x2d'),_0x218fd7[_0xf85c('0x1f')]),'method':'POST','body':{'name':_0x44d17a,'phone':_0x37ea85}})[_0xf85c('0x21')](function(_0x4d23c7){logger[_0xf85c('0xe')](_0xf85c('0x30'));return _0x4d23c7;});}});}function getAuth(_0x41004f){return util[_0xf85c('0x11')](_0xf85c('0x31'),new Buffer(_0x41004f[_0xf85c('0x32')]+':X')[_0xf85c('0x33')](_0xf85c('0x34')));}function request(_0x309b34){logger['debug']('[HTTP]',JSON['stringify'](_0x309b34));return rp(_[_0xf85c('0x9')](_0x309b34,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2e3ce3,_0xcc039b){var _0x82c9b0=[];if(_0x2e3ce3&&_0x2e3ce3['length']>0x0){_0x82c9b0=_[_0xf85c('0x35')](_0x2e3ce3,_0xcc039b);}return _0x82c9b0;}function getCustomFields(_0x4f349d,_0x4944f3){var _0x2368c4=[];var _0x2f5345={'custom_fields':[]};if(_0x4f349d[_0xf85c('0x24')]>0x0){_['forEach'](_0x4f349d,function(_0x800515){if(_[_0xf85c('0x36')](['string',_0xf85c('0x37')],_0x800515[_0xf85c('0x38')])&&_0x800515[_0xf85c('0x39')]&&!_0x800515[_0xf85c('0x3a')]){_0x2f5345[_0x800515[_0xf85c('0x39')]['toLowerCase']()]=_0x800515[_0xf85c('0x3b')][_0xf85c('0x33')]();}else if(_[_0xf85c('0x36')]([_0xf85c('0x3c'),_0xf85c('0x37')],_0x800515[_0xf85c('0x38')])&&_0x800515['idField']&&_0x800515[_0xf85c('0x3a')]){_0x2f5345['custom_fields'][_0xf85c('0x3d')]({'id':_0x800515['idField'],'value':_0x800515[_0xf85c('0x3b')][_0xf85c('0x33')]()});}else if(_0x800515[_0xf85c('0x38')]==='variable'&&_0x800515[_0xf85c('0x3e')]&&_0x800515[_0xf85c('0x3f')]&&_0x800515[_0xf85c('0x3a')]){_0x4944f3[_0x800515[_0xf85c('0x3e')]]&&_0x2f5345[_0xf85c('0x1b')][_0xf85c('0x3d')]({'id':_0x800515[_0xf85c('0x3f')],'value':_0x4944f3[_0x800515[_0xf85c('0x3e')]]['toString']()});}else if(_0x800515[_0xf85c('0x38')]===_0xf85c('0x40')&&_0x800515[_0xf85c('0x41')]&&_0x800515[_0xf85c('0x41')][_0xf85c('0x19')]&&_0x800515[_0xf85c('0x3f')]&&_0x800515[_0xf85c('0x3a')]){_0x4944f3[_0x800515['Variable']['name'][_0xf85c('0x42')]()]&&_0x2f5345[_0xf85c('0x1b')][_0xf85c('0x3d')]({'id':_0x800515[_0xf85c('0x3f')],'value':_0x4944f3[_0x800515[_0xf85c('0x41')][_0xf85c('0x19')][_0xf85c('0x42')]()][_0xf85c('0x33')]()});}});}return _0x2f5345;}exports[_0xf85c('0x43')]=function(_0x51c79f,_0x30cf30,_0x9ffeb5,_0x5f27ac,_0x529127,_0x44698d){var _0x28d931,_0x1bd331;_0x44698d['remoteUri']=intUtil[_0xf85c('0x44')](_0x44698d[_0xf85c('0x1f')]);_0x44698d[_0xf85c('0x45')]=intUtil['stripTrailingSlash'](_0x44698d[_0xf85c('0x45')]);if(_0x529127&&_0x529127[_0xf85c('0x46')]){logger[_0xf85c('0xe')](_0xf85c('0x47'),'Recording\x20is\x20enabled!');_0x30cf30[_0xf85c('0x48')]=util['format'](_0xf85c('0x49'),_0x44698d[_0xf85c('0x45')],_0x30cf30[_0xf85c('0x4a')],md5(_0x30cf30['uniqueid']));}else{_0x30cf30[_0xf85c('0x48')]='';}headers['Authorization']=getAuth(_0x44698d);return getUser(_0x44698d,_0x5f27ac[_0xf85c('0x28')])[_0xf85c('0x21')](function(_0x3be4af){_0x28d931=_0x3be4af;logger[_0xf85c('0xe')]('The\x20User\x20ID\x20is:',_0x28d931['id']);return getEndUser(_0x44698d,_0x30cf30['calleridname'],_0x30cf30[_0xf85c('0x14')]);})[_0xf85c('0x21')](function(_0x488aef){_0x1bd331=_0x488aef;logger[_0xf85c('0xe')]('The\x20Enduser\x20ID\x20is:',_0x1bd331['id']);return getTicket(_0x44698d,_0x28d931,_0x1bd331,_0x9ffeb5,_0x30cf30);})[_0xf85c('0x21')](function(_0x4ec91e){if(_0x4ec91e&&_0x4ec91e['id']){logger[_0xf85c('0xe')](_0xf85c('0x22'));logger['info'](_0xf85c('0x4b'),_0x4ec91e['id']);logger[_0xf85c('0xe')]('[QUEUE]',_0xf85c('0x4c'));emit(util[_0xf85c('0x11')](_0xf85c('0x4d'),_0x5f27ac[_0xf85c('0x19')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x44698d[_0xf85c('0x1f')],_0x4ec91e['id'])});}})[_0xf85c('0x4e')](function(_0x2dc17d){logger['error']('[QUEUE]',JSON[_0xf85c('0x4f')](_0x2dc17d));});};exports['outbound']=function(_0x29cf98,_0x370ce1,_0x4cd7b1,_0xdc51d0,_0x179add,_0x104c4f,_0x2bdf30){var _0x5afdec,_0x18fc60;_0x104c4f['remoteUri']=intUtil['stripTrailingSlash'](_0x104c4f[_0xf85c('0x1f')]);_0x104c4f['serverUrl']=intUtil[_0xf85c('0x44')](_0x104c4f[_0xf85c('0x45')]);if(_0x2bdf30&&_0x2bdf30['recordingFormat']&&_0x2bdf30[_0xf85c('0x50')]!==_0xf85c('0x51')){logger[_0xf85c('0xe')](_0xf85c('0x52'),_0xf85c('0x53'));_0x370ce1['recordingURL']=util[_0xf85c('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x104c4f[_0xf85c('0x45')],_0x370ce1['uniqueid'],md5(_0x370ce1['uniqueid']));}headers[_0xf85c('0x54')]=getAuth(_0x104c4f);return getUser(_0x104c4f,_0xdc51d0['email'])['then'](function(_0x30a18f){_0x5afdec=_0x30a18f;logger[_0xf85c('0xe')](_0xf85c('0x55'),_0x5afdec['id']);return getEndUser(_0x104c4f,_0x370ce1[_0xf85c('0x56')],_0x370ce1[_0xf85c('0x57')]);})[_0xf85c('0x21')](function(_0x2f948d){_0x18fc60=_0x2f948d;logger[_0xf85c('0xe')](_0xf85c('0x58'),_0x18fc60['id']);return getTicket(_0x104c4f,_0x5afdec,_0x18fc60,_0x4cd7b1,_0x370ce1);})['then'](function(_0x1ba920){if(_0x1ba920&&_0x1ba920['id']){logger[_0xf85c('0xe')](_0xf85c('0x22'));logger['info'](_0xf85c('0x4b'),_0x1ba920['id']);logger[_0xf85c('0xe')](_0xf85c('0x52'),_0xf85c('0x4c'));emit(util[_0xf85c('0x11')](_0xf85c('0x4d'),_0xdc51d0[_0xf85c('0x19')]),_0xf85c('0x59'),{'uri':util[_0xf85c('0x11')]('%s/helpdesk/tickets/%d',_0x104c4f['remoteUri'],_0x1ba920['id'])});}})['catch'](function(_0x5176c2){logger[_0xf85c('0x5a')](_0xf85c('0x52'),JSON[_0xf85c('0x4f')](_0x5176c2));});};exports[_0xf85c('0x5b')]=function(_0x255e0a,_0x57fc26,_0x317f1c,_0x5cd32a,_0x3c4ad7,_0x127c94){var _0x338737,_0x31b059;_0x127c94[_0xf85c('0x1f')]=intUtil[_0xf85c('0x44')](_0x127c94[_0xf85c('0x1f')]);_0x127c94['serverUrl']=intUtil['stripTrailingSlash'](_0x127c94[_0xf85c('0x45')]);if(_0x3c4ad7&&_0x3c4ad7['monitor_format']){logger[_0xf85c('0xe')]('['+_0x57fc26[_0xf85c('0x5c')][_0xf85c('0x5d')]()+']','Recording\x20is\x20enabled!');_0x57fc26['recordingURL']=util[_0xf85c('0x11')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x127c94['serverUrl'],_0x57fc26[_0xf85c('0x4a')],md5(_0x57fc26[_0xf85c('0x4a')]));}else{_0x57fc26[_0xf85c('0x48')]='';}headers[_0xf85c('0x54')]=getAuth(_0x127c94);return getUser(_0x127c94,'')[_0xf85c('0x21')](function(_0x4b6f7f){_0x338737=_0x4b6f7f;logger[_0xf85c('0xe')]('The\x20User\x20ID\x20is:',_0x338737['id']);return getEndUser(_0x127c94,_0x57fc26[_0xf85c('0x13')],_0x57fc26[_0xf85c('0x14')]);})[_0xf85c('0x21')](function(_0x242ca4){_0x31b059=_0x242ca4;logger[_0xf85c('0xe')](_0xf85c('0x58'),_0x31b059['id']);return getTicket(_0x127c94,_0x338737,_0x31b059,_0x317f1c,_0x57fc26);})[_0xf85c('0x21')](function(_0x43ee1e){if(_0x43ee1e){logger[_0xf85c('0xe')]('Ticket\x20created!');logger['info'](_0xf85c('0x4b'),_0x43ee1e['id']);}})['catch'](function(_0x306411){logger[_0xf85c('0x5a')]('['+_0x57fc26[_0xf85c('0x5c')][_0xf85c('0x5d')]()+']',JSON[_0xf85c('0x4f')](_0x306411));});}; \ 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 398c191..a356ec6 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 _0x4a16=['contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Contact','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','util','moment','ioredis','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','socket.io-emitter','/api/selector/owners','headers','users','length','email','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','GET','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','mobile_number','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact'];(function(_0x3646e3,_0x1703c8){var _0x247596=function(_0x58c235){while(--_0x58c235){_0x3646e3['push'](_0x3646e3['shift']());}};_0x247596(++_0x1703c8);}(_0x4a16,0x124));var _0x64a1=function(_0x56ff2d,_0x324153){_0x56ff2d=_0x56ff2d-0x0;var _0xcc7a00=_0x4a16[_0x56ff2d];return _0xcc7a00;};'use strict';var _=require('lodash');var rp=require(_0x64a1('0x0'));var md5=require(_0x64a1('0x1'));var util=require(_0x64a1('0x2'));var moment=require(_0x64a1('0x3'));var Promise=require('bluebird');var Redis=require(_0x64a1('0x4'));var intUtil=require('./util');var config=require(_0x64a1('0x5'));var logger=require(_0x64a1('0x6'))(_0x64a1('0x7'));config[_0x64a1('0x8')]=_[_0x64a1('0x9')](config[_0x64a1('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x64a1('0xa'))(new Redis(config[_0x64a1('0x8')]));function getAdminId(_0x1b1ac0,_0x3be737,_0x7f87d2,_0x26349a){return new Promise(function(_0x16cef1,_0xb8fa3b){var _0x34034e=![];var _0x550101={'method':'GET','uri':_0x26349a+_0x64a1('0xb'),'json':!![]};_0x550101[_0x64a1('0xc')]=_0x7f87d2;logger['info']('Getting\x20admin\x20information');return rp(_0x550101)['then'](function(_0x160e0b){if(_0x160e0b){var _0x1b0bd5=_0x160e0b[_0x64a1('0xd')];var _0x5bd102=null;for(_0x5bd102=0x0;_0x5bd102<_0x1b0bd5[_0x64a1('0xe')];_0x5bd102++){if(_0x1b0bd5[_0x5bd102][_0x64a1('0xf')]===_0x1b1ac0[_0x64a1('0x10')]){_0x1b1ac0[_0x64a1('0x11')]=_0x1b0bd5[_0x5bd102]['id'];_0x34034e=!![];}}if(_0x34034e){logger[_0x64a1('0x12')](_0x64a1('0x13'),_0x1b1ac0[_0x64a1('0x11')]);_0x16cef1(_0x1b1ac0);}else{_0xb8fa3b({'statusCode':0x194,'message':_0x64a1('0x14')});}}else{_0xb8fa3b({'statusCode':0x194,'message':_0x64a1('0x14')});}})[_0x64a1('0x15')](function(_0x311916){logger[_0x64a1('0x16')]('['+[_0x3be737[_0x64a1('0x17')]()]+']',_0x311916[_0x64a1('0x18')]);_0xb8fa3b(_0x311916);});});}function getUser(_0x579a13,_0xf18025,_0x206cdd){return function(_0x2c64a6){return new Promise(function(_0x21e5ab,_0x4b9c5e){var _0x328b67={'method':'GET','uri':_0x206cdd+_0x64a1('0xb'),'json':!![]};_0x328b67[_0x64a1('0xc')]=_0xf18025;logger[_0x64a1('0x12')](_0x64a1('0x19'));return rp(_0x328b67)[_0x64a1('0x1a')](function(_0x44c1fc){if(_0x44c1fc){var _0x2eb63e=_0x44c1fc[_0x64a1('0xd')];var _0x857ceb=![];var _0xa32cd7=null;if(_0x2c64a6[_0x64a1('0x1b')]!==null){logger[_0x64a1('0x12')](_0x64a1('0x1c'),_0x2c64a6['agentEmail']);_0x2c64a6[_0x64a1('0x1d')]=_0x2c64a6[_0x64a1('0x1b')];for(_0xa32cd7=0x0;_0xa32cd7<_0x2eb63e[_0x64a1('0xe')];_0xa32cd7++){if(_0x2eb63e[_0xa32cd7]['email']===_0x2c64a6[_0x64a1('0x1b')]){_0x857ceb=!![];_0x2c64a6[_0x64a1('0x1e')]=_0x2eb63e[_0xa32cd7]['id'];logger[_0x64a1('0x12')](_0x64a1('0x1f'),_0x2c64a6['userId']);}}}if(!_0x857ceb){logger[_0x64a1('0x12')]('Admin\x20selected');_0x2c64a6[_0x64a1('0x1d')]=_0x2c64a6[_0x64a1('0x10')];_0x2c64a6[_0x64a1('0x1e')]=_0x2c64a6[_0x64a1('0x11')];_0x857ceb=!![];}if(_0x857ceb){_0x21e5ab(_0x2c64a6);}else{_0x4b9c5e({'statusCode':0x194,'message':_0x64a1('0x14')});}}else{_0x4b9c5e({'statusCode':0x194,'message':_0x64a1('0x14')});}})[_0x64a1('0x15')](function(_0x574196){logger[_0x64a1('0x16')]('['+[_0x579a13[_0x64a1('0x17')]()]+']',_0x574196[_0x64a1('0x18')]);_0x4b9c5e(_0x574196);});});};}function searchContact(_0x4989a2,_0x4fcd9c,_0x1b9f3d,_0x386713){return new Promise(function(_0x6a72f8,_0x26f662){var _0x1e97c6={'method':_0x64a1('0x20'),'headers':_0x4fcd9c,'uri':_0x4989a2+_0x64a1('0x21')+_0x386713+_0x64a1('0x22')+_0x1b9f3d+'&entities=contact','json':!![]};rp(_0x1e97c6)[_0x64a1('0x1a')](function(_0x39aba8){var _0x5e00fc=_[_0x64a1('0x23')](_0x39aba8[_0x64a1('0x24')]['contacts'],[_0x1b9f3d,_0x386713]);_0x6a72f8(_0x5e00fc);})['catch'](function(_0x3ffd43){_0x26f662(_0x3ffd43);});});}function getEndUser(_0x371372,_0x4475d3,_0x3311a8){return function(_0x26a2a3){return new Promise(function(_0x1245b5,_0x3d7bba){logger[_0x64a1('0x12')](util[_0x64a1('0x25')](_0x64a1('0x26'),_0x26a2a3['contactNumber']));searchContact(_0x3311a8,_0x4475d3,_0x64a1('0x27'),_0x26a2a3[_0x64a1('0x28')])[_0x64a1('0x1a')](function(_0x28e99c){if(_0x28e99c){_0x26a2a3['endUserId']=_0x28e99c['id'];logger['info'](_0x64a1('0x29'),_0x26a2a3[_0x64a1('0x2a')]);return _0x1245b5(_0x26a2a3);}searchContact(_0x3311a8,_0x4475d3,_0x64a1('0x2b'),_0x26a2a3[_0x64a1('0x28')])[_0x64a1('0x1a')](function(_0x3da022){if(_0x3da022){_0x26a2a3[_0x64a1('0x2a')]=_0x3da022['id'];logger['info'](_0x64a1('0x2c'),_0x26a2a3[_0x64a1('0x2a')]);return _0x1245b5(_0x26a2a3);}createEndUser(_0x26a2a3,_0x371372,_0x4475d3,_0x3311a8)['then'](function(_0x33131a){logger['info']('Contact\x20created:',_0x33131a[_0x64a1('0x2a')]);return _0x1245b5(_0x33131a);});});})[_0x64a1('0x15')](function(_0x1cce2c){_0x3d7bba(_0x1cce2c);});});};}function createEndUser(_0x16ca57,_0x5094b8,_0x106d18,_0x1df315){return new Promise(function(_0x48572e,_0xf1ee12){var _0x607d9f=moment();var _0x5d23ec={'method':'POST','uri':_0x1df315+_0x64a1('0x2d'),'body':{'contact':{'last_name':_0x16ca57['contactNumber'],'work_number':_0x16ca57[_0x64a1('0x28')],'mobile_number':_0x16ca57[_0x64a1('0x28')],'owner_id':_0x16ca57[_0x64a1('0x1e')],'created_at':_0x607d9f['format'](_0x64a1('0x2e'))}},'json':!![]};_0x5d23ec['headers']=_0x106d18;logger[_0x64a1('0x12')](_0x64a1('0x2f'));return rp(_0x5d23ec)[_0x64a1('0x1a')](function(_0x41e791){_0x16ca57[_0x64a1('0x2a')]=_0x41e791[_0x64a1('0x30')]['id'];_0x48572e(_0x16ca57);})['catch'](function(_0x464ab3){logger[_0x64a1('0x16')]('['+[_0x5094b8[_0x64a1('0x17')]()]+']',_0x464ab3[_0x64a1('0x18')]);_0xf1ee12(_0x464ab3[_0x64a1('0x18')]);});});}function getTicket(_0x3d46a4,_0x353a7f,_0x41ad18,_0x4ce1fc,_0x2a0556){return function(_0x1d1aec){logger[_0x64a1('0x12')](_0x64a1('0x31'));return new Promise(function(_0x5f4a12,_0x17337a){var _0x2ede8b=moment();var _0xc70c1d={'method':_0x64a1('0x32'),'uri':_0x41ad18+_0x64a1('0x33'),'body':{'title':intUtil[_0x64a1('0x34')](_0x4ce1fc[_0x64a1('0x35')],_0x2a0556,'\x20'),'description':intUtil[_0x64a1('0x34')](_0x4ce1fc['Descriptions'],_0x2a0556,'\x0a'),'owner_id':_0x1d1aec[_0x64a1('0x1e')],'creater_id':_0x1d1aec[_0x64a1('0x11')],'targetable_id':_0x1d1aec[_0x64a1('0x2a')],'targetable_type':_0x64a1('0x36'),'created_at':_0x2ede8b['format'](_0x64a1('0x2e')),'due_date':_0x2ede8b[_0x64a1('0x37')](0x1e,'m')[_0x64a1('0x25')](_0x64a1('0x2e'))},'json':!![]};_0xc70c1d[_0x64a1('0xc')]=_0x353a7f;return rp(_0xc70c1d)[_0x64a1('0x1a')](function(_0x315744){_0x1d1aec[_0x64a1('0x38')]=_0x315744[_0x64a1('0x39')]['id'];logger[_0x64a1('0x12')](_0x64a1('0x3a'),_0x1d1aec[_0x64a1('0x38')]);_0x5f4a12(_0x1d1aec);})['catch'](function(_0x50e325){logger[_0x64a1('0x16')]('['+[_0x3d46a4[_0x64a1('0x17')]()]+']',_0x50e325[_0x64a1('0x18')]);_0x17337a(_0x50e325[_0x64a1('0x18')]);});});};}function emit(_0x15e873,_0x424c10,_0x304ace){var _0x6102fa={'uri':_0x15e873+_0x64a1('0x3b')+_0x304ace};io['to'](util[_0x64a1('0x25')](_0x64a1('0x3c'),_0x424c10))['emit'](_0x64a1('0x3d'),_0x6102fa);}exports['cs']=function(_0x1e6eea,_0x1eebc9,_0x4d57e2,_0x339980,_0x13b697,_0x59c183,_0x25393f,_0x316c66){var _0x264b65={};var _0x4b65b9={'Authorization':_0x64a1('0x3e')+_0x59c183[_0x64a1('0x3f')]};_0x59c183[_0x64a1('0x40')]=intUtil[_0x64a1('0x41')](_0x59c183['remoteUri']);_0x59c183[_0x64a1('0x42')]=intUtil['stripTrailingSlash'](_0x59c183[_0x64a1('0x42')]);var _0x280afe=_0x59c183['remoteUri'];_0x264b65[_0x64a1('0x10')]=_0x59c183[_0x64a1('0x43')];_0x264b65[_0x64a1('0x28')]=_0x316c66['toLowerCase']()==='outbound'?_0x1eebc9[_0x64a1('0x44')]:_0x1eebc9[_0x64a1('0x45')];_0x264b65[_0x64a1('0x46')]=_0x316c66===_0x64a1('0x47')||_0x316c66===_0x64a1('0x48')?_0x64a1('0x47'):_0x64a1('0x49');if(_0x339980){_0x264b65[_0x64a1('0x1b')]=_0x339980[_0x64a1('0xf')];}var _0x155207=util['format'](_0x64a1('0x4a'),_0x59c183[_0x64a1('0x42')],_0x1eebc9[_0x64a1('0x4b')],md5(_0x1eebc9[_0x64a1('0x4b')]));if(_0x13b697&&_0x13b697['monitor_format']){logger[_0x64a1('0x12')](_0x64a1('0x4c'),_0x64a1('0x4d'));_0x1eebc9[_0x64a1('0x4e')]=_0x155207;}else if(_0x25393f&&_0x25393f['recordingFormat']&&_0x25393f[_0x64a1('0x4f')]!=='none'){logger[_0x64a1('0x12')]('[OUTBOUND]',_0x64a1('0x4d'));_0x1eebc9['recordingURL']=_0x155207;}else{_0x1eebc9[_0x64a1('0x4e')]='';}return getAdminId(_0x264b65,_0x316c66,_0x4b65b9,_0x280afe)['then'](getUser(_0x316c66,_0x4b65b9,_0x280afe))[_0x64a1('0x1a')](getEndUser(_0x316c66,_0x4b65b9,_0x280afe))['then'](getTicket(_0x316c66,_0x4b65b9,_0x280afe,_0x4d57e2,_0x1eebc9))[_0x64a1('0x1a')](function(_0x31fbec){logger[_0x64a1('0x12')](util[_0x64a1('0x25')](_0x64a1('0x50'),_0x31fbec[_0x64a1('0x38')]));if(_0x316c66!==_0x64a1('0x48')){logger[_0x64a1('0x12')]('['+[_0x316c66['toUpperCase']()]+']',_0x64a1('0x51'));emit(_0x280afe,_0x339980[_0x64a1('0x52')],_0x31fbec['endUserId']);}})[_0x64a1('0x15')](function(_0xa2967e){logger[_0x64a1('0x16')]('['+[_0x316c66[_0x64a1('0x17')]()]+_0x64a1('0x53'),util[_0x64a1('0x54')](_0xa2967e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5452=['inspect','lodash','md5','util','moment','ioredis','./util','redis','defaults','localhost','socket.io-emitter','GET','then','users','length','adminEmail','adminId','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','/api/selector/owners','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','User\x20found:','userId','toUpperCase','message','/api/lookup?q=','&entities=contact','find','contacts','format','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','Subjects','Descriptions','add','task','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','recordingURL','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','ticketId','unmanaged','name'];(function(_0xf47a2d,_0x149fd4){var _0x2fec56=function(_0x4cd8f8){while(--_0x4cd8f8){_0xf47a2d['push'](_0xf47a2d['shift']());}};_0x2fec56(++_0x149fd4);}(_0x5452,0x13d));var _0x2545=function(_0x3febf6,_0x519bd0){_0x3febf6=_0x3febf6-0x0;var _0x1d8dc1=_0x5452[_0x3febf6];return _0x1d8dc1;};'use strict';var _=require(_0x2545('0x0'));var rp=require('request-promise');var md5=require(_0x2545('0x1'));var util=require(_0x2545('0x2'));var moment=require(_0x2545('0x3'));var Promise=require('bluebird');var Redis=require(_0x2545('0x4'));var intUtil=require(_0x2545('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('freshsales');config[_0x2545('0x6')]=_[_0x2545('0x7')](config[_0x2545('0x6')],{'host':_0x2545('0x8'),'port':0x18eb});var io=require(_0x2545('0x9'))(new Redis(config[_0x2545('0x6')]));function getAdminId(_0x453dc1,_0x597965,_0x2c7bbc,_0x49fb0){return new Promise(function(_0x4738a3,_0x5d391a){var _0x14bb5e=![];var _0x130372={'method':_0x2545('0xa'),'uri':_0x49fb0+'/api/selector/owners','json':!![]};_0x130372['headers']=_0x2c7bbc;logger['info']('Getting\x20admin\x20information');return rp(_0x130372)[_0x2545('0xb')](function(_0x4ada63){if(_0x4ada63){var _0x8169a5=_0x4ada63[_0x2545('0xc')];var _0x3444eb=null;for(_0x3444eb=0x0;_0x3444eb<_0x8169a5[_0x2545('0xd')];_0x3444eb++){if(_0x8169a5[_0x3444eb]['email']===_0x453dc1[_0x2545('0xe')]){_0x453dc1[_0x2545('0xf')]=_0x8169a5[_0x3444eb]['id'];_0x14bb5e=!![];}}if(_0x14bb5e){logger[_0x2545('0x10')](_0x2545('0x11'),_0x453dc1['adminId']);_0x4738a3(_0x453dc1);}else{_0x5d391a({'statusCode':0x194,'message':_0x2545('0x12')});}}else{_0x5d391a({'statusCode':0x194,'message':_0x2545('0x12')});}})[_0x2545('0x13')](function(_0x1bc262){logger[_0x2545('0x14')]('['+[_0x597965['toUpperCase']()]+']',_0x1bc262['message']);_0x5d391a(_0x1bc262);});});}function getUser(_0x1a64a1,_0x2cbcc8,_0x120ee6){return function(_0x1c0543){return new Promise(function(_0xda664c,_0x537983){var _0x2880df={'method':_0x2545('0xa'),'uri':_0x120ee6+_0x2545('0x15'),'json':!![]};_0x2880df[_0x2545('0x16')]=_0x2cbcc8;logger[_0x2545('0x10')](_0x2545('0x17'));return rp(_0x2880df)[_0x2545('0xb')](function(_0x1403fc){if(_0x1403fc){var _0x2dc0c7=_0x1403fc[_0x2545('0xc')];var _0x55d50a=![];var _0x2c2677=null;if(_0x1c0543[_0x2545('0x18')]!==null){logger[_0x2545('0x10')](_0x2545('0x19'),_0x1c0543[_0x2545('0x18')]);_0x1c0543[_0x2545('0x1a')]=_0x1c0543[_0x2545('0x18')];for(_0x2c2677=0x0;_0x2c2677<_0x2dc0c7[_0x2545('0xd')];_0x2c2677++){if(_0x2dc0c7[_0x2c2677][_0x2545('0x1b')]===_0x1c0543[_0x2545('0x18')]){_0x55d50a=!![];_0x1c0543['userId']=_0x2dc0c7[_0x2c2677]['id'];logger[_0x2545('0x10')](_0x2545('0x1c'),_0x1c0543[_0x2545('0x1d')]);}}}if(!_0x55d50a){logger[_0x2545('0x10')]('Admin\x20selected');_0x1c0543[_0x2545('0x1a')]=_0x1c0543['adminEmail'];_0x1c0543[_0x2545('0x1d')]=_0x1c0543['adminId'];_0x55d50a=!![];}if(_0x55d50a){_0xda664c(_0x1c0543);}else{_0x537983({'statusCode':0x194,'message':_0x2545('0x12')});}}else{_0x537983({'statusCode':0x194,'message':_0x2545('0x12')});}})[_0x2545('0x13')](function(_0x11062a){logger[_0x2545('0x14')]('['+[_0x1a64a1[_0x2545('0x1e')]()]+']',_0x11062a[_0x2545('0x1f')]);_0x537983(_0x11062a);});});};}function searchContact(_0x1ee760,_0x1ae4d2,_0xf8f4aa,_0xb4427a){return new Promise(function(_0x33dd73,_0x18199c){var _0x5d46e2={'method':_0x2545('0xa'),'headers':_0x1ae4d2,'uri':_0x1ee760+_0x2545('0x20')+_0xb4427a+'&f='+_0xf8f4aa+_0x2545('0x21'),'json':!![]};rp(_0x5d46e2)[_0x2545('0xb')](function(_0x312af1){var _0x389662=_[_0x2545('0x22')](_0x312af1[_0x2545('0x23')][_0x2545('0x23')],[_0xf8f4aa,_0xb4427a]);_0x33dd73(_0x389662);})['catch'](function(_0x41b9a6){_0x18199c(_0x41b9a6);});});}function getEndUser(_0x458e31,_0x2d0676,_0x1236c3){return function(_0x3c556b){return new Promise(function(_0x2bd83c,_0x1b0fa4){logger[_0x2545('0x10')](util[_0x2545('0x24')]('Searching\x20contact\x20with\x20phone\x20%s',_0x3c556b[_0x2545('0x25')]));searchContact(_0x1236c3,_0x2d0676,_0x2545('0x26'),_0x3c556b[_0x2545('0x25')])[_0x2545('0xb')](function(_0x233aa9){if(_0x233aa9){_0x3c556b[_0x2545('0x27')]=_0x233aa9['id'];logger[_0x2545('0x10')](_0x2545('0x28'),_0x3c556b[_0x2545('0x27')]);return _0x2bd83c(_0x3c556b);}searchContact(_0x1236c3,_0x2d0676,_0x2545('0x29'),_0x3c556b['contactNumber'])['then'](function(_0x5c7db1){if(_0x5c7db1){_0x3c556b[_0x2545('0x27')]=_0x5c7db1['id'];logger[_0x2545('0x10')](_0x2545('0x2a'),_0x3c556b['endUserId']);return _0x2bd83c(_0x3c556b);}createEndUser(_0x3c556b,_0x458e31,_0x2d0676,_0x1236c3)[_0x2545('0xb')](function(_0x219c97){logger['info'](_0x2545('0x2b'),_0x219c97[_0x2545('0x27')]);return _0x2bd83c(_0x219c97);});});})[_0x2545('0x13')](function(_0x594416){_0x1b0fa4(_0x594416);});});};}function createEndUser(_0x44f898,_0x236bd7,_0x207a71,_0x548e4a){return new Promise(function(_0x35d3b9,_0x179813){var _0x539837=moment();var _0x51a2c2={'method':_0x2545('0x2c'),'uri':_0x548e4a+_0x2545('0x2d'),'body':{'contact':{'last_name':_0x44f898['contactNumber'],'work_number':_0x44f898[_0x2545('0x25')],'mobile_number':_0x44f898[_0x2545('0x25')],'owner_id':_0x44f898[_0x2545('0x1d')],'created_at':_0x539837['format'](_0x2545('0x2e'))}},'json':!![]};_0x51a2c2['headers']=_0x207a71;logger['info'](_0x2545('0x2f'));return rp(_0x51a2c2)[_0x2545('0xb')](function(_0x4132f2){_0x44f898[_0x2545('0x27')]=_0x4132f2[_0x2545('0x30')]['id'];_0x35d3b9(_0x44f898);})[_0x2545('0x13')](function(_0x5abbc1){logger[_0x2545('0x14')]('['+[_0x236bd7[_0x2545('0x1e')]()]+']',_0x5abbc1['message']);_0x179813(_0x5abbc1[_0x2545('0x1f')]);});});}function getTicket(_0x524fd2,_0xddac04,_0xdadf4b,_0x17a492,_0x1a8826){return function(_0x2e62ed){logger[_0x2545('0x10')](_0x2545('0x31'));return new Promise(function(_0x13e8d7,_0x2e086b){var _0x2be1dc=moment();var _0x2b78b3={'method':_0x2545('0x2c'),'uri':_0xdadf4b+'/api/tasks','body':{'title':intUtil['getString'](_0x17a492[_0x2545('0x32')],_0x1a8826,'\x20'),'description':intUtil['getString'](_0x17a492[_0x2545('0x33')],_0x1a8826,'\x0a'),'owner_id':_0x2e62ed['userId'],'creater_id':_0x2e62ed[_0x2545('0xf')],'targetable_id':_0x2e62ed[_0x2545('0x27')],'targetable_type':'Contact','created_at':_0x2be1dc['format'](_0x2545('0x2e')),'due_date':_0x2be1dc[_0x2545('0x34')](0x1e,'m')[_0x2545('0x24')](_0x2545('0x2e'))},'json':!![]};_0x2b78b3[_0x2545('0x16')]=_0xddac04;return rp(_0x2b78b3)[_0x2545('0xb')](function(_0x12ba07){_0x2e62ed['ticketId']=_0x12ba07[_0x2545('0x35')]['id'];logger[_0x2545('0x10')]('Task\x20created:',_0x2e62ed['ticketId']);_0x13e8d7(_0x2e62ed);})[_0x2545('0x13')](function(_0x3cd79c){logger[_0x2545('0x14')]('['+[_0x524fd2[_0x2545('0x1e')]()]+']',_0x3cd79c[_0x2545('0x1f')]);_0x2e086b(_0x3cd79c['message']);});});};}function emit(_0x5c5229,_0x90015e,_0x5f008d){var _0x3c3f96={'uri':_0x5c5229+'/contacts/'+_0x5f008d};io['to'](util[_0x2545('0x24')]('user:%s',_0x90015e))[_0x2545('0x36')](_0x2545('0x37'),_0x3c3f96);}exports['cs']=function(_0x450032,_0x70f4cb,_0x4a582c,_0xbf357b,_0x472337,_0x470a38,_0x55acc2,_0x1c0e6e){var _0x259ebe={};var _0x705f45={'Authorization':_0x2545('0x38')+_0x470a38['apiKey']};_0x470a38[_0x2545('0x39')]=intUtil[_0x2545('0x3a')](_0x470a38['remoteUri']);_0x470a38[_0x2545('0x3b')]=intUtil[_0x2545('0x3a')](_0x470a38[_0x2545('0x3b')]);var _0x1d7625=_0x470a38['remoteUri'];_0x259ebe[_0x2545('0xe')]=_0x470a38[_0x2545('0x3c')];_0x259ebe[_0x2545('0x25')]=_0x1c0e6e[_0x2545('0x3d')]()===_0x2545('0x3e')?_0x70f4cb[_0x2545('0x3f')]:_0x70f4cb['calleridnum'];_0x259ebe[_0x2545('0x40')]=_0x1c0e6e===_0x2545('0x41')||_0x1c0e6e==='unmanaged'?'queue':'outbound';if(_0xbf357b){_0x259ebe[_0x2545('0x18')]=_0xbf357b['email'];}var _0x87ac79=util[_0x2545('0x24')](_0x2545('0x42'),_0x470a38[_0x2545('0x3b')],_0x70f4cb[_0x2545('0x43')],md5(_0x70f4cb[_0x2545('0x43')]));if(_0x472337&&_0x472337[_0x2545('0x44')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x70f4cb[_0x2545('0x45')]=_0x87ac79;}else if(_0x55acc2&&_0x55acc2[_0x2545('0x46')]&&_0x55acc2[_0x2545('0x46')]!==_0x2545('0x47')){logger[_0x2545('0x10')](_0x2545('0x48'),_0x2545('0x49'));_0x70f4cb[_0x2545('0x45')]=_0x87ac79;}else{_0x70f4cb[_0x2545('0x45')]='';}return getAdminId(_0x259ebe,_0x1c0e6e,_0x705f45,_0x1d7625)[_0x2545('0xb')](getUser(_0x1c0e6e,_0x705f45,_0x1d7625))[_0x2545('0xb')](getEndUser(_0x1c0e6e,_0x705f45,_0x1d7625))[_0x2545('0xb')](getTicket(_0x1c0e6e,_0x705f45,_0x1d7625,_0x4a582c,_0x70f4cb))[_0x2545('0xb')](function(_0x4a37bf){logger[_0x2545('0x10')](util[_0x2545('0x24')](_0x2545('0x4a'),_0x4a37bf[_0x2545('0x4b')]));if(_0x1c0e6e!==_0x2545('0x4c')){logger[_0x2545('0x10')]('['+[_0x1c0e6e[_0x2545('0x1e')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x1d7625,_0xbf357b[_0x2545('0x4d')],_0x4a37bf[_0x2545('0x27')]);}})[_0x2545('0x13')](function(_0x2b7def){logger[_0x2545('0x14')]('['+[_0x1c0e6e[_0x2545('0x1e')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x2545('0x4e')](_0x2b7def,{'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 6f55592..fe61834 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 _0xd4b1=['format','util','./zendesk','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','outbound','log','unmanaged','unknown\x20integration','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd4b1,0xbf));var _0x1d4b=function(_0x1a29b4,_0x34e94d){_0x1a29b4=_0x1a29b4-0x0;var _0xc7bbc5=_0xd4b1[_0x1a29b4];return _0xc7bbc5;};'use strict';var _=require('lodash');var util=require(_0x1d4b('0x0'));var zendesk=require(_0x1d4b('0x1'));var salesforce=require('./salesforce');var sugarcrm=require(_0x1d4b('0x2'));var freshdesk=require(_0x1d4b('0x3'));var zoho=require(_0x1d4b('0x4'));var desk=require(_0x1d4b('0x5'));var vtiger=require(_0x1d4b('0x6'));var servicenow=require(_0x1d4b('0x7'));var dynamics365=require(_0x1d4b('0x8'));var freshsales=require(_0x1d4b('0x9'));var integrations=[_0x1d4b('0xa'),_0x1d4b('0xb'),_0x1d4b('0xc'),_0x1d4b('0xd'),_0x1d4b('0xe'),_0x1d4b('0xf'),_0x1d4b('0x10'),_0x1d4b('0x11'),_0x1d4b('0x12'),_0x1d4b('0x13')];exports[_0x1d4b('0x14')]=function(_0xccfae0,_0x31e483,_0x1acc88,_0x57f982,_0x340450,_0xfa3bd7){if(_0x1acc88){if(_[_0x1d4b('0x15')](integrations,_0xccfae0[_0x1d4b('0x16')][_0x1d4b('0x17')]())){try{var _0x5a3d64=null;var _0x477586='';var _0x4fa414=_0x1acc88[_0xccfae0[_0x1d4b('0x16')][_0x1d4b('0x17')]()];if(_0x4fa414){var _0x55da2c=_0x4fa414[_0xccfae0[_0x1d4b('0x18')]];if(_0x55da2c){var _0x21a288=_[_0x1d4b('0x19')](_0x55da2c[_0x1d4b('0x1a')],{'id':parseInt(_0xccfae0[_0x1d4b('0x1b')],0xa)});if(_0x21a288){if(_0x57f982){if(_0x340450&&_0x31e483['queue']){_0x477586=_0x1d4b('0x1c');}else if(_0x31e483['routeId']){_0x477586=_0x1d4b('0x1d');}else{console[_0x1d4b('0x1e')]('EVENT\x20UNKNOWN',_0x31e483);}}else{_0x477586=_0x1d4b('0x1f');}switch(_0xccfae0[_0x1d4b('0x16')][_0x1d4b('0x17')]()){case _0x1d4b('0xa'):zendesk[_0x477586](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7);break;case _0x1d4b('0xb'):salesforce[_0x477586](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7);break;case _0x1d4b('0xc'):sugarcrm[_0x477586](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7);break;case _0x1d4b('0xd'):freshdesk[_0x477586](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7);break;case _0x1d4b('0xe'):zoho[_0x477586](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7);break;case _0x1d4b('0xf'):desk[_0x477586](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7);break;case'vtiger':vtiger[_0x477586](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7);break;case'freshsales':freshsales['cs'](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7,_0x477586);break;case _0x1d4b('0x13'):servicenow['cs'](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7,_0x477586);break;case _0x1d4b('0x11'):dynamics365['cs'](_0xccfae0,_0x31e483,_0x21a288,_0x57f982,_0x340450,_0x55da2c,_0xfa3bd7,_0x477586);break;default:console[_0x1d4b('0x1e')](_0x1d4b('0x20'));}}else{_0x5a3d64=require('../../../../config/logger')(_0xccfae0[_0x1d4b('0x16')][_0x1d4b('0x17')]());_0x5a3d64[_0x1d4b('0x21')](_0x1d4b('0x22'),util['format'](_0x1d4b('0x23'),_0xccfae0[_0x1d4b('0x16')]['toLowerCase'](),_0xccfae0['data3']));}}else{_0x5a3d64=require(_0x1d4b('0x24'))(_0xccfae0[_0x1d4b('0x16')][_0x1d4b('0x17')]());_0x5a3d64[_0x1d4b('0x21')]('[EXEC]',util[_0x1d4b('0x25')]('%s\x20account\x20#%s\x20not\x20found',_0xccfae0['data1'][_0x1d4b('0x17')](),_0xccfae0[_0x1d4b('0x18')]));}}else{}}catch(_0x194125){console[_0x1d4b('0x21')](_0x194125);}}}}; \ No newline at end of file +var _0xf9c9=['vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','find','Configurations','queue','routeId','outbound','log','unmanaged','salesforce','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','error','%s\x20account\x20#%s\x20not\x20found','data2','lodash','./salesforce','./sugarcrm','./freshdesk','./zoho','./vtiger','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk'];(function(_0x18d218,_0x2e2f58){var _0x3276a8=function(_0x547fc1){while(--_0x547fc1){_0x18d218['push'](_0x18d218['shift']());}};_0x3276a8(++_0x2e2f58);}(_0xf9c9,0x165));var _0x9f9c=function(_0x1c73b1,_0x5c6f36){_0x1c73b1=_0x1c73b1-0x0;var _0x4b9c7c=_0xf9c9[_0x1c73b1];return _0x4b9c7c;};'use strict';var _=require(_0x9f9c('0x0'));var util=require('util');var zendesk=require('./zendesk');var salesforce=require(_0x9f9c('0x1'));var sugarcrm=require(_0x9f9c('0x2'));var freshdesk=require(_0x9f9c('0x3'));var zoho=require(_0x9f9c('0x4'));var desk=require('./desk');var vtiger=require(_0x9f9c('0x5'));var servicenow=require('./servicenow');var dynamics365=require(_0x9f9c('0x6'));var freshsales=require(_0x9f9c('0x7'));var integrations=[_0x9f9c('0x8'),'salesforce',_0x9f9c('0x9'),_0x9f9c('0xa'),_0x9f9c('0xb'),_0x9f9c('0xc'),_0x9f9c('0xd'),_0x9f9c('0xe'),_0x9f9c('0xf'),_0x9f9c('0x10')];exports['exec']=function(_0x980577,_0x23ff64,_0x33a9d6,_0x418444,_0x16bf8f,_0x4d89ba){if(_0x33a9d6){if(_[_0x9f9c('0x11')](integrations,_0x980577[_0x9f9c('0x12')][_0x9f9c('0x13')]())){try{var _0x241a3f=null;var _0x3c5833='';var _0x5eae17=_0x33a9d6[_0x980577[_0x9f9c('0x12')][_0x9f9c('0x13')]()];if(_0x5eae17){var _0x5f0a83=_0x5eae17[_0x980577['data2']];if(_0x5f0a83){var _0xb2a8fb=_[_0x9f9c('0x14')](_0x5f0a83[_0x9f9c('0x15')],{'id':parseInt(_0x980577['data3'],0xa)});if(_0xb2a8fb){if(_0x418444){if(_0x16bf8f&&_0x23ff64[_0x9f9c('0x16')]){_0x3c5833='queue';}else if(_0x23ff64[_0x9f9c('0x17')]){_0x3c5833=_0x9f9c('0x18');}else{console[_0x9f9c('0x19')]('EVENT\x20UNKNOWN',_0x23ff64);}}else{_0x3c5833=_0x9f9c('0x1a');}switch(_0x980577['data1']['toLowerCase']()){case _0x9f9c('0x8'):zendesk[_0x3c5833](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba);break;case _0x9f9c('0x1b'):salesforce[_0x3c5833](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba);break;case'sugarcrm':sugarcrm[_0x3c5833](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba);break;case _0x9f9c('0xa'):freshdesk[_0x3c5833](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba);break;case _0x9f9c('0xb'):zoho[_0x3c5833](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba);break;case _0x9f9c('0xc'):desk[_0x3c5833](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba);break;case _0x9f9c('0xd'):vtiger[_0x3c5833](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba);break;case'freshsales':freshsales['cs'](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba,_0x3c5833);break;case'servicenow':servicenow['cs'](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba,_0x3c5833);break;case _0x9f9c('0xe'):dynamics365['cs'](_0x980577,_0x23ff64,_0xb2a8fb,_0x418444,_0x16bf8f,_0x5f0a83,_0x4d89ba,_0x3c5833);break;default:console['log'](_0x9f9c('0x1c'));}}else{_0x241a3f=require(_0x9f9c('0x1d'))(_0x980577[_0x9f9c('0x12')][_0x9f9c('0x13')]());_0x241a3f['error'](_0x9f9c('0x1e'),util[_0x9f9c('0x1f')](_0x9f9c('0x20'),_0x980577['data1'][_0x9f9c('0x13')](),_0x980577[_0x9f9c('0x21')]));}}else{_0x241a3f=require(_0x9f9c('0x1d'))(_0x980577['data1']['toLowerCase']());_0x241a3f[_0x9f9c('0x22')]('[EXEC]',util['format'](_0x9f9c('0x23'),_0x980577[_0x9f9c('0x12')][_0x9f9c('0x13')](),_0x980577[_0x9f9c('0x24')]));}}else{}}catch(_0x32f44e){console[_0x9f9c('0x22')](_0x32f44e);}}}}; \ 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 60c472f..5773e6f 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 _0xf5e9=['length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact','merge','$or','sobject','Contact','cloneDeep','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','','Caller\x20-\x20%s','Company','No\x20Company','create','includes','string','picklist','idField','content','toString','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','instanceUrl','catch','[QUEUE]','recordingFormat','none','[OUTBOUND]','destcalleridname','outbound','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','%s/%s/e','error','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','isNil','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','emit','assign','getString','ticketType','Task','ActivityDate','utc','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ContactId','AccountId','leadId','validateEmail','find','execute','then'];(function(_0x42322d,_0x5567b8){var _0x409906=function(_0x591bb6){while(--_0x591bb6){_0x42322d['push'](_0x42322d['shift']());}};_0x409906(++_0x5567b8);}(_0xf5e9,0x1da));var _0x9f5e=function(_0x2aee7b,_0x181285){_0x2aee7b=_0x2aee7b-0x0;var _0x5a4554=_0xf5e9[_0x2aee7b];return _0x5a4554;};'use strict';var _=require(_0x9f5e('0x0'));var rp=require(_0x9f5e('0x1'));var moment=require(_0x9f5e('0x2'));var BPromise=require('bluebird');var md5=require(_0x9f5e('0x3'));var jsforce=require(_0x9f5e('0x4'));var util=require(_0x9f5e('0x5'));var Redis=require('ioredis');var intUtil=require(_0x9f5e('0x6'));var config=require(_0x9f5e('0x7'));var logger=require(_0x9f5e('0x8'))(_0x9f5e('0x9'));config[_0x9f5e('0xa')]=_[_0x9f5e('0xb')](config['redis'],{'host':_0x9f5e('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9f5e('0xa')]));function emit(_0x141c2a,_0x2e1934,_0x27bd00){io['to'](_0x141c2a)[_0x9f5e('0xd')](_0x2e1934,_0x27bd00);}function getTicket(_0xedbace,_0x2f6fed,_0x273395,_0x2a5dcc,_0x41acee,_0x1631d8,_0xf3b05b,_0x42ff21){var _0x1214af=Object[_0x9f5e('0xe')]({},{'OwnerId':_0x2f6fed['id'],'Subject':intUtil[_0x9f5e('0xf')](_0x2a5dcc['Subjects'],_0x41acee,'\x20'),'Description':intUtil[_0x9f5e('0xf')](_0x2a5dcc['Descriptions'],_0x41acee,'\x0a')},getCustomFields(_0x1631d8,_0x41acee));if(_0x273395){if(_0x2a5dcc[_0x9f5e('0x10')]===_0x9f5e('0x11')){_0x1214af[_0x9f5e('0x12')]=moment[_0x9f5e('0x13')]();_0x1214af['IsReminderSet']=![];_0x1214af[_0x9f5e('0x14')]=![];if(_0x273395[_0x9f5e('0x15')]===_0x9f5e('0x16')||_0x273395[_0x9f5e('0x15')]===_0x9f5e('0x17')){_0x1214af[_0x9f5e('0x18')]=_0x273395['id'];}else if(_0x273395[_0x9f5e('0x15')]===_0x9f5e('0x19')){_0x1214af[_0x9f5e('0x1a')]=_0x273395['id'];}}else if(_0x2a5dcc[_0x9f5e('0x10')]==='Case'){if(_0x273395[_0x9f5e('0x15')]===_0x9f5e('0x16')){_0x1214af[_0x9f5e('0x1b')]=_0x273395['id'];}else if(_0x273395[_0x9f5e('0x15')]==='account'){_0x1214af[_0x9f5e('0x1c')]=_0x273395['id'];}else if(_0x273395[_0x9f5e('0x15')]==='lead'&&_0x2a5dcc[_0x9f5e('0x1d')]){_0x1214af[_0x2a5dcc[_0x9f5e('0x1d')]]=_0x273395['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0xf3b05b['sobject'](_0x2a5dcc['ticketType'])['create'](_0x1214af);}function getUser(_0x39d114,_0x2a0212,_0x603316){if(!_['isNil'](_0x2a0212)&&intUtil[_0x9f5e('0x1e')](_0x2a0212)){var _0x542c98={'Email':_0x2a0212};var _0x3ef59b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x603316['sobject']('User')[_0x9f5e('0x1f')](_0x542c98,_0x3ef59b)[_0x9f5e('0x20')]()[_0x9f5e('0x21')](function(_0x776e0f){if(_0x776e0f[_0x9f5e('0x22')]){var _0x18f4f0=_['find'](_0x776e0f,function(_0x2afab8){return _0x2afab8[_0x9f5e('0x23')]===_0x2a0212;});if(_0x18f4f0){logger[_0x9f5e('0x24')](_0x9f5e('0x25'),_0x2a0212);return BPromise[_0x9f5e('0x26')]({'id':_0x18f4f0['Id'],'name':_0x18f4f0[_0x9f5e('0x27')]});}}else{logger[_0x9f5e('0x24')](_0x9f5e('0x28'),_0x2a0212);return _0x603316[_0x9f5e('0x29')]()[_0x9f5e('0x21')](function(_0x421d3d){return BPromise[_0x9f5e('0x26')]({'id':_0x421d3d[_0x9f5e('0x2a')],'name':_0x421d3d[_0x9f5e('0x2b')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2a0212);return _0x603316['identity']()[_0x9f5e('0x21')](function(_0x11cae3){return BPromise[_0x9f5e('0x26')]({'id':_0x11cae3[_0x9f5e('0x2a')],'name':_0x11cae3[_0x9f5e('0x2b')]});});}}function getEndUser(_0x526416,_0x250afe,_0x242015,_0x37ef73,_0x62ac5a){var _0x3ccf4d={'$or':{'Phone':_0x37ef73}};var _0x3e8ef3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x9f5e('0x21')](function(){logger[_0x9f5e('0x24')](_0x9f5e('0x2c'),_0x37ef73,_0x250afe[_0x9f5e('0x2d')]);switch(_0x250afe['moduleSearch']){case _0x9f5e('0x2e'):var _0xe8004e=_['cloneDeep'](_0x3ccf4d);if(_0x250afe[_0x9f5e('0x2f')]){var _0x222b19={};_0x222b19[_0x250afe[_0x9f5e('0x2f')]]=_0x37ef73;_[_0x9f5e('0x30')](_0xe8004e[_0x9f5e('0x31')],_0x222b19);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x33'))[_0x9f5e('0x1f')](_0xe8004e,_0x3e8ef3)['execute']()[_0x9f5e('0x21')](function(_0x1af80f){if(_0x1af80f&&_0x1af80f['length']){return _0x1af80f;}else{var _0x3e0660=_[_0x9f5e('0x34')](_0x3ccf4d);if(_0x250afe['additionalSearchLead']){var _0x4edbda={};_0x4edbda[_0x250afe[_0x9f5e('0x35')]]=_0x37ef73;_[_0x9f5e('0x30')](_0x3e0660[_0x9f5e('0x31')],_0x4edbda);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x36'))[_0x9f5e('0x1f')](_0x3e0660,_0x3e8ef3);}});case _0x9f5e('0x37'):var _0x3b6fe6=_['cloneDeep'](_0x3ccf4d);if(_0x250afe[_0x9f5e('0x38')]){var _0x222b19={};_0x222b19[_0x250afe['additionalSearchAccount']]=_0x37ef73;_[_0x9f5e('0x30')](_0x3b6fe6[_0x9f5e('0x31')],_0x222b19);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x39'))['find'](_0x3b6fe6,_0x3e8ef3)[_0x9f5e('0x20')]()[_0x9f5e('0x21')](function(_0x598fd5){if(_0x598fd5&&_0x598fd5[_0x9f5e('0x22')]){return _0x598fd5;}else{var _0x3edbbf=_['cloneDeep'](_0x3ccf4d);if(_0x250afe[_0x9f5e('0x2f')]){var _0x294973={};_0x294973[_0x250afe[_0x9f5e('0x2f')]]=_0x37ef73;_['merge'](_0x3edbbf[_0x9f5e('0x31')],_0x294973);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x33'))[_0x9f5e('0x1f')](_0x3edbbf,_0x3e8ef3)[_0x9f5e('0x21')](function(_0x576559){if(_0x576559&&_0x576559[_0x9f5e('0x22')]){return _0x576559;}else{var _0x503b67=_['cloneDeep'](_0x3ccf4d);if(_0x250afe[_0x9f5e('0x35')]){var _0x1294cb={};_0x1294cb[_0x250afe['additionalSearchLead']]=_0x37ef73;_[_0x9f5e('0x30')](_0x503b67[_0x9f5e('0x31')],_0x1294cb);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x36'))[_0x9f5e('0x1f')](_0x503b67,_0x3e8ef3);}});}});case _0x9f5e('0x16'):var _0xe8004e=_['cloneDeep'](_0x3ccf4d);if(_0x250afe[_0x9f5e('0x2f')]){var _0x222b19={};_0x222b19[_0x250afe[_0x9f5e('0x2f')]]=_0x37ef73;_[_0x9f5e('0x30')](_0xe8004e[_0x9f5e('0x31')],_0x222b19);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x33'))[_0x9f5e('0x1f')](_0xe8004e,_0x3e8ef3)[_0x9f5e('0x20')]();case _0x9f5e('0x17'):var _0x50ed26=_[_0x9f5e('0x34')](_0x3ccf4d);if(_0x250afe[_0x9f5e('0x35')]){var _0x222b19={};_0x222b19[_0x250afe[_0x9f5e('0x35')]]=_0x37ef73;_[_0x9f5e('0x30')](_0x50ed26[_0x9f5e('0x31')],_0x222b19);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x36'))['find'](_0x50ed26,_0x3e8ef3);case _0x9f5e('0x19'):var _0x3b6fe6=_[_0x9f5e('0x34')](_0x3ccf4d);if(_0x250afe[_0x9f5e('0x38')]){var _0x222b19={};_0x222b19[_0x250afe[_0x9f5e('0x38')]]=_0x37ef73;_[_0x9f5e('0x30')](_0x3b6fe6[_0x9f5e('0x31')],_0x222b19);}return _0x62ac5a[_0x9f5e('0x32')](_0x9f5e('0x39'))[_0x9f5e('0x1f')](_0x3b6fe6,_0x3e8ef3);default:return null;}})[_0x9f5e('0x21')](function(_0x437a28){if(_0x437a28&&_0x437a28[_0x9f5e('0x22')]){var _0x3bd28c=_[_0x9f5e('0x3a')](_0x437a28);if(_0x3bd28c){return BPromise[_0x9f5e('0x26')]({'id':_0x3bd28c['Id'],'name':_0x3bd28c[_0x9f5e('0x27')],'phone':_0x3bd28c[_0x9f5e('0x3b')],'endUserType':_0x3bd28c['attributes'][_0x9f5e('0x3c')][_0x9f5e('0x3d')]()});}}})[_0x9f5e('0x21')](function(_0x5aa649){if(_0x5aa649){logger[_0x9f5e('0x24')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x5aa649[_0x9f5e('0x15')],_0x37ef73);return BPromise['resolve'](_0x5aa649);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x37ef73);var _0x3e3027={'Phone':_0x37ef73};if(_0x250afe[_0x9f5e('0x3e')]){if(_0x250afe[_0x9f5e('0x3e')]==='contact'){logger[_0x9f5e('0x24')](_0x9f5e('0x3f'),_0x37ef73,_0x250afe[_0x9f5e('0x3e')]);_0x3e3027[_0x9f5e('0x40')]=_0x242015!==''?_0x242015:util[_0x9f5e('0x41')]('Caller\x20-\x20%s',_0x37ef73);}else if(_0x250afe[_0x9f5e('0x3e')]==='lead'){logger[_0x9f5e('0x24')](_0x9f5e('0x3f'),_0x37ef73,_0x250afe['moduleCreate']);_0x3e3027[_0x9f5e('0x40')]=_0x242015!==_0x9f5e('0x42')?_0x242015:util['format'](_0x9f5e('0x43'),_0x37ef73);_0x3e3027[_0x9f5e('0x44')]=_0x9f5e('0x45');}else if(_0x250afe[_0x9f5e('0x3e')]==='account'){logger[_0x9f5e('0x24')](_0x9f5e('0x3f'),_0x37ef73,_0x250afe['moduleCreate']);_0x3e3027[_0x9f5e('0x27')]=_0x242015!==_0x9f5e('0x42')?_0x242015:util[_0x9f5e('0x41')]('Caller\x20-\x20%s',_0x37ef73);}else{return null;}}return _0x62ac5a[_0x9f5e('0x32')](_['upperFirst'](_0x250afe[_0x9f5e('0x3e')]))[_0x9f5e('0x46')](_0x3e3027)[_0x9f5e('0x21')](function(_0xb38728){return BPromise[_0x9f5e('0x26')]({'id':_0xb38728['id'],'endUserType':_0x250afe[_0x9f5e('0x3e')]});});}});}function getCustomFields(_0x518294,_0x52a1a1){var _0x59ad49={};if(_0x518294['length']>0x0){_['forEach'](_0x518294,function(_0x26a515){if(_[_0x9f5e('0x47')]([_0x9f5e('0x48'),_0x9f5e('0x49')],_0x26a515[_0x9f5e('0x3c')])&&_0x26a515[_0x9f5e('0x4a')]){_0x59ad49[_0x26a515[_0x9f5e('0x4a')]]=_0x26a515[_0x9f5e('0x4b')][_0x9f5e('0x4c')]();}else if(_0x26a515[_0x9f5e('0x3c')]==='variable'&&_0x26a515['variableName']&&_0x26a515[_0x9f5e('0x4a')]){_0x52a1a1[_0x26a515[_0x9f5e('0x4d')]]&&(_0x59ad49[_0x26a515[_0x9f5e('0x4a')]]=_0x52a1a1[_0x26a515[_0x9f5e('0x4d')]]['toString']());}else if(_0x26a515[_0x9f5e('0x3c')]==='customVariable'&&_0x26a515[_0x9f5e('0x4e')]&&_0x26a515[_0x9f5e('0x4e')][_0x9f5e('0x4f')]&&_0x26a515[_0x9f5e('0x4a')]){_0x52a1a1[_0x26a515[_0x9f5e('0x4e')]['name'][_0x9f5e('0x3d')]()]&&(_0x59ad49[_0x26a515['idField']]=_0x52a1a1[_0x26a515[_0x9f5e('0x4e')][_0x9f5e('0x4f')][_0x9f5e('0x3d')]()]['toString']());}});}return _0x59ad49;}function getConnection(_0x24ef89){var _0x1d97ea=_0x24ef89[_0x9f5e('0x50')][_0x9f5e('0x51')](_0x24ef89[_0x9f5e('0x52')]);var _0xdaffe6=new jsforce[(_0x9f5e('0x53'))]({'oauth2':{'loginUrl':_0x24ef89[_0x9f5e('0x54')]||_0x9f5e('0x55'),'clientId':_0x24ef89[_0x9f5e('0x56')],'clientSecret':_0x24ef89[_0x9f5e('0x57')]}});return _0xdaffe6['login'](_0x24ef89['username'],_0x1d97ea)['then'](function(){logger[_0x9f5e('0x24')](_0x9f5e('0x58'));return _0xdaffe6;});}exports[_0x9f5e('0x59')]=function(_0x3de61e,_0x126a05,_0x5d2507,_0x1e38bf,_0x429337,_0x3e04ee){var _0x5c70fa,_0x2634fa,_0x528045,_0x13d7e9;_0x3e04ee[_0x9f5e('0x5a')]=intUtil[_0x9f5e('0x5b')](_0x3e04ee[_0x9f5e('0x5a')]);_0x3e04ee['remoteUri']=intUtil['stripTrailingSlash'](_0x3e04ee[_0x9f5e('0x54')]);if(_0x429337&&_0x429337[_0x9f5e('0x5c')]){logger[_0x9f5e('0x24')]('[QUEUE]',_0x9f5e('0x5d'));_0x126a05[_0x9f5e('0x5e')]=util['format'](_0x9f5e('0x5f'),_0x3e04ee[_0x9f5e('0x5a')],_0x126a05[_0x9f5e('0x60')],md5(_0x126a05[_0x9f5e('0x60')]));}else{_0x126a05['recordingURL']='';}return getConnection(_0x3e04ee)['then'](function(_0x3897ae){_0x13d7e9=_0x3897ae;return getUser(_0x3e04ee,_0x1e38bf[_0x9f5e('0x61')],_0x13d7e9);})[_0x9f5e('0x21')](function(_0x80489f){_0x5c70fa=_0x80489f;return getEndUser(_0x3e04ee,_0x5d2507,_0x126a05[_0x9f5e('0x62')],_0x126a05['calleridnum'],_0x13d7e9);})[_0x9f5e('0x21')](function(_0x17a05e){_0x2634fa=_0x17a05e;return getTicket(_0x3e04ee,_0x5c70fa,_0x2634fa,_0x5d2507,_0x126a05,_0x5d2507[_0x9f5e('0x63')],_0x13d7e9,_0x9f5e('0x59'));})[_0x9f5e('0x21')](function(_0x1ec200){_0x528045=_0x1ec200;logger[_0x9f5e('0x24')](_0x9f5e('0x64'),_0x528045['id']);logger[_0x9f5e('0x24')](_0x9f5e('0x65'),_0x528045['id'],_0x1e38bf['name'],_0x3e04ee['type']);switch(_0x3e04ee[_0x9f5e('0x3c')]){case _0x9f5e('0x66'):emit(util[_0x9f5e('0x41')](_0x9f5e('0x67'),_0x1e38bf[_0x9f5e('0x4f')]),'trigger:salesforce:display',{'recordId':_0x528045['id']});break;case _0x9f5e('0x68'):emit(util[_0x9f5e('0x41')](_0x9f5e('0x67'),_0x1e38bf[_0x9f5e('0x4f')]),_0x9f5e('0x69'),{'uri':util[_0x9f5e('0x41')]('%s/%s/e',_0x13d7e9[_0x9f5e('0x6a')],_0x528045['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x9f5e('0x6b')](function(_0x4a7fb7){logger['error'](_0x9f5e('0x6c'),_0x4a7fb7);});};exports['outbound']=function(_0x17d21b,_0x1518df,_0x3a8505,_0xf63d1f,_0x2e0859,_0x200157,_0x2d603f){var _0x10625c,_0x2b2a18,_0x4901c1,_0x3ffcf;_0x200157[_0x9f5e('0x5a')]=intUtil[_0x9f5e('0x5b')](_0x200157[_0x9f5e('0x5a')]);_0x200157['remoteUri']=intUtil['stripTrailingSlash'](_0x200157[_0x9f5e('0x54')]);if(_0x2d603f&&_0x2d603f[_0x9f5e('0x6d')]&&_0x2d603f['recordingFormat']!==_0x9f5e('0x6e')){logger[_0x9f5e('0x24')](_0x9f5e('0x6f'),_0x9f5e('0x5d'));_0x1518df[_0x9f5e('0x5e')]=util[_0x9f5e('0x41')](_0x9f5e('0x5f'),_0x200157[_0x9f5e('0x5a')],_0x1518df[_0x9f5e('0x60')],md5(_0x1518df[_0x9f5e('0x60')]));}return getConnection(_0x200157)[_0x9f5e('0x21')](function(_0x48bbeb){_0x3ffcf=_0x48bbeb;return getUser(_0x200157,_0xf63d1f[_0x9f5e('0x61')],_0x3ffcf);})[_0x9f5e('0x21')](function(_0x14385b){_0x10625c=_0x14385b;return getEndUser(_0x200157,_0x3a8505,_0x1518df[_0x9f5e('0x70')],_0x1518df['destcalleridnum'],_0x3ffcf);})[_0x9f5e('0x21')](function(_0x5971a1){_0x2b2a18=_0x5971a1;return getTicket(_0x200157,_0x10625c,_0x2b2a18,_0x3a8505,_0x1518df,_0x3a8505[_0x9f5e('0x63')],_0x3ffcf,_0x9f5e('0x71'));})[_0x9f5e('0x21')](function(_0x390ae3){_0x4901c1=_0x390ae3;logger[_0x9f5e('0x24')](_0x9f5e('0x72'),_0x4901c1['id']);logger[_0x9f5e('0x24')](_0x9f5e('0x73'),_0x4901c1['id'],_0xf63d1f['name'],_0x200157[_0x9f5e('0x3c')]);switch(_0x200157[_0x9f5e('0x3c')]){case'integrationTab':emit(util[_0x9f5e('0x41')](_0x9f5e('0x67'),_0xf63d1f['name']),_0x9f5e('0x74'),{'recordId':_0x4901c1['id']});break;case'newTab':emit(util['format']('user:%s',_0xf63d1f[_0x9f5e('0x4f')]),_0x9f5e('0x69'),{'uri':util[_0x9f5e('0x41')](_0x9f5e('0x75'),_0x3ffcf['instanceUrl'],_0x4901c1['id'])});break;default:logger[_0x9f5e('0x76')](_0x9f5e('0x6f'),_0x9f5e('0x77'));}})[_0x9f5e('0x6b')](function(_0x322169){logger[_0x9f5e('0x76')](_0x9f5e('0x6f'),_0x322169);});};exports[_0x9f5e('0x78')]=function(_0x334e90,_0x5e7561,_0x27a8e2,_0x350258,_0x1639c6,_0x5d6ebe){var _0x28cdaf,_0x38c3c2,_0x254590,_0x534c2c;_0x5d6ebe[_0x9f5e('0x5a')]=intUtil[_0x9f5e('0x5b')](_0x5d6ebe['serverUrl']);_0x5d6ebe[_0x9f5e('0x54')]=intUtil[_0x9f5e('0x5b')](_0x5d6ebe[_0x9f5e('0x54')]);if(_0x1639c6&&_0x1639c6['monitor_format']){logger[_0x9f5e('0x24')]('['+_0x5e7561[_0x9f5e('0x79')]['toUpperCase']()+']',_0x9f5e('0x5d'));_0x5e7561[_0x9f5e('0x5e')]=util[_0x9f5e('0x41')](_0x9f5e('0x5f'),_0x5d6ebe[_0x9f5e('0x5a')],_0x5e7561['uniqueid'],md5(_0x5e7561['uniqueid']));}else{_0x5e7561[_0x9f5e('0x5e')]='';}return getConnection(_0x5d6ebe)[_0x9f5e('0x21')](function(_0x2536e6){_0x534c2c=_0x2536e6;if(!_[_0x9f5e('0x7a')](_0x350258)){return getUser(_0x5d6ebe,_0x350258['name'],_0x534c2c);}else{return getUser(_0x5d6ebe,null,_0x534c2c);}})[_0x9f5e('0x21')](function(_0x109c16){_0x28cdaf=_0x109c16;return getEndUser(_0x5d6ebe,_0x27a8e2,_0x5e7561[_0x9f5e('0x62')],_0x5e7561[_0x9f5e('0x7b')],_0x534c2c);})[_0x9f5e('0x21')](function(_0x5a13b2){_0x38c3c2=_0x5a13b2;return getTicket(_0x5d6ebe,_0x28cdaf,_0x38c3c2,_0x27a8e2,_0x5e7561,_0x27a8e2[_0x9f5e('0x63')],_0x534c2c);})['then'](function(_0x207ebe){_0x254590=_0x207ebe;logger[_0x9f5e('0x24')]('['+_0x5e7561['lastevent'][_0x9f5e('0x7c')]()+_0x9f5e('0x7d'),_0x254590['id']);logger['info']('['+_0x5e7561[_0x9f5e('0x79')][_0x9f5e('0x7c')]()+_0x9f5e('0x7e'),_0x5d6ebe[_0x9f5e('0x3c')]);})[_0x9f5e('0x6b')](function(_0x5b638c){logger[_0x9f5e('0x76')]('['+_0x5e7561[_0x9f5e('0x79')][_0x9f5e('0x7c')]()+']',_0x5b638c);});}; \ No newline at end of file +var _0x09a3=['Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','destcalleridnum','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','[OUTBOUND]','unmanaged','toUpperCase','Recording\x20is\x20enabled!','calleridname','lastevent',']\x20Ticket\x20%s\x20created.','lodash','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','User','find','then','length','Email','info','Agent\x20%s\x20found.','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','display_name','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','$or','Contact','execute','additionalSearchLead','Lead','additionalSearchAccount','merge','Account','additionalSearchContact','first','Name','Phone','attributes','type','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','forEach','includes','string','picklist','toString','variable','variableName','idField','customVariable'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x09a3,0x1a1));var _0x309a=function(_0x318bcb,_0x361b8d){_0x318bcb=_0x318bcb-0x0;var _0x56b5ba=_0x09a3[_0x318bcb];return _0x56b5ba;};'use strict';var _=require(_0x309a('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x309a('0x1'));var md5=require(_0x309a('0x2'));var jsforce=require(_0x309a('0x3'));var util=require(_0x309a('0x4'));var Redis=require(_0x309a('0x5'));var intUtil=require(_0x309a('0x6'));var config=require(_0x309a('0x7'));var logger=require(_0x309a('0x8'))(_0x309a('0x9'));config[_0x309a('0xa')]=_[_0x309a('0xb')](config[_0x309a('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x309a('0xa')]));function emit(_0x35c51b,_0x13b1ba,_0x3960e5){io['to'](_0x35c51b)['emit'](_0x13b1ba,_0x3960e5);}function getTicket(_0x2fa0c9,_0x4055e9,_0x1a5094,_0x15e778,_0x47abca,_0x3024e9,_0x1ad52d,_0x20ce9c){var _0x1a1937=Object[_0x309a('0xc')]({},{'OwnerId':_0x4055e9['id'],'Subject':intUtil[_0x309a('0xd')](_0x15e778['Subjects'],_0x47abca,'\x20'),'Description':intUtil[_0x309a('0xd')](_0x15e778[_0x309a('0xe')],_0x47abca,'\x0a')},getCustomFields(_0x3024e9,_0x47abca));if(_0x1a5094){if(_0x15e778[_0x309a('0xf')]===_0x309a('0x10')){_0x1a1937[_0x309a('0x11')]=moment[_0x309a('0x12')]();_0x1a1937[_0x309a('0x13')]=![];_0x1a1937[_0x309a('0x14')]=![];if(_0x1a5094['endUserType']===_0x309a('0x15')||_0x1a5094[_0x309a('0x16')]===_0x309a('0x17')){_0x1a1937[_0x309a('0x18')]=_0x1a5094['id'];}else if(_0x1a5094['endUserType']===_0x309a('0x19')){_0x1a1937['WhatId']=_0x1a5094['id'];}}else if(_0x15e778['ticketType']==='Case'){if(_0x1a5094[_0x309a('0x16')]===_0x309a('0x15')){_0x1a1937[_0x309a('0x1a')]=_0x1a5094['id'];}else if(_0x1a5094['endUserType']==='account'){_0x1a1937[_0x309a('0x1b')]=_0x1a5094['id'];}else if(_0x1a5094['endUserType']===_0x309a('0x17')&&_0x15e778[_0x309a('0x1c')]){_0x1a1937[_0x15e778['leadId']]=_0x1a5094['id'];}else{logger['info'](_0x309a('0x1d'));}}}return _0x1ad52d[_0x309a('0x1e')](_0x15e778[_0x309a('0xf')])[_0x309a('0x1f')](_0x1a1937);}function getUser(_0x5792d0,_0x135f2c,_0x14e717){if(!_[_0x309a('0x20')](_0x135f2c)&&intUtil['validateEmail'](_0x135f2c)){var _0x43e8e6={'Email':_0x135f2c};var _0x140b26={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x14e717[_0x309a('0x1e')](_0x309a('0x21'))[_0x309a('0x22')](_0x43e8e6,_0x140b26)['execute']()[_0x309a('0x23')](function(_0x17dfb4){if(_0x17dfb4[_0x309a('0x24')]){var _0x3b42d5=_[_0x309a('0x22')](_0x17dfb4,function(_0x159ddd){return _0x159ddd[_0x309a('0x25')]===_0x135f2c;});if(_0x3b42d5){logger[_0x309a('0x26')](_0x309a('0x27'),_0x135f2c);return BPromise['resolve']({'id':_0x3b42d5['Id'],'name':_0x3b42d5['Name']});}}else{logger[_0x309a('0x26')](_0x309a('0x28'),_0x135f2c);return _0x14e717['identity']()[_0x309a('0x23')](function(_0x5b9b6f){return BPromise[_0x309a('0x29')]({'id':_0x5b9b6f['user_id'],'name':_0x5b9b6f[_0x309a('0x2a')]});});}});}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x135f2c);return _0x14e717[_0x309a('0x2b')]()['then'](function(_0x34707d){return BPromise[_0x309a('0x29')]({'id':_0x34707d[_0x309a('0x2c')],'name':_0x34707d[_0x309a('0x2a')]});});}}function getEndUser(_0x3a9593,_0x519d23,_0x26d44d,_0x1c105f,_0x5f1413){var _0x5098b0={'$or':{'Phone':_0x1c105f}};var _0x261e8b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x309a('0x23')](function(){logger[_0x309a('0x26')](_0x309a('0x2d'),_0x1c105f,_0x519d23[_0x309a('0x2e')]);switch(_0x519d23[_0x309a('0x2e')]){case'contact_lead':var _0x57d5a1=_[_0x309a('0x2f')](_0x5098b0);if(_0x519d23['additionalSearchContact']){var _0x3ed061={};_0x3ed061[_0x519d23['additionalSearchContact']]=_0x1c105f;_['merge'](_0x57d5a1[_0x309a('0x30')],_0x3ed061);}return _0x5f1413[_0x309a('0x1e')](_0x309a('0x31'))['find'](_0x57d5a1,_0x261e8b)[_0x309a('0x32')]()[_0x309a('0x23')](function(_0x49dc41){if(_0x49dc41&&_0x49dc41['length']){return _0x49dc41;}else{var _0x22007a=_[_0x309a('0x2f')](_0x5098b0);if(_0x519d23[_0x309a('0x33')]){var _0x17e6b8={};_0x17e6b8[_0x519d23[_0x309a('0x33')]]=_0x1c105f;_['merge'](_0x22007a['$or'],_0x17e6b8);}return _0x5f1413[_0x309a('0x1e')](_0x309a('0x34'))[_0x309a('0x22')](_0x22007a,_0x261e8b);}});case'account_contact_lead':var _0x4757bb=_[_0x309a('0x2f')](_0x5098b0);if(_0x519d23[_0x309a('0x35')]){var _0x3ed061={};_0x3ed061[_0x519d23[_0x309a('0x35')]]=_0x1c105f;_[_0x309a('0x36')](_0x4757bb[_0x309a('0x30')],_0x3ed061);}return _0x5f1413[_0x309a('0x1e')](_0x309a('0x37'))[_0x309a('0x22')](_0x4757bb,_0x261e8b)[_0x309a('0x32')]()[_0x309a('0x23')](function(_0x3d2a17){if(_0x3d2a17&&_0x3d2a17[_0x309a('0x24')]){return _0x3d2a17;}else{var _0x308cb4=_['cloneDeep'](_0x5098b0);if(_0x519d23[_0x309a('0x38')]){var _0x5dec0b={};_0x5dec0b[_0x519d23['additionalSearchContact']]=_0x1c105f;_['merge'](_0x308cb4[_0x309a('0x30')],_0x5dec0b);}return _0x5f1413[_0x309a('0x1e')]('Contact')[_0x309a('0x22')](_0x308cb4,_0x261e8b)[_0x309a('0x23')](function(_0x4ec62d){if(_0x4ec62d&&_0x4ec62d[_0x309a('0x24')]){return _0x4ec62d;}else{var _0x4646a4=_[_0x309a('0x2f')](_0x5098b0);if(_0x519d23[_0x309a('0x33')]){var _0x4ae441={};_0x4ae441[_0x519d23[_0x309a('0x33')]]=_0x1c105f;_[_0x309a('0x36')](_0x4646a4[_0x309a('0x30')],_0x4ae441);}return _0x5f1413[_0x309a('0x1e')](_0x309a('0x34'))['find'](_0x4646a4,_0x261e8b);}});}});case _0x309a('0x15'):var _0x57d5a1=_[_0x309a('0x2f')](_0x5098b0);if(_0x519d23[_0x309a('0x38')]){var _0x3ed061={};_0x3ed061[_0x519d23[_0x309a('0x38')]]=_0x1c105f;_[_0x309a('0x36')](_0x57d5a1['$or'],_0x3ed061);}return _0x5f1413[_0x309a('0x1e')](_0x309a('0x31'))[_0x309a('0x22')](_0x57d5a1,_0x261e8b)[_0x309a('0x32')]();case _0x309a('0x17'):var _0x4e35b1=_[_0x309a('0x2f')](_0x5098b0);if(_0x519d23[_0x309a('0x33')]){var _0x3ed061={};_0x3ed061[_0x519d23['additionalSearchLead']]=_0x1c105f;_[_0x309a('0x36')](_0x4e35b1[_0x309a('0x30')],_0x3ed061);}return _0x5f1413[_0x309a('0x1e')](_0x309a('0x34'))['find'](_0x4e35b1,_0x261e8b);case _0x309a('0x19'):var _0x4757bb=_[_0x309a('0x2f')](_0x5098b0);if(_0x519d23[_0x309a('0x35')]){var _0x3ed061={};_0x3ed061[_0x519d23[_0x309a('0x35')]]=_0x1c105f;_[_0x309a('0x36')](_0x4757bb['$or'],_0x3ed061);}return _0x5f1413[_0x309a('0x1e')](_0x309a('0x37'))[_0x309a('0x22')](_0x4757bb,_0x261e8b);default:return null;}})[_0x309a('0x23')](function(_0x1a1ff1){if(_0x1a1ff1&&_0x1a1ff1['length']){var _0x172ec7=_[_0x309a('0x39')](_0x1a1ff1);if(_0x172ec7){return BPromise['resolve']({'id':_0x172ec7['Id'],'name':_0x172ec7[_0x309a('0x3a')],'phone':_0x172ec7[_0x309a('0x3b')],'endUserType':_0x172ec7[_0x309a('0x3c')][_0x309a('0x3d')]['toLowerCase']()});}}})[_0x309a('0x23')](function(_0x203f05){if(_0x203f05){logger['info']('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x203f05[_0x309a('0x16')],_0x1c105f);return BPromise[_0x309a('0x29')](_0x203f05);}else{logger[_0x309a('0x26')](_0x309a('0x3e'),_0x1c105f);var _0x149083={'Phone':_0x1c105f};if(_0x519d23[_0x309a('0x3f')]){if(_0x519d23[_0x309a('0x3f')]===_0x309a('0x15')){logger[_0x309a('0x26')](_0x309a('0x40'),_0x1c105f,_0x519d23[_0x309a('0x3f')]);_0x149083[_0x309a('0x41')]=_0x26d44d!==''?_0x26d44d:util[_0x309a('0x42')](_0x309a('0x43'),_0x1c105f);}else if(_0x519d23[_0x309a('0x3f')]===_0x309a('0x17')){logger[_0x309a('0x26')](_0x309a('0x40'),_0x1c105f,_0x519d23['moduleCreate']);_0x149083[_0x309a('0x41')]=_0x26d44d!==_0x309a('0x44')?_0x26d44d:util[_0x309a('0x42')](_0x309a('0x43'),_0x1c105f);_0x149083['Company']='No\x20Company';}else if(_0x519d23['moduleCreate']==='account'){logger[_0x309a('0x26')](_0x309a('0x40'),_0x1c105f,_0x519d23[_0x309a('0x3f')]);_0x149083['Name']=_0x26d44d!==_0x309a('0x44')?_0x26d44d:util[_0x309a('0x42')]('Caller\x20-\x20%s',_0x1c105f);}else{return null;}}return _0x5f1413['sobject'](_[_0x309a('0x45')](_0x519d23[_0x309a('0x3f')]))['create'](_0x149083)[_0x309a('0x23')](function(_0x1042ea){return BPromise[_0x309a('0x29')]({'id':_0x1042ea['id'],'endUserType':_0x519d23[_0x309a('0x3f')]});});}});}function getCustomFields(_0x19fd31,_0x4c8d9e){var _0x123302={};if(_0x19fd31[_0x309a('0x24')]>0x0){_[_0x309a('0x46')](_0x19fd31,function(_0x20e9d5){if(_[_0x309a('0x47')]([_0x309a('0x48'),_0x309a('0x49')],_0x20e9d5[_0x309a('0x3d')])&&_0x20e9d5['idField']){_0x123302[_0x20e9d5['idField']]=_0x20e9d5['content'][_0x309a('0x4a')]();}else if(_0x20e9d5[_0x309a('0x3d')]===_0x309a('0x4b')&&_0x20e9d5[_0x309a('0x4c')]&&_0x20e9d5[_0x309a('0x4d')]){_0x4c8d9e[_0x20e9d5[_0x309a('0x4c')]]&&(_0x123302[_0x20e9d5['idField']]=_0x4c8d9e[_0x20e9d5[_0x309a('0x4c')]][_0x309a('0x4a')]());}else if(_0x20e9d5['type']===_0x309a('0x4e')&&_0x20e9d5['Variable']&&_0x20e9d5['Variable']['name']&&_0x20e9d5[_0x309a('0x4d')]){_0x4c8d9e[_0x20e9d5[_0x309a('0x4f')][_0x309a('0x50')][_0x309a('0x51')]()]&&(_0x123302[_0x20e9d5['idField']]=_0x4c8d9e[_0x20e9d5['Variable'][_0x309a('0x50')][_0x309a('0x51')]()][_0x309a('0x4a')]());}});}return _0x123302;}function getConnection(_0x463670){var _0x5d7485=_0x463670[_0x309a('0x52')][_0x309a('0x53')](_0x463670[_0x309a('0x54')]);var _0x36f7cd=new jsforce[(_0x309a('0x55'))]({'oauth2':{'loginUrl':_0x463670[_0x309a('0x56')]||_0x309a('0x57'),'clientId':_0x463670[_0x309a('0x58')],'clientSecret':_0x463670[_0x309a('0x59')]}});return _0x36f7cd[_0x309a('0x5a')](_0x463670[_0x309a('0x5b')],_0x5d7485)['then'](function(){logger[_0x309a('0x26')](_0x309a('0x5c'));return _0x36f7cd;});}exports[_0x309a('0x5d')]=function(_0x2c52e1,_0x2f5070,_0x1771f8,_0x544f0a,_0x3d8511,_0x25c8da){var _0x53676e,_0x4fa47d,_0x16b62c,_0x2a987a;_0x25c8da['serverUrl']=intUtil[_0x309a('0x5e')](_0x25c8da[_0x309a('0x5f')]);_0x25c8da[_0x309a('0x56')]=intUtil['stripTrailingSlash'](_0x25c8da['remoteUri']);if(_0x3d8511&&_0x3d8511[_0x309a('0x60')]){logger[_0x309a('0x26')](_0x309a('0x61'),'Recording\x20is\x20enabled!');_0x2f5070[_0x309a('0x62')]=util[_0x309a('0x42')](_0x309a('0x63'),_0x25c8da[_0x309a('0x5f')],_0x2f5070[_0x309a('0x64')],md5(_0x2f5070[_0x309a('0x64')]));}else{_0x2f5070[_0x309a('0x62')]='';}return getConnection(_0x25c8da)[_0x309a('0x23')](function(_0x1b969b){_0x2a987a=_0x1b969b;return getUser(_0x25c8da,_0x544f0a[_0x309a('0x65')],_0x2a987a);})[_0x309a('0x23')](function(_0x45577b){_0x53676e=_0x45577b;return getEndUser(_0x25c8da,_0x1771f8,_0x2f5070['calleridname'],_0x2f5070['calleridnum'],_0x2a987a);})['then'](function(_0xc684f5){_0x4fa47d=_0xc684f5;return getTicket(_0x25c8da,_0x53676e,_0x4fa47d,_0x1771f8,_0x2f5070,_0x1771f8['Fields'],_0x2a987a,'queue');})[_0x309a('0x23')](function(_0x5bc845){_0x16b62c=_0x5bc845;logger[_0x309a('0x26')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x16b62c['id']);logger[_0x309a('0x26')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x16b62c['id'],_0x544f0a[_0x309a('0x50')],_0x25c8da['type']);switch(_0x25c8da[_0x309a('0x3d')]){case'integrationTab':emit(util[_0x309a('0x42')](_0x309a('0x66'),_0x544f0a[_0x309a('0x50')]),_0x309a('0x67'),{'recordId':_0x16b62c['id']});break;case'newTab':emit(util[_0x309a('0x42')](_0x309a('0x66'),_0x544f0a[_0x309a('0x50')]),_0x309a('0x68'),{'uri':util['format'](_0x309a('0x69'),_0x2a987a[_0x309a('0x6a')],_0x16b62c['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x309a('0x6b')](function(_0xb6882f){logger[_0x309a('0x6c')]('[QUEUE]',_0xb6882f);});};exports[_0x309a('0x6d')]=function(_0x4af53f,_0x5b489f,_0x979bff,_0x43f502,_0x1b80a2,_0x20a154,_0x162e9e){var _0xaa38ee,_0x4d2c78,_0x4fc938,_0x1ec5cf;_0x20a154[_0x309a('0x5f')]=intUtil['stripTrailingSlash'](_0x20a154['serverUrl']);_0x20a154['remoteUri']=intUtil[_0x309a('0x5e')](_0x20a154['remoteUri']);if(_0x162e9e&&_0x162e9e[_0x309a('0x6e')]&&_0x162e9e['recordingFormat']!=='none'){logger[_0x309a('0x26')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5b489f[_0x309a('0x62')]=util[_0x309a('0x42')](_0x309a('0x63'),_0x20a154[_0x309a('0x5f')],_0x5b489f[_0x309a('0x64')],md5(_0x5b489f['uniqueid']));}return getConnection(_0x20a154)[_0x309a('0x23')](function(_0x147d23){_0x1ec5cf=_0x147d23;return getUser(_0x20a154,_0x43f502[_0x309a('0x65')],_0x1ec5cf);})[_0x309a('0x23')](function(_0x2910b1){_0xaa38ee=_0x2910b1;return getEndUser(_0x20a154,_0x979bff,_0x5b489f['destcalleridname'],_0x5b489f[_0x309a('0x6f')],_0x1ec5cf);})[_0x309a('0x23')](function(_0x4ac36d){_0x4d2c78=_0x4ac36d;return getTicket(_0x20a154,_0xaa38ee,_0x4d2c78,_0x979bff,_0x5b489f,_0x979bff[_0x309a('0x70')],_0x1ec5cf,_0x309a('0x6d'));})[_0x309a('0x23')](function(_0x88b725){_0x4fc938=_0x88b725;logger[_0x309a('0x26')](_0x309a('0x71'),_0x4fc938['id']);logger[_0x309a('0x26')](_0x309a('0x72'),_0x4fc938['id'],_0x43f502[_0x309a('0x50')],_0x20a154[_0x309a('0x3d')]);switch(_0x20a154['type']){case _0x309a('0x73'):emit(util[_0x309a('0x42')](_0x309a('0x66'),_0x43f502[_0x309a('0x50')]),_0x309a('0x67'),{'recordId':_0x4fc938['id']});break;case _0x309a('0x74'):emit(util[_0x309a('0x42')](_0x309a('0x66'),_0x43f502[_0x309a('0x50')]),_0x309a('0x68'),{'uri':util[_0x309a('0x42')](_0x309a('0x69'),_0x1ec5cf[_0x309a('0x6a')],_0x4fc938['id'])});break;default:logger[_0x309a('0x6c')](_0x309a('0x75'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x309a('0x6b')](function(_0x2722d0){logger[_0x309a('0x6c')](_0x309a('0x75'),_0x2722d0);});};exports[_0x309a('0x76')]=function(_0x1740d2,_0x2ce5ea,_0x1eb0f3,_0x32196f,_0x3680e6,_0x3b1c84){var _0xaf6d92,_0x964f9a,_0x524afa,_0x345a25;_0x3b1c84['serverUrl']=intUtil[_0x309a('0x5e')](_0x3b1c84[_0x309a('0x5f')]);_0x3b1c84[_0x309a('0x56')]=intUtil[_0x309a('0x5e')](_0x3b1c84[_0x309a('0x56')]);if(_0x3680e6&&_0x3680e6[_0x309a('0x60')]){logger[_0x309a('0x26')]('['+_0x2ce5ea['lastevent'][_0x309a('0x77')]()+']',_0x309a('0x78'));_0x2ce5ea['recordingURL']=util[_0x309a('0x42')](_0x309a('0x63'),_0x3b1c84[_0x309a('0x5f')],_0x2ce5ea[_0x309a('0x64')],md5(_0x2ce5ea[_0x309a('0x64')]));}else{_0x2ce5ea[_0x309a('0x62')]='';}return getConnection(_0x3b1c84)[_0x309a('0x23')](function(_0x3a522e){_0x345a25=_0x3a522e;if(!_['isNil'](_0x32196f)){return getUser(_0x3b1c84,_0x32196f[_0x309a('0x50')],_0x345a25);}else{return getUser(_0x3b1c84,null,_0x345a25);}})[_0x309a('0x23')](function(_0x3c9d29){_0xaf6d92=_0x3c9d29;return getEndUser(_0x3b1c84,_0x1eb0f3,_0x2ce5ea[_0x309a('0x79')],_0x2ce5ea['calleridnum'],_0x345a25);})[_0x309a('0x23')](function(_0x119161){_0x964f9a=_0x119161;return getTicket(_0x3b1c84,_0xaf6d92,_0x964f9a,_0x1eb0f3,_0x2ce5ea,_0x1eb0f3[_0x309a('0x70')],_0x345a25);})['then'](function(_0x28f225){_0x524afa=_0x28f225;logger[_0x309a('0x26')]('['+_0x2ce5ea[_0x309a('0x7a')][_0x309a('0x77')]()+_0x309a('0x7b'),_0x524afa['id']);logger[_0x309a('0x26')]('['+_0x2ce5ea['lastevent'][_0x309a('0x77')]()+']\x20Integration\x20account\x20type\x20%s.',_0x3b1c84[_0x309a('0x3d')]);})[_0x309a('0x6b')](function(_0x14d117){logger[_0x309a('0x6c')]('['+_0x2ce5ea[_0x309a('0x7a')]['toUpperCase']()+']',_0x14d117);});}; \ 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 83f42cb..39b4143 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 _0x7084=['nameField','customField','toLowerCase','content','toString','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','Incident','Incident\x20-\x20','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','servicenow','defaults','redis','localhost','socket.io-emitter','GET','length','adminId','sys_id','],\x20getAdminUser\x20crm','error','message','info','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','result','true','userId','],\x20getUser\x20crm','catch',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','endUserNumber','user','System','then','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','type'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x7084,0x19a));var _0x4708=function(_0x1be289,_0x5dc88c){_0x1be289=_0x1be289-0x0;var _0x49296c=_0x7084[_0x1be289];return _0x49296c;};'use strict';var _=require(_0x4708('0x0'));var Promise=require(_0x4708('0x1'));var rp=require(_0x4708('0x2'));var util=require(_0x4708('0x3'));var md5=require(_0x4708('0x4'));var Redis=require(_0x4708('0x5'));var intUtil=require(_0x4708('0x6'));var config=require(_0x4708('0x7'));var logger=require('../../../../config/logger')(_0x4708('0x8'));config['redis']=_[_0x4708('0x9')](config[_0x4708('0xa')],{'host':_0x4708('0xb'),'port':0x18eb});var io=require(_0x4708('0xc'))(new Redis(config[_0x4708('0xa')]));function getAdminUser(_0x4cc9ad,_0x387e27,_0x158f18,_0xe502ed,_0x5c6d38,_0xd54bc4){return new Promise(function(_0xd1efc5,_0x47eed2){var _0x19b4af={'method':_0x4708('0xd'),'uri':_0xe502ed+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x5c6d38+'&'+_0xd54bc4,'auth':_0x387e27,'json':!![]};return rp(_0x19b4af)['then'](function(_0x20f692){if(_0x20f692['result'][_0x4708('0xe')]>0x0){_0x158f18[_0x4708('0xf')]=_0x20f692['result'][0x0][_0x4708('0x10')];}logger['info']('['+[_0x4cc9ad['toUpperCase']()]+_0x4708('0x11'),_0x158f18);_0xd1efc5(_0x158f18);})['catch'](function(_0x3f4ed4){logger[_0x4708('0x12')]('['+[_0x4cc9ad['toUpperCase']()]+']',_0x3f4ed4['message']);_0x47eed2(_0x3f4ed4[_0x4708('0x13')]);});});}function getUser(_0x253900,_0x51f468,_0x3b3b4c,_0x3022bf,_0x1fd0e7){return function(_0x425045){logger[_0x4708('0x14')]('['+[_0x253900[_0x4708('0x15')]()]+_0x4708('0x16'),_0x425045);return new Promise(function(_0x157b37,_0x3f2a07){if(intUtil[_0x4708('0x17')](_0x425045[_0x4708('0x18')])){var _0x5873f0={'method':_0x4708('0xd'),'uri':_0x3b3b4c+_0x4708('0x19')+_0x425045['userEmail']+'&'+_0x3022bf+'&'+_0x1fd0e7,'auth':_0x51f468,'json':!![]};logger[_0x4708('0x14')]('['+[_0x253900[_0x4708('0x15')]()]+_0x4708('0x1a'),_0x5873f0);return rp(_0x5873f0)['then'](function(_0x1cb8a4){logger[_0x4708('0x14')]('['+[_0x253900[_0x4708('0x15')]()]+_0x4708('0x1b'),_0x1cb8a4);if(_0x1cb8a4[_0x4708('0x1c')][_0x4708('0xe')]>0x0&&String(_0x1cb8a4[_0x4708('0x1c')][0x0]['active'])===_0x4708('0x1d')){_0x425045[_0x4708('0x1e')]=_0x1cb8a4[_0x4708('0x1c')][0x0][_0x4708('0x10')];}else{_0x425045[_0x4708('0x1e')]=_0x425045['adminId'];_0x425045[_0x4708('0x18')]=_0x425045['adminEmail'];}logger['info']('['+[_0x253900[_0x4708('0x15')]()]+_0x4708('0x1f'),_0x425045);_0x157b37(_0x425045);})[_0x4708('0x20')](function(_0x3a7ac5){logger[_0x4708('0x12')]('['+[_0x253900['toUpperCase']()]+']',_0x3a7ac5[_0x4708('0x13')]);_0x3f2a07(_0x3a7ac5[_0x4708('0x13')]);});}else{logger[_0x4708('0x14')]('['+[_0x253900[_0x4708('0x15')]()]+_0x4708('0x21'));_0x425045[_0x4708('0x1e')]=_0x425045[_0x4708('0xf')];_0x425045[_0x4708('0x18')]=_0x425045[_0x4708('0x22')];_0x157b37(_0x425045);}});};}function createEndUser(_0x8665e2,_0x4f8077,_0x3b7f01,_0x15ab44,_0x44dd8f){logger[_0x4708('0x14')]('['+[_0x8665e2[_0x4708('0x15')]()]+_0x4708('0x23'),_0x3b7f01);return new Promise(function(_0x1357a8,_0x7a3c8b){var _0x3a486a={'method':'POST','uri':_0x15ab44+'sys_user?'+_0x44dd8f,'body':{'user_name':_0x3b7f01[_0x4708('0x24')],'roles':_0x4708('0x25'),'first_name':_0x3b7f01[_0x4708('0x24')],'active':_0x4708('0x1d'),'date_format':_0x4708('0x26'),'phone':_0x3b7f01['endUserNumber']},'auth':_0x4f8077,'json':!![]};return rp(_0x3a486a)[_0x4708('0x27')](function(_0x24c928){logger[_0x4708('0x14')]('['+[_0x8665e2['toUpperCase']()]+'],\x20EndUser\x20schema',_0x24c928['result']);_0x3b7f01[_0x4708('0x28')]=_0x24c928['result'][_0x4708('0x10')];_0x1357a8(_0x3b7f01);})[_0x4708('0x20')](function(_0x4aedfe){logger['error']('['+[_0x8665e2['toUpperCase']()]+']',_0x4aedfe['message']);_0x7a3c8b(_0x4aedfe['message']);});});}function getEndUser(_0x275ec4,_0x25f355,_0x1bf21d,_0x531343,_0x34b442){return function(_0x550efa){logger[_0x4708('0x14')]('['+[_0x275ec4[_0x4708('0x15')]()]+_0x4708('0x29'),_0x550efa);return new Promise(function(_0x386ac8,_0x38cd4a){var _0xd7517={'method':_0x4708('0xd'),'uri':_0x1bf21d+_0x4708('0x2a')+_0x550efa['endUserNumber']+'&'+_0x531343+'&'+_0x34b442,'auth':_0x25f355,'json':!![]};return rp(_0xd7517)[_0x4708('0x27')](function(_0x259215){if(_0x259215['result']['length']>0x0){_0x550efa[_0x4708('0x28')]=_0x259215[_0x4708('0x1c')][0x0][_0x4708('0x10')];logger['info']('['+[_0x275ec4['toUpperCase']()]+_0x4708('0x2b'),_0x550efa);_0x386ac8(_0x550efa);}else{return createEndUser(_0x275ec4,_0x25f355,_0x550efa,_0x1bf21d,_0x531343)[_0x4708('0x27')](function(_0x18c901){logger[_0x4708('0x14')]('['+[_0x275ec4[_0x4708('0x15')]()]+_0x4708('0x2c'),_0x18c901);_0x386ac8(_0x18c901);});}})[_0x4708('0x20')](function(_0x4f359a){logger['error']('['+[_0x275ec4[_0x4708('0x15')]()]+']',_0x4f359a[_0x4708('0x13')]);_0x38cd4a(_0x4f359a[_0x4708('0x13')]);});});};}function getCustomFields(_0x3bb6b6,_0x107231){var _0x41161c={};if(_0x3bb6b6['length']>0x0){_[_0x4708('0x2d')](_0x3bb6b6,function(_0x3aecf6){if(_[_0x4708('0x2e')]([_0x4708('0x2f'),_0x4708('0x30')],_0x3aecf6[_0x4708('0x31')])&&_0x3aecf6[_0x4708('0x32')]&&!_0x3aecf6[_0x4708('0x33')]){_0x41161c[_0x3aecf6[_0x4708('0x32')][_0x4708('0x34')]()]=_0x3aecf6[_0x4708('0x35')][_0x4708('0x36')]();}else if(_['includes'](['string',_0x4708('0x30')],_0x3aecf6[_0x4708('0x31')])&&_0x3aecf6['idField']&&_0x3aecf6['customField']){_0x41161c[_0x3aecf6[_0x4708('0x37')][_0x4708('0x34')]()]=_0x3aecf6[_0x4708('0x35')][_0x4708('0x36')]();}else if(_0x3aecf6[_0x4708('0x31')]==='variable'&&_0x3aecf6['variableName']&&_0x3aecf6[_0x4708('0x37')]&&_0x3aecf6[_0x4708('0x33')]){_0x41161c[_0x3aecf6[_0x4708('0x37')]['toLowerCase']()]=_0x107231[_0x3aecf6[_0x4708('0x38')]][_0x4708('0x36')]();}else if(_0x3aecf6['type']==='customVariable'&&_0x3aecf6[_0x4708('0x39')]&&_0x3aecf6[_0x4708('0x39')][_0x4708('0x3a')]&&_0x3aecf6[_0x4708('0x37')]&&_0x3aecf6[_0x4708('0x33')]){_0x41161c[_0x3aecf6[_0x4708('0x37')][_0x4708('0x34')]()]=_0x107231[_0x3aecf6[_0x4708('0x39')][_0x4708('0x3a')]['toLowerCase']()][_0x4708('0x36')]();}});}return _0x41161c;}function getTicket(_0x28d8a5,_0x3b1de8,_0x11a087,_0xc01ee0,_0x12e35e,_0x369ca6){return function(_0x5116ee){logger['info']('['+[_0x28d8a5[_0x4708('0x15')]()]+_0x4708('0x3b'),_0x5116ee);return new Promise(function(_0x205937,_0x13a378){var _0x503636=_0x28d8a5[_0x4708('0x34')]()===_0x4708('0x3c')?_0x5116ee[_0x4708('0x1e')]:_0x5116ee[_0x4708('0x28')];var _0xf6e7e={'method':_0x4708('0x3d'),'uri':_0x11a087+_0x4708('0x3e')+'?'+_0x369ca6,'body':Object[_0x4708('0x3f')]({},{'active':'true','caller_id':_0x503636,'assigned_to':_0x5116ee['userId'],'short_description':intUtil[_0x4708('0x40')](_0xc01ee0[_0x4708('0x41')],_0x12e35e,'\x20'),'description':intUtil[_0x4708('0x40')](_0xc01ee0[_0x4708('0x42')],_0x12e35e,'\x0a')},getCustomFields(_0xc01ee0['Fields'],_0x12e35e)),'auth':_0x3b1de8,'json':!![]};return rp(_0xf6e7e)[_0x4708('0x27')](function(_0x48108f){logger['info']('['+[_0x28d8a5[_0x4708('0x15')]()]+_0x4708('0x43'),_0x48108f[_0x4708('0x1c')]);_0x5116ee[_0x4708('0x44')]=_0x48108f['result'][_0x4708('0x10')];_0x5116ee[_0x4708('0x45')]=_0x48108f[_0x4708('0x1c')][_0x4708('0x46')];logger[_0x4708('0x14')]('['+[_0x28d8a5[_0x4708('0x15')]()]+_0x4708('0x47'),_0x5116ee);_0x205937(_0x5116ee);})[_0x4708('0x20')](function(_0x5399ec){logger[_0x4708('0x12')]('['+[_0x28d8a5['toUpperCase']()]+']',_0x5399ec[_0x4708('0x13')]);_0x13a378(_0x5399ec[_0x4708('0x13')]);});});};}function createRemoteTag(_0x4ba2fb,_0x31c57b,_0x3811be,_0x2a18ca){return new Promise(function(_0x29cfcf,_0x2d5be7){var _0x3b4b90={'method':'POST','uri':_0x3811be+_0x4708('0x48')+'?'+_0x2a18ca,'body':{'short_description':_0x4ba2fb,'global':!![],'active':!![],'name':_0x4ba2fb},'auth':_0x31c57b,'json':!![]};return rp(_0x3b4b90)[_0x4708('0x27')](function(_0x2b2279){var _0x1b89db=_0x2b2279['result'][_0x4708('0x10')];_0x29cfcf(_0x1b89db);});});}function getRemoteTag(_0x335f54,_0x2b3e3f,_0x5f04da,_0x5159ed,_0xd57a74){return new Promise(function(_0x41dd41,_0xd82435){var _0x3f1b4f={'method':'GET','uri':_0x5f04da+_0x4708('0x48')+_0x4708('0x49')+_0x335f54+'&'+_0x5159ed,'auth':_0x2b3e3f,'json':!![]};return rp(_0x3f1b4f)[_0x4708('0x27')](function(_0xb2ea15){if(_0xb2ea15['result'][_0x4708('0xe')]>0x0){var _0x3af302=_0xb2ea15['result'][0x0][_0x4708('0x10')];_0x41dd41(_0x3af302);}else{return createRemoteTag(_0x335f54,_0x2b3e3f,_0x5f04da,_0x5159ed)['then'](function(_0x547ef7){_0x41dd41(_0x547ef7);});}});});}function assignTagToIncident(_0x1633d9,_0x363be6,_0x30f8b9,_0x4fe326,_0x1dfc94){return new Promise(function(_0xb183e6,_0x580a9e){var _0x2163e2={'method':_0x4708('0x3d'),'uri':_0x30f8b9+'label_entry'+'?'+_0x1dfc94,'body':{'label':_0x1633d9,'table':_0x4708('0x3e'),'id_type':_0x4708('0x4a'),'table_key':_0x4fe326['ticketId'],'title':_0x4708('0x4b')+_0x4fe326['ticketNumber'],'id_display':_0x4fe326[_0x4708('0x45')]},'auth':_0x363be6,'json':!![]};return rp(_0x2163e2)[_0x4708('0x27')](function(_0x440814){_0xb183e6();})[_0x4708('0x20')](function(){_0xb183e6();});});}function manageTags(_0x10461b,_0x2d5870,_0x1539da,_0x4aee5a,_0xdc1928,_0x2586ff,_0x209d8d){return new Promise(function(_0x29b3b5,_0x3b0f8c){var _0x148c0f=[];_0x2d5870[_0x4708('0x2d')](function(_0x2fbe21){_0x148c0f[_0x4708('0x4c')](getRemoteTag(_0x2fbe21,_0x1539da,_0x4aee5a,_0x2586ff,_0x209d8d));});return Promise['all'](_0x148c0f)[_0x4708('0x27')](function(_0x14a056){if(_0x14a056[_0x4708('0xe')]){logger[_0x4708('0x14')]('['+[_0x10461b[_0x4708('0x15')]()]+_0x4708('0x4d'),_0x14a056);var _0xa45fc3=[];_0x14a056['forEach'](function(_0x5eebef){_0xa45fc3[_0x4708('0x4c')](assignTagToIncident(_0x5eebef,_0x1539da,_0x4aee5a,_0xdc1928,_0x2586ff));});return Promise[_0x4708('0x4e')](_0xa45fc3)['then'](function(){_0x29b3b5();})[_0x4708('0x20')](function(){_0x29b3b5();});}else{_0x29b3b5();}});});}function getTags(_0x393bf9,_0x5a5229,_0x36d78c,_0x54444d,_0x1b8bfb,_0x52c726){return function(_0x1eeb43){return new Promise(function(_0x6db9c,_0x313d8e){var _0x4caab8=[];var _0x5df562=_0x54444d[_0x4708('0x4f')];if(_0x5df562&&_0x5df562[_0x4708('0xe')]>0x0){_0x4caab8=_[_0x4708('0x50')](_0x5df562,_0x4708('0x3a'));}if(_0x4caab8[_0x4708('0xe')]>0x0){return manageTags(_0x393bf9,_0x4caab8,_0x5a5229,_0x36d78c,_0x1eeb43,_0x1b8bfb,_0x52c726)['then'](function(){_0x6db9c(_0x1eeb43);});}else{_0x6db9c(_0x1eeb43);}});};}function emit(_0x5d5de5,_0x477395,_0x584990){var _0x4c6aab=_0x4708('0x51')+_0x4708('0x52')+_0x4708('0x53')+_0x4708('0x54');var _0x3eed66={'uri':_0x5d5de5+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x584990+_0x4c6aab};io['to'](util[_0x4708('0x55')](_0x4708('0x56'),_0x477395))[_0x4708('0x57')](_0x4708('0x58'),_0x3eed66);}exports['cs']=function(_0x50f819,_0x19276a,_0x5ace04,_0x5689b5,_0x4a160f,_0x1e9cfe,_0x228506,_0x1c91c3){var _0x4c028a={};var _0x111f47={'user':_0x1e9cfe[_0x4708('0x59')],'pass':_0x1e9cfe[_0x4708('0x5a')]};var _0x518441=_0x4708('0x5b');var _0x3e88c0=_0x4708('0x5c');_0x1e9cfe[_0x4708('0x5d')]=intUtil[_0x4708('0x5e')](_0x1e9cfe[_0x4708('0x5d')]);_0x1e9cfe[_0x4708('0x5f')]=intUtil[_0x4708('0x5e')](_0x1e9cfe[_0x4708('0x5f')]);var _0x1d961e=util[_0x4708('0x55')]('%s/api/now/table/',_0x1e9cfe[_0x4708('0x5d')]);_0x4c028a[_0x4708('0x18')]=!_[_0x4708('0x60')](_0x5689b5)?_0x5689b5[_0x4708('0x61')]:null;_0x4c028a[_0x4708('0x22')]=_0x1e9cfe['email'];_0x4c028a[_0x4708('0x24')]=_0x1c91c3['toLowerCase']()===_0x4708('0x3c')?_0x19276a[_0x4708('0x62')]:_0x19276a[_0x4708('0x63')];_0x4c028a[_0x4708('0x64')]=_0x1c91c3===_0x4708('0x65')||_0x1c91c3===_0x4708('0x66')?_0x4708('0x65'):_0x4708('0x3c');var _0x21e3fe=util['format'](_0x4708('0x67'),_0x1e9cfe['serverUrl'],_0x19276a[_0x4708('0x68')],md5(_0x19276a[_0x4708('0x68')]));if(_0x4a160f&&_0x4a160f[_0x4708('0x69')]){logger[_0x4708('0x14')](_0x4708('0x6a'),_0x4708('0x6b'));_0x19276a['recordingURL']=_0x21e3fe;}else if(_0x228506&&_0x228506[_0x4708('0x6c')]&&_0x228506[_0x4708('0x6c')]!==_0x4708('0x6d')){logger[_0x4708('0x14')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x19276a['recordingURL']=_0x21e3fe;}else{_0x19276a['recordingURL']='';}return getAdminUser(_0x1c91c3,_0x111f47,_0x4c028a,_0x1d961e,_0x3e88c0,_0x518441)['then'](getUser(_0x1c91c3,_0x111f47,_0x1d961e,_0x3e88c0,_0x518441))[_0x4708('0x27')](getEndUser(_0x1c91c3,_0x111f47,_0x1d961e,_0x3e88c0,_0x518441))[_0x4708('0x27')](getTicket(_0x1c91c3,_0x111f47,_0x1d961e,_0x5ace04,_0x19276a,_0x3e88c0))[_0x4708('0x27')](function(_0x233d28){logger[_0x4708('0x14')](util[_0x4708('0x55')](_0x4708('0x6e'),_0x233d28['ticketId']));logger['info'](util[_0x4708('0x55')](_0x4708('0x6f'),_0x1c91c3));if(_0x1c91c3!==_0x4708('0x66')){logger[_0x4708('0x14')]('['+[_0x1c91c3[_0x4708('0x15')]()]+']',_0x4708('0x70'));emit(_0x1e9cfe[_0x4708('0x5d')],_0x5689b5[_0x4708('0x3a')],_0x233d28[_0x4708('0x44')]);}})[_0x4708('0x20')](function(_0x1b617e){logger[_0x4708('0x12')]('['+[_0x1c91c3[_0x4708('0x15')]()]+_0x4708('0x71'),util[_0x4708('0x72')](_0x1b617e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8cdc=['call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','toUpperCase','],\x20getUser\x20rp\x20obj','active','true','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','type','customField','content','toString','string','picklist','idField','toLowerCase','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','userId','incident','assign','Subjects','getString','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8cdc,0x14e));var _0xc8cd=function(_0xb581a5,_0x2ccfd8){_0xb581a5=_0xb581a5-0x0;var _0x3213f2=_0x8cdc[_0xb581a5];return _0x3213f2;};'use strict';var _=require(_0xc8cd('0x0'));var Promise=require('bluebird');var rp=require(_0xc8cd('0x1'));var util=require('util');var md5=require(_0xc8cd('0x2'));var Redis=require(_0xc8cd('0x3'));var intUtil=require(_0xc8cd('0x4'));var config=require(_0xc8cd('0x5'));var logger=require(_0xc8cd('0x6'))(_0xc8cd('0x7'));config[_0xc8cd('0x8')]=_['defaults'](config[_0xc8cd('0x8')],{'host':_0xc8cd('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc8cd('0x8')]));function getAdminUser(_0x2273da,_0xaa16a4,_0x4a6019,_0xa3b36e,_0x9c03df,_0x2a57f9){return new Promise(function(_0x15199d,_0x29eb98){var _0x438d91={'method':'GET','uri':_0xa3b36e+_0xc8cd('0xa')+'&'+_0x9c03df+'&'+_0x2a57f9,'auth':_0xaa16a4,'json':!![]};return rp(_0x438d91)[_0xc8cd('0xb')](function(_0x5bc1cd){if(_0x5bc1cd['result'][_0xc8cd('0xc')]>0x0){_0x4a6019[_0xc8cd('0xd')]=_0x5bc1cd[_0xc8cd('0xe')][0x0][_0xc8cd('0xf')];}logger[_0xc8cd('0x10')]('['+[_0x2273da['toUpperCase']()]+_0xc8cd('0x11'),_0x4a6019);_0x15199d(_0x4a6019);})[_0xc8cd('0x12')](function(_0x3e001d){logger[_0xc8cd('0x13')]('['+[_0x2273da['toUpperCase']()]+']',_0x3e001d[_0xc8cd('0x14')]);_0x29eb98(_0x3e001d['message']);});});}function getUser(_0x317e3d,_0x1b4551,_0x19f118,_0x1d1d39,_0x19337b){return function(_0x3ce246){logger[_0xc8cd('0x10')]('['+[_0x317e3d['toUpperCase']()]+_0xc8cd('0x15'),_0x3ce246);return new Promise(function(_0x12e5f6,_0x44f943){if(intUtil[_0xc8cd('0x16')](_0x3ce246[_0xc8cd('0x17')])){var _0x48070e={'method':_0xc8cd('0x18'),'uri':_0x19f118+_0xc8cd('0x19')+_0x3ce246[_0xc8cd('0x17')]+'&'+_0x1d1d39+'&'+_0x19337b,'auth':_0x1b4551,'json':!![]};logger['info']('['+[_0x317e3d[_0xc8cd('0x1a')]()]+_0xc8cd('0x1b'),_0x48070e);return rp(_0x48070e)[_0xc8cd('0xb')](function(_0x4320bb){logger[_0xc8cd('0x10')]('['+[_0x317e3d[_0xc8cd('0x1a')]()]+'],\x20getUser\x20entity',_0x4320bb);if(_0x4320bb[_0xc8cd('0xe')]['length']>0x0&&String(_0x4320bb[_0xc8cd('0xe')][0x0][_0xc8cd('0x1c')])===_0xc8cd('0x1d')){_0x3ce246['userId']=_0x4320bb[_0xc8cd('0xe')][0x0]['sys_id'];}else{_0x3ce246['userId']=_0x3ce246[_0xc8cd('0xd')];_0x3ce246[_0xc8cd('0x17')]=_0x3ce246[_0xc8cd('0x1e')];}logger['info']('['+[_0x317e3d[_0xc8cd('0x1a')]()]+_0xc8cd('0x1f'),_0x3ce246);_0x12e5f6(_0x3ce246);})[_0xc8cd('0x12')](function(_0x58d4e1){logger[_0xc8cd('0x13')]('['+[_0x317e3d[_0xc8cd('0x1a')]()]+']',_0x58d4e1[_0xc8cd('0x14')]);_0x44f943(_0x58d4e1[_0xc8cd('0x14')]);});}else{logger[_0xc8cd('0x10')]('['+[_0x317e3d[_0xc8cd('0x1a')]()]+_0xc8cd('0x20'));_0x3ce246['userId']=_0x3ce246[_0xc8cd('0xd')];_0x3ce246[_0xc8cd('0x17')]=_0x3ce246[_0xc8cd('0x1e')];_0x12e5f6(_0x3ce246);}});};}function createEndUser(_0x420d42,_0x9ecd4f,_0x45ff19,_0x137777,_0x3cafc5){logger['info']('['+[_0x420d42['toUpperCase']()]+_0xc8cd('0x21'),_0x45ff19);return new Promise(function(_0x1b28ba,_0xc2bf14){var _0x58de9f={'method':_0xc8cd('0x22'),'uri':_0x137777+_0xc8cd('0x23')+_0x3cafc5,'body':{'user_name':_0x45ff19['endUserNumber'],'roles':_0xc8cd('0x24'),'first_name':_0x45ff19[_0xc8cd('0x25')],'active':_0xc8cd('0x1d'),'date_format':'System','phone':_0x45ff19[_0xc8cd('0x25')]},'auth':_0x9ecd4f,'json':!![]};return rp(_0x58de9f)[_0xc8cd('0xb')](function(_0x13f3b9){logger['info']('['+[_0x420d42['toUpperCase']()]+'],\x20EndUser\x20schema',_0x13f3b9[_0xc8cd('0xe')]);_0x45ff19[_0xc8cd('0x26')]=_0x13f3b9[_0xc8cd('0xe')][_0xc8cd('0xf')];_0x1b28ba(_0x45ff19);})[_0xc8cd('0x12')](function(_0x179036){logger['error']('['+[_0x420d42[_0xc8cd('0x1a')]()]+']',_0x179036[_0xc8cd('0x14')]);_0xc2bf14(_0x179036[_0xc8cd('0x14')]);});});}function getEndUser(_0x5b604e,_0x18c2b2,_0x214124,_0x1343c9,_0x2e3291){return function(_0x5db6fd){logger[_0xc8cd('0x10')]('['+[_0x5b604e[_0xc8cd('0x1a')]()]+'],\x20getEndUser\x20input\x20crm',_0x5db6fd);return new Promise(function(_0x494f92,_0x55ee62){var _0x20f74={'method':'GET','uri':_0x214124+_0xc8cd('0x27')+_0x5db6fd['endUserNumber']+'&'+_0x1343c9+'&'+_0x2e3291,'auth':_0x18c2b2,'json':!![]};return rp(_0x20f74)[_0xc8cd('0xb')](function(_0x240410){if(_0x240410[_0xc8cd('0xe')][_0xc8cd('0xc')]>0x0){_0x5db6fd[_0xc8cd('0x26')]=_0x240410['result'][0x0][_0xc8cd('0xf')];logger['info']('['+[_0x5b604e[_0xc8cd('0x1a')]()]+_0xc8cd('0x28'),_0x5db6fd);_0x494f92(_0x5db6fd);}else{return createEndUser(_0x5b604e,_0x18c2b2,_0x5db6fd,_0x214124,_0x1343c9)[_0xc8cd('0xb')](function(_0x2ec390){logger['info']('['+[_0x5b604e['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x2ec390);_0x494f92(_0x2ec390);});}})[_0xc8cd('0x12')](function(_0x5d4b16){logger[_0xc8cd('0x13')]('['+[_0x5b604e[_0xc8cd('0x1a')]()]+']',_0x5d4b16[_0xc8cd('0x14')]);_0x55ee62(_0x5d4b16[_0xc8cd('0x14')]);});});};}function getCustomFields(_0x1516e4,_0x2f7b47){var _0x29e65d={};if(_0x1516e4[_0xc8cd('0xc')]>0x0){_[_0xc8cd('0x29')](_0x1516e4,function(_0x570e69){if(_[_0xc8cd('0x2a')](['string','picklist'],_0x570e69[_0xc8cd('0x2b')])&&_0x570e69['nameField']&&!_0x570e69[_0xc8cd('0x2c')]){_0x29e65d[_0x570e69['nameField']['toLowerCase']()]=_0x570e69[_0xc8cd('0x2d')][_0xc8cd('0x2e')]();}else if(_[_0xc8cd('0x2a')]([_0xc8cd('0x2f'),_0xc8cd('0x30')],_0x570e69[_0xc8cd('0x2b')])&&_0x570e69[_0xc8cd('0x31')]&&_0x570e69['customField']){_0x29e65d[_0x570e69[_0xc8cd('0x31')][_0xc8cd('0x32')]()]=_0x570e69['content'][_0xc8cd('0x2e')]();}else if(_0x570e69[_0xc8cd('0x2b')]==='variable'&&_0x570e69[_0xc8cd('0x33')]&&_0x570e69[_0xc8cd('0x31')]&&_0x570e69[_0xc8cd('0x2c')]){_0x29e65d[_0x570e69[_0xc8cd('0x31')][_0xc8cd('0x32')]()]=_0x2f7b47[_0x570e69[_0xc8cd('0x33')]]['toString']();}else if(_0x570e69['type']===_0xc8cd('0x34')&&_0x570e69[_0xc8cd('0x35')]&&_0x570e69[_0xc8cd('0x35')][_0xc8cd('0x36')]&&_0x570e69[_0xc8cd('0x31')]&&_0x570e69[_0xc8cd('0x2c')]){_0x29e65d[_0x570e69[_0xc8cd('0x31')]['toLowerCase']()]=_0x2f7b47[_0x570e69[_0xc8cd('0x35')]['name'][_0xc8cd('0x32')]()]['toString']();}});}return _0x29e65d;}function getTicket(_0x3d64b3,_0xa1e138,_0x43e084,_0x1b5e3a,_0x44f959,_0x32d183){return function(_0x22c241){logger[_0xc8cd('0x10')]('['+[_0x3d64b3[_0xc8cd('0x1a')]()]+_0xc8cd('0x37'),_0x22c241);return new Promise(function(_0x361a24,_0x2e66bd){var _0x1ca5a1=_0x3d64b3[_0xc8cd('0x32')]()==='outbound'?_0x22c241[_0xc8cd('0x38')]:_0x22c241[_0xc8cd('0x26')];var _0x277204={'method':'POST','uri':_0x43e084+_0xc8cd('0x39')+'?'+_0x32d183,'body':Object[_0xc8cd('0x3a')]({},{'active':_0xc8cd('0x1d'),'caller_id':_0x1ca5a1,'assigned_to':_0x22c241[_0xc8cd('0x38')],'short_description':intUtil['getString'](_0x1b5e3a[_0xc8cd('0x3b')],_0x44f959,'\x20'),'description':intUtil[_0xc8cd('0x3c')](_0x1b5e3a['Descriptions'],_0x44f959,'\x0a')},getCustomFields(_0x1b5e3a[_0xc8cd('0x3d')],_0x44f959)),'auth':_0xa1e138,'json':!![]};return rp(_0x277204)[_0xc8cd('0xb')](function(_0x312e1c){logger[_0xc8cd('0x10')]('['+[_0x3d64b3[_0xc8cd('0x1a')]()]+_0xc8cd('0x3e'),_0x312e1c[_0xc8cd('0xe')]);_0x22c241[_0xc8cd('0x3f')]=_0x312e1c['result'][_0xc8cd('0xf')];_0x22c241[_0xc8cd('0x40')]=_0x312e1c[_0xc8cd('0xe')][_0xc8cd('0x41')];logger[_0xc8cd('0x10')]('['+[_0x3d64b3[_0xc8cd('0x1a')]()]+_0xc8cd('0x42'),_0x22c241);_0x361a24(_0x22c241);})['catch'](function(_0xc069f4){logger[_0xc8cd('0x13')]('['+[_0x3d64b3[_0xc8cd('0x1a')]()]+']',_0xc069f4['message']);_0x2e66bd(_0xc069f4['message']);});});};}function createRemoteTag(_0x28cc84,_0x5a49de,_0x3c290d,_0x53171b){return new Promise(function(_0x27bd37,_0x28a0ed){var _0x2dc0e3={'method':_0xc8cd('0x22'),'uri':_0x3c290d+'label'+'?'+_0x53171b,'body':{'short_description':_0x28cc84,'global':!![],'active':!![],'name':_0x28cc84},'auth':_0x5a49de,'json':!![]};return rp(_0x2dc0e3)[_0xc8cd('0xb')](function(_0x2fef8b){var _0x389bde=_0x2fef8b['result'][_0xc8cd('0xf')];_0x27bd37(_0x389bde);});});}function getRemoteTag(_0x295402,_0x57d0c1,_0x1b7b30,_0x4f2457,_0x1e8fa3){return new Promise(function(_0x5a5949,_0x27c10a){var _0xba6302={'method':_0xc8cd('0x18'),'uri':_0x1b7b30+_0xc8cd('0x43')+_0xc8cd('0x44')+_0x295402+'&'+_0x4f2457,'auth':_0x57d0c1,'json':!![]};return rp(_0xba6302)['then'](function(_0x1c2d26){if(_0x1c2d26[_0xc8cd('0xe')]['length']>0x0){var _0x42e921=_0x1c2d26[_0xc8cd('0xe')][0x0][_0xc8cd('0xf')];_0x5a5949(_0x42e921);}else{return createRemoteTag(_0x295402,_0x57d0c1,_0x1b7b30,_0x4f2457)['then'](function(_0x37b48f){_0x5a5949(_0x37b48f);});}});});}function assignTagToIncident(_0x14f21d,_0x5b4eef,_0x523fcc,_0x2211e1,_0x1eedd5){return new Promise(function(_0x304592,_0x67fd01){var _0x42646b={'method':_0xc8cd('0x22'),'uri':_0x523fcc+_0xc8cd('0x45')+'?'+_0x1eedd5,'body':{'label':_0x14f21d,'table':'incident','id_type':'Incident','table_key':_0x2211e1[_0xc8cd('0x3f')],'title':_0xc8cd('0x46')+_0x2211e1[_0xc8cd('0x40')],'id_display':_0x2211e1[_0xc8cd('0x40')]},'auth':_0x5b4eef,'json':!![]};return rp(_0x42646b)[_0xc8cd('0xb')](function(_0x44d20a){_0x304592();})[_0xc8cd('0x12')](function(){_0x304592();});});}function manageTags(_0x24352a,_0x3bf55e,_0x3a43cc,_0x43c7ce,_0x29463d,_0x4dbfdc,_0x18aba4){return new Promise(function(_0x5aaa4e,_0x4c50a4){var _0x31f6f5=[];_0x3bf55e[_0xc8cd('0x29')](function(_0x45e355){_0x31f6f5[_0xc8cd('0x47')](getRemoteTag(_0x45e355,_0x3a43cc,_0x43c7ce,_0x4dbfdc,_0x18aba4));});return Promise[_0xc8cd('0x48')](_0x31f6f5)[_0xc8cd('0xb')](function(_0x33c9d7){if(_0x33c9d7[_0xc8cd('0xc')]){logger[_0xc8cd('0x10')]('['+[_0x24352a['toUpperCase']()]+_0xc8cd('0x49'),_0x33c9d7);var _0x40549e=[];_0x33c9d7[_0xc8cd('0x29')](function(_0x4d5d03){_0x40549e[_0xc8cd('0x47')](assignTagToIncident(_0x4d5d03,_0x3a43cc,_0x43c7ce,_0x29463d,_0x4dbfdc));});return Promise[_0xc8cd('0x48')](_0x40549e)[_0xc8cd('0xb')](function(){_0x5aaa4e();})[_0xc8cd('0x12')](function(){_0x5aaa4e();});}else{_0x5aaa4e();}});});}function getTags(_0x4eedd1,_0x463625,_0x175f60,_0x5dcff2,_0x2c6bff,_0x3a1868){return function(_0x34d262){return new Promise(function(_0x38b368,_0x404a7e){var _0x20a3f1=[];var _0x13a304=_0x5dcff2[_0xc8cd('0x4a')];if(_0x13a304&&_0x13a304['length']>0x0){_0x20a3f1=_[_0xc8cd('0x4b')](_0x13a304,_0xc8cd('0x36'));}if(_0x20a3f1[_0xc8cd('0xc')]>0x0){return manageTags(_0x4eedd1,_0x20a3f1,_0x463625,_0x175f60,_0x34d262,_0x2c6bff,_0x3a1868)[_0xc8cd('0xb')](function(){_0x38b368(_0x34d262);});}else{_0x38b368(_0x34d262);}});};}function emit(_0x45bc86,_0x44c2d1,_0x2d56c7){var _0x119a8f=_0xc8cd('0x4c')+_0xc8cd('0x4d')+_0xc8cd('0x4e')+_0xc8cd('0x4f');var _0x18721b={'uri':_0x45bc86+_0xc8cd('0x50')+_0x2d56c7+_0x119a8f};io['to'](util[_0xc8cd('0x51')](_0xc8cd('0x52'),_0x44c2d1))[_0xc8cd('0x53')](_0xc8cd('0x54'),_0x18721b);}exports['cs']=function(_0x169204,_0x32ab5d,_0x3aa28b,_0x8af28,_0x2b3e00,_0x582964,_0xc1918c,_0x4ae76e){var _0x38397d={};var _0xb300a3={'user':_0x582964['username'],'pass':_0x582964[_0xc8cd('0x55')]};var _0x471482=_0xc8cd('0x56');var _0x110ec2=_0xc8cd('0x57');_0x582964[_0xc8cd('0x58')]=intUtil[_0xc8cd('0x59')](_0x582964[_0xc8cd('0x58')]);_0x582964[_0xc8cd('0x5a')]=intUtil['stripTrailingSlash'](_0x582964[_0xc8cd('0x5a')]);var _0x5f4c0c=util[_0xc8cd('0x51')]('%s/api/now/table/',_0x582964[_0xc8cd('0x58')]);_0x38397d['userEmail']=!_[_0xc8cd('0x5b')](_0x8af28)?_0x8af28[_0xc8cd('0x5c')]:null;_0x38397d[_0xc8cd('0x1e')]=_0x582964[_0xc8cd('0x5c')];_0x38397d[_0xc8cd('0x25')]=_0x4ae76e[_0xc8cd('0x32')]()==='outbound'?_0x32ab5d[_0xc8cd('0x5d')]:_0x32ab5d[_0xc8cd('0x5e')];_0x38397d[_0xc8cd('0x5f')]=_0x4ae76e===_0xc8cd('0x60')||_0x4ae76e===_0xc8cd('0x61')?_0xc8cd('0x60'):_0xc8cd('0x62');var _0x855e64=util[_0xc8cd('0x51')](_0xc8cd('0x63'),_0x582964['serverUrl'],_0x32ab5d[_0xc8cd('0x64')],md5(_0x32ab5d[_0xc8cd('0x64')]));if(_0x2b3e00&&_0x2b3e00['monitor_format']){logger['info'](_0xc8cd('0x65'),_0xc8cd('0x66'));_0x32ab5d[_0xc8cd('0x67')]=_0x855e64;}else if(_0xc1918c&&_0xc1918c[_0xc8cd('0x68')]&&_0xc1918c[_0xc8cd('0x68')]!=='none'){logger['info'](_0xc8cd('0x69'),_0xc8cd('0x66'));_0x32ab5d[_0xc8cd('0x67')]=_0x855e64;}else{_0x32ab5d['recordingURL']='';}return getAdminUser(_0x4ae76e,_0xb300a3,_0x38397d,_0x5f4c0c,_0x110ec2,_0x471482)[_0xc8cd('0xb')](getUser(_0x4ae76e,_0xb300a3,_0x5f4c0c,_0x110ec2,_0x471482))[_0xc8cd('0xb')](getEndUser(_0x4ae76e,_0xb300a3,_0x5f4c0c,_0x110ec2,_0x471482))[_0xc8cd('0xb')](getTicket(_0x4ae76e,_0xb300a3,_0x5f4c0c,_0x3aa28b,_0x32ab5d,_0x110ec2))[_0xc8cd('0xb')](function(_0x111fc9){logger[_0xc8cd('0x10')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x111fc9['ticketId']));logger[_0xc8cd('0x10')](util['format'](_0xc8cd('0x6a'),_0x4ae76e));if(_0x4ae76e!==_0xc8cd('0x61')){logger[_0xc8cd('0x10')]('['+[_0x4ae76e[_0xc8cd('0x1a')]()]+']',_0xc8cd('0x6b'));emit(_0x582964['remoteUri'],_0x8af28[_0xc8cd('0x36')],_0x111fc9[_0xc8cd('0x3f')]);}})[_0xc8cd('0x12')](function(_0x4c878a){logger[_0xc8cd('0x13')]('['+[_0x4ae76e['toUpperCase']()]+_0xc8cd('0x6c'),util[_0xc8cd('0x6d')](_0x4c878a,{'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 a99f3a7..73e881d 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 _0x8a4f=['Contacts','direction','length','push','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','toString','get_server_info','stringify','isNil','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','value','Agent\x20found!','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','resolve','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','then','Enduser\x20found!','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','forEach','string','customField','nameField','content','type','custom_fields','variable','customVariable','Variable','toLowerCase','login','username','sessionID','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','Outbound','unmanaged','lastevent','toUpperCase','error','lodash','request-promise','bluebird','md5','util','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','duration_minutes','parent_id'];(function(_0x358da2,_0x19a2dc){var _0x4c9594=function(_0x153633){while(--_0x153633){_0x358da2['push'](_0x358da2['shift']());}};_0x4c9594(++_0x19a2dc);}(_0x8a4f,0x14b));var _0xf8a4=function(_0xe2de4d,_0x400383){_0xe2de4d=_0xe2de4d-0x0;var _0x1e3728=_0x8a4f[_0xe2de4d];return _0x1e3728;};'use strict';var _=require(_0xf8a4('0x0'));var rp=require(_0xf8a4('0x1'));var BPromise=require(_0xf8a4('0x2'));var md5=require(_0xf8a4('0x3'));var util=require(_0xf8a4('0x4'));var Redis=require('ioredis');var intUtil=require(_0xf8a4('0x5'));var config=require(_0xf8a4('0x6'));var logger=require(_0xf8a4('0x7'))(_0xf8a4('0x8'));config[_0xf8a4('0x9')]=_['defaults'](config[_0xf8a4('0x9')],{'host':_0xf8a4('0xa'),'port':0x18eb});var io=require(_0xf8a4('0xb'))(new Redis(config[_0xf8a4('0x9')]));var def={'method':_0xf8a4('0xc'),'json':!![]};function emit(_0x4cf8ff,_0x3d94af,_0x1ace99){io['to'](_0x4cf8ff)[_0xf8a4('0xd')](_0x3d94af,_0x1ace99);}function getTicket(_0x343602,_0x1afc13,_0x5a321f,_0x48b5bd,_0x1f70b6,_0x3ca9cb,_0x3151d2,_0x2dbd9b){logger[_0xf8a4('0xe')](_0xf8a4('0xf'));var _0x429c80=new Date();var _0x245793=[{'name':_0xf8a4('0x10'),'value':intUtil['getString'](_0x48b5bd['Subjects'],_0x1f70b6,'\x20')},{'name':'assigned_user_id','value':_0x1afc13['id']},{'name':'created_by','value':_0x1afc13['id']},{'name':_0xf8a4('0x11'),'value':intUtil['getString'](_0x48b5bd[_0xf8a4('0x12')],_0x1f70b6,'\x0a')},{'name':_0xf8a4('0x13'),'value':_0x429c80[_0xf8a4('0x14')]()[_0xf8a4('0x15')](0x0,0x13)[_0xf8a4('0x16')]('T','\x20')},{'name':_0xf8a4('0x17'),'value':'0'},{'name':_0xf8a4('0x18'),'value':'15'},{'name':_0xf8a4('0x19'),'value':_0x5a321f['id']},{'name':'parent_type','value':_0xf8a4('0x1a')},{'name':'parent_name','value':_0x5a321f[_0xf8a4('0x10')]},{'name':_0xf8a4('0x1b'),'value':_0x2dbd9b}];if(_0x3ca9cb[_0xf8a4('0x1c')]){_['forEach'](_0x3ca9cb,function(_0x325046){if(_0x1f70b6[_0x325046['variableName']]){_0x245793[_0xf8a4('0x1d')]({'name':_0x325046[_0xf8a4('0x1e')],'value':_0x1f70b6[_0x325046[_0xf8a4('0x1f')]]});}});}return request({'form':{'method':_0xf8a4('0x20'),'input_type':_0xf8a4('0x21'),'response_type':_0xf8a4('0x21'),'rest_data':JSON['stringify']({'session':_0x3151d2['id'],'module_name':_0xf8a4('0x22'),'name_value_list':_0x245793})}});}function getAuth(_0x3516f9){return util[_0xf8a4('0x23')](_0xf8a4('0x24'),new Buffer(_0x3516f9['apiKey']+':X')[_0xf8a4('0x25')]('base64'));}function getServerInfo(_0x51dd8e){return request({'form':{'method':_0xf8a4('0x26'),'input_type':_0xf8a4('0x21'),'response_type':_0xf8a4('0x21'),'rest_data':JSON[_0xf8a4('0x27')]({'session':_0x51dd8e['id']})}});}function getUser(_0x4069f2,_0x486989,_0x1ad608){if(!_[_0xf8a4('0x28')](_0x486989)){logger[_0xf8a4('0xe')]('Getting\x20agent\x20with\x20name',_0x486989);return request({'form':{'method':_0xf8a4('0x29'),'input_type':'JSON','response_type':_0xf8a4('0x21'),'rest_data':JSON[_0xf8a4('0x27')]({'session':_0x1ad608['id'],'module_name':'Employees','query':util[_0xf8a4('0x23')](_0xf8a4('0x2a'),_0x486989),'order_by':'','offset':'0','select_fields':['id','name',_0xf8a4('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x58e663){if(_0x58e663[_0xf8a4('0x2c')][_0xf8a4('0x1c')]){var _0x8b1d20=_[_0xf8a4('0x2d')](_0x58e663[_0xf8a4('0x2c')],function(_0x45c636){return _0x45c636['name_value_list']['user_name'][_0xf8a4('0x2e')]===_0x486989;});if(_0x8b1d20){logger['info'](_0xf8a4('0x2f'));return BPromise['resolve']({'id':_0x8b1d20['name_value_list']['id']['value'],'name':_0x8b1d20['name_value_list'][_0xf8a4('0x10')][_0xf8a4('0x2e')]});}}logger[_0xf8a4('0xe')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x1ad608[_0xf8a4('0x30')][_0xf8a4('0x31')][_0xf8a4('0x2e')],'name':_0x1ad608[_0xf8a4('0x30')][_0xf8a4('0x2b')][_0xf8a4('0x2e')]});});}else{logger[_0xf8a4('0xe')](_0xf8a4('0x32'));return BPromise[_0xf8a4('0x33')]({'id':_0x1ad608[_0xf8a4('0x30')]['user_id'][_0xf8a4('0x2e')],'name':_0x1ad608[_0xf8a4('0x30')][_0xf8a4('0x2b')][_0xf8a4('0x2e')]});}}function getEndUser(_0x34bd3e,_0x59935a,_0x30b626,_0x29e0ee){logger[_0xf8a4('0xe')](_0xf8a4('0x34'),_0x30b626);return request({'form':{'method':_0xf8a4('0x29'),'input_type':_0xf8a4('0x21'),'response_type':_0xf8a4('0x21'),'rest_data':JSON['stringify']({'session':_0x29e0ee['id'],'module_name':_0xf8a4('0x1a'),'query':util[_0xf8a4('0x23')](_0xf8a4('0x35'),_0x30b626),'order_by':'','offset':'0','select_fields':['id',_0xf8a4('0x10'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf8a4('0x36')](function(_0x1e552b){if(_0x1e552b[_0xf8a4('0x2c')][_0xf8a4('0x1c')]){var _0xd895=_[_0xf8a4('0x2d')](_0x1e552b['entry_list'],function(_0x2d8ae0){return _0x2d8ae0[_0xf8a4('0x30')]['phone_home']['value']===_0x30b626;});if(_0xd895){logger['info'](_0xf8a4('0x37'));return BPromise['resolve']({'id':_0xd895['name_value_list']['id'][_0xf8a4('0x2e')],'name':_0xd895['name_value_list'][_0xf8a4('0x10')]['value'],'phone':_0xd895[_0xf8a4('0x30')][_0xf8a4('0x38')]['value']});}}else{logger['info'](_0xf8a4('0x39'));return request({'form':{'method':_0xf8a4('0x20'),'input_type':_0xf8a4('0x21'),'response_type':_0xf8a4('0x21'),'rest_data':JSON[_0xf8a4('0x27')]({'session':_0x29e0ee['id'],'module_name':_0xf8a4('0x1a'),'name_value_list':[{'name':_0xf8a4('0x3a'),'value':_0x59935a!==_0xf8a4('0x3b')?_0x59935a:util[_0xf8a4('0x23')](_0xf8a4('0x3c'),_0x30b626)},{'name':'phone_home','value':_0x30b626}]})}})[_0xf8a4('0x36')](function(_0x17632e){logger['info']('Enduser\x20created.');return BPromise[_0xf8a4('0x33')]({'id':_0x17632e['id'],'name':_0x17632e[_0xf8a4('0x2c')]['first_name'][_0xf8a4('0x2e')],'phone':_0x17632e[_0xf8a4('0x2c')][_0xf8a4('0x38')][_0xf8a4('0x2e')]});});}});}function request(_0x631cbe){logger[_0xf8a4('0x3d')](_0xf8a4('0x3e'),JSON[_0xf8a4('0x27')](_0x631cbe));return rp(_[_0xf8a4('0x3f')](def,_0x631cbe));}function getTags(_0x67367f,_0x43dcb3){var _0x263bba=[];if(_0x67367f&&_0x67367f[_0xf8a4('0x1c')]>0x0){_0x263bba=_[_0xf8a4('0x40')](_0x67367f,_0x43dcb3);}return _0x263bba;}function getCustomFields(_0x168f97,_0x5c8a36){var _0x152943=[];var _0x16524b={'custom_fields':[]};if(_0x168f97[_0xf8a4('0x1c')]>0x0){_[_0xf8a4('0x41')](_0x168f97,function(_0x2e9a26){if(_0x2e9a26['type']===_0xf8a4('0x42')&&_0x2e9a26['nameField']&&!_0x2e9a26[_0xf8a4('0x43')]){_0x16524b[_0x2e9a26[_0xf8a4('0x44')]['toLowerCase']()]=_0x2e9a26[_0xf8a4('0x45')][_0xf8a4('0x25')]();}else if(_0x2e9a26[_0xf8a4('0x46')]==='string'&&_0x2e9a26[_0xf8a4('0x1e')]&&_0x2e9a26[_0xf8a4('0x43')]){_0x16524b[_0xf8a4('0x47')][_0xf8a4('0x1d')]({'id':_0x2e9a26[_0xf8a4('0x1e')],'value':_0x2e9a26['content'][_0xf8a4('0x25')]()});}else if(_0x2e9a26[_0xf8a4('0x46')]===_0xf8a4('0x48')&&_0x2e9a26[_0xf8a4('0x1f')]&&_0x2e9a26[_0xf8a4('0x1e')]&&_0x2e9a26['customField']){_0x5c8a36[_0x2e9a26['variableName']]&&_0x16524b[_0xf8a4('0x47')]['push']({'id':_0x2e9a26['idField'],'value':_0x5c8a36[_0x2e9a26[_0xf8a4('0x1f')]][_0xf8a4('0x25')]()});}else if(_0x2e9a26['type']===_0xf8a4('0x49')&&_0x2e9a26['Variable']&&_0x2e9a26[_0xf8a4('0x4a')]['name']&&_0x2e9a26[_0xf8a4('0x1e')]&&_0x2e9a26[_0xf8a4('0x43')]){_0x5c8a36[_0x2e9a26[_0xf8a4('0x4a')][_0xf8a4('0x10')][_0xf8a4('0x4b')]()]&&_0x16524b[_0xf8a4('0x47')][_0xf8a4('0x1d')]({'id':_0x2e9a26[_0xf8a4('0x1e')],'value':_0x5c8a36[_0x2e9a26[_0xf8a4('0x4a')]['name']['toLowerCase']()][_0xf8a4('0x25')]()});}});}return _0x16524b;}function getConnection(_0x2036dd){return request({'method':'POST','form':{'method':_0xf8a4('0x4c'),'input_type':'JSON','response_type':_0xf8a4('0x21'),'rest_data':JSON[_0xf8a4('0x27')]({'user_auth':{'user_name':_0x2036dd[_0xf8a4('0x4d')],'password':_0x2036dd['password'],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xf8a4('0x36')](function(_0x4415f8){var _0x5a615e=_0x4415f8;if(_0x5a615e['id']){def[_0xf8a4('0x4e')]=_0x5a615e['id'];return BPromise[_0xf8a4('0x33')](_0x5a615e);}else{throw new Error(util[_0xf8a4('0x23')]('Account\x20%d\x20is\x20not\x20valid',_0x2036dd['id']));}});}function setRelationship(_0x332bd1,_0x228f8c,_0x31fc3e,_0x1bfe24){return request({'form':{'method':_0xf8a4('0x4f'),'input_type':_0xf8a4('0x21'),'response_type':_0xf8a4('0x21'),'rest_data':JSON['stringify']({'session':_0x332bd1['id'],'module_name':_0xf8a4('0x22'),'module_id':_0x31fc3e['id'],'link_field_name':_0x1bfe24,'related_ids':[_0x228f8c['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf8a4('0x50')]=function(_0x34dabf,_0x2fd264,_0x33fe98,_0x4ad89c,_0x430bbb,_0xcfeb64){var _0x20987c,_0x1a58ed,_0x19e6dd,_0x4b731b;_0xcfeb64['remoteUri']=intUtil[_0xf8a4('0x51')](_0xcfeb64[_0xf8a4('0x52')]);_0xcfeb64[_0xf8a4('0x53')]=intUtil[_0xf8a4('0x51')](_0xcfeb64['serverUrl']);def[_0xf8a4('0x54')]=util[_0xf8a4('0x23')](_0xf8a4('0x55'),_0xcfeb64[_0xf8a4('0x52')]);if(_0x430bbb&&_0x430bbb[_0xf8a4('0x56')]){logger[_0xf8a4('0xe')](_0xf8a4('0x57'),'Recording\x20is\x20enabled!');_0x2fd264[_0xf8a4('0x58')]=util[_0xf8a4('0x23')](_0xf8a4('0x59'),_0xcfeb64[_0xf8a4('0x53')],_0x2fd264[_0xf8a4('0x5a')],md5(_0x2fd264[_0xf8a4('0x5a')]));}else{_0x2fd264[_0xf8a4('0x58')]='';}return getConnection(_0xcfeb64)[_0xf8a4('0x36')](function(_0x167d41){_0x4b731b=_0x167d41;return getUser(_0xcfeb64,_0x4ad89c['name'],_0x4b731b);})[_0xf8a4('0x36')](function(_0x76bacd){_0x20987c=_0x76bacd;logger[_0xf8a4('0xe')](_0xf8a4('0x5b'),_0x20987c['id']);return getEndUser(_0xcfeb64,_0x2fd264[_0xf8a4('0x5c')],_0x2fd264[_0xf8a4('0x5d')],_0x4b731b);})[_0xf8a4('0x36')](function(_0x26e522){_0x1a58ed=_0x26e522;logger[_0xf8a4('0xe')](_0xf8a4('0x5e'),_0x1a58ed['id']);return getTicket(_0xcfeb64,_0x20987c,_0x1a58ed,_0x33fe98,_0x2fd264,_0x33fe98[_0xf8a4('0x5f')],_0x4b731b,_0xf8a4('0x60'));})[_0xf8a4('0x36')](function(_0x57fc32){_0x19e6dd=_0x57fc32;logger['info'](_0xf8a4('0x61'));logger[_0xf8a4('0xe')](_0xf8a4('0x62'),_0x19e6dd['id']);return setRelationship(_0x4b731b,_0x20987c,_0x19e6dd,_0xf8a4('0x63'));})['then'](function(){return setRelationship(_0x4b731b,_0x1a58ed,_0x19e6dd,_0xf8a4('0x64'));})['then'](function(){return getServerInfo(_0x4b731b);})['then'](function(_0x1f58ce){var _0x5ad497=parseInt(_0x1f58ce[_0xf8a4('0x65')][_0xf8a4('0x66')](0x0));var _0x34b2be=util[_0xf8a4('0x23')](_0xf8a4('0x67'),_0xcfeb64['remoteUri'],_0x19e6dd['id']);if(_0x5ad497>0x6){_0x34b2be=util[_0xf8a4('0x23')](_0xf8a4('0x68'),_0xcfeb64[_0xf8a4('0x52')],_0x19e6dd['id']);}logger[_0xf8a4('0xe')](_0xf8a4('0x57'),_0xf8a4('0x69'));emit(util[_0xf8a4('0x23')](_0xf8a4('0x6a'),_0x4ad89c[_0xf8a4('0x10')]),_0xf8a4('0x6b'),{'uri':_0x34b2be});})[_0xf8a4('0x6c')](function(_0x36d029){logger['error'](_0xf8a4('0x57'),JSON['stringify'](_0x36d029));});};exports[_0xf8a4('0x6d')]=function(_0xa4c5ae,_0x5cdb49,_0xe5242a,_0x1cdfe8,_0x5857a2,_0x3438b2,_0x50f296){var _0x1649ba,_0x59bb4e,_0x40b8f9,_0x93e609;_0x3438b2[_0xf8a4('0x52')]=intUtil['stripTrailingSlash'](_0x3438b2['remoteUri']);_0x3438b2[_0xf8a4('0x53')]=intUtil['stripTrailingSlash'](_0x3438b2[_0xf8a4('0x53')]);def[_0xf8a4('0x54')]=util[_0xf8a4('0x23')](_0xf8a4('0x55'),_0x3438b2[_0xf8a4('0x52')]);if(_0x50f296&&_0x50f296[_0xf8a4('0x6e')]&&_0x50f296[_0xf8a4('0x6e')]!=='none'){logger['info'](_0xf8a4('0x6f'),_0xf8a4('0x70'));_0x5cdb49[_0xf8a4('0x58')]=util[_0xf8a4('0x23')](_0xf8a4('0x59'),_0x3438b2['serverUrl'],_0x5cdb49['uniqueid'],md5(_0x5cdb49[_0xf8a4('0x5a')]));}return getConnection(_0x3438b2)[_0xf8a4('0x36')](function(_0x2f842c){_0x93e609=_0x2f842c;return getUser(_0x3438b2,_0x1cdfe8['name'],_0x93e609);})[_0xf8a4('0x36')](function(_0x581690){_0x1649ba=_0x581690;logger[_0xf8a4('0xe')](_0xf8a4('0x5b'),_0x1649ba['id']);return getEndUser(_0x3438b2,_0x5cdb49['destcalleridname'],_0x5cdb49[_0xf8a4('0x71')],_0x93e609);})[_0xf8a4('0x36')](function(_0x264ecc){_0x59bb4e=_0x264ecc;logger[_0xf8a4('0xe')](_0xf8a4('0x5e'),_0x59bb4e['id']);return getTicket(_0x3438b2,_0x1649ba,_0x59bb4e,_0xe5242a,_0x5cdb49,_0xe5242a['Fields'],_0x93e609,_0xf8a4('0x72'));})[_0xf8a4('0x36')](function(_0x247805){_0x40b8f9=_0x247805;logger[_0xf8a4('0xe')](_0xf8a4('0x61'));logger[_0xf8a4('0xe')](_0xf8a4('0x62'),_0x40b8f9['id']);return setRelationship(_0x93e609,_0x1649ba,_0x40b8f9,'users');})[_0xf8a4('0x36')](function(){return setRelationship(_0x93e609,_0x59bb4e,_0x40b8f9,'contacts');})[_0xf8a4('0x36')](function(){return getServerInfo(_0x93e609);})[_0xf8a4('0x36')](function(_0x134242){var _0x542025=parseInt(_0x134242['version'][_0xf8a4('0x66')](0x0));var _0x2c17b3=util[_0xf8a4('0x23')](_0xf8a4('0x67'),_0x3438b2[_0xf8a4('0x52')],_0x40b8f9['id']);if(_0x542025>0x6){_0x2c17b3=util[_0xf8a4('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x3438b2[_0xf8a4('0x52')],_0x40b8f9['id']);}logger['info'](_0xf8a4('0x6f'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf8a4('0x23')](_0xf8a4('0x6a'),_0x1cdfe8[_0xf8a4('0x10')]),_0xf8a4('0x6b'),{'uri':_0x2c17b3});})['catch'](function(_0x497d6a){logger['error']('[OUTBOUND]',JSON[_0xf8a4('0x27')](_0x497d6a));});};exports[_0xf8a4('0x73')]=function(_0x451496,_0x357a20,_0x16e9a4,_0x307bc8,_0xa13670,_0x5beff4){var _0x51e038,_0x1ffce8,_0x427447,_0x4e3cd7;_0x5beff4[_0xf8a4('0x52')]=intUtil['stripTrailingSlash'](_0x5beff4[_0xf8a4('0x52')]);_0x5beff4[_0xf8a4('0x53')]=intUtil['stripTrailingSlash'](_0x5beff4[_0xf8a4('0x53')]);def['uri']=util[_0xf8a4('0x23')]('%s/service/v4_1/rest.php',_0x5beff4[_0xf8a4('0x52')]);if(_0xa13670&&_0xa13670[_0xf8a4('0x56')]){logger[_0xf8a4('0xe')]('['+_0x357a20[_0xf8a4('0x74')][_0xf8a4('0x75')]()+']',_0xf8a4('0x70'));_0x357a20[_0xf8a4('0x58')]=util[_0xf8a4('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5beff4[_0xf8a4('0x53')],_0x357a20['uniqueid'],md5(_0x357a20[_0xf8a4('0x5a')]));}else{_0x357a20[_0xf8a4('0x58')]='';}return getConnection(_0x5beff4)[_0xf8a4('0x36')](function(_0x6ef63d){_0x4e3cd7=_0x6ef63d;if(!_[_0xf8a4('0x28')](_0x307bc8)){return getUser(_0x5beff4,_0x307bc8[_0xf8a4('0x10')],_0x4e3cd7);}else{return getUser(_0x5beff4,null,_0x4e3cd7);}})[_0xf8a4('0x36')](function(_0x28b5bb){_0x51e038=_0x28b5bb;logger[_0xf8a4('0xe')](_0xf8a4('0x5b'),_0x51e038['id']);return getEndUser(_0x5beff4,_0x357a20[_0xf8a4('0x5c')],_0x357a20[_0xf8a4('0x5d')],_0x4e3cd7);})['then'](function(_0x3b2abe){_0x1ffce8=_0x3b2abe;logger[_0xf8a4('0xe')](_0xf8a4('0x5e'),_0x1ffce8['id']);return getTicket(_0x5beff4,_0x51e038,_0x1ffce8,_0x16e9a4,_0x357a20,_0x16e9a4['Fields'],_0x4e3cd7,_0xf8a4('0x60'));})['then'](function(_0x105d57){_0x427447=_0x105d57;logger[_0xf8a4('0xe')](_0xf8a4('0x61'));logger[_0xf8a4('0xe')](_0xf8a4('0x62'),_0x427447['id']);return setRelationship(_0x4e3cd7,_0x51e038,_0x427447,_0xf8a4('0x63'));})['then'](function(){return setRelationship(_0x4e3cd7,_0x1ffce8,_0x427447,_0xf8a4('0x64'));})[_0xf8a4('0x36')](function(){return getServerInfo(_0x4e3cd7);})[_0xf8a4('0x6c')](function(_0x225b8c){logger[_0xf8a4('0x76')]('['+_0x357a20[_0xf8a4('0x74')][_0xf8a4('0x75')]()+']',JSON[_0xf8a4('0x27')](_0x225b8c));});}; \ No newline at end of file +var _0x6c2f=['base64','get_server_info','isNil','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','phone_home','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','type','string','customField','nameField','idField','custom_fields','content','customVariable','Variable','toLowerCase','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Inbound','Ticket\x20created!','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','trigger:browser:url','catch','error','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','Outbound','users','unmanaged','lastevent','toUpperCase','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','request-promise','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','emit','info','name','getString','Subjects','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString'];(function(_0xdd0574,_0x36e890){var _0x10018b=function(_0x2bcd01){while(--_0x2bcd01){_0xdd0574['push'](_0xdd0574['shift']());}};_0x10018b(++_0x36e890);}(_0x6c2f,0xc0));var _0xf6c2=function(_0x3d02f2,_0x4931d6){_0x3d02f2=_0x3d02f2-0x0;var _0x206194=_0x6c2f[_0x3d02f2];return _0x206194;};'use strict';var _=require('lodash');var rp=require(_0xf6c2('0x0'));var BPromise=require('bluebird');var md5=require('md5');var util=require(_0xf6c2('0x1'));var Redis=require(_0xf6c2('0x2'));var intUtil=require(_0xf6c2('0x3'));var config=require(_0xf6c2('0x4'));var logger=require('../../../../config/logger')(_0xf6c2('0x5'));config[_0xf6c2('0x6')]=_['defaults'](config['redis'],{'host':_0xf6c2('0x7'),'port':0x18eb});var io=require(_0xf6c2('0x8'))(new Redis(config[_0xf6c2('0x6')]));var def={'method':'POST','json':!![]};function emit(_0x1bdf06,_0x53bdaa,_0x120e85){io['to'](_0x1bdf06)[_0xf6c2('0x9')](_0x53bdaa,_0x120e85);}function getTicket(_0xc83aa0,_0x4d77da,_0x3c4fc7,_0x14fc25,_0xdfbd9d,_0x535baf,_0x53f648,_0x53efb6){logger[_0xf6c2('0xa')]('Creating\x20new\x20ticket...');var _0x14aad0=new Date();var _0x5b47eb=[{'name':_0xf6c2('0xb'),'value':intUtil[_0xf6c2('0xc')](_0x14fc25[_0xf6c2('0xd')],_0xdfbd9d,'\x20')},{'name':'assigned_user_id','value':_0x4d77da['id']},{'name':'created_by','value':_0x4d77da['id']},{'name':_0xf6c2('0xe'),'value':intUtil[_0xf6c2('0xc')](_0x14fc25[_0xf6c2('0xf')],_0xdfbd9d,'\x0a')},{'name':'date_start','value':_0x14aad0[_0xf6c2('0x10')]()[_0xf6c2('0x11')](0x0,0x13)[_0xf6c2('0x12')]('T','\x20')},{'name':_0xf6c2('0x13'),'value':'0'},{'name':_0xf6c2('0x14'),'value':'15'},{'name':_0xf6c2('0x15'),'value':_0x3c4fc7['id']},{'name':'parent_type','value':_0xf6c2('0x16')},{'name':_0xf6c2('0x17'),'value':_0x3c4fc7['name']},{'name':_0xf6c2('0x18'),'value':_0x53efb6}];if(_0x535baf[_0xf6c2('0x19')]){_[_0xf6c2('0x1a')](_0x535baf,function(_0x588c7c){if(_0xdfbd9d[_0x588c7c[_0xf6c2('0x1b')]]){_0x5b47eb[_0xf6c2('0x1c')]({'name':_0x588c7c['idField'],'value':_0xdfbd9d[_0x588c7c[_0xf6c2('0x1b')]]});}});}return request({'form':{'method':_0xf6c2('0x1d'),'input_type':_0xf6c2('0x1e'),'response_type':'JSON','rest_data':JSON[_0xf6c2('0x1f')]({'session':_0x53f648['id'],'module_name':_0xf6c2('0x20'),'name_value_list':_0x5b47eb})}});}function getAuth(_0x55fa20){return util[_0xf6c2('0x21')](_0xf6c2('0x22'),new Buffer(_0x55fa20['apiKey']+':X')[_0xf6c2('0x23')](_0xf6c2('0x24')));}function getServerInfo(_0xab9923){return request({'form':{'method':_0xf6c2('0x25'),'input_type':'JSON','response_type':_0xf6c2('0x1e'),'rest_data':JSON[_0xf6c2('0x1f')]({'session':_0xab9923['id']})}});}function getUser(_0x260b5f,_0x588213,_0x32e9f7){if(!_[_0xf6c2('0x26')](_0x588213)){logger[_0xf6c2('0xa')]('Getting\x20agent\x20with\x20name',_0x588213);return request({'form':{'method':_0xf6c2('0x27'),'input_type':_0xf6c2('0x1e'),'response_type':_0xf6c2('0x1e'),'rest_data':JSON[_0xf6c2('0x1f')]({'session':_0x32e9f7['id'],'module_name':_0xf6c2('0x28'),'query':util[_0xf6c2('0x21')](_0xf6c2('0x29'),_0x588213),'order_by':'','offset':'0','select_fields':['id',_0xf6c2('0xb'),_0xf6c2('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6c2('0x2b')](function(_0x49dcfb){if(_0x49dcfb[_0xf6c2('0x2c')]['length']){var _0x2f00dc=_[_0xf6c2('0x2d')](_0x49dcfb[_0xf6c2('0x2c')],function(_0xcee292){return _0xcee292[_0xf6c2('0x2e')][_0xf6c2('0x2a')][_0xf6c2('0x2f')]===_0x588213;});if(_0x2f00dc){logger[_0xf6c2('0xa')](_0xf6c2('0x30'));return BPromise[_0xf6c2('0x31')]({'id':_0x2f00dc[_0xf6c2('0x2e')]['id'][_0xf6c2('0x2f')],'name':_0x2f00dc['name_value_list'][_0xf6c2('0xb')]['value']});}}logger[_0xf6c2('0xa')](_0xf6c2('0x32'));return BPromise[_0xf6c2('0x31')]({'id':_0x32e9f7['name_value_list']['user_id'][_0xf6c2('0x2f')],'name':_0x32e9f7['name_value_list'][_0xf6c2('0x2a')][_0xf6c2('0x2f')]});});}else{logger[_0xf6c2('0xa')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0xf6c2('0x31')]({'id':_0x32e9f7[_0xf6c2('0x2e')][_0xf6c2('0x33')][_0xf6c2('0x2f')],'name':_0x32e9f7[_0xf6c2('0x2e')][_0xf6c2('0x2a')][_0xf6c2('0x2f')]});}}function getEndUser(_0x5834bd,_0x43b8c7,_0x3458c1,_0x5a5c6f){logger['info'](_0xf6c2('0x34'),_0x3458c1);return request({'form':{'method':_0xf6c2('0x27'),'input_type':_0xf6c2('0x1e'),'response_type':_0xf6c2('0x1e'),'rest_data':JSON[_0xf6c2('0x1f')]({'session':_0x5a5c6f['id'],'module_name':_0xf6c2('0x16'),'query':util[_0xf6c2('0x21')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x3458c1),'order_by':'','offset':'0','select_fields':['id',_0xf6c2('0xb'),_0xf6c2('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6c2('0x2b')](function(_0x100a70){if(_0x100a70[_0xf6c2('0x2c')][_0xf6c2('0x19')]){var _0x5272e8=_[_0xf6c2('0x2d')](_0x100a70[_0xf6c2('0x2c')],function(_0x49c54f){return _0x49c54f[_0xf6c2('0x2e')][_0xf6c2('0x35')]['value']===_0x3458c1;});if(_0x5272e8){logger[_0xf6c2('0xa')]('Enduser\x20found!');return BPromise[_0xf6c2('0x31')]({'id':_0x5272e8[_0xf6c2('0x2e')]['id'][_0xf6c2('0x2f')],'name':_0x5272e8[_0xf6c2('0x2e')][_0xf6c2('0xb')][_0xf6c2('0x2f')],'phone':_0x5272e8[_0xf6c2('0x2e')][_0xf6c2('0x35')][_0xf6c2('0x2f')]});}}else{logger['info'](_0xf6c2('0x36'));return request({'form':{'method':_0xf6c2('0x1d'),'input_type':_0xf6c2('0x1e'),'response_type':_0xf6c2('0x1e'),'rest_data':JSON[_0xf6c2('0x1f')]({'session':_0x5a5c6f['id'],'module_name':_0xf6c2('0x16'),'name_value_list':[{'name':_0xf6c2('0x37'),'value':_0x43b8c7!==_0xf6c2('0x38')?_0x43b8c7:util['format']('Caller\x20-\x20%s',_0x3458c1)},{'name':_0xf6c2('0x35'),'value':_0x3458c1}]})}})[_0xf6c2('0x2b')](function(_0x52f76b){logger[_0xf6c2('0xa')](_0xf6c2('0x39'));return BPromise['resolve']({'id':_0x52f76b['id'],'name':_0x52f76b[_0xf6c2('0x2c')]['first_name'][_0xf6c2('0x2f')],'phone':_0x52f76b[_0xf6c2('0x2c')][_0xf6c2('0x35')][_0xf6c2('0x2f')]});});}});}function request(_0x23226a){logger[_0xf6c2('0x3a')](_0xf6c2('0x3b'),JSON[_0xf6c2('0x1f')](_0x23226a));return rp(_[_0xf6c2('0x3c')](def,_0x23226a));}function getTags(_0x1c9ccb,_0x1cff02){var _0x145d4a=[];if(_0x1c9ccb&&_0x1c9ccb['length']>0x0){_0x145d4a=_['map'](_0x1c9ccb,_0x1cff02);}return _0x145d4a;}function getCustomFields(_0x3e9ce9,_0x31312b){var _0x43d76c=[];var _0x5e0fb4={'custom_fields':[]};if(_0x3e9ce9[_0xf6c2('0x19')]>0x0){_[_0xf6c2('0x1a')](_0x3e9ce9,function(_0x4b9ffc){if(_0x4b9ffc[_0xf6c2('0x3d')]===_0xf6c2('0x3e')&&_0x4b9ffc['nameField']&&!_0x4b9ffc[_0xf6c2('0x3f')]){_0x5e0fb4[_0x4b9ffc[_0xf6c2('0x40')]['toLowerCase']()]=_0x4b9ffc['content'][_0xf6c2('0x23')]();}else if(_0x4b9ffc[_0xf6c2('0x3d')]===_0xf6c2('0x3e')&&_0x4b9ffc[_0xf6c2('0x41')]&&_0x4b9ffc[_0xf6c2('0x3f')]){_0x5e0fb4[_0xf6c2('0x42')][_0xf6c2('0x1c')]({'id':_0x4b9ffc[_0xf6c2('0x41')],'value':_0x4b9ffc[_0xf6c2('0x43')]['toString']()});}else if(_0x4b9ffc[_0xf6c2('0x3d')]==='variable'&&_0x4b9ffc[_0xf6c2('0x1b')]&&_0x4b9ffc['idField']&&_0x4b9ffc[_0xf6c2('0x3f')]){_0x31312b[_0x4b9ffc[_0xf6c2('0x1b')]]&&_0x5e0fb4[_0xf6c2('0x42')][_0xf6c2('0x1c')]({'id':_0x4b9ffc[_0xf6c2('0x41')],'value':_0x31312b[_0x4b9ffc[_0xf6c2('0x1b')]]['toString']()});}else if(_0x4b9ffc['type']===_0xf6c2('0x44')&&_0x4b9ffc['Variable']&&_0x4b9ffc['Variable'][_0xf6c2('0xb')]&&_0x4b9ffc['idField']&&_0x4b9ffc[_0xf6c2('0x3f')]){_0x31312b[_0x4b9ffc[_0xf6c2('0x45')][_0xf6c2('0xb')][_0xf6c2('0x46')]()]&&_0x5e0fb4[_0xf6c2('0x42')][_0xf6c2('0x1c')]({'id':_0x4b9ffc[_0xf6c2('0x41')],'value':_0x31312b[_0x4b9ffc[_0xf6c2('0x45')][_0xf6c2('0xb')]['toLowerCase']()][_0xf6c2('0x23')]()});}});}return _0x5e0fb4;}function getConnection(_0x5ca77e){return request({'method':_0xf6c2('0x47'),'form':{'method':_0xf6c2('0x48'),'input_type':_0xf6c2('0x1e'),'response_type':_0xf6c2('0x1e'),'rest_data':JSON[_0xf6c2('0x1f')]({'user_auth':{'user_name':_0x5ca77e[_0xf6c2('0x49')],'password':_0x5ca77e[_0xf6c2('0x4a')],'encryption':_0xf6c2('0x4b')},'application':_0xf6c2('0x4c')})}})['then'](function(_0x4d9ced){var _0x5a72cf=_0x4d9ced;if(_0x5a72cf['id']){def[_0xf6c2('0x4d')]=_0x5a72cf['id'];return BPromise['resolve'](_0x5a72cf);}else{throw new Error(util[_0xf6c2('0x21')]('Account\x20%d\x20is\x20not\x20valid',_0x5ca77e['id']));}});}function setRelationship(_0x4f9218,_0x29772b,_0x5ab15a,_0x4a2d53){return request({'form':{'method':_0xf6c2('0x4e'),'input_type':_0xf6c2('0x1e'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4f9218['id'],'module_name':_0xf6c2('0x20'),'module_id':_0x5ab15a['id'],'link_field_name':_0x4a2d53,'related_ids':[_0x29772b['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x3b7381,_0x238339,_0x43009e,_0x305339,_0x1f82d3,_0x1c5848){var _0x5995fc,_0x54bf07,_0x28a377,_0x5c3777;_0x1c5848['remoteUri']=intUtil[_0xf6c2('0x4f')](_0x1c5848[_0xf6c2('0x50')]);_0x1c5848[_0xf6c2('0x51')]=intUtil[_0xf6c2('0x4f')](_0x1c5848['serverUrl']);def[_0xf6c2('0x52')]=util[_0xf6c2('0x21')](_0xf6c2('0x53'),_0x1c5848[_0xf6c2('0x50')]);if(_0x1f82d3&&_0x1f82d3[_0xf6c2('0x54')]){logger[_0xf6c2('0xa')](_0xf6c2('0x55'),_0xf6c2('0x56'));_0x238339[_0xf6c2('0x57')]=util[_0xf6c2('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1c5848[_0xf6c2('0x51')],_0x238339[_0xf6c2('0x58')],md5(_0x238339[_0xf6c2('0x58')]));}else{_0x238339[_0xf6c2('0x57')]='';}return getConnection(_0x1c5848)['then'](function(_0xee0d02){_0x5c3777=_0xee0d02;return getUser(_0x1c5848,_0x305339[_0xf6c2('0xb')],_0x5c3777);})['then'](function(_0x6dba10){_0x5995fc=_0x6dba10;logger[_0xf6c2('0xa')](_0xf6c2('0x59'),_0x5995fc['id']);return getEndUser(_0x1c5848,_0x238339[_0xf6c2('0x5a')],_0x238339[_0xf6c2('0x5b')],_0x5c3777);})[_0xf6c2('0x2b')](function(_0x41f94e){_0x54bf07=_0x41f94e;logger['info']('The\x20Enduser\x20ID\x20is:',_0x54bf07['id']);return getTicket(_0x1c5848,_0x5995fc,_0x54bf07,_0x43009e,_0x238339,_0x43009e[_0xf6c2('0x5c')],_0x5c3777,_0xf6c2('0x5d'));})['then'](function(_0x2a186d){_0x28a377=_0x2a186d;logger[_0xf6c2('0xa')](_0xf6c2('0x5e'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x28a377['id']);return setRelationship(_0x5c3777,_0x5995fc,_0x28a377,'users');})[_0xf6c2('0x2b')](function(){return setRelationship(_0x5c3777,_0x54bf07,_0x28a377,_0xf6c2('0x5f'));})['then'](function(){return getServerInfo(_0x5c3777);})['then'](function(_0xe94f4a){var _0x403d8a=parseInt(_0xe94f4a[_0xf6c2('0x60')]['charAt'](0x0));var _0x1c7cff=util['format'](_0xf6c2('0x61'),_0x1c5848[_0xf6c2('0x50')],_0x28a377['id']);if(_0x403d8a>0x6){_0x1c7cff=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x1c5848[_0xf6c2('0x50')],_0x28a377['id']);}logger[_0xf6c2('0xa')](_0xf6c2('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6c2('0x21')](_0xf6c2('0x62'),_0x305339[_0xf6c2('0xb')]),_0xf6c2('0x63'),{'uri':_0x1c7cff});})[_0xf6c2('0x64')](function(_0x5d1b2f){logger[_0xf6c2('0x65')](_0xf6c2('0x55'),JSON[_0xf6c2('0x1f')](_0x5d1b2f));});};exports['outbound']=function(_0x409767,_0x1f7973,_0x54c7df,_0x403b7d,_0x462d54,_0x383089,_0x45be6d){var _0x27aa57,_0x4b2dfc,_0x2409c8,_0x3dde35;_0x383089[_0xf6c2('0x50')]=intUtil['stripTrailingSlash'](_0x383089[_0xf6c2('0x50')]);_0x383089[_0xf6c2('0x51')]=intUtil['stripTrailingSlash'](_0x383089[_0xf6c2('0x51')]);def['uri']=util['format'](_0xf6c2('0x53'),_0x383089['remoteUri']);if(_0x45be6d&&_0x45be6d[_0xf6c2('0x66')]&&_0x45be6d[_0xf6c2('0x66')]!==_0xf6c2('0x67')){logger[_0xf6c2('0xa')](_0xf6c2('0x68'),'Recording\x20is\x20enabled!');_0x1f7973[_0xf6c2('0x57')]=util[_0xf6c2('0x21')](_0xf6c2('0x69'),_0x383089['serverUrl'],_0x1f7973[_0xf6c2('0x58')],md5(_0x1f7973['uniqueid']));}return getConnection(_0x383089)[_0xf6c2('0x2b')](function(_0x5d7958){_0x3dde35=_0x5d7958;return getUser(_0x383089,_0x403b7d[_0xf6c2('0xb')],_0x3dde35);})[_0xf6c2('0x2b')](function(_0x5af4cc){_0x27aa57=_0x5af4cc;logger[_0xf6c2('0xa')](_0xf6c2('0x59'),_0x27aa57['id']);return getEndUser(_0x383089,_0x1f7973[_0xf6c2('0x6a')],_0x1f7973['destcalleridnum'],_0x3dde35);})[_0xf6c2('0x2b')](function(_0x4cd89a){_0x4b2dfc=_0x4cd89a;logger[_0xf6c2('0xa')]('The\x20Enduser\x20ID\x20is:',_0x4b2dfc['id']);return getTicket(_0x383089,_0x27aa57,_0x4b2dfc,_0x54c7df,_0x1f7973,_0x54c7df[_0xf6c2('0x5c')],_0x3dde35,_0xf6c2('0x6b'));})[_0xf6c2('0x2b')](function(_0x77e2db){_0x2409c8=_0x77e2db;logger[_0xf6c2('0xa')](_0xf6c2('0x5e'));logger[_0xf6c2('0xa')]('The\x20Ticket\x20ID\x20is:',_0x2409c8['id']);return setRelationship(_0x3dde35,_0x27aa57,_0x2409c8,_0xf6c2('0x6c'));})[_0xf6c2('0x2b')](function(){return setRelationship(_0x3dde35,_0x4b2dfc,_0x2409c8,'contacts');})['then'](function(){return getServerInfo(_0x3dde35);})[_0xf6c2('0x2b')](function(_0x502eab){var _0x37c475=parseInt(_0x502eab[_0xf6c2('0x60')]['charAt'](0x0));var _0x48ff89=util[_0xf6c2('0x21')](_0xf6c2('0x61'),_0x383089['remoteUri'],_0x2409c8['id']);if(_0x37c475>0x6){_0x48ff89=util[_0xf6c2('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x383089[_0xf6c2('0x50')],_0x2409c8['id']);}logger[_0xf6c2('0xa')](_0xf6c2('0x68'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf6c2('0x21')](_0xf6c2('0x62'),_0x403b7d[_0xf6c2('0xb')]),_0xf6c2('0x63'),{'uri':_0x48ff89});})[_0xf6c2('0x64')](function(_0x364ca2){logger[_0xf6c2('0x65')](_0xf6c2('0x68'),JSON[_0xf6c2('0x1f')](_0x364ca2));});};exports[_0xf6c2('0x6d')]=function(_0xd6c7dc,_0x54ebd3,_0x677bc5,_0x3ee8cf,_0xf81bc8,_0x1da760){var _0x595375,_0x2f64b5,_0x566c17,_0x2ec13a;_0x1da760[_0xf6c2('0x50')]=intUtil[_0xf6c2('0x4f')](_0x1da760[_0xf6c2('0x50')]);_0x1da760[_0xf6c2('0x51')]=intUtil[_0xf6c2('0x4f')](_0x1da760['serverUrl']);def[_0xf6c2('0x52')]=util[_0xf6c2('0x21')]('%s/service/v4_1/rest.php',_0x1da760[_0xf6c2('0x50')]);if(_0xf81bc8&&_0xf81bc8[_0xf6c2('0x54')]){logger[_0xf6c2('0xa')]('['+_0x54ebd3[_0xf6c2('0x6e')][_0xf6c2('0x6f')]()+']','Recording\x20is\x20enabled!');_0x54ebd3['recordingURL']=util[_0xf6c2('0x21')](_0xf6c2('0x69'),_0x1da760[_0xf6c2('0x51')],_0x54ebd3[_0xf6c2('0x58')],md5(_0x54ebd3[_0xf6c2('0x58')]));}else{_0x54ebd3[_0xf6c2('0x57')]='';}return getConnection(_0x1da760)[_0xf6c2('0x2b')](function(_0x16e23c){_0x2ec13a=_0x16e23c;if(!_['isNil'](_0x3ee8cf)){return getUser(_0x1da760,_0x3ee8cf['name'],_0x2ec13a);}else{return getUser(_0x1da760,null,_0x2ec13a);}})[_0xf6c2('0x2b')](function(_0x231072){_0x595375=_0x231072;logger[_0xf6c2('0xa')](_0xf6c2('0x59'),_0x595375['id']);return getEndUser(_0x1da760,_0x54ebd3[_0xf6c2('0x5a')],_0x54ebd3['calleridnum'],_0x2ec13a);})['then'](function(_0x4e79a8){_0x2f64b5=_0x4e79a8;logger[_0xf6c2('0xa')](_0xf6c2('0x70'),_0x2f64b5['id']);return getTicket(_0x1da760,_0x595375,_0x2f64b5,_0x677bc5,_0x54ebd3,_0x677bc5[_0xf6c2('0x5c')],_0x2ec13a,_0xf6c2('0x5d'));})[_0xf6c2('0x2b')](function(_0x154fa6){_0x566c17=_0x154fa6;logger['info'](_0xf6c2('0x5e'));logger[_0xf6c2('0xa')](_0xf6c2('0x71'),_0x566c17['id']);return setRelationship(_0x2ec13a,_0x595375,_0x566c17,_0xf6c2('0x6c'));})['then'](function(){return setRelationship(_0x2ec13a,_0x2f64b5,_0x566c17,_0xf6c2('0x5f'));})['then'](function(){return getServerInfo(_0x2ec13a);})[_0xf6c2('0x64')](function(_0x5df05f){logger[_0xf6c2('0x65')]('['+_0x54ebd3[_0xf6c2('0x6e')][_0xf6c2('0x6f')]()+']',JSON[_0xf6c2('0x1f')](_0x5df05f));});}; \ 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 420f2d5..0d095ec 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 _0xc1ec=['customVariable','join','slice','substring','validateEmail','test','lodash','getString','length','sortBy','string','push','content','type','variable','variableName','Variable','name','toLowerCase','toString','keyType','key','format','keyContent','%s:\x20%s'];(function(_0x209f9c,_0x4ea385){var _0x13c1ef=function(_0x455599){while(--_0x455599){_0x209f9c['push'](_0x209f9c['shift']());}};_0x13c1ef(++_0x4ea385);}(_0xc1ec,0x6a));var _0xcc1e=function(_0x449659,_0x5bc428){_0x449659=_0x449659-0x0;var _0x1526cd=_0xc1ec[_0x449659];return _0x1526cd;};'use strict';var _=require(_0xcc1e('0x0'));var util=require('util');exports[_0xcc1e('0x1')]=function(_0x44f511,_0x14cc8d,_0xd44339){var _0x2c445c=[];if(_0x44f511[_0xcc1e('0x2')]>0x0){var _0x128ab4=_[_0xcc1e('0x3')](_0x44f511,['id']);for(var _0x49399b=0x0;_0x49399b<_0x128ab4[_0xcc1e('0x2')];_0x49399b++){var _0x588f7f=_0x128ab4[_0x49399b];if(_0x588f7f['type']===_0xcc1e('0x4')){_0x2c445c[_0xcc1e('0x5')](_0x588f7f[_0xcc1e('0x6')]);}else if(_0x588f7f[_0xcc1e('0x7')]===_0xcc1e('0x8')&&_0x588f7f[_0xcc1e('0x9')]){_0x14cc8d[_0x588f7f[_0xcc1e('0x9')]]&&_0x2c445c['push'](_0x14cc8d[_0x588f7f[_0xcc1e('0x9')]]['toString']());}else if(_0x588f7f[_0xcc1e('0x7')]==='customVariable'&&_0x588f7f[_0xcc1e('0xa')]&&_0x588f7f['Variable'][_0xcc1e('0xb')]){_0x14cc8d[_0x588f7f['Variable'][_0xcc1e('0xb')][_0xcc1e('0xc')]()]&&_0x2c445c[_0xcc1e('0x5')](_0x14cc8d[_0x588f7f[_0xcc1e('0xa')]['name'][_0xcc1e('0xc')]()][_0xcc1e('0xd')]());}else if(_0x588f7f[_0xcc1e('0x7')]==='keyValue'){if(_0x588f7f[_0xcc1e('0xe')]==='string'&&_0x588f7f[_0xcc1e('0xf')]){_0x2c445c[_0xcc1e('0x5')](util[_0xcc1e('0x10')]('%s:\x20%s',_0x588f7f[_0xcc1e('0xf')],_0x588f7f[_0xcc1e('0x11')]));}else if(_0x588f7f[_0xcc1e('0xe')]===_0xcc1e('0x8')&&_0x588f7f['variableName']&&_0x588f7f['key']){_0x14cc8d[_0x588f7f[_0xcc1e('0x9')]]&&_0x2c445c[_0xcc1e('0x5')](util[_0xcc1e('0x10')](_0xcc1e('0x12'),_0x588f7f[_0xcc1e('0xf')],_0x14cc8d[_0x588f7f[_0xcc1e('0x9')]]));}else if(_0x588f7f['keyType']===_0xcc1e('0x13')&&_0x588f7f[_0xcc1e('0xa')]&&_0x588f7f[_0xcc1e('0xa')][_0xcc1e('0xb')]&&_0x588f7f[_0xcc1e('0xf')]){_0x14cc8d[_0x588f7f[_0xcc1e('0xa')][_0xcc1e('0xb')][_0xcc1e('0xc')]()]&&_0x2c445c[_0xcc1e('0x5')](util[_0xcc1e('0x10')](_0xcc1e('0x12'),_0x588f7f[_0xcc1e('0xf')],_0x14cc8d[_0x588f7f[_0xcc1e('0xa')][_0xcc1e('0xb')][_0xcc1e('0xc')]()]));}}}}return _0x2c445c[_0xcc1e('0x14')](_0xd44339);};exports['stripTrailingSlash']=function(_0x3f4a92){var _0x15666d=_0x3f4a92[_0xcc1e('0x15')](-0x1);if(_0x15666d==='/'){_0x3f4a92=_0x3f4a92[_0xcc1e('0x16')](0x0,_0x3f4a92['lastIndexOf'](_0x15666d));}return _0x3f4a92;};exports[_0xcc1e('0x17')]=function(_0x24e03e){if(!_['isNil'](_0x24e03e)&&_0x24e03e!==''){var _0x5154ae=/^(([^<>()\[\]\\.,;:\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 _0x5154ae[_0xcc1e('0x18')](String(_0x24e03e)[_0xcc1e('0xc')]());}else{return![];}}; \ No newline at end of file +var _0x8d8f=['string','key','%s:\x20%s','keyContent','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','type','push','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyType'];(function(_0x2c6af3,_0x3ce442){var _0x4895bf=function(_0x5566cf){while(--_0x5566cf){_0x2c6af3['push'](_0x2c6af3['shift']());}};_0x4895bf(++_0x3ce442);}(_0x8d8f,0x150));var _0xf8d8=function(_0x92dd1e,_0x3b9fc2){_0x92dd1e=_0x92dd1e-0x0;var _0x4621ba=_0x8d8f[_0x92dd1e];return _0x4621ba;};'use strict';var _=require(_0xf8d8('0x0'));var util=require('util');exports[_0xf8d8('0x1')]=function(_0x250f13,_0x4bd456,_0xcaa829){var _0x1b536d=[];if(_0x250f13[_0xf8d8('0x2')]>0x0){var _0x2b98b5=_[_0xf8d8('0x3')](_0x250f13,['id']);for(var _0x400672=0x0;_0x400672<_0x2b98b5[_0xf8d8('0x2')];_0x400672++){var _0x3f7017=_0x2b98b5[_0x400672];if(_0x3f7017[_0xf8d8('0x4')]==='string'){_0x1b536d[_0xf8d8('0x5')](_0x3f7017['content']);}else if(_0x3f7017[_0xf8d8('0x4')]===_0xf8d8('0x6')&&_0x3f7017['variableName']){_0x4bd456[_0x3f7017[_0xf8d8('0x7')]]&&_0x1b536d[_0xf8d8('0x5')](_0x4bd456[_0x3f7017['variableName']][_0xf8d8('0x8')]());}else if(_0x3f7017[_0xf8d8('0x4')]===_0xf8d8('0x9')&&_0x3f7017[_0xf8d8('0xa')]&&_0x3f7017[_0xf8d8('0xa')][_0xf8d8('0xb')]){_0x4bd456[_0x3f7017[_0xf8d8('0xa')][_0xf8d8('0xb')][_0xf8d8('0xc')]()]&&_0x1b536d['push'](_0x4bd456[_0x3f7017['Variable']['name']['toLowerCase']()][_0xf8d8('0x8')]());}else if(_0x3f7017[_0xf8d8('0x4')]==='keyValue'){if(_0x3f7017[_0xf8d8('0xd')]===_0xf8d8('0xe')&&_0x3f7017[_0xf8d8('0xf')]){_0x1b536d[_0xf8d8('0x5')](util['format'](_0xf8d8('0x10'),_0x3f7017['key'],_0x3f7017[_0xf8d8('0x11')]));}else if(_0x3f7017['keyType']===_0xf8d8('0x6')&&_0x3f7017[_0xf8d8('0x7')]&&_0x3f7017[_0xf8d8('0xf')]){_0x4bd456[_0x3f7017[_0xf8d8('0x7')]]&&_0x1b536d[_0xf8d8('0x5')](util['format'](_0xf8d8('0x10'),_0x3f7017[_0xf8d8('0xf')],_0x4bd456[_0x3f7017[_0xf8d8('0x7')]]));}else if(_0x3f7017[_0xf8d8('0xd')]===_0xf8d8('0x9')&&_0x3f7017[_0xf8d8('0xa')]&&_0x3f7017['Variable'][_0xf8d8('0xb')]&&_0x3f7017[_0xf8d8('0xf')]){_0x4bd456[_0x3f7017[_0xf8d8('0xa')][_0xf8d8('0xb')]['toLowerCase']()]&&_0x1b536d[_0xf8d8('0x5')](util['format'](_0xf8d8('0x10'),_0x3f7017[_0xf8d8('0xf')],_0x4bd456[_0x3f7017[_0xf8d8('0xa')][_0xf8d8('0xb')]['toLowerCase']()]));}}}}return _0x1b536d[_0xf8d8('0x12')](_0xcaa829);};exports[_0xf8d8('0x13')]=function(_0x2499e2){var _0x3842d3=_0x2499e2['slice'](-0x1);if(_0x3842d3==='/'){_0x2499e2=_0x2499e2[_0xf8d8('0x14')](0x0,_0x2499e2[_0xf8d8('0x15')](_0x3842d3));}return _0x2499e2;};exports[_0xf8d8('0x16')]=function(_0x1cd693){if(!_[_0xf8d8('0x17')](_0x1cd693)&&_0x1cd693!==''){var _0x55bd46=/^(([^<>()\[\]\\.,;:\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 _0x55bd46[_0xf8d8('0x18')](String(_0x1cd693)[_0xf8d8('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 96ff130..dca727b 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x53e25d,_0x22a2f8){var _0x54a696=function(_0x29b8de){while(--_0x29b8de){_0x53e25d['push'](_0x53e25d['shift']());}};_0x54a696(++_0x22a2f8);}(_0x34e8,0x12c));var _0x834e=function(_0x3e04ef,_0x15154a){_0x3e04ef=_0x3e04ef-0x0;var _0x41a590=_0x34e8[_0x3e04ef];return _0x41a590;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x14490c,_0x50e8ab){var _0x2f6825=function(_0x477b03){while(--_0x477b03){_0x14490c['push'](_0x14490c['shift']());}};_0x2f6825(++_0x50e8ab);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 460296e..9a53d30 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 _0xef63=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/search.json','results','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Enduser\x20created.','authType','password','token','toString','GET','map','length','forEach','string','type','customField','nameField','toLowerCase','includes','picklist','idField','custom_fields','push','content','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','The\x20User\x20ID\x20is:','catch','inspect','request-promise','md5','ioredis','./util','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','agent','%s/users/me.json','user'];(function(_0x371289,_0x4ee087){var _0x397ad0=function(_0x40d519){while(--_0x40d519){_0x371289['push'](_0x371289['shift']());}};_0x397ad0(++_0x4ee087);}(_0xef63,0x17e));var _0x3ef6=function(_0xf10e94,_0x28b6e7){_0xf10e94=_0xf10e94-0x0;var _0x3770e7=_0xef63[_0xf10e94];return _0x3770e7;};'use strict';var _=require('lodash');var rp=require(_0x3ef6('0x0'));var md5=require(_0x3ef6('0x1'));var util=require('util');var Redis=require(_0x3ef6('0x2'));var intUtil=require(_0x3ef6('0x3'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('zendesk');config[_0x3ef6('0x4')]=_['defaults'](config[_0x3ef6('0x4')],{'host':_0x3ef6('0x5'),'port':0x18eb});var io=require(_0x3ef6('0x6'))(new Redis(config[_0x3ef6('0x4')]));function emit(_0x452da,_0x5c2bef,_0x1cb9b6){io['to'](_0x452da)[_0x3ef6('0x7')](_0x5c2bef,_0x1cb9b6);}var headers={'Content-Type':_0x3ef6('0x8'),'Accept':_0x3ef6('0x8')};function getTicket(_0x296430,_0x23b133,_0x25cac0,_0x3fee45,_0x1e2775){logger[_0x3ef6('0x9')](_0x3ef6('0xa'));return request({'uri':util[_0x3ef6('0xb')](_0x3ef6('0xc'),_0x296430[_0x3ef6('0xd')]),'method':_0x3ef6('0xe'),'body':{'ticket':_['merge']({'requester_id':_0x25cac0['id'],'submitter_id':_0x23b133?_0x23b133['id']:undefined,'assignee_id':_0x23b133?_0x23b133['id']:undefined,'tags':getTags(_0x3fee45[_0x3ef6('0xf')],_0x3ef6('0x10')),'subject':intUtil[_0x3ef6('0x11')](_0x3fee45[_0x3ef6('0x12')],_0x1e2775,'\x20'),'description':intUtil[_0x3ef6('0x11')](_0x3fee45[_0x3ef6('0x13')],_0x1e2775,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3ef6('0x11')](_0x3fee45[_0x3ef6('0x13')],_0x1e2775,'\x0a')}},getCustomFields(_0x3fee45['Fields'],_0x1e2775))}})['then'](function(_0xa6d15c){logger[_0x3ef6('0x9')](_0x3ef6('0x14'));return _0xa6d15c[_0x3ef6('0x15')];});}function getUser(_0x553878,_0x4c8886){if(intUtil[_0x3ef6('0x16')](_0x4c8886)){logger[_0x3ef6('0x9')](_0x3ef6('0x17'),_0x4c8886);return request({'uri':util[_0x3ef6('0xb')]('%s/search.json',_0x553878[_0x3ef6('0xd')]),'qs':{'query':util[_0x3ef6('0xb')](_0x3ef6('0x18'),_0x4c8886)}})[_0x3ef6('0x19')](function(_0x5006ce){if(_0x5006ce['count']){logger['info'](_0x3ef6('0x1a'));return _['find'](_0x5006ce['results'],{'email':_0x4c8886,'role':_0x3ef6('0x1b')});}else{logger[_0x3ef6('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x3ef6('0xb')](_0x3ef6('0x1c'),_0x553878[_0x3ef6('0xd')])})[_0x3ef6('0x19')](function(_0x5c5864){logger[_0x3ef6('0x9')]('Admin\x20account\x20selected.');return _0x5c5864[_0x3ef6('0x1d')];});}});}else{logger[_0x3ef6('0x9')](_0x3ef6('0x1e'));return request({'uri':util[_0x3ef6('0xb')]('%s/users/me.json',_0x553878[_0x3ef6('0xd')])})[_0x3ef6('0x19')](function(_0x3ff7ca){logger['info']('Admin\x20account\x20selected.');return _0x3ff7ca['user'];});}}function getEndUser(_0x74729c,_0x3a478f,_0x1de355){logger[_0x3ef6('0x9')](_0x3ef6('0x1f'),_0x1de355);return request({'uri':util[_0x3ef6('0xb')](_0x3ef6('0x20'),_0x74729c[_0x3ef6('0xd')]),'qs':{'query':util[_0x3ef6('0xb')]('type:user\x20role:end-user\x20phone:%s',_0x1de355)}})[_0x3ef6('0x19')](function(_0x20277d){var _0x59be89;if(_0x20277d[_0x3ef6('0x21')]['length']){_0x20277d[_0x3ef6('0x21')]=_[_0x3ef6('0x22')](_0x20277d[_0x3ef6('0x21')],{'suspended':![],'role':_0x3ef6('0x23')});if(_0x20277d[_0x3ef6('0x21')]['length']){_0x59be89=_[_0x3ef6('0x24')](_0x20277d['results']);}}if(_0x59be89){logger[_0x3ef6('0x9')](_0x3ef6('0x25'));return _0x59be89;}else{logger['info'](_0x3ef6('0x26'));return request({'uri':util[_0x3ef6('0xb')](_0x3ef6('0x27'),_0x74729c[_0x3ef6('0xd')]),'method':'POST','body':{'user':{'role':_0x3ef6('0x23'),'name':util[_0x3ef6('0xb')]('Caller\x20-\x20%s',_0x3a478f||_0x1de355),'phone':_0x1de355}}})[_0x3ef6('0x19')](function(_0x124a50){logger[_0x3ef6('0x9')](_0x3ef6('0x28'));return _0x124a50[_0x3ef6('0x1d')];});}});}function getAuth(_0x1e99b1){var _0x5eb820;if(_0x1e99b1[_0x3ef6('0x29')]==='password'){_0x5eb820=util[_0x3ef6('0xb')]('%s:%s',_0x1e99b1['username'],_0x1e99b1[_0x3ef6('0x2a')]);}else if(_0x1e99b1['authType']==='token'){_0x5eb820=util[_0x3ef6('0xb')]('%s/token:%s',_0x1e99b1['username'],_0x1e99b1[_0x3ef6('0x2b')]);}return util[_0x3ef6('0xb')]('Basic\x20%s',new Buffer(_0x5eb820)[_0x3ef6('0x2c')]('base64'));}function request(_0x2e0183){logger['debug']('[HTTP]',JSON['stringify'](_0x2e0183));return rp(_['defaults'](_0x2e0183,{'method':_0x3ef6('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x46ff97,_0x2f952e){var _0x28bd49=[];if(_0x46ff97&&_0x46ff97['length']>0x0){_0x28bd49=_[_0x3ef6('0x2e')](_0x46ff97,_0x2f952e);}return _0x28bd49;}function getCustomFields(_0x2fb99d,_0x45719f){var _0x3522c0=[];var _0x56410a={'custom_fields':[]};if(_0x2fb99d[_0x3ef6('0x2f')]>0x0){_[_0x3ef6('0x30')](_0x2fb99d,function(_0x1b0d95){if(_['includes']([_0x3ef6('0x31'),'picklist'],_0x1b0d95[_0x3ef6('0x32')])&&_0x1b0d95['nameField']&&!_0x1b0d95[_0x3ef6('0x33')]){_0x56410a[_0x1b0d95[_0x3ef6('0x34')][_0x3ef6('0x35')]()]=_0x1b0d95['content']['toString']();}else if(_[_0x3ef6('0x36')]([_0x3ef6('0x31'),_0x3ef6('0x37')],_0x1b0d95[_0x3ef6('0x32')])&&_0x1b0d95[_0x3ef6('0x38')]&&_0x1b0d95[_0x3ef6('0x33')]){_0x56410a[_0x3ef6('0x39')][_0x3ef6('0x3a')]({'id':_0x1b0d95[_0x3ef6('0x38')],'value':_0x1b0d95[_0x3ef6('0x3b')][_0x3ef6('0x2c')]()});}else if(_0x1b0d95[_0x3ef6('0x32')]===_0x3ef6('0x3c')&&_0x1b0d95[_0x3ef6('0x3d')]&&_0x1b0d95[_0x3ef6('0x38')]&&_0x1b0d95[_0x3ef6('0x33')]){_0x45719f[_0x1b0d95[_0x3ef6('0x3d')]]&&_0x56410a['custom_fields'][_0x3ef6('0x3a')]({'id':_0x1b0d95[_0x3ef6('0x38')],'value':_0x45719f[_0x1b0d95[_0x3ef6('0x3d')]][_0x3ef6('0x2c')]()});}else if(_0x1b0d95[_0x3ef6('0x32')]===_0x3ef6('0x3e')&&_0x1b0d95['Variable']&&_0x1b0d95['Variable']['name']&&_0x1b0d95[_0x3ef6('0x38')]&&_0x1b0d95[_0x3ef6('0x33')]){_0x45719f[_0x1b0d95[_0x3ef6('0x3f')]['name'][_0x3ef6('0x35')]()]&&_0x56410a[_0x3ef6('0x39')][_0x3ef6('0x3a')]({'id':_0x1b0d95[_0x3ef6('0x38')],'value':_0x45719f[_0x1b0d95[_0x3ef6('0x3f')][_0x3ef6('0x10')][_0x3ef6('0x35')]()]['toString']()});}});}return _0x56410a;}exports[_0x3ef6('0x40')]=function(_0x361b4e,_0x3d1031,_0x46a02a,_0x1cbc49,_0x1c84f0,_0xa24242){var _0x1ac3b0,_0x108ad9;_0xa24242[_0x3ef6('0xd')]=intUtil[_0x3ef6('0x41')](_0xa24242[_0x3ef6('0xd')]);_0xa24242[_0x3ef6('0x42')]=intUtil['stripTrailingSlash'](_0xa24242[_0x3ef6('0x42')]);if(_0x1c84f0&&_0x1c84f0[_0x3ef6('0x43')]){logger[_0x3ef6('0x9')]('[QUEUE]',_0x3ef6('0x44'));_0x3d1031[_0x3ef6('0x45')]=util['format'](_0x3ef6('0x46'),_0xa24242[_0x3ef6('0x42')],_0x3d1031[_0x3ef6('0x47')],md5(_0x3d1031[_0x3ef6('0x47')]));}else{_0x3d1031[_0x3ef6('0x45')]='';}headers[_0x3ef6('0x48')]=getAuth(_0xa24242);return getUser(_0xa24242,_0x1cbc49[_0x3ef6('0x49')])['then'](function(_0x32bae6){_0x1ac3b0=_0x32bae6;logger[_0x3ef6('0x9')]('The\x20User\x20ID\x20is:',_0x1ac3b0['id']);return getEndUser(_0xa24242,_0x3d1031[_0x3ef6('0x4a')],_0x3d1031[_0x3ef6('0x4b')]);})[_0x3ef6('0x19')](function(_0x5d95b4){_0x108ad9=_0x5d95b4;logger['info'](_0x3ef6('0x4c'),_0x108ad9['id']);return getTicket(_0xa24242,_0x1ac3b0,_0x108ad9,_0x46a02a,_0x3d1031);})['then'](function(_0x995d9d){if(_0x995d9d){logger[_0x3ef6('0x9')]('The\x20Ticket\x20ID\x20is:',_0x995d9d['id']);switch(_0xa24242[_0x3ef6('0x32')]){case _0x3ef6('0x4d'):logger[_0x3ef6('0x9')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x3ef6('0xb')](_0x3ef6('0x4e'),_0xa24242[_0x3ef6('0xd')],_0x1ac3b0['id'],_0x995d9d['id']),'method':_0x3ef6('0xe')});case _0x3ef6('0x4f'):logger['info'](_0x3ef6('0x50'),_0x3ef6('0x51'));emit(util[_0x3ef6('0xb')](_0x3ef6('0x52'),_0x1cbc49[_0x3ef6('0x10')]),_0x3ef6('0x53'),{'uri':util['format'](_0x3ef6('0x54'),_0xa24242[_0x3ef6('0xd')][_0x3ef6('0x55')](_0x3ef6('0x56'),''),_0x995d9d['id'])});break;default:logger[_0x3ef6('0x57')](_0x3ef6('0x50'),_0x3ef6('0x58'));}}})['catch'](function(_0x4b9615){logger[_0x3ef6('0x57')](_0x3ef6('0x59'),util['inspect'](_0x4b9615,{'showHidden':!![],'depth':null}));});};exports[_0x3ef6('0x5a')]=function(_0x3d4d42,_0x3b346a,_0x503cdc,_0x31de66,_0x4f3bbe,_0x1ef60c,_0x467775){var _0x3a1578,_0x26f5e9;_0x1ef60c['remoteUri']=intUtil['stripTrailingSlash'](_0x1ef60c[_0x3ef6('0xd')]);_0x1ef60c[_0x3ef6('0x42')]=intUtil['stripTrailingSlash'](_0x1ef60c[_0x3ef6('0x42')]);if(_0x467775&&_0x467775['recordingFormat']&&_0x467775[_0x3ef6('0x5b')]!==_0x3ef6('0x5c')){logger[_0x3ef6('0x9')](_0x3ef6('0x5d'),_0x3ef6('0x44'));_0x3b346a['recordingURL']=util['format'](_0x3ef6('0x46'),_0x1ef60c[_0x3ef6('0x42')],_0x3b346a['uniqueid'],md5(_0x3b346a[_0x3ef6('0x47')]));}headers[_0x3ef6('0x48')]=getAuth(_0x1ef60c);return getUser(_0x1ef60c,_0x31de66[_0x3ef6('0x49')])['then'](function(_0x3c78f1){_0x3a1578=_0x3c78f1;logger[_0x3ef6('0x9')]('The\x20User\x20ID\x20is:',_0x3a1578['id']);return getEndUser(_0x1ef60c,_0x3b346a[_0x3ef6('0x5e')],_0x3b346a[_0x3ef6('0x5f')]);})[_0x3ef6('0x19')](function(_0x301199){_0x26f5e9=_0x301199;logger[_0x3ef6('0x9')](_0x3ef6('0x4c'),_0x26f5e9['id']);return getTicket(_0x1ef60c,_0x3a1578,_0x26f5e9,_0x503cdc,_0x3b346a);})['then'](function(_0xf6d26f){if(_0xf6d26f){logger[_0x3ef6('0x9')]('The\x20Ticket\x20ID\x20is:',_0xf6d26f['id']);switch(_0x1ef60c[_0x3ef6('0x32')]){case _0x3ef6('0x4d'):logger[_0x3ef6('0x9')]('[OUTBOUND]',_0x3ef6('0x60'));return request({'uri':util[_0x3ef6('0xb')](_0x3ef6('0x4e'),_0x1ef60c[_0x3ef6('0xd')],_0x3a1578['id'],_0xf6d26f['id']),'method':'POST'});case _0x3ef6('0x4f'):logger[_0x3ef6('0x9')](_0x3ef6('0x5d'),_0x3ef6('0x51'));emit(util[_0x3ef6('0xb')](_0x3ef6('0x52'),_0x31de66['name']),_0x3ef6('0x53'),{'uri':util[_0x3ef6('0xb')](_0x3ef6('0x54'),_0x1ef60c['remoteUri']['replace'](_0x3ef6('0x56'),''),_0xf6d26f['id'])});break;default:logger[_0x3ef6('0x57')](_0x3ef6('0x5d'),_0x3ef6('0x58'));}}})['catch'](function(_0x4802b9){logger['error'](_0x3ef6('0x61'),util['inspect'](_0x4802b9,{'showHidden':!![],'depth':null}));});};exports[_0x3ef6('0x62')]=function(_0x5bba03,_0x3d566c,_0x2984a5,_0x48c701,_0x8fb49b,_0x245abc){var _0x1aaeb5,_0xad951c;_0x245abc[_0x3ef6('0xd')]=intUtil['stripTrailingSlash'](_0x245abc[_0x3ef6('0xd')]);_0x245abc[_0x3ef6('0x42')]=intUtil['stripTrailingSlash'](_0x245abc['serverUrl']);if(_0x8fb49b&&_0x8fb49b[_0x3ef6('0x43')]){logger[_0x3ef6('0x9')]('['+_0x3d566c[_0x3ef6('0x63')]['toUpperCase']()+']',_0x3ef6('0x44'));_0x3d566c[_0x3ef6('0x45')]=util[_0x3ef6('0xb')](_0x3ef6('0x46'),_0x245abc[_0x3ef6('0x42')],_0x3d566c[_0x3ef6('0x47')],md5(_0x3d566c[_0x3ef6('0x47')]));}else{_0x3d566c[_0x3ef6('0x45')]='';}headers[_0x3ef6('0x48')]=getAuth(_0x245abc);return getUser(_0x245abc)['then'](function(_0x8bed43){_0x1aaeb5=_0x8bed43;logger[_0x3ef6('0x9')](_0x3ef6('0x64'),_0x1aaeb5['id']);return getEndUser(_0x245abc,_0x3d566c['calleridname'],_0x3d566c['calleridnum']);})[_0x3ef6('0x19')](function(_0x2cf90d){_0xad951c=_0x2cf90d;logger[_0x3ef6('0x9')](_0x3ef6('0x4c'),_0xad951c['id']);return getTicket(_0x245abc,_0x1aaeb5,_0xad951c,_0x2984a5,_0x3d566c);})['then'](function(_0x804f3b){if(_0x804f3b){logger[_0x3ef6('0x9')]('The\x20Ticket\x20ID\x20is:',_0x804f3b['id']);}})[_0x3ef6('0x65')](function(_0x199654){logger[_0x3ef6('0x57')]('['+_0x3d566c[_0x3ef6('0x63')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x3ef6('0x66')](_0x199654,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb2c8=['nameField','customField','toLowerCase','content','type','idField','custom_fields','push','variableName','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','getString','Subjects','Descriptions','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','remoteUri','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','%s/users/me.json','then','user','Searching\x20enduser\x20with\x20phone','%s/search.json','filter','end-user','length','first','Enduser\x20found!','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','token','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string'];(function(_0x52eb9c,_0x199ee1){var _0xfbc63=function(_0x467450){while(--_0x467450){_0x52eb9c['push'](_0x52eb9c['shift']());}};_0xfbc63(++_0x199ee1);}(_0xb2c8,0x174));var _0x8b2c=function(_0x3b06f1,_0x48e9c0){_0x3b06f1=_0x3b06f1-0x0;var _0x329e2e=_0xb2c8[_0x3b06f1];return _0x329e2e;};'use strict';var _=require(_0x8b2c('0x0'));var rp=require('request-promise');var md5=require(_0x8b2c('0x1'));var util=require(_0x8b2c('0x2'));var Redis=require(_0x8b2c('0x3'));var intUtil=require(_0x8b2c('0x4'));var config=require(_0x8b2c('0x5'));var logger=require(_0x8b2c('0x6'))('zendesk');config['redis']=_[_0x8b2c('0x7')](config[_0x8b2c('0x8')],{'host':_0x8b2c('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x57745e,_0x43cecd,_0x950287){io['to'](_0x57745e)['emit'](_0x43cecd,_0x950287);}var headers={'Content-Type':'application/json','Accept':_0x8b2c('0xa')};function getTicket(_0xe3c014,_0x5d5084,_0x5013f5,_0x28aadc,_0x226109){logger[_0x8b2c('0xb')](_0x8b2c('0xc'));return request({'uri':util[_0x8b2c('0xd')](_0x8b2c('0xe'),_0xe3c014['remoteUri']),'method':_0x8b2c('0xf'),'body':{'ticket':_[_0x8b2c('0x10')]({'requester_id':_0x5013f5['id'],'submitter_id':_0x5d5084?_0x5d5084['id']:undefined,'assignee_id':_0x5d5084?_0x5d5084['id']:undefined,'tags':getTags(_0x28aadc[_0x8b2c('0x11')],'name'),'subject':intUtil[_0x8b2c('0x12')](_0x28aadc[_0x8b2c('0x13')],_0x226109,'\x20'),'description':intUtil[_0x8b2c('0x12')](_0x28aadc[_0x8b2c('0x14')],_0x226109,'\x0a'),'comment':{'public':![],'body':intUtil[_0x8b2c('0x12')](_0x28aadc['Descriptions'],_0x226109,'\x0a')}},getCustomFields(_0x28aadc['Fields'],_0x226109))}})['then'](function(_0x581cd3){logger[_0x8b2c('0xb')](_0x8b2c('0x15'));return _0x581cd3[_0x8b2c('0x16')];});}function getUser(_0xb3b8,_0x53f68b){if(intUtil[_0x8b2c('0x17')](_0x53f68b)){logger[_0x8b2c('0xb')](_0x8b2c('0x18'),_0x53f68b);return request({'uri':util[_0x8b2c('0xd')]('%s/search.json',_0xb3b8[_0x8b2c('0x19')]),'qs':{'query':util[_0x8b2c('0xd')]('type:user\x20role:agent\x20email:%s',_0x53f68b)}})['then'](function(_0x493aa4){if(_0x493aa4['count']){logger[_0x8b2c('0xb')](_0x8b2c('0x1a'));return _[_0x8b2c('0x1b')](_0x493aa4[_0x8b2c('0x1c')],{'email':_0x53f68b,'role':_0x8b2c('0x1d')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0xb3b8[_0x8b2c('0x19')])})['then'](function(_0x1700a0){logger[_0x8b2c('0xb')](_0x8b2c('0x1e'));return _0x1700a0['user'];});}});}else{logger[_0x8b2c('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8b2c('0xd')](_0x8b2c('0x1f'),_0xb3b8[_0x8b2c('0x19')])})[_0x8b2c('0x20')](function(_0x27902b){logger[_0x8b2c('0xb')](_0x8b2c('0x1e'));return _0x27902b[_0x8b2c('0x21')];});}}function getEndUser(_0x3bb024,_0x33c4c8,_0x2f016e){logger[_0x8b2c('0xb')](_0x8b2c('0x22'),_0x2f016e);return request({'uri':util[_0x8b2c('0xd')](_0x8b2c('0x23'),_0x3bb024['remoteUri']),'qs':{'query':util[_0x8b2c('0xd')]('type:user\x20role:end-user\x20phone:%s',_0x2f016e)}})['then'](function(_0x5c880e){var _0x1363a8;if(_0x5c880e[_0x8b2c('0x1c')]['length']){_0x5c880e[_0x8b2c('0x1c')]=_[_0x8b2c('0x24')](_0x5c880e['results'],{'suspended':![],'role':_0x8b2c('0x25')});if(_0x5c880e[_0x8b2c('0x1c')][_0x8b2c('0x26')]){_0x1363a8=_[_0x8b2c('0x27')](_0x5c880e[_0x8b2c('0x1c')]);}}if(_0x1363a8){logger[_0x8b2c('0xb')](_0x8b2c('0x28'));return _0x1363a8;}else{logger[_0x8b2c('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x8b2c('0xd')]('%s/users.json',_0x3bb024[_0x8b2c('0x19')]),'method':_0x8b2c('0xf'),'body':{'user':{'role':'end-user','name':util[_0x8b2c('0xd')](_0x8b2c('0x29'),_0x33c4c8||_0x2f016e),'phone':_0x2f016e}}})['then'](function(_0x25b3de){logger['info'](_0x8b2c('0x2a'));return _0x25b3de[_0x8b2c('0x21')];});}});}function getAuth(_0x586b25){var _0x291cd7;if(_0x586b25['authType']===_0x8b2c('0x2b')){_0x291cd7=util[_0x8b2c('0xd')](_0x8b2c('0x2c'),_0x586b25[_0x8b2c('0x2d')],_0x586b25['password']);}else if(_0x586b25[_0x8b2c('0x2e')]==='token'){_0x291cd7=util[_0x8b2c('0xd')](_0x8b2c('0x2f'),_0x586b25[_0x8b2c('0x2d')],_0x586b25[_0x8b2c('0x30')]);}return util['format'](_0x8b2c('0x31'),new Buffer(_0x291cd7)[_0x8b2c('0x32')](_0x8b2c('0x33')));}function request(_0x1f648b){logger[_0x8b2c('0x34')](_0x8b2c('0x35'),JSON[_0x8b2c('0x36')](_0x1f648b));return rp(_['defaults'](_0x1f648b,{'method':_0x8b2c('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x24724d,_0x2f188b){var _0x273398=[];if(_0x24724d&&_0x24724d[_0x8b2c('0x26')]>0x0){_0x273398=_[_0x8b2c('0x38')](_0x24724d,_0x2f188b);}return _0x273398;}function getCustomFields(_0x512441,_0x2c47e7){var _0x2a540a=[];var _0x1713df={'custom_fields':[]};if(_0x512441['length']>0x0){_[_0x8b2c('0x39')](_0x512441,function(_0x2ff23a){if(_[_0x8b2c('0x3a')]([_0x8b2c('0x3b'),'picklist'],_0x2ff23a['type'])&&_0x2ff23a[_0x8b2c('0x3c')]&&!_0x2ff23a[_0x8b2c('0x3d')]){_0x1713df[_0x2ff23a['nameField'][_0x8b2c('0x3e')]()]=_0x2ff23a[_0x8b2c('0x3f')]['toString']();}else if(_['includes']([_0x8b2c('0x3b'),'picklist'],_0x2ff23a[_0x8b2c('0x40')])&&_0x2ff23a[_0x8b2c('0x41')]&&_0x2ff23a[_0x8b2c('0x3d')]){_0x1713df[_0x8b2c('0x42')][_0x8b2c('0x43')]({'id':_0x2ff23a[_0x8b2c('0x41')],'value':_0x2ff23a[_0x8b2c('0x3f')][_0x8b2c('0x32')]()});}else if(_0x2ff23a[_0x8b2c('0x40')]==='variable'&&_0x2ff23a['variableName']&&_0x2ff23a[_0x8b2c('0x41')]&&_0x2ff23a['customField']){_0x2c47e7[_0x2ff23a[_0x8b2c('0x44')]]&&_0x1713df[_0x8b2c('0x42')][_0x8b2c('0x43')]({'id':_0x2ff23a[_0x8b2c('0x41')],'value':_0x2c47e7[_0x2ff23a[_0x8b2c('0x44')]][_0x8b2c('0x32')]()});}else if(_0x2ff23a[_0x8b2c('0x40')]===_0x8b2c('0x45')&&_0x2ff23a[_0x8b2c('0x46')]&&_0x2ff23a[_0x8b2c('0x46')][_0x8b2c('0x47')]&&_0x2ff23a[_0x8b2c('0x41')]&&_0x2ff23a[_0x8b2c('0x3d')]){_0x2c47e7[_0x2ff23a['Variable'][_0x8b2c('0x47')]['toLowerCase']()]&&_0x1713df['custom_fields'][_0x8b2c('0x43')]({'id':_0x2ff23a['idField'],'value':_0x2c47e7[_0x2ff23a[_0x8b2c('0x46')]['name']['toLowerCase']()][_0x8b2c('0x32')]()});}});}return _0x1713df;}exports['queue']=function(_0x3e3ece,_0x3c741e,_0x4a940e,_0x81b71f,_0x2a93f6,_0x21c8ab){var _0x1d1e77,_0x7ede4d;_0x21c8ab['remoteUri']=intUtil[_0x8b2c('0x48')](_0x21c8ab[_0x8b2c('0x19')]);_0x21c8ab[_0x8b2c('0x49')]=intUtil[_0x8b2c('0x48')](_0x21c8ab['serverUrl']);if(_0x2a93f6&&_0x2a93f6[_0x8b2c('0x4a')]){logger[_0x8b2c('0xb')](_0x8b2c('0x4b'),_0x8b2c('0x4c'));_0x3c741e['recordingURL']=util[_0x8b2c('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x21c8ab[_0x8b2c('0x49')],_0x3c741e[_0x8b2c('0x4d')],md5(_0x3c741e['uniqueid']));}else{_0x3c741e[_0x8b2c('0x4e')]='';}headers[_0x8b2c('0x4f')]=getAuth(_0x21c8ab);return getUser(_0x21c8ab,_0x81b71f[_0x8b2c('0x50')])[_0x8b2c('0x20')](function(_0x7125f1){_0x1d1e77=_0x7125f1;logger[_0x8b2c('0xb')](_0x8b2c('0x51'),_0x1d1e77['id']);return getEndUser(_0x21c8ab,_0x3c741e['calleridname'],_0x3c741e[_0x8b2c('0x52')]);})['then'](function(_0x37a7dd){_0x7ede4d=_0x37a7dd;logger[_0x8b2c('0xb')](_0x8b2c('0x53'),_0x7ede4d['id']);return getTicket(_0x21c8ab,_0x1d1e77,_0x7ede4d,_0x4a940e,_0x3c741e);})[_0x8b2c('0x20')](function(_0x666bb8){if(_0x666bb8){logger[_0x8b2c('0xb')](_0x8b2c('0x54'),_0x666bb8['id']);switch(_0x21c8ab[_0x8b2c('0x40')]){case _0x8b2c('0x55'):logger['info'](_0x8b2c('0x4b'),_0x8b2c('0x56'));return request({'uri':util[_0x8b2c('0xd')](_0x8b2c('0x57'),_0x21c8ab[_0x8b2c('0x19')],_0x1d1e77['id'],_0x666bb8['id']),'method':_0x8b2c('0xf')});case _0x8b2c('0x58'):logger['info'](_0x8b2c('0x4b'),_0x8b2c('0x59'));emit(util[_0x8b2c('0xd')](_0x8b2c('0x5a'),_0x81b71f[_0x8b2c('0x47')]),_0x8b2c('0x5b'),{'uri':util[_0x8b2c('0xd')](_0x8b2c('0x5c'),_0x21c8ab[_0x8b2c('0x19')]['replace'](_0x8b2c('0x5d'),''),_0x666bb8['id'])});break;default:logger[_0x8b2c('0x5e')](_0x8b2c('0x4b'),_0x8b2c('0x5f'));}}})[_0x8b2c('0x60')](function(_0x21c781){logger[_0x8b2c('0x5e')](_0x8b2c('0x61'),util[_0x8b2c('0x62')](_0x21c781,{'showHidden':!![],'depth':null}));});};exports[_0x8b2c('0x63')]=function(_0x4b3dbf,_0x12fa96,_0x20000f,_0x80225d,_0x18f003,_0x540b5d,_0x5f1612){var _0x20c535,_0x480505;_0x540b5d['remoteUri']=intUtil['stripTrailingSlash'](_0x540b5d['remoteUri']);_0x540b5d[_0x8b2c('0x49')]=intUtil['stripTrailingSlash'](_0x540b5d['serverUrl']);if(_0x5f1612&&_0x5f1612[_0x8b2c('0x64')]&&_0x5f1612[_0x8b2c('0x64')]!=='none'){logger['info'](_0x8b2c('0x65'),_0x8b2c('0x4c'));_0x12fa96[_0x8b2c('0x4e')]=util[_0x8b2c('0xd')](_0x8b2c('0x66'),_0x540b5d[_0x8b2c('0x49')],_0x12fa96[_0x8b2c('0x4d')],md5(_0x12fa96['uniqueid']));}headers[_0x8b2c('0x4f')]=getAuth(_0x540b5d);return getUser(_0x540b5d,_0x80225d['email'])[_0x8b2c('0x20')](function(_0x253dcf){_0x20c535=_0x253dcf;logger['info'](_0x8b2c('0x51'),_0x20c535['id']);return getEndUser(_0x540b5d,_0x12fa96[_0x8b2c('0x67')],_0x12fa96['destcalleridnum']);})['then'](function(_0x193863){_0x480505=_0x193863;logger[_0x8b2c('0xb')](_0x8b2c('0x53'),_0x480505['id']);return getTicket(_0x540b5d,_0x20c535,_0x480505,_0x20000f,_0x12fa96);})[_0x8b2c('0x20')](function(_0x2649c4){if(_0x2649c4){logger[_0x8b2c('0xb')](_0x8b2c('0x54'),_0x2649c4['id']);switch(_0x540b5d['type']){case _0x8b2c('0x55'):logger[_0x8b2c('0xb')](_0x8b2c('0x65'),_0x8b2c('0x56'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x540b5d['remoteUri'],_0x20c535['id'],_0x2649c4['id']),'method':_0x8b2c('0xf')});case _0x8b2c('0x58'):logger['info'](_0x8b2c('0x65'),_0x8b2c('0x59'));emit(util[_0x8b2c('0xd')](_0x8b2c('0x5a'),_0x80225d['name']),_0x8b2c('0x5b'),{'uri':util[_0x8b2c('0xd')]('%s/agent/tickets/%s',_0x540b5d[_0x8b2c('0x19')]['replace'](_0x8b2c('0x5d'),''),_0x2649c4['id'])});break;default:logger[_0x8b2c('0x5e')](_0x8b2c('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x3cb84b){logger[_0x8b2c('0x5e')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x8b2c('0x62')](_0x3cb84b,{'showHidden':!![],'depth':null}));});};exports[_0x8b2c('0x68')]=function(_0x2a8898,_0x12c5f3,_0x3e68cc,_0x20c618,_0x214d2f,_0x228997){var _0x230048,_0x2cafb1;_0x228997[_0x8b2c('0x19')]=intUtil[_0x8b2c('0x48')](_0x228997[_0x8b2c('0x19')]);_0x228997[_0x8b2c('0x49')]=intUtil['stripTrailingSlash'](_0x228997[_0x8b2c('0x49')]);if(_0x214d2f&&_0x214d2f[_0x8b2c('0x4a')]){logger[_0x8b2c('0xb')]('['+_0x12c5f3[_0x8b2c('0x69')][_0x8b2c('0x6a')]()+']',_0x8b2c('0x4c'));_0x12c5f3[_0x8b2c('0x4e')]=util[_0x8b2c('0xd')](_0x8b2c('0x66'),_0x228997['serverUrl'],_0x12c5f3['uniqueid'],md5(_0x12c5f3[_0x8b2c('0x4d')]));}else{_0x12c5f3['recordingURL']='';}headers[_0x8b2c('0x4f')]=getAuth(_0x228997);return getUser(_0x228997)[_0x8b2c('0x20')](function(_0x262edb){_0x230048=_0x262edb;logger[_0x8b2c('0xb')](_0x8b2c('0x51'),_0x230048['id']);return getEndUser(_0x228997,_0x12c5f3['calleridname'],_0x12c5f3[_0x8b2c('0x52')]);})[_0x8b2c('0x20')](function(_0x46bcf1){_0x2cafb1=_0x46bcf1;logger[_0x8b2c('0xb')](_0x8b2c('0x53'),_0x2cafb1['id']);return getTicket(_0x228997,_0x230048,_0x2cafb1,_0x3e68cc,_0x12c5f3);})[_0x8b2c('0x20')](function(_0x1e49e6){if(_0x1e49e6){logger['info'](_0x8b2c('0x54'),_0x1e49e6['id']);}})[_0x8b2c('0x60')](function(_0x1c13ea){logger[_0x8b2c('0x5e')]('['+_0x12c5f3[_0x8b2c('0x69')]['toUpperCase']()+']'+_0x8b2c('0x6b'),util['inspect'](_0x1c13ea,{'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 b22804c..c5c8ac1 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 _0xa79e=['moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','SUCCESS','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','contact','nothing','lead','Creating\x20new\x20call...','Owner','administrator','Subject','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','complete','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','code','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','https://crm.','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','toUpperCase','lastevent','lodash','md5','util','./util','moment','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','includes','picklist','idField','content','type','variable','variableName','customVariable','Variable','name','toLowerCase','toString','indexOf','split','isNil','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','clientSecret','then','access_token','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','info','Using\x20the\x20admin\x20account!','profile','Administrator','user','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','https://www.zohoapis.','startCase'];(function(_0x56e8e5,_0x58f5b3){var _0x30f213=function(_0x1c1c1d){while(--_0x1c1c1d){_0x56e8e5['push'](_0x56e8e5['shift']());}};_0x30f213(++_0x58f5b3);}(_0xa79e,0xf7));var _0xea79=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xa79e[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xea79('0x0'));var rp=require('request-promise');var md5=require(_0xea79('0x1'));var util=require(_0xea79('0x2'));var intUtil=require(_0xea79('0x3'));var moment=require(_0xea79('0x4'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xea79('0x5'));var logger=require(_0xea79('0x6'))('zoho');config[_0xea79('0x7')]=_[_0xea79('0x8')](config['redis'],{'host':_0xea79('0x9'),'port':0x18eb});var io=require(_0xea79('0xa'))(new Redis(config[_0xea79('0x7')]));function emit(_0x59ab11,_0x498460,_0x5d55ae){io['to'](_0x59ab11)[_0xea79('0xb')](_0x498460,_0x5d55ae);}function request(_0x38fc39){logger['debug'](_0xea79('0xc'),JSON[_0xea79('0xd')](_0x38fc39));return rp(_0x38fc39);}function getCustomFields(_0x442a7b,_0x12590e){var _0x5c4274={};if(_0x442a7b[_0xea79('0xe')]>0x0){_[_0xea79('0xf')](_0x442a7b,function(_0x199b0f){if(_[_0xea79('0x10')](['string',_0xea79('0x11')],_0x199b0f['type'])&&_0x199b0f[_0xea79('0x12')]){_0x5c4274[_0x199b0f[_0xea79('0x12')]]=_0x199b0f[_0xea79('0x13')]['toString']();}else if(_0x199b0f[_0xea79('0x14')]===_0xea79('0x15')&&_0x199b0f['variableName']&&_0x199b0f[_0xea79('0x12')]&&_0x12590e[_0x199b0f[_0xea79('0x16')]]){_0x5c4274[_0x199b0f[_0xea79('0x12')]]=_0x12590e[_0x199b0f[_0xea79('0x16')]]['toString']();}else if(_0x199b0f[_0xea79('0x14')]===_0xea79('0x17')&&_0x199b0f[_0xea79('0x18')]&&_0x199b0f[_0xea79('0x18')][_0xea79('0x19')]&&_0x199b0f[_0xea79('0x12')]&&_0x12590e[_0x199b0f['Variable'][_0xea79('0x19')][_0xea79('0x1a')]()]){_0x5c4274[_0x199b0f[_0xea79('0x12')]]=_0x12590e[_0x199b0f['Variable']['name'][_0xea79('0x1a')]()][_0xea79('0x1b')]();}});}return _0x5c4274;}function getName(_0x26ee56){if(_0x26ee56[_0xea79('0x1c')]('\x20')>0x0){var _0x39cff2=_0x26ee56[_0xea79('0x1d')](/ (.+)/);if(_0x39cff2[0x1]){return _0x39cff2;}}return[_0x26ee56,_0x26ee56];}var accountsTokens={};function getAccessToken(_0x2fa5bb){return new Promise(function(_0x4f3cf3,_0x3741a5){if(!_['isNil'](accountsTokens[_0x2fa5bb['id']])&&!_[_0xea79('0x1e')](accountsTokens[_0x2fa5bb['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2fa5bb['id']][_0xea79('0x1f')])){_0x4f3cf3(accountsTokens[_0x2fa5bb['id']]['access_token']);}}var _0x41da5d;switch(_0x2fa5bb[_0xea79('0x20')]){case'US':_0x41da5d=_0xea79('0x21');break;case'AU':_0x41da5d=_0xea79('0x22');break;case'EU':_0x41da5d='https://accounts.zoho.eu';break;case'IN':_0x41da5d=_0xea79('0x23');break;case'CN':_0x41da5d=_0xea79('0x24');break;default:_0x41da5d=_0xea79('0x25');break;}var _0x271a73={'method':_0xea79('0x26'),'uri':_0x41da5d+_0xea79('0x27'),'qs':{'refresh_token':_0x2fa5bb['refreshToken'],'client_id':_0x2fa5bb['clientId'],'client_secret':_0x2fa5bb[_0xea79('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x271a73)[_0xea79('0x29')](function(_0x217b8e){accountsTokens[_0x2fa5bb['id']]={'access_token':_0x217b8e[_0xea79('0x2a')],'expires_in':moment()['add'](_0x217b8e[_0xea79('0x1f')],_0xea79('0x2b'))};_0x4f3cf3(_0x217b8e[_0xea79('0x2a')]);})[_0xea79('0x2c')](function(_0x17f35f){logger['error'](_0xea79('0x2d'),_0x17f35f[_0xea79('0x2e')]);_0x3741a5(_0x17f35f);});});}function getUser(_0x63a058,_0x5100b2,_0x57cc30,_0x48ab33){logger['info'](_0xea79('0x2f'));return request({'method':'GET','uri':util[_0xea79('0x30')](_0xea79('0x31'),_0x5100b2),'qs':{'type':_0xea79('0x32')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x63a058},'json':!![]})[_0xea79('0x29')](function(_0x425fd2){if(_0x425fd2[_0xea79('0x33')]){var _0x2589fc=-0x1;if(_[_0xea79('0x34')](_0x425fd2['users'])){if(!_['isNil'](_0x48ab33)){_0x2589fc=_[_0xea79('0x35')](_0x425fd2[_0xea79('0x33')],function(_0x269c74){return _0x269c74['email']===_0x48ab33;});}if(_0x2589fc>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xea79('0x36')](_0xea79('0x37'));_0x2589fc=_[_0xea79('0x35')](_0x425fd2[_0xea79('0x33')],function(_0x28c1eb){return _0x28c1eb[_0xea79('0x38')][_0xea79('0x19')]===_0xea79('0x39');});}return _0x425fd2[_0xea79('0x33')][_0x2589fc];}else{if(_0x425fd2[_0xea79('0x3a')]['profile'][_0xea79('0x19')]==='Administrator'){logger['info'](_0xea79('0x37'));user=_0x425fd2[_0xea79('0x3a')];return user;}else{logger[_0xea79('0x3b')](_0xea79('0x3c'),JSON[_0xea79('0xd')](_0x425fd2));throw new Error(_0xea79('0x3d')+JSON[_0xea79('0xd')](_0x425fd2));}}}else{logger[_0xea79('0x3b')](_0xea79('0x3c'),JSON[_0xea79('0xd')](_0x425fd2));throw new Error(_0xea79('0x3d')+JSON[_0xea79('0xd')](_0x425fd2));}})[_0xea79('0x2c')](function(_0x37abef){console[_0xea79('0x3b')](_0x37abef);});}function getZohoUser(_0x231030,_0x51e94d){return new BPromise(function(_0x2e2d0c,_0x2affeb){request(_0x231030)[_0xea79('0x29')](function(_0x26eef9){var _0x28c808=null;if(_0x26eef9){_0x28c808=_0x26eef9['data'][0x0];_0x28c808[_0xea79('0x3e')]=_0x51e94d;}_0x2e2d0c(_0x28c808);})[_0xea79('0x2c')](function(_0x85e386){_0x2affeb(_0x85e386);});});}function createEndUser(_0x3c24b6,_0x104fd7,_0x392d91,_0x15d988,_0x234c8e,_0x5a55e2){var _0x392d91=getName(_0x392d91);return request({'method':_0xea79('0x26'),'uri':_0xea79('0x3f')+_0x104fd7+'/crm/v2/'+_[_0xea79('0x40')](_0x5a55e2[_0xea79('0x41')])+'s','body':{'data':[{'Last_Name':_0x392d91[0x1],'First_Name':_0x392d91[0x0],'Phone':_0x15d988,'Owner':{'name':!_[_0xea79('0x1e')](_0x234c8e[_0xea79('0x42')][_0xea79('0x19')])?_0x234c8e[_0xea79('0x42')]['name']:!_[_0xea79('0x1e')](_0x234c8e[_0xea79('0x43')])?_0x234c8e[_0xea79('0x43')]+'\x20'+_0x234c8e[_0xea79('0x44')]:_0x234c8e['last_name'],'id':_0x234c8e['id']}}]},'headers':{'Authorization':_0xea79('0x45')+_0x3c24b6},'json':!![]})[_0xea79('0x29')](function(_0x24b700){if(_0x24b700&&_0x24b700[_0xea79('0x46')][0x0]['code']===_0xea79('0x47')){var _0xd85314=_0x24b700[_0xea79('0x46')][0x0]['details'];_0xd85314['enduserType']=_['startCase'](_0x5a55e2[_0xea79('0x41')])+'s';return _0xd85314;}logger[_0xea79('0x3b')](_0xea79('0x3c'),JSON[_0xea79('0xd')](data));throw new Error('Error:\x20'+JSON[_0xea79('0xd')](data));})[_0xea79('0x2c')](function(_0x3c5ed0){console[_0xea79('0x48')](_0xea79('0x49'),_0x3c5ed0);});}function getEndUser(_0x5e78e5,_0x11a6cf,_0x3db522,_0x46408e,_0x53af43,_0x1ca11c,_0x461dcd){var _0x311262={'method':_0xea79('0x4a'),'uri':'','headers':{'Authorization':_0xea79('0x45')+_0x5e78e5},'json':!![]};switch(_0x461dcd[_0xea79('0x4b')]){case _0xea79('0x4c'):_0x311262['uri']=_0xea79('0x3f')+_0x11a6cf+_0xea79('0x4d')+_0x53af43+'))';return getZohoUser(_0x311262,_0xea79('0x4e'))['then'](function(_0x2b00f9){if(_0x2b00f9)return _0x2b00f9;_0x311262[_0xea79('0x4f')]=_0xea79('0x3f')+_0x11a6cf+_0xea79('0x50')+_0x53af43+'))';return getZohoUser(_0x311262,_0xea79('0x51'))[_0xea79('0x29')](function(_0xf869ef){if(_0xf869ef)return _0xf869ef;if(_0x461dcd['moduleCreate']!='nothing'){return createEndUser(_0x5e78e5,_0x11a6cf,_0x46408e,_0x53af43,_0x1ca11c,_0x461dcd);}else{return{};}});});break;case _0xea79('0x52'):_0x311262[_0xea79('0x4f')]=_0xea79('0x3f')+_0x11a6cf+_0xea79('0x4d')+_0x53af43+'))';return getZohoUser(_0x311262,_0xea79('0x4e'))[_0xea79('0x29')](function(_0x5bb572){if(_0x5bb572)return _0x5bb572;if(_0x461dcd[_0xea79('0x41')]!=_0xea79('0x53')){return createEndUser(_0x5e78e5,_0x11a6cf,_0x46408e,_0x53af43,_0x1ca11c,_0x461dcd);}else{return{};}});break;case _0xea79('0x54'):_0x311262[_0xea79('0x4f')]=_0xea79('0x3f')+_0x11a6cf+_0xea79('0x50')+_0x53af43+'))';return getZohoUser(_0x311262,_0xea79('0x51'))['then'](function(_0x105248){if(_0x105248)return _0x105248;if(_0x461dcd[_0xea79('0x41')]!=_0xea79('0x53')){return createEndUser(_0x5e78e5,_0x11a6cf,_0x46408e,_0x53af43,_0x1ca11c,_0x461dcd);}else{return{};}});break;}}function getCall(_0x3e83ac,_0x457fbd,_0x54e647,_0x2366e8,_0x4ef919,_0xe395f2,_0x42465b,_0x24bd4a){logger[_0xea79('0x36')](_0xea79('0x55'));var _0x2425ec={};_0x2425ec[_0xea79('0x56')]={'name':!_[_0xea79('0x1e')](_0x2366e8['role']['name'])&&!_[_0xea79('0x1e')](_0x2366e8[_0xea79('0x38')][_0xea79('0x19')])&&_0x2366e8[_0xea79('0x38')][_0xea79('0x19')]===_0xea79('0x57')?_0x2366e8[_0xea79('0x42')][_0xea79('0x19')]:!_[_0xea79('0x1e')](_0x2366e8[_0xea79('0x43')])?_0x2366e8[_0xea79('0x43')]+'\x20'+_0x2366e8[_0xea79('0x44')]:_0x2366e8[_0xea79('0x44')],'id':_0x2366e8['id']};_0x2425ec[_0xea79('0x58')]=intUtil['getString'](_0xe395f2['Subjects'],_0x42465b,'\x20');_0x2425ec[_0xea79('0x59')]=intUtil[_0xea79('0x5a')](_0xe395f2[_0xea79('0x5b')],_0x42465b,'\x0a');if(_0x4ef919[_0xea79('0x3e')]===_0xea79('0x4e')){_0x2425ec[_0xea79('0x5c')]={'name':!_['isNil'](_0x4ef919[_0xea79('0x5d')])?_0x4ef919[_0xea79('0x5d')]:!_[_0xea79('0x1e')](_0x4ef919[_0xea79('0x5e')])?_0x4ef919['First_Name']+'\x20'+_0x4ef919[_0xea79('0x5f')]:_0x4ef919[_0xea79('0x5f')],'id':_0x4ef919['id']};}if(_0x4ef919[_0xea79('0x3e')]===_0xea79('0x51')){_0x2425ec[_0xea79('0x60')]={'name':!_[_0xea79('0x1e')](_0x4ef919[_0xea79('0x5d')])?_0x4ef919[_0xea79('0x5d')]:!_[_0xea79('0x1e')](_0x4ef919[_0xea79('0x5e')])?_0x4ef919[_0xea79('0x5e')]+'\x20'+_0x4ef919[_0xea79('0x5f')]:_0x4ef919[_0xea79('0x5f')],'id':_0x4ef919['id']};_0x2425ec[_0xea79('0x61')]=_[_0xea79('0x40')](_0x4ef919['enduserType']);}if(_0x42465b[_0xea79('0x62')]){_0x2425ec[_0xea79('0x63')]=moment[_0xea79('0x64')](parseInt(_0x42465b[_0xea79('0x62')])*0x3e8)[_0xea79('0x30')](_0xea79('0x65'));}else if(_0x42465b['answertime']&&_0x42465b[_0xea79('0x66')]){_0x2425ec['Call_Duration']=moment[_0xea79('0x64')](moment(_0x42465b['endtime'],_0xea79('0x67'))[_0xea79('0x68')](moment(_0x42465b['starttime'],'YYYY-MM-DDTHH:mm:ss')))[_0xea79('0x30')](_0xea79('0x65'));}switch(_0x42465b['lastevent']){case _0xea79('0x69'):_0x2425ec[_0xea79('0x6a')]=_0xea79('0x6b');break;case _0xea79('0x6c'):case'connect':_0x2425ec[_0xea79('0x6a')]='Answered';break;case _0xea79('0x6d'):_0x2425ec[_0xea79('0x6a')]=_0xea79('0x6e');break;case _0xea79('0x6f'):_0x2425ec['Call_Result']=_0xea79('0x70');break;case'timeout':_0x2425ec[_0xea79('0x6a')]=_0xea79('0x71');default:}_0x2425ec[_0xea79('0x72')]=(_0x24bd4a==='outbound'?moment(_0x42465b[_0xea79('0x73')])[_0xea79('0x30')](_0xea79('0x67')):moment(_0x42465b[_0xea79('0x74')])['format'](_0xea79('0x67')))||moment()[_0xea79('0x30')](_0xea79('0x67'));_0x2425ec[_0xea79('0x75')]=_0x24bd4a||_0xea79('0x76');_0x2425ec=_['merge'](_0x2425ec,getCustomFields(_0xe395f2[_0xea79('0x77')],_0x42465b));return request({'method':_0xea79('0x26'),'uri':'https://www.zohoapis.'+_0x457fbd+_0xea79('0x78'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3e83ac},'body':{'data':[_0x2425ec]},'json':!![]})[_0xea79('0x29')](function(_0x451d86){if(_0x451d86&&_0x451d86[_0xea79('0x46')][0x0][_0xea79('0x79')]==='SUCCESS'){logger[_0xea79('0x36')](_0xea79('0x7a'));return{'id':_0x451d86[_0xea79('0x46')][0x0][_0xea79('0x7b')]['id']};}})[_0xea79('0x2c')](function(_0x16dadf){logger[_0xea79('0x36')](_0xea79('0x7c'),_0x16dadf[_0xea79('0x2e')]);console['log'](_0xea79('0x7c'),_0x16dadf);});}exports[_0xea79('0x7d')]=function(_0x4f44e0,_0x57d60b,_0x223e71,_0x5c1483,_0xcaf133,_0x3035e4){var _0x23c124,_0x5604e6,_0x139651;_0x3035e4[_0xea79('0x7e')]=intUtil[_0xea79('0x7f')](_0x3035e4[_0xea79('0x7e')]);_0x3035e4[_0xea79('0x80')]=intUtil[_0xea79('0x7f')](_0x3035e4[_0xea79('0x80')]);if(_0xcaf133&&_0xcaf133[_0xea79('0x81')]){logger[_0xea79('0x36')](_0xea79('0x82'),_0xea79('0x83'));_0x57d60b[_0xea79('0x84')]=_0x3035e4['serverUrl']+_0xea79('0x85')+_0x57d60b['uniqueid']+_0xea79('0x86')+md5(_0x57d60b[_0xea79('0x87')]);}else{_0x57d60b[_0xea79('0x84')]='';}var _0x47a94b=_0x3035e4[_0xea79('0x7e')]===_0xea79('0x88')?'eu':_0xea79('0x89');return getAccessToken(_0x3035e4)[_0xea79('0x29')](function(_0x99b127){_0x139651=_0x99b127;return getUser(_0x139651,_0x47a94b,_0x3035e4,_0x5c1483[_0xea79('0x8a')]);})[_0xea79('0x29')](function(_0x5ba200){_0x23c124=_0x5ba200;logger[_0xea79('0x36')](_0xea79('0x8b'),_0x23c124['id']);return getEndUser(_0x139651,_0x47a94b,_0x3035e4,_0x57d60b[_0xea79('0x8c')],_0x57d60b[_0xea79('0x8d')],_0x23c124,_0x223e71);})[_0xea79('0x29')](function(_0x503f26){_0x5604e6=_0x503f26;return getCall(_0x139651,_0x47a94b,_0x3035e4,_0x23c124,_0x5604e6,_0x223e71,_0x57d60b,_0xea79('0x76'));})[_0xea79('0x29')](function(_0x5eb916){if(_0x5eb916){logger[_0xea79('0x36')](_0xea79('0x8e'),_0x5eb916['id']);logger[_0xea79('0x36')](_0xea79('0x82'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x5c1483[_0xea79('0x19')]),'trigger:browser:url',{'uri':_0xea79('0x8f')+_0x3035e4[_0xea79('0x7e')]+_0xea79('0x90')+_0x5eb916['id']});}})[_0xea79('0x2c')](function(_0x49ff6a){logger[_0xea79('0x3b')](_0xea79('0x82'),JSON[_0xea79('0xd')](_0x49ff6a));});};exports[_0xea79('0x91')]=function(_0x2a5353,_0x520e2f,_0x28ef63,_0x5d2431,_0x433bb1,_0x2387d6,_0x19375b){var _0x53d8d2,_0x15b3c6,_0x4689dd;_0x2387d6[_0xea79('0x7e')]=intUtil[_0xea79('0x7f')](_0x2387d6['host']);_0x2387d6['serverUrl']=intUtil[_0xea79('0x7f')](_0x2387d6['serverUrl']);if(_0x19375b&&_0x19375b['recordingFormat']&&_0x19375b[_0xea79('0x92')]!==_0xea79('0x93')){logger[_0xea79('0x36')]('[OUTBOUND]',_0xea79('0x83'));_0x520e2f[_0xea79('0x84')]=_0x2387d6[_0xea79('0x80')]+_0xea79('0x85')+_0x520e2f[_0xea79('0x87')]+_0xea79('0x86')+md5(_0x520e2f[_0xea79('0x87')]);}var _0xc084c7=_0x2387d6[_0xea79('0x7e')]===_0xea79('0x88')?'eu':_0xea79('0x89');return getAccessToken(_0x2387d6)['then'](function(_0x26ad19){_0x4689dd=_0x26ad19;return getUser(_0x4689dd,_0xc084c7,_0x2387d6,_0x5d2431[_0xea79('0x8a')]);})[_0xea79('0x29')](function(_0x2c5972){_0x53d8d2=_0x2c5972;logger[_0xea79('0x36')](_0xea79('0x8b'),_0x53d8d2['id']);return getEndUser(_0x4689dd,_0xc084c7,_0x2387d6,_0x520e2f[_0xea79('0x94')],_0x520e2f[_0xea79('0x95')],_0x53d8d2,_0x28ef63);})['then'](function(_0x27bfac){_0x15b3c6=_0x27bfac;return getCall(_0x4689dd,_0xc084c7,_0x2387d6,_0x53d8d2,_0x15b3c6,_0x28ef63,_0x520e2f,_0xea79('0x96'));})['then'](function(_0x26acd5){if(_0x26acd5){logger[_0xea79('0x36')](_0xea79('0x8e'),_0x26acd5['id']);logger[_0xea79('0x36')](_0xea79('0x97'),_0xea79('0x98'));emit(util[_0xea79('0x30')]('user:%s',_0x5d2431[_0xea79('0x19')]),'trigger:browser:url',{'uri':'https://crm.'+_0x2387d6[_0xea79('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x26acd5['id']});}})['catch'](function(_0x4924d1){logger[_0xea79('0x3b')](_0xea79('0x97'),JSON['stringify'](_0x4924d1));});};exports[_0xea79('0x99')]=function(_0x4244f5,_0x5ac293,_0x17e918,_0x17149d,_0x3f76a2,_0x1f595e){var _0x55f4a0,_0x2e9ef7,_0x150968;_0x1f595e['host']=intUtil['stripTrailingSlash'](_0x1f595e['host']);_0x1f595e[_0xea79('0x80')]=intUtil[_0xea79('0x7f')](_0x1f595e[_0xea79('0x80')]);if(_0x3f76a2&&_0x3f76a2['monitor_format']){logger['info']('['+_0x5ac293['lastevent'][_0xea79('0x9a')]()+']',_0xea79('0x83'));_0x5ac293[_0xea79('0x84')]=_0x1f595e[_0xea79('0x80')]+_0xea79('0x85')+_0x5ac293[_0xea79('0x87')]+_0xea79('0x86')+md5(_0x5ac293['uniqueid']);}else{_0x5ac293[_0xea79('0x84')]='';}var _0x194730=_0x1f595e[_0xea79('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x1f595e)[_0xea79('0x29')](function(_0x2ce35b){_0x150968=_0x2ce35b;return getUser(_0x150968,_0x194730,_0x1f595e);})[_0xea79('0x29')](function(_0x502bd7){_0x55f4a0=_0x502bd7;logger[_0xea79('0x36')]('The\x20User\x20ID\x20is:',_0x55f4a0['id']);return getEndUser(_0x150968,_0x194730,_0x1f595e,_0x5ac293['calleridname'],_0x5ac293[_0xea79('0x8d')],_0x55f4a0,_0x17e918);})['then'](function(_0x44b85a){_0x2e9ef7=_0x44b85a;return getCall(_0x150968,_0x194730,_0x1f595e,_0x55f4a0,_0x2e9ef7,_0x17e918,_0x5ac293,_0xea79('0x76'));})[_0xea79('0x29')](function(_0x4be1af){if(_0x4be1af){logger[_0xea79('0x36')](_0xea79('0x8e'),_0x4be1af['id']);}})[_0xea79('0x2c')](function(_0x352893){logger[_0xea79('0x3b')]('['+_0x5ac293[_0xea79('0x9b')][_0xea79('0x9a')]()+']',JSON['stringify'](_0x352893));});}; \ No newline at end of file +var _0xf977=['timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','email','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=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','localhost','redis','emit','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','GET','contact_lead','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','Creating\x20new\x20call...','administrator','first_name','Subjects','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','Leads','$se_module','talktime','utc','mm:ss','endtime','Call_Duration','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','Rejected','abandoned'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf977,0x161));var _0x7f97=function(_0x415ec7,_0x18f21a){_0x415ec7=_0x415ec7-0x0;var _0x4fa78a=_0xf977[_0x415ec7];return _0x4fa78a;};'use strict';var _=require(_0x7f97('0x0'));var rp=require(_0x7f97('0x1'));var md5=require(_0x7f97('0x2'));var util=require(_0x7f97('0x3'));var intUtil=require(_0x7f97('0x4'));var moment=require(_0x7f97('0x5'));var Redis=require(_0x7f97('0x6'));var BPromise=require(_0x7f97('0x7'));var config=require(_0x7f97('0x8'));var logger=require(_0x7f97('0x9'))(_0x7f97('0xa'));config['redis']=_['defaults'](config['redis'],{'host':_0x7f97('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7f97('0xc')]));function emit(_0x1fd3fc,_0x3430a0,_0xc5cfed){io['to'](_0x1fd3fc)[_0x7f97('0xd')](_0x3430a0,_0xc5cfed);}function request(_0x51b32e){logger[_0x7f97('0xe')](_0x7f97('0xf'),JSON[_0x7f97('0x10')](_0x51b32e));return rp(_0x51b32e);}function getCustomFields(_0x3ea6f8,_0x179713){var _0x491a1b={};if(_0x3ea6f8[_0x7f97('0x11')]>0x0){_[_0x7f97('0x12')](_0x3ea6f8,function(_0x3d9b24){if(_[_0x7f97('0x13')]([_0x7f97('0x14'),'picklist'],_0x3d9b24[_0x7f97('0x15')])&&_0x3d9b24[_0x7f97('0x16')]){_0x491a1b[_0x3d9b24[_0x7f97('0x16')]]=_0x3d9b24[_0x7f97('0x17')][_0x7f97('0x18')]();}else if(_0x3d9b24[_0x7f97('0x15')]===_0x7f97('0x19')&&_0x3d9b24[_0x7f97('0x1a')]&&_0x3d9b24['idField']&&_0x179713[_0x3d9b24[_0x7f97('0x1a')]]){_0x491a1b[_0x3d9b24[_0x7f97('0x16')]]=_0x179713[_0x3d9b24[_0x7f97('0x1a')]][_0x7f97('0x18')]();}else if(_0x3d9b24[_0x7f97('0x15')]==='customVariable'&&_0x3d9b24['Variable']&&_0x3d9b24[_0x7f97('0x1b')][_0x7f97('0x1c')]&&_0x3d9b24[_0x7f97('0x16')]&&_0x179713[_0x3d9b24[_0x7f97('0x1b')]['name']['toLowerCase']()]){_0x491a1b[_0x3d9b24[_0x7f97('0x16')]]=_0x179713[_0x3d9b24[_0x7f97('0x1b')][_0x7f97('0x1c')][_0x7f97('0x1d')]()][_0x7f97('0x18')]();}});}return _0x491a1b;}function getName(_0x366e97){if(_0x366e97[_0x7f97('0x1e')]('\x20')>0x0){var _0x2ca2ce=_0x366e97[_0x7f97('0x1f')](/ (.+)/);if(_0x2ca2ce[0x1]){return _0x2ca2ce;}}return[_0x366e97,_0x366e97];}var accountsTokens={};function getAccessToken(_0x37dcac){return new Promise(function(_0x53e2cc,_0x29d835){if(!_[_0x7f97('0x20')](accountsTokens[_0x37dcac['id']])&&!_[_0x7f97('0x20')](accountsTokens[_0x37dcac['id']]['access_token'])){if(moment()[_0x7f97('0x21')](accountsTokens[_0x37dcac['id']][_0x7f97('0x22')])){_0x53e2cc(accountsTokens[_0x37dcac['id']][_0x7f97('0x23')]);}}var _0x162d78;switch(_0x37dcac[_0x7f97('0x24')]){case'US':_0x162d78=_0x7f97('0x25');break;case'AU':_0x162d78=_0x7f97('0x26');break;case'EU':_0x162d78='https://accounts.zoho.eu';break;case'IN':_0x162d78=_0x7f97('0x27');break;case'CN':_0x162d78=_0x7f97('0x28');break;default:_0x162d78=_0x7f97('0x29');break;}var _0x470e84={'method':_0x7f97('0x2a'),'uri':_0x162d78+'/oauth/v2/token','qs':{'refresh_token':_0x37dcac[_0x7f97('0x2b')],'client_id':_0x37dcac[_0x7f97('0x2c')],'client_secret':_0x37dcac[_0x7f97('0x2d')],'grant_type':_0x7f97('0x2e')},'json':!![]};return rp(_0x470e84)[_0x7f97('0x2f')](function(_0x2f588c){accountsTokens[_0x37dcac['id']]={'access_token':_0x2f588c[_0x7f97('0x23')],'expires_in':moment()[_0x7f97('0x30')](_0x2f588c[_0x7f97('0x22')],_0x7f97('0x31'))};_0x53e2cc(_0x2f588c[_0x7f97('0x23')]);})[_0x7f97('0x32')](function(_0xea0771){logger[_0x7f97('0x33')](_0x7f97('0x34'),_0xea0771[_0x7f97('0x35')]);_0x29d835(_0xea0771);});});}function getUser(_0x1f3d7a,_0x13c5f3,_0x453f2a,_0x109bb9){logger[_0x7f97('0x36')](_0x7f97('0x37'));return request({'method':'GET','uri':util[_0x7f97('0x38')](_0x7f97('0x39'),_0x13c5f3),'qs':{'type':_0x7f97('0x3a')},'headers':{'Authorization':_0x7f97('0x3b')+_0x1f3d7a},'json':!![]})[_0x7f97('0x2f')](function(_0x1e5b4c){if(_0x1e5b4c['users']){var _0x2bb16a=-0x1;if(_[_0x7f97('0x3c')](_0x1e5b4c[_0x7f97('0x3d')])){if(!_[_0x7f97('0x20')](_0x109bb9)){_0x2bb16a=_[_0x7f97('0x3e')](_0x1e5b4c[_0x7f97('0x3d')],function(_0xd4da04){return _0xd4da04['email']===_0x109bb9;});}if(_0x2bb16a>=0x0){logger[_0x7f97('0x36')]('Agent\x20found!');}else{logger[_0x7f97('0x36')](_0x7f97('0x3f'));_0x2bb16a=_[_0x7f97('0x3e')](_0x1e5b4c['users'],function(_0x253030){return _0x253030[_0x7f97('0x40')]['name']===_0x7f97('0x41');});}return _0x1e5b4c[_0x7f97('0x3d')][_0x2bb16a];}else{if(_0x1e5b4c[_0x7f97('0x42')][_0x7f97('0x40')][_0x7f97('0x1c')]===_0x7f97('0x41')){logger[_0x7f97('0x36')](_0x7f97('0x3f'));user=_0x1e5b4c[_0x7f97('0x42')];return user;}else{logger['error'](_0x7f97('0x43'),JSON[_0x7f97('0x10')](_0x1e5b4c));throw new Error(_0x7f97('0x44')+JSON[_0x7f97('0x10')](_0x1e5b4c));}}}else{logger[_0x7f97('0x33')](_0x7f97('0x43'),JSON[_0x7f97('0x10')](_0x1e5b4c));throw new Error(_0x7f97('0x44')+JSON[_0x7f97('0x10')](_0x1e5b4c));}})[_0x7f97('0x32')](function(_0x3de2c6){console[_0x7f97('0x33')](_0x3de2c6);});}function getZohoUser(_0x438053,_0x45a800){return new BPromise(function(_0x16b165,_0x234edb){request(_0x438053)['then'](function(_0x49ebae){var _0x574a99=null;if(_0x49ebae){_0x574a99=_0x49ebae[_0x7f97('0x45')][0x0];_0x574a99[_0x7f97('0x46')]=_0x45a800;}_0x16b165(_0x574a99);})[_0x7f97('0x32')](function(_0x11ad4d){_0x234edb(_0x11ad4d);});});}function createEndUser(_0x2d8c1c,_0x25ed32,_0x4dead3,_0x54c964,_0x375706,_0x2eb6d4){var _0x4dead3=getName(_0x4dead3);return request({'method':_0x7f97('0x2a'),'uri':'https://www.zohoapis.'+_0x25ed32+_0x7f97('0x47')+_[_0x7f97('0x48')](_0x2eb6d4[_0x7f97('0x49')])+'s','body':{'data':[{'Last_Name':_0x4dead3[0x1],'First_Name':_0x4dead3[0x0],'Phone':_0x54c964,'Owner':{'name':!_[_0x7f97('0x20')](_0x375706[_0x7f97('0x4a')]['name'])?_0x375706['role'][_0x7f97('0x1c')]:!_[_0x7f97('0x20')](_0x375706['first_name'])?_0x375706['first_name']+'\x20'+_0x375706[_0x7f97('0x4b')]:_0x375706[_0x7f97('0x4b')],'id':_0x375706['id']}}]},'headers':{'Authorization':_0x7f97('0x3b')+_0x2d8c1c},'json':!![]})[_0x7f97('0x2f')](function(_0x2037c6){if(_0x2037c6&&_0x2037c6[_0x7f97('0x45')][0x0][_0x7f97('0x4c')]===_0x7f97('0x4d')){var _0x469b23=_0x2037c6[_0x7f97('0x45')][0x0][_0x7f97('0x4e')];_0x469b23['enduserType']=_['startCase'](_0x2eb6d4[_0x7f97('0x49')])+'s';return _0x469b23;}logger[_0x7f97('0x33')](_0x7f97('0x43'),JSON[_0x7f97('0x10')](data));throw new Error(_0x7f97('0x4f')+JSON['stringify'](data));})[_0x7f97('0x32')](function(_0x33ce30){console[_0x7f97('0x50')](_0x7f97('0x51'),_0x33ce30);});}function getEndUser(_0x450d7a,_0x153dcf,_0x15e820,_0x287187,_0x1f27ed,_0x3db60e,_0x40361c){var _0x5ae354={'method':_0x7f97('0x52'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x450d7a},'json':!![]};switch(_0x40361c['moduleSearch']){case _0x7f97('0x53'):_0x5ae354[_0x7f97('0x54')]=_0x7f97('0x55')+_0x153dcf+_0x7f97('0x56')+_0x1f27ed+'))';return getZohoUser(_0x5ae354,_0x7f97('0x57'))['then'](function(_0x4d41ca){if(_0x4d41ca)return _0x4d41ca;_0x5ae354[_0x7f97('0x54')]=_0x7f97('0x55')+_0x153dcf+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1f27ed+'))';return getZohoUser(_0x5ae354,'Leads')[_0x7f97('0x2f')](function(_0xf5a00b){if(_0xf5a00b)return _0xf5a00b;if(_0x40361c['moduleCreate']!=_0x7f97('0x58')){return createEndUser(_0x450d7a,_0x153dcf,_0x287187,_0x1f27ed,_0x3db60e,_0x40361c);}else{return{};}});});break;case'contact':_0x5ae354['uri']=_0x7f97('0x55')+_0x153dcf+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x1f27ed+'))';return getZohoUser(_0x5ae354,'Contacts')[_0x7f97('0x2f')](function(_0x23c720){if(_0x23c720)return _0x23c720;if(_0x40361c[_0x7f97('0x49')]!='nothing'){return createEndUser(_0x450d7a,_0x153dcf,_0x287187,_0x1f27ed,_0x3db60e,_0x40361c);}else{return{};}});break;case'lead':_0x5ae354[_0x7f97('0x54')]=_0x7f97('0x55')+_0x153dcf+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1f27ed+'))';return getZohoUser(_0x5ae354,'Leads')[_0x7f97('0x2f')](function(_0x1ab5f3){if(_0x1ab5f3)return _0x1ab5f3;if(_0x40361c[_0x7f97('0x49')]!=_0x7f97('0x58')){return createEndUser(_0x450d7a,_0x153dcf,_0x287187,_0x1f27ed,_0x3db60e,_0x40361c);}else{return{};}});break;}}function getCall(_0x4be27e,_0x45c635,_0x233b45,_0x256c1b,_0x3b00d5,_0x1d195b,_0x749f30,_0x4b0fff){logger['info'](_0x7f97('0x59'));var _0xc7085a={};_0xc7085a['Owner']={'name':!_[_0x7f97('0x20')](_0x256c1b['role'][_0x7f97('0x1c')])&&!_[_0x7f97('0x20')](_0x256c1b[_0x7f97('0x40')][_0x7f97('0x1c')])&&_0x256c1b[_0x7f97('0x40')]['name']===_0x7f97('0x5a')?_0x256c1b[_0x7f97('0x4a')][_0x7f97('0x1c')]:!_[_0x7f97('0x20')](_0x256c1b[_0x7f97('0x5b')])?_0x256c1b['first_name']+'\x20'+_0x256c1b[_0x7f97('0x4b')]:_0x256c1b['last_name'],'id':_0x256c1b['id']};_0xc7085a['Subject']=intUtil['getString'](_0x1d195b[_0x7f97('0x5c')],_0x749f30,'\x20');_0xc7085a['Description']=intUtil[_0x7f97('0x5d')](_0x1d195b[_0x7f97('0x5e')],_0x749f30,'\x0a');if(_0x3b00d5[_0x7f97('0x46')]==='Contacts'){_0xc7085a[_0x7f97('0x5f')]={'name':!_['isNil'](_0x3b00d5['Full_Name'])?_0x3b00d5[_0x7f97('0x60')]:!_[_0x7f97('0x20')](_0x3b00d5['First_Name'])?_0x3b00d5[_0x7f97('0x61')]+'\x20'+_0x3b00d5[_0x7f97('0x62')]:_0x3b00d5[_0x7f97('0x62')],'id':_0x3b00d5['id']};}if(_0x3b00d5[_0x7f97('0x46')]===_0x7f97('0x63')){_0xc7085a['What_Id']={'name':!_[_0x7f97('0x20')](_0x3b00d5[_0x7f97('0x60')])?_0x3b00d5[_0x7f97('0x60')]:!_[_0x7f97('0x20')](_0x3b00d5[_0x7f97('0x61')])?_0x3b00d5[_0x7f97('0x61')]+'\x20'+_0x3b00d5[_0x7f97('0x62')]:_0x3b00d5[_0x7f97('0x62')],'id':_0x3b00d5['id']};_0xc7085a[_0x7f97('0x64')]=_['startCase'](_0x3b00d5[_0x7f97('0x46')]);}if(_0x749f30[_0x7f97('0x65')]){_0xc7085a['Call_Duration']=moment[_0x7f97('0x66')](parseInt(_0x749f30[_0x7f97('0x65')])*0x3e8)['format'](_0x7f97('0x67'));}else if(_0x749f30['answertime']&&_0x749f30[_0x7f97('0x68')]){_0xc7085a[_0x7f97('0x69')]=moment[_0x7f97('0x66')](moment(_0x749f30['endtime'],_0x7f97('0x6a'))[_0x7f97('0x6b')](moment(_0x749f30[_0x7f97('0x6c')],'YYYY-MM-DDTHH:mm:ss')))[_0x7f97('0x38')](_0x7f97('0x67'));}switch(_0x749f30[_0x7f97('0x6d')]){case _0x7f97('0x6e'):_0xc7085a[_0x7f97('0x6f')]=_0x7f97('0x70');break;case _0x7f97('0x71'):case _0x7f97('0x72'):_0xc7085a[_0x7f97('0x6f')]=_0x7f97('0x73');break;case'rejected':_0xc7085a[_0x7f97('0x6f')]=_0x7f97('0x74');break;case _0x7f97('0x75'):_0xc7085a[_0x7f97('0x6f')]='Abandoned';break;case _0x7f97('0x76'):_0xc7085a[_0x7f97('0x6f')]=_0x7f97('0x77');default:}_0xc7085a[_0x7f97('0x78')]=(_0x4b0fff===_0x7f97('0x79')?moment(_0x749f30[_0x7f97('0x6c')])[_0x7f97('0x38')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x749f30[_0x7f97('0x7a')])[_0x7f97('0x38')](_0x7f97('0x6a')))||moment()[_0x7f97('0x38')](_0x7f97('0x6a'));_0xc7085a[_0x7f97('0x7b')]=_0x4b0fff||_0x7f97('0x7c');_0xc7085a=_[_0x7f97('0x7d')](_0xc7085a,getCustomFields(_0x1d195b['Fields'],_0x749f30));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x45c635+_0x7f97('0x7e'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4be27e},'body':{'data':[_0xc7085a]},'json':!![]})['then'](function(_0x21d00f){if(_0x21d00f&&_0x21d00f[_0x7f97('0x45')][0x0][_0x7f97('0x4c')]==='SUCCESS'){logger['info'](_0x7f97('0x7f'));return{'id':_0x21d00f[_0x7f97('0x45')][0x0]['details']['id']};}})[_0x7f97('0x32')](function(_0x210cb6){logger[_0x7f97('0x36')](_0x7f97('0x80'),_0x210cb6[_0x7f97('0x35')]);console[_0x7f97('0x50')](_0x7f97('0x80'),_0x210cb6);});}exports['queue']=function(_0x351d7d,_0x36fdd9,_0x4f5c40,_0x29d887,_0x112edb,_0x16fc89){var _0x5d6c30,_0x16bc5c,_0x37418a;_0x16fc89[_0x7f97('0x81')]=intUtil['stripTrailingSlash'](_0x16fc89['host']);_0x16fc89['serverUrl']=intUtil[_0x7f97('0x82')](_0x16fc89[_0x7f97('0x83')]);if(_0x112edb&&_0x112edb[_0x7f97('0x84')]){logger[_0x7f97('0x36')](_0x7f97('0x85'),_0x7f97('0x86'));_0x36fdd9[_0x7f97('0x87')]=_0x16fc89[_0x7f97('0x83')]+_0x7f97('0x88')+_0x36fdd9[_0x7f97('0x89')]+_0x7f97('0x8a')+md5(_0x36fdd9[_0x7f97('0x89')]);}else{_0x36fdd9['recordingURL']='';}var _0x475167=_0x16fc89[_0x7f97('0x81')]===_0x7f97('0x8b')?'eu':_0x7f97('0x8c');return getAccessToken(_0x16fc89)[_0x7f97('0x2f')](function(_0x785f76){_0x37418a=_0x785f76;return getUser(_0x37418a,_0x475167,_0x16fc89,_0x29d887[_0x7f97('0x8d')]);})[_0x7f97('0x2f')](function(_0x4ad550){_0x5d6c30=_0x4ad550;logger['info'](_0x7f97('0x8e'),_0x5d6c30['id']);return getEndUser(_0x37418a,_0x475167,_0x16fc89,_0x36fdd9[_0x7f97('0x8f')],_0x36fdd9[_0x7f97('0x90')],_0x5d6c30,_0x4f5c40);})['then'](function(_0x755202){_0x16bc5c=_0x755202;return getCall(_0x37418a,_0x475167,_0x16fc89,_0x5d6c30,_0x16bc5c,_0x4f5c40,_0x36fdd9,_0x7f97('0x7c'));})['then'](function(_0x4993ec){if(_0x4993ec){logger[_0x7f97('0x36')](_0x7f97('0x91'),_0x4993ec['id']);logger[_0x7f97('0x36')](_0x7f97('0x85'),_0x7f97('0x92'));emit(util['format'](_0x7f97('0x93'),_0x29d887[_0x7f97('0x1c')]),_0x7f97('0x94'),{'uri':_0x7f97('0x95')+_0x16fc89[_0x7f97('0x81')]+_0x7f97('0x96')+_0x4993ec['id']});}})[_0x7f97('0x32')](function(_0x4e60fe){logger[_0x7f97('0x33')](_0x7f97('0x85'),JSON['stringify'](_0x4e60fe));});};exports[_0x7f97('0x79')]=function(_0x1c1f5c,_0x27121b,_0x2152fb,_0x2978b7,_0x27ac8c,_0x4f375e,_0x1e8268){var _0x3175d1,_0x2f4102,_0x2f31dc;_0x4f375e[_0x7f97('0x81')]=intUtil[_0x7f97('0x82')](_0x4f375e['host']);_0x4f375e[_0x7f97('0x83')]=intUtil[_0x7f97('0x82')](_0x4f375e['serverUrl']);if(_0x1e8268&&_0x1e8268[_0x7f97('0x97')]&&_0x1e8268[_0x7f97('0x97')]!==_0x7f97('0x98')){logger[_0x7f97('0x36')](_0x7f97('0x99'),_0x7f97('0x86'));_0x27121b[_0x7f97('0x87')]=_0x4f375e[_0x7f97('0x83')]+_0x7f97('0x88')+_0x27121b[_0x7f97('0x89')]+_0x7f97('0x8a')+md5(_0x27121b['uniqueid']);}var _0x1f63d9=_0x4f375e[_0x7f97('0x81')]===_0x7f97('0x8b')?'eu':_0x7f97('0x8c');return getAccessToken(_0x4f375e)[_0x7f97('0x2f')](function(_0x10171a){_0x2f31dc=_0x10171a;return getUser(_0x2f31dc,_0x1f63d9,_0x4f375e,_0x2978b7[_0x7f97('0x8d')]);})[_0x7f97('0x2f')](function(_0x333283){_0x3175d1=_0x333283;logger[_0x7f97('0x36')](_0x7f97('0x8e'),_0x3175d1['id']);return getEndUser(_0x2f31dc,_0x1f63d9,_0x4f375e,_0x27121b[_0x7f97('0x9a')],_0x27121b['destcalleridnum'],_0x3175d1,_0x2152fb);})[_0x7f97('0x2f')](function(_0x109c55){_0x2f4102=_0x109c55;return getCall(_0x2f31dc,_0x1f63d9,_0x4f375e,_0x3175d1,_0x2f4102,_0x2152fb,_0x27121b,_0x7f97('0x9b'));})['then'](function(_0x507e9a){if(_0x507e9a){logger[_0x7f97('0x36')](_0x7f97('0x91'),_0x507e9a['id']);logger['info'](_0x7f97('0x99'),_0x7f97('0x92'));emit(util['format']('user:%s',_0x2978b7['name']),_0x7f97('0x94'),{'uri':_0x7f97('0x95')+_0x4f375e[_0x7f97('0x81')]+_0x7f97('0x96')+_0x507e9a['id']});}})['catch'](function(_0x1b407a){logger['error'](_0x7f97('0x99'),JSON[_0x7f97('0x10')](_0x1b407a));});};exports['unmanaged']=function(_0x404fc2,_0x4af0c8,_0x464d19,_0x152b9c,_0xf30a37,_0x33b136){var _0xc28714,_0x327ec0,_0x10d76c;_0x33b136[_0x7f97('0x81')]=intUtil[_0x7f97('0x82')](_0x33b136['host']);_0x33b136['serverUrl']=intUtil[_0x7f97('0x82')](_0x33b136[_0x7f97('0x83')]);if(_0xf30a37&&_0xf30a37[_0x7f97('0x84')]){logger['info']('['+_0x4af0c8[_0x7f97('0x6d')]['toUpperCase']()+']',_0x7f97('0x86'));_0x4af0c8['recordingURL']=_0x33b136[_0x7f97('0x83')]+_0x7f97('0x88')+_0x4af0c8['uniqueid']+_0x7f97('0x8a')+md5(_0x4af0c8[_0x7f97('0x89')]);}else{_0x4af0c8[_0x7f97('0x87')]='';}var _0x17f369=_0x33b136[_0x7f97('0x81')]==='zoho.eu'?'eu':_0x7f97('0x8c');return getAccessToken(_0x33b136)[_0x7f97('0x2f')](function(_0xfd8209){_0x10d76c=_0xfd8209;return getUser(_0x10d76c,_0x17f369,_0x33b136);})[_0x7f97('0x2f')](function(_0xa8b8ac){_0xc28714=_0xa8b8ac;logger['info']('The\x20User\x20ID\x20is:',_0xc28714['id']);return getEndUser(_0x10d76c,_0x17f369,_0x33b136,_0x4af0c8[_0x7f97('0x8f')],_0x4af0c8[_0x7f97('0x90')],_0xc28714,_0x464d19);})[_0x7f97('0x2f')](function(_0x5da774){_0x327ec0=_0x5da774;return getCall(_0x10d76c,_0x17f369,_0x33b136,_0xc28714,_0x327ec0,_0x464d19,_0x4af0c8,_0x7f97('0x7c'));})['then'](function(_0x33b8dc){if(_0x33b8dc){logger[_0x7f97('0x36')](_0x7f97('0x91'),_0x33b8dc['id']);}})[_0x7f97('0x32')](function(_0x451802){logger['error']('['+_0x4af0c8[_0x7f97('0x6d')][_0x7f97('0x9c')]()+']',JSON[_0x7f97('0x10')](_0x451802));});}; \ 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 88e8f3c..ac76811 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 _0x16ad=['mustache','../../../../config/logger','trigger','exec','data2','data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x29e8e9,_0x21f717){var _0xfe6c6e=function(_0x49229a){while(--_0x49229a){_0x29e8e9['push'](_0x29e8e9['shift']());}};_0xfe6c6e(++_0x21f717);}(_0x16ad,0x1e0));var _0xd16a=function(_0x5a6355,_0x2b5c5b){_0x5a6355=_0x5a6355-0x0;var _0x14b0f6=_0x16ad[_0x5a6355];return _0x14b0f6;};'use strict';var util=require('util');var sh=require('shelljs');var Mustache=require(_0xd16a('0x0'));var logger=require(_0xd16a('0x1'))(_0xd16a('0x2'));exports[_0xd16a('0x3')]=function(_0xf76364,_0x51e30c){var _0x1aa8fa=_0xf76364['data2']?_0xf76364[_0xd16a('0x4')]:'Script';var _0x32f243=_0xf76364[_0xd16a('0x5')]?Mustache[_0xd16a('0x6')](_0xf76364[_0xd16a('0x5')],_0x51e30c):_0x51e30c;sh[_0xd16a('0x3')](_0x32f243,function(_0x1a198e,_0x3c7316,_0x1b15ec){if(_0x1a198e!==0x0){logger[_0xd16a('0x7')](util['format'](_0xd16a('0x8'),_0x1aa8fa,_0x32f243,_0x1a198e,_0x1b15ec));}else{logger[_0xd16a('0x9')](util[_0xd16a('0xa')](_0xd16a('0xb'),_0x1aa8fa,_0x32f243,_0x3c7316));}});}; \ No newline at end of file +var _0xdefb=['util','shelljs','mustache','trigger','exec','data2','data3','render','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x8c1af9,_0x26296b){var _0x39269e=function(_0x246ab7){while(--_0x246ab7){_0x8c1af9['push'](_0x8c1af9['shift']());}};_0x39269e(++_0x26296b);}(_0xdefb,0x13f));var _0xbdef=function(_0x281e5e,_0xf320e2){_0x281e5e=_0x281e5e-0x0;var _0x5a22d2=_0xdefb[_0x281e5e];return _0x5a22d2;};'use strict';var util=require(_0xbdef('0x0'));var sh=require(_0xbdef('0x1'));var Mustache=require(_0xbdef('0x2'));var logger=require('../../../../config/logger')(_0xbdef('0x3'));exports[_0xbdef('0x4')]=function(_0x273c82,_0x2a074d){var _0x470390=_0x273c82[_0xbdef('0x5')]?_0x273c82['data2']:'Script';var _0x58952b=_0x273c82[_0xbdef('0x6')]?Mustache[_0xbdef('0x7')](_0x273c82[_0xbdef('0x6')],_0x2a074d):_0x2a074d;sh[_0xbdef('0x4')](_0x58952b,function(_0x1af28b,_0x57bc62,_0x18c7d0){if(_0x1af28b!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x470390,_0x58952b,_0x1af28b,_0x18c7d0));}else{logger[_0xbdef('0x8')](util[_0xbdef('0x9')](_0xbdef('0xa'),_0x470390,_0x58952b,_0x57bc62));}});}; \ 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 1148161..0ba7001 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 _0x87d7=['body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','object','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','data5','headers','parse','error','stack','GET','PUT','data7','body'];(function(_0x8d8d2d,_0x594a83){var _0x12a671=function(_0xc3196a){while(--_0xc3196a){_0x8d8d2d['push'](_0x8d8d2d['shift']());}};_0x12a671(++_0x594a83);}(_0x87d7,0x6c));var _0x787d=function(_0x1eb70d,_0x2525b1){_0x1eb70d=_0x1eb70d-0x0;var _0x397c6b=_0x87d7[_0x1eb70d];return _0x397c6b;};'use strict';var rp=require(_0x787d('0x0'));var util=require(_0x787d('0x1'));var _=require(_0x787d('0x2'));var Mustache=require(_0x787d('0x3'));var logger=require(_0x787d('0x4'))(_0x787d('0x5'));exports[_0x787d('0x6')]=function(_0x4455f5,_0x1a64f4){var _0x190722,_0x94dab1;var _0x30f2e0={'method':_0x4455f5[_0x787d('0x7')][_0x787d('0x8')](),'uri':Mustache[_0x787d('0x9')](_0x4455f5[_0x787d('0xa')],_0x1a64f4),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4455f5[_0x787d('0xb')])==='number'&&parseInt(_0x4455f5[_0x787d('0xb')])>=0x1&&parseInt(_0x4455f5[_0x787d('0xb')])<=0xa?parseInt(_0x4455f5['data5'])*0x3e8:0x5*0x3e8};try{_0x30f2e0[_0x787d('0xc')]=_0x4455f5['data6']?JSON[_0x787d('0xd')](Mustache[_0x787d('0x9')](_0x4455f5['data6'],_0x1a64f4)):{};}catch(_0x6e43fa){logger[_0x787d('0xe')](_0x6e43fa[_0x787d('0xf')]);}switch(_0x4455f5[_0x787d('0x7')][_0x787d('0x8')]()){case _0x787d('0x10'):case'DELETE':_0x190722=null;_0x30f2e0['qs']=_0x1a64f4;break;case'POST':case _0x787d('0x11'):if(_0x4455f5[_0x787d('0x12')]){try{_0x190722=JSON[_0x787d('0xd')](Mustache['render'](_0x4455f5['data7'],_0x1a64f4));_0x30f2e0[_0x787d('0x13')]=_0x190722;}catch(_0x4a07b1){logger[_0x787d('0xe')](_0x4a07b1[_0x787d('0xf')]);logger[_0x787d('0xe')](_0x787d('0x14'));}}else{_0x190722=_0x1a64f4;_0x30f2e0['body']=_0x190722;}break;}logger[_0x787d('0x15')](util['format'](_0x787d('0x16'),_0x4455f5['data1'],_0x4455f5[_0x787d('0xa')],JSON[_0x787d('0x17')](_0x30f2e0)));rp(_0x30f2e0)['then'](function(_0x549792){_0x190722=!_['isNil'](_0x190722)?_0x787d('0x18')+_0x190722:'';_0x94dab1=typeof _0x549792['body']===_0x787d('0x19')?JSON['stringify'](_0x549792[_0x787d('0x13')]):_0x549792[_0x787d('0x13')];logger[_0x787d('0x15')](util[_0x787d('0x1a')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x4455f5['data1'],_0x4455f5[_0x787d('0xa')],_0x549792[_0x787d('0x1b')],_0x94dab1));})[_0x787d('0x1c')](function(_0xfdd2f1){logger[_0x787d('0xe')](util[_0x787d('0x1a')](_0x787d('0x1d'),_0x4455f5[_0x787d('0x7')],_0x4455f5[_0x787d('0xa')],_0xfdd2f1[_0x787d('0x1b')],_0xfdd2f1[_0x787d('0x1e')],_0xfdd2f1[_0x787d('0x1f')]));});}; \ No newline at end of file +var _0xe6d3=['data6','parse','render','error','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',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','request-promise','mustache','../../../../config/logger','exec','data1','toUpperCase','data2','number','data5','headers'];(function(_0x9efe0,_0x1e7272){var _0x232a0f=function(_0x377439){while(--_0x377439){_0x9efe0['push'](_0x9efe0['shift']());}};_0x232a0f(++_0x1e7272);}(_0xe6d3,0x6a));var _0x3e6d=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xe6d3[_0x46aff0];return _0x9d78cf;};'use strict';var rp=require(_0x3e6d('0x0'));var util=require('util');var _=require('lodash');var Mustache=require(_0x3e6d('0x1'));var logger=require(_0x3e6d('0x2'))('trigger');exports[_0x3e6d('0x3')]=function(_0x2f7fda,_0x422837){var _0xe34de8,_0x4db215;var _0x24d75f={'method':_0x2f7fda[_0x3e6d('0x4')][_0x3e6d('0x5')](),'uri':Mustache['render'](_0x2f7fda[_0x3e6d('0x6')],_0x422837),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2f7fda['data5'])===_0x3e6d('0x7')&&parseInt(_0x2f7fda[_0x3e6d('0x8')])>=0x1&&parseInt(_0x2f7fda[_0x3e6d('0x8')])<=0xa?parseInt(_0x2f7fda['data5'])*0x3e8:0x5*0x3e8};try{_0x24d75f[_0x3e6d('0x9')]=_0x2f7fda[_0x3e6d('0xa')]?JSON[_0x3e6d('0xb')](Mustache[_0x3e6d('0xc')](_0x2f7fda[_0x3e6d('0xa')],_0x422837)):{};}catch(_0x1f4966){logger[_0x3e6d('0xd')](_0x1f4966['stack']);}switch(_0x2f7fda[_0x3e6d('0x4')][_0x3e6d('0x5')]()){case'GET':case'DELETE':_0xe34de8=null;_0x24d75f['qs']=_0x422837;break;case'POST':case'PUT':if(_0x2f7fda[_0x3e6d('0xe')]){try{_0xe34de8=JSON['parse'](Mustache[_0x3e6d('0xc')](_0x2f7fda[_0x3e6d('0xe')],_0x422837));_0x24d75f[_0x3e6d('0xf')]=_0xe34de8;}catch(_0x58bd2f){logger[_0x3e6d('0xd')](_0x58bd2f[_0x3e6d('0x10')]);logger[_0x3e6d('0xd')](_0x3e6d('0x11'));}}else{_0xe34de8=_0x422837;_0x24d75f[_0x3e6d('0xf')]=_0xe34de8;}break;}logger[_0x3e6d('0x12')](util[_0x3e6d('0x13')](_0x3e6d('0x14'),_0x2f7fda[_0x3e6d('0x4')],_0x2f7fda[_0x3e6d('0x6')],JSON[_0x3e6d('0x15')](_0x24d75f)));rp(_0x24d75f)[_0x3e6d('0x16')](function(_0x330011){_0xe34de8=!_['isNil'](_0xe34de8)?_0x3e6d('0x17')+_0xe34de8:'';_0x4db215=typeof _0x330011[_0x3e6d('0xf')]===_0x3e6d('0x18')?JSON[_0x3e6d('0x15')](_0x330011[_0x3e6d('0xf')]):_0x330011['body'];logger[_0x3e6d('0x12')](util[_0x3e6d('0x13')](_0x3e6d('0x19'),_0x2f7fda['data1'],_0x2f7fda[_0x3e6d('0x6')],_0x330011[_0x3e6d('0x1a')],_0x4db215));})[_0x3e6d('0x1b')](function(_0x107d3c){logger[_0x3e6d('0xd')](util[_0x3e6d('0x13')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x2f7fda['data1'],_0x2f7fda[_0x3e6d('0x6')],_0x107d3c[_0x3e6d('0x1a')],_0x107d3c[_0x3e6d('0x1c')],_0x107d3c['message']));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index c505350..9059297 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 _0x558c=['Request','request','routing','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x558c,0x13d));var _0xc558=function(_0x12e6bd,_0x433957){_0x12e6bd=_0x12e6bd-0x0;var _0x25200a=_0x558c[_0x12e6bd];return _0x25200a;};'use strict';var jayson=require(_0xc558('0x0'));var BPromise=require(_0xc558('0x1'));var logger=require(_0xc558('0x2'))('routing');var client=jayson[_0xc558('0x3')][_0xc558('0x4')]({'port':0x2329});client[_0xc558('0x5')]=function(_0x3ca54f,_0x112096){return new BPromise(function(_0x33c0db,_0x44422f){return client[_0xc558('0x6')](_0x3ca54f,_0x112096)['then'](function(_0x5d5d9a){logger['debug']('rpc',_0xc558('0x7'),_0x3ca54f,_0x112096,_0x5d5d9a);if(_0x5d5d9a['error']){logger[_0xc558('0x8')](_0xc558('0x9'),_0xc558('0x7'),_0x3ca54f,_0x5d5d9a[_0xc558('0x8')][_0xc558('0xa')],_0x112096);return _0x44422f(_0x5d5d9a[_0xc558('0x8')][_0xc558('0xa')]);}else{return _0x33c0db(_0x5d5d9a[_0xc558('0xb')]);}})[_0xc558('0xc')](function(_0x1bbb72){logger[_0xc558('0x8')](_0xc558('0x9'),_0xc558('0x7'),_0x3ca54f,_0x1bbb72,_0x112096);return _0x44422f(_0x1bbb72);});});};module[_0xc558('0xd')]=client; \ No newline at end of file +var _0x21a4=['bluebird','../../config/logger','routing','http','Request','request','then','debug','rpc','error','message','result','catch','exports','jayson/promise'];(function(_0x1d13c3,_0x3eb018){var _0x3526b7=function(_0x3bfbef){while(--_0x3bfbef){_0x1d13c3['push'](_0x1d13c3['shift']());}};_0x3526b7(++_0x3eb018);}(_0x21a4,0x1b2));var _0x421a=function(_0x3de2ba,_0x131416){_0x3de2ba=_0x3de2ba-0x0;var _0x1164d8=_0x21a4[_0x3de2ba];return _0x1164d8;};'use strict';var jayson=require(_0x421a('0x0'));var BPromise=require(_0x421a('0x1'));var logger=require(_0x421a('0x2'))(_0x421a('0x3'));var client=jayson['client'][_0x421a('0x4')]({'port':0x2329});client[_0x421a('0x5')]=function(_0x3ec5ab,_0x4a1055){return new BPromise(function(_0x4195ef,_0x3b9135){return client[_0x421a('0x6')](_0x3ec5ab,_0x4a1055)[_0x421a('0x7')](function(_0x4d1e04){logger[_0x421a('0x8')](_0x421a('0x9'),'routing',_0x3ec5ab,_0x4a1055,_0x4d1e04);if(_0x4d1e04[_0x421a('0xa')]){logger[_0x421a('0xa')]('rpc','routing',_0x3ec5ab,_0x4d1e04['error'][_0x421a('0xb')],_0x4a1055);return _0x3b9135(_0x4d1e04['error'][_0x421a('0xb')]);}else{return _0x4195ef(_0x4d1e04[_0x421a('0xc')]);}})[_0x421a('0xd')](function(_0x160b3c){logger['error'](_0x421a('0x9'),'routing',_0x3ec5ab,_0x160b3c,_0x4a1055);return _0x3b9135(_0x160b3c);});});};module[_0x421a('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index b5a9595..b668f28 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 _0x3fa7=['loginMailFrequency','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0x235350,_0x14b14a){var _0x169cf5=function(_0x3cc556){while(--_0x3cc556){_0x235350['push'](_0x235350['shift']());}};_0x169cf5(++_0x14b14a);}(_0x3fa7,0x198));var _0x73fa=function(_0x219137,_0x5ae54b){_0x219137=_0x219137-0x0;var _0x102d82=_0x3fa7[_0x219137];return _0x102d82;};'use strict';var BPromise=require(_0x73fa('0x0'));var server=require(_0x73fa('0x1'));var Realtime=require(_0x73fa('0x2'));var EmailChannel=require(_0x73fa('0x3'));var mailAccount=require(_0x73fa('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x73fa('0x5')]()[_0x73fa('0x6')](mailAccount['getMailAccounts']())[_0x73fa('0x6')](realtime[_0x73fa('0x7')]())[_0x73fa('0x6')](function(){email[_0x73fa('0x8')](realtime[_0x73fa('0x9')]);return realtime;});}function main(){return server[_0x73fa('0xa')](realtime,email)[_0x73fa('0x6')](function(){return initRealtime();})[_0x73fa('0x6')](function(){return setting[_0x73fa('0xb')]();})[_0x73fa('0x6')](function(_0x459c41){return setInterval(initRealtime,_0x459c41[_0x73fa('0xc')]*0x3e8);})['catch'](function(_0x1a5d91){console[_0x73fa('0xd')](_0x1a5d91);});}main(); \ No newline at end of file +var _0x887b=['then','getMailAccounts','initMailAccounts','listen','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','resolve'];(function(_0x7862a7,_0x1b5705){var _0x5369e4=function(_0x576c91){while(--_0x576c91){_0x7862a7['push'](_0x7862a7['shift']());}};_0x5369e4(++_0x1b5705);}(_0x887b,0x185));var _0xb887=function(_0x29cd0d,_0x1692e9){_0x29cd0d=_0x29cd0d-0x0;var _0x532210=_0x887b[_0x29cd0d];return _0x532210;};'use strict';var BPromise=require(_0xb887('0x0'));var server=require(_0xb887('0x1'));var Realtime=require(_0xb887('0x2'));var EmailChannel=require(_0xb887('0x3'));var mailAccount=require(_0xb887('0x4'));var setting=require(_0xb887('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xb887('0x6')]()[_0xb887('0x7')](mailAccount[_0xb887('0x8')]())['then'](realtime[_0xb887('0x9')]())['then'](function(){email['refresh'](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xb887('0xa')](realtime,email)[_0xb887('0x7')](function(){return initRealtime();})['then'](function(){return setting['getSettings']();})[_0xb887('0x7')](function(_0x35019e){return setInterval(initRealtime,_0x35019e['loginMailFrequency']*0x3e8);})['catch'](function(_0x51370e){console[_0xb887('0xb')](_0x51370e);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 8414b8a..7e41334 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 _0xf6ea=['defaults','localhost','socket.io-emitter','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','handleImapBox','bind','handleImapEmail','end','error','handleImapError','name','total','messages','info','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','../../../config/logger','email','redis'];(function(_0x57bd0a,_0x2977b9){var _0x4e994a=function(_0x9b6679){while(--_0x9b6679){_0x57bd0a['push'](_0x57bd0a['shift']());}};_0x4e994a(++_0x2977b9);}(_0xf6ea,0x182));var _0xaf6e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf6ea[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var moment=require(_0xaf6e('0x0'));var BPromise=require(_0xaf6e('0x1'));var md5=require(_0xaf6e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xaf6e('0x3'))(_0xaf6e('0x4'));config[_0xaf6e('0x5')]=_[_0xaf6e('0x6')](config[_0xaf6e('0x5')],{'host':_0xaf6e('0x7'),'port':0x18eb});var io=require(_0xaf6e('0x8'))(new Redis(config[_0xaf6e('0x5')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xaf6e('0x9'));var mailAccount=require(_0xaf6e('0xa'));var md5Accounts={};function EmailChannel(_0x3ac962){logger['info'](_0xaf6e('0xb'));this[_0xaf6e('0xc')]=_0x3ac962[_0xaf6e('0xc')];this[_0xaf6e('0xd')]={};this[_0xaf6e('0xe')]=new EmailSmtp();}EmailChannel[_0xaf6e('0xf')][_0xaf6e('0x10')]=function(_0x5789ca){var _0x29e32a=this['mailAccounts'][_0x5789ca];var _0x2d54dd={'id':_0x29e32a['id'],'name':_0x29e32a['name'],'key':_0x29e32a[_0xaf6e('0x11')],'active':_0x29e32a[_0xaf6e('0x12')],'Imap':{'status':_0x29e32a[_0xaf6e('0x13')][_0xaf6e('0x14')],'messageStatus':_0x29e32a[_0xaf6e('0x13')][_0xaf6e('0x15')],'total':_0x29e32a[_0xaf6e('0x13')]['total']}};if(_[_0xaf6e('0x16')](md5Accounts[_0x5789ca])){md5Accounts[_0x5789ca]={};}var _0x3775ed=md5(JSON[_0xaf6e('0x17')](_0x2d54dd));if(md5Accounts[_0x5789ca][_0xaf6e('0x2')]!==_0x3775ed){md5Accounts[_0x5789ca][_0xaf6e('0x2')]=_0x3775ed;io[_0xaf6e('0x10')](_0xaf6e('0x18'),_0x2d54dd);}};EmailChannel['prototype'][_0xaf6e('0x19')]=function(_0x98eacd){for(var _0x681df8 in _0x98eacd){if(_0x98eacd['hasOwnProperty'](_0x681df8)){if(_0x98eacd[_0x681df8][_0xaf6e('0x13')]&&_0x98eacd[_0x681df8][_0xaf6e('0x12')]){var _0x1874f1=_0x98eacd[_0x681df8][_0xaf6e('0x13')];if(!this[_0xaf6e('0xd')][_0xaf6e('0x1a')](_0x1874f1['id'])){this[_0xaf6e('0xd')][_0x1874f1['id']]=new EmailImap(_0x1874f1,_0x98eacd[_0x681df8][_0xaf6e('0x4')]);this[_0xaf6e('0xd')][_0x1874f1['id']]['on'](_0xaf6e('0x1b'),this[_0xaf6e('0x1c')][_0xaf6e('0x1d')](this,_0x681df8));this[_0xaf6e('0xd')][_0x1874f1['id']]['on'](_0xaf6e('0x4'),this[_0xaf6e('0x1e')][_0xaf6e('0x1d')](this,_0x681df8));this[_0xaf6e('0xd')][_0x1874f1['id']]['on'](_0xaf6e('0x1f'),this['handleImapEnd'][_0xaf6e('0x1d')](this,_0x681df8));this[_0xaf6e('0xd')][_0x1874f1['id']]['on'](_0xaf6e('0x20'),this[_0xaf6e('0x21')][_0xaf6e('0x1d')](this,_0x681df8));}}else{if(_[_0xaf6e('0x16')](this['mailAccounts'][_0x681df8][_0xaf6e('0x13')])){this[_0xaf6e('0xc')][_0x681df8]['Imap']={};}this[_0xaf6e('0xc')][_0x681df8]['Imap'][_0xaf6e('0x14')]='disabled';this[_0xaf6e('0xc')][_0x681df8][_0xaf6e('0x13')]['messageStatus']='';this[_0xaf6e('0x10')](_0x681df8);}}}};EmailChannel[_0xaf6e('0xf')]['handleImapBox']=function(_0x1d50b9,_0x5354d2){if(this['mailAccounts'][_0x1d50b9]){this['mailAccounts'][_0x1d50b9][_0xaf6e('0x13')][_0xaf6e('0x14')]='connected';this['mailAccounts'][_0x1d50b9][_0xaf6e('0x13')][_0xaf6e('0x15')]=_0x5354d2[_0xaf6e('0x22')];if(_0x5354d2['messages']){this[_0xaf6e('0xc')][_0x1d50b9][_0xaf6e('0x13')][_0xaf6e('0x23')]=_0x5354d2[_0xaf6e('0x24')][_0xaf6e('0x23')];}return this[_0xaf6e('0x10')](_0x1d50b9);}};EmailChannel[_0xaf6e('0xf')]['handleImapEmail']=function(_0x4731ce,_0x134754){logger[_0xaf6e('0x25')](_0xaf6e('0x26'),_0x134754[_0xaf6e('0x27')],_0x134754[_0xaf6e('0x28')],_0x134754[_0xaf6e('0x29')],_0x4731ce);if(this[_0xaf6e('0xc')][_0x4731ce]){return mailAccount[_0xaf6e('0x2a')](_0x4731ce,_0x134754)[_0xaf6e('0x2b')](function(_0x211931){if(_0x211931){logger['info'](_0xaf6e('0x2c'));}})[_0xaf6e('0x2d')](function(_0x128e9d){logger['error'](_0xaf6e('0x2e'),JSON['stringify'](_0x128e9d));});}};EmailChannel[_0xaf6e('0xf')][_0xaf6e('0x2f')]=function(_0x3e8f15){if(this['mailAccounts'][_0x3e8f15]&&this['mailAccounts'][_0x3e8f15][_0xaf6e('0x13')]){if(this[_0xaf6e('0xd')][this[_0xaf6e('0xc')][_0x3e8f15][_0xaf6e('0x13')]['id']]){delete this[_0xaf6e('0xd')][this['mailAccounts'][_0x3e8f15][_0xaf6e('0x13')]['id']];}this[_0xaf6e('0xc')][_0x3e8f15][_0xaf6e('0x13')][_0xaf6e('0x30')]=moment();this[_0xaf6e('0x10')](_0x3e8f15);}};EmailChannel[_0xaf6e('0xf')][_0xaf6e('0x21')]=function(_0x532344,_0x289f7d){if(this['mailAccounts'][_0x532344]){this[_0xaf6e('0xc')][_0x532344]['Imap'][_0xaf6e('0x14')]=_0xaf6e('0x20');this[_0xaf6e('0xc')][_0x532344][_0xaf6e('0x13')]['messageStatus']=_0x289f7d;return this[_0xaf6e('0x10')](_0x532344);}};EmailChannel[_0xaf6e('0xf')][_0xaf6e('0x31')]=function(_0x240f9f,_0x5337de){return this[_0xaf6e('0xe')][_0xaf6e('0x32')](_0x240f9f,_0x5337de);};EmailChannel['prototype'][_0xaf6e('0x33')]=function(_0x253838){var _0x45414b=this;if(this[_0xaf6e('0xc')][_0x253838['id']]){if(_[_0xaf6e('0x16')](this['mailAccounts'][_0x253838['id']][_0xaf6e('0x34')])){this[_0xaf6e('0xc')][_0x253838['id']][_0xaf6e('0x34')]={};}this[_0xaf6e('0xc')][_0x253838['id']][_0xaf6e('0x34')][_0xaf6e('0x30')]=moment();return new BPromise(function(_0x667232,_0x34ff6){return _0x45414b[_0xaf6e('0xe')][_0xaf6e('0x35')](_0x253838)[_0xaf6e('0x2b')](function(_0x131efa){_0x45414b[_0xaf6e('0xc')][_0x253838['id']][_0xaf6e('0x34')]['status']=_0xaf6e('0x36');_0x45414b[_0xaf6e('0xc')][_0x253838['id']][_0xaf6e('0x34')][_0xaf6e('0x15')]='';_0x45414b['emit'](_0x253838['id']);_0x667232(_0x131efa);})[_0xaf6e('0x2d')](function(_0x560b20){_0x45414b['mailAccounts'][_0x253838['id']][_0xaf6e('0x34')][_0xaf6e('0x14')]='error';_0x45414b['mailAccounts'][_0x253838['id']]['Smtp'][_0xaf6e('0x15')]=_0x560b20;_0x45414b[_0xaf6e('0x10')](_0x253838['id']);_0x34ff6(_0x560b20);});});}return this[_0xaf6e('0xe')][_0xaf6e('0x35')](_0x253838);};module[_0xaf6e('0x37')]=EmailChannel; \ No newline at end of file +var _0x0670=['isNil','stringify','mailAccount:update','refresh','hasOwnProperty','box','bind','handleImapEmail','handleImapEnd','error','handleImapError','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','email','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','status','Imap','messageStatus','total'];(function(_0x3a812c,_0x3b1acb){var _0x54bfdb=function(_0x543fef){while(--_0x543fef){_0x3a812c['push'](_0x3a812c['shift']());}};_0x54bfdb(++_0x3b1acb);}(_0x0670,0xc8));var _0x0067=function(_0x2a6501,_0x9c5a0e){_0x2a6501=_0x2a6501-0x0;var _0x34d3ae=_0x0670[_0x2a6501];return _0x34d3ae;};'use strict';var _=require(_0x0067('0x0'));var moment=require(_0x0067('0x1'));var BPromise=require(_0x0067('0x2'));var md5=require(_0x0067('0x3'));var Redis=require(_0x0067('0x4'));var config=require(_0x0067('0x5'));var logger=require('../../../config/logger')(_0x0067('0x6'));config[_0x0067('0x7')]=_['defaults'](config[_0x0067('0x7')],{'host':_0x0067('0x8'),'port':0x18eb});var io=require(_0x0067('0x9'))(new Redis(config[_0x0067('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x0067('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x4951ec){logger[_0x0067('0xb')](_0x0067('0xc'));this[_0x0067('0xd')]=_0x4951ec['mailAccounts'];this[_0x0067('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x0067('0xf')][_0x0067('0x10')]=function(_0x3bb214){var _0x1427ba=this['mailAccounts'][_0x3bb214];var _0x25cc34={'id':_0x1427ba['id'],'name':_0x1427ba[_0x0067('0x11')],'key':_0x1427ba[_0x0067('0x12')],'active':_0x1427ba[_0x0067('0x13')],'Imap':{'status':_0x1427ba['Imap'][_0x0067('0x14')],'messageStatus':_0x1427ba[_0x0067('0x15')][_0x0067('0x16')],'total':_0x1427ba['Imap'][_0x0067('0x17')]}};if(_[_0x0067('0x18')](md5Accounts[_0x3bb214])){md5Accounts[_0x3bb214]={};}var _0x182ad9=md5(JSON[_0x0067('0x19')](_0x25cc34));if(md5Accounts[_0x3bb214][_0x0067('0x3')]!==_0x182ad9){md5Accounts[_0x3bb214][_0x0067('0x3')]=_0x182ad9;io['emit'](_0x0067('0x1a'),_0x25cc34);}};EmailChannel[_0x0067('0xf')][_0x0067('0x1b')]=function(_0x55655f){for(var _0x140c28 in _0x55655f){if(_0x55655f[_0x0067('0x1c')](_0x140c28)){if(_0x55655f[_0x140c28][_0x0067('0x15')]&&_0x55655f[_0x140c28]['active']){var _0x334ae5=_0x55655f[_0x140c28]['Imap'];if(!this[_0x0067('0xe')][_0x0067('0x1c')](_0x334ae5['id'])){this[_0x0067('0xe')][_0x334ae5['id']]=new EmailImap(_0x334ae5,_0x55655f[_0x140c28][_0x0067('0x6')]);this[_0x0067('0xe')][_0x334ae5['id']]['on'](_0x0067('0x1d'),this['handleImapBox'][_0x0067('0x1e')](this,_0x140c28));this[_0x0067('0xe')][_0x334ae5['id']]['on'](_0x0067('0x6'),this[_0x0067('0x1f')][_0x0067('0x1e')](this,_0x140c28));this[_0x0067('0xe')][_0x334ae5['id']]['on']('end',this[_0x0067('0x20')][_0x0067('0x1e')](this,_0x140c28));this[_0x0067('0xe')][_0x334ae5['id']]['on'](_0x0067('0x21'),this[_0x0067('0x22')][_0x0067('0x1e')](this,_0x140c28));}}else{if(_[_0x0067('0x18')](this[_0x0067('0xd')][_0x140c28][_0x0067('0x15')])){this[_0x0067('0xd')][_0x140c28][_0x0067('0x15')]={};}this['mailAccounts'][_0x140c28]['Imap']['status']='disabled';this[_0x0067('0xd')][_0x140c28][_0x0067('0x15')]['messageStatus']='';this[_0x0067('0x10')](_0x140c28);}}}};EmailChannel[_0x0067('0xf')][_0x0067('0x23')]=function(_0x1000a0,_0x515840){if(this['mailAccounts'][_0x1000a0]){this[_0x0067('0xd')][_0x1000a0]['Imap']['status']=_0x0067('0x24');this['mailAccounts'][_0x1000a0][_0x0067('0x15')][_0x0067('0x16')]=_0x515840[_0x0067('0x11')];if(_0x515840[_0x0067('0x25')]){this['mailAccounts'][_0x1000a0][_0x0067('0x15')]['total']=_0x515840['messages'][_0x0067('0x17')];}return this[_0x0067('0x10')](_0x1000a0);}};EmailChannel[_0x0067('0xf')][_0x0067('0x1f')]=function(_0x1934dc,_0x3f5096){logger['info'](_0x0067('0x26'),_0x3f5096[_0x0067('0x27')],_0x3f5096[_0x0067('0x28')],_0x3f5096[_0x0067('0x29')],_0x1934dc);if(this[_0x0067('0xd')][_0x1934dc]){return mailAccount[_0x0067('0x2a')](_0x1934dc,_0x3f5096)['then'](function(_0x28ddd6){if(_0x28ddd6){logger[_0x0067('0xb')](_0x0067('0x2b'));}})[_0x0067('0x2c')](function(_0x65e2eb){logger['error'](_0x0067('0x2d'),JSON[_0x0067('0x19')](_0x65e2eb));});}};EmailChannel[_0x0067('0xf')][_0x0067('0x20')]=function(_0x5825aa){if(this[_0x0067('0xd')][_0x5825aa]&&this[_0x0067('0xd')][_0x5825aa][_0x0067('0x15')]){if(this[_0x0067('0xe')][this[_0x0067('0xd')][_0x5825aa][_0x0067('0x15')]['id']]){delete this[_0x0067('0xe')][this[_0x0067('0xd')][_0x5825aa][_0x0067('0x15')]['id']];}this[_0x0067('0xd')][_0x5825aa][_0x0067('0x15')][_0x0067('0x2e')]=moment();this[_0x0067('0x10')](_0x5825aa);}};EmailChannel[_0x0067('0xf')][_0x0067('0x22')]=function(_0x5d3b86,_0x275a54){if(this[_0x0067('0xd')][_0x5d3b86]){this[_0x0067('0xd')][_0x5d3b86][_0x0067('0x15')][_0x0067('0x14')]=_0x0067('0x21');this[_0x0067('0xd')][_0x5d3b86]['Imap'][_0x0067('0x16')]=_0x275a54;return this[_0x0067('0x10')](_0x5d3b86);}};EmailChannel[_0x0067('0xf')][_0x0067('0x2f')]=function(_0x5b4522,_0x4c94b0){return this['smtp'][_0x0067('0x30')](_0x5b4522,_0x4c94b0);};EmailChannel[_0x0067('0xf')][_0x0067('0x31')]=function(_0x393333){var _0x5d9eef=this;if(this[_0x0067('0xd')][_0x393333['id']]){if(_[_0x0067('0x18')](this['mailAccounts'][_0x393333['id']][_0x0067('0x32')])){this[_0x0067('0xd')][_0x393333['id']][_0x0067('0x32')]={};}this[_0x0067('0xd')][_0x393333['id']]['Smtp'][_0x0067('0x2e')]=moment();return new BPromise(function(_0x291f38,_0x4ffd11){return _0x5d9eef[_0x0067('0x33')][_0x0067('0x34')](_0x393333)[_0x0067('0x35')](function(_0x39498a){_0x5d9eef[_0x0067('0xd')][_0x393333['id']][_0x0067('0x32')]['status']=_0x0067('0x36');_0x5d9eef[_0x0067('0xd')][_0x393333['id']]['Smtp'][_0x0067('0x16')]='';_0x5d9eef[_0x0067('0x10')](_0x393333['id']);_0x291f38(_0x39498a);})[_0x0067('0x2c')](function(_0x5430d9){_0x5d9eef[_0x0067('0xd')][_0x393333['id']]['Smtp']['status']=_0x0067('0x21');_0x5d9eef[_0x0067('0xd')][_0x393333['id']][_0x0067('0x32')]['messageStatus']=_0x5430d9;_0x5d9eef[_0x0067('0x10')](_0x393333['id']);_0x4ffd11(_0x5430d9);});});}return this[_0x0067('0x33')][_0x0067('0x34')](_0x393333);};module[_0x0067('0x37')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index dd35c2f..e9ac9c8 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 _0xee24=['error','connect','inherits','connTimeout','authTimeout','isNil','service','user','password','host','port','tls','autotls','getHost','email','anonymous@xcally.com','prototype','openBox','handleOpenBox','handleError','emit','box','readUnseen','end','search','UNSEEN','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','upperFirst','util','imap','randomstring','mailparser','simpleParser','iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','INBOX','account','getAccount','ready','handleReady','bind','once','handleEnd'];(function(_0x17aebb,_0x1bf817){var _0x32d111=function(_0x1848d8){while(--_0x1848d8){_0x17aebb['push'](_0x17aebb['shift']());}};_0x32d111(++_0x1bf817);}(_0xee24,0x1a6));var _0x4ee2=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0xee24[_0x7148a3];return _0x52f31d;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x4ee2('0x0'));var Imap=require(_0x4ee2('0x1'));var _=require('lodash');var rs=require(_0x4ee2('0x2'));var simpleParser=require(_0x4ee2('0x3'))[_0x4ee2('0x4')];var Iconv=require(_0x4ee2('0x5'))['Iconv'];var EventEmitter=require(_0x4ee2('0x6'))[_0x4ee2('0x7')];var utils=require(_0x4ee2('0x8'));var logger=require(_0x4ee2('0x9'))('email');function EmailImap(_0x2e6e11,_0x319d9d){this[_0x4ee2('0xa')]=_0x4ee2('0xb');this[_0x4ee2('0xc')]=this[_0x4ee2('0xd')](_0x2e6e11,_0x319d9d);this[_0x4ee2('0x1')]=new Imap(this[_0x4ee2('0xc')]);this['imap']['once'](_0x4ee2('0xe'),this[_0x4ee2('0xf')][_0x4ee2('0x10')](this));this[_0x4ee2('0x1')][_0x4ee2('0x11')]('end',this[_0x4ee2('0x12')][_0x4ee2('0x10')](this));this[_0x4ee2('0x1')]['on'](_0x4ee2('0x13'),this['handleError'][_0x4ee2('0x10')](this));this[_0x4ee2('0x1')][_0x4ee2('0x14')]();}util[_0x4ee2('0x15')](EmailImap,EventEmitter);EmailImap['prototype']['getAccount']=function(_0x2357c5,_0x2bf4c2){var _0x5a3c5c={'connTimeout':_0x2357c5[_0x4ee2('0x16')]?_0x2357c5[_0x4ee2('0x16')]*0x3e8:0x2710,'authTimeout':_0x2357c5[_0x4ee2('0x17')]?_0x2357c5[_0x4ee2('0x17')]*0x3e8:0x1388};if(_[_0x4ee2('0x18')](_0x2357c5[_0x4ee2('0x19')])){if(_0x2357c5['authentication']){_0x5a3c5c[_0x4ee2('0x1a')]=_0x2357c5[_0x4ee2('0x1a')];_0x5a3c5c[_0x4ee2('0x1b')]=_0x2357c5['password'];}_0x5a3c5c[_0x4ee2('0x1c')]=_0x2357c5[_0x4ee2('0x1c')];_0x5a3c5c[_0x4ee2('0x1d')]=_0x2357c5[_0x4ee2('0x1d')]||0x3e1;if(_0x2357c5[_0x4ee2('0x1e')]){_0x5a3c5c[_0x4ee2('0x1e')]=!![];}else{_0x5a3c5c[_0x4ee2('0x1e')]=![];_0x5a3c5c[_0x4ee2('0x1f')]='required';}}else{_0x5a3c5c['user']=_0x2357c5[_0x4ee2('0x1a')];_0x5a3c5c['password']=_0x2357c5[_0x4ee2('0x1b')];_0x5a3c5c[_0x4ee2('0x1c')]=utils[_0x4ee2('0x20')](_0x2357c5[_0x4ee2('0x19')]);_0x5a3c5c[_0x4ee2('0x1d')]=0x3e1;_0x5a3c5c['tls']=!![];}_0x5a3c5c[_0x4ee2('0x21')]=_0x2bf4c2||_0x2357c5['user']||_0x4ee2('0x22');return _0x5a3c5c;};EmailImap[_0x4ee2('0x23')][_0x4ee2('0xf')]=function(){this[_0x4ee2('0x1')][_0x4ee2('0x24')](this[_0x4ee2('0xa')],![],this[_0x4ee2('0x25')]['bind'](this));};EmailImap[_0x4ee2('0x23')]['handleOpenBox']=function(_0x58f27e,_0xebd95f){if(_0x58f27e){this[_0x4ee2('0x26')](_0x58f27e,!![]);}else{this[_0x4ee2('0x27')](_0x4ee2('0x28'),_0xebd95f);this[_0x4ee2('0x29')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x404fba){if(_0x404fba){this[_0x4ee2('0x26')](_0x404fba,!![]);}else{this['imap'][_0x4ee2('0x2a')]();}};EmailImap['prototype']['readUnseen']=function(){this['imap'][_0x4ee2('0x2b')]([_0x4ee2('0x2c')],this['handleReadUnseen'][_0x4ee2('0x10')](this));};EmailImap[_0x4ee2('0x23')]['handleReadUnseen']=function(_0xc7df80,_0x4bf072){if(_0xc7df80){this[_0x4ee2('0x26')](_0xc7df80,!![]);}else{if(_0x4bf072[_0x4ee2('0x2d')]){try{var _0x1fea65=this['imap']['fetch'](_0x4bf072,{'bodies':'','markSeen':!![]});_0x1fea65['on'](_0x4ee2('0x2e'),this[_0x4ee2('0x2f')][_0x4ee2('0x10')](this));_0x1fea65['once'](_0x4ee2('0x13'),this[_0x4ee2('0x30')][_0x4ee2('0x10')](this));_0x1fea65[_0x4ee2('0x11')](_0x4ee2('0x2a'),this[_0x4ee2('0x31')][_0x4ee2('0x10')](this));}catch(_0x250fc7){logger[_0x4ee2('0x13')](_0x250fc7);}}else{this[_0x4ee2('0x1')][_0x4ee2('0x32')](!![],this[_0x4ee2('0x33')]['bind'](this));}}};EmailImap[_0x4ee2('0x23')][_0x4ee2('0x2f')]=function(_0x5c4ab7,_0x16ea20){_0x5c4ab7['on'](_0x4ee2('0x34'),this[_0x4ee2('0x35')][_0x4ee2('0x10')](this));_0x5c4ab7[_0x4ee2('0x11')](_0x4ee2('0x36'),this[_0x4ee2('0x37')]['bind'](this));_0x5c4ab7[_0x4ee2('0x11')](_0x4ee2('0x2a'),this[_0x4ee2('0x38')]['bind'](this));};EmailImap[_0x4ee2('0x23')]['handleMessageBody']=function(_0x1079b6,_0x3f833d){simpleParser(_0x1079b6,{'Iconv':Iconv},this[_0x4ee2('0x39')][_0x4ee2('0x10')](this));};EmailImap[_0x4ee2('0x23')][_0x4ee2('0x37')]=function(_0x57850d){};EmailImap['prototype'][_0x4ee2('0x38')]=function(){};EmailImap[_0x4ee2('0x23')][_0x4ee2('0x39')]=function(_0x3f95e8,_0x264fe3){if(_0x3f95e8){logger[_0x4ee2('0x13')](_0x3f95e8);}else{var _0x938e4d=this;utils[_0x4ee2('0x3a')](this[_0x4ee2('0xc')],_0x264fe3,function(_0x11b091){_0x938e4d['emit']('email',_0x11b091);});}};EmailImap[_0x4ee2('0x23')][_0x4ee2('0x31')]=function(){this[_0x4ee2('0x1')]['closeBox'](!![],this[_0x4ee2('0x33')][_0x4ee2('0x10')](this));};EmailImap[_0x4ee2('0x23')][_0x4ee2('0x30')]=function(_0x31901e){this[_0x4ee2('0x26')](_0x31901e);this[_0x4ee2('0x1')][_0x4ee2('0x32')](!![],this[_0x4ee2('0x33')][_0x4ee2('0x10')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0x4ee2('0x27')](_0x4ee2('0x2a'));};EmailImap[_0x4ee2('0x23')]['handleError']=function(_0x1ef1d5,_0x56fd09){logger[_0x4ee2('0x13')]('handleError',this[_0x4ee2('0xc')][_0x4ee2('0x21')],JSON[_0x4ee2('0x3b')](_0x1ef1d5));var _0x5bc5f3='';if(_0x1ef1d5){if(_0x1ef1d5[_0x4ee2('0x3c')]){_0x5bc5f3=_0x1ef1d5['textCode'];}else{for(var _0x29bca3 in _0x1ef1d5){if(_0x1ef1d5[_0x4ee2('0x3d')](_0x29bca3)){_0x5bc5f3+=_[_0x4ee2('0x3e')](_0x29bca3)+':\x20'+_0x1ef1d5[_0x29bca3]+'\x0a';}}}}if(_0x56fd09){this[_0x4ee2('0x1')]['end']();}else{this[_0x4ee2('0x27')](_0x4ee2('0x13'),_0x5bc5f3);this['emit'](_0x4ee2('0x2a'));}};module['exports']=EmailImap; \ No newline at end of file +var _0x3685=['events','EventEmitter','./utils','email','mailbox','account','getAccount','once','ready','handleReady','end','bind','connect','inherits','prototype','connTimeout','authTimeout','isNil','authentication','user','password','host','port','autotls','required','getHost','service','tls','anonymous@xcally.com','openBox','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchError','handleFetchEnd','error','closeBox','handleFetchMessage','handleMessageBody','attributes','handleMessageEnd','handleMessageAttributes','handleSimpleParser','emit','handleError','handleEnd','stringify','textCode','upperFirst','exports','path','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x3685,0xf8));var _0x5368=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3685[_0x20a584];return _0x4b41a8;};'use strict';var fs=require('fs');var path=require(_0x5368('0x0'));var util=require('util');var Imap=require(_0x5368('0x1'));var _=require(_0x5368('0x2'));var rs=require(_0x5368('0x3'));var simpleParser=require(_0x5368('0x4'))[_0x5368('0x5')];var Iconv=require(_0x5368('0x6'))[_0x5368('0x7')];var EventEmitter=require(_0x5368('0x8'))[_0x5368('0x9')];var utils=require(_0x5368('0xa'));var logger=require('../../../config/logger')(_0x5368('0xb'));function EmailImap(_0x2529a2,_0x39223d){this[_0x5368('0xc')]='INBOX';this[_0x5368('0xd')]=this[_0x5368('0xe')](_0x2529a2,_0x39223d);this[_0x5368('0x1')]=new Imap(this[_0x5368('0xd')]);this[_0x5368('0x1')][_0x5368('0xf')](_0x5368('0x10'),this[_0x5368('0x11')]['bind'](this));this[_0x5368('0x1')][_0x5368('0xf')](_0x5368('0x12'),this['handleEnd'][_0x5368('0x13')](this));this[_0x5368('0x1')]['on']('error',this['handleError']['bind'](this));this[_0x5368('0x1')][_0x5368('0x14')]();}util[_0x5368('0x15')](EmailImap,EventEmitter);EmailImap[_0x5368('0x16')][_0x5368('0xe')]=function(_0x2f18dd,_0x173cd2){var _0x3bedbd={'connTimeout':_0x2f18dd[_0x5368('0x17')]?_0x2f18dd[_0x5368('0x17')]*0x3e8:0x2710,'authTimeout':_0x2f18dd['authTimeout']?_0x2f18dd[_0x5368('0x18')]*0x3e8:0x1388};if(_[_0x5368('0x19')](_0x2f18dd['service'])){if(_0x2f18dd[_0x5368('0x1a')]){_0x3bedbd[_0x5368('0x1b')]=_0x2f18dd[_0x5368('0x1b')];_0x3bedbd[_0x5368('0x1c')]=_0x2f18dd['password'];}_0x3bedbd[_0x5368('0x1d')]=_0x2f18dd['host'];_0x3bedbd['port']=_0x2f18dd[_0x5368('0x1e')]||0x3e1;if(_0x2f18dd['tls']){_0x3bedbd['tls']=!![];}else{_0x3bedbd['tls']=![];_0x3bedbd[_0x5368('0x1f')]=_0x5368('0x20');}}else{_0x3bedbd[_0x5368('0x1b')]=_0x2f18dd['user'];_0x3bedbd['password']=_0x2f18dd[_0x5368('0x1c')];_0x3bedbd[_0x5368('0x1d')]=utils[_0x5368('0x21')](_0x2f18dd[_0x5368('0x22')]);_0x3bedbd[_0x5368('0x1e')]=0x3e1;_0x3bedbd[_0x5368('0x23')]=!![];}_0x3bedbd[_0x5368('0xb')]=_0x173cd2||_0x2f18dd[_0x5368('0x1b')]||_0x5368('0x24');return _0x3bedbd;};EmailImap[_0x5368('0x16')]['handleReady']=function(){this[_0x5368('0x1')][_0x5368('0x25')](this[_0x5368('0xc')],![],this[_0x5368('0x26')][_0x5368('0x13')](this));};EmailImap[_0x5368('0x16')][_0x5368('0x26')]=function(_0x5d32ff,_0x47c30f){if(_0x5d32ff){this['handleError'](_0x5d32ff,!![]);}else{this['emit'](_0x5368('0x27'),_0x47c30f);this[_0x5368('0x28')]();}};EmailImap[_0x5368('0x16')][_0x5368('0x29')]=function(_0x131722){if(_0x131722){this['handleError'](_0x131722,!![]);}else{this[_0x5368('0x1')][_0x5368('0x12')]();}};EmailImap[_0x5368('0x16')][_0x5368('0x28')]=function(){this[_0x5368('0x1')][_0x5368('0x2a')]([_0x5368('0x2b')],this[_0x5368('0x2c')][_0x5368('0x13')](this));};EmailImap[_0x5368('0x16')][_0x5368('0x2c')]=function(_0x46ea22,_0x7449cd){if(_0x46ea22){this['handleError'](_0x46ea22,!![]);}else{if(_0x7449cd[_0x5368('0x2d')]){try{var _0x256abd=this[_0x5368('0x1')]['fetch'](_0x7449cd,{'bodies':'','markSeen':!![]});_0x256abd['on'](_0x5368('0x2e'),this['handleFetchMessage'][_0x5368('0x13')](this));_0x256abd[_0x5368('0xf')]('error',this[_0x5368('0x2f')][_0x5368('0x13')](this));_0x256abd['once']('end',this[_0x5368('0x30')][_0x5368('0x13')](this));}catch(_0x5df0bc){logger[_0x5368('0x31')](_0x5df0bc);}}else{this[_0x5368('0x1')][_0x5368('0x32')](!![],this['handleCloseBox'][_0x5368('0x13')](this));}}};EmailImap['prototype'][_0x5368('0x33')]=function(_0x16f6a6,_0x7ec790){_0x16f6a6['on']('body',this[_0x5368('0x34')][_0x5368('0x13')](this));_0x16f6a6[_0x5368('0xf')](_0x5368('0x35'),this['handleMessageAttributes'][_0x5368('0x13')](this));_0x16f6a6['once'](_0x5368('0x12'),this[_0x5368('0x36')]['bind'](this));};EmailImap[_0x5368('0x16')][_0x5368('0x34')]=function(_0x46e59a,_0x3d65a8){simpleParser(_0x46e59a,{'Iconv':Iconv},this['handleSimpleParser'][_0x5368('0x13')](this));};EmailImap[_0x5368('0x16')][_0x5368('0x37')]=function(_0x1ec050){};EmailImap[_0x5368('0x16')]['handleMessageEnd']=function(){};EmailImap[_0x5368('0x16')][_0x5368('0x38')]=function(_0x4e2d3e,_0x1e16ca){if(_0x4e2d3e){logger[_0x5368('0x31')](_0x4e2d3e);}else{var _0x20e24c=this;utils['parser'](this[_0x5368('0xd')],_0x1e16ca,function(_0x3f9f1b){_0x20e24c[_0x5368('0x39')](_0x5368('0xb'),_0x3f9f1b);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0x5368('0x1')][_0x5368('0x32')](!![],this[_0x5368('0x29')]['bind'](this));};EmailImap['prototype'][_0x5368('0x2f')]=function(_0x5ae3f1){this[_0x5368('0x3a')](_0x5ae3f1);this[_0x5368('0x1')]['closeBox'](!![],this[_0x5368('0x29')][_0x5368('0x13')](this));};EmailImap[_0x5368('0x16')][_0x5368('0x3b')]=function(){this[_0x5368('0x39')](_0x5368('0x12'));};EmailImap[_0x5368('0x16')][_0x5368('0x3a')]=function(_0x48c86,_0x43c776){logger[_0x5368('0x31')](_0x5368('0x3a'),this['account'][_0x5368('0xb')],JSON[_0x5368('0x3c')](_0x48c86));var _0xd4e247='';if(_0x48c86){if(_0x48c86['textCode']){_0xd4e247=_0x48c86[_0x5368('0x3d')];}else{for(var _0x386558 in _0x48c86){if(_0x48c86['hasOwnProperty'](_0x386558)){_0xd4e247+=_[_0x5368('0x3e')](_0x386558)+':\x20'+_0x48c86[_0x386558]+'\x0a';}}}}if(_0x43c776){this[_0x5368('0x1')][_0x5368('0x12')]();}else{this[_0x5368('0x39')](_0x5368('0x31'),_0xd4e247);this[_0x5368('0x39')](_0x5368('0x12'));}};module[_0x5368('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index d626b0c..043e787 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 _0x8886=['verify','createTransport','Not\x20verifired','nodemailer','bluebird','prototype','send','sendMail'];(function(_0x8c78,_0x3b91c2){var _0x384510=function(_0x92d7a2){while(--_0x92d7a2){_0x8c78['push'](_0x8c78['shift']());}};_0x384510(++_0x3b91c2);}(_0x8886,0xcb));var _0x6888=function(_0x607427,_0x2e1181){_0x607427=_0x607427-0x0;var _0x3d096c=_0x8886[_0x607427];return _0x3d096c;};'use strict';var nodemailer=require(_0x6888('0x0'));var BPromise=require(_0x6888('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x6888('0x2')][_0x6888('0x3')]=function(_0x5529ad,_0x52ee81){return new BPromise(function(_0xa1b7d1,_0x9f8ff){var _0x162bac=nodemailer['createTransport'](_0x5529ad);_0x162bac['use']('compile',inlineBase64());_0x162bac[_0x6888('0x4')](_0x52ee81,function(_0x49681a,_0x50aec8){if(_0x49681a){_0x9f8ff(_0x49681a['toString']());}else{_0xa1b7d1(_0x50aec8);}});});};EmailSmtp[_0x6888('0x2')][_0x6888('0x5')]=function(_0x22d966){return new BPromise(function(_0x588418,_0x47c5fa){var _0x364400=nodemailer[_0x6888('0x6')](_0x22d966);_0x364400[_0x6888('0x5')](function(_0x410d2c,_0x5139bc){if(_0x410d2c){_0x47c5fa(_0x410d2c['toString']());}else{if(_0x5139bc){_0x588418(_0x5139bc);}else{_0x47c5fa(_0x6888('0x7'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x165a=['prototype','send','createTransport','compile','sendMail','verify','toString','Not\x20verifired','exports','bluebird'];(function(_0x27d219,_0x4206d1){var _0xe1159b=function(_0x3d5937){while(--_0x3d5937){_0x27d219['push'](_0x27d219['shift']());}};_0xe1159b(++_0x4206d1);}(_0x165a,0x1a3));var _0xa165=function(_0x2025f0,_0x1807d8){_0x2025f0=_0x2025f0-0x0;var _0x30b7a7=_0x165a[_0x2025f0];return _0x30b7a7;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0xa165('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xa165('0x1')][_0xa165('0x2')]=function(_0x2ba628,_0x540d20){return new BPromise(function(_0x5227bc,_0x844135){var _0x83bbd5=nodemailer[_0xa165('0x3')](_0x2ba628);_0x83bbd5['use'](_0xa165('0x4'),inlineBase64());_0x83bbd5[_0xa165('0x5')](_0x540d20,function(_0x434bb3,_0x66e2fb){if(_0x434bb3){_0x844135(_0x434bb3['toString']());}else{_0x5227bc(_0x66e2fb);}});});};EmailSmtp[_0xa165('0x1')][_0xa165('0x6')]=function(_0x5738b2){return new BPromise(function(_0x278f3e,_0x50846a){var _0x2145a8=nodemailer[_0xa165('0x3')](_0x5738b2);_0x2145a8[_0xa165('0x6')](function(_0x55cd1e,_0xe32946){if(_0x55cd1e){_0x50846a(_0x55cd1e[_0xa165('0x7')]());}else{if(_0xe32946){_0x278f3e(_0xe32946);}else{_0x50846a(_0xa165('0x8'));}}});});};module[_0xa165('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index f1d5504..8a138c7 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 _0x5f66=['outlook.office365.com','127.0.0.1','moment','path','util','node-tnef','../../../config/logger','email','head','value','anonymous','generate','@xcally.com','name','split','length','join','pop','isEmpty','address','html','test','replace','\x20[Attachment:\x20','body','Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365'];(function(_0xcc4ab5,_0x415248){var _0x545144=function(_0xc9741e){while(--_0xc9741e){_0xcc4ab5['push'](_0xcc4ab5['shift']());}};_0x545144(++_0x415248);}(_0x5f66,0x1a0));var _0x65f6=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5f66[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var random=require('randomstring');var fs=require('fs');var path=require(_0x65f6('0x1'));var util=require(_0x65f6('0x2'));var tnef=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../../config/environment');function getAddress(_0x3c5029){var _0x5150c8=_[_0x65f6('0x6')](_0x3c5029[_0x65f6('0x7')]);return _0x5150c8&&_0x5150c8['address']?_0x5150c8['address']:_0x65f6('0x8')+random[_0x65f6('0x9')](0x6)+_0x65f6('0xa');}function getFirstName(_0x8f6451){var _0xc44c70=_[_0x65f6('0x6')](_0x8f6451['value']);if(_0xc44c70&&_0xc44c70['name']){var _0x18fea1=_0xc44c70[_0x65f6('0xb')][_0x65f6('0xc')](/\s+/);return _0x18fea1[_0x65f6('0xd')]?_0x18fea1['slice'](0x0,-0x1)[_0x65f6('0xe')]('\x20'):_0xc44c70['name'];}return'Anonymous';}function getLastName(_0x2d2dfa){var _0x576875=_[_0x65f6('0x6')](_0x2d2dfa['value']);if(_0x576875&&_0x576875[_0x65f6('0xb')]){var _0x186a6a=_0x576875[_0x65f6('0xb')][_0x65f6('0xc')](/\s+/);return _0x186a6a[_0x65f6('0xd')]>0x1?_0x186a6a[_0x65f6('0xf')]():'';}return'';}function getMails(_0x44144b,_0xb1d40a){var _0x46dbc6='';for(var _0x3440af=0x0;_0x3440af<_0xb1d40a['value'][_0x65f6('0xd')];_0x3440af+=0x1){if(_0xb1d40a['value'][_0x3440af]['address']!==_0x44144b){if(!_[_0x65f6('0x10')](_0x46dbc6)){_0x46dbc6+=',';}_0x46dbc6+=_0xb1d40a[_0x65f6('0x7')][_0x3440af][_0x65f6('0xb')]||_0xb1d40a[_0x65f6('0x7')][_0x3440af][_0x65f6('0x11')]||'';_0x46dbc6+='\x20<';_0x46dbc6+=_0xb1d40a[_0x65f6('0x7')][_0x3440af][_0x65f6('0x11')]?_0xb1d40a[_0x65f6('0x7')][_0x3440af]['address']:'anonymous'+random[_0x65f6('0x9')](0x6)+'@xcally.com';_0x46dbc6+='>';}}return _0x46dbc6;}function parseEmail(_0x4c81f3,_0x5c5b91,_0x365159){if(_0x5c5b91[_0x65f6('0x12')]){var _0x5114a4=/)<[^<]*)*<\/script>/gi;while(_0x5114a4[_0x65f6('0x13')](_0x5c5b91[_0x65f6('0x12')])){_0x5c5b91[_0x65f6('0x12')]=_0x5c5b91[_0x65f6('0x12')][_0x65f6('0x14')](_0x5114a4,'');}if(_0x5c5b91[_0x65f6('0x12')]['includes'](_0x65f6('0x15'))){var _0x4bb39e=[];_0x5c5b91['attachments'][_0x65f6('0x16')](_0xd173f4=>{_0x4bb39e['push'](_0xd173f4[_0x65f6('0x17')]);});var _0x471a33=/]+>/g;var _0x2317ce=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x2774a1=_0x5c5b91['html'][_0x65f6('0x14')](_0x2317ce,_0x65f6('0x18'));var _0x20a161=_0x2774a1['replace'](_0x471a33,'_IMG');for(let _0x4fde2f=0x0;_0x4fde2f<_0x4bb39e[_0x65f6('0xd')];_0x4fde2f++){var _0x16cde8=_0x20a161['replace'](_0x65f6('0x19'),_0x65f6('0x1a')+_0x4bb39e[_0x4fde2f]+'\x20]');_0x20a161=_0x16cde8;}_0x5c5b91[_0x65f6('0x12')]=_0x20a161;}_0x365159[_0x65f6('0x1b')]=_0x5c5b91[_0x65f6('0x12')];}else{_0x365159['body']=_0x5c5b91['textAsHtml'];}if(_0x365159['body']){_0x365159[_0x65f6('0x1b')]=_0x365159[_0x65f6('0x1b')][_0x65f6('0x14')](/\x20[Attachment:\x20','body','textAsHtml','message','originTo','isEmpty','originCc','bcc','attach','type','attachment','attachment-','format','%s-%s','now','server/files/attachments/','content','from','messageId','date','filter','application/ms-tnef','info','BodyHTML','Attachments','Data','

Empty\x20message

','getHost','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','@xcally.com','name','length'];(function(_0x4cbaa5,_0x3c0f0e){var _0x5c6198=function(_0x1a0a0c){while(--_0x1a0a0c){_0x4cbaa5['push'](_0x4cbaa5['shift']());}};_0x5c6198(++_0x3c0f0e);}(_0x5c3c,0x132));var _0xc5c3=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x5c3c[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xc5c3('0x0'));var moment=require(_0xc5c3('0x1'));var random=require(_0xc5c3('0x2'));var fs=require('fs');var path=require(_0xc5c3('0x3'));var util=require('util');var tnef=require(_0xc5c3('0x4'));var logger=require(_0xc5c3('0x5'))(_0xc5c3('0x6'));var config=require(_0xc5c3('0x7'));function getAddress(_0x2535e0){var _0x36525d=_[_0xc5c3('0x8')](_0x2535e0[_0xc5c3('0x9')]);return _0x36525d&&_0x36525d[_0xc5c3('0xa')]?_0x36525d['address']:'anonymous'+random['generate'](0x6)+_0xc5c3('0xb');}function getFirstName(_0x522be1){var _0x593b35=_[_0xc5c3('0x8')](_0x522be1[_0xc5c3('0x9')]);if(_0x593b35&&_0x593b35['name']){var _0x14140f=_0x593b35[_0xc5c3('0xc')]['split'](/\s+/);return _0x14140f[_0xc5c3('0xd')]?_0x14140f[_0xc5c3('0xe')](0x0,-0x1)[_0xc5c3('0xf')]('\x20'):_0x593b35['name'];}return _0xc5c3('0x10');}function getLastName(_0x6d6a29){var _0x532065=_[_0xc5c3('0x8')](_0x6d6a29[_0xc5c3('0x9')]);if(_0x532065&&_0x532065[_0xc5c3('0xc')]){var _0x5ce47d=_0x532065[_0xc5c3('0xc')][_0xc5c3('0x11')](/\s+/);return _0x5ce47d[_0xc5c3('0xd')]>0x1?_0x5ce47d[_0xc5c3('0x12')]():'';}return'';}function getMails(_0xc8a636,_0x5f34bb){var _0x5c0341='';for(var _0x4445ea=0x0;_0x4445ea<_0x5f34bb[_0xc5c3('0x9')][_0xc5c3('0xd')];_0x4445ea+=0x1){if(_0x5f34bb[_0xc5c3('0x9')][_0x4445ea]['address']!==_0xc8a636){if(!_['isEmpty'](_0x5c0341)){_0x5c0341+=',';}_0x5c0341+=_0x5f34bb[_0xc5c3('0x9')][_0x4445ea]['name']||_0x5f34bb[_0xc5c3('0x9')][_0x4445ea][_0xc5c3('0xa')]||'';_0x5c0341+='\x20<';_0x5c0341+=_0x5f34bb[_0xc5c3('0x9')][_0x4445ea][_0xc5c3('0xa')]?_0x5f34bb[_0xc5c3('0x9')][_0x4445ea]['address']:_0xc5c3('0x13')+random[_0xc5c3('0x14')](0x6)+_0xc5c3('0xb');_0x5c0341+='>';}}return _0x5c0341;}function parseEmail(_0x2b582a,_0x4e570f,_0x25ef16){if(_0x4e570f[_0xc5c3('0x15')]){var _0x3cc612=/)<[^<]*)*<\/script>/gi;while(_0x3cc612[_0xc5c3('0x16')](_0x4e570f[_0xc5c3('0x15')])){_0x4e570f['html']=_0x4e570f[_0xc5c3('0x15')][_0xc5c3('0x17')](_0x3cc612,'');}if(_0x4e570f[_0xc5c3('0x15')][_0xc5c3('0x18')](_0xc5c3('0x19'))){var _0x67445=[];_0x4e570f[_0xc5c3('0x1a')]['forEach'](_0x52d638=>{_0x67445[_0xc5c3('0x1b')](_0x52d638[_0xc5c3('0x1c')]);});var _0x53ab72=/]+>/g;var _0x5c7329=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x23e2fb=_0x4e570f[_0xc5c3('0x15')][_0xc5c3('0x17')](_0x5c7329,'_SRC');var _0x4af067=_0x23e2fb[_0xc5c3('0x17')](_0x53ab72,_0xc5c3('0x1d'));for(let _0x20c506=0x0;_0x20c506<_0x67445[_0xc5c3('0xd')];_0x20c506++){var _0x5caf85=_0x4af067[_0xc5c3('0x17')]('_IMG',_0xc5c3('0x1e')+_0x67445[_0x20c506]+'\x20]');_0x4af067=_0x5caf85;}_0x4e570f[_0xc5c3('0x15')]=_0x4af067;}_0x25ef16[_0xc5c3('0x1f')]=_0x4e570f[_0xc5c3('0x15')];}else{_0x25ef16[_0xc5c3('0x1f')]=_0x4e570f[_0xc5c3('0x20')];}if(_0x25ef16[_0xc5c3('0x1f')]){_0x25ef16[_0xc5c3('0x1f')]=_0x25ef16['body'][_0xc5c3('0x17')](/Empty\x20message

';if(_0x55be1d[_0xc5c3('0x36')]){for(var _0x4ffc5a=0x0;_0x4ffc5a<_0x55be1d[_0xc5c3('0x36')][_0xc5c3('0xd')];_0x4ffc5a++){var _0x508ebf=_0x55be1d[_0xc5c3('0x36')][_0x4ffc5a];_0x3e12ee['message'][_0xc5c3('0x1a')][_0xc5c3('0x1b')]({'filename':_0x508ebf['Title'],'content':new Buffer(_0x508ebf[_0xc5c3('0x37')])});}}}_0x53f4e3(parseEmail(_0x17e263,_0xa7cb91,_0x3e12ee));});}else{_0xa7cb91[_0xc5c3('0x15')]=_0xc5c3('0x38');_0x53f4e3(parseEmail(_0x17e263,_0xa7cb91,_0x3e12ee));}}else{_0x53f4e3(parseEmail(_0x17e263,_0xa7cb91,_0x3e12ee));}};exports[_0xc5c3('0x39')]=function(_0x450c46){switch(_0x450c46){case _0xc5c3('0x3a'):return'imap.gmail.com';case _0xc5c3('0x3b'):return _0xc5c3('0x3c');case _0xc5c3('0x3d'):return _0xc5c3('0x3e');case _0xc5c3('0x3f'):return'outlook.office365.com';}return'127.0.0.1';}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 31fe30c..df98b8b 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 _0x1634=['Imap','Smtp','exports','lodash','name','key','SERV','active'];(function(_0x4f46f1,_0x2a39b9){var _0x5e146b=function(_0x5aed22){while(--_0x5aed22){_0x4f46f1['push'](_0x4f46f1['shift']());}};_0x5e146b(++_0x2a39b9);}(_0x1634,0x9b));var _0x4163=function(_0x129470,_0x55e304){_0x129470=_0x129470-0x0;var _0x497663=_0x1634[_0x129470];return _0x497663;};'use strict';var _=require(_0x4163('0x0'));function MailAccount(_0x2cdb32){this['id']=_0x2cdb32['id']||0x0;this[_0x4163('0x1')]=_0x2cdb32[_0x4163('0x1')]||'Service';this[_0x4163('0x2')]=_0x2cdb32['key']||_0x4163('0x3');this[_0x4163('0x4')]=_0x2cdb32[_0x4163('0x4')]||![];this['Imap']=_0x2cdb32[_0x4163('0x5')]||[];this[_0x4163('0x6')]=_0x2cdb32[_0x4163('0x6')]||[];}module[_0x4163('0x7')]=MailAccount; \ No newline at end of file +var _0x8ee1=['SERV','active','Imap','Smtp','lodash','name','key'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8ee1,0x1a8));var _0x18ee=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0x8ee1[_0x10d670];return _0x20d6f8;};'use strict';var _=require(_0x18ee('0x0'));function MailAccount(_0x150d3c){this['id']=_0x150d3c['id']||0x0;this['name']=_0x150d3c[_0x18ee('0x1')]||'Service';this[_0x18ee('0x2')]=_0x150d3c[_0x18ee('0x2')]||_0x18ee('0x3');this['active']=_0x150d3c[_0x18ee('0x4')]||![];this[_0x18ee('0x5')]=_0x150d3c[_0x18ee('0x5')]||[];this[_0x18ee('0x6')]=_0x150d3c[_0x18ee('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 68b7610..e330548 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 _0xdb2a=['isUndefined','merge','exports','lodash','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x5b3950,_0x4e5556){var _0x41e436=function(_0x139e30){while(--_0x139e30){_0x5b3950['push'](_0x5b3950['shift']());}};_0x41e436(++_0x4e5556);}(_0xdb2a,0xf3));var _0xadb2=function(_0x424f7c,_0x5806ef){_0x424f7c=_0x424f7c-0x0;var _0x16574e=_0xdb2a[_0x424f7c];return _0x16574e;};'use strict';var _=require(_0xadb2('0x0'));var MailAccount=require(_0xadb2('0x1'));var Realtime=function(){this[_0xadb2('0x2')]={};};function freeIsNotKey(_0x3e46f5,_0x5d0839,_0x5711df){var _0x38928a=_[_0xadb2('0x3')](_0x3e46f5,function(_0x594304,_0x1b832b){return _0x594304[_0x5711df];});for(var _0x5d3573 in _0x5d0839){if(_0x5d0839[_0xadb2('0x4')](_0x5d3573)){if(!_0x38928a[_0x5d3573]){delete _0x5d0839[_0x5d3573];}}}}Realtime[_0xadb2('0x5')][_0xadb2('0x6')]=function(_0x3cfa3d,_0x15755a){for(var _0x4a221f in _0x15755a){if(_0x3cfa3d[_0xadb2('0x4')](_0x4a221f)){_0x3cfa3d[_0x4a221f]=_0x15755a[_0x4a221f];}}};Realtime[_0xadb2('0x5')][_0xadb2('0x7')]=function(){var _0xae5514=this;return function(_0x5c8689){if(_0x5c8689){freeIsNotKey(_0x5c8689,_0xae5514[_0xadb2('0x2')],'id');for(var _0x5418d8=0x0,_0x31febf={},_0x4b8c7e={};_0x5418d8<_0x5c8689[_0xadb2('0x8')];_0x5418d8+=0x1){_0x31febf=_0x5c8689[_0x5418d8];if(_[_0xadb2('0x9')](_0xae5514[_0xadb2('0x2')][_0x31febf['id']])){_0xae5514[_0xadb2('0x2')][_0x31febf['id']]=new MailAccount(_0x31febf);}else{_[_0xadb2('0xa')](_0xae5514[_0xadb2('0x2')][_0x31febf['id']],_0x31febf);}}}return _0xae5514['mailAccounts'];};};module[_0xadb2('0xb')]=Realtime; \ No newline at end of file +var _0x0ed1=['hasOwnProperty','prototype','mergeFromDatabase','length','isUndefined','mailAccounts','exports','lodash','../model/mailAccount','mapKeys'];(function(_0x28f632,_0x19c6b5){var _0x1bbfa2=function(_0x403808){while(--_0x403808){_0x28f632['push'](_0x28f632['shift']());}};_0x1bbfa2(++_0x19c6b5);}(_0x0ed1,0x13d));var _0x10ed=function(_0x44bf79,_0x524dcb){_0x44bf79=_0x44bf79-0x0;var _0x1971fd=_0x0ed1[_0x44bf79];return _0x1971fd;};'use strict';var _=require(_0x10ed('0x0'));var MailAccount=require(_0x10ed('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x10bc7e,_0xa257f8,_0x4e4ef9){var _0x2f57d3=_[_0x10ed('0x2')](_0x10bc7e,function(_0x53d15e,_0x571053){return _0x53d15e[_0x4e4ef9];});for(var _0x1d0d10 in _0xa257f8){if(_0xa257f8[_0x10ed('0x3')](_0x1d0d10)){if(!_0x2f57d3[_0x1d0d10]){delete _0xa257f8[_0x1d0d10];}}}}Realtime[_0x10ed('0x4')][_0x10ed('0x5')]=function(_0xce2d7,_0x59457e){for(var _0x5a6e69 in _0x59457e){if(_0xce2d7[_0x10ed('0x3')](_0x5a6e69)){_0xce2d7[_0x5a6e69]=_0x59457e[_0x5a6e69];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x3c7d72=this;return function(_0x186bdb){if(_0x186bdb){freeIsNotKey(_0x186bdb,_0x3c7d72['mailAccounts'],'id');for(var _0x2c5d59=0x0,_0x5eb05f={},_0x3608b2={};_0x2c5d59<_0x186bdb[_0x10ed('0x6')];_0x2c5d59+=0x1){_0x5eb05f=_0x186bdb[_0x2c5d59];if(_[_0x10ed('0x7')](_0x3c7d72[_0x10ed('0x8')][_0x5eb05f['id']])){_0x3c7d72[_0x10ed('0x8')][_0x5eb05f['id']]=new MailAccount(_0x5eb05f);}else{_['merge'](_0x3c7d72[_0x10ed('0x8')][_0x5eb05f['id']],_0x5eb05f);}}}return _0x3c7d72[_0x10ed('0x8')];};};module[_0x10ed('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index bdef477..60b6797 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 _0xe1d7=['Imap','MailServerOut','getMailAccount','notify','Request','getMailAccounts','service','email','active','ListId','TemplateId','MailServerIn'];(function(_0x373e9a,_0x54b49e){var _0x5c8b3a=function(_0x3b8524){while(--_0x3b8524){_0x373e9a['push'](_0x373e9a['shift']());}};_0x5c8b3a(++_0x54b49e);}(_0xe1d7,0x1a9));var _0x7e1d=function(_0x425036,_0x39bebc){_0x425036=_0x425036-0x0;var _0x7fc880=_0xe1d7[_0x425036];return _0x7fc880;};'use strict';var client=require('../client');exports[_0x7e1d('0x0')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id','name',_0x7e1d('0x1'),_0x7e1d('0x2'),_0x7e1d('0x3'),'key',_0x7e1d('0x4'),_0x7e1d('0x5')],'raw':![],'include':[{'model':_0x7e1d('0x6'),'as':_0x7e1d('0x7')},{'model':_0x7e1d('0x8'),'as':'Smtp'}]},'log':_0x7e1d('0x9')});};};exports[_0x7e1d('0xa')]=function(_0x4ba560,_0x38eafe){return client[_0x7e1d('0xb')]('NotifyMailAccount',{'account':{'id':_0x4ba560},'body':_0x38eafe,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x36d3=['MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','service','email','active','key','ListId','TemplateId','MailServerIn','Imap'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x36d3,0xb5));var _0x336d=function(_0x183b69,_0x21b23e){_0x183b69=_0x183b69-0x0;var _0x326224=_0x36d3[_0x183b69];return _0x326224;};'use strict';var client=require(_0x336d('0x0'));exports[_0x336d('0x1')]=function(){return function(){return client[_0x336d('0x2')]('GetMailAccount',{'options':{'attributes':['id','name',_0x336d('0x3'),_0x336d('0x4'),_0x336d('0x5'),_0x336d('0x6'),_0x336d('0x7'),_0x336d('0x8')],'raw':![],'include':[{'model':_0x336d('0x9'),'as':_0x336d('0xa')},{'model':_0x336d('0xb'),'as':_0x336d('0xc')}]},'log':_0x336d('0xd')});};};exports[_0x336d('0xe')]=function(_0x2269a9,_0x288324){return client[_0x336d('0x2')](_0x336d('0xf'),{'account':{'id':_0x2269a9},'body':_0x288324,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index f5ad911..679a7a7 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 _0x3ffa=['Request','loginMailFrequency','GetSettings','../client'];(function(_0xb98d8d,_0x481423){var _0x489b15=function(_0x409a13){while(--_0x409a13){_0xb98d8d['push'](_0xb98d8d['shift']());}};_0x489b15(++_0x481423);}(_0x3ffa,0x187));var _0xa3ff=function(_0x14a2e6,_0x3beaa7){_0x14a2e6=_0x14a2e6-0x0;var _0x28e3d0=_0x3ffa[_0x14a2e6];return _0x28e3d0;};'use strict';var client=require(_0xa3ff('0x0'));exports['getSettings']=function(){return client[_0xa3ff('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xa3ff('0x2')]},'log':_0xa3ff('0x3')});}; \ No newline at end of file +var _0x09b6=['GetSettings','../client','getSettings','ShowSetting','loginMailFrequency'];(function(_0x2d36a6,_0x2f8cd0){var _0x59cec0=function(_0x5a56d0){while(--_0x5a56d0){_0x2d36a6['push'](_0x2d36a6['shift']());}};_0x59cec0(++_0x2f8cd0);}(_0x09b6,0x1b4));var _0x609b=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0x09b6[_0x55abd9];return _0x3e5669;};'use strict';var client=require(_0x609b('0x0'));exports[_0x609b('0x1')]=function(){return client['Request'](_0x609b('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x609b('0x3')]},'log':_0x609b('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 7be392e..6bf41b8 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'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 2a78cde..2c32fc1 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 _0x31c8=['../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express'];(function(_0x3027bd,_0x48fbb3){var _0x284fd0=function(_0x5838fe){while(--_0x5838fe){_0x3027bd['push'](_0x3027bd['shift']());}};_0x284fd0(++_0x48fbb3);}(_0x31c8,0x79));var _0x831c=function(_0x5e17fe,_0x38a68e){_0x5e17fe=_0x5e17fe-0x0;var _0x3db256=_0x31c8[_0x5e17fe];return _0x3db256;};'use strict';var _=require(_0x831c('0x0'));var http=require('http');var express=require(_0x831c('0x1'));var sticky=require('sticky-session');var Redis=require(_0x831c('0x2'));var config=require(_0x831c('0x3'));var app=express();var server=http[_0x831c('0x4')](app);server[_0x831c('0x5')]=0xdbba0;if(sticky[_0x831c('0x6')](server,config[_0x831c('0x7')])){var socketio=require(_0x831c('0x8'))(server,{'transports':['websocket',_0x831c('0x9')]});config[_0x831c('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x831c('0xb')](require(_0x831c('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x831c('0xa')])}));require(_0x831c('0xd'))[_0x831c('0xe')]();require(_0x831c('0xf'))[_0x831c('0xe')](socketio);require(_0x831c('0x10'))[_0x831c('0xe')](app);require(_0x831c('0x11'))['default'](app);}else{server[_0x831c('0x12')](_0x831c('0x13'),function(){console[_0x831c('0x14')](_0x831c('0x15'),config[_0x831c('0x7')]);});}exports=module[_0x831c('0x16')]=app; \ No newline at end of file +var _0x5370=['../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','port','lodash','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','redis','defaults','localhost'];(function(_0x57b378,_0x20efb1){var _0xc6e9e7=function(_0x4e3fd6){while(--_0x4e3fd6){_0x57b378['push'](_0x57b378['shift']());}};_0xc6e9e7(++_0x20efb1);}(_0x5370,0x14b));var _0x0537=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x5370[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x0537('0x0'));var http=require('http');var express=require(_0x0537('0x1'));var sticky=require(_0x0537('0x2'));var Redis=require(_0x0537('0x3'));var config=require(_0x0537('0x4'));var app=express();var server=http[_0x0537('0x5')](app);server[_0x0537('0x6')]=0xdbba0;if(sticky[_0x0537('0x7')](server,config['port'])){var socketio=require(_0x0537('0x8'))(server,{'transports':[_0x0537('0x9'),_0x0537('0xa')]});config[_0x0537('0xb')]=_[_0x0537('0xc')](config[_0x0537('0xb')],{'host':_0x0537('0xd'),'port':0x18eb});socketio['adapter'](require('socket.io-redis')({'pubClient':new Redis(config[_0x0537('0xb')]),'subClient':new Redis(config[_0x0537('0xb')])}));require(_0x0537('0xe'))[_0x0537('0xf')]();require(_0x0537('0x10'))['default'](socketio);require(_0x0537('0x11'))[_0x0537('0xf')](app);require(_0x0537('0x12'))[_0x0537('0xf')](app);}else{server[_0x0537('0x13')](_0x0537('0x14'),function(){console[_0x0537('0x15')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x0537('0x16')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 4b356ae..6f8eb6d 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 _0xefbc=['result','exports','jayson/promise','routing','client','http','Request','request','then','debug','rpc','error','message'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xefbc,0x1d6));var _0xcefb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xefbc[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0xcefb('0x0'));var BPromise=require('bluebird');var logger=require('../../config/logger')(_0xcefb('0x1'));var client=jayson[_0xcefb('0x2')][_0xcefb('0x3')]({'port':0x2329});client[_0xcefb('0x4')]=function(_0x78a2af,_0x2bc7eb){return new BPromise(function(_0x502ac3,_0x1ace4f){return client[_0xcefb('0x5')](_0x78a2af,_0x2bc7eb)[_0xcefb('0x6')](function(_0x19fa27){logger[_0xcefb('0x7')](_0xcefb('0x8'),_0xcefb('0x1'),_0x78a2af,_0x2bc7eb,_0x19fa27);if(_0x19fa27[_0xcefb('0x9')]){logger[_0xcefb('0x9')](_0xcefb('0x8'),_0xcefb('0x1'),_0x78a2af,_0x19fa27[_0xcefb('0x9')][_0xcefb('0xa')],_0x2bc7eb);return _0x1ace4f(_0x19fa27['error'][_0xcefb('0xa')]);}else{return _0x502ac3(_0x19fa27[_0xcefb('0xb')]);}})['catch'](function(_0x40eb16){logger['error'](_0xcefb('0x8'),_0xcefb('0x1'),_0x78a2af,_0x40eb16,_0x2bc7eb);return _0x1ace4f(_0x40eb16);});});};module[_0xcefb('0xc')]=client; \ No newline at end of file +var _0x98c1=['exports','jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','debug','rpc','routing','error','message','result','catch'];(function(_0x27c068,_0x342981){var _0xe5a67f=function(_0x20658a){while(--_0x20658a){_0x27c068['push'](_0x27c068['shift']());}};_0xe5a67f(++_0x342981);}(_0x98c1,0x91));var _0x198c=function(_0x10f7f7,_0x457207){_0x10f7f7=_0x10f7f7-0x0;var _0x4ca615=_0x98c1[_0x10f7f7];return _0x4ca615;};'use strict';var jayson=require(_0x198c('0x0'));var BPromise=require(_0x198c('0x1'));var logger=require(_0x198c('0x2'))('routing');var client=jayson[_0x198c('0x3')][_0x198c('0x4')]({'port':0x2329});client[_0x198c('0x5')]=function(_0x3b29ec,_0x14c11c){return new BPromise(function(_0x1059b1,_0x3226ad){return client[_0x198c('0x6')](_0x3b29ec,_0x14c11c)[_0x198c('0x7')](function(_0x5a02d3){logger[_0x198c('0x8')](_0x198c('0x9'),_0x198c('0xa'),_0x3b29ec,_0x14c11c,_0x5a02d3);if(_0x5a02d3[_0x198c('0xb')]){logger[_0x198c('0xb')](_0x198c('0x9'),_0x198c('0xa'),_0x3b29ec,_0x5a02d3[_0x198c('0xb')][_0x198c('0xc')],_0x14c11c);return _0x3226ad(_0x5a02d3[_0x198c('0xb')][_0x198c('0xc')]);}else{return _0x1059b1(_0x5a02d3[_0x198c('0xd')]);}})[_0x198c('0xe')](function(_0x2463ff){logger[_0x198c('0xb')](_0x198c('0x9'),_0x198c('0xa'),_0x3b29ec,_0x2463ff,_0x14c11c);return _0x3226ad(_0x2463ff);});});};module[_0x198c('0xf')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 622865d..99a7153 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 _0x285e=['getMailQueues','initMailQueues','initFaxQueues','initWhatsappQueues','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues'];(function(_0xe55722,_0x3cb1da){var _0x3a58bc=function(_0x57c03b){while(--_0x57c03b){_0xe55722['push'](_0xe55722['shift']());}};_0x3a58bc(++_0x3cb1da);}(_0x285e,0x164));var _0xe285=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x285e[_0x9fd887];return _0x1a54ab;};'use strict';var BPromise=require('bluebird');var server=require(_0xe285('0x0'));var Realtime=require(_0xe285('0x1'));var user=require(_0xe285('0x2'));var interval=require(_0xe285('0x3'));var openchannelQueue=require(_0xe285('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xe285('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xe285('0x6'));var whatsappQueue=require(_0xe285('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe285('0x8')]()['then'](user[_0xe285('0x9')]())[_0xe285('0xa')](realtime[_0xe285('0xb')]())[_0xe285('0xa')](interval[_0xe285('0xc')]())['then'](realtime[_0xe285('0xd')]())[_0xe285('0xa')](openchannelQueue[_0xe285('0xe')]())[_0xe285('0xa')](realtime[_0xe285('0xf')]())[_0xe285('0xa')](chatQueue['getChatQueues']())['then'](realtime[_0xe285('0x10')]())['then'](smsQueue[_0xe285('0x11')]())[_0xe285('0xa')](realtime['initSmsQueues']())[_0xe285('0xa')](mailQueue[_0xe285('0x12')]())[_0xe285('0xa')](realtime[_0xe285('0x13')]())[_0xe285('0xa')](faxQueue['getFaxQueues']())['then'](realtime[_0xe285('0x14')]())[_0xe285('0xa')](whatsappQueue['getWhatsappQueues']())['then'](realtime[_0xe285('0x15')]())[_0xe285('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xe285('0xa')](function(_0x4c28d4){return initRealtime();})[_0xe285('0xa')](function(_0x2b287c){return setInterval(initRealtime,0x1388);})['catch'](function(_0x3960a6){console['log'](_0x3960a6);});}main(); \ No newline at end of file +var _0x540c=['./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','getSmsQueues','getMailQueues','initMailQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x540c,0xb6));var _0xc540=function(_0x882014,_0x4774d5){_0x882014=_0x882014-0x0;var _0x34aa1f=_0x540c[_0x882014];return _0x34aa1f;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require(_0xc540('0x0'));var user=require(_0xc540('0x1'));var interval=require(_0xc540('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xc540('0x3'));var smsQueue=require(_0xc540('0x4'));var mailQueue=require(_0xc540('0x5'));var faxQueue=require(_0xc540('0x6'));var whatsappQueue=require(_0xc540('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xc540('0x8')]()[_0xc540('0x9')](user[_0xc540('0xa')]())[_0xc540('0x9')](realtime[_0xc540('0xb')]())[_0xc540('0x9')](interval[_0xc540('0xc')]())['then'](realtime['initIntervals']())[_0xc540('0x9')](openchannelQueue['getOpenchannelQueues']())['then'](realtime['initOpenchannelQueues']())[_0xc540('0x9')](chatQueue['getChatQueues']())[_0xc540('0x9')](realtime['initChatQueues']())[_0xc540('0x9')](smsQueue[_0xc540('0xd')]())[_0xc540('0x9')](realtime['initSmsQueues']())[_0xc540('0x9')](mailQueue[_0xc540('0xe')]())['then'](realtime[_0xc540('0xf')]())[_0xc540('0x9')](faxQueue['getFaxQueues']())['then'](realtime['initFaxQueues']())[_0xc540('0x9')](whatsappQueue[_0xc540('0x10')]())[_0xc540('0x9')](realtime[_0xc540('0x11')]())[_0xc540('0x9')](function(){return realtime;});}function main(){return server[_0xc540('0x12')](realtime)['then'](function(_0x3efd25){return initRealtime();})[_0xc540('0x9')](function(_0x4a2ec1){return setInterval(initRealtime,0x1388);})[_0xc540('0x13')](function(_0x59fc34){console[_0xc540('0x14')](_0x59fc34);});}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 62be1ea..615f60c 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 _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(_0x10085f,_0x3b601c){var _0x16c1aa=function(_0xcd4a47){while(--_0xcd4a47){_0x10085f['push'](_0x10085f['shift']());}};_0x16c1aa(++_0x3b601c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x16539a,_0x31409a){_0x16539a=_0x16539a-0x0;var _0x200796=_0x5fc3[_0x16539a];return _0x200796;};'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 +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(_0x4fdcec,_0x4d89a5){var _0x413041=function(_0x2b02d5){while(--_0x2b02d5){_0x4fdcec['push'](_0x4fdcec['shift']());}};_0x413041(++_0x4d89a5);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 0ba7ea7..2210bf8 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 _0xcbe1=['catch','sendMailMessage','SendMail','jayson/promise','client','http','then','error','message'];(function(_0x1971b5,_0x5d9791){var _0x55faec=function(_0x5ce2e0){while(--_0x5ce2e0){_0x1971b5['push'](_0x1971b5['shift']());}};_0x55faec(++_0x5d9791);}(_0xcbe1,0x1a1));var _0x1cbe=function(_0x5ea94c,_0x19937b){_0x5ea94c=_0x5ea94c-0x0;var _0xededd7=_0xcbe1[_0x5ea94c];return _0xededd7;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1cbe('0x0'));var client=jayson[_0x1cbe('0x1')][_0x1cbe('0x2')]({'port':0x232b});function request(_0x58e82b,_0x7a5a37){return new BPromise(function(_0x6e1653,_0xd63bef){return client['request'](_0x58e82b,_0x7a5a37)[_0x1cbe('0x3')](function(_0x53e0a0){if(_0x53e0a0[_0x1cbe('0x4')]){return _0xd63bef(_0x53e0a0[_0x1cbe('0x4')][_0x1cbe('0x5')]);}else{return _0x6e1653(_0x53e0a0['result']);}})[_0x1cbe('0x6')](function(_0x4135ec){return _0xd63bef(_0x4135ec);});});}exports[_0x1cbe('0x7')]=function(_0x31f510,_0x5c7bcc){return request(_0x1cbe('0x8'),{'account':_0x31f510,'message':_0x5c7bcc});}; \ No newline at end of file +var _0x1467=['request','error','result','catch','sendMailMessage','bluebird','client','http'];(function(_0x4f9252,_0x39fed4){var _0x5841eb=function(_0x2ebcac){while(--_0x2ebcac){_0x4f9252['push'](_0x4f9252['shift']());}};_0x5841eb(++_0x39fed4);}(_0x1467,0x195));var _0x7146=function(_0x2d5dcf,_0xf71498){_0x2d5dcf=_0x2d5dcf-0x0;var _0x42a3e8=_0x1467[_0x2d5dcf];return _0x42a3e8;};'use strict';var BPromise=require(_0x7146('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x7146('0x1')][_0x7146('0x2')]({'port':0x232b});function request(_0x46c0ee,_0x4aa091){return new BPromise(function(_0x51a9f3,_0x2705cb){return client[_0x7146('0x3')](_0x46c0ee,_0x4aa091)['then'](function(_0x44fd38){if(_0x44fd38[_0x7146('0x4')]){return _0x2705cb(_0x44fd38[_0x7146('0x4')]['message']);}else{return _0x51a9f3(_0x44fd38[_0x7146('0x5')]);}})[_0x7146('0x6')](function(_0x4c3a77){return _0x2705cb(_0x4c3a77);});});}exports[_0x7146('0x7')]=function(_0x597d5a,_0x35ea7f){return request('SendMail',{'account':_0x597d5a,'message':_0x35ea7f});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 600f844..45c6c62 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 _0x943f=['prototype','getChannelStatus','CurrentCapacity','working','updateRealtime','chat','openchannel','whatsapp','length','toNumber','Status','smsStatusTime','emit','user:save','moment','md5','ioredis','redis','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue'];(function(_0x2e2c59,_0x22a19f){var _0x2639fd=function(_0x34b942){while(--_0x34b942){_0x2e2c59['push'](_0x2e2c59['shift']());}};_0x2639fd(++_0x22a19f);}(_0x943f,0xa7));var _0xf943=function(_0x4636c3,_0x4ebaba){_0x4636c3=_0x4636c3-0x0;var _0x44811c=_0x943f[_0x4636c3];return _0x44811c;};'use strict';var _=require('lodash');var moment=require(_0xf943('0x0'));var md5=require(_0xf943('0x1'));var Redis=require(_0xf943('0x2'));var config=require('../../../config/environment');config[_0xf943('0x3')]=_['defaults'](config[_0xf943('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xf943('0x4'))(new Redis(config[_0xf943('0x3')]));function Agent(_0x2a5947){this['id']=_0x2a5947['id']||0x0;this[_0xf943('0x5')]=_0x2a5947[_0xf943('0x5')]||'';this['online']=_0x2a5947[_0xf943('0x6')]||!![];this['voicePause']=_0x2a5947[_0xf943('0x7')]||![];this[_0xf943('0x8')]=_0x2a5947[_0xf943('0x8')]||![];this[_0xf943('0x9')]=_0x2a5947[_0xf943('0x9')]||![];this['faxPause']=_0x2a5947[_0xf943('0xa')]||![];this[_0xf943('0xb')]=_0x2a5947['smsPause']||![];this[_0xf943('0xc')]=_0x2a5947['openchannelPause']||![];this[_0xf943('0xd')]=_0xf943('0xe');this[_0xf943('0xf')]=0x0;this[_0xf943('0x10')]=_0x2a5947['chatCapacity']||0x0;this[_0xf943('0x11')]=0x0;this[_0xf943('0x12')]=_0xf943('0xe');this['mailStatusTime']=0x0;this[_0xf943('0x13')]=_0x2a5947[_0xf943('0x13')]||0x0;this[_0xf943('0x14')]=0x0;this['faxStatus']='unknown';this[_0xf943('0x15')]=0x0;this['faxCapacity']=_0x2a5947[_0xf943('0x16')]||0x0;this[_0xf943('0x17')]=0x0;this[_0xf943('0x18')]=_0xf943('0xe');this['smsStatusTime']=0x0;this[_0xf943('0x19')]=_0x2a5947[_0xf943('0x19')]||0x0;this[_0xf943('0x1a')]=0x0;this[_0xf943('0x1b')]='unknown';this[_0xf943('0x1c')]=0x0;this[_0xf943('0x1d')]=_0x2a5947['whatsappCapacity']||0x0;this[_0xf943('0x1e')]=0x0;this[_0xf943('0x1f')]=_0xf943('0xe');this[_0xf943('0x20')]=0x0;this[_0xf943('0x21')]=_0x2a5947[_0xf943('0x21')]||0x0;this[_0xf943('0x22')]=0x0;this[_0xf943('0x23')]=![];this[_0xf943('0x24')]=undefined;this['md5']='';this['updateRealtime']();}Agent[_0xf943('0x25')][_0xf943('0x26')]=function(_0x339e09){if(this[_0x339e09+_0xf943('0x27')]>0x0){if(this[_0x339e09+'Capacity']>0x0&&this[_0x339e09+_0xf943('0x27')]>=this[_0x339e09+'Capacity']){return'maxcapacity';}else{return _0xf943('0x28');}}else{return'idle';}};Agent[_0xf943('0x25')][_0xf943('0x29')]=function(){var _0x587550=['mail',_0xf943('0x2a'),_0xf943('0x2b'),'fax','sms',_0xf943('0x2c')];for(var _0x99bb42=0x0;_0x99bb42<_0x587550[_0xf943('0x2d')];_0x99bb42+=0x1){var _0x1a39d3=this[_0xf943('0x26')](_0x587550[_0x99bb42]);if(this[_0x587550[_0x99bb42]+'Status']!==_0x1a39d3){this[_0x587550[_0x99bb42]+'StatusTime']=_[_0xf943('0x2e')](moment()['format']('x'));}this[_0x587550[_0x99bb42]+_0xf943('0x2f')]=_0x1a39d3;}var _0x4683e0={'id':this['id'],'name':this[_0xf943('0x5')],'online':this['online'],'voicePause':this[_0xf943('0x7')],'chatPause':this[_0xf943('0x8')],'mailPause':this[_0xf943('0x9')],'smsPause':this[_0xf943('0xb')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf943('0xc')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xf943('0x10')],'chatCurrentCapacity':this[_0xf943('0x11')],'mailStatus':this[_0xf943('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xf943('0x13')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0xf943('0x15')],'faxCapacity':this[_0xf943('0x16')],'faxCurrentCapacity':this[_0xf943('0x17')],'smsStatus':this[_0xf943('0x18')],'smsStatusTime':this[_0xf943('0x30')],'smsCapacity':this[_0xf943('0x19')],'smsCurrentCapacity':this[_0xf943('0x1a')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xf943('0x1c')],'whatsappCapacity':this[_0xf943('0x1d')],'whatsappCurrentCapacity':this[_0xf943('0x1e')],'openchannelStatus':this[_0xf943('0x1f')],'openchannelStatusTime':this[_0xf943('0x20')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf943('0x22')],'busy':this[_0xf943('0x23')],'busyQueue':this[_0xf943('0x24')]};var _0x49837f=md5(JSON['stringify'](_0x4683e0));if(this['md5']!==_0x49837f){this[_0xf943('0x1')]=_0x49837f;io[_0xf943('0x31')](_0xf943('0x32'),_0x4683e0);}};module['exports']=Agent; \ No newline at end of file +var _0xc429=['openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','working','prototype','mail','chat','openchannel','fax','sms','length','Status','StatusTime','format','chatStatusTime','mailStatus','faxStatus','whatsappStatus','whatsappStatusTime','whatsappCapacity','busyQueue','stringify','user:save','exports','lodash','md5','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCurrentCapacity','openchannelStatus'];(function(_0x5235dd,_0x3f91cf){var _0x13059d=function(_0x355a98){while(--_0x355a98){_0x5235dd['push'](_0x5235dd['shift']());}};_0x13059d(++_0x3f91cf);}(_0xc429,0x1ba));var _0x9c42=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xc429[_0x5235a6];return _0x1cf37e;};'use strict';var _=require(_0x9c42('0x0'));var moment=require('moment');var md5=require(_0x9c42('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x9c42('0x2')]=_[_0x9c42('0x3')](config[_0x9c42('0x2')],{'host':_0x9c42('0x4'),'port':0x18eb});var io=require(_0x9c42('0x5'))(new Redis(config['redis']));function Agent(_0x48d832){this['id']=_0x48d832['id']||0x0;this[_0x9c42('0x6')]=_0x48d832[_0x9c42('0x6')]||'';this[_0x9c42('0x7')]=_0x48d832[_0x9c42('0x7')]||!![];this[_0x9c42('0x8')]=_0x48d832[_0x9c42('0x8')]||![];this[_0x9c42('0x9')]=_0x48d832[_0x9c42('0x9')]||![];this[_0x9c42('0xa')]=_0x48d832[_0x9c42('0xa')]||![];this[_0x9c42('0xb')]=_0x48d832['faxPause']||![];this[_0x9c42('0xc')]=_0x48d832['smsPause']||![];this[_0x9c42('0xd')]=_0x48d832['openchannelPause']||![];this[_0x9c42('0xe')]=_0x9c42('0xf');this['chatStatusTime']=0x0;this[_0x9c42('0x10')]=_0x48d832[_0x9c42('0x10')]||0x0;this[_0x9c42('0x11')]=0x0;this['mailStatus']=_0x9c42('0xf');this[_0x9c42('0x12')]=0x0;this[_0x9c42('0x13')]=_0x48d832['mailCapacity']||0x0;this[_0x9c42('0x14')]=0x0;this['faxStatus']='unknown';this[_0x9c42('0x15')]=0x0;this[_0x9c42('0x16')]=_0x48d832['faxCapacity']||0x0;this[_0x9c42('0x17')]=0x0;this[_0x9c42('0x18')]=_0x9c42('0xf');this[_0x9c42('0x19')]=0x0;this[_0x9c42('0x1a')]=_0x48d832[_0x9c42('0x1a')]||0x0;this[_0x9c42('0x1b')]=0x0;this['whatsappStatus']=_0x9c42('0xf');this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x48d832['whatsappCapacity']||0x0;this[_0x9c42('0x1c')]=0x0;this[_0x9c42('0x1d')]='unknown';this[_0x9c42('0x1e')]=0x0;this[_0x9c42('0x1f')]=_0x48d832['openchannelCapacity']||0x0;this[_0x9c42('0x20')]=0x0;this[_0x9c42('0x21')]=![];this['busyQueue']=undefined;this['md5']='';this[_0x9c42('0x22')]();}Agent['prototype'][_0x9c42('0x23')]=function(_0x10f2db){if(this[_0x10f2db+_0x9c42('0x24')]>0x0){if(this[_0x10f2db+'Capacity']>0x0&&this[_0x10f2db+_0x9c42('0x24')]>=this[_0x10f2db+_0x9c42('0x25')]){return'maxcapacity';}else{return _0x9c42('0x26');}}else{return'idle';}};Agent[_0x9c42('0x27')][_0x9c42('0x22')]=function(){var _0x2613f9=[_0x9c42('0x28'),_0x9c42('0x29'),_0x9c42('0x2a'),_0x9c42('0x2b'),_0x9c42('0x2c'),'whatsapp'];for(var _0x564a95=0x0;_0x564a95<_0x2613f9[_0x9c42('0x2d')];_0x564a95+=0x1){var _0xa10216=this[_0x9c42('0x23')](_0x2613f9[_0x564a95]);if(this[_0x2613f9[_0x564a95]+_0x9c42('0x2e')]!==_0xa10216){this[_0x2613f9[_0x564a95]+_0x9c42('0x2f')]=_['toNumber'](moment()[_0x9c42('0x30')]('x'));}this[_0x2613f9[_0x564a95]+'Status']=_0xa10216;}var _0xa2241a={'id':this['id'],'name':this[_0x9c42('0x6')],'online':this[_0x9c42('0x7')],'voicePause':this[_0x9c42('0x8')],'chatPause':this['chatPause'],'mailPause':this[_0x9c42('0xa')],'smsPause':this[_0x9c42('0xc')],'faxPause':this[_0x9c42('0xb')],'openchannelPause':this[_0x9c42('0xd')],'chatStatus':this[_0x9c42('0xe')],'chatStatusTime':this[_0x9c42('0x31')],'chatCapacity':this[_0x9c42('0x10')],'chatCurrentCapacity':this[_0x9c42('0x11')],'mailStatus':this[_0x9c42('0x32')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x9c42('0x14')],'faxStatus':this[_0x9c42('0x33')],'faxStatusTime':this[_0x9c42('0x15')],'faxCapacity':this[_0x9c42('0x16')],'faxCurrentCapacity':this[_0x9c42('0x17')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x9c42('0x19')],'smsCapacity':this[_0x9c42('0x1a')],'smsCurrentCapacity':this[_0x9c42('0x1b')],'whatsappStatus':this[_0x9c42('0x34')],'whatsappStatusTime':this[_0x9c42('0x35')],'whatsappCapacity':this[_0x9c42('0x36')],'whatsappCurrentCapacity':this[_0x9c42('0x1c')],'openchannelStatus':this[_0x9c42('0x1d')],'openchannelStatusTime':this[_0x9c42('0x1e')],'openchannelCapacity':this[_0x9c42('0x1f')],'openchannelCurrentCapacity':this[_0x9c42('0x20')],'busy':this[_0x9c42('0x21')],'busyQueue':this[_0x9c42('0x37')]};var _0x1b1b10=md5(JSON[_0x9c42('0x38')](_0xa2241a));if(this[_0x9c42('0x1')]!==_0x1b1b10){this[_0x9c42('0x1')]=_0x1b1b10;io['emit'](_0x9c42('0x39'),_0xa2241a);}};module[_0x9c42('0x3a')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 39d3455..93caca3 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 _0x7727=['online','loggedIn','available','stringify','format','exports','util','ioredis','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','_rr','map','paused','length'];(function(_0x45161c,_0x5494fc){var _0x186581=function(_0x78fada){while(--_0x78fada){_0x45161c['push'](_0x45161c['shift']());}};_0x186581(++_0x5494fc);}(_0x7727,0x176));var _0x7772=function(_0x244f98,_0x194da6){_0x244f98=_0x244f98-0x0;var _0x3eee57=_0x7727[_0x244f98];return _0x3eee57;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x7772('0x0'));var Redis=require(_0x7772('0x1'));var config=require('../../../config/environment');config[_0x7772('0x2')]=_['defaults'](config[_0x7772('0x2')],{'host':_0x7772('0x3'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7772('0x2')]));function ChatQueue(_0x5f0d56){this['id']=_0x5f0d56['id']||0x0;this[_0x7772('0x4')]=_0x5f0d56[_0x7772('0x4')]||'';this['timeout']=_0x5f0d56[_0x7772('0x5')]||0xa;this[_0x7772('0x6')]=_0x5f0d56['strategy']||'beepall';this[_0x7772('0x7')]=_0x5f0d56['Agents'];this[_0x7772('0x8')]={};this[_0x7772('0x9')]=0x0;this[_0x7772('0xa')]='';this[_0x7772('0xb')]();this[_0x7772('0xc')]();}ChatQueue['prototype'][_0x7772('0xb')]=function(){var _0x2707da=this[_0x7772('0x8')][_0x7772('0xd')];this['mapAgentsId']=_[_0x7772('0xe')](this[_0x7772('0x7')],'id');this['mapAgentsId'][_0x7772('0xd')]=_0x2707da;};ChatQueue['prototype'][_0x7772('0xc')]=function(){this['loggedIn']=0x0;this[_0x7772('0xf')]=0x0;for(var _0xb8615c=0x0;_0xb8615c=0x0?this[_0x7772('0x13')]:0x0;var _0x5473bf={'id':this['id'],'available':this[_0x7772('0x13')],'loggedIn':this[_0x7772('0x12')],'name':this[_0x7772('0x4')],'paused':this['paused'],'waiting':this[_0x7772('0x9')]};var _0x364516=md5(JSON[_0x7772('0x14')](_0x5473bf));if(this[_0x7772('0xa')]!==_0x364516){this[_0x7772('0xa')]=_0x364516;io['to'](util[_0x7772('0x15')]('chat:queue:%s',_0x5473bf['name']))['emit']('chat_queue:save',_0x5473bf);}};module[_0x7772('0x16')]=ChatQueue; \ No newline at end of file +var _0x04b4=['chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','paused','length','online','loggedIn'];(function(_0x42c9a8,_0x269ad8){var _0xd8d52e=function(_0x1fefdb){while(--_0x1fefdb){_0x42c9a8['push'](_0x42c9a8['shift']());}};_0xd8d52e(++_0x269ad8);}(_0x04b4,0x94));var _0x404b=function(_0x2036dd,_0x3aa426){_0x2036dd=_0x2036dd-0x0;var _0x38855b=_0x04b4[_0x2036dd];return _0x38855b;};'use strict';var _=require(_0x404b('0x0'));var md5=require(_0x404b('0x1'));var util=require(_0x404b('0x2'));var Redis=require('ioredis');var config=require(_0x404b('0x3'));config['redis']=_[_0x404b('0x4')](config[_0x404b('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x404b('0x5')]));function ChatQueue(_0x2d6b5d){this['id']=_0x2d6b5d['id']||0x0;this[_0x404b('0x6')]=_0x2d6b5d['name']||'';this['timeout']=_0x2d6b5d['timeout']||0xa;this['strategy']=_0x2d6b5d[_0x404b('0x7')]||_0x404b('0x8');this[_0x404b('0x9')]=_0x2d6b5d['Agents'];this[_0x404b('0xa')]={};this[_0x404b('0xb')]=0x0;this[_0x404b('0x1')]='';this['updateRouting']();this[_0x404b('0xc')]();}ChatQueue[_0x404b('0xd')][_0x404b('0xe')]=function(){var _0x7e1aa8=this[_0x404b('0xa')][_0x404b('0xf')];this[_0x404b('0xa')]=_['map'](this[_0x404b('0x9')],'id');this[_0x404b('0xa')][_0x404b('0xf')]=_0x7e1aa8;};ChatQueue[_0x404b('0xd')][_0x404b('0xc')]=function(){this['loggedIn']=0x0;this[_0x404b('0x10')]=0x0;for(var _0x518b80=0x0;_0x518b80=0x0?this['available']:0x0;var _0x3b7530={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x404b('0xb')]};var _0x48b750=md5(JSON[_0x404b('0x16')](_0x3b7530));if(this['md5']!==_0x48b750){this[_0x404b('0x1')]=_0x48b750;io['to'](util[_0x404b('0x17')](_0x404b('0x18'),_0x3b7530['name']))[_0x404b('0x19')](_0x404b('0x1a'),_0x3b7530);}};module[_0x404b('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 9dfa64f..d7dbcc4 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 _0xdb74=['online','faxPause','available','waiting','stringify','fax:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','prototype','map','loggedIn','paused','length'];(function(_0x4149cf,_0x5acec1){var _0x230583=function(_0x2f1b6c){while(--_0x2f1b6c){_0x4149cf['push'](_0x4149cf['shift']());}};_0x230583(++_0x5acec1);}(_0xdb74,0x10c));var _0x4db7=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0xdb74[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0x4db7('0x0'));var md5=require(_0x4db7('0x1'));var util=require(_0x4db7('0x2'));var Redis=require('ioredis');var config=require(_0x4db7('0x3'));config[_0x4db7('0x4')]=_[_0x4db7('0x5')](config[_0x4db7('0x4')],{'host':_0x4db7('0x6'),'port':0x18eb});var io=require(_0x4db7('0x7'))(new Redis(config[_0x4db7('0x4')]));function FaxQueue(_0x2f496d){this['id']=_0x2f496d['id']||0x0;this[_0x4db7('0x8')]=_0x2f496d[_0x4db7('0x8')]||'';this[_0x4db7('0x9')]=_0x2f496d[_0x4db7('0x9')]||0xa;this[_0x4db7('0xa')]=_0x2f496d[_0x4db7('0xa')]||'beepall';this['Agents']=_0x2f496d[_0x4db7('0xb')];this[_0x4db7('0xc')]={};this['waiting']=0x0;this[_0x4db7('0x1')]='';this['updateRouting']();this['updateRealtime']();}FaxQueue[_0x4db7('0xd')]['updateRouting']=function(){var _0x5b15d9=this[_0x4db7('0xc')]['_rr'];this[_0x4db7('0xc')]=_[_0x4db7('0xe')](this[_0x4db7('0xb')],'id');this[_0x4db7('0xc')]['_rr']=_0x5b15d9;};FaxQueue[_0x4db7('0xd')]['updateRealtime']=function(){this[_0x4db7('0xf')]=0x0;this[_0x4db7('0x10')]=0x0;for(var _0x1ac46b=0x0;_0x1ac46b=0x0?this[_0x4db7('0x14')]:0x0;var _0x589e13={'id':this['id'],'available':this[_0x4db7('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x4db7('0x8')],'paused':this[_0x4db7('0x10')],'waiting':this[_0x4db7('0x15')]};var _0x3bc227=md5(JSON[_0x4db7('0x16')](_0x589e13));if(this['md5']!==_0x3bc227){this[_0x4db7('0x1')]=_0x3bc227;io['to'](util['format'](_0x4db7('0x17'),_0x589e13[_0x4db7('0x8')]))[_0x4db7('0x18')]('fax_queue:save',_0x589e13);}};module[_0x4db7('0x19')]=FaxQueue; \ No newline at end of file +var _0x29b9=['md5','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','faxPause','paused','available','waiting','stringify','fax:queue:%s','emit','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x1a6ef3,_0x2b8ef7){var _0xf1f12a=function(_0x3c52ae){while(--_0x3c52ae){_0x1a6ef3['push'](_0x1a6ef3['shift']());}};_0xf1f12a(++_0x2b8ef7);}(_0x29b9,0x66));var _0x929b=function(_0x47cf98,_0x33dea6){_0x47cf98=_0x47cf98-0x0;var _0x4edeee=_0x29b9[_0x47cf98];return _0x4edeee;};'use strict';var _=require(_0x929b('0x0'));var md5=require('md5');var util=require(_0x929b('0x1'));var Redis=require(_0x929b('0x2'));var config=require(_0x929b('0x3'));config[_0x929b('0x4')]=_[_0x929b('0x5')](config['redis'],{'host':_0x929b('0x6'),'port':0x18eb});var io=require(_0x929b('0x7'))(new Redis(config[_0x929b('0x4')]));function FaxQueue(_0x52087e){this['id']=_0x52087e['id']||0x0;this[_0x929b('0x8')]=_0x52087e[_0x929b('0x8')]||'';this['timeout']=_0x52087e[_0x929b('0x9')]||0xa;this[_0x929b('0xa')]=_0x52087e['strategy']||_0x929b('0xb');this[_0x929b('0xc')]=_0x52087e['Agents'];this[_0x929b('0xd')]={};this['waiting']=0x0;this[_0x929b('0xe')]='';this[_0x929b('0xf')]();this[_0x929b('0x10')]();}FaxQueue['prototype'][_0x929b('0xf')]=function(){var _0x578fe1=this['mapAgentsId'][_0x929b('0x11')];this[_0x929b('0xd')]=_[_0x929b('0x12')](this['Agents'],'id');this[_0x929b('0xd')]['_rr']=_0x578fe1;};FaxQueue[_0x929b('0x13')][_0x929b('0x10')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4579f9=0x0;_0x4579f9=0x0?this[_0x929b('0x17')]:0x0;var _0x5532e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x929b('0x8')],'paused':this[_0x929b('0x16')],'waiting':this[_0x929b('0x18')]};var _0xcb1769=md5(JSON[_0x929b('0x19')](_0x5532e));if(this[_0x929b('0xe')]!==_0xcb1769){this[_0x929b('0xe')]=_0xcb1769;io['to'](util['format'](_0x929b('0x1a'),_0x5532e[_0x929b('0x8')]))[_0x929b('0x1b')]('fax_queue:save',_0x5532e);}};module[_0x929b('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 50e797e..55f51ad 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 _0x46e4=['Intervals','name'];(function(_0x59d19f,_0x185a4e){var _0x1bf090=function(_0x27d2db){while(--_0x27d2db){_0x59d19f['push'](_0x59d19f['shift']());}};_0x1bf090(++_0x185a4e);}(_0x46e4,0x10f));var _0x446e=function(_0x31b8dd,_0x4db86c){_0x31b8dd=_0x31b8dd-0x0;var _0x367812=_0x46e4[_0x31b8dd];return _0x367812;};'use strict';function Interval(_0x7b3aac){this['id']=_0x7b3aac['id']||0x0;this[_0x446e('0x0')]=_0x7b3aac['name']||'';this[_0x446e('0x1')]=_0x7b3aac[_0x446e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xf7c4=['Intervals','exports','name'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0xf7c4,0x170));var _0x4f7c=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xf7c4[_0x5608a3];return _0x1ed50a;};'use strict';function Interval(_0x5c9e1a){this['id']=_0x5c9e1a['id']||0x0;this['name']=_0x5c9e1a[_0x4f7c('0x0')]||'';this[_0x4f7c('0x1')]=_0x5c9e1a[_0x4f7c('0x1')]||{};}module[_0x4f7c('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index bf68951..3fc49ad 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 _0x49cc=['lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','paused','length','online','loggedIn','available','stringify','format','mail:queue:%s','mail_queue:save','exports'];(function(_0x53825a,_0x52f99a){var _0x19d024=function(_0x80306c){while(--_0x80306c){_0x53825a['push'](_0x53825a['shift']());}};_0x19d024(++_0x52f99a);}(_0x49cc,0xd9));var _0xc49c=function(_0x1e5786,_0x1560fc){_0x1e5786=_0x1e5786-0x0;var _0x56daa3=_0x49cc[_0x1e5786];return _0x56daa3;};'use strict';var _=require(_0xc49c('0x0'));var md5=require(_0xc49c('0x1'));var util=require(_0xc49c('0x2'));var Redis=require(_0xc49c('0x3'));var config=require(_0xc49c('0x4'));config[_0xc49c('0x5')]=_[_0xc49c('0x6')](config[_0xc49c('0x5')],{'host':_0xc49c('0x7'),'port':0x18eb});var io=require(_0xc49c('0x8'))(new Redis(config[_0xc49c('0x5')]));function MailQueue(_0x304107){this['id']=_0x304107['id']||0x0;this[_0xc49c('0x9')]=_0x304107['name']||'';this['timeout']=_0x304107[_0xc49c('0xa')]||0xa;this['strategy']=_0x304107[_0xc49c('0xb')]||_0xc49c('0xc');this[_0xc49c('0xd')]=_0x304107['Agents'];this['mapAgentsId']={};this[_0xc49c('0xe')]=0x0;this[_0xc49c('0x1')]='';this[_0xc49c('0xf')]();this[_0xc49c('0x10')]();}MailQueue[_0xc49c('0x11')][_0xc49c('0xf')]=function(){var _0x31f5fd=this[_0xc49c('0x12')][_0xc49c('0x13')];this[_0xc49c('0x12')]=_[_0xc49c('0x14')](this[_0xc49c('0xd')],'id');this[_0xc49c('0x12')]['_rr']=_0x31f5fd;};MailQueue['prototype'][_0xc49c('0x10')]=function(){this['loggedIn']=0x0;this[_0xc49c('0x15')]=0x0;for(var _0x5b5511=0x0;_0x5b5511=0x0?this[_0xc49c('0x19')]:0x0;var _0x2380a0={'id':this['id'],'available':this[_0xc49c('0x19')],'loggedIn':this[_0xc49c('0x18')],'name':this['name'],'paused':this[_0xc49c('0x15')],'waiting':this[_0xc49c('0xe')]};var _0x4dae8a=md5(JSON[_0xc49c('0x1a')](_0x2380a0));if(this[_0xc49c('0x1')]!==_0x4dae8a){this['md5']=_0x4dae8a;io['to'](util[_0xc49c('0x1b')](_0xc49c('0x1c'),_0x2380a0[_0xc49c('0x9')]))['emit'](_0xc49c('0x1d'),_0x2380a0);}};module[_0xc49c('0x1e')]=MailQueue; \ No newline at end of file +var _0x3eb3=['online','available','name','waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x3eb3,0x190));var _0x33eb=function(_0x29e6a5,_0x2a10e3){_0x29e6a5=_0x29e6a5-0x0;var _0x14111e=_0x3eb3[_0x29e6a5];return _0x14111e;};'use strict';var _=require(_0x33eb('0x0'));var md5=require(_0x33eb('0x1'));var util=require(_0x33eb('0x2'));var Redis=require('ioredis');var config=require(_0x33eb('0x3'));config[_0x33eb('0x4')]=_[_0x33eb('0x5')](config[_0x33eb('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x33eb('0x6'))(new Redis(config['redis']));function MailQueue(_0x499cc6){this['id']=_0x499cc6['id']||0x0;this['name']=_0x499cc6['name']||'';this[_0x33eb('0x7')]=_0x499cc6[_0x33eb('0x7')]||0xa;this['strategy']=_0x499cc6[_0x33eb('0x8')]||_0x33eb('0x9');this[_0x33eb('0xa')]=_0x499cc6[_0x33eb('0xa')];this[_0x33eb('0xb')]={};this['waiting']=0x0;this[_0x33eb('0x1')]='';this[_0x33eb('0xc')]();this[_0x33eb('0xd')]();}MailQueue[_0x33eb('0xe')][_0x33eb('0xc')]=function(){var _0x57fb7f=this[_0x33eb('0xb')][_0x33eb('0xf')];this[_0x33eb('0xb')]=_[_0x33eb('0x10')](this[_0x33eb('0xa')],'id');this[_0x33eb('0xb')][_0x33eb('0xf')]=_0x57fb7f;};MailQueue['prototype'][_0x33eb('0xd')]=function(){this[_0x33eb('0x11')]=0x0;this[_0x33eb('0x12')]=0x0;for(var _0x4e9107=0x0;_0x4e9107=0x0?this['available']:0x0;var _0x32d90d={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x33eb('0x16')],'paused':this[_0x33eb('0x12')],'waiting':this[_0x33eb('0x17')]};var _0x212918=md5(JSON[_0x33eb('0x18')](_0x32d90d));if(this[_0x33eb('0x1')]!==_0x212918){this[_0x33eb('0x1')]=_0x212918;io['to'](util[_0x33eb('0x19')](_0x33eb('0x1a'),_0x32d90d[_0x33eb('0x16')]))[_0x33eb('0x1b')](_0x33eb('0x1c'),_0x32d90d);}};module[_0x33eb('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 6e6e108..254b388 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 _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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'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 +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(_0x568a61,_0x2124f8){var _0x334c3b=function(_0x1afc39){while(--_0x1afc39){_0x568a61['push'](_0x568a61['shift']());}};_0x334c3b(++_0x2124f8);}(_0x2ef3,0xba));var _0x32ef=function(_0x55cf84,_0x3bf710){_0x55cf84=_0x55cf84-0x0;var _0x211623=_0x2ef3[_0x55cf84];return _0x211623;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index aa11237..753efd1 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 _0xe64a=['stringify','format','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','map','prototype','updateRealtime','paused','length','loggedIn','smsPause','available'];(function(_0x485150,_0x1e343a){var _0x5e1dfd=function(_0x2af564){while(--_0x2af564){_0x485150['push'](_0x485150['shift']());}};_0x5e1dfd(++_0x1e343a);}(_0xe64a,0x1e0));var _0xae64=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe64a[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xae64('0x0'));var md5=require(_0xae64('0x1'));var util=require(_0xae64('0x2'));var Redis=require(_0xae64('0x3'));var config=require(_0xae64('0x4'));config[_0xae64('0x5')]=_[_0xae64('0x6')](config[_0xae64('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x527d9c){this['id']=_0x527d9c['id']||0x0;this[_0xae64('0x7')]=_0x527d9c[_0xae64('0x7')]||'';this[_0xae64('0x8')]=_0x527d9c[_0xae64('0x8')]||0xa;this[_0xae64('0x9')]=_0x527d9c[_0xae64('0x9')]||_0xae64('0xa');this[_0xae64('0xb')]=_0x527d9c[_0xae64('0xb')];this[_0xae64('0xc')]={};this[_0xae64('0xd')]=0x0;this['md5']='';this[_0xae64('0xe')]();this['updateRealtime']();}SmsQueue['prototype'][_0xae64('0xe')]=function(){var _0x32fca7=this[_0xae64('0xc')][_0xae64('0xf')];this['mapAgentsId']=_[_0xae64('0x10')](this['Agents'],'id');this['mapAgentsId'][_0xae64('0xf')]=_0x32fca7;};SmsQueue[_0xae64('0x11')][_0xae64('0x12')]=function(){this['loggedIn']=0x0;this[_0xae64('0x13')]=0x0;for(var _0x760b31=0x0;_0x760b31=0x0?this[_0xae64('0x17')]:0x0;var _0x2500f1={'id':this['id'],'available':this[_0xae64('0x17')],'loggedIn':this[_0xae64('0x15')],'name':this[_0xae64('0x7')],'paused':this['paused'],'waiting':this[_0xae64('0xd')]};var _0x3528c2=md5(JSON[_0xae64('0x18')](_0x2500f1));if(this[_0xae64('0x1')]!==_0x3528c2){this[_0xae64('0x1')]=_0x3528c2;io['to'](util[_0xae64('0x19')]('sms:queue:%s',_0x2500f1[_0xae64('0x7')]))['emit'](_0xae64('0x1a'),_0x2500f1);}};module[_0xae64('0x1b')]=SmsQueue; \ No newline at end of file +var _0xb717=['updateRouting','updateRealtime','map','_rr','paused','length','online','smsPause','available','loggedIn','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xb717,0x1b4));var _0x7b71=function(_0xc1d298,_0x51d3e7){_0xc1d298=_0xc1d298-0x0;var _0x336163=_0xb717[_0xc1d298];return _0x336163;};'use strict';var _=require(_0x7b71('0x0'));var md5=require('md5');var util=require(_0x7b71('0x1'));var Redis=require('ioredis');var config=require(_0x7b71('0x2'));config[_0x7b71('0x3')]=_[_0x7b71('0x4')](config['redis'],{'host':_0x7b71('0x5'),'port':0x18eb});var io=require(_0x7b71('0x6'))(new Redis(config[_0x7b71('0x3')]));function SmsQueue(_0x26044f){this['id']=_0x26044f['id']||0x0;this[_0x7b71('0x7')]=_0x26044f['name']||'';this[_0x7b71('0x8')]=_0x26044f[_0x7b71('0x8')]||0xa;this[_0x7b71('0x9')]=_0x26044f[_0x7b71('0x9')]||_0x7b71('0xa');this['Agents']=_0x26044f[_0x7b71('0xb')];this[_0x7b71('0xc')]={};this['waiting']=0x0;this[_0x7b71('0xd')]='';this[_0x7b71('0xe')]();this[_0x7b71('0xf')]();}SmsQueue['prototype'][_0x7b71('0xe')]=function(){var _0x4a39d4=this[_0x7b71('0xc')]['_rr'];this[_0x7b71('0xc')]=_[_0x7b71('0x10')](this[_0x7b71('0xb')],'id');this[_0x7b71('0xc')][_0x7b71('0x11')]=_0x4a39d4;};SmsQueue['prototype'][_0x7b71('0xf')]=function(){this['loggedIn']=0x0;this[_0x7b71('0x12')]=0x0;for(var _0x22114a=0x0;_0x22114a=0x0?this['available']:0x0;var _0x1fd67d={'id':this['id'],'available':this[_0x7b71('0x16')],'loggedIn':this[_0x7b71('0x17')],'name':this[_0x7b71('0x7')],'paused':this[_0x7b71('0x12')],'waiting':this['waiting']};var _0xa1ba78=md5(JSON[_0x7b71('0x18')](_0x1fd67d));if(this[_0x7b71('0xd')]!==_0xa1ba78){this[_0x7b71('0xd')]=_0xa1ba78;io['to'](util[_0x7b71('0x19')](_0x7b71('0x1a'),_0x1fd67d['name']))[_0x7b71('0x1b')](_0x7b71('0x1c'),_0x1fd67d);}};module[_0x7b71('0x1d')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 86e59ec..088a384 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 _0x3a08=['name','timeout','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','prototype','_rr','map','updateRealtime','paused','loggedIn','whatsappPause','available','stringify','format','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter'];(function(_0x2e2e91,_0x4d6995){var _0x42940a=function(_0x4d581a){while(--_0x4d581a){_0x2e2e91['push'](_0x2e2e91['shift']());}};_0x42940a(++_0x4d6995);}(_0x3a08,0x164));var _0x83a0=function(_0x2d27d5,_0x36ee88){_0x2d27d5=_0x2d27d5-0x0;var _0x510d35=_0x3a08[_0x2d27d5];return _0x510d35;};'use strict';var _=require(_0x83a0('0x0'));var md5=require('md5');var util=require(_0x83a0('0x1'));var Redis=require(_0x83a0('0x2'));var config=require(_0x83a0('0x3'));config[_0x83a0('0x4')]=_[_0x83a0('0x5')](config[_0x83a0('0x4')],{'host':_0x83a0('0x6'),'port':0x18eb});var io=require(_0x83a0('0x7'))(new Redis(config[_0x83a0('0x4')]));function WhatsappQueue(_0x1ea297){this['id']=_0x1ea297['id']||0x0;this['name']=_0x1ea297[_0x83a0('0x8')]||'';this[_0x83a0('0x9')]=_0x1ea297[_0x83a0('0x9')]||0xa;this['strategy']=_0x1ea297['strategy']||_0x83a0('0xa');this[_0x83a0('0xb')]=_0x1ea297[_0x83a0('0xb')];this[_0x83a0('0xc')]={};this[_0x83a0('0xd')]=0x0;this[_0x83a0('0xe')]='';this[_0x83a0('0xf')]();this['updateRealtime']();}WhatsappQueue[_0x83a0('0x10')][_0x83a0('0xf')]=function(){var _0x35d63c=this[_0x83a0('0xc')][_0x83a0('0x11')];this[_0x83a0('0xc')]=_[_0x83a0('0x12')](this[_0x83a0('0xb')],'id');this[_0x83a0('0xc')][_0x83a0('0x11')]=_0x35d63c;};WhatsappQueue['prototype'][_0x83a0('0x13')]=function(){this['loggedIn']=0x0;this[_0x83a0('0x14')]=0x0;for(var _0x16b7c3=0x0;_0x16b7c3=0x0?this[_0x83a0('0x17')]:0x0;var _0x1c5cd9={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x83a0('0x14')],'waiting':this[_0x83a0('0xd')]};var _0x3f3ecf=md5(JSON[_0x83a0('0x18')](_0x1c5cd9));if(this['md5']!==_0x3f3ecf){this[_0x83a0('0xe')]=_0x3f3ecf;io['to'](util[_0x83a0('0x19')]('whatsapp:queue:%s',_0x1c5cd9[_0x83a0('0x8')]))['emit'](_0x83a0('0x1a'),_0x1c5cd9);}};module[_0x83a0('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x2332=['loggedIn','whatsappPause','available','stringify','format','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','paused','length','online'];(function(_0x5d9468,_0x228009){var _0x757bac=function(_0x37fa4d){while(--_0x37fa4d){_0x5d9468['push'](_0x5d9468['shift']());}};_0x757bac(++_0x228009);}(_0x2332,0x1b8));var _0x2233=function(_0x21a820,_0x34099f){_0x21a820=_0x21a820-0x0;var _0x49b501=_0x2332[_0x21a820];return _0x49b501;};'use strict';var _=require(_0x2233('0x0'));var md5=require(_0x2233('0x1'));var util=require('util');var Redis=require(_0x2233('0x2'));var config=require(_0x2233('0x3'));config[_0x2233('0x4')]=_['defaults'](config[_0x2233('0x4')],{'host':_0x2233('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2233('0x4')]));function WhatsappQueue(_0x1b61a1){this['id']=_0x1b61a1['id']||0x0;this['name']=_0x1b61a1[_0x2233('0x6')]||'';this['timeout']=_0x1b61a1[_0x2233('0x7')]||0xa;this['strategy']=_0x1b61a1[_0x2233('0x8')]||_0x2233('0x9');this[_0x2233('0xa')]=_0x1b61a1[_0x2233('0xa')];this['mapAgentsId']={};this[_0x2233('0xb')]=0x0;this[_0x2233('0x1')]='';this[_0x2233('0xc')]();this[_0x2233('0xd')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x24dbe6=this[_0x2233('0xe')]['_rr'];this[_0x2233('0xe')]=_['map'](this[_0x2233('0xa')],'id');this[_0x2233('0xe')][_0x2233('0xf')]=_0x24dbe6;};WhatsappQueue['prototype'][_0x2233('0xd')]=function(){this['loggedIn']=0x0;this[_0x2233('0x10')]=0x0;for(var _0xe7d500=0x0;_0xe7d500=0x0?this['available']:0x0;var _0x3ab84a={'id':this['id'],'available':this[_0x2233('0x15')],'loggedIn':this[_0x2233('0x13')],'name':this[_0x2233('0x6')],'paused':this[_0x2233('0x10')],'waiting':this[_0x2233('0xb')]};var _0x523d63=md5(JSON[_0x2233('0x16')](_0x3ab84a));if(this['md5']!==_0x523d63){this[_0x2233('0x1')]=_0x523d63;io['to'](util[_0x2233('0x17')](_0x2233('0x18'),_0x3ab84a['name']))['emit'](_0x2233('0x19'),_0x3ab84a);}};module[_0x2233('0x1a')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 66263ce..caf1702 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(_0x26b865,_0x33dfab){var _0xc807c4=function(_0x2b4e0b){while(--_0x2b4e0b){_0x26b865['push'](_0x26b865['shift']());}};_0xc807c4(++_0x33dfab);}(_0xb10b,0x12a));var _0xbb10=function(_0x5d07bb,_0x271464){_0x5d07bb=_0x5d07bb-0x0;var _0x42960a=_0xb10b[_0x5d07bb];return _0x42960a;};'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(_0x16e0ed,_0x1fbaa5){var _0x4fe926=function(_0x52e294){while(--_0x52e294){_0x16e0ed['push'](_0x16e0ed['shift']());}};_0x4fe926(++_0x1fbaa5);}(_0xb10b,0x12a));var _0xbb10=function(_0xe22ceb,_0x27dc83){_0xe22ceb=_0xe22ceb-0x0;var _0x45bb58=_0xb10b[_0xe22ceb];return _0x45bb58;};'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 55b6b3d..772a811 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 _0x9460=['../client','update','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x35c4ac,_0x49ed32){var _0x276c5c=function(_0x165ac5){while(--_0x165ac5){_0x35c4ac['push'](_0x35c4ac['shift']());}};_0x276c5c(++_0x49ed32);}(_0x9460,0xcc));var _0x0946=function(_0x2cfdfa,_0x4cba6f){_0x2cfdfa=_0x2cfdfa-0x0;var _0x4af1c4=_0x9460[_0x2cfdfa];return _0x4af1c4;};'use strict';var client=require(_0x0946('0x0'));exports[_0x0946('0x1')]=function(_0x515989,_0x27dc67){return client['Request'](_0x0946('0x2'),{'body':_0x27dc67,'options':{'where':{'id':_0x515989}},'log':_0x0946('0x3')});};exports['addTags']=function(_0x267a29,_0x40051c){return client['Request'](_0x0946('0x4'),{'body':_0x40051c,'options':{'where':{'id':_0x267a29}},'log':_0x0946('0x5')});}; \ No newline at end of file +var _0x86b4=['update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','../client'];(function(_0x1193eb,_0x2a1969){var _0x5507f2=function(_0x3bc111){while(--_0x3bc111){_0x1193eb['push'](_0x1193eb['shift']());}};_0x5507f2(++_0x2a1969);}(_0x86b4,0x77));var _0x486b=function(_0x601bc1,_0x4e3e25){_0x601bc1=_0x601bc1-0x0;var _0x153598=_0x86b4[_0x601bc1];return _0x153598;};'use strict';var client=require(_0x486b('0x0'));exports[_0x486b('0x1')]=function(_0x3ab20c,_0x1bd9d2){return client[_0x486b('0x2')](_0x486b('0x3'),{'body':_0x1bd9d2,'options':{'where':{'id':_0x3ab20c}},'log':'updateChatInteraction'});};exports[_0x486b('0x4')]=function(_0x39d9a1,_0x1ec46e){return client[_0x486b('0x2')](_0x486b('0x5'),{'body':_0x1ec46e,'options':{'where':{'id':_0x39d9a1}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 303ad7b..41ca6a1 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 _0x7d22=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0x421cf8,_0x23152c){var _0x145c48=function(_0x565862){while(--_0x565862){_0x421cf8['push'](_0x421cf8['shift']());}};_0x145c48(++_0x23152c);}(_0x7d22,0x82));var _0x27d2=function(_0x5bf630,_0x550219){_0x5bf630=_0x5bf630-0x0;var _0x5421c6=_0x7d22[_0x5bf630];return _0x5421c6;};'use strict';var client=require(_0x27d2('0x0'));exports[_0x27d2('0x1')]=function(_0x5a67b7){return client[_0x27d2('0x2')](_0x27d2('0x3'),{'body':_0x5a67b7,'log':_0x27d2('0x4')});}; \ No newline at end of file +var _0x968d=['../client','create','Request','CreateChatMessage','createChatMessage'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x968d,0x1a9));var _0xd968=function(_0x3c57c7,_0x18e494){_0x3c57c7=_0x3c57c7-0x0;var _0x9c2cbb=_0x968d[_0x3c57c7];return _0x9c2cbb;};'use strict';var client=require(_0xd968('0x0'));exports[_0xd968('0x1')]=function(_0x3ce87a){return client[_0xd968('0x2')](_0xd968('0x3'),{'body':_0x3ce87a,'log':_0xd968('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index afaf7d5..65c7f94 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 _0xb13b=['chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy','User','online'];(function(_0x1b40c0,_0x3cd13b){var _0x350d64=function(_0x1384d5){while(--_0x1384d5){_0x1b40c0['push'](_0x1b40c0['shift']());}};_0x350d64(++_0x3cd13b);}(_0xb13b,0x1de));var _0xbb13=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xb13b[_0x4b2436];return _0x4f5ab2;};'use strict';var client=require(_0xbb13('0x0'));exports[_0xbb13('0x1')]=function(){return function(){return client[_0xbb13('0x2')](_0xbb13('0x3'),{'options':{'raw':![],'attributes':['id',_0xbb13('0x4'),'timeout',_0xbb13('0x5')],'include':[{'model':_0xbb13('0x6'),'as':'Agents','attributes':['id',_0xbb13('0x4'),_0xbb13('0x7'),_0xbb13('0x8')]}]},'log':_0xbb13('0x1')});};}; \ No newline at end of file +var _0x16a6=['GetChatQueue','name','timeout','strategy','User','Agents','online','chatPause','../client','getChatQueues'];(function(_0xe8ffa9,_0x3ee012){var _0x456f4e=function(_0x16e36e){while(--_0x16e36e){_0xe8ffa9['push'](_0xe8ffa9['shift']());}};_0x456f4e(++_0x3ee012);}(_0x16a6,0x15c));var _0x616a=function(_0x5d6e30,_0xc21d51){_0x5d6e30=_0x5d6e30-0x0;var _0x3d3f3b=_0x16a6[_0x5d6e30];return _0x3d3f3b;};'use strict';var client=require(_0x616a('0x0'));exports[_0x616a('0x1')]=function(){return function(){return client['Request'](_0x616a('0x2'),{'options':{'raw':![],'attributes':['id',_0x616a('0x3'),_0x616a('0x4'),_0x616a('0x5')],'include':[{'model':_0x616a('0x6'),'as':_0x616a('0x7'),'attributes':['id','name',_0x616a('0x8'),_0x616a('0x9')]}]},'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 b0acadf..b6f9465 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 _0xbb95=['DESC','UpdateChatQueueReport','../client','create','CreateChatQueueReport'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0xbb95,0x7f));var _0x5bb9=function(_0x23ce40,_0xcc9a2){_0x23ce40=_0x23ce40-0x0;var _0x169e30=_0xbb95[_0x23ce40];return _0x169e30;};'use strict';var client=require(_0x5bb9('0x0'));exports[_0x5bb9('0x1')]=function(_0x4d775a){return client['Request'](_0x5bb9('0x2'),{'body':_0x4d775a,'log':_0x5bb9('0x2')});};exports['update']=function(_0xbb4ae9,_0x572ef3){return client['Request']('UpdateChatQueueReport',{'body':_0x572ef3,'options':{'where':{'uniqueid':_0xbb4ae9},'order':[['id',_0x5bb9('0x3')]],'limit':0x1},'log':_0x5bb9('0x4')});}; \ No newline at end of file +var _0x207d=['create','Request','CreateChatQueueReport','UpdateChatQueueReport','DESC','../client'];(function(_0x4c711f,_0x42753d){var _0x41b3f5=function(_0x331271){while(--_0x331271){_0x4c711f['push'](_0x4c711f['shift']());}};_0x41b3f5(++_0x42753d);}(_0x207d,0x10d));var _0xd207=function(_0x2c35b0,_0x2613a9){_0x2c35b0=_0x2c35b0-0x0;var _0x51ffbe=_0x207d[_0x2c35b0];return _0x51ffbe;};'use strict';var client=require(_0xd207('0x0'));exports[_0xd207('0x1')]=function(_0x302062){return client[_0xd207('0x2')]('CreateChatQueueReport',{'body':_0x302062,'log':_0xd207('0x3')});};exports['update']=function(_0x4505f2,_0x422501){return client['Request'](_0xd207('0x4'),{'body':_0x422501,'options':{'where':{'uniqueid':_0x4505f2},'order':[['id',_0xd207('0x5')]],'limit':0x1},'log':_0xd207('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 1a65393..168aa93 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(_0x19ac6e,_0x435862){var _0x1cdcf3=function(_0x23151c){while(--_0x23151c){_0x19ac6e['push'](_0x19ac6e['shift']());}};_0x1cdcf3(++_0x435862);}(_0x7a54,0x106));var _0x47a5=function(_0x3c5e39,_0x371b2b){_0x3c5e39=_0x3c5e39-0x0;var _0x174c1f=_0x7a54[_0x3c5e39];return _0x174c1f;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x2b0644,_0x26f8ac){var _0x3bfc8c=function(_0x43c6ae){while(--_0x43c6ae){_0x2b0644['push'](_0x2b0644['shift']());}};_0x3bfc8c(++_0x26f8ac);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index bbf2312..88c3478 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 _0x0e8a=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x3c4e4c,_0x36ff70){var _0x144a87=function(_0x5efb4b){while(--_0x5efb4b){_0x3c4e4c['push'](_0x3c4e4c['shift']());}};_0x144a87(++_0x36ff70);}(_0x0e8a,0x11f));var _0xa0e8=function(_0x32d1a9,_0x1b470c){_0x32d1a9=_0x32d1a9-0x0;var _0x50eaf1=_0x0e8a[_0x32d1a9];return _0x50eaf1;};'use strict';var client=require(_0xa0e8('0x0'));exports[_0xa0e8('0x1')]=function(_0x494c49){return client['Request'](_0xa0e8('0x2'),{'body':_0x494c49,'log':_0xa0e8('0x3')});}; \ No newline at end of file +var _0x7d2e=['Request','../client'];(function(_0x1b646f,_0x44b1f0){var _0x5663a8=function(_0x548a9d){while(--_0x548a9d){_0x1b646f['push'](_0x1b646f['shift']());}};_0x5663a8(++_0x44b1f0);}(_0x7d2e,0x89));var _0xe7d2=function(_0x22f75e,_0x4a9e06){_0x22f75e=_0x22f75e-0x0;var _0x1f6ab3=_0x7d2e[_0x22f75e];return _0x1f6ab3;};'use strict';var client=require(_0xe7d2('0x0'));exports['create']=function(_0xa2aa98){return client[_0xe7d2('0x1')]('CreateFaxMessage',{'body':_0xa2aa98,'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 cc0dc4f..53c8ceb 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 _0x2cf7=['Agents','online','faxPause','getFaxQueues','GetFaxQueue','name','timeout','strategy','User'];(function(_0x15a4c3,_0x4c0b8a){var _0x2be4cf=function(_0x416c61){while(--_0x416c61){_0x15a4c3['push'](_0x15a4c3['shift']());}};_0x2be4cf(++_0x4c0b8a);}(_0x2cf7,0x174));var _0x72cf=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x2cf7[_0x16de68];return _0x1c277e;};'use strict';var client=require('../client');exports[_0x72cf('0x0')]=function(){return function(){return client['Request'](_0x72cf('0x1'),{'options':{'raw':![],'attributes':['id',_0x72cf('0x2'),_0x72cf('0x3'),_0x72cf('0x4')],'include':[{'model':_0x72cf('0x5'),'as':_0x72cf('0x6'),'attributes':['id',_0x72cf('0x2'),_0x72cf('0x7'),_0x72cf('0x8')]}]},'log':_0x72cf('0x0')});};}; \ No newline at end of file +var _0xc7f7=['timeout','strategy','User','online','faxPause','../client','getFaxQueues','Request','name'];(function(_0x499daa,_0x400ff8){var _0x2e15f2=function(_0x47e09b){while(--_0x47e09b){_0x499daa['push'](_0x499daa['shift']());}};_0x2e15f2(++_0x400ff8);}(_0xc7f7,0xef));var _0x7c7f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7f7[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x7c7f('0x0'));exports[_0x7c7f('0x1')]=function(){return function(){return client[_0x7c7f('0x2')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x7c7f('0x3'),_0x7c7f('0x4'),_0x7c7f('0x5')],'include':[{'model':_0x7c7f('0x6'),'as':'Agents','attributes':['id',_0x7c7f('0x3'),_0x7c7f('0x7'),_0x7c7f('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 adcaa7f..590743a 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 _0x4783=['create','CreateFaxQueueReport','Request','UpdateFaxQueueReport','DESC','../client'];(function(_0x33ae5d,_0x518c4e){var _0x14ff4d=function(_0x1446aa){while(--_0x1446aa){_0x33ae5d['push'](_0x33ae5d['shift']());}};_0x14ff4d(++_0x518c4e);}(_0x4783,0x179));var _0x3478=function(_0x425919,_0x180d1b){_0x425919=_0x425919-0x0;var _0x4eaedc=_0x4783[_0x425919];return _0x4eaedc;};'use strict';var client=require(_0x3478('0x0'));exports[_0x3478('0x1')]=function(_0x5198bd){return client['Request'](_0x3478('0x2'),{'body':_0x5198bd,'log':_0x3478('0x2')});};exports['update']=function(_0x1711c2,_0x29dd56){return client[_0x3478('0x3')](_0x3478('0x4'),{'body':_0x29dd56,'options':{'where':{'uniqueid':_0x1711c2},'order':[['id',_0x3478('0x5')]],'limit':0x1},'log':_0x3478('0x4')});}; \ No newline at end of file +var _0x7b9b=['CreateFaxQueueReport','update','DESC','UpdateFaxQueueReport','../client','create','Request'];(function(_0x14684,_0x6214e8){var _0x538d29=function(_0x101796){while(--_0x101796){_0x14684['push'](_0x14684['shift']());}};_0x538d29(++_0x6214e8);}(_0x7b9b,0x177));var _0xb7b9=function(_0x42b030,_0x252cb6){_0x42b030=_0x42b030-0x0;var _0x112303=_0x7b9b[_0x42b030];return _0x112303;};'use strict';var client=require(_0xb7b9('0x0'));exports[_0xb7b9('0x1')]=function(_0x1514c4){return client[_0xb7b9('0x2')]('CreateFaxQueueReport',{'body':_0x1514c4,'log':_0xb7b9('0x3')});};exports[_0xb7b9('0x4')]=function(_0x330e6d,_0x49c105){return client[_0xb7b9('0x2')]('UpdateFaxQueueReport',{'body':_0x49c105,'options':{'where':{'uniqueid':_0x330e6d},'order':[['id',_0xb7b9('0x5')]],'limit':0x1},'log':_0xb7b9('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 1394b1f..0e9c897 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 _0x75b8=['../client','getIntervals','name'];(function(_0x17c54d,_0x598b4d){var _0x529552=function(_0x22b36f){while(--_0x22b36f){_0x17c54d['push'](_0x17c54d['shift']());}};_0x529552(++_0x598b4d);}(_0x75b8,0x1e6));var _0x875b=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x75b8[_0x15c421];return _0x5e5ed5;};'use strict';var client=require(_0x875b('0x0'));exports[_0x875b('0x1')]=function(){return function(){return client['Request']('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x875b('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x875b('0x2'),'interval']}]},'log':_0x875b('0x1')});};}; \ No newline at end of file +var _0x65ba=['Interval','Intervals','../client','getIntervals','Request','name'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x65ba,0xda));var _0xa65b=function(_0x198680,_0x13c5ad){_0x198680=_0x198680-0x0;var _0x44381a=_0x65ba[_0x198680];return _0x44381a;};'use strict';var client=require(_0xa65b('0x0'));exports[_0xa65b('0x1')]=function(){return function(){return client[_0xa65b('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xa65b('0x3')],'include':[{'model':_0xa65b('0x4'),'as':_0xa65b('0x5'),'attributes':['id',_0xa65b('0x3'),'interval']}]},'log':_0xa65b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 461aa0e..9275a3a 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 _0x2a07=['updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request'];(function(_0x594e11,_0x28f652){var _0x5418ad=function(_0x5dcfa7){while(--_0x5dcfa7){_0x594e11['push'](_0x594e11['shift']());}};_0x5418ad(++_0x28f652);}(_0x2a07,0x74));var _0x72a0=function(_0x5acb94,_0x389dbc){_0x5acb94=_0x5acb94-0x0;var _0x11800a=_0x2a07[_0x5acb94];return _0x11800a;};'use strict';var client=require(_0x72a0('0x0'));exports[_0x72a0('0x1')]=function(_0x3ed8a9,_0x437db4){return client[_0x72a0('0x2')]('UpdateMailInteraction',{'body':_0x437db4,'options':{'where':{'id':_0x3ed8a9}},'log':_0x72a0('0x3')});};exports[_0x72a0('0x4')]=function(_0x135982,_0x45b155){return client[_0x72a0('0x2')](_0x72a0('0x5'),{'body':_0x45b155,'options':{'where':{'id':_0x135982}},'log':_0x72a0('0x6')});}; \ No newline at end of file +var _0x955f=['update','Request','updateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x2bb121,_0xb11dc1){var _0x10ec2a=function(_0x11d808){while(--_0x11d808){_0x2bb121['push'](_0x2bb121['shift']());}};_0x10ec2a(++_0xb11dc1);}(_0x955f,0x1eb));var _0xf955=function(_0x5c93e8,_0xa75afb){_0x5c93e8=_0x5c93e8-0x0;var _0x213b48=_0x955f[_0x5c93e8];return _0x213b48;};'use strict';var client=require(_0xf955('0x0'));exports[_0xf955('0x1')]=function(_0x438668,_0x382225){return client[_0xf955('0x2')]('UpdateMailInteraction',{'body':_0x382225,'options':{'where':{'id':_0x438668}},'log':_0xf955('0x3')});};exports['addTags']=function(_0x5d0c95,_0x1db0dd){return client['Request'](_0xf955('0x4'),{'body':_0x1db0dd,'options':{'where':{'id':_0x5d0c95}},'log':_0xf955('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a605c83..6fce669 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 _0x1888=['CreateMailMessage','createMailMessage','../client','create'];(function(_0x18295b,_0x1c0aea){var _0x59890b=function(_0x1ff845){while(--_0x1ff845){_0x18295b['push'](_0x18295b['shift']());}};_0x59890b(++_0x1c0aea);}(_0x1888,0x166));var _0x8188=function(_0x41e81d,_0x2be61e){_0x41e81d=_0x41e81d-0x0;var _0x40292d=_0x1888[_0x41e81d];return _0x40292d;};'use strict';var client=require(_0x8188('0x0'));exports[_0x8188('0x1')]=function(_0x48a372){return client['Request'](_0x8188('0x2'),{'body':_0x48a372,'log':_0x8188('0x3')});}; \ No newline at end of file +var _0x4f1d=['create','Request','CreateMailMessage','createMailMessage','../client'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x4f1d,0x17b));var _0xd4f1=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4f1d[_0x59ee6f];return _0x4c0979;};'use strict';var client=require(_0xd4f1('0x0'));exports[_0xd4f1('0x1')]=function(_0x5e4108){return client[_0xd4f1('0x2')](_0xd4f1('0x3'),{'body':_0x5e4108,'log':_0xd4f1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 9bf0d8b..47fe128 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 _0xfc8a=['getMailQueues','Request','name','timeout','strategy','Agents','online','mailPause','../client'];(function(_0x29e7fb,_0x5b2ff3){var _0x171dad=function(_0x3ddce4){while(--_0x3ddce4){_0x29e7fb['push'](_0x29e7fb['shift']());}};_0x171dad(++_0x5b2ff3);}(_0xfc8a,0x11f));var _0xafc8=function(_0x3294e6,_0x4d4aa4){_0x3294e6=_0x3294e6-0x0;var _0x3f326b=_0xfc8a[_0x3294e6];return _0x3f326b;};'use strict';var client=require(_0xafc8('0x0'));exports[_0xafc8('0x1')]=function(){return function(){return client[_0xafc8('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xafc8('0x3'),_0xafc8('0x4'),_0xafc8('0x5')],'include':[{'model':'User','as':_0xafc8('0x6'),'attributes':['id',_0xafc8('0x3'),_0xafc8('0x7'),_0xafc8('0x8')]}]},'log':_0xafc8('0x1')});};}; \ No newline at end of file +var _0x1bec=['Request','name','timeout','strategy','User','online','mailPause','getMailQueues'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1bec,0x168));var _0xc1be=function(_0x2c6a0d,_0x28a135){_0x2c6a0d=_0x2c6a0d-0x0;var _0x4f9bde=_0x1bec[_0x2c6a0d];return _0x4f9bde;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0xc1be('0x0')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xc1be('0x1'),_0xc1be('0x2'),_0xc1be('0x3')],'include':[{'model':_0xc1be('0x4'),'as':'Agents','attributes':['id',_0xc1be('0x1'),_0xc1be('0x5'),_0xc1be('0x6')]}]},'log':_0xc1be('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0355e1c..3ec226c 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 _0x2b48=['Request','CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create'];(function(_0x3a0ab1,_0x2f4830){var _0x5494c4=function(_0x4bef51){while(--_0x4bef51){_0x3a0ab1['push'](_0x3a0ab1['shift']());}};_0x5494c4(++_0x2f4830);}(_0x2b48,0xd6));var _0x82b4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x2b48[_0x4e676e];return _0x336a3c;};'use strict';var client=require(_0x82b4('0x0'));exports[_0x82b4('0x1')]=function(_0x15b3d0){return client[_0x82b4('0x2')](_0x82b4('0x3'),{'body':_0x15b3d0,'log':_0x82b4('0x3')});};exports['update']=function(_0x5c919b,_0x543b29){return client[_0x82b4('0x2')](_0x82b4('0x4'),{'body':_0x543b29,'options':{'where':{'uniqueid':_0x5c919b},'order':[['id',_0x82b4('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x7ca4=['CreateMailQueueReport','update','Request','UpdateMailQueueReport','DESC','create'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x7ca4,0x149));var _0x47ca=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x7ca4[_0x2dafbe];return _0x58a45a;};'use strict';var client=require('../client');exports[_0x47ca('0x0')]=function(_0x468e0a){return client['Request'](_0x47ca('0x1'),{'body':_0x468e0a,'log':_0x47ca('0x1')});};exports[_0x47ca('0x2')]=function(_0x3d5499,_0x39fad4){return client[_0x47ca('0x3')](_0x47ca('0x4'),{'body':_0x39fad4,'options':{'where':{'uniqueid':_0x3d5499},'order':[['id',_0x47ca('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 26199bc..573b118 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 _0x193b=['addTags','addTagsToChatInteraction','update','Request','UpdateOpenchannelInteraction'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x193b,0xfc));var _0xb193=function(_0x29a08d,_0x551eca){_0x29a08d=_0x29a08d-0x0;var _0x10fc1a=_0x193b[_0x29a08d];return _0x10fc1a;};'use strict';var client=require('../client');exports[_0xb193('0x0')]=function(_0x19e0b8,_0xa0c567){return client[_0xb193('0x1')](_0xb193('0x2'),{'body':_0xa0c567,'options':{'where':{'id':_0x19e0b8}},'log':'updateOpenchannelInteraction'});};exports[_0xb193('0x3')]=function(_0x346659,_0x46db1b){return client[_0xb193('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x46db1b,'options':{'where':{'id':_0x346659}},'log':_0xb193('0x4')});}; \ No newline at end of file +var _0xa9ff=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x11e413,_0x343351){var _0x391080=function(_0x6a84cb){while(--_0x6a84cb){_0x11e413['push'](_0x11e413['shift']());}};_0x391080(++_0x343351);}(_0xa9ff,0x14b));var _0xfa9f=function(_0x5f002d,_0x1b9dc8){_0x5f002d=_0x5f002d-0x0;var _0x544598=_0xa9ff[_0x5f002d];return _0x544598;};'use strict';var client=require(_0xfa9f('0x0'));exports[_0xfa9f('0x1')]=function(_0x45ce62,_0x1c15b7){return client[_0xfa9f('0x2')](_0xfa9f('0x3'),{'body':_0x1c15b7,'options':{'where':{'id':_0x45ce62}},'log':'updateOpenchannelInteraction'});};exports[_0xfa9f('0x4')]=function(_0x5ec91f,_0x3200f0){return client[_0xfa9f('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x3200f0,'options':{'where':{'id':_0x5ec91f}},'log':_0xfa9f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 3722242..81edf8d 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 _0xdd49=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x3d7c57,_0x45f6f0){var _0x2258d2=function(_0x3d8346){while(--_0x3d8346){_0x3d7c57['push'](_0x3d7c57['shift']());}};_0x2258d2(++_0x45f6f0);}(_0xdd49,0x67));var _0x9dd4=function(_0x3a441a,_0x43eb56){_0x3a441a=_0x3a441a-0x0;var _0x3128a2=_0xdd49[_0x3a441a];return _0x3128a2;};'use strict';var client=require(_0x9dd4('0x0'));exports['create']=function(_0x4e7567){return client[_0x9dd4('0x1')](_0x9dd4('0x2'),{'body':_0x4e7567,'log':_0x9dd4('0x3')});}; \ No newline at end of file +var _0x1a85=['../client','create','Request','CreateOpenchannelMessage'];(function(_0x20c27f,_0x301037){var _0x54c057=function(_0xe023a2){while(--_0xe023a2){_0x20c27f['push'](_0x20c27f['shift']());}};_0x54c057(++_0x301037);}(_0x1a85,0xec));var _0x51a8=function(_0x20fa63,_0x65c8d3){_0x20fa63=_0x20fa63-0x0;var _0x4c37ae=_0x1a85[_0x20fa63];return _0x4c37ae;};'use strict';var client=require(_0x51a8('0x0'));exports[_0x51a8('0x1')]=function(_0x152716){return client[_0x51a8('0x2')](_0x51a8('0x3'),{'body':_0x152716,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 0d55581..cc95daa 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 _0xd41f=['strategy','User','openchannelPause','getOpenchannelQueues','Request','name','timeout'];(function(_0x95bb87,_0x5cf74b){var _0x47e385=function(_0x2b6f2a){while(--_0x2b6f2a){_0x95bb87['push'](_0x95bb87['shift']());}};_0x47e385(++_0x5cf74b);}(_0xd41f,0xf1));var _0xfd41=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd41f[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0xfd41('0x0')]=function(){return function(){return client[_0xfd41('0x1')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xfd41('0x2'),_0xfd41('0x3'),_0xfd41('0x4')],'include':[{'model':_0xfd41('0x5'),'as':'Agents','attributes':['id','name','online',_0xfd41('0x6')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xb98b=['Request','name','timeout','strategy','User','Agents','online','openchannelPause','../client','getOpenchannelQueues'];(function(_0xee5c62,_0x310238){var _0x130ad5=function(_0x2a0074){while(--_0x2a0074){_0xee5c62['push'](_0xee5c62['shift']());}};_0x130ad5(++_0x310238);}(_0xb98b,0xee));var _0xbb98=function(_0x20bc6c,_0x27af8a){_0x20bc6c=_0x20bc6c-0x0;var _0x2666f7=_0xb98b[_0x20bc6c];return _0x2666f7;};'use strict';var client=require(_0xbb98('0x0'));exports[_0xbb98('0x1')]=function(){return function(){return client[_0xbb98('0x2')]('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xbb98('0x3'),_0xbb98('0x4'),_0xbb98('0x5')],'include':[{'model':_0xbb98('0x6'),'as':_0xbb98('0x7'),'attributes':['id',_0xbb98('0x3'),_0xbb98('0x8'),_0xbb98('0x9')]}]},'log':_0xbb98('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 1b86865..453edc9 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 _0xcde4=['UpdateOpenchannelQueueReport','DESC','../client','create','Request','update'];(function(_0xed93cb,_0xbbb9ed){var _0x9a9a6c=function(_0x625994){while(--_0x625994){_0xed93cb['push'](_0xed93cb['shift']());}};_0x9a9a6c(++_0xbbb9ed);}(_0xcde4,0x13a));var _0x4cde=function(_0x4b1032,_0x36952e){_0x4b1032=_0x4b1032-0x0;var _0x5a1d55=_0xcde4[_0x4b1032];return _0x5a1d55;};'use strict';var client=require(_0x4cde('0x0'));exports[_0x4cde('0x1')]=function(_0x4e9cc5){return client[_0x4cde('0x2')]('CreateOpenchannelQueueReport',{'body':_0x4e9cc5,'log':'CreateOpenchannelQueueReport'});};exports[_0x4cde('0x3')]=function(_0x27b033,_0x5a2928){return client['Request'](_0x4cde('0x4'),{'body':_0x5a2928,'options':{'where':{'uniqueid':_0x27b033},'order':[['id',_0x4cde('0x5')]],'limit':0x1},'log':_0x4cde('0x4')});}; \ No newline at end of file +var _0x047f=['../client','create','Request','CreateOpenchannelQueueReport','update','DESC'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x047f,0xfc));var _0xf047=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x047f[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xf047('0x0'));exports[_0xf047('0x1')]=function(_0xd99677){return client[_0xf047('0x2')]('CreateOpenchannelQueueReport',{'body':_0xd99677,'log':_0xf047('0x3')});};exports[_0xf047('0x4')]=function(_0x3f79de,_0xb9a62c){return client[_0xf047('0x2')]('UpdateOpenchannelQueueReport',{'body':_0xb9a62c,'options':{'where':{'uniqueid':_0x3f79de},'order':[['id',_0xf047('0x5')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index fa62686..bf23d1f 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 _0x826a=['UpdateSmsInteraction','updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update'];(function(_0x1edb23,_0x3feef7){var _0x19d91f=function(_0x436ba1){while(--_0x436ba1){_0x1edb23['push'](_0x1edb23['shift']());}};_0x19d91f(++_0x3feef7);}(_0x826a,0x1aa));var _0xa826=function(_0x24ced8,_0x3f5fa7){_0x24ced8=_0x24ced8-0x0;var _0x404c28=_0x826a[_0x24ced8];return _0x404c28;};'use strict';var client=require('../client');exports[_0xa826('0x0')]=function(_0x5bb1d7,_0x204abf){return client['Request'](_0xa826('0x1'),{'body':_0x204abf,'options':{'where':{'id':_0x5bb1d7}},'log':_0xa826('0x2')});};exports[_0xa826('0x3')]=function(_0x34e1ad,_0x5372ab){return client[_0xa826('0x4')](_0xa826('0x5'),{'body':_0x5372ab,'options':{'where':{'id':_0x34e1ad}},'log':_0xa826('0x6')});}; \ No newline at end of file +var _0x4a9c=['../client','update','Request','UpdateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x1f5c23,_0x1f3cbf){var _0x4d29e6=function(_0x19fb9b){while(--_0x19fb9b){_0x1f5c23['push'](_0x1f5c23['shift']());}};_0x4d29e6(++_0x1f3cbf);}(_0x4a9c,0xcc));var _0xc4a9=function(_0x2baa39,_0x548cd8){_0x2baa39=_0x2baa39-0x0;var _0xe40aed=_0x4a9c[_0x2baa39];return _0xe40aed;};'use strict';var client=require(_0xc4a9('0x0'));exports[_0xc4a9('0x1')]=function(_0x40eb25,_0xb74796){return client[_0xc4a9('0x2')](_0xc4a9('0x3'),{'body':_0xb74796,'options':{'where':{'id':_0x40eb25}},'log':'updateSmsInteraction'});};exports[_0xc4a9('0x4')]=function(_0x935998,_0x129b6f){return client['Request']('AddTagsToSmsInteraction',{'body':_0x129b6f,'options':{'where':{'id':_0x935998}},'log':_0xc4a9('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 9255fa2..5652404 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 _0xe250=['Request','CreateSmsMessage'];(function(_0x40a825,_0x3bac79){var _0x273a54=function(_0x5628d8){while(--_0x5628d8){_0x40a825['push'](_0x40a825['shift']());}};_0x273a54(++_0x3bac79);}(_0xe250,0xb0));var _0x0e25=function(_0x4d35c3,_0x5d29b8){_0x4d35c3=_0x4d35c3-0x0;var _0x397ef8=_0xe250[_0x4d35c3];return _0x397ef8;};'use strict';var client=require('../client');exports['create']=function(_0x14f60a){return client[_0x0e25('0x0')](_0x0e25('0x1'),{'body':_0x14f60a,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xc09e=['CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x5f4267,_0x4470c2){var _0x2b40e6=function(_0x396787){while(--_0x396787){_0x5f4267['push'](_0x5f4267['shift']());}};_0x2b40e6(++_0x4470c2);}(_0xc09e,0x196));var _0xec09=function(_0x1bdaab,_0x36cd1c){_0x1bdaab=_0x1bdaab-0x0;var _0x457a92=_0xc09e[_0x1bdaab];return _0x457a92;};'use strict';var client=require(_0xec09('0x0'));exports[_0xec09('0x1')]=function(_0x10eb24){return client['Request'](_0xec09('0x2'),{'body':_0x10eb24,'log':_0xec09('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 65358af..922c7a9 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x16d8d5,_0x535545){var _0x429572=function(_0x464ec7){while(--_0x464ec7){_0x16d8d5['push'](_0x16d8d5['shift']());}};_0x429572(++_0x535545);}(_0xe706,0xa3));var _0x6e70=function(_0x190ceb,_0x2345b2){_0x190ceb=_0x190ceb-0x0;var _0x5ce806=_0xe706[_0x190ceb];return _0x5ce806;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0xeb9561,_0x43ce8a){var _0x4f4c6b=function(_0xf35fcd){while(--_0xf35fcd){_0xeb9561['push'](_0xeb9561['shift']());}};_0x4f4c6b(++_0x43ce8a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a130cd7..2784ede 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x4e63dd,_0x588a20){var _0x119e03=function(_0x46867b){while(--_0x46867b){_0x4e63dd['push'](_0x4e63dd['shift']());}};_0x119e03(++_0x588a20);}(_0x70e0,0x17b));var _0x070e=function(_0xc5a719,_0x3eb93b){_0xc5a719=_0xc5a719-0x0;var _0x48b2fd=_0x70e0[_0xc5a719];return _0x48b2fd;};'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 +var _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x1251bd,_0x5efe62){var _0x516b2f=function(_0xcb4c1b){while(--_0xcb4c1b){_0x1251bd['push'](_0x1251bd['shift']());}};_0x516b2f(++_0x5efe62);}(_0x34e8,0x12c));var _0x834e=function(_0x522af1,_0x5325a8){_0x522af1=_0x522af1-0x0;var _0x284239=_0x34e8[_0x522af1];return _0x284239;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 2e41ba8..441fbfb 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(_0x31f15b,_0x21ad16){var _0x4ab04f=function(_0x229349){while(--_0x229349){_0x31f15b['push'](_0x31f15b['shift']());}};_0x4ab04f(++_0x21ad16);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x801f9f,_0x44fc40){var _0x3d67ef=function(_0x5ebc0d){while(--_0x5ebc0d){_0x801f9f['push'](_0x801f9f['shift']());}};_0x3d67ef(++_0x44fc40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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 6144edb..8b32703 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 _0xacf4=['AddTagsToWhatsappInteraction','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xacf4,0xe7));var _0x4acf=function(_0x5217e2,_0x15c6f1){_0x5217e2=_0x5217e2-0x0;var _0x2da0b4=_0xacf4[_0x5217e2];return _0x2da0b4;};'use strict';var client=require('../client');exports['update']=function(_0x867c40,_0x14a022){return client[_0x4acf('0x0')](_0x4acf('0x1'),{'body':_0x14a022,'options':{'where':{'id':_0x867c40}},'log':_0x4acf('0x2')});};exports[_0x4acf('0x3')]=function(_0x145264,_0x5cf22d){return client[_0x4acf('0x0')](_0x4acf('0x4'),{'body':_0x5cf22d,'options':{'where':{'id':_0x145264}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x9541=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','../client','update','Request'];(function(_0x56cae2,_0x15a8cf){var _0x32b455=function(_0xd444f6){while(--_0xd444f6){_0x56cae2['push'](_0x56cae2['shift']());}};_0x32b455(++_0x15a8cf);}(_0x9541,0xb3));var _0x1954=function(_0x4ee960,_0x6389a4){_0x4ee960=_0x4ee960-0x0;var _0x4d9c93=_0x9541[_0x4ee960];return _0x4d9c93;};'use strict';var client=require(_0x1954('0x0'));exports[_0x1954('0x1')]=function(_0x158d6f,_0x169dc2){return client[_0x1954('0x2')](_0x1954('0x3'),{'body':_0x169dc2,'options':{'where':{'id':_0x158d6f}},'log':_0x1954('0x4')});};exports[_0x1954('0x5')]=function(_0x581d8c,_0x54d8f6){return client[_0x1954('0x2')](_0x1954('0x6'),{'body':_0x54d8f6,'options':{'where':{'id':_0x581d8c}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 32e721b..64dc0be 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 _0x35e0=['../client','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x11e704,_0xcd014c){var _0x453175=function(_0x856b34){while(--_0x856b34){_0x11e704['push'](_0x11e704['shift']());}};_0x453175(++_0xcd014c);}(_0x35e0,0xc3));var _0x035e=function(_0x4defbd,_0x4f788f){_0x4defbd=_0x4defbd-0x0;var _0x7a49ec=_0x35e0[_0x4defbd];return _0x7a49ec;};'use strict';var client=require(_0x035e('0x0'));exports['create']=function(_0x191fae){return client['Request'](_0x035e('0x1'),{'body':_0x191fae,'log':_0x035e('0x2')});}; \ No newline at end of file +var _0x10bf=['CreateWhatsappMessage','createWhatsappMessage','create','Request'];(function(_0x1a7550,_0x1edace){var _0x426e22=function(_0x1c10a1){while(--_0x1c10a1){_0x1a7550['push'](_0x1a7550['shift']());}};_0x426e22(++_0x1edace);}(_0x10bf,0x9e));var _0xf10b=function(_0x5a9fad,_0x4a4e40){_0x5a9fad=_0x5a9fad-0x0;var _0x1f1585=_0x10bf[_0x5a9fad];return _0x1f1585;};'use strict';var client=require('../client');exports[_0xf10b('0x0')]=function(_0x569ec8){return client[_0xf10b('0x1')](_0xf10b('0x2'),{'body':_0x569ec8,'log':_0xf10b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 5c6d099..3061273 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 _0x05ae=['name','timeout','strategy','Agents','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x05ae,0xef));var _0xe05a=function(_0x2be18b,_0x1a7d07){_0x2be18b=_0x2be18b-0x0;var _0x4eaaee=_0x05ae[_0x2be18b];return _0x4eaaee;};'use strict';var client=require(_0xe05a('0x0'));exports[_0xe05a('0x1')]=function(){return function(){return client[_0xe05a('0x2')](_0xe05a('0x3'),{'options':{'raw':![],'attributes':['id',_0xe05a('0x4'),_0xe05a('0x5'),_0xe05a('0x6')],'include':[{'model':'User','as':_0xe05a('0x7'),'attributes':['id',_0xe05a('0x4'),'online',_0xe05a('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x2bc5=['timeout','strategy','User','online','whatsappPause','../client','getWhatsappQueues','GetWhatsappQueue','name'];(function(_0x9517bb,_0x383ec3){var _0x532233=function(_0x1f7da7){while(--_0x1f7da7){_0x9517bb['push'](_0x9517bb['shift']());}};_0x532233(++_0x383ec3);}(_0x2bc5,0xef));var _0x52bc=function(_0x4ca796,_0x10dc47){_0x4ca796=_0x4ca796-0x0;var _0x171f87=_0x2bc5[_0x4ca796];return _0x171f87;};'use strict';var client=require(_0x52bc('0x0'));exports[_0x52bc('0x1')]=function(){return function(){return client['Request'](_0x52bc('0x2'),{'options':{'raw':![],'attributes':['id',_0x52bc('0x3'),_0x52bc('0x4'),_0x52bc('0x5')],'include':[{'model':_0x52bc('0x6'),'as':'Agents','attributes':['id',_0x52bc('0x3'),_0x52bc('0x7'),_0x52bc('0x8')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index de1aac1..96acf56 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 _0x9021=['UpdateWhatsappQueueReport','DESC','../client','create','Request','CreateWhatsappQueueReport','update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x9021,0x159));var _0x1902=function(_0xb3fe4b,_0x1bde5c){_0xb3fe4b=_0xb3fe4b-0x0;var _0x42027f=_0x9021[_0xb3fe4b];return _0x42027f;};'use strict';var client=require(_0x1902('0x0'));exports[_0x1902('0x1')]=function(_0x3a728f){return client[_0x1902('0x2')](_0x1902('0x3'),{'body':_0x3a728f,'log':_0x1902('0x3')});};exports[_0x1902('0x4')]=function(_0x2b9b9b,_0x3308b4){return client[_0x1902('0x2')](_0x1902('0x5'),{'body':_0x3308b4,'options':{'where':{'uniqueid':_0x2b9b9b},'order':[['id',_0x1902('0x6')]],'limit':0x1},'log':_0x1902('0x5')});}; \ No newline at end of file +var _0x69af=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x1bfeb4,_0x428015){var _0x7b77e=function(_0x418f47){while(--_0x418f47){_0x1bfeb4['push'](_0x1bfeb4['shift']());}};_0x7b77e(++_0x428015);}(_0x69af,0xdc));var _0xf69a=function(_0x25bc2c,_0x3722a0){_0x25bc2c=_0x25bc2c-0x0;var _0x3f92d8=_0x69af[_0x25bc2c];return _0x3f92d8;};'use strict';var client=require(_0xf69a('0x0'));exports[_0xf69a('0x1')]=function(_0x3bfa3e){return client['Request'](_0xf69a('0x2'),{'body':_0x3bfa3e,'log':_0xf69a('0x2')});};exports[_0xf69a('0x3')]=function(_0x4886da,_0x2a7168){return client['Request'](_0xf69a('0x4'),{'body':_0x2a7168,'options':{'where':{'uniqueid':_0x4886da},'order':[['id',_0xf69a('0x5')]],'limit':0x1},'log':_0xf69a('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/server/applications/agent.js b/server/services/routing/server/applications/agent.js index 30bb21d..7410a83 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 _0x8fd9=['next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','stop','validate','lodash','util','seq-queue','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','find','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END'];(function(_0x22507b,_0x3ae7a6){var _0x349028=function(_0x481a7a){while(--_0x481a7a){_0x22507b['push'](_0x22507b['shift']());}};_0x349028(++_0x3ae7a6);}(_0x8fd9,0x18c));var _0x98fd=function(_0x1cef07,_0x1eb5f2){_0x1cef07=_0x1cef07-0x0;var _0x2f0a89=_0x8fd9[_0x1cef07];return _0x2f0a89;};'use strict';var schema=require(_0x98fd('0x0'));var _=require(_0x98fd('0x1'));var util=require(_0x98fd('0x2'));var seqqueue=require(_0x98fd('0x3'));var logger=require('../../../../config/logger')(_0x98fd('0x4'));var strategy=require(_0x98fd('0x5'));var queue=schema({'name':{'type':_0x98fd('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x98fd('0x7'),'message':_0x98fd('0x8')}});function writeLog(_0x198dd3,_0x60e99c,_0x35f87e){return logger[_0x98fd('0x9')](util[_0x98fd('0xa')](_0x98fd('0xb'),_0x198dd3,_0x60e99c[_0x98fd('0xc')],_0x35f87e));}function handleFindAgent(_0x3599db){return function(_0x4f4a12){return _0x4f4a12[_0x98fd('0xc')][_0x98fd('0xd')]()===_0x3599db[_0x98fd('0xd')]();};}exports[_0x98fd('0xe')]=function(_0x2ffae0,_0x82bafc,_0x5a9088,_0xef76a4){return function(_0x1d81a1){try{var _0x645163={'name':_0x82bafc[0x0],'timeout':_0x82bafc[0x1]};var _0x4448a2=queue[_0x98fd('0x0')](_0x645163,{'typecast':!![]});if(_0x4448a2[_0x98fd('0xf')]){logger[_0x98fd('0x10')](_0x98fd('0x11'),_0x2ffae0,_[_0x98fd('0x12')](_0x4448a2,_0x98fd('0x13'))[_0x98fd('0x14')](',\x20'));_0x1d81a1['stop']();}else{var _0x646a7c=_[_0x98fd('0x15')](_0x5a9088['agents'],handleFindAgent(_0x645163[_0x98fd('0xc')]));if(_0x646a7c){var _0x87749=(_0x645163[_0x98fd('0x16')]||0xa)*0x3e8;var _0x103342,_0x1b944e;var _0x4d5edb=seqqueue[_0x98fd('0x17')](_0x87749);_0x4d5edb['id']=_0x2ffae0;_0x4d5edb[_0x98fd('0x18')]=_0x87749;_0x4d5edb[_0x98fd('0x19')]=_0xef76a4[_0x98fd('0x19')];writeLog(_0x2ffae0,_0x646a7c,util['format'](_0x98fd('0x1a'),_0x87749));_0x5a9088[_0x98fd('0x1b')][_0x2ffae0]['on'](_0x98fd('0x1c'),function(){logger[_0x98fd('0x9')](_0x98fd('0x1d'),_0x2ffae0);clearTimeout(_0x1b944e);_0x1b944e=undefined;_0x4d5edb[_0x98fd('0x1e')]();if(_0x5a9088[_0x98fd('0x1b')][_0x2ffae0]){delete _0x5a9088[_0x98fd('0x1b')][_0x2ffae0];}_0x1d81a1['stop']();});_0x5a9088[_0x98fd('0x1b')][_0x2ffae0]['on'](_0x98fd('0x1f'),function(){if(_0x5a9088[_0x98fd('0x1b')][_0x2ffae0]){delete _0x5a9088[_0x98fd('0x1b')][_0x2ffae0];}});_0x1b944e=setTimeout(function(){logger[_0x98fd('0x9')](_0x98fd('0x20'),_0x2ffae0);clearTimeout(_0x1b944e);_0x4d5edb[_0x98fd('0x1e')]();_0x1d81a1[_0x98fd('0x21')]();},_0x87749);strategy[_0x98fd('0x22')](_0x4d5edb,_0x646a7c,_0x5a9088,_0xef76a4);}else{logger[_0x98fd('0x10')](_0x98fd('0x23'),_0x2ffae0,_0x645163[_0x98fd('0xc')]);_0x1d81a1['stop']();}}}catch(_0xbde675){console[_0x98fd('0x24')](_0xbde675);logger[_0x98fd('0x10')]('[%s][QUEUE]\x20%s',_0x2ffae0,_0xbde675[_0x98fd('0x25')]);_0x1d81a1[_0x98fd('0x26')]();}};}; \ No newline at end of file +var _0xf1de=['stop','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','rules','[%s][AGENT]\x20ROUTING\x20END','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x1fb262,_0x2a08e4){var _0x49f240=function(_0x5c5285){while(--_0x5c5285){_0x1fb262['push'](_0x1fb262['shift']());}};_0x49f240(++_0x2a08e4);}(_0xf1de,0x7c));var _0xef1d=function(_0x38bdc1,_0x2927cf){_0x38bdc1=_0x38bdc1-0x0;var _0x47098f=_0xf1de[_0x38bdc1];return _0x47098f;};'use strict';var schema=require(_0xef1d('0x0'));var _=require(_0xef1d('0x1'));var util=require(_0xef1d('0x2'));var seqqueue=require(_0xef1d('0x3'));var logger=require(_0xef1d('0x4'))(_0xef1d('0x5'));var strategy=require(_0xef1d('0x6'));var queue=schema({'name':{'type':_0xef1d('0x7'),'required':!![],'message':_0xef1d('0x8')},'timeout':{'type':_0xef1d('0x9'),'message':_0xef1d('0xa')}});function writeLog(_0x488d6f,_0x15ade2,_0x28898b){return logger[_0xef1d('0xb')](util['format'](_0xef1d('0xc'),_0x488d6f,_0x15ade2[_0xef1d('0xd')],_0x28898b));}function handleFindAgent(_0x34d07b){return function(_0x21f080){return _0x21f080[_0xef1d('0xd')]['toLowerCase']()===_0x34d07b[_0xef1d('0xe')]();};}exports[_0xef1d('0xf')]=function(_0x2ee933,_0x533462,_0x2b996f,_0x4444e1){return function(_0x3f2ff0){try{var _0x4469ad={'name':_0x533462[0x0],'timeout':_0x533462[0x1]};var _0x299a11=queue[_0xef1d('0x0')](_0x4469ad,{'typecast':!![]});if(_0x299a11[_0xef1d('0x10')]){logger[_0xef1d('0x11')]('[%s][AGENT]\x20%s',_0x2ee933,_[_0xef1d('0x12')](_0x299a11,_0xef1d('0x13'))[_0xef1d('0x14')](',\x20'));_0x3f2ff0['stop']();}else{var _0x4d9b54=_[_0xef1d('0x15')](_0x2b996f[_0xef1d('0x16')],handleFindAgent(_0x4469ad[_0xef1d('0xd')]));if(_0x4d9b54){var _0x56d781=(_0x4469ad[_0xef1d('0x17')]||0xa)*0x3e8;var _0x18a3a7,_0x317dc4;var _0x3a6f64=seqqueue[_0xef1d('0x18')](_0x56d781);_0x3a6f64['id']=_0x2ee933;_0x3a6f64[_0xef1d('0x19')]=_0x56d781;_0x3a6f64[_0xef1d('0x1a')]=_0x4444e1[_0xef1d('0x1a')];writeLog(_0x2ee933,_0x4d9b54,util[_0xef1d('0x1b')](_0xef1d('0x1c'),_0x56d781));_0x2b996f['rules'][_0x2ee933]['on'](_0xef1d('0x1d'),function(){logger[_0xef1d('0xb')](_0xef1d('0x1e'),_0x2ee933);clearTimeout(_0x317dc4);_0x317dc4=undefined;_0x3a6f64[_0xef1d('0x1f')]();if(_0x2b996f[_0xef1d('0x20')][_0x2ee933]){delete _0x2b996f[_0xef1d('0x20')][_0x2ee933];}_0x3f2ff0['stop']();});_0x2b996f[_0xef1d('0x20')][_0x2ee933]['on']('complete',function(){if(_0x2b996f[_0xef1d('0x20')][_0x2ee933]){delete _0x2b996f[_0xef1d('0x20')][_0x2ee933];}});_0x317dc4=setTimeout(function(){logger[_0xef1d('0xb')](_0xef1d('0x21'),_0x2ee933);clearTimeout(_0x317dc4);_0x3a6f64['close']();_0x3f2ff0[_0xef1d('0x22')]();},_0x56d781);strategy['agent'](_0x3a6f64,_0x4d9b54,_0x2b996f,_0x4444e1);}else{logger[_0xef1d('0x11')](_0xef1d('0x23'),_0x2ee933,_0x4469ad[_0xef1d('0xd')]);_0x3f2ff0[_0xef1d('0x24')]();}}}catch(_0x46b625){console[_0xef1d('0x25')](_0x46b625);logger[_0xef1d('0x11')](_0xef1d('0x26'),_0x2ee933,_0x46b625[_0xef1d('0x27')]);_0x3f2ff0['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 9c7b13d..315974f 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 _0x1149=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','info','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','interaction','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','Message','create','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','next','amazonlex','providerName','providerResponse','stringify','then','dialogState','lodash','moment','aws-sdk'];(function(_0xd08119,_0x1921ce){var _0x555ac5=function(_0x3e4b7b){while(--_0x3e4b7b){_0xd08119['push'](_0xd08119['shift']());}};_0x555ac5(++_0x1921ce);}(_0x1149,0x17d));var _0x9114=function(_0x595113,_0x3f41f2){_0x595113=_0x595113-0x0;var _0xb85369=_0x1149[_0x595113];return _0xb85369;};'use strict';var _=require(_0x9114('0x0'));var moment=require(_0x9114('0x1'));var AWS=require(_0x9114('0x2'));var utils=require(_0x9114('0x3'));var logger=require(_0x9114('0x4'))(_0x9114('0x5'));var rpc={'chatMessage':require(_0x9114('0x6')),'openchannelMessage':require(_0x9114('0x7')),'mailMessage':require(_0x9114('0x8')),'smsMessage':require(_0x9114('0x9')),'faxMessage':require(_0x9114('0xa')),'whatsappMessage':require(_0x9114('0xb'))};exports[_0x9114('0xc')]=function(_0x1d1041,_0x51d7b2){return function(_0x3f28e7){try{if(!_[_0x9114('0xd')](this['interaction'][_0x9114('0xe')])){logger[_0x9114('0xf')](_0x9114('0x10'),_0x1d1041,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3f28e7['next']();}var _0x4a5322={'ContactId':this[_0x9114('0x11')]['id'],'sentAt':moment()[_0x9114('0x12')](_0x9114('0x13')),'direction':'out'};if(this[_0x9114('0x14')]===_0x9114('0x15')||this['channel']==='whatsapp'){_0x4a5322['phone']=this[_0x9114('0x16')][_0x9114('0x17')];}var _0x4a7c68=this[_0x9114('0x14')];if(_0x4a7c68===_0x9114('0x18')){_0x4a5322[_0x9114('0x19')]=this[_0x9114('0x1a')]['id'];}else{_0x4a5322[_[_0x9114('0x1b')](_0x4a7c68)+'AccountId']=this[_0x9114('0x1a')]['id'];}_0x4a5322[_[_0x9114('0x1b')](_0x4a7c68)+_0x9114('0x1c')]=this[_0x9114('0x16')]['id'];if(this[_0x9114('0x16')][_0x9114('0x1d')]){var _0x206925=_0x51d7b2[0x4];if(!_[_0x9114('0x1e')](_0x206925)){_0x4a5322[_0x9114('0x1f')]=utils['getMustacheRender'](_0x206925,this);return rpc[_0x4a7c68+_0x9114('0x20')][_0x9114('0x21')](_0x4a5322)['then'](function(_0x4a089e){logger['info'](_0x9114('0x10'),_0x1d1041,_0x4a5322[_0x9114('0x1f')]);})[_0x9114('0x22')](function(_0x26c25c){logger[_0x9114('0x23')](_0x9114('0x10'),_0x1d1041,JSON['stringify'](_0x26c25c));})[_0x9114('0x24')](function(){logger[_0x9114('0xf')](_0x9114('0x25'),_0x1d1041);_0x3f28e7[_0x9114('0x26')]();});}else{logger[_0x9114('0xf')](_0x9114('0x27'),_0x1d1041);_0x3f28e7[_0x9114('0x26')]();}}else{var _0x1391d7=this;var _0x4717a2=new AWS['LexRuntime']({'accessKeyId':_0x51d7b2[0x0],'secretAccessKey':_0x51d7b2[0x1],'region':_0x51d7b2[0x2]});var _0x46ad9f={'botAlias':'$LATEST','botName':_0x51d7b2[0x3],'inputText':this[_0x9114('0x28')][_0x9114('0x1f')],'userId':this[_0x9114('0x14')]+':'+this['interaction']['id']['toString']()};_0x4717a2['postText'](_0x46ad9f,function(_0x55106,_0x33d566){if(_0x55106){logger[_0x9114('0x23')](_0x9114('0x10'),_0x1d1041,_0x55106[_0x9114('0x28')]);_0x3f28e7[_0x9114('0x29')]();}else if(_0x33d566&&_0x33d566[_0x9114('0x28')]){_0x1391d7[_0x9114('0x1f')][_0x9114('0x2a')]=_0x33d566;_0x4a5322[_0x9114('0x1f')]=_0x33d566['message'];_0x4a5322[_0x9114('0x2b')]=_0x9114('0x2a');_0x4a5322[_0x9114('0x2c')]=JSON[_0x9114('0x2d')](_0x33d566);return rpc[_0x4a7c68+_0x9114('0x20')][_0x9114('0x21')](_0x4a5322)[_0x9114('0x2e')](function(_0xeea808){logger['info'](_0x9114('0x10'),_0x1d1041,_0x4a5322[_0x9114('0x1f')]);if(_0x33d566[_0x9114('0x2f')]=='Failed'){_0x3f28e7[_0x9114('0x29')]();}else{_0x3f28e7[_0x9114('0x26')]();}})['catch'](function(_0x118b9e){logger[_0x9114('0x23')](_0x9114('0x10'),_0x1d1041,JSON[_0x9114('0x2d')](_0x118b9e));_0x3f28e7[_0x9114('0x29')]();});}else{_0x3f28e7[_0x9114('0x29')]();}});}}catch(_0x16887b){logger[_0x9114('0x23')](_0x9114('0x10'),_0x1d1041,JSON['stringify'](_0x16887b));_0x3f28e7[_0x9114('0x26')]();}};}; \ No newline at end of file +var _0x4737=['Failed','catch','lodash','moment','aws-sdk','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','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','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','body','getMustacheRender','Message','then','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','message','postText','amazonlex','providerResponse','dialogState'];(function(_0x2bcb3a,_0x533554){var _0x51688a=function(_0x438bd9){while(--_0x438bd9){_0x2bcb3a['push'](_0x2bcb3a['shift']());}};_0x51688a(++_0x533554);}(_0x4737,0x1f1));var _0x7473=function(_0x38025d,_0x3b4aeb){_0x38025d=_0x38025d-0x0;var _0x1dab74=_0x4737[_0x38025d];return _0x1dab74;};'use strict';var _=require(_0x7473('0x0'));var moment=require(_0x7473('0x1'));var AWS=require(_0x7473('0x2'));var utils=require('./utils');var logger=require(_0x7473('0x3'))(_0x7473('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x7473('0x5')),'mailMessage':require(_0x7473('0x6')),'smsMessage':require(_0x7473('0x7')),'faxMessage':require(_0x7473('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x3e2bce,_0x384619){return function(_0x4e82a2){try{if(!_[_0x7473('0x9')](this[_0x7473('0xa')][_0x7473('0xb')])){logger[_0x7473('0xc')](_0x7473('0xd'),_0x3e2bce,_0x7473('0xe'));return _0x4e82a2[_0x7473('0xf')]();}var _0x5a9ad9={'ContactId':this[_0x7473('0x10')]['id'],'sentAt':moment()[_0x7473('0x11')](_0x7473('0x12')),'direction':'out'};if(this[_0x7473('0x13')]==='sms'||this[_0x7473('0x13')]==='whatsapp'){_0x5a9ad9[_0x7473('0x14')]=this[_0x7473('0xa')][_0x7473('0x14')];}var _0x307207=this[_0x7473('0x13')];if(_0x307207===_0x7473('0x15')){_0x5a9ad9[_0x7473('0x16')]=this[_0x7473('0x17')]['id'];}else{_0x5a9ad9[_[_0x7473('0x18')](_0x307207)+'AccountId']=this['account']['id'];}_0x5a9ad9[_['upperFirst'](_0x307207)+_0x7473('0x19')]=this[_0x7473('0xa')]['id'];if(this[_0x7473('0xa')][_0x7473('0x1a')]){var _0x149d09=_0x384619[0x4];if(!_['isEmpty'](_0x149d09)){_0x5a9ad9[_0x7473('0x1b')]=utils[_0x7473('0x1c')](_0x149d09,this);return rpc[_0x307207+_0x7473('0x1d')]['create'](_0x5a9ad9)[_0x7473('0x1e')](function(_0x15ec80){logger[_0x7473('0xc')](_0x7473('0xd'),_0x3e2bce,_0x5a9ad9['body']);})['catch'](function(_0x3c0c46){logger[_0x7473('0x1f')](_0x7473('0xd'),_0x3e2bce,JSON[_0x7473('0x20')](_0x3c0c46));})[_0x7473('0x21')](function(){logger[_0x7473('0xc')](_0x7473('0x22'),_0x3e2bce);_0x4e82a2[_0x7473('0x23')]();});}else{logger[_0x7473('0xc')](_0x7473('0x24'),_0x3e2bce);_0x4e82a2[_0x7473('0x23')]();}}else{var _0x4f4803=this;var _0x5305ff=new AWS[(_0x7473('0x25'))]({'accessKeyId':_0x384619[0x0],'secretAccessKey':_0x384619[0x1],'region':_0x384619[0x2]});var _0x53b6d7={'botAlias':'$LATEST','botName':_0x384619[0x3],'inputText':this[_0x7473('0x26')]['body'],'userId':this[_0x7473('0x13')]+':'+this[_0x7473('0xa')]['id']['toString']()};_0x5305ff[_0x7473('0x27')](_0x53b6d7,function(_0x52bfa9,_0x168950){if(_0x52bfa9){logger[_0x7473('0x1f')](_0x7473('0xd'),_0x3e2bce,_0x52bfa9[_0x7473('0x26')]);_0x4e82a2[_0x7473('0xf')]();}else if(_0x168950&&_0x168950[_0x7473('0x26')]){_0x4f4803['body'][_0x7473('0x28')]=_0x168950;_0x5a9ad9[_0x7473('0x1b')]=_0x168950[_0x7473('0x26')];_0x5a9ad9['providerName']=_0x7473('0x28');_0x5a9ad9[_0x7473('0x29')]=JSON['stringify'](_0x168950);return rpc[_0x307207+_0x7473('0x1d')]['create'](_0x5a9ad9)['then'](function(_0x4f3494){logger[_0x7473('0xc')]('[%s][AMAZONLEX]\x20%s',_0x3e2bce,_0x5a9ad9['body']);if(_0x168950[_0x7473('0x2a')]==_0x7473('0x2b')){_0x4e82a2[_0x7473('0xf')]();}else{_0x4e82a2[_0x7473('0x23')]();}})[_0x7473('0x2c')](function(_0x2bcee3){logger[_0x7473('0x1f')](_0x7473('0xd'),_0x3e2bce,JSON[_0x7473('0x20')](_0x2bcee3));_0x4e82a2['next']();});}else{_0x4e82a2[_0x7473('0xf')]();}});}}catch(_0x5432da){logger['error']('[%s][AMAZONLEX]\x20%s',_0x3e2bce,JSON['stringify'](_0x5432da));_0x4e82a2[_0x7473('0x23')]();}};}; \ 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 fa58dab..5041676 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 _0x69ed=['lodash','moment','./utils','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','created','interaction','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','One\x20Time\x20already\x20sent','channel','contact','format','out','body','getMustacheRender','message','from','mail','phone','read','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','InteractionId','Message','Smtp','service','host','port','secure','auth','user','pass','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','update','catch','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop'];(function(_0x2bfaf2,_0x24cc10){var _0xb7530f=function(_0x26f3d1){while(--_0x26f3d1){_0x2bfaf2['push'](_0x2bfaf2['shift']());}};_0xb7530f(++_0x24cc10);}(_0x69ed,0xed));var _0xd69e=function(_0x51acb7,_0x310dfd){_0x51acb7=_0x51acb7-0x0;var _0x411e2a=_0x69ed[_0x51acb7];return _0x411e2a;};'use strict';var _=require(_0xd69e('0x0'));var moment=require(_0xd69e('0x1'));var utils=require(_0xd69e('0x2'));var logger=require('../../../../config/logger')(_0xd69e('0x3'));var rpc={'chatMessage':require(_0xd69e('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd69e('0x5')),'smsMessage':require(_0xd69e('0x6')),'faxMessage':require(_0xd69e('0x7')),'whatsappMessage':require(_0xd69e('0x8')),'chatInteraction':require(_0xd69e('0x9')),'openchannelInteraction':require(_0xd69e('0xa')),'mailInteraction':require(_0xd69e('0xb')),'smsInteraction':require(_0xd69e('0xc')),'faxInteraction':require(_0xd69e('0xd')),'whatsappInteraction':require(_0xd69e('0xe'))};var mailRpc=require(_0xd69e('0xf'));exports[_0xd69e('0x10')]=function(_0x3a1416,_0x481cf1){return function(_0x43553b){try{if(_0x481cf1[0x0]==='1'&&(_['isNil'](this['interaction'][_0xd69e('0x11')])||!this[_0xd69e('0x12')][_0xd69e('0x11')])){logger[_0xd69e('0x13')](_0xd69e('0x14'),_0x3a1416,_0xd69e('0x15'));return _0x43553b[_0xd69e('0x16')]();}if(_0x481cf1[0x0]==='2'&&this[_0xd69e('0x12')][_0xd69e('0x17')]){logger[_0xd69e('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3a1416,_0xd69e('0x18'));return _0x43553b[_0xd69e('0x16')]();}var _0x357afd=this[_0xd69e('0x19')];var _0x178c95={'ContactId':this[_0xd69e('0x1a')]['id'],'sentAt':moment()[_0xd69e('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xd69e('0x1c')};if(this[_0xd69e('0x19')]==='mail'){_0x178c95[_0xd69e('0x1d')]=utils[_0xd69e('0x1e')](_0x481cf1[0x2],this);}else{_0x178c95[_0xd69e('0x1d')]=utils['getMustacheRender'](_0x481cf1[0x1],this);}if(this[_0xd69e('0x1f')]){_0x178c95['to']=this[_0xd69e('0x1f')][_0xd69e('0x20')]||'';if(this[_0xd69e('0x19')]===_0xd69e('0x21')&&_0x481cf1[0x1]==='1'){_0x178c95['cc']=this[_0xd69e('0x1f')]['cc']||'';}_0x178c95['from']=this[_0xd69e('0x1f')]['to']||'';_0x178c95[_0xd69e('0x22')]=this['message'][_0xd69e('0x22')]||'';_0x178c95[_0xd69e('0x23')]=!![];if(this[_0xd69e('0x1f')]['subject']){_0x178c95['subject']='';_0x178c95[_0xd69e('0x24')]+=_[_0xd69e('0x25')](this[_0xd69e('0x1f')]['subject'],_0xd69e('0x26'))?'':_0xd69e('0x27');_0x178c95[_0xd69e('0x24')]+=this[_0xd69e('0x1f')]['subject'];}}if(this['channel']===_0xd69e('0x28')){_0x178c95[_0xd69e('0x29')]=this[_0xd69e('0x2a')]['id'];}else{_0x178c95[_[_0xd69e('0x2b')](this['channel'])+'AccountId']=this[_0xd69e('0x2a')]['id'];}_0x178c95[_[_0xd69e('0x2b')](this[_0xd69e('0x19')])+_0xd69e('0x2c')]=this['interaction']['id'];var _0x42ede9=this[_0xd69e('0x12')];if(rpc[this[_0xd69e('0x19')]+_0xd69e('0x2d')]){if(this[_0xd69e('0x19')]==='mail'){var _0x2c7692={'tls':{'rejectUnauthorized':![]}};if(this[_0xd69e('0x2a')][_0xd69e('0x2e')][_0xd69e('0x2f')]){_0x2c7692[_0xd69e('0x2f')]=this['account'][_0xd69e('0x2e')][_0xd69e('0x2f')];}else{_0x2c7692[_0xd69e('0x30')]=this[_0xd69e('0x2a')][_0xd69e('0x2e')][_0xd69e('0x30')];_0x2c7692[_0xd69e('0x31')]=this[_0xd69e('0x2a')][_0xd69e('0x2e')]['port'];_0x2c7692['secure']=this['account'][_0xd69e('0x2e')][_0xd69e('0x32')];}if(this['account'][_0xd69e('0x2e')]['authentication']){_0x2c7692[_0xd69e('0x33')]={'user':this[_0xd69e('0x2a')][_0xd69e('0x2e')][_0xd69e('0x34')],'pass':this[_0xd69e('0x2a')][_0xd69e('0x2e')][_0xd69e('0x35')]};}_0x178c95[_0xd69e('0x36')]=this['message'][_0xd69e('0x37')];_0x178c95['html']=_0xd69e('0x38')+_[_0xd69e('0x39')](_0x178c95['body'],_0xd69e('0x3a'),_0xd69e('0x3b'))+_0xd69e('0x3c');_0x178c95[_0xd69e('0x3d')]={'Auto-Submitted':_0xd69e('0x3e'),'X-Auto-Response-Suppress':_0xd69e('0x3f'),'Precedence':_0xd69e('0x40')};return mailRpc['sendMailMessage'](_0x2c7692,_0x178c95)[_0xd69e('0x41')](function(_0x591d7b){logger[_0xd69e('0x13')](_0xd69e('0x42'),_0x3a1416);_0x178c95[_0xd69e('0x37')]=_0x591d7b['message'][_0xd69e('0x37')];return rpc[_0x357afd+_0xd69e('0x2d')]['create'](_0x178c95);})['then'](function(_0x3020a5){logger[_0xd69e('0x13')](_0xd69e('0x14'),_0x3a1416,JSON[_0xd69e('0x43')](_0x3020a5));})['catch'](function(_0x51589a){logger['error'](_0xd69e('0x44'),_0x3a1416,JSON[_0xd69e('0x43')](_0x51589a));})[_0xd69e('0x45')](function(){Promise[_0xd69e('0x46')]()[_0xd69e('0x41')](function(){if(_0x481cf1[0x0]!=='2'||_0x42ede9[_0xd69e('0x17')])return;return rpc[_0x357afd+_0xd69e('0x47')][_0xd69e('0x48')](_0x42ede9['id'],{'autoreplyExecuted':!![]})[_0xd69e('0x41')](function(_0x4c48ac){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x3a1416,JSON[_0xd69e('0x43')](_0x4c48ac));})[_0xd69e('0x49')](function(_0x13b111){logger[_0xd69e('0x4a')](_0xd69e('0x4b'),_0x3a1416,JSON[_0xd69e('0x43')](_0x13b111));});})[_0xd69e('0x41')](function(){_0x43553b['next']();});});}else{return rpc[this[_0xd69e('0x19')]+'Message'][_0xd69e('0x4c')](_0x178c95)[_0xd69e('0x41')](function(_0x1a0abf){logger[_0xd69e('0x13')](_0xd69e('0x14'),_0x3a1416,_0x178c95[_0xd69e('0x1d')]);})[_0xd69e('0x49')](function(_0x460881){logger[_0xd69e('0x4a')]('[%s][AUTOREPLY]\x20%s',_0x3a1416,JSON['stringify'](_0x460881));})[_0xd69e('0x45')](function(){Promise[_0xd69e('0x46')]()[_0xd69e('0x41')](function(){if(_0x481cf1[0x0]!=='2'||_0x42ede9[_0xd69e('0x17')])return;return rpc[_0x357afd+_0xd69e('0x47')]['update'](_0x42ede9['id'],{'autoreplyExecuted':!![]})[_0xd69e('0x41')](function(_0x1a1b18){logger['info'](_0xd69e('0x4d'),_0x3a1416,JSON[_0xd69e('0x43')](_0x1a1b18));})['catch'](function(_0x5cb11a){logger[_0xd69e('0x4a')](_0xd69e('0x4b'),_0x3a1416,JSON[_0xd69e('0x43')](_0x5cb11a));});})[_0xd69e('0x41')](function(){_0x43553b['next']();});});}}}catch(_0x523991){logger[_0xd69e('0x4a')]('[%s][AUTOREPLY]\x20%s',_0x3a1416,JSON[_0xd69e('0x43')](_0x523991));_0x43553b[_0xd69e('0x4e')]();}};}; \ No newline at end of file +var _0x15f1=['service','host','port','secure','auth','user','pass','inReplyTo','replace',''+_[_0x115f('0x37')](_0x5d7129[_0x115f('0x1f')],_0x115f('0x38'),'';_0x5d7129[_0x115f('0x39')]={'Auto-Submitted':_0x115f('0x3a'),'X-Auto-Response-Suppress':_0x115f('0x3b'),'Precedence':_0x115f('0x3c')};return mailRpc[_0x115f('0x3d')](_0x51b0e9,_0x5d7129)[_0x115f('0x3e')](function(_0x3c3b76){logger[_0x115f('0x12')](_0x115f('0x3f'),_0x1325db);_0x5d7129['messageId']=_0x3c3b76[_0x115f('0x21')][_0x115f('0x40')];return rpc[_0xaecd1e+_0x115f('0x41')][_0x115f('0x42')](_0x5d7129);})['then'](function(_0x48adc1){logger[_0x115f('0x12')](_0x115f('0x13'),_0x1325db,JSON['stringify'](_0x48adc1));})[_0x115f('0x43')](function(_0x268987){logger[_0x115f('0x44')]('[RPC][%s][AUTOREPLY]\x20%s',_0x1325db,JSON[_0x115f('0x45')](_0x268987));})[_0x115f('0x46')](function(){Promise[_0x115f('0x47')]()['then'](function(){if(_0xa3ed42[0x0]!=='2'||_0x129ad2['autoreplyExecuted'])return;return rpc[_0xaecd1e+_0x115f('0x48')]['update'](_0x129ad2['id'],{'autoreplyExecuted':!![]})[_0x115f('0x3e')](function(_0x58f542){logger['info'](_0x115f('0x17'),_0x1325db,JSON[_0x115f('0x45')](_0x58f542));})[_0x115f('0x43')](function(_0x108fbd){logger[_0x115f('0x44')](_0x115f('0x49'),_0x1325db,JSON[_0x115f('0x45')](_0x108fbd));});})[_0x115f('0x3e')](function(){_0x2d9766[_0x115f('0x15')]();});});}else{return rpc[this[_0x115f('0x19')]+_0x115f('0x41')]['create'](_0x5d7129)[_0x115f('0x3e')](function(_0x543901){logger[_0x115f('0x12')](_0x115f('0x13'),_0x1325db,_0x5d7129['body']);})[_0x115f('0x43')](function(_0x4339bd){logger['error'](_0x115f('0x13'),_0x1325db,JSON[_0x115f('0x45')](_0x4339bd));})[_0x115f('0x46')](function(){Promise[_0x115f('0x47')]()['then'](function(){if(_0xa3ed42[0x0]!=='2'||_0x129ad2['autoreplyExecuted'])return;return rpc[_0xaecd1e+_0x115f('0x48')][_0x115f('0x4a')](_0x129ad2['id'],{'autoreplyExecuted':!![]})[_0x115f('0x3e')](function(_0x392ba6){logger['info'](_0x115f('0x17'),_0x1325db,JSON[_0x115f('0x45')](_0x392ba6));})[_0x115f('0x43')](function(_0x550fca){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1325db,JSON['stringify'](_0x550fca));});})[_0x115f('0x3e')](function(){_0x2d9766[_0x115f('0x15')]();});});}}}catch(_0x4acbd4){logger[_0x115f('0x44')](_0x115f('0x13'),_0x1325db,JSON[_0x115f('0x45')](_0x4acbd4));_0x2d9766[_0x115f('0x4b')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 5770910..5c6718d 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe79f=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xe79f,0x15a));var _0xfe79=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe79f[_0x321bb2];return _0x9c12ed;};'use strict';var moment=require(_0xfe79('0x0'));var logger=require(_0xfe79('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xfe79('0x2')),'smsInteraction':require(_0xfe79('0x3')),'mailInteraction':require(_0xfe79('0x4')),'faxInteraction':require(_0xfe79('0x5')),'whatsappInteraction':require(_0xfe79('0x6'))};exports[_0xfe79('0x7')]=function(_0x298f4f,_0x5d5c43,_0x6f8e58,_0x56e37e){return function(_0x22237b){try{logger[_0xfe79('0x8')](_0xfe79('0x9'),_0x298f4f,_0x5d5c43[0x0]);var _0x43031b={'closed':0x1,'closedAt':moment()[_0xfe79('0xa')](_0xfe79('0xb')),'closeReason':_0xfe79('0xc'),'disposition':_0x5d5c43[0x0]};if(rpc[_0x56e37e[_0xfe79('0xd')]+'Interaction']){rpc[_0x56e37e[_0xfe79('0xd')]+_0xfe79('0xe')][_0xfe79('0xf')](_0x56e37e[_0xfe79('0x10')]['id'],_0x43031b)[_0xfe79('0x11')](function(_0x3f6622){logger[_0xfe79('0x8')](_0xfe79('0x12'),_0x298f4f,_0x56e37e['interaction']['id']);})[_0xfe79('0x13')](function(_0x1953cf){logger[_0xfe79('0x14')](_0xfe79('0x15'),_0x298f4f,JSON['stringify'](_0x1953cf));})[_0xfe79('0x16')](function(){_0x22237b[_0xfe79('0x17')]();});}}catch(_0x2830df){logger['error'](_0xfe79('0x15'),_0x298f4f,JSON[_0xfe79('0x18')](_0x2830df));_0x22237b['stop']();}};}; \ No newline at end of file +var _0x8831=['routing','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','update','interaction','then','stringify','finally','stop','[%s][CLOSE]\x20%s','moment','../../../../config/logger'];(function(_0x122714,_0x5def4d){var _0x57ef42=function(_0x6c68e2){while(--_0x6c68e2){_0x122714['push'](_0x122714['shift']());}};_0x57ef42(++_0x5def4d);}(_0x8831,0x116));var _0x1883=function(_0x530ddb,_0x3008f8){_0x530ddb=_0x530ddb-0x0;var _0x4fa295=_0x8831[_0x530ddb];return _0x4fa295;};'use strict';var moment=require(_0x1883('0x0'));var logger=require(_0x1883('0x1'))(_0x1883('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x1883('0x3')),'faxInteraction':require(_0x1883('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x1883('0x5')]=function(_0x2068a8,_0x62ea65,_0x5aa7c7,_0x17b445){return function(_0x370d84){try{logger[_0x1883('0x6')](_0x1883('0x7'),_0x2068a8,_0x62ea65[0x0]);var _0x4d978b={'closed':0x1,'closedAt':moment()[_0x1883('0x8')](_0x1883('0x9')),'closeReason':_0x1883('0xa'),'disposition':_0x62ea65[0x0]};if(rpc[_0x17b445['channel']+_0x1883('0xb')]){rpc[_0x17b445[_0x1883('0xc')]+_0x1883('0xb')][_0x1883('0xd')](_0x17b445[_0x1883('0xe')]['id'],_0x4d978b)[_0x1883('0xf')](function(_0x5ccdcf){logger[_0x1883('0x6')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x2068a8,_0x17b445[_0x1883('0xe')]['id']);})['catch'](function(_0x37de15){logger['error']('[%s][CLOSE]\x20%s',_0x2068a8,JSON[_0x1883('0x10')](_0x37de15));})[_0x1883('0x11')](function(){_0x370d84[_0x1883('0x12')]();});}}catch(_0x5893c3){logger['error'](_0x1883('0x13'),_0x2068a8,JSON[_0x1883('0x10')](_0x5893c3));_0x370d84['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index dfd3ca5..593a87f 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc91=['YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','Message','create','then','body','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','textRequest','dialogflow','result','providerName','providerResponse','endConversation','message','moment','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format'];(function(_0x3cc6ae,_0x244145){var _0x5413ca=function(_0x512466){while(--_0x512466){_0x3cc6ae['push'](_0x3cc6ae['shift']());}};_0x5413ca(++_0x244145);}(_0xfc91,0xb5));var _0x1fc9=function(_0x58ff4c,_0x320115){_0x58ff4c=_0x58ff4c-0x0;var _0x2a49df=_0xfc91[_0x58ff4c];return _0x2a49df;};'use strict';var _=require('lodash');var moment=require(_0x1fc9('0x0'));var apiai=require('apiai-promise');var md5=require(_0x1fc9('0x1'));var utils=require(_0x1fc9('0x2'));var logger=require(_0x1fc9('0x3'))(_0x1fc9('0x4'));var rpc={'chatMessage':require(_0x1fc9('0x5')),'openchannelMessage':require(_0x1fc9('0x6')),'mailMessage':require(_0x1fc9('0x7')),'smsMessage':require(_0x1fc9('0x8')),'faxMessage':require(_0x1fc9('0x9')),'whatsappMessage':require(_0x1fc9('0xa'))};exports[_0x1fc9('0xb')]=function(_0x314e81,_0x4c8cea){return function(_0x320970){try{if(!_['isNil'](this['interaction'][_0x1fc9('0xc')])){logger[_0x1fc9('0xd')](_0x1fc9('0xe'),_0x314e81,_0x1fc9('0xf'));return _0x320970[_0x1fc9('0x10')]();}var _0x3fc4f4={'ContactId':this[_0x1fc9('0x11')]['id'],'sentAt':moment()[_0x1fc9('0x12')](_0x1fc9('0x13')),'direction':_0x1fc9('0x14')};if(this[_0x1fc9('0x15')]===_0x1fc9('0x16')||this[_0x1fc9('0x15')]===_0x1fc9('0x17')){_0x3fc4f4[_0x1fc9('0x18')]=this[_0x1fc9('0x19')][_0x1fc9('0x18')];}var _0x5bb258=this[_0x1fc9('0x15')];if(_0x5bb258===_0x1fc9('0x1a')){_0x3fc4f4['ChatWebsiteId']=this[_0x1fc9('0x1b')]['id'];}else{_0x3fc4f4[_[_0x1fc9('0x1c')](_0x5bb258)+_0x1fc9('0x1d')]=this[_0x1fc9('0x1b')]['id'];}_0x3fc4f4[_[_0x1fc9('0x1c')](_0x5bb258)+_0x1fc9('0x1e')]=this['interaction']['id'];if(this['interaction'][_0x1fc9('0x1f')]){var _0x50730f=_0x4c8cea[0x2];if(!_[_0x1fc9('0x20')](_0x50730f)){_0x3fc4f4['body']=utils['getMustacheRender'](_0x50730f,this);return rpc[_0x5bb258+_0x1fc9('0x21')][_0x1fc9('0x22')](_0x3fc4f4)[_0x1fc9('0x23')](function(_0x40efef){logger[_0x1fc9('0xd')](_0x1fc9('0xe'),_0x314e81,_0x3fc4f4[_0x1fc9('0x24')]);})[_0x1fc9('0x25')](function(_0x300c22){logger[_0x1fc9('0x26')](_0x1fc9('0xe'),_0x314e81,JSON[_0x1fc9('0x27')](_0x300c22));})[_0x1fc9('0x28')](function(){logger[_0x1fc9('0xd')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x314e81);_0x320970['stop']();});}else{logger[_0x1fc9('0xd')](_0x1fc9('0x29'),_0x314e81);_0x320970[_0x1fc9('0x2a')]();}}else{var _0x56a342=this;var _0x524e1a=apiai(_0x4c8cea[0x0],{'language':_0x4c8cea[0x1]||'en'});return _0x524e1a[_0x1fc9('0x2b')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0x1fc9('0x23')](function(_0x58f4ec){_0x56a342[_0x1fc9('0x24')][_0x1fc9('0x2c')]=_0x58f4ec;_0x3fc4f4['body']=_0x58f4ec[_0x1fc9('0x2d')]['fulfillment']['speech'];_0x3fc4f4[_0x1fc9('0x2e')]=_0x1fc9('0x2c');_0x3fc4f4[_0x1fc9('0x2f')]=JSON[_0x1fc9('0x27')](_0x58f4ec);return rpc[_0x5bb258+_0x1fc9('0x21')]['create'](_0x3fc4f4)[_0x1fc9('0x23')](function(_0x197546){logger['info'](_0x1fc9('0xe'),_0x314e81,_0x3fc4f4[_0x1fc9('0x24')]);if(_0x58f4ec[_0x1fc9('0x2d')]['metadata'][_0x1fc9('0x30')]){_0x320970[_0x1fc9('0x10')]();}else{_0x320970[_0x1fc9('0x2a')]();}})[_0x1fc9('0x25')](function(_0x16f3a4){logger[_0x1fc9('0x26')](_0x1fc9('0xe'),_0x314e81,JSON[_0x1fc9('0x27')](_0x16f3a4));_0x320970['next']();});})[_0x1fc9('0x25')](function(_0x5a9097){logger['error'](_0x1fc9('0xe'),_0x314e81,_0x5a9097[_0x1fc9('0x31')]);_0x320970[_0x1fc9('0x10')]();});}}catch(_0x38a79e){logger[_0x1fc9('0x26')](_0x1fc9('0xe'),_0x314e81,JSON[_0x1fc9('0x27')](_0x38a79e));_0x320970['stop']();}};}; \ No newline at end of file +var _0x88b0=['UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','Message','create','then','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','dialogflow','result','fulfillment','speech','providerName','providerResponse','next','message','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction'];(function(_0x19362c,_0x4de21e){var _0x11e88e=function(_0x293f55){while(--_0x293f55){_0x19362c['push'](_0x19362c['shift']());}};_0x11e88e(++_0x4de21e);}(_0x88b0,0x1cb));var _0x088b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x88b0[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x088b('0x0'));var moment=require(_0x088b('0x1'));var apiai=require('apiai-promise');var md5=require('md5');var utils=require(_0x088b('0x2'));var logger=require(_0x088b('0x3'))(_0x088b('0x4'));var rpc={'chatMessage':require(_0x088b('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x088b('0x6')),'smsMessage':require(_0x088b('0x7')),'faxMessage':require(_0x088b('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0xfd98a3,_0xa5a81f){return function(_0x18fa42){try{if(!_[_0x088b('0x9')](this[_0x088b('0xa')][_0x088b('0xb')])){logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x088b('0xd'));return _0x18fa42['next']();}var _0x2502df={'ContactId':this['contact']['id'],'sentAt':moment()[_0x088b('0xe')](_0x088b('0xf')),'direction':'out'};if(this['channel']===_0x088b('0x10')||this[_0x088b('0x11')]===_0x088b('0x12')){_0x2502df['phone']=this[_0x088b('0xa')][_0x088b('0x13')];}var _0x1ea6d7=this['channel'];if(_0x1ea6d7===_0x088b('0x14')){_0x2502df[_0x088b('0x15')]=this[_0x088b('0x16')]['id'];}else{_0x2502df[_[_0x088b('0x17')](_0x1ea6d7)+_0x088b('0x18')]=this[_0x088b('0x16')]['id'];}_0x2502df[_[_0x088b('0x17')](_0x1ea6d7)+'InteractionId']=this[_0x088b('0xa')]['id'];if(this[_0x088b('0xa')][_0x088b('0x19')]){var _0xdee68a=_0xa5a81f[0x2];if(!_[_0x088b('0x1a')](_0xdee68a)){_0x2502df[_0x088b('0x1b')]=utils['getMustacheRender'](_0xdee68a,this);return rpc[_0x1ea6d7+_0x088b('0x1c')][_0x088b('0x1d')](_0x2502df)[_0x088b('0x1e')](function(_0x31d121){logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x2502df['body']);})[_0x088b('0x1f')](function(_0x3b3eb6){logger[_0x088b('0x20')](_0x088b('0x21'),_0xfd98a3,JSON[_0x088b('0x22')](_0x3b3eb6));})[_0x088b('0x23')](function(){logger['info'](_0x088b('0x24'),_0xfd98a3);_0x18fa42[_0x088b('0x25')]();});}else{logger[_0x088b('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0xfd98a3);_0x18fa42['stop']();}}else{var _0x464949=this;var _0x1db300=apiai(_0xa5a81f[0x0],{'language':_0xa5a81f[0x1]||'en'});return _0x1db300[_0x088b('0x26')](this['message'][_0x088b('0x1b')],{'sessionId':md5(this[_0x088b('0xa')]['id'])})['then'](function(_0x4b4d3f){_0x464949['body'][_0x088b('0x27')]=_0x4b4d3f;_0x2502df['body']=_0x4b4d3f[_0x088b('0x28')][_0x088b('0x29')][_0x088b('0x2a')];_0x2502df[_0x088b('0x2b')]=_0x088b('0x27');_0x2502df[_0x088b('0x2c')]=JSON['stringify'](_0x4b4d3f);return rpc[_0x1ea6d7+_0x088b('0x1c')][_0x088b('0x1d')](_0x2502df)[_0x088b('0x1e')](function(_0x5f20de){logger[_0x088b('0xc')](_0x088b('0x21'),_0xfd98a3,_0x2502df[_0x088b('0x1b')]);if(_0x4b4d3f[_0x088b('0x28')]['metadata']['endConversation']){_0x18fa42[_0x088b('0x2d')]();}else{_0x18fa42[_0x088b('0x25')]();}})[_0x088b('0x1f')](function(_0x193a00){logger[_0x088b('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,JSON[_0x088b('0x22')](_0x193a00));_0x18fa42[_0x088b('0x2d')]();});})[_0x088b('0x1f')](function(_0x6535be){logger[_0x088b('0x20')]('[%s][DIALOGFLOW]\x20%s',_0xfd98a3,_0x6535be[_0x088b('0x2e')]);_0x18fa42[_0x088b('0x2d')]();});}}catch(_0x213cbe){logger[_0x088b('0x20')](_0x088b('0x21'),_0xfd98a3,JSON[_0x088b('0x22')](_0x213cbe));_0x18fa42[_0x088b('0x25')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index c4c2613..abc465d 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x531c=['whatsapp','phone','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','info','error','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','replace','SessionsClient','message','detectIntent','length','queryResult','diagnosticInfo','fields','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','push','all','next','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','create','then','catch','[%s][DIALOGFLOWV2]\x20%s','stringify','consequence','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms'];(function(_0x50d8d3,_0xfa1ff){var _0x3704e7=function(_0x5803dd){while(--_0x5803dd){_0x50d8d3['push'](_0x50d8d3['shift']());}};_0x3704e7(++_0xfa1ff);}(_0x531c,0x18a));var _0xc531=function(_0x53c37a,_0x5b1dd4){_0x53c37a=_0x53c37a-0x0;var _0x283edf=_0x531c[_0x53c37a];return _0x283edf;};'use strict';var _=require(_0xc531('0x0'));var dialogflow=require(_0xc531('0x1'));var md5=require(_0xc531('0x2'));var moment=require('moment');var Promise=require(_0xc531('0x3'));var logger=require(_0xc531('0x4'))(_0xc531('0x5'));var utils=require(_0xc531('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xc531('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc531('0x8'))};function createMessage(_0xb1303f,_0x4588f2,_0x345c2c,_0x16c418){return new Promise(function(_0x3df428,_0xf53b57){var _0x547cee=_[_0xc531('0x9')](_0x345c2c);_0x547cee[_0xc531('0xa')]=_0x16c418;return rpc[_0x4588f2+'Message'][_0xc531('0xb')](_0x547cee)[_0xc531('0xc')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0xb1303f,_0x547cee[_0xc531('0xa')]);_0x3df428();})[_0xc531('0xd')](function(_0x59c154){logger['error'](_0xc531('0xe'),_0xb1303f,JSON[_0xc531('0xf')](_0x59c154));_0xf53b57(_0x59c154);});});}exports[_0xc531('0x10')]=function(_0x50066a,_0x3e6aeb){return function(_0x29a705){try{if(!_[_0xc531('0x11')](this[_0xc531('0x12')]['UserId'])){logger['info'](_0xc531('0xe'),_0x50066a,_0xc531('0x13'));return _0x29a705['next']();}var _0x5d0220={'ContactId':this[_0xc531('0x14')]['id'],'sentAt':moment()[_0xc531('0x15')](_0xc531('0x16')),'direction':_0xc531('0x17')};if(this[_0xc531('0x18')]===_0xc531('0x19')||this[_0xc531('0x18')]===_0xc531('0x1a')){_0x5d0220[_0xc531('0x1b')]=this[_0xc531('0x12')][_0xc531('0x1b')];}var _0x31e9c4=this[_0xc531('0x18')];if(_0x31e9c4==='chat'){_0x5d0220['ChatWebsiteId']=this[_0xc531('0x1c')]['id'];}else{_0x5d0220[_[_0xc531('0x1d')](_0x31e9c4)+_0xc531('0x1e')]=this[_0xc531('0x1c')]['id'];}_0x5d0220[_[_0xc531('0x1d')](_0x31e9c4)+_0xc531('0x1f')]=this[_0xc531('0x12')]['id'];if(this[_0xc531('0x12')][_0xc531('0x20')]){var _0x2f5285=_0x3e6aeb[0x4];if(!_['isEmpty'](_0x2f5285)){_0x5d0220[_0xc531('0xa')]=utils[_0xc531('0x21')](_0x2f5285,this);return rpc[_0x31e9c4+_0xc531('0x22')][_0xc531('0xb')](_0x5d0220)[_0xc531('0xc')](function(_0x58d71f){logger[_0xc531('0x23')](_0xc531('0xe'),_0x50066a,_0x5d0220[_0xc531('0xa')]);})[_0xc531('0xd')](function(_0x3b4fdc){logger[_0xc531('0x24')](_0xc531('0xe'),_0x50066a,JSON[_0xc531('0xf')](_0x3b4fdc));})[_0xc531('0x25')](function(){logger[_0xc531('0x23')](_0xc531('0x26'),_0x50066a);_0x29a705[_0xc531('0x27')]();});}else{logger[_0xc531('0x23')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x50066a);_0x29a705['stop']();}}else{var _0x3544a6=this;var _0x546475=_0x3e6aeb[0x2][_0xc531('0x28')](/\\n/g,'\x0a');var _0xf4654e={'credentials':{'private_key':_0x546475,'client_email':_0x3e6aeb[0x1]}};var _0x36ef05=new dialogflow[(_0xc531('0x29'))](_0xf4654e);var _0x632448=_0x36ef05['sessionPath'](_0x3e6aeb[0x0],md5(_0x3544a6[_0xc531('0x12')]['id']));var _0x2766b9={'session':_0x632448,'queryInput':{'text':{'text':_0x3544a6[_0xc531('0x2a')][_0xc531('0xa')],'languageCode':_0x3e6aeb[0x3]||'en'}}};return _0x36ef05[_0xc531('0x2b')](_0x2766b9)['then'](function(_0x37851a){if(_0x37851a&&_0x37851a[_0xc531('0x2c')]){_0x3544a6[_0xc531('0xa')]['dialogflowV2']=_0x37851a;var _0x15556c=_0x37851a[0x0];var _0x6e9cfc=_0x15556c[_0xc531('0x2d')][_0xc531('0x2e')]&&_0x15556c[_0xc531('0x2d')]['diagnosticInfo'][_0xc531('0x2f')]?_0x15556c[_0xc531('0x2d')]['diagnosticInfo'][_0xc531('0x2f')]['end_conversation'][_0xc531('0x30')]:![];_0x3544a6[_0xc531('0xa')]['DIALOGFLOWV2_ACTION']=_0x15556c[_0xc531('0x2d')][_0xc531('0x31')];_0x3544a6[_0xc531('0xa')][_0xc531('0x32')]=_0x15556c[_0xc531('0x2d')][_0xc531('0x33')];_0x3544a6[_0xc531('0xa')][_0xc531('0x34')]=_0x15556c[_0xc531('0x2d')][_0xc531('0x2e')]&&_0x15556c['queryResult'][_0xc531('0x2e')]['fields']?_0x15556c[_0xc531('0x2d')][_0xc531('0x2e')]['fields']['end_conversation'][_0xc531('0x30')]:![];_0x3544a6[_0xc531('0xa')][_0xc531('0x35')]=_0x15556c[_0xc531('0x2d')][_0xc531('0x36')][_0xc531('0x37')];_0x3544a6[_0xc531('0xa')][_0xc531('0x38')]=_0x15556c[_0xc531('0x2d')][_0xc531('0x36')][_0xc531('0x39')];_0x3544a6[_0xc531('0xa')][_0xc531('0x3a')]=_0x15556c[_0xc531('0x2d')][_0xc531('0x36')][_0xc531('0x3b')];_0x3544a6['body']['DIALOGFLOWV2_LANGUAGECODE']=_0x15556c[_0xc531('0x2d')][_0xc531('0x3c')];_0x3544a6[_0xc531('0xa')][_0xc531('0x3d')]=_0x15556c[_0xc531('0x2d')][_0xc531('0x3e')];_0x3544a6['body'][_0xc531('0x3f')]=_0x15556c[_0xc531('0x2d')][_0xc531('0x40')];_0x5d0220[_0xc531('0x41')]=_0xc531('0x42');_0x5d0220['providerResponse']=JSON[_0xc531('0xf')](_0x37851a);var _0x2f3707=[];for(var _0x1d5aeb=0x0;_0x1d5aeb<_0x37851a[_0xc531('0x2c')];_0x1d5aeb++){var _0x194701=_0x37851a[_0x1d5aeb];if(_0x194701&&_0x194701[_0xc531('0x2d')]&&_0x194701[_0xc531('0x2d')]['fulfillmentText']){_0x2f3707[_0xc531('0x43')](createMessage(_0x50066a,_0x31e9c4,_0x5d0220,_0x194701['queryResult']['fulfillmentText']));}}return Promise[_0xc531('0x44')](_0x2f3707)[_0xc531('0xc')](function(){if(_0x6e9cfc){_0x29a705[_0xc531('0x45')]();}else{_0x29a705[_0xc531('0x27')]();}})[_0xc531('0xd')](function(_0x732e46){logger[_0xc531('0x24')](_0xc531('0xe'),_0x50066a,JSON[_0xc531('0xf')](_0x732e46));_0x29a705[_0xc531('0x45')]();});}})[_0xc531('0xd')](function(_0x31fa2c){logger[_0xc531('0x24')](_0xc531('0xe'),_0x50066a,_0x31fa2c[_0xc531('0x2a')]);_0x29a705[_0xc531('0x45')]();});}}catch(_0x3e60db){logger['error'](_0xc531('0xe'),_0x50066a,JSON['stringify'](_0x3e60db));_0x29a705[_0xc531('0x27')]();}};}; \ No newline at end of file +var _0x1235=['isEmpty','getMustacheRender','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','fulfillmentText','push','all','next','lodash','moment','bluebird','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','whatsapp','interaction','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId'];(function(_0x1e2e42,_0x386fac){var _0x578407=function(_0x19bbc8){while(--_0x19bbc8){_0x1e2e42['push'](_0x1e2e42['shift']());}};_0x578407(++_0x386fac);}(_0x1235,0x71));var _0x5123=function(_0x1e1aef,_0x16d891){_0x1e1aef=_0x1e1aef-0x0;var _0x5273f8=_0x1235[_0x1e1aef];return _0x5273f8;};'use strict';var _=require(_0x5123('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x5123('0x1'));var Promise=require(_0x5123('0x2'));var logger=require(_0x5123('0x3'))('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x5123('0x4')),'smsMessage':require(_0x5123('0x5')),'faxMessage':require(_0x5123('0x6')),'whatsappMessage':require(_0x5123('0x7'))};function createMessage(_0x148684,_0x161c2a,_0x5de3f4,_0x20bd4b){return new Promise(function(_0xc8034c,_0x2968e7){var _0x2ccffd=_[_0x5123('0x8')](_0x5de3f4);_0x2ccffd[_0x5123('0x9')]=_0x20bd4b;return rpc[_0x161c2a+_0x5123('0xa')]['create'](_0x2ccffd)[_0x5123('0xb')](function(){logger['info'](_0x5123('0xc'),_0x148684,_0x2ccffd['body']);_0xc8034c();})[_0x5123('0xd')](function(_0x2fea9a){logger[_0x5123('0xe')](_0x5123('0xc'),_0x148684,JSON[_0x5123('0xf')](_0x2fea9a));_0x2968e7(_0x2fea9a);});});}exports[_0x5123('0x10')]=function(_0x582e98,_0x241043){return function(_0x276f0c){try{if(!_[_0x5123('0x11')](this['interaction'][_0x5123('0x12')])){logger[_0x5123('0x13')](_0x5123('0xc'),_0x582e98,_0x5123('0x14'));return _0x276f0c['next']();}var _0x367b5f={'ContactId':this[_0x5123('0x15')]['id'],'sentAt':moment()[_0x5123('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x5123('0x17')};if(this[_0x5123('0x18')]==='sms'||this[_0x5123('0x18')]===_0x5123('0x19')){_0x367b5f['phone']=this[_0x5123('0x1a')][_0x5123('0x1b')];}var _0x520feb=this[_0x5123('0x18')];if(_0x520feb===_0x5123('0x1c')){_0x367b5f[_0x5123('0x1d')]=this[_0x5123('0x1e')]['id'];}else{_0x367b5f[_['upperFirst'](_0x520feb)+'AccountId']=this[_0x5123('0x1e')]['id'];}_0x367b5f[_[_0x5123('0x1f')](_0x520feb)+_0x5123('0x20')]=this['interaction']['id'];if(this[_0x5123('0x1a')]['created']){var _0x41a844=_0x241043[0x4];if(!_[_0x5123('0x21')](_0x41a844)){_0x367b5f['body']=utils[_0x5123('0x22')](_0x41a844,this);return rpc[_0x520feb+'Message'][_0x5123('0x23')](_0x367b5f)[_0x5123('0xb')](function(_0x3e2cc2){logger[_0x5123('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x582e98,_0x367b5f[_0x5123('0x9')]);})[_0x5123('0xd')](function(_0x20608c){logger[_0x5123('0xe')](_0x5123('0xc'),_0x582e98,JSON['stringify'](_0x20608c));})[_0x5123('0x24')](function(){logger[_0x5123('0x13')](_0x5123('0x25'),_0x582e98);_0x276f0c[_0x5123('0x26')]();});}else{logger['info'](_0x5123('0x27'),_0x582e98);_0x276f0c[_0x5123('0x26')]();}}else{var _0x1e766e=this;var _0x38d73b=_0x241043[0x2][_0x5123('0x28')](/\\n/g,'\x0a');var _0x2be8e5={'credentials':{'private_key':_0x38d73b,'client_email':_0x241043[0x1]}};var _0xb82530=new dialogflow[(_0x5123('0x29'))](_0x2be8e5);var _0x2c34c3=_0xb82530[_0x5123('0x2a')](_0x241043[0x0],md5(_0x1e766e['interaction']['id']));var _0x4726c6={'session':_0x2c34c3,'queryInput':{'text':{'text':_0x1e766e[_0x5123('0x2b')][_0x5123('0x9')],'languageCode':_0x241043[0x3]||'en'}}};return _0xb82530[_0x5123('0x2c')](_0x4726c6)['then'](function(_0xe7d709){if(_0xe7d709&&_0xe7d709['length']){_0x1e766e[_0x5123('0x9')][_0x5123('0x2d')]=_0xe7d709;var _0x2ebfe2=_0xe7d709[0x0];var _0x2ce994=_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x2f')]&&_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x2f')][_0x5123('0x30')]?_0x2ebfe2[_0x5123('0x2e')]['diagnosticInfo'][_0x5123('0x30')][_0x5123('0x31')][_0x5123('0x32')]:![];_0x1e766e[_0x5123('0x9')][_0x5123('0x33')]=_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x34')];_0x1e766e['body'][_0x5123('0x35')]=_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x36')];_0x1e766e['body'][_0x5123('0x37')]=_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x2f')]&&_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x2f')][_0x5123('0x30')]?_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x2f')][_0x5123('0x30')][_0x5123('0x31')][_0x5123('0x32')]:![];_0x1e766e[_0x5123('0x9')][_0x5123('0x38')]=_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x39')][_0x5123('0x3a')];_0x1e766e[_0x5123('0x9')][_0x5123('0x3b')]=_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x39')][_0x5123('0x3c')];_0x1e766e['body'][_0x5123('0x3d')]=_0x2ebfe2['queryResult'][_0x5123('0x39')][_0x5123('0x3e')];_0x1e766e[_0x5123('0x9')][_0x5123('0x3f')]=_0x2ebfe2[_0x5123('0x2e')][_0x5123('0x40')];_0x1e766e['body'][_0x5123('0x41')]=_0x2ebfe2['queryResult'][_0x5123('0x42')];_0x1e766e[_0x5123('0x9')][_0x5123('0x43')]=_0x2ebfe2[_0x5123('0x2e')]['intentDetectionConfidence'];_0x367b5f[_0x5123('0x44')]=_0x5123('0x2d');_0x367b5f['providerResponse']=JSON[_0x5123('0xf')](_0xe7d709);var _0x574c33=[];for(var _0x22479d=0x0;_0x22479d<_0xe7d709['length'];_0x22479d++){var _0xb151ad=_0xe7d709[_0x22479d];if(_0xb151ad&&_0xb151ad['queryResult']&&_0xb151ad[_0x5123('0x2e')][_0x5123('0x45')]){_0x574c33[_0x5123('0x46')](createMessage(_0x582e98,_0x520feb,_0x367b5f,_0xb151ad['queryResult'][_0x5123('0x45')]));}}return Promise[_0x5123('0x47')](_0x574c33)[_0x5123('0xb')](function(){if(_0x2ce994){_0x276f0c['next']();}else{_0x276f0c[_0x5123('0x26')]();}})[_0x5123('0xd')](function(_0xf36d8d){logger[_0x5123('0xe')](_0x5123('0xc'),_0x582e98,JSON[_0x5123('0xf')](_0xf36d8d));_0x276f0c['next']();});}})[_0x5123('0xd')](function(_0x1df29b){logger[_0x5123('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x582e98,_0x1df29b[_0x5123('0x2b')]);_0x276f0c[_0x5123('0x48')]();});}}catch(_0x15225e){logger[_0x5123('0xe')](_0x5123('0xc'),_0x582e98,JSON[_0x5123('0xf')](_0x15225e));_0x276f0c[_0x5123('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 52e6ed5..ae02291 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe4e4=['priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','validate','error','[%s][GOTOIF]\x20%s','message','join','stop','condition','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','lodash','html-to-text','./utils','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe4e4,0xaf));var _0x4e4e=function(_0x16cc33,_0x184fd8){_0x16cc33=_0x16cc33-0x0;var _0x398abc=_0xe4e4[_0x16cc33];return _0x398abc;};'use strict';var schema=require('validate');var _=require(_0x4e4e('0x0'));var htmlToText=require(_0x4e4e('0x1'));var utils=require(_0x4e4e('0x2'));var logger=require(_0x4e4e('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x4e4e('0x4')},'priorityTrue':{'type':_0x4e4e('0x5'),'message':_0x4e4e('0x6')},'priorityFalse':{'type':'number','message':_0x4e4e('0x7')}});exports[_0x4e4e('0x8')]=function(_0x40ba7d,_0x4e4a79){return function(_0x3d72ec){try{var _0x50dd2b={'condition':htmlToText[_0x4e4e('0x9')](utils[_0x4e4e('0xa')](_0x4e4a79[0x0],this),{'wordwrap':![]})[_0x4e4e('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4e4a79[0x1],'priorityFalse':_0x4e4a79[0x2]};var _0xb362e4=gotoif[_0x4e4e('0xc')](_0x50dd2b,{'typecast':!![]});if(_0xb362e4['length']){logger[_0x4e4e('0xd')](_0x4e4e('0xe'),_0x40ba7d,_['map'](_0xb362e4,_0x4e4e('0xf'))[_0x4e4e('0x10')](',\x20'));_0x3d72ec[_0x4e4e('0x11')]();}else{try{var _0x52dbbe=eval('('+_0x50dd2b[_0x4e4e('0x12')]+')');var _0x1f400f=_0x52dbbe?_0x50dd2b['priorityTrue']:_0x50dd2b['priorityFalse'];logger['info'](_0x4e4e('0x13'),_0x40ba7d,_0x50dd2b[_0x4e4e('0x12')],_0x52dbbe,_0x1f400f||_0x4e4e('0x14'));if(_0x1f400f){var _0x1aef0f=_['findIndex'](_0x3d72ec[_0x4e4e('0x15')](),{'p':_0x1f400f});if(_0x1aef0f>=0x0){logger[_0x4e4e('0x16')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x40ba7d,_0x1f400f||'next',_0x1aef0f);_0x3d72ec['next'](_0x1aef0f);}else{logger['info'](_0x4e4e('0x17'),_0x40ba7d,_0x1f400f||'next');_0x3d72ec[_0x4e4e('0x11')]();}}else{_0x3d72ec['next']();}}catch(_0x288aa9){logger['error'](_0x4e4e('0x18'),_0x40ba7d,_0x288aa9['message']);_0x3d72ec[_0x4e4e('0x11')]();}}}catch(_0x507137){logger[_0x4e4e('0xd')](_0x4e4e('0xe'),_0x40ba7d,JSON[_0x4e4e('0x19')](_0x507137));_0x3d72ec[_0x4e4e('0x11')]();}};}; \ No newline at end of file +var _0xecb7=['../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text'];(function(_0x12ab97,_0x43a673){var _0x338e43=function(_0x57e69c){while(--_0x57e69c){_0x12ab97['push'](_0x12ab97['shift']());}};_0x338e43(++_0x43a673);}(_0xecb7,0x8e));var _0x7ecb=function(_0x132565,_0x22f59d){_0x132565=_0x132565-0x0;var _0x52fa38=_0xecb7[_0x132565];return _0x52fa38;};'use strict';var schema=require(_0x7ecb('0x0'));var _=require(_0x7ecb('0x1'));var htmlToText=require(_0x7ecb('0x2'));var utils=require('./utils');var logger=require(_0x7ecb('0x3'))(_0x7ecb('0x4'));var gotoif=schema({'condition':{'type':_0x7ecb('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x7ecb('0x6'),'message':_0x7ecb('0x7')},'priorityFalse':{'type':'number','message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x7ecb('0x8')]=function(_0x3a9278,_0x44739b){return function(_0x33c702){try{var _0x5b9325={'condition':htmlToText[_0x7ecb('0x9')](utils[_0x7ecb('0xa')](_0x44739b[0x0],this),{'wordwrap':![]})[_0x7ecb('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x44739b[0x1],'priorityFalse':_0x44739b[0x2]};var _0x592233=gotoif['validate'](_0x5b9325,{'typecast':!![]});if(_0x592233[_0x7ecb('0xc')]){logger[_0x7ecb('0xd')](_0x7ecb('0xe'),_0x3a9278,_[_0x7ecb('0xf')](_0x592233,_0x7ecb('0x10'))[_0x7ecb('0x11')](',\x20'));_0x33c702['stop']();}else{try{var _0x569382=eval('('+_0x5b9325['condition']+')');var _0x4d8097=_0x569382?_0x5b9325[_0x7ecb('0x12')]:_0x5b9325[_0x7ecb('0x13')];logger[_0x7ecb('0x14')](_0x7ecb('0x15'),_0x3a9278,_0x5b9325['condition'],_0x569382,_0x4d8097||_0x7ecb('0x16'));if(_0x4d8097){var _0x383270=_[_0x7ecb('0x17')](_0x33c702[_0x7ecb('0x18')](),{'p':_0x4d8097});if(_0x383270>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3a9278,_0x4d8097||_0x7ecb('0x16'),_0x383270);_0x33c702[_0x7ecb('0x16')](_0x383270);}else{logger[_0x7ecb('0x14')](_0x7ecb('0x19'),_0x3a9278,_0x4d8097||'next');_0x33c702[_0x7ecb('0x1a')]();}}else{_0x33c702[_0x7ecb('0x16')]();}}catch(_0x1d059d){logger[_0x7ecb('0xd')](_0x7ecb('0x1b'),_0x3a9278,_0x1d059d[_0x7ecb('0x10')]);_0x33c702[_0x7ecb('0x1a')]();}}}catch(_0x2f0664){logger[_0x7ecb('0xd')]('[%s][GOTOIF]\x20%s',_0x3a9278,JSON[_0x7ecb('0x1c')](_0x2f0664));_0x33c702[_0x7ecb('0x1a')]();}};}; \ 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 2e1a8f7..9461296 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 _0xf614=['map','message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s'];(function(_0xd064f8,_0x35a931){var _0xb24d49=function(_0x232772){while(--_0x232772){_0xd064f8['push'](_0xd064f8['shift']());}};_0xb24d49(++_0x35a931);}(_0xf614,0xb3));var _0x4f61=function(_0x516927,_0xb4aad0){_0x516927=_0x516927-0x0;var _0x30749b=_0xf614[_0x516927];return _0x30749b;};'use strict';var schema=require(_0x4f61('0x0'));var _=require(_0x4f61('0x1'));var logger=require(_0x4f61('0x2'))(_0x4f61('0x3'));var gotop=schema({'priority':{'type':_0x4f61('0x4'),'required':!![],'message':_0x4f61('0x5')}});exports[_0x4f61('0x6')]=function(_0x4c072d,_0x53db57){return function(_0x147d38){try{var _0x533d7f={'priority':_0x53db57[0x0]};var _0x5ea95b=gotop[_0x4f61('0x0')](_0x533d7f,{'typecast':!![]});if(_0x5ea95b[_0x4f61('0x7')]){logger[_0x4f61('0x8')](_0x4f61('0x9'),_0x4c072d,_[_0x4f61('0xa')](_0x5ea95b,_0x4f61('0xb'))[_0x4f61('0xc')](',\x20'));_0x147d38[_0x4f61('0xd')]();}else{logger[_0x4f61('0xe')]('[%s][GOTOP]\x20priority\x20%s',_0x4c072d,_0x533d7f[_0x4f61('0xf')]);if(_0x533d7f[_0x4f61('0xf')]){var _0x4a82b9=_[_0x4f61('0x10')](_0x147d38[_0x4f61('0x11')](),{'p':_0x533d7f[_0x4f61('0xf')]});if(_0x4a82b9>=0x0){logger[_0x4f61('0xe')](_0x4f61('0x12'),_0x4c072d,_0x533d7f[_0x4f61('0xf')]||'next',_0x4a82b9);_0x147d38[_0x4f61('0x13')](_0x4a82b9);}else{logger[_0x4f61('0xe')](_0x4f61('0x14'),_0x4c072d,_0x533d7f['priority']||_0x4f61('0x13'));_0x147d38['stop']();}}else{_0x147d38['next']();}}}catch(_0x421bf0){logger[_0x4f61('0x8')](_0x4f61('0x9'),_0x4c072d,JSON['stringify'](_0x421bf0));_0x147d38['stop']();}};}; \ No newline at end of file +var _0x93a4=['length','error','map','message','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20%s','stringify','stop','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate'];(function(_0x3180fd,_0x85b238){var _0x1fe719=function(_0x505be7){while(--_0x505be7){_0x3180fd['push'](_0x3180fd['shift']());}};_0x1fe719(++_0x85b238);}(_0x93a4,0xb8));var _0x493a=function(_0x5ac116,_0x20cc5f){_0x5ac116=_0x5ac116-0x0;var _0x3871a6=_0x93a4[_0x5ac116];return _0x3871a6;};'use strict';var schema=require('validate');var _=require(_0x493a('0x0'));var logger=require(_0x493a('0x1'))(_0x493a('0x2'));var gotop=schema({'priority':{'type':_0x493a('0x3'),'required':!![],'message':_0x493a('0x4')}});exports['consequence']=function(_0x40c970,_0xc97b01){return function(_0x149e4e){try{var _0x481182={'priority':_0xc97b01[0x0]};var _0x448283=gotop[_0x493a('0x5')](_0x481182,{'typecast':!![]});if(_0x448283[_0x493a('0x6')]){logger[_0x493a('0x7')]('[%s][GOTOP]\x20%s',_0x40c970,_[_0x493a('0x8')](_0x448283,_0x493a('0x9'))['join'](',\x20'));_0x149e4e['stop']();}else{logger[_0x493a('0xa')](_0x493a('0xb'),_0x40c970,_0x481182[_0x493a('0xc')]);if(_0x481182[_0x493a('0xc')]){var _0x1d9ae8=_['findIndex'](_0x149e4e[_0x493a('0xd')](),{'p':_0x481182[_0x493a('0xc')]});if(_0x1d9ae8>=0x0){logger['info'](_0x493a('0xe'),_0x40c970,_0x481182[_0x493a('0xc')]||'next',_0x1d9ae8);_0x149e4e[_0x493a('0xf')](_0x1d9ae8);}else{logger[_0x493a('0xa')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x40c970,_0x481182[_0x493a('0xc')]||'next');_0x149e4e['stop']();}}else{_0x149e4e[_0x493a('0xf')]();}}}catch(_0x4af81d){logger[_0x493a('0x7')](_0x493a('0x10'),_0x40c970,JSON[_0x493a('0x11')](_0x4af81d));_0x149e4e[_0x493a('0x12')]();}};}; \ 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 081981d..3897502 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 _0x8081=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','Message','create','info','body','next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x8081,0xbc));var _0x1808=function(_0x587623,_0x5d207a){_0x587623=_0x587623-0x0;var _0xaa9cd4=_0x8081[_0x587623];return _0xaa9cd4;};'use strict';var _=require(_0x1808('0x0'));var utils=require('./utils');var logger=require(_0x1808('0x1'))(_0x1808('0x2'));var rpc={'chatMessage':require(_0x1808('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1808('0x4')),'smsMessage':require(_0x1808('0x5')),'faxMessage':require(_0x1808('0x6')),'whatsappMessage':require(_0x1808('0x7'))};exports[_0x1808('0x8')]=function(_0x1bb0d3,_0x1475f0){return function(_0x47dd89){try{var _0x36b71b={'body':utils[_0x1808('0x9')](_0x1475f0[0x0],this),'ContactId':this[_0x1808('0xa')]['id']};if(this[_0x1808('0xb')]===_0x1808('0xc')){_0x36b71b['ChatWebsiteId']=this[_0x1808('0xd')]['id'];}else{_0x36b71b[_[_0x1808('0xe')](this[_0x1808('0xb')])+_0x1808('0xf')]=this['account']['id'];}_0x36b71b[_[_0x1808('0xe')](this[_0x1808('0xb')])+_0x1808('0x10')]=this['interaction']['id'];if(rpc[this[_0x1808('0xb')]+_0x1808('0x11')]){return rpc[this['channel']+_0x1808('0x11')][_0x1808('0x12')](_0x36b71b)['then'](function(_0x317195){logger[_0x1808('0x13')]('[%s][MESSAGE]\x20%s',_0x1bb0d3,_0x36b71b[_0x1808('0x14')]);_0x47dd89[_0x1808('0x15')]();})[_0x1808('0x16')](function(_0x2d88a9){logger[_0x1808('0x17')](_0x1808('0x18'),_0x1bb0d3,JSON[_0x1808('0x19')](_0x2d88a9));_0x47dd89[_0x1808('0x1a')]();});}}catch(_0x1adc68){logger[_0x1808('0x17')]('[%s][MESSAGE]\x20%s',_0x1bb0d3,JSON[_0x1808('0x19')](_0x1adc68));_0x47dd89[_0x1808('0x1a')]();}};}; \ No newline at end of file +var _0xaf60=['../../../../config/logger','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','ChatWebsiteId','account','upperFirst','InteractionId','Message','then','info','body','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils'];(function(_0x2ec42d,_0x10a3c8){var _0x34e2ae=function(_0x197334){while(--_0x197334){_0x2ec42d['push'](_0x2ec42d['shift']());}};_0x34e2ae(++_0x10a3c8);}(_0xaf60,0x82));var _0x0af6=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xaf60[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x0af6('0x0'));var utils=require(_0x0af6('0x1'));var logger=require(_0x0af6('0x2'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0af6('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0af6('0x4')),'whatsappMessage':require(_0x0af6('0x5'))};exports[_0x0af6('0x6')]=function(_0x2fe667,_0x463023){return function(_0x333ce1){try{var _0x2eb218={'body':utils['getMustacheRender'](_0x463023[0x0],this),'ContactId':this[_0x0af6('0x7')]['id']};if(this[_0x0af6('0x8')]==='chat'){_0x2eb218[_0x0af6('0x9')]=this[_0x0af6('0xa')]['id'];}else{_0x2eb218[_[_0x0af6('0xb')](this['channel'])+'AccountId']=this['account']['id'];}_0x2eb218[_[_0x0af6('0xb')](this['channel'])+_0x0af6('0xc')]=this['interaction']['id'];if(rpc[this['channel']+_0x0af6('0xd')]){return rpc[this[_0x0af6('0x8')]+_0x0af6('0xd')]['create'](_0x2eb218)[_0x0af6('0xe')](function(_0x30a734){logger[_0x0af6('0xf')]('[%s][MESSAGE]\x20%s',_0x2fe667,_0x2eb218[_0x0af6('0x10')]);_0x333ce1['next']();})[_0x0af6('0x11')](function(_0x4ed1aa){logger[_0x0af6('0x12')](_0x0af6('0x13'),_0x2fe667,JSON[_0x0af6('0x14')](_0x4ed1aa));_0x333ce1[_0x0af6('0x15')]();});}}catch(_0x53fb83){logger['error']('[%s][MESSAGE]\x20%s',_0x2fe667,JSON['stringify'](_0x53fb83));_0x333ce1['stop']();}};}; \ 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 d042100..12e26e7 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 _0xc274=['next','error','stringify','stop','../../../../config/logger','consequence','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0xa532e2,_0x5f2835){var _0x1a23ca=function(_0x192065){while(--_0x192065){_0xa532e2['push'](_0xa532e2['shift']());}};_0x1a23ca(++_0x5f2835);}(_0xc274,0x144));var _0x4c27=function(_0x36a05d,_0xabe768){_0x36a05d=_0x36a05d-0x0;var _0x7b9dcf=_0xc274[_0x36a05d];return _0x7b9dcf;};'use strict';var utils=require('./utils');var logger=require(_0x4c27('0x0'))('routing');exports[_0x4c27('0x1')]=function(_0x9e1ad3,_0x30174d){return function(_0x4773c4){try{logger['info'](_0x4c27('0x2'),_0x9e1ad3,utils[_0x4c27('0x3')](_0x30174d[0x0],this));_0x4773c4[_0x4c27('0x4')]();}catch(_0x1b01d1){logger[_0x4c27('0x5')]('[%s][NOOP]\x20%s',_0x9e1ad3,JSON[_0x4c27('0x6')](_0x1b01d1));_0x4773c4[_0x4c27('0x7')]();}};}; \ No newline at end of file +var _0x9acd=['getMustacheRender','next','stop','./utils','routing','info','[%s][NOOP]\x20%s'];(function(_0x1bad62,_0x9fea54){var _0x4520a5=function(_0x27c7f8){while(--_0x27c7f8){_0x1bad62['push'](_0x1bad62['shift']());}};_0x4520a5(++_0x9fea54);}(_0x9acd,0x18b));var _0xd9ac=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9acd[_0x273c39];return _0x46d6b5;};'use strict';var utils=require(_0xd9ac('0x0'));var logger=require('../../../../config/logger')(_0xd9ac('0x1'));exports['consequence']=function(_0x13a206,_0x39b044){return function(_0x5068be){try{logger[_0xd9ac('0x2')](_0xd9ac('0x3'),_0x13a206,utils[_0xd9ac('0x4')](_0x39b044[0x0],this));_0x5068be[_0xd9ac('0x5')]();}catch(_0x33fba8){logger['error'](_0xd9ac('0x3'),_0x13a206,JSON['stringify'](_0x33fba8));_0x5068be[_0xd9ac('0x6')]();}};}; \ 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 eb37b2a..8670321 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 _0x9c83=['stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','emit','clone','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','accepted','info','[%s][STOP:QUEUE][NAME:%s]','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','Queues','createQueue','rules','end','close','stop','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log'];(function(_0x3db169,_0x3d7e63){var _0x5c3d1a=function(_0x454fb9){while(--_0x454fb9){_0x3db169['push'](_0x3db169['shift']());}};_0x5c3d1a(++_0x3d7e63);}(_0x9c83,0xa5));var _0x39c8=function(_0x50766d,_0x3ba128){_0x50766d=_0x50766d-0x0;var _0x3972ef=_0x9c83[_0x50766d];return _0x3972ef;};'use strict';var schema=require(_0x39c8('0x0'));var _=require(_0x39c8('0x1'));var util=require(_0x39c8('0x2'));var seqqueue=require(_0x39c8('0x3'));var moment=require(_0x39c8('0x4'));var Redis=require(_0x39c8('0x5'));var config=require(_0x39c8('0x6'));var logger=require(_0x39c8('0x7'))(_0x39c8('0x8'));var strategy=require(_0x39c8('0x9'));config[_0x39c8('0xa')]=_[_0x39c8('0xb')](config['redis'],{'host':_0x39c8('0xc'),'port':0x18eb});var io=require(_0x39c8('0xd'))(new Redis(config[_0x39c8('0xa')]));var attributes=['id',_0x39c8('0xe'),_0x39c8('0xf'),_0x39c8('0x10'),_0x39c8('0x11'),'joinAt'];function emit(_0xdd8e45,_0x217a1a,_0x43128b){io['to'](_0xdd8e45)[_0x39c8('0x12')](_0x217a1a,_0x43128b);}function emitChannelQueueInteraction(_0x511912,_0x296568,_0x21d15d,_0x303324,_0x634130,_0x5e89bd,_0x2359f3,_0x9cc23){var _0x593cb1=_[_0x39c8('0x13')](_0x21d15d);_0x593cb1['queue_id']=_0x9cc23;_0x593cb1[_0x39c8('0x10')]=_0x296568;_0x593cb1[_0x39c8('0xf')]=_0x303324;_0x593cb1['id']=_0x634130;if(_0x5e89bd){_0x2359f3[util['format'](_0x39c8('0x14'),_0x511912)][_0x634130]=_[_0x39c8('0x15')](_0x593cb1,attributes);}else{delete _0x2359f3[util[_0x39c8('0x16')](_0x39c8('0x14'),_0x511912)][_0x634130];}emit(util[_0x39c8('0x16')](_0x39c8('0x17'),_0x511912,_0x296568),util['format'](_0x39c8('0x18'),_0x511912,_0x5e89bd?'save':_0x39c8('0x19')),_[_0x39c8('0x15')](_0x593cb1,attributes));}var rpc={'openchannelQueueReport':require(_0x39c8('0x1a')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x39c8('0x1b')),'faxQueueReport':require(_0x39c8('0x1c')),'whatsappQueueReport':require(_0x39c8('0x1d'))};var queue=schema({'name':{'type':_0x39c8('0x1e'),'required':!![],'message':_0x39c8('0x1f')},'timeout':{'type':_0x39c8('0x20'),'message':_0x39c8('0x21')}});function startRouting(_0x51f8e9,_0x5967a6,_0x137643,_0x191137){if(_0x51f8e9&&_0x5967a6&&_0x137643){_0x5967a6[_0x39c8('0x22')]+=0x1;var _0x4dce8a={'uniqueid':_0x51f8e9,'from':_0x137643[_0x39c8('0x23')]?_0x137643[_0x39c8('0x23')][_0x39c8('0x11')]:'','joinAt':moment()[_0x39c8('0x16')](_0x39c8('0x24')),'ContactId':_0x137643['contact']?_0x137643[_0x39c8('0x25')]['id']:null,'ListId':_0x137643[_0x39c8('0x26')]?_0x137643[_0x39c8('0x26')]['id']:null};_0x4dce8a[_[_0x39c8('0x27')](_0x137643[_0x39c8('0x28')])+_0x39c8('0x29')]=_0x5967a6['id']||null;_0x4dce8a[_[_0x39c8('0x27')](_0x137643['channel'])+'InteractionId']=_0x137643['interaction']?_0x137643[_0x39c8('0x2a')]['id']:null;_0x4dce8a[_[_0x39c8('0x27')](_0x137643[_0x39c8('0x28')])+_0x39c8('0x2b')]=_0x137643[_0x39c8('0x2c')]?_0x137643['message']['id']:null;_0x4dce8a[_['upperFirst'](_0x137643['channel'])+(_0x137643[_0x39c8('0x28')]!==_0x39c8('0x2d')?_0x39c8('0x2e'):_0x39c8('0x2f'))]=_0x137643['account']?_0x137643['account']['id']:null;logger['info'](util['format'](_0x39c8('0x30'),_0x51f8e9,_0x5967a6['name']));emitChannelQueueInteraction(_0x137643['channel'],_0x5967a6[_0x39c8('0x31')],_0x4dce8a,_0x137643[_0x39c8('0xf')][_0x39c8('0x31')],_0x137643[_0x39c8('0x2c')]['id'],!![],_0x191137,_0x5967a6['id']);if(rpc[_0x137643[_0x39c8('0x28')]+_0x39c8('0x32')]){return rpc[_0x137643[_0x39c8('0x28')]+'QueueReport'][_0x39c8('0x33')](_0x4dce8a)[_0x39c8('0x34')](function(_0x369efc){logger[_0x39c8('0x35')](_0x39c8('0x36'));});}}}function stopRouting(_0x50babd,_0x247f54,_0x5a89eb,_0x41c66f){if(_0x50babd&&_0x247f54){_0x247f54[_0x39c8('0x22')]-=0x1;var _0x178a1b={'leaveAt':moment()[_0x39c8('0x16')](_0x39c8('0x24')),'acceptAt':moment()[_0x39c8('0x16')](_0x39c8('0x24')),'reason':_0x39c8('0x37')};logger[_0x39c8('0x38')](util[_0x39c8('0x16')](_0x39c8('0x39'),_0x50babd,_0x247f54[_0x39c8('0x31')]));emitChannelQueueInteraction(_0x5a89eb[_0x39c8('0x28')],_0x247f54[_0x39c8('0x31')],_0x5a89eb[_0x39c8('0x23')],_0x5a89eb[_0x39c8('0xf')]['name'],_0x5a89eb[_0x39c8('0x2c')]['id'],![],_0x41c66f,_0x247f54['id']);if(rpc[_0x5a89eb[_0x39c8('0x28')]+_0x39c8('0x32')]){return rpc[_0x5a89eb[_0x39c8('0x28')]+_0x39c8('0x32')][_0x39c8('0x3a')](_0x50babd,_0x178a1b)[_0x39c8('0x34')](function(_0x2f52b8){logger[_0x39c8('0x35')]('update\x20queue\x20report');});}}}function endRouting(_0x14c655,_0x41febe,_0x4ffc43,_0x2a6daf){if(_0x14c655&&_0x41febe){_0x41febe[_0x39c8('0x22')]-=0x1;var _0x12d11f={'leaveAt':moment()['format'](_0x39c8('0x24')),'exitAt':moment()[_0x39c8('0x16')](_0x39c8('0x24')),'reason':_0x39c8('0x3b')};logger[_0x39c8('0x38')](util['format'](_0x39c8('0x3c'),_0x14c655,_0x41febe[_0x39c8('0x31')]));emitChannelQueueInteraction(_0x4ffc43[_0x39c8('0x28')],_0x41febe[_0x39c8('0x31')],_0x4ffc43[_0x39c8('0x23')],_0x4ffc43[_0x39c8('0xf')][_0x39c8('0x31')],_0x4ffc43['message']['id'],![],_0x2a6daf);if(rpc[_0x4ffc43[_0x39c8('0x28')]+'QueueReport']){return rpc[_0x4ffc43['channel']+_0x39c8('0x32')][_0x39c8('0x3a')](_0x14c655,_0x12d11f)[_0x39c8('0x34')](function(_0x1e4765){logger[_0x39c8('0x35')](_0x39c8('0x3d'));});}}}function handleFindQueue(_0x18b012){return function(_0x421e1b){return _0x421e1b[_0x39c8('0x31')]['toLowerCase']()===_0x18b012[_0x39c8('0x3e')]();};}exports[_0x39c8('0x3f')]=function(_0x74f520,_0x137d1f,_0x428c13,_0x24e9f2){return function(_0x3d0b7a){try{var _0xcee1b0={'name':_0x137d1f[0x0],'timeout':_0x137d1f[0x1]};var _0x326ad6=queue['validate'](_0xcee1b0,{'typecast':!![]});if(_0x326ad6[_0x39c8('0x40')]){logger[_0x39c8('0x35')](_0x39c8('0x41'),_0x74f520,_[_0x39c8('0x42')](_0x326ad6,_0x39c8('0x2c'))[_0x39c8('0x43')](',\x20'));_0x3d0b7a['stop']();}else{var _0x224fce=_['find'](_0x428c13[_0x24e9f2[_0x39c8('0x28')]+_0x39c8('0x44')],handleFindQueue(_0xcee1b0['name']));if(_0x224fce){startRouting(_0x74f520,_0x224fce,_0x24e9f2,_0x428c13);var _0x36b4e2=(_0x224fce[_0x39c8('0x3b')]||0xa)*0x3e8;var _0x3f4ddc=(_0xcee1b0[_0x39c8('0x3b')]||0x14)*0x3e8;var _0x39238b,_0x31cae3;if(_0x36b4e2>_0x3f4ddc){_0x3f4ddc=_0x36b4e2;}var _0x2e6452=seqqueue[_0x39c8('0x45')](_0x36b4e2);_0x2e6452['id']=_0x74f520;_0x2e6452['atimeout']=_0x36b4e2;_0x2e6452['qtimeout']=_0x3f4ddc;_0x2e6452[_0x39c8('0x28')]=_0x24e9f2['channel'];_0x428c13[_0x39c8('0x46')][_0x74f520]['on'](_0x39c8('0x47'),function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x74f520);stopRouting(_0x74f520,_0x224fce,_0x24e9f2,_0x428c13);clearTimeout(_0x39238b);_0x39238b=undefined;_0x2e6452[_0x39c8('0x48')](!![]);if(_0x428c13[_0x39c8('0x46')][_0x74f520]){delete _0x428c13[_0x39c8('0x46')][_0x74f520];}_0x3d0b7a[_0x39c8('0x49')]();});_0x428c13[_0x39c8('0x46')][_0x74f520]['on'](_0x39c8('0x4a'),function(){if(_0x428c13[_0x39c8('0x46')][_0x74f520]){delete _0x428c13[_0x39c8('0x46')][_0x74f520];}});_0x39238b=setTimeout(function(){logger[_0x39c8('0x38')](_0x39c8('0x4b'),_0x74f520);endRouting(_0x74f520,_0x224fce,_0x24e9f2,_0x428c13);clearTimeout(_0x39238b);_0x2e6452['close'](!![]);_0x3d0b7a[_0x39c8('0x4c')]();},_0x3f4ddc);switch(_0x224fce['strategy']){case _0x39c8('0x4d'):strategy['rrmemory'](_0x2e6452,_0x224fce,_0x428c13,_0x24e9f2);break;default:strategy[_0x39c8('0x4e')](_0x2e6452,_0x224fce,_0x428c13,_0x24e9f2);}}else{logger[_0x39c8('0x35')](_0x39c8('0x4f'),_0x74f520,_0xcee1b0[_0x39c8('0x31')]);_0x3d0b7a[_0x39c8('0x49')]();}}}catch(_0x30d7fd){console[_0x39c8('0x50')](_0x30d7fd);logger[_0x39c8('0x35')]('[%s][QUEUE]\x20%s',_0x74f520,_0x30d7fd[_0x39c8('0x51')]);_0x3d0b7a[_0x39c8('0x49')]();}};}; \ No newline at end of file +var _0xd8d7=['defaults','redis','localhost','socket.io-emitter','queue_id','account','from','joinAt','emit','clone','queue','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','channel','QueueId','upperFirst','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','accepted','info','update','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','validate','lodash','util','seq-queue','moment','./strategy'];(function(_0x3eba86,_0x41c765){var _0x3ac371=function(_0x2ce37a){while(--_0x2ce37a){_0x3eba86['push'](_0x3eba86['shift']());}};_0x3ac371(++_0x41c765);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x1526e1,_0x5ed5a5){_0x1526e1=_0x1526e1-0x0;var _0x249a1e=_0xd8d7[_0x1526e1];return _0x249a1e;};'use strict';var schema=require(_0x7d8d('0x0'));var _=require(_0x7d8d('0x1'));var util=require(_0x7d8d('0x2'));var seqqueue=require(_0x7d8d('0x3'));var moment=require(_0x7d8d('0x4'));var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x7d8d('0x5'));config['redis']=_[_0x7d8d('0x6')](config[_0x7d8d('0x7')],{'host':_0x7d8d('0x8'),'port':0x18eb});var io=require(_0x7d8d('0x9'))(new Redis(config[_0x7d8d('0x7')]));var attributes=['id',_0x7d8d('0xa'),_0x7d8d('0xb'),'queue',_0x7d8d('0xc'),_0x7d8d('0xd')];function emit(_0x3e2f6e,_0x144911,_0x407423){io['to'](_0x3e2f6e)[_0x7d8d('0xe')](_0x144911,_0x407423);}function emitChannelQueueInteraction(_0x2a0f33,_0x5aa889,_0x584e0c,_0x2fb7f3,_0xe1ca5f,_0x1a238c,_0xfc6750,_0x47b857){var _0x1ba2b9=_[_0x7d8d('0xf')](_0x584e0c);_0x1ba2b9[_0x7d8d('0xa')]=_0x47b857;_0x1ba2b9[_0x7d8d('0x10')]=_0x5aa889;_0x1ba2b9[_0x7d8d('0xb')]=_0x2fb7f3;_0x1ba2b9['id']=_0xe1ca5f;if(_0x1a238c){_0xfc6750[util[_0x7d8d('0x11')]('%sQueuesWaitingInteractions',_0x2a0f33)][_0xe1ca5f]=_[_0x7d8d('0x12')](_0x1ba2b9,attributes);}else{delete _0xfc6750[util[_0x7d8d('0x11')](_0x7d8d('0x13'),_0x2a0f33)][_0xe1ca5f];}emit(util[_0x7d8d('0x11')](_0x7d8d('0x14'),_0x2a0f33,_0x5aa889),util['format'](_0x7d8d('0x15'),_0x2a0f33,_0x1a238c?'save':_0x7d8d('0x16')),_['pick'](_0x1ba2b9,attributes));}var rpc={'openchannelQueueReport':require(_0x7d8d('0x17')),'mailQueueReport':require(_0x7d8d('0x18')),'chatQueueReport':require(_0x7d8d('0x19')),'smsQueueReport':require(_0x7d8d('0x1a')),'faxQueueReport':require(_0x7d8d('0x1b')),'whatsappQueueReport':require(_0x7d8d('0x1c'))};var queue=schema({'name':{'type':_0x7d8d('0x1d'),'required':!![],'message':_0x7d8d('0x1e')},'timeout':{'type':'number','message':_0x7d8d('0x1f')}});function startRouting(_0x3b3c2a,_0x34fca1,_0x17e3cf,_0x888ca2){if(_0x3b3c2a&&_0x34fca1&&_0x17e3cf){_0x34fca1[_0x7d8d('0x20')]+=0x1;var _0x3b32d3={'uniqueid':_0x3b3c2a,'from':_0x17e3cf[_0x7d8d('0x21')]?_0x17e3cf[_0x7d8d('0x21')][_0x7d8d('0xc')]:'','joinAt':moment()[_0x7d8d('0x11')](_0x7d8d('0x22')),'ContactId':_0x17e3cf[_0x7d8d('0x23')]?_0x17e3cf[_0x7d8d('0x23')]['id']:null,'ListId':_0x17e3cf['list']?_0x17e3cf['list']['id']:null};_0x3b32d3[_['upperFirst'](_0x17e3cf[_0x7d8d('0x24')])+_0x7d8d('0x25')]=_0x34fca1['id']||null;_0x3b32d3[_[_0x7d8d('0x26')](_0x17e3cf[_0x7d8d('0x24')])+_0x7d8d('0x27')]=_0x17e3cf['interaction']?_0x17e3cf[_0x7d8d('0x28')]['id']:null;_0x3b32d3[_[_0x7d8d('0x26')](_0x17e3cf[_0x7d8d('0x24')])+_0x7d8d('0x29')]=_0x17e3cf[_0x7d8d('0x2a')]?_0x17e3cf[_0x7d8d('0x2a')]['id']:null;_0x3b32d3[_[_0x7d8d('0x26')](_0x17e3cf['channel'])+(_0x17e3cf[_0x7d8d('0x24')]!==_0x7d8d('0x2b')?_0x7d8d('0x2c'):_0x7d8d('0x2d'))]=_0x17e3cf[_0x7d8d('0xb')]?_0x17e3cf['account']['id']:null;logger['info'](util[_0x7d8d('0x11')](_0x7d8d('0x2e'),_0x3b3c2a,_0x34fca1[_0x7d8d('0x2f')]));emitChannelQueueInteraction(_0x17e3cf['channel'],_0x34fca1[_0x7d8d('0x2f')],_0x3b32d3,_0x17e3cf[_0x7d8d('0xb')][_0x7d8d('0x2f')],_0x17e3cf['message']['id'],!![],_0x888ca2,_0x34fca1['id']);if(rpc[_0x17e3cf[_0x7d8d('0x24')]+_0x7d8d('0x30')]){return rpc[_0x17e3cf['channel']+_0x7d8d('0x30')][_0x7d8d('0x31')](_0x3b32d3)[_0x7d8d('0x32')](function(_0x308383){logger[_0x7d8d('0x33')]('create\x20queue\x20report');});}}}function stopRouting(_0x47960c,_0x123b34,_0x1226ba,_0x5c0370){if(_0x47960c&&_0x123b34){_0x123b34[_0x7d8d('0x20')]-=0x1;var _0x5232c3={'leaveAt':moment()[_0x7d8d('0x11')](_0x7d8d('0x22')),'acceptAt':moment()['format'](_0x7d8d('0x22')),'reason':_0x7d8d('0x34')};logger[_0x7d8d('0x35')](util[_0x7d8d('0x11')]('[%s][STOP:QUEUE][NAME:%s]',_0x47960c,_0x123b34[_0x7d8d('0x2f')]));emitChannelQueueInteraction(_0x1226ba['channel'],_0x123b34[_0x7d8d('0x2f')],_0x1226ba[_0x7d8d('0x21')],_0x1226ba[_0x7d8d('0xb')][_0x7d8d('0x2f')],_0x1226ba['message']['id'],![],_0x5c0370,_0x123b34['id']);if(rpc[_0x1226ba[_0x7d8d('0x24')]+_0x7d8d('0x30')]){return rpc[_0x1226ba[_0x7d8d('0x24')]+_0x7d8d('0x30')][_0x7d8d('0x36')](_0x47960c,_0x5232c3)[_0x7d8d('0x32')](function(_0x3a90df){logger[_0x7d8d('0x33')]('update\x20queue\x20report');});}}}function endRouting(_0x185820,_0x3f87da,_0x1aec8b,_0x5ad3b6){if(_0x185820&&_0x3f87da){_0x3f87da['waiting']-=0x1;var _0x5767ac={'leaveAt':moment()[_0x7d8d('0x11')](_0x7d8d('0x22')),'exitAt':moment()[_0x7d8d('0x11')](_0x7d8d('0x22')),'reason':_0x7d8d('0x37')};logger['info'](util[_0x7d8d('0x11')](_0x7d8d('0x38'),_0x185820,_0x3f87da['name']));emitChannelQueueInteraction(_0x1aec8b[_0x7d8d('0x24')],_0x3f87da[_0x7d8d('0x2f')],_0x1aec8b[_0x7d8d('0x21')],_0x1aec8b[_0x7d8d('0xb')][_0x7d8d('0x2f')],_0x1aec8b[_0x7d8d('0x2a')]['id'],![],_0x5ad3b6);if(rpc[_0x1aec8b[_0x7d8d('0x24')]+_0x7d8d('0x30')]){return rpc[_0x1aec8b[_0x7d8d('0x24')]+_0x7d8d('0x30')]['update'](_0x185820,_0x5767ac)['catch'](function(_0x403608){logger['error'](_0x7d8d('0x39'));});}}}function handleFindQueue(_0x327bd0){return function(_0x4c1273){return _0x4c1273[_0x7d8d('0x2f')]['toLowerCase']()===_0x327bd0[_0x7d8d('0x3a')]();};}exports['consequence']=function(_0x3e2720,_0x262797,_0x2702c3,_0x3cae70){return function(_0x1ac540){try{var _0x6dbc57={'name':_0x262797[0x0],'timeout':_0x262797[0x1]};var _0x82f2c9=queue[_0x7d8d('0x0')](_0x6dbc57,{'typecast':!![]});if(_0x82f2c9[_0x7d8d('0x3b')]){logger[_0x7d8d('0x33')](_0x7d8d('0x3c'),_0x3e2720,_[_0x7d8d('0x3d')](_0x82f2c9,_0x7d8d('0x2a'))[_0x7d8d('0x3e')](',\x20'));_0x1ac540[_0x7d8d('0x3f')]();}else{var _0x2a3b29=_[_0x7d8d('0x40')](_0x2702c3[_0x3cae70[_0x7d8d('0x24')]+_0x7d8d('0x41')],handleFindQueue(_0x6dbc57[_0x7d8d('0x2f')]));if(_0x2a3b29){startRouting(_0x3e2720,_0x2a3b29,_0x3cae70,_0x2702c3);var _0x3f57c=(_0x2a3b29[_0x7d8d('0x37')]||0xa)*0x3e8;var _0x33e4f9=(_0x6dbc57['timeout']||0x14)*0x3e8;var _0x1cb50d,_0x194bef;if(_0x3f57c>_0x33e4f9){_0x33e4f9=_0x3f57c;}var _0x2a9902=seqqueue[_0x7d8d('0x42')](_0x3f57c);_0x2a9902['id']=_0x3e2720;_0x2a9902['atimeout']=_0x3f57c;_0x2a9902[_0x7d8d('0x43')]=_0x33e4f9;_0x2a9902[_0x7d8d('0x24')]=_0x3cae70['channel'];_0x2702c3[_0x7d8d('0x44')][_0x3e2720]['on'](_0x7d8d('0x45'),function(){logger[_0x7d8d('0x35')](_0x7d8d('0x46'),_0x3e2720);stopRouting(_0x3e2720,_0x2a3b29,_0x3cae70,_0x2702c3);clearTimeout(_0x1cb50d);_0x1cb50d=undefined;_0x2a9902[_0x7d8d('0x47')](!![]);if(_0x2702c3['rules'][_0x3e2720]){delete _0x2702c3[_0x7d8d('0x44')][_0x3e2720];}_0x1ac540[_0x7d8d('0x3f')]();});_0x2702c3[_0x7d8d('0x44')][_0x3e2720]['on'](_0x7d8d('0x48'),function(){if(_0x2702c3[_0x7d8d('0x44')][_0x3e2720]){delete _0x2702c3['rules'][_0x3e2720];}});_0x1cb50d=setTimeout(function(){logger[_0x7d8d('0x35')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x3e2720);endRouting(_0x3e2720,_0x2a3b29,_0x3cae70,_0x2702c3);clearTimeout(_0x1cb50d);_0x2a9902[_0x7d8d('0x47')](!![]);_0x1ac540[_0x7d8d('0x49')]();},_0x33e4f9);switch(_0x2a3b29[_0x7d8d('0x4a')]){case _0x7d8d('0x4b'):strategy[_0x7d8d('0x4b')](_0x2a9902,_0x2a3b29,_0x2702c3,_0x3cae70);break;default:strategy[_0x7d8d('0x4c')](_0x2a9902,_0x2a3b29,_0x2702c3,_0x3cae70);}}else{logger[_0x7d8d('0x33')](_0x7d8d('0x4d'),_0x3e2720,_0x6dbc57[_0x7d8d('0x2f')]);_0x1ac540[_0x7d8d('0x3f')]();}}}catch(_0x1c077e){console[_0x7d8d('0x4e')](_0x1c077e);logger['error'](_0x7d8d('0x3c'),_0x3e2720,_0x1c077e['stack']);_0x1ac540[_0x7d8d('0x3f')]();}};}; \ 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 5b55661..b7fc33b 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 _0x6b30=['exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','isNil','agents','isAgentAvailable','channel','busy','busyQueue','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x6b30,0x14b));var _0x06b3=function(_0x202506,_0x5b9c15){_0x202506=_0x202506-0x0;var _0x4c3e29=_0x6b30[_0x202506];return _0x4c3e29;};'use strict';var _=require(_0x06b3('0x0'));var uuid=require(_0x06b3('0x1'));var util=require(_0x06b3('0x2'));var logger=require(_0x06b3('0x3'))('routing');var Agent=function(_0x4e1a82,_0x4fec61,_0x2d1e6d,_0x3bd980){this[_0x06b3('0x4')]=uuid['v4']();this[_0x06b3('0x5')]=_0x4e1a82;this[_0x06b3('0x6')]=_0x4fec61;this[_0x06b3('0x7')]=_0x2d1e6d;this[_0x06b3('0x8')]=_0x3bd980;this[_0x06b3('0x5')]['push'](this[_0x06b3('0x9')][_0x06b3('0xa')](this),this[_0x06b3('0xb')][_0x06b3('0xa')](this));this[_0x06b3('0x5')]['on'](_0x06b3('0xc'),this[_0x06b3('0xb')][_0x06b3('0xa')](this));this['squeue']['on'](_0x06b3('0xd'),this[_0x06b3('0xe')]['bind'](this));};Agent[_0x06b3('0xf')][_0x06b3('0x10')]=function(){this[_0x06b3('0x5')][_0x06b3('0x10')](this['handleRun'][_0x06b3('0xa')](this),this['handleTimeout'][_0x06b3('0xa')](this));};Agent[_0x06b3('0xf')][_0x06b3('0xe')]=function(){this[_0x06b3('0xb')](!![]);};Agent[_0x06b3('0xf')][_0x06b3('0x9')]=function(_0x504f1e){logger[_0x06b3('0x11')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x06b3('0x5')]['id'],this[_0x06b3('0x6')]['id']);if(_[_0x06b3('0x12')](this[_0x06b3('0x7')][_0x06b3('0x13')][this[_0x06b3('0x6')]['id']])){logger[_0x06b3('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x06b3('0x5')]['id'],this[_0x06b3('0x6')]['id']);setTimeout(this[_0x06b3('0x10')]['bind'](this),0x3e8);}else{if(this[_0x06b3('0x8')]['forcedOwnership']||util[_0x06b3('0x14')](this[_0x06b3('0x5')]['id'],this[_0x06b3('0x7')]['agents'][this[_0x06b3('0x6')]['id']],this[_0x06b3('0x5')][_0x06b3('0x15')],![])){this[_0x06b3('0x7')][_0x06b3('0x13')][this[_0x06b3('0x6')]['id']][_0x06b3('0x16')]=!![];this[_0x06b3('0x7')][_0x06b3('0x13')][this[_0x06b3('0x6')]['id']][_0x06b3('0x17')]=undefined;util['showNotification'](this[_0x06b3('0x4')],this['squeue']['id'],this[_0x06b3('0x7')][_0x06b3('0x13')][this['agent']['id']],null,this[_0x06b3('0x8')]);util['writeLog'](this[_0x06b3('0x5')]['id'],this['realtime']['agents'][this[_0x06b3('0x6')]['id']],_0x06b3('0x18')+(this['routing'][_0x06b3('0x19')]?_0x06b3('0x1a'):''));}else{logger[_0x06b3('0x11')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x06b3('0x5')]['id'],this[_0x06b3('0x6')]['id']);setTimeout(this[_0x06b3('0x10')][_0x06b3('0xa')](this),0x3e8);}}};Agent[_0x06b3('0xf')][_0x06b3('0xb')]=function(_0x19a281){if(_[_0x06b3('0x12')](this['realtime'][_0x06b3('0x13')][this[_0x06b3('0x6')]['id']])){return logger[_0x06b3('0x11')](_0x06b3('0x1b'),this['squeue']['id'],this[_0x06b3('0x6')]['id']);}else{logger[_0x06b3('0x11')](_0x06b3('0x1c'),this[_0x06b3('0x5')]['id'],this[_0x06b3('0x6')]['id']);util[_0x06b3('0x1d')](this['notificationId'],this[_0x06b3('0x5')]['id'],this[_0x06b3('0x7')][_0x06b3('0x13')][this[_0x06b3('0x6')]['id']],null,this['routing']);this[_0x06b3('0x7')][_0x06b3('0x13')][this[_0x06b3('0x6')]['id']][_0x06b3('0x16')]=![];this[_0x06b3('0x7')][_0x06b3('0x13')][this[_0x06b3('0x6')]['id']][_0x06b3('0x17')]=undefined;util[_0x06b3('0x1e')](this[_0x06b3('0x5')]['id'],this[_0x06b3('0x7')]['agents'][this['agent']['id']],_0x19a281?_0x06b3('0x1f'):'TIMEOUT');}if(!_0x19a281){setTimeout(this['push'][_0x06b3('0xa')](this),0x3e8);}};function agent(_0xf90a55,_0x29a3d7,_0x252085,_0x56db02){return new Agent(_0xf90a55,_0x29a3d7,_0x252085,_0x56db02);}module[_0x06b3('0x20')]=agent; \ No newline at end of file +var _0x8fb3=['handleDrained','info','agent','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','showNotification','writeLog','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','push','bind','timeout','handleRun','handleTimeout','prototype'];(function(_0x4ef533,_0x2a4048){var _0x1cb9ba=function(_0x311082){while(--_0x311082){_0x4ef533['push'](_0x4ef533['shift']());}};_0x1cb9ba(++_0x2a4048);}(_0x8fb3,0x1e2));var _0x38fb=function(_0x14f09c,_0x309f7f){_0x14f09c=_0x14f09c-0x0;var _0x5470ca=_0x8fb3[_0x14f09c];return _0x5470ca;};'use strict';var _=require('lodash');var uuid=require(_0x38fb('0x0'));var util=require('./util');var logger=require(_0x38fb('0x1'))(_0x38fb('0x2'));var Agent=function(_0x53331d,_0x3ae3bf,_0x24bbf3,_0x1f74d5){this[_0x38fb('0x3')]=uuid['v4']();this[_0x38fb('0x4')]=_0x53331d;this['agent']=_0x3ae3bf;this['realtime']=_0x24bbf3;this[_0x38fb('0x2')]=_0x1f74d5;this[_0x38fb('0x4')][_0x38fb('0x5')](this['handleRun']['bind'](this),this['handleTimeout'][_0x38fb('0x6')](this));this['squeue']['on'](_0x38fb('0x7'),this['handleTimeout']['bind'](this));this[_0x38fb('0x4')]['on']('drained',this['handleDrained'][_0x38fb('0x6')](this));};Agent['prototype'][_0x38fb('0x5')]=function(){this[_0x38fb('0x4')][_0x38fb('0x5')](this[_0x38fb('0x8')][_0x38fb('0x6')](this),this[_0x38fb('0x9')][_0x38fb('0x6')](this));};Agent[_0x38fb('0xa')][_0x38fb('0xb')]=function(){this[_0x38fb('0x9')](!![]);};Agent[_0x38fb('0xa')][_0x38fb('0x8')]=function(_0x49cc09){logger[_0x38fb('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x38fb('0x4')]['id'],this[_0x38fb('0xd')]['id']);if(_['isNil'](this[_0x38fb('0xe')]['agents'][this['agent']['id']])){logger['info'](_0x38fb('0xf'),this[_0x38fb('0x4')]['id'],this[_0x38fb('0xd')]['id']);setTimeout(this['push'][_0x38fb('0x6')](this),0x3e8);}else{if(this['routing'][_0x38fb('0x10')]||util[_0x38fb('0x11')](this[_0x38fb('0x4')]['id'],this['realtime'][_0x38fb('0x12')][this['agent']['id']],this[_0x38fb('0x4')]['channel'],![])){this[_0x38fb('0xe')]['agents'][this[_0x38fb('0xd')]['id']][_0x38fb('0x13')]=!![];this['realtime'][_0x38fb('0x12')][this[_0x38fb('0xd')]['id']][_0x38fb('0x14')]=undefined;util[_0x38fb('0x15')](this['notificationId'],this[_0x38fb('0x4')]['id'],this['realtime'][_0x38fb('0x12')][this[_0x38fb('0xd')]['id']],null,this['routing']);util[_0x38fb('0x16')](this['squeue']['id'],this[_0x38fb('0xe')][_0x38fb('0x12')][this[_0x38fb('0xd')]['id']],'RINGING'+(this[_0x38fb('0x2')][_0x38fb('0x10')]?':FORCED':''));}else{logger['info']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x38fb('0x4')]['id'],this[_0x38fb('0xd')]['id']);setTimeout(this[_0x38fb('0x5')][_0x38fb('0x6')](this),0x3e8);}}};Agent[_0x38fb('0xa')][_0x38fb('0x9')]=function(_0x19e859){if(_[_0x38fb('0x17')](this['realtime'][_0x38fb('0x12')][this[_0x38fb('0xd')]['id']])){return logger['info'](_0x38fb('0xf'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x38fb('0xc')](_0x38fb('0x18'),this[_0x38fb('0x4')]['id'],this[_0x38fb('0xd')]['id']);util[_0x38fb('0x19')](this[_0x38fb('0x3')],this[_0x38fb('0x4')]['id'],this['realtime'][_0x38fb('0x12')][this[_0x38fb('0xd')]['id']],null,this['routing']);this[_0x38fb('0xe')]['agents'][this[_0x38fb('0xd')]['id']][_0x38fb('0x13')]=![];this[_0x38fb('0xe')][_0x38fb('0x12')][this[_0x38fb('0xd')]['id']][_0x38fb('0x14')]=undefined;util[_0x38fb('0x16')](this['squeue']['id'],this[_0x38fb('0xe')][_0x38fb('0x12')][this['agent']['id']],_0x19e859?_0x38fb('0x1a'):_0x38fb('0x1b'));}if(!_0x19e859){setTimeout(this[_0x38fb('0x5')]['bind'](this),0x3e8);}};function agent(_0x1e22a5,_0x3978dc,_0x64647e,_0x5d4f86){return new Agent(_0x1e22a5,_0x3978dc,_0x64647e,_0x5d4f86);}module[_0x38fb('0x1c')]=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 8a45b1b..bb7a36c 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 _0xf350=['notificationId','squeue','bind','timeout','handleTimeout','drained','handleDrained','prototype','push','handleRun','isNil','queue','Agents','length','realtime','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','exports','lodash','../../../../../config/logger','routing'];(function(_0x4548d5,_0x50239a){var _0x10fb5b=function(_0x42da19){while(--_0x42da19){_0x4548d5['push'](_0x4548d5['shift']());}};_0x10fb5b(++_0x50239a);}(_0xf350,0x105));var _0x0f35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf350[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0f35('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x0f35('0x1'))(_0x0f35('0x2'));var Beepall=function(_0xd06af5,_0x363a5f,_0xf411f3,_0x42652f){this[_0x0f35('0x3')]=uuid['v4']();this['squeue']=_0xd06af5;this['queue']=_0x363a5f;this['realtime']=_0xf411f3;this[_0x0f35('0x2')]=_0x42652f;this[_0x0f35('0x4')]['push'](this['handleRun'][_0x0f35('0x5')](this),this['handleTimeout'][_0x0f35('0x5')](this));this['squeue']['on'](_0x0f35('0x6'),this[_0x0f35('0x7')][_0x0f35('0x5')](this));this[_0x0f35('0x4')]['on'](_0x0f35('0x8'),this[_0x0f35('0x9')][_0x0f35('0x5')](this));};Beepall[_0x0f35('0xa')][_0x0f35('0xb')]=function(){this['squeue'][_0x0f35('0xb')](this[_0x0f35('0xc')]['bind'](this),this[_0x0f35('0x7')]['bind'](this));};Beepall[_0x0f35('0xa')]['handleDrained']=function(_0x5e601e){this[_0x0f35('0x7')](!![]);};Beepall[_0x0f35('0xa')][_0x0f35('0xc')]=function(_0x509b6e){var _0x3c456a=!![];if(!_[_0x0f35('0xd')](this[_0x0f35('0xe')])&&!_[_0x0f35('0xd')](this[_0x0f35('0xe')][_0x0f35('0xf')])&&this[_0x0f35('0xe')][_0x0f35('0xf')][_0x0f35('0x10')]>0x0){for(var _0x34b759=0x0,_0x458382;_0x34b7590x0){for(var _0x3f5dc6=0x0,_0x5d68e4;_0x3f5dc60x0&&_0x2c0c21[_0x5e70ec+_0x75d1('0x25')]>=_0x2c0c21[_0x5e70ec+'Capacity']){writeLog(_0x526f6c,_0x2c0c21,_0x5e70ec['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x75d1('0x26')]=function(_0x30d9f3,_0x45c182,_0x468bf0,_0x38653d,_0x519ceb){return sendNotification(!![],_0x30d9f3,_0x45c182,_0x468bf0,_0x38653d,_0x519ceb);};exports['hideNotification']=function(_0x410e16,_0x197f52,_0x4967b5,_0x2408b6,_0x5aa4fa){return sendNotification(![],_0x410e16,_0x197f52,_0x4967b5,_0x2408b6,_0x5aa4fa);};exports[_0x75d1('0x27')]=writeLog; \ No newline at end of file +var _0xd046=['save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','util','../utils','mustache','../../../../../config/environment','redis','emit','user:save','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','format','message','user:%s','notification:%s'];(function(_0x54d988,_0x1bd266){var _0x35d67f=function(_0x595784){while(--_0x595784){_0x54d988['push'](_0x54d988['shift']());}};_0x35d67f(++_0x1bd266);}(_0xd046,0x129));var _0x6d04=function(_0xea4e4e,_0x26f86e){_0xea4e4e=_0xea4e4e-0x0;var _0x2cf125=_0xd046[_0xea4e4e];return _0x2cf125;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var utils=require(_0x6d04('0x1'));var Mustache=require(_0x6d04('0x2'));var Redis=require('ioredis');var config=require(_0x6d04('0x3'));var logger=require('../../../../../config/logger')('routing');config[_0x6d04('0x4')]=_['defaults'](config[_0x6d04('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6d04('0x4')]));function emit(_0x1968c4,_0x4f83bc,_0x569c7b){io['to'](_0x1968c4)[_0x6d04('0x5')](_0x4f83bc,_0x569c7b);}function sendNotification(_0x42aa22,_0x52fc0c,_0x533dcf,_0x27a3d6,_0x4b5aae,_0x38bce9){io['to'](util['format']('user:%s',_0x27a3d6['name']))[_0x6d04('0x5')](_0x6d04('0x6'),_0x27a3d6);var _0x3397ea=_0x38bce9||{};var _0x1acfcc=_0x533dcf['split']('.');var _0x26a6ab={'uniqueid':_0x52fc0c,'channel':_0x1acfcc[0x0],'id':_0x1acfcc[0x1],'title':_0x1acfcc[0x0]+_0x6d04('0x7'),'interactionId':_0x1acfcc[0x2],'queue':_0x4b5aae?_0x4b5aae[_0x6d04('0x8')]:null,'sound':_0x3397ea[_0x6d04('0x9')][_0x6d04('0xa')],'shake':_0x3397ea[_0x6d04('0x9')][_0x6d04('0xb')]};try{if(!_0x3397ea[_0x6d04('0xc')]){_0x3397ea[_0x6d04('0xc')]={};}if(_0x4b5aae){_0x3397ea[_0x6d04('0xc')][_0x6d04('0xd')]=_0x4b5aae;}else if(_0x3397ea[_0x6d04('0xc')][_0x6d04('0xd')]){delete _0x3397ea[_0x6d04('0xc')][_0x6d04('0xd')];}_0x26a6ab[_0x6d04('0xe')]=utils[_0x6d04('0xf')](_0x3397ea[_0x6d04('0x9')][_0x6d04('0x10')],_0x3397ea);}catch(_0x1f8252){_0x26a6ab[_0x6d04('0xe')]=_0x6d04('0x11');logger[_0x6d04('0x12')](util[_0x6d04('0x13')]('[%s][QUEUE]\x20%s',_0x52fc0c,_0x1f8252[_0x6d04('0x14')]));}io['to'](util[_0x6d04('0x13')](_0x6d04('0x15'),_0x27a3d6[_0x6d04('0x8')]))[_0x6d04('0x5')](util[_0x6d04('0x13')](_0x6d04('0x16'),_0x42aa22?_0x6d04('0x17'):_0x6d04('0x18')),_0x26a6ab);}function writeLog(_0x27d8eb,_0xbddecb,_0x2994d9){return logger[_0x6d04('0x19')](util['format'](_0x6d04('0x1a'),_0x27d8eb,_0xbddecb[_0x6d04('0x8')],_0x2994d9));}exports['isAgentAvailable']=function(_0x5a0224,_0x3bd862,_0x326276,_0x4386bd){if(_0x3bd862[_0x6d04('0x1b')]){writeLog(_0x5a0224,_0x3bd862,_0x6d04('0x1c'));return![];}if(!_0x3bd862[_0x6d04('0x1d')]){writeLog(_0x5a0224,_0x3bd862,_0x6d04('0x1e'));return![];}if(_0x3bd862[_0x326276+_0x6d04('0x1f')]){writeLog(_0x5a0224,_0x3bd862,_0x6d04('0x20'));return![];}if(_0x4386bd&&_0x3bd862[_0x6d04('0x21')](_0x326276+_0x6d04('0x22'))&&_0x3bd862[_0x6d04('0x21')](_0x326276+_0x6d04('0x23'))){if(_0x3bd862[_0x326276+_0x6d04('0x22')]>0x0&&_0x3bd862[_0x326276+'CurrentCapacity']>=_0x3bd862[_0x326276+_0x6d04('0x22')]){writeLog(_0x5a0224,_0x3bd862,_0x326276[_0x6d04('0x24')]()+_0x6d04('0x25'));return![];}}return!![];};exports[_0x6d04('0x26')]=function(_0x4256a3,_0x3a62d4,_0x549e97,_0x2a3b20,_0x3a7f68){return sendNotification(!![],_0x4256a3,_0x3a62d4,_0x549e97,_0x2a3b20,_0x3a7f68);};exports[_0x6d04('0x27')]=function(_0x40b9e6,_0x2ed2bb,_0x5d2b7e,_0x5d1033,_0x56dd77){return sendNotification(![],_0x40b9e6,_0x2ed2bb,_0x5d2b7e,_0x5d1033,_0x56dd77);};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index c4b3dbe..340b0f5 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 _0xbfa4=['getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','./utils','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x50af7c,_0x36d39e){var _0xf4d380=function(_0x4d9f37){while(--_0x4d9f37){_0x50af7c['push'](_0x50af7c['shift']());}};_0xf4d380(++_0x36d39e);}(_0xbfa4,0x106));var _0x4bfa=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xbfa4[_0x6d6a66];return _0x11eb6e;};'use strict';var schema=require(_0x4bfa('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x4bfa('0x1'));var logger=require('../../../../config/logger')('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0x4bfa('0x2')}});exports[_0x4bfa('0x3')]=function(_0x1b7f51,_0x125624){return function(_0x327755){try{var _0x1ba9fe={'command':_0x125624[0x0]};var _0x55eb98=system[_0x4bfa('0x0')](_0x1ba9fe,{'typecast':!![]});if(_0x55eb98[_0x4bfa('0x4')]){logger[_0x4bfa('0x5')](_0x4bfa('0x6'),_0x1b7f51,_[_0x4bfa('0x7')](_0x55eb98,_0x4bfa('0x8'))[_0x4bfa('0x9')](',\x20'));logger[_0x4bfa('0xa')](_0x4bfa('0xb'),_0x1b7f51);_0x327755[_0x4bfa('0xc')]();}else{var _0x4feba9=this;var _0x898675=utils[_0x4bfa('0xd')](_0x125624[0x0],this);logger[_0x4bfa('0xa')](_0x4bfa('0xe'),_0x1b7f51,_0x898675);sh[_0x4bfa('0xf')](_[_0x4bfa('0x10')](_0x898675),function(_0x227121,_0x349adf){logger[_0x4bfa('0xa')](_0x4bfa('0x11'),_0x1b7f51,_0x227121);if(_0x227121==0x0){var _0x37a58d=_0x349adf[_0x4bfa('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x125624[0x1])||_[_0x4bfa('0x13')](_0x125624[0x1])){logger[_0x4bfa('0xa')](_0x4bfa('0x14'),_0x1b7f51);_0x4feba9[_0x4bfa('0x15')][_0x125624[0x1]]=_0x37a58d;}else{logger[_0x4bfa('0xa')](_0x4bfa('0x16'),_0x1b7f51,_0x125624[0x1],_0x37a58d);_0x4feba9['body'][_0x125624[0x1]]=_0x37a58d;}}_0x327755['next']();});}}catch(_0x255314){logger[_0x4bfa('0x5')](_0x4bfa('0x6'),_0x1b7f51,_[_0x4bfa('0x17')](_0x255314)?JSON[_0x4bfa('0x18')](_0x255314):_0x255314);logger['info'](_0x4bfa('0xb'),_0x1b7f51);_0x327755['next']();}};}; \ No newline at end of file +var _0x7b78=['map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','stringify','validate','shelljs','lodash','../../../../config/logger','string','consequence','error'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x7b78,0x185));var _0x87b7=function(_0x4ceb70,_0x360f30){_0x4ceb70=_0x4ceb70-0x0;var _0x242d14=_0x7b78[_0x4ceb70];return _0x242d14;};'use strict';var schema=require(_0x87b7('0x0'));var sh=require(_0x87b7('0x1'));var _=require(_0x87b7('0x2'));var utils=require('./utils');var logger=require(_0x87b7('0x3'))('routing');var system=schema({'command':{'type':_0x87b7('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x87b7('0x5')]=function(_0x1417ce,_0x2233bc){return function(_0x1ea40f){try{var _0x151665={'command':_0x2233bc[0x0]};var _0x49ca66=system[_0x87b7('0x0')](_0x151665,{'typecast':!![]});if(_0x49ca66['length']){logger[_0x87b7('0x6')]('[%s][SYSTEM]\x20%s',_0x1417ce,_[_0x87b7('0x7')](_0x49ca66,'message')[_0x87b7('0x8')](',\x20'));logger[_0x87b7('0x9')](_0x87b7('0xa'),_0x1417ce);_0x1ea40f[_0x87b7('0xb')]();}else{var _0x5476d9=this;var _0x19ae92=utils[_0x87b7('0xc')](_0x2233bc[0x0],this);logger[_0x87b7('0x9')](_0x87b7('0xd'),_0x1417ce,_0x19ae92);sh['exec'](_['trim'](_0x19ae92),function(_0x458ec6,_0x553dde){logger['info'](_0x87b7('0xe'),_0x1417ce,_0x458ec6);if(_0x458ec6==0x0){var _0x20e174=_0x553dde[_0x87b7('0xf')](/(\r\n|\n|\r)/gm,'');if(_[_0x87b7('0x10')](_0x2233bc[0x1])||_[_0x87b7('0x11')](_0x2233bc[0x1])){logger[_0x87b7('0x9')](_0x87b7('0x12'),_0x1417ce);_0x5476d9['body'][_0x2233bc[0x1]]=_0x20e174;}else{logger['info'](_0x87b7('0x13'),_0x1417ce,_0x2233bc[0x1],_0x20e174);_0x5476d9[_0x87b7('0x14')][_0x2233bc[0x1]]=_0x20e174;}}_0x1ea40f[_0x87b7('0xb')]();});}}catch(_0x51d7ec){logger[_0x87b7('0x6')]('[%s][SYSTEM]\x20%s',_0x1417ce,_['isObject'](_0x51d7ec)?JSON[_0x87b7('0x15')](_0x51d7ec):_0x51d7ec);logger[_0x87b7('0x9')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x1417ce);_0x1ea40f[_0x87b7('0xb')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tag.js b/server/services/routing/server/applications/tag.js index c4f0d2c..4f3215c 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 _0x8771=['Interaction','channel','addTags','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info','next'];(function(_0x19f9e6,_0x4f59a6){var _0x45c862=function(_0x3447fb){while(--_0x3447fb){_0x19f9e6['push'](_0x19f9e6['shift']());}};_0x45c862(++_0x4f59a6);}(_0x8771,0x1a0));var _0x1877=function(_0x7d42c9,_0x53721d){_0x7d42c9=_0x7d42c9-0x0;var _0x542f15=_0x8771[_0x7d42c9];return _0x542f15;};'use strict';var schema=require(_0x1877('0x0'));var _=require(_0x1877('0x1'));var rpc={'chatInteraction':require(_0x1877('0x2')),'openchannelInteraction':require(_0x1877('0x3')),'smsInteraction':require(_0x1877('0x4')),'mailInteraction':require(_0x1877('0x5')),'faxInteraction':require(_0x1877('0x6')),'whatsappInteraction':require(_0x1877('0x7'))};var logger=require(_0x1877('0x8'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1877('0x9')}});exports[_0x1877('0xa')]=function(_0x28eb85,_0x3741a2,_0x5eb57c,_0x4536b9){return function(_0xbfffbd){try{var _0x53cdfd={'tag':_0x3741a2[0x0]};var _0x180398=tag[_0x1877('0x0')](_0x53cdfd,{'typecast':!![]});if(_0x180398[_0x1877('0xb')]){logger[_0x1877('0xc')]('[%s][TAG]\x20%s',_0x28eb85,_['map'](_0x180398,_0x1877('0xd'))['join'](',\x20'));logger[_0x1877('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x28eb85);_0xbfffbd[_0x1877('0xf')]();}else{var _0x406769={'ids':[_0x3741a2[0x0]]};if(rpc[_0x4536b9['channel']+_0x1877('0x10')]){rpc[_0x4536b9[_0x1877('0x11')]+'Interaction'][_0x1877('0x12')](_0x4536b9['interaction']['id'],_0x406769)[_0x1877('0x13')](function(_0x4d8372){logger['info'](_0x1877('0x14'),_0x28eb85,_0x3741a2[0x1],_0x4536b9[_0x1877('0x11')],_0x4536b9[_0x1877('0x15')]['id']);})[_0x1877('0x16')](function(_0x5c4c84){logger[_0x1877('0xc')](_0x1877('0x17'),_0x28eb85,JSON[_0x1877('0x18')](_0x5c4c84));logger[_0x1877('0xe')](_0x1877('0x19'),_0x28eb85);})[_0x1877('0x1a')](function(){_0xbfffbd['next']();});}}}catch(_0xa1e2dd){logger[_0x1877('0xc')]('[%s][TAG]\x20%s',_0x28eb85,_['isObject'](_0xa1e2dd)?JSON[_0x1877('0x18')](_0xa1e2dd):_0xa1e2dd);logger[_0x1877('0xe')](_0x1877('0x19'),_0x28eb85);_0xbfffbd[_0x1877('0xf')]();}};}; \ No newline at end of file +var _0x5208=['Interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','[%s][TAG]\x20%s','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','error','isObject','validate','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','next','channel'];(function(_0x5398c5,_0x4f7579){var _0x317767=function(_0x31fabb){while(--_0x31fabb){_0x5398c5['push'](_0x5398c5['shift']());}};_0x317767(++_0x4f7579);}(_0x5208,0x8d));var _0x8520=function(_0x4f13f8,_0x5e13c5){_0x4f13f8=_0x4f13f8-0x0;var _0x1e6b83=_0x5208[_0x4f13f8];return _0x1e6b83;};'use strict';var schema=require(_0x8520('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x8520('0x1')),'mailInteraction':require(_0x8520('0x2')),'faxInteraction':require(_0x8520('0x3')),'whatsappInteraction':require(_0x8520('0x4'))};var logger=require(_0x8520('0x5'))('routing');var tag=schema({'tag':{'type':_0x8520('0x6'),'required':!![],'message':_0x8520('0x7')}});exports[_0x8520('0x8')]=function(_0x279caf,_0x2e9795,_0x3e4959,_0x508c13){return function(_0x5c7a01){try{var _0x3e9e25={'tag':_0x2e9795[0x0]};var _0xe2d8b2=tag['validate'](_0x3e9e25,{'typecast':!![]});if(_0xe2d8b2[_0x8520('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x279caf,_[_0x8520('0xa')](_0xe2d8b2,_0x8520('0xb'))[_0x8520('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x279caf);_0x5c7a01[_0x8520('0xd')]();}else{var _0x1de0e3={'ids':[_0x2e9795[0x0]]};if(rpc[_0x508c13[_0x8520('0xe')]+_0x8520('0xf')]){rpc[_0x508c13[_0x8520('0xe')]+_0x8520('0xf')]['addTags'](_0x508c13['interaction']['id'],_0x1de0e3)['then'](function(_0x13c7c2){logger[_0x8520('0x10')](_0x8520('0x11'),_0x279caf,_0x2e9795[0x1],_0x508c13['channel'],_0x508c13[_0x8520('0x12')]['id']);})[_0x8520('0x13')](function(_0x46f9b1){logger['error'](_0x8520('0x14'),_0x279caf,JSON[_0x8520('0x15')](_0x46f9b1));logger['info'](_0x8520('0x16'),_0x279caf);})[_0x8520('0x17')](function(){_0x5c7a01[_0x8520('0xd')]();});}}}catch(_0x2639f7){logger[_0x8520('0x18')](_0x8520('0x14'),_0x279caf,_[_0x8520('0x19')](_0x2639f7)?JSON[_0x8520('0x15')](_0x2639f7):_0x2639f7);logger[_0x8520('0x10')](_0x8520('0x16'),_0x279caf);_0x5c7a01[_0x8520('0xd')]();}};}; \ 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 455fe64..c863bf6 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x452492,_0x37eaa1){var _0x3124d1=function(_0xf7fe8c){while(--_0xf7fe8c){_0x452492['push'](_0x452492['shift']());}};_0x3124d1(++_0x37eaa1);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0xfa982e,_0x1c0451){var _0x27f06a=function(_0x47dc43){while(--_0x47dc43){_0xfa982e['push'](_0xfa982e['shift']());}};_0x27f06a(++_0x1c0451);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 3c554c6..9fa7659 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 _0x4596=['dialogflowv2','amazonlex','tag','TagId','%s:%s:%s','app','./interval','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','matchPath','emit','stack','agent','agents','busyQueue','interaction','end','QueueReport','UserId','catch','message\x20is\x20empty','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','isNil','IntervalId','Intervals','map','interval','rules','channel','message','applications','isArray','length','existsSync','join','.js','toLowerCase','autoreply','appdata','split','push','slice','dialogflow'];(function(_0xc075ca,_0x44b3f1){var _0xfc6202=function(_0x46a201){while(--_0x46a201){_0xc075ca['push'](_0xc075ca['shift']());}};_0xfc6202(++_0x44b3f1);}(_0x4596,0xfb));var _0x6459=function(_0x47ff12,_0x429a56){_0x47ff12=_0x47ff12-0x0;var _0x10b7e3=_0x4596[_0x47ff12];return _0x10b7e3;};'use strict';var _=require(_0x6459('0x0'));var util=require(_0x6459('0x1'));var path=require(_0x6459('0x2'));var fs=require('fs');var jayson=require(_0x6459('0x3'));var BPromise=require(_0x6459('0x4'));var uuid=require('uuid');var config=require(_0x6459('0x5'));var logger=require(_0x6459('0x6'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x6459('0x7')),'chatQueueReport':require(_0x6459('0x8')),'smsQueueReport':require(_0x6459('0x9')),'faxQueueReport':require(_0x6459('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x6459('0xb'));function getId(_0x45a786,_0x49ab9e,_0x2849f5){return util[_0x6459('0xc')]('%s.%s.%s',_0x45a786,_0x49ab9e||0x0,_0x2849f5||0x0);}function getIntervals(_0x4c4b9f,_0x274773){var _0x3f2b23=[];if(!_[_0x6459('0xd')](_0x274773[_0x6459('0xe')])&&!_[_0x6459('0xd')](_0x4c4b9f[_0x274773[_0x6459('0xe')]])&&!_[_0x6459('0xd')](_0x4c4b9f[_0x274773[_0x6459('0xe')]][_0x6459('0xf')])){_0x3f2b23=_[_0x6459('0x10')](_0x4c4b9f[_0x274773[_0x6459('0xe')]]['Intervals'],'interval');}else if(!_[_0x6459('0xd')](_0x274773[_0x6459('0x11')])){_0x3f2b23=[_0x274773[_0x6459('0x11')]];}return _0x3f2b23;}exports['listen']=function(_0x2b7063){_0x2b7063[_0x6459('0x12')]={};return new BPromise(function(_0x410feb,_0x4c3b01){var _0x41c007={'Start':function(_0x7bc219){var _0x281cfb=this;return new Promise(function(_0xfaea51,_0x326f64){if(_0x7bc219){try{var _0x13b3d8=[];var _0x152aa0=getId(_0x7bc219[_0x6459('0x13')],_0x7bc219['message']?_0x7bc219[_0x6459('0x14')]['id']:0x0,_0x7bc219['interaction']?_0x7bc219['interaction']['id']:0x0);if(_0x7bc219[_0x6459('0x15')]&&_[_0x6459('0x16')](_0x7bc219[_0x6459('0x15')])&&_0x7bc219[_0x6459('0x15')][_0x6459('0x17')]){for(var _0x123454=0x0;_0x123454<_0x7bc219['applications']['length'];_0x123454+=0x1){var _0x4f479c=_0x7bc219['applications'][_0x123454];if(fs[_0x6459('0x18')](path[_0x6459('0x19')](__dirname,_0x6459('0x15'),_0x4f479c['app']+_0x6459('0x1a')))){var _0x4c5878=[];switch(_0x4f479c['app'][_0x6459('0x1b')]()){case _0x6459('0x1c'):var _0x1b2a90=_0x4f479c[_0x6459('0x1d')][_0x6459('0x1e')](',');if(_0x7bc219[_0x6459('0x13')]==='mail'){_0x4c5878[_0x6459('0x1f')](_0x1b2a90[0x0]);_0x4c5878[_0x6459('0x1f')](_0x1b2a90[0x1]);_0x4c5878[_0x6459('0x1f')](_0x1b2a90[_0x6459('0x20')](0x2,_0x1b2a90['length'])[_0x6459('0x19')](','));}else{_0x4c5878[_0x6459('0x1f')](_0x1b2a90[0x0]);_0x4c5878[_0x6459('0x1f')](_0x1b2a90[_0x6459('0x20')](0x1,_0x1b2a90[_0x6459('0x17')])['join'](','));}break;case _0x6459('0x21'):var _0x2cbc25=_0x4f479c['appdata'][_0x6459('0x1e')](',');_0x4c5878[_0x6459('0x1f')](_0x2cbc25[0x0]);_0x4c5878[_0x6459('0x1f')](_0x2cbc25[0x1]);_0x4c5878[_0x6459('0x1f')](_0x2cbc25['slice'](0x2,_0x2cbc25[_0x6459('0x17')])[_0x6459('0x19')](','));break;case _0x6459('0x22'):var _0x4f9ce3=_0x4f479c['appdata']['split'](',');_0x4c5878[_0x6459('0x1f')](_0x4f9ce3[0x0]);_0x4c5878[_0x6459('0x1f')](_0x4f9ce3[0x1]);_0x4c5878[_0x6459('0x1f')](_0x4f9ce3[0x2]);_0x4c5878[_0x6459('0x1f')](_0x4f9ce3[0x3]);_0x4c5878[_0x6459('0x1f')](_0x4f9ce3[_0x6459('0x20')](0x4,_0x4f9ce3['length'])[_0x6459('0x19')](','));break;case _0x6459('0x23'):var _0x3ebad2=_0x4f479c[_0x6459('0x1d')]['split'](',');_0x4c5878[_0x6459('0x1f')](_0x3ebad2[0x0]);_0x4c5878[_0x6459('0x1f')](_0x3ebad2[0x1]);_0x4c5878[_0x6459('0x1f')](_0x3ebad2[0x2]);_0x4c5878[_0x6459('0x1f')](_0x3ebad2[0x3]);_0x4c5878['push'](_0x3ebad2['slice'](0x4,_0x3ebad2[_0x6459('0x17')])['join'](','));break;case'message':_0x4c5878[_0x6459('0x1f')](_0x4f479c[_0x6459('0x1d')]);break;case _0x6459('0x24'):_0x4c5878[_0x6459('0x1f')](_0x4f479c[_0x6459('0x25')]);_0x4c5878[_0x6459('0x1f')](_0x4f479c['appdata']);break;default:_0x4c5878=_[_0x6459('0xd')](_0x4f479c[_0x6459('0x1d')])?[]:_0x4f479c[_0x6459('0x1d')][_0x6459('0x1e')](',');}var _0x260cf7={'id':util[_0x6459('0xc')](_0x6459('0x26'),_0x152aa0,_0x4f479c['id'],_0x4f479c[_0x6459('0x27')]),'condition':require(_0x6459('0x28'))[_0x6459('0x29')](_0x152aa0,getIntervals(_0x2b7063['intervals'],_0x4f479c),_0x2b7063),'consequence':require(_0x6459('0x2a')+_0x4f479c['app'])[_0x6459('0x2b')](_0x152aa0,_0x4c5878,_0x2b7063,_0x7bc219),'p':_0x4f479c[_0x6459('0x2c')]||0x0};logger[_0x6459('0x2d')](_0x6459('0x2e'),_0x260cf7['id'],_0x6459('0x2f'),getIntervals(_0x2b7063[_0x6459('0x30')],_0x4f479c)[_0x6459('0x19')](_0x6459('0x31')));_0x13b3d8['push'](_0x260cf7);}else{logger[_0x6459('0x32')](_0x6459('0x33'),path['join'](__dirname,_0x6459('0x15'),_0x4f479c[_0x6459('0x27')]+_0x6459('0x1a')));}}_0x2b7063['rules'][_0x152aa0]=new RuleEngine(_0x13b3d8);_0x2b7063[_0x6459('0x12')][_0x152aa0][_0x6459('0x34')](_0x7bc219,function(_0x170a26){logger[_0x6459('0x2d')]('Applications\x20executed',JSON['stringify'](_0x170a26[_0x6459('0x35')]));if(_0x2b7063[_0x6459('0x12')][_0x152aa0]){_0x2b7063[_0x6459('0x12')][_0x152aa0][_0x6459('0x36')]('complete');}});return _0xfaea51({'code':0xc8,'message':_0x7bc219});}else{logger[_0x6459('0x2d')]('No\x20applications\x20to\x20execute');return _0xfaea51({'code':0xc8,'message':_0x7bc219});}}catch(_0x5bb486){logger[_0x6459('0x32')](_0x5bb486[_0x6459('0x37')]);return _0x326f64(_0x281cfb[_0x6459('0x32')](0x1f4,_0x5bb486));}}return _0x326f64('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2062c7){var _0x333229=this;return new Promise(function(_0x1b48b8,_0x3c8dcc){if(_0x2062c7['agent']&&_0x2062c7[_0x6459('0x38')]['id']){if(_0x2b7063['agents'][_0x2062c7[_0x6459('0x38')]['id']]){_0x2b7063['agents'][_0x2062c7['agent']['id']]['busy']=![];_0x2b7063[_0x6459('0x39')][_0x2062c7[_0x6459('0x38')]['id']][_0x6459('0x3a')]=undefined;}}if(_0x2062c7[_0x6459('0x14')]&&_0x2062c7[_0x6459('0x14')]['id']){try{var _0x21bcdd=getId(_0x2062c7['channel'],_0x2062c7[_0x6459('0x14')]?_0x2062c7[_0x6459('0x14')]['id']:0x0,_0x2062c7[_0x6459('0x3b')]?_0x2062c7['interaction']['id']:0x0);if(_0x2b7063['rules'][_0x21bcdd]){_0x2b7063[_0x6459('0x12')][_0x21bcdd][_0x6459('0x36')](_0x6459('0x3c'));if(rpc[_0x2062c7[_0x6459('0x13')]+_0x6459('0x3d')]){rpc[_0x2062c7['channel']+_0x6459('0x3d')]['update'](_0x21bcdd,{'UserId':_0x2062c7[_0x6459('0x14')][_0x6459('0x3e')]})[_0x6459('0x3f')](function(_0x464069){logger[_0x6459('0x32')]('error\x20update\x20queue\x20report');});}}return _0x1b48b8({'code':0xc8,'message':_0x2062c7});}catch(_0x5f07af){logger[_0x6459('0x32')](_0x5f07af[_0x6459('0x37')]);return _0x3c8dcc(_0x333229[_0x6459('0x32')](0x1f4,_0x5f07af));}}logger[_0x6459('0x32')](_0x6459('0x40'));return _0x3c8dcc(_0x333229['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x202582){var _0x1f31ec=this;return new Promise(function(_0x13c40b,_0x205402){if(_0x202582[_0x6459('0x38')]&&_0x202582[_0x6459('0x38')]['id']){try{if(_0x2b7063['agents'][_0x202582[_0x6459('0x38')]['id']]){_0x2b7063[_0x6459('0x39')][_0x202582[_0x6459('0x38')]['id']]['busy']=![];_0x2b7063['agents'][_0x202582[_0x6459('0x38')]['id']][_0x6459('0x3a')]=undefined;}return _0x13c40b({'code':0xc8,'message':_0x202582});}catch(_0x17e3cb){logger[_0x6459('0x32')](_0x17e3cb[_0x6459('0x37')]);return _0x205402(_0x1f31ec[_0x6459('0x32')](0x1f4,_0x17e3cb));}}logger['error'](_0x6459('0x40'));return _0x205402(_0x1f31ec['error'](0x1f4,_0x6459('0x40')));});},'AbandonInteraction':function(_0x11dae9){var _0x34a60a=this;return new Promise(function(_0x354c30,_0xead593){if(_0x11dae9[_0x6459('0x13')]&&_0x11dae9[_0x6459('0x3b')]&&_0x11dae9[_0x6459('0x3b')]['id']){try{var _0x1b7b74=getId(_0x11dae9[_0x6459('0x13')],_0x11dae9[_0x6459('0x14')]?_0x11dae9['message']['id']:0x0,_0x11dae9['interaction']?_0x11dae9[_0x6459('0x3b')]['id']:0x0);if(_0x2b7063[_0x6459('0x12')][_0x1b7b74]){_0x2b7063[_0x6459('0x12')][_0x1b7b74]['emit'](_0x6459('0x3c'));}return _0x354c30({'code':0xc8,'message':_0x11dae9});}catch(_0x4d10ad){logger[_0x6459('0x32')](_0x4d10ad[_0x6459('0x37')]);return _0xead593(_0x34a60a['error'](0x1f4,_0x4d10ad));}}logger[_0x6459('0x32')](_0x6459('0x40'));return _0xead593(_0x34a60a[_0x6459('0x32')](0x1f4,_0x6459('0x40')));});},'AgentCapacity':function(_0x1886cb){var _0x127196=this;return new Promise(function(_0x1c6cf5,_0x15b7b4){if(_0x2b7063[_0x6459('0x39')][_0x6459('0x41')](_0x1886cb['id'])){for(var _0x3cc5cf in _0x1886cb[_0x6459('0x42')]){if(_0x1886cb[_0x6459('0x42')][_0x6459('0x41')](_0x3cc5cf)){if(_0x2b7063[_0x6459('0x39')][_0x1886cb['id']]['hasOwnProperty'](_0x3cc5cf+'CurrentCapacity')){_0x2b7063[_0x6459('0x39')][_0x1886cb['id']][_0x3cc5cf+'CurrentCapacity']=parseInt(_0x1886cb['capacity'][_0x3cc5cf],0xa);}}}_0x2b7063[_0x6459('0x39')][_0x1886cb['id']][_0x6459('0x43')]();return _0x1c6cf5({'code':0xc8,'message':_0x2b7063[_0x6459('0x39')][_0x1886cb['id']]});}else{return _0x15b7b4(_0x127196[_0x6459('0x32')](0x1f4,_0x6459('0x44')));}});},'Agents':function(_0x563eb6){return new Promise(function(_0x1d8c09,_0x1feae8){var _0x77a8cf=_[_0x6459('0x45')](_0x2b7063[_0x6459('0x39')]);_0x1d8c09({'count':_0x77a8cf['length'],'rows':_0x77a8cf});});},'ChatQueues':function(_0x5cbf5d){return new Promise(function(_0x118261,_0x2aca84){var _0x57538e=[];for(var _0x4346db in _0x2b7063['chatQueues']){if(_0x2b7063[_0x6459('0x46')][_0x6459('0x41')](_0x4346db)){var _0x8ce6a=_0x2b7063[_0x6459('0x46')][_0x4346db];var _0x2806fd={'id':_0x8ce6a['id'],'available':_0x8ce6a[_0x6459('0x47')],'loggedIn':_0x8ce6a[_0x6459('0x48')],'name':_0x8ce6a[_0x6459('0x49')],'paused':_0x8ce6a[_0x6459('0x4a')],'waiting':_0x8ce6a[_0x6459('0x4b')]};_0x57538e[_0x6459('0x1f')](_0x2806fd);}}_0x118261({'count':_0x57538e[_0x6459('0x17')],'rows':_0x57538e});});},'MailQueues':function(_0x1ed06a){return new Promise(function(_0x2c38b3,_0x5929a9){var _0x3c4950=[];for(var _0x26bbbf in _0x2b7063['mailQueues']){if(_0x2b7063[_0x6459('0x4c')][_0x6459('0x41')](_0x26bbbf)){var _0x1a406b=_0x2b7063[_0x6459('0x4c')][_0x26bbbf];var _0x12ae3c={'id':_0x1a406b['id'],'available':_0x1a406b[_0x6459('0x47')],'loggedIn':_0x1a406b['loggedIn'],'name':_0x1a406b[_0x6459('0x49')],'paused':_0x1a406b[_0x6459('0x4a')],'waiting':_0x1a406b[_0x6459('0x4b')]};_0x3c4950[_0x6459('0x1f')](_0x12ae3c);}}_0x2c38b3({'count':_0x3c4950['length'],'rows':_0x3c4950});});},'OpenchannelQueues':function(_0x5a05e7){return new Promise(function(_0x5d2d77,_0x4e0ee2){var _0xaa9ce5=[];for(var _0x23beea in _0x2b7063[_0x6459('0x4d')]){if(_0x2b7063[_0x6459('0x4d')][_0x6459('0x41')](_0x23beea)){var _0x1b5f51=_0x2b7063['openchannelQueues'][_0x23beea];var _0x573feb={'id':_0x1b5f51['id'],'available':_0x1b5f51[_0x6459('0x47')],'loggedIn':_0x1b5f51['loggedIn'],'name':_0x1b5f51[_0x6459('0x49')],'paused':_0x1b5f51['paused'],'waiting':_0x1b5f51[_0x6459('0x4b')]};_0xaa9ce5[_0x6459('0x1f')](_0x573feb);}}_0x5d2d77({'count':_0xaa9ce5[_0x6459('0x17')],'rows':_0xaa9ce5});});},'SmsQueues':function(_0x24752d){return new Promise(function(_0x8e6f24,_0x594373){var _0x4acfb4=[];for(var _0x3cadf9 in _0x2b7063[_0x6459('0x4e')]){if(_0x2b7063['smsQueues'][_0x6459('0x41')](_0x3cadf9)){var _0x52d29d=_0x2b7063[_0x6459('0x4e')][_0x3cadf9];var _0xf16d79={'id':_0x52d29d['id'],'available':_0x52d29d[_0x6459('0x47')],'loggedIn':_0x52d29d[_0x6459('0x48')],'name':_0x52d29d[_0x6459('0x49')],'paused':_0x52d29d['paused'],'waiting':_0x52d29d['waiting']};_0x4acfb4[_0x6459('0x1f')](_0xf16d79);}}_0x8e6f24({'count':_0x4acfb4['length'],'rows':_0x4acfb4});});},'FaxQueues':function(_0x3daa4b){return new Promise(function(_0x4d304d,_0x508460){var _0x1e9f8b=[];for(var _0x111354 in _0x2b7063[_0x6459('0x4f')]){if(_0x2b7063['faxQueues'][_0x6459('0x41')](_0x111354)){var _0x372b5a=_0x2b7063[_0x6459('0x4f')][_0x111354];var _0x6f5eff={'id':_0x372b5a['id'],'available':_0x372b5a[_0x6459('0x47')],'loggedIn':_0x372b5a['loggedIn'],'name':_0x372b5a[_0x6459('0x49')],'paused':_0x372b5a[_0x6459('0x4a')],'waiting':_0x372b5a[_0x6459('0x4b')]};_0x1e9f8b[_0x6459('0x1f')](_0x6f5eff);}}_0x4d304d({'count':_0x1e9f8b['length'],'rows':_0x1e9f8b});});},'WhatsappQueues':function(_0x3e8867){return new Promise(function(_0x160f9a,_0x57c94f){var _0x1d919e=[];for(var _0x5a77ae in _0x2b7063[_0x6459('0x50')]){if(_0x2b7063[_0x6459('0x50')]['hasOwnProperty'](_0x5a77ae)){var _0x1d4920=_0x2b7063[_0x6459('0x50')][_0x5a77ae];var _0x598e7f={'id':_0x1d4920['id'],'available':_0x1d4920[_0x6459('0x47')],'loggedIn':_0x1d4920[_0x6459('0x48')],'name':_0x1d4920['name'],'paused':_0x1d4920['paused'],'waiting':_0x1d4920[_0x6459('0x4b')]};_0x1d919e[_0x6459('0x1f')](_0x598e7f);}}_0x160f9a({'count':_0x1d919e[_0x6459('0x17')],'rows':_0x1d919e});});},'ChatQueuesWaitingInteractions':function(_0x40b105){return new Promise(function(_0xa32560,_0x45be26){var _0x162fb8=_[_0x6459('0x45')](_0x2b7063[_0x6459('0x51')]);_0xa32560({'count':_0x162fb8[_0x6459('0x17')],'rows':_0x162fb8});});},'MailQueuesWaitingInteractions':function(_0x4ab3d7){return new Promise(function(_0xb0bb69,_0x5b866e){var _0x5d5190=_['values'](_0x2b7063[_0x6459('0x52')]);_0xb0bb69({'count':_0x5d5190[_0x6459('0x17')],'rows':_0x5d5190});});},'OpenchannelQueuesWaitingInteractions':function(_0x2565dd){return new Promise(function(_0x309671,_0x345f27){var _0x33d5b7=_['values'](_0x2b7063[_0x6459('0x53')]);_0x309671({'count':_0x33d5b7[_0x6459('0x17')],'rows':_0x33d5b7});});},'SmsQueuesWaitingInteractions':function(_0x27f3e2){return new Promise(function(_0xdb0de8,_0x25a5cc){var _0x5cbc42=_[_0x6459('0x45')](_0x2b7063[_0x6459('0x54')]);_0xdb0de8({'count':_0x5cbc42[_0x6459('0x17')],'rows':_0x5cbc42});});},'FaxQueuesWaitingInteractions':function(_0x39e9cd){return new Promise(function(_0xe927a2,_0x5a8209){var _0x2b64ae=_[_0x6459('0x45')](_0x2b7063[_0x6459('0x55')]);_0xe927a2({'count':_0x2b64ae[_0x6459('0x17')],'rows':_0x2b64ae});});},'WhatsappQueuesWaitingInteractions':function(_0x48468c){return new Promise(function(_0x59d722,_0x3c2d4d){var _0x34267e=_['values'](_0x2b7063[_0x6459('0x56')]);_0x59d722({'count':_0x34267e[_0x6459('0x17')],'rows':_0x34267e});});}};var _0x4a9041=jayson[_0x6459('0x57')](_0x41c007)[_0x6459('0x58')]();_0x4a9041['on'](_0x6459('0x32'),function(_0x2cc992){logger['error'](JSON[_0x6459('0x59')](_0x2cc992));return _0x4c3b01(_0x2cc992);});_0x4a9041[_0x6459('0x5a')](0x232c,_0x6459('0x5b'),function(){console[_0x6459('0x5c')](_0x6459('0x5d'),0x232c);return _0x410feb(_0x6459('0x5e')+0x232c);});});}; \ No newline at end of file +var _0x2f1e=['message\x20is\x20empty','stack','end','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','path','bluebird','../../../config/environment','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','channel','message','interaction','isArray','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','%s:%s:%s','./interval','condition','intervals','./applications/','priority','Push\x20new\x20rule','on\x20interval','error','rules','execute','info','stringify','matchPath','emit','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','catch','error\x20update\x20queue\x20report'];(function(_0x548200,_0x3241b8){var _0x1a6d74=function(_0x412f84){while(--_0x412f84){_0x548200['push'](_0x548200['shift']());}};_0x1a6d74(++_0x3241b8);}(_0x2f1e,0x1d3));var _0xe2f1=function(_0x58ac34,_0x5b5bfb){_0x58ac34=_0x58ac34-0x0;var _0x3921ab=_0x2f1e[_0x58ac34];return _0x3921ab;};'use strict';var _=require('lodash');var util=require('util');var path=require(_0xe2f1('0x0'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xe2f1('0x1'));var uuid=require('uuid');var config=require(_0xe2f1('0x2'));var logger=require(_0xe2f1('0x3'))(_0xe2f1('0x4'));var rpc={'openchannelQueueReport':require(_0xe2f1('0x5')),'mailQueueReport':require(_0xe2f1('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xe2f1('0x7')),'faxQueueReport':require(_0xe2f1('0x8')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x5f5ba4,_0x5e50c0,_0x3ae64a){return util[_0xe2f1('0x9')](_0xe2f1('0xa'),_0x5f5ba4,_0x5e50c0||0x0,_0x3ae64a||0x0);}function getIntervals(_0x9b766e,_0x55339b){var _0x2eed30=[];if(!_[_0xe2f1('0xb')](_0x55339b[_0xe2f1('0xc')])&&!_[_0xe2f1('0xb')](_0x9b766e[_0x55339b['IntervalId']])&&!_[_0xe2f1('0xb')](_0x9b766e[_0x55339b[_0xe2f1('0xc')]][_0xe2f1('0xd')])){_0x2eed30=_[_0xe2f1('0xe')](_0x9b766e[_0x55339b[_0xe2f1('0xc')]][_0xe2f1('0xd')],_0xe2f1('0xf'));}else if(!_['isNil'](_0x55339b[_0xe2f1('0xf')])){_0x2eed30=[_0x55339b['interval']];}return _0x2eed30;}exports['listen']=function(_0x4b45e8){_0x4b45e8['rules']={};return new BPromise(function(_0x43f6ad,_0x434a68){var _0x312be1={'Start':function(_0x1014bd){var _0x58c086=this;return new Promise(function(_0x5dd7ab,_0xe37516){if(_0x1014bd){try{var _0x207d79=[];var _0x1b3a4c=getId(_0x1014bd[_0xe2f1('0x10')],_0x1014bd['message']?_0x1014bd[_0xe2f1('0x11')]['id']:0x0,_0x1014bd[_0xe2f1('0x12')]?_0x1014bd['interaction']['id']:0x0);if(_0x1014bd['applications']&&_[_0xe2f1('0x13')](_0x1014bd[_0xe2f1('0x14')])&&_0x1014bd[_0xe2f1('0x14')]['length']){for(var _0x1e8683=0x0;_0x1e8683<_0x1014bd['applications'][_0xe2f1('0x15')];_0x1e8683+=0x1){var _0x19df9b=_0x1014bd[_0xe2f1('0x14')][_0x1e8683];if(fs[_0xe2f1('0x16')](path[_0xe2f1('0x17')](__dirname,_0xe2f1('0x14'),_0x19df9b[_0xe2f1('0x18')]+_0xe2f1('0x19')))){var _0x47ec74=[];switch(_0x19df9b['app'][_0xe2f1('0x1a')]()){case _0xe2f1('0x1b'):var _0x5314d1=_0x19df9b[_0xe2f1('0x1c')][_0xe2f1('0x1d')](',');if(_0x1014bd[_0xe2f1('0x10')]===_0xe2f1('0x1e')){_0x47ec74[_0xe2f1('0x1f')](_0x5314d1[0x0]);_0x47ec74[_0xe2f1('0x1f')](_0x5314d1[0x1]);_0x47ec74['push'](_0x5314d1[_0xe2f1('0x20')](0x2,_0x5314d1['length'])[_0xe2f1('0x17')](','));}else{_0x47ec74[_0xe2f1('0x1f')](_0x5314d1[0x0]);_0x47ec74[_0xe2f1('0x1f')](_0x5314d1[_0xe2f1('0x20')](0x1,_0x5314d1[_0xe2f1('0x15')])[_0xe2f1('0x17')](','));}break;case _0xe2f1('0x21'):var _0x2c9347=_0x19df9b['appdata']['split'](',');_0x47ec74[_0xe2f1('0x1f')](_0x2c9347[0x0]);_0x47ec74[_0xe2f1('0x1f')](_0x2c9347[0x1]);_0x47ec74[_0xe2f1('0x1f')](_0x2c9347[_0xe2f1('0x20')](0x2,_0x2c9347[_0xe2f1('0x15')])[_0xe2f1('0x17')](','));break;case _0xe2f1('0x22'):var _0x2ccf1a=_0x19df9b[_0xe2f1('0x1c')][_0xe2f1('0x1d')](',');_0x47ec74[_0xe2f1('0x1f')](_0x2ccf1a[0x0]);_0x47ec74[_0xe2f1('0x1f')](_0x2ccf1a[0x1]);_0x47ec74[_0xe2f1('0x1f')](_0x2ccf1a[0x2]);_0x47ec74['push'](_0x2ccf1a[0x3]);_0x47ec74[_0xe2f1('0x1f')](_0x2ccf1a['slice'](0x4,_0x2ccf1a[_0xe2f1('0x15')])['join'](','));break;case _0xe2f1('0x23'):var _0x9bc2c8=_0x19df9b[_0xe2f1('0x1c')]['split'](',');_0x47ec74['push'](_0x9bc2c8[0x0]);_0x47ec74[_0xe2f1('0x1f')](_0x9bc2c8[0x1]);_0x47ec74['push'](_0x9bc2c8[0x2]);_0x47ec74[_0xe2f1('0x1f')](_0x9bc2c8[0x3]);_0x47ec74[_0xe2f1('0x1f')](_0x9bc2c8[_0xe2f1('0x20')](0x4,_0x9bc2c8[_0xe2f1('0x15')])[_0xe2f1('0x17')](','));break;case _0xe2f1('0x11'):_0x47ec74[_0xe2f1('0x1f')](_0x19df9b[_0xe2f1('0x1c')]);break;case _0xe2f1('0x24'):_0x47ec74['push'](_0x19df9b['TagId']);_0x47ec74['push'](_0x19df9b['appdata']);break;default:_0x47ec74=_[_0xe2f1('0xb')](_0x19df9b[_0xe2f1('0x1c')])?[]:_0x19df9b['appdata'][_0xe2f1('0x1d')](',');}var _0x1bc97f={'id':util[_0xe2f1('0x9')](_0xe2f1('0x25'),_0x1b3a4c,_0x19df9b['id'],_0x19df9b[_0xe2f1('0x18')]),'condition':require(_0xe2f1('0x26'))[_0xe2f1('0x27')](_0x1b3a4c,getIntervals(_0x4b45e8[_0xe2f1('0x28')],_0x19df9b),_0x4b45e8),'consequence':require(_0xe2f1('0x29')+_0x19df9b[_0xe2f1('0x18')])['consequence'](_0x1b3a4c,_0x47ec74,_0x4b45e8,_0x1014bd),'p':_0x19df9b[_0xe2f1('0x2a')]||0x0};logger['info'](_0xe2f1('0x2b'),_0x1bc97f['id'],_0xe2f1('0x2c'),getIntervals(_0x4b45e8[_0xe2f1('0x28')],_0x19df9b)['join']('\x20|\x20'));_0x207d79[_0xe2f1('0x1f')](_0x1bc97f);}else{logger[_0xe2f1('0x2d')]('Please\x20create\x20a\x20new\x20file\x20under',path['join'](__dirname,_0xe2f1('0x14'),_0x19df9b[_0xe2f1('0x18')]+_0xe2f1('0x19')));}}_0x4b45e8[_0xe2f1('0x2e')][_0x1b3a4c]=new RuleEngine(_0x207d79);_0x4b45e8[_0xe2f1('0x2e')][_0x1b3a4c][_0xe2f1('0x2f')](_0x1014bd,function(_0x131a59){logger[_0xe2f1('0x30')]('Applications\x20executed',JSON[_0xe2f1('0x31')](_0x131a59[_0xe2f1('0x32')]));if(_0x4b45e8[_0xe2f1('0x2e')][_0x1b3a4c]){_0x4b45e8[_0xe2f1('0x2e')][_0x1b3a4c][_0xe2f1('0x33')]('complete');}});return _0x5dd7ab({'code':0xc8,'message':_0x1014bd});}else{logger['info']('No\x20applications\x20to\x20execute');return _0x5dd7ab({'code':0xc8,'message':_0x1014bd});}}catch(_0x596fa4){logger[_0xe2f1('0x2d')](_0x596fa4['stack']);return _0xe37516(_0x58c086['error'](0x1f4,_0x596fa4));}}return _0xe37516(_0xe2f1('0x34'));});},'AcceptMessage':function(_0x3c2190){var _0x2f15ec=this;return new Promise(function(_0x33c3d2,_0x8037f3){if(_0x3c2190['agent']&&_0x3c2190[_0xe2f1('0x35')]['id']){if(_0x4b45e8['agents'][_0x3c2190[_0xe2f1('0x35')]['id']]){_0x4b45e8[_0xe2f1('0x36')][_0x3c2190[_0xe2f1('0x35')]['id']][_0xe2f1('0x37')]=![];_0x4b45e8[_0xe2f1('0x36')][_0x3c2190[_0xe2f1('0x35')]['id']][_0xe2f1('0x38')]=undefined;}}if(_0x3c2190[_0xe2f1('0x11')]&&_0x3c2190[_0xe2f1('0x11')]['id']){try{var _0x582fd7=getId(_0x3c2190['channel'],_0x3c2190[_0xe2f1('0x11')]?_0x3c2190[_0xe2f1('0x11')]['id']:0x0,_0x3c2190[_0xe2f1('0x12')]?_0x3c2190[_0xe2f1('0x12')]['id']:0x0);if(_0x4b45e8[_0xe2f1('0x2e')][_0x582fd7]){_0x4b45e8[_0xe2f1('0x2e')][_0x582fd7][_0xe2f1('0x33')]('end');if(rpc[_0x3c2190[_0xe2f1('0x10')]+'QueueReport']){rpc[_0x3c2190[_0xe2f1('0x10')]+_0xe2f1('0x39')][_0xe2f1('0x3a')](_0x582fd7,{'UserId':_0x3c2190[_0xe2f1('0x11')]['UserId']})[_0xe2f1('0x3b')](function(_0x35cbe1){logger[_0xe2f1('0x2d')](_0xe2f1('0x3c'));});}}return _0x33c3d2({'code':0xc8,'message':_0x3c2190});}catch(_0x4b6246){logger[_0xe2f1('0x2d')](_0x4b6246['stack']);return _0x8037f3(_0x2f15ec[_0xe2f1('0x2d')](0x1f4,_0x4b6246));}}logger[_0xe2f1('0x2d')](_0xe2f1('0x3d'));return _0x8037f3(_0x2f15ec[_0xe2f1('0x2d')](0x1f4,_0xe2f1('0x3d')));});},'RejectMessage':function(_0x3079ba){var _0x35c55a=this;return new Promise(function(_0x3f86f5,_0x44a1bc){if(_0x3079ba['agent']&&_0x3079ba[_0xe2f1('0x35')]['id']){try{if(_0x4b45e8['agents'][_0x3079ba[_0xe2f1('0x35')]['id']]){_0x4b45e8['agents'][_0x3079ba[_0xe2f1('0x35')]['id']][_0xe2f1('0x37')]=![];_0x4b45e8[_0xe2f1('0x36')][_0x3079ba[_0xe2f1('0x35')]['id']][_0xe2f1('0x38')]=undefined;}return _0x3f86f5({'code':0xc8,'message':_0x3079ba});}catch(_0x40d853){logger[_0xe2f1('0x2d')](_0x40d853[_0xe2f1('0x3e')]);return _0x44a1bc(_0x35c55a[_0xe2f1('0x2d')](0x1f4,_0x40d853));}}logger['error'](_0xe2f1('0x3d'));return _0x44a1bc(_0x35c55a['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x4063b3){var _0x6e5c0e=this;return new Promise(function(_0x3bb6cf,_0x4b8f37){if(_0x4063b3['channel']&&_0x4063b3[_0xe2f1('0x12')]&&_0x4063b3['interaction']['id']){try{var _0x106327=getId(_0x4063b3[_0xe2f1('0x10')],_0x4063b3[_0xe2f1('0x11')]?_0x4063b3[_0xe2f1('0x11')]['id']:0x0,_0x4063b3[_0xe2f1('0x12')]?_0x4063b3[_0xe2f1('0x12')]['id']:0x0);if(_0x4b45e8[_0xe2f1('0x2e')][_0x106327]){_0x4b45e8[_0xe2f1('0x2e')][_0x106327][_0xe2f1('0x33')](_0xe2f1('0x3f'));}return _0x3bb6cf({'code':0xc8,'message':_0x4063b3});}catch(_0x46495e){logger[_0xe2f1('0x2d')](_0x46495e[_0xe2f1('0x3e')]);return _0x4b8f37(_0x6e5c0e[_0xe2f1('0x2d')](0x1f4,_0x46495e));}}logger[_0xe2f1('0x2d')](_0xe2f1('0x3d'));return _0x4b8f37(_0x6e5c0e['error'](0x1f4,_0xe2f1('0x3d')));});},'AgentCapacity':function(_0x164bcf){var _0x3439ea=this;return new Promise(function(_0x59876d,_0x1b6e64){if(_0x4b45e8[_0xe2f1('0x36')][_0xe2f1('0x40')](_0x164bcf['id'])){for(var _0x4e8c85 in _0x164bcf[_0xe2f1('0x41')]){if(_0x164bcf[_0xe2f1('0x41')][_0xe2f1('0x40')](_0x4e8c85)){if(_0x4b45e8['agents'][_0x164bcf['id']][_0xe2f1('0x40')](_0x4e8c85+_0xe2f1('0x42'))){_0x4b45e8['agents'][_0x164bcf['id']][_0x4e8c85+_0xe2f1('0x42')]=parseInt(_0x164bcf[_0xe2f1('0x41')][_0x4e8c85],0xa);}}}_0x4b45e8['agents'][_0x164bcf['id']]['updateRealtime']();return _0x59876d({'code':0xc8,'message':_0x4b45e8['agents'][_0x164bcf['id']]});}else{return _0x1b6e64(_0x3439ea[_0xe2f1('0x2d')](0x1f4,_0xe2f1('0x43')));}});},'Agents':function(_0x595c69){return new Promise(function(_0x44f156,_0x30f286){var _0x1d5c6d=_[_0xe2f1('0x44')](_0x4b45e8[_0xe2f1('0x36')]);_0x44f156({'count':_0x1d5c6d[_0xe2f1('0x15')],'rows':_0x1d5c6d});});},'ChatQueues':function(_0x549ceb){return new Promise(function(_0x24c32f,_0x510060){var _0x5a7c53=[];for(var _0x1dd9dc in _0x4b45e8[_0xe2f1('0x45')]){if(_0x4b45e8[_0xe2f1('0x45')][_0xe2f1('0x40')](_0x1dd9dc)){var _0x219942=_0x4b45e8[_0xe2f1('0x45')][_0x1dd9dc];var _0x4beebc={'id':_0x219942['id'],'available':_0x219942[_0xe2f1('0x46')],'loggedIn':_0x219942[_0xe2f1('0x47')],'name':_0x219942[_0xe2f1('0x48')],'paused':_0x219942[_0xe2f1('0x49')],'waiting':_0x219942[_0xe2f1('0x4a')]};_0x5a7c53[_0xe2f1('0x1f')](_0x4beebc);}}_0x24c32f({'count':_0x5a7c53[_0xe2f1('0x15')],'rows':_0x5a7c53});});},'MailQueues':function(_0x38d8b1){return new Promise(function(_0x41ce78,_0x5015f9){var _0x95f088=[];for(var _0x4177a8 in _0x4b45e8[_0xe2f1('0x4b')]){if(_0x4b45e8['mailQueues'][_0xe2f1('0x40')](_0x4177a8)){var _0xa2ea5b=_0x4b45e8[_0xe2f1('0x4b')][_0x4177a8];var _0x4a7ff4={'id':_0xa2ea5b['id'],'available':_0xa2ea5b['available'],'loggedIn':_0xa2ea5b[_0xe2f1('0x47')],'name':_0xa2ea5b[_0xe2f1('0x48')],'paused':_0xa2ea5b[_0xe2f1('0x49')],'waiting':_0xa2ea5b[_0xe2f1('0x4a')]};_0x95f088['push'](_0x4a7ff4);}}_0x41ce78({'count':_0x95f088['length'],'rows':_0x95f088});});},'OpenchannelQueues':function(_0x5b60cc){return new Promise(function(_0x150f56,_0x415315){var _0x471144=[];for(var _0x210907 in _0x4b45e8[_0xe2f1('0x4c')]){if(_0x4b45e8[_0xe2f1('0x4c')][_0xe2f1('0x40')](_0x210907)){var _0x279c57=_0x4b45e8[_0xe2f1('0x4c')][_0x210907];var _0x566b4d={'id':_0x279c57['id'],'available':_0x279c57[_0xe2f1('0x46')],'loggedIn':_0x279c57['loggedIn'],'name':_0x279c57[_0xe2f1('0x48')],'paused':_0x279c57[_0xe2f1('0x49')],'waiting':_0x279c57[_0xe2f1('0x4a')]};_0x471144['push'](_0x566b4d);}}_0x150f56({'count':_0x471144[_0xe2f1('0x15')],'rows':_0x471144});});},'SmsQueues':function(_0x4835fe){return new Promise(function(_0x14d16b,_0x1f4a6b){var _0x5e39f8=[];for(var _0x2b54ee in _0x4b45e8['smsQueues']){if(_0x4b45e8['smsQueues'][_0xe2f1('0x40')](_0x2b54ee)){var _0x26dea7=_0x4b45e8['smsQueues'][_0x2b54ee];var _0x5e909e={'id':_0x26dea7['id'],'available':_0x26dea7[_0xe2f1('0x46')],'loggedIn':_0x26dea7[_0xe2f1('0x47')],'name':_0x26dea7[_0xe2f1('0x48')],'paused':_0x26dea7[_0xe2f1('0x49')],'waiting':_0x26dea7[_0xe2f1('0x4a')]};_0x5e39f8[_0xe2f1('0x1f')](_0x5e909e);}}_0x14d16b({'count':_0x5e39f8[_0xe2f1('0x15')],'rows':_0x5e39f8});});},'FaxQueues':function(_0x421e30){return new Promise(function(_0x420abc,_0xee119f){var _0x35f4ed=[];for(var _0x4b423b in _0x4b45e8[_0xe2f1('0x4d')]){if(_0x4b45e8[_0xe2f1('0x4d')][_0xe2f1('0x40')](_0x4b423b)){var _0x397ba2=_0x4b45e8['faxQueues'][_0x4b423b];var _0x117c64={'id':_0x397ba2['id'],'available':_0x397ba2[_0xe2f1('0x46')],'loggedIn':_0x397ba2[_0xe2f1('0x47')],'name':_0x397ba2[_0xe2f1('0x48')],'paused':_0x397ba2[_0xe2f1('0x49')],'waiting':_0x397ba2[_0xe2f1('0x4a')]};_0x35f4ed['push'](_0x117c64);}}_0x420abc({'count':_0x35f4ed['length'],'rows':_0x35f4ed});});},'WhatsappQueues':function(_0x3138a2){return new Promise(function(_0x2f03a5,_0xb226d9){var _0x4792f9=[];for(var _0x3d1591 in _0x4b45e8[_0xe2f1('0x4e')]){if(_0x4b45e8['whatsappQueues']['hasOwnProperty'](_0x3d1591)){var _0x20d234=_0x4b45e8[_0xe2f1('0x4e')][_0x3d1591];var _0x3443f4={'id':_0x20d234['id'],'available':_0x20d234['available'],'loggedIn':_0x20d234[_0xe2f1('0x47')],'name':_0x20d234[_0xe2f1('0x48')],'paused':_0x20d234[_0xe2f1('0x49')],'waiting':_0x20d234[_0xe2f1('0x4a')]};_0x4792f9['push'](_0x3443f4);}}_0x2f03a5({'count':_0x4792f9['length'],'rows':_0x4792f9});});},'ChatQueuesWaitingInteractions':function(_0x23ec61){return new Promise(function(_0x592d42,_0x1e7989){var _0x5be3b5=_['values'](_0x4b45e8[_0xe2f1('0x4f')]);_0x592d42({'count':_0x5be3b5['length'],'rows':_0x5be3b5});});},'MailQueuesWaitingInteractions':function(_0x5c01a6){return new Promise(function(_0x31d10a,_0x2f8f4d){var _0x3a653c=_[_0xe2f1('0x44')](_0x4b45e8[_0xe2f1('0x50')]);_0x31d10a({'count':_0x3a653c[_0xe2f1('0x15')],'rows':_0x3a653c});});},'OpenchannelQueuesWaitingInteractions':function(_0x55046a){return new Promise(function(_0x7036e0,_0xcc8442){var _0x1456d5=_[_0xe2f1('0x44')](_0x4b45e8[_0xe2f1('0x51')]);_0x7036e0({'count':_0x1456d5[_0xe2f1('0x15')],'rows':_0x1456d5});});},'SmsQueuesWaitingInteractions':function(_0x46fa12){return new Promise(function(_0x450af2,_0x5e9ac2){var _0x16ddcd=_['values'](_0x4b45e8[_0xe2f1('0x52')]);_0x450af2({'count':_0x16ddcd['length'],'rows':_0x16ddcd});});},'FaxQueuesWaitingInteractions':function(_0xbc8a61){return new Promise(function(_0x57feb8,_0xda61da){var _0x69490=_['values'](_0x4b45e8['faxQueuesWaitingInteractions']);_0x57feb8({'count':_0x69490[_0xe2f1('0x15')],'rows':_0x69490});});},'WhatsappQueuesWaitingInteractions':function(_0x2fb085){return new Promise(function(_0x518412,_0x94733){var _0x38ea68=_[_0xe2f1('0x44')](_0x4b45e8[_0xe2f1('0x53')]);_0x518412({'count':_0x38ea68[_0xe2f1('0x15')],'rows':_0x38ea68});});}};var _0x5ddeb0=jayson[_0xe2f1('0x54')](_0x312be1)['http']();_0x5ddeb0['on'](_0xe2f1('0x2d'),function(_0x2e8cc8){logger['error'](JSON[_0xe2f1('0x31')](_0x2e8cc8));return _0x434a68(_0x2e8cc8);});_0x5ddeb0['listen'](0x232c,_0xe2f1('0x55'),function(){console[_0xe2f1('0x56')](_0xe2f1('0x57'),0x232c);return _0x43f6ad('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 c5250b5..83bbb9c 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 _0x1668=['jayson/promise','../../../config/logger','client','http','error','result','condition','rules','info','stop','length','push','Command','format','then','message','[%s][INTERVAL]\x20%s','all','some','join','when','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','stack','util','bluebird'];(function(_0x556234,_0x50c8bc){var _0x50b777=function(_0x5b8fe3){while(--_0x5b8fe3){_0x556234['push'](_0x556234['shift']());}};_0x50b777(++_0x50c8bc);}(_0x1668,0x1ec));var _0x8166=function(_0x4c1717,_0x5c9f18){_0x4c1717=_0x4c1717-0x0;var _0x40df82=_0x1668[_0x4c1717];return _0x40df82;};'use strict';var util=require(_0x8166('0x0'));var BPromise=require(_0x8166('0x1'));var jayson=require(_0x8166('0x2'));var _=require('lodash');var logger=require(_0x8166('0x3'))('routing');var client=jayson[_0x8166('0x4')][_0x8166('0x5')]({'port':0x232a});function request(_0x2e31ab,_0x5c313b){return new BPromise(function(_0x48cbc3,_0x6f6c11){return client['request'](_0x2e31ab,_0x5c313b)['then'](function(_0x548ce1){if(_0x548ce1['error']){return _0x6f6c11(_0x548ce1[_0x8166('0x6')]['message']);}else{return _0x48cbc3(_0x548ce1[_0x8166('0x7')]);}})['catch'](function(_0x1010da){return _0x6f6c11(_0x1010da);});});}exports[_0x8166('0x8')]=function(_0x70946b,_0x52c049,_0x3ff514){return function(_0x117bcd){if(_0x3ff514[_0x8166('0x9')]&&!_0x3ff514['rules'][_0x70946b]){logger[_0x8166('0xa')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x70946b);return _0x117bcd[_0x8166('0xb')]();}var _0x162178=[];for(var _0xde89a2=0x0;_0xde89a2<_0x52c049[_0x8166('0xc')];_0xde89a2+=0x1){_0x162178[_0x8166('0xd')](request(_0x8166('0xe'),{'command':util[_0x8166('0xf')]('iftime\x20%s',_0x52c049[_0xde89a2])})[_0x8166('0x10')](function(_0x4f3142){return _0x4f3142&&_0x4f3142['message']&&_0x4f3142[_0x8166('0x11')]['indexOf']('true')>=0x0?!![]:![];})['catch'](function(_0x410ed){logger[_0x8166('0x6')](_0x8166('0x12'),_0x70946b,_0x52c049[_0xde89a2]);}));}BPromise[_0x8166('0x13')](_0x162178)[_0x8166('0x10')](function(_0x4680fa){var _0x5e642d=_[_0x8166('0x14')](_0x4680fa);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x70946b,_0x52c049[_0x8166('0x15')]('\x20|\x20'),_0x5e642d);_0x117bcd[_0x8166('0x16')](_0x5e642d);})['catch'](function(_0x171ef8){console['log'](_0x171ef8);logger['error'](_0x8166('0x17'),_0x70946b,_0x52c049[_0x8166('0x15')](_0x8166('0x18')),_0x171ef8[_0x8166('0x19')]);_0x117bcd[_0x8166('0xb')]();});};}; \ No newline at end of file +var _0x33eb=['request','then','error','result','condition','rules','info','length','format','message','indexOf','true','catch','all','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','join','stop','util','bluebird','jayson/promise','lodash','../../../config/logger','client','http'];(function(_0x4d5f49,_0x34ec42){var _0x213dbb=function(_0x29b439){while(--_0x29b439){_0x4d5f49['push'](_0x4d5f49['shift']());}};_0x213dbb(++_0x34ec42);}(_0x33eb,0x1c4));var _0xb33e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x33eb[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xb33e('0x0'));var BPromise=require(_0xb33e('0x1'));var jayson=require(_0xb33e('0x2'));var _=require(_0xb33e('0x3'));var logger=require(_0xb33e('0x4'))('routing');var client=jayson[_0xb33e('0x5')][_0xb33e('0x6')]({'port':0x232a});function request(_0x275946,_0x5e7c1e){return new BPromise(function(_0x1195ee,_0x39fc41){return client[_0xb33e('0x7')](_0x275946,_0x5e7c1e)[_0xb33e('0x8')](function(_0x21fdf2){if(_0x21fdf2[_0xb33e('0x9')]){return _0x39fc41(_0x21fdf2[_0xb33e('0x9')]['message']);}else{return _0x1195ee(_0x21fdf2[_0xb33e('0xa')]);}})['catch'](function(_0x201055){return _0x39fc41(_0x201055);});});}exports[_0xb33e('0xb')]=function(_0xd196b6,_0xbb9aa4,_0x51ecb3){return function(_0x28a6ff){if(_0x51ecb3['rules']&&!_0x51ecb3[_0xb33e('0xc')][_0xd196b6]){logger[_0xb33e('0xd')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0xd196b6);return _0x28a6ff['stop']();}var _0x3b4d75=[];for(var _0x5229a9=0x0;_0x5229a9<_0xbb9aa4[_0xb33e('0xe')];_0x5229a9+=0x1){_0x3b4d75['push'](request('Command',{'command':util[_0xb33e('0xf')]('iftime\x20%s',_0xbb9aa4[_0x5229a9])})['then'](function(_0x898d34){return _0x898d34&&_0x898d34[_0xb33e('0x10')]&&_0x898d34['message'][_0xb33e('0x11')](_0xb33e('0x12'))>=0x0?!![]:![];})[_0xb33e('0x13')](function(_0x5ad925){logger[_0xb33e('0x9')]('[%s][INTERVAL]\x20%s',_0xd196b6,_0xbb9aa4[_0x5229a9]);}));}BPromise[_0xb33e('0x14')](_0x3b4d75)[_0xb33e('0x8')](function(_0x4d80a9){var _0x4da351=_['some'](_0x4d80a9);logger[_0xb33e('0xd')]('[%s][INTERVAL]\x20%s\x20%s',_0xd196b6,_0xbb9aa4['join'](_0xb33e('0x15')),_0x4da351);_0x28a6ff[_0xb33e('0x16')](_0x4da351);})[_0xb33e('0x13')](function(_0x4b1dca){console[_0xb33e('0x17')](_0x4b1dca);logger['error'](_0xb33e('0x18'),_0xd196b6,_0xbb9aa4[_0xb33e('0x19')]('\x20|\x20'),_0x4b1dca['stack']);_0x28a6ff[_0xb33e('0x1a')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e585958..8def54e 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 _0x0fd9=['agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','format','agentcalledAt','now','connectedlinenum','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','forIn','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','abandoned','reason','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','agentcompleteAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','transfer','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','calleridnum','hangup','cause','rejected','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','util','./utils','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','then','type'];(function(_0x54bae9,_0x5d8f10){var _0x513c68=function(_0x2ce354){while(--_0x2ce354){_0x54bae9['push'](_0x54bae9['shift']());}};_0x513c68(++_0x5d8f10);}(_0x0fd9,0xa3));var _0x90fd=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x0fd9[_0x5cb1af];return _0x8d7940;};'use strict';var _=require('lodash');var util=require(_0x90fd('0x0'));var utils=require(_0x90fd('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x685cd0,_0x32f6b6){utils['info'](util['format'](_0x90fd('0x2'),_0x685cd0[_0x90fd('0x3')],_0x685cd0[_0x90fd('0x4')],_0x685cd0[_0x90fd('0x5')],_0x685cd0[_0x90fd('0x6')],_0x685cd0[_0x90fd('0x7')],_0x685cd0['calleridnum'],_0x685cd0['connectedlinenum'],_0x685cd0[_0x90fd('0x8')]));if(_0x685cd0['queue']){utils['getVoiceQueueByName'](_0x685cd0[_0x90fd('0x5')])[_0x90fd('0x9')](function(_0x5e66f0){if(_0x5e66f0){_0x685cd0[_0x90fd('0xa')]=_0x5e66f0[_0x90fd('0xa')];_0x685cd0[_0x90fd('0xb')]=_0x685cd0[_0x90fd('0xc')]?_0x5e66f0[_0x90fd('0xd')]:![];_0x685cd0[_0x90fd('0xe')]=_0x685cd0[_0x90fd('0xb')]?_0x5e66f0[_0x90fd('0xf')]:0x0;}utils[_0x90fd('0x10')]('CreateVoiceAgentReport',_0x685cd0);});}else{utils[_0x90fd('0x10')](_0x90fd('0x11'),_0x685cd0);}if(_0x32f6b6){delete transfers[_0x685cd0['uniqueid']];}else{delete agents[_0x685cd0[_0x90fd('0x12')]];}}exports[_0x90fd('0x13')]=function(_0x19a594){try{utils['debug'](util[_0x90fd('0x14')]('[%s][agents][agentcalled]',_0x19a594[_0x90fd('0x3')]),_0x19a594);agents[_0x19a594[_0x90fd('0x12')]]=_0x19a594;agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x8')]='called';agents[_0x19a594['destuniqueid']][_0x90fd('0x17')]=null;agents[_0x19a594[_0x90fd('0x12')]]['connectedlinename']=null;utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x19'),_0x19a594['uniqueid'],agents[_0x19a594[_0x90fd('0x12')]][_0x90fd('0x6')],_0x19a594[_0x90fd('0x12')]));}catch(_0x14958b){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x1b'),_0x19a594[_0x90fd('0x3')]),_0x14958b);}};exports[_0x90fd('0x1c')]=function(_0x90197e){try{if(!_[_0x90fd('0x1d')](agents[_0x90197e[_0x90fd('0x12')]])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x1f'),_0x90197e['uniqueid']),_0x90197e);utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x20'),_0x90197e[_0x90fd('0x3')],agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x6')],_0x90197e[_0x90fd('0x12')]));agents[_0x90197e[_0x90fd('0x12')]]['agentringnoanswer']=!![];agents[_0x90197e[_0x90fd('0x12')]]['agentringnoanswerAt']=utils[_0x90fd('0x16')]();agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x8')]=_0x90fd('0x21');agents[_0x90197e[_0x90fd('0x12')]]['reason']=_0x90fd('0x21');agents[_0x90197e[_0x90fd('0x12')]][_0x90fd('0x22')]=_0x90197e[_0x90fd('0x23')]?parseInt(_0x90197e[_0x90fd('0x23')])/0x3e8:0x0;agents[_0x90197e[_0x90fd('0x12')]]['talktime']=0x0;unanswered['push'](_0x90197e[_0x90fd('0x12')]);}}catch(_0x170cfb){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x1f'),_0x90197e['uniqueid']),_0x170cfb);}};exports['queuecallerabandon']=function(_0x3781bb){try{_[_0x90fd('0x24')](agents,function(_0x228fbc,_0x3a0102){if(_0x228fbc['uniqueid']==_0x3781bb['uniqueid']&&!_[_0x90fd('0x25')](unanswered,_0x228fbc[_0x90fd('0x12')])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')]('[%s][agents][queuecallerabandon]',_0x3781bb[_0x90fd('0x3')]),_0x3781bb);utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x26'),_0x3781bb[_0x90fd('0x3')],_0x228fbc[_0x90fd('0x6')],_0x228fbc[_0x90fd('0x12')]));_0x228fbc[_0x90fd('0x1c')]=!![];_0x228fbc[_0x90fd('0x27')]=utils[_0x90fd('0x16')]();_0x228fbc[_0x90fd('0x8')]=_0x90fd('0x28');_0x228fbc[_0x90fd('0x29')]=_0x90fd('0x28');_0x228fbc[_0x90fd('0x22')]=_0x3781bb[_0x90fd('0x22')];_0x228fbc['talktime']=0x0;writeDB(_0x228fbc);}});}catch(_0x13c019){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x2a'),_0x3781bb[_0x90fd('0x3')]),_0x13c019);}};exports[_0x90fd('0x2b')]=function(_0x35eae2){try{if(agents[_0x35eae2[_0x90fd('0x12')]]){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x2c'),_0x35eae2[_0x90fd('0x3')]),_0x35eae2);utils[_0x90fd('0x18')](util['format'](_0x90fd('0x2d'),_0x35eae2[_0x90fd('0x3')],agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x6')],_0x35eae2['destuniqueid']));agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x2e')]=utils[_0x90fd('0x16')]();agents[_0x35eae2['destuniqueid']]['connectedlinenum']=_0x35eae2[_0x90fd('0x17')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x2f')]=_0x35eae2[_0x90fd('0x2f')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x22')]=_0x35eae2[_0x90fd('0x23')];agents[_0x35eae2[_0x90fd('0x12')]][_0x90fd('0x8')]=_0x90fd('0x30');_[_0x90fd('0x24')](agents,function(_0x43c84c,_0x21dc9c){if(_0x43c84c[_0x90fd('0x12')]!=_0x35eae2[_0x90fd('0x12')]&&_0x43c84c[_0x90fd('0x3')]==_0x35eae2[_0x90fd('0x3')]){_0x43c84c[_0x90fd('0x31')]=0x0;_0x43c84c['holdtime']=_0x35eae2[_0x90fd('0x23')];_0x43c84c[_0x90fd('0x1c')]=!![];_0x43c84c[_0x90fd('0x27')]=utils['now']();_0x43c84c['lastevent']='answered_elsewhere';_0x43c84c[_0x90fd('0x29')]=_0x90fd('0x32');_0x43c84c[_0x90fd('0x33')]=_0x35eae2[_0x90fd('0x12')];_0x43c84c[_0x90fd('0x34')]=_0x35eae2[_0x90fd('0x6')];writeDB(_0x43c84c);}});}}catch(_0x363365){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x2c'),_0x35eae2[_0x90fd('0x3')]),_0x363365);}};exports[_0x90fd('0xc')]=function(_0x4cb682){try{if(!_[_0x90fd('0x1d')](agents[_0x4cb682[_0x90fd('0x12')]])){utils['debug'](util['format'](_0x90fd('0x35'),_0x4cb682[_0x90fd('0x3')]),_0x4cb682);utils[_0x90fd('0x18')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4cb682[_0x90fd('0x3')],agents[_0x4cb682[_0x90fd('0x12')]]['membername'],_0x4cb682['destuniqueid']));agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0xc')]=!![];agents[_0x4cb682['destuniqueid']]['agentcompleteAt']=utils[_0x90fd('0x16')]();agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0x31')]=utils['diffTime'](agents[_0x4cb682[_0x90fd('0x12')]][_0x90fd('0x36')],agents[_0x4cb682['destuniqueid']]['agentconnectAt']);agents[_0x4cb682['destuniqueid']][_0x90fd('0x29')]=_0x4cb682[_0x90fd('0x29')];agents[_0x4cb682['destuniqueid']][_0x90fd('0x8')]=_0x90fd('0x37');writeDB(agents[_0x4cb682[_0x90fd('0x12')]]);}}catch(_0xe5e47e){utils[_0x90fd('0x1a')](util['format']('[%s][agents][agentcomplete]',_0x4cb682[_0x90fd('0x3')]),_0xe5e47e);}};exports[_0x90fd('0x38')]=function(_0x125874){try{if(!_[_0x90fd('0x1d')](agents[_0x125874[_0x90fd('0x39')]])){utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x3a'),_0x125874[_0x90fd('0x3')]),_0x125874);utils[_0x90fd('0x18')](util['format'](_0x90fd('0x3b'),_0x125874[_0x90fd('0x3')],agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x6')],agents[_0x125874['transfereruniqueid']]['uniqueid']));agents[_0x125874[_0x90fd('0x39')]]['transfer']=!![];agents[_0x125874['transfereruniqueid']][_0x90fd('0x3c')]=_0x90fd('0x3d');agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x3e')]=_0x125874[_0x90fd('0x3f')];agents[_0x125874[_0x90fd('0x39')]][_0x90fd('0x40')]=agents[_0x125874['transfereruniqueid']]['uniqueid'];}}catch(_0x1b81dc){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')]('[%s][agents][blindtransfer]',_0x125874[_0x90fd('0x3')]),_0x1b81dc);}};exports[_0x90fd('0x41')]=function(_0x223554){try{utils[_0x90fd('0x1e')](util[_0x90fd('0x14')](_0x90fd('0x42'),_0x223554[_0x90fd('0x43')]),_0x223554);if(_0x223554[_0x90fd('0x43')]==_0x223554['origtransfererlinkedid']){if(!_['isNil'](agents[_0x223554[_0x90fd('0x44')]])){utils[_0x90fd('0x18')](util[_0x90fd('0x14')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x223554[_0x90fd('0x43')],agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x6')]));agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x45')]=!![];agents[_0x223554[_0x90fd('0x44')]]['transfertype']=_0x90fd('0x46');agents[_0x223554['secondtransfereruniqueid']][_0x90fd('0x3e')]=_0x223554['origtransfererexten'];agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x40')]=_0x223554[_0x90fd('0x43')];}if(_0x223554[_0x90fd('0x47')]&&agents[_0x223554['transfereeuniqueid']]){agents[_0x223554[_0x90fd('0x47')]][_0x90fd('0x48')]=0x1;transfers[_0x223554[_0x90fd('0x47')]]=_[_0x90fd('0x49')](agents[_0x223554[_0x90fd('0x47')]]);transfers[_0x223554[_0x90fd('0x47')]]['calleridnum']=agents[_0x223554['secondtransfereruniqueid']]['calleridnum'];transfers[_0x223554['transfereeuniqueid']]['calleridname']=agents[_0x223554[_0x90fd('0x44')]][_0x90fd('0x4a')];transfers[_0x223554[_0x90fd('0x47')]][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();transfers[_0x223554['transfereeuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x223554[_0x90fd('0x47')]][_0x90fd('0x22')]=0x0;transfers[_0x223554['transfereeuniqueid']][_0x90fd('0x48')]=0x2;}}else if(_0x223554[_0x90fd('0x44')]==_0x223554[_0x90fd('0x4b')]){if(!_[_0x90fd('0x1d')](agents[_0x223554[_0x90fd('0x43')]])){utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x4c'),_0x223554[_0x90fd('0x43')],agents[_0x223554['origtransfereruniqueid']][_0x90fd('0x6')]));agents[_0x223554[_0x90fd('0x43')]][_0x90fd('0x45')]=!![];agents[_0x223554['origtransfereruniqueid']]['transfertype']=_0x90fd('0x46');agents[_0x223554[_0x90fd('0x43')]]['transferexten']=_0x223554[_0x90fd('0x4d')];agents[_0x223554['origtransfereruniqueid']]['transferuniqueid']=_0x223554[_0x90fd('0x44')];}if(_0x223554[_0x90fd('0x4e')]&&agents[_0x223554[_0x90fd('0x4e')]]){agents[_0x223554[_0x90fd('0x4e')]][_0x90fd('0x48')]=0x1;transfers[_0x223554[_0x90fd('0x4e')]]=_[_0x90fd('0x49')](agents[_0x223554[_0x90fd('0x4e')]]);transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x4f')]=agents[_0x223554[_0x90fd('0x43')]][_0x90fd('0x4f')];transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x4a')]=agents[_0x223554[_0x90fd('0x43')]]['calleridname'];transfers[_0x223554['transfertargetuniqueid']][_0x90fd('0x15')]=utils[_0x90fd('0x16')]();transfers[_0x223554[_0x90fd('0x4e')]]['agentconnectAt']=utils[_0x90fd('0x16')]();transfers[_0x223554['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x223554[_0x90fd('0x4e')]]['agententerreason']=0x2;}}}catch(_0x27a080){utils[_0x90fd('0x1a')](util['format'](_0x90fd('0x42'),_0x223554[_0x90fd('0x43')]),_0x27a080);}};exports[_0x90fd('0x50')]=function(_0x454201){try{utils[_0x90fd('0x1e')](util[_0x90fd('0x14')]('[%s][agents][hangup]',_0x454201['uniqueid']),_0x454201);if(agents[_0x454201['uniqueid']]&&agents[_0x454201['uniqueid']][_0x90fd('0x29')]===_0x90fd('0x21')){if(_0x454201[_0x90fd('0x51')]==='21'){agents[_0x454201['uniqueid']][_0x90fd('0x29')]=_0x90fd('0x52');agents[_0x454201['uniqueid']][_0x90fd('0x8')]=_0x90fd('0x52');}utils[_0x90fd('0x18')](util[_0x90fd('0x14')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x454201[_0x90fd('0x3')],agents[_0x454201[_0x90fd('0x3')]]['membername'],agents[_0x454201['uniqueid']]['reason'],agents[_0x454201[_0x90fd('0x3')]]['lastevent']));writeDB(agents[_0x454201['uniqueid']]);var _0x328bda=unanswered['indexOf'](_0x454201[_0x90fd('0x3')]);if(_0x328bda>-0x1){unanswered[_0x90fd('0x53')](_0x328bda,0x1);}}if(transfers[_0x454201[_0x90fd('0x3')]]){transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0xc')]=!![];transfers[_0x454201[_0x90fd('0x3')]]['agentcompleteAt']=utils[_0x90fd('0x16')]();transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x31')]=utils['diffTime'](transfers[_0x454201['uniqueid']][_0x90fd('0x36')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]);transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')]=_0x90fd('0x54');transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]=_0x90fd('0x37');utils[_0x90fd('0x18')](util[_0x90fd('0x14')](_0x90fd('0x55'),_0x454201[_0x90fd('0x3')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x6')],transfers[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')],transfers[_0x454201['uniqueid']][_0x90fd('0x8')]));writeDB(transfers[_0x454201[_0x90fd('0x3')]],!![]);}if(agents[_0x454201[_0x90fd('0x3')]]&&agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]){agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0xc')]=!![];agents[_0x454201['uniqueid']][_0x90fd('0x36')]=utils[_0x90fd('0x16')]();agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x31')]=utils['diffTime'](agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x36')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x2e')]);agents[_0x454201[_0x90fd('0x3')]]['reason']=agents[_0x454201['uniqueid']][_0x90fd('0x45')]?_0x90fd('0x45'):_0x90fd('0x54');agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]=_0x90fd('0x37');utils['info'](util[_0x90fd('0x14')](_0x90fd('0x55'),_0x454201[_0x90fd('0x3')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x6')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x29')],agents[_0x454201[_0x90fd('0x3')]][_0x90fd('0x8')]));writeDB(agents[_0x454201['uniqueid']]);}}catch(_0x1adcc2){utils[_0x90fd('0x1a')](util[_0x90fd('0x14')](_0x90fd('0x56'),_0x454201[_0x90fd('0x3')]),_0x1adcc2);}}; \ No newline at end of file +var _0x3f8c=['[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','[%s][agents][hangup]','./utils','info','membername','interface','calleridnum','connectedlinenum','lastevent','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','debug','format','[%s][agents][agentcalled]','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','isNil','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','clone','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','rejected','indexOf','splice','agent'];(function(_0xe7e7a4,_0x9c6a00){var _0x41e34c=function(_0x53e714){while(--_0x53e714){_0xe7e7a4['push'](_0xe7e7a4['shift']());}};_0x41e34c(++_0x9c6a00);}(_0x3f8c,0x104));var _0xc3f8=function(_0xf3f6e0,_0xefb9cf){_0xf3f6e0=_0xf3f6e0-0x0;var _0x168236=_0x3f8c[_0xf3f6e0];return _0x168236;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc3f8('0x0'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x3a1f6a,_0x2e70c4){utils[_0xc3f8('0x1')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x3a1f6a['uniqueid'],_0x3a1f6a['channel'],_0x3a1f6a['queue'],_0x3a1f6a[_0xc3f8('0x2')],_0x3a1f6a[_0xc3f8('0x3')],_0x3a1f6a[_0xc3f8('0x4')],_0x3a1f6a[_0xc3f8('0x5')],_0x3a1f6a[_0xc3f8('0x6')]));if(_0x3a1f6a[_0xc3f8('0x7')]){utils['getVoiceQueueByName'](_0x3a1f6a[_0xc3f8('0x7')])[_0xc3f8('0x8')](function(_0x15cb3b){if(_0x15cb3b){_0x3a1f6a[_0xc3f8('0x9')]=_0x15cb3b[_0xc3f8('0x9')];_0x3a1f6a[_0xc3f8('0xa')]=_0x3a1f6a[_0xc3f8('0xb')]?_0x15cb3b['acw']:![];_0x3a1f6a[_0xc3f8('0xc')]=_0x3a1f6a[_0xc3f8('0xa')]?_0x15cb3b[_0xc3f8('0xd')]:0x0;}utils[_0xc3f8('0xe')]('CreateVoiceAgentReport',_0x3a1f6a);});}else{utils[_0xc3f8('0xe')](_0xc3f8('0xf'),_0x3a1f6a);}if(_0x2e70c4){delete transfers[_0x3a1f6a[_0xc3f8('0x10')]];}else{delete agents[_0x3a1f6a[_0xc3f8('0x11')]];}}exports['agentcalled']=function(_0x84f489){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x14'),_0x84f489[_0xc3f8('0x10')]),_0x84f489);agents[_0x84f489[_0xc3f8('0x11')]]=_0x84f489;agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();agents[_0x84f489[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x17');agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinenum']=null;agents[_0x84f489[_0xc3f8('0x11')]]['connectedlinename']=null;utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x18'),_0x84f489[_0xc3f8('0x10')],agents[_0x84f489[_0xc3f8('0x11')]]['membername'],_0x84f489[_0xc3f8('0x11')]));}catch(_0x1db809){utils['error'](util[_0xc3f8('0x13')]('[%s][agents][agentcalled]',_0x84f489[_0xc3f8('0x10')]),_0x1db809);}};exports[_0xc3f8('0x19')]=function(_0x3b2e98){try{if(!_['isNil'](agents[_0x3b2e98['destuniqueid']])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98[_0xc3f8('0x10')]),_0x3b2e98);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x1b'),_0x3b2e98[_0xc3f8('0x10')],agents[_0x3b2e98['destuniqueid']]['membername'],_0x3b2e98['destuniqueid']));agents[_0x3b2e98[_0xc3f8('0x11')]]['agentringnoanswer']=!![];agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1c')]=utils['now']();agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x6')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0xc3f8('0x1d');agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x1f')]=_0x3b2e98[_0xc3f8('0x20')]?parseInt(_0x3b2e98[_0xc3f8('0x20')])/0x3e8:0x0;agents[_0x3b2e98[_0xc3f8('0x11')]][_0xc3f8('0x21')]=0x0;unanswered[_0xc3f8('0x22')](_0x3b2e98[_0xc3f8('0x11')]);}}catch(_0x59e4dd){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x1a'),_0x3b2e98['uniqueid']),_0x59e4dd);}};exports[_0xc3f8('0x24')]=function(_0x4d39a0){try{_[_0xc3f8('0x25')](agents,function(_0x32343e,_0x47ab53){if(_0x32343e['uniqueid']==_0x4d39a0[_0xc3f8('0x10')]&&!_[_0xc3f8('0x26')](unanswered,_0x32343e[_0xc3f8('0x11')])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0[_0xc3f8('0x10')]),_0x4d39a0);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x28'),_0x4d39a0['uniqueid'],_0x32343e[_0xc3f8('0x2')],_0x32343e[_0xc3f8('0x11')]));_0x32343e[_0xc3f8('0x19')]=!![];_0x32343e[_0xc3f8('0x1c')]=utils[_0xc3f8('0x16')]();_0x32343e['lastevent']='abandoned';_0x32343e[_0xc3f8('0x1e')]=_0xc3f8('0x29');_0x32343e[_0xc3f8('0x1f')]=_0x4d39a0[_0xc3f8('0x1f')];_0x32343e[_0xc3f8('0x21')]=0x0;writeDB(_0x32343e);}});}catch(_0x4e51ac){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x27'),_0x4d39a0['uniqueid']),_0x4e51ac);}};exports[_0xc3f8('0x2a')]=function(_0x11ecc2){try{if(agents[_0x11ecc2[_0xc3f8('0x11')]]){utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x11ecc2);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x2c'),_0x11ecc2[_0xc3f8('0x10')],agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x11ecc2['destuniqueid']));agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x5')]=_0x11ecc2['connectedlinenum'];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x2e')]=_0x11ecc2[_0xc3f8('0x2e')];agents[_0x11ecc2['destuniqueid']][_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];agents[_0x11ecc2[_0xc3f8('0x11')]][_0xc3f8('0x6')]='connect';_[_0xc3f8('0x25')](agents,function(_0x45d416,_0x2df096){if(_0x45d416[_0xc3f8('0x11')]!=_0x11ecc2['destuniqueid']&&_0x45d416[_0xc3f8('0x10')]==_0x11ecc2['uniqueid']){_0x45d416['talktime']=0x0;_0x45d416[_0xc3f8('0x1f')]=_0x11ecc2[_0xc3f8('0x20')];_0x45d416[_0xc3f8('0x19')]=!![];_0x45d416[_0xc3f8('0x1c')]=utils['now']();_0x45d416['lastevent']=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x1e')]=_0xc3f8('0x2f');_0x45d416[_0xc3f8('0x30')]=_0x11ecc2[_0xc3f8('0x11')];_0x45d416[_0xc3f8('0x31')]=_0x11ecc2[_0xc3f8('0x2')];writeDB(_0x45d416);}});}}catch(_0x45e6ea){utils[_0xc3f8('0x23')](util[_0xc3f8('0x13')](_0xc3f8('0x2b'),_0x11ecc2['uniqueid']),_0x45e6ea);}};exports[_0xc3f8('0xb')]=function(_0x22e9b3){try{if(!_['isNil'](agents[_0x22e9b3[_0xc3f8('0x11')]])){utils[_0xc3f8('0x12')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0x22e9b3);utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x33'),_0x22e9b3[_0xc3f8('0x10')],agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x2')],_0x22e9b3[_0xc3f8('0x11')]));agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0xb')]=!![];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x34')],agents[_0x22e9b3['destuniqueid']]['agentconnectAt']);agents[_0x22e9b3[_0xc3f8('0x11')]][_0xc3f8('0x1e')]=_0x22e9b3[_0xc3f8('0x1e')];agents[_0x22e9b3['destuniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x36');writeDB(agents[_0x22e9b3[_0xc3f8('0x11')]]);}}catch(_0xe3d5c4){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x32'),_0x22e9b3[_0xc3f8('0x10')]),_0xe3d5c4);}};exports['blindtransfer']=function(_0x1becae){try{if(!_[_0xc3f8('0x37')](agents[_0x1becae[_0xc3f8('0x38')]])){utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae[_0xc3f8('0x10')]),_0x1becae);utils['info'](util[_0xc3f8('0x13')](_0xc3f8('0x3a'),_0x1becae['uniqueid'],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x2')],agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')]));agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3b')]=!![];agents[_0x1becae[_0xc3f8('0x38')]]['transfertype']=_0xc3f8('0x3c');agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3d')]=_0x1becae[_0xc3f8('0x3e')];agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x3f')]=agents[_0x1becae[_0xc3f8('0x38')]][_0xc3f8('0x10')];}}catch(_0x4fc02c){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x39'),_0x1becae['uniqueid']),_0x4fc02c);}};exports['attendedtransfer']=function(_0x773d56){try{utils['debug'](util[_0xc3f8('0x13')](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x773d56);if(_0x773d56['origtransfereruniqueid']==_0x773d56[_0xc3f8('0x42')]){if(!_['isNil'](agents[_0x773d56['secondtransfereruniqueid']])){utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x44')]]['membername']));agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56['secondtransfereruniqueid']]['transferexten']=_0x773d56[_0xc3f8('0x47')];agents[_0x773d56[_0xc3f8('0x44')]][_0xc3f8('0x3f')]=_0x773d56[_0xc3f8('0x41')];}if(_0x773d56[_0xc3f8('0x48')]&&agents[_0x773d56['transfereeuniqueid']]){agents[_0x773d56[_0xc3f8('0x48')]]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x48')]]=_[_0xc3f8('0x49')](agents[_0x773d56[_0xc3f8('0x48')]]);transfers[_0x773d56[_0xc3f8('0x48')]]['calleridnum']=agents[_0x773d56[_0xc3f8('0x44')]]['calleridnum'];transfers[_0x773d56['transfereeuniqueid']]['calleridname']=agents[_0x773d56['secondtransfereruniqueid']][_0xc3f8('0x4a')];transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x15')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x2d')]=utils[_0xc3f8('0x16')]();transfers[_0x773d56[_0xc3f8('0x48')]]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x48')]][_0xc3f8('0x4b')]=0x2;}}else if(_0x773d56[_0xc3f8('0x44')]==_0x773d56[_0xc3f8('0x4c')]){if(!_[_0xc3f8('0x37')](agents[_0x773d56['origtransfereruniqueid']])){utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x43'),_0x773d56[_0xc3f8('0x41')],agents[_0x773d56[_0xc3f8('0x41')]]['membername']));agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3b')]=!![];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x45')]=_0xc3f8('0x46');agents[_0x773d56[_0xc3f8('0x41')]]['transferexten']=_0x773d56[_0xc3f8('0x4d')];agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x3f')]=_0x773d56['secondtransfereruniqueid'];}if(_0x773d56[_0xc3f8('0x4e')]&&agents[_0x773d56[_0xc3f8('0x4e')]]){agents[_0x773d56['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x773d56[_0xc3f8('0x4e')]]=_[_0xc3f8('0x49')](agents[_0x773d56['transfertargetuniqueid']]);transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4')];transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4a')]=agents[_0x773d56[_0xc3f8('0x41')]][_0xc3f8('0x4a')];transfers[_0x773d56['transfertargetuniqueid']]['agentcalledAt']=utils[_0xc3f8('0x16')]();transfers[_0x773d56['transfertargetuniqueid']]['agentconnectAt']=utils['now']();transfers[_0x773d56['transfertargetuniqueid']]['holdtime']=0x0;transfers[_0x773d56[_0xc3f8('0x4e')]][_0xc3f8('0x4b')]=0x2;}}}catch(_0x188d39){utils[_0xc3f8('0x23')](util['format'](_0xc3f8('0x40'),_0x773d56[_0xc3f8('0x41')]),_0x188d39);}};exports['hangup']=function(_0x3b9b47){try{utils[_0xc3f8('0x12')](util[_0xc3f8('0x13')]('[%s][agents][hangup]',_0x3b9b47[_0xc3f8('0x10')]),_0x3b9b47);if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47['uniqueid']]['reason']===_0xc3f8('0x1d')){if(_0x3b9b47[_0xc3f8('0x4f')]==='21'){agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')]=_0xc3f8('0x50');agents[_0x3b9b47['uniqueid']][_0xc3f8('0x6')]=_0xc3f8('0x50');}utils['info'](util[_0xc3f8('0x13')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47[_0xc3f8('0x10')]]['membername'],agents[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],agents[_0x3b9b47[_0xc3f8('0x10')]]['lastevent']));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);var _0x5de19e=unanswered[_0xc3f8('0x51')](_0x3b9b47['uniqueid']);if(_0x5de19e>-0x1){unanswered[_0xc3f8('0x52')](_0x5de19e,0x1);}}if(transfers[_0x3b9b47[_0xc3f8('0x10')]]){transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0xb')]=!![];transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils[_0xc3f8('0x16')]();transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x21')]=utils['diffTime'](transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]);transfers[_0x3b9b47[_0xc3f8('0x10')]]['reason']=_0xc3f8('0x53');transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util['format'](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],transfers[_0x3b9b47[_0xc3f8('0x10')]]['membername'],transfers[_0x3b9b47['uniqueid']][_0xc3f8('0x1e')],transfers[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(transfers[_0x3b9b47[_0xc3f8('0x10')]],!![]);}if(agents[_0x3b9b47['uniqueid']]&&agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x2d')]){agents[_0x3b9b47[_0xc3f8('0x10')]]['agentcomplete']=!![];agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x34')]=utils['now']();agents[_0x3b9b47['uniqueid']][_0xc3f8('0x21')]=utils[_0xc3f8('0x35')](agents[_0x3b9b47['uniqueid']][_0xc3f8('0x34')],agents[_0x3b9b47[_0xc3f8('0x10')]]['agentconnectAt']);agents[_0x3b9b47[_0xc3f8('0x10')]]['reason']=agents[_0x3b9b47[_0xc3f8('0x10')]]['transfer']?_0xc3f8('0x3b'):_0xc3f8('0x53');agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]=_0xc3f8('0x36');utils[_0xc3f8('0x1')](util[_0xc3f8('0x13')](_0xc3f8('0x54'),_0x3b9b47[_0xc3f8('0x10')],agents[_0x3b9b47['uniqueid']]['membername'],agents[_0x3b9b47[_0xc3f8('0x10')]]['reason'],agents[_0x3b9b47[_0xc3f8('0x10')]][_0xc3f8('0x6')]));writeDB(agents[_0x3b9b47[_0xc3f8('0x10')]]);}}catch(_0xfb05eb){utils['error'](util[_0xc3f8('0x13')](_0xc3f8('0x55'),_0x3b9b47[_0xc3f8('0x10')]),_0xfb05eb);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 51be886..1f17909 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 _0x2c36=['newchannel','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','toNumber','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','duration','diffTime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','hangup','noop','execif','set','gotoif','lodash','util','./utils','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','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport'];(function(_0x3a97ae,_0x15e95e){var _0x322511=function(_0x16af42){while(--_0x16af42){_0x3a97ae['push'](_0x3a97ae['shift']());}};_0x322511(++_0x15e95e);}(_0x2c36,0x1a7));var _0x62c3=function(_0x2bc1fe,_0x45da98){_0x2bc1fe=_0x2bc1fe-0x0;var _0x1a47a5=_0x2c36[_0x2bc1fe];return _0x1a47a5;};'use strict';var _=require(_0x62c3('0x0'));var util=require(_0x62c3('0x1'));var utils=require(_0x62c3('0x2'));var transfers=require('./transfers.controller');var dispositions=[_0x62c3('0x3'),_0x62c3('0x4'),'FAILED',_0x62c3('0x3'),'NO\x20ANSWER',_0x62c3('0x3'),_0x62c3('0x5'),_0x62c3('0x6'),_0x62c3('0x4'),_0x62c3('0x4'),_0x62c3('0x4')];var channels={};function writeDB(_0x5e39f4){var _0x7779ef;if(transfers[_0x62c3('0x7')][_0x5e39f4[_0x62c3('0x8')]]){_0x7779ef=_0x5e39f4[_0x62c3('0x8')];_0x5e39f4['uniqueid']=transfers[_0x62c3('0x7')][_0x5e39f4[_0x62c3('0x8')]][_0x62c3('0x9')];}utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0xc'),_0x5e39f4[_0x62c3('0x8')],_0x5e39f4[_0x62c3('0xd')],_0x5e39f4[_0x62c3('0xe')],_0x5e39f4['membername'],_0x5e39f4[_0x62c3('0xf')],_0x5e39f4[_0x62c3('0x10')],_0x5e39f4[_0x62c3('0x11')],_0x5e39f4[_0x62c3('0x12')]));if(_0x5e39f4[_0x62c3('0x13')]){utils[_0x62c3('0x14')](_0x5e39f4[_0x62c3('0x13')])[_0x62c3('0x15')](function(_0x1c7b5d){if(_0x1c7b5d){_0x5e39f4[_0x62c3('0x16')]=_0x1c7b5d['id'];}utils[_0x62c3('0x17')](_0x62c3('0x18'),_0x5e39f4);});}else{utils[_0x62c3('0x17')](_0x62c3('0x18'),_0x5e39f4);}if(channels[_0x5e39f4['uniqueid']]){delete channels[_0x5e39f4[_0x62c3('0x8')]];}else if(_0x7779ef&&channels[_0x7779ef]){delete transfers[_0x62c3('0x7')][_0x7779ef];delete channels[_0x7779ef];}}exports[_0x62c3('0x19')]=function(_0x554066){try{utils[_0x62c3('0x1a')](util[_0x62c3('0xb')](_0x62c3('0x1b'),_0x554066['uniqueid']),_0x554066);if(_0x554066[_0x62c3('0x8')]==_0x554066[_0x62c3('0x1c')]&&_0x554066['channel']!=_0x62c3('0x1d')){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x1e'),_0x554066[_0x62c3('0x8')],_0x554066[_0x62c3('0x1f')],_0x554066[_0x62c3('0x20')]));channels[_0x554066[_0x62c3('0x8')]]={'uniqueid':_0x554066['uniqueid'],'accountcode':_0x554066[_0x62c3('0x13')],'source':_0x554066[_0x62c3('0x10')],'destination':_0x554066[_0x62c3('0x20')],'destinationcontext':_0x554066[_0x62c3('0x1f')],'channel':_0x554066[_0x62c3('0xd')],'starttime':utils[_0x62c3('0x21')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x62c3('0x22')};}}catch(_0x4fcd9b){utils[_0x62c3('0x23')](util[_0x62c3('0xb')](_0x62c3('0x1b'),_0x554066['uniqueid']),_0x4fcd9b);}};exports['newstate']=function(_0x1601a4){try{utils[_0x62c3('0x1a')](util[_0x62c3('0xb')](_0x62c3('0x24'),_0x1601a4[_0x62c3('0x8')]),_0x1601a4);if(!_[_0x62c3('0x25')](channels[_0x1601a4[_0x62c3('0x8')]])&&_0x1601a4['channelstate']==0x6){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x26'),_0x1601a4[_0x62c3('0x8')],_0x1601a4[_0x62c3('0x1f')],_0x1601a4[_0x62c3('0xd')]));if(_['isNil'](channels[_0x1601a4[_0x62c3('0x8')]][_0x62c3('0x27')])){channels[_0x1601a4[_0x62c3('0x8')]]['systemanswertime']=utils[_0x62c3('0x21')]();}}else if(!_[_0x62c3('0x25')](channels[_0x1601a4[_0x62c3('0x1c')]])&&_0x1601a4[_0x62c3('0x28')]==0x6&&_0x1601a4['context']!=_0x62c3('0x29')){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x2a'),_0x1601a4['uniqueid'],_0x1601a4['linkedid'],_0x1601a4[_0x62c3('0x1f')],_0x1601a4[_0x62c3('0xd')]));channels[_0x1601a4['linkedid']]['accountcode']=_0x1601a4[_0x62c3('0x13')];channels[_0x1601a4[_0x62c3('0x1c')]][_0x62c3('0x2b')]=_0x1601a4[_0x62c3('0xd')];if(_[_0x62c3('0x25')](channels[_0x1601a4[_0x62c3('0x1c')]][_0x62c3('0x2c')])){channels[_0x1601a4['linkedid']]['answertime']=utils['now']();}channels[_0x1601a4['linkedid']]['disposition']=dispositions[_[_0x62c3('0x2d')](_0x1601a4[_0x62c3('0x28')])]||'ANSWERED';}}catch(_0x5a7391){utils[_0x62c3('0x23')](util[_0x62c3('0xb')]('[%s][calls][newstate]',_0x1601a4[_0x62c3('0x8')]),_0x5a7391);}};exports['hangup']=function(_0x3588f8){try{if(!_['isNil'](channels[_0x3588f8[_0x62c3('0x8')]])){utils['debug'](util['format']('[%s][calls][hangup]',_0x3588f8[_0x62c3('0x8')]),_0x3588f8);if(_[_0x62c3('0x25')](channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x2e')])){channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x2e')]=_0x3588f8[_0x62c3('0x2f')]+'\x20<'+_0x3588f8[_0x62c3('0x10')]+'>';}utils[_0x62c3('0xa')](util['format'](_0x62c3('0x30'),_0x3588f8[_0x62c3('0x8')],channels[_0x3588f8['uniqueid']]['callerid'],_0x3588f8['cause-txt']));channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x31')]=utils[_0x62c3('0x21')]();channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x32')]=utils[_0x62c3('0x33')](channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x31')],channels[_0x3588f8[_0x62c3('0x8')]]['starttime']);channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x34')]=channels[_0x3588f8['uniqueid']][_0x62c3('0x2c')]?utils[_0x62c3('0x33')](channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x31')],channels[_0x3588f8[_0x62c3('0x8')]][_0x62c3('0x2c')]):0x0;writeDB(channels[_0x3588f8[_0x62c3('0x8')]]);}}catch(_0x5dad18){utils[_0x62c3('0x23')](util['format'](_0x62c3('0x35'),_0x3588f8[_0x62c3('0x8')]),_0x5dad18);}};exports[_0x62c3('0x36')]=function(_0x491aa8){try{if(!_[_0x62c3('0x25')](channels[_0x491aa8[_0x62c3('0x37')]])){utils[_0x62c3('0x1a')](util[_0x62c3('0xb')](_0x62c3('0x38'),_0x491aa8[_0x62c3('0x39')]),_0x491aa8);if(channels[_0x491aa8[_0x62c3('0x37')]][_0x62c3('0xd')]==_0x491aa8['transfereechannel']){utils[_0x62c3('0xa')](util[_0x62c3('0xb')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x491aa8[_0x62c3('0x39')],_0x491aa8['localtwolinkedid'],_0x491aa8[_0x62c3('0x3a')]));channels[_0x491aa8[_0x62c3('0x37')]]['destinationchannel']=_0x491aa8[_0x62c3('0x3a')];channels[_0x491aa8['localtwolinkedid']][_0x62c3('0x3b')]='_attended';}else if(channels[_0x491aa8[_0x62c3('0x37')]][_0x62c3('0xd')]=_0x491aa8[_0x62c3('0x3c')]){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x3d'),_0x491aa8['origtransfereruniqueid'],_0x491aa8['localtwolinkedid'],_0x491aa8['origtransfererchannel']));channels[_0x491aa8['localtwolinkedid']][_0x62c3('0x2b')]=_0x491aa8[_0x62c3('0x3e')];channels[_0x491aa8['localtwolinkedid']][_0x62c3('0x3b')]=_0x62c3('0x3f');}}}catch(_0x67498b){utils['error'](util[_0x62c3('0xb')](_0x62c3('0x38'),_0x491aa8[_0x62c3('0x39')]),_0x67498b);}};exports[_0x62c3('0x40')]=function(_0x3e75b6){try{if(!_[_0x62c3('0x25')](channels[_0x3e75b6[_0x62c3('0x8')]])){utils['debug'](util['format'](_0x62c3('0x41'),_0x3e75b6[_0x62c3('0x8')]),_0x3e75b6);channels[_0x3e75b6['uniqueid']]['musiconholdstartAt']=utils[_0x62c3('0x21')]();utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x42'),_0x3e75b6['uniqueid'],channels[_0x3e75b6[_0x62c3('0x8')]][_0x62c3('0x43')]));}}catch(_0x247b74){utils[_0x62c3('0x23')](util[_0x62c3('0xb')]('[%s][calls][musiconholdstart]',_0x3e75b6[_0x62c3('0x8')]),_0x247b74);}};exports[_0x62c3('0x44')]=function(_0x41e29d){try{if(!_[_0x62c3('0x25')](channels[_0x41e29d['uniqueid']])){utils['debug'](util[_0x62c3('0xb')](_0x62c3('0x45'),_0x41e29d[_0x62c3('0x8')]),_0x41e29d);if(!_['isNil'](channels[_0x41e29d['uniqueid']][_0x62c3('0x43')])){channels[_0x41e29d[_0x62c3('0x8')]]['mohtime']+=utils['diffTime'](utils[_0x62c3('0x21')](),channels[_0x41e29d[_0x62c3('0x8')]][_0x62c3('0x43')]);utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x46'),_0x41e29d[_0x62c3('0x8')],channels[_0x41e29d[_0x62c3('0x8')]]['mohtime']));delete channels[_0x41e29d[_0x62c3('0x8')]][_0x62c3('0x43')];}}}catch(_0x271443){utils['error'](util[_0x62c3('0xb')](_0x62c3('0x45'),_0x41e29d['uniqueid']),_0x271443);}};exports[_0x62c3('0x47')]=function(_0x1d4cd4){try{if(!_['isNil'](channels[_0x1d4cd4['uniqueid']])){utils[_0x62c3('0x1a')](util[_0x62c3('0xb')]('[%s][calls][varset]',_0x1d4cd4[_0x62c3('0x8')]),_0x1d4cd4);if(!_['isNil'](_0x1d4cd4[_0x62c3('0x48')][_0x62c3('0x49')])){utils['info'](util[_0x62c3('0xb')](_0x62c3('0x4a'),_0x1d4cd4['uniqueid'],_0x1d4cd4[_0x62c3('0x4b')]));channels[_0x1d4cd4[_0x62c3('0x8')]][_0x62c3('0x4c')]=_0x1d4cd4['value'];}if(!_['isNil'](_0x1d4cd4[_0x62c3('0x48')][_0x62c3('0x4d')])){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x4e'),_0x1d4cd4[_0x62c3('0x8')],_0x1d4cd4[_0x62c3('0x4b')]));channels[_0x1d4cd4[_0x62c3('0x8')]]['destination']=_0x1d4cd4[_0x62c3('0x4b')];channels[_0x1d4cd4['uniqueid']][_0x62c3('0x2e')]='\x22'+_0x1d4cd4[_0x62c3('0x4b')]+_0x62c3('0x4f')+_0x1d4cd4[_0x62c3('0x4b')]+'>';}if(!_[_0x62c3('0x25')](_0x1d4cd4[_0x62c3('0x48')][_0x62c3('0x50')])||!_[_0x62c3('0x25')](_0x1d4cd4[_0x62c3('0x48')]['xmd-callerid'])){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x51'),_0x1d4cd4[_0x62c3('0x8')],!_[_0x62c3('0x25')](_0x1d4cd4['variable'][_0x62c3('0x50')])?'xmd-callerid-preview':_0x62c3('0x52'),_0x1d4cd4[_0x62c3('0x4b')]));channels[_0x1d4cd4['uniqueid']]['callerid']=_0x1d4cd4[_0x62c3('0x4b')];}if(!_['isNil'](_0x1d4cd4[_0x62c3('0x48')][_0x62c3('0x53')])||!_[_0x62c3('0x25')](_0x1d4cd4['variable'][_0x62c3('0x54')])){utils[_0x62c3('0xa')](util['format'](_0x62c3('0x51'),_0x1d4cd4[_0x62c3('0x8')],!_['isNil'](_0x1d4cd4[_0x62c3('0x48')]['xmd-queue'])?_0x62c3('0x53'):_0x62c3('0x54'),_0x1d4cd4['value']));channels[_0x1d4cd4[_0x62c3('0x8')]][_0x62c3('0x55')]=_0x62c3('0x56');channels[_0x1d4cd4[_0x62c3('0x8')]][_0x62c3('0x57')]=_0x1d4cd4['value'];channels[_0x1d4cd4[_0x62c3('0x8')]]['queue']=!![];}if(!_['isNil'](_0x1d4cd4['variable']['xmd-contactid'])){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x58'),_0x1d4cd4[_0x62c3('0x8')],_0x1d4cd4[_0x62c3('0x4b')]));channels[_0x1d4cd4[_0x62c3('0x8')]][_0x62c3('0x59')]=_0x1d4cd4[_0x62c3('0x4b')];}if(!_[_0x62c3('0x25')](_0x1d4cd4[_0x62c3('0x48')]['xmd-cdrtype'])){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x5a'),_0x1d4cd4['uniqueid'],_0x1d4cd4[_0x62c3('0x4b')]));channels[_0x1d4cd4[_0x62c3('0x8')]][_0x62c3('0x5b')]=_0x1d4cd4[_0x62c3('0x4b')];}if(!_[_0x62c3('0x25')](_0x1d4cd4['variable'][_0x62c3('0x5c')])){utils[_0x62c3('0xa')](util['format'](_0x62c3('0x5d'),_0x1d4cd4['uniqueid'],_0x1d4cd4[_0x62c3('0x4b')]));channels[_0x1d4cd4['uniqueid']][_0x62c3('0x5e')]=_0x1d4cd4['value'];}if(!_[_0x62c3('0x25')](_0x1d4cd4[_0x62c3('0x48')][_0x62c3('0x5f')])){utils[_0x62c3('0xa')](util[_0x62c3('0xb')](_0x62c3('0x60'),_0x1d4cd4['uniqueid'],_0x1d4cd4['value']));channels[_0x1d4cd4[_0x62c3('0x8')]]['sipcallid']=_0x1d4cd4[_0x62c3('0x4b')];}}}catch(_0xc437a2){utils[_0x62c3('0x23')](util[_0x62c3('0xb')](_0x62c3('0x61'),_0x1d4cd4[_0x62c3('0x8')]),_0xc437a2);}};exports['newexten']=function(_0x5f33d4){try{if(!_[_0x62c3('0x25')](channels[_0x5f33d4[_0x62c3('0x8')]])){utils['debug'](util[_0x62c3('0xb')](_0x62c3('0x62'),_0x5f33d4[_0x62c3('0x8')]),_0x5f33d4);utils[_0x62c3('0xa')](util['format'](_0x62c3('0x63'),_0x5f33d4[_0x62c3('0x8')],_0x5f33d4[_0x62c3('0x64')],_0x5f33d4[_0x62c3('0x65')]));if(_0x5f33d4[_0x62c3('0x64')][_0x62c3('0x66')]()=='set'&&_[_0x62c3('0x67')](_0x5f33d4[_0x62c3('0x65')][_0x62c3('0x66')](),_0x62c3('0x68'))){var _0x2761a9=_0x5f33d4[_0x62c3('0x65')][_0x62c3('0x69')]('=');var _0xe83023=_0x2761a9[0x0]['substring'](_0x2761a9[0x0][_0x62c3('0x6a')]('(')+0x1,_0x2761a9[0x0][_0x62c3('0x6a')](')'));var _0x599fa0=_0x2761a9[0x1];channels[_0x5f33d4[_0x62c3('0x8')]][_0xe83023]=_0x599fa0;}if(!_['includes']([_0x62c3('0x6b'),_0x62c3('0x6c'),_0x62c3('0x6d'),_0x62c3('0x6e'),_0x62c3('0x6f')],_0x5f33d4[_0x62c3('0x64')][_0x62c3('0x66')]())){channels[_0x5f33d4[_0x62c3('0x8')]][_0x62c3('0x55')]=_0x5f33d4[_0x62c3('0x64')];channels[_0x5f33d4[_0x62c3('0x8')]]['lastdata']=_0x5f33d4[_0x62c3('0x65')];}}}catch(_0x1991ab){utils[_0x62c3('0x23')](util[_0x62c3('0xb')]('[%s][calls][newexten]',_0x5f33d4[_0x62c3('0x8')]),_0x1991ab);}}; \ No newline at end of file +var _0x7d6c=['source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','application','lastapplication','lodash','./utils','./transfers.controller','NO\x20ANSWER','FAILED','BUSY','blinds','uniqueid','transfereeuniqueid','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','ANSWERED','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','transfertargetchannel','origtransfererchannel','userfield','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value'];(function(_0x152cec,_0x3697f3){var _0x3107b9=function(_0x43c31d){while(--_0x43c31d){_0x152cec['push'](_0x152cec['shift']());}};_0x3107b9(++_0x3697f3);}(_0x7d6c,0x1e2));var _0xc7d6=function(_0x164330,_0x270ea1){_0x164330=_0x164330-0x0;var _0x65cc1c=_0x7d6c[_0x164330];return _0x65cc1c;};'use strict';var _=require(_0xc7d6('0x0'));var util=require('util');var utils=require(_0xc7d6('0x1'));var transfers=require(_0xc7d6('0x2'));var dispositions=[_0xc7d6('0x3'),_0xc7d6('0x4'),_0xc7d6('0x4'),_0xc7d6('0x3'),'NO\x20ANSWER','NO\x20ANSWER','ANSWERED',_0xc7d6('0x5'),_0xc7d6('0x4'),'FAILED','FAILED'];var channels={};function writeDB(_0x312a4b){var _0x27a2c0;if(transfers[_0xc7d6('0x6')][_0x312a4b[_0xc7d6('0x7')]]){_0x27a2c0=_0x312a4b['uniqueid'];_0x312a4b[_0xc7d6('0x7')]=transfers[_0xc7d6('0x6')][_0x312a4b[_0xc7d6('0x7')]][_0xc7d6('0x8')];}utils[_0xc7d6('0x9')](util['format'](_0xc7d6('0xa'),_0x312a4b[_0xc7d6('0x7')],_0x312a4b[_0xc7d6('0xb')],_0x312a4b[_0xc7d6('0xc')],_0x312a4b[_0xc7d6('0xd')],_0x312a4b[_0xc7d6('0xe')],_0x312a4b[_0xc7d6('0xf')],_0x312a4b['connectedlinenum'],_0x312a4b[_0xc7d6('0x10')]));if(_0x312a4b['accountcode']){utils[_0xc7d6('0x11')](_0x312a4b[_0xc7d6('0x12')])[_0xc7d6('0x13')](function(_0x5d9365){if(_0x5d9365){_0x312a4b[_0xc7d6('0x14')]=_0x5d9365['id'];}utils[_0xc7d6('0x15')](_0xc7d6('0x16'),_0x312a4b);});}else{utils['request'](_0xc7d6('0x16'),_0x312a4b);}if(channels[_0x312a4b[_0xc7d6('0x7')]]){delete channels[_0x312a4b[_0xc7d6('0x7')]];}else if(_0x27a2c0&&channels[_0x27a2c0]){delete transfers[_0xc7d6('0x6')][_0x27a2c0];delete channels[_0x27a2c0];}}exports['newchannel']=function(_0x572e4b){try{utils[_0xc7d6('0x17')](util['format'](_0xc7d6('0x18'),_0x572e4b[_0xc7d6('0x7')]),_0x572e4b);if(_0x572e4b[_0xc7d6('0x7')]==_0x572e4b['linkedid']&&_0x572e4b[_0xc7d6('0xb')]!=_0xc7d6('0x19')){utils['info'](util[_0xc7d6('0x1a')](_0xc7d6('0x1b'),_0x572e4b[_0xc7d6('0x7')],_0x572e4b['context'],_0x572e4b[_0xc7d6('0x1c')]));channels[_0x572e4b[_0xc7d6('0x7')]]={'uniqueid':_0x572e4b[_0xc7d6('0x7')],'accountcode':_0x572e4b[_0xc7d6('0x12')],'source':_0x572e4b[_0xc7d6('0xf')],'destination':_0x572e4b[_0xc7d6('0x1c')],'destinationcontext':_0x572e4b[_0xc7d6('0x1d')],'channel':_0x572e4b['channel'],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x32cacd){utils[_0xc7d6('0x1e')](util[_0xc7d6('0x1a')](_0xc7d6('0x18'),_0x572e4b[_0xc7d6('0x7')]),_0x32cacd);}};exports[_0xc7d6('0x1f')]=function(_0x34cfa9){try{utils['debug'](util['format'](_0xc7d6('0x20'),_0x34cfa9[_0xc7d6('0x7')]),_0x34cfa9);if(!_[_0xc7d6('0x21')](channels[_0x34cfa9[_0xc7d6('0x7')]])&&_0x34cfa9[_0xc7d6('0x22')]==0x6){utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')](_0xc7d6('0x23'),_0x34cfa9[_0xc7d6('0x7')],_0x34cfa9[_0xc7d6('0x1d')],_0x34cfa9['channel']));if(_[_0xc7d6('0x21')](channels[_0x34cfa9['uniqueid']]['systemanswertime'])){channels[_0x34cfa9[_0xc7d6('0x7')]][_0xc7d6('0x24')]=utils[_0xc7d6('0x25')]();}}else if(!_[_0xc7d6('0x21')](channels[_0x34cfa9[_0xc7d6('0x26')]])&&_0x34cfa9[_0xc7d6('0x22')]==0x6&&_0x34cfa9['context']!=_0xc7d6('0x27')){utils[_0xc7d6('0x9')](util['format'](_0xc7d6('0x28'),_0x34cfa9['uniqueid'],_0x34cfa9[_0xc7d6('0x26')],_0x34cfa9[_0xc7d6('0x1d')],_0x34cfa9[_0xc7d6('0xb')]));channels[_0x34cfa9[_0xc7d6('0x26')]][_0xc7d6('0x12')]=_0x34cfa9[_0xc7d6('0x12')];channels[_0x34cfa9[_0xc7d6('0x26')]][_0xc7d6('0x29')]=_0x34cfa9['channel'];if(_[_0xc7d6('0x21')](channels[_0x34cfa9[_0xc7d6('0x26')]][_0xc7d6('0x2a')])){channels[_0x34cfa9[_0xc7d6('0x26')]][_0xc7d6('0x2a')]=utils[_0xc7d6('0x25')]();}channels[_0x34cfa9[_0xc7d6('0x26')]][_0xc7d6('0x2b')]=dispositions[_['toNumber'](_0x34cfa9[_0xc7d6('0x22')])]||_0xc7d6('0x2c');}}catch(_0x1cdbcb){utils[_0xc7d6('0x1e')](util[_0xc7d6('0x1a')](_0xc7d6('0x20'),_0x34cfa9['uniqueid']),_0x1cdbcb);}};exports[_0xc7d6('0x2d')]=function(_0x289821){try{if(!_[_0xc7d6('0x21')](channels[_0x289821['uniqueid']])){utils[_0xc7d6('0x17')](util[_0xc7d6('0x1a')](_0xc7d6('0x2e'),_0x289821['uniqueid']),_0x289821);if(_[_0xc7d6('0x21')](channels[_0x289821[_0xc7d6('0x7')]][_0xc7d6('0x2f')])){channels[_0x289821[_0xc7d6('0x7')]]['callerid']=_0x289821[_0xc7d6('0x30')]+'\x20<'+_0x289821[_0xc7d6('0xf')]+'>';}utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')](_0xc7d6('0x31'),_0x289821[_0xc7d6('0x7')],channels[_0x289821[_0xc7d6('0x7')]]['callerid'],_0x289821[_0xc7d6('0x32')]));channels[_0x289821[_0xc7d6('0x7')]][_0xc7d6('0x33')]=utils['now']();channels[_0x289821[_0xc7d6('0x7')]][_0xc7d6('0x34')]=utils['diffTime'](channels[_0x289821['uniqueid']][_0xc7d6('0x33')],channels[_0x289821[_0xc7d6('0x7')]][_0xc7d6('0x35')]);channels[_0x289821[_0xc7d6('0x7')]][_0xc7d6('0x36')]=channels[_0x289821[_0xc7d6('0x7')]][_0xc7d6('0x2a')]?utils[_0xc7d6('0x37')](channels[_0x289821['uniqueid']]['endtime'],channels[_0x289821[_0xc7d6('0x7')]]['answertime']):0x0;writeDB(channels[_0x289821[_0xc7d6('0x7')]]);}}catch(_0x3cef88){utils[_0xc7d6('0x1e')](util[_0xc7d6('0x1a')]('[%s][calls][hangup]',_0x289821['uniqueid']),_0x3cef88);}};exports[_0xc7d6('0x38')]=function(_0x50d3d9){try{if(!_[_0xc7d6('0x21')](channels[_0x50d3d9[_0xc7d6('0x39')]])){utils[_0xc7d6('0x17')](util[_0xc7d6('0x1a')](_0xc7d6('0x3a'),_0x50d3d9[_0xc7d6('0x3b')]),_0x50d3d9);if(channels[_0x50d3d9[_0xc7d6('0x39')]]['channel']==_0x50d3d9['transfereechannel']){utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')](_0xc7d6('0x3c'),_0x50d3d9[_0xc7d6('0x3b')],_0x50d3d9[_0xc7d6('0x39')],_0x50d3d9[_0xc7d6('0x3d')]));channels[_0x50d3d9[_0xc7d6('0x39')]][_0xc7d6('0x29')]=_0x50d3d9[_0xc7d6('0x3d')];channels[_0x50d3d9['localtwolinkedid']]['userfield']=_0xc7d6('0x3e');}else if(channels[_0x50d3d9[_0xc7d6('0x39')]][_0xc7d6('0xb')]=_0x50d3d9[_0xc7d6('0x3f')]){utils['info'](util[_0xc7d6('0x1a')](_0xc7d6('0x3c'),_0x50d3d9['origtransfereruniqueid'],_0x50d3d9[_0xc7d6('0x39')],_0x50d3d9[_0xc7d6('0x40')]));channels[_0x50d3d9[_0xc7d6('0x39')]][_0xc7d6('0x29')]=_0x50d3d9[_0xc7d6('0x40')];channels[_0x50d3d9[_0xc7d6('0x39')]][_0xc7d6('0x41')]=_0xc7d6('0x3e');}}}catch(_0x2cf2a7){utils[_0xc7d6('0x1e')](util[_0xc7d6('0x1a')](_0xc7d6('0x3a'),_0x50d3d9[_0xc7d6('0x3b')]),_0x2cf2a7);}};exports[_0xc7d6('0x42')]=function(_0x58e5ec){try{if(!_[_0xc7d6('0x21')](channels[_0x58e5ec[_0xc7d6('0x7')]])){utils['debug'](util['format'](_0xc7d6('0x43'),_0x58e5ec[_0xc7d6('0x7')]),_0x58e5ec);channels[_0x58e5ec[_0xc7d6('0x7')]][_0xc7d6('0x44')]=utils[_0xc7d6('0x25')]();utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x58e5ec['uniqueid'],channels[_0x58e5ec[_0xc7d6('0x7')]][_0xc7d6('0x44')]));}}catch(_0x5d2638){utils['error'](util[_0xc7d6('0x1a')](_0xc7d6('0x43'),_0x58e5ec[_0xc7d6('0x7')]),_0x5d2638);}};exports['musiconholdstop']=function(_0xa5483){try{if(!_['isNil'](channels[_0xa5483[_0xc7d6('0x7')]])){utils[_0xc7d6('0x17')](util[_0xc7d6('0x1a')](_0xc7d6('0x45'),_0xa5483[_0xc7d6('0x7')]),_0xa5483);if(!_[_0xc7d6('0x21')](channels[_0xa5483[_0xc7d6('0x7')]][_0xc7d6('0x44')])){channels[_0xa5483[_0xc7d6('0x7')]]['mohtime']+=utils[_0xc7d6('0x37')](utils[_0xc7d6('0x25')](),channels[_0xa5483[_0xc7d6('0x7')]][_0xc7d6('0x44')]);utils['info'](util[_0xc7d6('0x1a')](_0xc7d6('0x46'),_0xa5483['uniqueid'],channels[_0xa5483[_0xc7d6('0x7')]][_0xc7d6('0x47')]));delete channels[_0xa5483['uniqueid']][_0xc7d6('0x44')];}}}catch(_0x47e21a){utils[_0xc7d6('0x1e')](util[_0xc7d6('0x1a')](_0xc7d6('0x45'),_0xa5483['uniqueid']),_0x47e21a);}};exports[_0xc7d6('0x48')]=function(_0x346ae1){try{if(!_[_0xc7d6('0x21')](channels[_0x346ae1['uniqueid']])){utils[_0xc7d6('0x17')](util['format'](_0xc7d6('0x49'),_0x346ae1[_0xc7d6('0x7')]),_0x346ae1);if(!_['isNil'](_0x346ae1[_0xc7d6('0x4a')][_0xc7d6('0x4b')])){utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')](_0xc7d6('0x4c'),_0x346ae1['uniqueid'],_0x346ae1[_0xc7d6('0x4d')]));channels[_0x346ae1[_0xc7d6('0x7')]][_0xc7d6('0x4e')]=_0x346ae1[_0xc7d6('0x4d')];}if(!_['isNil'](_0x346ae1[_0xc7d6('0x4a')][_0xc7d6('0x4f')])){utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')](_0xc7d6('0x50'),_0x346ae1[_0xc7d6('0x7')],_0x346ae1['value']));channels[_0x346ae1[_0xc7d6('0x7')]][_0xc7d6('0x51')]=_0x346ae1[_0xc7d6('0x4d')];channels[_0x346ae1[_0xc7d6('0x7')]][_0xc7d6('0x2f')]='\x22'+_0x346ae1[_0xc7d6('0x4d')]+_0xc7d6('0x52')+_0x346ae1[_0xc7d6('0x4d')]+'>';}if(!_[_0xc7d6('0x21')](_0x346ae1[_0xc7d6('0x4a')]['xmd-callerid-preview'])||!_[_0xc7d6('0x21')](_0x346ae1['variable']['xmd-callerid'])){utils['info'](util[_0xc7d6('0x1a')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x346ae1[_0xc7d6('0x7')],!_['isNil'](_0x346ae1[_0xc7d6('0x4a')][_0xc7d6('0x53')])?_0xc7d6('0x53'):'xmd-callerid',_0x346ae1[_0xc7d6('0x4d')]));channels[_0x346ae1[_0xc7d6('0x7')]]['callerid']=_0x346ae1[_0xc7d6('0x4d')];}if(!_[_0xc7d6('0x21')](_0x346ae1['variable']['xmd-queue'])||!_[_0xc7d6('0x21')](_0x346ae1[_0xc7d6('0x4a')][_0xc7d6('0x54')])){utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')](_0xc7d6('0x55'),_0x346ae1[_0xc7d6('0x7')],!_[_0xc7d6('0x21')](_0x346ae1[_0xc7d6('0x4a')][_0xc7d6('0x56')])?_0xc7d6('0x56'):_0xc7d6('0x54'),_0x346ae1[_0xc7d6('0x4d')]));channels[_0x346ae1[_0xc7d6('0x7')]]['lastapplication']='Queue';channels[_0x346ae1[_0xc7d6('0x7')]]['lastdata']=_0x346ae1[_0xc7d6('0x4d')];channels[_0x346ae1['uniqueid']][_0xc7d6('0xc')]=!![];}if(!_[_0xc7d6('0x21')](_0x346ae1[_0xc7d6('0x4a')]['xmd-contactid'])){utils['info'](util['format'](_0xc7d6('0x57'),_0x346ae1[_0xc7d6('0x7')],_0x346ae1[_0xc7d6('0x4d')]));channels[_0x346ae1[_0xc7d6('0x7')]][_0xc7d6('0x58')]=_0x346ae1[_0xc7d6('0x4d')];}if(!_[_0xc7d6('0x21')](_0x346ae1[_0xc7d6('0x4a')]['xmd-cdrtype'])){utils['info'](util['format'](_0xc7d6('0x59'),_0x346ae1[_0xc7d6('0x7')],_0x346ae1[_0xc7d6('0x4d')]));channels[_0x346ae1['uniqueid']][_0xc7d6('0x5a')]=_0x346ae1[_0xc7d6('0x4d')];}if(!_[_0xc7d6('0x21')](_0x346ae1[_0xc7d6('0x4a')][_0xc7d6('0x5b')])){utils[_0xc7d6('0x9')](util[_0xc7d6('0x1a')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x346ae1[_0xc7d6('0x7')],_0x346ae1[_0xc7d6('0x4d')]));channels[_0x346ae1['uniqueid']][_0xc7d6('0x5c')]=_0x346ae1[_0xc7d6('0x4d')];}if(!_[_0xc7d6('0x21')](_0x346ae1[_0xc7d6('0x4a')]['sipcallid'])){utils[_0xc7d6('0x9')](util['format'](_0xc7d6('0x5d'),_0x346ae1['uniqueid'],_0x346ae1['value']));channels[_0x346ae1[_0xc7d6('0x7')]][_0xc7d6('0x5e')]=_0x346ae1[_0xc7d6('0x4d')];}}}catch(_0x257f36){utils[_0xc7d6('0x1e')](util[_0xc7d6('0x1a')]('[%s][calls][varset]',_0x346ae1[_0xc7d6('0x7')]),_0x257f36);}};exports[_0xc7d6('0x5f')]=function(_0x567d0f){try{if(!_[_0xc7d6('0x21')](channels[_0x567d0f[_0xc7d6('0x7')]])){utils['debug'](util['format'](_0xc7d6('0x60'),_0x567d0f[_0xc7d6('0x7')]),_0x567d0f);utils[_0xc7d6('0x9')](util['format'](_0xc7d6('0x61'),_0x567d0f[_0xc7d6('0x7')],_0x567d0f['application'],_0x567d0f[_0xc7d6('0x62')]));if(_0x567d0f['application'][_0xc7d6('0x63')]()==_0xc7d6('0x64')&&_[_0xc7d6('0x65')](_0x567d0f[_0xc7d6('0x62')]['toLowerCase'](),_0xc7d6('0x66'))){var _0x52ffc4=_0x567d0f['appdata'][_0xc7d6('0x67')]('=');var _0x3c985a=_0x52ffc4[0x0][_0xc7d6('0x68')](_0x52ffc4[0x0][_0xc7d6('0x69')]('(')+0x1,_0x52ffc4[0x0][_0xc7d6('0x69')](')'));var _0x2ce0a0=_0x52ffc4[0x1];channels[_0x567d0f[_0xc7d6('0x7')]][_0x3c985a]=_0x2ce0a0;}if(!_[_0xc7d6('0x6a')]([_0xc7d6('0x2d'),_0xc7d6('0x6b'),_0xc7d6('0x6c'),_0xc7d6('0x64'),_0xc7d6('0x6d')],_0x567d0f[_0xc7d6('0x6e')][_0xc7d6('0x63')]())){channels[_0x567d0f[_0xc7d6('0x7')]][_0xc7d6('0x6f')]=_0x567d0f['application'];channels[_0x567d0f[_0xc7d6('0x7')]]['lastdata']=_0x567d0f['appdata'];}}}catch(_0xea8dad){utils[_0xc7d6('0x1e')](util[_0xc7d6('0x1a')](_0xc7d6('0x60'),_0x567d0f['uniqueid']),_0xea8dad);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index a777b46..bdfd533 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 _0x22f3=['[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown','[core]\x20shutdown','[core]\x20fullybooted','error','close'];(function(_0x4429e0,_0xee6f1f){var _0x51a5b3=function(_0x16eb11){while(--_0x16eb11){_0x4429e0['push'](_0x4429e0['shift']());}};_0x51a5b3(++_0xee6f1f);}(_0x22f3,0xc8));var _0x322f=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x22f3[_0x2300f2];return _0x6bd508;};'use strict';var utils=require(_0x322f('0x0'));exports[_0x322f('0x1')]=function(){utils[_0x322f('0x2')](_0x322f('0x3'));};exports[_0x322f('0x4')]=function(){utils['info'](_0x322f('0x5'));};exports['fullybooted']=function(){utils[_0x322f('0x2')](_0x322f('0x6'));};exports[_0x322f('0x7')]=function(_0x730021){utils[_0x322f('0x7')]('[core]\x20error',_0x730021);};exports[_0x322f('0x8')]=function(){utils['info'](_0x322f('0x9'));};exports[_0x322f('0xa')]=function(_0x50e771){}; \ No newline at end of file +var _0xeb87=['managerevent','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close'];(function(_0x5f139a,_0x3abb4a){var _0x18d3f7=function(_0x1a5385){while(--_0x1a5385){_0x5f139a['push'](_0x5f139a['shift']());}};_0x18d3f7(++_0x3abb4a);}(_0xeb87,0x6f));var _0x7eb8=function(_0x4ab18b,_0x5429fc){_0x4ab18b=_0x4ab18b-0x0;var _0x1cc5a3=_0xeb87[_0x4ab18b];return _0x1cc5a3;};'use strict';var utils=require('./utils');exports['connect']=function(){utils[_0x7eb8('0x0')](_0x7eb8('0x1'));};exports[_0x7eb8('0x2')]=function(){utils[_0x7eb8('0x0')]('[core]\x20shutdown');};exports[_0x7eb8('0x3')]=function(){utils[_0x7eb8('0x0')](_0x7eb8('0x4'));};exports[_0x7eb8('0x5')]=function(_0x1be593){utils[_0x7eb8('0x5')](_0x7eb8('0x6'),_0x1be593);};exports[_0x7eb8('0x7')]=function(){utils[_0x7eb8('0x0')](_0x7eb8('0x8'));};exports[_0x7eb8('0x9')]=function(_0x3f80fb){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index e9046b2..1bfcc38 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 _0x7086=['dialstring','connectedlinenum','dialstatus','newexten','debug','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','calleridnum','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel'];(function(_0x53bd6f,_0x15828a){var _0x5f4e08=function(_0x2032be){while(--_0x2032be){_0x53bd6f['push'](_0x53bd6f['shift']());}};_0x5f4e08(++_0x15828a);}(_0x7086,0x92));var _0x6708=function(_0x5281c2,_0xcf8747){_0x5281c2=_0x5281c2-0x0;var _0x3ab30e=_0x7086[_0x5281c2];return _0x3ab30e;};'use strict';var _=require('lodash');var util=require(_0x6708('0x0'));var utils=require(_0x6708('0x1'));var dials={};function writeDB(_0x234f7f){utils[_0x6708('0x2')](util[_0x6708('0x3')](_0x6708('0x4'),_0x234f7f[_0x6708('0x5')],_0x234f7f[_0x6708('0x6')],_0x234f7f[_0x6708('0x7')],_0x234f7f['calleridnum'],_0x234f7f[_0x6708('0x8')],_0x234f7f[_0x6708('0x9')]));utils['request']('CreateVoiceDialReport',_0x234f7f);delete dials[_0x234f7f[_0x6708('0x5')]];}exports[_0x6708('0xa')]=function(_0x3335e7){try{utils[_0x6708('0xb')](util[_0x6708('0x3')]('[%s][dials][newexten]',_0x3335e7[_0x6708('0x5')]),_0x3335e7);utils[_0x6708('0x2')](util[_0x6708('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3335e7['uniqueid'],_0x3335e7[_0x6708('0xc')],_0x3335e7[_0x6708('0xd')]));if(_0x3335e7['application'][_0x6708('0xe')]()==_0x6708('0xf')&&_[_0x6708('0x10')](_0x3335e7[_0x6708('0xd')]['toLowerCase'](),_0x6708('0x11'))){var _0x4506af=_0x3335e7[_0x6708('0xd')][_0x6708('0x12')]('=');dials[_0x3335e7['uniqueid']]={'routeId':_0x4506af[0x1]};}}catch(_0x2abadc){utils[_0x6708('0x13')](util['format'](_0x6708('0x14'),_0x3335e7[_0x6708('0x5')]),_0x2abadc);}};exports[_0x6708('0x15')]=function(_0x5e8da9){try{utils[_0x6708('0xb')](util[_0x6708('0x3')](_0x6708('0x16'),_0x5e8da9[_0x6708('0x5')]),_0x5e8da9);if(!_[_0x6708('0x17')](_0x5e8da9[_0x6708('0x18')][_0x6708('0x19')])){utils[_0x6708('0x2')](util[_0x6708('0x3')](_0x6708('0x1a'),_0x5e8da9[_0x6708('0x5')],_0x5e8da9[_0x6708('0x1b')]));dials[_0x5e8da9[_0x6708('0x5')]]={'routeId':_0x5e8da9[_0x6708('0x1b')]};}}catch(_0x31d2f0){utils[_0x6708('0x13')](util[_0x6708('0x3')]('[%s][dials][varset]',_0x5e8da9[_0x6708('0x5')]),_0x31d2f0);}};exports[_0x6708('0x1c')]=function(_0x285075){try{if(!_[_0x6708('0x17')](dials[_0x285075['uniqueid']])){utils[_0x6708('0xb')](util[_0x6708('0x3')](_0x6708('0x1d'),_0x285075[_0x6708('0x5')]),_0x285075);dials[_0x285075[_0x6708('0x5')]]=_[_0x6708('0x1e')](dials[_0x285075[_0x6708('0x5')]],_0x285075);dials[_0x285075[_0x6708('0x5')]]['starttime']=utils[_0x6708('0x1f')]();dials[_0x285075[_0x6708('0x5')]][_0x6708('0x20')]='called';utils[_0x6708('0x2')](util[_0x6708('0x3')](_0x6708('0x21'),_0x285075[_0x6708('0x5')],dials[_0x285075[_0x6708('0x5')]][_0x6708('0x22')]));}}catch(_0x5941ae){utils['error'](util['format'](_0x6708('0x1d'),_0x285075[_0x6708('0x5')]),_0x5941ae);}};exports[_0x6708('0x23')]=function(_0x129276){try{if(!_[_0x6708('0x17')](dials[_0x129276['uniqueid']])){utils[_0x6708('0xb')](util[_0x6708('0x3')](_0x6708('0x24'),_0x129276[_0x6708('0x5')]),_0x129276);dials[_0x129276['uniqueid']][_0x6708('0x9')]=_0x129276['dialstatus'];if(_0x129276[_0x6708('0x9')]==_0x6708('0x25')){dials[_0x129276[_0x6708('0x5')]]=_[_0x6708('0x1e')](dials[_0x129276[_0x6708('0x5')]],_0x129276);dials[_0x129276['uniqueid']][_0x6708('0x26')]=utils['now']();dials[_0x129276['uniqueid']][_0x6708('0x20')]=_0x6708('0x27');utils[_0x6708('0x2')](util[_0x6708('0x3')](_0x6708('0x28'),_0x129276['uniqueid'],_0x129276[_0x6708('0x9')],dials[_0x129276['uniqueid']][_0x6708('0x26')]));}else{utils[_0x6708('0x2')](util[_0x6708('0x3')](_0x6708('0x29'),_0x129276['uniqueid'],_0x129276[_0x6708('0x9')]));}}}catch(_0xbf8a0d){utils[_0x6708('0x13')](util['format'](_0x6708('0x24'),_0x129276[_0x6708('0x5')]),_0xbf8a0d);}};exports['hangup']=function(_0x2d86bd){try{if(!_[_0x6708('0x17')](dials[_0x2d86bd[_0x6708('0x5')]])){utils[_0x6708('0xb')](util[_0x6708('0x3')](_0x6708('0x2a'),_0x2d86bd[_0x6708('0x5')]),_0x2d86bd);utils[_0x6708('0x2')](util['format']('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x2d86bd[_0x6708('0x5')],_0x2d86bd[_0x6708('0x2b')],_0x2d86bd['calleridname'],_0x2d86bd[_0x6708('0x2c')]));dials[_0x2d86bd[_0x6708('0x5')]]=_['assign'](dials[_0x2d86bd[_0x6708('0x5')]],{'endtime':utils[_0x6708('0x1f')](),'lastevent':_0x6708('0x2d')});dials[_0x2d86bd[_0x6708('0x5')]][_0x6708('0x2e')]=utils['diffTime'](dials[_0x2d86bd['uniqueid']][_0x6708('0x2f')],dials[_0x2d86bd['uniqueid']]['starttime']);dials[_0x2d86bd[_0x6708('0x5')]][_0x6708('0x30')]=utils[_0x6708('0x31')](dials[_0x2d86bd[_0x6708('0x5')]][_0x6708('0x26')]||dials[_0x2d86bd[_0x6708('0x5')]][_0x6708('0x2f')],dials[_0x2d86bd[_0x6708('0x5')]]['starttime']);dials[_0x2d86bd['uniqueid']][_0x6708('0x32')]=dials[_0x2d86bd[_0x6708('0x5')]][_0x6708('0x26')]?utils['diffTime'](dials[_0x2d86bd[_0x6708('0x5')]][_0x6708('0x2f')],dials[_0x2d86bd[_0x6708('0x5')]][_0x6708('0x26')]):0x0;writeDB(dials[_0x2d86bd['uniqueid']]);}}catch(_0x5c952d){utils[_0x6708('0x13')](util['format']('[%s][dials][hangup]',_0x2d86bd[_0x6708('0x5')]),_0x5c952d);}}; \ No newline at end of file +var _0x2b1c=['duration','diffTime','endtime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','dialstatus','newexten','[%s][dials][newexten]','uniqueid','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','set','startsWith','toLowerCase','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','debug','assign','starttime','now','lastevent','[%s][dials][dialbegin]','dialend','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname'];(function(_0x12dd21,_0x463fcd){var _0x2a4ff5=function(_0x558cd7){while(--_0x558cd7){_0x12dd21['push'](_0x12dd21['shift']());}};_0x2a4ff5(++_0x463fcd);}(_0x2b1c,0x94));var _0xc2b1=function(_0x1e39eb,_0x4ee3c0){_0x1e39eb=_0x1e39eb-0x0;var _0x535c78=_0x2b1c[_0x1e39eb];return _0x535c78;};'use strict';var _=require(_0xc2b1('0x0'));var util=require(_0xc2b1('0x1'));var utils=require(_0xc2b1('0x2'));var dials={};function writeDB(_0x3e4999){utils[_0xc2b1('0x3')](util[_0xc2b1('0x4')](_0xc2b1('0x5'),_0x3e4999['uniqueid'],_0x3e4999[_0xc2b1('0x6')],_0x3e4999[_0xc2b1('0x7')],_0x3e4999[_0xc2b1('0x8')],_0x3e4999['connectedlinenum'],_0x3e4999[_0xc2b1('0x9')]));utils['request']('CreateVoiceDialReport',_0x3e4999);delete dials[_0x3e4999['uniqueid']];}exports[_0xc2b1('0xa')]=function(_0x3b3184){try{utils['debug'](util[_0xc2b1('0x4')](_0xc2b1('0xb'),_0x3b3184[_0xc2b1('0xc')]),_0x3b3184);utils[_0xc2b1('0x3')](util[_0xc2b1('0x4')](_0xc2b1('0xd'),_0x3b3184[_0xc2b1('0xc')],_0x3b3184['application'],_0x3b3184['appdata']));if(_0x3b3184[_0xc2b1('0xe')]['toLowerCase']()==_0xc2b1('0xf')&&_[_0xc2b1('0x10')](_0x3b3184['appdata'][_0xc2b1('0x11')](),'cdr(routeid)')){var _0x493f14=_0x3b3184['appdata'][_0xc2b1('0x12')]('=');dials[_0x3b3184['uniqueid']]={'routeId':_0x493f14[0x1]};}}catch(_0x440754){utils[_0xc2b1('0x13')](util[_0xc2b1('0x4')]('[%s][dials][newexten]',_0x3b3184[_0xc2b1('0xc')]),_0x440754);}};exports[_0xc2b1('0x14')]=function(_0x1ba96e){try{utils['debug'](util[_0xc2b1('0x4')]('[%s][dials][varset]',_0x1ba96e[_0xc2b1('0xc')]),_0x1ba96e);if(!_[_0xc2b1('0x15')](_0x1ba96e[_0xc2b1('0x16')][_0xc2b1('0x17')])){utils[_0xc2b1('0x3')](util[_0xc2b1('0x4')](_0xc2b1('0x18'),_0x1ba96e[_0xc2b1('0xc')],_0x1ba96e[_0xc2b1('0x19')]));dials[_0x1ba96e[_0xc2b1('0xc')]]={'routeId':_0x1ba96e[_0xc2b1('0x19')]};}}catch(_0x393844){utils['error'](util[_0xc2b1('0x4')]('[%s][dials][varset]',_0x1ba96e[_0xc2b1('0xc')]),_0x393844);}};exports[_0xc2b1('0x1a')]=function(_0xe15981){try{if(!_[_0xc2b1('0x15')](dials[_0xe15981[_0xc2b1('0xc')]])){utils[_0xc2b1('0x1b')](util['format']('[%s][dials][dialbegin]',_0xe15981['uniqueid']),_0xe15981);dials[_0xe15981['uniqueid']]=_[_0xc2b1('0x1c')](dials[_0xe15981[_0xc2b1('0xc')]],_0xe15981);dials[_0xe15981[_0xc2b1('0xc')]][_0xc2b1('0x1d')]=utils[_0xc2b1('0x1e')]();dials[_0xe15981[_0xc2b1('0xc')]][_0xc2b1('0x1f')]='called';utils[_0xc2b1('0x3')](util[_0xc2b1('0x4')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0xe15981[_0xc2b1('0xc')],dials[_0xe15981[_0xc2b1('0xc')]]['starttime']));}}catch(_0x2b2eec){utils[_0xc2b1('0x13')](util[_0xc2b1('0x4')](_0xc2b1('0x20'),_0xe15981['uniqueid']),_0x2b2eec);}};exports[_0xc2b1('0x21')]=function(_0x57faf1){try{if(!_[_0xc2b1('0x15')](dials[_0x57faf1['uniqueid']])){utils['debug'](util[_0xc2b1('0x4')]('[%s][dials][dialend]',_0x57faf1[_0xc2b1('0xc')]),_0x57faf1);dials[_0x57faf1[_0xc2b1('0xc')]][_0xc2b1('0x9')]=_0x57faf1['dialstatus'];if(_0x57faf1[_0xc2b1('0x9')]==_0xc2b1('0x22')){dials[_0x57faf1[_0xc2b1('0xc')]]=_[_0xc2b1('0x1c')](dials[_0x57faf1['uniqueid']],_0x57faf1);dials[_0x57faf1[_0xc2b1('0xc')]][_0xc2b1('0x23')]=utils[_0xc2b1('0x1e')]();dials[_0x57faf1[_0xc2b1('0xc')]]['lastevent']=_0xc2b1('0x24');utils[_0xc2b1('0x3')](util[_0xc2b1('0x4')](_0xc2b1('0x25'),_0x57faf1[_0xc2b1('0xc')],_0x57faf1[_0xc2b1('0x9')],dials[_0x57faf1[_0xc2b1('0xc')]][_0xc2b1('0x23')]));}else{utils[_0xc2b1('0x3')](util[_0xc2b1('0x4')](_0xc2b1('0x26'),_0x57faf1[_0xc2b1('0xc')],_0x57faf1['dialstatus']));}}}catch(_0x4f2afc){utils['error'](util[_0xc2b1('0x4')](_0xc2b1('0x27'),_0x57faf1['uniqueid']),_0x4f2afc);}};exports[_0xc2b1('0x28')]=function(_0x562bed){try{if(!_[_0xc2b1('0x15')](dials[_0x562bed[_0xc2b1('0xc')]])){utils['debug'](util[_0xc2b1('0x4')](_0xc2b1('0x29'),_0x562bed[_0xc2b1('0xc')]),_0x562bed);utils['info'](util[_0xc2b1('0x4')](_0xc2b1('0x2a'),_0x562bed[_0xc2b1('0xc')],_0x562bed[_0xc2b1('0x8')],_0x562bed[_0xc2b1('0x2b')],_0x562bed['cause-txt']));dials[_0x562bed[_0xc2b1('0xc')]]=_[_0xc2b1('0x1c')](dials[_0x562bed[_0xc2b1('0xc')]],{'endtime':utils[_0xc2b1('0x1e')](),'lastevent':'complete'});dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x2c')]=utils[_0xc2b1('0x2d')](dials[_0x562bed[_0xc2b1('0xc')]]['endtime'],dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x1d')]);dials[_0x562bed[_0xc2b1('0xc')]]['holdtime']=utils[_0xc2b1('0x2d')](dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x23')]||dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x2e')],dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x1d')]);dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x2f')]=dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x23')]?utils[_0xc2b1('0x2d')](dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x2e')],dials[_0x562bed[_0xc2b1('0xc')]][_0xc2b1('0x23')]):0x0;writeDB(dials[_0x562bed['uniqueid']]);}}catch(_0x80c385){utils['error'](util[_0xc2b1('0x4')](_0xc2b1('0x29'),_0x562bed[_0xc2b1('0xc')]),_0x80c385);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index e0970f8..e55797f 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 _0x4e37=['xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','asterisk-manager','../../config/environment','./utils','util','port','asterisk','username','keepConnected'];(function(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x4e37,0x1b8));var _0x74e3=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x4e37[_0x17bb31];return _0x505c71;};var AsteriskManager=require(_0x74e3('0x0'));var config=require(_0x74e3('0x1'));var utils=require(_0x74e3('0x2'));var util=require(_0x74e3('0x3'));var ami=new AsteriskManager(config['asterisk'][_0x74e3('0x4')],config[_0x74e3('0x5')]['ip'],config['asterisk'][_0x74e3('0x6')],config[_0x74e3('0x5')]['password'],!![]);ami[_0x74e3('0x7')]();if(config[_0x74e3('0x8')]&&config[_0x74e3('0x8')]['disabled']){utils[_0x74e3('0x9')](_0x74e3('0xa'));}else{var agents=require(_0x74e3('0xb'));var calls=require(_0x74e3('0xc'));var queues=require('./queues.controller');var recordings=require(_0x74e3('0xd'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0x74e3('0xe'));var core=require(_0x74e3('0xf'));ami['on'](_0x74e3('0x10'),core[_0x74e3('0x10')]);ami['on']('shutdown',core['shutdown']);ami['on'](_0x74e3('0x11'),core[_0x74e3('0x11')]);ami['on'](_0x74e3('0x12'),core[_0x74e3('0x12')]);ami['on'](_0x74e3('0x13'),core['close']);ami['on'](_0x74e3('0x14'),core[_0x74e3('0x14')]);ami['on'](_0x74e3('0x15'),function(_0xc312e2){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x18'),_0xc312e2[_0x74e3('0x19')]),_0xc312e2);members[_0x74e3('0x15')](_0xc312e2);}catch(_0x10bd04){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x18'),_0xc312e2[_0x74e3('0x19')]),_0x10bd04);}});ami['on']('agentcalled',function(_0x5e8101){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x1a'),_0x5e8101[_0x74e3('0x1b')]),_0x5e8101);agents[_0x74e3('0x1c')](_0x5e8101);}catch(_0x252366){utils[_0x74e3('0x12')](util[_0x74e3('0x17')](_0x74e3('0x1a'),_0x5e8101[_0x74e3('0x1b')]),_0x252366);}});ami['on'](_0x74e3('0x1d'),function(_0x55f0a5){try{utils['debug'](util[_0x74e3('0x17')]('[%s][index][agentringnoanswer]',_0x55f0a5[_0x74e3('0x1b')]),_0x55f0a5);agents[_0x74e3('0x1d')](_0x55f0a5);}catch(_0x53dd98){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x1e'),_0x55f0a5[_0x74e3('0x1b')]),_0x53dd98);}});ami['on'](_0x74e3('0x1f'),function(_0x319fcb){try{utils['debug'](util[_0x74e3('0x17')](_0x74e3('0x20'),_0x319fcb[_0x74e3('0x1b')]),_0x319fcb);agents[_0x74e3('0x1f')](_0x319fcb);queues[_0x74e3('0x1f')](_0x319fcb);}catch(_0x4e89e6){utils[_0x74e3('0x12')](util[_0x74e3('0x17')](_0x74e3('0x20'),_0x319fcb['uniqueid']),_0x4e89e6);}});ami['on'](_0x74e3('0x21'),function(_0x354d89){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')]('[%s][index][agentcomplete]',_0x354d89[_0x74e3('0x1b')]),_0x354d89);agents['agentcomplete'](_0x354d89);queues[_0x74e3('0x21')](_0x354d89);members[_0x74e3('0x21')](_0x354d89);}catch(_0x671e90){utils[_0x74e3('0x12')](util[_0x74e3('0x17')](_0x74e3('0x22'),_0x354d89[_0x74e3('0x1b')]),_0x671e90);}});ami['on'](_0x74e3('0x23'),function(_0x5bb62a){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x24'),_0x5bb62a[_0x74e3('0x1b')]),_0x5bb62a);agents[_0x74e3('0x23')](_0x5bb62a);queues[_0x74e3('0x23')](_0x5bb62a);}catch(_0x1735bb){utils['error'](util['format'](_0x74e3('0x24'),_0x5bb62a[_0x74e3('0x1b')]),_0x1735bb);}});ami['on'](_0x74e3('0x25'),function(_0x59275e){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x26'),_0x59275e[_0x74e3('0x1b')]),_0x59275e);queues[_0x74e3('0x25')](_0x59275e);recordings['queuecallerjoin'](_0x59275e);}catch(_0x2c268c){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x26'),_0x59275e[_0x74e3('0x1b')]),_0x2c268c);}});ami['on'](_0x74e3('0x27'),function(_0x264d58){try{utils['debug'](util['format'](_0x74e3('0x28'),_0x264d58[_0x74e3('0x1b')]),_0x264d58);queues[_0x74e3('0x27')](_0x264d58);}catch(_0x4b09de){utils[_0x74e3('0x12')](util[_0x74e3('0x17')]('[%s][index][queuecallerleave]',_0x264d58['uniqueid']),_0x4b09de);}});ami['on'](_0x74e3('0x29'),function(_0x45b38f){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')]('[%s][index][musiconholdstart]',_0x45b38f['uniqueid']),_0x45b38f);queues['musiconholdstart'](_0x45b38f);calls[_0x74e3('0x29')](_0x45b38f);}catch(_0x2e021f){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x2a'),_0x45b38f[_0x74e3('0x1b')]),_0x2e021f);}});ami['on'](_0x74e3('0x2b'),function(_0x1a1b55){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x2c'),_0x1a1b55[_0x74e3('0x1b')]),_0x1a1b55);queues['musiconholdstop'](_0x1a1b55);calls[_0x74e3('0x2b')](_0x1a1b55);}catch(_0x415c57){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x2c'),_0x1a1b55[_0x74e3('0x1b')]),_0x415c57);}});ami['on'](_0x74e3('0x2d'),function(_0xc0ede4){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x2e'),_0xc0ede4[_0x74e3('0x1b')]),_0xc0ede4);calls['newstate'](_0xc0ede4);recordings[_0x74e3('0x2d')](_0xc0ede4);}catch(_0xab6b8e){utils[_0x74e3('0x12')](util[_0x74e3('0x17')](_0x74e3('0x2e'),_0xc0ede4[_0x74e3('0x1b')]),_0xab6b8e);}});ami['on']('hangup',function(_0x6446fe){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')]('[%s][index][hangup]',_0x6446fe['uniqueid']),_0x6446fe);calls[_0x74e3('0x2f')](_0x6446fe);recordings[_0x74e3('0x2f')](_0x6446fe);dials[_0x74e3('0x2f')](_0x6446fe);agents[_0x74e3('0x2f')](_0x6446fe);queues[_0x74e3('0x2f')](_0x6446fe);}catch(_0x39fa38){utils[_0x74e3('0x12')](util[_0x74e3('0x17')]('[%s][index][hangup]',_0x6446fe['uniqueid']),_0x39fa38);}});ami['on'](_0x74e3('0x30'),function(_0x12260b){try{utils[_0x74e3('0x16')](util['format'](_0x74e3('0x31'),_0x12260b[_0x74e3('0x1b')]),_0x12260b);members['cdr'](_0x12260b);}catch(_0x2b9348){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x31'),_0x12260b[_0x74e3('0x1b')]),_0x2b9348);}});ami['on'](_0x74e3('0x32'),function(_0x40b002){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x33'),_0x40b002[_0x74e3('0x1b')]),_0x40b002);queues[_0x74e3('0x32')](_0x40b002);agents[_0x74e3('0x32')](_0x40b002);transfers[_0x74e3('0x32')](_0x40b002);}catch(_0xba1508){utils[_0x74e3('0x12')](util['format']('[%s][index][blindtransfer]',_0x40b002[_0x74e3('0x1b')]),_0xba1508);}});ami['on'](_0x74e3('0x34'),function(_0x94898e){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')]('[%s][index][attendedtransfer]',_0x94898e['origtransfereruniqueid']),_0x94898e);queues['attendedtransfer'](_0x94898e);transfers[_0x74e3('0x34')](_0x94898e);agents[_0x74e3('0x34')](_0x94898e);calls[_0x74e3('0x34')](_0x94898e);}catch(_0x4a13db){utils[_0x74e3('0x12')](util[_0x74e3('0x17')](_0x74e3('0x35'),_0x94898e[_0x74e3('0x36')]),_0x4a13db);}});ami['on'](_0x74e3('0x37'),function(_0x1bb207){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x38'),_0x1bb207[_0x74e3('0x1b')]),_0x1bb207);queues['varset'](_0x1bb207);recordings['varset'](_0x1bb207);calls[_0x74e3('0x37')](_0x1bb207);dials[_0x74e3('0x37')](_0x1bb207);}catch(_0x5b2f84){utils[_0x74e3('0x12')](util[_0x74e3('0x17')]('[%s][index][varset]',_0x1bb207[_0x74e3('0x1b')]),_0x5b2f84);}});ami['on'](_0x74e3('0x39'),function(_0x5d46b5){try{utils['debug'](util['format'](_0x74e3('0x3a'),_0x5d46b5[_0x74e3('0x1b')]),_0x5d46b5);calls[_0x74e3('0x39')](_0x5d46b5);recordings[_0x74e3('0x39')](_0x5d46b5);dials[_0x74e3('0x39')](_0x5d46b5);}catch(_0x2d55d5){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x3a'),_0x5d46b5['uniqueid']),_0x2d55d5);}});ami['on'](_0x74e3('0x3b'),function(_0x2eb352){try{utils[_0x74e3('0x16')](util['format']('[%s][index][newchannel]',_0x2eb352[_0x74e3('0x1b')]),_0x2eb352);calls[_0x74e3('0x3b')](_0x2eb352);recordings[_0x74e3('0x3b')](_0x2eb352);}catch(_0x5b8d7b){utils['error'](util[_0x74e3('0x17')](_0x74e3('0x3c'),_0x2eb352[_0x74e3('0x1b')]),_0x5b8d7b);}});ami['on'](_0x74e3('0x3d'),function(_0xe33da1){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')](_0x74e3('0x3e'),_0xe33da1[_0x74e3('0x1b')]),_0xe33da1);dials['dialbegin'](_0xe33da1);}catch(_0x126fb1){utils[_0x74e3('0x12')](util[_0x74e3('0x17')](_0x74e3('0x3f'),_0xe33da1['uniqueid']),_0x126fb1);}});ami['on']('dialend',function(_0x56f88b){try{utils[_0x74e3('0x16')](util[_0x74e3('0x17')]('[%s][index][dialend]',_0x56f88b[_0x74e3('0x1b')]),_0x56f88b);dials['dialend'](_0x56f88b);}catch(_0x1b66df){utils['error'](util['format']('[%s][index][dialend]',_0x56f88b[_0x74e3('0x1b')]),_0x1b66df);}});} \ No newline at end of file +var _0x2ca3=['hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./calls.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','debug','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]'];(function(_0x44fcfa,_0x5538d1){var _0xba6657=function(_0x56743d){while(--_0x56743d){_0x44fcfa['push'](_0x44fcfa['shift']());}};_0xba6657(++_0x5538d1);}(_0x2ca3,0x1ab));var _0x32ca=function(_0x4d741b,_0x2fbc11){_0x4d741b=_0x4d741b-0x0;var _0x495700=_0x2ca3[_0x4d741b];return _0x495700;};var AsteriskManager=require(_0x32ca('0x0'));var config=require(_0x32ca('0x1'));var utils=require(_0x32ca('0x2'));var util=require(_0x32ca('0x3'));var ami=new AsteriskManager(config[_0x32ca('0x4')][_0x32ca('0x5')],config[_0x32ca('0x4')]['ip'],config['asterisk'][_0x32ca('0x6')],config[_0x32ca('0x4')][_0x32ca('0x7')],!![]);ami[_0x32ca('0x8')]();if(config['xdr']&&config[_0x32ca('0x9')][_0x32ca('0xa')]){utils[_0x32ca('0xb')](_0x32ca('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x32ca('0xd'));var queues=require(_0x32ca('0xe'));var recordings=require('./recordings.controller');var members=require(_0x32ca('0xf'));var dials=require(_0x32ca('0x10'));var transfers=require('./transfers.controller');var core=require(_0x32ca('0x11'));ami['on']('connect',core[_0x32ca('0x12')]);ami['on'](_0x32ca('0x13'),core[_0x32ca('0x13')]);ami['on'](_0x32ca('0x14'),core[_0x32ca('0x14')]);ami['on'](_0x32ca('0x15'),core['error']);ami['on'](_0x32ca('0x16'),core[_0x32ca('0x16')]);ami['on'](_0x32ca('0x17'),core[_0x32ca('0x17')]);ami['on'](_0x32ca('0x18'),function(_0x1866b6){try{utils['debug'](util[_0x32ca('0x19')](_0x32ca('0x1a'),_0x1866b6[_0x32ca('0x1b')]),_0x1866b6);members[_0x32ca('0x18')](_0x1866b6);}catch(_0x4137ea){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x1a'),_0x1866b6['device']),_0x4137ea);}});ami['on'](_0x32ca('0x1c'),function(_0x356f7f){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x1e'),_0x356f7f[_0x32ca('0x1f')]),_0x356f7f);agents[_0x32ca('0x1c')](_0x356f7f);}catch(_0x6c77f8){utils[_0x32ca('0x15')](util['format'](_0x32ca('0x1e'),_0x356f7f[_0x32ca('0x1f')]),_0x6c77f8);}});ami['on']('agentringnoanswer',function(_0x2f95ba){try{utils['debug'](util[_0x32ca('0x19')]('[%s][index][agentringnoanswer]',_0x2f95ba['uniqueid']),_0x2f95ba);agents['agentringnoanswer'](_0x2f95ba);}catch(_0x26ba84){utils[_0x32ca('0x15')](util['format'](_0x32ca('0x20'),_0x2f95ba[_0x32ca('0x1f')]),_0x26ba84);}});ami['on'](_0x32ca('0x21'),function(_0xd9ebeb){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')]('[%s][index][agentconnect]',_0xd9ebeb[_0x32ca('0x1f')]),_0xd9ebeb);agents[_0x32ca('0x21')](_0xd9ebeb);queues[_0x32ca('0x21')](_0xd9ebeb);}catch(_0x2e81a5){utils['error'](util[_0x32ca('0x19')](_0x32ca('0x22'),_0xd9ebeb['uniqueid']),_0x2e81a5);}});ami['on']('agentcomplete',function(_0x1191cd){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x23'),_0x1191cd[_0x32ca('0x1f')]),_0x1191cd);agents['agentcomplete'](_0x1191cd);queues[_0x32ca('0x24')](_0x1191cd);members[_0x32ca('0x24')](_0x1191cd);}catch(_0x16817f){utils[_0x32ca('0x15')](util[_0x32ca('0x19')]('[%s][index][agentcomplete]',_0x1191cd['uniqueid']),_0x16817f);}});ami['on'](_0x32ca('0x25'),function(_0x3f5d9a){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x26'),_0x3f5d9a['uniqueid']),_0x3f5d9a);agents['queuecallerabandon'](_0x3f5d9a);queues[_0x32ca('0x25')](_0x3f5d9a);}catch(_0x53a02a){utils[_0x32ca('0x15')](util['format']('[%s][index][queuecallerabandon]',_0x3f5d9a['uniqueid']),_0x53a02a);}});ami['on']('queuecallerjoin',function(_0x42c75a){try{utils['debug'](util[_0x32ca('0x19')](_0x32ca('0x27'),_0x42c75a[_0x32ca('0x1f')]),_0x42c75a);queues['queuecallerjoin'](_0x42c75a);recordings[_0x32ca('0x28')](_0x42c75a);}catch(_0x59622a){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x27'),_0x42c75a['uniqueid']),_0x59622a);}});ami['on'](_0x32ca('0x29'),function(_0x262b60){try{utils['debug'](util[_0x32ca('0x19')]('[%s][index][queuecallerleave]',_0x262b60[_0x32ca('0x1f')]),_0x262b60);queues[_0x32ca('0x29')](_0x262b60);}catch(_0x137758){utils[_0x32ca('0x15')](util['format'](_0x32ca('0x2a'),_0x262b60[_0x32ca('0x1f')]),_0x137758);}});ami['on'](_0x32ca('0x2b'),function(_0xb46bdc){try{utils['debug'](util[_0x32ca('0x19')](_0x32ca('0x2c'),_0xb46bdc['uniqueid']),_0xb46bdc);queues[_0x32ca('0x2b')](_0xb46bdc);calls['musiconholdstart'](_0xb46bdc);}catch(_0x27cd88){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x2c'),_0xb46bdc[_0x32ca('0x1f')]),_0x27cd88);}});ami['on']('musiconholdstop',function(_0x5351c2){try{utils['debug'](util[_0x32ca('0x19')](_0x32ca('0x2d'),_0x5351c2[_0x32ca('0x1f')]),_0x5351c2);queues[_0x32ca('0x2e')](_0x5351c2);calls[_0x32ca('0x2e')](_0x5351c2);}catch(_0x28bb55){utils['error'](util[_0x32ca('0x19')]('[%s][index][musiconholdstop]',_0x5351c2[_0x32ca('0x1f')]),_0x28bb55);}});ami['on'](_0x32ca('0x2f'),function(_0x2ecf12){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')]('[%s][index][newstate]',_0x2ecf12[_0x32ca('0x1f')]),_0x2ecf12);calls[_0x32ca('0x2f')](_0x2ecf12);recordings[_0x32ca('0x2f')](_0x2ecf12);}catch(_0x15aa3a){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x30'),_0x2ecf12['uniqueid']),_0x15aa3a);}});ami['on'](_0x32ca('0x31'),function(_0xe939d1){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x32'),_0xe939d1[_0x32ca('0x1f')]),_0xe939d1);calls[_0x32ca('0x31')](_0xe939d1);recordings[_0x32ca('0x31')](_0xe939d1);dials[_0x32ca('0x31')](_0xe939d1);agents[_0x32ca('0x31')](_0xe939d1);queues[_0x32ca('0x31')](_0xe939d1);}catch(_0xb4b57c){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x32'),_0xe939d1[_0x32ca('0x1f')]),_0xb4b57c);}});ami['on'](_0x32ca('0x33'),function(_0x3ee93a){try{utils['debug'](util[_0x32ca('0x19')](_0x32ca('0x34'),_0x3ee93a['uniqueid']),_0x3ee93a);members['cdr'](_0x3ee93a);}catch(_0x75e716){utils['error'](util[_0x32ca('0x19')](_0x32ca('0x34'),_0x3ee93a[_0x32ca('0x1f')]),_0x75e716);}});ami['on'](_0x32ca('0x35'),function(_0x59f75d){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0x59f75d[_0x32ca('0x1f')]),_0x59f75d);queues[_0x32ca('0x35')](_0x59f75d);agents[_0x32ca('0x35')](_0x59f75d);transfers[_0x32ca('0x35')](_0x59f75d);}catch(_0x41d360){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x36'),_0x59f75d['uniqueid']),_0x41d360);}});ami['on']('attendedtransfer',function(_0x421b45){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x37'),_0x421b45['origtransfereruniqueid']),_0x421b45);queues[_0x32ca('0x38')](_0x421b45);transfers[_0x32ca('0x38')](_0x421b45);agents[_0x32ca('0x38')](_0x421b45);calls[_0x32ca('0x38')](_0x421b45);}catch(_0x332bb4){utils[_0x32ca('0x15')](util['format'](_0x32ca('0x37'),_0x421b45[_0x32ca('0x39')]),_0x332bb4);}});ami['on']('varset',function(_0x505c4e){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x3a'),_0x505c4e[_0x32ca('0x1f')]),_0x505c4e);queues['varset'](_0x505c4e);recordings[_0x32ca('0x3b')](_0x505c4e);calls[_0x32ca('0x3b')](_0x505c4e);dials['varset'](_0x505c4e);}catch(_0x1e02db){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x3a'),_0x505c4e[_0x32ca('0x1f')]),_0x1e02db);}});ami['on']('newexten',function(_0x526d01){try{utils['debug'](util[_0x32ca('0x19')]('[%s][index][newexten]',_0x526d01[_0x32ca('0x1f')]),_0x526d01);calls[_0x32ca('0x3c')](_0x526d01);recordings[_0x32ca('0x3c')](_0x526d01);dials[_0x32ca('0x3c')](_0x526d01);}catch(_0x1440f7){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x3d'),_0x526d01[_0x32ca('0x1f')]),_0x1440f7);}});ami['on']('newchannel',function(_0x28e4a0){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')]('[%s][index][newchannel]',_0x28e4a0[_0x32ca('0x1f')]),_0x28e4a0);calls[_0x32ca('0x3e')](_0x28e4a0);recordings[_0x32ca('0x3e')](_0x28e4a0);}catch(_0xbcf315){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x3f'),_0x28e4a0[_0x32ca('0x1f')]),_0xbcf315);}});ami['on'](_0x32ca('0x40'),function(_0x1310c5){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x41'),_0x1310c5[_0x32ca('0x1f')]),_0x1310c5);dials[_0x32ca('0x40')](_0x1310c5);}catch(_0x9306ac){utils[_0x32ca('0x15')](util[_0x32ca('0x19')]('[%s]dialbegin',_0x1310c5['uniqueid']),_0x9306ac);}});ami['on'](_0x32ca('0x42'),function(_0x48b8ff){try{utils[_0x32ca('0x1d')](util[_0x32ca('0x19')](_0x32ca('0x43'),_0x48b8ff[_0x32ca('0x1f')]),_0x48b8ff);dials[_0x32ca('0x42')](_0x48b8ff);}catch(_0x58c70c){utils[_0x32ca('0x15')](util[_0x32ca('0x19')](_0x32ca('0x43'),_0x48b8ff[_0x32ca('0x1f')]),_0x58c70c);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 8b2e9d6..9696080 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 _0xfbb0=['[%s][members][writeDB]','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','NOT_INUSE','isNil','now','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','debug','[%s][members][cdr]','channel','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','type','getUserByInterface','interface','then','membername','name','internal','request','getUserByName','split','CreateMemberReport','catch','error'];(function(_0x5a3d68,_0xef0d85){var _0x4ca6bd=function(_0x443d3e){while(--_0x443d3e){_0x5a3d68['push'](_0x5a3d68['shift']());}};_0x4ca6bd(++_0xef0d85);}(_0xfbb0,0x1d1));var _0x0fbb=function(_0x258f52,_0x40da1f){_0x258f52=_0x258f52-0x0;var _0x2d8cbc=_0xfbb0[_0x258f52];return _0x2d8cbc;};'use strict';var _=require(_0x0fbb('0x0'));var util=require(_0x0fbb('0x1'));var utils=require('./utils');var members={};var exclude=[_0x0fbb('0x2'),_0x0fbb('0x3')];function writeDB(_0x137328){utils[_0x0fbb('0x4')](util[_0x0fbb('0x5')](_0x0fbb('0x6'),_0x137328[_0x0fbb('0x7')],_0x137328['interface'],_0x137328['channel'],_0x137328['data2'],_0x137328['membername'],_0x137328[_0x0fbb('0x8')]));if(_0x137328['interface']){utils[_0x0fbb('0x9')](_0x137328[_0x0fbb('0xa')])[_0x0fbb('0xb')](function(_0xc97cbc){if(_0xc97cbc){_0x137328[_0x0fbb('0xc')]=_0xc97cbc[_0x0fbb('0xd')];_0x137328[_0x0fbb('0xe')]=_0xc97cbc[_0x0fbb('0xe')];utils[_0x0fbb('0xf')]('CreateMemberReport',_0x137328);}else{utils[_0x0fbb('0x10')](_0x137328['interface'][_0x0fbb('0x11')]('/')[0x1])[_0x0fbb('0xb')](function(_0x3bb64c){if(_0x3bb64c){_0x137328[_0x0fbb('0xc')]=_0x3bb64c[_0x0fbb('0xd')];_0x137328['internal']=_0x3bb64c[_0x0fbb('0xe')];utils[_0x0fbb('0xf')](_0x0fbb('0x12'),_0x137328);}});}})[_0x0fbb('0x13')](function(_0x43b95d){utils[_0x0fbb('0x14')](util[_0x0fbb('0x5')](_0x0fbb('0x15'),_0x137328[_0x0fbb('0x7')]),_0x43b95d);});}delete members[_0x137328[_0x0fbb('0xa')]];}function startsWith(_0x2bc5d8,_0x2c2dcb){return _['some'](_0x2bc5d8,function(_0xf8b50e){return _[_0x0fbb('0x16')](_0x2c2dcb,_0xf8b50e);});}exports[_0x0fbb('0x17')]=function(_0x554b19){try{utils['debug'](util['format'](_0x0fbb('0x18'),members[_0x554b19[_0x0fbb('0x19')]]?members[_0x554b19[_0x0fbb('0x19')]][_0x0fbb('0x7')]:_0x554b19[_0x0fbb('0x19')]),_0x554b19);utils[_0x0fbb('0x4')](util[_0x0fbb('0x5')](_0x0fbb('0x1a'),members[_0x554b19[_0x0fbb('0x19')]]?members[_0x554b19[_0x0fbb('0x19')]][_0x0fbb('0x7')]:_0x554b19[_0x0fbb('0x19')],_0x554b19[_0x0fbb('0x1b')],_0x554b19[_0x0fbb('0x19')]));switch(_0x554b19[_0x0fbb('0x1b')]){case _0x0fbb('0x1c'):case _0x0fbb('0x1d'):if(!startsWith(exclude,_0x554b19['device'])){members[_0x554b19['device']]={'channel':_0x0fbb('0x1e'),'interface':_0x554b19[_0x0fbb('0x19')],'type':_0x0fbb('0x1f'),'enterAt':utils['now'](),'role':'agent'};}break;case _0x0fbb('0x20'):if(!_[_0x0fbb('0x21')](members[_0x554b19['device']])){members[_0x554b19[_0x0fbb('0x19')]]['exitAt']=utils[_0x0fbb('0x22')]();members[_0x554b19['device']][_0x0fbb('0x23')]=utils[_0x0fbb('0x24')](members[_0x554b19[_0x0fbb('0x19')]][_0x0fbb('0x25')],members[_0x554b19['device']][_0x0fbb('0x26')]);if(members[_0x554b19['device']][_0x0fbb('0x7')]){writeDB(members[_0x554b19['device']]);}}break;default:break;}}catch(_0x42ce74){utils['error'](util[_0x0fbb('0x5')](_0x0fbb('0x18'),members[_0x554b19[_0x0fbb('0x19')]]?members[_0x554b19[_0x0fbb('0x19')]][_0x0fbb('0x7')]:_0x554b19[_0x0fbb('0x19')]),_0x42ce74);}};exports['agentcomplete']=function(_0x133669){try{if(!_[_0x0fbb('0x21')](members[_0x133669[_0x0fbb('0xa')]])){utils['debug'](util[_0x0fbb('0x5')](_0x0fbb('0x27'),_0x133669[_0x0fbb('0x7')]),_0x133669);utils[_0x0fbb('0x4')](util['format'](_0x0fbb('0x28'),_0x133669[_0x0fbb('0x7')],_0x133669['interface'],_0x133669[_0x0fbb('0x29')]));members[_0x133669[_0x0fbb('0xa')]]=_[_0x0fbb('0x2a')](members[_0x133669['interface']],{'data4':_0x133669[_0x0fbb('0x29')],'uniqueid':_0x133669[_0x0fbb('0x7')]});}}catch(_0x2a5c27){utils[_0x0fbb('0x14')](util[_0x0fbb('0x5')]('[%s][members][agentcomplete]',_0x133669[_0x0fbb('0x7')]),_0x2a5c27);}};exports[_0x0fbb('0x2b')]=function(_0x1363db){try{utils[_0x0fbb('0x2c')](util[_0x0fbb('0x5')](_0x0fbb('0x2d'),_0x1363db[_0x0fbb('0x7')]),_0x1363db);if(_0x1363db[_0x0fbb('0x2e')]){var _0x551abe=_0x1363db[_0x0fbb('0x2e')]['split']('-')[0x0];if(!_[_0x0fbb('0x21')](members[_0x551abe])){members[_0x551abe]=_[_0x0fbb('0x2a')](members[_0x551abe],{'data1':members[_0x551abe][_0x0fbb('0x2f')]||_0x1363db[_0x0fbb('0x8')],'data2':members[_0x551abe][_0x0fbb('0x30')]||_0x1363db[_0x0fbb('0x31')],'data3':members[_0x551abe][_0x0fbb('0x32')]||_0x1363db[_0x0fbb('0x33')],'uniqueid':members[_0x551abe]['uniqueid']||_0x1363db['uniqueid']});utils['info'](util[_0x0fbb('0x5')](_0x0fbb('0x34'),_0x1363db[_0x0fbb('0x7')],members[_0x551abe][_0x0fbb('0x2f')],members[_0x551abe][_0x0fbb('0x30')],members[_0x551abe][_0x0fbb('0x32')]));if(members[_0x551abe]['exitAt']){writeDB(members[_0x551abe]);}}}if(_0x1363db[_0x0fbb('0x35')]){var _0x3ec0d7=_0x1363db['destinationchannel']['split']('-')[0x0];if(!_['isNil'](members[_0x3ec0d7])){members[_0x3ec0d7]=_[_0x0fbb('0x2a')](members[_0x3ec0d7],{'data1':members[_0x3ec0d7]['data1']||_0x1363db[_0x0fbb('0x8')],'data2':members[_0x3ec0d7][_0x0fbb('0x30')]||_0x1363db[_0x0fbb('0x31')],'data3':members[_0x3ec0d7]['data3']||_0x1363db[_0x0fbb('0x33')],'uniqueid':members[_0x3ec0d7][_0x0fbb('0x7')]||_0x1363db[_0x0fbb('0x7')]});utils[_0x0fbb('0x4')](util[_0x0fbb('0x5')](_0x0fbb('0x34'),_0x1363db[_0x0fbb('0x7')],members[_0x3ec0d7][_0x0fbb('0x2f')],members[_0x3ec0d7][_0x0fbb('0x30')],members[_0x3ec0d7][_0x0fbb('0x32')]));if(members[_0x3ec0d7][_0x0fbb('0x25')]){writeDB(members[_0x3ec0d7]);}}}}catch(_0x5bb8c1){utils[_0x0fbb('0x14')](util[_0x0fbb('0x5')](_0x0fbb('0x2d'),_0x1363db[_0x0fbb('0x7')]),_0x5bb8c1);}}; \ No newline at end of file +var _0xcca0=['agent','NOT_INUSE','isNil','exitAt','duration','enterAt','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','type','source','data3','destination','data1','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','getUserByInterface','then','internal','CreateMemberReport','getUserByName','split','name','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xcca0,0x1d3));var _0x0cca=function(_0x56e3f2,_0x4c3db1){_0x56e3f2=_0x56e3f2-0x0;var _0x1a0106=_0xcca0[_0x56e3f2];return _0x1a0106;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x0cca('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x0cca('0x1')];function writeDB(_0x60637f){utils[_0x0cca('0x2')](util[_0x0cca('0x3')](_0x0cca('0x4'),_0x60637f[_0x0cca('0x5')],_0x60637f[_0x0cca('0x6')],_0x60637f[_0x0cca('0x7')],_0x60637f[_0x0cca('0x8')],_0x60637f[_0x0cca('0x9')],_0x60637f['type']));if(_0x60637f[_0x0cca('0x6')]){utils[_0x0cca('0xa')](_0x60637f[_0x0cca('0x6')])[_0x0cca('0xb')](function(_0x5682a7){if(_0x5682a7){_0x60637f[_0x0cca('0x9')]=_0x5682a7['name'];_0x60637f['internal']=_0x5682a7[_0x0cca('0xc')];utils['request'](_0x0cca('0xd'),_0x60637f);}else{utils[_0x0cca('0xe')](_0x60637f['interface'][_0x0cca('0xf')]('/')[0x1])[_0x0cca('0xb')](function(_0x39d81e){if(_0x39d81e){_0x60637f[_0x0cca('0x9')]=_0x39d81e[_0x0cca('0x10')];_0x60637f['internal']=_0x39d81e[_0x0cca('0xc')];utils['request']('CreateMemberReport',_0x60637f);}});}})[_0x0cca('0x11')](function(_0x320210){utils[_0x0cca('0x12')](util[_0x0cca('0x3')](_0x0cca('0x13'),_0x60637f[_0x0cca('0x5')]),_0x320210);});}delete members[_0x60637f[_0x0cca('0x6')]];}function startsWith(_0x4544de,_0x48de99){return _[_0x0cca('0x14')](_0x4544de,function(_0x4e694d){return _[_0x0cca('0x15')](_0x48de99,_0x4e694d);});}exports[_0x0cca('0x16')]=function(_0x3bdfbe){try{utils[_0x0cca('0x17')](util['format'](_0x0cca('0x18'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x5')]:_0x3bdfbe[_0x0cca('0x19')]),_0x3bdfbe);utils[_0x0cca('0x2')](util['format'](_0x0cca('0x1a'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe['device']]['uniqueid']:_0x3bdfbe[_0x0cca('0x19')],_0x3bdfbe[_0x0cca('0x1b')],_0x3bdfbe[_0x0cca('0x19')]));switch(_0x3bdfbe[_0x0cca('0x1b')]){case _0x0cca('0x1c'):case _0x0cca('0x1d'):if(!startsWith(exclude,_0x3bdfbe[_0x0cca('0x19')])){members[_0x3bdfbe[_0x0cca('0x19')]]={'channel':_0x0cca('0x1e'),'interface':_0x3bdfbe['device'],'type':_0x0cca('0x1f'),'enterAt':utils[_0x0cca('0x20')](),'role':_0x0cca('0x21')};}break;case _0x0cca('0x22'):if(!_[_0x0cca('0x23')](members[_0x3bdfbe[_0x0cca('0x19')]])){members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x24')]=utils[_0x0cca('0x20')]();members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x25')]=utils['diffTime'](members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x24')],members[_0x3bdfbe[_0x0cca('0x19')]][_0x0cca('0x26')]);if(members[_0x3bdfbe['device']][_0x0cca('0x5')]){writeDB(members[_0x3bdfbe[_0x0cca('0x19')]]);}}break;default:break;}}catch(_0xa2fe58){utils['error'](util[_0x0cca('0x3')](_0x0cca('0x18'),members[_0x3bdfbe[_0x0cca('0x19')]]?members[_0x3bdfbe['device']]['uniqueid']:_0x3bdfbe[_0x0cca('0x19')]),_0xa2fe58);}};exports['agentcomplete']=function(_0x38f513){try{if(!_[_0x0cca('0x23')](members[_0x38f513[_0x0cca('0x6')]])){utils[_0x0cca('0x17')](util[_0x0cca('0x3')]('[%s][members][agentcomplete]',_0x38f513[_0x0cca('0x5')]),_0x38f513);utils[_0x0cca('0x2')](util[_0x0cca('0x3')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x38f513[_0x0cca('0x5')],_0x38f513['interface'],_0x38f513['queue']));members[_0x38f513['interface']]=_[_0x0cca('0x27')](members[_0x38f513[_0x0cca('0x6')]],{'data4':_0x38f513['queue'],'uniqueid':_0x38f513[_0x0cca('0x5')]});}}catch(_0x475a23){utils['error'](util['format'](_0x0cca('0x28'),_0x38f513[_0x0cca('0x5')]),_0x475a23);}};exports[_0x0cca('0x29')]=function(_0x2949f3){try{utils['debug'](util[_0x0cca('0x3')](_0x0cca('0x2a'),_0x2949f3[_0x0cca('0x5')]),_0x2949f3);if(_0x2949f3[_0x0cca('0x7')]){var _0x22d210=_0x2949f3['channel'][_0x0cca('0xf')]('-')[0x0];if(!_[_0x0cca('0x23')](members[_0x22d210])){members[_0x22d210]=_[_0x0cca('0x27')](members[_0x22d210],{'data1':members[_0x22d210]['data1']||_0x2949f3[_0x0cca('0x2b')],'data2':members[_0x22d210]['data2']||_0x2949f3[_0x0cca('0x2c')],'data3':members[_0x22d210][_0x0cca('0x2d')]||_0x2949f3[_0x0cca('0x2e')],'uniqueid':members[_0x22d210][_0x0cca('0x5')]||_0x2949f3[_0x0cca('0x5')]});utils[_0x0cca('0x2')](util[_0x0cca('0x3')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2949f3[_0x0cca('0x5')],members[_0x22d210][_0x0cca('0x2f')],members[_0x22d210][_0x0cca('0x8')],members[_0x22d210][_0x0cca('0x2d')]));if(members[_0x22d210][_0x0cca('0x24')]){writeDB(members[_0x22d210]);}}}if(_0x2949f3['destinationchannel']){var _0x378976=_0x2949f3[_0x0cca('0x30')][_0x0cca('0xf')]('-')[0x0];if(!_[_0x0cca('0x23')](members[_0x378976])){members[_0x378976]=_['assign'](members[_0x378976],{'data1':members[_0x378976][_0x0cca('0x2f')]||_0x2949f3['type'],'data2':members[_0x378976][_0x0cca('0x8')]||_0x2949f3[_0x0cca('0x2c')],'data3':members[_0x378976]['data3']||_0x2949f3[_0x0cca('0x2e')],'uniqueid':members[_0x378976]['uniqueid']||_0x2949f3['uniqueid']});utils[_0x0cca('0x2')](util[_0x0cca('0x3')](_0x0cca('0x31'),_0x2949f3[_0x0cca('0x5')],members[_0x378976][_0x0cca('0x2f')],members[_0x378976][_0x0cca('0x8')],members[_0x378976]['data3']));if(members[_0x378976][_0x0cca('0x24')]){writeDB(members[_0x378976]);}}}}catch(_0x3fa7a5){utils[_0x0cca('0x12')](util[_0x0cca('0x3')](_0x0cca('0x2a'),_0x2949f3[_0x0cca('0x5')]),_0x3fa7a5);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 29b122a..565ff27 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 _0x8ad0=['COMPLETEDBY','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfererlinkedid','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','queuecallerexitreason','name','queuecallerenterreason','[%s][queues][hangup]','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','membername','agentcomplete','assigned','queuecallercomplete','reason','transfer','TRANSFER'];(function(_0x53bcc3,_0x364374){var _0x47c959=function(_0x40ef7d){while(--_0x40ef7d){_0x53bcc3['push'](_0x53bcc3['shift']());}};_0x47c959(++_0x364374);}(_0x8ad0,0x1c5));var _0x08ad=function(_0x4d6cc2,_0x373626){_0x4d6cc2=_0x4d6cc2-0x0;var _0x10cdcf=_0x8ad0[_0x4d6cc2];return _0x10cdcf;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x08ad('0x0'));var queues={};function writeDB(_0x3c3621){utils[_0x08ad('0x1')](util['format'](_0x08ad('0x2'),_0x3c3621[_0x08ad('0x3')],_0x3c3621['channel'],_0x3c3621[_0x08ad('0x4')],_0x3c3621[_0x08ad('0x5')],_0x3c3621[_0x08ad('0x6')],_0x3c3621[_0x08ad('0x7')],_0x3c3621['queuecallerexitreason']));if(_0x3c3621[_0x08ad('0x4')]){utils['getVoiceQueueByName'](_0x3c3621[_0x08ad('0x4')])[_0x08ad('0x8')](function(_0x269cc4){if(_0x269cc4){_0x3c3621[_0x08ad('0x9')]=_0x269cc4['type'];}utils[_0x08ad('0xa')](_0x08ad('0xb'),_0x3c3621);});}else{utils[_0x08ad('0xa')]('CreateVoiceQueueReport',_0x3c3621);}if(_0x3c3621[_0x08ad('0xc')]){delete queues[_0x3c3621[_0x08ad('0xc')]];}else{delete queues[_0x3c3621[_0x08ad('0x3')]];}}exports[_0x08ad('0xd')]=function(_0x441132){try{utils['debug'](util[_0x08ad('0xe')]('[%s][queues][queuecallerjoin]',_0x441132[_0x08ad('0x3')]),_0x441132);utils[_0x08ad('0x1')](util['format'](_0x08ad('0xf'),_0x441132[_0x08ad('0x3')],_0x441132[_0x08ad('0x4')],_0x441132[_0x08ad('0x10')]));queues[_0x441132[_0x08ad('0x3')]]=_[_0x08ad('0x11')](_0x441132,{'originalposition':_0x441132[_0x08ad('0x10')],'queuecallerjoinAt':utils[_0x08ad('0x12')](),'mohtime':0x0});}catch(_0x53f620){utils[_0x08ad('0x13')](util[_0x08ad('0xe')](_0x08ad('0x14'),_0x441132[_0x08ad('0x3')]),_0x53f620);}};exports[_0x08ad('0x15')]=function(_0x4bacd5){try{if(!_[_0x08ad('0x16')](queues[_0x4bacd5['uniqueid']])){utils[_0x08ad('0x17')](util[_0x08ad('0xe')]('[%s][queues][hangup]',_0x4bacd5[_0x08ad('0x3')]),_0x4bacd5);if(queues[_0x4bacd5[_0x08ad('0x3')]][_0x08ad('0x18')]){if(!queues[_0x4bacd5['uniqueid']][_0x08ad('0x19')]&&!queues[_0x4bacd5[_0x08ad('0x3')]][_0x08ad('0x1a')]){queues[_0x4bacd5[_0x08ad('0x3')]]['queuecallercomplete']=!![];queues[_0x4bacd5[_0x08ad('0x3')]][_0x08ad('0x1b')]=utils[_0x08ad('0x12')]();queues[_0x4bacd5[_0x08ad('0x3')]]['queuecallerexitreason']=_0x08ad('0x1c');}utils[_0x08ad('0x1')](util['format'](_0x08ad('0x1d'),_0x4bacd5[_0x08ad('0x3')],queues[_0x4bacd5['uniqueid']]['name'],queues[_0x4bacd5[_0x08ad('0x3')]][_0x08ad('0x1e')]));writeDB(queues[_0x4bacd5['uniqueid']]);}else if(queues[_0x4bacd5[_0x08ad('0x3')]]['transfereduniqueid']){utils[_0x08ad('0x1')](util[_0x08ad('0xe')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4bacd5[_0x08ad('0x3')],queues[_0x4bacd5['uniqueid']][_0x08ad('0x1f')],queues[_0x4bacd5[_0x08ad('0x3')]][_0x08ad('0xc')]));queues[queues[_0x4bacd5[_0x08ad('0x3')]][_0x08ad('0xc')]]=queues[_0x4bacd5[_0x08ad('0x3')]];queues[queues[_0x4bacd5[_0x08ad('0x3')]][_0x08ad('0xc')]][_0x08ad('0x20')]=0x2;delete queues[_0x4bacd5[_0x08ad('0x3')]];}}}catch(_0x1adbb7){utils[_0x08ad('0x13')](util[_0x08ad('0xe')](_0x08ad('0x21'),_0x4bacd5[_0x08ad('0x3')]),_0x1adbb7);}};exports[_0x08ad('0x22')]=function(_0x17bb27){try{utils[_0x08ad('0x17')](util['format']('[%s][queues][varset]',_0x17bb27['uniqueid']),_0x17bb27);if(!_[_0x08ad('0x16')](_0x17bb27[_0x08ad('0x23')][_0x08ad('0x24')])&&_0x17bb27[_0x08ad('0x25')][_0x08ad('0x26')]()!==_0x08ad('0x27')){if(!_[_0x08ad('0x16')](queues[_0x17bb27['uniqueid']])){queues[_0x17bb27[_0x08ad('0x3')]]['queuecallerabandon']=![];queues[_0x17bb27[_0x08ad('0x3')]][_0x08ad('0x28')]=null;queues[_0x17bb27[_0x08ad('0x3')]][_0x08ad('0x1a')]=!![];queues[_0x17bb27['uniqueid']][_0x08ad('0x29')]=utils['now']();queues[_0x17bb27[_0x08ad('0x3')]][_0x08ad('0x1e')]=_0x17bb27['value'][_0x08ad('0x26')]();utils[_0x08ad('0x1')](util[_0x08ad('0xe')](_0x08ad('0x2a'),_0x17bb27[_0x08ad('0x3')],queues[_0x17bb27['uniqueid']]['name'],_0x17bb27[_0x08ad('0x25')],queues[_0x17bb27[_0x08ad('0x3')]][_0x08ad('0x1e')]));writeDB(queues[_0x17bb27[_0x08ad('0x3')]]);}}else if(!_[_0x08ad('0x16')](_0x17bb27[_0x08ad('0x23')][_0x08ad('0x2b')])){if(!_['isNil'](queues[_0x17bb27[_0x08ad('0x3')]])&&!queues[_0x17bb27[_0x08ad('0x3')]][_0x08ad('0x19')]){queues[_0x17bb27['uniqueid']][_0x08ad('0x19')]=![];queues[_0x17bb27['uniqueid']]['queuecallerabandonAt']=null;queues[_0x17bb27[_0x08ad('0x3')]][_0x08ad('0x1a')]=!![];queues[_0x17bb27['uniqueid']][_0x08ad('0x29')]=utils['now']();queues[_0x17bb27['uniqueid']][_0x08ad('0x1e')]=_0x08ad('0x2c');utils[_0x08ad('0x1')](util[_0x08ad('0xe')](_0x08ad('0x2d'),_0x17bb27[_0x08ad('0x3')],queues[_0x17bb27[_0x08ad('0x3')]][_0x08ad('0x1f')],_0x17bb27[_0x08ad('0x25')],queues[_0x17bb27['uniqueid']][_0x08ad('0x1e')]));}}}catch(_0x35e144){utils[_0x08ad('0x13')](util['format']('[%s][queues][varset]',_0x17bb27[_0x08ad('0x3')]),_0x35e144);}};exports[_0x08ad('0x19')]=function(_0x36a455){try{if(!_[_0x08ad('0x16')](queues[_0x36a455[_0x08ad('0x3')]])){utils[_0x08ad('0x17')](util[_0x08ad('0xe')]('[%s][queues][queuecallerabandon]',_0x36a455[_0x08ad('0x3')]),_0x36a455);queues[_0x36a455[_0x08ad('0x3')]][_0x08ad('0x1a')]=![];queues[_0x36a455[_0x08ad('0x3')]][_0x08ad('0x29')]=null;queues[_0x36a455[_0x08ad('0x3')]]['queuecallerabandon']=!![];queues[_0x36a455[_0x08ad('0x3')]][_0x08ad('0x28')]=utils[_0x08ad('0x12')]();queues[_0x36a455[_0x08ad('0x3')]][_0x08ad('0x1e')]=_0x08ad('0x2e');utils[_0x08ad('0x1')](util[_0x08ad('0xe')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x36a455[_0x08ad('0x3')],queues[_0x36a455[_0x08ad('0x3')]][_0x08ad('0x1f')],queues[_0x36a455['uniqueid']][_0x08ad('0x1e')]));}}catch(_0x527e56){utils[_0x08ad('0x13')](util[_0x08ad('0xe')](_0x08ad('0x2f'),_0x36a455['uniqueid']),_0x527e56);}};exports[_0x08ad('0x30')]=function(_0x43a127){try{if(!_[_0x08ad('0x16')](queues[_0x43a127[_0x08ad('0x3')]])){utils[_0x08ad('0x17')](util[_0x08ad('0xe')](_0x08ad('0x31'),_0x43a127[_0x08ad('0x3')]),_0x43a127);utils[_0x08ad('0x1')](util[_0x08ad('0xe')](_0x08ad('0x32'),_0x43a127[_0x08ad('0x3')],queues[_0x43a127[_0x08ad('0x3')]]['name'],_0x43a127[_0x08ad('0x33')],_0x43a127[_0x08ad('0x34')]));queues[_0x43a127[_0x08ad('0x3')]][_0x08ad('0x30')]=!![];queues[_0x43a127[_0x08ad('0x3')]][_0x08ad('0x18')]=utils[_0x08ad('0x12')]();queues[_0x43a127[_0x08ad('0x3')]][_0x08ad('0x35')]=utils['diffTime'](queues[_0x43a127['uniqueid']][_0x08ad('0x18')],queues[_0x43a127[_0x08ad('0x3')]][_0x08ad('0x36')]);queues[_0x43a127[_0x08ad('0x3')]]['position']=_0x43a127[_0x08ad('0x10')];queues[_0x43a127[_0x08ad('0x3')]][_0x08ad('0x37')]=_0x43a127[_0x08ad('0x37')];queues[_0x43a127[_0x08ad('0x3')]]['connectedlinenum']=_0x43a127[_0x08ad('0x33')];queues[_0x43a127[_0x08ad('0x3')]][_0x08ad('0x34')]=_0x43a127[_0x08ad('0x34')];}}catch(_0x16b0b0){utils['error'](util[_0x08ad('0xe')](_0x08ad('0x31'),_0x43a127[_0x08ad('0x3')]),_0x16b0b0);}};exports[_0x08ad('0x38')]=function(_0x4e12cd){try{if(!_['isNil'](queues[_0x4e12cd[_0x08ad('0x3')]])){utils[_0x08ad('0x17')](util[_0x08ad('0xe')](_0x08ad('0x39'),_0x4e12cd['uniqueid']),_0x4e12cd);utils[_0x08ad('0x1')](util[_0x08ad('0xe')](_0x08ad('0x3a'),_0x4e12cd[_0x08ad('0x3')],queues[_0x4e12cd[_0x08ad('0x3')]][_0x08ad('0x1f')],_0x4e12cd['membername'],_0x4e12cd[_0x08ad('0x3b')]));queues[_0x4e12cd[_0x08ad('0x3')]][_0x08ad('0x19')]=![];queues[_0x4e12cd[_0x08ad('0x3')]][_0x08ad('0x19')]=![];queues[_0x4e12cd[_0x08ad('0x3')]][_0x08ad('0x28')]=null;queues[_0x4e12cd[_0x08ad('0x3')]][_0x08ad('0x1a')]=![];queues[_0x4e12cd['uniqueid']][_0x08ad('0x1e')]=null;queues[_0x4e12cd['uniqueid']][_0x08ad('0x29')]=null;queues[_0x4e12cd[_0x08ad('0x3')]]['assigned']=!![];queues[_0x4e12cd[_0x08ad('0x3')]][_0x08ad('0x7')]=_0x4e12cd[_0x08ad('0x3b')];queues[_0x4e12cd[_0x08ad('0x3')]][_0x08ad('0x5')]=_0x4e12cd[_0x08ad('0x3c')];}}catch(_0x45d30f){utils[_0x08ad('0x13')](util[_0x08ad('0xe')]('[%s][queues][agentconnect]',_0x4e12cd[_0x08ad('0x3')]),_0x45d30f);}};exports[_0x08ad('0x3d')]=function(_0x134c87){try{if(!_[_0x08ad('0x16')](queues[_0x134c87[_0x08ad('0x3')]])){if(queues[_0x134c87['uniqueid']][_0x08ad('0x18')]){utils[_0x08ad('0x17')](util['format']('[%s][queues][agentcomplete]',_0x134c87[_0x08ad('0x3')]),_0x134c87);queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x19')]=![];queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x19')]=![];queues[_0x134c87[_0x08ad('0x3')]]['queuecallerabandonAt']=null;queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x1a')]=![];queues[_0x134c87[_0x08ad('0x3')]]['queuecallerexitAt']=null;queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x3e')]=!![];queues[_0x134c87[_0x08ad('0x3')]]['lastAssignedTo']=_0x134c87[_0x08ad('0x3c')];queues[_0x134c87['uniqueid']][_0x08ad('0x3f')]=!![];queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x1b')]=utils[_0x08ad('0x12')]();if(_0x134c87[_0x08ad('0x40')]=='transfer'){if(!queues[_0x134c87['uniqueid']][_0x08ad('0x41')]){queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x1e')]=_0x08ad('0x42');}}else{queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x1e')]=_0x08ad('0x43')+_0x134c87['reason']['toUpperCase']();}utils[_0x08ad('0x1')](util[_0x08ad('0xe')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x134c87['uniqueid'],queues[_0x134c87[_0x08ad('0x3')]][_0x08ad('0x1f')],_0x134c87['membername'],queues[_0x134c87[_0x08ad('0x3')]]['queuecallerexitreason']));writeDB(queues[_0x134c87[_0x08ad('0x3')]]);}}}catch(_0x9b6da9){utils[_0x08ad('0x13')](util['format'](_0x08ad('0x44'),_0x134c87[_0x08ad('0x3')]),_0x9b6da9);}};exports[_0x08ad('0x45')]=function(_0x25cccd){try{if(!_[_0x08ad('0x16')](queues[_0x25cccd[_0x08ad('0x46')]])){utils[_0x08ad('0x17')](util[_0x08ad('0xe')](_0x08ad('0x47'),_0x25cccd[_0x08ad('0x3')]),_0x25cccd);queues[_0x25cccd[_0x08ad('0x46')]][_0x08ad('0x41')]=!![];queues[_0x25cccd[_0x08ad('0x46')]][_0x08ad('0x48')]=_0x08ad('0x49');queues[_0x25cccd['transfereeuniqueid']][_0x08ad('0x4a')]=_0x25cccd[_0x08ad('0x4b')];queues[_0x25cccd[_0x08ad('0x46')]][_0x08ad('0x4c')]=_0x25cccd[_0x08ad('0x46')];queues[_0x25cccd[_0x08ad('0x46')]][_0x08ad('0x1e')]=_0x08ad('0x4d');utils[_0x08ad('0x1')](util[_0x08ad('0xe')](_0x08ad('0x4e'),_0x25cccd[_0x08ad('0x3')],queues[_0x25cccd[_0x08ad('0x46')]][_0x08ad('0x1f')],_0x25cccd[_0x08ad('0x46')],_0x25cccd[_0x08ad('0x4b')]));}}catch(_0x5b69b4){utils[_0x08ad('0x13')](util['format']('[%s][queues][blindtransfer]',_0x25cccd[_0x08ad('0x3')]),_0x5b69b4);}};exports[_0x08ad('0x4f')]=function(_0x4f6fa6){try{utils['debug'](util[_0x08ad('0xe')](_0x08ad('0x50'),_0x4f6fa6['origtransfereruniqueid']),_0x4f6fa6);if(_0x4f6fa6['origtransfereruniqueid']==_0x4f6fa6[_0x08ad('0x51')]){if(!_[_0x08ad('0x16')](queues[_0x4f6fa6['secondtransfererlinkedid']])){utils[_0x08ad('0x1')](util[_0x08ad('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x4f6fa6[_0x08ad('0x52')],queues[_0x4f6fa6[_0x08ad('0x53')]][_0x08ad('0x1f')],_0x4f6fa6[_0x08ad('0x54')]));queues[_0x4f6fa6[_0x08ad('0x53')]][_0x08ad('0x41')]=!![];queues[_0x4f6fa6['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x4f6fa6[_0x08ad('0x53')]][_0x08ad('0x4a')]=_0x4f6fa6[_0x08ad('0x54')];queues[_0x4f6fa6[_0x08ad('0x53')]][_0x08ad('0x4c')]=_0x4f6fa6[_0x08ad('0x52')];queues[_0x4f6fa6['secondtransfererlinkedid']][_0x08ad('0x1e')]=_0x08ad('0x55');}if(!_[_0x08ad('0x16')](queues[_0x4f6fa6['origtransfererlinkedid']])){if(_0x4f6fa6[_0x08ad('0x56')]&&queues[_0x4f6fa6[_0x08ad('0x56')]]){queues[_0x4f6fa6[_0x08ad('0x56')]]['queuecallerenterreason']=0x1;queues[_0x4f6fa6[_0x08ad('0x46')]]=_[_0x08ad('0x57')](queues[_0x4f6fa6[_0x08ad('0x56')]]);queues[_0x4f6fa6['transfereeuniqueid']]['transfereduniqueid']=_0x4f6fa6['transfertargetuniqueid'];queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x20')]=0x2;queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x6')]=queues[_0x4f6fa6[_0x08ad('0x53')]][_0x08ad('0x6')];queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x58')]=queues[_0x4f6fa6[_0x08ad('0x53')]][_0x08ad('0x58')];queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x36')]=utils[_0x08ad('0x12')]();queues[_0x4f6fa6['transfereeuniqueid']][_0x08ad('0x18')]=utils[_0x08ad('0x12')]();queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x35')]=0x0;queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x59')]=0x0;utils[_0x08ad('0x1')](util[_0x08ad('0xe')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x4f6fa6['origtransfereruniqueid'],queues[_0x4f6fa6['transfereeuniqueid']][_0x08ad('0x1f')],queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x6')],queues[_0x4f6fa6[_0x08ad('0x46')]][_0x08ad('0x58')]));}else{utils[_0x08ad('0x1')](util[_0x08ad('0xe')](_0x08ad('0x5a'),_0x4f6fa6['origtransfereruniqueid'],queues[_0x4f6fa6[_0x08ad('0x51')]][_0x08ad('0x1f')],_0x4f6fa6[_0x08ad('0x53')]));queues[_0x4f6fa6[_0x08ad('0x51')]][_0x08ad('0xc')]=_0x4f6fa6['secondtransfererlinkedid'];}}}else if(_0x4f6fa6['secondtransfereruniqueid']==_0x4f6fa6[_0x08ad('0x53')]){if(!_[_0x08ad('0x16')](queues[_0x4f6fa6[_0x08ad('0x51')]])){utils['info'](util[_0x08ad('0xe')](_0x08ad('0x5b'),_0x4f6fa6[_0x08ad('0x52')],queues[_0x4f6fa6[_0x08ad('0x51')]][_0x08ad('0x1f')],_0x4f6fa6[_0x08ad('0x5c')],_0x4f6fa6[_0x08ad('0x5d')]));queues[_0x4f6fa6[_0x08ad('0x51')]][_0x08ad('0x41')]=!![];queues[_0x4f6fa6[_0x08ad('0x51')]]['transfertype']='ATTENDED';queues[_0x4f6fa6[_0x08ad('0x51')]][_0x08ad('0x4a')]=_0x4f6fa6[_0x08ad('0x5d')];queues[_0x4f6fa6['origtransfererlinkedid']][_0x08ad('0x4c')]=_0x4f6fa6[_0x08ad('0x5c')];queues[_0x4f6fa6[_0x08ad('0x51')]]['queuecallerexitreason']=_0x08ad('0x55');}if(!_[_0x08ad('0x16')](queues[_0x4f6fa6[_0x08ad('0x53')]])){if(_0x4f6fa6[_0x08ad('0x5e')]&&queues[_0x4f6fa6[_0x08ad('0x5e')]]){queues[_0x4f6fa6[_0x08ad('0x5e')]][_0x08ad('0x20')]=0x1;queues[_0x4f6fa6[_0x08ad('0x5f')]]=_[_0x08ad('0x57')](queues[_0x4f6fa6[_0x08ad('0x5e')]]);queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0xc')]=_0x4f6fa6[_0x08ad('0x5f')];queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0x20')]=0x2;queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0x6')]=queues[_0x4f6fa6[_0x08ad('0x51')]][_0x08ad('0x6')];queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0x58')]=queues[_0x4f6fa6[_0x08ad('0x51')]][_0x08ad('0x58')];queues[_0x4f6fa6['transfertargetuniqueid']]['queuecallerjoinAt']=utils[_0x08ad('0x12')]();queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0x18')]=utils[_0x08ad('0x12')]();queues[_0x4f6fa6['transfertargetuniqueid']][_0x08ad('0x35')]=0x0;queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0x59')]=0x0;utils[_0x08ad('0x1')](util['format'](_0x08ad('0x60'),_0x4f6fa6[_0x08ad('0x52')],queues[_0x4f6fa6['transfertargetuniqueid']][_0x08ad('0x1f')],queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0xc')],queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0x6')],queues[_0x4f6fa6[_0x08ad('0x5f')]][_0x08ad('0x58')]));}else{utils[_0x08ad('0x1')](util[_0x08ad('0xe')](_0x08ad('0x5a'),_0x4f6fa6[_0x08ad('0x52')],queues[_0x4f6fa6[_0x08ad('0x53')]]['name'],_0x4f6fa6['origtransfererlinkedid']));queues[_0x4f6fa6[_0x08ad('0x53')]][_0x08ad('0xc')]=_0x4f6fa6[_0x08ad('0x51')];}}}}catch(_0x2836ea){utils[_0x08ad('0x13')](util['format'](_0x08ad('0x50'),_0x4f6fa6[_0x08ad('0x52')]),_0x2836ea);}};exports[_0x08ad('0x61')]=function(_0x5876a2){try{if(!_[_0x08ad('0x16')](queues[_0x5876a2[_0x08ad('0x3')]])){utils[_0x08ad('0x17')](util[_0x08ad('0xe')](_0x08ad('0x62'),_0x5876a2[_0x08ad('0x3')]),_0x5876a2);queues[_0x5876a2[_0x08ad('0x3')]][_0x08ad('0x63')]=utils['now']();utils['info'](util[_0x08ad('0xe')](_0x08ad('0x64'),_0x5876a2[_0x08ad('0x3')],queues[_0x5876a2['uniqueid']][_0x08ad('0x1f')],queues[_0x5876a2[_0x08ad('0x3')]][_0x08ad('0x63')]));}}catch(_0x56b1e5){utils[_0x08ad('0x13')](util['format'](_0x08ad('0x62'),_0x5876a2[_0x08ad('0x3')]),_0x56b1e5);}};exports[_0x08ad('0x65')]=function(_0x40ab2b){try{if(!_['isNil'](queues[_0x40ab2b[_0x08ad('0x3')]])){if(!_['isNil'](queues[_0x40ab2b[_0x08ad('0x3')]]['musiconholdstartAt'])){utils[_0x08ad('0x17')](util[_0x08ad('0xe')](_0x08ad('0x66'),_0x40ab2b[_0x08ad('0x3')]),_0x40ab2b);queues[_0x40ab2b['uniqueid']]['mohtime']+=utils[_0x08ad('0x67')](utils[_0x08ad('0x12')](),queues[_0x40ab2b[_0x08ad('0x3')]][_0x08ad('0x63')]);utils['info'](util[_0x08ad('0xe')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x40ab2b[_0x08ad('0x3')],queues[_0x40ab2b[_0x08ad('0x3')]][_0x08ad('0x1f')],queues[_0x40ab2b[_0x08ad('0x3')]][_0x08ad('0x59')]));delete queues[_0x40ab2b[_0x08ad('0x3')]][_0x08ad('0x63')];}}}catch(_0x136d86){utils['error'](util[_0x08ad('0xe')](_0x08ad('0x66'),_0x40ab2b[_0x08ad('0x3')]),_0x136d86);}}; \ No newline at end of file +var _0x2343=['secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','queuecallerenterreason','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','isNil','queuestatus','toUpperCase','CONTINUE','queuecallerabandonAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','accountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','extension','[%s][queues][attendedtransfer]','origtransfereruniqueid'];(function(_0x38fa07,_0x1d81fc){var _0xe09111=function(_0x455e02){while(--_0x455e02){_0x38fa07['push'](_0x38fa07['shift']());}};_0xe09111(++_0x1d81fc);}(_0x2343,0x1bc));var _0x3234=function(_0x565fed,_0xb85768){_0x565fed=_0x565fed-0x0;var _0x3e018f=_0x2343[_0x565fed];return _0x3e018f;};'use strict';var _=require(_0x3234('0x0'));var util=require(_0x3234('0x1'));var utils=require(_0x3234('0x2'));var queues={};function writeDB(_0xa7e6e9){utils[_0x3234('0x3')](util['format'](_0x3234('0x4'),_0xa7e6e9[_0x3234('0x5')],_0xa7e6e9[_0x3234('0x6')],_0xa7e6e9[_0x3234('0x7')],_0xa7e6e9['lastAssignedTo'],_0xa7e6e9[_0x3234('0x8')],_0xa7e6e9['accountcode'],_0xa7e6e9[_0x3234('0x9')]));if(_0xa7e6e9[_0x3234('0x7')]){utils[_0x3234('0xa')](_0xa7e6e9['queue'])[_0x3234('0xb')](function(_0x42a8da){if(_0x42a8da){_0xa7e6e9['type']=_0x42a8da[_0x3234('0xc')];}utils[_0x3234('0xd')](_0x3234('0xe'),_0xa7e6e9);});}else{utils['request'](_0x3234('0xe'),_0xa7e6e9);}if(_0xa7e6e9[_0x3234('0xf')]){delete queues[_0xa7e6e9['transfereduniqueid']];}else{delete queues[_0xa7e6e9[_0x3234('0x5')]];}}exports[_0x3234('0x10')]=function(_0x354bd1){try{utils[_0x3234('0x11')](util[_0x3234('0x12')](_0x3234('0x13'),_0x354bd1[_0x3234('0x5')]),_0x354bd1);utils[_0x3234('0x3')](util[_0x3234('0x12')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x354bd1[_0x3234('0x5')],_0x354bd1[_0x3234('0x7')],_0x354bd1[_0x3234('0x14')]));queues[_0x354bd1['uniqueid']]=_[_0x3234('0x15')](_0x354bd1,{'originalposition':_0x354bd1[_0x3234('0x14')],'queuecallerjoinAt':utils[_0x3234('0x16')](),'mohtime':0x0});}catch(_0x3ab8be){utils[_0x3234('0x17')](util[_0x3234('0x12')](_0x3234('0x13'),_0x354bd1[_0x3234('0x5')]),_0x3ab8be);}};exports[_0x3234('0x18')]=function(_0x40ecdb){try{if(!_['isNil'](queues[_0x40ecdb[_0x3234('0x5')]])){utils['debug'](util[_0x3234('0x12')](_0x3234('0x19'),_0x40ecdb[_0x3234('0x5')]),_0x40ecdb);if(queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0x1a')]){if(!queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0x1b')]&&!queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0x1c')]){queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0x1d')]=!![];queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0x1e')]=utils[_0x3234('0x16')]();queues[_0x40ecdb['uniqueid']]['queuecallerexitreason']=_0x3234('0x1f');}utils[_0x3234('0x3')](util[_0x3234('0x12')](_0x3234('0x20'),_0x40ecdb['uniqueid'],queues[_0x40ecdb[_0x3234('0x5')]]['name'],queues[_0x40ecdb['uniqueid']][_0x3234('0x9')]));writeDB(queues[_0x40ecdb['uniqueid']]);}else if(queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0xf')]){utils[_0x3234('0x3')](util[_0x3234('0x12')](_0x3234('0x21'),_0x40ecdb[_0x3234('0x5')],queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0x22')],queues[_0x40ecdb['uniqueid']][_0x3234('0xf')]));queues[queues[_0x40ecdb['uniqueid']][_0x3234('0xf')]]=queues[_0x40ecdb[_0x3234('0x5')]];queues[queues[_0x40ecdb[_0x3234('0x5')]][_0x3234('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x40ecdb[_0x3234('0x5')]];}}}catch(_0x3df68d){utils['error'](util[_0x3234('0x12')](_0x3234('0x19'),_0x40ecdb[_0x3234('0x5')]),_0x3df68d);}};exports['varset']=function(_0x17c177){try{utils[_0x3234('0x11')](util[_0x3234('0x12')]('[%s][queues][varset]',_0x17c177[_0x3234('0x5')]),_0x17c177);if(!_[_0x3234('0x23')](_0x17c177['variable'][_0x3234('0x24')])&&_0x17c177['value'][_0x3234('0x25')]()!==_0x3234('0x26')){if(!_[_0x3234('0x23')](queues[_0x17c177[_0x3234('0x5')]])){queues[_0x17c177['uniqueid']][_0x3234('0x1b')]=![];queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x27')]=null;queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x1c')]=!![];queues[_0x17c177[_0x3234('0x5')]]['queuecallerexitAt']=utils[_0x3234('0x16')]();queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x9')]=_0x17c177[_0x3234('0x28')][_0x3234('0x25')]();utils[_0x3234('0x3')](util[_0x3234('0x12')](_0x3234('0x29'),_0x17c177[_0x3234('0x5')],queues[_0x17c177['uniqueid']]['name'],_0x17c177['value'],queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x9')]));writeDB(queues[_0x17c177[_0x3234('0x5')]]);}}else if(!_[_0x3234('0x23')](_0x17c177[_0x3234('0x2a')]['queueposition'])){if(!_[_0x3234('0x23')](queues[_0x17c177['uniqueid']])&&!queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x1b')]){queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x1b')]=![];queues[_0x17c177[_0x3234('0x5')]]['queuecallerabandonAt']=null;queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x1c')]=!![];queues[_0x17c177['uniqueid']][_0x3234('0x2b')]=utils[_0x3234('0x16')]();queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x9')]=_0x3234('0x2c');utils[_0x3234('0x3')](util[_0x3234('0x12')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x17c177[_0x3234('0x5')],queues[_0x17c177['uniqueid']]['name'],_0x17c177['value'],queues[_0x17c177[_0x3234('0x5')]][_0x3234('0x9')]));}}}catch(_0x43d361){utils['error'](util[_0x3234('0x12')](_0x3234('0x2d'),_0x17c177[_0x3234('0x5')]),_0x43d361);}};exports[_0x3234('0x1b')]=function(_0x4232e1){try{if(!_[_0x3234('0x23')](queues[_0x4232e1[_0x3234('0x5')]])){utils[_0x3234('0x11')](util[_0x3234('0x12')](_0x3234('0x2e'),_0x4232e1['uniqueid']),_0x4232e1);queues[_0x4232e1['uniqueid']][_0x3234('0x1c')]=![];queues[_0x4232e1[_0x3234('0x5')]][_0x3234('0x2b')]=null;queues[_0x4232e1[_0x3234('0x5')]][_0x3234('0x1b')]=!![];queues[_0x4232e1[_0x3234('0x5')]][_0x3234('0x27')]=utils[_0x3234('0x16')]();queues[_0x4232e1['uniqueid']][_0x3234('0x9')]=_0x3234('0x2f');utils[_0x3234('0x3')](util[_0x3234('0x12')](_0x3234('0x30'),_0x4232e1[_0x3234('0x5')],queues[_0x4232e1['uniqueid']][_0x3234('0x22')],queues[_0x4232e1['uniqueid']][_0x3234('0x9')]));}}catch(_0x1be6b3){utils[_0x3234('0x17')](util[_0x3234('0x12')]('[%s][queues][queuecallerabandon]',_0x4232e1[_0x3234('0x5')]),_0x1be6b3);}};exports['queuecallerleave']=function(_0x5a60ac){try{if(!_['isNil'](queues[_0x5a60ac['uniqueid']])){utils[_0x3234('0x11')](util[_0x3234('0x12')](_0x3234('0x31'),_0x5a60ac['uniqueid']),_0x5a60ac);utils[_0x3234('0x3')](util[_0x3234('0x12')](_0x3234('0x32'),_0x5a60ac[_0x3234('0x5')],queues[_0x5a60ac[_0x3234('0x5')]]['name'],_0x5a60ac['connectedlinenum'],_0x5a60ac[_0x3234('0x33')]));queues[_0x5a60ac[_0x3234('0x5')]][_0x3234('0x34')]=!![];queues[_0x5a60ac[_0x3234('0x5')]][_0x3234('0x1a')]=utils[_0x3234('0x16')]();queues[_0x5a60ac['uniqueid']][_0x3234('0x35')]=utils[_0x3234('0x36')](queues[_0x5a60ac[_0x3234('0x5')]][_0x3234('0x1a')],queues[_0x5a60ac[_0x3234('0x5')]][_0x3234('0x37')]);queues[_0x5a60ac['uniqueid']][_0x3234('0x14')]=_0x5a60ac[_0x3234('0x14')];queues[_0x5a60ac[_0x3234('0x5')]][_0x3234('0x38')]=_0x5a60ac[_0x3234('0x38')];queues[_0x5a60ac[_0x3234('0x5')]][_0x3234('0x39')]=_0x5a60ac[_0x3234('0x39')];queues[_0x5a60ac[_0x3234('0x5')]][_0x3234('0x33')]=_0x5a60ac[_0x3234('0x33')];}}catch(_0x4ab9dd){utils[_0x3234('0x17')](util[_0x3234('0x12')](_0x3234('0x31'),_0x5a60ac['uniqueid']),_0x4ab9dd);}};exports['agentconnect']=function(_0x230278){try{if(!_[_0x3234('0x23')](queues[_0x230278['uniqueid']])){utils[_0x3234('0x11')](util[_0x3234('0x12')](_0x3234('0x3a'),_0x230278[_0x3234('0x5')]),_0x230278);utils[_0x3234('0x3')](util[_0x3234('0x12')](_0x3234('0x3b'),_0x230278['uniqueid'],queues[_0x230278['uniqueid']][_0x3234('0x22')],_0x230278[_0x3234('0x3c')],_0x230278[_0x3234('0x3d')]));queues[_0x230278[_0x3234('0x5')]][_0x3234('0x1b')]=![];queues[_0x230278[_0x3234('0x5')]][_0x3234('0x1b')]=![];queues[_0x230278[_0x3234('0x5')]][_0x3234('0x27')]=null;queues[_0x230278['uniqueid']][_0x3234('0x1c')]=![];queues[_0x230278['uniqueid']][_0x3234('0x9')]=null;queues[_0x230278[_0x3234('0x5')]][_0x3234('0x2b')]=null;queues[_0x230278['uniqueid']][_0x3234('0x3e')]=!![];queues[_0x230278[_0x3234('0x5')]][_0x3234('0x3f')]=_0x230278[_0x3234('0x3d')];queues[_0x230278['uniqueid']][_0x3234('0x40')]=_0x230278[_0x3234('0x3c')];}}catch(_0x27aa1c){utils[_0x3234('0x17')](util[_0x3234('0x12')]('[%s][queues][agentconnect]',_0x230278[_0x3234('0x5')]),_0x27aa1c);}};exports[_0x3234('0x41')]=function(_0x48d0b4){try{if(!_[_0x3234('0x23')](queues[_0x48d0b4[_0x3234('0x5')]])){if(queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x1a')]){utils[_0x3234('0x11')](util['format'](_0x3234('0x42'),_0x48d0b4[_0x3234('0x5')]),_0x48d0b4);queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x1b')]=![];queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x1b')]=![];queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x27')]=null;queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x1c')]=![];queues[_0x48d0b4['uniqueid']][_0x3234('0x2b')]=null;queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x3e')]=!![];queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x40')]=_0x48d0b4[_0x3234('0x3c')];queues[_0x48d0b4['uniqueid']]['queuecallercomplete']=!![];queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x1e')]=utils[_0x3234('0x16')]();if(_0x48d0b4['reason']==_0x3234('0x43')){if(!queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x43')]){queues[_0x48d0b4['uniqueid']][_0x3234('0x9')]='TRANSFER';}}else{queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x9')]=_0x3234('0x44')+_0x48d0b4['reason'][_0x3234('0x25')]();}utils['info'](util['format'](_0x3234('0x45'),_0x48d0b4[_0x3234('0x5')],queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x22')],_0x48d0b4[_0x3234('0x3c')],queues[_0x48d0b4[_0x3234('0x5')]][_0x3234('0x9')]));writeDB(queues[_0x48d0b4['uniqueid']]);}}}catch(_0x426228){utils[_0x3234('0x17')](util[_0x3234('0x12')](_0x3234('0x42'),_0x48d0b4['uniqueid']),_0x426228);}};exports[_0x3234('0x46')]=function(_0x5b89bb){try{if(!_[_0x3234('0x23')](queues[_0x5b89bb['transfereeuniqueid']])){utils['debug'](util[_0x3234('0x12')](_0x3234('0x47'),_0x5b89bb[_0x3234('0x5')]),_0x5b89bb);queues[_0x5b89bb[_0x3234('0x48')]]['transfer']=!![];queues[_0x5b89bb[_0x3234('0x48')]][_0x3234('0x49')]=_0x3234('0x4a');queues[_0x5b89bb['transfereeuniqueid']][_0x3234('0x4b')]=_0x5b89bb['extension'];queues[_0x5b89bb[_0x3234('0x48')]][_0x3234('0x4c')]=_0x5b89bb[_0x3234('0x48')];queues[_0x5b89bb['transfereeuniqueid']]['queuecallerexitreason']=_0x3234('0x4d');utils['info'](util[_0x3234('0x12')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x5b89bb[_0x3234('0x5')],queues[_0x5b89bb[_0x3234('0x48')]][_0x3234('0x22')],_0x5b89bb['transfereeuniqueid'],_0x5b89bb[_0x3234('0x4e')]));}}catch(_0x1e14c7){utils['error'](util['format']('[%s][queues][blindtransfer]',_0x5b89bb[_0x3234('0x5')]),_0x1e14c7);}};exports['attendedtransfer']=function(_0x5dcbf3){try{utils[_0x3234('0x11')](util[_0x3234('0x12')](_0x3234('0x4f'),_0x5dcbf3[_0x3234('0x50')]),_0x5dcbf3);if(_0x5dcbf3['origtransfereruniqueid']==_0x5dcbf3['origtransfererlinkedid']){if(!_[_0x3234('0x23')](queues[_0x5dcbf3['secondtransfererlinkedid']])){utils[_0x3234('0x3')](util[_0x3234('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5dcbf3[_0x3234('0x50')],queues[_0x5dcbf3[_0x3234('0x51')]]['name'],_0x5dcbf3[_0x3234('0x52')]));queues[_0x5dcbf3[_0x3234('0x51')]][_0x3234('0x43')]=!![];queues[_0x5dcbf3[_0x3234('0x51')]][_0x3234('0x49')]=_0x3234('0x53');queues[_0x5dcbf3['secondtransfererlinkedid']][_0x3234('0x4b')]=_0x5dcbf3[_0x3234('0x52')];queues[_0x5dcbf3[_0x3234('0x51')]][_0x3234('0x4c')]=_0x5dcbf3[_0x3234('0x50')];queues[_0x5dcbf3[_0x3234('0x51')]][_0x3234('0x9')]=_0x3234('0x54');}if(!_['isNil'](queues[_0x5dcbf3[_0x3234('0x55')]])){if(_0x5dcbf3[_0x3234('0x56')]&&queues[_0x5dcbf3[_0x3234('0x56')]]){queues[_0x5dcbf3[_0x3234('0x56')]]['queuecallerenterreason']=0x1;queues[_0x5dcbf3[_0x3234('0x48')]]=_[_0x3234('0x57')](queues[_0x5dcbf3[_0x3234('0x56')]]);queues[_0x5dcbf3[_0x3234('0x48')]][_0x3234('0xf')]=_0x5dcbf3[_0x3234('0x58')];queues[_0x5dcbf3[_0x3234('0x48')]]['queuecallerenterreason']=0x2;queues[_0x5dcbf3[_0x3234('0x48')]]['calleridnum']=queues[_0x5dcbf3['secondtransfererlinkedid']][_0x3234('0x8')];queues[_0x5dcbf3[_0x3234('0x48')]][_0x3234('0x59')]=queues[_0x5dcbf3[_0x3234('0x51')]]['calleridname'];queues[_0x5dcbf3['transfereeuniqueid']][_0x3234('0x37')]=utils['now']();queues[_0x5dcbf3[_0x3234('0x48')]][_0x3234('0x1a')]=utils[_0x3234('0x16')]();queues[_0x5dcbf3[_0x3234('0x48')]][_0x3234('0x35')]=0x0;queues[_0x5dcbf3[_0x3234('0x48')]][_0x3234('0x5a')]=0x0;utils['info'](util[_0x3234('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5dcbf3[_0x3234('0x50')],queues[_0x5dcbf3[_0x3234('0x48')]][_0x3234('0x22')],queues[_0x5dcbf3['transfereeuniqueid']][_0x3234('0x8')],queues[_0x5dcbf3[_0x3234('0x48')]][_0x3234('0x59')]));}else{utils['info'](util['format'](_0x3234('0x5b'),_0x5dcbf3['origtransfereruniqueid'],queues[_0x5dcbf3[_0x3234('0x55')]][_0x3234('0x22')],_0x5dcbf3[_0x3234('0x51')]));queues[_0x5dcbf3[_0x3234('0x55')]][_0x3234('0xf')]=_0x5dcbf3[_0x3234('0x51')];}}}else if(_0x5dcbf3[_0x3234('0x5c')]==_0x5dcbf3[_0x3234('0x51')]){if(!_[_0x3234('0x23')](queues[_0x5dcbf3[_0x3234('0x55')]])){utils[_0x3234('0x3')](util[_0x3234('0x12')](_0x3234('0x5d'),_0x5dcbf3[_0x3234('0x50')],queues[_0x5dcbf3[_0x3234('0x55')]][_0x3234('0x22')],_0x5dcbf3[_0x3234('0x5c')],_0x5dcbf3[_0x3234('0x5e')]));queues[_0x5dcbf3[_0x3234('0x55')]][_0x3234('0x43')]=!![];queues[_0x5dcbf3[_0x3234('0x55')]]['transfertype']='ATTENDED';queues[_0x5dcbf3[_0x3234('0x55')]][_0x3234('0x4b')]=_0x5dcbf3[_0x3234('0x5e')];queues[_0x5dcbf3[_0x3234('0x55')]]['transferuniqueid']=_0x5dcbf3[_0x3234('0x5c')];queues[_0x5dcbf3[_0x3234('0x55')]][_0x3234('0x9')]=_0x3234('0x54');}if(!_['isNil'](queues[_0x5dcbf3[_0x3234('0x51')]])){if(_0x5dcbf3['transfertargetlinkedid']&&queues[_0x5dcbf3[_0x3234('0x5f')]]){queues[_0x5dcbf3[_0x3234('0x5f')]][_0x3234('0x60')]=0x1;queues[_0x5dcbf3['transfertargetuniqueid']]=_[_0x3234('0x57')](queues[_0x5dcbf3[_0x3234('0x5f')]]);queues[_0x5dcbf3['transfertargetuniqueid']][_0x3234('0xf')]=_0x5dcbf3[_0x3234('0x58')];queues[_0x5dcbf3[_0x3234('0x58')]]['queuecallerenterreason']=0x2;queues[_0x5dcbf3[_0x3234('0x58')]]['calleridnum']=queues[_0x5dcbf3[_0x3234('0x55')]][_0x3234('0x8')];queues[_0x5dcbf3['transfertargetuniqueid']][_0x3234('0x59')]=queues[_0x5dcbf3[_0x3234('0x55')]]['calleridname'];queues[_0x5dcbf3[_0x3234('0x58')]][_0x3234('0x37')]=utils['now']();queues[_0x5dcbf3[_0x3234('0x58')]][_0x3234('0x1a')]=utils[_0x3234('0x16')]();queues[_0x5dcbf3['transfertargetuniqueid']][_0x3234('0x35')]=0x0;queues[_0x5dcbf3['transfertargetuniqueid']][_0x3234('0x5a')]=0x0;utils['info'](util[_0x3234('0x12')](_0x3234('0x61'),_0x5dcbf3[_0x3234('0x50')],queues[_0x5dcbf3['transfertargetuniqueid']][_0x3234('0x22')],queues[_0x5dcbf3[_0x3234('0x58')]][_0x3234('0xf')],queues[_0x5dcbf3['transfertargetuniqueid']][_0x3234('0x8')],queues[_0x5dcbf3[_0x3234('0x58')]][_0x3234('0x59')]));}else{utils[_0x3234('0x3')](util[_0x3234('0x12')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5dcbf3[_0x3234('0x50')],queues[_0x5dcbf3['secondtransfererlinkedid']][_0x3234('0x22')],_0x5dcbf3[_0x3234('0x55')]));queues[_0x5dcbf3[_0x3234('0x51')]][_0x3234('0xf')]=_0x5dcbf3[_0x3234('0x55')];}}}}catch(_0x27982f){utils[_0x3234('0x17')](util[_0x3234('0x12')](_0x3234('0x4f'),_0x5dcbf3[_0x3234('0x50')]),_0x27982f);}};exports[_0x3234('0x62')]=function(_0x1343e2){try{if(!_['isNil'](queues[_0x1343e2[_0x3234('0x5')]])){utils['debug'](util[_0x3234('0x12')](_0x3234('0x63'),_0x1343e2[_0x3234('0x5')]),_0x1343e2);queues[_0x1343e2[_0x3234('0x5')]]['musiconholdstartAt']=utils[_0x3234('0x16')]();utils[_0x3234('0x3')](util['format'](_0x3234('0x64'),_0x1343e2['uniqueid'],queues[_0x1343e2['uniqueid']]['name'],queues[_0x1343e2[_0x3234('0x5')]][_0x3234('0x65')]));}}catch(_0x4bb002){utils[_0x3234('0x17')](util['format']('[%s][queues][musiconholdstart]',_0x1343e2['uniqueid']),_0x4bb002);}};exports[_0x3234('0x66')]=function(_0x3a81d1){try{if(!_['isNil'](queues[_0x3a81d1[_0x3234('0x5')]])){if(!_[_0x3234('0x23')](queues[_0x3a81d1[_0x3234('0x5')]][_0x3234('0x65')])){utils[_0x3234('0x11')](util[_0x3234('0x12')](_0x3234('0x67'),_0x3a81d1[_0x3234('0x5')]),_0x3a81d1);queues[_0x3a81d1[_0x3234('0x5')]][_0x3234('0x5a')]+=utils['diffTime'](utils['now'](),queues[_0x3a81d1[_0x3234('0x5')]][_0x3234('0x65')]);utils['info'](util[_0x3234('0x12')](_0x3234('0x68'),_0x3a81d1[_0x3234('0x5')],queues[_0x3a81d1['uniqueid']]['name'],queues[_0x3a81d1[_0x3234('0x5')]][_0x3234('0x5a')]));delete queues[_0x3a81d1[_0x3234('0x5')]][_0x3234('0x65')];}}}catch(_0x667299){utils[_0x3234('0x17')](util[_0x3234('0x12')](_0x3234('0x67'),_0x3a81d1[_0x3234('0x5')]),_0x667299);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index c4832fe..03732c7 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 _0x538f=['endsWith','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','cause-txt','calleridname','connectedlinenum','type','connectedlinename','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','startsWith','split','substring','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','queue','lodash','util','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','membername','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','channel','error','newstate','[%s][recordings][newstate]','channelstate','isNil','linkedid','context','transfer','info','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s'];(function(_0x42b410,_0x3b134c){var _0x5d4a16=function(_0x57c83e){while(--_0x57c83e){_0x42b410['push'](_0x42b410['shift']());}};_0x5d4a16(++_0x3b134c);}(_0x538f,0x98));var _0xf538=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x538f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf538('0x0'));var util=require(_0xf538('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x47d646){utils['info'](util[_0xf538('0x2')](_0xf538('0x3'),_0x47d646['uniqueid']));if(_0x47d646[_0xf538('0x4')]){utils[_0xf538('0x5')](_0x47d646['accountcode'])[_0xf538('0x6')](function(_0x40eed6){if(_0x40eed6){_0x47d646[_0xf538('0x7')]=_0x40eed6['name'];_0x47d646['UserId']=_0x40eed6['id'];}utils[_0xf538('0x8')](_0xf538('0x9'),_0x47d646);});}else{utils[_0xf538('0x8')](_0xf538('0x9'),_0x47d646);}}exports[_0xf538('0xa')]=function(_0x2ba9da){try{utils[_0xf538('0xb')](util[_0xf538('0x2')](_0xf538('0xc'),_0x2ba9da[_0xf538('0xd')]),_0x2ba9da);if(_0x2ba9da[_0xf538('0xd')]==_0x2ba9da['linkedid']){utils['info'](util[_0xf538('0x2')](_0xf538('0xe'),_0x2ba9da[_0xf538('0xd')],_0x2ba9da['context'],_0x2ba9da[_0xf538('0xf')]));recordings[_0x2ba9da[_0xf538('0xd')]]={'uniqueid':_0x2ba9da[_0xf538('0xd')],'accountcode':_0x2ba9da[_0xf538('0x4')],'exten':_0x2ba9da[_0xf538('0xf')],'context':_0x2ba9da['context'],'channel':_0x2ba9da[_0xf538('0x10')],'monitors':[]};}}catch(_0x161826){utils[_0xf538('0x11')](util[_0xf538('0x2')](_0xf538('0xc'),_0x2ba9da[_0xf538('0xd')]),_0x161826);}};exports[_0xf538('0x12')]=function(_0x371d80){try{utils[_0xf538('0xb')](util[_0xf538('0x2')](_0xf538('0x13'),_0x371d80[_0xf538('0xd')]),_0x371d80);if(!_['isNil'](recordings[_0x371d80[_0xf538('0xd')]])&&_0x371d80[_0xf538('0x14')]==0x6){utils['info'](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x371d80['uniqueid'],_0x371d80['context'],_0x371d80[_0xf538('0x10')]));}else if(!_[_0xf538('0x15')](recordings[_0x371d80[_0xf538('0x16')]])&&_0x371d80['channelstate']==0x6&&_0x371d80[_0xf538('0x17')]!=_0xf538('0x18')){utils[_0xf538('0x19')](util['format'](_0xf538('0x1a'),_0x371d80[_0xf538('0xd')],_0x371d80['linkedid'],_0x371d80[_0xf538('0x17')],_0x371d80[_0xf538('0x10')]));recordings[_0x371d80['linkedid']][_0xf538('0x4')]=_0x371d80[_0xf538('0x4')];}}catch(_0x52800a){utils[_0xf538('0x11')](util[_0xf538('0x2')]('[%s][recordings][newstate]',_0x371d80['uniqueid']),_0x52800a);}};exports[_0xf538('0x1b')]=function(_0x4983e3){try{if(!_[_0xf538('0x15')](_0x4983e3[_0xf538('0x1c')])&&!_[_0xf538('0x15')](_0x4983e3[_0xf538('0x1c')][_0xf538('0x1d')])){utils[_0xf538('0xb')](util['format']('[%s][recordings][varset]',_0x4983e3[_0xf538('0xd')]),_0x4983e3);utils[_0xf538('0x19')](util[_0xf538('0x2')](_0xf538('0x1e'),_0x4983e3[_0xf538('0xd')],_0x4983e3[_0xf538('0x1c')],_0x4983e3['value']));if(_[_0xf538('0x1f')](_0x4983e3[_0xf538('0x20')],_0xf538('0x21'))){_0x4983e3[_0xf538('0x20')]=_0x4983e3[_0xf538('0x20')][_0xf538('0x22')](_0xf538('0x21'),_0xf538('0x23'));}if(recordings[_0x4983e3[_0xf538('0x16')]]){var _0x12066f=_[_0xf538('0x24')](recordings[_0x4983e3[_0xf538('0x16')]][_0xf538('0x25')],{'value':_0x4983e3[_0xf538('0x20')]});if(_[_0xf538('0x15')](_0x12066f)){recordings[_0x4983e3[_0xf538('0x16')]][_0xf538('0x25')][_0xf538('0x26')]({'value':_0x4983e3['value']});}}}}catch(_0xc5b8cb){utils[_0xf538('0x11')](util['format'](_0xf538('0x27'),_0x4983e3[_0xf538('0xd')]),_0xc5b8cb);}};exports['hangup']=function(_0x83c538){try{if(!_['isNil'](recordings[_0x83c538['uniqueid']])){utils[_0xf538('0xb')](util['format'](_0xf538('0x28'),_0x83c538['uniqueid']),_0x83c538);utils['info'](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x83c538[_0xf538('0xd')],_0x83c538[_0xf538('0x29')],_0x83c538['calleridname'],_0x83c538[_0xf538('0x2a')]));recordings[_0x83c538[_0xf538('0xd')]][_0xf538('0x29')]=_0x83c538[_0xf538('0x29')];recordings[_0x83c538[_0xf538('0xd')]][_0xf538('0x2b')]=_0x83c538['calleridname'];recordings[_0x83c538[_0xf538('0xd')]]['connectedlinenum']=_0x83c538[_0xf538('0x2c')];recordings[_0x83c538[_0xf538('0xd')]]['connectedlinename']=_0x83c538['connectedlinename'];if(recordings[_0x83c538[_0xf538('0xd')]][_0xf538('0x2d')]=='outbound'&&recordings[_0x83c538['uniqueid']][_0xf538('0x4')]){recordings[_0x83c538['uniqueid']][_0xf538('0x2c')]=recordings[_0x83c538[_0xf538('0xd')]][_0xf538('0x4')];recordings[_0x83c538[_0xf538('0xd')]][_0xf538('0x2e')]='';}recordings[_0x83c538[_0xf538('0xd')]]['monitors'][_0xf538('0x2f')](function(_0x20bad8){var _0x14651f=_[_0xf538('0x30')](recordings[_0x83c538[_0xf538('0xd')]]);_0x14651f[_0xf538('0x20')]=_0x20bad8[_0xf538('0x20')];writeDB(_0x14651f);});delete recordings[_0x83c538[_0xf538('0xd')]];}}catch(_0x369983){utils['error'](util[_0xf538('0x2')](_0xf538('0x28'),_0x83c538[_0xf538('0xd')]),_0x369983);}};exports[_0xf538('0x31')]=function(_0x3aafe5){try{if(!_[_0xf538('0x15')](recordings[_0x3aafe5[_0xf538('0xd')]])){utils[_0xf538('0xb')](util[_0xf538('0x2')]('[%s][recordings][newexten]',_0x3aafe5[_0xf538('0xd')]),_0x3aafe5);utils['info'](util[_0xf538('0x2')](_0xf538('0x32'),_0x3aafe5[_0xf538('0xd')],_0x3aafe5['application'],_0x3aafe5[_0xf538('0x33')]));if(_0x3aafe5[_0xf538('0x34')][_0xf538('0x35')]()=='set'&&_[_0xf538('0x36')](_0x3aafe5['appdata']['toLowerCase'](),'cdr')){var _0x2e9d41=_0x3aafe5['appdata'][_0xf538('0x37')]('=');var _0x522ab6=_0x2e9d41[0x0][_0xf538('0x38')](_0x2e9d41[0x0][_0xf538('0x39')]('(')+0x1,_0x2e9d41[0x0][_0xf538('0x39')](')'));var _0x372ee6=_0x2e9d41[0x1];recordings[_0x3aafe5[_0xf538('0xd')]][_0x522ab6]=_0x372ee6;}}}catch(_0x1d7237){utils['error'](util[_0xf538('0x2')](_0xf538('0x3a'),_0x3aafe5[_0xf538('0xd')]),_0x1d7237);}};exports['queuecallerjoin']=function(_0x190298){try{if(!_[_0xf538('0x15')](recordings[_0x190298['uniqueid']])){utils[_0xf538('0xb')](util[_0xf538('0x2')](_0xf538('0x3b'),_0x190298[_0xf538('0xd')]),_0x190298);utils['info'](util['format']('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x190298[_0xf538('0xd')],_0x190298[_0xf538('0x3c')]));recordings[_0x190298[_0xf538('0xd')]][_0xf538('0x3c')]=_0x190298[_0xf538('0x3c')];}}catch(_0x9abca0){utils['error'](util[_0xf538('0x2')](_0xf538('0x3b'),_0x190298[_0xf538('0xd')]),_0x9abca0);}}; \ No newline at end of file +var _0xb75b=['CreateVoiceRecording','newchannel','debug','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newchannel]','newstate','[%s][recordings][newstate]','channelstate','isNil','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','replace','.wav49','monitors','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','forEach','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','lodash','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x4c974e,_0x513d9e){var _0x31327b=function(_0x5db97c){while(--_0x5db97c){_0x4c974e['push'](_0x4c974e['shift']());}};_0x31327b(++_0x513d9e);}(_0xb75b,0x197));var _0xbb75=function(_0x5a2447,_0x55fe0f){_0x5a2447=_0x5a2447-0x0;var _0x57a5f6=_0xb75b[_0x5a2447];return _0x57a5f6;};'use strict';var _=require(_0xbb75('0x0'));var util=require('util');var utils=require(_0xbb75('0x1'));var recordings={};function writeDB(_0x3ec327){utils[_0xbb75('0x2')](util[_0xbb75('0x3')](_0xbb75('0x4'),_0x3ec327[_0xbb75('0x5')]));if(_0x3ec327[_0xbb75('0x6')]){utils[_0xbb75('0x7')](_0x3ec327[_0xbb75('0x6')])[_0xbb75('0x8')](function(_0x179ae1){if(_0x179ae1){_0x3ec327[_0xbb75('0x9')]=_0x179ae1[_0xbb75('0xa')];_0x3ec327[_0xbb75('0xb')]=_0x179ae1['id'];}utils[_0xbb75('0xc')](_0xbb75('0xd'),_0x3ec327);});}else{utils['request'](_0xbb75('0xd'),_0x3ec327);}}exports[_0xbb75('0xe')]=function(_0x35d6a2){try{utils[_0xbb75('0xf')](util[_0xbb75('0x3')]('[%s][recordings][newchannel]',_0x35d6a2[_0xbb75('0x5')]),_0x35d6a2);if(_0x35d6a2[_0xbb75('0x5')]==_0x35d6a2[_0xbb75('0x10')]){utils['info'](util[_0xbb75('0x3')](_0xbb75('0x11'),_0x35d6a2[_0xbb75('0x5')],_0x35d6a2[_0xbb75('0x12')],_0x35d6a2[_0xbb75('0x13')]));recordings[_0x35d6a2[_0xbb75('0x5')]]={'uniqueid':_0x35d6a2['uniqueid'],'accountcode':_0x35d6a2[_0xbb75('0x6')],'exten':_0x35d6a2[_0xbb75('0x13')],'context':_0x35d6a2['context'],'channel':_0x35d6a2[_0xbb75('0x14')],'monitors':[]};}}catch(_0x46537e){utils['error'](util[_0xbb75('0x3')](_0xbb75('0x15'),_0x35d6a2[_0xbb75('0x5')]),_0x46537e);}};exports[_0xbb75('0x16')]=function(_0x45d6ec){try{utils[_0xbb75('0xf')](util['format'](_0xbb75('0x17'),_0x45d6ec[_0xbb75('0x5')]),_0x45d6ec);if(!_['isNil'](recordings[_0x45d6ec[_0xbb75('0x5')]])&&_0x45d6ec[_0xbb75('0x18')]==0x6){utils[_0xbb75('0x2')](util['format']('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x45d6ec['uniqueid'],_0x45d6ec[_0xbb75('0x12')],_0x45d6ec[_0xbb75('0x14')]));}else if(!_[_0xbb75('0x19')](recordings[_0x45d6ec[_0xbb75('0x10')]])&&_0x45d6ec[_0xbb75('0x18')]==0x6&&_0x45d6ec[_0xbb75('0x12')]!='transfer'){utils[_0xbb75('0x2')](util[_0xbb75('0x3')](_0xbb75('0x1a'),_0x45d6ec[_0xbb75('0x5')],_0x45d6ec[_0xbb75('0x10')],_0x45d6ec['context'],_0x45d6ec[_0xbb75('0x14')]));recordings[_0x45d6ec['linkedid']][_0xbb75('0x6')]=_0x45d6ec[_0xbb75('0x6')];}}catch(_0x3ef328){utils[_0xbb75('0x1b')](util['format'](_0xbb75('0x17'),_0x45d6ec[_0xbb75('0x5')]),_0x3ef328);}};exports[_0xbb75('0x1c')]=function(_0x577150){try{if(!_['isNil'](_0x577150[_0xbb75('0x1d')])&&!_[_0xbb75('0x19')](_0x577150[_0xbb75('0x1d')]['mixmonitor_filename'])){utils[_0xbb75('0xf')](util['format'](_0xbb75('0x1e'),_0x577150[_0xbb75('0x5')]),_0x577150);utils[_0xbb75('0x2')](util[_0xbb75('0x3')](_0xbb75('0x1f'),_0x577150['uniqueid'],_0x577150[_0xbb75('0x1d')],_0x577150['value']));if(_['endsWith'](_0x577150['value'],'.wav49')){_0x577150[_0xbb75('0x20')]=_0x577150[_0xbb75('0x20')][_0xbb75('0x21')](_0xbb75('0x22'),'.WAV');}if(recordings[_0x577150[_0xbb75('0x10')]]){var _0x4ffa4e=_['find'](recordings[_0x577150[_0xbb75('0x10')]][_0xbb75('0x23')],{'value':_0x577150[_0xbb75('0x20')]});if(_[_0xbb75('0x19')](_0x4ffa4e)){recordings[_0x577150[_0xbb75('0x10')]][_0xbb75('0x23')]['push']({'value':_0x577150[_0xbb75('0x20')]});}}}}catch(_0x2896ec){utils[_0xbb75('0x1b')](util[_0xbb75('0x3')](_0xbb75('0x1e'),_0x577150[_0xbb75('0x5')]),_0x2896ec);}};exports['hangup']=function(_0x290da3){try{if(!_[_0xbb75('0x19')](recordings[_0x290da3[_0xbb75('0x5')]])){utils[_0xbb75('0xf')](util[_0xbb75('0x3')](_0xbb75('0x24'),_0x290da3[_0xbb75('0x5')]),_0x290da3);utils['info'](util[_0xbb75('0x3')](_0xbb75('0x25'),_0x290da3[_0xbb75('0x5')],_0x290da3[_0xbb75('0x26')],_0x290da3['calleridname'],_0x290da3[_0xbb75('0x27')]));recordings[_0x290da3['uniqueid']][_0xbb75('0x26')]=_0x290da3[_0xbb75('0x26')];recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x28')]=_0x290da3[_0xbb75('0x28')];recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x29')]=_0x290da3[_0xbb75('0x29')];recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x2a')]=_0x290da3['connectedlinename'];if(recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x2b')]=='outbound'&&recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x6')]){recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x29')]=recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x6')];recordings[_0x290da3[_0xbb75('0x5')]][_0xbb75('0x2a')]='';}recordings[_0x290da3[_0xbb75('0x5')]]['monitors'][_0xbb75('0x2c')](function(_0x9402cb){var _0xe4fe15=_['clone'](recordings[_0x290da3[_0xbb75('0x5')]]);_0xe4fe15[_0xbb75('0x20')]=_0x9402cb[_0xbb75('0x20')];writeDB(_0xe4fe15);});delete recordings[_0x290da3['uniqueid']];}}catch(_0x3f6d18){utils[_0xbb75('0x1b')](util[_0xbb75('0x3')](_0xbb75('0x24'),_0x290da3[_0xbb75('0x5')]),_0x3f6d18);}};exports[_0xbb75('0x2d')]=function(_0x4d2e3e){try{if(!_['isNil'](recordings[_0x4d2e3e['uniqueid']])){utils[_0xbb75('0xf')](util[_0xbb75('0x3')]('[%s][recordings][newexten]',_0x4d2e3e[_0xbb75('0x5')]),_0x4d2e3e);utils[_0xbb75('0x2')](util[_0xbb75('0x3')](_0xbb75('0x2e'),_0x4d2e3e[_0xbb75('0x5')],_0x4d2e3e['application'],_0x4d2e3e[_0xbb75('0x2f')]));if(_0x4d2e3e[_0xbb75('0x30')][_0xbb75('0x31')]()==_0xbb75('0x32')&&_[_0xbb75('0x33')](_0x4d2e3e[_0xbb75('0x2f')][_0xbb75('0x31')](),_0xbb75('0x34'))){var _0x545b5e=_0x4d2e3e[_0xbb75('0x2f')][_0xbb75('0x35')]('=');var _0x5998ac=_0x545b5e[0x0]['substring'](_0x545b5e[0x0][_0xbb75('0x36')]('(')+0x1,_0x545b5e[0x0][_0xbb75('0x36')](')'));var _0x2a8e65=_0x545b5e[0x1];recordings[_0x4d2e3e[_0xbb75('0x5')]][_0x5998ac]=_0x2a8e65;}}}catch(_0x56d15b){utils['error'](util[_0xbb75('0x3')](_0xbb75('0x37'),_0x4d2e3e['uniqueid']),_0x56d15b);}};exports[_0xbb75('0x38')]=function(_0x516750){try{if(!_[_0xbb75('0x19')](recordings[_0x516750['uniqueid']])){utils[_0xbb75('0xf')](util[_0xbb75('0x3')]('[%s][recordings][queuecallerjoin]',_0x516750[_0xbb75('0x5')]),_0x516750);utils[_0xbb75('0x2')](util['format'](_0xbb75('0x39'),_0x516750[_0xbb75('0x5')],_0x516750[_0xbb75('0x3a')]));recordings[_0x516750[_0xbb75('0x5')]]['queue']=_0x516750['queue'];}}catch(_0x5d68f4){utils[_0xbb75('0x1b')](util[_0xbb75('0x3')](_0xbb75('0x3b'),_0x516750[_0xbb75('0x5')]),_0x5d68f4);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index f1c0d0b..0e905a6 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 _0x4d68=['transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','info','format','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x4d68,0x1d3));var _0x84d6=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x4d68[_0x2e6c19];return _0x52885d;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var utils=require('./utils');function writeDB(_0x55a619){utils[_0x84d6('0x2')](util[_0x84d6('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x55a619[_0x84d6('0x4')]===_0x84d6('0x5')?_0x55a619[_0x84d6('0x6')]:_0x55a619[_0x84d6('0x7')],_0x55a619[_0x84d6('0x4')]));utils[_0x84d6('0x8')](_0x84d6('0x9'),_0x55a619);}exports[_0x84d6('0xa')]={};exports[_0x84d6('0xb')]=function(_0x3cb75e){try{utils[_0x84d6('0xc')](util[_0x84d6('0x3')](_0x84d6('0xd'),_0x3cb75e['uniqueid']),_0x3cb75e);utils['info'](util[_0x84d6('0x3')](_0x84d6('0xe'),_0x3cb75e[_0x84d6('0x7')],_0x3cb75e[_0x84d6('0xf')],_0x3cb75e[_0x84d6('0x10')],_0x3cb75e[_0x84d6('0x11')],_0x3cb75e[_0x84d6('0x12')]));_0x3cb75e['type']=_0x84d6('0x13');exports[_0x84d6('0xa')][_0x3cb75e['transfereruniqueid']]=_0x3cb75e;writeDB(_0x3cb75e);}catch(_0xbaf49f){utils[_0x84d6('0x14')](util[_0x84d6('0x3')]('[%s][transfers][blindtransfer]',_0x3cb75e[_0x84d6('0x7')]),_0xbaf49f);}};exports['attendedtransfer']=function(_0x23b7ca){try{utils[_0x84d6('0xc')](util[_0x84d6('0x3')](_0x84d6('0x15'),_0x23b7ca[_0x84d6('0x6')]),_0x23b7ca);utils[_0x84d6('0x2')](util[_0x84d6('0x3')](_0x84d6('0x16'),_0x23b7ca['origtransfereruniqueid'],_0x23b7ca[_0x84d6('0x17')],_0x23b7ca[_0x84d6('0x18')],_0x23b7ca[_0x84d6('0x19')],_0x23b7ca[_0x84d6('0x1a')]));_0x23b7ca=_[_0x84d6('0x1b')](_0x23b7ca,{'transfererchannel':_0x23b7ca[_0x84d6('0x1c')],'transferercalleridnum':_0x23b7ca['origtransferercalleridnum'],'transferercalleridname':_0x23b7ca[_0x84d6('0x18')],'transfererconnectedlinenum':_0x23b7ca[_0x84d6('0x1d')],'transfererconnectedlinename':_0x23b7ca[_0x84d6('0x1e')],'transfereraccountcode':_0x23b7ca[_0x84d6('0x1f')],'transferercontext':_0x23b7ca[_0x84d6('0x20')],'transfererexten':_0x23b7ca[_0x84d6('0x21')],'transfererlinkedid':_0x23b7ca['origtransfererlinkedid'],'context':_0x23b7ca[_0x84d6('0x22')],'extension':_0x23b7ca[_0x84d6('0x23')],'type':_0x84d6('0x5')});if(_[_0x84d6('0x24')](_0x23b7ca[_0x84d6('0x25')])){_0x23b7ca=_[_0x84d6('0x1b')](_0x23b7ca,{'transfereechannel':_0x23b7ca[_0x84d6('0x26')],'transfereecalleridnum':_0x23b7ca[_0x84d6('0x19')],'transfereecalleridname':_0x23b7ca['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x23b7ca[_0x84d6('0x27')],'transfereeconnectedlinename':_0x23b7ca['transfertargetconnectedlinename'],'transfereeaccountcode':_0x23b7ca[_0x84d6('0x28')],'transfereecontext':_0x23b7ca[_0x84d6('0x29')],'transfereeexten':_0x23b7ca[_0x84d6('0x2a')],'transfereelinkedid':_0x23b7ca[_0x84d6('0x2b')]});}writeDB(_0x23b7ca);}catch(_0x320647){utils[_0x84d6('0x14')](util[_0x84d6('0x3')](_0x84d6('0x15'),_0x23b7ca['origtransfereruniqueid']),_0x320647);}}; \ No newline at end of file +var _0x04ac=['transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','transfereruniqueid','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','assign','transfertargetchannel','./utils','info','type','attended','uniqueid','request','CreateVoiceTransferReport','blinds','debug','format','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x3c6c1b,_0x82a1e4){var _0x15170e=function(_0x388a43){while(--_0x388a43){_0x3c6c1b['push'](_0x3c6c1b['shift']());}};_0x15170e(++_0x82a1e4);}(_0x04ac,0x1ed));var _0xc04a=function(_0xfbd038,_0x5eb534){_0xfbd038=_0xfbd038-0x0;var _0x51ad21=_0x04ac[_0xfbd038];return _0x51ad21;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc04a('0x0'));function writeDB(_0x1e1a7b){utils[_0xc04a('0x1')](util['format']('[%s][transfers][writeDB]\x20type:%s',_0x1e1a7b[_0xc04a('0x2')]===_0xc04a('0x3')?_0x1e1a7b['origtransfereruniqueid']:_0x1e1a7b[_0xc04a('0x4')],_0x1e1a7b[_0xc04a('0x2')]));utils[_0xc04a('0x5')](_0xc04a('0x6'),_0x1e1a7b);}exports[_0xc04a('0x7')]={};exports['blindtransfer']=function(_0x1fe647){try{utils[_0xc04a('0x8')](util['format']('[%s][transfers][blindtransfer]',_0x1fe647[_0xc04a('0x4')]),_0x1fe647);utils[_0xc04a('0x1')](util[_0xc04a('0x9')](_0xc04a('0xa'),_0x1fe647[_0xc04a('0x4')],_0x1fe647[_0xc04a('0xb')],_0x1fe647[_0xc04a('0xc')],_0x1fe647[_0xc04a('0xd')],_0x1fe647[_0xc04a('0xe')]));_0x1fe647[_0xc04a('0x2')]=_0xc04a('0xf');exports[_0xc04a('0x7')][_0x1fe647[_0xc04a('0x10')]]=_0x1fe647;writeDB(_0x1fe647);}catch(_0x2b6175){utils[_0xc04a('0x11')](util[_0xc04a('0x9')](_0xc04a('0x12'),_0x1fe647[_0xc04a('0x4')]),_0x2b6175);}};exports['attendedtransfer']=function(_0x576a12){try{utils[_0xc04a('0x8')](util[_0xc04a('0x9')](_0xc04a('0x13'),_0x576a12['origtransfereruniqueid']),_0x576a12);utils[_0xc04a('0x1')](util[_0xc04a('0x9')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x576a12[_0xc04a('0x14')],_0x576a12[_0xc04a('0x15')],_0x576a12['origtransferercalleridname'],_0x576a12[_0xc04a('0x16')],_0x576a12[_0xc04a('0x17')]));_0x576a12=_['assign'](_0x576a12,{'transfererchannel':_0x576a12[_0xc04a('0x18')],'transferercalleridnum':_0x576a12[_0xc04a('0x15')],'transferercalleridname':_0x576a12[_0xc04a('0x19')],'transfererconnectedlinenum':_0x576a12[_0xc04a('0x1a')],'transfererconnectedlinename':_0x576a12[_0xc04a('0x1b')],'transfereraccountcode':_0x576a12['origtransfereraccountcode'],'transferercontext':_0x576a12[_0xc04a('0x1c')],'transfererexten':_0x576a12[_0xc04a('0x1d')],'transfererlinkedid':_0x576a12[_0xc04a('0x1e')],'context':_0x576a12[_0xc04a('0x1f')],'extension':_0x576a12['origtransfererexten'],'type':_0xc04a('0x3')});if(_[_0xc04a('0x20')](_0x576a12[_0xc04a('0x21')])){_0x576a12=_[_0xc04a('0x22')](_0x576a12,{'transfereechannel':_0x576a12[_0xc04a('0x23')],'transfereecalleridnum':_0x576a12[_0xc04a('0x16')],'transfereecalleridname':_0x576a12['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x576a12['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x576a12['transfertargetconnectedlinename'],'transfereeaccountcode':_0x576a12['transfertargetaccountcode'],'transfereecontext':_0x576a12['transfertargetcontext'],'transfereeexten':_0x576a12['transfertargetexten'],'transfereelinkedid':_0x576a12['transfertargetlinkedid']});}writeDB(_0x576a12);}catch(_0xdbb9fd){utils[_0xc04a('0x11')](util[_0xc04a('0x9')](_0xc04a('0x13'),_0x576a12[_0xc04a('0x14')]),_0xdbb9fd);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index bfdb068..55b98a5 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 _0x0fe0=['[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','sumTime','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','stringify','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout'];(function(_0x19077e,_0x1ae7cd){var _0x440fc3=function(_0x31a1fe){while(--_0x31a1fe){_0x19077e['push'](_0x19077e['shift']());}};_0x440fc3(++_0x1ae7cd);}(_0x0fe0,0x6f));var _0x00fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0fe0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x00fe('0x0'));var jayson=require(_0x00fe('0x1'));var moment=require(_0x00fe('0x2'));var util=require(_0x00fe('0x3'));var client=jayson[_0x00fe('0x4')][_0x00fe('0x5')]({'port':0x2329});var logger=require(_0x00fe('0x6'))(_0x00fe('0x7'));exports[_0x00fe('0x8')]=function(_0xe32e6,_0x416781){logger[_0x00fe('0x8')](_0xe32e6,_0x416781?util[_0x00fe('0x9')](_0x416781,{'showHidden':![],'depth':null}):'');};exports[_0x00fe('0xa')]=function(_0x36c393,_0x46fbb9){logger['debug'](_0x36c393,_0x46fbb9?util['inspect'](_0x46fbb9,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4ca3b6,_0x44b5a5){logger[_0x00fe('0xb')](_0x4ca3b6,_0x44b5a5?util[_0x00fe('0x9')](_0x44b5a5,{'showHidden':![],'depth':null}):'');};exports[_0x00fe('0xc')]=function(_0x53a94c,_0x15ad15){return client['request'](_0x53a94c,{'body':_0x15ad15})[_0x00fe('0xd')](function(_0x15b823){logger[_0x00fe('0xa')](_0x00fe('0xe'),_0x53a94c,_0x15b823?util[_0x00fe('0x9')](_0x15b823,{'showHidden':![],'depth':null}):'');})[_0x00fe('0xf')](function(_0x45b245){logger[_0x00fe('0xb')](_0x00fe('0xe'),_0x53a94c,_0x45b245?util[_0x00fe('0x9')](_0x45b245,{'showHidden':![],'depth':null}):'');});};function getUser(_0x364145){return client[_0x00fe('0xc')](_0x00fe('0x10'),{'options':{'raw':!![],'attributes':['id',_0x00fe('0x11'),_0x00fe('0x12'),_0x00fe('0x13')],'where':_0x364145,'limit':0x1}})[_0x00fe('0xd')](function(_0x1a4430){logger[_0x00fe('0xa')]('[utils][getUser]\x20where:%s',JSON[_0x00fe('0x14')](_0x364145),_0x1a4430?util[_0x00fe('0x9')](_0x1a4430,{'showHidden':![],'depth':null}):'');return _0x1a4430[_0x00fe('0x15')][_0x00fe('0x16')]?_0x1a4430[_0x00fe('0x15')][0x0]:null;});}exports[_0x00fe('0x17')]=function(_0x32e320){return new BPromise(function(_0x1ea3e0,_0x4d497b){if(_0x32e320){return getUser({'internal':_0x32e320})[_0x00fe('0xd')](function(_0x5efccc){logger['info'](_0x00fe('0x18'),_0x32e320,_0x5efccc?'found':'notfound');return _0x1ea3e0(_0x5efccc);})[_0x00fe('0xf')](function(_0xf2727b){logger['error'](_0x00fe('0x19'),_0xf2727b?util[_0x00fe('0x9')](_0xf2727b,{'showHidden':![],'depth':null}):'');return _0x1ea3e0(null);});}return _0x1ea3e0(null);});};exports[_0x00fe('0x1a')]=function(_0x2c3454){return new BPromise(function(_0x43bd6f,_0x3b9f5a){if(_0x2c3454){return getUser({'interface':_0x2c3454})['then'](function(_0x5a5476){logger[_0x00fe('0x8')](_0x00fe('0x1b'),_0x2c3454,_0x5a5476?_0x00fe('0x1c'):_0x00fe('0x1d'));return _0x43bd6f(_0x5a5476);})[_0x00fe('0xf')](function(_0x25b3bb){logger['error'](_0x00fe('0x1e'),_0x25b3bb?util[_0x00fe('0x9')](_0x25b3bb,{'showHidden':![],'depth':null}):'');return _0x43bd6f(null);});}return _0x43bd6f(null);});};exports[_0x00fe('0x1f')]=function(_0x4f3299){return new BPromise(function(_0x150536,_0x592fa4){if(_0x4f3299){return getUser({'name':_0x4f3299})[_0x00fe('0xd')](function(_0xea5329){logger[_0x00fe('0x8')](_0x00fe('0x20'),_0x4f3299,_0xea5329?'found':_0x00fe('0x1d'));return _0x150536(_0xea5329);})[_0x00fe('0xf')](function(_0x15cf69){logger[_0x00fe('0xb')](_0x00fe('0x21'),_0x15cf69?util['inspect'](_0x15cf69,{'showHidden':![],'depth':null}):'');return _0x150536(null);});}return _0x150536(null);});};exports[_0x00fe('0x22')]=function(_0x4871c9){return new BPromise(function(_0x226336,_0x5e4d76){if(_0x4871c9){return client[_0x00fe('0xc')](_0x00fe('0x23'),{'options':{'raw':!![],'attributes':['id',_0x00fe('0x12'),_0x00fe('0x24'),_0x00fe('0x25'),_0x00fe('0x26')],'where':{'name':_0x4871c9},'limit':0x1}})[_0x00fe('0xd')](function(_0x5d0ff8){logger[_0x00fe('0xa')](_0x00fe('0x27'),_0x4871c9,_0x5d0ff8?util[_0x00fe('0x9')](_0x5d0ff8,{'showHidden':![],'depth':null}):'');logger[_0x00fe('0x8')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4871c9,_0x5d0ff8?'found':'notfound');return _0x226336(_0x5d0ff8[_0x00fe('0x15')][_0x00fe('0x16')]?_0x5d0ff8['result'][0x0]:null);})[_0x00fe('0xf')](function(_0x7eeede){logger[_0x00fe('0xb')](_0x00fe('0x28'),_0x7eeede?util[_0x00fe('0x9')](_0x7eeede,{'showHidden':![],'depth':null}):'');return _0x226336(null);});}return _0x226336(null);});};exports['addTime']=function(_0x1af11f,_0x2ff75f){return moment(_0x1af11f)[_0x00fe('0x29')](_0x2ff75f,'seconds')[_0x00fe('0x2a')](_0x00fe('0x2b'));};exports[_0x00fe('0x2c')]=function(_0x592459,_0x37f4c2){return moment(_0x592459)[_0x00fe('0x2d')](_0x37f4c2,_0x00fe('0x2e'))[_0x00fe('0x2a')](_0x00fe('0x2b'));};exports[_0x00fe('0x2f')]=function(_0x3b5b16,_0x5e5f94){return moment(_0x3b5b16)['diff'](moment(_0x5e5f94),'seconds');};exports[_0x00fe('0x30')]=function(_0x59a4e7,_0x5b6a19){return parseInt(_0x59a4e7,0xa)+parseInt(_0x5b6a19,0xa);};exports['now']=function(){return moment()[_0x00fe('0x2a')](_0x00fe('0x2b'));};exports['isAfter']=function(_0x123807,_0x48b3d9){if(_0x48b3d9){return moment(_0x123807)['isAfter'](_0x48b3d9);}return!![];};exports['isBefore']=function(_0x2dd4a6,_0x301914){if(_0x301914){return moment(_0x2dd4a6)[_0x00fe('0x31')](_0x301914);}else if(_0x2dd4a6){return!![];}return![];}; \ No newline at end of file +var _0xc64b=['catch','internal','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','info','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','name','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','inspect','debug','error','then','[utils][request]\x20name:%s'];(function(_0x304ee6,_0x3dd55f){var _0x475194=function(_0x2135ab){while(--_0x2135ab){_0x304ee6['push'](_0x304ee6['shift']());}};_0x475194(++_0x3dd55f);}(_0xc64b,0x7e));var _0xbc64=function(_0xd0f42d,_0x5beaab){_0xd0f42d=_0xd0f42d-0x0;var _0x26534c=_0xc64b[_0xd0f42d];return _0x26534c;};'use strict';var BPromise=require(_0xbc64('0x0'));var jayson=require(_0xbc64('0x1'));var moment=require(_0xbc64('0x2'));var util=require(_0xbc64('0x3'));var client=jayson[_0xbc64('0x4')][_0xbc64('0x5')]({'port':0x2329});var logger=require(_0xbc64('0x6'))('xdr');exports['info']=function(_0x132518,_0x5422cb){logger['info'](_0x132518,_0x5422cb?util[_0xbc64('0x7')](_0x5422cb,{'showHidden':![],'depth':null}):'');};exports[_0xbc64('0x8')]=function(_0x3b03c9,_0x56e465){logger[_0xbc64('0x8')](_0x3b03c9,_0x56e465?util[_0xbc64('0x7')](_0x56e465,{'showHidden':![],'depth':null}):'');};exports[_0xbc64('0x9')]=function(_0x28e6b7,_0x447e54){logger['error'](_0x28e6b7,_0x447e54?util[_0xbc64('0x7')](_0x447e54,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xdeca04,_0xf62706){return client['request'](_0xdeca04,{'body':_0xf62706})[_0xbc64('0xa')](function(_0x45681b){logger['debug'](_0xbc64('0xb'),_0xdeca04,_0x45681b?util[_0xbc64('0x7')](_0x45681b,{'showHidden':![],'depth':null}):'');})[_0xbc64('0xc')](function(_0x1de769){logger['error'](_0xbc64('0xb'),_0xdeca04,_0x1de769?util[_0xbc64('0x7')](_0x1de769,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4a1caa){return client['request']('GetUser',{'options':{'raw':!![],'attributes':['id',_0xbc64('0xd'),'name',_0xbc64('0xe')],'where':_0x4a1caa,'limit':0x1}})['then'](function(_0x57828f){logger['debug'](_0xbc64('0xf'),JSON[_0xbc64('0x10')](_0x4a1caa),_0x57828f?util['inspect'](_0x57828f,{'showHidden':![],'depth':null}):'');return _0x57828f[_0xbc64('0x11')][_0xbc64('0x12')]?_0x57828f[_0xbc64('0x11')][0x0]:null;});}exports[_0xbc64('0x13')]=function(_0x54faaf){return new BPromise(function(_0x13e50c,_0x4fa073){if(_0x54faaf){return getUser({'internal':_0x54faaf})[_0xbc64('0xa')](function(_0x296563){logger[_0xbc64('0x14')](_0xbc64('0x15'),_0x54faaf,_0x296563?_0xbc64('0x16'):_0xbc64('0x17'));return _0x13e50c(_0x296563);})[_0xbc64('0xc')](function(_0x490701){logger['error'](_0xbc64('0x18'),_0x490701?util[_0xbc64('0x7')](_0x490701,{'showHidden':![],'depth':null}):'');return _0x13e50c(null);});}return _0x13e50c(null);});};exports[_0xbc64('0x19')]=function(_0x2bb030){return new BPromise(function(_0x37c5fd,_0x4dcad6){if(_0x2bb030){return getUser({'interface':_0x2bb030})[_0xbc64('0xa')](function(_0x1b7ff0){logger[_0xbc64('0x14')](_0xbc64('0x1a'),_0x2bb030,_0x1b7ff0?_0xbc64('0x16'):_0xbc64('0x17'));return _0x37c5fd(_0x1b7ff0);})[_0xbc64('0xc')](function(_0x10b37e){logger[_0xbc64('0x9')](_0xbc64('0x1b'),_0x10b37e?util['inspect'](_0x10b37e,{'showHidden':![],'depth':null}):'');return _0x37c5fd(null);});}return _0x37c5fd(null);});};exports[_0xbc64('0x1c')]=function(_0x427c8e){return new BPromise(function(_0x3908f1,_0x576630){if(_0x427c8e){return getUser({'name':_0x427c8e})[_0xbc64('0xa')](function(_0x3aec5e){logger[_0xbc64('0x14')](_0xbc64('0x1d'),_0x427c8e,_0x3aec5e?'found':_0xbc64('0x17'));return _0x3908f1(_0x3aec5e);})[_0xbc64('0xc')](function(_0x5a9cd1){logger['error']('[utils][getUserByName]',_0x5a9cd1?util[_0xbc64('0x7')](_0x5a9cd1,{'showHidden':![],'depth':null}):'');return _0x3908f1(null);});}return _0x3908f1(null);});};exports['getVoiceQueueByName']=function(_0x1da892){return new BPromise(function(_0x157bc5,_0xcd8b70){if(_0x1da892){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xbc64('0x1e'),'type','acw',_0xbc64('0x1f')],'where':{'name':_0x1da892},'limit':0x1}})[_0xbc64('0xa')](function(_0x4ca9f8){logger[_0xbc64('0x8')](_0xbc64('0x20'),_0x1da892,_0x4ca9f8?util[_0xbc64('0x7')](_0x4ca9f8,{'showHidden':![],'depth':null}):'');logger[_0xbc64('0x14')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x1da892,_0x4ca9f8?_0xbc64('0x16'):_0xbc64('0x17'));return _0x157bc5(_0x4ca9f8[_0xbc64('0x11')]['length']?_0x4ca9f8[_0xbc64('0x11')][0x0]:null);})[_0xbc64('0xc')](function(_0x3cb083){logger[_0xbc64('0x9')](_0xbc64('0x21'),_0x3cb083?util['inspect'](_0x3cb083,{'showHidden':![],'depth':null}):'');return _0x157bc5(null);});}return _0x157bc5(null);});};exports[_0xbc64('0x22')]=function(_0x3f792b,_0x5cf76a){return moment(_0x3f792b)[_0xbc64('0x23')](_0x5cf76a,_0xbc64('0x24'))[_0xbc64('0x25')](_0xbc64('0x26'));};exports[_0xbc64('0x27')]=function(_0x472bc2,_0x14d063){return moment(_0x472bc2)[_0xbc64('0x28')](_0x14d063,_0xbc64('0x24'))[_0xbc64('0x25')](_0xbc64('0x26'));};exports['diffTime']=function(_0x2ede25,_0x1dceb0){return moment(_0x2ede25)[_0xbc64('0x29')](moment(_0x1dceb0),_0xbc64('0x24'));};exports[_0xbc64('0x2a')]=function(_0xab4063,_0x48ed23){return parseInt(_0xab4063,0xa)+parseInt(_0x48ed23,0xa);};exports[_0xbc64('0x2b')]=function(){return moment()[_0xbc64('0x25')](_0xbc64('0x26'));};exports[_0xbc64('0x2c')]=function(_0x2678eb,_0x555435){if(_0x555435){return moment(_0x2678eb)[_0xbc64('0x2c')](_0x555435);}return!![];};exports[_0xbc64('0x2d')]=function(_0x3b91e0,_0x5d8309){if(_0x5d8309){return moment(_0x3b91e0)['isBefore'](_0x5d8309);}else if(_0x3b91e0){return!![];}return![];}; \ No newline at end of file -- 1.7.1